@spacego/turbo-utils 0.0.1-alpha

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 (59) hide show
  1. package/README.md +30 -0
  2. package/lib/cjs/_virtual/_commonjsHelpers.js +1 -0
  3. package/lib/cjs/_virtual/dayjs.min.js +1 -0
  4. package/lib/cjs/_virtual/dayjs.min2.js +1 -0
  5. package/lib/cjs/calc/calc.js +1 -0
  6. package/lib/cjs/calc/index.js +1 -0
  7. package/lib/cjs/day/dayjs.js +1 -0
  8. package/lib/cjs/index.js +1 -0
  9. package/lib/cjs/is/is-empty.js +1 -0
  10. package/lib/cjs/is/is-equals.js +1 -0
  11. package/lib/cjs/is/is.js +1 -0
  12. package/lib/cjs/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js +1 -0
  13. package/lib/cjs/node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js +7 -0
  14. package/lib/cjs/utils/deep-clone.js +1 -0
  15. package/lib/cjs/utils/pick.js +1 -0
  16. package/lib/cjs/utils/query2params.js +1 -0
  17. package/lib/cjs/utils/util.js +1 -0
  18. package/lib/cjs/utils/uuid.js +1 -0
  19. package/lib/cjs/validator/validate.js +1 -0
  20. package/lib/cjs/validator/validator.js +1 -0
  21. package/lib/es/_virtual/_commonjsHelpers.js +6 -0
  22. package/lib/es/_virtual/dayjs.min.js +7 -0
  23. package/lib/es/_virtual/dayjs.min2.js +4 -0
  24. package/lib/es/calc/calc.js +49 -0
  25. package/lib/es/calc/index.js +13 -0
  26. package/lib/es/day/dayjs.js +105 -0
  27. package/lib/es/index.js +76 -0
  28. package/lib/es/is/is-empty.js +6 -0
  29. package/lib/es/is/is-equals.js +28 -0
  30. package/lib/es/is/is.js +58 -0
  31. package/lib/es/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js +282 -0
  32. package/lib/es/node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js +1024 -0
  33. package/lib/es/utils/deep-clone.js +11 -0
  34. package/lib/es/utils/pick.js +11 -0
  35. package/lib/es/utils/query2params.js +58 -0
  36. package/lib/es/utils/util.js +71 -0
  37. package/lib/es/utils/uuid.js +15 -0
  38. package/lib/es/validator/validate.js +22 -0
  39. package/lib/es/validator/validator.js +84 -0
  40. package/lib/types/calc/calc.d.ts +38 -0
  41. package/lib/types/calc/index.d.ts +18 -0
  42. package/lib/types/day/dayjs.d.ts +62 -0
  43. package/lib/types/day/index.d.ts +2 -0
  44. package/lib/types/index.d.ts +5 -0
  45. package/lib/types/is/index.d.ts +3 -0
  46. package/lib/types/is/is-empty.d.ts +14 -0
  47. package/lib/types/is/is-equals.d.ts +11 -0
  48. package/lib/types/is/is.d.ts +14 -0
  49. package/lib/types/utils/classnames.d.ts +19 -0
  50. package/lib/types/utils/deep-clone.d.ts +9 -0
  51. package/lib/types/utils/index.d.ts +6 -0
  52. package/lib/types/utils/pick.d.ts +11 -0
  53. package/lib/types/utils/query2params.d.ts +56 -0
  54. package/lib/types/utils/util.d.ts +71 -0
  55. package/lib/types/utils/uuid.d.ts +13 -0
  56. package/lib/types/validator/index.d.ts +2 -0
  57. package/lib/types/validator/validate.d.ts +46 -0
  58. package/lib/types/validator/validator.d.ts +71 -0
  59. package/package.json +53 -0
@@ -0,0 +1,1024 @@
1
+ /*!
2
+ * decimal.js v10.6.0
3
+ * An arbitrary-precision Decimal type for JavaScript.
4
+ * https://github.com/MikeMcl/decimal.js
5
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
6
+ * MIT Licence
7
+ */
8
+ var $ = 9e15, V = 1e9, fe = "0123456789abcdef", x = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", y = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", ce = {
9
+ // These values must be integers within the stated ranges (inclusive).
10
+ // Most of these values can be changed at run-time using the `Decimal.config` method.
11
+ // The maximum number of significant digits of the result of a calculation or base conversion.
12
+ // E.g. `Decimal.config({ precision: 20 });`
13
+ precision: 20,
14
+ // 1 to MAX_DIGITS
15
+ // The rounding mode used when rounding to `precision`.
16
+ //
17
+ // ROUND_UP 0 Away from zero.
18
+ // ROUND_DOWN 1 Towards zero.
19
+ // ROUND_CEIL 2 Towards +Infinity.
20
+ // ROUND_FLOOR 3 Towards -Infinity.
21
+ // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
22
+ // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
23
+ // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
24
+ // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
25
+ // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
26
+ //
27
+ // E.g.
28
+ // `Decimal.rounding = 4;`
29
+ // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
30
+ rounding: 4,
31
+ // 0 to 8
32
+ // The modulo mode used when calculating the modulus: a mod n.
33
+ // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
34
+ // The remainder (r) is calculated as: r = a - n * q.
35
+ //
36
+ // UP 0 The remainder is positive if the dividend is negative, else is negative.
37
+ // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
38
+ // FLOOR 3 The remainder has the same sign as the divisor (Python %).
39
+ // HALF_EVEN 6 The IEEE 754 remainder function.
40
+ // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
41
+ //
42
+ // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
43
+ // division (9) are commonly used for the modulus operation. The other rounding modes can also
44
+ // be used, but they may not give useful results.
45
+ modulo: 1,
46
+ // 0 to 9
47
+ // The exponent value at and beneath which `toString` returns exponential notation.
48
+ // JavaScript numbers: -7
49
+ toExpNeg: -7,
50
+ // 0 to -EXP_LIMIT
51
+ // The exponent value at and above which `toString` returns exponential notation.
52
+ // JavaScript numbers: 21
53
+ toExpPos: 21,
54
+ // 0 to EXP_LIMIT
55
+ // The minimum exponent value, beneath which underflow to zero occurs.
56
+ // JavaScript numbers: -324 (5e-324)
57
+ minE: -$,
58
+ // -1 to -EXP_LIMIT
59
+ // The maximum exponent value, above which overflow to Infinity occurs.
60
+ // JavaScript numbers: 308 (1.7976931348623157e+308)
61
+ maxE: $,
62
+ // 1 to EXP_LIMIT
63
+ // Whether to use cryptographically-secure random number generation, if available.
64
+ crypto: !1
65
+ // true/false
66
+ }, we, U, m = !0, ie = "[DecimalError] ", H = ie + "Invalid argument: ", me = ie + "Precision limit exceeded", Ne = ie + "crypto unavailable", ve = "[object Decimal]", L = Math.floor, C = Math.pow, Ae = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, Le = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, Fe = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Ee = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, T = 1e7, w = 7, Oe = 9007199254740991, Ie = x.length - 1, le = y.length - 1, d = { toStringTag: ve };
67
+ d.absoluteValue = d.abs = function() {
68
+ var e = new this.constructor(this);
69
+ return e.s < 0 && (e.s = 1), p(e);
70
+ };
71
+ d.ceil = function() {
72
+ return p(new this.constructor(this), this.e + 1, 2);
73
+ };
74
+ d.clampedTo = d.clamp = function(e, i) {
75
+ var n, r = this, s = r.constructor;
76
+ if (e = new s(e), i = new s(i), !e.s || !i.s) return new s(NaN);
77
+ if (e.gt(i)) throw Error(H + i);
78
+ return n = r.cmp(e), n < 0 ? e : r.cmp(i) > 0 ? i : new s(r);
79
+ };
80
+ d.comparedTo = d.cmp = function(e) {
81
+ var i, n, r, s, t = this, o = t.d, u = (e = new t.constructor(e)).d, c = t.s, f = e.s;
82
+ if (!o || !u)
83
+ return !c || !f ? NaN : c !== f ? c : o === u ? 0 : !o ^ c < 0 ? 1 : -1;
84
+ if (!o[0] || !u[0]) return o[0] ? c : u[0] ? -f : 0;
85
+ if (c !== f) return c;
86
+ if (t.e !== e.e) return t.e > e.e ^ c < 0 ? 1 : -1;
87
+ for (r = o.length, s = u.length, i = 0, n = r < s ? r : s; i < n; ++i)
88
+ if (o[i] !== u[i]) return o[i] > u[i] ^ c < 0 ? 1 : -1;
89
+ return r === s ? 0 : r > s ^ c < 0 ? 1 : -1;
90
+ };
91
+ d.cosine = d.cos = function() {
92
+ var e, i, n = this, r = n.constructor;
93
+ return n.d ? n.d[0] ? (e = r.precision, i = r.rounding, r.precision = e + Math.max(n.e, n.sd()) + w, r.rounding = 1, n = De(r, Se(r, n)), r.precision = e, r.rounding = i, p(U == 2 || U == 3 ? n.neg() : n, e, i, !0)) : new r(1) : new r(NaN);
94
+ };
95
+ d.cubeRoot = d.cbrt = function() {
96
+ var e, i, n, r, s, t, o, u, c, f, l = this, a = l.constructor;
97
+ if (!l.isFinite() || l.isZero()) return new a(l);
98
+ for (m = !1, t = l.s * C(l.s * l, 1 / 3), !t || Math.abs(t) == 1 / 0 ? (n = S(l.d), e = l.e, (t = (e - n.length + 1) % 3) && (n += t == 1 || t == -2 ? "0" : "00"), t = C(n, 1 / 3), e = L((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2)), t == 1 / 0 ? n = "5e" + e : (n = t.toExponential(), n = n.slice(0, n.indexOf("e") + 1) + e), r = new a(n), r.s = l.s) : r = new a(t.toString()), o = (e = a.precision) + 3; ; )
99
+ if (u = r, c = u.times(u).times(u), f = c.plus(l), r = k(f.plus(l).times(u), f.plus(c), o + 2, 1), S(u.d).slice(0, o) === (n = S(r.d)).slice(0, o))
100
+ if (n = n.slice(o - 3, o + 1), n == "9999" || !s && n == "4999") {
101
+ if (!s && (p(u, e + 1, 0), u.times(u).times(u).eq(l))) {
102
+ r = u;
103
+ break;
104
+ }
105
+ o += 4, s = 1;
106
+ } else {
107
+ (!+n || !+n.slice(1) && n.charAt(0) == "5") && (p(r, e + 1, 1), i = !r.times(r).times(r).eq(l));
108
+ break;
109
+ }
110
+ return m = !0, p(r, e, a.rounding, i);
111
+ };
112
+ d.decimalPlaces = d.dp = function() {
113
+ var e, i = this.d, n = NaN;
114
+ if (i) {
115
+ if (e = i.length - 1, n = (e - L(this.e / w)) * w, e = i[e], e) for (; e % 10 == 0; e /= 10) n--;
116
+ n < 0 && (n = 0);
117
+ }
118
+ return n;
119
+ };
120
+ d.dividedBy = d.div = function(e) {
121
+ return k(this, new this.constructor(e));
122
+ };
123
+ d.dividedToIntegerBy = d.divToInt = function(e) {
124
+ var i = this, n = i.constructor;
125
+ return p(k(i, new n(e), 0, 1, 1), n.precision, n.rounding);
126
+ };
127
+ d.equals = d.eq = function(e) {
128
+ return this.cmp(e) === 0;
129
+ };
130
+ d.floor = function() {
131
+ return p(new this.constructor(this), this.e + 1, 3);
132
+ };
133
+ d.greaterThan = d.gt = function(e) {
134
+ return this.cmp(e) > 0;
135
+ };
136
+ d.greaterThanOrEqualTo = d.gte = function(e) {
137
+ var i = this.cmp(e);
138
+ return i == 1 || i === 0;
139
+ };
140
+ d.hyperbolicCosine = d.cosh = function() {
141
+ var e, i, n, r, s, t = this, o = t.constructor, u = new o(1);
142
+ if (!t.isFinite()) return new o(t.s ? 1 / 0 : NaN);
143
+ if (t.isZero()) return u;
144
+ n = o.precision, r = o.rounding, o.precision = n + Math.max(t.e, t.sd()) + 4, o.rounding = 1, s = t.d.length, s < 32 ? (e = Math.ceil(s / 3), i = (1 / re(4, e)).toString()) : (e = 16, i = "2.3283064365386962890625e-10"), t = G(o, 1, t.times(i), new o(1), !0);
145
+ for (var c, f = e, l = new o(8); f--; )
146
+ c = t.times(t), t = u.minus(c.times(l.minus(c.times(l))));
147
+ return p(t, o.precision = n, o.rounding = r, !0);
148
+ };
149
+ d.hyperbolicSine = d.sinh = function() {
150
+ var e, i, n, r, s = this, t = s.constructor;
151
+ if (!s.isFinite() || s.isZero()) return new t(s);
152
+ if (i = t.precision, n = t.rounding, t.precision = i + Math.max(s.e, s.sd()) + 4, t.rounding = 1, r = s.d.length, r < 3)
153
+ s = G(t, 2, s, s, !0);
154
+ else {
155
+ e = 1.4 * Math.sqrt(r), e = e > 16 ? 16 : e | 0, s = s.times(1 / re(5, e)), s = G(t, 2, s, s, !0);
156
+ for (var o, u = new t(5), c = new t(16), f = new t(20); e--; )
157
+ o = s.times(s), s = s.times(u.plus(o.times(c.times(o).plus(f))));
158
+ }
159
+ return t.precision = i, t.rounding = n, p(s, i, n, !0);
160
+ };
161
+ d.hyperbolicTangent = d.tanh = function() {
162
+ var e, i, n = this, r = n.constructor;
163
+ return n.isFinite() ? n.isZero() ? new r(n) : (e = r.precision, i = r.rounding, r.precision = e + 7, r.rounding = 1, k(n.sinh(), n.cosh(), r.precision = e, r.rounding = i)) : new r(n.s);
164
+ };
165
+ d.inverseCosine = d.acos = function() {
166
+ var e = this, i = e.constructor, n = e.abs().cmp(1), r = i.precision, s = i.rounding;
167
+ return n !== -1 ? n === 0 ? e.isNeg() ? _(i, r, s) : new i(0) : new i(NaN) : e.isZero() ? _(i, r + 4, s).times(0.5) : (i.precision = r + 6, i.rounding = 1, e = new i(1).minus(e).div(e.plus(1)).sqrt().atan(), i.precision = r, i.rounding = s, e.times(2));
168
+ };
169
+ d.inverseHyperbolicCosine = d.acosh = function() {
170
+ var e, i, n = this, r = n.constructor;
171
+ return n.lte(1) ? new r(n.eq(1) ? 0 : NaN) : n.isFinite() ? (e = r.precision, i = r.rounding, r.precision = e + Math.max(Math.abs(n.e), n.sd()) + 4, r.rounding = 1, m = !1, n = n.times(n).minus(1).sqrt().plus(n), m = !0, r.precision = e, r.rounding = i, n.ln()) : new r(n);
172
+ };
173
+ d.inverseHyperbolicSine = d.asinh = function() {
174
+ var e, i, n = this, r = n.constructor;
175
+ return !n.isFinite() || n.isZero() ? new r(n) : (e = r.precision, i = r.rounding, r.precision = e + 2 * Math.max(Math.abs(n.e), n.sd()) + 6, r.rounding = 1, m = !1, n = n.times(n).plus(1).sqrt().plus(n), m = !0, r.precision = e, r.rounding = i, n.ln());
176
+ };
177
+ d.inverseHyperbolicTangent = d.atanh = function() {
178
+ var e, i, n, r, s = this, t = s.constructor;
179
+ return s.isFinite() ? s.e >= 0 ? new t(s.abs().eq(1) ? s.s / 0 : s.isZero() ? s : NaN) : (e = t.precision, i = t.rounding, r = s.sd(), Math.max(r, e) < 2 * -s.e - 1 ? p(new t(s), e, i, !0) : (t.precision = n = r - s.e, s = k(s.plus(1), new t(1).minus(s), n + e, 1), t.precision = e + 4, t.rounding = 1, s = s.ln(), t.precision = e, t.rounding = i, s.times(0.5))) : new t(NaN);
180
+ };
181
+ d.inverseSine = d.asin = function() {
182
+ var e, i, n, r, s = this, t = s.constructor;
183
+ return s.isZero() ? new t(s) : (i = s.abs().cmp(1), n = t.precision, r = t.rounding, i !== -1 ? i === 0 ? (e = _(t, n + 4, r).times(0.5), e.s = s.s, e) : new t(NaN) : (t.precision = n + 6, t.rounding = 1, s = s.div(new t(1).minus(s.times(s)).sqrt().plus(1)).atan(), t.precision = n, t.rounding = r, s.times(2)));
184
+ };
185
+ d.inverseTangent = d.atan = function() {
186
+ var e, i, n, r, s, t, o, u, c, f = this, l = f.constructor, a = l.precision, h = l.rounding;
187
+ if (f.isFinite()) {
188
+ if (f.isZero())
189
+ return new l(f);
190
+ if (f.abs().eq(1) && a + 4 <= le)
191
+ return o = _(l, a + 4, h).times(0.25), o.s = f.s, o;
192
+ } else {
193
+ if (!f.s) return new l(NaN);
194
+ if (a + 4 <= le)
195
+ return o = _(l, a + 4, h).times(0.5), o.s = f.s, o;
196
+ }
197
+ for (l.precision = u = a + 10, l.rounding = 1, n = Math.min(28, u / w + 2 | 0), e = n; e; --e) f = f.div(f.times(f).plus(1).sqrt().plus(1));
198
+ for (m = !1, i = Math.ceil(u / w), r = 1, c = f.times(f), o = new l(f), s = f; e !== -1; )
199
+ if (s = s.times(c), t = o.minus(s.div(r += 2)), s = s.times(c), o = t.plus(s.div(r += 2)), o.d[i] !== void 0) for (e = i; o.d[e] === t.d[e] && e--; ) ;
200
+ return n && (o = o.times(2 << n - 1)), m = !0, p(o, l.precision = a, l.rounding = h, !0);
201
+ };
202
+ d.isFinite = function() {
203
+ return !!this.d;
204
+ };
205
+ d.isInteger = d.isInt = function() {
206
+ return !!this.d && L(this.e / w) > this.d.length - 2;
207
+ };
208
+ d.isNaN = function() {
209
+ return !this.s;
210
+ };
211
+ d.isNegative = d.isNeg = function() {
212
+ return this.s < 0;
213
+ };
214
+ d.isPositive = d.isPos = function() {
215
+ return this.s > 0;
216
+ };
217
+ d.isZero = function() {
218
+ return !!this.d && this.d[0] === 0;
219
+ };
220
+ d.lessThan = d.lt = function(e) {
221
+ return this.cmp(e) < 0;
222
+ };
223
+ d.lessThanOrEqualTo = d.lte = function(e) {
224
+ return this.cmp(e) < 1;
225
+ };
226
+ d.logarithm = d.log = function(e) {
227
+ var i, n, r, s, t, o, u, c, f = this, l = f.constructor, a = l.precision, h = l.rounding, g = 5;
228
+ if (e == null)
229
+ e = new l(10), i = !0;
230
+ else {
231
+ if (e = new l(e), n = e.d, e.s < 0 || !n || !n[0] || e.eq(1)) return new l(NaN);
232
+ i = e.eq(10);
233
+ }
234
+ if (n = f.d, f.s < 0 || !n || !n[0] || f.eq(1))
235
+ return new l(n && !n[0] ? -1 / 0 : f.s != 1 ? NaN : n ? 0 : 1 / 0);
236
+ if (i)
237
+ if (n.length > 1)
238
+ t = !0;
239
+ else {
240
+ for (s = n[0]; s % 10 === 0; ) s /= 10;
241
+ t = s !== 1;
242
+ }
243
+ if (m = !1, u = a + g, o = B(f, u), r = i ? ee(l, u + 10) : B(e, u), c = k(o, r, u, 1), X(c.d, s = a, h))
244
+ do
245
+ if (u += 10, o = B(f, u), r = i ? ee(l, u + 10) : B(e, u), c = k(o, r, u, 1), !t) {
246
+ +S(c.d).slice(s + 1, s + 15) + 1 == 1e14 && (c = p(c, a + 1, 0));
247
+ break;
248
+ }
249
+ while (X(c.d, s += 10, h));
250
+ return m = !0, p(c, a, h);
251
+ };
252
+ d.minus = d.sub = function(e) {
253
+ var i, n, r, s, t, o, u, c, f, l, a, h, g = this, v = g.constructor;
254
+ if (e = new v(e), !g.d || !e.d)
255
+ return !g.s || !e.s ? e = new v(NaN) : g.d ? e.s = -e.s : e = new v(e.d || g.s !== e.s ? g : NaN), e;
256
+ if (g.s != e.s)
257
+ return e.s = -e.s, g.plus(e);
258
+ if (f = g.d, h = e.d, u = v.precision, c = v.rounding, !f[0] || !h[0]) {
259
+ if (h[0]) e.s = -e.s;
260
+ else if (f[0]) e = new v(g);
261
+ else return new v(c === 3 ? -0 : 0);
262
+ return m ? p(e, u, c) : e;
263
+ }
264
+ if (n = L(e.e / w), l = L(g.e / w), f = f.slice(), t = l - n, t) {
265
+ for (a = t < 0, a ? (i = f, t = -t, o = h.length) : (i = h, n = l, o = f.length), r = Math.max(Math.ceil(u / w), o) + 2, t > r && (t = r, i.length = 1), i.reverse(), r = t; r--; ) i.push(0);
266
+ i.reverse();
267
+ } else {
268
+ for (r = f.length, o = h.length, a = r < o, a && (o = r), r = 0; r < o; r++)
269
+ if (f[r] != h[r]) {
270
+ a = f[r] < h[r];
271
+ break;
272
+ }
273
+ t = 0;
274
+ }
275
+ for (a && (i = f, f = h, h = i, e.s = -e.s), o = f.length, r = h.length - o; r > 0; --r) f[o++] = 0;
276
+ for (r = h.length; r > t; ) {
277
+ if (f[--r] < h[r]) {
278
+ for (s = r; s && f[--s] === 0; ) f[s] = T - 1;
279
+ --f[s], f[r] += T;
280
+ }
281
+ f[r] -= h[r];
282
+ }
283
+ for (; f[--o] === 0; ) f.pop();
284
+ for (; f[0] === 0; f.shift()) --n;
285
+ return f[0] ? (e.d = f, e.e = ne(f, n), m ? p(e, u, c) : e) : new v(c === 3 ? -0 : 0);
286
+ };
287
+ d.modulo = d.mod = function(e) {
288
+ var i, n = this, r = n.constructor;
289
+ return e = new r(e), !n.d || !e.s || e.d && !e.d[0] ? new r(NaN) : !e.d || n.d && !n.d[0] ? p(new r(n), r.precision, r.rounding) : (m = !1, r.modulo == 9 ? (i = k(n, e.abs(), 0, 3, 1), i.s *= e.s) : i = k(n, e, 0, r.modulo, 1), i = i.times(e), m = !0, n.minus(i));
290
+ };
291
+ d.naturalExponential = d.exp = function() {
292
+ return ae(this);
293
+ };
294
+ d.naturalLogarithm = d.ln = function() {
295
+ return B(this);
296
+ };
297
+ d.negated = d.neg = function() {
298
+ var e = new this.constructor(this);
299
+ return e.s = -e.s, p(e);
300
+ };
301
+ d.plus = d.add = function(e) {
302
+ var i, n, r, s, t, o, u, c, f, l, a = this, h = a.constructor;
303
+ if (e = new h(e), !a.d || !e.d)
304
+ return !a.s || !e.s ? e = new h(NaN) : a.d || (e = new h(e.d || a.s === e.s ? a : NaN)), e;
305
+ if (a.s != e.s)
306
+ return e.s = -e.s, a.minus(e);
307
+ if (f = a.d, l = e.d, u = h.precision, c = h.rounding, !f[0] || !l[0])
308
+ return l[0] || (e = new h(a)), m ? p(e, u, c) : e;
309
+ if (t = L(a.e / w), r = L(e.e / w), f = f.slice(), s = t - r, s) {
310
+ for (s < 0 ? (n = f, s = -s, o = l.length) : (n = l, r = t, o = f.length), t = Math.ceil(u / w), o = t > o ? t + 1 : o + 1, s > o && (s = o, n.length = 1), n.reverse(); s--; ) n.push(0);
311
+ n.reverse();
312
+ }
313
+ for (o = f.length, s = l.length, o - s < 0 && (s = o, n = l, l = f, f = n), i = 0; s; )
314
+ i = (f[--s] = f[s] + l[s] + i) / T | 0, f[s] %= T;
315
+ for (i && (f.unshift(i), ++r), o = f.length; f[--o] == 0; ) f.pop();
316
+ return e.d = f, e.e = ne(f, r), m ? p(e, u, c) : e;
317
+ };
318
+ d.precision = d.sd = function(e) {
319
+ var i, n = this;
320
+ if (e !== void 0 && e !== !!e && e !== 1 && e !== 0) throw Error(H + e);
321
+ return n.d ? (i = ke(n.d), e && n.e + 1 > i && (i = n.e + 1)) : i = NaN, i;
322
+ };
323
+ d.round = function() {
324
+ var e = this, i = e.constructor;
325
+ return p(new i(e), e.e + 1, i.rounding);
326
+ };
327
+ d.sine = d.sin = function() {
328
+ var e, i, n = this, r = n.constructor;
329
+ return n.isFinite() ? n.isZero() ? new r(n) : (e = r.precision, i = r.rounding, r.precision = e + Math.max(n.e, n.sd()) + w, r.rounding = 1, n = _e(r, Se(r, n)), r.precision = e, r.rounding = i, p(U > 2 ? n.neg() : n, e, i, !0)) : new r(NaN);
330
+ };
331
+ d.squareRoot = d.sqrt = function() {
332
+ var e, i, n, r, s, t, o = this, u = o.d, c = o.e, f = o.s, l = o.constructor;
333
+ if (f !== 1 || !u || !u[0])
334
+ return new l(!f || f < 0 && (!u || u[0]) ? NaN : u ? o : 1 / 0);
335
+ for (m = !1, f = Math.sqrt(+o), f == 0 || f == 1 / 0 ? (i = S(u), (i.length + c) % 2 == 0 && (i += "0"), f = Math.sqrt(i), c = L((c + 1) / 2) - (c < 0 || c % 2), f == 1 / 0 ? i = "5e" + c : (i = f.toExponential(), i = i.slice(0, i.indexOf("e") + 1) + c), r = new l(i)) : r = new l(f.toString()), n = (c = l.precision) + 3; ; )
336
+ if (t = r, r = t.plus(k(o, t, n + 2, 1)).times(0.5), S(t.d).slice(0, n) === (i = S(r.d)).slice(0, n))
337
+ if (i = i.slice(n - 3, n + 1), i == "9999" || !s && i == "4999") {
338
+ if (!s && (p(t, c + 1, 0), t.times(t).eq(o))) {
339
+ r = t;
340
+ break;
341
+ }
342
+ n += 4, s = 1;
343
+ } else {
344
+ (!+i || !+i.slice(1) && i.charAt(0) == "5") && (p(r, c + 1, 1), e = !r.times(r).eq(o));
345
+ break;
346
+ }
347
+ return m = !0, p(r, c, l.rounding, e);
348
+ };
349
+ d.tangent = d.tan = function() {
350
+ var e, i, n = this, r = n.constructor;
351
+ return n.isFinite() ? n.isZero() ? new r(n) : (e = r.precision, i = r.rounding, r.precision = e + 10, r.rounding = 1, n = n.sin(), n.s = 1, n = k(n, new r(1).minus(n.times(n)).sqrt(), e + 10, 0), r.precision = e, r.rounding = i, p(U == 2 || U == 4 ? n.neg() : n, e, i, !0)) : new r(NaN);
352
+ };
353
+ d.times = d.mul = function(e) {
354
+ var i, n, r, s, t, o, u, c, f, l = this, a = l.constructor, h = l.d, g = (e = new a(e)).d;
355
+ if (e.s *= l.s, !h || !h[0] || !g || !g[0])
356
+ return new a(!e.s || h && !h[0] && !g || g && !g[0] && !h ? NaN : !h || !g ? e.s / 0 : e.s * 0);
357
+ for (n = L(l.e / w) + L(e.e / w), c = h.length, f = g.length, c < f && (t = h, h = g, g = t, o = c, c = f, f = o), t = [], o = c + f, r = o; r--; ) t.push(0);
358
+ for (r = f; --r >= 0; ) {
359
+ for (i = 0, s = c + r; s > r; )
360
+ u = t[s] + g[r] * h[s - r - 1] + i, t[s--] = u % T | 0, i = u / T | 0;
361
+ t[s] = (t[s] + i) % T | 0;
362
+ }
363
+ for (; !t[--o]; ) t.pop();
364
+ return i ? ++n : t.shift(), e.d = t, e.e = ne(t, n), m ? p(e, a.precision, a.rounding) : e;
365
+ };
366
+ d.toBinary = function(e, i) {
367
+ return he(this, 2, e, i);
368
+ };
369
+ d.toDecimalPlaces = d.toDP = function(e, i) {
370
+ var n = this, r = n.constructor;
371
+ return n = new r(n), e === void 0 ? n : (O(e, 0, V), i === void 0 ? i = r.rounding : O(i, 0, 8), p(n, e + n.e + 1, i));
372
+ };
373
+ d.toExponential = function(e, i) {
374
+ var n, r = this, s = r.constructor;
375
+ return e === void 0 ? n = R(r, !0) : (O(e, 0, V), i === void 0 ? i = s.rounding : O(i, 0, 8), r = p(new s(r), e + 1, i), n = R(r, !0, e + 1)), r.isNeg() && !r.isZero() ? "-" + n : n;
376
+ };
377
+ d.toFixed = function(e, i) {
378
+ var n, r, s = this, t = s.constructor;
379
+ return e === void 0 ? n = R(s) : (O(e, 0, V), i === void 0 ? i = t.rounding : O(i, 0, 8), r = p(new t(s), e + s.e + 1, i), n = R(r, !1, e + r.e + 1)), s.isNeg() && !s.isZero() ? "-" + n : n;
380
+ };
381
+ d.toFraction = function(e) {
382
+ var i, n, r, s, t, o, u, c, f, l, a, h, g = this, v = g.d, N = g.constructor;
383
+ if (!v) return new N(g);
384
+ if (f = n = new N(1), r = c = new N(0), i = new N(r), t = i.e = ke(v) - g.e - 1, o = t % w, i.d[0] = C(10, o < 0 ? w + o : o), e == null)
385
+ e = t > 0 ? i : f;
386
+ else {
387
+ if (u = new N(e), !u.isInt() || u.lt(f)) throw Error(H + u);
388
+ e = u.gt(i) ? t > 0 ? i : f : u;
389
+ }
390
+ for (m = !1, u = new N(S(v)), l = N.precision, N.precision = t = v.length * w * 2; a = k(u, i, 0, 1, 1), s = n.plus(a.times(r)), s.cmp(e) != 1; )
391
+ n = r, r = s, s = f, f = c.plus(a.times(s)), c = s, s = i, i = u.minus(a.times(s)), u = s;
392
+ return s = k(e.minus(n), r, 0, 1, 1), c = c.plus(s.times(f)), n = n.plus(s.times(r)), c.s = f.s = g.s, h = k(f, r, t, 1).minus(g).abs().cmp(k(c, n, t, 1).minus(g).abs()) < 1 ? [f, r] : [c, n], N.precision = l, m = !0, h;
393
+ };
394
+ d.toHexadecimal = d.toHex = function(e, i) {
395
+ return he(this, 16, e, i);
396
+ };
397
+ d.toNearest = function(e, i) {
398
+ var n = this, r = n.constructor;
399
+ if (n = new r(n), e == null) {
400
+ if (!n.d) return n;
401
+ e = new r(1), i = r.rounding;
402
+ } else {
403
+ if (e = new r(e), i === void 0 ? i = r.rounding : O(i, 0, 8), !n.d) return e.s ? n : e;
404
+ if (!e.d)
405
+ return e.s && (e.s = n.s), e;
406
+ }
407
+ return e.d[0] ? (m = !1, n = k(n, e, 0, i, 1).times(e), m = !0, p(n)) : (e.s = n.s, n = e), n;
408
+ };
409
+ d.toNumber = function() {
410
+ return +this;
411
+ };
412
+ d.toOctal = function(e, i) {
413
+ return he(this, 8, e, i);
414
+ };
415
+ d.toPower = d.pow = function(e) {
416
+ var i, n, r, s, t, o, u = this, c = u.constructor, f = +(e = new c(e));
417
+ if (!u.d || !e.d || !u.d[0] || !e.d[0]) return new c(C(+u, f));
418
+ if (u = new c(u), u.eq(1)) return u;
419
+ if (r = c.precision, t = c.rounding, e.eq(1)) return p(u, r, t);
420
+ if (i = L(e.e / w), i >= e.d.length - 1 && (n = f < 0 ? -f : f) <= Oe)
421
+ return s = Me(c, u, n, r), e.s < 0 ? new c(1).div(s) : p(s, r, t);
422
+ if (o = u.s, o < 0) {
423
+ if (i < e.d.length - 1) return new c(NaN);
424
+ if ((e.d[i] & 1) == 0 && (o = 1), u.e == 0 && u.d[0] == 1 && u.d.length == 1)
425
+ return u.s = o, u;
426
+ }
427
+ return n = C(+u, f), i = n == 0 || !isFinite(n) ? L(f * (Math.log("0." + S(u.d)) / Math.LN10 + u.e + 1)) : new c(n + "").e, i > c.maxE + 1 || i < c.minE - 1 ? new c(i > 0 ? o / 0 : 0) : (m = !1, c.rounding = u.s = 1, n = Math.min(12, (i + "").length), s = ae(e.times(B(u, r + n)), r), s.d && (s = p(s, r + 5, 1), X(s.d, r, t) && (i = r + 10, s = p(ae(e.times(B(u, i + n)), i), i + 5, 1), +S(s.d).slice(r + 1, r + 15) + 1 == 1e14 && (s = p(s, r + 1, 0)))), s.s = o, m = !0, c.rounding = t, p(s, r, t));
428
+ };
429
+ d.toPrecision = function(e, i) {
430
+ var n, r = this, s = r.constructor;
431
+ return e === void 0 ? n = R(r, r.e <= s.toExpNeg || r.e >= s.toExpPos) : (O(e, 1, V), i === void 0 ? i = s.rounding : O(i, 0, 8), r = p(new s(r), e, i), n = R(r, e <= r.e || r.e <= s.toExpNeg, e)), r.isNeg() && !r.isZero() ? "-" + n : n;
432
+ };
433
+ d.toSignificantDigits = d.toSD = function(e, i) {
434
+ var n = this, r = n.constructor;
435
+ return e === void 0 ? (e = r.precision, i = r.rounding) : (O(e, 1, V), i === void 0 ? i = r.rounding : O(i, 0, 8)), p(new r(n), e, i);
436
+ };
437
+ d.toString = function() {
438
+ var e = this, i = e.constructor, n = R(e, e.e <= i.toExpNeg || e.e >= i.toExpPos);
439
+ return e.isNeg() && !e.isZero() ? "-" + n : n;
440
+ };
441
+ d.truncated = d.trunc = function() {
442
+ return p(new this.constructor(this), this.e + 1, 1);
443
+ };
444
+ d.valueOf = d.toJSON = function() {
445
+ var e = this, i = e.constructor, n = R(e, e.e <= i.toExpNeg || e.e >= i.toExpPos);
446
+ return e.isNeg() ? "-" + n : n;
447
+ };
448
+ function S(e) {
449
+ var i, n, r, s = e.length - 1, t = "", o = e[0];
450
+ if (s > 0) {
451
+ for (t += o, i = 1; i < s; i++)
452
+ r = e[i] + "", n = w - r.length, n && (t += b(n)), t += r;
453
+ o = e[i], r = o + "", n = w - r.length, n && (t += b(n));
454
+ } else if (o === 0)
455
+ return "0";
456
+ for (; o % 10 === 0; ) o /= 10;
457
+ return t + o;
458
+ }
459
+ function O(e, i, n) {
460
+ if (e !== ~~e || e < i || e > n)
461
+ throw Error(H + e);
462
+ }
463
+ function X(e, i, n, r) {
464
+ var s, t, o, u;
465
+ for (t = e[0]; t >= 10; t /= 10) --i;
466
+ return --i < 0 ? (i += w, s = 0) : (s = Math.ceil((i + 1) / w), i %= w), t = C(10, w - i), u = e[s] % t | 0, r == null ? i < 3 ? (i == 0 ? u = u / 100 | 0 : i == 1 && (u = u / 10 | 0), o = n < 4 && u == 99999 || n > 3 && u == 49999 || u == 5e4 || u == 0) : o = (n < 4 && u + 1 == t || n > 3 && u + 1 == t / 2) && (e[s + 1] / t / 100 | 0) == C(10, i - 2) - 1 || (u == t / 2 || u == 0) && (e[s + 1] / t / 100 | 0) == 0 : i < 4 ? (i == 0 ? u = u / 1e3 | 0 : i == 1 ? u = u / 100 | 0 : i == 2 && (u = u / 10 | 0), o = (r || n < 4) && u == 9999 || !r && n > 3 && u == 4999) : o = ((r || n < 4) && u + 1 == t || !r && n > 3 && u + 1 == t / 2) && (e[s + 1] / t / 1e3 | 0) == C(10, i - 3) - 1, o;
467
+ }
468
+ function j(e, i, n) {
469
+ for (var r, s = [0], t, o = 0, u = e.length; o < u; ) {
470
+ for (t = s.length; t--; ) s[t] *= i;
471
+ for (s[0] += fe.indexOf(e.charAt(o++)), r = 0; r < s.length; r++)
472
+ s[r] > n - 1 && (s[r + 1] === void 0 && (s[r + 1] = 0), s[r + 1] += s[r] / n | 0, s[r] %= n);
473
+ }
474
+ return s.reverse();
475
+ }
476
+ function De(e, i) {
477
+ var n, r, s;
478
+ if (i.isZero()) return i;
479
+ r = i.d.length, r < 32 ? (n = Math.ceil(r / 3), s = (1 / re(4, n)).toString()) : (n = 16, s = "2.3283064365386962890625e-10"), e.precision += n, i = G(e, 1, i.times(s), new e(1));
480
+ for (var t = n; t--; ) {
481
+ var o = i.times(i);
482
+ i = o.times(o).minus(o).times(8).plus(1);
483
+ }
484
+ return e.precision -= n, i;
485
+ }
486
+ var k = /* @__PURE__ */ (function() {
487
+ function e(r, s, t) {
488
+ var o, u = 0, c = r.length;
489
+ for (r = r.slice(); c--; )
490
+ o = r[c] * s + u, r[c] = o % t | 0, u = o / t | 0;
491
+ return u && r.unshift(u), r;
492
+ }
493
+ function i(r, s, t, o) {
494
+ var u, c;
495
+ if (t != o)
496
+ c = t > o ? 1 : -1;
497
+ else
498
+ for (u = c = 0; u < t; u++)
499
+ if (r[u] != s[u]) {
500
+ c = r[u] > s[u] ? 1 : -1;
501
+ break;
502
+ }
503
+ return c;
504
+ }
505
+ function n(r, s, t, o) {
506
+ for (var u = 0; t--; )
507
+ r[t] -= u, u = r[t] < s[t] ? 1 : 0, r[t] = u * o + r[t] - s[t];
508
+ for (; !r[0] && r.length > 1; ) r.shift();
509
+ }
510
+ return function(r, s, t, o, u, c) {
511
+ var f, l, a, h, g, v, N, F, q, I, E, P, J, Z, se, K, W, oe, D, Q, Y = r.constructor, ue = r.s == s.s ? 1 : -1, A = r.d, M = s.d;
512
+ if (!A || !A[0] || !M || !M[0])
513
+ return new Y(
514
+ // Return NaN if either NaN, or both Infinity or 0.
515
+ !r.s || !s.s || (A ? M && A[0] == M[0] : !M) ? NaN : (
516
+ // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
517
+ A && A[0] == 0 || !M ? ue * 0 : ue / 0
518
+ )
519
+ );
520
+ for (c ? (g = 1, l = r.e - s.e) : (c = T, g = w, l = L(r.e / g) - L(s.e / g)), D = M.length, W = A.length, q = new Y(ue), I = q.d = [], a = 0; M[a] == (A[a] || 0); a++) ;
521
+ if (M[a] > (A[a] || 0) && l--, t == null ? (Z = t = Y.precision, o = Y.rounding) : u ? Z = t + (r.e - s.e) + 1 : Z = t, Z < 0)
522
+ I.push(1), v = !0;
523
+ else {
524
+ if (Z = Z / g + 2 | 0, a = 0, D == 1) {
525
+ for (h = 0, M = M[0], Z++; (a < W || h) && Z--; a++)
526
+ se = h * c + (A[a] || 0), I[a] = se / M | 0, h = se % M | 0;
527
+ v = h || a < W;
528
+ } else {
529
+ for (h = c / (M[0] + 1) | 0, h > 1 && (M = e(M, h, c), A = e(A, h, c), D = M.length, W = A.length), K = D, E = A.slice(0, D), P = E.length; P < D; ) E[P++] = 0;
530
+ Q = M.slice(), Q.unshift(0), oe = M[0], M[1] >= c / 2 && ++oe;
531
+ do
532
+ h = 0, f = i(M, E, D, P), f < 0 ? (J = E[0], D != P && (J = J * c + (E[1] || 0)), h = J / oe | 0, h > 1 ? (h >= c && (h = c - 1), N = e(M, h, c), F = N.length, P = E.length, f = i(N, E, F, P), f == 1 && (h--, n(N, D < F ? Q : M, F, c))) : (h == 0 && (f = h = 1), N = M.slice()), F = N.length, F < P && N.unshift(0), n(E, N, P, c), f == -1 && (P = E.length, f = i(M, E, D, P), f < 1 && (h++, n(E, D < P ? Q : M, P, c))), P = E.length) : f === 0 && (h++, E = [0]), I[a++] = h, f && E[0] ? E[P++] = A[K] || 0 : (E = [A[K]], P = 1);
533
+ while ((K++ < W || E[0] !== void 0) && Z--);
534
+ v = E[0] !== void 0;
535
+ }
536
+ I[0] || I.shift();
537
+ }
538
+ if (g == 1)
539
+ q.e = l, we = v;
540
+ else {
541
+ for (a = 1, h = I[0]; h >= 10; h /= 10) a++;
542
+ q.e = a + l * g - 1, p(q, u ? t + q.e + 1 : t, o, v);
543
+ }
544
+ return q;
545
+ };
546
+ })();
547
+ function p(e, i, n, r) {
548
+ var s, t, o, u, c, f, l, a, h, g = e.constructor;
549
+ e: if (i != null) {
550
+ if (a = e.d, !a) return e;
551
+ for (s = 1, u = a[0]; u >= 10; u /= 10) s++;
552
+ if (t = i - s, t < 0)
553
+ t += w, o = i, l = a[h = 0], c = l / C(10, s - o - 1) % 10 | 0;
554
+ else if (h = Math.ceil((t + 1) / w), u = a.length, h >= u)
555
+ if (r) {
556
+ for (; u++ <= h; ) a.push(0);
557
+ l = c = 0, s = 1, t %= w, o = t - w + 1;
558
+ } else
559
+ break e;
560
+ else {
561
+ for (l = u = a[h], s = 1; u >= 10; u /= 10) s++;
562
+ t %= w, o = t - w + s, c = o < 0 ? 0 : l / C(10, s - o - 1) % 10 | 0;
563
+ }
564
+ if (r = r || i < 0 || a[h + 1] !== void 0 || (o < 0 ? l : l % C(10, s - o - 1)), f = n < 4 ? (c || r) && (n == 0 || n == (e.s < 0 ? 3 : 2)) : c > 5 || c == 5 && (n == 4 || r || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
565
+ (t > 0 ? o > 0 ? l / C(10, s - o) : 0 : a[h - 1]) % 10 & 1 || n == (e.s < 0 ? 8 : 7)), i < 1 || !a[0])
566
+ return a.length = 0, f ? (i -= e.e + 1, a[0] = C(10, (w - i % w) % w), e.e = -i || 0) : a[0] = e.e = 0, e;
567
+ if (t == 0 ? (a.length = h, u = 1, h--) : (a.length = h + 1, u = C(10, w - t), a[h] = o > 0 ? (l / C(10, s - o) % C(10, o) | 0) * u : 0), f)
568
+ for (; ; )
569
+ if (h == 0) {
570
+ for (t = 1, o = a[0]; o >= 10; o /= 10) t++;
571
+ for (o = a[0] += u, u = 1; o >= 10; o /= 10) u++;
572
+ t != u && (e.e++, a[0] == T && (a[0] = 1));
573
+ break;
574
+ } else {
575
+ if (a[h] += u, a[h] != T) break;
576
+ a[h--] = 0, u = 1;
577
+ }
578
+ for (t = a.length; a[--t] === 0; ) a.pop();
579
+ }
580
+ return m && (e.e > g.maxE ? (e.d = null, e.e = NaN) : e.e < g.minE && (e.e = 0, e.d = [0])), e;
581
+ }
582
+ function R(e, i, n) {
583
+ if (!e.isFinite()) return Ce(e);
584
+ var r, s = e.e, t = S(e.d), o = t.length;
585
+ return i ? (n && (r = n - o) > 0 ? t = t.charAt(0) + "." + t.slice(1) + b(r) : o > 1 && (t = t.charAt(0) + "." + t.slice(1)), t = t + (e.e < 0 ? "e" : "e+") + e.e) : s < 0 ? (t = "0." + b(-s - 1) + t, n && (r = n - o) > 0 && (t += b(r))) : s >= o ? (t += b(s + 1 - o), n && (r = n - s - 1) > 0 && (t = t + "." + b(r))) : ((r = s + 1) < o && (t = t.slice(0, r) + "." + t.slice(r)), n && (r = n - o) > 0 && (s + 1 === o && (t += "."), t += b(r))), t;
586
+ }
587
+ function ne(e, i) {
588
+ var n = e[0];
589
+ for (i *= w; n >= 10; n /= 10) i++;
590
+ return i;
591
+ }
592
+ function ee(e, i, n) {
593
+ if (i > Ie)
594
+ throw m = !0, n && (e.precision = n), Error(me);
595
+ return p(new e(x), i, 1, !0);
596
+ }
597
+ function _(e, i, n) {
598
+ if (i > le) throw Error(me);
599
+ return p(new e(y), i, n, !0);
600
+ }
601
+ function ke(e) {
602
+ var i = e.length - 1, n = i * w + 1;
603
+ if (i = e[i], i) {
604
+ for (; i % 10 == 0; i /= 10) n--;
605
+ for (i = e[0]; i >= 10; i /= 10) n++;
606
+ }
607
+ return n;
608
+ }
609
+ function b(e) {
610
+ for (var i = ""; e--; ) i += "0";
611
+ return i;
612
+ }
613
+ function Me(e, i, n, r) {
614
+ var s, t = new e(1), o = Math.ceil(r / w + 4);
615
+ for (m = !1; ; ) {
616
+ if (n % 2 && (t = t.times(i), pe(t.d, o) && (s = !0)), n = L(n / 2), n === 0) {
617
+ n = t.d.length - 1, s && t.d[n] === 0 && ++t.d[n];
618
+ break;
619
+ }
620
+ i = i.times(i), pe(i.d, o);
621
+ }
622
+ return m = !0, t;
623
+ }
624
+ function de(e) {
625
+ return e.d[e.d.length - 1] & 1;
626
+ }
627
+ function qe(e, i, n) {
628
+ for (var r, s, t = new e(i[0]), o = 0; ++o < i.length; ) {
629
+ if (s = new e(i[o]), !s.s) {
630
+ t = s;
631
+ break;
632
+ }
633
+ r = t.cmp(s), (r === n || r === 0 && t.s === n) && (t = s);
634
+ }
635
+ return t;
636
+ }
637
+ function ae(e, i) {
638
+ var n, r, s, t, o, u, c, f = 0, l = 0, a = 0, h = e.constructor, g = h.rounding, v = h.precision;
639
+ if (!e.d || !e.d[0] || e.e > 17)
640
+ return new h(e.d ? e.d[0] ? e.s < 0 ? 0 : 1 / 0 : 1 : e.s ? e.s < 0 ? 0 : e : NaN);
641
+ for (i == null ? (m = !1, c = v) : c = i, u = new h(0.03125); e.e > -2; )
642
+ e = e.times(u), a += 5;
643
+ for (r = Math.log(C(2, a)) / Math.LN10 * 2 + 5 | 0, c += r, n = t = o = new h(1), h.precision = c; ; ) {
644
+ if (t = p(t.times(e), c, 1), n = n.times(++l), u = o.plus(k(t, n, c, 1)), S(u.d).slice(0, c) === S(o.d).slice(0, c)) {
645
+ for (s = a; s--; ) o = p(o.times(o), c, 1);
646
+ if (i == null)
647
+ if (f < 3 && X(o.d, c - r, g, f))
648
+ h.precision = c += 10, n = t = u = new h(1), l = 0, f++;
649
+ else
650
+ return p(o, h.precision = v, g, m = !0);
651
+ else
652
+ return h.precision = v, o;
653
+ }
654
+ o = u;
655
+ }
656
+ }
657
+ function B(e, i) {
658
+ var n, r, s, t, o, u, c, f, l, a, h, g = 1, v = 10, N = e, F = N.d, q = N.constructor, I = q.rounding, E = q.precision;
659
+ if (N.s < 0 || !F || !F[0] || !N.e && F[0] == 1 && F.length == 1)
660
+ return new q(F && !F[0] ? -1 / 0 : N.s != 1 ? NaN : F ? 0 : N);
661
+ if (i == null ? (m = !1, l = E) : l = i, q.precision = l += v, n = S(F), r = n.charAt(0), Math.abs(t = N.e) < 15e14) {
662
+ for (; r < 7 && r != 1 || r == 1 && n.charAt(1) > 3; )
663
+ N = N.times(e), n = S(N.d), r = n.charAt(0), g++;
664
+ t = N.e, r > 1 ? (N = new q("0." + n), t++) : N = new q(r + "." + n.slice(1));
665
+ } else
666
+ return f = ee(q, l + 2, E).times(t + ""), N = B(new q(r + "." + n.slice(1)), l - v).plus(f), q.precision = E, i == null ? p(N, E, I, m = !0) : N;
667
+ for (a = N, c = o = N = k(N.minus(1), N.plus(1), l, 1), h = p(N.times(N), l, 1), s = 3; ; ) {
668
+ if (o = p(o.times(h), l, 1), f = c.plus(k(o, new q(s), l, 1)), S(f.d).slice(0, l) === S(c.d).slice(0, l))
669
+ if (c = c.times(2), t !== 0 && (c = c.plus(ee(q, l + 2, E).times(t + ""))), c = k(c, new q(g), l, 1), i == null)
670
+ if (X(c.d, l - v, I, u))
671
+ q.precision = l += v, f = o = N = k(a.minus(1), a.plus(1), l, 1), h = p(N.times(N), l, 1), s = u = 1;
672
+ else
673
+ return p(c, q.precision = E, I, m = !0);
674
+ else
675
+ return q.precision = E, c;
676
+ c = f, s += 2;
677
+ }
678
+ }
679
+ function Ce(e) {
680
+ return String(e.s * e.s / 0);
681
+ }
682
+ function z(e, i) {
683
+ var n, r, s;
684
+ for ((n = i.indexOf(".")) > -1 && (i = i.replace(".", "")), (r = i.search(/e/i)) > 0 ? (n < 0 && (n = r), n += +i.slice(r + 1), i = i.substring(0, r)) : n < 0 && (n = i.length), r = 0; i.charCodeAt(r) === 48; r++) ;
685
+ for (s = i.length; i.charCodeAt(s - 1) === 48; --s) ;
686
+ if (i = i.slice(r, s), i) {
687
+ if (s -= r, e.e = n = n - r - 1, e.d = [], r = (n + 1) % w, n < 0 && (r += w), r < s) {
688
+ for (r && e.d.push(+i.slice(0, r)), s -= w; r < s; ) e.d.push(+i.slice(r, r += w));
689
+ i = i.slice(r), r = w - i.length;
690
+ } else
691
+ r -= s;
692
+ for (; r--; ) i += "0";
693
+ e.d.push(+i), m && (e.e > e.constructor.maxE ? (e.d = null, e.e = NaN) : e.e < e.constructor.minE && (e.e = 0, e.d = [0]));
694
+ } else
695
+ e.e = 0, e.d = [0];
696
+ return e;
697
+ }
698
+ function Te(e, i) {
699
+ var n, r, s, t, o, u, c, f, l;
700
+ if (i.indexOf("_") > -1) {
701
+ if (i = i.replace(/(\d)_(?=\d)/g, "$1"), Ee.test(i)) return z(e, i);
702
+ } else if (i === "Infinity" || i === "NaN")
703
+ return +i || (e.s = NaN), e.e = NaN, e.d = null, e;
704
+ if (Le.test(i))
705
+ n = 16, i = i.toLowerCase();
706
+ else if (Ae.test(i))
707
+ n = 2;
708
+ else if (Fe.test(i))
709
+ n = 8;
710
+ else
711
+ throw Error(H + i);
712
+ for (t = i.search(/p/i), t > 0 ? (c = +i.slice(t + 1), i = i.substring(2, t)) : i = i.slice(2), t = i.indexOf("."), o = t >= 0, r = e.constructor, o && (i = i.replace(".", ""), u = i.length, t = u - t, s = Me(r, new r(n), t, t * 2)), f = j(i, n, T), l = f.length - 1, t = l; f[t] === 0; --t) f.pop();
713
+ return t < 0 ? new r(e.s * 0) : (e.e = ne(f, l), e.d = f, m = !1, o && (e = k(e, s, u * 4)), c && (e = e.times(Math.abs(c) < 54 ? C(2, c) : te.pow(2, c))), m = !0, e);
714
+ }
715
+ function _e(e, i) {
716
+ var n, r = i.d.length;
717
+ if (r < 3)
718
+ return i.isZero() ? i : G(e, 2, i, i);
719
+ n = 1.4 * Math.sqrt(r), n = n > 16 ? 16 : n | 0, i = i.times(1 / re(5, n)), i = G(e, 2, i, i);
720
+ for (var s, t = new e(5), o = new e(16), u = new e(20); n--; )
721
+ s = i.times(i), i = i.times(t.plus(s.times(o.times(s).minus(u))));
722
+ return i;
723
+ }
724
+ function G(e, i, n, r, s) {
725
+ var t, o, u, c, f = e.precision, l = Math.ceil(f / w);
726
+ for (m = !1, c = n.times(n), u = new e(r); ; ) {
727
+ if (o = k(u.times(c), new e(i++ * i++), f, 1), u = s ? r.plus(o) : r.minus(o), r = k(o.times(c), new e(i++ * i++), f, 1), o = u.plus(r), o.d[l] !== void 0) {
728
+ for (t = l; o.d[t] === u.d[t] && t--; ) ;
729
+ if (t == -1) break;
730
+ }
731
+ t = u, u = r, r = o, o = t;
732
+ }
733
+ return m = !0, o.d.length = l + 1, o;
734
+ }
735
+ function re(e, i) {
736
+ for (var n = e; --i; ) n *= e;
737
+ return n;
738
+ }
739
+ function Se(e, i) {
740
+ var n, r = i.s < 0, s = _(e, e.precision, 1), t = s.times(0.5);
741
+ if (i = i.abs(), i.lte(t))
742
+ return U = r ? 4 : 1, i;
743
+ if (n = i.divToInt(s), n.isZero())
744
+ U = r ? 3 : 2;
745
+ else {
746
+ if (i = i.minus(n.times(s)), i.lte(t))
747
+ return U = de(n) ? r ? 2 : 3 : r ? 4 : 1, i;
748
+ U = de(n) ? r ? 1 : 4 : r ? 3 : 2;
749
+ }
750
+ return i.minus(s).abs();
751
+ }
752
+ function he(e, i, n, r) {
753
+ var s, t, o, u, c, f, l, a, h, g = e.constructor, v = n !== void 0;
754
+ if (v ? (O(n, 1, V), r === void 0 ? r = g.rounding : O(r, 0, 8)) : (n = g.precision, r = g.rounding), !e.isFinite())
755
+ l = Ce(e);
756
+ else {
757
+ for (l = R(e), o = l.indexOf("."), v ? (s = 2, i == 16 ? n = n * 4 - 3 : i == 8 && (n = n * 3 - 2)) : s = i, o >= 0 && (l = l.replace(".", ""), h = new g(1), h.e = l.length - o, h.d = j(R(h), 10, s), h.e = h.d.length), a = j(l, 10, s), t = c = a.length; a[--c] == 0; ) a.pop();
758
+ if (!a[0])
759
+ l = v ? "0p+0" : "0";
760
+ else {
761
+ if (o < 0 ? t-- : (e = new g(e), e.d = a, e.e = t, e = k(e, h, n, r, 0, s), a = e.d, t = e.e, f = we), o = a[n], u = s / 2, f = f || a[n + 1] !== void 0, f = r < 4 ? (o !== void 0 || f) && (r === 0 || r === (e.s < 0 ? 3 : 2)) : o > u || o === u && (r === 4 || f || r === 6 && a[n - 1] & 1 || r === (e.s < 0 ? 8 : 7)), a.length = n, f)
762
+ for (; ++a[--n] > s - 1; )
763
+ a[n] = 0, n || (++t, a.unshift(1));
764
+ for (c = a.length; !a[c - 1]; --c) ;
765
+ for (o = 0, l = ""; o < c; o++) l += fe.charAt(a[o]);
766
+ if (v) {
767
+ if (c > 1)
768
+ if (i == 16 || i == 8) {
769
+ for (o = i == 16 ? 4 : 3, --c; c % o; c++) l += "0";
770
+ for (a = j(l, s, i), c = a.length; !a[c - 1]; --c) ;
771
+ for (o = 1, l = "1."; o < c; o++) l += fe.charAt(a[o]);
772
+ } else
773
+ l = l.charAt(0) + "." + l.slice(1);
774
+ l = l + (t < 0 ? "p" : "p+") + t;
775
+ } else if (t < 0) {
776
+ for (; ++t; ) l = "0" + l;
777
+ l = "0." + l;
778
+ } else if (++t > c) for (t -= c; t--; ) l += "0";
779
+ else t < c && (l = l.slice(0, t) + "." + l.slice(t));
780
+ }
781
+ l = (i == 16 ? "0x" : i == 2 ? "0b" : i == 8 ? "0o" : "") + l;
782
+ }
783
+ return e.s < 0 ? "-" + l : l;
784
+ }
785
+ function pe(e, i) {
786
+ if (e.length > i)
787
+ return e.length = i, !0;
788
+ }
789
+ function Re(e) {
790
+ return new this(e).abs();
791
+ }
792
+ function Ze(e) {
793
+ return new this(e).acos();
794
+ }
795
+ function Ue(e) {
796
+ return new this(e).acosh();
797
+ }
798
+ function be(e, i) {
799
+ return new this(e).plus(i);
800
+ }
801
+ function Be(e) {
802
+ return new this(e).asin();
803
+ }
804
+ function He(e) {
805
+ return new this(e).asinh();
806
+ }
807
+ function Ve(e) {
808
+ return new this(e).atan();
809
+ }
810
+ function $e(e) {
811
+ return new this(e).atanh();
812
+ }
813
+ function Ge(e, i) {
814
+ e = new this(e), i = new this(i);
815
+ var n, r = this.precision, s = this.rounding, t = r + 4;
816
+ return !e.s || !i.s ? n = new this(NaN) : !e.d && !i.d ? (n = _(this, t, 1).times(i.s > 0 ? 0.25 : 0.75), n.s = e.s) : !i.d || e.isZero() ? (n = i.s < 0 ? _(this, r, s) : new this(0), n.s = e.s) : !e.d || i.isZero() ? (n = _(this, t, 1).times(0.5), n.s = e.s) : i.s < 0 ? (this.precision = t, this.rounding = 1, n = this.atan(k(e, i, t, 1)), i = _(this, t, 1), this.precision = r, this.rounding = s, n = e.s < 0 ? n.minus(i) : n.plus(i)) : n = this.atan(k(e, i, t, 1)), n;
817
+ }
818
+ function We(e) {
819
+ return new this(e).cbrt();
820
+ }
821
+ function Xe(e) {
822
+ return p(e = new this(e), e.e + 1, 2);
823
+ }
824
+ function Je(e, i, n) {
825
+ return new this(e).clamp(i, n);
826
+ }
827
+ function Ke(e) {
828
+ if (!e || typeof e != "object") throw Error(ie + "Object expected");
829
+ var i, n, r, s = e.defaults === !0, t = [
830
+ "precision",
831
+ 1,
832
+ V,
833
+ "rounding",
834
+ 0,
835
+ 8,
836
+ "toExpNeg",
837
+ -$,
838
+ 0,
839
+ "toExpPos",
840
+ 0,
841
+ $,
842
+ "maxE",
843
+ 0,
844
+ $,
845
+ "minE",
846
+ -$,
847
+ 0,
848
+ "modulo",
849
+ 0,
850
+ 9
851
+ ];
852
+ for (i = 0; i < t.length; i += 3)
853
+ if (n = t[i], s && (this[n] = ce[n]), (r = e[n]) !== void 0)
854
+ if (L(r) === r && r >= t[i + 1] && r <= t[i + 2]) this[n] = r;
855
+ else throw Error(H + n + ": " + r);
856
+ if (n = "crypto", s && (this[n] = ce[n]), (r = e[n]) !== void 0)
857
+ if (r === !0 || r === !1 || r === 0 || r === 1)
858
+ if (r)
859
+ if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
860
+ this[n] = !0;
861
+ else
862
+ throw Error(Ne);
863
+ else
864
+ this[n] = !1;
865
+ else
866
+ throw Error(H + n + ": " + r);
867
+ return this;
868
+ }
869
+ function Qe(e) {
870
+ return new this(e).cos();
871
+ }
872
+ function Ye(e) {
873
+ return new this(e).cosh();
874
+ }
875
+ function Pe(e) {
876
+ var i, n, r;
877
+ function s(t) {
878
+ var o, u, c, f = this;
879
+ if (!(f instanceof s)) return new s(t);
880
+ if (f.constructor = s, ge(t)) {
881
+ f.s = t.s, m ? !t.d || t.e > s.maxE ? (f.e = NaN, f.d = null) : t.e < s.minE ? (f.e = 0, f.d = [0]) : (f.e = t.e, f.d = t.d.slice()) : (f.e = t.e, f.d = t.d ? t.d.slice() : t.d);
882
+ return;
883
+ }
884
+ if (c = typeof t, c === "number") {
885
+ if (t === 0) {
886
+ f.s = 1 / t < 0 ? -1 : 1, f.e = 0, f.d = [0];
887
+ return;
888
+ }
889
+ if (t < 0 ? (t = -t, f.s = -1) : f.s = 1, t === ~~t && t < 1e7) {
890
+ for (o = 0, u = t; u >= 10; u /= 10) o++;
891
+ m ? o > s.maxE ? (f.e = NaN, f.d = null) : o < s.minE ? (f.e = 0, f.d = [0]) : (f.e = o, f.d = [t]) : (f.e = o, f.d = [t]);
892
+ return;
893
+ }
894
+ if (t * 0 !== 0) {
895
+ t || (f.s = NaN), f.e = NaN, f.d = null;
896
+ return;
897
+ }
898
+ return z(f, t.toString());
899
+ }
900
+ if (c === "string")
901
+ return (u = t.charCodeAt(0)) === 45 ? (t = t.slice(1), f.s = -1) : (u === 43 && (t = t.slice(1)), f.s = 1), Ee.test(t) ? z(f, t) : Te(f, t);
902
+ if (c === "bigint")
903
+ return t < 0 ? (t = -t, f.s = -1) : f.s = 1, z(f, t.toString());
904
+ throw Error(H + t);
905
+ }
906
+ if (s.prototype = d, s.ROUND_UP = 0, s.ROUND_DOWN = 1, s.ROUND_CEIL = 2, s.ROUND_FLOOR = 3, s.ROUND_HALF_UP = 4, s.ROUND_HALF_DOWN = 5, s.ROUND_HALF_EVEN = 6, s.ROUND_HALF_CEIL = 7, s.ROUND_HALF_FLOOR = 8, s.EUCLID = 9, s.config = s.set = Ke, s.clone = Pe, s.isDecimal = ge, s.abs = Re, s.acos = Ze, s.acosh = Ue, s.add = be, s.asin = Be, s.asinh = He, s.atan = Ve, s.atanh = $e, s.atan2 = Ge, s.cbrt = We, s.ceil = Xe, s.clamp = Je, s.cos = Qe, s.cosh = Ye, s.div = je, s.exp = ze, s.floor = xe, s.hypot = ye, s.ln = ei, s.log = ii, s.log10 = ri, s.log2 = ni, s.max = ti, s.min = si, s.mod = oi, s.mul = ui, s.pow = fi, s.random = ci, s.round = li, s.sign = ai, s.sin = hi, s.sinh = di, s.sqrt = pi, s.sub = gi, s.sum = wi, s.tan = mi, s.tanh = Ni, s.trunc = vi, e === void 0 && (e = {}), e && e.defaults !== !0)
907
+ for (r = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], i = 0; i < r.length; ) e.hasOwnProperty(n = r[i++]) || (e[n] = this[n]);
908
+ return s.config(e), s;
909
+ }
910
+ function je(e, i) {
911
+ return new this(e).div(i);
912
+ }
913
+ function ze(e) {
914
+ return new this(e).exp();
915
+ }
916
+ function xe(e) {
917
+ return p(e = new this(e), e.e + 1, 3);
918
+ }
919
+ function ye() {
920
+ var e, i, n = new this(0);
921
+ for (m = !1, e = 0; e < arguments.length; )
922
+ if (i = new this(arguments[e++]), i.d)
923
+ n.d && (n = n.plus(i.times(i)));
924
+ else {
925
+ if (i.s)
926
+ return m = !0, new this(1 / 0);
927
+ n = i;
928
+ }
929
+ return m = !0, n.sqrt();
930
+ }
931
+ function ge(e) {
932
+ return e instanceof te || e && e.toStringTag === ve || !1;
933
+ }
934
+ function ei(e) {
935
+ return new this(e).ln();
936
+ }
937
+ function ii(e, i) {
938
+ return new this(e).log(i);
939
+ }
940
+ function ni(e) {
941
+ return new this(e).log(2);
942
+ }
943
+ function ri(e) {
944
+ return new this(e).log(10);
945
+ }
946
+ function ti() {
947
+ return qe(this, arguments, -1);
948
+ }
949
+ function si() {
950
+ return qe(this, arguments, 1);
951
+ }
952
+ function oi(e, i) {
953
+ return new this(e).mod(i);
954
+ }
955
+ function ui(e, i) {
956
+ return new this(e).mul(i);
957
+ }
958
+ function fi(e, i) {
959
+ return new this(e).pow(i);
960
+ }
961
+ function ci(e) {
962
+ var i, n, r, s, t = 0, o = new this(1), u = [];
963
+ if (e === void 0 ? e = this.precision : O(e, 1, V), r = Math.ceil(e / w), this.crypto)
964
+ if (crypto.getRandomValues)
965
+ for (i = crypto.getRandomValues(new Uint32Array(r)); t < r; )
966
+ s = i[t], s >= 429e7 ? i[t] = crypto.getRandomValues(new Uint32Array(1))[0] : u[t++] = s % 1e7;
967
+ else if (crypto.randomBytes) {
968
+ for (i = crypto.randomBytes(r *= 4); t < r; )
969
+ s = i[t] + (i[t + 1] << 8) + (i[t + 2] << 16) + ((i[t + 3] & 127) << 24), s >= 214e7 ? crypto.randomBytes(4).copy(i, t) : (u.push(s % 1e7), t += 4);
970
+ t = r / 4;
971
+ } else
972
+ throw Error(Ne);
973
+ else for (; t < r; ) u[t++] = Math.random() * 1e7 | 0;
974
+ for (r = u[--t], e %= w, r && e && (s = C(10, w - e), u[t] = (r / s | 0) * s); u[t] === 0; t--) u.pop();
975
+ if (t < 0)
976
+ n = 0, u = [0];
977
+ else {
978
+ for (n = -1; u[0] === 0; n -= w) u.shift();
979
+ for (r = 1, s = u[0]; s >= 10; s /= 10) r++;
980
+ r < w && (n -= w - r);
981
+ }
982
+ return o.e = n, o.d = u, o;
983
+ }
984
+ function li(e) {
985
+ return p(e = new this(e), e.e + 1, this.rounding);
986
+ }
987
+ function ai(e) {
988
+ return e = new this(e), e.d ? e.d[0] ? e.s : 0 * e.s : e.s || NaN;
989
+ }
990
+ function hi(e) {
991
+ return new this(e).sin();
992
+ }
993
+ function di(e) {
994
+ return new this(e).sinh();
995
+ }
996
+ function pi(e) {
997
+ return new this(e).sqrt();
998
+ }
999
+ function gi(e, i) {
1000
+ return new this(e).sub(i);
1001
+ }
1002
+ function wi() {
1003
+ var e = 0, i = arguments, n = new this(i[e]);
1004
+ for (m = !1; n.s && ++e < i.length; ) n = n.plus(i[e]);
1005
+ return m = !0, p(n, this.precision, this.rounding);
1006
+ }
1007
+ function mi(e) {
1008
+ return new this(e).tan();
1009
+ }
1010
+ function Ni(e) {
1011
+ return new this(e).tanh();
1012
+ }
1013
+ function vi(e) {
1014
+ return p(e = new this(e), e.e + 1, 1);
1015
+ }
1016
+ d[Symbol.for("nodejs.util.inspect.custom")] = d.toString;
1017
+ d[Symbol.toStringTag] = "Decimal";
1018
+ var te = d.constructor = Pe(ce);
1019
+ x = new te(x);
1020
+ y = new te(y);
1021
+ export {
1022
+ te as Decimal,
1023
+ te as default
1024
+ };