package net.minecraft.launcher;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.mojang.launcher.updater.LowerCaseEnumTypeAdapterFactory;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import net.mc.main.Main;
import org.apache.commons.io.IOUtils;

public class LauncherConstants {
   public static final int VERSION_FORMAT = 21;
   public static final int PROFILES_FORMAT = 1;
   public static final String VERSION_NAME;
   public static final String BACK_IMAGE = "/prismarine.png";
   public static final URI URL_REGISTER;
   public static final String DEFAULT_PROFILE_NAME = "(Default)";
   public static final String URL_DOWNLOAD_BASE = "https://s3.amazonaws.com/Minecraft.Download/";
   public static final String URL_RESOURCE_BASE = "http://resources.download.minecraft.net/";
   public static final String URL_LIBRARY_BASE = "https://libraries.minecraft.net/";
   public static final String URL_BLOG = "http://486.merith.xyz/obsidian/";
   public static final String URL_SUPPORT = "https://skaiacraft.net/support";
   public static final String URL_STATUS_CHECKER = "http://status.mojang.com/check";
   public static final int UNVERSIONED_BOOTSTRAP_VERSION = 0;
   public static final int MINIMUM_BOOTSTRAP_SUPPORTED = 4;
   public static final int SUPER_COOL_BOOTSTRAP_VERSION = 100;
   public static final String URL_BOOTSTRAP_DOWNLOAD = "https://mojang.com/2013/06/minecraft-1-6-pre-release/";
   public static final String[] LAUNCHER_OUT_OF_DATE_BUTTONS;
   public static final String[] BOOTSTRAP_OUT_OF_DATE_BUTTONS;
   public static final String[] CONFIRM_PROFILE_DELETION_OPTIONS;
   public static final URI URL_FORGOT_USERNAME;
   public static final URI URL_FORGOT_PASSWORD_MINECRAFT;
   public static final URI URL_FORGOT_MIGRATED_EMAIL;
   public static final URI URL_DEMO_HELP;
   public static final URI URL_UPGRADE;
   public static final int MAX_NATIVES_LIFE_IN_SECONDS = 3600;
   public static final int MAX_SKIN_LIFE_IN_SECONDS = 604800;
   public static final String URL_JAR_FALLBACK = "https://s3.amazonaws.com/Minecraft.Download/";
   public static final URI URL_UPGRADE_WINDOWS;
   public static final URI URL_UPGRADE_OSX;
   public static final LauncherConstants.LauncherProperties PROPERTIES;

   static {
      VERSION_NAME = "Skaia Launcher v" + Main.currentv;
      URL_REGISTER = constantURI("https://account.mojang.com/register");
      LAUNCHER_OUT_OF_DATE_BUTTONS = new String[]{"Nevermind, close this launcher", "I'm sure. Reset my settings."};
      BOOTSTRAP_OUT_OF_DATE_BUTTONS = new String[]{"Go to URL", "Close"};
      CONFIRM_PROFILE_DELETION_OPTIONS = new String[]{"Delete profile", "Cancel"};
      URL_FORGOT_USERNAME = constantURI("http://help.mojang.com/customer/portal/articles/1233873?ref=launcher");
      URL_FORGOT_PASSWORD_MINECRAFT = constantURI("http://help.mojang.com/customer/portal/articles/329524-change-or-forgot-password?ref=launcher");
      URL_FORGOT_MIGRATED_EMAIL = constantURI("http://help.mojang.com/customer/portal/articles/1205055-minecraft-launcher-error---migrated-account?ref=launcher");
      URL_DEMO_HELP = constantURI("https://help.mojang.com/customer/portal/articles/1218766-can-only-play-minecraft-demo?ref=launcher");
      URL_UPGRADE = constantURI("https://launcher.mojang.com/download/MinecraftInstaller.msi");
      URL_UPGRADE_WINDOWS = constantURI("https://launcher.mojang.com/download/MinecraftInstaller.msi");
      URL_UPGRADE_OSX = constantURI("https://launcher.mojang.com/download/Minecraft.dmg");
      PROPERTIES = getProperties();
   }

   public static URI constantURI(String input) {
      try {
         return new URI(input);
      } catch (URISyntaxException var2) {
         throw new Error(var2);
      }
   }

   public static URL constantURL(String input) {
      try {
         return new URL(input);
      } catch (MalformedURLException var2) {
         throw new Error(var2);
      }
   }

   public static String getVersionName() {
      return VERSION_NAME;
   }

   private static LauncherConstants.LauncherProperties getProperties() {
      Gson gson = (new GsonBuilder()).registerTypeAdapterFactory(new LowerCaseEnumTypeAdapterFactory()).create();
      InputStream stream = LauncherConstants.class.getResourceAsStream("/launcher_properties.json");
      if (stream != null) {
         LauncherConstants.LauncherProperties var4;
         try {
            var4 = (LauncherConstants.LauncherProperties)gson.fromJson(IOUtils.toString(stream), LauncherConstants.LauncherProperties.class);
         } catch (IOException var7) {
            var7.printStackTrace();
            return new LauncherConstants.LauncherProperties();
         } finally {
            IOUtils.closeQuietly(stream);
         }

         return var4;
      } else {
         return new LauncherConstants.LauncherProperties();
      }
   }

   public static enum LauncherEnvironment {
      PRODUCTION(""),
      STAGING(" (STAGING VERSION, NOT FINAL)"),
      DEV(" (DEV VERSION, NOT FINAL)");

      private final String title;

      private LauncherEnvironment(String title) {
         this.title = title;
      }

      public String getTitle() {
         return this.title;
      }
   }

   public static class LauncherProperties {
      private LauncherConstants.LauncherEnvironment environment;
      private URL versionManifest;

      public LauncherProperties() {
         this.environment = LauncherConstants.LauncherEnvironment.PRODUCTION;
         this.versionManifest = LauncherConstants.constantURL("https://launchermeta.mojang.com/mc/game/version_manifest.json");
      }

      public LauncherConstants.LauncherEnvironment getEnvironment() {
         return this.environment;
      }

      public URL getVersionManifest() {
         return this.versionManifest;
      }
   }
}
