import { jsxs as d, jsx as t } from "react/jsx-runtime";
import { Button as w } from "@headlessui/react";
import { useEffect as x, useMemo as S } from "react";
import { WandShineW700 as b } from "@material-symbols-svg/react-rounded/icons/wand-shine";
import { Card as g } from "../../components/Card.js";
import { Input as A } from "../../components/Input.js";
import { Banner as C } from "../../components/Banner.js";
import "../../constants/chains.js";
import "ethers";
import "../../logger.js";
import { cn as N } from "../../utils/cn.js";
import { b as k, G as T, J as y } from "../../config-D-Ik_SSx.js";
import "../../machine/machine.js";
import { fireEvent as o } from "../../machine/events/utils/fireEvent.js";
import { useTypedTranslation as B } from "../../localisation.js";
import { useNotification as E } from "./useNotification.js";
const O = ({ error: a, className: i }) => {
  const { t: n } = B(), { ctx: e } = k(), { sendAddress: s, hideSendAddress: l } = T(), { supportedChains: m } = y(), r = E(a), c = e.targetToken && !e.sendAddress && m.includes(e.targetToken.blockchain), p = (u) => {
    const h = u.target.value;
    o("addressSet", h);
  };
  x(() => {
    s && s !== e.sendAddress && o("addressSet", s);
  }, [s, e.sendAddress]);
  const f = S(() => s ? "fixed" : r?.state ?? "default", [r, s]);
  return l ? null : /* @__PURE__ */ d(g, { className: N("flex flex-col", i), children: [
    /* @__PURE__ */ t("h5", { className: "text-sw-label-md text-sw-gray-50 pb-sw-md", children: n("sendAddress.label", "Send to") }),
    /* @__PURE__ */ t(
      A,
      {
        fontSize: "sm",
        defaultValue: e.sendAddress,
        state: f,
        className: "mb-sw-md",
        placeholder: n(
          "wallet.recipient.placeholder",
          "Enter recipient wallet address"
        ),
        onChange: p,
        children: !!c && /* @__PURE__ */ d(
          w,
          {
            className: "absolute right-0 flex items-center gap-sw-md min-w-max cursor-pointer",
            onClick: () => {
              o("addressSet", e.walletAddress ?? null);
            },
            children: [
              /* @__PURE__ */ t(b, { size: 14 }),
              /* @__PURE__ */ t("span", { className: "text-sw-label-md", children: n("sendAddress.button.magic.label", "My wallet") })
            ]
          }
        )
      }
    ),
    r && /* @__PURE__ */ t(C, { ...r })
  ] });
};
export {
  O as SendAddress
};
//# sourceMappingURL=index.js.map
