import { useState as g, useLayoutEffect as s } from "react";
const a = "auto", c = (e) => {
  let t = "auto";
  if (e.current) {
    const { innerHeight: n } = window, { bottom: r } = e.current.getBoundingClientRect();
    t = `${Math.max(n - (r + 33 + 8), 130)}px`;
  }
  return t;
}, d = (e, { isOpen: t, autoResize: n }) => {
  const [r, i] = g(a);
  return s(() => {
    const o = () => i(c(e));
    return t ? (o(), window.addEventListener("resize", o)) : t || i(a), () => {
      t && n && window.removeEventListener("resize", o);
    };
  }, [t, n, e]), { maxHeight: r };
};
export {
  a as DEFAULT_DROPDOWN_MAX_HEIGHT,
  d as useDropdownAutoHeight
};
//# sourceMappingURL=useDropdownAutoHeight.es.js.map
