import { jsxs as s, jsx as e } from "react/jsx-runtime";
import { Loader2 as b } from "lucide-react";
import { b as N, N as g } from "./chartConstants-Ds00dPgh.js";
function w({
  title: i,
  subtitle: n,
  icon: t,
  actions: r,
  height: c = "md",
  loading: a = !1,
  loadingLabel: l,
  empty: o = !1,
  emptyMessage: d,
  emptyHint: u,
  emptyIcon: h,
  footer: f,
  className: m,
  children: v
}) {
  const x = N[c], p = [
    "flex flex-col gap-4 p-4",
    "rounded-[var(--radius-card)]",
    "border border-[var(--border-color)]",
    m ?? ""
  ].filter(Boolean).join(" ");
  return /* @__PURE__ */ s(
    "section",
    {
      className: p,
      style: { backgroundColor: "var(--dataviz-surface)" },
      "aria-busy": a || void 0,
      children: [
        /* @__PURE__ */ s("header", { className: "flex items-start justify-between gap-3", children: [
          /* @__PURE__ */ s("div", { className: "flex items-start gap-3 min-w-0", children: [
            t && /* @__PURE__ */ e(
              "span",
              {
                className: "flex-shrink-0 mt-0.5",
                style: { color: "var(--dataviz-accent)" },
                "aria-hidden": "true",
                children: t
              }
            ),
            /* @__PURE__ */ s("div", { className: "min-w-0", children: [
              /* @__PURE__ */ e("h3", { className: "text-base font-semibold text-[var(--text-primary)] truncate", children: i }),
              n && /* @__PURE__ */ e("p", { className: "text-xs text-[var(--text-secondary)] mt-0.5 truncate", children: n })
            ] })
          ] }),
          r && /* @__PURE__ */ e("div", { className: "flex items-center gap-2 flex-shrink-0", children: r })
        ] }),
        /* @__PURE__ */ e(
          "div",
          {
            className: "relative w-full",
            style: { height: x },
            children: a ? /* @__PURE__ */ s(
              "div",
              {
                role: "status",
                "aria-live": "polite",
                className: "flex flex-col items-center justify-center w-full h-full gap-2 text-[var(--text-secondary)]",
                children: [
                  /* @__PURE__ */ e(b, { className: "w-6 h-6 animate-spin", "aria-hidden": "true" }),
                  l && /* @__PURE__ */ e("span", { className: "text-sm", children: l })
                ]
              }
            ) : o ? /* @__PURE__ */ e(
              g,
              {
                message: d ?? "",
                hint: u,
                icon: h
              }
            ) : v
          }
        ),
        f && !a && !o && /* @__PURE__ */ e("footer", { children: f })
      ]
    }
  );
}
function j({
  items: i,
  activeId: n,
  onHover: t,
  onSelect: r,
  ariaLabel: c
}) {
  return /* @__PURE__ */ e(
    "ul",
    {
      role: "list",
      "aria-label": c,
      className: "flex flex-wrap gap-x-4 gap-y-2 justify-center items-center pt-3 border-t border-[var(--border-color)]",
      onMouseLeave: t ? () => t(null) : void 0,
      children: i.map((a) => {
        const l = n === a.id;
        return /* @__PURE__ */ e("li", { children: /* @__PURE__ */ s(
          r ? "button" : "div",
          {
            type: r ? "button" : void 0,
            onMouseEnter: t ? () => t(a.id) : void 0,
            onClick: r ? () => r(a.id) : void 0,
            className: [
              "inline-flex items-center gap-2 text-xs",
              "rounded-[var(--radius-button)] px-2 py-1 transition-colors duration-150",
              !!(r || t) ? "cursor-pointer hover:bg-[var(--bg-hover)]" : "",
              l ? "bg-[var(--bg-hover)]" : "",
              r ? "focus:outline-none focus:ring-2 focus:ring-[var(--color-accent-500)]" : ""
            ].filter(Boolean).join(" "),
            children: [
              /* @__PURE__ */ e(
                "span",
                {
                  className: "inline-block w-2.5 h-2.5 rounded-full flex-shrink-0",
                  style: { backgroundColor: a.color },
                  "aria-hidden": "true"
                }
              ),
              /* @__PURE__ */ e("span", { className: "text-[var(--text-secondary)] font-medium", children: a.label }),
              a.value && /* @__PURE__ */ e("span", { className: "text-[var(--text-tertiary)] tabular-nums", children: a.value })
            ]
          }
        ) }, a.id);
      })
    }
  );
}
export {
  w as C,
  j as a
};
//# sourceMappingURL=ChartLegend-BdZxV6Ho.js.map
