{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chess-knight",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "chess-knight.tsx",
      "content": "\"use client\";\n\nimport { motion, useAnimation, type Variants } from \"motion/react\";\nimport type { HTMLAttributes, MouseEvent } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface ChessKnightIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface ChessKnightIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst KNIGHT_VARIANTS: Variants = {\n  normal: {\n    rotate: 0,\n    y: 0,\n    transition: {\n      type: \"spring\",\n      stiffness: 220,\n      damping: 12,\n    },\n  },\n  animate: {\n    rotate: [0, 12, 38, 42, 38, 10, -5, 0],\n    y: [0, -2, -9, -12, -9, -2, 1, 0],\n    transition: {\n      duration: 0.9,\n      times: [0, 0.1, 0.3, 0.45, 0.6, 0.78, 0.9, 1],\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst ChessKnightIcon = forwardRef<ChessKnightIconHandle, ChessKnightIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {\n    const controls = useAnimation();\n    const isControlled = !!ref;\n\n    useImperativeHandle(\n      ref,\n      () => ({\n        startAnimation: () => controls.start(\"animate\"),\n        stopAnimation: () => controls.start(\"normal\"),\n      }),\n      [controls]\n    );\n\n    const handleMouseEnter = useCallback(\n      (e: MouseEvent<HTMLDivElement>) => {\n        if (isControlled) {\n          onMouseEnter?.(e);\n        } else {\n          controls.start(\"animate\");\n        }\n      },\n      [controls, isControlled, onMouseEnter]\n    );\n\n    const handleMouseLeave = useCallback(\n      (e: MouseEvent<HTMLDivElement>) => {\n        if (isControlled) {\n          onMouseLeave?.(e);\n        } else {\n          controls.start(\"normal\");\n        }\n      },\n      [controls, isControlled, 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=\"2\"\n          style={{ overflow: \"visible\" }}\n          viewBox=\"0 0 24 24\"\n          width={size}\n          xmlns=\"http://www.w3.org/2000/svg\"\n        >\n          <motion.g\n            animate={controls}\n            initial=\"normal\"\n            style={{ transformBox: \"view-box\", transformOrigin: \"12px 22px\" }}\n            variants={KNIGHT_VARIANTS}\n          >\n            <path d=\"M5 20a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1z\" />\n            <path d=\"M16.5 18c1-2 2.5-5 2.5-9a7 7 0 0 0-7-7H6.635a1 1 0 0 0-.768 1.64L7 5l-2.32 5.802a2 2 0 0 0 .95 2.526l2.87 1.456\" />\n            <path d=\"m15 5 1.425-1.425\" />\n            <path d=\"m17 8 1.53-1.53\" />\n            <path d=\"M9.713 12.185 7 18\" />\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nChessKnightIcon.displayName = \"ChessKnightIcon\";\n\nexport { ChessKnightIcon };\n",
      "type": "registry:ui"
    }
  ]
}
