@elite-dangerous-almanac/core 0.1.0-beta.4 → 0.1.0-beta.5

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.
Files changed (52) hide show
  1. package/PROVENANCE/ships/SOURCES.md +34 -13
  2. package/README.md +2 -1
  3. package/THIRD_PARTY_NOTICES.md +3 -2
  4. package/dist/chunk-AUHDXSQL.js +1 -0
  5. package/dist/chunk-AUHDXSQL.js.map +1 -0
  6. package/dist/{chunk-VQQ6WHAL.js → chunk-ECBYOHPF.js} +1 -1
  7. package/dist/chunk-FMPRCYKY.js +1 -0
  8. package/dist/chunk-FMPRCYKY.js.map +1 -0
  9. package/dist/chunk-GQ5GX5TB.js +1 -0
  10. package/dist/chunk-GQ5GX5TB.js.map +1 -0
  11. package/dist/{chunk-DMCFX6VO.js → chunk-JBR4PTCM.js} +1 -1
  12. package/dist/chunk-JOTAOI5T.js +1 -0
  13. package/dist/chunk-JOTAOI5T.js.map +1 -0
  14. package/dist/{chunk-PDE4YOFT.js → chunk-LJI7VXJD.js} +1 -1
  15. package/dist/{chunk-PDE4YOFT.js.map → chunk-LJI7VXJD.js.map} +1 -1
  16. package/dist/chunk-MPZGCTRG.js +1 -0
  17. package/dist/chunk-MPZGCTRG.js.map +1 -0
  18. package/dist/chunk-XSFGRMJC.js +1 -0
  19. package/dist/{chunk-T24FTOEU.js.map → chunk-XSFGRMJC.js.map} +1 -1
  20. package/dist/chunk-ZAHNOQGG.js +1 -0
  21. package/dist/chunk-ZAHNOQGG.js.map +1 -0
  22. package/dist/{ship-loadout-BAU7scrE.d.ts → ship-loadout-D27yT2y2.d.ts} +76 -13
  23. package/dist/ships/gunsights.d.ts +111 -0
  24. package/dist/ships/gunsights.js +1 -0
  25. package/dist/ships/gunsights.js.map +1 -0
  26. package/dist/ships/index.d.ts +13 -7
  27. package/dist/ships/index.js +1 -1
  28. package/dist/ships/jump-range.d.ts +50 -7
  29. package/dist/ships/jump-range.js +1 -1
  30. package/dist/ships/module-capabilities.d.ts +3 -3
  31. package/dist/ships/modules-all.js +1 -1
  32. package/dist/ships/modules.d.ts +3 -3
  33. package/dist/ships/modules.js +1 -1
  34. package/dist/ships/pre-engineered-stats.js +1 -1
  35. package/dist/ships/shield-recovery.js +1 -1
  36. package/dist/ships/ship-loadout.d.ts +2 -1
  37. package/dist/ships/ship-loadout.js +1 -1
  38. package/dist/ships/weapons-capacitor.d.ts +71 -0
  39. package/dist/ships/weapons-capacitor.js +1 -0
  40. package/dist/ships/weapons-capacitor.js.map +1 -0
  41. package/dist/ships/weapons.d.ts +3 -2
  42. package/dist/ships/weapons.js +1 -1
  43. package/package.json +9 -1
  44. package/dist/chunk-BUV3MXGK.js +0 -1
  45. package/dist/chunk-BUV3MXGK.js.map +0 -1
  46. package/dist/chunk-KG4EWDZZ.js +0 -1
  47. package/dist/chunk-KG4EWDZZ.js.map +0 -1
  48. package/dist/chunk-T24FTOEU.js +0 -1
  49. package/dist/chunk-TXT2LOZI.js +0 -1
  50. package/dist/chunk-TXT2LOZI.js.map +0 -1
  51. /package/dist/{chunk-VQQ6WHAL.js.map → chunk-ECBYOHPF.js.map} +0 -0
  52. /package/dist/{chunk-DMCFX6VO.js.map → chunk-JBR4PTCM.js.map} +0 -0
@@ -15,7 +15,7 @@ Referred to throughout by source name; the pin is here, once.
15
15
  | Odyssey Materials Helper CAPI fixture `application/src/test/resources/parser/capifc/test9.json` | commit `2c652a2349b754f1dde1a58b6daaac5a04e421a6` | 2026-08-09 UTC |
16
16
  | EDCD/Coriolis — the application, for its formulas | commit `68c042ca6e3db62372cbbb2077cf972345511712` | 2026-08-01 UTC |
17
17
  | msarilar/EDEngineer `EDEngineer/Resources/Data/blueprints.json` | SHA-256 `787e6bd0579264d7b4615a281318792cb212285786f4ae07f61ec1cc464cdec0` — read from the branch tip, so pinned by digest | 2026-08-08 UTC |
18
- | Elite Dangerous in-game verification | game version `4.4.0.3`; direct in-game observation | 2026-08-14 UTC |
18
+ | Elite Dangerous in-game verification | game version `4.4.0.3`; direct in-game observation | 2026-08-14 UTC |
19
19
 
20
20
  Every `eddb.js` derivation uses the baseline snapshot unless its catalogue note names
21
21
  the Vessel Hangar snapshot.
@@ -91,18 +91,18 @@ identity from FDevIDs, stats and slots from coriolis-data, joined on `symbol`.
91
91
  omissions. Values are transcribed directly, subject only to the established numeric
92
92
  precision described above.
93
93
 
94
- | Field | Registry value → stored game value |
95
- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
- | `baseShieldStrength` | `Type7` 155→156 |
97
- | `masslock` | `Orca` 16→15; `Cutter` 27→26; `Viper_MkIV` 7→8; `Asp_Scout` 8→9; `Mandalay` 11→12; `PantherMkII` 27→25; `LakonMiner` 16→15; `Explorer_NX` 19→21; `SmallCombat01_NX` 10→11; `MediumTransport01` absent→16 |
98
- | `reserveFuelCapacity` | `Mandalay` 0.52→0.5; `PantherMkII` 1.16→1.11; `LakonMiner` 0.77→0.6; `SmallCombat01_NX` 0.57→0.61 |
99
- | `heatCapacity` | `Dolphin` 165→245; `Python_NX` 316→260; `Type8` 226→236; `Mandalay` 250→245; `Corsair` 230→280; `PantherMkII` 250→329; `LakonMiner` 289→300; `Explorer_NX` 250→341; `SmallCombat01_NX` 237→263; `MediumTransport01` absent→279 |
100
- | `heatDissipation` | `Python_NX` 52→52.05; `Type8` 36.5→36.45; `CobraMkV` 40.5→40.63; `Corsair` 52→52.05; `PantherMkII` 62.5→62.45; `LakonMiner` 52.15→52.05; `Explorer_NX` 72.1→71.93; `SmallCombat01_NX` 39.85→37.93; `MediumTransport01` absent→49.35 |
101
- | `maximumSpeed` | `Type9_Military` 179→180; `TypeX_3` 204→200; `CobraMkV` 291→290; `PantherMkII` 181→180; `LakonMiner` 272→270; `SmallCombat01_NX` 271→270 |
102
- | `boost` | `Type9_Military` 219→220; `CobraMkV` 412→410; `LakonMiner` 367→365 |
103
- | `pitch` | `Type9_Military` 20→22; `Krait_MkII` 26→31; `TypeX` 39→38; `TypeX_3` 32→35; `Krait_Light` 26→31; `Mamba` 27→30; `Python_NX` 37.72→37; `CobraMkV` 45.61→45; `SmallCombat01_NX` 51.4→50 |
104
- | `roll` | `Type9_Military` 20→40; `TypeX` 92→90; `Mamba` 80→75; `Python_NX` 92.76→91; `CobraMkV` 121.62→120; `SmallCombat01_NX` 123.36→120 |
105
- | `yaw` | `Python_NX` 12.74→12.5; `CobraMkV` 33.45→33; `SmallCombat01_NX` 24.67→24 |
94
+ | Field | Registry value → stored game value |
95
+ | --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
96
+ | `baseShieldStrength` | `Type7` 155→156 |
97
+ | `masslock` | `Orca` 16→15; `Cutter` 27→26; `Viper_MkIV` 7→8; `Asp_Scout` 8→9; `Mandalay` 11→12; `PantherMkII` 27→25; `LakonMiner` 16→15; `Explorer_NX` 19→21; `SmallCombat01_NX` 10→11; `MediumTransport01` absent→16 |
98
+ | `reserveFuelCapacity` | `Mandalay` 0.52→0.5; `PantherMkII` 1.16→1.11; `LakonMiner` 0.77→0.6; `SmallCombat01_NX` 0.57→0.61 |
99
+ | `heatCapacity` | `Dolphin` 165→245; `Python_NX` 316→260; `Type8` 226→236; `Mandalay` 250→245; `Corsair` 230→280; `PantherMkII` 250→329; `LakonMiner` 289→300; `Explorer_NX` 250→341; `SmallCombat01_NX` 237→263; `MediumTransport01` absent→279 |
100
+ | `heatDissipation` | `Python_NX` 52→52.05; `Type8` 36.5→36.45; `CobraMkV` 40.5→40.63; `Corsair` 52→52.05; `PantherMkII` 62.5→62.45; `LakonMiner` 52.15→52.05; `Explorer_NX` 72.1→71.93; `SmallCombat01_NX` 39.85→37.93; `MediumTransport01` absent→49.35 |
101
+ | `maximumSpeed` | `Type9_Military` 179→180; `TypeX_3` 204→200; `CobraMkV` 291→290; `PantherMkII` 181→180; `LakonMiner` 272→270; `SmallCombat01_NX` 271→270 |
102
+ | `boost` | `Type9_Military` 219→220; `CobraMkV` 412→410; `LakonMiner` 367→365 |
103
+ | `pitch` | `Type9_Military` 20→22; `Krait_MkII` 26→31; `TypeX` 39→38; `TypeX_3` 32→35; `Krait_Light` 26→31; `Mamba` 27→30; `Python_NX` 37.72→37; `CobraMkV` 45.61→45; `SmallCombat01_NX` 51.4→50 |
104
+ | `roll` | `Type9_Military` 20→40; `TypeX` 92→90; `Mamba` 80→75; `Python_NX` 92.76→91; `CobraMkV` 121.62→120; `SmallCombat01_NX` 123.36→120 |
105
+ | `yaw` | `Python_NX` 12.74→12.5; `CobraMkV` 33.45→33; `SmallCombat01_NX` 24.67→24 |
106
106
 
107
107
  - **`heatDissipation` is the hull's audited maximum cooling rate.** Coriolis-data carries no
108
108
  dissipation figure at all, and the game shows a player none: it is a community
@@ -127,6 +127,27 @@ identity from FDevIDs, stats and slots from coriolis-data, joined on `symbol`.
127
127
  (`FrameShiftDrive`, `HugeHardpoint1`, `TinyHardpoint2`, `Slot01_Size6`, `Military01`,
128
128
  `PlanetaryApproachSuite`).
129
129
 
130
+ ### Gunsights
131
+
132
+ - **File:** `gunsights.jsonc` (48 player-flyable hulls, 234 weapon hardpoints).
133
+ - **Source:** in-game gunsight observations from the in-game verification snapshot
134
+ pinned above.
135
+ - **Derivation:** each observation is joined to `ships.jsonc` by case-insensitive hull
136
+ symbol. Its hardpoints are joined by exact journal slot key to the hardpoints returned
137
+ by `enumerateSlots`, then written in the existing `Ship.hardpoints` order. One observed
138
+ identity absent from the player-flyable hull catalogue is discarded.
139
+ - **Fields retained:** only the camera-relative horizontal and vertical offsets, in
140
+ metres, as `[horizontalOffsetMetres, verticalOffsetMetres]`. Every observed fixed-weapon
141
+ direction coefficient is exactly zero, so those coefficients carry no information and
142
+ are omitted. Hull identity is already the map key; display names, slot keys and
143
+ hardpoint counts are recoverable from `ships.jsonc`; all other acquisition and
144
+ presentation metadata is unnecessary for projection and is dropped.
145
+ - **Precision:** offsets remain at their observed numeric precision. Exact zero and tiny
146
+ near-zero values both describe centerline mounts; the residuals are numeric precision,
147
+ not meaningful sub-millimetre displacements to interpret or normalize.
148
+ - **Manual corrections:** none. All 48 hulls and all 234 of their hardpoint slot keys join
149
+ one-to-one without correction.
150
+
130
151
  ### Default loadouts
131
152
 
132
153
  - **File:** `default-loadouts.jsonc` (48 hulls, 831 fitted modules).
package/README.md CHANGED
@@ -84,6 +84,7 @@ build.powerBudget();
84
84
  build.shieldMetrics();
85
85
  build.armourMetrics();
86
86
  build.weaponMetrics();
87
+ build.weaponsCapacitorMetrics({ weaponsPips: 2 });
87
88
 
88
89
  build.toSlefString({
89
90
  header: { appName: 'MyApp', appVersion: '1.0.0' },
@@ -93,7 +94,7 @@ build.toSlefString({
93
94
  `ShipLoadout` imports every ship and module catalogue so it can resolve any build.
94
95
  When only one calculation is required, use the data-free leaf modules under
95
96
  `ships/jump-range`, `ships/power`, `ships/shields`, `ships/armour`, `ships/weapons`,
96
- `ships/ammunition`, `ships/heat` or `ships/resistances`.
97
+ `ships/weapons-capacitor`, `ships/ammunition`, `ships/heat` or `ships/resistances`.
97
98
 
98
99
  `build.validation` reports validity and operational completeness. Potentially incomplete
99
100
  aggregates are nullable and have a diagnostic counterpart (`cargoCapacityResult`,
@@ -32,8 +32,9 @@ a verbatim copy produced at build time — edit this file, never the copy.
32
32
  (our own implementation) from it: the power budget and its priority groups; loaded speed,
33
33
  boost and rotation through the thruster-mass and ENG-pip curves; shield strength and its
34
34
  mass curve; shield collapse delay, regeneration and SYS-capacitor recovery timing; armour
35
- hit points; resistance stacking with its diminishing returns; and weapon DPS / capacitor
36
- draw / heat. It credits the original Frontier-forum research the formulas come from.
35
+ hit points; resistance stacking with its diminishing returns; weapon DPS / capacitor
36
+ draw / heat; and WEP-pip recharge with weapons-capacitor endurance. It credits the
37
+ original Frontier-forum research the formulas come from.
37
38
  - **The heat model** — the equilibrium heat level a thermal load settles at, how heat
38
39
  moves towards it over time, and the multiplier a drained weapons capacitor puts on a
39
40
  weapon's thermal load — is ported as fact from EDSY's `edsy.js`
@@ -0,0 +1 @@
1
+ import{shieldMetrics}from"./chunk-2FHHMYDC.js";import{getShipSlots,getShipBySymbol,getShipByName}from"./chunk-IJRKEODR.js";import{parseSlef,toSlef,stringifySlef,getLoadoutModifier}from"./chunk-7MKYFCFF.js";import{enumerateSlots,parseSlotName,SLOT_RESTRICTION_LABELS}from"./chunk-I7PIDRMU.js";import{sourcePurchaseFromLoadout,getSourceModuleValue}from"./chunk-QTDBO7R2.js";import{weaponsCapacitorMetrics}from"./chunk-FMPRCYKY.js";import{powerBudget}from"./chunk-76XKY2Y2.js";import{identifyPreEngineeredVariant,getPreEngineeredStats,scaleDamageComponents}from"./chunk-JBR4PTCM.js";import{weaponMetrics,sumWeaponMetrics,combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{builtInModuleBySymbol,getBulkheadsForShip}from"./chunk-ECBYOHPF.js";import{getPreEngineeredVariants}from"./chunk-GJCB2Z72.js";import{shieldRecovery,cellBankSummary}from"./chunk-MPZGCTRG.js";import{completeResult,calculateUnladenMass,calculateCargoCapacity,calculateFuelCapacity}from"./chunk-RF2IKLWQ.js";import{validateLoadout}from"./chunk-5W43EQEQ.js";import{mobilityMetrics}from"./chunk-24INI4U7.js";import{calculateModuleLimits}from"./chunk-KPETDYQX.js";import{ALL_MODULES}from"./chunk-XSFGRMJC.js";import{CORE_MODULES}from"./chunk-O72KI7RP.js";import{getExperimentalEffect,EXPERIMENTAL_EFFECTS}from"./chunk-PMJG7PHU.js";import{heatMetrics}from"./chunk-QMQHIZGS.js";import{singleJumpRange,frameShiftDriveMassFactor,fuelPerJump,totalRange}from"./chunk-GQ5GX5TB.js";import{ammunitionCapacity}from"./chunk-AA3K5XUE.js";import{armourMetrics}from"./chunk-FGXWVFN6.js";import{baseStats,computeModifiers,labelsForDamageType,scaleForLabel,fieldForLabel,labelsForField,capabilityValueForLabel,damageTypeForLabel}from"./chunk-VZZ2XIRE.js";import{resolveBlueprintForModule}from"./chunk-L2ZZXEZM.js";import{getBlueprintsForModule,getExperimentalsForModule,getEngineeringGroup}from"./chunk-BNILZXJD.js";import{getBlueprintGrade,BLUEPRINTS,getBlueprint}from"./chunk-Q5MR36RW.js";import{isDecorativeModification}from"./chunk-6LUEKHO5.js";import{getDefaultLoadout}from"./chunk-V3DW67W2.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{truncate,describeValue,requireString,requireStringIfPresent}from"./chunk-B5TT26XE.js";import{deepFreeze}from"./chunk-DURKO7JU.js";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.engineeringLocked&&variant.blueprint.toLowerCase()===wanted)}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 isEngineerable(item){return getEngineeringGroup(item)!==null}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 of getBlueprintsForModule(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})}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 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 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,statsFor){const banks=[];for(const module of modules){if(!startsWithAny(module.Item,PREFIX.shieldCellBank))continue;const effective=effectiveModule(module,statsFor(module));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})}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;#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 immovableReason=slot.key.toLowerCase()==="cargohatch"?"cargoHatch":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(raw,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){if(requireString(slotKey,SLOT_KEY).toLowerCase()==="cargohatch"){throw new LoadoutEditError("ShipLoadout.removeModule: the cargoHatch slot cannot be changed","immutableSlot",{slot:"CargoHatch"})}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 stats=this.#statsFor(module);if(!stats){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)`;if(isDecorativeModification(recipe)){throw new TypeError(`ShipLoadout.applyBlueprint: ${named} is a decorative modification, not a blueprint; no engineer applies one, and the stat changes it arrives with are in DECORATIVE_MODIFICATIONS`)}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(stats.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)){throw new TypeError(isEngineerable(module.Item)?`ShipLoadout.applyBlueprint: module "${truncate(module.Item)}" is not offered blueprint ${named}; it takes ${getBlueprintsForModule(module.Item).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 base=baseStats(stats);const missing=missingBaseLabels(stats,base,grade.features,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 modifiers=computeModifiers(base,grade,quality,experimental);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;modifiers.push({Label:label,Value:value*scaleForLabel(label),OriginalValue:(stats.damageDistribution?.[type]??0)*scaleForLabel(label)})}}const engineering={BlueprintName:fdname,Level:wantedGrade,Quality:quality,...wantedExperimental!==void 0?{ExperimentalEffect:wantedExperimental}:{},Modifiers:modifiers};this.#replaceModule(module.Slot,{...module,Engineering:engineering});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 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)}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}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;const fuel=Math.min(this.#requireFuelCapacity().main,fsd.maxFuel);return singleJumpRange(this.#requireMass(0),fuel,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),this.#requireFuelCapacity().main,this.frameShiftDrive)}jumpRangeSummary(){const cargo=this.#requireCargoCapacity();return{max:this.maxJumpRange(),unladen:this.jumpRange(),laden:this.jumpRange({cargo:cargo}),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.#modules.values()],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 banks=cellBankInputsFor([...this.#modules.values()],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(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.#modules.values()],weaponsPips,this.powerBudget(),module=>this.#statsFor(module)))}#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)}#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){const previous=this.#modules.get(slotKey)??null;this.#adjustImportedFigures(previous,replacement,replacementStats);if(replacement===null){this.#modules.delete(slotKey);this.#moduleStats.delete(slotKey)}else{this.#modules.set(slotKey,cloneLoadoutModule(replacement));if(replacementStats!==void 0)this.#moduleStats.set(slotKey,replacementStats)}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-AUHDXSQL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ships/internal/loadout-state.ts","../src/ships/internal/loadout-engineering.ts","../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":["shieldMetrics","getShipSlots","getShipBySymbol","getShipByName","parseSlef","toSlef","stringifySlef","getLoadoutModifier","enumerateSlots","parseSlotName","SLOT_RESTRICTION_LABELS","sourcePurchaseFromLoadout","getSourceModuleValue","weaponsCapacitorMetrics","powerBudget","identifyPreEngineeredVariant","getPreEngineeredStats","scaleDamageComponents","weaponMetrics","sumWeaponMetrics","combinedRateOfFire","builtInModuleBySymbol","getBulkheadsForShip","getPreEngineeredVariants","shieldRecovery","cellBankSummary","completeResult","calculateUnladenMass","calculateCargoCapacity","calculateFuelCapacity","validateLoadout","mobilityMetrics","calculateModuleLimits","ALL_MODULES","CORE_MODULES","getExperimentalEffect","EXPERIMENTAL_EFFECTS","heatMetrics","singleJumpRange","frameShiftDriveMassFactor","fuelPerJump","totalRange","ammunitionCapacity","armourMetrics","baseStats","computeModifiers","labelsForDamageType","scaleForLabel","fieldForLabel","labelsForField","capabilityValueForLabel","damageTypeForLabel","resolveBlueprintForModule","getBlueprintsForModule","getExperimentalsForModule","getEngineeringGroup","getBlueprintGrade","BLUEPRINTS","getBlueprint","isDecorativeModification","getDefaultLoadout","normalizeKey","truncate","describeValue","requireString","requireStringIfPresent","deepFreeze","FITTED_ITEM","isNonOutfittingSlot","slotKey","test","isBuiltInHullModule","module","Slot","toLowerCase","Item","startsWith","cloneLoadoutModule","On","Priority","Health","Value","Engineering","BlueprintName","Level","Quality","ExperimentalEffect","ExperimentalEffect_Localised","Modifiers","map","modifier","matchingKeyIn","keyed","has","wanted","key","keys","cloneModuleStats","restrictedToShips","limitIncrease","damageDistribution","damageComponents","unclassified","projectileRange","GUARDIAN_WEAPON_GROUPS","Set","missingBaseLabels","stats","base","features","experimental","contributions","contribution","label","filter","recipeSignature","fdname","blueprint","grades","Object","entries","grade","feature","method","sort","join","name","isGenericSpelling","isSoldWithBlueprint","item","some","variant","engineeringLocked","blueprintAvailableFor","offered","asWritten","resolved","trim","id","signature","experimentalAvailableFor","isEngineerable","isFinalGuardianWeaponEngineering","group","engineerableBase","statsOverride","availableBlueprintsFor","engineerable","available","length","Number","isFinite","a","b","push","availableExperimentalsFor","effect","modifiers","PREFIX","powerPlant","thrusters","frameShiftDrive","powerDistributor","shieldGenerator","shieldCellBank","shieldBooster","shieldReinforcement","hullReinforcement","moduleReinforcement","startsWithAny","symbol","prefixes","prefix","isPowerDistributor","slot","isEnabled","priorityOf","effectiveStat","field","stated","statedModifier","modified","effectiveCapability","Label","effectiveDamageDistribution","fromEffect","distribution","type","convertsDamage","modifierRatio","effective","relatedStat","ratio","effectiveModule","merged","fields","add","capability","value","engineeringGroup","massRatio","minMass","maxMass","performanceRatio","minMultiplier","maxMultiplier","category","normalizeEffectiveWeapon","damage","powerConsumerFor","draw","parsedSlot","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","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","heatInputFor","heatEfficiency","thrusterHeatRate","deployedThrusterHeatRate","fsdHeatRate","weapons","running","heat","retracted","heatPerSecond","sustainedHeatPerSecond","heatCapacity","heatDissipation","retractedPowerDraw","poweredDraw","deployedPowerDraw","unknownDraws","consumer","state","powered","bands","reduce","total","band","min","poweredRetracted","poweredDeployed","cellBankInputsFor","banks","ammunition","reinforcementRate","shieldBankReinforcement","cells","spinUp","shieldBankSpinUp","duration","shieldBankDuration","shieldBankHeat","stockBulkhead","variants","find","v","endsWith","armourInputFor","reinforcements","moduleReinforcements","bulkhead","hullBoost","moduleProtection","integrity","stock","baseArmour","WEAPON_FIELDS","burstAdjustedRateOfFire","touched","rate","rateOfFire","statedDamagePerSecond","firingFactor","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","allowedShipNames","labels","index","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","TypeError","remaining","Map","get","delete","sum","cost","SOURCE_ITEM","entry","moduleValues","fitted","captureLoadoutEvent","Array","isArray","captureEach","captureModule","capture","captured","health","engineering","captureEngineering","experimentalLocalised","normalizeLoadoutEvent","rawEvent","slots","normalizedSlot","set","top","moduleStats","variantStats","normalizedBlueprint","normalizedExperimental","exact","candidate","SLOT_KEY","requireLoadOptions","scope","RangeError","LoadoutEditError","constructor","super","this","fromEntries","FSD_PREFIX","BOOSTER_PREFIX","FUEL_TANK_PREFIX","ShipLoadout","_ShipLoadout","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","existing","currentLimits","moduleLimits","moduleStatsAt","immovableReason","moduleLimitRegression","fittedModuleAt","removable","fittedModuleFor","raw","effectiveStats","preEngineeredVariant","fittedModules","flatMap","availableBlueprints","availableExperimentalEffects","modulesForSlot","requireSlot","occupied","currentStats","setModule","conflict","previousSlot","previousSymbol","limitProblem","count","limit","fittedKey","replaceModule","removeModule","applyBlueprint","wantedGrade","wantedQuality","quality","wantedExperimental","recipe","named","isInteger","missing","OriginalValue","clearEngineering","bare","setModuleEnabled","patchModule","setModulePriority","patch","toLoadoutEvent","fuel","exportableJumpRange","hullCost","header","toSlefString","indent","drive","resolveDrive","tank","maxFuel","requireFuelCapacity","requireMass","fsd","jumpRange","ladenJumpRange","requireCargoCapacity","distance","jumpRangeSummary","unladen","laden","totalUnladen","totalLaden","consumers","cellBanks","order","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","modifierLabel","shouldCarryCapacity","fsdModule","m","isDrive","fuelMul","fuelPower","jumpBoost","resolveJ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oB,UAAW,mBAAqBjiB,KAAKqI,QACxE,MAAMkW,QAAU5kB,mBAAmBsoB,UAAW,mBAAqBjiB,KAAKue,QACxE,GAAIlW,eAAY,GAAakW,eAAY,EAAW,CAChD,MAAMlB,QAAU,IACRhV,eAAY,EAAY,CAAC,WAAa,MACtCkW,eAAY,EAAY,CAAC,WAAa,IAE9C,MAAM,IAAI9I,UACN,mCAAmCvY,SAAS+kB,UAAUlkB,iBAAiBsf,QAAQpc,KAAK,iCAE5F,CAEA,MAAO,CACHoH,gBACAkW,gBACA6D,QAASpiB,KAAKoiB,QACdC,UAAWriB,KAAKqiB,UAChBC,UAAWpK,MAAKqK,mBAExB,CAGA,iBAAAA,GACI,IAAA,MAAWL,KAAKhK,MAAK/Q,QAASiO,SAAU,CACpC,MAAMrV,MAAQmY,MAAK9Q,SAAU8a,GAC7B,GACIniB,OAAO4F,mBAAqB,gBAC3Buc,EAAEnkB,KAAKD,cAAcE,WAAWqa,gBACnC,CACE,QACJ,CACA,GAAI6J,EAAEhkB,KAAO,MAAO,SACpB,GAAI6B,OAAOuiB,iBAAc,EAAW,CAChC,MAAM,IAAI7M,UACN,6BAA6BvY,SAASglB,EAAEnkB,iDAEhD,CACA,OAAOgC,MAAMuiB,SACjB,CACA,OAAO,CACX,CAGA,SAAAlb,CAAUxJ,QACN,GAAIA,SAAW,KAAM,OAAO,KAC5B,MAAMmC,MACFmY,MAAKb,YAAazB,IAAIhY,OAAOC,OAASpD,sBAAsBmD,OAAOG,KAAMR,aAC7E,GAAIwC,MAAO,OAAOA,MAIlB,OAAOpC,oBAAoBC,QACrBnD,sBAAsB,sBAAuB,gCAC7C,IACV,UACJsd,iBAAAQ"}
@@ -1 +1 @@
1
- import{ALL_MODULES}from"./chunk-T24FTOEU.js";import{findInKeyIndex,findByKey,filterByKey,createKeyIndex}from"./chunk-S4DBNX2B.js";var MODULES_BY_SYMBOL=/* @__PURE__ */createKeyIndex(ALL_MODULES,"symbol");function builtInModuleBySymbol(symbol,label){return findInKeyIndex(MODULES_BY_SYMBOL,symbol,label)}function getModuleBySymbol(symbol,modules=ALL_MODULES){return modules===ALL_MODULES?builtInModuleBySymbol(symbol,"getModuleBySymbol: symbol"):findByKey(modules,"symbol",symbol,"getModuleBySymbol: symbol")}function getModulesByName(name,modules=ALL_MODULES){return filterByKey(modules,"name",name,"getModulesByName: name")}function getBulkheadsForShip(ship,modules=ALL_MODULES){return filterByKey(modules,"ship",ship,"getBulkheadsForShip: ship")}export{builtInModuleBySymbol,getBulkheadsForShip,getModuleBySymbol,getModulesByName};//# sourceMappingURL=chunk-VQQ6WHAL.js.map
1
+ import{ALL_MODULES}from"./chunk-XSFGRMJC.js";import{findInKeyIndex,findByKey,filterByKey,createKeyIndex}from"./chunk-S4DBNX2B.js";var MODULES_BY_SYMBOL=/* @__PURE__ */createKeyIndex(ALL_MODULES,"symbol");function builtInModuleBySymbol(symbol,label){return findInKeyIndex(MODULES_BY_SYMBOL,symbol,label)}function getModuleBySymbol(symbol,modules=ALL_MODULES){return modules===ALL_MODULES?builtInModuleBySymbol(symbol,"getModuleBySymbol: symbol"):findByKey(modules,"symbol",symbol,"getModuleBySymbol: symbol")}function getModulesByName(name,modules=ALL_MODULES){return filterByKey(modules,"name",name,"getModulesByName: name")}function getBulkheadsForShip(ship,modules=ALL_MODULES){return filterByKey(modules,"ship",ship,"getBulkheadsForShip: ship")}export{builtInModuleBySymbol,getBulkheadsForShip,getModuleBySymbol,getModulesByName};//# sourceMappingURL=chunk-ECBYOHPF.js.map
@@ -0,0 +1 @@
1
+ import{capacitorRechargeAtPips}from"./chunk-JOTAOI5T.js";function requireFiniteNonNegative(scope,name,value){if(!Number.isFinite(value)||value<0){throw new RangeError(`${scope}: ${name} must be a finite non-negative number`)}}function weaponsCapacitorMetrics(input){const scope="weaponsCapacitorMetrics";const weaponsPips=input.weaponsPips??4;if(!Number.isFinite(weaponsPips)||weaponsPips<0||weaponsPips>4){throw new RangeError(`${scope}: weaponsPips must be a finite number from 0 to 4`)}for(const field of["weaponsCapacity","weaponsRecharge","sustainedEnergyPerSecond"]){requireFiniteNonNegative(scope,field,input[field])}const rechargeRate=capacitorRechargeAtPips(input.weaponsRecharge,weaponsPips);const netDrainRate=Math.max(0,input.sustainedEnergyPerSecond-rechargeRate);return{weaponsPips:weaponsPips,capacity:input.weaponsCapacity,rechargeRate:rechargeRate,sustainedEnergyPerSecond:input.sustainedEnergyPerSecond,netDrainRate:netDrainRate,timeToDrain:netDrainRate===0?Infinity:input.weaponsCapacity/netDrainRate}}export{weaponsCapacitorMetrics};//# sourceMappingURL=chunk-FMPRCYKY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ships/weapons-capacitor.ts"],"names":["capacitorRechargeAtPips","requireFiniteNonNegative","scope","name","value","Number","isFinite","RangeError","weaponsCapacitorMetrics","input","weaponsPips","field","rechargeRate","weaponsRecharge","netDrainRate","Math","max","sustainedEnergyPerSecond","capacity","weaponsCapacity","timeToDrain","Infinity"],"mappings":"O,kDAmDA,SAASC,yBAAyBC,MAAeC,KAAcC,OAC3D,IAAKC,OAAOC,SAASF,QAAUA,MAAQ,EAAG,CACtC,MAAM,IAAIG,WAAW,GAAGL,UAAUC,4CACtC,CACJ,CAwBO,SAASK,wBAAwBC,OACpC,MAAMP,MAAQ,0BACd,MAAMQ,YAAcD,MAAMC,aAAe,EACzC,IAAKL,OAAOC,SAASI,cAAgBA,YAAc,GAAKA,YAAc,EAAG,CACrE,MAAM,IAAIH,WAAW,GAAGL,yDAC5B,CACA,IAAA,MAAWS,QAAS,CAChB,kBACA,kBACA,4BACQ,CACRV,yBAAyBC,MAAOS,MAAOF,MAAME,OACjD,CAEA,MAAMC,aAAeZ,wBAAwBS,MAAMI,gBAAiBH,aACpE,MAAMI,aAAeC,KAAKC,IAAI,EAAGP,MAAMQ,yBAA2BL,cAClE,MAAO,CACHF,wBACAQ,SAAUT,MAAMU,gBAChBP,0BACAK,yBAA0BR,MAAMQ,yBAChCH,0BACAM,YAAaN,eAAiB,EAAIO,SAAWZ,MAAMU,gBAAkBL,aAE7E,QAAAN"}
@@ -0,0 +1 @@
1
+ var MAX_TOTAL_RANGE_JUMPS=1e5;function requireNonNegative(scope,name,value){if(!Number.isFinite(value)||value<0){throw new RangeError(`${scope}: ${name} must be a finite non-negative number`)}}function requirePositive(scope,name,value){if(!Number.isFinite(value)||value<=0){throw new RangeError(`${scope}: fsd.${name} must be a finite positive number`)}}function validateFsd(scope,fsd){requirePositive(scope,"optMass",fsd.optMass);requireNonNegative(scope,"fsd.maxFuel",fsd.maxFuel);requirePositive(scope,"fuelMul",fsd.fuelMul);requirePositive(scope,"fuelPower",fsd.fuelPower);if(fsd.jumpBoost!==void 0){requireNonNegative(scope,"fsd.jumpBoost",fsd.jumpBoost)}}function frameShiftDriveMassFactorUnchecked(mass,fuel,fsd){return fsd.optMass/(mass+fuel)}function singleJumpRangeUnchecked(mass,fuel,fsd,scope){const burn=Math.min(fuel,fsd.maxFuel);if(burn<=0||mass+fuel<=0)return 0;const base=Math.pow(burn/fsd.fuelMul,1/fsd.fuelPower)*frameShiftDriveMassFactorUnchecked(mass,fuel,fsd);const range=base+(fsd.jumpBoost??0);if(!Number.isFinite(range)){throw new RangeError(`${scope}: parameters produce a non-finite range`)}return range}function frameShiftDriveMassFactor(mass,fuel,fsd){const scope="frameShiftDriveMassFactor";requireNonNegative(scope,"mass",mass);requireNonNegative(scope,"fuel",fuel);requirePositive(scope,"optMass",fsd.optMass);if(mass+fuel<=0){throw new RangeError(`${scope}: mass plus fuel must be positive`)}return frameShiftDriveMassFactorUnchecked(mass,fuel,fsd)}function singleJumpRange(mass,fuel,fsd){const scope="singleJumpRange";requireNonNegative(scope,"mass",mass);requireNonNegative(scope,"fuel",fuel);validateFsd(scope,fsd);return singleJumpRangeUnchecked(mass,fuel,fsd,scope)}function fuelPerJump(distance,mass,fuel,fsd){const scope="fuelPerJump";requireNonNegative(scope,"distance",distance);requireNonNegative(scope,"mass",mass);requireNonNegative(scope,"fuel",fuel);validateFsd(scope,fsd);if(distance<=0)return 0;const burn=Math.min(fuel,fsd.maxFuel);const maxDistance=singleJumpRangeUnchecked(mass,fuel,fsd,scope);if(maxDistance<=0)return 0;const cost=Math.pow(distance/maxDistance,fsd.fuelPower)*burn;return Math.min(cost,burn)}function totalRange(mass,fuel,fsd){const scope="totalRange";requireNonNegative(scope,"mass",mass);requireNonNegative(scope,"fuel",fuel);validateFsd(scope,fsd);if(fsd.maxFuel<=0)return{range:0,jumps:0};const jumps=fuel>0?Math.max(1,Math.ceil(fuel/fsd.maxFuel)):0;if(!Number.isFinite(jumps)||jumps>MAX_TOTAL_RANGE_JUMPS){throw new RangeError(`${scope}: fuel and fsd.maxFuel require more than ${MAX_TOTAL_RANGE_JUMPS} jumps`)}let range=0;let remaining=fuel;for(let i=0;i<jumps;i++){range+=singleJumpRangeUnchecked(mass,remaining,fsd,scope);if(!Number.isFinite(range)){throw new RangeError(`${scope}: parameters produce a non-finite total range`)}remaining=Math.max(0,remaining-fsd.maxFuel)}return{range:range,jumps:jumps}}export{frameShiftDriveMassFactor,fuelPerJump,singleJumpRange,totalRange};//# sourceMappingURL=chunk-GQ5GX5TB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ships/jump-range.ts"],"names":["MAX_TOTAL_RANGE_JUMPS","requireNonNegative","scope","name","value","Number","isFinite","RangeError","requirePositive","validateFsd","fsd","optMass","maxFuel","fuelMul","fuelPower","jumpBoost","frameShiftDriveMassFactorUnchecked","mass","fuel","singleJumpRangeUnchecked","burn","Math","min","base","pow","range","frameShiftDriveMassFactor","singleJumpRange","fuelPerJump","distance","maxDistance","cost","totalRange","jumps","max","ceil","remaining","i"],"mappings":"AAwDA,IAAMA,sBAAwB,IAG9B,SAASC,mBAAmBC,MAAeC,KAAcC,OACrD,IAAKC,OAAOC,SAASF,QAAUA,MAAQ,EAAG,CACtC,MAAM,IAAIG,WAAW,GAAGL,UAAUC,4CACtC,CACJ,CAGA,SAASK,gBAAgBN,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B,QAAAP,0BAAAE,YAAAD,gBAAAK"}
@@ -1 +1 @@
1
- import{combinedRateOfFire}from"./chunk-PDE4YOFT.js";import{getModuleBySymbol}from"./chunk-VQQ6WHAL.js";import{getPreEngineeredVariants}from"./chunk-GJCB2Z72.js";import{ALL_MODULES}from"./chunk-T24FTOEU.js";import{getExperimentalEffect}from"./chunk-PMJG7PHU.js";import{fieldForLabel,scaleForLabel,capabilityValueForLabel,computeModifiers,baseStats}from"./chunk-VZZ2XIRE.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{requireStringIfPresent}from"./chunk-B5TT26XE.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 asFeatures(modifiers){return modifiers.map(m=>({label:m.label,method:m.method,min:m.value,max:m.value}))}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),asFeatures(variant.modifiers??[]),1,effect??void 0)}function getPreEngineeredModifiers(variant){return modifiersWithExperimental(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 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.experimental!==void 0&&candidate.experimental.toLowerCase()!==capturedExperimental){continue}const expected=modifiersWithExperimental(candidate,engineering.ExperimentalEffect);if(!expected?.length)continue;let matched=0;let disagrees=false;for(const predicted of expected){const actual=actualByKey.get(modifierKey(predicted,stock));if(!actual)continue;if(!sameModifier(actual,predicted)){disagrees=true;break}matched++}if(!disagrees&&matched>=Math.max(1,expected.length-1))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{getPreEngineeredModifiers,getPreEngineeredStats,identifyPreEngineeredVariant,scaleDamageComponents,unresolvedModifiers};//# sourceMappingURL=chunk-DMCFX6VO.js.map
1
+ import{combinedRateOfFire}from"./chunk-LJI7VXJD.js";import{getModuleBySymbol}from"./chunk-ECBYOHPF.js";import{getPreEngineeredVariants}from"./chunk-GJCB2Z72.js";import{ALL_MODULES}from"./chunk-XSFGRMJC.js";import{getExperimentalEffect}from"./chunk-PMJG7PHU.js";import{fieldForLabel,scaleForLabel,capabilityValueForLabel,computeModifiers,baseStats}from"./chunk-VZZ2XIRE.js";import{normalizeKey}from"./chunk-S4DBNX2B.js";import{requireStringIfPresent}from"./chunk-B5TT26XE.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 asFeatures(modifiers){return modifiers.map(m=>({label:m.label,method:m.method,min:m.value,max:m.value}))}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),asFeatures(variant.modifiers??[]),1,effect??void 0)}function getPreEngineeredModifiers(variant){return modifiersWithExperimental(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 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.experimental!==void 0&&candidate.experimental.toLowerCase()!==capturedExperimental){continue}const expected=modifiersWithExperimental(candidate,engineering.ExperimentalEffect);if(!expected?.length)continue;let matched=0;let disagrees=false;for(const predicted of expected){const actual=actualByKey.get(modifierKey(predicted,stock));if(!actual)continue;if(!sameModifier(actual,predicted)){disagrees=true;break}matched++}if(!disagrees&&matched>=Math.max(1,expected.length-1))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{getPreEngineeredModifiers,getPreEngineeredStats,identifyPreEngineeredVariant,scaleDamageComponents,unresolvedModifiers};//# sourceMappingURL=chunk-JBR4PTCM.js.map
@@ -0,0 +1 @@
1
+ function capacitorRechargeAtPips(ratedRecharge,pips){return ratedRecharge*Math.pow(pips/4,1.1)}export{capacitorRechargeAtPips};//# sourceMappingURL=chunk-JOTAOI5T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ships/internal/capacitor-recharge.ts"],"names":["capacitorRechargeAtPips","ratedRecharge","pips","Math","pow"],"mappings":"AAWO,SAASA,wBAAwBC,cAAuBC,MAC3D,OAAOD,cAAgBE,KAAKC,IAAIF,KAAO,EAAG,IAC9C,QAAAF"}
@@ -1 +1 @@
1
- function combinedRateOfFire(weapon){const interval=weapon.burstInterval;if(interval===void 0||interval<=0)return void 0;const burst=weapon.burstRounds&&weapon.burstRounds>0?weapon.burstRounds:1;const burstRate=weapon.burstRateOfFire&&weapon.burstRateOfFire>0?weapon.burstRateOfFire:1;const cycle=(burst>1?(burst-1)/burstRate:0)+interval;return cycle>0?burst/cycle:void 0}var ZERO_SPLIT={kinetic:0,thermal:0,explosive:0,absolute:0,antiXeno:0};function splitDamage(damage,distribution){if(!distribution)return{...ZERO_SPLIT,absolute:damage};return{kinetic:damage*(distribution.kinetic??0),thermal:damage*(distribution.thermal??0),explosive:damage*(distribution.explosive??0),absolute:damage*(distribution.absolute??0),...(distribution.unclassified??0)===0?{}:{unclassified:damage*distribution.unclassified},antiXeno:damage*(distribution.antiXeno??0)}}function splitComponents(damage,components){const unclassified=(components.unclassified??[]).reduce((sum,value)=>sum+value,0);const conventional=(components.kinetic??0)+(components.thermal??0)+(components.explosive??0)+(components.absolute??0)+unclassified;if(conventional<=0)return{...ZERO_SPLIT,absolute:damage};const scale=damage/conventional;return{kinetic:(components.kinetic??0)*scale,thermal:(components.thermal??0)*scale,explosive:(components.explosive??0)*scale,absolute:(components.absolute??0)*scale,...unclassified===0?{}:{unclassified:unclassified*scale},antiXeno:(components.antiXeno??0)*scale}}function sustainedFireFactor(weapon){const rateOfFire=weapon.rateOfFire;const clip=weapon.clipSize===void 0?void 0:Math.ceil(weapon.clipSize);if(!rateOfFire||!clip||clip<=0)return 1;const burst=weapon.burstRounds&&weapon.burstRounds>0?weapon.burstRounds:1;const burstRate=weapon.burstRateOfFire&&weapon.burstRateOfFire>0?weapon.burstRateOfFire:1;const reload=weapon.reloadTime??0;const cycle=(clip-burst)/rateOfFire+(burst-1)/burstRate+reload;if(cycle<=0)return 1;const sustainedRate=clip/cycle;return Math.min(1,sustainedRate/rateOfFire)}function damagePerSecond(weapon){const damage=weapon.damage??0;const rounds=weapon.roundsPerShot&&weapon.roundsPerShot>0?weapon.roundsPerShot:1;return damage*rounds*(weapon.rateOfFire??1)}function sustainedDamagePerSecond(weapon){return damagePerSecond(weapon)*sustainedFireFactor(weapon)}function energyPerSecond(weapon){return(weapon.distributorDraw??0)*(weapon.rateOfFire??1)}function heatPerSecond(weapon){return(weapon.thermalLoad??0)*(weapon.rateOfFire??1)}function damageFalloff(weapon,metres){const maximum=weapon.maximumRange;if(maximum!==void 0&&metres>maximum)return 0;const falloff=weapon.falloffRange;if(falloff===void 0||maximum===void 0||metres<=falloff)return 1;const taper=maximum-falloff;if(taper<=0)return 1;return Math.max(0,1-(metres-falloff)/taper)}function armourPiercingFactor(armourPiercing,hardness){if(!Number.isFinite(armourPiercing)||armourPiercing<0){throw new RangeError("armourPiercingFactor: armour piercing must be a finite non-negative number")}if(!Number.isFinite(hardness)||hardness<0){throw new RangeError("armourPiercingFactor: hardness must be a finite non-negative number")}if(hardness===0)return 1;return Math.min(1,armourPiercing/hardness)}function weaponMetrics(weapon){const continuous=weapon.rateOfFire===void 0;const rateOfFire=weapon.rateOfFire??1;const factor=sustainedFireFactor(weapon);const dps=damagePerSecond(weapon);const sdps=dps*factor;const eps=energyPerSecond(weapon);const hps=heatPerSecond(weapon);const rounds=weapon.roundsPerShot&&weapon.roundsPerShot>0?weapon.roundsPerShot:1;return{damagePerShot:(weapon.damage??0)*rounds,rateOfFire:rateOfFire,sustainedRateOfFire:rateOfFire*factor,damagePerSecond:dps,sustainedDamagePerSecond:sdps,energyPerSecond:eps,sustainedEnergyPerSecond:eps*factor,heatPerSecond:hps,sustainedHeatPerSecond:hps*factor,thermalLoad:weapon.thermalLoad??0,powerDraw:weapon.powerDraw??0,damageByType:weapon.damageComponents?splitComponents(dps,weapon.damageComponents):splitDamage(dps,weapon.damageDistribution),sustainedDamageByType:weapon.damageComponents?splitComponents(sdps,weapon.damageComponents):splitDamage(sdps,weapon.damageDistribution),continuous:continuous}}function sumWeaponMetrics(metrics){const damageByType=emptyDamageSplitAccumulator();const sustainedDamageByType=emptyDamageSplitAccumulator();let damagePerSecond2=0;let sustainedDamagePerSecond2=0;let energyPerSecond2=0;let sustainedEnergyPerSecond=0;let heatPerSecond2=0;let sustainedHeatPerSecond=0;let thermalLoad=0;let powerDraw=0;for(const metric of metrics){damagePerSecond2+=metric.damagePerSecond;sustainedDamagePerSecond2+=metric.sustainedDamagePerSecond;energyPerSecond2+=metric.energyPerSecond;sustainedEnergyPerSecond+=metric.sustainedEnergyPerSecond;heatPerSecond2+=metric.heatPerSecond;sustainedHeatPerSecond+=metric.sustainedHeatPerSecond;thermalLoad+=metric.thermalLoad;powerDraw+=metric.powerDraw;addDamageSplit(damageByType,metric.damageByType);addDamageSplit(sustainedDamageByType,metric.sustainedDamageByType)}return{damagePerSecond:damagePerSecond2,sustainedDamagePerSecond:sustainedDamagePerSecond2,energyPerSecond:energyPerSecond2,sustainedEnergyPerSecond:sustainedEnergyPerSecond,heatPerSecond:heatPerSecond2,sustainedHeatPerSecond:sustainedHeatPerSecond,thermalLoad:thermalLoad,powerDraw:powerDraw,damageByType:finishDamageSplit(damageByType),sustainedDamageByType:finishDamageSplit(sustainedDamageByType)}}function emptyDamageSplitAccumulator(){return{kinetic:0,thermal:0,explosive:0,absolute:0,unclassified:0,antiXeno:0}}function addDamageSplit(total,split){total.kinetic+=split.kinetic;total.thermal+=split.thermal;total.explosive+=split.explosive;total.absolute+=split.absolute;total.unclassified+=split.unclassified??0;total.antiXeno+=split.antiXeno}function finishDamageSplit(total){const{unclassified:unclassified,...classified}=total;return unclassified===0?classified:{...classified,unclassified:unclassified}}export{armourPiercingFactor,combinedRateOfFire,damageFalloff,damagePerSecond,energyPerSecond,heatPerSecond,splitDamage,sumWeaponMetrics,sustainedDamagePerSecond,sustainedFireFactor,weaponMetrics};//# sourceMappingURL=chunk-PDE4YOFT.js.map
1
+ function combinedRateOfFire(weapon){const interval=weapon.burstInterval;if(interval===void 0||interval<=0)return void 0;const burst=weapon.burstRounds&&weapon.burstRounds>0?weapon.burstRounds:1;const burstRate=weapon.burstRateOfFire&&weapon.burstRateOfFire>0?weapon.burstRateOfFire:1;const cycle=(burst>1?(burst-1)/burstRate:0)+interval;return cycle>0?burst/cycle:void 0}var ZERO_SPLIT={kinetic:0,thermal:0,explosive:0,absolute:0,antiXeno:0};function splitDamage(damage,distribution){if(!distribution)return{...ZERO_SPLIT,absolute:damage};return{kinetic:damage*(distribution.kinetic??0),thermal:damage*(distribution.thermal??0),explosive:damage*(distribution.explosive??0),absolute:damage*(distribution.absolute??0),...(distribution.unclassified??0)===0?{}:{unclassified:damage*distribution.unclassified},antiXeno:damage*(distribution.antiXeno??0)}}function splitComponents(damage,components){const unclassified=(components.unclassified??[]).reduce((sum,value)=>sum+value,0);const conventional=(components.kinetic??0)+(components.thermal??0)+(components.explosive??0)+(components.absolute??0)+unclassified;if(conventional<=0)return{...ZERO_SPLIT,absolute:damage};const scale=damage/conventional;return{kinetic:(components.kinetic??0)*scale,thermal:(components.thermal??0)*scale,explosive:(components.explosive??0)*scale,absolute:(components.absolute??0)*scale,...unclassified===0?{}:{unclassified:unclassified*scale},antiXeno:(components.antiXeno??0)*scale}}function sustainedFireFactor(weapon){const rateOfFire=weapon.rateOfFire;const clip=weapon.clipSize===void 0?void 0:Math.ceil(weapon.clipSize);if(!rateOfFire||!clip||clip<=0)return 1;const burst=weapon.burstRounds&&weapon.burstRounds>0?weapon.burstRounds:1;const burstRate=weapon.burstRateOfFire&&weapon.burstRateOfFire>0?weapon.burstRateOfFire:1;const reload=weapon.reloadTime??0;const cycle=(clip-burst)/rateOfFire+(burst-1)/burstRate+reload;if(cycle<=0)return 1;const sustainedRate=clip/cycle;return Math.min(1,sustainedRate/rateOfFire)}function damagePerSecond(weapon){const damage=weapon.damage??0;const rounds=weapon.roundsPerShot&&weapon.roundsPerShot>0?weapon.roundsPerShot:1;return damage*rounds*(weapon.rateOfFire??1)}function sustainedDamagePerSecond(weapon){return damagePerSecond(weapon)*sustainedFireFactor(weapon)}function energyPerSecond(weapon){return(weapon.distributorDraw??0)*(weapon.rateOfFire??1)}function heatPerSecond(weapon){return(weapon.thermalLoad??0)*(weapon.rateOfFire??1)}function damageFalloff(weapon,metres){const maximum=weapon.maximumRange;if(maximum!==void 0&&metres>maximum)return 0;const falloff=weapon.falloffRange;if(falloff===void 0||maximum===void 0||metres<=falloff)return 1;const taper=maximum-falloff;if(taper<=0)return 1;return Math.max(0,1-(metres-falloff)/taper)}function armourPiercingFactor(armourPiercing,hardness){if(!Number.isFinite(armourPiercing)||armourPiercing<0){throw new RangeError("armourPiercingFactor: armour piercing must be a finite non-negative number")}if(!Number.isFinite(hardness)||hardness<0){throw new RangeError("armourPiercingFactor: hardness must be a finite non-negative number")}if(hardness===0)return 1;return Math.min(1,armourPiercing/hardness)}function weaponMetrics(weapon){const continuous=weapon.rateOfFire===void 0;const rateOfFire=weapon.rateOfFire??1;const factor=sustainedFireFactor(weapon);const dps=damagePerSecond(weapon);const sdps=dps*factor;const eps=energyPerSecond(weapon);const hps=heatPerSecond(weapon);const rounds=weapon.roundsPerShot&&weapon.roundsPerShot>0?weapon.roundsPerShot:1;return{damagePerShot:(weapon.damage??0)*rounds,rateOfFire:rateOfFire,sustainedRateOfFire:rateOfFire*factor,damagePerSecond:dps,sustainedDamagePerSecond:sdps,energyPerSecond:eps,sustainedEnergyPerSecond:eps*factor,heatPerSecond:hps,sustainedHeatPerSecond:hps*factor,thermalLoad:weapon.thermalLoad??0,powerDraw:weapon.powerDraw??0,damageByType:weapon.damageComponents?splitComponents(dps,weapon.damageComponents):splitDamage(dps,weapon.damageDistribution),sustainedDamageByType:weapon.damageComponents?splitComponents(sdps,weapon.damageComponents):splitDamage(sdps,weapon.damageDistribution),continuous:continuous}}function sumWeaponMetrics(metrics){const damageByType=emptyDamageSplitAccumulator();const sustainedDamageByType=emptyDamageSplitAccumulator();let damagePerSecond2=0;let sustainedDamagePerSecond2=0;let energyPerSecond2=0;let sustainedEnergyPerSecond=0;let heatPerSecond2=0;let sustainedHeatPerSecond=0;let thermalLoad=0;let powerDraw=0;for(const metric of metrics){damagePerSecond2+=metric.damagePerSecond;sustainedDamagePerSecond2+=metric.sustainedDamagePerSecond;energyPerSecond2+=metric.energyPerSecond;sustainedEnergyPerSecond+=metric.sustainedEnergyPerSecond;heatPerSecond2+=metric.heatPerSecond;sustainedHeatPerSecond+=metric.sustainedHeatPerSecond;thermalLoad+=metric.thermalLoad;powerDraw+=metric.powerDraw;addDamageSplit(damageByType,metric.damageByType);addDamageSplit(sustainedDamageByType,metric.sustainedDamageByType)}return{damagePerSecond:damagePerSecond2,sustainedDamagePerSecond:sustainedDamagePerSecond2,energyPerSecond:energyPerSecond2,sustainedEnergyPerSecond:sustainedEnergyPerSecond,heatPerSecond:heatPerSecond2,sustainedHeatPerSecond:sustainedHeatPerSecond,thermalLoad:thermalLoad,powerDraw:powerDraw,damageByType:finishDamageSplit(damageByType),sustainedDamageByType:finishDamageSplit(sustainedDamageByType)}}function emptyDamageSplitAccumulator(){return{kinetic:0,thermal:0,explosive:0,absolute:0,unclassified:0,antiXeno:0}}function addDamageSplit(total,split){total.kinetic+=split.kinetic;total.thermal+=split.thermal;total.explosive+=split.explosive;total.absolute+=split.absolute;total.unclassified+=split.unclassified??0;total.antiXeno+=split.antiXeno}function finishDamageSplit(total){const{unclassified:unclassified,...classified}=total;return unclassified===0?classified:{...classified,unclassified:unclassified}}export{armourPiercingFactor,combinedRateOfFire,damageFalloff,damagePerSecond,energyPerSecond,heatPerSecond,splitDamage,sumWeaponMetrics,sustainedDamagePerSecond,sustainedFireFactor,weaponMetrics};//# sourceMappingURL=chunk-LJI7VXJD.js.map