import * as p from "react";
import c from "../../../../rc-util/es/Children/toArray.mjs";
import { matchScreen as l } from "../../_util/responsiveObserver.mjs";
var f = globalThis && globalThis.__rest || function(e, r) {
  var n = {};
  for (var t in e)
    Object.prototype.hasOwnProperty.call(e, t) && r.indexOf(t) < 0 && (n[t] = e[t]);
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
    for (var o = 0, t = Object.getOwnPropertySymbols(e); o < t.length; o++)
      r.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[o]) && (n[t[o]] = e[t[o]]);
  return n;
};
const i = (e) => c(e).map((r) => Object.assign(Object.assign({}, r == null ? void 0 : r.props), {
  key: r.key
}));
function y(e, r, n) {
  const t = p.useMemo(() => (
    // Take `items` first or convert `children` into items
    r || i(n)
  ), [r, n]);
  return p.useMemo(() => t.map((a) => {
    var {
      span: s
    } = a, m = f(a, ["span"]);
    return Object.assign(Object.assign({}, m), {
      span: typeof s == "number" ? s : l(e, s)
    });
  }), [t, e]);
}
export {
  y as default
};
