"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var useHoverDirty_1 = tslib_1.__importDefault(require("./useHoverDirty")); var useMouse_1 = tslib_1.__importDefault(require("./useMouse")); var nullRef = { current: null }; var useMouseHovered = function (ref, options) { if (options === void 0) { options = {}; } var whenHovered = !!options.whenHovered; var bound = !!options.bound; var isHovered = useHoverDirty_1.default(ref, whenHovered); var state = useMouse_1.default(whenHovered && !isHovered ? nullRef : ref); if (bound) { state.elX = Math.max(0, Math.min(state.elX, state.elW)); state.elY = Math.max(0, Math.min(state.elY, state.elH)); } return state; }; exports.default = useMouseHovered;