model-blueprint 0.1.3 → 0.1.5

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