linkque-cli-v2 1.0.5 → 1.0.7

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 (51) hide show
  1. package/README.md +1 -1
  2. package/linkquejs.js +23 -2212
  3. package/package.json +4 -1
  4. package/vendor/linkque-agent-appwrite-integrate/dist/esm/anthropic-messages-B5T6TFD2.js +7172 -0
  5. package/vendor/linkque-agent-appwrite-integrate/dist/esm/azure-openai-responses-S7HNQOSE.js +229 -0
  6. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-2NGJGNYB.js +1765 -0
  7. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-3S3TOEBZ.js +608 -0
  8. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-46SEH6ER.js +78 -0
  9. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-6MHDOBWO.js +12 -0
  10. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-6WHNFJT4.js +31278 -0
  11. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-7BQRUS4C.js +671 -0
  12. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-7QWAKKTY.js +7054 -0
  13. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-CT4G24PS.js +8 -0
  14. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-DYEQRE6N.js +343 -0
  15. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-E2P6TIFG.js +31 -0
  16. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-FHNQ6DPF.js +14 -0
  17. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-FJ2BZPIM.js +60308 -0
  18. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-HTG7JBF2.js +38 -0
  19. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-I64V3ICJ.js +11166 -0
  20. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-IAT272TH.js +12121 -0
  21. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-IKZ25GJD.js +497 -0
  22. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-MKS245OU.js +3570 -0
  23. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-NKEOCGYU.js +76 -0
  24. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-OXGCUIKV.js +33 -0
  25. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-RYONFGPP.js +317 -0
  26. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-UEVQXSKG.js +4765 -0
  27. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-UFVAKOTZ.js +17 -0
  28. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-VS2QQHAK.js +46 -0
  29. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-XMVFOHGJ.js +31 -0
  30. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-XUFLSZM4.js +5319 -0
  31. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-Y6UTJIT4.js +23 -0
  32. package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-YDKZZ6EH.js +3584 -0
  33. package/vendor/linkque-agent-appwrite-integrate/dist/esm/dist-QD3CV4KC.js +1224 -0
  34. package/vendor/linkque-agent-appwrite-integrate/dist/esm/google-generative-ai-IOXNKFEV.js +412 -0
  35. package/vendor/linkque-agent-appwrite-integrate/dist/esm/google-vertex-U4ZV5IXZ.js +461 -0
  36. package/vendor/linkque-agent-appwrite-integrate/dist/esm/mistral-conversations-G3K7SSWR.js +30344 -0
  37. package/vendor/linkque-agent-appwrite-integrate/dist/esm/multipart-parser-2VJ7LVQD.js +170 -0
  38. package/vendor/linkque-agent-appwrite-integrate/dist/esm/multipart-parser-AJMV6U6H.js +178 -0
  39. package/vendor/linkque-agent-appwrite-integrate/dist/esm/multipart-parser-PULXGNYO.js +368 -0
  40. package/vendor/linkque-agent-appwrite-integrate/dist/esm/openai-codex-responses-4JJLPTCS.js +1308 -0
  41. package/vendor/linkque-agent-appwrite-integrate/dist/esm/openai-completions-PH4WW6E7.js +977 -0
  42. package/vendor/linkque-agent-appwrite-integrate/dist/esm/openai-responses-KGWAX6HR.js +264 -0
  43. package/vendor/linkque-agent-appwrite-integrate/dist/esm/openrouter-images-LMBZZQ76.js +138 -0
  44. package/vendor/linkque-agent-appwrite-integrate/dist/esm/otel-7GSG7QQO.js +6657 -0
  45. package/vendor/linkque-agent-appwrite-integrate/dist/esm/pi-messages-ZX3KUWSZ.js +309 -0
  46. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +2348 -0
  47. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +16 -0
  48. package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +17 -0
  49. package/vendor/linkque-agent-appwrite-integrate/dist/esm/src-NGZW4JXI.js +1396 -0
  50. package/vendor/linkque-agent-appwrite-integrate/package.json +1 -0
  51. package/worker.js +16 -6
@@ -0,0 +1,1765 @@
1
+ import {
2
+ __commonJS
3
+ } from "./chunk-VS2QQHAK.js";
4
+
5
+ // ../../node_modules/bignumber.js/bignumber.js
6
+ var require_bignumber = __commonJS({
7
+ "../../node_modules/bignumber.js/bignumber.js"(exports, module) {
8
+ (function(globalObject) {
9
+ "use strict";
10
+ var BigNumber, isNumeric = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, mathceil = Math.ceil, mathfloor = Math.floor, bignumberError = "[BigNumber Error] ", tooManyDigits = bignumberError + "Number primitive has more than 15 significant digits: ", BASE = 1e14, LOG_BASE = 14, MAX_SAFE_INTEGER = 9007199254740991, POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], SQRT_BASE = 1e7, MAX = 1e9;
11
+ function clone(configObject) {
12
+ 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 = {
13
+ prefix: "",
14
+ groupSize: 3,
15
+ secondaryGroupSize: 0,
16
+ groupSeparator: ",",
17
+ decimalSeparator: ".",
18
+ fractionGroupSize: 0,
19
+ fractionGroupSeparator: "\xA0",
20
+ // non-breaking space
21
+ suffix: ""
22
+ }, ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz", alphabetHasNormalDecimalDigits = true;
23
+ function BigNumber2(v, b) {
24
+ var alphabet, c, caseChanged, e, i, isNum, len, str, x = this;
25
+ if (!(x instanceof BigNumber2)) return new BigNumber2(v, b);
26
+ if (b == null) {
27
+ if (v && v._isBigNumber === true) {
28
+ x.s = v.s;
29
+ if (!v.c || v.e > MAX_EXP) {
30
+ x.c = x.e = null;
31
+ } else if (v.e < MIN_EXP) {
32
+ x.c = [x.e = 0];
33
+ } else {
34
+ x.e = v.e;
35
+ x.c = v.c.slice();
36
+ }
37
+ return;
38
+ }
39
+ if ((isNum = typeof v == "number") && v * 0 == 0) {
40
+ x.s = 1 / v < 0 ? (v = -v, -1) : 1;
41
+ if (v === ~~v) {
42
+ for (e = 0, i = v; i >= 10; i /= 10, e++) ;
43
+ if (e > MAX_EXP) {
44
+ x.c = x.e = null;
45
+ } else {
46
+ x.e = e;
47
+ x.c = [v];
48
+ }
49
+ return;
50
+ }
51
+ str = String(v);
52
+ } else {
53
+ if (!isNumeric.test(str = String(v))) return parseNumeric(x, str, isNum);
54
+ x.s = str.charCodeAt(0) == 45 ? (str = str.slice(1), -1) : 1;
55
+ }
56
+ if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
57
+ if ((i = str.search(/e/i)) > 0) {
58
+ if (e < 0) e = i;
59
+ e += +str.slice(i + 1);
60
+ str = str.substring(0, i);
61
+ } else if (e < 0) {
62
+ e = str.length;
63
+ }
64
+ } else {
65
+ intCheck(b, 2, ALPHABET.length, "Base");
66
+ if (b == 10 && alphabetHasNormalDecimalDigits) {
67
+ x = new BigNumber2(v);
68
+ return round(x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE);
69
+ }
70
+ str = String(v);
71
+ if (isNum = typeof v == "number") {
72
+ if (v * 0 != 0) return parseNumeric(x, str, isNum, b);
73
+ x.s = 1 / v < 0 ? (str = str.slice(1), -1) : 1;
74
+ if (BigNumber2.DEBUG && str.replace(/^0\.0*|\./, "").length > 15) {
75
+ throw Error(tooManyDigits + v);
76
+ }
77
+ } else {
78
+ x.s = str.charCodeAt(0) === 45 ? (str = str.slice(1), -1) : 1;
79
+ }
80
+ alphabet = ALPHABET.slice(0, b);
81
+ e = i = 0;
82
+ for (len = str.length; i < len; i++) {
83
+ if (alphabet.indexOf(c = str.charAt(i)) < 0) {
84
+ if (c == ".") {
85
+ if (i > e) {
86
+ e = len;
87
+ continue;
88
+ }
89
+ } else if (!caseChanged) {
90
+ if (str == str.toUpperCase() && (str = str.toLowerCase()) || str == str.toLowerCase() && (str = str.toUpperCase())) {
91
+ caseChanged = true;
92
+ i = -1;
93
+ e = 0;
94
+ continue;
95
+ }
96
+ }
97
+ return parseNumeric(x, String(v), isNum, b);
98
+ }
99
+ }
100
+ isNum = false;
101
+ str = convertBase(str, b, 10, x.s);
102
+ if ((e = str.indexOf(".")) > -1) str = str.replace(".", "");
103
+ else e = str.length;
104
+ }
105
+ for (i = 0; str.charCodeAt(i) === 48; i++) ;
106
+ for (len = str.length; str.charCodeAt(--len) === 48; ) ;
107
+ if (str = str.slice(i, ++len)) {
108
+ len -= i;
109
+ if (isNum && BigNumber2.DEBUG && len > 15 && (v > MAX_SAFE_INTEGER || v !== mathfloor(v))) {
110
+ throw Error(tooManyDigits + x.s * v);
111
+ }
112
+ if ((e = e - i - 1) > MAX_EXP) {
113
+ x.c = x.e = null;
114
+ } else if (e < MIN_EXP) {
115
+ x.c = [x.e = 0];
116
+ } else {
117
+ x.e = e;
118
+ x.c = [];
119
+ i = (e + 1) % LOG_BASE;
120
+ if (e < 0) i += LOG_BASE;
121
+ if (i < len) {
122
+ if (i) x.c.push(+str.slice(0, i));
123
+ for (len -= LOG_BASE; i < len; ) {
124
+ x.c.push(+str.slice(i, i += LOG_BASE));
125
+ }
126
+ i = LOG_BASE - (str = str.slice(i)).length;
127
+ } else {
128
+ i -= len;
129
+ }
130
+ for (; i--; str += "0") ;
131
+ x.c.push(+str);
132
+ }
133
+ } else {
134
+ x.c = [x.e = 0];
135
+ }
136
+ }
137
+ BigNumber2.clone = clone;
138
+ BigNumber2.ROUND_UP = 0;
139
+ BigNumber2.ROUND_DOWN = 1;
140
+ BigNumber2.ROUND_CEIL = 2;
141
+ BigNumber2.ROUND_FLOOR = 3;
142
+ BigNumber2.ROUND_HALF_UP = 4;
143
+ BigNumber2.ROUND_HALF_DOWN = 5;
144
+ BigNumber2.ROUND_HALF_EVEN = 6;
145
+ BigNumber2.ROUND_HALF_CEIL = 7;
146
+ BigNumber2.ROUND_HALF_FLOOR = 8;
147
+ BigNumber2.EUCLID = 9;
148
+ BigNumber2.config = BigNumber2.set = function(obj) {
149
+ var p, v;
150
+ if (obj != null) {
151
+ if (typeof obj == "object") {
152
+ if (obj.hasOwnProperty(p = "DECIMAL_PLACES")) {
153
+ v = obj[p];
154
+ intCheck(v, 0, MAX, p);
155
+ DECIMAL_PLACES = v;
156
+ }
157
+ if (obj.hasOwnProperty(p = "ROUNDING_MODE")) {
158
+ v = obj[p];
159
+ intCheck(v, 0, 8, p);
160
+ ROUNDING_MODE = v;
161
+ }
162
+ if (obj.hasOwnProperty(p = "EXPONENTIAL_AT")) {
163
+ v = obj[p];
164
+ if (v && v.pop) {
165
+ intCheck(v[0], -MAX, 0, p);
166
+ intCheck(v[1], 0, MAX, p);
167
+ TO_EXP_NEG = v[0];
168
+ TO_EXP_POS = v[1];
169
+ } else {
170
+ intCheck(v, -MAX, MAX, p);
171
+ TO_EXP_NEG = -(TO_EXP_POS = v < 0 ? -v : v);
172
+ }
173
+ }
174
+ if (obj.hasOwnProperty(p = "RANGE")) {
175
+ v = obj[p];
176
+ if (v && v.pop) {
177
+ intCheck(v[0], -MAX, -1, p);
178
+ intCheck(v[1], 1, MAX, p);
179
+ MIN_EXP = v[0];
180
+ MAX_EXP = v[1];
181
+ } else {
182
+ intCheck(v, -MAX, MAX, p);
183
+ if (v) {
184
+ MIN_EXP = -(MAX_EXP = v < 0 ? -v : v);
185
+ } else {
186
+ throw Error(bignumberError + p + " cannot be zero: " + v);
187
+ }
188
+ }
189
+ }
190
+ if (obj.hasOwnProperty(p = "CRYPTO")) {
191
+ v = obj[p];
192
+ if (v === !!v) {
193
+ if (v) {
194
+ if (typeof crypto != "undefined" && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
195
+ CRYPTO = v;
196
+ } else {
197
+ CRYPTO = !v;
198
+ throw Error(bignumberError + "crypto unavailable");
199
+ }
200
+ } else {
201
+ CRYPTO = v;
202
+ }
203
+ } else {
204
+ throw Error(bignumberError + p + " not true or false: " + v);
205
+ }
206
+ }
207
+ if (obj.hasOwnProperty(p = "MODULO_MODE")) {
208
+ v = obj[p];
209
+ intCheck(v, 0, 9, p);
210
+ MODULO_MODE = v;
211
+ }
212
+ if (obj.hasOwnProperty(p = "POW_PRECISION")) {
213
+ v = obj[p];
214
+ intCheck(v, 0, MAX, p);
215
+ POW_PRECISION = v;
216
+ }
217
+ if (obj.hasOwnProperty(p = "FORMAT")) {
218
+ v = obj[p];
219
+ if (typeof v == "object") FORMAT = v;
220
+ else throw Error(bignumberError + p + " not an object: " + v);
221
+ }
222
+ if (obj.hasOwnProperty(p = "ALPHABET")) {
223
+ v = obj[p];
224
+ if (typeof v == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(v)) {
225
+ alphabetHasNormalDecimalDigits = v.slice(0, 10) == "0123456789";
226
+ ALPHABET = v;
227
+ } else {
228
+ throw Error(bignumberError + p + " invalid: " + v);
229
+ }
230
+ }
231
+ } else {
232
+ throw Error(bignumberError + "Object expected: " + obj);
233
+ }
234
+ }
235
+ return {
236
+ DECIMAL_PLACES,
237
+ ROUNDING_MODE,
238
+ EXPONENTIAL_AT: [TO_EXP_NEG, TO_EXP_POS],
239
+ RANGE: [MIN_EXP, MAX_EXP],
240
+ CRYPTO,
241
+ MODULO_MODE,
242
+ POW_PRECISION,
243
+ FORMAT,
244
+ ALPHABET
245
+ };
246
+ };
247
+ BigNumber2.isBigNumber = function(v) {
248
+ if (!v || v._isBigNumber !== true) return false;
249
+ if (!BigNumber2.DEBUG) return true;
250
+ var i, n, c = v.c, e = v.e, s = v.s;
251
+ out: if ({}.toString.call(c) == "[object Array]") {
252
+ if ((s === 1 || s === -1) && e >= -MAX && e <= MAX && e === mathfloor(e)) {
253
+ if (c[0] === 0) {
254
+ if (e === 0 && c.length === 1) return true;
255
+ break out;
256
+ }
257
+ i = (e + 1) % LOG_BASE;
258
+ if (i < 1) i += LOG_BASE;
259
+ if (String(c[0]).length == i) {
260
+ for (i = 0; i < c.length; i++) {
261
+ n = c[i];
262
+ if (n < 0 || n >= BASE || n !== mathfloor(n)) break out;
263
+ }
264
+ if (n !== 0) return true;
265
+ }
266
+ }
267
+ } else if (c === null && e === null && (s === null || s === 1 || s === -1)) {
268
+ return true;
269
+ }
270
+ throw Error(bignumberError + "Invalid BigNumber: " + v);
271
+ };
272
+ BigNumber2.maximum = BigNumber2.max = function() {
273
+ return maxOrMin(arguments, -1);
274
+ };
275
+ BigNumber2.minimum = BigNumber2.min = function() {
276
+ return maxOrMin(arguments, 1);
277
+ };
278
+ BigNumber2.random = function() {
279
+ var pow2_53 = 9007199254740992;
280
+ var random53bitInt = Math.random() * pow2_53 & 2097151 ? function() {
281
+ return mathfloor(Math.random() * pow2_53);
282
+ } : function() {
283
+ return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
284
+ };
285
+ return function(dp) {
286
+ var a, b, e, k, v, i = 0, c = [], rand = new BigNumber2(ONE);
287
+ if (dp == null) dp = DECIMAL_PLACES;
288
+ else intCheck(dp, 0, MAX);
289
+ k = mathceil(dp / LOG_BASE);
290
+ if (CRYPTO) {
291
+ if (crypto.getRandomValues) {
292
+ a = crypto.getRandomValues(new Uint32Array(k *= 2));
293
+ for (; i < k; ) {
294
+ v = a[i] * 131072 + (a[i + 1] >>> 11);
295
+ if (v >= 9e15) {
296
+ b = crypto.getRandomValues(new Uint32Array(2));
297
+ a[i] = b[0];
298
+ a[i + 1] = b[1];
299
+ } else {
300
+ c.push(v % 1e14);
301
+ i += 2;
302
+ }
303
+ }
304
+ i = k / 2;
305
+ } else if (crypto.randomBytes) {
306
+ a = crypto.randomBytes(k *= 7);
307
+ for (; i < k; ) {
308
+ 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];
309
+ if (v >= 9e15) {
310
+ crypto.randomBytes(7).copy(a, i);
311
+ } else {
312
+ c.push(v % 1e14);
313
+ i += 7;
314
+ }
315
+ }
316
+ i = k / 7;
317
+ } else {
318
+ CRYPTO = false;
319
+ throw Error(bignumberError + "crypto unavailable");
320
+ }
321
+ }
322
+ if (!CRYPTO) {
323
+ for (; i < k; ) {
324
+ v = random53bitInt();
325
+ if (v < 9e15) c[i++] = v % 1e14;
326
+ }
327
+ }
328
+ k = c[--i];
329
+ dp %= LOG_BASE;
330
+ if (k && dp) {
331
+ v = POWS_TEN[LOG_BASE - dp];
332
+ c[i] = mathfloor(k / v) * v;
333
+ }
334
+ for (; c[i] === 0; c.pop(), i--) ;
335
+ if (i < 0) {
336
+ c = [e = 0];
337
+ } else {
338
+ for (e = -1; c[0] === 0; c.splice(0, 1), e -= LOG_BASE) ;
339
+ for (i = 1, v = c[0]; v >= 10; v /= 10, i++) ;
340
+ if (i < LOG_BASE) e -= LOG_BASE - i;
341
+ }
342
+ rand.e = e;
343
+ rand.c = c;
344
+ return rand;
345
+ };
346
+ }();
347
+ BigNumber2.sum = function() {
348
+ var i = 1, args = arguments, sum = new BigNumber2(args[0]);
349
+ for (; i < args.length; ) sum = sum.plus(args[i++]);
350
+ return sum;
351
+ };
352
+ convertBase = /* @__PURE__ */ function() {
353
+ var decimal = "0123456789";
354
+ function toBaseOut(str, baseIn, baseOut, alphabet) {
355
+ var j, arr = [0], arrL, i = 0, len = str.length;
356
+ for (; i < len; ) {
357
+ for (arrL = arr.length; arrL--; arr[arrL] *= baseIn) ;
358
+ arr[0] += alphabet.indexOf(str.charAt(i++));
359
+ for (j = 0; j < arr.length; j++) {
360
+ if (arr[j] > baseOut - 1) {
361
+ if (arr[j + 1] == null) arr[j + 1] = 0;
362
+ arr[j + 1] += arr[j] / baseOut | 0;
363
+ arr[j] %= baseOut;
364
+ }
365
+ }
366
+ }
367
+ return arr.reverse();
368
+ }
369
+ return function(str, baseIn, baseOut, sign, callerIsToString) {
370
+ var alphabet, d, e, k, r, x, xc, y, i = str.indexOf("."), dp = DECIMAL_PLACES, rm = ROUNDING_MODE;
371
+ if (i >= 0) {
372
+ k = POW_PRECISION;
373
+ POW_PRECISION = 0;
374
+ str = str.replace(".", "");
375
+ y = new BigNumber2(baseIn);
376
+ x = y.pow(str.length - i);
377
+ POW_PRECISION = k;
378
+ y.c = toBaseOut(
379
+ toFixedPoint(coeffToString(x.c), x.e, "0"),
380
+ 10,
381
+ baseOut,
382
+ decimal
383
+ );
384
+ y.e = y.c.length;
385
+ }
386
+ xc = toBaseOut(str, baseIn, baseOut, callerIsToString ? (alphabet = ALPHABET, decimal) : (alphabet = decimal, ALPHABET));
387
+ e = k = xc.length;
388
+ for (; xc[--k] == 0; xc.pop()) ;
389
+ if (!xc[0]) return alphabet.charAt(0);
390
+ if (i < 0) {
391
+ --e;
392
+ } else {
393
+ x.c = xc;
394
+ x.e = e;
395
+ x.s = sign;
396
+ x = div(x, y, dp, rm, baseOut);
397
+ xc = x.c;
398
+ r = x.r;
399
+ e = x.e;
400
+ }
401
+ d = e + dp + 1;
402
+ i = xc[d];
403
+ k = baseOut / 2;
404
+ r = r || d < 0 || xc[d + 1] != null;
405
+ 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));
406
+ if (d < 1 || !xc[0]) {
407
+ str = r ? toFixedPoint(alphabet.charAt(1), -dp, alphabet.charAt(0)) : alphabet.charAt(0);
408
+ } else {
409
+ xc.length = d;
410
+ if (r) {
411
+ for (--baseOut; ++xc[--d] > baseOut; ) {
412
+ xc[d] = 0;
413
+ if (!d) {
414
+ ++e;
415
+ xc = [1].concat(xc);
416
+ }
417
+ }
418
+ }
419
+ for (k = xc.length; !xc[--k]; ) ;
420
+ for (i = 0, str = ""; i <= k; str += alphabet.charAt(xc[i++])) ;
421
+ str = toFixedPoint(str, e, alphabet.charAt(0));
422
+ }
423
+ return str;
424
+ };
425
+ }();
426
+ div = /* @__PURE__ */ function() {
427
+ function multiply(x, k, base) {
428
+ var m, temp, xlo, xhi, carry = 0, i = x.length, klo = k % SQRT_BASE, khi = k / SQRT_BASE | 0;
429
+ for (x = x.slice(); i--; ) {
430
+ xlo = x[i] % SQRT_BASE;
431
+ xhi = x[i] / SQRT_BASE | 0;
432
+ m = khi * xlo + xhi * klo;
433
+ temp = klo * xlo + m % SQRT_BASE * SQRT_BASE + carry;
434
+ carry = (temp / base | 0) + (m / SQRT_BASE | 0) + khi * xhi;
435
+ x[i] = temp % base;
436
+ }
437
+ if (carry) x = [carry].concat(x);
438
+ return x;
439
+ }
440
+ function compare2(a, b, aL, bL) {
441
+ var i, cmp;
442
+ if (aL != bL) {
443
+ cmp = aL > bL ? 1 : -1;
444
+ } else {
445
+ for (i = cmp = 0; i < aL; i++) {
446
+ if (a[i] != b[i]) {
447
+ cmp = a[i] > b[i] ? 1 : -1;
448
+ break;
449
+ }
450
+ }
451
+ }
452
+ return cmp;
453
+ }
454
+ function subtract(a, b, aL, base) {
455
+ var i = 0;
456
+ for (; aL--; ) {
457
+ a[aL] -= i;
458
+ i = a[aL] < b[aL] ? 1 : 0;
459
+ a[aL] = i * base + a[aL] - b[aL];
460
+ }
461
+ for (; !a[0] && a.length > 1; a.splice(0, 1)) ;
462
+ }
463
+ return function(x, y, dp, rm, base) {
464
+ 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;
465
+ if (!xc || !xc[0] || !yc || !yc[0]) {
466
+ return new BigNumber2(
467
+ // Return NaN if either NaN, or both Infinity or 0.
468
+ !x.s || !y.s || (xc ? yc && xc[0] == yc[0] : !yc) ? NaN : (
469
+ // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
470
+ xc && xc[0] == 0 || !yc ? s * 0 : s / 0
471
+ )
472
+ );
473
+ }
474
+ q = new BigNumber2(s);
475
+ qc = q.c = [];
476
+ e = x.e - y.e;
477
+ s = dp + e + 1;
478
+ if (!base) {
479
+ base = BASE;
480
+ e = bitFloor(x.e / LOG_BASE) - bitFloor(y.e / LOG_BASE);
481
+ s = s / LOG_BASE | 0;
482
+ }
483
+ for (i = 0; yc[i] == (xc[i] || 0); i++) ;
484
+ if (yc[i] > (xc[i] || 0)) e--;
485
+ if (s < 0) {
486
+ qc.push(1);
487
+ more = true;
488
+ } else {
489
+ xL = xc.length;
490
+ yL = yc.length;
491
+ i = 0;
492
+ s += 2;
493
+ n = mathfloor(base / (yc[0] + 1));
494
+ if (n > 1) {
495
+ yc = multiply(yc, n, base);
496
+ xc = multiply(xc, n, base);
497
+ yL = yc.length;
498
+ xL = xc.length;
499
+ }
500
+ xi = yL;
501
+ rem = xc.slice(0, yL);
502
+ remL = rem.length;
503
+ for (; remL < yL; rem[remL++] = 0) ;
504
+ yz = yc.slice();
505
+ yz = [0].concat(yz);
506
+ yc0 = yc[0];
507
+ if (yc[1] >= base / 2) yc0++;
508
+ do {
509
+ n = 0;
510
+ cmp = compare2(yc, rem, yL, remL);
511
+ if (cmp < 0) {
512
+ rem0 = rem[0];
513
+ if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
514
+ n = mathfloor(rem0 / yc0);
515
+ if (n > 1) {
516
+ if (n >= base) n = base - 1;
517
+ prod = multiply(yc, n, base);
518
+ prodL = prod.length;
519
+ remL = rem.length;
520
+ while (compare2(prod, rem, prodL, remL) == 1) {
521
+ n--;
522
+ subtract(prod, yL < prodL ? yz : yc, prodL, base);
523
+ prodL = prod.length;
524
+ cmp = 1;
525
+ }
526
+ } else {
527
+ if (n == 0) {
528
+ cmp = n = 1;
529
+ }
530
+ prod = yc.slice();
531
+ prodL = prod.length;
532
+ }
533
+ if (prodL < remL) prod = [0].concat(prod);
534
+ subtract(rem, prod, remL, base);
535
+ remL = rem.length;
536
+ if (cmp == -1) {
537
+ while (compare2(yc, rem, yL, remL) < 1) {
538
+ n++;
539
+ subtract(rem, yL < remL ? yz : yc, remL, base);
540
+ remL = rem.length;
541
+ }
542
+ }
543
+ } else if (cmp === 0) {
544
+ n++;
545
+ rem = [0];
546
+ }
547
+ qc[i++] = n;
548
+ if (rem[0]) {
549
+ rem[remL++] = xc[xi] || 0;
550
+ } else {
551
+ rem = [xc[xi]];
552
+ remL = 1;
553
+ }
554
+ } while ((xi++ < xL || rem[0] != null) && s--);
555
+ more = rem[0] != null;
556
+ if (!qc[0]) qc.splice(0, 1);
557
+ }
558
+ if (base == BASE) {
559
+ for (i = 1, s = qc[0]; s >= 10; s /= 10, i++) ;
560
+ round(q, dp + (q.e = i + e * LOG_BASE - 1) + 1, rm, more);
561
+ } else {
562
+ q.e = e;
563
+ q.r = +more;
564
+ }
565
+ return q;
566
+ };
567
+ }();
568
+ function format(n, i, rm, id) {
569
+ var c0, e, ne, len, str;
570
+ if (rm == null) rm = ROUNDING_MODE;
571
+ else intCheck(rm, 0, 8);
572
+ if (!n.c) return n.toString();
573
+ c0 = n.c[0];
574
+ ne = n.e;
575
+ if (i == null) {
576
+ str = coeffToString(n.c);
577
+ str = id == 1 || id == 2 && (ne <= TO_EXP_NEG || ne >= TO_EXP_POS) ? toExponential(str, ne) : toFixedPoint(str, ne, "0");
578
+ } else {
579
+ n = round(new BigNumber2(n), i, rm);
580
+ e = n.e;
581
+ str = coeffToString(n.c);
582
+ len = str.length;
583
+ if (id == 1 || id == 2 && (i <= e || e <= TO_EXP_NEG)) {
584
+ for (; len < i; str += "0", len++) ;
585
+ str = toExponential(str, e);
586
+ } else {
587
+ i -= ne + (id === 2 && e > ne);
588
+ str = toFixedPoint(str, e, "0");
589
+ if (e + 1 > len) {
590
+ if (--i > 0) for (str += "."; i--; str += "0") ;
591
+ } else {
592
+ i += e - len;
593
+ if (i > 0) {
594
+ if (e + 1 == len) str += ".";
595
+ for (; i--; str += "0") ;
596
+ }
597
+ }
598
+ }
599
+ }
600
+ return n.s < 0 && c0 ? "-" + str : str;
601
+ }
602
+ function maxOrMin(args, n) {
603
+ var k, y, i = 1, x = new BigNumber2(args[0]);
604
+ for (; i < args.length; i++) {
605
+ y = new BigNumber2(args[i]);
606
+ if (!y.s || (k = compare(x, y)) === n || k === 0 && x.s === n) {
607
+ x = y;
608
+ }
609
+ }
610
+ return x;
611
+ }
612
+ function normalise(n, c, e) {
613
+ var i = 1, j = c.length;
614
+ for (; !c[--j]; c.pop()) ;
615
+ for (j = c[0]; j >= 10; j /= 10, i++) ;
616
+ if ((e = i + e * LOG_BASE - 1) > MAX_EXP) {
617
+ n.c = n.e = null;
618
+ } else if (e < MIN_EXP) {
619
+ n.c = [n.e = 0];
620
+ } else {
621
+ n.e = e;
622
+ n.c = c;
623
+ }
624
+ return n;
625
+ }
626
+ parseNumeric = /* @__PURE__ */ function() {
627
+ var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i, dotAfter = /^([^.]+)\.$/, dotBefore = /^\.([^.]+)$/, isInfinityOrNaN = /^-?(Infinity|NaN)$/, whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
628
+ return function(x, str, isNum, b) {
629
+ var base, s = isNum ? str : str.replace(whitespaceOrPlus, "");
630
+ if (isInfinityOrNaN.test(s)) {
631
+ x.s = isNaN(s) ? null : s < 0 ? -1 : 1;
632
+ } else {
633
+ if (!isNum) {
634
+ s = s.replace(basePrefix, function(m, p1, p2) {
635
+ base = (p2 = p2.toLowerCase()) == "x" ? 16 : p2 == "b" ? 2 : 8;
636
+ return !b || b == base ? p1 : m;
637
+ });
638
+ if (b) {
639
+ base = b;
640
+ s = s.replace(dotAfter, "$1").replace(dotBefore, "0.$1");
641
+ }
642
+ if (str != s) return new BigNumber2(s, base);
643
+ }
644
+ if (BigNumber2.DEBUG) {
645
+ throw Error(bignumberError + "Not a" + (b ? " base " + b : "") + " number: " + str);
646
+ }
647
+ x.s = null;
648
+ }
649
+ x.c = x.e = null;
650
+ };
651
+ }();
652
+ function round(x, sd, rm, r) {
653
+ var d, i, j, k, n, ni, rd, xc = x.c, pows10 = POWS_TEN;
654
+ if (xc) {
655
+ out: {
656
+ for (d = 1, k = xc[0]; k >= 10; k /= 10, d++) ;
657
+ i = sd - d;
658
+ if (i < 0) {
659
+ i += LOG_BASE;
660
+ j = sd;
661
+ n = xc[ni = 0];
662
+ rd = mathfloor(n / pows10[d - j - 1] % 10);
663
+ } else {
664
+ ni = mathceil((i + 1) / LOG_BASE);
665
+ if (ni >= xc.length) {
666
+ if (r) {
667
+ for (; xc.length <= ni; xc.push(0)) ;
668
+ n = rd = 0;
669
+ d = 1;
670
+ i %= LOG_BASE;
671
+ j = i - LOG_BASE + 1;
672
+ } else {
673
+ break out;
674
+ }
675
+ } else {
676
+ n = k = xc[ni];
677
+ for (d = 1; k >= 10; k /= 10, d++) ;
678
+ i %= LOG_BASE;
679
+ j = i - LOG_BASE + d;
680
+ rd = j < 0 ? 0 : mathfloor(n / pows10[d - j - 1] % 10);
681
+ }
682
+ }
683
+ r = r || sd < 0 || // Are there any non-zero digits after the rounding digit?
684
+ // The expression n % pows10[d - j - 1] returns all digits of n to the right
685
+ // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
686
+ xc[ni + 1] != null || (j < 0 ? n : n % pows10[d - j - 1]);
687
+ 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.
688
+ (i > 0 ? j > 0 ? n / pows10[d - j] : 0 : xc[ni - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
689
+ if (sd < 1 || !xc[0]) {
690
+ xc.length = 0;
691
+ if (r) {
692
+ sd -= x.e + 1;
693
+ xc[0] = pows10[(LOG_BASE - sd % LOG_BASE) % LOG_BASE];
694
+ x.e = -sd || 0;
695
+ } else {
696
+ xc[0] = x.e = 0;
697
+ }
698
+ return x;
699
+ }
700
+ if (i == 0) {
701
+ xc.length = ni;
702
+ k = 1;
703
+ ni--;
704
+ } else {
705
+ xc.length = ni + 1;
706
+ k = pows10[LOG_BASE - i];
707
+ xc[ni] = j > 0 ? mathfloor(n / pows10[d - j] % pows10[j]) * k : 0;
708
+ }
709
+ if (r) {
710
+ for (; ; ) {
711
+ if (ni == 0) {
712
+ for (i = 1, j = xc[0]; j >= 10; j /= 10, i++) ;
713
+ j = xc[0] += k;
714
+ for (k = 1; j >= 10; j /= 10, k++) ;
715
+ if (i != k) {
716
+ x.e++;
717
+ if (xc[0] == BASE) xc[0] = 1;
718
+ }
719
+ break;
720
+ } else {
721
+ xc[ni] += k;
722
+ if (xc[ni] != BASE) break;
723
+ xc[ni--] = 0;
724
+ k = 1;
725
+ }
726
+ }
727
+ }
728
+ for (i = xc.length; xc[--i] === 0; xc.pop()) ;
729
+ }
730
+ if (x.e > MAX_EXP) {
731
+ x.c = x.e = null;
732
+ } else if (x.e < MIN_EXP) {
733
+ x.c = [x.e = 0];
734
+ }
735
+ }
736
+ return x;
737
+ }
738
+ function valueOf(n) {
739
+ var str, e = n.e;
740
+ if (e === null) return n.toString();
741
+ str = coeffToString(n.c);
742
+ str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(str, e) : toFixedPoint(str, e, "0");
743
+ return n.s < 0 ? "-" + str : str;
744
+ }
745
+ P.absoluteValue = P.abs = function() {
746
+ var x = new BigNumber2(this);
747
+ if (x.s < 0) x.s = 1;
748
+ return x;
749
+ };
750
+ P.comparedTo = function(y, b) {
751
+ return compare(this, new BigNumber2(y, b));
752
+ };
753
+ P.decimalPlaces = P.dp = function(dp, rm) {
754
+ var c, n, v, x = this;
755
+ if (dp != null) {
756
+ intCheck(dp, 0, MAX);
757
+ if (rm == null) rm = ROUNDING_MODE;
758
+ else intCheck(rm, 0, 8);
759
+ return round(new BigNumber2(x), dp + x.e + 1, rm);
760
+ }
761
+ if (!(c = x.c)) return null;
762
+ n = ((v = c.length - 1) - bitFloor(this.e / LOG_BASE)) * LOG_BASE;
763
+ if (v = c[v]) for (; v % 10 == 0; v /= 10, n--) ;
764
+ if (n < 0) n = 0;
765
+ return n;
766
+ };
767
+ P.dividedBy = P.div = function(y, b) {
768
+ return div(this, new BigNumber2(y, b), DECIMAL_PLACES, ROUNDING_MODE);
769
+ };
770
+ P.dividedToIntegerBy = P.idiv = function(y, b) {
771
+ return div(this, new BigNumber2(y, b), 0, 1);
772
+ };
773
+ P.exponentiatedBy = P.pow = function(n, m) {
774
+ var half, isModExp, i, k, more, nIsBig, nIsNeg, nIsOdd, y, x = this;
775
+ n = new BigNumber2(n);
776
+ if (n.c && !n.isInteger()) {
777
+ throw Error(bignumberError + "Exponent not an integer: " + valueOf(n));
778
+ }
779
+ if (m != null) m = new BigNumber2(m);
780
+ nIsBig = n.e > 14;
781
+ if (!x.c || !x.c[0] || x.c[0] == 1 && !x.e && x.c.length == 1 || !n.c || !n.c[0]) {
782
+ y = new BigNumber2(Math.pow(+valueOf(x), nIsBig ? n.s * (2 - isOdd(n)) : +valueOf(n)));
783
+ return m ? y.mod(m) : y;
784
+ }
785
+ nIsNeg = n.s < 0;
786
+ if (m) {
787
+ if (m.c ? !m.c[0] : !m.s) return new BigNumber2(NaN);
788
+ isModExp = !nIsNeg && x.isInteger() && m.isInteger();
789
+ if (isModExp) x = x.mod(m);
790
+ } 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))) {
791
+ k = x.s < 0 && isOdd(n) ? -0 : 0;
792
+ if (x.e > -1) k = 1 / k;
793
+ return new BigNumber2(nIsNeg ? 1 / k : k);
794
+ } else if (POW_PRECISION) {
795
+ k = mathceil(POW_PRECISION / LOG_BASE + 2);
796
+ }
797
+ if (nIsBig) {
798
+ half = new BigNumber2(0.5);
799
+ if (nIsNeg) n.s = 1;
800
+ nIsOdd = isOdd(n);
801
+ } else {
802
+ i = Math.abs(+valueOf(n));
803
+ nIsOdd = i % 2;
804
+ }
805
+ y = new BigNumber2(ONE);
806
+ for (; ; ) {
807
+ if (nIsOdd) {
808
+ y = y.times(x);
809
+ if (!y.c) break;
810
+ if (k) {
811
+ if (y.c.length > k) y.c.length = k;
812
+ } else if (isModExp) {
813
+ y = y.mod(m);
814
+ }
815
+ }
816
+ if (i) {
817
+ i = mathfloor(i / 2);
818
+ if (i === 0) break;
819
+ nIsOdd = i % 2;
820
+ } else {
821
+ n = n.times(half);
822
+ round(n, n.e + 1, 1);
823
+ if (n.e > 14) {
824
+ nIsOdd = isOdd(n);
825
+ } else {
826
+ i = +valueOf(n);
827
+ if (i === 0) break;
828
+ nIsOdd = i % 2;
829
+ }
830
+ }
831
+ x = x.times(x);
832
+ if (k) {
833
+ if (x.c && x.c.length > k) x.c.length = k;
834
+ } else if (isModExp) {
835
+ x = x.mod(m);
836
+ }
837
+ }
838
+ if (isModExp) return y;
839
+ if (nIsNeg) y = ONE.div(y);
840
+ return m ? y.mod(m) : k ? round(y, POW_PRECISION, ROUNDING_MODE, more) : y;
841
+ };
842
+ P.integerValue = function(rm) {
843
+ var n = new BigNumber2(this);
844
+ if (rm == null) rm = ROUNDING_MODE;
845
+ else intCheck(rm, 0, 8);
846
+ return round(n, n.e + 1, rm);
847
+ };
848
+ P.isEqualTo = P.eq = function(y, b) {
849
+ return compare(this, new BigNumber2(y, b)) === 0;
850
+ };
851
+ P.isFinite = function() {
852
+ return !!this.c;
853
+ };
854
+ P.isGreaterThan = P.gt = function(y, b) {
855
+ return compare(this, new BigNumber2(y, b)) > 0;
856
+ };
857
+ P.isGreaterThanOrEqualTo = P.gte = function(y, b) {
858
+ return (b = compare(this, new BigNumber2(y, b))) === 1 || b === 0;
859
+ };
860
+ P.isInteger = function() {
861
+ return !!this.c && bitFloor(this.e / LOG_BASE) > this.c.length - 2;
862
+ };
863
+ P.isLessThan = P.lt = function(y, b) {
864
+ return compare(this, new BigNumber2(y, b)) < 0;
865
+ };
866
+ P.isLessThanOrEqualTo = P.lte = function(y, b) {
867
+ return (b = compare(this, new BigNumber2(y, b))) === -1 || b === 0;
868
+ };
869
+ P.isNaN = function() {
870
+ return !this.s;
871
+ };
872
+ P.isNegative = function() {
873
+ return this.s < 0;
874
+ };
875
+ P.isPositive = function() {
876
+ return this.s > 0;
877
+ };
878
+ P.isZero = function() {
879
+ return !!this.c && this.c[0] == 0;
880
+ };
881
+ P.minus = function(y, b) {
882
+ var i, j, t, xLTy, x = this, a = x.s;
883
+ y = new BigNumber2(y, b);
884
+ b = y.s;
885
+ if (!a || !b) return new BigNumber2(NaN);
886
+ if (a != b) {
887
+ y.s = -b;
888
+ return x.plus(y);
889
+ }
890
+ var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
891
+ if (!xe || !ye) {
892
+ if (!xc || !yc) return xc ? (y.s = -b, y) : new BigNumber2(yc ? x : NaN);
893
+ if (!xc[0] || !yc[0]) {
894
+ return yc[0] ? (y.s = -b, y) : new BigNumber2(xc[0] ? x : (
895
+ // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
896
+ ROUNDING_MODE == 3 ? -0 : 0
897
+ ));
898
+ }
899
+ }
900
+ xe = bitFloor(xe);
901
+ ye = bitFloor(ye);
902
+ xc = xc.slice();
903
+ if (a = xe - ye) {
904
+ if (xLTy = a < 0) {
905
+ a = -a;
906
+ t = xc;
907
+ } else {
908
+ ye = xe;
909
+ t = yc;
910
+ }
911
+ t.reverse();
912
+ for (b = a; b--; t.push(0)) ;
913
+ t.reverse();
914
+ } else {
915
+ j = (xLTy = (a = xc.length) < (b = yc.length)) ? a : b;
916
+ for (a = b = 0; b < j; b++) {
917
+ if (xc[b] != yc[b]) {
918
+ xLTy = xc[b] < yc[b];
919
+ break;
920
+ }
921
+ }
922
+ }
923
+ if (xLTy) {
924
+ t = xc;
925
+ xc = yc;
926
+ yc = t;
927
+ y.s = -y.s;
928
+ }
929
+ b = (j = yc.length) - (i = xc.length);
930
+ if (b > 0) for (; b--; xc[i++] = 0) ;
931
+ b = BASE - 1;
932
+ for (; j > a; ) {
933
+ if (xc[--j] < yc[j]) {
934
+ for (i = j; i && !xc[--i]; xc[i] = b) ;
935
+ --xc[i];
936
+ xc[j] += BASE;
937
+ }
938
+ xc[j] -= yc[j];
939
+ }
940
+ for (; xc[0] == 0; xc.splice(0, 1), --ye) ;
941
+ if (!xc[0]) {
942
+ y.s = ROUNDING_MODE == 3 ? -1 : 1;
943
+ y.c = [y.e = 0];
944
+ return y;
945
+ }
946
+ return normalise(y, xc, ye);
947
+ };
948
+ P.modulo = P.mod = function(y, b) {
949
+ var q, s, x = this;
950
+ y = new BigNumber2(y, b);
951
+ if (!x.c || !y.s || y.c && !y.c[0]) {
952
+ return new BigNumber2(NaN);
953
+ } else if (!y.c || x.c && !x.c[0]) {
954
+ return new BigNumber2(x);
955
+ }
956
+ if (MODULO_MODE == 9) {
957
+ s = y.s;
958
+ y.s = 1;
959
+ q = div(x, y, 0, 3);
960
+ y.s = s;
961
+ q.s *= s;
962
+ } else {
963
+ q = div(x, y, 0, MODULO_MODE);
964
+ }
965
+ y = x.minus(q.times(y));
966
+ if (!y.c[0] && MODULO_MODE == 1) y.s = x.s;
967
+ return y;
968
+ };
969
+ P.multipliedBy = P.times = function(y, b) {
970
+ 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;
971
+ if (!xc || !yc || !xc[0] || !yc[0]) {
972
+ if (!x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc) {
973
+ y.c = y.e = y.s = null;
974
+ } else {
975
+ y.s *= x.s;
976
+ if (!xc || !yc) {
977
+ y.c = y.e = null;
978
+ } else {
979
+ y.c = [0];
980
+ y.e = 0;
981
+ }
982
+ }
983
+ return y;
984
+ }
985
+ e = bitFloor(x.e / LOG_BASE) + bitFloor(y.e / LOG_BASE);
986
+ y.s *= x.s;
987
+ xcL = xc.length;
988
+ ycL = yc.length;
989
+ if (xcL < ycL) {
990
+ zc = xc;
991
+ xc = yc;
992
+ yc = zc;
993
+ i = xcL;
994
+ xcL = ycL;
995
+ ycL = i;
996
+ }
997
+ for (i = xcL + ycL, zc = []; i--; zc.push(0)) ;
998
+ base = BASE;
999
+ sqrtBase = SQRT_BASE;
1000
+ for (i = ycL; --i >= 0; ) {
1001
+ c = 0;
1002
+ ylo = yc[i] % sqrtBase;
1003
+ yhi = yc[i] / sqrtBase | 0;
1004
+ for (k = xcL, j = i + k; j > i; ) {
1005
+ xlo = xc[--k] % sqrtBase;
1006
+ xhi = xc[k] / sqrtBase | 0;
1007
+ m = yhi * xlo + xhi * ylo;
1008
+ xlo = ylo * xlo + m % sqrtBase * sqrtBase + zc[j] + c;
1009
+ c = (xlo / base | 0) + (m / sqrtBase | 0) + yhi * xhi;
1010
+ zc[j--] = xlo % base;
1011
+ }
1012
+ zc[j] = c;
1013
+ }
1014
+ if (c) {
1015
+ ++e;
1016
+ } else {
1017
+ zc.splice(0, 1);
1018
+ }
1019
+ return normalise(y, zc, e);
1020
+ };
1021
+ P.negated = function() {
1022
+ var x = new BigNumber2(this);
1023
+ x.s = -x.s || null;
1024
+ return x;
1025
+ };
1026
+ P.plus = function(y, b) {
1027
+ var t, x = this, a = x.s;
1028
+ y = new BigNumber2(y, b);
1029
+ b = y.s;
1030
+ if (!a || !b) return new BigNumber2(NaN);
1031
+ if (a != b) {
1032
+ y.s = -b;
1033
+ return x.minus(y);
1034
+ }
1035
+ var xe = x.e / LOG_BASE, ye = y.e / LOG_BASE, xc = x.c, yc = y.c;
1036
+ if (!xe || !ye) {
1037
+ if (!xc || !yc) return new BigNumber2(a / 0);
1038
+ if (!xc[0] || !yc[0]) return yc[0] ? y : new BigNumber2(xc[0] ? x : a * 0);
1039
+ }
1040
+ xe = bitFloor(xe);
1041
+ ye = bitFloor(ye);
1042
+ xc = xc.slice();
1043
+ if (a = xe - ye) {
1044
+ if (a > 0) {
1045
+ ye = xe;
1046
+ t = yc;
1047
+ } else {
1048
+ a = -a;
1049
+ t = xc;
1050
+ }
1051
+ t.reverse();
1052
+ for (; a--; t.push(0)) ;
1053
+ t.reverse();
1054
+ }
1055
+ a = xc.length;
1056
+ b = yc.length;
1057
+ if (a - b < 0) {
1058
+ t = yc;
1059
+ yc = xc;
1060
+ xc = t;
1061
+ b = a;
1062
+ }
1063
+ for (a = 0; b; ) {
1064
+ a = (xc[--b] = xc[b] + yc[b] + a) / BASE | 0;
1065
+ xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
1066
+ }
1067
+ if (a) {
1068
+ xc = [a].concat(xc);
1069
+ ++ye;
1070
+ }
1071
+ return normalise(y, xc, ye);
1072
+ };
1073
+ P.precision = P.sd = function(sd, rm) {
1074
+ var c, n, v, x = this;
1075
+ if (sd != null && sd !== !!sd) {
1076
+ intCheck(sd, 1, MAX);
1077
+ if (rm == null) rm = ROUNDING_MODE;
1078
+ else intCheck(rm, 0, 8);
1079
+ return round(new BigNumber2(x), sd, rm);
1080
+ }
1081
+ if (!(c = x.c)) return null;
1082
+ v = c.length - 1;
1083
+ n = v * LOG_BASE + 1;
1084
+ if (v = c[v]) {
1085
+ for (; v % 10 == 0; v /= 10, n--) ;
1086
+ for (v = c[0]; v >= 10; v /= 10, n++) ;
1087
+ }
1088
+ if (sd && x.e + 1 > n) n = x.e + 1;
1089
+ return n;
1090
+ };
1091
+ P.shiftedBy = function(k) {
1092
+ intCheck(k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER);
1093
+ return this.times("1e" + k);
1094
+ };
1095
+ P.squareRoot = P.sqrt = function() {
1096
+ 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");
1097
+ if (s !== 1 || !c || !c[0]) {
1098
+ return new BigNumber2(!s || s < 0 && (!c || c[0]) ? NaN : c ? x : 1 / 0);
1099
+ }
1100
+ s = Math.sqrt(+valueOf(x));
1101
+ if (s == 0 || s == 1 / 0) {
1102
+ n = coeffToString(c);
1103
+ if ((n.length + e) % 2 == 0) n += "0";
1104
+ s = Math.sqrt(+n);
1105
+ e = bitFloor((e + 1) / 2) - (e < 0 || e % 2);
1106
+ if (s == 1 / 0) {
1107
+ n = "5e" + e;
1108
+ } else {
1109
+ n = s.toExponential();
1110
+ n = n.slice(0, n.indexOf("e") + 1) + e;
1111
+ }
1112
+ r = new BigNumber2(n);
1113
+ } else {
1114
+ r = new BigNumber2(s + "");
1115
+ }
1116
+ if (r.c[0]) {
1117
+ e = r.e;
1118
+ s = e + dp;
1119
+ if (s < 3) s = 0;
1120
+ for (; ; ) {
1121
+ t = r;
1122
+ r = half.times(t.plus(div(x, t, dp, 1)));
1123
+ if (coeffToString(t.c).slice(0, s) === (n = coeffToString(r.c)).slice(0, s)) {
1124
+ if (r.e < e) --s;
1125
+ n = n.slice(s - 3, s + 1);
1126
+ if (n == "9999" || !rep && n == "4999") {
1127
+ if (!rep) {
1128
+ round(t, t.e + DECIMAL_PLACES + 2, 0);
1129
+ if (t.times(t).eq(x)) {
1130
+ r = t;
1131
+ break;
1132
+ }
1133
+ }
1134
+ dp += 4;
1135
+ s += 4;
1136
+ rep = 1;
1137
+ } else {
1138
+ if (!+n || !+n.slice(1) && n.charAt(0) == "5") {
1139
+ round(r, r.e + DECIMAL_PLACES + 2, 1);
1140
+ m = !r.times(r).eq(x);
1141
+ }
1142
+ break;
1143
+ }
1144
+ }
1145
+ }
1146
+ }
1147
+ return round(r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m);
1148
+ };
1149
+ P.toExponential = function(dp, rm) {
1150
+ if (dp != null) {
1151
+ intCheck(dp, 0, MAX);
1152
+ dp++;
1153
+ }
1154
+ return format(this, dp, rm, 1);
1155
+ };
1156
+ P.toFixed = function(dp, rm) {
1157
+ if (dp != null) {
1158
+ intCheck(dp, 0, MAX);
1159
+ dp = dp + this.e + 1;
1160
+ }
1161
+ return format(this, dp, rm);
1162
+ };
1163
+ P.toFormat = function(dp, rm, format2) {
1164
+ var str, x = this;
1165
+ if (format2 == null) {
1166
+ if (dp != null && rm && typeof rm == "object") {
1167
+ format2 = rm;
1168
+ rm = null;
1169
+ } else if (dp && typeof dp == "object") {
1170
+ format2 = dp;
1171
+ dp = rm = null;
1172
+ } else {
1173
+ format2 = FORMAT;
1174
+ }
1175
+ } else if (typeof format2 != "object") {
1176
+ throw Error(bignumberError + "Argument not an object: " + format2);
1177
+ }
1178
+ str = x.toFixed(dp, rm);
1179
+ if (x.c) {
1180
+ 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;
1181
+ if (g2) {
1182
+ i = g1;
1183
+ g1 = g2;
1184
+ g2 = i;
1185
+ len -= i;
1186
+ }
1187
+ if (g1 > 0 && len > 0) {
1188
+ i = len % g1 || g1;
1189
+ intPart = intDigits.substr(0, i);
1190
+ for (; i < len; i += g1) intPart += groupSeparator + intDigits.substr(i, g1);
1191
+ if (g2 > 0) intPart += groupSeparator + intDigits.slice(i);
1192
+ if (isNeg) intPart = "-" + intPart;
1193
+ }
1194
+ str = fractionPart ? intPart + (format2.decimalSeparator || "") + ((g2 = +format2.fractionGroupSize) ? fractionPart.replace(
1195
+ new RegExp("\\d{" + g2 + "}\\B", "g"),
1196
+ "$&" + (format2.fractionGroupSeparator || "")
1197
+ ) : fractionPart) : intPart;
1198
+ }
1199
+ return (format2.prefix || "") + str + (format2.suffix || "");
1200
+ };
1201
+ P.toFraction = function(md) {
1202
+ var d, d0, d1, d2, e, exp, n, n0, n1, q, r, s, x = this, xc = x.c;
1203
+ if (md != null) {
1204
+ n = new BigNumber2(md);
1205
+ if (!n.isInteger() && (n.c || n.s !== 1) || n.lt(ONE)) {
1206
+ throw Error(bignumberError + "Argument " + (n.isInteger() ? "out of range: " : "not an integer: ") + valueOf(n));
1207
+ }
1208
+ }
1209
+ if (!xc) return new BigNumber2(x);
1210
+ d = new BigNumber2(ONE);
1211
+ n1 = d0 = new BigNumber2(ONE);
1212
+ d1 = n0 = new BigNumber2(ONE);
1213
+ s = coeffToString(xc);
1214
+ e = d.e = s.length - x.e - 1;
1215
+ d.c[0] = POWS_TEN[(exp = e % LOG_BASE) < 0 ? LOG_BASE + exp : exp];
1216
+ md = !md || n.comparedTo(d) > 0 ? e > 0 ? d : n1 : n;
1217
+ exp = MAX_EXP;
1218
+ MAX_EXP = 1 / 0;
1219
+ n = new BigNumber2(s);
1220
+ n0.c[0] = 0;
1221
+ for (; ; ) {
1222
+ q = div(n, d, 0, 1);
1223
+ d2 = d0.plus(q.times(d1));
1224
+ if (d2.comparedTo(md) == 1) break;
1225
+ d0 = d1;
1226
+ d1 = d2;
1227
+ n1 = n0.plus(q.times(d2 = n1));
1228
+ n0 = d2;
1229
+ d = n.minus(q.times(d2 = d));
1230
+ n = d2;
1231
+ }
1232
+ d2 = div(md.minus(d0), d1, 0, 1);
1233
+ n0 = n0.plus(d2.times(n1));
1234
+ d0 = d0.plus(d2.times(d1));
1235
+ n0.s = n1.s = x.s;
1236
+ e = e * 2;
1237
+ r = div(n1, d1, e, ROUNDING_MODE).minus(x).abs().comparedTo(
1238
+ div(n0, d0, e, ROUNDING_MODE).minus(x).abs()
1239
+ ) < 1 ? [n1, d1] : [n0, d0];
1240
+ MAX_EXP = exp;
1241
+ return r;
1242
+ };
1243
+ P.toNumber = function() {
1244
+ return +valueOf(this);
1245
+ };
1246
+ P.toPrecision = function(sd, rm) {
1247
+ if (sd != null) intCheck(sd, 1, MAX);
1248
+ return format(this, sd, rm, 2);
1249
+ };
1250
+ P.toString = function(b) {
1251
+ var str, n = this, s = n.s, e = n.e;
1252
+ if (e === null) {
1253
+ if (s) {
1254
+ str = "Infinity";
1255
+ if (s < 0) str = "-" + str;
1256
+ } else {
1257
+ str = "NaN";
1258
+ }
1259
+ } else {
1260
+ if (b == null) {
1261
+ str = e <= TO_EXP_NEG || e >= TO_EXP_POS ? toExponential(coeffToString(n.c), e) : toFixedPoint(coeffToString(n.c), e, "0");
1262
+ } else if (b === 10 && alphabetHasNormalDecimalDigits) {
1263
+ n = round(new BigNumber2(n), DECIMAL_PLACES + e + 1, ROUNDING_MODE);
1264
+ str = toFixedPoint(coeffToString(n.c), n.e, "0");
1265
+ } else {
1266
+ intCheck(b, 2, ALPHABET.length, "Base");
1267
+ str = convertBase(toFixedPoint(coeffToString(n.c), e, "0"), 10, b, s, true);
1268
+ }
1269
+ if (s < 0 && n.c[0]) str = "-" + str;
1270
+ }
1271
+ return str;
1272
+ };
1273
+ P.valueOf = P.toJSON = function() {
1274
+ return valueOf(this);
1275
+ };
1276
+ P._isBigNumber = true;
1277
+ if (configObject != null) BigNumber2.set(configObject);
1278
+ return BigNumber2;
1279
+ }
1280
+ function bitFloor(n) {
1281
+ var i = n | 0;
1282
+ return n > 0 || n === i ? i : i - 1;
1283
+ }
1284
+ function coeffToString(a) {
1285
+ var s, z, i = 1, j = a.length, r = a[0] + "";
1286
+ for (; i < j; ) {
1287
+ s = a[i++] + "";
1288
+ z = LOG_BASE - s.length;
1289
+ for (; z--; s = "0" + s) ;
1290
+ r += s;
1291
+ }
1292
+ for (j = r.length; r.charCodeAt(--j) === 48; ) ;
1293
+ return r.slice(0, j + 1 || 1);
1294
+ }
1295
+ function compare(x, y) {
1296
+ var a, b, xc = x.c, yc = y.c, i = x.s, j = y.s, k = x.e, l = y.e;
1297
+ if (!i || !j) return null;
1298
+ a = xc && !xc[0];
1299
+ b = yc && !yc[0];
1300
+ if (a || b) return a ? b ? 0 : -j : i;
1301
+ if (i != j) return i;
1302
+ a = i < 0;
1303
+ b = k == l;
1304
+ if (!xc || !yc) return b ? 0 : !xc ^ a ? 1 : -1;
1305
+ if (!b) return k > l ^ a ? 1 : -1;
1306
+ j = (k = xc.length) < (l = yc.length) ? k : l;
1307
+ for (i = 0; i < j; i++) if (xc[i] != yc[i]) return xc[i] > yc[i] ^ a ? 1 : -1;
1308
+ return k == l ? 0 : k > l ^ a ? 1 : -1;
1309
+ }
1310
+ function intCheck(n, min, max, name) {
1311
+ if (n < min || n > max || n !== mathfloor(n)) {
1312
+ throw Error(bignumberError + (name || "Argument") + (typeof n == "number" ? n < min || n > max ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(n));
1313
+ }
1314
+ }
1315
+ function isOdd(n) {
1316
+ var k = n.c.length - 1;
1317
+ return bitFloor(n.e / LOG_BASE) == k && n.c[k] % 2 != 0;
1318
+ }
1319
+ function toExponential(str, e) {
1320
+ return (str.length > 1 ? str.charAt(0) + "." + str.slice(1) : str) + (e < 0 ? "e" : "e+") + e;
1321
+ }
1322
+ function toFixedPoint(str, e, z) {
1323
+ var len, zs;
1324
+ if (e < 0) {
1325
+ for (zs = z + "."; ++e; zs += z) ;
1326
+ str = zs + str;
1327
+ } else {
1328
+ len = str.length;
1329
+ if (++e > len) {
1330
+ for (zs = z, e -= len; --e; zs += z) ;
1331
+ str += zs;
1332
+ } else if (e < len) {
1333
+ str = str.slice(0, e) + "." + str.slice(e);
1334
+ }
1335
+ }
1336
+ return str;
1337
+ }
1338
+ BigNumber = clone();
1339
+ BigNumber["default"] = BigNumber.BigNumber = BigNumber;
1340
+ if (typeof define == "function" && define.amd) {
1341
+ define(function() {
1342
+ return BigNumber;
1343
+ });
1344
+ } else if (typeof module != "undefined" && module.exports) {
1345
+ module.exports = BigNumber;
1346
+ } else {
1347
+ if (!globalObject) {
1348
+ globalObject = typeof self != "undefined" && self ? self : window;
1349
+ }
1350
+ globalObject.BigNumber = BigNumber;
1351
+ }
1352
+ })(exports);
1353
+ }
1354
+ });
1355
+
1356
+ // ../../node_modules/json-bigint/lib/stringify.js
1357
+ var require_stringify = __commonJS({
1358
+ "../../node_modules/json-bigint/lib/stringify.js"(exports, module) {
1359
+ var BigNumber = require_bignumber();
1360
+ var JSON = module.exports;
1361
+ (function() {
1362
+ "use strict";
1363
+ function f(n) {
1364
+ return n < 10 ? "0" + n : n;
1365
+ }
1366
+ var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = {
1367
+ // table of character substitutions
1368
+ "\b": "\\b",
1369
+ " ": "\\t",
1370
+ "\n": "\\n",
1371
+ "\f": "\\f",
1372
+ "\r": "\\r",
1373
+ '"': '\\"',
1374
+ "\\": "\\\\"
1375
+ }, rep;
1376
+ function quote(string) {
1377
+ escapable.lastIndex = 0;
1378
+ return escapable.test(string) ? '"' + string.replace(escapable, function(a) {
1379
+ var c = meta[a];
1380
+ return typeof c === "string" ? c : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
1381
+ }) + '"' : '"' + string + '"';
1382
+ }
1383
+ function str(key, holder) {
1384
+ var i, k, v, length, mind = gap, partial, value = holder[key], isBigNumber = value != null && (value instanceof BigNumber || BigNumber.isBigNumber(value));
1385
+ if (value && typeof value === "object" && typeof value.toJSON === "function") {
1386
+ value = value.toJSON(key);
1387
+ }
1388
+ if (typeof rep === "function") {
1389
+ value = rep.call(holder, key, value);
1390
+ }
1391
+ switch (typeof value) {
1392
+ case "string":
1393
+ if (isBigNumber) {
1394
+ return value;
1395
+ } else {
1396
+ return quote(value);
1397
+ }
1398
+ case "number":
1399
+ return isFinite(value) ? String(value) : "null";
1400
+ case "boolean":
1401
+ case "null":
1402
+ case "bigint":
1403
+ return String(value);
1404
+ case "object":
1405
+ if (!value) {
1406
+ return "null";
1407
+ }
1408
+ gap += indent;
1409
+ partial = [];
1410
+ if (Object.prototype.toString.apply(value) === "[object Array]") {
1411
+ length = value.length;
1412
+ for (i = 0; i < length; i += 1) {
1413
+ partial[i] = str(i, value) || "null";
1414
+ }
1415
+ v = partial.length === 0 ? "[]" : gap ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]" : "[" + partial.join(",") + "]";
1416
+ gap = mind;
1417
+ return v;
1418
+ }
1419
+ if (rep && typeof rep === "object") {
1420
+ length = rep.length;
1421
+ for (i = 0; i < length; i += 1) {
1422
+ if (typeof rep[i] === "string") {
1423
+ k = rep[i];
1424
+ v = str(k, value);
1425
+ if (v) {
1426
+ partial.push(quote(k) + (gap ? ": " : ":") + v);
1427
+ }
1428
+ }
1429
+ }
1430
+ } else {
1431
+ Object.keys(value).forEach(function(k2) {
1432
+ var v2 = str(k2, value);
1433
+ if (v2) {
1434
+ partial.push(quote(k2) + (gap ? ": " : ":") + v2);
1435
+ }
1436
+ });
1437
+ }
1438
+ v = partial.length === 0 ? "{}" : gap ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}" : "{" + partial.join(",") + "}";
1439
+ gap = mind;
1440
+ return v;
1441
+ }
1442
+ }
1443
+ if (typeof JSON.stringify !== "function") {
1444
+ JSON.stringify = function(value, replacer, space) {
1445
+ var i;
1446
+ gap = "";
1447
+ indent = "";
1448
+ if (typeof space === "number") {
1449
+ for (i = 0; i < space; i += 1) {
1450
+ indent += " ";
1451
+ }
1452
+ } else if (typeof space === "string") {
1453
+ indent = space;
1454
+ }
1455
+ rep = replacer;
1456
+ if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
1457
+ throw new Error("JSON.stringify");
1458
+ }
1459
+ return str("", { "": value });
1460
+ };
1461
+ }
1462
+ })();
1463
+ }
1464
+ });
1465
+
1466
+ // ../../node_modules/json-bigint/lib/parse.js
1467
+ var require_parse = __commonJS({
1468
+ "../../node_modules/json-bigint/lib/parse.js"(exports, module) {
1469
+ var BigNumber = null;
1470
+ var suspectProtoRx = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/;
1471
+ var suspectConstructorRx = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
1472
+ var json_parse = function(options) {
1473
+ "use strict";
1474
+ var _options = {
1475
+ strict: false,
1476
+ // not being strict means do not generate syntax errors for "duplicate key"
1477
+ storeAsString: false,
1478
+ // toggles whether the values should be stored as BigNumber (default) or a string
1479
+ alwaysParseAsBig: false,
1480
+ // toggles whether all numbers should be Big
1481
+ useNativeBigInt: false,
1482
+ // toggles whether to use native BigInt instead of bignumber.js
1483
+ protoAction: "error",
1484
+ constructorAction: "error"
1485
+ };
1486
+ if (options !== void 0 && options !== null) {
1487
+ if (options.strict === true) {
1488
+ _options.strict = true;
1489
+ }
1490
+ if (options.storeAsString === true) {
1491
+ _options.storeAsString = true;
1492
+ }
1493
+ _options.alwaysParseAsBig = options.alwaysParseAsBig === true ? options.alwaysParseAsBig : false;
1494
+ _options.useNativeBigInt = options.useNativeBigInt === true ? options.useNativeBigInt : false;
1495
+ if (typeof options.constructorAction !== "undefined") {
1496
+ if (options.constructorAction === "error" || options.constructorAction === "ignore" || options.constructorAction === "preserve") {
1497
+ _options.constructorAction = options.constructorAction;
1498
+ } else {
1499
+ throw new Error(
1500
+ `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${options.constructorAction}`
1501
+ );
1502
+ }
1503
+ }
1504
+ if (typeof options.protoAction !== "undefined") {
1505
+ if (options.protoAction === "error" || options.protoAction === "ignore" || options.protoAction === "preserve") {
1506
+ _options.protoAction = options.protoAction;
1507
+ } else {
1508
+ throw new Error(
1509
+ `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${options.protoAction}`
1510
+ );
1511
+ }
1512
+ }
1513
+ }
1514
+ var at, ch, escapee = {
1515
+ '"': '"',
1516
+ "\\": "\\",
1517
+ "/": "/",
1518
+ b: "\b",
1519
+ f: "\f",
1520
+ n: "\n",
1521
+ r: "\r",
1522
+ t: " "
1523
+ }, text, error = function(m) {
1524
+ throw {
1525
+ name: "SyntaxError",
1526
+ message: m,
1527
+ at,
1528
+ text
1529
+ };
1530
+ }, next = function(c) {
1531
+ if (c && c !== ch) {
1532
+ error("Expected '" + c + "' instead of '" + ch + "'");
1533
+ }
1534
+ ch = text.charAt(at);
1535
+ at += 1;
1536
+ return ch;
1537
+ }, number = function() {
1538
+ var number2, string2 = "";
1539
+ if (ch === "-") {
1540
+ string2 = "-";
1541
+ next("-");
1542
+ }
1543
+ while (ch >= "0" && ch <= "9") {
1544
+ string2 += ch;
1545
+ next();
1546
+ }
1547
+ if (ch === ".") {
1548
+ string2 += ".";
1549
+ while (next() && ch >= "0" && ch <= "9") {
1550
+ string2 += ch;
1551
+ }
1552
+ }
1553
+ if (ch === "e" || ch === "E") {
1554
+ string2 += ch;
1555
+ next();
1556
+ if (ch === "-" || ch === "+") {
1557
+ string2 += ch;
1558
+ next();
1559
+ }
1560
+ while (ch >= "0" && ch <= "9") {
1561
+ string2 += ch;
1562
+ next();
1563
+ }
1564
+ }
1565
+ number2 = +string2;
1566
+ if (!isFinite(number2)) {
1567
+ error("Bad number");
1568
+ } else {
1569
+ if (BigNumber == null) BigNumber = require_bignumber();
1570
+ if (string2.length > 15)
1571
+ return _options.storeAsString ? string2 : _options.useNativeBigInt ? BigInt(string2) : new BigNumber(string2);
1572
+ else
1573
+ return !_options.alwaysParseAsBig ? number2 : _options.useNativeBigInt ? BigInt(number2) : new BigNumber(number2);
1574
+ }
1575
+ }, string = function() {
1576
+ var hex, i, string2 = "", uffff;
1577
+ if (ch === '"') {
1578
+ var startAt = at;
1579
+ while (next()) {
1580
+ if (ch === '"') {
1581
+ if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
1582
+ next();
1583
+ return string2;
1584
+ }
1585
+ if (ch === "\\") {
1586
+ if (at - 1 > startAt) string2 += text.substring(startAt, at - 1);
1587
+ next();
1588
+ if (ch === "u") {
1589
+ uffff = 0;
1590
+ for (i = 0; i < 4; i += 1) {
1591
+ hex = parseInt(next(), 16);
1592
+ if (!isFinite(hex)) {
1593
+ break;
1594
+ }
1595
+ uffff = uffff * 16 + hex;
1596
+ }
1597
+ string2 += String.fromCharCode(uffff);
1598
+ } else if (typeof escapee[ch] === "string") {
1599
+ string2 += escapee[ch];
1600
+ } else {
1601
+ break;
1602
+ }
1603
+ startAt = at;
1604
+ }
1605
+ }
1606
+ }
1607
+ error("Bad string");
1608
+ }, white = function() {
1609
+ while (ch && ch <= " ") {
1610
+ next();
1611
+ }
1612
+ }, word = function() {
1613
+ switch (ch) {
1614
+ case "t":
1615
+ next("t");
1616
+ next("r");
1617
+ next("u");
1618
+ next("e");
1619
+ return true;
1620
+ case "f":
1621
+ next("f");
1622
+ next("a");
1623
+ next("l");
1624
+ next("s");
1625
+ next("e");
1626
+ return false;
1627
+ case "n":
1628
+ next("n");
1629
+ next("u");
1630
+ next("l");
1631
+ next("l");
1632
+ return null;
1633
+ }
1634
+ error("Unexpected '" + ch + "'");
1635
+ }, value, array = function() {
1636
+ var array2 = [];
1637
+ if (ch === "[") {
1638
+ next("[");
1639
+ white();
1640
+ if (ch === "]") {
1641
+ next("]");
1642
+ return array2;
1643
+ }
1644
+ while (ch) {
1645
+ array2.push(value());
1646
+ white();
1647
+ if (ch === "]") {
1648
+ next("]");
1649
+ return array2;
1650
+ }
1651
+ next(",");
1652
+ white();
1653
+ }
1654
+ }
1655
+ error("Bad array");
1656
+ }, object = function() {
1657
+ var key, object2 = /* @__PURE__ */ Object.create(null);
1658
+ if (ch === "{") {
1659
+ next("{");
1660
+ white();
1661
+ if (ch === "}") {
1662
+ next("}");
1663
+ return object2;
1664
+ }
1665
+ while (ch) {
1666
+ key = string();
1667
+ white();
1668
+ next(":");
1669
+ if (_options.strict === true && Object.hasOwnProperty.call(object2, key)) {
1670
+ error('Duplicate key "' + key + '"');
1671
+ }
1672
+ if (suspectProtoRx.test(key) === true) {
1673
+ if (_options.protoAction === "error") {
1674
+ error("Object contains forbidden prototype property");
1675
+ } else if (_options.protoAction === "ignore") {
1676
+ value();
1677
+ } else {
1678
+ object2[key] = value();
1679
+ }
1680
+ } else if (suspectConstructorRx.test(key) === true) {
1681
+ if (_options.constructorAction === "error") {
1682
+ error("Object contains forbidden constructor property");
1683
+ } else if (_options.constructorAction === "ignore") {
1684
+ value();
1685
+ } else {
1686
+ object2[key] = value();
1687
+ }
1688
+ } else {
1689
+ object2[key] = value();
1690
+ }
1691
+ white();
1692
+ if (ch === "}") {
1693
+ next("}");
1694
+ return object2;
1695
+ }
1696
+ next(",");
1697
+ white();
1698
+ }
1699
+ }
1700
+ error("Bad object");
1701
+ };
1702
+ value = function() {
1703
+ white();
1704
+ switch (ch) {
1705
+ case "{":
1706
+ return object();
1707
+ case "[":
1708
+ return array();
1709
+ case '"':
1710
+ return string();
1711
+ case "-":
1712
+ return number();
1713
+ default:
1714
+ return ch >= "0" && ch <= "9" ? number() : word();
1715
+ }
1716
+ };
1717
+ return function(source, reviver) {
1718
+ var result;
1719
+ text = source + "";
1720
+ at = 0;
1721
+ ch = " ";
1722
+ result = value();
1723
+ white();
1724
+ if (ch) {
1725
+ error("Syntax error");
1726
+ }
1727
+ return typeof reviver === "function" ? function walk(holder, key) {
1728
+ var k, v, value2 = holder[key];
1729
+ if (value2 && typeof value2 === "object") {
1730
+ Object.keys(value2).forEach(function(k2) {
1731
+ v = walk(value2, k2);
1732
+ if (v !== void 0) {
1733
+ value2[k2] = v;
1734
+ } else {
1735
+ delete value2[k2];
1736
+ }
1737
+ });
1738
+ }
1739
+ return reviver.call(holder, key, value2);
1740
+ }({ "": result }, "") : result;
1741
+ };
1742
+ };
1743
+ module.exports = json_parse;
1744
+ }
1745
+ });
1746
+
1747
+ // ../../node_modules/json-bigint/index.js
1748
+ var require_json_bigint = __commonJS({
1749
+ "../../node_modules/json-bigint/index.js"(exports, module) {
1750
+ var json_stringify = require_stringify().stringify;
1751
+ var json_parse = require_parse();
1752
+ module.exports = function(options) {
1753
+ return {
1754
+ parse: json_parse(options),
1755
+ stringify: json_stringify
1756
+ };
1757
+ };
1758
+ module.exports.parse = json_parse();
1759
+ module.exports.stringify = json_stringify;
1760
+ }
1761
+ });
1762
+
1763
+ export {
1764
+ require_json_bigint
1765
+ };