import { jsx as a } from "react/jsx-runtime";
import { useReactive as u, useMemoizedFn as f } from "ahooks";
import h from "@iconify-icons/material-symbols/mail-outline-rounded";
import { LOGIN_PROVIDER as E } from "@arcblock/ux/lib/Util/constant";
import { translate as P } from "@arcblock/ux/lib/Locale/util";
import p from "./list-item.js";
import g from "./placeholder.js";
import s from "../../assets/locale.js";
function q({ baseUrl: l }) {
  const i = u({
    baseUrl: l,
    status: "idle",
    get computedStatus() {
      return this.status === "idle" ? "creating" : this.status === "creating" || this.status === "sending" || this.status === "verifying" ? "scanned" : this.status;
    },
    error: "",
    magicToken: "",
    reset() {
      this.status = "idle", this.error = "", this.magicToken = "";
    }
  }), r = E.EMAIL, t = "Email", o = h, m = {
    zh: {
      ...s.zh,
      email: "邮箱地址",
      emailPlaceholder: "请输入邮箱地址",
      sendCode: "发送验证邮件",
      confirm: "确认",
      verifyEmail: "登录链接已发送至邮箱，请登录邮箱查看",
      useCode: "使用验证码",
      codePlaceholder: "请输入验证码",
      orUseCodePlaceholder: "或使用验证码",
      emailInvalid: "邮箱格式不正确",
      emailRequired: "邮箱地址不能为空"
    },
    en: {
      ...s.en,
      email: "Email",
      emailPlaceholder: "Enter your email address",
      sendCode: "Send Verification Email",
      confirm: "Confirm",
      verifyEmail: "Login link sent! Please check your email.",
      useCode: "Use Verification Code",
      codePlaceholder: "Enter your verification code.",
      orUseCodePlaceholder: "Or use verification code.",
      emailInvalid: "Email format is incorrect",
      emailRequired: "Email is required"
    }
  }, n = f((e, d = {}, c = "en") => P(m, e, c, "en", d));
  return {
    name: r,
    title: t,
    icon: o,
    renderListItem(e) {
      return /* @__PURE__ */ a(p, { ...e, state: i, name: r, title: t, icon: o, t: n });
    },
    renderPlaceholder(e) {
      return /* @__PURE__ */ a(g, { ...e, state: i, name: r, title: t, icon: o, t: n });
    },
    order: 100,
    state: i
  };
}
export {
  q as default
};
