numora 2.0.5 → 3.0.1

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,200 +1,195 @@
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);
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
- }
9
- function A(e) {
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 v = (e, t, n) => ie(e, typeof t != "symbol" ? t + "" : t, n);
4
+ var $ = /* @__PURE__ */ ((e) => (e.Blur = "blur", e.Change = "change", e))($ || {}), S = /* @__PURE__ */ ((e) => (e.None = "none", e.Thousand = "thousand", e.Lakh = "lakh", e.Wan = "wan", e))(S || {});
5
+ const _ = 2, z = 0, Z = $.Blur, B = ",", W = S.None, N = ".", oe = !1, k = !1, U = !1, G = !1;
6
+ function T(e) {
10
7
  return {
11
- decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? E,
8
+ decimalSeparator: (e == null ? void 0 : e.decimalSeparator) ?? N,
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 K(e, t) {
13
+ const n = e.startsWith("-"), s = n ? e.slice(1) : e, [o = "", r = ""] = s.split(t);
14
+ return {
15
+ sign: n ? "-" : "",
16
+ integer: o,
17
+ decimal: r
18
+ };
19
+ }
20
+ function ae(e, t) {
21
+ if (!e.value.includes(t)) return !1;
22
+ const { selectionStart: n, selectionEnd: s, value: o } = e;
23
+ return !o.slice(n ?? 0, s ?? 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 ce(e, t, n) {
26
+ const { key: s } = e;
27
+ if (s !== "," && s !== ".") return !1;
28
+ if (ae(t, n))
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 !== n) {
31
+ const { selectionStart: o, selectionEnd: r, value: i } = t, a = o ?? 0, c = r ?? a;
32
+ t.value = i.slice(0, a) + n + i.slice(c);
33
+ const l = a + 1;
34
+ return t.setSelectionRange(l, l), !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;
54
- }, N = {
38
+ const le = (e, t, n = N) => {
39
+ const { sign: s, integer: o, decimal: r } = K(e, n);
40
+ if (!e.includes(n)) return e;
41
+ const a = r.slice(0, t);
42
+ return `${s}${o}${n}${a}`;
43
+ }, he = (e, t = N) => {
44
+ const n = e.indexOf(t);
45
+ if (n === -1) return e;
46
+ const s = e.slice(0, n + 1), r = e.slice(n + 1).split(",").join("").split(".").join("").split(t).join("");
47
+ return s + r;
48
+ }, ue = (e, t = 0, n = N) => {
49
+ if (t <= 0) return e;
50
+ const { sign: s, integer: o, decimal: r } = K(e, n);
51
+ if (r.length >= t)
52
+ return e.includes(n) ? e : `${s}${o}${n}${r}`;
53
+ const i = r.padEnd(t, "0");
54
+ return `${s}${o}${n}${i}`;
55
+ }, L = {
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 y(e, t, n = S.Thousand, s = !1, o = ".") {
61
+ if (!e || e === "0" || e === o || e === "-" || e === `-${o}`)
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 r = e.includes(o), i = e.startsWith("-"), a = i ? e.slice(1) : e, [c, l] = a.split(o);
63
64
  if (!c) {
64
- const u = l ? `${i}${l}` : a;
65
- return s ? `-${u}` : u;
65
+ const f = l ? `${o}${l}` : a;
66
+ return i ? `-${f}` : f;
66
67
  }
67
- if (r && c.startsWith("0") && c.length > 1) {
68
- const u = c.match(/^(0+)/);
69
- if (u) {
70
- const g = u[1], f = c.slice(g.length);
71
- if (f) {
72
- const p = Z(f, t, n), $ = g + p, m = s ? "-" : "";
73
- return o ? l ? `${m}${$}${i}${l}` : `${m}${$}${i}` : `${m}${$}`;
68
+ if (s && c.startsWith("0") && c.length > 1) {
69
+ const f = c.match(/^(0+)/);
70
+ if (f) {
71
+ const d = f[1], g = c.slice(d.length);
72
+ if (g) {
73
+ const p = j(g, t, n), m = d + p, D = i ? "-" : "";
74
+ return r ? l ? `${D}${m}${o}${l}` : `${D}${m}${o}` : `${D}${m}`;
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 = j(c, t, n), u = i ? "-" : "";
79
+ return r ? l ? `${u}${h}${o}${l}` : `${u}${h}${o}` : `${u}${h}`;
79
80
  }
80
- function Z(e, t, n) {
81
+ function j(e, t, n) {
81
82
  if (e === "0" || e === "")
82
83
  return e;
83
84
  switch (n) {
84
85
  case S.None:
85
86
  return e;
86
87
  case S.Thousand:
87
- return ne(e, t);
88
+ return fe(e, t);
88
89
  case S.Lakh:
89
- return re(e, t);
90
+ return de(e, t);
90
91
  case S.Wan:
91
- return se(e, t);
92
+ return ge(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);
97
+ function fe(e, t) {
98
+ return q(e, t, L.thousand.size);
98
99
  }
99
- function re(e, t) {
100
- if (e.length <= N.lakh.firstGroup)
100
+ function de(e, t) {
101
+ if (e.length <= L.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(""));
106
- return r.reverse().join(t);
107
- }
108
- function se(e, t) {
109
- return U(e, t, N.wan.size);
110
- }
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);
116
- }
117
- function ie(e, t, n) {
118
- return (t == null ? void 0 : t.formatOn) === "change" && t.thousandSeparator ? G(
103
+ const n = e.split("").reverse(), s = [], o = n.slice(0, L.lakh.firstGroup).reverse().join("");
104
+ s.push(o);
105
+ for (let r = L.lakh.firstGroup; r < n.length; r += L.lakh.restGroup)
106
+ s.push(n.slice(r, r + L.lakh.restGroup).reverse().join(""));
107
+ return s.reverse().join(t);
108
+ }
109
+ function ge(e, t) {
110
+ return q(e, t, L.wan.size);
111
+ }
112
+ function q(e, t, n) {
113
+ const s = e.split("").reverse(), o = [];
114
+ for (let r = 0; r < s.length; r += n)
115
+ o.push(s.slice(r, r + n).reverse().join(""));
116
+ return o.reverse().join(t);
117
+ }
118
+ function pe(e, t, n) {
119
+ return (t == null ? void 0 : t.formatOn) === $.Change && t.thousandSeparator ? y(
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) ?? N
124
125
  ) : e;
125
126
  }
126
- 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;
127
+ function b(e, t, n, s = ".") {
128
+ let o = 0;
129
+ for (let r = 0; r < t && r < e.length; r++)
130
+ e[r] !== n && o++;
131
+ return o;
133
132
  }
134
- function oe(e, t, n, r = ".") {
133
+ function Se(e, t, n, s = ".") {
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 o = 0;
137
+ for (let r = 0; r < e.length; r++)
138
+ if (e[r] !== n) {
139
+ if (o === t - 1)
140
+ return r + 1;
141
+ o++;
144
142
  }
145
- }
146
143
  return e.length;
147
144
  }
148
- function C(e, t, n, r = ".") {
145
+ function A(e, t, n, s = ".") {
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 o = 0;
149
+ for (let r = 0; r < e.length; r++)
150
+ if (e[r] !== n) {
151
+ if (o++, o === t)
152
+ return r + 1;
153
+ if (o > t)
154
+ return r;
159
155
  }
160
- }
161
156
  return e.length;
162
157
  }
163
- function j(e, t, n) {
158
+ function Q(e, t, n) {
164
159
  return t < 0 || t >= e.length ? !1 : e[t] === n;
165
160
  }
166
- function ae(e, t = {}) {
161
+ function me(e, t = {}) {
167
162
  const {
168
163
  thousandSeparator: n,
169
- 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);
164
+ decimalSeparator: s = ".",
165
+ prefix: o = "",
166
+ suffix: r = ""
167
+ } = t, i = Array.from({ length: e.length + 1 }).map(() => !0);
168
+ if (o && i.fill(!1, 0, o.length), r) {
169
+ const a = e.length - r.length;
170
+ i.fill(!1, a + 1, e.length + 1);
176
171
  }
177
172
  for (let a = 0; a < e.length; a++) {
178
173
  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));
174
+ (n && c === n || c === s) && (i[a] = !1, a + 1 < e.length && !/\d/.test(e[a + 1]) && (i[a + 1] = !1));
180
175
  }
181
- return s.some((a) => a) || s.fill(!0), s;
176
+ return i.some((a) => a) || i.fill(!0), i;
182
177
  }
183
- 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);
178
+ function I(e, t, n, s) {
179
+ const o = e.length;
180
+ if (t = Math.max(0, Math.min(t, o)), !n[t]) {
181
+ let r = t;
182
+ for (; r <= o && !n[r]; )
183
+ r++;
184
+ let i = t;
185
+ for (; i >= 0 && !n[i]; )
186
+ i--;
187
+ r <= o && i >= 0 ? t = t - i < r - t ? i : r : r <= o ? t = r : i >= 0 && (t = i);
193
188
  }
194
- return (t === -1 || t > i) && (t = i), t;
189
+ return (t === -1 || t > o) && (t = o), t;
195
190
  }
196
- const J = (e, t) => e === t;
197
- function ce(e, t, n, r, i, o, s = ".", a = {}) {
191
+ const H = (e, t) => e === t;
192
+ function $e(e, t, n, s, o, r, i = ".", a = {}) {
198
193
  if (n < 0)
199
194
  return 0;
200
195
  if (n > e.length || e === "" || t === "")
@@ -202,145 +197,145 @@ 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 = Q(
206
201
  e,
207
202
  n,
208
- r
209
- ), d = e.indexOf(s), u = t.indexOf(s);
203
+ s
204
+ ), u = e.indexOf(i), f = t.indexOf(i);
210
205
  if (a.isCharacterEquivalent && e !== t) {
211
- const p = le(
206
+ const p = be(
212
207
  e,
213
208
  t,
214
209
  n,
215
- a.isCharacterEquivalent || J,
216
- o,
210
+ a.isCharacterEquivalent || H,
211
+ r,
217
212
  a
218
213
  );
219
214
  if (p !== void 0)
220
215
  return p;
221
216
  }
222
217
  if (l)
223
- return he(
218
+ return Ne(
224
219
  e,
225
220
  t,
226
221
  n,
227
- r,
222
+ s,
228
223
  h,
229
- d,
230
224
  u,
231
- o,
232
- s,
225
+ f,
226
+ r,
227
+ i,
233
228
  a
234
229
  );
235
- const f = ge(
230
+ const g = ve(
236
231
  e,
237
232
  t,
238
233
  n,
239
- r,
234
+ s,
240
235
  h,
241
- s
236
+ i
242
237
  );
243
- return a.boundary ? T(t, f, a.boundary) : f;
238
+ return a.boundary ? I(t, g, a.boundary) : g;
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++) {
248
- l[f] = -1;
240
+ function be(e, t, n, s, o, r) {
241
+ const i = e.length, a = t.length, c = {}, l = new Array(i);
242
+ for (let g = 0; g < i; g++) {
243
+ l[g] = -1;
249
244
  for (let p = 0; p < a; p++) {
250
245
  if (c[p]) continue;
251
- if (r(
252
- e[f],
246
+ if (s(
247
+ e[g],
253
248
  t[p],
254
249
  {
255
250
  oldValue: e,
256
251
  newValue: t,
257
- typedRange: i,
258
- oldIndex: f,
252
+ typedRange: o,
253
+ oldIndex: g,
259
254
  newIndex: p
260
255
  }
261
256
  )) {
262
- l[f] = p, c[p] = !0;
257
+ l[g] = p, c[p] = !0;
263
258
  break;
264
259
  }
265
260
  }
266
261
  }
267
262
  let h = n;
268
- for (; h < s && (l[h] === -1 || !/\d/.test(e[h])); )
263
+ for (; h < i && (l[h] === -1 || !/\d/.test(e[h])); )
269
264
  h++;
270
- const d = h === s || l[h] === -1 ? a : l[h];
265
+ const u = h === i || l[h] === -1 ? a : l[h];
271
266
  for (h = n - 1; h >= 0 && l[h] === -1; ) h--;
272
- const u = h === -1 || l[h] === -1 ? 0 : l[h] + 1;
273
- if (u > d) return d;
274
- const g = n - u < d - n ? u : d;
275
- return o.boundary ? T(t, g, o.boundary) : g;
276
- }
277
- function he(e, t, n, r, i, o, s, a, c, l = {}) {
278
- if (i)
279
- return ue(
267
+ const f = h === -1 || l[h] === -1 ? 0 : l[h] + 1;
268
+ if (f > u) return u;
269
+ const d = n - f < u - n ? f : u;
270
+ return r.boundary ? I(t, d, r.boundary) : d;
271
+ }
272
+ function Ne(e, t, n, s, o, r, i, a, c, l = {}) {
273
+ if (o)
274
+ return De(
280
275
  e,
281
276
  t,
282
277
  n,
283
- r,
284
278
  s,
279
+ i,
285
280
  c
286
281
  );
287
282
  const h = b(
288
283
  e,
289
284
  n,
290
- r,
285
+ s,
291
286
  c
292
- ), d = b(
287
+ ), u = b(
293
288
  e,
294
289
  e.length,
295
- r,
290
+ s,
296
291
  c
297
- ), u = b(
292
+ ), f = b(
298
293
  t,
299
294
  t.length,
300
- r,
295
+ s,
301
296
  c
302
- ), g = d - u, f = de(
297
+ ), d = u - f, g = Ee(
303
298
  e,
304
299
  n,
305
- r,
300
+ s,
306
301
  h,
307
- g,
308
- o,
302
+ d,
303
+ r,
309
304
  a,
310
305
  c
311
- ), p = o === -1 || n <= o, $ = fe(
306
+ ), p = r === -1 || n <= r, m = Le(
312
307
  t,
313
- f,
314
- r,
315
308
  g,
309
+ s,
310
+ d,
316
311
  a,
317
312
  c,
318
313
  p,
319
- s
314
+ i
320
315
  );
321
- return l.boundary ? T(t, $, l.boundary) : $;
316
+ return l.boundary ? I(t, m, l.boundary) : m;
322
317
  }
323
- function ue(e, t, n, r, i, o) {
324
- const s = n + 1;
325
- if (s < e.length) {
318
+ function De(e, t, n, s, o, r) {
319
+ const i = n + 1;
320
+ if (i < e.length) {
326
321
  const a = b(
327
322
  e,
323
+ i,
328
324
  s,
329
- r,
330
- o
331
- ), c = oe(
325
+ r
326
+ ), c = Se(
332
327
  t,
333
328
  a,
334
- r,
335
- o
329
+ s,
330
+ r
336
331
  );
337
- return c < t.length && t[c] !== r ? c + 1 : c;
332
+ return c < t.length && t[c] !== s ? 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 Ee(e, t, n, s, o, r, i, a) {
337
+ if (i) {
338
+ const { start: l, isDelete: h } = i;
344
339
  return h ? b(
345
340
  e,
346
341
  l,
@@ -353,102 +348,102 @@ function de(e, t, n, r, i, o, s, a) {
353
348
  a
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 && o > 0 ? s + 1 : s;
357
352
  }
358
- function fe(e, t, n, r, i, o, s, a) {
359
- if (s && a !== -1) {
353
+ function Le(e, t, n, s, o, r, i, a) {
354
+ if (i && a !== -1) {
360
355
  const l = e.substring(0, a), h = b(
361
356
  l,
362
357
  l.length,
363
358
  n,
364
- o
359
+ r
365
360
  );
366
361
  if (t <= h) {
367
- const d = C(
362
+ const u = A(
368
363
  l,
369
364
  t,
370
365
  n,
371
- o
366
+ r
372
367
  );
373
- if (d > 0 && d < l.length && b(
368
+ if (u > 0 && u < l.length && b(
374
369
  l,
375
- d,
370
+ u,
376
371
  n,
377
- o
372
+ r
378
373
  ) === t) {
379
- if (l[d] === n && i && r > 0 && d < l.length - 1)
380
- return d + 1;
381
- if (!i && r > 0 && d < l.length - 1)
382
- return Math.min(d + 1, l.length);
374
+ if (l[u] === n && o && s > 0 && u < l.length - 1)
375
+ return u + 1;
376
+ if (!o && s > 0 && u < l.length - 1)
377
+ return Math.min(u + 1, l.length);
383
378
  }
384
- return d;
379
+ return u;
385
380
  }
386
381
  }
387
- const c = C(
382
+ const c = A(
388
383
  e,
389
384
  t,
390
385
  n,
391
- o
386
+ r
392
387
  );
393
388
  if (c > 0 && c < e.length && b(
394
389
  e,
395
390
  c,
396
391
  n,
397
- o
392
+ r
398
393
  ) === t) {
399
- if (e[c] === n && i && r > 0 && c < e.length - 1)
394
+ if (e[c] === n && o && s > 0 && c < e.length - 1)
400
395
  return c + 1;
401
- if (!i && r > 0 && c < e.length - 1)
396
+ if (!o && s > 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 ve(e, t, n, s, o, r) {
402
+ const i = n >= e.length, a = b(
408
403
  e,
409
404
  n,
410
- r,
411
- o
405
+ s,
406
+ r
412
407
  ), c = b(
413
408
  e,
414
409
  e.length,
415
- r,
416
- o
410
+ s,
411
+ r
417
412
  ), l = b(
418
413
  t,
419
414
  t.length,
420
- r,
421
- o
415
+ s,
416
+ r
422
417
  );
423
- if (s || a === c)
418
+ if (i || a === 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);
428
- const u = C(
421
+ let u = a;
422
+ h > 0 && !i && a < c && (u = a + 1);
423
+ const f = A(
429
424
  t,
430
- d,
431
- r,
432
- o
425
+ u,
426
+ s,
427
+ r
433
428
  );
434
- return i && !j(t, u, r) ? Math.max(0, u - 1) : u;
429
+ return o && !Q(t, f, s) ? Math.max(0, f - 1) : f;
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 we(e, t, n) {
432
+ const { selectionStart: s, selectionEnd: o, endOffset: r = 0 } = e;
433
+ if (s !== o) {
434
+ const h = o - s;
440
435
  return {
441
- start: r,
442
- end: i,
436
+ start: s,
437
+ end: o,
443
438
  deletedLength: h,
444
439
  isDelete: !1
445
440
  };
446
441
  }
447
- if (o > 0) {
448
- const h = o;
442
+ if (r > 0) {
443
+ const h = r;
449
444
  return {
450
- start: r,
451
- end: r + h,
445
+ start: s,
446
+ end: s + h,
452
447
  deletedLength: h,
453
448
  isDelete: !0
454
449
  };
@@ -456,31 +451,31 @@ function pe(e, t, n) {
456
451
  const a = t.length, c = n.length, l = a - c;
457
452
  if (!(l <= 0))
458
453
  return {
459
- start: r,
460
- end: r + l,
454
+ start: s,
455
+ end: s + l,
461
456
  deletedLength: l,
462
457
  isDelete: !1
463
458
  };
464
459
  }
465
- function Se(e, t) {
460
+ function ye(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 s = e.length - 1, o = t.length - 1;
467
+ for (; s >= n && o >= n && e[s] === t[o]; )
468
+ s--, o--;
469
+ const r = s - n + 1, i = o - n + 1;
470
+ if (!(r === 0 && i === 0))
476
471
  return {
477
472
  start: n,
478
- end: r + 1,
479
- deletedLength: o,
480
- isDelete: o > s
473
+ end: s + 1,
474
+ deletedLength: r,
475
+ isDelete: r > i
481
476
  };
482
477
  }
483
- function z(e, t) {
478
+ function J(e, t) {
484
479
  if (e.value = e.value, e === null)
485
480
  return !1;
486
481
  if (e.createTextRange) {
@@ -489,111 +484,348 @@ 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 Me(e, t, n) {
488
+ return e.selectionStart === 0 && e.selectionEnd === e.value.length ? null : (J(e, t), setTimeout(() => {
489
+ e.value === n && e.selectionStart !== t && J(e, t);
495
490
  }, 0));
496
491
  }
497
- function ve(e) {
492
+ function xe(e) {
498
493
  return Math.max(e.selectionStart, e.selectionEnd);
499
494
  }
500
- function $e(e, t, n) {
501
- if ((n == null ? void 0 : n.formatOn) !== v.Change || !n.thousandSeparator)
495
+ function Ce(e, t, n) {
496
+ if ((n == null ? void 0 : n.formatOn) !== $.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: s, selectionEnd: o, value: r } = t;
499
+ if (s === null || o === null || s !== o)
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: i } = e, a = n.thousandSeparator;
502
+ i === "Backspace" && s > 0 && r[s - 1] === a && t.setSelectionRange(s - 1, s - 1), i === "Delete" && r[s] === a && t.setSelectionRange(s + 1, s + 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(
504
+ function Ae(e, t, n, s, o, r, i) {
505
+ if (!o) return;
506
+ const { selectionStart: a = 0, selectionEnd: c = 0, endOffset: l = 0 } = o;
507
+ let h = we(
513
508
  { selectionStart: a, 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
521
- }), u = {
522
- thousandSeparator: (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator,
523
- isCharacterEquivalent: J,
524
- boundary: d
525
- }, g = (s == null ? void 0 : s.thousandSeparator) ?? o.thousandSeparator ?? ",", f = (s == null ? void 0 : s.ThousandStyle) ?? S.None, p = ce(
512
+ if (h || (h = ye(t, n)), !h) return;
513
+ const u = me(n, {
514
+ thousandSeparator: (i == null ? void 0 : i.thousandSeparator) ?? r.thousandSeparator,
515
+ decimalSeparator: r.decimalSeparator
516
+ }), f = {
517
+ thousandSeparator: (i == null ? void 0 : i.thousandSeparator) ?? r.thousandSeparator,
518
+ isCharacterEquivalent: H,
519
+ boundary: u
520
+ }, d = (i == null ? void 0 : i.thousandSeparator) ?? r.thousandSeparator ?? ",", g = (i == null ? void 0 : i.ThousandStyle) ?? S.None, p = $e(
526
521
  t,
527
522
  n,
528
- r,
523
+ s,
524
+ d,
529
525
  g,
526
+ h,
527
+ r.decimalSeparator,
528
+ f
529
+ );
530
+ Me(e, p, n);
531
+ }
532
+ function V(e) {
533
+ const [t, n = ""] = e.split(".");
534
+ return t.length + n.length > 30;
535
+ }
536
+ function X(e, t) {
537
+ const n = e.replace(".", ""), s = t.replace(".", ""), o = Math.max(n.length, s.length), r = n.padStart(o, "0"), i = s.padStart(o, "0");
538
+ for (let a = 0; a < o; a++) {
539
+ const c = parseInt(r[a], 10), l = parseInt(i[a], 10);
540
+ if (c !== l)
541
+ return c - l;
542
+ }
543
+ return 0;
544
+ }
545
+ const Te = [
546
+ { suffix: "N", zeros: 30 },
547
+ // Nonillion
548
+ { suffix: "O", zeros: 27 },
549
+ // Octillion
550
+ { suffix: "Sp", zeros: 24 },
551
+ // Septillion
552
+ { suffix: "Sx", zeros: 21 },
553
+ // Sextillion
554
+ { suffix: "Qi", zeros: 18 },
555
+ // Quintillion
556
+ { suffix: "Qa", zeros: 15 },
557
+ // Quadrillion
558
+ { suffix: "T", zeros: 12 },
559
+ // Trillion
560
+ { suffix: "B", zeros: 9 },
561
+ // Billion
562
+ { suffix: "M", zeros: 6 },
563
+ // Million
564
+ { suffix: "k", zeros: 3 }
565
+ // Thousand
566
+ ];
567
+ function Y(e, t, n = 0) {
568
+ const [s, o = ""] = e.split(t), r = s.replace(/^0+/, "") || "0";
569
+ for (const i of Te)
570
+ if (i.zeros >= n && (r.length > i.zeros || r.length === i.zeros && o.length > 0)) {
571
+ const a = i.zeros;
572
+ if (r.length > a) {
573
+ const c = r.slice(0, -a), u = (r.slice(-a) + o).replace(/0+$/, "");
574
+ return { scaledValue: u ? `${c}${t}${u}` : c, scaleSuffix: i.suffix };
575
+ } else {
576
+ const c = a - r.length, l = "0", u = ("0".repeat(c) + r + o).replace(/0+$/, "");
577
+ return { scaledValue: u ? `${l}${t}${u}` : l, scaleSuffix: i.suffix };
578
+ }
579
+ }
580
+ return { scaledValue: e, scaleSuffix: "" };
581
+ }
582
+ function P(e, t, n, s, o = !1, r = !1) {
583
+ if (r && o && n > 0)
584
+ return `0${s}${"0".repeat(n)}`;
585
+ const [i, a = ""] = e.split(s);
586
+ let c;
587
+ if (t === 0)
588
+ c = i;
589
+ else if (a.length === 0) {
590
+ const l = "0".repeat(Math.max(t, n));
591
+ c = `${i}${s}${l}`;
592
+ } else if (a.length < t) {
593
+ const l = Math.max(t - a.length, n - a.length);
594
+ c = `${i}${s}${a}${"0".repeat(l)}`;
595
+ } else
596
+ c = `${i}${s}${a.slice(0, t)}`;
597
+ if (n > 0) {
598
+ const [l, h = ""] = c.split(s);
599
+ if (h.length < n) {
600
+ const u = n - h.length;
601
+ c = `${l}${s}${h}${"0".repeat(u)}`;
602
+ }
603
+ }
604
+ if (n === 0)
605
+ c = c.replace(/(\.[0-9]*?)0+$/, "$1").replace(/\.$/, "");
606
+ else {
607
+ const [l, h = ""] = c.split(s);
608
+ if (h) {
609
+ const u = h.replace(/0+$/, ""), f = u.length >= n ? u : h.slice(0, n);
610
+ c = f ? `${l}${s}${f}` : l;
611
+ }
612
+ }
613
+ return c;
614
+ }
615
+ function F(e, t) {
616
+ return !e || e === "0" || e === t || e === "-" || e === `-${t}`;
617
+ }
618
+ function ee(e) {
619
+ const t = e.startsWith("-");
620
+ return { isNegative: t, absoluteValue: t ? e.slice(1) : e };
621
+ }
622
+ function te(e, t) {
623
+ if (!e || e === "0")
624
+ return "0";
625
+ const n = e.includes(t), [s, o = ""] = n ? e.split(t) : [e, ""];
626
+ let r;
627
+ if (o.length <= 2) {
628
+ const a = 2 - o.length;
629
+ r = s + o + "0".repeat(a);
630
+ } else
631
+ r = s + o.slice(0, 2) + t + o.slice(2);
632
+ let i = r.replace(/^0+/, "") || "0";
633
+ if (i.startsWith(t) && (i = "0" + i), i.includes(t)) {
634
+ const [a, c] = i.split(t);
635
+ return a === "0" && !c ? "0" : i;
636
+ }
637
+ return i;
638
+ }
639
+ function Ie(e, t) {
640
+ const { decimals: n, decimalSeparator: s, thousandSeparator: o, thousandStyle: r, decimalsMin: i = 0 } = t;
641
+ if (F(e, s))
642
+ return "0";
643
+ const { isNegative: a, absoluteValue: c } = ee(e), l = te(c, s);
644
+ let h = l;
645
+ o && r !== S.None && (h = y(l, o, r, !1, s));
646
+ const u = P(
647
+ h,
648
+ n,
649
+ i,
650
+ s,
651
+ !1,
652
+ e === "0"
653
+ );
654
+ return `${a ? "-" : ""}${u}`;
655
+ }
656
+ function ot(e, t = 2, n = N, s, o = S.None) {
657
+ const r = Ie(e, {
658
+ decimals: t,
659
+ decimalSeparator: n,
660
+ thousandSeparator: s,
661
+ thousandStyle: o,
662
+ decimalsMin: t
663
+ // Use decimals as decimalsMin to ensure trailing zeros are shown
664
+ });
665
+ return r === "0" ? "0%" : `${r}%`;
666
+ }
667
+ function at(e, t = 2, n = {}) {
668
+ const {
669
+ missingPlaceholder: s = "?",
670
+ veryLargePlaceholder: o = "🔥",
671
+ decimalsUnder: r = 1e3,
672
+ decimalSeparator: i = N,
673
+ thousandSeparator: a,
674
+ thousandStyle: c = S.None
675
+ } = n;
676
+ if (e == null || e === "")
677
+ return s;
678
+ if (F(e, i))
679
+ return "0%";
680
+ const { isNegative: l, absoluteValue: h } = ee(e), u = te(h, i);
681
+ if (V(u))
682
+ return o;
683
+ const { scaledValue: f, scaleSuffix: d } = Y(u, i), p = X(f, r.toString()) < 0 ? t : 0;
684
+ let m = f;
685
+ a && c !== S.None && (m = y(f, a, c, !1, i));
686
+ const D = P(
687
+ m,
688
+ p,
689
+ p,
690
+ i,
691
+ !1,
692
+ !1
693
+ );
694
+ return `${l ? "-" : ""}${D}${d}%`;
695
+ }
696
+ function Pe(e) {
697
+ const t = "₀₁₂₃₄₅₆₇₈₉";
698
+ return e.replace(/[0-9]/g, (n) => t[+n]);
699
+ }
700
+ function ct(e, t = 8, n = N) {
701
+ if (!e || !e.includes(n))
702
+ return e;
703
+ const s = e.startsWith("-"), o = s ? e.slice(1) : e, [r, i] = o.split(n);
704
+ if (!i || !i.length)
705
+ return e;
706
+ const a = i.match(/^(0{3,})/);
707
+ if (!a)
708
+ return e;
709
+ const l = a[1].length, h = i.slice(l), u = r === "0" && l >= 5 ? l + 1 : l, f = Pe(u.toString());
710
+ let d = `0${f}${h}`;
711
+ const g = f.length, p = Math.max(0, t - g - 1);
712
+ h.length > p && (d = `0${f}${h.slice(0, p)}`), d = d.replace(/0+$/, "");
713
+ const m = r === "0" ? d : `${r}${d}`;
714
+ return s ? `-${m}` : m;
715
+ }
716
+ const E = {
717
+ minScale: 0,
718
+ decimalsUnder: 1e3,
719
+ decimals: 2,
720
+ decimalsMin: 0,
721
+ decimalsMinAppliesToZero: !1,
722
+ veryLargePlaceholder: "🔥",
723
+ decimalSeparator: N
724
+ };
725
+ function lt(e, t = {}) {
726
+ const {
727
+ minScale: n = E.minScale,
728
+ decimalsUnder: s = E.decimalsUnder,
729
+ decimals: o = E.decimals,
730
+ decimalsMin: r = E.decimalsMin,
731
+ decimalsMinAppliesToZero: i = E.decimalsMinAppliesToZero,
732
+ veryLargePlaceholder: a = E.veryLargePlaceholder,
733
+ decimalSeparator: c = E.decimalSeparator,
734
+ thousandSeparator: l,
735
+ thousandStyle: h = S.None
736
+ } = t;
737
+ if (!e || e === "0" || e === c || e === "-" || e === `-${c}`)
738
+ return i && r > 0 ? `0${c}${"0".repeat(r)}` : "0";
739
+ const u = e.startsWith("-"), f = u ? e.slice(1) : e;
740
+ if (V(f))
741
+ return a;
742
+ const { scaledValue: d, scaleSuffix: g } = Y(
530
743
  f,
744
+ c,
745
+ n
746
+ ), m = X(d, s.toString()) < 0 ? o : 0;
747
+ let D = d;
748
+ l && h !== S.None && (D = y(
749
+ d,
750
+ l,
531
751
  h,
532
- o.decimalSeparator,
533
- u
752
+ !1,
753
+ c
754
+ ));
755
+ const R = P(
756
+ D,
757
+ m,
758
+ r,
759
+ c,
760
+ i,
761
+ e === "0"
762
+ // Pass whether the original value is '0'
534
763
  );
535
- be(e, p, n);
764
+ return `${u ? "-" : ""}${R}${g}`;
536
765
  }
537
- const Ne = (e, t = !1, n = ".") => {
538
- const r = D(n), i = new RegExp(`[^0-9${r}]`, "g");
766
+ function x(e) {
767
+ return e.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
768
+ }
769
+ const Oe = (e, t = !1, n = ".") => {
770
+ const s = x(n), o = new RegExp(`[^0-9${s}]`, "g");
539
771
  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;
772
+ return e.replace(o, "");
773
+ const r = e.startsWith("-"), i = e.replace(o, "");
774
+ if (r) {
775
+ if (i.length > 0)
776
+ return "-" + i;
545
777
  if (e === "-")
546
778
  return "-";
547
779
  }
548
- return s;
780
+ return i;
549
781
  };
550
- function Le(e) {
782
+ function Re(e) {
551
783
  const t = /([+-]?\d+\.?\d*)[eE]([+-]?\d+)/g;
552
- let n = e, r;
553
- const i = [];
554
- for (; (r = t.exec(e)) !== null; ) {
555
- const o = r[0], s = r[1], a = parseInt(r[2], 10);
784
+ let n = e, s;
785
+ const o = [];
786
+ for (; (s = t.exec(e)) !== null; ) {
787
+ const r = s[0], i = s[1], a = parseInt(s[2], 10);
556
788
  let c;
557
789
  if (a === 0)
558
- c = s;
790
+ c = i;
559
791
  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);
792
+ const l = i.startsWith("-"), h = l ? i.slice(1) : i, [u, f = ""] = h.split(".");
793
+ a > 0 ? c = _e(u, f, a) : c = ze(u, f, Math.abs(a)), l && (c = "-" + c);
562
794
  }
563
- i.push({ full: o, expanded: c });
795
+ o.push({ full: r, expanded: c });
564
796
  }
565
- for (const { full: o, expanded: s } of i)
566
- n = n.replace(o, s);
797
+ for (const { full: r, expanded: i } of o)
798
+ n = n.replace(r, i);
567
799
  return n;
568
800
  }
569
- function we(e, t, n) {
570
- const r = e + t;
571
- if (r === "0" || r.match(/^0+$/))
801
+ function _e(e, t, n) {
802
+ const s = e + t;
803
+ if (s === "0" || s.match(/^0+$/))
572
804
  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;
805
+ const o = t.length;
806
+ if (n <= o) {
807
+ const i = s.slice(0, e.length + n), a = s.slice(e.length + n);
808
+ return a ? `${i}.${a}` : i;
577
809
  }
578
- const o = n - i;
579
- return r + "0".repeat(o);
810
+ const r = n - o;
811
+ return s + "0".repeat(r);
580
812
  }
581
- function De(e, t, n) {
582
- const r = e + t;
583
- if (r === "0" || r.match(/^0+$/))
813
+ function ze(e, t, n) {
814
+ const s = e + t;
815
+ if (s === "0" || s.match(/^0+$/))
584
816
  return "0";
585
- const s = e.length - n;
586
- if (s <= 0) {
587
- const a = Math.abs(s), c = `0.${"0".repeat(a)}${r}`;
588
- return y(c);
817
+ const i = e.length - n;
818
+ if (i <= 0) {
819
+ const a = Math.abs(i), c = `0.${"0".repeat(a)}${s}`;
820
+ return C(c);
589
821
  }
590
- if (s < e.length) {
591
- const a = r.slice(0, s), c = r.slice(s), l = `${a}.${c}`;
592
- return y(l);
822
+ if (i < e.length) {
823
+ const a = s.slice(0, i), c = s.slice(i), l = `${a}.${c}`;
824
+ return C(l);
593
825
  }
594
- return y(r);
826
+ return C(s);
595
827
  }
596
- function y(e) {
828
+ function C(e) {
597
829
  if (!e.includes("."))
598
830
  return e;
599
831
  if (e === "0" || e === "0.")
@@ -608,10 +840,10 @@ function y(e) {
608
840
  }
609
841
  return e.replace(/\.?0+$/, "") || e;
610
842
  }
611
- function me(e) {
843
+ function Ze(e) {
612
844
  const t = /(\d+\.?\d*)\s*(Qa|Qi|Sx|Sp|[kmbMTO]|N)/gi;
613
- return e.replace(t, (n, r, i) => {
614
- const o = {
845
+ return e.replace(t, (n, s, o) => {
846
+ const r = {
615
847
  k: 3,
616
848
  // Thousand
617
849
  K: 3,
@@ -629,66 +861,66 @@ function me(e) {
629
861
  t: 12
630
862
  // Trillion
631
863
  };
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];
864
+ let i;
865
+ if (o.length > 1) {
866
+ const d = o.charAt(0).toUpperCase() + o.slice(1).toLowerCase();
867
+ i = r[o] || r[d];
636
868
  } else {
637
- const g = i.toLowerCase();
638
- s = o[i] || o[g];
869
+ const d = o.toLowerCase();
870
+ i = r[o] || r[d];
639
871
  }
640
- if (!s)
872
+ if (!i)
641
873
  return n;
642
- const a = r.startsWith("-"), c = a ? r.slice(1) : r, [l, h = ""] = c.split("."), d = l.replace(/^0+/, "") || "0";
643
- let u;
874
+ const a = s.startsWith("-"), c = a ? s.slice(1) : s, [l, h = ""] = c.split("."), u = l.replace(/^0+/, "") || "0";
875
+ let f;
644
876
  if (h.length === 0)
645
- u = d + "0".repeat(s);
646
- else if (h.length <= s) {
647
- const g = s - h.length;
648
- u = d + h + "0".repeat(g);
877
+ f = u + "0".repeat(i);
878
+ else if (h.length <= i) {
879
+ const d = i - h.length;
880
+ f = u + h + "0".repeat(d);
649
881
  } else {
650
- const g = h.slice(0, s), f = h.slice(s);
651
- u = d + g + "." + f;
882
+ const d = h.slice(0, i), g = h.slice(i);
883
+ f = u + d + "." + g;
652
884
  }
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;
885
+ return f = f.replace(/^(-?)0+([1-9])/, "$1$2"), f.match(/^-?0+$/) && (f = a ? "-0" : "0"), f.includes(".") && (f = f.replace(/\.?0+$/, "")), a && !f.startsWith("-") ? "-" + f : f;
654
886
  });
655
887
  }
656
- function Me(e) {
888
+ function Be(e) {
657
889
  if (!e || e === "0" || e === "-0" || e === "-" || e === ".")
658
890
  return e;
659
891
  const t = e.startsWith("-"), n = t ? e.slice(1) : e;
660
892
  if (!n || n === "0" || n === ".")
661
893
  return e;
662
894
  if (n.includes(".")) {
663
- const [i, o] = n.split(".");
664
- if (i && i.length > 0) {
665
- const a = (i.replace(/^0+/, "") || "0") + "." + o;
895
+ const [o, r] = n.split(".");
896
+ if (o && o.length > 0) {
897
+ const a = (o.replace(/^0+/, "") || "0") + "." + r;
666
898
  return t ? "-" + a : a;
667
899
  }
668
900
  return e;
669
901
  }
670
902
  if (n.startsWith("0") && n.length > 1) {
671
- const i = n.replace(/^0+/, "") || "0";
672
- return t ? "-" + i : i;
903
+ const o = n.replace(/^0+/, "") || "0";
904
+ return t ? "-" + o : o;
673
905
  }
674
906
  return e;
675
907
  }
676
- function ye(e) {
908
+ function We(e) {
677
909
  return e.replace(/[\u00A0\u2000-\u200B\u202F\u205F\u3000]/g, " ").replace(/\s/g, "");
678
910
  }
679
911
  function w(e, t) {
680
- const n = D(t);
912
+ const n = x(t);
681
913
  return e.replace(new RegExp(n, "g"), "");
682
914
  }
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(
915
+ const ke = (e, t) => {
916
+ let n = We(e);
917
+ return t != null && t.thousandSeparator && (n = w(n, t.thousandSeparator)), t != null && t.enableCompactNotation && (n = Ze(n)), n = Re(n), n = Oe(
686
918
  n,
687
919
  t == null ? void 0 : t.enableNegative,
688
920
  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;
921
+ ), n = he(n, (t == null ? void 0 : t.decimalSeparator) || N), t != null && t.enableLeadingZeros || (n = Be(n)), n;
690
922
  };
691
- function Ae(e, t, n) {
923
+ function Ue(e, t, n) {
692
924
  return {
693
925
  enableCompactNotation: e == null ? void 0 : e.enableCompactNotation,
694
926
  enableNegative: e == null ? void 0 : e.enableNegative,
@@ -697,31 +929,31 @@ function Ae(e, t, n) {
697
929
  thousandSeparator: n ? t.thousandSeparator : void 0
698
930
  };
699
931
  }
700
- function x(e, t, n, r) {
701
- const i = A(n), o = r ?? (n == null ? void 0 : n.formatOn) === v.Change, s = Ce(
932
+ function O(e, t, n, s) {
933
+ const o = T(n), r = s ?? (n == null ? void 0 : n.formatOn) === $.Change, i = ke(
702
934
  e,
703
- Ae(n, i, o)
704
- ), a = F(
705
- s,
935
+ Ue(n, o, r)
936
+ ), a = le(
937
+ i,
706
938
  t,
707
- i.decimalSeparator
708
- ), c = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = te(
939
+ o.decimalSeparator
940
+ ), c = (n == null ? void 0 : n.decimalMinLength) ?? 0, l = ue(
709
941
  a,
710
942
  c,
711
- i.decimalSeparator
943
+ o.decimalSeparator
712
944
  ), h = l;
713
- return { formatted: ie(l, n, i), raw: h };
945
+ return { formatted: pe(l, n, o), raw: h };
714
946
  }
715
- function Ke(e, t, n) {
716
- const r = !!(n != null && n.thousandSeparator);
717
- return x(
947
+ function ht(e, t, n) {
948
+ const s = !!(n != null && n.thousandSeparator);
949
+ return O(
718
950
  e,
719
951
  t,
720
952
  n,
721
- r
953
+ s
722
954
  );
723
955
  }
724
- function Te(e, t, n) {
956
+ function Ge(e, t, n) {
725
957
  if (e === "Backspace" || e === "Delete")
726
958
  return e === "Delete" && t === n ? {
727
959
  endOffset: 1
@@ -729,61 +961,61 @@ function Te(e, t, n) {
729
961
  endOffset: 0
730
962
  };
731
963
  }
732
- function xe(e, t) {
733
- const { decimalSeparator: n } = A(t), r = e.target;
734
- if (V(e, r, t, n)) {
964
+ function je(e, t) {
965
+ const { decimalSeparator: n } = T(t), s = e.target;
966
+ if (ce(e, s, n)) {
735
967
  e.preventDefault();
736
968
  return;
737
969
  }
738
- return $e(e, r, t), Te(e.key, r.selectionStart, r.selectionEnd);
970
+ return Ce(e, s, t), Ge(e.key, s.selectionStart, s.selectionEnd);
739
971
  }
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,
743
- t,
972
+ function Je(e, t, n, s) {
973
+ const o = e.target, r = o.value, i = xe(o), a = T(s), c = (s == null ? void 0 : s.formatOn) === $.Change, { formatted: l, raw: h } = O(
744
974
  r,
975
+ t,
976
+ s,
745
977
  c
746
978
  );
747
- return i.value = l, o !== l && Ee(
748
- i,
979
+ return o.value = l, r !== l && Ae(
749
980
  o,
981
+ r,
750
982
  l,
751
- s,
983
+ i,
752
984
  n,
753
985
  a,
754
- r
986
+ s
755
987
  ), { formatted: l, raw: h };
756
988
  }
757
- function Re(e, t, n, r) {
758
- const i = r - n;
759
- return e + t + i;
989
+ function Ke(e, t, n, s) {
990
+ const o = s - n;
991
+ return e + t + o;
760
992
  }
761
- function Oe(e, t, n) {
762
- var u;
993
+ function qe(e, t, n) {
994
+ var f;
763
995
  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(
996
+ const s = e.target, { value: o, selectionStart: r, selectionEnd: i } = s, a = ((f = e.clipboardData) == null ? void 0 : f.getData("text/plain")) || "", c = o.slice(0, r || 0) + a + o.slice(i || 0), { formatted: l, raw: h } = O(
765
997
  c,
766
998
  t,
767
999
  n,
768
1000
  !0
769
1001
  );
770
- r.value = l;
771
- const d = Re(
772
- o || 0,
1002
+ s.value = l;
1003
+ const u = Ke(
1004
+ r || 0,
773
1005
  a.length,
774
1006
  c.length,
775
1007
  l.length
776
1008
  );
777
- return r.setSelectionRange(d, d), { formatted: l, raw: h };
1009
+ return s.setSelectionRange(u, u), { formatted: l, raw: h };
778
1010
  }
779
- function _e(e, t) {
780
- const n = D(e);
1011
+ function Qe(e, t) {
1012
+ const n = x(e);
781
1013
  return t ? `^-?[0-9]*[${n}]?[0-9]*$` : `^[0-9]*[${n}]?[0-9]*$`;
782
1014
  }
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);
1015
+ function He(e) {
1016
+ Ve(e.decimalMaxLength), Xe(e.decimalMinLength), Ye(e.decimalMinLength, e.decimalMaxLength), Fe(e.formatOn), et(e.thousandSeparator), tt(e.thousandStyle), nt(e.decimalSeparator), st(e.thousandSeparator, e.decimalSeparator), M("enableCompactNotation", e.enableCompactNotation), M("enableNegative", e.enableNegative), M("enableLeadingZeros", e.enableLeadingZeros), M("rawValueMode", e.rawValueMode), rt(e.onChange);
785
1017
  }
786
- function Pe(e) {
1018
+ function Ve(e) {
787
1019
  if (e !== void 0) {
788
1020
  if (typeof e != "number")
789
1021
  throw new Error(
@@ -799,7 +1031,7 @@ function Pe(e) {
799
1031
  );
800
1032
  }
801
1033
  }
802
- function We(e) {
1034
+ function Xe(e) {
803
1035
  if (e !== void 0) {
804
1036
  if (typeof e != "number")
805
1037
  throw new Error(
@@ -815,19 +1047,19 @@ function We(e) {
815
1047
  );
816
1048
  }
817
1049
  }
818
- function ke(e, t) {
1050
+ function Ye(e, t) {
819
1051
  if (!(e === void 0 || t === void 0) && e > t)
820
1052
  throw new Error(
821
1053
  `decimalMinLength (${e}) cannot be greater than decimalMaxLength (${t}).`
822
1054
  );
823
1055
  }
824
- function Ze(e) {
825
- if (e !== void 0 && e !== v.Blur && e !== v.Change)
1056
+ function Fe(e) {
1057
+ if (e !== void 0 && e !== $.Blur && e !== $.Change)
826
1058
  throw new Error(
827
- `formatOn must be either ${v.Blur} or ${v.Change}. Received: ${JSON.stringify(e)}`
1059
+ `formatOn must be either ${$.Blur} or ${$.Change}. Received: ${JSON.stringify(e)}`
828
1060
  );
829
1061
  }
830
- function ze(e) {
1062
+ function et(e) {
831
1063
  if (e !== void 0) {
832
1064
  if (typeof e != "string")
833
1065
  throw new Error(
@@ -843,13 +1075,13 @@ function ze(e) {
843
1075
  );
844
1076
  }
845
1077
  }
846
- function Ge(e) {
1078
+ function tt(e) {
847
1079
  if (e !== void 0 && !Object.values(S).includes(e))
848
1080
  throw new Error(
849
1081
  `ThousandStyle must be one of: ${Object.values(S).map((t) => `'${t}'`).join(", ")}. Received: ${JSON.stringify(e)}`
850
1082
  );
851
1083
  }
852
- function Ue(e) {
1084
+ function nt(e) {
853
1085
  if (e !== void 0) {
854
1086
  if (typeof e != "string")
855
1087
  throw new Error(
@@ -865,7 +1097,7 @@ function Ue(e) {
865
1097
  );
866
1098
  }
867
1099
  }
868
- function je(e, t) {
1100
+ function st(e, t) {
869
1101
  if (!(e === void 0 || t === void 0) && e === t)
870
1102
  throw new Error(
871
1103
  `Decimal separator can't be same as thousand separator. thousandSeparator: ${e}, decimalSeparator: ${t}`
@@ -877,107 +1109,107 @@ function M(e, t) {
877
1109
  `${e} must be a boolean. Received: ${typeof t} (${JSON.stringify(t)})`
878
1110
  );
879
1111
  }
880
- function Je(e) {
1112
+ function rt(e) {
881
1113
  if (e !== void 0 && typeof e != "function")
882
1114
  throw new Error(
883
1115
  `onChange must be a function or undefined. Received: ${typeof e} (${JSON.stringify(e)})`
884
1116
  );
885
1117
  }
886
- class Qe {
1118
+ class ut {
887
1119
  constructor(t, {
888
- decimalMaxLength: n = I,
889
- decimalMinLength: r = R,
890
- formatOn: i = O,
891
- thousandSeparator: o = _,
892
- thousandStyle: s = B,
893
- decimalSeparator: a = E,
1120
+ decimalMaxLength: n = _,
1121
+ decimalMinLength: s = z,
1122
+ formatOn: o = Z,
1123
+ thousandSeparator: r = B,
1124
+ thousandStyle: i = W,
1125
+ decimalSeparator: a = N,
894
1126
  enableCompactNotation: c = !0,
895
- enableNegative: l = P,
896
- enableLeadingZeros: h = W,
897
- rawValueMode: d = k,
898
- onChange: u,
899
- ...g
1127
+ enableNegative: l = k,
1128
+ enableLeadingZeros: h = U,
1129
+ rawValueMode: u = G,
1130
+ onChange: f,
1131
+ ...d
900
1132
  }) {
901
- L(this, "element");
902
- L(this, "options");
903
- L(this, "resolvedOptions");
904
- L(this, "rawValue", "");
905
- L(this, "caretPositionBeforeChange");
906
- if (Be({
1133
+ v(this, "element");
1134
+ v(this, "options");
1135
+ v(this, "resolvedOptions");
1136
+ v(this, "rawValue", "");
1137
+ v(this, "caretPositionBeforeChange");
1138
+ if (He({
907
1139
  decimalMaxLength: n,
908
- decimalMinLength: r,
909
- formatOn: i,
910
- thousandSeparator: o,
911
- thousandStyle: s,
1140
+ decimalMinLength: s,
1141
+ formatOn: o,
1142
+ thousandSeparator: r,
1143
+ thousandStyle: i,
912
1144
  decimalSeparator: a,
913
1145
  enableCompactNotation: c,
914
1146
  enableNegative: l,
915
1147
  enableLeadingZeros: h,
916
- rawValueMode: d,
917
- onChange: u
1148
+ rawValueMode: u,
1149
+ onChange: f
918
1150
  }), this.options = {
919
1151
  decimalMaxLength: n,
920
- decimalMinLength: r,
921
- onChange: u,
922
- formatOn: i,
923
- thousandSeparator: o,
924
- thousandStyle: s,
1152
+ decimalMinLength: s,
1153
+ onChange: f,
1154
+ formatOn: o,
1155
+ thousandSeparator: r,
1156
+ thousandStyle: i,
925
1157
  decimalSeparator: a,
926
1158
  enableCompactNotation: c,
927
1159
  enableNegative: l,
928
1160
  enableLeadingZeros: h,
929
- rawValueMode: d,
930
- ...g
1161
+ rawValueMode: u,
1162
+ ...d
931
1163
  }, 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;
1164
+ const g = this.element.value, p = this.resolvedOptions.thousandSeparator ? w(g, this.resolvedOptions.thousandSeparator) : g;
933
1165
  this.rawValue = p, this.element.value = this.formatValueForDisplay(p);
934
1166
  } else if (this.element.value) {
935
- const f = this.element.value;
936
- this.element.value = this.formatValueForDisplay(f);
1167
+ const g = this.element.value;
1168
+ this.element.value = this.formatValueForDisplay(g);
937
1169
  }
938
1170
  }
939
1171
  createInputElement(t) {
940
1172
  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);
942
- this.element.setAttribute("pattern", H);
1173
+ const se = Qe(this.resolvedOptions.decimalSeparator, this.resolvedOptions.enableNegative);
1174
+ this.element.setAttribute("pattern", se);
943
1175
  }
944
1176
  const {
945
1177
  decimalMaxLength: n,
946
- decimalMinLength: r,
947
- formatOn: i,
948
- thousandSeparator: o,
949
- thousandStyle: s,
1178
+ decimalMinLength: s,
1179
+ formatOn: o,
1180
+ thousandSeparator: r,
1181
+ thousandStyle: i,
950
1182
  decimalSeparator: a,
951
1183
  enableCompactNotation: c,
952
1184
  enableNegative: l,
953
1185
  enableLeadingZeros: h,
954
- rawValueMode: d,
955
- onChange: u,
956
- value: g,
957
- defaultValue: f,
1186
+ rawValueMode: u,
1187
+ onChange: f,
1188
+ value: d,
1189
+ defaultValue: g,
958
1190
  type: p,
959
- inputMode: $,
960
- spellcheck: m,
961
- autocomplete: qe,
962
- ...q
1191
+ inputMode: m,
1192
+ spellcheck: D,
1193
+ autocomplete: R,
1194
+ ...ne
963
1195
  } = this.options;
964
- Object.assign(this.element, q), g !== void 0 ? this.element.value = g : f !== void 0 && (this.element.defaultValue = f, this.element.value = f), t.appendChild(this.element);
1196
+ Object.assign(this.element, ne), d !== void 0 ? this.element.value = d : g !== void 0 && (this.element.defaultValue = g, this.element.value = g), t.appendChild(this.element);
965
1197
  }
966
1198
  setupEventListeners() {
967
- 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 === v.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
1199
+ 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 === $.Blur && this.resolvedOptions.thousandSeparator && (this.element.addEventListener("focus", this.handleFocus.bind(this)), this.element.addEventListener("blur", this.handleBlur.bind(this)));
968
1200
  }
969
1201
  getResolvedOptions() {
970
1202
  return {
971
- decimalMaxLength: this.options.decimalMaxLength ?? I,
972
- decimalMinLength: this.options.decimalMinLength ?? R,
973
- formatOn: this.options.formatOn ?? O,
974
- thousandSeparator: this.options.thousandSeparator ?? _,
975
- thousandStyle: this.options.thousandStyle ?? B,
976
- decimalSeparator: this.options.decimalSeparator ?? E,
977
- enableCompactNotation: this.options.enableCompactNotation ?? X,
978
- enableNegative: this.options.enableNegative ?? P,
979
- enableLeadingZeros: this.options.enableLeadingZeros ?? W,
980
- rawValueMode: this.options.rawValueMode ?? k,
1203
+ decimalMaxLength: this.options.decimalMaxLength ?? _,
1204
+ decimalMinLength: this.options.decimalMinLength ?? z,
1205
+ formatOn: this.options.formatOn ?? Z,
1206
+ thousandSeparator: this.options.thousandSeparator ?? B,
1207
+ thousandStyle: this.options.thousandStyle ?? W,
1208
+ decimalSeparator: this.options.decimalSeparator ?? N,
1209
+ enableCompactNotation: this.options.enableCompactNotation ?? oe,
1210
+ enableNegative: this.options.enableNegative ?? k,
1211
+ enableLeadingZeros: this.options.enableLeadingZeros ?? U,
1212
+ rawValueMode: this.options.rawValueMode ?? G,
981
1213
  onChange: this.options.onChange
982
1214
  };
983
1215
  }
@@ -996,66 +1228,66 @@ class Qe {
996
1228
  }
997
1229
  handleValueChange(t, n) {
998
1230
  if (this.resolvedOptions.rawValueMode && n !== void 0 && (this.rawValue = n), this.resolvedOptions.onChange) {
999
- const r = this.resolvedOptions.rawValueMode ? this.rawValue : t;
1000
- this.resolvedOptions.onChange(r);
1231
+ const s = this.resolvedOptions.rawValueMode ? this.rawValue : t;
1232
+ this.resolvedOptions.onChange(s);
1001
1233
  }
1002
1234
  }
1003
1235
  formatValueForDisplay(t) {
1004
1236
  if (!t)
1005
1237
  return t;
1006
- const { thousandSeparator: n, thousandStyle: r, enableLeadingZeros: i, decimalSeparator: o } = this.resolvedOptions;
1007
- return n && r !== S.None ? G(
1238
+ const { thousandSeparator: n, thousandStyle: s, enableLeadingZeros: o, decimalSeparator: r } = this.resolvedOptions;
1239
+ return n && s !== S.None ? y(
1008
1240
  t,
1009
1241
  n,
1010
- r,
1011
- i,
1012
- o
1242
+ s,
1243
+ o,
1244
+ r
1013
1245
  ) : t;
1014
1246
  }
1015
1247
  handleChange(t) {
1016
- const { formatted: n, raw: r } = Ie(
1248
+ const { formatted: n, raw: s } = Je(
1017
1249
  t,
1018
1250
  this.resolvedOptions.decimalMaxLength,
1019
1251
  this.caretPositionBeforeChange,
1020
1252
  this.buildFormattingOptions()
1021
1253
  );
1022
- this.caretPositionBeforeChange = void 0, this.handleValueChange(n, r);
1254
+ this.caretPositionBeforeChange = void 0, this.handleValueChange(n, s);
1023
1255
  }
1024
1256
  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
1257
+ const n = t.target, { selectionStart: s, selectionEnd: o } = n, r = this.buildFormattingOptions(), i = je(t, {
1258
+ formatOn: r.formatOn,
1259
+ thousandSeparator: r.thousandSeparator,
1260
+ ThousandStyle: r.ThousandStyle,
1261
+ decimalSeparator: r.decimalSeparator
1030
1262
  });
1031
- s ? this.caretPositionBeforeChange = {
1032
- selectionStart: r ?? 0,
1033
- selectionEnd: i ?? 0,
1034
- endOffset: s.endOffset
1263
+ i ? this.caretPositionBeforeChange = {
1264
+ selectionStart: s ?? 0,
1265
+ selectionEnd: o ?? 0,
1266
+ endOffset: i.endOffset
1035
1267
  } : this.caretPositionBeforeChange = {
1036
- selectionStart: r ?? 0,
1037
- selectionEnd: i ?? 0
1268
+ selectionStart: s ?? 0,
1269
+ selectionEnd: o ?? 0
1038
1270
  };
1039
1271
  }
1040
1272
  handlePaste(t) {
1041
- const { formatted: n, raw: r } = Oe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
1042
- this.handleValueChange(n, r);
1043
- const i = new Event("input", { bubbles: !0, cancelable: !0 });
1044
- this.element.dispatchEvent(i);
1273
+ const { formatted: n, raw: s } = qe(t, this.resolvedOptions.decimalMaxLength, this.buildFormattingOptions());
1274
+ this.handleValueChange(n, s);
1275
+ const o = new Event("input", { bubbles: !0, cancelable: !0 });
1276
+ this.element.dispatchEvent(o);
1045
1277
  }
1046
1278
  handleFocus(t) {
1047
- if (this.resolvedOptions.formatOn === v.Blur && this.resolvedOptions.thousandSeparator) {
1279
+ if (this.resolvedOptions.formatOn === $.Blur && this.resolvedOptions.thousandSeparator) {
1048
1280
  const n = t.target;
1049
1281
  n.value = w(n.value, this.resolvedOptions.thousandSeparator);
1050
1282
  }
1051
1283
  }
1052
1284
  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) {
1285
+ const n = t.target, { thousandSeparator: s, thousandStyle: o } = this.resolvedOptions;
1286
+ if (s && o !== S.None && n.value) {
1287
+ const r = n.value, i = this.formatValueForDisplay(n.value);
1288
+ n.value = i;
1289
+ const a = this.resolvedOptions.rawValueMode ? w(i, s) : void 0;
1290
+ if (this.handleValueChange(i, a), r !== i) {
1059
1291
  const c = new Event("input", { bubbles: !0, cancelable: !0 });
1060
1292
  this.element.dispatchEvent(c);
1061
1293
  const l = new Event("change", { bubbles: !0, cancelable: !0 });
@@ -1116,8 +1348,8 @@ class Qe {
1116
1348
  const t = this.getValue();
1117
1349
  if (!t)
1118
1350
  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;
1120
- return parseFloat(r);
1351
+ const n = this.resolvedOptions.thousandSeparator ? w(t, this.resolvedOptions.thousandSeparator) : t, s = this.resolvedOptions.decimalSeparator && this.resolvedOptions.decimalSeparator !== "." ? n.replace(new RegExp(x(this.resolvedOptions.decimalSeparator), "g"), ".") : n;
1352
+ return parseFloat(s);
1121
1353
  }
1122
1354
  /**
1123
1355
  * Sets the value from a number, similar to HTMLInputElement.valueAsNumber.
@@ -1132,12 +1364,16 @@ class Qe {
1132
1364
  }
1133
1365
  }
1134
1366
  export {
1135
- v as FormatOn,
1136
- Qe as NumoraInput,
1367
+ $ as FormatOn,
1368
+ ut as NumoraInput,
1137
1369
  S as ThousandStyle,
1138
- Ke as formatValue,
1139
- Ie as handleOnChangeNumoraInput,
1140
- xe as handleOnKeyDownNumoraInput,
1141
- Oe as handleOnPasteNumoraInput,
1142
- x as processAndFormatValue
1370
+ ct as condenseDecimalZeros,
1371
+ O as formatInputValue,
1372
+ lt as formatLargeNumber,
1373
+ at as formatLargePercent,
1374
+ ot as formatPercent,
1375
+ ht as formatValueForDisplay,
1376
+ Je as handleOnChangeNumoraInput,
1377
+ je as handleOnKeyDownNumoraInput,
1378
+ qe as handleOnPasteNumoraInput
1143
1379
  };