ootk 6.0.3 → 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,12 +83,15 @@ var AngularDistanceMethod = /* @__PURE__ */ ((AngularDistanceMethod2) => {
77
83
 
78
84
  // src/enums/CatalogSource.ts
79
85
  var CatalogSource = /* @__PURE__ */ ((CatalogSource2) => {
80
- CatalogSource2["USSF"] = "USSF";
81
- CatalogSource2["CELESTRAK"] = "Celestrak";
82
- CatalogSource2["UNIV_OF_MICH"] = "University of Michigan";
83
- CatalogSource2["CALPOLY"] = "CalPoly";
84
- CatalogSource2["NUSPACE"] = "NuSpace";
85
- CatalogSource2["VIMPEL"] = "JSC Vimpel";
86
+ CatalogSource2["UNKNOWN"] = "unknown";
87
+ CatalogSource2["USSF"] = "spacetrack";
88
+ CatalogSource2["CELESTRAK"] = "celestrak";
89
+ CatalogSource2["CELESTRAK_SUP"] = "celestrak-sup";
90
+ CatalogSource2["UNIV_OF_MICH"] = "univ-of-mich";
91
+ CatalogSource2["CALPOLY"] = "calpoly";
92
+ CatalogSource2["NUSPACE"] = "nuspace";
93
+ CatalogSource2["VIMPEL"] = "vimpel";
94
+ CatalogSource2["SATNOGS"] = "satnogs";
86
95
  CatalogSource2["TLE_TXT"] = "TLE.txt";
87
96
  CatalogSource2["EXTRA_JSON"] = "extra.json";
88
97
  return CatalogSource2;
@@ -269,10 +278,11 @@ var Epoch = class {
269
278
  */
270
279
  constructor(posix = Date.now() / 1e3) {
271
280
  this.posix = posix;
272
- if (posix < 0) {
273
- throw new ValidationError("Epoch posix time must be non-negative", "posix", posix);
281
+ if (Number.isNaN(posix)) {
282
+ throw new ValidationError("Epoch posix time must be a valid number", "posix", posix);
274
283
  }
275
284
  }
285
+ posix;
276
286
  toString() {
277
287
  return this.toDateTime().toISOString();
278
288
  }
@@ -1816,6 +1826,8 @@ var EpochGPS = class _EpochGPS {
1816
1826
  throw new ValidationError("GPS seconds must be between 0 and 604799", "seconds", seconds);
1817
1827
  }
1818
1828
  }
1829
+ week;
1830
+ seconds;
1819
1831
  /** Cached GPS reference epoch (1980-01-06T00:00:00.000Z) */
1820
1832
  static reference_ = null;
1821
1833
  /**
@@ -2274,6 +2286,9 @@ var Vector3D = class _Vector3D {
2274
2286
  this.y = y;
2275
2287
  this.z = z;
2276
2288
  }
2289
+ x;
2290
+ y;
2291
+ z;
2277
2292
  /**
2278
2293
  * Create a new Vector3D object from the first three elements of a Vector
2279
2294
  * object.
@@ -2471,6 +2486,7 @@ var Vector = class _Vector {
2471
2486
  this.elements = elements;
2472
2487
  this.length = elements.length;
2473
2488
  }
2489
+ elements;
2474
2490
  /**
2475
2491
  * The length of the vector.
2476
2492
  */
@@ -8591,6 +8607,12 @@ var CubicSpline = class {
8591
8607
  this.p1 = p1;
8592
8608
  this.m1 = m1;
8593
8609
  }
8610
+ t0;
8611
+ p0;
8612
+ m0;
8613
+ t1;
8614
+ p1;
8615
+ m1;
8594
8616
  // / Interpolate position at the provided time [t] _(POSIX seconds)_.
8595
8617
  position_(t) {
8596
8618
  const t2 = t * t;
@@ -8666,6 +8688,7 @@ var CubicSplineInterpolator = class _CubicSplineInterpolator extends StateInterp
8666
8688
  super();
8667
8689
  this.splines_ = splines_;
8668
8690
  }
8691
+ splines_;
8669
8692
  static fromEphemeris(ephemeris) {
8670
8693
  const splines = [];
8671
8694
  for (let i = 0; i < ephemeris.length - 1; i++) {
@@ -8865,6 +8888,7 @@ var VerletBlendInterpolator = class _VerletBlendInterpolator extends StateInterp
8865
8888
  super();
8866
8889
  this.ephemeris = ephemeris;
8867
8890
  }
8891
+ ephemeris;
8868
8892
  get sizeBytes() {
8869
8893
  return 64 * 7 * this.ephemeris.length / 8;
8870
8894
  }
@@ -9024,6 +9048,7 @@ var OemParser = class _OemParser {
9024
9048
  let currentBlock = null;
9025
9049
  let currentMetadata = {};
9026
9050
  let metadataComments = [];
9051
+ let userDefined = {};
9027
9052
  let inMeta = false;
9028
9053
  let inData = false;
9029
9054
  let inCovariance = false;
@@ -9032,6 +9057,7 @@ var OemParser = class _OemParser {
9032
9057
  if (line === "META_START") {
9033
9058
  currentMetadata = {};
9034
9059
  metadataComments = [];
9060
+ userDefined = {};
9035
9061
  inMeta = true;
9036
9062
  continue;
9037
9063
  }
@@ -9039,6 +9065,9 @@ var OemParser = class _OemParser {
9039
9065
  if (metadataComments.length > 0) {
9040
9066
  currentMetadata.COMMENT = metadataComments;
9041
9067
  }
9068
+ if (Object.keys(userDefined).length > 0) {
9069
+ currentMetadata.USER_DEFINED = userDefined;
9070
+ }
9042
9071
  currentBlock = {
9043
9072
  metadata: currentMetadata,
9044
9073
  ephemeris: []
@@ -9077,7 +9106,9 @@ var OemParser = class _OemParser {
9077
9106
  const eqIndex = line.indexOf("=");
9078
9107
  const key = line.substring(0, eqIndex).trim();
9079
9108
  const value = line.substring(eqIndex + 1).trim();
9080
- if (key === "INTERPOLATION_DEGREE") {
9109
+ if (key.startsWith("USER_DEFINED_")) {
9110
+ userDefined[key.substring(13)] = value;
9111
+ } else if (key === "INTERPOLATION_DEGREE") {
9081
9112
  currentMetadata[key] = parseInt(value, 10);
9082
9113
  } else {
9083
9114
  currentMetadata[key] = value;
@@ -13525,6 +13556,11 @@ var Thrust = class {
13525
13556
  crosstrack * 1e-3
13526
13557
  );
13527
13558
  }
13559
+ center;
13560
+ radial;
13561
+ intrack;
13562
+ crosstrack;
13563
+ durationRate;
13528
13564
  deltaV;
13529
13565
  get magnitude() {
13530
13566
  return this.deltaV.magnitude() * 1e3;
@@ -13563,6 +13599,9 @@ var Hill = class _Hill {
13563
13599
  this.semimajorAxis_ = semimajorAxis;
13564
13600
  this.meanMotion_ = Earth.smaToMeanMotion(this.semimajorAxis_);
13565
13601
  }
13602
+ epoch;
13603
+ position;
13604
+ velocity;
13566
13605
  semimajorAxis_;
13567
13606
  meanMotion_;
13568
13607
  static fromState(origin, radialPosition, intrackPosition, nodeVelocity, nodeOffsetTime) {
@@ -14118,7 +14157,7 @@ ${this.line2}`;
14118
14157
  let exponent = parseInt(tleLine1.substring(BSTAR_PART_4, _Tle.bstar_.stop));
14119
14158
  if (exponentSymbol === "-") {
14120
14159
  exponent *= -1;
14121
- } else if (exponentSymbol !== "+") {
14160
+ } else if (exponentSymbol !== "+" && exponentSymbol !== " " && exponentSymbol !== "0") {
14122
14161
  throw new ParseError(`Invalid BSTAR exponent symbol: ${exponentSymbol}`, "TLE");
14123
14162
  }
14124
14163
  bstar1 *= 10 ** exponent;
@@ -14518,15 +14557,21 @@ ${this.line2}`;
14518
14557
  const line1 = _Tle.parseLine1(tleLine1);
14519
14558
  const line2 = _Tle.parseLine2(tleLine2);
14520
14559
  if (line1.satNum !== line2.satNum) {
14560
+ console.info("Line 1 satNum:", line1.satNum);
14561
+ console.info("Line 2 satNum:", line2.satNum);
14521
14562
  throw new ParseError("Satellite numbers do not match between TLE lines", "TLE");
14522
14563
  }
14523
14564
  if (line1.satNumRaw !== line2.satNumRaw) {
14565
+ console.info("Line 1 satNumRaw:", line1.satNumRaw);
14566
+ console.info("Line 2 satNumRaw:", line2.satNumRaw);
14524
14567
  throw new ParseError("Raw satellite numbers do not match between TLE lines", "TLE");
14525
14568
  }
14526
14569
  if (line1.lineNumber1 !== 1) {
14570
+ console.info("Line 1 line number:", line1.lineNumber1);
14527
14571
  throw new ParseError("First TLE line number must be 1", "TLE");
14528
14572
  }
14529
14573
  if (line2.lineNumber2 !== 2) {
14574
+ console.info("Line 2 line number:", line2.lineNumber2);
14530
14575
  throw new ParseError("Second TLE line number must be 2", "TLE");
14531
14576
  }
14532
14577
  return {
@@ -14572,9 +14617,44 @@ ${this.line2}`;
14572
14617
  return { ...line1, ...line2 };
14573
14618
  }
14574
14619
  /**
14575
- * Converts a 6 digit SCC number to a 5 digit SCC alpha 5 number
14576
- * @param sccNum The 6 digit SCC number
14577
- * @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.
14578
14658
  */
14579
14659
  static convert6DigitToA5(sccNum) {
14580
14660
  if (sccNum.length < 6) {
@@ -14583,9 +14663,27 @@ ${this.line2}`;
14583
14663
  if (typeof sccNum[0] !== "string") {
14584
14664
  throw new ParseError("Invalid SCC number format", "TLE");
14585
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
+ }
14586
14673
  if (RegExp(/[A-Z]/iu, "u").test(sccNum[0])) {
14587
14674
  return sccNum;
14588
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
+ }
14589
14687
  const rest = sccNum.slice(2, 6);
14590
14688
  let first = parseInt(`${sccNum[0]}${sccNum[1]}`);
14591
14689
  const iPlus = first >= 18 ? 1 : 0;
@@ -14594,9 +14692,17 @@ ${this.line2}`;
14594
14692
  return `${String.fromCharCode(first + 55)}${rest}`;
14595
14693
  }
14596
14694
  /**
14597
- * Converts a 5-digit SCC number to a 6-digit SCC number.
14598
- * @param sccNum - The 5-digit SCC number to convert.
14599
- * @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.
14600
14706
  */
14601
14707
  static convertA5to6Digit(sccNum) {
14602
14708
  if (sccNum.length < 5) {
@@ -14607,10 +14713,33 @@ ${this.line2}`;
14607
14713
  throw new ParseError("Invalid SCC number format", "TLE");
14608
14714
  }
14609
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
+ }
14610
14723
  const firstLetter = values[0];
14611
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
+ );
14612
14733
  }
14613
- 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;
14614
14743
  }
14615
14744
  };
14616
14745
 
@@ -14832,6 +14961,9 @@ var SolarRadiationPressure = class _SolarRadiationPressure extends Force {
14832
14961
  this.area = area;
14833
14962
  this.reflectCoeff = reflectCoeff;
14834
14963
  }
14964
+ mass;
14965
+ area;
14966
+ reflectCoeff;
14835
14967
  // / Solar pressure _(N/m²)_;
14836
14968
  static _kRef = 456e-8 * KM_PER_AU ** 2;
14837
14969
  acceleration(state) {
@@ -15214,6 +15346,8 @@ var ThirdBodyGravity = class _ThirdBodyGravity {
15214
15346
  this.moon = moon;
15215
15347
  this.sun = sun;
15216
15348
  }
15349
+ moon;
15350
+ sun;
15217
15351
  static moonGravity_(state) {
15218
15352
  const rMoon = Moon.eci(state.epoch.toDateTime());
15219
15353
  const aNum = rMoon.subtract(state.position);
@@ -15316,6 +15450,13 @@ var RAE = class _RAE {
15316
15450
  this.azRateRad = azRateRad;
15317
15451
  this.elRateRad = elRateRad;
15318
15452
  }
15453
+ epoch;
15454
+ rng;
15455
+ azRad;
15456
+ elRad;
15457
+ rngRate;
15458
+ azRateRad;
15459
+ elRateRad;
15319
15460
  // / Create a new [Razel] object, using degrees for the angular values.
15320
15461
  static fromDegrees(epoch, range, azimuth, elevation, rangeRate, azimuthRate, elevationRate) {
15321
15462
  const azimuthRateRad = azimuthRate ? azimuthRate * DEG2RAD : void 0;
@@ -15784,6 +15925,9 @@ var RungeKuttaAdaptive = class _RungeKuttaAdaptive extends Propagator {
15784
15925
  this._cacheState = this.initState_;
15785
15926
  this.tolerance_ = Math.max(_RungeKuttaAdaptive._minTolerance, Math.abs(tolerance_));
15786
15927
  }
15928
+ initState_;
15929
+ forceModel_;
15930
+ tolerance_;
15787
15931
  // / Initial state vector.
15788
15932
  _cacheState;
15789
15933
  _checkpoints = [];
@@ -16079,6 +16223,11 @@ var RungeKutta4Propagator = class extends Propagator {
16079
16223
  this.checkpoints_ = checkpoints_;
16080
16224
  this.stepSize_ = Math.abs(stepSize_);
16081
16225
  }
16226
+ initState_;
16227
+ forceModel_;
16228
+ stepSize_;
16229
+ cacheState_;
16230
+ checkpoints_;
16082
16231
  // / Set the integrator step size to the provided number of [seconds].
16083
16232
  setStepSize(seconds) {
16084
16233
  this.stepSize_ = Math.abs(seconds);
@@ -16407,6 +16556,7 @@ var Sgp4Propagator = class extends Propagator {
16407
16556
  this.tle_ = tle_;
16408
16557
  this.cacheState_ = tle_.state.toJ2000();
16409
16558
  }
16559
+ tle_;
16410
16560
  cacheState_;
16411
16561
  checkpoints_ = [];
16412
16562
  /**
@@ -16493,11 +16643,15 @@ var Satellite = class _Satellite extends SpaceObject {
16493
16643
  period;
16494
16644
  rightAscension;
16495
16645
  satrec;
16496
- /** 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. */
16497
16649
  sccNum;
16498
- /** 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). */
16499
16652
  sccNum5;
16500
- /** 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). */
16501
16655
  sccNum6;
16502
16656
  tle1;
16503
16657
  tle2;
@@ -16572,7 +16726,7 @@ var Satellite = class _Satellite extends SpaceObject {
16572
16726
  /** Operational status */
16573
16727
  status = "?" /* UNKNOWN */;
16574
16728
  constructor(info, options) {
16575
- if (info.source === "JSC Vimpel" /* VIMPEL */ && info.tle1 && info.tle2) {
16729
+ if (info.source === "vimpel" /* VIMPEL */ && info.tle1 && info.tle2) {
16576
16730
  info = _Satellite.setSccNumTo0_(info);
16577
16731
  }
16578
16732
  super(info);
@@ -16679,13 +16833,42 @@ var Satellite = class _Satellite extends SpaceObject {
16679
16833
  return new _Satellite({ omm, name: name ?? omm.OBJECT_NAME });
16680
16834
  }
16681
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
+ }
16682
16866
  parseTleAndUpdateOrbit_(tle1, tle2, sccNum) {
16683
16867
  const tleData = Tle.parse(tle1, tle2);
16684
16868
  this.tle1 = tle1;
16685
16869
  this.tle2 = tle2;
16686
16870
  this.sccNum = sccNum ?? tleData.satNum.toString();
16687
- this.sccNum5 = Tle.convert6DigitToA5(this.sccNum);
16688
- this.sccNum6 = Tle.convertA5to6Digit(this.sccNum5);
16871
+ this.assignAlpha5Forms_();
16689
16872
  this.intlDes = tleData.intlDes;
16690
16873
  this.epochYear = tleData.epochYear;
16691
16874
  this.epochDay = tleData.epochDay;
@@ -16708,8 +16891,7 @@ var Satellite = class _Satellite extends SpaceObject {
16708
16891
  parseOmmAndUpdateOrbit_(omm) {
16709
16892
  const noradStr = String(omm.NORAD_CAT_ID);
16710
16893
  this.sccNum = noradStr.padStart(5, "0");
16711
- this.sccNum5 = Tle.convert6DigitToA5(noradStr);
16712
- this.sccNum6 = Tle.convertA5to6Digit(this.sccNum5);
16894
+ this.assignAlpha5Forms_();
16713
16895
  this.intlDes = omm.OBJECT_ID;
16714
16896
  const YYYY = omm.EPOCH.slice(0, 4);
16715
16897
  const MM = omm.EPOCH.slice(5, 7);
@@ -16769,8 +16951,10 @@ var Satellite = class _Satellite extends SpaceObject {
16769
16951
  ecen: this.eccentricity,
16770
16952
  epochyr: this.epochYear,
16771
16953
  epochday: this.epochDay,
16772
- intl: omm.OBJECT_ID,
16773
- 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,
16774
16958
  bstar: this.bstar,
16775
16959
  meanMotionDot: this.meanMoDev1,
16776
16960
  meanMotionDdot: this.meanMoDev2,
@@ -19115,6 +19299,13 @@ var RadecGeocentric = class _RadecGeocentric {
19115
19299
  this.declinationRate = declinationRate;
19116
19300
  this.rangeRate = rangeRate;
19117
19301
  }
19302
+ epoch;
19303
+ rightAscension;
19304
+ declination;
19305
+ range;
19306
+ rightAscensionRate;
19307
+ declinationRate;
19308
+ rangeRate;
19118
19309
  /**
19119
19310
  * Creates a RadecGeocentric object from the given parameters in degrees.
19120
19311
  * @param epoch - The epoch in UTC.
@@ -19257,6 +19448,13 @@ var RadecTopocentric = class _RadecTopocentric {
19257
19448
  this.declinationRate = declinationRate;
19258
19449
  this.rangeRate = rangeRate;
19259
19450
  }
19451
+ epoch;
19452
+ rightAscension;
19453
+ declination;
19454
+ range;
19455
+ rightAscensionRate;
19456
+ declinationRate;
19457
+ rangeRate;
19260
19458
  /**
19261
19459
  * Create a new RadecTopocentric object, using degrees for the angular values.
19262
19460
  * @param epoch UTC epoch.
@@ -19814,6 +20012,8 @@ var RkCheckpoint = class {
19814
20012
  this.cacheState = cacheState;
19815
20013
  this.stepSize = stepSize;
19816
20014
  }
20015
+ cacheState;
20016
+ stepSize;
19817
20017
  };
19818
20018
 
19819
20019
  // src/propagator/RkResult.ts
@@ -19824,6 +20024,9 @@ var RkResult = class {
19824
20024
  this.error = error;
19825
20025
  this.newStep = newStep;
19826
20026
  }
20027
+ state;
20028
+ error;
20029
+ newStep;
19827
20030
  };
19828
20031
 
19829
20032
  // src/covariance/StateCovariance.ts
@@ -19844,6 +20047,8 @@ var StateCovariance = class _StateCovariance {
19844
20047
  this.matrix = matrix;
19845
20048
  this.frame = frame;
19846
20049
  }
20050
+ matrix;
20051
+ frame;
19847
20052
  // / Create a new [StateCovariance] object from 1-sigma values.
19848
20053
  static fromSigmas(sigmas, frame) {
19849
20054
  const n = sigmas.length;
@@ -19874,6 +20079,8 @@ var PropagatorPairs = class {
19874
20079
  this.posStep_ = posStep_;
19875
20080
  this.velStep_ = velStep_;
19876
20081
  }
20082
+ posStep_;
20083
+ velStep_;
19877
20084
  _high = Array(6).fill(null);
19878
20085
  _low = Array(6).fill(null);
19879
20086
  set(index, high, low) {
@@ -19907,6 +20114,9 @@ var BatchLeastSquaresResult = class {
19907
20114
  this.covariance = covariance2;
19908
20115
  this.rms = rms;
19909
20116
  }
20117
+ state;
20118
+ covariance;
20119
+ rms;
19910
20120
  };
19911
20121
 
19912
20122
  // src/orbit-determination/BatchLeastSquaresOD.ts
@@ -19937,6 +20147,12 @@ var BatchLeastSquaresOD = class _BatchLeastSquaresOD {
19937
20147
  this.propagator_ = new RungeKutta89Propagator(this.apriori_, this.forceModel_);
19938
20148
  this.nominal_ = this.propagator_.propagate(this.start_);
19939
20149
  }
20150
+ observations_;
20151
+ apriori_;
20152
+ forceModel_;
20153
+ posStep_;
20154
+ velStep_;
20155
+ fastDerivatives_;
19940
20156
  /** Propagator pair cache, for generating observation Jacobians. */
19941
20157
  propPairs_;
19942
20158
  /** Nominal state propagator. */
@@ -20037,6 +20253,7 @@ var GibbsIOD = class _GibbsIOD {
20037
20253
  constructor(mu = Earth.mu) {
20038
20254
  this.mu = mu;
20039
20255
  }
20256
+ mu;
20040
20257
  /** Abort solve if position plane exceeds this value. */
20041
20258
  static coplanarThreshold_ = 5 * DEG2RAD;
20042
20259
  /**
@@ -20095,6 +20312,7 @@ var HerrickGibbsIOD = class {
20095
20312
  constructor(mu = Earth.mu) {
20096
20313
  this.mu = mu;
20097
20314
  }
20315
+ mu;
20098
20316
  // / Attempt to create a state estimate from three inertial position vectors.
20099
20317
  solve(r1, t1, r2, t2, r3, t3) {
20100
20318
  const dt31 = t3.difference(t1);
@@ -20355,6 +20573,7 @@ var LambertIOD = class _LambertIOD {
20355
20573
  constructor(mu = Earth.mu) {
20356
20574
  this.mu = mu;
20357
20575
  }
20576
+ mu;
20358
20577
  /**
20359
20578
  * Try to guess the short path argument given an [interceptor] and
20360
20579
  * [target] state.
@@ -21042,6 +21261,11 @@ var LevenbergMarquardtResult = class {
21042
21261
  this.iterations = iterations;
21043
21262
  this.converged = converged;
21044
21263
  }
21264
+ state;
21265
+ covariance;
21266
+ rms;
21267
+ iterations;
21268
+ converged;
21045
21269
  };
21046
21270
 
21047
21271
  // src/orbit-determination/LevenbergMarquardtOD.ts
@@ -21072,6 +21296,12 @@ var LevenbergMarquardtOD = class _LevenbergMarquardtOD {
21072
21296
  const propagator = new RungeKutta89Propagator(this.apriori_, this.forceModel_);
21073
21297
  this.nominal_ = propagator.propagate(this.start_);
21074
21298
  }
21299
+ observations_;
21300
+ apriori_;
21301
+ forceModel_;
21302
+ posStep_;
21303
+ velStep_;
21304
+ fastDerivatives_;
21075
21305
  /** Propagator pair cache, for generating observation Jacobians. */
21076
21306
  propPairs_;
21077
21307
  /** State estimate during solve. */
@@ -21230,6 +21460,8 @@ var SimplexEntry = class _SimplexEntry {
21230
21460
  this.x_ = new Vector(points);
21231
21461
  this.score = this.f_(points);
21232
21462
  }
21463
+ f_;
21464
+ points;
21233
21465
  /**
21234
21466
  * The cost function score at this vertex.
21235
21467
  *
@@ -21762,6 +21994,8 @@ var ConjunctionAssessment = class {
21762
21994
  this.primaryProp = this.createPropagator(primary, false);
21763
21995
  this.secondaryProp = this.createPropagator(secondary, false);
21764
21996
  }
21997
+ primary;
21998
+ secondary;
21765
21999
  primaryProp;
21766
22000
  secondaryProp;
21767
22001
  primaryCovSample;
@@ -23207,6 +23441,9 @@ var ObservationRadar = class _ObservationRadar extends Observation {
23207
23441
  this.observation = observation;
23208
23442
  this.noise_ = noise_;
23209
23443
  }
23444
+ site_;
23445
+ observation;
23446
+ noise_;
23210
23447
  // / Default noise matrix.
23211
23448
  static defaultNoise = _ObservationRadar.noiseFromSigmas(0.32, 0.015 * DEG2RAD, 0.015 * DEG2RAD);
23212
23449
  get epoch() {
@@ -23696,6 +23933,9 @@ var ObservationOptical = class _ObservationOptical extends Observation {
23696
23933
  this.observation = observation;
23697
23934
  this.noise_ = noise_;
23698
23935
  }
23936
+ site_;
23937
+ observation;
23938
+ noise_;
23699
23939
  // / Inertial site location.
23700
23940
  get site() {
23701
23941
  return this.site_;
@@ -24178,12 +24418,12 @@ var HorizonsParser = class {
24178
24418
  for (let i = 0; i < lines.length; i++) {
24179
24419
  const line = lines[i].trim();
24180
24420
  if (line.startsWith("Target body name:")) {
24181
- targetName = this.extractValue_(line, "Target body name:");
24421
+ targetName = this.extractTargetName_(line, "Target body name:");
24182
24422
  metadata.targetName = targetName;
24183
24423
  } else if (line.startsWith("Center body name:")) {
24184
24424
  centerBody = this.extractValue_(line, "Center body name:");
24185
24425
  metadata.centerBody = centerBody;
24186
- } else if (line.startsWith("Center-site name:")) {
24426
+ } else if (line.startsWith("Center-site name:") && !centerBody) {
24187
24427
  centerBody = this.extractValue_(line, "Center-site name:");
24188
24428
  metadata.centerBody = centerBody;
24189
24429
  } else if (line.startsWith("Output type:")) {
@@ -24238,7 +24478,7 @@ var HorizonsParser = class {
24238
24478
  for (let i = 0; i < lines.length; i++) {
24239
24479
  const line = lines[i].trim();
24240
24480
  if (line.startsWith("Target body name:")) {
24241
- targetName = this.extractValue_(line, "Target body name:");
24481
+ targetName = this.extractTargetName_(line, "Target body name:");
24242
24482
  } else if (line.startsWith("Center-site name:")) {
24243
24483
  observerLocation = this.extractValue_(line, "Center-site name:");
24244
24484
  }
@@ -24269,7 +24509,23 @@ var HorizonsParser = class {
24269
24509
  */
24270
24510
  static extractValue_(line, key) {
24271
24511
  const value = line.substring(key.length).trim();
24272
- 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;
24273
24529
  }
24274
24530
  /**
24275
24531
  * Parses a vector data line from Horizons output.
@@ -24339,7 +24595,9 @@ var HorizonsParser = class {
24339
24595
  return null;
24340
24596
  }
24341
24597
  const posLine = allLines[nextIndex].trim();
24342
- 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;
24343
24601
  if (!posMatch) {
24344
24602
  return null;
24345
24603
  }
@@ -24351,7 +24609,9 @@ var HorizonsParser = class {
24351
24609
  let velocity;
24352
24610
  if (nextIndex < allLines.length) {
24353
24611
  const velLine = allLines[nextIndex].trim();
24354
- 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;
24355
24615
  if (velMatch) {
24356
24616
  velocity = new Vector3D(
24357
24617
  parseFloat(velMatch[1]),
@@ -24361,6 +24621,17 @@ var HorizonsParser = class {
24361
24621
  nextIndex++;
24362
24622
  }
24363
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
+ }
24364
24635
  return {
24365
24636
  data: { epoch, position, velocity },
24366
24637
  nextIndex
@@ -25107,6 +25378,58 @@ var OdmExporter = class _OdmExporter {
25107
25378
  return lines.join("\n");
25108
25379
  }
25109
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
+ // ==========================================================================
25110
25433
  // OMM — Orbit Mean-Elements Message
25111
25434
  // ==========================================================================
25112
25435
  /**
@@ -26906,6 +27229,11 @@ var ChebyshevCoefficients = class _ChebyshevCoefficients {
26906
27229
  this.cyd_ = _ChebyshevCoefficients._derivative(a, b, cy_);
26907
27230
  this.czd_ = _ChebyshevCoefficients._derivative(a, b, cz_);
26908
27231
  }
27232
+ a;
27233
+ b;
27234
+ cx_;
27235
+ cy_;
27236
+ cz_;
26909
27237
  cxd_;
26910
27238
  cyd_;
26911
27239
  czd_;
@@ -27427,6 +27755,11 @@ var TwoBurnOrbitTransfer = class _TwoBurnOrbitTransfer {
27427
27755
  this.vTransB = vTransB;
27428
27756
  this.tTrans = tTrans;
27429
27757
  }
27758
+ vInit;
27759
+ vFinal;
27760
+ vTransA;
27761
+ vTransB;
27762
+ tTrans;
27430
27763
  /**
27431
27764
  * Calculates the parameters for a Hohmann transfer orbit between two circular orbits.
27432
27765
  * @param rInit The initial radius of the orbit. (km)
@@ -27479,6 +27812,7 @@ var ChebyshevCompressor = class _ChebyshevCompressor {
27479
27812
  constructor(interpolator_) {
27480
27813
  this.interpolator_ = interpolator_;
27481
27814
  }
27815
+ interpolator_;
27482
27816
  /** Returns the cosine of π times x. */
27483
27817
  static cosPi_(x) {
27484
27818
  return Math.cos(Math.PI * x);
@@ -27719,6 +28053,8 @@ var SimpleLinearRegression = class _SimpleLinearRegression {
27719
28053
  this.ys = ys;
27720
28054
  this.update();
27721
28055
  }
28056
+ xs;
28057
+ ys;
27722
28058
  /** Line slope (m in y = mx + b). */
27723
28059
  slope_ = 0;
27724
28060
  /** Y-axis intercept (b in y = mx + b). */