{
  "name": "cai-animated-brain",
  "type": "registry:ui",
  "description": "cai-animated-brain component for the Canadian AI design system",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "components/lucide-animated/brain.tsx",
      "target": "@components/lucide-animated/cai-animated-brain.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 BrainIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface BrainIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst BRAIN_STEM_VARIANTS: Variants = {\n  normal: { pathLength: 1, pathOffset: 0 },\n  animate: {\n    pathLength: [1, 0.4, 1],\n    pathOffset: [0, 0.25, 0],\n    transition: {\n      duration: 1.4,\n      repeat: Number.POSITIVE_INFINITY,\n      repeatType: \"mirror\",\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst BRAIN_SIDE_VARIANTS: Variants = {\n  normal: { pathLength: 1, pathOffset: 0 },\n  animate: {\n    pathLength: [1, 0.5, 1],\n    pathOffset: [0, 0.25, 0],\n    transition: {\n      duration: 1.4,\n      repeat: Number.POSITIVE_INFINITY,\n      repeatType: \"mirror\",\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst BRAIN_TOP_ARC_VARIANTS: Variants = {\n  normal: { pathLength: 1, pathOffset: 0 },\n  animate: {\n    pathLength: [1, 0.8, 1],\n    pathOffset: [0, 0.07, 0],\n    transition: {\n      duration: 1.4,\n      repeat: Number.POSITIVE_INFINITY,\n      repeatType: \"mirror\",\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst BRAIN_LOWER_ARC_VARIANTS: Variants = {\n  normal: { pathLength: 1, pathOffset: 0 },\n  animate: {\n    pathLength: [1, 0.8, 1],\n    pathOffset: [0, 0.14, 0],\n    transition: {\n      duration: 1.4,\n      repeat: Number.POSITIVE_INFINITY,\n      repeatType: \"mirror\",\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst BrainIcon = forwardRef<BrainIconHandle, BrainIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 20, ...props }, ref) => {\n    const controls = useAnimation();\n    const isControlledRef = useRef(false);\n\n    useImperativeHandle(ref, () => {\n      isControlledRef.current = true;\n\n      return {\n        startAnimation: () => controls.start(\"animate\"),\n        stopAnimation: () => controls.start(\"normal\"),\n      };\n    });\n\n    const handleMouseEnter = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseEnter?.(e);\n        } else {\n          controls.start(\"animate\");\n        }\n      },\n      [controls, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: React.MouseEvent<HTMLDivElement>) => {\n        if (isControlledRef.current) {\n          onMouseLeave?.(e);\n        } else {\n          controls.start(\"normal\");\n        }\n      },\n      [controls, onMouseLeave]\n    );\n\n    return (\n      <div\n        className={cn(className)}\n        onMouseEnter={handleMouseEnter}\n        onMouseLeave={handleMouseLeave}\n        {...props}\n      >\n        <motion.svg\n          animate={controls}\n          fill=\"none\"\n          height={size}\n          stroke=\"currentColor\"\n          strokeLinecap=\"round\"\n          strokeLinejoin=\"round\"\n          strokeWidth={1.5}\n          variants={{\n            normal: {\n              scale: 1,\n              strokeWidth: 2,\n            },\n            animate: {\n              scale: [1, 1.08, 1],\n              strokeWidth: [2, 2.25, 2],\n              transition: {\n                duration: 1.4,\n                repeat: Number.POSITIVE_INFINITY,\n                repeatType: \"mirror\",\n                ease: \"easeInOut\",\n              },\n            },\n          }}\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.path\n            animate={controls}\n            d=\"M12 18V5\"\n            variants={BRAIN_STEM_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            d=\"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4\"\n            variants={BRAIN_SIDE_VARIANTS}\n          />\n\n          <motion.path\n            animate={controls}\n            d=\"M12 5A3 3 0 1 1 17.598 6.5\"\n            variants={BRAIN_TOP_ARC_VARIANTS}\n          />\n          <motion.path\n            animate={controls}\n            d=\"M12 5A3 3 0 1 0 6.402 6.5\"\n            variants={BRAIN_TOP_ARC_VARIANTS}\n          />\n\n          <path d=\"M17.997 5.125a4 4 0 0 1 2.526 5.77\" />\n\n          <motion.path\n            animate={controls}\n            d=\"M18 18a4 4 0 0 0 2-7.464\"\n            variants={BRAIN_LOWER_ARC_VARIANTS}\n          />\n\n          <path d=\"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517\" />\n\n          <motion.path\n            animate={controls}\n            d=\"M6 18a4 4 0 0 1-2-7.464\"\n            variants={BRAIN_LOWER_ARC_VARIANTS}\n          />\n          <path d=\"M6.003 5.125a4 4 0 0 0-2.526 5.77\" />\n        </motion.svg>\n      </div>\n    );\n  }\n);\n\nBrainIcon.displayName = \"BrainIcon\";\n\nexport { BrainIcon };\n",
      "type": "registry:ui"
    }
  ]
}