import { useState as T, useEffect as b } from "react";
const c = 300, p = (e, r) => {
  const [a, m] = T(350);
  return b(() => {
    const l = () => e.current ? (e.current.querySelector(".TreeHeader"), r || (e.current.querySelector(".TreeRoot")?.clientHeight ?? c)) : c, i = () => {
      const u = l();
      m(u);
    };
    let n;
    const t = () => {
      clearTimeout(n), n = setTimeout(i, 16);
    }, d = setTimeout(i, 50), o = new ResizeObserver(t), s = new MutationObserver(t);
    return e.current && (o.observe(e.current), e.current.parentElement && o.observe(e.current.parentElement), s.observe(e.current, {
      childList: !0,
      subtree: !0,
      attributes: !0,
      attributeFilter: ["style", "class"]
    })), window.addEventListener("resize", t), () => {
      clearTimeout(d), clearTimeout(n), o.disconnect(), s.disconnect(), window.removeEventListener("resize", t);
    };
  }, [r, e]), a;
};
export {
  p as useTreeHeight
};
//# sourceMappingURL=useTreeHeight.js.map
