import { gaSendErrorEvent as t } from "./accelbyte-widgets145.mjs";
import { Env as m } from "./accelbyte-widgets108.mjs";
import { UserAlreadyLinkedError as u, UserAlreadyFullAccountError as d, UserUpgradeHeadlessAccountWithVerificationCodeError as E, SendVerificationCodeRawDecodeError as g, UserUpdateEmailError as y, GenerateUploadFileUrlError as p, FileUploadUrlInfoDecodeError as f } from "./accelbyte-widgets175.mjs";
import { ErrorHelper as o } from "./accelbyte-widgets120.mjs";
import { translateServiceError as C } from "@accelbyte/error-translator";
import r from "react";
import { Trans as n } from "react-i18next";
const a = m.CONTACT_SUPPORT_EMAIL, L = () => /* @__PURE__ */ r.createElement(r.Fragment, null, !a && /* @__PURE__ */ r.createElement(n, { i18nKey: "CatalogPurchaseWidget.userBanned" }, "You have been banned from making any purchases."), a && /* @__PURE__ */ r.createElement(n, { i18nKey: "CatalogPurchaseWidget.userBannedWithEmail" }, "You have been banned from making any purchases. For more information, please contact", " ", /* @__PURE__ */ r.createElement("a", { href: `mailto:${a}` }, { CONTACT_SUPPORT_EMAIL: a }))), P = (s) => {
  const { error: e, defaultMessage: l } = s;
  if (!e)
    return null;
  if (o.isAxiosNetworkError(e))
    return t({ eventCategory: "NetworkError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.networkError" }, "The server cannot be reached. Please try again.");
  switch (!0) {
    case e instanceof f:
      return t({ eventCategory: "FileUploadUrlInfoDecodeError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.iam.user.files.uploadUrlInfo" }, "Invalid upload URL");
    case e instanceof p:
      return t({ eventCategory: "GenerateUploadFileUrlError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.iam.user.files.generateUploadUrl" }, "An error has occurred while generating the upload URL. Please try again.");
    case e instanceof y:
      return t({ eventCategory: "UserUpdateEmailError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.iam.user.updateEmail" }, "An error has occurred while updating your email address. Please try again.");
    case e instanceof g:
      return t({ eventCategory: "SendVerificationCodeRawDecodeError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.iam.user.requestCode" }, "An error has occurred while requesting your verification code. Please try again.");
    case e instanceof E:
      return t({
        eventCategory: "UserUpgradeHeadlessAccountWithVerificationCodeError",
        eventLabel: o.errorToString(e)
      }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.iam.user.upgradeHeadlessAccount" }, "An error has occurred while upgrading your account. Please try again.");
    case e instanceof d:
      return t({ eventCategory: "UserAlreadyFullAccountError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.iam.user.userAlreadyFullAccount" }, "Your account has already been upgraded.");
    case e instanceof u:
      return t({ eventCategory: "UserAlreadyFullAccountError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.iam.user.userAlreadyLinked" }, "The Twitch account is already linked with other account. Please try with another one.");
  }
  const c = o.extractServiceErrorCode(e) || 0, i = C(c, void 0, l);
  return i ? /* @__PURE__ */ r.createElement(r.Fragment, null, i) : (o.isAxiosError(e) && e.response && e.response.status) === 403 ? (t({ eventCategory: "AxiosForbiddenError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.playerPortal.forbidden" }, "You cannot access this page. Please go back.")) : o.isAxiosServerError(e) ? (t({ eventCategory: "ServerError", eventLabel: o.errorToString(e) }), /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.serverError" }, "We're experiencing some technical issues right now. Please try again later.")) : /* @__PURE__ */ r.createElement(n, { i18nKey: "CommonError.unknownError" }, "Something went wrong. Please contact support for assistance.");
};
export {
  L as BannedMessage,
  P as CommonError
};
