@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.
Files changed (80) hide show
  1. package/CHANGELOG.md +1478 -0
  2. package/LICENSING.md +184 -30
  3. package/NOTICE +81 -14
  4. package/README.md +345 -67
  5. package/dist/{api-VOW6Umy5.d.ts → api-ChL1N2Sr.d.ts} +44 -7
  6. package/dist/ayanamsa-ClFzkKmV.d.ts +135 -0
  7. package/dist/calc.d.ts +218 -21
  8. package/dist/calc.js +580 -160
  9. package/dist/chunk-2PZYJQV5.js +83 -0
  10. package/dist/chunk-47ERTK5X.js +27 -0
  11. package/dist/{chunk-O3NJRGJ2.js → chunk-4XOYTBLS.js} +1 -1
  12. package/dist/chunk-767FTO7O.js +48 -0
  13. package/dist/{chunk-N4B5JNMA.js → chunk-7Y2F2IWN.js} +40 -28
  14. package/dist/chunk-B4M2Y7FT.js +96 -0
  15. package/dist/{chunk-KHBLFXFG.js → chunk-B5LKF437.js} +29 -28
  16. package/dist/{chunk-ONBZ4HK7.js → chunk-BHJXUY67.js} +4 -2
  17. package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
  18. package/dist/chunk-I3L4POY7.js +18 -0
  19. package/dist/{chunk-I7O5EGFV.js → chunk-LNGURVNH.js} +3 -3
  20. package/dist/{chunk-4NV4ZEFZ.js → chunk-NNOSOOWS.js} +4 -4
  21. package/dist/chunk-OVXQQEXL.js +41 -0
  22. package/dist/{chunk-WOU7JVD3.js → chunk-QLIEEICB.js} +205 -194
  23. package/dist/chunk-RMBWKZI2.js +130 -0
  24. package/dist/{chunk-AECKV73C.js → chunk-TSS2SZWQ.js} +8 -2
  25. package/dist/{chunk-L6ZHWJZ6.js → chunk-TZVPZHZM.js} +51 -29
  26. package/dist/chunk-WBTWY2OB.js +478 -0
  27. package/dist/chunk-Y4E3WJU5.js +87 -0
  28. package/dist/chunk-YPU3MDNI.js +852 -0
  29. package/dist/conventions.d.ts +70 -0
  30. package/dist/conventions.js +26 -0
  31. package/dist/crossings.d.ts +22 -10
  32. package/dist/crossings.js +1 -1
  33. package/dist/de440-pack.d.ts +43 -0
  34. package/dist/de440-pack.js +16 -0
  35. package/dist/de440.d.ts +113 -0
  36. package/dist/de440.js +19 -0
  37. package/dist/deltat.d.ts +28 -3
  38. package/dist/deltat.js +1 -1
  39. package/dist/ephemeris-exTSqBgb.d.ts +60 -0
  40. package/dist/geo.d.ts +46 -13
  41. package/dist/geo.js +4 -2
  42. package/dist/{houses-q1O2GGp4.d.ts → houses-Bh7GCnPi.d.ts} +14 -4
  43. package/dist/houses-extra.d.ts +22 -7
  44. package/dist/houses-extra.js +4 -2
  45. package/dist/index.d.ts +36 -49
  46. package/dist/index.js +54 -34
  47. package/dist/{internal-math-CmJ9xtaW.d.ts → internal-math-CxenuGfm.d.ts} +41 -27
  48. package/dist/internal-math.d.ts +4 -3
  49. package/dist/internal-math.js +14 -12
  50. package/dist/internal.d.ts +16 -7
  51. package/dist/internal.js +27 -6
  52. package/dist/lite-composite.js +114 -0
  53. package/dist/lite-declinations.js +253 -0
  54. package/dist/lite-dignities.js +333 -0
  55. package/dist/lite-sect.js +72 -0
  56. package/dist/lite.d.ts +82 -0
  57. package/dist/lite.js +4 -0
  58. package/dist/receipt.d.ts +3 -268
  59. package/dist/receipt.js +202 -89
  60. package/dist/reference-span-CILpclrz.d.ts +40 -0
  61. package/dist/{rulers-9wljfVaO.d.ts → rulers-CSSWtiWF.d.ts} +7 -2
  62. package/dist/sky.d.ts +26 -10
  63. package/dist/sky.js +23 -14
  64. package/dist/techniques.d.ts +160 -21
  65. package/dist/techniques.js +157 -89
  66. package/dist/time-bands-CZA9AlLg.d.ts +36 -0
  67. package/dist/time-scale-DIFNa0gz.d.ts +47 -0
  68. package/dist/time.d.ts +81 -0
  69. package/dist/time.js +74 -0
  70. package/dist/timing.d.ts +55 -17
  71. package/dist/timing.js +33 -45
  72. package/dist/types-DpPdtXgO.d.ts +335 -0
  73. package/dist/vedic.d.ts +150 -123
  74. package/dist/vedic.js +398 -440
  75. package/dist/window.d.ts +102 -80
  76. package/dist/window.js +108 -51
  77. package/dist/zone-history-BxmDCcTK.d.ts +290 -0
  78. package/package.json +26 -3
  79. package/dist/chunk-2OWGBT3O.js +0 -219
  80. package/dist/types-B4MCoCCS.d.ts +0 -228
package/dist/vedic.js CHANGED
@@ -1,438 +1,58 @@
1
1
  import {
2
2
  resolvedChart
3
- } from "./chunk-L6ZHWJZ6.js";
3
+ } from "./chunk-TZVPZHZM.js";
4
+ import {
5
+ AYANAMSAS,
6
+ NAKSHATRA_TICKS,
7
+ PADA_TICKS,
8
+ SIGN_TICKS,
9
+ TICKS_PER_DEGREE,
10
+ YEAR_TICKS,
11
+ ayanamsa,
12
+ ayanamsaAt,
13
+ declareSiderealLongitude,
14
+ definitionOf,
15
+ requireSidereal,
16
+ siderealChartOf,
17
+ siderealLongitude,
18
+ ticksOf,
19
+ userAyanamsa,
20
+ wrap360
21
+ } from "./chunk-WBTWY2OB.js";
22
+ import {
23
+ readOptions
24
+ } from "./chunk-47ERTK5X.js";
25
+ import {
26
+ gastHours,
27
+ meanNodeLongitude,
28
+ onChartClock,
29
+ refuseUnderSource
30
+ } from "./chunk-QLIEEICB.js";
4
31
  import {
5
32
  dateFrom
6
33
  } from "./chunk-CPALRSPC.js";
7
- import "./chunk-AECKV73C.js";
8
- import "./chunk-PFGUCNOK.js";
34
+ import "./chunk-B4M2Y7FT.js";
9
35
  import {
10
- eclipticFrame,
11
- meanEcliptic,
12
- onChartClock
13
- } from "./chunk-WOU7JVD3.js";
36
+ eclipticOfDate
37
+ } from "./chunk-2PZYJQV5.js";
14
38
  import {
15
- REFERENCE_SPAN,
16
- TIME_SCALE_NAMES,
17
- outsideReferenceSpan,
18
39
  timeBasis
19
- } from "./chunk-KHBLFXFG.js";
20
- import "./chunk-ONBZ4HK7.js";
21
- import "./chunk-4NV4ZEFZ.js";
40
+ } from "./chunk-B5LKF437.js";
41
+ import "./chunk-TSS2SZWQ.js";
42
+ import "./chunk-767FTO7O.js";
43
+ import "./chunk-YPU3MDNI.js";
22
44
  import {
23
- SIGN_NAMES
24
- } from "./chunk-2OWGBT3O.js";
25
-
26
- // src/vedic/ayanamsa.ts
27
- import { BaryState, Body, HelioVector } from "astronomy-engine";
28
- var DEG = Math.PI / 180;
29
- var ARCSEC = DEG / 3600;
30
- var MAS = ARCSEC / 1e3;
31
- var J2000 = 2451545;
32
- var DAY_MS = 864e5;
33
- var UNIX_JD = 24405875e-1;
34
- var JULIAN_YEAR = 365.25;
35
- var AU_KM = 1495978707e-1;
36
- var C_AU_PER_DAY = 299792.458 * 86400 / AU_KM;
37
- var SUN_SCHWARZSCHILD_AU = 197412574336e-19;
38
- var SPAN_FROM_JD = UNIX_JD + Date.parse(REFERENCE_SPAN.from) / DAY_MS;
39
- var SPAN_TO_JD = UNIX_JD + Date.parse(REFERENCE_SPAN.to) / DAY_MS;
40
- var DEFINITIONS = /* @__PURE__ */ new WeakSet();
41
- function registered(definition) {
42
- const frozen = Object.freeze(definition);
43
- DEFINITIONS.add(frozen);
44
- return frozen;
45
- }
46
- var HIPPARCOS_EPOCH = 24483490625e-4;
47
- var HIP2007 = "Hipparcos 2007 (I/311)";
48
- function star(name, ra, dec, pmRa, pmDec, parallax, radialVelocity, epochTT = HIPPARCOS_EPOCH) {
49
- return Object.freeze({ name, ra, dec, epochTT, pmRa, pmDec, parallax, radialVelocity });
50
- }
51
- var AYANAMSAS = Object.freeze({
52
- lahiri: registered({
53
- kind: "epoch",
54
- name: "lahiri",
55
- label: "Lahiri (Chitrapaksha)",
56
- // True 23°15′00.658″ less the IAU 1980 nutation in longitude at that instant, +16.768927″.
57
- epochTT: 24355535e-1,
58
- value: 23 + 15 / 60 + (0.658 - 16.768927) / 3600,
59
- model: "iau1976",
60
- source: "Indian Astronomical Ephemeris: 23\xB015\u203200.658\u2033 true at 1956-03-21 0h TT (1989, p. 556)"
61
- }),
62
- "fagan-bradley": registered({
63
- kind: "epoch",
64
- name: "fagan-bradley",
65
- label: "Fagan\u2013Bradley",
66
- epochTT: 243328242345905e-8,
67
- value: 24 + 2 / 60 + 31.36 / 3600,
68
- model: "newcomb",
69
- source: "Synetic vernal point 335\xB057\u203228.64\u2033 at B1950.0 (Astro*Index)"
70
- }),
71
- krishnamurti: registered({
72
- kind: "epoch",
73
- name: "krishnamurti",
74
- label: "Krishnamurti (KP)",
75
- epochTT: 24150205e-1,
76
- value: 22.363889,
77
- model: "newcomb",
78
- source: "22\xB021\u203250\u2033 at 1900-01-01, fitted to KP Reader 1's table (Hand, Dawson)"
79
- }),
80
- raman: registered({
81
- kind: "linear",
82
- name: "raman",
83
- label: "Raman",
84
- epochTT: J2000 + (397 - 2e3) * JULIAN_YEAR,
85
- value: 0,
86
- rate: 50 + 1 / 3,
87
- source: "B. V. Raman, A Manual of Hindu Astrology (1935) \xA749"
88
- }),
89
- yukteswar: registered({
90
- kind: "linear",
91
- name: "yukteswar",
92
- label: "Sri Yukteswar",
93
- epochTT: 24129081244e-4,
94
- value: 20 + 54 / 60 + 36 / 3600,
95
- rate: 54,
96
- source: "Sri Yukteswar, The Holy Science (1894), Introduction"
97
- }),
98
- "true-chitra": registered({
99
- kind: "star",
100
- name: "true-chitra",
101
- label: "True Chitra (Spica at 180\xB0)",
102
- longitude: 180,
103
- star: star("Spica (\u03B1 Vir, HIP 65474)", 201.29835228, -11.16124494, -42.35, -30.67, 13.06, -3.31),
104
- source: `Surya Siddhanta VIII; ${HIP2007}`
105
- }),
106
- "true-revati": registered({
107
- kind: "star",
108
- name: "true-revati",
109
- label: "True Revati (\u03B6 Psc at 359\xB050\u2032)",
110
- longitude: 359 + 50 / 60,
111
- star: star("Revati (\u03B6 Psc A, HIP 5737)", 18.43250842, 7.57548938, 145, -55.69, 18.76, 15),
112
- source: `Surya Siddhanta VIII; ${HIP2007}`
113
- }),
114
- "true-pushya": registered({
115
- kind: "star",
116
- name: "true-pushya",
117
- label: "True Pushya (\u03B4 Cnc at 106\xB0)",
118
- longitude: 106,
119
- star: star("Pushya (\u03B4 Cnc, HIP 42911)", 131.17129191, 18.15486373, -17.67, -229.26, 24.98, 17.14),
120
- source: `P. V. R. Narasimha Rao (2013); ${HIP2007}`
121
- }),
122
- "galactic-center": registered({
123
- kind: "star",
124
- name: "galactic-center",
125
- label: "Galactic Center at 0\xB0 Sagittarius",
126
- longitude: 240,
127
- star: star("Sgr A*", 266.416816625, -(29 + 28.1699 / 3600), -3.151, -5.547, 0, 0, J2000),
128
- source: "Sgr A*: SIMBAD ICRS position; Reid & Brunthaler 2004"
129
- })
130
- });
131
- function requireFinite(value, low, high, label) {
132
- if (typeof value !== "number" || !Number.isFinite(value) || value < low || value > high) {
133
- throw new RangeError(`${label} must be a finite number in [${low}, ${high}].`);
134
- }
135
- return value;
136
- }
137
- var EPOCH_JD_LIMIT = 1e8;
138
- function userAyanamsa(input) {
139
- if (!input || typeof input !== "object") throw new RangeError("userAyanamsa needs an input object.");
140
- const name = input.name ?? "user";
141
- if (typeof name !== "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(name) || Object.hasOwn(AYANAMSAS, name)) {
142
- throw new RangeError("Ayanamsa name must be a new lowercase identifier of at most 64 characters.");
143
- }
144
- const epoch = input.epoch;
145
- let epochTT;
146
- if (epoch && typeof epoch === "object" && !(epoch instanceof Date)) {
147
- epochTT = requireFinite(epoch.julianDateTT, UNIX_JD - EPOCH_JD_LIMIT, UNIX_JD + EPOCH_JD_LIMIT, "epoch.julianDateTT");
148
- } else {
149
- const at = dateFrom(epoch, "epoch");
150
- epochTT = J2000 + timeBasis(at.getTime(), "utc").ttDays;
151
- }
152
- const value = requireFinite(input.value, -360, 360, "value");
153
- const common = { name, label: `user: ${name}`, source: "caller-defined", epochTT, value };
154
- if (input.rate !== void 0) {
155
- if (input.model !== void 0) throw new RangeError("Give either a rate or a precession model, not both.");
156
- return registered({ kind: "linear", ...common, rate: requireFinite(input.rate, -3600, 3600, "rate") });
157
- }
158
- const model = input.model ?? "engine";
159
- if (model !== "engine" && model !== "newcomb" && model !== "iau1976") {
160
- throw new RangeError("model must be engine, newcomb or iau1976.");
161
- }
162
- return registered({ kind: "epoch", ...common, model });
163
- }
164
- function definitionOf(definition) {
165
- if (typeof definition === "string") {
166
- if (!Object.hasOwn(AYANAMSAS, definition)) throw new RangeError(`Unknown ayanamsa: ${definition}.`);
167
- return AYANAMSAS[definition];
168
- }
169
- if (!definition || typeof definition !== "object" || !DEFINITIONS.has(definition)) {
170
- throw new RangeError("An ayanamsa must be a built-in name, an AYANAMSAS entry or a userAyanamsa result.");
171
- }
172
- return definition;
173
- }
174
- function longitudeIn(frame, x, y, z) {
175
- const [ex, ey] = meanEcliptic(frame, x, y, z);
176
- return Math.atan2(ey, ex);
177
- }
178
- function olderModelLongitude(model, jd) {
179
- let zeta, z, theta, eps;
180
- if (model === "newcomb") {
181
- const B1850 = 239675820358095e-8;
182
- const CENTURY = 36524.2198781;
183
- const t = (J2000 - B1850) / CENTURY;
184
- const h = (jd - J2000) / CENTURY;
185
- const sum = (4607.1096 + t * (2.7944 + 118e-6 * t) + (1.3972 + 118e-6 * t + 0.03632 * h) * h) * h;
186
- const diff = (0.79236 + 656e-6 * t + 328e-6 * h) * h * h;
187
- zeta = (sum - diff) / 2;
188
- z = (sum + diff) / 2;
189
- theta = (2005.1125 - t * (0.85294 + 365e-6 * t) + (-0.42647 - 365e-6 * t - 0.041802 * h) * h) * h;
190
- const e = (jd - B1850) / CENTURY;
191
- eps = 84451.68 + e * (-46.837 + e * (-8752e-6 + 183e-5 * e));
192
- } else {
193
- const t = (jd - J2000) / 36525;
194
- zeta = t * (2306.2181 + t * (0.30188 + 0.017998 * t));
195
- z = t * (2306.2181 + t * (1.09468 + 0.018203 * t));
196
- theta = t * (2004.3109 + t * (-0.42665 - 0.041833 * t));
197
- eps = 84381.448 + t * (-46.815 + t * (-59e-5 + 1813e-6 * t));
198
- }
199
- [zeta, z, theta, eps] = [zeta * ARCSEC, z * ARCSEC, theta * ARCSEC, eps * ARCSEC];
200
- const x = Math.cos(z) * Math.cos(zeta) * Math.cos(theta) - Math.sin(z) * Math.sin(zeta);
201
- const y = Math.sin(z) * Math.cos(zeta) * Math.cos(theta) + Math.cos(z) * Math.sin(zeta);
202
- const w = Math.cos(zeta) * Math.sin(theta);
203
- return Math.atan2(Math.cos(eps) * y + Math.sin(eps) * w, x);
204
- }
205
- var FRAMES = /* @__PURE__ */ new WeakMap();
206
- function epochFrame(definition) {
207
- let epoch = FRAMES.get(definition);
208
- if (epoch === void 0) {
209
- const frame = eclipticFrame(definition.epochTT - J2000);
210
- const correction = definition.model === "engine" ? 0 : longitudeIn(frame, 1, 0, 0) - olderModelLongitude(definition.model, definition.epochTT);
211
- epoch = Object.freeze({ frame, correction });
212
- FRAMES.set(definition, epoch);
213
- }
214
- return epoch;
215
- }
216
- var dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
217
- var scale = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
218
- var unit = (a) => scale(a, 1 / Math.sqrt(dot(a, a)));
219
- function bias(v) {
220
- const [xi, eta, alpha] = [-16.617 * MAS, -6.8192 * MAS, -14.6 * MAS];
221
- const x1 = v[0] + alpha * v[1];
222
- const y1 = v[1] - alpha * v[0];
223
- const x2 = x1 - xi * v[2];
224
- const z2 = v[2] + xi * x1;
225
- return [x2, y1 - eta * z2, z2 + eta * y1];
226
- }
227
- function apparentStar(s, time) {
228
- const ra = s.ra * DEG;
229
- const dec = s.dec * DEG;
230
- const p0 = bias([Math.cos(dec) * Math.cos(ra), Math.cos(dec) * Math.sin(ra), Math.sin(dec)]);
231
- const east = bias([-Math.sin(ra), Math.cos(ra), 0]);
232
- const north = bias([-Math.sin(dec) * Math.cos(ra), -Math.sin(dec) * Math.sin(ra), Math.cos(dec)]);
233
- const days = time.tt + J2000 - s.epochTT;
234
- const pm = (k2) => k2 * MAS / JULIAN_YEAR;
235
- const bary = BaryState(Body.Earth, time);
236
- let q;
237
- if (s.parallax > 0) {
238
- const d = 1 / (s.parallax * MAS);
239
- const rv = s.radialVelocity * 86400 / AU_KM;
240
- q = [0, 1, 2].map((i) => d * p0[i] + days * (d * (pm(s.pmRa) * east[i] + pm(s.pmDec) * north[i]) + rv * p0[i]));
241
- q = [q[0] - bary.x, q[1] - bary.y, q[2] - bary.z];
242
- } else {
243
- q = [0, 1, 2].map((i) => p0[i] + days * (pm(s.pmRa) * east[i] + pm(s.pmDec) * north[i]));
244
- }
245
- let p = unit(q);
246
- const helio = HelioVector(Body.Earth, time);
247
- const em = Math.hypot(helio.x, helio.y, helio.z);
248
- const e = [helio.x / em, helio.y / em, helio.z / em];
249
- const pe = dot(p, e);
250
- const w = SUN_SCHWARZSCHILD_AU / em / Math.max(1 + pe, 1e-6 / Math.max(em * em, 1));
251
- 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])]);
252
- const v = [bary.vx / C_AU_PER_DAY, bary.vy / C_AU_PER_DAY, bary.vz / C_AU_PER_DAY];
253
- const root = Math.sqrt(1 - dot(v, v));
254
- const k = 1 + dot(p, v) / (1 + root);
255
- return unit([p[0] * root + k * v[0], p[1] * root + k * v[1], p[2] * root + k * v[2]]);
256
- }
257
- function meanAyanamsa(definition, time, frame) {
258
- switch (definition.kind) {
259
- case "epoch": {
260
- const { frame: at, correction } = frame;
261
- const [x, y, z] = eclipticFrame(time.tt).rows;
262
- return definition.value + (correction - longitudeIn(at, x, y, z)) / DEG;
263
- }
264
- case "linear":
265
- return definition.value + definition.rate * (time.tt + J2000 - definition.epochTT) / JULIAN_YEAR / 3600;
266
- case "star": {
267
- const [x, y, z] = apparentStar(definition.star, time);
268
- return longitudeIn(eclipticFrame(time.tt), x, y, z) / DEG - definition.longitude;
269
- }
270
- }
271
- }
272
- function wrap(value) {
273
- const r = value % 360;
274
- return r > 180 ? r - 360 : r <= -180 ? r + 360 : r;
275
- }
276
- var VALUES = /* @__PURE__ */ new WeakMap();
277
- function isAyanamsaValue(value) {
278
- return typeof value === "object" && value !== null && VALUES.has(value);
279
- }
280
- function utcInstantOf(value) {
281
- const ms = VALUES.get(value);
282
- if (ms === void 0) throw new RangeError("ayanamsa must be a value returned by ayanamsa().");
283
- return new Date(Math.round(ms)).toISOString();
284
- }
285
- function ayanamsa(definition, at, options = {}) {
286
- const resolved = definitionOf(definition);
287
- const date = dateFrom(at, "at");
288
- const pin = options?.deltaT;
289
- if (pin !== void 0) requireFinite(pin, -1e10, 1e10, "deltaT");
290
- const scale2 = options?.timeScale;
291
- if (scale2 !== void 0 && !TIME_SCALE_NAMES.includes(scale2)) {
292
- throw new RangeError('timeScale must be "utc", "ut1" or "tt".');
293
- }
294
- const frame = resolved.kind === "epoch" ? epochFrame(resolved) : void 0;
295
- const outside = outsideReferenceSpan(date) || resolved.kind === "epoch" && !(resolved.epochTT >= SPAN_FROM_JD && resolved.epochTT < SPAN_TO_JD);
296
- return onChartClock(date.getTime(), scale2 ?? "utc", pin, (time, basis) => {
297
- const mean = wrap(meanAyanamsa(resolved, time, frame));
298
- const nutation = eclipticFrame(time.tt).tilt.dpsi / 3600;
299
- const { ut1MinusUtc, leapSeconds } = basis.timeScale;
300
- const value = Object.freeze({
301
- ayanamsa: resolved.name,
302
- utc: date.toISOString(),
303
- timeScale: Object.freeze({
304
- ...basis.timeScale,
305
- ut1MinusUtc: ut1MinusUtc && Object.freeze({ ...ut1MinusUtc }),
306
- leapSeconds: leapSeconds && Object.freeze({ ...leapSeconds })
307
- }),
308
- julianDateTT: time.tt + J2000,
309
- deltaT: Object.freeze({ ...basis.deltaT }),
310
- mean,
311
- nutation,
312
- true: wrap(mean + nutation),
313
- flags: Object.freeze(outside ? ["outside-reference-span"] : [])
314
- });
315
- VALUES.set(value, basis.utcMs);
316
- return value;
317
- });
318
- }
319
-
320
- // src/vedic/grid.ts
321
- var TICKS_PER_DEGREE = 7560;
322
- var SIGN_TICKS = 226800;
323
- var NAKSHATRA_TICKS = 100800;
324
- var PADA_TICKS = 25200;
325
- var YEAR_TICKS = 840;
326
- var SPLIT = 134217729;
327
- function productError(a, b, p) {
328
- let t = SPLIT * a;
329
- const ah = t - (t - a);
330
- const al = a - ah;
331
- t = SPLIT * b;
332
- const bh = t - (t - b);
333
- const bl = b - bh;
334
- return ah * bh - p + ah * bl + al * bh + al * bl;
335
- }
336
- function ticksOf(lon) {
337
- const p = lon * TICKS_PER_DEGREE;
338
- const f = Math.floor(p);
339
- return f === p && productError(lon, TICKS_PER_DEGREE, p) < 0 ? f - 1 : f;
340
- }
341
-
342
- // src/vedic/sidereal.ts
343
- var SIDEREAL = /* @__PURE__ */ new WeakSet();
344
- function make(value) {
345
- const frozen = Object.freeze(value);
346
- SIDEREAL.add(frozen);
347
- return frozen;
348
- }
349
- function requireSidereal(value) {
350
- if (typeof value !== "object" || value === null || !SIDEREAL.has(value)) {
351
- throw new RangeError("Expected a SiderealLongitude from siderealLongitude or declareSiderealLongitude.");
352
- }
353
- return value;
354
- }
355
- function wrap360(value) {
356
- if (value >= 0 && value < 360) return value;
357
- let r = value % 360;
358
- if (r < 0) r += 360;
359
- return r === 360 || r === 0 ? 0 : r;
360
- }
361
- function finiteLongitude(value, label) {
362
- if (typeof value !== "number" || !Number.isFinite(value)) throw new RangeError(`${label} must be a finite number.`);
363
- return wrap360(value);
364
- }
365
- function siderealLongitude(tropicalLongitude, ayanamsa2) {
366
- if (!isAyanamsaValue(ayanamsa2)) throw new RangeError("ayanamsa must be a value returned by ayanamsa().");
367
- const tropical = finiteLongitude(tropicalLongitude, "tropicalLongitude");
368
- return make({
369
- frame: "sidereal",
370
- lon: wrap360(tropical - ayanamsa2.true),
371
- ayanamsa: ayanamsa2.ayanamsa,
372
- trueAyanamsa: ayanamsa2.true,
373
- tropical,
374
- utc: utcInstantOf(ayanamsa2)
375
- });
376
- }
377
- function declareSiderealLongitude(longitude, declaration) {
378
- const label = declaration?.ayanamsa;
379
- if (typeof label !== "string" || !label || label.length > 80 || label.trim() !== label || /[\u0000-\u001f\u007f]/.test(label)) {
380
- throw new RangeError("declaration.ayanamsa must be a nonempty trimmed label of at most 80 characters.");
381
- }
382
- const at = declaration.at;
383
- return make({
384
- frame: "sidereal",
385
- lon: finiteLongitude(longitude, "longitude"),
386
- ayanamsa: label,
387
- trueAyanamsa: null,
388
- tropical: null,
389
- utc: at === void 0 ? null : dateFrom(at, "declaration.at").toISOString()
390
- });
391
- }
392
- function siderealChartOf(chart, definition) {
393
- const input = chart.input;
394
- const value = ayanamsa(definition, input.utc, {
395
- ...input.deltaT === void 0 ? {} : { deltaT: input.deltaT },
396
- ...input.timeScale === void 0 ? {} : { timeScale: input.timeScale }
397
- });
398
- const of = (lon) => siderealLongitude(lon, value);
399
- const bodies = chart.bodies.map((row) => {
400
- const sidereal = of(row.lon);
401
- SIDEREAL.delete(sidereal);
402
- return make({ ...sidereal, body: row.body });
403
- });
404
- const ascendant = chart.angles ? of(chart.angles.asc) : null;
405
- const houseSystem = chart.houses ? chart.houses.system : null;
406
- let cusps = null;
407
- if (chart.houses && houseSystem === "whole" && ascendant) {
408
- const first = Math.floor(ticksOf(ascendant.lon) / SIGN_TICKS);
409
- cusps = Array.from({ length: 12 }, (_, k) => {
410
- const lon = (first + k) % 12 * 30;
411
- return make({
412
- frame: "sidereal",
413
- lon,
414
- ayanamsa: value.ayanamsa,
415
- trueAyanamsa: value.true,
416
- tropical: wrap360(lon + value.true),
417
- utc: utcInstantOf(value)
418
- });
419
- });
420
- } else if (chart.houses) {
421
- cusps = chart.houses.cusps.map(of);
422
- }
423
- const flags = [...chart.flags];
424
- for (const flag of value.flags) if (!flags.includes(flag)) flags.push(flag);
425
- return Object.freeze({
426
- ayanamsa: value.ayanamsa,
427
- ayanamsaValue: value,
428
- bodies: Object.freeze(bodies),
429
- ascendant,
430
- midheaven: chart.angles ? of(chart.angles.mc) : null,
431
- houseSystem,
432
- cusps: cusps && Object.freeze(cusps),
433
- flags: Object.freeze(flags)
434
- });
435
- }
45
+ tilt
46
+ } from "./chunk-Y4E3WJU5.js";
47
+ import {
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";
436
56
 
437
57
  // src/vedic/chart.ts
438
58
  function siderealChart(natal, ayanamsa2) {
@@ -599,14 +219,21 @@ var TRIMSAMSA = [
599
219
  { ends: [5, 12, 20, 25, 30], signs: [1, 5, 11, 9, 7] }
600
220
  ].map(({ ends, signs }) => ({ ends: ends.map((d) => d * 7560), signs }));
601
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) {
602
226
  const found = RULES.find((candidate) => candidate.name === varga);
603
227
  if (!found) throw new RangeError(`Unknown varga: ${String(varga)}.`);
604
228
  if (!found.schemes.includes(scheme)) {
605
229
  throw new RangeError(found.notImplemented.includes(scheme) || scheme === "cyclic" ? `The ${String(scheme)} ${varga} is not implemented.` : `Unknown varga scheme: ${String(scheme)}.`);
606
230
  }
607
- const ticks = ticksOf(requireSidereal(position).lon);
231
+ return found;
232
+ }
233
+ function placed(found, scheme, ticks) {
608
234
  const s = Math.floor(ticks / SIGN_TICKS);
609
235
  const within = ticks - s * SIGN_TICKS;
236
+ const varga = found.name;
610
237
  let part;
611
238
  let sign;
612
239
  if (varga === "D30") {
@@ -619,8 +246,333 @@ function vargaOf(position, varga, scheme = "parashari") {
619
246
  else if (varga === "D2") sign = (odd(s) ? part === 0 : part === 1) ? 4 : 3;
620
247
  else sign = found.start(s) + (varga === "D3" ? 4 * part : varga === "D4" ? 3 * part : part);
621
248
  }
622
- const signIndex = (sign % 12 + 12) % 12;
623
- return Object.freeze({ varga, scheme, part: part + 1, sign: SIGN_NAMES[signIndex], signIndex });
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
+ });
624
576
  }
625
577
 
626
578
  // src/vedic/kp.ts
@@ -651,7 +603,7 @@ var SEGMENTS = (() => {
651
603
  const sign = Math.floor(from / SIGN_TICKS);
652
604
  out.push({
653
605
  number: out.length + 1,
654
- sign: SIGN_NAMES[sign],
606
+ sign: SIGN_SLUGS[sign],
655
607
  signLord: SIGN_LORDS[sign],
656
608
  star: NAKSHATRAS[n],
657
609
  starLord: VIMSHOTTARI_LORDS[n % 9],
@@ -671,7 +623,7 @@ var SEGMENTS = (() => {
671
623
  return out;
672
624
  })();
673
625
  var KP_SUBS = Object.freeze(SEGMENTS.map(
674
- ({ number, sign, signLord, star: star2, starLord, subLord, start, end }) => Object.freeze({ number, sign, signLord, star: star2, starLord, subLord, start, end })
626
+ ({ number, sign, signLord, star, starLord, subLord, start, end }) => Object.freeze({ number, sign, signLord, star, starLord, subLord, start, end })
675
627
  ));
676
628
  function kpLordsOf(position) {
677
629
  const ticks = ticksOf(requireSidereal(position).lon);
@@ -736,8 +688,8 @@ var ASHTOTTARI_YEARS = Object.freeze({
736
688
  });
737
689
  var CONTEXT = /* @__PURE__ */ new WeakMap();
738
690
  var iso = (ms) => new Date(Math.round(ms)).toISOString();
739
- function yearDaysOf(options) {
740
- const name = options?.yearLength ?? "julian";
691
+ function yearDaysOf(read) {
692
+ const name = read.yearLength ?? "julian";
741
693
  if (typeof name !== "string" || !Object.hasOwn(DASHA_YEAR_DAYS, name)) {
742
694
  throw new RangeError("yearLength must be julian, tropical or savana.");
743
695
  }
@@ -794,7 +746,7 @@ function result(system, yearLength, yearDays, moon, birthMs, balance, mahadashas
794
746
  }
795
747
  var vimYears = (index) => VIMSHOTTARI_YEARS[VIMSHOTTARI_LORDS[index]];
796
748
  function vimshottariDasha(moon, options) {
797
- const [yearLength, yearDays] = yearDaysOf(options);
749
+ const [yearLength, yearDays] = yearDaysOf(readOptions(options, ["yearLength"], "vimshottariDasha options"));
798
750
  const { moon: checked, birthMs } = moonAndBirth(moon);
799
751
  const { index, elapsed } = nakshatraOf(checked);
800
752
  const first = index % 9;
@@ -831,10 +783,12 @@ function dashaSubperiods(period) {
831
783
  ));
832
784
  }
833
785
  function vimshottariAt(moon, at, options) {
834
- const levels = integer(options?.levels ?? 5, 1, 5, "levels");
786
+ const read = readOptions(options, ["yearLength", "levels"], "vimshottariAt options");
787
+ const levels = integer(read.levels ?? 5, 1, 5, "levels");
835
788
  const when = dateFrom(at, "at").getTime();
836
789
  const chain = [];
837
- let periods = vimshottariDasha(moon, options).mahadashas;
790
+ const yearLength = read.yearLength;
791
+ let periods = vimshottariDasha(moon, yearLength === void 0 ? void 0 : { yearLength }).mahadashas;
838
792
  for (let level = 1; level <= levels; level += 1) {
839
793
  const found = periods.find((p) => Math.round(p.startMs) <= when && when < Math.round(p.endMs));
840
794
  if (!found) throw new RangeError("at is outside the 120-year Vimshottari cycle of this Moon.");
@@ -844,8 +798,9 @@ function vimshottariAt(moon, at, options) {
844
798
  return Object.freeze(chain);
845
799
  }
846
800
  function yoginiDasha(moon, options) {
847
- const [yearLength, yearDays] = yearDaysOf(options);
848
- const cycles = integer(options?.cycles ?? 1, 1, 10, "cycles");
801
+ const read = readOptions(options, ["yearLength", "cycles"], "dasha cycle options");
802
+ const [yearLength, yearDays] = yearDaysOf(read);
803
+ const cycles = integer(read.cycles ?? 1, 1, 10, "cycles");
849
804
  const { moon: checked, birthMs } = moonAndBirth(moon);
850
805
  const { index, elapsed } = nakshatraOf(checked);
851
806
  const first = (index + 3) % 8;
@@ -868,8 +823,9 @@ var ABHIJIT_END = 21 * NAKSHATRA_TICKS + NAKSHATRA_TICKS / 15;
868
823
  var ASHTOTTARI_LORDS = Object.keys(ASHTOTTARI_YEARS);
869
824
  var GROUP_SIZES = [4, 3, 4, 3, 4, 3, 4, 3];
870
825
  function ashtottariDasha(moon, options) {
871
- const [yearLength, yearDays] = yearDaysOf(options);
872
- const cycles = integer(options?.cycles ?? 1, 1, 10, "cycles");
826
+ const read = readOptions(options, ["yearLength", "cycles"], "dasha cycle options");
827
+ const [yearLength, yearDays] = yearDaysOf(read);
828
+ const cycles = integer(read.cycles ?? 1, 1, 10, "cycles");
873
829
  const { moon: checked, birthMs } = moonAndBirth(moon);
874
830
  const ticks = ticksOf(checked.lon);
875
831
  const standard = Math.floor(ticks / NAKSHATRA_TICKS);
@@ -911,6 +867,7 @@ export {
911
867
  NAKSHATRAS,
912
868
  SIGN_LORDS,
913
869
  VARGAS,
870
+ VARGA_POINTS,
914
871
  VIMSHOTTARI_LORDS,
915
872
  VIMSHOTTARI_YEARS,
916
873
  YOGINIS,
@@ -924,6 +881,7 @@ export {
924
881
  siderealLongitude,
925
882
  userAyanamsa,
926
883
  vargaOf,
884
+ vargaSensitivity,
927
885
  vimshottariAt,
928
886
  vimshottariDasha,
929
887
  yoginiDasha