import { jsx as a } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import p from "classnames";
import f from "../../../../internal/StatusBox/StatusBox.js";
import A from "../../../../internal/StatusBox/useStatusBox.js";
import { getTransactionCategory as d } from "../../../../utils/translation/getters.js";
import { getAmountStyleForTransaction as S, getRefundTypeForTransaction as g } from "../../utils.js";
import { TX_DATA_AMOUNT as y, TX_DATA_CONTAINER as x, TX_STATUS_BOX as B, TX_DATA_TAGS as C } from "../../constants.js";
import { RefundType as l, RefundedState as u } from "../../types.js";
import { TagVariant as m } from "../../../../internal/Tag/types.js";
import { Tag as r } from "../../../../internal/Tag/Tag.js";
import { useMemo as T } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { memo as c } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/compat/dist/compat.module.js";
import D from "../../../../../core/Context/preact/useCoreContext.js";
import { Fragment as L } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
const i = ({ refundedState: e, transaction: t }) => {
  const o = A({
    timezone: t.balanceAccount?.timeZone,
    createdAt: t.createdAt,
    amountData: t.netAmount,
    paymentMethodData: t.paymentMethod,
    bankAccount: t.bankAccount
  }), n = T(
    () => ({
      amount: `${y}--${S(t)}`
    }),
    [t]
  ), s = T(
    () => /* @__PURE__ */ a(i.StatusTags, { transaction: t, refundedState: e }),
    [t, e]
  );
  return /* @__PURE__ */ a("div", { className: p(x, B), children: /* @__PURE__ */ a(f, { ...o, classNames: n, tag: s }) });
};
i.StatusTags = c(({ transaction: e, refundedState: t }) => {
  const { i18n: o } = D(), { category: n } = e, s = g(e);
  return /* @__PURE__ */ a("div", { className: C, children: [
    n && /* @__PURE__ */ a(r, { label: d(o, n), variant: m.DEFAULT }),
    s && /* @__PURE__ */ a(L, { children: [
      s === l.FULL && /* @__PURE__ */ a(r, { label: o.get("transactions.details.common.refundTypes.full"), variant: m.SUCCESS }),
      s === l.PARTIAL && /* @__PURE__ */ a(r, { label: o.get("transactions.details.common.refundTypes.partial"), variant: m.BLUE })
    ] }),
    t === u.FULL && /* @__PURE__ */ a(r, { label: o.get("transactions.details.common.refundedStates.full"), variant: m.SUCCESS }),
    t === u.PARTIAL && /* @__PURE__ */ a(r, { label: o.get("transactions.details.common.refundedStates.partial"), variant: m.BLUE })
  ] });
});
const I = c(i);
export {
  I as default
};
