@zodiacs/engine 1.1.0 → 2.0.0-rc.2
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 +224 -0
- package/LICENSING.md +4 -0
- package/README.md +71 -30
- package/dist/{api-ChL1N2Sr.d.ts → api-C_SVd9BJ.d.ts} +7 -2
- package/dist/{ayanamsa-ClFzkKmV.d.ts → ayanamsa-Clgkekhh.d.ts} +1 -1
- package/dist/calc.d.ts +3 -2
- package/dist/calc.js +18 -10
- package/dist/{chunk-Y4E3WJU5.js → chunk-CV53HA7R.js} +1 -1
- package/dist/{chunk-2PZYJQV5.js → chunk-EEW7746S.js} +1 -1
- package/dist/{chunk-WBTWY2OB.js → chunk-FVGA776A.js} +2 -2
- package/dist/{chunk-YPU3MDNI.js → chunk-HNVGWN3S.js} +1 -1
- package/dist/{chunk-TZVPZHZM.js → chunk-IXFUYEUF.js} +28 -11
- package/dist/{chunk-4XOYTBLS.js → chunk-LWZS7HI3.js} +1 -1
- package/dist/{chunk-LNGURVNH.js → chunk-N4UQLCBN.js} +1 -1
- package/dist/{chunk-7Y2F2IWN.js → chunk-NX4PHQBL.js} +16 -6
- package/dist/{chunk-QLIEEICB.js → chunk-PNXIA7MI.js} +24 -10
- package/dist/{chunk-NNOSOOWS.js → chunk-SCRO6HWB.js} +4 -2
- package/dist/{chunk-B4M2Y7FT.js → chunk-T6F4FYYS.js} +1 -1
- package/dist/{chunk-767FTO7O.js → chunk-UXY4RU57.js} +1 -1
- package/dist/{chunk-BMDASNPB.js → chunk-WONTOC5W.js} +2 -1
- package/dist/crossings.d.ts +1 -1
- package/dist/de440-pack.d.ts +1 -1
- package/dist/de440-pack.js +4 -4
- package/dist/de440.d.ts +1 -1
- package/dist/de440.js +3 -3
- package/dist/{ephemeris-exTSqBgb.d.ts → ephemeris-D1lM832F.d.ts} +5 -1
- package/dist/geo.d.ts +14 -5
- package/dist/geo.js +2 -2
- package/dist/houses-extra.d.ts +2 -2
- package/dist/{houses-Bh7GCnPi.d.ts → houses-icK01yXi.d.ts} +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +10 -10
- package/dist/{internal-math-CxenuGfm.d.ts → internal-math-BGX23p4h.d.ts} +2 -2
- package/dist/internal-math.d.ts +3 -3
- package/dist/internal-math.js +2 -2
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +7 -7
- package/dist/receipt.d.ts +2 -2
- package/dist/receipt.js +15 -4
- package/dist/{rulers-CSSWtiWF.d.ts → rulers-CpS9qkvu.d.ts} +1 -1
- package/dist/sky.d.ts +3 -3
- package/dist/sky.js +8 -8
- package/dist/techniques.d.ts +2 -2
- package/dist/techniques.js +10 -10
- package/dist/time.js +3 -3
- package/dist/timing.d.ts +4 -4
- package/dist/timing.js +10 -10
- package/dist/{types-DpPdtXgO.d.ts → types-BCnyWBQZ.d.ts} +21 -4
- package/dist/vedic.d.ts +3 -3
- package/dist/vedic.js +10 -10
- package/dist/window.d.ts +1 -1
- package/dist/window.js +8 -8
- package/dist/{zone-history-BxmDCcTK.d.ts → zone-history-0XzMGx9V.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
ephemerisAt,
|
|
10
10
|
longitudeSpeed,
|
|
11
11
|
notingFallbacks
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PNXIA7MI.js";
|
|
13
13
|
import {
|
|
14
14
|
dateFrom
|
|
15
15
|
} from "./chunk-CPALRSPC.js";
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ASPECT_BODY_SET,
|
|
18
18
|
EPHEMERIS,
|
|
19
19
|
matchAspect
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-T6F4FYYS.js";
|
|
21
21
|
import {
|
|
22
22
|
TIME_SCALE_NAMES,
|
|
23
23
|
outsideReferenceSpan,
|
|
@@ -29,8 +29,9 @@ import {
|
|
|
29
29
|
} from "./chunk-TSS2SZWQ.js";
|
|
30
30
|
import {
|
|
31
31
|
POLAR_FALLBACK,
|
|
32
|
-
isPolarUndefinedHouseSystem
|
|
33
|
-
|
|
32
|
+
isPolarUndefinedHouseSystem,
|
|
33
|
+
meanObliquity
|
|
34
|
+
} from "./chunk-SCRO6HWB.js";
|
|
34
35
|
import {
|
|
35
36
|
normalizeLongitude,
|
|
36
37
|
signForLongitude
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
snapshotFlags,
|
|
41
42
|
timeFlags,
|
|
42
43
|
validateBirthSettings
|
|
43
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-WONTOC5W.js";
|
|
44
45
|
|
|
45
46
|
// src/returns.ts
|
|
46
47
|
var DAY = 864e5;
|
|
@@ -207,8 +208,11 @@ function resolvedChart(source) {
|
|
|
207
208
|
if (isPolarUndefinedHouseSystem(input.houseSystem) && actualHouseSystem === POLAR_FALLBACK) {
|
|
208
209
|
expected.push("polar-fallback");
|
|
209
210
|
}
|
|
211
|
+
const basis = timeBasis(+input.utc, input.timeScale, input.deltaT);
|
|
212
|
+
if (hasHouses && resultFlags.values.includes("polar-angles") && Math.abs(input.latitude) >= 90 - meanObliquity(basis.ttDays / 36525) - 3e-3)
|
|
213
|
+
expected.push("polar-angles");
|
|
210
214
|
if (outsideReferenceSpan(input.utc)) expected.push("outside-reference-span");
|
|
211
|
-
if (resultFlags.values.length > expected.length && deltaTExtrapolated(
|
|
215
|
+
if (resultFlags.values.length > expected.length && deltaTExtrapolated(basis, hasHouses))
|
|
212
216
|
expected.push("delta-t-extrapolated");
|
|
213
217
|
if (source.ephemeris === void 0 || source.ephemeris?.name === "astronomy-engine") {
|
|
214
218
|
for (const reason of ["de440-unavailable", "outside-de440-span"]) if (resultFlags.values.includes(reason)) expected.push(reason);
|
|
@@ -240,6 +244,13 @@ var BIRTH_FIELDS = [
|
|
|
240
244
|
"flags",
|
|
241
245
|
"deltaT"
|
|
242
246
|
];
|
|
247
|
+
function noBareDate(value, name) {
|
|
248
|
+
if (typeof value === "string" && !value.includes("T")) {
|
|
249
|
+
throw new RangeError(
|
|
250
|
+
`${name} is a calendar date with no time. Give the birth instant with its UTC offset, such as 1990-05-03T08:30:00+02:00, or set timeKnown: false if the birth time is not known.`
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
243
254
|
function validateBirth(birth) {
|
|
244
255
|
if (!birth || typeof birth !== "object" || Array.isArray(birth)) {
|
|
245
256
|
throw new RangeError("birth must be an object containing a resolved utc instant.");
|
|
@@ -251,7 +262,8 @@ function validateBirth(birth) {
|
|
|
251
262
|
const settings = validateBirthSettings(birth);
|
|
252
263
|
const supplied = birth.flags;
|
|
253
264
|
const flags = supplied === void 0 ? void 0 : snapshotFlags(supplied);
|
|
254
|
-
const
|
|
265
|
+
const suppliedUtc = birth.utc;
|
|
266
|
+
const utc = dateFrom(suppliedUtc, "birth.utc");
|
|
255
267
|
const pin = birth.deltaT;
|
|
256
268
|
if (pin !== void 0 && (typeof pin !== "number" || !Number.isFinite(pin) || Math.abs(pin) > 1e10)) {
|
|
257
269
|
throw new RangeError("deltaT must be a finite number of seconds, at most 1e10 in size.");
|
|
@@ -262,11 +274,13 @@ function validateBirth(birth) {
|
|
|
262
274
|
}
|
|
263
275
|
const possible = ["delta-t-extrapolated", "de440-unavailable", "outside-de440-span"];
|
|
264
276
|
if (settings.timeKnown === false) possible.push("no-time");
|
|
265
|
-
else if (settings.
|
|
266
|
-
possible.push("polar-
|
|
277
|
+
else if (settings.latitude !== void 0) {
|
|
278
|
+
possible.push("polar-angles");
|
|
279
|
+
if (settings.houseSystem !== void 0 && isPolarUndefinedHouseSystem(settings.houseSystem)) possible.push("polar-fallback");
|
|
267
280
|
}
|
|
268
281
|
if (outsideReferenceSpan(utc)) possible.push("outside-reference-span");
|
|
269
282
|
assertDerivedFlags(flags?.values ?? [], possible);
|
|
283
|
+
if (settings.timeKnown !== false) noBareDate(suppliedUtc, "birth.utc");
|
|
270
284
|
const input = {
|
|
271
285
|
utc,
|
|
272
286
|
houseSystem: settings.houseSystem ?? "whole",
|
|
@@ -348,10 +362,13 @@ function saturnReturn(birth) {
|
|
|
348
362
|
} else if (isBirth(birth)) {
|
|
349
363
|
const validated = validateBirth(birth);
|
|
350
364
|
utc = utcOf(
|
|
351
|
-
validated.flags?.values.
|
|
365
|
+
validated.flags?.values.some((flag) => flag === "polar-fallback" || flag === "polar-angles") ? computedBirth(validated).input : validated.input
|
|
352
366
|
);
|
|
353
|
-
} else
|
|
367
|
+
} else {
|
|
368
|
+
utc = dateFrom(birth, "birth");
|
|
369
|
+
}
|
|
354
370
|
const { value, fallbacks } = notingFallbacks(() => computeSaturnReturns(utc));
|
|
371
|
+
noBareDate(birth, "birth");
|
|
355
372
|
const ephemeris = fallbacks.length > 0 ? EPHEMERIS.name : ephemerisAt(utc.getTime()).ephemeris.name;
|
|
356
373
|
return { ...value, ephemeris, flags: fallbacks };
|
|
357
374
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-KFTJMMG7.js";
|
|
7
7
|
import {
|
|
8
8
|
validateBirthSettings
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WONTOC5W.js";
|
|
10
10
|
|
|
11
11
|
// src/geo/calendar.ts
|
|
12
12
|
var GREGORIAN_ADOPTION_SOURCES = /* @__PURE__ */ Object.freeze({
|
|
@@ -48,14 +48,21 @@ var GREGORIAN_ADOPTION = /* @__PURE__ */ Object.freeze(
|
|
|
48
48
|
});
|
|
49
49
|
})
|
|
50
50
|
);
|
|
51
|
+
var ZONE_CITIES = "vienna - - prague berlin copenhagen madrid - paris london budapest rome - oslo - lisbon moscow -".split(" ");
|
|
52
|
+
function zoneAdoption(timeZone) {
|
|
53
|
+
return /^europe\/[a-z]/i.test(timeZone) ? GREGORIAN_ADOPTION[ZONE_CITIES.indexOf(timeZone.slice(7).toLowerCase())] : void 0;
|
|
54
|
+
}
|
|
51
55
|
function gregorianAdoption(country) {
|
|
52
56
|
return GREGORIAN_ADOPTION.find((row) => row.code === country || row.country === country);
|
|
53
57
|
}
|
|
54
58
|
function calendarNote(gregorianDate, calendar, country) {
|
|
55
59
|
if (!parseCalendarDate(gregorianDate, "gregorian")) throw new RangeError("gregorianDate must be a valid Gregorian date, YYYY-MM-DD.");
|
|
60
|
+
checkCalendarCountry(calendar, country);
|
|
61
|
+
return noteFor(gregorianDate, calendar, country);
|
|
62
|
+
}
|
|
63
|
+
function checkCalendarCountry(calendar, country) {
|
|
56
64
|
if (calendar !== "gregorian" && calendar !== "julian") throw new RangeError('calendar must be "gregorian" or "julian".');
|
|
57
65
|
if (typeof country !== "string" || !country.trim()) throw new RangeError("country must be a nonempty string.");
|
|
58
|
-
return noteFor(gregorianDate, calendar, country);
|
|
59
66
|
}
|
|
60
67
|
function noteFor(gregorianDate, calendar, country) {
|
|
61
68
|
const adoption = gregorianAdoption(country);
|
|
@@ -301,10 +308,7 @@ function readOptions(options = {}) {
|
|
|
301
308
|
if (longitude !== void 0 && !(typeof longitude === "number" && Math.abs(longitude) <= 180)) {
|
|
302
309
|
throw new RangeError("longitude must be between -180 and 180 degrees.");
|
|
303
310
|
}
|
|
304
|
-
|
|
305
|
-
if (country !== void 0 && (typeof country !== "string" || !country.trim())) {
|
|
306
|
-
throw new RangeError("country must be a nonempty string.");
|
|
307
|
-
}
|
|
311
|
+
checkCalendarCountry(calendar, country === void 0 ? "-" : country);
|
|
308
312
|
if (fold !== "earlier" && fold !== "later") throw new RangeError('fold must be "earlier" or "later".');
|
|
309
313
|
return { longitude, calendar, country, fold };
|
|
310
314
|
}
|
|
@@ -360,6 +364,12 @@ function resolveLocalToUtc(date, time, timeZone, options) {
|
|
|
360
364
|
const lmt = inEra || !place && history?.zoneEraEnd != null && chosen.utcMs < history.zoneEraEnd;
|
|
361
365
|
const flags = kind ? [`dst-${kind}`] : [];
|
|
362
366
|
if (lmt) flags.push("lmt");
|
|
367
|
+
if (!(country && gregorianAdoption(country))) {
|
|
368
|
+
const own = zoneAdoption(timeZone);
|
|
369
|
+
const near = /^(europe|asia|etc)\/|^[^/]+$/i.test(timeZone);
|
|
370
|
+
if ((own ? [own] : GREGORIAN_ADOPTION).some((r) => date > r.lastJulian && date < r.firstGregorian && (near || r.firstGregorian < "1800")))
|
|
371
|
+
flags.push("calendar-unknown");
|
|
372
|
+
}
|
|
363
373
|
const localMeanTime = longitude !== void 0 && place && (inEra || kind === "gap" && reading.at === place.endMs) ? { longitude, zoneOffsetMinutes: zoneReading.chosen.offset / 60 } : null;
|
|
364
374
|
const zone = shipped ? {
|
|
365
375
|
source: "tzdb",
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
ENGINE_VERSION,
|
|
3
3
|
EPHEMERIS,
|
|
4
4
|
findAspects
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-T6F4FYYS.js";
|
|
6
6
|
import {
|
|
7
7
|
eclipticFrame,
|
|
8
8
|
eclipticOfDate,
|
|
9
9
|
meanEcliptic
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EEW7746S.js";
|
|
11
11
|
import {
|
|
12
12
|
EPHEMERIS_SPAN,
|
|
13
13
|
elapsedDays,
|
|
@@ -16,16 +16,17 @@ import {
|
|
|
16
16
|
} from "./chunk-B5LKF437.js";
|
|
17
17
|
import {
|
|
18
18
|
shippedDe440Source
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-UXY4RU57.js";
|
|
20
20
|
import {
|
|
21
21
|
tilt
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-CV53HA7R.js";
|
|
23
23
|
import {
|
|
24
24
|
computeAngles,
|
|
25
25
|
computeHouses,
|
|
26
26
|
eastPointOf,
|
|
27
|
+
insidePolarCircle,
|
|
27
28
|
vertexOf
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-SCRO6HWB.js";
|
|
29
30
|
import {
|
|
30
31
|
degreeInSign,
|
|
31
32
|
normalizeLongitude,
|
|
@@ -602,7 +603,21 @@ function position(body, lon, lat, speed, chosen) {
|
|
|
602
603
|
};
|
|
603
604
|
}
|
|
604
605
|
function computeBodies(date) {
|
|
605
|
-
return evaluated(() =>
|
|
606
|
+
return evaluated(() => {
|
|
607
|
+
const ms = date.getTime();
|
|
608
|
+
const basis = basisAt(ms, UTC_CLOCK);
|
|
609
|
+
const chosen = chosenAt(basis.ttDays);
|
|
610
|
+
const bodies = bodiesAt(ms, UTC_CLOCK, chosen);
|
|
611
|
+
const flags = instantFlags(date, basis, chosen, null);
|
|
612
|
+
return flags.length === 0 ? bodies : bodies.map((row) => ({ ...row, flags: [...flags] }));
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
function instantFlags(utc, basis, chosen, angles) {
|
|
616
|
+
const flags = [];
|
|
617
|
+
if (outsideReferenceSpan(utc)) flags.push("outside-reference-span");
|
|
618
|
+
if (deltaTExtrapolated(basis, angles)) flags.push("delta-t-extrapolated");
|
|
619
|
+
if (chosen.fallback !== null) flags.push(chosen.fallback);
|
|
620
|
+
return flags;
|
|
606
621
|
}
|
|
607
622
|
function bodiesAt(ms, clock, chosen = chosenAt(basisAt(ms, clock).ttDays)) {
|
|
608
623
|
if (chosen.fallback !== null) noted?.add(chosen.fallback);
|
|
@@ -646,7 +661,7 @@ function chartAt(input) {
|
|
|
646
661
|
const clock = clockOf(input);
|
|
647
662
|
const basis = timeBasis(ms, clock.scale, clock.pin);
|
|
648
663
|
const chosen = chosenAt(basis.ttDays);
|
|
649
|
-
const { from
|
|
664
|
+
const { from } = chosen;
|
|
650
665
|
const bodies = bodiesAt(ms, clock, chosen);
|
|
651
666
|
let angles = null;
|
|
652
667
|
let houses = null;
|
|
@@ -662,12 +677,11 @@ function chartAt(input) {
|
|
|
662
677
|
const result = computeHouses(input.houseSystem, angleInput, angles);
|
|
663
678
|
houses = result.houses;
|
|
664
679
|
if (result.fellBack) flags.push("polar-fallback");
|
|
680
|
+
if (insidePolarCircle(angleInput)) flags.push("polar-angles");
|
|
665
681
|
} else if (!input.timeKnown) {
|
|
666
682
|
flags.push("no-time");
|
|
667
683
|
}
|
|
668
|
-
|
|
669
|
-
deltaTExtrapolated(basis, angles) && flags.push("delta-t-extrapolated");
|
|
670
|
-
if (fallback !== null) flags.push(fallback);
|
|
684
|
+
flags.push(...instantFlags(input.utc, basis, chosen, angles));
|
|
671
685
|
return {
|
|
672
686
|
input,
|
|
673
687
|
bodies,
|
|
@@ -23,6 +23,7 @@ var HOUSE_SYSTEMS = /* @__PURE__ */ Object.freeze([
|
|
|
23
23
|
var POLAR_UNDEFINED_HOUSE_SYSTEMS = /* @__PURE__ */ Object.freeze(["placidus", "koch"]);
|
|
24
24
|
var POLAR_FALLBACK = "whole";
|
|
25
25
|
var PLACIDUS_POLAR_FALLBACK = POLAR_FALLBACK;
|
|
26
|
+
var insidePolarCircle = (input) => Math.abs(input.latitude) >= 90 - input.obliquity;
|
|
26
27
|
function isPolarUndefinedHouseSystem(system) {
|
|
27
28
|
return POLAR_UNDEFINED_HOUSE_SYSTEMS.includes(system);
|
|
28
29
|
}
|
|
@@ -87,7 +88,7 @@ function wholeSignCusps(ascendant) {
|
|
|
87
88
|
return Array.from({ length: 12 }, (_, index) => normalizeLongitude(first + index * 30));
|
|
88
89
|
}
|
|
89
90
|
function placidusCusps(input, angles) {
|
|
90
|
-
if (
|
|
91
|
+
if (insidePolarCircle(input)) return null;
|
|
91
92
|
const ramc = ramcOf(input);
|
|
92
93
|
const phi = input.latitude * DEG;
|
|
93
94
|
function iterate(offset, multiplier) {
|
|
@@ -178,7 +179,7 @@ function vehlowCusps(angles) {
|
|
|
178
179
|
return Array.from({ length: 12 }, (_, index) => normalizeLongitude(angles.asc - 15 + index * 30));
|
|
179
180
|
}
|
|
180
181
|
function kochCusps(input, angles) {
|
|
181
|
-
if (
|
|
182
|
+
if (insidePolarCircle(input)) return null;
|
|
182
183
|
const ramc = ramcOf(input);
|
|
183
184
|
const argument = Math.tan(input.latitude * DEG) * Math.tan(declinationOfLongitude(angles.mc, input.obliquity) * DEG);
|
|
184
185
|
const third = (90 + Math.asin(argument) * RAD) / 3;
|
|
@@ -331,6 +332,7 @@ export {
|
|
|
331
332
|
POLAR_UNDEFINED_HOUSE_SYSTEMS,
|
|
332
333
|
POLAR_FALLBACK,
|
|
333
334
|
PLACIDUS_POLAR_FALLBACK,
|
|
335
|
+
insidePolarCircle,
|
|
334
336
|
isPolarUndefinedHouseSystem,
|
|
335
337
|
meanObliquity,
|
|
336
338
|
ramcOf,
|