import { u as s, w as i } from "./xlsx-Byegf6ga.js";
import { u } from "./xlsx.util-BPV2vsSD.js";
function p(o, a) {
  return a.map((e) => typeof e.selector == "function" ? e.selector(o) : o[e.selector]);
}
function f(o, a) {
  const e = a.map((t) => t.name), n = o.map((t) => p(t, a));
  return s.aoa_to_sheet([e, ...n]);
}
async function d(o, a) {
  const e = s.book_new(), n = /* @__PURE__ */ new Set();
  for (const t of o) {
    const c = f(
      t.data,
      t.columns.map((r) => typeof r == "string" ? {
        name: r,
        selector: r
      } : r)
    );
    s.book_append_sheet(e, c, u(t.name, n));
  }
  await i(e, a);
}
export {
  d as e
};
