panchang-ts 0.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.
@@ -0,0 +1,295 @@
1
+ interface GeoLocation {
2
+ /** Latitude in decimal degrees. Range: -90 to 90. */
3
+ latitude: number;
4
+ /** Longitude in decimal degrees. Range: -180 to 180. */
5
+ longitude: number;
6
+ /** Elevation in meters above sea level. Default: 0. */
7
+ elevation?: number;
8
+ }
9
+
10
+ type AyanamsaType = 'lahiri' | 'raman' | 'krishnamurti';
11
+ type Language = 'en' | 'sa' | 'hi';
12
+ type Precision = 'standard' | 'high';
13
+ interface PanchangOptions {
14
+ timezone: number | string;
15
+ ayanamsa?: AyanamsaType;
16
+ language?: Language;
17
+ computeEndTimes?: boolean;
18
+ precision?: Precision;
19
+ }
20
+ interface InstantPanchangOptions {
21
+ ayanamsa?: AyanamsaType;
22
+ language?: Language;
23
+ computeEndTimes?: boolean;
24
+ precision?: Precision;
25
+ }
26
+
27
+ interface TimePeriod {
28
+ start: Date;
29
+ end: Date;
30
+ }
31
+ interface ElementBase {
32
+ index: number;
33
+ name: string;
34
+ completionPercentage: number;
35
+ endTime: Date | null;
36
+ }
37
+ interface TithiInfo extends ElementBase {
38
+ paksha: 'Shukla' | 'Krishna';
39
+ number: number;
40
+ }
41
+ interface NakshatraInfo extends ElementBase {
42
+ pada: number;
43
+ degreesInNakshatra: number;
44
+ }
45
+ interface YogaInfo extends ElementBase {
46
+ }
47
+ interface KaranaInfo extends ElementBase {
48
+ type: 'fixed' | 'movable';
49
+ }
50
+ interface VaraInfo {
51
+ index: number;
52
+ name: string;
53
+ shortName: string;
54
+ englishName: string;
55
+ }
56
+ interface DailyElementBase {
57
+ startTime: Date | null;
58
+ isActiveAtSunrise: boolean;
59
+ }
60
+ interface DailyTithiInfo extends TithiInfo, DailyElementBase {
61
+ }
62
+ interface DailyNakshatraInfo extends NakshatraInfo, DailyElementBase {
63
+ }
64
+ interface DailyYogaInfo extends YogaInfo, DailyElementBase {
65
+ }
66
+ interface DailyKaranaInfo extends KaranaInfo, DailyElementBase {
67
+ }
68
+
69
+ interface MasaInfo {
70
+ index: number;
71
+ name: string;
72
+ }
73
+ interface DailyPanchangResult {
74
+ date: Date;
75
+ location: GeoLocation;
76
+ timezone: number;
77
+ sunrise: Date;
78
+ sunset: Date;
79
+ nextSunrise: Date;
80
+ dayDurationMinutes: number;
81
+ nightDurationMinutes: number;
82
+ tithis: DailyTithiInfo[];
83
+ nakshatras: DailyNakshatraInfo[];
84
+ yogas: DailyYogaInfo[];
85
+ karanas: DailyKaranaInfo[];
86
+ vara: VaraInfo;
87
+ rahuKalam: TimePeriod;
88
+ gulikaKalam: TimePeriod;
89
+ yamaganda: TimePeriod;
90
+ abhijitMuhurta: TimePeriod;
91
+ ayanamsa: number;
92
+ siderealSunAtSunrise: number;
93
+ siderealMoonAtSunrise: number;
94
+ masa: MasaInfo;
95
+ _debug?: {
96
+ totalMs: number;
97
+ sunriseMs: number;
98
+ elementsMs: number;
99
+ endTimesMs: number;
100
+ };
101
+ }
102
+ interface InstantPanchangResult {
103
+ timestamp: Date;
104
+ location: GeoLocation;
105
+ tithi: TithiInfo;
106
+ nakshatra: NakshatraInfo;
107
+ yoga: YogaInfo;
108
+ karana: KaranaInfo;
109
+ vara: VaraInfo;
110
+ ayanamsa: number;
111
+ siderealSun: number;
112
+ siderealMoon: number;
113
+ }
114
+
115
+ /**
116
+ * Returns the Panchang elements active at a single UTC moment.
117
+ *
118
+ * Use this for birth-chart calculations, muhurta selection, or any case
119
+ * where you need the exact element at a specific instant rather than a
120
+ * full sunrise-to-sunrise day.
121
+ *
122
+ * @param date UTC instant to evaluate.
123
+ * @param location Observer coordinates `{ latitude, longitude, elevation? }`.
124
+ * @param options Optional settings: `ayanamsa`, `language`, `computeEndTimes`,
125
+ * `precision`. No `timezone` required — the result is UTC-based.
126
+ * @returns `InstantPanchangResult` with one value per element
127
+ * (tithi, nakshatra, yoga, karana, vara) plus sidereal longitudes.
128
+ * @throws `PanchangError` for invalid inputs or polar locations with no sunrise.
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * import { getInstantPanchang } from 'panchang-ts';
133
+ *
134
+ * const p = getInstantPanchang(
135
+ * new Date('2025-01-14T03:00:00Z'),
136
+ * { latitude: 18.5204, longitude: 73.8567 },
137
+ * { language: 'sa' },
138
+ * );
139
+ * console.log(p.tithi.name); // "कृष्ण चतुर्दशी"
140
+ * console.log(p.tithi.endTime); // Date (UTC) when this Tithi ends
141
+ * ```
142
+ */
143
+ declare function getInstantPanchang(date: Date, location: GeoLocation, options?: InstantPanchangOptions): InstantPanchangResult;
144
+ /**
145
+ * Returns the full Hindu Panchang for a sunrise-to-sunrise day.
146
+ *
147
+ * The "day" is defined as the window from the local sunrise to the following
148
+ * sunrise (as per Vedic convention). Multiple elements per category are
149
+ * returned when a transition occurs during the day — e.g. if Tithi changes
150
+ * at 14:30 the result has two `DailyTithiInfo` entries.
151
+ *
152
+ * All `Date` objects in the result are **offset-adjusted** to the requested
153
+ * timezone. Read their components via `getUTC*` methods:
154
+ * ```
155
+ * result.sunrise.getUTCHours() // local sunrise hour
156
+ * result.sunrise.getHours() // ← wrong, uses system timezone
157
+ * ```
158
+ *
159
+ * @param date Any `Date` within the local calendar day you want.
160
+ * Only the calendar date is used; the time component is ignored.
161
+ * @param location Observer coordinates `{ latitude, longitude, elevation? }`.
162
+ * @param options Settings — `timezone` is required (UTC offset in minutes,
163
+ * e.g. 330 for IST). Also accepts `ayanamsa`, `language`,
164
+ * `computeEndTimes`, `precision`.
165
+ * @returns `DailyPanchangResult` with element arrays, sunrise/sunset,
166
+ * inauspicious periods, muhurta, ayanamsa, and Masa.
167
+ * @throws `PanchangError` for invalid inputs or polar locations with no sunrise.
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * import { getDailyPanchang } from 'panchang-ts';
172
+ *
173
+ * const result = getDailyPanchang(
174
+ * new Date(2025, 0, 14), // Jan 14, 2025
175
+ * { latitude: 18.5204, longitude: 73.8567 }, // Pune, India
176
+ * { timezone: 330 }, // IST = UTC+5:30
177
+ * );
178
+ *
179
+ * result.tithis[0].name; // "Krishna Chaturdashi"
180
+ * result.vara.name; // "Mangalavara"
181
+ * result.rahuKalam.start; // Date — read via getUTCHours()
182
+ *
183
+ * // Fast mode (names only, ~5× faster):
184
+ * const fast = getDailyPanchang(date, loc, { timezone: 330, computeEndTimes: false });
185
+ * ```
186
+ */
187
+ declare function getDailyPanchang(date: Date, location: GeoLocation, options: PanchangOptions): DailyPanchangResult;
188
+
189
+ /**
190
+ * Compute sunrise nearest to (and after) the given UTC search start.
191
+ *
192
+ * @param searchFromUtc Start searching from this UTC instant.
193
+ * For daily mode, this is local midnight converted to UTC.
194
+ * @param location Observer coordinates.
195
+ * @param limitDays How far ahead to search. Default 2 (handles polar edge cases).
196
+ * @returns Sunrise as a UTC Date.
197
+ * @throws PanchangError (NO_SUNRISE) for polar regions with no sunrise.
198
+ */
199
+ declare function computeSunrise(searchFromUtc: Date, location: GeoLocation, limitDays?: number): Date;
200
+ /**
201
+ * Compute sunset nearest to (and after) the given UTC search start.
202
+ *
203
+ * @param searchFromUtc Start searching from this UTC instant (typically sunrise).
204
+ * @param location Observer coordinates.
205
+ * @param limitDays How far ahead to search. Default 2.
206
+ * @returns Sunset as a UTC Date.
207
+ * @throws PanchangError (NO_SUNSET) for polar regions with no sunset.
208
+ */
209
+ declare function computeSunset(searchFromUtc: Date, location: GeoLocation, limitDays?: number): Date;
210
+
211
+ /**
212
+ * Sidereal longitude of the Sun at a given UTC instant.
213
+ * Returns degrees in range [0, 360).
214
+ *
215
+ * Uses SunPosition() for the geocentric ecliptic longitude of the Sun.
216
+ * EclipticLongitude(Body.Sun) is not valid — the Sun has no heliocentric longitude.
217
+ */
218
+ declare function getSiderealSunLongitude(date: Date, ayanamsaType: AyanamsaType): number;
219
+
220
+ /**
221
+ * Sidereal longitude of the Moon at a given UTC instant.
222
+ * Returns degrees in range [0, 360).
223
+ *
224
+ * Uses Ecliptic(GeoMoon(t)).elon for the geocentric ecliptic longitude.
225
+ * EclipticLongitude(Body.Moon) returns heliocentric longitude, which is
226
+ * inappropriate for panchang calculations.
227
+ */
228
+ declare function getSiderealMoonLongitude(date: Date, ayanamsaType: AyanamsaType): number;
229
+
230
+ /**
231
+ * Compute the ayanamsa (precession offset) for a given UTC date.
232
+ *
233
+ * The ayanamsa is subtracted from the tropical (ecliptic) longitude to obtain
234
+ * the sidereal longitude used in Vedic astrology.
235
+ *
236
+ * @param date UTC date to evaluate.
237
+ * @param type Ayanamsa system: `'lahiri'` (default), `'raman'`, or `'krishnamurti'`.
238
+ * @returns Ayanamsa value in degrees. Typical range ~23–24° for dates near J2000.
239
+ * @throws `PanchangError` (INVALID_AYANAMSA) for unrecognised type strings.
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * import { getAyanamsa } from 'panchang-ts';
244
+ * getAyanamsa(new Date('2025-01-01T00:00:00Z'), 'lahiri'); // ~24.10
245
+ * ```
246
+ */
247
+ declare function computeAyanamsa(date: Date, type?: AyanamsaType): number;
248
+
249
+ /**
250
+ * Compute Rahu Kalam — the inauspicious period ruled by Rahu.
251
+ * Daytime is divided into 8 equal slots; the slot index varies by weekday.
252
+ *
253
+ * @param sunrise UTC sunrise Date.
254
+ * @param sunset UTC sunset Date.
255
+ * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
256
+ * @returns `{ start, end }` UTC Dates for the Rahu Kalam period.
257
+ */
258
+ declare function computeRahuKalam(sunrise: Date, sunset: Date, varaIndex: number): TimePeriod;
259
+ /**
260
+ * Compute Gulika Kalam — the inauspicious period ruled by Saturn's son Gulika.
261
+ *
262
+ * @param sunrise UTC sunrise Date.
263
+ * @param sunset UTC sunset Date.
264
+ * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
265
+ * @returns `{ start, end }` UTC Dates for the Gulika Kalam period.
266
+ */
267
+ declare function computeGulikaKalam(sunrise: Date, sunset: Date, varaIndex: number): TimePeriod;
268
+ /**
269
+ * Compute Yamaganda — the inauspicious period associated with Yama (death).
270
+ *
271
+ * @param sunrise UTC sunrise Date.
272
+ * @param sunset UTC sunset Date.
273
+ * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
274
+ * @returns `{ start, end }` UTC Dates for the Yamaganda period.
275
+ */
276
+ declare function computeYamaganda(sunrise: Date, sunset: Date, varaIndex: number): TimePeriod;
277
+
278
+ /**
279
+ * Abhijit Muhurta: the 8th muhurta when daytime is divided into 15 equal parts.
280
+ * This is the most auspicious muhurta, centered around local noon.
281
+ *
282
+ * For a 12-hour day: each muhurta = 48 min. Abhijit = ~11:36 AM to 12:24 PM.
283
+ *
284
+ * @param sunrise Sunrise UTC Date
285
+ * @param sunset Sunset UTC Date
286
+ */
287
+ declare function computeAbhijitMuhurta(sunrise: Date, sunset: Date): TimePeriod;
288
+
289
+ type PanchangErrorCode = 'INVALID_LATITUDE' | 'INVALID_LONGITUDE' | 'INVALID_ELEVATION' | 'INVALID_DATE' | 'INVALID_TIMEZONE' | 'INVALID_AYANAMSA' | 'TIMEZONE_RESOLUTION_FAILED' | 'NO_SUNRISE' | 'NO_SUNSET' | 'SEARCH_DIVERGED';
290
+ declare class PanchangError extends Error {
291
+ readonly code: PanchangErrorCode;
292
+ constructor(message: string, code: PanchangErrorCode);
293
+ }
294
+
295
+ export { type AyanamsaType, type DailyKaranaInfo, type DailyNakshatraInfo, type DailyPanchangResult, type DailyTithiInfo, type DailyYogaInfo, type GeoLocation, type InstantPanchangOptions, type InstantPanchangResult, type KaranaInfo, type Language, type MasaInfo, type NakshatraInfo, PanchangError, type PanchangErrorCode, type PanchangOptions, type Precision, type TimePeriod, type TithiInfo, type VaraInfo, type YogaInfo, computeAbhijitMuhurta, computeGulikaKalam, computeRahuKalam, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };
@@ -0,0 +1,295 @@
1
+ interface GeoLocation {
2
+ /** Latitude in decimal degrees. Range: -90 to 90. */
3
+ latitude: number;
4
+ /** Longitude in decimal degrees. Range: -180 to 180. */
5
+ longitude: number;
6
+ /** Elevation in meters above sea level. Default: 0. */
7
+ elevation?: number;
8
+ }
9
+
10
+ type AyanamsaType = 'lahiri' | 'raman' | 'krishnamurti';
11
+ type Language = 'en' | 'sa' | 'hi';
12
+ type Precision = 'standard' | 'high';
13
+ interface PanchangOptions {
14
+ timezone: number | string;
15
+ ayanamsa?: AyanamsaType;
16
+ language?: Language;
17
+ computeEndTimes?: boolean;
18
+ precision?: Precision;
19
+ }
20
+ interface InstantPanchangOptions {
21
+ ayanamsa?: AyanamsaType;
22
+ language?: Language;
23
+ computeEndTimes?: boolean;
24
+ precision?: Precision;
25
+ }
26
+
27
+ interface TimePeriod {
28
+ start: Date;
29
+ end: Date;
30
+ }
31
+ interface ElementBase {
32
+ index: number;
33
+ name: string;
34
+ completionPercentage: number;
35
+ endTime: Date | null;
36
+ }
37
+ interface TithiInfo extends ElementBase {
38
+ paksha: 'Shukla' | 'Krishna';
39
+ number: number;
40
+ }
41
+ interface NakshatraInfo extends ElementBase {
42
+ pada: number;
43
+ degreesInNakshatra: number;
44
+ }
45
+ interface YogaInfo extends ElementBase {
46
+ }
47
+ interface KaranaInfo extends ElementBase {
48
+ type: 'fixed' | 'movable';
49
+ }
50
+ interface VaraInfo {
51
+ index: number;
52
+ name: string;
53
+ shortName: string;
54
+ englishName: string;
55
+ }
56
+ interface DailyElementBase {
57
+ startTime: Date | null;
58
+ isActiveAtSunrise: boolean;
59
+ }
60
+ interface DailyTithiInfo extends TithiInfo, DailyElementBase {
61
+ }
62
+ interface DailyNakshatraInfo extends NakshatraInfo, DailyElementBase {
63
+ }
64
+ interface DailyYogaInfo extends YogaInfo, DailyElementBase {
65
+ }
66
+ interface DailyKaranaInfo extends KaranaInfo, DailyElementBase {
67
+ }
68
+
69
+ interface MasaInfo {
70
+ index: number;
71
+ name: string;
72
+ }
73
+ interface DailyPanchangResult {
74
+ date: Date;
75
+ location: GeoLocation;
76
+ timezone: number;
77
+ sunrise: Date;
78
+ sunset: Date;
79
+ nextSunrise: Date;
80
+ dayDurationMinutes: number;
81
+ nightDurationMinutes: number;
82
+ tithis: DailyTithiInfo[];
83
+ nakshatras: DailyNakshatraInfo[];
84
+ yogas: DailyYogaInfo[];
85
+ karanas: DailyKaranaInfo[];
86
+ vara: VaraInfo;
87
+ rahuKalam: TimePeriod;
88
+ gulikaKalam: TimePeriod;
89
+ yamaganda: TimePeriod;
90
+ abhijitMuhurta: TimePeriod;
91
+ ayanamsa: number;
92
+ siderealSunAtSunrise: number;
93
+ siderealMoonAtSunrise: number;
94
+ masa: MasaInfo;
95
+ _debug?: {
96
+ totalMs: number;
97
+ sunriseMs: number;
98
+ elementsMs: number;
99
+ endTimesMs: number;
100
+ };
101
+ }
102
+ interface InstantPanchangResult {
103
+ timestamp: Date;
104
+ location: GeoLocation;
105
+ tithi: TithiInfo;
106
+ nakshatra: NakshatraInfo;
107
+ yoga: YogaInfo;
108
+ karana: KaranaInfo;
109
+ vara: VaraInfo;
110
+ ayanamsa: number;
111
+ siderealSun: number;
112
+ siderealMoon: number;
113
+ }
114
+
115
+ /**
116
+ * Returns the Panchang elements active at a single UTC moment.
117
+ *
118
+ * Use this for birth-chart calculations, muhurta selection, or any case
119
+ * where you need the exact element at a specific instant rather than a
120
+ * full sunrise-to-sunrise day.
121
+ *
122
+ * @param date UTC instant to evaluate.
123
+ * @param location Observer coordinates `{ latitude, longitude, elevation? }`.
124
+ * @param options Optional settings: `ayanamsa`, `language`, `computeEndTimes`,
125
+ * `precision`. No `timezone` required — the result is UTC-based.
126
+ * @returns `InstantPanchangResult` with one value per element
127
+ * (tithi, nakshatra, yoga, karana, vara) plus sidereal longitudes.
128
+ * @throws `PanchangError` for invalid inputs or polar locations with no sunrise.
129
+ *
130
+ * @example
131
+ * ```typescript
132
+ * import { getInstantPanchang } from 'panchang-ts';
133
+ *
134
+ * const p = getInstantPanchang(
135
+ * new Date('2025-01-14T03:00:00Z'),
136
+ * { latitude: 18.5204, longitude: 73.8567 },
137
+ * { language: 'sa' },
138
+ * );
139
+ * console.log(p.tithi.name); // "कृष्ण चतुर्दशी"
140
+ * console.log(p.tithi.endTime); // Date (UTC) when this Tithi ends
141
+ * ```
142
+ */
143
+ declare function getInstantPanchang(date: Date, location: GeoLocation, options?: InstantPanchangOptions): InstantPanchangResult;
144
+ /**
145
+ * Returns the full Hindu Panchang for a sunrise-to-sunrise day.
146
+ *
147
+ * The "day" is defined as the window from the local sunrise to the following
148
+ * sunrise (as per Vedic convention). Multiple elements per category are
149
+ * returned when a transition occurs during the day — e.g. if Tithi changes
150
+ * at 14:30 the result has two `DailyTithiInfo` entries.
151
+ *
152
+ * All `Date` objects in the result are **offset-adjusted** to the requested
153
+ * timezone. Read their components via `getUTC*` methods:
154
+ * ```
155
+ * result.sunrise.getUTCHours() // local sunrise hour
156
+ * result.sunrise.getHours() // ← wrong, uses system timezone
157
+ * ```
158
+ *
159
+ * @param date Any `Date` within the local calendar day you want.
160
+ * Only the calendar date is used; the time component is ignored.
161
+ * @param location Observer coordinates `{ latitude, longitude, elevation? }`.
162
+ * @param options Settings — `timezone` is required (UTC offset in minutes,
163
+ * e.g. 330 for IST). Also accepts `ayanamsa`, `language`,
164
+ * `computeEndTimes`, `precision`.
165
+ * @returns `DailyPanchangResult` with element arrays, sunrise/sunset,
166
+ * inauspicious periods, muhurta, ayanamsa, and Masa.
167
+ * @throws `PanchangError` for invalid inputs or polar locations with no sunrise.
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * import { getDailyPanchang } from 'panchang-ts';
172
+ *
173
+ * const result = getDailyPanchang(
174
+ * new Date(2025, 0, 14), // Jan 14, 2025
175
+ * { latitude: 18.5204, longitude: 73.8567 }, // Pune, India
176
+ * { timezone: 330 }, // IST = UTC+5:30
177
+ * );
178
+ *
179
+ * result.tithis[0].name; // "Krishna Chaturdashi"
180
+ * result.vara.name; // "Mangalavara"
181
+ * result.rahuKalam.start; // Date — read via getUTCHours()
182
+ *
183
+ * // Fast mode (names only, ~5× faster):
184
+ * const fast = getDailyPanchang(date, loc, { timezone: 330, computeEndTimes: false });
185
+ * ```
186
+ */
187
+ declare function getDailyPanchang(date: Date, location: GeoLocation, options: PanchangOptions): DailyPanchangResult;
188
+
189
+ /**
190
+ * Compute sunrise nearest to (and after) the given UTC search start.
191
+ *
192
+ * @param searchFromUtc Start searching from this UTC instant.
193
+ * For daily mode, this is local midnight converted to UTC.
194
+ * @param location Observer coordinates.
195
+ * @param limitDays How far ahead to search. Default 2 (handles polar edge cases).
196
+ * @returns Sunrise as a UTC Date.
197
+ * @throws PanchangError (NO_SUNRISE) for polar regions with no sunrise.
198
+ */
199
+ declare function computeSunrise(searchFromUtc: Date, location: GeoLocation, limitDays?: number): Date;
200
+ /**
201
+ * Compute sunset nearest to (and after) the given UTC search start.
202
+ *
203
+ * @param searchFromUtc Start searching from this UTC instant (typically sunrise).
204
+ * @param location Observer coordinates.
205
+ * @param limitDays How far ahead to search. Default 2.
206
+ * @returns Sunset as a UTC Date.
207
+ * @throws PanchangError (NO_SUNSET) for polar regions with no sunset.
208
+ */
209
+ declare function computeSunset(searchFromUtc: Date, location: GeoLocation, limitDays?: number): Date;
210
+
211
+ /**
212
+ * Sidereal longitude of the Sun at a given UTC instant.
213
+ * Returns degrees in range [0, 360).
214
+ *
215
+ * Uses SunPosition() for the geocentric ecliptic longitude of the Sun.
216
+ * EclipticLongitude(Body.Sun) is not valid — the Sun has no heliocentric longitude.
217
+ */
218
+ declare function getSiderealSunLongitude(date: Date, ayanamsaType: AyanamsaType): number;
219
+
220
+ /**
221
+ * Sidereal longitude of the Moon at a given UTC instant.
222
+ * Returns degrees in range [0, 360).
223
+ *
224
+ * Uses Ecliptic(GeoMoon(t)).elon for the geocentric ecliptic longitude.
225
+ * EclipticLongitude(Body.Moon) returns heliocentric longitude, which is
226
+ * inappropriate for panchang calculations.
227
+ */
228
+ declare function getSiderealMoonLongitude(date: Date, ayanamsaType: AyanamsaType): number;
229
+
230
+ /**
231
+ * Compute the ayanamsa (precession offset) for a given UTC date.
232
+ *
233
+ * The ayanamsa is subtracted from the tropical (ecliptic) longitude to obtain
234
+ * the sidereal longitude used in Vedic astrology.
235
+ *
236
+ * @param date UTC date to evaluate.
237
+ * @param type Ayanamsa system: `'lahiri'` (default), `'raman'`, or `'krishnamurti'`.
238
+ * @returns Ayanamsa value in degrees. Typical range ~23–24° for dates near J2000.
239
+ * @throws `PanchangError` (INVALID_AYANAMSA) for unrecognised type strings.
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * import { getAyanamsa } from 'panchang-ts';
244
+ * getAyanamsa(new Date('2025-01-01T00:00:00Z'), 'lahiri'); // ~24.10
245
+ * ```
246
+ */
247
+ declare function computeAyanamsa(date: Date, type?: AyanamsaType): number;
248
+
249
+ /**
250
+ * Compute Rahu Kalam — the inauspicious period ruled by Rahu.
251
+ * Daytime is divided into 8 equal slots; the slot index varies by weekday.
252
+ *
253
+ * @param sunrise UTC sunrise Date.
254
+ * @param sunset UTC sunset Date.
255
+ * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
256
+ * @returns `{ start, end }` UTC Dates for the Rahu Kalam period.
257
+ */
258
+ declare function computeRahuKalam(sunrise: Date, sunset: Date, varaIndex: number): TimePeriod;
259
+ /**
260
+ * Compute Gulika Kalam — the inauspicious period ruled by Saturn's son Gulika.
261
+ *
262
+ * @param sunrise UTC sunrise Date.
263
+ * @param sunset UTC sunset Date.
264
+ * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
265
+ * @returns `{ start, end }` UTC Dates for the Gulika Kalam period.
266
+ */
267
+ declare function computeGulikaKalam(sunrise: Date, sunset: Date, varaIndex: number): TimePeriod;
268
+ /**
269
+ * Compute Yamaganda — the inauspicious period associated with Yama (death).
270
+ *
271
+ * @param sunrise UTC sunrise Date.
272
+ * @param sunset UTC sunset Date.
273
+ * @param varaIndex Weekday index: 0 = Sunday, 6 = Saturday.
274
+ * @returns `{ start, end }` UTC Dates for the Yamaganda period.
275
+ */
276
+ declare function computeYamaganda(sunrise: Date, sunset: Date, varaIndex: number): TimePeriod;
277
+
278
+ /**
279
+ * Abhijit Muhurta: the 8th muhurta when daytime is divided into 15 equal parts.
280
+ * This is the most auspicious muhurta, centered around local noon.
281
+ *
282
+ * For a 12-hour day: each muhurta = 48 min. Abhijit = ~11:36 AM to 12:24 PM.
283
+ *
284
+ * @param sunrise Sunrise UTC Date
285
+ * @param sunset Sunset UTC Date
286
+ */
287
+ declare function computeAbhijitMuhurta(sunrise: Date, sunset: Date): TimePeriod;
288
+
289
+ type PanchangErrorCode = 'INVALID_LATITUDE' | 'INVALID_LONGITUDE' | 'INVALID_ELEVATION' | 'INVALID_DATE' | 'INVALID_TIMEZONE' | 'INVALID_AYANAMSA' | 'TIMEZONE_RESOLUTION_FAILED' | 'NO_SUNRISE' | 'NO_SUNSET' | 'SEARCH_DIVERGED';
290
+ declare class PanchangError extends Error {
291
+ readonly code: PanchangErrorCode;
292
+ constructor(message: string, code: PanchangErrorCode);
293
+ }
294
+
295
+ export { type AyanamsaType, type DailyKaranaInfo, type DailyNakshatraInfo, type DailyPanchangResult, type DailyTithiInfo, type DailyYogaInfo, type GeoLocation, type InstantPanchangOptions, type InstantPanchangResult, type KaranaInfo, type Language, type MasaInfo, type NakshatraInfo, PanchangError, type PanchangErrorCode, type PanchangOptions, type Precision, type TimePeriod, type TithiInfo, type VaraInfo, type YogaInfo, computeAbhijitMuhurta, computeGulikaKalam, computeRahuKalam, computeYamaganda, computeAyanamsa as getAyanamsa, getDailyPanchang, getInstantPanchang, getSiderealMoonLongitude, getSiderealSunLongitude, computeSunrise as getSunrise, computeSunset as getSunset };