{"version":3,"sources":["../src/index.ts","../src/data/fy-2081-82.ts","../src/data/index.ts","../src/util.ts","../src/income-tax.ts","../src/tds.ts","../src/vat.ts","../src/capital-gains.ts","../src/contributions.ts","../src/corporate.ts","../src/payroll.ts","../src/bill.ts"],"sourcesContent":["/**\n * `nepali-tax-pro-max` — Nepal IRD tax calculator suite.\n *\n * Covers income tax, TDS, VAT, capital gains, SSF, PF, CIT, payroll, and\n * corporate tax. Fiscal-year-aware (default 2081/82). Zero deps. ESM + CJS.\n *\n * @packageDocumentation\n *\n * @example Income tax\n * ```ts\n * import { calculateIncomeTax } from \"nepali-tax-pro-max\";\n * calculateIncomeTax({ income: 1_000_000, status: \"single\" });\n * // { tax: 85000, effectiveRate: 0.085, ... }\n * ```\n *\n * @example Payroll\n * ```ts\n * import { calculatePayroll } from \"nepali-tax-pro-max\";\n * calculatePayroll({\n *   monthlyBasic: 50_000,\n *   monthlyAllowances: 20_000,\n *   profile: { status: \"single\", isSSFMember: true },\n *   deductions: { lifeInsurance: 30_000 },\n * });\n * ```\n *\n * @example VAT + TDS bill\n * ```ts\n * import { calculateBill } from \"nepali-tax-pro-max\";\n * calculateBill({\n *   serviceAmount: 100_000,\n *   applyVAT: true,\n *   tdsType: \"service-vat-registered\",\n * });\n * ```\n */\n\n// ---------- Data / rates ----------\nexport {\n  DEFAULT_FISCAL_YEAR,\n  RATES_BY_FY,\n  RATES_FY_2081_82,\n  getRates,\n  getSupportedFiscalYears,\n} from \"./data/index.js\";\n\n// ---------- Income tax ----------\nexport {\n  type IncomeTaxOptions,\n  applySlabs,\n  calculateIncomeTax,\n  getEffectiveRate,\n  getMarginalRate,\n  getSlabs,\n} from \"./income-tax.js\";\n\n// ---------- TDS ----------\nexport {\n  type SalaryTdsOptions,\n  type SalaryTdsResult,\n  type TdsOptions,\n  type TdsResult,\n  calculateSalaryTDS,\n  calculateTDS,\n  getTDSRate,\n  totalDeductions,\n} from \"./tds.js\";\n\n// ---------- VAT ----------\nexport {\n  type VatOptions,\n  addVAT,\n  calculateVAT,\n  extractVAT,\n  getVATRate,\n  getVATThreshold,\n  isAboveVATThreshold,\n} from \"./vat.js\";\n\n// ---------- Capital gains ----------\nexport {\n  type CapitalGainsOptions,\n  type CapitalGainsResult,\n  calculateCapitalGains,\n  getCapitalGainsRate,\n} from \"./capital-gains.js\";\n\n// ---------- SSF / PF / CIT ----------\nexport {\n  type CitResult,\n  type PfResult,\n  type SsfResult,\n  calculateCIT,\n  calculatePF,\n  calculateSSF,\n} from \"./contributions.js\";\n\n// ---------- Corporate tax ----------\nexport {\n  type CorporateTaxOptions,\n  type CorporateTaxResult,\n  calculateCorporateTax,\n  getCorporateRate,\n} from \"./corporate.js\";\n\n// ---------- Payroll ----------\nexport {\n  type PayrollOptions,\n  calculatePayroll,\n} from \"./payroll.js\";\n\n// ---------- Bill / invoice ----------\nexport {\n  type BillOptions,\n  calculateBill,\n} from \"./bill.js\";\n\n// ---------- Types ----------\nexport type {\n  BillResult,\n  CapitalGainsAsset,\n  CorporateCategory,\n  FilingStatus,\n  FiscalYear,\n  IncomeTaxResult,\n  PayrollResult,\n  RatesSnapshot,\n  SalaryDeductions,\n  SlabSet,\n  TaxProfile,\n  TaxSlab,\n  TdsCategory,\n  VatResult,\n} from \"./types.js\";\n","/**\n * Nepal income tax / TDS / VAT / SSF / PF / capital gains rates for\n * **Fiscal Year 2081/82** (Shrawan 1, 2081 → Ashad end, 2082 ≈ 2024-07-16 → 2025-07-16).\n *\n * Source: Finance Act 2081 (Jestha 15, 2081), IRD circulars, SSF schedule.\n *\n * **Verify before deploying for production tax filings.** Rates here reflect\n * the version published in the gazette as of 2024-07. Any subsequent IRD\n * notification supersedes — open a PR to add a new FY file rather than\n * mutating this one.\n *\n * Sources:\n *  - https://ird.gov.np  (Finance Act 2081)\n *  - https://mof.gov.np  (Budget Speech 2081/82)\n *  - https://ssf.gov.np  (SSF contribution schedule)\n */\n\nimport type { RatesSnapshot } from \"../types.js\";\n\nexport const RATES_FY_2081_82: RatesSnapshot = {\n  fiscalYear: \"2081/82\",\n\n  // Individual (unmarried) slabs.\n  slabsSingle: [\n    { from: 0, to: 500_000, rate: 0.01, label: \"SST\" },\n    { from: 500_000, to: 700_000, rate: 0.10 },\n    { from: 700_000, to: 1_000_000, rate: 0.20 },\n    { from: 1_000_000, to: 2_000_000, rate: 0.30 },\n    { from: 2_000_000, to: 5_000_000, rate: 0.36 },\n    { from: 5_000_000, to: Infinity, rate: 0.39 },\n  ],\n\n  // Couple (married) slabs.\n  slabsCouple: [\n    { from: 0, to: 600_000, rate: 0.01, label: \"SST\" },\n    { from: 600_000, to: 800_000, rate: 0.10 },\n    { from: 800_000, to: 1_100_000, rate: 0.20 },\n    { from: 1_100_000, to: 2_000_000, rate: 0.30 },\n    { from: 2_000_000, to: 5_000_000, rate: 0.36 },\n    { from: 5_000_000, to: Infinity, rate: 0.39 },\n  ],\n\n  // TDS rates by category. All as fractions.\n  tds: {\n    salary: 0,                          // Uses slabs (handled separately).\n    rent: 0.10,                         // House/land to individual.\n    \"rent-vehicle\": 0.015,              // Commercial vehicle, VAT-registered.\n    \"service-vat-registered\": 0.015,    // Service to VAT-registered vendor.\n    \"service-non-vat\": 0.15,            // Service to non-VAT vendor.\n    \"service-non-resident\": 0.15,       // Service paid to non-resident.\n    royalty: 0.15,\n    \"dividend-resident\": 0.05,\n    \"dividend-non-resident\": 0.05,\n    \"interest-bank-individual\": 0.05,   // Bank interest to natural person — final.\n    \"interest-other\": 0.15,\n    commission: 0.15,\n    lottery: 0.25,                      // Lottery / windfall gain.\n    \"meeting-allowance\": 0.15,\n    \"aircraft-lease\": 0.10,\n    \"reinsurance-non-resident\": 0.015,\n    \"consumer-committee\": 0.015,\n    \"exam-fee\": 0.15,\n  },\n\n  vat: {\n    rate: 0.13,\n    thresholdGoods: 5_000_000,\n    thresholdService: 3_000_000,\n  },\n\n  capitalGains: {\n    \"shares-listed-individual-short\": 0.075,\n    \"shares-listed-individual-long\": 0.05,\n    \"shares-listed-entity\": 0.10,\n    \"shares-listed-promoter\": 0.10,\n    \"shares-unlisted-individual\": 0.10,\n    \"shares-unlisted-entity\": 0.15,\n    \"land-individual-short\": 0.075,\n    \"land-individual-long\": 0.05,\n    \"land-entity\": 0.015,\n  },\n\n  corporate: {\n    standard: 0.25,\n    \"bank-financial\": 0.30,\n    insurance: 0.30,\n    telecom: 0.30,\n    petroleum: 0.30,\n    \"capital-market\": 0.30,\n    \"special-industry\": 0.20,\n    export: 0.20,\n    \"tobacco-alcohol\": 0.30,\n  },\n\n  ssf: {\n    employee: 0.11,    // 11% of basic\n    employer: 0.20,    // 20% of basic\n    breakdown: {\n      medical: 0.0322,\n      accident: 0.0140,\n      dependent: 0.0027,\n      retirement: 0.2611,\n    },\n  },\n\n  pf: {\n    employee: 0.10,\n    employer: 0.10,\n  },\n\n  deductionCaps: {\n    retirement: 300_000,         // Non-SSF members\n    retirementSsf: 500_000,      // SSF members\n    lifeInsurance: 40_000,\n    healthInsurance: 20_000,\n    donation: 100_000,\n    donationPercentOfTaxableIncome: 0.05,\n  },\n\n  sourceUrl: \"https://ird.gov.np\",\n};\n","/**\n * Fiscal-year rate registry. To add a new FY:\n *  1. Create `fy-<year>.ts` next to this file with a `RATES_FY_<year>` export.\n *  2. Add it to the `RATES_BY_FY` map below.\n *  3. Update `DEFAULT_FISCAL_YEAR` if the new FY is the current one.\n *\n * Rates from past FYs are immutable — never mutate a published file.\n */\n\nimport type { FiscalYear, RatesSnapshot } from \"../types.js\";\nimport { RATES_FY_2081_82 } from \"./fy-2081-82.js\";\n\n/** All FYs currently shipped in the package. */\nexport const RATES_BY_FY: ReadonlyMap<FiscalYear, RatesSnapshot> = new Map([\n  [\"2081/82\", RATES_FY_2081_82],\n]);\n\n/** The default fiscal year used when callers don't pass `fiscalYear`. */\nexport const DEFAULT_FISCAL_YEAR: FiscalYear = \"2081/82\";\n\n/** Resolve rates for a given fiscal year, defaulting to the current FY. */\nexport function getRates(fiscalYear: FiscalYear = DEFAULT_FISCAL_YEAR): RatesSnapshot {\n  const r = RATES_BY_FY.get(fiscalYear);\n  if (!r) {\n    throw new RangeError(\n      `getRates: fiscal year \"${fiscalYear}\" not supported. Available: ${[...RATES_BY_FY.keys()].join(\", \")}`,\n    );\n  }\n  return r;\n}\n\n/** All supported fiscal years in the registry. */\nexport function getSupportedFiscalYears(): FiscalYear[] {\n  return [...RATES_BY_FY.keys()];\n}\n\nexport { RATES_FY_2081_82 };\n","/**\n * Internal helpers for the tax library.\n */\n\n/** Round to 2 decimal places (paisa precision), half-up. */\nexport function r2(n: number): number {\n  if (!Number.isFinite(n)) {\n    throw new RangeError(`r2: non-finite ${n}`);\n  }\n  const sign = n < 0 ? -1 : 1;\n  return sign * Math.round(Math.abs(n) * 100) / 100;\n}\n\n/** Round to 4 decimal places, half-up. Used for rates / ratios. */\nexport function r4(n: number): number {\n  if (!Number.isFinite(n)) {\n    throw new RangeError(`r4: non-finite ${n}`);\n  }\n  const sign = n < 0 ? -1 : 1;\n  return sign * Math.round(Math.abs(n) * 10000) / 10000;\n}\n\n/** Ensure a value is a finite non-negative number. */\nexport function ensureNonNegative(n: number, fnName: string): number {\n  if (typeof n !== \"number\" || !Number.isFinite(n)) {\n    throw new RangeError(`${fnName}: expected a finite number, got ${n}`);\n  }\n  if (n < 0) {\n    throw new RangeError(`${fnName}: expected non-negative, got ${n}`);\n  }\n  return n;\n}\n\n/** Ensure a value is a finite number. */\nexport function ensureFinite(n: number, fnName: string): number {\n  if (typeof n !== \"number\" || !Number.isFinite(n)) {\n    throw new RangeError(`${fnName}: expected a finite number, got ${n}`);\n  }\n  return n;\n}\n\n/** Clamp `n` to `[min, max]`. */\nexport function clamp(n: number, min: number, max: number): number {\n  if (n < min) return min;\n  if (n > max) return max;\n  return n;\n}\n","/**\n * Nepal income tax calculation per IRD slabs.\n *\n * Uses the Finance Act slab table for the requested fiscal year (default\n * 2081/82). Supports single / couple status, SSF members (skip 1% SST),\n * non-resident flat 25%, women rebate (10% off tax), disabled/pensioner\n * exemptions, and remote-area allowances.\n *\n * @example\n * calculateIncomeTax({ income: 1_000_000, status: \"single\" });\n * // { fiscalYear: \"2081/82\", grossIncome: 1000000, taxableIncome: 1000000,\n * //   tax: 85000, effectiveRate: 0.085, perBracket: [...], notes: [...] }\n */\n\nimport { getRates } from \"./data/index.js\";\nimport type {\n  FiscalYear,\n  IncomeTaxResult,\n  SlabSet,\n  TaxProfile,\n  TaxSlab,\n} from \"./types.js\";\nimport { ensureNonNegative, r2, r4 } from \"./util.js\";\n\nconst REMOTE_AREA_DEDUCTIONS: Record<NonNullable<TaxProfile[\"remoteArea\"]>, number> = {\n  A: 50_000,\n  B: 40_000,\n  C: 30_000,\n  D: 20_000,\n  E: 10_000,\n};\n\n/** Pure function: apply a slab table to a taxable income amount. */\nexport function applySlabs(taxableIncome: number, slabs: SlabSet): {\n  tax: number;\n  perBracket: IncomeTaxResult[\"perBracket\"];\n} {\n  ensureNonNegative(taxableIncome, \"applySlabs\");\n  const perBracket: Array<{ bracket: TaxSlab; amountInBracket: number; tax: number }> = [];\n  let tax = 0;\n  let remaining = taxableIncome;\n  for (const slab of slabs) {\n    if (remaining <= 0) break;\n    const span = slab.to - slab.from;\n    const inBracket = Math.min(remaining, span);\n    const slabTax = inBracket * slab.rate;\n    perBracket.push({ bracket: slab, amountInBracket: r2(inBracket), tax: r2(slabTax) });\n    tax += slabTax;\n    remaining -= inBracket;\n  }\n  return { tax: r2(tax), perBracket };\n}\n\n/** Compute the basic exemption threshold given a profile & FY. */\nfunction thresholdFor(slabs: SlabSet, profile: TaxProfile): number {\n  // First slab end is the basic threshold.\n  let base = slabs[0]?.to ?? 0;\n  if (profile.isDisabled) base += 0.5 * base;\n  if (profile.isPensioner) base += 0.25 * base;\n  return base;\n}\n\n/** Income tax options. */\nexport interface IncomeTaxOptions {\n  /** Annual gross income (NPR rupees). */\n  readonly income: number;\n  /** Filing status — defaults to `\"single\"`. */\n  readonly status?: TaxProfile[\"status\"];\n  /** Fiscal year — defaults to current. */\n  readonly fiscalYear?: FiscalYear;\n  /** Tax-payer profile flags. */\n  readonly profile?: Omit<TaxProfile, \"status\">;\n  /** Pre-calculated total deductions to subtract from gross. */\n  readonly deductions?: number;\n}\n\n/**\n * Calculate income tax for an individual / sole proprietor.\n *\n * Returns the slab-applied tax (after rebates and rounding). For full\n * payroll-style breakdown including SSF/PF/insurance deductions, use\n * `calculatePayroll` instead.\n *\n * @example\n * calculateIncomeTax({ income: 800_000, status: \"single\" }).tax;\n * // 5000  + 20000 + 20000 = 45000\n */\nexport function calculateIncomeTax(options: IncomeTaxOptions): IncomeTaxResult {\n  const {\n    income,\n    status = \"single\",\n    fiscalYear,\n    profile = {},\n    deductions = 0,\n  } = options;\n  ensureNonNegative(income, \"calculateIncomeTax\");\n  ensureNonNegative(deductions, \"calculateIncomeTax\");\n\n  const rates = getRates(fiscalYear);\n  const fullProfile: TaxProfile = { status, ...profile };\n  const notes: string[] = [];\n\n  // Non-resident — flat rate.\n  if (fullProfile.residency === \"non-resident\") {\n    const tax = r2(Math.max(0, income - deductions) * 0.25);\n    notes.push(\"Non-resident flat 25%\");\n    return {\n      fiscalYear: rates.fiscalYear,\n      grossIncome: income,\n      taxableIncome: r2(Math.max(0, income - deductions)),\n      tax,\n      effectiveRate: income > 0 ? r4(tax / income) : 0,\n      perBracket: [],\n      notes,\n    };\n  }\n\n  let slabs = status === \"couple\" ? rates.slabsCouple : rates.slabsSingle;\n\n  // SSF members are exempt from the 1% SST slab — replace with 0%.\n  if (fullProfile.isSSFMember) {\n    slabs = slabs.map((s, i) => (i === 0 ? { ...s, rate: 0, label: \"Exempt (SSF)\" } : s));\n    notes.push(\"SSF member: 1% SST exempt\");\n  }\n\n  // Apply remote-area deduction.\n  let extraDeduction = 0;\n  if (fullProfile.remoteArea) {\n    extraDeduction = REMOTE_AREA_DEDUCTIONS[fullProfile.remoteArea];\n    notes.push(`Remote area ${fullProfile.remoteArea}: -Rs ${extraDeduction.toLocaleString()}`);\n  }\n\n  // Disabled / pensioner widen the basic exemption.\n  const widenedThreshold = thresholdFor(slabs, fullProfile);\n  if (fullProfile.isDisabled) notes.push(`Disabled exemption: threshold widened to Rs ${widenedThreshold.toLocaleString()}`);\n  if (fullProfile.isPensioner) notes.push(`Pensioner exemption: threshold widened to Rs ${widenedThreshold.toLocaleString()}`);\n\n  const adjustedSlabs = (fullProfile.isDisabled || fullProfile.isPensioner)\n    ? widenSlabs(slabs, widenedThreshold)\n    : slabs;\n\n  const taxable = Math.max(0, income - deductions - extraDeduction);\n  const { tax: rawTax, perBracket } = applySlabs(taxable, adjustedSlabs);\n\n  // Women rebate: 10% off the computed tax (employment income, single only).\n  let tax = rawTax;\n  if (fullProfile.isWomanRebate && status === \"single\") {\n    tax = r2(rawTax * 0.9);\n    notes.push(\"Women rebate: 10% reduction\");\n  }\n\n  return {\n    fiscalYear: rates.fiscalYear,\n    grossIncome: income,\n    taxableIncome: r2(taxable),\n    tax,\n    effectiveRate: income > 0 ? r4(tax / income) : 0,\n    perBracket,\n    notes,\n  };\n}\n\n/** Internal: shift the basic exemption to a wider threshold. */\nfunction widenSlabs(slabs: SlabSet, newFirstTo: number): SlabSet {\n  const original = slabs[0];\n  if (!original) return slabs;\n  if (newFirstTo <= original.to) return slabs;\n  const widened: TaxSlab[] = [{ ...original, to: newFirstTo }];\n  for (let i = 1; i < slabs.length; i++) {\n    const s = slabs[i]!;\n    if (s.from < newFirstTo) {\n      if (s.to > newFirstTo) {\n        widened.push({ ...s, from: newFirstTo });\n      }\n      // else fully absorbed — drop\n    } else {\n      widened.push(s);\n    }\n  }\n  return widened;\n}\n\n/** Quick helper: get the slab table for a status & FY. */\nexport function getSlabs(\n  status: TaxProfile[\"status\"] = \"single\",\n  fiscalYear?: FiscalYear,\n): SlabSet {\n  const rates = getRates(fiscalYear);\n  return status === \"couple\" ? rates.slabsCouple : rates.slabsSingle;\n}\n\n/** Effective tax rate (= tax / income) for a given income. */\nexport function getEffectiveRate(\n  income: number,\n  status: TaxProfile[\"status\"] = \"single\",\n  fiscalYear?: FiscalYear,\n): number {\n  if (income <= 0) return 0;\n  const result = calculateIncomeTax({ income, status, fiscalYear });\n  return result.effectiveRate;\n}\n\n/** Marginal rate at a given income level. */\nexport function getMarginalRate(\n  income: number,\n  status: TaxProfile[\"status\"] = \"single\",\n  fiscalYear?: FiscalYear,\n): number {\n  const slabs = getSlabs(status, fiscalYear);\n  for (const s of slabs) {\n    if (income > s.from && income <= s.to) return s.rate;\n  }\n  // Above all brackets — return top rate.\n  return slabs[slabs.length - 1]?.rate ?? 0;\n}\n","/**\n * TDS (Tax Deducted at Source) calculation.\n *\n * @example\n * calculateTDS({ amount: 100_000, type: \"rent\" });\n * // { tds: 10000, rate: 0.10, type: \"rent\", fiscalYear: \"2081/82\" }\n *\n * calculateTDS({ amount: 100_000, type: \"service-vat-registered\" });\n * // { tds: 1500, rate: 0.015, ... }\n */\n\nimport { getRates } from \"./data/index.js\";\nimport { calculateIncomeTax } from \"./income-tax.js\";\nimport type {\n  FiscalYear,\n  SalaryDeductions,\n  TaxProfile,\n  TdsCategory,\n} from \"./types.js\";\nimport { ensureNonNegative, r2 } from \"./util.js\";\n\n/** TDS calculation result. */\nexport interface TdsResult {\n  readonly type: TdsCategory;\n  readonly amount: number;\n  readonly rate: number;\n  readonly tds: number;\n  readonly netToVendor: number;\n  readonly fiscalYear: FiscalYear;\n}\n\n/** Options for `calculateTDS`. */\nexport interface TdsOptions {\n  /** Gross payment amount before TDS deduction. */\n  readonly amount: number;\n  /** Payment category. */\n  readonly type: TdsCategory;\n  /** Fiscal year — defaults to current. */\n  readonly fiscalYear?: FiscalYear;\n}\n\n/**\n * Compute TDS for a payment by category. Salary TDS uses the slab table —\n * call `calculateSalaryTDS` for that.\n */\nexport function calculateTDS(options: TdsOptions): TdsResult {\n  const { amount, type, fiscalYear } = options;\n  ensureNonNegative(amount, \"calculateTDS\");\n  if (type === \"salary\") {\n    throw new TypeError(\n      \"calculateTDS: salary uses slab-based withholding; use calculateSalaryTDS instead\",\n    );\n  }\n  const rates = getRates(fiscalYear);\n  const rate = rates.tds[type];\n  if (rate === undefined) {\n    throw new TypeError(`calculateTDS: unknown TDS category \"${type}\"`);\n  }\n  const tds = r2(amount * rate);\n  return {\n    type,\n    amount: r2(amount),\n    rate,\n    tds,\n    netToVendor: r2(amount - tds),\n    fiscalYear: rates.fiscalYear,\n  };\n}\n\n/** Get the TDS rate for a category at a given FY. */\nexport function getTDSRate(type: TdsCategory, fiscalYear?: FiscalYear): number {\n  const rates = getRates(fiscalYear);\n  const rate = rates.tds[type];\n  if (rate === undefined) {\n    throw new TypeError(`getTDSRate: unknown TDS category \"${type}\"`);\n  }\n  return rate;\n}\n\n/** Salary TDS options. */\nexport interface SalaryTdsOptions {\n  /** Annual gross salary (NPR). */\n  readonly annualIncome: number;\n  /** Filing status — defaults to `\"single\"`. */\n  readonly status?: TaxProfile[\"status\"];\n  /** Tax-payer profile flags. */\n  readonly profile?: Omit<TaxProfile, \"status\">;\n  /**\n   * Annual deductions to subtract from gross. Either:\n   *  - a pre-calculated `number` total, or\n   *  - a `SalaryDeductions` block (retirement / lifeInsurance / healthInsurance\n   *    / donation) which is internally capped via `totalDeductions`.\n   */\n  readonly deductions?: number | SalaryDeductions;\n  /** Fiscal year — defaults to current. */\n  readonly fiscalYear?: FiscalYear;\n}\n\n/** Salary TDS result. */\nexport interface SalaryTdsResult {\n  readonly fiscalYear: FiscalYear;\n  readonly annualTax: number;\n  readonly monthlyTds: number;\n}\n\n/**\n * Compute monthly salary TDS via the slab table. Splits annual tax into 12\n * equal monthly withholdings.\n *\n * For festival-bonus / 13-month payroll, use `calculatePayroll` which handles\n * proration explicitly.\n */\nexport function calculateSalaryTDS(options: SalaryTdsOptions): SalaryTdsResult {\n  const deductionsTotal =\n    typeof options.deductions === \"number\" || options.deductions === undefined\n      ? options.deductions\n      : totalDeductions(\n          options.deductions,\n          options.fiscalYear,\n          options.profile?.isSSFMember ?? false,\n          Math.max(0, options.annualIncome),\n        );\n  const result = calculateIncomeTax({\n    income: options.annualIncome,\n    status: options.status,\n    fiscalYear: options.fiscalYear,\n    profile: options.profile,\n    deductions: deductionsTotal,\n  });\n  return {\n    fiscalYear: result.fiscalYear,\n    annualTax: result.tax,\n    monthlyTds: r2(result.tax / 12),\n  };\n}\n\n/** Convenience: compute total deductions from a `SalaryDeductions` block. */\nexport function totalDeductions(\n  d: SalaryDeductions,\n  fiscalYear?: FiscalYear,\n  isSSFMember = false,\n  taxableIncomeBeforeDonation?: number,\n): number {\n  const rates = getRates(fiscalYear);\n  const caps = rates.deductionCaps;\n\n  const retCap = isSSFMember ? caps.retirementSsf : caps.retirement;\n  const retirement = Math.min(d.retirement ?? 0, retCap);\n  const lifeInsurance = Math.min(d.lifeInsurance ?? 0, caps.lifeInsurance);\n  const healthInsurance = Math.min(d.healthInsurance ?? 0, caps.healthInsurance);\n\n  let donation = 0;\n  if (d.donation && d.donation > 0) {\n    let cap = caps.donation;\n    if (taxableIncomeBeforeDonation !== undefined) {\n      cap = Math.min(cap, caps.donationPercentOfTaxableIncome * taxableIncomeBeforeDonation);\n    }\n    donation = Math.min(d.donation, cap);\n  }\n\n  return r2(retirement + lifeInsurance + healthInsurance + donation);\n}\n","/**\n * VAT (Value Added Tax) — 13% standard rate on Nepali invoices.\n *\n * @example\n * calculateVAT(1000);                        // { base: 1000, vat: 130, total: 1130, ... }\n * calculateVAT(1130, { inclusive: true });   // { base: 1000, vat: 130, total: 1130, ... }\n * extractVAT(1130);                          // 130\n * isAboveVATThreshold(60_00_000, \"goods\")    // true\n */\n\nimport { getRates } from \"./data/index.js\";\nimport type { FiscalYear, VatResult } from \"./types.js\";\nimport { ensureNonNegative, r2 } from \"./util.js\";\n\n/** Options for `calculateVAT`. */\nexport interface VatOptions {\n  /** Whether the input amount is VAT-inclusive (default `false`). */\n  readonly inclusive?: boolean;\n  /** Fiscal year (default current). */\n  readonly fiscalYear?: FiscalYear;\n  /** Override VAT rate (default = current FY rate, 13%). */\n  readonly rate?: number;\n}\n\n/**\n * Compute VAT on a base amount. By default treats input as VAT-exclusive.\n * Pass `{ inclusive: true }` to back-out VAT from a tax-included total.\n *\n * @example\n * calculateVAT(1000)                         // exclusive: vat=130, total=1130\n * calculateVAT(1130, { inclusive: true })    // inclusive: base=1000, vat=130\n */\nexport function calculateVAT(amount: number, options: VatOptions = {}): VatResult {\n  ensureNonNegative(amount, \"calculateVAT\");\n  const rates = getRates(options.fiscalYear);\n  const rate = options.rate ?? rates.vat.rate;\n  if (options.inclusive) {\n    const base = amount / (1 + rate);\n    const vat = amount - base;\n    return {\n      base: r2(base),\n      vat: r2(vat),\n      total: r2(amount),\n      rate,\n      inclusive: true,\n    };\n  }\n  const vat = amount * rate;\n  return {\n    base: r2(amount),\n    vat: r2(vat),\n    total: r2(amount + vat),\n    rate,\n    inclusive: false,\n  };\n}\n\n/** Just return the VAT amount from an inclusive total. */\nexport function extractVAT(totalInclusive: number, fiscalYear?: FiscalYear): number {\n  return calculateVAT(totalInclusive, { inclusive: true, fiscalYear }).vat;\n}\n\n/** Just return the VAT amount on top of an exclusive base. */\nexport function addVAT(base: number, fiscalYear?: FiscalYear): number {\n  return calculateVAT(base, { inclusive: false, fiscalYear }).vat;\n}\n\n/** Get the current standard VAT rate (default 13%). */\nexport function getVATRate(fiscalYear?: FiscalYear): number {\n  return getRates(fiscalYear).vat.rate;\n}\n\n/** Get the VAT-registration threshold for goods or services. */\nexport function getVATThreshold(\n  type: \"goods\" | \"service\",\n  fiscalYear?: FiscalYear,\n): number {\n  const rates = getRates(fiscalYear);\n  return type === \"goods\" ? rates.vat.thresholdGoods : rates.vat.thresholdService;\n}\n\n/** True if a turnover triggers mandatory VAT registration. */\nexport function isAboveVATThreshold(\n  turnover: number,\n  type: \"goods\" | \"service\",\n  fiscalYear?: FiscalYear,\n): boolean {\n  return turnover >= getVATThreshold(type, fiscalYear);\n}\n","/**\n * Capital gains tax for shares (listed/unlisted) and real estate.\n *\n * Holding-period thresholds:\n *  - Listed shares (individual): 365 days for long-term\n *  - Land/building (individual): 5 years (1825 days) for long-term\n *\n * @example\n * calculateCapitalGains({\n *   asset: \"shares-listed-individual\",\n *   gain: 100000,\n *   holdingDays: 400,\n *   ownerType: \"individual\",\n *   listed: true,\n * });\n * // { tax: 5000, rate: 0.05, ... }\n */\n\nimport { getRates } from \"./data/index.js\";\nimport type {\n  CapitalGainsAsset,\n  FiscalYear,\n} from \"./types.js\";\nimport { ensureNonNegative, r2 } from \"./util.js\";\n\n/** Options for `calculateCapitalGains` — high-level form. */\nexport interface CapitalGainsOptions {\n  /** Realised gain in NPR. */\n  readonly gain: number;\n  /**\n   * Asset class.\n   *  - `\"shares-listed\"`: ordinary listed shares (individual: 7.5% short / 5% long, entity: 10%).\n   *  - `\"shares-listed-promoter\"`: promoter shares — flat 10% regardless of holding period.\n   *  - `\"shares-unlisted\"`: unlisted/private shares (10% individual, 15% entity).\n   *  - `\"land\"`: real estate (individual: 7.5% short / 5% long over 5y, entity: 1.5%).\n   *\n   * For **bonus shares**, pass `gain = sellPrice * qty` (cost basis = 0) and\n   * `asset: \"shares-listed\"` — the rate then follows the holding period.\n   */\n  readonly asset:\n    | \"shares-listed\"\n    | \"shares-listed-promoter\"\n    | \"shares-unlisted\"\n    | \"land\";\n  /** Owner type. Ignored for `\"shares-listed-promoter\"` (always individual flat rate). */\n  readonly ownerType: \"individual\" | \"entity\";\n  /** Holding period in days (only relevant for individuals on listed shares / land). */\n  readonly holdingDays?: number;\n  /** Fiscal year (default current). */\n  readonly fiscalYear?: FiscalYear;\n}\n\n/** Result of capital gains calculation. */\nexport interface CapitalGainsResult {\n  readonly fiscalYear: FiscalYear;\n  readonly asset: CapitalGainsAsset;\n  readonly gain: number;\n  readonly rate: number;\n  readonly tax: number;\n  readonly netProceeds: number;\n}\n\nconst SHARES_LONG_TERM_DAYS = 365;\nconst LAND_LONG_TERM_DAYS = 5 * 365; // 1825\n\n/** Resolve the canonical `CapitalGainsAsset` key from high-level inputs. */\nfunction resolveAssetKey(opts: CapitalGainsOptions): CapitalGainsAsset {\n  const { asset, ownerType, holdingDays = 0 } = opts;\n  if (asset === \"shares-listed-promoter\") {\n    return \"shares-listed-promoter\";\n  }\n  if (asset === \"shares-listed\") {\n    if (ownerType === \"entity\") return \"shares-listed-entity\";\n    return holdingDays >= SHARES_LONG_TERM_DAYS\n      ? \"shares-listed-individual-long\"\n      : \"shares-listed-individual-short\";\n  }\n  if (asset === \"shares-unlisted\") {\n    return ownerType === \"entity\"\n      ? \"shares-unlisted-entity\"\n      : \"shares-unlisted-individual\";\n  }\n  // land\n  if (ownerType === \"entity\") return \"land-entity\";\n  return holdingDays >= LAND_LONG_TERM_DAYS\n    ? \"land-individual-long\"\n    : \"land-individual-short\";\n}\n\n/** Calculate capital gains tax (high-level form). */\nexport function calculateCapitalGains(opts: CapitalGainsOptions): CapitalGainsResult {\n  ensureNonNegative(opts.gain, \"calculateCapitalGains\");\n  const rates = getRates(opts.fiscalYear);\n  const key = resolveAssetKey(opts);\n  const rate = rates.capitalGains[key];\n  const tax = r2(opts.gain * rate);\n  return {\n    fiscalYear: rates.fiscalYear,\n    asset: key,\n    gain: r2(opts.gain),\n    rate,\n    tax,\n    netProceeds: r2(opts.gain - tax),\n  };\n}\n\n/** Get the rate for a specific canonical asset key. */\nexport function getCapitalGainsRate(\n  asset: CapitalGainsAsset,\n  fiscalYear?: FiscalYear,\n): number {\n  return getRates(fiscalYear).capitalGains[asset];\n}\n","/**\n * Social Security Fund (SSF), Provident Fund (PF), and Citizen Investment\n * Trust (CIT) contributions.\n *\n * **SSF**: 31% total = 11% employee + 20% employer. Sub-allocation:\n *   medical 3.22%, accident 1.40%, dependent 0.27%, retirement 26.11%.\n *\n * **PF**: standard 10% + 10% employer match.\n *\n * **CIT**: voluntary, capped per `deductionCaps.retirement(Ssf)`.\n *\n * @example\n * calculateSSF(50000)\n * // { employee: 5500, employer: 10000, total: 15500, breakdown: {...} }\n *\n * calculatePF(50000)\n * // { employee: 5000, employer: 5000, total: 10000 }\n */\n\nimport { getRates } from \"./data/index.js\";\nimport type { FiscalYear } from \"./types.js\";\nimport { ensureNonNegative, r2 } from \"./util.js\";\n\n/** SSF result. */\nexport interface SsfResult {\n  readonly basicSalary: number;\n  readonly employee: number;\n  readonly employer: number;\n  readonly total: number;\n  readonly breakdown: {\n    readonly medical: number;\n    readonly accident: number;\n    readonly dependent: number;\n    readonly retirement: number;\n  };\n  readonly fiscalYear: FiscalYear;\n}\n\n/**\n * Calculate SSF contribution on a basic salary amount.\n * @param basicSalary - Monthly OR annual basic salary, library is unit-agnostic.\n *                      Result will be in the same units.\n */\nexport function calculateSSF(\n  basicSalary: number,\n  options: { fiscalYear?: FiscalYear } = {},\n): SsfResult {\n  ensureNonNegative(basicSalary, \"calculateSSF\");\n  const rates = getRates(options.fiscalYear);\n  const ssf = rates.ssf;\n  const total = basicSalary * (ssf.employee + ssf.employer);\n  const breakdown = {\n    medical: r2(basicSalary * ssf.breakdown.medical),\n    accident: r2(basicSalary * ssf.breakdown.accident),\n    dependent: r2(basicSalary * ssf.breakdown.dependent),\n    retirement: r2(basicSalary * ssf.breakdown.retirement),\n  };\n  return {\n    basicSalary: r2(basicSalary),\n    employee: r2(basicSalary * ssf.employee),\n    employer: r2(basicSalary * ssf.employer),\n    total: r2(total),\n    breakdown,\n    fiscalYear: rates.fiscalYear,\n  };\n}\n\n/** PF result. */\nexport interface PfResult {\n  readonly basicSalary: number;\n  readonly employee: number;\n  readonly employer: number;\n  readonly total: number;\n  readonly fiscalYear: FiscalYear;\n}\n\n/**\n * Calculate Provident Fund contribution.\n * @param employeeRateOverride Custom employee rate (default 10%); employer matches.\n */\nexport function calculatePF(\n  basicSalary: number,\n  options: { fiscalYear?: FiscalYear; employeeRate?: number; employerRate?: number } = {},\n): PfResult {\n  ensureNonNegative(basicSalary, \"calculatePF\");\n  const rates = getRates(options.fiscalYear);\n  const empRate = options.employeeRate ?? rates.pf.employee;\n  const erRate = options.employerRate ?? rates.pf.employer;\n  return {\n    basicSalary: r2(basicSalary),\n    employee: r2(basicSalary * empRate),\n    employer: r2(basicSalary * erRate),\n    total: r2(basicSalary * (empRate + erRate)),\n    fiscalYear: rates.fiscalYear,\n  };\n}\n\n/** CIT contribution capped at the retirement deduction limit. */\nexport interface CitResult {\n  readonly contribution: number;\n  readonly cappedContribution: number;\n  readonly cap: number;\n  readonly excess: number;\n  readonly fiscalYear: FiscalYear;\n}\n\n/**\n * Compute the deductible portion of a CIT contribution. Excess over the cap\n * is still deposited but not deductible.\n */\nexport function calculateCIT(\n  contribution: number,\n  options: { fiscalYear?: FiscalYear; isSSFMember?: boolean } = {},\n): CitResult {\n  ensureNonNegative(contribution, \"calculateCIT\");\n  const rates = getRates(options.fiscalYear);\n  const cap = options.isSSFMember\n    ? rates.deductionCaps.retirementSsf\n    : rates.deductionCaps.retirement;\n  const cappedContribution = Math.min(contribution, cap);\n  return {\n    contribution: r2(contribution),\n    cappedContribution: r2(cappedContribution),\n    cap,\n    excess: r2(Math.max(0, contribution - cap)),\n    fiscalYear: rates.fiscalYear,\n  };\n}\n","/**\n * Corporate income tax — single-rate by category.\n *\n * Standard companies: 25%. Banks/insurance/telecom/petroleum/capital-market/\n * tobacco-alcohol: 30%. Special manufacturing industries: 20%. Export: 20%.\n *\n * @example\n * calculateCorporateTax({ profit: 10_000_000, category: \"standard\" });\n * // { tax: 2500000, rate: 0.25, ... }\n */\n\nimport { getRates } from \"./data/index.js\";\nimport type { CorporateCategory, FiscalYear } from \"./types.js\";\nimport { ensureNonNegative, r2 } from \"./util.js\";\n\n/** Options for corporate tax. */\nexport interface CorporateTaxOptions {\n  /** Net profit before tax (NPR). */\n  readonly profit: number;\n  /** Industry category. */\n  readonly category: CorporateCategory;\n  /** Fiscal year (default current). */\n  readonly fiscalYear?: FiscalYear;\n}\n\n/** Corporate tax result. */\nexport interface CorporateTaxResult {\n  readonly fiscalYear: FiscalYear;\n  readonly category: CorporateCategory;\n  readonly profit: number;\n  readonly rate: number;\n  readonly tax: number;\n  readonly netAfterTax: number;\n}\n\n/** Calculate corporate income tax. */\nexport function calculateCorporateTax(opts: CorporateTaxOptions): CorporateTaxResult {\n  ensureNonNegative(opts.profit, \"calculateCorporateTax\");\n  const rates = getRates(opts.fiscalYear);\n  const rate = rates.corporate[opts.category];\n  const tax = r2(opts.profit * rate);\n  return {\n    fiscalYear: rates.fiscalYear,\n    category: opts.category,\n    profit: r2(opts.profit),\n    rate,\n    tax,\n    netAfterTax: r2(opts.profit - tax),\n  };\n}\n\n/** Get the corporate rate for a category at a given FY. */\nexport function getCorporateRate(\n  category: CorporateCategory,\n  fiscalYear?: FiscalYear,\n): number {\n  return getRates(fiscalYear).corporate[category];\n}\n","/**\n * End-to-end payroll calculator — gross monthly salary → annual tax → monthly\n * net take-home.\n *\n * Pipeline:\n *   1. Annualize gross (months + festival bonus)\n *   2. Compute SSF/PF deductions\n *   3. Add other deductions (insurance, donation, retirement)\n *   4. Cap deductions per FY rules\n *   5. Apply slabs to taxable income\n *   6. Apply rebates (women, etc.)\n *   7. Annual net = gross − SSF/PF employee − tax\n *   8. Monthly net = annual net / 12\n *\n * @example\n * calculatePayroll({\n *   monthlyBasic: 50_000,\n *   monthlyAllowances: 20_000,\n *   festivalBonus: true,\n *   profile: { status: \"single\", isSSFMember: true },\n *   deductions: { lifeInsurance: 30_000 },\n * });\n */\n\nimport { calculateSSF, calculatePF } from \"./contributions.js\";\nimport { getRates } from \"./data/index.js\";\nimport { calculateIncomeTax } from \"./income-tax.js\";\nimport { totalDeductions } from \"./tds.js\";\nimport type {\n  FiscalYear,\n  PayrollResult,\n  SalaryDeductions,\n  TaxProfile,\n} from \"./types.js\";\nimport { ensureNonNegative, r2 } from \"./util.js\";\n\n/** Options for `calculatePayroll`. */\nexport interface PayrollOptions {\n  /** Monthly basic salary (used as base for SSF/PF). */\n  readonly monthlyBasic: number;\n  /** Monthly non-basic allowances (taxable but not contribution-eligible). */\n  readonly monthlyAllowances?: number;\n  /** Whether a 1-month festival/Dashain bonus is paid (default true). */\n  readonly festivalBonus?: boolean;\n  /** Number of months (default 12 — Dashain bonus is added separately). */\n  readonly months?: number;\n  /** Tax profile. */\n  readonly profile?: TaxProfile;\n  /** Additional voluntary deductions. */\n  readonly deductions?: SalaryDeductions;\n  /** Use SSF (subtract employee SSF) or PF (default `\"ssf\"` if SSF member, else `\"pf\"`). */\n  readonly retirementScheme?: \"ssf\" | \"pf\" | \"none\";\n  /** Override PF employee rate (default 10%). */\n  readonly pfEmployeeRate?: number;\n  /** Override PF employer rate (default 10%). */\n  readonly pfEmployerRate?: number;\n  /** Fiscal year (default current). */\n  readonly fiscalYear?: FiscalYear;\n}\n\n/**\n * Run a full payroll calculation. Returns the breakdown for one fiscal year.\n *\n * Conventions:\n *  - Festival bonus = 1 month basic + allowances, fully taxable.\n *  - Annual gross includes festival bonus.\n *  - Retirement scheme contribution counts as a deduction per `deductionCaps`.\n *  - SSF members are exempt from the 1% SST (handled in income-tax module).\n */\nexport function calculatePayroll(options: PayrollOptions): PayrollResult {\n  const {\n    monthlyBasic,\n    monthlyAllowances = 0,\n    festivalBonus = true,\n    months = 12,\n    profile = { status: \"single\" },\n    deductions = {},\n    retirementScheme,\n    pfEmployeeRate,\n    pfEmployerRate,\n    fiscalYear,\n  } = options;\n\n  ensureNonNegative(monthlyBasic, \"calculatePayroll\");\n  ensureNonNegative(monthlyAllowances, \"calculatePayroll\");\n\n  const rates = getRates(fiscalYear);\n  const notes: string[] = [];\n\n  // 1. Annualize gross.\n  const monthlyGross = monthlyBasic + monthlyAllowances;\n  const baseAnnual = monthlyGross * months;\n  const bonus = festivalBonus ? monthlyGross : 0;\n  const annualGross = baseAnnual + bonus;\n  const annualBasic = monthlyBasic * months + (festivalBonus ? monthlyBasic : 0);\n\n  if (festivalBonus) notes.push(`Festival bonus: 1 month gross (Rs ${monthlyGross.toLocaleString()})`);\n\n  // 2. Compute retirement scheme.\n  const scheme = retirementScheme ?? (profile.isSSFMember ? \"ssf\" : \"pf\");\n  let employeeRetirement = 0;\n  let employerRetirement = 0;\n  let ssfEmployee = 0;\n  let ssfEmployer = 0;\n  let pfEmployee = 0;\n  let pfEmployer = 0;\n\n  if (scheme === \"ssf\") {\n    const ssf = calculateSSF(annualBasic, { fiscalYear });\n    ssfEmployee = ssf.employee;\n    ssfEmployer = ssf.employer;\n    employeeRetirement = ssfEmployee;\n    employerRetirement = ssfEmployer;\n    notes.push(\"Retirement scheme: SSF (11% employee + 20% employer)\");\n  } else if (scheme === \"pf\") {\n    const pf = calculatePF(annualBasic, {\n      fiscalYear,\n      ...(pfEmployeeRate !== undefined && { employeeRate: pfEmployeeRate }),\n      ...(pfEmployerRate !== undefined && { employerRate: pfEmployerRate }),\n    });\n    pfEmployee = pf.employee;\n    pfEmployer = pf.employer;\n    employeeRetirement = pfEmployee;\n    employerRetirement = pfEmployer;\n    notes.push(\"Retirement scheme: PF (10% + 10%)\");\n  }\n\n  // 3. Sum deductions (capped).\n  // Add the employee retirement contribution as a deduction (counts toward\n  // retirement cap), in addition to whatever the user passed in `deductions.retirement`.\n  const totalRetirement = employeeRetirement + (deductions.retirement ?? 0);\n  const cappedDeductions = totalDeductions(\n    {\n      retirement: totalRetirement,\n      lifeInsurance: deductions.lifeInsurance ?? 0,\n      healthInsurance: deductions.healthInsurance ?? 0,\n      donation: deductions.donation ?? 0,\n    },\n    fiscalYear,\n    profile.isSSFMember ?? false,\n    annualGross,\n  );\n\n  // 4. Apply slabs.\n  const taxResult = calculateIncomeTax({\n    income: annualGross,\n    status: profile.status,\n    fiscalYear: rates.fiscalYear,\n    profile,\n    deductions: cappedDeductions,\n  });\n  notes.push(...taxResult.notes);\n\n  // 5. Net = gross − employee retirement − tax. (Employer portion is not paid out to employee.)\n  const annualNet = r2(annualGross - employeeRetirement - taxResult.tax);\n  const monthlyNet = r2(annualNet / months);\n\n  return {\n    fiscalYear: rates.fiscalYear,\n    annualGross: r2(annualGross),\n    annualDeductions: cappedDeductions,\n    taxableIncome: taxResult.taxableIncome,\n    annualTax: taxResult.tax,\n    monthlyTds: r2(taxResult.tax / months),\n    annualNet,\n    monthlyNet,\n    ssfEmployee: r2(ssfEmployee),\n    ssfEmployer: r2(ssfEmployer),\n    pfEmployee: r2(pfEmployee),\n    pfEmployer: r2(pfEmployer),\n    notes,\n  };\n}\n","/**\n * Vendor bill / invoice calculator: given a service amount + VAT-flag + TDS\n * category, computes the full breakdown of payments to vendor and government.\n *\n * @example\n * calculateBill({\n *   serviceAmount: 100_000,\n *   applyVAT: true,\n *   tdsType: \"service-vat-registered\",\n * });\n * // {\n * //   serviceAmount: 100000,\n * //   vat: 13000,\n * //   tds: 1500,           // 1.5% of service amount (not VAT)\n * //   grossInvoice: 113000,\n * //   payableToVendor: 111500, // gross − TDS\n * //   payableToGovtVAT: 13000,\n * //   payableToGovtTDS: 1500,\n * // }\n */\n\nimport { calculateTDS } from \"./tds.js\";\nimport { calculateVAT } from \"./vat.js\";\nimport type {\n  BillResult,\n  FiscalYear,\n  TdsCategory,\n} from \"./types.js\";\nimport { ensureNonNegative, r2 } from \"./util.js\";\n\n/** Options for `calculateBill`. */\nexport interface BillOptions {\n  /** Service amount before VAT. */\n  readonly serviceAmount: number;\n  /** Whether VAT applies (default false — vendor not VAT-registered). */\n  readonly applyVAT?: boolean;\n  /** TDS category (skip if no TDS). */\n  readonly tdsType?: Exclude<TdsCategory, \"salary\">;\n  /** Override VAT rate. */\n  readonly vatRate?: number;\n  /** Fiscal year (default current). */\n  readonly fiscalYear?: FiscalYear;\n}\n\n/**\n * Compute the full vendor invoice with VAT + TDS.\n *\n * TDS is computed on the **service amount only**, not the VAT (per IRD).\n * VAT is added to the service amount; TDS is deducted from the gross invoice.\n */\nexport function calculateBill(options: BillOptions): BillResult {\n  const {\n    serviceAmount,\n    applyVAT = false,\n    tdsType,\n    vatRate,\n    fiscalYear,\n  } = options;\n  ensureNonNegative(serviceAmount, \"calculateBill\");\n\n  let vat = 0;\n  let grossInvoice = serviceAmount;\n  if (applyVAT) {\n    const v = calculateVAT(serviceAmount, {\n      fiscalYear,\n      ...(vatRate !== undefined && { rate: vatRate }),\n    });\n    vat = v.vat;\n    grossInvoice = v.total;\n  }\n\n  let tds = 0;\n  if (tdsType) {\n    const t = calculateTDS({ amount: serviceAmount, type: tdsType, fiscalYear });\n    tds = t.tds;\n  }\n\n  return {\n    serviceAmount: r2(serviceAmount),\n    vat: r2(vat),\n    tds: r2(tds),\n    grossInvoice: r2(grossInvoice),\n    payableToVendor: r2(grossInvoice - tds),\n    payableToGovtVAT: r2(vat),\n    payableToGovtTDS: r2(tds),\n  };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBO,IAAM,mBAAkC;AAAA,EAC7C,YAAY;AAAA;AAAA,EAGZ,aAAa;AAAA,IACX,EAAE,MAAM,GAAG,IAAI,KAAS,MAAM,MAAM,OAAO,MAAM;AAAA,IACjD,EAAE,MAAM,KAAS,IAAI,KAAS,MAAM,IAAK;AAAA,IACzC,EAAE,MAAM,KAAS,IAAI,KAAW,MAAM,IAAK;AAAA,IAC3C,EAAE,MAAM,KAAW,IAAI,KAAW,MAAM,IAAK;AAAA,IAC7C,EAAE,MAAM,KAAW,IAAI,KAAW,MAAM,KAAK;AAAA,IAC7C,EAAE,MAAM,KAAW,IAAI,UAAU,MAAM,KAAK;AAAA,EAC9C;AAAA;AAAA,EAGA,aAAa;AAAA,IACX,EAAE,MAAM,GAAG,IAAI,KAAS,MAAM,MAAM,OAAO,MAAM;AAAA,IACjD,EAAE,MAAM,KAAS,IAAI,KAAS,MAAM,IAAK;AAAA,IACzC,EAAE,MAAM,KAAS,IAAI,MAAW,MAAM,IAAK;AAAA,IAC3C,EAAE,MAAM,MAAW,I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