@zodiacs/engine 1.0.0 → 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 +1020 -0
- package/LICENSING.md +168 -27
- package/NOTICE +78 -12
- package/README.md +288 -44
- package/dist/{api-WbxJ4Wj-.d.ts → api-ChL1N2Sr.d.ts} +33 -2
- package/dist/{ayanamsa--YQ46fET.d.ts → ayanamsa-ClFzkKmV.d.ts} +2 -1
- package/dist/calc.d.ts +90 -4
- package/dist/calc.js +360 -126
- package/dist/chunk-2PZYJQV5.js +83 -0
- package/dist/{chunk-7TRLIFFI.js → chunk-4XOYTBLS.js} +1 -1
- package/dist/chunk-767FTO7O.js +48 -0
- package/dist/{chunk-YIITY7Q7.js → chunk-7Y2F2IWN.js} +19 -17
- package/dist/{chunk-OG4OYTJJ.js → chunk-B4M2Y7FT.js} +1 -129
- package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
- package/dist/chunk-I3L4POY7.js +18 -0
- package/dist/{chunk-CHSYDKBL.js → chunk-LNGURVNH.js} +3 -3
- package/dist/{chunk-DMGHYCDI.js → chunk-NNOSOOWS.js} +1 -1
- package/dist/chunk-OVXQQEXL.js +41 -0
- package/dist/{chunk-SRXBTP5H.js → chunk-QLIEEICB.js} +201 -190
- package/dist/chunk-RMBWKZI2.js +130 -0
- package/dist/{chunk-FTX3JDJA.js → chunk-TZVPZHZM.js} +42 -23
- package/dist/{chunk-WS3TDSP3.js → chunk-WBTWY2OB.js} +7 -3
- 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 +15 -4
- 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/ephemeris-exTSqBgb.d.ts +60 -0
- package/dist/geo.d.ts +16 -4
- package/dist/geo.js +2 -2
- package/dist/{houses-CFERsAlK.d.ts → houses-Bh7GCnPi.d.ts} +3 -3
- package/dist/houses-extra.d.ts +5 -4
- package/dist/index.d.ts +8 -6
- package/dist/index.js +40 -28
- package/dist/{internal-math-DJJ8BYex.d.ts → internal-math-CxenuGfm.d.ts} +2 -2
- 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 +25 -4
- 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 -2
- package/dist/receipt.js +143 -65
- package/dist/{rulers-Dla6h_Sm.d.ts → rulers-CSSWtiWF.d.ts} +1 -1
- package/dist/sky.d.ts +4 -3
- package/dist/sky.js +17 -10
- package/dist/techniques.d.ts +102 -6
- package/dist/techniques.js +131 -56
- 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 +6 -5
- package/dist/timing.js +24 -17
- package/dist/types-DpPdtXgO.d.ts +335 -0
- package/dist/vedic.d.ts +112 -4
- package/dist/vedic.js +369 -14
- package/dist/window.d.ts +22 -2
- package/dist/window.js +86 -28
- package/dist/{zone-history-ghdyO0Sc.d.ts → zone-history-BxmDCcTK.d.ts} +32 -10
- package/package.json +24 -3
- package/dist/types-B-yb_tGL.d.ts +0 -240
package/dist/vedic.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolvedChart
|
|
3
|
+
} from "./chunk-TZVPZHZM.js";
|
|
1
4
|
import {
|
|
2
5
|
AYANAMSAS,
|
|
3
6
|
NAKSHATRA_TICKS,
|
|
@@ -6,32 +9,50 @@ import {
|
|
|
6
9
|
TICKS_PER_DEGREE,
|
|
7
10
|
YEAR_TICKS,
|
|
8
11
|
ayanamsa,
|
|
12
|
+
ayanamsaAt,
|
|
9
13
|
declareSiderealLongitude,
|
|
10
14
|
definitionOf,
|
|
11
15
|
requireSidereal,
|
|
12
16
|
siderealChartOf,
|
|
13
17
|
siderealLongitude,
|
|
14
18
|
ticksOf,
|
|
15
|
-
userAyanamsa
|
|
16
|
-
|
|
19
|
+
userAyanamsa,
|
|
20
|
+
wrap360
|
|
21
|
+
} from "./chunk-WBTWY2OB.js";
|
|
17
22
|
import {
|
|
18
23
|
readOptions
|
|
19
24
|
} from "./chunk-47ERTK5X.js";
|
|
20
25
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
gastHours,
|
|
27
|
+
meanNodeLongitude,
|
|
28
|
+
onChartClock,
|
|
29
|
+
refuseUnderSource
|
|
30
|
+
} from "./chunk-QLIEEICB.js";
|
|
23
31
|
import {
|
|
24
32
|
dateFrom
|
|
25
33
|
} from "./chunk-CPALRSPC.js";
|
|
34
|
+
import "./chunk-B4M2Y7FT.js";
|
|
35
|
+
import {
|
|
36
|
+
eclipticOfDate
|
|
37
|
+
} from "./chunk-2PZYJQV5.js";
|
|
38
|
+
import {
|
|
39
|
+
timeBasis
|
|
40
|
+
} from "./chunk-B5LKF437.js";
|
|
26
41
|
import "./chunk-TSS2SZWQ.js";
|
|
27
|
-
import "./chunk-
|
|
28
|
-
import "./chunk-
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
import "./chunk-767FTO7O.js";
|
|
43
|
+
import "./chunk-YPU3MDNI.js";
|
|
44
|
+
import {
|
|
45
|
+
tilt
|
|
46
|
+
} from "./chunk-Y4E3WJU5.js";
|
|
32
47
|
import {
|
|
33
|
-
|
|
34
|
-
} from "./chunk-
|
|
48
|
+
computeAngles
|
|
49
|
+
} from "./chunk-NNOSOOWS.js";
|
|
50
|
+
import {
|
|
51
|
+
SIGN_SLUGS,
|
|
52
|
+
normalizeLongitude
|
|
53
|
+
} from "./chunk-RMBWKZI2.js";
|
|
54
|
+
import "./chunk-BHJXUY67.js";
|
|
55
|
+
import "./chunk-BMDASNPB.js";
|
|
35
56
|
|
|
36
57
|
// src/vedic/chart.ts
|
|
37
58
|
function siderealChart(natal, ayanamsa2) {
|
|
@@ -198,14 +219,21 @@ var TRIMSAMSA = [
|
|
|
198
219
|
{ ends: [5, 12, 20, 25, 30], signs: [1, 5, 11, 9, 7] }
|
|
199
220
|
].map(({ ends, signs }) => ({ ends: ends.map((d) => d * 7560), signs }));
|
|
200
221
|
function vargaOf(position, varga, scheme = "parashari") {
|
|
222
|
+
const found = ruleOf(varga, scheme);
|
|
223
|
+
return positionOf(found, scheme, ticksOf(requireSidereal(position).lon));
|
|
224
|
+
}
|
|
225
|
+
function ruleOf(varga, scheme) {
|
|
201
226
|
const found = RULES.find((candidate) => candidate.name === varga);
|
|
202
227
|
if (!found) throw new RangeError(`Unknown varga: ${String(varga)}.`);
|
|
203
228
|
if (!found.schemes.includes(scheme)) {
|
|
204
229
|
throw new RangeError(found.notImplemented.includes(scheme) || scheme === "cyclic" ? `The ${String(scheme)} ${varga} is not implemented.` : `Unknown varga scheme: ${String(scheme)}.`);
|
|
205
230
|
}
|
|
206
|
-
|
|
231
|
+
return found;
|
|
232
|
+
}
|
|
233
|
+
function placed(found, scheme, ticks) {
|
|
207
234
|
const s = Math.floor(ticks / SIGN_TICKS);
|
|
208
235
|
const within = ticks - s * SIGN_TICKS;
|
|
236
|
+
const varga = found.name;
|
|
209
237
|
let part;
|
|
210
238
|
let sign;
|
|
211
239
|
if (varga === "D30") {
|
|
@@ -218,8 +246,333 @@ function vargaOf(position, varga, scheme = "parashari") {
|
|
|
218
246
|
else if (varga === "D2") sign = (odd(s) ? part === 0 : part === 1) ? 4 : 3;
|
|
219
247
|
else sign = found.start(s) + (varga === "D3" ? 4 * part : varga === "D4" ? 3 * part : part);
|
|
220
248
|
}
|
|
221
|
-
|
|
222
|
-
|
|
249
|
+
return [part, (sign % 12 + 12) % 12];
|
|
250
|
+
}
|
|
251
|
+
function positionOf(found, scheme, ticks) {
|
|
252
|
+
const [part, signIndex] = placed(found, scheme, ticks);
|
|
253
|
+
return Object.freeze({ varga: found.name, scheme, part: part + 1, sign: SIGN_SLUGS[signIndex], signIndex });
|
|
254
|
+
}
|
|
255
|
+
function vargaAtTick(ticks, varga, scheme = "parashari") {
|
|
256
|
+
return positionOf(ruleOf(varga, scheme), scheme, ticks);
|
|
257
|
+
}
|
|
258
|
+
var CIRCLE = 12 * SIGN_TICKS;
|
|
259
|
+
var CHANGES = /* @__PURE__ */ new Map();
|
|
260
|
+
function changeBoundaries(varga, scheme = "parashari") {
|
|
261
|
+
const key = `${varga} ${scheme}`;
|
|
262
|
+
let list = CHANGES.get(key);
|
|
263
|
+
if (!list) {
|
|
264
|
+
const found = ruleOf(varga, scheme);
|
|
265
|
+
const signAt = (ticks) => placed(found, scheme, (ticks + CIRCLE) % CIRCLE)[1];
|
|
266
|
+
const changes = [];
|
|
267
|
+
for (let s = 0; s < 12; s += 1) {
|
|
268
|
+
const starts = varga === "D30" ? [0, ...TRIMSAMSA[odd(s) ? 0 : 1].ends.slice(0, 4)] : Array.from({ length: found.divisions }, (_, k) => k * SIGN_TICKS / found.divisions);
|
|
269
|
+
for (const start of starts) {
|
|
270
|
+
const t = s * SIGN_TICKS + start;
|
|
271
|
+
if (signAt(t - 1) !== signAt(t)) changes.push(t);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
list = Object.freeze(changes);
|
|
275
|
+
CHANGES.set(key, list);
|
|
276
|
+
}
|
|
277
|
+
return list;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// src/vedic/varga-time.ts
|
|
281
|
+
import { GeoMoon, GeoVector } from "astronomy-engine";
|
|
282
|
+
var VARGA_POINTS = /* @__PURE__ */ Object.freeze([
|
|
283
|
+
"Ascendant",
|
|
284
|
+
"Sun",
|
|
285
|
+
"Moon",
|
|
286
|
+
"Mercury",
|
|
287
|
+
"Venus",
|
|
288
|
+
"Mars",
|
|
289
|
+
"Jupiter",
|
|
290
|
+
"Saturn",
|
|
291
|
+
"Uranus",
|
|
292
|
+
"Neptune",
|
|
293
|
+
"Pluto",
|
|
294
|
+
"Mean Node",
|
|
295
|
+
"Mean South Node"
|
|
296
|
+
]);
|
|
297
|
+
var DAY = 864e5;
|
|
298
|
+
var DEG = Math.PI / 180;
|
|
299
|
+
var CIRCLE2 = 2721600;
|
|
300
|
+
var J2000 = Date.UTC(2e3, 0, 1, 12);
|
|
301
|
+
var SPAN_FROM = Date.UTC(1800, 0, 1);
|
|
302
|
+
var SPAN_TO = Date.UTC(2200, 0, 1);
|
|
303
|
+
var KNOTS = (1941 - 2e3) * 365.25;
|
|
304
|
+
var VARGA_BUDGET = 2e6;
|
|
305
|
+
var SLACK = 1e-9;
|
|
306
|
+
var NODE_RATE = 69628905431e-4 / 3600 / 36525;
|
|
307
|
+
var BODY_RATE_BOUNDS = /* @__PURE__ */ Object.freeze({
|
|
308
|
+
Sun: 2.1,
|
|
309
|
+
Moon: 31,
|
|
310
|
+
Mercury: 4.5,
|
|
311
|
+
Venus: 2.6,
|
|
312
|
+
Mars: 1.6,
|
|
313
|
+
Jupiter: 0.49,
|
|
314
|
+
Saturn: 0.27,
|
|
315
|
+
Uranus: 0.13,
|
|
316
|
+
Neptune: 0.077,
|
|
317
|
+
Pluto: 0.082
|
|
318
|
+
});
|
|
319
|
+
var DETAILS = /* @__PURE__ */ Object.freeze({
|
|
320
|
+
"no-angles": "The chart has no angles: its time is not known, or it has no place.",
|
|
321
|
+
polar: "The latitude is more than 66\xB0 from the equator. The search stops there, short of the latitude where the Ascendant's derived lower rate bound reaches zero.",
|
|
322
|
+
"out-of-range": "The birth instant's UT1 or TT lies outside REFERENCE_SPAN, 1800 to 2200.",
|
|
323
|
+
"rate-bound": "The point moved as its rate bound says it cannot, so no change can be said to be the first.",
|
|
324
|
+
"evaluation-budget": "The call spent its 2,000,000 evaluations before this point's search was done."
|
|
325
|
+
});
|
|
326
|
+
var VERIFICATION = "exact to the millisecond in the engine's own positions on the chart's clock; none missed by derived bounds for the Ascendant and the mean nodes, by scanned bounds for the bodies";
|
|
327
|
+
function siderealAt(point, ms, sky) {
|
|
328
|
+
refuseUnderSource("vargaSensitivity");
|
|
329
|
+
return onChartClock(ms, sky.scale, sky.pin, (time) => {
|
|
330
|
+
let lon;
|
|
331
|
+
if (point === "Ascendant") {
|
|
332
|
+
lon = computeAngles({
|
|
333
|
+
gastHours: gastHours(time),
|
|
334
|
+
latitude: sky.latitude,
|
|
335
|
+
longitude: sky.longitude,
|
|
336
|
+
obliquity: tilt(time.tt).tobl
|
|
337
|
+
}).asc;
|
|
338
|
+
} else if (point.startsWith("Mean")) {
|
|
339
|
+
const node = meanNodeLongitude(time.tt / 36525, tilt(time.tt).dpsi / 3600);
|
|
340
|
+
lon = normalizeLongitude(point === "Mean Node" ? node : node + 180);
|
|
341
|
+
} else {
|
|
342
|
+
const vector = point === "Moon" ? GeoMoon(time) : GeoVector(point, time, true);
|
|
343
|
+
lon = eclipticOfDate(vector.x, vector.y, vector.z, time.tt).lon;
|
|
344
|
+
}
|
|
345
|
+
return wrap360(wrap360(lon) - ayanamsaAt(sky.definition, time).true);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
var Spent = class {
|
|
349
|
+
};
|
|
350
|
+
function kept(lon, budget) {
|
|
351
|
+
const values = /* @__PURE__ */ new Map();
|
|
352
|
+
return (ms) => {
|
|
353
|
+
let value = values.get(ms);
|
|
354
|
+
if (value === void 0) {
|
|
355
|
+
if (budget.left < 1) throw new Spent();
|
|
356
|
+
budget.left -= 1;
|
|
357
|
+
value = lon(ms);
|
|
358
|
+
values.set(ms, value);
|
|
359
|
+
}
|
|
360
|
+
return value;
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
function firstWhere(holds, from, to) {
|
|
364
|
+
let low = from;
|
|
365
|
+
let high = to;
|
|
366
|
+
while (high - low > 1) {
|
|
367
|
+
const middle = low + Math.floor((high - low) / 2);
|
|
368
|
+
if (holds(middle)) high = middle;
|
|
369
|
+
else low = middle;
|
|
370
|
+
}
|
|
371
|
+
return high;
|
|
372
|
+
}
|
|
373
|
+
var turn = (value) => (value % 360 + 360) % 360;
|
|
374
|
+
var signed = (value) => value > 180 ? value - 360 : value <= -180 ? value + 360 : value;
|
|
375
|
+
function runOf(boundaries, at) {
|
|
376
|
+
const next = boundaries.findIndex((t) => t > at);
|
|
377
|
+
const k = next < 0 ? boundaries.length : next;
|
|
378
|
+
return [boundaries[(k - 1 + boundaries.length) % boundaries.length], boundaries[k % boundaries.length]];
|
|
379
|
+
}
|
|
380
|
+
function seamWalks(lo, hi, scale, pin) {
|
|
381
|
+
const basis = (ms) => timeBasis(ms, scale, pin);
|
|
382
|
+
const label = (ms) => {
|
|
383
|
+
const { timeScale, deltaT, utcMs, ut1Days } = basis(ms);
|
|
384
|
+
return [
|
|
385
|
+
timeScale.basis,
|
|
386
|
+
deltaT.model,
|
|
387
|
+
deltaT.segment,
|
|
388
|
+
ut1Days < KNOTS,
|
|
389
|
+
timeScale.ut1MinusUtc?.source,
|
|
390
|
+
timeBasis(utcMs, "utc").timeScale.leapSeconds?.taiMinusUtc
|
|
391
|
+
].join();
|
|
392
|
+
};
|
|
393
|
+
const walks = [];
|
|
394
|
+
for (let p = lo; p < hi; p += 36e5) {
|
|
395
|
+
const q = Math.min(p + 36e5, hi);
|
|
396
|
+
for (let from = p, kind = label(p); kind !== label(q); ) {
|
|
397
|
+
const z = firstWhere((ms) => label(ms) !== kind, from, q);
|
|
398
|
+
const [before, at] = [basis(z - 1), basis(z)];
|
|
399
|
+
const step = Math.max(Math.abs((at.ut1Days - before.ut1Days) * DAY - 1), Math.abs((at.ttDays - before.ttDays) * DAY - 1));
|
|
400
|
+
const width = Math.ceil(step) + 1e3;
|
|
401
|
+
walks.push([Math.max(lo, z - width), Math.min(hi, z + width)]);
|
|
402
|
+
from = z;
|
|
403
|
+
kind = label(z);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return walks;
|
|
407
|
+
}
|
|
408
|
+
function searchRuns(x, mode, [low, high], runs, t0, lo, hi, walks) {
|
|
409
|
+
const inside = (ms, [a, b]) => (ticksOf(x(ms)) - a + CIRCLE2) % CIRCLE2 < (b - a + CIRCLE2) % CIRCLE2;
|
|
410
|
+
const side = (dir) => {
|
|
411
|
+
const found = runs.map(() => null);
|
|
412
|
+
let open = runs.map((_, k) => k);
|
|
413
|
+
const limit = dir > 0 ? hi : lo;
|
|
414
|
+
for (let t = t0; open.length > 0 && t !== limit; ) {
|
|
415
|
+
const walking = walks.some(([u, v]) => u <= t + dir && t + dir <= v);
|
|
416
|
+
let n = 1;
|
|
417
|
+
let e = t + dir;
|
|
418
|
+
if (!walking) {
|
|
419
|
+
if (mode) n = Math.max(1, Math.floor(330 / high));
|
|
420
|
+
else {
|
|
421
|
+
const here = x(t);
|
|
422
|
+
const d = Math.min(...open.flatMap((k) => runs[k].map((end) => Math.abs(signed(end / 7560 - here)))));
|
|
423
|
+
n = Math.max(1, Math.floor(d / high));
|
|
424
|
+
}
|
|
425
|
+
e = t + dir * n;
|
|
426
|
+
if (dir * (e - limit) > 0) e = limit;
|
|
427
|
+
for (const [u, v] of walks) {
|
|
428
|
+
const edge = dir > 0 ? u : v;
|
|
429
|
+
if (dir * (edge - t) > 0 && dir * (e - edge) >= 0) e = edge - dir;
|
|
430
|
+
}
|
|
431
|
+
if (mode) {
|
|
432
|
+
const length = Math.abs(e - t);
|
|
433
|
+
const advance = turn(mode * dir * (x(e) - x(t)) + 30) - 30;
|
|
434
|
+
if (advance < low * length - SLACK || advance > high * length + SLACK) return "rate-bound";
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
const leaving = open.filter((k) => !inside(e, runs[k]));
|
|
438
|
+
for (const k of leaving) {
|
|
439
|
+
const at = dir > 0 ? firstWhere((ms) => !inside(ms, runs[k]), t, e) : firstWhere((ms) => inside(ms, runs[k]), e, t);
|
|
440
|
+
if (!walking && !mode && (Math.abs(e - t) !== n || at !== (dir > 0 ? e : e + 1))) return "rate-bound";
|
|
441
|
+
const rising = signed(x(at) - x(at - 1)) > 0;
|
|
442
|
+
found[k] = [at, rising === dir > 0 ? runs[k][1] : runs[k][0]];
|
|
443
|
+
}
|
|
444
|
+
open = open.filter((k) => !leaving.includes(k));
|
|
445
|
+
t = e;
|
|
446
|
+
}
|
|
447
|
+
return found;
|
|
448
|
+
};
|
|
449
|
+
try {
|
|
450
|
+
const next = side(1);
|
|
451
|
+
if (typeof next === "string") return next;
|
|
452
|
+
const previous = side(-1);
|
|
453
|
+
return typeof previous === "string" ? previous : [previous, next];
|
|
454
|
+
} catch (thrown) {
|
|
455
|
+
if (thrown instanceof Spent) return "evaluation-budget";
|
|
456
|
+
throw thrown;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
function subset(value, all, label) {
|
|
460
|
+
if (value === void 0) return void 0;
|
|
461
|
+
if (!Array.isArray(value) || value.some((item, k) => !all.includes(item) || value.indexOf(item) !== k)) {
|
|
462
|
+
throw new RangeError(`options.${label} must be an array of distinct names from: ${all.join(", ")}.`);
|
|
463
|
+
}
|
|
464
|
+
return all.filter((item) => value.includes(item));
|
|
465
|
+
}
|
|
466
|
+
function vargaSensitivity(natal, ayanamsa2, options) {
|
|
467
|
+
const read = readOptions(options, ["points", "vargas", "cyclic", "horizonMinutes"], "vargaSensitivity options");
|
|
468
|
+
const points = subset(read.points, VARGA_POINTS, "points") ?? VARGA_POINTS.filter((_, k) => k < 8 || k > 10);
|
|
469
|
+
const names = VARGAS.map((varga) => varga.name);
|
|
470
|
+
const vargas = subset(read.vargas, names, "vargas") ?? names;
|
|
471
|
+
const cyclic = read.cyclic ?? false;
|
|
472
|
+
if (typeof cyclic !== "boolean") throw new RangeError("options.cyclic must be true or false.");
|
|
473
|
+
const minutes = read.horizonMinutes ?? 1440;
|
|
474
|
+
if (typeof minutes !== "number" || !Number.isInteger(minutes) || minutes < 1 || minutes > 2880) {
|
|
475
|
+
throw new RangeError("options.horizonMinutes must be a whole number of minutes from 1 to 2,880.");
|
|
476
|
+
}
|
|
477
|
+
const keys = vargas.flatMap((varga) => cyclic && (varga === "D2" || varga === "D3") ? [[varga, "parashari"], [varga, "cyclic"]] : [[varga, "parashari"]]);
|
|
478
|
+
const definition = definitionOf(ayanamsa2);
|
|
479
|
+
const chart = resolvedChart(natal).chart;
|
|
480
|
+
const sidereal = siderealChartOf(chart, definition);
|
|
481
|
+
const { utc, timeScale, deltaT: pin, latitude, longitude } = chart.input;
|
|
482
|
+
const sky = { scale: timeScale ?? "utc", pin, latitude, longitude, definition };
|
|
483
|
+
const t0 = utc.getTime();
|
|
484
|
+
const inSpan = (ms) => {
|
|
485
|
+
const { ut1Days, ttDays } = timeBasis(ms, sky.scale, pin);
|
|
486
|
+
return [ut1Days, ttDays].every((days) => J2000 + days * DAY >= SPAN_FROM && J2000 + days * DAY < SPAN_TO);
|
|
487
|
+
};
|
|
488
|
+
const reach = minutes * 6e4;
|
|
489
|
+
const known = inSpan(t0);
|
|
490
|
+
let lo = t0;
|
|
491
|
+
let hi = t0;
|
|
492
|
+
if (known) {
|
|
493
|
+
lo = inSpan(t0 - reach) ? t0 - reach : firstWhere(inSpan, t0 - reach, t0);
|
|
494
|
+
hi = inSpan(t0 + reach) ? t0 + reach : firstWhere((ms) => !inSpan(ms), t0, t0 + reach) - 1;
|
|
495
|
+
}
|
|
496
|
+
const walks = known ? seamWalks(lo, hi, sky.scale, pin) : [];
|
|
497
|
+
const a = 3e-4 + (definition.kind === "linear" ? Math.abs(definition.rate) / 3600 / 365.25 : definition.kind === "star" ? 0.021 : 0);
|
|
498
|
+
const budget = { left: VARGA_BUDGET };
|
|
499
|
+
let spent = false;
|
|
500
|
+
const rows = [];
|
|
501
|
+
const evaluations = {};
|
|
502
|
+
for (const point of points) {
|
|
503
|
+
const left = budget.left;
|
|
504
|
+
const derived = point === "Ascendant" || point.startsWith("Mean");
|
|
505
|
+
const x = kept((ms) => siderealAt(point, ms, sky), budget);
|
|
506
|
+
let reason = !known ? "out-of-range" : spent ? "evaluation-budget" : point !== "Ascendant" ? null : chart.angles === null ? "no-angles" : Math.abs(latitude) > 66 ? "polar" : null;
|
|
507
|
+
let birth = null;
|
|
508
|
+
let sides = null;
|
|
509
|
+
if (reason === null) {
|
|
510
|
+
try {
|
|
511
|
+
birth = x(t0);
|
|
512
|
+
} catch (thrown) {
|
|
513
|
+
if (!(thrown instanceof Spent)) throw thrown;
|
|
514
|
+
reason = "evaluation-budget";
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (birth !== null) {
|
|
518
|
+
let rates;
|
|
519
|
+
if (point === "Ascendant") {
|
|
520
|
+
const phi = Math.abs(latitude) * DEG;
|
|
521
|
+
const tilted = Math.cos(phi + 23.5 * DEG);
|
|
522
|
+
rates = [
|
|
523
|
+
0.99 * 360.9856 * Math.sqrt(Math.cos(phi) ** 2 - Math.sin(23.5 * DEG) ** 2) - 5e-5 / tilted - a,
|
|
524
|
+
1.01 * 360.9856 * Math.cos(phi) / tilted + a
|
|
525
|
+
];
|
|
526
|
+
} else if (derived) rates = [NODE_RATE * (1 - 1e-5) - a, NODE_RATE * (1 + 1e-5) + a];
|
|
527
|
+
else rates = [0, BODY_RATE_BOUNDS[point] + a];
|
|
528
|
+
const tick = ticksOf(birth);
|
|
529
|
+
const runs = keys.map(([varga, scheme]) => runOf(changeBoundaries(varga, scheme), tick));
|
|
530
|
+
const result2 = searchRuns(
|
|
531
|
+
x,
|
|
532
|
+
!derived ? 0 : point === "Ascendant" ? 1 : -1,
|
|
533
|
+
[rates[0] / DAY, rates[1] / DAY],
|
|
534
|
+
runs,
|
|
535
|
+
t0,
|
|
536
|
+
lo,
|
|
537
|
+
hi,
|
|
538
|
+
walks
|
|
539
|
+
);
|
|
540
|
+
if (typeof result2 === "string") reason = result2;
|
|
541
|
+
else sides = result2;
|
|
542
|
+
}
|
|
543
|
+
if (reason === "evaluation-budget") spent = true;
|
|
544
|
+
evaluations[point] = left - budget.left;
|
|
545
|
+
keys.forEach(([varga, scheme], k) => {
|
|
546
|
+
const change = (found) => found && Object.freeze({
|
|
547
|
+
at: new Date(found[0]).toISOString(),
|
|
548
|
+
minutes: (found[0] - t0) / 6e4,
|
|
549
|
+
boundary: found[1] / 7560,
|
|
550
|
+
from: vargaAtTick(ticksOf(x(found[0] - 1)), varga, scheme).sign,
|
|
551
|
+
to: vargaAtTick(ticksOf(x(found[0])), varga, scheme).sign
|
|
552
|
+
});
|
|
553
|
+
rows.push(Object.freeze({
|
|
554
|
+
point,
|
|
555
|
+
varga,
|
|
556
|
+
scheme,
|
|
557
|
+
position: birth === null ? null : vargaAtTick(ticksOf(birth), varga, scheme),
|
|
558
|
+
previous: sides && change(sides[0][k] ?? null),
|
|
559
|
+
next: sides && change(sides[1][k] ?? null),
|
|
560
|
+
completeness: derived ? "derived" : "scanned",
|
|
561
|
+
refusal: reason && Object.freeze({ status: "refused", reason, detail: DETAILS[reason] })
|
|
562
|
+
}));
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
return Object.freeze({
|
|
566
|
+
ayanamsa: definition.name,
|
|
567
|
+
utc: utc.toISOString(),
|
|
568
|
+
timeScale: sidereal.ayanamsaValue.timeScale,
|
|
569
|
+
horizonMinutes: minutes,
|
|
570
|
+
searched: Object.freeze({ from: new Date(lo).toISOString(), to: new Date(hi).toISOString() }),
|
|
571
|
+
verification: VERIFICATION,
|
|
572
|
+
rows: Object.freeze(rows),
|
|
573
|
+
evaluations: Object.freeze(evaluations),
|
|
574
|
+
flags: sidereal.flags
|
|
575
|
+
});
|
|
223
576
|
}
|
|
224
577
|
|
|
225
578
|
// src/vedic/kp.ts
|
|
@@ -514,6 +867,7 @@ export {
|
|
|
514
867
|
NAKSHATRAS,
|
|
515
868
|
SIGN_LORDS,
|
|
516
869
|
VARGAS,
|
|
870
|
+
VARGA_POINTS,
|
|
517
871
|
VIMSHOTTARI_LORDS,
|
|
518
872
|
VIMSHOTTARI_YEARS,
|
|
519
873
|
YOGINIS,
|
|
@@ -527,6 +881,7 @@ export {
|
|
|
527
881
|
siderealLongitude,
|
|
528
882
|
userAyanamsa,
|
|
529
883
|
vargaOf,
|
|
884
|
+
vargaSensitivity,
|
|
530
885
|
vimshottariAt,
|
|
531
886
|
vimshottariDasha,
|
|
532
887
|
yoginiDasha
|
package/dist/window.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { H as HouseSystem, B as BodyName, Z as ZodiacSign, b as HouseNumber, f as AspectType,
|
|
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
|
/** The schema id of a birth window. */
|
|
5
6
|
declare const BIRTH_WINDOW_SCHEMA = "zodiacs.birth-window.v1";
|
|
@@ -129,7 +130,14 @@ type BirthWindowFlag = "polar-fallback"
|
|
|
129
130
|
/** An interval's end-to-end change broke a bound; completeness is then not established. */
|
|
130
131
|
| "bound-exceeded"
|
|
131
132
|
/** The result lists unresolved intervals. */
|
|
132
|
-
| "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";
|
|
133
141
|
interface BirthWindow {
|
|
134
142
|
readonly schema: typeof BIRTH_WINDOW_SCHEMA;
|
|
135
143
|
/** How far the switch instants have been checked: dense one-second sampling, not proof. */
|
|
@@ -155,6 +163,18 @@ interface BirthWindow {
|
|
|
155
163
|
readonly unresolved: readonly WindowUnresolved[];
|
|
156
164
|
readonly flags: readonly BirthWindowFlag[];
|
|
157
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
|
+
};
|
|
158
178
|
}
|
|
159
179
|
/** Thrown when a window needs more evaluated instants than the search allows. An Error, not a RangeError. */
|
|
160
180
|
declare class WindowBudgetError extends Error {
|