numora 3.1.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,25 +1,25 @@
1
- var re = Object.defineProperty;
2
- var ie = (e, t, n) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var $ = (e, t, n) => ie(e, typeof t != "symbol" ? t + "" : t, n);
4
- var b = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(b || {}), p = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e))(p || {});
5
- const x = 2, G = 0, Z = b.Blur, k = ",", B = p.None, N = ".", P = !1, W = !1, U = !1, z = !1;
6
- function w(e) {
1
+ var ne = Object.defineProperty;
2
+ var re = (e, t, n) => t in e ? ne(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var w = (e, t, n) => re(e, typeof t != "symbol" ? t + "" : t, n);
4
+ var N = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(N || {}), p = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e.Locale = "locale", e))(p || {});
5
+ const G = 2, B = 0, Z = N.Blur, ie = ",", H = p.None, C = ".", k = !1, W = !1, U = !1, z = !1;
6
+ function y(e) {
7
7
  return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
8
8
  }
9
9
  const J = /* @__PURE__ */ new Map();
10
- function I(e, t = "g") {
10
+ function T(e, t = "g") {
11
11
  const n = `${e}:${t}`;
12
12
  let r = J.get(n);
13
13
  return r || (r = new RegExp(e, t), J.set(n, r)), r;
14
14
  }
15
15
  function se(e, t = "g") {
16
- const n = w(e);
17
- return I(n, t);
16
+ const n = y(e);
17
+ return T(n, t);
18
18
  }
19
19
  const ae = /[.,]/g;
20
- function T(e) {
20
+ function _(e) {
21
21
  return {
22
- decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? N,
22
+ decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? C,
23
23
  thousandSeparator: e == null ? void 0 : e.thousandSeparator
24
24
  };
25
25
  }
@@ -36,37 +36,37 @@ function ce(e, t) {
36
36
  const { selectionStart: n, selectionEnd: r, value: i } = e;
37
37
  return !i.slice(n ?? 0, r ?? 0).includes(t);
38
38
  }
39
- function oe(e, t, n) {
39
+ function le(e, t, n) {
40
40
  const { key: r } = e;
41
41
  if (r !== "," && r !== ".") return !1;
42
42
  if (ce(t, n))
43
43
  return !0;
44
44
  if (r !== n) {
45
- const { selectionStart: i, selectionEnd: s, value: a } = t, c = i ?? 0, l = s ?? c;
46
- t.value = a.slice(0, c) + n + a.slice(l);
47
- const o = c + 1;
48
- return t.setSelectionRange(o, o), !0;
45
+ const { selectionStart: i, selectionEnd: s, value: a } = t, c = i ?? 0, o = s ?? c;
46
+ t.value = a.slice(0, c) + n + a.slice(o);
47
+ const l = c + 1;
48
+ return t.setSelectionRange(l, l), !0;
49
49
  }
50
50
  return !1;
51
51
  }
52
- const le = (e, t, n = N) => {
52
+ const oe = (e, t, n = C) => {
53
53
  const { sign: r, integer: i, decimal: s } = Y(e, n);
54
54
  if (!s) return e;
55
55
  const a = s.slice(0, t);
56
56
  return `${r}${i}${n}${a}`;
57
- }, he = (e, t = N) => {
57
+ }, he = (e, t = C) => {
58
58
  const n = e.indexOf(t);
59
59
  if (n === -1 || n === e.length - 1) return e;
60
- const r = e.slice(0, n + 1), i = e.slice(n + 1), a = t === "." || t === "," ? ae : I("[,\\." + w(t) + "]", "g");
60
+ const r = e.slice(0, n + 1), i = e.slice(n + 1), a = t === "." || t === "," ? ae : T("[,\\." + y(t) + "]", "g");
61
61
  return r + i.replace(a, "");
62
- }, ue = (e, t = 0, n = N) => {
62
+ }, ue = (e, t = 0, n = C) => {
63
63
  if (t <= 0) return e;
64
64
  const { sign: r, integer: i, decimal: s } = Y(e, n);
65
65
  if (s.length >= t)
66
66
  return e;
67
67
  const a = s.padEnd(t, "0");
68
68
  return `${r}${i}${n}${a}`;
69
- }, v = {
69
+ }, D = {
70
70
  thousand: { size: 3 },
71
71
  lakh: { firstGroup: 3, restGroup: 2 },
72
72
  wan: { size: 4 }
@@ -74,65 +74,65 @@ const le = (e, t, n = N) => {
74
74
  function Q(e, t, n = p.Thousand, r = !1, i = ".") {
75
75
  if (!e || e === "0" || e === i || e === "-" || e === `-${i}`)
76
76
  return e;
77
- const s = e.includes(i), a = e.startsWith("-"), c = a ? e.slice(1) : e, [l, o] = c.split(i);
78
- if (!l) {
79
- const u = o ? `${i}${o}` : c;
77
+ const s = e.includes(i), a = e.startsWith("-"), c = a ? e.slice(1) : e, [o, l] = c.split(i);
78
+ if (!o) {
79
+ const u = l ? `${i}${l}` : c;
80
80
  return a ? `-${u}` : u;
81
81
  }
82
- if (r && l.startsWith("0") && l.length > 1) {
83
- const u = l.match(de);
82
+ if (r && o.startsWith("0") && o.length > 1) {
83
+ const u = o.match(de);
84
84
  if (u) {
85
- const g = u[1], f = l.slice(g.length);
86
- if (f) {
87
- const S = X(f, t, n), E = g + S, m = a ? "-" : "";
88
- return s ? o ? `${m}${E}${i}${o}` : `${m}${E}${i}` : `${m}${E}`;
85
+ const S = u[1], E = o.slice(S.length);
86
+ if (E) {
87
+ const m = P(E, t, n), f = S + m, g = a ? "-" : "";
88
+ return s ? l ? `${g}${f}${i}${l}` : `${g}${f}${i}` : `${g}${f}`;
89
89
  }
90
90
  }
91
91
  }
92
- const h = X(l, t, n), d = a ? "-" : "";
93
- return s ? o ? `${d}${h}${i}${o}` : `${d}${h}${i}` : `${d}${h}`;
92
+ const h = P(o, t, n), d = a ? "-" : "";
93
+ return s ? l ? `${d}${h}${i}${l}` : `${d}${h}${i}` : `${d}${h}`;
94
94
  }
95
- function X(e, t, n) {
95
+ function P(e, t, n) {
96
96
  if (e === "0" || e === "")
97
97
  return e;
98
98
  switch (n) {
99
99
  case p.None:
100
100
  return e;
101
101
  case p.Thousand:
102
- return j(e, t, v.thousand.size);
102
+ return X(e, t, D.thousand.size);
103
103
  case p.Lakh:
104
104
  return fe(e, t);
105
105
  case p.Wan:
106
- return j(e, t, v.wan.size);
106
+ return X(e, t, D.wan.size);
107
107
  default:
108
108
  return e;
109
109
  }
110
110
  }
111
111
  function fe(e, t) {
112
- if (e.length <= v.lakh.firstGroup)
112
+ if (e.length <= D.lakh.firstGroup)
113
113
  return e;
114
- const n = [], r = e.length - v.lakh.firstGroup;
114
+ const n = [], r = e.length - D.lakh.firstGroup;
115
115
  n.unshift(e.slice(r));
116
- for (let i = r; i > 0; i -= v.lakh.restGroup)
117
- n.unshift(e.slice(Math.max(0, i - v.lakh.restGroup), i));
116
+ for (let i = r; i > 0; i -= D.lakh.restGroup)
117
+ n.unshift(e.slice(Math.max(0, i - D.lakh.restGroup), i));
118
118
  return n.join(t);
119
119
  }
120
- function j(e, t, n) {
120
+ function X(e, t, n) {
121
121
  const r = [];
122
122
  for (let i = e.length; i > 0; i -= n)
123
123
  r.unshift(e.slice(Math.max(0, i - n), i));
124
124
  return r.join(t);
125
125
  }
126
126
  function ge(e, t, n) {
127
- return (t == null ? void 0 : t.formatOn) === b.Change && t.thousandSeparator ? Q(
127
+ return (t == null ? void 0 : t.formatOn) === N.Change && t.thousandSeparator ? Q(
128
128
  e,
129
129
  t.thousandSeparator,
130
130
  t.ThousandStyle ?? p.None,
131
131
  t.enableLeadingZeros,
132
- (n == null ? void 0 : n.decimalSeparator) ?? N
132
+ (n == null ? void 0 : n.decimalSeparator) ?? C
133
133
  ) : e;
134
134
  }
135
- function L(e, t, n) {
135
+ function $(e, t, n) {
136
136
  let r = 0;
137
137
  for (let i = 0; i < t && i < e.length; i++)
138
138
  e[i] !== n && r++;
@@ -150,7 +150,7 @@ function Se(e, t, n) {
150
150
  }
151
151
  return e.length;
152
152
  }
153
- function y(e, t, n) {
153
+ function R(e, t, n) {
154
154
  if (t === 0)
155
155
  return 0;
156
156
  let r = 0;
@@ -167,7 +167,7 @@ function V(e, t, n) {
167
167
  return t < 0 || t >= e.length ? !1 : e[t] === n;
168
168
  }
169
169
  const Ee = /\d/;
170
- function pe(e, t = {}) {
170
+ function me(e, t = {}) {
171
171
  const {
172
172
  thousandSeparator: n,
173
173
  decimalSeparator: r = ".",
@@ -179,14 +179,22 @@ function pe(e, t = {}) {
179
179
  a.fill(!1, c + 1, e.length + 1);
180
180
  }
181
181
  for (let c = 0; c < e.length; c++) {
182
- const l = e[c];
183
- (n && l === n || l === r) && (a[c] = !1, c + 1 < e.length && !Ee.test(e[c + 1]) && (a[c + 1] = !1));
182
+ const o = e[c];
183
+ (n && o === n || o === r) && (a[c] = !1, c + 1 < e.length && !Ee.test(e[c + 1]) && (a[c + 1] = !1));
184
184
  }
185
185
  return a.some((c) => c) || a.fill(!0), a;
186
186
  }
187
- function _(e, t, n, r) {
187
+ function x(e, t, n, r) {
188
188
  const i = e.length;
189
- if (t = Math.max(0, Math.min(t, i)), !n[t]) {
189
+ if (t = Math.max(0, Math.min(t, i)), r === "left") {
190
+ for (; t >= 0 && !n[t]; )
191
+ t--;
192
+ t === -1 && (t = n.indexOf(!0));
193
+ } else if (r === "right") {
194
+ for (; t <= i && !n[t]; )
195
+ t++;
196
+ t > i && (t = n.lastIndexOf(!0));
197
+ } else if (!n[t]) {
190
198
  let s = t;
191
199
  for (; s <= i && !n[s]; )
192
200
  s++;
@@ -197,133 +205,152 @@ function _(e, t, n, r) {
197
205
  }
198
206
  return (t === -1 || t > i) && (t = i), t;
199
207
  }
200
- const K = /(\d+\.?\d*)\s*[kmbt]$/i, F = (e, t) => e === t;
208
+ const j = /(\d+\.?\d*)\s*[kmbt]$/i, pe = (e, t) => e === t;
201
209
  function be(e, t, n, r, i, s, a = ".", c = {}) {
202
210
  if (n < 0)
203
211
  return 0;
204
- if (n > e.length || e === "" || t === "" || K.test(e) && !K.test(t) && t.length > e.length && n >= e.length - 1)
212
+ if (n > e.length || e === "" || t === "" || j.test(e) && !j.test(t) && t.length > e.length && n >= e.length - 1)
205
213
  return t.length;
206
- const l = t.length < e.length, o = V(
214
+ const o = t.length < e.length, l = V(
207
215
  e,
208
216
  n,
209
217
  r
210
218
  ), h = e.indexOf(a), d = t.indexOf(a);
211
219
  if (c.isCharacterEquivalent && e !== t) {
212
- const E = me(
220
+ const f = {
221
+ thousandSeparator: r || void 0,
222
+ ...c
223
+ }, g = Le(
213
224
  e,
214
225
  t,
215
226
  n,
216
- c.isCharacterEquivalent || F,
227
+ c.isCharacterEquivalent || pe,
217
228
  s,
218
- c
229
+ f
219
230
  );
220
- if (E !== void 0)
221
- return E;
231
+ if (g !== void 0)
232
+ return g;
222
233
  }
223
- const g = /* @__PURE__ */ new Map(), f = (E, m, te) => {
224
- const C = `${E === e ? "o" : "n"}:${m}`;
225
- return g.has(C) || g.set(C, L(E, m, r)), g.get(C);
234
+ const S = /* @__PURE__ */ new Map(), E = (f, g, L) => {
235
+ const b = `${f === e ? "o" : "n"}:${g}`;
236
+ return S.has(b) || S.set(b, $(f, g, r)), S.get(b);
226
237
  };
227
- if (l)
238
+ if (o)
228
239
  return Ne(
229
240
  e,
230
241
  t,
231
242
  n,
232
243
  r,
233
- o,
244
+ l,
234
245
  h,
235
246
  d,
236
247
  s,
237
248
  c,
238
- f
249
+ E
239
250
  );
240
- const S = ve(
251
+ const m = Ce(
241
252
  e,
242
253
  t,
243
254
  n,
244
255
  r,
245
- o,
246
- f
256
+ l,
257
+ E
247
258
  );
248
- return c.boundary ? _(t, S, c.boundary) : S;
259
+ return c.boundary ? x(t, m, c.boundary) : m;
249
260
  }
250
- function me(e, t, n, r, i, s) {
261
+ function Le(e, t, n, r, i, s) {
251
262
  const a = e.length, c = t.length;
252
- let l = 0, o = 0, h = c;
253
- for (let u = 0; u < a; u++) {
254
- let g = -1;
255
- for (let f = l; f < c; f++)
263
+ let o = 0, l = 0, h = c;
264
+ for (let g = 0; g < a; g++) {
265
+ let L = -1;
266
+ for (let b = o; b < c; b++)
256
267
  if (r(
257
- e[u],
258
- t[f],
268
+ e[g],
269
+ t[b],
259
270
  {
260
271
  oldValue: e,
261
272
  newValue: t,
262
273
  typedRange: i,
263
- oldIndex: u,
264
- newIndex: f
274
+ oldIndex: g,
275
+ newIndex: b
265
276
  }
266
277
  )) {
267
- g = f;
278
+ L = b;
268
279
  break;
269
280
  }
270
- g !== -1 && (l = g + 1, u < n ? o = g + 1 : h === c && /\d/.test(e[u]) && (h = g));
281
+ L !== -1 && (o = L + 1, g < n ? l = L + 1 : h === c && /\d/.test(e[g]) && (h = L));
271
282
  }
272
- if (o > h) return h;
273
- const d = n - o < h - n ? o : h;
274
- return s.boundary ? _(t, d, s.boundary) : d;
283
+ if (l > h) return h;
284
+ const d = t.length < e.length || i !== void 0 && i.isDelete === !1;
285
+ let u, S = !1, E = !1;
286
+ if (d) {
287
+ u = l;
288
+ const g = s.thousandSeparator, L = s.decimalSeparator ?? ".", b = u < t.length ? t[u] : "";
289
+ g && b === g ? (n > 0 ? e[n - 1] : "") === g ? (u = h, S = !0) : E = !0 : b === L && (E = !0);
290
+ } else
291
+ u = n - l < h - n ? l : h;
292
+ const m = d && !S ? "left" : "right";
293
+ if (s.boundary)
294
+ return E ? u : x(t, u, s.boundary, m);
295
+ const f = s.thousandSeparator;
296
+ if (!E && f && u >= 0 && u < t.length && t[u] === f)
297
+ if (d && !S)
298
+ for (; u > 0 && t[u] === f; ) u--;
299
+ else
300
+ for (; u < t.length && t[u] === f; ) u++;
301
+ return u;
275
302
  }
276
- function Ne(e, t, n, r, i, s, a, c, l = {}, o = L) {
303
+ function Ne(e, t, n, r, i, s, a, c, o = {}, l = $) {
277
304
  if (i)
278
- return Le(
305
+ return $e(
279
306
  e,
280
307
  t,
281
308
  n,
282
309
  r,
283
310
  a,
284
- o
311
+ l
285
312
  );
286
- const h = o(e, n, r), d = o(e, e.length, r), u = o(t, t.length, r), g = d - u, f = $e(
313
+ const h = l(e, n, r), d = l(e, e.length, r), u = l(t, t.length, r), S = d - u, E = ve(
287
314
  e,
288
315
  n,
289
316
  r,
290
317
  h,
291
- g,
318
+ S,
292
319
  s,
293
320
  c,
294
- o
295
- ), S = s === -1 || n <= s, E = De(
321
+ l
322
+ ), m = s === -1 || n <= s, f = De(
296
323
  t,
297
- f,
324
+ E,
298
325
  r,
299
- g,
300
- c,
301
326
  S,
327
+ c,
328
+ m,
302
329
  a,
303
- o
330
+ l
304
331
  );
305
- return l.boundary ? _(t, E, l.boundary) : E;
332
+ return o.boundary ? x(t, f, o.boundary) : f;
306
333
  }
307
- function Le(e, t, n, r, i, s = L) {
334
+ function $e(e, t, n, r, i, s = $) {
308
335
  const a = n + 1;
309
336
  if (a < e.length) {
310
- const c = s(e, a, r), l = Se(
337
+ const c = s(e, a, r), o = Se(
311
338
  t,
312
339
  c,
313
340
  r
314
341
  );
315
- return l < t.length && t[l] !== r ? l + 1 : l;
342
+ return o < t.length && t[o] !== r ? o + 1 : o;
316
343
  }
317
344
  return n;
318
345
  }
319
- function $e(e, t, n, r, i, s, a, c = L) {
346
+ function ve(e, t, n, r, i, s, a, c = $) {
320
347
  if (a) {
321
- const { start: o, isDelete: h } = a;
322
- return h ? c(e, o, n) : Math.max(0, c(e, o, n));
348
+ const { start: l, isDelete: h } = a;
349
+ return h ? c(e, l, n) : Math.max(0, c(e, l, n));
323
350
  }
324
351
  return t > 0 && e[t - 1] === n && i > 0 ? r + 1 : r;
325
352
  }
326
- function q(e, t, n, r, i, s, a = L) {
353
+ function K(e, t, n, r, i, s, a = $) {
327
354
  if (t > 0 && t < e.length && a(e, t, r) === n) {
328
355
  if (e[t] === r && s && i > 0 && t < e.length - 1)
329
356
  return t + 1;
@@ -332,33 +359,33 @@ function q(e, t, n, r, i, s, a = L) {
332
359
  }
333
360
  return t;
334
361
  }
335
- function De(e, t, n, r, i, s, a, c = L) {
362
+ function De(e, t, n, r, i, s, a, c = $) {
336
363
  if (s && a !== -1) {
337
- const o = e.substring(0, a), h = c(o, o.length, n);
364
+ const l = e.substring(0, a), h = c(l, l.length, n);
338
365
  if (t <= h) {
339
- const d = y(
340
- o,
366
+ const d = R(
367
+ l,
341
368
  t,
342
369
  n
343
370
  );
344
- return q(o, d, t, n, r, i, c);
371
+ return K(l, d, t, n, r, i, c);
345
372
  }
346
373
  }
347
- const l = y(
374
+ const o = R(
348
375
  e,
349
376
  t,
350
377
  n
351
378
  );
352
- return q(e, l, t, n, r, i, c);
379
+ return K(e, o, t, n, r, i, c);
353
380
  }
354
- function ve(e, t, n, r, i, s = L) {
355
- const a = n >= e.length, c = s(e, n, r), l = s(e, e.length, r), o = s(t, t.length, r);
356
- if (a || c === l)
381
+ function Ce(e, t, n, r, i, s = $) {
382
+ const a = n >= e.length, c = s(e, n, r), o = s(e, e.length, r), l = s(t, t.length, r);
383
+ if (a || c === o)
357
384
  return t.length;
358
- const h = o - l;
385
+ const h = l - o;
359
386
  let d = c;
360
- h > 0 && !a && c < l && (d = c + 1);
361
- const u = y(
387
+ h > 0 && !a && c < o && (d = c + 1);
388
+ const u = R(
362
389
  t,
363
390
  d,
364
391
  r
@@ -385,16 +412,16 @@ function we(e, t, n) {
385
412
  isDelete: !0
386
413
  };
387
414
  }
388
- const c = t.length, l = n.length, o = c - l;
389
- if (!(o <= 0))
415
+ const c = t.length, o = n.length, l = c - o;
416
+ if (!(l <= 0))
390
417
  return {
391
418
  start: r,
392
- end: r + o,
393
- deletedLength: o,
419
+ end: r + l,
420
+ deletedLength: l,
394
421
  isDelete: !1
395
422
  };
396
423
  }
397
- function Ce(e, t) {
424
+ function ye(e, t) {
398
425
  if (e === t)
399
426
  return;
400
427
  let n = 0;
@@ -412,7 +439,7 @@ function Ce(e, t) {
412
439
  isDelete: s > a
413
440
  };
414
441
  }
415
- function H(e, t) {
442
+ function q(e, t) {
416
443
  if (e.value = e.value, e === null)
417
444
  return !1;
418
445
  if (e.createTextRange) {
@@ -422,15 +449,15 @@ function H(e, t) {
422
449
  return e.selectionStart !== null || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
423
450
  }
424
451
  function Me(e, t, n) {
425
- return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (H(e, t), setTimeout(() => {
426
- e.value === n && e.selectionStart !== t && H(e, t);
452
+ return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (q(e, t), setTimeout(() => {
453
+ e.value === n && e.selectionStart !== t && q(e, t);
427
454
  }, 0));
428
455
  }
429
456
  function Ae(e) {
430
457
  return Math.max(e.selectionStart, e.selectionEnd);
431
458
  }
432
- function Re(e, t, n) {
433
- if ((n == null ? void 0 : n.formatOn) !== b.Change || !n.thousandSeparator)
459
+ function Ie(e, t, n) {
460
+ if ((n == null ? void 0 : n.formatOn) !== N.Change || !n.thousandSeparator)
434
461
  return;
435
462
  const { selectionStart: r, selectionEnd: i, value: s } = t;
436
463
  if (r === null || i === null || r !== i)
@@ -438,52 +465,56 @@ function Re(e, t, n) {
438
465
  const { key: a } = e, c = n.thousandSeparator;
439
466
  a === "Backspace" && r > 0 && s[r - 1] === c && t.setSelectionRange(r - 1, r - 1), a === "Delete" && s[r] === c && t.setSelectionRange(r + 1, r + 1);
440
467
  }
441
- function ye(e, t, n, r, i, s, a) {
468
+ function Re(e, t, n, r, i, s, a) {
442
469
  if (!i) return;
443
- const { selectionStart: c = 0, selectionEnd: l = 0, endOffset: o = 0 } = i;
470
+ const { selectionStart: c = 0, selectionEnd: o = 0, endOffset: l = 0 } = i;
444
471
  let h = we(
445
- { selectionStart: c, selectionEnd: l, endOffset: o },
472
+ { selectionStart: c, selectionEnd: o, endOffset: l },
446
473
  t,
447
474
  n
448
475
  );
449
- if (h || (h = Ce(t, n)), !h) return;
450
- const d = pe(n, {
476
+ if (h || (h = ye(t, n)), !h) return;
477
+ const d = me(n, {
451
478
  thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator,
452
479
  decimalSeparator: s.decimalSeparator
453
480
  }), u = {
454
481
  thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator,
455
- isCharacterEquivalent: F,
482
+ decimalSeparator: s.decimalSeparator,
483
+ isCharacterEquivalent: (f, g) => {
484
+ const L = (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator;
485
+ return L && f === L ? !1 : f === g;
486
+ },
456
487
  boundary: d
457
- }, g = (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator ?? ",", f = (a == null ? void 0 : a.ThousandStyle) ?? p.None, S = be(
488
+ }, S = (a == null ? void 0 : a.thousandSeparator) ?? s.thousandSeparator ?? ",", E = (a == null ? void 0 : a.ThousandStyle) ?? p.None, m = be(
458
489
  t,
459
490
  n,
460
491
  r,
461
- g,
462
- f,
492
+ S,
493
+ E,
463
494
  h,
464
495
  s.decimalSeparator,
465
496
  u
466
497
  );
467
- Me(e, S, n);
498
+ Me(e, m, n);
468
499
  }
469
- const Ie = (e, t = !1, n = ".") => {
470
- const r = w(n), i = I(`[^0-9${r}]`, "g");
500
+ const Te = (e, t = !1, n = ".") => {
501
+ const r = y(n), i = T(`[^0-9${r}]`, "g");
471
502
  if (!t)
472
503
  return e.replace(i, "");
473
504
  const s = e.startsWith("-"), a = e.replace(i, "");
474
505
  return s && (a.length > 0 || e === "-") ? "-" + a : a;
475
- }, Te = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g, ee = /^0+$/, A = /\.?0+$/;
476
- function _e(e) {
477
- return !e.includes("e") && !e.includes("E") ? e : e.replace(Te, (t, n, r) => {
506
+ }, _e = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g, F = /^0+$/, A = /\.?0+$/;
507
+ function xe(e) {
508
+ return !e.includes("e") && !e.includes("E") ? e : e.replace(_e, (t, n, r) => {
478
509
  const i = parseInt(r, 10);
479
510
  if (i === 0) return n;
480
- const s = n.startsWith("-"), a = s ? n.slice(1) : n, [c, l = ""] = a.split("."), o = i > 0 ? Oe(c, l, i) : xe(c, l, Math.abs(i));
481
- return s ? "-" + o : o;
511
+ const s = n.startsWith("-"), a = s ? n.slice(1) : n, [c, o = ""] = a.split("."), l = i > 0 ? Oe(c, o, i) : Ge(c, o, Math.abs(i));
512
+ return s ? "-" + l : l;
482
513
  });
483
514
  }
484
515
  function Oe(e, t, n) {
485
516
  const r = e + t;
486
- if (r === "0" || ee.test(r))
517
+ if (r === "0" || F.test(r))
487
518
  return "0";
488
519
  const i = t.length;
489
520
  if (n <= i) {
@@ -493,22 +524,22 @@ function Oe(e, t, n) {
493
524
  const s = n - i;
494
525
  return r + "0".repeat(s);
495
526
  }
496
- function xe(e, t, n) {
527
+ function Ge(e, t, n) {
497
528
  const r = e + t;
498
- if (r === "0" || ee.test(r))
529
+ if (r === "0" || F.test(r))
499
530
  return "0";
500
531
  const s = e.length - n;
501
532
  if (s <= 0) {
502
533
  const a = Math.abs(s), c = `0.${"0".repeat(a)}${r}`;
503
- return R(c);
534
+ return I(c);
504
535
  }
505
536
  if (s < e.length) {
506
- const a = r.slice(0, s), c = r.slice(s), l = `${a}.${c}`;
507
- return R(l);
537
+ const a = r.slice(0, s), c = r.slice(s), o = `${a}.${c}`;
538
+ return I(o);
508
539
  }
509
- return R(r);
540
+ return I(r);
510
541
  }
511
- function R(e) {
542
+ function I(e) {
512
543
  if (!e.includes("."))
513
544
  return e;
514
545
  if (e === "0.")
@@ -523,7 +554,7 @@ function R(e) {
523
554
  }
524
555
  return e.replace(A, "") || e;
525
556
  }
526
- const Ge = /(\d+\.?\d*)\s*([kmbt])/gi, Ze = /^0+/, ke = /^(-?)0+([1-9])/, Be = /^-?0+$/, Pe = /\.?0+$/, We = {
557
+ const Be = /(\d+\.?\d*)\s*([kmbt])/gi, Ze = /^0+/, ke = /^(-?)0+([1-9])/, We = /^-?0+$/, Ue = /\.?0+$/, ze = {
527
558
  k: 3,
528
559
  // Thousand
529
560
  m: 6,
@@ -533,26 +564,26 @@ const Ge = /(\d+\.?\d*)\s*([kmbt])/gi, Ze = /^0+/, ke = /^(-?)0+([1-9])/, Be = /
533
564
  t: 12
534
565
  // Trillion
535
566
  };
536
- function Ue(e) {
537
- return e.replace(Ge, (t, n, r) => {
538
- const i = r.toLowerCase(), s = We[i];
567
+ function Je(e) {
568
+ return e.replace(Be, (t, n, r) => {
569
+ const i = r.toLowerCase(), s = ze[i];
539
570
  if (!s)
540
571
  return t;
541
- const [a, c = ""] = n.split("."), l = a.replace(Ze, "") || "0";
542
- let o;
572
+ const [a, c = ""] = n.split("."), o = a.replace(Ze, "") || "0";
573
+ let l;
543
574
  if (c.length === 0)
544
- o = l + "0".repeat(s);
575
+ l = o + "0".repeat(s);
545
576
  else if (c.length <= s) {
546
577
  const h = s - c.length;
547
- o = l + c + "0".repeat(h);
578
+ l = o + c + "0".repeat(h);
548
579
  } else {
549
580
  const h = c.slice(0, s), d = c.slice(s);
550
- o = l + h + "." + d;
581
+ l = o + h + "." + d;
551
582
  }
552
- return o = o.replace(ke, "$1$2"), Be.test(o) && (o = "0"), o.includes(".") && (o = o.replace(Pe, "")), o;
583
+ return l = l.replace(ke, "$1$2"), We.test(l) && (l = "0"), l.includes(".") && (l = l.replace(Ue, "")), l;
553
584
  });
554
585
  }
555
- function ze(e) {
586
+ function Pe(e) {
556
587
  if (!e || e === "0" || e === "-0" || e === "-" || e === ".")
557
588
  return e;
558
589
  const t = e.startsWith("-"), n = t ? e.slice(1) : e;
@@ -572,22 +603,22 @@ function ze(e) {
572
603
  }
573
604
  return e;
574
605
  }
575
- function Je(e) {
606
+ function Xe(e) {
576
607
  return e.replace(/[\s\u200B]/g, "");
577
608
  }
578
- function D(e, t) {
609
+ function v(e, t) {
579
610
  const n = se(t);
580
611
  return e.replace(n, "");
581
612
  }
582
- const Xe = (e, t) => {
583
- let n = Je(e);
584
- return t != null && t.thousandSeparator && (n = D(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Ue(n)), n = _e(n), n = Ie(
613
+ const je = (e, t) => {
614
+ let n = Xe(e);
615
+ return t != null && t.thousandSeparator && (n = v(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Je(n)), n = xe(n), n = Te(
585
616
  n,
586
617
  t == null ? void 0 : t.enableNegative,
587
618
  t == null ? void 0 : t.decimalSeparator
588
- ), n = he(n, t == null ? void 0 : t.decimalSeparator), t != null && t.enableLeadingZeros || (n = ze(n)), n;
619
+ ), n = he(n, t == null ? void 0 : t.decimalSeparator), t != null && t.enableLeadingZeros || (n = Pe(n)), n;
589
620
  };
590
- function je(e, t, n) {
621
+ function Ke(e, t, n) {
591
622
  return {
592
623
  enableCompactNotation: e == null ? void 0 : e.enableCompactNotation,
593
624
  enableNegative: e == null ? void 0 : e.enableNegative,
@@ -597,21 +628,21 @@ function je(e, t, n) {
597
628
  };
598
629
  }
599
630
  function O(e, t, n, r) {
600
- const i = T(n), s = r ?? (n == null ? void 0 : n.formatOn) === b.Change, a = Xe(
631
+ const i = _(n), s = r ?? (n == null ? void 0 : n.formatOn) === N.Change, a = je(
601
632
  e,
602
- je(n, i, s)
603
- ), c = le(
633
+ Ke(n, i, s)
634
+ ), c = oe(
604
635
  a,
605
636
  t,
606
637
  i.decimalSeparator
607
- ), l = (n == null ? void 0 : n.decimalMinLength) ?? 0, o = ue(
638
+ ), o = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = ue(
608
639
  c,
609
- l,
640
+ o,
610
641
  i.decimalSeparator
611
642
  );
612
- return { formatted: ge(o, n, i), raw: o };
643
+ return { formatted: ge(l, n, i), raw: l };
613
644
  }
614
- function ht(e, t, n) {
645
+ function ft(e, t, n) {
615
646
  const r = !!(n != null && n.thousandSeparator);
616
647
  return O(
617
648
  e,
@@ -620,7 +651,7 @@ function ht(e, t, n) {
620
651
  r
621
652
  );
622
653
  }
623
- function Ke(e, t, n) {
654
+ function qe(e, t, n) {
624
655
  if (e === "Backspace" || e === "Delete")
625
656
  return e === "Delete" && t === n ? {
626
657
  endOffset: 1
@@ -628,61 +659,81 @@ function Ke(e, t, n) {
628
659
  endOffset: 0
629
660
  };
630
661
  }
631
- function qe(e, t) {
632
- const { decimalSeparator: n } = T(t), r = e.target;
633
- if (oe(e, r, n)) {
662
+ function He(e, t) {
663
+ const { decimalSeparator: n } = _(t), r = e.target;
664
+ if (le(e, r, n)) {
634
665
  e.preventDefault();
635
666
  return;
636
667
  }
637
- return Re(e, r, t), Ke(e.key, r.selectionStart, r.selectionEnd);
668
+ return Ie(e, r, t), qe(e.key, r.selectionStart, r.selectionEnd);
638
669
  }
639
- function He(e, t, n, r) {
640
- const i = e.target, s = i.value, a = Ae(i), c = T(r), l = (r == null ? void 0 : r.formatOn) === b.Change, { formatted: o, raw: h } = O(
670
+ function Ye(e, t, n, r) {
671
+ const i = e.target, s = i.value, a = Ae(i), c = _(r), o = (r == null ? void 0 : r.formatOn) === N.Change, { formatted: l, raw: h } = O(
641
672
  s,
642
673
  t,
643
674
  r,
644
- l
675
+ o
645
676
  );
646
- return i.value = o, s !== o && ye(
677
+ return i.value = l, s !== l && Re(
647
678
  i,
648
679
  s,
649
- o,
680
+ l,
650
681
  a,
651
682
  n,
652
683
  c,
653
684
  r
654
- ), { formatted: o, raw: h };
685
+ ), { formatted: l, raw: h };
655
686
  }
656
- function Ye(e, t, n, r) {
687
+ function Qe(e, t, n, r) {
657
688
  const i = r - n;
658
689
  return e + t + i;
659
690
  }
660
- function Qe(e, t, n) {
691
+ function Ve(e, t, n) {
661
692
  var u;
662
693
  e.preventDefault();
663
- const r = e.target, { value: i, selectionStart: s, selectionEnd: a } = r, c = ((u = e.clipboardData) == null ? void 0 : u.getData("text/plain")) || "", l = i.slice(0, s || 0) + c + i.slice(a || 0), { formatted: o, raw: h } = O(
664
- l,
694
+ const r = e.target, { value: i, selectionStart: s, selectionEnd: a } = r, c = ((u = e.clipboardData) == null ? void 0 : u.getData("text/plain")) || "", o = i.slice(0, s || 0) + c + i.slice(a || 0), { formatted: l, raw: h } = O(
695
+ o,
665
696
  t,
666
697
  n,
667
698
  !0
668
699
  );
669
- r.value = o;
670
- const d = Ye(
700
+ r.value = l;
701
+ const d = Qe(
671
702
  s || 0,
672
703
  c.length,
673
- l.length,
674
- o.length
704
+ o.length,
705
+ l.length
675
706
  );
676
- return r.setSelectionRange(d, d), { formatted: o, raw: h };
707
+ return r.setSelectionRange(d, d), { formatted: l, raw: h };
677
708
  }
678
- function Ve(e, t) {
679
- const n = w(e);
709
+ function Fe(e, t) {
710
+ const n = y(e);
680
711
  return t ? `^-?[0-9]*[${n}]?[0-9]*$` : `^[0-9]*[${n}]?[0-9]*$`;
681
712
  }
682
- function Fe(e) {
683
- et(e.decimalMaxLength), tt(e.decimalMinLength), nt(e.decimalMinLength, e.decimalMaxLength), rt(e.formatOn), it(e.thousandSeparator), st(e.thousandStyle), at(e.decimalSeparator), ct(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), ot(e.onChange);
684
- }
685
713
  function et(e) {
714
+ var t, n;
715
+ try {
716
+ const i = new Intl.NumberFormat(e).formatToParts(123456789e-2);
717
+ return {
718
+ decimalSeparator: ((t = i.find((s) => s.type === "decimal")) == null ? void 0 : t.value) ?? ".",
719
+ thousandSeparator: ((n = i.find((s) => s.type === "group")) == null ? void 0 : n.value) ?? ","
720
+ };
721
+ } catch {
722
+ return { thousandSeparator: ",", decimalSeparator: "." };
723
+ }
724
+ }
725
+ function tt(e) {
726
+ let t = e.thousandSeparator ?? ie, n = e.decimalSeparator ?? C, r = e.thousandStyle ?? H;
727
+ if (e.thousandStyle === p.Locale || e.decimalSeparator === "auto") {
728
+ const s = et();
729
+ e.thousandStyle === p.Locale && (t = e.thousandSeparator ?? s.thousandSeparator, n = e.decimalSeparator === "auto" || e.decimalSeparator === void 0 ? s.decimalSeparator : e.decimalSeparator, r = p.Thousand), e.decimalSeparator === "auto" && (n = s.decimalSeparator);
730
+ }
731
+ return { thousandSeparator: t, thousandStyle: r, decimalSeparator: n };
732
+ }
733
+ function nt(e) {
734
+ rt(e.decimalMaxLength), it(e.decimalMinLength), st(e.decimalMinLength, e.decimalMaxLength), at(e.formatOn), ct(e.thousandSeparator), lt(e.thousandStyle), ot(e.decimalSeparator), ht(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), ut(e.onChange);
735
+ }
736
+ function rt(e) {
686
737
  if (e !== void 0) {
687
738
  if (typeof e != "number")
688
739
  throw new Error(
@@ -698,7 +749,7 @@ function et(e) {
698
749
  );
699
750
  }
700
751
  }
701
- function tt(e) {
752
+ function it(e) {
702
753
  if (e !== void 0) {
703
754
  if (typeof e != "number")
704
755
  throw new Error(
@@ -714,19 +765,19 @@ function tt(e) {
714
765
  );
715
766
  }
716
767
  }
717
- function nt(e, t) {
768
+ function st(e, t) {
718
769
  if (!(e === void 0 || t === void 0) && e > t)
719
770
  throw new Error(
720
771
  `decimalMinLength (${e}) cannot be greater than decimalMaxLength (${t}).`
721
772
  );
722
773
  }
723
- function rt(e) {
724
- if (e !== void 0 && e !== b.Blur && e !== b.Change)
774
+ function at(e) {
775
+ if (e !== void 0 && e !== N.Blur && e !== N.Change)
725
776
  throw new Error(
726
- `formatOn must be either ${b.Blur} or ${b.Change}. Received: ${JSON.stringify(e)}`
777
+ `formatOn must be either ${N.Blur} or ${N.Change}. Received: ${JSON.stringify(e)}`
727
778
  );
728
779
  }
729
- function it(e) {
780
+ function ct(e) {
730
781
  if (e !== void 0) {
731
782
  if (typeof e != "string")
732
783
  throw new Error(
@@ -742,14 +793,14 @@ function it(e) {
742
793
  );
743
794
  }
744
795
  }
745
- function st(e) {
796
+ function lt(e) {
746
797
  if (e !== void 0 && !Object.values(p).includes(e))
747
798
  throw new Error(
748
799
  `ThousandStyle must be one of: ${Object.values(p).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
749
800
  );
750
801
  }
751
- function at(e) {
752
- if (e !== void 0) {
802
+ function ot(e) {
803
+ if (!(e === void 0 || e === "auto")) {
753
804
  if (typeof e != "string")
754
805
  throw new Error(
755
806
  `decimalSeparator must be a string. Received: ${typeof e} (${JSON.stringify(e)})`
@@ -764,8 +815,8 @@ function at(e) {
764
815
  );
765
816
  }
766
817
  }
767
- function ct(e, t) {
768
- if (!(e === void 0 || t === void 0) && e === t)
818
+ function ht(e, t) {
819
+ if (!(e === void 0 || t === void 0) && t !== "auto" && e === t)
769
820
  throw new Error(
770
821
  `Decimal separator can't be same as thousand separator. thousandSeparator: ${e}, decimalSeparator: ${t}`
771
822
  );
@@ -776,45 +827,45 @@ function M(e, t) {
776
827
  `${e} must be a boolean. Received: ${typeof t} (${JSON.stringify(t)})`
777
828
  );
778
829
  }
779
- function ot(e) {
830
+ function ut(e) {
780
831
  if (e !== void 0 && typeof e != "function")
781
832
  throw new Error(
782
833
  `onChange must be a function or undefined. Received: ${typeof e} (${JSON.stringify(e)})`
783
834
  );
784
835
  }
785
- class ut {
836
+ class gt {
786
837
  constructor(t, {
787
- decimalMaxLength: n = x,
788
- decimalMinLength: r = G,
838
+ decimalMaxLength: n = G,
839
+ decimalMinLength: r = B,
789
840
  formatOn: i = Z,
790
- thousandSeparator: s = k,
791
- thousandStyle: a = B,
792
- decimalSeparator: c = N,
793
- enableCompactNotation: l = P,
794
- enableNegative: o = W,
841
+ thousandSeparator: s,
842
+ thousandStyle: a = H,
843
+ decimalSeparator: c,
844
+ enableCompactNotation: o = k,
845
+ enableNegative: l = W,
795
846
  enableLeadingZeros: h = U,
796
847
  rawValueMode: d = z,
797
848
  onChange: u,
798
- ...g
849
+ ...S
799
850
  }) {
800
- $(this, "element");
801
- $(this, "options");
802
- $(this, "resolvedOptions");
803
- $(this, "rawValue", "");
804
- $(this, "caretPositionBeforeChange");
805
- if (Fe({
851
+ w(this, "element");
852
+ w(this, "resolvedOptions");
853
+ w(this, "rawValue", "");
854
+ w(this, "caretPositionBeforeChange");
855
+ nt({
806
856
  decimalMaxLength: n,
807
857
  decimalMinLength: r,
808
858
  formatOn: i,
809
859
  thousandSeparator: s,
810
860
  thousandStyle: a,
811
861
  decimalSeparator: c,
812
- enableCompactNotation: l,
813
- enableNegative: o,
862
+ enableCompactNotation: o,
863
+ enableNegative: l,
814
864
  enableLeadingZeros: h,
815
865
  rawValueMode: d,
816
866
  onChange: u
817
- }), this.options = {
867
+ });
868
+ const E = {
818
869
  decimalMaxLength: n,
819
870
  decimalMinLength: r,
820
871
  onChange: u,
@@ -822,61 +873,67 @@ class ut {
822
873
  thousandSeparator: s,
823
874
  thousandStyle: a,
824
875
  decimalSeparator: c,
825
- enableCompactNotation: l,
826
- enableNegative: o,
876
+ enableCompactNotation: o,
877
+ enableNegative: l,
827
878
  enableLeadingZeros: h,
828
879
  rawValueMode: d,
829
- ...g
830
- }, this.resolvedOptions = this.getResolvedOptions(), this.createInputElement(t), this.setupEventListeners(), this.resolvedOptions.rawValueMode && this.element.value) {
831
- const f = this.element.value, S = this.resolvedOptions.thousandSeparator ? D(f, this.resolvedOptions.thousandSeparator) : f;
832
- this.rawValue = S, this.element.value = this.formatValueForDisplay(S);
880
+ ...S
881
+ };
882
+ if (this.resolvedOptions = this.getResolvedOptions(E), this.createInputElement(t, E), this.setupEventListeners(), this.resolvedOptions.rawValueMode && this.element.value) {
883
+ const m = this.element.value, f = this.resolvedOptions.thousandSeparator ? v(m, this.resolvedOptions.thousandSeparator) : m;
884
+ this.rawValue = f, this.element.value = this.formatValueForDisplay(f);
833
885
  } else if (this.element.value) {
834
- const f = this.element.value;
835
- this.element.value = this.formatValueForDisplay(f);
886
+ const m = this.element.value;
887
+ this.element.value = this.formatValueForDisplay(m);
836
888
  }
837
889
  }
838
- createInputElement(t) {
890
+ createInputElement(t, n) {
839
891
  this.element = document.createElement("input"), this.element.setAttribute("type", "text"), this.element.setAttribute("inputmode", "decimal"), this.element.setAttribute("spellcheck", "false"), this.element.setAttribute("autocomplete", "off");
840
- const n = Ve(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
841
- this.element.setAttribute("pattern", n);
892
+ const r = Fe(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
893
+ this.element.setAttribute("pattern", r);
842
894
  const {
843
- decimalMaxLength: r,
844
- decimalMinLength: i,
845
- formatOn: s,
846
- thousandSeparator: a,
847
- thousandStyle: c,
895
+ decimalMaxLength: i,
896
+ decimalMinLength: s,
897
+ formatOn: a,
898
+ thousandSeparator: c,
899
+ thousandStyle: o,
848
900
  decimalSeparator: l,
849
- enableCompactNotation: o,
850
- enableNegative: h,
851
- enableLeadingZeros: d,
852
- rawValueMode: u,
853
- onChange: g,
854
- value: f,
855
- defaultValue: S,
856
- type: E,
857
- inputMode: m,
858
- spellcheck: te,
859
- autocomplete: C,
860
- ...ne
861
- } = this.options;
862
- Object.assign(this.element, ne), f !== void 0 ? this.element.value = f : S !== void 0 && (this.element.defaultValue = S, this.element.value = S), t.appendChild(this.element);
901
+ enableCompactNotation: h,
902
+ enableNegative: d,
903
+ enableLeadingZeros: u,
904
+ rawValueMode: S,
905
+ onChange: E,
906
+ value: m,
907
+ defaultValue: f,
908
+ type: g,
909
+ inputMode: L,
910
+ spellcheck: b,
911
+ autocomplete: ee,
912
+ ...te
913
+ } = n;
914
+ Object.assign(this.element, te), m !== void 0 ? this.element.value = m : f !== void 0 && (this.element.defaultValue = f, this.element.value = f), t.appendChild(this.element);
863
915
  }
864
916
  setupEventListeners() {
865
- this.element.addEventListener("input", this.handleChange.bind(this)), this.element.addEventListener("keydown", this.handleKeyDown.bind(this)), this.element.addEventListener("paste", this.handlePaste.bind(this)), this.resolvedOptions.formatOn === b.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
917
+ this.element.addEventListener("input", this.handleChange.bind(this)), this.element.addEventListener("keydown", this.handleKeyDown.bind(this)), this.element.addEventListener("paste", this.handlePaste.bind(this)), this.resolvedOptions.formatOn === N.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
866
918
  }
867
- getResolvedOptions() {
919
+ getResolvedOptions(t) {
920
+ const n = tt({
921
+ thousandSeparator: t.thousandSeparator,
922
+ thousandStyle: t.thousandStyle,
923
+ decimalSeparator: t.decimalSeparator
924
+ });
868
925
  return {
869
- decimalMaxLength: this.options.decimalMaxLength ?? x,
870
- decimalMinLength: this.options.decimalMinLength ?? G,
871
- formatOn: this.options.formatOn ?? Z,
872
- thousandSeparator: this.options.thousandSeparator ?? k,
873
- thousandStyle: this.options.thousandStyle ?? B,
874
- decimalSeparator: this.options.decimalSeparator ?? N,
875
- enableCompactNotation: this.options.enableCompactNotation ?? P,
876
- enableNegative: this.options.enableNegative ?? W,
877
- enableLeadingZeros: this.options.enableLeadingZeros ?? U,
878
- rawValueMode: this.options.rawValueMode ?? z,
879
- onChange: this.options.onChange
926
+ decimalMaxLength: t.decimalMaxLength ?? G,
927
+ decimalMinLength: t.decimalMinLength ?? B,
928
+ formatOn: t.formatOn ?? Z,
929
+ thousandSeparator: n.thousandSeparator,
930
+ thousandStyle: n.thousandStyle,
931
+ decimalSeparator: n.decimalSeparator,
932
+ enableCompactNotation: t.enableCompactNotation ?? k,
933
+ enableNegative: t.enableNegative ?? W,
934
+ enableLeadingZeros: t.enableLeadingZeros ?? U,
935
+ rawValueMode: t.rawValueMode ?? z,
936
+ onChange: t.onChange
880
937
  };
881
938
  }
882
939
  buildFormattingOptions() {
@@ -911,7 +968,7 @@ class ut {
911
968
  ) : t;
912
969
  }
913
970
  handleChange(t) {
914
- const { formatted: n, raw: r } = He(
971
+ const { formatted: n, raw: r } = Ye(
915
972
  t,
916
973
  this.resolvedOptions.decimalMaxLength,
917
974
  this.caretPositionBeforeChange,
@@ -920,7 +977,7 @@ class ut {
920
977
  this.caretPositionBeforeChange = void 0, this.handleValueChange(n, r);
921
978
  }
922
979
  handleKeyDown(t) {
923
- const n = t.target, { selectionStart: r, selectionEnd: i } = n, s = this.buildFormattingOptions(), a = qe(t, {
980
+ const n = t.target, { selectionStart: r, selectionEnd: i } = n, s = this.buildFormattingOptions(), a = He(t, {
924
981
  formatOn: s.formatOn,
925
982
  thousandSeparator: s.thousandSeparator,
926
983
  ThousandStyle: s.ThousandStyle,
@@ -936,15 +993,15 @@ class ut {
936
993
  };
937
994
  }
938
995
  handlePaste(t) {
939
- const { formatted: n, raw: r } = Qe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
996
+ const { formatted: n, raw: r } = Ve(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
940
997
  this.handleValueChange(n, r);
941
998
  const i = new Event("input", { bubbles: !0, cancelable: !0 });
942
999
  this.element.dispatchEvent(i);
943
1000
  }
944
1001
  handleFocus(t) {
945
- if (this.resolvedOptions.formatOn === b.Blur && this.resolvedOptions.thousandSeparator) {
1002
+ if (this.resolvedOptions.formatOn === N.Blur && this.resolvedOptions.thousandSeparator) {
946
1003
  const n = t.target;
947
- n.value = D(n.value, this.resolvedOptions.thousandSeparator);
1004
+ n.value = v(n.value, this.resolvedOptions.thousandSeparator);
948
1005
  }
949
1006
  }
950
1007
  handleBlur(t) {
@@ -952,7 +1009,7 @@ class ut {
952
1009
  if (r && i !== p.None && n.value) {
953
1010
  const s = this.formatValueForDisplay(n.value);
954
1011
  n.value = s;
955
- const a = this.resolvedOptions.rawValueMode ? D(s, r) : void 0;
1012
+ const a = this.resolvedOptions.rawValueMode ? v(s, r) : void 0;
956
1013
  this.handleValueChange(s, a);
957
1014
  }
958
1015
  }
@@ -961,7 +1018,7 @@ class ut {
961
1018
  }
962
1019
  setValue(t) {
963
1020
  if (this.resolvedOptions.rawValueMode) {
964
- const n = this.resolvedOptions.thousandSeparator ? D(t, this.resolvedOptions.thousandSeparator) : t;
1021
+ const n = this.resolvedOptions.thousandSeparator ? v(t, this.resolvedOptions.thousandSeparator) : t;
965
1022
  this.rawValue = n, this.element.value = this.formatValueForDisplay(n);
966
1023
  } else
967
1024
  this.element.value = t;
@@ -1009,7 +1066,7 @@ class ut {
1009
1066
  const t = this.getValue();
1010
1067
  if (!t)
1011
1068
  return NaN;
1012
- const n = this.resolvedOptions.thousandSeparator ? D(t, this.resolvedOptions.thousandSeparator) : t, r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(w(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
1069
+ const n = this.resolvedOptions.thousandSeparator ? v(t, this.resolvedOptions.thousandSeparator) : t, r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(y(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
1013
1070
  return parseFloat(r);
1014
1071
  }
1015
1072
  /**
@@ -1025,15 +1082,17 @@ class ut {
1025
1082
  }
1026
1083
  }
1027
1084
  export {
1028
- b as FormatOn,
1029
- ut as NumoraInput,
1085
+ N as FormatOn,
1086
+ gt as NumoraInput,
1030
1087
  p as ThousandStyle,
1031
1088
  O as formatInputValue,
1032
- ht as formatValueForDisplay,
1033
- Ve as getNumoraPattern,
1034
- He as handleOnChangeNumoraInput,
1035
- qe as handleOnKeyDownNumoraInput,
1036
- Qe as handleOnPasteNumoraInput,
1037
- D as removeThousandSeparators,
1038
- Fe as validateNumoraInputOptions
1089
+ ft as formatValueForDisplay,
1090
+ Fe as getNumoraPattern,
1091
+ et as getSeparatorsFromLocale,
1092
+ Ye as handleOnChangeNumoraInput,
1093
+ He as handleOnKeyDownNumoraInput,
1094
+ Ve as handleOnPasteNumoraInput,
1095
+ v as removeThousandSeparators,
1096
+ tt as resolveLocaleOptions,
1097
+ nt as validateNumoraInputOptions
1039
1098
  };