import { jsx as x } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useRef as n, useMemo as V } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { SummaryItem as h } from "../SummaryItem/SummaryItem.js";
import C from "../../../../../core/Context/preact/useCoreContext.js";
const R = ({
  total: e,
  hiddenField: s,
  isHeader: r = !1,
  showLabelUnderline: a = !1,
  isSkeleton: l = !1,
  isLoading: c = !1,
  widths: u,
  onWidthsSet: g,
  expensesElemId: o,
  incomingsElemId: i
}) => {
  const { i18n: t } = C(), m = n(null), f = n(null), p = n(null), y = V(() => {
    const b = {
      elemId: i,
      labelKey: "transactions.overview.totals.tags.incoming",
      ref: m,
      skeletonWidth: 80,
      getValue: () => e && t.amount(e.incomings, e.currency),
      tooltipLabel: "transactions.overview.totals.tags.incoming.description",
      get ariaLabel() {
        return `${t.get(this.labelKey)}: ${this.getValue()}`;
      }
    }, v = {
      elemId: o,
      labelKey: "transactions.overview.totals.tags.outgoing",
      ref: f,
      skeletonWidth: 80,
      getValue: () => e && t.amount(e.expenses, e.currency),
      tooltipLabel: "transactions.overview.totals.tags.outgoing.description",
      get ariaLabel() {
        return `${t.get(this.labelKey)}: ${this.getValue()}`;
      }
    };
    return [
      ...s !== "incomings" ? [b] : [],
      ...s !== "expenses" ? [v] : [],
      {
        ref: p,
        skeletonWidth: 40,
        valueHasLabelStyle: !0,
        getValue: () => e?.currency
      }
    ];
  }, [i, o, s, e, t]);
  return /* @__PURE__ */ x(
    h,
    {
      showLabelUnderline: a,
      isEmpty: !e,
      columnConfigs: y,
      isHeader: r,
      isSkeletonVisible: l,
      isLoading: c,
      widths: u,
      onWidthsSet: g
    }
  );
};
export {
  R as TransactionTotalItem
};
