@skip-go/client 0.17.2 → 1.0.0-alpha-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/api/getAssets.d.mts +19 -0
  2. package/dist/api/getAssets.mjs +25 -0
  3. package/dist/api/getAssetsBetweenChains.d.mts +56 -0
  4. package/dist/api/getAssetsBetweenChains.mjs +9 -0
  5. package/dist/api/getBridges.d.mts +54 -0
  6. package/dist/api/getBridges.mjs +10 -0
  7. package/dist/api/getChains.d.mts +41 -0
  8. package/dist/api/getChains.mjs +16 -0
  9. package/dist/api/getVenues.d.mts +13 -0
  10. package/dist/api/getVenues.mjs +10 -0
  11. package/dist/api/postAssetsFromSource.d.mts +13 -0
  12. package/dist/api/postAssetsFromSource.mjs +14 -0
  13. package/dist/api/postBalances.d.mts +35 -0
  14. package/dist/api/postBalances.mjs +16 -0
  15. package/dist/api/postIbcOriginAssets.d.mts +32 -0
  16. package/dist/api/postIbcOriginAssets.mjs +11 -0
  17. package/dist/api/postMessages.d.mts +528 -0
  18. package/dist/api/postMessages.mjs +10 -0
  19. package/dist/api/postMessagesDirect.d.mts +568 -0
  20. package/dist/api/postMessagesDirect.mjs +10 -0
  21. package/dist/api/postRecommendAssets.d.mts +40 -0
  22. package/dist/api/postRecommendAssets.mjs +13 -0
  23. package/dist/api/postRoute.d.mts +460 -0
  24. package/dist/api/postRoute.mjs +16 -0
  25. package/dist/api/postSubmitTransaction.d.mts +13 -0
  26. package/dist/api/postSubmitTransaction.mjs +10 -0
  27. package/dist/api/postTrackTransaction.d.mts +13 -0
  28. package/dist/api/postTrackTransaction.mjs +11 -0
  29. package/dist/api/postTransactionStatus.d.mts +559 -0
  30. package/dist/api/postTransactionStatus.mjs +10 -0
  31. package/dist/apiState-CdzxTxYd.d.mts +6 -0
  32. package/dist/chunk-AXBFBHS2.mjs +41 -0
  33. package/dist/client-types-CVch1pZ-.d.mts +60 -0
  34. package/dist/executeRoute-CRdeEz1o.d.mts +69 -0
  35. package/dist/generateApi-3mHZ6Zbr.d.mts +22 -0
  36. package/dist/index.d.mts +35 -0
  37. package/dist/index.mjs +24 -0
  38. package/dist/public-functions/executeRoute.d.mts +9 -0
  39. package/dist/public-functions/executeRoute.mjs +100 -0
  40. package/dist/public-functions/getFeeInfoForChain.d.mts +9 -0
  41. package/dist/public-functions/getFeeInfoForChain.mjs +47 -0
  42. package/dist/public-functions/getRecommendedGasPrice.d.mts +9 -0
  43. package/dist/public-functions/getRecommendedGasPrice.mjs +1366 -0
  44. package/dist/public-functions/getSigningStargateClient.d.mts +13 -0
  45. package/dist/public-functions/getSigningStargateClient.mjs +32 -0
  46. package/dist/public-functions/setApiOptions.d.mts +9 -0
  47. package/dist/public-functions/setApiOptions.mjs +46 -0
  48. package/dist/public-functions/setClientOptions.d.mts +9 -0
  49. package/dist/public-functions/setClientOptions.mjs +34 -0
  50. package/dist/setClientOptions-CVB_OUIn.d.mts +19 -0
  51. package/dist/swaggerTypes-O9-gvCT1.d.mts +1890 -0
  52. package/package.json +10 -4
  53. package/dist/index.d.ts +0 -2336
  54. package/dist/index.js +0 -264
@@ -0,0 +1,1366 @@
1
+ import { __async } from '../chunk-AXBFBHS2.mjs';
2
+ import { Decimal } from '@cosmjs/math/build/decimal';
3
+ import { GasPrice } from '@cosmjs/stargate';
4
+ import { getFeeInfoForChain } from 'src/public-functions/getFeeInfoForChain.mjs';
5
+
6
+ // ../../node_modules/bignumber.js/bignumber.mjs
7
+ var isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
8
+ var mathceil = Math.ceil;
9
+ var mathfloor = Math.floor;
10
+ var bignumberError = "[BigNumber Error] ";
11
+ var tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ";
12
+ var BASE = 1e14;
13
+ var LOG_BASE = 14;
14
+ var MAX_SAFE_INTEGER = 9007199254740991;
15
+ var POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13];
16
+ var SQRT_BASE = 1e7;
17
+ var MAX = 1e9;
18
+ function clone(configObject) {
19
+ var div, convertBase, parseNumeric, P = BigNumber2.prototype = { constructor: BigNumber2, toString: null, valueOf: null }, ONE = new BigNumber2(1), DECIMAL_PLACES = 20, ROUNDING_MODE = 4, TO_EXP_NEG = -7, TO_EXP_POS = 21, MIN_EXP = -1e7, MAX_EXP = 1e7, CRYPTO = false, MODULO_MODE = 1, POW_PRECISION = 0, FORMAT = {
20
+ prefix: "",
21
+ groupSize: 3,
22
+ secondaryGroupSize: 0,
23
+ groupSeparator: ",",
24
+ decimalSeparator: ".",
25
+ fractionGroupSize: 0,
26
+ fractionGroupSeparator: "\xA0",
27
+ // non-breaking space
28
+ suffix: ""
29
+ }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
30
+ function BigNumber2(v, b) {
31
+ var alphabet, c, caseChanged, e, i, isNum, len, str, x = this;
32
+ if (!(x instanceof BigNumber2)) return new BigNumber2(v, b);
33
+ if (b == null) {
34
+ if (v && v._isBigNumber === true) {
35
+ x.s = v.s;
36
+ if (!v.c || v.e > MAX_EXP) {
37
+ x.c = x.e = null;
38
+ } else if (v.e < MIN_EXP) {
39
+ x.c = [x.e = 0];
40
+ } else {
41
+ x.e = v.e;
42
+ x.c = v.c.slice();
43
+ }
44
+ return;
45
+ }
46
+ if ((isNum = typeof v == "number") && v * 0 == 0) {
47
+ x.s = 1 / v < 0 ? (v = -v, -1) : 1;
48
+ if (v === ~~v) {
49
+ for (e = 0, i = v; i >= 10; i /= 10, e++) ;
50
+ if (e > MAX_EXP) {
51
+ x.c = x.e = null;
52
+ } else {
53
+ x.e = e;
54
+ x.c = [v];
55
+ }
56
+ return;
57
+ }
58
+ str = String(v);
59
+ } else {
60
+ if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
61
+ x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
62
+ }
63
+ if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
64
+ if ((i = str.search(/e/i)) > 0) {
65
+ if (e < 0) e = i;
66
+ e += +str.slice(i + 1);
67
+ str = str.substring(0, i);
68
+ } else if (e < 0) {
69
+ e = str.length;
70
+ }
71
+ } else {
72
+ intCheck(b, 2, ALPHABET.length, "Base");
73
+ if (b == 10 && alphabetHasNormalDecimalDigits) {
74
+ x = new BigNumber2(v);
75
+ return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
76
+ }
77
+ str = String(v);
78
+ if (isNum = typeof v == "number") {
79
+ if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
80
+ x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
81
+ if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
82
+ throw Error(tooManyDigits + v);
83
+ }
84
+ } else {
85
+ x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
86
+ }
87
+ alphabet = ALPHABET.slice(0, b);
88
+ e = i = 0;
89
+ for (len = str.length; i < len; i++) {
90
+ if (alphabet.indexOf(c = str.charAt(i)) < 0) {
91
+ if (c == ".") {
92
+ if (i > e) {
93
+ e = len;
94
+ continue;
95
+ }
96
+ } else if (!caseChanged) {
97
+ if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
98
+ caseChanged = true;
99
+ i = -1;
100
+ e = 0;
101
+ continue;
102
+ }
103
+ }
104
+ return parseNumeric(x, String(v), isNum, b);
105
+ }
106
+ }
107
+ isNum = false;
108
+ str = convertBase(str, b, 10, x.s);
109
+ if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
110
+ else e = str.length;
111
+ }
112
+ for (i = 0; str.charCodeAt(i) === 48; i++) ;
113
+ for (len = str.length; str.charCodeAt(--len) === 48; ) ;
114
+ if (str = str.slice(i, ++len)) {
115
+ len -= i;
116
+ if (isNum && BigNumber2.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
117
+ throw Error(tooManyDigits + x.s * v);
118
+ }
119
+ if ((e = e - i - 1) > MAX_EXP) {
120
+ x.c = x.e = null;
121
+ } else if (e < MIN_EXP) {
122
+ x.c = [x.e = 0];
123
+ } else {
124
+ x.e = e;
125
+ x.c = [];
126
+ i = (e + 1) % LOG_BASE;
127
+ if (e < 0) i += LOG_BASE;
128
+ if (i < len) {
129
+ if (i) x.c.push(+str.slice(0, i));
130
+ for (len -= LOG_BASE; i < len; ) {
131
+ x.c.push(+str.slice(i, i += LOG_BASE));
132
+ }
133
+ i = LOG_BASE - (str = str.slice(i)).length;
134
+ } else {
135
+ i -= len;
136
+ }
137
+ for (; i--; str += "0") ;
138
+ x.c.push(+str);
139
+ }
140
+ } else {
141
+ x.c = [x.e = 0];
142
+ }
143
+ }
144
+ BigNumber2.clone = clone;
145
+ BigNumber2.ROUND_UP = 0;
146
+ BigNumber2.ROUND_DOWN = 1;
147
+ BigNumber2.ROUND_CEIL = 2;
148
+ BigNumber2.ROUND_FLOOR = 3;
149
+ BigNumber2.ROUND_HALF_UP = 4;
150
+ BigNumber2.ROUND_HALF_DOWN = 5;
151
+ BigNumber2.ROUND_HALF_EVEN = 6;
152
+ BigNumber2.ROUND_HALF_CEIL = 7;
153
+ BigNumber2.ROUND_HALF_FLOOR = 8;
154
+ BigNumber2.EUCLID = 9;
155
+ BigNumber2.config = BigNumber2.set = function(obj) {
156
+ var p, v;
157
+ if (obj != null) {
158
+ if (typeof obj == "object") {
159
+ if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) {
160
+ v = obj[p];
161
+ intCheck(v, 0, MAX, p);
162
+ DECIMAL_PLACES = v;
163
+ }
164
+ if (obj.hasOwnProperty(p = "ROUNDING_MODE")) {
165
+ v = obj[p];
166
+ intCheck(v, 0, 8, p);
167
+ ROUNDING_MODE = v;
168
+ }
169
+ if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) {
170
+ v = obj[p];
171
+ if (v && v.pop) {
172
+ intCheck(v[0], -MAX, 0, p);
173
+ intCheck(v[1], 0, MAX, p);
174
+ TO_EXP_NEG = v[0];
175
+ TO_EXP_POS = v[1];
176
+ } else {
177
+ intCheck(v, -MAX, MAX, p);
178
+ TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
179
+ }
180
+ }
181
+ if (obj.hasOwnProperty(p = "RANGE")) {
182
+ v = obj[p];
183
+ if (v && v.pop) {
184
+ intCheck(v[0], -MAX, -1, p);
185
+ intCheck(v[1], 1, MAX, p);
186
+ MIN_EXP = v[0];
187
+ MAX_EXP = v[1];
188
+ } else {
189
+ intCheck(v, -MAX, MAX, p);
190
+ if (v) {
191
+ MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
192
+ } else {
193
+ throw Error(bignumberError + p + " cannot be zero: " + v);
194
+ }
195
+ }
196
+ }
197
+ if (obj.hasOwnProperty(p = "CRYPTO")) {
198
+ v = obj[p];
199
+ if (v === !!v) {
200
+ if (v) {
201
+ if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
202
+ CRYPTO = v;
203
+ } else {
204
+ CRYPTO = !v;
205
+ throw Error(bignumberError + "crypto unavailable");
206
+ }
207
+ } else {
208
+ CRYPTO = v;
209
+ }
210
+ } else {
211
+ throw Error(bignumberError + p + " not true or false: " + v);
212
+ }
213
+ }
214
+ if (obj.hasOwnProperty(p = "MODULO_MODE")) {
215
+ v = obj[p];
216
+ intCheck(v, 0, 9, p);
217
+ MODULO_MODE = v;
218
+ }
219
+ if (obj.hasOwnProperty(p = "POW_PRECISION")) {
220
+ v = obj[p];
221
+ intCheck(v, 0, MAX, p);
222
+ POW_PRECISION = v;
223
+ }
224
+ if (obj.hasOwnProperty(p = "FORMAT")) {
225
+ v = obj[p];
226
+ if (typeof v == "object") FORMAT = v;
227
+ else throw Error(bignumberError + p + " not an object: " + v);
228
+ }
229
+ if (obj.hasOwnProperty(p = "ALPHABET")) {
230
+ v = obj[p];
231
+ if (typeof v == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) {
232
+ alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789";
233
+ ALPHABET = v;
234
+ } else {
235
+ throw Error(bignumberError + p + " invalid: " + v);
236
+ }
237
+ }
238
+ } else {
239
+ throw Error(bignumberError + "Object expected: " + obj);
240
+ }
241
+ }
242
+ return {
243
+ DECIMAL_PLACES,
244
+ ROUNDING_MODE,
245
+ EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
246
+ RANGE: [MIN_EXP, MAX_EXP],
247
+ CRYPTO,
248
+ MODULO_MODE,
249
+ POW_PRECISION,
250
+ FORMAT,
251
+ ALPHABET
252
+ };
253
+ };
254
+ BigNumber2.isBigNumber = function(v) {
255
+ if (!v || v._isBigNumber !== true) return false;
256
+ if (!BigNumber2.DEBUG) return true;
257
+ var i, n, c = v.c, e = v.e, s = v.s;
258
+ out: if ({}.toString.call(c) == "[object Array]") {
259
+ if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
260
+ if (c[0] === 0) {
261
+ if (e === 0 && c.length === 1) return true;
262
+ break out;
263
+ }
264
+ i = (e + 1) % LOG_BASE;
265
+ if (i < 1) i += LOG_BASE;
266
+ if (String(c[0]).length == i) {
267
+ for (i = 0; i < c.length; i++) {
268
+ n = c[i];
269
+ if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
270
+ }
271
+ if (n !== 0) return true;
272
+ }
273
+ }
274
+ } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
275
+ return true;
276
+ }
277
+ throw Error(bignumberError + "Invalid BigNumber: " + v);
278
+ };
279
+ BigNumber2.maximum = BigNumber2.max = function() {
280
+ return maxOrMin(arguments, -1);
281
+ };
282
+ BigNumber2.minimum = BigNumber2.min = function() {
283
+ return maxOrMin(arguments, 1);
284
+ };
285
+ BigNumber2.random = function() {
286
+ var pow2_53 = 9007199254740992;
287
+ var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
288
+ return mathfloor(Math.random() * pow2_53);
289
+ } : function() {
290
+ return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
291
+ };
292
+ return function(dp) {
293
+ var a, b, e, k, v, i = 0, c = [], rand = new BigNumber2(ONE);
294
+ if (dp == null) dp = DECIMAL_PLACES;
295
+ else intCheck(dp, 0, MAX);
296
+ k = mathceil(dp / LOG_BASE);
297
+ if (CRYPTO) {
298
+ if (crypto.getRandomValues) {
299
+ a = crypto.getRandomValues(new Uint32Array(k *= 2));
300
+ for (; i < k; ) {
301
+ v = a[i] * 131072 + (a[i + 1] >>> 11);
302
+ if (v >= 9e15) {
303
+ b = crypto.getRandomValues(new Uint32Array(2));
304
+ a[i] = b[0];
305
+ a[i + 1] = b[1];
306
+ } else {
307
+ c.push(v % 1e14);
308
+ i += 2;
309
+ }
310
+ }
311
+ i = k / 2;
312
+ } else if (crypto.randomBytes) {
313
+ a = crypto.randomBytes(k *= 7);
314
+ for (; i < k; ) {
315
+ v = (a[i] & 31) * 281474976710656 + a[i + 1] * 1099511627776 + a[i + 2] * 4294967296 + a[i + 3] * 16777216 + (a[i + 4] << 16) + (a[i + 5] << 8) + a[i + 6];
316
+ if (v >= 9e15) {
317
+ crypto.randomBytes(7).copy(a, i);
318
+ } else {
319
+ c.push(v % 1e14);
320
+ i += 7;
321
+ }
322
+ }
323
+ i = k / 7;
324
+ } else {
325
+ CRYPTO = false;
326
+ throw Error(bignumberError + "crypto unavailable");
327
+ }
328
+ }
329
+ if (!CRYPTO) {
330
+ for (; i < k; ) {
331
+ v = random53bitInt();
332
+ if (v < 9e15) c[i++] = v % 1e14;
333
+ }
334
+ }
335
+ k = c[--i];
336
+ dp %= LOG_BASE;
337
+ if (k && dp) {
338
+ v = POWS_TEN[LOG_BASE - dp];
339
+ c[i] = mathfloor(k / v) * v;
340
+ }
341
+ for (; c[i] === 0; c.pop(), i--) ;
342
+ if (i < 0) {
343
+ c = [e = 0];
344
+ } else {
345
+ for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) ;
346
+ for (i = 1, v = c[0]; v >= 10; v /= 10, i++) ;
347
+ if (i < LOG_BASE) e -= LOG_BASE - i;
348
+ }
349
+ rand.e = e;
350
+ rand.c = c;
351
+ return rand;
352
+ };
353
+ }();
354
+ BigNumber2.sum = function() {
355
+ var i = 1, args = arguments, sum = new BigNumber2(args[0]);
356
+ for (; i < args.length; ) sum = sum.plus(args[i++]);
357
+ return sum;
358
+ };
359
+ convertBase = /* @__PURE__ */ function() {
360
+ var decimal = "0123456789";
361
+ function toBaseOut(str, baseIn, baseOut, alphabet) {
362
+ var j, arr = [0], arrL, i = 0, len = str.length;
363
+ for (; i < len; ) {
364
+ for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
365
+ arr[0] += alphabet.indexOf(str.charAt(i++));
366
+ for (j = 0; j < arr.length; j++) {
367
+ if (arr[j] > baseOut - 1) {
368
+ if (arr[j + 1] == null) arr[j + 1] = 0;
369
+ arr[j + 1] += arr[j] / baseOut | 0;
370
+ arr[j] %= baseOut;
371
+ }
372
+ }
373
+ }
374
+ return arr.reverse();
375
+ }
376
+ return function(str, baseIn, baseOut, sign, callerIsToString) {
377
+ var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
378
+ if (i >= 0) {
379
+ k = POW_PRECISION;
380
+ POW_PRECISION = 0;
381
+ str = str.replace(".", "");
382
+ y = new BigNumber2(baseIn);
383
+ x = y.pow(str.length - i);
384
+ POW_PRECISION = k;
385
+ y.c = toBaseOut(
386
+ toFixedPoint(coeffToString(x.c), x.e, "0"),
387
+ 10,
388
+ baseOut,
389
+ decimal
390
+ );
391
+ y.e = y.c.length;
392
+ }
393
+ xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
394
+ e = k = xc.length;
395
+ for (; xc[--k] == 0; xc.pop()) ;
396
+ if (!xc[0]) return alphabet.charAt(0);
397
+ if (i < 0) {
398
+ --e;
399
+ } else {
400
+ x.c = xc;
401
+ x.e = e;
402
+ x.s = sign;
403
+ x = div(x, y, dp, rm, baseOut);
404
+ xc = x.c;
405
+ r = x.r;
406
+ e = x.e;
407
+ }
408
+ d = e + dp + 1;
409
+ i = xc[d];
410
+ k = baseOut / 2;
411
+ r = r || d < 0 || xc[d + 1] != null;
412
+ r = rm < 4 ? (i != null || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : i > k || i == k && (rm == 4 || r || rm == 6 && xc[d - 1] & 1 || rm == (x.s < 0 ? 8 : 7));
413
+ if (d < 1 || !xc[0]) {
414
+ str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
415
+ } else {
416
+ xc.length = d;
417
+ if (r) {
418
+ for (--baseOut; ++xc[--d] > baseOut; ) {
419
+ xc[d] = 0;
420
+ if (!d) {
421
+ ++e;
422
+ xc = [1].concat(xc);
423
+ }
424
+ }
425
+ }
426
+ for (k = xc.length; !xc[--k]; ) ;
427
+ for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) ;
428
+ str = toFixedPoint(str, e, alphabet.charAt(0));
429
+ }
430
+ return str;
431
+ };
432
+ }();
433
+ div = /* @__PURE__ */ function() {
434
+ function multiply(x, k, base) {
435
+ var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0;
436
+ for (x = x.slice(); i--; ) {
437
+ xlo = x[i] % SQRT_BASE;
438
+ xhi = x[i] / SQRT_BASE | 0;
439
+ m = khi * xlo + xhi * klo;
440
+ temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;
441
+ carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
442
+ x[i] = temp % base;
443
+ }
444
+ if (carry) x = [carry].concat(x);
445
+ return x;
446
+ }
447
+ function compare2(a, b, aL, bL) {
448
+ var i, cmp;
449
+ if (aL != bL) {
450
+ cmp = aL > bL ? 1 : -1;
451
+ } else {
452
+ for (i = cmp = 0; i < aL; i++) {
453
+ if (a[i] != b[i]) {
454
+ cmp = a[i] > b[i] ? 1 : -1;
455
+ break;
456
+ }
457
+ }
458
+ }
459
+ return cmp;
460
+ }
461
+ function subtract(a, b, aL, base) {
462
+ var i = 0;
463
+ for (; aL--; ) {
464
+ a[aL] -= i;
465
+ i = a[aL] < b[aL] ? 1 : 0;
466
+ a[aL] = i * base + a[aL] - b[aL];
467
+ }
468
+ for (; !a[0] && a.length > 1; a.splice(0, 1)) ;
469
+ }
470
+ return function(x, y, dp, rm, base) {
471
+ var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0, yL, yz, s = x.s == y.s ? 1 : -1, xc = x.c, yc = y.c;
472
+ if (!xc || !xc[0] || !yc || !yc[0]) {
473
+ return new BigNumber2(
474
+ // Return NaN if either NaN, or both Infinity or 0.
475
+ !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
476
+ // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
477
+ xc && xc[0] == 0 || !yc ? s * 0 : s / 0
478
+ )
479
+ );
480
+ }
481
+ q = new BigNumber2(s);
482
+ qc = q.c = [];
483
+ e = x.e - y.e;
484
+ s = dp + e + 1;
485
+ if (!base) {
486
+ base = BASE;
487
+ e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
488
+ s = s / LOG_BASE | 0;
489
+ }
490
+ for (i = 0; yc[i] == (xc[i] || 0); i++) ;
491
+ if (yc[i] > (xc[i] || 0)) e--;
492
+ if (s < 0) {
493
+ qc.push(1);
494
+ more = true;
495
+ } else {
496
+ xL = xc.length;
497
+ yL = yc.length;
498
+ i = 0;
499
+ s += 2;
500
+ n = mathfloor(base / (yc[0] + 1));
501
+ if (n > 1) {
502
+ yc = multiply(yc, n, base);
503
+ xc = multiply(xc, n, base);
504
+ yL = yc.length;
505
+ xL = xc.length;
506
+ }
507
+ xi = yL;
508
+ rem = xc.slice(0, yL);
509
+ remL = rem.length;
510
+ for (; remL < yL; rem[remL++] = 0) ;
511
+ yz = yc.slice();
512
+ yz = [0].concat(yz);
513
+ yc0 = yc[0];
514
+ if (yc[1] >= base / 2) yc0++;
515
+ do {
516
+ n = 0;
517
+ cmp = compare2(yc, rem, yL, remL);
518
+ if (cmp < 0) {
519
+ rem0 = rem[0];
520
+ if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
521
+ n = mathfloor(rem0 / yc0);
522
+ if (n > 1) {
523
+ if (n >= base) n = base - 1;
524
+ prod = multiply(yc, n, base);
525
+ prodL = prod.length;
526
+ remL = rem.length;
527
+ while (compare2(prod, rem, prodL, remL) == 1) {
528
+ n--;
529
+ subtract(prod, yL < prodL ? yz : yc, prodL, base);
530
+ prodL = prod.length;
531
+ cmp = 1;
532
+ }
533
+ } else {
534
+ if (n == 0) {
535
+ cmp = n = 1;
536
+ }
537
+ prod = yc.slice();
538
+ prodL = prod.length;
539
+ }
540
+ if (prodL < remL) prod = [0].concat(prod);
541
+ subtract(rem, prod, remL, base);
542
+ remL = rem.length;
543
+ if (cmp == -1) {
544
+ while (compare2(yc, rem, yL, remL) < 1) {
545
+ n++;
546
+ subtract(rem, yL < remL ? yz : yc, remL, base);
547
+ remL = rem.length;
548
+ }
549
+ }
550
+ } else if (cmp === 0) {
551
+ n++;
552
+ rem = [0];
553
+ }
554
+ qc[i++] = n;
555
+ if (rem[0]) {
556
+ rem[remL++] = xc[xi] || 0;
557
+ } else {
558
+ rem = [xc[xi]];
559
+ remL = 1;
560
+ }
561
+ } while ((xi++ < xL || rem[0] != null) && s--);
562
+ more = rem[0] != null;
563
+ if (!qc[0]) qc.splice(0, 1);
564
+ }
565
+ if (base == BASE) {
566
+ for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) ;
567
+ round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
568
+ } else {
569
+ q.e = e;
570
+ q.r = +more;
571
+ }
572
+ return q;
573
+ };
574
+ }();
575
+ function format(n, i, rm, id) {
576
+ var c0, e, ne, len, str;
577
+ if (rm == null) rm = ROUNDING_MODE;
578
+ else intCheck(rm, 0, 8);
579
+ if (!n.c) return n.toString();
580
+ c0 = n.c[0];
581
+ ne = n.e;
582
+ if (i == null) {
583
+ str = coeffToString(n.c);
584
+ str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
585
+ } else {
586
+ n = round(new BigNumber2(n), i, rm);
587
+ e = n.e;
588
+ str = coeffToString(n.c);
589
+ len = str.length;
590
+ if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
591
+ for (; len < i; str += "0", len++) ;
592
+ str = toExponential(str, e);
593
+ } else {
594
+ i -= ne;
595
+ str = toFixedPoint(str, e, "0");
596
+ if (e + 1 > len) {
597
+ if (--i > 0) for (str += "."; i--; str += "0") ;
598
+ } else {
599
+ i += e - len;
600
+ if (i > 0) {
601
+ if (e + 1 == len) str += ".";
602
+ for (; i--; str += "0") ;
603
+ }
604
+ }
605
+ }
606
+ }
607
+ return n.s < 0 && c0 ? "-" + str : str;
608
+ }
609
+ function maxOrMin(args, n) {
610
+ var k, y, i = 1, x = new BigNumber2(args[0]);
611
+ for (; i < args.length; i++) {
612
+ y = new BigNumber2(args[i]);
613
+ if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) {
614
+ x = y;
615
+ }
616
+ }
617
+ return x;
618
+ }
619
+ function normalise(n, c, e) {
620
+ var i = 1, j = c.length;
621
+ for (; !c[--j]; c.pop()) ;
622
+ for (j = c[0]; j >= 10; j /= 10, i++) ;
623
+ if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
624
+ n.c = n.e = null;
625
+ } else if (e < MIN_EXP) {
626
+ n.c = [n.e = 0];
627
+ } else {
628
+ n.e = e;
629
+ n.c = c;
630
+ }
631
+ return n;
632
+ }
633
+ parseNumeric = /* @__PURE__ */ function() {
634
+ var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
635
+ return function(x, str, isNum, b) {
636
+ var base, s = isNum ? str : str.replace(whitespaceOrPlus, "");
637
+ if (isInfinityOrNaN.test(s)) {
638
+ x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
639
+ } else {
640
+ if (!isNum) {
641
+ s = s.replace(basePrefix, function(m, p1, p2) {
642
+ base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
643
+ return !b || b == base ? p1 : m;
644
+ });
645
+ if (b) {
646
+ base = b;
647
+ s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
648
+ }
649
+ if (str != s) return new BigNumber2(s, base);
650
+ }
651
+ if (BigNumber2.DEBUG) {
652
+ throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str);
653
+ }
654
+ x.s = null;
655
+ }
656
+ x.c = x.e = null;
657
+ };
658
+ }();
659
+ function round(x, sd, rm, r) {
660
+ var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
661
+ if (xc) {
662
+ out: {
663
+ for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) ;
664
+ i = sd - d;
665
+ if (i < 0) {
666
+ i += LOG_BASE;
667
+ j = sd;
668
+ n = xc[ni = 0];
669
+ rd = mathfloor(n / pows10[d - j - 1] % 10);
670
+ } else {
671
+ ni = mathceil((i + 1) / LOG_BASE);
672
+ if (ni >= xc.length) {
673
+ if (r) {
674
+ for (; xc.length <= ni; xc.push(0)) ;
675
+ n = rd = 0;
676
+ d = 1;
677
+ i %= LOG_BASE;
678
+ j = i - LOG_BASE + 1;
679
+ } else {
680
+ break out;
681
+ }
682
+ } else {
683
+ n = k = xc[ni];
684
+ for (d = 1; k >= 10; k /= 10, d++) ;
685
+ i %= LOG_BASE;
686
+ j = i - LOG_BASE + d;
687
+ rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10);
688
+ }
689
+ }
690
+ r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?
691
+ // The expression n % pows10[d - j - 1] returns all digits of n to the right
692
+ // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
693
+ xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
694
+ r = rm < 4 ? (rd || r) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || r || rm == 6 && // Check whether the digit to the left of the rounding digit is odd.
695
+ (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
696
+ if (sd < 1 || !xc[0]) {
697
+ xc.length = 0;
698
+ if (r) {
699
+ sd -= x.e + 1;
700
+ xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
701
+ x.e = -sd || 0;
702
+ } else {
703
+ xc[0] = x.e = 0;
704
+ }
705
+ return x;
706
+ }
707
+ if (i == 0) {
708
+ xc.length = ni;
709
+ k = 1;
710
+ ni--;
711
+ } else {
712
+ xc.length = ni + 1;
713
+ k = pows10[LOG_BASE - i];
714
+ xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
715
+ }
716
+ if (r) {
717
+ for (; ; ) {
718
+ if (ni == 0) {
719
+ for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) ;
720
+ j = xc[0] += k;
721
+ for (k = 1; j >= 10; j /= 10, k++) ;
722
+ if (i != k) {
723
+ x.e++;
724
+ if (xc[0] == BASE) xc[0] = 1;
725
+ }
726
+ break;
727
+ } else {
728
+ xc[ni] += k;
729
+ if (xc[ni] != BASE) break;
730
+ xc[ni--] = 0;
731
+ k = 1;
732
+ }
733
+ }
734
+ }
735
+ for (i = xc.length; xc[--i] === 0; xc.pop()) ;
736
+ }
737
+ if (x.e > MAX_EXP) {
738
+ x.c = x.e = null;
739
+ } else if (x.e < MIN_EXP) {
740
+ x.c = [x.e = 0];
741
+ }
742
+ }
743
+ return x;
744
+ }
745
+ function valueOf(n) {
746
+ var str, e = n.e;
747
+ if (e === null) return n.toString();
748
+ str = coeffToString(n.c);
749
+ str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0");
750
+ return n.s < 0 ? "-" + str : str;
751
+ }
752
+ P.absoluteValue = P.abs = function() {
753
+ var x = new BigNumber2(this);
754
+ if (x.s < 0) x.s = 1;
755
+ return x;
756
+ };
757
+ P.comparedTo = function(y, b) {
758
+ return compare(this, new BigNumber2(y, b));
759
+ };
760
+ P.decimalPlaces = P.dp = function(dp, rm) {
761
+ var c, n, v, x = this;
762
+ if (dp != null) {
763
+ intCheck(dp, 0, MAX);
764
+ if (rm == null) rm = ROUNDING_MODE;
765
+ else intCheck(rm, 0, 8);
766
+ return round(new BigNumber2(x), dp + x.e + 1, rm);
767
+ }
768
+ if (!(c = x.c)) return null;
769
+ n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
770
+ if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) ;
771
+ if (n < 0) n = 0;
772
+ return n;
773
+ };
774
+ P.dividedBy = P.div = function(y, b) {
775
+ return div(this, new BigNumber2(y, b), DECIMAL_PLACES, ROUNDING_MODE);
776
+ };
777
+ P.dividedToIntegerBy = P.idiv = function(y, b) {
778
+ return div(this, new BigNumber2(y, b), 0, 1);
779
+ };
780
+ P.exponentiatedBy = P.pow = function(n, m) {
781
+ var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this;
782
+ n = new BigNumber2(n);
783
+ if (n.c && !n.isInteger()) {
784
+ throw Error(bignumberError + "Exponent not an integer: " + valueOf(n));
785
+ }
786
+ if (m != null) m = new BigNumber2(m);
787
+ nIsBig = n.e > 14;
788
+ if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
789
+ y = new BigNumber2(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));
790
+ return m ? y.mod(m) : y;
791
+ }
792
+ nIsNeg = n.s < 0;
793
+ if (m) {
794
+ if (m.c ? !m.c[0] : !m.s) return new BigNumber2(NaN);
795
+ isModExp = !nIsNeg && x.isInteger() && m.isInteger();
796
+ if (isModExp) x = x.mod(m);
797
+ } else if (n.e > 9 && (x.e > 0 || x.e < -1 || (x.e == 0 ? x.c[0] > 1 || nIsBig && x.c[1] >= 24e7 : x.c[0] < 8e13 || nIsBig && x.c[0] <= 9999975e7))) {
798
+ k = x.s < 0 && isOdd(n) ? -0 : 0;
799
+ if (x.e > -1) k = 1 / k;
800
+ return new BigNumber2(nIsNeg ? 1 / k : k);
801
+ } else if (POW_PRECISION) {
802
+ k = mathceil(POW_PRECISION / LOG_BASE + 2);
803
+ }
804
+ if (nIsBig) {
805
+ half = new BigNumber2(0.5);
806
+ if (nIsNeg) n.s = 1;
807
+ nIsOdd = isOdd(n);
808
+ } else {
809
+ i = Math.abs(+valueOf(n));
810
+ nIsOdd = i % 2;
811
+ }
812
+ y = new BigNumber2(ONE);
813
+ for (; ; ) {
814
+ if (nIsOdd) {
815
+ y = y.times(x);
816
+ if (!y.c) break;
817
+ if (k) {
818
+ if (y.c.length > k) y.c.length = k;
819
+ } else if (isModExp) {
820
+ y = y.mod(m);
821
+ }
822
+ }
823
+ if (i) {
824
+ i = mathfloor(i / 2);
825
+ if (i === 0) break;
826
+ nIsOdd = i % 2;
827
+ } else {
828
+ n = n.times(half);
829
+ round(n, n.e + 1, 1);
830
+ if (n.e > 14) {
831
+ nIsOdd = isOdd(n);
832
+ } else {
833
+ i = +valueOf(n);
834
+ if (i === 0) break;
835
+ nIsOdd = i % 2;
836
+ }
837
+ }
838
+ x = x.times(x);
839
+ if (k) {
840
+ if (x.c && x.c.length > k) x.c.length = k;
841
+ } else if (isModExp) {
842
+ x = x.mod(m);
843
+ }
844
+ }
845
+ if (isModExp) return y;
846
+ if (nIsNeg) y = ONE.div(y);
847
+ return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
848
+ };
849
+ P.integerValue = function(rm) {
850
+ var n = new BigNumber2(this);
851
+ if (rm == null) rm = ROUNDING_MODE;
852
+ else intCheck(rm, 0, 8);
853
+ return round(n, n.e + 1, rm);
854
+ };
855
+ P.isEqualTo = P.eq = function(y, b) {
856
+ return compare(this, new BigNumber2(y, b)) === 0;
857
+ };
858
+ P.isFinite = function() {
859
+ return !!this.c;
860
+ };
861
+ P.isGreaterThan = P.gt = function(y, b) {
862
+ return compare(this, new BigNumber2(y, b)) > 0;
863
+ };
864
+ P.isGreaterThanOrEqualTo = P.gte = function(y, b) {
865
+ return (b = compare(this, new BigNumber2(y, b))) === 1 || b === 0;
866
+ };
867
+ P.isInteger = function() {
868
+ return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
869
+ };
870
+ P.isLessThan = P.lt = function(y, b) {
871
+ return compare(this, new BigNumber2(y, b)) < 0;
872
+ };
873
+ P.isLessThanOrEqualTo = P.lte = function(y, b) {
874
+ return (b = compare(this, new BigNumber2(y, b))) === -1 || b === 0;
875
+ };
876
+ P.isNaN = function() {
877
+ return !this.s;
878
+ };
879
+ P.isNegative = function() {
880
+ return this.s < 0;
881
+ };
882
+ P.isPositive = function() {
883
+ return this.s > 0;
884
+ };
885
+ P.isZero = function() {
886
+ return !!this.c && this.c[0] == 0;
887
+ };
888
+ P.minus = function(y, b) {
889
+ var i, j, t, xLTy, x = this, a = x.s;
890
+ y = new BigNumber2(y, b);
891
+ b = y.s;
892
+ if (!a || !b) return new BigNumber2(NaN);
893
+ if (a != b) {
894
+ y.s = -b;
895
+ return x.plus(y);
896
+ }
897
+ var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
898
+ if (!xe || !ye) {
899
+ if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber2(yc ? x : NaN);
900
+ if (!xc[0] || !yc[0]) {
901
+ return yc[0] ? (y.s = -b, y) : new BigNumber2(xc[0] ? x : (
902
+ // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
903
+ ROUNDING_MODE == 3 ? -0 : 0
904
+ ));
905
+ }
906
+ }
907
+ xe = bitFloor(xe);
908
+ ye = bitFloor(ye);
909
+ xc = xc.slice();
910
+ if (a = xe - ye) {
911
+ if (xLTy = a < 0) {
912
+ a = -a;
913
+ t = xc;
914
+ } else {
915
+ ye = xe;
916
+ t = yc;
917
+ }
918
+ t.reverse();
919
+ for (b = a; b--; t.push(0)) ;
920
+ t.reverse();
921
+ } else {
922
+ j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
923
+ for (a = b = 0; b < j; b++) {
924
+ if (xc[b] != yc[b]) {
925
+ xLTy = xc[b] < yc[b];
926
+ break;
927
+ }
928
+ }
929
+ }
930
+ if (xLTy) {
931
+ t = xc;
932
+ xc = yc;
933
+ yc = t;
934
+ y.s = -y.s;
935
+ }
936
+ b = (j = yc.length) - (i = xc.length);
937
+ if (b > 0) for (; b--; xc[i++] = 0) ;
938
+ b = BASE - 1;
939
+ for (; j > a; ) {
940
+ if (xc[--j] < yc[j]) {
941
+ for (i = j; i && !xc[--i]; xc[i] = b) ;
942
+ --xc[i];
943
+ xc[j] += BASE;
944
+ }
945
+ xc[j] -= yc[j];
946
+ }
947
+ for (; xc[0] == 0; xc.splice(0, 1), --ye) ;
948
+ if (!xc[0]) {
949
+ y.s = ROUNDING_MODE == 3 ? -1 : 1;
950
+ y.c = [y.e = 0];
951
+ return y;
952
+ }
953
+ return normalise(y, xc, ye);
954
+ };
955
+ P.modulo = P.mod = function(y, b) {
956
+ var q, s, x = this;
957
+ y = new BigNumber2(y, b);
958
+ if (!x.c || !y.s || y.c && !y.c[0]) {
959
+ return new BigNumber2(NaN);
960
+ } else if (!y.c || x.c && !x.c[0]) {
961
+ return new BigNumber2(x);
962
+ }
963
+ if (MODULO_MODE == 9) {
964
+ s = y.s;
965
+ y.s = 1;
966
+ q = div(x, y, 0, 3);
967
+ y.s = s;
968
+ q.s *= s;
969
+ } else {
970
+ q = div(x, y, 0, MODULO_MODE);
971
+ }
972
+ y = x.minus(q.times(y));
973
+ if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
974
+ return y;
975
+ };
976
+ P.multipliedBy = P.times = function(y, b) {
977
+ var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc, base, sqrtBase, x = this, xc = x.c, yc = (y = new BigNumber2(y, b)).c;
978
+ if (!xc || !yc || !xc[0] || !yc[0]) {
979
+ if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
980
+ y.c = y.e = y.s = null;
981
+ } else {
982
+ y.s *= x.s;
983
+ if (!xc || !yc) {
984
+ y.c = y.e = null;
985
+ } else {
986
+ y.c = [0];
987
+ y.e = 0;
988
+ }
989
+ }
990
+ return y;
991
+ }
992
+ e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
993
+ y.s *= x.s;
994
+ xcL = xc.length;
995
+ ycL = yc.length;
996
+ if (xcL < ycL) {
997
+ zc = xc;
998
+ xc = yc;
999
+ yc = zc;
1000
+ i = xcL;
1001
+ xcL = ycL;
1002
+ ycL = i;
1003
+ }
1004
+ for (i = xcL + ycL, zc = []; i--; zc.push(0)) ;
1005
+ base = BASE;
1006
+ sqrtBase = SQRT_BASE;
1007
+ for (i = ycL; --i >= 0; ) {
1008
+ c = 0;
1009
+ ylo = yc[i] % sqrtBase;
1010
+ yhi = yc[i] / sqrtBase | 0;
1011
+ for (k = xcL, j = i + k; j > i; ) {
1012
+ xlo = xc[--k] % sqrtBase;
1013
+ xhi = xc[k] / sqrtBase | 0;
1014
+ m = yhi * xlo + xhi * ylo;
1015
+ xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;
1016
+ c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
1017
+ zc[j--] = xlo % base;
1018
+ }
1019
+ zc[j] = c;
1020
+ }
1021
+ if (c) {
1022
+ ++e;
1023
+ } else {
1024
+ zc.splice(0, 1);
1025
+ }
1026
+ return normalise(y, zc, e);
1027
+ };
1028
+ P.negated = function() {
1029
+ var x = new BigNumber2(this);
1030
+ x.s = -x.s || null;
1031
+ return x;
1032
+ };
1033
+ P.plus = function(y, b) {
1034
+ var t, x = this, a = x.s;
1035
+ y = new BigNumber2(y, b);
1036
+ b = y.s;
1037
+ if (!a || !b) return new BigNumber2(NaN);
1038
+ if (a != b) {
1039
+ y.s = -b;
1040
+ return x.minus(y);
1041
+ }
1042
+ var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
1043
+ if (!xe || !ye) {
1044
+ if (!xc || !yc) return new BigNumber2(a / 0);
1045
+ if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber2(xc[0] ? x : a * 0);
1046
+ }
1047
+ xe = bitFloor(xe);
1048
+ ye = bitFloor(ye);
1049
+ xc = xc.slice();
1050
+ if (a = xe - ye) {
1051
+ if (a > 0) {
1052
+ ye = xe;
1053
+ t = yc;
1054
+ } else {
1055
+ a = -a;
1056
+ t = xc;
1057
+ }
1058
+ t.reverse();
1059
+ for (; a--; t.push(0)) ;
1060
+ t.reverse();
1061
+ }
1062
+ a = xc.length;
1063
+ b = yc.length;
1064
+ if (a - b < 0) {
1065
+ t = yc;
1066
+ yc = xc;
1067
+ xc = t;
1068
+ b = a;
1069
+ }
1070
+ for (a = 0; b; ) {
1071
+ a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
1072
+ xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
1073
+ }
1074
+ if (a) {
1075
+ xc = [a].concat(xc);
1076
+ ++ye;
1077
+ }
1078
+ return normalise(y, xc, ye);
1079
+ };
1080
+ P.precision = P.sd = function(sd, rm) {
1081
+ var c, n, v, x = this;
1082
+ if (sd != null && sd !== !!sd) {
1083
+ intCheck(sd, 1, MAX);
1084
+ if (rm == null) rm = ROUNDING_MODE;
1085
+ else intCheck(rm, 0, 8);
1086
+ return round(new BigNumber2(x), sd, rm);
1087
+ }
1088
+ if (!(c = x.c)) return null;
1089
+ v = c.length - 1;
1090
+ n = v * LOG_BASE + 1;
1091
+ if (v = c[v]) {
1092
+ for (; v % 10 == 0; v /= 10, n--) ;
1093
+ for (v = c[0]; v >= 10; v /= 10, n++) ;
1094
+ }
1095
+ if (sd && x.e + 1 > n) n = x.e + 1;
1096
+ return n;
1097
+ };
1098
+ P.shiftedBy = function(k) {
1099
+ intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
1100
+ return this.times("1e" + k);
1101
+ };
1102
+ P.squareRoot = P.sqrt = function() {
1103
+ var m, n, r, rep, t, x = this, c = x.c, s = x.s, e = x.e, dp = DECIMAL_PLACES + 4, half = new BigNumber2("0.5");
1104
+ if (s !== 1 || !c || !c[0]) {
1105
+ return new BigNumber2(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
1106
+ }
1107
+ s = Math.sqrt(+valueOf(x));
1108
+ if (s == 0 || s == 1 / 0) {
1109
+ n = coeffToString(c);
1110
+ if ((n.length + e) % 2 == 0) n += "0";
1111
+ s = Math.sqrt(+n);
1112
+ e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
1113
+ if (s == 1 / 0) {
1114
+ n = "5e" + e;
1115
+ } else {
1116
+ n = s.toExponential();
1117
+ n = n.slice(0, n.indexOf("e") + 1) + e;
1118
+ }
1119
+ r = new BigNumber2(n);
1120
+ } else {
1121
+ r = new BigNumber2(s + "");
1122
+ }
1123
+ if (r.c[0]) {
1124
+ e = r.e;
1125
+ s = e + dp;
1126
+ if (s < 3) s = 0;
1127
+ for (; ; ) {
1128
+ t = r;
1129
+ r = half.times(t.plus(div(x, t, dp, 1)));
1130
+ if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
1131
+ if (r.e < e) --s;
1132
+ n = n.slice(s - 3, s + 1);
1133
+ if (n == "9999" || !rep && n == "4999") {
1134
+ if (!rep) {
1135
+ round(t, t.e + DECIMAL_PLACES + 2, 0);
1136
+ if (t.times(t).eq(x)) {
1137
+ r = t;
1138
+ break;
1139
+ }
1140
+ }
1141
+ dp += 4;
1142
+ s += 4;
1143
+ rep = 1;
1144
+ } else {
1145
+ if (!+n || !+n.slice(1) && n.charAt(0) == "5") {
1146
+ round(r, r.e + DECIMAL_PLACES + 2, 1);
1147
+ m = !r.times(r).eq(x);
1148
+ }
1149
+ break;
1150
+ }
1151
+ }
1152
+ }
1153
+ }
1154
+ return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
1155
+ };
1156
+ P.toExponential = function(dp, rm) {
1157
+ if (dp != null) {
1158
+ intCheck(dp, 0, MAX);
1159
+ dp++;
1160
+ }
1161
+ return format(this, dp, rm, 1);
1162
+ };
1163
+ P.toFixed = function(dp, rm) {
1164
+ if (dp != null) {
1165
+ intCheck(dp, 0, MAX);
1166
+ dp = dp + this.e + 1;
1167
+ }
1168
+ return format(this, dp, rm);
1169
+ };
1170
+ P.toFormat = function(dp, rm, format2) {
1171
+ var str, x = this;
1172
+ if (format2 == null) {
1173
+ if (dp != null && rm && typeof rm == "object") {
1174
+ format2 = rm;
1175
+ rm = null;
1176
+ } else if (dp && typeof dp == "object") {
1177
+ format2 = dp;
1178
+ dp = rm = null;
1179
+ } else {
1180
+ format2 = FORMAT;
1181
+ }
1182
+ } else if (typeof format2 != "object") {
1183
+ throw Error(bignumberError + "Argument not an object: " + format2);
1184
+ }
1185
+ str = x.toFixed(dp, rm);
1186
+ if (x.c) {
1187
+ var i, arr = str.split("."), g1 = +format2.groupSize, g2 = +format2.secondaryGroupSize, groupSeparator = format2.groupSeparator || "", intPart = arr[0], fractionPart = arr[1], isNeg = x.s < 0, intDigits = isNeg ? intPart.slice(1) : intPart, len = intDigits.length;
1188
+ if (g2) {
1189
+ i = g1;
1190
+ g1 = g2;
1191
+ g2 = i;
1192
+ len -= i;
1193
+ }
1194
+ if (g1 > 0 && len > 0) {
1195
+ i = len % g1 || g1;
1196
+ intPart = intDigits.substr(0, i);
1197
+ for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
1198
+ if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
1199
+ if (isNeg) intPart = "-" + intPart;
1200
+ }
1201
+ str = fractionPart ? intPart + (format2.decimalSeparator || "") + ((g2 = +format2.fractionGroupSize) ? fractionPart.replace(
1202
+ new RegExp("\\d{" + g2 + "}\\B", "g"),
1203
+ "$&" + (format2.fractionGroupSeparator || "")
1204
+ ) : fractionPart) : intPart;
1205
+ }
1206
+ return (format2.prefix || "") + str + (format2.suffix || "");
1207
+ };
1208
+ P.toFraction = function(md) {
1209
+ var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c;
1210
+ if (md != null) {
1211
+ n = new BigNumber2(md);
1212
+ if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
1213
+ throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n));
1214
+ }
1215
+ }
1216
+ if (!xc) return new BigNumber2(x);
1217
+ d = new BigNumber2(ONE);
1218
+ n1 = d0 = new BigNumber2(ONE);
1219
+ d1 = n0 = new BigNumber2(ONE);
1220
+ s = coeffToString(xc);
1221
+ e = d.e = s.length - x.e - 1;
1222
+ d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
1223
+ md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;
1224
+ exp = MAX_EXP;
1225
+ MAX_EXP = 1 / 0;
1226
+ n = new BigNumber2(s);
1227
+ n0.c[0] = 0;
1228
+ for (; ; ) {
1229
+ q = div(n, d, 0, 1);
1230
+ d2 = d0.plus(q.times(d1));
1231
+ if (d2.comparedTo(md) == 1) break;
1232
+ d0 = d1;
1233
+ d1 = d2;
1234
+ n1 = n0.plus(q.times(d2 = n1));
1235
+ n0 = d2;
1236
+ d = n.minus(q.times(d2 = d));
1237
+ n = d2;
1238
+ }
1239
+ d2 = div(md.minus(d0), d1, 0, 1);
1240
+ n0 = n0.plus(d2.times(n1));
1241
+ d0 = d0.plus(d2.times(d1));
1242
+ n0.s = n1.s = x.s;
1243
+ e = e * 2;
1244
+ r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
1245
+ div(n0, d0, e, ROUNDING_MODE).minus(x).abs()
1246
+ ) < 1 ? [n1, d1] : [n0, d0];
1247
+ MAX_EXP = exp;
1248
+ return r;
1249
+ };
1250
+ P.toNumber = function() {
1251
+ return +valueOf(this);
1252
+ };
1253
+ P.toPrecision = function(sd, rm) {
1254
+ if (sd != null) intCheck(sd, 1, MAX);
1255
+ return format(this, sd, rm, 2);
1256
+ };
1257
+ P.toString = function(b) {
1258
+ var str, n = this, s = n.s, e = n.e;
1259
+ if (e === null) {
1260
+ if (s) {
1261
+ str = "Infinity";
1262
+ if (s < 0) str = "-" + str;
1263
+ } else {
1264
+ str = "NaN";
1265
+ }
1266
+ } else {
1267
+ if (b == null) {
1268
+ str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0");
1269
+ } else if (b === 10 && alphabetHasNormalDecimalDigits) {
1270
+ n = round(new BigNumber2(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
1271
+ str = toFixedPoint(coeffToString(n.c), n.e, "0");
1272
+ } else {
1273
+ intCheck(b, 2, ALPHABET.length, "Base");
1274
+ str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true);
1275
+ }
1276
+ if (s < 0 && n.c[0]) str = "-" + str;
1277
+ }
1278
+ return str;
1279
+ };
1280
+ P.valueOf = P.toJSON = function() {
1281
+ return valueOf(this);
1282
+ };
1283
+ P._isBigNumber = true;
1284
+ P[Symbol.toStringTag] = "BigNumber";
1285
+ P[Symbol.for("nodejs.util.inspect.custom")] = P.valueOf;
1286
+ if (configObject != null) BigNumber2.set(configObject);
1287
+ return BigNumber2;
1288
+ }
1289
+ function bitFloor(n) {
1290
+ var i = n | 0;
1291
+ return n > 0 || n === i ? i : i - 1;
1292
+ }
1293
+ function coeffToString(a) {
1294
+ var s, z, i = 1, j = a.length, r = a[0] + "";
1295
+ for (; i < j; ) {
1296
+ s = a[i++] + "";
1297
+ z = LOG_BASE - s.length;
1298
+ for (; z--; s = "0" + s) ;
1299
+ r += s;
1300
+ }
1301
+ for (j = r.length; r.charCodeAt(--j) === 48; ) ;
1302
+ return r.slice(0, j + 1 || 1);
1303
+ }
1304
+ function compare(x, y) {
1305
+ var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e;
1306
+ if (!i || !j) return null;
1307
+ a = xc && !xc[0];
1308
+ b = yc && !yc[0];
1309
+ if (a || b) return a ? b ? 0 : -j : i;
1310
+ if (i != j) return i;
1311
+ a = i < 0;
1312
+ b = k == l;
1313
+ if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
1314
+ if (!b) return k > l ^ a ? 1 : -1;
1315
+ j = (k = xc.length) < (l = yc.length) ? k : l;
1316
+ for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
1317
+ return k == l ? 0 : k > l ^ a ? 1 : -1;
1318
+ }
1319
+ function intCheck(n, min, max, name) {
1320
+ if (n < min || n > max || n !== mathfloor(n)) {
1321
+ throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
1322
+ }
1323
+ }
1324
+ function isOdd(n) {
1325
+ var k = n.c.length - 1;
1326
+ return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
1327
+ }
1328
+ function toExponential(str, e) {
1329
+ return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e;
1330
+ }
1331
+ function toFixedPoint(str, e, z) {
1332
+ var len, zs;
1333
+ if (e < 0) {
1334
+ for (zs = z + "."; ++e; zs += z) ;
1335
+ str = zs + str;
1336
+ } else {
1337
+ len = str.length;
1338
+ if (++e > len) {
1339
+ for (zs = z, e -= len; --e; zs += z) ;
1340
+ str += zs;
1341
+ } else if (e < len) {
1342
+ str = str.slice(0, e) + "." + str.slice(e);
1343
+ }
1344
+ }
1345
+ return str;
1346
+ }
1347
+ var BigNumber = clone();
1348
+
1349
+ // src/public-functions/getRecommendedGasPrice.ts
1350
+ var getRecommendedGasPrice = (props) => __async(void 0, null, function* () {
1351
+ const feeInfo = yield getFeeInfoForChain(props);
1352
+ if (!feeInfo || !feeInfo.gasPrice) {
1353
+ return void 0;
1354
+ }
1355
+ let price = feeInfo.gasPrice.average;
1356
+ if (price === "") {
1357
+ price = feeInfo.gasPrice.high;
1358
+ }
1359
+ if (price === "") {
1360
+ price = feeInfo.gasPrice.low;
1361
+ }
1362
+ if (!price) return;
1363
+ return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), feeInfo.denom);
1364
+ });
1365
+
1366
+ export { getRecommendedGasPrice };