diff --git a/dist/engine.bundle.js b/dist/engine.bundle.js index 23b54d185..59d2808cb 100644 --- a/dist/engine.bundle.js +++ b/dist/engine.bundle.js @@ -1,33179 +1,4 @@ -/******/ (function(modules) { // webpackBootstrap -/******/ // install a JSONP callback for chunk loading -/******/ function webpackJsonpCallback(data) { -/******/ var chunkIds = data[0]; -/******/ var moreModules = data[1]; -/******/ var executeModules = data[2]; -/******/ -/******/ // add "moreModules" to the modules object, -/******/ // then flag all "chunkIds" as loaded and fire callback -/******/ var moduleId, chunkId, i = 0, resolves = []; -/******/ for(;i < chunkIds.length; i++) { -/******/ chunkId = chunkIds[i]; -/******/ if(installedChunks[chunkId]) { -/******/ resolves.push(installedChunks[chunkId][0]); -/******/ } -/******/ installedChunks[chunkId] = 0; -/******/ } -/******/ for(moduleId in moreModules) { -/******/ if(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) { -/******/ modules[moduleId] = moreModules[moduleId]; -/******/ } -/******/ } -/******/ if(parentJsonpFunction) parentJsonpFunction(data); -/******/ -/******/ while(resolves.length) { -/******/ resolves.shift()(); -/******/ } -/******/ -/******/ // add entry modules from loaded chunk to deferred list -/******/ deferredModules.push.apply(deferredModules, executeModules || []); -/******/ -/******/ // run deferred modules when all chunks ready -/******/ return checkDeferredModules(); -/******/ }; -/******/ function checkDeferredModules() { -/******/ var result; -/******/ for(var i = 0; i < deferredModules.length; i++) { -/******/ var deferredModule = deferredModules[i]; -/******/ var fulfilled = true; -/******/ for(var j = 1; j < deferredModule.length; j++) { -/******/ var depId = deferredModule[j]; -/******/ if(installedChunks[depId] !== 0) fulfilled = false; -/******/ } -/******/ if(fulfilled) { -/******/ deferredModules.splice(i--, 1); -/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]); -/******/ } -/******/ } -/******/ return result; -/******/ } -/******/ -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // object to store loaded and loading chunks -/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched -/******/ // Promise = chunk loading, 0 = chunk loaded -/******/ var installedChunks = { -/******/ 2: 0 -/******/ }; -/******/ -/******/ var deferredModules = []; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ var jsonpArray = window["webpackJsonp"] = window["webpackJsonp"] || []; -/******/ var oldJsonpFunction = jsonpArray.push.bind(jsonpArray); -/******/ jsonpArray.push = webpackJsonpCallback; -/******/ jsonpArray = jsonpArray.slice(); -/******/ for(var i = 0; i < jsonpArray.length; i++) webpackJsonpCallback(jsonpArray[i]); -/******/ var parentJsonpFunction = oldJsonpFunction; -/******/ -/******/ -/******/ // add entry module to deferred list -/******/ deferredModules.push([15,0]); -/******/ // run deferred modules when ready -/******/ return checkDeferredModules(); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */, -/* 1 */, -/* 2 */ -/*!***********************!*\ - !*** ./src/Player.js ***! - \***********************/ -/*! exports provided: Player, loadPlayer */ -/*! all exports used */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Player", function() { return Player; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "loadPlayer", function() { return loadPlayer; }); -/* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Corporation/Corporation */ 122); -/* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _PersonObjects_Player_PlayerObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./PersonObjects/Player/PlayerObject */ 794); -/* harmony import */ var _Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Exploits/Exploit */ 168); -/* harmony import */ var _Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/JSONReviver */ 29); -/* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! decimal.js */ 65); - - - - - - - - -let Player = new _PersonObjects_Player_PlayerObject__WEBPACK_IMPORTED_MODULE_1__[/* PlayerObject */ "a"](); - -function loadPlayer(saveString) { - Player = JSON.parse(saveString, _utils_JSONReviver__WEBPACK_IMPORTED_MODULE_3__["Reviver"]); - - // Parse Decimal.js objects - Player.money = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.money); - - if (Player.corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_0__["Corporation"]) { - Player.corporation.funds = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.corporation.funds); - Player.corporation.revenue = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.corporation.revenue); - Player.corporation.expenses = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](Player.corporation.expenses); - - for (var i = 0; i < Player.corporation.divisions.length; ++i) { - var ind = Player.corporation.divisions[i]; - ind.lastCycleRevenue = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.lastCycleRevenue); - ind.lastCycleExpenses = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.lastCycleExpenses); - ind.thisCycleRevenue = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.thisCycleRevenue); - ind.thisCycleExpenses = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["default"](ind.thisCycleExpenses); - } - } - - Player.exploits = Object(_Exploits_Exploit__WEBPACK_IMPORTED_MODULE_2__["sanitizeExploits"])(Player.exploits); -} - - -/***/ }), -/* 3 */, -/* 4 */ -/*!****************************************************!*\ - !*** ./src/Augmentation/data/AugmentationNames.ts ***! - \****************************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.AugmentationNames = void 0; -exports.AugmentationNames = { - Targeting1: "Augmented Targeting I", - Targeting2: "Augmented Targeting II", - Targeting3: "Augmented Targeting III", - SyntheticHeart: "Synthetic Heart", - SynfibrilMuscle: "Synfibril Muscle", - CombatRib1: "Combat Rib I", - CombatRib2: "Combat Rib II", - CombatRib3: "Combat Rib III", - NanofiberWeave: "Nanofiber Weave", - SubdermalArmor: "NEMEAN Subdermal Weave", - WiredReflexes: "Wired Reflexes", - GrapheneBoneLacings: "Graphene Bone Lacings", - BionicSpine: "Bionic Spine", - GrapheneBionicSpine: "Graphene Bionic Spine Upgrade", - BionicLegs: "Bionic Legs", - GrapheneBionicLegs: "Graphene Bionic Legs Upgrade", - SpeechProcessor: "Speech Processor Implant", - TITN41Injection: "TITN-41 Gene-Modification Injection", - EnhancedSocialInteractionImplant: "Enhanced Social Interaction Implant", - BitWire: "BitWire", - ArtificialBioNeuralNetwork: "Artificial Bio-neural Network Implant", - ArtificialSynapticPotentiation: "Artificial Synaptic Potentiation", - EnhancedMyelinSheathing: "Enhanced Myelin Sheathing", - SynapticEnhancement: "Synaptic Enhancement Implant", - NeuralRetentionEnhancement: "Neural-Retention Enhancement", - DataJack: "DataJack", - ENM: "Embedded Netburner Module", - ENMCore: "Embedded Netburner Module Core Implant", - ENMCoreV2: "Embedded Netburner Module Core V2 Upgrade", - ENMCoreV3: "Embedded Netburner Module Core V3 Upgrade", - ENMAnalyzeEngine: "Embedded Netburner Module Analyze Engine", - ENMDMA: "Embedded Netburner Module Direct Memory Access Upgrade", - Neuralstimulator: "Neuralstimulator", - NeuralAccelerator: "Neural Accelerator", - CranialSignalProcessorsG1: "Cranial Signal Processors - Gen I", - CranialSignalProcessorsG2: "Cranial Signal Processors - Gen II", - CranialSignalProcessorsG3: "Cranial Signal Processors - Gen III", - CranialSignalProcessorsG4: "Cranial Signal Processors - Gen IV", - CranialSignalProcessorsG5: "Cranial Signal Processors - Gen V", - NeuronalDensification: "Neuronal Densification", - NuoptimalInjectorImplant: "Nuoptimal Nootropic Injector Implant", - SpeechEnhancement: "Speech Enhancement", - FocusWire: "FocusWire", - PCDNI: "PC Direct-Neural Interface", - PCDNIOptimizer: "PC Direct-Neural Interface Optimization Submodule", - PCDNINeuralNetwork: "PC Direct-Neural Interface NeuroNet Injector", - PCMatrix: "PCMatrix", - ADRPheromone1: "ADR-V1 Pheromone Gene", - ADRPheromone2: "ADR-V2 Pheromone Gene", - ShadowsSimulacrum: "The Shadow's Simulacrum", - HacknetNodeCPUUpload: "Hacknet Node CPU Architecture Neural-Upload", - HacknetNodeCacheUpload: "Hacknet Node Cache Architecture Neural-Upload", - HacknetNodeNICUpload: "Hacknet Node NIC Architecture Neural-Upload", - HacknetNodeKernelDNI: "Hacknet Node Kernel Direct-Neural Interface", - HacknetNodeCoreDNI: "Hacknet Node Core Direct-Neural Interface", - NeuroFluxGovernor: "NeuroFlux Governor", - Neurotrainer1: "Neurotrainer I", - Neurotrainer2: "Neurotrainer II", - Neurotrainer3: "Neurotrainer III", - Hypersight: "HyperSight Corneal Implant", - LuminCloaking1: "LuminCloaking-V1 Skin Implant", - LuminCloaking2: "LuminCloaking-V2 Skin Implant", - HemoRecirculator: "HemoRecirculator", - SmartSonar: "SmartSonar Implant", - PowerRecirculator: "Power Recirculation Core", - QLink: "QLink", - TheRedPill: "The Red Pill", - SPTN97: "SPTN-97 Gene Modification", - HiveMind: "ECorp HVMind Implant", - CordiARCReactor: "CordiARC Fusion Reactor", - SmartJaw: "SmartJaw", - Neotra: "Neotra", - Xanipher: "Xanipher", - nextSENS: "nextSENS Gene Modification", - OmniTekInfoLoad: "OmniTek InfoLoad", - PhotosyntheticCells: "Photosynthetic Cells", - Neurolink: "BitRunners Neurolink", - TheBlackHand: "The Black Hand", - UnstableCircadianModulator: "Unstable Circadian Modulator", - CRTX42AA: "CRTX42-AA Gene Modification", - Neuregen: "Neuregen Gene Modification", - CashRoot: "CashRoot Starter Kit", - NutriGen: "NutriGen Implant", - INFRARet: "INFRARET Enhancement", - DermaForce: "DermaForce Particle Barrier", - GrapheneBrachiBlades: "Graphene BranchiBlades Upgrade", - GrapheneBionicArms: "Graphene Bionic Arms Upgrade", - BrachiBlades: "BrachiBlades", - BionicArms: "Bionic Arms", - SNA: "Social Negotiation Assistant (S.N.A)", - HydroflameLeftArm: "Hydroflame Left Arm", - EsperEyewear: "EsperTech Bladeburner Eyewear", - EMS4Recombination: "EMS-4 Recombination", - OrionShoulder: "ORION-MKIV Shoulder", - HyperionV1: "Hyperion Plasma Cannon V1", - HyperionV2: "Hyperion Plasma Cannon V2", - GolemSerum: "GOLEM Serum", - VangelisVirus: "Vangelis Virus", - VangelisVirus3: "Vangelis Virus 3.0", - INTERLINKED: "I.N.T.E.R.L.I.N.K.E.D", - BladeRunner: "Blade's Runners", - BladeArmor: "BLADE-51b Tesla Armor", - BladeArmorPowerCells: "BLADE-51b Tesla Armor: Power Cells Upgrade", - BladeArmorEnergyShielding: "BLADE-51b Tesla Armor: Energy Shielding Upgrade", - BladeArmorUnibeam: "BLADE-51b Tesla Armor: Unibeam Upgrade", - BladeArmorOmnibeam: "BLADE-51b Tesla Armor: Omnibeam Upgrade", - BladeArmorIPU: "BLADE-51b Tesla Armor: IPU Upgrade", - BladesSimulacrum: "The Blade's Simulacrum", - //Wasteland Augs - //PepBoy: "P.E.P-Boy", Plasma Energy Projection System - //PepBoyForceField Generates plasma force fields - //PepBoyBlasts Generate high density plasma concussive blasts - //PepBoyDataStorage STore more data on pep boy, -}; - - -/***/ }), -/* 5 */, -/* 6 */, -/* 7 */ -/*!*********************************!*\ - !*** ./src/ui/numeralFormat.ts ***! - \*********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.numeralWrapper = void 0; -const numeral_1 = __importDefault(__webpack_require__(/*! numeral */ 99)); -__webpack_require__(/*! numeral/locales/bg */ 1158); -__webpack_require__(/*! numeral/locales/cs */ 1157); -__webpack_require__(/*! numeral/locales/da-dk */ 1156); -__webpack_require__(/*! numeral/locales/de */ 1155); -__webpack_require__(/*! numeral/locales/en-au */ 1154); -__webpack_require__(/*! numeral/locales/en-gb */ 1153); -__webpack_require__(/*! numeral/locales/es */ 1152); -__webpack_require__(/*! numeral/locales/fr */ 1151); -__webpack_require__(/*! numeral/locales/hu */ 1150); -__webpack_require__(/*! numeral/locales/it */ 1149); -__webpack_require__(/*! numeral/locales/lv */ 1148); -__webpack_require__(/*! numeral/locales/no */ 1147); -__webpack_require__(/*! numeral/locales/pl */ 1146); -__webpack_require__(/*! numeral/locales/ru */ 1145); -/* eslint-disable class-methods-use-this */ -const extraFormats = [1e15, 1e18, 1e21, 1e24, 1e27, 1e30]; -const extraNotations = ['q', 'Q', 's', 'S', 'o', 'n']; -class NumeralFormatter { - constructor() { - // Default Locale - this.defaultLocale = "en"; - this.defaultLocale = 'en'; - } - updateLocale(l) { - if (numeral_1.default.locale(l) == null) { - console.warn(`Invalid locale for numeral: ${l}`); - numeral_1.default.locale(this.defaultLocale); - return false; - } - return true; - } - format(n, format) { - // numeraljs doesnt properly format numbers that are too big or too small - if (Math.abs(n) < 1e-6) { - n = 0; - } - const answer = numeral_1.default(n).format(format); - if (answer === 'NaN') { - return `${n}`; - } - return answer; - } - formatBigNumber(n) { - return this.format(n, "0.000a"); - } - // TODO: leverage numeral.js to do it. This function also implies you can - // use this format in some text field but you can't. ( "1t" will parse but - // "1s" will not) - formatReallyBigNumber(n, decimalPlaces = 3) { - if (n === Infinity) - return "∞"; - for (let i = 0; i < extraFormats.length; i++) { - if (extraFormats[i] < n && n <= extraFormats[i] * 1000) { - return this.format(n / extraFormats[i], '0.' + '0'.repeat(decimalPlaces)) + extraNotations[i]; - } - } - if (Math.abs(n) < 1000) { - return this.format(n, '0.' + '0'.repeat(decimalPlaces)); - } - const str = this.format(n, '0.' + '0'.repeat(decimalPlaces) + 'a'); - if (str === "NaNt") - return this.format(n, '0.' + ' '.repeat(decimalPlaces) + 'e+0'); - return str; - } - formatHp(n) { - if (n < 1e6) { - return this.format(n, "0,0"); - } - return this.formatReallyBigNumber(n); - } - formatMoney(n) { - return "$" + this.formatReallyBigNumber(n); - } - formatSkill(n) { - if (n < 1e15) { - return this.format(n, "0,0"); - } - return this.formatReallyBigNumber(n); - } - formatExp(n) { - return this.formatReallyBigNumber(n); - } - formatHashes(n) { - return this.formatReallyBigNumber(n); - } - formatReputation(n) { - return this.formatReallyBigNumber(n); - } - formatFavor(n) { - return this.format(n, "0,0"); - } - formatRAM(n) { - return this.format(n, "0.00") + "GB"; - } - formatPercentage(n, decimalPlaces = 2) { - const formatter = "0." + "0".repeat(decimalPlaces) + "%"; - return this.format(n, formatter); - } - formatServerSecurity(n) { - return this.format(n, "0,0.000"); - } - formatRespect(n) { - return this.formatReallyBigNumber(n, 5); - } - formatWanted(n) { - return this.formatReallyBigNumber(n, 5); - } - formatMultiplier(n) { - return this.format(n, "0,0.00"); - } - formatSleeveShock(n) { - return this.format(n, "0,0.000"); - } - formatSleeveSynchro(n) { - return this.format(n, "0,0.000"); - } - formatSleeveMemory(n) { - return this.format(n, "0"); - } - formatPopulation(n) { - return this.format(n, "0.000a"); - } - formatStamina(n) { - return this.format(n, "0.0"); - } - formatShares(n) { - if (n < 1000) { - return this.format(n, "0"); - } - return this.formatReallyBigNumber(n); - } - formatInfiltrationSecurity(n) { - return this.formatReallyBigNumber(n); - } - formatThreads(n) { - return this.format(n, "0,0"); - } - parseMoney(s) { - // numeral library does not handle formats like 1e10 well (returns 110), - // so if both return a valid number, return the biggest one - const numeralValue = numeral_1.default(s).value(); - const parsed = parseFloat(s); - if (isNaN(parsed) && numeralValue === null) { - return NaN; - } - else if (isNaN(parsed)) { - return numeralValue; - } - else if (numeralValue === null) { - return parsed; - } - else { - return Math.max(numeralValue, parsed); - } - } -} -exports.numeralWrapper = new NumeralFormatter(); - - -/***/ }), -/* 8 */ -/*!***********************************!*\ - !*** ./src/ui/postToTerminal.tsx ***! - \***********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.postContent = exports.postElement = exports.hackProgressPost = exports.hackProgressBarPost = exports.postError = exports.post = void 0; -const server_1 = __webpack_require__(/*! react-dom/server */ 398); -const getElementById_1 = __webpack_require__(/*! ../../utils/uiHelpers/getElementById */ 190); -/** - * Adds some output to the terminal. - * @param input Text or HTML to output to the terminal - */ -function post(input) { - postContent(input); -} -exports.post = post; -function postError(input) { - postContent(`ERROR: ${input}`, { color: "#ff2929" }); -} -exports.postError = postError; -/** - * Adds some output to the terminal with an identifier of "hack-progress-bar" - * @param input Text or HTML to output to the terminal - */ -function hackProgressBarPost(input) { - postContent(input, { id: "hack-progress-bar" }); -} -exports.hackProgressBarPost = hackProgressBarPost; -/** - * Adds some output to the terminal with an identifier of "hack-progress" - * @param input Text or HTML to output to the terminal - */ -function hackProgressPost(input) { - postContent(input, { id: "hack-progress" }); -} -exports.hackProgressPost = hackProgressPost; -function postElement(element) { - postContent(server_1.renderToStaticMarkup(element)); -} -exports.postElement = postElement; -function postContent(input, config = {}) { - // tslint:disable-next-line:max-line-length - const style = `color: ${config.color != null ? config.color : "var(--my-font-color)"}; background-color:var(--my-background-color);${config.id === undefined ? " white-space:pre-wrap;" : ""}`; - // tslint:disable-next-line:max-line-length - const content = `${input}`; - const inputElement = getElementById_1.getElementById("terminal-input"); - inputElement.insertAdjacentHTML("beforebegin", content); - scrollTerminalToBottom(); -} -exports.postContent = postContent; -function scrollTerminalToBottom() { - const container = getElementById_1.getElementById("terminal-container"); - container.scrollTop = container.scrollHeight; -} - - -/***/ }), -/* 9 */, -/* 10 */ -/*!*******************************************!*\ - !*** ./src/Netscript/RamCostGenerator.ts ***! - \*******************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getRamCost = exports.RamCosts = exports.RamCostConstants = void 0; -// TODO remember to update RamCalculations.js and WorkerScript.js -// RAM costs for Netscript functions -exports.RamCostConstants = { - ScriptBaseRamCost: 1.6, - ScriptDomRamCost: 25, - ScriptHackRamCost: 0.1, - ScriptHackAnalyzeRamCost: 1, - ScriptGrowRamCost: 0.15, - ScriptGrowthAnalyzeRamCost: 1, - ScriptWeakenRamCost: 0.15, - ScriptScanRamCost: 0.2, - ScriptPortProgramRamCost: 0.05, - ScriptRunRamCost: 1.0, - ScriptExecRamCost: 1.3, - ScriptSpawnRamCost: 2.0, - ScriptScpRamCost: 0.6, - ScriptKillRamCost: 0.5, - ScriptHasRootAccessRamCost: 0.05, - ScriptGetHostnameRamCost: 0.05, - ScriptGetHackingLevelRamCost: 0.05, - ScriptGetMultipliersRamCost: 4.0, - ScriptGetServerRamCost: 0.1, - ScriptGetServerMaxRam: 0.05, - ScriptGetServerUsedRam: 0.05, - ScriptFileExistsRamCost: 0.1, - ScriptIsRunningRamCost: 0.1, - ScriptHacknetNodesRamCost: 4.0, - ScriptHNUpgLevelRamCost: 0.4, - ScriptHNUpgRamRamCost: 0.6, - ScriptHNUpgCoreRamCost: 0.8, - ScriptGetStockRamCost: 2.0, - ScriptBuySellStockRamCost: 2.5, - ScriptGetPurchaseServerRamCost: 0.25, - ScriptPurchaseServerRamCost: 2.25, - ScriptGetPurchasedServerLimit: 0.05, - ScriptGetPurchasedServerMaxRam: 0.05, - ScriptRoundRamCost: 0.05, - ScriptReadWriteRamCost: 1.0, - ScriptArbScriptRamCost: 1.0, - ScriptGetScriptRamCost: 0.1, - ScriptGetRunningScriptRamCost: 0.3, - ScriptGetHackTimeRamCost: 0.05, - ScriptGetFavorToDonate: 0.10, - ScriptCodingContractBaseRamCost: 10, - ScriptSleeveBaseRamCost: 4, - ScriptSingularityFn1RamCost: 2, - ScriptSingularityFn2RamCost: 3, - ScriptSingularityFn3RamCost: 5, - ScriptGangApiBaseRamCost: 4, - ScriptBladeburnerApiBaseRamCost: 4, -}; -exports.RamCosts = { - hacknet: { - numNodes: () => 0, - purchaseNode: () => 0, - getPurchaseNodeCost: () => 0, - getNodeStats: () => 0, - upgradeLevel: () => 0, - upgradeRam: () => 0, - upgradeCore: () => 0, - upgradeCache: () => 0, - getLevelUpgradeCost: () => 0, - getRamUpgradeCost: () => 0, - getCoreUpgradeCost: () => 0, - getCacheUpgradeCost: () => 0, - numHashes: () => 0, - hashCost: () => 0, - spendHashes: () => 0, - }, - sprintf: () => 0, - vsprintf: () => 0, - scan: () => exports.RamCostConstants.ScriptScanRamCost, - hack: () => exports.RamCostConstants.ScriptHackRamCost, - hackAnalyzeThreads: () => exports.RamCostConstants.ScriptHackAnalyzeRamCost, - hackAnalyzePercent: () => exports.RamCostConstants.ScriptHackAnalyzeRamCost, - hackChance: () => exports.RamCostConstants.ScriptHackAnalyzeRamCost, - sleep: () => 0, - grow: () => exports.RamCostConstants.ScriptGrowRamCost, - growthAnalyze: () => exports.RamCostConstants.ScriptGrowthAnalyzeRamCost, - weaken: () => exports.RamCostConstants.ScriptWeakenRamCost, - print: () => 0, - tprint: () => 0, - clearLog: () => 0, - disableLog: () => 0, - enableLog: () => 0, - isLogEnabled: () => 0, - getScriptLogs: () => 0, - nuke: () => exports.RamCostConstants.ScriptPortProgramRamCost, - brutessh: () => exports.RamCostConstants.ScriptPortProgramRamCost, - ftpcrack: () => exports.RamCostConstants.ScriptPortProgramRamCost, - relaysmtp: () => exports.RamCostConstants.ScriptPortProgramRamCost, - httpworm: () => exports.RamCostConstants.ScriptPortProgramRamCost, - sqlinject: () => exports.RamCostConstants.ScriptPortProgramRamCost, - run: () => exports.RamCostConstants.ScriptRunRamCost, - exec: () => exports.RamCostConstants.ScriptExecRamCost, - spawn: () => exports.RamCostConstants.ScriptSpawnRamCost, - kill: () => exports.RamCostConstants.ScriptKillRamCost, - killall: () => exports.RamCostConstants.ScriptKillRamCost, - exit: () => 0, - scp: () => exports.RamCostConstants.ScriptScpRamCost, - ls: () => exports.RamCostConstants.ScriptScanRamCost, - ps: () => exports.RamCostConstants.ScriptScanRamCost, - hasRootAccess: () => exports.RamCostConstants.ScriptHasRootAccessRamCost, - getIp: () => exports.RamCostConstants.ScriptGetHostnameRamCost, - getHostname: () => exports.RamCostConstants.ScriptGetHostnameRamCost, - getHackingLevel: () => exports.RamCostConstants.ScriptGetHackingLevelRamCost, - getHackingMultipliers: () => exports.RamCostConstants.ScriptGetMultipliersRamCost, - getHacknetMultipliers: () => exports.RamCostConstants.ScriptGetMultipliersRamCost, - getBitNodeMultipliers: () => exports.RamCostConstants.ScriptGetMultipliersRamCost, - getServer: () => exports.RamCostConstants.ScriptGetMultipliersRamCost / 2, - getServerMoneyAvailable: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerSecurityLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerBaseSecurityLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerMinSecurityLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerRequiredHackingLevel: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerMaxMoney: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerGrowth: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerNumPortsRequired: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerRam: () => exports.RamCostConstants.ScriptGetServerRamCost, - getServerMaxRam: () => exports.RamCostConstants.ScriptGetServerMaxRam, - getServerUsedRam: () => exports.RamCostConstants.ScriptGetServerUsedRam, - serverExists: () => exports.RamCostConstants.ScriptGetServerRamCost, - fileExists: () => exports.RamCostConstants.ScriptFileExistsRamCost, - isRunning: () => exports.RamCostConstants.ScriptIsRunningRamCost, - getStockSymbols: () => exports.RamCostConstants.ScriptGetStockRamCost, - getStockPrice: () => exports.RamCostConstants.ScriptGetStockRamCost, - getStockAskPrice: () => exports.RamCostConstants.ScriptGetStockRamCost, - getStockBidPrice: () => exports.RamCostConstants.ScriptGetStockRamCost, - getStockPosition: () => exports.RamCostConstants.ScriptGetStockRamCost, - getStockMaxShares: () => exports.RamCostConstants.ScriptGetStockRamCost, - getStockPurchaseCost: () => exports.RamCostConstants.ScriptGetStockRamCost, - getStockSaleGain: () => exports.RamCostConstants.ScriptGetStockRamCost, - buyStock: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - sellStock: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - shortStock: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - sellShort: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - placeOrder: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - cancelOrder: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - getOrders: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - getStockVolatility: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - getStockForecast: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - purchase4SMarketData: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - purchase4SMarketDataTixApi: () => exports.RamCostConstants.ScriptBuySellStockRamCost, - getPurchasedServerLimit: () => exports.RamCostConstants.ScriptGetPurchasedServerLimit, - getPurchasedServerMaxRam: () => exports.RamCostConstants.ScriptGetPurchasedServerMaxRam, - getPurchasedServerCost: () => exports.RamCostConstants.ScriptGetPurchaseServerRamCost, - purchaseServer: () => exports.RamCostConstants.ScriptPurchaseServerRamCost, - deleteServer: () => exports.RamCostConstants.ScriptPurchaseServerRamCost, - getPurchasedServers: () => exports.RamCostConstants.ScriptPurchaseServerRamCost, - write: () => exports.RamCostConstants.ScriptReadWriteRamCost, - tryWrite: () => exports.RamCostConstants.ScriptReadWriteRamCost, - read: () => exports.RamCostConstants.ScriptReadWriteRamCost, - peek: () => exports.RamCostConstants.ScriptReadWriteRamCost, - clear: () => exports.RamCostConstants.ScriptReadWriteRamCost, - getPortHandle: () => exports.RamCostConstants.ScriptReadWriteRamCost * 10, - rm: () => exports.RamCostConstants.ScriptReadWriteRamCost, - scriptRunning: () => exports.RamCostConstants.ScriptArbScriptRamCost, - scriptKill: () => exports.RamCostConstants.ScriptArbScriptRamCost, - getScriptName: () => 0, - getScriptRam: () => exports.RamCostConstants.ScriptGetScriptRamCost, - getHackTime: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, - getGrowTime: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, - getWeakenTime: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, - getScriptIncome: () => exports.RamCostConstants.ScriptGetScriptRamCost, - getScriptExpGain: () => exports.RamCostConstants.ScriptGetScriptRamCost, - getRunningScript: () => exports.RamCostConstants.ScriptGetRunningScriptRamCost, - nFormat: () => 0, - getTimeSinceLastAug: () => exports.RamCostConstants.ScriptGetHackTimeRamCost, - prompt: () => 0, - wget: () => 0, - getFavorToDonate: () => exports.RamCostConstants.ScriptGetFavorToDonate, - // Singularity Functions - universityCourse: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - gymWorkout: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - travelToCity: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - purchaseTor: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - purchaseProgram: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - getCurrentServer: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - connect: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - manualHack: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - installBackdoor: () => exports.RamCostConstants.ScriptSingularityFn1RamCost, - getStats: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, - getCharacterInformation: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, - getPlayer: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, - hospitalize: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, - isBusy: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 4, - stopAction: () => exports.RamCostConstants.ScriptSingularityFn1RamCost / 2, - upgradeHomeRam: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, - getUpgradeHomeRamCost: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 2, - workForCompany: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, - applyToCompany: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, - getCompanyRep: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, - getCompanyFavor: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, - getCompanyFavorGain: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 4, - checkFactionInvitations: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, - joinFaction: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, - workForFaction: () => exports.RamCostConstants.ScriptSingularityFn2RamCost, - getFactionRep: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, - getFactionFavor: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 3, - getFactionFavorGain: () => exports.RamCostConstants.ScriptSingularityFn2RamCost / 4, - donateToFaction: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - createProgram: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - commitCrime: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getCrimeChance: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getCrimeStats: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getOwnedAugmentations: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getOwnedSourceFiles: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getAugmentationsFromFaction: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getAugmentationPrereq: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getAugmentationCost: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - getAugmentationStats: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - purchaseAugmentation: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - softReset: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - installAugmentations: () => exports.RamCostConstants.ScriptSingularityFn3RamCost, - // Gang API - gang: { - createGang: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, - inGang: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, - getMemberNames: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, - getGangInformation: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - getOtherGangInformation: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - getMemberInformation: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - canRecruitMember: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, - recruitMember: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - getTaskNames: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, - getTaskStats: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, - setMemberTask: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - getEquipmentNames: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 4, - getEquipmentCost: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - getEquipmentType: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - getEquipmentStats: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - purchaseEquipment: () => exports.RamCostConstants.ScriptGangApiBaseRamCost, - ascendMember: () => exports.RamCostConstants.ScriptGangApiBaseRamCost, - setTerritoryWarfare: () => exports.RamCostConstants.ScriptGangApiBaseRamCost / 2, - getChanceToWinClash: () => exports.RamCostConstants.ScriptGangApiBaseRamCost, - getBonusTime: () => 0, - }, - // Bladeburner API - bladeburner: { - getContractNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, - getOperationNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, - getBlackOpNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, - getBlackOpRank: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2, - getGeneralActionNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, - getSkillNames: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 10, - startAction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - stopBladeburnerAction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 2, - getCurrentAction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost / 4, - getActionTime: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getActionEstimatedSuccessChance: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getActionRepGain: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getActionCountRemaining: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getActionMaxLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getActionCurrentLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getActionAutolevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - setActionAutolevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - setActionLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getRank: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getSkillPoints: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getSkillLevel: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getSkillUpgradeCost: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - upgradeSkill: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getTeamSize: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - setTeamSize: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getCityEstimatedPopulation: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getCityEstimatedCommunities: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getCityChaos: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getCity: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - switchCity: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getStamina: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - joinBladeburnerFaction: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - joinBladeburnerDivision: () => exports.RamCostConstants.ScriptBladeburnerApiBaseRamCost, - getBonusTime: () => 0, - }, - // Coding Contract API - codingcontract: { - attempt: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost, - getContractType: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 2, - getData: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 2, - getDescription: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 2, - getNumTriesRemaining: () => exports.RamCostConstants.ScriptCodingContractBaseRamCost / 5, - }, - // Duplicate Sleeve API - sleeve: { - getNumSleeves: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - setToShockRecovery: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - setToSynchronize: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - setToCommitCrime: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - setToUniversityCourse: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - travel: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - setToCompanyWork: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - setToFactionWork: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - setToGymWorkout: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - getSleeveStats: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - getTask: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - getInformation: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - getSleeveAugmentations: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - getSleevePurchasableAugs: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - purchaseSleeveAug: () => exports.RamCostConstants.ScriptSleeveBaseRamCost, - }, - heart: { - // Easter egg function - break: () => 0, - }, -}; -function getRamCost(...args) { - if (args.length === 0) { - console.warn(`No arguments passed to getRamCost()`); - return 0; - } - let curr = exports.RamCosts[args[0]]; - for (let i = 1; i < args.length; ++i) { - if (curr == null) { - console.warn(`Invalid function passed to getRamCost: ${args}`); - return 0; - } - const currType = typeof curr; - if (currType === "function" || currType === "number") { - break; - } - curr = curr[args[i]]; - } - const currType = typeof curr; - if (currType === "function") { - return curr(); - } - if (currType === "number") { - return curr; - } - console.warn(`Unexpected type (${currType}) for value [${args}]`); - return 0; -} -exports.getRamCost = getRamCost; - - -/***/ }), -/* 11 */ -/*!**************************!*\ - !*** ./src/Constants.ts ***! - \**************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CONSTANTS = void 0; -exports.CONSTANTS = { - Version: "0.52.9", - // Speed (in ms) at which the main loop is updated - _idleSpeed: 200, - /** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience - * and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then - * the player will have this level assuming no multipliers. Multipliers can cause skills to go above this. - */ - MaxSkillLevel: 975, - // Milliseconds per game cycle - MilliPerCycle: 200, - // How much reputation is needed to join a megacorporation's faction - CorpFactionRepRequirement: 200e3, - // Base RAM costs - BaseCostFor1GBOfRamHome: 32000, - BaseCostFor1GBOfRamServer: 55000, - // Cost to travel to another city - TravelCost: 200e3, - // Faction and Company favor-related things - BaseFavorToDonate: 150, - DonateMoneyToRepDivisor: 1e6, - FactionReputationToFavorBase: 500, - FactionReputationToFavorMult: 1.02, - CompanyReputationToFavorBase: 500, - CompanyReputationToFavorMult: 1.02, - // NeuroFlux Governor Augmentation cost multiplier - NeuroFluxGovernorLevelMult: 1.14, - NumNetscriptPorts: 20, - // Server-related constants - HomeComputerMaxRam: 1073741824, - ServerBaseGrowthRate: 1.03, - ServerMaxGrowthRate: 1.0035, - ServerFortifyAmount: 0.002, - ServerWeakenAmount: 0.05, - PurchasedServerLimit: 25, - PurchasedServerMaxRam: 1048576, - // Augmentation Constants - MultipleAugMultiplier: 1.9, - // TOR Router - TorRouterCost: 200e3, - // Infiltration - InfiltrationBribeBaseAmount: 100e3, - InfiltrationMoneyValue: 5e3, - InfiltrationRepValue: 1.4, - InfiltrationExpPow: 0.8, - // Stock market - WSEAccountCost: 200e6, - TIXAPICost: 5e9, - MarketData4SCost: 1e9, - MarketDataTixApi4SCost: 25e9, - StockMarketCommission: 100e3, - // Hospital/Health - HospitalCostPerHp: 100e3, - // Intelligence-related constants - IntelligenceCrimeWeight: 0.025, - IntelligenceInfiltrationWeight: 0.1, - IntelligenceCrimeBaseExpGain: 0.05, - IntelligenceProgramBaseExpGain: 2.5, - IntelligenceTerminalHackBaseExpGain: 200, - IntelligenceSingFnBaseExpGain: 1.5, - IntelligenceClassBaseExpGain: 0.01, - IntelligenceHackingMissionBaseExpGain: 3, - // Hacking Missions - // TODO Move this into Hacking Mission implementation - HackingMissionRepToDiffConversion: 10000, - HackingMissionRepToRewardConversion: 7, - HackingMissionSpamTimeIncrease: 25000, - HackingMissionTransferAttackIncrease: 1.05, - HackingMissionMiscDefenseIncrease: 1.05, - HackingMissionDifficultyToHacking: 135, - HackingMissionHowToPlay: "Hacking missions are a minigame that, if won, will reward you with faction reputation.

" + - "In this game you control a set of Nodes and use them to try and defeat an enemy. Your Nodes " + - "are colored blue, while the enemy's are red. There are also other nodes on the map colored gray " + - "that initially belong to neither you nor the enemy. The goal of the game is " + - "to capture all of the enemy's Database nodes within the time limit. " + - "If you fail to do this, you will lose.

" + - "Each Node has three stats: Attack, Defense, and HP. There are five different actions that " + - "a Node can take:

" + - "Attack - Targets an enemy Node and lowers its HP. The effectiveness is determined by the owner's Attack, the Player's " + - "hacking level, and the enemy's defense.

" + - "Scan - Targets an enemy Node and lowers its Defense. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the " + - "enemy's defense.

" + - "Weaken - Targets an enemy Node and lowers its Attack. The effectiveness is determined by the owner's Attack, the Player's hacking level, and the enemy's " + - "defense.

" + - "Fortify - Raises the Node's Defense. The effectiveness is determined by your hacking level.

" + - "Overflow - Raises the Node's Attack but lowers its Defense. The effectiveness is determined by your hacking level.

" + - "Note that when determining the effectiveness of the above actions, the TOTAL Attack or Defense of the team is used, not just the " + - "Attack/Defense of the individual Node that is performing the action.

" + - "To capture a Node, you must lower its HP down to 0.

" + - "There are six different types of Nodes:

" + - "CPU Core - These are your main Nodes that are used to perform actions. Capable of performing every action

" + - "Firewall - Nodes with high defense. These Nodes can 'Fortify'

" + - "Database - A special type of Node. The player's objective is to conquer all of the enemy's Database Nodes within " + - "the time limit. These Nodes cannot perform any actions

" + - "Spam - Conquering one of these Nodes will slow the enemy's trace, giving the player additional time to complete " + - "the mission. These Nodes cannot perform any actions

" + - "Transfer - Conquering one of these nodes will increase the Attack of all of your CPU Cores by a small fixed percentage. " + - "These Nodes are capable of performing every action except the 'Attack' action

" + - "Shield - Nodes with high defense. These Nodes can 'Fortify'

" + - "To assign an action to a Node, you must first select one of your Nodes. This can be done by simply clicking on it. Double-clicking " + - "a node will select all of your Nodes of the same type (e.g. select all CPU Core Nodes or all Transfer Nodes). Note that only Nodes " + - "that can perform actions (CPU Core, Transfer, Shield, Firewall) can be selected. Selected Nodes will be denoted with a white highlight. After selecting a Node or multiple Nodes, " + - "select its action using the Action Buttons near the top of the screen. Every action also has a corresponding keyboard " + - "shortcut.

" + - "For certain actions such as attacking, scanning, and weakening, the Node performing the action must have a target. To target " + - "another node, simply click-and-drag from the 'source' Node to a target. A Node can only have one target, and you can target " + - "any Node that is adjacent to one of your Nodes (immediately above, below, or to the side. NOT diagonal). Furthermore, only CPU Cores and Transfer Nodes " + - "can target, since they are the only ones that can perform the related actions. To remove a target, you can simply click on the line that represents " + - "the connection between one of your Nodes and its target. Alternatively, you can select the 'source' Node and click the 'Drop Connection' button, " + - "or press 'd'.

" + - "Other Notes:

" + - "-Whenever a miscellenaous Node (not owned by the player or enemy) is conquered, the defense of all remaining miscellaneous Nodes that " + - "are not actively being targeted will increase by a fixed percentage.

" + - "-Whenever a Node is conquered, its stats are significantly reduced

" + - "-Miscellaneous Nodes slowly raise their defense over time

" + - "-Nodes slowly regenerate health over time.", - // Time-related constants - MillisecondsPer20Hours: 72000000, - GameCyclesPer20Hours: 72000000 / 200, - MillisecondsPer10Hours: 36000000, - GameCyclesPer10Hours: 36000000 / 200, - MillisecondsPer8Hours: 28800000, - GameCyclesPer8Hours: 28800000 / 200, - MillisecondsPer4Hours: 14400000, - GameCyclesPer4Hours: 14400000 / 200, - MillisecondsPer2Hours: 7200000, - GameCyclesPer2Hours: 7200000 / 200, - MillisecondsPerHour: 3600000, - GameCyclesPerHour: 3600000 / 200, - MillisecondsPerHalfHour: 1800000, - GameCyclesPerHalfHour: 1800000 / 200, - MillisecondsPerQuarterHour: 900000, - GameCyclesPerQuarterHour: 900000 / 200, - MillisecondsPerFiveMinutes: 300000, - GameCyclesPerFiveMinutes: 300000 / 200, - // Player Work & Action - FactionWorkHacking: "Faction Hacking Work", - FactionWorkField: "Faction Field Work", - FactionWorkSecurity: "Faction Security Work", - WorkTypeCompany: "Working for Company", - WorkTypeCompanyPartTime: "Working for Company part-time", - WorkTypeFaction: "Working for Faction", - WorkTypeCreateProgram: "Working on Create a Program", - WorkTypeStudyClass: "Studying or Taking a class at university", - WorkTypeCrime: "Committing a crime", - ClassStudyComputerScience: "studying Computer Science", - ClassDataStructures: "taking a Data Structures course", - ClassNetworks: "taking a Networks course", - ClassAlgorithms: "taking an Algorithms course", - ClassManagement: "taking a Management course", - ClassLeadership: "taking a Leadership course", - ClassGymStrength: "training your strength at a gym", - ClassGymDefense: "training your defense at a gym", - ClassGymDexterity: "training your dexterity at a gym", - ClassGymAgility: "training your agility at a gym", - ClassDataStructuresBaseCost: 40, - ClassNetworksBaseCost: 80, - ClassAlgorithmsBaseCost: 320, - ClassManagementBaseCost: 160, - ClassLeadershipBaseCost: 320, - ClassGymBaseCost: 120, - ClassStudyComputerScienceBaseExp: 0.5, - ClassDataStructuresBaseExp: 1, - ClassNetworksBaseExp: 2, - ClassAlgorithmsBaseExp: 4, - ClassManagementBaseExp: 2, - ClassLeadershipBaseExp: 4, - CrimeShoplift: "shoplift", - CrimeRobStore: "rob a store", - CrimeMug: "mug someone", - CrimeLarceny: "commit larceny", - CrimeDrugs: "deal drugs", - CrimeBondForgery: "forge corporate bonds", - CrimeTraffickArms: "traffick illegal arms", - CrimeHomicide: "commit homicide", - CrimeGrandTheftAuto: "commit grand theft auto", - CrimeKidnap: "kidnap someone for ransom", - CrimeAssassination: "assassinate a high-profile target", - CrimeHeist: "pull off the ultimate heist", - // Coding Contract - // TODO: Move this into Coding contract implementation? - CodingContractBaseFactionRepGain: 2500, - CodingContractBaseCompanyRepGain: 4000, - CodingContractBaseMoneyGain: 75e6, - // BitNode/Source-File related stuff - TotalNumBitNodes: 24, - LatestUpdate: ` - v0.52.9 - 2021-07-27 Less lag! (hydroflame & community) - ------------------------------------------- - - ** Active Scripts page ** - - * Now less laggy, has pagination. - - ** File diagnostic ** - - * Added a popup found under options that shows the files you own and how - large they are. This help find bugs and leftover massive logs files. - - ** Corporation ** - - * Added safeguard against a very specific bug that causes NaN money. I'm - still not sure what the root cause is but it should prevent corp from - breaking. - - ** Netscript ** - - * tprintf is a new function that doesn't print the filename. - - ** Misc. ** - - * Infiltration kills you if you try to automate it. (@threehams) - * Fix beautify button not working - * Added bladeburner_analysis_mult to getPlayer() (@brusby) - * Fixed joining bladeburner via netscript functions. (@omuretsu) - * All bladeburner actions are click-to-copy - * nerf noodle bar -`, - /* - - - */ -}; - - -/***/ }), -/* 12 */ -/*!*******************************************!*\ - !*** ./src/Augmentation/Augmentations.ts ***! - \*******************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Augmentations = void 0; -exports.Augmentations = {}; - - -/***/ }), -/* 13 */ -/*!*****************************!*\ - !*** ./utils/DialogBox.tsx ***! - \*****************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.dialogBoxCreate = exports.MessagePopup = void 0; -const createPopup_1 = __webpack_require__(/*! ../src/ui/React/createPopup */ 41); -const getRandomInt_1 = __webpack_require__(/*! ./helpers/getRandomInt */ 45); -const react_1 = __importDefault(__webpack_require__(/*! react */ 0)); -function MessagePopup(props) { - return (react_1.default.createElement(react_1.default.Fragment, null, props.content)); -} -exports.MessagePopup = MessagePopup; -function dialogBoxCreate(txt, preformatted = false) { - const popupId = `popup-` + (Array.from(Array(16))).map(() => `${getRandomInt_1.getRandomInt(0, 9)}`).join(''); - if (typeof txt === 'string') { - if (preformatted) { - // For text files as they are often computed data that - // shouldn't be wrapped and should retain tabstops. - createPopup_1.createPopup(popupId, MessagePopup, { - content: (react_1.default.createElement("pre", { dangerouslySetInnerHTML: { __html: txt } })), - }); - } - else { - createPopup_1.createPopup(popupId, MessagePopup, { - content: (react_1.default.createElement("p", { dangerouslySetInnerHTML: { __html: txt.replace(/(?:\r\n|\r|\n)/g, '
') } })), - }); - } - } - else { - createPopup_1.createPopup(popupId, MessagePopup, { - content: txt, - }); - } -} -exports.dialogBoxCreate = dialogBoxCreate; - - -/***/ }), -/* 14 */, -/* 15 */ -/*!************************!*\ - !*** ./src/engine.jsx ***! - \************************/ -/*! exports provided: Engine */ -/*! all exports used */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Engine", function() { return Engine; }); -/* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/StringHelperFunctions */ 23); -/* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Augmentation/Augmentations */ 12); -/* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Augmentation/AugmentationHelpers */ 79); -/* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Augmentation/data/AugmentationNames */ 4); -/* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BitNode/BitNode */ 127); -/* harmony import */ var _BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Bladeburner/Bladeburner */ 94); -/* harmony import */ var _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _ui_React_CharacterOverview__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ui/React/CharacterOverview */ 767); -/* harmony import */ var _CinematicText__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./CinematicText */ 450); -/* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./CodingContractGenerator */ 176); -/* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _Company_Companies__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Company/Companies */ 33); -/* harmony import */ var _Company_Companies__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_Company_Companies__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Corporation/Corporation */ 122); -/* harmony import */ var _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Constants */ 11); -/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_Constants__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var _DevMenu__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./DevMenu */ 532); -/* harmony import */ var _Faction_Factions__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Faction/Factions */ 17); -/* harmony import */ var _Faction_Factions__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_Faction_Factions__WEBPACK_IMPORTED_MODULE_13__); -/* harmony import */ var _Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Faction/FactionHelpers */ 71); -/* harmony import */ var _Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./Faction/ui/FactionList */ 766); -/* harmony import */ var _Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15__); -/* harmony import */ var _Gang_Helpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Gang/Helpers */ 765); -/* harmony import */ var _Gang_Helpers__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_Gang_Helpers__WEBPACK_IMPORTED_MODULE_16__); -/* harmony import */ var _Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Bladeburner/ui/Root */ 764); -/* harmony import */ var _Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17__); -/* harmony import */ var _Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Infiltration/Helper */ 763); -/* harmony import */ var _Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18__); -/* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./PersonObjects/formulas/reputation */ 109); -/* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__); -/* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Fconf/FconfSettings */ 39); -/* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20__); -/* harmony import */ var _Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Hacknet/HacknetHelpers */ 25); -/* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./InteractiveTutorial */ 43); -/* harmony import */ var _Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./Locations/data/LocationNames */ 40); -/* harmony import */ var _Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(_Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23__); -/* harmony import */ var _Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Locations/ui/Root */ 455); -/* harmony import */ var _Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__); -/* harmony import */ var _Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./Message/MessageHelpers */ 87); -/* harmony import */ var _Missions__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./Missions */ 81); -/* harmony import */ var _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Netscript/WorkerScripts */ 112); -/* harmony import */ var _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27___default = /*#__PURE__*/__webpack_require__.n(_Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__); -/* harmony import */ var _NetscriptWorker__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./NetscriptWorker */ 80); -/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Server/ServerHelpers */ 22); -/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_29__); -/* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./Player */ 2); -/* harmony import */ var _Prestige__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Prestige */ 173); -/* harmony import */ var _Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./Programs/ProgramHelpers */ 304); -/* harmony import */ var _RedPill__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./RedPill */ 103); -/* harmony import */ var _SaveObject__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./SaveObject */ 114); -/* harmony import */ var _ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./ScriptEditor/ui/Root */ 714); -/* harmony import */ var _ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__webpack_require__.n(_ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35__); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./Server/AllServers */ 20); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_36__); -/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./Settings/Settings */ 24); -/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_37___default = /*#__PURE__*/__webpack_require__.n(_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__); -/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./SourceFile/SourceFileFlags */ 37); -/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38___default = /*#__PURE__*/__webpack_require__.n(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__); -/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./Server/SpecialServerIps */ 38); -/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39___default = /*#__PURE__*/__webpack_require__.n(_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39__); -/* harmony import */ var _StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./StockMarket/StockMarket */ 47); -/* harmony import */ var _StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40___default = /*#__PURE__*/__webpack_require__.n(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__); -/* harmony import */ var _Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./Milestones/MilestoneHelpers */ 701); -/* harmony import */ var _Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41___default = /*#__PURE__*/__webpack_require__.n(_Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41__); -/* harmony import */ var _Terminal__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./Terminal */ 74); -/* harmony import */ var _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./PersonObjects/Sleeve/Sleeve */ 178); -/* harmony import */ var _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__); -/* harmony import */ var _PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./PersonObjects/Sleeve/SleeveUI */ 451); -/* harmony import */ var _PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__); -/* harmony import */ var _PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./PersonObjects/Resleeving/ResleevingUI */ 526); -/* harmony import */ var _PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__); -/* harmony import */ var _ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./ui/createStatusText */ 141); -/* harmony import */ var _ui_createStatusText__WEBPACK_IMPORTED_MODULE_46___default = /*#__PURE__*/__webpack_require__.n(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__); -/* harmony import */ var _ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./ui/CharacterInfo */ 700); -/* harmony import */ var _ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47___default = /*#__PURE__*/__webpack_require__.n(_ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47__); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./ui/navigationTracking */ 18); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__); -/* harmony import */ var _ui_setSettingsLabels__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./ui/setSettingsLabels */ 699); -/* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./ui/React/Money */ 27); -/* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_50___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Money__WEBPACK_IMPORTED_MODULE_50__); -/* harmony import */ var _ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ./ui/React/Hashes */ 126); -/* harmony import */ var _ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51__); -/* harmony import */ var _ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ./ui/React/Reputation */ 59); -/* harmony import */ var _ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52__); -/* harmony import */ var _ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ./ui/ActiveScripts/Root */ 525); -/* harmony import */ var _ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53___default = /*#__PURE__*/__webpack_require__.n(_ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__); -/* harmony import */ var _ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ./ui/MainMenu/Headers */ 698); -/* harmony import */ var _ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54___default = /*#__PURE__*/__webpack_require__.n(_ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54__); -/* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ./ui/MainMenu/Links */ 31); -/* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55___default = /*#__PURE__*/__webpack_require__.n(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__); -/* harmony import */ var _Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ./Diagnostic/FileDiagnosticPopup */ 697); -/* harmony import */ var _Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56___default = /*#__PURE__*/__webpack_require__.n(_Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56__); -/* harmony import */ var _ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ./ui/React/createPopup */ 41); -/* harmony import */ var _ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57___default = /*#__PURE__*/__webpack_require__.n(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57__); -/* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ../utils/DialogBox */ 13); -/* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_58___default = /*#__PURE__*/__webpack_require__.n(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__); -/* harmony import */ var _utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ../utils/GameOptions */ 303); -/* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ../utils/helpers/exceptionAlert */ 91); -/* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__); -/* harmony import */ var _utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ../utils/uiHelpers/removeLoadingScreen */ 524); -/* harmony import */ var _utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__); -/* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ../utils/helpers/keyCodes */ 44); -/* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__); -/* harmony import */ var _Exploits_tampering__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ./Exploits/tampering */ 863); -/* harmony import */ var _Exploits_tampering__WEBPACK_IMPORTED_MODULE_63___default = /*#__PURE__*/__webpack_require__.n(_Exploits_tampering__WEBPACK_IMPORTED_MODULE_63__); -/* harmony import */ var _Exploits_unclickable__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ./Exploits/unclickable */ 862); -/* harmony import */ var _Exploits_unclickable__WEBPACK_IMPORTED_MODULE_64___default = /*#__PURE__*/__webpack_require__.n(_Exploits_unclickable__WEBPACK_IMPORTED_MODULE_64__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! react */ 0); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_65___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_65__); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! react-dom */ 21); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_66___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_66__); -/** - * Game engine. Handles the main game loop as well as the main UI pages - * - * TODO: Separate UI functionality into its own component - */ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -/** - * Shortcuts to navigate through the game - * Alt-t - Terminal - * Alt-c - Character - * Alt-e - Script editor - * Alt-s - Active scripts - * Alt-h - Hacknet Nodes - * Alt-w - City - * Alt-j - Job - * Alt-r - Travel Agency of current city - * Alt-p - Create program - * Alt-f - Factions - * Alt-a - Augmentations - * Alt-u - Tutorial - * Alt-o - Options - */ - -$(document).keydown(function (e) { - if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].DisableHotkeys === true) { - return; - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking && !_RedPill__WEBPACK_IMPORTED_MODULE_33__["redPillFlag"] && !_Missions__WEBPACK_IMPORTED_MODULE_26__[/* inMission */ "c"] && !_CinematicText__WEBPACK_IMPORTED_MODULE_7__[/* cinematicTextFlag */ "a"]) { - if (e.keyCode == _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].T && e.altKey) { - e.preventDefault(); - Engine.loadTerminalContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].C && e.altKey) { - e.preventDefault(); - Engine.loadCharacterContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].E && e.altKey) { - e.preventDefault(); - Engine.loadScriptEditorContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].S && e.altKey) { - e.preventDefault(); - Engine.loadActiveScriptsContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].H && e.altKey) { - e.preventDefault(); - Engine.loadHacknetNodesContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].W && e.altKey) { - e.preventDefault(); - Engine.loadLocationContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].J && e.altKey) { - e.preventDefault(); - Engine.loadJobContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].R && e.altKey) { - e.preventDefault(); - Engine.loadTravelContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].P && e.altKey) { - e.preventDefault(); - Engine.loadCreateProgramContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].F && e.altKey) { - // Overriden by Fconf - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal) && _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_20__["FconfSettings"].ENABLE_BASH_HOTKEYS) { - return; - } - - e.preventDefault(); - Engine.loadFactionsContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].A && e.altKey) { - e.preventDefault(); - Engine.loadAugmentationsContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].U && e.altKey) { - e.preventDefault(); - Engine.loadTutorialContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].B && e.altKey) { - e.preventDefault(); - Engine.loadBladeburnerContent(); - } else if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].G && e.altKey) { - e.preventDefault(); - Engine.loadGangContent(); - } - } - - if (e.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_62__["KEY"].O && e.altKey) { - e.preventDefault(); - Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxOpen */ "b"])(); - } -}); -const Engine = { - // Clickable objects - Clickables: { - // Main menu buttons - saveMainMenuButton: null, - deleteMainMenuButton: null - }, - // Display objects - // TODO-Refactor this into its own component - Display: { - // Main menu content - terminalContent: null, - characterContent: null, - scriptEditorContent: null, - activeScriptsContent: null, - hacknetNodesContent: null, - createProgramContent: null, - factionsContent: null, - factionContent: null, - augmentationsContent: null, - milestonesContent: null, - tutorialContent: null, - infiltrationContent: null, - stockMarketContent: null, - gangContent: null, - bladeburnerContent: null, - locationContent: null, - workInProgressContent: null, - redPillContent: null, - cinematicTextContent: null, - missionContent: null, - // Character info - characterInfo: null - }, - indexedDb: undefined, - // Time variables (milliseconds unix epoch time) - _lastUpdate: new Date().getTime(), - _idleSpeed: 200, - // Speed (in ms) at which the main loop is updated - loadTerminalContent: function () { - Engine.hideAllContent(); - Engine.Display.terminalContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Terminal.classList.add("active"); - }, - loadCharacterContent: function () { - Engine.hideAllContent(); - Engine.Display.characterContent.style.display = "block"; - Engine.updateCharacterInfo(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CharacterInfo); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Stats.classList.add("active"); - }, - loadScriptEditorContent: function (filename = "", code = "") { - Engine.hideAllContent(); - Engine.Display.scriptEditorContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].ScriptEditor); - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ScriptEditor_ui_Root__WEBPACK_IMPORTED_MODULE_35__["Root"], { - filename: filename, - code: code, - player: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], - engine: this - }), Engine.Display.scriptEditorContent); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ScriptEditor.classList.add("active"); - }, - loadActiveScriptsContent: function () { - Engine.hideAllContent(); - Engine.Display.activeScriptsContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].ActiveScripts); - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__["ActiveScriptsRoot"], { - p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], - workerScripts: _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__["workerScripts"] - }), Engine.Display.activeScriptsContent); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ActiveScripts.classList.add("active"); - }, - loadHacknetNodesContent: function () { - Engine.hideAllContent(); - Engine.Display.hacknetNodesContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].HacknetNodes); - Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* renderHacknetNodesUI */ "q"])(); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].HacknetNodes.classList.add("active"); - }, - loadCreateProgramContent: function () { - Engine.hideAllContent(); - Engine.Display.createProgramContent.style.display = "block"; - Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* displayCreateProgramContent */ "a"])(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CreateProgram); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].CreateProgram.classList.add("active"); - }, - loadFactionsContent: function () { - Engine.hideAllContent(); - Engine.Display.factionsContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Factions); - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Faction_ui_FactionList__WEBPACK_IMPORTED_MODULE_15__["FactionList"], { - player: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], - engine: this - }), Engine.Display.factionsContent); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Factions.classList.add("active"); - }, - loadFactionContent: function () { - Engine.hideAllContent(); - Engine.Display.factionContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Faction); - }, - loadAugmentationsContent: function () { - Engine.hideAllContent(); - Engine.Display.augmentationsContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Augmentations); - Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__[/* displayAugmentationsContent */ "c"])(Engine.Display.augmentationsContent); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Augmentations.classList.add("active"); - }, - loadMilestonesContent: function () { - Engine.hideAllContent(); - Engine.Display.milestonesContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Milestones); - Object(_Milestones_MilestoneHelpers__WEBPACK_IMPORTED_MODULE_41__["displayMilestonesContent"])(); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Milestones.classList.add("active"); - }, - loadTutorialContent: function () { - Engine.hideAllContent(); - Engine.Display.tutorialContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Tutorial); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Tutorial.classList.add("active"); - }, - loadDevMenuContent: function () { - Engine.hideAllContent(); - Object(_DevMenu__WEBPACK_IMPORTED_MODULE_12__[/* createDevMenu */ "b"])(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].DevMenu); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].DevMenu.classList.add("active"); - }, - loadLocationContent: function (initiallyInCity = true) { - Engine.hideAllContent(); - Engine.Display.locationContent.style.display = "block"; - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].City.classList.add("active"); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Location); - const rootComponent = react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__["LocationRoot"], { - initiallyInCity: initiallyInCity, - engine: Engine, - p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"] - }); - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(rootComponent, Engine.Display.locationContent); - }, - loadTravelContent: function () { - // Same as loadLocationContent() except first set the location to the travel agency, - // and make sure that the 'City' main menu link doesnt become 'active' - Engine.hideAllContent(); - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gotoLocation(_Locations_data_LocationNames__WEBPACK_IMPORTED_MODULE_23__["LocationName"].TravelAgency); - Engine.Display.locationContent.style.display = "block"; - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Travel.classList.add("active"); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Location); - const rootComponent = react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__["LocationRoot"], { - initiallyInCity: false, - engine: Engine, - p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"] - }); - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(rootComponent, Engine.Display.locationContent); - }, - loadJobContent: function () { - // Same as loadLocationContent(), except first set the location to the job. - // Make sure that the 'City' main menu link doesnt become 'active' - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].companyName == "") { - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])("You do not currently have a job! You can visit various companies " + "in the city and try to find a job."); - return; - } - - Engine.hideAllContent(); - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gotoLocation(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].companyName); - Engine.Display.locationContent.style.display = "block"; - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Job.classList.add("active"); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Location); - const rootComponent = react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Locations_ui_Root__WEBPACK_IMPORTED_MODULE_24__["LocationRoot"], { - initiallyInCity: false, - engine: Engine, - p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"] - }); - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(rootComponent, Engine.Display.locationContent); - }, - loadWorkInProgressContent: function () { - Engine.hideAllContent(); - var mainMenu = document.getElementById("mainmenu-container"); - mainMenu.style.visibility = "hidden"; - Engine.Display.workInProgressContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].WorkInProgress); - }, - loadRedPillContent: function () { - Engine.hideAllContent(); - var mainMenu = document.getElementById("mainmenu-container"); - mainMenu.style.visibility = "hidden"; - Engine.Display.redPillContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].RedPill); - }, - loadCinematicTextContent: function () { - Engine.hideAllContent(); - var mainMenu = document.getElementById("mainmenu-container"); - mainMenu.style.visibility = "hidden"; - Engine.Display.cinematicTextContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CinematicText); - }, - loadInfiltrationContent: function (name, difficulty, maxLevel) { - Engine.hideAllContent(); - const mainMenu = document.getElementById("mainmenu-container"); - mainMenu.style.visibility = "hidden"; - Engine.Display.infiltrationContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Infiltration); - Object(_Infiltration_Helper__WEBPACK_IMPORTED_MODULE_18__["displayInfiltrationContent"])(this, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], name, difficulty, maxLevel); - }, - loadStockMarketContent: function () { - Engine.hideAllContent(); - Engine.Display.stockMarketContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].StockMarket); - Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["displayStockMarketContent"])(); - }, - loadGangContent: function () { - Engine.hideAllContent(); - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { - Engine.Display.gangContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Gang); - Object(_Gang_Helpers__WEBPACK_IMPORTED_MODULE_16__["displayGangContent"])(this, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gang, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } else { - Engine.loadTerminalContent(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal); - } - }, - loadMissionContent: function () { - Engine.hideAllContent(); - document.getElementById("mainmenu-container").style.visibility = "hidden"; - document.getElementById("character-overview-wrapper").style.visibility = "hidden"; - Engine.Display.missionContent.style.display = "block"; - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Mission); - }, - loadCorporationContent: function () { - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { - Engine.hideAllContent(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Corporation); - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.createUI(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } - }, - loadBladeburnerContent: function () { - if (!(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"])) return; - Engine.hideAllContent(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Bladeburner); - Engine.Display.bladeburnerContent.style.display = "block"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_Bladeburner_ui_Root__WEBPACK_IMPORTED_MODULE_17__["Root"], { - bladeburner: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner, - player: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], - engine: this - }), Engine.Display.bladeburnerContent); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Bladeburner.classList.add("active"); - }, - loadSleevesContent: function () { - // This is for Duplicate Sleeves page, not Re-sleeving @ Vita Life - try { - Engine.hideAllContent(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Sleeves); - Object(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__["createSleevesPage"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } catch (e) { - Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(e); - } - }, - loadResleevingContent: function () { - try { - Engine.hideAllContent(); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Resleeves); - Object(_PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__["createResleevesPage"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } catch (e) { - Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(e); - } - }, - // Helper function that hides all content - hideAllContent: function () { - Engine.Display.terminalContent.style.display = "none"; - Engine.Display.characterContent.style.display = "none"; - Engine.Display.scriptEditorContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.scriptEditorContent); - Engine.Display.activeScriptsContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.activeScriptsContent); - Engine.Display.infiltrationContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.infiltrationContent); - Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* clearHacknetNodesUI */ "a"])(); - Engine.Display.createProgramContent.style.display = "none"; - Engine.Display.factionsContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.factionsContent); - Engine.Display.factionContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.factionContent); - Engine.Display.augmentationsContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.augmentationsContent); - Engine.Display.milestonesContent.style.display = "none"; - Engine.Display.tutorialContent.style.display = "none"; - Engine.Display.locationContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.locationContent); - Engine.Display.gangContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.gangContent); - Engine.Display.bladeburnerContent.style.display = "none"; - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.unmountComponentAtNode(Engine.Display.bladeburnerContent); - Engine.Display.workInProgressContent.style.display = "none"; - Engine.Display.redPillContent.style.display = "none"; - Engine.Display.cinematicTextContent.style.display = "none"; - Engine.Display.stockMarketContent.style.display = "none"; - Engine.Display.missionContent.style.display = "none"; - - if (document.getElementById("gang-container")) { - document.getElementById("gang-container").style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.clearUI(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } - - Object(_PersonObjects_Resleeving_ResleevingUI__WEBPACK_IMPORTED_MODULE_45__["clearResleevesPage"])(); - Object(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__["clearSleevesPage"])(); // Make nav menu tabs inactive - - Engine.inactivateMainMenuLinks(); // Close dev menu - - Object(_DevMenu__WEBPACK_IMPORTED_MODULE_12__[/* closeDevMenu */ "a"])(); - }, - // Remove 'active' css class from all main menu links - inactivateMainMenuLinks: function () { - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Terminal.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ScriptEditor.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ActiveScripts.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].CreateProgram.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Stats.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Factions.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Augmentations.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].HacknetNodes.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Sleeves.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].City.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Travel.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Job.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].StockMarket.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Bladeburner.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Corporation.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Milestones.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Tutorial.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Options.classList.remove("active"); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].DevMenu.classList.remove("active"); - }, - displayCharacterOverviewInfo: function () { - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ui_React_CharacterOverview__WEBPACK_IMPORTED_MODULE_6__[/* CharacterOverviewComponent */ "a"], null), document.getElementById('character-overview-text')); - const save = document.getElementById("character-overview-save-button"); - const flashClass = "flashing-button"; - - if (!_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval) { - save.classList.add(flashClass); - } else { - save.classList.remove(flashClass); - } - }, - /// Display character info - updateCharacterInfo: function () { - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(Object(_ui_CharacterInfo__WEBPACK_IMPORTED_MODULE_47__["CharacterInfo"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]), Engine.Display.characterInfo); - }, - // Main Game Loop - idleTimer: function () { - // Get time difference - const _thisUpdate = new Date().getTime(); - - let diff = _thisUpdate - Engine._lastUpdate; - const offset = diff % Engine._idleSpeed; // Divide this by cycle time to determine how many cycles have elapsed since last update - - diff = Math.floor(diff / Engine._idleSpeed); - - if (diff > 0) { - // Update the game engine by the calculated number of cycles - Engine._lastUpdate = _thisUpdate - offset; - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].lastUpdate = _thisUpdate - offset; - Engine.updateGame(diff); - } - - window.requestAnimationFrame(Engine.idleTimer); - }, - updateGame: function (numCycles = 1) { - const time = numCycles * Engine._idleSpeed; - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime == null) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime = 0; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug == null) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug = 0; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode == null) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode = 0; - } - - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime += time; - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug += time; - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode += time; // Start Manual hack - - if (_Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionStarted === true) { - Engine._totalActionTime = _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionTime; - Engine._actionTimeLeft = _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionTime; - Engine._actionInProgress = true; - Engine._actionProgressBarCount = 1; - Engine._actionProgressStr = "[ ]"; - Engine._actionTimeStr = "Time left: "; - _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].actionStarted = false; - } // Working - - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking) { - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workForFaction(numCycles); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCreateProgram) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].createProgramWork(numCycles); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeStudyClass) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].takeClass(numCycles); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCrime) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].commitCrime(numCycles); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workPartTime(numCycles); - } else { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].work(numCycles); - } - } // Update stock prices - - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { - Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["processStockPrices"])(numCycles); - } // Gang, if applicable - - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gang.process(numCycles, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } // Mission - - - if (_Missions__WEBPACK_IMPORTED_MODULE_26__[/* inMission */ "c"] && _Missions__WEBPACK_IMPORTED_MODULE_26__[/* currMission */ "b"]) { - _Missions__WEBPACK_IMPORTED_MODULE_26__[/* currMission */ "b"].process(numCycles); - } // Corporation - - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { - // Stores cycles in a "buffer". Processed separately using Engine Counters - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.storeCycles(numCycles); - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner.storeCycles(numCycles); - } // Sleeves - - - for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++i) { - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i] instanceof _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__["Sleeve"]) { - const expForOtherSleeves = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i].process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], numCycles); // This sleeve earns experience for other sleeves - - if (expForOtherSleeves == null) { - continue; - } - - for (let j = 0; j < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++j) { - if (j === i) { - continue; - } - - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[j].gainExperience(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], expForOtherSleeves, numCycles, true); - } - } - } // Counters - - - Engine.decrementAllCounters(numCycles); - Engine.checkCounters(); // Manual hacks - - if (Engine._actionInProgress == true) { - Engine.updateHackProgress(numCycles); - } // Update the running time of all active scripts - - - Object(_NetscriptWorker__WEBPACK_IMPORTED_MODULE_28__[/* updateOnlineScriptTimes */ "f"])(numCycles); // Hacknet Nodes - - Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* processHacknetEarnings */ "j"])(numCycles); - }, - - /** - * Counters for the main event loop. Represent the number of game cycles that - * are required for something to happen. These counters are in game cycles, - * which is once every 200ms - */ - Counters: { - autoSaveCounter: 300, - updateSkillLevelsCounter: 10, - updateDisplays: 3, - updateDisplaysMed: 9, - updateDisplaysLong: 15, - updateActiveScriptsDisplay: 5, - createProgramNotifications: 10, - augmentationsNotifications: 10, - checkFactionInvitations: 100, - passiveFactionGrowth: 5, - messages: 150, - mechanicProcess: 5, - // Processes certain mechanics (Corporation, Bladeburner) - contractGeneration: 3000 // Generate Coding Contracts - - }, - decrementAllCounters: function (numCycles = 1) { - for (var counter in Engine.Counters) { - if (Engine.Counters.hasOwnProperty(counter)) { - Engine.Counters[counter] = Engine.Counters[counter] - numCycles; - } - } - }, - - /** - * Checks if any counters are 0. If they are, executes whatever - * is necessary and then resets the counter - */ - checkCounters: function () { - if (Engine.Counters.autoSaveCounter <= 0) { - if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval == null) { - _Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval = 60; - } - - if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval === 0) { - Engine.Counters.autoSaveCounter = Infinity; - } else { - Engine.Counters.autoSaveCounter = _Settings_Settings__WEBPACK_IMPORTED_MODULE_37__["Settings"].AutosaveInterval * 5; - _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].saveGame(Engine.indexedDb); - } - } - - if (Engine.Counters.updateSkillLevelsCounter <= 0) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].updateSkillLevels(); - Engine.Counters.updateSkillLevelsCounter = 10; - } - - if (Engine.Counters.updateActiveScriptsDisplay <= 0) { - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].ActiveScripts)) { - react_dom__WEBPACK_IMPORTED_MODULE_66___default.a.render(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(_ui_ActiveScripts_Root__WEBPACK_IMPORTED_MODULE_53__["ActiveScriptsRoot"], { - p: _Player__WEBPACK_IMPORTED_MODULE_30__["Player"], - workerScripts: _Netscript_WorkerScripts__WEBPACK_IMPORTED_MODULE_27__["workerScripts"] - }), Engine.Display.activeScriptsContent); - } - - Engine.Counters.updateActiveScriptsDisplay = 5; - } - - if (Engine.Counters.updateDisplays <= 0) { - Engine.displayCharacterOverviewInfo(); - - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].HacknetNodes)) { - Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* renderHacknetNodesUI */ "q"])(); - } else if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CreateProgram)) { - Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* displayCreateProgramContent */ "a"])(); - } else if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Sleeves)) { - Object(_PersonObjects_Sleeve_SleeveUI__WEBPACK_IMPORTED_MODULE_44__["updateSleevesPage"])(); - } - - Engine.Counters.updateDisplays = 3; - } - - if (Engine.Counters.updateDisplaysMed <= 0) { - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].CharacterInfo)) { - Engine.updateCharacterInfo(); - } - - Engine.Counters.updateDisplaysMed = 9; - } - - if (Engine.Counters.createProgramNotifications <= 0) { - var num = Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* getNumAvailableCreateProgram */ "b"])(); - var elem = document.getElementById("create-program-notification"); - - if (num > 0) { - elem.innerHTML = num; - elem.setAttribute("class", "notification-on"); - } else { - elem.innerHTML = ""; - elem.setAttribute("class", "notification-off"); - } - - Engine.Counters.createProgramNotifications = 10; - } - - if (Engine.Counters.augmentationsNotifications <= 0) { - var num = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].queuedAugmentations.length; - var elem = document.getElementById("augmentations-notification"); - - if (num > 0) { - elem.innerHTML = num; - elem.setAttribute("class", "notification-on"); - } else { - elem.innerHTML = ""; - elem.setAttribute("class", "notification-off"); - } - - Engine.Counters.augmentationsNotifications = 10; - } - - if (Engine.Counters.checkFactionInvitations <= 0) { - var invitedFactions = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].checkForFactionInvitations(); - - if (invitedFactions.length > 0) { - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstFacInvRecvd === false) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstFacInvRecvd = true; - document.getElementById("factions-tab").style.display = "list-item"; - document.getElementById("character-menu-header").click(); - document.getElementById("character-menu-header").click(); - } - - var randFaction = invitedFactions[Math.floor(Math.random() * invitedFactions.length)]; - Object(_Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__["inviteToFaction"])(randFaction); - } - - const num = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factionInvitations.length; - const elem = document.getElementById("factions-notification"); - - if (num > 0) { - elem.innerHTML = num; - elem.setAttribute("class", "notification-on"); - } else { - elem.innerHTML = ""; - elem.setAttribute("class", "notification-off"); - } - - Engine.Counters.checkFactionInvitations = 100; - } - - if (Engine.Counters.passiveFactionGrowth <= 0) { - var adjustedCycles = Math.floor(5 - Engine.Counters.passiveFactionGrowth); - Object(_Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__["processPassiveFactionRepGain"])(adjustedCycles); - Engine.Counters.passiveFactionGrowth = 5; - } - - if (Engine.Counters.messages <= 0) { - Object(_Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_25__[/* checkForMessagesToSend */ "b"])(); - - if (_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_1__["Augmentations"][_Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_3__["AugmentationNames"].TheRedPill].owned) { - Engine.Counters.messages = 4500; // 15 minutes for Red pill message - } else { - Engine.Counters.messages = 150; - } - } - - if (Engine.Counters.mechanicProcess <= 0) { - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { - try { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner.process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } catch (e) { - Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])("Exception caught in Bladeburner.process(): " + e); - } - } - - Engine.Counters.mechanicProcess = 5; - } - - if (Engine.Counters.contractGeneration <= 0) { - // X% chance of a contract being generated - if (Math.random() <= 0.25) { - Object(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_8__["generateRandomContract"])(); - } - - Engine.Counters.contractGeneration = 3000; - } - }, - // Calculates the hack progress for a manual (non-scripted) hack and updates the progress bar/time accordingly - // TODO Refactor this into Terminal module - _totalActionTime: 0, - _actionTimeLeft: 0, - _actionTimeStr: "Time left: ", - _actionProgressStr: "[ ]", - _actionProgressBarCount: 1, - _actionInProgress: false, - updateHackProgress: function (numCycles = 1) { - var timeElapsedMilli = numCycles * Engine._idleSpeed; - Engine._actionTimeLeft -= timeElapsedMilli / 1000; // Substract idle speed (ms) - - Engine._actionTimeLeft = Math.max(Engine._actionTimeLeft, 0); // Calculate percent filled - - var percent = Math.round((1 - Engine._actionTimeLeft / Engine._totalActionTime) * 100); // Update progress bar - - while (Engine._actionProgressBarCount * 2 <= percent) { - Engine._actionProgressStr = Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__["replaceAt"])(Engine._actionProgressStr, Engine._actionProgressBarCount, "|"); - Engine._actionProgressBarCount += 1; - } // Update hack time remaining - - - Engine._actionTimeStr = "Time left: " + Math.max(0, Math.round(Engine._actionTimeLeft)).toString() + "s"; - document.getElementById("hack-progress").innerHTML = Engine._actionTimeStr; // Dynamically update progress bar - - document.getElementById("hack-progress-bar").innerHTML = Engine._actionProgressStr.replace(/ /g, " "); // Once percent is 100, the hack is completed - - if (percent >= 100) { - Engine._actionInProgress = false; - _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].finishAction(); - } - }, - - /** - * Collapses a main menu header. Used when initializing the game. - * @param elems {HTMLElement[]} Elements under header - */ - closeMainMenuHeader: function (elems) { - for (var i = 0; i < elems.length; ++i) { - elems[i].style.maxHeight = null; - elems[i].style.opacity = 0; - elems[i].style.pointerEvents = "none"; - } - }, - - /** - * Expands a main menu header. Used when initializing the game. - * @param elems {HTMLElement[]} Elements under header - */ - openMainMenuHeader: function (elems) { - for (var i = 0; i < elems.length; ++i) { - elems[i].style.maxHeight = elems[i].scrollHeight + "px"; - elems[i].style.display = "block"; - } - }, - - /** - * Used in game when clicking on a main menu header (NOT used for initialization) - * @param open {boolean} Whether header is being opened or closed - * @param elems {HTMLElement[]} li Elements under header - * @param links {HTMLElement[]} a elements under header - */ - toggleMainMenuHeader: function (open, elems, links) { - for (var i = 0; i < elems.length; ++i) { - if (open) { - elems[i].style.opacity = 1; - elems[i].style.maxHeight = elems[i].scrollHeight + "px"; - } else { - elems[i].style.opacity = 0; - elems[i].style.maxHeight = null; - } - } - - for (var i = 0; i < links.length; ++i) { - if (open) { - links[i].style.opacity = 1; - links[i].style.maxHeight = links[i].scrollHeight + "px"; - links[i].style.pointerEvents = "auto"; - } else { - links[i].style.opacity = 0; - links[i].style.maxHeight = null; - links[i].style.pointerEvents = "none"; - } - } - }, - load: function (saveString) { - // Initialize main menu accordion panels to all start as "open" - const terminal = document.getElementById("terminal-tab"); - const createScript = document.getElementById("create-script-tab"); - const activeScripts = document.getElementById("active-scripts-tab"); - const createProgram = document.getElementById("create-program-tab"); - const stats = document.getElementById("stats-tab"); - const factions = document.getElementById("factions-tab"); - const augmentations = document.getElementById("augmentations-tab"); - const hacknetnodes = document.getElementById("hacknet-nodes-tab"); - const city = document.getElementById("city-tab"); - const travel = document.getElementById("travel-tab"); - const job = document.getElementById("job-tab"); - const stockmarket = document.getElementById("stock-market-tab"); - const bladeburner = document.getElementById("bladeburner-tab"); - const corp = document.getElementById("corporation-tab"); - const gang = document.getElementById("gang-tab"); - const milestones = document.getElementById("milestones-tab"); - const tutorial = document.getElementById("tutorial-tab"); - const options = document.getElementById("options-tab"); - const dev = document.getElementById("dev-tab"); // Load game from save or create new game - - if (Object(_SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* loadGame */ "a"])(saveString)) { - Object(_BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__["initBitNodeMultipliers"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - Engine.setDisplayElements(); // Sets variables for important DOM elements - - Engine.init(); // Initialize buttons, work, etc. - - Object(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__["updateSourceFileFlags"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__[/* initAugmentations */ "d"])(); // Also calls Player.reapplyAllAugmentations() - - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].reapplyAllSourceFiles(); - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { - Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["initSymbolToStockMap"])(); - } // Calculate the number of cycles have elapsed while offline - - - Engine._lastUpdate = new Date().getTime(); - const lastUpdate = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].lastUpdate; - const timeOffline = Engine._lastUpdate - lastUpdate; - const numCyclesOffline = Math.floor(timeOffline / Engine._idleSpeed); - let offlineReputation = 0; - const offlineHackingIncome = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].moneySourceA.hacking / _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug * timeOffline * 0.75; - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gainMoney(offlineHackingIncome); // Process offline progress - - Object(_NetscriptWorker__WEBPACK_IMPORTED_MODULE_28__[/* loadAllRunningScripts */ "b"])(); // This also takes care of offline production for those scripts - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].focus = true; - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workForFaction(numCyclesOffline); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCreateProgram) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].createProgramWork(numCyclesOffline); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeStudyClass) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].takeClass(numCyclesOffline); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCrime) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].commitCrime(numCyclesOffline); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workPartTime(numCyclesOffline); - } else { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].work(numCyclesOffline); - } - } else { - for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factions.length; i++) { - const facName = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factions[i]; - if (!_Faction_Factions__WEBPACK_IMPORTED_MODULE_13__["Factions"].hasOwnProperty(facName)) continue; - const faction = _Faction_Factions__WEBPACK_IMPORTED_MODULE_13__["Factions"][facName]; - if (!faction.isMember) continue; // No rep for special factions. - - const info = faction.getInfo(); - if (!info.offersWork()) continue; // No rep for gangs. - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].getGangName() === facName) continue; - const hRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__["getHackingWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], faction); - const sRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__["getFactionSecurityWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], faction); - const fRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_19__["getFactionFieldWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], faction); // can be infinite, doesn't matter. - - const reputationRate = Math.max(hRep, sRep, fRep) / _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].factions.length; - const rep = reputationRate * numCyclesOffline; - faction.playerReputation += rep; - offlineReputation += rep; - } - } // Hacknet Nodes offline progress - - - var offlineProductionFromHacknetNodes = Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* processHacknetEarnings */ "j"])(numCyclesOffline); - const hacknetProdInfo = Object(_Hacknet_HacknetHelpers__WEBPACK_IMPORTED_MODULE_21__[/* hasHacknetServers */ "h"])() ? react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_65___default.a.Fragment, null, Object(_ui_React_Hashes__WEBPACK_IMPORTED_MODULE_51__["Hashes"])(offlineProductionFromHacknetNodes), " hashes") : Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_50__["Money"])(offlineProductionFromHacknetNodes); // Passive faction rep gain offline - - Object(_Faction_FactionHelpers__WEBPACK_IMPORTED_MODULE_14__["processPassiveFactionRepGain"])(numCyclesOffline); // Stock Market offline progress - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { - Object(_StockMarket_StockMarket__WEBPACK_IMPORTED_MODULE_40__["processStockPrices"])(numCyclesOffline); - } // Gang progress for BitNode 2 - - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].gang.process(numCyclesOffline, _Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - } // Corporation offline progress - - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation.storeCycles(numCyclesOffline); - } // Bladeburner offline progress - - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner.storeCycles(numCyclesOffline); - } // Sleeves offline progress - - - for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++i) { - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i] instanceof _PersonObjects_Sleeve_Sleeve__WEBPACK_IMPORTED_MODULE_43__["Sleeve"]) { - const expForOtherSleeves = _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[i].process(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], numCyclesOffline); // This sleeve earns experience for other sleeves - - if (expForOtherSleeves == null) { - continue; - } - - for (let j = 0; j < _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves.length; ++j) { - if (j === i) { - continue; - } - - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].sleeves[j].gainExperience(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], expForOtherSleeves, numCyclesOffline, true); - } - } - } // Update total playtime - - - var time = numCyclesOffline * Engine._idleSpeed; - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime == null) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime = 0; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug == null) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug = 0; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode == null) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode = 0; - } - - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].totalPlaytime += time; - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastAug += time; - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].playtimeSinceLastBitnode += time; - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].lastUpdate = Engine._lastUpdate; - Engine.start(); // Run main game loop and Scripts loop - - Object(_utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__["removeLoadingScreen"])(); - const timeOfflineString = Object(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_0__["convertTimeMsToTimeElapsedString"])(time); - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])(react__WEBPACK_IMPORTED_MODULE_65___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_65___default.a.Fragment, null, "Offline for ", timeOfflineString, ". While you were offline, your scripts generated ", Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_50__["Money"])(offlineHackingIncome), ", your Hacknet Nodes generated ", hacknetProdInfo, " and you gained ", Object(_ui_React_Reputation__WEBPACK_IMPORTED_MODULE_52__["Reputation"])(offlineReputation), " divided amongst your factions.")); // Close main menu accordions for loaded game - - var visibleMenuTabs = [terminal, createScript, activeScripts, stats, hacknetnodes, city, milestones, tutorial, options, dev]; - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstFacInvRecvd) { - visibleMenuTabs.push(factions); - } else { - factions.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstAugPurchased) { - visibleMenuTabs.push(augmentations); - } else { - augmentations.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].companyName !== "") { - visibleMenuTabs.push(job); - } else { - job.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstTimeTraveled) { - visibleMenuTabs.push(travel); - } else { - travel.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].firstProgramAvailable) { - visibleMenuTabs.push(createProgram); - } else { - createProgram.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].hasWseAccount) { - visibleMenuTabs.push(stockmarket); - } else { - stockmarket.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].bladeburner instanceof _Bladeburner_Bladeburner__WEBPACK_IMPORTED_MODULE_5__["Bladeburner"]) { - visibleMenuTabs.push(bladeburner); - } else { - bladeburner.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].corporation instanceof _Corporation_Corporation__WEBPACK_IMPORTED_MODULE_10__["Corporation"]) { - visibleMenuTabs.push(corp); - } else { - corp.style.display = "none"; - } - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].inGang()) { - visibleMenuTabs.push(gang); - } else { - gang.style.display = "none"; - } - - Engine.closeMainMenuHeader(visibleMenuTabs); - } else { - // No save found, start new game - Object(_BitNode_BitNode__WEBPACK_IMPORTED_MODULE_4__["initBitNodeMultipliers"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); - Object(_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_39__["initSpecialServerIps"])(); - Engine.setDisplayElements(); // Sets variables for important DOM elements - - Engine.start(); // Run main game loop and Scripts loop - - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].init(); - Object(_Server_AllServers__WEBPACK_IMPORTED_MODULE_36__["initForeignServers"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].getHomeComputer()); - Object(_Company_Companies__WEBPACK_IMPORTED_MODULE_9__["initCompanies"])(); - Object(_Faction_Factions__WEBPACK_IMPORTED_MODULE_13__["initFactions"])(); - Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_2__[/* initAugmentations */ "d"])(); - Object(_Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_25__[/* initMessages */ "c"])(); - Object(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_38__["updateSourceFileFlags"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"]); // Open main menu accordions for new game - - const hackingHdr = document.getElementById("hacking-menu-header"); - hackingHdr.classList.toggle("opened"); - const characterHdr = document.getElementById("character-menu-header"); - characterHdr.classList.toggle("opened"); - const worldHdr = document.getElementById("world-menu-header"); - worldHdr.classList.toggle("opened"); - const helpHdr = document.getElementById("help-menu-header"); - helpHdr.classList.toggle("opened"); // Hide tabs that wont be revealed until later - - factions.style.display = "none"; - augmentations.style.display = "none"; - job.style.display = "none"; - stockmarket.style.display = "none"; - travel.style.display = "none"; - createProgram.style.display = "none"; - bladeburner.style.display = "none"; - corp.style.display = "none"; - gang.style.display = "none"; - dev.style.display = "none"; - Engine.openMainMenuHeader([terminal, createScript, activeScripts, stats, hacknetnodes, city, milestones, tutorial, options]); // Start interactive tutorial - - Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_22__["iTutorialStart"])(); - Object(_utils_uiHelpers_removeLoadingScreen__WEBPACK_IMPORTED_MODULE_61__["removeLoadingScreen"])(); - } // Initialize labels on game settings - - - Object(_ui_setSettingsLabels__WEBPACK_IMPORTED_MODULE_49__[/* setSettingsLabels */ "a"])(); - _Terminal__WEBPACK_IMPORTED_MODULE_42__[/* Terminal */ "a"].resetTerminalInput(); - }, - setDisplayElements: function () { - // Content elements - Engine.Display.terminalContent = document.getElementById("terminal-container"); - _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["routing"].navigateTo(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_48__["Page"].Terminal); - Engine.Display.characterContent = document.getElementById("character-container"); - Engine.Display.characterContent.style.display = "none"; - Engine.Display.scriptEditorContent = document.getElementById("script-editor-container"); - Engine.Display.scriptEditorContent.style.display = "none"; - Engine.Display.activeScriptsContent = document.getElementById("active-scripts-container"); - Engine.Display.activeScriptsContent.style.display = "none"; - Engine.Display.hacknetNodesContent = document.getElementById("hacknet-nodes-container"); - Engine.Display.hacknetNodesContent.style.display = "none"; - Engine.Display.createProgramContent = document.getElementById("create-program-container"); - Engine.Display.createProgramContent.style.display = "none"; - Engine.Display.factionsContent = document.getElementById("factions-container"); - Engine.Display.factionsContent.style.display = "none"; - Engine.Display.factionContent = document.getElementById("faction-container"); - Engine.Display.factionContent.style.display = "none"; - Engine.Display.augmentationsContent = document.getElementById("augmentations-container"); - Engine.Display.augmentationsContent.style.display = "none"; - Engine.Display.milestonesContent = document.getElementById("milestones-container"); - Engine.Display.milestonesContent.style.display = "none"; - Engine.Display.tutorialContent = document.getElementById("tutorial-container"); - Engine.Display.tutorialContent.style.display = "none"; - Engine.Display.infiltrationContent = document.getElementById("infiltration-container"); - Engine.Display.infiltrationContent.style.display = "none"; - Engine.Display.stockMarketContent = document.getElementById("stock-market-container"); - Engine.Display.stockMarketContent.style.display = "none"; - Engine.Display.gangContent = document.getElementById("gang-container"); - Engine.Display.gangContent.style.display = "none"; - Engine.Display.bladeburnerContent = document.getElementById("gang-container"); - Engine.Display.bladeburnerContent.style.display = "none"; - Engine.Display.missionContent = document.getElementById("mission-container"); - Engine.Display.missionContent.style.display = "none"; // Character info - - Engine.Display.characterInfo = document.getElementById("character-content"); // Location page (page that shows up when you visit a specific location in World) - - Engine.Display.locationContent = document.getElementById("location-container"); - Engine.Display.locationContent.style.display = "none"; // Work In Progress - - Engine.Display.workInProgressContent = document.getElementById("work-in-progress-container"); - Engine.Display.workInProgressContent.style.display = "none"; // Red Pill / Hack World Daemon - - Engine.Display.redPillContent = document.getElementById("red-pill-container"); - Engine.Display.redPillContent.style.display = "none"; // Cinematic Text - - Engine.Display.cinematicTextContent = document.getElementById("cinematic-text-container"); - Engine.Display.cinematicTextContent.style.display = "none"; // Initialize references to main menu links - - if (!Object(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["initializeMainMenuLinks"])()) { - const errorMsg = "Failed to initialize Main Menu Links. Please try refreshing the page. " + "If that doesn't work, report the issue to the developer"; - Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(new Error(errorMsg)); - console.error(errorMsg); - return; - } - }, - // Initialization - init: function () { - // Import game link - document.getElementById("import-game-link").onclick = function () { - _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].importGame(); - }; // Initialize Main Menu Headers (this must be done after initializing the links) - - - if (!Object(_ui_MainMenu_Headers__WEBPACK_IMPORTED_MODULE_54__["initializeMainMenuHeaders"])(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"], "development" === "development")) { - const errorMsg = "Failed to initialize Main Menu Headers. Please try refreshing the page. " + "If that doesn't work, report the issue to the developer"; - Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_60__["exceptionAlert"])(new Error(errorMsg)); - console.error(errorMsg); - return; - } - - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Terminal.addEventListener("click", function () { - Engine.loadTerminalContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ScriptEditor.addEventListener("click", function () { - Engine.loadScriptEditorContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].ActiveScripts.addEventListener("click", function () { - Engine.loadActiveScriptsContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].CreateProgram.addEventListener("click", function () { - Engine.loadCreateProgramContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Stats.addEventListener("click", function () { - Engine.loadCharacterContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Factions.addEventListener("click", function () { - Engine.loadFactionsContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Augmentations.addEventListener("click", function () { - Engine.loadAugmentationsContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].HacknetNodes.addEventListener("click", function () { - Engine.loadHacknetNodesContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Sleeves.addEventListener("click", function () { - Engine.loadSleevesContent(); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Sleeves.classList.add("active"); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].City.addEventListener("click", function () { - Engine.loadLocationContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Travel.addEventListener("click", function () { - Engine.loadTravelContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Job.addEventListener("click", function () { - Engine.loadJobContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].StockMarket.addEventListener("click", function () { - Engine.loadStockMarketContent(); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].StockMarket.classList.add("active"); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Bladeburner.addEventListener("click", function () { - Engine.loadBladeburnerContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Corporation.addEventListener("click", function () { - Engine.loadCorporationContent(); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Corporation.classList.add("active"); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.addEventListener("click", function () { - Engine.loadGangContent(); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Gang.classList.add('active'); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Milestones.addEventListener("click", function () { - Engine.loadMilestonesContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].Tutorial.addEventListener("click", function () { - Engine.loadTutorialContent(); - return false; - }); - _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_55__["MainMenuLinks"].DevMenu.addEventListener("click", function () { - if (true) { - Engine.loadDevMenuContent(); - } - - return false; - }); // Active scripts list - - Engine.ActiveScriptsList = document.getElementById("active-scripts-list"); // Save, Delete, Import/Export buttons - - Engine.Clickables.saveMainMenuButton = document.getElementById("save-game-link"); - Engine.Clickables.saveMainMenuButton.addEventListener("click", function () { - _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].saveGame(Engine.indexedDb); - return false; - }); - Engine.Clickables.deleteMainMenuButton = document.getElementById("delete-game-link"); - Engine.Clickables.deleteMainMenuButton.addEventListener("click", function () { - _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].deleteGame(Engine.indexedDb); - return false; - }); - document.getElementById("export-game-link").addEventListener("click", function () { - _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].exportGame(); - return false; - }); // Character Overview buttons - - document.getElementById("character-overview-save-button").addEventListener("click", function () { - _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].saveGame(Engine.indexedDb); - return false; - }); - document.getElementById("character-overview-options-button").addEventListener("click", function () { - Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxOpen */ "b"])(); - return false; - }); // Create Program buttons - - Object(_Programs_ProgramHelpers__WEBPACK_IMPORTED_MODULE_32__[/* initCreateProgramButtons */ "c"])(); // Message at the top of terminal - - Object(_Terminal__WEBPACK_IMPORTED_MODULE_42__[/* postNetburnerText */ "b"])(); // Player was working cancel button - - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].isWorking) { - var cancelButton = document.getElementById("work-in-progress-cancel-button"); - cancelButton.addEventListener("click", function () { - if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishFactionWork(true); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCreateProgram) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishCreateProgramWork(true); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeStudyClass) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishClass(); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCrime) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishCrime(true); - } else if (_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType == _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime) { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishWorkPartTime(); - } else { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].finishWork(true); - } - }); - const focusButton = document.getElementById("work-in-progress-something-else-button"); - focusButton.style.visibility = "hidden"; - const focusable = [_Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeFaction, _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompanyPartTime, _Constants__WEBPACK_IMPORTED_MODULE_11__["CONSTANTS"].WorkTypeCompany]; - - if (focusable.includes(_Player__WEBPACK_IMPORTED_MODULE_30__["Player"].workType)) { - focusButton.style.visibility = "visible"; - focusButton.addEventListener("click", function () { - _Player__WEBPACK_IMPORTED_MODULE_30__["Player"].stopFocusing(); - }); - } - - Engine.loadWorkInProgressContent(); - } // Character overview screen - - - document.getElementById("character-overview-container").style.display = "block"; // Remove classes from links (they might be set from tutorial) - - document.getElementById("terminal-menu-link").removeAttribute("class"); - document.getElementById("stats-menu-link").removeAttribute("class"); - document.getElementById("create-script-menu-link").removeAttribute("class"); - document.getElementById("active-scripts-menu-link").removeAttribute("class"); - document.getElementById("hacknet-nodes-menu-link").removeAttribute("class"); - document.getElementById("city-menu-link").removeAttribute("class"); - document.getElementById("milestones-menu-link").removeAttribute("class"); - document.getElementById("tutorial-menu-link").removeAttribute("class"); // Copy Save Data to Clipboard - - document.getElementById("copy-save-to-clipboard-link").addEventListener("click", function () { - const saveString = _SaveObject__WEBPACK_IMPORTED_MODULE_34__[/* saveObject */ "b"].getSaveString(); - - if (!navigator.clipboard) { - // Async Clipboard API not supported, so we'll use this using the - // textarea and document.execCommand('copy') trick - const textArea = document.createElement("textarea"); - textArea.value = saveString; - textArea.setAttribute("readonly", ''); - textArea.style.position = 'absolute'; - textArea.left = '-9999px'; - document.body.appendChild(textArea); - textArea.focus(); - textArea.select(); - - try { - const successful = document.execCommand("copy"); - - if (successful) { - Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Copied save to clipboard"); - } else { - Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Failed to copy save"); - } - } catch (e) { - console.error("Unable to copy save data to clipboard using document.execCommand('copy')"); - Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Failed to copy save"); - } - - document.body.removeChild(textArea); - } else { - // Use the Async Clipboard API - navigator.clipboard.writeText(saveString).then(function () { - Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Copied save to clipboard"); - }, function (err) { - console.error(err); - console.error("Unable to copy save data to clipboard using Async API"); - Object(_ui_createStatusText__WEBPACK_IMPORTED_MODULE_46__["createStatusText"])("Failed to copy save"); - }); - } - }); // DEBUG Delete active Scripts on home - - document.getElementById("debug-delete-scripts-link").addEventListener("click", function () { - for (const hostname of Object.keys(_Server_AllServers__WEBPACK_IMPORTED_MODULE_36__["AllServers"])) { - _Server_AllServers__WEBPACK_IMPORTED_MODULE_36__["AllServers"][hostname].runningScripts = []; - } - - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])("Forcefully deleted all running scripts. Please save and refresh page."); - Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxClose */ "a"])(); - return false; - }); // DEBUG Soft Reset - - document.getElementById("debug-soft-reset").addEventListener("click", function () { - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_58__["dialogBoxCreate"])("Soft Reset!"); - Object(_Prestige__WEBPACK_IMPORTED_MODULE_31__[/* prestigeAugmentation */ "a"])(); - Object(_utils_GameOptions__WEBPACK_IMPORTED_MODULE_59__[/* gameOptionsBoxClose */ "a"])(); - return false; - }); // DEBUG File diagnostic - - document.getElementById("debug-files").addEventListener("click", function () { - Object(_ui_React_createPopup__WEBPACK_IMPORTED_MODULE_57__["createPopup"])("debug-files-diagnostic-popup", _Diagnostic_FileDiagnosticPopup__WEBPACK_IMPORTED_MODULE_56__["FileDiagnosticPopup"], {}); - return false; - }); - }, - start: function () { - // Run main loop - Engine.idleTimer(); - } -}; -var indexedDbRequest; - -window.onload = function () { - if (!window.indexedDB) { - return Engine.load(null); // Will try to load from localstorage - } - /** - * DB is called bitburnerSave - * Object store is called savestring - * key for the Object store is called save - */ - - - indexedDbRequest = window.indexedDB.open("bitburnerSave", 1); - - indexedDbRequest.onerror = function (e) { - console.error("Error opening indexedDB: "); - console.error(e); - return Engine.load(null); // Try to load from localstorage - }; - - indexedDbRequest.onsuccess = function (e) { - Engine.indexedDb = e.target.result; - var transaction = Engine.indexedDb.transaction(["savestring"]); - var objectStore = transaction.objectStore("savestring"); - var request = objectStore.get("save"); - - request.onerror = function (e) { - console.error("Error in Database request to get savestring: " + e); - return Engine.load(null); // Try to load from localstorage - }; - - request.onsuccess = function () { - Engine.load(request.result); - }; - }; - - indexedDbRequest.onupgradeneeded = function (e) { - const db = e.target.result; - db.createObjectStore("savestring"); - }; -}; - - -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! jquery */ 143))) - -/***/ }), -/* 16 */ -/*!*******************************************!*\ - !*** ./src/Augmentation/Augmentation.tsx ***! - \*******************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Augmentation = void 0; -// Class definition for a single Augmentation object -const React = __importStar(__webpack_require__(/*! react */ 0)); -const BitNodeMultipliers_1 = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 19); -const Factions_1 = __webpack_require__(/*! ../Faction/Factions */ 17); -const numeralFormat_1 = __webpack_require__(/*! ../ui/numeralFormat */ 7); -const Money_1 = __webpack_require__(/*! ../ui/React/Money */ 27); -const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); -function generateStatsDescription(mults, programs, startingMoney) { - const f = (x, decimals = 0) => { - // look, I don't know how to make a "smart decimals" - // todo, make it smarter - if (x === 1.0777 - 1) - return "7.77%"; - if (x === 1.777 - 1) - return "77.7%"; - return numeralFormat_1.numeralWrapper.formatPercentage(x, decimals); - }; - let desc = React.createElement(React.Fragment, null, "Effects:"); - if (mults.hacking_mult && - mults.hacking_mult == mults.strength_mult && - mults.hacking_mult == mults.defense_mult && - mults.hacking_mult == mults.dexterity_mult && - mults.hacking_mult == mults.agility_mult && - mults.hacking_mult == mults.charisma_mult) { - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_mult - 1), - " all skills"); - } - else { - if (mults.hacking_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_mult - 1), - " hacking skill"); - if (mults.strength_mult && - mults.strength_mult == mults.defense_mult && - mults.strength_mult == mults.dexterity_mult && - mults.strength_mult == mults.agility_mult) { - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.strength_mult - 1), - " combat skills"); - } - else { - if (mults.strength_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.strength_mult - 1), - " strength skill"); - if (mults.defense_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.defense_mult - 1), - " defense skill"); - if (mults.dexterity_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.dexterity_mult - 1), - " dexterity skill"); - if (mults.agility_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.agility_mult - 1), - " agility skill"); - } - if (mults.charisma_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.charisma_mult - 1), - " Charisma skill"); - } - if (mults.hacking_exp_mult && - mults.hacking_exp_mult === mults.strength_exp_mult && - mults.hacking_exp_mult === mults.defense_exp_mult && - mults.hacking_exp_mult === mults.dexterity_exp_mult && - mults.hacking_exp_mult === mults.agility_exp_mult && - mults.hacking_exp_mult === mults.charisma_exp_mult) { - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_exp_mult - 1), - " exp for all skills"); - } - else { - if (mults.hacking_exp_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_exp_mult - 1), - " hacking exp"); - if (mults.strength_exp_mult && - mults.strength_exp_mult === mults.defense_exp_mult && - mults.strength_exp_mult === mults.dexterity_exp_mult && - mults.strength_exp_mult === mults.agility_exp_mult) { - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.strength_exp_mult - 1), - " combat exp"); - } - else { - if (mults.strength_exp_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.strength_exp_mult - 1), - " strength exp"); - if (mults.defense_exp_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.defense_exp_mult - 1), - " defense exp"); - if (mults.dexterity_exp_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.dexterity_exp_mult - 1), - " dexterity exp"); - if (mults.agility_exp_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.agility_exp_mult - 1), - " agility exp"); - } - if (mults.charisma_exp_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.charisma_exp_mult - 1), - " charisma exp"); - } - if (mults.hacking_speed_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_speed_mult - 1), - " faster hacking"); - if (mults.hacking_chance_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_chance_mult - 1), - " hack() success chance"); - if (mults.hacking_money_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_money_mult - 1), - " hack() power"); - if (mults.hacking_grow_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacking_grow_mult - 1), - " grow() power"); - if (mults.faction_rep_mult && - mults.faction_rep_mult === mults.company_rep_mult) { - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.faction_rep_mult - 1), - " reputation from factions and companies"); - } - else { - if (mults.faction_rep_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.faction_rep_mult - 1), - " reputation from factions"); - if (mults.company_rep_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.company_rep_mult - 1), - " reputation from companies"); - } - if (mults.crime_money_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.crime_money_mult - 1), - " crime money"); - if (mults.crime_success_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.crime_success_mult - 1), - " crime success rate"); - if (mults.work_money_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.work_money_mult - 1), - " work money"); - if (mults.hacknet_node_money_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.hacknet_node_money_mult - 1), - " hacknet production"); - if (mults.hacknet_node_purchase_cost_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "-", - f(-(mults.hacknet_node_purchase_cost_mult - 1)), - " hacknet nodes cost"); - if (mults.hacknet_node_level_cost_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "-", - f(-(mults.hacknet_node_level_cost_mult - 1)), - " hacknet nodes upgrade cost"); - if (mults.bladeburner_max_stamina_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.bladeburner_max_stamina_mult - 1), - " Bladeburner Max Stamina"); - if (mults.bladeburner_stamina_gain_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.bladeburner_stamina_gain_mult - 1), - " Bladeburner Stamina gain"); - if (mults.bladeburner_analysis_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.bladeburner_analysis_mult - 1), - " Bladeburner Field Analysis effectiveness"); - if (mults.bladeburner_success_chance_mult) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "+", - f(mults.bladeburner_success_chance_mult - 1), - " Bladeburner Contracts and Operations success chance"); - if (startingMoney) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "Start with ", - Money_1.Money(startingMoney), - " after installing Augmentations."); - if (programs) - desc = React.createElement(React.Fragment, null, - desc, - React.createElement("br", null), - "Start with ", - programs.join(' and '), - " after installing Augmentations."); - return desc; -} -class Augmentation { - constructor(params = { info: "", moneyCost: 0, name: "", repCost: 0 }) { - // How much money this costs to buy - this.baseCost = 0; - // How much faction reputation is required to unlock this - this.baseRepRequirement = 0; - // Any Augmentation not immediately available in BitNode-1 is special (e.g. Bladeburner augs) - this.isSpecial = false; - // Augmentation level - for repeatable Augs like NeuroFlux Governor - this.level = 0; - // Name of Augmentation - this.name = ""; - // Whether the player owns this Augmentation - this.owned = false; - // Array of names of all prerequisites - this.prereqs = []; - // Multipliers given by this Augmentation. Must match the property name in - // The Player/Person classes - this.mults = {}; - // Initial cost. Doesn't change when you purchase multiple Augmentation - this.startingCost = 0; - this.name = params.name; - this.info = params.info; - this.prereqs = params.prereqs ? params.prereqs : []; - this.baseRepRequirement = params.repCost * BitNodeMultipliers_1.BitNodeMultipliers.AugmentationRepCost; - this.baseCost = params.moneyCost * BitNodeMultipliers_1.BitNodeMultipliers.AugmentationMoneyCost; - this.startingCost = this.baseCost; - if (params.isSpecial) { - this.isSpecial = true; - } - this.level = 0; - // Set multipliers - if (params.hacking_mult) { - this.mults.hacking_mult = params.hacking_mult; - } - if (params.strength_mult) { - this.mults.strength_mult = params.strength_mult; - } - if (params.defense_mult) { - this.mults.defense_mult = params.defense_mult; - } - if (params.dexterity_mult) { - this.mults.dexterity_mult = params.dexterity_mult; - } - if (params.agility_mult) { - this.mults.agility_mult = params.agility_mult; - } - if (params.charisma_mult) { - this.mults.charisma_mult = params.charisma_mult; - } - if (params.hacking_exp_mult) { - this.mults.hacking_exp_mult = params.hacking_exp_mult; - } - if (params.strength_exp_mult) { - this.mults.strength_exp_mult = params.strength_exp_mult; - } - if (params.defense_exp_mult) { - this.mults.defense_exp_mult = params.defense_exp_mult; - } - if (params.dexterity_exp_mult) { - this.mults.dexterity_exp_mult = params.dexterity_exp_mult; - } - if (params.agility_exp_mult) { - this.mults.agility_exp_mult = params.agility_exp_mult; - } - if (params.charisma_exp_mult) { - this.mults.charisma_exp_mult = params.charisma_exp_mult; - } - if (params.hacking_chance_mult) { - this.mults.hacking_chance_mult = params.hacking_chance_mult; - } - if (params.hacking_speed_mult) { - this.mults.hacking_speed_mult = params.hacking_speed_mult; - } - if (params.hacking_money_mult) { - this.mults.hacking_money_mult = params.hacking_money_mult; - } - if (params.hacking_grow_mult) { - this.mults.hacking_grow_mult = params.hacking_grow_mult; - } - if (params.company_rep_mult) { - this.mults.company_rep_mult = params.company_rep_mult; - } - if (params.faction_rep_mult) { - this.mults.faction_rep_mult = params.faction_rep_mult; - } - if (params.crime_money_mult) { - this.mults.crime_money_mult = params.crime_money_mult; - } - if (params.crime_success_mult) { - this.mults.crime_success_mult = params.crime_success_mult; - } - if (params.work_money_mult) { - this.mults.work_money_mult = params.work_money_mult; - } - if (params.hacknet_node_money_mult) { - this.mults.hacknet_node_money_mult = params.hacknet_node_money_mult; - } - if (params.hacknet_node_purchase_cost_mult) { - this.mults.hacknet_node_purchase_cost_mult = params.hacknet_node_purchase_cost_mult; - } - if (params.hacknet_node_ram_cost_mult) { - this.mults.hacknet_node_ram_cost_mult = params.hacknet_node_ram_cost_mult; - } - if (params.hacknet_node_core_cost_mult) { - this.mults.hacknet_node_core_cost_mult = params.hacknet_node_core_cost_mult; - } - if (params.hacknet_node_level_cost_mult) { - this.mults.hacknet_node_level_cost_mult = params.hacknet_node_level_cost_mult; - } - if (params.bladeburner_max_stamina_mult) { - this.mults.bladeburner_max_stamina_mult = params.bladeburner_max_stamina_mult; - } - if (params.bladeburner_stamina_gain_mult) { - this.mults.bladeburner_stamina_gain_mult = params.bladeburner_stamina_gain_mult; - } - if (params.bladeburner_analysis_mult) { - this.mults.bladeburner_analysis_mult = params.bladeburner_analysis_mult; - } - if (params.bladeburner_success_chance_mult) { - this.mults.bladeburner_success_chance_mult = params.bladeburner_success_chance_mult; - } - if (params.stats) - this.stats = params.stats; - else - this.stats = generateStatsDescription(this.mults, params.programs, params.startingMoney); - } - // Adds this Augmentation to the specified Factions - addToFactions(factionList) { - for (let i = 0; i < factionList.length; ++i) { - const faction = Factions_1.Factions[factionList[i]]; - if (faction == null) { - console.warn(`In Augmentation.addToFactions(), could not find faction with this name: ${factionList[i]}`); - continue; - } - faction.augmentations.push(this.name); - } - } - // Adds this Augmentation to all Factions - addToAllFactions() { - for (const fac in Factions_1.Factions) { - if (Factions_1.Factions.hasOwnProperty(fac)) { - const facObj = Factions_1.Factions[fac]; - if (facObj == null) { - console.warn(`Invalid Faction object in addToAllFactions(). Key value: ${fac}`); - continue; - } - facObj.augmentations.push(this.name); - } - } - } - // Serialize the current object to a JSON save state. - toJSON() { - return JSONReviver_1.Generic_toJSON("Augmentation", this); - } - // Initiatizes a Augmentation object from a JSON save state. - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - static fromJSON(value) { - return JSONReviver_1.Generic_fromJSON(Augmentation, value.data); - } -} -exports.Augmentation = Augmentation; -JSONReviver_1.Reviver.constructors.Augmentation = Augmentation; - - -/***/ }), -/* 17 */ -/*!*********************************!*\ - !*** ./src/Faction/Factions.ts ***! - \*********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.resetFaction = exports.initFactions = exports.factionExists = exports.AddToFactions = exports.loadFactions = exports.Factions = void 0; -/** - * Initialization and manipulation of the Factions object, which stores data - * about all Factions in the game - */ -const Faction_1 = __webpack_require__(/*! ./Faction */ 125); -const FactionInfo_1 = __webpack_require__(/*! ./FactionInfo */ 695); -const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); -exports.Factions = {}; -function loadFactions(saveString) { - exports.Factions = JSON.parse(saveString, JSONReviver_1.Reviver); -} -exports.loadFactions = loadFactions; -function AddToFactions(faction) { - const name = faction.name; - exports.Factions[name] = faction; -} -exports.AddToFactions = AddToFactions; -function factionExists(name) { - return exports.Factions.hasOwnProperty(name); -} -exports.factionExists = factionExists; -function initFactions() { - for (const name in FactionInfo_1.FactionInfos) { - resetFaction(new Faction_1.Faction(name)); - } -} -exports.initFactions = initFactions; -//Resets a faction during (re-)initialization. Saves the favor in the new -//Faction object and deletes the old Faction Object from "Factions". Then -//reinserts the new Faction object -function resetFaction(newFactionObject) { - if (!(newFactionObject instanceof Faction_1.Faction)) { - throw new Error("Invalid argument 'newFactionObject' passed into resetFaction()"); - } - const factionName = newFactionObject.name; - if (factionExists(factionName)) { - newFactionObject.favor = exports.Factions[factionName].favor; - delete exports.Factions[factionName]; - } - AddToFactions(newFactionObject); -} -exports.resetFaction = resetFaction; - - -/***/ }), -/* 18 */ -/*!**************************************!*\ - !*** ./src/ui/navigationTracking.ts ***! - \**************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.routing = exports.Page = void 0; -/** - * The full-screen page the player is currently be on. - * These pages are mutually exclusive. - */ -var Page; -(function (Page) { - /** - * (Default) The terminal is where the player issues all commands, executes scripts, etc. - */ - Page["Terminal"] = "Terminal"; - /** - * Displays most of the statistics about the player. - */ - Page["CharacterInfo"] = "CharacterInfo"; - /** - * The console for editing Netscript files. - */ - Page["ScriptEditor"] = "ScriptEditor"; - /** - * Monitor the scripts currently executing across the servers. - */ - Page["ActiveScripts"] = "ActiveScripts"; - /** - * View, purchase, and upgrade Hacknet nodes. - */ - Page["HacknetNodes"] = "HacknetNodes"; - /** - * The list of programs the player could potentially build. - */ - Page["CreateProgram"] = "CreateProgram"; - /** - * The list of all factions, and invites, available to the player. - */ - Page["Factions"] = "Factions"; - /** - * Information about a specific faction. - */ - Page["Faction"] = "Faction"; - /** - * The list of installed, and yet-to-be installed, augmentations the player has purchased. - */ - Page["Augmentations"] = "Augmentations"; - /** - * List of milestones that players should follow. - */ - Page["Milestones"] = "Milestones"; - /** - * A collection of in-game material to learn about the game. - */ - Page["Tutorial"] = "Tutorial"; - /** - * A collection of items to manipulate the state of the game. Useful for development. - */ - Page["DevMenu"] = "Dev Menu"; - /** - * Visiting a location in the world - */ - Page["Location"] = "Location"; - /** - * A blocking page to show the player they are currently doing some action (building a program, working, etc.). - */ - Page["workInProgress"] = "WorkInProgress"; - /** - * A special screen to show the player they've reached a certain point in the game. - */ - Page["RedPill"] = "RedPill"; - /** - * A special screen to show the player they've reached a certain point in the game. - */ - Page["CinematicText"] = "CinematicText"; - /** - * Mini-game to infiltrate a company, gaining experience from successful progress. - */ - Page["Infiltration"] = "Infiltration"; - /** - * View the in-game stock market. - */ - Page["StockMarket"] = "StockMarket"; - /** - * Manage gang actions and members. - */ - Page["Gang"] = "Gang"; - /** - * Perform missions for a Faction. - */ - Page["Mission"] = "Mission"; - /** - * Manage a corporation. - */ - Page["Corporation"] = "Corporation"; - /** - * Manage special Bladeburner activities. - */ - Page["Bladeburner"] = "Bladeburner"; - /** - * Manage your Sleeves - */ - Page["Sleeves"] = "Sleeves"; - /** - * Purchase Resleeves - */ - Page["Resleeves"] = "Re-sleeving"; -})(Page = exports.Page || (exports.Page = {})); -/** - * This class keeps track of player navigation/routing within the game. - */ -class Routing { - constructor() { - /** - * Tracking the what page the user is currently on. - */ - this.currentPage = null; - } - /** - * Determines if the player is currently on the specified page. - * @param page The page to compare against the current state. - */ - isOn(page) { - return this.currentPage === page; - } - /** - * Routes the player to the appropriate page. - * @param page The page to navigate to. - */ - navigateTo(page) { - this.currentPage = page; - } -} -/** - * The routing instance for tracking page navigation. - */ -exports.routing = new Routing(); - - -/***/ }), -/* 19 */ -/*!*******************************************!*\ - !*** ./src/BitNode/BitNodeMultipliers.ts ***! - \*******************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.BitNodeMultipliers = void 0; -/** - * The multipliers that are influenced by current Bitnode progression. - */ -// tslint:disable-next-line:variable-name -exports.BitNodeMultipliers = { - HackingLevelMultiplier: 1, - StrengthLevelMultiplier: 1, - DefenseLevelMultiplier: 1, - DexterityLevelMultiplier: 1, - AgilityLevelMultiplier: 1, - CharismaLevelMultiplier: 1, - ServerGrowthRate: 1, - ServerMaxMoney: 1, - ServerStartingMoney: 1, - ServerStartingSecurity: 1, - ServerWeakenRate: 1, - HomeComputerRamCost: 1, - PurchasedServerCost: 1, - PurchasedServerLimit: 1, - PurchasedServerMaxRam: 1, - CompanyWorkMoney: 1, - CrimeMoney: 1, - HacknetNodeMoney: 1, - ManualHackMoney: 1, - ScriptHackMoney: 1, - ScriptHackMoneyGain: 1, - CodingContractMoney: 1, - ClassGymExpGain: 1, - CompanyWorkExpGain: 1, - CrimeExpGain: 1, - FactionWorkExpGain: 1, - HackExpGain: 1, - FactionPassiveRepGain: 1, - FactionWorkRepGain: 1, - RepToDonateToFaction: 1, - AugmentationMoneyCost: 1, - AugmentationRepCost: 1, - InfiltrationMoney: 1, - InfiltrationRep: 1, - FourSigmaMarketDataCost: 1, - FourSigmaMarketDataApiCost: 1, - CorporationValuation: 1, - BladeburnerRank: 1, - BladeburnerSkillCost: 1, - DaedalusAugsRequirement: 1, - GangKarmaRequirement: 1, -}; - - -/***/ }), -/* 20 */ -/*!**********************************!*\ - !*** ./src/Server/AllServers.ts ***! - \**********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.loadAllServers = exports.prestigeAllServers = exports.initForeignServers = exports.AddToAllServers = exports.createUniqueRandomIp = exports.ipExists = exports.AllServers = void 0; -const Server_1 = __webpack_require__(/*! ./Server */ 488); -const SpecialServerIps_1 = __webpack_require__(/*! ./SpecialServerIps */ 38); -const servers_1 = __webpack_require__(/*! ./data/servers */ 1060); -const IPAddress_1 = __webpack_require__(/*! ../../utils/IPAddress */ 399); -const getRandomInt_1 = __webpack_require__(/*! ../../utils/helpers/getRandomInt */ 45); -const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); -/** - * Map of all Servers that exist in the game - * Key (string) = IP - * Value = Server object - */ -exports.AllServers = {}; -function ipExists(ip) { - return (exports.AllServers[ip] != null); -} -exports.ipExists = ipExists; -function createUniqueRandomIp() { - const ip = IPAddress_1.createRandomIp(); - // If the Ip already exists, recurse to create a new one - if (ipExists(ip)) { - return IPAddress_1.createRandomIp(); - } - return ip; -} -exports.createUniqueRandomIp = createUniqueRandomIp; -// Saftely add a Server to the AllServers map -function AddToAllServers(server) { - const serverIp = server.ip; - if (ipExists(serverIp)) { - console.warn(`IP of server that's being added: ${serverIp}`); - console.warn(`Hostname of the server thats being added: ${server.hostname}`); - console.warn(`The server that already has this IP is: ${exports.AllServers[serverIp].hostname}`); - throw new Error("Error: Trying to add a server with an existing IP"); - } - exports.AllServers[serverIp] = server; -} -exports.AddToAllServers = AddToAllServers; -function initForeignServers(homeComputer) { - /* Create a randomized network for all the foreign servers */ - //Groupings for creating a randomized network - const networkLayers = []; - for (let i = 0; i < 15; i++) { - networkLayers.push([]); - } - // Essentially any property that is of type 'number | IMinMaxRange' - const propertiesToPatternMatch = [ - "hackDifficulty", - "moneyAvailable", - "requiredHackingSkill", - "serverGrowth", - ]; - const toNumber = (value) => { - switch (typeof value) { - case 'number': - return value; - case 'object': - return getRandomInt_1.getRandomInt(value.min, value.max); - default: - throw Error(`Do not know how to convert the type '${typeof value}' to a number`); - } - }; - for (const metadata of servers_1.serverMetadata) { - const serverParams = { - hostname: metadata.hostname, - ip: createUniqueRandomIp(), - numOpenPortsRequired: metadata.numOpenPortsRequired, - organizationName: metadata.organizationName, - }; - if (metadata.maxRamExponent !== undefined) { - serverParams.maxRam = Math.pow(2, toNumber(metadata.maxRamExponent)); - } - for (const prop of propertiesToPatternMatch) { - if (metadata[prop] !== undefined) { - serverParams[prop] = toNumber(metadata[prop]); - } - } - const server = new Server_1.Server(serverParams); - for (const filename of (metadata.literature || [])) { - server.messages.push(filename); - } - if (metadata.specialName !== undefined) { - SpecialServerIps_1.SpecialServerIps.addIp(metadata.specialName, server.ip); - } - AddToAllServers(server); - if (metadata.networkLayer !== undefined) { - networkLayers[toNumber(metadata.networkLayer) - 1].push(server); - } - } - /* Create a randomized network for all the foreign servers */ - const linkComputers = (server1, server2) => { - server1.serversOnNetwork.push(server2.ip); - server2.serversOnNetwork.push(server1.ip); - }; - const getRandomArrayItem = (arr) => arr[Math.floor(Math.random() * arr.length)]; - const linkNetworkLayers = (network1, selectServer) => { - for (const server of network1) { - linkComputers(server, selectServer()); - } - }; - // Connect the first tier of servers to the player's home computer - linkNetworkLayers(networkLayers[0], () => homeComputer); - for (let i = 1; i < networkLayers.length; i++) { - linkNetworkLayers(networkLayers[i], () => getRandomArrayItem(networkLayers[i - 1])); - } -} -exports.initForeignServers = initForeignServers; -function prestigeAllServers() { - for (const member in exports.AllServers) { - delete exports.AllServers[member]; - } - exports.AllServers = {}; -} -exports.prestigeAllServers = prestigeAllServers; -function loadAllServers(saveString) { - exports.AllServers = JSON.parse(saveString, JSONReviver_1.Reviver); -} -exports.loadAllServers = loadAllServers; - - -/***/ }), -/* 21 */, -/* 22 */ -/*!*************************************!*\ - !*** ./src/Server/ServerHelpers.ts ***! - \*************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isBackdoorInstalled = exports.getServerOnNetwork = exports.getServer = exports.GetServerByHostname = exports.prestigeHomeComputer = exports.processSingleServerGrowth = exports.numCycleForGrowth = exports.safetlyCreateUniqueServer = void 0; -const AllServers_1 = __webpack_require__(/*! ./AllServers */ 20); -const Server_1 = __webpack_require__(/*! ./Server */ 488); -const grow_1 = __webpack_require__(/*! ./formulas/grow */ 522); -const BitNodeMultipliers_1 = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 19); -const Constants_1 = __webpack_require__(/*! ../Constants */ 11); -const Programs_1 = __webpack_require__(/*! ../Programs/Programs */ 30); -const LiteratureNames_1 = __webpack_require__(/*! ../Literature/data/LiteratureNames */ 144); -const isValidNumber_1 = __webpack_require__(/*! ../utils/helpers/isValidNumber */ 1059); -const isValidIPAddress_1 = __webpack_require__(/*! ../../utils/helpers/isValidIPAddress */ 679); -/** - * Constructs a new server, while also ensuring that the new server - * does not have a duplicate hostname/ip. - */ -function safetlyCreateUniqueServer(params) { - if (params.ip != null && AllServers_1.ipExists(params.ip)) { - params.ip = AllServers_1.createUniqueRandomIp(); - } - if (GetServerByHostname(params.hostname) != null) { - // Use a for loop to ensure that we don't get suck in an infinite loop somehow - let hostname = params.hostname; - for (let i = 0; i < 200; ++i) { - hostname = `${params.hostname}-${i}`; - if (GetServerByHostname(hostname) == null) { - break; - } - } - params.hostname = hostname; - } - return new Server_1.Server(params); -} -exports.safetlyCreateUniqueServer = safetlyCreateUniqueServer; -/** - * Returns the number of "growth cycles" needed to grow the specified server by the - * specified amount. - * @param server - Server being grown - * @param growth - How much the server is being grown by, in DECIMAL form (e.g. 1.5 rather than 50) - * @param p - Reference to Player object - * @returns Number of "growth cycles" needed - */ -function numCycleForGrowth(server, growth, p) { - let ajdGrowthRate = 1 + (Constants_1.CONSTANTS.ServerBaseGrowthRate - 1) / server.hackDifficulty; - if (ajdGrowthRate > Constants_1.CONSTANTS.ServerMaxGrowthRate) { - ajdGrowthRate = Constants_1.CONSTANTS.ServerMaxGrowthRate; - } - const serverGrowthPercentage = server.serverGrowth / 100; - const cycles = Math.log(growth) / (Math.log(ajdGrowthRate) * p.hacking_grow_mult * serverGrowthPercentage * BitNodeMultipliers_1.BitNodeMultipliers.ServerGrowthRate); - return cycles; -} -exports.numCycleForGrowth = numCycleForGrowth; -//Applied server growth for a single server. Returns the percentage growth -function processSingleServerGrowth(server, threads, p, cores = 1) { - let serverGrowth = grow_1.calculateServerGrowth(server, threads, p, cores); - if (serverGrowth < 1) { - console.warn("serverGrowth calculated to be less than 1"); - serverGrowth = 1; - } - const oldMoneyAvailable = server.moneyAvailable; - server.moneyAvailable *= serverGrowth; - // in case of data corruption - if (isValidNumber_1.isValidNumber(server.moneyMax) && isNaN(server.moneyAvailable)) { - server.moneyAvailable = server.moneyMax; - } - // cap at max - if (isValidNumber_1.isValidNumber(server.moneyMax) && server.moneyAvailable > server.moneyMax) { - server.moneyAvailable = server.moneyMax; - } - // if there was any growth at all, increase security - if (oldMoneyAvailable !== server.moneyAvailable) { - //Growing increases server security twice as much as hacking - let usedCycles = numCycleForGrowth(server, server.moneyAvailable / oldMoneyAvailable, p); - usedCycles = Math.max(0, usedCycles); - server.fortify(2 * Constants_1.CONSTANTS.ServerFortifyAmount * Math.ceil(usedCycles)); - } - return server.moneyAvailable / oldMoneyAvailable; -} -exports.processSingleServerGrowth = processSingleServerGrowth; -function prestigeHomeComputer(homeComp) { - const hasBitflume = homeComp.programs.includes(Programs_1.Programs.BitFlume.name); - homeComp.programs.length = 0; //Remove programs - homeComp.runningScripts = []; - homeComp.serversOnNetwork = []; - homeComp.isConnectedTo = true; - homeComp.ramUsed = 0; - homeComp.programs.push(Programs_1.Programs.NukeProgram.name); - if (hasBitflume) { - homeComp.programs.push(Programs_1.Programs.BitFlume.name); - } - //Update RAM usage on all scripts - homeComp.scripts.forEach(function (script) { - script.updateRamUsage(homeComp.scripts); - }); - homeComp.messages.length = 0; //Remove .lit and .msg files - homeComp.messages.push(LiteratureNames_1.LiteratureNames.HackersStartingHandbook); -} -exports.prestigeHomeComputer = prestigeHomeComputer; -//Returns server object with corresponding hostname -// Relatively slow, would rather not use this a lot -function GetServerByHostname(hostname) { - for (const ip in AllServers_1.AllServers) { - if (AllServers_1.AllServers.hasOwnProperty(ip)) { - if (AllServers_1.AllServers[ip].hostname == hostname) { - return AllServers_1.AllServers[ip]; - } - } - } - return null; -} -exports.GetServerByHostname = GetServerByHostname; -//Get server by IP or hostname. Returns null if invalid -function getServer(s) { - if (!isValidIPAddress_1.isValidIPAddress(s)) { - return GetServerByHostname(s); - } - if (AllServers_1.AllServers[s] !== undefined) { - return AllServers_1.AllServers[s]; - } - return null; -} -exports.getServer = getServer; -// Returns the i-th server on the specified server's network -// A Server's serverOnNetwork property holds only the IPs. This function returns -// the actual Server object -function getServerOnNetwork(server, i) { - if (i > server.serversOnNetwork.length) { - console.error("Tried to get server on network that was out of range"); - return null; - } - return AllServers_1.AllServers[server.serversOnNetwork[i]]; -} -exports.getServerOnNetwork = getServerOnNetwork; -function isBackdoorInstalled(server) { - if ("backdoorInstalled" in server) { - return server.backdoorInstalled; - } - return false; -} -exports.isBackdoorInstalled = isBackdoorInstalled; - - -/***/ }), -/* 23 */ -/*!****************************************!*\ - !*** ./utils/StringHelperFunctions.ts ***! - \****************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.replaceAt = exports.generateRandomString = exports.isHTML = exports.formatNumber = exports.containsAllStrings = exports.longestCommonStart = exports.convertTimeMsToTimeElapsedString = void 0; -const isString_1 = __webpack_require__(/*! ./helpers/isString */ 72); -// Netburner String helper functions -// Replaces the character at an index with a new character -function replaceAt(base, index, character) { - return base.substr(0, index) + character + base.substr(index + character.length); -} -exports.replaceAt = replaceAt; -/* -Converts a date representing time in milliseconds to a string with the format H hours M minutes and S seconds -e.g. 10000 -> "10 seconds" - 120000 -> "2 minutes and 0 seconds" -*/ -function convertTimeMsToTimeElapsedString(time, showMilli = false) { - time = Math.floor(time); - const millisecondsPerSecond = 1000; - const secondPerMinute = 60; - const minutesPerHours = 60; - const secondPerHours = secondPerMinute * minutesPerHours; - const hoursPerDays = 24; - const secondPerDay = secondPerHours * hoursPerDays; - // Convert ms to seconds, since we only have second-level precision - const totalSeconds = Math.floor(time / millisecondsPerSecond); - const days = Math.floor(totalSeconds / secondPerDay); - const secTruncDays = totalSeconds % secondPerDay; - const hours = Math.floor(secTruncDays / secondPerHours); - const secTruncHours = secTruncDays % secondPerHours; - const minutes = Math.floor(secTruncHours / secondPerMinute); - const secTruncMinutes = secTruncHours % secondPerMinute; - const milliTruncSec = (() => { - let str = `${time % millisecondsPerSecond}`; - while (str.length < 3) - str = "0" + str; - return str; - })(); - const seconds = showMilli ? `${secTruncMinutes}.${milliTruncSec}` : `${secTruncMinutes}`; - let res = ""; - if (days > 0) { - res += `${days} days `; - } - if (hours > 0) { - res += `${hours} hours `; - } - if (minutes > 0) { - res += `${minutes} minutes `; - } - res += `${seconds} seconds`; - return res; -} -exports.convertTimeMsToTimeElapsedString = convertTimeMsToTimeElapsedString; -// Finds the longest common starting substring in a set of strings -function longestCommonStart(strings) { - if (!containsAllStrings(strings)) { - return ""; - } - if (strings.length === 0) { - return ""; - } - const A = strings.concat() - .sort(); - const a1 = A[0]; - const a2 = A[A.length - 1]; - const L = a1.length; - let i = 0; - const areEqualCaseInsensitive = (a, b) => a.toUpperCase() === b.toUpperCase(); - while (i < L && areEqualCaseInsensitive(a1.charAt(i), a2.charAt(i))) { - i++; - } - return a1.substring(0, i); -} -exports.longestCommonStart = longestCommonStart; -// Returns whether an array contains entirely of string objects -function containsAllStrings(arr) { - return arr.every(isString_1.isString); -} -exports.containsAllStrings = containsAllStrings; -// Formats a number with commas and a specific number of decimal digits -function formatNumber(num, numFractionDigits = 0) { - return num.toLocaleString(undefined, { - maximumFractionDigits: numFractionDigits, - minimumFractionDigits: numFractionDigits, - }); -} -exports.formatNumber = formatNumber; -// Checks if a string contains HTML elements -function isHTML(str) { - const element = document.createElement("div"); - element.innerHTML = str; - const c = element.childNodes; - for (let i = c.length - 1; i >= 0; i--) { - if (c[i].nodeType === 1) { - return true; - } - } - return false; -} -exports.isHTML = isHTML; -// Generates a random alphanumeric string with N characters -function generateRandomString(n) { - let str = ""; - const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (let i = 0; i < n; i++) { - str += chars.charAt(Math.floor(Math.random() * chars.length)); - } - return str; -} -exports.generateRandomString = generateRandomString; - - -/***/ }), -/* 24 */ -/*!**********************************!*\ - !*** ./src/Settings/Settings.ts ***! - \**********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Settings = void 0; -const SettingEnums_1 = __webpack_require__(/*! ./SettingEnums */ 222); -const defaultSettings = { - AutosaveInterval: 60, - CodeInstructionRunTime: 50, - DisableASCIIArt: false, - DisableHotkeys: false, - DisableTextEffects: false, - Locale: "en", - MaxLogCapacity: 50, - MaxPortCapacity: 50, - SuppressBuyAugmentationConfirmation: false, - SuppressFactionInvites: false, - SuppressHospitalizationPopup: false, - SuppressMessages: false, - SuppressTravelConfirmation: false, - SuppressBladeburnerPopup: false, -}; -/** - * The current options the player has customized to their play style. - */ -// tslint:disable-next-line:variable-name -exports.Settings = { - AutosaveInterval: defaultSettings.AutosaveInterval, - CodeInstructionRunTime: 25, - DisableASCIIArt: defaultSettings.DisableASCIIArt, - DisableHotkeys: defaultSettings.DisableHotkeys, - DisableTextEffects: defaultSettings.DisableTextEffects, - Locale: "en", - MaxLogCapacity: defaultSettings.MaxLogCapacity, - MaxPortCapacity: defaultSettings.MaxPortCapacity, - OwnedAugmentationsOrder: SettingEnums_1.OwnedAugmentationsOrderSetting.AcquirementTime, - PurchaseAugmentationsOrder: SettingEnums_1.PurchaseAugmentationsOrderSetting.Default, - SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation, - SuppressFactionInvites: defaultSettings.SuppressFactionInvites, - SuppressHospitalizationPopup: defaultSettings.SuppressHospitalizationPopup, - SuppressMessages: defaultSettings.SuppressMessages, - SuppressTravelConfirmation: defaultSettings.SuppressTravelConfirmation, - SuppressBladeburnerPopup: defaultSettings.SuppressBladeburnerPopup, - MonacoTheme: 'vs-dark', - MonacoInsertSpaces: false, - init() { - Object.assign(exports.Settings, defaultSettings); - }, - load(saveString) { - Object.assign(exports.Settings, JSON.parse(saveString)); - }, -}; - - -/***/ }), -/* 25 */ -/*!****************************************!*\ - !*** ./src/Hacknet/HacknetHelpers.jsx ***! - \****************************************/ -/*! exports provided: hasHacknetServers, purchaseHacknet, hasMaxNumberHacknetServers, getCostOfNextHacknetNode, getCostOfNextHacknetServer, getMaxNumberLevelUpgrades, getMaxNumberRamUpgrades, getMaxNumberCoreUpgrades, getMaxNumberCacheUpgrades, purchaseLevelUpgrade, purchaseRamUpgrade, purchaseCoreUpgrade, purchaseCacheUpgrade, renderHacknetNodesUI, clearHacknetNodesUI, processHacknetEarnings, updateHashManagerCapacity, purchaseHashUpgrade */ -/*! exports used: clearHacknetNodesUI, getCostOfNextHacknetNode, getCostOfNextHacknetServer, getMaxNumberCacheUpgrades, getMaxNumberCoreUpgrades, getMaxNumberLevelUpgrades, getMaxNumberRamUpgrades, hasHacknetServers, hasMaxNumberHacknetServers, processHacknetEarnings, purchaseCacheUpgrade, purchaseCoreUpgrade, purchaseHacknet, purchaseHashUpgrade, purchaseLevelUpgrade, purchaseRamUpgrade, renderHacknetNodesUI, updateHashManagerCapacity */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return hasHacknetServers; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return purchaseHacknet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return hasMaxNumberHacknetServers; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCostOfNextHacknetNode; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getCostOfNextHacknetServer; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getMaxNumberLevelUpgrades; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getMaxNumberRamUpgrades; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getMaxNumberCoreUpgrades; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getMaxNumberCacheUpgrades; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return purchaseLevelUpgrade; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return purchaseRamUpgrade; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return purchaseCoreUpgrade; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return purchaseCacheUpgrade; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return renderHacknetNodesUI; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return clearHacknetNodesUI; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return processHacknetEarnings; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return updateHashManagerCapacity; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return purchaseHashUpgrade; }); -/* harmony import */ var _HacknetNode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./HacknetNode */ 535); -/* harmony import */ var _HacknetNode__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_HacknetNode__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formulas/HacknetNodes */ 153); -/* harmony import */ var _formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./formulas/HacknetServers */ 139); -/* harmony import */ var _formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _data_Constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./data/Constants */ 34); -/* harmony import */ var _data_Constants__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_data_Constants__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _HacknetServer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./HacknetServer */ 78); -/* harmony import */ var _HacknetServer__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_HacknetServer__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _HashManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./HashManager */ 177); -/* harmony import */ var _HashManager__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_HashManager__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./HashUpgrades */ 241); -/* harmony import */ var _HashUpgrades__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_HashUpgrades__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../CodingContractGenerator */ 176); -/* harmony import */ var _CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../InteractiveTutorial */ 43); -/* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Player */ 2); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Server/AllServers */ 20); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Server/ServerHelpers */ 22); -/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../SourceFile/SourceFileFlags */ 37); -/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../ui/navigationTracking */ 18); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! react */ 0); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_14__); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! react-dom */ 21); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_15__); -/* harmony import */ var _ui_Root__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./ui/Root */ 449); -/** - * Generic helper/utility functions for the Hacknet mechanic: - * - Purchase nodes/upgrades - * - Calculating maximum number of upgrades - * - Processing Hacknet earnings - * - Updating Hash Manager capacity - * - Purchasing hash upgrades - * - * TODO Should probably split the different types of functions into their own modules - */ - - - - - - - - - - - - - - - - - -let hacknetNodesDiv; - -function hacknetNodesInit() { - hacknetNodesDiv = document.getElementById("hacknet-nodes-container"); - document.removeEventListener("DOMContentLoaded", hacknetNodesInit); -} - -document.addEventListener("DOMContentLoaded", hacknetNodesInit); // Returns a boolean indicating whether the player has Hacknet Servers -// (the upgraded form of Hacknet Nodes) - -function hasHacknetServers() { - return _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].bitNodeN === 9 || _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_12__["SourceFileFlags"][9] > 0; -} -function purchaseHacknet() { - /* INTERACTIVE TUTORIAL */ - if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["ITutorial"].isRunning) { - if (_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["ITutorial"].currStep === _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["iTutorialSteps"].HacknetNodesIntroduction) { - Object(_InteractiveTutorial__WEBPACK_IMPORTED_MODULE_8__["iTutorialNextStep"])(); - } else { - return; - } - } - /* END INTERACTIVE TUTORIAL */ - - - const numOwned = _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length; - - if (hasHacknetServers()) { - const cost = getCostOfNextHacknetServer(); - - if (isNaN(cost)) { - throw new Error(`Calculated cost of purchasing HacknetServer is NaN`); - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { - return -1; - } - - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].createHacknetServer(); - updateHashManagerCapacity(); - return numOwned; - } else { - const cost = getCostOfNextHacknetNode(); - - if (isNaN(cost)) { - throw new Error(`Calculated cost of purchasing HacknetNode is NaN`); - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { - return -1; - } // Auto generate a name for the Node - - - const name = "hacknet-node-" + numOwned; - const node = new _HacknetNode__WEBPACK_IMPORTED_MODULE_0__["HacknetNode"](name, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.push(node); - return numOwned; - } -} -function hasMaxNumberHacknetServers() { - return hasHacknetServers() && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length >= _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxServers; -} -function getCostOfNextHacknetNode() { - return Object(_formulas_HacknetNodes__WEBPACK_IMPORTED_MODULE_1__["calculateNodeCost"])(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_purchase_cost_mult); -} -function getCostOfNextHacknetServer() { - return Object(_formulas_HacknetServers__WEBPACK_IMPORTED_MODULE_2__["calculateServerCost"])(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_purchase_cost_mult); -} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's level - -function getMaxNumberLevelUpgrades(nodeObj, maxLevel) { - if (maxLevel == null) { - throw new Error(`getMaxNumberLevelUpgrades() called without maxLevel arg`); - } - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { - return 0; - } - - let min = 1; - let max = maxLevel - 1; - let levelsToMax = maxLevel - nodeObj.level; - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(levelsToMax, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { - return levelsToMax; - } - - while (min <= max) { - var curr = (min + max) / 2 | 0; - - if (curr !== maxLevel && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult)) && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { - return Math.min(levelsToMax, curr); - } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateLevelUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { - max = curr - 1; - } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateLevelUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult))) { - min = curr + 1; - } else { - return Math.min(levelsToMax, curr); - } - } - - return 0; -} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's RAM - -function getMaxNumberRamUpgrades(nodeObj, maxLevel) { - if (maxLevel == null) { - throw new Error(`getMaxNumberRamUpgrades() called without maxLevel arg`); - } - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateRamUpgradeCost(1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult))) { - return 0; - } - - let levelsToMax; - - if (nodeObj instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]) { - levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.maxRam)); - } else { - levelsToMax = Math.round(Math.log2(maxLevel / nodeObj.ram)); - } - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateRamUpgradeCost(levelsToMax, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult))) { - return levelsToMax; - } //We'll just loop until we find the max - - - for (let i = levelsToMax - 1; i >= 0; --i) { - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateRamUpgradeCost(i, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult))) { - return i; - } - } - - return 0; -} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cores - -function getMaxNumberCoreUpgrades(nodeObj, maxLevel) { - if (maxLevel == null) { - throw new Error(`getMaxNumberCoreUpgrades() called without maxLevel arg`); - } - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateCoreUpgradeCost(1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { - return 0; - } - - let min = 1; - let max = maxLevel - 1; - const levelsToMax = maxLevel - nodeObj.cores; - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateCoreUpgradeCost(levelsToMax, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { - return levelsToMax; - } // Use a binary search to find the max possible number of upgrades - - - while (min <= max) { - let curr = (min + max) / 2 | 0; - - if (curr != maxLevel && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateCoreUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult)) && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateCoreUpgradeCost(curr + 1, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { - return Math.min(levelsToMax, curr); - } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.lt(nodeObj.calculateCoreUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { - max = curr - 1; - } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].money.gt(nodeObj.calculateCoreUpgradeCost(curr, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult))) { - min = curr + 1; - } else { - return Math.min(levelsToMax, curr); - } - } - - return 0; -} // Calculate the maximum number of times the Player can afford to upgrade a Hacknet Node's cache - -function getMaxNumberCacheUpgrades(nodeObj, maxLevel) { - if (maxLevel == null) { - throw new Error(`getMaxNumberCacheUpgrades() called without maxLevel arg`); - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(1))) { - return 0; - } - - let min = 1; - let max = maxLevel - 1; - const levelsToMax = maxLevel - nodeObj.cache; - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(levelsToMax))) { - return levelsToMax; - } // Use a binary search to find the max possible number of upgrades - - - while (min <= max) { - let curr = (min + max) / 2 | 0; - - if (curr != maxLevel && _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr)) && !_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr + 1))) { - return Math.min(levelsToMax, curr); - } else if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr))) { - max = curr - 1; - } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(nodeObj.calculateCacheUpgradeCost(curr))) { - min = curr + 1; - } else { - return Math.min(levelsToMax, curr); - } - } - - return 0; -} -function purchaseLevelUpgrade(node, levels = 1) { - const sanitizedLevels = Math.round(levels); - const cost = node.calculateLevelUpgradeCost(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_level_cost_mult); - - if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { - return false; - } - - const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]; // If we're at max level, return false - - if (node.level >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxLevel)) { - return false; - } // If the number of specified upgrades would exceed the max level, calculate - // the maximum number of upgrades and use that - - - if (node.level + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxLevel)) { - const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxLevel : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxLevel) - node.level); - return purchaseLevelUpgrade(node, diff); - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { - return false; - } - - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); - node.upgradeLevel(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); - return true; -} -function purchaseRamUpgrade(node, levels = 1) { - const sanitizedLevels = Math.round(levels); - const cost = node.calculateRamUpgradeCost(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_ram_cost_mult); - - if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { - return false; - } - - const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]; // Fail if we're already at max - - if (node.ram >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxRam : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxRam)) { - return false; - } // If the number of specified upgrades would exceed the max RAM, calculate the - // max possible number of upgrades and use that - - - if (isServer) { - if (node.maxRam * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxRam) { - const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxRam / node.maxRam))); - return purchaseRamUpgrade(node, diff); - } - } else { - if (node.ram * Math.pow(2, sanitizedLevels) > _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxRam) { - const diff = Math.max(0, Math.log2(Math.round(_data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxRam / node.ram))); - return purchaseRamUpgrade(node, diff); - } - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { - return false; - } - - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); - node.upgradeRam(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); - return true; -} -function purchaseCoreUpgrade(node, levels = 1) { - const sanitizedLevels = Math.round(levels); - const cost = node.calculateCoreUpgradeCost(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_core_cost_mult); - - if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { - return false; - } - - const isServer = node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"]; // Fail if we're already at max - - if (node.cores >= (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxCores)) { - return false; - } // If the specified number of upgrades would exceed the max Cores, calculate - // the max possible number of upgrades and use that - - - if (node.cores + sanitizedLevels > (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxCores)) { - const diff = Math.max(0, (isServer ? _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCores : _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetNodeConstants"].MaxCores) - node.cores); - return purchaseCoreUpgrade(node, diff); - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { - return false; - } - - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); - node.upgradeCore(sanitizedLevels, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); - return true; -} -function purchaseCacheUpgrade(node, levels = 1) { - const sanitizedLevels = Math.round(levels); - const cost = node.calculateCacheUpgradeCost(sanitizedLevels); - - if (isNaN(cost) || cost <= 0 || sanitizedLevels < 0) { - return false; - } - - if (!(node instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"])) { - console.warn(`purchaseCacheUpgrade() called for a non-HacknetNode`); - return false; - } // Fail if we're already at max - - - if (node.cache + sanitizedLevels > _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCache) { - const diff = Math.max(0, _data_Constants__WEBPACK_IMPORTED_MODULE_3__["HacknetServerConstants"].MaxCache - node.cache); - return purchaseCacheUpgrade(node, diff); - } - - if (!_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].canAfford(cost)) { - return false; - } - - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].loseMoney(cost); - node.upgradeCache(sanitizedLevels); - return true; -} // Create/Refresh Hacknet Nodes UI - -function renderHacknetNodesUI() { - if (!_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_13__["Page"].HacknetNodes)) { - return; - } - - react_dom__WEBPACK_IMPORTED_MODULE_15___default.a.render(react__WEBPACK_IMPORTED_MODULE_14___default.a.createElement(_ui_Root__WEBPACK_IMPORTED_MODULE_16__[/* HacknetRoot */ "a"], null), hacknetNodesDiv); -} -function clearHacknetNodesUI() { - if (hacknetNodesDiv instanceof HTMLElement) { - react_dom__WEBPACK_IMPORTED_MODULE_15___default.a.unmountComponentAtNode(hacknetNodesDiv); - } - - hacknetNodesDiv.style.display = "none"; -} -function processHacknetEarnings(numCycles) { - // Determine if player has Hacknet Nodes or Hacknet Servers, then - // call the appropriate function - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length === 0) { - return 0; - } - - if (hasHacknetServers()) { - return processAllHacknetServerEarnings(numCycles); - } else if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes[0] instanceof _HacknetNode__WEBPACK_IMPORTED_MODULE_0__["HacknetNode"]) { - return processAllHacknetNodeEarnings(numCycles); - } else { - return 0; - } -} - -function processAllHacknetNodeEarnings(numCycles) { - let total = 0; - - for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length; ++i) { - total += processSingleHacknetNodeEarnings(numCycles, _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes[i]); - } - - return total; -} - -function processSingleHacknetNodeEarnings(numCycles, nodeObj) { - const totalEarnings = nodeObj.process(numCycles); - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].gainMoney(totalEarnings); - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].recordMoneySource(totalEarnings, "hacknetnode"); - return totalEarnings; -} - -function processAllHacknetServerEarnings(numCycles) { - if (!(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__["HashManager"])) { - throw new Error(`Player does not have a HashManager (should be in 'hashManager' prop)`); - } - - let hashes = 0; - - for (let i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes.length; ++i) { - // hacknetNodes array only contains the IP addresses of the servers. - // Also, update the hash rate before processing - const hserver = _Server_AllServers__WEBPACK_IMPORTED_MODULE_10__["AllServers"][_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes[i]]; - hserver.updateHashRate(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknet_node_money_mult); - const h = hserver.process(numCycles); - hserver.totalHashesGenerated += h; - hashes += h; - } - - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.storeHashes(hashes); - return hashes; -} - -function updateHashManagerCapacity() { - if (!(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__["HashManager"])) { - console.error(`Player does not have a HashManager`); - return; - } - - const nodes = _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hacknetNodes; - - if (nodes.length === 0) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(0); - return; - } - - let total = 0; - - for (let i = 0; i < nodes.length; ++i) { - if (typeof nodes[i] !== "string") { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(0); - return; - } - - const h = _Server_AllServers__WEBPACK_IMPORTED_MODULE_10__["AllServers"][nodes[i]]; - - if (!(h instanceof _HacknetServer__WEBPACK_IMPORTED_MODULE_4__["HacknetServer"])) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(0); - return; - } - - total += h.hashCapacity; - } - - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.updateCapacity(total); -} -function purchaseHashUpgrade(upgName, upgTarget) { - if (!(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager instanceof _HashManager__WEBPACK_IMPORTED_MODULE_5__["HashManager"])) { - console.error(`Player does not have a HashManager`); - return false; - } // HashManager handles the transaction. This just needs to actually implement - // the effects of the upgrade - - - if (_Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.upgrade(upgName)) { - const upg = _HashUpgrades__WEBPACK_IMPORTED_MODULE_6__["HashUpgrades"][upgName]; - - switch (upgName) { - case "Sell for Money": - { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].gainMoney(upg.value); - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].recordMoneySource(upg.value, "hacknetnode"); - break; - } - - case "Sell for Corporation Funds": - { - // This will throw if player doesn't have a corporation - try { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].corporation.funds = _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].corporation.funds.plus(upg.value); - } catch (e) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); - return false; - } - - break; - } - - case "Reduce Minimum Security": - { - try { - const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__["GetServerByHostname"])(upgTarget); - - if (target == null) { - console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`); - return false; - } - - target.changeMinimumSecurity(upg.value, true); - } catch (e) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); - return false; - } - - break; - } - - case "Increase Maximum Money": - { - try { - const target = Object(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_11__["GetServerByHostname"])(upgTarget); - - if (target == null) { - console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`); - return false; - } - - target.changeMaximumMoney(upg.value, true); - } catch (e) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); - return false; - } - - break; - } - - case "Improve Studying": - { - // Multiplier handled by HashManager - break; - } - - case "Improve Gym Training": - { - // Multiplier handled by HashManager - break; - } - - case "Exchange for Corporation Research": - { - // This will throw if player doesn't have a corporation - try { - for (const division of _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].corporation.divisions) { - division.sciResearch.qty += upg.value; - } - } catch (e) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); - return false; - } - - break; - } - - case "Exchange for Bladeburner Rank": - { - // This will throw if player isnt in Bladeburner - try { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].bladeburner.changeRank(_Player__WEBPACK_IMPORTED_MODULE_9__["Player"], upg.value); - } catch (e) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); - return false; - } - - break; - } - - case "Exchange for Bladeburner SP": - { - // This will throw if player isn't in Bladeburner - try { - // As long as we don't change `Bladeburner.totalSkillPoints`, this - // shouldn't affect anything else - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].bladeburner.skillPoints += upg.value; - } catch (e) { - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); - return false; - } - - break; - } - - case "Generate Coding Contract": - { - Object(_CodingContractGenerator__WEBPACK_IMPORTED_MODULE_7__["generateRandomContract"])(); - break; - } - - default: - console.warn(`Unrecognized upgrade name ${upgName}. Upgrade has no effect`); - _Player__WEBPACK_IMPORTED_MODULE_9__["Player"].hashManager.refundUpgrade(upgName); - return false; - } - - return true; - } - - return false; -} - -/***/ }), -/* 26 */, -/* 27 */ -/*!********************************!*\ - !*** ./src/ui/React/Money.tsx ***! - \********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Money = void 0; -const React = __importStar(__webpack_require__(/*! react */ 0)); -const numeralFormat_1 = __webpack_require__(/*! ../../ui/numeralFormat */ 7); -function Money(money) { - return React.createElement("span", { className: "money-gold samefont" }, typeof money === 'number' ? numeralFormat_1.numeralWrapper.formatMoney(money) : money); -} -exports.Money = Money; - - -/***/ }), -/* 28 */, -/* 29 */ -/*!******************************!*\ - !*** ./utils/JSONReviver.js ***! - \******************************/ -/*! exports provided: Reviver, Generic_toJSON, Generic_fromJSON */ -/*! all exports used */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reviver", function() { return Reviver; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Generic_toJSON", function() { return Generic_toJSON; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Generic_fromJSON", function() { return Generic_fromJSON; }); -/* Generic Reviver, toJSON, and fromJSON functions used for saving and loading objects */ - -// A generic "smart reviver" function. -// Looks for object values with a `ctor` property and -// a `data` property. If it finds them, and finds a matching -// constructor that has a `fromJSON` property on it, it hands -// off to that `fromJSON` fuunction, passing in the value. -function Reviver(key, value) { - var ctor; - if (value == null) { - console.log("Reviver WRONGLY called with key: " + key + ", and value: " + value); - return 0; - } - - if (typeof value === "object" && - typeof value.ctor === "string" && - typeof value.data !== "undefined") { - // Compatibility for version v0.43.1 - // TODO Remove this eventually - if (value.ctor === "AllServersMap") { - console.log('Converting AllServersMap for v0.43.1'); - return value.data; - } - - ctor = Reviver.constructors[value.ctor] || window[value.ctor]; - - if (typeof ctor === "function" && - typeof ctor.fromJSON === "function") { - - return ctor.fromJSON(value); - } - } - return value; -} -Reviver.constructors = {}; // A list of constructors the smart reviver should know about - -// A generic "toJSON" function that creates the data expected -// by Reviver. -// `ctorName` The name of the constructor to use to revive it -// `obj` The object being serialized -// `keys` (Optional) Array of the properties to serialize, -// if not given then all of the objects "own" properties -// that don't have function values will be serialized. -// (Note: If you list a property in `keys`, it will be serialized -// regardless of whether it's an "own" property.) -// Returns: The structure (which will then be turned into a string -// as part of the JSON.stringify algorithm) -function Generic_toJSON(ctorName, obj, keys) { - var data, key; - - if (!keys) { - keys = Object.keys(obj); // Only "own" properties are included - } - - data = {}; - for (let index = 0; index < keys.length; ++index) { - key = keys[index]; - data[key] = obj[key]; - } - return {ctor: ctorName, data: data}; -} - -// A generic "fromJSON" function for use with Reviver: Just calls the -// constructor function with no arguments, then applies all of the -// key/value pairs from the raw data to the instance. Only useful for -// constructors that can be reasonably called without arguments! -// `ctor` The constructor to call -// `data` The data to apply -// Returns: The object -function Generic_fromJSON(ctor, data) { - var obj, name; - - obj = new ctor(); - for (name in data) { - obj[name] = data[name]; - } - return obj; -} - - - - -/***/ }), -/* 30 */ -/*!**********************************!*\ - !*** ./src/Programs/Programs.ts ***! - \**********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Programs = void 0; -const Program_1 = __webpack_require__(/*! ./Program */ 1082); -const ProgramsMetadata_1 = __webpack_require__(/*! ./data/ProgramsMetadata */ 1081); -exports.Programs = {}; -for (const params of ProgramsMetadata_1.programsMetadata) { - exports.Programs[params.key] = new Program_1.Program(params.name, params.create); -} - - -/***/ }), -/* 31 */ -/*!**********************************!*\ - !*** ./src/ui/MainMenu/Links.ts ***! - \**********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.initializeMainMenuLinks = exports.MainMenuLinks = void 0; -// Get references to the Main Menu link DOM elements -// Does NOT include collapsible headers for the links -const clearEventListeners_1 = __webpack_require__(/*! ../../../utils/uiHelpers/clearEventListeners */ 49); -const emptyElement = (() => { - const elem = document.createElement('div'); - if (elem === null) - throw new Error("unable to create empty div element"); - return elem; -})(); -exports.MainMenuLinks = { - Terminal: emptyElement, - ScriptEditor: emptyElement, - ActiveScripts: emptyElement, - CreateProgram: emptyElement, - Stats: emptyElement, - Factions: emptyElement, - Augmentations: emptyElement, - HacknetNodes: emptyElement, - Sleeves: emptyElement, - City: emptyElement, - Travel: emptyElement, - Job: emptyElement, - StockMarket: emptyElement, - Bladeburner: emptyElement, - Corporation: emptyElement, - Gang: emptyElement, - Milestones: emptyElement, - Tutorial: emptyElement, - Options: emptyElement, - DevMenu: emptyElement, -}; -function initializeMainMenuLinks() { - try { - function safeGetLink(id) { - const elem = clearEventListeners_1.clearEventListeners(id); - if (elem == null) { - throw new Error(`clearEventListeners() failed for element with id: ${id}`); - } - return elem; - } - exports.MainMenuLinks.Terminal = safeGetLink("terminal-menu-link"); - exports.MainMenuLinks.ScriptEditor = safeGetLink("create-script-menu-link"); - exports.MainMenuLinks.ActiveScripts = safeGetLink("active-scripts-menu-link"); - exports.MainMenuLinks.CreateProgram = safeGetLink("create-program-menu-link"); - exports.MainMenuLinks.Stats = safeGetLink("stats-menu-link"); - exports.MainMenuLinks.Factions = safeGetLink("factions-menu-link"); - exports.MainMenuLinks.Augmentations = safeGetLink("augmentations-menu-link"); - exports.MainMenuLinks.HacknetNodes = safeGetLink("hacknet-nodes-menu-link"); - exports.MainMenuLinks.Sleeves = safeGetLink("sleeves-menu-link"); - exports.MainMenuLinks.City = safeGetLink("city-menu-link"); - exports.MainMenuLinks.Travel = safeGetLink("travel-menu-link"); - exports.MainMenuLinks.Job = safeGetLink("job-menu-link"); - exports.MainMenuLinks.StockMarket = safeGetLink("stock-market-menu-link"); - exports.MainMenuLinks.Bladeburner = safeGetLink("bladeburner-menu-link"); - exports.MainMenuLinks.Corporation = safeGetLink("corporation-menu-link"); - exports.MainMenuLinks.Gang = safeGetLink("gang-menu-link"); - exports.MainMenuLinks.Milestones = safeGetLink("milestones-menu-link"); - exports.MainMenuLinks.Tutorial = safeGetLink("tutorial-menu-link"); - const op = document.getElementById("options-menu-link"); - if (op === null) - throw new Error(`Could not find element with id: "options-menu-link"`); - exports.MainMenuLinks.Options = op; // This click listener is already set, so don't clear it - exports.MainMenuLinks.DevMenu = safeGetLink("dev-menu-link"); - return true; - } - catch (e) { - console.error(`Failed to initialize Main Menu Links: ${e}`); - return false; - } -} -exports.initializeMainMenuLinks = initializeMainMenuLinks; - - -/***/ }), -/* 32 */, -/* 33 */ -/*!**********************************!*\ - !*** ./src/Company/Companies.ts ***! - \**********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.companyExists = exports.loadCompanies = exports.initCompanies = exports.Companies = void 0; -// Constructs all CompanyPosition objects using the metadata in data/companypositions.ts -const CompaniesMetadata_1 = __webpack_require__(/*! ./data/CompaniesMetadata */ 1083); -const Company_1 = __webpack_require__(/*! ./Company */ 138); -const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); -exports.Companies = {}; -function addCompany(params) { - if (exports.Companies[params.name] != null) { - console.warn(`Duplicate Company Position being defined: ${params.name}`); - } - exports.Companies[params.name] = new Company_1.Company(params); -} -// Used to initialize new Company objects for the Companies map -// Called when creating new game or after a prestige/reset -function initCompanies() { - // Save Old Company data for 'favor' - const oldCompanies = exports.Companies; - // Re-construct all Companies - exports.Companies = {}; - CompaniesMetadata_1.companiesMetadata.forEach((e) => { - addCompany(e); - }); - // Reset data - for (const companyName in exports.Companies) { - const company = exports.Companies[companyName]; - const oldCompany = oldCompanies[companyName]; - if (!(oldCompany instanceof Company_1.Company)) { - // New game, so no OldCompanies data - company.favor = 0; - } - else { - company.favor = oldCompanies[companyName].favor; - if (isNaN(company.favor)) { - company.favor = 0; - } - } - } -} -exports.initCompanies = initCompanies; -// Used to load Companies map from a save -function loadCompanies(saveString) { - exports.Companies = JSON.parse(saveString, JSONReviver_1.Reviver); -} -exports.loadCompanies = loadCompanies; -// Utility function to check if a string is valid company name -function companyExists(name) { - return exports.Companies.hasOwnProperty(name); -} -exports.companyExists = companyExists; - - -/***/ }), -/* 34 */ -/*!***************************************!*\ - !*** ./src/Hacknet/data/Constants.ts ***! - \***************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HacknetServerConstants = exports.HacknetNodeConstants = void 0; -exports.HacknetNodeConstants = { - MoneyGainPerLevel: 1.6, - BaseCost: 1000, - LevelBaseCost: 1, - RamBaseCost: 30e3, - CoreBaseCost: 500e3, - PurchaseNextMult: 1.85, - UpgradeLevelMult: 1.04, - UpgradeRamMult: 1.28, - UpgradeCoreMult: 1.48, - MaxLevel: 200, - MaxRam: 64, - MaxCores: 16, -}; -exports.HacknetServerConstants = { - HashesPerLevel: 0.001, - BaseCost: 50e3, - RamBaseCost: 200e3, - CoreBaseCost: 1e6, - CacheBaseCost: 10e6, - PurchaseMult: 3.20, - UpgradeLevelMult: 1.10, - UpgradeRamMult: 1.40, - UpgradeCoreMult: 1.55, - UpgradeCacheMult: 1.85, - MaxServers: 20, - MaxLevel: 300, - MaxRam: 8192, - MaxCores: 128, - MaxCache: 15, -}; - - -/***/ }), -/* 35 */, -/* 36 */, -/* 37 */ -/*!*******************************************!*\ - !*** ./src/SourceFile/SourceFileFlags.ts ***! - \*******************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// Contains an array containing information about the player's source files -// Array[n] returns what level the player has of Source-File N. -Object.defineProperty(exports, "__esModule", { value: true }); -exports.updateSourceFileFlags = exports.SourceFileFlags = void 0; -const Constants_1 = __webpack_require__(/*! ../Constants */ 11); -exports.SourceFileFlags = Array(Constants_1.CONSTANTS.TotalNumBitNodes + 1); // Skip index 0 -function updateSourceFileFlags(p) { - for (let i = 0; i < exports.SourceFileFlags.length; ++i) { - exports.SourceFileFlags[i] = 0; - } - for (let i = 0; i < p.sourceFiles.length; ++i) { - const sf = p.sourceFiles[i]; - exports.SourceFileFlags[sf.n] = sf.lvl; - } -} -exports.updateSourceFileFlags = updateSourceFileFlags; - - -/***/ }), -/* 38 */ -/*!****************************************!*\ - !*** ./src/Server/SpecialServerIps.ts ***! - \****************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.initSpecialServerIps = exports.loadSpecialServerIps = exports.prestigeSpecialServerIps = exports.SpecialServerIps = exports.SpecialServerIpsMap = exports.SpecialServerNames = void 0; -const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); -/* Holds IP of Special Servers */ -exports.SpecialServerNames = { - FulcrumSecretTechnologies: "Fulcrum Secret Technologies Server", - CyberSecServer: "CyberSec Server", - NiteSecServer: "NiteSec Server", - TheBlackHandServer: "The Black Hand Server", - BitRunnersServer: "BitRunners Server", - TheDarkArmyServer: "The Dark Army Server", - DaedalusServer: "Daedalus Server", - WorldDaemon: "w0r1d_d43m0n", -}; -class SpecialServerIpsMap { - addIp(name, ip) { - this[name] = ip; - } - getIp(name) { - return this[name]; - } - // Serialize the current object to a JSON save state - toJSON() { - return JSONReviver_1.Generic_toJSON("SpecialServerIpsMap", this); - } - // Initializes a SpecialServerIpsMap Object from a JSON save state - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - static fromJSON(value) { - return JSONReviver_1.Generic_fromJSON(SpecialServerIpsMap, value.data); - } -} -exports.SpecialServerIpsMap = SpecialServerIpsMap; -JSONReviver_1.Reviver.constructors.SpecialServerIpsMap = SpecialServerIpsMap; -exports.SpecialServerIps = new SpecialServerIpsMap(); -function prestigeSpecialServerIps() { - for (const member in exports.SpecialServerIps) { - delete exports.SpecialServerIps[member]; - } - exports.SpecialServerIps = new SpecialServerIpsMap(); -} -exports.prestigeSpecialServerIps = prestigeSpecialServerIps; -function loadSpecialServerIps(saveString) { - exports.SpecialServerIps = JSON.parse(saveString, JSONReviver_1.Reviver); -} -exports.loadSpecialServerIps = loadSpecialServerIps; -function initSpecialServerIps() { - exports.SpecialServerIps = new SpecialServerIpsMap(); -} -exports.initSpecialServerIps = initSpecialServerIps; - - -/***/ }), -/* 39 */ -/*!************************************!*\ - !*** ./src/Fconf/FconfSettings.ts ***! - \************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.FconfSettings = void 0; -exports.FconfSettings = { - ENABLE_BASH_HOTKEYS: false, - ENABLE_TIMESTAMPS: false, - MAIN_MENU_STYLE: "default", - THEME_BACKGROUND_COLOR: "#000000", - THEME_FONT_COLOR: "#66ff33", - THEME_HIGHLIGHT_COLOR: "#ffffff", - THEME_PROMPT_COLOR: "#f92672", - WRAP_INPUT: false, -}; - - -/***/ }), -/* 40 */ -/*!*********************************************!*\ - !*** ./src/Locations/data/LocationNames.ts ***! - \*********************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LocationName = void 0; -/** - * Names of all locations - */ -var LocationName; -(function (LocationName) { - // Cities - LocationName["Aevum"] = "Aevum"; - LocationName["Chongqing"] = "Chongqing"; - LocationName["Ishima"] = "Ishima"; - LocationName["NewTokyo"] = "New Tokyo"; - LocationName["Sector12"] = "Sector-12"; - LocationName["Volhaven"] = "Volhaven"; - // Aevum Locations - LocationName["AevumAeroCorp"] = "AeroCorp"; - LocationName["AevumBachmanAndAssociates"] = "Bachman & Associates"; - LocationName["AevumClarkeIncorporated"] = "Clarke Incorporated"; - LocationName["AevumCrushFitnessGym"] = "Crush Fitness Gym"; - LocationName["AevumECorp"] = "ECorp"; - LocationName["AevumFulcrumTechnologies"] = "Fulcrum Technologies"; - LocationName["AevumGalacticCybersystems"] = "Galactic Cybersystems"; - LocationName["AevumNetLinkTechnologies"] = "NetLink Technologies"; - LocationName["AevumPolice"] = "Aevum Police Headquarters"; - LocationName["AevumRhoConstruction"] = "Rho Construction"; - LocationName["AevumSnapFitnessGym"] = "Snap Fitness Gym"; - LocationName["AevumSummitUniversity"] = "Summit University"; - LocationName["AevumWatchdogSecurity"] = "Watchdog Security"; - LocationName["AevumCasino"] = "Iker Molina Casino"; - // Chongqing locations - LocationName["ChongqingKuaiGongInternational"] = "KuaiGong International"; - LocationName["ChongqingSolarisSpaceSystems"] = "Solaris Space Systems"; - // Sector 12 - LocationName["Sector12AlphaEnterprises"] = "Alpha Enterprises"; - LocationName["Sector12BladeIndustries"] = "Blade Industries"; - LocationName["Sector12CIA"] = "Central Intelligence Agency"; - LocationName["Sector12CarmichaelSecurity"] = "Carmichael Security"; - LocationName["Sector12CityHall"] = "Sector-12 City Hall"; - LocationName["Sector12DeltaOne"] = "DeltaOne"; - LocationName["Sector12FoodNStuff"] = "FoodNStuff"; - LocationName["Sector12FourSigma"] = "Four Sigma"; - LocationName["Sector12IcarusMicrosystems"] = "Icarus Microsystems"; - LocationName["Sector12IronGym"] = "Iron Gym"; - LocationName["Sector12JoesGuns"] = "Joe's Guns"; - LocationName["Sector12MegaCorp"] = "MegaCorp"; - LocationName["Sector12NSA"] = "National Security Agency"; - LocationName["Sector12PowerhouseGym"] = "Powerhouse Gym"; - LocationName["Sector12RothmanUniversity"] = "Rothman University"; - LocationName["Sector12UniversalEnergy"] = "Universal Energy"; - // New Tokyo - LocationName["NewTokyoDefComm"] = "DefComm"; - LocationName["NewTokyoGlobalPharmaceuticals"] = "Global Pharmaceuticals"; - LocationName["NewTokyoNoodleBar"] = "Noodle Bar"; - LocationName["NewTokyoVitaLife"] = "VitaLife"; - // Ishima - LocationName["IshimaNovaMedical"] = "Nova Medical"; - LocationName["IshimaOmegaSoftware"] = "Omega Software"; - LocationName["IshimaStormTechnologies"] = "Storm Technologies"; - // Volhaven - LocationName["VolhavenCompuTek"] = "CompuTek"; - LocationName["VolhavenHeliosLabs"] = "Helios Labs"; - LocationName["VolhavenLexoCorp"] = "LexoCorp"; - LocationName["VolhavenMilleniumFitnessGym"] = "Millenium Fitness Gym"; - LocationName["VolhavenNWO"] = "NWO"; - LocationName["VolhavenOmniTekIncorporated"] = "OmniTek Incorporated"; - LocationName["VolhavenOmniaCybersystems"] = "Omnia Cybersystems"; - LocationName["VolhavenSysCoreSecurities"] = "SysCore Securities"; - LocationName["VolhavenZBInstituteOfTechnology"] = "ZB Institute of Technology"; - // Generic locations - LocationName["Hospital"] = "Hospital"; - LocationName["Slums"] = "The Slums"; - LocationName["TravelAgency"] = "Travel Agency"; - LocationName["WorldStockExchange"] = "World Stock Exchange"; - // Default name for Location objects - LocationName["Void"] = "The Void"; -})(LocationName = exports.LocationName || (exports.LocationName = {})); - - -/***/ }), -/* 41 */ -/*!**************************************!*\ - !*** ./src/ui/React/createPopup.tsx ***! - \**************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.removePopup = exports.createPopup = void 0; -/** - * Create a pop-up dialog box using React. - * - * Calling this function with the same ID and React Root Component will trigger a re-render - * - * @param id The (hopefully) unique identifier for the popup container - * @param rootComponent Root React Component for the content (NOT the popup containers themselves) - */ -const React = __importStar(__webpack_require__(/*! react */ 0)); -const ReactDOM = __importStar(__webpack_require__(/*! react-dom */ 21)); -const Popup_1 = __webpack_require__(/*! ./Popup */ 1136); -const createElement_1 = __webpack_require__(/*! ../../../utils/uiHelpers/createElement */ 51); -const removeElementById_1 = __webpack_require__(/*! ../../../utils/uiHelpers/removeElementById */ 90); -let gameContainer; -(function () { - function getGameContainer() { - const container = document.getElementById("entire-game-container"); - if (container == null) { - throw new Error(`Failed to find game container DOM element`); - } - gameContainer = container; - document.removeEventListener("DOMContentLoaded", getGameContainer); - } - document.addEventListener("DOMContentLoaded", getGameContainer); -})(); -// This variable is used to avoid setting the semi-transparent background -// several times on top of one another. Sometimes there's several popup at once. -let deepestPopupId = ""; -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -function createPopup(id, rootComponent, props) { - let container = document.getElementById(id); - if (container == null) { - function onClick(event) { - if (!event.srcElement) - return; - if (!(event.srcElement instanceof HTMLElement)) - return; - const clickedId = event.srcElement.id; - if (clickedId !== id) - return; - removePopup(id); - } - const backgroundColor = deepestPopupId === "" ? 'rgba(0,0,0,0.5)' : 'rgba(0,0,0,0)'; - container = createElement_1.createElement("div", { - class: "popup-box-container", - display: "flex", - id: id, - backgroundColor: backgroundColor, - clickListener: onClick, - }); - gameContainer.appendChild(container); - } - if (deepestPopupId === "") - deepestPopupId = id; - ReactDOM.render(React.createElement(Popup_1.Popup, { content: rootComponent, id: id, props: props, removePopup: removePopup }), container); - return container; -} -exports.createPopup = createPopup; -/** - * Closes a popup created with the createPopup() function above - */ -function removePopup(id) { - const content = document.getElementById(`${id}`); - if (content == null) - return; - ReactDOM.unmountComponentAtNode(content); - removeElementById_1.removeElementById(id); - removeElementById_1.removeElementById(`${id}-close`); - if (id === deepestPopupId) - deepestPopupId = ""; -} -exports.removePopup = removePopup; - - -/***/ }), -/* 42 */ -/*!*****************************************!*\ - !*** ./src/Locations/data/CityNames.ts ***! - \*****************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CityName = void 0; -/** - * All possible Cities in the game. Names only, not actual "City" object - * Implemented as an enum for typing purposes - */ -var CityName; -(function (CityName) { - CityName["Aevum"] = "Aevum"; - CityName["Chongqing"] = "Chongqing"; - CityName["Ishima"] = "Ishima"; - CityName["NewTokyo"] = "New Tokyo"; - CityName["Sector12"] = "Sector-12"; - CityName["Volhaven"] = "Volhaven"; -})(CityName = exports.CityName || (exports.CityName = {})); - - -/***/ }), -/* 43 */ -/*!************************************!*\ - !*** ./src/InteractiveTutorial.js ***! - \************************************/ -/*! exports provided: iTutorialSteps, iTutorialEnd, iTutorialStart, iTutorialNextStep, ITutorial */ -/*! all exports used */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialSteps", function() { return iTutorialSteps; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialEnd", function() { return iTutorialEnd; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialStart", function() { return iTutorialStart; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iTutorialNextStep", function() { return iTutorialNextStep; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ITutorial", function() { return ITutorial; }); -/* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./engine */ 15); -/* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Player */ 2); -/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Settings/Settings */ 24); -/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Settings_Settings__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ui/MainMenu/Links */ 31); -/* harmony import */ var _ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Literature/data/LiteratureNames */ 144); -/* harmony import */ var _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__); -/* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/helpers/exceptionAlert */ 91); -/* harmony import */ var _utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/uiHelpers/clearEventListeners */ 49); -/* harmony import */ var _utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../utils/uiHelpers/createElement */ 51); -/* harmony import */ var _utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../utils/uiHelpers/createPopup */ 129); -/* harmony import */ var _utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/uiHelpers/removeElementById */ 90); -/* harmony import */ var _utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9__); - - - - - - - - - - - - - -// Ordered array of keys to Interactive Tutorial Steps -const orderedITutorialSteps = [ - "Start", - "GoToCharacterPage", // Click on 'Stats' page - "CharacterPage", // Introduction to 'Stats' page - "CharacterGoToTerminalPage", // Go back to Terminal - "TerminalIntro", // Introduction to Terminal - "TerminalHelp", // Using 'help' Terminal command - "TerminalLs", // Using 'ls' Terminal command - "TerminalScan", // Using 'scan' Terminal command - "TerminalScanAnalyze1", // Using 'scan-analyze' Terminal command - "TerminalScanAnalyze2", // Using 'scan-analyze 3' Terminal command - "TerminalConnect", // Connecting to n00dles - "TerminalAnalyze", // Analyzing n00dles - "TerminalNuke", // NUKE n00dles - "TerminalManualHack", // Hack n00dles - "TerminalHackingMechanics", // Explanation of hacking mechanics - "TerminalCreateScript", // Create a script using 'nano' - "TerminalTypeScript", // Script Editor page - Type script and then save & close - "TerminalFree", // Using 'Free' Terminal command - "TerminalRunScript", // Running script using 'run' Terminal command - "TerminalGoToActiveScriptsPage", - "ActiveScriptsPage", - "ActiveScriptsToTerminal", - "TerminalTailScript", - "GoToHacknetNodesPage", - "HacknetNodesIntroduction", - "HacknetNodesGoToWorldPage", - "WorldDescription", - "TutorialPageInfo", - "End", -] - -// Create an 'enum' for the Steps -const iTutorialSteps = {}; -for (let i = 0; i < orderedITutorialSteps.length; ++i) { - iTutorialSteps[orderedITutorialSteps[i]] = i; -} - -const ITutorial = { - currStep: 0, // iTutorialSteps.Start - isRunning: false, - - // Keeps track of whether each step has been done - stepIsDone: {}, -} - -function iTutorialStart() { - // Initialize Interactive Tutorial state by settings 'done' for each state to false - ITutorial.stepIsDone = {}; - for (let i = 0; i < orderedITutorialSteps.length; ++i) { - ITutorial.stepIsDone[i] = false; - } - - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - - // Don't autosave during this interactive tutorial - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].Counters.autoSaveCounter = Infinity; - ITutorial.currStep = 0; - ITutorial.isRunning = true; - - document.getElementById("interactive-tutorial-container").style.display = "block"; - - // Exit tutorial button - const exitButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("interactive-tutorial-exit"); - exitButton.addEventListener("click", function() { - iTutorialEnd(); - return false; - }); - - // Back button - const backButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("interactive-tutorial-back"); - backButton.addEventListener("click", function() { - iTutorialPrevStep(); - return false; - }); - - // Next button - const nextButton = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("interactive-tutorial-next"); - nextButton.addEventListener("click", function() { - iTutorialNextStep(); - return false; - }); - - iTutorialEvaluateStep(); -} - -function iTutorialEvaluateStep() { - if (!ITutorial.isRunning) {return;} - - // Disable and clear main menu - const terminalMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("terminal-menu-link"); - const statsMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("stats-menu-link"); - const activeScriptsMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("active-scripts-menu-link"); - const hacknetMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("hacknet-nodes-menu-link"); - const cityMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("city-menu-link"); - const tutorialMainMenu = Object(_utils_uiHelpers_clearEventListeners__WEBPACK_IMPORTED_MODULE_6__["clearEventListeners"])("tutorial-menu-link"); - terminalMainMenu.removeAttribute("class"); - statsMainMenu.removeAttribute("class"); - activeScriptsMainMenu.removeAttribute("class"); - hacknetMainMenu.removeAttribute("class"); - cityMainMenu.removeAttribute("class"); - tutorialMainMenu.removeAttribute("class"); - - // Interactive Tutorial Next button - const nextBtn = document.getElementById("interactive-tutorial-next"); - - switch(ITutorial.currStep) { - case iTutorialSteps.Start: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Welcome to Bitburner, a cyberpunk-themed incremental RPG! " + - "The game takes place in a dark, dystopian future... The year is 2077...

" + - "This tutorial will show you the basics of the game. " + - "You may skip the tutorial at any time."); - nextBtn.style.display = "inline-block"; - break; - case iTutorialSteps.GoToCharacterPage: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Let's start by heading to the Stats page. Click the Stats tab on " + - "the main navigation menu (left-hand side of the screen)"); - nextBtn.style.display = "none"; - - // Flash 'Stats' menu and set its tutorial click handler - statsMainMenu.setAttribute("class", "flashing-button"); - statsMainMenu.addEventListener("click", function() { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadCharacterContent(); - iTutorialNextStep(); //Opening the character page will go to the next step - return false; - }); - break; - case iTutorialSteps.CharacterPage: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadCharacterContent(); - iTutorialSetText("The Stats page shows a lot of important information about your progress, " + - "such as your skills, money, and bonuses. ") - nextBtn.style.display = "inline-block"; - break; - case iTutorialSteps.CharacterGoToTerminalPage: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadCharacterContent(); - iTutorialSetText("Let's head to your computer's terminal by clicking the Terminal tab on the " + - "main navigation menu."); - nextBtn.style.display = "none"; - - // Flash 'Terminal' menu and set its tutorial click handler - terminalMainMenu.setAttribute("class", "flashing-button"); - terminalMainMenu.addEventListener("click", function() { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialNextStep(); - return false; - }); - break; - case iTutorialSteps.TerminalIntro: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("The Terminal is used to interface with your home computer as well as " + - "all of the other machines around the world."); - nextBtn.style.display = "inline-block"; - break; - case iTutorialSteps.TerminalHelp: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Let's try it out. Start by entering the help command into the Terminal " + - "(Don't forget to press Enter after typing the command)"); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalLs: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("The help command displays a list of all available Terminal commands, how to use them, " + - "and a description of what they do.

Let's try another command. Enter the ls command."); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalScan: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText(" ls is a basic command that shows files " + - "on the computer. Right now, it shows that you have a program called NUKE.exe on your computer. " + - "We'll get to what this does later.

Using your home computer's terminal, you can connect " + - "to other machines throughout the world. Let's do that now by first entering " + - "the scan command."); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalScanAnalyze1: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("The scan command shows all available network connections. In other words, " + - "it displays a list of all servers that can be connected to from your " + - "current machine. A server is identified by its hostname.

" + - "That's great and all, but there's so many servers. Which one should you go to? " + - "The scan-analyze command gives some more detailed information about servers on the " + - "network. Try it now!"); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalScanAnalyze2: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("You just ran scan-analyze with a depth of one. This command shows more detailed " + - "information about each server that you can connect to (servers that are a distance of " + - "one node away).

It is also possible to run scan-analyze with " + - "a higher depth. Let's try a depth of two with the following command: scan-analyze 2.") - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalConnect: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Now you can see information about all servers that are up to two nodes away, as well " + - "as figure out how to navigate to those servers through the network. You can only connect to " + - "a server that is one node away. To connect to a machine, use the connect [hostname] command.

" + - "From the results of the scan-analyze command, we can see that the n00dles server is " + - "only one node away. Let's connect so it now using: connect n00dles"); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalAnalyze: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("You are now connected to another machine! What can you do now? You can hack it!

In the year 2077, currency has " + - "become digital and decentralized. People and corporations store their money " + - "on servers and computers. Using your hacking abilities, you can hack servers " + - "to steal money and gain experience.

" + - "Before you try to hack a server, you should run diagnostics using the analyze command."); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalNuke: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("When the analyze command finishes running it will show useful information " + - "about hacking the server.

For this server, the required hacking skill is only 1, " + - "which means you can hack it right now. However, in order to hack a server " + - "you must first gain root access. The NUKE.exe program that we saw earlier on your " + - "home computer is a virus that will grant you root access to a machine if there are enough " + - "open ports.

The analyze results shows that there do not need to be any open ports " + - "on this machine for the NUKE virus to work, so go ahead and run the virus using the " + - "run NUKE.exe command."); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalManualHack: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("You now have root access! You can hack the server using the hack command. " + - "Try doing that now."); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalHackingMechanics: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("You are now attempting to hack the server. Performing a hack takes time and " + - "only has a certain percentage chance " + - "of success. This time and success chance is determined by a variety of factors, including " + - "your hacking skill and the server's security level.

" + - "If your attempt to hack the server is successful, you will steal a certain percentage " + - "of the server's total money. This percentage is affected by your hacking skill and " + - "the server's security level.

The amount of money on a server is not limitless. So, if " + - "you constantly hack a server and deplete its money, then you will encounter " + - "diminishing returns in your hacking."); - nextBtn.style.display = "inline-block"; - break; - case iTutorialSteps.TerminalCreateScript: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Hacking is the core mechanic of the game and is necessary for progressing. However, " + - "you don't want to be hacking manually the entire time. You can automate your hacking " + - "by writing scripts!

To create a new script or edit an existing one, you can use the nano " + - "command. Scripts must end with the .script extension. Let's make a script now by " + - "entering nano n00dles.script after the hack command finishes running (Sidenote: Pressing ctrl + c" + - " will end a command like hack early)"); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalTypeScript: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadScriptEditorContent("n00dles.script", ""); - iTutorialSetText("This is the script editor. You can use it to program your scripts. Scripts are " + - "written in a simplified version of javascript. Copy and paste the following code into the script editor:

" + - "
" +
-                         "while(true) {\n" +
-                         "  hack('n00dles');\n" +
-                         "}
" + - "For anyone with basic programming experience, this code should be straightforward. " + - "This script will continuously hack the n00dles server.

" + - "To save and close the script editor, press the button in the bottom left, or press ctrl + b."); - nextBtn.style.display = "none"; // next step triggered in saveAndCloseScriptEditor() (Script.js) - break; - case iTutorialSteps.TerminalFree: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Now we'll run the script. Scripts require a certain amount of RAM to run, and can be " + - "run on any machine which you have root access to. Different servers have different " + - "amounts of RAM. You can also purchase more RAM for your home server.

To check how much " + - "RAM is available on this machine, enter the free command."); - nextBtn.style.display = "none"; // next step triggered by terminal commmand - break; - case iTutorialSteps.TerminalRunScript: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("We have 4GB of free RAM on this machine, which is enough to run our " + - "script. Let's run our script using run n00dles.script."); - nextBtn.style.display = "none"; // next step triggered by terminal commmand - break; - case iTutorialSteps.TerminalGoToActiveScriptsPage: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Your script is now running! " + - "It will continuously run in the background and will automatically stop if " + - "the code ever completes (the n00dles.script will never complete because it " + - "runs an infinite loop).

These scripts can passively earn you income and hacking experience. " + - "Your scripts will also earn money and experience while you are offline, although at a " + - "slightly slower rate.

" + - "Let's check out some statistics for our running scripts by clicking the " + - "Active Scripts link in the main navigation menu."); - nextBtn.style.display = "none"; - - // Flash 'Active Scripts' menu and set its tutorial click handler - activeScriptsMainMenu.setAttribute("class", "flashing-button"); - activeScriptsMainMenu.addEventListener("click", function() { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadActiveScriptsContent(); - iTutorialNextStep(); - return false; - }); - break; - case iTutorialSteps.ActiveScriptsPage: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadActiveScriptsContent(); - iTutorialSetText("This page displays information about all of your scripts that are " + - "running across every server. You can use this to gauge how well " + - "your scripts are doing. Let's go back to the Terminal"); - nextBtn.style.display = "none"; - - // Flash 'Terminal' button and set its tutorial click handler - terminalMainMenu.setAttribute("class", "flashing-button"); - terminalMainMenu.addEventListener("click", function() { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialNextStep(); - return false; - }); - break; - case iTutorialSteps.ActiveScriptsToTerminal: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("One last thing about scripts, each active script contains logs that detail " + - "what it's doing. We can check these logs using the tail command. Do that " + - "now for the script we just ran by typing tail n00dles.script"); - nextBtn.style.display = "none"; // next step triggered by terminal command - break; - case iTutorialSteps.TerminalTailScript: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("The log for this script won't show much right now (it might show nothing at all) because it " + - "just started running...but check back again in a few minutes!

" + - "This covers the basics of hacking. To learn more about writing " + - "scripts, select the Tutorial link in the " + - "main navigation menu to look at the documentation. " + - "If you are an experienced JavaScript " + - "developer, I would highly suggest you check out the section on " + - "NetscriptJS/Netscript 2.0, it's faster and more powerful.

For now, let's move on to something else!"); - nextBtn.style.display = "inline-block"; - break; - case iTutorialSteps.GoToHacknetNodesPage: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTerminalContent(); - iTutorialSetText("Hacking is not the only way to earn money. One other way to passively " + - "earn money is by purchasing and upgrading Hacknet Nodes. Let's go to " + - "the Hacknet page through the main navigation menu now."); - nextBtn.style.display = "none"; - - // Flash 'Hacknet' menu and set its tutorial click handler - hacknetMainMenu.setAttribute("class", "flashing-button"); - hacknetMainMenu.addEventListener("click", function() { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadHacknetNodesContent(); - iTutorialNextStep(); - return false; - }); - break; - case iTutorialSteps.HacknetNodesIntroduction: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadHacknetNodesContent(); - iTutorialSetText("here you can purchase new Hacknet Nodes and upgrade your " + - "existing ones. Let's purchase a new one now."); - nextBtn.style.display = "none"; // Next step triggered by purchaseHacknet() (HacknetNode.js) - break; - case iTutorialSteps.HacknetNodesGoToWorldPage: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadHacknetNodesContent(); - iTutorialSetText("You just purchased a Hacknet Node! This Hacknet Node will passively " + - "earn you money over time, both online and offline. When you get enough " + - " money, you can upgrade " + - "your newly-purchased Hacknet Node below.

" + - "Let's go to the City page through the main navigation menu."); - nextBtn.style.display = "none"; - - // Flash 'City' menu and set its tutorial click handler - cityMainMenu.setAttribute("class", "flashing-button"); - cityMainMenu.addEventListener("click", function() { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadLocationContent(); - iTutorialNextStep(); - return false; - }); - break; - case iTutorialSteps.WorldDescription: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadLocationContent(); - iTutorialSetText("This page lists all of the different locations you can currently " + - "travel to. Each location has something that you can do. " + - "There's a lot of content out in the world, make sure " + - "you explore and discover!

" + - "Lastly, click on the Tutorial link in the main navigation menu."); - nextBtn.style.display = "none"; - - // Flash 'Tutorial' menu and set its tutorial click handler - tutorialMainMenu.setAttribute("class", "flashing-button"); - tutorialMainMenu.addEventListener("click", function() { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTutorialContent(); - iTutorialNextStep(); - return false; - }); - break; - case iTutorialSteps.TutorialPageInfo: - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].loadTutorialContent(); - iTutorialSetText("This page contains a lot of different documentation about the game's " + - "content and mechanics. I know it's a lot, but I highly suggest you read " + - "(or at least skim) through this before you start playing. That's the end of the tutorial. " + - "Hope you enjoy the game!"); - nextBtn.style.display = "inline-block"; - nextBtn.innerHTML = "Finish Tutorial"; - break; - case iTutorialSteps.End: - iTutorialEnd(); - break; - default: - throw new Error("Invalid tutorial step"); - } - - if (ITutorial.stepIsDone[ITutorial.currStep] === true) { - nextBtn.style.display = "inline-block"; - } -} - -// Go to the next step and evaluate it -function iTutorialNextStep() { - // Special behavior for certain steps - if (ITutorial.currStep === iTutorialSteps.GoToCharacterPage) { - document.getElementById("stats-menu-link").removeAttribute("class"); - } - if (ITutorial.currStep === iTutorialSteps.CharacterGoToTerminalPage) { - document.getElementById("terminal-menu-link").removeAttribute("class"); - } - if (ITutorial.currStep === iTutorialSteps.TerminalGoToActiveScriptsPage) { - document.getElementById("active-scripts-menu-link").removeAttribute("class"); - } - if (ITutorial.currStep === iTutorialSteps.ActiveScriptsPage) { - document.getElementById("terminal-menu-link").removeAttribute("class"); - } - if (ITutorial.currStep === iTutorialSteps.GoToHacknetNodesPage) { - document.getElementById("hacknet-nodes-menu-link").removeAttribute("class"); - } - if (ITutorial.currStep === iTutorialSteps.HacknetNodesGoToWorldPage) { - document.getElementById("city-menu-link").removeAttribute("class"); - } - if (ITutorial.currStep === iTutorialSteps.WorldDescription) { - document.getElementById("tutorial-menu-link").removeAttribute("class"); - } - - ITutorial.stepIsDone[ITutorial.currStep] = true; - if (ITutorial.currStep < iTutorialSteps.End) { - ITutorial.currStep += 1; - } - iTutorialEvaluateStep(); -} - -// Go to previous step and evaluate -function iTutorialPrevStep() { - if (ITutorial.currStep > iTutorialSteps.Start) { - ITutorial.currStep -= 1; - } - iTutorialEvaluateStep(); -} - -function iTutorialEnd() { - // Re-enable auto save - if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_2__["Settings"].AutosaveInterval === 0) { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].Counters.autoSaveCounter = Infinity; - } else { - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].Counters.autoSaveCounter = _Settings_Settings__WEBPACK_IMPORTED_MODULE_2__["Settings"].AutosaveInterval * 5; - } - - // Initialize references to main menu links - // We have to call initializeMainMenuLinks() again because the Interactive Tutorial - // re-creates Main menu links with clearEventListeners() - if (!Object(_ui_MainMenu_Links__WEBPACK_IMPORTED_MODULE_3__["initializeMainMenuLinks"])()) { - const errorMsg = "Failed to initialize Main Menu Links. Please try refreshing the page. " + - "If that doesn't work, report the issue to the developer"; - Object(_utils_helpers_exceptionAlert__WEBPACK_IMPORTED_MODULE_5__["exceptionAlert"])(new Error(errorMsg)); - console.error(errorMsg); - return; - } - _engine__WEBPACK_IMPORTED_MODULE_0__["Engine"].init(); - - ITutorial.currStep = iTutorialSteps.End; - ITutorial.isRunning = false; - document.getElementById("interactive-tutorial-container").style.display = "none"; - - // Create a popup with final introductory stuff - const popupId = "interactive-tutorial-ending-popup"; - const txt = Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__["createElement"])("p", { - innerHTML: - "If you are new to the game, the following links may be useful for you!

" + - "Getting Started Guide" + - "Documentation

" + - "The Beginner's Guide to Hacking was added to your home computer! It contains some tips/pointers for starting out with the game. " + - "To read it, go to Terminal and enter

cat " + _Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__["LiteratureNames"].HackersStartingHandbook, - }); - const gotitBtn = Object(_utils_uiHelpers_createElement__WEBPACK_IMPORTED_MODULE_7__["createElement"])("a", { - class:"a-link-button", float:"right", padding:"6px", innerText:"Got it!", - clickListener:()=>{ - Object(_utils_uiHelpers_removeElementById__WEBPACK_IMPORTED_MODULE_9__["removeElementById"])(popupId); - }, - }); - Object(_utils_uiHelpers_createPopup__WEBPACK_IMPORTED_MODULE_8__["createPopup"])(popupId, [txt, gotitBtn]); - - _Player__WEBPACK_IMPORTED_MODULE_1__["Player"].getHomeComputer().messages.push(_Literature_data_LiteratureNames__WEBPACK_IMPORTED_MODULE_4__["LiteratureNames"].HackersStartingHandbook); -} - -let textBox = null; -(function() { - function set() { - textBox = document.getElementById("interactive-tutorial-text"); - document.removeEventListener("DOMContentLoaded", set); - } - document.addEventListener("DOMContentLoaded", set); -})(); - -function iTutorialSetText(txt) { - textBox.innerHTML = txt; - textBox.parentElement.scrollTop = 0; // this resets scroll position -} - - - - -/***/ }), -/* 44 */ -/*!***********************************!*\ - !*** ./utils/helpers/keyCodes.ts ***! - \***********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.KEY = void 0; -/** - * Keyboard key codes - */ -exports.KEY = { - CTRL: 17, - DOWNARROW: 40, - ENTER: 13, - ESC: 27, - TAB: 9, - UPARROW: 38, - "0": 48, - "1": 49, - "2": 50, - "3": 51, - "4": 52, - "5": 53, - "6": 54, - "7": 55, - "8": 56, - "9": 57, - A: 65, - B: 66, - C: 67, - D: 68, - E: 69, - F: 70, - G: 71, - H: 72, - I: 73, - J: 74, - K: 75, - L: 76, - M: 77, - N: 78, - O: 79, - P: 80, - Q: 81, - R: 82, - S: 83, - T: 84, - U: 85, - V: 86, - W: 87, - X: 88, - Y: 89, - Z: 90, -}; - - -/***/ }), -/* 45 */ -/*!***************************************!*\ - !*** ./utils/helpers/getRandomInt.ts ***! - \***************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getRandomInt = void 0; -/** - * Gets a random integer bounded by the values passed in. - * @param min The minimum value in the range. - * @param max The maximum value in the range. - */ -function getRandomInt(min, max) { - const lower = Math.min(min, max); - const upper = Math.max(min, max); - return Math.floor(Math.random() * (upper - lower + 1)) + lower; -} -exports.getRandomInt = getRandomInt; - - -/***/ }), -/* 46 */, -/* 47 */ -/*!*****************************************!*\ - !*** ./src/StockMarket/StockMarket.tsx ***! - \*****************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.displayStockMarketContent = exports.processStockPrices = exports.stockMarketCycle = exports.initSymbolToStockMap = exports.initStockMarket = exports.deleteStockMarket = exports.loadStockMarket = exports.cancelOrder = exports.placeOrder = exports.SymbolToStockMap = exports.StockMarket = void 0; -const BuyingAndSelling_1 = __webpack_require__(/*! ./BuyingAndSelling */ 174); -const Order_1 = __webpack_require__(/*! ./Order */ 996); -const OrderProcessing_1 = __webpack_require__(/*! ./OrderProcessing */ 995); -const Stock_1 = __webpack_require__(/*! ./Stock */ 191); -const StockMarketConstants_1 = __webpack_require__(/*! ./StockMarketConstants */ 994); -const InitStockMetadata_1 = __webpack_require__(/*! ./data/InitStockMetadata */ 993); -const OrderTypes_1 = __webpack_require__(/*! ./data/OrderTypes */ 111); -const PositionTypes_1 = __webpack_require__(/*! ./data/PositionTypes */ 98); -const StockSymbols_1 = __webpack_require__(/*! ./data/StockSymbols */ 284); -const Root_1 = __webpack_require__(/*! ./ui/Root */ 992); -const Constants_1 = __webpack_require__(/*! ../Constants */ 11); -const Player_1 = __webpack_require__(/*! ../Player */ 2); -const EventEmitter_1 = __webpack_require__(/*! ../utils/EventEmitter */ 487); -const navigationTracking_1 = __webpack_require__(/*! .././ui/navigationTracking */ 18); -const numeralFormat_1 = __webpack_require__(/*! .././ui/numeralFormat */ 7); -const DialogBox_1 = __webpack_require__(/*! ../../utils/DialogBox */ 13); -const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); -const React = __importStar(__webpack_require__(/*! react */ 0)); -const ReactDOM = __importStar(__webpack_require__(/*! react-dom */ 21)); -exports.StockMarket = {}; // Maps full stock name -> Stock object -exports.SymbolToStockMap = {}; // Maps symbol -> Stock object -function placeOrder(stock, shares, price, type, position, workerScript = null) { - if (!(stock instanceof Stock_1.Stock)) { - if (workerScript) { - workerScript.log("placeOrder", `Invalid stock: '${stock}'`); - } - else { - DialogBox_1.dialogBoxCreate(`ERROR: Invalid stock passed to placeOrder() function`); - } - return false; - } - if (typeof shares !== "number" || typeof price !== "number") { - if (workerScript) { - workerScript.log("placeOrder", `Invalid arguments: shares='${shares}' price='${price}'`); - } - else { - DialogBox_1.dialogBoxCreate("ERROR: Invalid numeric value provided for either 'shares' or 'price' argument"); - } - return false; - } - const order = new Order_1.Order(stock.symbol, shares, price, type, position); - if (exports.StockMarket["Orders"] == null) { - const orders = {}; - for (const name in exports.StockMarket) { - const stk = exports.StockMarket[name]; - if (!(stk instanceof Stock_1.Stock)) { - continue; - } - orders[stk.symbol] = []; - } - exports.StockMarket["Orders"] = orders; - } - exports.StockMarket["Orders"][stock.symbol].push(order); - // Process to see if it should be executed immediately - const processOrderRefs = { - rerenderFn: displayStockMarketContent, - stockMarket: exports.StockMarket, - symbolToStockMap: exports.SymbolToStockMap, - }; - OrderProcessing_1.processOrders(stock, order.type, order.pos, processOrderRefs); - displayStockMarketContent(); - return true; -} -exports.placeOrder = placeOrder; -function cancelOrder(params, workerScript = null) { - if (exports.StockMarket["Orders"] == null) { - return false; - } - if (params.order && params.order instanceof Order_1.Order) { - const order = params.order; - // An 'Order' object is passed in - const stockOrders = exports.StockMarket["Orders"][order.stockSymbol]; - for (let i = 0; i < stockOrders.length; ++i) { - if (order == stockOrders[i]) { - stockOrders.splice(i, 1); - displayStockMarketContent(); - return true; - } - } - return false; - } - else if (params.stock && params.shares && params.price && params.type && - params.pos && params.stock instanceof Stock_1.Stock) { - // Order properties are passed in. Need to look for the order - const stockOrders = exports.StockMarket["Orders"][params.stock.symbol]; - const orderTxt = params.stock.symbol + " - " + params.shares + " @ " + - numeralFormat_1.numeralWrapper.formatMoney(params.price); - for (let i = 0; i < stockOrders.length; ++i) { - const order = stockOrders[i]; - if (params.shares === order.shares && - params.price === order.price && - params.type === order.type && - params.pos === order.pos) { - stockOrders.splice(i, 1); - displayStockMarketContent(); - if (workerScript) { - workerScript.scriptRef.log("Successfully cancelled order: " + orderTxt); - } - return true; - } - } - if (workerScript) { - workerScript.scriptRef.log("Failed to cancel order: " + orderTxt); - } - return false; - } - return false; -} -exports.cancelOrder = cancelOrder; -function loadStockMarket(saveString) { - if (saveString === "") { - exports.StockMarket = {}; - } - else { - exports.StockMarket = JSON.parse(saveString, JSONReviver_1.Reviver); - } -} -exports.loadStockMarket = loadStockMarket; -function deleteStockMarket() { - exports.StockMarket = {}; -} -exports.deleteStockMarket = deleteStockMarket; -function initStockMarket() { - for (const stk in exports.StockMarket) { - if (exports.StockMarket.hasOwnProperty(stk)) { - delete exports.StockMarket[stk]; - } - } - for (const metadata of InitStockMetadata_1.InitStockMetadata) { - const name = metadata.name; - exports.StockMarket[name] = new Stock_1.Stock(metadata); - } - const orders = {}; - for (const name in exports.StockMarket) { - const stock = exports.StockMarket[name]; - if (!(stock instanceof Stock_1.Stock)) { - continue; - } - orders[stock.symbol] = []; - } - exports.StockMarket["Orders"] = orders; - exports.StockMarket.storedCycles = 0; - exports.StockMarket.lastUpdate = 0; - exports.StockMarket.ticksUntilCycle = StockMarketConstants_1.TicksPerCycle; -} -exports.initStockMarket = initStockMarket; -function initSymbolToStockMap() { - for (const name in StockSymbols_1.StockSymbols) { - if (StockSymbols_1.StockSymbols.hasOwnProperty(name)) { - const stock = exports.StockMarket[name]; - if (stock == null) { - console.error(`Could not find Stock for ${name}`); - continue; - } - const symbol = StockSymbols_1.StockSymbols[name]; - exports.SymbolToStockMap[symbol] = stock; - } - } -} -exports.initSymbolToStockMap = initSymbolToStockMap; -function stockMarketCycle() { - for (const name in exports.StockMarket) { - const stock = exports.StockMarket[name]; - if (!(stock instanceof Stock_1.Stock)) { - continue; - } - const roll = Math.random(); - if (roll < 0.45) { - stock.b = !stock.b; - stock.flipForecastForecast(); - } - exports.StockMarket.ticksUntilCycle = StockMarketConstants_1.TicksPerCycle; - } -} -exports.stockMarketCycle = stockMarketCycle; -// Stock prices updated every 6 seconds -const msPerStockUpdate = 6e3; -const cyclesPerStockUpdate = msPerStockUpdate / Constants_1.CONSTANTS.MilliPerCycle; -function processStockPrices(numCycles = 1) { - if (exports.StockMarket.storedCycles == null || isNaN(exports.StockMarket.storedCycles)) { - exports.StockMarket.storedCycles = 0; - } - exports.StockMarket.storedCycles += numCycles; - if (exports.StockMarket.storedCycles < cyclesPerStockUpdate) { - return; - } - // We can process the update every 4 seconds as long as there are enough - // stored cycles. This lets us account for offline time - const timeNow = new Date().getTime(); - if (timeNow - exports.StockMarket.lastUpdate < 4e3) { - return; - } - exports.StockMarket.lastUpdate = timeNow; - exports.StockMarket.storedCycles -= cyclesPerStockUpdate; - // Cycle - if (exports.StockMarket.ticksUntilCycle == null || typeof exports.StockMarket.ticksUntilCycle !== "number") { - exports.StockMarket.ticksUntilCycle = StockMarketConstants_1.TicksPerCycle; - } - --exports.StockMarket.ticksUntilCycle; - if (exports.StockMarket.ticksUntilCycle <= 0) { - stockMarketCycle(); - } - const v = Math.random(); - for (const name in exports.StockMarket) { - const stock = exports.StockMarket[name]; - if (!(stock instanceof Stock_1.Stock)) { - continue; - } - let av = (v * stock.mv) / 100; - if (isNaN(av)) { - av = .02; - } - let chc = 50; - if (stock.b) { - chc = (chc + stock.otlkMag) / 100; - } - else { - chc = (chc - stock.otlkMag) / 100; - } - if (stock.price >= stock.cap) { - chc = 0.1; // "Soft Limit" on stock price. It could still go up but its unlikely - stock.b = false; - } - if (isNaN(chc)) { - chc = 0.5; - } - const c = Math.random(); - const processOrderRefs = { - rerenderFn: displayStockMarketContent, - stockMarket: exports.StockMarket, - symbolToStockMap: exports.SymbolToStockMap, - }; - if (c < chc) { - stock.changePrice(stock.price * (1 + av)); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitBuy, PositionTypes_1.PositionTypes.Short, processOrderRefs); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitSell, PositionTypes_1.PositionTypes.Long, processOrderRefs); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopBuy, PositionTypes_1.PositionTypes.Long, processOrderRefs); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopSell, PositionTypes_1.PositionTypes.Short, processOrderRefs); - } - else { - stock.changePrice(stock.price / (1 + av)); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitBuy, PositionTypes_1.PositionTypes.Long, processOrderRefs); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.LimitSell, PositionTypes_1.PositionTypes.Short, processOrderRefs); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopBuy, PositionTypes_1.PositionTypes.Short, processOrderRefs); - OrderProcessing_1.processOrders(stock, OrderTypes_1.OrderTypes.StopSell, PositionTypes_1.PositionTypes.Long, processOrderRefs); - } - let otlkMagChange = stock.otlkMag * av; - if (stock.otlkMag < 5) { - if (stock.otlkMag <= 1) { - otlkMagChange = 1; - } - else { - otlkMagChange *= 10; - } - } - stock.cycleForecast(otlkMagChange); - stock.cycleForecastForecast(otlkMagChange / 2); - // Shares required for price movement gradually approaches max over time - stock.shareTxUntilMovement = Math.min(stock.shareTxUntilMovement + 10, stock.shareTxForMovement); - } - displayStockMarketContent(); -} -exports.processStockPrices = processStockPrices; -let stockMarketContainer = null; -function setStockMarketContainer() { - stockMarketContainer = document.getElementById("stock-market-container"); - document.removeEventListener("DOMContentLoaded", setStockMarketContainer); -} -document.addEventListener("DOMContentLoaded", setStockMarketContainer); -function initStockMarketFnForReact() { - initStockMarket(); - initSymbolToStockMap(); -} -const eventEmitterForUiReset = new EventEmitter_1.EventEmitter(); -function displayStockMarketContent() { - if (!navigationTracking_1.routing.isOn(navigationTracking_1.Page.StockMarket)) { - return; - } - eventEmitterForUiReset.emitEvent(); - if (stockMarketContainer instanceof HTMLElement) { - const castedStockMarket = exports.StockMarket; - ReactDOM.render(React.createElement(Root_1.StockMarketRoot, { buyStockLong: BuyingAndSelling_1.buyStock, buyStockShort: BuyingAndSelling_1.shortStock, cancelOrder: cancelOrder, eventEmitterForReset: eventEmitterForUiReset, initStockMarket: initStockMarketFnForReact, p: Player_1.Player, placeOrder: placeOrder, sellStockLong: BuyingAndSelling_1.sellStock, sellStockShort: BuyingAndSelling_1.sellShort, stockMarket: castedStockMarket }), stockMarketContainer); - } -} -exports.displayStockMarketContent = displayStockMarketContent; - - -/***/ }), -/* 48 */, -/* 49 */ -/*!************************************************!*\ - !*** ./utils/uiHelpers/clearEventListeners.ts ***! - \************************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.clearEventListeners = void 0; -const getElementById_1 = __webpack_require__(/*! ./getElementById */ 190); -/** - * Given an element by its ID, removes all event listeners from that element by cloning and - * replacing. Then returns the new cloned element. - * @param elemId The HTML ID to retrieve the element by. - */ -function clearEventListeners(elemId) { - try { - let elem; - if (typeof elemId === "string") { - elem = getElementById_1.getElementById(elemId); - } - else { - elem = elemId; - } - const newElem = elem.cloneNode(true); - if (elem.parentNode !== null) { - elem.parentNode.replaceChild(newElem, elem); - } - return newElem; - } - catch (e) { - // tslint:disable-next-line:no-console - console.error(e); - return null; - } -} -exports.clearEventListeners = clearEventListeners; - - -/***/ }), -/* 50 */ -/*!************************!*\ - !*** ./src/Hacking.ts ***! - \************************/ -/*! no static exports found */ -/*! exports used: calculateGrowTime, calculateHackingChance, calculateHackingExpGain, calculateHackingTime, calculatePercentMoneyHacked, calculateWeakenTime */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.calculateWeakenTime = exports.calculateGrowTime = exports.calculateHackingTime = exports.calculatePercentMoneyHacked = exports.calculateHackingExpGain = exports.calculateHackingChance = void 0; -const BitNodeMultipliers_1 = __webpack_require__(/*! ./BitNode/BitNodeMultipliers */ 19); -const intelligence_1 = __webpack_require__(/*! ./PersonObjects/formulas/intelligence */ 411); -/** - * Returns the chance the player has to successfully hack a server - */ -function calculateHackingChance(server, player) { - const hackFactor = 1.75; - const difficultyMult = (100 - server.hackDifficulty) / 100; - const skillMult = hackFactor * player.hacking_skill; - const skillChance = (skillMult - server.requiredHackingSkill) / skillMult; - const chance = skillChance * difficultyMult * player.hacking_chance_mult * intelligence_1.calculateIntelligenceBonus(player.intelligence, 1); - if (chance > 1) { - return 1; - } - if (chance < 0) { - return 0; - } - return chance; -} -exports.calculateHackingChance = calculateHackingChance; -/** - * Returns the amount of hacking experience the player will gain upon - * successfully hacking a server - */ -function calculateHackingExpGain(server, player) { - const baseExpGain = 3; - const diffFactor = 0.3; - if (server.baseDifficulty == null) { - server.baseDifficulty = server.hackDifficulty; - } - let expGain = baseExpGain; - expGain += (server.baseDifficulty * player.hacking_exp_mult * diffFactor); - return expGain * BitNodeMultipliers_1.BitNodeMultipliers.HackExpGain; -} -exports.calculateHackingExpGain = calculateHackingExpGain; -/** - * Returns the percentage of money that will be stolen from a server if - * it is successfully hacked (returns the decimal form, not the actual percent value) - */ -function calculatePercentMoneyHacked(server, player) { - // Adjust if needed for balancing. This is the divisor for the final calculation - const balanceFactor = 240; - const difficultyMult = (100 - server.hackDifficulty) / 100; - const skillMult = (player.hacking_skill - (server.requiredHackingSkill - 1)) / player.hacking_skill; - const percentMoneyHacked = difficultyMult * skillMult * player.hacking_money_mult / balanceFactor; - if (percentMoneyHacked < 0) { - return 0; - } - if (percentMoneyHacked > 1) { - return 1; - } - return percentMoneyHacked * BitNodeMultipliers_1.BitNodeMultipliers.ScriptHackMoney; -} -exports.calculatePercentMoneyHacked = calculatePercentMoneyHacked; -/** - * Returns time it takes to complete a hack on a server, in seconds - */ -function calculateHackingTime(server, player) { - const difficultyMult = server.requiredHackingSkill * server.hackDifficulty; - const baseDiff = 500; - const baseSkill = 50; - const diffFactor = 2.5; - let skillFactor = (diffFactor * difficultyMult + baseDiff); - // tslint:disable-next-line - skillFactor /= (player.hacking_skill + baseSkill); - const hackTimeMultiplier = 5; - const hackingTime = hackTimeMultiplier * skillFactor / (player.hacking_speed_mult * intelligence_1.calculateIntelligenceBonus(player.intelligence, 1)); - return hackingTime; -} -exports.calculateHackingTime = calculateHackingTime; -/** - * Returns time it takes to complete a grow operation on a server, in seconds - */ -function calculateGrowTime(server, player) { - const growTimeMultiplier = 3.2; // Relative to hacking time. 16/5 = 3.2 - return growTimeMultiplier * calculateHackingTime(server, player); -} -exports.calculateGrowTime = calculateGrowTime; -/** - * Returns time it takes to complete a weaken operation on a server, in seconds - */ -function calculateWeakenTime(server, player) { - const weakenTimeMultiplier = 4; // Relative to hacking time - return weakenTimeMultiplier * calculateHackingTime(server, player); -} -exports.calculateWeakenTime = calculateWeakenTime; - - -/***/ }), -/* 51 */ -/*!******************************************!*\ - !*** ./utils/uiHelpers/createElement.ts ***! - \******************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.createElement = void 0; -function setElementAnchor(el, params) { - if (params.text !== undefined) { - el.text = params.text; - } - if (params.href !== undefined) { - el.href = params.href; - } - if (params.target !== undefined) { - el.target = params.target; - } -} -function setElementInput(el, params) { - if (params.name !== undefined) { - el.name = params.name; - } - if (params.value !== undefined) { - el.value = params.value; - } - if (params.type !== undefined) { - el.type = params.type; - } - if (params.checked !== undefined) { - el.checked = params.checked; - } - if (params.pattern !== undefined) { - el.pattern = params.pattern; - } - if (params.maxLength !== undefined) { - el.maxLength = params.maxLength; - } - if (params.placeholder !== undefined) { - el.placeholder = params.placeholder; - } - if (params.max !== undefined) { - el.max = params.max; - } - if (params.min !== undefined) { - el.min = params.min; - } - if (params.step !== undefined) { - el.step = params.step; - } -} -function setElementLabel(el, params) { - if (params.for !== undefined) { - el.htmlFor = params.for; - } -} -function setElementListeners(el, params) { - // tslint:disable:no-unbound-method - if (params.clickListener !== undefined) { - el.addEventListener("click", params.clickListener); - } - if (params.inputListener !== undefined) { - el.addEventListener("input", params.inputListener); - } - if (params.changeListener !== undefined) { - el.addEventListener("change", params.changeListener); - } - if (params.onkeyup !== undefined) { - el.addEventListener("keyup", params.onkeyup); - } - if (params.onkeydown !== undefined) { - el.addEventListener("keydown", params.onkeydown); - } - if (params.onfocus !== undefined) { - el.addEventListener("focus", params.onfocus); - } - // tslint:enable:no-unbound-method -} -function setElementStyle(el, params) { - if (params.display !== undefined) { - el.style.display = params.display; - } - if (params.visibility !== undefined) { - el.style.visibility = params.visibility; - } - if (params.margin !== undefined) { - el.style.margin = params.margin; - } - if (params.marginLeft !== undefined) { - el.style.marginLeft = params.marginLeft; - } - if (params.marginTop !== undefined) { - el.style.marginTop = params.marginTop; - } - if (params.padding !== undefined) { - el.style.padding = params.padding; - } - if (params.color !== undefined) { - el.style.color = params.color; - } - if (params.border !== undefined) { - el.style.border = params.border; - } - if (params.float !== undefined) { - el.style.cssFloat = params.float; - } - if (params.fontSize !== undefined) { - el.style.fontSize = params.fontSize; - } - if (params.whiteSpace !== undefined) { - el.style.whiteSpace = params.whiteSpace; - } - if (params.width !== undefined) { - el.style.width = params.width; - } - if (params.height !== undefined) { - el.style.height = params.height; - } - if (params.top !== undefined) { - el.style.top = params.top; - } - if (params.left !== undefined) { - el.style.left = params.left; - } - if (params.backgroundColor !== undefined) { - el.style.backgroundColor = params.backgroundColor; - } - if (params.position !== undefined) { - el.style.position = params.position; - } - if (params.overflow !== undefined) { - el.style.overflow = params.overflow; - } -} -function setElementTooltip(el, params) { - if (params.tooltip !== undefined && params.tooltip !== "") { - el.className += " tooltip"; - el.appendChild(createElement("span", { - class: "tooltiptext", - innerHTML: params.tooltip, - })); - } - else if (params.tooltipleft !== undefined) { - el.className += " tooltip"; - el.appendChild(createElement("span", { - class: "tooltiptextleft", - innerHTML: params.tooltipleft, - })); - } - else if (params.tooltipsmall !== undefined) { - el.className += " tooltip"; - el.appendChild(createElement("span", { - class: "tooltiptext smallfont", - innerHTML: params.tooltipsmall, - })); - } - else if (params.tooltiplow !== undefined) { - el.className += "tooltip"; - el.appendChild(createElement("span", { - class: "tooltiptextlow", - innerHTML: params.tooltiplow, - })); - } -} -/** - * An all-in-one-call way of creating an element to be added to the DOM at some point. - * @param tagName The HTML tag/element name - * @param params Additional parameters to set on the element - */ -function createElement(tagName, params = {}) { - const el = document.createElement(tagName); - if (params.id !== undefined) { - el.id = params.id; - } - if (params.class !== undefined) { - el.className = params.class; - } - if (params.innerHTML !== undefined) { - el.innerHTML = params.innerHTML; - } - if (params.innerText !== undefined) { - el.innerText = params.innerText; - } - if (params.tabIndex !== undefined) { - el.tabIndex = params.tabIndex; - } - setElementAnchor(el, params); - setElementInput(el, params); - setElementLabel(el, params); - setElementListeners(el, params); - setElementStyle(el, params); - setElementTooltip(el, params); - return el; -} -exports.createElement = createElement; - - -/***/ }), -/* 52 */ -/*!*****************************************!*\ - !*** ./src/Company/CompanyPositions.ts ***! - \*****************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CompanyPositions = void 0; -// Constructs all CompanyPosition objects using the metadata in data/companypositions.ts -const CompanyPositionsMetadata_1 = __webpack_require__(/*! ./data/CompanyPositionsMetadata */ 1069); -const CompanyPosition_1 = __webpack_require__(/*! ./CompanyPosition */ 286); -exports.CompanyPositions = {}; -function addCompanyPosition(params) { - if (exports.CompanyPositions[params.name] != null) { - console.warn(`Duplicate Company Position being defined: ${params.name}`); - } - exports.CompanyPositions[params.name] = new CompanyPosition_1.CompanyPosition(params); -} -CompanyPositionsMetadata_1.companyPositionMetadata.forEach((e) => { - addCompanyPosition(e); -}); - - -/***/ }), -/* 53 */, -/* 54 */, -/* 55 */, -/* 56 */ -/*!************************************!*\ - !*** ./src/ui/React/StdButton.tsx ***! - \************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.StdButton = void 0; -/** - * Basic stateless button - * Uses the 'std-button' css class - */ -const React = __importStar(__webpack_require__(/*! react */ 0)); -function StdButton(props) { - const hasTooltip = props.tooltip != null && props.tooltip !== ""; - let className = props.disabled ? "std-button-disabled" : "std-button"; - if (hasTooltip) { - className += " tooltip"; - } - if (typeof props.addClasses === "string") { - className += ` ${props.addClasses}`; - } - // Tooltip will be set using inner HTML - let tooltip; - if (hasTooltip) { - if (typeof props.tooltip === 'string') { - const tooltipMarkup = { - __html: props.tooltip, - }; - tooltip = React.createElement("span", { className: "tooltiptext", dangerouslySetInnerHTML: tooltipMarkup }); - } - else { - tooltip = React.createElement("span", { className: "tooltiptext" }, props.tooltip); - } - } - return (React.createElement("button", { className: className, id: props.id, onClick: props.onClick, style: props.style }, - props.text, - hasTooltip && - tooltip)); -} -exports.StdButton = StdButton; - - -/***/ }), -/* 57 */, -/* 58 */ -/*!**************************************************!*\ - !*** ./src/Company/data/companypositionnames.ts ***! - \**************************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -// Defs for job titles, stored in arrays and categorized by job "type" -Object.defineProperty(exports, "__esModule", { value: true }); -exports.PartTimeCompanyPositions = exports.BusinessConsultantCompanyPositions = exports.SoftwareConsultantCompanyPositions = exports.MiscCompanyPositions = exports.AgentCompanyPositions = exports.SecurityCompanyPositions = exports.BusinessCompanyPositions = exports.NetworkEngineerCompanyPositions = exports.SecurityEngineerCompanyPositions = exports.ITCompanyPositions = exports.SoftwareCompanyPositions = void 0; -exports.SoftwareCompanyPositions = [ - "Software Engineering Intern", - "Junior Software Engineer", - "Senior Software Engineer", - "Lead Software Developer", - "Head of Software", - "Head of Engineering", - "Vice President of Technology", - "Chief Technology Officer", -]; -exports.ITCompanyPositions = [ - "IT Intern", - "IT Analyst", - "IT Manager", - "Systems Administrator", -]; -exports.SecurityEngineerCompanyPositions = [ - "Security Engineer", -]; -exports.NetworkEngineerCompanyPositions = [ - "Network Engineer", - "Network Administrator", -]; -exports.BusinessCompanyPositions = [ - "Business Intern", - "Business Analyst", - "Business Manager", - "Operations Manager", - "Chief Financial Officer", - "Chief Executive Officer", -]; -exports.SecurityCompanyPositions = [ - "Police Officer", - "Police Chief", - "Security Guard", - "Security Officer", - "Security Supervisor", - "Head of Security", -]; -exports.AgentCompanyPositions = [ - "Field Agent", - "Secret Agent", - "Special Operative", -]; -exports.MiscCompanyPositions = [ - "Waiter", - "Employee", -]; -exports.SoftwareConsultantCompanyPositions = [ - "Software Consultant", - "Senior Software Consultant", -]; -exports.BusinessConsultantCompanyPositions = [ - "Business Consultant", - "Senior Business Consultant", -]; -exports.PartTimeCompanyPositions = [ - "Part-time Waiter", - "Part-time Employee", -]; - - -/***/ }), -/* 59 */ -/*!*************************************!*\ - !*** ./src/ui/React/Reputation.tsx ***! - \*************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Reputation = void 0; -const React = __importStar(__webpack_require__(/*! react */ 0)); -const numeralFormat_1 = __webpack_require__(/*! ../../ui/numeralFormat */ 7); -function Reputation(reputation) { - return React.createElement("span", { className: "reputation samefont" }, typeof reputation === 'number' ? numeralFormat_1.numeralWrapper.formatReputation(reputation) : reputation); -} -exports.Reputation = Reputation; - - -/***/ }), -/* 60 */, -/* 61 */ -/*!***************************!*\ - !*** ./utils/YesNoBox.ts ***! - \***************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.yesNoTxtInpBoxCreate = exports.yesNoTxtInpBoxGetInput = exports.yesNoTxtInpBoxGetNoButton = exports.yesNoTxtInpBoxGetYesButton = exports.yesNoTxtInpBoxClose = exports.yesNoTxtInpBoxHotkeyHandler = exports.yesNoBoxCreate = exports.yesNoBoxGetNoButton = exports.yesNoBoxGetYesButton = exports.yesNoBoxClose = exports.yesNoBoxOpen = void 0; -/** - * Generic Yes-No Pop-up box - * Used to create pop-up boxes that require a yes/no response from player - * - * There are two types of pop ups: - * 1. Just a Yes/No response from player - * 2. Popup also includes a text input field in addition to the Yes/No response - */ -const clearEventListeners_1 = __webpack_require__(/*! ./uiHelpers/clearEventListeners */ 49); -const keyCodes_1 = __webpack_require__(/*! ./helpers/keyCodes */ 44); -const ReactDOM = __importStar(__webpack_require__(/*! react-dom */ 21)); -exports.yesNoBoxOpen = false; -const yesNoBoxContainer = document.getElementById("yes-no-box-container"); -const yesNoBoxTextElement = document.getElementById("yes-no-box-text"); -function yesNoBoxHotkeyHandler(e) { - if (e.keyCode === keyCodes_1.KEY.ESC) { - yesNoBoxClose(); - } - else if (e.keyCode === keyCodes_1.KEY.ENTER) { - const yesBtn = document.getElementById("yes-no-box-yes"); - if (yesBtn) { - yesBtn.click(); - } - else { - console.error(`Could not find YesNoBox Yes button DOM element`); - } - } -} -function yesNoBoxClose() { - if (yesNoBoxContainer) { - yesNoBoxContainer.style.display = "none"; - } - else { - console.error("Container not found for YesNoBox"); - } - exports.yesNoBoxOpen = false; - // Remove hotkey handler - document.removeEventListener("keydown", yesNoBoxHotkeyHandler); - return false; //So that 'return yesNoBoxClose()' is return false in event listeners -} -exports.yesNoBoxClose = yesNoBoxClose; -function yesNoBoxGetYesButton() { - return clearEventListeners_1.clearEventListeners("yes-no-box-yes"); -} -exports.yesNoBoxGetYesButton = yesNoBoxGetYesButton; -function yesNoBoxGetNoButton() { - return clearEventListeners_1.clearEventListeners("yes-no-box-no"); -} -exports.yesNoBoxGetNoButton = yesNoBoxGetNoButton; -function yesNoBoxCreate(txt) { - if (exports.yesNoBoxOpen) { - return false; - } //Already open - exports.yesNoBoxOpen = true; - if (yesNoBoxTextElement) { - ReactDOM.unmountComponentAtNode(yesNoBoxTextElement); - yesNoBoxTextElement.innerHTML = ''; - if (typeof txt === 'string') { - yesNoBoxTextElement.innerHTML = txt; - } - else { - ReactDOM.render(txt, yesNoBoxTextElement); - } - } - else { - console.error(`Text element not found for YesNoBox`); - } - if (yesNoBoxContainer) { - yesNoBoxContainer.style.display = "flex"; - } - else { - console.error("Container not found for YesNoBox"); - } - // Add event listener for Esc and Enter hotkeys - document.addEventListener("keydown", yesNoBoxHotkeyHandler); - return true; -} -exports.yesNoBoxCreate = yesNoBoxCreate; -/** - * Yes-No pop up box with text input field - */ -const yesNoTextInputBoxContainer = document.getElementById("yes-no-text-input-box-container"); -const yesNoTextInputBoxInput = document.getElementById("yes-no-text-input-box-input"); -const yesNoTextInputBoxTextElement = document.getElementById("yes-no-text-input-box-text"); -function yesNoTxtInpBoxHotkeyHandler(e) { - if (e.keyCode === keyCodes_1.KEY.ESC) { - yesNoTxtInpBoxClose(); - } - else if (e.keyCode === keyCodes_1.KEY.ENTER) { - const yesBtn = document.getElementById("yes-no-text-input-box-yes"); - if (yesBtn) { - yesBtn.click(); - } - else { - console.error(`Could not find YesNoTxtInputBox Yes button DOM element`); - } - } -} -exports.yesNoTxtInpBoxHotkeyHandler = yesNoTxtInpBoxHotkeyHandler; -function yesNoTxtInpBoxClose() { - if (yesNoTextInputBoxContainer != null) { - yesNoTextInputBoxContainer.style.display = "none"; - } - else { - console.error("Container not found for YesNoTextInputBox"); - return false; - } - if (!yesNoTextInputBoxInput) - throw new Error("yesNoTextInputBoxInput was not set"); - exports.yesNoBoxOpen = false; - yesNoTextInputBoxInput.value = ""; - // Remove hotkey handler - document.removeEventListener("keydown", yesNoTxtInpBoxHotkeyHandler); - return false; -} -exports.yesNoTxtInpBoxClose = yesNoTxtInpBoxClose; -function yesNoTxtInpBoxGetYesButton() { - const elem = clearEventListeners_1.clearEventListeners("yes-no-text-input-box-yes"); - if (elem === null) - throw new Error("Could not find element with id: 'yes-no-text-input-box-yes'"); - return elem; -} -exports.yesNoTxtInpBoxGetYesButton = yesNoTxtInpBoxGetYesButton; -function yesNoTxtInpBoxGetNoButton() { - const elem = clearEventListeners_1.clearEventListeners("yes-no-text-input-box-no"); - if (elem === null) - throw new Error("Could not find element with id: 'yes-no-text-input-box-no'"); - return elem; -} -exports.yesNoTxtInpBoxGetNoButton = yesNoTxtInpBoxGetNoButton; -function yesNoTxtInpBoxGetInput() { - if (!yesNoTextInputBoxInput) { - console.error("Could not find YesNoTextInputBox input element"); - return ""; - } - let val = yesNoTextInputBoxInput.value; - val = val.replace(/\s+/g, ''); - return val; -} -exports.yesNoTxtInpBoxGetInput = yesNoTxtInpBoxGetInput; -function yesNoTxtInpBoxCreate(txt) { - exports.yesNoBoxOpen = true; - if (yesNoTextInputBoxTextElement) { - ReactDOM.unmountComponentAtNode(yesNoTextInputBoxTextElement); - yesNoTextInputBoxTextElement.innerHTML = ''; - if (typeof txt === 'string') { - yesNoTextInputBoxTextElement.innerHTML = txt; - } - else { - ReactDOM.render(txt, yesNoTextInputBoxTextElement); - } - } - if (yesNoTextInputBoxContainer) { - yesNoTextInputBoxContainer.style.display = "flex"; - } - else { - console.error("Container not found for YesNoTextInputBox"); - } - // Add event listener for Esc and Enter hotkeys - document.addEventListener("keydown", yesNoTxtInpBoxHotkeyHandler); - if (!yesNoTextInputBoxInput) - throw new Error("yesNoTextInputBoxInput was not set"); - yesNoTextInputBoxInput.focus(); -} -exports.yesNoTxtInpBoxCreate = yesNoTxtInpBoxCreate; - - -/***/ }), -/* 62 */, -/* 63 */, -/* 64 */, -/* 65 */, -/* 66 */ -/*!***************************************!*\ - !*** ./src/Script/ScriptHelpersTS.ts ***! - \***************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isScriptFilename = void 0; -// Script helper functions -function isScriptFilename(f) { - return f.endsWith(".js") || f.endsWith(".script") || f.endsWith(".ns"); -} -exports.isScriptFilename = isScriptFilename; - - -/***/ }), -/* 67 */ -/*!**********************!*\ - !*** ./src/Alias.ts ***! - \**********************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.substituteAliases = exports.removeAlias = exports.parseAliasDeclaration = exports.printAliases = exports.loadGlobalAliases = exports.loadAliases = exports.GlobalAliases = exports.Aliases = void 0; -const postToTerminal_1 = __webpack_require__(/*! ./ui/postToTerminal */ 8); -exports.Aliases = {}; -exports.GlobalAliases = {}; -function loadAliases(saveString) { - if (saveString === "") { - exports.Aliases = {}; - } - else { - exports.Aliases = JSON.parse(saveString); - } -} -exports.loadAliases = loadAliases; -function loadGlobalAliases(saveString) { - if (saveString === "") { - exports.GlobalAliases = {}; - } - else { - exports.GlobalAliases = JSON.parse(saveString); - } -} -exports.loadGlobalAliases = loadGlobalAliases; -// Prints all aliases to terminal -function printAliases() { - for (const name in exports.Aliases) { - if (exports.Aliases.hasOwnProperty(name)) { - postToTerminal_1.post("alias " + name + "=" + exports.Aliases[name]); - } - } - for (const name in exports.GlobalAliases) { - if (exports.GlobalAliases.hasOwnProperty(name)) { - postToTerminal_1.post("global alias " + name + "=" + exports.GlobalAliases[name]); - } - } -} -exports.printAliases = printAliases; -// Returns true if successful, false otherwise -function parseAliasDeclaration(dec, global = false) { - const re = /^([_|\w|!|%|,|@]+)="(.+)"$/; - const matches = dec.match(re); - if (matches == null || matches.length != 3) { - return false; - } - if (global) { - addGlobalAlias(matches[1], matches[2]); - } - else { - addAlias(matches[1], matches[2]); - } - return true; -} -exports.parseAliasDeclaration = parseAliasDeclaration; -function addAlias(name, value) { - if (name in exports.GlobalAliases) { - delete exports.GlobalAliases[name]; - } - exports.Aliases[name] = value.trim(); -} -function addGlobalAlias(name, value) { - if (name in exports.Aliases) { - delete exports.Aliases[name]; - } - exports.GlobalAliases[name] = value.trim(); -} -function getAlias(name) { - if (exports.Aliases.hasOwnProperty(name)) { - return exports.Aliases[name]; - } - return null; -} -function getGlobalAlias(name) { - if (exports.GlobalAliases.hasOwnProperty(name)) { - return exports.GlobalAliases[name]; - } - return null; -} -function removeAlias(name) { - if (exports.Aliases.hasOwnProperty(name)) { - delete exports.Aliases[name]; - return true; - } - if (exports.GlobalAliases.hasOwnProperty(name)) { - delete exports.GlobalAliases[name]; - return true; - } - return false; -} -exports.removeAlias = removeAlias; -/** - * Returns the original string with any aliases substituted in. - * Aliases are only applied to "whole words", one level deep - */ -function substituteAliases(origCommand) { - var _a, _b; - const commandArray = origCommand.split(" "); - if (commandArray.length > 0) { - // For the alias and unalias commands, dont substite - if (commandArray[0] === "unalias" || commandArray[0] === "alias") { - return commandArray.join(" "); - } - let somethingSubstituted = true; - let depth = 0; - while (somethingSubstituted && depth < 10) { - depth++; - somethingSubstituted = false; - const alias = (_a = getAlias(commandArray[0])) === null || _a === void 0 ? void 0 : _a.split(" "); - if (alias != null) { - somethingSubstituted = true; - commandArray.splice(0, 1, ...alias); - //commandArray[0] = alias; - } - for (let i = 0; i < commandArray.length; ++i) { - const alias = (_b = getGlobalAlias(commandArray[i])) === null || _b === void 0 ? void 0 : _b.split(" "); - if (alias != null) { - somethingSubstituted = true; - commandArray.splice(i, 1, ...alias); - i += alias.length - 1; - //commandArray[i] = alias; - } - } - } - } - return commandArray.join(" "); -} -exports.substituteAliases = substituteAliases; - - -/***/ }), -/* 68 */ -/*!***********************************!*\ - !*** ./src/NetscriptEvaluator.js ***! - \***********************************/ -/*! exports provided: netscriptDelay, makeRuntimeRejectMsg, resolveNetscriptRequestedThreads, getErrorLineNumber, isScriptErrorMessage */ -/*! exports used: isScriptErrorMessage, makeRuntimeRejectMsg, netscriptDelay, resolveNetscriptRequestedThreads */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return netscriptDelay; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return makeRuntimeRejectMsg; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return resolveNetscriptRequestedThreads; }); -/* unused harmony export getErrorLineNumber */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isScriptErrorMessage; }); -/* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/SetTimeoutRef */ 76); -/* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/helpers/isString */ 72); -/* harmony import */ var _utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Server/AllServers */ 20); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_2__); - - - - - -function netscriptDelay(time, workerScript) { - return new Promise(function(resolve) { - workerScript.delay = Object(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_0__["setTimeoutRef"])(() => { - workerScript.delay = null; - resolve(); - }, time); - workerScript.delayResolve = resolve; - }); -} - -function makeRuntimeRejectMsg(workerScript, msg, exp=null) { - var lineNum = ""; - if (exp != null) { - var num = getErrorLineNumber(exp, workerScript); - lineNum = " (Line " + num + ")" - } - const server = _Server_AllServers__WEBPACK_IMPORTED_MODULE_2__["AllServers"][workerScript.serverIp]; - if (server == null) { - throw new Error(`WorkerScript constructed with invalid server ip: ${this.serverIp}`); - } - - return "|"+server.hostname+"|"+workerScript.name+"|" + msg + lineNum; -} - -function resolveNetscriptRequestedThreads(workerScript, functionName, requestedThreads) { - const threads = workerScript.scriptRef.threads; - if (!requestedThreads) { - return (isNaN(threads) || threads < 1) ? 1 : threads; - } - const requestedThreadsAsInt = requestedThreads|0; - if (isNaN(requestedThreads) || requestedThreadsAsInt < 1) { - throw makeRuntimeRejectMsg(workerScript, `Invalid thread count passed to ${functionName}: ${requestedThreads}. Threads must be a positive number.`); - } - if (requestedThreads > threads) { - throw makeRuntimeRejectMsg(workerScript, `Too many threads requested by ${functionName}. Requested: ${requestedThreads}. Has: ${threads}.`); - } - return requestedThreadsAsInt; -} - - -function getErrorLineNumber(exp, workerScript) { - var code = workerScript.scriptRef.codeCode(); - - //Split code up to the start of the node - try { - code = code.substring(0, exp.start); - return (code.match(/\n/g) || []).length + 1; - } catch(e) { - return -1; - } -} - -function isScriptErrorMessage(msg) { - if (!Object(_utils_helpers_isString__WEBPACK_IMPORTED_MODULE_1__["isString"])(msg)) {return false;} - let splitMsg = msg.split("|"); - if (splitMsg.length != 4){ - return false; - } - return true; -} - - -/***/ }), -/* 69 */, -/* 70 */ -/*!*******************************************!*\ - !*** ./src/Netscript/killWorkerScript.ts ***! - \*******************************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.killWorkerScript = void 0; -/** - * Stops an actively-running script (represented by a WorkerScript object) - * and removes it from the global pool of active scripts. - */ -const WorkerScript_1 = __webpack_require__(/*! ./WorkerScript */ 247); -const WorkerScripts_1 = __webpack_require__(/*! ./WorkerScripts */ 112); -const WorkerScriptStartStopEventEmitter_1 = __webpack_require__(/*! ./WorkerScriptStartStopEventEmitter */ 147); -const RunningScript_1 = __webpack_require__(/*! ../Script/RunningScript */ 194); -const AllServers_1 = __webpack_require__(/*! ../Server/AllServers */ 20); -const compareArrays_1 = __webpack_require__(/*! ../../utils/helpers/compareArrays */ 195); -const roundToTwo_1 = __webpack_require__(/*! ../../utils/helpers/roundToTwo */ 290); -function killWorkerScript(script, serverIp, rerenderUi) { - if (rerenderUi == null || typeof rerenderUi !== "boolean") { - rerenderUi = true; - } - if (script instanceof WorkerScript_1.WorkerScript) { - stopAndCleanUpWorkerScript(script); - return true; - } - else if (script instanceof RunningScript_1.RunningScript && typeof serverIp === "string") { - // Try to kill by PID - const res = killWorkerScriptByPid(script.pid, rerenderUi); - if (res) { - return res; - } - // If for some reason that doesn't work, we'll try the old way - for (const ws of WorkerScripts_1.workerScripts.values()) { - if (ws.name == script.filename && ws.serverIp == serverIp && - compareArrays_1.compareArrays(ws.args, script.args)) { - stopAndCleanUpWorkerScript(ws, rerenderUi); - return true; - } - } - return false; - } - else if (typeof script === "number") { - return killWorkerScriptByPid(script, rerenderUi); - } - else { - console.error(`killWorkerScript() called with invalid argument:`); - console.error(script); - return false; - } -} -exports.killWorkerScript = killWorkerScript; -function killWorkerScriptByPid(pid, rerenderUi = true) { - const ws = WorkerScripts_1.workerScripts.get(pid); - if (ws instanceof WorkerScript_1.WorkerScript) { - stopAndCleanUpWorkerScript(ws, rerenderUi); - return true; - } - return false; -} -function stopAndCleanUpWorkerScript(workerScript, rerenderUi = true) { - workerScript.env.stopFlag = true; - killNetscriptDelay(workerScript); - removeWorkerScript(workerScript, rerenderUi); -} -/** - * Helper function that removes the script being killed from the global pool. - * Also handles other cleanup-time operations - * - * @param {WorkerScript | number} - Identifier for WorkerScript. Either the object itself, or - * its index in the global workerScripts array - */ -function removeWorkerScript(workerScript, rerenderUi = true) { - if (workerScript instanceof WorkerScript_1.WorkerScript) { - const ip = workerScript.serverIp; - const name = workerScript.name; - // Get the server on which the script runs - const server = AllServers_1.AllServers[ip]; - if (server == null) { - console.error(`Could not find server on which this script is running: ${ip}`); - return; - } - // Recalculate ram used on that server - server.ramUsed = roundToTwo_1.roundToTwo(server.ramUsed - workerScript.ramUsage); - if (server.ramUsed < 0) { - console.warn(`Server (${server.hostname}) RAM usage went negative (if it's due to floating pt imprecision, it's okay): ${server.ramUsed}`); - server.ramUsed = 0; - } - // Delete the RunningScript object from that server - for (let i = 0; i < server.runningScripts.length; ++i) { - const runningScript = server.runningScripts[i]; - if (runningScript.filename === name && compareArrays_1.compareArrays(runningScript.args, workerScript.args)) { - server.runningScripts.splice(i, 1); - break; - } - } - // Delete script from global pool (workerScripts) - const res = WorkerScripts_1.workerScripts.delete(workerScript.pid); - if (!res) { - console.warn(`removeWorkerScript() called with WorkerScript that wasn't in the global map:`); - console.warn(workerScript); - } - if (rerenderUi) { - WorkerScriptStartStopEventEmitter_1.WorkerScriptStartStopEventEmitter.emitEvent(); - } - } - else { - console.error(`Invalid argument passed into removeWorkerScript():`); - console.error(workerScript); - return; - } -} -/** - * Helper function that interrupts a script's delay if it is in the middle of a - * timed, blocked operation (like hack(), sleep(), etc.). This allows scripts to - * be killed immediately even if they're in the middle of one of those long operations - */ -function killNetscriptDelay(workerScript) { - if (workerScript instanceof WorkerScript_1.WorkerScript) { - if (workerScript.delay) { - clearTimeout(workerScript.delay); - if (workerScript.delayResolve) { - workerScript.delayResolve(); - } - } - } -} - - -/***/ }), -/* 71 */ -/*!****************************************!*\ - !*** ./src/Faction/FactionHelpers.jsx ***! - \****************************************/ -/*! exports provided: inviteToFaction, joinFaction, startHackingMission, displayFactionContent, purchaseAugmentationBoxCreate, hasAugmentationPrereqs, purchaseAugmentation, getNextNeurofluxLevel, processPassiveFactionRepGain */ -/*! all exports used */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inviteToFaction", function() { return inviteToFaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "joinFaction", function() { return joinFaction; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startHackingMission", function() { return startHackingMission; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "displayFactionContent", function() { return displayFactionContent; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "purchaseAugmentationBoxCreate", function() { return purchaseAugmentationBoxCreate; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hasAugmentationPrereqs", function() { return hasAugmentationPrereqs; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "purchaseAugmentation", function() { return purchaseAugmentation; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNextNeurofluxLevel", function() { return getNextNeurofluxLevel; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "processPassiveFactionRepGain", function() { return processPassiveFactionRepGain; }); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 0); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-dom */ 21); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _ui_Root__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui/Root */ 791); -/* harmony import */ var _ui_Root__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_ui_Root__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Augmentation/Augmentations */ 12); -/* harmony import */ var _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Augmentation/AugmentationHelpers */ 79); -/* harmony import */ var _Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../Augmentation/PlayerOwnedAugmentation */ 196); -/* harmony import */ var _Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../Augmentation/data/AugmentationNames */ 4); -/* harmony import */ var _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../BitNode/BitNodeMultipliers */ 19); -/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../Constants */ 11); -/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Constants__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../engine */ 15); -/* harmony import */ var _Faction__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Faction */ 125); -/* harmony import */ var _Faction__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_Faction__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _Factions__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Factions */ 17); -/* harmony import */ var _Factions__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(_Factions__WEBPACK_IMPORTED_MODULE_11__); -/* harmony import */ var _Missions__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Missions */ 81); -/* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Player */ 2); -/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Settings/Settings */ 24); -/* harmony import */ var _Settings_Settings__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_Settings_Settings__WEBPACK_IMPORTED_MODULE_14__); -/* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../PersonObjects/formulas/reputation */ 109); -/* harmony import */ var _PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__); -/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../SourceFile/SourceFileFlags */ 37); -/* harmony import */ var _SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../ui/navigationTracking */ 18); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__); -/* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../../utils/DialogBox */ 13); -/* harmony import */ var _utils_DialogBox__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__); -/* harmony import */ var _utils_FactionInvitationBox__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../../utils/FactionInvitationBox */ 790); -/* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../ui/React/Money */ 27); -/* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Money__WEBPACK_IMPORTED_MODULE_20__); -/* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../../utils/YesNoBox */ 61); -/* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__); - - - - - - - - - - - - - - - - - - - - - - -function inviteToFaction(faction) { - if (_Settings_Settings__WEBPACK_IMPORTED_MODULE_14__["Settings"].SuppressFactionInvites) { - faction.alreadyInvited = true; - _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations.push(faction.name); - - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_17__["Page"].Factions)) { - _engine__WEBPACK_IMPORTED_MODULE_9__["Engine"].loadFactionsContent(); - } - } else { - Object(_utils_FactionInvitationBox__WEBPACK_IMPORTED_MODULE_19__[/* factionInvitationBoxCreate */ "a"])(faction); - } -} -function joinFaction(faction) { - if (faction.isMember) return; - faction.isMember = true; - _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factions.push(faction.name); - const factionInfo = faction.getInfo(); //Determine what factions you are banned from now that you have joined this faction - - for (const i in factionInfo.enemies) { - const enemy = factionInfo.enemies[i]; - - if (_Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][enemy] instanceof _Faction__WEBPACK_IMPORTED_MODULE_10__["Faction"]) { - _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][enemy].isBanned = true; - } - } - - for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations.length; ++i) { - if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations[i] == faction.name || _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations[i]].isBanned) { - _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].factionInvitations.splice(i, 1); - i--; - } - } -} -function startHackingMission(faction) { - const mission = new _Missions__WEBPACK_IMPORTED_MODULE_12__[/* HackingMission */ "a"](faction.playerReputation, faction); - Object(_Missions__WEBPACK_IMPORTED_MODULE_12__[/* setInMission */ "d"])(true, mission); //Sets inMission flag to true - - mission.init(); -} //Displays the HTML content for a specific faction - -function displayFactionContent(factionName, initiallyOnAugmentationsPage = false) { - const faction = _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][factionName]; - - if (faction == null) { - throw new Error(`Invalid factionName passed into displayFactionContent(): ${factionName}`); - } - - if (!faction.isMember) { - throw new Error(`Not a member of this faction. Cannot display faction information`); - } - - react_dom__WEBPACK_IMPORTED_MODULE_1___default.a.render(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_ui_Root__WEBPACK_IMPORTED_MODULE_2__["FactionRoot"], { - engine: _engine__WEBPACK_IMPORTED_MODULE_9__["Engine"], - initiallyOnAugmentationsPage: initiallyOnAugmentationsPage, - faction: faction, - p: _Player__WEBPACK_IMPORTED_MODULE_13__["Player"], - startHackingMissionFn: startHackingMission - }), _engine__WEBPACK_IMPORTED_MODULE_9__["Engine"].Display.factionContent); -} -function purchaseAugmentationBoxCreate(aug, fac) { - const factionInfo = fac.getInfo(); - const yesBtn = Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxGetYesButton"])(); - yesBtn.innerHTML = "Purchase"; - yesBtn.addEventListener("click", function () { - if (!Object(_Augmentation_AugmentationHelpers__WEBPACK_IMPORTED_MODULE_4__[/* isRepeatableAug */ "f"])(aug) && _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].hasAugmentation(aug)) { - return; - } - - purchaseAugmentation(aug, fac); - Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxClose"])(); - }); - const noBtn = Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxGetNoButton"])(); - noBtn.innerHTML = "Cancel"; - noBtn.addEventListener("click", function () { - Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxClose"])(); - }); - let content = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { - dangerouslySetInnerHTML: { - __html: aug.info - } - }); - - if (typeof aug.info !== 'string') { - content = react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", null, aug.info); - } - - Object(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_21__["yesNoBoxCreate"])(react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(react__WEBPACK_IMPORTED_MODULE_0___default.a.Fragment, null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("h2", null, aug.name), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), content, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("br", null), "Would you like to purchase the ", aug.name, " Augmentation for\xA0", Object(_ui_React_Money__WEBPACK_IMPORTED_MODULE_20__["Money"])(aug.baseCost * factionInfo.augmentationPriceMult), "?")); -} //Returns a boolean indicating whether the player has the prerequisites for the -//specified Augmentation - -function hasAugmentationPrereqs(aug) { - let hasPrereqs = true; - - if (aug.prereqs && aug.prereqs.length > 0) { - for (let i = 0; i < aug.prereqs.length; ++i) { - const prereqAug = _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"][aug.prereqs[i]]; - - if (prereqAug == null) { - console.error(`Invalid prereq Augmentation ${aug.prereqs[i]}`); - continue; - } - - if (prereqAug.owned === false) { - hasPrereqs = false; // Check if the aug is purchased - - for (let j = 0; j < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.length; ++j) { - if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations[j].name === prereqAug.name) { - hasPrereqs = true; - break; - } - } - } - } - } - - return hasPrereqs; -} -function purchaseAugmentation(aug, fac, sing = false) { - const factionInfo = fac.getInfo(); - var hasPrereqs = hasAugmentationPrereqs(aug); - - if (!hasPrereqs) { - var txt = "You must first purchase or install " + aug.prereqs.join(",") + " before you can " + "purchase this one."; - - if (sing) { - return txt; - } else { - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])(txt); - } - } else if (aug.baseCost !== 0 && _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].money.lt(aug.baseCost * factionInfo.augmentationPriceMult)) { - let txt = "You don't have enough money to purchase " + aug.name; - - if (sing) { - return txt; - } - - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])(txt); - } else if (fac.playerReputation < aug.baseRepRequirement) { - let txt = "You don't have enough faction reputation to purchase " + aug.name; - - if (sing) { - return txt; - } - - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])(txt); - } else if (aug.baseCost === 0 || _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].money.gte(aug.baseCost * factionInfo.augmentationPriceMult)) { - if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].firstAugPurchased === false) { - _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].firstAugPurchased = true; - document.getElementById("augmentations-tab").style.display = "list-item"; - document.getElementById("character-menu-header").click(); - document.getElementById("character-menu-header").click(); - } - - var queuedAugmentation = new _Augmentation_PlayerOwnedAugmentation__WEBPACK_IMPORTED_MODULE_5__["PlayerOwnedAugmentation"](aug.name); - - if (aug.name == _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { - queuedAugmentation.level = getNextNeurofluxLevel(); - } - - _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.push(queuedAugmentation); - _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].loseMoney(aug.baseCost * factionInfo.augmentationPriceMult); // If you just purchased Neuroflux Governor, recalculate the cost - - if (aug.name == _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { - var nextLevel = getNextNeurofluxLevel(); - --nextLevel; - var mult = Math.pow(_Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].NeuroFluxGovernorLevelMult, nextLevel); - aug.baseRepRequirement = 500 * mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__["BitNodeMultipliers"].AugmentationRepCost; - aug.baseCost = 750e3 * mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__["BitNodeMultipliers"].AugmentationMoneyCost; - - for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.length - 1; ++i) { - aug.baseCost *= _Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__["SourceFileFlags"][11]]; - } - } - - for (var name in _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"]) { - if (_Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"].hasOwnProperty(name)) { - _Augmentation_Augmentations__WEBPACK_IMPORTED_MODULE_3__["Augmentations"][name].baseCost *= _Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].MultipleAugMultiplier * [1, 0.96, 0.94, 0.93][_SourceFile_SourceFileFlags__WEBPACK_IMPORTED_MODULE_16__["SourceFileFlags"][11]]; - } - } - - if (sing) { - return "You purchased " + aug.name; - } else { - if (!_Settings_Settings__WEBPACK_IMPORTED_MODULE_14__["Settings"].SuppressBuyAugmentationConfirmation) { - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])("You purchased " + aug.name + ". It's enhancements will not take " + "effect until they are installed. To install your augmentations, go to the " + "'Augmentations' tab on the left-hand navigation menu. Purchasing additional " + "augmentations will now be more expensive."); - } - } // Force a rerender of the Augmentations page - - - displayFactionContent(fac.name, true); - } else { - Object(_utils_DialogBox__WEBPACK_IMPORTED_MODULE_18__["dialogBoxCreate"])("Hmm, something went wrong when trying to purchase an Augmentation. " + "Please report this to the game developer with an explanation of how to " + "reproduce this."); - } -} -function getNextNeurofluxLevel() { - // Get current Neuroflux level based on Player's augmentations - let currLevel = 0; - - for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].augmentations.length; ++i) { - if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].augmentations[i].name === _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { - currLevel = _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].augmentations[i].level; - } - } // Account for purchased but uninstalled Augmentations - - - for (var i = 0; i < _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations.length; ++i) { - if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].queuedAugmentations[i].name == _Augmentation_data_AugmentationNames__WEBPACK_IMPORTED_MODULE_6__["AugmentationNames"].NeuroFluxGovernor) { - ++currLevel; - } - } - - return currLevel + 1; -} -function processPassiveFactionRepGain(numCycles) { - for (const name in _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"]) { - if (name === _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].currentWorkFactionName) continue; - if (!_Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"].hasOwnProperty(name)) continue; - const faction = _Factions__WEBPACK_IMPORTED_MODULE_11__["Factions"][name]; - if (!faction.isMember) continue; // No passive rep for special factions - - const info = faction.getInfo(); - if (!info.offersWork()) continue; // No passive rep for gangs. - - if (_Player__WEBPACK_IMPORTED_MODULE_13__["Player"].getGangName() === name) continue; // 0 favor = 1%/s - // 50 favor = 6%/s - // 100 favor = 11%/s - - const favorMult = Math.min(0.1, faction.favor / 1000 + 0.01); // Find the best of all possible favor gain, minimum 1 rep / 2 minute. - - const hRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__["getHackingWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_13__["Player"], faction); - const sRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__["getFactionSecurityWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_13__["Player"], faction); - const fRep = Object(_PersonObjects_formulas_reputation__WEBPACK_IMPORTED_MODULE_15__["getFactionFieldWorkRepGain"])(_Player__WEBPACK_IMPORTED_MODULE_13__["Player"], faction); - const rate = Math.max(hRep * favorMult, sRep * favorMult, fRep * favorMult, 1 / 120); - faction.playerReputation += rate * numCycles * _Player__WEBPACK_IMPORTED_MODULE_13__["Player"].faction_rep_mult * _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_7__["BitNodeMultipliers"].FactionPassiveRepGain; - } -} - -/***/ }), -/* 72 */ -/*!***********************************!*\ - !*** ./utils/helpers/isString.ts ***! - \***********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.isString = void 0; -/** - * Checks whether the value passed in can be considered a string. - * @param value The value to check if it is a string. - */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -function isString(value) { - return (typeof value === "string" || value instanceof String); -} -exports.isString = isString; - - -/***/ }), -/* 73 */ -/*!********************************!*\ - !*** ./src/Message/Message.ts ***! - \********************************/ -/*! no static exports found */ -/*! all exports used */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Message = void 0; -const JSONReviver_1 = __webpack_require__(/*! ../../utils/JSONReviver */ 29); -class Message { - constructor(filename = "", msg = "") { - // Name of Message file - this.filename = ""; - // The text contains in the Message - this.msg = ""; - // Flag indicating whether this Message has been received by the player - this.recvd = false; - this.filename = filename; - this.msg = msg; - this.recvd = false; - } - // Serialize the current object to a JSON save state - toJSON() { - return JSONReviver_1.Generic_toJSON("Message", this); - } - // Initializes a Message Object from a JSON save state - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - static fromJSON(value) { - return JSONReviver_1.Generic_fromJSON(Message, value.data); - } -} -exports.Message = Message; -JSONReviver_1.Reviver.constructors.Message = Message; - - -/***/ }), -/* 74 */ -/*!**************************!*\ - !*** ./src/Terminal.jsx ***! - \**************************/ -/*! exports provided: postNetburnerText, Terminal */ -/*! exports used: Terminal, postNetburnerText */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* WEBPACK VAR INJECTION */(function($) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return postNetburnerText; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Terminal; }); -/* harmony import */ var _Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Terminal/DirectoryHelpers */ 86); -/* harmony import */ var _Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_Terminal_DirectoryHelpers__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Terminal/determineAllPossibilitiesForTabCompletion */ 782); -/* harmony import */ var _Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__); -/* harmony import */ var _Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Terminal/HelpText */ 458); -/* harmony import */ var _Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_Terminal_HelpText__WEBPACK_IMPORTED_MODULE_2__); -/* harmony import */ var _Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Terminal/tabCompletion */ 781); -/* harmony import */ var _Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__); -/* harmony import */ var _Fconf_Fconf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./Fconf/Fconf */ 193); -/* harmony import */ var _Alias__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Alias */ 67); -/* harmony import */ var _Alias__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_Alias__WEBPACK_IMPORTED_MODULE_5__); -/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./BitNode/BitNodeMultipliers */ 19); -/* harmony import */ var _BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_BitNode_BitNodeMultipliers__WEBPACK_IMPORTED_MODULE_6__); -/* harmony import */ var _CodingContracts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./CodingContracts */ 93); -/* harmony import */ var _CodingContracts__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_CodingContracts__WEBPACK_IMPORTED_MODULE_7__); -/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./Constants */ 11); -/* harmony import */ var _Constants__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Constants__WEBPACK_IMPORTED_MODULE_8__); -/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./Programs/Programs */ 30); -/* harmony import */ var _Programs_Programs__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(_Programs_Programs__WEBPACK_IMPORTED_MODULE_9__); -/* harmony import */ var _DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./DarkWeb/DarkWeb */ 533); -/* harmony import */ var _DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_DarkWeb_DarkWeb__WEBPACK_IMPORTED_MODULE_10__); -/* harmony import */ var _engine__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./engine */ 15); -/* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Fconf/FconfSettings */ 39); -/* harmony import */ var _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__); -/* harmony import */ var _Hacking__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Hacking */ 50); -/* harmony import */ var _Hacking__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_Hacking__WEBPACK_IMPORTED_MODULE_13__); -/* harmony import */ var _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./Hacknet/HacknetServer */ 78); -/* harmony import */ var _Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_Hacknet_HacknetServer__WEBPACK_IMPORTED_MODULE_14__); -/* harmony import */ var _InteractiveTutorial__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./InteractiveTutorial */ 43); -/* harmony import */ var _Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./Literature/LiteratureHelpers */ 523); -/* harmony import */ var _Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(_Literature_LiteratureHelpers__WEBPACK_IMPORTED_MODULE_16__); -/* harmony import */ var _Message_Message__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./Message/Message */ 73); -/* harmony import */ var _Message_Message__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_Message_Message__WEBPACK_IMPORTED_MODULE_17__); -/* harmony import */ var _Message_MessageHelpers__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./Message/MessageHelpers */ 87); -/* harmony import */ var _NetscriptWorker__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./NetscriptWorker */ 80); -/* harmony import */ var _Netscript_killWorkerScript__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./Netscript/killWorkerScript */ 70); -/* harmony import */ var _Netscript_killWorkerScript__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(_Netscript_killWorkerScript__WEBPACK_IMPORTED_MODULE_20__); -/* harmony import */ var _Netscript_WorkerScriptStartStopEventEmitter__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./Netscript/WorkerScriptStartStopEventEmitter */ 147); -/* harmony import */ var _Netscript_WorkerScriptStartStopEventEmitter__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(_Netscript_WorkerScriptStartStopEventEmitter__WEBPACK_IMPORTED_MODULE_21__); -/* harmony import */ var _Player__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./Player */ 2); -/* harmony import */ var _RedPill__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./RedPill */ 103); -/* harmony import */ var _Script_RunningScript__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./Script/RunningScript */ 194); -/* harmony import */ var _Script_RunningScript__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(_Script_RunningScript__WEBPACK_IMPORTED_MODULE_24__); -/* harmony import */ var _utils_helpers_compareArrays__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../utils/helpers/compareArrays */ 195); -/* harmony import */ var _utils_helpers_compareArrays__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_compareArrays__WEBPACK_IMPORTED_MODULE_25__); -/* harmony import */ var _Script_RunningScriptHelpers__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./Script/RunningScriptHelpers */ 444); -/* harmony import */ var _Script_RunningScriptHelpers__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(_Script_RunningScriptHelpers__WEBPACK_IMPORTED_MODULE_26__); -/* harmony import */ var _Script_ScriptHelpers__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./Script/ScriptHelpers */ 120); -/* harmony import */ var _Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./Script/ScriptHelpersTS */ 66); -/* harmony import */ var _Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(_Script_ScriptHelpersTS__WEBPACK_IMPORTED_MODULE_28__); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./Server/AllServers */ 20); -/* harmony import */ var _Server_AllServers__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(_Server_AllServers__WEBPACK_IMPORTED_MODULE_29__); -/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./Server/ServerHelpers */ 22); -/* harmony import */ var _Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_30___default = /*#__PURE__*/__webpack_require__.n(_Server_ServerHelpers__WEBPACK_IMPORTED_MODULE_30__); -/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./Server/SpecialServerIps */ 38); -/* harmony import */ var _Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31___default = /*#__PURE__*/__webpack_require__.n(_Server_SpecialServerIps__WEBPACK_IMPORTED_MODULE_31__); -/* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./utils/SetTimeoutRef */ 76); -/* harmony import */ var _utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32___default = /*#__PURE__*/__webpack_require__.n(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32__); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./ui/navigationTracking */ 18); -/* harmony import */ var _ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33___default = /*#__PURE__*/__webpack_require__.n(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__); -/* harmony import */ var _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./ui/numeralFormat */ 7); -/* harmony import */ var _ui_numeralFormat__WEBPACK_IMPORTED_MODULE_34___default = /*#__PURE__*/__webpack_require__.n(_ui_numeralFormat__WEBPACK_IMPORTED_MODULE_34__); -/* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../utils/helpers/keyCodes */ 44); -/* harmony import */ var _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__); -/* harmony import */ var _utils_helpers_arrayToString__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ../utils/helpers/arrayToString */ 113); -/* harmony import */ var _utils_helpers_arrayToString__WEBPACK_IMPORTED_MODULE_36___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_arrayToString__WEBPACK_IMPORTED_MODULE_36__); -/* harmony import */ var _utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ../utils/helpers/getTimestamp */ 409); -/* harmony import */ var _utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37___default = /*#__PURE__*/__webpack_require__.n(_utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37__); -/* harmony import */ var _utils_LogBox__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ../utils/LogBox */ 151); -/* harmony import */ var _utils_LogBox__WEBPACK_IMPORTED_MODULE_38___default = /*#__PURE__*/__webpack_require__.n(_utils_LogBox__WEBPACK_IMPORTED_MODULE_38__); -/* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ../utils/YesNoBox */ 61); -/* harmony import */ var _utils_YesNoBox__WEBPACK_IMPORTED_MODULE_39___default = /*#__PURE__*/__webpack_require__.n(_utils_YesNoBox__WEBPACK_IMPORTED_MODULE_39__); -/* harmony import */ var _ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./ui/postToTerminal */ 8); -/* harmony import */ var _ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40___default = /*#__PURE__*/__webpack_require__.n(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__); -/* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ../utils/StringHelperFunctions */ 23); -/* harmony import */ var _utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_41___default = /*#__PURE__*/__webpack_require__.n(_utils_StringHelperFunctions__WEBPACK_IMPORTED_MODULE_41__); -/* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./ui/React/Money */ 27); -/* harmony import */ var _ui_React_Money__WEBPACK_IMPORTED_MODULE_42___default = /*#__PURE__*/__webpack_require__.n(_ui_React_Money__WEBPACK_IMPORTED_MODULE_42__); -/* harmony import */ var autosize__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! autosize */ 780); -/* harmony import */ var autosize__WEBPACK_IMPORTED_MODULE_43___default = /*#__PURE__*/__webpack_require__.n(autosize__WEBPACK_IMPORTED_MODULE_43__); -/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! jszip */ 779); -/* harmony import */ var jszip__WEBPACK_IMPORTED_MODULE_44___default = /*#__PURE__*/__webpack_require__.n(jszip__WEBPACK_IMPORTED_MODULE_44__); -/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! file-saver */ 778); -/* harmony import */ var file_saver__WEBPACK_IMPORTED_MODULE_45___default = /*#__PURE__*/__webpack_require__.n(file_saver__WEBPACK_IMPORTED_MODULE_45__); -/* harmony import */ var arg__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! arg */ 445); -/* harmony import */ var arg__WEBPACK_IMPORTED_MODULE_46___default = /*#__PURE__*/__webpack_require__.n(arg__WEBPACK_IMPORTED_MODULE_46__); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! react */ 0); -/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_47___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_47__); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! react-dom */ 21); -/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_48___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_48__); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -function postNetburnerText() { - Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__["post"])("Bitburner v" + _Constants__WEBPACK_IMPORTED_MODULE_8__["CONSTANTS"].Version); -} // Helper function that checks if an argument (which is a string) is a valid number - - -function isNumber(str) { - if (typeof str != "string") { - return false; - } // Only process strings - - - return !isNaN(str) && !isNaN(parseFloat(str)); -} - -function getTerminalInput() { - return document.getElementById("terminal-input-text-box").value; -} // Defines key commands in terminal - - -$(document).keydown(function (event) { - // Terminal - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { - var terminalInput = document.getElementById("terminal-input-text-box"); - - if (terminalInput != null && !event.ctrlKey && !event.shiftKey && !Terminal.contractOpen) { - terminalInput.focus(); - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].ENTER) { - event.preventDefault(); // Prevent newline from being entered in Script Editor - - const command = getTerminalInput(); - const dir = Terminal.currDir; - Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__["post"])("[" + (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_TIMESTAMPS ? Object(_utils_helpers_getTimestamp__WEBPACK_IMPORTED_MODULE_37__["getTimestamp"])() + " " : "") + _Player__WEBPACK_IMPORTED_MODULE_22__["Player"].getCurrentServer().hostname + ` ~${dir}]> ${command}`); - - if (command.length > 0) { - Terminal.resetTerminalInput(); // Clear input first - - Terminal.executeCommands(command); - } - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].C && event.ctrlKey) { - if (_engine__WEBPACK_IMPORTED_MODULE_11__["Engine"]._actionInProgress) { - // Cancel action - Object(_ui_postToTerminal__WEBPACK_IMPORTED_MODULE_40__["post"])("Cancelling..."); - _engine__WEBPACK_IMPORTED_MODULE_11__["Engine"]._actionInProgress = false; - Terminal.finishAction(true); - } else if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { - // Dont prevent default so it still copies - Terminal.resetTerminalInput(); // Clear Terminal - } - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].L && event.ctrlKey) { - event.preventDefault(); - Terminal.executeCommand("clear"); // Clear screen - } // Ctrl p same as up arrow - // Ctrl n same as down arrow - - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].UPARROW || _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS && event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].P && event.ctrlKey) { - if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { - event.preventDefault(); - } // Cycle through past commands - - - if (terminalInput == null) { - return; - } - - var i = Terminal.commandHistoryIndex; - var len = Terminal.commandHistory.length; - - if (len == 0) { - return; - } - - if (i < 0 || i > len) { - Terminal.commandHistoryIndex = len; - } - - if (i != 0) { - --Terminal.commandHistoryIndex; - } - - var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex]; - terminalInput.value = prevCommand; - Object(_utils_SetTimeoutRef__WEBPACK_IMPORTED_MODULE_32__["setTimeoutRef"])(function () { - terminalInput.selectionStart = terminalInput.selectionEnd = 10000; - }, 10); - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].DOWNARROW || _Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS && event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].M && event.ctrlKey) { - if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { - event.preventDefault(); - } // Cycle through past commands - - - if (terminalInput == null) { - return; - } - - var i = Terminal.commandHistoryIndex; - var len = Terminal.commandHistory.length; - - if (len == 0) { - return; - } - - if (i < 0 || i > len) { - Terminal.commandHistoryIndex = len; - } // Latest command, put nothing - - - if (i == len || i == len - 1) { - Terminal.commandHistoryIndex = len; - terminalInput.value = ""; - } else { - ++Terminal.commandHistoryIndex; - var prevCommand = Terminal.commandHistory[Terminal.commandHistoryIndex]; - terminalInput.value = prevCommand; - } - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].TAB) { - event.preventDefault(); // Autocomplete - - if (terminalInput == null) { - return; - } - - let input = terminalInput.value; - - if (input == "") { - return; - } - - const semiColonIndex = input.lastIndexOf(";"); - - if (semiColonIndex !== -1) { - input = input.slice(semiColonIndex + 1); - } - - input = input.trim(); - input = input.replace(/\s\s+/g, ' '); - const commandArray = input.split(" "); - let index = commandArray.length - 2; - - if (index < -1) { - index = 0; - } - - const allPos = Object(_Terminal_determineAllPossibilitiesForTabCompletion__WEBPACK_IMPORTED_MODULE_1__["determineAllPossibilitiesForTabCompletion"])(_Player__WEBPACK_IMPORTED_MODULE_22__["Player"], input, index, Terminal.currDir); - - if (allPos.length == 0) { - return; - } - - let arg = ""; - let command = ""; - - if (commandArray.length == 0) { - return; - } - - if (commandArray.length == 1) { - command = commandArray[0]; - } else if (commandArray.length == 2) { - command = commandArray[0]; - arg = commandArray[1]; - } else if (commandArray.length == 3) { - command = commandArray[0] + " " + commandArray[1]; - arg = commandArray[2]; - } else { - arg = commandArray.pop(); - command = commandArray.join(" "); - } - - Object(_Terminal_tabCompletion__WEBPACK_IMPORTED_MODULE_3__["tabCompletion"])(command, arg, allPos); - terminalInput.focus(); - } // Extra Bash Emulation Hotkeys, must be enabled through .fconf - - - if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].ENABLE_BASH_HOTKEYS) { - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].A && event.ctrlKey) { - event.preventDefault(); - Terminal.moveTextCursor("home"); - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].E && event.ctrlKey) { - event.preventDefault(); - Terminal.moveTextCursor("end"); - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].B && event.ctrlKey) { - event.preventDefault(); - Terminal.moveTextCursor("prevchar"); - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].B && event.altKey) { - event.preventDefault(); - Terminal.moveTextCursor("prevword"); - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].F && event.ctrlKey) { - event.preventDefault(); - Terminal.moveTextCursor("nextchar"); - } - - if (event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].F && event.altKey) { - event.preventDefault(); - Terminal.moveTextCursor("nextword"); - } - - if ((event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].H || event.keyCode === _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].D) && event.ctrlKey) { - Terminal.modifyInput("backspace"); - event.preventDefault(); - } // TODO AFTER THIS: - // alt + d deletes word after cursor - // ^w deletes word before cursor - // ^k clears line after cursor - // ^u clears line before cursor - - } - } -}); // Keep terminal in focus - -let terminalCtrlPressed = false, - shiftKeyPressed = false; -$(document).ready(function () { - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { - $('.terminal-input').focus(); - } -}); -$(document).keydown(function (e) { - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { - if (e.which == _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].CTRL) { - terminalCtrlPressed = true; - } else if (e.shiftKey) { - shiftKeyPressed = true; - } else if (terminalCtrlPressed || shiftKeyPressed || Terminal.contractOpen) {// Don't focus - } else { - var inputTextBox = document.getElementById("terminal-input-text-box"); - - if (inputTextBox != null) { - inputTextBox.focus(); - } - - terminalCtrlPressed = false; - shiftKeyPressed = false; - } - } -}); -$(document).keyup(function (e) { - if (_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["routing"].isOn(_ui_navigationTracking__WEBPACK_IMPORTED_MODULE_33__["Page"].Terminal)) { - if (e.which == _utils_helpers_keyCodes__WEBPACK_IMPORTED_MODULE_35__["KEY"].CTRL) { - terminalCtrlPressed = false; - } - - if (e.shiftKey) { - shiftKeyPressed = false; - } - } -}); -let Terminal = { - // Flags to determine whether the player is currently running a hack or an analyze - hackFlag: false, - backdoorFlag: false, - analyzeFlag: false, - actionStarted: false, - actionTime: 0, - commandHistory: [], - commandHistoryIndex: 0, - // True if a Coding Contract prompt is opened - contractOpen: false, - // Full Path of current directory - // Excludes the trailing forward slash - currDir: "/", - resetTerminalInput: function (keepInput = false) { - let input = ""; - - if (keepInput) { - input = getTerminalInput(); - } - - const dir = Terminal.currDir; - - if (_Fconf_FconfSettings__WEBPACK_IMPORTED_MODULE_12__["FconfSettings"].WRAP_INPUT) { - document.getElementById("terminal-input-td").innerHTML = `
[${_Player__WEBPACK_IMPORTED_MODULE_22__["Player"].getCurrentServer().hostname} ~${dir}]$
` + `"; - support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; - - // Support: IE <=9 only - // IE <=9 replaces "; - support.option = !!div.lastChild; -} )(); - - -// We have to close these tags to support XHTML (#13200) -var wrapMap = { - - // XHTML parsers do not magically insert elements in the - // same way that tag soup parsers do. So we cannot shorten - // this by omitting or other required elements. - thead: [ 1, "", "
" ], - col: [ 2, "", "
" ], - tr: [ 2, "", "
" ], - td: [ 3, "", "
" ], - - _default: [ 0, "", "" ] -}; - -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// Support: IE <=9 only -if ( !support.option ) { - wrapMap.optgroup = wrapMap.option = [ 1, "" ]; -} - - -function getAll( context, tag ) { - - // Support: IE <=9 - 11 only - // Use typeof to avoid zero-argument method invocation on host objects (#15151) - var ret; - - if ( typeof context.getElementsByTagName !== "undefined" ) { - ret = context.getElementsByTagName( tag || "*" ); - - } else if ( typeof context.querySelectorAll !== "undefined" ) { - ret = context.querySelectorAll( tag || "*" ); - - } else { - ret = []; - } - - if ( tag === undefined || tag && nodeName( context, tag ) ) { - return jQuery.merge( [ context ], ret ); - } - - return ret; -} - - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - dataPriv.set( - elems[ i ], - "globalEval", - !refElements || dataPriv.get( refElements[ i ], "globalEval" ) - ); - } -} - - -var rhtml = /<|&#?\w+;/; - -function buildFragment( elems, context, scripts, selection, ignored ) { - var elem, tmp, tag, wrap, attached, j, - fragment = context.createDocumentFragment(), - nodes = [], - i = 0, - l = elems.length; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( toType( elem ) === "object" ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; - - // Descend through wrappers to the right content - j = wrap[ 0 ]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( nodes, tmp.childNodes ); - - // Remember the top-level container - tmp = fragment.firstChild; - - // Ensure the created nodes are orphaned (#12392) - tmp.textContent = ""; - } - } - } - - // Remove wrapper from fragment - fragment.textContent = ""; - - i = 0; - while ( ( elem = nodes[ i++ ] ) ) { - - // Skip elements already in the context collection (trac-4087) - if ( selection && jQuery.inArray( elem, selection ) > -1 ) { - if ( ignored ) { - ignored.push( elem ); - } - continue; - } - - attached = isAttached( elem ); - - // Append to fragment - tmp = getAll( fragment.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( attached ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( ( elem = tmp[ j++ ] ) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - return fragment; -} - - -var - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -// Support: IE <=9 - 11+ -// focus() and blur() are asynchronous, except when they are no-op. -// So expect focus to be synchronous when the element is already active, -// and blur to be synchronous when the element is not already active. -// (focus and blur are always synchronous in other supported browsers, -// this just defines when we can count on it). -function expectSync( elem, type ) { - return ( elem === safeActiveElement() ) === ( type === "focus" ); -} - -// Support: IE <=9 only -// Accessing document.activeElement can throw unexpectedly -// https://bugs.jquery.com/ticket/13393 -function safeActiveElement() { - try { - return document.activeElement; - } catch ( err ) { } -} - -function on( elem, types, selector, data, fn, one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - on( elem, type, selector, data, types[ type ], one ); - } - return elem; - } - - if ( data == null && fn == null ) { - - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return elem; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return elem.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - } ); -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - - var handleObjIn, eventHandle, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.get( elem ); - - // Only attach events to objects that accept data - if ( !acceptData( elem ) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Ensure that invalid selectors throw exceptions at attach time - // Evaluate against documentElement in case elem is a non-element node (e.g., document) - if ( selector ) { - jQuery.find.matchesSelector( documentElement, selector ); - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !( events = elemData.events ) ) { - events = elemData.events = Object.create( null ); - } - if ( !( eventHandle = elemData.handle ) ) { - eventHandle = elemData.handle = function( e ) { - - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? - jQuery.event.dispatch.apply( elem, arguments ) : undefined; - }; - } - - // Handle multiple events separated by a space - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // There *must* be a type, no attaching namespace-only handlers - if ( !type ) { - continue; - } - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend( { - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join( "." ) - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !( handlers = events[ type ] ) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener if the special events handler returns false - if ( !special.setup || - special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var j, origCount, tmp, - events, t, handleObj, - special, handlers, type, namespaces, origType, - elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); - - if ( !elemData || !( events = elemData.events ) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[ t ] ) || []; - type = origType = tmp[ 1 ]; - namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[ 2 ] && - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || - selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || - special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove data and the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - dataPriv.remove( elem, "handle events" ); - } - }, - - dispatch: function( nativeEvent ) { - - var i, j, ret, matched, handleObj, handlerQueue, - args = new Array( arguments.length ), - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( nativeEvent ), - - handlers = ( - dataPriv.get( this, "events" ) || Object.create( null ) - )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[ 0 ] = event; - - for ( i = 1; i < arguments.length; i++ ) { - args[ i ] = arguments[ i ]; - } - - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( ( handleObj = matched.handlers[ j++ ] ) && - !event.isImmediatePropagationStopped() ) { - - // If the event is namespaced, then each handler is only invoked if it is - // specially universal or its namespaces are a superset of the event's. - if ( !event.rnamespace || handleObj.namespace === false || - event.rnamespace.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || - handleObj.handler ).apply( matched.elem, args ); - - if ( ret !== undefined ) { - if ( ( event.result = ret ) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var i, handleObj, sel, matchedHandlers, matchedSelectors, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - if ( delegateCount && - - // Support: IE <=9 - // Black-hole SVG instance trees (trac-13180) - cur.nodeType && - - // Support: Firefox <=42 - // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) - // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click - // Support: IE 11 only - // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) - !( event.type === "click" && event.button >= 1 ) ) { - - for ( ; cur !== this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { - matchedHandlers = []; - matchedSelectors = {}; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matchedSelectors[ sel ] === undefined ) { - matchedSelectors[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) > -1 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matchedSelectors[ sel ] ) { - matchedHandlers.push( handleObj ); - } - } - if ( matchedHandlers.length ) { - handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); - } - } - } - } - - // Add the remaining (directly-bound) handlers - cur = this; - if ( delegateCount < handlers.length ) { - handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); - } - - return handlerQueue; - }, - - addProp: function( name, hook ) { - Object.defineProperty( jQuery.Event.prototype, name, { - enumerable: true, - configurable: true, - - get: isFunction( hook ) ? - function() { - if ( this.originalEvent ) { - return hook( this.originalEvent ); - } - } : - function() { - if ( this.originalEvent ) { - return this.originalEvent[ name ]; - } - }, - - set: function( value ) { - Object.defineProperty( this, name, { - enumerable: true, - configurable: true, - writable: true, - value: value - } ); - } - } ); - }, - - fix: function( originalEvent ) { - return originalEvent[ jQuery.expando ] ? - originalEvent : - new jQuery.Event( originalEvent ); - }, - - special: { - load: { - - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - - // Utilize native event to ensure correct state for checkable inputs - setup: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Claim the first handler - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - // dataPriv.set( el, "click", ... ) - leverageNative( el, "click", returnTrue ); - } - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function( data ) { - - // For mutual compressibility with _default, replace `this` access with a local var. - // `|| data` is dead code meant only to preserve the variable through minification. - var el = this || data; - - // Force setup before triggering a click - if ( rcheckableType.test( el.type ) && - el.click && nodeName( el, "input" ) ) { - - leverageNative( el, "click" ); - } - - // Return non-false to allow normal event-path propagation - return true; - }, - - // For cross-browser consistency, suppress native .click() on links - // Also prevent it if we're currently inside a leveraged native-event stack - _default: function( event ) { - var target = event.target; - return rcheckableType.test( target.type ) && - target.click && nodeName( target, "input" ) && - dataPriv.get( target, "click" ) || - nodeName( target, "a" ); - } - }, - - beforeunload: { - postDispatch: function( event ) { - - // Support: Firefox 20+ - // Firefox doesn't alert if the returnValue field is not set. - if ( event.result !== undefined && event.originalEvent ) { - event.originalEvent.returnValue = event.result; - } - } - } - } -}; - -// Ensure the presence of an event listener that handles manually-triggered -// synthetic events by interrupting progress until reinvoked in response to -// *native* events that it fires directly, ensuring that state changes have -// already occurred before other listeners are invoked. -function leverageNative( el, type, expectSync ) { - - // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add - if ( !expectSync ) { - if ( dataPriv.get( el, type ) === undefined ) { - jQuery.event.add( el, type, returnTrue ); - } - return; - } - - // Register the controller as a special universal handler for all event namespaces - dataPriv.set( el, type, false ); - jQuery.event.add( el, type, { - namespace: false, - handler: function( event ) { - var notAsync, result, - saved = dataPriv.get( this, type ); - - if ( ( event.isTrigger & 1 ) && this[ type ] ) { - - // Interrupt processing of the outer synthetic .trigger()ed event - // Saved data should be false in such cases, but might be a leftover capture object - // from an async native handler (gh-4350) - if ( !saved.length ) { - - // Store arguments for use when handling the inner native event - // There will always be at least one argument (an event object), so this array - // will not be confused with a leftover capture object. - saved = slice.call( arguments ); - dataPriv.set( this, type, saved ); - - // Trigger the native event and capture its result - // Support: IE <=9 - 11+ - // focus() and blur() are asynchronous - notAsync = expectSync( this, type ); - this[ type ](); - result = dataPriv.get( this, type ); - if ( saved !== result || notAsync ) { - dataPriv.set( this, type, false ); - } else { - result = {}; - } - if ( saved !== result ) { - - // Cancel the outer synthetic event - event.stopImmediatePropagation(); - event.preventDefault(); - return result.value; - } - - // If this is an inner synthetic event for an event with a bubbling surrogate - // (focus or blur), assume that the surrogate already propagated from triggering the - // native event and prevent that from happening again here. - // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the - // bubbling surrogate propagates *after* the non-bubbling base), but that seems - // less bad than duplication. - } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { - event.stopPropagation(); - } - - // If this is a native event triggered above, everything is now in order - // Fire an inner synthetic event with the original arguments - } else if ( saved.length ) { - - // ...and capture the result - dataPriv.set( this, type, { - value: jQuery.event.trigger( - - // Support: IE <=9 - 11+ - // Extend with the prototype to reset the above stopImmediatePropagation() - jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), - saved.slice( 1 ), - this - ) - } ); - - // Abort handling of the native event - event.stopImmediatePropagation(); - } - } - } ); -} - -jQuery.removeEvent = function( elem, type, handle ) { - - // This "if" is needed for plain objects - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle ); - } -}; - -jQuery.Event = function( src, props ) { - - // Allow instantiation without the 'new' keyword - if ( !( this instanceof jQuery.Event ) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = src.defaultPrevented || - src.defaultPrevented === undefined && - - // Support: Android <=2.3 only - src.returnValue === false ? - returnTrue : - returnFalse; - - // Create target properties - // Support: Safari <=6 - 7 only - // Target should not be a text node (#504, #13143) - this.target = ( src.target && src.target.nodeType === 3 ) ? - src.target.parentNode : - src.target; - - this.currentTarget = src.currentTarget; - this.relatedTarget = src.relatedTarget; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || Date.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - constructor: jQuery.Event, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - isSimulated: false, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - - if ( e && !this.isSimulated ) { - e.preventDefault(); - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopPropagation(); - } - }, - stopImmediatePropagation: function() { - var e = this.originalEvent; - - this.isImmediatePropagationStopped = returnTrue; - - if ( e && !this.isSimulated ) { - e.stopImmediatePropagation(); - } - - this.stopPropagation(); - } -}; - -// Includes all common event props including KeyEvent and MouseEvent specific props -jQuery.each( { - altKey: true, - bubbles: true, - cancelable: true, - changedTouches: true, - ctrlKey: true, - detail: true, - eventPhase: true, - metaKey: true, - pageX: true, - pageY: true, - shiftKey: true, - view: true, - "char": true, - code: true, - charCode: true, - key: true, - keyCode: true, - button: true, - buttons: true, - clientX: true, - clientY: true, - offsetX: true, - offsetY: true, - pointerId: true, - pointerType: true, - screenX: true, - screenY: true, - targetTouches: true, - toElement: true, - touches: true, - - which: function( event ) { - var button = event.button; - - // Add which for key events - if ( event.which == null && rkeyEvent.test( event.type ) ) { - return event.charCode != null ? event.charCode : event.keyCode; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { - if ( button & 1 ) { - return 1; - } - - if ( button & 2 ) { - return 3; - } - - if ( button & 4 ) { - return 2; - } - - return 0; - } - - return event.which; - } -}, jQuery.event.addProp ); - -jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { - jQuery.event.special[ type ] = { - - // Utilize native event if possible so blur/focus sequence is correct - setup: function() { - - // Claim the first handler - // dataPriv.set( this, "focus", ... ) - // dataPriv.set( this, "blur", ... ) - leverageNative( this, type, expectSync ); - - // Return false to allow normal processing in the caller - return false; - }, - trigger: function() { - - // Force setup before trigger - leverageNative( this, type ); - - // Return non-false to allow normal event-path propagation - return true; - }, - - delegateType: delegateType - }; -} ); - -// Create mouseenter/leave events using mouseover/out and event-time checks -// so that event delegation works in jQuery. -// Do the same for pointerenter/pointerleave and pointerover/pointerout -// -// Support: Safari 7 only -// Safari sends mouseenter too often; see: -// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 -// for the description of the bug (it existed in older Chrome versions as well). -jQuery.each( { - mouseenter: "mouseover", - mouseleave: "mouseout", - pointerenter: "pointerover", - pointerleave: "pointerout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mouseenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -} ); - -jQuery.fn.extend( { - - on: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn ); - }, - one: function( types, selector, data, fn ) { - return on( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? - handleObj.origType + "." + handleObj.namespace : - handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each( function() { - jQuery.event.remove( this, types, fn, selector ); - } ); - } -} ); - - -var - - // Support: IE <=10 - 11, Edge 12 - 13 only - // In IE/Edge using regex groups here causes severe slowdowns. - // See https://connect.microsoft.com/IE/feedback/details/1736512/ - rnoInnerhtml = /\s*$/g; - -// Prefer a tbody over its parent table for containing new rows -function manipulationTarget( elem, content ) { - if ( nodeName( elem, "table" ) && - nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { - - return jQuery( elem ).children( "tbody" )[ 0 ] || elem; - } - - return elem; -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { - elem.type = elem.type.slice( 5 ); - } else { - elem.removeAttribute( "type" ); - } - - return elem; -} - -function cloneCopyEvent( src, dest ) { - var i, l, type, pdataOld, udataOld, udataCur, events; - - if ( dest.nodeType !== 1 ) { - return; - } - - // 1. Copy private data: events, handlers, etc. - if ( dataPriv.hasData( src ) ) { - pdataOld = dataPriv.get( src ); - events = pdataOld.events; - - if ( events ) { - dataPriv.remove( dest, "handle events" ); - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - } - - // 2. Copy user data - if ( dataUser.hasData( src ) ) { - udataOld = dataUser.access( src ); - udataCur = jQuery.extend( {}, udataOld ); - - dataUser.set( dest, udataCur ); - } -} - -// Fix IE bugs, see support tests -function fixInput( src, dest ) { - var nodeName = dest.nodeName.toLowerCase(); - - // Fails to persist the checked state of a cloned checkbox or radio button. - if ( nodeName === "input" && rcheckableType.test( src.type ) ) { - dest.checked = src.checked; - - // Fails to return the selected option to the default selected state when cloning options - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -function domManip( collection, args, callback, ignored ) { - - // Flatten any nested arrays - args = flat( args ); - - var fragment, first, scripts, hasScripts, node, doc, - i = 0, - l = collection.length, - iNoClone = l - 1, - value = args[ 0 ], - valueIsFunction = isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( valueIsFunction || - ( l > 1 && typeof value === "string" && - !support.checkClone && rchecked.test( value ) ) ) { - return collection.each( function( index ) { - var self = collection.eq( index ); - if ( valueIsFunction ) { - args[ 0 ] = value.call( this, index, self.html() ); - } - domManip( self, args, callback, ignored ); - } ); - } - - if ( l ) { - fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - // Require either new content or an interest in ignored elements to invoke the callback - if ( first || ignored ) { - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item - // instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - - // Support: Android <=4.0 only, PhantomJS 1 only - // push.apply(_, arraylike) throws on ancient WebKit - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( collection[ i ], node, i ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !dataPriv.access( node, "globalEval" ) && - jQuery.contains( doc, node ) ) { - - if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { - - // Optional AJAX dependency, but won't run scripts if not present - if ( jQuery._evalUrl && !node.noModule ) { - jQuery._evalUrl( node.src, { - nonce: node.nonce || node.getAttribute( "nonce" ) - }, doc ); - } - } else { - DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); - } - } - } - } - } - } - - return collection; -} - -function remove( elem, selector, keepData ) { - var node, - nodes = selector ? jQuery.filter( selector, elem ) : elem, - i = 0; - - for ( ; ( node = nodes[ i ] ) != null; i++ ) { - if ( !keepData && node.nodeType === 1 ) { - jQuery.cleanData( getAll( node ) ); - } - - if ( node.parentNode ) { - if ( keepData && isAttached( node ) ) { - setGlobalEval( getAll( node, "script" ) ); - } - node.parentNode.removeChild( node ); - } - } - - return elem; -} - -jQuery.extend( { - htmlPrefilter: function( html ) { - return html; - }, - - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var i, l, srcElements, destElements, - clone = elem.cloneNode( true ), - inPage = isAttached( elem ); - - // Fix IE cloning issues - if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && - !jQuery.isXMLDoc( elem ) ) { - - // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - fixInput( srcElements[ i ], destElements[ i ] ); - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0, l = srcElements.length; i < l; i++ ) { - cloneCopyEvent( srcElements[ i ], destElements[ i ] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - // Return the cloned set - return clone; - }, - - cleanData: function( elems ) { - var data, elem, type, - special = jQuery.event.special, - i = 0; - - for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { - if ( acceptData( elem ) ) { - if ( ( data = elem[ dataPriv.expando ] ) ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataPriv.expando ] = undefined; - } - if ( elem[ dataUser.expando ] ) { - - // Support: Chrome <=35 - 45+ - // Assign undefined instead of using delete, see Data#remove - elem[ dataUser.expando ] = undefined; - } - } - } - } -} ); - -jQuery.fn.extend( { - detach: function( selector ) { - return remove( this, selector, true ); - }, - - remove: function( selector ) { - return remove( this, selector ); - }, - - text: function( value ) { - return access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().each( function() { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.textContent = value; - } - } ); - }, null, value, arguments.length ); - }, - - append: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.appendChild( elem ); - } - } ); - }, - - prepend: function() { - return domManip( this, arguments, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - var target = manipulationTarget( this, elem ); - target.insertBefore( elem, target.firstChild ); - } - } ); - }, - - before: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - } ); - }, - - after: function() { - return domManip( this, arguments, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - } ); - }, - - empty: function() { - var elem, - i = 0; - - for ( ; ( elem = this[ i ] ) != null; i++ ) { - if ( elem.nodeType === 1 ) { - - // Prevent memory leaks - jQuery.cleanData( getAll( elem, false ) ); - - // Remove any remaining nodes - elem.textContent = ""; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function() { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - } ); - }, - - html: function( value ) { - return access( this, function( value ) { - var elem = this[ 0 ] || {}, - i = 0, - l = this.length; - - if ( value === undefined && elem.nodeType === 1 ) { - return elem.innerHTML; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { - - value = jQuery.htmlPrefilter( value ); - - try { - for ( ; i < l; i++ ) { - elem = this[ i ] || {}; - - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch ( e ) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function() { - var ignored = []; - - // Make the changes, replacing each non-ignored context element with the new content - return domManip( this, arguments, function( elem ) { - var parent = this.parentNode; - - if ( jQuery.inArray( this, ignored ) < 0 ) { - jQuery.cleanData( getAll( this ) ); - if ( parent ) { - parent.replaceChild( elem, this ); - } - } - - // Force callback invocation - }, ignored ); - } -} ); - -jQuery.each( { - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1, - i = 0; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone( true ); - jQuery( insert[ i ] )[ original ]( elems ); - - // Support: Android <=4.0 only, PhantomJS 1 only - // .get() because push.apply(_, arraylike) throws on ancient WebKit - push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -} ); -var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); - -var getStyles = function( elem ) { - - // Support: IE <=11 only, Firefox <=30 (#15098, #14150) - // IE throws on elements created in popups - // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" - var view = elem.ownerDocument.defaultView; - - if ( !view || !view.opener ) { - view = window; - } - - return view.getComputedStyle( elem ); - }; - -var swap = function( elem, options, callback ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.call( elem ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; -}; - - -var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); - - - -( function() { - - // Executing both pixelPosition & boxSizingReliable tests require only one layout - // so they're executed at the same time to save the second computation. - function computeStyleTests() { - - // This is a singleton, we need to execute it only once - if ( !div ) { - return; - } - - container.style.cssText = "position:absolute;left:-11111px;width:60px;" + - "margin-top:1px;padding:0;border:0"; - div.style.cssText = - "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + - "margin:auto;border:1px;padding:1px;" + - "width:60%;top:1%"; - documentElement.appendChild( container ).appendChild( div ); - - var divStyle = window.getComputedStyle( div ); - pixelPositionVal = divStyle.top !== "1%"; - - // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 - reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; - - // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 - // Some styles come back with percentage values, even though they shouldn't - div.style.right = "60%"; - pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; - - // Support: IE 9 - 11 only - // Detect misreporting of content dimensions for box-sizing:border-box elements - boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; - - // Support: IE 9 only - // Detect overflow:scroll screwiness (gh-3699) - // Support: Chrome <=64 - // Don't get tricked when zoom affects offsetWidth (gh-4029) - div.style.position = "absolute"; - scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; - - documentElement.removeChild( container ); - - // Nullify the div so it wouldn't be stored in the memory and - // it will also be a sign that checks already performed - div = null; - } - - function roundPixelMeasures( measure ) { - return Math.round( parseFloat( measure ) ); - } - - var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, - reliableTrDimensionsVal, reliableMarginLeftVal, - container = document.createElement( "div" ), - div = document.createElement( "div" ); - - // Finish early in limited (non-browser) environments - if ( !div.style ) { - return; - } - - // Support: IE <=9 - 11 only - // Style of cloned element affects source element cloned (#8908) - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - jQuery.extend( support, { - boxSizingReliable: function() { - computeStyleTests(); - return boxSizingReliableVal; - }, - pixelBoxStyles: function() { - computeStyleTests(); - return pixelBoxStylesVal; - }, - pixelPosition: function() { - computeStyleTests(); - return pixelPositionVal; - }, - reliableMarginLeft: function() { - computeStyleTests(); - return reliableMarginLeftVal; - }, - scrollboxSize: function() { - computeStyleTests(); - return scrollboxSizeVal; - }, - - // Support: IE 9 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Behavior in IE 9 is more subtle than in newer versions & it passes - // some versions of this test; make sure not to make it pass there! - reliableTrDimensions: function() { - var table, tr, trChild, trStyle; - if ( reliableTrDimensionsVal == null ) { - table = document.createElement( "table" ); - tr = document.createElement( "tr" ); - trChild = document.createElement( "div" ); - - table.style.cssText = "position:absolute;left:-11111px"; - tr.style.height = "1px"; - trChild.style.height = "9px"; - - documentElement - .appendChild( table ) - .appendChild( tr ) - .appendChild( trChild ); - - trStyle = window.getComputedStyle( tr ); - reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; - - documentElement.removeChild( table ); - } - return reliableTrDimensionsVal; - } - } ); -} )(); - - -function curCSS( elem, name, computed ) { - var width, minWidth, maxWidth, ret, - - // Support: Firefox 51+ - // Retrieving style before computed somehow - // fixes an issue with getting wrong values - // on detached elements - style = elem.style; - - computed = computed || getStyles( elem ); - - // getPropertyValue is needed for: - // .css('filter') (IE 9 only, #12537) - // .css('--customProperty) (#3144) - if ( computed ) { - ret = computed.getPropertyValue( name ) || computed[ name ]; - - if ( ret === "" && !isAttached( elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Android Browser returns percentage for some values, - // but width seems to be reliably pixels. - // This is against the CSSOM draft spec: - // https://drafts.csswg.org/cssom/#resolved-values - if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret !== undefined ? - - // Support: IE <=9 - 11 only - // IE returns zIndex value as an integer. - ret + "" : - ret; -} - - -function addGetHookIf( conditionFn, hookFn ) { - - // Define the hook, we'll check on the first run if it's really needed. - return { - get: function() { - if ( conditionFn() ) { - - // Hook not needed (or it's not possible to use it due - // to missing dependency), remove it. - delete this.get; - return; - } - - // Hook needed; redefine it so that the support test is not executed again. - return ( this.get = hookFn ).apply( this, arguments ); - } - }; -} - - -var cssPrefixes = [ "Webkit", "Moz", "ms" ], - emptyStyle = document.createElement( "div" ).style, - vendorProps = {}; - -// Return a vendor-prefixed property or undefined -function vendorPropName( name ) { - - // Check for vendor prefixed names - var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in emptyStyle ) { - return name; - } - } -} - -// Return a potentially-mapped jQuery.cssProps or vendor prefixed property -function finalPropName( name ) { - var final = jQuery.cssProps[ name ] || vendorProps[ name ]; - - if ( final ) { - return final; - } - if ( name in emptyStyle ) { - return name; - } - return vendorProps[ name ] = vendorPropName( name ) || name; -} - - -var - - // Swappable if display is none or starts with table - // except "table", "table-cell", or "table-caption" - // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rcustomProp = /^--/, - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: "0", - fontWeight: "400" - }; - -function setPositiveNumber( _elem, value, subtract ) { - - // Any relative (+/-) values have already been - // normalized at this point - var matches = rcssNum.exec( value ); - return matches ? - - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : - value; -} - -function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { - var i = dimension === "width" ? 1 : 0, - extra = 0, - delta = 0; - - // Adjustment may not be necessary - if ( box === ( isBorderBox ? "border" : "content" ) ) { - return 0; - } - - for ( ; i < 4; i += 2 ) { - - // Both box models exclude margin - if ( box === "margin" ) { - delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); - } - - // If we get here with a content-box, we're seeking "padding" or "border" or "margin" - if ( !isBorderBox ) { - - // Add padding - delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // For "border" or "margin", add border - if ( box !== "padding" ) { - delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - - // But still keep track of it otherwise - } else { - extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - - // If we get here with a border-box (content + padding + border), we're seeking "content" or - // "padding" or "margin" - } else { - - // For "content", subtract padding - if ( box === "content" ) { - delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // For "content" or "padding", subtract border - if ( box !== "margin" ) { - delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - // Account for positive content-box scroll gutter when requested by providing computedVal - if ( !isBorderBox && computedVal >= 0 ) { - - // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border - // Assuming integer scroll gutter, subtract the rest and round down - delta += Math.max( 0, Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - computedVal - - delta - - extra - - 0.5 - - // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter - // Use an explicit zero to avoid NaN (gh-3964) - ) ) || 0; - } - - return delta; -} - -function getWidthOrHeight( elem, dimension, extra ) { - - // Start with computed style - var styles = getStyles( elem ), - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). - // Fake content-box until we know it's needed to know the true value. - boxSizingNeeded = !support.boxSizingReliable() || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - valueIsBorderBox = isBorderBox, - - val = curCSS( elem, dimension, styles ), - offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); - - // Support: Firefox <=54 - // Return a confounding non-pixel value or feign ignorance, as appropriate. - if ( rnumnonpx.test( val ) ) { - if ( !extra ) { - return val; - } - val = "auto"; - } - - - // Support: IE 9 - 11 only - // Use offsetWidth/offsetHeight for when box sizing is unreliable. - // In those cases, the computed value can be trusted to be border-box. - if ( ( !support.boxSizingReliable() && isBorderBox || - - // Support: IE 10 - 11+, Edge 15 - 18+ - // IE/Edge misreport `getComputedStyle` of table rows with width/height - // set in CSS while `offset*` properties report correct values. - // Interestingly, in some cases IE 9 doesn't suffer from this issue. - !support.reliableTrDimensions() && nodeName( elem, "tr" ) || - - // Fall back to offsetWidth/offsetHeight when value is "auto" - // This happens for inline elements with no explicit setting (gh-3571) - val === "auto" || - - // Support: Android <=4.1 - 4.3 only - // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) - !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && - - // Make sure the element is visible & connected - elem.getClientRects().length ) { - - isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // Where available, offsetWidth/offsetHeight approximate border box dimensions. - // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the - // retrieved value as a content box dimension. - valueIsBorderBox = offsetProp in elem; - if ( valueIsBorderBox ) { - val = elem[ offsetProp ]; - } - } - - // Normalize "" and auto - val = parseFloat( val ) || 0; - - // Adjust for the element's box model - return ( val + - boxModelAdjustment( - elem, - dimension, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles, - - // Provide the current computed size to request scroll gutter calculation (gh-3589) - val - ) - ) + "px"; -} - -jQuery.extend( { - - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Don't automatically add "px" to these possibly-unitless properties - cssNumber: { - "animationIterationCount": true, - "columnCount": true, - "fillOpacity": true, - "flexGrow": true, - "flexShrink": true, - "fontWeight": true, - "gridArea": true, - "gridColumn": true, - "gridColumnEnd": true, - "gridColumnStart": true, - "gridRow": true, - "gridRowEnd": true, - "gridRowStart": true, - "lineHeight": true, - "opacity": true, - "order": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: {}, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ), - style = elem.style; - - // Make sure that we're working with the right name. We don't - // want to query the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Gets hook for the prefixed version, then unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // Convert "+=" or "-=" to relative numbers (#7345) - if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { - value = adjustCSS( elem, name, ret ); - - // Fixes bug #9237 - type = "number"; - } - - // Make sure that null and NaN values aren't set (#7116) - if ( value == null || value !== value ) { - return; - } - - // If a number was passed in, add the unit (except for certain CSS properties) - // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append - // "px" to a few hardcoded values. - if ( type === "number" && !isCustomProp ) { - value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); - } - - // background-* props affect original clone's values - if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !( "set" in hooks ) || - ( value = hooks.set( elem, value, extra ) ) !== undefined ) { - - if ( isCustomProp ) { - style.setProperty( name, value ); - } else { - style[ name ] = value; - } - } - - } else { - - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && - ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { - - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var val, num, hooks, - origName = camelCase( name ), - isCustomProp = rcustomProp.test( name ); - - // Make sure that we're working with the right name. We don't - // want to modify the value if it is a CSS custom property - // since they are user-defined. - if ( !isCustomProp ) { - name = finalPropName( origName ); - } - - // Try prefixed name followed by the unprefixed name - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - // Convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Make numeric if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || isFinite( num ) ? num || 0 : val; - } - - return val; - } -} ); - -jQuery.each( [ "height", "width" ], function( _i, dimension ) { - jQuery.cssHooks[ dimension ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - - // Certain elements can have dimension info if we invisibly show them - // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && - - // Support: Safari 8+ - // Table columns in Safari have non-zero offsetWidth & zero - // getBoundingClientRect().width unless display is changed. - // Support: IE <=11 only - // Running getBoundingClientRect on a disconnected node - // in IE throws an error. - ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? - swap( elem, cssShow, function() { - return getWidthOrHeight( elem, dimension, extra ); - } ) : - getWidthOrHeight( elem, dimension, extra ); - } - }, - - set: function( elem, value, extra ) { - var matches, - styles = getStyles( elem ), - - // Only read styles.position if the test has a chance to fail - // to avoid forcing a reflow. - scrollboxSizeBuggy = !support.scrollboxSize() && - styles.position === "absolute", - - // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) - boxSizingNeeded = scrollboxSizeBuggy || extra, - isBorderBox = boxSizingNeeded && - jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - subtract = extra ? - boxModelAdjustment( - elem, - dimension, - extra, - isBorderBox, - styles - ) : - 0; - - // Account for unreliable border-box dimensions by comparing offset* to computed and - // faking a content-box to get border and padding (gh-3699) - if ( isBorderBox && scrollboxSizeBuggy ) { - subtract -= Math.ceil( - elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - - parseFloat( styles[ dimension ] ) - - boxModelAdjustment( elem, dimension, "border", false, styles ) - - 0.5 - ); - } - - // Convert to pixels if value adjustment is needed - if ( subtract && ( matches = rcssNum.exec( value ) ) && - ( matches[ 3 ] || "px" ) !== "px" ) { - - elem.style[ dimension ] = value; - value = jQuery.css( elem, dimension ); - } - - return setPositiveNumber( elem, value, subtract ); - } - }; -} ); - -jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, - function( elem, computed ) { - if ( computed ) { - return ( parseFloat( curCSS( elem, "marginLeft" ) ) || - elem.getBoundingClientRect().left - - swap( elem, { marginLeft: 0 }, function() { - return elem.getBoundingClientRect().left; - } ) - ) + "px"; - } - } -); - -// These hooks are used by animate to expand properties -jQuery.each( { - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // Assumes a single number if not a string - parts = typeof value === "string" ? value.split( " " ) : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( prefix !== "margin" ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -} ); - -jQuery.fn.extend( { - css: function( name, value ) { - return access( this, function( elem, name, value ) { - var styles, len, - map = {}, - i = 0; - - if ( Array.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - } -} ); - - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || jQuery.easing._default; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - // Use a property on the element directly when it is not a DOM element, - // or when there is no matching style property that exists. - if ( tween.elem.nodeType !== 1 || - tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { - return tween.elem[ tween.prop ]; - } - - // Passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails. - // Simple values such as "10px" are parsed to Float; - // complex values such as "rotate(1rad)" are returned as-is. - result = jQuery.css( tween.elem, tween.prop, "" ); - - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - - // Use step hook for back compat. - // Use cssHook if its there. - // Use .style if available and use plain properties where available. - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.nodeType === 1 && ( - jQuery.cssHooks[ tween.prop ] || - tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Support: IE <=9 only -// Panic based approach to setting things on disconnected nodes -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p * Math.PI ) / 2; - }, - _default: "swing" -}; - -jQuery.fx = Tween.prototype.init; - -// Back compat <1.8 extension point -jQuery.fx.step = {}; - - - - -var - fxNow, inProgress, - rfxtypes = /^(?:toggle|show|hide)$/, - rrun = /queueHooks$/; - -function schedule() { - if ( inProgress ) { - if ( document.hidden === false && window.requestAnimationFrame ) { - window.requestAnimationFrame( schedule ); - } else { - window.setTimeout( schedule, jQuery.fx.interval ); - } - - jQuery.fx.tick(); - } -} - -// Animations created synchronously will run synchronously -function createFxNow() { - window.setTimeout( function() { - fxNow = undefined; - } ); - return ( fxNow = Date.now() ); -} - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - i = 0, - attrs = { height: type }; - - // If we include width, step value is 1 to do all cssExpand values, - // otherwise step value is 2 to skip over Left and Right - includeWidth = includeWidth ? 1 : 0; - for ( ; i < 4; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -function createTween( value, prop, animation ) { - var tween, - collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { - - // We're done with this property - return tween; - } - } -} - -function defaultPrefilter( elem, props, opts ) { - var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, - isBox = "width" in props || "height" in props, - anim = this, - orig = {}, - style = elem.style, - hidden = elem.nodeType && isHiddenWithinTree( elem ), - dataShow = dataPriv.get( elem, "fxshow" ); - - // Queue-skipping animations hijack the fx hooks - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always( function() { - - // Ensure the complete handler is called before this completes - anim.always( function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - } ); - } ); - } - - // Detect show/hide animations - for ( prop in props ) { - value = props[ prop ]; - if ( rfxtypes.test( value ) ) { - delete props[ prop ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - - // Pretend to be hidden if this is a "show" and - // there is still data from a stopped show/hide - if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { - hidden = true; - - // Ignore all other no-op show/hide data - } else { - continue; - } - } - orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); - } - } - - // Bail out if this is a no-op like .hide().hide() - propTween = !jQuery.isEmptyObject( props ); - if ( !propTween && jQuery.isEmptyObject( orig ) ) { - return; - } - - // Restrict "overflow" and "display" styles during box animations - if ( isBox && elem.nodeType === 1 ) { - - // Support: IE <=9 - 11, Edge 12 - 15 - // Record all 3 overflow attributes because IE does not infer the shorthand - // from identically-valued overflowX and overflowY and Edge just mirrors - // the overflowX value there. - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Identify a display type, preferring old show/hide data over the CSS cascade - restoreDisplay = dataShow && dataShow.display; - if ( restoreDisplay == null ) { - restoreDisplay = dataPriv.get( elem, "display" ); - } - display = jQuery.css( elem, "display" ); - if ( display === "none" ) { - if ( restoreDisplay ) { - display = restoreDisplay; - } else { - - // Get nonempty value(s) by temporarily forcing visibility - showHide( [ elem ], true ); - restoreDisplay = elem.style.display || restoreDisplay; - display = jQuery.css( elem, "display" ); - showHide( [ elem ] ); - } - } - - // Animate inline elements as inline-block - if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { - if ( jQuery.css( elem, "float" ) === "none" ) { - - // Restore the original display value at the end of pure show/hide animations - if ( !propTween ) { - anim.done( function() { - style.display = restoreDisplay; - } ); - if ( restoreDisplay == null ) { - display = style.display; - restoreDisplay = display === "none" ? "" : display; - } - } - style.display = "inline-block"; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - anim.always( function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - } ); - } - - // Implement show/hide animations - propTween = false; - for ( prop in orig ) { - - // General show/hide setup for this element animation - if ( !propTween ) { - if ( dataShow ) { - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - } else { - dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); - } - - // Store hidden/visible for toggle so `.stop().toggle()` "reverses" - if ( toggle ) { - dataShow.hidden = !hidden; - } - - // Show elements before animating them - if ( hidden ) { - showHide( [ elem ], true ); - } - - /* eslint-disable no-loop-func */ - - anim.done( function() { - - /* eslint-enable no-loop-func */ - - // The final step of a "hide" animation is actually hiding the element - if ( !hidden ) { - showHide( [ elem ] ); - } - dataPriv.remove( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - } ); - } - - // Per-property setup - propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = propTween.start; - if ( hidden ) { - propTween.end = propTween.start; - propTween.start = 0; - } - } - } -} - -function propFilter( props, specialEasing ) { - var index, name, easing, value, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( Array.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // Not quite $.extend, this won't overwrite existing keys. - // Reusing 'index' because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = Animation.prefilters.length, - deferred = jQuery.Deferred().always( function() { - - // Don't match elem in the :animated selector - delete tick.elem; - } ), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - - // Support: Android 2.3 only - // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ] ); - - // If there's more to do, yield - if ( percent < 1 && length ) { - return remaining; - } - - // If this was an empty animation, synthesize a final progress notification - if ( !length ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - } - - // Resolve the animation and report its conclusion - deferred.resolveWith( elem, [ animation ] ); - return false; - }, - animation = deferred.promise( { - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { - specialEasing: {}, - easing: jQuery.easing._default - }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - - // If we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // Resolve when we played the last frame; otherwise, reject - if ( gotoEnd ) { - deferred.notifyWith( elem, [ animation, 1, 0 ] ); - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - } ), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length; index++ ) { - result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - if ( isFunction( result.stop ) ) { - jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = - result.stop.bind( result ); - } - return result; - } - } - - jQuery.map( props, createTween, animation ); - - if ( isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - // Attach callbacks from options - animation - .progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - } ) - ); - - return animation; -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweeners: { - "*": [ function( prop, value ) { - var tween = this.createTween( prop, value ); - adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); - return tween; - } ] - }, - - tweener: function( props, callback ) { - if ( isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.match( rnothtmlwhite ); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length; index++ ) { - prop = props[ index ]; - Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; - Animation.tweeners[ prop ].unshift( callback ); - } - }, - - prefilters: [ defaultPrefilter ], - - prefilter: function( callback, prepend ) { - if ( prepend ) { - Animation.prefilters.unshift( callback ); - } else { - Animation.prefilters.push( callback ); - } - } -} ); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !isFunction( easing ) && easing - }; - - // Go to the end state if fx are off - if ( jQuery.fx.off ) { - opt.duration = 0; - - } else { - if ( typeof opt.duration !== "number" ) { - if ( opt.duration in jQuery.fx.speeds ) { - opt.duration = jQuery.fx.speeds[ opt.duration ]; - - } else { - opt.duration = jQuery.fx.speeds._default; - } - } - } - - // Normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.fn.extend( { - fadeTo: function( speed, to, easing, callback ) { - - // Show any hidden elements after setting opacity to 0 - return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() - - // Animate to the value specified - .end().animate( { opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - - // Empty animations, or finishing resolves immediately - if ( empty || dataPriv.get( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue ) { - this.queue( type || "fx", [] ); - } - - return this.each( function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = dataPriv.get( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && - ( type == null || timers[ index ].queue === type ) ) { - - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // Start the next in the queue if the last step wasn't forced. - // Timers currently will call their complete callbacks, which - // will dequeue but only if they were gotoEnd. - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - } ); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each( function() { - var index, - data = dataPriv.get( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // Enable finishing flag on private data - data.finish = true; - - // Empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.stop ) { - hooks.stop.call( this, true ); - } - - // Look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // Look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // Turn off finishing flag - delete data.finish; - } ); - } -} ); - -jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -} ); - -// Generate shortcuts for custom animations -jQuery.each( { - slideDown: genFx( "show" ), - slideUp: genFx( "hide" ), - slideToggle: genFx( "toggle" ), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -} ); - -jQuery.timers = []; -jQuery.fx.tick = function() { - var timer, - i = 0, - timers = jQuery.timers; - - fxNow = Date.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - - // Run the timer and safely remove it when done (allowing for external removal) - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - jQuery.timers.push( timer ); - jQuery.fx.start(); -}; - -jQuery.fx.interval = 13; -jQuery.fx.start = function() { - if ( inProgress ) { - return; - } - - inProgress = true; - schedule(); -}; - -jQuery.fx.stop = function() { - inProgress = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - - // Default speed - _default: 400 -}; - - -// Based off of the plugin by Clint Helfers, with permission. -// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ -jQuery.fn.delay = function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = window.setTimeout( next, time ); - hooks.stop = function() { - window.clearTimeout( timeout ); - }; - } ); -}; - - -( function() { - var input = document.createElement( "input" ), - select = document.createElement( "select" ), - opt = select.appendChild( document.createElement( "option" ) ); - - input.type = "checkbox"; - - // Support: Android <=4.3 only - // Default value for a checkbox should be "on" - support.checkOn = input.value !== ""; - - // Support: IE <=11 only - // Must access selectedIndex to make default options select - support.optSelected = opt.selected; - - // Support: IE <=11 only - // An input loses its value after becoming a radio - input = document.createElement( "input" ); - input.value = "t"; - input.type = "radio"; - support.radioValue = input.value === "t"; -} )(); - - -var boolHook, - attrHandle = jQuery.expr.attrHandle; - -jQuery.fn.extend( { - attr: function( name, value ) { - return access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each( function() { - jQuery.removeAttr( this, name ); - } ); - } -} ); - -jQuery.extend( { - attr: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set attributes on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - // Attribute hooks are determined by the lowercase version - // Grab necessary hook if one is defined - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - hooks = jQuery.attrHooks[ name.toLowerCase() ] || - ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); - } - - if ( value !== undefined ) { - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - } - - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - elem.setAttribute( name, value + "" ); - return value; - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - ret = jQuery.find.attr( elem, name ); - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? undefined : ret; - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !support.radioValue && value === "radio" && - nodeName( elem, "input" ) ) { - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - removeAttr: function( elem, value ) { - var name, - i = 0, - - // Attribute names can contain non-HTML whitespace characters - // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - attrNames = value && value.match( rnothtmlwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( ( name = attrNames[ i++ ] ) ) { - elem.removeAttribute( name ); - } - } - } -} ); - -// Hooks for boolean attributes -boolHook = { - set: function( elem, value, name ) { - if ( value === false ) { - - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - elem.setAttribute( name, name ); - } - return name; - } -}; - -jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { - var getter = attrHandle[ name ] || jQuery.find.attr; - - attrHandle[ name ] = function( elem, name, isXML ) { - var ret, handle, - lowercaseName = name.toLowerCase(); - - if ( !isXML ) { - - // Avoid an infinite loop by temporarily removing this function from the getter - handle = attrHandle[ lowercaseName ]; - attrHandle[ lowercaseName ] = ret; - ret = getter( elem, name, isXML ) != null ? - lowercaseName : - null; - attrHandle[ lowercaseName ] = handle; - } - return ret; - }; -} ); - - - - -var rfocusable = /^(?:input|select|textarea|button)$/i, - rclickable = /^(?:a|area)$/i; - -jQuery.fn.extend( { - prop: function( name, value ) { - return access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - return this.each( function() { - delete this[ jQuery.propFix[ name ] || name ]; - } ); - } -} ); - -jQuery.extend( { - prop: function( elem, name, value ) { - var ret, hooks, - nType = elem.nodeType; - - // Don't get/set properties on text, comment and attribute nodes - if ( nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { - - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && - ( ret = hooks.set( elem, value, name ) ) !== undefined ) { - return ret; - } - - return ( elem[ name ] = value ); - } - - if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { - return ret; - } - - return elem[ name ]; - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - - // Support: IE <=9 - 11 only - // elem.tabIndex doesn't always return the - // correct value when it hasn't been explicitly set - // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - // Use proper attribute retrieval(#12072) - var tabindex = jQuery.find.attr( elem, "tabindex" ); - - if ( tabindex ) { - return parseInt( tabindex, 10 ); - } - - if ( - rfocusable.test( elem.nodeName ) || - rclickable.test( elem.nodeName ) && - elem.href - ) { - return 0; - } - - return -1; - } - } - }, - - propFix: { - "for": "htmlFor", - "class": "className" - } -} ); - -// Support: IE <=11 only -// Accessing the selectedIndex property -// forces the browser to respect setting selected -// on the option -// The getter ensures a default option is selected -// when in an optgroup -// eslint rule "no-unused-expressions" is disabled for this code -// since it considers such accessions noop -if ( !support.optSelected ) { - jQuery.propHooks.selected = { - get: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent && parent.parentNode ) { - parent.parentNode.selectedIndex; - } - return null; - }, - set: function( elem ) { - - /* eslint no-unused-expressions: "off" */ - - var parent = elem.parentNode; - if ( parent ) { - parent.selectedIndex; - - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - } - }; -} - -jQuery.each( [ - "tabIndex", - "readOnly", - "maxLength", - "cellSpacing", - "cellPadding", - "rowSpan", - "colSpan", - "useMap", - "frameBorder", - "contentEditable" -], function() { - jQuery.propFix[ this.toLowerCase() ] = this; -} ); - - - - - // Strip and collapse whitespace according to HTML spec - // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace - function stripAndCollapse( value ) { - var tokens = value.match( rnothtmlwhite ) || []; - return tokens.join( " " ); - } - - -function getClass( elem ) { - return elem.getAttribute && elem.getAttribute( "class" ) || ""; -} - -function classesToArray( value ) { - if ( Array.isArray( value ) ) { - return value; - } - if ( typeof value === "string" ) { - return value.match( rnothtmlwhite ) || []; - } - return []; -} - -jQuery.fn.extend( { - addClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, curValue, clazz, j, finalValue, - i = 0; - - if ( isFunction( value ) ) { - return this.each( function( j ) { - jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); - } ); - } - - if ( !arguments.length ) { - return this.attr( "class", "" ); - } - - classes = classesToArray( value ); - - if ( classes.length ) { - while ( ( elem = this[ i++ ] ) ) { - curValue = getClass( elem ); - - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); - - if ( cur ) { - j = 0; - while ( ( clazz = classes[ j++ ] ) ) { - - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) > -1 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - - // Only assign if different to avoid unneeded rendering. - finalValue = stripAndCollapse( cur ); - if ( curValue !== finalValue ) { - elem.setAttribute( "class", finalValue ); - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isValidValue = type === "string" || Array.isArray( value ); - - if ( typeof stateVal === "boolean" && isValidValue ) { - return stateVal ? this.addClass( value ) : this.removeClass( value ); - } - - if ( isFunction( value ) ) { - return this.each( function( i ) { - jQuery( this ).toggleClass( - value.call( this, i, getClass( this ), stateVal ), - stateVal - ); - } ); - } - - return this.each( function() { - var className, i, self, classNames; - - if ( isValidValue ) { - - // Toggle individual class names - i = 0; - self = jQuery( this ); - classNames = classesToArray( value ); - - while ( ( className = classNames[ i++ ] ) ) { - - // Check each className given, space separated list - if ( self.hasClass( className ) ) { - self.removeClass( className ); - } else { - self.addClass( className ); - } - } - - // Toggle whole class name - } else if ( value === undefined || type === "boolean" ) { - className = getClass( this ); - if ( className ) { - - // Store className if set - dataPriv.set( this, "__className__", className ); - } - - // If the element has a class name or if we're passed `false`, - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - if ( this.setAttribute ) { - this.setAttribute( "class", - className || value === false ? - "" : - dataPriv.get( this, "__className__" ) || "" - ); - } - } - } ); - }, - - hasClass: function( selector ) { - var className, elem, - i = 0; - - className = " " + selector + " "; - while ( ( elem = this[ i++ ] ) ) { - if ( elem.nodeType === 1 && - ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { - return true; - } - } - - return false; - } -} ); - - - - -var rreturn = /\r/g; - -jQuery.fn.extend( { - val: function( value ) { - var hooks, ret, valueIsFunction, - elem = this[ 0 ]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || - jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && - "get" in hooks && - ( ret = hooks.get( elem, "value" ) ) !== undefined - ) { - return ret; - } - - ret = elem.value; - - // Handle most common string cases - if ( typeof ret === "string" ) { - return ret.replace( rreturn, "" ); - } - - // Handle cases where value is null/undef or number - return ret == null ? "" : ret; - } - - return; - } - - valueIsFunction = isFunction( value ); - - return this.each( function( i ) { - var val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( valueIsFunction ) { - val = value.call( this, i, jQuery( this ).val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - - } else if ( typeof val === "number" ) { - val += ""; - - } else if ( Array.isArray( val ) ) { - val = jQuery.map( val, function( value ) { - return value == null ? "" : value + ""; - } ); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - } ); - } -} ); - -jQuery.extend( { - valHooks: { - option: { - get: function( elem ) { - - var val = jQuery.find.attr( elem, "value" ); - return val != null ? - val : - - // Support: IE <=10 - 11 only - // option.text throws exceptions (#14686, #14858) - // Strip and collapse whitespace - // https://html.spec.whatwg.org/#strip-and-collapse-whitespace - stripAndCollapse( jQuery.text( elem ) ); - } - }, - select: { - get: function( elem ) { - var value, option, i, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one", - values = one ? null : [], - max = one ? index + 1 : options.length; - - if ( index < 0 ) { - i = max; - - } else { - i = one ? index : 0; - } - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Support: IE <=9 only - // IE8-9 doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - - // Don't return options that are disabled or in a disabled optgroup - !option.disabled && - ( !option.parentNode.disabled || - !nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var optionSet, option, - options = elem.options, - values = jQuery.makeArray( value ), - i = options.length; - - while ( i-- ) { - option = options[ i ]; - - /* eslint-disable no-cond-assign */ - - if ( option.selected = - jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 - ) { - optionSet = true; - } - - /* eslint-enable no-cond-assign */ - } - - // Force browsers to behave consistently when non-matching value is set - if ( !optionSet ) { - elem.selectedIndex = -1; - } - return values; - } - } - } -} ); - -// Radios and checkboxes getter/setter -jQuery.each( [ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - set: function( elem, value ) { - if ( Array.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); - } - } - }; - if ( !support.checkOn ) { - jQuery.valHooks[ this ].get = function( elem ) { - return elem.getAttribute( "value" ) === null ? "on" : elem.value; - }; - } -} ); - - - - -// Return jQuery for attributes-only inclusion - - -support.focusin = "onfocusin" in window; - - -var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - stopPropagationCallback = function( e ) { - e.stopPropagation(); - }; - -jQuery.extend( jQuery.event, { - - trigger: function( event, data, elem, onlyHandlers ) { - - var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, - eventPath = [ elem || document ], - type = hasOwn.call( event, "type" ) ? event.type : event, - namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; - - cur = lastElement = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "." ) > -1 ) { - - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split( "." ); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf( ":" ) < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) - event.isTrigger = onlyHandlers ? 2 : 3; - event.namespace = namespaces.join( "." ); - event.rnamespace = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === ( elem.ownerDocument || document ) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { - lastElement = cur; - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( - dataPriv.get( cur, "events" ) || Object.create( null ) - )[ event.type ] && - dataPriv.get( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && handle.apply && acceptData( cur ) ) { - event.result = handle.apply( cur, data ); - if ( event.result === false ) { - event.preventDefault(); - } - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( ( !special._default || - special._default.apply( eventPath.pop(), data ) === false ) && - acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name as the event. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - - if ( event.isPropagationStopped() ) { - lastElement.addEventListener( type, stopPropagationCallback ); - } - - elem[ type ](); - - if ( event.isPropagationStopped() ) { - lastElement.removeEventListener( type, stopPropagationCallback ); - } - - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - // Piggyback on a donor event to simulate a different one - // Used only for `focus(in | out)` events - simulate: function( type, elem, event ) { - var e = jQuery.extend( - new jQuery.Event(), - event, - { - type: type, - isSimulated: true - } - ); - - jQuery.event.trigger( e, null, elem ); - } - -} ); - -jQuery.fn.extend( { - - trigger: function( type, data ) { - return this.each( function() { - jQuery.event.trigger( type, data, this ); - } ); - }, - triggerHandler: function( type, data ) { - var elem = this[ 0 ]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -} ); - - -// Support: Firefox <=44 -// Firefox doesn't have focus(in | out) events -// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 -// -// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 -// focus(in | out) events fire after focus & blur events, -// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order -// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 -if ( !support.focusin ) { - jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler on the document while someone wants focusin/focusout - var handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - - // Handle: regular nodes (via `this.ownerDocument`), window - // (via `this.document`) & document (via `this`). - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ); - - if ( !attaches ) { - doc.addEventListener( orig, handler, true ); - } - dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); - }, - teardown: function() { - var doc = this.ownerDocument || this.document || this, - attaches = dataPriv.access( doc, fix ) - 1; - - if ( !attaches ) { - doc.removeEventListener( orig, handler, true ); - dataPriv.remove( doc, fix ); - - } else { - dataPriv.access( doc, fix, attaches ); - } - } - }; - } ); -} -var location = window.location; - -var nonce = { guid: Date.now() }; - -var rquery = ( /\?/ ); - - - -// Cross-browser xml parsing -jQuery.parseXML = function( data ) { - var xml; - if ( !data || typeof data !== "string" ) { - return null; - } - - // Support: IE 9 - 11 only - // IE throws on parseFromString with invalid input. - try { - xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); - } catch ( e ) { - xml = undefined; - } - - if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; -}; - - -var - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( Array.isArray( obj ) ) { - - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - - // Item is non-scalar (array or object), encode its numeric index. - buildParams( - prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", - v, - traditional, - add - ); - } - } ); - - } else if ( !traditional && toType( obj ) === "object" ) { - - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - - // Serialize scalar item. - add( prefix, obj ); - } -} - -// Serialize an array of form elements or a set of -// key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, valueOrFunction ) { - - // If value is a function, invoke it and use its return value - var value = isFunction( valueOrFunction ) ? - valueOrFunction() : - valueOrFunction; - - s[ s.length ] = encodeURIComponent( key ) + "=" + - encodeURIComponent( value == null ? "" : value ); - }; - - if ( a == null ) { - return ""; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - } ); - - } else { - - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ); -}; - -jQuery.fn.extend( { - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map( function() { - - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - } ) - .filter( function() { - var type = this.type; - - // Use .is( ":disabled" ) so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !rcheckableType.test( type ) ); - } ) - .map( function( _i, elem ) { - var val = jQuery( this ).val(); - - if ( val == null ) { - return null; - } - - if ( Array.isArray( val ) ) { - return jQuery.map( val, function( val ) { - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ); - } - - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - } ).get(); - } -} ); - - -var - r20 = /%20/g, - rhash = /#.*$/, - rantiCache = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, - - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat( "*" ), - - // Anchor tag for parsing the document origin - originAnchor = document.createElement( "a" ); - originAnchor.href = location.href; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; - - if ( isFunction( func ) ) { - - // For each dataType in the dataTypeExpression - while ( ( dataType = dataTypes[ i++ ] ) ) { - - // Prepend if requested - if ( dataType[ 0 ] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); - - // Otherwise append - } else { - ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && - !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - } ); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var key, deep, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -/* Handles responses to an ajax request: - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - - var ct, type, finalDataType, firstDataType, - contents = s.contents, - dataTypes = s.dataTypes; - - // Remove auto dataType and get content-type in the process - while ( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -/* Chain conversions given the request and the original response - * Also sets the responseXXX fields on the jqXHR instance - */ -function ajaxConvert( s, response, jqXHR, isSuccess ) { - var conv2, current, conv, tmp, prev, - converters = {}, - - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(); - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - current = dataTypes.shift(); - - // Convert to each sequential dataType - while ( current ) { - - if ( s.responseFields[ current ] ) { - jqXHR[ s.responseFields[ current ] ] = response; - } - - // Apply the dataFilter if provided - if ( !prev && isSuccess && s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - prev = current; - current = dataTypes.shift(); - - if ( current ) { - - // There's only work to do if current dataType is non-auto - if ( current === "*" ) { - - current = prev; - - // Convert response if prev dataType is non-auto and differs from current - } else if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split( " " ); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.unshift( tmp[ 1 ] ); - } - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s.throws ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { - state: "parsererror", - error: conv ? e : "No conversion from " + prev + " to " + current - }; - } - } - } - } - } - } - - return { state: "success", data: response }; -} - -jQuery.extend( { - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: location.href, - type: "GET", - isLocal: rlocalProtocol.test( location.protocol ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /\bxml\b/, - html: /\bhtml/, - json: /\bjson\b/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText", - json: "responseJSON" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": JSON.parse, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var transport, - - // URL without anti-cache param - cacheURL, - - // Response headers - responseHeadersString, - responseHeaders, - - // timeout handle - timeoutTimer, - - // Url cleanup var - urlAnchor, - - // Request state (becomes false upon send and true upon completion) - completed, - - // To know if global events are to be dispatched - fireGlobals, - - // Loop variable - i, - - // uncached part of the url - uncached, - - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - - // Callbacks context - callbackContext = s.context || s, - - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && - ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks( "once memory" ), - - // Status-dependent callbacks - statusCode = s.statusCode || {}, - - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - - // Default abort message - strAbort = "canceled", - - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( completed ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() + " " ] = - ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) - .concat( match[ 2 ] ); - } - } - match = responseHeaders[ key.toLowerCase() + " " ]; - } - return match == null ? null : match.join( ", " ); - }, - - // Raw string - getAllResponseHeaders: function() { - return completed ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - if ( completed == null ) { - name = requestHeadersNames[ name.toLowerCase() ] = - requestHeadersNames[ name.toLowerCase() ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( completed == null ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( completed ) { - - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } else { - - // Lazy-add the new callbacks in a way that preserves old ones - for ( code in map ) { - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ); - - // Add protocol if not provided (prefilters might expect it) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || location.href ) + "" ) - .replace( rprotocol, location.protocol + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; - - // A cross-domain request is in order when the origin doesn't match the current origin. - if ( s.crossDomain == null ) { - urlAnchor = document.createElement( "a" ); - - // Support: IE <=8 - 11, Edge 12 - 15 - // IE throws exception on accessing the href property if url is malformed, - // e.g. http://example.com:80x/ - try { - urlAnchor.href = s.url; - - // Support: IE <=8 - 11 only - // Anchor's host property isn't correctly set when s.url is relative - urlAnchor.href = urlAnchor.href; - s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== - urlAnchor.protocol + "//" + urlAnchor.host; - } catch ( e ) { - - // If there is an error parsing the URL, assume it is crossDomain, - // it can be rejected by the transport if it is invalid - s.crossDomain = true; - } - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( completed ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) - fireGlobals = jQuery.event && s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger( "ajaxStart" ); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - // Remove hash to simplify url manipulation - cacheURL = s.url.replace( rhash, "" ); - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // Remember the hash so we can put it back - uncached = s.url.slice( cacheURL.length ); - - // If data is available and should be processed, append data to url - if ( s.data && ( s.processData || typeof s.data === "string" ) ) { - cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; - - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add or update anti-cache param if needed - if ( s.cache === false ) { - cacheURL = cacheURL.replace( rantiCache, "$1" ); - uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + - uncached; - } - - // Put hash and anti-cache on the URL that will be requested (gh-1732) - s.url = cacheURL + uncached; - - // Change '%20' to '+' if this is encoded form body content (gh-2658) - } else if ( s.data && s.processData && - ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { - s.data = s.data.replace( r20, "+" ); - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? - s.accepts[ s.dataTypes[ 0 ] ] + - ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && - ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { - - // Abort if not done already and return - return jqXHR.abort(); - } - - // Aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - completeDeferred.add( s.complete ); - jqXHR.done( s.success ); - jqXHR.fail( s.error ); - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - - // If request was aborted inside ajaxSend, stop there - if ( completed ) { - return jqXHR; - } - - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = window.setTimeout( function() { - jqXHR.abort( "timeout" ); - }, s.timeout ); - } - - try { - completed = false; - transport.send( requestHeaders, done ); - } catch ( e ) { - - // Rethrow post-completion exceptions - if ( completed ) { - throw e; - } - - // Propagate others as results - done( -1, e ); - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Ignore repeat invocations - if ( completed ) { - return; - } - - completed = true; - - // Clear timeout if it exists - if ( timeoutTimer ) { - window.clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Determine if successful - isSuccess = status >= 200 && status < 300 || status === 304; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // Use a noop converter for missing script - if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { - s.converters[ "text script" ] = function() {}; - } - - // Convert no matter what (that way responseXXX fields are always set) - response = ajaxConvert( s, response, jqXHR, isSuccess ); - - // If successful, handle type chaining - if ( isSuccess ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader( "Last-Modified" ); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader( "etag" ); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 || s.type === "HEAD" ) { - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - statusText = response.state; - success = response.data; - error = response.error; - isSuccess = !error; - } - } else { - - // Extract error from statusText and normalize for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger( "ajaxStop" ); - } - } - } - - return jqXHR; - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - } -} ); - -jQuery.each( [ "get", "post" ], function( _i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - - // Shift arguments if data argument was omitted - if ( isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - // The url can be an options object (which then must have .url) - return jQuery.ajax( jQuery.extend( { - url: url, - type: method, - dataType: type, - data: data, - success: callback - }, jQuery.isPlainObject( url ) && url ) ); - }; -} ); - -jQuery.ajaxPrefilter( function( s ) { - var i; - for ( i in s.headers ) { - if ( i.toLowerCase() === "content-type" ) { - s.contentType = s.headers[ i ] || ""; - } - } -} ); - - -jQuery._evalUrl = function( url, options, doc ) { - return jQuery.ajax( { - url: url, - - // Make this explicit, since user can override this through ajaxSetup (#11264) - type: "GET", - dataType: "script", - cache: true, - async: false, - global: false, - - // Only evaluate the response if it is successful (gh-4126) - // dataFilter is not invoked for failure responses, so using it instead - // of the default converter is kludgy but it works. - converters: { - "text script": function() {} - }, - dataFilter: function( response ) { - jQuery.globalEval( response, options, doc ); - } - } ); -}; - - -jQuery.fn.extend( { - wrapAll: function( html ) { - var wrap; - - if ( this[ 0 ] ) { - if ( isFunction( html ) ) { - html = html.call( this[ 0 ] ); - } - - // The elements to wrap the target around - wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); - - if ( this[ 0 ].parentNode ) { - wrap.insertBefore( this[ 0 ] ); - } - - wrap.map( function() { - var elem = this; - - while ( elem.firstElementChild ) { - elem = elem.firstElementChild; - } - - return elem; - } ).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( isFunction( html ) ) { - return this.each( function( i ) { - jQuery( this ).wrapInner( html.call( this, i ) ); - } ); - } - - return this.each( function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - } ); - }, - - wrap: function( html ) { - var htmlIsFunction = isFunction( html ); - - return this.each( function( i ) { - jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); - } ); - }, - - unwrap: function( selector ) { - this.parent( selector ).not( "body" ).each( function() { - jQuery( this ).replaceWith( this.childNodes ); - } ); - return this; - } -} ); - - -jQuery.expr.pseudos.hidden = function( elem ) { - return !jQuery.expr.pseudos.visible( elem ); -}; -jQuery.expr.pseudos.visible = function( elem ) { - return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); -}; - - - - -jQuery.ajaxSettings.xhr = function() { - try { - return new window.XMLHttpRequest(); - } catch ( e ) {} -}; - -var xhrSuccessStatus = { - - // File protocol always yields status code 0, assume 200 - 0: 200, - - // Support: IE <=9 only - // #1450: sometimes IE returns 1223 when it should be 204 - 1223: 204 - }, - xhrSupported = jQuery.ajaxSettings.xhr(); - -support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -support.ajax = xhrSupported = !!xhrSupported; - -jQuery.ajaxTransport( function( options ) { - var callback, errorCallback; - - // Cross domain only allowed if supported through XMLHttpRequest - if ( support.cors || xhrSupported && !options.crossDomain ) { - return { - send: function( headers, complete ) { - var i, - xhr = options.xhr(); - - xhr.open( - options.type, - options.url, - options.async, - options.username, - options.password - ); - - // Apply custom fields if provided - if ( options.xhrFields ) { - for ( i in options.xhrFields ) { - xhr[ i ] = options.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( options.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( options.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { - headers[ "X-Requested-With" ] = "XMLHttpRequest"; - } - - // Set headers - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - - // Callback - callback = function( type ) { - return function() { - if ( callback ) { - callback = errorCallback = xhr.onload = - xhr.onerror = xhr.onabort = xhr.ontimeout = - xhr.onreadystatechange = null; - - if ( type === "abort" ) { - xhr.abort(); - } else if ( type === "error" ) { - - // Support: IE <=9 only - // On a manual native abort, IE9 throws - // errors on any property access that is not readyState - if ( typeof xhr.status !== "number" ) { - complete( 0, "error" ); - } else { - complete( - - // File: protocol always yields status 0; see #8605, #14207 - xhr.status, - xhr.statusText - ); - } - } else { - complete( - xhrSuccessStatus[ xhr.status ] || xhr.status, - xhr.statusText, - - // Support: IE <=9 only - // IE9 has no XHR2 but throws on binary (trac-11426) - // For XHR2 non-text, let the caller handle it (gh-2498) - ( xhr.responseType || "text" ) !== "text" || - typeof xhr.responseText !== "string" ? - { binary: xhr.response } : - { text: xhr.responseText }, - xhr.getAllResponseHeaders() - ); - } - } - }; - }; - - // Listen to events - xhr.onload = callback(); - errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); - - // Support: IE 9 only - // Use onreadystatechange to replace onabort - // to handle uncaught aborts - if ( xhr.onabort !== undefined ) { - xhr.onabort = errorCallback; - } else { - xhr.onreadystatechange = function() { - - // Check readyState before timeout as it changes - if ( xhr.readyState === 4 ) { - - // Allow onerror to be called first, - // but that will not handle a native abort - // Also, save errorCallback to a variable - // as xhr.onerror cannot be accessed - window.setTimeout( function() { - if ( callback ) { - errorCallback(); - } - } ); - } - }; - } - - // Create the abort callback - callback = callback( "abort" ); - - try { - - // Do send the request (this may raise an exception) - xhr.send( options.hasContent && options.data || null ); - } catch ( e ) { - - // #14683: Only rethrow if this hasn't been notified as an error yet - if ( callback ) { - throw e; - } - } - }, - - abort: function() { - if ( callback ) { - callback(); - } - } - }; - } -} ); - - - - -// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) -jQuery.ajaxPrefilter( function( s ) { - if ( s.crossDomain ) { - s.contents.script = false; - } -} ); - -// Install script dataType -jQuery.ajaxSetup( { - accepts: { - script: "text/javascript, application/javascript, " + - "application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /\b(?:java|ecma)script\b/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -} ); - -// Handle cache's special case and crossDomain -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - } -} ); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function( s ) { - - // This transport only deals with cross domain or forced-by-attrs requests - if ( s.crossDomain || s.scriptAttrs ) { - var script, callback; - return { - send: function( _, complete ) { - script = jQuery( "