import { useState as a } from "react";
import d from "./useResizeObserver.js";
const S = (c) => {
  const [h, u] = a({ width: 0, height: 0 });
  return d(c, (z) => {
    const e = z[0];
    if (e) {
      const t = e.contentBoxSize;
      let i = 0, o = 0;
      if (t) {
        const n = Array.isArray(t) ? t : [t];
        i = n.reduce((r, { inlineSize: s }) => r + s, 0), o = n.reduce((r, { blockSize: s }) => r + s, 0);
      } else
        i = e.contentRect.width, o = e.contentRect.height;
      u({ width: i, height: o });
    }
  }), { size: h };
};
export {
  S as default
};
