import { DataTable as e } from "./DataTable.js";
import { card as t, cardActions as n, cardBadges as r, cardHeader as i, cardMetaGrid as a, cardMetaItem as o, cardMetaLabel as s, cardMetaValue as c, cardSubtitle as l, cardTitle as u, cardTitleGroup as d, cards as f, cardsOnly as p, tableOnly as m } from "./ResponsiveRecordList.css.js";
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
//#region src/components/data-table/ResponsiveRecordList.tsx
var v = (e, t) => e == null ? null : e.cell(t), y = (e, t) => e.find((e) => e.mobileRole === t) ?? null, b = (e) => e.mobileRole === "hidden" ? !1 : e.mobileRole === "meta" ? !0 : e.mobileRole == null ? e.priority === "important" || e.priority === "secondary" : !1, x = ({ columns: x, rows: S, getRowId: C, mode: w = "auto", density: T = "compact", renderAction: E, className: D, ...O }) => {
	let k = y(x, "title") ?? x.find((e) => e.isPrimary === !0 || e.priority === "primary") ?? x[0] ?? null, A = y(x, "subtitle"), j = x.filter((e) => e.mobileRole === "badge" || e.mobileRole === "status"), M = x.filter((e) => e !== k && e !== A && b(e)), N = /* @__PURE__ */ g(h, { children: O.emptyState ?? null });
	return S.length > 0 && (N = /* @__PURE__ */ g("div", {
		className: f,
		children: S.map((e, f) => {
			let p = C(e, f), m = v(k, e), h = v(A, e), y = E?.(e), b = null;
			h != null && h !== "" && (b = /* @__PURE__ */ g("div", {
				className: l,
				children: h
			}));
			let x = null;
			y != null && (x = /* @__PURE__ */ g("div", {
				className: n,
				children: y
			}));
			let S = null;
			j.length > 0 && (S = /* @__PURE__ */ g("div", {
				className: r,
				children: j.map((t) => /* @__PURE__ */ g("span", { children: t.cell(e) }, t.id))
			}));
			let w = null;
			return M.length > 0 && (w = /* @__PURE__ */ g("dl", {
				className: a,
				children: M.map((t) => /* @__PURE__ */ _("div", {
					className: o,
					children: [/* @__PURE__ */ g("dt", {
						className: s,
						children: t.header
					}), /* @__PURE__ */ g("dd", {
						className: c,
						children: t.cell(e)
					})]
				}, t.id))
			})), /* @__PURE__ */ _("article", {
				className: t({ density: T }),
				children: [
					/* @__PURE__ */ _("div", {
						className: i,
						children: [/* @__PURE__ */ _("div", {
							className: d,
							children: [/* @__PURE__ */ g("div", {
								className: u,
								children: m
							}), b]
						}), x]
					}),
					S,
					w
				]
			}, p);
		})
	})), w === "cards" ? /* @__PURE__ */ g("div", {
		className: D,
		children: N
	}) : w === "table" ? /* @__PURE__ */ g(e, {
		...O,
		rows: S,
		columns: x,
		getRowId: C,
		className: D,
		density: T
	}) : /* @__PURE__ */ _("div", {
		className: D,
		children: [/* @__PURE__ */ g(e, {
			...O,
			rows: S,
			columns: x,
			getRowId: C,
			density: T,
			className: m
		}), /* @__PURE__ */ g("div", {
			className: p,
			children: N
		})]
	});
};
//#endregion
export { x as ResponsiveRecordList, x as default };

//# sourceMappingURL=ResponsiveRecordList.js.map