"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const eventType = require("./utils/event-type.js");
const types = require("../render/utils/types.js");
const usePointerEvent = require("../events/use-pointer-event.js");
const lock = require("./drag/utils/lock.js");
function createHoverEvent(visualElement, isActive, callback) {
  return function(event, info) {
    var _a;
    if (!eventType.isMouseEvent(event) || lock.isDragActive())
      return;
    (_a = visualElement.animationState) === null || _a === void 0 ? void 0 : _a.setActive(types.AnimationType.Hover, isActive);
    callback === null || callback === void 0 ? void 0 : callback(event, info);
  };
}
function useHoverGesture(_a) {
  var onHoverStart = _a.onHoverStart, onHoverEnd = _a.onHoverEnd, whileHover = _a.whileHover, visualElement = _a.visualElement;
  usePointerEvent.usePointerEvent(visualElement, "pointerenter", onHoverStart || whileHover ? createHoverEvent(visualElement, true, onHoverStart) : void 0, { passive: !onHoverStart });
  usePointerEvent.usePointerEvent(visualElement, "pointerleave", onHoverEnd || whileHover ? createHoverEvent(visualElement, false, onHoverEnd) : void 0, { passive: !onHoverEnd });
}
exports.useHoverGesture = useHoverGesture;
//# sourceMappingURL=use-hover-gesture.js.map
