import { DesktopChecker as N } from "@accelbyte/sdk";
import { getAvailableEnvVars as C, getEnvVarMap as P } from "./accelbyte-widgets320.mjs";
const e = C(), E = P(), R = (L) => L.value, S = (L, A) => R(L) ? R(L) === "true" : A, n = () => {
  const A = [
    E.ADMINPORTAL_CLIENT_ID,
    E.PLAYERPORTAL_CLIENT_ID,
    E.LAUNCHER_CLIENT_ID,
    E.SDK_PLAYGROUND_CLIENT_ID,
    E.STORYBOOK_CLIENT_ID
  ].find((I) => I.value !== void 0 && I.value !== "");
  return (A == null ? void 0 : A.value) || "";
}, U = () => {
  const A = [
    E.CONF_EDITOR_REDIRECT_URI,
    E.PLAYERPORTAL_REDIRECT_URI,
    E.LAUNCHER_REDIRECT_URI,
    E.SDK_PLAYGROUND_REDIRECT_URI,
    E.STORYBOOK_REDIRECT_URI
  ].find((I) => I.value !== void 0 && I.value !== "");
  return (A == null ? void 0 : A.value) || "";
};
class _ {
  static failOnMissing(A = []) {
    const I = A.reduce((O, { key: T, value: D }) => (D || O.push(T), O), []);
    if (I.length > 0)
      throw Error(`Missing required env var 
${I.map((O) => `❌ ${O}`).join(`
`)}`);
  }
}
_.BASE_URL = R(E.BASE_URL);
_.CLIENT_ID = n();
_.NAMESPACE = R(E.NAMESPACE);
_.REDIRECT_URL = U();
_.CONF_SERVER = R(E.CONF_SERVER);
_.PLAYER_PORTAL_BASE_URL = N.isDesktopApp() ? "" : R(E.PLAYERPORTAL_BASE_PATH) ?? "";
_.CONF_EDITOR_BASE_PATH = R(E.CONF_EDITOR_BASE_PATH);
_.NODE_ENV = R(E.NODE_ENV);
_.IS_DEV_MODE = R(E.NODE_ENV) === "development";
_.IS_PROD_MODE = R(E.NODE_ENV) === "production";
_.IS_DEBUG_PROD = R(E.DEBUG_PROD) === "true";
_.CACHE_URL = R(E.CACHE_URL);
_.LEGAL_WEB_URL = R(E.LEGAL_WEB_URL);
_.CONTACT_SUPPORT_EMAIL = R(E.CONTACT_SUPPORT_EMAIL);
_.TELEMETRY_GOOGLE_ANALYTICS_TRACKING_ID = R(E.TELEMETRY_GOOGLE_ANALYTICS_TRACKING_ID);
_.WALLET_VIRTUAL_CURRENCY_CODE = R(E.WALLET_VIRTUAL_CURRENCY_CODE);
_.READY_PLAYER_ME_AVATAR_URL = R(E.READY_PLAYER_ME_AVATAR_URL);
_.IS_DISABLE_DISPLAY_NAME = S(E.IS_DISABLE_DISPLAY_NAME, !1);
_.IS_DISABLE_USERNAME = S(E.IS_DISABLE_USERNAME, !1);
_.MOCK_WINDOWS = S(E.MOCK_WINDOWS, !1);
_.ACCESS_TOKEN = R(E.ACCESS_TOKEN);
_.SERVER_PORT = R(E.SERVER_PORT);
_.SDK_PLAYGROUND_BASE_PATH = R(E.SDK_PLAYGROUND_BASE_PATH);
_.STORYBOOK_BASE_PATH = R(E.STORYBOOK_BASE_PATH);
_.REDIS_HOST = R(E.PLAYERPORTAL_REDIS_HOST);
_.REDIS_PORT = R(E.PLAYERPORTAL_REDIS_PORT);
_.REDIS_EXPIRATION_TIME = R(E.PLAYERPORTAL_REDIS_EXPIRATION_TIME);
_.NEWS_BASE_PATH = R(E.NEWS_BASE_PATH);
_.NEWS_V2_URL = R(E.NEWS_V2_URL) || "";
_.FULL_ACCESS_LOG_ENABLED = R(E.FULL_ACCESS_LOG_ENABLED);
_.LAUNCHER_APP_ID = R(E.LAUNCHER_APP_ID);
_.LAUNCHER_GUID = R(E.LAUNCHER_GUID);
_.LAUNCHER_PAYMENT_URL = R(E.LAUNCHER_PAYMENT_URL);
if (_.IS_DEV_MODE || _.IS_DEBUG_PROD) {
  const L = { ...e };
  console.log("Env:", JSON.stringify(L, null, 2).replace(/"/g, ""));
}
export {
  _ as Env
};
