import { b as i, C as s, i as p, f as M, m as f, g as _, c as E, e as l, d as u } from "./validateEmail-03d506e7.mjs";
import { z as P } from "zod";
import { c as a } from "./FormGroup-bf779d3e.mjs";
import * as e from "react";
import { Trans as t } from "react-i18next";
import y from "xregexp";
import { b as T, c as w, M as k } from "./numbers-4344265e.mjs";
const o = P.enum([...i.options, s.enum.invalidFormat]), V = (n, { allowUnicode: r = !1, isRequired: c = !0, strictlyAllowSpecialCharacters: m = !0, maxLength: A = T, minLength: N = w, isCustomRegex: d = !1, customRegex: g = "" } = {}) => {
  const L = "[a-zA-Z0-9]", h = `^${L}+([',. -]${L}+)*$`;
  return p(n) ? c ? o.enum.empty : null : d ? M(n, g, {
    allowUnicode: r || d
  }) : r && !m && !y("^[\\pL\\pN\\pM]*$").test(n) || r && m && !y("^[\\pL\\pN\\pM]+([',. -][\\pL\\pN]+)*$").test(n) || !r && !m && !f(n, /^\w*$/g) || !r && m && n.trim() !== n || !r && m && !f(n, h) ? o.enum.invalidFormat : _(n, {
    max: A,
    min: N
  });
}, v = P.enum([s.enum.empty]), G = (n, r) => p(n, r) ? v.enum.empty : null, H = (n, r) => {
  if (!n || !r.min || !r.max)
    return null;
  switch (n) {
    case i.enum.empty:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "linkPlatformAccountPage.LinkNewAccount.form.passwordEmptyError" }, "You must fill in a password"));
    case i.enum.lessThanLengthLimit:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "linkPlatformAccountPage.LinkNewAccount.form.passwordLessThanLengthLimit" }, "Your password must contain at least ", { PASSWORD_MIN_LIMIT: r.min }, " characters"));
    case i.enum.exceedLengthLimit:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "linkPlatformAccountPage.LinkNewAccount.form.passwordExceedLimit" }, "Your password must not exceed ", { PASSWORD_MAX_LENGTH: r.max }, " characters"));
    case E.enum.invalidFormat:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "linkPlatformAccountPage.LinkNewAccount.form.passwordInvalidFormat" }, "Please enter a valid password"));
    default:
      return /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.unknownError" }, "Something went wrong. Please contact support for assistance.");
  }
}, C = (n, r = {}) => {
  if (!n)
    return null;
  switch (n) {
    case i.enum.empty:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.displayNameEmptyError" }, "The display name cannot be empty."));
    case i.enum.lessThanLengthLimit:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.lessThanLengthLimit" }, "Your display name must contain at least ", { DISPLAY_NAME_MIN_LIMIT: r.min }, " characters"));
    case i.enum.exceedLengthLimit:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.displayNameExceedLimit" }, "Display name must not exceed ", { MAX_DISPLAY_NAME_LENGTH: r.max }, " characters"));
    case E.enum.invalidFormat:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.displayNameInvalidFormat" }, "Please enter a valid display name format"));
    default:
      return /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.unknownError" }, "Something went wrong. Please contact support for assistance.");
  }
}, Y = (n, r = {}) => {
  if (!n)
    return null;
  switch (n) {
    case i.enum.empty:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.userName.emptyError" }, "The username cannot be empty"));
    case i.enum.lessThanLengthLimit:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.userName.lessThanLengthLimit" }, "Your username must contain at least ", { MIN_USERNAME_LENGTH: r.min }, " characters"));
    case i.enum.exceedLengthLimit:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.userName.exceedLimit" }, "Your username must not exceed ", { MAX_USERNAME_LENGTH: r.max }, " characters"));
    case E.enum.invalidFormat:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "AccountMyProfilePage.form.userName.invalidFormat" }, "Please enter a valid username format"));
    default:
      return /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.unknownError" }, "Something went wrong. Please contact administrator.");
  }
}, b = (n) => {
  if (!n)
    return null;
  switch (n) {
    case u.enum.empty:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "linkPlatformAccountPage.LinkNewAccount.verifyCodeError.empty" }, "You must enter your verification code"));
    case u.enum.exceedLengthLimit:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "linkPlatformAccountPage.LinkNewAccount.verifyCodeError.ExceedLimit" }, "Verification code must not exceed ", { MAX_SHORT_TEXT_LENGTH: k }, " characters"));
    case u.enum.invalidFormat:
      return /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(t, { i18nKey: "linkPlatformAccountPage.LinkNewAccount.verifyCodeError.invalidFormat" }, "Please enter a valid verification code"));
    default:
      return /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.unknownError" }, "Something went wrong. Please contact support for assistance.");
  }
}, X = (n, { minLength: r, maxLength: c } = {}) => {
  if (!n)
    return null;
  const m = {
    [l.enum.empty]: /* @__PURE__ */ e.createElement(t, { i18nKey: "LinkPlatformAccountPage.LinkNewAccount.emailError.empty" }, "Email is required"),
    [l.enum.lessThanLengthLimit]: /* @__PURE__ */ e.createElement(t, { i18nKey: "LinkPlatformAccountPage.LinkNewAccount.emailError.lessThanLengthLimit" }, "Email must not less than ", { MIN_EMAIL_LENGTH: r }, " characters"),
    [l.enum.exceedLengthLimit]: /* @__PURE__ */ e.createElement(t, { i18nKey: "LinkPlatformAccountPage.LinkNewAccount.emailError.ExceedLimit" }, "Email must not exceed ", { MAX_EMAIL_LENGTH: c }, " characters"),
    [o.enum.invalidFormat]: /* @__PURE__ */ e.createElement(t, { i18nKey: "LinkPlatformAccountPage.LinkNewAccount.emailError.InvalidFormat" }, "Please provide a valid Email format"),
    [s.enum.containsForbiddenWords]: /* @__PURE__ */ e.createElement(t, { i18nKey: "LinkPlatformAccountPage.LinkNewAccount.emailError.containsForbiddenWords" }, "Email contains prohibited word or use blocked domain")
  };
  return /* @__PURE__ */ e.createElement(a, null, m[n]);
};
export {
  b as D,
  H as P,
  Y as U,
  C as a,
  X as b,
  V as c,
  G as v
};
