@zodiacs/engine 0.1.1-rc.16 → 1.1.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.
- package/CHANGELOG.md +1478 -0
- package/LICENSING.md +184 -30
- package/NOTICE +81 -14
- package/README.md +345 -67
- package/dist/{api-VOW6Umy5.d.ts → api-ChL1N2Sr.d.ts} +44 -7
- package/dist/ayanamsa-ClFzkKmV.d.ts +135 -0
- package/dist/calc.d.ts +218 -21
- package/dist/calc.js +580 -160
- package/dist/chunk-2PZYJQV5.js +83 -0
- package/dist/chunk-47ERTK5X.js +27 -0
- package/dist/{chunk-O3NJRGJ2.js → chunk-4XOYTBLS.js} +1 -1
- package/dist/chunk-767FTO7O.js +48 -0
- package/dist/{chunk-N4B5JNMA.js → chunk-7Y2F2IWN.js} +40 -28
- package/dist/chunk-B4M2Y7FT.js +96 -0
- package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
- package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
- package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
- package/dist/chunk-I3L4POY7.js +18 -0
- package/dist/{chunk-I7O5EGFV.js → chunk-LNGURVNH.js} +3 -3
- package/dist/{chunk-4NV4ZEFZ.js → chunk-NNOSOOWS.js} +4 -4
- package/dist/chunk-OVXQQEXL.js +41 -0
- package/dist/{chunk-WOU7JVD3.js → chunk-QLIEEICB.js} +205 -194
- package/dist/chunk-RMBWKZI2.js +130 -0
- package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
- package/dist/{chunk-L6ZHWJZ6.js → chunk-TZVPZHZM.js} +51 -29
- package/dist/chunk-WBTWY2OB.js +478 -0
- package/dist/chunk-Y4E3WJU5.js +87 -0
- package/dist/chunk-YPU3MDNI.js +852 -0
- package/dist/conventions.d.ts +70 -0
- package/dist/conventions.js +26 -0
- package/dist/crossings.d.ts +22 -10
- package/dist/crossings.js +1 -1
- package/dist/de440-pack.d.ts +43 -0
- package/dist/de440-pack.js +16 -0
- package/dist/de440.d.ts +113 -0
- package/dist/de440.js +19 -0
- package/dist/deltat.d.ts +28 -3
- package/dist/deltat.js +1 -1
- package/dist/ephemeris-exTSqBgb.d.ts +60 -0
- package/dist/geo.d.ts +46 -13
- package/dist/geo.js +4 -2
- package/dist/{houses-q1O2GGp4.d.ts → houses-Bh7GCnPi.d.ts} +14 -4
- package/dist/houses-extra.d.ts +22 -7
- package/dist/houses-extra.js +4 -2
- package/dist/index.d.ts +36 -49
- package/dist/index.js +54 -34
- package/dist/{internal-math-CmJ9xtaW.d.ts → internal-math-CxenuGfm.d.ts} +41 -27
- package/dist/internal-math.d.ts +4 -3
- package/dist/internal-math.js +14 -12
- package/dist/internal.d.ts +16 -7
- package/dist/internal.js +27 -6
- package/dist/lite-composite.js +114 -0
- package/dist/lite-declinations.js +253 -0
- package/dist/lite-dignities.js +333 -0
- package/dist/lite-sect.js +72 -0
- package/dist/lite.d.ts +82 -0
- package/dist/lite.js +4 -0
- package/dist/receipt.d.ts +3 -268
- package/dist/receipt.js +202 -89
- package/dist/reference-span-CILpclrz.d.ts +40 -0
- package/dist/{rulers-9wljfVaO.d.ts → rulers-CSSWtiWF.d.ts} +7 -2
- package/dist/sky.d.ts +26 -10
- package/dist/sky.js +23 -14
- package/dist/techniques.d.ts +160 -21
- package/dist/techniques.js +157 -89
- package/dist/time-bands-CZA9AlLg.d.ts +36 -0
- package/dist/time-scale-DIFNa0gz.d.ts +47 -0
- package/dist/time.d.ts +81 -0
- package/dist/time.js +74 -0
- package/dist/timing.d.ts +55 -17
- package/dist/timing.js +33 -45
- package/dist/types-DpPdtXgO.d.ts +335 -0
- package/dist/vedic.d.ts +150 -123
- package/dist/vedic.js +398 -440
- package/dist/window.d.ts +102 -80
- package/dist/window.js +108 -51
- package/dist/zone-history-BxmDCcTK.d.ts +290 -0
- package/package.json +26 -3
- package/dist/chunk-2OWGBT3O.js +0 -219
- package/dist/types-B4MCoCCS.d.ts +0 -228
package/dist/window.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { H as HouseSystem, B as BodyName, Z as ZodiacSign, b as HouseNumber,
|
|
1
|
+
import { H as HouseSystem, B as BodyName, Z as ZodiacSign, b as HouseNumber, f as AspectType, e as DateInput } from './types-DpPdtXgO.js';
|
|
2
2
|
import './deltat.js';
|
|
3
|
+
import './time-scale-DIFNa0gz.js';
|
|
3
4
|
|
|
4
|
-
/**
|
|
5
|
-
declare const
|
|
6
|
-
/**
|
|
7
|
-
declare const
|
|
5
|
+
/** The schema id of a birth window. */
|
|
6
|
+
declare const BIRTH_WINDOW_SCHEMA = "zodiacs.birth-window.v1";
|
|
7
|
+
/** How far this release's switch instants have been checked; a later release may check them further and say so here. */
|
|
8
|
+
declare const WINDOW_VERIFICATION: string;
|
|
9
|
+
/** The longest window accepted: 48 hours, in milliseconds. A minor release may accept a longer one. */
|
|
10
|
+
declare const MAX_WINDOW_MS: number;
|
|
8
11
|
/**
|
|
9
12
|
* Upper bounds on each body's longitude rate, degrees per day: twice the
|
|
10
13
|
* largest rate the engine's own positions reach from 1800 to 2200, scanned
|
|
@@ -15,15 +18,15 @@ declare const WINDOW_RATE_BOUNDS: Readonly<Record<BodyName, number>>;
|
|
|
15
18
|
/** A rounding model: the true instant is uniform over the rounding unit of the record. */
|
|
16
19
|
interface WindowRounding {
|
|
17
20
|
/** The recorded time, resolved to an instant. */
|
|
18
|
-
recorded: DateInput;
|
|
21
|
+
readonly recorded: DateInput;
|
|
19
22
|
/** The rounding unit, in minutes. */
|
|
20
|
-
minutes: number;
|
|
23
|
+
readonly minutes: number;
|
|
21
24
|
/**
|
|
22
25
|
* "nearest" (the default): the record is the nearest multiple of the unit,
|
|
23
26
|
* so the true instant lies within half a unit of it. "down": the record is
|
|
24
27
|
* the start of its unit, as a clock read without rounding up.
|
|
25
28
|
*/
|
|
26
|
-
mode?: "nearest" | "down";
|
|
29
|
+
readonly mode?: "nearest" | "down";
|
|
27
30
|
}
|
|
28
31
|
/**
|
|
29
32
|
* A window of possible birth instants, resolved by the caller, and a place.
|
|
@@ -32,133 +35,152 @@ interface WindowRounding {
|
|
|
32
35
|
*/
|
|
33
36
|
interface BirthWindowInput {
|
|
34
37
|
/** The first instant of the window. */
|
|
35
|
-
start?: DateInput;
|
|
38
|
+
readonly start?: DateInput;
|
|
36
39
|
/** The end of the window, which it does not include. */
|
|
37
|
-
end?: DateInput;
|
|
38
|
-
at?: DateInput;
|
|
40
|
+
readonly end?: DateInput;
|
|
41
|
+
readonly at?: DateInput;
|
|
39
42
|
/** Minutes either side of `at`, to the nearest millisecond. */
|
|
40
|
-
minutes?: number;
|
|
41
|
-
latitude: number;
|
|
42
|
-
longitude: number;
|
|
43
|
+
readonly minutes?: number;
|
|
44
|
+
readonly latitude: number;
|
|
45
|
+
readonly longitude: number;
|
|
43
46
|
/** Defaults to "whole", as for natalChart. */
|
|
44
|
-
houseSystem?: HouseSystem;
|
|
47
|
+
readonly houseSystem?: HouseSystem;
|
|
45
48
|
/** A second prior for the cells' shares; its unit must lie inside the window. */
|
|
46
|
-
rounding?: WindowRounding;
|
|
49
|
+
readonly rounding?: WindowRounding;
|
|
47
50
|
}
|
|
48
51
|
interface WindowAspect {
|
|
49
|
-
a: BodyName;
|
|
50
|
-
b: BodyName;
|
|
51
|
-
type: AspectType;
|
|
52
|
+
readonly a: BodyName;
|
|
53
|
+
readonly b: BodyName;
|
|
54
|
+
readonly type: AspectType;
|
|
52
55
|
}
|
|
53
56
|
/** The discrete features of the chart, as natalChart would give them, throughout a cell. */
|
|
54
57
|
interface WindowFeatures {
|
|
55
58
|
/** 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
|
+
readonly signs: Readonly<Record<BodyName, ZodiacSign | null>>;
|
|
60
|
+
readonly ascendant: ZodiacSign;
|
|
61
|
+
readonly midheaven: ZodiacSign;
|
|
59
62
|
/**
|
|
60
63
|
* Each body's house, as houseOf gives it from the chart's cusps; null for
|
|
61
64
|
* the nodes inside an unresolved interval where the houses are whole signs.
|
|
62
65
|
*/
|
|
63
|
-
houses: Record<BodyName, HouseNumber | null
|
|
66
|
+
readonly houses: Readonly<Record<BodyName, HouseNumber | null>>;
|
|
64
67
|
/** The aspects in orb, in natalChart's pair order. */
|
|
65
|
-
aspects: WindowAspect[];
|
|
68
|
+
readonly aspects: readonly WindowAspect[];
|
|
66
69
|
/** The house system used: the requested one, or "whole" where Placidus or Koch falls back. */
|
|
67
|
-
houseSystem: HouseSystem;
|
|
70
|
+
readonly houseSystem: HouseSystem;
|
|
68
71
|
}
|
|
69
72
|
interface BirthWindowCell {
|
|
70
73
|
/** First instant of the cell. */
|
|
71
|
-
start: Date;
|
|
74
|
+
readonly start: Date;
|
|
72
75
|
/** End of the cell, which it does not include. */
|
|
73
|
-
end: Date;
|
|
74
|
-
milliseconds: number;
|
|
76
|
+
readonly end: Date;
|
|
77
|
+
readonly milliseconds: number;
|
|
75
78
|
/** Share of the window under a uniform prior. */
|
|
76
|
-
share: number;
|
|
79
|
+
readonly share: number;
|
|
77
80
|
/** Share under the rounding model, when one was given. */
|
|
78
|
-
roundedShare?: number;
|
|
79
|
-
features: WindowFeatures;
|
|
81
|
+
readonly roundedShare?: number;
|
|
82
|
+
readonly features: WindowFeatures;
|
|
80
83
|
}
|
|
81
84
|
/** A change to or from null opens or closes an unresolved interval; it is not a crossing. */
|
|
82
85
|
type WindowChange = {
|
|
83
|
-
feature: "sign";
|
|
84
|
-
body: BodyName;
|
|
85
|
-
from: ZodiacSign | null;
|
|
86
|
-
to: ZodiacSign | null;
|
|
86
|
+
readonly feature: "sign";
|
|
87
|
+
readonly body: BodyName;
|
|
88
|
+
readonly from: ZodiacSign | null;
|
|
89
|
+
readonly to: ZodiacSign | null;
|
|
87
90
|
} | {
|
|
88
|
-
feature: "ascendant" | "midheaven";
|
|
89
|
-
from: ZodiacSign;
|
|
90
|
-
to: ZodiacSign;
|
|
91
|
+
readonly feature: "ascendant" | "midheaven";
|
|
92
|
+
readonly from: ZodiacSign;
|
|
93
|
+
readonly to: ZodiacSign;
|
|
91
94
|
} | {
|
|
92
|
-
feature: "house";
|
|
93
|
-
body: BodyName;
|
|
94
|
-
from: HouseNumber | null;
|
|
95
|
-
to: HouseNumber | null;
|
|
95
|
+
readonly feature: "house";
|
|
96
|
+
readonly body: BodyName;
|
|
97
|
+
readonly from: HouseNumber | null;
|
|
98
|
+
readonly to: HouseNumber | null;
|
|
96
99
|
} | {
|
|
97
|
-
feature: "aspect";
|
|
98
|
-
a: BodyName;
|
|
99
|
-
b: BodyName;
|
|
100
|
-
from: AspectType | null;
|
|
101
|
-
to: AspectType | null;
|
|
100
|
+
readonly feature: "aspect";
|
|
101
|
+
readonly a: BodyName;
|
|
102
|
+
readonly b: BodyName;
|
|
103
|
+
readonly from: AspectType | null;
|
|
104
|
+
readonly to: AspectType | null;
|
|
102
105
|
} | {
|
|
103
|
-
feature: "house-system";
|
|
104
|
-
from: HouseSystem;
|
|
105
|
-
to: HouseSystem;
|
|
106
|
+
readonly feature: "house-system";
|
|
107
|
+
readonly from: HouseSystem;
|
|
108
|
+
readonly to: HouseSystem;
|
|
106
109
|
};
|
|
107
110
|
interface BirthWindowSwitch {
|
|
108
111
|
/**
|
|
109
112
|
* The first millisecond with the new features: the engine's value at the
|
|
110
113
|
* millisecond before differs, so the crossing lies in (at − 1 ms, at].
|
|
111
114
|
*/
|
|
112
|
-
at: Date;
|
|
113
|
-
changes: WindowChange[];
|
|
115
|
+
readonly at: Date;
|
|
116
|
+
readonly changes: readonly WindowChange[];
|
|
114
117
|
}
|
|
115
118
|
/** Where the node's jitter would outlast the budget: these features are null in every cell of [start, end). */
|
|
116
119
|
interface WindowUnresolved {
|
|
117
|
-
start: Date;
|
|
120
|
+
readonly start: Date;
|
|
118
121
|
/** 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";
|
|
122
|
+
readonly end: Date;
|
|
123
|
+
readonly milliseconds: number;
|
|
124
|
+
readonly features: readonly {
|
|
125
|
+
readonly feature: "sign" | "house";
|
|
126
|
+
readonly body: "North Node" | "South Node";
|
|
124
127
|
}[];
|
|
125
128
|
}
|
|
126
129
|
type BirthWindowFlag = "polar-fallback"
|
|
127
130
|
/** An interval's end-to-end change broke a bound; completeness is then not established. */
|
|
128
131
|
| "bound-exceeded"
|
|
129
132
|
/** The result lists unresolved intervals. */
|
|
130
|
-
| "node-unresolved"
|
|
133
|
+
| "node-unresolved"
|
|
134
|
+
/**
|
|
135
|
+
* The window was to be computed on the shipped DE440 pack, the default
|
|
136
|
+
* source, and the pack could not be opened: it was computed on
|
|
137
|
+
* astronomy-engine, which `ephemeris` names (`EphemerisFallback` in the
|
|
138
|
+
* root entry).
|
|
139
|
+
*/
|
|
140
|
+
| "de440-unavailable";
|
|
131
141
|
interface BirthWindow {
|
|
132
|
-
schema:
|
|
142
|
+
readonly schema: typeof BIRTH_WINDOW_SCHEMA;
|
|
133
143
|
/** How far the switch instants have been checked: dense one-second sampling, not proof. */
|
|
134
|
-
verification:
|
|
135
|
-
start: Date;
|
|
136
|
-
end: Date;
|
|
137
|
-
latitude: number;
|
|
138
|
-
longitude: number;
|
|
144
|
+
readonly verification: string;
|
|
145
|
+
readonly start: Date;
|
|
146
|
+
readonly end: Date;
|
|
147
|
+
readonly latitude: number;
|
|
148
|
+
readonly longitude: number;
|
|
139
149
|
/** 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;
|
|
150
|
+
readonly houseSystem: HouseSystem;
|
|
151
|
+
readonly rounding: {
|
|
152
|
+
readonly recorded: Date;
|
|
153
|
+
readonly minutes: number;
|
|
154
|
+
readonly mode: "nearest" | "down";
|
|
155
|
+
readonly start: Date;
|
|
156
|
+
readonly end: Date;
|
|
147
157
|
} | null;
|
|
148
158
|
/** Cells in time order; they tile [start, end). */
|
|
149
|
-
cells: BirthWindowCell[];
|
|
159
|
+
readonly cells: readonly BirthWindowCell[];
|
|
150
160
|
/** Switches in time order, one per cell boundary. */
|
|
151
|
-
switches: BirthWindowSwitch[];
|
|
161
|
+
readonly switches: readonly BirthWindowSwitch[];
|
|
152
162
|
/** Intervals left unresolved, in time order; empty unless `node-unresolved` is flagged. */
|
|
153
|
-
unresolved: WindowUnresolved[];
|
|
154
|
-
flags: BirthWindowFlag[];
|
|
155
|
-
engineVersion: string;
|
|
163
|
+
readonly unresolved: readonly WindowUnresolved[];
|
|
164
|
+
readonly flags: readonly BirthWindowFlag[];
|
|
165
|
+
readonly engineVersion: string;
|
|
166
|
+
/**
|
|
167
|
+
* What every position in the window was computed on, the source a lone
|
|
168
|
+
* natalChart call at any of its instants uses: `"jpl-de440"` with the
|
|
169
|
+
* shipped pack's SHA-256 (REFERENCE_SPAN lies inside the pack), or
|
|
170
|
+
* `"astronomy-engine"` with its version, by the caller's choice
|
|
171
|
+
* (`setDefaultEphemeris`) or, with the flag `"de440-unavailable"`, as a
|
|
172
|
+
* fallback.
|
|
173
|
+
*/
|
|
174
|
+
readonly ephemeris: {
|
|
175
|
+
readonly name: string;
|
|
176
|
+
readonly version: string;
|
|
177
|
+
};
|
|
156
178
|
}
|
|
157
179
|
/** Thrown when a window needs more evaluated instants than the search allows. An Error, not a RangeError. */
|
|
158
180
|
declare class WindowBudgetError extends Error {
|
|
159
181
|
readonly name = "WindowBudgetError";
|
|
160
|
-
/** The instants the search allows. */
|
|
161
|
-
readonly limit
|
|
182
|
+
/** The instants the search allows; a later release may allow more. */
|
|
183
|
+
readonly limit: number;
|
|
162
184
|
constructor();
|
|
163
185
|
}
|
|
164
186
|
/**
|
|
@@ -175,4 +197,4 @@ declare class WindowBudgetError extends Error {
|
|
|
175
197
|
*/
|
|
176
198
|
declare function birthWindow(input: BirthWindowInput): BirthWindow;
|
|
177
199
|
|
|
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 };
|
|
200
|
+
export { BIRTH_WINDOW_SCHEMA, 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 };
|
package/dist/window.js
CHANGED
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
dateFrom
|
|
3
|
-
} from "./chunk-CPALRSPC.js";
|
|
4
|
-
import {
|
|
5
|
-
validateBirthSettings
|
|
6
|
-
} from "./chunk-PFGUCNOK.js";
|
|
7
1
|
import {
|
|
8
2
|
bodyLongitude,
|
|
3
|
+
ephemerisAt,
|
|
9
4
|
gastHours,
|
|
10
5
|
onChartClock,
|
|
11
|
-
|
|
12
|
-
} from "./chunk-
|
|
6
|
+
refuseUnderSource
|
|
7
|
+
} from "./chunk-QLIEEICB.js";
|
|
8
|
+
import {
|
|
9
|
+
dateFrom
|
|
10
|
+
} from "./chunk-CPALRSPC.js";
|
|
11
|
+
import {
|
|
12
|
+
ASPECTS,
|
|
13
|
+
ASPECT_TYPES,
|
|
14
|
+
ENGINE_VERSION,
|
|
15
|
+
matchAspect,
|
|
16
|
+
separation
|
|
17
|
+
} from "./chunk-B4M2Y7FT.js";
|
|
18
|
+
import "./chunk-2PZYJQV5.js";
|
|
13
19
|
import {
|
|
14
20
|
REFERENCE_SPAN,
|
|
15
21
|
elapsedDays,
|
|
16
22
|
timeBasis
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-B5LKF437.js";
|
|
24
|
+
import "./chunk-767FTO7O.js";
|
|
25
|
+
import "./chunk-YPU3MDNI.js";
|
|
26
|
+
import {
|
|
27
|
+
tilt
|
|
28
|
+
} from "./chunk-Y4E3WJU5.js";
|
|
19
29
|
import {
|
|
20
30
|
computeAngles,
|
|
21
31
|
computeHouses,
|
|
22
32
|
houseOf,
|
|
23
33
|
isPolarUndefinedHouseSystem
|
|
24
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-NNOSOOWS.js";
|
|
25
35
|
import {
|
|
26
|
-
|
|
27
|
-
ASPECT_TYPES,
|
|
28
|
-
ENGINE_VERSION,
|
|
29
|
-
SIGN_NAMES,
|
|
30
|
-
matchAspect,
|
|
36
|
+
SIGN_SLUGS,
|
|
31
37
|
normalizeLongitude,
|
|
32
|
-
separation,
|
|
33
38
|
signIndexForLongitude
|
|
34
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-RMBWKZI2.js";
|
|
40
|
+
import "./chunk-BHJXUY67.js";
|
|
41
|
+
import {
|
|
42
|
+
validateBirthSettings
|
|
43
|
+
} from "./chunk-BMDASNPB.js";
|
|
35
44
|
|
|
36
45
|
// src/window-ranges.ts
|
|
37
46
|
var DEG = Math.PI / 180;
|
|
@@ -119,9 +128,10 @@ var DAY = 864e5;
|
|
|
119
128
|
var DEG2 = Math.PI / 180;
|
|
120
129
|
var RAD2 = 180 / Math.PI;
|
|
121
130
|
var J2000 = Date.UTC(2e3, 0, 1, 12);
|
|
131
|
+
var BIRTH_WINDOW_SCHEMA = "zodiacs.birth-window.v1";
|
|
122
132
|
var WINDOW_VERIFICATION = "sampled at one-second resolution";
|
|
123
133
|
var MAX_WINDOW_MS = 1728e5;
|
|
124
|
-
var WINDOW_RATE_BOUNDS = Object.freeze({
|
|
134
|
+
var WINDOW_RATE_BOUNDS = /* @__PURE__ */ Object.freeze({
|
|
125
135
|
Sun: 2.1,
|
|
126
136
|
Moon: 31,
|
|
127
137
|
Mercury: 4.5,
|
|
@@ -143,8 +153,8 @@ var SIDEREAL_RATE = 360.98562;
|
|
|
143
153
|
var MAX_ANGLE_MS = Math.floor(45 / SIDEREAL_RATE * DAY);
|
|
144
154
|
var BAND = 1e-9;
|
|
145
155
|
var MAX_EVALUATIONS = 2e6;
|
|
146
|
-
var SPAN_FROM = Date.parse(REFERENCE_SPAN.from);
|
|
147
|
-
var SPAN_TO = Date.parse(REFERENCE_SPAN.to);
|
|
156
|
+
var SPAN_FROM = /* @__PURE__ */ (() => Date.parse(REFERENCE_SPAN.from))();
|
|
157
|
+
var SPAN_TO = /* @__PURE__ */ (() => Date.parse(REFERENCE_SPAN.to))();
|
|
148
158
|
var POLE_MARGIN = 1e-6;
|
|
149
159
|
var NODE_COARSE_MS = 36e5;
|
|
150
160
|
var NODE_FINE_MS = 6e4;
|
|
@@ -167,7 +177,8 @@ var BODIES = [
|
|
|
167
177
|
];
|
|
168
178
|
var NORTH = 10;
|
|
169
179
|
var SOUTH = 11;
|
|
170
|
-
var RATES = BODIES.map((body) => WINDOW_RATE_BOUNDS[body]);
|
|
180
|
+
var RATES = /* @__PURE__ */ BODIES.map((body) => WINDOW_RATE_BOUNDS[body]);
|
|
181
|
+
var DEFLECTION_JITTER = 1.8 / 3600;
|
|
171
182
|
var PAIRS = [];
|
|
172
183
|
for (let first = 0; first < 10; first += 1) {
|
|
173
184
|
for (let second = first + 1; second < 10; second += 1) PAIRS.push([first, second]);
|
|
@@ -176,8 +187,8 @@ var orbEdges = (luminary) => ASPECTS.flatMap(({ angle, orb, luminaryOrb }) => {
|
|
|
176
187
|
const width = luminary ? luminaryOrb : orb;
|
|
177
188
|
return [angle - width, angle + width].filter((edge) => edge > 0 && edge < 180);
|
|
178
189
|
});
|
|
179
|
-
var ORB_EDGES = orbEdges(false);
|
|
180
|
-
var LUMINARY_ORB_EDGES = orbEdges(true);
|
|
190
|
+
var ORB_EDGES = /* @__PURE__ */ orbEdges(false);
|
|
191
|
+
var LUMINARY_ORB_EDGES = /* @__PURE__ */ orbEdges(true);
|
|
181
192
|
var ASC = 12;
|
|
182
193
|
var MC = 13;
|
|
183
194
|
var HOUSE = 14;
|
|
@@ -195,7 +206,7 @@ var SENSITIVE_RAMC = {
|
|
|
195
206
|
};
|
|
196
207
|
var WindowBudgetError = class extends Error {
|
|
197
208
|
name = "WindowBudgetError";
|
|
198
|
-
/** The instants the search allows. */
|
|
209
|
+
/** The instants the search allows; a later release may allow more. */
|
|
199
210
|
limit = MAX_EVALUATIONS;
|
|
200
211
|
constructor() {
|
|
201
212
|
super(
|
|
@@ -214,7 +225,7 @@ function firstWhere(holds, from, to) {
|
|
|
214
225
|
return high;
|
|
215
226
|
}
|
|
216
227
|
var onePiece = (a, b) => Number.isNaN(elapsedDays(timeBasis(a, "utc"), timeBasis(b, "utc"), Number.NaN));
|
|
217
|
-
function seamsIn(start, end) {
|
|
228
|
+
function seamsIn(start, end, source) {
|
|
218
229
|
const steps = [];
|
|
219
230
|
let from = start - 1;
|
|
220
231
|
while (from < end && !onePiece(from, end)) {
|
|
@@ -222,14 +233,26 @@ function seamsIn(start, end) {
|
|
|
222
233
|
steps.push(at - 1, at, at + 1);
|
|
223
234
|
from = at;
|
|
224
235
|
}
|
|
225
|
-
return { bodies: BODIES.map(() => steps), angles: steps };
|
|
236
|
+
return { bodies: BODIES.map(() => [...steps, ...sourceSteps(start, end, source)]), angles: steps };
|
|
237
|
+
}
|
|
238
|
+
function sourceSteps(start, end, source) {
|
|
239
|
+
if (!source?.steps) return [];
|
|
240
|
+
const tt = (time) => timeBasis(time, "utc").ttDays;
|
|
241
|
+
const found = [];
|
|
242
|
+
for (const step of source.steps(tt(start - 1), tt(end))) {
|
|
243
|
+
if (!(tt(end) >= step)) continue;
|
|
244
|
+
const at = tt(start - 1) >= step ? start - 1 : firstWhere((time) => tt(time) >= step, start - 1, end);
|
|
245
|
+
for (let near = at - 2; near <= at + 2; near += 1) found.push(near);
|
|
246
|
+
}
|
|
247
|
+
return found;
|
|
226
248
|
}
|
|
227
249
|
var Sky = class {
|
|
228
|
-
constructor(latitude, longitude, system, seams) {
|
|
250
|
+
constructor(latitude, longitude, system, seams, source = null) {
|
|
229
251
|
this.latitude = latitude;
|
|
230
252
|
this.longitude = longitude;
|
|
231
253
|
this.system = system;
|
|
232
254
|
this.seams = seams;
|
|
255
|
+
this.source = source;
|
|
233
256
|
this.tanPhi = Math.tan(latitude * DEG2);
|
|
234
257
|
const values = SENSITIVE_RAMC[system];
|
|
235
258
|
this.sensitive = values ? values[latitude >= 0 ? 0 : 1] : [];
|
|
@@ -238,6 +261,7 @@ var Sky = class {
|
|
|
238
261
|
longitude;
|
|
239
262
|
system;
|
|
240
263
|
seams;
|
|
264
|
+
source;
|
|
241
265
|
instants = /* @__PURE__ */ new Map();
|
|
242
266
|
evaluations = 0;
|
|
243
267
|
violations = 0;
|
|
@@ -265,6 +289,35 @@ var Sky = class {
|
|
|
265
289
|
}
|
|
266
290
|
return value;
|
|
267
291
|
}
|
|
292
|
+
/** The bound on a body's longitude rate, degrees a day: its WINDOW_RATE_BOUNDS entry. */
|
|
293
|
+
rate(index) {
|
|
294
|
+
return RATES[index];
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* The most the Sun's light deflection may displace a body's longitude at
|
|
298
|
+
* any instant of [t1, t2], degrees: on a source that bends light at the
|
|
299
|
+
* Sun (the DE440 pack's reduction, src/de440/reduce.ts), for Mercury to
|
|
300
|
+
* Pluto within a degree of the Sun in longitude, DEFLECTION_JITTER, and
|
|
301
|
+
* otherwise nothing. The reduction bends light outside the Sun's disc and
|
|
302
|
+
* not behind it (from 1.1.0-rc.12), so the place is the undeflected place,
|
|
303
|
+
* whose rate the body's bound covers, plus a displacement of at most
|
|
304
|
+
* 4GM/c²R = 1.7512″ (light passing at the limb), which steps to nothing
|
|
305
|
+
* where the body passes behind the limb. The search takes that
|
|
306
|
+
* displacement as it takes the true node's jitter. Farther than a degree
|
|
307
|
+
* in longitude the deflection's rate is under 0.002 degrees a day, inside
|
|
308
|
+
* what every rate bound has in hand (each is about twice the body's
|
|
309
|
+
* largest rate), and the disc is far away. Through 1.1.0-rc.11 the
|
|
310
|
+
* reduction bent light behind the disc too, without limit towards the
|
|
311
|
+
* centre, and the rate bound grew as the inverse square of the elongation
|
|
312
|
+
* instead.
|
|
313
|
+
*/
|
|
314
|
+
bend(index, t1, t2) {
|
|
315
|
+
if (!this.source || index < 2 || index >= NORTH) return 0;
|
|
316
|
+
const days = (t2 - t1) / DAY;
|
|
317
|
+
const against = RATES[index] + RATES[0];
|
|
318
|
+
const apart = Math.min(Math.abs(signedDelta(this.lon(t1, 0), this.lon(t1, index))), Math.abs(signedDelta(this.lon(t2, 0), this.lon(t2, index))));
|
|
319
|
+
return apart - against * days >= 1 ? 0 : DEFLECTION_JITTER;
|
|
320
|
+
}
|
|
268
321
|
node(time) {
|
|
269
322
|
return bodyLongitude("North Node", new Date(time));
|
|
270
323
|
}
|
|
@@ -342,10 +395,10 @@ var Interval = class {
|
|
|
342
395
|
const known = this.bodies[index];
|
|
343
396
|
if (known !== void 0) return known;
|
|
344
397
|
const { sky, t1, t2 } = this;
|
|
345
|
-
const reach =
|
|
346
|
-
const jitter = index >= NORTH ?
|
|
398
|
+
const reach = sky.rate(index) * (t2 - t1) / DAY;
|
|
399
|
+
const jitter = 2 * (index >= NORTH ? Math.max(nodeJitter(t1), nodeJitter(t2)) : sky.bend(index, t1, t2));
|
|
347
400
|
let range;
|
|
348
|
-
if (reach + jitter
|
|
401
|
+
if (!(reach + jitter < 90) || this.jumps(sky.seams.bodies[index])) range = null;
|
|
349
402
|
else {
|
|
350
403
|
const l1 = sky.lon(t1, index);
|
|
351
404
|
const step = signedDelta(l1, sky.lon(t2, index));
|
|
@@ -365,13 +418,15 @@ var Interval = class {
|
|
|
365
418
|
if (this.jumps(sky.seams.bodies[first]) || this.jumps(sky.seams.bodies[second])) return true;
|
|
366
419
|
const s1 = separation(sky.lon(t1, first), sky.lon(t1, second));
|
|
367
420
|
const s2 = separation(sky.lon(t2, first), sky.lon(t2, second));
|
|
368
|
-
const reach = (
|
|
369
|
-
|
|
421
|
+
const reach = (sky.rate(first) + sky.rate(second)) * (t2 - t1) / DAY;
|
|
422
|
+
const jitter = 2 * (sky.bend(first, t1, t2) + sky.bend(second, t1, t2));
|
|
423
|
+
if (!(reach < 360)) return true;
|
|
424
|
+
if (Math.abs(s2 - s1) > reach + jitter + 1e-12) {
|
|
370
425
|
this.violation();
|
|
371
426
|
return true;
|
|
372
427
|
}
|
|
373
|
-
const lo = (s1 + s2 - reach) / 2 - BAND;
|
|
374
|
-
const hi = (s1 + s2 + reach) / 2 + BAND;
|
|
428
|
+
const lo = (s1 + s2 - reach) / 2 - jitter - BAND;
|
|
429
|
+
const hi = (s1 + s2 + reach) / 2 + jitter + BAND;
|
|
375
430
|
const edges = first < 2 ? LUMINARY_ORB_EDGES : ORB_EDGES;
|
|
376
431
|
return edges.some((edge) => edge >= lo && edge <= hi);
|
|
377
432
|
}
|
|
@@ -784,7 +839,7 @@ function features(values, system) {
|
|
|
784
839
|
BODIES.forEach((body, index) => {
|
|
785
840
|
const sign = values[index];
|
|
786
841
|
const house = values[HOUSE + index];
|
|
787
|
-
signs[body] = sign === UNRESOLVED ? null :
|
|
842
|
+
signs[body] = sign === UNRESOLVED ? null : SIGN_SLUGS[sign];
|
|
788
843
|
houses[body] = house === UNRESOLVED ? null : house;
|
|
789
844
|
});
|
|
790
845
|
const aspects = [];
|
|
@@ -794,19 +849,19 @@ function features(values, system) {
|
|
|
794
849
|
});
|
|
795
850
|
return {
|
|
796
851
|
signs,
|
|
797
|
-
ascendant:
|
|
798
|
-
midheaven:
|
|
852
|
+
ascendant: SIGN_SLUGS[values[ASC]],
|
|
853
|
+
midheaven: SIGN_SLUGS[values[MC]],
|
|
799
854
|
houses,
|
|
800
855
|
aspects,
|
|
801
856
|
houseSystem: values[SYSTEM] === 1 ? "whole" : system
|
|
802
857
|
};
|
|
803
858
|
}
|
|
804
859
|
function change(id, from, to, system) {
|
|
805
|
-
const sign = (value) => value === UNRESOLVED ? null :
|
|
860
|
+
const sign = (value) => value === UNRESOLVED ? null : SIGN_SLUGS[value];
|
|
806
861
|
const house = (value) => value === UNRESOLVED ? null : value;
|
|
807
862
|
if (id < ASC) return { feature: "sign", body: BODIES[id], from: sign(from), to: sign(to) };
|
|
808
863
|
if (id === ASC || id === MC) {
|
|
809
|
-
return { feature: id === ASC ? "ascendant" : "midheaven", from:
|
|
864
|
+
return { feature: id === ASC ? "ascendant" : "midheaven", from: SIGN_SLUGS[from], to: SIGN_SLUGS[to] };
|
|
810
865
|
}
|
|
811
866
|
if (id < ASPECT) return { feature: "house", body: BODIES[id - HOUSE], from: house(from), to: house(to) };
|
|
812
867
|
if (id < SYSTEM) {
|
|
@@ -822,6 +877,7 @@ function change(id, from, to, system) {
|
|
|
822
877
|
return { feature: "house-system", from: from === 1 ? "whole" : system, to: to === 1 ? "whole" : system };
|
|
823
878
|
}
|
|
824
879
|
function birthWindow(input) {
|
|
880
|
+
refuseUnderSource("birthWindow");
|
|
825
881
|
if (!input || typeof input !== "object") throw new RangeError("input must be an object.");
|
|
826
882
|
const settings = validateBirthSettings({
|
|
827
883
|
latitude: input.latitude,
|
|
@@ -838,7 +894,8 @@ function birthWindow(input) {
|
|
|
838
894
|
}
|
|
839
895
|
const system = settings.houseSystem ?? "whole";
|
|
840
896
|
const { start, end, rounding } = resolvedWindow(input);
|
|
841
|
-
const
|
|
897
|
+
const chosen = ephemerisAt(start);
|
|
898
|
+
const sky = new Sky(latitude, longitude, system, seamsIn(start, end, chosen.from), chosen.from);
|
|
842
899
|
const ids = Array.from({ length: SYSTEM + 1 }, (_, id) => id).filter(
|
|
843
900
|
(id) => id !== SYSTEM || isPolarUndefinedHouseSystem(system)
|
|
844
901
|
);
|
|
@@ -889,18 +946,15 @@ function birthWindow(input) {
|
|
|
889
946
|
let fallback = values[SYSTEM] === 1;
|
|
890
947
|
const close = (cellEnd) => {
|
|
891
948
|
const milliseconds = cellEnd - cellStart;
|
|
892
|
-
const
|
|
949
|
+
const overlap = support && Math.max(0, Math.min(cellEnd, support[1]) - Math.max(cellStart, support[0]));
|
|
950
|
+
cells.push({
|
|
893
951
|
start: new Date(cellStart),
|
|
894
952
|
end: new Date(cellEnd),
|
|
895
953
|
milliseconds,
|
|
896
954
|
share: milliseconds / length,
|
|
897
|
-
features: features(values, system)
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
const overlap = Math.max(0, Math.min(cellEnd, support[1]) - Math.max(cellStart, support[0]));
|
|
901
|
-
cell.roundedShare = overlap / (support[1] - support[0]);
|
|
902
|
-
}
|
|
903
|
-
cells.push(cell);
|
|
955
|
+
features: features(values, system),
|
|
956
|
+
...support ? { roundedShare: overlap / (support[1] - support[0]) } : {}
|
|
957
|
+
});
|
|
904
958
|
cellStart = cellEnd;
|
|
905
959
|
};
|
|
906
960
|
for (let index = 0; index < changes.length; ) {
|
|
@@ -925,8 +979,9 @@ function birthWindow(input) {
|
|
|
925
979
|
if (fallback) flags.push("polar-fallback");
|
|
926
980
|
if (sky.violations > 0) flags.push("bound-exceeded");
|
|
927
981
|
if (unresolved.length > 0) flags.push("node-unresolved");
|
|
982
|
+
if (chosen.fallback === "de440-unavailable") flags.push(chosen.fallback);
|
|
928
983
|
return {
|
|
929
|
-
schema:
|
|
984
|
+
schema: BIRTH_WINDOW_SCHEMA,
|
|
930
985
|
verification: WINDOW_VERIFICATION,
|
|
931
986
|
start: new Date(start),
|
|
932
987
|
end: new Date(end),
|
|
@@ -949,10 +1004,12 @@ function birthWindow(input) {
|
|
|
949
1004
|
};
|
|
950
1005
|
}),
|
|
951
1006
|
flags,
|
|
952
|
-
engineVersion: ENGINE_VERSION
|
|
1007
|
+
engineVersion: ENGINE_VERSION,
|
|
1008
|
+
ephemeris: chosen.ephemeris
|
|
953
1009
|
};
|
|
954
1010
|
}
|
|
955
1011
|
export {
|
|
1012
|
+
BIRTH_WINDOW_SCHEMA,
|
|
956
1013
|
MAX_WINDOW_MS,
|
|
957
1014
|
WINDOW_RATE_BOUNDS,
|
|
958
1015
|
WINDOW_VERIFICATION,
|