numora 2.0.4 → 3.0.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.
Files changed (32) hide show
  1. package/dist/NumoraInput.d.ts +67 -0
  2. package/dist/config.d.ts +11 -0
  3. package/dist/features/compact-notation.d.ts +17 -0
  4. package/dist/features/decimals.d.ts +21 -0
  5. package/dist/features/formatting/caret-position-utils.d.ts +54 -0
  6. package/dist/features/formatting/change-detection.d.ts +40 -0
  7. package/dist/features/formatting/character-equivalence.d.ts +9 -0
  8. package/dist/features/formatting/constants.d.ts +29 -0
  9. package/dist/features/formatting/cursor-boundary.d.ts +39 -0
  10. package/dist/features/formatting/cursor-position.d.ts +50 -0
  11. package/dist/features/formatting/digit-counting.d.ts +61 -0
  12. package/dist/features/formatting/index.d.ts +20 -0
  13. package/dist/features/formatting/large-number.d.ts +39 -0
  14. package/dist/features/formatting/numeric-formatting-utils.d.ts +24 -0
  15. package/dist/features/formatting/percent.d.ts +45 -0
  16. package/dist/features/formatting/subscript-notation.d.ts +20 -0
  17. package/dist/features/formatting/thousand-grouping.d.ts +34 -0
  18. package/dist/features/leading-zeros.d.ts +18 -0
  19. package/dist/features/mobile-keyboard-filtering.d.ts +18 -0
  20. package/dist/features/non-numeric-characters.d.ts +9 -0
  21. package/dist/features/sanitization.d.ts +44 -0
  22. package/dist/features/scientific-notation.d.ts +9 -0
  23. package/dist/index.d.ts +5 -0
  24. package/dist/index.js +1 -1
  25. package/dist/index.mjs +386 -388
  26. package/dist/types.d.ts +34 -0
  27. package/dist/utils/escape-reg-exp.d.ts +16 -0
  28. package/dist/utils/event-handlers.d.ts +31 -0
  29. package/dist/utils/format-utils.d.ts +28 -0
  30. package/dist/utils/input-pattern.d.ts +5 -0
  31. package/dist/validation.d.ts +20 -0
  32. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -1,81 +1,82 @@
1
- var K = Object.defineProperty;
2
- var Q = (e, t, n) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var L = (e, t, n) => Q(e, typeof t != "symbol" ? t + "" : t, n);
1
+ var Q = Object.defineProperty;
2
+ var X = (e, t, n) => t in e ? Q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var $ = (e, t, n) => X(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  var v = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))(v || {}), S = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e))(S || {});
5
- const I = 2, R = 0, O = v.Blur, _ = ",", B = S.None, E = ".", X = !1, P = !1, W = !1, k = !1;
6
- function D(e) {
7
- return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
8
- }
5
+ const I = 2, O = 0, R = v.Blur, _ = ",", B = S.None, m = ".", Y = !1, P = !1, W = !1, k = !1;
9
6
  function A(e) {
10
7
  return {
11
- decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? E,
8
+ decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? m,
12
9
  thousandSeparator: e == null ? void 0 : e.thousandSeparator
13
10
  };
14
11
  }
15
- function Y(e, t) {
16
- const n = e.target;
17
- return n ? n.value.includes(t) : !1;
12
+ function U(e, t) {
13
+ const n = e.startsWith("-"), r = n ? e.slice(1) : e, [s = "", i = ""] = r.split(t);
14
+ return {
15
+ sign: n ? "-" : "",
16
+ integer: s,
17
+ decimal: i
18
+ };
19
+ }
20
+ function V(e, t) {
21
+ if (!e.value.includes(t)) return !1;
22
+ const { selectionStart: n, selectionEnd: r, value: s } = e;
23
+ return !s.slice(n ?? 0, r ?? 0).includes(t);
18
24
  }
19
- function V(e, t, n, r) {
20
- const { selectionStart: i, selectionEnd: o, value: s } = t, { key: a } = e, c = n == null ? void 0 : n.ThousandStyle;
21
- if (c !== S.None && c !== void 0 || a !== "," && a !== ".")
22
- return !1;
23
- if (Y(e, r))
25
+ function F(e, t, n, r) {
26
+ const { key: s } = e;
27
+ if (s !== "," && s !== ".") return !1;
28
+ if (V(t, r))
24
29
  return !0;
25
- if (a !== r) {
26
- const l = i ?? 0, h = o ?? l, d = s.slice(0, l) + r + s.slice(h);
27
- t.value = d;
28
- const u = l + 1;
29
- return t.setSelectionRange(u, u), !0;
30
+ if (s !== r) {
31
+ const { selectionStart: i, selectionEnd: a, value: o } = t, c = i ?? 0, l = a ?? c;
32
+ t.value = o.slice(0, c) + r + o.slice(l);
33
+ const h = c + 1;
34
+ return t.setSelectionRange(h, h), !0;
30
35
  }
31
36
  return !1;
32
37
  }
33
- const F = (e, t, n = E) => {
34
- const [r, i] = e.split(n);
35
- return i ? `${r}${n}${i.slice(0, t)}` : e;
36
- }, ee = (e, t = E) => {
37
- const n = D(t), r = new RegExp(`(${n}.*?)${n}`, "g");
38
- return e.replace(r, `$1${t}`);
39
- }, te = (e, t = 0, n = E) => {
40
- if (t === 0)
41
- return e;
42
- if (!e || e === "0" || e === n || e === "-" || e === `-${n}`)
43
- return e === "-" || e === `-${n}` ? `-${n}${"0".repeat(t)}` : e === n ? `${n}${"0".repeat(t)}` : `${e}${n}${"0".repeat(t)}`;
44
- const r = e.includes(n), i = e.startsWith("-"), o = i ? e.slice(1) : e, [s, a = ""] = o.split(n);
45
- if (!r) {
46
- const c = "0".repeat(t);
47
- return i ? `-${s}${n}${c}` : `${s}${n}${c}`;
48
- }
49
- if (a.length < t) {
50
- const c = t - a.length, l = a + "0".repeat(c);
51
- return i ? `-${s}${n}${l}` : `${s}${n}${l}`;
52
- }
53
- return e;
38
+ const ee = (e, t, n = m) => {
39
+ const { sign: r, integer: s, decimal: i } = U(e, n);
40
+ if (!e.includes(n)) return e;
41
+ const o = i.slice(0, t);
42
+ return `${r}${s}${n}${o}`;
43
+ }, te = (e, t = m) => {
44
+ const n = e.indexOf(t);
45
+ if (n === -1) return e;
46
+ const r = e.slice(0, n + 1), i = e.slice(n + 1).split(",").join("").split(".").join("").split(t).join("");
47
+ return r + i;
48
+ }, ne = (e, t = 0, n = m) => {
49
+ if (t <= 0) return e;
50
+ const { sign: r, integer: s, decimal: i } = U(e, n);
51
+ if (i.length >= t)
52
+ return e.includes(n) ? e : `${r}${s}${n}${i}`;
53
+ const a = i.padEnd(t, "0");
54
+ return `${r}${s}${n}${a}`;
54
55
  }, N = {
55
56
  thousand: { size: 3 },
56
57
  lakh: { firstGroup: 3, restGroup: 2 },
57
58
  wan: { size: 4 }
58
59
  };
59
- function G(e, t, n, r = !1, i = ".") {
60
- if (!e || e === "0" || e === i || e === "-" || e === `-${i}`)
60
+ function j(e, t, n = S.Thousand, r = !1, s = ".") {
61
+ if (!e || e === "0" || e === s || e === "-" || e === `-${s}`)
61
62
  return e;
62
- const o = e.includes(i), s = e.startsWith("-"), a = s ? e.slice(1) : e, [c, l] = a.split(i);
63
+ const i = e.includes(s), a = e.startsWith("-"), o = a ? e.slice(1) : e, [c, l] = o.split(s);
63
64
  if (!c) {
64
- const u = l ? `${i}${l}` : a;
65
- return s ? `-${u}` : u;
65
+ const u = l ? `${s}${l}` : o;
66
+ return a ? `-${u}` : u;
66
67
  }
67
68
  if (r && c.startsWith("0") && c.length > 1) {
68
69
  const u = c.match(/^(0+)/);
69
70
  if (u) {
70
71
  const g = u[1], f = c.slice(g.length);
71
72
  if (f) {
72
- const p = Z(f, t, n), $ = g + p, m = s ? "-" : "";
73
- return o ? l ? `${m}${$}${i}${l}` : `${m}${$}${i}` : `${m}${$}`;
73
+ const p = Z(f, t, n), E = g + p, w = a ? "-" : "";
74
+ return i ? l ? `${w}${E}${s}${l}` : `${w}${E}${s}` : `${w}${E}`;
74
75
  }
75
76
  }
76
77
  }
77
- const h = Z(c, t, n), d = s ? "-" : "";
78
- return o ? l ? `${d}${h}${i}${l}` : `${d}${h}${i}` : `${d}${h}`;
78
+ const h = Z(c, t, n), d = a ? "-" : "";
79
+ return i ? l ? `${d}${h}${s}${l}` : `${d}${h}${s}` : `${d}${h}`;
79
80
  }
80
81
  function Z(e, t, n) {
81
82
  if (e === "0" || e === "")
@@ -84,117 +85,111 @@ function Z(e, t, n) {
84
85
  case S.None:
85
86
  return e;
86
87
  case S.Thousand:
87
- return ne(e, t);
88
- case S.Lakh:
89
88
  return re(e, t);
89
+ case S.Lakh:
90
+ return ie(e, t);
90
91
  case S.Wan:
91
92
  return se(e, t);
92
93
  default:
93
94
  return e;
94
95
  }
95
96
  }
96
- function ne(e, t) {
97
- return U(e, t, N.thousand.size);
98
- }
99
97
  function re(e, t) {
98
+ return z(e, t, N.thousand.size);
99
+ }
100
+ function ie(e, t) {
100
101
  if (e.length <= N.lakh.firstGroup)
101
102
  return e;
102
- const n = e.split("").reverse(), r = [], i = n.slice(0, N.lakh.firstGroup).reverse().join("");
103
- r.push(i);
104
- for (let o = N.lakh.firstGroup; o < n.length; o += N.lakh.restGroup)
105
- r.push(n.slice(o, o + N.lakh.restGroup).reverse().join(""));
103
+ const n = e.split("").reverse(), r = [], s = n.slice(0, N.lakh.firstGroup).reverse().join("");
104
+ r.push(s);
105
+ for (let i = N.lakh.firstGroup; i < n.length; i += N.lakh.restGroup)
106
+ r.push(n.slice(i, i + N.lakh.restGroup).reverse().join(""));
106
107
  return r.reverse().join(t);
107
108
  }
108
109
  function se(e, t) {
109
- return U(e, t, N.wan.size);
110
+ return z(e, t, N.wan.size);
110
111
  }
111
- function U(e, t, n) {
112
- const r = e.split("").reverse(), i = [];
113
- for (let o = 0; o < r.length; o += n)
114
- i.push(r.slice(o, o + n).reverse().join(""));
115
- return i.reverse().join(t);
112
+ function z(e, t, n) {
113
+ const r = e.split("").reverse(), s = [];
114
+ for (let i = 0; i < r.length; i += n)
115
+ s.push(r.slice(i, i + n).reverse().join(""));
116
+ return s.reverse().join(t);
116
117
  }
117
- function ie(e, t, n) {
118
- return (t == null ? void 0 : t.formatOn) === "change" && t.thousandSeparator ? G(
118
+ function ae(e, t, n) {
119
+ return (t == null ? void 0 : t.formatOn) === "change" && t.thousandSeparator ? j(
119
120
  e,
120
121
  t.thousandSeparator,
121
122
  t.ThousandStyle ?? S.None,
122
123
  t.enableLeadingZeros,
123
- (n == null ? void 0 : n.decimalSeparator) ?? E
124
+ (n == null ? void 0 : n.decimalSeparator) ?? m
124
125
  ) : e;
125
126
  }
126
127
  function b(e, t, n, r = ".") {
127
- let i = 0;
128
- for (let o = 0; o < t && o < e.length; o++) {
129
- const s = e[o];
130
- s !== n && s !== r && i++;
131
- }
132
- return i;
128
+ let s = 0;
129
+ for (let i = 0; i < t && i < e.length; i++)
130
+ e[i] !== n && s++;
131
+ return s;
133
132
  }
134
133
  function oe(e, t, n, r = ".") {
135
134
  if (t === 0)
136
135
  return 0;
137
- let i = 0;
138
- for (let o = 0; o < e.length; o++) {
139
- const s = e[o];
140
- if (s !== n && s !== r) {
141
- if (i === t - 1)
142
- return o + 1;
143
- i++;
136
+ let s = 0;
137
+ for (let i = 0; i < e.length; i++)
138
+ if (e[i] !== n) {
139
+ if (s === t - 1)
140
+ return i + 1;
141
+ s++;
144
142
  }
145
- }
146
143
  return e.length;
147
144
  }
148
145
  function C(e, t, n, r = ".") {
149
146
  if (t === 0)
150
147
  return 0;
151
- let i = 0;
152
- for (let o = 0; o < e.length; o++) {
153
- const s = e[o];
154
- if (s !== n && s !== r) {
155
- if (i++, i === t)
156
- return o + 1;
157
- if (i > t)
158
- return o;
148
+ let s = 0;
149
+ for (let i = 0; i < e.length; i++)
150
+ if (e[i] !== n) {
151
+ if (s++, s === t)
152
+ return i + 1;
153
+ if (s > t)
154
+ return i;
159
155
  }
160
- }
161
156
  return e.length;
162
157
  }
163
- function j(e, t, n) {
158
+ function J(e, t, n) {
164
159
  return t < 0 || t >= e.length ? !1 : e[t] === n;
165
160
  }
166
- function ae(e, t = {}) {
161
+ function ce(e, t = {}) {
167
162
  const {
168
163
  thousandSeparator: n,
169
164
  decimalSeparator: r = ".",
170
- prefix: i = "",
171
- suffix: o = ""
172
- } = t, s = Array.from({ length: e.length + 1 }).map(() => !0);
173
- if (i && s.fill(!1, 0, i.length), o) {
174
- const a = e.length - o.length;
175
- s.fill(!1, a + 1, e.length + 1);
165
+ prefix: s = "",
166
+ suffix: i = ""
167
+ } = t, a = Array.from({ length: e.length + 1 }).map(() => !0);
168
+ if (s && a.fill(!1, 0, s.length), i) {
169
+ const o = e.length - i.length;
170
+ a.fill(!1, o + 1, e.length + 1);
176
171
  }
177
- for (let a = 0; a < e.length; a++) {
178
- const c = e[a];
179
- (n && c === n || c === r) && (s[a] = !1, a + 1 < e.length && !/\d/.test(e[a + 1]) && (s[a + 1] = !1));
172
+ for (let o = 0; o < e.length; o++) {
173
+ const c = e[o];
174
+ (n && c === n || c === r) && (a[o] = !1, o + 1 < e.length && !/\d/.test(e[o + 1]) && (a[o + 1] = !1));
180
175
  }
181
- return s.some((a) => a) || s.fill(!0), s;
176
+ return a.some((o) => o) || a.fill(!0), a;
182
177
  }
183
178
  function T(e, t, n, r) {
184
- const i = e.length;
185
- if (t = Math.max(0, Math.min(t, i)), !n[t]) {
186
- let o = t;
187
- for (; o <= i && !n[o]; )
188
- o++;
189
- let s = t;
190
- for (; s >= 0 && !n[s]; )
191
- s--;
192
- o <= i && s >= 0 ? t = t - s < o - t ? s : o : o <= i ? t = o : s >= 0 && (t = s);
179
+ const s = e.length;
180
+ if (t = Math.max(0, Math.min(t, s)), !n[t]) {
181
+ let i = t;
182
+ for (; i <= s && !n[i]; )
183
+ i++;
184
+ let a = t;
185
+ for (; a >= 0 && !n[a]; )
186
+ a--;
187
+ i <= s && a >= 0 ? t = t - a < i - t ? a : i : i <= s ? t = i : a >= 0 && (t = a);
193
188
  }
194
- return (t === -1 || t > i) && (t = i), t;
189
+ return (t === -1 || t > s) && (t = s), t;
195
190
  }
196
- const J = (e, t) => e === t;
197
- function ce(e, t, n, r, i, o, s = ".", a = {}) {
191
+ const K = (e, t) => e === t;
192
+ function le(e, t, n, r, s, i, a = ".", o = {}) {
198
193
  if (n < 0)
199
194
  return 0;
200
195
  if (n > e.length || e === "" || t === "")
@@ -202,25 +197,25 @@ function ce(e, t, n, r, i, o, s = ".", a = {}) {
202
197
  const c = /(\d+\.?\d*)\s*[kmbMTOQaqiSxsxSpOoNn]$/i;
203
198
  if (c.test(e) && !c.test(t) && t.length > e.length && n >= e.length - 1)
204
199
  return t.length;
205
- const l = t.length < e.length, h = j(
200
+ const l = t.length < e.length, h = J(
206
201
  e,
207
202
  n,
208
203
  r
209
- ), d = e.indexOf(s), u = t.indexOf(s);
210
- if (a.isCharacterEquivalent && e !== t) {
211
- const p = le(
204
+ ), d = e.indexOf(a), u = t.indexOf(a);
205
+ if (o.isCharacterEquivalent && e !== t) {
206
+ const p = he(
212
207
  e,
213
208
  t,
214
209
  n,
215
- a.isCharacterEquivalent || J,
216
- o,
217
- a
210
+ o.isCharacterEquivalent || K,
211
+ i,
212
+ o
218
213
  );
219
214
  if (p !== void 0)
220
215
  return p;
221
216
  }
222
217
  if (l)
223
- return he(
218
+ return ue(
224
219
  e,
225
220
  t,
226
221
  n,
@@ -228,25 +223,25 @@ function ce(e, t, n, r, i, o, s = ".", a = {}) {
228
223
  h,
229
224
  d,
230
225
  u,
231
- o,
232
- s,
233
- a
226
+ i,
227
+ a,
228
+ o
234
229
  );
235
- const f = ge(
230
+ const f = pe(
236
231
  e,
237
232
  t,
238
233
  n,
239
234
  r,
240
235
  h,
241
- s
236
+ a
242
237
  );
243
- return a.boundary ? T(t, f, a.boundary) : f;
238
+ return o.boundary ? T(t, f, o.boundary) : f;
244
239
  }
245
- function le(e, t, n, r, i, o) {
246
- const s = e.length, a = t.length, c = {}, l = new Array(s);
247
- for (let f = 0; f < s; f++) {
240
+ function he(e, t, n, r, s, i) {
241
+ const a = e.length, o = t.length, c = {}, l = new Array(a);
242
+ for (let f = 0; f < a; f++) {
248
243
  l[f] = -1;
249
- for (let p = 0; p < a; p++) {
244
+ for (let p = 0; p < o; p++) {
250
245
  if (c[p]) continue;
251
246
  if (r(
252
247
  e[f],
@@ -254,7 +249,7 @@ function le(e, t, n, r, i, o) {
254
249
  {
255
250
  oldValue: e,
256
251
  newValue: t,
257
- typedRange: i,
252
+ typedRange: s,
258
253
  oldIndex: f,
259
254
  newIndex: p
260
255
  }
@@ -265,23 +260,23 @@ function le(e, t, n, r, i, o) {
265
260
  }
266
261
  }
267
262
  let h = n;
268
- for (; h < s && (l[h] === -1 || !/\d/.test(e[h])); )
263
+ for (; h < a && (l[h] === -1 || !/\d/.test(e[h])); )
269
264
  h++;
270
- const d = h === s || l[h] === -1 ? a : l[h];
265
+ const d = h === a || l[h] === -1 ? o : l[h];
271
266
  for (h = n - 1; h >= 0 && l[h] === -1; ) h--;
272
267
  const u = h === -1 || l[h] === -1 ? 0 : l[h] + 1;
273
268
  if (u > d) return d;
274
269
  const g = n - u < d - n ? u : d;
275
- return o.boundary ? T(t, g, o.boundary) : g;
270
+ return i.boundary ? T(t, g, i.boundary) : g;
276
271
  }
277
- function he(e, t, n, r, i, o, s, a, c, l = {}) {
278
- if (i)
279
- return ue(
272
+ function ue(e, t, n, r, s, i, a, o, c, l = {}) {
273
+ if (s)
274
+ return de(
280
275
  e,
281
276
  t,
282
277
  n,
283
278
  r,
284
- s,
279
+ a,
285
280
  c
286
281
  );
287
282
  const h = b(
@@ -299,86 +294,86 @@ function he(e, t, n, r, i, o, s, a, c, l = {}) {
299
294
  t.length,
300
295
  r,
301
296
  c
302
- ), g = d - u, f = de(
297
+ ), g = d - u, f = fe(
303
298
  e,
304
299
  n,
305
300
  r,
306
301
  h,
307
302
  g,
303
+ i,
308
304
  o,
309
- a,
310
305
  c
311
- ), p = o === -1 || n <= o, $ = fe(
306
+ ), p = i === -1 || n <= i, E = ge(
312
307
  t,
313
308
  f,
314
309
  r,
315
310
  g,
316
- a,
311
+ o,
317
312
  c,
318
313
  p,
319
- s
314
+ a
320
315
  );
321
- return l.boundary ? T(t, $, l.boundary) : $;
316
+ return l.boundary ? T(t, E, l.boundary) : E;
322
317
  }
323
- function ue(e, t, n, r, i, o) {
324
- const s = n + 1;
325
- if (s < e.length) {
326
- const a = b(
318
+ function de(e, t, n, r, s, i) {
319
+ const a = n + 1;
320
+ if (a < e.length) {
321
+ const o = b(
327
322
  e,
328
- s,
323
+ a,
329
324
  r,
330
- o
325
+ i
331
326
  ), c = oe(
332
327
  t,
333
- a,
328
+ o,
334
329
  r,
335
- o
330
+ i
336
331
  );
337
332
  return c < t.length && t[c] !== r ? c + 1 : c;
338
333
  }
339
334
  return n;
340
335
  }
341
- function de(e, t, n, r, i, o, s, a) {
342
- if (s) {
343
- const { start: l, isDelete: h } = s;
336
+ function fe(e, t, n, r, s, i, a, o) {
337
+ if (a) {
338
+ const { start: l, isDelete: h } = a;
344
339
  return h ? b(
345
340
  e,
346
341
  l,
347
342
  n,
348
- a
343
+ o
349
344
  ) : Math.max(0, b(
350
345
  e,
351
346
  l,
352
347
  n,
353
- a
348
+ o
354
349
  ));
355
350
  }
356
- return t > 0 && e[t - 1] === n && i > 0 ? r + 1 : r;
351
+ return t > 0 && e[t - 1] === n && s > 0 ? r + 1 : r;
357
352
  }
358
- function fe(e, t, n, r, i, o, s, a) {
359
- if (s && a !== -1) {
360
- const l = e.substring(0, a), h = b(
353
+ function ge(e, t, n, r, s, i, a, o) {
354
+ if (a && o !== -1) {
355
+ const l = e.substring(0, o), h = b(
361
356
  l,
362
357
  l.length,
363
358
  n,
364
- o
359
+ i
365
360
  );
366
361
  if (t <= h) {
367
362
  const d = C(
368
363
  l,
369
364
  t,
370
365
  n,
371
- o
366
+ i
372
367
  );
373
368
  if (d > 0 && d < l.length && b(
374
369
  l,
375
370
  d,
376
371
  n,
377
- o
372
+ i
378
373
  ) === t) {
379
- if (l[d] === n && i && r > 0 && d < l.length - 1)
374
+ if (l[d] === n && s && r > 0 && d < l.length - 1)
380
375
  return d + 1;
381
- if (!i && r > 0 && d < l.length - 1)
376
+ if (!s && r > 0 && d < l.length - 1)
382
377
  return Math.min(d + 1, l.length);
383
378
  }
384
379
  return d;
@@ -388,64 +383,64 @@ function fe(e, t, n, r, i, o, s, a) {
388
383
  e,
389
384
  t,
390
385
  n,
391
- o
386
+ i
392
387
  );
393
388
  if (c > 0 && c < e.length && b(
394
389
  e,
395
390
  c,
396
391
  n,
397
- o
392
+ i
398
393
  ) === t) {
399
- if (e[c] === n && i && r > 0 && c < e.length - 1)
394
+ if (e[c] === n && s && r > 0 && c < e.length - 1)
400
395
  return c + 1;
401
- if (!i && r > 0 && c < e.length - 1)
396
+ if (!s && r > 0 && c < e.length - 1)
402
397
  return Math.min(c + 1, e.length);
403
398
  }
404
399
  return c;
405
400
  }
406
- function ge(e, t, n, r, i, o) {
407
- const s = n >= e.length, a = b(
401
+ function pe(e, t, n, r, s, i) {
402
+ const a = n >= e.length, o = b(
408
403
  e,
409
404
  n,
410
405
  r,
411
- o
406
+ i
412
407
  ), c = b(
413
408
  e,
414
409
  e.length,
415
410
  r,
416
- o
411
+ i
417
412
  ), l = b(
418
413
  t,
419
414
  t.length,
420
415
  r,
421
- o
416
+ i
422
417
  );
423
- if (s || a === c)
418
+ if (a || o === c)
424
419
  return t.length;
425
420
  const h = l - c;
426
- let d = a;
427
- h > 0 && !s && a < c && (d = a + 1);
421
+ let d = o;
422
+ h > 0 && !a && o < c && (d = o + 1);
428
423
  const u = C(
429
424
  t,
430
425
  d,
431
426
  r,
432
- o
427
+ i
433
428
  );
434
- return i && !j(t, u, r) ? Math.max(0, u - 1) : u;
429
+ return s && !J(t, u, r) ? Math.max(0, u - 1) : u;
435
430
  }
436
- function pe(e, t, n) {
437
- const { selectionStart: r, selectionEnd: i, endOffset: o = 0 } = e;
438
- if (r !== i) {
439
- const h = i - r;
431
+ function Se(e, t, n) {
432
+ const { selectionStart: r, selectionEnd: s, endOffset: i = 0 } = e;
433
+ if (r !== s) {
434
+ const h = s - r;
440
435
  return {
441
436
  start: r,
442
- end: i,
437
+ end: s,
443
438
  deletedLength: h,
444
439
  isDelete: !1
445
440
  };
446
441
  }
447
- if (o > 0) {
448
- const h = o;
442
+ if (i > 0) {
443
+ const h = i;
449
444
  return {
450
445
  start: r,
451
446
  end: r + h,
@@ -453,7 +448,7 @@ function pe(e, t, n) {
453
448
  isDelete: !0
454
449
  };
455
450
  }
456
- const a = t.length, c = n.length, l = a - c;
451
+ const o = t.length, c = n.length, l = o - c;
457
452
  if (!(l <= 0))
458
453
  return {
459
454
  start: r,
@@ -462,25 +457,25 @@ function pe(e, t, n) {
462
457
  isDelete: !1
463
458
  };
464
459
  }
465
- function Se(e, t) {
460
+ function be(e, t) {
466
461
  if (e === t)
467
462
  return;
468
463
  let n = 0;
469
464
  for (; n < e.length && n < t.length && e[n] === t[n]; )
470
465
  n++;
471
- let r = e.length - 1, i = t.length - 1;
472
- for (; r >= n && i >= n && e[r] === t[i]; )
473
- r--, i--;
474
- const o = r - n + 1, s = i - n + 1;
475
- if (!(o === 0 && s === 0))
466
+ let r = e.length - 1, s = t.length - 1;
467
+ for (; r >= n && s >= n && e[r] === t[s]; )
468
+ r--, s--;
469
+ const i = r - n + 1, a = s - n + 1;
470
+ if (!(i === 0 && a === 0))
476
471
  return {
477
472
  start: n,
478
473
  end: r + 1,
479
- deletedLength: o,
480
- isDelete: o > s
474
+ deletedLength: i,
475
+ isDelete: i > a
481
476
  };
482
477
  }
483
- function z(e, t) {
478
+ function G(e, t) {
484
479
  if (e.value = e.value, e === null)
485
480
  return !1;
486
481
  if (e.createTextRange) {
@@ -489,106 +484,109 @@ function z(e, t) {
489
484
  }
490
485
  return e.selectionStart !== null || e.selectionStart === 0 ? (e.focus(), e.setSelectionRange(t, t), !0) : (e.focus(), !1);
491
486
  }
492
- function be(e, t, n) {
493
- return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (z(e, t), setTimeout(() => {
494
- e.value === n && e.selectionStart !== t && z(e, t);
487
+ function ve(e, t, n) {
488
+ return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (G(e, t), setTimeout(() => {
489
+ e.value === n && e.selectionStart !== t && G(e, t);
495
490
  }, 0));
496
491
  }
497
- function ve(e) {
492
+ function Ee(e) {
498
493
  return Math.max(e.selectionStart, e.selectionEnd);
499
494
  }
500
- function $e(e, t, n) {
495
+ function me(e, t, n) {
501
496
  if ((n == null ? void 0 : n.formatOn) !== v.Change || !n.thousandSeparator)
502
497
  return;
503
- const { selectionStart: r, selectionEnd: i, value: o } = t;
504
- if (r === null || i === null || r !== i)
498
+ const { selectionStart: r, selectionEnd: s, value: i } = t;
499
+ if (r === null || s === null || r !== s)
505
500
  return;
506
- const { key: s } = e, a = n.thousandSeparator;
507
- s === "Backspace" && r > 0 && o[r - 1] === a && t.setSelectionRange(r - 1, r - 1), s === "Delete" && o[r] === a && t.setSelectionRange(r + 1, r + 1);
501
+ const { key: a } = e, o = n.thousandSeparator;
502
+ a === "Backspace" && r > 0 && i[r - 1] === o && t.setSelectionRange(r - 1, r - 1), a === "Delete" && i[r] === o && t.setSelectionRange(r + 1, r + 1);
508
503
  }
509
- function Ee(e, t, n, r, i, o, s) {
510
- if (!i) return;
511
- const { selectionStart: a = 0, selectionEnd: c = 0, endOffset: l = 0 } = i;
512
- let h = pe(
513
- { selectionStart: a, selectionEnd: c, endOffset: l },
504
+ function Ne(e, t, n, r, s, i, a) {
505
+ if (!s) return;
506
+ const { selectionStart: o = 0, selectionEnd: c = 0, endOffset: l = 0 } = s;
507
+ let h = Se(
508
+ { selectionStart: o, selectionEnd: c, endOffset: l },
514
509
  t,
515
510
  n
516
511
  );
517
- if (h || (h = Se(t, n)), !h) return;
518
- const d = ae(n, {
519
- thousandSeparator: (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator,
520
- decimalSeparator: o.decimalSeparator
512
+ if (h || (h = be(t, n)), !h) return;
513
+ const d = ce(n, {
514
+ thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? i.thousandSeparator,
515
+ decimalSeparator: i.decimalSeparator
521
516
  }), u = {
522
- thousandSeparator: (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator,
523
- isCharacterEquivalent: J,
517
+ thousandSeparator: (a == null ? void 0 : a.thousandSeparator) ?? i.thousandSeparator,
518
+ isCharacterEquivalent: K,
524
519
  boundary: d
525
- }, g = (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator ?? ",", f = (s == null ? void 0 : s.ThousandStyle) ?? S.None, p = ce(
520
+ }, g = (a == null ? void 0 : a.thousandSeparator) ?? i.thousandSeparator ?? ",", f = (a == null ? void 0 : a.ThousandStyle) ?? S.None, p = le(
526
521
  t,
527
522
  n,
528
523
  r,
529
524
  g,
530
525
  f,
531
526
  h,
532
- o.decimalSeparator,
527
+ i.decimalSeparator,
533
528
  u
534
529
  );
535
- be(e, p, n);
530
+ ve(e, p, n);
531
+ }
532
+ function M(e) {
533
+ return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
536
534
  }
537
- const Ne = (e, t = !1, n = ".") => {
538
- const r = D(n), i = new RegExp(`[^0-9${r}]`, "g");
535
+ const $e = (e, t = !1, n = ".") => {
536
+ const r = M(n), s = new RegExp(`[^0-9${r}]`, "g");
539
537
  if (!t)
540
- return e.replace(i, "");
541
- const o = e.startsWith("-"), s = e.replace(i, "");
542
- if (o) {
543
- if (s.length > 0)
544
- return "-" + s;
538
+ return e.replace(s, "");
539
+ const i = e.startsWith("-"), a = e.replace(s, "");
540
+ if (i) {
541
+ if (a.length > 0)
542
+ return "-" + a;
545
543
  if (e === "-")
546
544
  return "-";
547
545
  }
548
- return s;
546
+ return a;
549
547
  };
550
548
  function Le(e) {
551
549
  const t = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g;
552
550
  let n = e, r;
553
- const i = [];
551
+ const s = [];
554
552
  for (; (r = t.exec(e)) !== null; ) {
555
- const o = r[0], s = r[1], a = parseInt(r[2], 10);
553
+ const i = r[0], a = r[1], o = parseInt(r[2], 10);
556
554
  let c;
557
- if (a === 0)
558
- c = s;
555
+ if (o === 0)
556
+ c = a;
559
557
  else {
560
- const l = s.startsWith("-"), h = l ? s.slice(1) : s, [d, u = ""] = h.split(".");
561
- a > 0 ? c = we(d, u, a) : c = De(d, u, Math.abs(a)), l && (c = "-" + c);
558
+ const l = a.startsWith("-"), h = l ? a.slice(1) : a, [d, u = ""] = h.split(".");
559
+ o > 0 ? c = we(d, u, o) : c = De(d, u, Math.abs(o)), l && (c = "-" + c);
562
560
  }
563
- i.push({ full: o, expanded: c });
561
+ s.push({ full: i, expanded: c });
564
562
  }
565
- for (const { full: o, expanded: s } of i)
566
- n = n.replace(o, s);
563
+ for (const { full: i, expanded: a } of s)
564
+ n = n.replace(i, a);
567
565
  return n;
568
566
  }
569
567
  function we(e, t, n) {
570
568
  const r = e + t;
571
569
  if (r === "0" || r.match(/^0+$/))
572
570
  return "0";
573
- const i = t.length;
574
- if (n <= i) {
575
- const s = r.slice(0, e.length + n), a = r.slice(e.length + n);
576
- return a ? `${s}.${a}` : s;
571
+ const s = t.length;
572
+ if (n <= s) {
573
+ const a = r.slice(0, e.length + n), o = r.slice(e.length + n);
574
+ return o ? `${a}.${o}` : a;
577
575
  }
578
- const o = n - i;
579
- return r + "0".repeat(o);
576
+ const i = n - s;
577
+ return r + "0".repeat(i);
580
578
  }
581
579
  function De(e, t, n) {
582
580
  const r = e + t;
583
581
  if (r === "0" || r.match(/^0+$/))
584
582
  return "0";
585
- const s = e.length - n;
586
- if (s <= 0) {
587
- const a = Math.abs(s), c = `0.${"0".repeat(a)}${r}`;
583
+ const a = e.length - n;
584
+ if (a <= 0) {
585
+ const o = Math.abs(a), c = `0.${"0".repeat(o)}${r}`;
588
586
  return y(c);
589
587
  }
590
- if (s < e.length) {
591
- const a = r.slice(0, s), c = r.slice(s), l = `${a}.${c}`;
588
+ if (a < e.length) {
589
+ const o = r.slice(0, a), c = r.slice(a), l = `${o}.${c}`;
592
590
  return y(l);
593
591
  }
594
592
  return y(r);
@@ -608,10 +606,10 @@ function y(e) {
608
606
  }
609
607
  return e.replace(/\.?0+$/, "") || e;
610
608
  }
611
- function me(e) {
609
+ function Me(e) {
612
610
  const t = /(\d+\.?\d*)\s*(Qa|Qi|Sx|Sp|[kmbMTO]|N)/gi;
613
- return e.replace(t, (n, r, i) => {
614
- const o = {
611
+ return e.replace(t, (n, r, s) => {
612
+ const i = {
615
613
  k: 3,
616
614
  // Thousand
617
615
  K: 3,
@@ -629,66 +627,66 @@ function me(e) {
629
627
  t: 12
630
628
  // Trillion
631
629
  };
632
- let s;
633
- if (i.length > 1) {
634
- const g = i.charAt(0).toUpperCase() + i.slice(1).toLowerCase();
635
- s = o[i] || o[g];
630
+ let a;
631
+ if (s.length > 1) {
632
+ const g = s.charAt(0).toUpperCase() + s.slice(1).toLowerCase();
633
+ a = i[s] || i[g];
636
634
  } else {
637
- const g = i.toLowerCase();
638
- s = o[i] || o[g];
635
+ const g = s.toLowerCase();
636
+ a = i[s] || i[g];
639
637
  }
640
- if (!s)
638
+ if (!a)
641
639
  return n;
642
- const a = r.startsWith("-"), c = a ? r.slice(1) : r, [l, h = ""] = c.split("."), d = l.replace(/^0+/, "") || "0";
640
+ const o = r.startsWith("-"), c = o ? r.slice(1) : r, [l, h = ""] = c.split("."), d = l.replace(/^0+/, "") || "0";
643
641
  let u;
644
642
  if (h.length === 0)
645
- u = d + "0".repeat(s);
646
- else if (h.length <= s) {
647
- const g = s - h.length;
643
+ u = d + "0".repeat(a);
644
+ else if (h.length <= a) {
645
+ const g = a - h.length;
648
646
  u = d + h + "0".repeat(g);
649
647
  } else {
650
- const g = h.slice(0, s), f = h.slice(s);
648
+ const g = h.slice(0, a), f = h.slice(a);
651
649
  u = d + g + "." + f;
652
650
  }
653
- return u = u.replace(/^(-?)0+([1-9])/, "$1$2"), u.match(/^-?0+$/) && (u = a ? "-0" : "0"), u.includes(".") && (u = u.replace(/\.?0+$/, "")), a && !u.startsWith("-") ? "-" + u : u;
651
+ return u = u.replace(/^(-?)0+([1-9])/, "$1$2"), u.match(/^-?0+$/) && (u = o ? "-0" : "0"), u.includes(".") && (u = u.replace(/\.?0+$/, "")), o && !u.startsWith("-") ? "-" + u : u;
654
652
  });
655
653
  }
656
- function Me(e) {
654
+ function ye(e) {
657
655
  if (!e || e === "0" || e === "-0" || e === "-" || e === ".")
658
656
  return e;
659
657
  const t = e.startsWith("-"), n = t ? e.slice(1) : e;
660
658
  if (!n || n === "0" || n === ".")
661
659
  return e;
662
660
  if (n.includes(".")) {
663
- const [i, o] = n.split(".");
664
- if (i && i.length > 0) {
665
- const a = (i.replace(/^0+/, "") || "0") + "." + o;
666
- return t ? "-" + a : a;
661
+ const [s, i] = n.split(".");
662
+ if (s && s.length > 0) {
663
+ const o = (s.replace(/^0+/, "") || "0") + "." + i;
664
+ return t ? "-" + o : o;
667
665
  }
668
666
  return e;
669
667
  }
670
668
  if (n.startsWith("0") && n.length > 1) {
671
- const i = n.replace(/^0+/, "") || "0";
672
- return t ? "-" + i : i;
669
+ const s = n.replace(/^0+/, "") || "0";
670
+ return t ? "-" + s : s;
673
671
  }
674
672
  return e;
675
673
  }
676
- function ye(e) {
674
+ function Ce(e) {
677
675
  return e.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000]/g, " ").replace(/\s/g, "");
678
676
  }
679
- function w(e, t) {
680
- const n = D(t);
677
+ function L(e, t) {
678
+ const n = M(t);
681
679
  return e.replace(new RegExp(n, "g"), "");
682
680
  }
683
- const Ce = (e, t) => {
684
- let n = ye(e);
685
- return t != null && t.thousandSeparator && (n = w(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = me(n)), n = Le(n), n = Ne(
681
+ const Ae = (e, t) => {
682
+ let n = Ce(e);
683
+ return t != null && t.thousandSeparator && (n = L(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Me(n)), n = Le(n), n = $e(
686
684
  n,
687
685
  t == null ? void 0 : t.enableNegative,
688
686
  t == null ? void 0 : t.decimalSeparator
689
- ), n = ee(n, (t == null ? void 0 : t.decimalSeparator) || E), t != null && t.enableLeadingZeros || (n = Me(n)), n;
687
+ ), n = te(n, (t == null ? void 0 : t.decimalSeparator) || m), t != null && t.enableLeadingZeros || (n = ye(n)), n;
690
688
  };
691
- function Ae(e, t, n) {
689
+ function Te(e, t, n) {
692
690
  return {
693
691
  enableCompactNotation: e == null ? void 0 : e.enableCompactNotation,
694
692
  enableNegative: e == null ? void 0 : e.enableNegative,
@@ -698,21 +696,21 @@ function Ae(e, t, n) {
698
696
  };
699
697
  }
700
698
  function x(e, t, n, r) {
701
- const i = A(n), o = r ?? (n == null ? void 0 : n.formatOn) === v.Change, s = Ce(
699
+ const s = A(n), i = r ?? (n == null ? void 0 : n.formatOn) === v.Change, a = Ae(
702
700
  e,
703
- Ae(n, i, o)
704
- ), a = F(
705
- s,
706
- t,
707
- i.decimalSeparator
708
- ), c = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = te(
701
+ Te(n, s, i)
702
+ ), o = ee(
709
703
  a,
704
+ t,
705
+ s.decimalSeparator
706
+ ), c = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = ne(
707
+ o,
710
708
  c,
711
- i.decimalSeparator
709
+ s.decimalSeparator
712
710
  ), h = l;
713
- return { formatted: ie(l, n, i), raw: h };
711
+ return { formatted: ae(l, n, s), raw: h };
714
712
  }
715
- function Ke(e, t, n) {
713
+ function Qe(e, t, n) {
716
714
  const r = !!(n != null && n.thousandSeparator);
717
715
  return x(
718
716
  e,
@@ -721,7 +719,7 @@ function Ke(e, t, n) {
721
719
  r
722
720
  );
723
721
  }
724
- function Te(e, t, n) {
722
+ function xe(e, t, n) {
725
723
  if (e === "Backspace" || e === "Delete")
726
724
  return e === "Delete" && t === n ? {
727
725
  endOffset: 1
@@ -729,39 +727,39 @@ function Te(e, t, n) {
729
727
  endOffset: 0
730
728
  };
731
729
  }
732
- function xe(e, t) {
730
+ function Ie(e, t) {
733
731
  const { decimalSeparator: n } = A(t), r = e.target;
734
- if (V(e, r, t, n)) {
732
+ if (F(e, r, t, n)) {
735
733
  e.preventDefault();
736
734
  return;
737
735
  }
738
- return $e(e, r, t), Te(e.key, r.selectionStart, r.selectionEnd);
736
+ return me(e, r, t), xe(e.key, r.selectionStart, r.selectionEnd);
739
737
  }
740
- function Ie(e, t, n, r) {
741
- const i = e.target, o = i.value, s = ve(i), a = A(r), c = (r == null ? void 0 : r.formatOn) === v.Change, { formatted: l, raw: h } = x(
742
- o,
738
+ function Oe(e, t, n, r) {
739
+ const s = e.target, i = s.value, a = Ee(s), o = A(r), c = (r == null ? void 0 : r.formatOn) === v.Change, { formatted: l, raw: h } = x(
740
+ i,
743
741
  t,
744
742
  r,
745
743
  c
746
744
  );
747
- return i.value = l, o !== l && Ee(
745
+ return s.value = l, i !== l && Ne(
746
+ s,
748
747
  i,
749
- o,
750
748
  l,
751
- s,
752
- n,
753
749
  a,
750
+ n,
751
+ o,
754
752
  r
755
753
  ), { formatted: l, raw: h };
756
754
  }
757
755
  function Re(e, t, n, r) {
758
- const i = r - n;
759
- return e + t + i;
756
+ const s = r - n;
757
+ return e + t + s;
760
758
  }
761
- function Oe(e, t, n) {
759
+ function _e(e, t, n) {
762
760
  var u;
763
761
  e.preventDefault();
764
- const r = e.target, { value: i, selectionStart: o, selectionEnd: s } = r, a = ((u = e.clipboardData) == null ? void 0 : u.getData("text/plain")) || "", c = i.slice(0, o || 0) + a + i.slice(s || 0), { formatted: l, raw: h } = x(
762
+ const r = e.target, { value: s, selectionStart: i, selectionEnd: a } = r, o = ((u = e.clipboardData) == null ? void 0 : u.getData("text/plain")) || "", c = s.slice(0, i || 0) + o + s.slice(a || 0), { formatted: l, raw: h } = x(
765
763
  c,
766
764
  t,
767
765
  n,
@@ -769,21 +767,21 @@ function Oe(e, t, n) {
769
767
  );
770
768
  r.value = l;
771
769
  const d = Re(
772
- o || 0,
773
- a.length,
770
+ i || 0,
771
+ o.length,
774
772
  c.length,
775
773
  l.length
776
774
  );
777
775
  return r.setSelectionRange(d, d), { formatted: l, raw: h };
778
776
  }
779
- function _e(e, t) {
780
- const n = D(e);
777
+ function Be(e, t) {
778
+ const n = M(e);
781
779
  return t ? `^-?[0-9]*[${n}]?[0-9]*$` : `^[0-9]*[${n}]?[0-9]*$`;
782
780
  }
783
- function Be(e) {
784
- Pe(e.decimalMaxLength), We(e.decimalMinLength), ke(e.decimalMinLength, e.decimalMaxLength), Ze(e.formatOn), ze(e.thousandSeparator), Ge(e.thousandStyle), Ue(e.decimalSeparator), je(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), Je(e.onChange);
785
- }
786
781
  function Pe(e) {
782
+ We(e.decimalMaxLength), ke(e.decimalMinLength), Ze(e.decimalMinLength, e.decimalMaxLength), Ge(e.formatOn), Ue(e.thousandSeparator), je(e.thousandStyle), ze(e.decimalSeparator), Je(e.thousandSeparator, e.decimalSeparator), D("enableCompactNotation", e.enableCompactNotation), D("enableNegative", e.enableNegative), D("enableLeadingZeros", e.enableLeadingZeros), D("rawValueMode", e.rawValueMode), Ke(e.onChange);
783
+ }
784
+ function We(e) {
787
785
  if (e !== void 0) {
788
786
  if (typeof e != "number")
789
787
  throw new Error(
@@ -799,7 +797,7 @@ function Pe(e) {
799
797
  );
800
798
  }
801
799
  }
802
- function We(e) {
800
+ function ke(e) {
803
801
  if (e !== void 0) {
804
802
  if (typeof e != "number")
805
803
  throw new Error(
@@ -815,19 +813,19 @@ function We(e) {
815
813
  );
816
814
  }
817
815
  }
818
- function ke(e, t) {
816
+ function Ze(e, t) {
819
817
  if (!(e === void 0 || t === void 0) && e > t)
820
818
  throw new Error(
821
819
  `decimalMinLength (${e}) cannot be greater than decimalMaxLength (${t}).`
822
820
  );
823
821
  }
824
- function Ze(e) {
822
+ function Ge(e) {
825
823
  if (e !== void 0 && e !== v.Blur && e !== v.Change)
826
824
  throw new Error(
827
825
  `formatOn must be either ${v.Blur} or ${v.Change}. Received: ${JSON.stringify(e)}`
828
826
  );
829
827
  }
830
- function ze(e) {
828
+ function Ue(e) {
831
829
  if (e !== void 0) {
832
830
  if (typeof e != "string")
833
831
  throw new Error(
@@ -843,13 +841,13 @@ function ze(e) {
843
841
  );
844
842
  }
845
843
  }
846
- function Ge(e) {
844
+ function je(e) {
847
845
  if (e !== void 0 && !Object.values(S).includes(e))
848
846
  throw new Error(
849
847
  `ThousandStyle must be one of: ${Object.values(S).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
850
848
  );
851
849
  }
852
- function Ue(e) {
850
+ function ze(e) {
853
851
  if (e !== void 0) {
854
852
  if (typeof e != "string")
855
853
  throw new Error(
@@ -865,32 +863,32 @@ function Ue(e) {
865
863
  );
866
864
  }
867
865
  }
868
- function je(e, t) {
866
+ function Je(e, t) {
869
867
  if (!(e === void 0 || t === void 0) && e === t)
870
868
  throw new Error(
871
869
  `Decimal separator can't be same as thousand separator. thousandSeparator: ${e}, decimalSeparator: ${t}`
872
870
  );
873
871
  }
874
- function M(e, t) {
872
+ function D(e, t) {
875
873
  if (t !== void 0 && typeof t != "boolean")
876
874
  throw new Error(
877
875
  `${e} must be a boolean. Received: ${typeof t} (${JSON.stringify(t)})`
878
876
  );
879
877
  }
880
- function Je(e) {
878
+ function Ke(e) {
881
879
  if (e !== void 0 && typeof e != "function")
882
880
  throw new Error(
883
881
  `onChange must be a function or undefined. Received: ${typeof e} (${JSON.stringify(e)})`
884
882
  );
885
883
  }
886
- class Qe {
884
+ class Xe {
887
885
  constructor(t, {
888
886
  decimalMaxLength: n = I,
889
- decimalMinLength: r = R,
890
- formatOn: i = O,
891
- thousandSeparator: o = _,
892
- thousandStyle: s = B,
893
- decimalSeparator: a = E,
887
+ decimalMinLength: r = O,
888
+ formatOn: s = R,
889
+ thousandSeparator: i = _,
890
+ thousandStyle: a = B,
891
+ decimalSeparator: o = m,
894
892
  enableCompactNotation: c = !0,
895
893
  enableNegative: l = P,
896
894
  enableLeadingZeros: h = W,
@@ -898,18 +896,18 @@ class Qe {
898
896
  onChange: u,
899
897
  ...g
900
898
  }) {
901
- L(this, "element");
902
- L(this, "options");
903
- L(this, "resolvedOptions");
904
- L(this, "rawValue", "");
905
- L(this, "caretPositionBeforeChange");
906
- if (Be({
899
+ $(this, "element");
900
+ $(this, "options");
901
+ $(this, "resolvedOptions");
902
+ $(this, "rawValue", "");
903
+ $(this, "caretPositionBeforeChange");
904
+ if (Pe({
907
905
  decimalMaxLength: n,
908
906
  decimalMinLength: r,
909
- formatOn: i,
910
- thousandSeparator: o,
911
- thousandStyle: s,
912
- decimalSeparator: a,
907
+ formatOn: s,
908
+ thousandSeparator: i,
909
+ thousandStyle: a,
910
+ decimalSeparator: o,
913
911
  enableCompactNotation: c,
914
912
  enableNegative: l,
915
913
  enableLeadingZeros: h,
@@ -919,17 +917,17 @@ class Qe {
919
917
  decimalMaxLength: n,
920
918
  decimalMinLength: r,
921
919
  onChange: u,
922
- formatOn: i,
923
- thousandSeparator: o,
924
- thousandStyle: s,
925
- decimalSeparator: a,
920
+ formatOn: s,
921
+ thousandSeparator: i,
922
+ thousandStyle: a,
923
+ decimalSeparator: o,
926
924
  enableCompactNotation: c,
927
925
  enableNegative: l,
928
926
  enableLeadingZeros: h,
929
927
  rawValueMode: d,
930
928
  ...g
931
929
  }, this.resolvedOptions = this.getResolvedOptions(), this.createInputElement(t), this.setupEventListeners(), this.resolvedOptions.rawValueMode && this.element.value) {
932
- const f = this.element.value, p = this.resolvedOptions.thousandSeparator ? w(f, this.resolvedOptions.thousandSeparator) : f;
930
+ const f = this.element.value, p = this.resolvedOptions.thousandSeparator ? L(f, this.resolvedOptions.thousandSeparator) : f;
933
931
  this.rawValue = p, this.element.value = this.formatValueForDisplay(p);
934
932
  } else if (this.element.value) {
935
933
  const f = this.element.value;
@@ -938,16 +936,16 @@ class Qe {
938
936
  }
939
937
  createInputElement(t) {
940
938
  if (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"), this.resolvedOptions.decimalSeparator !== void 0 && this.resolvedOptions.enableNegative !== void 0) {
941
- const H = _e(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
939
+ const H = Be(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
942
940
  this.element.setAttribute("pattern", H);
943
941
  }
944
942
  const {
945
943
  decimalMaxLength: n,
946
944
  decimalMinLength: r,
947
- formatOn: i,
948
- thousandSeparator: o,
949
- thousandStyle: s,
950
- decimalSeparator: a,
945
+ formatOn: s,
946
+ thousandSeparator: i,
947
+ thousandStyle: a,
948
+ decimalSeparator: o,
951
949
  enableCompactNotation: c,
952
950
  enableNegative: l,
953
951
  enableLeadingZeros: h,
@@ -956,8 +954,8 @@ class Qe {
956
954
  value: g,
957
955
  defaultValue: f,
958
956
  type: p,
959
- inputMode: $,
960
- spellcheck: m,
957
+ inputMode: E,
958
+ spellcheck: w,
961
959
  autocomplete: qe,
962
960
  ...q
963
961
  } = this.options;
@@ -969,12 +967,12 @@ class Qe {
969
967
  getResolvedOptions() {
970
968
  return {
971
969
  decimalMaxLength: this.options.decimalMaxLength ?? I,
972
- decimalMinLength: this.options.decimalMinLength ?? R,
973
- formatOn: this.options.formatOn ?? O,
970
+ decimalMinLength: this.options.decimalMinLength ?? O,
971
+ formatOn: this.options.formatOn ?? R,
974
972
  thousandSeparator: this.options.thousandSeparator ?? _,
975
973
  thousandStyle: this.options.thousandStyle ?? B,
976
- decimalSeparator: this.options.decimalSeparator ?? E,
977
- enableCompactNotation: this.options.enableCompactNotation ?? X,
974
+ decimalSeparator: this.options.decimalSeparator ?? m,
975
+ enableCompactNotation: this.options.enableCompactNotation ?? Y,
978
976
  enableNegative: this.options.enableNegative ?? P,
979
977
  enableLeadingZeros: this.options.enableLeadingZeros ?? W,
980
978
  rawValueMode: this.options.rawValueMode ?? k,
@@ -1003,17 +1001,17 @@ class Qe {
1003
1001
  formatValueForDisplay(t) {
1004
1002
  if (!t)
1005
1003
  return t;
1006
- const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: i, decimalSeparator: o } = this.resolvedOptions;
1007
- return n && r !== S.None ? G(
1004
+ const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: s, decimalSeparator: i } = this.resolvedOptions;
1005
+ return n && r !== S.None ? j(
1008
1006
  t,
1009
1007
  n,
1010
1008
  r,
1011
- i,
1012
- o
1009
+ s,
1010
+ i
1013
1011
  ) : t;
1014
1012
  }
1015
1013
  handleChange(t) {
1016
- const { formatted: n, raw: r } = Ie(
1014
+ const { formatted: n, raw: r } = Oe(
1017
1015
  t,
1018
1016
  this.resolvedOptions.decimalMaxLength,
1019
1017
  this.caretPositionBeforeChange,
@@ -1022,40 +1020,40 @@ class Qe {
1022
1020
  this.caretPositionBeforeChange = void 0, this.handleValueChange(n, r);
1023
1021
  }
1024
1022
  handleKeyDown(t) {
1025
- const n = t.target, { selectionStart: r, selectionEnd: i } = n, o = this.buildFormattingOptions(), s = xe(t, {
1026
- formatOn: o.formatOn,
1027
- thousandSeparator: o.thousandSeparator,
1028
- ThousandStyle: o.ThousandStyle,
1029
- decimalSeparator: o.decimalSeparator
1023
+ const n = t.target, { selectionStart: r, selectionEnd: s } = n, i = this.buildFormattingOptions(), a = Ie(t, {
1024
+ formatOn: i.formatOn,
1025
+ thousandSeparator: i.thousandSeparator,
1026
+ ThousandStyle: i.ThousandStyle,
1027
+ decimalSeparator: i.decimalSeparator
1030
1028
  });
1031
- s ? this.caretPositionBeforeChange = {
1029
+ a ? this.caretPositionBeforeChange = {
1032
1030
  selectionStart: r ?? 0,
1033
- selectionEnd: i ?? 0,
1034
- endOffset: s.endOffset
1031
+ selectionEnd: s ?? 0,
1032
+ endOffset: a.endOffset
1035
1033
  } : this.caretPositionBeforeChange = {
1036
1034
  selectionStart: r ?? 0,
1037
- selectionEnd: i ?? 0
1035
+ selectionEnd: s ?? 0
1038
1036
  };
1039
1037
  }
1040
1038
  handlePaste(t) {
1041
- const { formatted: n, raw: r } = Oe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
1039
+ const { formatted: n, raw: r } = _e(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
1042
1040
  this.handleValueChange(n, r);
1043
- const i = new Event("input", { bubbles: !0, cancelable: !0 });
1044
- this.element.dispatchEvent(i);
1041
+ const s = new Event("input", { bubbles: !0, cancelable: !0 });
1042
+ this.element.dispatchEvent(s);
1045
1043
  }
1046
1044
  handleFocus(t) {
1047
1045
  if (this.resolvedOptions.formatOn === v.Blur && this.resolvedOptions.thousandSeparator) {
1048
1046
  const n = t.target;
1049
- n.value = w(n.value, this.resolvedOptions.thousandSeparator);
1047
+ n.value = L(n.value, this.resolvedOptions.thousandSeparator);
1050
1048
  }
1051
1049
  }
1052
1050
  handleBlur(t) {
1053
- const n = t.target, { thousandSeparator: r, thousandStyle: i } = this.resolvedOptions;
1054
- if (r && i !== S.None && n.value) {
1055
- const o = n.value, s = this.formatValueForDisplay(n.value);
1056
- n.value = s;
1057
- const a = this.resolvedOptions.rawValueMode ? w(s, r) : void 0;
1058
- if (this.handleValueChange(s, a), o !== s) {
1051
+ const n = t.target, { thousandSeparator: r, thousandStyle: s } = this.resolvedOptions;
1052
+ if (r && s !== S.None && n.value) {
1053
+ const i = n.value, a = this.formatValueForDisplay(n.value);
1054
+ n.value = a;
1055
+ const o = this.resolvedOptions.rawValueMode ? L(a, r) : void 0;
1056
+ if (this.handleValueChange(a, o), i !== a) {
1059
1057
  const c = new Event("input", { bubbles: !0, cancelable: !0 });
1060
1058
  this.element.dispatchEvent(c);
1061
1059
  const l = new Event("change", { bubbles: !0, cancelable: !0 });
@@ -1068,7 +1066,7 @@ class Qe {
1068
1066
  }
1069
1067
  setValue(t) {
1070
1068
  if (this.resolvedOptions.rawValueMode) {
1071
- const n = this.resolvedOptions.thousandSeparator ? w(t, this.resolvedOptions.thousandSeparator) : t;
1069
+ const n = this.resolvedOptions.thousandSeparator ? L(t, this.resolvedOptions.thousandSeparator) : t;
1072
1070
  this.rawValue = n, this.element.value = this.formatValueForDisplay(n);
1073
1071
  } else
1074
1072
  this.element.value = t;
@@ -1116,7 +1114,7 @@ class Qe {
1116
1114
  const t = this.getValue();
1117
1115
  if (!t)
1118
1116
  return NaN;
1119
- const n = this.resolvedOptions.thousandSeparator ? w(t, this.resolvedOptions.thousandSeparator) : t, r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(D(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
1117
+ const n = this.resolvedOptions.thousandSeparator ? L(t, this.resolvedOptions.thousandSeparator) : t, r = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(M(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
1120
1118
  return parseFloat(r);
1121
1119
  }
1122
1120
  /**
@@ -1133,11 +1131,11 @@ class Qe {
1133
1131
  }
1134
1132
  export {
1135
1133
  v as FormatOn,
1136
- Qe as NumoraInput,
1134
+ Xe as NumoraInput,
1137
1135
  S as ThousandStyle,
1138
- Ke as formatValue,
1139
- Ie as handleOnChangeNumoraInput,
1140
- xe as handleOnKeyDownNumoraInput,
1141
- Oe as handleOnPasteNumoraInput,
1142
- x as processAndFormatValue
1136
+ x as formatInputValue,
1137
+ Qe as formatValueForDisplay,
1138
+ Oe as handleOnChangeNumoraInput,
1139
+ Ie as handleOnKeyDownNumoraInput,
1140
+ _e as handleOnPasteNumoraInput
1143
1141
  };