@zodiacs/engine 0.1.1-rc.15 → 0.1.1-rc.16

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 (43) hide show
  1. package/CHANGELOG.md +433 -0
  2. package/LICENSING.md +175 -8
  3. package/NOTICE +93 -0
  4. package/README.md +255 -59
  5. package/dist/{api-CoB_kqE3.d.ts → api-VOW6Umy5.d.ts} +4 -5
  6. package/dist/calc.d.ts +279 -0
  7. package/dist/calc.js +853 -0
  8. package/dist/{chunk-MFF3VKO3.js → chunk-2OWGBT3O.js} +1 -1
  9. package/dist/{chunk-ZHVI3KWJ.js → chunk-4NV4ZEFZ.js} +1 -1
  10. package/dist/chunk-A3U2ZS2W.js +29 -0
  11. package/dist/{chunk-OYGRVGXD.js → chunk-I7O5EGFV.js} +3 -3
  12. package/dist/{chunk-CWI4YUDL.js → chunk-L6ZHWJZ6.js} +9 -9
  13. package/dist/chunk-N4B5JNMA.js +473 -0
  14. package/dist/chunk-O3NJRGJ2.js +56 -0
  15. package/dist/{chunk-ZZPITHQS.js → chunk-WOU7JVD3.js} +194 -60
  16. package/dist/crossings.d.ts +1 -1
  17. package/dist/geo.d.ts +1 -1
  18. package/dist/geo.js +15 -458
  19. package/dist/houses-extra.d.ts +81 -0
  20. package/dist/houses-extra.js +337 -0
  21. package/dist/{internal-math-BbktkHCc.d.ts → houses-q1O2GGp4.d.ts} +3 -159
  22. package/dist/index.d.ts +5 -4
  23. package/dist/index.js +17 -17
  24. package/dist/internal-math-CmJ9xtaW.d.ts +160 -0
  25. package/dist/internal-math.d.ts +3 -2
  26. package/dist/internal-math.js +2 -2
  27. package/dist/internal.d.ts +1 -1
  28. package/dist/internal.js +3 -3
  29. package/dist/receipt.d.ts +31 -6
  30. package/dist/receipt.js +13 -7
  31. package/dist/rulers-9wljfVaO.d.ts +10 -0
  32. package/dist/sky.d.ts +158 -0
  33. package/dist/sky.js +377 -0
  34. package/dist/techniques.d.ts +410 -0
  35. package/dist/techniques.js +830 -0
  36. package/dist/timing.d.ts +69 -10
  37. package/dist/timing.js +86 -33
  38. package/dist/{types-BsWaqwU_.d.ts → types-B4MCoCCS.d.ts} +2 -2
  39. package/dist/vedic.d.ts +3 -4
  40. package/dist/vedic.js +26 -43
  41. package/dist/window.d.ts +178 -0
  42. package/dist/window.js +961 -0
  43. package/package.json +23 -3
package/dist/timing.d.ts CHANGED
@@ -1,15 +1,10 @@
1
- import { Z as ZodiacSign, B as BodyName, q as PointName, n as HouseNumber, D as DateInput, g as Sect } from './types-BsWaqwU_.js';
2
- import { N as NatalSource } from './api-CoB_kqE3.js';
1
+ import { T as TraditionalPlanet } from './rulers-9wljfVaO.js';
2
+ export { C as CHALDEAN_ORDER, a as TRADITIONAL_RULERS } from './rulers-9wljfVaO.js';
3
+ import { B as BodyName, r as PointName, Z as ZodiacSign, b as HouseNumber, D as DateInput, k as Sect } from './types-B4MCoCCS.js';
4
+ import { N as NatalSource } from './api-VOW6Umy5.js';
3
5
  import './deltat.js';
4
6
  import './crossings.js';
5
7
 
6
- /** The seven visible planets of the traditional rulership scheme. */
7
- type TraditionalPlanet = "Sun" | "Moon" | "Mercury" | "Venus" | "Mars" | "Jupiter" | "Saturn";
8
- /** The traditional domicile ruler of each sign; the outer planets rule none. */
9
- declare const TRADITIONAL_RULERS: Readonly<Record<ZodiacSign, TraditionalPlanet>>;
10
- /** The seven planets in descending order of their spheres, Saturn to the Moon. */
11
- declare const CHALDEAN_ORDER: readonly TraditionalPlanet[];
12
-
13
8
  /** The four angles of a chart with a birth time and place. */
14
9
  type AngleName = "Ascendant" | "Midheaven" | "Descendant" | "Imum Coeli";
15
10
  /** A natal longitude a technique can start from or direct: a body, an angle or a chart point. */
@@ -411,4 +406,68 @@ declare function directLongitudes(rows: readonly {
411
406
  */
412
407
  declare function solarArcDirections(natal: NatalSource, target: DateInput): SolarArcDirections;
413
408
 
414
- export { type AngleName, type AnnualProfection, CHALDEAN_ORDER, type ChartLongitudeName, DEFAULT_FIRDARIA_VARIANT, DEFAULT_PROFECTION_MONTHS, DEFAULT_RELEASING_YEARS, type DatedFirdariaPeriod, type DatedFirdariaSubPeriod, type DirectedLongitude, type DirectedPosition, FIRDARIA_CYCLE_YEARS, FIRDARIA_VARIANTS, FIRDARIA_YEARS, type FirdariaAt, type FirdariaConventions, type FirdariaLord, type FirdariaOptions, type FirdariaPeriod, type FirdariaSubPeriod, type FirdariaTimeline, type FirdariaTimelineOptions, type FirdariaVariant, PROFECTION_MONTH_CONVENTIONS, type ProfectionAt, type ProfectionConventions, type ProfectionMonth, type ProfectionMonthConvention, type ProfectionOptions, type ProfectionOrigin, type ProfectionSpan, type ProfectionYear, type ProfectionYearSpan, RELEASING_CYCLE_UNITS, RELEASING_UNIT_DAYS, RELEASING_YEAR_CONVENTIONS, type ReleasingAt, type ReleasingAtOptions, type ReleasingConventions, type ReleasingLevel, type ReleasingLot, type ReleasingOptions, type ReleasingOrigin, type ReleasingPeriod, type ReleasingTimeline, type ReleasingYearConvention, type SolarArc, type SolarArcDirections, TRADITIONAL_RULERS, type TimingFlag, type TimingOrigin, type TraditionalPlanet, VALENS_MINOR_YEARS, annualProfection, directLongitudes, firdaria, firdariaAt, firdariaPeriods, firdariaSequence, profectionAt, profectionYear, releasingAt, releasingPeriods, solarArc, solarArcDirections, zodiacalReleasing, zodiacalReleasingAt };
409
+ /** The bodies a return can be asked for. */
410
+ type ReturnBody = "Sun" | "Moon" | "Mercury" | "Venus" | "Mars" | "Jupiter" | "Saturn" | "Uranus" | "Neptune" | "Pluto";
411
+ declare const RETURN_BODIES: readonly ReturnBody[];
412
+ /**
413
+ * Days between the coarse samples of each body's search: two steps are
414
+ * shorter than the shortest time between two stations from 1800 to 2200
415
+ * (19.75 days for Mercury, 40.75 for Venus, 59.75 for Mars, longer for the
416
+ * others), and one step moves the Moon at most 15.4°.
417
+ */
418
+ declare const RETURN_STEP_DAYS: Readonly<Record<ReturnBody, number>>;
419
+ /** One return: an instant in the window at which the body is on its natal longitude. */
420
+ interface PlanetaryReturn {
421
+ readonly at: Date;
422
+ /** True when the body was moving backward through the degree. */
423
+ readonly retrograde: boolean;
424
+ /**
425
+ * The pass it belongs to, from 1 in the window. A pass is one approach to
426
+ * the degree: a single direct return, or direct, retrograde and direct
427
+ * returns around a station.
428
+ */
429
+ readonly pass: number;
430
+ }
431
+ /** `stepDays` (default {@link RETURN_STEP_DAYS}) and `maxSamples`, a budget of longitude evaluations. */
432
+ interface PlanetaryReturnOptions {
433
+ stepDays?: number;
434
+ maxSamples?: number;
435
+ }
436
+ /**
437
+ * The search's verdict with its returns: `"complete"` with every return it
438
+ * found, or `"refused"` with none when the budget ran out. Both carry the
439
+ * body, its natal longitude (the chart's, degrees in [0, 360)), the window,
440
+ * the longitude evaluations made (`samples`) and the result's flags.
441
+ */
442
+ type PlanetaryReturns = {
443
+ readonly status: "complete";
444
+ readonly body: ReturnBody;
445
+ readonly natalLongitude: number;
446
+ readonly from: Date;
447
+ readonly to: Date;
448
+ readonly samples: number;
449
+ readonly flags: readonly TimingFlag[];
450
+ readonly returns: readonly PlanetaryReturn[];
451
+ } | {
452
+ readonly status: "refused";
453
+ readonly reason: "sample-budget";
454
+ readonly maxSamples: number;
455
+ readonly body: ReturnBody;
456
+ readonly natalLongitude: number;
457
+ readonly from: Date;
458
+ readonly to: Date;
459
+ readonly samples: number;
460
+ readonly flags: readonly TimingFlag[];
461
+ readonly returns: readonly [];
462
+ };
463
+ /**
464
+ * Every return of `body` to its natal longitude in (from, to]: the chart's
465
+ * own longitude of the body, then `searchLongitudeCrossings` over the window
466
+ * at the body's step. Retrograde returns are reported with direct ones. The
467
+ * search assumes smooth motion with at most one station in two steps; within
468
+ * that it finds a pair of returns around a station that falls between two
469
+ * samples. Invalid input throws RangeError. Frozen.
470
+ */
471
+ declare function planetaryReturns(natal: NatalSource, body: ReturnBody, from: DateInput, to: DateInput, options?: PlanetaryReturnOptions): PlanetaryReturns;
472
+
473
+ export { type AngleName, type AnnualProfection, type ChartLongitudeName, DEFAULT_FIRDARIA_VARIANT, DEFAULT_PROFECTION_MONTHS, DEFAULT_RELEASING_YEARS, type DatedFirdariaPeriod, type DatedFirdariaSubPeriod, type DirectedLongitude, type DirectedPosition, FIRDARIA_CYCLE_YEARS, FIRDARIA_VARIANTS, FIRDARIA_YEARS, type FirdariaAt, type FirdariaConventions, type FirdariaLord, type FirdariaOptions, type FirdariaPeriod, type FirdariaSubPeriod, type FirdariaTimeline, type FirdariaTimelineOptions, type FirdariaVariant, PROFECTION_MONTH_CONVENTIONS, type PlanetaryReturn, type PlanetaryReturnOptions, type PlanetaryReturns, type ProfectionAt, type ProfectionConventions, type ProfectionMonth, type ProfectionMonthConvention, type ProfectionOptions, type ProfectionOrigin, type ProfectionSpan, type ProfectionYear, type ProfectionYearSpan, RELEASING_CYCLE_UNITS, RELEASING_UNIT_DAYS, RELEASING_YEAR_CONVENTIONS, RETURN_BODIES, RETURN_STEP_DAYS, type ReleasingAt, type ReleasingAtOptions, type ReleasingConventions, type ReleasingLevel, type ReleasingLot, type ReleasingOptions, type ReleasingOrigin, type ReleasingPeriod, type ReleasingTimeline, type ReleasingYearConvention, type ReturnBody, type SolarArc, type SolarArcDirections, type TimingFlag, type TimingOrigin, TraditionalPlanet, VALENS_MINOR_YEARS, annualProfection, directLongitudes, firdaria, firdariaAt, firdariaPeriods, firdariaSequence, planetaryReturns, profectionAt, profectionYear, releasingAt, releasingPeriods, solarArc, solarArcDirections, zodiacalReleasing, zodiacalReleasingAt };
package/dist/timing.js CHANGED
@@ -1,60 +1,40 @@
1
+ import {
2
+ CHALDEAN_ORDER,
3
+ TRADITIONAL_RULERS
4
+ } from "./chunk-A3U2ZS2W.js";
1
5
  import {
2
6
  PROGRESSION_DAYS_PER_YEAR,
3
7
  progressedBodies,
4
8
  progressedInstant
5
- } from "./chunk-OYGRVGXD.js";
9
+ } from "./chunk-I7O5EGFV.js";
6
10
  import {
7
11
  chartDeclinations,
8
12
  chartPoints,
9
13
  findLongitudeCrossings,
10
14
  resolvedChart,
15
+ searchLongitudeCrossings,
11
16
  utcOf
12
- } from "./chunk-CWI4YUDL.js";
17
+ } from "./chunk-L6ZHWJZ6.js";
18
+ import {
19
+ dateFrom
20
+ } from "./chunk-CPALRSPC.js";
13
21
  import "./chunk-AECKV73C.js";
14
22
  import "./chunk-PFGUCNOK.js";
15
23
  import {
16
24
  bodyLongitude
17
- } from "./chunk-ZZPITHQS.js";
18
- import "./chunk-ZHVI3KWJ.js";
19
- import {
20
- dateFrom
21
- } from "./chunk-CPALRSPC.js";
25
+ } from "./chunk-WOU7JVD3.js";
22
26
  import {
23
27
  outsideReferenceSpan
24
28
  } from "./chunk-KHBLFXFG.js";
25
29
  import "./chunk-ONBZ4HK7.js";
30
+ import "./chunk-4NV4ZEFZ.js";
26
31
  import {
27
32
  SIGN_NAMES,
28
33
  degreeInSign,
29
34
  normalizeLongitude,
30
35
  signForLongitude,
31
36
  signIndexForLongitude
32
- } from "./chunk-MFF3VKO3.js";
33
-
34
- // src/timing/rulers.ts
35
- var TRADITIONAL_RULERS = /* @__PURE__ */ Object.freeze({
36
- aries: "Mars",
37
- taurus: "Venus",
38
- gemini: "Mercury",
39
- cancer: "Moon",
40
- leo: "Sun",
41
- virgo: "Mercury",
42
- libra: "Venus",
43
- scorpio: "Mars",
44
- sagittarius: "Jupiter",
45
- capricorn: "Saturn",
46
- aquarius: "Saturn",
47
- pisces: "Jupiter"
48
- });
49
- var CHALDEAN_ORDER = /* @__PURE__ */ Object.freeze([
50
- "Saturn",
51
- "Jupiter",
52
- "Mars",
53
- "Sun",
54
- "Venus",
55
- "Mercury",
56
- "Moon"
57
- ]);
37
+ } from "./chunk-2OWGBT3O.js";
58
38
 
59
39
  // src/timing/shared.ts
60
40
  var DAY_MS = 864e5;
@@ -820,6 +800,76 @@ function solarArcDirections(natal, target) {
820
800
  const flags = timingFlags([arc.birth.getTime(), arc.progressed.getTime()], sectContradictsAltitude(chart, points));
821
801
  return Object.freeze({ arc, positions: Object.freeze(positions), flags });
822
802
  }
803
+
804
+ // src/timing/planetary-returns.ts
805
+ var RETURN_BODIES = Object.freeze([
806
+ "Sun",
807
+ "Moon",
808
+ "Mercury",
809
+ "Venus",
810
+ "Mars",
811
+ "Jupiter",
812
+ "Saturn",
813
+ "Uranus",
814
+ "Neptune",
815
+ "Pluto"
816
+ ]);
817
+ var RETURN_STEP_DAYS = Object.freeze({
818
+ Sun: 5,
819
+ Moon: 1,
820
+ Mercury: 2,
821
+ Venus: 4,
822
+ Mars: 5,
823
+ Jupiter: 5,
824
+ Saturn: 5,
825
+ Uranus: 5,
826
+ Neptune: 5,
827
+ Pluto: 5
828
+ });
829
+ function planetaryReturns(natal, body, from, to, options) {
830
+ if (typeof body !== "string" || !RETURN_BODIES.includes(body)) {
831
+ throw new RangeError(`body must be one of ${RETURN_BODIES.join(", ")}.`);
832
+ }
833
+ const start = dateFrom(from, "from");
834
+ const end = dateFrom(to, "to");
835
+ const read = readOptions(options, ["stepDays", "maxSamples"], "planetaryReturns options");
836
+ const stepDays = read.stepDays === void 0 ? RETURN_STEP_DAYS[body] : read.stepDays;
837
+ const { chart } = guarded(() => resolvedChart(natal));
838
+ const natalBody = chart.bodies.find((row) => row.body === body);
839
+ if (!natalBody) throw new RangeError(`The chart has no ${body}.`);
840
+ const natalLongitude = natalBody.lon;
841
+ const search = guarded(
842
+ () => searchLongitudeCrossings(body, natalLongitude, start, end, {
843
+ stepDays,
844
+ ...read.maxSamples === void 0 ? {} : { maxSamples: read.maxSamples }
845
+ })
846
+ );
847
+ const common = {
848
+ body,
849
+ natalLongitude,
850
+ from: start,
851
+ to: end,
852
+ samples: search.samples,
853
+ flags: timingFlags([utcOf(chart.input).getTime(), start.getTime(), end.getTime()], false)
854
+ };
855
+ if (search.status === "refused") {
856
+ return Object.freeze({
857
+ ...common,
858
+ status: "refused",
859
+ reason: search.reason,
860
+ maxSamples: search.maxSamples,
861
+ returns: Object.freeze([])
862
+ });
863
+ }
864
+ let pass = 0;
865
+ let previousDirect = true;
866
+ const returns = search.crossings.map((crossing) => {
867
+ if (pass === 0 || previousDirect && !crossing.retrograde) pass += 1;
868
+ previousDirect = !crossing.retrograde;
869
+ return Object.freeze({ at: crossing.at, retrograde: crossing.retrograde, pass });
870
+ });
871
+ return Object.freeze({ ...common, status: "complete", returns: Object.freeze(returns) });
872
+ }
823
873
  export {
824
874
  CHALDEAN_ORDER,
825
875
  DEFAULT_FIRDARIA_VARIANT,
@@ -832,6 +882,8 @@ export {
832
882
  RELEASING_CYCLE_UNITS,
833
883
  RELEASING_UNIT_DAYS,
834
884
  RELEASING_YEAR_CONVENTIONS,
885
+ RETURN_BODIES,
886
+ RETURN_STEP_DAYS,
835
887
  TRADITIONAL_RULERS,
836
888
  VALENS_MINOR_YEARS,
837
889
  annualProfection,
@@ -840,6 +892,7 @@ export {
840
892
  firdariaAt,
841
893
  firdariaPeriods,
842
894
  firdariaSequence,
895
+ planetaryReturns,
843
896
  profectionAt,
844
897
  profectionYear,
845
898
  releasingAt,
@@ -215,7 +215,7 @@ interface MoonPhase {
215
215
  name: MoonPhaseName;
216
216
  waxing: boolean;
217
217
  }
218
- declare const ENGINE_VERSION = "0.1.1-rc.15";
218
+ declare const ENGINE_VERSION = "0.1.1-rc.16";
219
219
  /**
220
220
  * The ephemeris underneath every position. The dependency is pinned to this
221
221
  * exact version, so receipts can name it without asking the caller.
@@ -225,4 +225,4 @@ declare const EPHEMERIS: Readonly<{
225
225
  readonly version: "2.1.19";
226
226
  }>;
227
227
 
228
- export { type Angles as A, type BodyName as B, type ChartInput as C, type DateInput as D, type Element as E, type HouseSystem as H, type InterAspect as I, type LeapSeconds as L, type MoonPhase as M, type PairSummary as P, type SynastryResult as S, type TimeScaleName as T, type Ut1MinusUtc as U, type ZodiacSign as Z, type BodyPosition as a, type Chart as b, type ChartFlag as c, type BirthInput as d, type ChartPoints as e, type TransitResult as f, type Sect as g, type MinimalBody as h, type Modality as i, type Aspect as j, type AspectType as k, ENGINE_VERSION as l, EPHEMERIS as m, type HouseNumber as n, type Houses as o, type MoonPhaseName as p, type PointName as q, type PointPosition as r, type Polarity as s, type SignDefinition as t, type TimeScale as u };
228
+ export { type Angles as A, type BodyName as B, type ChartInput as C, type DateInput as D, type Element as E, type HouseSystem as H, type InterAspect as I, type LeapSeconds as L, type MoonPhase as M, type PairSummary as P, type SynastryResult as S, type TimeScaleName as T, type Ut1MinusUtc as U, type ZodiacSign as Z, type Houses as a, type HouseNumber as b, type BodyPosition as c, type Chart as d, type ChartFlag as e, type BirthInput as f, type AspectType as g, type TimeScale as h, type ChartPoints as i, type TransitResult as j, type Sect as k, type MinimalBody as l, type Modality as m, type Aspect as n, ENGINE_VERSION as o, EPHEMERIS as p, type MoonPhaseName as q, type PointName as r, type PointPosition as s, type Polarity as t, type SignDefinition as u };
package/dist/vedic.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { T as TimeScaleName, u as TimeScale, D as DateInput, B as BodyName, H as HouseSystem, c as ChartFlag, b as Chart, d as BirthInput, Z as ZodiacSign } from './types-BsWaqwU_.js';
1
+ import { T as TimeScaleName, h as TimeScale, D as DateInput, B as BodyName, H as HouseSystem, e as ChartFlag, d as Chart, f as BirthInput, Z as ZodiacSign } from './types-B4MCoCCS.js';
2
2
  import { DeltaT } from './deltat.js';
3
3
 
4
4
  /** The precession model of an epoch value: the engine's IAU 2006, Newcomb's (Kinoshita 1975) or IAU 1976. */
@@ -106,9 +106,8 @@ interface AyanamsaOptions {
106
106
  /**
107
107
  * The mean and true ayanamsa of a definition at an instant, read as a chart
108
108
  * reads its own: on the engine's time basis, or a pinned ΔT, and refused
109
- * outside EPHEMERIS_SPAN. `true` adds the engine's nutation (five IAU 2000B
110
- * terms, within 0.270″ of the full series), which cancels from sidereal
111
- * longitudes.
109
+ * outside EPHEMERIS_SPAN. `true` adds the engine's nutation in longitude (IAU
110
+ * 2000B, all 77 terms), which cancels from sidereal longitudes.
112
111
  */
113
112
  declare function ayanamsa(definition: AyanamsaName | AyanamsaDefinition, at: DateInput, options?: AyanamsaOptions): AyanamsaValue;
114
113
 
package/dist/vedic.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  resolvedChart
3
- } from "./chunk-CWI4YUDL.js";
4
- import "./chunk-AECKV73C.js";
5
- import "./chunk-PFGUCNOK.js";
6
- import {
7
- onChartClock,
8
- onEngineClock
9
- } from "./chunk-ZZPITHQS.js";
10
- import "./chunk-ZHVI3KWJ.js";
3
+ } from "./chunk-L6ZHWJZ6.js";
11
4
  import {
12
5
  dateFrom
13
6
  } from "./chunk-CPALRSPC.js";
7
+ import "./chunk-AECKV73C.js";
8
+ import "./chunk-PFGUCNOK.js";
9
+ import {
10
+ eclipticFrame,
11
+ meanEcliptic,
12
+ onChartClock
13
+ } from "./chunk-WOU7JVD3.js";
14
14
  import {
15
15
  REFERENCE_SPAN,
16
16
  TIME_SCALE_NAMES,
@@ -18,22 +18,13 @@ import {
18
18
  timeBasis
19
19
  } from "./chunk-KHBLFXFG.js";
20
20
  import "./chunk-ONBZ4HK7.js";
21
+ import "./chunk-4NV4ZEFZ.js";
21
22
  import {
22
23
  SIGN_NAMES
23
- } from "./chunk-MFF3VKO3.js";
24
+ } from "./chunk-2OWGBT3O.js";
24
25
 
25
26
  // src/vedic/ayanamsa.ts
26
- import {
27
- AstroTime,
28
- BaryState,
29
- Body,
30
- HelioVector,
31
- InverseRotation,
32
- RotateVector,
33
- Rotation_EQJ_ECT,
34
- Vector,
35
- e_tilt
36
- } from "astronomy-engine";
27
+ import { BaryState, Body, HelioVector } from "astronomy-engine";
37
28
  var DEG = Math.PI / 180;
38
29
  var ARCSEC = DEG / 3600;
39
30
  var MAS = ARCSEC / 1e3;
@@ -180,13 +171,9 @@ function definitionOf(definition) {
180
171
  }
181
172
  return definition;
182
173
  }
183
- function longitudeIn(rotation, dpsi, v) {
184
- const e = RotateVector(rotation, v);
185
- return Math.atan2(e.y, e.x) - dpsi;
186
- }
187
- function meanEquinox(time) {
188
- const psi = e_tilt(time).dpsi * ARCSEC;
189
- return RotateVector(InverseRotation(Rotation_EQJ_ECT(time)), new Vector(Math.cos(psi), Math.sin(psi), 0, time));
174
+ function longitudeIn(frame, x, y, z) {
175
+ const [ex, ey] = meanEcliptic(frame, x, y, z);
176
+ return Math.atan2(ey, ex);
190
177
  }
191
178
  function olderModelLongitude(model, jd) {
192
179
  let zeta, z, theta, eps;
@@ -217,18 +204,14 @@ function olderModelLongitude(model, jd) {
217
204
  }
218
205
  var FRAMES = /* @__PURE__ */ new WeakMap();
219
206
  function epochFrame(definition) {
220
- let frame = FRAMES.get(definition);
221
- if (frame === void 0) {
222
- frame = onEngineClock(0, () => {
223
- const epoch = new AstroTime(definition.epochTT - J2000);
224
- const rotation = Rotation_EQJ_ECT(epoch);
225
- const dpsi = e_tilt(epoch).dpsi * ARCSEC;
226
- const correction = definition.model === "engine" ? 0 : longitudeIn(rotation, dpsi, new Vector(1, 0, 0, epoch)) - olderModelLongitude(definition.model, definition.epochTT);
227
- return Object.freeze({ rotation, dpsi, correction });
228
- });
229
- FRAMES.set(definition, frame);
207
+ let epoch = FRAMES.get(definition);
208
+ if (epoch === void 0) {
209
+ const frame = eclipticFrame(definition.epochTT - J2000);
210
+ const correction = definition.model === "engine" ? 0 : longitudeIn(frame, 1, 0, 0) - olderModelLongitude(definition.model, definition.epochTT);
211
+ epoch = Object.freeze({ frame, correction });
212
+ FRAMES.set(definition, epoch);
230
213
  }
231
- return frame;
214
+ return epoch;
232
215
  }
233
216
  var dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
234
217
  var scale = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
@@ -274,15 +257,15 @@ function apparentStar(s, time) {
274
257
  function meanAyanamsa(definition, time, frame) {
275
258
  switch (definition.kind) {
276
259
  case "epoch": {
277
- const { rotation, dpsi, correction } = frame;
278
- return definition.value + (correction - longitudeIn(rotation, dpsi, meanEquinox(time))) / DEG;
260
+ const { frame: at, correction } = frame;
261
+ const [x, y, z] = eclipticFrame(time.tt).rows;
262
+ return definition.value + (correction - longitudeIn(at, x, y, z)) / DEG;
279
263
  }
280
264
  case "linear":
281
265
  return definition.value + definition.rate * (time.tt + J2000 - definition.epochTT) / JULIAN_YEAR / 3600;
282
266
  case "star": {
283
267
  const [x, y, z] = apparentStar(definition.star, time);
284
- const tilt = e_tilt(time).dpsi * ARCSEC;
285
- return longitudeIn(Rotation_EQJ_ECT(time), tilt, new Vector(x, y, z, time)) / DEG - definition.longitude;
268
+ return longitudeIn(eclipticFrame(time.tt), x, y, z) / DEG - definition.longitude;
286
269
  }
287
270
  }
288
271
  }
@@ -312,7 +295,7 @@ function ayanamsa(definition, at, options = {}) {
312
295
  const outside = outsideReferenceSpan(date) || resolved.kind === "epoch" && !(resolved.epochTT >= SPAN_FROM_JD && resolved.epochTT < SPAN_TO_JD);
313
296
  return onChartClock(date.getTime(), scale2 ?? "utc", pin, (time, basis) => {
314
297
  const mean = wrap(meanAyanamsa(resolved, time, frame));
315
- const nutation = e_tilt(time).dpsi / 3600;
298
+ const nutation = eclipticFrame(time.tt).tilt.dpsi / 3600;
316
299
  const { ut1MinusUtc, leapSeconds } = basis.timeScale;
317
300
  const value = Object.freeze({
318
301
  ayanamsa: resolved.name,
@@ -0,0 +1,178 @@
1
+ import { H as HouseSystem, B as BodyName, Z as ZodiacSign, b as HouseNumber, g as AspectType, D as DateInput } from './types-B4MCoCCS.js';
2
+ import './deltat.js';
3
+
4
+ /** How far this release's switch instants have been checked. */
5
+ declare const WINDOW_VERIFICATION = "sampled at one-second resolution";
6
+ /** The longest window accepted: 48 hours, in milliseconds. */
7
+ declare const MAX_WINDOW_MS = 172800000;
8
+ /**
9
+ * Upper bounds on each body's longitude rate, degrees per day: twice the
10
+ * largest rate the engine's own positions reach from 1800 to 2200, scanned
11
+ * every hour for the Moon and the nodes, every three hours for Mercury, Venus
12
+ * and Mars, every six for the Sun and daily for the rest.
13
+ */
14
+ declare const WINDOW_RATE_BOUNDS: Readonly<Record<BodyName, number>>;
15
+ /** A rounding model: the true instant is uniform over the rounding unit of the record. */
16
+ interface WindowRounding {
17
+ /** The recorded time, resolved to an instant. */
18
+ recorded: DateInput;
19
+ /** The rounding unit, in minutes. */
20
+ minutes: number;
21
+ /**
22
+ * "nearest" (the default): the record is the nearest multiple of the unit,
23
+ * so the true instant lies within half a unit of it. "down": the record is
24
+ * the start of its unit, as a clock read without rounding up.
25
+ */
26
+ mode?: "nearest" | "down";
27
+ }
28
+ /**
29
+ * A window of possible birth instants, resolved by the caller, and a place.
30
+ * Give `start` and `end`, or `at` and `minutes` for [at − minutes, at +
31
+ * minutes), or only `rounding`, whose unit is then the window.
32
+ */
33
+ interface BirthWindowInput {
34
+ /** The first instant of the window. */
35
+ start?: DateInput;
36
+ /** The end of the window, which it does not include. */
37
+ end?: DateInput;
38
+ at?: DateInput;
39
+ /** Minutes either side of `at`, to the nearest millisecond. */
40
+ minutes?: number;
41
+ latitude: number;
42
+ longitude: number;
43
+ /** Defaults to "whole", as for natalChart. */
44
+ houseSystem?: HouseSystem;
45
+ /** A second prior for the cells' shares; its unit must lie inside the window. */
46
+ rounding?: WindowRounding;
47
+ }
48
+ interface WindowAspect {
49
+ a: BodyName;
50
+ b: BodyName;
51
+ type: AspectType;
52
+ }
53
+ /** The discrete features of the chart, as natalChart would give them, throughout a cell. */
54
+ interface WindowFeatures {
55
+ /** Each body's sign; null for the nodes inside an unresolved interval. */
56
+ signs: Record<BodyName, ZodiacSign | null>;
57
+ ascendant: ZodiacSign;
58
+ midheaven: ZodiacSign;
59
+ /**
60
+ * Each body's house, as houseOf gives it from the chart's cusps; null for
61
+ * the nodes inside an unresolved interval where the houses are whole signs.
62
+ */
63
+ houses: Record<BodyName, HouseNumber | null>;
64
+ /** The aspects in orb, in natalChart's pair order. */
65
+ aspects: WindowAspect[];
66
+ /** The house system used: the requested one, or "whole" where Placidus or Koch falls back. */
67
+ houseSystem: HouseSystem;
68
+ }
69
+ interface BirthWindowCell {
70
+ /** First instant of the cell. */
71
+ start: Date;
72
+ /** End of the cell, which it does not include. */
73
+ end: Date;
74
+ milliseconds: number;
75
+ /** Share of the window under a uniform prior. */
76
+ share: number;
77
+ /** Share under the rounding model, when one was given. */
78
+ roundedShare?: number;
79
+ features: WindowFeatures;
80
+ }
81
+ /** A change to or from null opens or closes an unresolved interval; it is not a crossing. */
82
+ type WindowChange = {
83
+ feature: "sign";
84
+ body: BodyName;
85
+ from: ZodiacSign | null;
86
+ to: ZodiacSign | null;
87
+ } | {
88
+ feature: "ascendant" | "midheaven";
89
+ from: ZodiacSign;
90
+ to: ZodiacSign;
91
+ } | {
92
+ feature: "house";
93
+ body: BodyName;
94
+ from: HouseNumber | null;
95
+ to: HouseNumber | null;
96
+ } | {
97
+ feature: "aspect";
98
+ a: BodyName;
99
+ b: BodyName;
100
+ from: AspectType | null;
101
+ to: AspectType | null;
102
+ } | {
103
+ feature: "house-system";
104
+ from: HouseSystem;
105
+ to: HouseSystem;
106
+ };
107
+ interface BirthWindowSwitch {
108
+ /**
109
+ * The first millisecond with the new features: the engine's value at the
110
+ * millisecond before differs, so the crossing lies in (at − 1 ms, at].
111
+ */
112
+ at: Date;
113
+ changes: WindowChange[];
114
+ }
115
+ /** Where the node's jitter would outlast the budget: these features are null in every cell of [start, end). */
116
+ interface WindowUnresolved {
117
+ start: Date;
118
+ /** The first instant at which they are resolved again. */
119
+ end: Date;
120
+ milliseconds: number;
121
+ features: {
122
+ feature: "sign" | "house";
123
+ body: "North Node" | "South Node";
124
+ }[];
125
+ }
126
+ type BirthWindowFlag = "polar-fallback"
127
+ /** An interval's end-to-end change broke a bound; completeness is then not established. */
128
+ | "bound-exceeded"
129
+ /** The result lists unresolved intervals. */
130
+ | "node-unresolved";
131
+ interface BirthWindow {
132
+ schema: "zodiacs.birth-window.v1";
133
+ /** How far the switch instants have been checked: dense one-second sampling, not proof. */
134
+ verification: typeof WINDOW_VERIFICATION;
135
+ start: Date;
136
+ end: Date;
137
+ latitude: number;
138
+ longitude: number;
139
+ /** The requested house system. */
140
+ houseSystem: HouseSystem;
141
+ rounding: {
142
+ recorded: Date;
143
+ minutes: number;
144
+ mode: "nearest" | "down";
145
+ start: Date;
146
+ end: Date;
147
+ } | null;
148
+ /** Cells in time order; they tile [start, end). */
149
+ cells: BirthWindowCell[];
150
+ /** Switches in time order, one per cell boundary. */
151
+ switches: BirthWindowSwitch[];
152
+ /** Intervals left unresolved, in time order; empty unless `node-unresolved` is flagged. */
153
+ unresolved: WindowUnresolved[];
154
+ flags: BirthWindowFlag[];
155
+ engineVersion: string;
156
+ }
157
+ /** Thrown when a window needs more evaluated instants than the search allows. An Error, not a RangeError. */
158
+ declare class WindowBudgetError extends Error {
159
+ readonly name = "WindowBudgetError";
160
+ /** The instants the search allows. */
161
+ readonly limit = 2000000;
162
+ constructor();
163
+ }
164
+ /**
165
+ * Partition a birth-time window, [start, end) of at most 48 hours inside
166
+ * REFERENCE_SPAN, into cells within which each body's sign and house, the
167
+ * signs of the ascendant and midheaven, the aspects in orb and any Placidus or
168
+ * Koch fallback are constant. Values are the engine's own at each millisecond,
169
+ * as a lone natalChart call computes them. Where the search's bounds hold
170
+ * (README), each cell holds natalChart's features at every millisecond, except
171
+ * the nodes' in the intervals listed in `unresolved`, which are null. Labelled
172
+ * {@link WINDOW_VERIFICATION}: checked against dense sampling, not proven.
173
+ * Throws RangeError for invalid input, and WindowBudgetError, which is not a
174
+ * RangeError, when the search would need more than two million instants.
175
+ */
176
+ declare function birthWindow(input: BirthWindowInput): BirthWindow;
177
+
178
+ export { type BirthWindow, type BirthWindowCell, type BirthWindowFlag, type BirthWindowInput, type BirthWindowSwitch, MAX_WINDOW_MS, WINDOW_RATE_BOUNDS, WINDOW_VERIFICATION, type WindowAspect, WindowBudgetError, type WindowChange, type WindowFeatures, type WindowRounding, type WindowUnresolved, birthWindow };