{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chess-king",
  "type": "registry:ui",
  "registryDependencies": [],
  "dependencies": ["motion"],
  "devDependencies": [],
  "files": [
    {
      "path": "chess-king.tsx",
      "content": "\"use client\";\n\nimport { motion, useAnimation, type Variants } from \"motion/react\";\nimport type { HTMLAttributes } from \"react\";\nimport { forwardRef, useCallback, useImperativeHandle, useRef } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport interface ChessKingIconHandle {\n  startAnimation: () => void;\n  stopAnimation: () => void;\n}\n\ninterface ChessKingIconProps extends HTMLAttributes<HTMLDivElement> {\n  size?: number;\n}\n\nconst KING_VARIANTS: Variants = {\n  normal: {\n    rotate: 0,\n    y: 0,\n    transition: {\n      type: \"spring\",\n      stiffness: 160,\n      damping: 14,\n    },\n  },\n  animate: {\n    rotate: [0, -10, 10, -6, 6, -2, 0],\n    y: [0, -3, -3, -2, -2, -1, 0],\n    transition: {\n      duration: 1.1,\n      times: [0, 0.18, 0.38, 0.55, 0.7, 0.85, 1],\n      ease: \"easeInOut\",\n    },\n  },\n};\n\nconst ChessKingIcon = forwardRef<ChessKingIconHandle, ChessKingIconProps>(\n  ({ onMouseEnter, onMouseLeave, className, size = 28, ...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        <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={KING_VARIANTS}\n          >\n            <path d=\"M4 20a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1z\" />\n            <path d=\"m6.7 18-1-1C4.35 15.682 3 14.09 3 12a5 5 0 0 1 4.95-5c1.584 0 2.7.455 4.05 1.818C13.35 7.455 14.466 7 16.05 7A5 5 0 0 1 21 12c0 2.082-1.359 3.673-2.7 5l-1 1\" />\n            <path d=\"M10 4h4\" />\n            <path d=\"M12 2v6.818\" />\n          </motion.g>\n        </svg>\n      </div>\n    );\n  }\n);\n\nChessKingIcon.displayName = \"ChessKingIcon\";\n\nexport { ChessKingIcon };\n",
      "type": "registry:ui"
    }
  ]
}
