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