text: "use strict";
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  };
  var __generator = (this && this.__generator) || function (thisArg, body) {
      var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
      return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
      function verb(n) { return function (v) { return step([n, v]); }; }
      function step(op) {
          if (f) throw new TypeError("Generator is already executing.");
          while (_) try {
              if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
              if (y = 0, t) op = [op[0] & 2, t.value];
              switch (op[0]) {
                  case 0: case 1: t = op; break;
                  case 4: _.label++; return { value: op[1], done: false };
                  case 5: _.label++; y = op[1]; op = [0]; continue;
                  case 7: op = _.ops.pop(); _.trys.pop(); continue;
                  default:
                      if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
                      if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
                      if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
                      if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
                      if (t[2]) _.ops.pop();
                      _.trys.pop(); continue;
              }
              op = body.call(thisArg, _);
          } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
          if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
      }
  };
  window.addEventListener("load", function () { return __awaiter(void 0, void 0, void 0, function () {
      var _a, IsDarkMode, SetDarkMode, IsTestnet, AsyncNoParallel, ShowRandomnessCanvas, newLink, isTestnet, RunTests_1, testOverlay_1, testRunningDiv_1, testRunningProgress_1, testDoneDiv_1, testResultTextDiv_1, testResultCloseButton, GenerateSingleAddress;
      return __generator(this, function (_b) {
          switch (_b.label) {
              case 0:
                  CreateWorkers();
                  _a = Util(), IsDarkMode = _a.IsDarkMode, SetDarkMode = _a.SetDarkMode, IsTestnet = _a.IsTestnet, AsyncNoParallel = _a.AsyncNoParallel;
                  ShowRandomnessCanvas = EntropyCanvas().ShowRandomnessCanvas;
                  // set testnet value
                  WorkerInterface.SetIsTestnet(IsTestnet());
                  // initialize favicon
                  {
                      newLink = document.createElement("link");
                      newLink.rel = "shortcut icon";
                      newLink.type = "image/png";
                      newLink.href = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5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yyE3rWs1YEaIi5LxXEo/AGbLYSlLEIrUy1Amoc9ov3AQjgleRpMvIYK2KmUkl9JXARvAKInDG+Wl/UPvKIKgoeOWgb/sYc8JmQVh7rkruZQ+F9zA9vwS+4CMAohukuHMz4I4VKO4MGnR2x+ktUeRjSu2XTRxKlZs55fYFYwyWHpCuyhmS7aVAQ3dwtEhq+CkGJ/HfKbuuyS/+ZS53K0qm+ROSQzgu7A0JyCQeOsy3JVj6r5HU5/i+GgQq7qYVYNZwQ2VX+bg6jbUdxbWhRcK+5fm9YBD+quPFYOaZilHjxj5lK5ZnaB2bwFqO6mItVgYUSHaDH8+ahLvV+y6GeqUZm007g+AholrDokZn+qtGjS8GfTwcv+zyqqSZGkTbVQ0dAWoalYsv4Mv0x7TAw7j110Q6L5rIIEVsREmbpgVPMsucgLgwD2Txh4p/Rla+wzSCx6bjxVU+TSUF1xrxqWhJdOB8AqNBCyo6whw+KGJ8x02bAFR/Kv65D2P2SGnvI17DGA2UiuP7bg+5eUg+cHHqoDRy3nOTgQZO+9ihuDPJ5/FL365/UeuzbQBYMf1pVC1tGV/651eXvP0ikswqpkf18xPumuKbEaYcWyurh6mcCgmQ9mkPs16rSnaNsOMODZXSsMk64xzp1UlN7Wve500G4s3JnyfJ65NPzBdDv8dAPwl9qfQLkNMAAAAAElFTkSuQmCC";
                      document.getElementsByTagName("head")[0].appendChild(newLink);
                  }
                  // show warning if not running from a local file
                  if (window.location.protocol !== "file:") {
                      document.getElementById("warning-text").style.display = "";
                  }
                  // dark mode events
                  {
                      SetDarkMode(IsDarkMode());
                      document.getElementById("light-mode-button").addEventListener("click", function () { return SetDarkMode(false); });
                      document.getElementById("dark-mode-button").addEventListener("click", function () { return SetDarkMode(true); });
                  }
                  // setup testnet links / texts
                  {
                      isTestnet = IsTestnet();
                      if (isTestnet) {
                          document.getElementById("testnet-text").style.display = "";
                          document.getElementById("run-tests-link").style.display = "none";
                      }
                      document.getElementById("testnet-link-li").style.display = isTestnet ? "none" : "";
                      document.getElementById("mainnet-link-li").style.display = isTestnet ? "" : "none";
                  }
                  // tests
                  {
                      RunTests_1 = InitTests();
                      testOverlay_1 = document.getElementById("tests-overlay");
                      testRunningDiv_1 = document.getElementById("tests-running-container");
                      testRunningProgress_1 = document.getElementById("tests-running-progress");
                      testDoneDiv_1 = document.getElementById("tests-done-container");
                      testResultTextDiv_1 = document.getElementById("tests-result");
                      testResultCloseButton = document.getElementById("tests-result-close-button");
                      document.getElementById("run-tests-link").addEventListener("click", AsyncNoParallel(function () { return __awaiter(void 0, void 0, void 0, function () {
                          var failedTestMessages;
                          return __generator(this, function (_a) {
                              switch (_a.label) {
                                  case 0:
                                      testOverlay_1.style.display = "flex";
                                      testRunningDiv_1.style.display = "flex";
                                      testDoneDiv_1.style.display = "none";
                                      return [4 /*yield*/, RunTests_1(function (current, total) {
                                              testRunningProgress_1.textContent = current + "/" + total;
                                          })];
                                  case 1:
                                      failedTestMessages = _a.sent();
                                      testRunningDiv_1.style.display = "none";
                                      testDoneDiv_1.style.display = "flex";
                                      if (failedTestMessages.length === 0) {
                                          testResultTextDiv_1.textContent = "All tests OK!";
                                      }
                                      else {
                                          testResultTextDiv_1.textContent = failedTestMessages.length + " test" + (failedTestMessages.length === 1 ? "" : "s") + " failed! Please report this issue! Check the developer console for details.";
                                          failedTestMessages.forEach(console.error);
                                      }
                                      return [2 /*return*/];
                              }
                          });
                      }); }));
                      testResultCloseButton.addEventListener("click", function () { return testOverlay_1.style.display = "none"; });
                  }
                  InitializePage();
                  GenerateSingleAddress = InitSingleAddressPage();
                  InitAddressDetailsPage();
                  InitBulkGeneratePage();
                  InitPaperWalletPage();
                  InitMnemonicSeedPage();
                  GetCustomPaperWalletDesign = InitCustomPaperWalletDesign();
                  return [4 /*yield*/, ShowRandomnessCanvas()];
              case 1:
                  _b.sent();
                  return [4 /*yield*/, GenerateSingleAddress()];
              case 2:
                  _b.sent();
                  return [2 /*return*/];
          }
      });
  }); });
  