import { useRef as a, useCallback as f, useEffect as o } from "react";
const b = (e, u, i = []) => {
  const n = a(null), t = f(() => {
    if (!e.current)
      return;
    Array.from(e.current.children).forEach((r) => {
      const s = Number.parseInt(r.getAttribute("data-index") || "", 10);
      Number.isNaN(s) || u(s, r);
    });
  }, [u]);
  o(() => {
    if (e.current)
      return n.current = new ResizeObserver(() => {
        t();
      }), () => n.current?.disconnect();
  }, [t]), o(() => {
    if (!e.current || !n.current)
      return;
    const c = Array.from(e.current.children);
    return c.forEach((r) => {
      n.current?.observe(r);
    }), t(), () => {
      c.forEach((r) => {
        n.current?.unobserve(r);
      });
    };
  }, [...i, t]);
};
export {
  b as default
};
//# sourceMappingURL=useVirtualListResizeObserver.js.map
