"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.useNodeHovered = void 0;
const react_1 = require("react");
const hooks_1 = require("./hooks.js");
const useNodeHovered = (nodeRef) => {
    const [nodeHovered, setNodeHovered, unsetNodeHovered] = (0, hooks_1.useBooleanState)(false);
    (0, react_1.useEffect)(() => {
        const { current: anchor } = nodeRef;
        anchor?.addEventListener('mouseenter', setNodeHovered);
        anchor?.addEventListener('mouseleave', unsetNodeHovered);
        return () => {
            anchor?.removeEventListener('mouseenter', setNodeHovered);
            anchor?.removeEventListener('mouseleave', unsetNodeHovered);
        };
        // https://github.com/facebook/react/issues/23392#issuecomment-1055610198
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [nodeRef.current, setNodeHovered, unsetNodeHovered]);
    return nodeHovered;
};
exports.useNodeHovered = useNodeHovered;
//# sourceMappingURL=useNodeHovered.js.map
