calcsuite-react 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/calcsuite.js CHANGED
@@ -1,10 +1,10 @@
1
- var ma = Object.defineProperty;
2
- var pa = (e, t, n) => t in e ? ma(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var ge = (e, t, n) => pa(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var fa = Object.defineProperty;
2
+ var ya = (e, t, n) => t in e ? fa(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var ge = (e, t, n) => ya(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as o, jsxs as b, Fragment as re } from "react/jsx-runtime";
5
- import { useState as M, useCallback as ke, useMemo as ne, useContext as ha, createContext as fa, useRef as de, useEffect as X, Fragment as xn, useSyncExternalStore as ya } from "react";
6
- import dt from "decimal.js";
7
- const ba = {
5
+ import { useState as M, useCallback as ke, useMemo as X, useContext as ba, createContext as ga, useRef as de, useEffect as Q, Fragment as xn, useSyncExternalStore as va } from "react";
6
+ import mt from "decimal.js";
7
+ const ka = {
8
8
  money: 2,
9
9
  rate: 6,
10
10
  period: 4,
@@ -13,7 +13,7 @@ const ba = {
13
13
  instalment: "none",
14
14
  residualAbsorption: "last"
15
15
  }, qt = {
16
- rounding: ba,
16
+ rounding: ka,
17
17
  ui: {
18
18
  theme: "system",
19
19
  accent: "#078DEE",
@@ -68,13 +68,13 @@ function xt(e) {
68
68
  defaults: { tenureUnit: "both", rateType: "floating", maxRatePercent: 50, sipReturnPercent: "12", inflationPercent: "6" }
69
69
  };
70
70
  }
71
- const Ze = xt("IN"), H = dt.clone({
71
+ const Qe = xt("IN"), H = mt.clone({
72
72
  precision: 40,
73
- rounding: dt.ROUND_HALF_UP,
73
+ rounding: mt.ROUND_HALF_UP,
74
74
  toExpPos: 60,
75
75
  toExpNeg: -60,
76
- modulo: dt.ROUND_DOWN
77
- }), g = (e) => new H(e), cs = (e, t) => g(e).eq(t), us = (e, t) => g(e).gt(t), ds = (e, t) => g(e).lt(t), ce = (e, t = "1e-9") => e.abs().lt(t), ga = {
76
+ modulo: mt.ROUND_DOWN
77
+ }), g = (e) => new H(e), ms = (e, t) => g(e).eq(t), ps = (e, t) => g(e).gt(t), hs = (e, t) => g(e).lt(t), ce = (e, t = "1e-9") => e.abs().lt(t), wa = {
78
78
  HALF_UP: H.ROUND_HALF_UP,
79
79
  HALF_EVEN: H.ROUND_HALF_EVEN,
80
80
  HALF_DOWN: H.ROUND_HALF_DOWN,
@@ -83,7 +83,7 @@ const Ze = xt("IN"), H = dt.clone({
83
83
  CEIL: H.ROUND_CEIL,
84
84
  FLOOR: H.ROUND_FLOOR
85
85
  };
86
- function va(e) {
86
+ function Na(e) {
87
87
  switch (e.numberFormat.grouping) {
88
88
  case "indian":
89
89
  return "en-IN";
@@ -98,7 +98,7 @@ function va(e) {
98
98
  }
99
99
  }
100
100
  function Sn(e) {
101
- const t = ga[e.rounding.mode], n = (l, p = e.numberFormat.decimalPlaces) => g(l).toDecimalPlaces(p, t), a = (l, p) => e.numberFormat.grouping === "plain" ? l.toFixed(p) : new Intl.NumberFormat(va(e), {
101
+ const t = wa[e.rounding.mode], n = (l, p = e.numberFormat.decimalPlaces) => g(l).toDecimalPlaces(p, t), a = (l, p) => e.numberFormat.grouping === "plain" ? l.toFixed(p) : new Intl.NumberFormat(Na(e), {
102
102
  minimumFractionDigits: e.numberFormat.trimTrailingZeros ? 0 : p,
103
103
  maximumFractionDigits: p
104
104
  }).format(l), r = (l, p) => l ? e.numberFormat.negativeFormat === "parentheses" ? `(${p})` : `-${p}` : p, s = (l) => {
@@ -122,71 +122,108 @@ function Sn(e) {
122
122
  };
123
123
  return { settings: e, money: m, moneyParts: d, num: i, pct: (l, p = e.numberFormat.percentPlaces) => `${i(l, p)}%`, compact: u, round: n };
124
124
  }
125
- function mt(e) {
125
+ function pt(e) {
126
126
  const t = Math.floor(e / 12), n = e % 12, a = [];
127
127
  return t && a.push(`${t} yr`), n && a.push(`${n} mo`), a.join(" ") || "0 mo";
128
128
  }
129
- const Cn = fa(null), Pn = "calcsuite:settings";
130
- function Xe(e, t) {
129
+ const Cn = [
130
+ { id: "default", label: "Green", main: "#00A76F", light: "#2CCF8E", dark: "#087055", ink: "#06251A" },
131
+ { id: "cyan", label: "Cyan", main: "#078DEE", light: "#68CDF9", dark: "#0351AB", ink: "#FFFFFF" },
132
+ { id: "purple", label: "Purple", main: "#7635DC", light: "#B985F4", dark: "#431A9E", ink: "#FFFFFF" },
133
+ { id: "blue", label: "Blue", main: "#2065D1", light: "#76B0F1", dark: "#103996", ink: "#FFFFFF" },
134
+ { id: "orange", label: "Orange", main: "#FDA92D", light: "#FED680", dark: "#B66816", ink: "#212B36" },
135
+ { id: "gray", label: "Gray", main: "#A4AAB3", light: "#CED1D7", dark: "#63686C", ink: "#FFFFFF" }
136
+ ], xa = (e) => Cn.find((t) => t.main.toLowerCase() === e.toLowerCase()), Je = "-apple-system, 'Segoe UI', system-ui, sans-serif", Pn = [
137
+ { id: "Inter Tight", label: "Inter Tight", stack: `'Inter Tight', ${Je}` },
138
+ { id: "Public Sans", label: "Public Sans", stack: `'Public Sans', ${Je}` },
139
+ { id: "system-ui", label: "System UI", stack: `system-ui, ${Je}` },
140
+ { id: "Georgia", label: "Georgia (serif)", stack: "Georgia, 'Times New Roman', serif" }
141
+ ], Sa = (e) => {
142
+ var t;
143
+ return ((t = Pn.find((n) => n.id === e)) == null ? void 0 : t.stack) ?? `'${e}', ${Je}`;
144
+ }, Tn = ga(null), Fn = "calcsuite:settings";
145
+ function et(e, t) {
131
146
  if (t == null) return e;
132
147
  const n = Array.isArray(e) ? [...e] : { ...e };
133
148
  for (const a of Object.keys(t)) {
134
149
  const r = t[a], s = e[a];
135
- n[a] = r && typeof r == "object" && !Array.isArray(r) && s && typeof s == "object" ? Xe(s, r) : r;
150
+ n[a] = r && typeof r == "object" && !Array.isArray(r) && s && typeof s == "object" ? et(s, r) : r;
136
151
  }
137
152
  return n;
138
153
  }
139
- function ka(e) {
140
- const t = e ? Xe(Ze, e) : Ze;
154
+ function Ca(e) {
155
+ const t = e ? et(Qe, e) : Qe;
141
156
  try {
142
- const n = localStorage.getItem(Pn);
143
- if (n) return Xe(t, JSON.parse(n));
157
+ const n = localStorage.getItem(Fn);
158
+ if (n) return et(t, JSON.parse(n));
144
159
  } catch {
145
160
  }
146
161
  return t;
147
162
  }
148
- function pt(e) {
163
+ function ht(e) {
149
164
  try {
150
- e.persistence.driver === "localStorage" && localStorage.setItem(Pn, JSON.stringify(e));
165
+ e.persistence.driver === "localStorage" && localStorage.setItem(Fn, JSON.stringify(e));
151
166
  } catch {
152
167
  }
153
168
  }
154
- function ms({
169
+ function fs({
155
170
  children: e,
156
171
  settings: t
157
172
  }) {
158
- const [n, a] = M(() => ka(t)), r = ke((p) => {
159
- a(p), pt(p);
160
- }, []), s = ke((p) => a((h) => {
161
- const f = Xe(h, p);
162
- return pt(f), f;
163
- }), []), u = ke((p) => {
164
- a((h) => {
165
- const y = { ...xt(p), ui: h.ui, compliance: h.compliance, persistence: h.persistence, features: h.features };
166
- return pt(y), y;
173
+ const [n, a] = M(() => Ca(t)), r = ke((h) => {
174
+ a(h), ht(h);
175
+ }, []), s = ke((h) => a((f) => {
176
+ const y = et(f, h);
177
+ return ht(y), y;
178
+ }), []), u = ke((h) => {
179
+ a((f) => {
180
+ const w = { ...xt(h), ui: f.ui, compliance: f.compliance, persistence: f.persistence, features: f.features };
181
+ return ht(w), w;
167
182
  });
168
- }, []), m = ke(() => r(xt(n.region)), [r, n.region]), d = ke((p) => r(p), [r]), i = ne(() => Sn(n), [n]), c = ne(() => {
169
- var h;
170
- const p = n.ui.theme;
171
- return p === "system" ? (h = window.matchMedia) != null && h.call(window, "(prefers-color-scheme: dark)").matches ? "dark" : "light" : p;
172
- }, [n.ui.theme]), l = ne(
183
+ }, []), m = ke(() => r(xt(n.region)), [r, n.region]), d = ke((h) => r(h), [r]), i = X(() => Sn(n), [n]), c = X(() => {
184
+ var f;
185
+ const h = n.ui.theme;
186
+ return h === "system" ? (f = window.matchMedia) != null && f.call(window, "(prefers-color-scheme: dark)").matches ? "dark" : "light" : h;
187
+ }, [n.ui.theme]), l = X(
173
188
  () => ({ settings: n, fmt: i, update: s, setRegion: u, reset: m, replace: d, resolvedTheme: c }),
174
189
  [n, i, s, u, m, d, c]
190
+ ), p = X(
191
+ () => {
192
+ var h;
193
+ return {
194
+ display: "contents",
195
+ "--fc-accent": n.ui.accent,
196
+ // Each preset ships its own readable text colour for on-accent surfaces (buttons, active nav,
197
+ // FAB). Without this, on-accent text falls back to white and low-contrasts on light accents.
198
+ "--fc-accent-ink": ((h = xa(n.ui.accent)) == null ? void 0 : h.ink) ?? "#ffffff",
199
+ "--fc-font-ui": Sa(n.ui.fontFamily)
200
+ };
201
+ },
202
+ [n.ui.accent, n.ui.fontFamily]
175
203
  );
176
- return /* @__PURE__ */ o(Cn.Provider, { value: l, children: e });
204
+ return /* @__PURE__ */ o(Tn.Provider, { value: l, children: /* @__PURE__ */ o(
205
+ "div",
206
+ {
207
+ "data-fincalc-root": "",
208
+ "data-theme": c === "highContrast" ? "dark" : c,
209
+ "data-density": n.ui.density,
210
+ style: p,
211
+ children: e
212
+ }
213
+ ) });
177
214
  }
178
215
  function ue() {
179
- const e = ha(Cn);
216
+ const e = ba(Tn);
180
217
  if (!e) throw new Error("useSettings must be used within SettingsProvider");
181
218
  return e;
182
219
  }
183
- let Qe = 0;
184
- const wa = () => {
185
- Qe += 1;
186
- }, Na = () => {
187
- Qe = Math.max(0, Qe - 1);
188
- }, xa = () => Qe > 0, Sa = 'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
189
- function Ca({
220
+ let tt = 0;
221
+ const Pa = () => {
222
+ tt += 1;
223
+ }, Ta = () => {
224
+ tt = Math.max(0, tt - 1);
225
+ }, Fa = () => tt > 0, Ia = 'a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';
226
+ function Ra({
190
227
  open: e,
191
228
  onClose: t,
192
229
  children: n,
@@ -195,11 +232,11 @@ function Ca({
195
232
  }) {
196
233
  const s = de(null), u = de(null), m = ke(() => {
197
234
  const h = s.current;
198
- return h ? Array.from(h.querySelectorAll(Sa)).filter(
235
+ return h ? Array.from(h.querySelectorAll(Ia)).filter(
199
236
  (f) => !f.hasAttribute("disabled") && f.getAttribute("aria-hidden") !== "true"
200
237
  ) : [];
201
238
  }, []), [d, i] = M(e), [c, l] = M(!1);
202
- X(() => {
239
+ Q(() => {
203
240
  if (e)
204
241
  i(!0), l(!1);
205
242
  else if (d) {
@@ -209,7 +246,7 @@ function Ca({
209
246
  }, 210);
210
247
  return () => clearTimeout(h);
211
248
  }
212
- }, [e]), X(() => {
249
+ }, [e]), Q(() => {
213
250
  if (!e) return;
214
251
  const h = s.current;
215
252
  u.current = document.activeElement;
@@ -219,7 +256,7 @@ function Ca({
219
256
  document.body.style.overflow = "hidden";
220
257
  const w = (k) => {
221
258
  if (k.key === "Escape") {
222
- if (xa()) return;
259
+ if (Fa()) return;
223
260
  k.preventDefault(), k.stopImmediatePropagation(), t();
224
261
  return;
225
262
  }
@@ -265,17 +302,17 @@ function be(e, t, n, a = !1) {
265
302
  let m = s.times(u.minus(1)).div(r);
266
303
  return a && (m = m.times(r.plus(1))), m;
267
304
  }
268
- function et(e, t, n) {
305
+ function nt(e, t, n) {
269
306
  return g(e).times(g(t).plus(1).pow(n));
270
307
  }
271
- function Tn(e, t, n, a = !1) {
308
+ function In(e, t, n, a = !1) {
272
309
  const r = g(t), s = g(e);
273
310
  if (ce(r)) return s.times(n);
274
311
  const u = r.plus(1).pow(n);
275
312
  let m = s.times(g(1).minus(u.pow(-1))).div(r);
276
313
  return a && (m = m.times(r.plus(1))), m;
277
314
  }
278
- function Pa(e, t, n) {
315
+ function Ea(e, t, n) {
279
316
  return g(e).div(g(t).plus(1).pow(n));
280
317
  }
281
318
  function we(e, t, n, a = 0, r = !1) {
@@ -285,11 +322,11 @@ function we(e, t, n, a = 0, r = !1) {
285
322
  let m = g(e).times(u).plus(a).times(s).div(u.minus(1));
286
323
  return r && (m = m.div(s.plus(1))), m;
287
324
  }
288
- function Ta(e, t, n) {
325
+ function Ma(e, t, n) {
289
326
  const a = g(n), r = g(e), s = g(t);
290
327
  return ce(a) ? r.div(s) : H.ln(s.div(s.minus(r.times(a)))).div(H.ln(a.plus(1)));
291
328
  }
292
- function rt(e, t = -0.9999, n = 100, a = 200) {
329
+ function it(e, t = -0.9999, n = 100, a = 200) {
293
330
  let r = g(t), s = g(n), u = e(r), m = e(s);
294
331
  if (u.times(m).gt(0)) return null;
295
332
  for (let d = 0; d < a; d++) {
@@ -306,42 +343,42 @@ function At(e, t) {
306
343
  a = a.plus(g(t[r]).div(n.plus(1).pow(r)));
307
344
  return a;
308
345
  }
309
- function Fn(e) {
310
- return rt((t) => At(t, e));
346
+ function Rn(e) {
347
+ return it((t) => At(t, e));
311
348
  }
312
- const Fa = (e, t) => (Date.parse(t) - Date.parse(e)) / 864e5;
313
- function In(e, t) {
349
+ const $a = (e, t) => (Date.parse(t) - Date.parse(e)) / 864e5;
350
+ function En(e, t) {
314
351
  const n = g(e), a = t[0].date;
315
352
  let r = g(0);
316
353
  for (const s of t) {
317
- const u = g(Fa(a, s.date)).div(365);
354
+ const u = g($a(a, s.date)).div(365);
318
355
  r = r.plus(g(s.amount).div(n.plus(1).pow(u)));
319
356
  }
320
357
  return r;
321
358
  }
322
- function Rn(e) {
359
+ function Mn(e) {
323
360
  if (e.length < 2) return null;
324
361
  const t = [...e].sort((n, a) => Date.parse(n.date) - Date.parse(a.date));
325
- return rt((n) => In(n, t), -0.9999, 100);
362
+ return it((n) => En(n, t), -0.9999, 100);
326
363
  }
327
- function ot(e, t, n) {
364
+ function st(e, t, n) {
328
365
  return g(t).div(e).pow(g(1).div(n)).minus(1);
329
366
  }
330
- const ps = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
367
+ const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
331
368
  __proto__: null,
332
- bisectRate: rt,
333
- cagr: ot,
369
+ bisectRate: it,
370
+ cagr: st,
334
371
  fvAnnuity: be,
335
- fvLump: et,
336
- irr: Fn,
337
- nper: Ta,
372
+ fvLump: nt,
373
+ irr: Rn,
374
+ nper: Ma,
338
375
  npv: At,
339
376
  periodic: J,
340
377
  pmt: we,
341
- pvAnnuity: Tn,
342
- pvLump: Pa,
343
- xirr: Rn,
344
- xnpv: In
378
+ pvAnnuity: In,
379
+ pvLump: Ea,
380
+ xirr: Mn,
381
+ xnpv: En
345
382
  }, Symbol.toStringTag, { value: "Module" })), me = {
346
383
  IN: {
347
384
  region: "IN",
@@ -378,18 +415,18 @@ class se extends Error {
378
415
  this.name = "FinCalcError", this.code = n, this.field = r;
379
416
  }
380
417
  }
381
- const Ia = 2, ee = (e) => e.toDecimalPlaces(Ia, H.ROUND_HALF_UP), St = (e) => e.div(100).div(12);
418
+ const Aa = 2, te = (e) => e.toDecimalPlaces(Aa, H.ROUND_HALF_UP), St = (e) => e.div(100).div(12);
382
419
  function Ct(e, t, n) {
383
420
  if (ce(t)) return e.div(n);
384
421
  const a = t.plus(1).pow(n);
385
422
  return e.times(t).times(a).div(a.minus(1));
386
423
  }
387
- function Ra(e, t, n) {
424
+ function Da(e, t, n) {
388
425
  if (ce(t)) return e.times(n);
389
426
  const a = t.plus(1).pow(n);
390
427
  return e.times(a.minus(1)).div(t.times(a));
391
428
  }
392
- function Ea(e, t, n) {
429
+ function La(e, t, n) {
393
430
  if (ce(t)) return Math.ceil(e.div(n).toNumber());
394
431
  const a = e.times(t);
395
432
  if (n.lte(a))
@@ -415,25 +452,25 @@ function Gt(e, t, n, a) {
415
452
  throw new se("SOLVER_DID_NOT_CONVERGE", "Could not find a rate within the allowed range.", "rate");
416
453
  return u;
417
454
  }
418
- function Ma(e, t, n, a) {
455
+ function Ua(e, t, n, a) {
419
456
  const r = [];
420
457
  let s = e, u = g(0);
421
458
  for (let m = 1; m <= n; m++) {
422
- const d = s, i = ee(d.times(t));
459
+ const d = s, i = te(d.times(t));
423
460
  let c, l;
424
- if (m === n ? (c = d, l = ee(d.plus(i))) : (l = a, c = l.minus(i), c.gt(d) && (c = d, l = ee(d.plus(i)))), s = d.minus(c), u = u.plus(i), r.push({
461
+ if (m === n ? (c = d, l = te(d.plus(i))) : (l = a, c = l.minus(i), c.gt(d) && (c = d, l = te(d.plus(i)))), s = d.minus(c), u = u.plus(i), r.push({
425
462
  month: m,
426
- openingBalance: ee(d),
463
+ openingBalance: te(d),
427
464
  payment: l,
428
- principal: ee(c),
465
+ principal: te(c),
429
466
  interest: i,
430
- closingBalance: ee(s),
431
- cumulativeInterest: ee(u)
467
+ closingBalance: te(s),
468
+ cumulativeInterest: te(u)
432
469
  }), s.lte(0)) break;
433
470
  }
434
471
  return r;
435
472
  }
436
- function $a(e) {
473
+ function Oa(e) {
437
474
  const t = [];
438
475
  for (const n of e) {
439
476
  const a = Math.ceil(n.month / 12);
@@ -464,7 +501,7 @@ function Ie(e) {
464
501
  const k = g(d).div(12);
465
502
  if (s === "payment") {
466
503
  const S = u.times(m).div(100).times(k);
467
- i = ee(u.plus(S).div(d));
504
+ i = te(u.plus(S).div(d));
468
505
  } else if (s === "principal")
469
506
  u = i.times(d).div(g(1).plus(m.div(100).times(k)));
470
507
  else throw s === "tenure" ? new se("MISSING_SOLVE_TARGET", "Flat-rate loans need an explicit tenure.", "tenureMonths") : new se("MISSING_SOLVE_TARGET", "Flat-rate loans need an explicit rate.", "annualRatePct");
@@ -473,34 +510,34 @@ function Ie(e) {
473
510
  const k = () => St(m);
474
511
  switch (s) {
475
512
  case "payment":
476
- i = ee(Ct(u, k(), d)), l = "PMT = P·r·(1+r)^n / ((1+r)^n − 1)";
513
+ i = te(Ct(u, k(), d)), l = "PMT = P·r·(1+r)^n / ((1+r)^n − 1)";
477
514
  break;
478
515
  case "principal":
479
- u = Ra(i, k(), d), l = "P = PMT·((1+r)^n − 1) / (r·(1+r)^n)";
516
+ u = Da(i, k(), d), l = "P = PMT·((1+r)^n − 1) / (r·(1+r)^n)";
480
517
  break;
481
518
  case "tenure":
482
- d = Ea(u, k(), i), l = "n = ln(PMT / (PMT − P·r)) / ln(1 + r)";
519
+ d = La(u, k(), i), l = "n = ln(PMT / (PMT − P·r)) / ln(1 + r)";
483
520
  break;
484
521
  case "rate":
485
522
  m = Gt(u, d, i, t.maxRatePct), l = "solve r: PMT = P·r·(1+r)^n / ((1+r)^n − 1)";
486
523
  break;
487
524
  }
488
525
  }
489
- const p = St(m), h = n === "flat" ? i : ee(Ct(u, p, d)), f = Ma(u, p, d, h);
526
+ const p = St(m), h = n === "flat" ? i : te(Ct(u, p, d)), f = Ua(u, p, d, h);
490
527
  d = f.length;
491
528
  const y = f.reduce((k, S) => k.plus(S.interest), g(0)), w = f.reduce((k, S) => k.plus(S.payment), g(0));
492
529
  return {
493
530
  solvedFor: s,
494
531
  basis: n,
495
532
  region: e.region,
496
- principal: ee(u),
533
+ principal: te(u),
497
534
  annualRatePct: m.toDecimalPlaces(6, H.ROUND_HALF_UP),
498
535
  tenureMonths: d,
499
536
  payment: h,
500
- totalInterest: ee(y),
501
- totalPayment: ee(w),
537
+ totalInterest: te(y),
538
+ totalPayment: te(w),
502
539
  schedule: f,
503
- byYear: $a(f),
540
+ byYear: Oa(f),
504
541
  chart: {
505
542
  balance: f.map((k) => k.closingBalance),
506
543
  cumulativeInterest: f.map((k) => k.cumulativeInterest)
@@ -522,7 +559,7 @@ const C = (e, t = 0) => {
522
559
  tone: n,
523
560
  sub: a
524
561
  }), U = (e) => e.toDecimalPlaces(2, H.ROUND_HALF_UP);
525
- function En(e, t) {
562
+ function $n(e, t) {
526
563
  const n = /* @__PURE__ */ new Map();
527
564
  for (const r of e) {
528
565
  const s = Math.ceil(r.month / 12), u = n.get(s);
@@ -540,7 +577,7 @@ function En(e, t) {
540
577
  }
541
578
  return a;
542
579
  }
543
- const Mn = [
580
+ const An = [
544
581
  {
545
582
  key: "count",
546
583
  label: "How many loans",
@@ -551,19 +588,19 @@ const Mn = [
551
588
  ];
552
589
  for (let e = 1; e <= 5; e++) {
553
590
  const t = e <= 2, n = t ? void 0 : (a) => C(a.count, 2) >= e;
554
- Mn.push(
591
+ An.push(
555
592
  { key: `p${e}`, label: `Loan ${e} amount`, kind: "money", prefix: "currency", default: e <= 2 ? "2500000" : "", optional: !t, showIf: n },
556
593
  { key: `r${e}`, label: `Loan ${e} rate`, kind: "percent", suffix: "%", default: e === 1 ? 9 : e === 2 ? 8.65 : "", optional: !t, showIf: n, labelByRegion: {} },
557
594
  { key: `t${e}`, label: `Loan ${e} tenure`, kind: "tenure", default: 240, optional: !t, showIf: n, labelByRegion: { US: `Loan ${e} term` } }
558
595
  );
559
596
  }
560
- const Aa = {
597
+ const Ba = {
561
598
  id: "loan.compare",
562
599
  group: "loans",
563
600
  title: "Compare loans",
564
601
  blurb: "Line up 2–5 loans and see which costs least over its full life.",
565
602
  keywords: ["compare", "loan", "cheapest", "emi", "best offer"],
566
- inputs: Mn,
603
+ inputs: An,
567
604
  compute(e, t) {
568
605
  const n = me[t.region], a = Math.max(2, Math.min(5, C(e.count, 2))), r = [];
569
606
  for (let l = 1; l <= a; l++) {
@@ -601,7 +638,7 @@ const Aa = {
601
638
  raw: i
602
639
  };
603
640
  }
604
- }, Da = {
641
+ }, _a = {
605
642
  id: "loan.prepay",
606
643
  group: "loans",
607
644
  title: "Prepayment impact",
@@ -670,7 +707,7 @@ const Aa = {
670
707
  schedule: {
671
708
  title: "New amortisation",
672
709
  columns: ["Month", "Principal", "Interest", "Prepay", "Balance"],
673
- groups: En(w, t),
710
+ groups: $n(w, t),
674
711
  toneCols: { 1: "principal", 2: "interest" }
675
712
  },
676
713
  notes: B,
@@ -685,7 +722,7 @@ const Aa = {
685
722
  }
686
723
  };
687
724
  }
688
- }, La = {
725
+ }, Ha = {
689
726
  id: "loan.transfer",
690
727
  group: "loans",
691
728
  title: "Balance transfer",
@@ -729,7 +766,7 @@ const Aa = {
729
766
  }
730
767
  };
731
768
  }
732
- }, Ua = {
769
+ }, qa = {
733
770
  id: "loan.eligibility",
734
771
  group: "loans",
735
772
  title: "Loan eligibility",
@@ -770,7 +807,7 @@ const Aa = {
770
807
  }
771
808
  const d = [];
772
809
  let i = g(0);
773
- return u.gt(0) ? i = U(Tn(u, s, r)) : d.push("Existing obligations already use up the allowed share of income — no additional loan capacity."), {
810
+ return u.gt(0) ? i = U(In(u, s, r)) : d.push("Existing obligations already use up the allowed share of income — no additional loan capacity."), {
774
811
  primary: v("Eligible loan amount", t.fmt.money(i), "positive"),
775
812
  secondary: m,
776
813
  formula: t.region === "US" ? "EMI = min(income·frontDTI, income·backDTI − debts); P = PV of that annuity" : "EMI = income·FOIR − existingEMI; P = PV of that annuity",
@@ -781,7 +818,7 @@ const Aa = {
781
818
  }
782
819
  };
783
820
  }
784
- }, Oa = {
821
+ }, Ga = {
785
822
  id: "loan.stepEmi",
786
823
  group: "loans",
787
824
  title: "Step-up / step-down EMI",
@@ -798,7 +835,7 @@ const Aa = {
798
835
  let S = a;
799
836
  for (let F = 1; F <= s; F++) S = S.plus(S.times(m)).minus(k.times(d(F)));
800
837
  return S;
801
- }, c = U(rt((k) => i(k), 0, a.toNumber(), 200) ?? we(a, m, s)), l = [];
838
+ }, c = U(it((k) => i(k), 0, a.toNumber(), 200) ?? we(a, m, s)), l = [];
802
839
  let p = a, h = g(0), f = c;
803
840
  for (let k = 1; k <= s && p.gt("0.005"); k++) {
804
841
  const S = U(p.times(m));
@@ -818,7 +855,7 @@ const Aa = {
818
855
  schedule: {
819
856
  title: "Amortisation",
820
857
  columns: ["Month", "Principal", "Interest", n.paymentLabel, "Balance"],
821
- groups: En(l, t),
858
+ groups: $n(l, t),
822
859
  toneCols: { 1: "principal", 2: "interest" }
823
860
  },
824
861
  notes: [`EMI changes by ${t.fmt.pct(g(C(e.annualStepPct)))} every 12 months. A step-up starts lower and pays a little more interest than a flat EMI; a step-down does the reverse.`],
@@ -832,7 +869,7 @@ const Aa = {
832
869
  }
833
870
  };
834
871
  }
835
- }, Ba = {
872
+ }, ja = {
836
873
  id: "loan.moratorium",
837
874
  group: "loans",
838
875
  title: "Moratorium / EMI holiday",
@@ -887,7 +924,7 @@ const Aa = {
887
924
  }
888
925
  };
889
926
  }
890
- }, _a = {
927
+ }, Va = {
891
928
  id: "loan.overdraft",
892
929
  group: "loans",
893
930
  title: "Overdraft / flexi loan",
@@ -917,7 +954,7 @@ const Aa = {
917
954
  }
918
955
  };
919
956
  }
920
- }, Ha = {
957
+ }, Ya = {
921
958
  id: "loan.refinance",
922
959
  group: "loans",
923
960
  title: "Refinance",
@@ -964,16 +1001,16 @@ const Aa = {
964
1001
  }
965
1002
  };
966
1003
  }
967
- }, qa = [
968
- Aa,
969
- Da,
970
- La,
971
- Ua,
972
- Oa,
1004
+ }, Ka = [
973
1005
  Ba,
974
1006
  _a,
975
- Ha
976
- ], it = Ze.defaults.sipReturnPercent, Ga = Ze.defaults.inflationPercent, st = (e, t) => ({
1007
+ Ha,
1008
+ qa,
1009
+ Ga,
1010
+ ja,
1011
+ Va,
1012
+ Ya
1013
+ ], lt = Qe.defaults.sipReturnPercent, Wa = Qe.defaults.inflationPercent, ct = (e, t) => ({
977
1014
  labels: e,
978
1015
  series: [{ name: "Value", tone: "accent", points: t, area: !0 }]
979
1016
  }), Dt = (e) => ({
@@ -983,7 +1020,7 @@ const Aa = {
983
1020
  }), Lt = (e, t) => [
984
1021
  { label: "Invested", value: Number(e), tone: "principal" },
985
1022
  { label: "Gains", value: Number(t), tone: "interest" }
986
- ], ja = {
1023
+ ], za = {
987
1024
  id: "invest.sip",
988
1025
  group: "invest",
989
1026
  title: "SIP Calculator",
@@ -991,7 +1028,7 @@ const Aa = {
991
1028
  keywords: ["sip", "systematic investment plan", "mutual fund", "monthly investment", "future value"],
992
1029
  inputs: [
993
1030
  { key: "monthlyAmount", label: "Monthly investment", kind: "money", prefix: "currency", default: "10000" },
994
- { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1031
+ { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: lt },
995
1032
  { key: "tenure", label: "Investment period", kind: "tenure", default: 120 }
996
1033
  ],
997
1034
  compute(e, t) {
@@ -1009,7 +1046,7 @@ const Aa = {
1009
1046
  ],
1010
1047
  split: Lt(i.toFixed(2), c.toFixed(2)),
1011
1048
  schedule: Dt(p),
1012
- chart: st(p.map((f) => f.label), h),
1049
+ chart: ct(p.map((f) => f.label), h),
1013
1050
  formula: "FV = P·[((1+i)^n − 1) / i]·(1+i), i = r/12 (invested at the start of each month)",
1014
1051
  notes: ["Returns are assumed constant; actual market returns vary year to year."],
1015
1052
  raw: {
@@ -1020,7 +1057,7 @@ const Aa = {
1020
1057
  }
1021
1058
  };
1022
1059
  }
1023
- }, Va = {
1060
+ }, Ja = {
1024
1061
  id: "invest.stepupSip",
1025
1062
  group: "invest",
1026
1063
  title: "Step-up SIP Calculator",
@@ -1029,7 +1066,7 @@ const Aa = {
1029
1066
  inputs: [
1030
1067
  { key: "monthlyAmount", label: "Initial monthly investment", kind: "money", prefix: "currency", default: "10000" },
1031
1068
  { key: "annualStepPct", label: "Annual step-up", kind: "percent", suffix: "%", default: "10" },
1032
- { key: "returnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1069
+ { key: "returnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: lt },
1033
1070
  { key: "tenure", label: "Investment period", kind: "tenure", default: 120 }
1034
1071
  ],
1035
1072
  compute(e, t) {
@@ -1048,13 +1085,13 @@ const Aa = {
1048
1085
  ],
1049
1086
  split: Lt(c.toFixed(2), f.toFixed(2)),
1050
1087
  schedule: Dt(p),
1051
- chart: st(p.map((y) => y.label), h),
1088
+ chart: ct(p.map((y) => y.label), h),
1052
1089
  formula: "Monthly simulation; the SIP amount is increased by the step-up % every 12 months",
1053
1090
  notes: ["The monthly amount steps up on each yearly anniversary; returns are assumed constant."],
1054
1091
  raw: { maturity: i.toFixed(2), invested: c.toFixed(2), gains: f.toFixed(2), finalMonthly: l.toFixed(2) }
1055
1092
  };
1056
1093
  }
1057
- }, Ya = { annual: 1, semiannual: 2, quarterly: 4, monthly: 12 }, Ka = {
1094
+ }, Za = { annual: 1, semiannual: 2, quarterly: 4, monthly: 12 }, Xa = {
1058
1095
  id: "invest.lumpsum",
1059
1096
  group: "invest",
1060
1097
  title: "Lump Sum Calculator",
@@ -1062,7 +1099,7 @@ const Aa = {
1062
1099
  keywords: ["lump sum", "lumpsum", "one time investment", "compound interest", "maturity"],
1063
1100
  inputs: [
1064
1101
  { key: "principal", label: "Investment amount", kind: "money", prefix: "currency", default: "100000" },
1065
- { key: "ratePct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1102
+ { key: "ratePct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: lt },
1066
1103
  { key: "years", label: "Investment period", kind: "years", suffix: "years", default: 10 },
1067
1104
  {
1068
1105
  key: "compounding",
@@ -1078,7 +1115,7 @@ const Aa = {
1078
1115
  }
1079
1116
  ],
1080
1117
  compute(e, t) {
1081
- const { D: n, fmt: a } = t, r = D(e.principal, "100000"), s = n(C(e.ratePct, Number(t.settings.defaults.sipReturnPercent))), u = Math.max(1, Math.round(C(e.years, 10))), m = Ya[_(e.compounding, "annual")] ?? 1, d = s.div(100).div(m), i = r.times(d.plus(1).pow(m * u)), c = i.minus(r), l = r.isZero() ? n(0) : ot(r, i, u), p = [], h = [];
1118
+ const { D: n, fmt: a } = t, r = D(e.principal, "100000"), s = n(C(e.ratePct, Number(t.settings.defaults.sipReturnPercent))), u = Math.max(1, Math.round(C(e.years, 10))), m = Za[_(e.compounding, "annual")] ?? 1, d = s.div(100).div(m), i = r.times(d.plus(1).pow(m * u)), c = i.minus(r), l = r.isZero() ? n(0) : st(r, i, u), p = [], h = [];
1082
1119
  for (let f = 1; f <= u; f++) {
1083
1120
  const y = r.times(d.plus(1).pow(m * f));
1084
1121
  p.push({ label: String(f), cells: [a.money(r), a.money(y.minus(r)), a.money(y)] }), h.push(Number(y.toFixed(2)));
@@ -1092,13 +1129,13 @@ const Aa = {
1092
1129
  ],
1093
1130
  split: Lt(r.toFixed(2), c.toFixed(2)),
1094
1131
  schedule: Dt(p),
1095
- chart: st(p.map((f) => f.label), h),
1132
+ chart: ct(p.map((f) => f.label), h),
1096
1133
  formula: "A = P·(1 + r/f)^(f·t)",
1097
1134
  notes: ["Returns are assumed constant across the whole period."],
1098
1135
  raw: { maturity: i.toFixed(2), invested: r.toFixed(2), gains: c.toFixed(2), cagr: l.times(100).toFixed(4) }
1099
1136
  };
1100
1137
  }
1101
- }, Wa = 1200, za = {
1138
+ }, Qa = 1200, er = {
1102
1139
  id: "invest.swp",
1103
1140
  group: "invest",
1104
1141
  title: "SWP Calculator",
@@ -1111,7 +1148,7 @@ const Aa = {
1111
1148
  { key: "tenureMonths", label: "Withdrawal period", kind: "tenure", default: 120, optional: !0 }
1112
1149
  ],
1113
1150
  compute(e, t) {
1114
- const { D: n, fmt: a } = t, r = D(e.corpus, "5000000"), s = D(e.withdrawalPerMonth, "30000"), u = C(e.expectedReturnPct, 8), m = J(u, 12), d = C(e.tenureMonths, 0), i = d > 0 ? Math.round(d) : Wa;
1151
+ const { D: n, fmt: a } = t, r = D(e.corpus, "5000000"), s = D(e.withdrawalPerMonth, "30000"), u = C(e.expectedReturnPct, 8), m = J(u, 12), d = C(e.tenureMonths, 0), i = d > 0 ? Math.round(d) : Qa;
1115
1152
  let c = r, l = n(0), p = 0;
1116
1153
  const h = [], f = [];
1117
1154
  let y = r, w = n(0);
@@ -1137,7 +1174,7 @@ const Aa = {
1137
1174
  rows: h,
1138
1175
  toneCols: { 2: "interest", 3: "principal" }
1139
1176
  },
1140
- chart: st(h.map((N) => N.label), f),
1177
+ chart: ct(h.map((N) => N.label), f),
1141
1178
  formula: "Each month: balance = balance·(1 + r/12) − withdrawal",
1142
1179
  notes: [
1143
1180
  S ? `The corpus is exhausted in month ${p}; the final withdrawal may be partial.` : "The corpus survives the whole withdrawal period; the remaining balance is shown.",
@@ -1150,7 +1187,7 @@ const Aa = {
1150
1187
  }
1151
1188
  };
1152
1189
  }
1153
- }, Ja = {
1190
+ }, tr = {
1154
1191
  id: "invest.goal",
1155
1192
  group: "invest",
1156
1193
  title: "Goal SIP Planner",
@@ -1159,12 +1196,12 @@ const Aa = {
1159
1196
  inputs: [
1160
1197
  { key: "targetCorpus", label: "Today's cost of goal", kind: "money", prefix: "currency", default: "10000000" },
1161
1198
  { key: "years", label: "Years to goal", kind: "years", suffix: "years", default: 15 },
1162
- { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: it },
1163
- { key: "inflationPct", label: "Inflation", kind: "percent", suffix: "% p.a.", default: Ga },
1199
+ { key: "expectedReturnPct", label: "Expected return", kind: "percent", suffix: "% p.a.", default: lt },
1200
+ { key: "inflationPct", label: "Inflation", kind: "percent", suffix: "% p.a.", default: Wa },
1164
1201
  { key: "existingSavings", label: "Existing savings", kind: "money", prefix: "currency", default: "0", optional: !0 }
1165
1202
  ],
1166
1203
  compute(e, t) {
1167
- const { D: n, fmt: a } = t, r = D(e.targetCorpus, "10000000"), s = Math.max(1, Math.round(C(e.years, 15))), u = C(e.expectedReturnPct, Number(t.settings.defaults.sipReturnPercent)), m = n(C(e.inflationPct, Number(t.settings.defaults.inflationPercent))).div(100), d = D(e.existingSavings, "0"), i = s * 12, c = J(u, 12), l = r.times(m.plus(1).pow(s)), p = et(d, c, i), h = l.minus(p), f = be(1, c, i, !0), y = h.gt(0) ? h.div(f) : n(0), w = y.times(i), k = h.gt(0) ? h.minus(w) : n(0), S = [
1204
+ const { D: n, fmt: a } = t, r = D(e.targetCorpus, "10000000"), s = Math.max(1, Math.round(C(e.years, 15))), u = C(e.expectedReturnPct, Number(t.settings.defaults.sipReturnPercent)), m = n(C(e.inflationPct, Number(t.settings.defaults.inflationPercent))).div(100), d = D(e.existingSavings, "0"), i = s * 12, c = J(u, 12), l = r.times(m.plus(1).pow(s)), p = nt(d, c, i), h = l.minus(p), f = be(1, c, i, !0), y = h.gt(0) ? h.div(f) : n(0), w = y.times(i), k = h.gt(0) ? h.minus(w) : n(0), S = [
1168
1205
  `Target grows with ${a.pct(m.times(100))} inflation to ${a.money(l)} in ${s} years.`
1169
1206
  ];
1170
1207
  d.gt(0) && S.push(`Existing savings grow to ${a.money(p)}, reducing what the SIP must fund.`);
@@ -1188,14 +1225,14 @@ const Aa = {
1188
1225
  }
1189
1226
  };
1190
1227
  }
1191
- }, Za = [ja, Va, Ka, za, Ja], $n = "10% TDS applies on interest above ₹40,000/yr (₹50,000 for senior citizens). Submit Form 15G/15H to waive if income is below the taxable limit.", Oe = (e, t, n) => ({
1228
+ }, nr = [za, Ja, Xa, er, tr], Dn = "10% TDS applies on interest above ₹40,000/yr (₹50,000 for senior citizens). Submit Form 15G/15H to waive if income is below the taxable limit.", Oe = (e, t, n) => ({
1192
1229
  labels: e,
1193
1230
  series: [{ name: n, tone: "accent", points: t, area: !0 }]
1194
1231
  }), Be = (e, t, n) => ({
1195
1232
  columns: e,
1196
1233
  rows: t,
1197
1234
  toneCols: { [n]: "interest" }
1198
- }), Xa = {
1235
+ }), ar = {
1199
1236
  id: "invest.fd",
1200
1237
  group: "invest",
1201
1238
  title: "Fixed Deposit (FD)",
@@ -1256,7 +1293,7 @@ const Aa = {
1256
1293
  formula: i ? "Interest/period = P·(r/f); principal returned at maturity" : "A = P·(1 + r/f)^(f·t)",
1257
1294
  notes: [
1258
1295
  i ? "Interest is paid out each period; the principal is returned at maturity." : "Interest is reinvested (compounded) and paid with the principal at maturity.",
1259
- $n
1296
+ Dn
1260
1297
  ],
1261
1298
  raw: {
1262
1299
  maturity: k.toFixed(2),
@@ -1267,7 +1304,7 @@ const Aa = {
1267
1304
  }
1268
1305
  };
1269
1306
  }
1270
- }, Qa = {
1307
+ }, rr = {
1271
1308
  id: "invest.rd",
1272
1309
  group: "invest",
1273
1310
  title: "Recurring Deposit (RD)",
@@ -1308,12 +1345,12 @@ const Aa = {
1308
1345
  schedule: Be(["Year", "Invested", "Interest", "Value"], p, 2),
1309
1346
  chart: Oe(p.map((f) => f.label), h, "Value"),
1310
1347
  formula: "M = Σ deposit·(1 + r/4)^(quarters remaining)",
1311
- notes: ["Interest is compounded quarterly, the standard for bank recurring deposits.", $n],
1348
+ notes: ["Interest is compounded quarterly, the standard for bank recurring deposits.", Dn],
1312
1349
  warnings: d,
1313
1350
  raw: { maturity: i.toFixed(2), invested: c.toFixed(2), interest: l.toFixed(2) }
1314
1351
  };
1315
1352
  }
1316
- }, er = {
1353
+ }, or = {
1317
1354
  id: "invest.ppf",
1318
1355
  group: "invest",
1319
1356
  title: "Public Provident Fund (PPF)",
@@ -1370,7 +1407,7 @@ const Aa = {
1370
1407
  raw: { maturity: i.toFixed(2), invested: p.toFixed(2), interest: h.toFixed(2) }
1371
1408
  };
1372
1409
  }
1373
- }, tr = {
1410
+ }, ir = {
1374
1411
  id: "invest.nps",
1375
1412
  group: "invest",
1376
1413
  title: "National Pension System (NPS)",
@@ -1414,7 +1451,7 @@ const Aa = {
1414
1451
  }
1415
1452
  };
1416
1453
  }
1417
- }, nr = {
1454
+ }, sr = {
1418
1455
  id: "invest.epf",
1419
1456
  group: "invest",
1420
1457
  title: "Employees’ Provident Fund (EPF)",
@@ -1463,7 +1500,7 @@ const Aa = {
1463
1500
  raw: { corpus: h.toFixed(2), contributions: f.toFixed(2), interest: k.toFixed(2) }
1464
1501
  };
1465
1502
  }
1466
- }, ar = {
1503
+ }, lr = {
1467
1504
  id: "invest.ssy",
1468
1505
  group: "invest",
1469
1506
  title: "Sukanya Samriddhi Yojana (SSY)",
@@ -1506,7 +1543,7 @@ const Aa = {
1506
1543
  raw: { maturity: l.toFixed(2), invested: f.toFixed(2), interest: y.toFixed(2) }
1507
1544
  };
1508
1545
  }
1509
- }, rr = [Xa, Qa, er, tr, nr, ar], or = {
1546
+ }, cr = [ar, rr, or, ir, sr, lr], ur = {
1510
1547
  id: "invest.401k",
1511
1548
  group: "invest",
1512
1549
  title: "401(k) with Employer Match",
@@ -1570,7 +1607,7 @@ const Aa = {
1570
1607
  }
1571
1608
  };
1572
1609
  }
1573
- }, ir = {
1610
+ }, dr = {
1574
1611
  id: "invest.iraCompare",
1575
1612
  group: "invest",
1576
1613
  title: "Roth vs Traditional IRA",
@@ -1624,7 +1661,7 @@ const Aa = {
1624
1661
  }
1625
1662
  };
1626
1663
  }
1627
- }, sr = {
1664
+ }, mr = {
1628
1665
  id: "invest.529",
1629
1666
  group: "invest",
1630
1667
  title: "529 College Savings",
@@ -1640,7 +1677,7 @@ const Aa = {
1640
1677
  { key: "collegeCostInflationPct", label: "College cost inflation", kind: "percent", suffix: "%", default: 5, advanced: !0 }
1641
1678
  ],
1642
1679
  compute(e, t) {
1643
- const { fmt: n } = t, a = g(C(e.currentSavings)), r = g(C(e.monthlyContribution)), s = Math.max(0, Math.round(C(e.yearsUntilCollege))), u = s * 12, m = J(C(e.expectedReturnPct), 12), d = et(a, m, u), i = be(r, m, u), c = d.plus(i), l = a.plus(r.times(u)), p = c.minus(l), h = [
1680
+ const { fmt: n } = t, a = g(C(e.currentSavings)), r = g(C(e.monthlyContribution)), s = Math.max(0, Math.round(C(e.yearsUntilCollege))), u = s * 12, m = J(C(e.expectedReturnPct), 12), d = nt(a, m, u), i = be(r, m, u), c = d.plus(i), l = a.plus(r.times(u)), p = c.minus(l), h = [
1644
1681
  v("Total invested", n.money(l), "principal"),
1645
1682
  v("Investment growth", n.money(p), "interest")
1646
1683
  ], f = {
@@ -1654,7 +1691,7 @@ const Aa = {
1654
1691
  const k = g(C(e.currentAnnualCost)), S = g(C(e.collegeCostInflationPct)).div(100);
1655
1692
  let F = g(0);
1656
1693
  for (let x = 0; x < 4; x++)
1657
- F = F.plus(et(k, S, s + x));
1694
+ F = F.plus(nt(k, S, s + x));
1658
1695
  const N = c.minus(F), P = N.gte(0);
1659
1696
  h.push(v("4-year college cost", n.money(F), "default", "inflation-adjusted")), h.push(
1660
1697
  v(
@@ -1679,7 +1716,7 @@ const Aa = {
1679
1716
  raw: f
1680
1717
  };
1681
1718
  }
1682
- }, lr = [or, ir, sr], cr = (e) => e === "annual" ? 1 : e === "semiannual" ? 2 : e === "quarterly" ? 4 : 12, lt = (e) => _(e).split(/[, ]+/).map((t) => t.trim()).filter(Boolean).map(Number).filter((t) => Number.isFinite(t)), ur = {
1719
+ }, pr = [ur, dr, mr], hr = (e) => e === "annual" ? 1 : e === "semiannual" ? 2 : e === "quarterly" ? 4 : 12, ut = (e) => _(e).split(/[, ]+/).map((t) => t.trim()).filter(Boolean).map(Number).filter((t) => Number.isFinite(t)), fr = {
1683
1720
  id: "returns.tvm",
1684
1721
  group: "returns",
1685
1722
  title: "Time value of money (TVM)",
@@ -1710,7 +1747,7 @@ const Aa = {
1710
1747
  ] }
1711
1748
  ],
1712
1749
  compute(e) {
1713
- const t = _(e.solveFor, "FV"), n = cr(_(e.compounding, "monthly")), a = g(C(e.ratePct)).div(100).div(n), r = C(e.n), s = _(e.timing) === "begin", u = g(C(e.pv)), m = g(C(e.pmt)), d = g(C(e.fv)), i = (f, y) => ce(f) ? g(y) : f.plus(1).pow(y).minus(1).div(f).times(s ? f.plus(1) : 1), c = (f, y) => f.plus(1).pow(y);
1750
+ const t = _(e.solveFor, "FV"), n = hr(_(e.compounding, "monthly")), a = g(C(e.ratePct)).div(100).div(n), r = C(e.n), s = _(e.timing) === "begin", u = g(C(e.pv)), m = g(C(e.pmt)), d = g(C(e.fv)), i = (f, y) => ce(f) ? g(y) : f.plus(1).pow(y).minus(1).div(f).times(s ? f.plus(1) : 1), c = (f, y) => f.plus(1).pow(y);
1714
1751
  let l = "Future value", p = g(0), h = "PV·(1+i)^n + PMT·[((1+i)^n − 1)/i]·timing + FV = 0";
1715
1752
  if (t === "FV")
1716
1753
  p = u.times(c(a, r)).plus(m.times(i(a, r))).neg(), l = "Future value";
@@ -1747,7 +1784,7 @@ const Aa = {
1747
1784
  }
1748
1785
  return { primary: v(l, p.toDecimalPlaces(2).toString(), "accent"), formula: h, raw: { value: p.toNumber() } };
1749
1786
  }
1750
- }, dr = {
1787
+ }, yr = {
1751
1788
  id: "returns.cagr",
1752
1789
  group: "returns",
1753
1790
  title: "CAGR",
@@ -1759,7 +1796,7 @@ const Aa = {
1759
1796
  { key: "years", label: "Period", kind: "years", default: "10" }
1760
1797
  ],
1761
1798
  compute(e, t) {
1762
- const n = t.D(C(e.begin)), a = t.D(C(e.end)), r = C(e.years) || 1, s = ot(n, a, r).times(100), u = a.minus(n).div(n).times(100);
1799
+ const n = t.D(C(e.begin)), a = t.D(C(e.end)), r = C(e.years) || 1, s = st(n, a, r).times(100), u = a.minus(n).div(n).times(100);
1763
1800
  return {
1764
1801
  primary: v("CAGR", `${t.fmt.num(s, 2)}%`, "accent"),
1765
1802
  secondary: [
@@ -1770,7 +1807,7 @@ const Aa = {
1770
1807
  raw: { cagr: s.toNumber(), absolute: u.toNumber() }
1771
1808
  };
1772
1809
  }
1773
- }, mr = {
1810
+ }, br = {
1774
1811
  id: "returns.absolute",
1775
1812
  group: "returns",
1776
1813
  title: "Absolute return",
@@ -1783,14 +1820,14 @@ const Aa = {
1783
1820
  ],
1784
1821
  compute(e, t) {
1785
1822
  const n = t.D(C(e.invested)), a = t.D(C(e.current)), r = a.minus(n).div(n).times(100), s = C(e.years), u = [v("Total gain", t.fmt.money(a.minus(n)), a.gte(n) ? "positive" : "negative")];
1786
- return s > 0 && u.push(v("Annualised (CAGR)", `${t.fmt.num(ot(n, a, s).times(100), 2)}%`)), {
1823
+ return s > 0 && u.push(v("Annualised (CAGR)", `${t.fmt.num(st(n, a, s).times(100), 2)}%`)), {
1787
1824
  primary: v("Absolute return", `${t.fmt.num(r, 2)}%`, "accent"),
1788
1825
  secondary: u,
1789
1826
  formula: "Absolute return = (Current − Invested) / Invested",
1790
1827
  raw: { absolute: r.toNumber() }
1791
1828
  };
1792
1829
  }
1793
- }, pr = {
1830
+ }, gr = {
1794
1831
  id: "returns.xirr",
1795
1832
  group: "returns",
1796
1833
  title: "XIRR",
@@ -1806,7 +1843,7 @@ const Aa = {
1806
1843
  compute(e, t) {
1807
1844
  const a = (e.flows ?? []).filter((u) => u.date && u.amount !== "").map((u) => ({ date: u.date, amount: u.amount }));
1808
1845
  if (a.length < 2) return { primary: v("XIRR", "—"), warnings: ["Enter at least two dated cashflows."] };
1809
- const r = Rn(a);
1846
+ const r = Mn(a);
1810
1847
  if (!r) return { primary: v("XIRR", "—"), warnings: ["Need at least one negative and one positive cashflow."] };
1811
1848
  const s = r.times(100);
1812
1849
  return {
@@ -1815,7 +1852,7 @@ const Aa = {
1815
1852
  raw: { xirr: s.toNumber() }
1816
1853
  };
1817
1854
  }
1818
- }, hr = {
1855
+ }, vr = {
1819
1856
  id: "returns.irr",
1820
1857
  group: "returns",
1821
1858
  title: "IRR",
@@ -1823,12 +1860,12 @@ const Aa = {
1823
1860
  keywords: ["irr", "internal rate of return"],
1824
1861
  inputs: [{ key: "series", label: "Cashflows (comma-separated, period 0 first)", kind: "text", default: "-100000, 30000, 40000, 50000, 40000", help: "-100000, 30000, ..." }],
1825
1862
  compute(e, t) {
1826
- const n = lt(_(e.series));
1863
+ const n = ut(_(e.series));
1827
1864
  if (n.length < 2) return { primary: v("IRR", "—"), warnings: ["Enter at least two cashflows."] };
1828
- const a = Fn(n);
1865
+ const a = Rn(n);
1829
1866
  return a ? { primary: v("IRR", `${t.fmt.num(a.times(100), 2)}%`, "accent"), formula: "IRR: rate where NPV = 0", raw: { irr: a.times(100).toNumber() } } : { primary: v("IRR", "—"), warnings: ["No sign change — IRR is undefined for these flows."] };
1830
1867
  }
1831
- }, fr = {
1868
+ }, kr = {
1832
1869
  id: "returns.npv",
1833
1870
  group: "returns",
1834
1871
  title: "NPV",
@@ -1839,7 +1876,7 @@ const Aa = {
1839
1876
  { key: "series", label: "Cashflows (comma-separated, period 0 first)", kind: "text", default: "-100000, 30000, 40000, 50000, 40000" }
1840
1877
  ],
1841
1878
  compute(e, t) {
1842
- const n = lt(_(e.series)), a = At(g(C(e.ratePct)).div(100), n);
1879
+ const n = ut(_(e.series)), a = At(g(C(e.ratePct)).div(100), n);
1843
1880
  return {
1844
1881
  primary: v("NPV", t.fmt.money(a), a.gte(0) ? "positive" : "negative"),
1845
1882
  secondary: [v(a.gte(0) ? "Value-creating" : "Value-destroying", a.gte(0) ? "NPV ≥ 0" : "NPV < 0")],
@@ -1847,7 +1884,7 @@ const Aa = {
1847
1884
  raw: { npv: a.toNumber() }
1848
1885
  };
1849
1886
  }
1850
- }, yr = {
1887
+ }, wr = {
1851
1888
  id: "returns.mirr",
1852
1889
  group: "returns",
1853
1890
  title: "MIRR",
@@ -1859,7 +1896,7 @@ const Aa = {
1859
1896
  { key: "reinvestPct", label: "Reinvestment rate", kind: "percent", default: "12" }
1860
1897
  ],
1861
1898
  compute(e, t) {
1862
- const n = lt(_(e.series)), a = n.length - 1;
1899
+ const n = ut(_(e.series)), a = n.length - 1;
1863
1900
  if (a < 1) return { primary: v("MIRR", "—"), warnings: ["Enter at least two cashflows."] };
1864
1901
  const r = g(C(e.financePct)).div(100), s = g(C(e.reinvestPct)).div(100);
1865
1902
  let u = g(0), m = g(0);
@@ -1869,7 +1906,7 @@ const Aa = {
1869
1906
  const d = u.div(m.neg()).pow(g(1).div(a)).minus(1).times(100);
1870
1907
  return { primary: v("MIRR", `${t.fmt.num(d, 2)}%`, "accent"), formula: "MIRR = (FV(inflows@reinvest) / −PV(outflows@finance))^(1/n) − 1", raw: { mirr: d.toNumber() } };
1871
1908
  }
1872
- }, br = {
1909
+ }, Nr = {
1873
1910
  id: "returns.payback",
1874
1911
  group: "returns",
1875
1912
  title: "Payback period",
@@ -1881,7 +1918,7 @@ const Aa = {
1881
1918
  { key: "discountPct", label: "Discount rate (for discounted payback)", kind: "percent", default: "0", optional: !0, advanced: !0 }
1882
1919
  ],
1883
1920
  compute(e, t) {
1884
- const n = t.D(C(e.investment)), a = lt(_(e.series)), r = g(C(e.discountPct)).div(100), s = r.gt(0);
1921
+ const n = t.D(C(e.investment)), a = ut(_(e.series)), r = g(C(e.discountPct)).div(100), s = r.gt(0);
1885
1922
  let u = g(0), m = 0, d = null;
1886
1923
  for (let i = 0; i < a.length; i++) {
1887
1924
  const c = s ? g(a[i]).div(r.plus(1).pow(i + 1)) : g(a[i]), l = u;
@@ -1898,7 +1935,7 @@ const Aa = {
1898
1935
  raw: { payback: d }
1899
1936
  };
1900
1937
  }
1901
- }, gr = {
1938
+ }, xr = {
1902
1939
  id: "returns.realReturn",
1903
1940
  group: "returns",
1904
1941
  title: "Real (inflation-adjusted) return",
@@ -1917,7 +1954,7 @@ const Aa = {
1917
1954
  raw: { real: r.toNumber() }
1918
1955
  };
1919
1956
  }
1920
- }, vr = {
1957
+ }, Sr = {
1921
1958
  id: "returns.rule72",
1922
1959
  group: "returns",
1923
1960
  title: "Rule of 72",
@@ -1938,17 +1975,17 @@ const Aa = {
1938
1975
  raw: { approx: a.toNumber(), exact: r.toNumber() }
1939
1976
  };
1940
1977
  }
1941
- }, kr = [
1942
- ur,
1943
- dr,
1944
- mr,
1945
- pr,
1946
- hr,
1978
+ }, Cr = [
1947
1979
  fr,
1948
1980
  yr,
1949
1981
  br,
1950
1982
  gr,
1951
- vr
1983
+ vr,
1984
+ kr,
1985
+ wr,
1986
+ Nr,
1987
+ xr,
1988
+ Sr
1952
1989
  ], Ne = "Estimate for planning only — not tax advice. Verify against current law and your own situation.";
1953
1990
  function Ut(e, t, n) {
1954
1991
  let a = g(0), r = 0;
@@ -1966,7 +2003,7 @@ function Ut(e, t, n) {
1966
2003
  }
1967
2004
  return { tax: a, rows: s };
1968
2005
  }
1969
- const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e, t) => e.gt(t) ? g(t) : e, ct = (e, t) => v(e, t, "positive"), xr = {
2006
+ const Pr = (e, t) => Ut(e, t, Tr).tax, Tr = { money: (e) => String(e) }, jt = (e, t) => e.gt(t) ? g(t) : e, dt = (e, t) => v(e, t, "positive"), Fr = {
1970
2007
  id: "tax.gst",
1971
2008
  group: "tax",
1972
2009
  title: "GST Calculator",
@@ -2047,7 +2084,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2047
2084
  }
2048
2085
  };
2049
2086
  }
2050
- }, Sr = {
2087
+ }, Ir = {
2051
2088
  id: "tax.tds",
2052
2089
  group: "tax",
2053
2090
  title: "TDS on Interest",
@@ -2081,7 +2118,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2081
2118
  ), {
2082
2119
  primary: v("TDS deducted", n.money(p), p.gt(0) ? "negative" : "positive"),
2083
2120
  secondary: [
2084
- ct("Net interest received", n.money(h)),
2121
+ dt("Net interest received", n.money(h)),
2085
2122
  v("Effective TDS rate", n.pct(f), "accent"),
2086
2123
  v("Applicable threshold", n.money(d), "default")
2087
2124
  ],
@@ -2094,7 +2131,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2094
2131
  "<60": [{ to: 25e4, rate: 0 }, { to: 5e5, rate: 5 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }],
2095
2132
  "60-80": [{ to: 3e5, rate: 0 }, { to: 5e5, rate: 5 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }],
2096
2133
  "80+": [{ to: 5e5, rate: 0 }, { to: 1e6, rate: 20 }, { to: 1 / 0, rate: 30 }]
2097
- }, Cr = [
2134
+ }, Rr = [
2098
2135
  { to: 3e5, rate: 0 },
2099
2136
  { to: 7e5, rate: 5 },
2100
2137
  { to: 1e6, rate: 10 },
@@ -2102,7 +2139,7 @@ const wr = (e, t) => Ut(e, t, Nr).tax, Nr = { money: (e) => String(e) }, jt = (e
2102
2139
  { to: 15e5, rate: 20 },
2103
2140
  { to: 1 / 0, rate: 30 }
2104
2141
  ];
2105
- function Pr(e, t, n) {
2142
+ function Er(e, t, n) {
2106
2143
  const r = [
2107
2144
  { threshold: 5e7, rate: 25, prev: 20 },
2108
2145
  { threshold: 2e7, rate: 20, prev: 15 },
@@ -2114,10 +2151,10 @@ function Pr(e, t, n) {
2114
2151
  return i.gt(0) ? s.minus(i) : s;
2115
2152
  }
2116
2153
  function Yt(e, t, n, a, r) {
2117
- const { tax: s, rows: u } = Ut(e, t, r), m = e.gt(n) ? g(0) : s.lt(a) ? s : g(a), d = s.minus(m), i = Pr(e, d, (p) => wr(g(p), t)), c = d.plus(i).times("0.04"), l = d.plus(i).plus(c);
2154
+ const { tax: s, rows: u } = Ut(e, t, r), m = e.gt(n) ? g(0) : s.lt(a) ? s : g(a), d = s.minus(m), i = Er(e, d, (p) => Pr(g(p), t)), c = d.plus(i).times("0.04"), l = d.plus(i).plus(c);
2118
2155
  return { taxable: e, base: s, rebate: m, surcharge: i, cess: c, total: l, rows: u };
2119
2156
  }
2120
- const Tr = {
2157
+ const Mr = {
2121
2158
  id: "tax.incomeIN",
2122
2159
  group: "tax",
2123
2160
  title: "Income Tax (Old vs New)",
@@ -2143,7 +2180,7 @@ const Tr = {
2143
2180
  { key: "homeLoanInterest", label: "Home loan interest (24b)", kind: "money", prefix: "currency", default: "0", help: "max ₹2L", optional: !0 }
2144
2181
  ],
2145
2182
  compute(e, t) {
2146
- const { fmt: n } = t, a = D(e.grossIncome, "1200000"), r = _(e.age, "<60"), s = jt(D(e.ded80C, "0"), 15e4), u = D(e.ded80D, "0"), m = D(e.hraExemption, "0"), d = jt(D(e.homeLoanInterest, "0"), 2e5), i = g(5e4).plus(s).plus(u).plus(m).plus(d), c = a.minus(i), l = c.gt(0) ? c : g(0), p = Yt(l, Vt[r] ?? Vt["<60"], 5e5, 12500, n), h = a.minus(75e3), f = h.gt(0) ? h : g(0), y = Yt(f, Cr, 7e5, 25e3, n), w = !y.total.gt(p.total), k = w ? y : p, S = p.total.minus(y.total).abs();
2183
+ const { fmt: n } = t, a = D(e.grossIncome, "1200000"), r = _(e.age, "<60"), s = jt(D(e.ded80C, "0"), 15e4), u = D(e.ded80D, "0"), m = D(e.hraExemption, "0"), d = jt(D(e.homeLoanInterest, "0"), 2e5), i = g(5e4).plus(s).plus(u).plus(m).plus(d), c = a.minus(i), l = c.gt(0) ? c : g(0), p = Yt(l, Vt[r] ?? Vt["<60"], 5e5, 12500, n), h = a.minus(75e3), f = h.gt(0) ? h : g(0), y = Yt(f, Rr, 7e5, 25e3, n), w = !y.total.gt(p.total), k = w ? y : p, S = p.total.minus(y.total).abs();
2147
2184
  return {
2148
2185
  primary: v(
2149
2186
  `${w ? "New" : "Old"} regime is cheaper`,
@@ -2179,7 +2216,7 @@ const Tr = {
2179
2216
  }
2180
2217
  };
2181
2218
  }
2182
- }, Fr = {
2219
+ }, $r = {
2183
2220
  id: "tax.capitalGains",
2184
2221
  group: "tax",
2185
2222
  title: "Capital Gains Tax",
@@ -2228,7 +2265,7 @@ const Tr = {
2228
2265
  raw: { gain: d.toFixed(2), tax: h ? null : l.toFixed(2), type: p, isLong: c ? 1 : 0 }
2229
2266
  };
2230
2267
  }
2231
- }, Ir = {
2268
+ }, Ar = {
2232
2269
  id: "tax.hra",
2233
2270
  group: "tax",
2234
2271
  title: "HRA Exemption",
@@ -2248,7 +2285,7 @@ const Tr = {
2248
2285
  l.lt(h) && (h = l), p.lt(h) && (h = p);
2249
2286
  const f = s.minus(h);
2250
2287
  return {
2251
- primary: ct("HRA exempt", n.money(h)),
2288
+ primary: dt("HRA exempt", n.money(h)),
2252
2289
  secondary: [
2253
2290
  v("Taxable HRA", n.money(f), "negative"),
2254
2291
  v("HRA received", n.money(s), "principal"),
@@ -2263,7 +2300,7 @@ const Tr = {
2263
2300
  raw: { exempt: h.toFixed(2), taxable: f.toFixed(2), limitRent: l.toFixed(2), limitPct: p.toFixed(2) }
2264
2301
  };
2265
2302
  }
2266
- }, Rr = {
2303
+ }, Dr = {
2267
2304
  id: "tax.advanceTax",
2268
2305
  group: "tax",
2269
2306
  title: "Advance Tax Instalments",
@@ -2304,7 +2341,7 @@ const Tr = {
2304
2341
  raw: { advanceTaxDue: u.toFixed(2), liability: a.toFixed(2), tdsPaid: r.toFixed(2) }
2305
2342
  };
2306
2343
  }
2307
- }, Er = {
2344
+ }, Lr = {
2308
2345
  id: "tax.salesTaxUS",
2309
2346
  group: "tax",
2310
2347
  title: "Sales Tax",
@@ -2362,7 +2399,7 @@ const Tr = {
2362
2399
  { to: 609350, rate: 35 },
2363
2400
  { to: 1 / 0, rate: 37 }
2364
2401
  ]
2365
- }, Mr = { single: 14600, marriedJoint: 29200, headOfHousehold: 21900 }, $r = {
2402
+ }, Ur = { single: 14600, marriedJoint: 29200, headOfHousehold: 21900 }, Or = {
2366
2403
  id: "tax.incomeUS",
2367
2404
  group: "tax",
2368
2405
  title: "Federal Income Tax",
@@ -2402,14 +2439,14 @@ const Tr = {
2402
2439
  }
2403
2440
  ],
2404
2441
  compute(e, t) {
2405
- const { fmt: n } = t, a = D(e.grossIncome, "60000"), r = _(e.filingStatus, "single"), s = Kt[r] ?? Kt.single, m = _(e.deductionMode, "standard") === "itemized" ? D(e.itemizedAmount, "0") : g(Mr[r] ?? 14600), d = a.minus(m), i = d.gt(0) ? d : g(0), { tax: c, rows: l } = Ut(i, s, n), p = a.gt(0) ? c.div(a).times(100) : g(0), h = s.find((w) => i.lte(w.to)) ?? s[s.length - 1], f = i.gt(0) ? h.rate : 0, y = a.minus(c);
2442
+ const { fmt: n } = t, a = D(e.grossIncome, "60000"), r = _(e.filingStatus, "single"), s = Kt[r] ?? Kt.single, m = _(e.deductionMode, "standard") === "itemized" ? D(e.itemizedAmount, "0") : g(Ur[r] ?? 14600), d = a.minus(m), i = d.gt(0) ? d : g(0), { tax: c, rows: l } = Ut(i, s, n), p = a.gt(0) ? c.div(a).times(100) : g(0), h = s.find((w) => i.lte(w.to)) ?? s[s.length - 1], f = i.gt(0) ? h.rate : 0, y = a.minus(c);
2406
2443
  return {
2407
2444
  primary: v("Federal income tax", n.money(c), "negative"),
2408
2445
  secondary: [
2409
2446
  v("Taxable income", n.money(i), "principal", `after ${n.money(m)} deduction`),
2410
2447
  v("Effective rate", n.pct(p), "accent"),
2411
2448
  v("Marginal rate", `${f}%`, "default"),
2412
- ct("After-tax income", n.money(y))
2449
+ dt("After-tax income", n.money(y))
2413
2450
  ],
2414
2451
  schedule: {
2415
2452
  title: "Bracket breakdown",
@@ -2431,7 +2468,7 @@ const Tr = {
2431
2468
  }
2432
2469
  };
2433
2470
  }
2434
- }, Ar = {
2471
+ }, Br = {
2435
2472
  id: "tax.mortgageDeductionUS",
2436
2473
  group: "tax",
2437
2474
  title: "Mortgage Interest Deduction",
@@ -2449,7 +2486,7 @@ const Tr = {
2449
2486
  "Acquisition-debt limit is $750,000 ($375,000 if married filing separately) for loans after 15 Dec 2017. " + Ne
2450
2487
  ];
2451
2488
  return s.gt(u) && i.unshift(`Loan balance exceeds $750k: only ${n.pct(g(u).div(s).times(100))} of the interest is deductible.`), {
2452
- primary: ct("Estimated tax savings", n.money(d)),
2489
+ primary: dt("Estimated tax savings", n.money(d)),
2453
2490
  secondary: [
2454
2491
  v("Deductible interest", n.money(m), "principal"),
2455
2492
  v("Marginal tax rate", n.pct(g(C(e.marginalTaxRatePct, 24))), "accent")
@@ -2459,16 +2496,16 @@ const Tr = {
2459
2496
  raw: { savings: d.toFixed(2), deductibleInterest: m.toFixed(2) }
2460
2497
  };
2461
2498
  }
2462
- }, Dr = [
2463
- xr,
2464
- Sr,
2465
- Tr,
2499
+ }, _r = [
2466
2500
  Fr,
2467
2501
  Ir,
2468
- Rr,
2469
- Er,
2502
+ Mr,
2470
2503
  $r,
2471
- Ar
2504
+ Ar,
2505
+ Dr,
2506
+ Lr,
2507
+ Or,
2508
+ Br
2472
2509
  ], $e = {
2473
2510
  length: { m: 1, km: 1e3, cm: 0.01, mm: 1e-3, mi: 1609.344, yd: 0.9144, ft: 0.3048, in: 0.0254 },
2474
2511
  area: { sqm: 1, sqft: 0.092903, sqyd: 0.836127, acre: 4046.8564224, hectare: 1e4, bigha: 1337.8, gunta: 101.17, cent: 40.4686 },
@@ -2508,10 +2545,10 @@ const Tr = {
2508
2545
  C: "Celsius (°C)",
2509
2546
  F: "Fahrenheit (°F)",
2510
2547
  K: "Kelvin (K)"
2511
- }, Lr = ["C", "F", "K"], Wt = (e) => e.map((t) => ({ value: t, label: Pt[t] ?? t })), Ae = (e, t, n, a) => [
2548
+ }, Hr = ["C", "F", "K"], Wt = (e) => e.map((t) => ({ value: t, label: Pt[t] ?? t })), Ae = (e, t, n, a) => [
2512
2549
  { key: `${e}From`, label: "From", kind: "select", default: n, options: Wt(t), showIf: (r) => r.category === e },
2513
2550
  { key: `${e}To`, label: "To", kind: "select", default: a, options: Wt(t), showIf: (r) => r.category === e }
2514
- ], Ur = {
2551
+ ], qr = {
2515
2552
  id: "tools.units",
2516
2553
  group: "tools",
2517
2554
  title: "Unit Converter",
@@ -2536,7 +2573,7 @@ const Tr = {
2536
2573
  ...Ae("area", Object.keys($e.area), "acre", "sqm"),
2537
2574
  ...Ae("weight", Object.keys($e.weight), "kg", "lb"),
2538
2575
  ...Ae("volume", Object.keys($e.volume), "l", "gal_us"),
2539
- ...Ae("temperature", Lr, "C", "F")
2576
+ ...Ae("temperature", Hr, "C", "F")
2540
2577
  ],
2541
2578
  compute(e, t) {
2542
2579
  const { D: n, fmt: a } = t, r = n(C(e.value, 0)), s = _(e.category, "length"), u = _(e[`${s}From`], ""), m = _(e[`${s}To`], ""), d = [];
@@ -2555,14 +2592,14 @@ const Tr = {
2555
2592
  raw: { result: i.toFixed(6), from: u, to: m, category: s }
2556
2593
  };
2557
2594
  }
2558
- }, je = 864e5, ht = (e) => {
2595
+ }, Ve = 864e5, ft = (e) => {
2559
2596
  if (!e) {
2560
2597
  const r = /* @__PURE__ */ new Date();
2561
2598
  return new Date(Date.UTC(r.getUTCFullYear(), r.getUTCMonth(), r.getUTCDate()));
2562
2599
  }
2563
2600
  const [t, n, a] = e.split("-").map(Number);
2564
2601
  return new Date(Date.UTC(t, (n || 1) - 1, a || 1));
2565
- }, ft = (e, t) => new Date(Date.UTC(e, t, 0)).getUTCDate(), Ve = (e) => e.toISOString().slice(0, 10), Or = {
2602
+ }, yt = (e, t) => new Date(Date.UTC(e, t, 0)).getUTCDate(), Ye = (e) => e.toISOString().slice(0, 10), Gr = {
2566
2603
  id: "tools.dateCalc",
2567
2604
  group: "tools",
2568
2605
  title: "Date Calculator",
@@ -2609,31 +2646,31 @@ const Tr = {
2609
2646
  ],
2610
2647
  compute(e) {
2611
2648
  if (_(e.mode, "difference") === "addSubtract") {
2612
- const l = ht(_(e.startDate, "")), p = Math.round(C(e.count, 0)), h = _(e.unit, "days"), f = _(e.direction, "add") === "subtract" ? -1 : 1, y = f * p;
2649
+ const l = ft(_(e.startDate, "")), p = Math.round(C(e.count, 0)), h = _(e.unit, "days"), f = _(e.direction, "add") === "subtract" ? -1 : 1, y = f * p;
2613
2650
  let w;
2614
2651
  if (h === "days" || h === "weeks")
2615
- w = new Date(l.getTime() + y * (h === "weeks" ? 7 : 1) * je);
2652
+ w = new Date(l.getTime() + y * (h === "weeks" ? 7 : 1) * Ve);
2616
2653
  else if (h === "months") {
2617
- const S = l.getUTCMonth() + y, F = l.getUTCFullYear() + Math.floor(S / 12), N = (S % 12 + 12) % 12, P = Math.min(l.getUTCDate(), ft(F, N + 1));
2654
+ const S = l.getUTCMonth() + y, F = l.getUTCFullYear() + Math.floor(S / 12), N = (S % 12 + 12) % 12, P = Math.min(l.getUTCDate(), yt(F, N + 1));
2618
2655
  w = new Date(Date.UTC(F, N, P));
2619
2656
  } else {
2620
- const S = l.getUTCFullYear() + y, F = Math.min(l.getUTCDate(), ft(S, l.getUTCMonth() + 1));
2657
+ const S = l.getUTCFullYear() + y, F = Math.min(l.getUTCDate(), yt(S, l.getUTCMonth() + 1));
2621
2658
  w = new Date(Date.UTC(S, l.getUTCMonth(), F));
2622
2659
  }
2623
2660
  const k = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"][w.getUTCDay()];
2624
2661
  return {
2625
- primary: v("Result date", Ve(w), "accent", k),
2626
- secondary: [v("From", Ve(l)), v("Shift", `${f < 0 ? "−" : "+"}${p} ${h}`)],
2627
- raw: { resultDate: Ve(w), weekday: k, from: Ve(l) }
2662
+ primary: v("Result date", Ye(w), "accent", k),
2663
+ secondary: [v("From", Ye(l)), v("Shift", `${f < 0 ? "−" : "+"}${p} ${h}`)],
2664
+ raw: { resultDate: Ye(w), weekday: k, from: Ye(l) }
2628
2665
  };
2629
2666
  }
2630
- let n = ht(_(e.startDate, "")), a = ht(_(e.endDate, "")), r = !1;
2667
+ let n = ft(_(e.startDate, "")), a = ft(_(e.endDate, "")), r = !1;
2631
2668
  a.getTime() < n.getTime() && ([n, a] = [a, n], r = !0);
2632
2669
  let s = a.getUTCFullYear() - n.getUTCFullYear(), u = a.getUTCMonth() - n.getUTCMonth(), m = a.getUTCDate() - n.getUTCDate();
2633
- m < 0 && (u -= 1, m += ft(a.getUTCFullYear(), a.getUTCMonth())), u < 0 && (s -= 1, u += 12);
2634
- const d = Math.round((a.getTime() - n.getTime()) / je);
2670
+ m < 0 && (u -= 1, m += yt(a.getUTCFullYear(), a.getUTCMonth())), u < 0 && (s -= 1, u += 12);
2671
+ const d = Math.round((a.getTime() - n.getTime()) / Ve);
2635
2672
  let i = 0;
2636
- for (let l = n.getTime() + je; l <= a.getTime(); l += je) {
2673
+ for (let l = n.getTime() + Ve; l <= a.getTime(); l += Ve) {
2637
2674
  const p = new Date(l).getUTCDay();
2638
2675
  p !== 0 && p !== 6 && i++;
2639
2676
  }
@@ -2649,10 +2686,10 @@ const Tr = {
2649
2686
  raw: { years: s, months: u, days: m, totalDays: d, weeks: Number((d / 7).toFixed(2)), businessDays: i }
2650
2687
  };
2651
2688
  }
2652
- }, Tt = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"], Br = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"], tt = (e) => e < 20 ? Tt[e] : Br[Math.floor(e / 10)] + (e % 10 ? " " + Tt[e % 10] : ""), Ft = (e) => {
2689
+ }, Tt = ["Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"], jr = ["", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"], at = (e) => e < 20 ? Tt[e] : jr[Math.floor(e / 10)] + (e % 10 ? " " + Tt[e % 10] : ""), Ft = (e) => {
2653
2690
  const t = Math.floor(e / 100), n = e % 100, a = [];
2654
- return t && a.push(Tt[t] + " Hundred"), n && a.push(tt(n)), a.join(" ");
2655
- }, An = (e) => {
2691
+ return t && a.push(Tt[t] + " Hundred"), n && a.push(at(n)), a.join(" ");
2692
+ }, Ln = (e) => {
2656
2693
  if (e === 0) return "Zero";
2657
2694
  const t = ["", " Thousand", " Million", " Billion", " Trillion"], n = [];
2658
2695
  let a = 0;
@@ -2661,11 +2698,11 @@ const Tr = {
2661
2698
  r && n.unshift(Ft(r) + t[a]), e = Math.floor(e / 1e3), a++;
2662
2699
  }
2663
2700
  return n.length ? n.join(" ") : "Zero";
2664
- }, _r = (e) => {
2701
+ }, Vr = (e) => {
2665
2702
  if (e === 0) return "Zero";
2666
2703
  const t = Math.floor(e / 1e7), n = Math.floor(e / 1e5) % 100, a = Math.floor(e / 1e3) % 100, r = e % 1e3, s = [];
2667
- return t && s.push((t <= 999 ? Ft(t) : An(t)) + " Crore"), n && s.push(tt(n) + " Lakh"), a && s.push(tt(a) + " Thousand"), r && s.push(Ft(r)), s.join(" ");
2668
- }, Hr = {
2704
+ return t && s.push((t <= 999 ? Ft(t) : Ln(t)) + " Crore"), n && s.push(at(n) + " Lakh"), a && s.push(at(a) + " Thousand"), r && s.push(Ft(r)), s.join(" ");
2705
+ }, Yr = {
2669
2706
  id: "tools.numToWords",
2670
2707
  group: "tools",
2671
2708
  title: "Number to Words",
@@ -2687,15 +2724,15 @@ const Tr = {
2687
2724
  ],
2688
2725
  compute(e, t) {
2689
2726
  const { D: n, fmt: a } = t, r = _(e.scale, "indian"), s = ye(e.cheque, !1), u = n(_(e.amount, "0").replace(/[, ]/g, "") || "0"), m = u.isNegative(), d = u.abs(), i = d.floor(), c = Number(d.minus(i).times(100).toDecimalPlaces(0).toString()), l = Number(i.toString()), p = t.settings.currency.code, h = p === "INR" ? "Rupees" : p === "USD" ? "Dollars" : p, f = p === "INR" ? "Paise" : "Cents";
2690
- let y = r === "western" ? An(l) : _r(l);
2691
- return c > 0 && (y += ` and ${tt(c)} ${f}`), s && (y = `${h} ${y} Only`), m && (y = `Minus ${y}`), {
2727
+ let y = r === "western" ? Ln(l) : Vr(l);
2728
+ return c > 0 && (y += ` and ${at(c)} ${f}`), s && (y = `${h} ${y} Only`), m && (y = `Minus ${y}`), {
2692
2729
  primary: v("In words", y, "accent"),
2693
2730
  secondary: [v("In figures", a.num(u, c > 0 ? 2 : 0))],
2694
2731
  notes: ['Words are Title Case with the chosen number scale; the cheque format adds the currency name and "Only".'],
2695
2732
  raw: { words: y, integer: l, fraction: c }
2696
2733
  };
2697
2734
  }
2698
- }, qr = [Ur, Or, Hr], Gr = [
2735
+ }, Kr = [qr, Gr, Yr], Wr = [
2699
2736
  {
2700
2737
  id: "tools.scientific",
2701
2738
  group: "tools",
@@ -2706,7 +2743,7 @@ const Tr = {
2706
2743
  compute: () => ({ primary: { label: "Scientific calculator", value: "" } }),
2707
2744
  custom: "scientific"
2708
2745
  }
2709
- ], jr = {
2746
+ ], zr = {
2710
2747
  id: "loan.emi",
2711
2748
  group: "loans",
2712
2749
  title: "EMI / Loan",
@@ -2715,7 +2752,7 @@ const Tr = {
2715
2752
  inputs: [],
2716
2753
  compute: () => ({ primary: { label: "", value: "" } }),
2717
2754
  custom: "loan.emi"
2718
- }, Vr = {
2755
+ }, Jr = {
2719
2756
  id: "tools.currency",
2720
2757
  group: "tools",
2721
2758
  title: "Currency converter",
@@ -2724,49 +2761,49 @@ const Tr = {
2724
2761
  inputs: [],
2725
2762
  compute: () => ({ primary: { label: "", value: "" } }),
2726
2763
  custom: "currency"
2727
- }, Yr = [
2728
- jr,
2729
- Vr,
2730
- ...qa,
2731
- ...Za,
2732
- ...rr,
2733
- ...lr,
2734
- ...kr,
2735
- ...Dr,
2736
- ...qr,
2737
- ...Gr
2764
+ }, Zr = [
2765
+ zr,
2766
+ Jr,
2767
+ ...Ka,
2768
+ ...nr,
2769
+ ...cr,
2770
+ ...pr,
2771
+ ...Cr,
2772
+ ..._r,
2773
+ ...Kr,
2774
+ ...Wr
2738
2775
  ], It = [];
2739
- function hs(e) {
2776
+ function bs(e) {
2740
2777
  It.some((t) => t.id === e.id) || It.push(e);
2741
2778
  }
2742
- function Dn() {
2743
- return [...Yr, ...It];
2779
+ function Un() {
2780
+ return [...Zr, ...It];
2744
2781
  }
2745
- function Kr(e) {
2746
- return Dn().filter((t) => !t.regions || t.regions.includes(e));
2782
+ function Xr(e) {
2783
+ return Un().filter((t) => !t.regions || t.regions.includes(e));
2747
2784
  }
2748
2785
  function Rt(e) {
2749
- return Dn().find((t) => t.id === e);
2786
+ return Un().find((t) => t.id === e);
2750
2787
  }
2751
- const Wr = [
2788
+ const Qr = [
2752
2789
  { id: "loans", label: "Loans" },
2753
2790
  { id: "invest", label: "Invest" },
2754
2791
  { id: "returns", label: "Returns" },
2755
2792
  { id: "tax", label: "Tax" },
2756
2793
  { id: "tools", label: "Tools" }
2757
2794
  ];
2758
- function zr(e, t) {
2795
+ function eo(e, t) {
2759
2796
  var n;
2760
2797
  return ((n = e.labelByRegion) == null ? void 0 : n[t]) ?? e.label;
2761
2798
  }
2762
- function Jr({
2799
+ function to({
2763
2800
  f: e,
2764
2801
  value: t,
2765
2802
  onChange: n,
2766
2803
  values: a
2767
2804
  }) {
2768
2805
  var i, c;
2769
- const { settings: r } = ue(), s = r.region, u = zr(e, s), m = r.currency.symbol, d = t == null ? "" : String(t);
2806
+ const { settings: r } = ue(), s = r.region, u = eo(e, s), m = r.currency.symbol, d = t == null ? "" : String(t);
2770
2807
  switch (e.kind) {
2771
2808
  case "money":
2772
2809
  case "number":
@@ -2804,7 +2841,7 @@ function Jr({
2804
2841
  ] })
2805
2842
  ] });
2806
2843
  case "tenure":
2807
- return /* @__PURE__ */ o(Zr, { f: e, label: u, months: Number(t) || 0, onChange: n });
2844
+ return /* @__PURE__ */ o(no, { f: e, label: u, months: Number(t) || 0, onChange: n });
2808
2845
  case "select":
2809
2846
  return /* @__PURE__ */ b("label", { className: "field", children: [
2810
2847
  /* @__PURE__ */ o("span", { className: "lbl", children: u }),
@@ -2842,12 +2879,12 @@ function Jr({
2842
2879
  /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("input", { value: d, placeholder: e.help, onChange: (l) => n(l.target.value), "aria-label": u }) })
2843
2880
  ] });
2844
2881
  case "cashflows":
2845
- return /* @__PURE__ */ o(Xr, { f: e, label: u, value: t ?? [], onChange: n });
2882
+ return /* @__PURE__ */ o(ao, { f: e, label: u, value: t ?? [], onChange: n });
2846
2883
  default:
2847
2884
  return null;
2848
2885
  }
2849
2886
  }
2850
- function Zr({
2887
+ function no({
2851
2888
  f: e,
2852
2889
  label: t,
2853
2890
  months: n,
@@ -2887,7 +2924,7 @@ function Zr({
2887
2924
  e.suffix && /* @__PURE__ */ o("div", { className: "solved-note", children: e.suffix })
2888
2925
  ] });
2889
2926
  }
2890
- function Xr({
2927
+ function ao({
2891
2928
  label: e,
2892
2929
  value: t,
2893
2930
  onChange: n
@@ -2910,7 +2947,7 @@ function Xr({
2910
2947
  /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: () => s([...a, { date: "", amount: "" }]), children: "+ Add cashflow" })
2911
2948
  ] });
2912
2949
  }
2913
- const Ln = {
2950
+ const On = {
2914
2951
  principal: "pr-txt",
2915
2952
  interest: "in-txt",
2916
2953
  accent: "accent-txt",
@@ -2918,11 +2955,11 @@ const Ln = {
2918
2955
  negative: "neg-txt",
2919
2956
  default: ""
2920
2957
  };
2921
- function Qr({ view: e }) {
2958
+ function ro({ view: e }) {
2922
2959
  const { settings: t } = ue(), n = t.currency.symbol, a = e.primary.value, r = a.startsWith(n), s = r ? a.slice(n.length).trim() : a, u = /[A-Za-z]{3,}/.test(a);
2923
2960
  return /* @__PURE__ */ b("div", { className: "result", "aria-live": "polite", children: [
2924
2961
  /* @__PURE__ */ o("div", { className: "label", children: e.primary.label }),
2925
- /* @__PURE__ */ b("div", { className: `value num ${u ? "value-text" : ""} ${Ln[e.primary.tone ?? "default"]}`, children: [
2962
+ /* @__PURE__ */ b("div", { className: `value num ${u ? "value-text" : ""} ${On[e.primary.tone ?? "default"]}`, children: [
2926
2963
  r && /* @__PURE__ */ o("span", { className: "cur", children: n }),
2927
2964
  s,
2928
2965
  e.primaryPer && /* @__PURE__ */ b("span", { className: "per", children: [
@@ -2931,18 +2968,18 @@ function Qr({ view: e }) {
2931
2968
  ] })
2932
2969
  ] }),
2933
2970
  e.primary.sub && /* @__PURE__ */ o("div", { className: "per", children: e.primary.sub }),
2934
- e.split && e.split.length > 0 && /* @__PURE__ */ o(to, { split: e.split }),
2935
- e.secondary && e.secondary.length > 0 && /* @__PURE__ */ o("div", { className: "secondary", children: e.secondary.map((m, d) => /* @__PURE__ */ o(eo, { m }, d)) })
2971
+ e.split && e.split.length > 0 && /* @__PURE__ */ o(io, { split: e.split }),
2972
+ e.secondary && e.secondary.length > 0 && /* @__PURE__ */ o("div", { className: "secondary", children: e.secondary.map((m, d) => /* @__PURE__ */ o(oo, { m }, d)) })
2936
2973
  ] });
2937
2974
  }
2938
- function eo({ m: e }) {
2975
+ function oo({ m: e }) {
2939
2976
  return /* @__PURE__ */ b("div", { className: "kv", children: [
2940
2977
  /* @__PURE__ */ o("div", { className: "k", children: e.label }),
2941
- /* @__PURE__ */ o("div", { className: `v num ${Ln[e.tone ?? "default"]}`, children: e.value }),
2978
+ /* @__PURE__ */ o("div", { className: `v num ${On[e.tone ?? "default"]}`, children: e.value }),
2942
2979
  e.sub && /* @__PURE__ */ o("div", { className: "k", children: e.sub })
2943
2980
  ] });
2944
2981
  }
2945
- function to({ split: e }) {
2982
+ function io({ split: e }) {
2946
2983
  const t = e.reduce((a, r) => a + Math.max(0, r.value), 0) || 1, n = e.map((a) => Math.round(Math.max(0, a.value) / t * 100));
2947
2984
  return /* @__PURE__ */ b(re, { children: [
2948
2985
  /* @__PURE__ */ o("div", { className: "splitbar", role: "img", "aria-label": e.map((a, r) => `${a.label} ${n[r]}%`).join(", "), children: e.map((a, r) => /* @__PURE__ */ o("div", { className: a.tone, style: { width: `${n[r]}%` } }, r)) }),
@@ -2955,7 +2992,7 @@ function to({ split: e }) {
2955
2992
  ] }, r)) })
2956
2993
  ] });
2957
2994
  }
2958
- function no({ schedule: e }) {
2995
+ function so({ schedule: e }) {
2959
2996
  var u;
2960
2997
  const [t, n] = M(/* @__PURE__ */ new Set([0])), a = (m) => {
2961
2998
  var d;
@@ -2997,7 +3034,7 @@ const zt = {
2997
3034
  interest: "var(--fc-interest)",
2998
3035
  accent: "var(--fc-accent)"
2999
3036
  };
3000
- function ao({ chart: e }) {
3037
+ function lo({ chart: e }) {
3001
3038
  const m = Math.max(...e.series.map((h) => h.points.length), 1), d = Math.max(...e.series.flatMap((h) => h.points), 1), i = (h) => 8 + h / Math.max(m - 1, 1) * 704, c = (h) => 12 + (1 - h / d) * 226, l = (h) => h.map((f, y) => `${y === 0 ? "M" : "L"}${i(y).toFixed(1)},${c(f).toFixed(1)}`).join(" "), p = (h) => `M${i(0)},${c(0)} ${h.map((f, y) => `L${i(y).toFixed(1)},${c(f).toFixed(1)}`).join(" ")} L${i(h.length - 1)},${c(0)} Z`;
3002
3039
  return /* @__PURE__ */ b("div", { className: "chart", children: [
3003
3040
  /* @__PURE__ */ b("svg", { viewBox: "0 0 720 260", role: "img", "aria-label": "Projection chart", children: [
@@ -3013,7 +3050,7 @@ function ao({ chart: e }) {
3013
3050
  ] }, f)) })
3014
3051
  ] });
3015
3052
  }
3016
- const Un = 1, ro = [
3053
+ const Bn = 1, co = [
3017
3054
  { id: "csv", label: "CSV (.csv)" },
3018
3055
  { id: "tsv", label: "TSV (.tsv)" },
3019
3056
  { id: "json", label: "JSON (.json)" },
@@ -3042,7 +3079,7 @@ function _e(e) {
3042
3079
  for (const n of e.rows) t.push([n.label, ...n.cells]);
3043
3080
  return { header: e.columns, rows: t };
3044
3081
  }
3045
- function oo(e) {
3082
+ function uo(e) {
3046
3083
  var t;
3047
3084
  return e ? e.groups ? e.groups.reduce((n, a) => n + a.rows.length, 0) : ((t = e.rows) == null ? void 0 : t.length) ?? 0 : 0;
3048
3085
  }
@@ -3062,32 +3099,32 @@ function Se(e, t, n = "application/octet-stream") {
3062
3099
  URL.revokeObjectURL(r), s.remove();
3063
3100
  }, 0);
3064
3101
  }
3065
- function io(e, t) {
3102
+ function mo(e, t) {
3066
3103
  let n = e == null ? "" : String(e);
3067
3104
  return /^[=+\-@\t\r]/.test(n) && (n = `'${n}`), (n.includes(t) || n.includes('"') || n.includes(`
3068
3105
  `) || n.includes("\r")) && (n = `"${n.replace(/"/g, '""')}"`), n;
3069
3106
  }
3070
- function so(e) {
3107
+ function po(e) {
3071
3108
  var t;
3072
3109
  return ((t = e == null ? void 0 : e.numberFormat) == null ? void 0 : t.grouping) === "european" ? ";" : ",";
3073
3110
  }
3074
- function On(e, t) {
3111
+ function _n(e, t) {
3075
3112
  const n = [["ArthaGanaka export"], ["Calculator", e.title]];
3076
3113
  for (const a of Re(e)) n.push(a);
3077
3114
  if (n.push([]), e.result.schedule) {
3078
3115
  const a = _e(e.result.schedule);
3079
3116
  n.push(a.header, ...a.rows);
3080
3117
  }
3081
- return n.map((a) => a.map((r) => io(r, t)).join(t)).join(`\r
3118
+ return n.map((a) => a.map((r) => mo(r, t)).join(t)).join(`\r
3082
3119
  `);
3083
3120
  }
3084
- function lo(e) {
3085
- return On(e, so(e.settingsSnapshot));
3121
+ function ho(e) {
3122
+ return _n(e, po(e.settingsSnapshot));
3086
3123
  }
3087
- function co(e) {
3088
- return On(e, " ");
3124
+ function fo(e) {
3125
+ return _n(e, " ");
3089
3126
  }
3090
- function uo(e, t = Un) {
3127
+ function yo(e, t = Bn) {
3091
3128
  return JSON.stringify(
3092
3129
  {
3093
3130
  schemaVersion: t,
@@ -3107,7 +3144,7 @@ function uo(e, t = Un) {
3107
3144
  2
3108
3145
  );
3109
3146
  }
3110
- function mo(e) {
3147
+ function bo(e) {
3111
3148
  const t = new TextEncoder().encode(e);
3112
3149
  if (typeof btoa == "function") {
3113
3150
  let n = "";
@@ -3116,41 +3153,41 @@ function mo(e) {
3116
3153
  }
3117
3154
  return globalThis.Buffer.from(t).toString("base64");
3118
3155
  }
3119
- const po = (e) => mo(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3120
- function Bn(e, t) {
3121
- const n = po(JSON.stringify({ id: e, values: t }));
3156
+ const go = (e) => bo(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
3157
+ function Hn(e, t) {
3158
+ const n = go(JSON.stringify({ id: e, values: t }));
3122
3159
  return `#fincalc=${encodeURIComponent(e)}&s=${n}`;
3123
3160
  }
3124
- const Ye = (e) => String(e ?? "").replace(/\|/g, "\\|").replace(/\n/g, " ");
3161
+ const Ke = (e) => String(e ?? "").replace(/\|/g, "\\|").replace(/\n/g, " ");
3125
3162
  function Jt(e) {
3126
3163
  const t = [`# ${e.title}`, ""];
3127
3164
  t.push("| Metric | Value |", "| --- | --- |");
3128
- for (const [n, a] of Re(e)) t.push(`| ${Ye(n)} | ${Ye(a)} |`);
3165
+ for (const [n, a] of Re(e)) t.push(`| ${Ke(n)} | ${Ke(a)} |`);
3129
3166
  if (e.result.schedule) {
3130
3167
  const n = _e(e.result.schedule);
3131
- t.push("", `## ${e.result.schedule.title ?? "Schedule"}`, ""), t.push(`| ${n.header.map(Ye).join(" | ")} |`), t.push(`| ${n.header.map(() => "---").join(" | ")} |`);
3132
- for (const a of n.rows) t.push(`| ${a.map(Ye).join(" | ")} |`);
3168
+ t.push("", `## ${e.result.schedule.title ?? "Schedule"}`, ""), t.push(`| ${n.header.map(Ke).join(" | ")} |`), t.push(`| ${n.header.map(() => "---").join(" | ")} |`);
3169
+ for (const a of n.rows) t.push(`| ${a.map(Ke).join(" | ")} |`);
3133
3170
  }
3134
3171
  return t.push("", `_Generated by ArthaGanaka · ${e.meta.computedAt}_`), t.join(`
3135
3172
  `);
3136
3173
  }
3137
3174
  const Pe = (e) => String(e ?? "").replace(/[&<>"]/g, (t) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" })[t]);
3138
- function ho(e) {
3175
+ function vo(e) {
3139
3176
  return `<table><tbody>${Re(e).map(([n, a]) => `<tr><th>${Pe(n)}</th><td>${Pe(a)}</td></tr>`).join("")}</tbody></table>`;
3140
3177
  }
3141
- function fo(e) {
3178
+ function ko(e) {
3142
3179
  const t = _e(e), n = `<tr>${t.header.map((r) => `<th>${Pe(r)}</th>`).join("")}</tr>`, a = t.rows.map((r) => `<tr>${r.map((s) => `<td>${Pe(s)}</td>`).join("")}</tr>`).join("");
3143
3180
  return `<table><thead>${n}</thead><tbody>${a}</tbody></table>`;
3144
3181
  }
3145
- function _n(e) {
3146
- const t = e.result.schedule ? `<h2>${Pe(e.result.schedule.title ?? "Schedule")}</h2>${fo(e.result.schedule)}` : "";
3147
- return `<h1>${Pe(e.title)}</h1>${ho(e)}${t}<p class="fc-print-foot">Generated by ArthaGanaka · ${Pe(e.meta.computedAt)}</p>`;
3182
+ function qn(e) {
3183
+ const t = e.result.schedule ? `<h2>${Pe(e.result.schedule.title ?? "Schedule")}</h2>${ko(e.result.schedule)}` : "";
3184
+ return `<h1>${Pe(e.title)}</h1>${vo(e)}${t}<p class="fc-print-foot">Generated by ArthaGanaka · ${Pe(e.meta.computedAt)}</p>`;
3148
3185
  }
3149
- const Zt = (e) => String(e ?? "").replace(/\\/g, "\\\\").replace(/[;,]/g, (t) => `\\${t}`).replace(/\n/g, "\\n"), Xt = (e) => `${e.getFullYear()}${String(e.getMonth() + 1).padStart(2, "0")}${String(e.getDate()).padStart(2, "0")}`, yo = (e) => new Date(e || Date.now()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z"), bo = (e, t) => {
3186
+ const Zt = (e) => String(e ?? "").replace(/\\/g, "\\\\").replace(/[;,]/g, (t) => `\\${t}`).replace(/\n/g, "\\n"), Xt = (e) => `${e.getFullYear()}${String(e.getMonth() + 1).padStart(2, "0")}${String(e.getDate()).padStart(2, "0")}`, wo = (e) => new Date(e || Date.now()).toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z"), No = (e, t) => {
3150
3187
  const n = new Date(e);
3151
3188
  return n.setMonth(n.getMonth() + t), n;
3152
3189
  };
3153
- function go(e) {
3190
+ function xo(e) {
3154
3191
  for (const t of Object.values(e))
3155
3192
  if (typeof t == "string" && /^\d{4}-\d{2}-\d{2}/.test(t)) {
3156
3193
  const n = new Date(t);
@@ -3158,12 +3195,12 @@ function go(e) {
3158
3195
  }
3159
3196
  return /* @__PURE__ */ new Date();
3160
3197
  }
3161
- function vo(e) {
3162
- const t = oo(e.result.schedule);
3198
+ function So(e) {
3199
+ const t = uo(e.result.schedule);
3163
3200
  if (!t) throw new Error("This calculator has no instalment schedule to put on a calendar.");
3164
- const n = go(e.values), a = t <= 60, r = a ? t : Math.ceil(t / 12), s = yo(e.meta.computedAt), u = ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//ArthaGanaka//Export//EN", "CALSCALE:GREGORIAN"];
3201
+ const n = xo(e.values), a = t <= 60, r = a ? t : Math.ceil(t / 12), s = wo(e.meta.computedAt), u = ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//ArthaGanaka//Export//EN", "CALSCALE:GREGORIAN"];
3165
3202
  for (let m = 0; m < r; m++) {
3166
- const d = bo(n, a ? m + 1 : (m + 1) * 12), i = a ? `instalment ${m + 1}` : `year ${m + 1}`;
3203
+ const d = No(n, a ? m + 1 : (m + 1) * 12), i = a ? `instalment ${m + 1}` : `year ${m + 1}`;
3167
3204
  u.push(
3168
3205
  "BEGIN:VEVENT",
3169
3206
  `UID:${Zt(e.calculatorId)}-${m + 1}-${Xt(d)}@arthaganaka`,
@@ -3176,13 +3213,13 @@ function vo(e) {
3176
3213
  return u.push("END:VCALENDAR"), u.join(`\r
3177
3214
  `);
3178
3215
  }
3179
- async function Hn(e) {
3216
+ async function Gn(e) {
3180
3217
  var n;
3181
3218
  const t = typeof navigator < "u" ? navigator : void 0;
3182
3219
  if ((n = t == null ? void 0 : t.clipboard) != null && n.writeText) return t.clipboard.writeText(e);
3183
3220
  throw new Error("Clipboard is not available in this browser.");
3184
3221
  }
3185
- async function ko(e, t) {
3222
+ async function Co(e, t) {
3186
3223
  var a;
3187
3224
  const n = typeof navigator < "u" ? navigator : void 0;
3188
3225
  if ((a = n == null ? void 0 : n.clipboard) != null && a.write && typeof ClipboardItem < "u" && typeof Blob < "u")
@@ -3196,18 +3233,18 @@ async function ko(e, t) {
3196
3233
  return;
3197
3234
  } catch {
3198
3235
  }
3199
- await Hn(t);
3236
+ await Gn(t);
3200
3237
  }
3201
- function wo(e) {
3238
+ function Po(e) {
3202
3239
  if (!Ot() || typeof window > "u") throw new Error("Print is only available in the browser.");
3203
3240
  const t = document.createElement("div");
3204
- t.className = "fc-print-root", t.innerHTML = _n(e), document.body.appendChild(t), document.body.classList.add("fc-printing");
3241
+ t.className = "fc-print-root", t.innerHTML = qn(e), document.body.appendChild(t), document.body.classList.add("fc-printing");
3205
3242
  const n = () => {
3206
3243
  document.body.classList.remove("fc-printing"), t.remove(), window.removeEventListener("afterprint", n);
3207
3244
  };
3208
3245
  window.addEventListener("afterprint", n), window.print(), setTimeout(n, 1500);
3209
3246
  }
3210
- function No(e, t = 2) {
3247
+ function To(e, t = 2) {
3211
3248
  if (!Ot()) return Promise.reject(new Error("PNG export is only available in the browser."));
3212
3249
  const n = Re(e), a = 620, r = 120 + n.length * 30 + 30, s = document.createElement("canvas");
3213
3250
  s.width = a * t, s.height = r * t;
@@ -3224,7 +3261,7 @@ function No(e, t = 2) {
3224
3261
  (i, c) => s.toBlob((l) => l ? i(l) : c(new Error("Could not render PNG.")), "image/png")
3225
3262
  );
3226
3263
  }
3227
- async function xo(e) {
3264
+ async function Fo(e) {
3228
3265
  let t;
3229
3266
  try {
3230
3267
  t = await import(
@@ -3250,7 +3287,7 @@ async function xo(e) {
3250
3287
  const s = ve(e, "pdf");
3251
3288
  return a.save(s), { ok: !0, filename: s };
3252
3289
  }
3253
- async function So(e) {
3290
+ async function Io(e) {
3254
3291
  var i, c;
3255
3292
  let t;
3256
3293
  try {
@@ -3273,12 +3310,12 @@ async function So(e) {
3273
3310
  const m = a(u, { type: "array", bookType: "xlsx" }), d = ve(e, "xlsx");
3274
3311
  return Se(d, new Blob([m], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" })), { ok: !0, filename: d };
3275
3312
  }
3276
- function qn(e) {
3277
- const t = Bn(e.calculatorId, e.values);
3313
+ function jn(e) {
3314
+ const t = Hn(e.calculatorId, e.values);
3278
3315
  return (typeof location < "u" ? location.origin + location.pathname : "") + t;
3279
3316
  }
3280
- async function Co(e) {
3281
- const t = Bn(e.calculatorId, e.values), n = qn(e);
3317
+ async function Ro(e) {
3318
+ const t = Hn(e.calculatorId, e.values), n = jn(e);
3282
3319
  if (typeof location < "u")
3283
3320
  try {
3284
3321
  location.hash = t;
@@ -3286,31 +3323,31 @@ async function Co(e) {
3286
3323
  }
3287
3324
  const a = n.length > 2e3 ? `Link is long (${n.length} chars) — some apps may trim it. ` : "";
3288
3325
  try {
3289
- return await Hn(n), { ok: !0, data: n, note: `${a}Link copied to clipboard.` };
3326
+ return await Gn(n), { ok: !0, data: n, note: `${a}Link copied to clipboard.` };
3290
3327
  } catch {
3291
3328
  return { ok: !0, data: n, note: `${a}Link is in the address bar — copy it from there.` };
3292
3329
  }
3293
3330
  }
3294
- function Po(e) {
3331
+ function Eo(e) {
3295
3332
  return {
3296
3333
  ok: !0,
3297
- data: qn(e),
3334
+ data: jn(e),
3298
3335
  note: "A QR image needs an optional QR library — share this link instead."
3299
3336
  };
3300
3337
  }
3301
- function To(e = {}) {
3302
- const t = e.schemaVersion ?? Un, n = {
3338
+ function Mo(e = {}) {
3339
+ const t = e.schemaVersion ?? Bn, n = {
3303
3340
  csv: (a) => {
3304
3341
  const r = ve(a, "csv");
3305
- return Se(r, lo(a), "text/csv;charset=utf-8"), { ok: !0, filename: r };
3342
+ return Se(r, ho(a), "text/csv;charset=utf-8"), { ok: !0, filename: r };
3306
3343
  },
3307
3344
  tsv: (a) => {
3308
3345
  const r = ve(a, "tsv");
3309
- return Se(r, co(a), "text/tab-separated-values;charset=utf-8"), { ok: !0, filename: r };
3346
+ return Se(r, fo(a), "text/tab-separated-values;charset=utf-8"), { ok: !0, filename: r };
3310
3347
  },
3311
3348
  json: (a) => {
3312
3349
  const r = ve(a, "json");
3313
- return Se(r, uo(a, t), "application/json"), { ok: !0, filename: r };
3350
+ return Se(r, yo(a, t), "application/json"), { ok: !0, filename: r };
3314
3351
  },
3315
3352
  markdown: (a) => {
3316
3353
  const r = ve(a, "md");
@@ -3318,18 +3355,18 @@ function To(e = {}) {
3318
3355
  },
3319
3356
  ics: (a) => {
3320
3357
  const r = ve(a, "ics");
3321
- return Se(r, vo(a), "text/calendar;charset=utf-8"), { ok: !0, filename: r };
3358
+ return Se(r, So(a), "text/calendar;charset=utf-8"), { ok: !0, filename: r };
3322
3359
  },
3323
- clipboard: async (a) => (await ko(_n(a), Jt(a)), { ok: !0, note: "Copied table to clipboard." }),
3324
- print: (a) => (wo(a), { ok: !0 }),
3325
- url: (a) => Co(a),
3326
- qr: (a) => Po(a),
3360
+ clipboard: async (a) => (await Co(qn(a), Jt(a)), { ok: !0, note: "Copied table to clipboard." }),
3361
+ print: (a) => (Po(a), { ok: !0 }),
3362
+ url: (a) => Ro(a),
3363
+ qr: (a) => Eo(a),
3327
3364
  png: async (a, r) => {
3328
3365
  const s = ve(a, "png");
3329
- return Se(s, await No(a, r.scale ?? 2)), { ok: !0, filename: s };
3366
+ return Se(s, await To(a, r.scale ?? 2)), { ok: !0, filename: s };
3330
3367
  },
3331
- pdf: (a) => xo(a),
3332
- xlsx: (a) => So(a)
3368
+ pdf: (a) => Fo(a),
3369
+ xlsx: (a) => Io(a)
3333
3370
  };
3334
3371
  return {
3335
3372
  formats: Object.keys(n),
@@ -3339,13 +3376,13 @@ function To(e = {}) {
3339
3376
  }
3340
3377
  };
3341
3378
  }
3342
- function Gn({ payload: e }) {
3343
- const t = ne(() => To(), []), [n, a] = M(!1), [r, s] = M(null), u = de(null), m = de(null), d = de([]);
3344
- X(() => {
3379
+ function Vn({ payload: e }) {
3380
+ const t = X(() => Mo(), []), [n, a] = M(!1), [r, s] = M(null), u = de(null), m = de(null), d = de([]);
3381
+ Q(() => {
3345
3382
  if (!r) return;
3346
3383
  const p = setTimeout(() => s(null), 4500);
3347
3384
  return () => clearTimeout(p);
3348
- }, [r]), X(() => {
3385
+ }, [r]), Q(() => {
3349
3386
  var h;
3350
3387
  if (!n) return;
3351
3388
  (h = d.current[0]) == null || h.focus();
@@ -3408,7 +3445,7 @@ function Gn({ payload: e }) {
3408
3445
  }
3409
3446
  )
3410
3447
  ] }),
3411
- n && /* @__PURE__ */ o("div", { ref: m, className: "menu-list", role: "menu", "aria-label": "Export as", children: ro.map((p, h) => /* @__PURE__ */ o(
3448
+ n && /* @__PURE__ */ o("div", { ref: m, className: "menu-list", role: "menu", "aria-label": "Export as", children: co.map((p, h) => /* @__PURE__ */ o(
3412
3449
  "button",
3413
3450
  {
3414
3451
  type: "button",
@@ -3425,10 +3462,10 @@ function Gn({ payload: e }) {
3425
3462
  r && /* @__PURE__ */ o("div", { className: `export-toast ${r.kind}`, role: "status", "aria-live": "polite", children: r.msg })
3426
3463
  ] });
3427
3464
  }
3428
- const Bt = "calcsuite:history", Fo = 100, Io = [];
3465
+ const Bt = "calcsuite:history", $o = 100, Ao = [];
3429
3466
  let Ce = null;
3430
- const ze = /* @__PURE__ */ new Set();
3431
- function jn() {
3467
+ const Ze = /* @__PURE__ */ new Set();
3468
+ function Yn() {
3432
3469
  if (Ce) return Ce;
3433
3470
  try {
3434
3471
  Ce = JSON.parse(localStorage.getItem(Bt) || "[]");
@@ -3437,39 +3474,39 @@ function jn() {
3437
3474
  }
3438
3475
  return Ce;
3439
3476
  }
3440
- function Vn(e) {
3477
+ function Kn(e) {
3441
3478
  Ce = e;
3442
3479
  try {
3443
3480
  localStorage.setItem(Bt, JSON.stringify(e));
3444
3481
  } catch {
3445
3482
  }
3446
- ze.forEach((t) => t());
3483
+ Ze.forEach((t) => t());
3447
3484
  }
3448
3485
  let Qt = !1;
3449
- function Ro(e) {
3450
- return ze.add(e), !Qt && typeof window < "u" && (Qt = !0, window.addEventListener("storage", (t) => {
3451
- t.key === Bt && (Ce = null, ze.forEach((n) => n()));
3452
- })), () => ze.delete(e);
3486
+ function Do(e) {
3487
+ return Ze.add(e), !Qt && typeof window < "u" && (Qt = !0, window.addEventListener("storage", (t) => {
3488
+ t.key === Bt && (Ce = null, Ze.forEach((n) => n()));
3489
+ })), () => Ze.delete(e);
3453
3490
  }
3454
- function Yn(e) {
3455
- Vn([{ ...e, at: Date.now() }, ...jn()].slice(0, Fo));
3491
+ function Wn(e) {
3492
+ Kn([{ ...e, at: Date.now() }, ...Yn()].slice(0, $o));
3456
3493
  }
3457
- function Eo() {
3458
- Vn([]);
3494
+ function Lo() {
3495
+ Kn([]);
3459
3496
  }
3460
- function Mo() {
3461
- const e = ya(Ro, jn, () => Io), t = ke((a) => Yn(a), []), n = ke(() => Eo(), []);
3497
+ function Uo() {
3498
+ const e = va(Do, Yn, () => Ao), t = ke((a) => Wn(a), []), n = ke(() => Lo(), []);
3462
3499
  return { items: e, save: t, clear: n };
3463
3500
  }
3464
- function Kn({ item: e }) {
3501
+ function zn({ item: e }) {
3465
3502
  const [t, n] = M(!1), a = de();
3466
- return X(() => () => clearTimeout(a.current), []), /* @__PURE__ */ o("button", { className: `icon-btn ${t ? "saved" : ""}`, onClick: () => {
3467
- Yn(e), n(!0), clearTimeout(a.current), a.current = setTimeout(() => n(!1), 1500);
3503
+ return Q(() => () => clearTimeout(a.current), []), /* @__PURE__ */ o("button", { className: `icon-btn ${t ? "saved" : ""}`, onClick: () => {
3504
+ Wn(e), n(!0), clearTimeout(a.current), a.current = setTimeout(() => n(!1), 1500);
3468
3505
  }, "aria-live": "polite", children: t ? "Saved ✓" : "Save" });
3469
3506
  }
3470
- const $o = { payment: "Payment", principal: "Amount", rate: "Rate", tenure: "Term" };
3471
- function Wn() {
3472
- const { settings: e, fmt: t } = ue(), n = e.region, a = me[n], [r, s] = M("payment"), [u, m] = M(a.defaultBasis), [d, i] = M(n === "IN" ? "2500000" : "300000"), [c, l] = M(a.defaultRatePct), [p, h] = M(String(Math.floor(a.defaultTermMonths / 12))), [f, y] = M(String(a.defaultTermMonths % 12)), [w, k] = M(n === "IN" ? "21934" : "1896"), [S, F] = M("schedule"), N = u === "flat" ? ["payment", "principal"] : ["payment", "principal", "rate", "tenure"], P = (parseInt(p || "0", 10) || 0) * 12 + (parseInt(f || "0", 10) || 0), x = (R) => R.replace(/[, ]/g, "").trim(), { result: T, error: $ } = ne(() => {
3507
+ const Oo = { payment: "Payment", principal: "Amount", rate: "Rate", tenure: "Term" };
3508
+ function Jn() {
3509
+ const { settings: e, fmt: t } = ue(), n = e.region, a = me[n], [r, s] = M("payment"), [u, m] = M(a.defaultBasis), [d, i] = M(n === "IN" ? "2500000" : "300000"), [c, l] = M(a.defaultRatePct), [p, h] = M(String(Math.floor(a.defaultTermMonths / 12))), [f, y] = M(String(a.defaultTermMonths % 12)), [w, k] = M(n === "IN" ? "21934" : "1896"), [S, F] = M("schedule"), N = u === "flat" ? ["payment", "principal"] : ["payment", "principal", "rate", "tenure"], P = (parseInt(p || "0", 10) || 0) * 12 + (parseInt(f || "0", 10) || 0), x = (R) => R.replace(/[, ]/g, "").trim(), { result: T, error: $ } = X(() => {
3473
3510
  try {
3474
3511
  return { result: Ie({
3475
3512
  region: n,
@@ -3486,7 +3523,7 @@ function Wn() {
3486
3523
  payment: T ? t.money(T.payment) : "—",
3487
3524
  principal: T ? t.money(T.principal) : "—",
3488
3525
  rate: T ? `${t.num(T.annualRatePct, 3)} %` : "—",
3489
- tenure: T ? mt(T.tenureMonths) : "—"
3526
+ tenure: T ? pt(T.tenureMonths) : "—"
3490
3527
  }, G = T ? t.moneyParts(T.payment) : { symbol: "", digits: "—" }, q = e.currency.symbol, A = {
3491
3528
  region: n,
3492
3529
  basis: u,
@@ -3527,7 +3564,7 @@ function Wn() {
3527
3564
  { label: "Principal", value: t.money(R.principal) },
3528
3565
  { label: "Total interest", value: t.money(R.totalInterest), tone: "interest" },
3529
3566
  { label: "Total payment", value: t.money(R.totalPayment) },
3530
- { label: a.tenureWord, value: mt(R.tenureMonths) }
3567
+ { label: a.tenureWord, value: pt(R.tenureMonths) }
3531
3568
  ],
3532
3569
  schedule: j,
3533
3570
  formula: R.formula,
@@ -3544,7 +3581,7 @@ function Wn() {
3544
3581
  /* @__PURE__ */ b("section", { className: "card", children: [
3545
3582
  /* @__PURE__ */ b("div", { className: "solve-row", children: [
3546
3583
  /* @__PURE__ */ o("span", { className: "lbl", children: "Solve for" }),
3547
- /* @__PURE__ */ o("div", { className: "seg", role: "group", "aria-label": "Solve for", children: N.map((R) => /* @__PURE__ */ o("button", { "aria-pressed": r === R, onClick: () => s(R), children: $o[R] }, R)) })
3584
+ /* @__PURE__ */ o("div", { className: "seg", role: "group", "aria-label": "Solve for", children: N.map((R) => /* @__PURE__ */ o("button", { "aria-pressed": r === R, onClick: () => s(R), children: Oo[R] }, R)) })
3548
3585
  ] }),
3549
3586
  /* @__PURE__ */ b("div", { className: "field", style: { marginBottom: "calc(var(--fc-space) * 2)" }, children: [
3550
3587
  /* @__PURE__ */ o("span", { className: "lbl", children: "Interest basis" }),
@@ -3563,8 +3600,8 @@ function Wn() {
3563
3600
  ] })
3564
3601
  ] }),
3565
3602
  /* @__PURE__ */ b("div", { className: "grid two", children: [
3566
- /* @__PURE__ */ o(yt, { label: "Loan amount", solved: L("principal"), solvedText: B.principal, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: d, onChange: (R) => i(R.target.value), "aria-label": "Loan amount" }) }),
3567
- /* @__PURE__ */ o(yt, { label: "Interest rate", solved: L("rate"), solvedText: B.rate, suffix: "% p.a.", children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: c, onChange: (R) => l(R.target.value), "aria-label": "Interest rate" }) }),
3603
+ /* @__PURE__ */ o(bt, { label: "Loan amount", solved: L("principal"), solvedText: B.principal, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: d, onChange: (R) => i(R.target.value), "aria-label": "Loan amount" }) }),
3604
+ /* @__PURE__ */ o(bt, { label: "Interest rate", solved: L("rate"), solvedText: B.rate, suffix: "% p.a.", children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: c, onChange: (R) => l(R.target.value), "aria-label": "Interest rate" }) }),
3568
3605
  /* @__PURE__ */ b("div", { className: "field", children: [
3569
3606
  /* @__PURE__ */ o("span", { className: "lbl", children: a.tenureWord }),
3570
3607
  L("tenure") ? /* @__PURE__ */ b(re, { children: [
@@ -3581,7 +3618,7 @@ function Wn() {
3581
3618
  ] })
3582
3619
  ] })
3583
3620
  ] }),
3584
- /* @__PURE__ */ o(yt, { label: a.paymentLabel, solved: L("payment"), solvedText: B.payment, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: w, onChange: (R) => k(R.target.value), "aria-label": a.paymentLabel }) })
3621
+ /* @__PURE__ */ o(bt, { label: a.paymentLabel, solved: L("payment"), solvedText: B.payment, affix: q, children: /* @__PURE__ */ o("input", { className: "num", inputMode: "decimal", value: w, onChange: (R) => k(R.target.value), "aria-label": a.paymentLabel }) })
3585
3622
  ] }),
3586
3623
  $ && /* @__PURE__ */ o("div", { className: "error", role: "alert", style: { marginTop: 16 }, children: $ })
3587
3624
  ] }),
@@ -3598,7 +3635,7 @@ function Wn() {
3598
3635
  /* @__PURE__ */ o("span", { className: "per", children: " /month" })
3599
3636
  ] })
3600
3637
  ] }),
3601
- /* @__PURE__ */ o(Ao, { result: T }),
3638
+ /* @__PURE__ */ o(Bo, { result: T }),
3602
3639
  /* @__PURE__ */ b("div", { className: "secondary", children: [
3603
3640
  /* @__PURE__ */ b("div", { className: "kv", children: [
3604
3641
  /* @__PURE__ */ o("div", { className: "k", children: "Principal" }),
@@ -3614,18 +3651,18 @@ function Wn() {
3614
3651
  ] }),
3615
3652
  /* @__PURE__ */ b("div", { className: "kv", children: [
3616
3653
  /* @__PURE__ */ o("div", { className: "k", children: a.tenureWord }),
3617
- /* @__PURE__ */ o("div", { className: "v num", children: mt(T.tenureMonths) })
3654
+ /* @__PURE__ */ o("div", { className: "v num", children: pt(T.tenureMonths) })
3618
3655
  ] })
3619
3656
  ] }),
3620
3657
  /* @__PURE__ */ b("div", { className: "actions-row", children: [
3621
3658
  /* @__PURE__ */ o(
3622
- Kn,
3659
+ zn,
3623
3660
  {
3624
3661
  item: { id: "loan.emi", title: `Loan — ${t.money(T.payment)}/mo`, primary: t.money(T.payment), values: A }
3625
3662
  }
3626
3663
  ),
3627
3664
  /* @__PURE__ */ o(
3628
- Gn,
3665
+ Vn,
3629
3666
  {
3630
3667
  payload: {
3631
3668
  calculatorId: "loan.emi",
@@ -3657,8 +3694,8 @@ function Wn() {
3657
3694
  e.ui.showFormulas && /* @__PURE__ */ o("button", { role: "tab", "aria-selected": S === "formula", onClick: () => F("formula"), children: "Formula" })
3658
3695
  ] }),
3659
3696
  /* @__PURE__ */ b("div", { className: "tab-anim", children: [
3660
- S === "schedule" && /* @__PURE__ */ o(Do, { result: T }),
3661
- S === "chart" && /* @__PURE__ */ o(Lo, { result: T }),
3697
+ S === "schedule" && /* @__PURE__ */ o(_o, { result: T }),
3698
+ S === "chart" && /* @__PURE__ */ o(Ho, { result: T }),
3662
3699
  S === "formula" && e.ui.showFormulas && /* @__PURE__ */ b("div", { className: "formula", children: [
3663
3700
  /* @__PURE__ */ o("code", { children: T.formula }),
3664
3701
  /* @__PURE__ */ b("div", { className: "assumptions", children: [
@@ -3683,7 +3720,7 @@ function Wn() {
3683
3720
  ] })
3684
3721
  ] });
3685
3722
  }
3686
- function yt({
3723
+ function bt({
3687
3724
  label: e,
3688
3725
  solved: t,
3689
3726
  solvedText: n,
@@ -3703,7 +3740,7 @@ function yt({
3703
3740
  ] })
3704
3741
  ] });
3705
3742
  }
3706
- function Ao({ result: e }) {
3743
+ function Bo({ result: e }) {
3707
3744
  const { fmt: t } = ue(), n = Number(e.principal.toFixed(2)), a = Number(e.totalInterest.toFixed(2)), r = n + a || 1, s = Math.round(n / r * 100);
3708
3745
  return /* @__PURE__ */ b(re, { children: [
3709
3746
  /* @__PURE__ */ b("div", { className: "splitbar", role: "img", "aria-label": `Principal ${s}%, interest ${100 - s}%`, children: [
@@ -3728,7 +3765,7 @@ function Ao({ result: e }) {
3728
3765
  ] })
3729
3766
  ] });
3730
3767
  }
3731
- function Do({ result: e }) {
3768
+ function _o({ result: e }) {
3732
3769
  const { fmt: t } = ue(), [n, a] = M("yearly"), [r, s] = M(/* @__PURE__ */ new Set([1])), u = (d) => s((i) => {
3733
3770
  const c = new Set(i);
3734
3771
  return c.has(d) ? c.delete(d) : c.add(d), c;
@@ -3790,7 +3827,7 @@ function Do({ result: e }) {
3790
3827
  ] }) })
3791
3828
  ] });
3792
3829
  }
3793
- function Lo({ result: e }) {
3830
+ function Ho({ result: e }) {
3794
3831
  const { fmt: t } = ue(), n = e.chart.balance.map((k) => k.toNumber()), a = e.chart.cumulativeInterest.map((k) => k.toNumber()), r = n.length, s = 720, u = 260, m = 8, d = 8, i = 12, c = 22, l = e.principal.toNumber(), p = Math.max(l, a[a.length - 1] ?? 0) || 1, h = (k) => m + k / Math.max(r - 1, 1) * (s - m - d), f = (k) => i + (1 - k / p) * (u - i - c), y = (k) => k.map((S, F) => `${F === 0 ? "M" : "L"}${h(F).toFixed(1)},${f(S).toFixed(1)}`).join(" "), w = `M${h(0)},${f(l)} ${n.map((k, S) => `L${h(S).toFixed(1)},${f(k).toFixed(1)}`).join(" ")} L${h(r - 1)},${f(0)} L${h(0)},${f(0)} Z`;
3795
3832
  return /* @__PURE__ */ b("div", { className: "chart", children: [
3796
3833
  /* @__PURE__ */ b("svg", { viewBox: `0 0 ${s} ${u}`, role: "img", "aria-label": "Balance and cumulative interest over the term", children: [
@@ -3813,7 +3850,7 @@ function Lo({ result: e }) {
3813
3850
  ] })
3814
3851
  ] });
3815
3852
  }
3816
- const Uo = /* @__PURE__ */ new Set([
3853
+ const qo = /* @__PURE__ */ new Set([
3817
3854
  "sin",
3818
3855
  "cos",
3819
3856
  "tan",
@@ -3850,7 +3887,7 @@ const Uo = /* @__PURE__ */ new Set([
3850
3887
  "sq",
3851
3888
  "cube",
3852
3889
  "recip"
3853
- ]), Oo = {
3890
+ ]), Go = {
3854
3891
  arcsin: "asin",
3855
3892
  arccos: "acos",
3856
3893
  arctan: "atan",
@@ -3858,14 +3895,14 @@ const Uo = /* @__PURE__ */ new Set([
3858
3895
  log10: "log",
3859
3896
  ncr: "ncr",
3860
3897
  npr: "npr"
3861
- }, Bo = (e) => e === " " || e === " " || e === `
3862
- ` || e === "\r", fe = (e) => e >= "0" && e <= "9", en = (e) => e >= "a" && e <= "z" || e >= "A" && e <= "Z", zn = (e) => fe(e) || e >= "a" && e <= "f" || e >= "A" && e <= "F", tn = /* @__PURE__ */ new Set(["num", "const", "var", "func", "lparen", "uop"]), _o = /* @__PURE__ */ new Set(["num", "const", "var", "rparen", "postfix"]);
3863
- function Ho(e) {
3864
- return e === "HEX" ? zn : e === "OCT" ? (t) => t >= "0" && t <= "7" : e === "BIN" ? (t) => t === "0" || t === "1" : fe;
3865
- }
3866
- function qo(e) {
3867
- const t = e.toLowerCase(), n = Oo[t] ?? t;
3868
- if (Uo.has(n)) return { type: "func", value: n };
3898
+ }, jo = (e) => e === " " || e === " " || e === `
3899
+ ` || e === "\r", fe = (e) => e >= "0" && e <= "9", en = (e) => e >= "a" && e <= "z" || e >= "A" && e <= "Z", Zn = (e) => fe(e) || e >= "a" && e <= "f" || e >= "A" && e <= "F", tn = /* @__PURE__ */ new Set(["num", "const", "var", "func", "lparen", "uop"]), Vo = /* @__PURE__ */ new Set(["num", "const", "var", "rparen", "postfix"]);
3900
+ function Yo(e) {
3901
+ return e === "HEX" ? Zn : e === "OCT" ? (t) => t >= "0" && t <= "7" : e === "BIN" ? (t) => t === "0" || t === "1" : fe;
3902
+ }
3903
+ function Ko(e) {
3904
+ const t = e.toLowerCase(), n = Go[t] ?? t;
3905
+ if (qo.has(n)) return { type: "func", value: n };
3869
3906
  if (t === "mod") return { type: "op", value: "mod" };
3870
3907
  if (t === "and") return { type: "op", value: "and" };
3871
3908
  if (t === "or") return { type: "op", value: "or" };
@@ -3882,12 +3919,12 @@ function qo(e) {
3882
3919
  }
3883
3920
  throw new Error(`Unknown name: ${e}`);
3884
3921
  }
3885
- function Go(e, t = {}) {
3922
+ function Wo(e, t = {}) {
3886
3923
  const n = t.base ?? "DEC", a = e, r = [];
3887
3924
  let s = 0;
3888
3925
  for (; s < a.length; ) {
3889
3926
  const d = a[s];
3890
- if (Bo(d)) {
3927
+ if (jo(d)) {
3891
3928
  s++;
3892
3929
  continue;
3893
3930
  }
@@ -3895,14 +3932,14 @@ function Go(e, t = {}) {
3895
3932
  if (d === "0" && (a[s + 1] === "x" || a[s + 1] === "X" || a[s + 1] === "o" || a[s + 1] === "O" || a[s + 1] === "b" || a[s + 1] === "B")) {
3896
3933
  const l = a[s + 1].toLowerCase();
3897
3934
  let p = s + 2;
3898
- const h = l === "x" ? zn : l === "o" ? (y) => y >= "0" && y <= "7" : (y) => y === "0" || y === "1", f = p;
3935
+ const h = l === "x" ? Zn : l === "o" ? (y) => y >= "0" && y <= "7" : (y) => y === "0" || y === "1", f = p;
3899
3936
  for (; p < a.length && h(a[p]); ) p++;
3900
3937
  if (p === f) throw new Error(`Malformed 0${l} literal`);
3901
3938
  r.push({ type: "num", value: BigInt(`0${l}${a.slice(f, p)}`).toString() }), s = p;
3902
3939
  continue;
3903
3940
  }
3904
3941
  if (n !== "DEC") {
3905
- const l = Ho(n);
3942
+ const l = Yo(n);
3906
3943
  let p = s;
3907
3944
  for (; p < a.length && l(a[p]); ) p++;
3908
3945
  const h = a.slice(s, p), f = n === "HEX" ? "0x" : n === "OCT" ? "0o" : "0b";
@@ -3926,7 +3963,7 @@ function Go(e, t = {}) {
3926
3963
  if (en(d) || d === "_") {
3927
3964
  let c = s;
3928
3965
  for (; c < a.length && (en(a[c]) || fe(a[c]) || a[c] === "_"); ) c++;
3929
- r.push(qo(a.slice(s, c))), s = c;
3966
+ r.push(Ko(a.slice(s, c))), s = c;
3930
3967
  continue;
3931
3968
  }
3932
3969
  const i = a.slice(s, s + 2);
@@ -4006,11 +4043,11 @@ function Go(e, t = {}) {
4006
4043
  }), m = [];
4007
4044
  for (let d = 0; d < u.length; d++) {
4008
4045
  const i = u[d], c = m[m.length - 1];
4009
- c && _o.has(c.type) && tn.has(i.type) && m.push({ type: "op", value: "*", implicit: !0 }), m.push(i);
4046
+ c && Vo.has(c.type) && tn.has(i.type) && m.push({ type: "op", value: "*", implicit: !0 }), m.push(i);
4010
4047
  }
4011
4048
  return m;
4012
4049
  }
4013
- const jo = {
4050
+ const zo = {
4014
4051
  or: { prec: 1 },
4015
4052
  xor: { prec: 2 },
4016
4053
  and: { prec: 3 },
@@ -4024,7 +4061,7 @@ const jo = {
4024
4061
  "%": { prec: 6 },
4025
4062
  "^": { prec: 8, right: !0 }
4026
4063
  }, nn = { neg: 7, bnot: 7, sqrt: 10, cbrt: 10, qdrt: 10 }, De = Symbol("arg");
4027
- function Vo(e) {
4064
+ function Jo(e) {
4028
4065
  const t = [], n = [];
4029
4066
  let a = !0;
4030
4067
  const r = () => {
@@ -4075,7 +4112,7 @@ function Vo(e) {
4075
4112
  else if (d.value !== "+") throw new Error(`Unexpected operator: ${d.value}`);
4076
4113
  a = !0;
4077
4114
  } else {
4078
- const i = jo[d.value];
4115
+ const i = zo[d.value];
4079
4116
  if (!i) throw new Error(`Unknown operator: ${d.value}`);
4080
4117
  for (; n.length; ) {
4081
4118
  const c = n[n.length - 1];
@@ -4116,11 +4153,11 @@ function Vo(e) {
4116
4153
  if (m === De) throw new Error("Malformed expression");
4117
4154
  return m;
4118
4155
  }
4119
- const Yo = new H("3.141592653589793238462643383279502884197"), Ko = new H("2.718281828459045235360287471352662497757"), Wo = new H("1.618033988749894848204586834365638117720");
4120
- function bt(e, t) {
4156
+ const Zo = new H("3.141592653589793238462643383279502884197"), Xo = new H("2.718281828459045235360287471352662497757"), Qo = new H("1.618033988749894848204586834365638117720");
4157
+ function gt(e, t) {
4121
4158
  return t === "deg" ? e * Math.PI / 180 : t === "grad" ? e * Math.PI / 200 : e;
4122
4159
  }
4123
- function gt(e, t) {
4160
+ function vt(e, t) {
4124
4161
  return t === "deg" ? e * 180 / Math.PI : t === "grad" ? e * 200 / Math.PI : e;
4125
4162
  }
4126
4163
  function an(e) {
@@ -4130,13 +4167,13 @@ function an(e) {
4130
4167
  for (let n = 2; n <= e.toNumber(); n++) t = t.times(n);
4131
4168
  return t;
4132
4169
  }
4133
- function zo(e, t) {
4170
+ function ei(e, t) {
4134
4171
  if (!e.isInteger() || !t.isInteger() || t.isNegative() || t.gt(e)) throw new Error("nPr domain");
4135
4172
  let n = g(1);
4136
4173
  for (let a = 0; a < t.toNumber(); a++) n = n.times(e.minus(a));
4137
4174
  return n;
4138
4175
  }
4139
- function Jo(e, t) {
4176
+ function ti(e, t) {
4140
4177
  if (!e.isInteger() || !t.isInteger() || t.isNegative() || t.gt(e)) throw new Error("nCr domain");
4141
4178
  const n = H.min(t, e.minus(t));
4142
4179
  let a = g(1);
@@ -4151,7 +4188,7 @@ function rn(e, t) {
4151
4188
  }
4152
4189
  return n;
4153
4190
  }
4154
- function vt(e, t) {
4191
+ function kt(e, t) {
4155
4192
  if (e.isNegative()) {
4156
4193
  if (t.isInteger() && !t.mod(2).isZero()) return e.abs().pow(g(1).div(t)).neg();
4157
4194
  throw new Error("root of negative");
@@ -4159,7 +4196,7 @@ function vt(e, t) {
4159
4196
  return e.pow(g(1).div(t));
4160
4197
  }
4161
4198
  const ie = (e) => BigInt(e.trunc().toFixed(0));
4162
- function Zo(e, t = {}) {
4199
+ function ni(e, t = {}) {
4163
4200
  const n = t.angleMode ?? "deg", a = t.percentMode ?? "of", r = (i) => {
4164
4201
  var l;
4165
4202
  if (i === "ans") return g(t.ans ?? 0);
@@ -4171,22 +4208,22 @@ function Zo(e, t = {}) {
4171
4208
  let p;
4172
4209
  switch (i) {
4173
4210
  case "sin":
4174
- p = Math.sin(bt(l, n));
4211
+ p = Math.sin(gt(l, n));
4175
4212
  break;
4176
4213
  case "cos":
4177
- p = Math.cos(bt(l, n));
4214
+ p = Math.cos(gt(l, n));
4178
4215
  break;
4179
4216
  case "tan":
4180
- p = Math.tan(bt(l, n));
4217
+ p = Math.tan(gt(l, n));
4181
4218
  break;
4182
4219
  case "asin":
4183
- p = gt(Math.asin(l), n);
4220
+ p = vt(Math.asin(l), n);
4184
4221
  break;
4185
4222
  case "acos":
4186
- p = gt(Math.acos(l), n);
4223
+ p = vt(Math.acos(l), n);
4187
4224
  break;
4188
4225
  case "atan":
4189
- p = gt(Math.atan(l), n);
4226
+ p = vt(Math.atan(l), n);
4190
4227
  break;
4191
4228
  case "sinh":
4192
4229
  p = Math.sinh(l);
@@ -4220,11 +4257,11 @@ function Zo(e, t = {}) {
4220
4257
  case "sqrt":
4221
4258
  return p(1), l.sqrt();
4222
4259
  case "cbrt":
4223
- return p(1), vt(l, g(3));
4260
+ return p(1), kt(l, g(3));
4224
4261
  case "qdrt":
4225
- return p(1), vt(l, g(4));
4262
+ return p(1), kt(l, g(4));
4226
4263
  case "root":
4227
- return p(2), vt(l, c[1]);
4264
+ return p(2), kt(l, c[1]);
4228
4265
  case "pow":
4229
4266
  return p(2), l.pow(c[1]);
4230
4267
  case "ln":
@@ -4241,9 +4278,9 @@ function Zo(e, t = {}) {
4241
4278
  case "tenpow":
4242
4279
  return p(1), g(10).pow(l);
4243
4280
  case "ncr":
4244
- return p(2), Jo(l, c[1]);
4281
+ return p(2), ti(l, c[1]);
4245
4282
  case "npr":
4246
- return p(2), zo(l, c[1]);
4283
+ return p(2), ei(l, c[1]);
4247
4284
  case "gcd":
4248
4285
  return p(2), rn(l, c[1]);
4249
4286
  case "lcm":
@@ -4309,7 +4346,7 @@ function Zo(e, t = {}) {
4309
4346
  case "num":
4310
4347
  return g(i.value);
4311
4348
  case "const":
4312
- return i.name === "PI" ? Yo : i.name === "E" ? Ko : Wo;
4349
+ return i.name === "PI" ? Zo : i.name === "E" ? Xo : Qo;
4313
4350
  case "var":
4314
4351
  return r(i.name);
4315
4352
  case "percent":
@@ -4336,7 +4373,7 @@ function Zo(e, t = {}) {
4336
4373
  function on(e, t = {}) {
4337
4374
  if (e == null || e.trim() === "") return { value: new H(0) };
4338
4375
  try {
4339
- const n = Go(e, { base: t.base }), a = Vo(n), r = Zo(a, t);
4376
+ const n = Wo(e, { base: t.base }), a = Jo(n), r = ni(a, t);
4340
4377
  return r.isNaN() ? { value: r, error: "Not a number" } : { value: r };
4341
4378
  } catch (n) {
4342
4379
  return { value: new H(NaN), error: n instanceof Error ? n.message : String(n) };
@@ -4351,8 +4388,8 @@ function sn(e, t) {
4351
4388
  }
4352
4389
  return e.toSignificantDigits(12).toString();
4353
4390
  }
4354
- function Jn({ def: e }) {
4355
- const { settings: t } = ue(), n = t.percentMode ?? "of", [a, r] = M(""), [s, u] = M("deg"), [m, d] = M("DEC"), [i, c] = M(!1), [l, p] = M(() => new H(0)), [h, f] = M(() => new H(0)), [y, w] = M([]), k = de(null), S = ne(
4391
+ function Xn({ def: e }) {
4392
+ const { settings: t } = ue(), n = t.percentMode ?? "of", [a, r] = M(""), [s, u] = M("deg"), [m, d] = M("DEC"), [i, c] = M(!1), [l, p] = M(() => new H(0)), [h, f] = M(() => new H(0)), [y, w] = M([]), k = de(null), S = X(
4356
4393
  () => on(a, { angleMode: s, percentMode: n, base: m, ans: h, memory: l }),
4357
4394
  [a, s, n, m, h, l]
4358
4395
  ), F = a.trim() ? S.error ? "" : sn(S.value, m) : "", N = (I) => requestAnimationFrame(() => {
@@ -4499,15 +4536,15 @@ function Jn({ def: e }) {
4499
4536
  ] }),
4500
4537
  /* @__PURE__ */ b("div", { className: "sci-pad", role: "group", "aria-label": "calculator keypad", children: [
4501
4538
  G.map((I, R) => /* @__PURE__ */ o("div", { className: "sci-row", children: I.map((j, Y) => {
4502
- const V = i && j.alt ? j.alt : j, Q = j.t === "2nd";
4539
+ const V = i && j.alt ? j.alt : j, ee = j.t === "2nd";
4503
4540
  return /* @__PURE__ */ o(
4504
4541
  "button",
4505
4542
  {
4506
4543
  type: "button",
4507
4544
  className: `sci-key ${V.cls ?? "fn"}`,
4508
4545
  "aria-label": V.aria,
4509
- "aria-pressed": Q ? i : void 0,
4510
- onClick: () => Q ? c((Ee) => !Ee) : B(V),
4546
+ "aria-pressed": ee ? i : void 0,
4547
+ onClick: () => ee ? c((Ee) => !Ee) : B(V),
4511
4548
  children: V.t
4512
4549
  },
4513
4550
  Y
@@ -4540,7 +4577,7 @@ function Jn({ def: e }) {
4540
4577
  ] })
4541
4578
  ] });
4542
4579
  }
4543
- const nt = [
4580
+ const rt = [
4544
4581
  { code: "USD", name: "US Dollar", symbol: "$" },
4545
4582
  { code: "EUR", name: "Euro", symbol: "€" },
4546
4583
  { code: "GBP", name: "British Pound", symbol: "£" },
@@ -4585,28 +4622,28 @@ const nt = [
4585
4622
  { code: "BDT", name: "Bangladeshi Taka", symbol: "৳" },
4586
4623
  { code: "LKR", name: "Sri Lankan Rupee", symbol: "Rs" },
4587
4624
  { code: "NPR", name: "Nepalese Rupee", symbol: "रू" }
4588
- ], Xo = (e) => nt.find((t) => t.code === e), Qo = (e) => e === "INR" ? "en-IN" : "en-US", Zn = (e, t) => g(e).times(t), Xn = (e) => {
4625
+ ], ai = (e) => rt.find((t) => t.code === e), ri = (e) => e === "INR" ? "en-IN" : "en-US", Qn = (e, t) => g(e).times(t), ea = (e) => {
4589
4626
  const t = g(e);
4590
4627
  return t.gt(0) ? g(1).div(t) : g(0);
4591
4628
  };
4592
4629
  function Mt(e, t) {
4593
4630
  const n = g(e);
4594
4631
  try {
4595
- return new Intl.NumberFormat(Qo(t), { style: "currency", currency: t }).format(
4632
+ return new Intl.NumberFormat(ri(t), { style: "currency", currency: t }).format(
4596
4633
  Number(n.toFixed(4))
4597
4634
  );
4598
4635
  } catch {
4599
4636
  return `${new Intl.NumberFormat("en-US", { maximumFractionDigits: 4 }).format(Number(n.toFixed(4)))} ${t}`;
4600
4637
  }
4601
4638
  }
4602
- function Qn(e) {
4639
+ function ta(e) {
4603
4640
  try {
4604
4641
  return new Intl.NumberFormat("en-US", { style: "currency", currency: e }).resolvedOptions().maximumFractionDigits ?? 2;
4605
4642
  } catch {
4606
4643
  return 2;
4607
4644
  }
4608
4645
  }
4609
- function Je(e, t) {
4646
+ function Xe(e, t) {
4610
4647
  const n = Math.max(0, Math.floor((t - e) / 1e3));
4611
4648
  if (n < 60) return "just now";
4612
4649
  const a = Math.floor(n / 60);
@@ -4618,23 +4655,23 @@ function Je(e, t) {
4618
4655
  const u = Math.floor(s / 30);
4619
4656
  return `${u} month${u === 1 ? "" : "s"} ago`;
4620
4657
  }
4621
- const ea = (e, t) => t - e > 864e5, fs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4658
+ const na = (e, t) => t - e > 864e5, gs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4622
4659
  __proto__: null,
4623
- CURRENCIES: nt,
4624
- convert: Zn,
4625
- currencyByCode: Xo,
4626
- currencyDecimals: Qn,
4660
+ CURRENCIES: rt,
4661
+ convert: Qn,
4662
+ currencyByCode: ai,
4663
+ currencyDecimals: ta,
4627
4664
  formatCurrency: Mt,
4628
- inverseRate: Xn,
4629
- isStale: ea,
4630
- stalenessLabel: Je
4631
- }, Symbol.toStringTag, { value: "Module" })), ei = (e) => `https://open.er-api.com/v6/latest/${encodeURIComponent(e)}`;
4632
- async function ti(e, t, n = {}) {
4665
+ inverseRate: ea,
4666
+ isStale: na,
4667
+ stalenessLabel: Xe
4668
+ }, Symbol.toStringTag, { value: "Module" })), oi = (e) => `https://open.er-api.com/v6/latest/${encodeURIComponent(e)}`;
4669
+ async function ii(e, t, n = {}) {
4633
4670
  var m;
4634
4671
  if (e === t) return { rate: "1", asOf: "", provider: "identity" };
4635
4672
  const a = n.fetchImpl ?? (typeof fetch < "u" ? fetch : void 0);
4636
4673
  if (!a) throw new Error("No fetch available in this environment");
4637
- const r = await a(ei(e), { signal: n.signal });
4674
+ const r = await a(oi(e), { signal: n.signal });
4638
4675
  if (!r.ok) throw new Error(`Rate service returned HTTP ${r.status}`);
4639
4676
  const s = await r.json();
4640
4677
  if (s != null && s.result && s.result !== "success") throw new Error(s["error-type"] || "Rate service error");
@@ -4646,35 +4683,35 @@ function ln(e, t) {
4646
4683
  const n = Date.parse(e);
4647
4684
  return Number.isFinite(n) ? n : t;
4648
4685
  }
4649
- const ta = "calcsuite:fxrates", na = "calcsuite:fxmode", kt = () => {
4686
+ const aa = "calcsuite:fxrates", ra = "calcsuite:fxmode", wt = () => {
4650
4687
  try {
4651
- return JSON.parse(localStorage.getItem(ta) || "{}");
4688
+ return JSON.parse(localStorage.getItem(aa) || "{}");
4652
4689
  } catch {
4653
4690
  return {};
4654
4691
  }
4655
- }, ni = (e) => {
4692
+ }, si = (e) => {
4656
4693
  try {
4657
- localStorage.setItem(ta, JSON.stringify(e));
4694
+ localStorage.setItem(aa, JSON.stringify(e));
4658
4695
  } catch {
4659
4696
  }
4660
- }, ai = () => {
4697
+ }, li = () => {
4661
4698
  try {
4662
- return localStorage.getItem(na) === "offline" ? "offline" : "online";
4699
+ return localStorage.getItem(ra) === "offline" ? "offline" : "online";
4663
4700
  } catch {
4664
4701
  return "online";
4665
4702
  }
4666
- }, Ke = (e, t) => `${e}_${t}`;
4667
- function aa() {
4703
+ }, We = (e, t) => `${e}_${t}`;
4704
+ function oa() {
4668
4705
  var _t;
4669
- const [e, t] = M("USD"), [n, a] = M("INR"), [r, s] = M(""), [u, m] = M(""), [d, i] = M("none"), [c, l] = M(""), [p, h] = M("idle"), [f, y] = M(""), [w, k] = M(() => ai()), [S, F] = M(() => kt()), [N, P] = M(() => Date.now()), x = de(null);
4670
- X(() => {
4706
+ const [e, t] = M("USD"), [n, a] = M("INR"), [r, s] = M(""), [u, m] = M(""), [d, i] = M("none"), [c, l] = M(""), [p, h] = M("idle"), [f, y] = M(""), [w, k] = M(() => li()), [S, F] = M(() => wt()), [N, P] = M(() => Date.now()), x = de(null);
4707
+ Q(() => {
4671
4708
  const O = setInterval(() => P(Date.now()), 3e4);
4672
4709
  return () => clearInterval(O);
4673
4710
  }, []);
4674
4711
  const T = (O, Z) => {
4675
4712
  F((ae) => {
4676
- const oe = { ...ae, [Ke(e, n)]: { rate: O, at: Z } };
4677
- return ni(oe), oe;
4713
+ const oe = { ...ae, [We(e, n)]: { rate: O, at: Z } };
4714
+ return si(oe), oe;
4678
4715
  });
4679
4716
  }, $ = (O, Z) => {
4680
4717
  var oe;
@@ -4684,11 +4721,11 @@ function aa() {
4684
4721
  m("1"), i("live"), l(""), h("idle");
4685
4722
  return;
4686
4723
  }
4687
- h("loading"), y(""), ti(O, Z, { signal: ae.signal }).then((xe) => {
4724
+ h("loading"), y(""), ii(O, Z, { signal: ae.signal }).then((xe) => {
4688
4725
  ae.signal.aborted || (m(xe.rate), i("live"), l(xe.asOf), h("idle"), T(xe.rate, ln(xe.asOf, Date.now())));
4689
4726
  }).catch((xe) => {
4690
4727
  if (ae.signal.aborted) return;
4691
- const Ht = kt()[Ke(O, Z)];
4728
+ const Ht = wt()[We(O, Z)];
4692
4729
  Ht ? (m(Ht.rate), i("saved"), h("error"), y("Offline — showing your last saved rate. Refresh when back online.")) : (i("none"), h("error"), y(`Couldn’t fetch a live rate (${xe instanceof Error ? xe.message : "offline"}). Enter one manually.`));
4693
4730
  });
4694
4731
  }, L = (O, Z) => {
@@ -4697,31 +4734,31 @@ function aa() {
4697
4734
  m("1"), i("saved");
4698
4735
  return;
4699
4736
  }
4700
- const ae = kt()[Ke(O, Z)];
4737
+ const ae = wt()[We(O, Z)];
4701
4738
  ae ? (m(ae.rate), i("saved")) : (m(""), i("none"));
4702
4739
  };
4703
- X(() => (w === "online" ? $(e, n) : L(e, n), () => {
4740
+ Q(() => (w === "online" ? $(e, n) : L(e, n), () => {
4704
4741
  var O;
4705
4742
  return (O = x.current) == null ? void 0 : O.abort();
4706
4743
  }), [e, n, w]);
4707
4744
  const B = (O) => {
4708
4745
  k(O);
4709
4746
  try {
4710
- localStorage.setItem(na, O);
4747
+ localStorage.setItem(ra, O);
4711
4748
  } catch {
4712
4749
  }
4713
- }, G = (O) => O.replace(/[, ]/g, "").trim(), q = G(r), A = G(u), I = q !== "" && Number(q) >= 0 && Number.isFinite(Number(q)), R = A !== "" && Number(A) > 0 && Number.isFinite(Number(A)), j = ne(
4714
- () => I && R ? Zn(q, A) : null,
4750
+ }, G = (O) => O.replace(/[, ]/g, "").trim(), q = G(r), A = G(u), I = q !== "" && Number(q) >= 0 && Number.isFinite(Number(q)), R = A !== "" && Number(A) > 0 && Number.isFinite(Number(A)), j = X(
4751
+ () => I && R ? Qn(q, A) : null,
4715
4752
  [I, R, q, A]
4716
- ), Y = R ? Xn(A) : null, V = (O) => {
4753
+ ), Y = R ? ea(A) : null, V = (O) => {
4717
4754
  m(O), i("manual"), h("idle"), y(""), (R || O.trim() !== "") && T(G(O), Date.now());
4718
- }, Q = () => {
4755
+ }, ee = () => {
4719
4756
  t(n), a(e);
4720
- }, Ee = c ? Je(ln(c, N), N) : "just now", K = (_t = S[Ke(e, n)]) == null ? void 0 : _t.at, pe = (O) => /* @__PURE__ */ b("option", { value: O.code, children: [
4757
+ }, Ee = c ? Xe(ln(c, N), N) : "just now", K = (_t = S[We(e, n)]) == null ? void 0 : _t.at, pe = (O) => /* @__PURE__ */ b("option", { value: O.code, children: [
4721
4758
  O.code,
4722
4759
  " — ",
4723
4760
  O.name
4724
- ] }, O.code), Me = Object.entries(S).sort((O, Z) => Z[1].at - O[1].at), Ge = () => p === "error" ? /* @__PURE__ */ b("span", { children: [
4761
+ ] }, O.code), Me = Object.entries(S).sort((O, Z) => Z[1].at - O[1].at), je = () => p === "error" ? /* @__PURE__ */ b("span", { children: [
4725
4762
  "⚠ ",
4726
4763
  f
4727
4764
  ] }) : d === "manual" ? /* @__PURE__ */ o("span", { children: "Manual rate (you entered this)" }) : w === "online" ? p === "loading" ? /* @__PURE__ */ o("span", { children: "Fetching live rate…" }) : d === "live" ? /* @__PURE__ */ b("span", { children: [
@@ -4731,7 +4768,7 @@ function aa() {
4731
4768
  " · open.er-api.com"
4732
4769
  ] }) : null : d === "saved" && K ? /* @__PURE__ */ b("span", { children: [
4733
4770
  "✈ Offline · saved rate ",
4734
- Je(K, N)
4771
+ Xe(K, N)
4735
4772
  ] }) : /* @__PURE__ */ o("span", { children: "✈ Offline · enter a rate manually" });
4736
4773
  return /* @__PURE__ */ b("div", { "data-part": "calculator", "data-calculator": "tools.currency", children: [
4737
4774
  /* @__PURE__ */ b("section", { className: "card", children: [
@@ -4756,12 +4793,12 @@ function aa() {
4756
4793
  ] }),
4757
4794
  /* @__PURE__ */ b("label", { className: "field cc-cur", children: [
4758
4795
  /* @__PURE__ */ o("span", { className: "lbl", children: "From" }),
4759
- /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: e, onChange: (O) => t(O.target.value), "aria-label": "From currency", children: nt.map(pe) }) })
4796
+ /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: e, onChange: (O) => t(O.target.value), "aria-label": "From currency", children: rt.map(pe) }) })
4760
4797
  ] }),
4761
- /* @__PURE__ */ o("button", { type: "button", className: "cc-swap", onClick: Q, "aria-label": "Swap currencies", title: "Swap", children: "⇄" }),
4798
+ /* @__PURE__ */ o("button", { type: "button", className: "cc-swap", onClick: ee, "aria-label": "Swap currencies", title: "Swap", children: "⇄" }),
4762
4799
  /* @__PURE__ */ b("label", { className: "field cc-cur", children: [
4763
4800
  /* @__PURE__ */ o("span", { className: "lbl", children: "To" }),
4764
- /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: n, onChange: (O) => a(O.target.value), "aria-label": "To currency", children: nt.map(pe) }) })
4801
+ /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: n, onChange: (O) => a(O.target.value), "aria-label": "To currency", children: rt.map(pe) }) })
4765
4802
  ] })
4766
4803
  ] }),
4767
4804
  /* @__PURE__ */ b("label", { className: "field", style: { marginTop: 16 }, children: [
@@ -4795,7 +4832,7 @@ function aa() {
4795
4832
  }
4796
4833
  )
4797
4834
  ] }),
4798
- /* @__PURE__ */ o("div", { className: `cc-status ${p === "error" ? "cc-stale" : ""}`, "aria-live": "polite", children: Ge() }),
4835
+ /* @__PURE__ */ o("div", { className: `cc-status ${p === "error" ? "cc-stale" : ""}`, "aria-live": "polite", children: je() }),
4799
4836
  e === n && /* @__PURE__ */ o("div", { className: "notice", children: "“From” and “To” are the same currency — the rate is 1." })
4800
4837
  ] })
4801
4838
  ] }),
@@ -4832,7 +4869,7 @@ function aa() {
4832
4869
  /* @__PURE__ */ b("div", { className: "kv", children: [
4833
4870
  /* @__PURE__ */ o("div", { className: "k", children: "Precision" }),
4834
4871
  /* @__PURE__ */ b("div", { className: "v num", children: [
4835
- Qn(n),
4872
+ ta(n),
4836
4873
  " dp · ",
4837
4874
  n
4838
4875
  ] })
@@ -4865,7 +4902,7 @@ function aa() {
4865
4902
  oe
4866
4903
  ] }),
4867
4904
  /* @__PURE__ */ o("span", { className: "num", children: Z.rate }),
4868
- /* @__PURE__ */ o("span", { className: `cc-book-when ${ea(Z.at, N) ? "cc-stale" : ""}`, children: Je(Z.at, N) })
4905
+ /* @__PURE__ */ o("span", { className: `cc-book-when ${na(Z.at, N) ? "cc-stale" : ""}`, children: Xe(Z.at, N) })
4869
4906
  ]
4870
4907
  }
4871
4908
  ) }, O);
@@ -4873,23 +4910,23 @@ function aa() {
4873
4910
  ] })
4874
4911
  ] });
4875
4912
  }
4876
- const ri = {
4913
+ const ci = {
4877
4914
  id: "",
4878
4915
  group: "tools",
4879
4916
  title: "",
4880
4917
  inputs: [],
4881
4918
  compute: () => ({ primary: { label: "", value: "" } })
4882
- }, oi = {
4883
- "loan.emi": Wn,
4884
- scientific: Jn,
4885
- currency: aa
4919
+ }, ui = {
4920
+ "loan.emi": Jn,
4921
+ scientific: Xn,
4922
+ currency: oa
4886
4923
  };
4887
4924
  function cn(e, t) {
4888
4925
  const n = {};
4889
4926
  for (const a of e.inputs) a.default !== void 0 && (n[a.key] = a.default);
4890
4927
  return t ? { ...n, ...t } : n;
4891
4928
  }
4892
- function ii({
4929
+ function di({
4893
4930
  def: e,
4894
4931
  id: t,
4895
4932
  seed: n,
@@ -4898,9 +4935,9 @@ function ii({
4898
4935
  actions: s
4899
4936
  }) {
4900
4937
  var L, B, G, q;
4901
- const u = e ?? (t ? Rt(t) : void 0), m = u ?? ri, d = { ...oi, ...a }, { settings: i, fmt: c } = ue(), [l, p] = M(() => cn(m, n)), [h, f] = M("schedule"), [y, w] = M(!1);
4902
- X(() => p(cn(m, n)), [m.id, n]);
4903
- const k = i.region, S = (A, I) => p((R) => ({ ...R, [A]: I })), F = m.inputs.filter((A) => A.showIf ? A.showIf(l, k) : !0), N = F.filter((A) => !A.advanced), P = F.filter((A) => A.advanced), { result: x, error: T } = ne(() => {
4938
+ const u = e ?? (t ? Rt(t) : void 0), m = u ?? ci, d = { ...ui, ...a }, { settings: i, fmt: c } = ue(), [l, p] = M(() => cn(m, n)), [h, f] = M("schedule"), [y, w] = M(!1);
4939
+ Q(() => p(cn(m, n)), [m.id, n]);
4940
+ const k = i.region, S = (A, I) => p((R) => ({ ...R, [A]: I })), F = m.inputs.filter((A) => A.showIf ? A.showIf(l, k) : !0), N = F.filter((A) => !A.advanced), P = F.filter((A) => A.advanced), { result: x, error: T } = X(() => {
4904
4941
  const A = { settings: i, region: k, fmt: c, D: g };
4905
4942
  try {
4906
4943
  return { result: m.compute(l, A), error: null };
@@ -4908,7 +4945,7 @@ function ii({
4908
4945
  return { result: null, error: I instanceof Error ? I.message : "Could not calculate." };
4909
4946
  }
4910
4947
  }, [m, l, i, k, c]);
4911
- if (X(() => r == null ? void 0 : r(x, l), [x]), !u)
4948
+ if (Q(() => r == null ? void 0 : r(x, l), [x]), !u)
4912
4949
  return /* @__PURE__ */ b("div", { className: "error", role: "alert", children: [
4913
4950
  "Unknown calculator",
4914
4951
  t ? `: ${t}` : "",
@@ -4936,7 +4973,7 @@ function ii({
4936
4973
  T && /* @__PURE__ */ o("div", { className: "error", role: "alert", style: { marginTop: 16 }, children: T })
4937
4974
  ] }),
4938
4975
  x && !T && /* @__PURE__ */ b("section", { className: "card", children: [
4939
- /* @__PURE__ */ o(Qr, { view: x }),
4976
+ /* @__PURE__ */ o(ro, { view: x }),
4940
4977
  (B = x.warnings) == null ? void 0 : B.map((A, I) => /* @__PURE__ */ o("div", { className: "notice", children: A }, I)),
4941
4978
  s && /* @__PURE__ */ o("div", { className: "actions-row", children: s(x, l) }),
4942
4979
  $ && /* @__PURE__ */ b(re, { children: [
@@ -4947,8 +4984,8 @@ function ii({
4947
4984
  (((G = x.notes) == null ? void 0 : G.length) ?? 0) > 0 && i.ui.showAssumptions && /* @__PURE__ */ o("button", { role: "tab", "aria-selected": h === "assumptions", onClick: () => f("assumptions"), children: "Assumptions" })
4948
4985
  ] }),
4949
4986
  /* @__PURE__ */ b("div", { className: "tab-anim", children: [
4950
- h === "schedule" && x.schedule && /* @__PURE__ */ o(no, { schedule: x.schedule }),
4951
- h === "chart" && x.chart && /* @__PURE__ */ o(ao, { chart: x.chart }),
4987
+ h === "schedule" && x.schedule && /* @__PURE__ */ o(so, { schedule: x.schedule }),
4988
+ h === "chart" && x.chart && /* @__PURE__ */ o(lo, { chart: x.chart }),
4952
4989
  h === "formula" && x.formula && i.ui.showFormulas && /* @__PURE__ */ b("div", { className: "formula", children: [
4953
4990
  /* @__PURE__ */ o("code", { children: x.formula }),
4954
4991
  x.formulaSubstituted && /* @__PURE__ */ o("code", { style: { marginTop: 8 }, children: x.formulaSubstituted })
@@ -4971,21 +5008,8 @@ function un({ def: e, region: t }) {
4971
5008
  }
4972
5009
  function dn({ f: e, values: t, set: n }) {
4973
5010
  const a = e.kind === "cashflows" || e.kind === "segmented" ? "span2" : "";
4974
- return /* @__PURE__ */ o("div", { className: a, children: /* @__PURE__ */ o(Jr, { f: e, value: t[e.key], onChange: (r) => n(e.key, r), values: t }) });
5011
+ return /* @__PURE__ */ o("div", { className: a, children: /* @__PURE__ */ o(to, { f: e, value: t[e.key], onChange: (r) => n(e.key, r), values: t }) });
4975
5012
  }
4976
- const si = [
4977
- { id: "default", label: "Green", main: "#00A76F", light: "#2CCF8E", dark: "#087055", ink: "#06251A" },
4978
- { id: "cyan", label: "Cyan", main: "#078DEE", light: "#68CDF9", dark: "#0351AB", ink: "#FFFFFF" },
4979
- { id: "purple", label: "Purple", main: "#7635DC", light: "#B985F4", dark: "#431A9E", ink: "#FFFFFF" },
4980
- { id: "blue", label: "Blue", main: "#2065D1", light: "#76B0F1", dark: "#103996", ink: "#FFFFFF" },
4981
- { id: "orange", label: "Orange", main: "#FDA92D", light: "#FED680", dark: "#B66816", ink: "#212B36" },
4982
- { id: "gray", label: "Gray", main: "#A4AAB3", light: "#CED1D7", dark: "#63686C", ink: "#FFFFFF" }
4983
- ], wt = "-apple-system, 'Segoe UI', system-ui, sans-serif", li = [
4984
- { id: "Inter Tight", label: "Inter Tight", stack: `'Inter Tight', ${wt}` },
4985
- { id: "Public Sans", label: "Public Sans", stack: `'Public Sans', ${wt}` },
4986
- { id: "system-ui", label: "System UI", stack: `system-ui, ${wt}` },
4987
- { id: "Georgia", label: "Georgia (serif)", stack: "Georgia, 'Times New Roman', serif" }
4988
- ];
4989
5013
  class z extends Error {
4990
5014
  constructor(n, a = { code: "transport_error" }) {
4991
5015
  super(n);
@@ -4996,17 +5020,17 @@ class z extends Error {
4996
5020
  this.name = "TransportError", this.code = a.code, this.status = a.status ?? 0, this.request = a.request;
4997
5021
  }
4998
5022
  }
4999
- const ci = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"], ui = {
5023
+ const mi = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"], pi = {
5000
5024
  attempts: 3,
5001
5025
  backoff: "exponential",
5002
5026
  baseDelayMs: 300,
5003
5027
  retryOn: [408, 429, 500, 502, 503, 504],
5004
5028
  respectRetryAfter: !0
5005
- }, di = {
5029
+ }, hi = {
5006
5030
  enabled: !0,
5007
5031
  headerName: "Idempotency-Key",
5008
5032
  keyFrom: "inputsHash"
5009
- }, mi = {
5033
+ }, fi = {
5010
5034
  enabled: !0,
5011
5035
  storage: "memory",
5012
5036
  maxItems: 200,
@@ -5018,7 +5042,7 @@ const ci = ["authorization", "cookie", "x-api-key", "x-auth-token", "api-key"],
5018
5042
  return !1;
5019
5043
  }
5020
5044
  };
5021
- function ra() {
5045
+ function ia() {
5022
5046
  const e = globalThis.crypto;
5023
5047
  return e != null && e.randomUUID ? e.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
5024
5048
  const n = Math.random() * 16 | 0;
@@ -5026,21 +5050,21 @@ function ra() {
5026
5050
  });
5027
5051
  }
5028
5052
  const pn = (e) => new Promise((t) => setTimeout(t, Math.max(0, e)));
5029
- function pi(e) {
5053
+ function yi(e) {
5030
5054
  let t = String(e).replace(/[\\/]+/g, "-").replace(/[\x00-\x1f\x7f]+/g, "").replace(/[<>:"|?*]+/g, "").replace(/^\.+/, "");
5031
5055
  return t = t.trim(), t || "file";
5032
5056
  }
5033
- function oa(e, t) {
5057
+ function sa(e, t) {
5034
5058
  var m;
5035
5059
  const n = /* @__PURE__ */ new Date(), a = (d) => String(d).padStart(2, "0"), r = (((m = t.filename) == null ? void 0 : m.split(".").pop()) || t.kind || "bin").toLowerCase(), s = (t.inputsHash || "").replace(/^sha256:/, "").slice(0, 8) || "00000000", u = e.replace(/\{calculator\}/g, t.calculator || "calc").replace(/\{yyyy\}/g, String(n.getFullYear())).replace(/\{MM\}/g, a(n.getMonth() + 1)).replace(/\{dd\}/g, a(n.getDate())).replace(/\{hash8\}/g, s).replace(/\{ext\}/g, r).replace(/\{kind\}/g, t.kind || "file");
5036
- return pi(u);
5060
+ return yi(u);
5037
5061
  }
5038
5062
  function $t(e, t = []) {
5039
- const n = /* @__PURE__ */ new Set([...ci, ...t.map((r) => r.toLowerCase())]), a = {};
5063
+ const n = /* @__PURE__ */ new Set([...mi, ...t.map((r) => r.toLowerCase())]), a = {};
5040
5064
  for (const [r, s] of Object.entries(e)) a[r] = n.has(r.toLowerCase()) ? "***" : s;
5041
5065
  return a;
5042
5066
  }
5043
- class hi {
5067
+ class bi {
5044
5068
  constructor(t, n) {
5045
5069
  ge(this, "items", []);
5046
5070
  ge(this, "key");
@@ -5068,7 +5092,7 @@ class hi {
5068
5092
  return this.items.length;
5069
5093
  }
5070
5094
  enqueue(t) {
5071
- const n = { ...t, id: ra(), createdAt: (/* @__PURE__ */ new Date()).toISOString(), retryCount: 0 };
5095
+ const n = { ...t, id: ia(), createdAt: (/* @__PURE__ */ new Date()).toISOString(), retryCount: 0 };
5072
5096
  for (this.items.push(n); this.items.length > this.cfg.maxItems; ) this.items.shift();
5073
5097
  return this.save(), n;
5074
5098
  }
@@ -5090,12 +5114,12 @@ class hi {
5090
5114
  }
5091
5115
  }
5092
5116
  const hn = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
5093
- function fi(e) {
5094
- const t = e.fetch ?? globalThis.fetch, n = { ...ui, ...e.retry }, a = { ...di, ...e.idempotency }, r = { ...mi, ...e.offlineQueue }, s = e.timeoutMs ?? 15e3, u = e.credentials ?? "same-origin", m = new hi(r, "calcsuite");
5117
+ function gi(e) {
5118
+ const t = e.fetch ?? globalThis.fetch, n = { ...pi, ...e.retry }, a = { ...hi, ...e.idempotency }, r = { ...fi, ...e.offlineQueue }, s = e.timeoutMs ?? 15e3, u = e.credentials ?? "same-origin", m = new bi(r, "calcsuite");
5095
5119
  function d(N, P) {
5096
5120
  const x = e.endpoints[N];
5097
5121
  if (!x) throw new z(`Endpoint "${N}" is not configured`, { code: "no_endpoint" });
5098
- let T = /^https?:\/\//i.test(x) ? x : yi(e.baseUrl, x);
5122
+ let T = /^https?:\/\//i.test(x) ? x : vi(e.baseUrl, x);
5099
5123
  return P != null && (T = T.replace(/:id\b/, encodeURIComponent(P))), T;
5100
5124
  }
5101
5125
  function i() {
@@ -5110,10 +5134,10 @@ function fi(e) {
5110
5134
  if (!a.enabled || x) return x;
5111
5135
  if (hn.has(fn(N))) {
5112
5136
  if (a.keyFrom === "inputsHash") {
5113
- const T = gi(P);
5137
+ const T = wi(P);
5114
5138
  if (T) return T;
5115
5139
  }
5116
- return ra();
5140
+ return ia();
5117
5141
  }
5118
5142
  }
5119
5143
  async function p(N, P, x) {
@@ -5140,7 +5164,7 @@ function fi(e) {
5140
5164
  }
5141
5165
  async function f(N, P = {}) {
5142
5166
  var B, G, q, A;
5143
- const x = fn(N), T = bi(d(N, P.pathParam), P.query), $ = l(N, P.body, P.idempotencyKey);
5167
+ const x = fn(N), T = ki(d(N, P.pathParam), P.query), $ = l(N, P.body, P.idempotencyKey);
5144
5168
  let L;
5145
5169
  for (let I = 1; I <= Math.max(1, n.attempts); I++) {
5146
5170
  const R = await c(), j = {
@@ -5152,8 +5176,8 @@ function fi(e) {
5152
5176
  $ && (j[a.headerName] = $);
5153
5177
  const Y = $t(j, R.keys);
5154
5178
  let V = P.body;
5155
- const Q = { endpoint: String(N), method: x, url: T, headers: Y, body: V, attempt: I };
5156
- e.transformRequest && V !== void 0 && (V = e.transformRequest(V, Q)), (B = e.onRequest) == null || B.call(e, Q);
5179
+ const ee = { endpoint: String(N), method: x, url: T, headers: Y, body: V, attempt: I };
5180
+ e.transformRequest && V !== void 0 && (V = e.transformRequest(V, ee)), (B = e.onRequest) == null || B.call(e, ee);
5157
5181
  const Ee = yn();
5158
5182
  try {
5159
5183
  const K = await p(
@@ -5170,22 +5194,22 @@ function fi(e) {
5170
5194
  await pn(h(I, K));
5171
5195
  continue;
5172
5196
  }
5173
- const pe = await ia(K), Me = {
5174
- ...Q,
5197
+ const pe = await la(K), Me = {
5198
+ ...ee,
5175
5199
  status: K.status,
5176
5200
  ok: K.ok,
5177
5201
  durationMs: yn() - Ee,
5178
5202
  data: pe
5179
5203
  };
5180
5204
  if ((G = e.onResponse) == null || G.call(e, Me), !K.ok) {
5181
- const Ge = new z(`Request failed with ${K.status}`, {
5205
+ const je = new z(`Request failed with ${K.status}`, {
5182
5206
  code: "http_error",
5183
5207
  status: K.status,
5184
- request: Q
5208
+ request: ee
5185
5209
  });
5186
- throw (q = e.onError) == null || q.call(e, Ge, Q), Ge;
5210
+ throw (q = e.onError) == null || q.call(e, je, ee), je;
5187
5211
  }
5188
- return e.transformResponse ? e.transformResponse(pe, Q) : pe;
5212
+ return e.transformResponse ? e.transformResponse(pe, ee) : pe;
5189
5213
  } catch (K) {
5190
5214
  if (L = K, K instanceof z && K.code === "http_error") throw K;
5191
5215
  if (I < n.attempts) {
@@ -5201,16 +5225,16 @@ function fi(e) {
5201
5225
  headers: { ...P.headers ?? {} }
5202
5226
  // never the auth headers
5203
5227
  }).id };
5204
- const pe = K instanceof z ? K : new z("Network request failed", { code: "network_error", request: Q });
5205
- throw (A = e.onError) == null || A.call(e, pe, Q), pe;
5228
+ const pe = K instanceof z ? K : new z("Network request failed", { code: "network_error", request: ee });
5229
+ throw (A = e.onError) == null || A.call(e, pe, ee), pe;
5206
5230
  }
5207
5231
  }
5208
5232
  throw L instanceof Error ? L : new z("Request failed", { code: "transport_error" });
5209
5233
  }
5210
5234
  async function y(N, P, x = {}) {
5211
5235
  const T = e.upload;
5212
- ki(N, P, T.accept, T.maxBytes);
5213
- const $ = P.filename ?? oa(T.filenameTemplate, P), L = { ...P, filename: $, bytes: N.size, contentType: P.contentType ?? sa(N) };
5236
+ xi(N, P, T.accept, T.maxBytes);
5237
+ const $ = P.filename ?? sa(T.filenameTemplate, P), L = { ...P, filename: $, bytes: N.size, contentType: P.contentType ?? ca(N) };
5214
5238
  if (T.beforeUpload && !await T.beforeUpload(N, L))
5215
5239
  throw new z("Upload cancelled by host", { code: "upload_cancelled" });
5216
5240
  return T.strategy === "presigned" ? F(N, L, x) : T.strategy === "base64Json" ? S(N, L, x) : k(N, L, x);
@@ -5241,10 +5265,10 @@ function fi(e) {
5241
5265
  { method: "POST", credentials: u, headers: B, body: $ },
5242
5266
  x.signal
5243
5267
  );
5244
- return vi(G);
5268
+ return Ni(G);
5245
5269
  }
5246
5270
  async function S(N, P, x) {
5247
- const T = await wi(N);
5271
+ const T = await Si(N);
5248
5272
  return f("upload", {
5249
5273
  ...x,
5250
5274
  body: {
@@ -5331,23 +5355,23 @@ function fn(e) {
5331
5355
  function yn() {
5332
5356
  return typeof performance < "u" && performance.now ? performance.now() : Date.now();
5333
5357
  }
5334
- function yi(e, t) {
5358
+ function vi(e, t) {
5335
5359
  return e ? `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}` : t;
5336
5360
  }
5337
- function bi(e, t) {
5361
+ function ki(e, t) {
5338
5362
  if (!t) return e;
5339
5363
  const n = [];
5340
5364
  for (const [a, r] of Object.entries(t))
5341
5365
  r == null || r === "" || n.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(r))}`);
5342
5366
  return n.length ? e + (e.includes("?") ? "&" : "?") + n.join("&") : e;
5343
5367
  }
5344
- function gi(e) {
5368
+ function wi(e) {
5345
5369
  var a;
5346
5370
  if (!e || typeof e != "object") return;
5347
5371
  const t = e, n = ((a = t == null ? void 0 : t.meta) == null ? void 0 : a.inputsHash) ?? (t == null ? void 0 : t.inputsHash);
5348
5372
  return typeof n == "string" && n ? n : void 0;
5349
5373
  }
5350
- async function ia(e) {
5374
+ async function la(e) {
5351
5375
  const t = e.headers.get("content-type") || "";
5352
5376
  try {
5353
5377
  return t.includes("application/json") ? await e.json() : await e.text() || null;
@@ -5355,21 +5379,21 @@ async function ia(e) {
5355
5379
  return null;
5356
5380
  }
5357
5381
  }
5358
- async function vi(e) {
5382
+ async function Ni(e) {
5359
5383
  if (!e.ok) throw new z(`Upload failed (${e.status})`, { code: "upload_failed", status: e.status });
5360
- return ia(e);
5384
+ return la(e);
5361
5385
  }
5362
- function sa(e) {
5386
+ function ca(e) {
5363
5387
  return e.type || "application/octet-stream";
5364
5388
  }
5365
- function ki(e, t, n, a) {
5389
+ function xi(e, t, n, a) {
5366
5390
  if (e.size > a)
5367
5391
  throw new z(`File exceeds ${a} bytes`, { code: "too_large" });
5368
- const r = t.contentType ?? sa(e);
5392
+ const r = t.contentType ?? ca(e);
5369
5393
  if (n.length && r && !n.includes(r))
5370
5394
  throw new z(`Content type ${r} not accepted`, { code: "bad_type" });
5371
5395
  }
5372
- async function wi(e) {
5396
+ async function Si(e) {
5373
5397
  const t = await e.arrayBuffer(), n = new Uint8Array(t);
5374
5398
  if (typeof btoa == "function") {
5375
5399
  let r = "";
@@ -5380,7 +5404,7 @@ async function wi(e) {
5380
5404
  if (a) return a.from(n).toString("base64");
5381
5405
  throw new z("No base64 encoder available", { code: "no_base64" });
5382
5406
  }
5383
- function We(e, t) {
5407
+ function ze(e, t) {
5384
5408
  if (!t) return e;
5385
5409
  let n = e;
5386
5410
  for (const a of t.split(".")) {
@@ -5398,15 +5422,15 @@ function bn(e, t, n) {
5398
5422
  }
5399
5423
  r[a[a.length - 1]] = n;
5400
5424
  }
5401
- function Ni(e, t) {
5425
+ function Ci(e, t) {
5402
5426
  if (t === "asIs") return e;
5403
5427
  const n = e.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-\s]+/g, " ").trim().split(" ").filter(Boolean);
5404
5428
  return n.length === 0 ? e : t === "snake" ? n.map((a) => a.toLowerCase()).join("_") : t === "kebab" ? n.map((a) => a.toLowerCase()).join("-") : n.map((a, r) => r === 0 ? a.toLowerCase() : a[0].toUpperCase() + a.slice(1).toLowerCase()).join("");
5405
5429
  }
5406
5430
  function gn(e, t) {
5407
- return e.split(".").map((n) => Ni(n, t)).join(".");
5431
+ return e.split(".").map((n) => Ci(n, t)).join(".");
5408
5432
  }
5409
- function xi(e, t) {
5433
+ function Pi(e, t) {
5410
5434
  switch (t) {
5411
5435
  case "toFixed2":
5412
5436
  return Number(e).toFixed(2);
@@ -5423,11 +5447,11 @@ function xi(e, t) {
5423
5447
  return e;
5424
5448
  }
5425
5449
  }
5426
- function Si(e, t) {
5450
+ function Ti(e, t) {
5427
5451
  const n = e instanceof Date ? e : new Date(e);
5428
5452
  return Number.isNaN(n.getTime()) ? String(e) : n.toISOString();
5429
5453
  }
5430
- function Ci(e, t, n) {
5454
+ function Fi(e, t, n) {
5431
5455
  switch (t) {
5432
5456
  case "number": {
5433
5457
  if (n.numberEncoding === "number") {
@@ -5439,7 +5463,7 @@ function Ci(e, t, n) {
5439
5463
  case "boolean":
5440
5464
  return typeof e == "string" ? e.toLowerCase() === "true" : !!e;
5441
5465
  case "date":
5442
- return Si(e, n.dateFormat);
5466
+ return Ti(e, n.dateFormat);
5443
5467
  case "json":
5444
5468
  return e;
5445
5469
  case "string":
@@ -5447,30 +5471,30 @@ function Ci(e, t, n) {
5447
5471
  return String(e);
5448
5472
  }
5449
5473
  }
5450
- function at(e, t) {
5474
+ function ot(e, t) {
5451
5475
  if (t === "number") return e;
5452
5476
  if (typeof e == "number") return String(e);
5453
- if (Array.isArray(e)) return e.map((n) => at(n, t));
5477
+ if (Array.isArray(e)) return e.map((n) => ot(n, t));
5454
5478
  if (e && typeof e == "object") {
5455
5479
  const n = {};
5456
- for (const [a, r] of Object.entries(e)) n[a] = at(r, t);
5480
+ for (const [a, r] of Object.entries(e)) n[a] = ot(r, t);
5457
5481
  return n;
5458
5482
  }
5459
5483
  return e;
5460
5484
  }
5461
- function Pi(e, t) {
5485
+ function Ii(e, t) {
5462
5486
  var n;
5463
5487
  switch (e.kind) {
5464
5488
  case "static":
5465
5489
  return e.value;
5466
5490
  case "input":
5467
- return We(t.inputs, e.path);
5491
+ return ze(t.inputs, e.path);
5468
5492
  case "output":
5469
- return We(t.outputs, e.path);
5493
+ return ze(t.outputs, e.path);
5470
5494
  case "setting":
5471
- return We(t.settings, e.path);
5495
+ return ze(t.settings, e.path);
5472
5496
  case "context":
5473
- return We(t.context, e.path);
5497
+ return ze(t.context, e.path);
5474
5498
  case "token":
5475
5499
  return (n = t.tokens) == null ? void 0 : n[e.name];
5476
5500
  case "callback":
@@ -5479,10 +5503,10 @@ function Pi(e, t) {
5479
5503
  return;
5480
5504
  }
5481
5505
  }
5482
- function Ti(e, t, n) {
5506
+ function Ri(e, t, n) {
5483
5507
  const a = {};
5484
5508
  for (const u of e) {
5485
- let m = Pi(u.source, n);
5509
+ let m = Ii(u.source, n);
5486
5510
  const d = m === "" || m == null;
5487
5511
  if (u.omitWhenEmpty && d) continue;
5488
5512
  const i = gn(u.key, t.keyCase);
@@ -5491,14 +5515,14 @@ function Ti(e, t, n) {
5491
5515
  bn(a, i, null);
5492
5516
  continue;
5493
5517
  }
5494
- u.transform && u.transform !== "none" && (m = xi(m, u.transform)), bn(a, i, Ci(m, u.type, t));
5518
+ u.transform && u.transform !== "none" && (m = Pi(m, u.transform)), bn(a, i, Fi(m, u.type, t));
5495
5519
  }
5496
5520
  const r = t.include, s = (u, m) => {
5497
- m !== void 0 && (a[gn(u, t.keyCase)] = at(m, t.numberEncoding));
5521
+ m !== void 0 && (a[gn(u, t.keyCase)] = ot(m, t.numberEncoding));
5498
5522
  };
5499
5523
  return r != null && r.inputs && s("inputs", n.inputs), r != null && r.outputs && s("outputs", n.outputs), r != null && r.schedule && s("schedule", n.schedule), r != null && r.settingsSnapshot && s("settingsSnapshot", n.settings), r != null && r.meta && s("meta", n.context), t.numberEncoding === "number" && console.warn('[fincalc] numberEncoding="number" reintroduces float error; prefer "string".'), t.mode === "wrapped" && t.wrapperKey ? { [t.wrapperKey]: a } : a;
5500
5524
  }
5501
- const ys = {
5525
+ const vs = {
5502
5526
  mode: "flat",
5503
5527
  keyCase: "asIs",
5504
5528
  dateFormat: "iso",
@@ -5507,9 +5531,9 @@ const ys = {
5507
5531
  include: { inputs: !0, outputs: !0, schedule: !1, settingsSnapshot: !0, meta: !0 }
5508
5532
  };
5509
5533
  function vn(e) {
5510
- return at(e, "string");
5534
+ return ot(e, "string");
5511
5535
  }
5512
- function bs(e) {
5536
+ function ks(e) {
5513
5537
  const t = e.settings;
5514
5538
  return {
5515
5539
  schemaVersion: 1,
@@ -5543,17 +5567,17 @@ function bs(e) {
5543
5567
  warnings: e.warnings ?? []
5544
5568
  },
5545
5569
  ...e.attachments && e.attachments.length ? { attachments: e.attachments } : {},
5546
- client: { tz: e.clientTz ?? Fi(), platform: "web" }
5570
+ client: { tz: e.clientTz ?? Ei(), platform: "web" }
5547
5571
  };
5548
5572
  }
5549
- function Fi() {
5573
+ function Ei() {
5550
5574
  try {
5551
5575
  return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
5552
5576
  } catch {
5553
5577
  return "UTC";
5554
5578
  }
5555
5579
  }
5556
- const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "rates", "settings"], Ii = {
5580
+ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "rates", "settings"], Mi = {
5557
5581
  save: "POST",
5558
5582
  update: "PUT",
5559
5583
  get: "GET",
@@ -5563,7 +5587,7 @@ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "r
5563
5587
  uploadUrl: "GET",
5564
5588
  rates: "GET",
5565
5589
  settings: "GET"
5566
- }, la = ["bearer", "apiKeyHeader", "basic", "custom"], Ri = {
5590
+ }, ua = ["bearer", "apiKeyHeader", "basic", "custom"], $i = {
5567
5591
  strategy: "multipart",
5568
5592
  fieldName: "file",
5569
5593
  maxBytes: 10 * 1024 * 1024,
@@ -5572,10 +5596,10 @@ const He = ["save", "update", "get", "list", "delete", "upload", "uploadUrl", "r
5572
5596
  checksum: "none",
5573
5597
  chunked: { enabled: !1, chunkBytes: 1024 * 1024 }
5574
5598
  };
5575
- function ca() {
5599
+ function da() {
5576
5600
  const e = {};
5577
5601
  for (const t of He)
5578
- e[t] = { path: `/calculations${t === "save" || t === "list" ? "" : t === "get" || t === "update" || t === "delete" ? "/:id" : "/" + t}`, method: Ii[t], enabled: t === "save" || t === "list" };
5602
+ e[t] = { path: `/calculations${t === "save" || t === "list" ? "" : t === "get" || t === "update" || t === "delete" ? "/:id" : "/" + t}`, method: Mi[t], enabled: t === "save" || t === "list" };
5579
5603
  return {
5580
5604
  baseUrl: "https://api.example.com/v1",
5581
5605
  auth: { strategy: "bearer", headerName: "Authorization" },
@@ -5583,17 +5607,17 @@ function ca() {
5583
5607
  credentials: "same-origin",
5584
5608
  retry: { attempts: 3, backoff: "exponential", baseDelayMs: 300, retryOn: [408, 429, 500, 502, 503, 504], respectRetryAfter: !0 },
5585
5609
  endpoints: e,
5586
- upload: Ri
5610
+ upload: $i
5587
5611
  };
5588
5612
  }
5589
- const Ei = {
5613
+ const Ai = {
5590
5614
  mode: "flat",
5591
5615
  keyCase: "asIs",
5592
5616
  dateFormat: "iso",
5593
5617
  nullHandling: "omit",
5594
5618
  numberEncoding: "string",
5595
5619
  include: { inputs: !0, outputs: !0, schedule: !1, settingsSnapshot: !0, meta: !0 }
5596
- }, Mi = [
5620
+ }, Di = [
5597
5621
  { key: "calculator", source: { kind: "context", path: "calculator" }, type: "string", required: !0, omitWhenEmpty: !1 },
5598
5622
  { key: "principal", source: { kind: "input", path: "principal" }, type: "number", required: !0, omitWhenEmpty: !1 },
5599
5623
  { key: "payment", source: { kind: "output", path: "payment" }, type: "number", required: !1, omitWhenEmpty: !1 },
@@ -5612,7 +5636,7 @@ function kn(e) {
5612
5636
  n /= 1024, a++;
5613
5637
  return `${n.toFixed(n < 10 ? 1 : 0)} ${t[a]}`;
5614
5638
  }
5615
- function ua(e, t, n) {
5639
+ function ma(e, t, n) {
5616
5640
  switch (e) {
5617
5641
  case "bearer":
5618
5642
  return { Authorization: `Bearer ${n}` };
@@ -5630,9 +5654,9 @@ function ua(e, t, n) {
5630
5654
  function qe(e, t) {
5631
5655
  return t ? /^https?:\/\//i.test(t) ? t : `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}` : e;
5632
5656
  }
5633
- const $i = ["Connection", "Endpoints", "Upload", "Payload", "Test", "cURL", "Queue"];
5634
- function da({ hostConfig: e, getToken: t } = {}) {
5635
- const { settings: n } = ue(), [a, r] = M("Connection"), [s, u] = M(ca), [m, d] = M(Ei), [i, c] = M(Mi);
5657
+ const Li = ["Connection", "Endpoints", "Upload", "Payload", "Test", "cURL", "Queue"];
5658
+ function pa({ hostConfig: e, getToken: t } = {}) {
5659
+ const { settings: n } = ue(), [a, r] = M("Connection"), [s, u] = M(da), [m, d] = M(Ai), [i, c] = M(Di);
5636
5660
  if (!n.features.integrationPanel)
5637
5661
  return /* @__PURE__ */ o("section", { className: "card", "data-part": "integration-panel", children: /* @__PURE__ */ b("div", { className: "panel-head", children: [
5638
5662
  /* @__PURE__ */ o("h2", { children: "Integration" }),
@@ -5654,12 +5678,12 @@ function da({ hostConfig: e, getToken: t } = {}) {
5654
5678
  /* @__PURE__ */ o("h2", { children: "Integration" }),
5655
5679
  /* @__PURE__ */ o("p", { children: "Point the library at your backend without a code change. Nothing here stores a secret." })
5656
5680
  ] }),
5657
- /* @__PURE__ */ o("div", { className: "tabs", role: "tablist", "aria-label": "Integration settings", children: $i.map((f) => /* @__PURE__ */ o("button", { role: "tab", "aria-selected": a === f, onClick: () => r(f), children: f }, f)) }),
5681
+ /* @__PURE__ */ o("div", { className: "tabs", role: "tablist", "aria-label": "Integration settings", children: Li.map((f) => /* @__PURE__ */ o("button", { role: "tab", "aria-selected": a === f, onClick: () => r(f), children: f }, f)) }),
5658
5682
  /* @__PURE__ */ b("div", { role: "tabpanel", "aria-label": a, children: [
5659
- a === "Connection" && /* @__PURE__ */ o(Ai, { cfg: s, patch: p, hostLocked: l, getToken: t }),
5660
- a === "Endpoints" && /* @__PURE__ */ o(Di, { cfg: s, setCfg: u, locked: l("endpoints") }),
5683
+ a === "Connection" && /* @__PURE__ */ o(Ui, { cfg: s, patch: p, hostLocked: l, getToken: t }),
5684
+ a === "Endpoints" && /* @__PURE__ */ o(Oi, { cfg: s, setCfg: u, locked: l("endpoints") }),
5661
5685
  a === "Upload" && /* @__PURE__ */ o(
5662
- Li,
5686
+ Bi,
5663
5687
  {
5664
5688
  upload: s.upload,
5665
5689
  baseUrl: s.baseUrl,
@@ -5669,7 +5693,7 @@ function da({ hostConfig: e, getToken: t } = {}) {
5669
5693
  }
5670
5694
  ),
5671
5695
  a === "Payload" && /* @__PURE__ */ o(
5672
- Hi,
5696
+ ji,
5673
5697
  {
5674
5698
  fields: i,
5675
5699
  setFields: c,
@@ -5678,11 +5702,11 @@ function da({ hostConfig: e, getToken: t } = {}) {
5678
5702
  ctx: h
5679
5703
  }
5680
5704
  ),
5681
- a === "Test" && /* @__PURE__ */ o(Gi, { cfg: s, getToken: t }),
5682
- a === "cURL" && /* @__PURE__ */ o(ji, { cfg: s }),
5683
- a === "Queue" && /* @__PURE__ */ o(Vi, { cfg: s, getToken: t })
5705
+ a === "Test" && /* @__PURE__ */ o(Yi, { cfg: s, getToken: t }),
5706
+ a === "cURL" && /* @__PURE__ */ o(Ki, { cfg: s }),
5707
+ a === "Queue" && /* @__PURE__ */ o(Wi, { cfg: s, getToken: t })
5684
5708
  ] }),
5685
- /* @__PURE__ */ o(Yi, { cfg: s, setCfg: u })
5709
+ /* @__PURE__ */ o(zi, { cfg: s, setCfg: u })
5686
5710
  ] });
5687
5711
  }
5688
5712
  function Fe({ on: e, children: t }) {
@@ -5691,7 +5715,7 @@ function Fe({ on: e, children: t }) {
5691
5715
  e && /* @__PURE__ */ o("div", { className: "int-note", children: "Set by your organisation — read-only." })
5692
5716
  ] });
5693
5717
  }
5694
- function te({
5718
+ function ne({
5695
5719
  label: e,
5696
5720
  value: t,
5697
5721
  onChange: n,
@@ -5733,15 +5757,15 @@ function le({
5733
5757
  /* @__PURE__ */ o("div", { className: "input-wrap", children: /* @__PURE__ */ o("select", { value: t, onChange: (s) => a(s.target.value), "aria-label": e, children: r.map((s) => /* @__PURE__ */ o("option", { value: s.value, children: s.label }, s.value)) }) })
5734
5758
  ] });
5735
5759
  }
5736
- function Ai({
5760
+ function Ui({
5737
5761
  cfg: e,
5738
5762
  patch: t,
5739
5763
  hostLocked: n,
5740
5764
  getToken: a
5741
5765
  }) {
5742
- const r = la.includes(e.auth.strategy);
5766
+ const r = ua.includes(e.auth.strategy);
5743
5767
  return /* @__PURE__ */ b("div", { className: "grid two", children: [
5744
- /* @__PURE__ */ o(Fe, { on: n("baseUrl"), children: /* @__PURE__ */ o(te, { label: "Base URL", value: e.baseUrl, onChange: (s) => t({ baseUrl: s }), help: "Absolute origin + base path" }) }),
5768
+ /* @__PURE__ */ o(Fe, { on: n("baseUrl"), children: /* @__PURE__ */ o(ne, { label: "Base URL", value: e.baseUrl, onChange: (s) => t({ baseUrl: s }), help: "Absolute origin + base path" }) }),
5745
5769
  /* @__PURE__ */ o(
5746
5770
  le,
5747
5771
  {
@@ -5751,7 +5775,7 @@ function Ai({
5751
5775
  onChange: (s) => t({ auth: { ...e.auth, strategy: s } })
5752
5776
  }
5753
5777
  ),
5754
- (e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom") && /* @__PURE__ */ o(te, { label: "Header name", value: e.auth.headerName, onChange: (s) => t({ auth: { ...e.auth, headerName: s } }) }),
5778
+ (e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom") && /* @__PURE__ */ o(ne, { label: "Header name", value: e.auth.headerName, onChange: (s) => t({ auth: { ...e.auth, headerName: s } }) }),
5755
5779
  r && /* @__PURE__ */ b("div", { className: "field span2", children: [
5756
5780
  /* @__PURE__ */ o("span", { className: "lbl", children: "Token" }),
5757
5781
  a ? /* @__PURE__ */ o("div", { className: "input-wrap", style: { background: "var(--fc-accent-weak)" }, children: /* @__PURE__ */ o("input", { value: "•••••••••• supplied by host application", readOnly: !0, "aria-label": "token supplied by host", style: { textAlign: "left" } }) }) : /* @__PURE__ */ b("div", { className: "notice", children: [
@@ -5760,7 +5784,7 @@ function Ai({
5760
5784
  " supplied by the host — endpoints that require auth are disabled. The panel never accepts a token as input."
5761
5785
  ] })
5762
5786
  ] }),
5763
- /* @__PURE__ */ o(Fe, { on: n("timeoutMs"), children: /* @__PURE__ */ o(te, { label: "Timeout", type: "number", value: String(e.timeoutMs), onChange: (s) => t({ timeoutMs: Number(s) || 0 }), affix: "ms" }) }),
5787
+ /* @__PURE__ */ o(Fe, { on: n("timeoutMs"), children: /* @__PURE__ */ o(ne, { label: "Timeout", type: "number", value: String(e.timeoutMs), onChange: (s) => t({ timeoutMs: Number(s) || 0 }), affix: "ms" }) }),
5764
5788
  /* @__PURE__ */ o(Fe, { on: n("credentials"), children: /* @__PURE__ */ o(
5765
5789
  le,
5766
5790
  {
@@ -5770,7 +5794,7 @@ function Ai({
5770
5794
  onChange: (s) => t({ credentials: s })
5771
5795
  }
5772
5796
  ) }),
5773
- /* @__PURE__ */ o(Fe, { on: n("retry"), children: /* @__PURE__ */ o(te, { label: "Retry attempts", type: "number", value: String(e.retry.attempts), onChange: (s) => t({ retry: { ...e.retry, attempts: Number(s) || 1 } }) }) }),
5797
+ /* @__PURE__ */ o(Fe, { on: n("retry"), children: /* @__PURE__ */ o(ne, { label: "Retry attempts", type: "number", value: String(e.retry.attempts), onChange: (s) => t({ retry: { ...e.retry, attempts: Number(s) || 1 } }) }) }),
5774
5798
  /* @__PURE__ */ o(
5775
5799
  le,
5776
5800
  {
@@ -5780,9 +5804,9 @@ function Ai({
5780
5804
  onChange: (s) => t({ retry: { ...e.retry, backoff: s } })
5781
5805
  }
5782
5806
  ),
5783
- /* @__PURE__ */ o(te, { label: "Base delay", type: "number", value: String(e.retry.baseDelayMs), onChange: (s) => t({ retry: { ...e.retry, baseDelayMs: Number(s) || 0 } }), affix: "ms" }),
5807
+ /* @__PURE__ */ o(ne, { label: "Base delay", type: "number", value: String(e.retry.baseDelayMs), onChange: (s) => t({ retry: { ...e.retry, baseDelayMs: Number(s) || 0 } }), affix: "ms" }),
5784
5808
  /* @__PURE__ */ o(
5785
- te,
5809
+ ne,
5786
5810
  {
5787
5811
  label: "Retry on (status codes)",
5788
5812
  value: e.retry.retryOn.join(", "),
@@ -5792,7 +5816,7 @@ function Ai({
5792
5816
  )
5793
5817
  ] });
5794
5818
  }
5795
- function Di({ cfg: e, setCfg: t, locked: n }) {
5819
+ function Oi({ cfg: e, setCfg: t, locked: n }) {
5796
5820
  const a = (r, s) => t((u) => ({ ...u, endpoints: { ...u.endpoints, [r]: { ...u.endpoints[r], ...s } } }));
5797
5821
  return /* @__PURE__ */ o(Fe, { on: n, children: /* @__PURE__ */ o("div", { className: "int-table-wrap", children: /* @__PURE__ */ b("table", { className: "int-table", children: [
5798
5822
  /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ b("tr", { children: [
@@ -5815,25 +5839,25 @@ function Di({ cfg: e, setCfg: t, locked: n }) {
5815
5839
  }) })
5816
5840
  ] }) }) });
5817
5841
  }
5818
- function Li({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5842
+ function Bi({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5819
5843
  var m, d, i;
5820
- const s = (c) => a({ ...e, ...c }), u = ne(
5821
- () => oa(e.filenameTemplate, { calculator: "loan.emi", kind: "pdf", inputsHash: Ue.inputsHash, filename: "x.pdf" }),
5844
+ const s = (c) => a({ ...e, ...c }), u = X(
5845
+ () => sa(e.filenameTemplate, { calculator: "loan.emi", kind: "pdf", inputsHash: Ue.inputsHash, filename: "x.pdf" }),
5822
5846
  [e.filenameTemplate]
5823
5847
  );
5824
5848
  return /* @__PURE__ */ o(Fe, { on: r, children: /* @__PURE__ */ b("div", { className: "grid two", children: [
5825
- /* @__PURE__ */ o(te, { label: "Upload URI", value: n, readOnly: !0, help: "Resolved from baseUrl + the 'upload' endpoint path (edit it under Endpoints)" }),
5849
+ /* @__PURE__ */ o(ne, { label: "Upload URI", value: n, readOnly: !0, help: "Resolved from baseUrl + the 'upload' endpoint path (edit it under Endpoints)" }),
5826
5850
  /* @__PURE__ */ o(le, { label: "Strategy", value: e.strategy, options: ["multipart", "presigned", "base64Json"], onChange: (c) => s({ strategy: c }) }),
5827
- /* @__PURE__ */ o(te, { label: "Field name", value: e.fieldName, onChange: (c) => s({ fieldName: c }) }),
5828
- /* @__PURE__ */ o(te, { label: "Max bytes", type: "number", value: String(e.maxBytes), onChange: (c) => s({ maxBytes: Number(c) || 0 }), affix: kn(e.maxBytes) }),
5851
+ /* @__PURE__ */ o(ne, { label: "Field name", value: e.fieldName, onChange: (c) => s({ fieldName: c }) }),
5852
+ /* @__PURE__ */ o(ne, { label: "Max bytes", type: "number", value: String(e.maxBytes), onChange: (c) => s({ maxBytes: Number(c) || 0 }), affix: kn(e.maxBytes) }),
5829
5853
  /* @__PURE__ */ b("div", { className: "field span2", children: [
5830
- /* @__PURE__ */ o(te, { label: "Filename template", value: e.filenameTemplate, onChange: (c) => s({ filenameTemplate: c }), help: "{calculator} {yyyy} {MM} {dd} {hash8} {ext}" }),
5854
+ /* @__PURE__ */ o(ne, { label: "Filename template", value: e.filenameTemplate, onChange: (c) => s({ filenameTemplate: c }), help: "{calculator} {yyyy} {MM} {dd} {hash8} {ext}" }),
5831
5855
  /* @__PURE__ */ b("div", { className: "int-note mono", children: [
5832
5856
  "→ ",
5833
5857
  u
5834
5858
  ] })
5835
5859
  ] }),
5836
- /* @__PURE__ */ o(te, { label: "Accepted MIME types", value: e.accept.join(", "), onChange: (c) => s({ accept: c.split(",").map((l) => l.trim()).filter(Boolean) }) }),
5860
+ /* @__PURE__ */ o(ne, { label: "Accepted MIME types", value: e.accept.join(", "), onChange: (c) => s({ accept: c.split(",").map((l) => l.trim()).filter(Boolean) }) }),
5837
5861
  /* @__PURE__ */ o(le, { label: "Checksum", value: e.checksum ?? "none", options: ["none", "sha256"], onChange: (c) => s({ checksum: c }) }),
5838
5862
  /* @__PURE__ */ b("label", { className: "field toggle-field span2", children: [
5839
5863
  /* @__PURE__ */ o("span", { className: "lbl", children: "Chunked upload (large PDFs)" }),
@@ -5853,7 +5877,7 @@ function Li({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5853
5877
  }
5854
5878
  )
5855
5879
  ] }),
5856
- ((i = e.chunked) == null ? void 0 : i.enabled) && /* @__PURE__ */ o(te, { label: "Chunk size", type: "number", value: String(e.chunked.chunkBytes), onChange: (c) => s({ chunked: { enabled: !0, chunkBytes: Number(c) || 1 } }), affix: kn(e.chunked.chunkBytes) }),
5880
+ ((i = e.chunked) == null ? void 0 : i.enabled) && /* @__PURE__ */ o(ne, { label: "Chunk size", type: "number", value: String(e.chunked.chunkBytes), onChange: (c) => s({ chunked: { enabled: !0, chunkBytes: Number(c) || 1 } }), affix: kn(e.chunked.chunkBytes) }),
5857
5881
  e.strategy === "presigned" && /* @__PURE__ */ b("div", { className: "span2 int-subform", children: [
5858
5882
  /* @__PURE__ */ b("div", { className: "int-note", children: [
5859
5883
  /* @__PURE__ */ o("strong", { children: "Presigned sub-form" }),
@@ -5870,14 +5894,14 @@ function Li({ upload: e, baseUrl: t, uploadUri: n, onChange: a, locked: r }) {
5870
5894
  ] })
5871
5895
  ] }) });
5872
5896
  }
5873
- const Ui = ["static", "input", "output", "setting", "context", "token", "callback"];
5874
- function Oi(e) {
5897
+ const _i = ["static", "input", "output", "setting", "context", "token", "callback"];
5898
+ function Hi(e) {
5875
5899
  return e.kind === "static" ? String(e.value) : e.kind === "token" ? e.name : e.kind === "callback" ? "fn()" : e.path;
5876
5900
  }
5877
- function Bi(e, t) {
5901
+ function qi(e, t) {
5878
5902
  return e.kind === "static" ? { kind: "static", value: t } : e.kind === "token" ? { kind: "token", name: t } : e.kind === "callback" ? e : { kind: e.kind, path: t };
5879
5903
  }
5880
- function _i(e) {
5904
+ function Gi(e) {
5881
5905
  switch (e) {
5882
5906
  case "static":
5883
5907
  return { kind: "static", value: "" };
@@ -5889,16 +5913,16 @@ function _i(e) {
5889
5913
  return { kind: e, path: "" };
5890
5914
  }
5891
5915
  }
5892
- function Hi({
5916
+ function ji({
5893
5917
  fields: e,
5894
5918
  setFields: t,
5895
5919
  envelope: n,
5896
5920
  setEnvelope: a,
5897
5921
  ctx: r
5898
5922
  }) {
5899
- const s = ne(() => {
5923
+ const s = X(() => {
5900
5924
  try {
5901
- return JSON.stringify(Ti(e, n, r), null, 2);
5925
+ return JSON.stringify(Ri(e, n, r), null, 2);
5902
5926
  } catch (i) {
5903
5927
  return `// ${i instanceof Error ? i.message : "preview failed"}`;
5904
5928
  }
@@ -5912,7 +5936,7 @@ function Hi({
5912
5936
  /* @__PURE__ */ b("div", { children: [
5913
5937
  /* @__PURE__ */ b("div", { className: "grid two", children: [
5914
5938
  /* @__PURE__ */ o(le, { label: "Envelope", value: n.mode, options: ["flat", "wrapped"], onChange: (i) => a({ ...n, mode: i }) }),
5915
- n.mode === "wrapped" && /* @__PURE__ */ o(te, { label: "Wrapper key", value: n.wrapperKey ?? "data", onChange: (i) => a({ ...n, wrapperKey: i }) }),
5939
+ n.mode === "wrapped" && /* @__PURE__ */ o(ne, { label: "Wrapper key", value: n.wrapperKey ?? "data", onChange: (i) => a({ ...n, wrapperKey: i }) }),
5916
5940
  /* @__PURE__ */ o(le, { label: "Key case", value: n.keyCase, options: ["asIs", "camel", "snake", "kebab"], onChange: (i) => a({ ...n, keyCase: i }) }),
5917
5941
  /* @__PURE__ */ o(le, { label: "Null handling", value: n.nullHandling, options: ["omit", "null"], onChange: (i) => a({ ...n, nullHandling: i }) }),
5918
5942
  /* @__PURE__ */ o(le, { label: "Number encoding", value: n.numberEncoding, options: ["string", "number"], onChange: (i) => a({ ...n, numberEncoding: i }) })
@@ -5939,13 +5963,13 @@ function Hi({
5939
5963
  ] }) }),
5940
5964
  /* @__PURE__ */ o("tbody", { children: e.map((i, c) => /* @__PURE__ */ b("tr", { children: [
5941
5965
  /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("input", { value: i.key, onChange: (l) => u(c, { key: l.target.value }), "aria-label": "key", className: "int-cell-input" }) }),
5942
- /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("select", { value: i.source.kind, onChange: (l) => u(c, { source: _i(l.target.value) }), "aria-label": "source kind", children: Ui.map((l) => /* @__PURE__ */ o("option", { children: l }, l)) }) }),
5966
+ /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o("select", { value: i.source.kind, onChange: (l) => u(c, { source: Gi(l.target.value) }), "aria-label": "source kind", children: _i.map((l) => /* @__PURE__ */ o("option", { children: l }, l)) }) }),
5943
5967
  /* @__PURE__ */ o("td", { children: /* @__PURE__ */ o(
5944
5968
  "input",
5945
5969
  {
5946
- value: Oi(i.source),
5970
+ value: Hi(i.source),
5947
5971
  disabled: i.source.kind === "callback",
5948
- onChange: (l) => u(c, { source: Bi(i.source, l.target.value) }),
5972
+ onChange: (l) => u(c, { source: qi(i.source, l.target.value) }),
5949
5973
  "aria-label": "source value",
5950
5974
  className: "int-cell-input"
5951
5975
  }
@@ -5976,7 +6000,7 @@ function Hi({
5976
6000
  ] })
5977
6001
  ] });
5978
6002
  }
5979
- function qi(e, t) {
6003
+ function Vi(e, t) {
5980
6004
  const n = {};
5981
6005
  for (const a of He) {
5982
6006
  const r = e.endpoints[a];
@@ -5990,10 +6014,10 @@ function qi(e, t) {
5990
6014
  retry: e.retry,
5991
6015
  upload: e.upload,
5992
6016
  offlineQueue: { enabled: !0, storage: "memory", maxItems: 200, flushOn: "manual" },
5993
- getAuth: t ? async () => ua(e.auth.strategy, e.auth.headerName, await t()) : void 0
6017
+ getAuth: t ? async () => ma(e.auth.strategy, e.auth.headerName, await t()) : void 0
5994
6018
  };
5995
6019
  }
5996
- function Gi({ cfg: e, getToken: t }) {
6020
+ function Yi({ cfg: e, getToken: t }) {
5997
6021
  const [n, a] = M({ loading: !1 }), [r, s] = M("save");
5998
6022
  return /* @__PURE__ */ b("div", { children: [
5999
6023
  /* @__PURE__ */ b("div", { className: "grid two", children: [
@@ -6001,11 +6025,11 @@ function Gi({ cfg: e, getToken: t }) {
6001
6025
  /* @__PURE__ */ o("div", { className: "field", style: { display: "flex", alignItems: "flex-end" }, children: /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: async () => {
6002
6026
  a({ loading: !0 });
6003
6027
  const m = e.endpoints[r], d = qe(e.baseUrl, m.path).replace(/:id\b/, "sample-id"), i = { "content-type": "application/json", "X-FinCalc-Test": "1" };
6004
- t && Object.assign(i, ua(e.auth.strategy, e.auth.headerName, await t()));
6028
+ t && Object.assign(i, ma(e.auth.strategy, e.auth.headerName, await t()));
6005
6029
  const c = performance.now();
6006
6030
  try {
6007
6031
  const l = await fetch(d, { method: m.method, headers: i, credentials: e.credentials }), p = await l.text(), h = {};
6008
- l.headers.forEach((f, y) => h[y] = f), a({ loading: !1, ok: l.ok, status: l.status, ms: Math.round(performance.now() - c), headers: h, body: Ki(p), sent: { url: d, method: m.method, headers: $t(i) } });
6032
+ l.headers.forEach((f, y) => h[y] = f), a({ loading: !1, ok: l.ok, status: l.status, ms: Math.round(performance.now() - c), headers: h, body: Ji(p), sent: { url: d, method: m.method, headers: $t(i) } });
6009
6033
  } catch (l) {
6010
6034
  a({ loading: !1, ok: !1, ms: Math.round(performance.now() - c), error: l instanceof Error ? l.message : "request failed", sent: { url: d, method: m.method, headers: $t(i) } });
6011
6035
  }
@@ -6035,9 +6059,9 @@ ${JSON.stringify(n.sent.headers, null, 2)}` })
6035
6059
  ] })
6036
6060
  ] });
6037
6061
  }
6038
- function ji({ cfg: e }) {
6062
+ function Ki({ cfg: e }) {
6039
6063
  const [t, n] = M(!1), [a, r] = M("save"), s = e.endpoints[a], u = qe(e.baseUrl, s.path).replace(/:id\b/, "sample-id"), m = { "content-type": "application/json" };
6040
- la.includes(e.auth.strategy) && (m[e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom" ? e.auth.headerName || "X-API-Key" : "Authorization"] = t ? "<token>" : "***");
6064
+ ua.includes(e.auth.strategy) && (m[e.auth.strategy === "apiKeyHeader" || e.auth.strategy === "custom" ? e.auth.headerName || "X-API-Key" : "Authorization"] = t ? "<token>" : "***");
6041
6065
  const d = [`curl -X ${s.method} '${u}'`];
6042
6066
  for (const [c, l] of Object.entries(m)) d.push(` -H '${c}: ${l}'`);
6043
6067
  ["POST", "PUT", "PATCH"].includes(s.method) && d.push(` -d '{"example":"body"}'`);
@@ -6058,8 +6082,8 @@ function ji({ cfg: e }) {
6058
6082
  }, children: "Copy" })
6059
6083
  ] });
6060
6084
  }
6061
- function Vi({ cfg: e, getToken: t }) {
6062
- const n = ne(() => fi(qi(e, t)), [e, t]), [a, r] = M(() => n.queue.list()), [s, u] = M(""), m = () => r(n.queue.list());
6085
+ function Wi({ cfg: e, getToken: t }) {
6086
+ const n = X(() => gi(Vi(e, t)), [e, t]), [a, r] = M(() => n.queue.list()), [s, u] = M(""), m = () => r(n.queue.list());
6063
6087
  return /* @__PURE__ */ b("div", { children: [
6064
6088
  /* @__PURE__ */ b("div", { className: "actions-row", style: { marginTop: 0 }, children: [
6065
6089
  /* @__PURE__ */ o("button", { type: "button", className: "icon-btn", onClick: m, children: "Refresh" }),
@@ -6088,7 +6112,7 @@ function Vi({ cfg: e, getToken: t }) {
6088
6112
  ] }) })
6089
6113
  ] });
6090
6114
  }
6091
- function Yi({ cfg: e, setCfg: t }) {
6115
+ function zi({ cfg: e, setCfg: t }) {
6092
6116
  const [n, a] = M(""), [r, s] = M("");
6093
6117
  return /* @__PURE__ */ b("div", { className: "accordion", style: { marginTop: 20 }, children: [
6094
6118
  /* @__PURE__ */ o("span", { className: "lbl", children: "Import / export config (JSON)" }),
@@ -6102,7 +6126,7 @@ function Yi({ cfg: e, setCfg: t }) {
6102
6126
  const d = JSON.parse(n);
6103
6127
  for (const i of ["token", "apiKey", "getAuth", "authorization"])
6104
6128
  i in d && (delete d[i], s(`Refused to import "${i}" — the panel never persists a secret.`));
6105
- t(() => ({ ...ca(), ...d })), r || s("Imported.");
6129
+ t(() => ({ ...da(), ...d })), r || s("Imported.");
6106
6130
  } catch {
6107
6131
  s("Invalid JSON.");
6108
6132
  }
@@ -6111,16 +6135,16 @@ function Yi({ cfg: e, setCfg: t }) {
6111
6135
  r && /* @__PURE__ */ o("div", { className: "int-note", children: r })
6112
6136
  ] });
6113
6137
  }
6114
- function Ki(e) {
6138
+ function Ji(e) {
6115
6139
  try {
6116
6140
  return JSON.stringify(JSON.parse(e), null, 2);
6117
6141
  } catch {
6118
6142
  return e;
6119
6143
  }
6120
6144
  }
6121
- const Wi = "1234567.891";
6122
- function zi() {
6123
- const { settings: e, update: t, setRegion: n, reset: a, replace: r } = ue(), s = de(null), u = Sn(e).money(g(Wi)), m = () => {
6145
+ const Zi = "1234567.891";
6146
+ function Xi() {
6147
+ const { settings: e, update: t, setRegion: n, reset: a, replace: r } = ue(), s = de(null), u = Sn(e).money(g(Zi)), m = () => {
6124
6148
  const i = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), c = URL.createObjectURL(i), l = document.createElement("a");
6125
6149
  l.href = c, l.download = "calcsuite-settings.json", l.click(), URL.revokeObjectURL(c);
6126
6150
  }, d = (i) => {
@@ -6211,7 +6235,7 @@ function zi() {
6211
6235
  options: [["system", "System"], ["light", "Light"], ["dark", "Dark"], ["highContrast", "High contrast"]]
6212
6236
  }
6213
6237
  ) }),
6214
- /* @__PURE__ */ o(W, { label: "Accent colour", children: /* @__PURE__ */ o("div", { className: "swatches", children: si.map((i) => {
6238
+ /* @__PURE__ */ o(W, { label: "Accent colour", children: /* @__PURE__ */ o("div", { className: "swatches", children: Cn.map((i) => {
6215
6239
  const c = e.ui.accent.toLowerCase() === i.main.toLowerCase();
6216
6240
  return /* @__PURE__ */ o(
6217
6241
  "button",
@@ -6232,7 +6256,7 @@ function zi() {
6232
6256
  {
6233
6257
  value: e.ui.fontFamily,
6234
6258
  onChange: (i) => t({ ui: { fontFamily: i } }),
6235
- options: li.map((i) => [i.id, i.label])
6259
+ options: Pn.map((i) => [i.id, i.label])
6236
6260
  }
6237
6261
  ) }),
6238
6262
  /* @__PURE__ */ o(W, { label: "Density", children: /* @__PURE__ */ o(
@@ -6255,7 +6279,7 @@ function zi() {
6255
6279
  " — so exports (PDF/CSV/…) and saved calculations post directly to your own server. No secret is ever stored by the app."
6256
6280
  ] })
6257
6281
  ] }),
6258
- e.features.integrationPanel && /* @__PURE__ */ o(da, {}),
6282
+ e.features.integrationPanel && /* @__PURE__ */ o(pa, {}),
6259
6283
  /* @__PURE__ */ b("div", { className: "actions-row", children: [
6260
6284
  /* @__PURE__ */ o("button", { className: "icon-btn", onClick: m, children: "Export settings" }),
6261
6285
  /* @__PURE__ */ o("button", { className: "icon-btn", onClick: () => {
@@ -6288,7 +6312,7 @@ function he({ value: e, onChange: t, options: n }) {
6288
6312
  function Le({ on: e, onClick: t }) {
6289
6313
  return /* @__PURE__ */ o("button", { type: "button", role: "switch", "aria-checked": e, className: `toggle ${e ? "on" : ""}`, onClick: t, children: /* @__PURE__ */ o("span", { className: "knob" }) });
6290
6314
  }
6291
- function Ji({
6315
+ function Qi({
6292
6316
  items: e,
6293
6317
  onRestore: t,
6294
6318
  onClear: n
@@ -6317,18 +6341,18 @@ function wn(e, t) {
6317
6341
  for (let s = 0; s < n.length && r < e.length; s++) n[s] === e[r] && r++;
6318
6342
  return r === e.length ? 10 : -1;
6319
6343
  }
6320
- function Zi({
6344
+ function es({
6321
6345
  calculators: e,
6322
6346
  actions: t,
6323
6347
  onPick: n,
6324
6348
  onClose: a
6325
6349
  }) {
6326
6350
  const [r, s] = M(""), [u, m] = M(0), d = de(null);
6327
- X(() => {
6351
+ Q(() => {
6328
6352
  var l;
6329
6353
  return (l = d.current) == null ? void 0 : l.focus();
6330
- }, []), X(() => (wa(), () => Na()), []);
6331
- const i = ne(() => {
6354
+ }, []), Q(() => (Pa(), () => Ta()), []);
6355
+ const i = X(() => {
6332
6356
  const l = e.map((y) => ({
6333
6357
  key: `calc:${y.id}`,
6334
6358
  label: y.title,
@@ -6341,7 +6365,7 @@ function Zi({
6341
6365
  return { it: y, s: Math.max(wn(f, y.label), wn(f, `${y.group} ${((k = (w = e.find((S) => S.title === y.label)) == null ? void 0 : w.keywords) == null ? void 0 : k.join(" ")) ?? ""}`)) };
6342
6366
  }).filter((y) => y.s > 0).sort((y, w) => w.s - y.s).map((y) => y.it) : h;
6343
6367
  }, [r, e, t, n]);
6344
- return X(() => m(0), [r]), /* @__PURE__ */ o("div", { className: "palette-backdrop", onClick: a, children: /* @__PURE__ */ b("div", { className: "palette", role: "dialog", "aria-label": "Command palette", onClick: (l) => l.stopPropagation(), children: [
6368
+ return Q(() => m(0), [r]), /* @__PURE__ */ o("div", { className: "palette-backdrop", onClick: a, children: /* @__PURE__ */ b("div", { className: "palette", role: "dialog", "aria-label": "Command palette", onClick: (l) => l.stopPropagation(), children: [
6345
6369
  /* @__PURE__ */ o(
6346
6370
  "input",
6347
6371
  {
@@ -6377,7 +6401,7 @@ function Zi({
6377
6401
  ] })
6378
6402
  ] }) });
6379
6403
  }
6380
- const ut = (e) => ({
6404
+ const Ge = (e) => ({
6381
6405
  width: e,
6382
6406
  height: e,
6383
6407
  viewBox: "0 0 24 24",
@@ -6388,32 +6412,45 @@ const ut = (e) => ({
6388
6412
  strokeLinejoin: "round",
6389
6413
  "aria-hidden": !0
6390
6414
  });
6391
- function Xi({ size: e = 17 }) {
6392
- return /* @__PURE__ */ b("svg", { ...ut(e), children: [
6415
+ function ts({ size: e = 17 }) {
6416
+ return /* @__PURE__ */ b("svg", { ...Ge(e), children: [
6393
6417
  /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "3" }),
6394
6418
  /* @__PURE__ */ o("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
6395
6419
  ] });
6396
6420
  }
6397
- function Qi({ size: e = 17 }) {
6398
- return /* @__PURE__ */ b("svg", { ...ut(e), children: [
6421
+ function ns({ size: e = 17 }) {
6422
+ return /* @__PURE__ */ b("svg", { ...Ge(e), children: [
6399
6423
  /* @__PURE__ */ o("circle", { cx: "12", cy: "12", r: "4" }),
6400
6424
  /* @__PURE__ */ o("path", { d: "M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41" })
6401
6425
  ] });
6402
6426
  }
6403
- function es({ size: e = 17 }) {
6404
- return /* @__PURE__ */ o("svg", { ...ut(e), children: /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
6427
+ function as({ size: e = 17 }) {
6428
+ return /* @__PURE__ */ o("svg", { ...Ge(e), children: /* @__PURE__ */ o("path", { d: "M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z" }) });
6429
+ }
6430
+ function ha({ size: e = 17 }) {
6431
+ return /* @__PURE__ */ b("svg", { ...Ge(e), children: [
6432
+ /* @__PURE__ */ o("rect", { x: "4", y: "2", width: "16", height: "20", rx: "2" }),
6433
+ /* @__PURE__ */ o("line", { x1: "8", y1: "6", x2: "16", y2: "6" }),
6434
+ /* @__PURE__ */ o("line", { x1: "8", y1: "10", x2: "8", y2: "10" }),
6435
+ /* @__PURE__ */ o("line", { x1: "12", y1: "10", x2: "12", y2: "10" }),
6436
+ /* @__PURE__ */ o("line", { x1: "16", y1: "10", x2: "16", y2: "10" }),
6437
+ /* @__PURE__ */ o("line", { x1: "8", y1: "14", x2: "8", y2: "14" }),
6438
+ /* @__PURE__ */ o("line", { x1: "12", y1: "14", x2: "12", y2: "14" }),
6439
+ /* @__PURE__ */ o("line", { x1: "16", y1: "14", x2: "16", y2: "14" }),
6440
+ /* @__PURE__ */ o("line", { x1: "8", y1: "18", x2: "12", y2: "18" })
6441
+ ] });
6405
6442
  }
6406
- function ts({ size: e = 17 }) {
6407
- return /* @__PURE__ */ b("svg", { ...ut(e), children: [
6443
+ function rs({ size: e = 17 }) {
6444
+ return /* @__PURE__ */ b("svg", { ...Ge(e), children: [
6408
6445
  /* @__PURE__ */ o("path", { d: "M3 3v5h5" }),
6409
6446
  /* @__PURE__ */ o("path", { d: "M3.05 13A9 9 0 1 0 6 5.3L3 8" }),
6410
6447
  /* @__PURE__ */ o("path", { d: "M12 7v5l4 2" })
6411
6448
  ] });
6412
6449
  }
6413
- const ns = { "loan.emi": Wn, scientific: Jn, currency: aa };
6414
- function as({ onClose: e }) {
6415
- const { settings: t, setRegion: n, update: a, resolvedTheme: r } = ue(), s = t.region, u = ne(() => Kr(s), [s]), [m, d] = M("loan.emi"), [i, c] = M("calc"), [l, p] = M(void 0), [h, f] = M(!1), { items: y, clear: w } = Mo();
6416
- X(() => {
6450
+ const os = { "loan.emi": Jn, scientific: Xn, currency: oa };
6451
+ function is({ onClose: e }) {
6452
+ const { settings: t, setRegion: n, update: a, resolvedTheme: r } = ue(), s = t.region, u = X(() => Xr(s), [s]), [m, d] = M("loan.emi"), [i, c] = M("calc"), [l, p] = M(void 0), [h, f] = M(!1), { items: y, clear: w } = Uo();
6453
+ Q(() => {
6417
6454
  const x = () => {
6418
6455
  const T = new URLSearchParams(location.hash.replace(/^#/, "") || location.search), $ = T.get("fincalc");
6419
6456
  if ($ && Rt($)) {
@@ -6455,8 +6492,11 @@ function as({ onClose: e }) {
6455
6492
  return /* @__PURE__ */ b("div", { className: "fc-shell", onKeyDown: k, children: [
6456
6493
  /* @__PURE__ */ b("header", { className: "fc-topbar", children: [
6457
6494
  /* @__PURE__ */ b("div", { className: "brand fc-brand", children: [
6458
- /* @__PURE__ */ o("strong", { children: "CalcSuite" }),
6459
- /* @__PURE__ */ o("a", { className: "fc-brand-sub", href: "https://acecbm.com", target: "_blank", rel: "noopener noreferrer", children: "an AceCBM product ↗" })
6495
+ /* @__PURE__ */ o("span", { className: "fc-brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ o(ha, { size: 22 }) }),
6496
+ /* @__PURE__ */ b("div", { className: "fc-brand-text", children: [
6497
+ /* @__PURE__ */ o("strong", { children: "CalcSuite" }),
6498
+ /* @__PURE__ */ o("a", { className: "fc-brand-sub", href: "https://acecbm.com", target: "_blank", rel: "noopener noreferrer", children: "an AceCBM product ↗" })
6499
+ ] })
6460
6500
  ] }),
6461
6501
  /* @__PURE__ */ b("div", { className: "fc-top-actions", children: [
6462
6502
  /* @__PURE__ */ o("button", { className: "icon-btn", onClick: () => f(!0), "aria-label": "Search", children: "⌘K Search" }),
@@ -6464,17 +6504,17 @@ function as({ onClose: e }) {
6464
6504
  /* @__PURE__ */ o("button", { "aria-pressed": s === "IN", onClick: () => n("IN"), children: "🇮🇳" }),
6465
6505
  /* @__PURE__ */ o("button", { "aria-pressed": s === "US", onClick: () => n("US"), children: "🇺🇸" })
6466
6506
  ] }),
6467
- /* @__PURE__ */ o("button", { className: "icon-btn icon-only", onClick: () => a({ ui: { theme: r === "dark" ? "light" : "dark" } }), "aria-label": r === "dark" ? "Switch to light mode" : "Switch to dark mode", children: r === "dark" ? /* @__PURE__ */ o(Qi, {}) : /* @__PURE__ */ o(es, {}) }),
6507
+ /* @__PURE__ */ o("button", { className: "icon-btn icon-only", onClick: () => a({ ui: { theme: r === "dark" ? "light" : "dark" } }), "aria-label": r === "dark" ? "Switch to light mode" : "Switch to dark mode", children: r === "dark" ? /* @__PURE__ */ o(ns, {}) : /* @__PURE__ */ o(as, {}) }),
6468
6508
  /* @__PURE__ */ b("button", { className: "icon-btn", "aria-label": "History", onClick: () => c("history"), children: [
6469
- /* @__PURE__ */ o(ts, {}),
6509
+ /* @__PURE__ */ o(rs, {}),
6470
6510
  " History"
6471
6511
  ] }),
6472
- /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Settings", onClick: () => c("settings"), children: /* @__PURE__ */ o(Xi, {}) }),
6512
+ /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Settings", onClick: () => c("settings"), children: /* @__PURE__ */ o(ts, {}) }),
6473
6513
  e && /* @__PURE__ */ o("button", { className: "icon-btn icon-only", "aria-label": "Close", onClick: e, children: "✕" })
6474
6514
  ] })
6475
6515
  ] }),
6476
6516
  /* @__PURE__ */ b("div", { className: "fc-body", children: [
6477
- /* @__PURE__ */ o("nav", { className: "fc-rail", "aria-label": "Calculators", children: Wr.map((x) => {
6517
+ /* @__PURE__ */ o("nav", { className: "fc-rail", "aria-label": "Calculators", children: Qr.map((x) => {
6478
6518
  const T = u.filter(($) => $.group === x.id);
6479
6519
  return T.length === 0 ? null : /* @__PURE__ */ b("div", { className: "rail-group", children: [
6480
6520
  /* @__PURE__ */ o("div", { className: "rail-group-label", children: x.label }),
@@ -6490,24 +6530,24 @@ function as({ onClose: e }) {
6490
6530
  ] }, x.id);
6491
6531
  }) }),
6492
6532
  /* @__PURE__ */ o("main", { className: "fc-main", children: /* @__PURE__ */ b("div", { className: "fc-anim-in", children: [
6493
- i === "settings" && /* @__PURE__ */ o(zi, {}),
6494
- i === "history" && /* @__PURE__ */ o(Ji, { items: y, onRestore: P, onClear: w }),
6495
- i === "integration" && /* @__PURE__ */ o(da, {}),
6533
+ i === "settings" && /* @__PURE__ */ o(Xi, {}),
6534
+ i === "history" && /* @__PURE__ */ o(Qi, { items: y, onRestore: P, onClear: w }),
6535
+ i === "integration" && /* @__PURE__ */ o(pa, {}),
6496
6536
  i === "calc" && /* @__PURE__ */ o(
6497
- ii,
6537
+ di,
6498
6538
  {
6499
6539
  def: F,
6500
6540
  seed: l,
6501
- customRegistry: ns,
6541
+ customRegistry: os,
6502
6542
  actions: (x, T) => x ? /* @__PURE__ */ b(re, { children: [
6503
6543
  /* @__PURE__ */ o(
6504
- Kn,
6544
+ zn,
6505
6545
  {
6506
6546
  item: { id: F.id, title: `${F.title} — ${x.primary.value}`, primary: x.primary.value, values: T }
6507
6547
  }
6508
6548
  ),
6509
6549
  /* @__PURE__ */ o(
6510
- Gn,
6550
+ Vn,
6511
6551
  {
6512
6552
  payload: {
6513
6553
  calculatorId: F.id,
@@ -6524,37 +6564,11 @@ function as({ onClose: e }) {
6524
6564
  )
6525
6565
  ] }, i === "calc" ? `calc:${F.id}` : i) })
6526
6566
  ] }),
6527
- h && /* @__PURE__ */ o(Zi, { calculators: u, actions: N, onPick: S, onClose: () => f(!1) })
6567
+ h && /* @__PURE__ */ o(es, { calculators: u, actions: N, onPick: S, onClose: () => f(!1) })
6528
6568
  ] });
6529
6569
  }
6530
- function Nn({ size: e = 22 }) {
6531
- return /* @__PURE__ */ b(
6532
- "svg",
6533
- {
6534
- width: e,
6535
- height: e,
6536
- viewBox: "0 0 24 24",
6537
- fill: "none",
6538
- stroke: "currentColor",
6539
- strokeWidth: 2,
6540
- strokeLinecap: "round",
6541
- strokeLinejoin: "round",
6542
- "aria-hidden": "true",
6543
- children: [
6544
- /* @__PURE__ */ o("rect", { x: "4", y: "2", width: "16", height: "20", rx: "2" }),
6545
- /* @__PURE__ */ o("line", { x1: "8", y1: "6", x2: "16", y2: "6" }),
6546
- /* @__PURE__ */ o("line", { x1: "8", y1: "10", x2: "8", y2: "10" }),
6547
- /* @__PURE__ */ o("line", { x1: "12", y1: "10", x2: "12", y2: "10" }),
6548
- /* @__PURE__ */ o("line", { x1: "16", y1: "10", x2: "16", y2: "10" }),
6549
- /* @__PURE__ */ o("line", { x1: "8", y1: "14", x2: "8", y2: "14" }),
6550
- /* @__PURE__ */ o("line", { x1: "12", y1: "14", x2: "12", y2: "14" }),
6551
- /* @__PURE__ */ o("line", { x1: "16", y1: "14", x2: "16", y2: "14" }),
6552
- /* @__PURE__ */ o("line", { x1: "8", y1: "18", x2: "12", y2: "18" })
6553
- ]
6554
- }
6555
- );
6556
- }
6557
- function gs({
6570
+ const Nn = ({ size: e = 22 }) => /* @__PURE__ */ o(ha, { size: e });
6571
+ function ws({
6558
6572
  variant: e = "fab",
6559
6573
  position: t = "bottom-right",
6560
6574
  hotkey: n = "mod+shift+k",
@@ -6578,7 +6592,7 @@ function gs({
6578
6592
  close: () => S(!1),
6579
6593
  toggle: () => S(!k)
6580
6594
  };
6581
- X(() => {
6595
+ Q(() => {
6582
6596
  if (!n) return;
6583
6597
  const x = n.includes("mod"), T = n.includes("shift"), $ = n.split("+").pop(), L = (B) => {
6584
6598
  (!x || B.metaKey || B.ctrlKey) && (!T || B.shiftKey) && B.key.toLowerCase() === $ && (B.preventDefault(), S(!k));
@@ -6591,12 +6605,12 @@ function gs({
6591
6605
  /* @__PURE__ */ o("span", { "aria-hidden": !0, style: { marginRight: 6, display: "inline-flex", alignItems: "center" }, children: m ?? /* @__PURE__ */ o(Nn, { size: 16 }) }),
6592
6606
  u
6593
6607
  ] }),
6594
- /* @__PURE__ */ o(Ca, { open: k, onClose: F.close, title: h, size: p, children: /* @__PURE__ */ o(as, { onClose: F.close }) })
6608
+ /* @__PURE__ */ o(Ra, { open: k, onClose: F.close, title: h, size: p, children: /* @__PURE__ */ o(is, { onClose: F.close }) })
6595
6609
  ] });
6596
6610
  }
6597
- const rs = 60 * 60 * 1e3, Nt = (e, t) => `${e}|${[...t].sort().join(",")}`;
6598
- function vs(e, t = {}) {
6599
- const n = t.ttlMs ?? rs, a = t.now ?? Date.now, r = /* @__PURE__ */ new Map();
6611
+ const ss = 60 * 60 * 1e3, Nt = (e, t) => `${e}|${[...t].sort().join(",")}`;
6612
+ function Ns(e, t = {}) {
6613
+ const n = t.ttlMs ?? ss, a = t.now ?? Date.now, r = /* @__PURE__ */ new Map();
6600
6614
  let s = null;
6601
6615
  function u(i) {
6602
6616
  var l;
@@ -6642,71 +6656,71 @@ function vs(e, t = {}) {
6642
6656
  clear: () => r.clear()
6643
6657
  };
6644
6658
  }
6645
- const ks = { solve: Ie, REGIONS: me };
6659
+ const xs = { solve: Ie, REGIONS: me };
6646
6660
  export {
6647
- ii as CalculatorPanel,
6648
- ao as Chart,
6649
- Zi as CommandPalette,
6650
- aa as CurrencyConverter,
6661
+ di as CalculatorPanel,
6662
+ lo as Chart,
6663
+ es as CommandPalette,
6664
+ oa as CurrencyConverter,
6651
6665
  g as D,
6652
- ys as DEFAULT_ENVELOPE,
6653
- Ze as DEFAULT_SETTINGS,
6666
+ vs as DEFAULT_ENVELOPE,
6667
+ Qe as DEFAULT_SETTINGS,
6654
6668
  H as Decimal,
6655
- Ca as Dialog,
6656
- ro as EXPORT_FORMATS,
6657
- Gn as ExportMenu,
6658
- Jr as Field,
6659
- Ca as FinCalcDialog,
6669
+ Ra as Dialog,
6670
+ co as EXPORT_FORMATS,
6671
+ Vn as ExportMenu,
6672
+ to as Field,
6673
+ Ra as FinCalcDialog,
6660
6674
  se as FinCalcError,
6661
- gs as FinCalcLauncher,
6662
- ms as FinCalcProvider,
6663
- as as FinCalcRoot,
6664
- Wr as GROUPS,
6665
- Ji as HistoryPanel,
6666
- da as IntegrationPanel,
6667
- gs as Launcher,
6668
- Wn as LoanEmiPanel,
6669
- ba as POLICY_DEFAULT,
6670
- Qr as ResultCard,
6671
- Kn as SaveButton,
6672
- no as ScheduleTable,
6673
- Jn as SciCalculator,
6674
- zi as SettingsPanel,
6675
- ms as SettingsProvider,
6676
- as as Shell,
6677
- Dn as allCalculators,
6675
+ ws as FinCalcLauncher,
6676
+ fs as FinCalcProvider,
6677
+ is as FinCalcRoot,
6678
+ Qr as GROUPS,
6679
+ Qi as HistoryPanel,
6680
+ pa as IntegrationPanel,
6681
+ ws as Launcher,
6682
+ Jn as LoanEmiPanel,
6683
+ ka as POLICY_DEFAULT,
6684
+ ro as ResultCard,
6685
+ zn as SaveButton,
6686
+ so as ScheduleTable,
6687
+ Xn as SciCalculator,
6688
+ Xi as SettingsPanel,
6689
+ fs as SettingsProvider,
6690
+ is as Shell,
6691
+ Un as allCalculators,
6678
6692
  ye as boolval,
6679
- oa as buildFilename,
6680
- Ti as buildPayload,
6681
- bs as buildSavePayload,
6693
+ sa as buildFilename,
6694
+ Ri as buildPayload,
6695
+ ks as buildSavePayload,
6682
6696
  Rt as calculatorById,
6683
- Kr as calculatorsForRegion,
6684
- Eo as clearHistory,
6685
- To as createExporter,
6686
- vs as createFxCache,
6687
- fi as createTransport,
6688
- fs as currency,
6697
+ Xr as calculatorsForRegion,
6698
+ Lo as clearHistory,
6699
+ Mo as createExporter,
6700
+ Ns as createFxCache,
6701
+ gi as createTransport,
6702
+ gs as currency,
6689
6703
  D as dmoney,
6690
- cs as eq,
6704
+ ms as eq,
6691
6705
  on as evalExpression,
6692
- Zo as evaluateExpression,
6693
- ti as fetchLiveRate,
6694
- ps as finance,
6695
- us as gt,
6706
+ ni as evaluateExpression,
6707
+ ii as fetchLiveRate,
6708
+ ys as finance,
6709
+ ps as gt,
6696
6710
  ce as isZeroish,
6697
- ks as loan,
6698
- ds as lt,
6711
+ xs as loan,
6712
+ hs as lt,
6699
6713
  Sn as makeFormatter,
6700
6714
  v as metric,
6701
6715
  C as numval,
6702
- Vo as parseExpression,
6716
+ Jo as parseExpression,
6703
6717
  xt as regionDefaults,
6704
- hs as registerCalculator,
6705
- pi as sanitizeFilename,
6706
- Yn as saveHistory,
6718
+ bs as registerCalculator,
6719
+ yi as sanitizeFilename,
6720
+ Wn as saveHistory,
6707
6721
  Ie as solveLoan,
6708
6722
  _ as strval,
6709
6723
  ue as useFinCalc,
6710
- Mo as useHistory,
6724
+ Uo as useHistory,
6711
6725
  ue as useSettings
6712
6726
  };