@zodiacs/engine 0.1.1-rc.16 → 1.0.0

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 (53) hide show
  1. package/CHANGELOG.md +458 -0
  2. package/LICENSING.md +18 -5
  3. package/NOTICE +3 -2
  4. package/README.md +67 -33
  5. package/dist/{api-VOW6Umy5.d.ts → api-WbxJ4Wj-.d.ts} +12 -6
  6. package/dist/ayanamsa--YQ46fET.d.ts +134 -0
  7. package/dist/calc.d.ts +131 -20
  8. package/dist/calc.js +246 -60
  9. package/dist/chunk-47ERTK5X.js +27 -0
  10. package/dist/{chunk-O3NJRGJ2.js → chunk-7TRLIFFI.js} +1 -1
  11. package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
  12. package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
  13. package/dist/{chunk-I7O5EGFV.js → chunk-CHSYDKBL.js} +1 -1
  14. package/dist/{chunk-4NV4ZEFZ.js → chunk-DMGHYCDI.js} +4 -4
  15. package/dist/{chunk-L6ZHWJZ6.js → chunk-FTX3JDJA.js} +15 -12
  16. package/dist/{chunk-2OWGBT3O.js → chunk-OG4OYTJJ.js} +47 -42
  17. package/dist/{chunk-WOU7JVD3.js → chunk-SRXBTP5H.js} +7 -7
  18. package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
  19. package/dist/chunk-WS3TDSP3.js +474 -0
  20. package/dist/{chunk-N4B5JNMA.js → chunk-YIITY7Q7.js} +21 -11
  21. package/dist/crossings.d.ts +8 -7
  22. package/dist/crossings.js +1 -1
  23. package/dist/deltat.d.ts +28 -3
  24. package/dist/deltat.js +1 -1
  25. package/dist/geo.d.ts +33 -12
  26. package/dist/geo.js +3 -1
  27. package/dist/{houses-q1O2GGp4.d.ts → houses-CFERsAlK.d.ts} +12 -2
  28. package/dist/houses-extra.d.ts +19 -5
  29. package/dist/houses-extra.js +4 -2
  30. package/dist/index.d.ts +34 -49
  31. package/dist/index.js +21 -13
  32. package/dist/{internal-math-CmJ9xtaW.d.ts → internal-math-DJJ8BYex.d.ts} +41 -27
  33. package/dist/internal-math.d.ts +3 -3
  34. package/dist/internal-math.js +2 -2
  35. package/dist/internal.d.ts +1 -1
  36. package/dist/internal.js +5 -5
  37. package/dist/receipt.d.ts +2 -268
  38. package/dist/receipt.js +70 -35
  39. package/dist/reference-span-CILpclrz.d.ts +40 -0
  40. package/dist/{rulers-9wljfVaO.d.ts → rulers-Dla6h_Sm.d.ts} +7 -2
  41. package/dist/sky.d.ts +25 -10
  42. package/dist/sky.js +11 -9
  43. package/dist/techniques.d.ts +61 -18
  44. package/dist/techniques.js +39 -46
  45. package/dist/timing.d.ts +53 -16
  46. package/dist/timing.js +19 -38
  47. package/dist/{types-B4MCoCCS.d.ts → types-B-yb_tGL.d.ts} +23 -11
  48. package/dist/vedic.d.ts +42 -123
  49. package/dist/vedic.js +43 -440
  50. package/dist/window.d.ts +81 -79
  51. package/dist/window.js +26 -27
  52. package/dist/zone-history-ghdyO0Sc.d.ts +268 -0
  53. package/package.json +3 -1
package/dist/receipt.js CHANGED
@@ -11,20 +11,20 @@ import {
11
11
  UT1_DATA,
12
12
  outsideReferenceSpan,
13
13
  timeBasis
14
- } from "./chunk-KHBLFXFG.js";
14
+ } from "./chunk-B5LKF437.js";
15
15
  import {
16
16
  DELTA_T_MODEL,
17
17
  DELTA_T_TABLE,
18
18
  deltaTAt
19
- } from "./chunk-ONBZ4HK7.js";
19
+ } from "./chunk-BHJXUY67.js";
20
20
  import {
21
21
  ASPECTS,
22
- ASPECT_BODIES,
22
+ ASPECT_BODY_SET,
23
23
  ASPECT_TYPES,
24
24
  EPHEMERIS,
25
25
  SIGNS,
26
26
  aspectMotion
27
- } from "./chunk-2OWGBT3O.js";
27
+ } from "./chunk-OG4OYTJJ.js";
28
28
 
29
29
  // src/receipt-json.ts
30
30
  function parseReceiptJson(json, limits) {
@@ -159,7 +159,7 @@ function compareVersions(a, b) {
159
159
  var NATAL_ENVELOPE_SCHEMA = "zodiacs.natal-envelope.draft-v1";
160
160
  var NATAL_RECEIPT_SCHEMA = "zodiacs.calculation-receipt.draft-v1";
161
161
  var NATAL_DIAGNOSTIC_SCHEMA = "zodiacs.natal-diagnostic.draft-v1";
162
- var NATAL_ENVELOPE_LIMITS = Object.freeze({ bytes: 65536, depth: 12, nodes: 4096 });
162
+ var NATAL_ENVELOPE_LIMITS = /* @__PURE__ */ Object.freeze({ bytes: 65536, depth: 12, nodes: 4096 });
163
163
  var ERROR_CODES = /* @__PURE__ */ new Set([
164
164
  "invalid_json",
165
165
  "invalid_shape",
@@ -182,7 +182,7 @@ var NatalEnvelopeError = class extends Error {
182
182
  ERROR_BRAND.set(this, fixed);
183
183
  }
184
184
  };
185
- var CONVENTIONS_RC3 = Object.freeze({
185
+ var CONVENTIONS_RC3 = /* @__PURE__ */ Object.freeze({
186
186
  calendar: "proleptic-gregorian",
187
187
  zodiac: "tropical",
188
188
  planetPositions: "apparent-geocentric-ecliptic-of-date",
@@ -193,30 +193,36 @@ var CONVENTIONS_RC3 = Object.freeze({
193
193
  speed: "degrees-per-day;central-difference-plus-minus-0.25-day",
194
194
  aspects: "major-aspects;sun-moon-eight-planets;no-nodes"
195
195
  });
196
- var CONVENTIONS_RC7 = Object.freeze({
196
+ var CONVENTIONS_RC7 = /* @__PURE__ */ (() => Object.freeze({
197
197
  ...CONVENTIONS_RC3,
198
198
  angles: "gast-and-true-obliquity",
199
199
  speed: "degrees-per-day;central-difference-plus-minus-0.001-day;nodes-plus-minus-0.25-day",
200
200
  aspects: "major-aspects;sun-moon-eight-planets;no-nodes;applying-instantaneous-orb-rate"
201
- });
202
- var CONVENTIONS_RC8 = Object.freeze({
201
+ }))();
202
+ var CONVENTIONS_RC8 = /* @__PURE__ */ (() => Object.freeze({
203
203
  ...CONVENTIONS_RC7,
204
204
  planetPositions: "aberrated-geocentric-ecliptic-of-date;no-deflection",
205
205
  moonPosition: "astronomy-engine-ecliptic-geo-moon;no-light-time;no-aberration",
206
206
  deltaT: "tt-minus-ut1;ut1-read-as-utc;value-in-result"
207
- });
208
- var CONVENTIONS_RC15 = Object.freeze({
207
+ }))();
208
+ var CONVENTIONS_RC15 = /* @__PURE__ */ (() => Object.freeze({
209
209
  ...CONVENTIONS_RC8,
210
210
  deltaT: "tt-minus-ut1;value-in-result",
211
211
  timeScale: "tt-from-leap-seconds-and-ut1-from-iers-1972-to-table-end;delta-t-model-otherwise;in-result",
212
212
  localTime: "tzdb-shards-before-1970;host-intl-from-1970;flags-from-transition-record"
213
- });
214
- var CONVENTIONS = Object.freeze({
213
+ }))();
214
+ var CONVENTIONS = /* @__PURE__ */ (() => Object.freeze({
215
215
  ...CONVENTIONS_RC15,
216
216
  moonPosition: "astronomy-engine-geo-moon;no-light-time;no-aberration",
217
217
  nutation: "iau2000b;equation-of-equinoxes-with-two-complementary-terms"
218
- });
219
- var NATAL_RECEIPT_CONVENTION_SETS = Object.freeze([CONVENTIONS, CONVENTIONS_RC15, CONVENTIONS_RC8, CONVENTIONS_RC7, CONVENTIONS_RC3]);
218
+ }))();
219
+ var NATAL_RECEIPT_CONVENTION_SETS = /* @__PURE__ */ Object.freeze([
220
+ CONVENTIONS,
221
+ CONVENTIONS_RC15,
222
+ CONVENTIONS_RC8,
223
+ CONVENTIONS_RC7,
224
+ CONVENTIONS_RC3
225
+ ]);
220
226
  var RC3_TO_RC6 = /^0\.1\.1-rc\.[3-6](?:\+[A-Za-z0-9.-]+)?$/;
221
227
  var RC7 = /^0\.1\.1-rc\.7(?:\+[A-Za-z0-9.-]+)?$/;
222
228
  var RC8_TO_RC14 = /^0\.1\.1-rc\.(?:[89]|1[0-4])(?:\+[A-Za-z0-9.-]+)?$/;
@@ -225,7 +231,7 @@ var before = (version2, release) => compareVersions(version2, release) < 0;
225
231
  var NUTATION_RELEASE = "0.1.1-rc.16";
226
232
  var RC9_RELEASE = "0.1.1-rc.9";
227
233
  var RC10_RELEASE = "0.1.1-rc.10";
228
- var COVERAGE = Object.freeze({
234
+ var COVERAGE = /* @__PURE__ */ Object.freeze({
229
235
  assessment: "finite-reference-cases-only",
230
236
  broadDateRange: "not-certified",
231
237
  angleExclusions: "exact-geographic-poles-and-ecliptic-horizon-coincidence",
@@ -270,6 +276,14 @@ var HOUSE_SYSTEMS_BEFORE_RC10 = HOUSE_SYSTEMS.filter(
270
276
  var POLAR_UNDEFINED = ["placidus", "koch"];
271
277
  var TURNING_WITH_ASCENDANT = ["regiomontanus", "campanus", "topocentric"];
272
278
  var HOSTILE_KEYS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
279
+ var BODY_RECORD = ["body", "lon", "lat", "speed", "retrograde", "sign", "degree"];
280
+ var ANGLES_RECORD = ["asc", "mc", "dsc", "ic"];
281
+ var HOUSES_RECORD = ["system", "cusps"];
282
+ var ASPECT_RECORD = ["a", "b", "type", "orb", "applying"];
283
+ var DELTA_T_RECORD = ["seconds", "sigma", "model", "table", "tableDigest", "segment"];
284
+ var TIME_SCALE_RECORD = ["input", "basis", "ut1MinusUtc", "leapSeconds"];
285
+ var UT1_RECORD = ["seconds", "sigma", "source"];
286
+ var LEAP_SECONDS_RECORD = ["taiMinusUtc", "listed"];
273
287
  function fail(code) {
274
288
  throw new NatalEnvelopeError(code);
275
289
  }
@@ -351,6 +365,24 @@ function fields(value, required, optional = []) {
351
365
  if (required.some((key) => !Object.hasOwn(value, key)) || Object.keys(value).some((key) => !required.includes(key) && !optional.includes(key)))
352
366
  fail("invalid_shape");
353
367
  }
368
+ function list(value) {
369
+ if (!Array.isArray(value)) fail("invalid_shape");
370
+ return value;
371
+ }
372
+ function kept(value, keys) {
373
+ const from = record(value);
374
+ const out = {};
375
+ for (const key of keys) if (Object.hasOwn(from, key)) out[key] = from[key];
376
+ return out;
377
+ }
378
+ function timeScaleKept(value) {
379
+ const timeScale = kept(value, TIME_SCALE_RECORD);
380
+ if (timeScale.ut1MinusUtc !== null && timeScale.ut1MinusUtc !== void 0)
381
+ timeScale.ut1MinusUtc = kept(timeScale.ut1MinusUtc, UT1_RECORD);
382
+ if (timeScale.leapSeconds !== null && timeScale.leapSeconds !== void 0)
383
+ timeScale.leapSeconds = kept(timeScale.leapSeconds, LEAP_SECONDS_RECORD);
384
+ return timeScale;
385
+ }
354
386
  function choice(value, choices) {
355
387
  if (typeof value !== "string" || !choices.includes(value)) fail("invalid_value");
356
388
  return value;
@@ -431,7 +463,7 @@ var J2000_MS = Date.UTC(2e3, 0, 1, 12);
431
463
  var IERS_SEGMENTS = ["observed", "predicted", "fallback"];
432
464
  function validateDeltaT(value, instant, timeBasis2) {
433
465
  const deltaT = record(value);
434
- fields(deltaT, ["seconds", "sigma", "model", "table", "tableDigest", "segment"]);
466
+ fields(deltaT, DELTA_T_RECORD);
435
467
  const seconds = number(deltaT.seconds, -1e10, 1e10);
436
468
  if (deltaT.model === "pinned") {
437
469
  if (deltaT.sigma !== null || deltaT.table !== null || deltaT.tableDigest !== null || deltaT.segment !== "pinned")
@@ -461,19 +493,19 @@ function same(actual, expected) {
461
493
  }
462
494
  function validateTimeScale(value, deltaT, instant, scale) {
463
495
  const timeScale = record(value);
464
- fields(timeScale, ["input", "basis", "ut1MinusUtc", "leapSeconds"]);
496
+ fields(timeScale, TIME_SCALE_RECORD);
465
497
  const basis = choice(timeScale.basis, ["iers", "delta-t", "pinned"]);
466
498
  const { ut1MinusUtc, leapSeconds } = timeScale;
467
499
  if (ut1MinusUtc !== null) {
468
500
  const ut1 = record(ut1MinusUtc);
469
- fields(ut1, ["seconds", "sigma", "source"]);
501
+ fields(ut1, UT1_RECORD);
470
502
  number(ut1.seconds, -1, 1);
471
503
  number(ut1.sigma, 0, 1);
472
504
  choice(ut1.source, IERS_SEGMENTS);
473
505
  }
474
506
  if (leapSeconds !== null) {
475
507
  const leap = record(leapSeconds);
476
- fields(leap, ["taiMinusUtc", "listed"]);
508
+ fields(leap, LEAP_SECONDS_RECORD);
477
509
  if (!Number.isInteger(number(leap.taiMinusUtc, 10, 100))) fail("invalid_value");
478
510
  bool(leap.listed);
479
511
  }
@@ -482,7 +514,8 @@ function validateTimeScale(value, deltaT, instant, scale) {
482
514
  fail("inconsistent_result");
483
515
  if (deltaT.tableDigest === UT1_DATA.digest || deltaT.tableDigest === DELTA_T_TABLE.digest) {
484
516
  const expected = timeBasis(Date.parse(instant), scale);
485
- if (!same(deltaT, expected.deltaT) || !same(timeScale, expected.timeScale)) fail("inconsistent_result");
517
+ if (!same(deltaT, kept(expected.deltaT, DELTA_T_RECORD)) || !same(timeScale, timeScaleKept(expected.timeScale)))
518
+ fail("inconsistent_result");
486
519
  }
487
520
  }
488
521
  function validateResult(value, instantaneousApplying, instant, scale) {
@@ -505,7 +538,7 @@ function validateResult(value, instantaneousApplying, instant, scale) {
505
538
  const speeds = /* @__PURE__ */ new Map();
506
539
  for (const item of result.bodies) {
507
540
  const body = record(item);
508
- fields(body, ["body", "lon", "lat", "speed", "retrograde", "sign", "degree"]);
541
+ fields(body, BODY_RECORD);
509
542
  const name = choice(body.body, BODIES);
510
543
  if (names.has(name)) fail("invalid_value");
511
544
  names.add(name);
@@ -521,12 +554,12 @@ function validateResult(value, instantaneousApplying, instant, scale) {
521
554
  if (result.angles === null !== (result.houses === null)) fail("inconsistent_result");
522
555
  if (result.angles !== null) {
523
556
  const angles = record(result.angles);
524
- fields(angles, ["asc", "mc", "dsc", "ic"]);
557
+ fields(angles, ANGLES_RECORD);
525
558
  for (const angle of Object.values(angles)) longitude(angle);
526
559
  if (!angularClose(angles.dsc, angles.asc + 180) || !angularClose(angles.ic, angles.mc + 180))
527
560
  fail("inconsistent_result");
528
561
  const houses = record(result.houses);
529
- fields(houses, ["system", "cusps"]);
562
+ fields(houses, HOUSES_RECORD);
530
563
  const system = choice(houses.system, HOUSE_SYSTEMS);
531
564
  if (!Array.isArray(houses.cusps) || houses.cusps.length !== 12) fail("invalid_shape");
532
565
  const cusps = houses.cusps.map(longitude);
@@ -572,14 +605,14 @@ function validateResult(value, instantaneousApplying, instant, scale) {
572
605
  const pairs = /* @__PURE__ */ new Set();
573
606
  for (const item of result.aspects) {
574
607
  const aspect = record(item);
575
- fields(aspect, ["a", "b", "type", "orb", "applying"]);
608
+ fields(aspect, ASPECT_RECORD);
576
609
  const a = choice(
577
610
  aspect.a,
578
- BODIES.filter((body) => ASPECT_BODIES.has(body))
611
+ BODIES.filter((body) => ASPECT_BODY_SET.has(body))
579
612
  );
580
613
  const b = choice(
581
614
  aspect.b,
582
- BODIES.filter((body) => ASPECT_BODIES.has(body))
615
+ BODIES.filter((body) => ASPECT_BODY_SET.has(body))
583
616
  );
584
617
  const key = [a, b].sort().join("/");
585
618
  if (a === b || pairs.has(key)) fail("inconsistent_result");
@@ -856,7 +889,7 @@ function checked(input) {
856
889
  function createNatalEnvelope(chart, context = {}) {
857
890
  return guarded(() => {
858
891
  const source = record(cloneData(chart, true));
859
- fields(source, [
892
+ const required = [
860
893
  "input",
861
894
  "bodies",
862
895
  "angles",
@@ -866,7 +899,8 @@ function createNatalEnvelope(chart, context = {}) {
866
899
  "deltaT",
867
900
  "timeScale",
868
901
  "engineVersion"
869
- ]);
902
+ ];
903
+ if (required.some((key) => !Object.hasOwn(source, key))) fail("invalid_shape");
870
904
  const input = record(source.input);
871
905
  fields(
872
906
  input,
@@ -912,13 +946,14 @@ function createNatalEnvelope(chart, context = {}) {
912
946
  conventions: { ...CONVENTIONS },
913
947
  coverage: { ...COVERAGE }
914
948
  },
949
+ // The fields the record's conventions set names, and only those.
915
950
  result: {
916
- bodies: source.bodies,
917
- angles: source.angles,
918
- houses: source.houses,
919
- aspects: source.aspects,
920
- deltaT: source.deltaT,
921
- timeScale: source.timeScale
951
+ bodies: list(source.bodies).map((body) => kept(body, BODY_RECORD)),
952
+ angles: source.angles === null ? null : kept(source.angles, ANGLES_RECORD),
953
+ houses: houses === null ? null : kept(houses, HOUSES_RECORD),
954
+ aspects: list(source.aspects).map((aspect) => kept(aspect, ASPECT_RECORD)),
955
+ deltaT: kept(source.deltaT, DELTA_T_RECORD),
956
+ timeScale: timeScaleKept(source.timeScale)
922
957
  },
923
958
  ...supplied.extensions === void 0 ? {} : { extensions: supplied.extensions }
924
959
  };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * The span over which this engine's positions have been compared with an
3
+ * independent ephemeris: from 1800-01-01T00:00Z up to, not including,
4
+ * 2200-01-01T00:00Z. Charts outside it are still computed, and carry the
5
+ * `outside-reference-span` flag.
6
+ */
7
+ declare const REFERENCE_SPAN: Readonly<{
8
+ readonly from: "1800-01-01T00:00:00.000Z";
9
+ readonly to: "2200-01-01T00:00:00.000Z";
10
+ }>;
11
+ /**
12
+ * The span of Terrestrial Time over which the ephemeris is evaluated at all:
13
+ * the years astronomy-engine 2.1.19 itself tabulates, J2000 ± 730,000 days of
14
+ * TT (0001-04-30T12:00 to 3998-09-03T12:00 TT). That is the range of its Pluto
15
+ * model's state table; for any other time its source says: "The target time is
16
+ * outside the year range 0000..4000. Calculate it by crawling backward from 0000
17
+ * or forward from 4000. ... This is super slow." Beyond the table its other
18
+ * series diverge as well: on 30000-06-01 the Sun came out 29° off the ecliptic.
19
+ *
20
+ * Every instant a calculation evaluates, the instant and its speed samples, must
21
+ * lie inside on the calculation's own ΔT clock, or the call throws RangeError.
22
+ * With the model ΔT, instants from 0001-05-01T00:00Z to 3998-09-02T00:00Z are
23
+ * always inside. Being inside is not an accuracy claim: see REFERENCE_SPAN.
24
+ */
25
+ declare const EPHEMERIS_SPAN: Readonly<{
26
+ /** The scale of the bounds, as a label, like `fromTT` and `toTT`: not a TimeScaleName, which is lowercase. */
27
+ readonly timeScale: "TT";
28
+ /** Days of Terrestrial Time from J2000.0, 2000-01-01T12:00 TT, inclusive. */
29
+ readonly daysFromJ2000: Readonly<{
30
+ readonly from: -730000;
31
+ readonly to: 730000;
32
+ }>;
33
+ /** The same bounds as Terrestrial Time labels (not UTC). */
34
+ readonly fromTT: "0001-04-30T12:00:00";
35
+ readonly toTT: "3998-09-03T12:00:00";
36
+ }>;
37
+ /** True when the instant lies outside REFERENCE_SPAN. */
38
+ declare function outsideReferenceSpan(utc: Date): boolean;
39
+
40
+ export { EPHEMERIS_SPAN as E, REFERENCE_SPAN as R, outsideReferenceSpan as o };
@@ -1,8 +1,13 @@
1
- import { Z as ZodiacSign } from './types-B4MCoCCS.js';
1
+ import { Z as ZodiacSign } from './types-B-yb_tGL.js';
2
2
 
3
3
  /** The seven visible planets of the traditional rulership scheme. */
4
4
  type TraditionalPlanet = "Sun" | "Moon" | "Mercury" | "Venus" | "Mars" | "Jupiter" | "Saturn";
5
- /** The traditional domicile ruler of each sign; the outer planets rule none. */
5
+ /**
6
+ * The traditional domicile ruler of each sign; the outer planets rule none.
7
+ * The same rulers as `@zodiacs/engine/techniques`'s DOMICILE_RULERS and
8
+ * `@zodiacs/engine/vedic`'s SIGN_LORDS. Each entry point carries its own copy,
9
+ * so that none imports another; a test keeps the three equal.
10
+ */
6
11
  declare const TRADITIONAL_RULERS: Readonly<Record<ZodiacSign, TraditionalPlanet>>;
7
12
  /** The seven planets in descending order of their spheres, Saturn to the Moon. */
8
13
  declare const CHALDEAN_ORDER: readonly TraditionalPlanet[];
package/dist/sky.d.ts CHANGED
@@ -1,11 +1,18 @@
1
- import { B as BodyName, D as DateInput } from './types-B4MCoCCS.js';
2
- import { T as TraditionalPlanet } from './rulers-9wljfVaO.js';
3
- export { C as CHALDEAN_ORDER } from './rulers-9wljfVaO.js';
1
+ import { B as BodyName, D as DateInput } from './types-B-yb_tGL.js';
2
+ import { T as TraditionalPlanet } from './rulers-Dla6h_Sm.js';
3
+ export { C as CHALDEAN_ORDER } from './rulers-Dla6h_Sm.js';
4
4
  import './deltat.js';
5
5
 
6
6
  /** A body the sky functions accept: the Sun, the Moon and the planets. */
7
7
  type SkyBody = Exclude<BodyName, "North Node" | "South Node">;
8
- /** A place: geodetic latitude and longitude in degrees (east positive) and height in metres. */
8
+ /**
9
+ * A place: geodetic latitude and longitude in degrees (east positive) and
10
+ * height in metres above the WGS84 ellipsoid, on which the sky functions place
11
+ * the observer. `@zodiacs/engine/calc`'s CalcPlace has the same three fields on
12
+ * the IERS 2003 ellipsoid, which its topocentric reduction uses, and accepts
13
+ * heights from −12,000 m: the two ellipsoids' equatorial radii differ by
14
+ * 0.4 m, and a height from −12,000 to −10,000 m is refused here.
15
+ */
9
16
  interface Observer {
10
17
  latitude: number;
11
18
  longitude: number;
@@ -18,15 +25,15 @@ type Limb = "upper" | "centre" | "lower";
18
25
  type Refraction = "standard" | "none";
19
26
  interface SkyOptions {
20
27
  /** `"upper"` for the Sun and Moon unless given; the planets accept only `"centre"`. */
21
- limb?: Limb;
28
+ readonly limb?: Limb | undefined;
22
29
  /** `"standard"` unless given. */
23
- refraction?: Refraction;
30
+ readonly refraction?: Refraction | undefined;
24
31
  /** Most position evaluations the searches may make: a positive integer or `Infinity` (default). */
25
- maxSamples?: number;
32
+ readonly maxSamples?: number | undefined;
26
33
  }
27
34
  interface SkyDayOptions extends SkyOptions {
28
35
  /** The clock that defines the day, minutes east of UTC. Default: the observer's local mean time, longitude × 4. */
29
- utcOffsetMinutes?: number;
36
+ readonly utcOffsetMinutes?: number | undefined;
30
37
  }
31
38
  type SkyEventKind = "rise" | "set" | "upper-transit" | "lower-transit";
32
39
  interface SkyEvent {
@@ -124,7 +131,8 @@ interface PlanetaryDayBase {
124
131
  * clock's midnight falls next to sunrise. `"no-sunset"`: the Sun rose but did
125
132
  * not set within three days of the date's start, as polar day begins.
126
133
  * `"no-next-sunrise"`: it rose and set but did not rise again within those
127
- * three days, as polar night begins. `"refused"`: the sample budget ran out.
134
+ * three days, as polar night begins. `"refused"`: the sample budget ran out,
135
+ * with `reason: "sample-budget"` as a refused skyEventsOn() gives it.
128
136
  */
129
137
  type PlanetaryDay = (PlanetaryDayBase & {
130
138
  readonly status: "complete";
@@ -133,7 +141,14 @@ type PlanetaryDay = (PlanetaryDayBase & {
133
141
  readonly nextSunrise: Date;
134
142
  readonly hours: readonly PlanetaryHour[];
135
143
  }) | (PlanetaryDayBase & {
136
- readonly status: "no-sunrise" | "no-sunset" | "no-next-sunrise" | "refused";
144
+ readonly status: "no-sunrise" | "no-sunset" | "no-next-sunrise";
145
+ readonly sunrise: null;
146
+ readonly sunset: null;
147
+ readonly nextSunrise: null;
148
+ readonly hours: readonly [];
149
+ }) | (PlanetaryDayBase & {
150
+ readonly status: "refused";
151
+ readonly reason: "sample-budget";
137
152
  readonly sunrise: null;
138
153
  readonly sunset: null;
139
154
  readonly nextSunrise: null;
package/dist/sky.js CHANGED
@@ -4,23 +4,23 @@ import {
4
4
  import {
5
5
  equatorRows,
6
6
  turn
7
- } from "./chunk-O3NJRGJ2.js";
7
+ } from "./chunk-7TRLIFFI.js";
8
8
  import {
9
9
  dateFrom
10
10
  } from "./chunk-CPALRSPC.js";
11
11
  import {
12
12
  searchLongitudeCrossingsWith
13
- } from "./chunk-AECKV73C.js";
13
+ } from "./chunk-TSS2SZWQ.js";
14
14
  import {
15
15
  gastHours,
16
16
  onChartClock
17
- } from "./chunk-WOU7JVD3.js";
17
+ } from "./chunk-SRXBTP5H.js";
18
18
  import {
19
19
  outsideReferenceSpan
20
- } from "./chunk-KHBLFXFG.js";
21
- import "./chunk-ONBZ4HK7.js";
22
- import "./chunk-4NV4ZEFZ.js";
23
- import "./chunk-2OWGBT3O.js";
20
+ } from "./chunk-B5LKF437.js";
21
+ import "./chunk-BHJXUY67.js";
22
+ import "./chunk-DMGHYCDI.js";
23
+ import "./chunk-OG4OYTJJ.js";
24
24
 
25
25
  // src/sky/riseset.ts
26
26
  import { Body, GeoVector } from "astronomy-engine";
@@ -53,7 +53,7 @@ var RAD = Math.PI / 180;
53
53
  var DAY_MS = 864e5;
54
54
  var STEP_DAYS = 1 / 24;
55
55
  var STANDARD_REFRACTION_ARCMIN = 34;
56
- var SKY_RADII_KM = Object.freeze({ Sun: 696e3, Moon: 1737.4 });
56
+ var SKY_RADII_KM = /* @__PURE__ */ Object.freeze({ Sun: 696e3, Moon: 1737.4 });
57
57
  var KM_PER_AU = 1495978707e-1;
58
58
  var WGS84_A = 6378.137;
59
59
  var WGS84_F = 1 / 298.257223563;
@@ -303,7 +303,9 @@ function dayOf(site, input, midnightMs) {
303
303
  const search = searchEvents("Sun", site, conventions, startMs, startMs + SPAN_DAYS * DAY_MS2, budgetOf(input.maxSamples), false);
304
304
  const base = { date: isoDate(midnightMs), utcOffsetMinutes: offset, weekday, ruler, conventions, samples: search.samples };
305
305
  const empty = { sunrise: null, sunset: null, nextSunrise: null, hours: Object.freeze([]) };
306
- if (search.status === "refused") return Object.freeze({ ...base, flags: Object.freeze([]), status: "refused", ...empty });
306
+ if (search.status === "refused") {
307
+ return Object.freeze({ ...base, flags: Object.freeze([]), status: "refused", reason: "sample-budget", ...empty });
308
+ }
307
309
  const rise = search.events.find((event) => event.kind === "rise" && event.at.getTime() < startMs + DAY_MS2);
308
310
  const set = rise && search.events.find((event) => event.kind === "set" && event.at > rise.at);
309
311
  const next = set && search.events.find((event) => event.kind === "rise" && event.at > set.at);
@@ -1,5 +1,5 @@
1
- import { N as NatalSource } from './api-VOW6Umy5.js';
2
- import { d as Chart, H as HouseSystem, D as DateInput, B as BodyName, g as AspectType, Z as ZodiacSign, E as Element, k as Sect } from './types-B4MCoCCS.js';
1
+ import { N as NatalSource } from './api-WbxJ4Wj-.js';
2
+ import { d as Chart, H as HouseSystem, D as DateInput, B as BodyName, f as AspectType, Z as ZodiacSign, E as Element, k as Sect } from './types-B-yb_tGL.js';
3
3
  import './deltat.js';
4
4
  import './crossings.js';
5
5
 
@@ -12,15 +12,15 @@ interface GeoPlace {
12
12
  }
13
13
 
14
14
  /** Half-width of the solar return search around its date, days. */
15
- declare const SOLAR_RETURN_WINDOW_DAYS = 200;
15
+ declare const SOLAR_RETURN_WINDOW_DAYS: number;
16
16
  /** How far back `mostRecentSolarReturnInstant` searches, days. */
17
- declare const SOLAR_RETURN_LOOKBACK_DAYS = 370;
17
+ declare const SOLAR_RETURN_LOOKBACK_DAYS: number;
18
18
  /** Coarse step of the solar return search, days. */
19
- declare const SOLAR_RETURN_STEP_DAYS = 1;
19
+ declare const SOLAR_RETURN_STEP_DAYS: number;
20
20
  /** How far the lunar return search runs, days. */
21
- declare const LUNAR_RETURN_HORIZON_DAYS = 40;
21
+ declare const LUNAR_RETURN_HORIZON_DAYS: number;
22
22
  /** Coarse step of the lunar return search, days. */
23
- declare const LUNAR_RETURN_STEP_DAYS = 0.25;
23
+ declare const LUNAR_RETURN_STEP_DAYS: number;
24
24
  /** The solar return nearest the date, or the latest at or before it. */
25
25
  type SolarReturnSelection = "nearest" | "most-recent";
26
26
  interface ReturnOptions {
@@ -33,7 +33,8 @@ interface SolarReturnOptions extends ReturnOptions {
33
33
  /** `"nearest"` by default. */
34
34
  selection?: SolarReturnSelection | undefined;
35
35
  }
36
- interface PlanetaryReturn {
36
+ /** A solar or lunar return: the instant the body is back on its natal longitude, and the chart then. */
37
+ interface ReturnChart {
37
38
  readonly body: "Sun" | "Moon";
38
39
  /** The body's longitude in the natal chart, degrees. */
39
40
  readonly natalLongitude: number;
@@ -45,11 +46,17 @@ interface PlanetaryReturn {
45
46
  /** From the natal instant and the ends of the searched window. */
46
47
  readonly flags: readonly TechniqueFlag[];
47
48
  }
48
- interface SolarReturn extends PlanetaryReturn {
49
+ /**
50
+ * A solar or lunar return, under its first name.
51
+ *
52
+ * @deprecated Use ReturnChart, the same type: `@zodiacs/engine/timing`'s PlanetaryReturn is another one.
53
+ */
54
+ type PlanetaryReturn = ReturnChart;
55
+ interface SolarReturn extends ReturnChart {
49
56
  readonly body: "Sun";
50
57
  readonly selection: SolarReturnSelection;
51
58
  }
52
- interface LunarReturn extends PlanetaryReturn {
59
+ interface LunarReturn extends ReturnChart {
53
60
  readonly body: "Moon";
54
61
  }
55
62
  /**
@@ -111,14 +118,32 @@ declare function compositeChart(first: NatalSource, second: NatalSource): Compos
111
118
  /**
112
119
  * `"coordinates"`: the mean latitude and the longitude halfway along the
113
120
  * shorter arc. `"great-circle"`: halfway along the great circle.
121
+ *
122
+ * @experimental The conventions of a Davison chart here (the place's default,
123
+ * the house system, a known time only when both are known) may change in a
124
+ * minor release.
114
125
  */
115
126
  type DavisonPlaceConvention = "coordinates" | "great-circle";
127
+ /**
128
+ * Options for davisonChart.
129
+ *
130
+ * @experimental The conventions of a Davison chart here (the place's default,
131
+ * the house system, a known time only when both are known) may change in a
132
+ * minor release.
133
+ */
116
134
  interface DavisonOptions {
117
135
  /** `"coordinates"` by default. */
118
136
  place?: DavisonPlaceConvention | undefined;
119
137
  /** The first chart's by default. */
120
138
  houseSystem?: HouseSystem | undefined;
121
139
  }
140
+ /**
141
+ * A Davison chart, with the instant and the place it was cast for.
142
+ *
143
+ * @experimental The conventions of a Davison chart here (the place's default,
144
+ * the house system, a known time only when both are known) may change in a
145
+ * minor release.
146
+ */
122
147
  interface DavisonChart {
123
148
  /** The mean of the two births' UTC instants, rounded down to the millisecond. */
124
149
  readonly instant: Date;
@@ -129,11 +154,23 @@ interface DavisonChart {
129
154
  readonly chart: Chart;
130
155
  readonly flags: readonly TechniqueFlag[];
131
156
  }
132
- /** The midpoint of two places; antipodes have no great-circle midpoint (RangeError). */
157
+ /**
158
+ * The midpoint of two places. A place outside latitudes −90 to 90 and
159
+ * longitudes −180 to 180, or a convention not named, throws a RangeError, and
160
+ * so do antipodes, which have no great-circle midpoint.
161
+ *
162
+ * @experimental The conventions of a Davison chart here (the place's default,
163
+ * the house system, a known time only when both are known) may change in a
164
+ * minor release.
165
+ */
133
166
  declare function davisonPlace(first: GeoPlace, second: GeoPlace, convention?: DavisonPlaceConvention): GeoPlace;
134
167
  /**
135
168
  * The Davison chart of two charts or births (Davison, 1977): a chart for the
136
169
  * midpoint in time and the midpoint in space of the two births.
170
+ *
171
+ * @experimental The conventions of a Davison chart here (the place's default,
172
+ * the house system, a known time only when both are known) may change in a
173
+ * minor release.
137
174
  */
138
175
  declare function davisonChart(first: NatalSource, second: NatalSource, options?: DavisonOptions): DavisonChart;
139
176
 
@@ -187,8 +224,8 @@ interface VoidOfCourseOptions {
187
224
  /** `"modern"` by default. */
188
225
  bodies?: VoidBodies | undefined;
189
226
  }
190
- /** The longest window the scans accept, days. */
191
- declare const VOID_OF_COURSE_MAX_DAYS = 3660;
227
+ /** The longest window the scans accept, days. A minor release may accept a longer one. */
228
+ declare const VOID_OF_COURSE_MAX_DAYS: number;
192
229
  /** Every entry of the apparent Moon into a sign in (from, to], in time order (6-hour steps). */
193
230
  declare function moonIngresses(from: DateInput, to: DateInput): readonly MoonIngress[];
194
231
  /** Every exact Ptolemaic aspect of the Moon to the chosen bodies in (from, to]: 3-hour samples, 26 bisections. */
@@ -278,7 +315,12 @@ type SignDignity = "domicile" | "exaltation" | "detriment" | "fall";
278
315
  type EssentialDignity = "domicile" | "exaltation" | "triplicity" | "term" | "face";
279
316
  type Debility = "detriment" | "fall";
280
317
  declare const CLASSICAL_PLANETS: readonly ClassicalPlanet[];
281
- /** Each sign's domicile ruler (Tetrabiblos I.17). */
318
+ /**
319
+ * Each sign's domicile ruler (Tetrabiblos I.17): the same rulers as
320
+ * `@zodiacs/engine/timing`'s TRADITIONAL_RULERS and `@zodiacs/engine/vedic`'s
321
+ * SIGN_LORDS. Each entry point carries its own copy, so that none imports
322
+ * another; a test keeps the three equal.
323
+ */
282
324
  declare const DOMICILE_RULERS: Readonly<Record<ZodiacSign, ClassicalPlanet>>;
283
325
  /** Each planet's exaltation (Tetrabiblos I.19); its fall is the opposite sign. */
284
326
  declare const EXALTATIONS: Readonly<Record<ClassicalPlanet, ZodiacSign>>;
@@ -374,8 +416,8 @@ declare const EVERY_ZONE_OFFSETS: Readonly<{
374
416
  readonly earliestHours: 14;
375
417
  readonly latestHours: -12;
376
418
  }>;
377
- /** The longest span `moonSignsBetween` accepts, days. */
378
- declare const MOON_SIGN_MAX_SPAN_DAYS = 20;
419
+ /** The longest span `moonSignsBetween` accepts, days. A minor release may accept a longer one. */
420
+ declare const MOON_SIGN_MAX_SPAN_DAYS: number;
379
421
  interface MoonSignCandidates {
380
422
  /** YYYY-MM-DD, Gregorian. */
381
423
  readonly date: string;
@@ -402,9 +444,10 @@ declare function moonSignsBetween(from: DateInput, to: DateInput): readonly Zodi
402
444
  * The Moon signs possible over a civil date with an unknown birth time. With
403
445
  * `timeZone`, from local midnight to local midnight, read as
404
446
  * `resolveLocalToUtc` (`@zodiacs/engine/geo`) reads them; before 1970, await
405
- * its `prepareLocalTime` first. Without, in every time zone: `sign` is set
447
+ * its `prepareLocalTime` first, or it throws geo's ZoneHistoryNotLoadedError,
448
+ * an Error and not a RangeError. Without, in every time zone: `sign` is set
406
449
  * only when the Moon held it the whole date everywhere.
407
450
  */
408
451
  declare function moonSignCandidates(date: string, options?: MoonSignOptions): MoonSignCandidates;
409
452
 
410
- export { type AspectPattern, type AspectPatterns, CHALDEAN_FACES, CLASSICAL_PLANETS, type ClassicalPlanet, type CompositeAspect, type CompositeChart, type CompositePosition, DOMICILE_RULERS, type DavisonChart, type DavisonOptions, type DavisonPlaceConvention, type Debility, type DignityRulers, type DignitySpan, EGYPTIAN_TERMS, EVERY_ZONE_OFFSETS, EXALTATIONS, type EssentialDignity, type GeoPlace, LUNAR_RETURN_HORIZON_DAYS, LUNAR_RETURN_STEP_DAYS, type LunarReturn, MOON_SIGN_MAX_SPAN_DAYS, type MoonAspect, type MoonIngress, type MoonSignCandidates, type MoonSignOptions, type MutualReception, PATTERN_BODIES, type PatternBody, type PatternContainment, type PatternEdge, type PatternEdgeInput, type PatternKind, type PatternPoint, type PlanetDignities, type PlanetaryReturn, type ReceptionOptions, type ReturnOptions, SOLAR_RETURN_LOOKBACK_DAYS, SOLAR_RETURN_STEP_DAYS, SOLAR_RETURN_WINDOW_DAYS, type SignDignity, type SolarReturn, type SolarReturnOptions, type SolarReturnSelection, TRIPLICITY_LORDS, type TechniqueFlag, VOID_BODIES, VOID_OF_COURSE_CONVENTION, VOID_OF_COURSE_MAX_DAYS, type VoidBodies, type VoidBody, type VoidOfCourseOptions, type VoidOfCourseStatus, type VoidOfCourseWindow, aspectPatterns, chartAspectPatterns, compositeAspects, compositeChart, compositeMidpoints, davisonChart, davisonPlace, dignitiesFor, dignityFor, dignityRulersAt, essentialDignities, hasClassicalDignities, lunarReturn, lunarReturnInstant, moonAspects, moonIngresses, moonSignCandidates, moonSignsBetween, mostRecentSolarReturnInstant, mutualReceptions, patternContainment, solarReturn, solarReturnInstant, voidOfCourseAt, voidOfCourseWindows };
453
+ export { type AspectPattern, type AspectPatterns, CHALDEAN_FACES, CLASSICAL_PLANETS, type ClassicalPlanet, type CompositeAspect, type CompositeChart, type CompositePosition, DOMICILE_RULERS, type DavisonChart, type DavisonOptions, type DavisonPlaceConvention, type Debility, type DignityRulers, type DignitySpan, EGYPTIAN_TERMS, EVERY_ZONE_OFFSETS, EXALTATIONS, type EssentialDignity, type GeoPlace, LUNAR_RETURN_HORIZON_DAYS, LUNAR_RETURN_STEP_DAYS, type LunarReturn, MOON_SIGN_MAX_SPAN_DAYS, type MoonAspect, type MoonIngress, type MoonSignCandidates, type MoonSignOptions, type MutualReception, PATTERN_BODIES, type PatternBody, type PatternContainment, type PatternEdge, type PatternEdgeInput, type PatternKind, type PatternPoint, type PlanetDignities, type PlanetaryReturn, type ReceptionOptions, type ReturnChart, type ReturnOptions, SOLAR_RETURN_LOOKBACK_DAYS, SOLAR_RETURN_STEP_DAYS, SOLAR_RETURN_WINDOW_DAYS, type SignDignity, type SolarReturn, type SolarReturnOptions, type SolarReturnSelection, TRIPLICITY_LORDS, type TechniqueFlag, VOID_BODIES, VOID_OF_COURSE_CONVENTION, VOID_OF_COURSE_MAX_DAYS, type VoidBodies, type VoidBody, type VoidOfCourseOptions, type VoidOfCourseStatus, type VoidOfCourseWindow, aspectPatterns, chartAspectPatterns, compositeAspects, compositeChart, compositeMidpoints, davisonChart, davisonPlace, dignitiesFor, dignityFor, dignityRulersAt, essentialDignities, hasClassicalDignities, lunarReturn, lunarReturnInstant, moonAspects, moonIngresses, moonSignCandidates, moonSignsBetween, mostRecentSolarReturnInstant, mutualReceptions, patternContainment, solarReturn, solarReturnInstant, voidOfCourseAt, voidOfCourseWindows };