import { useElementSize as m } from "@vueuse/core";
import { ref as u, computed as d, unref as i, onUpdated as H } from "vue";
import "../../config-provider/index.mjs";
import { useGlobalConfig as S } from "../../config-provider/hooks/use-global-config.mjs";
function c(t) {
  if (!t)
    return 0;
  const e = parseFloat(t);
  return Number.isNaN(e) ? 0 : e;
}
function l(t) {
  if (!t)
    return 0;
  const e = getComputedStyle(t);
  return t.clientHeight + c(e.marginTop) + c(e.marginBottom);
}
const N = (t) => {
  const e = u(), { height: s } = m(e), g = S("namespace"), r = u();
  let o = !1;
  const p = d(() => {
    const n = e.value?.querySelector(`.${i(g)}-ap-table-header-wrapper`)?.clientHeight || 0, f = e.value?.querySelector(".ant-table-header")?.clientHeight || 47, a = e.value?.querySelector(".ant-pagination"), h = a ? l(a) : i(r);
    return a && (o = !0), Math.ceil(
      i(s) - f - n - (h || 0) - (t?.offset || 0)
    );
  });
  return H(() => {
    if (o)
      return;
    const n = e.value?.querySelector(".ant-pagination");
    if (!n) {
      r.value = 0;
      return;
    }
    r.value = l(n), o = !0;
  }), { contentRef: e, height: p };
};
export {
  N as default
};
