@moneyto/components 0.0.15 → 0.0.16

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.
@@ -1,1060 +0,0 @@
1
- var _t = Object.defineProperty;
2
- var Ct = (e, t, s) => t in e ? _t(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var q = (e, t, s) => Ct(e, typeof t != "symbol" ? t + "" : t, s);
4
- import { y as St, Y as Rt, j as X, Z as Nt, _ as ft, z as ht, $ as kt, a0 as F, a1 as pt, U as bt, G as Q, a2 as K, a3 as $, a4 as j, a5 as It, a6 as z, C as R, a7 as dt, a8 as Lt, a9 as Gt, aa as Ot, ab as Pt, A as Bt, I as Ut, ac as Ft, M as w, O as wt, F as Dt, ad as Ht, ae as Kt, af as jt, ag as tt, ah as D, D as G, ai as Wt } from "./Styles-BlozloOq.js";
5
- let H = null;
6
- function ta(e, t) {
7
- return t;
8
- }
9
- function xt(e, t, s, n) {
10
- for (var o = [], r = t.length, c = 0; c < r; c++)
11
- Gt(t[c].e, o, !0);
12
- var u = r > 0 && o.length === 0 && s !== null;
13
- if (u) {
14
- var d = (
15
- /** @type {Element} */
16
- /** @type {Element} */
17
- s.parentNode
18
- );
19
- Ot(d), d.append(
20
- /** @type {Element} */
21
- s
22
- ), n.clear(), S(e, t[0].prev, t[r - 1].next);
23
- }
24
- Pt(o, () => {
25
- for (var f = 0; f < r; f++) {
26
- var g = t[f];
27
- u || (n.delete(g.k), S(e, g.prev, g.next)), Bt(g.e, !u);
28
- }
29
- });
30
- }
31
- function ea(e, t, s, n, o, r = null) {
32
- var c = e, u = { flags: t, items: /* @__PURE__ */ new Map(), first: null }, d = (t & dt) !== 0;
33
- if (d) {
34
- var f = (
35
- /** @type {Element} */
36
- e
37
- );
38
- c = R ? w(
39
- /** @type {Comment | Text} */
40
- wt(f)
41
- ) : f.appendChild(Rt());
42
- }
43
- R && Dt();
44
- var g = null, y = !1, p = Nt(() => {
45
- var A = s();
46
- return Ht(A) ? A : A == null ? [] : pt(A);
47
- });
48
- St(() => {
49
- var A = X(p), m = A.length;
50
- if (y && m === 0)
51
- return;
52
- y = m === 0;
53
- let E = !1;
54
- if (R) {
55
- var h = Kt(c) === jt;
56
- h !== (m === 0) && (c = tt(), w(c), D(!1), E = !0);
57
- }
58
- if (R) {
59
- for (var v = null, M, a = 0; a < m; a++) {
60
- if (G.nodeType === 8 && /** @type {Comment} */
61
- G.data === Wt) {
62
- c = /** @type {Comment} */
63
- G, E = !0, D(!1);
64
- break;
65
- }
66
- var i = A[a], l = n(i, a);
67
- M = mt(
68
- G,
69
- u,
70
- v,
71
- null,
72
- i,
73
- l,
74
- a,
75
- o,
76
- t,
77
- s
78
- ), u.items.set(l, M), v = M;
79
- }
80
- m > 0 && w(tt());
81
- }
82
- R || Yt(A, u, c, o, t, n, s), r !== null && (m === 0 ? g ? ft(g) : g = ht(() => r(c)) : g !== null && kt(g, () => {
83
- g = null;
84
- })), E && D(!0), X(p);
85
- }), R && (c = G);
86
- }
87
- function Yt(e, t, s, n, o, r, c) {
88
- var x, Y, Z, V;
89
- var u = (o & Lt) !== 0, d = (o & (K | j)) !== 0, f = e.length, g = t.items, y = t.first, p = y, A, m = null, E, h = [], v = [], M, a, i, l;
90
- if (u)
91
- for (l = 0; l < f; l += 1)
92
- M = e[l], a = r(M, l), i = g.get(a), i !== void 0 && ((x = i.a) == null || x.measure(), (E ?? (E = /* @__PURE__ */ new Set())).add(i));
93
- for (l = 0; l < f; l += 1) {
94
- if (M = e[l], a = r(M, l), i = g.get(a), i === void 0) {
95
- var _ = p ? (
96
- /** @type {TemplateNode} */
97
- p.e.nodes_start
98
- ) : s;
99
- m = mt(
100
- _,
101
- t,
102
- m,
103
- m === null ? t.first : m.next,
104
- M,
105
- a,
106
- l,
107
- n,
108
- o,
109
- c
110
- ), g.set(a, m), h = [], v = [], p = m.next;
111
- continue;
112
- }
113
- if (d && Zt(i, M, l, o), (i.e.f & F) !== 0 && (ft(i.e), u && ((Y = i.a) == null || Y.unfix(), (E ?? (E = /* @__PURE__ */ new Set())).delete(i))), i !== p) {
114
- if (A !== void 0 && A.has(i)) {
115
- if (h.length < v.length) {
116
- var C = v[0], T;
117
- m = C.prev;
118
- var W = h[0], B = h[h.length - 1];
119
- for (T = 0; T < h.length; T += 1)
120
- et(h[T], C, s);
121
- for (T = 0; T < v.length; T += 1)
122
- A.delete(v[T]);
123
- S(t, W.prev, B.next), S(t, m, W), S(t, B, C), p = C, m = B, l -= 1, h = [], v = [];
124
- } else
125
- A.delete(i), et(i, p, s), S(t, i.prev, i.next), S(t, i, m === null ? t.first : m.next), S(t, m, i), m = i;
126
- continue;
127
- }
128
- for (h = [], v = []; p !== null && p.k !== a; )
129
- (p.e.f & F) === 0 && (A ?? (A = /* @__PURE__ */ new Set())).add(p), v.push(p), p = p.next;
130
- if (p === null)
131
- continue;
132
- i = p;
133
- }
134
- h.push(i), m = i, p = i.next;
135
- }
136
- if (p !== null || A !== void 0) {
137
- for (var L = A === void 0 ? [] : pt(A); p !== null; )
138
- (p.e.f & F) === 0 && L.push(p), p = p.next;
139
- var U = L.length;
140
- if (U > 0) {
141
- var Mt = (o & dt) !== 0 && f === 0 ? s : null;
142
- if (u) {
143
- for (l = 0; l < U; l += 1)
144
- (Z = L[l].a) == null || Z.measure();
145
- for (l = 0; l < U; l += 1)
146
- (V = L[l].a) == null || V.fix();
147
- }
148
- xt(t, L, Mt, g);
149
- }
150
- }
151
- u && bt(() => {
152
- var J;
153
- if (E !== void 0)
154
- for (i of E)
155
- (J = i.a) == null || J.apply();
156
- }), Q.first = t.first && t.first.e, Q.last = m && m.e;
157
- }
158
- function Zt(e, t, s, n) {
159
- (n & K) !== 0 && $(e.v, t), (n & j) !== 0 ? $(
160
- /** @type {Value<number>} */
161
- e.i,
162
- s
163
- ) : e.i = s;
164
- }
165
- function mt(e, t, s, n, o, r, c, u, d, f) {
166
- var g = H, y = (d & K) !== 0, p = (d & Ft) === 0, A = y ? p ? It(o) : z(o) : o, m = (d & j) === 0 ? c : z(c), E = {
167
- i: m,
168
- v: A,
169
- k: r,
170
- a: null,
171
- // @ts-expect-error
172
- e: null,
173
- prev: s,
174
- next: n
175
- };
176
- H = E;
177
- try {
178
- return E.e = ht(() => u(e, A, m, f), R), E.e.prev = s && s.e, E.e.next = n && n.e, s === null ? t.first = E : (s.next = E, s.e.next = E.e), n !== null && (n.prev = E, n.e.prev = E.e), E;
179
- } finally {
180
- H = g;
181
- }
182
- }
183
- function et(e, t, s) {
184
- for (var n = e.next ? (
185
- /** @type {TemplateNode} */
186
- e.next.e.nodes_start
187
- ) : s, o = t ? (
188
- /** @type {TemplateNode} */
189
- t.e.nodes_start
190
- ) : s, r = (
191
- /** @type {TemplateNode} */
192
- e.e.nodes_start
193
- ); r !== n; ) {
194
- var c = (
195
- /** @type {TemplateNode} */
196
- Ut(r)
197
- );
198
- o.before(r), r = c;
199
- }
200
- }
201
- function S(e, t, s) {
202
- t === null ? e.first = s : (t.next = s, t.e.next = s && s.e), s !== null && (s.prev = t, s.e.prev = t && t.e);
203
- }
204
- function Vt(e) {
205
- return String.fromCodePoint(e.toLowerCase().charCodeAt(0) + 127365);
206
- }
207
- function Jt(e) {
208
- return e.split("-").pop().toUpperCase();
209
- }
210
- function sa(e) {
211
- if (!e)
212
- throw new Error("countryCode is required");
213
- return Array.from(Jt(e)).map(Vt).join("");
214
- }
215
- const qt = "AD", Xt = "AE", Qt = "AF", $t = "AG", zt = "AI", te = "AL", ee = "AM", se = "AO", ne = "AQ", oe = "AR", re = "AS", ae = "AT", ie = "AU", ce = "AW", le = "AX", ue = "AZ", fe = "BA", he = "BB", pe = "BD", de = "BE", me = "BF", Ae = "BG", Ee = "BH", ge = "BI", ve = "BJ", ye = "BL", Te = "BM", Me = "BN", _e = "BO", Ce = "BQ", Se = "BR", Re = "BS", Ne = "BT", ke = "BV", be = "BW", Ie = "BY", Le = "BZ", Ge = "CA", Oe = "CC", Pe = "CD", Be = "CF", Ue = "CG", Fe = "CH", we = "CI", De = "CK", He = "CL", Ke = "CM", je = "CN", We = "CO", xe = "CR", Ye = "CU", Ze = "CV", Ve = "CW", Je = "CX", qe = "CY", Xe = "CZ", Qe = "DE", $e = "DJ", ze = "DK", ts = "DM", es = "DO", ss = "DZ", ns = "EC", os = "EE", rs = "EG", as = "EH", is = "ER", cs = "ES", ls = "ET", us = "FI", fs = "FJ", hs = "FK", ps = "FM", ds = "FO", ms = "FR", As = "GA", Es = "GB", gs = "GD", vs = "GE", ys = "GF", Ts = "GG", Ms = "GH", _s = "GI", Cs = "GL", Ss = "GM", Rs = "GN", Ns = "GP", ks = "GQ", bs = "GR", Is = "GS", Ls = "GT", Gs = "GU", Os = "GW", Ps = "GY", Bs = "HK", Us = "HM", Fs = "HN", ws = "HR", Ds = "HT", Hs = "HU", Ks = "ID", js = "IE", Ws = "IL", xs = "IM", Ys = "IN", Zs = "IO", Vs = "IQ", Js = "IR", qs = "IS", Xs = "IT", Qs = "JE", $s = "JM", zs = "JO", tn = "JP", en = "KE", sn = "KG", nn = "KH", on = "KI", rn = "KM", an = "KN", cn = "KP", ln = "KR", un = "KW", fn = "KY", hn = "KZ", pn = "LA", dn = "LB", mn = "LC", An = "LI", En = "LK", gn = "LR", vn = "LS", yn = "LT", Tn = "LU", Mn = "LV", _n = "LY", Cn = "MA", Sn = "MC", Rn = "MD", Nn = "ME", kn = "MF", bn = "MG", In = "MH", Ln = "MK", Gn = "ML", On = "MM", Pn = "MN", Bn = "MO", Un = "MP", Fn = "MQ", wn = "MR", Dn = "MS", Hn = "MT", Kn = "MU", jn = "MV", Wn = "MW", xn = "MX", Yn = "MY", Zn = "MZ", Vn = "NA", Jn = "NC", qn = "NE", Xn = "NF", Qn = "NG", $n = "NI", zn = "NL", to = "NO", eo = "NP", so = "NR", no = "NU", oo = "NZ", ro = "OM", ao = "PA", io = "PE", co = "PF", lo = "PG", uo = "PH", fo = "PK", ho = "PL", po = "PM", mo = "PN", Ao = "PR", Eo = "PS", go = "PT", vo = "PW", yo = "PY", To = "QA", Mo = "RE", _o = "RO", Co = "RS", So = "RU", Ro = "RW", No = "SA", ko = "SB", bo = "SC", Io = "SD", Lo = "SE", Go = "SG", Oo = "SH", Po = "SI", Bo = "SJ", Uo = "SK", Fo = "SL", wo = "SM", Do = "SN", Ho = "SO", Ko = "SR", jo = "SS", Wo = "ST", xo = "SV", Yo = "SX", Zo = "SY", Vo = "SZ", Jo = "TC", qo = "TD", Xo = "TF", Qo = "TG", $o = "TH", zo = "TJ", tr = "TK", er = "TL", sr = "TM", nr = "TN", or = "TO", rr = "TR", ar = "TT", ir = "TV", cr = "TW", lr = "TZ", ur = "UA", fr = "UG", hr = "UM", pr = "US", dr = "UY", mr = "UZ", Ar = "VA", Er = "VC", gr = "VE", vr = "VG", yr = "VI", Tr = "VN", Mr = "VU", _r = "WF", Cr = "WS", Sr = "XK", Rr = "YE", Nr = "YT", kr = "ZA", br = "ZM", Ir = "ZW", na = {
216
- AND: qt,
217
- ARE: Xt,
218
- AFG: Qt,
219
- ATG: $t,
220
- AIA: zt,
221
- ALB: te,
222
- ARM: ee,
223
- AGO: se,
224
- ATA: ne,
225
- ARG: oe,
226
- ASM: re,
227
- AUT: ae,
228
- AUS: ie,
229
- ABW: ce,
230
- ALA: le,
231
- AZE: ue,
232
- BIH: fe,
233
- BRB: he,
234
- BGD: pe,
235
- BEL: de,
236
- BFA: me,
237
- BGR: Ae,
238
- BHR: Ee,
239
- BDI: ge,
240
- BEN: ve,
241
- BLM: ye,
242
- BMU: Te,
243
- BRN: Me,
244
- BOL: _e,
245
- BES: Ce,
246
- BRA: Se,
247
- BHS: Re,
248
- BTN: Ne,
249
- BVT: ke,
250
- BWA: be,
251
- BLR: Ie,
252
- BLZ: Le,
253
- CAN: Ge,
254
- CCK: Oe,
255
- COD: Pe,
256
- CAF: Be,
257
- COG: Ue,
258
- CHE: Fe,
259
- CIV: we,
260
- COK: De,
261
- CHL: He,
262
- CMR: Ke,
263
- CHN: je,
264
- COL: We,
265
- CRI: xe,
266
- CUB: Ye,
267
- CPV: Ze,
268
- CUW: Ve,
269
- CXR: Je,
270
- CYP: qe,
271
- CZE: Xe,
272
- DEU: Qe,
273
- DJI: $e,
274
- DNK: ze,
275
- DMA: ts,
276
- DOM: es,
277
- DZA: ss,
278
- ECU: ns,
279
- EST: os,
280
- EGY: rs,
281
- ESH: as,
282
- ERI: is,
283
- ESP: cs,
284
- ETH: ls,
285
- FIN: us,
286
- FJI: fs,
287
- FLK: hs,
288
- FSM: ps,
289
- FRO: ds,
290
- FRA: ms,
291
- GAB: As,
292
- GBR: Es,
293
- GRD: gs,
294
- GEO: vs,
295
- GUF: ys,
296
- GGY: Ts,
297
- GHA: Ms,
298
- GIB: _s,
299
- GRL: Cs,
300
- GMB: Ss,
301
- GIN: Rs,
302
- GLP: Ns,
303
- GNQ: ks,
304
- GRC: bs,
305
- SGS: Is,
306
- GTM: Ls,
307
- GUM: Gs,
308
- GNB: Os,
309
- GUY: Ps,
310
- HKG: Bs,
311
- HMD: Us,
312
- HND: Fs,
313
- HRV: ws,
314
- HTI: Ds,
315
- HUN: Hs,
316
- IDN: Ks,
317
- IRL: js,
318
- ISR: Ws,
319
- IMN: xs,
320
- IND: Ys,
321
- IOT: Zs,
322
- IRQ: Vs,
323
- IRN: Js,
324
- ISL: qs,
325
- ITA: Xs,
326
- JEY: Qs,
327
- JAM: $s,
328
- JOR: zs,
329
- JPN: tn,
330
- KEN: en,
331
- KGZ: sn,
332
- KHM: nn,
333
- KIR: on,
334
- COM: rn,
335
- KNA: an,
336
- PRK: cn,
337
- KOR: ln,
338
- KWT: un,
339
- CYM: fn,
340
- KAZ: hn,
341
- LAO: pn,
342
- LBN: dn,
343
- LCA: mn,
344
- LIE: An,
345
- LKA: En,
346
- LBR: gn,
347
- LSO: vn,
348
- LTU: yn,
349
- LUX: Tn,
350
- LVA: Mn,
351
- LBY: _n,
352
- MAR: Cn,
353
- MCO: Sn,
354
- MDA: Rn,
355
- MNE: Nn,
356
- MAF: kn,
357
- MDG: bn,
358
- MHL: In,
359
- MKD: Ln,
360
- MLI: Gn,
361
- MMR: On,
362
- MNG: Pn,
363
- MAC: Bn,
364
- MNP: Un,
365
- MTQ: Fn,
366
- MRT: wn,
367
- MSR: Dn,
368
- MLT: Hn,
369
- MUS: Kn,
370
- MDV: jn,
371
- MWI: Wn,
372
- MEX: xn,
373
- MYS: Yn,
374
- MOZ: Zn,
375
- NAM: Vn,
376
- NCL: Jn,
377
- NER: qn,
378
- NFK: Xn,
379
- NGA: Qn,
380
- NIC: $n,
381
- NLD: zn,
382
- NOR: to,
383
- NPL: eo,
384
- NRU: so,
385
- NIU: no,
386
- NZL: oo,
387
- OMN: ro,
388
- PAN: ao,
389
- PER: io,
390
- PYF: co,
391
- PNG: lo,
392
- PHL: uo,
393
- PAK: fo,
394
- POL: ho,
395
- SPM: po,
396
- PCN: mo,
397
- PRI: Ao,
398
- PSE: Eo,
399
- PRT: go,
400
- PLW: vo,
401
- PRY: yo,
402
- QAT: To,
403
- REU: Mo,
404
- ROU: _o,
405
- SRB: Co,
406
- RUS: So,
407
- RWA: Ro,
408
- SAU: No,
409
- SLB: ko,
410
- SYC: bo,
411
- SDN: Io,
412
- SWE: Lo,
413
- SGP: Go,
414
- SHN: Oo,
415
- SVN: Po,
416
- SJM: Bo,
417
- SVK: Uo,
418
- SLE: Fo,
419
- SMR: wo,
420
- SEN: Do,
421
- SOM: Ho,
422
- SUR: Ko,
423
- SSD: jo,
424
- STP: Wo,
425
- SLV: xo,
426
- SXM: Yo,
427
- SYR: Zo,
428
- SWZ: Vo,
429
- TCA: Jo,
430
- TCD: qo,
431
- ATF: Xo,
432
- TGO: Qo,
433
- THA: $o,
434
- TJK: zo,
435
- TKL: tr,
436
- TLS: er,
437
- TKM: sr,
438
- TUN: nr,
439
- TON: or,
440
- TUR: rr,
441
- TTO: ar,
442
- TUV: ir,
443
- TWN: cr,
444
- TZA: lr,
445
- UKR: ur,
446
- UGA: fr,
447
- UMI: hr,
448
- USA: pr,
449
- URY: dr,
450
- UZB: mr,
451
- VAT: Ar,
452
- VCT: Er,
453
- VEN: gr,
454
- VGB: vr,
455
- VIR: yr,
456
- VNM: Tr,
457
- VUT: Mr,
458
- WLF: _r,
459
- WSM: Cr,
460
- XKX: Sr,
461
- YEM: Rr,
462
- MYT: Nr,
463
- ZAF: kr,
464
- ZMB: br,
465
- ZWE: Ir
466
- }, Lr = '"Twemoji Mozilla","Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji","EmojiOne Color","Android Emoji",sans-serif';
467
- function Gr() {
468
- const e = document.createElement("canvas");
469
- e.width = e.height = 1;
470
- const t = e.getContext("2d", { willReadFrequently: !0 });
471
- return t.textBaseline = "top", t.font = `100px ${Lr}`, t.scale(0.01, 0.01), t;
472
- }
473
- function st(e, t, s) {
474
- return e.clearRect(0, 0, 100, 100), e.fillStyle = s, e.fillText(t, 0, 0), e.getImageData(0, 0, 1, 1).data.join(",");
475
- }
476
- function nt(e) {
477
- const t = Gr(), s = st(t, e, "#fff"), n = st(t, e, "#000");
478
- return n === s && !n.startsWith("0,0,0,");
479
- }
480
- function oa(e = "Twemoji Country Flags", t = "https://cdn.jsdelivr.net/npm/country-flag-emoji-polyfill@0.1/dist/TwemojiCountryFlags.woff2") {
481
- if (typeof window < "u" && nt("😊") && !nt("🇨🇭")) {
482
- const s = document.createElement("style");
483
- return s.textContent = `@font-face {
484
- font-family: "${e}";
485
- unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067,
486
- U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
487
- src: url('${t}') format('woff2');
488
- font-display: swap;
489
- }`, document.head.appendChild(s), !0;
490
- }
491
- return !1;
492
- }
493
- var Or = Object.defineProperty, Pr = (e, t, s) => t in e ? Or(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, O = (e, t, s) => Pr(e, typeof t != "symbol" ? t + "" : t, s);
494
- const ot = {
495
- "#": { pattern: /[0-9]/ },
496
- "@": { pattern: /[a-zA-Z]/ },
497
- "*": { pattern: /[a-zA-Z0-9]/ }
498
- }, rt = (e, t, s) => e.replaceAll(t, "").replace(s, ".").replace("..", ".").replace(/[^.\d]/g, ""), at = (e, t, s) => {
499
- var n;
500
- return new Intl.NumberFormat(((n = s.number) == null ? void 0 : n.locale) ?? "en", {
501
- minimumFractionDigits: e,
502
- maximumFractionDigits: t,
503
- roundingMode: "trunc"
504
- });
505
- }, Br = (e, t = !0, s) => {
506
- var n, o, r, c;
507
- const u = ((n = s.number) == null ? void 0 : n.unsigned) !== !0 && e.startsWith("-") ? "-" : "", d = ((o = s.number) == null ? void 0 : o.fraction) ?? 0;
508
- let f = at(0, d, s);
509
- const g = f.formatToParts(1000.12), y = ((r = g.find((h) => h.type === "group")) == null ? void 0 : r.value) ?? " ", p = ((c = g.find((h) => h.type === "decimal")) == null ? void 0 : c.value) ?? ".", A = rt(e, y, p);
510
- if (Number.isNaN(parseFloat(A))) return u;
511
- const m = A.split(".");
512
- if (m[1] != null && m[1].length >= 1) {
513
- const h = m[1].length <= d ? m[1].length : d;
514
- f = at(h, d, s);
515
- }
516
- let E = f.format(parseFloat(A));
517
- return t ? d > 0 && A.endsWith(".") && !A.slice(0, -1).includes(".") && (E += p) : E = rt(E, y, p), u + E;
518
- };
519
- class At {
520
- constructor(t = {}) {
521
- O(this, "opts", {}), O(this, "memo", /* @__PURE__ */ new Map());
522
- const s = { ...t };
523
- if (s.tokens != null) {
524
- s.tokens = s.tokensReplace ? { ...s.tokens } : { ...ot, ...s.tokens };
525
- for (const n of Object.values(s.tokens))
526
- typeof n.pattern == "string" && (n.pattern = new RegExp(n.pattern));
527
- } else
528
- s.tokens = ot;
529
- Array.isArray(s.mask) && (s.mask.length > 1 ? s.mask = [...s.mask].sort((n, o) => n.length - o.length) : s.mask = s.mask[0] ?? ""), s.mask === "" && (s.mask = null), this.opts = s;
530
- }
531
- masked(t) {
532
- return this.process(String(t), this.findMask(String(t)));
533
- }
534
- unmasked(t) {
535
- return this.process(String(t), this.findMask(String(t)), !1);
536
- }
537
- isEager() {
538
- return this.opts.eager === !0;
539
- }
540
- isReversed() {
541
- return this.opts.reversed === !0;
542
- }
543
- completed(t) {
544
- const s = this.findMask(String(t));
545
- if (this.opts.mask == null || s == null) return !1;
546
- const n = this.process(String(t), s).length;
547
- return typeof this.opts.mask == "string" ? n >= this.opts.mask.length : n >= s.length;
548
- }
549
- findMask(t) {
550
- const s = this.opts.mask;
551
- if (s == null)
552
- return null;
553
- if (typeof s == "string")
554
- return s;
555
- if (typeof s == "function")
556
- return s(t);
557
- const n = this.process(t, s.slice(-1).pop() ?? "", !1);
558
- return s.find((o) => this.process(t, o, !1).length >= n.length) ?? "";
559
- }
560
- escapeMask(t) {
561
- const s = [], n = [];
562
- return t.split("").forEach((o, r) => {
563
- o === "!" && t[r - 1] !== "!" ? n.push(r - n.length) : s.push(o);
564
- }), { mask: s.join(""), escaped: n };
565
- }
566
- process(t, s, n = !0) {
567
- if (this.opts.number != null) return Br(t, n, this.opts);
568
- if (s == null) return t;
569
- const o = `v=${t},mr=${s},m=${n ? 1 : 0}`;
570
- if (this.memo.has(o)) return this.memo.get(o);
571
- const { mask: r, escaped: c } = this.escapeMask(s), u = [], d = this.opts.tokens != null ? this.opts.tokens : {}, f = this.isReversed() ? -1 : 1, g = this.isReversed() ? "unshift" : "push", y = this.isReversed() ? 0 : r.length - 1, p = this.isReversed() ? () => h > -1 && v > -1 : () => h < r.length && v < t.length, A = (a) => !this.isReversed() && a <= y || this.isReversed() && a >= y;
572
- let m, E = -1, h = this.isReversed() ? r.length - 1 : 0, v = this.isReversed() ? t.length - 1 : 0, M = !1;
573
- for (; p(); ) {
574
- const a = r.charAt(h), i = d[a], l = (i == null ? void 0 : i.transform) != null ? i.transform(t.charAt(v)) : t.charAt(v);
575
- if (!c.includes(h) && i != null ? (l.match(i.pattern) != null ? (u[g](l), i.repeated ? (E === -1 ? E = h : h === y && h !== E && (h = E - f), y === E && (h -= f)) : i.multiple && (M = !0, h -= f), h += f) : i.multiple ? M && (h += f, v -= f, M = !1) : l === m ? m = void 0 : i.optional && (h += f, v -= f), v += f) : (n && !this.isEager() && u[g](a), l === a && !this.isEager() ? v += f : m = a, this.isEager() || (h += f)), this.isEager())
576
- for (; A(h) && (d[r.charAt(h)] == null || c.includes(h)); ) {
577
- if (n) {
578
- if (u[g](r.charAt(h)), t.charAt(v) === r.charAt(h)) {
579
- h += f, v += f;
580
- continue;
581
- }
582
- } else r.charAt(h) === t.charAt(v) && (v += f);
583
- h += f;
584
- }
585
- }
586
- return this.memo.set(o, u.join("")), this.memo.get(o);
587
- }
588
- }
589
- const Et = (e) => JSON.parse(e.replaceAll("'", '"')), Ur = (e, t = {}) => {
590
- const s = { ...t };
591
- e.dataset.maska != null && e.dataset.maska !== "" && (s.mask = Fr(e.dataset.maska)), e.dataset.maskaEager != null && (s.eager = P(e.dataset.maskaEager)), e.dataset.maskaReversed != null && (s.reversed = P(e.dataset.maskaReversed)), e.dataset.maskaTokensReplace != null && (s.tokensReplace = P(e.dataset.maskaTokensReplace)), e.dataset.maskaTokens != null && (s.tokens = wr(e.dataset.maskaTokens));
592
- const n = {};
593
- return e.dataset.maskaNumberLocale != null && (n.locale = e.dataset.maskaNumberLocale), e.dataset.maskaNumberFraction != null && (n.fraction = parseInt(e.dataset.maskaNumberFraction)), e.dataset.maskaNumberUnsigned != null && (n.unsigned = P(e.dataset.maskaNumberUnsigned)), (e.dataset.maskaNumber != null || Object.values(n).length > 0) && (s.number = n), s;
594
- }, P = (e) => e !== "" ? !!JSON.parse(e) : !0, Fr = (e) => e.startsWith("[") && e.endsWith("]") ? Et(e) : e, wr = (e) => {
595
- if (e.startsWith("{") && e.endsWith("}"))
596
- return Et(e);
597
- const t = {};
598
- return e.split("|").forEach((s) => {
599
- const n = s.split(":");
600
- t[n[0]] = {
601
- pattern: new RegExp(n[1]),
602
- optional: n[2] === "optional",
603
- multiple: n[2] === "multiple",
604
- repeated: n[2] === "repeated"
605
- };
606
- }), t;
607
- };
608
- class ra {
609
- constructor(t, s = {}) {
610
- O(this, "items", /* @__PURE__ */ new Map()), O(this, "eventAbortController"), O(this, "onInput", (n) => {
611
- if (n instanceof CustomEvent && n.type === "input" && !n.isTrusted && !n.bubbles)
612
- return;
613
- const o = n.target, r = this.items.get(o);
614
- if (r === void 0) return;
615
- const c = "inputType" in n && n.inputType.startsWith("delete"), u = r.isEager(), d = c && u && r.unmasked(o.value) === "" ? "" : o.value;
616
- this.fixCursor(o, c, () => this.setValue(o, d));
617
- }), this.options = s, this.eventAbortController = new AbortController(), this.init(this.getInputs(t));
618
- }
619
- update(t = {}) {
620
- this.options = { ...t }, this.init(Array.from(this.items.keys()));
621
- }
622
- updateValue(t) {
623
- var s;
624
- t.value !== "" && t.value !== ((s = this.processInput(t)) == null ? void 0 : s.masked) && this.setValue(t, t.value);
625
- }
626
- destroy() {
627
- this.eventAbortController.abort(), this.items.clear();
628
- }
629
- init(t) {
630
- const s = this.getOptions(this.options);
631
- for (const n of t) {
632
- if (!this.items.has(n)) {
633
- const { signal: r } = this.eventAbortController;
634
- n.addEventListener("input", this.onInput, { capture: !0, signal: r });
635
- }
636
- const o = new At(Ur(n, s));
637
- this.items.set(n, o), queueMicrotask(() => this.updateValue(n)), n.selectionStart === null && o.isEager() && console.warn("Maska: input of `%s` type is not supported", n.type);
638
- }
639
- }
640
- getInputs(t) {
641
- return typeof t == "string" ? Array.from(document.querySelectorAll(t)) : "length" in t ? Array.from(t) : [t];
642
- }
643
- getOptions(t) {
644
- const { onMaska: s, preProcess: n, postProcess: o, ...r } = t;
645
- return r;
646
- }
647
- fixCursor(t, s, n) {
648
- var o, r;
649
- const c = t.selectionStart, u = t.value;
650
- if (n(), c === null || c === u.length && !s) return;
651
- const d = t.value, f = u.slice(0, c), g = d.slice(0, c), y = (o = this.processInput(t, f)) == null ? void 0 : o.unmasked, p = (r = this.processInput(t, g)) == null ? void 0 : r.unmasked;
652
- if (y === void 0 || p === void 0) return;
653
- let A = c;
654
- f !== g && (A += s ? d.length - u.length : y.length - p.length), t.setSelectionRange(A, A);
655
- }
656
- setValue(t, s) {
657
- const n = this.processInput(t, s);
658
- n !== void 0 && (t.value = n.masked, this.options.onMaska != null && (Array.isArray(this.options.onMaska) ? this.options.onMaska.forEach((o) => o(n)) : this.options.onMaska(n)), t.dispatchEvent(new CustomEvent("maska", { detail: n })), t.dispatchEvent(new CustomEvent("input", { detail: n.masked })));
659
- }
660
- processInput(t, s) {
661
- const n = this.items.get(t);
662
- if (n === void 0) return;
663
- let o = s ?? t.value;
664
- this.options.preProcess != null && (o = this.options.preProcess(o));
665
- let r = n.masked(o);
666
- return this.options.postProcess != null && (r = this.options.postProcess(r)), {
667
- masked: r,
668
- unmasked: n.unmasked(o),
669
- completed: n.completed(o)
670
- };
671
- }
672
- }
673
- const Dr = "application/json", gt = "Content-Type", b = Symbol(), vt = Symbol();
674
- function it(e = {}) {
675
- var t;
676
- const s = e instanceof Array ? Object.fromEntries(e) : e;
677
- return (t = Object.entries(s).find(([n]) => n.toLowerCase() === gt.toLowerCase())) === null || t === void 0 ? void 0 : t[1];
678
- }
679
- function ct(e) {
680
- return /^application\/.*json.*/.test(e);
681
- }
682
- const N = function(e, t, s = !1) {
683
- return Object.entries(t).reduce((n, [o, r]) => {
684
- const c = e[o];
685
- return Array.isArray(c) && Array.isArray(r) ? n[o] = s ? [...c, ...r] : r : typeof c == "object" && typeof r == "object" ? n[o] = N(c, r, s) : n[o] = r, n;
686
- }, { ...e });
687
- }, I = {
688
- // Default options
689
- options: {},
690
- // Error type
691
- errorType: "text",
692
- // Polyfills
693
- polyfills: {
694
- // fetch: null,
695
- // FormData: null,
696
- // URL: null,
697
- // URLSearchParams: null,
698
- // performance: null,
699
- // PerformanceObserver: null,
700
- // AbortController: null,
701
- },
702
- polyfill(e, t = !0, s = !1, ...n) {
703
- const o = this.polyfills[e] || (typeof self < "u" ? self[e] : null) || (typeof global < "u" ? global[e] : null);
704
- if (t && !o)
705
- throw new Error(e + " is not defined");
706
- return s && o ? new o(...n) : o;
707
- }
708
- };
709
- function Hr(e, t = !1) {
710
- I.options = t ? e : N(I.options, e);
711
- }
712
- function Kr(e, t = !1) {
713
- I.polyfills = t ? e : N(I.polyfills, e);
714
- }
715
- function jr(e) {
716
- I.errorType = e;
717
- }
718
- const Wr = (e) => (t) => e.reduceRight((s, n) => n(s), t) || t;
719
- class yt extends Error {
720
- }
721
- const xr = (e) => {
722
- const t = /* @__PURE__ */ Object.create(null);
723
- e = e._addons.reduce((a, i) => i.beforeRequest && i.beforeRequest(a, e._options, t) || a, e);
724
- const { _url: s, _options: n, _config: o, _catchers: r, _resolvers: c, _middlewares: u, _addons: d } = e, f = new Map(r), g = N(o.options, n);
725
- let y = s;
726
- const p = Wr(u)((a, i) => (y = a, o.polyfill("fetch")(a, i)))(s, g), A = new Error(), m = p.catch((a) => {
727
- throw { [b]: a };
728
- }).then((a) => {
729
- var i;
730
- if (!a.ok) {
731
- const l = new yt();
732
- if (l.cause = A, l.stack = l.stack + `
733
- CAUSE: ` + A.stack, l.response = a, l.status = a.status, l.url = y, a.type === "opaque")
734
- throw l;
735
- const _ = o.errorType === "json" || ((i = a.headers.get("Content-Type")) === null || i === void 0 ? void 0 : i.split(";")[0]) === "application/json";
736
- return (o.errorType ? _ ? a.text() : a[o.errorType]() : Promise.resolve(a.body)).then((T) => {
737
- throw l.message = typeof T == "string" ? T : a.statusText, T && (_ && typeof T == "string" ? (l.text = T, l.json = JSON.parse(T)) : l[o.errorType] = T), l;
738
- });
739
- }
740
- return a;
741
- }), E = (a) => a.catch((i) => {
742
- const l = Object.prototype.hasOwnProperty.call(i, b), _ = l ? i[b] : i, C = (_ == null ? void 0 : _.status) && f.get(_.status) || f.get(_ == null ? void 0 : _.name) || l && f.has(b) && f.get(b);
743
- if (C)
744
- return C(_, e);
745
- const T = f.get(vt);
746
- if (T)
747
- return T(_, e);
748
- throw _;
749
- }), h = (a) => (i) => /* If a callback is provided, then callback with the body result otherwise return the parsed body itself. */ E(a ? m.then((l) => l && l[a]()).then((l) => i ? i(l) : l) : m.then((l) => i ? i(l) : l)), v = {
750
- _wretchReq: e,
751
- _fetchReq: p,
752
- _sharedState: t,
753
- res: h(null),
754
- json: h("json"),
755
- blob: h("blob"),
756
- formData: h("formData"),
757
- arrayBuffer: h("arrayBuffer"),
758
- text: h("text"),
759
- error(a, i) {
760
- return f.set(a, i), this;
761
- },
762
- badRequest(a) {
763
- return this.error(400, a);
764
- },
765
- unauthorized(a) {
766
- return this.error(401, a);
767
- },
768
- forbidden(a) {
769
- return this.error(403, a);
770
- },
771
- notFound(a) {
772
- return this.error(404, a);
773
- },
774
- timeout(a) {
775
- return this.error(408, a);
776
- },
777
- internalError(a) {
778
- return this.error(500, a);
779
- },
780
- fetchError(a) {
781
- return this.error(b, a);
782
- }
783
- }, M = d.reduce((a, i) => ({
784
- ...a,
785
- ...typeof i.resolver == "function" ? i.resolver(a) : i.resolver
786
- }), v);
787
- return c.reduce((a, i) => i(a, e), M);
788
- }, Yr = {
789
- _url: "",
790
- _options: {},
791
- _config: I,
792
- _catchers: /* @__PURE__ */ new Map(),
793
- _resolvers: [],
794
- _deferred: [],
795
- _middlewares: [],
796
- _addons: [],
797
- addon(e) {
798
- return { ...this, _addons: [...this._addons, e], ...e.wretch };
799
- },
800
- errorType(e) {
801
- return {
802
- ...this,
803
- _config: {
804
- ...this._config,
805
- errorType: e
806
- }
807
- };
808
- },
809
- polyfills(e, t = !1) {
810
- return {
811
- ...this,
812
- _config: {
813
- ...this._config,
814
- polyfills: t ? e : N(this._config.polyfills, e)
815
- }
816
- };
817
- },
818
- url(e, t = !1) {
819
- if (t)
820
- return { ...this, _url: e };
821
- const s = this._url.split("?");
822
- return {
823
- ...this,
824
- _url: s.length > 1 ? s[0] + e + "?" + s[1] : this._url + e
825
- };
826
- },
827
- options(e, t = !1) {
828
- return { ...this, _options: t ? e : N(this._options, e) };
829
- },
830
- headers(e) {
831
- const t = e ? Array.isArray(e) ? Object.fromEntries(e) : "entries" in e ? Object.fromEntries(e.entries()) : e : {};
832
- return { ...this, _options: N(this._options, { headers: t }) };
833
- },
834
- accept(e) {
835
- return this.headers({ Accept: e });
836
- },
837
- content(e) {
838
- return this.headers({ [gt]: e });
839
- },
840
- auth(e) {
841
- return this.headers({ Authorization: e });
842
- },
843
- catcher(e, t) {
844
- const s = new Map(this._catchers);
845
- return s.set(e, t), { ...this, _catchers: s };
846
- },
847
- catcherFallback(e) {
848
- return this.catcher(vt, e);
849
- },
850
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
851
- resolve(e, t = !1) {
852
- return { ...this, _resolvers: t ? [e] : [...this._resolvers, e] };
853
- },
854
- defer(e, t = !1) {
855
- return {
856
- ...this,
857
- _deferred: t ? [e] : [...this._deferred, e]
858
- };
859
- },
860
- middlewares(e, t = !1) {
861
- return {
862
- ...this,
863
- _middlewares: t ? e : [...this._middlewares, ...e]
864
- };
865
- },
866
- fetch(e = this._options.method, t = "", s = null) {
867
- let n = this.url(t).options({ method: e });
868
- const o = it(n._options.headers), r = this._config.polyfill("FormData", !1), c = typeof s == "object" && !(r && s instanceof r) && (!n._options.headers || !o || ct(o));
869
- return n = s ? c ? n.json(s, o) : n.body(s) : n, xr(n._deferred.reduce((u, d) => d(u, u._url, u._options), n));
870
- },
871
- get(e = "") {
872
- return this.fetch("GET", e);
873
- },
874
- delete(e = "") {
875
- return this.fetch("DELETE", e);
876
- },
877
- put(e, t = "") {
878
- return this.fetch("PUT", t, e);
879
- },
880
- post(e, t = "") {
881
- return this.fetch("POST", t, e);
882
- },
883
- patch(e, t = "") {
884
- return this.fetch("PATCH", t, e);
885
- },
886
- head(e = "") {
887
- return this.fetch("HEAD", e);
888
- },
889
- opts(e = "") {
890
- return this.fetch("OPTIONS", e);
891
- },
892
- body(e) {
893
- return { ...this, _options: { ...this._options, body: e } };
894
- },
895
- json(e, t) {
896
- const s = it(this._options.headers);
897
- return this.content(t || ct(s) && s || Dr).body(JSON.stringify(e));
898
- }
899
- };
900
- function k(e = "", t = {}) {
901
- return { ...Yr, _url: e, _options: t };
902
- }
903
- k.default = k;
904
- k.options = Hr;
905
- k.errorType = jr;
906
- k.polyfills = Kr;
907
- k.WretchError = yt;
908
- const Zr = () => ({
909
- beforeRequest(e, t, s) {
910
- const n = e._config.polyfill("AbortController", !1, !0);
911
- !t.signal && n && (t.signal = n.signal);
912
- const o = {
913
- ref: null,
914
- clear() {
915
- o.ref && (clearTimeout(o.ref), o.ref = null);
916
- }
917
- };
918
- return s.abort = {
919
- timeout: o,
920
- fetchController: n
921
- }, e;
922
- },
923
- wretch: {
924
- signal(e) {
925
- return { ...this, _options: { ...this._options, signal: e.signal } };
926
- }
927
- },
928
- resolver: {
929
- setTimeout(e, t = this._sharedState.abort.fetchController) {
930
- const { timeout: s } = this._sharedState.abort;
931
- return s.clear(), s.ref = setTimeout(() => t.abort(), e), this;
932
- },
933
- controller() {
934
- return [this._sharedState.abort.fetchController, this];
935
- },
936
- onAbort(e) {
937
- return this.error("AbortError", e);
938
- }
939
- }
940
- });
941
- function Tt(e, t = !1, s, n = s.polyfill("FormData", !0, !0), o = []) {
942
- return Object.entries(e).forEach(([r, c]) => {
943
- let u = o.reduce((d, f) => d ? `${d}[${f}]` : f, null);
944
- if (u = u ? `${u}[${r}]` : r, c instanceof Array || globalThis.FileList && c instanceof FileList)
945
- for (const d of c)
946
- n.append(u, d);
947
- else t && typeof c == "object" && (!(t instanceof Array) || !t.includes(r)) ? c !== null && Tt(c, t, s, n, [...o, r]) : n.append(u, c);
948
- }), n;
949
- }
950
- const Vr = {
951
- wretch: {
952
- formData(e, t = !1) {
953
- return this.body(Tt(e, t, this._config));
954
- }
955
- }
956
- };
957
- function lt(e) {
958
- return typeof e < "u" ? e : "";
959
- }
960
- const Jr = (e, t, s, n, o) => {
961
- let r;
962
- if (typeof t == "string")
963
- r = t;
964
- else {
965
- const u = o.polyfill("URLSearchParams", !0, !0);
966
- for (const d in t) {
967
- const f = t[d];
968
- if (!(n && f == null))
969
- if (t[d] instanceof Array)
970
- for (const g of f)
971
- u.append(d, lt(g));
972
- else
973
- u.append(d, lt(f));
974
- }
975
- r = u.toString();
976
- }
977
- const c = e.split("?");
978
- return r ? s || c.length < 2 ? c[0] + "?" + r : e + "&" + r : s ? c[0] : e;
979
- }, qr = {
980
- wretch: {
981
- query(e, t = !1, s = !1) {
982
- return { ...this, _url: Jr(this._url, e, t, s, this._config) };
983
- }
984
- }
985
- }, Xr = {
986
- number: {
987
- locale: "uk",
988
- fraction: 2,
989
- unsigned: !0
990
- }
991
- }, aa = {
992
- number: {
993
- locale: "uk",
994
- fraction: 0,
995
- unsigned: !0
996
- }
997
- }, ia = (e) => {
998
- const t = e.split(",");
999
- return t.length > 1 && t[1].length === 1 ? e.padEnd(e.length + 1, "0") : e;
1000
- }, Qr = (e) => new At(Xr).unmasked(e), ut = Symbol("aborted");
1001
- class ca {
1002
- constructor(t) {
1003
- q(this, "abort");
1004
- this.version = t;
1005
- }
1006
- getProfile(t) {
1007
- return t === "GBP" ? "uk" : "euro";
1008
- }
1009
- async loadData(t = "https://transfer.moneyto.co.uk/sf/country-list") {
1010
- const s = await this.makeRequest().url(t).get();
1011
- if (s.status === "success")
1012
- return s.result;
1013
- }
1014
- async calculate(t, s = "https://transfer.moneyto.co.uk/sf/calculate") {
1015
- var c;
1016
- (c = this.abort) == null || c.abort(ut), this.abort = new AbortController();
1017
- const n = t.isReceive ? t.payoutAmount : t.sendAmount, o = new URLSearchParams(window.location.search), r = {
1018
- country: t.country,
1019
- method: t.payoutType,
1020
- amount: Qr(n),
1021
- currency: t.payoutCurrency,
1022
- send_currency: t.sendCurrency,
1023
- is_receive: t.isReceive ? 1 : 0,
1024
- profile: this.getProfile(t.sendCurrency),
1025
- utm_source: o.get("utm_source"),
1026
- utm_medium: o.get("utm_medium"),
1027
- utm_campaign: o.get("utm_campaign"),
1028
- utm_content: o.get("utm_content"),
1029
- utm_term: o.get("utm_term")
1030
- };
1031
- try {
1032
- const u = await this.makeRequest().url(s).formData(r).signal(this.abort).post();
1033
- if (u.status !== "success")
1034
- throw new Error();
1035
- return u.result;
1036
- } catch (u) {
1037
- throw u === ut ? u : new Error("Calculation error, please try later");
1038
- }
1039
- }
1040
- makeRequest() {
1041
- let t = k().errorType("json").addon(Zr()).addon(Vr).addon(qr).resolve((s) => s.json());
1042
- return this.version && (t = t.query({ api_version: this.version })), t;
1043
- }
1044
- }
1045
- export {
1046
- ca as A,
1047
- At as F,
1048
- ra as V,
1049
- na as a,
1050
- H as b,
1051
- sa as c,
1052
- aa as d,
1053
- ea as e,
1054
- oa as f,
1055
- Xr as g,
1056
- ut as h,
1057
- ta as i,
1058
- Qr as j,
1059
- ia as p
1060
- };