import { useEffect as c } from "react";
function i(e, n, s) {
  c(() => {
    const t = (o) => {
      const r = e?.current, u = s?.current;
      !r || r.contains(o.target) || u || n(o);
    };
    return document.addEventListener("mousedown", t), document.addEventListener("touchstart", t), () => {
      document.removeEventListener("mousedown", t), document.removeEventListener("touchstart", t);
    };
  }, [e, n]);
}
export {
  i as default
};
