'use strict';

var events = require('../../../../../../@ariakit_core@0.4.15/node_modules/@ariakit/core/esm/utils/events.cjs');
var React = require('react');

function usePreviousMouseDownRef(enabled) {
  const previousMouseDownRef = React.useRef();
  React.useEffect(() => {
    if (!enabled) {
      previousMouseDownRef.current = null;
      return;
    }
    const onMouseDown = (event) => {
      previousMouseDownRef.current = event.target;
    };
    return events.addGlobalEventListener("mousedown", onMouseDown, true);
  }, [enabled]);
  return previousMouseDownRef;
}

exports.usePreviousMouseDownRef = usePreviousMouseDownRef;
//# sourceMappingURL=HLTQOHKZ.cjs.map
