import { z as a } from "zod";
import { VALIDATION_ERROR_CODE as z, DesktopChecker as Z } from "@accelbyte/sdk";
import Y from "axios";
import { LoginErrorParam as $, IamUserAuthorizationClient as C, Iam as D, IamOAuthClient as M, TokenResponseV3 as Q } from "@accelbyte/sdk-iam";
import { c as p, u as v, e as ee, h as re } from "./useRoutes-367960a3.mjs";
import { useCallback as o } from "react";
import { Basic as i } from "@accelbyte/sdk-basic";
const ve = a.enum(["EMAILPASSWD"]), l = a.enum([
  "steam",
  "steamopenid",
  "facebook",
  "google",
  "oculus",
  "oculusweb",
  "twitch",
  "ios",
  "device",
  "discord",
  "epicgames",
  "ps4",
  "ps4web",
  "ps5",
  "live",
  "xblweb",
  "stadia",
  "stadiaweb",
  "apple",
  "netflix",
  "eaorigin",
  "azuresaml"
]), Ge = a.enum(["psn", "steamnetwork"]), Ee = a.object({
  namespace: a.string(),
  platformUserId: a.string(),
  displayName: a.string().optional()
});
a.object({
  linkedPlatforms: a.array(Ee),
  namespace: a.string(),
  userId: a.string(),
  displayName: a.string(),
  emailAddress: a.string()
});
const de = a.enum(["SUCCESS", "FAILED", "PENDING"]);
var _e = /* @__PURE__ */ ((e) => (e.TEMPLATE_CONFIG = "templateConfig", e.AVATARS_LIST_CONFIG = "avatarsList", e.LAUNCHER_DOWNLOAD_LINK_CONFIG = "launcherDownloadLink", e.LAUNCHER_UPDATE_URL_CONFIG = "launcherUpdateUrl", e.PAGE_CONFIG = "pageConfig", e.SOCIAL_LINKS = "socialLinks", e.EXPERIMENTAL_FEATURE_FLAGS = "experimentalFeatureFlags", e.LAUNCHER_FEATURE_FLAGS = "launcherFeatureFlags", e.PP_FEATURE_FLAGS = "ppFeatureFlags", e.LOGIN_FEATURE_FLAGS = "loginFeatureFlags", e.SUPPORT_FEATURE_FLAGS = "supportFeatureFlags", e.NEWS_FEATURE_FLAG = "newsFeatureFlags", e.APP_ID = "appId", e.COMPANY_LOGO = "companyLogo", e.BRAND_NAME = "brandName", e.META_DATA = "metaData", e.FOOTER = "footer", e.HOMEPAGE = "homepage", e.FAVICON = "favicon", e.COPYRIGHT = "copyright", e.SUPPORT_EMAIL = "supportEmail", e.GLOBAL_PAGE_CONFIG = "globalPageConfig", e.THIRD_PARTY_LOGIN = "thirdPartyLogin", e.LOGO_VARIANT = "logoVariant", e.LAUNCHER_TEMPLATE_INFO = "launcherTemplateInfo", e.LEGAL_TEMPLATE_INFO = "legalTemplateInfo", e.LOGIN_TEMPLATE_INFO = "loginTemplateInfo", e.PP_TEMPLATE_INFO = "ppTemplateInfo", e.PAYMENT_TEMPLATE_INFO = "paymentTemplateInfo", e.TWITCHDROP_TEMPLATE_INFO = "twitchDropTemplateInfo", e.GAMELIST = "gameList", e.STREAMER_INFO = "streamerInfo", e.BACKGROUND = "backgroundConfig", e.PAGE_TITLE = "pageTitle", e.SUBMISSION_FORM = "submissionForm", e.DISPLAY_CTA_BUTTON = "displayCTAButton", e.KNOWLEDGE_BASE_SETTING = "knowledgeBaseSettings", e.LAUNCHER_ICON = "launcherIcon", e.HEADER_CUSTOMIZATION = "customHeader", e.FOOTER_CUSTOMIZATION = "customFooter", e.PAGE_SCROLL_CUSTOMIZATION = "customClassPageScrollEvent", e.DISPLAY_NEWS_PAGE = "displayNewsPage", e.AGE_GATING = "ageGating", e.APP_PRINCING = "singleTemplatePricingModel", e))(_e || {}), te = /* @__PURE__ */ ((e) => (e.TWITCH = "twitch", e.DISCORD = "discord", e.TWITTER = "twitter", e.YOUTUBE = "youtube", e.FACEBOOK = "facebook", e.TIKTOK = "tiktok", e.INSTAGRAM = "instagram", e.REDDIT = "reddit", e.LINKEDIN = "linkedin", e))(te || {}), Ae = /* @__PURE__ */ ((e) => (e.TITLE_FONT = "font-title", e.BODY_FONT = "font-body", e.HEADING_FONT = "font-heading", e))(Ae || {}), se = /* @__PURE__ */ ((e) => (e.PP = "pp", e.LAUNCHER = "launcher", e.WIDGET = "widget", e.LOGIN = "login", e.LEGAL = "legal", e.PAYMENT = "payment", e.TWITCHDROP = "twitchdrop", e.SUPPORT = "support", e.NEWS = "news", e))(se || {});
const Ye = a.enum([
  l.enum.steamopenid,
  l.enum.epicgames,
  l.enum.ps4web,
  l.enum.xblweb,
  l.enum.facebook,
  l.enum.google,
  l.enum.twitch,
  l.enum.apple,
  l.enum.discord,
  l.enum.oculusweb
]), Me = "preview";
var Re = /* @__PURE__ */ ((e) => (e.FULL_BIRTH = "full-birth", e.CHECKBOX = "checkbox", e))(Re || {});
class S {
  //
  static errorToString(r) {
    return JSON.stringify(r, Object.getOwnPropertyNames(r));
  }
  static isAxiosError(r) {
    return !!r && !!r.config;
  }
  static isAxiosNetworkError(r) {
    return S.isAxiosError(r) && (!r.response || r.code === Y.AxiosError.ERR_NETWORK);
  }
  static isAxiosServerError(r) {
    var _, T;
    if (r instanceof Y.AxiosError && ((_ = r.response) != null && _.status)) {
      const P = (T = r.response) == null ? void 0 : T.status;
      return S.isAxiosError(r) && P >= 500 && P <= 599;
    }
    return !1;
  }
  static isLoginSessionExpired(r) {
    return r.message === $.Enum.login_session_expired;
  }
  static extractServiceErrorCode(r) {
    var _;
    if (S.isAxiosError(r) && ((_ = r == null ? void 0 : r.response) != null && _.data)) {
      const T = r.response.data;
      if (Le.safeParse(T).success)
        return T.errorCode;
      if (ae.safeParse(T).success)
        return T.ErrorCode;
    }
    return null;
  }
  static isInputValidationError(r) {
    return S.isAxiosError(r) && S.extractServiceErrorCode(r) === z;
  }
}
const ae = a.object({
  ErrorCode: a.number(),
  ErrorMessage: a.string()
}), Le = a.object({
  errorCode: a.number(),
  errorMessage: a.string()
});
var n = /* @__PURE__ */ ((e) => (e.IDLE = "idle", e.FETCHING = "fetching", e.CREATING = "creating", e.UPDATING = "updating", e.PURCHASING = "purchasing", e.CLAIMING = "claiming", e.REDEEMING = "redeeming", e.CANCELLING = "cancelling", e.REQUESTING = "requesting", e.VERIFYING = "verifying", e.DELETING = "deleting", e.DOWNLOADING = "downloading", e.SENDING = "sending", e))(n || {});
const ne = p("sdk");
function oe() {
  return v(ne);
}
const Te = p("sdk-options");
function Fe() {
  return v(Te);
}
class N {
  static getErrorType(r) {
    return console.error(r), r;
  }
}
const F = {
  user: null,
  userFetchError: null,
  userUpdateError: null,
  userFetchStatus: n.IDLE,
  userProfile: null,
  userProfileError: null,
  userProfileFetchStatus: n.IDLE,
  mfaData: null,
  authenticatorKey: null,
  authenticatorKeyFetchStatus: n.IDLE,
  isLinkingAccountRequired2FA: !1
}, Ie = p("user-info", F);
function He() {
  const [e] = oe(), [r, _] = v(Ie), { state: T } = ee(), { state: P } = re(), c = o(() => {
    e && _({ mfaData: C.getMfaDataFromStorage() });
  }, [e]), d = o(() => {
    _(F);
  }, []), f = o(async () => {
    let s = null, A = null;
    try {
      return _({ userFetchError: null, userFetchStatus: n.FETCHING }), s = await D.UsersApi(e).getUsersMe(), { data: s };
    } catch (L) {
      return A = N.getErrorType(L), { error: A };
    } finally {
      _({ user: s, userFetchError: A, userFetchStatus: n.IDLE });
    }
  }, [e]), B = o(
    async (s = !1) => {
      var I, u;
      let A = null, L = null;
      try {
        _({ userProfileFetchStatus: n.FETCHING, userProfileError: null });
        const O = await m(e);
        if (O.data && (A = O.data), O.error) {
          if (!s)
            throw O.error;
          if (s && O.error && S.isAxiosError(O.error) && Number((u = (I = O.error.response) == null ? void 0 : I.data) == null ? void 0 : u.errorCode) === 11440) {
            const U = await y(e);
            if (U.error)
              throw U.error;
            A = U.data;
          }
        }
        return { data: A };
      } catch (O) {
        return L = N.getErrorType(O), { error: L };
      } finally {
        _({ userProfileError: L, userProfile: A, userProfileFetchStatus: n.IDLE });
      }
    },
    [e]
  ), m = async (s) => {
    try {
      return { data: await i.UserProfileApi(s).getUsersMeProfiles() };
    } catch (A) {
      return { error: N.getErrorType(A) };
    }
  }, y = async (s) => {
    try {
      return { data: await i.UserProfileApi(s).createUserMeProfile({}) };
    } catch (A) {
      return { error: N.getErrorType(A) };
    }
  }, k = o(
    async (s) => {
      let A = null, L = null;
      if (Object.keys(s).length !== 0)
        try {
          return _({
            userFetchStatus: n.UPDATING,
            userUpdateError: null
          }), A = await D.UsersApi(e).updateUserMe(s), _({ user: A, userFetchStatus: n.IDLE }), { data: A };
        } catch (I) {
          return L = N.getErrorType(I), _({ userUpdateError: L, userFetchStatus: n.IDLE }), { error: L };
        }
    },
    [e]
  ), g = o(
    async (s) => {
      let A = null, L = null;
      if (Object.keys(s).length !== 0)
        try {
          return _({
            userProfileFetchStatus: n.UPDATING,
            userProfileError: null
          }), A = await i.UserProfileApi(e).updateUserMeProfile(s), { data: A };
        } catch (I) {
          return L = N.getErrorType(I), { error: L };
        } finally {
          _({ userProfileError: L, userProfile: A, userProfileFetchStatus: n.IDLE });
        }
    },
    [e]
  ), h = o(
    async (s, A) => {
      let L = null, I;
      try {
        return _({
          userFetchStatus: n.UPDATING,
          userUpdateError: null
        }), await D.UsersV4Api(e).updateUserMeEmail({ code: s, emailAddress: A }), I = A, { data: null };
      } catch (u) {
        return L = N.getErrorType(u), { error: L };
      } finally {
        _((u) => ({
          ...u,
          userUpdateError: L,
          user: u.user ? {
            ...u.user,
            emailAddress: I || u.user.emailAddress
          } : u.user,
          userFetchStatus: n.IDLE
        }));
      }
    },
    [e]
  ), V = o(
    async (s, A, L) => {
      let I = null;
      try {
        return _({ userUpdateError: null, userFetchStatus: n.UPDATING }), await D.UsersApi(e).updateUserMePassword({
          oldPassword: s,
          newPassword: A,
          languageTag: L
        }), { data: null };
      } catch (u) {
        return I = N.getErrorType(u), { error: I };
      } finally {
        _({ userUpdateError: I, userFetchStatus: n.IDLE });
      }
    },
    [e]
  ), W = o(
    async (s) => {
      let A = null, L = null;
      try {
        return _({ userProfileError: null, userProfileFetchStatus: n.UPDATING }), A = await i.UserProfileApi(e).updateUserMeProfile({ avatarUrl: s }), { data: A };
      } catch (I) {
        return L = N.getErrorType(I), { error: I };
      } finally {
        _({ userProfile: A, userProfileError: L, userProfileFetchStatus: n.IDLE });
      }
    },
    [e]
  ), w = o(
    (s) => {
      _({ mfaData: s || C.getMfaDataFromStorage() });
    },
    [e]
  ), b = o(() => {
    _({ mfaData: void 0 });
  }, []), K = o(async (s) => {
    _({ mfaData: s, isLinkingAccountRequired2FA: !0 }), T.replace(P.home.link);
  }, []), x = o(() => {
    _({ isLinkingAccountRequired2FA: !1 });
  }, []), J = o(
    async (s) => {
      if (r.mfaData)
        try {
          return { data: (await new M(e).verify2FA({ ...s, mfaToken: r.mfaData.mfaToken })).data };
        } catch (A) {
          return { error: N.getErrorType(A) };
        }
    },
    [e, r.mfaData, r.isLinkingAccountRequired2FA]
  ), j = o(async () => {
    await new M(e).logout();
  }, [e]), q = o(async () => {
    const s = await new C(e).refreshToken();
    if (!s)
      return d(), null;
    const A = Q.safeParse(s);
    return A.success ? A.data : null;
  }, [e]), X = o(async () => {
    let s = null;
    try {
      return _({ authenticatorKeyFetchStatus: n.CREATING }), s = await D.UsersV4Api(e).createUserMeMfaAuthenticatorKey(), { data: s };
    } catch (A) {
      return { error: A };
    } finally {
      _({ authenticatorKey: s, authenticatorKeyFetchStatus: n.IDLE });
    }
  }, [e]);
  return {
    state: r,
    mutations: {
      resetState: d,
      fetchCurrentUserInformation: f,
      fetchUserProfile: B,
      updateUser: k,
      updateUserProfile: g,
      updateEmail: h,
      updatePassword: V,
      uploadUserProfileImage: W,
      logout: j,
      updateMFAData: w,
      removeMFAData: b,
      verify2FA: J,
      linkAccountRequired2FA: K,
      setDefaultMfaData: c,
      refreshToken: q,
      generateAuthenticatorSecretKey: X,
      clearLinkAccountRequired2FA: x
    }
  };
}
const fe = a.object({
  url: a.string().nullish(),
  accessUrl: a.string().nullish(),
  method: a.string().nullish(),
  contentType: a.string().nullish()
}), ue = "FNUH0TIFLLFTGNN9", H = () => ({
  NODE_ENV: {
    key: "NODE_ENV",
    value: process.env.NODE_ENV
  },
  DEBUG_PROD: {
    key: "DEBUG_PROD",
    value: process.env.DEBUG_PROD
  },
  BASE_URL: {
    key: "JUSTICE_BASE_URL",
    value: process.env.JUSTICE_BASE_URL
  },
  LEGAL_WEB_URL: {
    key: "JUSTICE_LEGAL_WEB_URL",
    value: process.env.JUSTICE_LEGAL_WEB_URL
  },
  // Odin Editor stuff.
  ADMINPORTAL_CLIENT_ID: {
    key: "ADMINPORTAL_CLIENT_ID",
    value: process.env.ADMINPORTAL_CLIENT_ID
  },
  CONF_EDITOR_REDIRECT_URI: {
    key: "CONF_EDITOR_REDIRECT_URI",
    value: process.env.CONF_EDITOR_REDIRECT_URI
  },
  CONF_EDITOR_BASE_PATH: {
    key: "CONF_EDITOR_BASE_PATH",
    value: process.env.CONF_EDITOR_BASE_PATH
  },
  // Web app stuff.
  PLAYERPORTAL_CLIENT_ID: {
    key: "PLAYERPORTAL_CLIENT_ID",
    value: process.env.PLAYERPORTAL_CLIENT_ID
  },
  PLAYERPORTAL_REDIRECT_URI: {
    key: "PLAYERPORTAL_REDIRECT_URI",
    value: process.env.PLAYERPORTAL_REDIRECT_URI
  },
  PLAYERPORTAL_BASE_PATH: {
    key: "PLAYERPORTAL_BASE_PATH",
    value: process.env.PLAYERPORTAL_BASE_PATH
  },
  PLAYERPORTAL_REDIS_HOST: {
    key: "PLAYERPORTAL_REDIS_HOST",
    value: process.env.PLAYERPORTAL_REDIS_HOST
  },
  PLAYERPORTAL_REDIS_PORT: {
    key: "PLAYERPORTAL_REDIS_PORT",
    value: process.env.PLAYERPORTAL_REDIS_PORT
  },
  PLAYERPORTAL_REDIS_EXPIRATION_TIME: {
    key: "PLAYERPORTAL_REDIS_EXPIRATION_TIME",
    value: process.env.PLAYERPORTAL_REDIS_EXPIRATION_TIME
  },
  NEWS_V2_URL: {
    key: "NEWS_V2_URL",
    value: process.env.NEWS_V2_URL
  },
  // Desktop app stuff.
  LAUNCHER_CLIENT_ID: {
    key: "LAUNCHER_CLIENT_ID",
    value: process.env.LAUNCHER_CLIENT_ID
  },
  LAUNCHER_REDIRECT_URI: {
    key: "LAUNCHER_REDIRECT_URI",
    value: process.env.LAUNCHER_REDIRECT_URI
  },
  LAUNCHER_STORE_KEY: {
    key: "LAUNCHER_STORE_KEY",
    value: process.env.LAUNCHER_STORE_KEY ?? ue
  },
  LAUNCHER_UPDATE_CHANNEL: {
    key: "LAUNCHER_UPDATE_CHANNEL",
    value: process.env.LAUNCHER_UPDATE_CHANNEL || "latest"
  },
  // SDK Playground app stuff.
  SDK_PLAYGROUND_CLIENT_ID: {
    key: "SDK_PLAYGROUND_CLIENT_ID",
    value: process.env.SDK_PLAYGROUND_CLIENT_ID
  },
  SDK_PLAYGROUND_REDIRECT_URI: {
    key: "SDK_PLAYGROUND_REDIRECT_URI",
    value: process.env.SDK_PLAYGROUND_REDIRECT_URI
  },
  SDK_PLAYGROUND_BASE_PATH: {
    key: "SDK_PLAYGROUND_BASE_PATH",
    value: process.env.SDK_PLAYGROUND_BASE_PATH
  },
  // News app stuff.
  NEWS_BASE_PATH: {
    key: "NEWS_BASE_PATH",
    value: process.env.NEWS_BASE_PATH
  },
  NAMESPACE: {
    key: "JUSTICE_PUBLISHER_NAMESPACE",
    value: process.env.JUSTICE_PUBLISHER_NAMESPACE
  },
  CONF_SERVER: {
    key: "JUSTICE_CONF_SERVER",
    value: process.env.JUSTICE_CONF_SERVER
  },
  // Storybook stuff.
  STORYBOOK_CLIENT_ID: {
    key: "STORYBOOK_CLIENT_ID",
    value: process.env.STORYBOOK_CLIENT_ID
  },
  STORYBOOK_REDIRECT_URI: {
    key: "STORYBOOK_REDIRECT_URI",
    value: process.env.STORYBOOK_REDIRECT_URI
  },
  STORYBOOK_BASE_PATH: {
    key: "STORYBOOK_BASE_PATH",
    value: process.env.STORYBOOK_BASE_PATH
  },
  CACHE_URL: {
    key: "CACHE_URL",
    value: process.env.CACHE_URL
  },
  SERVER_PORT: {
    key: "PORT",
    value: process.env.PORT
  },
  CONTACT_SUPPORT_EMAIL: {
    key: "CONTACT_SUPPORT_EMAIL",
    value: process.env.CONTACT_SUPPORT_EMAIL
  },
  TELEMETRY_GOOGLE_ANALYTICS_TRACKING_ID: {
    key: "TELEMETRY_GOOGLE_ANALYTICS_TRACKING_ID",
    value: process.env.TELEMETRY_GOOGLE_ANALYTICS_TRACKING_ID
  },
  WALLET_VIRTUAL_CURRENCY_CODE: {
    key: "JUSTICE_WALLET_VIRTUAL_CURRENCY_CODE",
    value: process.env.JUSTICE_WALLET_VIRTUAL_CURRENCY_CODE
  },
  READY_PLAYER_ME_AVATAR_URL: {
    key: "PLAYERPORTAL_READYPLAYERME_AVATAR_URL",
    value: process.env.PLAYERPORTAL_READYPLAYERME_AVATAR_URL
  },
  MOCK_WINDOWS: {
    key: "MOCK_WINDOWS",
    value: process.env.MOCK_WINDOWS
  },
  ACCESS_TOKEN: {
    key: "ACCESS_TOKEN",
    value: process.env.ACCESS_TOKEN
  },
  IS_DISABLE_DISPLAY_NAME: {
    key: "JUSTICE_PLAYERPORTAL_DISABLE_DISPLAY_NAME",
    value: process.env.JUSTICE_PLAYERPORTAL_DISABLE_DISPLAY_NAME
  },
  IS_DISABLE_USERNAME: {
    key: "JUSTICE_PLAYERPORTAL_DISABLE_USER_NAME",
    value: process.env.JUSTICE_PLAYERPORTAL_DISABLE_USER_NAME
  },
  LEGALWEB_BASE_PATH: {
    key: "LEGALWEB_BASE_PATH",
    value: process.env.LEGALWEB_BASE_PATH
  },
  LEGAL_CONTACT_SUPPORT_EMAIL: {
    key: "LEGAL_CONTACT_SUPPORT_EMAIL",
    value: process.env.LEGAL_CONTACT_SUPPORT_EMAIL
  },
  JUSTICE_API_URL: {
    key: "JUSTICE_API_URL",
    value: process.env.JUSTICE_API_URL
  },
  FULL_ACCESS_LOG_ENABLED: {
    key: "FULL_ACCESS_LOG_ENABLED",
    value: process.env.FULL_ACCESS_LOG_ENABLED
  },
  LAUNCHER_APP_ID: {
    key: "LAUNCHER_APP_ID",
    value: process.env.LAUNCHER_APP_ID
  },
  LAUNCHER_GUID: {
    key: "LAUNCHER_GUID",
    value: process.env.LAUNCHER_GUID
  },
  LAUNCHER_SENTRY_DSN: {
    key: "LAUNCHER_SENTRY_DSN",
    value: process.env.LAUNCHER_SENTRY_DSN
  },
  LAUNCHER_PAYMENT_URL: {
    key: "LAUNCHER_PAYMENT_URL",
    value: process.env.LAUNCHER_PAYMENT_URL
  },
  PLAYERPORTAL_CDN_URL: {
    key: "PLAYERPORTAL_CDN_URL",
    value: process.env.PLAYERPORTAL_CDN_URL
  },
  PLAYER_PORTAL_GA_ID: {
    key: "PLAYER_PORTAL_GA_ID",
    value: process.env.PLAYER_PORTAL_GA_ID
  },
  LAUNCHER_GA_ID: {
    key: "LAUNCHER_GA_ID",
    value: process.env.LAUNCHER_GA_ID
  },
  LAUNCHER_GA_KEY: {
    key: "LAUNCHER_GA_KEY",
    value: process.env.LAUNCHER_GA_KEY
  },
  ENABLE_COMMON_CONFIG_SERVICE: {
    key: "ENABLE_COMMON_CONFIG_SERVICE",
    value: process.env.ENABLE_COMMON_CONFIG_SERVICE
  },
  LOG_LEVEL: {
    key: "LOG_LEVEL",
    value: process.env.LOG_LEVEL
  },
  SENTRY_DSN: {
    key: "SENTRY_DSN",
    value: process.env.SENTRY_DSN
  }
}), le = (e = !0) => (() => {
  const r = H();
  return Object.keys(r).reduce((_, T) => {
    const { key: P, value: c } = r[T];
    return c && e && (_[P] = c), e || (_[P] = c), _;
  }, {});
})(), Ne = le(), E = H(), R = (e) => e.value, G = (e, r) => R(e) ? R(e) === "true" : r, Pe = () => {
  const r = [
    E.ADMINPORTAL_CLIENT_ID,
    E.PLAYERPORTAL_CLIENT_ID,
    E.LAUNCHER_CLIENT_ID,
    E.SDK_PLAYGROUND_CLIENT_ID,
    E.STORYBOOK_CLIENT_ID
  ].find((_) => _.value !== void 0 && _.value !== "");
  return (r == null ? void 0 : r.value) || "";
}, Oe = () => {
  const r = [
    E.CONF_EDITOR_REDIRECT_URI,
    E.PLAYERPORTAL_REDIRECT_URI,
    E.LAUNCHER_REDIRECT_URI,
    E.SDK_PLAYGROUND_REDIRECT_URI,
    E.STORYBOOK_REDIRECT_URI
  ].find((_) => _.value !== void 0 && _.value !== "");
  return (r == null ? void 0 : r.value) || "";
};
class t {
  // static LOGIN_ENABLE_CAPTCHA_VALIDATION = getEnv(ENV_VARS.LOGIN_ENABLE_CAPTCHA_VALIDATION)
  static failOnMissing(r = []) {
    const _ = r.reduce((T, { key: P, value: c }) => (c || T.push(P), T), []);
    if (_.length > 0)
      throw Error(`Missing required env var 
${_.map((T) => `❌ ${T}`).join(`
`)}`);
  }
}
t.BASE_URL = R(E.BASE_URL);
t.CLIENT_ID = Pe();
t.NAMESPACE = R(E.NAMESPACE);
t.REDIRECT_URL = Oe();
t.CONF_SERVER = R(E.CONF_SERVER);
t.PLAYER_PORTAL_BASE_URL = Z.isDesktopApp() ? "" : R(E.PLAYERPORTAL_BASE_PATH) ?? "";
t.PLAYER_PORTAL_GA_ID = R(E.PLAYER_PORTAL_GA_ID);
t.CONF_EDITOR_BASE_PATH = R(E.CONF_EDITOR_BASE_PATH);
t.NODE_ENV = R(E.NODE_ENV);
t.IS_DEV_MODE = R(E.NODE_ENV) === "development";
t.IS_PROD_MODE = R(E.NODE_ENV) === "production";
t.IS_DEBUG_PROD = R(E.DEBUG_PROD) === "true";
t.CACHE_URL = R(E.CACHE_URL);
t.LEGAL_WEB_URL = R(E.LEGAL_WEB_URL);
t.CONTACT_SUPPORT_EMAIL = R(E.CONTACT_SUPPORT_EMAIL);
t.TELEMETRY_GOOGLE_ANALYTICS_TRACKING_ID = R(E.TELEMETRY_GOOGLE_ANALYTICS_TRACKING_ID);
t.WALLET_VIRTUAL_CURRENCY_CODE = R(E.WALLET_VIRTUAL_CURRENCY_CODE);
t.READY_PLAYER_ME_AVATAR_URL = R(E.READY_PLAYER_ME_AVATAR_URL);
t.IS_DISABLE_DISPLAY_NAME = G(E.IS_DISABLE_DISPLAY_NAME, !1);
t.IS_DISABLE_USERNAME = G(E.IS_DISABLE_USERNAME, !1);
t.MOCK_WINDOWS = G(E.MOCK_WINDOWS, !1);
t.ACCESS_TOKEN = R(E.ACCESS_TOKEN);
t.SERVER_PORT = R(E.SERVER_PORT);
t.SDK_PLAYGROUND_BASE_PATH = R(E.SDK_PLAYGROUND_BASE_PATH);
t.STORYBOOK_BASE_PATH = R(E.STORYBOOK_BASE_PATH);
t.REDIS_HOST = R(E.PLAYERPORTAL_REDIS_HOST);
t.REDIS_PORT = R(E.PLAYERPORTAL_REDIS_PORT);
t.REDIS_EXPIRATION_TIME = R(E.PLAYERPORTAL_REDIS_EXPIRATION_TIME);
t.NEWS_BASE_PATH = R(E.NEWS_BASE_PATH);
t.NEWS_V2_URL = R(E.NEWS_V2_URL) || "";
t.FULL_ACCESS_LOG_ENABLED = R(E.FULL_ACCESS_LOG_ENABLED);
t.LAUNCHER_APP_ID = R(E.LAUNCHER_APP_ID);
t.LAUNCHER_GUID = R(E.LAUNCHER_GUID);
t.LAUNCHER_SENTRY_DSN = R(E.LAUNCHER_SENTRY_DSN);
t.LAUNCHER_PAYMENT_URL = R(E.LAUNCHER_PAYMENT_URL);
t.LAUNCHER_UPDATE_CHANNEL = R(E.LAUNCHER_UPDATE_CHANNEL);
t.ENABLE_COMMON_CONFIG_SERVICE = R(E.ENABLE_COMMON_CONFIG_SERVICE) === "true";
t.LOG_LEVEL = R(E.LOG_LEVEL);
if (t.IS_DEV_MODE || t.IS_DEBUG_PROD) {
  const e = { ...Ne };
  console.log("Env:", JSON.stringify(e, null, 2).replace(/"/g, ""));
}
export {
  se as A,
  _e as C,
  S as E,
  n as F,
  l as L,
  Ae as O,
  te as S,
  N as W,
  Me as a,
  t as b,
  He as c,
  Fe as d,
  Re as e,
  fe as f,
  Ye as g,
  de as h,
  Ge as i,
  ve as j,
  oe as u
};
