{
  "name": "cai-animated-heart-pulse",
  "type": "registry:ui",
  "description": "cai-animated-heart-pulse component for the Canadian AI design system",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "components/lucide-animated/heart-pulse.tsx",
      "target": "@components/lucide-animated/cai-animated-heart-pulse.tsx",
      "content": "/*\nMIT License\n\nCopyright (c) 2024-2026 pqoqubbw\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n*/\n\"use client\";\n\nimport type { Variants } from \"motion/react\";\nimport { motion, useAnimation } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface HeartPulseIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface HeartPulseIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst HEART_DRAW_VARIANTS: Variants = {\n  normal: { pathLength: 1, opacity: 1 },\n  hidden: { pathLength: 0, opacity: 0 },\n  draw: { pathLength: [0, 1], opacity: [0, 1] },\n};\n\nconst HEART_PULSE_VARIANTS: Variants = {\n  normal: { scale: 1 },\n  pulse: { scale: [1, 1.08, 1] },\n};\n\nconst LINE_VARIANTS: Variants = {\n  normal: { pathLength: 1, pathOffset: 0, opacity: 1 },\n  animate: { pathLength: [0, 1], pathOffset: [1, 0], opacity: [0, 1] },\n};\n\nconst HeartPulseIcon = forwardRef<HeartPulseIconHandle, HeartPulseIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 20, ...props }, ref) => {\n    const heartDrawControls = useAnimation();\n    const heartPulseControls = useAnimation();\n    const lineControls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    const startAnimation = useCallback(async () => {\n      heartDrawControls.start(\"hidden\", { duration: 0 });\n      await lineControls.start(\"animate\", {\n        duration: 0.6,\n        ease: \"linear\",\n        opacity: { duration: 0.1 },\n      });\n      await heartDrawControls.start(\"draw\", {\n        duration: 0.5,\n        ease: \"easeOut\",\n        opacity: { duration: 0.1 },\n      });\n      heartPulseControls.start(\"pulse\", {\n        duration: 0.9,\n        repeat: 1,\n        ease: \"easeInOut\",\n      });\n    }, [heartDrawControls, heartPulseControls, lineControls]);\n\n    const stopAnimation = useCallback(() => {\n      heartDrawControls.start(\"normal\", { duration: 0.3 });\n      heartPulseControls.start(\"normal\", { duration: 0.3 });\n      lineControls.start(\"normal\", { duration: 0.3 });\n    }, [heartDrawControls, heartPulseControls, lineControls]);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n      return { startAnimation, stopAnimation };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          startAnimation();\n        }\n      },\n      [startAnimation, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          stopAnimation();\n        }\n      },\n      [stopAnimation, onMouseLeave]\n    );\n\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <svg\n          fill=\"none\"\n          height={size}\n          stroke=\"currentColor\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          strokeWidth={1.5}\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.g\n            animate={heartPulseControls}\n            style={{ originX: \"12px\", originY: \"12px\" }}\n            variants={HEART_PULSE_VARIANTS}\n          >\n            <motion.path\n              animate={heartDrawControls}\n              d=\"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5\"\n              variants={HEART_DRAW_VARIANTS}\n            />\n          </motion.g>\n          <motion.path\n            animate={lineControls}\n            d=\"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27\"\n            variants={LINE_VARIANTS}\n          />\n        </svg>\n      </div>\n    );\n  }\n);\n\nHeartPulseIcon.displayName = \"HeartPulseIcon\";\n\nexport { HeartPulseIcon };\n",
      "type": "registry:ui"
    }
  ]
}