import { useEffect } from 'react';
export var useMouseEvents = function useMouseEvents(ref, pointerEvents, handleMouseEnter, handleMouseLeave) {
  useEffect(function () {
    var node = ref === null || ref === void 0 ? void 0 : ref.current;
    if (ref && node && pointerEvents && handleMouseEnter && handleMouseLeave) {
      node === null || node === void 0 || node.addEventListener('mouseenter', handleMouseEnter);
      node === null || node === void 0 || node.addEventListener('mouseleave', handleMouseLeave);
      node === null || node === void 0 || node.addEventListener('mousedown', function (evt) {
        return evt.stopPropagation();
      });
    }
    return function () {
      if (ref && node && pointerEvents && handleMouseEnter && handleMouseLeave) {
        node === null || node === void 0 || node.removeEventListener('mouseenter', handleMouseEnter);
        node === null || node === void 0 || node.removeEventListener('mouseleave', handleMouseLeave);
        node === null || node === void 0 || node.removeEventListener('mousedown', function (evt) {
          return evt.stopPropagation();
        });
      }
    };
  }, [ref, pointerEvents, handleMouseEnter, handleMouseLeave]);
};