{"version":3,"sources":["../../src/datetime/types.ts","../../src/datetime/constants.ts","../../src/datetime/utils.ts","../../src/datetime/calc.ts","../../src/datetime/parse.ts","../../src/datetime/format.ts","../../src/datetime/relative.ts","../../src/datetime/timezone.ts","../../src/datetime/weton.ts"],"names":[],"mappings":";;;AAsBO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EAI1C,WAAA,CAAY,UAAkB,uBAAA,EAAyB;AACrD,IAAA,KAAA,CAAM,OAAO,CAAA;AAHf;AAAA,IAAA,IAAA,CAAS,IAAA,GAAO,cAAA;AAId,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AACF;AAiBO,IAAM,qBAAA,GAAN,cAAoC,KAAA,CAAM;AAAA,EAI/C,WAAA,CAAY,UAAkB,mCAAA,EAAqC;AACjE,IAAA,KAAA,CAAM,OAAO,CAAA;AAHf;AAAA,IAAA,IAAA,CAAS,IAAA,GAAO,oBAAA;AAId,IAAA,IAAA,CAAK,IAAA,GAAO,uBAAA;AAAA,EACd;AACF;;;AC/CO,IAAM,WAAA,GAAiC;AAAA,EAC5C,EAAA;AAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AAGO,IAAM,iBAAA,GAAuC;AAAA,EAClD,EAAA;AAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF;AAGO,IAAM,SAAA,GAA+B;AAAA,EAC1C,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QA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AAA;AAAA,EACA;AACF,CAAA;AA6BO,SAAS,SAAS,IAAA,EAAmB;AAC1C,EAAA,IAAI,CAAC,WAAA,CAAY,IAAI,CAAA,EAAG;AACtB,IAAA,MAAM,IAAI,iBAAiB,yCAAyC,CAAA;AAAA,EACtE;AAEA,EAAA,MAAM,WAAW,IAAA,CAAK,GAAA;AAAA,IACpB,KAAK,cAAA,EAAe;AAAA,IACpB,KAAK,WAAA,EAAY;AAAA,IACjB,KAAK,UAAA;AAAW,GAClB;AAEA,EAAA,MAAM,kBAAkB,IAAA,CAAK,KAAA;AAAA,IAAA,CAC1B,WAAW,eAAA,IAAmB;AAAA,GACjC;AAEA,EAAA,IAAI,kBAAkB,CAAA,EAAG;AACvB,IAAA,MAAM,IAAI,gBAAA;AAAA,MACR,CAAA,mEAAA,EAAsE,IAAA,CAAK,WAAA,EAAa,CAAA,CAAA;AAAA,KAC1F;AAAA,EACF;AAEA,EAAA,MAAM,aAAa,eAAA,GAAkB,gBAAA;AAErC,EAAA,MAAM,OAAA,GAAU,mBAAA,CAAoB,UAAA,GAAa,CAAC,CAAA;AAClD,EAAA,MAAM,OAAA,GAAU,mBAAA,CAAoB,UAAA,GAAa,CAAC,CAAA;AAClD,EAAA,MAAM,KAAA,GACJ,mBAAA,CAAoB,OAAO,CAAA,GAAI,oBAAoB,OAAO,CAAA;AAE5D,EAAA,OAAO,EAAE,OAAA,EAAS,OAAA,EAAS,KAAA,EAAM;AACnC","file":"index.cjs","sourcesContent":["/**\n * Custom error classes for datetime module\n *\n * @module datetime/types\n * @packageDocumentation\n */\n\n/**\n * Error thrown when an invalid date is provided to a function.\n * Extends native Error with a `code` property for programmatic error handling.\n *\n * @example\n * ```typescript\n * try {\n *   formatDate('invalid');\n * } catch (error) {\n *   if (error instanceof InvalidDateError) {\n *     console.log(error.code); // 'INVALID_DATE'\n *   }\n * }\n * ```\n */\nexport class InvalidDateError extends Error {\n  /** Error code for programmatic identification */\n  readonly code = 'INVALID_DATE' as const;\n\n  constructor(message: string = 'Invalid date provided') {\n    super(message);\n    this.name = 'InvalidDateError';\n  }\n}\n\n/**\n * Error thrown when an invalid date range is provided.\n * Extends native Error with a `code` property for programmatic error handling.\n *\n * @example\n * ```typescript\n * try {\n *   formatDateRange(new Date('2026-01-05'), new Date('2026-01-01'));\n * } catch (error) {\n *   if (error instanceof InvalidDateRangeError) {\n *     console.log(error.code); // 'INVALID_DATE_RANGE'\n *   }\n * }\n * ```\n */\nexport class InvalidDateRangeError extends Error {\n  /** Error code for programmatic identification */\n  readonly code = 'INVALID_DATE_RANGE' as const;\n\n  constructor(message: string = 'End date must be after start date') {\n    super(message);\n    this.name = 'InvalidDateRangeError';\n  }\n}\n\n/**\n * Date formatting style options\n */\nexport type DateStyle =\n  | 'full'\n  | 'long'\n  | 'medium'\n  | 'short'\n  | 'weekday'\n  | 'month';\n\n/**\n * Options for getAge function\n */\nexport interface AgeOptions {\n  /**\n   * Reference date to calculate age from.\n   * Defaults to current date at function call time.\n   * @defaultValue new Date()\n   */\n  fromDate?: Date | string | number;\n\n  /**\n   * Return age as formatted string instead of object.\n   * @defaultValue false\n   */\n  asString?: boolean;\n}\n\n/**\n * Age calculation result object\n */\nexport interface AgeResult {\n  /** Full years */\n  years: number;\n  /** Remaining months (0-11) */\n  months: number;\n  /** Remaining days (0-30) */\n  days: number;\n}\n\n/**\n * The five-day Javanese market cycle (pancawara / pasaran).\n *\n * Listed in canonical order starting from the wetonan anchor (Legi).\n */\nexport type Pasaran =\n  | 'Legi'\n  | 'Pahing'\n  | 'Pon'\n  | 'Wage'\n  | 'Kliwon';\n\n/**\n * Indonesian weekday name (saptawara).\n *\n * Listed in canonical Monday-first order. For indexing against the\n * wetonan anchor (which starts on Jumat / Friday) use the\n * `WETON_WEEKDAY_ORDER` constant exported from `weton.ts`.\n */\nexport type IndonesianWeekday =\n  | 'Senin'\n  | 'Selasa'\n  | 'Rabu'\n  | 'Kamis'\n  | 'Jumat'\n  | 'Sabtu'\n  | 'Minggu';\n\n/**\n * Javanese market-day information for a given Gregorian date.\n *\n * The `neptu` value is the sum of the weekday neptu and the pasaran\n * neptu and always lies in the inclusive range `[7, 18]`.\n *\n * @see getWeton\n */\nexport interface Weton {\n  /** The five-day market cycle position */\n  pasaran: Pasaran;\n  /** The Indonesian weekday name */\n  weekday: IndonesianWeekday;\n  /** Combined neptu value, integer in [7, 18] */\n  neptu: number;\n}\n","/**\n * Constants for Indonesian datetime formatting\n *\n * @module datetime/constants\n * @packageDocumentation\n */\n\n/** Full Indonesian month names (1-indexed: index 0 = empty, 1 = Januari) */\nexport const MONTH_NAMES: readonly string[] = [\n  '', // Placeholder for 0-index\n  'Januari',\n  'Februari',\n  'Maret',\n  'April',\n  'Mei',\n  'Juni',\n  'Juli',\n  'Agustus',\n  'September',\n  'Oktober',\n  'November',\n  'Desember',\n];\n\n/** Short Indonesian month names (3-letter abbreviation) */\nexport const MONTH_NAMES_SHORT: readonly string[] = [\n  '', // Placeholder for 0-index\n  'Jan',\n  'Feb',\n  'Mar',\n  'Apr',\n  'Mei',\n  'Jun',\n  'Jul',\n  'Agu',\n  'Sep',\n  'Okt',\n  'Nov',\n  'Des',\n];\n\n/** Full Indonesian day names */\nexport const DAY_NAMES: readonly string[] = [\n  'Minggu',\n  'Senin',\n  'Selasa',\n  'Rabu',\n  'Kamis',\n  'Jumat',\n  'Sabtu',\n];\n\n/** Short Indonesian day names (3-letter abbreviation) */\nexport const DAY_NAMES_SHORT: readonly string[] = [\n  'Min',\n  'Sen',\n  'Sel',\n  'Rab',\n  'Kam',\n  'Jum',\n  'Sab',\n];\n\n/** Mapping of IANA timezone names to Indonesian abbreviations */\nexport const TIMEZONE_MAP: Readonly<Record<string, 'WIB' | 'WITA' | 'WIT'>> = {\n  // UTC+7 - WIB\n  'Asia/Jakarta': 'WIB',\n  'Asia/Pontianak': 'WIB',\n\n  // UTC+8 - WITA\n  'Asia/Makassar': 'WITA',\n  'Asia/Denpasar': 'WITA',\n  'Asia/Manado': 'WITA',\n  'Asia/Palu': 'WITA',\n\n  // UTC+9 - WIT\n  'Asia/Jayapura': 'WIT',\n};\n\n/** Valid UTC offset hours that map to Indonesian timezones */\nexport const VALID_UTC_OFFSETS: readonly number[] = [7, 8, 9];\n","/**\n * Internal utilities for datetime module\n *\n * @module datetime/utils\n */\n\nimport { InvalidDateError } from './types';\n\n/**\n * Normalize various date input types to a Date object.\n *\n * @param date - Date input (Date, string, or number timestamp)\n * @returns Date object\n * @throws {InvalidDateError} If the input cannot be parsed to a valid date\n */\nexport function normalizeDate(date: Date | string | number): Date {\n  let result: Date;\n\n  if (date instanceof Date) {\n    result = date;\n  } else if (typeof date === 'number') {\n    result = new Date(date);\n  } else if (typeof date === 'string') {\n    result = new Date(date);\n  } else {\n    throw new InvalidDateError('Date must be a Date, string, or number');\n  }\n\n  if (Number.isNaN(result.getTime())) {\n    throw new InvalidDateError(`Unable to parse date: ${String(date)}`);\n  }\n\n  return result;\n}","/**\n * Date calculation utilities\n *\n * @module datetime/calc\n * @packageDocumentation\n */\n\nimport { normalizeDate } from './utils';\nimport { InvalidDateError } from './types';\n\n/**\n * Check if a year is a leap year.\n *\n * A year is a leap year if:\n * - Divisible by 4, but not by 100, OR\n * - Divisible by 400\n *\n * @param year - The year to check\n * @returns `true` if leap year, `false` otherwise (including invalid inputs)\n *\n * @example\n * ```typescript\n * isLeapYear(2024); // true\n * isLeapYear(2023); // false\n * isLeapYear(1900); // false (divisible by 100 but not 400)\n * isLeapYear(2000); // true (divisible by 400)\n * isLeapYear(NaN);  // false\n * isLeapYear(3.5);  // false (non-integer)\n * ```\n */\nexport function isLeapYear(year: number): boolean {\n  // Return false for non-finite, non-integer, or NaN values\n  if (!Number.isFinite(year) || !Number.isInteger(year)) {\n    return false;\n  }\n\n  return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\n/**\n * Get the number of days in a month.\n *\n * Accounts for leap years in February.\n *\n * @param month - Month number (1-12, 1-indexed)\n * @param year - Full year (e.g., 2026)\n * @returns Number of days in the month, or 0 for invalid inputs\n *\n * @example\n * ```typescript\n * daysInMonth(1, 2026);  // 31 (January)\n * daysInMonth(2, 2024);  // 29 (February, leap year)\n * daysInMonth(2, 2023);  // 28 (February, non-leap year)\n * daysInMonth(4, 2026);  // 30 (April)\n * daysInMonth(13, 2026); // 0 (invalid month)\n * daysInMonth(2, NaN);   // 0 (invalid year)\n * ```\n */\nexport function daysInMonth(month: number, year: number): number {\n  // Validate inputs\n  if (\n    !Number.isFinite(month) ||\n    !Number.isInteger(month) ||\n    !Number.isFinite(year) ||\n    !Number.isInteger(year) ||\n    month < 1 ||\n    month > 12\n  ) {\n    return 0;\n  }\n\n  // Months with 31 days: Jan(1), Mar(3), May(5), Jul(7), Aug(8), Oct(10), Dec(12)\n  if ([1, 3, 5, 7, 8, 10, 12].includes(month)) {\n    return 31;\n  }\n\n  // Months with 30 days: Apr(4), Jun(6), Sep(9), Nov(11)\n  if ([4, 6, 9, 11].includes(month)) {\n    return 30;\n  }\n\n  // February - check for leap year\n  return isLeapYear(year) ? 29 : 28;\n}\n\n/**\n * Type guard to check if a value is a valid Date object.\n *\n * Returns `true` only for Date instances that represent a valid date\n * (i.e., not `Invalid Date`). Returns `false` for null, undefined,\n * invalid dates, and non-Date values.\n *\n * @param date - Value to check\n * @returns `true` if valid Date object, `false` otherwise\n *\n * @example\n * ```typescript\n * isValidDate(new Date());           // true\n * isValidDate(new Date('invalid'));  // false\n * isValidDate(null);                 // false\n * isValidDate(undefined);            // false\n * isValidDate('2024-01-01');         // false (string, not Date)\n * isValidDate(1704067200000);        // false (number, not Date)\n * ```\n */\nexport function isValidDate(date: unknown): date is Date {\n  return date instanceof Date && !Number.isNaN(date.getTime());\n}\n\n/**\n * Check if a date falls on a weekend (Saturday or Sunday).\n *\n * Note: This only checks Saturday/Sunday and does not account for\n * industry-specific Saturday work schedules.\n *\n * @param date - Date object to check\n * @returns `true` if Saturday or Sunday, `false` otherwise\n *\n * @example\n * ```typescript\n * isWeekend(new Date('2026-01-03')); // true (Saturday)\n * isWeekend(new Date('2026-01-04')); // true (Sunday)\n * isWeekend(new Date('2026-01-05')); // false (Monday)\n * ```\n */\nexport function isWeekend(date: Date): boolean {\n  const day = date.getDay();\n  return day === 0 || day === 6; // Sunday = 0, Saturday = 6\n}\n\n/**\n * Check if a date falls on a working day (Monday-Friday).\n *\n * Note: This only checks Monday-Friday and does not account for\n * national holidays (holiday lists require periodic updates and\n * are not included per project mandates).\n *\n * @param date - Date object to check\n * @returns `true` if Monday-Friday, `false` otherwise\n *\n * @example\n * ```typescript\n * isWorkingDay(new Date('2026-01-05')); // true (Monday)\n * isWorkingDay(new Date('2026-01-03')); // false (Saturday)\n * isWorkingDay(new Date('2026-01-04')); // false (Sunday)\n * ```\n */\nexport function isWorkingDay(date: Date): boolean {\n  const day = date.getDay();\n  return day >= 1 && day <= 5; // Monday = 1 to Friday = 5\n}\n\n/**\n * Calculate age from a birth date.\n *\n * Accounts for leap years and month length variations.\n * Can return as an object { years, months, days } or as a formatted string.\n *\n * @param birthDate - Birth date (Date, string, or number timestamp)\n * @param options - Options for age calculation\n * @returns Age as object or formatted string (based on asString option)\n * @throws {InvalidDateError} If birthDate or fromDate is invalid\n *\n * @example\n * ```typescript\n * // Get age as object\n * getAge('1990-06-15'); // { years: 36, months: 9, days: 21 }\n * getAge(new Date('1990-06-15'), { fromDate: new Date('2024-06-15') });\n * // { years: 34, months: 0, days: 0 }\n *\n * // Get age as string\n * getAge('1990-06-15', { asString: true });\n * // '36 Tahun 9 Bulan 21 Hari'\n *\n * getAge(new Date('2020-01-01'), { fromDate: new Date('2020-01-15'), asString: true });\n * // '15 Hari'\n * ```\n */\nexport function getAge(\n  birthDate: Date | string | number,\n  options: { fromDate?: Date | string | number; asString?: boolean } = {}\n): { years: number; months: number; days: number } | string {\n  const birth = normalizeDate(birthDate);\n  const from = options.fromDate ? normalizeDate(options.fromDate) : new Date();\n\n  // Validate: birth date cannot be in the future\n  if (birth.getTime() > from.getTime()) {\n    throw new InvalidDateError(\n      'Birth date cannot be in the future relative to fromDate'\n    );\n  }\n\n  let years = from.getFullYear() - birth.getFullYear();\n  let months = from.getMonth() - birth.getMonth();\n  let days = from.getDate() - birth.getDate();\n\n  // Adjust for negative days\n  if (days < 0) {\n    months--;\n    // Get days in previous month\n    const prevMonth = from.getMonth() === 0 ? 11 : from.getMonth() - 1;\n    const prevMonthYear =\n      from.getMonth() === 0 ? from.getFullYear() - 1 : from.getFullYear();\n    days += daysInMonth(prevMonth + 1, prevMonthYear);\n  }\n\n  // Adjust for negative months\n  if (months < 0) {\n    years--;\n    months += 12;\n  }\n\n  const result = { years, months, days };\n\n  if (options.asString) {\n    return formatAgeString(result);\n  }\n\n  return result;\n}\n\n/**\n * Format age object as Indonesian string.\n * Omits zero components.\n *\n * @param age - Age object with years, months, days\n * @returns Formatted age string\n */\nfunction formatAgeString(age: {\n  years: number;\n  months: number;\n  days: number;\n}): string {\n  const parts: string[] = [];\n\n  if (age.years > 0) {\n    parts.push(`${age.years} Tahun`);\n  }\n\n  if (age.months > 0) {\n    parts.push(`${age.months} Bulan`);\n  }\n\n  if (age.days > 0) {\n    parts.push(`${age.days} Hari`);\n  }\n\n  // Handle edge case: all zeros (same day)\n  if (parts.length === 0) {\n    return '0 Hari';\n  }\n\n  return parts.join(' ');\n}\n\n/**\n * Add (or subtract) a number of working days to a date, skipping\n * Saturdays and Sundays.\n *\n * National holidays are intentionally **not** considered. A holiday\n * calendar would require volatile government-decree data and is out\n * of scope (see `mandates.md`).\n *\n * The semantics are: advance the date by `count` calendar days, and\n * if the resulting day is a weekend, snap forward (positive `count`)\n * or backward (negative `count`) to the nearest weekday. This\n * matches the industry-standard `date-fns` behaviour.\n *\n * - `count === 0` returns a new Date equal to the input (no snap).\n * - For non-zero `count`, the result is always a Monday through\n *   Friday.\n *\n * **Note on pre-weekend inputs**: a date that already lands on a\n * weekend is advanced by `count` calendar days from that weekend day\n * (not snapped first), then snapped to a weekday. So\n * `addBusinessDays(Saturday, 1) === next Monday`.\n *\n * @param date - Starting date.\n * @param count - Working days to move. Positive moves forward, negative\n *   moves backward, `0` returns a new Date equal to the input.\n * @returns A new Date representing the resulting working day.\n * @throws {InvalidDateError} If `date` is not a valid Date instance.\n *\n * @example\n * ```typescript\n * // Friday + 1 working day = next Monday\n * addBusinessDays(new Date('2026-01-09'), 1);\n * // -> Date for 2026-01-12 (Monday)\n *\n * // Wednesday + 2 working days = Friday (weekend not crossed)\n * addBusinessDays(new Date('2026-01-07'), 2);\n * // -> Date for 2026-01-09 (Friday)\n *\n * // Monday - 1 working day = previous Friday\n * addBusinessDays(new Date('2026-01-12'), -1);\n * // -> Date for 2026-01-09 (Friday)\n * ```\n */\nexport function addBusinessDays(date: Date, count: number): Date {\n  if (!isValidDate(date)) {\n    throw new InvalidDateError(\n      'addBusinessDays requires a valid Date instance'\n    );\n  }\n\n  if (count === 0) {\n    return new Date(date.getTime());\n  }\n\n  const result = new Date(date.getTime());\n  result.setDate(result.getDate() + count);\n\n  if (!isWeekend(result)) {\n    return result;\n  }\n\n  // Snap to nearest weekday in the direction of motion.\n  if (count > 0) {\n    while (isWeekend(result)) {\n      result.setDate(result.getDate() + 1);\n    }\n  } else {\n    while (isWeekend(result)) {\n      result.setDate(result.getDate() - 1);\n    }\n  }\n\n  return result;\n}\n","/**\n * Date parsing utilities for Indonesian formats\n *\n * @module datetime/parse\n * @packageDocumentation\n */\n\nimport { daysInMonth } from './calc';\n\n/**\n * Parse a date string in Indonesian format (DD-MM-YYYY) or ISO format (YYYY-MM-DD).\n *\n * Strict parsing rules:\n * - Accepts delimiters: `/`, `-`, `.`\n * - DD-MM-YYYY format: Day first (1-31), 4-digit year required\n * - ISO auto-detection: If first segment is 4 digits AND > 31, treated as YYYY-MM-DD\n * - Leap year validation: Feb 29 is only valid in leap years\n * - 2-digit years NOT supported\n * - Time components NOT supported\n *\n * @param dateStr - Date string to parse\n * @returns Date object if valid, `null` if invalid\n *\n * @example\n * ```typescript\n * // Indonesian format (DD-MM-YYYY)\n * parseDate('02-01-2026');    // Date(2026, 0, 2) - Jan 2, 2026\n * parseDate('02/01/2026');    // Date(2026, 0, 2)\n * parseDate('02.01.2026');    // Date(2026, 0, 2)\n *\n * // ISO format auto-detected (YYYY-MM-DD)\n * parseDate('2026-01-02');    // Date(2026, 0, 2)\n *\n * // Invalid inputs return null\n * parseDate('29-02-2023');    // null (not a leap year)\n * parseDate('02-01-26');      // null (2-digit year)\n * parseDate('02-01-2026 14:30'); // null (time component)\n * parseDate('invalid');       // null\n * ```\n */\nexport function parseDate(dateStr: string): Date | null {\n  // Trim whitespace\n  const trimmed = dateStr.trim();\n\n  // Reject if empty\n  if (!trimmed) {\n    return null;\n  }\n\n  // Reject if contains time component (has space or colon)\n  if (trimmed.includes(' ') || trimmed.includes(':')) {\n    return null;\n  }\n\n  // Split by supported delimiters: / - .\n  const parts = trimmed.split(/[-/.]/);\n\n  // Must have exactly 3 parts\n  if (parts.length !== 3) {\n    return null;\n  }\n\n  // Parse all segments as integers\n  const nums = parts.map((p) => parseInt(p, 10));\n\n  // Check for NaN or negative values\n  if (nums.some((n) => Number.isNaN(n) || n < 0)) {\n    return null;\n  }\n\n  // Check for 2-digit years (any segment < 100 after the first position)\n  // First segment can be < 100 (day) or > 31 (year in ISO format)\n  const [first, second, third] = nums;\n\n  // Determine format: ISO (YYYY-MM-DD) or Indonesian (DD-MM-YYYY)\n  let day: number;\n  let month: number;\n  let year: number;\n\n  // ISO format detection: first segment is 4 digits AND > 31 (must be a year)\n  if (first > 999 && first > 31) {\n    // ISO format: YYYY-MM-DD\n    year = first;\n    month = second;\n    day = third;\n  } else {\n    // Indonesian format: DD-MM-YYYY\n    // Validate that third segment is 4 digits (year)\n    if (third < 1000) {\n      return null; // 2-digit year not supported\n    }\n\n    day = first;\n    month = second;\n    year = third;\n  }\n\n  // Validate month range (1-12)\n  if (month < 1 || month > 12) {\n    return null;\n  }\n\n  // Validate year is reasonable (positive and 4 digits)\n  if (year < 1000 || year > 9999) {\n    return null;\n  }\n\n  // Validate day against month length\n  const maxDays = daysInMonth(month, year);\n  if (maxDays === 0 || day < 1 || day > maxDays) {\n    return null;\n  }\n\n  // Create date (month is 0-indexed in JS Date)\n  const date = new Date(year, month - 1, day);\n\n  // Final validation: ensure the date was created correctly\n  // (catches edge cases like Feb 30 being converted to Mar 2)\n  if (\n    date.getFullYear() !== year ||\n    date.getMonth() !== month - 1 ||\n    date.getDate() !== day\n  ) {\n    return null;\n  }\n\n  return date;\n}\n","/**\n * Date formatting utilities for Indonesian locale\n *\n * @module datetime/format\n * @packageDocumentation\n */\n\nimport { InvalidDateError, InvalidDateRangeError, type DateStyle } from './types';\nimport { MONTH_NAMES, MONTH_NAMES_SHORT, DAY_NAMES } from './constants';\nimport { normalizeDate } from './utils';\n\n/**\n * Format a date with Indonesian locale.\n *\n * @param date - Date to format (Date, string, or number timestamp in milliseconds)\n * @param style - Formatting style (default: 'long')\n * @returns Formatted date string\n * @throws {InvalidDateError} If the date is invalid\n *\n * @example\n * ```typescript\n * formatDate(new Date('2026-01-02'), 'full');   // 'Jumat, 2 Januari 2026'\n * formatDate(new Date('2026-01-02'), 'long');   // '2 Januari 2026'\n * formatDate(new Date('2026-01-02'), 'medium'); // '2 Jan 2026'\n * formatDate(new Date('2026-01-02'), 'short');  // '02/01/2026'\n * formatDate(new Date('2026-01-02'), 'weekday'); // 'Jumat'\n * formatDate(new Date('2026-01-02'), 'month');  // 'Januari'\n * ```\n */\nexport function formatDate(\n  date: Date | string | number,\n  style: DateStyle = 'long'\n): string {\n  const d = normalizeDate(date);\n\n  const day = d.getDate();\n  const month = d.getMonth() + 1; // 1-indexed\n  const year = d.getFullYear();\n  const dayOfWeek = d.getDay(); // 0 = Sunday\n\n  switch (style) {\n    case 'full':\n      return `${DAY_NAMES[dayOfWeek]}, ${day} ${MONTH_NAMES[month]} ${year}`;\n\n    case 'long':\n      return `${day} ${MONTH_NAMES[month]} ${year}`;\n\n    case 'medium':\n      return `${day} ${MONTH_NAMES_SHORT[month]} ${year}`;\n\n    case 'short': {\n      const dd = String(day).padStart(2, '0');\n      const mm = String(month).padStart(2, '0');\n      return `${dd}/${mm}/${year}`;\n    }\n\n    case 'weekday':\n      return DAY_NAMES[dayOfWeek];\n\n    case 'month':\n      return MONTH_NAMES[month];\n\n    default:\n      throw new InvalidDateError(`Unknown format style: ${style}`);\n  }\n}\n\n/**\n * Format a date range with Indonesian locale and smart redundancy removal.\n *\n * Removes redundant month/year information when dates share them.\n *\n * @param start - Start date\n * @param end - End date\n * @param style - Formatting style (default: 'long')\n * @returns Formatted date range string\n * @throws {InvalidDateError} If either date is invalid\n * @throws {InvalidDateRangeError} If end date is before start date\n *\n * @example\n * ```typescript\n * // Same day\n * formatDateRange(\n *   new Date('2026-01-02'),\n *   new Date('2026-01-02')\n * ); // '2 Januari 2026'\n *\n * // Same month & year\n * formatDateRange(\n *   new Date('2026-01-02'),\n *   new Date('2026-01-05')\n * ); // '2 - 5 Januari 2026'\n *\n * // Same year\n * formatDateRange(\n *   new Date('2026-01-30'),\n *   new Date('2026-02-02')\n * ); // '30 Januari - 2 Februari 2026'\n *\n * // Different year\n * formatDateRange(\n *   new Date('2025-12-30'),\n *   new Date('2026-01-02')\n * ); // '30 Desember 2025 - 2 Januari 2026'\n * ```\n */\nexport function formatDateRange(\n  start: Date,\n  end: Date,\n  style: Exclude<DateStyle, 'weekday' | 'month'> = 'long'\n): string {\n  const s = normalizeDate(start);\n  const e = normalizeDate(end);\n\n  // Validate range\n  if (e.getTime() < s.getTime()) {\n    throw new InvalidDateRangeError();\n  }\n\n  // Short style: no redundancy removal, always full format\n  if (style === 'short') {\n    return `${formatDate(s, 'short')} - ${formatDate(e, 'short')}`;\n  }\n\n  // Full style: full weekday + date for both\n  if (style === 'full') {\n    return `${formatDate(s, 'full')} - ${formatDate(e, 'full')}`;\n  }\n\n  // Extract components\n  const sDay = s.getDate();\n  const eDay = e.getDate();\n  const sMonth = s.getMonth() + 1;\n  const eMonth = e.getMonth() + 1;\n  const sYear = s.getFullYear();\n  const eYear = e.getFullYear();\n\n  // Same day: show single date\n  if (sDay === eDay && sMonth === eMonth && sYear === eYear) {\n    return formatDate(s, style);\n  }\n\n  // Different year: full format for both\n  if (sYear !== eYear) {\n    return `${formatDate(s, style)} - ${formatDate(e, style)}`;\n  }\n\n  // Same year, different month: omit year from start date\n  if (sMonth !== eMonth) {\n    if (style === 'long') {\n      return `${sDay} ${MONTH_NAMES[sMonth]} - ${eDay} ${MONTH_NAMES[eMonth]} ${eYear}`;\n    }\n    // medium style\n    return `${sDay} ${MONTH_NAMES_SHORT[sMonth]} - ${eDay} ${MONTH_NAMES_SHORT[eMonth]} ${eYear}`;\n  }\n\n  // Same month & year: show range with single month/year\n  if (style === 'long') {\n    return `${sDay} - ${eDay} ${MONTH_NAMES[eMonth]} ${eYear}`;\n  }\n  // medium style\n  return `${sDay} - ${eDay} ${MONTH_NAMES_SHORT[eMonth]} ${eYear}`;\n}\n","/**\n * Relative time formatting for Indonesian locale\n *\n * @module datetime/relative\n * @packageDocumentation\n */\n\nimport { formatDate } from './format';\nimport { normalizeDate } from './utils';\n\n/**\n * Format a date as relative time in Indonesian.\n *\n * Returns human-readable relative time like \"Baru saja\", \"X menit yang lalu\",\n * \"Kemarin\", or falls back to formatted date for older dates.\n *\n * @param date - Date to format (Date, string, or number timestamp in milliseconds)\n * @param baseDate - Reference date for comparison (default: current date)\n * @returns Relative time string in Indonesian\n * @throws {InvalidDateError} If either date is invalid\n *\n * @example\n * ```typescript\n * // Assuming today is 2026-01-02 12:00:00\n * toRelativeTime(new Date('2026-01-02 11:59:00')); // 'Baru saja'\n * toRelativeTime(new Date('2026-01-02 11:00:00')); // '1 jam yang lalu'\n * toRelativeTime(new Date('2026-01-01 12:00:00')); // 'Kemarin'\n * toRelativeTime(new Date('2025-12-30 12:00:00')); // '3 hari yang lalu'\n * toRelativeTime(new Date('2025-12-01 12:00:00')); // '1 Desember 2025'\n * ```\n */\nexport function toRelativeTime(\n  date: Date | string | number,\n  baseDate: Date = new Date()\n): string {\n  const d = normalizeDate(date);\n  const base = normalizeDate(baseDate);\n\n  const diffMs = d.getTime() - base.getTime();\n  const diffSec = Math.floor(diffMs / 1000);\n  const diffMin = Math.floor(diffMs / (1000 * 60));\n  const diffHour = Math.floor(diffMs / (1000 * 60 * 60));\n  const diffDay = Math.floor(diffMs / (1000 * 60 * 60 * 24));\n\n  // Exact match\n  if (diffMs === 0) {\n    return 'Sekarang';\n  }\n\n  // Future dates\n  if (diffMs > 0) {\n    // < 1 minute\n    if (diffSec < 60) {\n      return 'Baru saja';\n    }\n\n    // < 60 minutes\n    if (diffMin < 60) {\n      return `${diffMin} menit lagi`;\n    }\n\n    // < 24 hours\n    if (diffHour < 24) {\n      return `${diffHour} jam lagi`;\n    }\n\n    // 1 day (24-48 hours)\n    if (diffHour < 48) {\n      return 'Besok';\n    }\n\n    // 2-30 days\n    if (diffDay <= 30) {\n      return `${diffDay} hari lagi`;\n    }\n\n    // > 30 days: fallback to formatted date\n    return formatDate(d, 'long');\n  }\n\n  // Past dates\n  const absDiffSec = Math.abs(diffSec);\n  const absDiffMin = Math.abs(diffMin);\n  const absDiffHour = Math.abs(diffHour);\n  const absDiffDay = Math.abs(diffDay);\n\n  // < 1 minute\n  if (absDiffSec < 60) {\n    return 'Baru saja';\n  }\n\n  // < 60 minutes\n  if (absDiffMin < 60) {\n    return `${absDiffMin} menit yang lalu`;\n  }\n\n  // < 24 hours\n  if (absDiffHour < 24) {\n    return `${absDiffHour} jam yang lalu`;\n  }\n\n  // 1 day (24-48 hours)\n  if (absDiffHour < 48) {\n    return 'Kemarin';\n  }\n\n  // 2-30 days\n  if (absDiffDay <= 30) {\n    return `${absDiffDay} hari yang lalu`;\n  }\n\n  // > 30 days: fallback to formatted date\n  return formatDate(d, 'long');\n}\n","/**\n * Timezone utilities for Indonesian locale\n *\n * @module datetime/timezone\n * @packageDocumentation\n */\n\nimport { TIMEZONE_MAP } from './constants';\n\n/**\n * Map IANA timezone names or UTC offsets to Indonesian abbreviations (WIB/WITA/WIT).\n *\n * Supported mappings:\n * - UTC+7 / Asia/Jakarta / Asia/Pontianak → \"WIB\"\n * - UTC+8 / Asia/Makassar / Asia/Denpasar → \"WITA\"\n * - UTC+9 / Asia/Jayapura → \"WIT\"\n *\n * @param input - IANA timezone name (case-sensitive), offset in hours, or offset string\n * @returns Indonesian timezone abbreviation or null if not Indonesian\n *\n * @example\n * ```typescript\n * // IANA timezone names\n * getIndonesianTimezone('Asia/Jakarta');    // 'WIB'\n * getIndonesianTimezone('Asia/Makassar');   // 'WITA'\n * getIndonesianTimezone('Asia/Jayapura');   // 'WIT'\n *\n * // Offset as number (hours)\n * getIndonesianTimezone(7);                 // 'WIB'\n * getIndonesianTimezone(8);                 // 'WITA'\n * getIndonesianTimezone(9);                 // 'WIT'\n *\n * // Offset as string\n * getIndonesianTimezone('+07:00');          // 'WIB'\n * getIndonesianTimezone('+0700');           // 'WIB'\n * getIndonesianTimezone('+08:00');          // 'WITA'\n *\n * // Non-Indonesian returns null\n * getIndonesianTimezone('America/New_York'); // null\n * getIndonesianTimezone(-5);                 // null\n * ```\n */\nexport function getIndonesianTimezone(\n  input: string | number\n): 'WIB' | 'WITA' | 'WIT' | null {\n  // Handle number input (offset in hours)\n  if (typeof input === 'number') {\n    if (!Number.isFinite(input) || !Number.isInteger(input)) {\n      return null;\n    }\n\n    switch (input) {\n      case 7:\n        return 'WIB';\n      case 8:\n        return 'WITA';\n      case 9:\n        return 'WIT';\n      default:\n        return null;\n    }\n  }\n\n  // Handle string input\n  if (typeof input !== 'string') {\n    return null;\n  }\n\n  const trimmed = input.trim();\n\n  // Check if it's an offset string (+07:00, +0700, -05:00, etc.)\n  const offsetMatch = trimmed.match(/^([+-])(\\d{2}):?(\\d{2})$/);\n  if (offsetMatch) {\n    const sign = offsetMatch[1];\n    const hours = parseInt(offsetMatch[2], 10);\n    const minutes = parseInt(offsetMatch[3], 10);\n\n    // Indonesian timezones are all positive (UTC+)\n    if (sign === '-') {\n      return null;\n    }\n\n    // Validate format (must be exactly on the hour, no minutes)\n    if (minutes !== 0) {\n      return null;\n    }\n\n    // Map to Indonesian timezone\n    switch (hours) {\n      case 7:\n        return 'WIB';\n      case 8:\n        return 'WITA';\n      case 9:\n        return 'WIT';\n      default:\n        return null;\n    }\n  }\n\n  // Check if it's an IANA timezone name\n  if (TIMEZONE_MAP[trimmed]) {\n    return TIMEZONE_MAP[trimmed];\n  }\n\n  // Unknown timezone\n  return null;\n}\n","/**\n * Javanese market-day (weton) utilities.\n *\n * @module datetime/weton\n * @packageDocumentation\n */\n\nimport { Pasaran, IndonesianWeekday, Weton, InvalidDateError } from './types';\nimport { isValidDate } from './calc';\n\n/** Milliseconds in one day. */\nconst MS_PER_DAY = 86_400_000;\n\n/** Length of one full wetonan cycle (LCM of 5 and 7). */\nconst WETON_CYCLE_DAYS = 35;\n\n/**\n * Anchor of the Javanese calendar: 8 July 1633 CE.\n *\n * Inaugurated by Sultan Agung of Mataram as the first day of the first\n * kurup (Alip Jemuwah Legi). All modern weton calculators align\n * against this date.\n *\n * @see packages/toolkit/research/weton_research.md\n */\nconst WETON_ANCHOR_MS = Date.UTC(1633, 6, 8);\n\n/**\n * Weekday neptu table (saptawara).\n *\n * Canonical, non-volatile cultural constants. The values match the\n * standard Indonesian convention used in every modern weton calculator.\n */\nconst WETON_WEEKDAY_NEPTU: Readonly<Record<IndonesianWeekday, number>> = {\n  Senin: 4,\n  Selasa: 3,\n  Rabu: 7,\n  Kamis: 8,\n  Jumat: 6,\n  Sabtu: 9,\n  Minggu: 5,\n};\n\n/**\n * Pasaran neptu table (pancawara).\n */\nconst WETON_PASARAN_NEPTU: Readonly<Record<Pasaran, number>> = {\n  Legi: 5,\n  Pahing: 9,\n  Pon: 7,\n  Wage: 4,\n  Kliwon: 8,\n};\n\n/**\n * Pasaran order, indexed by the cycle position modulo 5.\n *\n * Cycle index 0 (the anchor) is Legi. Each +1 day advances one\n * position.\n */\nconst WETON_PASARAN_ORDER: readonly Pasaran[] = [\n  'Legi',\n  'Pahing',\n  'Pon',\n  'Wage',\n  'Kliwon',\n];\n\n/**\n * Weekday order, indexed by the cycle position modulo 7.\n *\n * Cycle index 0 (the anchor) is Jumat (Friday). Using the anchor\n * weekday as index 0 lets `cycleIndex % 7` map directly to this array\n * without a remap step.\n */\nconst WETON_WEEKDAY_ORDER: readonly IndonesianWeekday[] = [\n  'Jumat',\n  'Sabtu',\n  'Minggu',\n  'Senin',\n  'Selasa',\n  'Rabu',\n  'Kamis',\n];\n\n/**\n * Get the Javanese market-day information (weton) for a given date.\n *\n * The result combines the Indonesian weekday (saptawara), the five-day\n * market position (pancawara / pasaran), and the combined neptu value\n * (weekday neptu + pasaran neptu), which always lies in `[7, 18]`.\n *\n * The date is interpreted in UTC for deterministic, timezone- and\n * DST-independent behaviour.\n *\n * @param date - The date to look up. Interpreted in UTC.\n * @returns The weton for that date.\n * @throws {InvalidDateError} If `date` is not a valid Date instance, or\n *   if the date falls before the Javanese calendar anchor (8 July 1633\n *   CE). Pre-anchor dates are outside the defined scope of the\n *   Javanese kurup system; we refuse to return a plausible-looking but\n *   possibly wrong result.\n *\n * @example\n * ```typescript\n * getWeton(new Date(Date.UTC(1633, 6, 8)));\n * // { weekday: 'Jumat', pasaran: 'Legi', neptu: 11 }\n *\n * getWeton(new Date(Date.UTC(1945, 7, 17)));\n * // { weekday: 'Jumat', pasaran: 'Pahing', neptu: 15 }\n * ```\n */\nexport function getWeton(date: Date): Weton {\n  if (!isValidDate(date)) {\n    throw new InvalidDateError('getWeton requires a valid Date instance');\n  }\n\n  const targetMs = Date.UTC(\n    date.getUTCFullYear(),\n    date.getUTCMonth(),\n    date.getUTCDate()\n  );\n\n  const daysSinceAnchor = Math.floor(\n    (targetMs - WETON_ANCHOR_MS) / MS_PER_DAY\n  );\n\n  if (daysSinceAnchor < 0) {\n    throw new InvalidDateError(\n      `getWeton is only defined for dates on or after 8 July 1633 CE (got ${date.toISOString()})`\n    );\n  }\n\n  const cycleIndex = daysSinceAnchor % WETON_CYCLE_DAYS;\n\n  const weekday = WETON_WEEKDAY_ORDER[cycleIndex % 7] as IndonesianWeekday;\n  const pasaran = WETON_PASARAN_ORDER[cycleIndex % 5] as Pasaran;\n  const neptu =\n    WETON_WEEKDAY_NEPTU[weekday] + WETON_PASARAN_NEPTU[pasaran];\n\n  return { weekday, pasaran, neptu };\n}\n"]}