import { jsxs as s, jsx as e } from "react/jsx-runtime";
import { forwardRef as L, useMemo as h } from "react";
import { cx as v } from "../../utils/classNames.js";
import { useArrowTheme as B } from "../../hooks/useArrowTheme.js";
import { SectionHeader as g } from "../section-header/SectionHeader.js";
import { Tidbit as E } from "../tidbit/Tidbit.js";
import { StatusLabel as S } from "../status-label/StatusLabel.js";
const T = {
  on: "AutoPay on",
  off: "AutoPay off",
  paused: "AutoPay paused",
  none: ""
}, j = L(
  ({
    id: t = "bill-card",
    sectionHeader: n,
    eyebrow: f,
    tidbit: i,
    billTotal: N,
    billCopy: d,
    buttons: l,
    lists: m,
    inverse: b,
    autoPayType: u = "on",
    autoPayStatusLabels: o = {},
    className: w
  }, A) => {
    const x = B(), a = b ?? x.inverse, r = h(
      () => ({ ...T, ...o, none: "" }),
      [o]
    ), _ = h(() => {
      const c = {
        style: "dot",
        backgroundColor: "secondary"
      };
      switch (u) {
        case "on":
          return { ...c, status: "positive", label: r.on };
        case "paused":
          return { ...c, status: "caution", label: r.paused };
        case "off":
          return { ...c, status: void 0, label: r.off };
        case "none":
        default:
          return;
      }
    }, [u, r]), P = !!(d != null && d.header || d != null && d.body);
    return /* @__PURE__ */ s(
      "div",
      {
        ref: A,
        className: v("tdds-bill-card-wrapper", w),
        ...a ? { "data-inverse": "true" } : {},
        children: [
          n ? /* @__PURE__ */ e("div", { className: "tdds-bill-card__section-header", children: /* @__PURE__ */ e(g, { ...n, inverse: a }) }) : null,
          /* @__PURE__ */ s(
            "div",
            {
              id: t,
              className: v("tdds-bill-card", {
                "tdds-bill-card--inverse": !!a
              }),
              children: [
                i ? /* @__PURE__ */ e("div", { className: "tdds-bill-card__tidbit", id: `${t}__tidbit`, children: /* @__PURE__ */ e(
                  E,
                  {
                    ...i,
                    elevated: !1,
                    id: `${t}__tidbit`,
                    inverse: a
                  }
                ) }) : null,
                /* @__PURE__ */ s("div", { className: "tdds-bill-card__header-row", children: [
                  /* @__PURE__ */ s("div", { className: "tdds-bill-card__header-column", children: [
                    /* @__PURE__ */ e("h3", { className: "tdds-bill-card__eyebrow-status-row", children: f }),
                    /* @__PURE__ */ e("p", { className: "tdds-bill-card__amount", children: N.amount })
                  ] }),
                  /* @__PURE__ */ e("div", { className: "tdds-bill-card__status-wrap", children: _ ? /* @__PURE__ */ e("div", { className: "tdds-bill-card__status", children: /* @__PURE__ */ e(S, { ..._, inverse: a }) }) : null })
                ] }),
                P ? /* @__PURE__ */ s("div", { className: "tdds-bill-card__bill-copy", children: [
                  d != null && d.body ? /* @__PURE__ */ s("div", { className: "tdds-bill-card__due", children: [
                    /* @__PURE__ */ e("span", { className: "tdds-bill-card__subtitle", children: d.headerPrefix ? String(d.headerPrefix).trimEnd() : "" }),
                    /* @__PURE__ */ e("strong", { className: "tdds-bill-card__due-date", children: d.header ? d.headerPrefix ? " " + d.header : d.header : "" })
                  ] }) : null,
                  d != null && d.body ? /* @__PURE__ */ e("p", { className: "tdds-bill-card__subtitle", children: d.body }) : null
                ] }) : null,
                l ? /* @__PURE__ */ e("div", { className: "tdds-bill-card__buttons", children: l }) : null,
                m ? /* @__PURE__ */ e("div", { className: "tdds-bill-card__lists", children: m }) : null
              ]
            }
          )
        ]
      }
    );
  }
);
j.displayName = "BillCard";
export {
  j as BillCard
};
//# sourceMappingURL=BillCard.js.map
