import { jsx as t, jsxs as s } from "react/jsx-runtime";
import { ensureArray as z } from "@argent/x-shared";
import { NativeActivityTypeNative as B, getAnyActivityTitle as E, isRejectOnChainActivity as M, isUpgradeActivity as O, isSwapActivity as U } from "@argent/x-shared/simulation";
import { Flex as m } from "@chakra-ui/react";
import { useMemo as r } from "react";
import { useTranslation as W } from "react-i18next";
import { TransactionReviewAction as v } from "../../TransactionReviewAction.js";
import { ActivityIcon as w } from "../icon/ActivityIcon.js";
import { ActivityAdditionalDetails as C } from "./ActivityAdditionalDetails.js";
import { SendAndReceiveActivity as F } from "../summary/SendAndReceiveActivity.js";
import { CellStack as H } from "../../../../components/CellStack.js";
import { H4 as I, P3 as g } from "../../../../components/typography.generated.js";
import { formatDateTime as P } from "../../../../utilities/date/index.js";
const te = ({ activity: e, networkId: o, hideComponent: n, children: h, locales: b, ...x }) => {
  var a, p, f;
  const { t: S } = W(), i = e.type === B, T = E(e, S), c = i && ((a = e.meta) == null ? void 0 : a.subtitle), j = r(() => M(e), [e]), R = r(() => O(e), [e]), D = r(() => U(e), [e]), l = (i && ((p = e.meta) == null ? void 0 : p.icon) || j || R) && !D, N = i && ((f = e.meta) == null ? void 0 : f.investment), y = r(() => {
    var A;
    const u = (A = e.actions) == null ? void 0 : A.map((d) => /* @__PURE__ */ t(v, { action: d, networkId: o, hideComponent: n }, `review-${d.name}`));
    return z(u).length ? /* @__PURE__ */ t(m, { direction: "column", gap: 1, children: u }) : null;
  }, [e.actions, N, o]);
  return /* @__PURE__ */ s(H, { ...x, children: [
    /* @__PURE__ */ s(m, { alignItems: "center", w: "full", gap: 3, pb: 3, pl: l ? 1 : 3, pr: 3, children: [
      l && /* @__PURE__ */ t(w, { size: 12, fontSize: "xl", activity: e, networkId: o, preferMetaIcon: !0 }),
      /* @__PURE__ */ s(m, { direction: "column", gap: 0.5, children: [
        /* @__PURE__ */ t(I, { children: T }),
        c && /* @__PURE__ */ t(g, { fontWeight: "semibold", color: "text-secondary", children: c }),
        /* @__PURE__ */ t(g, { fontWeight: "semibold", color: "text-secondary", children: P(e.submitted, b) })
      ] })
    ] }),
    h,
    /* @__PURE__ */ t(F, { summaryArray: e.transferSummary, networkId: o, hideComponent: n }),
    /* @__PURE__ */ t(C, { activity: e, networkId: o, hideComponent: n }),
    y
  ] });
};
export {
  te as ActivityDetails
};
