import { jsxs as s, jsx as e } from "react/jsx-runtime";
import { generateAvatarImage as x, getColor as T, getNftPicture as w, prettifyTokenAmount as F, prettifyCurrencyValue as W, bigDecimal as I } from "@argent/x-shared";
import P from "../../features/icons/WarningCircleSecondaryIcon.js";
import { useColorMode as U, AccordionButton as j, Flex as _, Image as v } from "@chakra-ui/react";
import { useMemo as h, useCallback as A } from "react";
import { useCurrency as B } from "../../features/providers/CurrencyProvider.js";
import { TextWithAmount as M } from "../TextWithAmount.js";
import { P3 as f, P2 as S, Label2Bold as D } from "../typography.generated.js";
const c = "Unknown NFT", G = ({ contractAddress: o, safe: C, dataIndex: u, totalData: p, isDisabled: d, isDefaultNetwork: N, amount: a, usdValue: l, nft: r, collection: n }) => {
  const { colorMode: g } = U(), b = h(() => g === "dark", [g]), m = B(), i = A((t, k) => x(k ?? c, {
    background: T(t)
  }), []), y = h(() => {
    if (r && r.name)
      return {
        name: r.name,
        description: r.description,
        image_url_copy: r.image_url_copy ?? r.image_uri ?? i(o, r.name)
      };
    if (n) {
      const t = n.name ?? "Unknown Collection";
      return {
        name: `${t} NFT`,
        description: `${t} NFT`,
        image_url_copy: n.imageUri ?? i(o)
      };
    }
    return {
      name: c,
      description: c,
      image_url_copy: i(o)
    };
  }, [o, n, r, i]);
  return /* @__PURE__ */ s(j, { display: "flex", width: "100%", justifyContent: "space-between", outline: "none", px: "3", pb: u !== p - 1 ? "3" : "3.5", _expanded: {
    backgroundColor: b ? "neutrals.700" : "gray.50",
    pb: "3.5"
  }, disabled: d, _disabled: {
    cursor: "auto",
    opacity: 1
  }, _hover: {
    backgroundColor: d ? "" : b ? "neutrals.700" : "gray.50",
    borderBottomRadius: u === p - 1 ? "xl" : "0"
  }, children: [
    /* @__PURE__ */ s(_, { alignItems: "center", gap: "2", children: [
      /* @__PURE__ */ e(v, { src: w({ image_url_copy: y.image_url_copy }) || "", w: "5", h: "5", borderRadius: "base" }),
      /* @__PURE__ */ e(f, { fontWeight: "bold", color: "text-primary", children: y.name }),
      !C && /* @__PURE__ */ e(S, { color: "error.500", fontWeight: "bold", mt: "0.25", children: /* @__PURE__ */ e(P, {}) })
    ] }),
    /* @__PURE__ */ s(_, { direction: "column", gap: "0.5", alignItems: "flex-end", children: [
      /* @__PURE__ */ e(M, { amount: a, children: /* @__PURE__ */ e(f, { color: a < 0n ? "error.500" : "secondary.500", fontWeight: "bold", children: F({
        amount: a,
        decimals: 0,
        symbol: "NFT",
        showPlusSign: !0
      }) }) }),
      N && !!l && l !== "0" && /* @__PURE__ */ e(D, { color: "neutrals.300", children: W(I.parseCurrencyAbs(l).toString(), m == null ? void 0 : m.symbol) })
    ] })
  ] });
};
export {
  G as NftDetails
};
