ootk 6.0.4 → 6.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -21,6 +21,8 @@ var ValidationError = class extends OotkError {
21
21
  this.value = value;
22
22
  this.name = "ValidationError";
23
23
  }
24
+ field;
25
+ value;
24
26
  };
25
27
  var ParseError = class extends OotkError {
26
28
  /**
@@ -35,6 +37,8 @@ var ParseError = class extends OotkError {
35
37
  this.line = line;
36
38
  this.name = "ParseError";
37
39
  }
40
+ format;
41
+ line;
38
42
  };
39
43
  var PropagationError = class extends OotkError {
40
44
  /**
@@ -47,6 +51,7 @@ var PropagationError = class extends OotkError {
47
51
  this.epoch = epoch;
48
52
  this.name = "PropagationError";
49
53
  }
54
+ epoch;
50
55
  };
51
56
  var OrbitDeterminationError = class extends OotkError {
52
57
  /**
@@ -59,6 +64,7 @@ var OrbitDeterminationError = class extends OotkError {
59
64
  this.algorithm = algorithm;
60
65
  this.name = "OrbitDeterminationError";
61
66
  }
67
+ algorithm;
62
68
  };
63
69
 
64
70
  // src/enums/AngularDiameterMethod.ts
@@ -77,6 +83,7 @@ var AngularDistanceMethod = /* @__PURE__ */ ((AngularDistanceMethod2) => {
77
83
 
78
84
  // src/enums/CatalogSource.ts
79
85
  var CatalogSource = /* @__PURE__ */ ((CatalogSource2) => {
86
+ CatalogSource2["UNKNOWN"] = "unknown";
80
87
  CatalogSource2["USSF"] = "spacetrack";
81
88
  CatalogSource2["CELESTRAK"] = "celestrak";
82
89
  CatalogSource2["CELESTRAK_SUP"] = "celestrak-sup";
@@ -275,6 +282,7 @@ var Epoch = class {
275
282
  throw new ValidationError("Epoch posix time must be a valid number", "posix", posix);
276
283
  }
277
284
  }
285
+ posix;
278
286
  toString() {
279
287
  return this.toDateTime().toISOString();
280
288
  }
@@ -1818,6 +1826,8 @@ var EpochGPS = class _EpochGPS {
1818
1826
  throw new ValidationError("GPS seconds must be between 0 and 604799", "seconds", seconds);
1819
1827
  }
1820
1828
  }
1829
+ week;
1830
+ seconds;
1821
1831
  /** Cached GPS reference epoch (1980-01-06T00:00:00.000Z) */
1822
1832
  static reference_ = null;
1823
1833
  /**
@@ -2276,6 +2286,9 @@ var Vector3D = class _Vector3D {
2276
2286
  this.y = y;
2277
2287
  this.z = z;
2278
2288
  }
2289
+ x;
2290
+ y;
2291
+ z;
2279
2292
  /**
2280
2293
  * Create a new Vector3D object from the first three elements of a Vector
2281
2294
  * object.
@@ -2473,6 +2486,7 @@ var Vector = class _Vector {
2473
2486
  this.elements = elements;
2474
2487
  this.length = elements.length;
2475
2488
  }
2489
+ elements;
2476
2490
  /**
2477
2491
  * The length of the vector.
2478
2492
  */
@@ -8593,6 +8607,12 @@ var CubicSpline = class {
8593
8607
  this.p1 = p1;
8594
8608
  this.m1 = m1;
8595
8609
  }
8610
+ t0;
8611
+ p0;
8612
+ m0;
8613
+ t1;
8614
+ p1;
8615
+ m1;
8596
8616
  // / Interpolate position at the provided time [t] _(POSIX seconds)_.
8597
8617
  position_(t) {
8598
8618
  const t2 = t * t;
@@ -8668,6 +8688,7 @@ var CubicSplineInterpolator = class _CubicSplineInterpolator extends StateInterp
8668
8688
  super();
8669
8689
  this.splines_ = splines_;
8670
8690
  }
8691
+ splines_;
8671
8692
  static fromEphemeris(ephemeris) {
8672
8693
  const splines = [];
8673
8694
  for (let i = 0; i < ephemeris.length - 1; i++) {
@@ -8867,6 +8888,7 @@ var VerletBlendInterpolator = class _VerletBlendInterpolator extends StateInterp
8867
8888
  super();
8868
8889
  this.ephemeris = ephemeris;
8869
8890
  }
8891
+ ephemeris;
8870
8892
  get sizeBytes() {
8871
8893
  return 64 * 7 * this.ephemeris.length / 8;
8872
8894
  }
@@ -9026,6 +9048,7 @@ var OemParser = class _OemParser {
9026
9048
  let currentBlock = null;
9027
9049
  let currentMetadata = {};
9028
9050
  let metadataComments = [];
9051
+ let userDefined = {};
9029
9052
  let inMeta = false;
9030
9053
  let inData = false;
9031
9054
  let inCovariance = false;
@@ -9034,6 +9057,7 @@ var OemParser = class _OemParser {
9034
9057
  if (line === "META_START") {
9035
9058
  currentMetadata = {};
9036
9059
  metadataComments = [];
9060
+ userDefined = {};
9037
9061
  inMeta = true;
9038
9062
  continue;
9039
9063
  }
@@ -9041,6 +9065,9 @@ var OemParser = class _OemParser {
9041
9065
  if (metadataComments.length > 0) {
9042
9066
  currentMetadata.COMMENT = metadataComments;
9043
9067
  }
9068
+ if (Object.keys(userDefined).length > 0) {
9069
+ currentMetadata.USER_DEFINED = userDefined;
9070
+ }
9044
9071
  currentBlock = {
9045
9072
  metadata: currentMetadata,
9046
9073
  ephemeris: []
@@ -9079,7 +9106,9 @@ var OemParser = class _OemParser {
9079
9106
  const eqIndex = line.indexOf("=");
9080
9107
  const key = line.substring(0, eqIndex).trim();
9081
9108
  const value = line.substring(eqIndex + 1).trim();
9082
- if (key === "INTERPOLATION_DEGREE") {
9109
+ if (key.startsWith("USER_DEFINED_")) {
9110
+ userDefined[key.substring(13)] = value;
9111
+ } else if (key === "INTERPOLATION_DEGREE") {
9083
9112
  currentMetadata[key] = parseInt(value, 10);
9084
9113
  } else {
9085
9114
  currentMetadata[key] = value;
@@ -13527,6 +13556,11 @@ var Thrust = class {
13527
13556
  crosstrack * 1e-3
13528
13557
  );
13529
13558
  }
13559
+ center;
13560
+ radial;
13561
+ intrack;
13562
+ crosstrack;
13563
+ durationRate;
13530
13564
  deltaV;
13531
13565
  get magnitude() {
13532
13566
  return this.deltaV.magnitude() * 1e3;
@@ -13565,6 +13599,9 @@ var Hill = class _Hill {
13565
13599
  this.semimajorAxis_ = semimajorAxis;
13566
13600
  this.meanMotion_ = Earth.smaToMeanMotion(this.semimajorAxis_);
13567
13601
  }
13602
+ epoch;
13603
+ position;
13604
+ velocity;
13568
13605
  semimajorAxis_;
13569
13606
  meanMotion_;
13570
13607
  static fromState(origin, radialPosition, intrackPosition, nodeVelocity, nodeOffsetTime) {
@@ -14520,15 +14557,21 @@ ${this.line2}`;
14520
14557
  const line1 = _Tle.parseLine1(tleLine1);
14521
14558
  const line2 = _Tle.parseLine2(tleLine2);
14522
14559
  if (line1.satNum !== line2.satNum) {
14560
+ console.info("Line 1 satNum:", line1.satNum);
14561
+ console.info("Line 2 satNum:", line2.satNum);
14523
14562
  throw new ParseError("Satellite numbers do not match between TLE lines", "TLE");
14524
14563
  }
14525
14564
  if (line1.satNumRaw !== line2.satNumRaw) {
14565
+ console.info("Line 1 satNumRaw:", line1.satNumRaw);
14566
+ console.info("Line 2 satNumRaw:", line2.satNumRaw);
14526
14567
  throw new ParseError("Raw satellite numbers do not match between TLE lines", "TLE");
14527
14568
  }
14528
14569
  if (line1.lineNumber1 !== 1) {
14570
+ console.info("Line 1 line number:", line1.lineNumber1);
14529
14571
  throw new ParseError("First TLE line number must be 1", "TLE");
14530
14572
  }
14531
14573
  if (line2.lineNumber2 !== 2) {
14574
+ console.info("Line 2 line number:", line2.lineNumber2);
14532
14575
  throw new ParseError("Second TLE line number must be 2", "TLE");
14533
14576
  }
14534
14577
  return {
@@ -14574,9 +14617,44 @@ ${this.line2}`;
14574
14617
  return { ...line1, ...line2 };
14575
14618
  }
14576
14619
  /**
14577
- * Converts a 6 digit SCC number to a 5 digit SCC alpha 5 number
14578
- * @param sccNum The 6 digit SCC number
14579
- * @returns The 5 digit SCC alpha 5 number
14620
+ * Classifies a satellite catalog number by representation. See {@link SatNumKind}.
14621
+ * Pure function; no side effects.
14622
+ * @param sccNum The catalog number string.
14623
+ * @returns The {@link SatNumKind} describing the input.
14624
+ */
14625
+ static classifySatNum(sccNum) {
14626
+ if (typeof sccNum !== "string") {
14627
+ return "invalid";
14628
+ }
14629
+ const trimmed = sccNum.trim();
14630
+ if (trimmed.length === 0) {
14631
+ return "invalid";
14632
+ }
14633
+ const first = trimmed[0];
14634
+ if (trimmed.length === 5 && first in _Tle.alpha5_) {
14635
+ return /^\d{4}$/u.test(trimmed.slice(1)) ? "alpha5" : "invalid";
14636
+ }
14637
+ if (!/^\d+$/u.test(trimmed)) {
14638
+ return "invalid";
14639
+ }
14640
+ if (trimmed.length <= 5) {
14641
+ return "numeric5";
14642
+ }
14643
+ if (trimmed.length === 6) {
14644
+ return parseInt(trimmed, 10) <= 339999 ? "numeric6" : "extended";
14645
+ }
14646
+ return "extended";
14647
+ }
14648
+ /**
14649
+ * Converts a 6-digit numeric SCC number to its 5-character alpha-5 form.
14650
+ *
14651
+ * Inputs shorter than 6 chars or already in alpha-5 form pass through unchanged.
14652
+ *
14653
+ * @param sccNum The SCC number to convert.
14654
+ * @returns The 5-character alpha-5 representation.
14655
+ * @throws {ValidationError} If `sccNum` exceeds the alpha-5 range (numeric value > 339 999,
14656
+ * or length > 6). For such IDs the canonical value should be kept on
14657
+ * `Satellite.sccNum` and the TLE column populated with the last 5 digits.
14580
14658
  */
14581
14659
  static convert6DigitToA5(sccNum) {
14582
14660
  if (sccNum.length < 6) {
@@ -14585,9 +14663,27 @@ ${this.line2}`;
14585
14663
  if (typeof sccNum[0] !== "string") {
14586
14664
  throw new ParseError("Invalid SCC number format", "TLE");
14587
14665
  }
14666
+ if (sccNum.length > 6) {
14667
+ throw new ValidationError(
14668
+ "SCC number exceeds TLE alpha-5 capacity (max 339999); use Satellite.sccNum for the canonical ID",
14669
+ "sccNum",
14670
+ sccNum
14671
+ );
14672
+ }
14588
14673
  if (RegExp(/[A-Z]/iu, "u").test(sccNum[0])) {
14589
14674
  return sccNum;
14590
14675
  }
14676
+ const numericValue = parseInt(sccNum, 10);
14677
+ if (isNaN(numericValue)) {
14678
+ throw new ValidationError("SCC number must be numeric", "sccNum", sccNum);
14679
+ }
14680
+ if (numericValue > 339999) {
14681
+ throw new ValidationError(
14682
+ "SCC number exceeds TLE alpha-5 capacity (max 339999); use Satellite.sccNum for the canonical ID",
14683
+ "sccNum",
14684
+ sccNum
14685
+ );
14686
+ }
14591
14687
  const rest = sccNum.slice(2, 6);
14592
14688
  let first = parseInt(`${sccNum[0]}${sccNum[1]}`);
14593
14689
  const iPlus = first >= 18 ? 1 : 0;
@@ -14596,9 +14692,17 @@ ${this.line2}`;
14596
14692
  return `${String.fromCharCode(first + 55)}${rest}`;
14597
14693
  }
14598
14694
  /**
14599
- * Converts a 5-digit SCC number to a 6-digit SCC number.
14600
- * @param sccNum - The 5-digit SCC number to convert.
14601
- * @returns The converted 6-digit SCC number.
14695
+ * Converts a 5-character alpha-5 SCC number to its 6-digit numeric form.
14696
+ *
14697
+ * Inputs shorter than 5 chars pass through unchanged. Numeric inputs without
14698
+ * an alpha-5 leading letter pass through unchanged (5-digit numeric, in-range
14699
+ * 6-digit numeric, and extended 7+ digit numeric IDs are all identity).
14700
+ *
14701
+ * @param sccNum The SCC number to convert.
14702
+ * @returns The 6-digit numeric representation, or the input itself if it
14703
+ * is already a numeric form.
14704
+ * @throws {ValidationError} If `sccNum` is malformed: 6-digit numeric whose
14705
+ * value exceeds 339 999, or contains stray letters in a non-leading position.
14602
14706
  */
14603
14707
  static convertA5to6Digit(sccNum) {
14604
14708
  if (sccNum.length < 5) {
@@ -14609,10 +14713,33 @@ ${this.line2}`;
14609
14713
  throw new ParseError("Invalid SCC number format", "TLE");
14610
14714
  }
14611
14715
  if (values[0] in _Tle.alpha5_) {
14716
+ if (!/^\d+$/u.test(sccNum.slice(1))) {
14717
+ throw new ValidationError(
14718
+ "Alpha-5 SCC number must have 4 trailing digits",
14719
+ "sccNum",
14720
+ sccNum
14721
+ );
14722
+ }
14612
14723
  const firstLetter = values[0];
14613
14724
  values[0] = _Tle.alpha5_[firstLetter];
14725
+ return values.join("");
14726
+ }
14727
+ if (!/^\s*\d+\s*$/u.test(sccNum)) {
14728
+ throw new ValidationError(
14729
+ "SCC number must be alpha-5 or all-numeric",
14730
+ "sccNum",
14731
+ sccNum
14732
+ );
14614
14733
  }
14615
- return values.join("");
14734
+ const trimmed = sccNum.trim();
14735
+ if (trimmed.length === 6 && parseInt(trimmed, 10) > 339999) {
14736
+ throw new ValidationError(
14737
+ "6-digit SCC number exceeds TLE alpha-5 capacity (max 339999)",
14738
+ "sccNum",
14739
+ sccNum
14740
+ );
14741
+ }
14742
+ return sccNum;
14616
14743
  }
14617
14744
  };
14618
14745
 
@@ -14834,6 +14961,9 @@ var SolarRadiationPressure = class _SolarRadiationPressure extends Force {
14834
14961
  this.area = area;
14835
14962
  this.reflectCoeff = reflectCoeff;
14836
14963
  }
14964
+ mass;
14965
+ area;
14966
+ reflectCoeff;
14837
14967
  // / Solar pressure _(N/m²)_;
14838
14968
  static _kRef = 456e-8 * KM_PER_AU ** 2;
14839
14969
  acceleration(state) {
@@ -15216,6 +15346,8 @@ var ThirdBodyGravity = class _ThirdBodyGravity {
15216
15346
  this.moon = moon;
15217
15347
  this.sun = sun;
15218
15348
  }
15349
+ moon;
15350
+ sun;
15219
15351
  static moonGravity_(state) {
15220
15352
  const rMoon = Moon.eci(state.epoch.toDateTime());
15221
15353
  const aNum = rMoon.subtract(state.position);
@@ -15318,6 +15450,13 @@ var RAE = class _RAE {
15318
15450
  this.azRateRad = azRateRad;
15319
15451
  this.elRateRad = elRateRad;
15320
15452
  }
15453
+ epoch;
15454
+ rng;
15455
+ azRad;
15456
+ elRad;
15457
+ rngRate;
15458
+ azRateRad;
15459
+ elRateRad;
15321
15460
  // / Create a new [Razel] object, using degrees for the angular values.
15322
15461
  static fromDegrees(epoch, range, azimuth, elevation, rangeRate, azimuthRate, elevationRate) {
15323
15462
  const azimuthRateRad = azimuthRate ? azimuthRate * DEG2RAD : void 0;
@@ -15786,6 +15925,9 @@ var RungeKuttaAdaptive = class _RungeKuttaAdaptive extends Propagator {
15786
15925
  this._cacheState = this.initState_;
15787
15926
  this.tolerance_ = Math.max(_RungeKuttaAdaptive._minTolerance, Math.abs(tolerance_));
15788
15927
  }
15928
+ initState_;
15929
+ forceModel_;
15930
+ tolerance_;
15789
15931
  // / Initial state vector.
15790
15932
  _cacheState;
15791
15933
  _checkpoints = [];
@@ -16081,6 +16223,11 @@ var RungeKutta4Propagator = class extends Propagator {
16081
16223
  this.checkpoints_ = checkpoints_;
16082
16224
  this.stepSize_ = Math.abs(stepSize_);
16083
16225
  }
16226
+ initState_;
16227
+ forceModel_;
16228
+ stepSize_;
16229
+ cacheState_;
16230
+ checkpoints_;
16084
16231
  // / Set the integrator step size to the provided number of [seconds].
16085
16232
  setStepSize(seconds) {
16086
16233
  this.stepSize_ = Math.abs(seconds);
@@ -16409,6 +16556,7 @@ var Sgp4Propagator = class extends Propagator {
16409
16556
  this.tle_ = tle_;
16410
16557
  this.cacheState_ = tle_.state.toJ2000();
16411
16558
  }
16559
+ tle_;
16412
16560
  cacheState_;
16413
16561
  checkpoints_ = [];
16414
16562
  /**
@@ -16495,11 +16643,15 @@ var Satellite = class _Satellite extends SpaceObject {
16495
16643
  period;
16496
16644
  rightAscension;
16497
16645
  satrec;
16498
- /** The satellite catalog number as listed in the TLE. */
16646
+ /** The canonical satellite catalog number. May be a 5-digit numeric, alpha-5,
16647
+ * 6-digit numeric, or an extended (7+ digit) ID such as CelesTrak supplemental
16648
+ * 9-digit IDs. */
16499
16649
  sccNum;
16500
- /** The 5 digit alpha-numeric satellite catalog number. */
16650
+ /** The 5-character alpha-5 representation, or `null` when {@link sccNum} is
16651
+ * an extended ID that exceeds the alpha-5 capacity (max numeric value 339 999). */
16501
16652
  sccNum5;
16502
- /** The 6 digit numeric satellite catalog number. */
16653
+ /** The 6-digit numeric representation, or `null` when {@link sccNum} is
16654
+ * an extended ID that exceeds the alpha-5 capacity (max numeric value 339 999). */
16503
16655
  sccNum6;
16504
16656
  tle1;
16505
16657
  tle2;
@@ -16681,13 +16833,42 @@ var Satellite = class _Satellite extends SpaceObject {
16681
16833
  return new _Satellite({ omm, name: name ?? omm.OBJECT_NAME });
16682
16834
  }
16683
16835
  // ==================== TLE/OMM Parsing ====================
16836
+ /**
16837
+ * Converts an OMM international designator (e.g. `"2026-114A"`) to the
16838
+ * TLE intl-des column format (cols 10-17, e.g. `"26114A"`). Inputs that
16839
+ * don't match the OMM `YYYY-NNNL...` pattern pass through unchanged.
16840
+ */
16841
+ static ommObjectIdToTleIntlDes_(objectId) {
16842
+ if (!objectId) {
16843
+ return "";
16844
+ }
16845
+ const match = objectId.match(/^\d{4}-(?<rest>\d{3}[A-Z]{1,3})$/u);
16846
+ if (match?.groups?.rest) {
16847
+ return objectId.slice(2, 4) + match.groups.rest;
16848
+ }
16849
+ return objectId;
16850
+ }
16851
+ /**
16852
+ * Derives {@link sccNum5} and {@link sccNum6} from {@link sccNum}. When the
16853
+ * canonical ID is an extended (7+ digit) value that exceeds the TLE alpha-5
16854
+ * capacity (max 339 999), both forms are set to `null`.
16855
+ */
16856
+ assignAlpha5Forms_() {
16857
+ const kind = Tle.classifySatNum(this.sccNum);
16858
+ if (kind === "numeric5" || kind === "alpha5" || kind === "numeric6") {
16859
+ this.sccNum5 = Tle.convert6DigitToA5(this.sccNum);
16860
+ this.sccNum6 = Tle.convertA5to6Digit(this.sccNum5);
16861
+ } else {
16862
+ this.sccNum5 = null;
16863
+ this.sccNum6 = null;
16864
+ }
16865
+ }
16684
16866
  parseTleAndUpdateOrbit_(tle1, tle2, sccNum) {
16685
16867
  const tleData = Tle.parse(tle1, tle2);
16686
16868
  this.tle1 = tle1;
16687
16869
  this.tle2 = tle2;
16688
16870
  this.sccNum = sccNum ?? tleData.satNum.toString();
16689
- this.sccNum5 = Tle.convert6DigitToA5(this.sccNum);
16690
- this.sccNum6 = Tle.convertA5to6Digit(this.sccNum5);
16871
+ this.assignAlpha5Forms_();
16691
16872
  this.intlDes = tleData.intlDes;
16692
16873
  this.epochYear = tleData.epochYear;
16693
16874
  this.epochDay = tleData.epochDay;
@@ -16710,8 +16891,7 @@ var Satellite = class _Satellite extends SpaceObject {
16710
16891
  parseOmmAndUpdateOrbit_(omm) {
16711
16892
  const noradStr = String(omm.NORAD_CAT_ID);
16712
16893
  this.sccNum = noradStr.padStart(5, "0");
16713
- this.sccNum5 = Tle.convert6DigitToA5(noradStr);
16714
- this.sccNum6 = Tle.convertA5to6Digit(this.sccNum5);
16894
+ this.assignAlpha5Forms_();
16715
16895
  this.intlDes = omm.OBJECT_ID;
16716
16896
  const YYYY = omm.EPOCH.slice(0, 4);
16717
16897
  const MM = omm.EPOCH.slice(5, 7);
@@ -16771,8 +16951,10 @@ var Satellite = class _Satellite extends SpaceObject {
16771
16951
  ecen: this.eccentricity,
16772
16952
  epochyr: this.epochYear,
16773
16953
  epochday: this.epochDay,
16774
- intl: omm.OBJECT_ID,
16775
- scc: this.sccNum,
16954
+ intl: _Satellite.ommObjectIdToTleIntlDes_(omm.OBJECT_ID),
16955
+ // Extended (7+ digit) IDs don't fit TLE cols 3-7. Truncate to the last 5
16956
+ // digits for the TLE string; the canonical ID stays on this.sccNum.
16957
+ scc: Tle.classifySatNum(this.sccNum) === "extended" ? this.sccNum.slice(-5) : this.sccNum,
16776
16958
  bstar: this.bstar,
16777
16959
  meanMotionDot: this.meanMoDev1,
16778
16960
  meanMotionDdot: this.meanMoDev2,
@@ -19117,6 +19299,13 @@ var RadecGeocentric = class _RadecGeocentric {
19117
19299
  this.declinationRate = declinationRate;
19118
19300
  this.rangeRate = rangeRate;
19119
19301
  }
19302
+ epoch;
19303
+ rightAscension;
19304
+ declination;
19305
+ range;
19306
+ rightAscensionRate;
19307
+ declinationRate;
19308
+ rangeRate;
19120
19309
  /**
19121
19310
  * Creates a RadecGeocentric object from the given parameters in degrees.
19122
19311
  * @param epoch - The epoch in UTC.
@@ -19259,6 +19448,13 @@ var RadecTopocentric = class _RadecTopocentric {
19259
19448
  this.declinationRate = declinationRate;
19260
19449
  this.rangeRate = rangeRate;
19261
19450
  }
19451
+ epoch;
19452
+ rightAscension;
19453
+ declination;
19454
+ range;
19455
+ rightAscensionRate;
19456
+ declinationRate;
19457
+ rangeRate;
19262
19458
  /**
19263
19459
  * Create a new RadecTopocentric object, using degrees for the angular values.
19264
19460
  * @param epoch UTC epoch.
@@ -19816,6 +20012,8 @@ var RkCheckpoint = class {
19816
20012
  this.cacheState = cacheState;
19817
20013
  this.stepSize = stepSize;
19818
20014
  }
20015
+ cacheState;
20016
+ stepSize;
19819
20017
  };
19820
20018
 
19821
20019
  // src/propagator/RkResult.ts
@@ -19826,6 +20024,9 @@ var RkResult = class {
19826
20024
  this.error = error;
19827
20025
  this.newStep = newStep;
19828
20026
  }
20027
+ state;
20028
+ error;
20029
+ newStep;
19829
20030
  };
19830
20031
 
19831
20032
  // src/covariance/StateCovariance.ts
@@ -19846,6 +20047,8 @@ var StateCovariance = class _StateCovariance {
19846
20047
  this.matrix = matrix;
19847
20048
  this.frame = frame;
19848
20049
  }
20050
+ matrix;
20051
+ frame;
19849
20052
  // / Create a new [StateCovariance] object from 1-sigma values.
19850
20053
  static fromSigmas(sigmas, frame) {
19851
20054
  const n = sigmas.length;
@@ -19876,6 +20079,8 @@ var PropagatorPairs = class {
19876
20079
  this.posStep_ = posStep_;
19877
20080
  this.velStep_ = velStep_;
19878
20081
  }
20082
+ posStep_;
20083
+ velStep_;
19879
20084
  _high = Array(6).fill(null);
19880
20085
  _low = Array(6).fill(null);
19881
20086
  set(index, high, low) {
@@ -19909,6 +20114,9 @@ var BatchLeastSquaresResult = class {
19909
20114
  this.covariance = covariance2;
19910
20115
  this.rms = rms;
19911
20116
  }
20117
+ state;
20118
+ covariance;
20119
+ rms;
19912
20120
  };
19913
20121
 
19914
20122
  // src/orbit-determination/BatchLeastSquaresOD.ts
@@ -19939,6 +20147,12 @@ var BatchLeastSquaresOD = class _BatchLeastSquaresOD {
19939
20147
  this.propagator_ = new RungeKutta89Propagator(this.apriori_, this.forceModel_);
19940
20148
  this.nominal_ = this.propagator_.propagate(this.start_);
19941
20149
  }
20150
+ observations_;
20151
+ apriori_;
20152
+ forceModel_;
20153
+ posStep_;
20154
+ velStep_;
20155
+ fastDerivatives_;
19942
20156
  /** Propagator pair cache, for generating observation Jacobians. */
19943
20157
  propPairs_;
19944
20158
  /** Nominal state propagator. */
@@ -20039,6 +20253,7 @@ var GibbsIOD = class _GibbsIOD {
20039
20253
  constructor(mu = Earth.mu) {
20040
20254
  this.mu = mu;
20041
20255
  }
20256
+ mu;
20042
20257
  /** Abort solve if position plane exceeds this value. */
20043
20258
  static coplanarThreshold_ = 5 * DEG2RAD;
20044
20259
  /**
@@ -20097,6 +20312,7 @@ var HerrickGibbsIOD = class {
20097
20312
  constructor(mu = Earth.mu) {
20098
20313
  this.mu = mu;
20099
20314
  }
20315
+ mu;
20100
20316
  // / Attempt to create a state estimate from three inertial position vectors.
20101
20317
  solve(r1, t1, r2, t2, r3, t3) {
20102
20318
  const dt31 = t3.difference(t1);
@@ -20357,6 +20573,7 @@ var LambertIOD = class _LambertIOD {
20357
20573
  constructor(mu = Earth.mu) {
20358
20574
  this.mu = mu;
20359
20575
  }
20576
+ mu;
20360
20577
  /**
20361
20578
  * Try to guess the short path argument given an [interceptor] and
20362
20579
  * [target] state.
@@ -21044,6 +21261,11 @@ var LevenbergMarquardtResult = class {
21044
21261
  this.iterations = iterations;
21045
21262
  this.converged = converged;
21046
21263
  }
21264
+ state;
21265
+ covariance;
21266
+ rms;
21267
+ iterations;
21268
+ converged;
21047
21269
  };
21048
21270
 
21049
21271
  // src/orbit-determination/LevenbergMarquardtOD.ts
@@ -21074,6 +21296,12 @@ var LevenbergMarquardtOD = class _LevenbergMarquardtOD {
21074
21296
  const propagator = new RungeKutta89Propagator(this.apriori_, this.forceModel_);
21075
21297
  this.nominal_ = propagator.propagate(this.start_);
21076
21298
  }
21299
+ observations_;
21300
+ apriori_;
21301
+ forceModel_;
21302
+ posStep_;
21303
+ velStep_;
21304
+ fastDerivatives_;
21077
21305
  /** Propagator pair cache, for generating observation Jacobians. */
21078
21306
  propPairs_;
21079
21307
  /** State estimate during solve. */
@@ -21232,6 +21460,8 @@ var SimplexEntry = class _SimplexEntry {
21232
21460
  this.x_ = new Vector(points);
21233
21461
  this.score = this.f_(points);
21234
21462
  }
21463
+ f_;
21464
+ points;
21235
21465
  /**
21236
21466
  * The cost function score at this vertex.
21237
21467
  *
@@ -21764,6 +21994,8 @@ var ConjunctionAssessment = class {
21764
21994
  this.primaryProp = this.createPropagator(primary, false);
21765
21995
  this.secondaryProp = this.createPropagator(secondary, false);
21766
21996
  }
21997
+ primary;
21998
+ secondary;
21767
21999
  primaryProp;
21768
22000
  secondaryProp;
21769
22001
  primaryCovSample;
@@ -23209,6 +23441,9 @@ var ObservationRadar = class _ObservationRadar extends Observation {
23209
23441
  this.observation = observation;
23210
23442
  this.noise_ = noise_;
23211
23443
  }
23444
+ site_;
23445
+ observation;
23446
+ noise_;
23212
23447
  // / Default noise matrix.
23213
23448
  static defaultNoise = _ObservationRadar.noiseFromSigmas(0.32, 0.015 * DEG2RAD, 0.015 * DEG2RAD);
23214
23449
  get epoch() {
@@ -23698,6 +23933,9 @@ var ObservationOptical = class _ObservationOptical extends Observation {
23698
23933
  this.observation = observation;
23699
23934
  this.noise_ = noise_;
23700
23935
  }
23936
+ site_;
23937
+ observation;
23938
+ noise_;
23701
23939
  // / Inertial site location.
23702
23940
  get site() {
23703
23941
  return this.site_;
@@ -24180,12 +24418,12 @@ var HorizonsParser = class {
24180
24418
  for (let i = 0; i < lines.length; i++) {
24181
24419
  const line = lines[i].trim();
24182
24420
  if (line.startsWith("Target body name:")) {
24183
- targetName = this.extractValue_(line, "Target body name:");
24421
+ targetName = this.extractTargetName_(line, "Target body name:");
24184
24422
  metadata.targetName = targetName;
24185
24423
  } else if (line.startsWith("Center body name:")) {
24186
24424
  centerBody = this.extractValue_(line, "Center body name:");
24187
24425
  metadata.centerBody = centerBody;
24188
- } else if (line.startsWith("Center-site name:")) {
24426
+ } else if (line.startsWith("Center-site name:") && !centerBody) {
24189
24427
  centerBody = this.extractValue_(line, "Center-site name:");
24190
24428
  metadata.centerBody = centerBody;
24191
24429
  } else if (line.startsWith("Output type:")) {
@@ -24240,7 +24478,7 @@ var HorizonsParser = class {
24240
24478
  for (let i = 0; i < lines.length; i++) {
24241
24479
  const line = lines[i].trim();
24242
24480
  if (line.startsWith("Target body name:")) {
24243
- targetName = this.extractValue_(line, "Target body name:");
24481
+ targetName = this.extractTargetName_(line, "Target body name:");
24244
24482
  } else if (line.startsWith("Center-site name:")) {
24245
24483
  observerLocation = this.extractValue_(line, "Center-site name:");
24246
24484
  }
@@ -24271,7 +24509,23 @@ var HorizonsParser = class {
24271
24509
  */
24272
24510
  static extractValue_(line, key) {
24273
24511
  const value = line.substring(key.length).trim();
24274
- return value.split(/\s{2,}/)[0].trim();
24512
+ return value.split(/\s{2,}/u)[0].trim();
24513
+ }
24514
+ /**
24515
+ * Extracts the target body name, stripping parenthetical descriptors and IDs.
24516
+ *
24517
+ * Horizons format examples:
24518
+ * - "1 Ceres {source: astDys}" → "1 Ceres"
24519
+ * - "Artemis II (spacecraft) (-1024) {source: ...}" → "Artemis II"
24520
+ * - "Mars (499)" → "Mars"
24521
+ */
24522
+ static extractTargetName_(line, key) {
24523
+ const raw = this.extractValue_(line, key);
24524
+ const parenIdx = raw.search(/\s\(/u);
24525
+ if (parenIdx > 0) {
24526
+ return raw.substring(0, parenIdx).trim();
24527
+ }
24528
+ return raw;
24275
24529
  }
24276
24530
  /**
24277
24531
  * Parses a vector data line from Horizons output.
@@ -24341,7 +24595,9 @@ var HorizonsParser = class {
24341
24595
  return null;
24342
24596
  }
24343
24597
  const posLine = allLines[nextIndex].trim();
24344
- const posMatch = posLine.match(/X\s*=\s*([-\d.E+]+)\s+Y\s*=\s*([-\d.E+]+)\s+Z\s*=\s*([-\d.E+]+)/i);
24598
+ const posMatchLabeled = posLine.match(/X\s*=\s*([-\d.E+]+)\s+Y\s*=\s*([-\d.E+]+)\s+Z\s*=\s*([-\d.E+]+)/iu);
24599
+ const posMatchBare = !posMatchLabeled ? posLine.match(/^\s*([-\d.E+]+)\s+([-\d.E+]+)\s+([-\d.E+]+)\s*$/iu) : null;
24600
+ const posMatch = posMatchLabeled ?? posMatchBare;
24345
24601
  if (!posMatch) {
24346
24602
  return null;
24347
24603
  }
@@ -24353,7 +24609,9 @@ var HorizonsParser = class {
24353
24609
  let velocity;
24354
24610
  if (nextIndex < allLines.length) {
24355
24611
  const velLine = allLines[nextIndex].trim();
24356
- const velMatch = velLine.match(/VX\s*=\s*([-\d.E+]+)\s+VY\s*=\s*([-\d.E+]+)\s+VZ\s*=\s*([-\d.E+]+)/i);
24612
+ const velMatchLabeled = velLine.match(/VX\s*=\s*([-\d.E+]+)\s+VY\s*=\s*([-\d.E+]+)\s+VZ\s*=\s*([-\d.E+]+)/iu);
24613
+ const velMatchBare = !velMatchLabeled ? velLine.match(/^\s*([-\d.E+]+)\s+([-\d.E+]+)\s+([-\d.E+]+)\s*$/iu) : null;
24614
+ const velMatch = velMatchLabeled ?? velMatchBare;
24357
24615
  if (velMatch) {
24358
24616
  velocity = new Vector3D(
24359
24617
  parseFloat(velMatch[1]),
@@ -24363,6 +24621,17 @@ var HorizonsParser = class {
24363
24621
  nextIndex++;
24364
24622
  }
24365
24623
  }
24624
+ while (nextIndex < allLines.length) {
24625
+ const extraLine = allLines[nextIndex].trim();
24626
+ if (extraLine === "$$EOE" || extraLine.length === 0 || /^\d+\.\d+\s*=\s*A\.D\./u.test(extraLine)) {
24627
+ break;
24628
+ }
24629
+ if (/^\s*[-\d.E+]+(\s+[-\d.E+]+)*\s*$/u.test(extraLine)) {
24630
+ nextIndex++;
24631
+ } else {
24632
+ break;
24633
+ }
24634
+ }
24366
24635
  return {
24367
24636
  data: { epoch, position, velocity },
24368
24637
  nextIndex
@@ -25109,6 +25378,58 @@ var OdmExporter = class _OdmExporter {
25109
25378
  return lines.join("\n");
25110
25379
  }
25111
25380
  // ==========================================================================
25381
+ // OEM from State Vectors — direct J2000 array export
25382
+ // ==========================================================================
25383
+ /**
25384
+ * Export an array of J2000 state vectors as OEM KVN.
25385
+ *
25386
+ * Unlike {@link formatOem}, which propagates a TLE-based satellite, this
25387
+ * method serializes pre-computed state vectors directly. Useful for
25388
+ * converting parsed ephemeris data (e.g., NASA Horizons) to CCSDS OEM.
25389
+ *
25390
+ * @param stateVectors - Array of J2000 state vectors to export
25391
+ * @param metadata - Object identification metadata
25392
+ * @param options - Export configuration
25393
+ * @returns OEM KVN format string
25394
+ */
25395
+ static formatOemFromStateVectors(stateVectors, metadata, options = {}) {
25396
+ if (stateVectors.length === 0) {
25397
+ throw new Error("Cannot export OEM with no state vectors");
25398
+ }
25399
+ const refFrame = options.refFrame ?? "EME2000";
25400
+ const centerName = options.centerName ?? "EARTH";
25401
+ const startTime = stateVectors[0].epoch.toDateTime();
25402
+ const stopTime = stateVectors[stateVectors.length - 1].epoch.toDateTime();
25403
+ const lines = [];
25404
+ lines.push("CCSDS_OEM_VERS = 2.0");
25405
+ _OdmExporter.appendComments_(lines, options.comments);
25406
+ lines.push(`CREATION_DATE = ${_OdmExporter.formatDateTime_(/* @__PURE__ */ new Date())}`);
25407
+ lines.push(`ORIGINATOR = ${options.originator ?? "KeepTrack"}`);
25408
+ if (options.messageId) {
25409
+ lines.push(`MESSAGE_ID = ${options.messageId}`);
25410
+ }
25411
+ lines.push("");
25412
+ lines.push("META_START");
25413
+ lines.push(`OBJECT_NAME = ${metadata.objectName}`);
25414
+ lines.push(`OBJECT_ID = ${metadata.objectId}`);
25415
+ lines.push(`CENTER_NAME = ${centerName}`);
25416
+ lines.push(`REF_FRAME = ${refFrame}`);
25417
+ lines.push("TIME_SYSTEM = UTC");
25418
+ lines.push(`START_TIME = ${_OdmExporter.formatDateTime_(startTime)}`);
25419
+ lines.push(`STOP_TIME = ${_OdmExporter.formatDateTime_(stopTime)}`);
25420
+ lines.push(`INTERPOLATION = ${options.interpolation ?? "LAGRANGE"}`);
25421
+ lines.push(`INTERPOLATION_DEGREE = ${options.interpolationDegree ?? 7}`);
25422
+ lines.push("META_STOP");
25423
+ lines.push("");
25424
+ for (const sv of stateVectors) {
25425
+ const epoch = _OdmExporter.formatDateTime_(sv.epoch.toDateTime());
25426
+ lines.push(
25427
+ `${epoch} ${_OdmExporter.formatNumber_(sv.position.x)} ${_OdmExporter.formatNumber_(sv.position.y)} ${_OdmExporter.formatNumber_(sv.position.z)} ${_OdmExporter.formatNumber_(sv.velocity.x)} ${_OdmExporter.formatNumber_(sv.velocity.y)} ${_OdmExporter.formatNumber_(sv.velocity.z)}`
25428
+ );
25429
+ }
25430
+ return lines.join("\n");
25431
+ }
25432
+ // ==========================================================================
25112
25433
  // OMM — Orbit Mean-Elements Message
25113
25434
  // ==========================================================================
25114
25435
  /**
@@ -26908,6 +27229,11 @@ var ChebyshevCoefficients = class _ChebyshevCoefficients {
26908
27229
  this.cyd_ = _ChebyshevCoefficients._derivative(a, b, cy_);
26909
27230
  this.czd_ = _ChebyshevCoefficients._derivative(a, b, cz_);
26910
27231
  }
27232
+ a;
27233
+ b;
27234
+ cx_;
27235
+ cy_;
27236
+ cz_;
26911
27237
  cxd_;
26912
27238
  cyd_;
26913
27239
  czd_;
@@ -27429,6 +27755,11 @@ var TwoBurnOrbitTransfer = class _TwoBurnOrbitTransfer {
27429
27755
  this.vTransB = vTransB;
27430
27756
  this.tTrans = tTrans;
27431
27757
  }
27758
+ vInit;
27759
+ vFinal;
27760
+ vTransA;
27761
+ vTransB;
27762
+ tTrans;
27432
27763
  /**
27433
27764
  * Calculates the parameters for a Hohmann transfer orbit between two circular orbits.
27434
27765
  * @param rInit The initial radius of the orbit. (km)
@@ -27481,6 +27812,7 @@ var ChebyshevCompressor = class _ChebyshevCompressor {
27481
27812
  constructor(interpolator_) {
27482
27813
  this.interpolator_ = interpolator_;
27483
27814
  }
27815
+ interpolator_;
27484
27816
  /** Returns the cosine of π times x. */
27485
27817
  static cosPi_(x) {
27486
27818
  return Math.cos(Math.PI * x);
@@ -27721,6 +28053,8 @@ var SimpleLinearRegression = class _SimpleLinearRegression {
27721
28053
  this.ys = ys;
27722
28054
  this.update();
27723
28055
  }
28056
+ xs;
28057
+ ys;
27724
28058
  /** Line slope (m in y = mx + b). */
27725
28059
  slope_ = 0;
27726
28060
  /** Y-axis intercept (b in y = mx + b). */