@elite-dangerous-almanac/core 0.1.0-beta.11 → 0.1.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KLIYDSYF.js → chunk-LRC7UW7S.js} +1 -1
- package/dist/chunk-LRC7UW7S.js.map +1 -0
- package/dist/{chunk-H7ABQQUR.js → chunk-OLW6EIDX.js} +1 -1
- package/dist/chunk-OLW6EIDX.js.map +1 -0
- package/dist/{ship-loadout-D-QabZ5g.d.ts → ship-loadout-CIqzqUOH.d.ts} +47 -11
- package/dist/ships/index.d.ts +4 -3
- package/dist/ships/index.js +1 -1
- package/dist/ships/pre-engineered-stats.d.ts +12 -4
- package/dist/ships/pre-engineered-stats.js +1 -1
- package/dist/ships/ship-loadout.d.ts +1 -1
- package/dist/ships/ship-loadout.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-H7ABQQUR.js.map +0 -1
- package/dist/chunk-KLIYDSYF.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{getModuleBySymbol,builtInModuleBySymbol}from"./chunk-MNXWK7PA.js";import{getPreEngineeredVariants}from"./chunk-32PVERNH.js";import{ALL_MODULES}from"./chunk-53ERRGPM.js";import{EXPERIMENTAL_EFFECTS,getExperimentalEffect}from"./chunk-PMJG7PHU.js";import{fieldForLabel,preciseModifierValue,scaleForLabel,capabilityValueForLabel,baseStats,computeModifiers,labelsForDamageType}from"./chunk-SVZARHWP.js";import{resolveBlueprintForModule}from"./chunk-ZJB5UYNE.js";import{getBlueprintsForModule,getExperimentalsForModule,getEngineeringGroup}from"./chunk-TH4S5MVD.js";import{getBlueprint,BLUEPRINTS}from"./chunk-DNTN34M4.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{requireStringIfPresent}from"./chunk-B5TT26XE.js";import{deepFreeze}from"./chunk-DURKO7JU.js";function scaleDamageComponents(components,baseDamage,effectiveDamage){const scale=baseDamage!==void 0&&baseDamage!==0&&effectiveDamage!==void 0?effectiveDamage/baseDamage:1;return{...components.kinetic===void 0?{}:{kinetic:components.kinetic*scale},...components.thermal===void 0?{}:{thermal:components.thermal*scale},...components.explosive===void 0?{}:{explosive:components.explosive*scale},...components.absolute===void 0?{}:{absolute:components.absolute*scale},...components.antiXeno===void 0?{}:{antiXeno:components.antiXeno*scale},...components.unclassified===void 0?{}:{unclassified:components.unclassified.map(value=>value*scale)}}}function fixedModifierFeatures(modifiers){return modifiers.map(modifier=>({label:modifier.label,method:modifier.method,min:modifier.value,max:modifier.value}))}var FITTED_ITEM="ShipLoadout: fitted module Item";function isNonOutfittingSlot(slotKey){return/^(paintjob|shipname\d+|shipid\d+|bobble\d+|decal\d+|shipkit.+|weaponcolour|enginecolour|vesselvoice|shipcockpit|stringlights)$/i.test(slotKey)}function isBuiltInHullModule(module){return module.Slot.toLowerCase()==="cargohatch"&&module.Item.toLowerCase().startsWith("modularcargobaydoor")}function cloneLoadoutModule(module){return{Slot:module.Slot,Item:module.Item,...module.On===void 0?{}:{On:module.On},...module.Priority===void 0?{}:{Priority:module.Priority},...module.Health===void 0?{}:{Health:module.Health},...module.Value===void 0?{}:{Value:module.Value},...module.Engineering===void 0?{}:{Engineering:{BlueprintName:module.Engineering.BlueprintName,Level:module.Engineering.Level,Quality:module.Engineering.Quality,...module.Engineering.ExperimentalEffect===void 0?{}:{ExperimentalEffect:module.Engineering.ExperimentalEffect},...module.Engineering.ExperimentalEffect_Localised===void 0?{}:{ExperimentalEffect_Localised:module.Engineering.ExperimentalEffect_Localised},...module.Engineering.Modifiers===void 0?{}:{Modifiers:module.Engineering.Modifiers.map(modifier=>({...modifier}))}}}}}function matchingKeyIn(keyed,slotKey){if(keyed.has(slotKey))return slotKey;const wanted=slotKey.toLowerCase();for(const key of keyed.keys()){if(key.toLowerCase()===wanted)return key}return null}function cloneModuleStats(module){return deepFreeze({...module,...module.restrictedToShips===void 0?{}:{restrictedToShips:[...module.restrictedToShips]},...module.limitIncrease===void 0?{}:{limitIncrease:{...module.limitIncrease}},...module.damageDistribution===void 0?{}:{damageDistribution:{...module.damageDistribution}},...module.damageComponents===void 0?{}:{damageComponents:{...module.damageComponents,...module.damageComponents.unclassified===void 0?{}:{unclassified:[...module.damageComponents.unclassified]}}},...module.projectileRange===void 0?{}:{projectileRange:{...module.projectileRange}}})}var GUARDIAN_WEAPON_GROUPS=/* @__PURE__ */new Set(["guardianGauss","guardianPlasma","guardianShard"]);function missingBaseLabels(stats,base,features,experimental){const contributions=[...features,...experimental??[]];return[...new Set(contributions.map(contribution=>contribution.label).filter(label=>{if(base[label]!==void 0)return false;return fieldForLabel(label,stats)===null}))]}function recipeSignature(fdname){const blueprint=getBlueprint(fdname);if(!blueprint)return null;const grades=Object.entries(blueprint.grades).map(([grade,{features:features}])=>`${grade}:${features.map(feature=>`${feature.label}/${feature.method??""}`).sort().join(",")}`).sort().join(";");return`${blueprint.name.toLowerCase()}|${grades}`}var isGenericSpelling=fdname=>fdname.toLowerCase().startsWith("misc_");function isSoldWithBlueprint(item,wanted){return getPreEngineeredVariants(item).some(variant=>variant.acquisition==="mercenary"&&variant.blueprint.toLowerCase()===wanted)}function blueprintRoutesFor(item){const routes=/* @__PURE__ */new Map;for(const fdname of getBlueprintsForModule(item))routes.set(fdname,"ordinary");for(const variant of getPreEngineeredVariants(item)){if(variant.acquisition==="mercenary"&&!routes.has(variant.blueprint)){routes.set(variant.blueprint,"mercenary")}}return routes}function blueprintAvailableFor(item,fdname){const offered=getBlueprintsForModule(item);const asWritten=normalizeKey(fdname,"ShipLoadout.applyBlueprint: fdname");const resolved=resolveBlueprintForModule(item,fdname).trim();const wanted=resolved.toLowerCase();if(offered.some(id=>id.toLowerCase()===wanted))return true;if(isSoldWithBlueprint(item,wanted)||isSoldWithBlueprint(item,asWritten))return true;if(!isGenericSpelling(wanted))return false;const signature=recipeSignature(resolved);if(signature===null)return false;return offered.some(id=>recipeSignature(id)===signature&&!isGenericSpelling(id))}function experimentalAvailableFor(item,fdname){const wanted=normalizeKey(fdname,"ShipLoadout.applyBlueprint: options.experimental");return getExperimentalsForModule(item).some(id=>id.toLowerCase()===wanted)}function primitiveLabelFor(stats,label){if(label==="MaximumRange"&&stats.maximumRange!==void 0)return"Range";if(label==="DamageFalloffRange"&&stats.falloffRange!==void 0){return"FalloffRange"}if(label==="Range"&&stats.scannerRange!==void 0)return"ScannerRange";if(label==="DSS_PatchRadius")return"ProbeRadius";if(label==="FuelScoopRate")return"RefuelRate";if(label==="EnergyPerRegen"&&stats.shieldRegenRate!==void 0){return"DistributorDraw"}return label}function primitiveEngineeringInputsFor(stats,grade,experimental){const canonicalGrade={...grade,features:grade.features.map(feature=>{const label=primitiveLabelFor(stats,feature.label);return label===feature.label?feature:{...feature,label:label}})};if(!experimental)return{grade:canonicalGrade};return{grade:canonicalGrade,experimental:{...experimental,modifiers:experimental.modifiers.map(modifier=>{const label=primitiveLabelFor(stats,modifier.label);return label===modifier.label?modifier:{...modifier,label:label}})}}}var round6=value=>{const rounded=Math.round(value*1e6)/1e6;return Object.is(rounded,-0)?0:rounded};function float32FiringCycle(interval,burstRounds,burstRateOfFire){if(interval<=0)return void 0;const withinBurst=burstRounds>1?Math.fround(Math.fround(burstRounds-1)/Math.fround(burstRateOfFire)):0;const cycle=Math.fround(withinBurst+Math.fround(interval));return cycle>0?cycle:void 0}function float32RateOfFire(interval,burstRounds,burstRateOfFire){const cycle=float32FiringCycle(interval,burstRounds,burstRateOfFire);return cycle===void 0?void 0:Math.fround(Math.fround(burstRounds)/cycle)}function float32DamagePerSecond(damage,rounds,rate,burstRounds,cycle){if(cycle!==void 0&&(rounds!==1||burstRounds!==1)){const damagePerCycle=Math.fround(Math.fround(Math.fround(damage)*Math.fround(rounds))*Math.fround(burstRounds));return Math.fround(damagePerCycle/cycle)}return Math.fround(Math.fround(Math.fround(damage)*Math.fround(rounds))*Math.fround(rate))}var JOURNAL_MODIFIER_ORDER=["CargoCapacity","GuardianModuleResistance","Mass","Integrity","PowerDraw","BootTime","PowerCapacity","HeatEfficiency","FSDOptimalMass","MaxFuelPerJump","FSDHeatRate","EngineOptimalMass","EngineOptPerformance","EngineHeatRate","ShieldGenOptimalMass","ShieldGenStrength","DamagePerSecond","Damage","DistributorDraw","ThermalLoad","ArmourPenetration","MaximumRange","ShotSpeed","RateOfFire","DamageType","$Kinetic;","$Thermal;","$Explosive;","$Absolute;","AmmoClipSize","AmmoMaximum","ReloadTime","Jitter","DamageFalloffRange","DefenceModifierShieldMultiplier","DefenceModifierHealthMultiplier","DefenceModifierHealthAddition","DefenceModifierShieldAddition","RegenRate","BrokenRegenRate","EnergyPerRegen","KineticResistance","ThermicResistance","ExplosiveResistance","CausticResistance","DamageProtection","ModuleDefenceAbsorption","WeaponsCapacity","WeaponsRecharge","EnginesCapacity","EnginesRecharge","SystemsCapacity","SystemsRecharge","ShieldBankSpinUp","ShieldBankDuration","ShieldBankReinforcement","ShieldBankHeat","FSDInterdictorRange","FSDInterdictorFacingLimit","SensorTargetScanAngle","MaxAngle","ScannerTimeToScan","Range","DSS_PatchRadius","FuelScoopRate","FuelCapacity"];var JOURNAL_MODIFIER_RANK=new Map(JOURNAL_MODIFIER_ORDER.map((label,index)=>[label,index]));function sortJournalModifiers(modifiers){return modifiers.map((modifier,index)=>({modifier:modifier,index:index})).sort((a,b)=>(JOURNAL_MODIFIER_RANK.get(a.modifier.Label)??JOURNAL_MODIFIER_ORDER.length)-(JOURNAL_MODIFIER_RANK.get(b.modifier.Label)??JOURNAL_MODIFIER_ORDER.length)||a.index-b.index).map(({modifier:modifier})=>modifier)}function journalModifiersFor(stats,modifiers){const weapon=stats.damage!==void 0;const valueFor=(label,fallback)=>{const modifier=modifiers.find(candidate=>candidate.Label===label);return(modifier&&preciseModifierValue(modifier))??Math.fround(fallback)};const burstTouched=["BurstInterval","BurstSize","BurstRateOfFire"].some(label=>modifiers.some(modifier=>modifier.Label===label));const damageTouched=modifiers.some(modifier=>modifier.Label==="Damage");const rateTouched=burstTouched||modifiers.some(modifier=>modifier.Label==="RateOfFire");let damagePerSecond;let derivedRate;if(weapon&&(damageTouched||rateTouched)){const continuous=stats.burstInterval===void 0&&stats.rateOfFire===void 0;const baseDamage=Math.fround(stats.damage);const effectiveDamage=valueFor("Damage",stats.damage);if(continuous){damagePerSecond={Label:"DamagePerSecond",Value:round6(effectiveDamage),OriginalValue:round6(baseDamage)}}else{const burstRounds=valueFor("BurstSize",stats.burstRounds??1);const burstRate=valueFor("BurstRateOfFire",stats.burstRateOfFire??1);const baseBurstRounds=Math.fround(stats.burstRounds??1);const baseBurstRate=Math.fround(stats.burstRateOfFire??1);const baseInterval=stats.burstInterval===void 0?void 0:Math.fround(stats.burstInterval);const baseCycle=baseInterval===void 0?void 0:float32FiringCycle(baseInterval,baseBurstRounds,baseBurstRate);const baseRate=baseInterval!==void 0?float32RateOfFire(baseInterval,baseBurstRounds,baseBurstRate):stats.rateOfFire===void 0?void 0:Math.fround(stats.rateOfFire);const rateModifier=modifiers.find(modifier=>modifier.Label==="RateOfFire");const effectiveRate=rateModifier&&preciseModifierValue(rateModifier);const effectiveInterval=valueFor("BurstInterval",stats.burstInterval??0);const effectiveCycle=effectiveRate===void 0?float32FiringCycle(effectiveInterval,burstRounds,burstRate):void 0;const rate=effectiveRate??(effectiveCycle===void 0?void 0:Math.fround(Math.fround(burstRounds)/effectiveCycle));if(baseRate!==void 0&&rate!==void 0){const stockRounds=Math.fround(stats.roundsPerShot??1);const effectiveRounds=Math.fround(modifiers.find(modifier=>modifier.Label==="Rounds"||modifier.Label==="RoundsPerShot")?.Value??stockRounds);damagePerSecond={Label:"DamagePerSecond",Value:round6(float32DamagePerSecond(effectiveDamage,effectiveRounds,rate,burstRounds,effectiveCycle)),OriginalValue:round6(float32DamagePerSecond(baseDamage,stockRounds,baseRate,baseBurstRounds,baseCycle))};if(burstTouched){derivedRate={Label:"RateOfFire",Value:round6(rate),OriginalValue:round6(baseRate)}}}}}const result=[];for(const modifier of modifiers){const label=modifier.Label;if(weapon&&["BurstInterval","BurstSize","BurstRateOfFire"].includes(label))continue;if(weapon&&label==="Damage"&&stats.rateOfFire===void 0)continue;let journalLabel=label;if(label==="Range"&&stats.maximumRange!==void 0)journalLabel="MaximumRange";else if(label==="FalloffRange"&&stats.falloffRange!==void 0){journalLabel="DamageFalloffRange"}else if(label==="ScannerRange"&&stats.scannerRange!==void 0){journalLabel="Range"}else if(label==="ProbeRadius")journalLabel="DSS_PatchRadius";else if(label==="RefuelRate")journalLabel="FuelScoopRate";else if(label==="DistributorDraw"&&stats.shieldRegenRate!==void 0){journalLabel="EnergyPerRegen"}result.push(journalLabel===label?modifier:{...modifier,Label:journalLabel})}if(damagePerSecond)result.push(damagePerSecond);if(derivedRate){const direct=result.findIndex(modifier=>modifier.Label==="RateOfFire");if(direct>=0)result[direct]=derivedRate;else result.push(derivedRate)}return sortJournalModifiers(result)}function isFinalGuardianWeaponEngineering(item,blueprint){const group=getEngineeringGroup(item);if(group===null||!GUARDIAN_WEAPON_GROUPS.has(group))return false;const resolved=resolveBlueprintForModule(item,blueprint);return getBlueprint(resolved)!==null&&!blueprintAvailableFor(item,blueprint)}function engineerableBase(item,statsOverride){const stats=statsOverride??builtInModuleBySymbol(item,FITTED_ITEM);if(!stats||stats.engineeringLocked)return null;return{stats:stats,base:baseStats(stats)}}function availableBlueprintsFor(item,statsOverride){const engineerable=engineerableBase(item,statsOverride);if(!engineerable)return[];const{stats:stats,base:base}=engineerable;const available=[];for(const[fdname,route]of blueprintRoutesFor(item)){const blueprint=BLUEPRINTS[fdname];if(!blueprint)continue;const grades=Object.entries(blueprint.grades).filter(([,grade])=>missingBaseLabels(stats,base,grade.features).length===0).map(([grade])=>Number(grade)).filter(Number.isFinite).sort((a,b)=>a-b);if(grades.length>0)available.push({fdname:fdname,grades:grades,route:route})}return available}function availableExperimentalsFor(item,statsOverride){const engineerable=engineerableBase(item,statsOverride);if(!engineerable)return[];const{stats:stats,base:base}=engineerable;return getExperimentalsForModule(item).filter(fdname=>{const effect=EXPERIMENTAL_EFFECTS[fdname];return effect!==void 0&&missingBaseLabels(stats,base,effect.modifiers).length===0})}function modifiersWithExperimental(variant,experimental){const module=getModuleBySymbol(variant.symbol,ALL_MODULES);const effectName=experimental??variant.experimental;if(!module||!variant.modifiers?.length&&effectName===void 0)return null;const effect=effectName===void 0?void 0:getExperimentalEffect(effectName);if(effectName!==void 0&&!effect)return null;return computeModifiers(baseStats(module),fixedModifierFeatures(variant.modifiers??[]),1,effect??void 0)}function getPreEngineeredModifiers(variant){return modifiersWithExperimental(variant)??[]}function journalModifiersWithExperimental(variant,experimental){const module=getModuleBySymbol(variant.symbol,ALL_MODULES);if(!module)return[];const modifiers=journalModifiersFor(module,modifiersWithExperimental(variant,experimental)??[]);const effectName=experimental??variant.experimental;const damageDistribution=effectName?getExperimentalEffect(effectName)?.damageDistribution:void 0;if(!damageDistribution)return modifiers;for(const type of["kinetic","thermal","explosive","absolute"]){const value=damageDistribution[type];const label=labelsForDamageType(type)[0];if(value===void 0||label===void 0)continue;modifiers.push({Label:label,Value:value*scaleForLabel(label),OriginalValue:(module.damageDistribution?.[type]??0)*scaleForLabel(label)})}return modifiers}function getPreEngineeredJournalModifiers(variant){return journalModifiersWithExperimental(variant)}function sameJournalNumber(actual,expected){return Math.abs(actual-expected)<=Math.max(1e-5,Math.abs(expected)*1e-6)}function modifierKey(modifier,module){return fieldForLabel(modifier.Label,module)??`label:${normalizeKey(modifier.Label,"identifyPreEngineeredVariant: module.Engineering.Modifiers[].Label")}`}function sameModifier(actual,expected){if(expected.Value!==void 0){return actual.Value!==void 0&&sameJournalNumber(actual.Value,expected.Value)}return expected.ValueStr!==void 0&&actual.ValueStr!==void 0}function matchesModifierSignature(actualByKey,expected,module){let matched=0;for(const predicted of expected){const actual=actualByKey.get(modifierKey(predicted,module));if(!actual)continue;if(!sameModifier(actual,predicted))return false;matched++}return matched>=Math.max(1,expected.length-1)}function identifyPreEngineeredVariant(module){const engineering=module.Engineering;if(!engineering?.Modifiers?.length)return null;requireStringIfPresent(module.Item,"identifyPreEngineeredVariant: module.Item");const stock=getModuleBySymbol(module.Item,ALL_MODULES);if(!stock)return null;const actualByKey=/* @__PURE__ */new Map;for(const modifier of engineering.Modifiers){actualByKey.set(modifierKey(modifier,stock),modifier)}const capturedExperimental=normalizeKey(engineering.ExperimentalEffect,"identifyPreEngineeredVariant: module.Engineering.ExperimentalEffect");const matches=[];for(const candidate of getPreEngineeredVariants(module.Item)){if(!candidate.modifiers?.length)continue;if(candidate.grade!==engineering.Level)continue;if(candidate.acquisition==="eventReward"&&(engineering.ExperimentalEffect!==void 0||engineering.ExperimentalEffect_Localised!==void 0||normalizeKey(engineering.BlueprintName,"identifyPreEngineeredVariant: module.Engineering.BlueprintName")!==candidate.blueprint.toLowerCase())){continue}if(candidate.experimental!==void 0&&candidate.experimental.toLowerCase()!==capturedExperimental){continue}const primitive=modifiersWithExperimental(candidate,engineering.ExperimentalEffect);if(!primitive?.length)continue;const matched=matchesModifierSignature(actualByKey,primitive,stock)||matchesModifierSignature(actualByKey,journalModifiersWithExperimental(candidate,engineering.ExperimentalEffect),stock);if(matched)matches.push(candidate)}return matches.length===1?matches[0]:null}function unresolvedModifiers(variant){const resolved=new Set(getPreEngineeredModifiers(variant).map(modifier=>modifier.Label));return(variant.modifiers??[]).map(modifier=>modifier.label).filter(label=>!resolved.has(label))}function getPreEngineeredStats(variant){const module=getModuleBySymbol(variant.symbol,ALL_MODULES);if(!module)return null;if(!variant.modifiers?.length&&!variant.engineeringLocked&&variant.experimental===void 0)return module;const modifiers=variant.modifiers??[];const resolved={...module,...variant.engineeringLocked?{engineeringLocked:true}:{}};for(const{Label:Label,Value:Value,ValueStr:ValueStr}of getPreEngineeredModifiers(variant)){const field=fieldForLabel(Label,module);if(field&&field!=="damageDistribution"&&Value!==void 0){Object.assign(resolved,{[field]:Value/scaleForLabel(Label)})}else if(field&&ValueStr!==void 0&&capabilityValueForLabel(Label)!==null){Object.assign(resolved,{[field]:true})}}const experimentalDamageDistribution=variant.experimental?getExperimentalEffect(variant.experimental)?.damageDistribution:void 0;if(experimentalDamageDistribution){resolved.damageDistribution={...experimentalDamageDistribution};delete resolved.damageComponents}if(resolved.rateOfFire!==void 0&&!modifiers.some(m=>m.label==="RateOfFire")&&modifiers.some(m=>m.label==="BurstSize"||m.label==="BurstRateOfFire"||m.label==="BurstInterval")){const rate=combinedRateOfFire(resolved);if(rate!==void 0)resolved.rateOfFire=rate}if(module.damageComponents&&!experimentalDamageDistribution){resolved.damageComponents=scaleDamageComponents(module.damageComponents,module.damage,resolved.damage)}return resolved}export{FITTED_ITEM,availableBlueprintsFor,availableExperimentalsFor,blueprintAvailableFor,blueprintRoutesFor,cloneLoadoutModule,cloneModuleStats,experimentalAvailableFor,getPreEngineeredJournalModifiers,getPreEngineeredModifiers,getPreEngineeredStats,identifyPreEngineeredVariant,isBuiltInHullModule,isFinalGuardianWeaponEngineering,isNonOutfittingSlot,journalModifiersFor,matchingKeyIn,missingBaseLabels,primitiveEngineeringInputsFor,scaleDamageComponents,unresolvedModifiers};//# sourceMappingURL=chunk-KLIYDSYF.js.map
|
|
1
|
+
import{combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{getModuleBySymbol,builtInModuleBySymbol}from"./chunk-MNXWK7PA.js";import{getPreEngineeredVariants}from"./chunk-32PVERNH.js";import{ALL_MODULES}from"./chunk-53ERRGPM.js";import{EXPERIMENTAL_EFFECTS,getExperimentalEffect}from"./chunk-PMJG7PHU.js";import{fieldForLabel,preciseModifierValue,scaleForLabel,capabilityValueForLabel,baseStats,computeModifiers,labelsForDamageType}from"./chunk-SVZARHWP.js";import{resolveBlueprintForModule}from"./chunk-ZJB5UYNE.js";import{getBlueprintsForModule,getExperimentalsForModule,getEngineeringGroup}from"./chunk-TH4S5MVD.js";import{getBlueprint,BLUEPRINTS}from"./chunk-DNTN34M4.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{requireStringIfPresent}from"./chunk-B5TT26XE.js";import{deepFreeze}from"./chunk-DURKO7JU.js";function scaleDamageComponents(components,baseDamage,effectiveDamage){const scale=baseDamage!==void 0&&baseDamage!==0&&effectiveDamage!==void 0?effectiveDamage/baseDamage:1;return{...components.kinetic===void 0?{}:{kinetic:components.kinetic*scale},...components.thermal===void 0?{}:{thermal:components.thermal*scale},...components.explosive===void 0?{}:{explosive:components.explosive*scale},...components.absolute===void 0?{}:{absolute:components.absolute*scale},...components.antiXeno===void 0?{}:{antiXeno:components.antiXeno*scale},...components.unclassified===void 0?{}:{unclassified:components.unclassified.map(value=>value*scale)}}}function fixedModifierFeatures(modifiers){return modifiers.map(modifier=>({label:modifier.label,method:modifier.method,min:modifier.value,max:modifier.value}))}var FITTED_ITEM="ShipLoadout: fitted module Item";function isNonOutfittingSlot(slotKey){return/^(paintjob|shipname\d+|shipid\d+|bobble\d+|decal\d+|shipkit.+|weaponcolour|enginecolour|vesselvoice|shipcockpit|stringlights)$/i.test(slotKey)}function isBuiltInHullModule(module){return module.Slot.toLowerCase()==="cargohatch"&&module.Item.toLowerCase().startsWith("modularcargobaydoor")}function cloneLoadoutModule(module){return{Slot:module.Slot,Item:module.Item,...module.On===void 0?{}:{On:module.On},...module.Priority===void 0?{}:{Priority:module.Priority},...module.Health===void 0?{}:{Health:module.Health},...module.Value===void 0?{}:{Value:module.Value},...module.Engineering===void 0?{}:{Engineering:{BlueprintName:module.Engineering.BlueprintName,Level:module.Engineering.Level,Quality:module.Engineering.Quality,...module.Engineering.ExperimentalEffect===void 0?{}:{ExperimentalEffect:module.Engineering.ExperimentalEffect},...module.Engineering.ExperimentalEffect_Localised===void 0?{}:{ExperimentalEffect_Localised:module.Engineering.ExperimentalEffect_Localised},...module.Engineering.Modifiers===void 0?{}:{Modifiers:module.Engineering.Modifiers.map(modifier=>({...modifier}))}}}}}function matchingKeyIn(keyed,slotKey){if(keyed.has(slotKey))return slotKey;const wanted=slotKey.toLowerCase();for(const key of keyed.keys()){if(key.toLowerCase()===wanted)return key}return null}function cloneModuleStats(module){return deepFreeze({...module,...module.restrictedToShips===void 0?{}:{restrictedToShips:[...module.restrictedToShips]},...module.limitIncrease===void 0?{}:{limitIncrease:{...module.limitIncrease}},...module.damageDistribution===void 0?{}:{damageDistribution:{...module.damageDistribution}},...module.damageComponents===void 0?{}:{damageComponents:{...module.damageComponents,...module.damageComponents.unclassified===void 0?{}:{unclassified:[...module.damageComponents.unclassified]}}},...module.projectileRange===void 0?{}:{projectileRange:{...module.projectileRange}}})}var GUARDIAN_WEAPON_GROUPS=/* @__PURE__ */new Set(["guardianGauss","guardianPlasma","guardianShard"]);function missingBaseLabels(stats,base,features,experimental){const contributions=[...features,...experimental??[]];return[...new Set(contributions.map(contribution=>contribution.label).filter(label=>{if(base[label]!==void 0)return false;return fieldForLabel(label,stats)===null}))]}function recipeSignature(fdname){const blueprint=getBlueprint(fdname);if(!blueprint)return null;const grades=Object.entries(blueprint.grades).map(([grade,{features:features}])=>`${grade}:${features.map(feature=>`${feature.label}/${feature.method??""}`).sort().join(",")}`).sort().join(";");return`${blueprint.name.toLowerCase()}|${grades}`}var isGenericSpelling=fdname=>fdname.toLowerCase().startsWith("misc_");function isSoldWithBlueprint(item,wanted){return getPreEngineeredVariants(item).some(variant=>variant.acquisition==="mercenary"&&variant.blueprint.toLowerCase()===wanted)}function blueprintRoutesFor(item){const routes=/* @__PURE__ */new Map;for(const fdname of getBlueprintsForModule(item))routes.set(fdname,"ordinary");for(const variant of getPreEngineeredVariants(item)){if(variant.acquisition==="mercenary"&&!routes.has(variant.blueprint)){routes.set(variant.blueprint,"mercenary")}}return routes}function blueprintAvailableFor(item,fdname){const offered=getBlueprintsForModule(item);const asWritten=normalizeKey(fdname,"ShipLoadout.applyBlueprint: fdname");const resolved=resolveBlueprintForModule(item,fdname).trim();const wanted=resolved.toLowerCase();if(offered.some(id=>id.toLowerCase()===wanted))return true;if(isSoldWithBlueprint(item,wanted)||isSoldWithBlueprint(item,asWritten))return true;if(!isGenericSpelling(wanted))return false;const signature=recipeSignature(resolved);if(signature===null)return false;return offered.some(id=>recipeSignature(id)===signature&&!isGenericSpelling(id))}function experimentalAvailableFor(item,fdname){const wanted=normalizeKey(fdname,"ShipLoadout.applyBlueprint: options.experimental");return getExperimentalsForModule(item).some(id=>id.toLowerCase()===wanted)}function primitiveLabelFor(stats,label){if(label==="MaximumRange"&&stats.maximumRange!==void 0)return"Range";if(label==="DamageFalloffRange"&&stats.falloffRange!==void 0){return"FalloffRange"}if(label==="Range"&&stats.scannerRange!==void 0)return"ScannerRange";if(label==="DSS_PatchRadius")return"ProbeRadius";if(label==="FuelScoopRate")return"RefuelRate";if(label==="EnergyPerRegen"&&stats.shieldRegenRate!==void 0){return"DistributorDraw"}return label}function primitiveEngineeringInputsFor(stats,grade,experimental){const canonicalGrade={...grade,features:grade.features.map(feature=>{const label=primitiveLabelFor(stats,feature.label);return label===feature.label?feature:{...feature,label:label}})};if(!experimental)return{grade:canonicalGrade};return{grade:canonicalGrade,experimental:{...experimental,modifiers:experimental.modifiers.map(modifier=>{const label=primitiveLabelFor(stats,modifier.label);return label===modifier.label?modifier:{...modifier,label:label}})}}}var round6=value=>{const rounded=Math.round(value*1e6)/1e6;return Object.is(rounded,-0)?0:rounded};function float32FiringCycle(interval,burstRounds,burstRateOfFire){if(interval<=0)return void 0;const withinBurst=burstRounds>1?Math.fround(Math.fround(burstRounds-1)/Math.fround(burstRateOfFire)):0;const cycle=Math.fround(withinBurst+Math.fround(interval));return cycle>0?cycle:void 0}function float32RateOfFire(interval,burstRounds,burstRateOfFire){const cycle=float32FiringCycle(interval,burstRounds,burstRateOfFire);return cycle===void 0?void 0:Math.fround(Math.fround(burstRounds)/cycle)}function float32DamagePerSecond(damage,rounds,rate,burstRounds,cycle){if(cycle!==void 0&&(rounds!==1||burstRounds!==1)){const damagePerCycle=Math.fround(Math.fround(Math.fround(damage)*Math.fround(rounds))*Math.fround(burstRounds));return Math.fround(damagePerCycle/cycle)}return Math.fround(Math.fround(Math.fround(damage)*Math.fround(rounds))*Math.fround(rate))}var JOURNAL_MODIFIER_ORDER=["CargoCapacity","GuardianModuleResistance","Mass","Integrity","PowerDraw","BootTime","PowerCapacity","HeatEfficiency","FSDOptimalMass","MaxFuelPerJump","FSDHeatRate","EngineOptimalMass","EngineOptPerformance","EngineHeatRate","ShieldGenOptimalMass","ShieldGenStrength","DamagePerSecond","Damage","DistributorDraw","ThermalLoad","ArmourPenetration","MaximumRange","ShotSpeed","RateOfFire","DamageType","$Kinetic;","$Thermal;","$Explosive;","$Absolute;","AmmoClipSize","AmmoMaximum","ReloadTime","Jitter","DamageFalloffRange","DefenceModifierShieldMultiplier","DefenceModifierHealthMultiplier","DefenceModifierHealthAddition","DefenceModifierShieldAddition","RegenRate","BrokenRegenRate","EnergyPerRegen","KineticResistance","ThermicResistance","ExplosiveResistance","CausticResistance","DamageProtection","ModuleDefenceAbsorption","WeaponsCapacity","WeaponsRecharge","EnginesCapacity","EnginesRecharge","SystemsCapacity","SystemsRecharge","ShieldBankSpinUp","ShieldBankDuration","ShieldBankReinforcement","ShieldBankHeat","FSDInterdictorRange","FSDInterdictorFacingLimit","SensorTargetScanAngle","MaxAngle","ScannerTimeToScan","Range","DSS_PatchRadius","FuelScoopRate","FuelCapacity"];var JOURNAL_MODIFIER_RANK=new Map(JOURNAL_MODIFIER_ORDER.map((label,index)=>[label,index]));function sortJournalModifiers(modifiers){return modifiers.map((modifier,index)=>({modifier:modifier,index:index})).sort((a,b)=>(JOURNAL_MODIFIER_RANK.get(a.modifier.Label)??JOURNAL_MODIFIER_ORDER.length)-(JOURNAL_MODIFIER_RANK.get(b.modifier.Label)??JOURNAL_MODIFIER_ORDER.length)||a.index-b.index).map(({modifier:modifier})=>modifier)}function journalModifiersFor(stats,modifiers){const weapon=stats.damage!==void 0;const valueFor=(label,fallback)=>{const modifier=modifiers.find(candidate=>candidate.Label===label);return(modifier&&preciseModifierValue(modifier))??Math.fround(fallback)};const burstTouched=["BurstInterval","BurstSize","BurstRateOfFire"].some(label=>modifiers.some(modifier=>modifier.Label===label));const damageTouched=modifiers.some(modifier=>modifier.Label==="Damage");const rateTouched=burstTouched||modifiers.some(modifier=>modifier.Label==="RateOfFire");let damagePerSecond;let derivedRate;if(weapon&&(damageTouched||rateTouched)){const continuous=stats.burstInterval===void 0&&stats.rateOfFire===void 0;const baseDamage=Math.fround(stats.damage);const effectiveDamage=valueFor("Damage",stats.damage);if(continuous){damagePerSecond={Label:"DamagePerSecond",Value:round6(effectiveDamage),OriginalValue:round6(baseDamage)}}else{const burstRounds=valueFor("BurstSize",stats.burstRounds??1);const burstRate=valueFor("BurstRateOfFire",stats.burstRateOfFire??1);const baseBurstRounds=Math.fround(stats.burstRounds??1);const baseBurstRate=Math.fround(stats.burstRateOfFire??1);const baseInterval=stats.burstInterval===void 0?void 0:Math.fround(stats.burstInterval);const baseCycle=baseInterval===void 0?void 0:float32FiringCycle(baseInterval,baseBurstRounds,baseBurstRate);const baseRate=baseInterval!==void 0?float32RateOfFire(baseInterval,baseBurstRounds,baseBurstRate):stats.rateOfFire===void 0?void 0:Math.fround(stats.rateOfFire);const rateModifier=modifiers.find(modifier=>modifier.Label==="RateOfFire");const effectiveRate=rateModifier&&preciseModifierValue(rateModifier);const effectiveInterval=valueFor("BurstInterval",stats.burstInterval??0);const effectiveCycle=effectiveRate===void 0?float32FiringCycle(effectiveInterval,burstRounds,burstRate):void 0;const rate=effectiveRate??(effectiveCycle===void 0?void 0:Math.fround(Math.fround(burstRounds)/effectiveCycle));if(baseRate!==void 0&&rate!==void 0){const stockRounds=Math.fround(stats.roundsPerShot??1);const effectiveRounds=Math.fround(modifiers.find(modifier=>modifier.Label==="Rounds"||modifier.Label==="RoundsPerShot")?.Value??stockRounds);damagePerSecond={Label:"DamagePerSecond",Value:round6(float32DamagePerSecond(effectiveDamage,effectiveRounds,rate,burstRounds,effectiveCycle)),OriginalValue:round6(float32DamagePerSecond(baseDamage,stockRounds,baseRate,baseBurstRounds,baseCycle))};if(burstTouched){derivedRate={Label:"RateOfFire",Value:round6(rate),OriginalValue:round6(baseRate)}}}}}const result=[];for(const modifier of modifiers){const label=modifier.Label;if(weapon&&["BurstInterval","BurstSize","BurstRateOfFire"].includes(label))continue;if(weapon&&label==="Damage"&&stats.rateOfFire===void 0)continue;let journalLabel=label;if(label==="Range"&&stats.maximumRange!==void 0)journalLabel="MaximumRange";else if(label==="FalloffRange"&&stats.falloffRange!==void 0){journalLabel="DamageFalloffRange"}else if(label==="ScannerRange"&&stats.scannerRange!==void 0){journalLabel="Range"}else if(label==="ProbeRadius")journalLabel="DSS_PatchRadius";else if(label==="RefuelRate")journalLabel="FuelScoopRate";else if(label==="DistributorDraw"&&stats.shieldRegenRate!==void 0){journalLabel="EnergyPerRegen"}result.push(journalLabel===label?modifier:{...modifier,Label:journalLabel})}if(damagePerSecond)result.push(damagePerSecond);if(derivedRate){const direct=result.findIndex(modifier=>modifier.Label==="RateOfFire");if(direct>=0)result[direct]=derivedRate;else result.push(derivedRate)}return sortJournalModifiers(result)}function isFinalGuardianWeaponEngineering(item,blueprint){const group=getEngineeringGroup(item);if(group===null||!GUARDIAN_WEAPON_GROUPS.has(group))return false;const resolved=resolveBlueprintForModule(item,blueprint);return getBlueprint(resolved)!==null&&!blueprintAvailableFor(item,blueprint)}function engineerableBase(item,statsOverride){const stats=statsOverride??builtInModuleBySymbol(item,FITTED_ITEM);if(!stats||stats.engineeringLocked)return null;return{stats:stats,base:baseStats(stats)}}function availableBlueprintsFor(item,statsOverride){const engineerable=engineerableBase(item,statsOverride);if(!engineerable)return[];const{stats:stats,base:base}=engineerable;const available=[];for(const[fdname,route]of blueprintRoutesFor(item)){const blueprint=BLUEPRINTS[fdname];if(!blueprint)continue;const grades=Object.entries(blueprint.grades).filter(([,grade])=>missingBaseLabels(stats,base,grade.features).length===0).map(([grade])=>Number(grade)).filter(Number.isFinite).sort((a,b)=>a-b);if(grades.length>0)available.push({fdname:fdname,grades:grades,route:route})}return available}function availableExperimentalsFor(item,statsOverride){const engineerable=engineerableBase(item,statsOverride);if(!engineerable)return[];const{stats:stats,base:base}=engineerable;return getExperimentalsForModule(item).filter(fdname=>{const effect=EXPERIMENTAL_EFFECTS[fdname];return effect!==void 0&&missingBaseLabels(stats,base,effect.modifiers).length===0})}var MAX_ENGINEERING_GRADE=5;function modifiersWithExperimental(variant,experimental){const module=getModuleBySymbol(variant.symbol,ALL_MODULES);const effectName=experimental??variant.experimental;if(!module||!variant.modifiers?.length&&effectName===void 0)return null;const effect=effectName===void 0?void 0:getExperimentalEffect(effectName);if(effectName!==void 0&&!effect)return null;return computeModifiers(baseStats(module),fixedModifierFeatures(variant.modifiers??[]),1,effect??void 0)}function getPreEngineeredModifiers(variant){return modifiersWithExperimental(variant)??[]}function journalModifiersWithExperimental(variant,experimental){const module=getModuleBySymbol(variant.symbol,ALL_MODULES);if(!module)return[];const modifiers=journalModifiersFor(module,modifiersWithExperimental(variant,experimental)??[]);const effectName=experimental??variant.experimental;const damageDistribution=effectName?getExperimentalEffect(effectName)?.damageDistribution:void 0;if(!damageDistribution)return modifiers;for(const type of["kinetic","thermal","explosive","absolute"]){const value=damageDistribution[type];const label=labelsForDamageType(type)[0];if(value===void 0||label===void 0)continue;modifiers.push({Label:label,Value:value*scaleForLabel(label),OriginalValue:(module.damageDistribution?.[type]??0)*scaleForLabel(label)})}return modifiers}function getPreEngineeredJournalModifiers(variant){return journalModifiersWithExperimental(variant)}function sameJournalNumber(actual,expected){return Math.abs(actual-expected)<=Math.max(1e-5,Math.abs(expected)*1e-6)}function modifierKey(modifier,module){return fieldForLabel(modifier.Label,module)??`label:${normalizeKey(modifier.Label,"identifyPreEngineeredVariant: module.Engineering.Modifiers[].Label")}`}function sameModifier(actual,expected){if(expected.Value!==void 0){return actual.Value!==void 0&&sameJournalNumber(actual.Value,expected.Value)}return expected.ValueStr!==void 0&&actual.ValueStr!==void 0}function matchesModifierSignature(actualByKey,expected,module){let matched=0;for(const predicted of expected){const actual=actualByKey.get(modifierKey(predicted,module));if(!actual)continue;if(!sameModifier(actual,predicted))return false;matched++}return matched>=Math.max(1,expected.length-1)}function identifyPreEngineeredVariant(module){const engineering=module.Engineering;if(!engineering)return null;requireStringIfPresent(module.Item,"identifyPreEngineeredVariant: module.Item");const stock=getModuleBySymbol(module.Item,ALL_MODULES);if(!stock)return null;const capturedBlueprint=normalizeKey(engineering.BlueprintName,"identifyPreEngineeredVariant: module.Engineering.BlueprintName");const variants=getPreEngineeredVariants(module.Item);const blueprintMatches=variants.filter(candidate=>candidate.blueprint.toLowerCase()===capturedBlueprint);const blueprintMatch=blueprintMatches.length===1?blueprintMatches[0]:null;const capturedGrade=engineering.Level;if(blueprintMatch?.acquisition==="mercenary"&&Number.isInteger(capturedGrade)&&capturedGrade>=blueprintMatch.grade&&capturedGrade<=MAX_ENGINEERING_GRADE){return blueprintMatch}if(!engineering.Modifiers?.length)return null;const actualByKey=/* @__PURE__ */new Map;for(const modifier of engineering.Modifiers){actualByKey.set(modifierKey(modifier,stock),modifier)}const capturedExperimental=normalizeKey(engineering.ExperimentalEffect,"identifyPreEngineeredVariant: module.Engineering.ExperimentalEffect");const matches=[];for(const candidate of variants){if(!candidate.modifiers?.length)continue;if(candidate.grade!==engineering.Level)continue;if(candidate.acquisition==="eventReward"&&(engineering.ExperimentalEffect!==void 0||engineering.ExperimentalEffect_Localised!==void 0||capturedBlueprint!==candidate.blueprint.toLowerCase())){continue}if(candidate.experimental!==void 0&&candidate.experimental.toLowerCase()!==capturedExperimental){continue}const primitive=modifiersWithExperimental(candidate,engineering.ExperimentalEffect);if(!primitive?.length)continue;const matched=matchesModifierSignature(actualByKey,primitive,stock)||matchesModifierSignature(actualByKey,journalModifiersWithExperimental(candidate,engineering.ExperimentalEffect),stock);if(matched)matches.push(candidate)}return matches.length===1?matches[0]:null}function unresolvedModifiers(variant){const resolved=new Set(getPreEngineeredModifiers(variant).map(modifier=>modifier.Label));return(variant.modifiers??[]).map(modifier=>modifier.label).filter(label=>!resolved.has(label))}function getPreEngineeredStats(variant){const module=getModuleBySymbol(variant.symbol,ALL_MODULES);if(!module)return null;if(!variant.modifiers?.length&&!variant.engineeringLocked&&variant.experimental===void 0)return module;const modifiers=variant.modifiers??[];const resolved={...module,...variant.engineeringLocked?{engineeringLocked:true}:{}};for(const{Label:Label,Value:Value,ValueStr:ValueStr}of getPreEngineeredModifiers(variant)){const field=fieldForLabel(Label,module);if(field&&field!=="damageDistribution"&&Value!==void 0){Object.assign(resolved,{[field]:Value/scaleForLabel(Label)})}else if(field&&ValueStr!==void 0&&capabilityValueForLabel(Label)!==null){Object.assign(resolved,{[field]:true})}}const experimentalDamageDistribution=variant.experimental?getExperimentalEffect(variant.experimental)?.damageDistribution:void 0;if(experimentalDamageDistribution){resolved.damageDistribution={...experimentalDamageDistribution};delete resolved.damageComponents}if(resolved.rateOfFire!==void 0&&!modifiers.some(m=>m.label==="RateOfFire")&&modifiers.some(m=>m.label==="BurstSize"||m.label==="BurstRateOfFire"||m.label==="BurstInterval")){const rate=combinedRateOfFire(resolved);if(rate!==void 0)resolved.rateOfFire=rate}if(module.damageComponents&&!experimentalDamageDistribution){resolved.damageComponents=scaleDamageComponents(module.damageComponents,module.damage,resolved.damage)}return resolved}export{FITTED_ITEM,availableBlueprintsFor,availableExperimentalsFor,blueprintAvailableFor,blueprintRoutesFor,cloneLoadoutModule,cloneModuleStats,experimentalAvailableFor,getPreEngineeredJournalModifiers,getPreEngineeredModifiers,getPreEngineeredStats,identifyPreEngineeredVariant,isBuiltInHullModule,isFinalGuardianWeaponEngineering,isNonOutfittingSlot,journalModifiersFor,matchingKeyIn,missingBaseLabels,primitiveEngineeringInputsFor,scaleDamageComponents,unresolvedModifiers};//# sourceMappingURL=chunk-LRC7UW7S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ships/internal/damage-components.ts","../src/ships/internal/fixed-modifier-features.ts","../src/ships/internal/loadout-state.ts","../src/ships/internal/loadout-engineering.ts","../src/ships/pre-engineered-stats.ts"],"names":["combinedRateOfFire","getModuleBySymbol","builtInModuleBySymbol","getPreEngineeredVariants","ALL_MODULES","EXPERIMENTAL_EFFECTS","getExperimentalEffect","fieldForLabel","preciseModifierValue","scaleForLabel","capabilityValueForLabel","baseStats","computeModifiers","labelsForDamageType","resolveBlueprintForModule","getBlueprintsForModule","getExperimentalsForModule","getEngineeringGroup","getBlueprint","BLUEPRINTS","normalizeKey","requireStringIfPresent","deepFreeze","scaleDamageComponents","components","baseDamage","effectiveDamage","scale","kinetic","thermal","explosive","absolute","antiXeno","unclassified","map","value","fixedModifierFeatures","modifiers","modifier","label","method","min","max","FITTED_ITEM","isNonOutfittingSlot","slotKey","test","isBuiltInHullModule","module","Slot","toLowerCase","Item","startsWith","cloneLoadoutModule","On","Priority","Health","Value","Engineering","BlueprintName","Level","Quality","ExperimentalEffect","ExperimentalEffect_Localised","Modifiers","matchingKeyIn","keyed","has","wanted","key","keys","cloneModuleStats","restrictedToShips","limitIncrease","damageDistribution","damageComponents","projectileRange","GUARDIAN_WEAPON_GROUPS","Set","missingBaseLabels","stats","base","features","experimental","contributions","contribution","filter","recipeSignature","fdname","blueprint","grades","Object","entries","grade","feature","sort","join","name","isGenericSpelling","isSoldWithBlueprint","item","some","variant","acquisition","blueprintRoutesFor","routes","Map","set","blueprintAvailableFor","offered","asWritten","resolved","trim","id","signature","experimentalAvailableFor","primitiveLabelFor","maximumRange","falloffRange","scannerRange","shieldRegenRate","primitiveEngineeringInputsFor","canonicalGrade","round6","rounded","Math","round","is","float32FiringCycle","interval","burstRounds","burstRateOfFire","withinBurst","fround","cycle","float32RateOfFire","float32DamagePerSecond","damage","rounds","rate","damagePerCycle","JOURNAL_MODIFIER_ORDER","JOURNAL_MODIFIER_RANK","index","sortJournalModifiers","a","b","get","Label","length","journalModifiersFor","weapon","valueFor","fallback","find","candidate","burstTouched","damageTouched","rateTouched","damagePerSecond","derivedRate","continuous","burstInterval","rateOfFire","OriginalValue","burstRate","baseBurstRounds","baseBurstRate","baseInterval","baseCycle","baseRate","rateModifier","effectiveRate","effectiveInterval","effectiveCycle","stockRounds","roundsPerShot","effectiveRounds","result","includes","journalLabel","push","direct","findIndex","isFinalGuardianWeaponEngineering","group","engineerableBase","statsOverride","engineeringLocked","availableBlueprintsFor","engineerable","available","route","Number","isFinite","availableExperimentalsFor","effect","MAX_ENGINEERING_GRADE","modifiersWithExperimental","symbol","effectName","getPreEngineeredModifiers","journalModifiersWithExperimental","type","getPreEngineeredJournalModifiers","sameJournalNumber","actual","expected","abs","modifierKey","sameModifier","ValueStr","matchesModifierSignature","actualByKey","matched","predicted","identifyPreEngineeredVariant","engineering","stock","capturedBlueprint","variants","blueprintMatches","blueprintMatch","capturedGrade","isInteger","capturedExperimental","matches","primitive","unresolvedModifiers","getPreEngineeredStats","field","assign","experimentalDamageDistribution","m"],"mappings":"O,8yBAWO,SAASuB,sBACZC,WACAC,WACAC,iBAEA,MAAMC,MACFF,kBAAe,GAAaA,aAAe,GAAKC,uBAAoB,EAC9DA,gBAAkBD,WAClB,EACV,MAAO,IACCD,WAAWI,eAAY,EAAY,CAAA,EAAK,CAAEA,QAASJ,WAAWI,QAAUD,UACxEH,WAAWK,eAAY,EAAY,CAAA,EAAK,CAAEA,QAASL,WAAWK,QAAUF,UACxEH,WAAWM,iBAAc,EAAY,CAAA,EAAK,CAAEA,UAAWN,WAAWM,UAAYH,UAC9EH,WAAWO,gBAAa,EAAY,CAAA,EAAK,CAAEA,SAAUP,WAAWO,SAAWJ,UAC3EH,WAAWQ,gBAAa,EAAY,CAAA,EAAK,CAAEA,SAAUR,WAAWQ,SAAWL,UAC3EH,WAAWS,oBAAiB,EAC1B,CAAA,EACA,CAAEA,aAAcT,WAAWS,aAAaC,IAAKC,OAAUA,MAAQR,QAE7E,CCdO,SAASS,sBACZC,WAEA,OAAOA,UAAUH,IAAKI,WAAA,CAClBC,MAAOD,SAASC,MAChBC,OAAQF,SAASE,OACjBC,IAAKH,SAASH,MACdO,IAAKJ,SAASH,QA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B,YAAS,EAAW5B,SAASoD,WAAaxB,IAClD,CACA,GAAI3F,OAAO2B,mBAAqB6J,+BAAgC,CAC5DzH,SAASpC,iBAAmBpD,sBACxByB,OAAO2B,iBACP3B,OAAOyF,OACP1B,SAAS0B,OAEjB,CACA,OAAO1B,QACX,QAAApE,YAAAkJ,uBAAAM,0BAAAvF,sBAAAJ,mBAAAnD,mBAAAkB,iBAAA4C,yBAAAyF,iCAAAH,0BAAA4B,sBAAAb,6BAAAzK,oBAAAyI,iCAAA5I,oBAAA0G,oBAAArF,cAAAc,kBAAA0C,8BAAAlG,sBAAA6M"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{weaponsCapacitorMetrics}from"./chunk-FMPRCYKY.js";import{shieldRecovery,cellBankSummary}from"./chunk-VZZUNSDF.js";import{shieldMetrics}from"./chunk-2FHHMYDC.js";import{getShipSlots,getShipBySymbol,getShipByName}from"./chunk-IJRKEODR.js";import{parseSlef,toSlef,stringifySlef,getLoadoutModifier}from"./chunk-RKLJ7EEE.js";import{parseSlotName,enumerateSlots,SLOT_RESTRICTION_LABELS}from"./chunk-I7PIDRMU.js";import{sourcePurchaseFromLoadout,getSourceModuleValue}from"./chunk-QTDBO7R2.js";import{powerBudget}from"./chunk-76XKY2Y2.js";import{isNonOutfittingSlot,isBuiltInHullModule,cloneLoadoutModule,identifyPreEngineeredVariant,cloneModuleStats,availableBlueprintsFor,availableExperimentalsFor,blueprintAvailableFor,blueprintRoutesFor,experimentalAvailableFor,primitiveEngineeringInputsFor,missingBaseLabels,journalModifiersFor,getPreEngineeredStats,unresolvedModifiers,getPreEngineeredJournalModifiers,getPreEngineeredModifiers,matchingKeyIn,FITTED_ITEM,isFinalGuardianWeaponEngineering,scaleDamageComponents}from"./chunk-KLIYDSYF.js";import{weaponMetrics,sumWeaponMetrics,combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{builtInModuleBySymbol,getBulkheadsForShip}from"./chunk-MNXWK7PA.js";import{getPreEngineeredVariants}from"./chunk-32PVERNH.js";import{singleJumpRange,frameShiftDriveMassFactor,fuelPerJump,totalRange}from"./chunk-GQ5GX5TB.js";import{completeResult,calculateUnladenMass,calculateCargoCapacity,calculateFuelCapacity}from"./chunk-RF2IKLWQ.js";import{validateLoadout,fixedSlotReason}from"./chunk-BM7JQ5CH.js";import{mobilityMetrics}from"./chunk-24INI4U7.js";import{calculateModuleLimits}from"./chunk-KPETDYQX.js";import{ALL_MODULES}from"./chunk-53ERRGPM.js";import{CORE_MODULES}from"./chunk-O72KI7RP.js";import{getDefaultLoadout}from"./chunk-V3DW67W2.js";import{distributorMetrics}from"./chunk-P2QOL63K.js";import{getExperimentalEffect}from"./chunk-PMJG7PHU.js";import{heatMetrics}from"./chunk-QMQHIZGS.js";import{ammunitionCapacity}from"./chunk-AA3K5XUE.js";import{armourMetrics}from"./chunk-FGXWVFN6.js";import{baseStats,computeModifiers,labelsForDamageType,scaleForLabel,fieldForLabel,labelsForField,capabilityValueForLabel,damageTypeForLabel}from"./chunk-SVZARHWP.js";import{resolveBlueprintForModule}from"./chunk-ZJB5UYNE.js";import{getExperimentalsForModule}from"./chunk-TH4S5MVD.js";import{getBlueprintGrade}from"./chunk-DNTN34M4.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{truncate,describeValue,requireString,requireStringIfPresent}from"./chunk-B5TT26XE.js";import{deepFreeze}from"./chunk-DURKO7JU.js";var PREFIX={powerPlant:["int_powerplant","int_guardianpowerplant"],thrusters:["int_engine","int_mkiiagileboost_engine"],frameShiftDrive:["int_hyperdrive"],powerDistributor:["int_powerdistributor","int_guardianpowerdistributor"],shieldGenerator:["int_shieldgenerator"],shieldCellBank:["int_shieldcellbank"],shieldBooster:["hpt_shieldbooster"],shieldReinforcement:["int_guardianshieldreinforcement"],hullReinforcement:["int_hullreinforcement","int_guardianhullreinforcement","int_metaalloyhullreinforcement"],moduleReinforcement:["int_modulereinforcement","int_guardianmodulereinforcement"]};var startsWithAny=(symbol,prefixes)=>prefixes.some(prefix=>symbol.toLowerCase().startsWith(prefix));function isPowerDistributor(module,stats){return stats?.slot?stats.slot==="powerDistributor":startsWithAny(module.Item,PREFIX.powerDistributor)}function isEnabled(module){return module.On!==false}function priorityOf(module){return(module.Priority??0)+1}function effectiveStat(module,field,stats){const stated=statedModifier(module,field);if(stated!==void 0)return stated;const base=stats?.[field];return typeof base==="number"?base:void 0}function statedModifier(module,field){for(const label of labelsForField(field)){if(capabilityValueForLabel(label)!==null)continue;const modified=getLoadoutModifier(module,label);if(modified!==null)return modified/scaleForLabel(label)}return void 0}function effectiveCapability(module,field,stats){for(const label of labelsForField(field)){if(capabilityValueForLabel(label)===null)continue;if(module.Engineering?.Modifiers?.some(modifier=>modifier.Label.toLowerCase()===label.toLowerCase())){return true}}const base=stats[field];return typeof base==="boolean"?base:void 0}function effectiveDamageDistribution(module,stats){const fromEffect=module.Engineering?.ExperimentalEffect?getExperimentalEffect(module.Engineering.ExperimentalEffect)?.damageDistribution:void 0;const distribution={...fromEffect??stats.damageDistribution};let resolved=fromEffect!==void 0||stats.damageDistribution!==void 0;for(const modifier of module.Engineering?.Modifiers??[]){if(modifier.Value===void 0)continue;const type=damageTypeForLabel(modifier.Label);if(type===null)continue;distribution[type]=modifier.Value/scaleForLabel(modifier.Label);resolved=true}return resolved?distribution:void 0}function convertsDamage(module){if(module.Engineering?.ExperimentalEffect&&getExperimentalEffect(module.Engineering.ExperimentalEffect)?.damageDistribution){return true}return(module.Engineering?.Modifiers??[]).some(modifier=>damageTypeForLabel(modifier.Label)!==null)}function modifierRatio(module,stats,field){const base=stats?.[field];if(typeof base!=="number"||base===0)return 1;const effective=effectiveStat(module,field,stats);return effective===void 0?1:effective/base}function relatedStat(module,stats,field,ratio){const stated=statedModifier(module,field);if(stated!==void 0)return stated;const base=stats?.[field];return typeof base==="number"?base*ratio:void 0}function effectiveModule(module,stats){if(!stats||!module.Engineering)return stats;const merged={...stats};const fields=new Set(Object.keys(stats));for(const modifier of module.Engineering.Modifiers??[]){const field=fieldForLabel(modifier.Label,stats);if(field)fields.add(field)}for(const key of fields){const capability=effectiveCapability(module,key,stats);if(capability!==void 0){merged[key]=capability;continue}const value=effectiveStat(module,key,stats);if(value!==void 0)merged[key]=value}if(stats.engineeringGroup==="thrusters"){const massRatio=modifierRatio(module,stats,"optMass");const minMass=relatedStat(module,stats,"minMass",massRatio);const maxMass=relatedStat(module,stats,"maxMass",massRatio);if(minMass!==void 0)merged.minMass=minMass;if(maxMass!==void 0)merged.maxMass=maxMass}if(stats.engineeringGroup==="thrusters"||stats.engineeringGroup==="shieldGenerators"){const performanceRatio=modifierRatio(module,stats,"optMultiplier");const minMultiplier=relatedStat(module,stats,"minMultiplier",performanceRatio);const maxMultiplier=relatedStat(module,stats,"maxMultiplier",performanceRatio);if(minMultiplier!==void 0)merged.minMultiplier=minMultiplier;if(maxMultiplier!==void 0)merged.maxMultiplier=maxMultiplier;if(stats.engineeringGroup==="thrusters"){for(const field of["minSpeedMultiplier","optSpeedMultiplier","maxSpeedMultiplier","minRotationMultiplier","optRotationMultiplier","maxRotationMultiplier"]){const value=stats[field];if(value!==void 0)merged[field]=value*performanceRatio}}}const damageDistribution=effectiveDamageDistribution(module,stats);if(damageDistribution)merged.damageDistribution=damageDistribution;if(stats.category==="hardpoint")normalizeEffectiveWeapon(module,merged);if(convertsDamage(module)){delete merged.damageComponents}else if(stats.damageComponents){merged.damageComponents=scaleDamageComponents(stats.damageComponents,stats.damage,typeof merged.damage==="number"?merged.damage:void 0)}return merged}function powerConsumerFor(module,stats){const draw=effectiveStat(module,"powerDraw",stats);const parsedSlot=parseSlotName(module.Slot);const mounted=stats?.category==="hardpoint"||stats?.category==="utility";const deployedOnly=stats!==null?mounted&&stats.alwaysPowered!==true:parsedSlot?.kind==="hardpoint"?true:parsedSlot?.kind==="utility"?void 0:false;const common={priority:priorityOf(module),enabled:isEnabled(module),...deployedOnly===void 0?{}:{deployedOnly:deployedOnly},label:module.Slot};if(draw===void 0){const inherentlyPassiveSlot=parsedSlot?.kind==="armour"||parsedSlot?.kind==="core"&&(parsedSlot.core==="powerPlant"||parsedSlot.core==="fuelTank");if(stats!==null||inherentlyPassiveSlot||isNonOutfittingSlot(module.Slot))return null;return{drawUnknown:true,...common}}if(draw===0)return null;return{draw:draw,...common}}function powerAvailable(modules,statsFor){for(const module of modules){const stats=statsFor(module);const isPlant=stats?.slot?stats.slot==="powerPlant":startsWithAny(module.Item,PREFIX.powerPlant);if(!isPlant)continue;if(!isEnabled(module))return 0;return effectiveStat(module,"powerCapacity",stats)??0}return 0}function mapResistanceFields(read){return{kineticResistance:read("kineticResistance")??0,thermalResistance:read("thermalResistance")??0,explosiveResistance:read("explosiveResistance")??0,causticResistance:read("causticResistance")??0}}function resistancesOf(module,stats){return mapResistanceFields(field=>effectiveStat(module,field,stats))}function shieldInputFor(shipSymbol,modules,systemsPips,statsFor){const hull=getShipBySymbol(shipSymbol);let generator=null;const boosters=[];let reinforcement=0;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!generator&&startsWithAny(module.Item,PREFIX.shieldGenerator)){const massRatio=modifierRatio(module,stats,"optMass");const strengthRatio=modifierRatio(module,stats,"optMultiplier");const optMass=effectiveStat(module,"optMass",stats);const minMass=relatedStat(module,stats,"minMass",massRatio);const maxMass=relatedStat(module,stats,"maxMass",Math.max(1,massRatio));const optMultiplier=effectiveStat(module,"optMultiplier",stats);const minMultiplier=relatedStat(module,stats,"minMultiplier",strengthRatio);const maxMultiplier=relatedStat(module,stats,"maxMultiplier",strengthRatio);generator={...optMass===void 0?{}:{optMass:optMass},...minMass===void 0?{}:{minMass:minMass},...maxMass===void 0?{}:{maxMass:maxMass},...optMultiplier===void 0?{}:{optMultiplier:optMultiplier},...minMultiplier===void 0?{}:{minMultiplier:minMultiplier},...maxMultiplier===void 0?{}:{maxMultiplier:maxMultiplier},...resistancesOf(module,stats)}}else if(startsWithAny(module.Item,PREFIX.shieldBooster)){boosters.push({shieldBoost:effectiveStat(module,"shieldBoost",stats)??0,...resistancesOf(module,stats)})}else if(startsWithAny(module.Item,PREFIX.shieldReinforcement)){reinforcement+=effectiveStat(module,"shieldAddition",stats)??0}}return{hullMass:hull?.hullMass??0,baseShieldStrength:hull?.baseShieldStrength??0,generator:generator,boosters:boosters,reinforcement:reinforcement,systemsPips:systemsPips}}function mobilityInputFor(shipSymbol,modules,mass,enginesPips,statsFor){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;let thrusters=null;for(const module of modules){const stats=statsFor(module);const isThruster=stats?.slot?stats.slot==="thrusters":startsWithAny(module.Item,PREFIX.thrusters);if(!isThruster)continue;if(!isEnabled(module))return null;const effective=effectiveModule(module,stats);const minMass=effective?.minMass;const optMass=effective?.optMass;const maxMass=effective?.maxMass;const minMultiplier=effective?.minMultiplier;const optMultiplier=effective?.optMultiplier;const maxMultiplier=effective?.maxMultiplier;if(minMass===void 0||optMass===void 0||maxMass===void 0||minMultiplier===void 0||optMultiplier===void 0||maxMultiplier===void 0){return null}thrusters={minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:minMultiplier,optMultiplier:optMultiplier,maxMultiplier:maxMultiplier,...effective?.optSpeedMultiplier===void 0?{}:{speedCurve:{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:effective.minSpeedMultiplier??minMultiplier,optMultiplier:effective.optSpeedMultiplier,maxMultiplier:effective.maxSpeedMultiplier??maxMultiplier}},...effective?.optRotationMultiplier===void 0?{}:{rotationCurve:{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:effective.minRotationMultiplier??minMultiplier,optMultiplier:effective.optRotationMultiplier,maxMultiplier:effective.maxRotationMultiplier??maxMultiplier}}};break}if(!thrusters)return null;return{minimumSpeed:hull.minimumSpeed,maximumSpeed:hull.maximumSpeed,boost:hull.boost,minPitch:hull.minPitch,pitch:hull.pitch,minRoll:hull.minRoll,roll:hull.roll,minYaw:hull.minYaw,yaw:hull.yaw,mass:typeof mass==="function"?mass():mass,thrusters:thrusters,enginesPips:enginesPips}}function shieldRecoveryInputFor(shipSymbol,modules,systemsPips,statsFor){let generator=null;let distributor=null;for(const module of modules){const stats=statsFor(module);if(!generator&&startsWithAny(module.Item,PREFIX.shieldGenerator)){if(!isEnabled(module))return null;generator=module}if(isPowerDistributor(module,stats)&&isEnabled(module))distributor=module}if(!generator)return null;const generatorStats=statsFor(generator);const distributorStats=distributor?statsFor(distributor):null;const strength=shieldMetrics(shieldInputFor(shipSymbol,modules,0,statsFor)).strength;return{strength:strength,regenRate:effectiveStat(generator,"shieldRegenRate",generatorStats)??0,brokenRegenRate:effectiveStat(generator,"shieldBrokenRegenRate",generatorStats)??0,distributorDraw:effectiveStat(generator,"distributorDraw",generatorStats)??.6,systemsCapacity:distributor?effectiveStat(distributor,"systemsCapacity",distributorStats)??0:0,systemsRecharge:distributor?effectiveStat(distributor,"systemsRecharge",distributorStats)??0:0,systemsPips:systemsPips}}function weaponsCapacitorInputFor(modules,weaponsPips,budget,statsFor){let weaponsCapacity=0;let weaponsRecharge=0;let sustainedEnergyPerSecond=0;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!poweredStates(module,stats,budget).deployed)continue;if(isPowerDistributor(module,stats)){weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats)??0;weaponsRecharge=effectiveStat(module,"weaponsRecharge",stats)??0}const weapon=weaponStatsFor(module,stats);if(weapon){sustainedEnergyPerSecond+=weaponMetrics(weapon).sustainedEnergyPerSecond}}return{weaponsCapacity:weaponsCapacity,weaponsRecharge:weaponsRecharge,sustainedEnergyPerSecond:sustainedEnergyPerSecond,weaponsPips:weaponsPips}}function distributorInputFor(modules,pips,budget,statsFor){for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!isPowerDistributor(module,stats))continue;if(!poweredStates(module,stats,budget).retracted)return null;const systemsCapacity=effectiveStat(module,"systemsCapacity",stats);const systemsRecharge=effectiveStat(module,"systemsRecharge",stats);const enginesCapacity=effectiveStat(module,"enginesCapacity",stats);const enginesRecharge=effectiveStat(module,"enginesRecharge",stats);const weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats);const weaponsRecharge=effectiveStat(module,"weaponsRecharge",stats);if(systemsCapacity===void 0||systemsRecharge===void 0||enginesCapacity===void 0||enginesRecharge===void 0||weaponsCapacity===void 0||weaponsRecharge===void 0){return null}return{systemsCapacity:systemsCapacity,systemsRecharge:systemsRecharge,enginesCapacity:enginesCapacity,enginesRecharge:enginesRecharge,weaponsCapacity:weaponsCapacity,weaponsRecharge:weaponsRecharge,...pips}}return null}function heatInputFor(shipSymbol,modules,budget,statsFor){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;let heatEfficiency;let thrusterHeatRate=0;let deployedThrusterHeatRate=0;let fsdHeatRate=0;let weaponsCapacity=0;const weapons=[];for(const module of modules){const stats=statsFor(module);const isPlant=stats?.slot?stats.slot==="powerPlant":startsWithAny(module.Item,PREFIX.powerPlant);if(isPlant){if(!isEnabled(module))return null;heatEfficiency=effectiveStat(module,"heatEfficiency",stats);continue}if(!isEnabled(module))continue;const running=poweredStates(module,stats,budget);if(stats?.slot?stats.slot==="thrusters":startsWithAny(module.Item,PREFIX.thrusters)){const heat=effectiveStat(module,"engineHeatRate",stats)??0;if(running.retracted)thrusterHeatRate+=heat;if(running.deployed)deployedThrusterHeatRate+=heat}else if(stats?.slot?stats.slot==="frameShiftDrive":startsWithAny(module.Item,PREFIX.frameShiftDrive)){if(running.retracted)fsdHeatRate+=effectiveStat(module,"fsdHeatRate",stats)??0}else if(isPowerDistributor(module,stats)){if(running.deployed){weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats)??0}}const weapon=weaponStatsFor(module,stats);if(!weapon||!running.deployed)continue;weapons.push({heatPerSecond:weaponMetrics(weapon).sustainedHeatPerSecond,distributorDraw:weapon.distributorDraw??0})}if(heatEfficiency===void 0)return null;return{heatCapacity:hull.heatCapacity,heatDissipation:hull.heatDissipation,heatEfficiency:heatEfficiency,retractedPowerDraw:poweredDraw(budget,"retracted"),deployedPowerDraw:poweredDraw(budget,"deployed"),thrusterHeatRate:thrusterHeatRate,deployedThrusterHeatRate:deployedThrusterHeatRate,fsdHeatRate:fsdHeatRate,weaponsCapacity:weaponsCapacity,weapons:weapons,unknownDraws:budget.unknownDraws.map(consumer=>consumer.label??"(unnamed module)")}}function poweredDraw(budget,state){const powered=state==="retracted"?"poweredRetracted":"poweredDeployed";return budget.bands.reduce((total,band)=>band[powered]?total+band[state]:total,0)}function poweredStates(module,stats,budget){const draw=effectiveStat(module,"powerDraw",stats);if(draw===void 0||draw===0)return{retracted:true,deployed:true};const band=budget.bands[Math.min(budget.bands.length,Math.max(1,priorityOf(module)))-1];if(!band)return{retracted:true,deployed:true};return{retracted:band.poweredRetracted,deployed:band.poweredDeployed}}function cellBankInputsFor(modules,budget,statsFor){const banks=[];for(const module of modules){if(!startsWithAny(module.Item,PREFIX.shieldCellBank))continue;const stats=statsFor(module);const effective=effectiveModule(module,stats);const ammunition=effective?ammunitionCapacity(effective):null;banks.push({slot:module.Slot,symbol:module.Item,reinforcementRate:effective?.shieldBankReinforcement??0,cells:ammunition?.total??0,spinUp:effective?.shieldBankSpinUp??0,duration:effective?.shieldBankDuration??0,heat:effective?.shieldBankHeat??0,powered:budget.available>0&&isEnabled(module)&&poweredStates(module,stats,budget).deployed})}return banks}function stockBulkhead(shipSymbol){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;const variants=getBulkheadsForShip(hull.name,CORE_MODULES);return variants.find(v=>v.symbol.toLowerCase().endsWith("_default"))??variants.find(v=>v.mass===0)??variants[0]??null}function armourInputFor(shipSymbol,modules,statsFor){const hull=getShipBySymbol(shipSymbol);const reinforcements=[];const moduleReinforcements=[];let bulkhead=null;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(module.Slot.toLowerCase()==="armour"){bulkhead={hullBoost:effectiveStat(module,"hullBoost",stats)??0,...resistancesOf(module,stats)}}else if(startsWithAny(module.Item,PREFIX.hullReinforcement)){const boost=getLoadoutModifier(module,"DefenceModifierHealthMultiplier");reinforcements.push({hullReinforcement:effectiveStat(module,"hullReinforcement",stats)??0,hullBoost:boost===null?0:boost/scaleForLabel("DefenceModifierHealthMultiplier"),...resistancesOf(module,stats)})}else if(startsWithAny(module.Item,PREFIX.moduleReinforcement)){moduleReinforcements.push({moduleProtection:effectiveStat(module,"moduleProtection",stats)??0,integrity:effectiveStat(module,"integrity",stats)??0})}}if(!bulkhead){const stock=stockBulkhead(shipSymbol);bulkhead=stock?{hullBoost:stock.hullBoost??0,...mapResistanceFields(field=>stock[field])}:null}return{baseArmour:hull?.baseArmour??0,bulkhead:bulkhead,reinforcements:reinforcements,moduleReinforcements:moduleReinforcements}}var WEAPON_FIELDS=["damage","roundsPerShot","rateOfFire","burstInterval","burstRounds","burstRateOfFire","chargeTime","clipSize","ammoMaximum","reloadTime","distributorDraw","thermalLoad","powerDraw","maximumRange","falloffRange","armourPiercing"];function weaponStatsFor(module,stats){if(!stats||stats.category!=="hardpoint")return null;const weapon={};for(const field of WEAPON_FIELDS){const value=effectiveStat(module,field,stats);if(value!==void 0)weapon[field]=value}normalizeEffectiveWeapon(module,weapon);const damageDistribution=effectiveDamageDistribution(module,stats);if(damageDistribution)weapon.damageDistribution=damageDistribution;if(stats.damageComponents&&!convertsDamage(module)){weapon.damageComponents=scaleDamageComponents(stats.damageComponents,stats.damage,typeof weapon.damage==="number"?weapon.damage:void 0)}if(stats.projectileRange)weapon.projectileRange={...stats.projectileRange};return weapon}function burstAdjustedRateOfFire(module,weapon){if(getLoadoutModifier(module,"RateOfFire")!==null)return void 0;const touched=["BurstSize","BurstRateOfFire","BurstInterval"].some(label=>getLoadoutModifier(module,label)!==null);if(!touched)return void 0;return combinedRateOfFire(weapon)}function normalizeEffectiveWeapon(module,weapon){const rate=burstAdjustedRateOfFire(module,weapon);if(rate!==void 0)weapon.rateOfFire=rate;const statedDamagePerSecond=getLoadoutModifier(module,"DamagePerSecond");const firingFactor=Number(weapon.roundsPerShot??1)*Number(weapon.rateOfFire??1);if(statedDamagePerSecond!==null&&firingFactor>0){weapon.damage=statedDamagePerSecond/firingFactor}const{maximumRange:maximumRange,falloffRange:falloffRange}=weapon;if(maximumRange!==void 0&&falloffRange!==void 0&&falloffRange>maximumRange){weapon.falloffRange=maximumRange}}var CORE_NAMES={powerPlant:"Power Plant",thrusters:"Thrusters",frameShiftDrive:"Frame Shift Drive",lifeSupport:"Life Support",powerDistributor:"Power Distributor",sensors:"Sensors",fuelTank:"Fuel Tank"};var RESTRICTED_OPTIONAL_NAMES={military:"Military Slot",cargo:"Cargo Slot",limpetController:"Limpet Controller Slot",vesselHangar:"Vessel Hangar Slot",passenger:"Passenger Slot"};function trailingDigits(key){let start=key.length;while(start>0){const code=key.charCodeAt(start-1);if(code<48||code>57)break;start--}return start===key.length?null:key.slice(start)}function loadoutSlotName(slot){switch(slot.kind){case"core":return CORE_NAMES[slot.core];case"hardpoint":{const match=/^(Small|Medium|Large|Huge)(Mining)?Hardpoint(\d+)$/.exec(slot.key);if(!match)return slot.key;return`${match[1]}${match[2]?" Mining":""} Hardpoint ${Number(match[3])}`}case"utility":{const match=/^TinyHardpoint(\d+)$/.exec(slot.key);return match?`Utility Mount ${Number(match[1])}`:slot.key}case"optional":{if(slot.restriction==="planetaryApproachSuite")return"Planetary Approach Suite";if(slot.restriction){const numbered=trailingDigits(slot.key);const label=RESTRICTED_OPTIONAL_NAMES[slot.restriction];return label&&numbered?`${label} ${Number(numbered)}`:slot.key}const optional=/^Slot(\d+)_Size(\d+)$/.exec(slot.key);return optional?`Optional Internal ${Number(optional[1])} (Size ${slot.size})`:slot.key}case"armour":return"Armour";case"cargoHatch":return"Cargo Hatch"}}var MILITARY_PREFIXES=["int_hullreinforcement","int_metaalloyhullreinforcement","int_modulereinforcement","int_shieldcellbank","int_guardianhullreinforcement","int_guardianmodulereinforcement","int_guardianshieldreinforcement"];var MINING_PREFIXES=["hpt_mininglaser","hpt_mining_abrblstr","hpt_mining_seismchrgwarhd","hpt_mining_subsurfdispmisle","hpt_human_extraction","hpt_miningtoolv2"];var CARGO_PREFIXES=["int_cargorack","int_largecargorack","int_corrosionproofcargorack","int_fueltank"];var RESTRICTED_SLOT_PREFIXES={mining:MINING_PREFIXES,military:MILITARY_PREFIXES,cargo:CARGO_PREFIXES,limpetController:["int_dronecontrol","int_multidronecontrol"],vesselHangar:["int_fighterbay"],passenger:["int_passengercabin","int_mkii_passengercabin"],planetaryApproachSuite:["int_planetapproachsuite"]};var problem=(constraint,message,params)=>({constraint:constraint,message:message,...params===void 0?{}:{params:params}});function restrictionProblem(slot,symbol){const restriction=slot.restriction;if(!restriction)return null;if(RESTRICTED_SLOT_PREFIXES[restriction].some(prefix=>symbol.startsWith(prefix))){return null}return problem("restrictedMount",`slot only takes ${SLOT_RESTRICTION_LABELS[restriction]}`,{restriction:restriction})}function moduleSlotProblem(slot,module){const required=module.restrictedToSlot;if(!required||slot.restriction===required)return null;return problem("restrictedMount",`module only fits a mount that takes ${SLOT_RESTRICTION_LABELS[required]}`,{restriction:required})}function moduleFitProblem(shipSymbol,slot,module){if(slot.kind==="cargoHatch"){return problem("immutableSlot","the cargoHatch slot cannot be changed")}if(slot.kind==="armour"){const hull=getShipBySymbol(shipSymbol);if(module.slot!=="armour"||module.ship===void 0){return problem("armourRequired","not a ship armour module")}if(!hull||module.ship.toLowerCase()!==hull.name.toLowerCase()){const armourHull=getShipByName(module.ship);return problem("wrongHullArmour",`armour belongs to ${truncate(module.ship)}, not ${truncate(hull?.name??shipSymbol)}`,{armourShipName:module.ship,...armourHull===null?{}:{armourShipSymbol:armourHull.symbol},shipSymbol:shipSymbol,...hull===null?{}:{shipName:hull.name}})}return null}const restricted=module.restrictedToShips;if(restricted&&!restricted.some(symbol2=>symbol2.toLowerCase()===shipSymbol.toLowerCase())){const allowedShipNames=restricted.map(symbol2=>{const hull=getShipBySymbol(symbol2);return hull?.name??symbol2});const labels=restricted.map((symbol2,index)=>{const name=allowedShipNames[index];return name===symbol2?symbol2:`${name} (${symbol2})`});return problem("restrictedHull",`module is restricted to ${truncate(labels.join(", "))}`,{allowedShipNames:allowedShipNames,allowedShipSymbols:[...restricted],shipSymbol:shipSymbol})}const wrongMount=moduleSlotProblem(slot,module);if(wrongMount)return wrongMount;const symbol=module.symbol.toLowerCase();const moduleSlot=module.slot;switch(slot.kind){case"core":if(moduleSlot!==slot.core){return problem("wrongCoreType",`not a ${slot.core} module`,{requiredCore:slot.core,moduleSlot:moduleSlot??"none"})}break;case"hardpoint":{if(module.category!=="hardpoint"){return problem("hardpointRequired","not a hardpoint weapon")}const restricted2=restrictionProblem(slot,symbol);if(restricted2)return restricted2;break}case"utility":if(module.category!=="utility"){return problem("utilityRequired","not a utility module")}return null;case"optional":{const isFuelTank=moduleSlot==="fuelTank";if(module.category!=="internal"&&!isFuelTank){return problem("optionalInternalRequired","not an optional-internal module")}if(moduleSlot&&!isFuelTank){return problem("coreModuleInOptionalSlot","a core module only fits its core slot")}const restricted2=restrictionProblem(slot,symbol);if(restricted2)return restricted2;break}}return module.class>slot.size?problem("oversized",`module size ${truncate(module.class)} exceeds slot size ${slot.size}`,{moduleClass:module.class,slotSize:slot.size}):null}function moduleFitError(shipSymbol,slot,module){return moduleFitProblem(shipSymbol,slot,module)?.message??null}var REBUY_FRACTION=.05;function exportLoadoutEvent(input,options){const fromSource=options.credits==="source";const source=fromSource?input.sourcePurchase:null;const totals=source!==null&&sourceTotalsHold(input.modules,source)?source:null;const hullValue=fromSource?source?.hullValue??null:input.retailHullValue;const modulesValue=fromSource?totals?.modulesValue??null:computedModulesValue(input.modules,input.statsFor);const rebuy=fromSource?totals?.rebuy??null:hullValue===null||modulesValue===null?null:Math.trunc((hullValue+modulesValue)*REBUY_FRACTION);return{event:"Loadout",Ship:input.shipSymbol.toLowerCase(),...input.shipName===void 0?{}:{ShipName:input.shipName},...input.shipIdent===void 0?{}:{ShipIdent:input.shipIdent},...hullValue===null?{}:{HullValue:hullValue},...modulesValue===null?{}:{ModulesValue:modulesValue},...input.unladenMass===null?{}:{UnladenMass:input.unladenMass},...input.cargoCapacity===null?{}:{CargoCapacity:input.cargoCapacity},...input.maxJumpRange===null?{}:{MaxJumpRange:input.maxJumpRange},...input.fuelCapacity===null?{}:{FuelCapacity:{Main:input.fuelCapacity.main,Reserve:input.fuelCapacity.reserve}},...rebuy===null?{}:{Rebuy:rebuy},Modules:exportModules(input,options,fromSource)}}function exportModules(input,options,fromSource){const ordered=options.moduleOrder==="slots"?slotOrderedModules(input.shipSymbol,input.modules,input.layout):[...input.modules.values()];return ordered.map(module=>{const on=module.On??(options.explicitPower?true:void 0);const priority=module.Priority??(options.explicitPower?0:void 0);const value=fromSource?sourceModuleValue(module,input.sourcePurchase):moduleValue(module,input.statsFor);return{Slot:module.Slot,Item:module.Item.toLowerCase(),...on===void 0?{}:{On:on},...priority===void 0?{}:{Priority:priority},...module.Health===void 0?{}:{Health:module.Health},...typeof value==="number"?{Value:value}:{},...module.Engineering===void 0?{}:{Engineering:cloneLoadoutModule(module).Engineering}}})}function slotOrderedModules(shipSymbol,modules,layout){if(!layout){throw new TypeError(`ShipLoadout.toLoadoutEvent: no slot layout for hull "${truncate(shipSymbol)}", so modules cannot be ordered by slot`)}const remaining=new Map(modules);const ordered=[];for(const slot of layout){const key=matchingKeyIn(remaining,slot.key);const module=key===null?void 0:remaining.get(key);if(module&&key!==null){ordered.push(module);remaining.delete(key)}}return[...ordered,...remaining.values()]}function computedModulesValue(modules,statsFor){let sum=0;for(const module of modules.values()){const value=moduleValue(module,statsFor);if(value==="unknown")return null;if(value!=="free")sum+=value}return sum}function moduleValue(module,statsFor){const stats=statsFor(module);if(stats!==null)return stats.cost??"unknown";return isNonOutfittingSlot(module.Slot)||isBuiltInHullModule(module)?"free":"unknown"}var SOURCE_ITEM="ShipLoadout: sourcePurchase moduleValues[].item";function sourceModuleValue(module,source){const entry=source===null?null:getSourceModuleValue(source,module.Slot);if(entry===null)return"unknown";return normalizeKey(entry.item,SOURCE_ITEM)===normalizeKey(module.Item,FITTED_ITEM)?entry.value:"unknown"}function sourceTotalsHold(modules,source){for(const entry of source.moduleValues){const key=matchingKeyIn(modules,entry.slot);const fitted=key===null?void 0:modules.get(key);if(!fitted||normalizeKey(fitted.Item,FITTED_ITEM)!==normalizeKey(entry.item,SOURCE_ITEM)){return false}}return true}function captureLoadoutEvent(event){const modules=event.Modules;const shipName=event.ShipName;const shipIdent=event.ShipIdent;const hullValue=event.HullValue;const modulesValue=event.ModulesValue;const rebuy=event.Rebuy;const unladenMass=event.UnladenMass;const cargoCapacity=event.CargoCapacity;const fuelCapacity=event.FuelCapacity;return{Ship:event.Ship,Modules:Array.isArray(modules)?captureEach(modules,captureModule):modules,...shipName===void 0?{}:{ShipName:shipName},...shipIdent===void 0?{}:{ShipIdent:shipIdent},...hullValue===void 0?{}:{HullValue:hullValue},...modulesValue===void 0?{}:{ModulesValue:modulesValue},...rebuy===void 0?{}:{Rebuy:rebuy},...unladenMass===void 0?{}:{UnladenMass:unladenMass},...cargoCapacity===void 0?{}:{CargoCapacity:cargoCapacity},...fuelCapacity===void 0?{}:{FuelCapacity:{...fuelCapacity}}}}function captureEach(values,capture){const captured=[];const{length:length}=values;for(let index=0;index<length;index++)captured.push(capture(values[index]));return captured}function captureModule(module){if(module===null||typeof module!=="object")return module;const on=module.On;const priority=module.Priority;const health=module.Health;const value=module.Value;const engineering=module.Engineering;return{Slot:module.Slot,Item:module.Item,...on===void 0?{}:{On:on},...priority===void 0?{}:{Priority:priority},...health===void 0?{}:{Health:health},...value===void 0?{}:{Value:value},...engineering===void 0?{}:{Engineering:captureEngineering(engineering)}}}function captureEngineering(engineering){if(engineering===null||typeof engineering!=="object")return engineering;const experimental=engineering.ExperimentalEffect;const experimentalLocalised=engineering.ExperimentalEffect_Localised;const modifiers=engineering.Modifiers;return{BlueprintName:engineering.BlueprintName,Level:engineering.Level,Quality:engineering.Quality,...experimental===void 0?{}:{ExperimentalEffect:experimental},...experimentalLocalised===void 0?{}:{ExperimentalEffect_Localised:experimentalLocalised},...modifiers===void 0?{}:{Modifiers:Array.isArray(modifiers)?captureEach(modifiers,modifier=>modifier!==null&&typeof modifier==="object"?{...modifier}:modifier):modifiers}}}function normalizeLoadoutEvent(rawEvent){const event=captureLoadoutEvent(rawEvent);requireStringIfPresent(event.Ship,"ShipLoadout.fromLoadout: event.Ship");if(!Array.isArray(event.Modules)){throw new TypeError(`ShipLoadout.fromLoadout: event.Modules must be an array, received ${describeValue(event.Modules)}`)}const modules=/* @__PURE__ */new Map;const slots=/* @__PURE__ */new Set;for(const module of event.Modules){if(module===null||typeof module!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: event.Modules[] must hold module objects, received ${describeValue(module)}`)}requireString(module.Slot,"ShipLoadout.fromLoadout: module.Slot");requireString(module.Item,"ShipLoadout.fromLoadout: module.Item");if(module.Engineering!==void 0){if(module.Engineering===null||typeof module.Engineering!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering must be an object, received ${describeValue(module.Engineering)}`)}requireStringIfPresent(module.Engineering.BlueprintName,"ShipLoadout.fromLoadout: module.Engineering.BlueprintName");requireStringIfPresent(module.Engineering.ExperimentalEffect,"ShipLoadout.fromLoadout: module.Engineering.ExperimentalEffect");if(module.Engineering.Modifiers!==void 0&&!Array.isArray(module.Engineering.Modifiers)){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering.Modifiers must be an array, received ${describeValue(module.Engineering.Modifiers)}`)}for(const[index,modifier]of(module.Engineering.Modifiers??[]).entries()){if(modifier===null||typeof modifier!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering.Modifiers[${index}] must be an object, received ${describeValue(modifier)}`)}requireString(modifier.Label,`ShipLoadout.fromLoadout: module.Engineering.Modifiers[${index}].Label`)}}const normalizedSlot=module.Slot.toLowerCase();if(slots.has(normalizedSlot)){throw new TypeError(`ShipLoadout.fromLoadout: duplicate slot "${truncate(module.Slot)}"`)}slots.add(normalizedSlot);modules.set(module.Slot,cloneLoadoutModule(module))}const top={};if(event.ShipName!==void 0)top.ShipName=event.ShipName;if(event.ShipIdent!==void 0)top.ShipIdent=event.ShipIdent;if(event.HullValue!==void 0)top.HullValue=event.HullValue;if(event.ModulesValue!==void 0)top.ModulesValue=event.ModulesValue;if(event.Rebuy!==void 0)top.Rebuy=event.Rebuy;if(event.UnladenMass!==void 0)top.UnladenMass=event.UnladenMass;if(event.CargoCapacity!==void 0)top.CargoCapacity=event.CargoCapacity;if(event.FuelCapacity!==void 0)top.FuelCapacity={...event.FuelCapacity};const moduleStats=/* @__PURE__ */new Map;for(const module of modules.values()){const engineering=module.Engineering;const variant=identifyPreEngineeredVariant(module);const variantStats=variant?getPreEngineeredStats(variant):null;if(variantStats)moduleStats.set(module.Slot,cloneModuleStats(variantStats));if(variantStats?.engineeringLocked||typeof engineering?.BlueprintName!=="string"||!isFinalGuardianWeaponEngineering(module.Item,engineering.BlueprintName)){continue}const normalizedBlueprint=normalizeKey(engineering.BlueprintName,"ShipLoadout.fromLoadout: module.Engineering.BlueprintName");const normalizedExperimental=normalizeKey(engineering.ExperimentalEffect,"ShipLoadout.fromLoadout: module.Engineering.ExperimentalEffect");const exact=getPreEngineeredVariants(module.Item).find(candidate=>candidate.blueprint.toLowerCase()===normalizedBlueprint&&candidate.grade===engineering.Level&&candidate.experimental?.toLowerCase()===normalizedExperimental);const stats=exact?getPreEngineeredStats(exact):builtInModuleBySymbol(module.Item,"ShipLoadout.fromLoadout: module.Item");if(stats){moduleStats.set(module.Slot,cloneModuleStats({...stats,engineeringLocked:true}))}}return{shipSymbol:event.Ship,modules:modules,moduleStats:moduleStats,top:top,sourcePurchase:sourcePurchaseFromLoadout(event)}}var SLOT_KEY="ShipLoadout: slotKey";var requireLoadOptions=(scope,options)=>{for(const field of["fuel","cargo"]){const value=options[field];if(value!==void 0&&(!Number.isFinite(value)||value<0)){throw new RangeError(`${scope}: ${field} must be a finite non-negative number`)}}};var LoadoutEditError=class extends TypeError{code;constraint;params;constructor(message,code,params,constraint){super(message);this.code=code;this.params=deepFreeze(Object.fromEntries(Object.entries(params).map(([key,value])=>[key,Array.isArray(value)?[...value]:value])));if(constraint!==void 0)this.constraint=constraint}};var FSD_PREFIX="int_hyperdrive";var BOOSTER_PREFIX="int_guardianfsdbooster";var FUEL_TANK_PREFIX="int_fueltank";var ShipLoadout=class _ShipLoadout{#shipSymbol;#modules;#moduleStats;#primitiveModifiers=/* @__PURE__ */new Map;#top;#sourcePurchase;#version=0;#viewVersion=0;#layoutCache;#calculationCache=null;#validationCache=null;#fittedModuleCache=null;#slotCache=null;constructor(shipSymbol,modules,top,sourcePurchase=null,moduleStats=/* @__PURE__ */new Map){this.#shipSymbol=shipSymbol;this.#modules=modules;this.#top=top;this.#sourcePurchase=sourcePurchase;this.#moduleStats=moduleStats}static fromSlef(input,index=0){const entries=parseSlef(input);const entry=entries[index];if(!entry){throw new TypeError(`ShipLoadout.fromSlef: no entry at index ${truncate(index)} (have ${entries.length})`)}return _ShipLoadout.fromLoadout(entry.data)}static fromLoadout(event){if(event===null||typeof event!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: event must be a Loadout event, received ${describeValue(event)}`)}const imported=normalizeLoadoutEvent(event);return new _ShipLoadout(imported.shipSymbol,imported.modules,imported.top,imported.sourcePurchase,imported.moduleStats)}static empty(shipSymbol){const layout=getShipSlots(requireString(shipSymbol,"ShipLoadout.empty: shipSymbol"));if(!layout){throw new TypeError(`ShipLoadout.empty: no slot layout for hull "${truncate(shipSymbol)}"`)}return new _ShipLoadout(layout.symbol,/* @__PURE__ */new Map,{})}static default(shipSymbol){const requested=requireString(shipSymbol,"ShipLoadout.default: shipSymbol");const loadout=getDefaultLoadout(requested);if(!loadout){throw new TypeError(`ShipLoadout.default: no default loadout for hull "${truncate(shipSymbol)}"`)}return new _ShipLoadout(loadout.symbol,new Map(loadout.modules.map(module=>[module.slot,{Slot:module.slot,Item:module.symbol}])),{})}get shipSymbol(){return this.#shipSymbol}get shipName(){return this.#top.ShipName??null}get shipIdent(){return this.#top.ShipIdent??null}get unladenMass(){return this.unladenMassResult.value}get unladenMassResult(){return this.#top.UnladenMass===void 0?this.#computedUnladenMass():completeResult(this.#top.UnladenMass)}#computedUnladenMass(){return calculateUnladenMass(getShipBySymbol(this.#shipSymbol)?.hullMass??null,this.#calculationModules())}get fuelCapacity(){return this.fuelCapacityResult.value}get fuelCapacityResult(){const cap=this.#top.FuelCapacity;if(cap?.Main!==void 0&&cap.Reserve!==void 0){return completeResult(Object.freeze({main:cap.Main,reserve:cap.Reserve}))}const computed=this.#computedFuelCapacity();if(computed.value===null)return computed;return completeResult(Object.freeze({main:cap?.Main??computed.value.main,reserve:cap?.Reserve??computed.value.reserve}))}get cargoCapacity(){return this.cargoCapacityResult.value}get cargoCapacityResult(){return this.#top.CargoCapacity===void 0?this.#computedCargoCapacity():completeResult(this.#top.CargoCapacity)}#computedCargoCapacity(){return calculateCargoCapacity(this.#calculationModules())}#computedFuelCapacity(){return calculateFuelCapacity(getShipBySymbol(this.#shipSymbol)?.reserveFuelCapacity??null,this.#calculationModules())}get hullValue(){return this.#top.HullValue??null}get modulesValue(){return this.#top.ModulesValue??null}get rebuy(){return this.#top.Rebuy??null}get sourcePurchase(){return this.#sourcePurchase}get validation(){const cached=this.#validationCache;if(cached!==null&&cached.version===this.#version)return cached.value;const slots=this.#layoutOrNull();const byKey=new Map(slots?.map(slot=>[slot.key.toLowerCase(),slot])??[]);const modules=[...this.#modules.values()].map(module=>{const stats=this.#statsFor(module);const slot=byKey.get(module.Slot.toLowerCase());const builtIn=stats===null&&isNonOutfittingSlot(module.Slot)||isBuiltInHullModule(module);const fitProblem=stats&&slot&&!builtIn?moduleFitProblem(this.#shipSymbol,slot,stats):null;return{slot:module.Slot,symbol:module.Item,known:stats!==null||builtIn,requiresKnownSlot:!builtIn,fitError:fitProblem?.message??null,...fitProblem===null?{}:{fitConstraint:fitProblem.constraint},...fitProblem?.params===void 0?{}:{fitParams:fitProblem.params},...stats?.exclusionGroup===void 0?{}:{exclusionGroup:stats.exclusionGroup},...stats?.limitGroup===void 0?{}:{limitGroup:stats.limitGroup},...stats?.limitIncrease===void 0?{}:{limitIncrease:stats.limitIncrease}}});const value=validateLoadout({shipSymbol:this.#shipSymbol,slots:slots,modules:modules});this.#validationCache={version:this.#version,value:value};return value}slots(kind){let cached=this.#slotCache;if(cached===null||cached.version!==this.#viewVersion){cached={version:this.#viewVersion,value:/* @__PURE__ */new Map};this.#slotCache=cached}const existing=cached.value.get(kind);if(existing!==void 0)return existing;const slots=kind===void 0?this.#layout():this.#layout().filter(slot=>slot.kind===kind);const currentLimits=this.#moduleLimits();const value=deepFreeze(slots.map(slot=>{const stats=this.#moduleStatsAt(slot.key);const fixedReason=fixedSlotReason(slot);const immovableReason=fixedReason!==null?fixedReason:stats?.limitIncrease!==void 0&&this.#moduleLimitRegression(slot.key,null,currentLimits,stats)!==null?"moduleLimit":null;return{...slot,name:loadoutSlotName(slot),module:this.fittedModuleAt(slot.key),removable:immovableReason===null,...immovableReason===null?{}:{immovableReason:immovableReason}}}));cached.value.set(kind,value);return value}fittedModuleAt(slotKey){const module=this.#fittedModuleFor(slotKey);if(!module)return null;let cached=this.#fittedModuleCache;if(cached===null||cached.version!==this.#viewVersion){cached={version:this.#viewVersion,value:/* @__PURE__ */new Map};this.#fittedModuleCache=cached}const existing=cached.value.get(module.Slot);if(existing!==void 0)return existing;const raw=cloneLoadoutModule(module);const stats=this.#statsFor(module);const effective=effectiveModule(this.#moduleForEffectiveStats(module),stats);const value=deepFreeze({slot:module.Slot,symbol:raw.Item,on:raw.On,priority:raw.Priority,health:raw.Health,value:raw.Value,engineering:raw.Engineering,raw:raw,stats:stats===null?null:cloneModuleStats(stats),effectiveStats:effective===null?null:cloneModuleStats(effective),ammunition:ammunitionCapacity(effective),preEngineeredVariant:identifyPreEngineeredVariant(raw)});cached.value.set(module.Slot,value);return value}fittedModules(){return deepFreeze([...this.#modules.keys()].flatMap(key=>{const fitted=this.fittedModuleAt(key);return fitted===null?[]:[fitted]}))}availableBlueprints(slotKey){const module=this.#fittedModuleFor(slotKey);return deepFreeze(module?availableBlueprintsFor(module.Item,this.#statsFor(module)):[])}availableExperimentalEffects(slotKey){const module=this.#fittedModuleFor(slotKey);return deepFreeze(module?availableExperimentalsFor(module.Item,this.#statsFor(module)):[])}modulesForSlot(slotKey){const slot=this.#requireSlot(slotKey);const occupied=new Set([...this.#modules.values()].flatMap(fitted=>{if(fitted.Slot.toLowerCase()===slot.key.toLowerCase())return[];const group=this.#statsFor(fitted)?.exclusionGroup;return group===void 0?[]:[group]}));const currentLimits=this.#moduleLimits();const currentStats=this.#moduleStatsAt(slot.key);return ALL_MODULES.filter(module=>moduleFitError(this.#shipSymbol,slot,module)===null&&(module.exclusionGroup===void 0||!occupied.has(module.exclusionGroup))&&this.#moduleLimitRegression(slot.key,module,currentLimits,currentStats)===null)}setModule(slotKey,module){const slot=this.#requireSlot(slotKey);if(module===null||module===void 0){throw new TypeError(`ShipLoadout.setModule: no module supplied for "${truncate(slotKey)}" (did the module lookup return undefined?)`)}if(typeof module.symbol!=="string"){throw new TypeError(`ShipLoadout.setModule: module for "${truncate(slotKey)}" must be an outfitting module, received ${describeValue(module)}`)}const problem2=moduleFitProblem(this.#shipSymbol,slot,module);if(problem2){if(problem2.constraint==="immutableSlot"){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${problem2.message}`,"immutableSlot",{slot:slot.key})}throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${problem2.message}`,"incompatibleModule",{...problem2.params,slot:slot.key,symbol:module.symbol,constraint:problem2.constraint},problem2.constraint)}if(module.exclusionGroup!==void 0){const conflict=[...this.#modules.values()].find(fitted=>fitted.Slot.toLowerCase()!==slot.key.toLowerCase()&&this.#statsFor(fitted)?.exclusionGroup===module.exclusionGroup);if(conflict){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${module.exclusionGroup} is limited to one per ship (already fitted in ${truncate(conflict.Slot)})`,"duplicateExclusiveModule",{exclusionGroup:module.exclusionGroup,slot:slot.key,symbol:module.symbol,previousSlot:conflict.Slot,previousSymbol:conflict.Item})}}const limitProblem=this.#moduleLimitRegression(slot.key,module);if(limitProblem!==null){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${limitProblem.group} would have ${limitProblem.count} modules but the ship allows ${limitProblem.limit}`,"moduleLimitExceeded",{group:limitProblem.group,count:limitProblem.count,limit:limitProblem.limit,slot:slot.key,symbol:module.symbol})}const key=this.#fittedKey(slotKey)??slot.key;this.#replaceModule(key,{Slot:key,Item:module.symbol},cloneModuleStats(module));return this}removeModule(slotKey){const wanted=requireString(slotKey,SLOT_KEY).toLowerCase();if(wanted==="cargohatch"){throw new LoadoutEditError("ShipLoadout.removeModule: the cargoHatch slot cannot be changed","immutableSlot",{slot:"CargoHatch"})}const parsed=parseSlotName(slotKey);const slot=this.#layoutOrNull()?.find(candidate=>candidate.key.toLowerCase()===wanted);if(parsed!==null&&fixedSlotReason(parsed)==="requiredSlot"){const fittedKey=this.#fittedKey(slotKey);const key2=slot?.key??fittedKey??slotKey;throw new LoadoutEditError(`ShipLoadout.removeModule: the ${truncate(key2)} slot is required and cannot be emptied`,"requiredSlot",{slot:key2})}const key=this.#fittedKey(slotKey);if(key!==null){const limitProblem=this.#moduleLimitRegression(key,null);if(limitProblem!==null){const fitted=this.#modules.get(key);throw new LoadoutEditError(`ShipLoadout.removeModule: ${truncate(slotKey)}: ${limitProblem.group} would have ${limitProblem.count} modules but the ship allows ${limitProblem.limit}`,"moduleLimitExceeded",{group:limitProblem.group,count:limitProblem.count,limit:limitProblem.limit,slot:key,...fitted===void 0?{}:{symbol:fitted.Item}})}this.#replaceModule(key,null)}return this}applyBlueprint(slotKey,fdname,options){requireString(fdname,"ShipLoadout.applyBlueprint: fdname");if(options===null||typeof options!=="object"){throw new TypeError(`ShipLoadout.applyBlueprint: options must be an object with a grade, received ${describeValue(options)}`)}const wantedGrade=options.grade;const wantedQuality=options.quality;const wantedExperimental=options.experimental??void 0;requireStringIfPresent(wantedExperimental,"ShipLoadout.applyBlueprint: options.experimental");const module=this.#fittedModuleFor(slotKey);if(!module){throw new RangeError(`ShipLoadout.applyBlueprint: slot "${truncate(slotKey)}" is empty`)}const fittedStats=this.#statsFor(module);if(!fittedStats){throw new TypeError(`ShipLoadout.applyBlueprint: no stats for module "${truncate(module.Item)}"`)}const recipe=resolveBlueprintForModule(module.Item,fdname);const named=recipe===fdname?`"${truncate(fdname)}"`:`"${truncate(fdname)}" (${truncate(recipe)} on this module)`;const written=fdname.trim().toLowerCase();const resolved=recipe.trim().toLowerCase();if(getPreEngineeredVariants(module.Item).some(variant=>variant.acquisition==="eventReward"&&(variant.blueprint.toLowerCase()===written||variant.blueprint.toLowerCase()===resolved))){throw new TypeError(`ShipLoadout.applyBlueprint: ${named} is a fixed pre-engineered identity, not a craftable blueprint; use setPreEngineeredVariant to fit its fixed article`)}if(!Number.isInteger(wantedGrade)||wantedGrade<1||wantedGrade>5){throw new RangeError(`ShipLoadout.applyBlueprint: no blueprint ${named} grade ${truncate(wantedGrade)}`)}const grade=getBlueprintGrade(recipe,wantedGrade);if(!grade){throw new RangeError(`ShipLoadout.applyBlueprint: no blueprint ${named} grade ${truncate(wantedGrade)}`)}let experimental;if(wantedExperimental!==void 0){experimental=getExperimentalEffect(wantedExperimental);if(!experimental){throw new RangeError(`ShipLoadout.applyBlueprint: unknown experimental effect "${truncate(wantedExperimental)}"`)}}const quality=wantedQuality??1;if(!Number.isFinite(quality)||quality<0||quality>1){throw new RangeError(`ShipLoadout.applyBlueprint: quality must be a finite number in [0, 1]`)}if(fittedStats.engineeringLocked){throw new TypeError(`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is a final pre-engineered article and accepts no further engineering`)}if(!blueprintAvailableFor(module.Item,fdname)){const offered=[...blueprintRoutesFor(module.Item)].map(([blueprint,route])=>`${blueprint} (${route})`);throw new TypeError(offered.length>0?`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is not offered blueprint ${named}; available candidates are ${offered.join(", ")}`:`ShipLoadout.applyBlueprint: no registry lists an engineering menu for module "${truncate(module.Item)}"`)}if(wantedExperimental!==void 0&&!experimentalAvailableFor(module.Item,wantedExperimental)){const offered=getExperimentalsForModule(module.Item);throw new TypeError(`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is not offered experimental effect "${truncate(wantedExperimental)}"; it takes ${offered.length>0?offered.join(", "):"no experimental effect"}`)}const stats=this.#engineeringBaseStats(module)??fittedStats;const base=baseStats(stats);const canonical=primitiveEngineeringInputsFor(stats,grade,experimental);const missing=missingBaseLabels(stats,base,canonical.grade.features,canonical.experimental?.modifiers);if(missing.length>0){throw new TypeError(`ShipLoadout.applyBlueprint: cannot compute ${named} for module "${truncate(module.Item)}"; missing base stats for ${missing.join(", ")}`)}const damageDistribution=experimental?.damageDistribution??grade.damageDistribution;const primitiveModifiers=computeModifiers(base,canonical.grade,quality,canonical.experimental);const modifiers=journalModifiersFor(stats,primitiveModifiers);if(damageDistribution){for(const type of["kinetic","thermal","explosive","absolute"]){const value=damageDistribution[type];if(value===void 0)continue;const label=labelsForDamageType(type)[0];if(label===void 0)continue;const damageModifier={Label:label,Value:value*scaleForLabel(label),OriginalValue:(stats.damageDistribution?.[type]??0)*scaleForLabel(label)};modifiers.push(damageModifier);primitiveModifiers.push(damageModifier)}}const engineering={BlueprintName:fdname,Level:wantedGrade,Quality:quality,...wantedExperimental!==void 0?{ExperimentalEffect:wantedExperimental}:{},Modifiers:modifiers};this.#replaceModule(module.Slot,{...module,Engineering:engineering},stats,primitiveModifiers);return this}setPreEngineeredVariant(slotKey,variant){if(variant===null||typeof variant!=="object"){throw new TypeError(`ShipLoadout.setPreEngineeredVariant: variant must be a pre-engineered variant, received ${describeValue(variant)}`)}requireString(variant.symbol,"ShipLoadout.setPreEngineeredVariant: variant.symbol");requireString(variant.blueprint,"ShipLoadout.setPreEngineeredVariant: variant.blueprint");requireString(variant.acquisition,"ShipLoadout.setPreEngineeredVariant: variant.acquisition");requireStringIfPresent(variant.experimental,"ShipLoadout.setPreEngineeredVariant: variant.experimental");const known=getPreEngineeredVariants(variant.symbol).find(candidate=>candidate.blueprint.toLowerCase()===variant.blueprint.toLowerCase()&&candidate.grade===variant.grade&&(candidate.experimental?.toLowerCase()??"")===(variant.experimental?.toLowerCase()??"")&&candidate.acquisition===variant.acquisition);if(!known){throw new RangeError(`ShipLoadout.setPreEngineeredVariant: no catalogued variant "${truncate(variant.blueprint)}" for module "${truncate(variant.symbol)}"`)}const stats=getPreEngineeredStats(known);const unresolved=unresolvedModifiers(known);if(unresolved.length>0){throw new TypeError(`ShipLoadout.setPreEngineeredVariant: cannot resolve "${truncate(variant.blueprint)}" for module "${truncate(variant.symbol)}"; missing base stats for ${unresolved.join(", ")}`)}this.setModule(slotKey,stats);const module=this.#fittedModuleFor(slotKey);const engineering={BlueprintName:known.blueprint,Level:known.grade,Quality:1,...known.experimental===void 0?{}:{ExperimentalEffect:known.experimental},...known.modifiers?.length?{Modifiers:getPreEngineeredJournalModifiers(known)}:{}};this.#replaceModule(module.Slot,{...module,Engineering:engineering},cloneModuleStats(stats),getPreEngineeredModifiers(known));return this}clearEngineering(slotKey){const module=this.#fittedModuleFor(slotKey);if(module&&this.#statsFor(module)?.engineeringLocked){throw new TypeError(`ShipLoadout.clearEngineering: module "${truncate(module.Item)}" is a final pre-engineered article and its engineering cannot be removed`)}if(module?.Engineering){const baseStats2=this.#engineeringBaseStats(module);const bare={Slot:module.Slot,Item:module.Item};if(module.On!==void 0)bare.On=module.On;if(module.Priority!==void 0){bare.Priority=module.Priority}if(module.Health!==void 0)bare.Health=module.Health;if(module.Value!==void 0)bare.Value=module.Value;this.#replaceModule(module.Slot,bare,baseStats2??void 0)}return this}setModuleEnabled(slotKey,on){this.#patchModule(slotKey,{On:on});return this}setModulePriority(slotKey,priority){if(!Number.isInteger(priority)||priority<0||priority>4){throw new RangeError(`ShipLoadout: power priority must be an integer 0-4, got ${truncate(priority)}`)}this.#patchModule(slotKey,{Priority:priority});return this}#patchModule(slotKey,patch){const module=this.#fittedModuleFor(slotKey);if(!module){throw new RangeError(`ShipLoadout: slot "${truncate(slotKey)}" is empty`)}this.#modules.set(module.Slot,cloneLoadoutModule({...module,...patch}));this.#viewVersion++}toLoadoutEvent(options={}){const hull=getShipBySymbol(this.#shipSymbol);const unladenMass=this.#computedUnladenMass().value;const cargoCapacity=this.#computedCargoCapacity().value;const fuel=this.#computedFuelCapacity().value;const maxJumpRange=this.#exportableJumpRange(unladenMass);return exportLoadoutEvent({shipSymbol:this.#shipSymbol,...this.#top.ShipName===void 0?{}:{shipName:this.#top.ShipName},...this.#top.ShipIdent===void 0?{}:{shipIdent:this.#top.ShipIdent},modules:this.#modules,...options.moduleOrder==="slots"?{layout:this.#layoutOrNull()}:{},sourcePurchase:this.#sourcePurchase,retailHullValue:hull?.hullCost??null,unladenMass:unladenMass,cargoCapacity:cargoCapacity,fuelCapacity:fuel,maxJumpRange:maxJumpRange,statsFor:module=>this.#statsFor(module)},options)}toSlef(options){return toSlef(this.toLoadoutEvent(options),options.header)}toSlefString(options){return stringifySlef(this.toSlef(options),{indent:options.indent??0})}#exportableJumpRange(unladenMass){if(unladenMass===null)return null;let drive;try{drive=this.#resolveDrive()}catch{return null}if(drive===null)return null;const tank=this.#computedFuelCapacity().value;if(tank===null)return null;return singleJumpRange(unladenMass,Math.min(tank.main,drive.maxFuel),drive)}get frameShiftDrive(){const drive=this.#resolveDrive();if(drive===null)throw new TypeError("ShipLoadout: build has no frame shift drive");return drive}#maxJumpFuel(fsd){return Math.min(this.#requireFuelCapacity().main,fsd.maxFuel)}frameShiftDriveMassFactor(options={}){requireLoadOptions("ShipLoadout.frameShiftDriveMassFactor",options);const fuel=options.fuel??this.#requireFuelCapacity().main;return frameShiftDriveMassFactor(this.#requireMass(options.cargo??0),fuel,this.frameShiftDrive)}maxJumpRange(){const fsd=this.frameShiftDrive;return singleJumpRange(this.#requireMass(0),this.#maxJumpFuel(fsd),fsd)}jumpRange(options={}){requireLoadOptions("ShipLoadout.jumpRange",options);const fsd=this.frameShiftDrive;const fuel=options.fuel??this.#requireFuelCapacity().main;return singleJumpRange(this.#requireMass(options.cargo??0),fuel,fsd)}ladenJumpRange(){return this.jumpRange({cargo:this.#requireCargoCapacity()})}fuelPerJump(distance,options={}){requireLoadOptions("ShipLoadout.fuelPerJump",options);const fsd=this.frameShiftDrive;const fuel=options.fuel??this.#requireFuelCapacity().main;return fuelPerJump(distance,this.#requireMass(options.cargo??0),fuel,fsd)}totalRange(options={}){requireLoadOptions("ShipLoadout.totalRange",options);return totalRange(this.#requireMass(options.cargo??0),options.fuel??this.#requireFuelCapacity().main,this.frameShiftDrive)}jumpRangeSummary(){const cargo=this.#requireCargoCapacity();const fsd=this.frameShiftDrive;const maxFuel=this.#maxJumpFuel(fsd);return{max:this.maxJumpRange(),unladen:this.jumpRange(),laden:this.jumpRange({cargo:cargo}),totalMax:this.totalRange({fuel:maxFuel}),totalUnladen:this.totalRange(),totalLaden:this.totalRange({cargo:cargo})}}powerBudget(){const modules=[...this.#modules.values()];const consumers=[];for(const module of modules){const consumer=powerConsumerFor(module,this.#statsFor(module));if(consumer)consumers.push(consumer)}return powerBudget(powerAvailable(modules,module=>this.#statsFor(module)),consumers)}heatMetrics(){const input=heatInputFor(this.#shipSymbol,this.#modulesForEffectiveStats(),this.powerBudget(),module=>this.#statsFor(module));return input?heatMetrics(input):null}mobilityMetrics(options={}){const enginesPips=options.enginesPips??4;if(!Number.isFinite(enginesPips)||enginesPips<0||enginesPips>4){throw new RangeError("ShipLoadout.mobilityMetrics: enginesPips must be a finite number from 0 to 4")}requireLoadOptions("ShipLoadout.mobilityMetrics",options);const input=mobilityInputFor(this.#shipSymbol,[...this.#modules.values()],()=>{const main=options.fuel??this.#top.FuelCapacity?.Main??this.#requireFuelCapacity().main;return this.#requireMass(options.cargo??0)+main},enginesPips,module=>this.#statsFor(module));return input?mobilityMetrics(input):null}shieldMetrics(options={}){const input=shieldInputFor(this.#shipSymbol,[...this.#modules.values()],options.systemsPips??0,module=>this.#statsFor(module));if(!input.generator)return null;return shieldMetrics(input)}shieldRecovery(options={}){const systemsPips=options.systemsPips??4;if(!Number.isFinite(systemsPips)||systemsPips<0||systemsPips>4){throw new RangeError("ShipLoadout.shieldRecovery: systemsPips must be a finite number from 0 to 4")}const input=shieldRecoveryInputFor(this.#shipSymbol,[...this.#modules.values()],systemsPips,module=>this.#statsFor(module));return input?shieldRecovery(input):null}cellBanks(){const modules=[...this.#modules.values()];const banks=cellBankInputsFor(modules,this.powerBudget(),module=>this.#statsFor(module));const layout=this.#layoutOrNull();if(layout){const order=new Map(layout.map((slot,index)=>[slot.key.toLowerCase(),index]));banks.sort((left,right)=>(order.get(left.slot.toLowerCase())??Number.MAX_SAFE_INTEGER)-(order.get(right.slot.toLowerCase())??Number.MAX_SAFE_INTEGER))}return cellBankSummary(banks)}retailCredits(){const hull=getShipBySymbol(this.#shipSymbol)?.hullCost??null;let modules=0;const unpriced=[];for(const module of this.#modules.values()){const stats=this.#statsFor(module);if(stats?.cost!==void 0){modules+=stats.cost}else if(stats!==null||!isNonOutfittingSlot(module.Slot)&&!isBuiltInHullModule(module)){unpriced.push({slot:module.Slot,symbol:module.Item})}}return deepFreeze({hull:hull,modules:modules,rebuy:hull===null?null:Math.trunc((hull+modules)*.05),unpriced:unpriced})}armourMetrics(){return armourMetrics(armourInputFor(this.#shipSymbol,[...this.#modules.values()],module=>this.#statsFor(module)))}weaponMetrics(){const weapons=[];for(const module of this.#modules.values()){const record=this.#statsFor(module);const stats=weaponStatsFor(this.#moduleForEffectiveStats(module),record);if(!stats)continue;weapons.push({slot:module.Slot,symbol:module.Item,name:record?.name??module.Item,enabled:module.On!==false,metrics:weaponMetrics(stats),ammunition:ammunitionCapacity(stats)})}return{weapons:weapons,total:sumWeaponMetrics(weapons.filter(weapon=>weapon.enabled).map(weapon=>weapon.metrics))}}weaponsCapacitorMetrics(options={}){const weaponsPips=options.weaponsPips??4;if(!Number.isFinite(weaponsPips)||weaponsPips<0||weaponsPips>4){throw new RangeError("ShipLoadout.weaponsCapacitorMetrics: weaponsPips must be a finite number from 0 to 4")}return weaponsCapacitorMetrics(weaponsCapacitorInputFor(this.#modulesForEffectiveStats(),weaponsPips,this.powerBudget(),module=>this.#statsFor(module)))}distributorMetrics(options={}){const pips={systemsPips:options.systemsPips??4,enginesPips:options.enginesPips??4,weaponsPips:options.weaponsPips??4};for(const field of["systemsPips","enginesPips","weaponsPips"]){const value=pips[field];if(!Number.isFinite(value)||value<0||value>4){throw new RangeError(`ShipLoadout.distributorMetrics: ${field} must be a finite number from 0 to 4`)}}const input=distributorInputFor(this.#modulesForEffectiveStats(),pips,this.powerBudget(),module=>this.#statsFor(module));return input?distributorMetrics(input):null}#layoutOrNull(){if(this.#layoutCache===void 0){const layout=getShipSlots(this.#shipSymbol);this.#layoutCache=layout===null?null:Object.freeze(enumerateSlots(layout))}return this.#layoutCache}#invalidate(){this.#version++;this.#viewVersion++}#layout(){const layout=this.#layoutOrNull();if(!layout){throw new TypeError(`ShipLoadout: no slot layout for hull "${truncate(this.#shipSymbol)}"`)}return layout}#requireSlot(slotKey){const wanted=requireString(slotKey,SLOT_KEY).toLowerCase();const slot=this.#layout().find(s=>s.key.toLowerCase()===wanted);if(!slot){throw new RangeError(`ShipLoadout: hull "${truncate(this.#shipSymbol)}" has no slot "${truncate(slotKey)}"`)}return slot}#fittedKey(slotKey){return matchingKeyIn(this.#modules,requireString(slotKey,SLOT_KEY))}#fittedModuleFor(slotKey){const key=this.#fittedKey(slotKey);return key===null?void 0:this.#modules.get(key)}#require(result,what){if(result.value===null){throw new TypeError(`ShipLoadout: cannot determine ${what} (${result.issues.map(i=>i.message).join("; ")})`)}return result.value}#requireMass(cargo){return this.#require(this.unladenMassResult,"mass")+cargo}#requireFuelCapacity(){return this.#require(this.fuelCapacityResult,"fuel capacity")}#requireCargoCapacity(){return this.#require(this.cargoCapacityResult,"cargo capacity")}#calculationModules(){const cached=this.#calculationCache;if(cached!==null&&cached.version===this.#version)return cached.value;const value=this.#resolveCalculationModules();this.#calculationCache={version:this.#version,value:value};return value}#resolveCalculationModules(){return[...this.#modules.values()].map(module=>{const stats=this.#statsFor(module);const symbol=module.Item.toLowerCase();const parsedSlot=parseSlotName(module.Slot);const unresolvedOutfitting=stats===null&&!isNonOutfittingSlot(module.Slot)&&!isBuiltInHullModule(module);const isCargoRack=stats?.cargoCapacity!==void 0||stats?.engineeringGroup==="cargoRacks"||symbol.includes("cargorack");const isFuelTank=stats?.fuelCapacity!==void 0||stats?.slot==="fuelTank"||symbol.startsWith(FUEL_TANK_PREFIX);const mayCarryCapacity=unresolvedOutfitting&&(parsedSlot===null||parsedSlot.kind==="optional");const mayCarryFuel=mayCarryCapacity||unresolvedOutfitting&&parsedSlot?.kind==="core"&&parsedSlot.core==="fuelTank";return{slot:module.Slot,symbol:module.Item,mass:this.#moduleMass(module),...isCargoRack||mayCarryCapacity?{cargoCapacity:isCargoRack?this.#moduleCapacity(module,"CargoCapacity","cargoCapacity"):null}:{},...isFuelTank||mayCarryFuel?{fuelCapacity:isFuelTank?this.#moduleCapacity(module,"FuelCapacity","fuelCapacity"):null}:{}}})}#moduleLimits(){const entries=[...this.#modules.values()].flatMap(module=>{const stats=this.#statsFor(module);return stats===null?[]:[stats]});return calculateModuleLimits(entries)}#moduleStatsAt(slotKey){const fitted=this.#fittedModuleFor(slotKey);return fitted===void 0?null:this.#statsFor(fitted)}#engineeringBaseStats(module){const fitted=this.#statsFor(module);if(!module.Engineering||identifyPreEngineeredVariant(module)===null)return fitted;const stock=builtInModuleBySymbol(module.Item,FITTED_ITEM);if(!stock)return fitted;return fitted?.engineeringLocked?cloneModuleStats({...stock,engineeringLocked:true}):stock}#moduleForEffectiveStats(module){const modifiers=this.#primitiveModifiers.get(module.Slot);if(modifiers===void 0||module.Engineering===void 0)return module;return{...module,Engineering:{...module.Engineering,Modifiers:modifiers}}}#modulesForEffectiveStats(){return[...this.#modules.values()].map(module=>this.#moduleForEffectiveStats(module))}#moduleLimitRegression(slotKey,replacement,current=this.#moduleLimits(),previous=this.#moduleStatsAt(slotKey)){if(previous?.limitGroup===void 0&&previous?.limitIncrease===void 0&&replacement?.limitGroup===void 0&&replacement?.limitIncrease===void 0){return null}for(const usage of current){const count=usage.count-Number(previous?.limitGroup===usage.group)+Number(replacement?.limitGroup===usage.group);const increase=usage.increase-(previous?.limitIncrease?.group===usage.group?previous.limitIncrease.amount:0)+(replacement?.limitIncrease?.group===usage.group?replacement.limitIncrease.amount:0);const limit=usage.baseLimit+increase;const excess=Math.max(0,count-limit);if(excess>usage.excess){return{...usage,increase:increase,limit:limit,count:count,excess:excess}}}return null}#replaceModule(slotKey,replacement,replacementStats,primitiveModifiers){const previous=this.#modules.get(slotKey)??null;this.#adjustImportedFigures(previous,replacement,replacementStats);if(replacement===null){this.#modules.delete(slotKey);this.#moduleStats.delete(slotKey);this.#primitiveModifiers.delete(slotKey)}else{this.#modules.set(slotKey,cloneLoadoutModule(replacement));if(replacementStats!==void 0)this.#moduleStats.set(slotKey,replacementStats);if(primitiveModifiers===void 0)this.#primitiveModifiers.delete(slotKey);else this.#primitiveModifiers.set(slotKey,primitiveModifiers)}this.#invalidate()}#adjustImportedFigures(previous,next,nextStats){const previousMass=this.#moduleMass(previous);const nextMass=this.#moduleMass(next,nextStats);if(this.#top.UnladenMass!==void 0){if(previousMass===null||nextMass===null)delete this.#top.UnladenMass;else this.#top.UnladenMass+=nextMass-previousMass}const previousCargo=this.#moduleCapacity(previous,"CargoCapacity","cargoCapacity");const nextCargo=this.#moduleCapacity(next,"CargoCapacity","cargoCapacity",nextStats);if(this.#top.CargoCapacity!==void 0){if(previousCargo===null||nextCargo===null)delete this.#top.CargoCapacity;else this.#top.CargoCapacity+=nextCargo-previousCargo}const previousFuel=this.#moduleCapacity(previous,"FuelCapacity","fuelCapacity");const nextFuel=this.#moduleCapacity(next,"FuelCapacity","fuelCapacity",nextStats);if(this.#top.FuelCapacity?.Main!==void 0){const reserve=this.#top.FuelCapacity.Reserve;if(previousFuel===null||nextFuel===null){if(reserve===void 0)delete this.#top.FuelCapacity;else this.#top.FuelCapacity={Reserve:reserve}}else{this.#top.FuelCapacity={Main:this.#top.FuelCapacity.Main+nextFuel-previousFuel,...reserve===void 0?{}:{Reserve:reserve}}}}if(normalizeKey(previous?.Item,FITTED_ITEM)===normalizeKey(next?.Item,FITTED_ITEM)){return}delete this.#top.ModulesValue;delete this.#top.Rebuy}#moduleMass(module,statsOverride){if(module===null)return 0;const modified=getLoadoutModifier(module,"Mass");if(modified!==null)return modified;const stats=statsOverride??this.#statsFor(module);if(stats?.mass!==void 0)return stats.mass;if(isBuiltInHullModule(module))return 0;return stats===null&&isNonOutfittingSlot(module.Slot)?0:null}#moduleCapacity(module,modifierLabel,field,statsOverride){if(module===null)return 0;const modified=getLoadoutModifier(module,modifierLabel);if(modified!==null)return modified;const stats=statsOverride??this.#statsFor(module);if(stats?.[field]!==void 0)return stats[field];const symbol=module.Item.toLowerCase();const isFuelTank=stats?.slot?stats.slot==="fuelTank":symbol.startsWith(FUEL_TANK_PREFIX);const shouldCarryCapacity=field==="cargoCapacity"?symbol.includes("cargorack"):isFuelTank;return shouldCarryCapacity?null:0}#resolveDrive(){let fsdModule;for(const m of this.#modules.values()){const stats=this.#statsFor(m);const isDrive=stats?.slot?stats.slot==="frameShiftDrive":m.Item.toLowerCase().startsWith(FSD_PREFIX);if(isDrive){fsdModule=m;break}}if(!fsdModule)return null;const base=this.#statsFor(fsdModule);if(!base||base.fuelMul===void 0||base.fuelPower===void 0){throw new TypeError(`ShipLoadout: no jump constants in the stats catalogue for frame shift drive "${truncate(fsdModule.Item)}"`)}const optMass=getLoadoutModifier(fsdModule,"FSDOptimalMass")??base.optMass;const maxFuel=getLoadoutModifier(fsdModule,"MaxFuelPerJump")??base.maxFuel;if(optMass===void 0||maxFuel===void 0){const missing=[...optMass===void 0?["optMass"]:[],...maxFuel===void 0?["maxFuel"]:[]];throw new TypeError(`ShipLoadout: frame shift drive "${truncate(fsdModule.Item)}" has no ${missing.join(" or ")} in the stats catalogue`)}return{optMass:optMass,maxFuel:maxFuel,fuelMul:base.fuelMul,fuelPower:base.fuelPower,jumpBoost:this.#resolveJumpBoost()}}#resolveJumpBoost(){for(const m of this.#modules.values()){const stats=this.#statsFor(m);if(stats?.engineeringGroup!=="fsdBoosters"&&!m.Item.toLowerCase().startsWith(BOOSTER_PREFIX)){continue}if(m.On===false)continue;if(stats?.jumpBoost===void 0){throw new TypeError(`ShipLoadout: FSD booster "${truncate(m.Item)}" has no jumpBoost in the stats catalogue`)}return stats.jumpBoost}return 0}#statsFor(module){if(module===null)return null;const stats=this.#moduleStats.get(module.Slot)??builtInModuleBySymbol(module.Item,FITTED_ITEM);if(stats)return stats;return isBuiltInHullModule(module)?builtInModuleBySymbol("ModularCargoBayDoor","ShipLoadout: built-in module"):null}};export{LoadoutEditError,ShipLoadout};//# sourceMappingURL=chunk-H7ABQQUR.js.map
|
|
1
|
+
import{weaponsCapacitorMetrics}from"./chunk-FMPRCYKY.js";import{shieldRecovery,cellBankSummary}from"./chunk-VZZUNSDF.js";import{shieldMetrics}from"./chunk-2FHHMYDC.js";import{getShipSlots,getShipBySymbol,getShipByName}from"./chunk-IJRKEODR.js";import{parseSlef,toSlef,stringifySlef,getLoadoutModifier}from"./chunk-RKLJ7EEE.js";import{parseSlotName,enumerateSlots,SLOT_RESTRICTION_LABELS}from"./chunk-I7PIDRMU.js";import{sourcePurchaseFromLoadout,getSourceModuleValue}from"./chunk-QTDBO7R2.js";import{powerBudget}from"./chunk-76XKY2Y2.js";import{isNonOutfittingSlot,isBuiltInHullModule,cloneLoadoutModule,identifyPreEngineeredVariant,cloneModuleStats,availableBlueprintsFor,availableExperimentalsFor,blueprintAvailableFor,blueprintRoutesFor,experimentalAvailableFor,primitiveEngineeringInputsFor,missingBaseLabels,journalModifiersFor,getPreEngineeredStats,unresolvedModifiers,getPreEngineeredJournalModifiers,getPreEngineeredModifiers,matchingKeyIn,FITTED_ITEM,isFinalGuardianWeaponEngineering,scaleDamageComponents}from"./chunk-LRC7UW7S.js";import{weaponMetrics,sumWeaponMetrics,combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{builtInModuleBySymbol,getBulkheadsForShip}from"./chunk-MNXWK7PA.js";import{getPreEngineeredVariants}from"./chunk-32PVERNH.js";import{singleJumpRange,frameShiftDriveMassFactor,fuelPerJump,totalRange}from"./chunk-GQ5GX5TB.js";import{completeResult,calculateUnladenMass,calculateCargoCapacity,calculateFuelCapacity}from"./chunk-RF2IKLWQ.js";import{validateLoadout,fixedSlotReason}from"./chunk-BM7JQ5CH.js";import{mobilityMetrics}from"./chunk-24INI4U7.js";import{calculateModuleLimits}from"./chunk-KPETDYQX.js";import{ALL_MODULES}from"./chunk-53ERRGPM.js";import{CORE_MODULES}from"./chunk-O72KI7RP.js";import{getDefaultLoadout}from"./chunk-V3DW67W2.js";import{distributorMetrics}from"./chunk-P2QOL63K.js";import{getExperimentalEffect}from"./chunk-PMJG7PHU.js";import{heatMetrics}from"./chunk-QMQHIZGS.js";import{ammunitionCapacity}from"./chunk-AA3K5XUE.js";import{armourMetrics}from"./chunk-FGXWVFN6.js";import{baseStats,computeModifiers,labelsForDamageType,scaleForLabel,fieldForLabel,labelsForField,capabilityValueForLabel,damageTypeForLabel}from"./chunk-SVZARHWP.js";import{resolveBlueprintForModule}from"./chunk-ZJB5UYNE.js";import{getExperimentalsForModule}from"./chunk-TH4S5MVD.js";import{getBlueprintGrade}from"./chunk-DNTN34M4.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{truncate,describeValue,requireString,requireStringIfPresent}from"./chunk-B5TT26XE.js";import{deepFreeze}from"./chunk-DURKO7JU.js";var PREFIX={powerPlant:["int_powerplant","int_guardianpowerplant"],thrusters:["int_engine","int_mkiiagileboost_engine"],frameShiftDrive:["int_hyperdrive"],powerDistributor:["int_powerdistributor","int_guardianpowerdistributor"],shieldGenerator:["int_shieldgenerator"],shieldCellBank:["int_shieldcellbank"],shieldBooster:["hpt_shieldbooster"],shieldReinforcement:["int_guardianshieldreinforcement"],hullReinforcement:["int_hullreinforcement","int_guardianhullreinforcement","int_metaalloyhullreinforcement"],moduleReinforcement:["int_modulereinforcement","int_guardianmodulereinforcement"]};var startsWithAny=(symbol,prefixes)=>prefixes.some(prefix=>symbol.toLowerCase().startsWith(prefix));function isPowerDistributor(module,stats){return stats?.slot?stats.slot==="powerDistributor":startsWithAny(module.Item,PREFIX.powerDistributor)}function isEnabled(module){return module.On!==false}function priorityOf(module){return(module.Priority??0)+1}function effectiveStat(module,field,stats){const stated=statedModifier(module,field);if(stated!==void 0)return stated;const base=stats?.[field];return typeof base==="number"?base:void 0}function statedModifier(module,field){for(const label of labelsForField(field)){if(capabilityValueForLabel(label)!==null)continue;const modified=getLoadoutModifier(module,label);if(modified!==null)return modified/scaleForLabel(label)}return void 0}function effectiveCapability(module,field,stats){for(const label of labelsForField(field)){if(capabilityValueForLabel(label)===null)continue;if(module.Engineering?.Modifiers?.some(modifier=>modifier.Label.toLowerCase()===label.toLowerCase())){return true}}const base=stats[field];return typeof base==="boolean"?base:void 0}function effectiveDamageDistribution(module,stats){const fromEffect=module.Engineering?.ExperimentalEffect?getExperimentalEffect(module.Engineering.ExperimentalEffect)?.damageDistribution:void 0;const distribution={...fromEffect??stats.damageDistribution};let resolved=fromEffect!==void 0||stats.damageDistribution!==void 0;for(const modifier of module.Engineering?.Modifiers??[]){if(modifier.Value===void 0)continue;const type=damageTypeForLabel(modifier.Label);if(type===null)continue;distribution[type]=modifier.Value/scaleForLabel(modifier.Label);resolved=true}return resolved?distribution:void 0}function convertsDamage(module){if(module.Engineering?.ExperimentalEffect&&getExperimentalEffect(module.Engineering.ExperimentalEffect)?.damageDistribution){return true}return(module.Engineering?.Modifiers??[]).some(modifier=>damageTypeForLabel(modifier.Label)!==null)}function modifierRatio(module,stats,field){const base=stats?.[field];if(typeof base!=="number"||base===0)return 1;const effective=effectiveStat(module,field,stats);return effective===void 0?1:effective/base}function relatedStat(module,stats,field,ratio){const stated=statedModifier(module,field);if(stated!==void 0)return stated;const base=stats?.[field];return typeof base==="number"?base*ratio:void 0}function effectiveModule(module,stats){if(!stats||!module.Engineering)return stats;const merged={...stats};const fields=new Set(Object.keys(stats));for(const modifier of module.Engineering.Modifiers??[]){const field=fieldForLabel(modifier.Label,stats);if(field)fields.add(field)}for(const key of fields){const capability=effectiveCapability(module,key,stats);if(capability!==void 0){merged[key]=capability;continue}const value=effectiveStat(module,key,stats);if(value!==void 0)merged[key]=value}if(stats.engineeringGroup==="thrusters"){const massRatio=modifierRatio(module,stats,"optMass");const minMass=relatedStat(module,stats,"minMass",massRatio);const maxMass=relatedStat(module,stats,"maxMass",massRatio);if(minMass!==void 0)merged.minMass=minMass;if(maxMass!==void 0)merged.maxMass=maxMass}if(stats.engineeringGroup==="thrusters"||stats.engineeringGroup==="shieldGenerators"){const performanceRatio=modifierRatio(module,stats,"optMultiplier");const minMultiplier=relatedStat(module,stats,"minMultiplier",performanceRatio);const maxMultiplier=relatedStat(module,stats,"maxMultiplier",performanceRatio);if(minMultiplier!==void 0)merged.minMultiplier=minMultiplier;if(maxMultiplier!==void 0)merged.maxMultiplier=maxMultiplier;if(stats.engineeringGroup==="thrusters"){for(const field of["minSpeedMultiplier","optSpeedMultiplier","maxSpeedMultiplier","minRotationMultiplier","optRotationMultiplier","maxRotationMultiplier"]){const value=stats[field];if(value!==void 0)merged[field]=value*performanceRatio}}}const damageDistribution=effectiveDamageDistribution(module,stats);if(damageDistribution)merged.damageDistribution=damageDistribution;if(stats.category==="hardpoint")normalizeEffectiveWeapon(module,merged);if(convertsDamage(module)){delete merged.damageComponents}else if(stats.damageComponents){merged.damageComponents=scaleDamageComponents(stats.damageComponents,stats.damage,typeof merged.damage==="number"?merged.damage:void 0)}return merged}function powerConsumerFor(module,stats){const draw=effectiveStat(module,"powerDraw",stats);const parsedSlot=parseSlotName(module.Slot);const mounted=stats?.category==="hardpoint"||stats?.category==="utility";const deployedOnly=stats!==null?mounted&&stats.alwaysPowered!==true:parsedSlot?.kind==="hardpoint"?true:parsedSlot?.kind==="utility"?void 0:false;const common={priority:priorityOf(module),enabled:isEnabled(module),...deployedOnly===void 0?{}:{deployedOnly:deployedOnly},label:module.Slot};if(draw===void 0){const inherentlyPassiveSlot=parsedSlot?.kind==="armour"||parsedSlot?.kind==="core"&&(parsedSlot.core==="powerPlant"||parsedSlot.core==="fuelTank");if(stats!==null||inherentlyPassiveSlot||isNonOutfittingSlot(module.Slot))return null;return{drawUnknown:true,...common}}if(draw===0)return null;return{draw:draw,...common}}function powerAvailable(modules,statsFor){for(const module of modules){const stats=statsFor(module);const isPlant=stats?.slot?stats.slot==="powerPlant":startsWithAny(module.Item,PREFIX.powerPlant);if(!isPlant)continue;if(!isEnabled(module))return 0;return effectiveStat(module,"powerCapacity",stats)??0}return 0}function mapResistanceFields(read){return{kineticResistance:read("kineticResistance")??0,thermalResistance:read("thermalResistance")??0,explosiveResistance:read("explosiveResistance")??0,causticResistance:read("causticResistance")??0}}function resistancesOf(module,stats){return mapResistanceFields(field=>effectiveStat(module,field,stats))}function shieldInputFor(shipSymbol,modules,systemsPips,statsFor){const hull=getShipBySymbol(shipSymbol);let generator=null;const boosters=[];let reinforcement=0;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!generator&&startsWithAny(module.Item,PREFIX.shieldGenerator)){const massRatio=modifierRatio(module,stats,"optMass");const strengthRatio=modifierRatio(module,stats,"optMultiplier");const optMass=effectiveStat(module,"optMass",stats);const minMass=relatedStat(module,stats,"minMass",massRatio);const maxMass=relatedStat(module,stats,"maxMass",Math.max(1,massRatio));const optMultiplier=effectiveStat(module,"optMultiplier",stats);const minMultiplier=relatedStat(module,stats,"minMultiplier",strengthRatio);const maxMultiplier=relatedStat(module,stats,"maxMultiplier",strengthRatio);generator={...optMass===void 0?{}:{optMass:optMass},...minMass===void 0?{}:{minMass:minMass},...maxMass===void 0?{}:{maxMass:maxMass},...optMultiplier===void 0?{}:{optMultiplier:optMultiplier},...minMultiplier===void 0?{}:{minMultiplier:minMultiplier},...maxMultiplier===void 0?{}:{maxMultiplier:maxMultiplier},...resistancesOf(module,stats)}}else if(startsWithAny(module.Item,PREFIX.shieldBooster)){boosters.push({shieldBoost:effectiveStat(module,"shieldBoost",stats)??0,...resistancesOf(module,stats)})}else if(startsWithAny(module.Item,PREFIX.shieldReinforcement)){reinforcement+=effectiveStat(module,"shieldAddition",stats)??0}}return{hullMass:hull?.hullMass??0,baseShieldStrength:hull?.baseShieldStrength??0,generator:generator,boosters:boosters,reinforcement:reinforcement,systemsPips:systemsPips}}function mobilityInputFor(shipSymbol,modules,mass,enginesPips,statsFor){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;let thrusters=null;for(const module of modules){const stats=statsFor(module);const isThruster=stats?.slot?stats.slot==="thrusters":startsWithAny(module.Item,PREFIX.thrusters);if(!isThruster)continue;if(!isEnabled(module))return null;const effective=effectiveModule(module,stats);const minMass=effective?.minMass;const optMass=effective?.optMass;const maxMass=effective?.maxMass;const minMultiplier=effective?.minMultiplier;const optMultiplier=effective?.optMultiplier;const maxMultiplier=effective?.maxMultiplier;if(minMass===void 0||optMass===void 0||maxMass===void 0||minMultiplier===void 0||optMultiplier===void 0||maxMultiplier===void 0){return null}thrusters={minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:minMultiplier,optMultiplier:optMultiplier,maxMultiplier:maxMultiplier,...effective?.optSpeedMultiplier===void 0?{}:{speedCurve:{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:effective.minSpeedMultiplier??minMultiplier,optMultiplier:effective.optSpeedMultiplier,maxMultiplier:effective.maxSpeedMultiplier??maxMultiplier}},...effective?.optRotationMultiplier===void 0?{}:{rotationCurve:{minMass:minMass,optMass:optMass,maxMass:maxMass,minMultiplier:effective.minRotationMultiplier??minMultiplier,optMultiplier:effective.optRotationMultiplier,maxMultiplier:effective.maxRotationMultiplier??maxMultiplier}}};break}if(!thrusters)return null;return{minimumSpeed:hull.minimumSpeed,maximumSpeed:hull.maximumSpeed,boost:hull.boost,minPitch:hull.minPitch,pitch:hull.pitch,minRoll:hull.minRoll,roll:hull.roll,minYaw:hull.minYaw,yaw:hull.yaw,mass:typeof mass==="function"?mass():mass,thrusters:thrusters,enginesPips:enginesPips}}function shieldRecoveryInputFor(shipSymbol,modules,systemsPips,statsFor){let generator=null;let distributor=null;for(const module of modules){const stats=statsFor(module);if(!generator&&startsWithAny(module.Item,PREFIX.shieldGenerator)){if(!isEnabled(module))return null;generator=module}if(isPowerDistributor(module,stats)&&isEnabled(module))distributor=module}if(!generator)return null;const generatorStats=statsFor(generator);const distributorStats=distributor?statsFor(distributor):null;const strength=shieldMetrics(shieldInputFor(shipSymbol,modules,0,statsFor)).strength;return{strength:strength,regenRate:effectiveStat(generator,"shieldRegenRate",generatorStats)??0,brokenRegenRate:effectiveStat(generator,"shieldBrokenRegenRate",generatorStats)??0,distributorDraw:effectiveStat(generator,"distributorDraw",generatorStats)??.6,systemsCapacity:distributor?effectiveStat(distributor,"systemsCapacity",distributorStats)??0:0,systemsRecharge:distributor?effectiveStat(distributor,"systemsRecharge",distributorStats)??0:0,systemsPips:systemsPips}}function weaponsCapacitorInputFor(modules,weaponsPips,budget,statsFor){let weaponsCapacity=0;let weaponsRecharge=0;let sustainedEnergyPerSecond=0;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!poweredStates(module,stats,budget).deployed)continue;if(isPowerDistributor(module,stats)){weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats)??0;weaponsRecharge=effectiveStat(module,"weaponsRecharge",stats)??0}const weapon=weaponStatsFor(module,stats);if(weapon){sustainedEnergyPerSecond+=weaponMetrics(weapon).sustainedEnergyPerSecond}}return{weaponsCapacity:weaponsCapacity,weaponsRecharge:weaponsRecharge,sustainedEnergyPerSecond:sustainedEnergyPerSecond,weaponsPips:weaponsPips}}function distributorInputFor(modules,pips,budget,statsFor){for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(!isPowerDistributor(module,stats))continue;if(!poweredStates(module,stats,budget).retracted)return null;const systemsCapacity=effectiveStat(module,"systemsCapacity",stats);const systemsRecharge=effectiveStat(module,"systemsRecharge",stats);const enginesCapacity=effectiveStat(module,"enginesCapacity",stats);const enginesRecharge=effectiveStat(module,"enginesRecharge",stats);const weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats);const weaponsRecharge=effectiveStat(module,"weaponsRecharge",stats);if(systemsCapacity===void 0||systemsRecharge===void 0||enginesCapacity===void 0||enginesRecharge===void 0||weaponsCapacity===void 0||weaponsRecharge===void 0){return null}return{systemsCapacity:systemsCapacity,systemsRecharge:systemsRecharge,enginesCapacity:enginesCapacity,enginesRecharge:enginesRecharge,weaponsCapacity:weaponsCapacity,weaponsRecharge:weaponsRecharge,...pips}}return null}function heatInputFor(shipSymbol,modules,budget,statsFor){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;let heatEfficiency;let thrusterHeatRate=0;let deployedThrusterHeatRate=0;let fsdHeatRate=0;let weaponsCapacity=0;const weapons=[];for(const module of modules){const stats=statsFor(module);const isPlant=stats?.slot?stats.slot==="powerPlant":startsWithAny(module.Item,PREFIX.powerPlant);if(isPlant){if(!isEnabled(module))return null;heatEfficiency=effectiveStat(module,"heatEfficiency",stats);continue}if(!isEnabled(module))continue;const running=poweredStates(module,stats,budget);if(stats?.slot?stats.slot==="thrusters":startsWithAny(module.Item,PREFIX.thrusters)){const heat=effectiveStat(module,"engineHeatRate",stats)??0;if(running.retracted)thrusterHeatRate+=heat;if(running.deployed)deployedThrusterHeatRate+=heat}else if(stats?.slot?stats.slot==="frameShiftDrive":startsWithAny(module.Item,PREFIX.frameShiftDrive)){if(running.retracted)fsdHeatRate+=effectiveStat(module,"fsdHeatRate",stats)??0}else if(isPowerDistributor(module,stats)){if(running.deployed){weaponsCapacity=effectiveStat(module,"weaponsCapacity",stats)??0}}const weapon=weaponStatsFor(module,stats);if(!weapon||!running.deployed)continue;weapons.push({heatPerSecond:weaponMetrics(weapon).sustainedHeatPerSecond,distributorDraw:weapon.distributorDraw??0})}if(heatEfficiency===void 0)return null;return{heatCapacity:hull.heatCapacity,heatDissipation:hull.heatDissipation,heatEfficiency:heatEfficiency,retractedPowerDraw:poweredDraw(budget,"retracted"),deployedPowerDraw:poweredDraw(budget,"deployed"),thrusterHeatRate:thrusterHeatRate,deployedThrusterHeatRate:deployedThrusterHeatRate,fsdHeatRate:fsdHeatRate,weaponsCapacity:weaponsCapacity,weapons:weapons,unknownDraws:budget.unknownDraws.map(consumer=>consumer.label??"(unnamed module)")}}function poweredDraw(budget,state){const powered=state==="retracted"?"poweredRetracted":"poweredDeployed";return budget.bands.reduce((total,band)=>band[powered]?total+band[state]:total,0)}function poweredStates(module,stats,budget){const draw=effectiveStat(module,"powerDraw",stats);if(draw===void 0||draw===0)return{retracted:true,deployed:true};const band=budget.bands[Math.min(budget.bands.length,Math.max(1,priorityOf(module)))-1];if(!band)return{retracted:true,deployed:true};return{retracted:band.poweredRetracted,deployed:band.poweredDeployed}}function cellBankInputsFor(modules,budget,statsFor){const banks=[];for(const module of modules){if(!startsWithAny(module.Item,PREFIX.shieldCellBank))continue;const stats=statsFor(module);const effective=effectiveModule(module,stats);const ammunition=effective?ammunitionCapacity(effective):null;banks.push({slot:module.Slot,symbol:module.Item,reinforcementRate:effective?.shieldBankReinforcement??0,cells:ammunition?.total??0,spinUp:effective?.shieldBankSpinUp??0,duration:effective?.shieldBankDuration??0,heat:effective?.shieldBankHeat??0,powered:budget.available>0&&isEnabled(module)&&poweredStates(module,stats,budget).deployed})}return banks}function stockBulkhead(shipSymbol){const hull=getShipBySymbol(shipSymbol);if(!hull)return null;const variants=getBulkheadsForShip(hull.name,CORE_MODULES);return variants.find(v=>v.symbol.toLowerCase().endsWith("_default"))??variants.find(v=>v.mass===0)??variants[0]??null}function armourInputFor(shipSymbol,modules,statsFor){const hull=getShipBySymbol(shipSymbol);const reinforcements=[];const moduleReinforcements=[];let bulkhead=null;for(const module of modules){if(!isEnabled(module))continue;const stats=statsFor(module);if(module.Slot.toLowerCase()==="armour"){bulkhead={hullBoost:effectiveStat(module,"hullBoost",stats)??0,...resistancesOf(module,stats)}}else if(startsWithAny(module.Item,PREFIX.hullReinforcement)){const boost=getLoadoutModifier(module,"DefenceModifierHealthMultiplier");reinforcements.push({hullReinforcement:effectiveStat(module,"hullReinforcement",stats)??0,hullBoost:boost===null?0:boost/scaleForLabel("DefenceModifierHealthMultiplier"),...resistancesOf(module,stats)})}else if(startsWithAny(module.Item,PREFIX.moduleReinforcement)){moduleReinforcements.push({moduleProtection:effectiveStat(module,"moduleProtection",stats)??0,integrity:effectiveStat(module,"integrity",stats)??0})}}if(!bulkhead){const stock=stockBulkhead(shipSymbol);bulkhead=stock?{hullBoost:stock.hullBoost??0,...mapResistanceFields(field=>stock[field])}:null}return{baseArmour:hull?.baseArmour??0,bulkhead:bulkhead,reinforcements:reinforcements,moduleReinforcements:moduleReinforcements}}var WEAPON_FIELDS=["damage","roundsPerShot","rateOfFire","burstInterval","burstRounds","burstRateOfFire","chargeTime","clipSize","ammoMaximum","reloadTime","distributorDraw","thermalLoad","powerDraw","maximumRange","falloffRange","armourPiercing"];function weaponStatsFor(module,stats){if(!stats||stats.category!=="hardpoint")return null;const weapon={};for(const field of WEAPON_FIELDS){const value=effectiveStat(module,field,stats);if(value!==void 0)weapon[field]=value}normalizeEffectiveWeapon(module,weapon);const damageDistribution=effectiveDamageDistribution(module,stats);if(damageDistribution)weapon.damageDistribution=damageDistribution;if(stats.damageComponents&&!convertsDamage(module)){weapon.damageComponents=scaleDamageComponents(stats.damageComponents,stats.damage,typeof weapon.damage==="number"?weapon.damage:void 0)}if(stats.projectileRange)weapon.projectileRange={...stats.projectileRange};return weapon}function burstAdjustedRateOfFire(module,weapon){if(getLoadoutModifier(module,"RateOfFire")!==null)return void 0;const touched=["BurstSize","BurstRateOfFire","BurstInterval"].some(label=>getLoadoutModifier(module,label)!==null);if(!touched)return void 0;return combinedRateOfFire(weapon)}function normalizeEffectiveWeapon(module,weapon){const rate=burstAdjustedRateOfFire(module,weapon);if(rate!==void 0)weapon.rateOfFire=rate;const statedDamagePerSecond=getLoadoutModifier(module,"DamagePerSecond");const firingFactor=Number(weapon.roundsPerShot??1)*Number(weapon.rateOfFire??1);if(statedDamagePerSecond!==null&&firingFactor>0){weapon.damage=statedDamagePerSecond/firingFactor}const{maximumRange:maximumRange,falloffRange:falloffRange}=weapon;if(maximumRange!==void 0&&falloffRange!==void 0&&falloffRange>maximumRange){weapon.falloffRange=maximumRange}}var CORE_NAMES={powerPlant:"Power Plant",thrusters:"Thrusters",frameShiftDrive:"Frame Shift Drive",lifeSupport:"Life Support",powerDistributor:"Power Distributor",sensors:"Sensors",fuelTank:"Fuel Tank"};var RESTRICTED_OPTIONAL_NAMES={military:"Military Slot",cargo:"Cargo Slot",limpetController:"Limpet Controller Slot",vesselHangar:"Vessel Hangar Slot",passenger:"Passenger Slot"};function trailingDigits(key){let start=key.length;while(start>0){const code=key.charCodeAt(start-1);if(code<48||code>57)break;start--}return start===key.length?null:key.slice(start)}function loadoutSlotName(slot){switch(slot.kind){case"core":return CORE_NAMES[slot.core];case"hardpoint":{const match=/^(Small|Medium|Large|Huge)(Mining)?Hardpoint(\d+)$/.exec(slot.key);if(!match)return slot.key;return`${match[1]}${match[2]?" Mining":""} Hardpoint ${Number(match[3])}`}case"utility":{const match=/^TinyHardpoint(\d+)$/.exec(slot.key);return match?`Utility Mount ${Number(match[1])}`:slot.key}case"optional":{if(slot.restriction==="planetaryApproachSuite")return"Planetary Approach Suite";if(slot.restriction){const numbered=trailingDigits(slot.key);const label=RESTRICTED_OPTIONAL_NAMES[slot.restriction];return label&&numbered?`${label} ${Number(numbered)}`:slot.key}const optional=/^Slot(\d+)_Size(\d+)$/.exec(slot.key);return optional?`Optional Internal ${Number(optional[1])} (Size ${slot.size})`:slot.key}case"armour":return"Armour";case"cargoHatch":return"Cargo Hatch"}}var MILITARY_PREFIXES=["int_hullreinforcement","int_metaalloyhullreinforcement","int_modulereinforcement","int_shieldcellbank","int_guardianhullreinforcement","int_guardianmodulereinforcement","int_guardianshieldreinforcement"];var MINING_PREFIXES=["hpt_mininglaser","hpt_mining_abrblstr","hpt_mining_seismchrgwarhd","hpt_mining_subsurfdispmisle","hpt_human_extraction","hpt_miningtoolv2"];var CARGO_PREFIXES=["int_cargorack","int_largecargorack","int_corrosionproofcargorack","int_fueltank"];var RESTRICTED_SLOT_PREFIXES={mining:MINING_PREFIXES,military:MILITARY_PREFIXES,cargo:CARGO_PREFIXES,limpetController:["int_dronecontrol","int_multidronecontrol"],vesselHangar:["int_fighterbay"],passenger:["int_passengercabin","int_mkii_passengercabin"],planetaryApproachSuite:["int_planetapproachsuite"]};var problem=(constraint,message,params)=>({constraint:constraint,message:message,...params===void 0?{}:{params:params}});function restrictionProblem(slot,symbol){const restriction=slot.restriction;if(!restriction)return null;if(RESTRICTED_SLOT_PREFIXES[restriction].some(prefix=>symbol.startsWith(prefix))){return null}return problem("restrictedMount",`slot only takes ${SLOT_RESTRICTION_LABELS[restriction]}`,{restriction:restriction})}function moduleSlotProblem(slot,module){const required=module.restrictedToSlot;if(!required||slot.restriction===required)return null;return problem("restrictedMount",`module only fits a mount that takes ${SLOT_RESTRICTION_LABELS[required]}`,{restriction:required})}function moduleFitProblem(shipSymbol,slot,module){if(slot.kind==="cargoHatch"){return problem("immutableSlot","the cargoHatch slot cannot be changed")}if(slot.kind==="armour"){const hull=getShipBySymbol(shipSymbol);if(module.slot!=="armour"||module.ship===void 0){return problem("armourRequired","not a ship armour module")}if(!hull||module.ship.toLowerCase()!==hull.name.toLowerCase()){const armourHull=getShipByName(module.ship);return problem("wrongHullArmour",`armour belongs to ${truncate(module.ship)}, not ${truncate(hull?.name??shipSymbol)}`,{armourShipName:module.ship,...armourHull===null?{}:{armourShipSymbol:armourHull.symbol},shipSymbol:shipSymbol,...hull===null?{}:{shipName:hull.name}})}return null}const restricted=module.restrictedToShips;if(restricted&&!restricted.some(symbol2=>symbol2.toLowerCase()===shipSymbol.toLowerCase())){const allowedShipNames=restricted.map(symbol2=>{const hull=getShipBySymbol(symbol2);return hull?.name??symbol2});const labels=restricted.map((symbol2,index)=>{const name=allowedShipNames[index];return name===symbol2?symbol2:`${name} (${symbol2})`});return problem("restrictedHull",`module is restricted to ${truncate(labels.join(", "))}`,{allowedShipNames:allowedShipNames,allowedShipSymbols:[...restricted],shipSymbol:shipSymbol})}const wrongMount=moduleSlotProblem(slot,module);if(wrongMount)return wrongMount;const symbol=module.symbol.toLowerCase();const moduleSlot=module.slot;switch(slot.kind){case"core":if(moduleSlot!==slot.core){return problem("wrongCoreType",`not a ${slot.core} module`,{requiredCore:slot.core,moduleSlot:moduleSlot??"none"})}break;case"hardpoint":{if(module.category!=="hardpoint"){return problem("hardpointRequired","not a hardpoint weapon")}const restricted2=restrictionProblem(slot,symbol);if(restricted2)return restricted2;break}case"utility":if(module.category!=="utility"){return problem("utilityRequired","not a utility module")}return null;case"optional":{const isFuelTank=moduleSlot==="fuelTank";if(module.category!=="internal"&&!isFuelTank){return problem("optionalInternalRequired","not an optional-internal module")}if(moduleSlot&&!isFuelTank){return problem("coreModuleInOptionalSlot","a core module only fits its core slot")}const restricted2=restrictionProblem(slot,symbol);if(restricted2)return restricted2;break}}return module.class>slot.size?problem("oversized",`module size ${truncate(module.class)} exceeds slot size ${slot.size}`,{moduleClass:module.class,slotSize:slot.size}):null}function moduleFitError(shipSymbol,slot,module){return moduleFitProblem(shipSymbol,slot,module)?.message??null}var REBUY_FRACTION=.05;function exportLoadoutEvent(input,options){const fromSource=options.credits==="source";const source=fromSource?input.sourcePurchase:null;const totals=source!==null&&sourceTotalsHold(input.modules,source)?source:null;const hullValue=fromSource?source?.hullValue??null:input.retailHullValue;const modulesValue=fromSource?totals?.modulesValue??null:computedModulesValue(input.modules,input.statsFor);const rebuy=fromSource?totals?.rebuy??null:hullValue===null||modulesValue===null?null:Math.trunc((hullValue+modulesValue)*REBUY_FRACTION);return{event:"Loadout",Ship:input.shipSymbol.toLowerCase(),...input.shipName===void 0?{}:{ShipName:input.shipName},...input.shipIdent===void 0?{}:{ShipIdent:input.shipIdent},...hullValue===null?{}:{HullValue:hullValue},...modulesValue===null?{}:{ModulesValue:modulesValue},...input.unladenMass===null?{}:{UnladenMass:input.unladenMass},...input.cargoCapacity===null?{}:{CargoCapacity:input.cargoCapacity},...input.maxJumpRange===null?{}:{MaxJumpRange:input.maxJumpRange},...input.fuelCapacity===null?{}:{FuelCapacity:{Main:input.fuelCapacity.main,Reserve:input.fuelCapacity.reserve}},...rebuy===null?{}:{Rebuy:rebuy},Modules:exportModules(input,options,fromSource)}}function exportModules(input,options,fromSource){const ordered=options.moduleOrder==="slots"?slotOrderedModules(input.shipSymbol,input.modules,input.layout):[...input.modules.values()];return ordered.map(module=>{const on=module.On??(options.explicitPower?true:void 0);const priority=module.Priority??(options.explicitPower?0:void 0);const value=fromSource?sourceModuleValue(module,input.sourcePurchase):moduleValue(module,input.statsFor);return{Slot:module.Slot,Item:module.Item.toLowerCase(),...on===void 0?{}:{On:on},...priority===void 0?{}:{Priority:priority},...module.Health===void 0?{}:{Health:module.Health},...typeof value==="number"?{Value:value}:{},...module.Engineering===void 0?{}:{Engineering:cloneLoadoutModule(module).Engineering}}})}function slotOrderedModules(shipSymbol,modules,layout){if(!layout){throw new TypeError(`ShipLoadout.toLoadoutEvent: no slot layout for hull "${truncate(shipSymbol)}", so modules cannot be ordered by slot`)}const remaining=new Map(modules);const ordered=[];for(const slot of layout){const key=matchingKeyIn(remaining,slot.key);const module=key===null?void 0:remaining.get(key);if(module&&key!==null){ordered.push(module);remaining.delete(key)}}return[...ordered,...remaining.values()]}function computedModulesValue(modules,statsFor){let sum=0;for(const module of modules.values()){const value=moduleValue(module,statsFor);if(value==="unknown")return null;if(value!=="free")sum+=value}return sum}function moduleValue(module,statsFor){const stats=statsFor(module);if(stats!==null)return stats.cost??"unknown";return isNonOutfittingSlot(module.Slot)||isBuiltInHullModule(module)?"free":"unknown"}var SOURCE_ITEM="ShipLoadout: sourcePurchase moduleValues[].item";function sourceModuleValue(module,source){const entry=source===null?null:getSourceModuleValue(source,module.Slot);if(entry===null)return"unknown";return normalizeKey(entry.item,SOURCE_ITEM)===normalizeKey(module.Item,FITTED_ITEM)?entry.value:"unknown"}function sourceTotalsHold(modules,source){for(const entry of source.moduleValues){const key=matchingKeyIn(modules,entry.slot);const fitted=key===null?void 0:modules.get(key);if(!fitted||normalizeKey(fitted.Item,FITTED_ITEM)!==normalizeKey(entry.item,SOURCE_ITEM)){return false}}return true}function captureLoadoutEvent(event){const modules=event.Modules;const shipName=event.ShipName;const shipIdent=event.ShipIdent;const hullValue=event.HullValue;const modulesValue=event.ModulesValue;const rebuy=event.Rebuy;const unladenMass=event.UnladenMass;const cargoCapacity=event.CargoCapacity;const fuelCapacity=event.FuelCapacity;return{Ship:event.Ship,Modules:Array.isArray(modules)?captureEach(modules,captureModule):modules,...shipName===void 0?{}:{ShipName:shipName},...shipIdent===void 0?{}:{ShipIdent:shipIdent},...hullValue===void 0?{}:{HullValue:hullValue},...modulesValue===void 0?{}:{ModulesValue:modulesValue},...rebuy===void 0?{}:{Rebuy:rebuy},...unladenMass===void 0?{}:{UnladenMass:unladenMass},...cargoCapacity===void 0?{}:{CargoCapacity:cargoCapacity},...fuelCapacity===void 0?{}:{FuelCapacity:{...fuelCapacity}}}}function captureEach(values,capture){const captured=[];const{length:length}=values;for(let index=0;index<length;index++)captured.push(capture(values[index]));return captured}function captureModule(module){if(module===null||typeof module!=="object")return module;const on=module.On;const priority=module.Priority;const health=module.Health;const value=module.Value;const engineering=module.Engineering;return{Slot:module.Slot,Item:module.Item,...on===void 0?{}:{On:on},...priority===void 0?{}:{Priority:priority},...health===void 0?{}:{Health:health},...value===void 0?{}:{Value:value},...engineering===void 0?{}:{Engineering:captureEngineering(engineering)}}}function captureEngineering(engineering){if(engineering===null||typeof engineering!=="object")return engineering;const experimental=engineering.ExperimentalEffect;const experimentalLocalised=engineering.ExperimentalEffect_Localised;const modifiers=engineering.Modifiers;return{BlueprintName:engineering.BlueprintName,Level:engineering.Level,Quality:engineering.Quality,...experimental===void 0?{}:{ExperimentalEffect:experimental},...experimentalLocalised===void 0?{}:{ExperimentalEffect_Localised:experimentalLocalised},...modifiers===void 0?{}:{Modifiers:Array.isArray(modifiers)?captureEach(modifiers,modifier=>modifier!==null&&typeof modifier==="object"?{...modifier}:modifier):modifiers}}}function normalizeLoadoutEvent(rawEvent){const event=captureLoadoutEvent(rawEvent);requireStringIfPresent(event.Ship,"ShipLoadout.fromLoadout: event.Ship");if(!Array.isArray(event.Modules)){throw new TypeError(`ShipLoadout.fromLoadout: event.Modules must be an array, received ${describeValue(event.Modules)}`)}const modules=/* @__PURE__ */new Map;const slots=/* @__PURE__ */new Set;for(const module of event.Modules){if(module===null||typeof module!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: event.Modules[] must hold module objects, received ${describeValue(module)}`)}requireString(module.Slot,"ShipLoadout.fromLoadout: module.Slot");requireString(module.Item,"ShipLoadout.fromLoadout: module.Item");if(module.Engineering!==void 0){if(module.Engineering===null||typeof module.Engineering!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering must be an object, received ${describeValue(module.Engineering)}`)}requireStringIfPresent(module.Engineering.BlueprintName,"ShipLoadout.fromLoadout: module.Engineering.BlueprintName");requireStringIfPresent(module.Engineering.ExperimentalEffect,"ShipLoadout.fromLoadout: module.Engineering.ExperimentalEffect");if(module.Engineering.Modifiers!==void 0&&!Array.isArray(module.Engineering.Modifiers)){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering.Modifiers must be an array, received ${describeValue(module.Engineering.Modifiers)}`)}for(const[index,modifier]of(module.Engineering.Modifiers??[]).entries()){if(modifier===null||typeof modifier!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: module.Engineering.Modifiers[${index}] must be an object, received ${describeValue(modifier)}`)}requireString(modifier.Label,`ShipLoadout.fromLoadout: module.Engineering.Modifiers[${index}].Label`)}}const normalizedSlot=module.Slot.toLowerCase();if(slots.has(normalizedSlot)){throw new TypeError(`ShipLoadout.fromLoadout: duplicate slot "${truncate(module.Slot)}"`)}slots.add(normalizedSlot);modules.set(module.Slot,cloneLoadoutModule(module))}const top={};if(event.ShipName!==void 0)top.ShipName=event.ShipName;if(event.ShipIdent!==void 0)top.ShipIdent=event.ShipIdent;if(event.HullValue!==void 0)top.HullValue=event.HullValue;if(event.ModulesValue!==void 0)top.ModulesValue=event.ModulesValue;if(event.Rebuy!==void 0)top.Rebuy=event.Rebuy;if(event.UnladenMass!==void 0)top.UnladenMass=event.UnladenMass;if(event.CargoCapacity!==void 0)top.CargoCapacity=event.CargoCapacity;if(event.FuelCapacity!==void 0)top.FuelCapacity={...event.FuelCapacity};const moduleStats=/* @__PURE__ */new Map;for(const module of modules.values()){const engineering=module.Engineering;const variant=identifyPreEngineeredVariant(module);const variantStats=variant?getPreEngineeredStats(variant):null;if(variantStats)moduleStats.set(module.Slot,cloneModuleStats(variantStats));if(variantStats?.engineeringLocked||typeof engineering?.BlueprintName!=="string"||!isFinalGuardianWeaponEngineering(module.Item,engineering.BlueprintName)){continue}const normalizedBlueprint=normalizeKey(engineering.BlueprintName,"ShipLoadout.fromLoadout: module.Engineering.BlueprintName");const normalizedExperimental=normalizeKey(engineering.ExperimentalEffect,"ShipLoadout.fromLoadout: module.Engineering.ExperimentalEffect");const exact=getPreEngineeredVariants(module.Item).find(candidate=>candidate.blueprint.toLowerCase()===normalizedBlueprint&&candidate.grade===engineering.Level&&candidate.experimental?.toLowerCase()===normalizedExperimental);const stats=exact?getPreEngineeredStats(exact):builtInModuleBySymbol(module.Item,"ShipLoadout.fromLoadout: module.Item");if(stats){moduleStats.set(module.Slot,cloneModuleStats({...stats,engineeringLocked:true}))}}return{shipSymbol:event.Ship,modules:modules,moduleStats:moduleStats,top:top,sourcePurchase:sourcePurchaseFromLoadout(event)}}var SLOT_KEY="ShipLoadout: slotKey";var requireLoadOptions=(scope,options)=>{for(const field of["fuel","cargo"]){const value=options[field];if(value!==void 0&&(!Number.isFinite(value)||value<0)){throw new RangeError(`${scope}: ${field} must be a finite non-negative number`)}}};var LoadoutEditError=class extends TypeError{code;constraint;params;constructor(message,code,params,constraint){super(message);this.code=code;this.params=deepFreeze(Object.fromEntries(Object.entries(params).map(([key,value])=>[key,Array.isArray(value)?[...value]:value])));if(constraint!==void 0)this.constraint=constraint}};var FSD_PREFIX="int_hyperdrive";var BOOSTER_PREFIX="int_guardianfsdbooster";var FUEL_TANK_PREFIX="int_fueltank";var ShipLoadout=class _ShipLoadout{#shipSymbol;#modules;#moduleStats;#primitiveModifiers=/* @__PURE__ */new Map;#top;#sourcePurchase;#version=0;#viewVersion=0;#layoutCache;#calculationCache=null;#validationCache=null;#fittedModuleCache=null;#slotCache=null;constructor(shipSymbol,modules,top,sourcePurchase=null,moduleStats=/* @__PURE__ */new Map){this.#shipSymbol=shipSymbol;this.#modules=modules;this.#top=top;this.#sourcePurchase=sourcePurchase;this.#moduleStats=moduleStats}static fromSlef(input,index=0){const entries=parseSlef(input);const entry=entries[index];if(!entry){throw new TypeError(`ShipLoadout.fromSlef: no entry at index ${truncate(index)} (have ${entries.length})`)}return _ShipLoadout.fromLoadout(entry.data)}static fromLoadout(event){if(event===null||typeof event!=="object"){throw new TypeError(`ShipLoadout.fromLoadout: event must be a Loadout event, received ${describeValue(event)}`)}const imported=normalizeLoadoutEvent(event);return new _ShipLoadout(imported.shipSymbol,imported.modules,imported.top,imported.sourcePurchase,imported.moduleStats)}static empty(shipSymbol){const layout=getShipSlots(requireString(shipSymbol,"ShipLoadout.empty: shipSymbol"));if(!layout){throw new TypeError(`ShipLoadout.empty: no slot layout for hull "${truncate(shipSymbol)}"`)}return new _ShipLoadout(layout.symbol,/* @__PURE__ */new Map,{})}static default(shipSymbol){const requested=requireString(shipSymbol,"ShipLoadout.default: shipSymbol");const loadout=getDefaultLoadout(requested);if(!loadout){throw new TypeError(`ShipLoadout.default: no default loadout for hull "${truncate(shipSymbol)}"`)}return new _ShipLoadout(loadout.symbol,new Map(loadout.modules.map(module=>[module.slot,{Slot:module.slot,Item:module.symbol}])),{})}get shipSymbol(){return this.#shipSymbol}get shipName(){return this.#top.ShipName??null}get shipIdent(){return this.#top.ShipIdent??null}get unladenMass(){return this.unladenMassResult.value}get unladenMassResult(){return this.#top.UnladenMass===void 0?this.#computedUnladenMass():completeResult(this.#top.UnladenMass)}#computedUnladenMass(){return calculateUnladenMass(getShipBySymbol(this.#shipSymbol)?.hullMass??null,this.#calculationModules())}get fuelCapacity(){return this.fuelCapacityResult.value}get fuelCapacityResult(){const cap=this.#top.FuelCapacity;if(cap?.Main!==void 0&&cap.Reserve!==void 0){return completeResult(Object.freeze({main:cap.Main,reserve:cap.Reserve}))}const computed=this.#computedFuelCapacity();if(computed.value===null)return computed;return completeResult(Object.freeze({main:cap?.Main??computed.value.main,reserve:cap?.Reserve??computed.value.reserve}))}get cargoCapacity(){return this.cargoCapacityResult.value}get cargoCapacityResult(){return this.#top.CargoCapacity===void 0?this.#computedCargoCapacity():completeResult(this.#top.CargoCapacity)}#computedCargoCapacity(){return calculateCargoCapacity(this.#calculationModules())}#computedFuelCapacity(){return calculateFuelCapacity(getShipBySymbol(this.#shipSymbol)?.reserveFuelCapacity??null,this.#calculationModules())}get hullValue(){return this.#top.HullValue??null}get modulesValue(){return this.#top.ModulesValue??null}get rebuy(){return this.#top.Rebuy??null}get sourcePurchase(){return this.#sourcePurchase}get validation(){const cached=this.#validationCache;if(cached!==null&&cached.version===this.#version)return cached.value;const slots=this.#layoutOrNull();const byKey=new Map(slots?.map(slot=>[slot.key.toLowerCase(),slot])??[]);const modules=[...this.#modules.values()].map(module=>{const stats=this.#statsFor(module);const slot=byKey.get(module.Slot.toLowerCase());const builtIn=stats===null&&isNonOutfittingSlot(module.Slot)||isBuiltInHullModule(module);const fitProblem=stats&&slot&&!builtIn?moduleFitProblem(this.#shipSymbol,slot,stats):null;return{slot:module.Slot,symbol:module.Item,known:stats!==null||builtIn,requiresKnownSlot:!builtIn,fitError:fitProblem?.message??null,...fitProblem===null?{}:{fitConstraint:fitProblem.constraint},...fitProblem?.params===void 0?{}:{fitParams:fitProblem.params},...stats?.exclusionGroup===void 0?{}:{exclusionGroup:stats.exclusionGroup},...stats?.limitGroup===void 0?{}:{limitGroup:stats.limitGroup},...stats?.limitIncrease===void 0?{}:{limitIncrease:stats.limitIncrease}}});const value=validateLoadout({shipSymbol:this.#shipSymbol,slots:slots,modules:modules});this.#validationCache={version:this.#version,value:value};return value}slots(kind){let cached=this.#slotCache;if(cached===null||cached.version!==this.#viewVersion){cached={version:this.#viewVersion,value:/* @__PURE__ */new Map};this.#slotCache=cached}const existing=cached.value.get(kind);if(existing!==void 0)return existing;const slots=kind===void 0?this.#layout():this.#layout().filter(slot=>slot.kind===kind);const currentLimits=this.#moduleLimits();const value=deepFreeze(slots.map(slot=>{const stats=this.#moduleStatsAt(slot.key);const fixedReason=fixedSlotReason(slot);const immovableReason=fixedReason!==null?fixedReason:stats?.limitIncrease!==void 0&&this.#moduleLimitRegression(slot.key,null,currentLimits,stats)!==null?"moduleLimit":null;return{...slot,name:loadoutSlotName(slot),module:this.fittedModuleAt(slot.key),removable:immovableReason===null,...immovableReason===null?{}:{immovableReason:immovableReason}}}));cached.value.set(kind,value);return value}fittedModuleAt(slotKey){const module=this.#fittedModuleFor(slotKey);if(!module)return null;let cached=this.#fittedModuleCache;if(cached===null||cached.version!==this.#viewVersion){cached={version:this.#viewVersion,value:/* @__PURE__ */new Map};this.#fittedModuleCache=cached}const existing=cached.value.get(module.Slot);if(existing!==void 0)return existing;const raw=cloneLoadoutModule(module);const stats=this.#statsFor(module);const effective=effectiveModule(this.#moduleForEffectiveStats(module),stats);const value=deepFreeze({slot:module.Slot,symbol:raw.Item,on:raw.On,priority:raw.Priority,health:raw.Health,value:raw.Value,engineering:raw.Engineering,raw:raw,stats:stats===null?null:cloneModuleStats(stats),effectiveStats:effective===null?null:cloneModuleStats(effective),ammunition:ammunitionCapacity(effective),preEngineeredVariant:identifyPreEngineeredVariant(raw)});cached.value.set(module.Slot,value);return value}fittedModules(){return deepFreeze([...this.#modules.keys()].flatMap(key=>{const fitted=this.fittedModuleAt(key);return fitted===null?[]:[fitted]}))}availableBlueprints(slotKey){const module=this.#fittedModuleFor(slotKey);return deepFreeze(module?availableBlueprintsFor(module.Item,this.#statsFor(module)):[])}availableExperimentalEffects(slotKey){const module=this.#fittedModuleFor(slotKey);return deepFreeze(module?availableExperimentalsFor(module.Item,this.#statsFor(module)):[])}modulesForSlot(slotKey){const slot=this.#requireSlot(slotKey);const occupied=new Set([...this.#modules.values()].flatMap(fitted=>{if(fitted.Slot.toLowerCase()===slot.key.toLowerCase())return[];const group=this.#statsFor(fitted)?.exclusionGroup;return group===void 0?[]:[group]}));const currentLimits=this.#moduleLimits();const currentStats=this.#moduleStatsAt(slot.key);return ALL_MODULES.filter(module=>moduleFitError(this.#shipSymbol,slot,module)===null&&(module.exclusionGroup===void 0||!occupied.has(module.exclusionGroup))&&this.#moduleLimitRegression(slot.key,module,currentLimits,currentStats)===null)}setModule(slotKey,module){const slot=this.#requireSlot(slotKey);if(module===null||module===void 0){throw new TypeError(`ShipLoadout.setModule: no module supplied for "${truncate(slotKey)}" (did the module lookup return undefined?)`)}if(typeof module.symbol!=="string"){throw new TypeError(`ShipLoadout.setModule: module for "${truncate(slotKey)}" must be an outfitting module, received ${describeValue(module)}`)}const problem2=moduleFitProblem(this.#shipSymbol,slot,module);if(problem2){if(problem2.constraint==="immutableSlot"){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${problem2.message}`,"immutableSlot",{slot:slot.key})}throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${problem2.message}`,"incompatibleModule",{...problem2.params,slot:slot.key,symbol:module.symbol,constraint:problem2.constraint},problem2.constraint)}if(module.exclusionGroup!==void 0){const conflict=[...this.#modules.values()].find(fitted=>fitted.Slot.toLowerCase()!==slot.key.toLowerCase()&&this.#statsFor(fitted)?.exclusionGroup===module.exclusionGroup);if(conflict){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${module.exclusionGroup} is limited to one per ship (already fitted in ${truncate(conflict.Slot)})`,"duplicateExclusiveModule",{exclusionGroup:module.exclusionGroup,slot:slot.key,symbol:module.symbol,previousSlot:conflict.Slot,previousSymbol:conflict.Item})}}const limitProblem=this.#moduleLimitRegression(slot.key,module);if(limitProblem!==null){throw new LoadoutEditError(`ShipLoadout.setModule: ${truncate(module.symbol)} → ${truncate(slotKey)}: ${limitProblem.group} would have ${limitProblem.count} modules but the ship allows ${limitProblem.limit}`,"moduleLimitExceeded",{group:limitProblem.group,count:limitProblem.count,limit:limitProblem.limit,slot:slot.key,symbol:module.symbol})}const key=this.#fittedKey(slotKey)??slot.key;this.#replaceModule(key,{Slot:key,Item:module.symbol},cloneModuleStats(module));return this}removeModule(slotKey){const wanted=requireString(slotKey,SLOT_KEY).toLowerCase();if(wanted==="cargohatch"){throw new LoadoutEditError("ShipLoadout.removeModule: the cargoHatch slot cannot be changed","immutableSlot",{slot:"CargoHatch"})}const parsed=parseSlotName(slotKey);const slot=this.#layoutOrNull()?.find(candidate=>candidate.key.toLowerCase()===wanted);if(parsed!==null&&fixedSlotReason(parsed)==="requiredSlot"){const fittedKey=this.#fittedKey(slotKey);const key2=slot?.key??fittedKey??slotKey;throw new LoadoutEditError(`ShipLoadout.removeModule: the ${truncate(key2)} slot is required and cannot be emptied`,"requiredSlot",{slot:key2})}const key=this.#fittedKey(slotKey);if(key!==null){const limitProblem=this.#moduleLimitRegression(key,null);if(limitProblem!==null){const fitted=this.#modules.get(key);throw new LoadoutEditError(`ShipLoadout.removeModule: ${truncate(slotKey)}: ${limitProblem.group} would have ${limitProblem.count} modules but the ship allows ${limitProblem.limit}`,"moduleLimitExceeded",{group:limitProblem.group,count:limitProblem.count,limit:limitProblem.limit,slot:key,...fitted===void 0?{}:{symbol:fitted.Item}})}this.#replaceModule(key,null)}return this}applyBlueprint(slotKey,fdname,options){requireString(fdname,"ShipLoadout.applyBlueprint: fdname");if(options===null||typeof options!=="object"){throw new TypeError(`ShipLoadout.applyBlueprint: options must be an object with a grade, received ${describeValue(options)}`)}const wantedGrade=options.grade;const wantedQuality=options.quality;const wantedExperimental=options.experimental??void 0;requireStringIfPresent(wantedExperimental,"ShipLoadout.applyBlueprint: options.experimental");const module=this.#fittedModuleFor(slotKey);if(!module){throw new RangeError(`ShipLoadout.applyBlueprint: slot "${truncate(slotKey)}" is empty`)}const fittedStats=this.#statsFor(module);if(!fittedStats){throw new TypeError(`ShipLoadout.applyBlueprint: no stats for module "${truncate(module.Item)}"`)}const recipe=resolveBlueprintForModule(module.Item,fdname);const named=recipe===fdname?`"${truncate(fdname)}"`:`"${truncate(fdname)}" (${truncate(recipe)} on this module)`;const written=fdname.trim().toLowerCase();const resolved=recipe.trim().toLowerCase();if(getPreEngineeredVariants(module.Item).some(variant=>variant.acquisition==="eventReward"&&(variant.blueprint.toLowerCase()===written||variant.blueprint.toLowerCase()===resolved))){throw new TypeError(`ShipLoadout.applyBlueprint: ${named} is a fixed pre-engineered identity, not a craftable blueprint; use setPreEngineeredVariant to fit its fixed article`)}if(!Number.isInteger(wantedGrade)||wantedGrade<1||wantedGrade>5){throw new RangeError(`ShipLoadout.applyBlueprint: no blueprint ${named} grade ${truncate(wantedGrade)}`)}const grade=getBlueprintGrade(recipe,wantedGrade);if(!grade){throw new RangeError(`ShipLoadout.applyBlueprint: no blueprint ${named} grade ${truncate(wantedGrade)}`)}let experimental;if(wantedExperimental!==void 0){experimental=getExperimentalEffect(wantedExperimental);if(!experimental){throw new RangeError(`ShipLoadout.applyBlueprint: unknown experimental effect "${truncate(wantedExperimental)}"`)}}const quality=wantedQuality??1;if(!Number.isFinite(quality)||quality<0||quality>1){throw new RangeError(`ShipLoadout.applyBlueprint: quality must be a finite number in [0, 1]`)}if(fittedStats.engineeringLocked){throw new TypeError(`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is a final pre-engineered article and accepts no further engineering`)}if(!blueprintAvailableFor(module.Item,fdname)){const offered=[...blueprintRoutesFor(module.Item)].map(([blueprint,route])=>`${blueprint} (${route})`);throw new TypeError(offered.length>0?`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is not offered blueprint ${named}; available candidates are ${offered.join(", ")}`:`ShipLoadout.applyBlueprint: no registry lists an engineering menu for module "${truncate(module.Item)}"`)}if(wantedExperimental!==void 0&&!experimentalAvailableFor(module.Item,wantedExperimental)){const offered=getExperimentalsForModule(module.Item);throw new TypeError(`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is not offered experimental effect "${truncate(wantedExperimental)}"; it takes ${offered.length>0?offered.join(", "):"no experimental effect"}`)}const stats=this.#engineeringBaseStats(module)??fittedStats;const base=baseStats(stats);const canonical=primitiveEngineeringInputsFor(stats,grade,experimental);const missing=missingBaseLabels(stats,base,canonical.grade.features,canonical.experimental?.modifiers);if(missing.length>0){throw new TypeError(`ShipLoadout.applyBlueprint: cannot compute ${named} for module "${truncate(module.Item)}"; missing base stats for ${missing.join(", ")}`)}const damageDistribution=experimental?.damageDistribution??grade.damageDistribution;const primitiveModifiers=computeModifiers(base,canonical.grade,quality,canonical.experimental);const modifiers=journalModifiersFor(stats,primitiveModifiers);if(damageDistribution){for(const type of["kinetic","thermal","explosive","absolute"]){const value=damageDistribution[type];if(value===void 0)continue;const label=labelsForDamageType(type)[0];if(label===void 0)continue;const damageModifier={Label:label,Value:value*scaleForLabel(label),OriginalValue:(stats.damageDistribution?.[type]??0)*scaleForLabel(label)};modifiers.push(damageModifier);primitiveModifiers.push(damageModifier)}}const engineering={BlueprintName:fdname,Level:wantedGrade,Quality:quality,...wantedExperimental!==void 0?{ExperimentalEffect:wantedExperimental}:{},Modifiers:modifiers};this.#replaceModule(module.Slot,{...module,Engineering:engineering},stats,primitiveModifiers);return this}setPreEngineeredVariant(slotKey,variant){if(variant===null||typeof variant!=="object"){throw new TypeError(`ShipLoadout.setPreEngineeredVariant: variant must be a pre-engineered variant, received ${describeValue(variant)}`)}requireString(variant.symbol,"ShipLoadout.setPreEngineeredVariant: variant.symbol");requireString(variant.blueprint,"ShipLoadout.setPreEngineeredVariant: variant.blueprint");requireString(variant.acquisition,"ShipLoadout.setPreEngineeredVariant: variant.acquisition");requireStringIfPresent(variant.experimental,"ShipLoadout.setPreEngineeredVariant: variant.experimental");const known=getPreEngineeredVariants(variant.symbol).find(candidate=>candidate.blueprint.toLowerCase()===variant.blueprint.toLowerCase()&&candidate.grade===variant.grade&&(candidate.experimental?.toLowerCase()??"")===(variant.experimental?.toLowerCase()??"")&&candidate.acquisition===variant.acquisition);if(!known){throw new RangeError(`ShipLoadout.setPreEngineeredVariant: no catalogued variant "${truncate(variant.blueprint)}" for module "${truncate(variant.symbol)}"`)}const stats=getPreEngineeredStats(known);const unresolved=unresolvedModifiers(known);if(unresolved.length>0){throw new TypeError(`ShipLoadout.setPreEngineeredVariant: cannot resolve "${truncate(variant.blueprint)}" for module "${truncate(variant.symbol)}"; missing base stats for ${unresolved.join(", ")}`)}this.setModule(slotKey,stats);const module=this.#fittedModuleFor(slotKey);const engineering={BlueprintName:known.blueprint,Level:known.grade,Quality:1,...known.experimental===void 0?{}:{ExperimentalEffect:known.experimental},...known.modifiers?.length?{Modifiers:getPreEngineeredJournalModifiers(known)}:{}};this.#replaceModule(module.Slot,{...module,Engineering:engineering},cloneModuleStats(stats),getPreEngineeredModifiers(known));return this}clearEngineering(slotKey){const module=this.#fittedModuleFor(slotKey);if(module&&this.#statsFor(module)?.engineeringLocked){throw new TypeError(`ShipLoadout.clearEngineering: module "${truncate(module.Item)}" is a final pre-engineered article and its engineering cannot be removed`)}if(module?.Engineering){const baseStats2=this.#engineeringBaseStats(module);const bare={Slot:module.Slot,Item:module.Item};if(module.On!==void 0)bare.On=module.On;if(module.Priority!==void 0){bare.Priority=module.Priority}if(module.Health!==void 0)bare.Health=module.Health;if(module.Value!==void 0)bare.Value=module.Value;this.#replaceModule(module.Slot,bare,baseStats2??void 0)}return this}setModuleEnabled(slotKey,on){this.#patchModule(slotKey,{On:on});return this}setModulePriority(slotKey,priority){if(!Number.isInteger(priority)||priority<0||priority>4){throw new RangeError(`ShipLoadout: power priority must be an integer 0-4, got ${truncate(priority)}`)}this.#patchModule(slotKey,{Priority:priority});return this}#patchModule(slotKey,patch){const module=this.#fittedModuleFor(slotKey);if(!module){throw new RangeError(`ShipLoadout: slot "${truncate(slotKey)}" is empty`)}this.#modules.set(module.Slot,cloneLoadoutModule({...module,...patch}));this.#viewVersion++}toLoadoutEvent(options={}){const hull=getShipBySymbol(this.#shipSymbol);const unladenMass=this.#computedUnladenMass().value;const cargoCapacity=this.#computedCargoCapacity().value;const fuel=this.#computedFuelCapacity().value;const maxJumpRange=this.#exportableJumpRange(unladenMass);return exportLoadoutEvent({shipSymbol:this.#shipSymbol,...this.#top.ShipName===void 0?{}:{shipName:this.#top.ShipName},...this.#top.ShipIdent===void 0?{}:{shipIdent:this.#top.ShipIdent},modules:this.#modules,...options.moduleOrder==="slots"?{layout:this.#layoutOrNull()}:{},sourcePurchase:this.#sourcePurchase,retailHullValue:hull?.hullCost??null,unladenMass:unladenMass,cargoCapacity:cargoCapacity,fuelCapacity:fuel,maxJumpRange:maxJumpRange,statsFor:module=>this.#statsFor(module)},options)}toSlef(options){return toSlef(this.toLoadoutEvent(options),options.header)}toSlefString(options){return stringifySlef(this.toSlef(options),{indent:options.indent??0})}#exportableJumpRange(unladenMass){if(unladenMass===null)return null;let drive;try{drive=this.#resolveDrive()}catch{return null}if(drive===null)return null;const tank=this.#computedFuelCapacity().value;if(tank===null)return null;return singleJumpRange(unladenMass,Math.min(tank.main,drive.maxFuel),drive)}get frameShiftDrive(){const drive=this.#resolveDrive();if(drive===null)throw new TypeError("ShipLoadout: build has no frame shift drive");return drive}#maxJumpFuel(fsd){return Math.min(this.#requireFuelCapacity().main,fsd.maxFuel)}frameShiftDriveMassFactor(options={}){requireLoadOptions("ShipLoadout.frameShiftDriveMassFactor",options);const fuel=options.fuel??this.#requireFuelCapacity().main;return frameShiftDriveMassFactor(this.#requireMass(options.cargo??0),fuel,this.frameShiftDrive)}maxJumpRange(){const fsd=this.frameShiftDrive;return singleJumpRange(this.#requireMass(0),this.#maxJumpFuel(fsd),fsd)}jumpRange(options={}){requireLoadOptions("ShipLoadout.jumpRange",options);const fsd=this.frameShiftDrive;const fuel=options.fuel??this.#requireFuelCapacity().main;return singleJumpRange(this.#requireMass(options.cargo??0),fuel,fsd)}ladenJumpRange(){return this.jumpRange({cargo:this.#requireCargoCapacity()})}fuelPerJump(distance,options={}){requireLoadOptions("ShipLoadout.fuelPerJump",options);const fsd=this.frameShiftDrive;const fuel=options.fuel??this.#requireFuelCapacity().main;return fuelPerJump(distance,this.#requireMass(options.cargo??0),fuel,fsd)}totalRange(options={}){requireLoadOptions("ShipLoadout.totalRange",options);return totalRange(this.#requireMass(options.cargo??0),options.fuel??this.#requireFuelCapacity().main,this.frameShiftDrive)}jumpRangeSummary(){const cargo=this.#requireCargoCapacity();const fsd=this.frameShiftDrive;const maxFuel=this.#maxJumpFuel(fsd);return{max:this.maxJumpRange(),unladen:this.jumpRange(),laden:this.jumpRange({cargo:cargo}),totalMax:this.totalRange({fuel:maxFuel}),totalUnladen:this.totalRange(),totalLaden:this.totalRange({cargo:cargo})}}powerBudget(){const modules=[...this.#modules.values()];const consumers=[];for(const module of modules){const consumer=powerConsumerFor(module,this.#statsFor(module));if(consumer)consumers.push(consumer)}return powerBudget(powerAvailable(modules,module=>this.#statsFor(module)),consumers)}heatMetrics(){const input=heatInputFor(this.#shipSymbol,this.#modulesForEffectiveStats(),this.powerBudget(),module=>this.#statsFor(module));return input?heatMetrics(input):null}mobilityMetrics(options={}){const enginesPips=options.enginesPips??4;if(!Number.isFinite(enginesPips)||enginesPips<0||enginesPips>4){throw new RangeError("ShipLoadout.mobilityMetrics: enginesPips must be a finite number from 0 to 4")}requireLoadOptions("ShipLoadout.mobilityMetrics",options);const input=mobilityInputFor(this.#shipSymbol,[...this.#modules.values()],()=>{const main=options.fuel??this.#top.FuelCapacity?.Main??this.#requireFuelCapacity().main;return this.#requireMass(options.cargo??0)+main},enginesPips,module=>this.#statsFor(module));return input?mobilityMetrics(input):null}shieldMetrics(options={}){const input=shieldInputFor(this.#shipSymbol,[...this.#modules.values()],options.systemsPips??0,module=>this.#statsFor(module));if(!input.generator)return null;return shieldMetrics(input)}shieldRecovery(options={}){const systemsPips=options.systemsPips??4;if(!Number.isFinite(systemsPips)||systemsPips<0||systemsPips>4){throw new RangeError("ShipLoadout.shieldRecovery: systemsPips must be a finite number from 0 to 4")}const input=shieldRecoveryInputFor(this.#shipSymbol,[...this.#modules.values()],systemsPips,module=>this.#statsFor(module));return input?shieldRecovery(input):null}cellBanks(){const modules=[...this.#modules.values()];const banks=cellBankInputsFor(modules,this.powerBudget(),module=>this.#statsFor(module));const layout=this.#layoutOrNull();if(layout){const order=new Map(layout.map((slot,index)=>[slot.key.toLowerCase(),index]));banks.sort((left,right)=>(order.get(left.slot.toLowerCase())??Number.MAX_SAFE_INTEGER)-(order.get(right.slot.toLowerCase())??Number.MAX_SAFE_INTEGER))}return cellBankSummary(banks)}retailCredits(){const hull=getShipBySymbol(this.#shipSymbol)?.hullCost??null;let modules=0;const unpriced=[];for(const module of this.#modules.values()){const stats=this.#statsFor(module);if(stats?.cost!==void 0){modules+=stats.cost}else if(stats!==null||!isNonOutfittingSlot(module.Slot)&&!isBuiltInHullModule(module)){unpriced.push({slot:module.Slot,symbol:module.Item})}}return deepFreeze({hull:hull,modules:modules,rebuy:hull===null?null:Math.trunc((hull+modules)*.05),unpriced:unpriced})}mercCoinCost(){let total=0;for(const slotKey of this.#modules.keys()){total+=this.fittedModuleAt(slotKey)?.preEngineeredVariant?.mercCoinCost??0}return total}armourMetrics(){return armourMetrics(armourInputFor(this.#shipSymbol,[...this.#modules.values()],module=>this.#statsFor(module)))}weaponMetrics(){const weapons=[];for(const module of this.#modules.values()){const record=this.#statsFor(module);const stats=weaponStatsFor(this.#moduleForEffectiveStats(module),record);if(!stats)continue;weapons.push({slot:module.Slot,symbol:module.Item,name:record?.name??module.Item,enabled:module.On!==false,metrics:weaponMetrics(stats),ammunition:ammunitionCapacity(stats)})}return{weapons:weapons,total:sumWeaponMetrics(weapons.filter(weapon=>weapon.enabled).map(weapon=>weapon.metrics))}}weaponsCapacitorMetrics(options={}){const weaponsPips=options.weaponsPips??4;if(!Number.isFinite(weaponsPips)||weaponsPips<0||weaponsPips>4){throw new RangeError("ShipLoadout.weaponsCapacitorMetrics: weaponsPips must be a finite number from 0 to 4")}return weaponsCapacitorMetrics(weaponsCapacitorInputFor(this.#modulesForEffectiveStats(),weaponsPips,this.powerBudget(),module=>this.#statsFor(module)))}distributorMetrics(options={}){const pips={systemsPips:options.systemsPips??4,enginesPips:options.enginesPips??4,weaponsPips:options.weaponsPips??4};for(const field of["systemsPips","enginesPips","weaponsPips"]){const value=pips[field];if(!Number.isFinite(value)||value<0||value>4){throw new RangeError(`ShipLoadout.distributorMetrics: ${field} must be a finite number from 0 to 4`)}}const input=distributorInputFor(this.#modulesForEffectiveStats(),pips,this.powerBudget(),module=>this.#statsFor(module));return input?distributorMetrics(input):null}#layoutOrNull(){if(this.#layoutCache===void 0){const layout=getShipSlots(this.#shipSymbol);this.#layoutCache=layout===null?null:Object.freeze(enumerateSlots(layout))}return this.#layoutCache}#invalidate(){this.#version++;this.#viewVersion++}#layout(){const layout=this.#layoutOrNull();if(!layout){throw new TypeError(`ShipLoadout: no slot layout for hull "${truncate(this.#shipSymbol)}"`)}return layout}#requireSlot(slotKey){const wanted=requireString(slotKey,SLOT_KEY).toLowerCase();const slot=this.#layout().find(s=>s.key.toLowerCase()===wanted);if(!slot){throw new RangeError(`ShipLoadout: hull "${truncate(this.#shipSymbol)}" has no slot "${truncate(slotKey)}"`)}return slot}#fittedKey(slotKey){return matchingKeyIn(this.#modules,requireString(slotKey,SLOT_KEY))}#fittedModuleFor(slotKey){const key=this.#fittedKey(slotKey);return key===null?void 0:this.#modules.get(key)}#require(result,what){if(result.value===null){throw new TypeError(`ShipLoadout: cannot determine ${what} (${result.issues.map(i=>i.message).join("; ")})`)}return result.value}#requireMass(cargo){return this.#require(this.unladenMassResult,"mass")+cargo}#requireFuelCapacity(){return this.#require(this.fuelCapacityResult,"fuel capacity")}#requireCargoCapacity(){return this.#require(this.cargoCapacityResult,"cargo capacity")}#calculationModules(){const cached=this.#calculationCache;if(cached!==null&&cached.version===this.#version)return cached.value;const value=this.#resolveCalculationModules();this.#calculationCache={version:this.#version,value:value};return value}#resolveCalculationModules(){return[...this.#modules.values()].map(module=>{const stats=this.#statsFor(module);const symbol=module.Item.toLowerCase();const parsedSlot=parseSlotName(module.Slot);const unresolvedOutfitting=stats===null&&!isNonOutfittingSlot(module.Slot)&&!isBuiltInHullModule(module);const isCargoRack=stats?.cargoCapacity!==void 0||stats?.engineeringGroup==="cargoRacks"||symbol.includes("cargorack");const isFuelTank=stats?.fuelCapacity!==void 0||stats?.slot==="fuelTank"||symbol.startsWith(FUEL_TANK_PREFIX);const mayCarryCapacity=unresolvedOutfitting&&(parsedSlot===null||parsedSlot.kind==="optional");const mayCarryFuel=mayCarryCapacity||unresolvedOutfitting&&parsedSlot?.kind==="core"&&parsedSlot.core==="fuelTank";return{slot:module.Slot,symbol:module.Item,mass:this.#moduleMass(module),...isCargoRack||mayCarryCapacity?{cargoCapacity:isCargoRack?this.#moduleCapacity(module,"CargoCapacity","cargoCapacity"):null}:{},...isFuelTank||mayCarryFuel?{fuelCapacity:isFuelTank?this.#moduleCapacity(module,"FuelCapacity","fuelCapacity"):null}:{}}})}#moduleLimits(){const entries=[...this.#modules.values()].flatMap(module=>{const stats=this.#statsFor(module);return stats===null?[]:[stats]});return calculateModuleLimits(entries)}#moduleStatsAt(slotKey){const fitted=this.#fittedModuleFor(slotKey);return fitted===void 0?null:this.#statsFor(fitted)}#engineeringBaseStats(module){const fitted=this.#statsFor(module);if(!module.Engineering||identifyPreEngineeredVariant(module)===null)return fitted;const stock=builtInModuleBySymbol(module.Item,FITTED_ITEM);if(!stock)return fitted;return fitted?.engineeringLocked?cloneModuleStats({...stock,engineeringLocked:true}):stock}#moduleForEffectiveStats(module){const modifiers=this.#primitiveModifiers.get(module.Slot);if(modifiers===void 0||module.Engineering===void 0)return module;return{...module,Engineering:{...module.Engineering,Modifiers:modifiers}}}#modulesForEffectiveStats(){return[...this.#modules.values()].map(module=>this.#moduleForEffectiveStats(module))}#moduleLimitRegression(slotKey,replacement,current=this.#moduleLimits(),previous=this.#moduleStatsAt(slotKey)){if(previous?.limitGroup===void 0&&previous?.limitIncrease===void 0&&replacement?.limitGroup===void 0&&replacement?.limitIncrease===void 0){return null}for(const usage of current){const count=usage.count-Number(previous?.limitGroup===usage.group)+Number(replacement?.limitGroup===usage.group);const increase=usage.increase-(previous?.limitIncrease?.group===usage.group?previous.limitIncrease.amount:0)+(replacement?.limitIncrease?.group===usage.group?replacement.limitIncrease.amount:0);const limit=usage.baseLimit+increase;const excess=Math.max(0,count-limit);if(excess>usage.excess){return{...usage,increase:increase,limit:limit,count:count,excess:excess}}}return null}#replaceModule(slotKey,replacement,replacementStats,primitiveModifiers){const previous=this.#modules.get(slotKey)??null;this.#adjustImportedFigures(previous,replacement,replacementStats);if(replacement===null){this.#modules.delete(slotKey);this.#moduleStats.delete(slotKey);this.#primitiveModifiers.delete(slotKey)}else{this.#modules.set(slotKey,cloneLoadoutModule(replacement));if(replacementStats!==void 0)this.#moduleStats.set(slotKey,replacementStats);if(primitiveModifiers===void 0)this.#primitiveModifiers.delete(slotKey);else this.#primitiveModifiers.set(slotKey,primitiveModifiers)}this.#invalidate()}#adjustImportedFigures(previous,next,nextStats){const previousMass=this.#moduleMass(previous);const nextMass=this.#moduleMass(next,nextStats);if(this.#top.UnladenMass!==void 0){if(previousMass===null||nextMass===null)delete this.#top.UnladenMass;else this.#top.UnladenMass+=nextMass-previousMass}const previousCargo=this.#moduleCapacity(previous,"CargoCapacity","cargoCapacity");const nextCargo=this.#moduleCapacity(next,"CargoCapacity","cargoCapacity",nextStats);if(this.#top.CargoCapacity!==void 0){if(previousCargo===null||nextCargo===null)delete this.#top.CargoCapacity;else this.#top.CargoCapacity+=nextCargo-previousCargo}const previousFuel=this.#moduleCapacity(previous,"FuelCapacity","fuelCapacity");const nextFuel=this.#moduleCapacity(next,"FuelCapacity","fuelCapacity",nextStats);if(this.#top.FuelCapacity?.Main!==void 0){const reserve=this.#top.FuelCapacity.Reserve;if(previousFuel===null||nextFuel===null){if(reserve===void 0)delete this.#top.FuelCapacity;else this.#top.FuelCapacity={Reserve:reserve}}else{this.#top.FuelCapacity={Main:this.#top.FuelCapacity.Main+nextFuel-previousFuel,...reserve===void 0?{}:{Reserve:reserve}}}}if(normalizeKey(previous?.Item,FITTED_ITEM)===normalizeKey(next?.Item,FITTED_ITEM)){return}delete this.#top.ModulesValue;delete this.#top.Rebuy}#moduleMass(module,statsOverride){if(module===null)return 0;const modified=getLoadoutModifier(module,"Mass");if(modified!==null)return modified;const stats=statsOverride??this.#statsFor(module);if(stats?.mass!==void 0)return stats.mass;if(isBuiltInHullModule(module))return 0;return stats===null&&isNonOutfittingSlot(module.Slot)?0:null}#moduleCapacity(module,modifierLabel,field,statsOverride){if(module===null)return 0;const modified=getLoadoutModifier(module,modifierLabel);if(modified!==null)return modified;const stats=statsOverride??this.#statsFor(module);if(stats?.[field]!==void 0)return stats[field];const symbol=module.Item.toLowerCase();const isFuelTank=stats?.slot?stats.slot==="fuelTank":symbol.startsWith(FUEL_TANK_PREFIX);const shouldCarryCapacity=field==="cargoCapacity"?symbol.includes("cargorack"):isFuelTank;return shouldCarryCapacity?null:0}#resolveDrive(){let fsdModule;for(const m of this.#modules.values()){const stats=this.#statsFor(m);const isDrive=stats?.slot?stats.slot==="frameShiftDrive":m.Item.toLowerCase().startsWith(FSD_PREFIX);if(isDrive){fsdModule=m;break}}if(!fsdModule)return null;const base=this.#statsFor(fsdModule);if(!base||base.fuelMul===void 0||base.fuelPower===void 0){throw new TypeError(`ShipLoadout: no jump constants in the stats catalogue for frame shift drive "${truncate(fsdModule.Item)}"`)}const optMass=getLoadoutModifier(fsdModule,"FSDOptimalMass")??base.optMass;const maxFuel=getLoadoutModifier(fsdModule,"MaxFuelPerJump")??base.maxFuel;if(optMass===void 0||maxFuel===void 0){const missing=[...optMass===void 0?["optMass"]:[],...maxFuel===void 0?["maxFuel"]:[]];throw new TypeError(`ShipLoadout: frame shift drive "${truncate(fsdModule.Item)}" has no ${missing.join(" or ")} in the stats catalogue`)}return{optMass:optMass,maxFuel:maxFuel,fuelMul:base.fuelMul,fuelPower:base.fuelPower,jumpBoost:this.#resolveJumpBoost()}}#resolveJumpBoost(){for(const m of this.#modules.values()){const stats=this.#statsFor(m);if(stats?.engineeringGroup!=="fsdBoosters"&&!m.Item.toLowerCase().startsWith(BOOSTER_PREFIX)){continue}if(m.On===false)continue;if(stats?.jumpBoost===void 0){throw new TypeError(`ShipLoadout: FSD booster "${truncate(m.Item)}" has no jumpBoost in the stats catalogue`)}return stats.jumpBoost}return 0}#statsFor(module){if(module===null)return null;const stats=this.#moduleStats.get(module.Slot)??builtInModuleBySymbol(module.Item,FITTED_ITEM);if(stats)return stats;return isBuiltInHullModule(module)?builtInModuleBySymbol("ModularCargoBayDoor","ShipLoadout: built-in module"):null}};export{LoadoutEditError,ShipLoadout};//# sourceMappingURL=chunk-OLW6EIDX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ships/internal/loadout-metrics.ts","../src/ships/internal/loadout-views.ts","../src/ships/internal/loadout-fitting.ts","../src/ships/internal/loadout-export.ts","../src/ships/internal/loadout-import.ts","../src/ships/ship-loadout.ts"],"names":["weaponsCapacitorMetrics","shieldRecovery","cellBankSummary","shieldMetrics","getShipSlots","getShipBySymbol","getShipByName","parseSlef","toSlef","stringifySlef","getLoadoutModifier","parseSlotName","enumerateSlots","SLOT_RESTRICTION_LABELS","sourcePurchaseFromLoadout","getSourceModuleValue","powerBudget","isNonOutfittingSlot","isBuiltInHullModule","cloneLoadoutModule","identifyPreEngineeredVariant","cloneModuleStats","availableBlueprintsFor","availableExperimentalsFor","blueprintAvailableFor","blueprintRoutesFor","experimentalAvailableFor","primitiveEngineeringInputsFor","missingBaseLabels","journalModifiersFor","getPreEngineeredStats","unresolvedModifiers","getPreEngineeredJournalModifiers","getPreEngineeredModifiers","matchingKeyIn","FITTED_ITEM","isFinalGuardianWeaponEngineering","scaleDamageComponents","weaponMetrics","sumWeaponMetrics","combinedRateOfFire","builtInModuleBySymbol","getBulkheadsForShip","getPreEngineeredVariants","singleJumpRange","frameShiftDriveMassFactor","fuelPerJump","totalRange","completeResult","calculateUnladenMass","calculateCargoCapacity","calculateFuelCapacity","validateLoadout","fixedSlotReason","mobilityMetrics","calculateModuleLimits","ALL_MODULES","CORE_MODULES","getDefaultLoadout","distributorMetrics","getExperimentalEffect","heatMetrics","ammunitionCapacity","armourMetrics","baseStats","computeModifiers","labelsForDamageType","scaleForLabel","fieldForLabel","labelsForField","capabilityValueForLabel","damageTypeForLabel","resolveBlueprintForModule","getExperimentalsForModule","getBlueprintGrade","normalizeKey","truncate","describeValue","requireString","requireStringIfPresent","deepFreeze","PREFIX","powerPlant","thrusters","frameShiftDrive","powerDistributor","shieldGenerator","shieldCellBank","shieldBooster","shieldReinforcement","hullReinforcement","moduleReinforcement","startsWithAny","symbol","prefixes","some","prefix","toLowerCase","startsWith","isPowerDistributor","module","stats","slot","Item","isEnabled","On","priorityOf","Priority","effectiveStat","field","stated","statedModifier","base","label","modified","effectiveCapability","Engineering","Modifiers","modifier","Label","effectiveDamageDistribution","fromEffect","ExperimentalEffect","damageDistribution","distribution","resolved","Value","type","convertsDamage","modifierRatio","effective","relatedStat","ratio","effectiveModule","merged","fields","Set","Object","keys","add","key","capability","value","engineeringGroup","massRatio","minMass","maxMass","performanceRatio","minMultiplier","maxMultiplier","category","normalizeEffectiveWeapon","damageComponents","damage","powerConsumerFor","draw","parsedSlot","Slot","mounted","deployedOnly","alwaysPowered","kind","common","priority","enabled","inherentlyPassiveSlot","core","drawUnknown","powerAvailable","modules","statsFor","isPlant","mapResistanceFields","read","kineticResistance","thermalResistance","explosiveResistance","causticResistance","resistancesOf","shieldInputFor","shipSymbol","systemsPips","hull","generator","boosters","reinforcement","strengthRatio","optMass","Math","max","optMultiplier","push","shieldBoost","hullMass","baseShieldStrength","mobilityInputFor","mass","enginesPips","isThruster","optSpeedMultiplier","speedCurve","minSpeedMultiplier","maxSpeedMultiplier","optRotationMultiplier","rotationCurve","minRotationMultiplier","maxRotationMultiplier","minimumSpeed","maximumSpeed","boost","minPitch","pitch","minRoll","roll","minYaw","yaw","shieldRecoveryInputFor","distributor","generatorStats","distributorStats","strength","regenRate","brokenRegenRate","distributorDraw","systemsCapacity","systemsRecharge","weaponsCapacitorInputFor","weaponsPips","budget","weaponsCapacity","weaponsRecharge","sustainedEnergyPerSecond","poweredStates","deployed","weapon","weaponStatsFor","distributorInputFor","pips","retracted","enginesCapacity","enginesRecharge","heatInputFor","heatEfficiency","thrusterHeatRate","deployedThrusterHeatRate","fsdHeatRate","weapons","running","heat","heatPerSecond","sustainedHeatPerSecond","heatCapacity","heatDissipation","retractedPowerDraw","poweredDraw","deployedPowerDraw","unknownDraws","map","consumer","state","powered","bands","reduce","total","band","min","length","poweredRetracted","poweredDeployed","cellBankInputsFor","banks","ammunition","reinforcementRate","shieldBankReinforcement","cells","spinUp","shieldBankSpinUp","duration","shieldBankDuration","shieldBankHeat","available","stockBulkhead","variants","name","find","v","endsWith","armourInputFor","reinforcements","moduleReinforcements","bulkhead","hullBoost","moduleProtection","integrity","stock","baseArmour","WEAPON_FIELDS","projectileRange","burstAdjustedRateOfFire","touched","rate","rateOfFire","statedDamagePerSecond","firingFactor","Number","roundsPerShot","maximumRange","falloffRange","CORE_NAMES","lifeSupport","sensors","fuelTank","RESTRICTED_OPTIONAL_NAMES","military","cargo","limpetController","vesselHangar","passenger","trailingDigits","start","code","charCodeAt","slice","loadoutSlotName","match","exec","restriction","numbered","optional","size","MILITARY_PREFIXES","MINING_PREFIXES","CARGO_PREFIXES","RESTRICTED_SLOT_PREFIXES","mining","planetaryApproachSuite","problem","constraint","message","params","restrictionProblem","moduleSlotProblem","required","restrictedToSlot","moduleFitProblem","ship","armourHull","armourShipName","armourShipSymbol","shipName","restricted","restrictedToShips","allowedShipNames","labels","index","join","allowedShipSymbols","wrongMount","moduleSlot","requiredCore","isFuelTank","class","moduleClass","slotSize","moduleFitError","REBUY_FRACTION","exportLoadoutEvent","input","options","fromSource","credits","source","sourcePurchase","totals","sourceTotalsHold","hullValue","retailHullValue","modulesValue","computedModulesValue","rebuy","trunc","event","Ship","ShipName","shipIdent","ShipIdent","HullValue","ModulesValue","unladenMass","UnladenMass","cargoCapacity","CargoCapacity","maxJumpRange","MaxJumpRange","fuelCapacity","FuelCapacity","Main","main","Reserve","reserve","Rebuy","Modules","exportModules","ordered","moduleOrder","slotOrderedModules","layout","values","on","explicitPower","sourceModuleValue","moduleValue","Health","TypeError","remaining","Map","get","delete","sum","cost","SOURCE_ITEM","entry","item","moduleValues","fitted","captureLoadoutEvent","Array","isArray","captureEach","captureModule","capture","captured","health","engineering","captureEngineering","experimental","experimentalLocalised","ExperimentalEffect_Localised","modifiers","BlueprintName","Level","Quality","normalizeLoadoutEvent","rawEvent","slots","entries","normalizedSlot","has","set","top","moduleStats","variant","variantStats","engineeringLocked","normalizedBlueprint","normalizedExperimental","exact","candidate","blueprint","grade","SLOT_KEY","requireLoadOptions","scope","isFinite","RangeError","LoadoutEditError","constructor","super","this","fromEntries","FSD_PREFIX","BOOSTER_PREFIX","FUEL_TANK_PREFIX","ShipLoadout","_ShipLoadout","primitiveModifiers","version","viewVersion","layoutCache","calculationCache","validationCache","fittedModuleCache","slotCache","fromSlef","fromLoadout","data","imported","empty","requested","loadout","unladenMassResult","computedUnladenMass","calculationModules","fuelCapacityResult","cap","freeze","computed","computedFuelCapacity","cargoCapacityResult","computedCargoCapacity","reserveFuelCapacity","validation","cached","layoutOrNull","byKey","builtIn","fitProblem","known","requiresKnownSlot","fitError","fitConstraint","fitParams","exclusionGroup","limitGroup","limitIncrease","existing","filter","currentLimits","moduleLimits","moduleStatsAt","fixedReason","immovableReason","moduleLimitRegression","fittedModuleAt","removable","slotKey","fittedModuleFor","raw","moduleForEffectiveStats","effectiveStats","preEngineeredVariant","fittedModules","flatMap","availableBlueprints","availableExperimentalEffects","modulesForSlot","requireSlot","occupied","group","currentStats","setModule","conflict","previousSlot","previousSymbol","limitProblem","count","limit","fittedKey","replaceModule","removeModule","wanted","parsed","applyBlueprint","fdname","wantedGrade","wantedQuality","quality","wantedExperimental","fittedStats","recipe","named","written","trim","acquisition","isInteger","offered","route","engineeringBaseStats","canonical","missing","features","damageModifier","OriginalValue","setPreEngineeredVariant","unresolved","clearEngineering","bare","setModuleEnabled","patchModule","setModulePriority","patch","toLoadoutEvent","fuel","exportableJumpRange","hullCost","header","toSlefString","indent","drive","resolveDrive","tank","maxFuel","maxJumpFuel","fsd","requireFuelCapacity","requireMass","jumpRange","ladenJumpRange","requireCargoCapacity","distance","jumpRangeSummary","unladen","laden","totalMax","totalUnladen","totalLaden","consumers","modulesForEffectiveStats","cellBanks","order","sort","left","right","MAX_SAFE_INTEGER","retailCredits","unpriced","mercCoinCost","record","metrics","invalidate","s","require","result","what","issues","i","resolveCalculationModules","unresolvedOutfitting","isCargoRack","includes","mayCarryCapacity","mayCarryFuel","moduleMass","moduleCapacity","replacement","current","previous","usage","increase","amount","baseLimit","excess","replacementStats","adjustImportedFigures","next","nextStats","previousMass","nextMass","previousCargo","nextCargo","previousFuel","nextFuel","statsOverride","modifierLabel","shouldC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apons capacitor, `0`–`4`. Defaults to `4`. */
|
|
328
328
|
readonly weaponsPips?: number;
|
|
329
329
|
}
|
|
330
|
-
/**
|
|
330
|
+
/**
|
|
331
|
+
* Retail catalogue credits for an assembled build.
|
|
332
|
+
*
|
|
333
|
+
* @see {@link ShipLoadout.mercCoinCost} for Mercenary purchase prices.
|
|
334
|
+
*/
|
|
331
335
|
interface RetailCredits {
|
|
332
336
|
/** Bare hull list price in credits, or `null` for an unknown hull. */
|
|
333
337
|
readonly hull: number | null;
|
|
@@ -398,9 +402,10 @@ interface AvailableBlueprint {
|
|
|
398
402
|
* or `'mercenary'` for a bespoke recipe attached to a Mercenary purchase.
|
|
399
403
|
*
|
|
400
404
|
* @remarks
|
|
401
|
-
* A Mercenary article shares its module symbol with the stock article
|
|
402
|
-
*
|
|
403
|
-
*
|
|
405
|
+
* A Mercenary article shares its module symbol with the stock article. Its bespoke
|
|
406
|
+
* blueprint is nevertheless available only through that purchase, so a fitted module
|
|
407
|
+
* carrying the blueprint identifies the article even after a later grade upgrade.
|
|
408
|
+
* `'mercenary'` means the recipe requires that purchase route.
|
|
404
409
|
*/
|
|
405
410
|
readonly route: 'ordinary' | 'mercenary';
|
|
406
411
|
}
|
|
@@ -551,11 +556,14 @@ declare class ShipLoadout {
|
|
|
551
556
|
* Capture/instance state (`timestamp`, `ShipID`, `HullHealth`, `Hot`) and engineering
|
|
552
557
|
* provenance (`Engineer`, `EngineerID`, `BlueprintID`) are deliberately excluded
|
|
553
558
|
* from the durable build. See {@link LoadoutEvent} and {@link ModuleEngineering}.
|
|
554
|
-
* A
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
+
* A reward module is identified when its reported stat signature uniquely matches a
|
|
560
|
+
* catalogue variant. That reward's complete fixed stat block is then used as the fitted
|
|
561
|
+
* record, including values the capture omits; a separately applied experimental effect
|
|
562
|
+
* is included when matching and remains authoritative in the captured modifiers. A
|
|
563
|
+
* Mercenary module is instead identified by the bespoke blueprint available only to its
|
|
564
|
+
* purchase, including after a later grade upgrade. Its unpublished purchase modifiers
|
|
565
|
+
* are not inferred; the capture's current engineering remains authoritative.
|
|
566
|
+
* Under-specified or ambiguous evidence stays unidentified.
|
|
559
567
|
* An ordinary weapon recipe on a Guardian weapon identifies a final pre-engineered
|
|
560
568
|
* article; the import preserves that identity, uses the catalogue's complete hand-set
|
|
561
569
|
* stat block when the exact article is known, exposes no engineering options for it,
|
|
@@ -794,8 +802,9 @@ declare class ShipLoadout {
|
|
|
794
802
|
* @param slotKey - Slot key, matched case-insensitively.
|
|
795
803
|
* @returns Frozen blueprint descriptors: the ordinary engineering menu first, then
|
|
796
804
|
* bespoke Mercenary upgrade recipes. An `'ordinary'` candidate is available to the
|
|
797
|
-
* stock module; a `'mercenary'` candidate
|
|
798
|
-
*
|
|
805
|
+
* stock module; a `'mercenary'` candidate is purchase-specific. Applying that bespoke
|
|
806
|
+
* blueprint identifies the matching Mercenary article even though its bare module
|
|
807
|
+
* symbol does not.
|
|
799
808
|
* Returns an empty array when the slot is empty, unresolved or final, or the module
|
|
800
809
|
* symbol has neither route.
|
|
801
810
|
* @throws {TypeError} If `slotKey` is not a string.
|
|
@@ -1004,6 +1013,9 @@ declare class ShipLoadout {
|
|
|
1004
1013
|
* @returns `this`, for chaining. A no-op if the slot is empty or unmodified.
|
|
1005
1014
|
* @throws {TypeError} If `slotKey` is not a string, or the fitted article is final
|
|
1006
1015
|
* pre-engineered and its baked engineering cannot be removed.
|
|
1016
|
+
* @remarks
|
|
1017
|
+
* Clearing a Mercenary article removes its purchase-exclusive blueprint identity.
|
|
1018
|
+
* Its {@link FittedModule.preEngineeredVariant} then reads `null`.
|
|
1007
1019
|
*/
|
|
1008
1020
|
clearEngineering(slotKey: string): this;
|
|
1009
1021
|
/**
|
|
@@ -1368,8 +1380,32 @@ declare class ShipLoadout {
|
|
|
1368
1380
|
*
|
|
1369
1381
|
* ShipLoadout.default('Anaconda').retailCredits().hull; // -> 142456440
|
|
1370
1382
|
* ```
|
|
1383
|
+
* @see {@link mercCoinCost} for Mercenary purchase prices.
|
|
1371
1384
|
*/
|
|
1372
1385
|
retailCredits(): RetailCredits;
|
|
1386
|
+
/**
|
|
1387
|
+
* Total the Merc Coin prices of the Mercenary articles fitted to this build.
|
|
1388
|
+
*
|
|
1389
|
+
* @returns The total in Merc Coin, or `0` when no fitted article is a Mercenary
|
|
1390
|
+
* purchase. Credit prices and rebuy remain available from {@link retailCredits}.
|
|
1391
|
+
* @remarks
|
|
1392
|
+
* The total counts both articles fitted through {@link setPreEngineeredVariant} and
|
|
1393
|
+
* purchases implied by applying their Mercenary-only blueprint through
|
|
1394
|
+
* {@link applyBlueprint}. The blueprint identifies the purchase at grade 1 and after
|
|
1395
|
+
* later upgrades; the current grade does not change the original shop price.
|
|
1396
|
+
* @example
|
|
1397
|
+
* ```ts
|
|
1398
|
+
* import { getPreEngineeredVariants } from '@elite-dangerous-almanac/core/ships/pre-engineered';
|
|
1399
|
+
* import { ShipLoadout } from '@elite-dangerous-almanac/core/ships/ship-loadout';
|
|
1400
|
+
*
|
|
1401
|
+
* const variant = getPreEngineeredVariants('Hpt_Railgun_Fixed_Medium')
|
|
1402
|
+
* .find((candidate) => candidate.acquisition === 'mercenary')!;
|
|
1403
|
+
* const build = ShipLoadout.default('Python')
|
|
1404
|
+
* .setPreEngineeredVariant('MediumHardpoint1', variant);
|
|
1405
|
+
* build.mercCoinCost(); // -> 950
|
|
1406
|
+
* ```
|
|
1407
|
+
*/
|
|
1408
|
+
mercCoinCost(): number;
|
|
1373
1409
|
/**
|
|
1374
1410
|
* The build's armour: hull hit points, the bulkhead and reinforcement each
|
|
1375
1411
|
* contribute, and the effective resistances.
|
package/dist/ships/index.d.ts
CHANGED
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
* modules and apply engineering, and
|
|
13
13
|
* answers the questions apps actually ask ({@link ShipLoadout.maxJumpRange},
|
|
14
14
|
* {@link ShipLoadout.powerBudget}, {@link ShipLoadout.shieldMetrics}, `unladenMass`,
|
|
15
|
-
* `rebuy
|
|
16
|
-
* at retail ({@link ShipLoadout.sourcePurchase}, a
|
|
15
|
+
* `rebuy`, {@link ShipLoadout.mercCoinCost}) — and keeps what a capture said it *paid*
|
|
16
|
+
* apart from what the build is worth at retail ({@link ShipLoadout.sourcePurchase}, a
|
|
17
|
+
* {@link SourcePurchaseRecord}). It is
|
|
17
18
|
* the batteries-included facade and pulls in every catalogue;
|
|
18
19
|
* everything below is what it is built from, so drop to the pieces when you
|
|
19
20
|
* need one answer rather than a whole ship.
|
|
@@ -193,7 +194,7 @@ export { ModuleLimitEntry, ModuleLimitUsage, SHIP_MODULE_LIMITS, calculateModule
|
|
|
193
194
|
export { FrameShiftDriveJumpStats, MassCurveStats, PowerDistributorStats, PowerGenerationStats, ShieldRegenerationStats, WeaponDamageStats, hasFrameShiftDriveJumpStats, hasMassCurveStats, hasPowerDistributorStats, hasPowerGenerationStats, hasShieldRegenerationStats, hasWeaponDamageStats } from './module-capabilities.js';
|
|
194
195
|
export { BlueprintModuleEngineering, EngineeringModifier, LoadoutEvent, LoadoutModule, ModuleEngineering, Slef, SlefConstraint, SlefDiagnostic, SlefDiagnosticCode, SlefEntry, SlefHeader, SlefInspection, SlefStringifyOptions, getLoadoutModifier, inspectSlef, parseSlef, stringifySlef, toSlef } from './slef.js';
|
|
195
196
|
export { FrameShiftDriveParams, TotalRangeDetails, frameShiftDriveMassFactor, fuelPerJump, singleJumpRange, totalRange } from './jump-range.js';
|
|
196
|
-
export { A as ApplyBlueprintOptions, a as AvailableBlueprint, B as BuildWeaponMetrics, D as DefenceOptions, b as DistributorOptions, F as FittedModule, c as FittedWeaponMetrics, I as ImmovableReason, J as JumpOptions, d as JumpRangeSummary, L as LoadoutEditError, e as LoadoutEditErrorCode, f as LoadoutExportOptions, g as LoadoutSlot, M as MobilityOptions, R as RetailCredits, S as ShipLoadout, h as SlefExportOptions, W as WeaponsOptions } from '../ship-loadout-
|
|
197
|
+
export { A as ApplyBlueprintOptions, a as AvailableBlueprint, B as BuildWeaponMetrics, D as DefenceOptions, b as DistributorOptions, F as FittedModule, c as FittedWeaponMetrics, I as ImmovableReason, J as JumpOptions, d as JumpRangeSummary, L as LoadoutEditError, e as LoadoutEditErrorCode, f as LoadoutExportOptions, g as LoadoutSlot, M as MobilityOptions, R as RetailCredits, S as ShipLoadout, h as SlefExportOptions, W as WeaponsOptions } from '../ship-loadout-CIqzqUOH.js';
|
|
197
198
|
export { CalculationIssue, CalculationResult, FuelCapacity, LoadoutCalculationModule, calculateCargoCapacity, calculateFuelCapacity, calculateUnladenMass } from './loadout-calculations.js';
|
|
198
199
|
export { LoadoutIssue, LoadoutIssueCode, LoadoutIssueParam, LoadoutIssueParams, LoadoutValidation, LoadoutValidationInput, ModuleFitConstraint, ValidationModule, validateLoadout } from './loadout-validation.js';
|
|
199
200
|
export { SourceModuleValue, SourcePurchaseRecord, getSourceModuleValue, sourcePurchaseFromLoadout, sumSourceModuleValues } from './source-purchase.js';
|
package/dist/ships/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{LoadoutEditError,ShipLoadout}from"../chunk-
|
|
1
|
+
export{LoadoutEditError,ShipLoadout}from"../chunk-OLW6EIDX.js";export{weaponsCapacitorMetrics}from"../chunk-FMPRCYKY.js";export{cellBankSummary,shieldRecovery}from"../chunk-VZZUNSDF.js";export{shieldMassCurveMultiplier,shieldMetrics,shieldStrength}from"../chunk-2FHHMYDC.js";export{SHIPS,getShipByName,getShipBySymbol,getShipSlots}from"../chunk-IJRKEODR.js";export{getLoadoutModifier,inspectSlef,parseSlef,stringifySlef,toSlef}from"../chunk-RKLJ7EEE.js";export{SLOT_RESTRICTION_LABELS,enumerateSlots,parseSlotName}from"../chunk-I7PIDRMU.js";export{getSourceModuleValue,sourcePurchaseFromLoadout,sumSourceModuleValues}from"../chunk-QTDBO7R2.js";export{powerBudget}from"../chunk-76XKY2Y2.js";export{getPreEngineeredJournalModifiers,getPreEngineeredModifiers,getPreEngineeredStats,identifyPreEngineeredVariant,unresolvedModifiers}from"../chunk-LRC7UW7S.js";export{armourPiercingFactor,combinedRateOfFire,damageFalloff,damagePerSecond,energyPerSecond,heatPerSecond,splitDamage,sumWeaponMetrics,sustainedDamagePerSecond,sustainedFireFactor,weaponMetrics}from"../chunk-LJI7VXJD.js";export{getBulkheadsForShip,getModuleBySymbol,getModulesByName}from"../chunk-MNXWK7PA.js";export{PRE_ENGINEERED_MODULES,getPreEngineeredVariants,isPreEngineered}from"../chunk-32PVERNH.js";export{frameShiftDriveMassFactor,fuelPerJump,singleJumpRange,totalRange}from"../chunk-GQ5GX5TB.js";export{calculateCargoCapacity,calculateFuelCapacity,calculateUnladenMass}from"../chunk-RF2IKLWQ.js";export{validateLoadout}from"../chunk-BM7JQ5CH.js";export{mobilityMetrics,thrusterMassCurveMultiplier}from"../chunk-24INI4U7.js";export{hasFrameShiftDriveJumpStats,hasMassCurveStats,hasPowerDistributorStats,hasPowerGenerationStats,hasShieldRegenerationStats,hasWeaponDamageStats}from"../chunk-JTQVWIGL.js";export{SHIP_MODULE_LIMITS,calculateModuleLimits}from"../chunk-KPETDYQX.js"; export{distributorMetrics}from"../chunk-P2QOL63K.js"; export{EXPERIMENTAL_EFFECTS,getExperimentalEffect}from"../chunk-PMJG7PHU.js";export{SHIP_GUNSIGHTS,getShipGunsight,projectGunsight}from"../chunk-ZAHNOQGG.js";export{OVERHEAT_HEAT_LEVEL,effectiveWeaponThermalLoad,equilibriumHeatLevel,heatLevelAtTime,heatMetrics,secondsToHeatLevel}from"../chunk-QMQHIZGS.js";export{ammunitionCapacity}from"../chunk-AA3K5XUE.js";export{armourMetrics}from"../chunk-FGXWVFN6.js";export{effectiveHitPoints,mapDamageTypes,stackArmourResistance,stackShieldResistance,systemsResistance}from"../chunk-ZNCXENNB.js";export{computeModifiers,rollsForGrade,sumMaterials}from"../chunk-SVZARHWP.js";export{resolveBlueprintForModule}from"../chunk-ZJB5UYNE.js";export{ENGINEERING_OPTION_GROUPS,getBlueprintsForModule,getEngineeringGroup,getExperimentalsForBlueprint,getExperimentalsForModule}from"../chunk-TH4S5MVD.js";export{BLUEPRINTS,getBlueprint,getBlueprintGrade}from"../chunk-DNTN34M4.js"; //# sourceMappingURL=index.js.map
|
|
@@ -19,8 +19,9 @@ import './slots.js';
|
|
|
19
19
|
* gzipped). Consumers that only list variants can import `./pre-engineered.js` without
|
|
20
20
|
* these module catalogues.
|
|
21
21
|
* A journal or SLEF module can instead be classified with
|
|
22
|
-
* {@link identifyPreEngineeredVariant}: it matches
|
|
23
|
-
* and composes an experimental effect added after purchase before comparing values.
|
|
22
|
+
* {@link identifyPreEngineeredVariant}: it matches a reward article's reported stat signature
|
|
23
|
+
* and composes an experimental effect added after purchase before comparing values. A Mercenary
|
|
24
|
+
* article is identified by its Mercenary-only blueprint, including after later grade upgrades.
|
|
24
25
|
*
|
|
25
26
|
* **What is resolved, and what is not.** The module catalogues carry the mechanical
|
|
26
27
|
* stats (mass, integrity, power, capacities, optimal mass), defence stats and weapon
|
|
@@ -83,17 +84,24 @@ declare function getPreEngineeredJournalModifiers(variant: PreEngineeredVariant)
|
|
|
83
84
|
/**
|
|
84
85
|
* Identify the fixed pre-engineered/reward variant described by a fitted loadout module.
|
|
85
86
|
*
|
|
86
|
-
*
|
|
87
|
+
* Reward matching uses the reported post-engineering stat values rather than trusting the
|
|
87
88
|
* blueprint tuple alone: reward variants carry hand-set values that an ordinary roll of
|
|
88
89
|
* the named blueprint does not reproduce. A captured experimental effect is composed
|
|
89
90
|
* with each candidate before comparison, because some fixed articles accept an effect
|
|
90
91
|
* after purchase (the V1 frame-shift drives are the common example).
|
|
91
92
|
*
|
|
93
|
+
* Mercenary articles are the exception: their bespoke blueprint is available only after
|
|
94
|
+
* buying the article, while their unpublished purchase modifier block cannot identify it.
|
|
95
|
+
* The module symbol and blueprint therefore identify the purchase at grade 1 and after
|
|
96
|
+
* upgrading it through grades 2–5. The fitted grade and experimental effect remain the
|
|
97
|
+
* loadout's current engineering state; the returned variant carries the original purchase
|
|
98
|
+
* grade and Merc Coin price.
|
|
99
|
+
*
|
|
92
100
|
* Frontier journals and captures may omit a derived modifier, so one predicted value may
|
|
93
101
|
* be absent. Every stated predicted value must agree within journal float noise, and all
|
|
94
102
|
* but at most one must be present. Ambiguous or incomplete evidence returns `null` rather
|
|
95
103
|
* than guessing.
|
|
96
|
-
*
|
|
104
|
+
* Other variants without a published stat block cannot be identified.
|
|
97
105
|
*
|
|
98
106
|
* @param module - A module from a journal `Loadout` event or SLEF export.
|
|
99
107
|
* @returns The uniquely matching catalogue variant, or `null` when the stats do not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getPreEngineeredJournalModifiers,getPreEngineeredModifiers,getPreEngineeredStats,identifyPreEngineeredVariant,unresolvedModifiers}from"../chunk-
|
|
1
|
+
export{getPreEngineeredJournalModifiers,getPreEngineeredModifiers,getPreEngineeredStats,identifyPreEngineeredVariant,unresolvedModifiers}from"../chunk-LRC7UW7S.js"; //# sourceMappingURL=pre-engineered-stats.js.map
|
|
@@ -13,7 +13,7 @@ import './distributor.js';
|
|
|
13
13
|
import './mobility.js';
|
|
14
14
|
import './shield-recovery.js';
|
|
15
15
|
import './pre-engineered.js';
|
|
16
|
-
export { A as ApplyBlueprintOptions, a as AvailableBlueprint, B as BuildWeaponMetrics, D as DefenceOptions, b as DistributorOptions, c as FittedWeaponMetrics, I as ImmovableReason, J as JumpOptions, d as JumpRangeSummary, L as LoadoutEditError, e as LoadoutEditErrorCode, f as LoadoutExportOptions, g as LoadoutSlot, M as MobilityOptions, R as RetailCredits, S as ShipLoadout, h as SlefExportOptions, W as WeaponsOptions } from '../ship-loadout-
|
|
16
|
+
export { A as ApplyBlueprintOptions, a as AvailableBlueprint, B as BuildWeaponMetrics, D as DefenceOptions, b as DistributorOptions, c as FittedWeaponMetrics, I as ImmovableReason, J as JumpOptions, d as JumpRangeSummary, L as LoadoutEditError, e as LoadoutEditErrorCode, f as LoadoutExportOptions, g as LoadoutSlot, M as MobilityOptions, R as RetailCredits, S as ShipLoadout, h as SlefExportOptions, W as WeaponsOptions } from '../ship-loadout-CIqzqUOH.js';
|
|
17
17
|
import './source-purchase.js';
|
|
18
18
|
import './loadout-calculations.js';
|
|
19
19
|
import './loadout-validation.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{LoadoutEditError,ShipLoadout}from"../chunk-
|
|
1
|
+
export{LoadoutEditError,ShipLoadout}from"../chunk-OLW6EIDX.js"; //# sourceMappingURL=ship-loadout.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elite-dangerous-almanac/core",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.12",
|
|
4
4
|
"description": "Elite Dangerous static data and calculations: astronomy, ships and outfitting, personal equipment and engineering, materials, and market commodities.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ships/internal/loadout-metrics.ts","../src/ships/internal/loadout-views.ts","../src/ships/internal/loadout-fitting.ts","../src/ships/internal/loadout-export.ts","../src/ships/internal/loadout-import.ts","../src/ships/ship-loadout.ts"],"names":["weaponsCapacitorMetrics","shieldRecovery","cellBankSummary","shieldMetrics","getShipSlots","getShipBySymbol","getShipByName","parseSlef","toSlef","stringifySlef","getLoadoutModifier","parseSlotName","enumerateSlots","SLOT_RESTRICTION_LABELS","sourcePurchaseFromLoadout","getSourceModuleValue","powerBudget","isNonOutfittingSlot","isBuiltInHullModule","cloneLoadoutModule","identifyPreEngineeredVariant","cloneModuleStats","availableBlueprintsFor","availableExperimentalsFor","blueprintAvailableFor","blueprintRoutesFor","experimentalAvailableFor","primitiveEngineeringInputsFor","missingBaseLabels","journalModifiersFor","getPreEngineeredStats","unresolvedModifiers","getPreEngineeredJournalModifiers","getPreEngineeredModifiers","matchingKeyIn","FITTED_ITEM","isFinalGuardianWeaponEngineering","scaleDamageComponents","weaponMetrics","sumWeaponMetrics","combinedRateOfFire","builtInModuleBySymbol","getBulkheadsForShip","getPreEngineeredVariants","singleJumpRange","frameShiftDriveMassFactor","fuelPerJump","totalRange","completeResult","calculateUnladenMass","calculateCargoCapacity","calculateFuelCapacity","validateLoadout","fixedSlotReason","mobilityMetrics","calculateModuleLimits","ALL_MODULES","CORE_MODULES","getDefaultLoadout","distributorMetrics","getExperimentalEffect","heatMetrics","ammunitionCapacity","armourMetrics","baseStats","computeModifiers","labelsForDamageType","scaleForLabel","fieldForLabel","labelsForField","capabilityValueForLabel","damageTypeForLabel","resolveBlueprintForModule","getExperimentalsForModule","getBlueprintGrade","normalizeKey","truncate","describeValue","requireString","requireStringIfPresent","deepFreeze","PREFIX","powerPlant","thrusters","frameShiftDrive","powerDistributor","shieldGenerator","shieldCellBank","shieldBooster","shieldReinforcement","hullReinforcement","moduleReinforcement","startsWithAny","symbol","prefixes","some","prefix","toLowerCase","startsWith","isPowerDistributor","module","stats","slot","Item","isEnabled","On","priorityOf","Priority","effectiveStat","field","stated","statedModifier","base","label","modified","effectiveCapability","Engineering","Modifiers","modifier","Label","effectiveDamageDistribution","fromEffect","ExperimentalEffect","damageDistribution","distribution","resolved","Value","type","convertsDamage","modifierRatio","effective","relatedStat","ratio","effectiveModule","merged","fields","Set","Object","keys","add","key","capability","value","engineeringGroup","massRatio","minMass","maxMass","performanceRatio","minMultiplier","maxMultiplier","category","normalizeEffectiveWeapon","damageComponents","damage","powerConsumerFor","draw","parsedSlot","Slot","mounted","deployedOnly","alwaysPowered","kind","common","priority","enabled","inherentlyPassiveSlot","core","drawUnknown","powerAvailable","modules","statsFor","isPlant","mapResistanceFields","read","kineticResistance","thermalResistance","explosiveResistance","causticResistance","resistancesOf","shieldInputFor","shipSymbol","systemsPips","hull","generator","boosters","reinforcement","strengthRatio","optMass","Math","max","optMultiplier","push","shieldBoost","hullMass","baseShieldStrength","mobilityInputFor","mass","enginesPips","isThruster","optSpeedMultiplier","speedCurve","minSpeedMultiplier","maxSpeedMultiplier","optRotationMultiplier","rotationCurve","minRotationMultiplier","maxRotationMultiplier","minimumSpeed","maximumSpeed","boost","minPitch","pitch","minRoll","roll","minYaw","yaw","shieldRecoveryInputFor","distributor","generatorStats","distributorStats","strength","regenRate","brokenRegenRate","distributorDraw","systemsCapacity","systemsRecharge","weaponsCapacitorInputFor","weaponsPips","budget","weaponsCapacity","weaponsRecharge","sustainedEnergyPerSecond","poweredStates","deployed","weapon","weaponStatsFor","distributorInputFor","pips","retracted","enginesCapacity","enginesRecharge","heatInputFor","heatEfficiency","thrusterHeatRate","deployedThrusterHeatRate","fsdHeatRate","weapons","running","heat","heatPerSecond","sustainedHeatPerSecond","heatCapacity","heatDissipation","retractedPowerDraw","poweredDraw","deployedPowerDraw","unknownDraws","map","consumer","state","powered","bands","reduce","total","band","min","length","poweredRetracted","poweredDeployed","cellBankInputsFor","banks","ammunition","reinforcementRate","shieldBankReinforcement","cells","spinUp","shieldBankSpinUp","duration","shieldBankDuration","shieldBankHeat","available","stockBulkhead","variants","name","find","v","endsWith","armourInputFor","reinforcements","moduleReinforcements","bulkhead","hullBoost","moduleProtection","integrity","stock","baseArmour","WEAPON_FIELDS","projectileRange","burstAdjustedRateOfFire","touched","rate","rateOfFire","statedDamagePerSecond","firingFactor","Number","roundsPerShot","maximumRange","falloffRange","CORE_NAMES","lifeSupport","sensors","fuelTank","RESTRICTED_OPTIONAL_NAMES","military","cargo","limpetController","vesselHangar","passenger","trailingDigits","start","code","charCodeAt","slice","loadoutSlotName","match","exec","restriction","numbered","optional","size","MILITARY_PREFIXES","MINING_PREFIXES","CARGO_PREFIXES","RESTRICTED_SLOT_PREFIXES","mining","planetaryApproachSuite","problem","constraint","message","params","restrictionProblem","moduleSlotProblem","required","restrictedToSlot","moduleFitProblem","ship","armourHull","armourShipName","armourShipSymbol","shipName","restricted","restrictedToShips","allowedShipNames","labels","index","join","allowedShipSymbols","wrongMount","moduleSlot","requiredCore","isFuelTank","class","moduleClass","slotSize","moduleFitError","REBUY_FRACTION","exportLoadoutEvent","input","options","fromSource","credits","source","sourcePurchase","totals","sourceTotalsHold","hullValue","retailHullValue","modulesValue","computedModulesValue","rebuy","trunc","event","Ship","ShipName","shipIdent","ShipIdent","HullValue","ModulesValue","unladenMass","UnladenMass","cargoCapacity","CargoCapacity","maxJumpRange","MaxJumpRange","fuelCapacity","FuelCapacity","Main","main","Reserve","reserve","Rebuy","Modules","exportModules","ordered","moduleOrder","slotOrderedModules","layout","values","on","explicitPower","sourceModuleValue","moduleValue","Health","TypeError","remaining","Map","get","delete","sum","cost","SOURCE_ITEM","entry","item","moduleValues","fitted","captureLoadoutEvent","Array","isArray","captureEach","captureModule","capture","captured","health","engineering","captureEngineering","experimental","experimentalLocalised","ExperimentalEffect_Localised","modifiers","BlueprintName","Level","Quality","normalizeLoadoutEvent","rawEvent","slots","entries","normalizedSlot","has","set","top","moduleStats","variant","variantStats","engineeringLocked","normalizedBlueprint","normalizedExperimental","exact","candidate","blueprint","grade","SLOT_KEY","requireLoadOptions","scope","isFinite","RangeError","LoadoutEditError","constructor","super","this","fromEntries","FSD_PREFIX","BOOSTER_PREFIX","FUEL_TANK_PREFIX","ShipLoadout","_ShipLoadout","primitiveModifiers","version","viewVersion","layoutCache","calculationCache","validationCache","fittedModuleCache","slotCache","fromSlef","fromLoadout","data","imported","empty","requested","loadout","unladenMassResult","computedUnladenMass","calculationModules","fuelCapacityResult","cap","freeze","computed","computedFuelCapacity","cargoCapacityResult","computedCargoCapacity","reserveFuelCapacity","validation","cached","layoutOrNull","byKey","builtIn","fitProblem","known","requiresKnownSlot","fitError","fitConstraint","fitParams","exclusionGroup","limitGroup","limitIncrease","existing","filter","currentLimits","moduleLimits","moduleStatsAt","fixedReason","immovableReason","moduleLimitRegression","fittedModuleAt","removable","slotKey","fittedModuleFor","raw","moduleForEffectiveStats","effectiveStats","preEngineeredVariant","fittedModules","flatMap","availableBlueprints","availableExperimentalEffects","modulesForSlot","requireSlot","occupied","group","currentStats","setModule","conflict","previousSlot","previousSymbol","limitProblem","count","limit","fittedKey","replaceModule","removeModule","wanted","parsed","applyBlueprint","fdname","wantedGrade","wantedQuality","quality","wantedExperimental","fittedStats","recipe","named","written","trim","acquisition","isInteger","offered","route","engineeringBaseStats","canonical","missing","features","damageModifier","OriginalValue","setPreEngineeredVariant","unresolved","clearEngineering","bare","setModuleEnabled","patchModule","setModulePriority","patch","toLoadoutEvent","fuel","exportableJumpRange","hullCost","header","toSlefString","indent","drive","resolveDrive","tank","maxFuel","maxJumpFuel","fsd","requireFuelCapacity","requireMass","jumpRange","ladenJumpRange","requireCargoCapacity","distance","jumpRangeSummary","unladen","laden","totalMax","totalUnladen","totalLaden","consumers","modulesForEffectiveStats","cellBanks","order","sort","left","right","MAX_SAFE_INTEGER","retailCredits","unpriced","record","metrics","invalidate","s","require","result","what","issues","i","resolveCalculationModules","unresolvedOutfitting","isCargoRack","includes","mayCarryCapacity","mayCarryFuel","moduleMass","moduleCapacity","replacement","current","previous","usage","increase","amount","baseLimit","excess","replacementStats","adjustImportedFigures","next","nextStats","previousMass","nextMass","previousCargo","nextCargo","previousFuel","nextFuel","statsOverride","modifierLabel","shouldCarryCapacity","fsdModule","m","isDrive","fuelMul","fuelPower","jumpBoost","resolveJumpBoost"],"mappings":"O,8+EAkEA,IAAMiF,OAAS,CACXC,WAAY,CAAC,iBAAkB,0BAC/BC,UAAW,CAAC,aAAc,6BAC1BC,gBAAiB,CAAC,kBAClBC,iBAAkB,CAAC,uBAAwB,gCAC3CC,gBAAiB,CAAC,uBAClBC,eAAgB,CAAC,sBACjBC,cAAe,CAAC,qBAChBC,oBAAqB,CAAC,mCACtBC,kBAAmB,CACf,wBACA,gCACA,kCAEJC,oBAAqB,CAAC,0BAA2B,oCAGrD,IAAMC,cAAgB,CAACC,OAAgBC,WACnCA,SAASC,KAAMC,QAAWH,OAAOI,cAAcC,WAAWF,SAG9D,SAASG,mBAAmB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AUqe,GAC7B,GACI1iB,OAAO0C,mBAAqB,gBAC3BggB,EAAExiB,KAAKN,cAAcC,WAAWqX,gBACnC,CACE,QACJ,CACA,GAAIwL,EAAEtiB,KAAO,MAAO,SACpB,GAAIJ,OAAO8iB,iBAAc,EAAW,CAChC,MAAM,IAAItP,UACN,6BAA6BjV,SAASmkB,EAAExiB,iDAEhD,CACA,OAAOF,MAAM8iB,SACjB,CACA,OAAO,CACX,CAGA,SAAAze,CAAUtE,QACN,GAAIA,SAAW,KAAM,OAAO,KAC5B,MAAMC,MACF+W,MAAKlB,YAAalC,IAAI5T,OAAOyD,OAASpH,sBAAsB2D,OAAOG,KAAMpE,aAC7E,GAAIkE,MAAO,OAAOA,MAIlB,OAAOnF,oBAAoBkF,QACrB3D,sBAAsB,sBAAuB,gCAC7C,IACV,UACJwa,iBAAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/ships/internal/damage-components.ts","../src/ships/internal/fixed-modifier-features.ts","../src/ships/internal/loadout-state.ts","../src/ships/internal/loadout-engineering.ts","../src/ships/pre-engineered-stats.ts"],"names":["combinedRateOfFire","getModuleBySymbol","builtInModuleBySymbol","getPreEngineeredVariants","ALL_MODULES","EXPERIMENTAL_EFFECTS","getExperimentalEffect","fieldForLabel","preciseModifierValue","scaleForLabel","capabilityValueForLabel","baseStats","computeModifiers","labelsForDamageType","resolveBlueprintForModule","getBlueprintsForModule","getExperimentalsForModule","getEngineeringGroup","getBlueprint","BLUEPRINTS","normalizeKey","requireStringIfPresent","deepFreeze","scaleDamageComponents","components","baseDamage","effectiveDamage","scale","kinetic","thermal","explosive","absolute","antiXeno","unclassified","map","value","fixedModifierFeatures","modifiers","modifier","label","method","min","max","FITTED_ITEM","isNonOutfittingSlot","slotKey","test","isBuiltInHullModule","module","Slot","toLowerCase","Item","startsWith","cloneLoadoutModule","On","Priority","Health","Value","Engineering","BlueprintName","Level","Quality","ExperimentalEffect","ExperimentalEffect_Localised","Modifiers","matchingKeyIn","keyed","has","wanted","key","keys","cloneModuleStats","restrictedToShips","limitIncrease","damageDistribution","damageComponents","projectileRange","GUARDIAN_WEAPON_GROUPS","Set","missingBaseLabels","stats","base","features","experimental","contributions","contribution","filter","recipeSignature","fdname","blueprint","grades","Object","entries","grade","feature","sort","join","name","isGenericSpelling","isSoldWithBlueprint","item","some","variant","acquisition","blueprintRoutesFor","routes","Map","set","blueprintAvailableFor","offered","asWritten","resolved","trim","id","signature","experimentalAvailableFor","primitiveLabelFor","maximumRange","falloffRange","scannerRange","shieldRegenRate","primitiveEngineeringInputsFor","canonicalGrade","round6","rounded","Math","round","is","float32FiringCycle","interval","burstRounds","burstRateOfFire","withinBurst","fround","cycle","float32RateOfFire","float32DamagePerSecond","damage","rounds","rate","damagePerCycle","JOURNAL_MODIFIER_ORDER","JOURNAL_MODIFIER_RANK","index","sortJournalModifiers","a","b","get","Label","length","journalModifiersFor","weapon","valueFor","fallback","find","candidate","burstTouched","damageTouched","rateTouched","damagePerSecond","derivedRate","continuous","burstInterval","rateOfFire","OriginalValue","burstRate","baseBurstRounds","baseBurstRate","baseInterval","baseCycle","baseRate","rateModifier","effectiveRate","effectiveInterval","effectiveCycle","stockRounds","roundsPerShot","effectiveRounds","result","includes","journalLabel","push","direct","findIndex","isFinalGuardianWeaponEngineering","group","engineerableBase","statsOverride","engineeringLocked","availableBlueprintsFor","engineerable","available","route","Number","isFinite","availableExperimentalsFor","effect","modifiersWithExperimental","symbol","effectName","getPreEngineeredModifiers","journalModifiersWithExperimental","type","getPreEngineeredJournalModifiers","sameJournalNumber","actual","expected","abs","modifierKey","sameModifier","ValueStr","matchesModifierSignature","actualByKey","matched","predicted","identifyPreEngineeredVariant","engineering","stock","capturedExperimental","matches","primitive","unresolvedModifiers","getPreEngineeredStats","field","assign","experimentalDamageDistribution","m"],"mappings":"O,8yBAWO,SAASuB,sBACZC,WACAC,WACAC,iBAEA,MAAMC,MACFF,kBAAe,GAAaA,aAAe,GAAKC,uBAAo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