import { useEffect, useRef, useState } from "react";
const usePseudoClasses = (ref) => {
	const internalRef = useRef(null);
	const refObject = ref ?? internalRef;
	const [isHovered, setIsHovered] = useState(false);
	const [isFocused, setIsFocused] = useState(false);
	const [isActive, setIsActive] = useState(false);
	useEffect(() => {
		const handleMouseEnter = () => setIsHovered(true);
		const handleMouseLeave = () => setIsHovered(false);
		const handleFocusIn = () => setIsFocused(true);
		const handleFocusOut = () => setIsFocused(false);
		const handlePointerDown = () => setIsActive(true);
		const handlePointerUp = () => setIsActive(false);
		const handlePointerLeave = () => setIsActive(false);
		refObject.current?.addEventListener("mouseenter", handleMouseEnter);
		refObject.current?.addEventListener("mouseleave", handleMouseLeave);
		refObject.current?.addEventListener("pointerenter", handleMouseEnter);
		refObject.current?.addEventListener("pointerleave", handleMouseLeave);
		refObject.current?.addEventListener("focusin", handleFocusIn);
		refObject.current?.addEventListener("focusout", handleFocusOut);
		refObject.current?.addEventListener("pointerdown", handlePointerDown);
		refObject.current?.addEventListener("pointerup", handlePointerUp);
		refObject.current?.addEventListener("pointerleave", handlePointerLeave);
		return () => {
			refObject.current?.removeEventListener("mouseenter", handleMouseEnter);
			refObject.current?.removeEventListener("mouseleave", handleMouseLeave);
			refObject.current?.removeEventListener("pointerenter", handleMouseEnter);
			refObject.current?.removeEventListener("pointerleave", handleMouseLeave);
			refObject.current?.removeEventListener("focusin", handleFocusIn);
			refObject.current?.removeEventListener("focusout", handleFocusOut);
			refObject.current?.removeEventListener("pointerdown", handlePointerDown);
			refObject.current?.removeEventListener("pointerup", handlePointerUp);
			refObject.current?.removeEventListener("pointerleave", handlePointerLeave);
		};
	}, [refObject]);
	return {
		refObject,
		isHovered,
		isFocused,
		isActive
	};
};
export { usePseudoClasses as t };

//# sourceMappingURL=usePseudoClasses.js.map