// src/hooks/useOutsideClick.ts
import { useEffect } from "react";
var useOutsideClick = (refs, handler) => {
  useEffect(() => {
    const listener = (event) => {
      if (event.target === null) return;
      if (refs.some((ref) => !ref.current || ref.current.contains(event.target))) {
        return;
      }
      handler();
    };
    document.addEventListener("mousedown", listener);
    document.addEventListener("touchstart", listener);
    return () => {
      document.removeEventListener("mousedown", listener);
      document.removeEventListener("touchstart", listener);
    };
  }, [refs, handler]);
};
export {
  useOutsideClick
};
//# sourceMappingURL=useOutsideClick.js.map