import { useEffect as n } from "react";
const c = (r, t) => {
  const s = typeof window < "u" && "ResizeObserver" in window;
  let e;
  const o = () => {
    e && (e.disconnect(), e = void 0);
  };
  return n(() => {
    if (!(!r || !s))
      return e = new ResizeObserver(t), e.observe(r), () => {
        o();
      };
  }, [r, s]), {
    isSupported: s,
    stop: () => {
      o();
    }
  };
};
export {
  c as default
};
