import { useEffect as u } from "react";
function i(t, e) {
  u(() => {
    function n(r) {
      !t || !t.current || t.current.contains(r.target) || e(r);
    }
    return document.addEventListener("click", n, !0), () => {
      document.removeEventListener("click", n, !0);
    };
  }, [t, e]);
}
export {
  i as default
};
