{"version":3,"sources":["../../src/nik/constants.ts","../../src/nik/utils/date.ts","../../src/nik/validate.ts","../../src/nik/parse.ts","../../src/nik/format.ts","../../src/nik/clean.ts","../../src/nik/validate-detailed.ts","../../src/nik/utils.ts","../../src/nik/types.ts"],"names":["NIK_PATTERN"],"mappings":";;;AAIO,IAAM,SAAA,GAAoC;AAAA,EAC/C,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,OAAA;AAAA,EACN,IAAA,EAAM,kBAAA;AAAA,EACN,IAAA,EAAM,UAAA;AAAA,EACN,IAAA,EAAM,SAAA;AAAA,EACN,IAAA,EAAM,2BAAA;AAAA,EACN,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,aAAA;AAAA,EACN,IAAA,EAAM,YAAA;AAAA,EACN,IAAA,EAAM,aAAA;AAAA,EACN,IAAA,EAAM,eAAA;AAAA,EACN,IAAA,EAAM,YAAA;AAAA,EACN,IAAA,EAAM,QAAA;AAAA,EACN,IAAA,EAAM,MAAA;AAAA,EACN,IAAA,EAAM,qBAAA;AAAA,EACN,IAAA,EAAM,qBAAA;AAAA,EACN,IAAA,EAAM,kBAAA;AAAA,EACN,IAAA,EAAM,mBAAA;AAAA,EACN,IAAA,EAAM,oBAAA;AAAA,EACN,IAAA,EAAM,kBAAA;AAAA,EACN,IAAA,EAAM,kBAAA;AAAA,EACN,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,iBAAA;AAAA,EACN,IAAA,EAAM,kBAAA;AAAA,EACN,IAAA,EAAM,mBAAA;AAAA,EACN,IAAA,EAAM,WAAA;AAAA,EACN,IAAA,EAAM,gBAAA;AAAA,EACN,IAAA,EAAM,QAAA;AAAA,EACN,IAAA,EAAM,cAAA;AAAA,EACN,IAAA,EAAM,OAAA;AAAA,EACN,IAAA,EAAM,aAAA;AAAA,EACN,IAA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AK,UAAU,OAAA,EAAQ,KAAM,UAAU,OAAA,EAAQ;AAEnD;;;AC/EO,IAAM,eAAA,GAAN,cAA8B,KAAA,CAAM;AAAA,EAIzC,WAAA,CAAY,UAAkB,sBAAA,EAAwB;AACpD,IAAA,KAAA,CAAM,OAAO,CAAA;AAHf;AAAA,IAAA,IAAA,CAAS,IAAA,GAAO,aAAA;AAId,IAAA,IAAA,CAAK,IAAA,GAAO,iBAAA;AAAA,EACd;AACF","file":"index.cjs","sourcesContent":["/**\n * Indonesian province codes and names\n * Based on Dukcapil Kemendagri data\n */\nexport const PROVINCES: Record<string, string> = {\n  '11': 'Aceh',\n  '12': 'Sumatera Utara',\n  '13': 'Sumatera Barat',\n  '14': 'Riau',\n  '15': 'Jambi',\n  '16': 'Sumatera Selatan',\n  '17': 'Bengkulu',\n  '18': 'Lampung',\n  '19': 'Kepulauan Bangka Belitung',\n  '21': 'Kepulauan Riau',\n  '31': 'DKI Jakarta',\n  '32': 'Jawa Barat',\n  '33': 'Jawa Tengah',\n  '34': 'DI Yogyakarta',\n  '35': 'Jawa Timur',\n  '36': 'Banten',\n  '51': 'Bali',\n  '52': 'Nusa Tenggara Barat',\n  '53': 'Nusa Tenggara Timur',\n  '61': 'Kalimantan Barat',\n  '62': 'Kalimantan Tengah',\n  '63': 'Kalimantan Selatan',\n  '64': 'Kalimantan Timur',\n  '65': 'Kalimantan Utara',\n  '71': 'Sulawesi Utara',\n  '72': 'Sulawesi Tengah',\n  '73': 'Sulawesi Selatan',\n  '74': 'Sulawesi Tenggara',\n  '75': 'Gorontalo',\n  '76': 'Sulawesi Barat',\n  '81': 'Maluku',\n  '82': 'Maluku Utara',\n  '91': 'Papua',\n  '92': 'Papua Barat',\n  '93': 'Papua Selatan',\n  '94': 'Papua Tengah',\n  '95': 'Papua Pegunungan',\n  '96': 'Papua Barat Daya',\n};\n\n/**\n * Regency codes for each province (simplified - only major ones)\n * In a real implementation, you'd have complete data\n */\nexport const REGENCIES: Record<string, Record<string, string>> = {\n  '32': {\n    '01': 'Kab. Bogor',\n    '02': 'Kab. Sukabumi',\n    '03': 'Kab. Cianjur',\n    '71': 'Kota Bandung',\n    '72': 'Kota Bekasi',\n    '73': 'Kota Depok',\n  },\n  '31': { \n    '01': 'Kota Jakarta Selatan',\n    '02': 'Kota Jakarta Timur',\n    '03': 'Kota Jakarta Pusat',\n    '04': 'Kota Jakarta Barat',\n    '05': 'Kota Jakarta Utara',\n  },\n};","/**\n * Shared date parsing and validation utilities for NIK module.\n *\n * @module nik/utils/date\n * @packageDocumentation\n */\n\n/**\n * Result of parsing date components from a NIK string.\n *\n * @public\n */\nexport interface ParsedNIKDate {\n  /** 2-digit year code (00-99) from NIK positions 7-8 */\n  year: number;\n  /** Full 4-digit year (1900-1999 or 2000-2099) */\n  fullYear: number;\n  /** Month (1-12) from NIK positions 9-10 */\n  month: number;\n  /** Actual day (1-31), decoded from encoded day */\n  day: number;\n  /** Gender derived from day encoding */\n  gender: 'male' | 'female';\n  /** Original encoded day (1-31 for male, 41-71 for female) */\n  dayEncoded: number;\n}\n\n/**\n * Parses date components from a NIK string.\n *\n * Extracts year, month, and encoded day from positions 7-12 of the NIK.\n * For females, the day is encoded as (actual day + 40).\n *\n * @param nik - 16-digit NIK string\n * @returns ParsedNIKDate or null if NIK format is invalid\n *\n * @example\n * ```typescript\n * const result = parseNIKDate('3201018901310123');\n * // { year: 89, fullYear: 1989, month: 1, day: 31, gender: 'male', dayEncoded: 31 }\n * ```\n *\n * @public\n */\nexport function parseNIKDate(nik: string): ParsedNIKDate | null {\n  if (nik.length !== 16) {\n    return null;\n  }\n\n  const yearStr = nik.substring(6, 8);\n  const monthStr = nik.substring(8, 10);\n  const dayEncodedStr = nik.substring(10, 12);\n\n  const year = parseInt(yearStr, 10);\n  if (isNaN(year)) return null;\n\n  const fullYear = year > 30 ? 1900 + year : 2000 + year;\n\n  const month = parseInt(monthStr, 10);\n  if (isNaN(month)) return null;\n\n  const dayEncoded = parseInt(dayEncodedStr, 10);\n  if (isNaN(dayEncoded)) return null;\n\n  const gender: 'male' | 'female' = dayEncoded > 40 ? 'female' : 'male';\n  const day = dayEncoded > 40 ? dayEncoded - 40 : dayEncoded;\n\n  return { year, fullYear, month, day, gender, dayEncoded };\n}\n\n/**\n * Validates if year/month/day form a valid calendar date.\n *\n * Uses JavaScript's Date object to check if the date actually exists\n * (handles leap years, invalid month/day combinations).\n *\n * @param year - Full 4-digit year\n * @param month - Month (1-12)\n * @param day - Day (1-31)\n * @returns true if valid calendar date\n *\n * @example\n * ```typescript\n * validateNIKDateComponents(2024, 2, 29); // true (leap year)\n * validateNIKDateComponents(2023, 2, 29); // false\n * validateNIKDateComponents(2024, 13, 1); // false\n * ```\n *\n * @public\n */\nexport function validateNIKDateComponents(\n  year: number,\n  month: number,\n  day: number\n): boolean {\n  if (month < 1 || month > 12) return false;\n  if (day < 1 || day > 31) return false;\n\n  const testDate = new Date(year, month - 1, day);\n  return (\n    testDate.getFullYear() === year &&\n    testDate.getMonth() === month - 1 &&\n    testDate.getDate() === day\n  );\n}\n","import { PROVINCES } from './constants';\nimport { parseNIKDate, validateNIKDateComponents } from './utils/date';\n\nconst NIK_PATTERN = /^\\d{16}$/;\n\n/**\n * Validates a NIK (Nomor Induk Kependudukan) format.\n *\n * A valid NIK must:\n * - Be exactly 16 digits\n * - Have a valid province code (positions 1-2)\n * - Have a valid date (positions 7-12)\n * - Not be in the future\n * - Not be before 1900\n *\n * For female NIKs, the day is encoded as (actual day + 40).\n * For example, a female born on the 15th would have day = 55.\n *\n * @param nik - The 16-digit NIK string to validate\n * @returns `true` if the NIK is valid, `false` otherwise\n *\n * @example\n * ```typescript\n * validateNIK('3201234567890123'); // true - valid NIK\n * validateNIK('1234'); // false - wrong length\n * validateNIK('9912345678901234'); // false - invalid province\n * ```\n *\n * @public\n */\nexport function validateNIK(nik: string): boolean {\n  if (!NIK_PATTERN.test(nik)) {\n    return false;\n  }\n\n  const provinceCode = nik.substring(0, 2);\n  if (!PROVINCES[provinceCode]) {\n    return false;\n  }\n\n  const parsed = parseNIKDate(nik);\n  if (!parsed) {\n    return false;\n  }\n\n  const { fullYear, month, day } = parsed;\n\n  if (!validateNIKDateComponents(fullYear, month, day)) {\n    return false;\n  }\n\n  const now = new Date();\n  if (new Date(fullYear, month - 1, day) > now || fullYear < 1900) {\n    return false;\n  }\n\n  return true;\n}\n","import { PROVINCES, REGENCIES } from './constants';\nimport { NIKInfo } from './types';\nimport { parseNIKDate, validateNIKDateComponents } from './utils/date';\n\nconst NIK_PATTERN = /^\\d{16}$/;\n\n/**\n * Parses a NIK and extracts all embedded information.\n *\n * Extracts province, regency, district codes, birth date, gender,\n * and serial number from a 16-digit NIK string.\n *\n * @param nik - The 16-digit NIK string to parse\n * @returns Parsed NIK information, or `null` if the NIK format is invalid\n *\n * @example\n * Parse a valid male NIK:\n * ```typescript\n * const info = parseNIK('3201018901310123');\n * console.log(info);\n * // {\n * //   province: { code: '32', name: 'Jawa Barat' },\n * //   regency: { code: '01', name: 'Kab. Bogor' },\n * //   district: { code: '01', name: null },\n * //   birthDate: Date(1989, 0, 31), // Jan 31, 1989\n * //   gender: 'male',\n * //   serialNumber: '0123',\n * //   isValid: true\n * // }\n * ```\n *\n * @example\n * Parse a female NIK (day + 40):\n * ```typescript\n * const info = parseNIK('3201019508550123');\n * console.log(info.gender); // 'female'\n * console.log(info.birthDate); // Date(1995, 7, 15) - Aug 15, 1995\n * ```\n *\n * @example\n * Invalid NIK returns null:\n * ```typescript\n * const info = parseNIK('invalid');\n * console.log(info); // null\n * ```\n *\n * @public\n */\nexport function parseNIK(nik: string): NIKInfo | null {\n  if (!NIK_PATTERN.test(nik)) {\n    return null;\n  }\n\n  const provinceCode = nik.substring(0, 2);\n  const regencyCode = nik.substring(2, 4);\n  const districtCode = nik.substring(4, 6);\n  const serialNumber = nik.substring(12, 16);\n\n  const province = PROVINCES[provinceCode];\n  if (!province) {\n    return null;\n  }\n\n  const regencies = REGENCIES[provinceCode] || {};\n  const regency = regencies[regencyCode] || 'Unknown';\n\n  const parsed = parseNIKDate(nik);\n  if (!parsed) {\n    return null;\n  }\n\n  const { fullYear, month, day, gender } = parsed;\n\n  if (!validateNIKDateComponents(fullYear, month, day)) {\n    return null;\n  }\n\n  const birthDate = new Date(fullYear, month - 1, day);\n\n  return {\n    province: {\n      code: provinceCode,\n      name: province,\n    },\n    regency: {\n      code: regencyCode,\n      name: regency,\n    },\n    district: {\n      code: districtCode,\n      name: null,\n    },\n    birthDate,\n    gender,\n    serialNumber,\n    isValid: true,\n  };\n}\n","import { MaskOptions } from './types';\n\n/**\n * Formats a NIK with separators for better readability.\n *\n * Groups the NIK into logical segments: province, regency, district,\n * year, month, day, and serial number.\n *\n * @param nik - The 16-digit NIK string to format\n * @param separator - Character to use as separator\n * @returns Formatted NIK string, or original string if invalid format\n *\n * @example\n * Default separator (dash):\n * ```typescript\n * formatNIK('3201234567890123');\n * // '32-01-23-45-67-89-0123'\n * ```\n *\n * @example\n * Custom separator:\n * ```typescript\n * formatNIK('3201234567890123', ' ');\n * // '32 01 23 45 67 89 0123'\n * ```\n *\n * @example\n * Invalid NIK returns as-is:\n * ```typescript\n * formatNIK('1234');\n * // '1234'\n * ```\n *\n * @public\n */\nexport function formatNIK(nik: string, separator: string = '-'): string {\n  if (!/^\\d{16}$/.test(nik)) {\n    return nik;\n  }\n\n  // Format: PP-KK-DD-YY-MM-DD-XXXX\n  // PP = Province (2 digits)\n  // KK = Regency (2 digits)\n  // DD = District (2 digits)\n  // YY = Year (2 digits)\n  // MM = Month (2 digits)\n  // DD = Day (2 digits, +40 for female)\n  // XXXX = Serial number (4 digits)\n  return [\n    nik.substring(0, 2), // Province\n    nik.substring(2, 4), // Regency\n    nik.substring(4, 6), // District\n    nik.substring(6, 8), // Year\n    nik.substring(8, 10), // Month\n    nik.substring(10, 12), // Day\n    nik.substring(12, 16), // Serial\n  ].join(separator);\n}\n\n/**\n * Masks a NIK to protect privacy while keeping partial visibility.\n *\n * By default, shows the first 4 and last 4 digits, masking the middle 8.\n * Optionally formats the masked NIK with separators.\n *\n * @param nik - The 16-digit NIK string to mask\n * @param options - Masking configuration options\n * @returns Masked NIK string, or original string if invalid format\n *\n * @example\n * Default masking (first 4, last 4):\n * ```typescript\n * maskNIK('3201234567890123');\n * // '3201********0123'\n * ```\n *\n * @example\n * Custom mask character:\n * ```typescript\n * maskNIK('3201234567890123', { maskChar: 'X' });\n * // '3201XXXXXXXX0123'\n * ```\n *\n * @example\n * With separator:\n * ```typescript\n * maskNIK('3201234567890123', { separator: '-' });\n * // '32-01-**-**-**-**-0123'\n * ```\n *\n * @example\n * Custom visibleStart and visibleEnd:\n * ```typescript\n * maskNIK('3201234567890123', { visibleStart: 6, visibleEnd: 4 });\n * // '320123******0123'\n * ```\n *\n * @public\n */\nexport function maskNIK(nik: string, options: MaskOptions = {}): string {\n  if (!/^\\d{16}$/.test(nik)) {\n    return nik;\n  }\n\n  const { visibleStart, visibleEnd, maskChar, separator, start, end, char } =\n    options;\n\n  const hasLegacyOptions =\n    start !== undefined || end !== undefined || char !== undefined;\n\n  if (hasLegacyOptions) {\n    console.warn(\n      '[DEPRECATED] Mask options start/end/char are deprecated. ' +\n        'Use visibleStart/visibleEnd/maskChar instead. ' +\n        'These old names will be removed in v1.0.0.'\n    );\n  }\n\n  const effectiveStart =\n    visibleStart !== undefined ? visibleStart : start !== undefined ? start : 4;\n  const effectiveEnd =\n    visibleEnd !== undefined ? visibleEnd : end !== undefined ? end : 4;\n  const effectiveChar =\n    maskChar !== undefined ? maskChar : char !== undefined ? char : '*';\n\n  if (effectiveStart + effectiveEnd >= 16) {\n    return nik;\n  }\n\n  if (separator) {\n    const formatted = formatNIK(nik, separator);\n    const parts = formatted.split(separator);\n\n    let charCount = 0;\n    const maskedParts = parts.map((part) => {\n      const partStart = charCount;\n      const partEnd = charCount + part.length;\n      charCount += part.length;\n\n      if (partEnd <= effectiveStart) {\n        return part;\n      } else if (partStart >= 16 - effectiveEnd) {\n        return part;\n      } else if (partStart >= effectiveStart && partEnd <= 16 - effectiveEnd) {\n        return effectiveChar.repeat(part.length);\n      } else {\n        return part\n          .split('')\n          .map((ch, idx) => {\n            const pos = partStart + idx;\n            if (pos < effectiveStart || pos >= 16 - effectiveEnd) {\n              return ch;\n            }\n            return effectiveChar;\n          })\n          .join('');\n      }\n    });\n\n    return maskedParts.join(separator);\n  }\n\n  const startPart = nik.substring(0, effectiveStart);\n  const endPart = nik.substring(16 - effectiveEnd);\n  const maskLength = 16 - effectiveStart - effectiveEnd;\n  return startPart + effectiveChar.repeat(maskLength) + endPart;\n}\n","/**\n * Cleans a NIK by removing all non-digit characters.\n *\n * Accepts NIK in any format (with separators like `.`, `-`, ` `) and\n * returns a clean 16-digit string. Returns empty string for invalid inputs.\n *\n * @param nik - NIK in any format\n * @returns Clean 16-digit NIK or empty string if invalid\n *\n * @example\n * ```typescript\n * cleanNIK('32-01-01-89-01-31-0123'); // '3201018901310123'\n * cleanNIK('3201.8901.3101.23'); // '32018901310123' (only 14 digits - invalid)\n * cleanNIK('invalid'); // ''\n * ```\n *\n * @public\n */\nexport function cleanNIK(nik: string): string {\n  if (typeof nik !== 'string') {\n    return '';\n  }\n\n  const cleaned = nik.replace(/\\D/g, '');\n\n  if (cleaned.length !== 16) {\n    return '';\n  }\n\n  return cleaned;\n}\n","import { PROVINCES } from './constants';\nimport { NIKValidationResult, NIKValidationError, NIKErrorCode } from './types';\nimport { cleanNIK } from './clean';\nimport { parseNIK } from './parse';\n\nfunction createError(code: NIKErrorCode, message: string): NIKValidationError {\n  return { code, message };\n}\n\n/**\n * Validates a NIK and returns detailed error information.\n *\n * Unlike `validateNIK` which returns a boolean, this function provides\n * structured error reporting for form validation use cases.\n *\n * @param nik - The NIK string to validate (accepts any format with separators)\n * @returns Detailed validation result with errors array\n *\n * @example\n * ```typescript\n * const result = validateNIKDetailed('3201018901310123');\n * if (!result.isValid) {\n *   result.errors.forEach(err => {\n *     console.log(`${err.code}: ${err.message}`);\n *   });\n * }\n * ```\n *\n * @public\n */\nexport function validateNIKDetailed(nik: string): NIKValidationResult {\n  const cleaned = cleanNIK(nik);\n\n  if (cleaned === '') {\n    return {\n      isValid: false,\n      errors: [createError('INVALID_FORMAT', 'NIK must be exactly 16 digits')],\n      nik: null,\n    };\n  }\n\n  const provinceCode = cleaned.substring(0, 2);\n  if (!PROVINCES[provinceCode]) {\n    return {\n      isValid: false,\n      errors: [\n        createError(\n          'INVALID_PROVINCE',\n          `Province code ${provinceCode} not found`\n        ),\n      ],\n      nik: null,\n    };\n  }\n\n  const info = parseNIK(cleaned);\n  if (!info) {\n    return {\n      isValid: false,\n      errors: [createError('INVALID_DATE', 'Invalid date components')],\n      nik: null,\n    };\n  }\n\n  const birthDate = info.birthDate;\n  if (!birthDate) {\n    return {\n      isValid: false,\n      errors: [createError('INVALID_DATE', 'Invalid birth date')],\n      nik: null,\n    };\n  }\n\n  const now = new Date();\n  if (birthDate > now) {\n    return {\n      isValid: false,\n      errors: [\n        createError('FUTURE_DATE', 'Birth date cannot be in the future'),\n      ],\n      nik: null,\n    };\n  }\n\n  return {\n    isValid: true,\n    errors: [],\n    nik: cleaned,\n  };\n}\n","import { parseNIK } from './parse';\nimport { cleanNIK } from './clean';\nimport { Age, GetAgeOptions } from './types';\n\n/**\n * Calculates the age of a person based on their NIK.\n *\n * Returns detailed age breakdown with years, months, and days, or a\n * formatted Indonesian string. This is consistent with `datetime.getAge()`.\n *\n * @param nik - The 16-digit NIK string\n * @param options - Options object with `referenceDate` and `asString`\n * @returns Age object `{ years, months, days }`, formatted string, or null if invalid\n *\n * @example\n * ```typescript\n * // Returns object by default\n * getAge('3201018901310123');\n * // { years: 35, months: 2, days: 6 } (as of 2026-04-06)\n *\n * // Returns formatted string\n * getAge('3201018901310123', { asString: true });\n * // '35 Tahun 2 Bulan 6 Hari'\n *\n * // Custom reference date\n * getAge('3201018901310123', { referenceDate: new Date('2025-01-01') });\n * // { years: 35, months: 11, days: 1 }\n * ```\n *\n * @public\n */\nexport function getAge(\n  nik: string,\n  options: GetAgeOptions = {}\n): Age | string | null {\n  const { referenceDate = new Date(), asString = false } = options;\n\n  const info = parseNIK(nik);\n  if (!info || !info.birthDate) {\n    return null;\n  }\n\n  const birthDate = info.birthDate;\n  let years = referenceDate.getFullYear() - birthDate.getFullYear();\n  let months = referenceDate.getMonth() - birthDate.getMonth();\n  let days = referenceDate.getDate() - birthDate.getDate();\n\n  if (days < 0) {\n    months--;\n    const prevMonth = new Date(\n      referenceDate.getFullYear(),\n      referenceDate.getMonth(),\n      0\n    );\n    days += prevMonth.getDate();\n  }\n\n  if (months < 0) {\n    years--;\n    months += 12;\n  }\n\n  if (asString) {\n    const parts: string[] = [];\n    if (years > 0) parts.push(`${years} Tahun`);\n    if (months > 0) parts.push(`${months} Bulan`);\n    if (days > 0 || parts.length === 0) parts.push(`${days} Hari`);\n    return parts.join(' ');\n  }\n\n  return { years, months, days };\n}\n\n/**\n * Compares two NIKs to check if they belong to the same person.\n *\n * Two NIKs are considered the same person if they have identical:\n * - Province code (positions 1-2)\n * - Regency code (positions 3-4)\n * - District code (positions 5-6)\n * - Birth date (year + month + day)\n * - Gender (derived from day encoding)\n * - Serial number (positions 13-16)\n *\n * @param nik1 - First NIK (accepts any format)\n * @param nik2 - Second NIK (accepts any format)\n * @returns True if both NIKs belong to the same person, false otherwise\n *\n * @example\n * ```typescript\n * // Same person, same format\n * compareNIK('3201018901310123', '3201018901310123'); // true\n *\n * // Same person, different format\n * compareNIK('3201018901310123', '3201-01-89-01-31-0123'); // true\n *\n * // Different serial number\n * compareNIK('3201018901310123', '3201018901310124'); // false\n *\n * // Invalid NIK\n * compareNIK('invalid', '3201018901310123'); // false\n * ```\n *\n * @public\n */\nexport function compareNIK(nik1: string, nik2: string): boolean {\n  const cleaned1 = cleanNIK(nik1);\n  const cleaned2 = cleanNIK(nik2);\n\n  if (\n    cleaned1 === '' ||\n    cleaned2 === '' ||\n    cleaned1.length !== 16 ||\n    cleaned2.length !== 16\n  ) {\n    return false;\n  }\n\n  if (cleaned1 === cleaned2) {\n    return true;\n  }\n\n  const pos1_6_1 = cleaned1.substring(0, 6);\n  const pos1_6_2 = cleaned2.substring(0, 6);\n\n  if (pos1_6_1 !== pos1_6_2) {\n    return false;\n  }\n\n  const birthDate1 = cleaned1.substring(6, 12);\n  const birthDate2 = cleaned2.substring(6, 12);\n\n  if (birthDate1 !== birthDate2) {\n    return false;\n  }\n\n  const serial1 = cleaned1.substring(12, 16);\n  const serial2 = cleaned2.substring(12, 16);\n\n  return serial1 === serial2;\n}\n\n/**\n * Checks if a person is an adult based on their NIK.\n *\n * By default, uses 17 years as the threshold (Indonesian KTP eligibility age).\n * Indonesian law allows KTP at age 17, or upon marriage, or already married.\n *\n * @param nik - The 16-digit NIK string\n * @param minAge - Minimum age threshold (default: 17)\n * @returns True if the person is at least minAge years old, false otherwise\n *\n * @example\n * ```typescript\n * // Born 1995-01-01, reference 2026-04-06 (age 31)\n * isAdult('3201950101950123'); // true (31 >= 17)\n * isAdult('3201950101950123', 21); // true (31 >= 21)\n *\n * // Born 2010-01-01, reference 2026-04-06 (age 16)\n * isAdult('3210010101950123'); // false (16 < 17)\n * isAdult('3210010101950123', 16); // true (16 >= 16)\n *\n * // Invalid NIK\n * isAdult('invalid'); // false\n * ```\n *\n * @public\n */\nexport function isAdult(nik: string, minAge: number = 17): boolean {\n  const age = getAge(nik);\n  if (age === null) {\n    return false;\n  }\n\n  if (typeof age === 'string') {\n    const yearsMatch = age.match(/^(\\d+)/);\n    if (yearsMatch) {\n      return parseInt(yearsMatch[1], 10) >= minAge;\n    }\n    return false;\n  }\n\n  return age.years >= minAge;\n}\n\n/**\n * Formats the birth date from a NIK into a human-readable string.\n *\n * @param nik - The 16-digit NIK string\n * @param locale - The locale to use for formatting (default: 'id-ID')\n * @returns Formatted birth date string, or null if invalid\n *\n * @example\n * ```typescript\n * formatBirthDate('3201018901310123'); // '31 Januari 1989'\n * ```\n */\nexport function formatBirthDate(nik: string): string | null {\n  const info = parseNIK(nik);\n  if (!info || !info.birthDate) {\n    return null;\n  }\n\n  const day = info.birthDate.getDate();\n  const month = info.birthDate.getMonth();\n  const year = info.birthDate.getFullYear();\n\n  const monthNames = [\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  return `${day} ${monthNames[month]} ${year}`;\n}\n\n/**\n * Checks if a NIK matches a specific gender.\n *\n * @param nik - The 16-digit NIK string\n * @param gender - The gender to check ('male' | 'female')\n * @returns True if the NIK matches the gender, false otherwise\n */\nexport function isValidForGender(\n  nik: string,\n  gender: 'male' | 'female'\n): boolean {\n  const info = parseNIK(nik);\n  if (!info) {\n    return false;\n  }\n  return info.gender === gender;\n}\n\n/**\n * Checks if a NIK matches a specific birth date.\n *\n * @param nik - The 16-digit NIK string\n * @param birthDate - The birth date to check\n * @returns True if the NIK matches the birth date, false otherwise\n */\nexport function isValidForBirthDate(nik: string, birthDate: Date): boolean {\n  const info = parseNIK(nik);\n  if (!info || !info.birthDate) {\n    return false;\n  }\n\n  return (\n    info.birthDate.getFullYear() === birthDate.getFullYear() &&\n    info.birthDate.getMonth() === birthDate.getMonth() &&\n    info.birthDate.getDate() === birthDate.getDate()\n  );\n}\n","/**\n * Information extracted from a valid NIK.\n *\n * Contains parsed data including location codes, birth date, gender,\n * and serial number from a 16-digit NIK string.\n *\n * @public\n */\nexport interface NIKInfo {\n  /**\n   * Province information extracted from positions 1-2 of the NIK.\n   *\n   * @example\n   * ```typescript\n   * { code: '32', name: 'Jawa Barat' }\n   * ```\n   */\n  province: {\n    /** Two-digit province code (e.g., '32') */\n    code: string;\n    /** Full province name (e.g., 'Jawa Barat') */\n    name: string;\n  };\n\n  /**\n   * Regency (Kabupaten/Kota) information extracted from positions 3-4 of the NIK.\n   *\n   * @example\n   * ```typescript\n   * { code: '01', name: 'Kab. Bogor' }\n   * ```\n   */\n  regency: {\n    /** Two-digit regency code (e.g., '01') */\n    code: string;\n    /** Full regency name (e.g., 'Kab. Bogor') */\n    name: string;\n  };\n\n  /**\n   * District (Kecamatan) information extracted from positions 5-6 of the NIK.\n   * May be `null` if district data is not available.\n   *\n   * @example\n   * ```typescript\n   * { code: '23', name: 'Ciawi' }\n   * ```\n   */\n  district: {\n    /** Two-digit district code (e.g., '23') */\n    code: string;\n    /** Full district name, or `null` if data unavailable */\n    name: string | null;\n  };\n\n  /**\n   * Birth date extracted from positions 7-12 of the NIK.\n   * For females, the day is encoded as (actual day + 40).\n   * Returns `null` if the date is invalid.\n   *\n   * @example\n   * ```typescript\n   * new Date(1989, 0, 31) // January 31, 1989\n   * ```\n   */\n  birthDate: Date | null;\n\n  /**\n   * Gender derived from the day encoding in the NIK.\n   * - 'male': day is 1-31\n   * - 'female': day is 41-71 (actual day + 40)\n   * - `null`: if unable to determine\n   */\n  gender: 'male' | 'female' | null;\n\n  /**\n   * Serial number from positions 13-16 of the NIK.\n   * Uniquely identifies individuals with the same location and birth date.\n   * Returns `null` if unable to extract.\n   *\n   * @example\n   * ```typescript\n   * '0123'\n   * ```\n   */\n  serialNumber: string | null;\n\n  /**\n   * Whether the NIK passed validation checks.\n   * If `false`, other fields may be `null` or contain partial data.\n   */\n  isValid: boolean;\n}\n\n/**\n * Options for masking a NIK to protect privacy.\n *\n * Controls how many characters to show at the start and end,\n * what character to use for masking, and optional separators.\n *\n * @example\n * Default masking:\n * ```typescript\n * { visibleStart: 4, visibleEnd: 4, maskChar: '*' }\n * // Result: '3201********0123'\n *\n * // With separator\n * { visibleStart: 4, visibleEnd: 4, maskChar: '*', separator: '-' }\n * // Result: '3201-****-****-0123'\n * ```\n *\n * @public\n */\nexport interface MaskOptions {\n  /**\n   * Number of characters to show at the start.\n   *\n   * @defaultValue 4\n   */\n  visibleStart?: number;\n\n  /**\n   * Number of characters to show at the end.\n   *\n   * @defaultValue 4\n   */\n  visibleEnd?: number;\n\n  /**\n   * Character to use for masking hidden digits.\n   *\n   * @defaultValue '*'\n   */\n  maskChar?: string;\n\n  /**\n   * Optional separator to add between groups of digits.\n   * If provided, the NIK will be formatted with separators.\n   *\n   * @defaultValue undefined (no separator)\n   *\n   * @example\n   * ```typescript\n   * '-' // Results in format: '3201-****-****-0123'\n   * ' ' // Results in format: '3201 **** **** 0123'\n   * ```\n   */\n  separator?: string;\n\n  /**\n   * @deprecated Use `visibleStart` instead. Deprecated in v0.7.0.\n   */\n  start?: number;\n\n  /**\n   * @deprecated Use `visibleEnd` instead. Deprecated in v0.7.0.\n   */\n  end?: number;\n\n  /**\n   * @deprecated Use `maskChar` instead. Deprecated in v0.7.0.\n   */\n  char?: string;\n}\n\n/**\n * Error thrown when an invalid NIK 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 *   requireNIK('invalid');\n * } catch (error) {\n *   if (error instanceof InvalidNIKError) {\n *     console.log(error.code); // 'INVALID_NIK'\n *   }\n * }\n * ```\n *\n * @public\n */\nexport class InvalidNIKError extends Error {\n  /** Error code for programmatic identification */\n  readonly code = 'INVALID_NIK' as const;\n\n  constructor(message: string = 'Invalid NIK provided') {\n    super(message);\n    this.name = 'InvalidNIKError';\n  }\n}\n\n/**\n * Error codes for detailed NIK validation.\n *\n * @public\n */\nexport type NIKErrorCode =\n  | 'INVALID_FORMAT'\n  | 'INVALID_PROVINCE'\n  | 'INVALID_MONTH'\n  | 'INVALID_DAY'\n  | 'INVALID_DATE'\n  | 'FUTURE_DATE';\n\n/**\n * A single validation error with code and message.\n *\n * @public\n */\nexport interface NIKValidationError {\n  /** Error code for programmatic handling */\n  code: NIKErrorCode;\n  /** Human-readable error message */\n  message: string;\n}\n\n/**\n * Detailed validation result for NIK with structured error reporting.\n *\n * Use this for form validation where you need to show specific error\n * messages per field.\n *\n * @example\n * ```typescript\n * const result = validateNIKDetailed('1234');\n * if (!result.isValid) {\n *   result.errors.forEach(err => {\n *     console.log(err.code, err.message);\n *   });\n * }\n * ```\n *\n * @public\n */\nexport interface NIKValidationResult {\n  /** Whether the NIK is valid */\n  isValid: boolean;\n  /** List of validation errors (empty if valid) */\n  errors: NIKValidationError[];\n  /** Cleaned 16-digit NIK if valid, null otherwise */\n  nik: string | null;\n}\n\n/**\n * Options for getAge function.\n *\n * @public\n */\nexport interface GetAgeOptions {\n  /** Date to calculate age from (default: current date) */\n  referenceDate?: Date;\n  /** Return formatted Indonesian string instead of object */\n  asString?: boolean;\n}\n\n/**\n * Age result object with years, months, and days.\n *\n * @public\n */\nexport interface Age {\n  /** Full years */\n  years: number;\n  /** Remaining months after full years */\n  months: number;\n  /** Remaining days after full months */\n  days: number;\n}\n"]}