kaabalah 6.16.0 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -6
- package/dist/astrology/index.d.mts +3423 -148
- package/dist/astrology/index.d.ts +3423 -148
- package/dist/astrology/index.js +849 -59
- package/dist/astrology/index.mjs +4 -2
- package/dist/{chunk-MWLSSRHL.mjs → chunk-4BKDSA7L.mjs} +3 -4
- package/dist/chunk-4BKDSA7L.mjs.map +1 -0
- package/dist/chunk-4WVN4RMM.mjs +1139 -0
- package/dist/chunk-4WVN4RMM.mjs.map +1 -0
- package/dist/{chunk-J5Y325TG.mjs → chunk-4ZFY3GBP.mjs} +2210 -3
- package/dist/chunk-4ZFY3GBP.mjs.map +1 -0
- package/dist/{chunk-LQVHJ3VY.mjs → chunk-54QDLBID.mjs} +41 -41
- package/dist/{chunk-LQVHJ3VY.mjs.map → chunk-54QDLBID.mjs.map} +1 -1
- package/dist/{chunk-PBBF5DKC.js → chunk-6SBCBVTZ.js} +21 -21
- package/dist/{chunk-WP5MRAYG.mjs → chunk-COEM6U4V.mjs} +3 -4
- package/dist/chunk-COEM6U4V.mjs.map +1 -0
- package/dist/{chunk-3JMY4U4S.mjs → chunk-DBRPCQRR.mjs} +245 -211
- package/dist/chunk-DBRPCQRR.mjs.map +1 -0
- package/dist/{chunk-WRF3EORB.js → chunk-DCJYTCJZ.js} +16 -17
- package/dist/chunk-DCJYTCJZ.js.map +1 -0
- package/dist/{chunk-UO2RQQZO.mjs → chunk-DK2VS36Z.mjs} +2 -2
- package/dist/{chunk-HEZCZXQC.js → chunk-E353GPHE.js} +16 -16
- package/dist/{chunk-6LZOAU6E.js → chunk-GDJSVV46.js} +272 -241
- package/dist/chunk-GDJSVV46.js.map +1 -0
- package/dist/{chunk-Z3JZ5DZN.mjs → chunk-IZBM4CPN.mjs} +2 -2
- package/dist/chunk-J3WVI5Y3.mjs +16280 -0
- package/dist/chunk-J3WVI5Y3.mjs.map +1 -0
- package/dist/{chunk-7OWGGDRF.js → chunk-JFRVH3TD.js} +2288 -80
- package/dist/chunk-JFRVH3TD.js.map +1 -0
- package/dist/chunk-MZBY6G5S.js +1182 -0
- package/dist/chunk-MZBY6G5S.js.map +1 -0
- package/dist/{chunk-7JWBIAUF.mjs → chunk-NS5AXNEW.mjs} +3 -3
- package/dist/chunk-QU4RKOBD.js +16536 -0
- package/dist/chunk-QU4RKOBD.js.map +1 -0
- package/dist/{chunk-CMXTZKWW.js → chunk-UCNBHGIY.js} +157 -157
- package/dist/{chunk-CMXTZKWW.js.map → chunk-UCNBHGIY.js.map} +1 -1
- package/dist/{chunk-BKFHIKFY.js → chunk-XRSK74V5.js} +179 -180
- package/dist/chunk-XRSK74V5.js.map +1 -0
- package/dist/{chunk-2IC6H3FI.js → chunk-YVLKVB6W.js} +52 -52
- package/dist/cli.js +27609 -11656
- package/dist/cli.js.map +1 -1
- package/dist/core/index.js +56 -57
- package/dist/core/index.mjs +2 -3
- package/dist/core-B3_-9yli.d.mts +279 -0
- package/dist/core-cWIQtely.d.ts +279 -0
- package/dist/gematria/index.js +7 -8
- package/dist/gematria/index.mjs +2 -3
- package/dist/iching/index.d.mts +37 -37
- package/dist/iching/index.d.ts +37 -37
- package/dist/iching/index.js +46 -47
- package/dist/iching/index.mjs +3 -4
- package/dist/index.d.mts +139 -2
- package/dist/index.d.ts +139 -2
- package/dist/index.js +1422 -301
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +190 -10
- package/dist/index.mjs.map +1 -1
- package/dist/numerology/index.d.mts +437 -252
- package/dist/numerology/index.d.ts +437 -252
- package/dist/numerology/index.js +108 -28
- package/dist/numerology/index.mjs +4 -4
- package/dist/schedule-types-DsR1_guG.d.mts +200 -0
- package/dist/schedule-types-DsR1_guG.d.ts +200 -0
- package/dist/semantic/index.d.mts +10 -9
- package/dist/semantic/index.d.ts +10 -9
- package/dist/semantic/index.js +41 -41
- package/dist/semantic/index.mjs +8 -8
- package/dist/swisseph.node-734BKSOZ.js +10 -0
- package/dist/swisseph.node-734BKSOZ.js.map +1 -0
- package/dist/swisseph.node-TDPYTBSS.mjs +8 -0
- package/dist/swisseph.node-TDPYTBSS.mjs.map +1 -0
- package/dist/tarot/index.js +30 -31
- package/dist/tarot/index.mjs +3 -4
- package/dist/visual/index.d.mts +1 -0
- package/dist/visual/index.d.ts +1 -0
- package/dist/visual/index.js +46 -47
- package/dist/visual/index.mjs +3 -4
- package/dist/wasm/build/swisseph.node-734BKSOZ.js +10 -0
- package/dist/wasm/build/swisseph.node-734BKSOZ.js.map +1 -0
- package/dist/wasm/build/swisseph.node-TDPYTBSS.mjs +8 -0
- package/dist/wasm/build/swisseph.node-TDPYTBSS.mjs.map +1 -0
- package/package.json +4 -2
- package/dist/chunk-3JMY4U4S.mjs.map +0 -1
- package/dist/chunk-3QN5V3DP.js +0 -4737
- package/dist/chunk-3QN5V3DP.js.map +0 -1
- package/dist/chunk-6LZOAU6E.js.map +0 -1
- package/dist/chunk-7OWGGDRF.js.map +0 -1
- package/dist/chunk-BKFHIKFY.js.map +0 -1
- package/dist/chunk-IT7GZ337.mjs +0 -4679
- package/dist/chunk-IT7GZ337.mjs.map +0 -1
- package/dist/chunk-J5Y325TG.mjs.map +0 -1
- package/dist/chunk-JY4QC6FR.js +0 -2214
- package/dist/chunk-JY4QC6FR.js.map +0 -1
- package/dist/chunk-MWLSSRHL.mjs.map +0 -1
- package/dist/chunk-RUE6NTVT.mjs +0 -2211
- package/dist/chunk-RUE6NTVT.mjs.map +0 -1
- package/dist/chunk-WP5MRAYG.mjs.map +0 -1
- package/dist/chunk-WRF3EORB.js.map +0 -1
- package/dist/swisseph.node-53QCJWTI.mjs +0 -3471
- package/dist/swisseph.node-53QCJWTI.mjs.map +0 -1
- package/dist/swisseph.node-CGBZTQ5N.js +0 -3473
- package/dist/swisseph.node-CGBZTQ5N.js.map +0 -1
- package/dist/swisseph.node-GPVFDOB6.wasm +0 -0
- package/dist/wasm/build/swisseph.node-53QCJWTI.mjs +0 -3471
- package/dist/wasm/build/swisseph.node-53QCJWTI.mjs.map +0 -1
- package/dist/wasm/build/swisseph.node-CGBZTQ5N.js +0 -3473
- package/dist/wasm/build/swisseph.node-CGBZTQ5N.js.map +0 -1
- package/dist/wasm/build/swisseph.node-GPVFDOB6.wasm +0 -0
- /package/dist/{chunk-PBBF5DKC.js.map → chunk-6SBCBVTZ.js.map} +0 -0
- /package/dist/{chunk-2IC6H3FI.js.map → chunk-DK2VS36Z.mjs.map} +0 -0
- /package/dist/{chunk-7JWBIAUF.mjs.map → chunk-E353GPHE.js.map} +0 -0
- /package/dist/{chunk-Z3JZ5DZN.mjs.map → chunk-IZBM4CPN.mjs.map} +0 -0
- /package/dist/{chunk-HEZCZXQC.js.map → chunk-NS5AXNEW.mjs.map} +0 -0
- /package/dist/{chunk-UO2RQQZO.mjs.map → chunk-YVLKVB6W.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/civil-date.ts","../src/numerology/schedule-types.ts","../src/numerology/core.ts","../src/numerology/life-stages.ts","../src/numerology/schedule.ts"],"names":["reduced"],"mappings":";;;;;AAkBO,IAAM,iBAAiB;AACvB,IAAM,iBAAiB;AAEvB,SAAS,WAAW,MAAuB;AAChD,SAAQ,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAM,OAAO,QAAQ;AAChE;AAEO,SAAS,YAAY,MAAc,OAAuB;AAC/D,MAAI,UAAU;AAAG,WAAO,WAAW,IAAI,IAAI,KAAK;AAChD,SAAO,UAAU,KAAK,UAAU,KAAK,UAAU,KAAK,UAAU,KAAK,KAAK;AAC1E;AAEO,SAAS,iBAAiB,OAAoC;AACnE,MAAI,UAAU,QAAQ,OAAO,UAAU;AAAU,WAAO;AACxD,QAAM,EAAE,MAAM,OAAO,IAAI,IAAI;AAC7B,SACE,OAAO,UAAU,IAAI,KACrB,OAAO,UAAU,KAAK,KACtB,OAAO,UAAU,GAAG,KACnB,QAAmB,kBACnB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Date is a calendar day, not an instant. All arithmetic here is pure\n * integer arithmetic on day ordinals, so it cannot drift across DST changes\n * or depend on the host timezone. Legacy `Date` APIs are bridged with\n * `civilDateFromLocalDate` / `civilDateToLocalNoon` (local-noon convention).\n */\n\nexport interface CivilDate {\n /** Full Gregorian year, 1–9999. */\n year: number;\n /** Month 1–12. */\n month: number;\n /** Day of month 1–31, valid for the month. */\n day: number;\n}\n\nexport const MIN_CIVIL_YEAR = 1;\nexport const MAX_CIVIL_YEAR = 9999;\n\nexport function isLeapYear(year: number): boolean {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\nexport function daysInMonth(year: number, month: number): number {\n if (month === 2) return isLeapYear(year) ? 29 : 28;\n return month === 4 || month === 6 || month === 9 || month === 11 ? 30 : 31;\n}\n\nexport function isValidCivilDate(value: unknown): value is CivilDate {\n if (value === null || typeof value !== \"object\") return false;\n const { year, month, day } = value as Partial<CivilDate>;\n return (\n Number.isInteger(year) &&\n Number.isInteger(month) &&\n Number.isInteger(day) &&\n (year as number) >= MIN_CIVIL_YEAR &&\n (year as number) <= MAX_CIVIL_YEAR &&\n (month as number) >= 1 &&\n (month as number) <= 12 &&\n (day as number) >= 1 &&\n (day as number) <= daysInMonth(year as number, month as number)\n );\n}\n\nexport function civilDate(year: number, month: number, day: number): CivilDate {\n const value = { year, month, day };\n if (!isValidCivilDate(value)) {\n throw new RangeError(`Invalid civil date: ${year}-${month}-${day}`);\n }\n return value;\n}\n\n/** Strict `YYYY-MM-DD` parser. Returns null for malformed or impossible dates. */\nexport function parseCivilDate(text: string): CivilDate | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(text);\n if (!match) return null;\n const value = {\n year: Number.parseInt(match[1], 10),\n month: Number.parseInt(match[2], 10),\n day: Number.parseInt(match[3], 10)\n };\n return isValidCivilDate(value) ? value : null;\n}\n\nexport function formatCivilDate(date: CivilDate): string {\n const pad = (n: number, width: number) => String(n).padStart(width, \"0\");\n return `${pad(date.year, 4)}-${pad(date.month, 2)}-${pad(date.day, 2)}`;\n}\n\n/**\n * Days since 1970-01-01 in the proleptic Gregorian calendar (pure integer\n * arithmetic; independent of timezone, DST and time of day).\n */\nexport function civilDayOrdinal(date: CivilDate): number {\n const y = date.month <= 2 ? date.year - 1 : date.year;\n const era = Math.floor(y / 400);\n const yoe = y - era * 400;\n const mp = (date.month + 9) % 12;\n const doy = Math.floor((153 * mp + 2) / 5) + date.day - 1;\n const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;\n return era * 146097 + doe - 719468;\n}\n\nexport function civilDateFromOrdinal(ordinal: number): CivilDate {\n const z = ordinal + 719468;\n const era = Math.floor(z / 146097);\n const doe = z - era * 146097;\n const yoe = Math.floor((doe - Math.floor(doe / 1460) + Math.floor(doe / 36524) - Math.floor(doe / 146096)) / 365);\n const doy = doe - (365 * yoe + Math.floor(yoe / 4) - Math.floor(yoe / 100));\n const mp = Math.floor((5 * doy + 2) / 153);\n const day = doy - Math.floor((153 * mp + 2) / 5) + 1;\n const month = mp < 10 ? mp + 3 : mp - 9;\n const year = yoe + era * 400 + (month <= 2 ? 1 : 0);\n return { year, month, day };\n}\n\nexport function addCivilDays(date: CivilDate, days: number): CivilDate {\n return civilDateFromOrdinal(civilDayOrdinal(date) + days);\n}\n\n/** `b - a` in whole civil days. */\nexport function diffCivilDays(a: CivilDate, b: CivilDate): number {\n return civilDayOrdinal(b) - civilDayOrdinal(a);\n}\n\nexport function compareCivilDates(a: CivilDate, b: CivilDate): number {\n return civilDayOrdinal(a) - civilDayOrdinal(b);\n}\n\n/** Reads the host-local calendar day of a legacy `Date`. */\nexport function civilDateFromLocalDate(date: Date): CivilDate {\n return { year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate() };\n}\n\n/**\n * Local-noon `Date` for a civil day. Safe for years 0001–0099, which numeric\n * `Date` constructors would otherwise reinterpret as 1900–1999.\n */\nexport function civilDateToLocalNoon(date: CivilDate): Date {\n const result = new Date(2000, 0, 1, 12, 0, 0, 0);\n result.setFullYear(date.year, date.month - 1, date.day);\n return result;\n}\n\n/**\n * Completed years between two civil days (birthday age). A 29 February\n * birthday completes its year on 1 March in non-leap years.\n */\nexport function completedYears(from: CivilDate, to: CivilDate): number {\n let years = to.year - from.year;\n if (to.month < from.month || (to.month === from.month && to.day < from.day)) {\n years -= 1;\n }\n return years;\n}\n\n/**\n * Anniversary of `birth` in `year`. A 29 February birth resolves to 1 March\n * in non-leap years (roll-forward), matching `completedYears`.\n */\nexport function anniversaryInYear(birth: CivilDate, year: number): CivilDate {\n if (birth.month === 2 && birth.day === 29 && !isLeapYear(year)) {\n return { year, month: 3, day: 1 };\n }\n return { year, month: birth.month, day: birth.day };\n}\n","/**\n * Types, errors and input normalisation shared by the dated numerology\n * schedule facade (`schedule.ts`, `partial-date.ts`, `life-stages.ts`).\n *\n * All dates are civil Gregorian days (`CivilDate` or \"YYYY-MM-DD\"); nothing in\n * this facade reads the host timezone and intervals are half-open\n * `[start, endExclusive)`.\n */\n\nimport {\n type CivilDate,\n MAX_CIVIL_YEAR,\n MIN_CIVIL_YEAR,\n daysInMonth,\n formatCivilDate,\n isValidCivilDate,\n parseCivilDate,\n} from \"../civil-date\";\n\nexport const SCHEDULE_METHOD_VERSION = \"kaabalah-numerology-schedule/1\";\n\n/** Largest year accepted as input so that \"next birthday\" arithmetic stays within 1-9999. */\nexport const MAX_SCHEDULE_YEAR = MAX_CIVIL_YEAR - 1;\n/** Hard cap on the span of a timeline request, in days (about 100 years). */\nexport const MAX_TIMELINE_RANGE_DAYS = 36525;\n/** Hard cap on the number of intervals a timeline may contain. */\nexport const MAX_TIMELINE_INTERVALS_HARD_CAP = 10000;\nexport const DEFAULT_MAX_TIMELINE_INTERVALS = 2000;\n/** Hard cap on candidate dates enumerated for partial birth dates (a whole year). */\nexport const MAX_CANDIDATE_DATES = 366;\n\nexport type NumerologyErrorCode =\n | \"INVALID_DATE\"\n | \"INVALID_ARGUMENT\"\n | \"INVALID_RANGE\"\n | \"RANGE_TOO_LARGE\"\n | \"TOO_MANY_INTERVALS\"\n | \"MISSING_BIRTH_DATE\";\n\n/** Typed `RangeError` raised by the schedule facade. `code` is stable and machine-readable. */\nexport class NumerologyScheduleError extends RangeError {\n readonly code: NumerologyErrorCode;\n\n constructor(code: NumerologyErrorCode, message: string) {\n super(message);\n this.name = \"NumerologyScheduleError\";\n this.code = code;\n }\n}\n\nexport type CivilDateInput = CivilDate | string;\n\n/** Discriminated birth-date knowledge. */\nexport type PartialBirthDate =\n | { kind: \"full\"; date: CivilDateInput }\n | { kind: \"month-day\"; month: number; day: number }\n | { kind: \"year-month\"; year: number; month: number }\n | { kind: \"year\"; year: number; approximate?: boolean }\n | { kind: \"unknown\" };\n\n/** A full date (`CivilDate` or \"YYYY-MM-DD\") or an explicit partial-date description. */\nexport type BirthInput = CivilDateInput | PartialBirthDate;\n\nexport type ShortMonthPolicy = \"next-month-first\" | \"clamp\" | \"overflow\";\nexport type LifePathMethod = \"kaabalistic\" | \"straight-across\";\nexport type MasterPolicy = \"preserve\" | \"reduce\";\nexport type NameInputKind = \"first-token\" | \"given-name\" | \"full-name\";\n\nexport type PinnacleTransitionRule = \"36-minus-life-path\" | \"fixed-first-end-age\";\nexport type LifePeriodRule = \"pinnacle-aligned-27\" | \"fixed-28-56\";\n\nexport interface LifeStageOptions {\n /** Life path used for the age-transition rule. Default `\"straight-across\"` (the traditional pinnacle convention). */\n lifePathMethod?: LifePathMethod;\n /** Overrides the \"36 minus single-digit life path\" first-pinnacle end age (integer 1-60). */\n firstPinnacleEndAge?: number;\n /** Boundaries of the three life periods. Default `\"pinnacle-aligned-27\"`. */\n lifePeriodRule?: LifePeriodRule;\n}\n\nexport interface ScheduleLimits {\n /** Death date (inclusive last day of coverage). A missing death date is NOT evidence of survival and ends nothing. */\n death?: CivilDateInput | null;\n /** Exclusive end of coverage. */\n horizonEndExclusive?: CivilDateInput | null;\n}\n\nexport interface ScheduleOptions {\n /** Name used for the soul number (period 3). Missing/blank -> period 3 unavailable. */\n firstName?: string | null;\n /** How `firstName` is read. Default `\"first-token\"` (first whitespace-delimited token). */\n nameKind?: NameInputKind;\n /** Life path used for personal period 2. Default `\"kaabalistic\"`. */\n lifePathMethod?: LifePathMethod;\n /** Master-number policy for personal year/month/period, calendar frame, life path and pinnacles. Default `\"preserve\"`. Fibonacci never preserves masters. */\n masters?: MasterPolicy;\n /** Personal-month boundary policy when the birth day is absent from a month. Default `\"next-month-first\"` (legacy). */\n shortMonthPolicy?: ShortMonthPolicy;\n limits?: ScheduleLimits;\n lifeStages?: LifeStageOptions;\n}\n\nexport interface ScheduleInput extends ScheduleOptions {\n birth: BirthInput;\n}\n\nexport interface ReducedNumber {\n value: number;\n reductionSteps: number[];\n isMaster: boolean;\n}\n\nexport type UnavailableReason =\n | \"birth-date-unknown\"\n | \"birth-day-or-month-unknown\"\n | \"birth-year-unknown\"\n | \"birth-year-approximate\"\n | \"first-name-missing\"\n | \"first-name-has-no-vowels\"\n | \"before-birth\"\n | \"after-death\"\n | \"after-horizon\"\n | \"full-birth-date-required\"\n | \"beyond-supported-calendar\";\n\nexport interface Unavailable {\n available: false;\n reason: UnavailableReason;\n detail: string;\n}\n\nexport function unavailable(reason: UnavailableReason, detail: string): Unavailable {\n return { available: false, reason, detail };\n}\n\nexport interface MethodDescriptor {\n id: string;\n formula: string;\n}\n\nexport interface NumerologyMethodMetadata {\n methodVersion: string;\n dateModel: string;\n lifePathMethod: LifePathMethod;\n lifePathMethodDescription: string;\n masterPolicy: MasterPolicy;\n masterNumbers: number[];\n fibonacciReduction: string;\n nameInput: { kind: NameInputKind; provided: boolean; rule: string };\n gematria: string;\n shortMonthPolicy: ShortMonthPolicy;\n limits: {\n death: string | null;\n horizonEndExclusive: string | null;\n deathNote: string;\n };\n methods: Record<string, MethodDescriptor>;\n notes: string[];\n}\n\nexport function fmt(date: CivilDate): string {\n if (date.year < MIN_CIVIL_YEAR || date.year > MAX_CIVIL_YEAR) {\n throw new NumerologyScheduleError(\"INVALID_DATE\", `Date out of supported range: year ${date.year}`);\n }\n return formatCivilDate(date);\n}\n\n/** Parses a date input, throwing a typed error for malformed/impossible/out-of-range values. */\nexport function resolveCivilDate(input: CivilDateInput, label = \"date\"): CivilDate {\n let result: CivilDate | null;\n if (typeof input === \"string\") {\n result = parseCivilDate(input);\n if (!result) {\n throw new NumerologyScheduleError(\n \"INVALID_DATE\",\n `${label} must be a real calendar date formatted YYYY-MM-DD (got ${JSON.stringify(input)})`\n );\n }\n } else if (isValidCivilDate(input)) {\n result = { year: input.year, month: input.month, day: input.day };\n } else {\n throw new NumerologyScheduleError(\"INVALID_DATE\", `${label} is not a valid civil date`);\n }\n if (result.year > MAX_SCHEDULE_YEAR) {\n throw new NumerologyScheduleError(\"INVALID_DATE\", `${label}: years above ${MAX_SCHEDULE_YEAR} are not supported`);\n }\n return result;\n}\n\nexport type NormalizedBirth =\n | { kind: \"full\"; date: CivilDate }\n | { kind: \"month-day\"; month: number; day: number }\n | { kind: \"year-month\"; year: number; month: number }\n | { kind: \"year\"; year: number; approximate: boolean }\n | { kind: \"unknown\" };\n\nfunction isPartial(input: BirthInput): input is PartialBirthDate {\n return typeof input === \"object\" && input !== null && \"kind\" in input;\n}\n\nexport function normalizeBirth(input: BirthInput | undefined): NormalizedBirth {\n if (input === undefined || input === null) {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", \"birth is required (use { kind: \\\"unknown\\\" } for no information)\");\n }\n if (!isPartial(input)) {\n return { kind: \"full\", date: resolveCivilDate(input, \"birth date\") };\n }\n switch (input.kind) {\n case \"full\":\n return { kind: \"full\", date: resolveCivilDate(input.date, \"birth date\") };\n case \"month-day\": {\n const { month, day } = input;\n // 29 February is a valid month/day (leap years exist).\n if (!Number.isInteger(month) || !Number.isInteger(day) || month < 1 || month > 12 || day < 1 || day > daysInMonth(2000, month)) {\n throw new NumerologyScheduleError(\"INVALID_DATE\", `Invalid month/day: ${month}/${day}`);\n }\n return { kind: \"month-day\", month, day };\n }\n case \"year-month\": {\n const { year, month } = input;\n assertYear(year);\n if (!Number.isInteger(month) || month < 1 || month > 12) {\n throw new NumerologyScheduleError(\"INVALID_DATE\", `Invalid month: ${month}`);\n }\n return { kind: \"year-month\", year, month };\n }\n case \"year\":\n assertYear(input.year);\n return { kind: \"year\", year: input.year, approximate: input.approximate === true };\n case \"unknown\":\n return { kind: \"unknown\" };\n default:\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown birth kind: ${String((input as { kind: unknown }).kind)}`);\n }\n}\n\nfunction assertYear(year: number): void {\n if (!Number.isInteger(year) || year < MIN_CIVIL_YEAR || year > MAX_SCHEDULE_YEAR) {\n throw new NumerologyScheduleError(\"INVALID_DATE\", `Year must be an integer ${MIN_CIVIL_YEAR}-${MAX_SCHEDULE_YEAR} (got ${year})`);\n }\n}\n","/**\n * Low-level numerology primitives (digit reduction, life paths). Split from\n * `index.ts` so the schedule facade can use them without import cycles.\n */\n\nimport type * as NumerologyModuleTypes from \"./data\";\n\nexport function parseDate(date: Date): { day: string; month: string; year: string } {\n if (!date) {\n throw new Error(\"Date is required\");\n }\n\n if (!(date instanceof Date)) {\n throw new Error(\"Date must be a Date object\");\n }\n\n if (Number.isNaN(date.getTime())) {\n throw new Error(\"Date must be a valid Date object\");\n }\n\n return {\n day: String(date.getDate()).padStart(2, \"0\"),\n month: String(date.getMonth() + 1).padStart(2, \"0\"),\n year: String(date.getFullYear()).padStart(4, \"0\"),\n };\n}\n\nexport function mapDatePartsToBlocksOfTwo({\n day,\n month,\n year,\n}: {\n day: string;\n month: string;\n year: string;\n}): { day: string; month: string; year1: string; year2: string } {\n return {\n day: day.padStart(2, \"0\"),\n month: month.padStart(2, \"0\"),\n year1: year.slice(0, 2),\n year2: year.slice(2),\n };\n}\n\nfunction digitSum(n: number): number {\n let s = 0;\n\n for (const ch of String(Math.abs(n))) {\n s += ch.charCodeAt(0) - 48;\n }\n\n return s;\n}\n\nexport const MASTER_NUMBERS = [11, 22, 33, 44];\n\nexport function isMasterNumber(n: number): boolean {\n return MASTER_NUMBERS.includes(n);\n}\n\nexport function reduceToSingle(\n n: number,\n options: { preserveMasters?: boolean } = { preserveMasters: false }\n): number {\n // standard digital root with 0 allowed; never preserve masters here\n if (n === 0) {\n return 0;\n }\n\n let reduced = n;\n while (reduced > 9) {\n if (options?.preserveMasters && isMasterNumber(reduced)) {\n break;\n }\n\n reduced = digitSum(reduced);\n }\n\n // optional tweak for exact \"00\" cases will be applied by caller, not here\n return reduced;\n}\n\nexport function reduceToSingleWithSteps(\n n: number,\n options: { preserveMasters?: boolean } = { preserveMasters: false }\n): NumerologyModuleTypes.ReducedValueWithSteps {\n const steps = [n];\n\n if (n === 0) {\n return {\n reducedValue: 0,\n reductionSteps: steps,\n };\n }\n\n let reduced = n;\n\n while (reduced > 9) {\n if (options?.preserveMasters && isMasterNumber(reduced)) {\n break;\n }\n\n reduced = digitSum(reduced);\n steps.push(reduced);\n }\n\n return {\n reducedValue: reduced,\n reductionSteps: steps,\n };\n}\n\nfunction reduceBlock(block: string): number {\n const n = [...block].reduce(\n (acc, curr) => acc + (curr.charCodeAt(0) - 48),\n 0\n );\n\n if (n === 0) {\n return 0;\n }\n\n return reduceToSingle(n);\n}\n\n/**\n * Calculate the Kaabalistic life path number based on a birth date.\n * Note: This method produces more master numbers and never produces life path 2s (or any life path that ends with 0 like 10, 20, 30, etc.)\n */\nexport function calculateKaabalisticLifePath(\n birthDate: Date\n): NumerologyModuleTypes.KaabalisticLifePathResult {\n const { day, month, year1, year2 } = mapDatePartsToBlocksOfTwo(\n parseDate(birthDate)\n );\n\n const reducedDay = reduceBlock(day);\n const reducedMonth = reduceBlock(month);\n const reducedYear1 = reduceBlock(year1);\n const reducedYear2 = reduceBlock(year2);\n\n const dayMonthSynthesis = parseInt(`${reducedDay}${reducedMonth}`, 10);\n const yearSynthesis = parseInt(`${reducedYear1}${reducedYear2}`, 10);\n\n const reducedDayMonthSynthesis = reduceToSingle(dayMonthSynthesis);\n const reducedYearSynthesis = reduceToSingle(yearSynthesis);\n\n const finalSynthesis = parseInt(\n `${reducedDayMonthSynthesis}${reducedYearSynthesis}`,\n 10\n );\n\n const lifePath = reduceToSingleWithSteps(finalSynthesis, { preserveMasters: true });\n const isMasterLifePath = isMasterNumber(lifePath.reducedValue);\n\n const personalMythologyNumbers = [\n parseInt(`${dayMonthSynthesis}${yearSynthesis}`, 10),\n finalSynthesis,\n ];\n\n if (finalSynthesis !== lifePath.reducedValue) {\n personalMythologyNumbers.push(lifePath.reducedValue);\n }\n\n const reducedLifePath = reduceToSingle(lifePath.reducedValue);\n if (isMasterLifePath) {\n personalMythologyNumbers.push(reducedLifePath);\n }\n\n return {\n parts: { day, month, year1, year2 },\n reducedParts: { reducedDay, reducedMonth, reducedYear1, reducedYear2 },\n syntheses: {\n dayMonthSynthesis,\n yearSynthesis,\n reducedDayMonthSynthesis,\n reducedYearSynthesis,\n finalSynthesis,\n },\n lifePath,\n personalMythologyNumbers,\n };\n}\n\n/**\n * Calculate the traditional straight across reduction life path number based on a birth date.\n */\nexport function calculateStraightAcrossReductionLifePath(\n birthDate: Date\n): NumerologyModuleTypes.StraightAcrossReductionLifePathResult {\n const { day, month, year } = parseDate(birthDate);\n\n const result = reduceToSingleWithSteps(\n parseInt(`${day}${month}${year}`, 10),\n { preserveMasters: true }\n );\n\n return {\n dayEnergy: reduceToSingleWithSteps(parseInt(day, 10), { preserveMasters: true }),\n monthEnergy: reduceToSingleWithSteps(parseInt(month, 10), { preserveMasters: true }),\n yearEnergy: reduceToSingleWithSteps(parseInt(year, 10), { preserveMasters: true }),\n lifePath: result,\n };\n}\n","/**\n * Pinnacles, challenges and life periods as NAMED, DOCUMENTED CONVENTIONS.\n *\n * These conventions are not universal: sources differ on the age at which the\n * first pinnacle ends, on whether master numbers survive in components, and on\n * what \"three life periods\" means. Every choice below is exposed through\n * `LifeStageOptions` / returned metadata. They are distinct from the three\n * four-month personal periods of the birthday year.\n *\n * Convention `kaabalah-life-stages/1`:\n * - components: month, day and year (digit sum of the full year) reduced to a\n * single digit, masters not preserved (the same components as\n * `calculateChallenges`).\n * - pinnacle 1 = month + day; 2 = day + year; 3 = P1 + P2 (reduced values);\n * 4 = month + year. Results reduced with the master policy.\n * - challenges: 1 = |month - day|; 2 = |day - year|; 3 (main) = |C1 - C2|;\n * 4 = |month - year| (single digits, 0-8).\n * - age transition: the first pinnacle/challenge ends at completed age\n * `36 - L`, L = life path reduced to a single digit (11 -> 2, 22 -> 4,\n * 33 -> 6, 44 -> 8); each following one lasts 9 years; the fourth is open.\n * `firstPinnacleEndAge` overrides this.\n * - life periods: three periods valued by month, day and year reductions\n * (master policy applied). `pinnacle-aligned-27`: [0, 36-L), 27 years, rest.\n * `fixed-28-56`: [0, 28), [28, 56), [56, open).\n */\n\nimport {\n type CivilDate,\n MAX_CIVIL_YEAR,\n anniversaryInYear,\n civilDateToLocalNoon,\n} from \"../civil-date\";\nimport {\n calculateKaabalisticLifePath,\n calculateStraightAcrossReductionLifePath,\n reduceToSingle,\n reduceToSingleWithSteps,\n isMasterNumber,\n} from \"./core\";\nimport {\n type LifeStageOptions,\n type LifePathMethod,\n type MasterPolicy,\n type ReducedNumber,\n NumerologyScheduleError,\n} from \"./schedule-types\";\n\nexport const LIFE_STAGE_METHOD_ID = \"kaabalah-life-stages/1\";\n\nexport interface LifeStageSpan {\n /** 1-based position within its family. */\n index: number;\n startAge: number;\n /** `null` for the open-ended last span. */\n endAgeExclusive: number | null;\n /** `null` when the start anniversary falls after the last supported year (9999); see `startBeyondCalendar`. */\n start: CivilDate | null;\n /** `null` for the open-ended last span, or when the end falls after year 9999 (then `nominalEndBeyondCalendar` is true). */\n nominalEndExclusive: CivilDate | null;\n /** True only when the span's start is past the supported calendar (the span cannot be dated). */\n startBeyondCalendar?: true;\n /** True only when the span has an age end but its date is past the supported calendar (year > 9999). */\n nominalEndBeyondCalendar?: true;\n}\n\nexport interface Pinnacle extends LifeStageSpan {\n value: ReducedNumber;\n}\n\nexport interface Challenge extends LifeStageSpan {\n value: number;\n /** True for the third (main) challenge. */\n isMain: boolean;\n}\n\nexport interface LifePeriod extends LifeStageSpan {\n /** Which date part this period is valued by. */\n basis: \"month\" | \"day\" | \"year\";\n value: ReducedNumber;\n}\n\nexport interface LifeStages {\n convention: string;\n lifePathMethod: LifePathMethod;\n lifePathForTransition: number;\n transitionRule: \"36-minus-life-path\" | \"fixed-first-end-age\";\n firstPinnacleEndAge: number;\n lifePeriodRule: \"pinnacle-aligned-27\" | \"fixed-28-56\";\n masterPolicy: MasterPolicy;\n components: { month: number; day: number; year: number };\n pinnacles: Pinnacle[];\n challenges: Challenge[];\n lifePeriods: LifePeriod[];\n}\n\nfunction reduced(n: number, masters: MasterPolicy): ReducedNumber {\n const r = reduceToSingleWithSteps(n, { preserveMasters: masters === \"preserve\" });\n return { value: r.reducedValue, reductionSteps: r.reductionSteps, isMaster: isMasterNumber(r.reducedValue) };\n}\n\nexport function computeLifeStages(\n birth: CivilDate,\n masters: MasterPolicy,\n options: LifeStageOptions = {}\n): LifeStages {\n const lifePathMethod = options.lifePathMethod ?? \"straight-across\";\n const lifePathRule = options.firstPinnacleEndAge === undefined ? \"36-minus-life-path\" : \"fixed-first-end-age\";\n const lifePeriodRule = options.lifePeriodRule ?? \"pinnacle-aligned-27\";\n if (lifePeriodRule !== \"pinnacle-aligned-27\" && lifePeriodRule !== \"fixed-28-56\") {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown lifePeriodRule: ${String(lifePeriodRule)}`);\n }\n if (lifePathMethod !== \"kaabalistic\" && lifePathMethod !== \"straight-across\") {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown lifePathMethod: ${String(lifePathMethod)}`);\n }\n if (\n options.firstPinnacleEndAge !== undefined &&\n (!Number.isInteger(options.firstPinnacleEndAge) || options.firstPinnacleEndAge < 1 || options.firstPinnacleEndAge > 60)\n ) {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", \"firstPinnacleEndAge must be an integer 1-60\");\n }\n\n const noon = civilDateToLocalNoon(birth);\n const lifePathValue =\n lifePathMethod === \"kaabalistic\"\n ? calculateKaabalisticLifePath(noon).lifePath.reducedValue\n : calculateStraightAcrossReductionLifePath(noon).lifePath.reducedValue;\n const lifePathForTransition = reduceToSingle(lifePathValue);\n const firstEnd = options.firstPinnacleEndAge ?? 36 - lifePathForTransition;\n\n const m = reduceToSingle(birth.month);\n const d = reduceToSingle(birth.day);\n const y = reduceToSingle(birth.year);\n\n // Anniversaries past year 9999 are not representable: report them explicitly instead of throwing.\n const dated = (age: number): CivilDate | null =>\n birth.year + age > MAX_CIVIL_YEAR ? null : anniversaryInYear(birth, birth.year + age);\n const span = (index: number, startAge: number, endAge: number | null): LifeStageSpan => {\n const start = dated(startAge);\n const end = endAge === null ? null : dated(endAge);\n return {\n index,\n startAge,\n endAgeExclusive: endAge,\n start,\n nominalEndExclusive: end,\n ...(start === null ? { startBeyondCalendar: true as const } : {}),\n ...(endAge !== null && end === null ? { nominalEndBeyondCalendar: true as const } : {}),\n };\n };\n\n const edges = [0, firstEnd, firstEnd + 9, firstEnd + 18];\n const spans = edges.map((age, i) => span(i + 1, age, i < 3 ? edges[i + 1] : null));\n\n const p1 = reduced(m + d, masters);\n const p2 = reduced(d + y, masters);\n const pinnacleValues = [p1, p2, reduced(p1.value + p2.value, masters), reduced(m + y, masters)];\n const pinnacles = spans.map((s, i) => ({ ...s, value: pinnacleValues[i] }));\n\n const c1 = Math.abs(m - d);\n const c2 = Math.abs(d - y);\n const challengeValues = [c1, c2, Math.abs(c1 - c2), Math.abs(m - y)];\n const challenges = spans.map((s, i) => ({ ...s, value: challengeValues[i], isMain: i === 2 }));\n\n const periodEdges = lifePeriodRule === \"fixed-28-56\" ? [0, 28, 56] : [0, firstEnd, firstEnd + 27];\n const bases = [\"month\", \"day\", \"year\"] as const;\n const baseValues = [birth.month, birth.day, birth.year];\n const lifePeriods = periodEdges.map((age, i) => ({\n ...span(i + 1, age, i < 2 ? periodEdges[i + 1] : null),\n basis: bases[i],\n value: reduced(baseValues[i], masters),\n }));\n\n return {\n convention: LIFE_STAGE_METHOD_ID,\n lifePathMethod,\n lifePathForTransition,\n transitionRule: lifePathRule,\n firstPinnacleEndAge: firstEnd,\n lifePeriodRule,\n masterPolicy: masters,\n components: { month: m, day: d, year: y },\n pinnacles,\n challenges,\n lifePeriods,\n };\n}\n","/**\n * Dated numerology schedule facade.\n *\n * Pure, civil-date based (no timezone, no `Date`, no local-noon trick for\n * callers). Provides:\n * - `getNumerologySnapshot`: everything active on one civil day;\n * - `generateNumerologyTimeline`: bounded, half-open intervals for chosen layers;\n * - `getNumerologyMethodMetadata`: the explicit method identity.\n *\n * Layers: birthday frame (`personal-year`, `personal-month`, `personal-period`,\n * `heptad`, `age-cycle`, `fibonacci`), life stages (`pinnacle`, `challenge`,\n * `life-period`) and the distinct calendar frame (`calendar-year`,\n * `calendar-month`, `calendar-day`).\n *\n * Every interval is `[start, endExclusive)` in \"YYYY-MM-DD\". When limits\n * (birth, death, horizon) cut an interval, `nominalStart/nominalEndExclusive`\n * keep the unclipped bounds and `clipped` is true. A missing death date means\n * nothing about survival: no end is inferred.\n */\n\nimport {\n type CivilDate,\n MAX_CIVIL_YEAR,\n addCivilDays,\n anniversaryInYear,\n civilDateToLocalNoon,\n compareCivilDates,\n completedYears,\n daysInMonth,\n diffCivilDays,\n} from \"../civil-date\";\nimport { calculateGematria } from \"../gematria\";\nimport {\n calculateKaabalisticLifePath,\n calculateStraightAcrossReductionLifePath,\n MASTER_NUMBERS,\n reduceToSingleWithSteps,\n} from \"./core\";\nimport { computeLifeStages, LIFE_STAGE_METHOD_ID, type LifeStageSpan, type LifeStages } from \"./life-stages\";\nimport {\n DEFAULT_MAX_TIMELINE_INTERVALS,\n MAX_TIMELINE_INTERVALS_HARD_CAP,\n MAX_TIMELINE_RANGE_DAYS,\n SCHEDULE_METHOD_VERSION,\n NumerologyScheduleError,\n fmt,\n normalizeBirth,\n resolveCivilDate,\n unavailable,\n type CivilDateInput,\n type LifePathMethod,\n type MasterPolicy,\n type MethodDescriptor,\n type NameInputKind,\n type NormalizedBirth,\n type NumerologyMethodMetadata,\n type ReducedNumber,\n type ScheduleInput,\n type ShortMonthPolicy,\n type Unavailable,\n} from \"./schedule-types\";\n\nexport * from \"./schedule-types\";\n\n// ---------------------------------------------------------------------------\n// Public result types\n// ---------------------------------------------------------------------------\n\nexport interface ScheduleIntervalBase {\n /** Inclusive start, \"YYYY-MM-DD\" (possibly clipped to the birth date). */\n start: string;\n /** Exclusive end, \"YYYY-MM-DD\" (possibly clipped by death/horizon). `null` only for open-ended life stages with no horizon. */\n endExclusive: string | null;\n nominalStart: string;\n /** `null` for open-ended spans and when the real end is past year 9999 (then `nominalEndBeyondCalendar` is true). */\n nominalEndExclusive: string | null;\n /** True only when the nominal end falls after the last supported calendar year (9999) and so cannot be dated. */\n nominalEndBeyondCalendar?: true;\n startClipped: boolean;\n endClipped: boolean;\n /** True when the start or the end was clipped by birth/death/horizon limits. */\n clipped: boolean;\n lengthDays: number | null;\n nominalLengthDays: number | null;\n}\n\nexport interface AgeCycleRef {\n /** Repeating 1-7 label of the seven-year block. */\n label: number;\n /** Absolute 0-based seven-year block index from birth (`floor(completedAge / 7)`). */\n absoluteIndex: number;\n /** Year within the block, 1-7 (`completedAge % 7 + 1`). */\n yearPosition: number;\n}\n\nexport interface PersonalYearInterval extends ScheduleIntervalBase {\n layer: \"personal-year\";\n birthdayYear: number;\n completedAge: number | null;\n personalYear: ReducedNumber;\n ageCycle: AgeCycleRef | null;\n}\n\nexport interface PersonalMonthInterval extends ScheduleIntervalBase {\n layer: \"personal-month\";\n birthdayYear: number;\n /** Phase number 1-12 (position in the birthday year). */\n phase: number;\n /** Nominal calendar-month label 1-12 used in the value (kept even when the phase starts in another month). */\n calendarMonth: number;\n intendedBirthDay: number;\n /** Reduced value, kept separate from `phase`. */\n value: ReducedNumber;\n /** True when the phase start differs from the nominal `YYYY-MM-<birthDay>` date. */\n startAdjusted: boolean;\n /** Nominal start as text; may be an impossible date such as \"2025-02-31\". */\n nominalStartText: string;\n shortMonthPolicy: ShortMonthPolicy;\n}\n\nexport type PersonalPeriodValue =\n | (ReducedNumber & {\n available: true;\n addend: number;\n addendSource: \"completed-age\" | \"life-path\" | \"first-name-soul-number\";\n })\n | Unavailable;\n\nexport interface PersonalPeriodInterval extends ScheduleIntervalBase {\n layer: \"personal-period\";\n birthdayYear: number;\n /** Phase number 1-3 (four months each). */\n phase: number;\n /** First/last personal-month phase covered, 1-12. */\n monthPhases: [number, number];\n startCalendarMonth: number;\n endCalendarMonth: number;\n value: PersonalPeriodValue;\n}\n\nexport interface HeptadInterval extends ScheduleIntervalBase {\n layer: \"heptad\";\n birthdayYear: number;\n /** Phase number 1-7. */\n phase: number;\n /** True for the seventh segment, which spans the actual remainder to the next birthday (53/54 days). */\n isRemainder: boolean;\n}\n\nexport interface AgeCycleInterval extends ScheduleIntervalBase {\n layer: \"age-cycle\";\n label: number;\n absoluteIndex: number;\n startAge: number;\n endAgeExclusive: number;\n}\n\nexport interface FibonacciInterval extends ScheduleIntervalBase {\n layer: \"fibonacci\";\n birthdayYear: number;\n completedAge: number;\n /** Seven cycles; single-digit reductions (masters NOT preserved). */\n cycles: { phase: number; value: number; reductionSteps: number[] }[];\n}\n\nexport interface CalendarYearInterval extends ScheduleIntervalBase {\n layer: \"calendar-year\";\n year: number;\n personalYear: ReducedNumber;\n}\nexport interface CalendarMonthInterval extends ScheduleIntervalBase {\n layer: \"calendar-month\";\n year: number;\n month: number;\n personalYear: ReducedNumber;\n personalMonth: ReducedNumber;\n}\nexport interface CalendarDayInterval extends ScheduleIntervalBase {\n layer: \"calendar-day\";\n date: string;\n personalYear: ReducedNumber;\n personalMonth: ReducedNumber;\n personalDay: ReducedNumber;\n}\n\nexport interface PinnacleInterval extends ScheduleIntervalBase {\n layer: \"pinnacle\";\n index: number;\n startAge: number;\n endAgeExclusive: number | null;\n value: ReducedNumber;\n}\nexport interface ChallengeInterval extends ScheduleIntervalBase {\n layer: \"challenge\";\n index: number;\n isMain: boolean;\n startAge: number;\n endAgeExclusive: number | null;\n value: number;\n}\nexport interface LifePeriodInterval extends ScheduleIntervalBase {\n layer: \"life-period\";\n index: number;\n basis: \"month\" | \"day\" | \"year\";\n startAge: number;\n endAgeExclusive: number | null;\n value: ReducedNumber;\n}\n\nexport type ScheduleInterval =\n | PersonalYearInterval\n | PersonalMonthInterval\n | PersonalPeriodInterval\n | HeptadInterval\n | AgeCycleInterval\n | FibonacciInterval\n | CalendarYearInterval\n | CalendarMonthInterval\n | CalendarDayInterval\n | PinnacleInterval\n | ChallengeInterval\n | LifePeriodInterval;\n\nexport type TimelineLayer = ScheduleInterval[\"layer\"];\n\nexport const TIMELINE_LAYERS: readonly TimelineLayer[] = [\n \"personal-year\",\n \"personal-month\",\n \"personal-period\",\n \"heptad\",\n \"age-cycle\",\n \"fibonacci\",\n \"calendar-year\",\n \"calendar-month\",\n \"calendar-day\",\n \"pinnacle\",\n \"challenge\",\n \"life-period\",\n];\n\nexport type SnapshotStatus = \"ok\" | \"partial\" | \"before-birth\" | \"after-death\" | \"after-horizon\";\n\nexport interface NumerologySnapshot {\n asOf: string;\n status: SnapshotStatus;\n birth: { kind: NormalizedBirth[\"kind\"]; date?: string; month?: number; day?: number; year?: number; approximate?: boolean };\n meta: NumerologyMethodMetadata;\n /** Completed (birthday) age; `null` unless the full birth date is known. */\n completedAge: number | null;\n /** Possible completed ages when only a year (or year and month) is known. */\n completedAgeRange: { min: number; max: number } | null;\n lastBirthdayYear: number | null;\n /** 1-based day within the birthday year. */\n dayInBirthdayYear: number | null;\n fixedNumbers: {\n lifePath: (ReducedNumber & { available: true; method: LifePathMethod }) | Unavailable;\n firstNameSoulNumber: (ReducedNumber & { available: true }) | Unavailable;\n };\n birthdayYear: PersonalYearInterval | null;\n personalMonth: PersonalMonthInterval | null;\n personalPeriod: PersonalPeriodInterval | null;\n heptad: (HeptadInterval & { dayInHeptad: number }) | null;\n ageCycle: (AgeCycleInterval & { yearPosition: number }) | null;\n fibonacci: FibonacciInterval | null;\n calendar: {\n personalYear: ReducedNumber;\n personalMonth: ReducedNumber;\n personalDay: ReducedNumber;\n } | null;\n lifeStages: {\n pinnacle: PinnacleInterval | null;\n challenge: ChallengeInterval | null;\n lifePeriod: LifePeriodInterval | null;\n mainChallenge: number;\n transition: { rule: string; lifePathForTransition: number; firstPinnacleEndAge: number };\n } | null;\n unavailable: { field: string; reason: Unavailable[\"reason\"]; detail: string }[];\n}\n\nexport interface NumerologyTimeline {\n from: string;\n toExclusive: string;\n layers: TimelineLayer[];\n meta: NumerologyMethodMetadata;\n /** Intervals overlapping `[from, toExclusive)`, with their real (not window-clipped) bounds, sorted by start then layer. */\n intervals: ScheduleInterval[];\n caps: { maxIntervals: number; maxRangeDays: number };\n unavailable: { field: string; reason: Unavailable[\"reason\"]; detail: string }[];\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface Anchor {\n month: number;\n day: number;\n year: number | null;\n}\n\ninterface Ctx {\n input: ScheduleInput;\n birth: NormalizedBirth;\n full: CivilDate | null;\n anchor: Anchor | null;\n masters: MasterPolicy;\n lifePathMethod: LifePathMethod;\n nameKind: NameInputKind;\n policy: ShortMonthPolicy;\n soul: (ReducedNumber & { available: true }) | Unavailable;\n lifePath: (ReducedNumber & { available: true; method: LifePathMethod }) | Unavailable;\n death: CivilDate | null;\n horizon: CivilDate | null;\n coverageStart: CivilDate | null;\n coverageEnd: CivilDate | null;\n meta: NumerologyMethodMetadata;\n stages: LifeStages | null;\n}\n\nconst MASTER_SET = new Set(MASTER_NUMBERS);\n\nfunction red(ctx: { masters: MasterPolicy }, n: number): ReducedNumber {\n const r = reduceToSingleWithSteps(n, { preserveMasters: ctx.masters === \"preserve\" });\n return { value: r.reducedValue, reductionSteps: r.reductionSteps, isMaster: MASTER_SET.has(r.reducedValue) };\n}\n\nfunction wrapMonth(month: number): number {\n return ((((month - 1) % 12) + 12) % 12) + 1;\n}\n\nfunction nameToken(raw: string, kind: NameInputKind): string {\n const trimmed = raw.trim().replace(/\\s+/g, \" \");\n return kind === \"first-token\" ? trimmed.split(\" \")[0] ?? \"\" : trimmed;\n}\n\nfunction resolveSoul(\n firstName: string | null | undefined,\n kind: NameInputKind\n): (ReducedNumber & { available: true }) | Unavailable {\n if (firstName === undefined || firstName === null || typeof firstName !== \"string\" || firstName.trim() === \"\") {\n return unavailable(\"first-name-missing\", \"No first name supplied; the soul number (personal period 3) is not computed.\");\n }\n const used = nameToken(firstName, kind);\n const vowels = calculateGematria(used).vowels;\n if (vowels.originalSum === 0 || vowels.finalValue === 0) {\n return unavailable(\"first-name-has-no-vowels\", \"The supplied name has no vowels recognised by the gematria mapping; soul number not computed.\");\n }\n return {\n available: true,\n value: vowels.finalValue,\n reductionSteps: vowels.reductionSteps,\n isMaster: false,\n };\n}\n\nfunction resolveLifePath(\n full: CivilDate | null,\n method: LifePathMethod,\n masters: MasterPolicy,\n birthKind: NormalizedBirth[\"kind\"]\n): (ReducedNumber & { available: true; method: LifePathMethod }) | Unavailable {\n if (!full) {\n return unavailable(\n birthKind === \"unknown\"\n ? \"birth-date-unknown\"\n : birthKind === \"month-day\"\n ? \"birth-year-unknown\"\n : \"birth-day-or-month-unknown\",\n \"The life path needs the full birth date (day, month and year).\"\n );\n }\n const noon = civilDateToLocalNoon(full);\n const base =\n method === \"kaabalistic\"\n ? calculateKaabalisticLifePath(noon).lifePath\n : calculateStraightAcrossReductionLifePath(noon).lifePath;\n const r = masters === \"preserve\" ? base : reduceToSingleWithSteps(base.reducedValue);\n return {\n available: true,\n method,\n value: r.reducedValue,\n reductionSteps: [...r.reductionSteps],\n isMaster: MASTER_SET.has(r.reducedValue),\n };\n}\n\nfunction buildMetadata(\n input: ScheduleInput,\n masters: MasterPolicy,\n lifePathMethod: LifePathMethod,\n nameKind: NameInputKind,\n policy: ShortMonthPolicy,\n death: CivilDate | null,\n horizon: CivilDate | null,\n stages: LifeStages | null\n): NumerologyMethodMetadata {\n const methods: Record<string, MethodDescriptor> = {\n \"personal-year\": {\n id: \"birthday-personal-year/v1\",\n formula: \"reduce(birthDay + birthMonth + birthdayYear); birthdayYear = year of the most recent birthday; masters per policy\",\n },\n \"personal-month\": {\n id: \"birthday-personal-month/v1\",\n formula: \"reduce(personalYear.value + calendarMonthLabel); label = wrap(birthMonth + phase - 1); phase k starts on the birth day of month label k (see shortMonthPolicy)\",\n },\n \"personal-period\": {\n id: \"birthday-personal-period/v1\",\n formula:\n \"four months each; 1: reduce(birthdayYear + completedAge); 2: reduce(birthdayYear + lifePath); 3: reduce(birthdayYear + firstNameVowelSoulNumber); masters per policy\",\n },\n heptad: {\n id: \"fixed-52-day-heptad/v1\",\n formula: \"six 52-day segments from the birthday; segment 7 runs to the next birthday (53/54 days); civil day counts\",\n },\n \"age-cycle\": {\n id: \"seven-year-age-cycle/v1\",\n formula: \"block = floor(completedAge / 7); label = block % 7 + 1; yearPosition = completedAge % 7 + 1; blocks start on the birthday\",\n },\n fibonacci: {\n id: \"fibonacci-completed-age/v1\",\n formula:\n \"c1 = reduce(age); c2 = reduce(c1 + 2); c3 = reduce(c1 + c2.rawSum); c(n) = reduce(c(n-2).rawSum + c(n-1).rawSum); single-digit, masters not preserved; age = completed age\",\n },\n \"calendar-year\": {\n id: \"calendar-personal-year-month-day/v1\",\n formula: \"calendarPY = reduce(birthDay + birthMonth + calendarYear)\",\n },\n \"calendar-month\": {\n id: \"calendar-personal-year-month-day/v1\",\n formula: \"calendarPM = reduce(calendarPY.value + calendarMonth)\",\n },\n \"calendar-day\": {\n id: \"calendar-personal-year-month-day/v1\",\n formula:\n \"calendarPD = reduce(calendarPM.value + calendarDay). Chosen convention (the library has no personal-day calculator); distinct from the birthday frame\",\n },\n };\n for (const layer of [\"pinnacle\", \"challenge\", \"life-period\"]) {\n methods[layer] = {\n id: LIFE_STAGE_METHOD_ID,\n formula: stages\n ? `first span ends at age ${stages.firstPinnacleEndAge} (${stages.transitionRule}); see life-stages.ts for the full convention`\n : \"36 - single-digit life path for the first pinnacle end; requires the full birth date\",\n };\n }\n const deathText = death ? fmt(death) : null;\n return {\n methodVersion: SCHEDULE_METHOD_VERSION,\n dateModel: \"civil proleptic-Gregorian dates, no timezone; intervals are half-open [start, endExclusive); 29 February birthdays fall on 1 March in common years\",\n lifePathMethod,\n lifePathMethodDescription:\n lifePathMethod === \"kaabalistic\"\n ? \"kaabalistic concatenation of reduced two-digit blocks (calculateKaabalisticLifePath)\"\n : \"straight digit-sum of DDMMYYYY (calculateStraightAcrossReductionLifePath)\",\n masterPolicy: masters,\n masterNumbers: [...MASTER_NUMBERS],\n fibonacciReduction: \"single digit, master numbers never preserved (unchanged legacy behaviour)\",\n nameInput: {\n kind: nameKind,\n provided: typeof input.firstName === \"string\" && input.firstName.trim() !== \"\",\n rule:\n nameKind === \"first-token\"\n ? \"first whitespace-delimited token of the supplied name\"\n : nameKind === \"given-name\"\n ? \"the supplied string is the given name (all words used)\"\n : \"the supplied string is the full name (all words used)\",\n },\n gematria: \"kaabalah gematria vowel sum (calculateGematria(...).vowels); diacritic mappings (e.g. Ã, Ç) unchanged\",\n shortMonthPolicy: policy,\n limits: {\n death: deathText,\n horizonEndExclusive: horizon ? fmt(horizon) : null,\n deathNote: death\n ? \"Coverage ends after the supplied death date (inclusive).\"\n : \"No death date supplied. This is NOT evidence of survival; nothing is inferred and no end is imposed.\",\n },\n methods,\n notes: [\n \"Phase numbers (month/period/heptad positions) are separate from reduced values.\",\n \"Pinnacle, challenge and life-period conventions are named choices, not universal rules.\",\n ],\n };\n}\n\nfunction buildCtx(input: ScheduleInput): Ctx {\n if (typeof input !== \"object\" || input === null) {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", \"A schedule input object is required\");\n }\n const birth = normalizeBirth(input.birth);\n const masters = input.masters ?? \"preserve\";\n const lifePathMethod = input.lifePathMethod ?? \"kaabalistic\";\n const nameKind = input.nameKind ?? \"first-token\";\n const policy = input.shortMonthPolicy ?? \"next-month-first\";\n if (masters !== \"preserve\" && masters !== \"reduce\") {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown masters policy: ${String(masters)}`);\n }\n if (lifePathMethod !== \"kaabalistic\" && lifePathMethod !== \"straight-across\") {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown lifePathMethod: ${String(lifePathMethod)}`);\n }\n if (nameKind !== \"first-token\" && nameKind !== \"given-name\" && nameKind !== \"full-name\") {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown nameKind: ${String(nameKind)}`);\n }\n if (policy !== \"next-month-first\" && policy !== \"clamp\" && policy !== \"overflow\") {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown shortMonthPolicy: ${String(policy)}`);\n }\n\n const full = birth.kind === \"full\" ? birth.date : null;\n const anchor: Anchor | null =\n birth.kind === \"full\"\n ? { month: birth.date.month, day: birth.date.day, year: birth.date.year }\n : birth.kind === \"month-day\"\n ? { month: birth.month, day: birth.day, year: null }\n : null;\n\n const death = input.limits?.death ? resolveCivilDate(input.limits.death, \"death date\") : null;\n const horizon = input.limits?.horizonEndExclusive ? resolveCivilDate(input.limits.horizonEndExclusive, \"horizonEndExclusive\") : null;\n if (full && death && compareCivilDates(death, full) < 0) {\n throw new NumerologyScheduleError(\"INVALID_RANGE\", \"Death date is before the birth date\");\n }\n let coverageEnd: CivilDate | null = null;\n if (death) coverageEnd = addCivilDays(death, 1);\n if (horizon && (!coverageEnd || compareCivilDates(horizon, coverageEnd) < 0)) coverageEnd = horizon;\n\n const stages = full ? computeLifeStages(full, masters, input.lifeStages) : null;\n return {\n input,\n birth,\n full,\n anchor,\n masters,\n lifePathMethod,\n nameKind,\n policy,\n soul: resolveSoul(input.firstName, nameKind),\n lifePath: resolveLifePath(full, lifePathMethod, masters, birth.kind),\n death,\n horizon,\n coverageStart: full,\n coverageEnd,\n meta: buildMetadata(input, masters, lifePathMethod, nameKind, policy, death, horizon, stages),\n stages,\n };\n}\n\n/** Method identity for a set of options, without computing anything dated. */\nexport function getNumerologyMethodMetadata(options: Omit<ScheduleInput, \"birth\"> & { birth?: ScheduleInput[\"birth\"] } = {}): NumerologyMethodMetadata {\n return buildCtx({ ...options, birth: options.birth ?? { kind: \"unknown\" } }).meta;\n}\n\n// ---------------------------------------------------------------------------\n// Interval helpers\n// ---------------------------------------------------------------------------\n\nfunction mkInterval(ctx: Ctx, nominalStart: CivilDate, nominalEndInput: CivilDate | null, endBeyondCalendar = false): ScheduleIntervalBase | null {\n // Dates past year 9999 cannot be formatted: a start there means no interval,\n // an end there becomes an explicit null flagged `nominalEndBeyondCalendar`.\n if (nominalStart.year > MAX_CIVIL_YEAR) return null;\n let nominalEnd = nominalEndInput;\n let beyond = endBeyondCalendar;\n if (nominalEnd && nominalEnd.year > MAX_CIVIL_YEAR) {\n nominalEnd = null;\n beyond = true;\n }\n let start = nominalStart;\n let startClipped = false;\n if (ctx.coverageStart && compareCivilDates(start, ctx.coverageStart) < 0) {\n start = ctx.coverageStart;\n startClipped = true;\n }\n let end = nominalEnd;\n let endClipped = false;\n if (ctx.coverageEnd && (end === null || compareCivilDates(end, ctx.coverageEnd) > 0)) {\n end = ctx.coverageEnd;\n endClipped = true;\n }\n if (end !== null && compareCivilDates(start, end) >= 0) return null;\n return {\n start: fmt(start),\n endExclusive: end ? fmt(end) : null,\n nominalStart: fmt(nominalStart),\n nominalEndExclusive: nominalEnd ? fmt(nominalEnd) : null,\n ...(beyond ? { nominalEndBeyondCalendar: true as const } : {}),\n startClipped,\n endClipped,\n clipped: startClipped || endClipped,\n lengthDays: end ? diffCivilDays(start, end) : null,\n nominalLengthDays: nominalEnd ? diffCivilDays(nominalStart, nominalEnd) : null,\n };\n}\n\nfunction contains(iv: ScheduleIntervalBase, iso: string): boolean {\n return iv.start <= iso && (iv.endExclusive === null || iso < iv.endExclusive);\n}\n\nfunction overlaps(iv: ScheduleIntervalBase, from: string, toExclusive: string): boolean {\n return iv.start < toExclusive && (iv.endExclusive === null || iv.endExclusive > from);\n}\n\n/** Start of personal-month phase `j` (0-12) of the birthday year `y`. */\nfunction monthBoundary(\n anchor: Anchor,\n y: number,\n j: number,\n policy: ShortMonthPolicy\n): { date: CivilDate; adjusted: boolean; nominalText: string } {\n const absolute = y * 12 + (anchor.month - 1) + j;\n const yy = Math.floor(absolute / 12);\n const mm = (absolute % 12) + 1;\n const dim = daysInMonth(yy, mm);\n const nominalText = `${String(yy).padStart(4, \"0\")}-${String(mm).padStart(2, \"0\")}-${String(anchor.day).padStart(2, \"0\")}`;\n if (anchor.day <= dim) return { date: { year: yy, month: mm, day: anchor.day }, adjusted: false, nominalText };\n switch (policy) {\n case \"clamp\":\n return { date: { year: yy, month: mm, day: dim }, adjusted: true, nominalText };\n case \"overflow\":\n return { date: addCivilDays({ year: yy, month: mm, day: 1 }, anchor.day - 1), adjusted: true, nominalText };\n default:\n return { date: addCivilDays({ year: yy, month: mm, day: dim }, 1), adjusted: true, nominalText };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Birthday-year row\n// ---------------------------------------------------------------------------\n\ninterface YearRow {\n year: number;\n personalYear: PersonalYearInterval;\n months: PersonalMonthInterval[];\n periods: PersonalPeriodInterval[];\n heptads: HeptadInterval[];\n fibonacci: FibonacciInterval | null;\n}\n\nfunction ageCycleRef(completedAge: number | null): AgeCycleRef | null {\n if (completedAge === null || completedAge < 0) return null;\n const block = Math.floor(completedAge / 7);\n return { label: (block % 7) + 1, absoluteIndex: block, yearPosition: (completedAge % 7) + 1 };\n}\n\nfunction fibonacciValues(age: number): FibonacciInterval[\"cycles\"] {\n const s1 = reduceToSingleWithSteps(age);\n const s2 = reduceToSingleWithSteps(s1.reducedValue + 2);\n const s3 = reduceToSingleWithSteps(s1.reducedValue + s2.reductionSteps[0]);\n const s4 = reduceToSingleWithSteps(s2.reductionSteps[0] + s3.reductionSteps[0]);\n const s5 = reduceToSingleWithSteps(s3.reductionSteps[0] + s4.reductionSteps[0]);\n const s6 = reduceToSingleWithSteps(s4.reductionSteps[0] + s5.reductionSteps[0]);\n const s7 = reduceToSingleWithSteps(s5.reductionSteps[0] + s6.reductionSteps[0]);\n return [s1, s2, s3, s4, s5, s6, s7].map((s, i) => ({\n phase: i + 1,\n value: s.reducedValue,\n reductionSteps: s.reductionSteps,\n }));\n}\n\nfunction buildYearRow(ctx: Ctx, y: number): YearRow | null {\n const anchor = ctx.anchor;\n if (!anchor) return null;\n const start = anniversaryInYear({ year: 0, month: anchor.month, day: anchor.day }, y);\n const nominalEnd = anniversaryInYear({ year: 0, month: anchor.month, day: anchor.day }, y + 1);\n const yearBase = mkInterval(ctx, start, nominalEnd);\n if (!yearBase) return null;\n\n const completedAge = ctx.full ? y - ctx.full.year : null;\n const personalYearValue = red(ctx, anchor.day + anchor.month + y);\n const personalYear: PersonalYearInterval = {\n layer: \"personal-year\",\n ...yearBase,\n birthdayYear: y,\n completedAge,\n personalYear: personalYearValue,\n ageCycle: ageCycleRef(completedAge),\n };\n\n const bounds: CivilDate[] = [];\n const adjusted: boolean[] = [];\n const nominalTexts: string[] = [];\n for (let j = 0; j <= 12; j++) {\n if (j === 0) {\n bounds.push(start);\n adjusted.push(false);\n nominalTexts.push(fmt(start));\n } else if (j === 12) {\n bounds.push(nominalEnd);\n adjusted.push(false);\n nominalTexts.push(fmt(nominalEnd));\n } else {\n const b = monthBoundary(anchor, y, j, ctx.policy);\n bounds.push(b.date);\n adjusted.push(b.adjusted);\n nominalTexts.push(b.nominalText);\n }\n }\n\n const months: PersonalMonthInterval[] = [];\n for (let k = 0; k < 12; k++) {\n const iv = mkInterval(ctx, bounds[k], bounds[k + 1]);\n if (!iv) continue;\n const label = wrapMonth(anchor.month + k);\n months.push({\n layer: \"personal-month\",\n ...iv,\n birthdayYear: y,\n phase: k + 1,\n calendarMonth: label,\n intendedBirthDay: anchor.day,\n value: red(ctx, personalYearValue.value + label),\n startAdjusted: adjusted[k],\n nominalStartText: nominalTexts[k],\n shortMonthPolicy: ctx.policy,\n });\n }\n\n const periods: PersonalPeriodInterval[] = [];\n for (let p = 0; p < 3; p++) {\n const iv = mkInterval(ctx, bounds[p * 4], bounds[p * 4 + 4]);\n if (!iv) continue;\n let value: PersonalPeriodValue;\n if (p === 0) {\n value =\n completedAge === null\n ? unavailable(\"birth-year-unknown\", \"Period 1 needs the completed age, which needs the full birth date.\")\n : { available: true, ...red(ctx, y + completedAge), addend: completedAge, addendSource: \"completed-age\" };\n } else if (p === 1) {\n value = ctx.lifePath.available\n ? { available: true, ...red(ctx, y + ctx.lifePath.value), addend: ctx.lifePath.value, addendSource: \"life-path\" }\n : unavailable(ctx.lifePath.reason, \"Period 2 needs the life path, which needs the full birth date.\");\n } else {\n value = ctx.soul.available\n ? { available: true, ...red(ctx, y + ctx.soul.value), addend: ctx.soul.value, addendSource: \"first-name-soul-number\" }\n : ctx.soul;\n }\n periods.push({\n layer: \"personal-period\",\n ...iv,\n birthdayYear: y,\n phase: p + 1,\n monthPhases: [p * 4 + 1, p * 4 + 4],\n startCalendarMonth: wrapMonth(anchor.month + p * 4),\n endCalendarMonth: wrapMonth(anchor.month + p * 4 + 3),\n value,\n });\n }\n\n const heptads: HeptadInterval[] = [];\n for (let h = 0; h < 7; h++) {\n const hs = addCivilDays(start, h * 52);\n const he = h < 6 ? addCivilDays(start, (h + 1) * 52) : nominalEnd;\n const iv = mkInterval(ctx, hs, he);\n if (!iv) continue;\n heptads.push({ layer: \"heptad\", ...iv, birthdayYear: y, phase: h + 1, isRemainder: h === 6 });\n }\n\n const fibonacci: FibonacciInterval | null =\n completedAge !== null && completedAge >= 0\n ? { layer: \"fibonacci\", ...yearBase, birthdayYear: y, completedAge, cycles: fibonacciValues(completedAge) }\n : null;\n return { year: y, personalYear, months, periods, heptads, fibonacci };\n}\n\n/** Year of the most recent birthday on or before `date`, or null before the birth. */\nfunction birthdayYearOf(ctx: Ctx, date: CivilDate): number | null {\n const a = ctx.anchor;\n if (!a) return null;\n const anniv = anniversaryInYear({ year: 0, month: a.month, day: a.day }, date.year);\n const y = compareCivilDates(anniv, date) <= 0 ? date.year : date.year - 1;\n if (ctx.full && y < ctx.full.year) return null;\n if (y < 1) return null;\n return y;\n}\n\n// ---------------------------------------------------------------------------\n// Calendar frame\n// ---------------------------------------------------------------------------\n\nfunction calendarYearValue(ctx: Ctx, year: number): ReducedNumber {\n return red(ctx, ctx.anchor!.day + ctx.anchor!.month + year);\n}\n\nfunction calendarYearInterval(ctx: Ctx, year: number): CalendarYearInterval | null {\n const iv = mkInterval(ctx, { year, month: 1, day: 1 }, { year: year + 1, month: 1, day: 1 });\n return iv ? { layer: \"calendar-year\", ...iv, year, personalYear: calendarYearValue(ctx, year) } : null;\n}\n\nfunction calendarMonthInterval(ctx: Ctx, year: number, month: number): CalendarMonthInterval | null {\n const next = month === 12 ? { year: year + 1, month: 1, day: 1 } : { year, month: month + 1, day: 1 };\n const iv = mkInterval(ctx, { year, month, day: 1 }, next);\n if (!iv) return null;\n const py = calendarYearValue(ctx, year);\n return { layer: \"calendar-month\", ...iv, year, month, personalYear: py, personalMonth: red(ctx, py.value + month) };\n}\n\nfunction calendarDayInterval(ctx: Ctx, date: CivilDate): CalendarDayInterval | null {\n const iv = mkInterval(ctx, date, addCivilDays(date, 1));\n if (!iv) return null;\n const py = calendarYearValue(ctx, date.year);\n const pm = red(ctx, py.value + date.month);\n return { layer: \"calendar-day\", ...iv, date: fmt(date), personalYear: py, personalMonth: pm, personalDay: red(ctx, pm.value + date.day) };\n}\n\n// ---------------------------------------------------------------------------\n// Age cycles and life stages\n// ---------------------------------------------------------------------------\n\nfunction ageCycleInterval(ctx: Ctx, block: number): AgeCycleInterval | null {\n const birth = ctx.full!;\n const iv = mkInterval(ctx, anniversaryInYear(birth, birth.year + block * 7), anniversaryInYear(birth, birth.year + block * 7 + 7));\n return iv\n ? { layer: \"age-cycle\", ...iv, label: (block % 7) + 1, absoluteIndex: block, startAge: block * 7, endAgeExclusive: block * 7 + 7 }\n : null;\n}\n\nfunction stageIntervals(ctx: Ctx): {\n pinnacles: PinnacleInterval[];\n challenges: ChallengeInterval[];\n lifePeriods: LifePeriodInterval[];\n /** Spans whose start is past year 9999 (not datable), as `layer.index` entries. */\n skipped: UnavailableEntry[];\n} {\n const s = ctx.stages!;\n const pinnacles: PinnacleInterval[] = [];\n const challenges: ChallengeInterval[] = [];\n const lifePeriods: LifePeriodInterval[] = [];\n const skipped: UnavailableEntry[] = [];\n const make = (layer: string, p: LifeStageSpan): ScheduleIntervalBase | null => {\n if (p.start === null) {\n skipped.push({\n field: `${layer}.${p.index}`,\n reason: \"beyond-supported-calendar\",\n detail: `Starts at age ${p.startAge}, after the last supported calendar year (${MAX_CIVIL_YEAR}).`,\n });\n return null;\n }\n return mkInterval(ctx, p.start, p.nominalEndExclusive, p.nominalEndBeyondCalendar === true);\n };\n for (const p of s.pinnacles) {\n const iv = make(\"pinnacle\", p);\n if (iv) pinnacles.push({ layer: \"pinnacle\", ...iv, index: p.index, startAge: p.startAge, endAgeExclusive: p.endAgeExclusive, value: p.value });\n }\n for (const c of s.challenges) {\n const iv = make(\"challenge\", c);\n if (iv) challenges.push({ layer: \"challenge\", ...iv, index: c.index, isMain: c.isMain, startAge: c.startAge, endAgeExclusive: c.endAgeExclusive, value: c.value });\n }\n for (const l of s.lifePeriods) {\n const iv = make(\"life-period\", l);\n if (iv) lifePeriods.push({ layer: \"life-period\", ...iv, index: l.index, basis: l.basis, startAge: l.startAge, endAgeExclusive: l.endAgeExclusive, value: l.value });\n }\n return { pinnacles, challenges, lifePeriods, skipped };\n}\n\n// ---------------------------------------------------------------------------\n// Snapshot\n// ---------------------------------------------------------------------------\n\ntype UnavailableEntry = NumerologySnapshot[\"unavailable\"][number];\n\nfunction birthSummary(birth: NormalizedBirth): NumerologySnapshot[\"birth\"] {\n switch (birth.kind) {\n case \"full\":\n return { kind: \"full\", date: fmt(birth.date) };\n case \"month-day\":\n return { kind: \"month-day\", month: birth.month, day: birth.day };\n case \"year-month\":\n return { kind: \"year-month\", year: birth.year, month: birth.month };\n case \"year\":\n return { kind: \"year\", year: birth.year, approximate: birth.approximate };\n default:\n return { kind: \"unknown\" };\n }\n}\n\nfunction describeUnavailableBirth(ctx: Ctx): UnavailableEntry[] {\n const kind = ctx.birth.kind;\n const reason: Unavailable[\"reason\"] =\n kind === \"unknown\" ? \"birth-date-unknown\" : kind === \"year\" && ctx.birth.approximate ? \"birth-year-approximate\" : \"birth-day-or-month-unknown\";\n const detail =\n kind === \"year-month\"\n ? \"Birth day unknown: birthday-based personal cycles, heptads and the calendar frame need the birth day and month.\"\n : kind === \"year\"\n ? \"Only the birth year is known: birthday-based cycles need the birth day and month.\"\n : \"No birth date information: birthday-based cycles need at least the birth day and month.\";\n return [\n \"personalYear\",\n \"personalMonth\",\n \"personalPeriod\",\n \"heptad\",\n \"ageCycle\",\n \"fibonacci\",\n \"calendar\",\n \"lifeStages\",\n ].map((field) => ({ field, reason, detail }));\n}\n\nfunction completedAgeRange(birth: NormalizedBirth, asOf: CivilDate): { min: number; max: number } | null {\n if (birth.kind === \"year\" && !birth.approximate) {\n const diff = asOf.year - birth.year;\n return { min: Math.max(diff - 1, 0), max: Math.max(diff, 0) };\n }\n if (birth.kind === \"year-month\") {\n const diff = asOf.year - birth.year;\n if (asOf.month > birth.month) return { min: diff, max: diff };\n if (asOf.month < birth.month) return { min: Math.max(diff - 1, 0), max: Math.max(diff - 1, 0) };\n return { min: Math.max(diff - 1, 0), max: diff };\n }\n return null;\n}\n\nfunction emptySnapshot(ctx: Ctx, asOf: CivilDate, status: SnapshotStatus, unavailableEntries: UnavailableEntry[]): NumerologySnapshot {\n return {\n asOf: fmt(asOf),\n status,\n birth: birthSummary(ctx.birth),\n meta: ctx.meta,\n completedAge: null,\n completedAgeRange: completedAgeRange(ctx.birth, asOf),\n lastBirthdayYear: null,\n dayInBirthdayYear: null,\n fixedNumbers: { lifePath: ctx.lifePath, firstNameSoulNumber: ctx.soul },\n birthdayYear: null,\n personalMonth: null,\n personalPeriod: null,\n heptad: null,\n ageCycle: null,\n fibonacci: null,\n calendar: null,\n lifeStages: null,\n unavailable: unavailableEntries,\n };\n}\n\n/**\n * Everything active on one civil day.\n *\n * `input.birth` may be a full date (`\"YYYY-MM-DD\"` / `CivilDate`) or a\n * `PartialBirthDate`. Partial dates return `status: \"partial\"`: month/day\n * knowledge still yields the birthday-year frame, personal months, heptads and\n * calendar frame (age-dependent values are marked unavailable); year-only or\n * year/month knowledge yields `completedAgeRange` and structured reasons, and\n * never a guessed date.\n */\nexport function getNumerologySnapshot(input: ScheduleInput & { asOf: CivilDateInput }): NumerologySnapshot {\n const ctx = buildCtx(input);\n const asOf = resolveCivilDate(input.asOf, \"asOf\");\n const asOfIso = fmt(asOf);\n\n if (!ctx.anchor) {\n return emptySnapshot(ctx, asOf, \"partial\", describeUnavailableBirth(ctx));\n }\n if (ctx.full && compareCivilDates(asOf, ctx.full) < 0) {\n return emptySnapshot(ctx, asOf, \"before-birth\", [\n { field: \"all\", reason: \"before-birth\", detail: \"The as-of date is before the birth date.\" },\n ]);\n }\n if (ctx.death && compareCivilDates(asOf, ctx.death) > 0) {\n return emptySnapshot(ctx, asOf, \"after-death\", [\n { field: \"all\", reason: \"after-death\", detail: \"The as-of date is after the supplied death date.\" },\n ]);\n }\n if (ctx.horizon && compareCivilDates(asOf, ctx.horizon) >= 0) {\n return emptySnapshot(ctx, asOf, \"after-horizon\", [\n { field: \"all\", reason: \"after-horizon\", detail: \"The as-of date is at or after the horizon end.\" },\n ]);\n }\n\n const y = birthdayYearOf(ctx, asOf);\n const row = y === null ? null : buildYearRow(ctx, y);\n if (y === null || row === null) {\n return emptySnapshot(ctx, asOf, \"partial\", [\n { field: \"all\", reason: \"birth-year-unknown\", detail: \"No birthday year exists on or before the as-of date within the supported range.\" },\n ]);\n }\n const by = row.personalYear;\n const heptad = row.heptads.find((h) => contains(h, asOfIso)) ?? null;\n const unavailableEntries: UnavailableEntry[] = [];\n\n const period = row.periods.find((p) => contains(p, asOfIso)) ?? null;\n if (period && !period.value.available) {\n unavailableEntries.push({ field: `personalPeriod.${period.phase}`, reason: period.value.reason, detail: period.value.detail });\n }\n if (!ctx.full) {\n for (const field of [\"completedAge\", \"ageCycle\", \"fibonacci\", \"lifeStages\", \"fixedNumbers.lifePath\"]) {\n unavailableEntries.push({\n field,\n reason: \"birth-year-unknown\",\n detail: \"Needs the full birth date (the birth year is not known).\",\n });\n }\n }\n\n let ageCycle: NumerologySnapshot[\"ageCycle\"] = null;\n let lifeStages: NumerologySnapshot[\"lifeStages\"] = null;\n if (ctx.full && by.completedAge !== null) {\n const ref = by.ageCycle!;\n const block = ageCycleInterval(ctx, ref.absoluteIndex);\n if (block) ageCycle = { ...block, yearPosition: ref.yearPosition };\n const st = stageIntervals(ctx);\n unavailableEntries.push(...st.skipped);\n lifeStages = {\n pinnacle: st.pinnacles.find((p) => contains(p, asOfIso)) ?? null,\n challenge: st.challenges.find((p) => contains(p, asOfIso)) ?? null,\n lifePeriod: st.lifePeriods.find((p) => contains(p, asOfIso)) ?? null,\n mainChallenge: ctx.stages!.challenges[2].value,\n transition: {\n rule: ctx.stages!.transitionRule,\n lifePathForTransition: ctx.stages!.lifePathForTransition,\n firstPinnacleEndAge: ctx.stages!.firstPinnacleEndAge,\n },\n };\n }\n\n const cy = calendarYearValue(ctx, asOf.year);\n const cm = red(ctx, cy.value + asOf.month);\n const cd = red(ctx, cm.value + asOf.day);\n\n return {\n asOf: asOfIso,\n status: ctx.full ? \"ok\" : \"partial\",\n birth: birthSummary(ctx.birth),\n meta: ctx.meta,\n completedAge: by.completedAge,\n completedAgeRange: null,\n lastBirthdayYear: y,\n dayInBirthdayYear: diffCivilDays(parseIso(by.nominalStart), asOf) + 1,\n fixedNumbers: { lifePath: ctx.lifePath, firstNameSoulNumber: ctx.soul },\n birthdayYear: by,\n personalMonth: row.months.find((m) => contains(m, asOfIso)) ?? null,\n personalPeriod: period,\n heptad: heptad ? { ...heptad, dayInHeptad: diffCivilDays(parseIso(heptad.nominalStart), asOf) + 1 } : null,\n ageCycle,\n fibonacci: row.fibonacci,\n calendar: { personalYear: cy, personalMonth: cm, personalDay: cd },\n lifeStages,\n unavailable: unavailableEntries,\n };\n}\n\nfunction parseIso(iso: string): CivilDate {\n return { year: Number(iso.slice(0, 4)), month: Number(iso.slice(5, 7)), day: Number(iso.slice(8, 10)) };\n}\n\n// ---------------------------------------------------------------------------\n// Timeline\n// ---------------------------------------------------------------------------\n\nexport interface TimelineInput extends ScheduleInput {\n /** Inclusive start of the requested window. */\n from: CivilDateInput;\n /** Exclusive end of the requested window. */\n toExclusive: CivilDateInput;\n /** Layers to generate. Default `[\"personal-year\"]`. */\n layers?: TimelineLayer[];\n /** Interval budget (default 2000, at most 10000). Exceeding it throws `TOO_MANY_INTERVALS`; nothing is silently truncated. */\n maxIntervals?: number;\n}\n\nconst LAYER_ORDER = new Map(TIMELINE_LAYERS.map((l, i) => [l, i] as const));\nconst BIRTHDAY_ROW_LAYERS = new Set<TimelineLayer>([\"personal-year\", \"personal-month\", \"personal-period\", \"heptad\", \"fibonacci\"]);\nconst CALENDAR_LAYERS = new Set<TimelineLayer>([\"calendar-year\", \"calendar-month\", \"calendar-day\"]);\n\n/**\n * Bounded, sorted, half-open intervals overlapping `[from, toExclusive)`.\n * Intervals keep their real bounds (they are not cut at the window edges).\n */\nexport function generateNumerologyTimeline(input: TimelineInput): NumerologyTimeline {\n const ctx = buildCtx(input);\n const from = resolveCivilDate(input.from, \"from\");\n const to = resolveCivilDate(input.toExclusive, \"toExclusive\");\n const fromIso = fmt(from);\n const toIso = fmt(to);\n if (compareCivilDates(from, to) >= 0) {\n throw new NumerologyScheduleError(\"INVALID_RANGE\", \"toExclusive must be after from\");\n }\n if (diffCivilDays(from, to) > MAX_TIMELINE_RANGE_DAYS) {\n throw new NumerologyScheduleError(\"RANGE_TOO_LARGE\", `Timeline range is limited to ${MAX_TIMELINE_RANGE_DAYS} days`);\n }\n const maxIntervals = input.maxIntervals ?? DEFAULT_MAX_TIMELINE_INTERVALS;\n if (!Number.isInteger(maxIntervals) || maxIntervals < 1 || maxIntervals > MAX_TIMELINE_INTERVALS_HARD_CAP) {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `maxIntervals must be an integer 1-${MAX_TIMELINE_INTERVALS_HARD_CAP}`);\n }\n const layers = input.layers ?? [\"personal-year\"];\n if (!Array.isArray(layers) || layers.length === 0) {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", \"layers must be a non-empty array\");\n }\n for (const layer of layers) {\n if (!LAYER_ORDER.has(layer)) {\n throw new NumerologyScheduleError(\"INVALID_ARGUMENT\", `Unknown timeline layer: ${String(layer)}`);\n }\n }\n const wanted = [...new Set(layers)];\n const intervals: ScheduleInterval[] = [];\n const unavailableEntries: UnavailableEntry[] = [];\n const push = (iv: ScheduleInterval | null | undefined) => {\n if (!iv || !overlaps(iv, fromIso, toIso)) return;\n intervals.push(iv);\n if (intervals.length > maxIntervals) {\n throw new NumerologyScheduleError(\"TOO_MANY_INTERVALS\", `Timeline would exceed ${maxIntervals} intervals; narrow the range or layers`);\n }\n };\n\n const needsAnchor = wanted.filter((l) => BIRTHDAY_ROW_LAYERS.has(l) || CALENDAR_LAYERS.has(l));\n const needsFull = wanted.filter((l) => l === \"age-cycle\" || l === \"pinnacle\" || l === \"challenge\" || l === \"life-period\");\n const anchorReason = describeUnavailableBirth(ctx)[0];\n const fullReason: Pick<UnavailableEntry, \"reason\" | \"detail\"> =\n ctx.birth.kind === \"unknown\"\n ? { reason: \"birth-date-unknown\", detail: \"No birth date information.\" }\n : { reason: \"full-birth-date-required\", detail: \"This layer needs the full birth date.\" };\n\n if (!ctx.anchor) {\n for (const l of needsAnchor) unavailableEntries.push({ field: l, reason: anchorReason.reason, detail: anchorReason.detail });\n }\n if (!ctx.full) {\n for (const l of needsFull) unavailableEntries.push({ field: l, ...fullReason });\n if (ctx.anchor && wanted.includes(\"fibonacci\")) {\n unavailableEntries.push({ field: \"fibonacci\", reason: \"birth-year-unknown\", detail: \"Needs the completed age (full birth date).\" });\n }\n }\n\n const rowLayers = wanted.filter((l) => BIRTHDAY_ROW_LAYERS.has(l));\n if (ctx.anchor && rowLayers.length > 0) {\n const first = birthdayYearOf(ctx, from) ?? (ctx.full ? ctx.full.year : from.year - 1);\n for (let y = first; ; y++) {\n const start = anniversaryInYear({ year: 0, month: ctx.anchor.month, day: ctx.anchor.day }, y);\n if (compareCivilDates(start, to) >= 0 || (ctx.coverageEnd && compareCivilDates(start, ctx.coverageEnd) >= 0)) break;\n const row = buildYearRow(ctx, y);\n if (!row) continue;\n if (rowLayers.includes(\"personal-year\")) push(row.personalYear);\n if (rowLayers.includes(\"personal-month\")) row.months.forEach(push);\n if (rowLayers.includes(\"personal-period\")) row.periods.forEach(push);\n if (rowLayers.includes(\"heptad\")) row.heptads.forEach(push);\n if (rowLayers.includes(\"fibonacci\")) push(row.fibonacci);\n }\n }\n\n if (ctx.anchor) {\n if (wanted.includes(\"calendar-year\")) {\n for (let y = from.year; y <= to.year; y++) push(calendarYearInterval(ctx, y));\n }\n if (wanted.includes(\"calendar-month\")) {\n for (let y = from.year; y <= to.year; y++) for (let m = 1; m <= 12; m++) push(calendarMonthInterval(ctx, y, m));\n }\n if (wanted.includes(\"calendar-day\")) {\n let cursor = from;\n if (ctx.coverageStart && compareCivilDates(cursor, ctx.coverageStart) < 0) cursor = ctx.coverageStart;\n for (; compareCivilDates(cursor, to) < 0; cursor = addCivilDays(cursor, 1)) {\n if (ctx.coverageEnd && compareCivilDates(cursor, ctx.coverageEnd) >= 0) break;\n push(calendarDayInterval(ctx, cursor));\n }\n }\n }\n\n if (ctx.full) {\n if (wanted.includes(\"age-cycle\")) {\n const ageAtFrom = Math.max(completedYears(ctx.full, from), 0);\n for (let b = Math.floor(ageAtFrom / 7); ; b++) {\n const start = anniversaryInYear(ctx.full, ctx.full.year + b * 7);\n if (compareCivilDates(start, to) >= 0 || (ctx.coverageEnd && compareCivilDates(start, ctx.coverageEnd) >= 0)) break;\n push(ageCycleInterval(ctx, b));\n }\n }\n if (wanted.some((l) => l === \"pinnacle\" || l === \"challenge\" || l === \"life-period\")) {\n const st = stageIntervals(ctx);\n if (wanted.includes(\"pinnacle\")) st.pinnacles.forEach(push);\n if (wanted.includes(\"challenge\")) st.challenges.forEach(push);\n if (wanted.includes(\"life-period\")) st.lifePeriods.forEach(push);\n for (const u of st.skipped) if (wanted.includes(u.field.split(\".\")[0] as TimelineLayer)) unavailableEntries.push(u);\n }\n }\n\n intervals.sort(\n (a, b) =>\n a.start.localeCompare(b.start) ||\n (LAYER_ORDER.get(a.layer) ?? 0) - (LAYER_ORDER.get(b.layer) ?? 0) ||\n indexOf(a) - indexOf(b)\n );\n\n return {\n from: fromIso,\n toExclusive: toIso,\n layers: wanted,\n meta: ctx.meta,\n intervals,\n caps: { maxIntervals, maxRangeDays: MAX_TIMELINE_RANGE_DAYS },\n unavailable: unavailableEntries,\n };\n}\n\nfunction indexOf(iv: ScheduleInterval): number {\n switch (iv.layer) {\n case \"personal-month\":\n case \"personal-period\":\n case \"heptad\":\n return iv.phase;\n case \"pinnacle\":\n case \"challenge\":\n case \"life-period\":\n return iv.index;\n default:\n return 0;\n }\n}\n\n"]}
|