import { useMemo as i } from "react";
import { b as o, G as d, J as l } from "../../config-D-Ik_SSx.js";
import { useTypedTranslation as c } from "../../localisation.js";
import { getIntentsAccountId as u } from "../../utils/intents/getIntentsAccountId.js";
import { CHAINS_LIST as f, EVM_CHAINS as m } from "../../constants/chains.js";
const v = (r) => {
  const { t } = c(), { ctx: e } = o(), { sendAddress: n } = d(), { supportedChains: a } = l();
  return i(() => {
    if (n)
      return;
    if (e.sendAddress && r)
      return {
        variant: "error",
        state: "error",
        message: r
      };
    if (!e.targetToken)
      return {
        variant: "warn",
        state: "disabled",
        message: t(
          "wallet.recipient.info.selectToken",
          "Select a token to receive"
        )
      };
    if (e.quoteStatus === "error" && e.error?.code === "TOKEN_IS_NOT_SUPPORTED")
      return {
        variant: "error",
        state: "error",
        message: t("wallet.recipient.error.invalidAddress", {
          defaultValue: "Invalid address. Use one on {{network}} network.",
          network: f[e.targetToken.blockchain]?.label ?? "selected"
        })
      };
    if (e.state === "initial_wallet" && e.error?.code === "SEND_ADDRESS_IS_NOT_FOUND")
      return {
        variant: "error",
        state: "error",
        message: t("wallet.recipient.error.sendAddressNotFound", {
          defaultValue: "This {{chain}} account does not exist",
          chain: e.error.meta.chain.toUpperCase()
        })
      };
    if (e.state === "initial_wallet" && e.error?.code === "SEND_ADDRESS_IS_INVALID")
      return {
        variant: "error",
        state: "error",
        message: t("wallet.recipient.error.sendAddressInvalid", {
          defaultValue: "Invalid {{chain}} address format",
          chain: e.error.meta.chain.toUpperCase()
        })
      };
    const s = m.includes(
      e.targetToken.blockchain
    ) ? "EVM" : e.targetToken.blockchain.toUpperCase();
    if (!e.targetToken.isIntent && !a.includes(e.targetToken.blockchain))
      return {
        variant: "warn",
        state: "default",
        message: t("wallet.recipient.warn.compatibleNetwork", {
          defaultValue: "Make sure the address is on the {{chainLabel}} compatible network",
          chainLabel: s
        })
      };
    if (!e.targetToken.isIntent && e.walletAddress !== e.sendAddress)
      return {
        variant: "warn",
        state: "default",
        message: t("wallet.recipient.warn.compatibleNetwork", {
          defaultValue: "Make sure the address is on the {{chainLabel}} compatible network",
          chainLabel: s
        })
      };
    if (e.walletAddress === e.sendAddress && a.includes(e.targetToken.blockchain))
      return {
        variant: "success",
        state: "default",
        message: t("wallet.recipient.message.networkVerified", {
          defaultValue: "Address verified for {{chainLabel}} compatible network",
          chainLabel: s
        })
      };
    if (!e.walletAddress && !e.sendAddress)
      return {
        variant: "error",
        state: "error",
        message: t(
          "wallet.recipient.message.receiveFunds",
          "Please enter wallet address to receive funds"
        )
      };
    if (e.sendAddress && e.targetToken.isIntent && e.sendAddress === u({
      walletAddress: e.sendAddress,
      addressType: "evm"
    }))
      return {
        variant: "success",
        state: "default",
        message: t("wallet.recipient.message.receiveFunds", {
          defaultValue: "You will receive funds on your Intents account"
        })
      };
  }, [e, n, r, a]);
};
export {
  v as useNotification
};
//# sourceMappingURL=useNotification.js.map
