@zodiacs/engine 0.1.1-rc.15 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +891 -0
  2. package/LICENSING.md +192 -12
  3. package/NOTICE +96 -2
  4. package/README.md +296 -66
  5. package/dist/{api-CoB_kqE3.d.ts → api-WbxJ4Wj-.d.ts} +15 -10
  6. package/dist/ayanamsa--YQ46fET.d.ts +134 -0
  7. package/dist/calc.d.ts +390 -0
  8. package/dist/calc.js +1039 -0
  9. package/dist/chunk-47ERTK5X.js +27 -0
  10. package/dist/chunk-7TRLIFFI.js +56 -0
  11. package/dist/chunk-A3U2ZS2W.js +29 -0
  12. package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
  13. package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
  14. package/dist/{chunk-OYGRVGXD.js → chunk-CHSYDKBL.js} +3 -3
  15. package/dist/{chunk-ZHVI3KWJ.js → chunk-DMGHYCDI.js} +4 -4
  16. package/dist/{chunk-CWI4YUDL.js → chunk-FTX3JDJA.js} +21 -18
  17. package/dist/{chunk-MFF3VKO3.js → chunk-OG4OYTJJ.js} +47 -42
  18. package/dist/{chunk-ZZPITHQS.js → chunk-SRXBTP5H.js} +199 -65
  19. package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
  20. package/dist/chunk-WS3TDSP3.js +474 -0
  21. package/dist/chunk-YIITY7Q7.js +483 -0
  22. package/dist/crossings.d.ts +8 -7
  23. package/dist/crossings.js +1 -1
  24. package/dist/deltat.d.ts +28 -3
  25. package/dist/deltat.js +1 -1
  26. package/dist/geo.d.ts +33 -12
  27. package/dist/geo.js +17 -458
  28. package/dist/{internal-math-BbktkHCc.d.ts → houses-CFERsAlK.d.ts} +14 -160
  29. package/dist/houses-extra.d.ts +95 -0
  30. package/dist/houses-extra.js +339 -0
  31. package/dist/index.d.ts +34 -48
  32. package/dist/index.js +31 -23
  33. package/dist/internal-math-DJJ8BYex.d.ts +174 -0
  34. package/dist/internal-math.d.ts +3 -2
  35. package/dist/internal-math.js +2 -2
  36. package/dist/internal.d.ts +1 -1
  37. package/dist/internal.js +5 -5
  38. package/dist/receipt.d.ts +2 -243
  39. package/dist/receipt.js +78 -37
  40. package/dist/reference-span-CILpclrz.d.ts +40 -0
  41. package/dist/rulers-Dla6h_Sm.d.ts +15 -0
  42. package/dist/sky.d.ts +173 -0
  43. package/dist/sky.js +379 -0
  44. package/dist/techniques.d.ts +453 -0
  45. package/dist/techniques.js +823 -0
  46. package/dist/timing.d.ts +113 -17
  47. package/dist/timing.js +98 -64
  48. package/dist/{types-BsWaqwU_.d.ts → types-B-yb_tGL.d.ts} +23 -11
  49. package/dist/vedic.d.ts +42 -124
  50. package/dist/vedic.js +44 -458
  51. package/dist/window.d.ts +180 -0
  52. package/dist/window.js +960 -0
  53. package/dist/zone-history-ghdyO0Sc.d.ts +268 -0
  54. package/package.json +25 -3
package/dist/vedic.js CHANGED
@@ -1,455 +1,37 @@
1
1
  import {
2
- resolvedChart
3
- } from "./chunk-CWI4YUDL.js";
4
- import "./chunk-AECKV73C.js";
5
- import "./chunk-PFGUCNOK.js";
2
+ AYANAMSAS,
3
+ NAKSHATRA_TICKS,
4
+ PADA_TICKS,
5
+ SIGN_TICKS,
6
+ TICKS_PER_DEGREE,
7
+ YEAR_TICKS,
8
+ ayanamsa,
9
+ declareSiderealLongitude,
10
+ definitionOf,
11
+ requireSidereal,
12
+ siderealChartOf,
13
+ siderealLongitude,
14
+ ticksOf,
15
+ userAyanamsa
16
+ } from "./chunk-WS3TDSP3.js";
17
+ import {
18
+ readOptions
19
+ } from "./chunk-47ERTK5X.js";
6
20
  import {
7
- onChartClock,
8
- onEngineClock
9
- } from "./chunk-ZZPITHQS.js";
10
- import "./chunk-ZHVI3KWJ.js";
21
+ resolvedChart
22
+ } from "./chunk-FTX3JDJA.js";
11
23
  import {
12
24
  dateFrom
13
25
  } from "./chunk-CPALRSPC.js";
26
+ import "./chunk-TSS2SZWQ.js";
27
+ import "./chunk-PFGUCNOK.js";
28
+ import "./chunk-SRXBTP5H.js";
29
+ import "./chunk-B5LKF437.js";
30
+ import "./chunk-BHJXUY67.js";
31
+ import "./chunk-DMGHYCDI.js";
14
32
  import {
15
- REFERENCE_SPAN,
16
- TIME_SCALE_NAMES,
17
- outsideReferenceSpan,
18
- timeBasis
19
- } from "./chunk-KHBLFXFG.js";
20
- import "./chunk-ONBZ4HK7.js";
21
- import {
22
- SIGN_NAMES
23
- } from "./chunk-MFF3VKO3.js";
24
-
25
- // 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";
37
- var DEG = Math.PI / 180;
38
- var ARCSEC = DEG / 3600;
39
- var MAS = ARCSEC / 1e3;
40
- var J2000 = 2451545;
41
- var DAY_MS = 864e5;
42
- var UNIX_JD = 24405875e-1;
43
- var JULIAN_YEAR = 365.25;
44
- var AU_KM = 1495978707e-1;
45
- var C_AU_PER_DAY = 299792.458 * 86400 / AU_KM;
46
- var SUN_SCHWARZSCHILD_AU = 197412574336e-19;
47
- var SPAN_FROM_JD = UNIX_JD + Date.parse(REFERENCE_SPAN.from) / DAY_MS;
48
- var SPAN_TO_JD = UNIX_JD + Date.parse(REFERENCE_SPAN.to) / DAY_MS;
49
- var DEFINITIONS = /* @__PURE__ */ new WeakSet();
50
- function registered(definition) {
51
- const frozen = Object.freeze(definition);
52
- DEFINITIONS.add(frozen);
53
- return frozen;
54
- }
55
- var HIPPARCOS_EPOCH = 24483490625e-4;
56
- var HIP2007 = "Hipparcos 2007 (I/311)";
57
- function star(name, ra, dec, pmRa, pmDec, parallax, radialVelocity, epochTT = HIPPARCOS_EPOCH) {
58
- return Object.freeze({ name, ra, dec, epochTT, pmRa, pmDec, parallax, radialVelocity });
59
- }
60
- var AYANAMSAS = Object.freeze({
61
- lahiri: registered({
62
- kind: "epoch",
63
- name: "lahiri",
64
- label: "Lahiri (Chitrapaksha)",
65
- // True 23°15′00.658″ less the IAU 1980 nutation in longitude at that instant, +16.768927″.
66
- epochTT: 24355535e-1,
67
- value: 23 + 15 / 60 + (0.658 - 16.768927) / 3600,
68
- model: "iau1976",
69
- source: "Indian Astronomical Ephemeris: 23\xB015\u203200.658\u2033 true at 1956-03-21 0h TT (1989, p. 556)"
70
- }),
71
- "fagan-bradley": registered({
72
- kind: "epoch",
73
- name: "fagan-bradley",
74
- label: "Fagan\u2013Bradley",
75
- epochTT: 243328242345905e-8,
76
- value: 24 + 2 / 60 + 31.36 / 3600,
77
- model: "newcomb",
78
- source: "Synetic vernal point 335\xB057\u203228.64\u2033 at B1950.0 (Astro*Index)"
79
- }),
80
- krishnamurti: registered({
81
- kind: "epoch",
82
- name: "krishnamurti",
83
- label: "Krishnamurti (KP)",
84
- epochTT: 24150205e-1,
85
- value: 22.363889,
86
- model: "newcomb",
87
- source: "22\xB021\u203250\u2033 at 1900-01-01, fitted to KP Reader 1's table (Hand, Dawson)"
88
- }),
89
- raman: registered({
90
- kind: "linear",
91
- name: "raman",
92
- label: "Raman",
93
- epochTT: J2000 + (397 - 2e3) * JULIAN_YEAR,
94
- value: 0,
95
- rate: 50 + 1 / 3,
96
- source: "B. V. Raman, A Manual of Hindu Astrology (1935) \xA749"
97
- }),
98
- yukteswar: registered({
99
- kind: "linear",
100
- name: "yukteswar",
101
- label: "Sri Yukteswar",
102
- epochTT: 24129081244e-4,
103
- value: 20 + 54 / 60 + 36 / 3600,
104
- rate: 54,
105
- source: "Sri Yukteswar, The Holy Science (1894), Introduction"
106
- }),
107
- "true-chitra": registered({
108
- kind: "star",
109
- name: "true-chitra",
110
- label: "True Chitra (Spica at 180\xB0)",
111
- longitude: 180,
112
- star: star("Spica (\u03B1 Vir, HIP 65474)", 201.29835228, -11.16124494, -42.35, -30.67, 13.06, -3.31),
113
- source: `Surya Siddhanta VIII; ${HIP2007}`
114
- }),
115
- "true-revati": registered({
116
- kind: "star",
117
- name: "true-revati",
118
- label: "True Revati (\u03B6 Psc at 359\xB050\u2032)",
119
- longitude: 359 + 50 / 60,
120
- star: star("Revati (\u03B6 Psc A, HIP 5737)", 18.43250842, 7.57548938, 145, -55.69, 18.76, 15),
121
- source: `Surya Siddhanta VIII; ${HIP2007}`
122
- }),
123
- "true-pushya": registered({
124
- kind: "star",
125
- name: "true-pushya",
126
- label: "True Pushya (\u03B4 Cnc at 106\xB0)",
127
- longitude: 106,
128
- star: star("Pushya (\u03B4 Cnc, HIP 42911)", 131.17129191, 18.15486373, -17.67, -229.26, 24.98, 17.14),
129
- source: `P. V. R. Narasimha Rao (2013); ${HIP2007}`
130
- }),
131
- "galactic-center": registered({
132
- kind: "star",
133
- name: "galactic-center",
134
- label: "Galactic Center at 0\xB0 Sagittarius",
135
- longitude: 240,
136
- star: star("Sgr A*", 266.416816625, -(29 + 28.1699 / 3600), -3.151, -5.547, 0, 0, J2000),
137
- source: "Sgr A*: SIMBAD ICRS position; Reid & Brunthaler 2004"
138
- })
139
- });
140
- function requireFinite(value, low, high, label) {
141
- if (typeof value !== "number" || !Number.isFinite(value) || value < low || value > high) {
142
- throw new RangeError(`${label} must be a finite number in [${low}, ${high}].`);
143
- }
144
- return value;
145
- }
146
- var EPOCH_JD_LIMIT = 1e8;
147
- function userAyanamsa(input) {
148
- if (!input || typeof input !== "object") throw new RangeError("userAyanamsa needs an input object.");
149
- const name = input.name ?? "user";
150
- if (typeof name !== "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(name) || Object.hasOwn(AYANAMSAS, name)) {
151
- throw new RangeError("Ayanamsa name must be a new lowercase identifier of at most 64 characters.");
152
- }
153
- const epoch = input.epoch;
154
- let epochTT;
155
- if (epoch && typeof epoch === "object" && !(epoch instanceof Date)) {
156
- epochTT = requireFinite(epoch.julianDateTT, UNIX_JD - EPOCH_JD_LIMIT, UNIX_JD + EPOCH_JD_LIMIT, "epoch.julianDateTT");
157
- } else {
158
- const at = dateFrom(epoch, "epoch");
159
- epochTT = J2000 + timeBasis(at.getTime(), "utc").ttDays;
160
- }
161
- const value = requireFinite(input.value, -360, 360, "value");
162
- const common = { name, label: `user: ${name}`, source: "caller-defined", epochTT, value };
163
- if (input.rate !== void 0) {
164
- if (input.model !== void 0) throw new RangeError("Give either a rate or a precession model, not both.");
165
- return registered({ kind: "linear", ...common, rate: requireFinite(input.rate, -3600, 3600, "rate") });
166
- }
167
- const model = input.model ?? "engine";
168
- if (model !== "engine" && model !== "newcomb" && model !== "iau1976") {
169
- throw new RangeError("model must be engine, newcomb or iau1976.");
170
- }
171
- return registered({ kind: "epoch", ...common, model });
172
- }
173
- function definitionOf(definition) {
174
- if (typeof definition === "string") {
175
- if (!Object.hasOwn(AYANAMSAS, definition)) throw new RangeError(`Unknown ayanamsa: ${definition}.`);
176
- return AYANAMSAS[definition];
177
- }
178
- if (!definition || typeof definition !== "object" || !DEFINITIONS.has(definition)) {
179
- throw new RangeError("An ayanamsa must be a built-in name, an AYANAMSAS entry or a userAyanamsa result.");
180
- }
181
- return definition;
182
- }
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));
190
- }
191
- function olderModelLongitude(model, jd) {
192
- let zeta, z, theta, eps;
193
- if (model === "newcomb") {
194
- const B1850 = 239675820358095e-8;
195
- const CENTURY = 36524.2198781;
196
- const t = (J2000 - B1850) / CENTURY;
197
- const h = (jd - J2000) / CENTURY;
198
- const sum = (4607.1096 + t * (2.7944 + 118e-6 * t) + (1.3972 + 118e-6 * t + 0.03632 * h) * h) * h;
199
- const diff = (0.79236 + 656e-6 * t + 328e-6 * h) * h * h;
200
- zeta = (sum - diff) / 2;
201
- z = (sum + diff) / 2;
202
- theta = (2005.1125 - t * (0.85294 + 365e-6 * t) + (-0.42647 - 365e-6 * t - 0.041802 * h) * h) * h;
203
- const e = (jd - B1850) / CENTURY;
204
- eps = 84451.68 + e * (-46.837 + e * (-8752e-6 + 183e-5 * e));
205
- } else {
206
- const t = (jd - J2000) / 36525;
207
- zeta = t * (2306.2181 + t * (0.30188 + 0.017998 * t));
208
- z = t * (2306.2181 + t * (1.09468 + 0.018203 * t));
209
- theta = t * (2004.3109 + t * (-0.42665 - 0.041833 * t));
210
- eps = 84381.448 + t * (-46.815 + t * (-59e-5 + 1813e-6 * t));
211
- }
212
- [zeta, z, theta, eps] = [zeta * ARCSEC, z * ARCSEC, theta * ARCSEC, eps * ARCSEC];
213
- const x = Math.cos(z) * Math.cos(zeta) * Math.cos(theta) - Math.sin(z) * Math.sin(zeta);
214
- const y = Math.sin(z) * Math.cos(zeta) * Math.cos(theta) + Math.cos(z) * Math.sin(zeta);
215
- const w = Math.cos(zeta) * Math.sin(theta);
216
- return Math.atan2(Math.cos(eps) * y + Math.sin(eps) * w, x);
217
- }
218
- var FRAMES = /* @__PURE__ */ new WeakMap();
219
- 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);
230
- }
231
- return frame;
232
- }
233
- var dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
234
- var scale = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
235
- var unit = (a) => scale(a, 1 / Math.sqrt(dot(a, a)));
236
- function bias(v) {
237
- const [xi, eta, alpha] = [-16.617 * MAS, -6.8192 * MAS, -14.6 * MAS];
238
- const x1 = v[0] + alpha * v[1];
239
- const y1 = v[1] - alpha * v[0];
240
- const x2 = x1 - xi * v[2];
241
- const z2 = v[2] + xi * x1;
242
- return [x2, y1 - eta * z2, z2 + eta * y1];
243
- }
244
- function apparentStar(s, time) {
245
- const ra = s.ra * DEG;
246
- const dec = s.dec * DEG;
247
- const p0 = bias([Math.cos(dec) * Math.cos(ra), Math.cos(dec) * Math.sin(ra), Math.sin(dec)]);
248
- const east = bias([-Math.sin(ra), Math.cos(ra), 0]);
249
- const north = bias([-Math.sin(dec) * Math.cos(ra), -Math.sin(dec) * Math.sin(ra), Math.cos(dec)]);
250
- const days = time.tt + J2000 - s.epochTT;
251
- const pm = (k2) => k2 * MAS / JULIAN_YEAR;
252
- const bary = BaryState(Body.Earth, time);
253
- let q;
254
- if (s.parallax > 0) {
255
- const d = 1 / (s.parallax * MAS);
256
- const rv = s.radialVelocity * 86400 / AU_KM;
257
- q = [0, 1, 2].map((i) => d * p0[i] + days * (d * (pm(s.pmRa) * east[i] + pm(s.pmDec) * north[i]) + rv * p0[i]));
258
- q = [q[0] - bary.x, q[1] - bary.y, q[2] - bary.z];
259
- } else {
260
- q = [0, 1, 2].map((i) => p0[i] + days * (pm(s.pmRa) * east[i] + pm(s.pmDec) * north[i]));
261
- }
262
- let p = unit(q);
263
- const helio = HelioVector(Body.Earth, time);
264
- const em = Math.hypot(helio.x, helio.y, helio.z);
265
- const e = [helio.x / em, helio.y / em, helio.z / em];
266
- const pe = dot(p, e);
267
- const w = SUN_SCHWARZSCHILD_AU / em / Math.max(1 + pe, 1e-6 / Math.max(em * em, 1));
268
- p = unit([p[0] + w * (e[0] - pe * p[0]), p[1] + w * (e[1] - pe * p[1]), p[2] + w * (e[2] - pe * p[2])]);
269
- const v = [bary.vx / C_AU_PER_DAY, bary.vy / C_AU_PER_DAY, bary.vz / C_AU_PER_DAY];
270
- const root = Math.sqrt(1 - dot(v, v));
271
- const k = 1 + dot(p, v) / (1 + root);
272
- return unit([p[0] * root + k * v[0], p[1] * root + k * v[1], p[2] * root + k * v[2]]);
273
- }
274
- function meanAyanamsa(definition, time, frame) {
275
- switch (definition.kind) {
276
- case "epoch": {
277
- const { rotation, dpsi, correction } = frame;
278
- return definition.value + (correction - longitudeIn(rotation, dpsi, meanEquinox(time))) / DEG;
279
- }
280
- case "linear":
281
- return definition.value + definition.rate * (time.tt + J2000 - definition.epochTT) / JULIAN_YEAR / 3600;
282
- case "star": {
283
- 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;
286
- }
287
- }
288
- }
289
- function wrap(value) {
290
- const r = value % 360;
291
- return r > 180 ? r - 360 : r <= -180 ? r + 360 : r;
292
- }
293
- var VALUES = /* @__PURE__ */ new WeakMap();
294
- function isAyanamsaValue(value) {
295
- return typeof value === "object" && value !== null && VALUES.has(value);
296
- }
297
- function utcInstantOf(value) {
298
- const ms = VALUES.get(value);
299
- if (ms === void 0) throw new RangeError("ayanamsa must be a value returned by ayanamsa().");
300
- return new Date(Math.round(ms)).toISOString();
301
- }
302
- function ayanamsa(definition, at, options = {}) {
303
- const resolved = definitionOf(definition);
304
- const date = dateFrom(at, "at");
305
- const pin = options?.deltaT;
306
- if (pin !== void 0) requireFinite(pin, -1e10, 1e10, "deltaT");
307
- const scale2 = options?.timeScale;
308
- if (scale2 !== void 0 && !TIME_SCALE_NAMES.includes(scale2)) {
309
- throw new RangeError('timeScale must be "utc", "ut1" or "tt".');
310
- }
311
- const frame = resolved.kind === "epoch" ? epochFrame(resolved) : void 0;
312
- const outside = outsideReferenceSpan(date) || resolved.kind === "epoch" && !(resolved.epochTT >= SPAN_FROM_JD && resolved.epochTT < SPAN_TO_JD);
313
- return onChartClock(date.getTime(), scale2 ?? "utc", pin, (time, basis) => {
314
- const mean = wrap(meanAyanamsa(resolved, time, frame));
315
- const nutation = e_tilt(time).dpsi / 3600;
316
- const { ut1MinusUtc, leapSeconds } = basis.timeScale;
317
- const value = Object.freeze({
318
- ayanamsa: resolved.name,
319
- utc: date.toISOString(),
320
- timeScale: Object.freeze({
321
- ...basis.timeScale,
322
- ut1MinusUtc: ut1MinusUtc && Object.freeze({ ...ut1MinusUtc }),
323
- leapSeconds: leapSeconds && Object.freeze({ ...leapSeconds })
324
- }),
325
- julianDateTT: time.tt + J2000,
326
- deltaT: Object.freeze({ ...basis.deltaT }),
327
- mean,
328
- nutation,
329
- true: wrap(mean + nutation),
330
- flags: Object.freeze(outside ? ["outside-reference-span"] : [])
331
- });
332
- VALUES.set(value, basis.utcMs);
333
- return value;
334
- });
335
- }
336
-
337
- // src/vedic/grid.ts
338
- var TICKS_PER_DEGREE = 7560;
339
- var SIGN_TICKS = 226800;
340
- var NAKSHATRA_TICKS = 100800;
341
- var PADA_TICKS = 25200;
342
- var YEAR_TICKS = 840;
343
- var SPLIT = 134217729;
344
- function productError(a, b, p) {
345
- let t = SPLIT * a;
346
- const ah = t - (t - a);
347
- const al = a - ah;
348
- t = SPLIT * b;
349
- const bh = t - (t - b);
350
- const bl = b - bh;
351
- return ah * bh - p + ah * bl + al * bh + al * bl;
352
- }
353
- function ticksOf(lon) {
354
- const p = lon * TICKS_PER_DEGREE;
355
- const f = Math.floor(p);
356
- return f === p && productError(lon, TICKS_PER_DEGREE, p) < 0 ? f - 1 : f;
357
- }
358
-
359
- // src/vedic/sidereal.ts
360
- var SIDEREAL = /* @__PURE__ */ new WeakSet();
361
- function make(value) {
362
- const frozen = Object.freeze(value);
363
- SIDEREAL.add(frozen);
364
- return frozen;
365
- }
366
- function requireSidereal(value) {
367
- if (typeof value !== "object" || value === null || !SIDEREAL.has(value)) {
368
- throw new RangeError("Expected a SiderealLongitude from siderealLongitude or declareSiderealLongitude.");
369
- }
370
- return value;
371
- }
372
- function wrap360(value) {
373
- if (value >= 0 && value < 360) return value;
374
- let r = value % 360;
375
- if (r < 0) r += 360;
376
- return r === 360 || r === 0 ? 0 : r;
377
- }
378
- function finiteLongitude(value, label) {
379
- if (typeof value !== "number" || !Number.isFinite(value)) throw new RangeError(`${label} must be a finite number.`);
380
- return wrap360(value);
381
- }
382
- function siderealLongitude(tropicalLongitude, ayanamsa2) {
383
- if (!isAyanamsaValue(ayanamsa2)) throw new RangeError("ayanamsa must be a value returned by ayanamsa().");
384
- const tropical = finiteLongitude(tropicalLongitude, "tropicalLongitude");
385
- return make({
386
- frame: "sidereal",
387
- lon: wrap360(tropical - ayanamsa2.true),
388
- ayanamsa: ayanamsa2.ayanamsa,
389
- trueAyanamsa: ayanamsa2.true,
390
- tropical,
391
- utc: utcInstantOf(ayanamsa2)
392
- });
393
- }
394
- function declareSiderealLongitude(longitude, declaration) {
395
- const label = declaration?.ayanamsa;
396
- if (typeof label !== "string" || !label || label.length > 80 || label.trim() !== label || /[\u0000-\u001f\u007f]/.test(label)) {
397
- throw new RangeError("declaration.ayanamsa must be a nonempty trimmed label of at most 80 characters.");
398
- }
399
- const at = declaration.at;
400
- return make({
401
- frame: "sidereal",
402
- lon: finiteLongitude(longitude, "longitude"),
403
- ayanamsa: label,
404
- trueAyanamsa: null,
405
- tropical: null,
406
- utc: at === void 0 ? null : dateFrom(at, "declaration.at").toISOString()
407
- });
408
- }
409
- function siderealChartOf(chart, definition) {
410
- const input = chart.input;
411
- const value = ayanamsa(definition, input.utc, {
412
- ...input.deltaT === void 0 ? {} : { deltaT: input.deltaT },
413
- ...input.timeScale === void 0 ? {} : { timeScale: input.timeScale }
414
- });
415
- const of = (lon) => siderealLongitude(lon, value);
416
- const bodies = chart.bodies.map((row) => {
417
- const sidereal = of(row.lon);
418
- SIDEREAL.delete(sidereal);
419
- return make({ ...sidereal, body: row.body });
420
- });
421
- const ascendant = chart.angles ? of(chart.angles.asc) : null;
422
- const houseSystem = chart.houses ? chart.houses.system : null;
423
- let cusps = null;
424
- if (chart.houses && houseSystem === "whole" && ascendant) {
425
- const first = Math.floor(ticksOf(ascendant.lon) / SIGN_TICKS);
426
- cusps = Array.from({ length: 12 }, (_, k) => {
427
- const lon = (first + k) % 12 * 30;
428
- return make({
429
- frame: "sidereal",
430
- lon,
431
- ayanamsa: value.ayanamsa,
432
- trueAyanamsa: value.true,
433
- tropical: wrap360(lon + value.true),
434
- utc: utcInstantOf(value)
435
- });
436
- });
437
- } else if (chart.houses) {
438
- cusps = chart.houses.cusps.map(of);
439
- }
440
- const flags = [...chart.flags];
441
- for (const flag of value.flags) if (!flags.includes(flag)) flags.push(flag);
442
- return Object.freeze({
443
- ayanamsa: value.ayanamsa,
444
- ayanamsaValue: value,
445
- bodies: Object.freeze(bodies),
446
- ascendant,
447
- midheaven: chart.angles ? of(chart.angles.mc) : null,
448
- houseSystem,
449
- cusps: cusps && Object.freeze(cusps),
450
- flags: Object.freeze(flags)
451
- });
452
- }
33
+ SIGN_SLUGS
34
+ } from "./chunk-OG4OYTJJ.js";
453
35
 
454
36
  // src/vedic/chart.ts
455
37
  function siderealChart(natal, ayanamsa2) {
@@ -637,7 +219,7 @@ function vargaOf(position, varga, scheme = "parashari") {
637
219
  else sign = found.start(s) + (varga === "D3" ? 4 * part : varga === "D4" ? 3 * part : part);
638
220
  }
639
221
  const signIndex = (sign % 12 + 12) % 12;
640
- return Object.freeze({ varga, scheme, part: part + 1, sign: SIGN_NAMES[signIndex], signIndex });
222
+ return Object.freeze({ varga, scheme, part: part + 1, sign: SIGN_SLUGS[signIndex], signIndex });
641
223
  }
642
224
 
643
225
  // src/vedic/kp.ts
@@ -668,7 +250,7 @@ var SEGMENTS = (() => {
668
250
  const sign = Math.floor(from / SIGN_TICKS);
669
251
  out.push({
670
252
  number: out.length + 1,
671
- sign: SIGN_NAMES[sign],
253
+ sign: SIGN_SLUGS[sign],
672
254
  signLord: SIGN_LORDS[sign],
673
255
  star: NAKSHATRAS[n],
674
256
  starLord: VIMSHOTTARI_LORDS[n % 9],
@@ -688,7 +270,7 @@ var SEGMENTS = (() => {
688
270
  return out;
689
271
  })();
690
272
  var KP_SUBS = Object.freeze(SEGMENTS.map(
691
- ({ number, sign, signLord, star: star2, starLord, subLord, start, end }) => Object.freeze({ number, sign, signLord, star: star2, starLord, subLord, start, end })
273
+ ({ number, sign, signLord, star, starLord, subLord, start, end }) => Object.freeze({ number, sign, signLord, star, starLord, subLord, start, end })
692
274
  ));
693
275
  function kpLordsOf(position) {
694
276
  const ticks = ticksOf(requireSidereal(position).lon);
@@ -753,8 +335,8 @@ var ASHTOTTARI_YEARS = Object.freeze({
753
335
  });
754
336
  var CONTEXT = /* @__PURE__ */ new WeakMap();
755
337
  var iso = (ms) => new Date(Math.round(ms)).toISOString();
756
- function yearDaysOf(options) {
757
- const name = options?.yearLength ?? "julian";
338
+ function yearDaysOf(read) {
339
+ const name = read.yearLength ?? "julian";
758
340
  if (typeof name !== "string" || !Object.hasOwn(DASHA_YEAR_DAYS, name)) {
759
341
  throw new RangeError("yearLength must be julian, tropical or savana.");
760
342
  }
@@ -811,7 +393,7 @@ function result(system, yearLength, yearDays, moon, birthMs, balance, mahadashas
811
393
  }
812
394
  var vimYears = (index) => VIMSHOTTARI_YEARS[VIMSHOTTARI_LORDS[index]];
813
395
  function vimshottariDasha(moon, options) {
814
- const [yearLength, yearDays] = yearDaysOf(options);
396
+ const [yearLength, yearDays] = yearDaysOf(readOptions(options, ["yearLength"], "vimshottariDasha options"));
815
397
  const { moon: checked, birthMs } = moonAndBirth(moon);
816
398
  const { index, elapsed } = nakshatraOf(checked);
817
399
  const first = index % 9;
@@ -848,10 +430,12 @@ function dashaSubperiods(period) {
848
430
  ));
849
431
  }
850
432
  function vimshottariAt(moon, at, options) {
851
- const levels = integer(options?.levels ?? 5, 1, 5, "levels");
433
+ const read = readOptions(options, ["yearLength", "levels"], "vimshottariAt options");
434
+ const levels = integer(read.levels ?? 5, 1, 5, "levels");
852
435
  const when = dateFrom(at, "at").getTime();
853
436
  const chain = [];
854
- let periods = vimshottariDasha(moon, options).mahadashas;
437
+ const yearLength = read.yearLength;
438
+ let periods = vimshottariDasha(moon, yearLength === void 0 ? void 0 : { yearLength }).mahadashas;
855
439
  for (let level = 1; level <= levels; level += 1) {
856
440
  const found = periods.find((p) => Math.round(p.startMs) <= when && when < Math.round(p.endMs));
857
441
  if (!found) throw new RangeError("at is outside the 120-year Vimshottari cycle of this Moon.");
@@ -861,8 +445,9 @@ function vimshottariAt(moon, at, options) {
861
445
  return Object.freeze(chain);
862
446
  }
863
447
  function yoginiDasha(moon, options) {
864
- const [yearLength, yearDays] = yearDaysOf(options);
865
- const cycles = integer(options?.cycles ?? 1, 1, 10, "cycles");
448
+ const read = readOptions(options, ["yearLength", "cycles"], "dasha cycle options");
449
+ const [yearLength, yearDays] = yearDaysOf(read);
450
+ const cycles = integer(read.cycles ?? 1, 1, 10, "cycles");
866
451
  const { moon: checked, birthMs } = moonAndBirth(moon);
867
452
  const { index, elapsed } = nakshatraOf(checked);
868
453
  const first = (index + 3) % 8;
@@ -885,8 +470,9 @@ var ABHIJIT_END = 21 * NAKSHATRA_TICKS + NAKSHATRA_TICKS / 15;
885
470
  var ASHTOTTARI_LORDS = Object.keys(ASHTOTTARI_YEARS);
886
471
  var GROUP_SIZES = [4, 3, 4, 3, 4, 3, 4, 3];
887
472
  function ashtottariDasha(moon, options) {
888
- const [yearLength, yearDays] = yearDaysOf(options);
889
- const cycles = integer(options?.cycles ?? 1, 1, 10, "cycles");
473
+ const read = readOptions(options, ["yearLength", "cycles"], "dasha cycle options");
474
+ const [yearLength, yearDays] = yearDaysOf(read);
475
+ const cycles = integer(read.cycles ?? 1, 1, 10, "cycles");
890
476
  const { moon: checked, birthMs } = moonAndBirth(moon);
891
477
  const ticks = ticksOf(checked.lon);
892
478
  const standard = Math.floor(ticks / NAKSHATRA_TICKS);