import { useState as i, useEffect as o } from "react";
const b = (e, r = { rootMargin: "0px" }) => {
  const [n, s] = i(!1);
  return o(() => {
    if (!e.current)
      return;
    const c = ([u]) => s(u.isIntersecting), t = new IntersectionObserver(c, r);
    return t.observe(e.current), () => {
      e.current && t.unobserve(e.current);
    };
  }, [e, r]), n;
};
export {
  b as default
};
//# sourceMappingURL=useOnScreen.js.map
