import { ErrorHelper as a } from "./accelbyte-widgets120.mjs";
import m from "./accelbyte-widgets110.mjs";
import { translateServiceError as l } from "@accelbyte/error-translator";
import e from "react";
import { Trans as t } from "react-i18next";
import "./accelbyte-widgets187.mjs";
const c = (n) => {
  var s;
  const { error: r } = n;
  if (!r)
    return null;
  if (a.isAxiosNetworkError(r))
    return /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.networkError" }, "The server cannot be reached. Please try again.");
  const i = a.extractServiceErrorCode(r) || 0, o = l(i);
  return o ? /* @__PURE__ */ e.createElement(e.Fragment, null, o) : (a.isAxiosError(r) && ((s = r == null ? void 0 : r.response) == null ? void 0 : s.status)) === 403 ? /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.playerPortal.forbidden" }, "You cannot access this page. Please go back.") : a.isAxiosServerError(r) ? /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.serverError" }, "We are experiencing some technical issues right now. Please try again later.") : /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.unknownError" }, "Something went wrong. Please contact support for assistance.");
}, y = ({ error: n, appId: r, isWithBackground: i = !0 }) => {
  var o;
  return a.isAxiosError(n) && r && ((o = n.response) == null ? void 0 : o.status) === 404 ? /* @__PURE__ */ e.createElement("div", { className: "noMatchingGameError", style: { backgroundImage: i ? `url(${m})` : void 0 } }, /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement("h2", { className: "heading" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.noMatchingGame" }, 'Game "', { appId: r }, `" doesn't exist in the store.`)), /* @__PURE__ */ e.createElement("p", { className: "paragraph" }, /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.noMatchingGameResolution" }, "To fix this, do one of the following:")), /* @__PURE__ */ e.createElement("ol", { className: "list" }, /* @__PURE__ */ e.createElement("li", null, /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.noMatchingGameResolutionEnsure" }, 'Ensure the game "', { appId: r }, '" exists in the store,')), /* @__PURE__ */ e.createElement("li", null, /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.noMatchingGameResolutionChangeAppID" }, "Change the App ID to an existing game, or")), /* @__PURE__ */ e.createElement("li", null, /* @__PURE__ */ e.createElement(t, { i18nKey: "CommonError.noMatchingGameResolutionChangeTemplateConfig" }, "Change the Template Config to multiple game."))))) : /* @__PURE__ */ e.createElement(c, { error: n });
};
export {
  c as CommonError,
  y as NoMatchingGameError
};
