import { jsx as o, jsxs as h } from "react/jsx-runtime";
import { isRejectOnChainActivity as C, isUpgradeActivity as A, NativeActivityTypeNative as R } from "@argent/x-shared/simulation";
import x from "../../../icons/CancelCircleSecondaryIcon.js";
import j from "../../../icons/CrossSecondaryIcon.js";
import O from "../../../icons/LegalSecondaryIcon.js";
import k from "../../../icons/RocketSecondaryIcon.js";
import N from "../../../icons/SendSecondaryIcon.js";
import U from "../../../icons/UpgradeSecondaryIcon.js";
import { Circle as t, Square as q } from "@chakra-ui/react";
import { groupBy as B, isEmpty as u } from "lodash-es";
import { memo as D, useMemo as y } from "react";
import { getActivityDetailsIcon as E } from "./getActivityDetailsIcon.js";
import { SendOrReceiveActivityIcon as S } from "./SendOrReceiveActivityIcon.js";
const v = {
  SendSecondaryIcon: N,
  RocketSecondaryIcon: k
}, K = ({ activity: n, networkId: d, size: r = 10, preferMetaIcon: b = !1, ...c }) => {
  var p;
  const { type: g, status: m, transferSummary: I = [] } = n, { send: s, receive: f } = B(I, (e) => e.sent ? "send" : "receive"), i = y(() => u(s) ? null : (l) => /* @__PURE__ */ o(S, { summaryArray: s, networkId: d, size: r, ...l }), [d, s, r]), a = y(() => u(f) ? null : (l) => /* @__PURE__ */ o(S, { summaryArray: f, networkId: d, size: r, ...l }), [d, f, r]);
  if (m === "failure" || m === "rejected" || m === "cancelled")
    return /* @__PURE__ */ o(t, { size: r, bgColor: "surface-elevated-hover", ...c, children: /* @__PURE__ */ o(x, {}) });
  if (C(n))
    return /* @__PURE__ */ o(t, { size: r, bgColor: "icon-background-brand", ...c, children: /* @__PURE__ */ o(j, {}) });
  if (A(n))
    return /* @__PURE__ */ o(t, { size: r, bgColor: "icon-background-brand", ...c, children: /* @__PURE__ */ o(U, { color: "surface-elevated" }) });
  if (g === R && (b || !(i || a))) {
    const e = (p = n.meta) == null ? void 0 : p.icon;
    if (e && e in v) {
      const l = v[e];
      return /* @__PURE__ */ o(t, { size: r, color: "surface-default", bgColor: "icon-background-brand", ...c, children: /* @__PURE__ */ o(l, {}) });
    }
  }
  if (i && a)
    return /* @__PURE__ */ h(q, { size: r, position: "relative", ...c, children: [
      /* @__PURE__ */ o(i, { size: 6, fontSize: "sm", position: "absolute", left: 0, top: 0 }),
      /* @__PURE__ */ o(a, { size: 6.5, fontSize: "sm", position: "absolute", right: 0, bottom: 0, filter: "drop-shadow(-1px -1px var(--chakra-colors-surface-elevated))" })
    ] });
  if (i)
    return /* @__PURE__ */ o(i, {});
  if (a)
    return /* @__PURE__ */ o(a, {});
  if ("details" in n && !u(n.details)) {
    const e = E(n.details);
    if (e)
      return /* @__PURE__ */ o(t, { size: r, color: "surface-default", bgColor: "icon-background-brand", ...c, children: e });
  }
  return /* @__PURE__ */ o(t, { size: r, bgColor: "surface-elevated-hover", ...c, children: /* @__PURE__ */ o(O, {}) });
}, _ = D(K);
export {
  _ as ActivityIcon,
  v as icons
};
