lifeastroapi 0.0.0-stage → 0.3.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,1277 @@
1
+ /**
2
+ * Shared building blocks for the report → HTML templates.
3
+ *
4
+ * These templates are ported from the LifeAstroAPI server-side Go templates
5
+ * (`internal/pdf/*.go`) so the SDK-rendered PDF looks identical to the
6
+ * design the API was built to produce. Each `render*Html` function consumes
7
+ * the JSON exactly as returned by `client.reports.*` and emits a
8
+ * self-contained HTML document ready to convert to PDF (see `htmlToPdf`).
9
+ */
10
+ /** Branding overrides supplied by the SDK caller (camelCase, all optional). */
11
+ interface Branding {
12
+ companyName?: string;
13
+ /** Logo image URL (or a `data:` URI). Rendered at the top of the cover. */
14
+ logoUrl?: string;
15
+ /** Primary accent color (headings, table headers). */
16
+ primaryColor?: string;
17
+ /** Secondary color (meta text, footer). */
18
+ secondaryColor?: string;
19
+ /** Footer line printed on every page. */
20
+ footerText?: string;
21
+ /** Diagonal watermark text (e.g. "DRAFT", "SAMPLE"). */
22
+ watermarkText?: string;
23
+ }
24
+ /** Branding as it appears in the API JSON (`data.Branding`, PascalCase). */
25
+ interface RawBranding {
26
+ CompanyName?: string;
27
+ LogoURL?: string;
28
+ PrimaryColor?: string;
29
+ SecondaryColor?: string;
30
+ FooterText?: string;
31
+ WatermarkText?: string;
32
+ }
33
+ /** Fully resolved branding with defaults applied. */
34
+ interface ResolvedBranding {
35
+ companyName: string;
36
+ logoUrl: string;
37
+ primaryColor: string;
38
+ secondaryColor: string;
39
+ footerText: string;
40
+ watermarkText: string;
41
+ }
42
+ /**
43
+ * Merge caller-supplied branding over the branding embedded in the report
44
+ * JSON, then apply sensible defaults. Caller overrides win per-field.
45
+ */
46
+ declare function resolveBranding(raw?: RawBranding, override?: Branding): ResolvedBranding;
47
+ /**
48
+ * Strip "AI-tell" punctuation that readers associate with machine-generated
49
+ * text — em-dash (—), en-dash (–) and arrows (→ ⟶ -> →) — replacing them with
50
+ * a natural comma. Works for ALL languages (Devanagari, Latin, etc.). Also
51
+ * tidies the artefacts the swap can create (double commas, comma-before-comma,
52
+ * spaces before commas, a trailing/leading comma).
53
+ */
54
+ declare function humanize(text: string): string;
55
+ /**
56
+ * Make an authored narrative BODY read like a warm, second-person consumer
57
+ * reading instead of a clinical astrologer's note:
58
+ * - strips the repeated "three-levels / astrology is about guidance" filler
59
+ * paragraph that pads ~2000 rules and says nothing about the person;
60
+ * - converts the third-person clinical term ("the native" / "जातक" /
61
+ * "जातक") to second person ("you" / "आप").
62
+ * Locale-aware. Safe to run on any string (no-ops if nothing matches).
63
+ * Apply this to narrative bodies only (not labels/headings).
64
+ */
65
+ declare function cleanNarrative(text: string, locale?: string): string;
66
+ /** HTML-escape a value (after humanizing AI-tell punctuation). `null`/`undefined` → "". */
67
+ declare function esc(value: unknown): string;
68
+ /** HTML-escape a NARRATIVE BODY: clean tone first (locale-aware), then esc. */
69
+ declare function escBody(value: unknown, locale?: string): string;
70
+ /** One authored narrative block, as it appears in report JSON (PascalCase). */
71
+ interface NarrativeSection {
72
+ Heading?: string;
73
+ Body?: string;
74
+ Bullets?: string[];
75
+ Citations?: string[];
76
+ }
77
+
78
+ /**
79
+ * Vedic Birth Chart (Lite) report → HTML.
80
+ *
81
+ * Ported from the LifeAstroAPI server-side Go template
82
+ * (`internal/pdf/kundli_lite.go`). The Lite report is a deliberate subset of
83
+ * the Detailed Kundli: cover page, ascendant + lagna-summary block, and the
84
+ * 9-graha planet positions table. No per-rule narrative sections, panchang,
85
+ * or citations.
86
+ *
87
+ * Consumes the JSON exactly as returned by `client.reports.kundliLite()` and
88
+ * emits a self-contained HTML document ready to convert to PDF.
89
+ */
90
+
91
+ /** A single planetary placement (PascalCase struct, snake_case JSON fields). */
92
+ interface KundliLitePlacement {
93
+ sign?: string;
94
+ dms_within?: string;
95
+ nakshatra?: string;
96
+ pada?: number;
97
+ nak_lord?: string;
98
+ }
99
+ /** One graha row in the planet table. */
100
+ interface KundliLitePlanet {
101
+ name?: string;
102
+ placement?: KundliLitePlacement;
103
+ house_num?: number;
104
+ retro?: boolean;
105
+ }
106
+ /** Birth subject (reused shape from the Detailed Kundli). */
107
+ interface KundliLiteSubject {
108
+ Name?: string;
109
+ BirthDate?: string;
110
+ BirthTime?: string;
111
+ BirthPlace?: string;
112
+ Lat?: number;
113
+ Lon?: number;
114
+ }
115
+ /**
116
+ * The Lite report payload, mirroring Go's `KundliLiteReportData`.
117
+ * Top-level + Subject fields are PascalCase (no Go `json:` tag); nested
118
+ * placement fields are snake_case (tagged in KundliPlacement/KundliPlanet).
119
+ */
120
+ interface KundliLiteData {
121
+ Locale?: string;
122
+ Branding?: RawBranding;
123
+ Subject?: KundliLiteSubject;
124
+ Ascendant?: KundliLitePlacement;
125
+ Planets?: KundliLitePlanet[];
126
+ LagnaSummary?: string;
127
+ GeneratedAt?: string;
128
+ }
129
+ declare function renderKundliLiteHtml(data: KundliLiteData, branding?: Branding): string;
130
+
131
+ /**
132
+ * Brihad Kundli — renderers for the deep classical sections + corpus-backed
133
+ * narrative chapters (the content that takes the report to 290+ pages).
134
+ *
135
+ * These consume the snake_case JSON keys emitted by the Go C-series structs
136
+ * (internal/pdf/brihad_csections.go) and the narrative chapters
137
+ * (BrihadNarrativeChapter). Kept separate from kundliBrihad.ts so the main
138
+ * template stays readable; the main render fn imports renderBrihadDeepSections
139
+ * and splices its output into the document body.
140
+ */
141
+
142
+ interface BrihadNarrativeSection {
143
+ Heading?: string;
144
+ Body?: string;
145
+ Bullets?: string[] | null;
146
+ Citations?: string[] | null;
147
+ }
148
+ interface BrihadNarrativeChapter {
149
+ key?: string;
150
+ title?: string;
151
+ sections?: BrihadNarrativeSection[];
152
+ }
153
+ interface BrihadAvakahada {
154
+ paya?: string;
155
+ varna?: string;
156
+ vashya?: string;
157
+ yoni?: string;
158
+ gana?: string;
159
+ nadi?: string;
160
+ tatva?: string;
161
+ nakshatra_lord?: string;
162
+ rashi_lord?: string;
163
+ lagna_lord?: string;
164
+ }
165
+ interface BrihadGhata {
166
+ weekday?: string;
167
+ tithi_text?: string;
168
+ month?: string;
169
+ nakshatra?: string;
170
+ yoga?: string;
171
+ karana?: string;
172
+ prahar?: number;
173
+ ghata_rashi?: string;
174
+ }
175
+ interface BrihadChalit {
176
+ houses?: {
177
+ house?: number;
178
+ begin_sign?: string;
179
+ begin_dms?: string;
180
+ madhya_sign?: string;
181
+ madhya_dms?: string;
182
+ }[];
183
+ planets?: {
184
+ name?: string;
185
+ rashi_house?: number;
186
+ chalit_house?: number;
187
+ shifted?: boolean;
188
+ }[];
189
+ }
190
+ interface BrihadKP {
191
+ cusps?: {
192
+ house?: number;
193
+ sign?: string;
194
+ dms?: string;
195
+ star_lord?: string;
196
+ sub_lord?: string;
197
+ sub_sub_lord?: string;
198
+ }[];
199
+ planet_significators?: {
200
+ key?: string;
201
+ values?: number[];
202
+ }[];
203
+ house_significators?: {
204
+ house?: number;
205
+ planets?: string[];
206
+ }[];
207
+ ruling_planets?: Record<string, string>;
208
+ }
209
+ interface BrihadJaimini {
210
+ charakarakas?: {
211
+ karaka?: string;
212
+ planet?: string;
213
+ }[];
214
+ karakamsa_sign?: string;
215
+ swamsa_sign?: string;
216
+ arudha_padas?: {
217
+ label?: string;
218
+ name?: string;
219
+ sign?: string;
220
+ house?: number;
221
+ }[];
222
+ }
223
+ interface BrihadIshtaDevata {
224
+ deity?: string;
225
+ twelfth_sign?: string;
226
+ determining_graha?: string;
227
+ body?: string;
228
+ }
229
+ interface BrihadMaitriRow {
230
+ planet?: string;
231
+ relations?: Record<string, string>;
232
+ }
233
+ interface BrihadMaitri {
234
+ order?: string[];
235
+ naisargik?: BrihadMaitriRow[];
236
+ tatkalik?: BrihadMaitriRow[];
237
+ panchadha?: BrihadMaitriRow[];
238
+ }
239
+ interface BrihadAvastha {
240
+ planet?: string;
241
+ baladi?: string;
242
+ jagradadi?: string;
243
+ deeptadi?: string;
244
+ }
245
+ interface BrihadLalKitab {
246
+ planets?: {
247
+ name?: string;
248
+ house?: number;
249
+ sign?: string;
250
+ }[];
251
+ rins?: {
252
+ name?: string;
253
+ present?: boolean;
254
+ body?: string;
255
+ }[];
256
+ teva?: {
257
+ name?: string;
258
+ present?: boolean;
259
+ }[];
260
+ }
261
+ interface BrihadShadbalaRow {
262
+ planet?: string;
263
+ total_rupas?: number;
264
+ rank?: number;
265
+ }
266
+ interface BrihadBhavaBalaRow {
267
+ house?: number;
268
+ bhavadhipati?: number;
269
+ bhava_dig_bala?: number;
270
+ bhava_drsti?: number;
271
+ total?: number;
272
+ }
273
+ interface BrihadAshtakavarga {
274
+ sav?: number[];
275
+ sav_total?: number;
276
+ prastar?: {
277
+ planet?: string;
278
+ contributors?: string[];
279
+ grid?: number[][];
280
+ per_sign?: number[];
281
+ total?: number;
282
+ }[];
283
+ }
284
+ interface BrihadVarshaphalYear {
285
+ year?: number;
286
+ muntha_sign?: string;
287
+ muntha_house?: number;
288
+ varsha_lord?: string;
289
+ sahams?: {
290
+ name?: string;
291
+ sign?: string;
292
+ dms?: string;
293
+ lord?: string;
294
+ verified?: boolean;
295
+ }[];
296
+ panchavargeeya?: {
297
+ planet?: string;
298
+ vishwa?: number;
299
+ }[];
300
+ summary?: string;
301
+ }
302
+ interface BrihadRajyogaPower {
303
+ percent?: number;
304
+ yoga_count?: number;
305
+ planets?: string[];
306
+ swarnim_kaal?: {
307
+ lord?: string;
308
+ start?: string;
309
+ end?: string;
310
+ }[];
311
+ }
312
+ interface BrihadMuddaArea {
313
+ label?: string;
314
+ text?: string;
315
+ }
316
+ interface BrihadMuddaPeriod {
317
+ lord?: string;
318
+ date_from?: string;
319
+ date_to?: string;
320
+ summary?: string;
321
+ areas?: BrihadMuddaArea[];
322
+ do_label?: string;
323
+ do?: string;
324
+ avoid_label?: string;
325
+ avoid?: string;
326
+ remedy_label?: string;
327
+ remedy?: string;
328
+ }
329
+ interface BrihadMuddaTimeline {
330
+ year?: number;
331
+ heading?: string;
332
+ periods?: BrihadMuddaPeriod[];
333
+ }
334
+ /** Container of the new fields, mixed into KundliBrihadData. */
335
+ interface BrihadPanchang {
336
+ tithi?: string;
337
+ vara?: string;
338
+ nakshatra?: string;
339
+ yoga?: string;
340
+ karana?: string;
341
+ }
342
+ interface BrihadGemstone {
343
+ kind?: string;
344
+ planet?: string;
345
+ stone?: string;
346
+ reason?: string;
347
+ }
348
+ interface BrihadGems {
349
+ stones?: BrihadGemstone[];
350
+ }
351
+ interface BrihadDeepData {
352
+ schema_version?: number;
353
+ avakahada?: BrihadAvakahada | null;
354
+ panchang?: BrihadPanchang | null;
355
+ gems?: BrihadGems | null;
356
+ ghata_chakra?: BrihadGhata | null;
357
+ chalit?: BrihadChalit | null;
358
+ kp?: BrihadKP | null;
359
+ jaimini?: BrihadJaimini | null;
360
+ ishta_devata?: BrihadIshtaDevata | null;
361
+ maitri?: BrihadMaitri | null;
362
+ avasthas?: BrihadAvastha[];
363
+ lal_kitab?: BrihadLalKitab | null;
364
+ shadbala?: BrihadShadbalaRow[];
365
+ bhava_bala?: BrihadBhavaBalaRow[];
366
+ ashtakavarga?: BrihadAshtakavarga | null;
367
+ varshaphal?: BrihadVarshaphalYear[];
368
+ mudda_timeline?: BrihadMuddaTimeline | null;
369
+ rajyoga_power?: BrihadRajyogaPower | null;
370
+ narrative_chapters?: BrihadNarrativeChapter[];
371
+ }
372
+
373
+ /**
374
+ * Brihad Kundli (comprehensive premium kundli) report → HTML.
375
+ *
376
+ * Ported verbatim (design + i18n) from the server-side Go template at
377
+ * `internal/pdf/brihad_kundli.go`. Consumes the JSON exactly as returned by
378
+ * `GET /v1/reports/kundli/brihad` and emits a self-contained HTML document
379
+ * ready to convert to PDF.
380
+ *
381
+ * This is the flagship report. The Go template renders 10 sections (each
382
+ * guarded so absent data collapses to nothing):
383
+ * Cover, Birth Chart Summary (ascendant + planet table), Planetary Analysis,
384
+ * House Analysis, Yogas, Vimshottari Dasha, Remedies, Divisional Charts,
385
+ * Doshas, Predictions by Life Area, Classical Citations.
386
+ */
387
+
388
+ /** A sign + degree pair (ascendant and every natal planet). snake_case keys. */
389
+ interface BrihadPlacement {
390
+ sign?: string;
391
+ dms_within?: string;
392
+ nakshatra?: string;
393
+ pada?: number;
394
+ nak_lord?: string;
395
+ }
396
+ /** One natal planet row. */
397
+ interface BrihadPlanet {
398
+ name?: string;
399
+ name_en?: string;
400
+ placement?: BrihadPlacement;
401
+ house_num?: number;
402
+ retro?: boolean;
403
+ }
404
+ /** Cover metadata. */
405
+ interface BrihadSubject {
406
+ Name?: string;
407
+ BirthDate?: string;
408
+ BirthTime?: string;
409
+ BirthPlace?: string;
410
+ Lat?: number;
411
+ Lon?: number;
412
+ }
413
+ /** One house's narrative + meta (PascalCase — no json tags in Go). */
414
+ interface BrihadHouseSection {
415
+ HouseNum?: number;
416
+ LordEN?: string;
417
+ LordHI?: string;
418
+ LordSign?: string;
419
+ Body?: string;
420
+ }
421
+ /** One detected yoga (PascalCase). */
422
+ interface BrihadYoga {
423
+ NameEN?: string;
424
+ NameHI?: string;
425
+ Effect?: string;
426
+ Source?: string;
427
+ }
428
+ /** One Vimshottari Mahadasha period (PascalCase). */
429
+ interface BrihadDashaPeriod {
430
+ Lord?: string;
431
+ LordHI?: string;
432
+ StartDate?: string;
433
+ EndDate?: string;
434
+ DurationY?: number;
435
+ Body?: string;
436
+ }
437
+ /** One inline remedy (PascalCase). */
438
+ interface BrihadRemedy {
439
+ Title?: string;
440
+ Description?: string;
441
+ Category?: string;
442
+ }
443
+ /** One planet's placement in a divisional chart (snake_case via json tags). */
444
+ interface BrihadDivisionalPlanet {
445
+ name?: string;
446
+ sign?: string;
447
+ house?: number;
448
+ }
449
+ /** One varga chart's render data (snake_case via json tags). */
450
+ interface BrihadDivisional {
451
+ varga?: string;
452
+ name?: string;
453
+ subtitle?: string;
454
+ lagna_sign?: string;
455
+ planets?: BrihadDivisionalPlanet[];
456
+ }
457
+ /** One dosha's render data (PascalCase). */
458
+ interface BrihadDoshaEntry {
459
+ NameEN?: string;
460
+ NameHI?: string;
461
+ Severity?: string;
462
+ Body?: string;
463
+ Source?: string;
464
+ }
465
+ /** The composite dosha block (PascalCase). Each subfield nil → absent. */
466
+ interface BrihadDoshas {
467
+ Mangal?: BrihadDoshaEntry | null;
468
+ KaalSarp?: BrihadDoshaEntry | null;
469
+ Pitra?: BrihadDoshaEntry | null;
470
+ }
471
+ /** One life-area forecast (PascalCase). */
472
+ interface BrihadPrediction {
473
+ Area?: string;
474
+ Body?: string;
475
+ }
476
+ /** One classical-text reference (PascalCase). */
477
+ interface BrihadCitation {
478
+ Topic?: string;
479
+ Source?: string;
480
+ Note?: string;
481
+ }
482
+ /** The full Brihad Kundli report payload. */
483
+ interface KundliBrihadData extends BrihadDeepData {
484
+ Locale?: string;
485
+ Branding?: RawBranding;
486
+ Subject?: BrihadSubject;
487
+ Ascendant?: BrihadPlacement;
488
+ Planets?: BrihadPlanet[];
489
+ Houses?: BrihadHouseSection[];
490
+ Yogas?: BrihadYoga[];
491
+ CurrentDasha?: BrihadDashaPeriod | null;
492
+ UpcomingDashas?: BrihadDashaPeriod[];
493
+ Remedies?: BrihadRemedy[];
494
+ DivisionalCharts?: BrihadDivisional[];
495
+ Doshas?: BrihadDoshas | null;
496
+ Predictions?: BrihadPrediction[];
497
+ Citations?: BrihadCitation[];
498
+ GeneratedAt?: string;
499
+ }
500
+ declare function renderKundliBrihadHtml(data: KundliBrihadData, branding?: Branding): string;
501
+
502
+ /**
503
+ * Detailed Kundli report → HTML.
504
+ *
505
+ * Ported from the server-side Go template `internal/pdf/kundli.go` so the
506
+ * SDK-rendered PDF is visually faithful to the API's own report. Consumes the
507
+ * JSON returned by `client.reports.kundliDetailed(...)` verbatim (PascalCase
508
+ * top-level keys; snake_case inside placement/panchang — see interfaces below)
509
+ * and returns a self-contained HTML document ready for `htmlToPdf`.
510
+ *
511
+ * The Go template's i18n helpers (signLabel/nakLabel/planetLabel/tithiLabel…)
512
+ * just echo the already-locale-resolved field straight back, so here we read
513
+ * the field directly — no client-side translation is performed.
514
+ */
515
+
516
+ /** A sign + degree pair (snake_case keys, as in the API JSON). */
517
+ interface KundliPlacement {
518
+ sign?: string;
519
+ dms_within?: string;
520
+ nakshatra?: string;
521
+ pada?: number;
522
+ nak_lord?: string;
523
+ }
524
+ /** One planet row in the positions table. */
525
+ interface KundliPlanet {
526
+ name?: string;
527
+ placement?: KundliPlacement;
528
+ house_num?: number;
529
+ retro?: boolean;
530
+ }
531
+ /** Tithi / nakshatra / yoga / karana at the moment of birth. */
532
+ interface KundliPanchang {
533
+ tithi?: string;
534
+ nakshatra?: string;
535
+ yoga?: string;
536
+ karana?: string;
537
+ }
538
+ /** The birth subject metadata printed on the cover. */
539
+ interface KundliSubject {
540
+ Name?: string;
541
+ BirthDate?: string;
542
+ BirthTime?: string;
543
+ BirthPlace?: string;
544
+ Lat?: number;
545
+ Lon?: number;
546
+ }
547
+ /** Branding embedded in the report JSON (PascalCase). */
548
+ interface KundliBranding {
549
+ CompanyName?: string;
550
+ LogoURL?: string;
551
+ PrimaryColor?: string;
552
+ SecondaryColor?: string;
553
+ FooterText?: string;
554
+ WatermarkText?: string;
555
+ }
556
+ /** Full Detailed Kundli payload (exactly as returned by the API). */
557
+ interface KundliDetailedData {
558
+ Locale?: string;
559
+ Branding?: KundliBranding;
560
+ Subject?: KundliSubject;
561
+ Ascendant?: KundliPlacement;
562
+ Planets?: KundliPlanet[];
563
+ Panchang?: KundliPanchang;
564
+ GeneratedAt?: string;
565
+ Narratives?: NarrativeSection[];
566
+ CurrentDasha?: BrihadDashaPeriod;
567
+ UpcomingDashas?: BrihadDashaPeriod[];
568
+ Houses?: BrihadHouseSection[];
569
+ Yogas?: BrihadYoga[];
570
+ Doshas?: BrihadDoshas | null;
571
+ }
572
+ /**
573
+ * Render the Detailed Kundli report as a complete HTML document.
574
+ *
575
+ * @param data report JSON from `client.reports.kundliDetailed(...)`
576
+ * @param branding optional caller branding overrides (win per-field over the
577
+ * branding embedded in `data`)
578
+ */
579
+ declare function renderKundliDetailedHtml(data: KundliDetailedData, branding?: Branding): string;
580
+
581
+ /**
582
+ * Match Making (Kundli Milan) report → HTML.
583
+ *
584
+ * Ported from the server-side Go template `internal/pdf/matchmaking.go` so the
585
+ * SDK-rendered PDF is visually faithful to the API's own report. Consumes the
586
+ * JSON returned by `client.reports.matchMaking(...)` verbatim (PascalCase
587
+ * top-level keys; snake_case inside the boy/girl subjects — see interfaces
588
+ * below) and returns a self-contained HTML document ready for `htmlToPdf`.
589
+ *
590
+ * The Go template's i18n helpers (matchNakLabel/kootaLabel/…) just echo the
591
+ * already-locale-resolved field straight back, so here we read the field
592
+ * directly — no client-side translation is performed. The koota `name` and
593
+ * subject `nakshatra` arrive pre-localized from the API.
594
+ *
595
+ * The verdict-description and dosha/nadi summary prose is hard-coded per
596
+ * locale in the Go template (conventional Ashtakoota wording, no rule corpus);
597
+ * it is ported here verbatim, including the Computed=false honesty guard so a
598
+ * Mangal Dosha check that never ran is never rendered as "no dosha".
599
+ */
600
+
601
+ /**
602
+ * Per-person header info (name, birth, moon nakshatra). Keys are snake_case as
603
+ * tagged in the Go `MatchMakingSubject` struct. `nakshatra`/`sign` arrive
604
+ * pre-resolved to the request locale.
605
+ */
606
+ interface MatchMakingSubject {
607
+ name?: string;
608
+ birth_date?: string;
609
+ birth_time?: string;
610
+ birth_place?: string;
611
+ nakshatra?: string;
612
+ sign?: string;
613
+ gana?: string;
614
+ nadi?: string;
615
+ }
616
+ /**
617
+ * One of the 8 kootas with score + max + reason. `name` and `score` are tagged
618
+ * (lowercase) in Go; `Max` and `Reason` have no tag → PascalCase. `Reason` is
619
+ * the human-readable explanation, pre-resolved to the requested locale.
620
+ */
621
+ interface MatchMakingKoota {
622
+ name?: string;
623
+ score?: number;
624
+ Max?: number;
625
+ Reason?: string;
626
+ }
627
+ /** The full 8-koota table + total. All fields untagged → PascalCase. */
628
+ interface MatchMakingAshtakoota {
629
+ Total?: number;
630
+ /** Maximum possible total (36). */
631
+ Max?: number;
632
+ /** Ordered: varna, vashya, tara, yoni, graha_maitri, gana, bhakoot, nadi. */
633
+ Kootas?: MatchMakingKoota[];
634
+ /** "poor" | "fair" | "good" | "excellent". */
635
+ Verdict?: string;
636
+ }
637
+ /**
638
+ * One Mangal Dosha result for a single person. All fields untagged →
639
+ * PascalCase. When `Computed` is false the check never ran (no birth
640
+ * lat/lon) — every other field is a zero value and MUST NOT be read as a
641
+ * "no dosha" verdict.
642
+ */
643
+ interface MatchMakingDosha {
644
+ Computed?: boolean;
645
+ NotComputedReason?: string;
646
+ HasDosha?: boolean;
647
+ /** "purn" | "mild" | "none". */
648
+ Type?: string;
649
+ HousesOccupied?: number[];
650
+ Cancelled?: boolean;
651
+ CancelReasons?: string[];
652
+ }
653
+ /** The Nadi Dosha verdict between the pair. All fields untagged → PascalCase. */
654
+ interface MatchMakingNadiDosha {
655
+ HasDosha?: boolean;
656
+ BoyNadi?: string;
657
+ GirlNadi?: string;
658
+ /** "none" | "high" | "exempted". */
659
+ Severity?: string;
660
+ Exceptions?: string[];
661
+ }
662
+ /** Branding embedded in the report JSON (PascalCase). */
663
+ interface MatchMakingBranding {
664
+ CompanyName?: string;
665
+ LogoURL?: string;
666
+ PrimaryColor?: string;
667
+ SecondaryColor?: string;
668
+ FooterText?: string;
669
+ WatermarkText?: string;
670
+ }
671
+ /** Full Match Making payload (exactly as returned by the API). */
672
+ interface MatchMakingData {
673
+ Locale?: string;
674
+ Branding?: MatchMakingBranding;
675
+ Boy?: MatchMakingSubject;
676
+ Girl?: MatchMakingSubject;
677
+ Ashtakoota?: MatchMakingAshtakoota;
678
+ MangalDoshaBoy?: MatchMakingDosha;
679
+ MangalDoshaGirl?: MatchMakingDosha;
680
+ NadiDosha?: MatchMakingNadiDosha;
681
+ GeneratedAt?: string;
682
+ /** Short summary string; falls back to a derived line from the total. */
683
+ FinalVerdict?: string;
684
+ }
685
+ /**
686
+ * Render the Match Making (Kundli Milan) report as a complete HTML document.
687
+ *
688
+ * @param data report JSON from `client.reports.matchMaking(...)`
689
+ * @param branding optional caller branding overrides (win per-field over the
690
+ * branding embedded in `data`)
691
+ */
692
+ declare function renderMatchMakingHtml(data: MatchMakingData, branding?: Branding): string;
693
+
694
+ /**
695
+ * Dasha Analysis report → HTML.
696
+ *
697
+ * Ported from the server-side Go template `internal/pdf/dasha_analysis.go`
698
+ * (the 20-page Vimshottari deep-dive). Section render order mirrors the Go
699
+ * template exactly:
700
+ * 1. Cover
701
+ * 2. Currently Active Dasha Stack (5-level MD/AD/PD/SD/Prana)
702
+ * 3. Predictions for the active sub-periods (MD + AD prose) — suppressed
703
+ * entirely when there is no active path
704
+ * 4. All 9 Mahadashas (120-year cycle)
705
+ * 5. Past 20-Year Review
706
+ * 6. Next 10-Year Preview
707
+ * 7. Yogini Dasha (optional secondary system; suppressed when empty)
708
+ *
709
+ * Consumes the JSON exactly as returned by `client.reports.dashaAnalysis`.
710
+ */
711
+
712
+ /**
713
+ * One dasha period at any depth (Mahadasha, Antardasha, or Yogini period).
714
+ * Mirrors the Go `DashaPeriodView` struct — all keys PascalCase (no json tags).
715
+ */
716
+ interface DashaPeriodView {
717
+ /** Canonical English lord name, e.g. "Saturn". */
718
+ Lord?: string;
719
+ /** Devanagari lord name, e.g. "शनि" (used for hi/mr). */
720
+ LordHI?: string;
721
+ /** Pre-formatted start date "YYYY-MM-DD". */
722
+ StartDate?: string;
723
+ /** Pre-formatted end date "YYYY-MM-DD". */
724
+ EndDate?: string;
725
+ /** Rounded year count; 0 for sub-year periods. */
726
+ DurationY?: number;
727
+ /** Exact day count for sub-year reporting. */
728
+ DurationD?: number;
729
+ /** Optional locale-resolved one-line note. */
730
+ Body?: string;
731
+ }
732
+ /**
733
+ * The active 5-level Vimshottari stack at the report's "now".
734
+ * Mirrors the Go `DashaActivePath` struct.
735
+ */
736
+ interface DashaActivePath {
737
+ Maha?: DashaPeriodView;
738
+ Antar?: DashaPeriodView;
739
+ Pratyantar?: DashaPeriodView;
740
+ Sookshma?: DashaPeriodView;
741
+ Prana?: DashaPeriodView;
742
+ /** Longer-form prose summary for the Mahadasha level. */
743
+ MahaBody?: string;
744
+ /** Longer-form prose summary for the Antardasha level. */
745
+ AntarBody?: string;
746
+ }
747
+ /** Subject block (shared `KundliSubject` shape, PascalCase). */
748
+ interface DashaAnalysisSubject {
749
+ Name?: string;
750
+ BirthDate?: string;
751
+ BirthTime?: string;
752
+ BirthPlace?: string;
753
+ Lat?: number;
754
+ Lon?: number;
755
+ }
756
+ /** The Dasha Analysis report JSON (`data` from the API), PascalCase keys. */
757
+ interface DashaAnalysisData {
758
+ Locale?: string;
759
+ Branding?: RawBranding;
760
+ Subject?: DashaAnalysisSubject;
761
+ /** Currently-running 5-level Vimshottari stack. May be absent/null. */
762
+ ActivePath?: DashaActivePath | null;
763
+ /** All 9 Vimshottari Mahadashas, chronological. */
764
+ AllMahadashas?: DashaPeriodView[];
765
+ /** Mahadashas overlapping the last 20 years. */
766
+ PastReview?: DashaPeriodView[];
767
+ /** Antardashas overlapping the next 10 years. */
768
+ FuturePreview?: DashaPeriodView[];
769
+ /** Optional Yogini-system periods. */
770
+ YoginiDashas?: DashaPeriodView[];
771
+ /** ISO timestamp; pre-formatted on the server. */
772
+ GeneratedAt?: string;
773
+ }
774
+ declare function renderDashaAnalysisHtml(data: DashaAnalysisData, branding?: Branding): string;
775
+
776
+ /**
777
+ * Numerology Report → HTML.
778
+ *
779
+ * Ported from the server-side Go template `internal/pdf/numerology.go` so the
780
+ * SDK-rendered PDF matches the API's design. Consumes the JSON returned by
781
+ * `client.reports.numerology(...)`.
782
+ *
783
+ * The captured response (`/v1/reports/numerology`) returns the compute subset
784
+ * with snake_case keys: `dob`, `driver`, `conductor`, `driver_factors`,
785
+ * `conductor_factors`, `compatible_drivers`. The full PDF struct additionally
786
+ * carries soul/personality/destiny (+ their factors), subject name, branding,
787
+ * locale and generated timestamp — modelled here optionally so a richer
788
+ * payload renders the same way the Go template does.
789
+ *
790
+ * JSON key casing rule applied per field:
791
+ * - factor sub-fields have explicit json tags → snake/lowercase (number,
792
+ * planet, day, color, gemstone, deity, direction)
793
+ * - top-level compute keys are tagged → dob, driver, conductor,
794
+ * driver_factors, conductor_factors, compatible_drivers
795
+ * - PDF-only fields (Subject, Branding, Locale, GeneratedAt) have NO json
796
+ * tag in Go → PascalCase
797
+ */
798
+
799
+ /** Lucky-factor block for a single number (factor sub-fields are json-tagged). */
800
+ interface NumerologyFactors {
801
+ number?: number;
802
+ planet?: string;
803
+ day?: string;
804
+ color?: string;
805
+ gemstone?: string;
806
+ deity?: string;
807
+ direction?: string;
808
+ }
809
+ /** Cover-page subject header (Go `NumerologySubject`, no json tags → PascalCase). */
810
+ interface NumerologySubject {
811
+ Name?: string;
812
+ DOB?: string;
813
+ }
814
+ /** Numerology report payload (exact JSON keys; optional generous). */
815
+ interface NumerologyData {
816
+ dob?: string;
817
+ driver?: number;
818
+ conductor?: number;
819
+ soul?: number;
820
+ personality?: number;
821
+ destiny?: number;
822
+ driver_factors?: NumerologyFactors;
823
+ conductor_factors?: NumerologyFactors;
824
+ soul_factors?: NumerologyFactors;
825
+ personality_factors?: NumerologyFactors;
826
+ destiny_factors?: NumerologyFactors;
827
+ compatible_drivers?: number[];
828
+ Locale?: string;
829
+ Branding?: RawBranding;
830
+ Subject?: NumerologySubject;
831
+ GeneratedAt?: string;
832
+ }
833
+ declare function renderNumerologyHtml(data: NumerologyData, branding?: Branding): string;
834
+
835
+ /**
836
+ * Sade Sati report → HTML.
837
+ *
838
+ * Ported from the server-side Go template `internal/pdf/sadesati.go`. Renders a
839
+ * single-subject report focused on Saturn's ~7.5-year transit through the
840
+ * moon-1 / moon / moon+1 sign cluster of the native's chart.
841
+ *
842
+ * Layout (mirrors the Go template):
843
+ * 1. Cover with subject + moon-sign badge + current status.
844
+ * 2. Current phase explanation block (color-coded by status).
845
+ * 3. Past windows table (chronological).
846
+ * 4. Current window highlight (when active).
847
+ * 5. Future windows table (chronological).
848
+ * 6. Remedies summary block.
849
+ *
850
+ * The Go i18n helpers (`label`, `statusLabel`, `durationLabel`,
851
+ * `statusDescription`, `remediesList`) and the `moon_sign`/`saturn_sign`
852
+ * fields are already locale-resolved by the API handler, so the strings are
853
+ * rendered verbatim — we only re-implement the locale-keyed label/prose tables.
854
+ */
855
+
856
+ /**
857
+ * Cover-page header info. `MoonSign` is pre-resolved to the request locale by
858
+ * the handler. JSON keys are lowercase (the Go struct carries `json:` tags).
859
+ */
860
+ interface SadeSatiSubject {
861
+ name?: string;
862
+ birth_date?: string;
863
+ birth_time?: string;
864
+ birth_place?: string;
865
+ moon_sign?: string;
866
+ }
867
+ /**
868
+ * The current at-the-moment reading. `status` is one of
869
+ * `"rising" | "peak" | "setting" | "clear"`. `saturn_sign` / `moon_sign` are
870
+ * pre-resolved to the request locale. JSON keys are lowercase (`json:` tags).
871
+ */
872
+ interface SadeSatiStatus {
873
+ status?: string;
874
+ saturn_sign?: string;
875
+ moon_sign?: string;
876
+ }
877
+ /**
878
+ * One continuous Sade Sati period (Saturn passing through one or more affected
879
+ * signs). The `SadeSatiWindow` Go struct has NO `json:` tags, so every key is
880
+ * PascalCase. Date strings are pre-formatted by the handler.
881
+ */
882
+ interface SadeSatiWindow {
883
+ StartDate?: string;
884
+ EndDate?: string;
885
+ StartPhase?: string;
886
+ EndPhase?: string;
887
+ /** Localized sign labels Saturn passed through (typically the 3-sign cluster). */
888
+ SignsTraversed?: string[];
889
+ /** "approx 7.5" for full windows, less for retrograde-truncated edges. */
890
+ DurationYears?: number;
891
+ }
892
+ /**
893
+ * Full Sade Sati report payload. Top-level `SadeSatiReportData` Go struct has
894
+ * NO `json:` tags, so its fields are PascalCase. `Past` may be `null`, and
895
+ * `Current` is `null` when no window brackets the report moment.
896
+ */
897
+ interface SadeSatiData {
898
+ Locale?: string;
899
+ Branding?: RawBranding;
900
+ Subject?: SadeSatiSubject;
901
+ CurrentStatus?: SadeSatiStatus;
902
+ Past?: SadeSatiWindow[] | null;
903
+ Current?: SadeSatiWindow | null;
904
+ Future?: SadeSatiWindow[] | null;
905
+ GeneratedAt?: string;
906
+ }
907
+ declare function renderSadeSatiHtml(data: SadeSatiData, branding?: Branding): string;
908
+
909
+ /**
910
+ * Varshaphal (annual / solar-return) report → HTML.
911
+ *
912
+ * Ported from the server-side Go template `internal/pdf/varshaphal.go` so the
913
+ * SDK-rendered PDF is visually faithful to the API's own report. Consumes the
914
+ * JSON returned by `client.reports.varshaphal(...)` verbatim (PascalCase
915
+ * top-level keys; snake_case inside placement/muntha/varsha-lord — see
916
+ * interfaces below) and returns a self-contained HTML document ready for
917
+ * `htmlToPdf`.
918
+ *
919
+ * The Go template's i18n helpers (signLabel/nakLabel/planetLabel/
920
+ * munthaSignLabel/varshaLordLabel) just echo the already-locale-resolved field
921
+ * straight back, so here we read the field directly — no client-side
922
+ * translation is performed.
923
+ *
924
+ * The one exception is the Year Outlook prose: the Go template derives it
925
+ * client-side (`varshaOutlook`) from the muntha house + target year rather than
926
+ * from a JSON field, so the same band-based logic is ported below.
927
+ */
928
+
929
+ /** A sign + degree pair (snake_case keys, as in the API JSON). */
930
+ interface VarshaphalPlacement {
931
+ sign?: string;
932
+ dms_within?: string;
933
+ nakshatra?: string;
934
+ pada?: number;
935
+ nak_lord?: string;
936
+ }
937
+ /** One planet row in the solar-return positions table. */
938
+ interface VarshaphalPlanet {
939
+ name?: string;
940
+ placement?: VarshaphalPlacement;
941
+ house_num?: number;
942
+ retro?: boolean;
943
+ }
944
+ /** The birth subject metadata printed on the cover (PascalCase, no json tags). */
945
+ interface VarshaphalSubject {
946
+ Name?: string;
947
+ BirthDate?: string;
948
+ BirthTime?: string;
949
+ BirthPlace?: string;
950
+ }
951
+ /** Muntha — the progressed ascendant for the year (json-tagged → snake/lower). */
952
+ interface VarshaphalMuntha {
953
+ sign?: string;
954
+ house?: number;
955
+ }
956
+ /** Varsha lord — the planet ruling the year's first hora (json-tagged). */
957
+ interface VarshaphalLord {
958
+ name?: string;
959
+ hora?: number;
960
+ }
961
+ /** Branding embedded in the report JSON (PascalCase). */
962
+ interface VarshaphalBranding {
963
+ CompanyName?: string;
964
+ LogoURL?: string;
965
+ PrimaryColor?: string;
966
+ SecondaryColor?: string;
967
+ FooterText?: string;
968
+ WatermarkText?: string;
969
+ }
970
+ /** Full Varshaphal payload (exactly as returned by the API). */
971
+ interface VarshaphalData {
972
+ Locale?: string;
973
+ Branding?: VarshaphalBranding;
974
+ Subject?: VarshaphalSubject;
975
+ TargetYear?: number;
976
+ /** Solar-return moment, ISO-8601, handler-formatted (e.g. "2026-06-14T21:53:59Z"). */
977
+ SolarReturnISO?: string;
978
+ Ascendant?: VarshaphalPlacement;
979
+ Planets?: VarshaphalPlanet[];
980
+ Muntha?: VarshaphalMuntha;
981
+ VarshaLord?: VarshaphalLord;
982
+ GeneratedAt?: string;
983
+ }
984
+ /**
985
+ * Render the Varshaphal (annual / solar-return) report as a complete HTML
986
+ * document.
987
+ *
988
+ * @param data report JSON from `client.reports.varshaphal(...)`
989
+ * @param branding optional caller branding overrides (win per-field over the
990
+ * branding embedded in `data`)
991
+ */
992
+ declare function renderVarshaphalHtml(data: VarshaphalData, branding?: Branding): string;
993
+
994
+ /**
995
+ * Horoscope report (daily / weekly / monthly) → branded HTML.
996
+ *
997
+ * Ported to consume the exact shape `client.reports.horoscope{Daily,Weekly,Monthly}()`
998
+ * returns — the raw `horoscope.Entry` (snake_case), same wire shape as
999
+ * `/v1/horoscope/*`. Note: the Entry carries NO branding, so branding here
1000
+ * comes entirely from the caller-supplied `branding` argument.
1001
+ */
1002
+
1003
+ interface HoroscopeSlowMover {
1004
+ planet?: string;
1005
+ current_sign?: string;
1006
+ heading?: string;
1007
+ body?: string;
1008
+ citations?: string[];
1009
+ }
1010
+ interface HoroscopePanchang {
1011
+ tithi?: string;
1012
+ paksha?: string;
1013
+ nakshatra?: string;
1014
+ yoga?: string;
1015
+ karana?: string;
1016
+ vaar?: string;
1017
+ rahu_kaal?: string;
1018
+ auspicious_window?: string;
1019
+ sunrise?: string;
1020
+ sunset?: string;
1021
+ }
1022
+ interface HoroscopeLucky {
1023
+ color?: string;
1024
+ number?: number;
1025
+ direction?: string;
1026
+ time?: string;
1027
+ }
1028
+ /** Matches the `horoscope.Entry` JSON returned by the reports/horoscope endpoints. */
1029
+ interface HoroscopeData {
1030
+ rashi?: string;
1031
+ rashi_label?: string;
1032
+ period?: "daily" | "weekly" | "monthly" | string;
1033
+ period_key?: string;
1034
+ language?: string;
1035
+ headline?: string;
1036
+ slow_movers?: HoroscopeSlowMover[];
1037
+ panchang?: HoroscopePanchang | null;
1038
+ lucky?: HoroscopeLucky | null;
1039
+ meta?: {
1040
+ generated_at?: string;
1041
+ source?: string;
1042
+ };
1043
+ }
1044
+ /** Render a horoscope report (daily/weekly/monthly) to a branded HTML document. */
1045
+ declare function renderHoroscopeHtml(data: HoroscopeData, branding?: Branding): string;
1046
+
1047
+ /**
1048
+ * Mangal Dosha (Manglik) report → HTML.
1049
+ *
1050
+ * Ported from the server-side Go template `internal/pdf/mangal_dosha.go`. A
1051
+ * single-subject diagnostic focused on Mars' placement from the lagna and what
1052
+ * it means for marriage / partnerships. The prose, remedies, and i18n labels are
1053
+ * hard-coded in the Go template (conventional, uniform across consultations), so
1054
+ * they are re-implemented here verbatim — only `Status` / `HasDosha` /
1055
+ * `Cancelled` / `HousesOccupied` / `MarsPlacement` / `Subject` come from the JSON.
1056
+ *
1057
+ * Layout (mirrors the Go template):
1058
+ * 1. Cover with subject + status badge.
1059
+ * 2. Diagnostic block (Mars sign / nakshatra / houses / diagnosis).
1060
+ * 3. Cancellation block (only when classical cancellations apply).
1061
+ * 4. Marriage implications prose.
1062
+ * 5. Recommended remedies (heavier for "purn", lighter for "mild").
1063
+ */
1064
+
1065
+ /**
1066
+ * Cover-page header info. `ascendant_sign` is pre-resolved to the request locale
1067
+ * by the handler. JSON keys are lowercase (the Go struct carries `json:` tags).
1068
+ */
1069
+ interface MangalDoshaSubject {
1070
+ name?: string;
1071
+ birth_date?: string;
1072
+ birth_time?: string;
1073
+ birth_place?: string;
1074
+ ascendant_sign?: string;
1075
+ }
1076
+ /**
1077
+ * Mars' placement (the shared `KundliPlacement` shape — snake_case `json:` tags).
1078
+ * `sign` / `nakshatra` are pre-resolved to the request locale by the handler.
1079
+ */
1080
+ interface MangalDoshaPlacement {
1081
+ sign?: string;
1082
+ dms_within?: string;
1083
+ nakshatra?: string;
1084
+ pada?: number;
1085
+ nak_lord?: string;
1086
+ }
1087
+ /**
1088
+ * Full Mangal Dosha report payload. The top-level `MangalDoshaReportData` Go
1089
+ * struct has NO `json:` tags, so its fields are PascalCase. `Status` is one of
1090
+ * `"purn"` (full) | `"mild"` (partial) | `"none"`.
1091
+ */
1092
+ interface MangalDoshaData {
1093
+ Locale?: string;
1094
+ Branding?: RawBranding;
1095
+ Subject?: MangalDoshaSubject;
1096
+ Status?: string;
1097
+ HasDosha?: boolean;
1098
+ HousesOccupied?: number[];
1099
+ Cancelled?: boolean;
1100
+ CancelReasons?: string[];
1101
+ MarsPlacement?: MangalDoshaPlacement;
1102
+ GeneratedAt?: string;
1103
+ }
1104
+ /**
1105
+ * Render the Mangal Dosha report as a complete, self-contained HTML document
1106
+ * ready to convert to PDF.
1107
+ */
1108
+ declare function renderMangalDoshaHtml(data: MangalDoshaData, branding?: Branding): string;
1109
+
1110
+ /**
1111
+ * Optional HTML → PDF rendering via Puppeteer (headless Chromium).
1112
+ *
1113
+ * Puppeteer is an OPTIONAL peer dependency — the core `lifeastroapi` package
1114
+ * and all `render*Html` functions work with zero dependencies. Install
1115
+ * `puppeteer` (or pass your own via `{ puppeteer }` / a live `{ browser }`)
1116
+ * only if you want this module to produce PDF bytes for you.
1117
+ *
1118
+ * Chromium is the right engine here: it ships Noto fonts so Devanagari /
1119
+ * Tamil / Telugu / Bengali / Gujarati / Kannada render correctly, and it
1120
+ * handles the templates' CSS (gradients, tables, watermark, @page) faithfully.
1121
+ */
1122
+ /** Minimal structural type for a Puppeteer page. */
1123
+ interface PageLike {
1124
+ setContent(html: string, opts?: any): Promise<void>;
1125
+ pdf(opts?: any): Promise<Uint8Array | Buffer>;
1126
+ evaluate(fn: any, ...args: any[]): Promise<any>;
1127
+ close(): Promise<void>;
1128
+ }
1129
+ /** Minimal structural type for a Puppeteer browser. */
1130
+ interface PuppeteerBrowserLike {
1131
+ newPage(): Promise<PageLike>;
1132
+ close(): Promise<void>;
1133
+ }
1134
+ /** Minimal structural type for the puppeteer module. */
1135
+ interface PuppeteerModuleLike {
1136
+ launch(opts?: any): Promise<PuppeteerBrowserLike>;
1137
+ }
1138
+ interface HtmlToPdfOptions {
1139
+ /** Paper size. Default "A4". */
1140
+ format?: "A4" | "A3" | "A5" | "Letter" | "Legal" | "Tabloid";
1141
+ /** Landscape orientation. Default false. */
1142
+ landscape?: boolean;
1143
+ /** Print CSS background colors/images. Default true (templates are branded). */
1144
+ printBackground?: boolean;
1145
+ /** Honour the template's own @page CSS size. Default true. */
1146
+ preferCSSPageSize?: boolean;
1147
+ /** Page margins, e.g. `{ top: "10mm" }`. */
1148
+ margin?: {
1149
+ top?: string;
1150
+ bottom?: string;
1151
+ left?: string;
1152
+ right?: string;
1153
+ };
1154
+ /**
1155
+ * Render a running header/footer in the page margin (outside the content
1156
+ * box, so it can never overlap body content). When true, supply
1157
+ * `headerTemplate` / `footerTemplate` and a `margin` large enough to hold
1158
+ * them. Chromium replaces `<span class="pageNumber|totalPages|title|date|url">`
1159
+ * inside the templates. NOTE: Chromium ignores external CSS in these
1160
+ * templates — use inline styles only.
1161
+ */
1162
+ displayHeaderFooter?: boolean;
1163
+ /** HTML for the running header (inline styles only). */
1164
+ headerTemplate?: string;
1165
+ /** HTML for the running footer (inline styles only). */
1166
+ footerTemplate?: string;
1167
+ /** Render scale (0.1–2). */
1168
+ scale?: number;
1169
+ /** Max time to wait for the page to settle, ms. Default 30000. */
1170
+ timeoutMs?: number;
1171
+ /**
1172
+ * Reuse an already-launched browser (recommended for servers — launching
1173
+ * Chromium per call is slow). When provided, it is NOT closed for you.
1174
+ */
1175
+ browser?: PuppeteerBrowserLike;
1176
+ /** Inject the puppeteer module (e.g. `puppeteer-core` + `@sparticuz/chromium` on serverless). */
1177
+ puppeteer?: PuppeteerModuleLike;
1178
+ /** Options forwarded to `puppeteer.launch()` when this module launches the browser. */
1179
+ launchOptions?: Record<string, unknown>;
1180
+ }
1181
+ declare function htmlToPdf(html: string, opts?: HtmlToPdfOptions): Promise<Uint8Array>;
1182
+
1183
+ /**
1184
+ * Zero-dependency PDF outline (bookmark) injector.
1185
+ *
1186
+ * Chromium's `page.pdf()` / `--print-to-pdf` does NOT emit a document outline
1187
+ * from HTML headings, so the navigable "bookmark sidebar" that professional
1188
+ * reports (a long kundli can carry hundreds of bookmarks) rely on is missing.
1189
+ *
1190
+ * This module appends an `/Outlines` tree to an already-rendered PDF via an
1191
+ * **incremental update** (ISO 32000-1 §7.5.6): we never rewrite the original
1192
+ * bytes — we add new objects, a new cross-reference section, and a new trailer
1193
+ * at the end of the file, then point the document Catalog at the new outline.
1194
+ * That keeps it dependency-free (no pdf-lib / pdfjs) and robust: the original
1195
+ * content, fonts and pages are untouched.
1196
+ *
1197
+ * Limitations (acceptable for our reports):
1198
+ * - Assumes the input is a standard cross-reference *table* PDF (what Chromium
1199
+ * emits), not a cross-reference *stream*. We parse the existing Catalog and
1200
+ * its `/Pages` to map page numbers → page object refs.
1201
+ * - Destinations use `[pageRef /Fit]` (whole-page fit) — the right behaviour
1202
+ * for section bookmarks.
1203
+ */
1204
+ /** One bookmark. `level` is 1-based (1 = top); children follow their parent. */
1205
+ interface OutlineItem {
1206
+ /** Bookmark label (shown in the reader's sidebar). */
1207
+ title: string;
1208
+ /** 1-based PDF page the bookmark jumps to. */
1209
+ page: number;
1210
+ /** 1-based nesting depth (1 = top-level part, 2 = section, …). */
1211
+ level: number;
1212
+ }
1213
+ /**
1214
+ * Append a bookmark outline to a rendered PDF and return the new bytes.
1215
+ *
1216
+ * @param pdf the rendered PDF (from htmlToPdf)
1217
+ * @param items ordered bookmarks; `page` is 1-based, `level` is 1-based depth
1218
+ */
1219
+ declare function addPdfOutline(pdf: Uint8Array, items: OutlineItem[]): Uint8Array;
1220
+
1221
+ /**
1222
+ * `lifeastroapi/pdf` — turn LifeAstroAPI report JSON into branded, print-ready
1223
+ * PDFs (or HTML).
1224
+ *
1225
+ * Two layers:
1226
+ * 1. `render*Html(data, branding?)` — pure, zero-dependency functions that
1227
+ * turn the JSON from `client.reports.*` into a self-contained, branded
1228
+ * HTML document. Run anywhere (Node, edge, browser).
1229
+ * 2. `htmlToPdf(html, opts?)` + the `*Pdf(...)` convenience wrappers —
1230
+ * produce PDF bytes via the optional `puppeteer` peer dependency.
1231
+ *
1232
+ * @example
1233
+ * ```ts
1234
+ * import { LifeAstro } from "lifeastroapi";
1235
+ * import { kundliDetailedPdf } from "lifeastroapi/pdf";
1236
+ *
1237
+ * const client = new LifeAstro({ apiKey: process.env.LIFEASTRO_API_KEY });
1238
+ * const report = await client.reports.kundliDetailed({
1239
+ * date: "1990-01-15", time: "10:30", tz: "Asia/Kolkata", lat: 19.07, lon: 72.87,
1240
+ * });
1241
+ * const pdf = await kundliDetailedPdf(report, {
1242
+ * branding: { companyName: "Acme Astro", logoUrl: "https://…/logo.png", primaryColor: "#6b21a8" },
1243
+ * });
1244
+ * ```
1245
+ */
1246
+
1247
+ /** Options for the one-call `*Pdf` convenience wrappers. */
1248
+ type ReportPdfOptions = HtmlToPdfOptions & {
1249
+ /** Branding overrides (logo, colors, company name, footer, watermark). */
1250
+ branding?: Branding;
1251
+ };
1252
+ /** Detailed Kundli → PDF. */
1253
+ declare const kundliDetailedPdf: (data: Parameters<typeof renderKundliDetailedHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1254
+ /** Lite Kundli → PDF. */
1255
+ declare const kundliLitePdf: (data: Parameters<typeof renderKundliLiteHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1256
+ /** Brihad (comprehensive) Kundli → PDF. Uses a running header (amber page
1257
+ * tab + company) and footer (dotted url) rendered in the page margin so the
1258
+ * chrome never overlaps body content, and a generated विषय-सूची / table of
1259
+ * contents with accurate, color-coded page numbers (resolved via a 2-pass
1260
+ * render). */
1261
+ declare const kundliBrihadPdf: (data: Parameters<typeof renderKundliBrihadHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array>;
1262
+ /** Match-making (Kundli Milan) → PDF. */
1263
+ declare const matchMakingPdf: (data: Parameters<typeof renderMatchMakingHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1264
+ /** Dasha analysis → PDF. */
1265
+ declare const dashaAnalysisPdf: (data: Parameters<typeof renderDashaAnalysisHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1266
+ /** Numerology → PDF. */
1267
+ declare const numerologyPdf: (data: Parameters<typeof renderNumerologyHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1268
+ /** Sade Sati → PDF. */
1269
+ declare const sadeSatiPdf: (data: Parameters<typeof renderSadeSatiHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1270
+ /** Varshaphal (annual) → PDF. */
1271
+ declare const varshaphalPdf: (data: Parameters<typeof renderVarshaphalHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1272
+ /** Horoscope (daily/weekly/monthly) → PDF. */
1273
+ declare const horoscopePdf: (data: Parameters<typeof renderHoroscopeHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1274
+ /** Mangal Dosha (Manglik) → PDF. */
1275
+ declare const mangalDoshaPdf: (data: Parameters<typeof renderMangalDoshaHtml>[0], opts?: ReportPdfOptions) => Promise<Uint8Array<ArrayBufferLike>>;
1276
+
1277
+ export { type Branding, type DashaAnalysisData, type HoroscopeData, type HtmlToPdfOptions, type KundliBrihadData, type KundliDetailedData, type KundliLiteData, type MangalDoshaData, type MatchMakingData, type NumerologyData, type OutlineItem, type PuppeteerBrowserLike, type PuppeteerModuleLike, type RawBranding, type ReportPdfOptions, type ResolvedBranding, type SadeSatiData, type VarshaphalData, addPdfOutline, cleanNarrative, dashaAnalysisPdf, esc, escBody, horoscopePdf, htmlToPdf, humanize, kundliBrihadPdf, kundliDetailedPdf, kundliLitePdf, mangalDoshaPdf, matchMakingPdf, numerologyPdf, renderDashaAnalysisHtml, renderHoroscopeHtml, renderKundliBrihadHtml, renderKundliDetailedHtml, renderKundliLiteHtml, renderMangalDoshaHtml, renderMatchMakingHtml, renderNumerologyHtml, renderSadeSatiHtml, renderVarshaphalHtml, resolveBranding, sadeSatiPdf, varshaphalPdf };