@tokemak/utils 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +1585 -0
  2. package/package.json +3 -5
package/dist/index.mjs ADDED
@@ -0,0 +1,1585 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined")
11
+ return require.apply(this, arguments);
12
+ throw new Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __commonJS = (cb, mod) => function __require2() {
15
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
+ };
17
+ var __copyProps = (to, from, except, desc) => {
18
+ if (from && typeof from === "object" || typeof from === "function") {
19
+ for (let key of __getOwnPropNames(from))
20
+ if (!__hasOwnProp.call(to, key) && key !== except)
21
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
+ }
23
+ return to;
24
+ };
25
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
+ // If the importer is in node compatibility mode or this is not an ESM
27
+ // file that has been converted to a CommonJS file using a Babel-
28
+ // compatible transform (i.e. "__esModule" has not been set), then set
29
+ // "default" to the CommonJS "module.exports" for node compatibility.
30
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
+ mod
32
+ ));
33
+
34
+ // ../../node_modules/numbro/dist/numbro.min.js
35
+ var require_numbro_min = __commonJS({
36
+ "../../node_modules/numbro/dist/numbro.min.js"(exports, module) {
37
+ !function(e) {
38
+ if ("object" == typeof exports && "undefined" != typeof module)
39
+ module.exports = e();
40
+ else if ("function" == typeof define && define.amd)
41
+ define([], e);
42
+ else {
43
+ ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).numbro = e();
44
+ }
45
+ }(function() {
46
+ return function a(o, u, c) {
47
+ function s(t, e2) {
48
+ if (!u[t]) {
49
+ if (!o[t]) {
50
+ var r = "function" == typeof __require && __require;
51
+ if (!e2 && r)
52
+ return r(t, true);
53
+ if (l)
54
+ return l(t, true);
55
+ var n = new Error("Cannot find module '" + t + "'");
56
+ throw n.code = "MODULE_NOT_FOUND", n;
57
+ }
58
+ var i = u[t] = { exports: {} };
59
+ o[t][0].call(i.exports, function(e3) {
60
+ return s(o[t][1][e3] || e3);
61
+ }, i, i.exports, a, o, u, c);
62
+ }
63
+ return u[t].exports;
64
+ }
65
+ for (var l = "function" == typeof __require && __require, e = 0; e < c.length; e++)
66
+ s(c[e]);
67
+ return s;
68
+ }({ 1: [function(e, r, t) {
69
+ !function(e2) {
70
+ "use strict";
71
+ var t2, T = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, C = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator, U = Math.ceil, R = Math.floor, I = "[BigNumber Error] ", $ = I + "Number primitive has more than 15 significant digits: ", G = 1e14, V = 14, q = 9007199254740991, Z = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], z = 1e7, W = 1e9;
72
+ function H(e3) {
73
+ var t3 = 0 | e3;
74
+ return 0 < e3 || e3 === t3 ? t3 : t3 - 1;
75
+ }
76
+ function Y(e3) {
77
+ for (var t3, r2, n = 1, i = e3.length, a = e3[0] + ""; n < i; ) {
78
+ for (t3 = e3[n++] + "", r2 = V - t3.length; r2--; t3 = "0" + t3)
79
+ ;
80
+ a += t3;
81
+ }
82
+ for (i = a.length; 48 === a.charCodeAt(--i); )
83
+ ;
84
+ return a.slice(0, i + 1 || 1);
85
+ }
86
+ function K(e3, t3) {
87
+ var r2, n, i = e3.c, a = t3.c, o = e3.s, u = t3.s, c = e3.e, s = t3.e;
88
+ if (!o || !u)
89
+ return null;
90
+ if (r2 = i && !i[0], n = a && !a[0], r2 || n)
91
+ return r2 ? n ? 0 : -u : o;
92
+ if (o != u)
93
+ return o;
94
+ if (r2 = o < 0, n = c == s, !i || !a)
95
+ return n ? 0 : !i ^ r2 ? 1 : -1;
96
+ if (!n)
97
+ return s < c ^ r2 ? 1 : -1;
98
+ for (u = (c = i.length) < (s = a.length) ? c : s, o = 0; o < u; o++)
99
+ if (i[o] != a[o])
100
+ return i[o] > a[o] ^ r2 ? 1 : -1;
101
+ return c == s ? 0 : s < c ^ r2 ? 1 : -1;
102
+ }
103
+ function J(e3, t3, r2, n) {
104
+ if (e3 < t3 || r2 < e3 || e3 !== R(e3))
105
+ throw Error(I + (n || "Argument") + ("number" == typeof e3 ? e3 < t3 || r2 < e3 ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(e3));
106
+ }
107
+ function X(e3) {
108
+ var t3 = e3.c.length - 1;
109
+ return H(e3.e / V) == t3 && e3.c[t3] % 2 != 0;
110
+ }
111
+ function Q(e3, t3) {
112
+ return (1 < e3.length ? e3.charAt(0) + "." + e3.slice(1) : e3) + (t3 < 0 ? "e" : "e+") + t3;
113
+ }
114
+ function ee(e3, t3, r2) {
115
+ var n, i;
116
+ if (t3 < 0) {
117
+ for (i = r2 + "."; ++t3; i += r2)
118
+ ;
119
+ e3 = i + e3;
120
+ } else if (++t3 > (n = e3.length)) {
121
+ for (i = r2, t3 -= n; --t3; i += r2)
122
+ ;
123
+ e3 += i;
124
+ } else
125
+ t3 < n && (e3 = e3.slice(0, t3) + "." + e3.slice(t3));
126
+ return e3;
127
+ }
128
+ (t2 = function e3(t3) {
129
+ var v, f, g, r2, s, m, o, u, c, l, p, n = A.prototype = { constructor: A, toString: null, valueOf: null }, h = new A(1), y = 20, b = 4, d = -7, w = 21, S = -1e7, O = 1e7, x = false, a = 1, N = 0, B = { prefix: "", groupSize: 3, secondaryGroupSize: 0, groupSeparator: ",", decimalSeparator: ".", fractionGroupSize: 0, fractionGroupSeparator: "\xA0", suffix: "" }, M = "0123456789abcdefghijklmnopqrstuvwxyz";
130
+ function A(e4, t4) {
131
+ var r3, n2, i2, a2, o2, u2, c2, s2, l2 = this;
132
+ if (!(l2 instanceof A))
133
+ return new A(e4, t4);
134
+ if (null == t4) {
135
+ if (e4 && true === e4._isBigNumber)
136
+ return l2.s = e4.s, void (!e4.c || e4.e > O ? l2.c = l2.e = null : e4.e < S ? l2.c = [l2.e = 0] : (l2.e = e4.e, l2.c = e4.c.slice()));
137
+ if ((u2 = "number" == typeof e4) && 0 * e4 == 0) {
138
+ if (l2.s = 1 / e4 < 0 ? (e4 = -e4, -1) : 1, e4 === ~~e4) {
139
+ for (a2 = 0, o2 = e4; 10 <= o2; o2 /= 10, a2++)
140
+ ;
141
+ return void (O < a2 ? l2.c = l2.e = null : (l2.e = a2, l2.c = [e4]));
142
+ }
143
+ s2 = String(e4);
144
+ } else {
145
+ if (!T.test(s2 = String(e4)))
146
+ return g(l2, s2, u2);
147
+ l2.s = 45 == s2.charCodeAt(0) ? (s2 = s2.slice(1), -1) : 1;
148
+ }
149
+ -1 < (a2 = s2.indexOf(".")) && (s2 = s2.replace(".", "")), 0 < (o2 = s2.search(/e/i)) ? (a2 < 0 && (a2 = o2), a2 += +s2.slice(o2 + 1), s2 = s2.substring(0, o2)) : a2 < 0 && (a2 = s2.length);
150
+ } else {
151
+ if (J(t4, 2, M.length, "Base"), 10 == t4)
152
+ return j(l2 = new A(e4), y + l2.e + 1, b);
153
+ if (s2 = String(e4), u2 = "number" == typeof e4) {
154
+ if (0 * e4 != 0)
155
+ return g(l2, s2, u2, t4);
156
+ if (l2.s = 1 / e4 < 0 ? (s2 = s2.slice(1), -1) : 1, A.DEBUG && 15 < s2.replace(/^0\.0*|\./, "").length)
157
+ throw Error($ + e4);
158
+ } else
159
+ l2.s = 45 === s2.charCodeAt(0) ? (s2 = s2.slice(1), -1) : 1;
160
+ for (r3 = M.slice(0, t4), a2 = o2 = 0, c2 = s2.length; o2 < c2; o2++)
161
+ if (r3.indexOf(n2 = s2.charAt(o2)) < 0) {
162
+ if ("." == n2) {
163
+ if (a2 < o2) {
164
+ a2 = c2;
165
+ continue;
166
+ }
167
+ } else if (!i2 && (s2 == s2.toUpperCase() && (s2 = s2.toLowerCase()) || s2 == s2.toLowerCase() && (s2 = s2.toUpperCase()))) {
168
+ i2 = true, o2 = -1, a2 = 0;
169
+ continue;
170
+ }
171
+ return g(l2, String(e4), u2, t4);
172
+ }
173
+ u2 = false, -1 < (a2 = (s2 = f(s2, t4, 10, l2.s)).indexOf(".")) ? s2 = s2.replace(".", "") : a2 = s2.length;
174
+ }
175
+ for (o2 = 0; 48 === s2.charCodeAt(o2); o2++)
176
+ ;
177
+ for (c2 = s2.length; 48 === s2.charCodeAt(--c2); )
178
+ ;
179
+ if (s2 = s2.slice(o2, ++c2)) {
180
+ if (c2 -= o2, u2 && A.DEBUG && 15 < c2 && (q < e4 || e4 !== R(e4)))
181
+ throw Error($ + l2.s * e4);
182
+ if ((a2 = a2 - o2 - 1) > O)
183
+ l2.c = l2.e = null;
184
+ else if (a2 < S)
185
+ l2.c = [l2.e = 0];
186
+ else {
187
+ if (l2.e = a2, l2.c = [], o2 = (a2 + 1) % V, a2 < 0 && (o2 += V), o2 < c2) {
188
+ for (o2 && l2.c.push(+s2.slice(0, o2)), c2 -= V; o2 < c2; )
189
+ l2.c.push(+s2.slice(o2, o2 += V));
190
+ o2 = V - (s2 = s2.slice(o2)).length;
191
+ } else
192
+ o2 -= c2;
193
+ for (; o2--; s2 += "0")
194
+ ;
195
+ l2.c.push(+s2);
196
+ }
197
+ } else
198
+ l2.c = [l2.e = 0];
199
+ }
200
+ function D(e4, t4, r3, n2) {
201
+ for (var i2, a2, o2 = [0], u2 = 0, c2 = e4.length; u2 < c2; ) {
202
+ for (a2 = o2.length; a2--; o2[a2] *= t4)
203
+ ;
204
+ for (o2[0] += n2.indexOf(e4.charAt(u2++)), i2 = 0; i2 < o2.length; i2++)
205
+ o2[i2] > r3 - 1 && (null == o2[i2 + 1] && (o2[i2 + 1] = 0), o2[i2 + 1] += o2[i2] / r3 | 0, o2[i2] %= r3);
206
+ }
207
+ return o2.reverse();
208
+ }
209
+ function E(e4, t4, r3) {
210
+ var n2, i2, a2, o2, u2 = 0, c2 = e4.length, s2 = t4 % z, l2 = t4 / z | 0;
211
+ for (e4 = e4.slice(); c2--; )
212
+ u2 = ((i2 = s2 * (a2 = e4[c2] % z) + (n2 = l2 * a2 + (o2 = e4[c2] / z | 0) * s2) % z * z + u2) / r3 | 0) + (n2 / z | 0) + l2 * o2, e4[c2] = i2 % r3;
213
+ return u2 && (e4 = [u2].concat(e4)), e4;
214
+ }
215
+ function F(e4, t4, r3, n2) {
216
+ var i2, a2;
217
+ if (r3 != n2)
218
+ a2 = n2 < r3 ? 1 : -1;
219
+ else
220
+ for (i2 = a2 = 0; i2 < r3; i2++)
221
+ if (e4[i2] != t4[i2]) {
222
+ a2 = e4[i2] > t4[i2] ? 1 : -1;
223
+ break;
224
+ }
225
+ return a2;
226
+ }
227
+ function k(e4, t4, r3, n2) {
228
+ for (var i2 = 0; r3--; )
229
+ e4[r3] -= i2, i2 = e4[r3] < t4[r3] ? 1 : 0, e4[r3] = i2 * n2 + e4[r3] - t4[r3];
230
+ for (; !e4[0] && 1 < e4.length; e4.splice(0, 1))
231
+ ;
232
+ }
233
+ function i(e4, t4, r3, n2) {
234
+ var i2, a2, o2, u2, c2;
235
+ if (null == r3 ? r3 = b : J(r3, 0, 8), !e4.c)
236
+ return e4.toString();
237
+ if (i2 = e4.c[0], o2 = e4.e, null == t4)
238
+ c2 = Y(e4.c), c2 = 1 == n2 || 2 == n2 && (o2 <= d || w <= o2) ? Q(c2, o2) : ee(c2, o2, "0");
239
+ else if (a2 = (e4 = j(new A(e4), t4, r3)).e, u2 = (c2 = Y(e4.c)).length, 1 == n2 || 2 == n2 && (t4 <= a2 || a2 <= d)) {
240
+ for (; u2 < t4; c2 += "0", u2++)
241
+ ;
242
+ c2 = Q(c2, a2);
243
+ } else if (t4 -= o2, c2 = ee(c2, a2, "0"), u2 < a2 + 1) {
244
+ if (0 < --t4)
245
+ for (c2 += "."; t4--; c2 += "0")
246
+ ;
247
+ } else if (0 < (t4 += a2 - u2))
248
+ for (a2 + 1 == u2 && (c2 += "."); t4--; c2 += "0")
249
+ ;
250
+ return e4.s < 0 && i2 ? "-" + c2 : c2;
251
+ }
252
+ function _(e4, t4) {
253
+ for (var r3, n2 = 1, i2 = new A(e4[0]); n2 < e4.length; n2++) {
254
+ if (!(r3 = new A(e4[n2])).s) {
255
+ i2 = r3;
256
+ break;
257
+ }
258
+ t4.call(i2, r3) && (i2 = r3);
259
+ }
260
+ return i2;
261
+ }
262
+ function L(e4, t4, r3) {
263
+ for (var n2 = 1, i2 = t4.length; !t4[--i2]; t4.pop())
264
+ ;
265
+ for (i2 = t4[0]; 10 <= i2; i2 /= 10, n2++)
266
+ ;
267
+ return (r3 = n2 + r3 * V - 1) > O ? e4.c = e4.e = null : r3 < S ? e4.c = [e4.e = 0] : (e4.e = r3, e4.c = t4), e4;
268
+ }
269
+ function j(e4, t4, r3, n2) {
270
+ var i2, a2, o2, u2, c2, s2, l2, f2 = e4.c, g2 = Z;
271
+ if (f2) {
272
+ e: {
273
+ for (i2 = 1, u2 = f2[0]; 10 <= u2; u2 /= 10, i2++)
274
+ ;
275
+ if ((a2 = t4 - i2) < 0)
276
+ a2 += V, o2 = t4, l2 = (c2 = f2[s2 = 0]) / g2[i2 - o2 - 1] % 10 | 0;
277
+ else if ((s2 = U((a2 + 1) / V)) >= f2.length) {
278
+ if (!n2)
279
+ break e;
280
+ for (; f2.length <= s2; f2.push(0))
281
+ ;
282
+ c2 = l2 = 0, o2 = (a2 %= V) - V + (i2 = 1);
283
+ } else {
284
+ for (c2 = u2 = f2[s2], i2 = 1; 10 <= u2; u2 /= 10, i2++)
285
+ ;
286
+ l2 = (o2 = (a2 %= V) - V + i2) < 0 ? 0 : c2 / g2[i2 - o2 - 1] % 10 | 0;
287
+ }
288
+ if (n2 = n2 || t4 < 0 || null != f2[s2 + 1] || (o2 < 0 ? c2 : c2 % g2[i2 - o2 - 1]), n2 = r3 < 4 ? (l2 || n2) && (0 == r3 || r3 == (e4.s < 0 ? 3 : 2)) : 5 < l2 || 5 == l2 && (4 == r3 || n2 || 6 == r3 && (0 < a2 ? 0 < o2 ? c2 / g2[i2 - o2] : 0 : f2[s2 - 1]) % 10 & 1 || r3 == (e4.s < 0 ? 8 : 7)), t4 < 1 || !f2[0])
289
+ return f2.length = 0, n2 ? (t4 -= e4.e + 1, f2[0] = g2[(V - t4 % V) % V], e4.e = -t4 || 0) : f2[0] = e4.e = 0, e4;
290
+ if (0 == a2 ? (f2.length = s2, u2 = 1, s2--) : (f2.length = s2 + 1, u2 = g2[V - a2], f2[s2] = 0 < o2 ? R(c2 / g2[i2 - o2] % g2[o2]) * u2 : 0), n2)
291
+ for (; ; ) {
292
+ if (0 == s2) {
293
+ for (a2 = 1, o2 = f2[0]; 10 <= o2; o2 /= 10, a2++)
294
+ ;
295
+ for (o2 = f2[0] += u2, u2 = 1; 10 <= o2; o2 /= 10, u2++)
296
+ ;
297
+ a2 != u2 && (e4.e++, f2[0] == G && (f2[0] = 1));
298
+ break;
299
+ }
300
+ if (f2[s2] += u2, f2[s2] != G)
301
+ break;
302
+ f2[s2--] = 0, u2 = 1;
303
+ }
304
+ for (a2 = f2.length; 0 === f2[--a2]; f2.pop())
305
+ ;
306
+ }
307
+ e4.e > O ? e4.c = e4.e = null : e4.e < S && (e4.c = [e4.e = 0]);
308
+ }
309
+ return e4;
310
+ }
311
+ function P(e4) {
312
+ var t4, r3 = e4.e;
313
+ return null === r3 ? e4.toString() : (t4 = Y(e4.c), t4 = r3 <= d || w <= r3 ? Q(t4, r3) : ee(t4, r3, "0"), e4.s < 0 ? "-" + t4 : t4);
314
+ }
315
+ return A.clone = e3, A.ROUND_UP = 0, A.ROUND_DOWN = 1, A.ROUND_CEIL = 2, A.ROUND_FLOOR = 3, A.ROUND_HALF_UP = 4, A.ROUND_HALF_DOWN = 5, A.ROUND_HALF_EVEN = 6, A.ROUND_HALF_CEIL = 7, A.ROUND_HALF_FLOOR = 8, A.EUCLID = 9, A.config = A.set = function(e4) {
316
+ var t4, r3;
317
+ if (null != e4) {
318
+ if ("object" != typeof e4)
319
+ throw Error(I + "Object expected: " + e4);
320
+ if (e4.hasOwnProperty(t4 = "DECIMAL_PLACES") && (J(r3 = e4[t4], 0, W, t4), y = r3), e4.hasOwnProperty(t4 = "ROUNDING_MODE") && (J(r3 = e4[t4], 0, 8, t4), b = r3), e4.hasOwnProperty(t4 = "EXPONENTIAL_AT") && ((r3 = e4[t4]) && r3.pop ? (J(r3[0], -W, 0, t4), J(r3[1], 0, W, t4), d = r3[0], w = r3[1]) : (J(r3, -W, W, t4), d = -(w = r3 < 0 ? -r3 : r3))), e4.hasOwnProperty(t4 = "RANGE"))
321
+ if ((r3 = e4[t4]) && r3.pop)
322
+ J(r3[0], -W, -1, t4), J(r3[1], 1, W, t4), S = r3[0], O = r3[1];
323
+ else {
324
+ if (J(r3, -W, W, t4), !r3)
325
+ throw Error(I + t4 + " cannot be zero: " + r3);
326
+ S = -(O = r3 < 0 ? -r3 : r3);
327
+ }
328
+ if (e4.hasOwnProperty(t4 = "CRYPTO")) {
329
+ if ((r3 = e4[t4]) !== !!r3)
330
+ throw Error(I + t4 + " not true or false: " + r3);
331
+ if (r3) {
332
+ if ("undefined" == typeof crypto || !crypto || !crypto.getRandomValues && !crypto.randomBytes)
333
+ throw x = !r3, Error(I + "crypto unavailable");
334
+ x = r3;
335
+ } else
336
+ x = r3;
337
+ }
338
+ if (e4.hasOwnProperty(t4 = "MODULO_MODE") && (J(r3 = e4[t4], 0, 9, t4), a = r3), e4.hasOwnProperty(t4 = "POW_PRECISION") && (J(r3 = e4[t4], 0, W, t4), N = r3), e4.hasOwnProperty(t4 = "FORMAT")) {
339
+ if ("object" != typeof (r3 = e4[t4]))
340
+ throw Error(I + t4 + " not an object: " + r3);
341
+ B = r3;
342
+ }
343
+ if (e4.hasOwnProperty(t4 = "ALPHABET")) {
344
+ if ("string" != typeof (r3 = e4[t4]) || /^.$|[+-.\s]|(.).*\1/.test(r3))
345
+ throw Error(I + t4 + " invalid: " + r3);
346
+ M = r3;
347
+ }
348
+ }
349
+ return { DECIMAL_PLACES: y, ROUNDING_MODE: b, EXPONENTIAL_AT: [d, w], RANGE: [S, O], CRYPTO: x, MODULO_MODE: a, POW_PRECISION: N, FORMAT: B, ALPHABET: M };
350
+ }, A.isBigNumber = function(e4) {
351
+ if (!e4 || true !== e4._isBigNumber)
352
+ return false;
353
+ if (!A.DEBUG)
354
+ return true;
355
+ var t4, r3, n2 = e4.c, i2 = e4.e, a2 = e4.s;
356
+ e:
357
+ if ("[object Array]" == {}.toString.call(n2)) {
358
+ if ((1 === a2 || -1 === a2) && -W <= i2 && i2 <= W && i2 === R(i2)) {
359
+ if (0 === n2[0]) {
360
+ if (0 === i2 && 1 === n2.length)
361
+ return true;
362
+ break e;
363
+ }
364
+ if ((t4 = (i2 + 1) % V) < 1 && (t4 += V), String(n2[0]).length == t4) {
365
+ for (t4 = 0; t4 < n2.length; t4++)
366
+ if ((r3 = n2[t4]) < 0 || G <= r3 || r3 !== R(r3))
367
+ break e;
368
+ if (0 !== r3)
369
+ return true;
370
+ }
371
+ }
372
+ } else if (null === n2 && null === i2 && (null === a2 || 1 === a2 || -1 === a2))
373
+ return true;
374
+ throw Error(I + "Invalid BigNumber: " + e4);
375
+ }, A.maximum = A.max = function() {
376
+ return _(arguments, n.lt);
377
+ }, A.minimum = A.min = function() {
378
+ return _(arguments, n.gt);
379
+ }, A.random = (r2 = 9007199254740992, s = Math.random() * r2 & 2097151 ? function() {
380
+ return R(Math.random() * r2);
381
+ } : function() {
382
+ return 8388608 * (1073741824 * Math.random() | 0) + (8388608 * Math.random() | 0);
383
+ }, function(e4) {
384
+ var t4, r3, n2, i2, a2, o2 = 0, u2 = [], c2 = new A(h);
385
+ if (null == e4 ? e4 = y : J(e4, 0, W), i2 = U(e4 / V), x)
386
+ if (crypto.getRandomValues) {
387
+ for (t4 = crypto.getRandomValues(new Uint32Array(i2 *= 2)); o2 < i2; )
388
+ 9e15 <= (a2 = 131072 * t4[o2] + (t4[o2 + 1] >>> 11)) ? (r3 = crypto.getRandomValues(new Uint32Array(2)), t4[o2] = r3[0], t4[o2 + 1] = r3[1]) : (u2.push(a2 % 1e14), o2 += 2);
389
+ o2 = i2 / 2;
390
+ } else {
391
+ if (!crypto.randomBytes)
392
+ throw x = false, Error(I + "crypto unavailable");
393
+ for (t4 = crypto.randomBytes(i2 *= 7); o2 < i2; )
394
+ 9e15 <= (a2 = 281474976710656 * (31 & t4[o2]) + 1099511627776 * t4[o2 + 1] + 4294967296 * t4[o2 + 2] + 16777216 * t4[o2 + 3] + (t4[o2 + 4] << 16) + (t4[o2 + 5] << 8) + t4[o2 + 6]) ? crypto.randomBytes(7).copy(t4, o2) : (u2.push(a2 % 1e14), o2 += 7);
395
+ o2 = i2 / 7;
396
+ }
397
+ if (!x)
398
+ for (; o2 < i2; )
399
+ (a2 = s()) < 9e15 && (u2[o2++] = a2 % 1e14);
400
+ for (i2 = u2[--o2], e4 %= V, i2 && e4 && (a2 = Z[V - e4], u2[o2] = R(i2 / a2) * a2); 0 === u2[o2]; u2.pop(), o2--)
401
+ ;
402
+ if (o2 < 0)
403
+ u2 = [n2 = 0];
404
+ else {
405
+ for (n2 = -1; 0 === u2[0]; u2.splice(0, 1), n2 -= V)
406
+ ;
407
+ for (o2 = 1, a2 = u2[0]; 10 <= a2; a2 /= 10, o2++)
408
+ ;
409
+ o2 < V && (n2 -= V - o2);
410
+ }
411
+ return c2.e = n2, c2.c = u2, c2;
412
+ }), A.sum = function() {
413
+ for (var e4 = 1, t4 = arguments, r3 = new A(t4[0]); e4 < t4.length; )
414
+ r3 = r3.plus(t4[e4++]);
415
+ return r3;
416
+ }, m = "0123456789", f = function(e4, t4, r3, n2, i2) {
417
+ var a2, o2, u2, c2, s2, l2, f2, g2, p2 = e4.indexOf("."), d2 = y, h2 = b;
418
+ for (0 <= p2 && (c2 = N, N = 0, e4 = e4.replace(".", ""), l2 = (g2 = new A(t4)).pow(e4.length - p2), N = c2, g2.c = D(ee(Y(l2.c), l2.e, "0"), 10, r3, m), g2.e = g2.c.length), u2 = c2 = (f2 = D(e4, t4, r3, i2 ? (a2 = M, m) : (a2 = m, M))).length; 0 == f2[--c2]; f2.pop())
419
+ ;
420
+ if (!f2[0])
421
+ return a2.charAt(0);
422
+ if (p2 < 0 ? --u2 : (l2.c = f2, l2.e = u2, l2.s = n2, f2 = (l2 = v(l2, g2, d2, h2, r3)).c, s2 = l2.r, u2 = l2.e), p2 = f2[o2 = u2 + d2 + 1], c2 = r3 / 2, s2 = s2 || o2 < 0 || null != f2[o2 + 1], s2 = h2 < 4 ? (null != p2 || s2) && (0 == h2 || h2 == (l2.s < 0 ? 3 : 2)) : c2 < p2 || p2 == c2 && (4 == h2 || s2 || 6 == h2 && 1 & f2[o2 - 1] || h2 == (l2.s < 0 ? 8 : 7)), o2 < 1 || !f2[0])
423
+ e4 = s2 ? ee(a2.charAt(1), -d2, a2.charAt(0)) : a2.charAt(0);
424
+ else {
425
+ if (f2.length = o2, s2)
426
+ for (--r3; ++f2[--o2] > r3; )
427
+ f2[o2] = 0, o2 || (++u2, f2 = [1].concat(f2));
428
+ for (c2 = f2.length; !f2[--c2]; )
429
+ ;
430
+ for (p2 = 0, e4 = ""; p2 <= c2; e4 += a2.charAt(f2[p2++]))
431
+ ;
432
+ e4 = ee(e4, u2, a2.charAt(0));
433
+ }
434
+ return e4;
435
+ }, v = function(e4, t4, r3, n2, i2) {
436
+ var a2, o2, u2, c2, s2, l2, f2, g2, p2, d2, h2, v2, m2, y2, b2, w2, S2, O2 = e4.s == t4.s ? 1 : -1, x2 = e4.c, N2 = t4.c;
437
+ if (!(x2 && x2[0] && N2 && N2[0]))
438
+ return new A(e4.s && t4.s && (x2 ? !N2 || x2[0] != N2[0] : N2) ? x2 && 0 == x2[0] || !N2 ? 0 * O2 : O2 / 0 : NaN);
439
+ for (p2 = (g2 = new A(O2)).c = [], O2 = r3 + (o2 = e4.e - t4.e) + 1, i2 || (i2 = G, o2 = H(e4.e / V) - H(t4.e / V), O2 = O2 / V | 0), u2 = 0; N2[u2] == (x2[u2] || 0); u2++)
440
+ ;
441
+ if (N2[u2] > (x2[u2] || 0) && o2--, O2 < 0)
442
+ p2.push(1), c2 = true;
443
+ else {
444
+ for (y2 = x2.length, w2 = N2.length, O2 += 2, 1 < (s2 = R(i2 / (N2[u2 = 0] + 1))) && (N2 = E(N2, s2, i2), x2 = E(x2, s2, i2), w2 = N2.length, y2 = x2.length), m2 = w2, h2 = (d2 = x2.slice(0, w2)).length; h2 < w2; d2[h2++] = 0)
445
+ ;
446
+ S2 = N2.slice(), S2 = [0].concat(S2), b2 = N2[0], N2[1] >= i2 / 2 && b2++;
447
+ do {
448
+ if (s2 = 0, (a2 = F(N2, d2, w2, h2)) < 0) {
449
+ if (v2 = d2[0], w2 != h2 && (v2 = v2 * i2 + (d2[1] || 0)), 1 < (s2 = R(v2 / b2)))
450
+ for (i2 <= s2 && (s2 = i2 - 1), f2 = (l2 = E(N2, s2, i2)).length, h2 = d2.length; 1 == F(l2, d2, f2, h2); )
451
+ s2--, k(l2, w2 < f2 ? S2 : N2, f2, i2), f2 = l2.length, a2 = 1;
452
+ else
453
+ 0 == s2 && (a2 = s2 = 1), f2 = (l2 = N2.slice()).length;
454
+ if (f2 < h2 && (l2 = [0].concat(l2)), k(d2, l2, h2, i2), h2 = d2.length, -1 == a2)
455
+ for (; F(N2, d2, w2, h2) < 1; )
456
+ s2++, k(d2, w2 < h2 ? S2 : N2, h2, i2), h2 = d2.length;
457
+ } else
458
+ 0 === a2 && (s2++, d2 = [0]);
459
+ p2[u2++] = s2, d2[0] ? d2[h2++] = x2[m2] || 0 : (d2 = [x2[m2]], h2 = 1);
460
+ } while ((m2++ < y2 || null != d2[0]) && O2--);
461
+ c2 = null != d2[0], p2[0] || p2.splice(0, 1);
462
+ }
463
+ if (i2 == G) {
464
+ for (u2 = 1, O2 = p2[0]; 10 <= O2; O2 /= 10, u2++)
465
+ ;
466
+ j(g2, r3 + (g2.e = u2 + o2 * V - 1) + 1, n2, c2);
467
+ } else
468
+ g2.e = o2, g2.r = +c2;
469
+ return g2;
470
+ }, o = /^(-?)0([xbo])(?=\w[\w.]*$)/i, u = /^([^.]+)\.$/, c = /^\.([^.]+)$/, l = /^-?(Infinity|NaN)$/, p = /^\s*\+(?=[\w.])|^\s+|\s+$/g, g = function(e4, t4, r3, n2) {
471
+ var i2, a2 = r3 ? t4 : t4.replace(p, "");
472
+ if (l.test(a2))
473
+ e4.s = isNaN(a2) ? null : a2 < 0 ? -1 : 1;
474
+ else {
475
+ if (!r3 && (a2 = a2.replace(o, function(e5, t5, r4) {
476
+ return i2 = "x" == (r4 = r4.toLowerCase()) ? 16 : "b" == r4 ? 2 : 8, n2 && n2 != i2 ? e5 : t5;
477
+ }), n2 && (i2 = n2, a2 = a2.replace(u, "$1").replace(c, "0.$1")), t4 != a2))
478
+ return new A(a2, i2);
479
+ if (A.DEBUG)
480
+ throw Error(I + "Not a" + (n2 ? " base " + n2 : "") + " number: " + t4);
481
+ e4.s = null;
482
+ }
483
+ e4.c = e4.e = null;
484
+ }, n.absoluteValue = n.abs = function() {
485
+ var e4 = new A(this);
486
+ return e4.s < 0 && (e4.s = 1), e4;
487
+ }, n.comparedTo = function(e4, t4) {
488
+ return K(this, new A(e4, t4));
489
+ }, n.decimalPlaces = n.dp = function(e4, t4) {
490
+ var r3, n2, i2;
491
+ if (null != e4)
492
+ return J(e4, 0, W), null == t4 ? t4 = b : J(t4, 0, 8), j(new A(this), e4 + this.e + 1, t4);
493
+ if (!(r3 = this.c))
494
+ return null;
495
+ if (n2 = ((i2 = r3.length - 1) - H(this.e / V)) * V, i2 = r3[i2])
496
+ for (; i2 % 10 == 0; i2 /= 10, n2--)
497
+ ;
498
+ return n2 < 0 && (n2 = 0), n2;
499
+ }, n.dividedBy = n.div = function(e4, t4) {
500
+ return v(this, new A(e4, t4), y, b);
501
+ }, n.dividedToIntegerBy = n.idiv = function(e4, t4) {
502
+ return v(this, new A(e4, t4), 0, 1);
503
+ }, n.exponentiatedBy = n.pow = function(e4, t4) {
504
+ var r3, n2, i2, a2, o2, u2, c2, s2, l2 = this;
505
+ if ((e4 = new A(e4)).c && !e4.isInteger())
506
+ throw Error(I + "Exponent not an integer: " + P(e4));
507
+ if (null != t4 && (t4 = new A(t4)), o2 = 14 < e4.e, !l2.c || !l2.c[0] || 1 == l2.c[0] && !l2.e && 1 == l2.c.length || !e4.c || !e4.c[0])
508
+ return s2 = new A(Math.pow(+P(l2), o2 ? 2 - X(e4) : +P(e4))), t4 ? s2.mod(t4) : s2;
509
+ if (u2 = e4.s < 0, t4) {
510
+ if (t4.c ? !t4.c[0] : !t4.s)
511
+ return new A(NaN);
512
+ (n2 = !u2 && l2.isInteger() && t4.isInteger()) && (l2 = l2.mod(t4));
513
+ } else {
514
+ if (9 < e4.e && (0 < l2.e || l2.e < -1 || (0 == l2.e ? 1 < l2.c[0] || o2 && 24e7 <= l2.c[1] : l2.c[0] < 8e13 || o2 && l2.c[0] <= 9999975e7)))
515
+ return a2 = l2.s < 0 && X(e4) ? -0 : 0, -1 < l2.e && (a2 = 1 / a2), new A(u2 ? 1 / a2 : a2);
516
+ N && (a2 = U(N / V + 2));
517
+ }
518
+ for (c2 = o2 ? (r3 = new A(0.5), u2 && (e4.s = 1), X(e4)) : (i2 = Math.abs(+P(e4))) % 2, s2 = new A(h); ; ) {
519
+ if (c2) {
520
+ if (!(s2 = s2.times(l2)).c)
521
+ break;
522
+ a2 ? s2.c.length > a2 && (s2.c.length = a2) : n2 && (s2 = s2.mod(t4));
523
+ }
524
+ if (i2) {
525
+ if (0 === (i2 = R(i2 / 2)))
526
+ break;
527
+ c2 = i2 % 2;
528
+ } else if (j(e4 = e4.times(r3), e4.e + 1, 1), 14 < e4.e)
529
+ c2 = X(e4);
530
+ else {
531
+ if (0 == (i2 = +P(e4)))
532
+ break;
533
+ c2 = i2 % 2;
534
+ }
535
+ l2 = l2.times(l2), a2 ? l2.c && l2.c.length > a2 && (l2.c.length = a2) : n2 && (l2 = l2.mod(t4));
536
+ }
537
+ return n2 ? s2 : (u2 && (s2 = h.div(s2)), t4 ? s2.mod(t4) : a2 ? j(s2, N, b, void 0) : s2);
538
+ }, n.integerValue = function(e4) {
539
+ var t4 = new A(this);
540
+ return null == e4 ? e4 = b : J(e4, 0, 8), j(t4, t4.e + 1, e4);
541
+ }, n.isEqualTo = n.eq = function(e4, t4) {
542
+ return 0 === K(this, new A(e4, t4));
543
+ }, n.isFinite = function() {
544
+ return !!this.c;
545
+ }, n.isGreaterThan = n.gt = function(e4, t4) {
546
+ return 0 < K(this, new A(e4, t4));
547
+ }, n.isGreaterThanOrEqualTo = n.gte = function(e4, t4) {
548
+ return 1 === (t4 = K(this, new A(e4, t4))) || 0 === t4;
549
+ }, n.isInteger = function() {
550
+ return !!this.c && H(this.e / V) > this.c.length - 2;
551
+ }, n.isLessThan = n.lt = function(e4, t4) {
552
+ return K(this, new A(e4, t4)) < 0;
553
+ }, n.isLessThanOrEqualTo = n.lte = function(e4, t4) {
554
+ return -1 === (t4 = K(this, new A(e4, t4))) || 0 === t4;
555
+ }, n.isNaN = function() {
556
+ return !this.s;
557
+ }, n.isNegative = function() {
558
+ return this.s < 0;
559
+ }, n.isPositive = function() {
560
+ return 0 < this.s;
561
+ }, n.isZero = function() {
562
+ return !!this.c && 0 == this.c[0];
563
+ }, n.minus = function(e4, t4) {
564
+ var r3, n2, i2, a2, o2 = this, u2 = o2.s;
565
+ if (t4 = (e4 = new A(e4, t4)).s, !u2 || !t4)
566
+ return new A(NaN);
567
+ if (u2 != t4)
568
+ return e4.s = -t4, o2.plus(e4);
569
+ var c2 = o2.e / V, s2 = e4.e / V, l2 = o2.c, f2 = e4.c;
570
+ if (!c2 || !s2) {
571
+ if (!l2 || !f2)
572
+ return l2 ? (e4.s = -t4, e4) : new A(f2 ? o2 : NaN);
573
+ if (!l2[0] || !f2[0])
574
+ return f2[0] ? (e4.s = -t4, e4) : new A(l2[0] ? o2 : 3 == b ? -0 : 0);
575
+ }
576
+ if (c2 = H(c2), s2 = H(s2), l2 = l2.slice(), u2 = c2 - s2) {
577
+ for ((i2 = (a2 = u2 < 0) ? (u2 = -u2, l2) : (s2 = c2, f2)).reverse(), t4 = u2; t4--; i2.push(0))
578
+ ;
579
+ i2.reverse();
580
+ } else
581
+ for (n2 = (a2 = (u2 = l2.length) < (t4 = f2.length)) ? u2 : t4, u2 = t4 = 0; t4 < n2; t4++)
582
+ if (l2[t4] != f2[t4]) {
583
+ a2 = l2[t4] < f2[t4];
584
+ break;
585
+ }
586
+ if (a2 && (i2 = l2, l2 = f2, f2 = i2, e4.s = -e4.s), 0 < (t4 = (n2 = f2.length) - (r3 = l2.length)))
587
+ for (; t4--; l2[r3++] = 0)
588
+ ;
589
+ for (t4 = G - 1; u2 < n2; ) {
590
+ if (l2[--n2] < f2[n2]) {
591
+ for (r3 = n2; r3 && !l2[--r3]; l2[r3] = t4)
592
+ ;
593
+ --l2[r3], l2[n2] += G;
594
+ }
595
+ l2[n2] -= f2[n2];
596
+ }
597
+ for (; 0 == l2[0]; l2.splice(0, 1), --s2)
598
+ ;
599
+ return l2[0] ? L(e4, l2, s2) : (e4.s = 3 == b ? -1 : 1, e4.c = [e4.e = 0], e4);
600
+ }, n.modulo = n.mod = function(e4, t4) {
601
+ var r3, n2, i2 = this;
602
+ return e4 = new A(e4, t4), !i2.c || !e4.s || e4.c && !e4.c[0] ? new A(NaN) : !e4.c || i2.c && !i2.c[0] ? new A(i2) : (9 == a ? (n2 = e4.s, e4.s = 1, r3 = v(i2, e4, 0, 3), e4.s = n2, r3.s *= n2) : r3 = v(i2, e4, 0, a), (e4 = i2.minus(r3.times(e4))).c[0] || 1 != a || (e4.s = i2.s), e4);
603
+ }, n.multipliedBy = n.times = function(e4, t4) {
604
+ var r3, n2, i2, a2, o2, u2, c2, s2, l2, f2, g2, p2, d2, h2, v2, m2 = this, y2 = m2.c, b2 = (e4 = new A(e4, t4)).c;
605
+ if (!(y2 && b2 && y2[0] && b2[0]))
606
+ return !m2.s || !e4.s || y2 && !y2[0] && !b2 || b2 && !b2[0] && !y2 ? e4.c = e4.e = e4.s = null : (e4.s *= m2.s, y2 && b2 ? (e4.c = [0], e4.e = 0) : e4.c = e4.e = null), e4;
607
+ for (n2 = H(m2.e / V) + H(e4.e / V), e4.s *= m2.s, (c2 = y2.length) < (f2 = b2.length) && (d2 = y2, y2 = b2, b2 = d2, i2 = c2, c2 = f2, f2 = i2), i2 = c2 + f2, d2 = []; i2--; d2.push(0))
608
+ ;
609
+ for (h2 = G, v2 = z, i2 = f2; 0 <= --i2; ) {
610
+ for (r3 = 0, g2 = b2[i2] % v2, p2 = b2[i2] / v2 | 0, a2 = i2 + (o2 = c2); i2 < a2; )
611
+ r3 = ((s2 = g2 * (s2 = y2[--o2] % v2) + (u2 = p2 * s2 + (l2 = y2[o2] / v2 | 0) * g2) % v2 * v2 + d2[a2] + r3) / h2 | 0) + (u2 / v2 | 0) + p2 * l2, d2[a2--] = s2 % h2;
612
+ d2[a2] = r3;
613
+ }
614
+ return r3 ? ++n2 : d2.splice(0, 1), L(e4, d2, n2);
615
+ }, n.negated = function() {
616
+ var e4 = new A(this);
617
+ return e4.s = -e4.s || null, e4;
618
+ }, n.plus = function(e4, t4) {
619
+ var r3, n2 = this, i2 = n2.s;
620
+ if (t4 = (e4 = new A(e4, t4)).s, !i2 || !t4)
621
+ return new A(NaN);
622
+ if (i2 != t4)
623
+ return e4.s = -t4, n2.minus(e4);
624
+ var a2 = n2.e / V, o2 = e4.e / V, u2 = n2.c, c2 = e4.c;
625
+ if (!a2 || !o2) {
626
+ if (!u2 || !c2)
627
+ return new A(i2 / 0);
628
+ if (!u2[0] || !c2[0])
629
+ return c2[0] ? e4 : new A(u2[0] ? n2 : 0 * i2);
630
+ }
631
+ if (a2 = H(a2), o2 = H(o2), u2 = u2.slice(), i2 = a2 - o2) {
632
+ for ((r3 = 0 < i2 ? (o2 = a2, c2) : (i2 = -i2, u2)).reverse(); i2--; r3.push(0))
633
+ ;
634
+ r3.reverse();
635
+ }
636
+ for ((i2 = u2.length) - (t4 = c2.length) < 0 && (r3 = c2, c2 = u2, u2 = r3, t4 = i2), i2 = 0; t4; )
637
+ i2 = (u2[--t4] = u2[t4] + c2[t4] + i2) / G | 0, u2[t4] = G === u2[t4] ? 0 : u2[t4] % G;
638
+ return i2 && (u2 = [i2].concat(u2), ++o2), L(e4, u2, o2);
639
+ }, n.precision = n.sd = function(e4, t4) {
640
+ var r3, n2, i2;
641
+ if (null != e4 && e4 !== !!e4)
642
+ return J(e4, 1, W), null == t4 ? t4 = b : J(t4, 0, 8), j(new A(this), e4, t4);
643
+ if (!(r3 = this.c))
644
+ return null;
645
+ if (n2 = (i2 = r3.length - 1) * V + 1, i2 = r3[i2]) {
646
+ for (; i2 % 10 == 0; i2 /= 10, n2--)
647
+ ;
648
+ for (i2 = r3[0]; 10 <= i2; i2 /= 10, n2++)
649
+ ;
650
+ }
651
+ return e4 && this.e + 1 > n2 && (n2 = this.e + 1), n2;
652
+ }, n.shiftedBy = function(e4) {
653
+ return J(e4, -q, q), this.times("1e" + e4);
654
+ }, n.squareRoot = n.sqrt = function() {
655
+ var e4, t4, r3, n2, i2, a2 = this, o2 = a2.c, u2 = a2.s, c2 = a2.e, s2 = y + 4, l2 = new A("0.5");
656
+ if (1 !== u2 || !o2 || !o2[0])
657
+ return new A(!u2 || u2 < 0 && (!o2 || o2[0]) ? NaN : o2 ? a2 : 1 / 0);
658
+ if ((r3 = 0 == (u2 = Math.sqrt(+P(a2))) || u2 == 1 / 0 ? (((t4 = Y(o2)).length + c2) % 2 == 0 && (t4 += "0"), u2 = Math.sqrt(+t4), c2 = H((c2 + 1) / 2) - (c2 < 0 || c2 % 2), new A(t4 = u2 == 1 / 0 ? "1e" + c2 : (t4 = u2.toExponential()).slice(0, t4.indexOf("e") + 1) + c2)) : new A(u2 + "")).c[0]) {
659
+ for ((u2 = (c2 = r3.e) + s2) < 3 && (u2 = 0); ; )
660
+ if (i2 = r3, r3 = l2.times(i2.plus(v(a2, i2, s2, 1))), Y(i2.c).slice(0, u2) === (t4 = Y(r3.c)).slice(0, u2)) {
661
+ if (r3.e < c2 && --u2, "9999" != (t4 = t4.slice(u2 - 3, u2 + 1)) && (n2 || "4999" != t4)) {
662
+ +t4 && (+t4.slice(1) || "5" != t4.charAt(0)) || (j(r3, r3.e + y + 2, 1), e4 = !r3.times(r3).eq(a2));
663
+ break;
664
+ }
665
+ if (!n2 && (j(i2, i2.e + y + 2, 0), i2.times(i2).eq(a2))) {
666
+ r3 = i2;
667
+ break;
668
+ }
669
+ s2 += 4, u2 += 4, n2 = 1;
670
+ }
671
+ }
672
+ return j(r3, r3.e + y + 1, b, e4);
673
+ }, n.toExponential = function(e4, t4) {
674
+ return null != e4 && (J(e4, 0, W), e4++), i(this, e4, t4, 1);
675
+ }, n.toFixed = function(e4, t4) {
676
+ return null != e4 && (J(e4, 0, W), e4 = e4 + this.e + 1), i(this, e4, t4);
677
+ }, n.toFormat = function(e4, t4, r3) {
678
+ var n2;
679
+ if (null == r3)
680
+ null != e4 && t4 && "object" == typeof t4 ? (r3 = t4, t4 = null) : e4 && "object" == typeof e4 ? (r3 = e4, e4 = t4 = null) : r3 = B;
681
+ else if ("object" != typeof r3)
682
+ throw Error(I + "Argument not an object: " + r3);
683
+ if (n2 = this.toFixed(e4, t4), this.c) {
684
+ var i2, a2 = n2.split("."), o2 = +r3.groupSize, u2 = +r3.secondaryGroupSize, c2 = r3.groupSeparator || "", s2 = a2[0], l2 = a2[1], f2 = this.s < 0, g2 = f2 ? s2.slice(1) : s2, p2 = g2.length;
685
+ if (u2 && (i2 = o2, o2 = u2, p2 -= u2 = i2), 0 < o2 && 0 < p2) {
686
+ for (i2 = p2 % o2 || o2, s2 = g2.substr(0, i2); i2 < p2; i2 += o2)
687
+ s2 += c2 + g2.substr(i2, o2);
688
+ 0 < u2 && (s2 += c2 + g2.slice(i2)), f2 && (s2 = "-" + s2);
689
+ }
690
+ n2 = l2 ? s2 + (r3.decimalSeparator || "") + ((u2 = +r3.fractionGroupSize) ? l2.replace(new RegExp("\\d{" + u2 + "}\\B", "g"), "$&" + (r3.fractionGroupSeparator || "")) : l2) : s2;
691
+ }
692
+ return (r3.prefix || "") + n2 + (r3.suffix || "");
693
+ }, n.toFraction = function(e4) {
694
+ var t4, r3, n2, i2, a2, o2, u2, c2, s2, l2, f2, g2, p2 = this, d2 = p2.c;
695
+ if (null != e4 && (!(u2 = new A(e4)).isInteger() && (u2.c || 1 !== u2.s) || u2.lt(h)))
696
+ throw Error(I + "Argument " + (u2.isInteger() ? "out of range: " : "not an integer: ") + P(u2));
697
+ if (!d2)
698
+ return new A(p2);
699
+ for (t4 = new A(h), s2 = r3 = new A(h), n2 = c2 = new A(h), g2 = Y(d2), a2 = t4.e = g2.length - p2.e - 1, t4.c[0] = Z[(o2 = a2 % V) < 0 ? V + o2 : o2], e4 = !e4 || 0 < u2.comparedTo(t4) ? 0 < a2 ? t4 : s2 : u2, o2 = O, O = 1 / 0, u2 = new A(g2), c2.c[0] = 0; l2 = v(u2, t4, 0, 1), 1 != (i2 = r3.plus(l2.times(n2))).comparedTo(e4); )
700
+ r3 = n2, n2 = i2, s2 = c2.plus(l2.times(i2 = s2)), c2 = i2, t4 = u2.minus(l2.times(i2 = t4)), u2 = i2;
701
+ return i2 = v(e4.minus(r3), n2, 0, 1), c2 = c2.plus(i2.times(s2)), r3 = r3.plus(i2.times(n2)), c2.s = s2.s = p2.s, f2 = v(s2, n2, a2 *= 2, b).minus(p2).abs().comparedTo(v(c2, r3, a2, b).minus(p2).abs()) < 1 ? [s2, n2] : [c2, r3], O = o2, f2;
702
+ }, n.toNumber = function() {
703
+ return +P(this);
704
+ }, n.toPrecision = function(e4, t4) {
705
+ return null != e4 && J(e4, 1, W), i(this, e4, t4, 2);
706
+ }, n.toString = function(e4) {
707
+ var t4, r3 = this, n2 = r3.s, i2 = r3.e;
708
+ return null === i2 ? n2 ? (t4 = "Infinity", n2 < 0 && (t4 = "-" + t4)) : t4 = "NaN" : (t4 = null == e4 ? i2 <= d || w <= i2 ? Q(Y(r3.c), i2) : ee(Y(r3.c), i2, "0") : 10 === e4 ? ee(Y((r3 = j(new A(r3), y + i2 + 1, b)).c), r3.e, "0") : (J(e4, 2, M.length, "Base"), f(ee(Y(r3.c), i2, "0"), 10, e4, n2, true)), n2 < 0 && r3.c[0] && (t4 = "-" + t4)), t4;
709
+ }, n.valueOf = n.toJSON = function() {
710
+ return P(this);
711
+ }, n._isBigNumber = true, C && (n[Symbol.toStringTag] = "BigNumber", n[Symbol.for("nodejs.util.inspect.custom")] = n.valueOf), null != t3 && A.set(t3), A;
712
+ }()).default = t2.BigNumber = t2, void 0 !== r && r.exports ? r.exports = t2 : (e2 = e2 || ("undefined" != typeof self && self ? self : window)).BigNumber = t2;
713
+ }(this);
714
+ }, {}], 2: [function(e, t, r) {
715
+ "use strict";
716
+ t.exports = { languageTag: "en-US", delimiters: { thousands: ",", decimal: "." }, abbreviations: { thousand: "k", million: "m", billion: "b", trillion: "t" }, spaceSeparated: false, ordinal: function(e2) {
717
+ var t2 = e2 % 10;
718
+ return 1 == ~~(e2 % 100 / 10) ? "th" : 1 == t2 ? "st" : 2 == t2 ? "nd" : 3 == t2 ? "rd" : "th";
719
+ }, bytes: { binarySuffixes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"], decimalSuffixes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] }, currency: { symbol: "$", position: "prefix", code: "USD" }, currencyFormat: { thousandSeparated: true, totalLength: 4, spaceSeparated: true, spaceSeparatedCurrency: true }, formats: { fourDigits: { totalLength: 4, spaceSeparated: true }, fullWithTwoDecimals: { output: "currency", thousandSeparated: true, mantissa: 2 }, fullWithTwoDecimalsNoCurrency: { thousandSeparated: true, mantissa: 2 }, fullWithNoDecimals: { output: "currency", thousandSeparated: true, mantissa: 0 } } };
720
+ }, {}], 3: [function(e, t, r) {
721
+ "use strict";
722
+ function I(e2, t2) {
723
+ return function(e3) {
724
+ if (Array.isArray(e3))
725
+ return e3;
726
+ }(e2) || function(e3, t3) {
727
+ if (!(Symbol.iterator in Object(e3) || "[object Arguments]" === Object.prototype.toString.call(e3)))
728
+ return;
729
+ var r2 = [], n2 = true, i2 = false, a2 = void 0;
730
+ try {
731
+ for (var o2, u2 = e3[Symbol.iterator](); !(n2 = (o2 = u2.next()).done) && (r2.push(o2.value), !t3 || r2.length !== t3); n2 = true)
732
+ ;
733
+ } catch (e4) {
734
+ i2 = true, a2 = e4;
735
+ } finally {
736
+ try {
737
+ n2 || null == u2.return || u2.return();
738
+ } finally {
739
+ if (i2)
740
+ throw a2;
741
+ }
742
+ }
743
+ return r2;
744
+ }(e2, t2) || function() {
745
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
746
+ }();
747
+ }
748
+ var $ = e("./globalState"), o = e("./validating"), u = e("./parsing"), i = e("bignumber.js"), G = { trillion: Math.pow(10, 12), billion: Math.pow(10, 9), million: Math.pow(10, 6), thousand: Math.pow(10, 3) }, V = { totalLength: 0, characteristic: 0, forceAverage: false, average: false, mantissa: -1, optionalMantissa: true, thousandSeparated: false, spaceSeparated: false, negative: "sign", forceSign: false, roundingFunction: Math.round, spaceSeparatedAbbreviation: false }, n = $.currentBytes(), d = n.binarySuffixes, h = n.decimalSuffixes, a = { general: { scale: 1024, suffixes: h, marker: "bd" }, binary: { scale: 1024, suffixes: d, marker: "b" }, decimal: { scale: 1e3, suffixes: h, marker: "d" } };
749
+ function c(e2) {
750
+ var t2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {}, r2 = 2 < arguments.length ? arguments[2] : void 0;
751
+ if ("string" == typeof t2 && (t2 = u.parseFormat(t2)), !o.validateFormat(t2))
752
+ return "ERROR: invalid format";
753
+ var n2 = t2.prefix || "", i2 = t2.postfix || "", a2 = function(e3, t3, r3) {
754
+ switch (t3.output) {
755
+ case "currency":
756
+ return t3 = s(t3, $.currentCurrencyDefaultFormat()), function(e4, t4, r4) {
757
+ var n3 = r4.currentCurrency(), i3 = Object.assign({}, t4), a3 = Object.assign({}, V, i3), o2 = void 0, u2 = "", c2 = !!a3.totalLength || !!a3.forceAverage || a3.average, s2 = i3.currencyPosition || n3.position, l = i3.currencySymbol || n3.symbol, f = void 0 !== a3.spaceSeparatedCurrency ? a3.spaceSeparatedCurrency : a3.spaceSeparated;
758
+ void 0 === i3.lowPrecision && (i3.lowPrecision = false);
759
+ f && (u2 = " ");
760
+ "infix" === s2 && (o2 = u2 + l + u2);
761
+ var g2 = m({ instance: e4, providedFormat: i3, state: r4, decimalSeparator: o2 });
762
+ "prefix" === s2 && (g2 = e4._value < 0 && "sign" === a3.negative ? "-".concat(u2).concat(l).concat(g2.slice(1)) : 0 < e4._value && a3.forceSign ? "+".concat(u2).concat(l).concat(g2.slice(1)) : l + u2 + g2);
763
+ s2 && "postfix" !== s2 || (u2 = !a3.spaceSeparatedAbbreviation && c2 ? "" : u2, g2 = g2 + u2 + l);
764
+ return g2;
765
+ }(e3, t3, $);
766
+ case "percent":
767
+ return t3 = s(t3, $.currentPercentageDefaultFormat()), function(e4, t4, r4, n3) {
768
+ var i3 = t4.prefixSymbol, a3 = m({ instance: n3(100 * e4._value), providedFormat: t4, state: r4 }), o2 = Object.assign({}, V, t4);
769
+ if (i3)
770
+ return "%".concat(o2.spaceSeparated ? " " : "").concat(a3);
771
+ return "".concat(a3).concat(o2.spaceSeparated ? " " : "", "%");
772
+ }(e3, t3, $, r3);
773
+ case "byte":
774
+ return t3 = s(t3, $.currentByteDefaultFormat()), function(e4, t4, r4, n3) {
775
+ var i3 = t4.base || "binary", a3 = Object.assign({}, V, t4), o2 = r4.currentBytes(), u2 = o2.binarySuffixes, c2 = o2.decimalSuffixes, s2 = { general: { scale: 1024, suffixes: c2 || h, marker: "bd" }, binary: { scale: 1024, suffixes: u2 || d, marker: "b" }, decimal: { scale: 1e3, suffixes: c2 || h, marker: "d" } }[i3], l = v(e4._value, s2.suffixes, s2.scale), f = l.value, g2 = l.suffix, p = m({ instance: n3(f), providedFormat: t4, state: r4, defaults: r4.currentByteDefaultFormat() });
776
+ return "".concat(p).concat(a3.spaceSeparated ? " " : "").concat(g2);
777
+ }(e3, t3, $, r3);
778
+ case "time":
779
+ return t3 = s(t3, $.currentTimeDefaultFormat()), function(e4) {
780
+ var t4 = Math.floor(e4._value / 60 / 60), r4 = Math.floor((e4._value - 60 * t4 * 60) / 60), n3 = Math.round(e4._value - 60 * t4 * 60 - 60 * r4);
781
+ return "".concat(t4, ":").concat(r4 < 10 ? "0" : "").concat(r4, ":").concat(n3 < 10 ? "0" : "").concat(n3);
782
+ }(e3);
783
+ case "ordinal":
784
+ return t3 = s(t3, $.currentOrdinalDefaultFormat()), function(e4, t4, r4) {
785
+ var n3 = r4.currentOrdinal(), i3 = Object.assign({}, V, t4), a3 = m({ instance: e4, providedFormat: t4, state: r4 }), o2 = n3(e4._value);
786
+ return "".concat(a3).concat(i3.spaceSeparated ? " " : "").concat(o2);
787
+ }(e3, t3, $);
788
+ case "number":
789
+ default:
790
+ return m({ instance: e3, providedFormat: t3, numbro: r3 });
791
+ }
792
+ }(e2, t2, r2);
793
+ return a2 = (a2 = n2 + a2) + i2;
794
+ }
795
+ function v(e2, t2, r2) {
796
+ var n2 = t2[0], i2 = Math.abs(e2);
797
+ if (r2 <= i2) {
798
+ for (var a2 = 1; a2 < t2.length; ++a2) {
799
+ var o2 = Math.pow(r2, a2), u2 = Math.pow(r2, a2 + 1);
800
+ if (o2 <= i2 && i2 < u2) {
801
+ n2 = t2[a2], e2 /= o2;
802
+ break;
803
+ }
804
+ }
805
+ n2 === t2[0] && (e2 /= Math.pow(r2, t2.length - 1), n2 = t2[t2.length - 1]);
806
+ }
807
+ return { value: e2, suffix: n2 };
808
+ }
809
+ function g(e2) {
810
+ for (var t2 = "", r2 = 0; r2 < e2; r2++)
811
+ t2 += "0";
812
+ return t2;
813
+ }
814
+ function q(e2, t2, r2) {
815
+ var n2 = 2 < arguments.length && void 0 !== r2 ? r2 : Math.round;
816
+ return -1 !== e2.toString().indexOf("e") ? function(e3, t3) {
817
+ var r3 = e3.toString(), n3 = I(r3.split("e"), 2), i2 = n3[0], a2 = n3[1], o2 = I(i2.split("."), 2), u2 = o2[0], c2 = o2[1], s2 = void 0 === c2 ? "" : c2;
818
+ if (0 < +a2)
819
+ r3 = u2 + s2 + g(a2 - s2.length);
820
+ else {
821
+ var l = ".";
822
+ l = +u2 < 0 ? "-0".concat(l) : "0".concat(l);
823
+ var f = (g(-a2 - 1) + Math.abs(u2) + s2).substr(0, t3);
824
+ f.length < t3 && (f += g(t3 - f.length)), r3 = l + f;
825
+ }
826
+ return 0 < +a2 && 0 < t3 && (r3 += ".".concat(g(t3))), r3;
827
+ }(e2, t2) : new i(n2(+"".concat(e2, "e+").concat(t2)) / Math.pow(10, t2)).toFixed(t2);
828
+ }
829
+ function Z(e2, t2, r2, n2, i2) {
830
+ var a2 = n2.currentDelimiters(), o2 = a2.thousands;
831
+ i2 = i2 || a2.decimal;
832
+ var u2 = a2.thousandsSize || 3, c2 = e2.toString(), s2 = c2.split(".")[0], l = c2.split(".")[1], f = t2 < 0 && 0 === s2.indexOf("-");
833
+ r2 && (f && (s2 = s2.slice(1)), function(e3, t3) {
834
+ for (var r3 = [], n3 = 0, i3 = e3; 0 < i3; i3--)
835
+ n3 === t3 && (r3.unshift(i3), n3 = 0), n3++;
836
+ return r3;
837
+ }(s2.length, u2).forEach(function(e3, t3) {
838
+ s2 = s2.slice(0, e3 + t3) + o2 + s2.slice(e3 + t3);
839
+ }), f && (s2 = "-".concat(s2)));
840
+ return c2 = l ? s2 + i2 + l : s2;
841
+ }
842
+ function m(e2) {
843
+ var t2 = e2.instance, r2 = e2.providedFormat, n2 = e2.state, i2 = void 0 === n2 ? $ : n2, a2 = e2.decimalSeparator, o2 = e2.defaults, u2 = void 0 === o2 ? i2.currentDefaults() : o2, c2 = t2._value;
844
+ if (0 === c2 && i2.hasZeroFormat())
845
+ return i2.getZeroFormat();
846
+ if (!isFinite(c2))
847
+ return c2.toString();
848
+ var s2, l, f, g2, p, d2, h2, v2, m2 = Object.assign({}, V, u2, r2), y = m2.totalLength, b = y ? 0 : m2.characteristic, w = m2.optionalCharacteristic, S = m2.forceAverage, O = m2.lowPrecision, x = !!y || !!S || m2.average, N = y ? -1 : x && void 0 === r2.mantissa ? 0 : m2.mantissa, B = !y && (void 0 === r2.optionalMantissa ? -1 === N : m2.optionalMantissa), M = m2.trimMantissa, A = m2.thousandSeparated, D = m2.spaceSeparated, E = m2.negative, F = m2.forceSign, k = m2.exponential, _ = m2.roundingFunction, L = "";
849
+ if (x) {
850
+ var j = function(e3) {
851
+ var t3 = e3.value, r3 = e3.forceAverage, n3 = e3.lowPrecision, i3 = void 0 === n3 || n3, a3 = e3.abbreviations, o3 = e3.spaceSeparated, u3 = void 0 !== o3 && o3, c3 = e3.totalLength, s3 = void 0 === c3 ? 0 : c3, l2 = e3.roundingFunction, f2 = void 0 === l2 ? Math.round : l2, g3 = "", p2 = Math.abs(t3), d3 = -1;
852
+ if (r3 && a3[r3] && G[r3] ? (g3 = a3[r3], t3 /= G[r3]) : p2 >= G.trillion || i3 && 1 === f2(p2 / G.trillion) ? (g3 = a3.trillion, t3 /= G.trillion) : p2 < G.trillion && p2 >= G.billion || i3 && 1 === f2(p2 / G.billion) ? (g3 = a3.billion, t3 /= G.billion) : p2 < G.billion && p2 >= G.million || i3 && 1 === f2(p2 / G.million) ? (g3 = a3.million, t3 /= G.million) : (p2 < G.million && p2 >= G.thousand || i3 && 1 === f2(p2 / G.thousand)) && (g3 = a3.thousand, t3 /= G.thousand), g3 = g3 && (u3 ? " " : "") + g3, s3) {
853
+ var h3 = t3 < 0, v3 = t3.toString().split(".")[0], m3 = h3 ? v3.length - 1 : v3.length;
854
+ d3 = Math.max(s3 - m3, 0);
855
+ }
856
+ return { value: t3, abbreviation: g3, mantissaPrecision: d3 };
857
+ }({ value: c2, forceAverage: S, lowPrecision: O, abbreviations: i2.currentAbbreviations(), spaceSeparated: D, roundingFunction: _, totalLength: y });
858
+ c2 = j.value, L += j.abbreviation, y && (N = j.mantissaPrecision);
859
+ }
860
+ if (k) {
861
+ var P = (l = (s2 = { value: c2, characteristicPrecision: b }).value, f = s2.characteristicPrecision, g2 = void 0 === f ? 0 : f, p = I(l.toExponential().split("e"), 2), d2 = p[0], h2 = p[1], v2 = +d2, g2 && 1 < g2 && (v2 *= Math.pow(10, g2 - 1), h2 = 0 <= (h2 -= g2 - 1) ? "+".concat(h2) : h2), { value: v2, abbreviation: "e".concat(h2) });
862
+ c2 = P.value, L = P.abbreviation + L;
863
+ }
864
+ var T, C, U, R = function(e3, t3, r3, n3, i3, a3) {
865
+ if (-1 === n3)
866
+ return e3;
867
+ var o3 = q(t3, n3, a3), u3 = I(o3.toString().split("."), 2), c3 = u3[0], s3 = u3[1], l2 = void 0 === s3 ? "" : s3;
868
+ if (l2.match(/^0+$/) && (r3 || i3))
869
+ return c3;
870
+ var f2 = l2.match(/0+$/);
871
+ return i3 && f2 ? "".concat(c3, ".").concat(l2.toString().slice(0, f2.index)) : o3.toString();
872
+ }(c2.toString(), c2, B, N, M, _);
873
+ return R = Z(R = function(e3, t3, r3, n3) {
874
+ var i3 = e3, a3 = I(i3.toString().split("."), 2), o3 = a3[0], u3 = a3[1];
875
+ if (o3.match(/^-?0$/) && r3)
876
+ return u3 ? "".concat(o3.replace("0", ""), ".").concat(u3) : o3.replace("0", "");
877
+ var c3 = t3 < 0 && 0 === o3.indexOf("-");
878
+ if (c3 && (o3 = o3.slice(1), i3 = i3.slice(1)), o3.length < n3)
879
+ for (var s3 = n3 - o3.length, l2 = 0; l2 < s3; l2++)
880
+ i3 = "0".concat(i3);
881
+ return c3 && (i3 = "-".concat(i3)), i3.toString();
882
+ }(R, c2, w, b), c2, A, i2, a2), (x || k) && (R = R + L), (F || c2 < 0) && (T = R, U = E, R = 0 === (C = c2) ? T : 0 == +T ? T.replace("-", "") : 0 < C ? "+".concat(T) : "sign" === U ? T : "(".concat(T.replace("-", ""), ")")), R;
883
+ }
884
+ function s(e2, t2) {
885
+ if (!e2)
886
+ return t2;
887
+ var r2 = Object.keys(e2);
888
+ return 1 === r2.length && "output" === r2[0] ? t2 : e2;
889
+ }
890
+ t.exports = function(n2) {
891
+ return { format: function() {
892
+ for (var e2 = arguments.length, t2 = new Array(e2), r2 = 0; r2 < e2; r2++)
893
+ t2[r2] = arguments[r2];
894
+ return c.apply(void 0, t2.concat([n2]));
895
+ }, getByteUnit: function() {
896
+ for (var e2 = arguments.length, t2 = new Array(e2), r2 = 0; r2 < e2; r2++)
897
+ t2[r2] = arguments[r2];
898
+ return function(e3) {
899
+ var t3 = a.general;
900
+ return v(e3._value, t3.suffixes, t3.scale).suffix;
901
+ }.apply(void 0, t2.concat([n2]));
902
+ }, getBinaryByteUnit: function() {
903
+ for (var e2 = arguments.length, t2 = new Array(e2), r2 = 0; r2 < e2; r2++)
904
+ t2[r2] = arguments[r2];
905
+ return function(e3) {
906
+ var t3 = a.binary;
907
+ return v(e3._value, t3.suffixes, t3.scale).suffix;
908
+ }.apply(void 0, t2.concat([n2]));
909
+ }, getDecimalByteUnit: function() {
910
+ for (var e2 = arguments.length, t2 = new Array(e2), r2 = 0; r2 < e2; r2++)
911
+ t2[r2] = arguments[r2];
912
+ return function(e3) {
913
+ var t3 = a.decimal;
914
+ return v(e3._value, t3.suffixes, t3.scale).suffix;
915
+ }.apply(void 0, t2.concat([n2]));
916
+ }, formatOrDefault: s };
917
+ };
918
+ }, { "./globalState": 4, "./parsing": 8, "./validating": 10, "bignumber.js": 1 }], 4: [function(e, t, r) {
919
+ "use strict";
920
+ var i = e("./en-US"), n = e("./validating"), a = e("./parsing"), o = {}, u = void 0, c = {}, s = null, l = {};
921
+ function f(e2) {
922
+ u = e2;
923
+ }
924
+ function g() {
925
+ return c[u];
926
+ }
927
+ o.languages = function() {
928
+ return Object.assign({}, c);
929
+ }, o.currentLanguage = function() {
930
+ return u;
931
+ }, o.currentBytes = function() {
932
+ return g().bytes || {};
933
+ }, o.currentCurrency = function() {
934
+ return g().currency;
935
+ }, o.currentAbbreviations = function() {
936
+ return g().abbreviations;
937
+ }, o.currentDelimiters = function() {
938
+ return g().delimiters;
939
+ }, o.currentOrdinal = function() {
940
+ return g().ordinal;
941
+ }, o.currentDefaults = function() {
942
+ return Object.assign({}, g().defaults, l);
943
+ }, o.currentOrdinalDefaultFormat = function() {
944
+ return Object.assign({}, o.currentDefaults(), g().ordinalFormat);
945
+ }, o.currentByteDefaultFormat = function() {
946
+ return Object.assign({}, o.currentDefaults(), g().byteFormat);
947
+ }, o.currentPercentageDefaultFormat = function() {
948
+ return Object.assign({}, o.currentDefaults(), g().percentageFormat);
949
+ }, o.currentCurrencyDefaultFormat = function() {
950
+ return Object.assign({}, o.currentDefaults(), g().currencyFormat);
951
+ }, o.currentTimeDefaultFormat = function() {
952
+ return Object.assign({}, o.currentDefaults(), g().timeFormat);
953
+ }, o.setDefaults = function(e2) {
954
+ e2 = a.parseFormat(e2), n.validateFormat(e2) && (l = e2);
955
+ }, o.getZeroFormat = function() {
956
+ return s;
957
+ }, o.setZeroFormat = function(e2) {
958
+ return s = "string" == typeof e2 ? e2 : null;
959
+ }, o.hasZeroFormat = function() {
960
+ return null !== s;
961
+ }, o.languageData = function(e2) {
962
+ if (e2) {
963
+ if (c[e2])
964
+ return c[e2];
965
+ throw new Error('Unknown tag "'.concat(e2, '"'));
966
+ }
967
+ return g();
968
+ }, o.registerLanguage = function(e2) {
969
+ var t2 = 1 < arguments.length && void 0 !== arguments[1] && arguments[1];
970
+ if (!n.validateLanguage(e2))
971
+ throw new Error("Invalid language data");
972
+ c[e2.languageTag] = e2, t2 && f(e2.languageTag);
973
+ }, o.setLanguage = function(e2) {
974
+ var t2 = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : i.languageTag;
975
+ if (!c[e2]) {
976
+ var r2 = e2.split("-")[0], n2 = Object.keys(c).find(function(e3) {
977
+ return e3.split("-")[0] === r2;
978
+ });
979
+ return c[n2] ? void f(n2) : void f(t2);
980
+ }
981
+ f(e2);
982
+ }, o.registerLanguage(i), u = i.languageTag, t.exports = o;
983
+ }, { "./en-US": 2, "./parsing": 8, "./validating": 10 }], 5: [function(n, e, t) {
984
+ "use strict";
985
+ e.exports = function(t2) {
986
+ return { loadLanguagesInNode: function(e2) {
987
+ return r = t2, void e2.forEach(function(t3) {
988
+ var e3 = void 0;
989
+ try {
990
+ e3 = n("../languages/".concat(t3));
991
+ } catch (e4) {
992
+ console.error('Unable to load "'.concat(t3, '". No matching language file found.'));
993
+ }
994
+ e3 && r.registerLanguage(e3);
995
+ });
996
+ var r;
997
+ } };
998
+ };
999
+ }, {}], 6: [function(e, t, r) {
1000
+ "use strict";
1001
+ var c = e("bignumber.js");
1002
+ function a(e2, t2, r2) {
1003
+ var n = new c(e2._value), i = t2;
1004
+ return r2.isNumbro(t2) && (i = t2._value), i = new c(i), e2._value = n.minus(i).toNumber(), e2;
1005
+ }
1006
+ t.exports = function(u) {
1007
+ return { add: function(e2, t2) {
1008
+ return n = t2, i = u, a2 = new c((r2 = e2)._value), o = n, i.isNumbro(n) && (o = n._value), o = new c(o), r2._value = a2.plus(o).toNumber(), r2;
1009
+ var r2, n, i, a2, o;
1010
+ }, subtract: function(e2, t2) {
1011
+ return a(e2, t2, u);
1012
+ }, multiply: function(e2, t2) {
1013
+ return n = t2, i = u, a2 = new c((r2 = e2)._value), o = n, i.isNumbro(n) && (o = n._value), o = new c(o), r2._value = a2.times(o).toNumber(), r2;
1014
+ var r2, n, i, a2, o;
1015
+ }, divide: function(e2, t2) {
1016
+ return n = t2, i = u, a2 = new c((r2 = e2)._value), o = n, i.isNumbro(n) && (o = n._value), o = new c(o), r2._value = a2.dividedBy(o).toNumber(), r2;
1017
+ var r2, n, i, a2, o;
1018
+ }, set: function(e2, t2) {
1019
+ return r2 = e2, i = n = t2, u.isNumbro(n) && (i = n._value), r2._value = i, r2;
1020
+ var r2, n, i;
1021
+ }, difference: function(e2, t2) {
1022
+ return r2 = t2, a(i = (n = u)(e2._value), r2, n), Math.abs(i._value);
1023
+ var r2, n, i;
1024
+ }, BigNumber: c };
1025
+ };
1026
+ }, { "bignumber.js": 1 }], 7: [function(e, t, r) {
1027
+ "use strict";
1028
+ function i(e2, t2) {
1029
+ for (var r2 = 0; r2 < t2.length; r2++) {
1030
+ var n2 = t2[r2];
1031
+ n2.enumerable = n2.enumerable || false, n2.configurable = true, "value" in n2 && (n2.writable = true), Object.defineProperty(e2, n2.key, n2);
1032
+ }
1033
+ }
1034
+ var a = e("./globalState"), n = e("./validating"), o = e("./loading")(p), u = e("./unformatting"), c = e("./formatting")(p), s = e("./manipulating")(p), l = e("./parsing"), f = function() {
1035
+ function t2(e3) {
1036
+ !function(e4, t3) {
1037
+ if (!(e4 instanceof t3))
1038
+ throw new TypeError("Cannot call a class as a function");
1039
+ }(this, t2), this._value = e3;
1040
+ }
1041
+ var e2, r2, n2;
1042
+ return e2 = t2, (r2 = [{ key: "clone", value: function() {
1043
+ return p(this._value);
1044
+ } }, { key: "format", value: function(e3) {
1045
+ var t3 = 0 < arguments.length && void 0 !== e3 ? e3 : {};
1046
+ return c.format(this, t3);
1047
+ } }, { key: "formatCurrency", value: function(e3) {
1048
+ return "string" == typeof e3 && (e3 = l.parseFormat(e3)), (e3 = c.formatOrDefault(e3, a.currentCurrencyDefaultFormat())).output = "currency", c.format(this, e3);
1049
+ } }, { key: "formatTime", value: function(e3) {
1050
+ var t3 = 0 < arguments.length && void 0 !== e3 ? e3 : {};
1051
+ return t3.output = "time", c.format(this, t3);
1052
+ } }, { key: "binaryByteUnits", value: function() {
1053
+ return c.getBinaryByteUnit(this);
1054
+ } }, { key: "decimalByteUnits", value: function() {
1055
+ return c.getDecimalByteUnit(this);
1056
+ } }, { key: "byteUnits", value: function() {
1057
+ return c.getByteUnit(this);
1058
+ } }, { key: "difference", value: function(e3) {
1059
+ return s.difference(this, e3);
1060
+ } }, { key: "add", value: function(e3) {
1061
+ return s.add(this, e3);
1062
+ } }, { key: "subtract", value: function(e3) {
1063
+ return s.subtract(this, e3);
1064
+ } }, { key: "multiply", value: function(e3) {
1065
+ return s.multiply(this, e3);
1066
+ } }, { key: "divide", value: function(e3) {
1067
+ return s.divide(this, e3);
1068
+ } }, { key: "set", value: function(e3) {
1069
+ return s.set(this, g(e3));
1070
+ } }, { key: "value", value: function() {
1071
+ return this._value;
1072
+ } }, { key: "valueOf", value: function() {
1073
+ return this._value;
1074
+ } }]) && i(e2.prototype, r2), n2 && i(e2, n2), t2;
1075
+ }();
1076
+ function g(e2) {
1077
+ var t2 = e2;
1078
+ return p.isNumbro(e2) ? t2 = e2._value : "string" == typeof e2 ? t2 = p.unformat(e2) : isNaN(e2) && (t2 = NaN), t2;
1079
+ }
1080
+ function p(e2) {
1081
+ return new f(g(e2));
1082
+ }
1083
+ p.version = "2.3.6", p.isNumbro = function(e2) {
1084
+ return e2 instanceof f;
1085
+ }, p.language = a.currentLanguage, p.registerLanguage = a.registerLanguage, p.setLanguage = a.setLanguage, p.languages = a.languages, p.languageData = a.languageData, p.zeroFormat = a.setZeroFormat, p.defaultFormat = a.currentDefaults, p.setDefaults = a.setDefaults, p.defaultCurrencyFormat = a.currentCurrencyDefaultFormat, p.validate = n.validate, p.loadLanguagesInNode = o.loadLanguagesInNode, p.unformat = u.unformat, p.BigNumber = s.BigNumber, t.exports = p;
1086
+ }, { "./formatting": 3, "./globalState": 4, "./loading": 5, "./manipulating": 6, "./parsing": 8, "./unformatting": 9, "./validating": 10 }], 8: [function(e, t, r) {
1087
+ "use strict";
1088
+ t.exports = { parseFormat: function(e2) {
1089
+ var t2, r2, n, i, a, o, u, c, s, l, f, g, p, d, h, v, m, y, b, w, S, O, x = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
1090
+ return "string" != typeof e2 ? e2 : (r2 = x, e2 = (n = (t2 = e2).match(/^{([^}]*)}/)) ? (r2.prefix = n[1], t2.slice(n[0].length)) : t2, a = x, function(e3, t3) {
1091
+ if (-1 === e3.indexOf("$")) {
1092
+ if (-1 === e3.indexOf("%"))
1093
+ return -1 !== e3.indexOf("bd") ? (t3.output = "byte", t3.base = "general") : -1 !== e3.indexOf("b") ? (t3.output = "byte", t3.base = "binary") : -1 !== e3.indexOf("d") ? (t3.output = "byte", t3.base = "decimal") : -1 === e3.indexOf(":") ? -1 !== e3.indexOf("o") && (t3.output = "ordinal") : t3.output = "time";
1094
+ t3.output = "percent";
1095
+ } else
1096
+ t3.output = "currency";
1097
+ }(e2 = (o = (i = e2).match(/{([^}]*)}$/)) ? (a.postfix = o[1], i.slice(0, -o[0].length)) : i, x), u = x, (c = e2.match(/[1-9]+[0-9]*/)) && (u.totalLength = +c[0]), s = x, (l = e2.split(".")[0].match(/0+/)) && (s.characteristic = l[0].length), function(e3, t3) {
1098
+ if (-1 !== e3.indexOf(".")) {
1099
+ var r3 = e3.split(".")[0];
1100
+ t3.optionalCharacteristic = -1 === r3.indexOf("0");
1101
+ }
1102
+ }(e2, x), f = x, -1 !== e2.indexOf("a") && (f.average = true), p = x, -1 !== (g = e2).indexOf("K") ? p.forceAverage = "thousand" : -1 !== g.indexOf("M") ? p.forceAverage = "million" : -1 !== g.indexOf("B") ? p.forceAverage = "billion" : -1 !== g.indexOf("T") && (p.forceAverage = "trillion"), function(e3, t3) {
1103
+ var r3 = e3.split(".")[1];
1104
+ if (r3) {
1105
+ var n2 = r3.match(/0+/);
1106
+ n2 && (t3.mantissa = n2[0].length);
1107
+ }
1108
+ }(e2, x), h = x, (d = e2).match(/\[\.]/) ? h.optionalMantissa = true : d.match(/\./) && (h.optionalMantissa = false), v = x, (m = e2.split(".")[1]) && (v.trimMantissa = -1 !== m.indexOf("[")), y = x, -1 !== e2.indexOf(",") && (y.thousandSeparated = true), b = x, -1 !== e2.indexOf(" ") && (b.spaceSeparated = true, b.spaceSeparatedCurrency = true, (b.average || b.forceAverage) && (b.spaceSeparatedAbbreviation = true)), S = x, (w = e2).match(/^\+?\([^)]*\)$/) && (S.negative = "parenthesis"), w.match(/^\+?-/) && (S.negative = "sign"), O = x, e2.match(/^\+/) && (O.forceSign = true), x);
1109
+ } };
1110
+ }, {}], 9: [function(g, e, t) {
1111
+ "use strict";
1112
+ var M = [{ key: "ZiB", factor: Math.pow(1024, 7) }, { key: "ZB", factor: Math.pow(1e3, 7) }, { key: "YiB", factor: Math.pow(1024, 8) }, { key: "YB", factor: Math.pow(1e3, 8) }, { key: "TiB", factor: Math.pow(1024, 4) }, { key: "TB", factor: Math.pow(1e3, 4) }, { key: "PiB", factor: Math.pow(1024, 5) }, { key: "PB", factor: Math.pow(1e3, 5) }, { key: "MiB", factor: Math.pow(1024, 2) }, { key: "MB", factor: Math.pow(1e3, 2) }, { key: "KiB", factor: Math.pow(1024, 1) }, { key: "KB", factor: Math.pow(1e3, 1) }, { key: "GiB", factor: Math.pow(1024, 3) }, { key: "GB", factor: Math.pow(1e3, 3) }, { key: "EiB", factor: Math.pow(1024, 6) }, { key: "EB", factor: Math.pow(1e3, 6) }, { key: "B", factor: 1 }];
1113
+ function A(e2) {
1114
+ return e2.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
1115
+ }
1116
+ function p(e2, t2, r, n, i, a, o) {
1117
+ var u = 2 < arguments.length && void 0 !== r ? r : "", c = 3 < arguments.length ? n : void 0, s = 4 < arguments.length ? i : void 0, l = 5 < arguments.length ? a : void 0, f = 6 < arguments.length ? o : void 0;
1118
+ if ("" !== e2)
1119
+ return e2 === s ? 0 : function e3(t3, r2, n2, i2, a2, o2, u2) {
1120
+ var c2 = 2 < arguments.length && void 0 !== n2 ? n2 : "", s2 = 3 < arguments.length ? i2 : void 0, l2 = 4 < arguments.length ? a2 : void 0, f2 = 5 < arguments.length ? o2 : void 0, g2 = 6 < arguments.length ? u2 : void 0;
1121
+ if (!isNaN(+t3))
1122
+ return +t3;
1123
+ var p2 = "", d = t3.replace(/(^[^(]*)\((.*)\)([^)]*$)/, "$1$2$3");
1124
+ if (d !== t3)
1125
+ return -1 * e3(d, r2, c2, s2, l2, f2, g2);
1126
+ for (var h = 0; h < M.length; h++) {
1127
+ var v = M[h];
1128
+ if ((p2 = t3.replace(RegExp("([0-9 ])(".concat(v.key, ")$")), "$1")) !== t3)
1129
+ return e3(p2, r2, c2, s2, l2, f2, g2) * v.factor;
1130
+ }
1131
+ if ((p2 = t3.replace("%", "")) !== t3)
1132
+ return e3(p2, r2, c2, s2, l2, f2, g2) / 100;
1133
+ var m = parseFloat(t3);
1134
+ if (!isNaN(m)) {
1135
+ var y = s2(m);
1136
+ if (y && "." !== y && (p2 = t3.replace(new RegExp("".concat(A(y), "$")), "")) !== t3)
1137
+ return e3(p2, r2, c2, s2, l2, f2, g2);
1138
+ var b = {};
1139
+ Object.keys(f2).forEach(function(e4) {
1140
+ b[f2[e4]] = e4;
1141
+ });
1142
+ for (var w = Object.keys(b).sort().reverse(), S = w.length, O = 0; O < S; O++) {
1143
+ var x = w[O], N = b[x];
1144
+ if ((p2 = t3.replace(x, "")) !== t3) {
1145
+ var B = void 0;
1146
+ switch (N) {
1147
+ case "thousand":
1148
+ B = Math.pow(10, 3);
1149
+ break;
1150
+ case "million":
1151
+ B = Math.pow(10, 6);
1152
+ break;
1153
+ case "billion":
1154
+ B = Math.pow(10, 9);
1155
+ break;
1156
+ case "trillion":
1157
+ B = Math.pow(10, 12);
1158
+ }
1159
+ return e3(p2, r2, c2, s2, l2, f2, g2) * B;
1160
+ }
1161
+ }
1162
+ }
1163
+ }(function(e3, t3, r2) {
1164
+ var n2 = 2 < arguments.length && void 0 !== r2 ? r2 : "", i2 = e3.replace(n2, "");
1165
+ return i2 = (i2 = i2.replace(new RegExp("([0-9])".concat(A(t3.thousands), "([0-9])"), "g"), "$1$2")).replace(t3.decimal, ".");
1166
+ }(e2, t2, u), t2, u, c, s, l, f);
1167
+ }
1168
+ e.exports = { unformat: function(e2, t2) {
1169
+ var r, n, i, a = g("./globalState"), o = a.currentDelimiters(), u = a.currentCurrency().symbol, c = a.currentOrdinal(), s = a.getZeroFormat(), l = a.currentAbbreviations(), f = void 0;
1170
+ if ("string" == typeof e2)
1171
+ f = function(e3, t3) {
1172
+ if (e3.indexOf(":") && ":" !== t3.thousands) {
1173
+ var r2 = e3.split(":");
1174
+ if (3 === r2.length) {
1175
+ var n2 = +r2[0], i2 = +r2[1], a2 = +r2[2];
1176
+ return !isNaN(n2) && !isNaN(i2) && !isNaN(a2);
1177
+ }
1178
+ }
1179
+ }(e2, o) ? (r = e2.split(":"), n = +r[0], i = +r[1], +r[2] + 60 * i + 3600 * n) : p(e2, o, u, c, s, l, t2);
1180
+ else {
1181
+ if ("number" != typeof e2)
1182
+ return;
1183
+ f = e2;
1184
+ }
1185
+ if (void 0 !== f)
1186
+ return f;
1187
+ } };
1188
+ }, { "./globalState": 4 }], 10: [function(e, t, r) {
1189
+ "use strict";
1190
+ function n(e2) {
1191
+ return function(e3) {
1192
+ if (Array.isArray(e3)) {
1193
+ for (var t2 = 0, r2 = new Array(e3.length); t2 < e3.length; t2++)
1194
+ r2[t2] = e3[t2];
1195
+ return r2;
1196
+ }
1197
+ }(e2) || function(e3) {
1198
+ if (Symbol.iterator in Object(e3) || "[object Arguments]" === Object.prototype.toString.call(e3))
1199
+ return Array.from(e3);
1200
+ }(e2) || function() {
1201
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
1202
+ }();
1203
+ }
1204
+ function f(e2) {
1205
+ return (f = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e3) {
1206
+ return typeof e3;
1207
+ } : function(e3) {
1208
+ return e3 && "function" == typeof Symbol && e3.constructor === Symbol && e3 !== Symbol.prototype ? "symbol" : typeof e3;
1209
+ })(e2);
1210
+ }
1211
+ var i = e("./unformatting"), a = /^[a-z]{2,3}(-[a-zA-Z]{4})?(-([A-Z]{2}|[0-9]{3}))?$/, g = { output: { type: "string", validValues: ["currency", "percent", "byte", "time", "ordinal", "number"] }, base: { type: "string", validValues: ["decimal", "binary", "general"], restriction: function(e2, t2) {
1212
+ return "byte" === t2.output;
1213
+ }, message: "`base` must be provided only when the output is `byte`", mandatory: function(e2) {
1214
+ return "byte" === e2.output;
1215
+ } }, characteristic: { type: "number", restriction: function(e2) {
1216
+ return 0 <= e2;
1217
+ }, message: "value must be positive" }, prefix: "string", postfix: "string", forceAverage: { type: "string", validValues: ["trillion", "billion", "million", "thousand"] }, average: "boolean", lowPrecision: { type: "boolean", restriction: function(e2, t2) {
1218
+ return true === t2.average;
1219
+ }, message: "`lowPrecision` must be provided only when the option `average` is set" }, currencyPosition: { type: "string", validValues: ["prefix", "infix", "postfix"] }, currencySymbol: "string", totalLength: { type: "number", restrictions: [{ restriction: function(e2) {
1220
+ return 0 <= e2;
1221
+ }, message: "value must be positive" }, { restriction: function(e2, t2) {
1222
+ return !t2.exponential;
1223
+ }, message: "`totalLength` is incompatible with `exponential`" }] }, mantissa: { type: "number", restriction: function(e2) {
1224
+ return 0 <= e2;
1225
+ }, message: "value must be positive" }, optionalMantissa: "boolean", trimMantissa: "boolean", roundingFunction: "function", optionalCharacteristic: "boolean", thousandSeparated: "boolean", spaceSeparated: "boolean", spaceSeparatedCurrency: "boolean", spaceSeparatedAbbreviation: "boolean", abbreviations: { type: "object", children: { thousand: "string", million: "string", billion: "string", trillion: "string" } }, negative: { type: "string", validValues: ["sign", "parenthesis"] }, forceSign: "boolean", exponential: { type: "boolean" }, prefixSymbol: { type: "boolean", restriction: function(e2, t2) {
1226
+ return "percent" === t2.output;
1227
+ }, message: "`prefixSymbol` can be provided only when the output is `percent`" } }, o = { languageTag: { type: "string", mandatory: true, restriction: function(e2) {
1228
+ return e2.match(a);
1229
+ }, message: "the language tag must follow the BCP 47 specification (see https://tools.ieft.org/html/bcp47)" }, delimiters: { type: "object", children: { thousands: "string", decimal: "string", thousandsSize: "number" }, mandatory: true }, abbreviations: { type: "object", children: { thousand: { type: "string", mandatory: true }, million: { type: "string", mandatory: true }, billion: { type: "string", mandatory: true }, trillion: { type: "string", mandatory: true } }, mandatory: true }, spaceSeparated: "boolean", spaceSeparatedCurrency: "boolean", ordinal: { type: "function", mandatory: true }, bytes: { type: "object", children: { binarySuffixes: "object", decimalSuffixes: "object" } }, currency: { type: "object", children: { symbol: "string", position: "string", code: "string" }, mandatory: true }, defaults: "format", ordinalFormat: "format", byteFormat: "format", percentageFormat: "format", currencyFormat: "format", timeDefaults: "format", formats: { type: "object", children: { fourDigits: { type: "format", mandatory: true }, fullWithTwoDecimals: { type: "format", mandatory: true }, fullWithTwoDecimalsNoCurrency: { type: "format", mandatory: true }, fullWithNoDecimals: { type: "format", mandatory: true } } } };
1230
+ function u(e2) {
1231
+ return void 0 !== i.unformat(e2);
1232
+ }
1233
+ function p(c2, s, l, e2) {
1234
+ var t2 = 3 < arguments.length && void 0 !== e2 && e2, r2 = Object.keys(c2).map(function(e3) {
1235
+ if (!s[e3])
1236
+ return console.error("".concat(l, " Invalid key: ").concat(e3)), false;
1237
+ var t3 = c2[e3], r3 = s[e3];
1238
+ if ("string" == typeof r3 && (r3 = { type: r3 }), "format" === r3.type) {
1239
+ if (!p(t3, g, "[Validate ".concat(e3, "]"), true))
1240
+ return false;
1241
+ } else if (f(t3) !== r3.type)
1242
+ return console.error("".concat(l, " ").concat(e3, ' type mismatched: "').concat(r3.type, '" expected, "').concat(f(t3), '" provided')), false;
1243
+ if (r3.restrictions && r3.restrictions.length)
1244
+ for (var n2 = r3.restrictions.length, i2 = 0; i2 < n2; i2++) {
1245
+ var a2 = r3.restrictions[i2], o2 = a2.restriction, u2 = a2.message;
1246
+ if (!o2(t3, c2))
1247
+ return console.error("".concat(l, " ").concat(e3, " invalid value: ").concat(u2)), false;
1248
+ }
1249
+ if (r3.restriction && !r3.restriction(t3, c2))
1250
+ return console.error("".concat(l, " ").concat(e3, " invalid value: ").concat(r3.message)), false;
1251
+ if (r3.validValues && -1 === r3.validValues.indexOf(t3))
1252
+ return console.error("".concat(l, " ").concat(e3, " invalid value: must be among ").concat(JSON.stringify(r3.validValues), ', "').concat(t3, '" provided')), false;
1253
+ if (r3.children && !p(t3, r3.children, "[Validate ".concat(e3, "]")))
1254
+ return false;
1255
+ return true;
1256
+ });
1257
+ return t2 || r2.push.apply(r2, n(Object.keys(s).map(function(e3) {
1258
+ var t3 = s[e3];
1259
+ if ("string" == typeof t3 && (t3 = { type: t3 }), t3.mandatory) {
1260
+ var r3 = t3.mandatory;
1261
+ if ("function" == typeof r3 && (r3 = r3(c2)), r3 && void 0 === c2[e3])
1262
+ return console.error("".concat(l, ' Missing mandatory key "').concat(e3, '"')), false;
1263
+ }
1264
+ return true;
1265
+ }))), r2.reduce(function(e3, t3) {
1266
+ return e3 && t3;
1267
+ }, true);
1268
+ }
1269
+ function c(e2) {
1270
+ return p(e2, g, "[Validate format]");
1271
+ }
1272
+ t.exports = { validate: function(e2, t2) {
1273
+ var r2 = u(e2), n2 = c(t2);
1274
+ return r2 && n2;
1275
+ }, validateFormat: c, validateInput: u, validateLanguage: function(e2) {
1276
+ return p(e2, o, "[Validate language]");
1277
+ } };
1278
+ }, { "./unformatting": 9 }] }, {}, [7])(7);
1279
+ });
1280
+ }
1281
+ });
1282
+
1283
+ // format/convertCycleToUnix.ts
1284
+ var convertCycleToUnix = (cycle, cycleDurationInSeconds, pinnedCycle, pinnedCycleDate) => {
1285
+ const cycleDurationInUnixMilliseconds = cycleDurationInSeconds * 1e3;
1286
+ const cycleInUnixTime = cycleDurationInUnixMilliseconds * (cycle - pinnedCycle) + pinnedCycleDate;
1287
+ const cycleDate = new Date(cycleInUnixTime);
1288
+ return cycleDate.getTime() / 1e3;
1289
+ };
1290
+
1291
+ // format/convertChainCycleToUnix.ts
1292
+ import { base, sepolia } from "viem/chains";
1293
+ var convertChainCycleToUnix = (cycle, chainId = 1) => {
1294
+ const weekInDays = 7;
1295
+ const dayInSeconds = 86400;
1296
+ const weekInSeconds = weekInDays * dayInSeconds;
1297
+ if (chainId === sepolia.id) {
1298
+ const cycleDuration = 300;
1299
+ const pinnedCycle = 291;
1300
+ const pinnedCycleTimestamp = 1733338200 * 1e3;
1301
+ return convertCycleToUnix(
1302
+ cycle,
1303
+ cycleDuration,
1304
+ pinnedCycle,
1305
+ pinnedCycleTimestamp
1306
+ );
1307
+ }
1308
+ if (chainId === base.id) {
1309
+ const pinnedCycle = 316;
1310
+ const pinnedCycleTimestamp = 1733338053 * 1e3;
1311
+ return convertCycleToUnix(
1312
+ cycle,
1313
+ weekInSeconds,
1314
+ pinnedCycle,
1315
+ pinnedCycleTimestamp
1316
+ );
1317
+ }
1318
+ const firstLockCycle = 241;
1319
+ const firstLockCycleDate = Date.parse("30 Nov 2022 16:00:00 GMT");
1320
+ return convertCycleToUnix(
1321
+ cycle,
1322
+ weekInSeconds,
1323
+ firstLockCycle,
1324
+ firstLockCycleDate
1325
+ );
1326
+ };
1327
+
1328
+ // format/convertStringToBigInt.ts
1329
+ import { parseUnits } from "viem";
1330
+ var convertStringToBigInt = (amount, decimals) => {
1331
+ return parseUnits(amount, decimals || 18);
1332
+ };
1333
+
1334
+ // format/convertSecondsToRemainingTime.ts
1335
+ function padNumber(num, hideZero) {
1336
+ if (num <= 0)
1337
+ return "0";
1338
+ if (num < 10 && hideZero)
1339
+ return `${num}`;
1340
+ if (num < 10)
1341
+ return `${num}`;
1342
+ return num.toString();
1343
+ }
1344
+ function convertSecondsToRemainingTime(remain) {
1345
+ if (remain <= 0) {
1346
+ return "In Progress";
1347
+ }
1348
+ const days = Math.floor(remain / 60 / 60 / 24);
1349
+ const hours = Math.floor((remain - days * 60 * 60 * 24) / 60 / 60);
1350
+ const mins = Math.floor(
1351
+ (remain - days * 60 * 60 * 24 - hours * 60 * 60) / 60
1352
+ );
1353
+ return `${days > 0 ? `${padNumber(days)}d` : ""} ${hours > 0 ? `${padNumber(hours)}h` : ""} ${mins > 0 ? `${padNumber(mins)}m` : ""}`;
1354
+ }
1355
+
1356
+ // format/formatAmount.ts
1357
+ var import_numbro = __toESM(require_numbro_min());
1358
+ function formatAmount(amount, mantissa = 2, ltSmallAmt = false) {
1359
+ if (!amount)
1360
+ return "0.00";
1361
+ if (Number(amount) === 0)
1362
+ return "0.00";
1363
+ if (Number(amount) < 9e-13) {
1364
+ mantissa = 18;
1365
+ } else if (Number(amount) < 9e-10) {
1366
+ mantissa = 11;
1367
+ } else if (Number(amount) < 9e-8) {
1368
+ mantissa = 9;
1369
+ } else if (Number(amount) < 9e-6) {
1370
+ mantissa = 7;
1371
+ } else if (Number(amount) < 9e-4) {
1372
+ mantissa = 5;
1373
+ } else if (Number(amount) < 0.09 && mantissa === 2) {
1374
+ mantissa = 3;
1375
+ }
1376
+ if (Number(amount) < 1e-3 && ltSmallAmt) {
1377
+ return "<0.001";
1378
+ }
1379
+ return (0, import_numbro.default)(amount).format({
1380
+ mantissa,
1381
+ // optionalMantissa: true,
1382
+ thousandSeparated: true
1383
+ });
1384
+ }
1385
+
1386
+ // format/formatCurrency.ts
1387
+ var import_numbro2 = __toESM(require_numbro_min());
1388
+ function formatCurrency(amount, average = false, mantissa = 2) {
1389
+ if (!amount || amount === 0)
1390
+ return "$0.00";
1391
+ return (0, import_numbro2.default)(amount).formatCurrency({
1392
+ thousandSeparated: true,
1393
+ mantissa,
1394
+ average
1395
+ });
1396
+ }
1397
+
1398
+ // format/formatLargeNumber.ts
1399
+ var import_numbro3 = __toESM(require_numbro_min());
1400
+ function formatLargeNumber(amount, average = false) {
1401
+ return (0, import_numbro3.default)(amount).format({
1402
+ average: true,
1403
+ mantissa: 2,
1404
+ optionalMantissa: true,
1405
+ currencyPosition: "prefix"
1406
+ }).toUpperCase();
1407
+ }
1408
+
1409
+ // format/formatPercent.ts
1410
+ var import_numbro4 = __toESM(require_numbro_min());
1411
+ function formatPercent(amount, mantissa = 2) {
1412
+ return (0, import_numbro4.default)(amount).format({
1413
+ output: "percent",
1414
+ mantissa,
1415
+ optionalMantissa: true
1416
+ });
1417
+ }
1418
+
1419
+ // format/formatTVL.ts
1420
+ var import_numbro5 = __toESM(require_numbro_min());
1421
+ function formatTVL(amount, average = false) {
1422
+ return (0, import_numbro5.default)(amount).formatCurrency({
1423
+ average: true,
1424
+ mantissa: 2,
1425
+ optionalMantissa: true,
1426
+ currencyPosition: "prefix"
1427
+ }).toUpperCase();
1428
+ }
1429
+
1430
+ // format/formatToke.ts
1431
+ import { formatUnits } from "viem";
1432
+ function formatTOKE(value) {
1433
+ return formatUnits(value, 18);
1434
+ }
1435
+
1436
+ // format/formatPoolName.ts
1437
+ var formatPoolName = (name) => {
1438
+ let formattedName = name.replace(/^(Curve\.fi |Balancer )/, "").replace(/Tokemak-/g, "").replace(/Wrapped Ether-/g, "").replace(/Balancer /g, "").replace(/Curve\.fi /g, "").replace(/Curve /g, "").replace(/USD Coin-/g, "").replace(/Pool/g, "").replace(/Autopilot Wrapped - /g, "");
1439
+ if (formattedName.includes(":")) {
1440
+ const parts = formattedName.split(":");
1441
+ formattedName = parts[1].trim();
1442
+ }
1443
+ return formattedName;
1444
+ };
1445
+
1446
+ // format/formatEtherNum.ts
1447
+ import { formatEther } from "viem";
1448
+ var formatEtherNum = (val) => {
1449
+ return Number(formatEther(val));
1450
+ };
1451
+
1452
+ // format/truncateAddress.ts
1453
+ var truncateAddress = (address, length = 4) => {
1454
+ if (!address)
1455
+ return null;
1456
+ return `${address.slice(0, length + 2)}...${address.slice(-length)}`;
1457
+ };
1458
+
1459
+ // format/formatLessThan.ts
1460
+ import { formatEther as formatEther2, parseEther } from "viem";
1461
+ var formatLessThan = (amount) => {
1462
+ if (parseEther("0.01") > amount) {
1463
+ return "<0.01";
1464
+ } else {
1465
+ return formatAmount(formatEther2(amount));
1466
+ }
1467
+ };
1468
+
1469
+ // format/timestampToDate.ts
1470
+ function convertTimestampToDate(timestamp) {
1471
+ if (timestamp.toString().length === 10) {
1472
+ timestamp *= 1e3;
1473
+ }
1474
+ return new Date(timestamp);
1475
+ }
1476
+
1477
+ // format/capitalizeFirstLetter.ts
1478
+ var capitalizeFirstLetter = (str) => {
1479
+ return str.charAt(0).toUpperCase() + str.slice(1);
1480
+ };
1481
+
1482
+ // format/formatDateToReadable.ts
1483
+ var formatDateToReadable = (date) => {
1484
+ const formattedDate = new Intl.DateTimeFormat("en", {
1485
+ day: "2-digit",
1486
+ month: "short",
1487
+ // Short month name (e.g., "Jan")
1488
+ year: "numeric"
1489
+ }).format(date);
1490
+ return formattedDate;
1491
+ };
1492
+
1493
+ // format/convertNumToBps.ts
1494
+ var convertNumToBps = (num) => {
1495
+ return num * 1e4;
1496
+ };
1497
+
1498
+ // format/formatUnitsNum.ts
1499
+ import { formatUnits as formatUnits2 } from "viem";
1500
+ var formatUnitsNum = (val, decimals) => {
1501
+ return Number(formatUnits2(val, decimals));
1502
+ };
1503
+
1504
+ // helpers/calculateMinAmountWithSlippage.ts
1505
+ var calculateMinAmountWithSlippage = (amount, slippage, decimals = 18) => {
1506
+ const precisionFactor = BigInt(10 ** decimals);
1507
+ const slippageBigInt = BigInt(Math.floor(slippage * Number(precisionFactor)));
1508
+ const slippageAmount = amount * slippageBigInt / precisionFactor;
1509
+ const minAmountWithSlippage = amount - slippageAmount;
1510
+ return minAmountWithSlippage;
1511
+ };
1512
+
1513
+ // helpers/getNetwork.ts
1514
+ import { ALL_NETWORKS } from "@tokemak/tokenlist";
1515
+ var getNetwork = (chainId) => {
1516
+ if (typeof chainId === "string") {
1517
+ if (chainId === "mainnet") {
1518
+ return ALL_NETWORKS.find(
1519
+ (chain) => chain.name.toLowerCase() === "ethereum"
1520
+ );
1521
+ }
1522
+ return ALL_NETWORKS.find((chain) => chain.name.toLowerCase() === chainId);
1523
+ }
1524
+ if (typeof chainId === "number") {
1525
+ return ALL_NETWORKS.find((chain) => chain.chainId === chainId);
1526
+ }
1527
+ };
1528
+
1529
+ // helpers/getProtocol.ts
1530
+ import { ALL_PROTOCOLS } from "@tokemak/tokenlist";
1531
+ var getProtocol = (protocolName) => {
1532
+ return ALL_PROTOCOLS.find(
1533
+ (protocol) => protocol.name.toLowerCase() === protocolName.toLowerCase()
1534
+ );
1535
+ };
1536
+
1537
+ // helpers/getToken.ts
1538
+ import { ALL_TOKENS } from "@tokemak/tokenlist";
1539
+ var getToken = (address, chainId) => {
1540
+ if (!address) {
1541
+ return {};
1542
+ }
1543
+ const token = ALL_TOKENS.find(
1544
+ (t) => t.address.toLowerCase() === address.toLowerCase() && (chainId ? t.chainId === chainId : true)
1545
+ );
1546
+ if (!token) {
1547
+ for (const t of ALL_TOKENS) {
1548
+ if (t.extensions?.bridgeInfo) {
1549
+ for (const chainId2 in t.extensions.bridgeInfo) {
1550
+ if (t.extensions.bridgeInfo[chainId2].tokenAddress.toLowerCase() === address.toLowerCase()) {
1551
+ return t;
1552
+ }
1553
+ }
1554
+ }
1555
+ }
1556
+ console.error("Error: Token not found:" + address);
1557
+ return {};
1558
+ }
1559
+ return token;
1560
+ };
1561
+ export {
1562
+ calculateMinAmountWithSlippage,
1563
+ capitalizeFirstLetter,
1564
+ convertChainCycleToUnix,
1565
+ convertCycleToUnix,
1566
+ convertNumToBps,
1567
+ convertSecondsToRemainingTime,
1568
+ convertStringToBigInt,
1569
+ convertTimestampToDate,
1570
+ formatAmount,
1571
+ formatCurrency,
1572
+ formatDateToReadable,
1573
+ formatEtherNum,
1574
+ formatLargeNumber,
1575
+ formatLessThan,
1576
+ formatPercent,
1577
+ formatPoolName,
1578
+ formatTOKE,
1579
+ formatTVL,
1580
+ formatUnitsNum,
1581
+ getNetwork,
1582
+ getProtocol,
1583
+ getToken,
1584
+ truncateAddress
1585
+ };