@rozoai/checkout 0.1.1 → 0.1.3

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.
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __rozoCreateRequire } from 'node:module';
3
+ import { fileURLToPath as __rozoFileURLToPath } from 'node:url';
4
+ import { dirname as __rozoDirname } from 'node:path';
3
5
  const require = __rozoCreateRequire(import.meta.url);
6
+ const __filename = __rozoFileURLToPath(import.meta.url);
7
+ const __dirname = __rozoDirname(__filename);
4
8
  var __create = Object.create;
5
9
  var __defProp = Object.defineProperty;
6
10
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -41,6 +45,676 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
41
45
  ));
42
46
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
43
47
 
48
+ // node_modules/viem/_esm/utils/data/isHex.js
49
+ function isHex(value, { strict = true } = {}) {
50
+ if (!value)
51
+ return false;
52
+ if (typeof value !== "string")
53
+ return false;
54
+ return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
55
+ }
56
+ var init_isHex = __esm({
57
+ "node_modules/viem/_esm/utils/data/isHex.js"() {
58
+ }
59
+ });
60
+
61
+ // node_modules/viem/_esm/utils/data/size.js
62
+ function size(value) {
63
+ if (isHex(value, { strict: false }))
64
+ return Math.ceil((value.length - 2) / 2);
65
+ return value.length;
66
+ }
67
+ var init_size = __esm({
68
+ "node_modules/viem/_esm/utils/data/size.js"() {
69
+ init_isHex();
70
+ }
71
+ });
72
+
73
+ // node_modules/viem/_esm/errors/version.js
74
+ var version;
75
+ var init_version = __esm({
76
+ "node_modules/viem/_esm/errors/version.js"() {
77
+ version = "2.55.11";
78
+ }
79
+ });
80
+
81
+ // node_modules/viem/_esm/errors/base.js
82
+ function walk(err, fn) {
83
+ if (fn?.(err))
84
+ return err;
85
+ if (err && typeof err === "object" && "cause" in err && err.cause !== void 0)
86
+ return walk(err.cause, fn);
87
+ return fn ? null : err;
88
+ }
89
+ var errorConfig, BaseError;
90
+ var init_base = __esm({
91
+ "node_modules/viem/_esm/errors/base.js"() {
92
+ init_version();
93
+ errorConfig = {
94
+ getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
95
+ version: `viem@${version}`
96
+ };
97
+ BaseError = class _BaseError extends Error {
98
+ constructor(shortMessage, args = {}) {
99
+ const details = (() => {
100
+ if (args.cause instanceof _BaseError)
101
+ return args.cause.details;
102
+ if (args.cause?.message)
103
+ return args.cause.message;
104
+ return args.details;
105
+ })();
106
+ const docsPath = (() => {
107
+ if (args.cause instanceof _BaseError)
108
+ return args.cause.docsPath || args.docsPath;
109
+ return args.docsPath;
110
+ })();
111
+ const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
112
+ const message = [
113
+ shortMessage || "An error occurred.",
114
+ "",
115
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
116
+ ...docsUrl ? [`Docs: ${docsUrl}`] : [],
117
+ ...details ? [`Details: ${details}`] : [],
118
+ ...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
119
+ ].join("\n");
120
+ super(message, args.cause ? { cause: args.cause } : void 0);
121
+ Object.defineProperty(this, "details", {
122
+ enumerable: true,
123
+ configurable: true,
124
+ writable: true,
125
+ value: void 0
126
+ });
127
+ Object.defineProperty(this, "docsPath", {
128
+ enumerable: true,
129
+ configurable: true,
130
+ writable: true,
131
+ value: void 0
132
+ });
133
+ Object.defineProperty(this, "metaMessages", {
134
+ enumerable: true,
135
+ configurable: true,
136
+ writable: true,
137
+ value: void 0
138
+ });
139
+ Object.defineProperty(this, "shortMessage", {
140
+ enumerable: true,
141
+ configurable: true,
142
+ writable: true,
143
+ value: void 0
144
+ });
145
+ Object.defineProperty(this, "version", {
146
+ enumerable: true,
147
+ configurable: true,
148
+ writable: true,
149
+ value: void 0
150
+ });
151
+ Object.defineProperty(this, "name", {
152
+ enumerable: true,
153
+ configurable: true,
154
+ writable: true,
155
+ value: "BaseError"
156
+ });
157
+ this.details = details;
158
+ this.docsPath = docsPath;
159
+ this.metaMessages = args.metaMessages;
160
+ this.name = args.name ?? this.name;
161
+ this.shortMessage = shortMessage;
162
+ this.version = version;
163
+ }
164
+ walk(fn) {
165
+ return walk(this, fn);
166
+ }
167
+ };
168
+ }
169
+ });
170
+
171
+ // node_modules/viem/_esm/errors/data.js
172
+ var SizeExceedsPaddingSizeError;
173
+ var init_data = __esm({
174
+ "node_modules/viem/_esm/errors/data.js"() {
175
+ init_base();
176
+ SizeExceedsPaddingSizeError = class extends BaseError {
177
+ constructor({ size: size2, targetSize, type }) {
178
+ super(`${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`, { name: "SizeExceedsPaddingSizeError" });
179
+ }
180
+ };
181
+ }
182
+ });
183
+
184
+ // node_modules/viem/_esm/utils/data/pad.js
185
+ function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
186
+ if (typeof hexOrBytes === "string")
187
+ return padHex(hexOrBytes, { dir, size: size2 });
188
+ return padBytes(hexOrBytes, { dir, size: size2 });
189
+ }
190
+ function padHex(hex_, { dir, size: size2 = 32 } = {}) {
191
+ if (size2 === null)
192
+ return hex_;
193
+ const hex = hex_.replace("0x", "");
194
+ if (hex.length > size2 * 2)
195
+ throw new SizeExceedsPaddingSizeError({
196
+ size: Math.ceil(hex.length / 2),
197
+ targetSize: size2,
198
+ type: "hex"
199
+ });
200
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](size2 * 2, "0")}`;
201
+ }
202
+ function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
203
+ if (size2 === null)
204
+ return bytes;
205
+ if (bytes.length > size2)
206
+ throw new SizeExceedsPaddingSizeError({
207
+ size: bytes.length,
208
+ targetSize: size2,
209
+ type: "bytes"
210
+ });
211
+ const paddedBytes = new Uint8Array(size2);
212
+ for (let i = 0; i < size2; i++) {
213
+ const padEnd = dir === "right";
214
+ paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
215
+ }
216
+ return paddedBytes;
217
+ }
218
+ var init_pad = __esm({
219
+ "node_modules/viem/_esm/utils/data/pad.js"() {
220
+ init_data();
221
+ }
222
+ });
223
+
224
+ // node_modules/viem/_esm/errors/encoding.js
225
+ var IntegerOutOfRangeError, SizeOverflowError;
226
+ var init_encoding = __esm({
227
+ "node_modules/viem/_esm/errors/encoding.js"() {
228
+ init_base();
229
+ IntegerOutOfRangeError = class extends BaseError {
230
+ constructor({ max, min, signed, size: size2, value }) {
231
+ super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
232
+ }
233
+ };
234
+ SizeOverflowError = class extends BaseError {
235
+ constructor({ givenSize, maxSize }) {
236
+ super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
237
+ }
238
+ };
239
+ }
240
+ });
241
+
242
+ // node_modules/viem/_esm/utils/encoding/fromHex.js
243
+ function assertSize(hexOrBytes, { size: size2 }) {
244
+ if (size(hexOrBytes) > size2)
245
+ throw new SizeOverflowError({
246
+ givenSize: size(hexOrBytes),
247
+ maxSize: size2
248
+ });
249
+ }
250
+ var init_fromHex = __esm({
251
+ "node_modules/viem/_esm/utils/encoding/fromHex.js"() {
252
+ init_encoding();
253
+ init_size();
254
+ }
255
+ });
256
+
257
+ // node_modules/viem/_esm/utils/encoding/toHex.js
258
+ function toHex(value, opts = {}) {
259
+ if (typeof value === "number" || typeof value === "bigint")
260
+ return numberToHex(value, opts);
261
+ if (typeof value === "string") {
262
+ return stringToHex(value, opts);
263
+ }
264
+ if (typeof value === "boolean")
265
+ return boolToHex(value, opts);
266
+ return bytesToHex(value, opts);
267
+ }
268
+ function boolToHex(value, opts = {}) {
269
+ const hex = `0x${Number(value)}`;
270
+ if (typeof opts.size === "number") {
271
+ assertSize(hex, { size: opts.size });
272
+ return pad(hex, { size: opts.size });
273
+ }
274
+ return hex;
275
+ }
276
+ function bytesToHex(value, opts = {}) {
277
+ let string = "";
278
+ for (let i = 0; i < value.length; i++) {
279
+ string += hexes[value[i]];
280
+ }
281
+ const hex = `0x${string}`;
282
+ if (typeof opts.size === "number") {
283
+ assertSize(hex, { size: opts.size });
284
+ return pad(hex, { dir: "right", size: opts.size });
285
+ }
286
+ return hex;
287
+ }
288
+ function numberToHex(value_, opts = {}) {
289
+ const { signed, size: size2 } = opts;
290
+ const value = BigInt(value_);
291
+ let maxValue;
292
+ if (size2) {
293
+ if (signed)
294
+ maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
295
+ else
296
+ maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
297
+ } else if (typeof value_ === "number") {
298
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
299
+ }
300
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
301
+ if (maxValue && value > maxValue || value < minValue) {
302
+ const suffix = typeof value_ === "bigint" ? "n" : "";
303
+ throw new IntegerOutOfRangeError({
304
+ max: maxValue ? `${maxValue}${suffix}` : void 0,
305
+ min: `${minValue}${suffix}`,
306
+ signed,
307
+ size: size2,
308
+ value: `${value_}${suffix}`
309
+ });
310
+ }
311
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
312
+ if (size2)
313
+ return pad(hex, { size: size2 });
314
+ return hex;
315
+ }
316
+ function stringToHex(value_, opts = {}) {
317
+ const value = encoder.encode(value_);
318
+ return bytesToHex(value, opts);
319
+ }
320
+ var hexes, encoder;
321
+ var init_toHex = __esm({
322
+ "node_modules/viem/_esm/utils/encoding/toHex.js"() {
323
+ init_encoding();
324
+ init_pad();
325
+ init_fromHex();
326
+ hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0"));
327
+ encoder = /* @__PURE__ */ new TextEncoder();
328
+ }
329
+ });
330
+
331
+ // node_modules/viem/_esm/utils/encoding/toBytes.js
332
+ function toBytes(value, opts = {}) {
333
+ if (typeof value === "number" || typeof value === "bigint")
334
+ return numberToBytes(value, opts);
335
+ if (typeof value === "boolean")
336
+ return boolToBytes(value, opts);
337
+ if (isHex(value))
338
+ return hexToBytes(value, opts);
339
+ return stringToBytes(value, opts);
340
+ }
341
+ function boolToBytes(value, opts = {}) {
342
+ const bytes = new Uint8Array(1);
343
+ bytes[0] = Number(value);
344
+ if (typeof opts.size === "number") {
345
+ assertSize(bytes, { size: opts.size });
346
+ return pad(bytes, { size: opts.size });
347
+ }
348
+ return bytes;
349
+ }
350
+ function charCodeToBase16(char) {
351
+ if (char >= charCodeMap.zero && char <= charCodeMap.nine)
352
+ return char - charCodeMap.zero;
353
+ if (char >= charCodeMap.A && char <= charCodeMap.F)
354
+ return char - (charCodeMap.A - 10);
355
+ if (char >= charCodeMap.a && char <= charCodeMap.f)
356
+ return char - (charCodeMap.a - 10);
357
+ return void 0;
358
+ }
359
+ function hexToBytes(hex_, opts = {}) {
360
+ let hex = hex_;
361
+ if (opts.size) {
362
+ assertSize(hex, { size: opts.size });
363
+ hex = pad(hex, { dir: "right", size: opts.size });
364
+ }
365
+ let hexString = hex.slice(2);
366
+ if (hexString.length % 2)
367
+ hexString = `0${hexString}`;
368
+ const length = hexString.length / 2;
369
+ const bytes = new Uint8Array(length);
370
+ for (let index = 0, j = 0; index < length; index++) {
371
+ const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));
372
+ const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));
373
+ if (nibbleLeft === void 0 || nibbleRight === void 0) {
374
+ throw new BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`);
375
+ }
376
+ bytes[index] = nibbleLeft * 16 + nibbleRight;
377
+ }
378
+ return bytes;
379
+ }
380
+ function numberToBytes(value, opts) {
381
+ const hex = numberToHex(value, opts);
382
+ return hexToBytes(hex);
383
+ }
384
+ function stringToBytes(value, opts = {}) {
385
+ const bytes = encoder2.encode(value);
386
+ if (typeof opts.size === "number") {
387
+ assertSize(bytes, { size: opts.size });
388
+ return pad(bytes, { dir: "right", size: opts.size });
389
+ }
390
+ return bytes;
391
+ }
392
+ var encoder2, charCodeMap;
393
+ var init_toBytes = __esm({
394
+ "node_modules/viem/_esm/utils/encoding/toBytes.js"() {
395
+ init_base();
396
+ init_isHex();
397
+ init_pad();
398
+ init_fromHex();
399
+ init_toHex();
400
+ encoder2 = /* @__PURE__ */ new TextEncoder();
401
+ charCodeMap = {
402
+ zero: 48,
403
+ nine: 57,
404
+ A: 65,
405
+ F: 70,
406
+ a: 97,
407
+ f: 102
408
+ };
409
+ }
410
+ });
411
+
412
+ // node_modules/@noble/hashes/esm/_u64.js
413
+ function fromBig(n, le = false) {
414
+ if (le)
415
+ return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
416
+ return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
417
+ }
418
+ function split(lst, le = false) {
419
+ const len = lst.length;
420
+ let Ah = new Uint32Array(len);
421
+ let Al = new Uint32Array(len);
422
+ for (let i = 0; i < len; i++) {
423
+ const { h, l } = fromBig(lst[i], le);
424
+ [Ah[i], Al[i]] = [h, l];
425
+ }
426
+ return [Ah, Al];
427
+ }
428
+ var U32_MASK64, _32n, rotlSH, rotlSL, rotlBH, rotlBL;
429
+ var init_u64 = __esm({
430
+ "node_modules/@noble/hashes/esm/_u64.js"() {
431
+ U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
432
+ _32n = /* @__PURE__ */ BigInt(32);
433
+ rotlSH = (h, l, s) => h << s | l >>> 32 - s;
434
+ rotlSL = (h, l, s) => l << s | h >>> 32 - s;
435
+ rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
436
+ rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
437
+ }
438
+ });
439
+
440
+ // node_modules/@noble/hashes/esm/utils.js
441
+ function isBytes(a) {
442
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
443
+ }
444
+ function anumber(n) {
445
+ if (!Number.isSafeInteger(n) || n < 0)
446
+ throw new Error("positive integer expected, got " + n);
447
+ }
448
+ function abytes(b, ...lengths) {
449
+ if (!isBytes(b))
450
+ throw new Error("Uint8Array expected");
451
+ if (lengths.length > 0 && !lengths.includes(b.length))
452
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
453
+ }
454
+ function aexists(instance, checkFinished = true) {
455
+ if (instance.destroyed)
456
+ throw new Error("Hash instance has been destroyed");
457
+ if (checkFinished && instance.finished)
458
+ throw new Error("Hash#digest() has already been called");
459
+ }
460
+ function aoutput(out, instance) {
461
+ abytes(out);
462
+ const min = instance.outputLen;
463
+ if (out.length < min) {
464
+ throw new Error("digestInto() expects output buffer of length at least " + min);
465
+ }
466
+ }
467
+ function u32(arr) {
468
+ return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
469
+ }
470
+ function clean(...arrays) {
471
+ for (let i = 0; i < arrays.length; i++) {
472
+ arrays[i].fill(0);
473
+ }
474
+ }
475
+ function byteSwap(word) {
476
+ return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
477
+ }
478
+ function byteSwap32(arr) {
479
+ for (let i = 0; i < arr.length; i++) {
480
+ arr[i] = byteSwap(arr[i]);
481
+ }
482
+ return arr;
483
+ }
484
+ function utf8ToBytes(str) {
485
+ if (typeof str !== "string")
486
+ throw new Error("string expected");
487
+ return new Uint8Array(new TextEncoder().encode(str));
488
+ }
489
+ function toBytes2(data) {
490
+ if (typeof data === "string")
491
+ data = utf8ToBytes(data);
492
+ abytes(data);
493
+ return data;
494
+ }
495
+ function createHasher(hashCons) {
496
+ const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
497
+ const tmp = hashCons();
498
+ hashC.outputLen = tmp.outputLen;
499
+ hashC.blockLen = tmp.blockLen;
500
+ hashC.create = () => hashCons();
501
+ return hashC;
502
+ }
503
+ var isLE, swap32IfBE, Hash;
504
+ var init_utils = __esm({
505
+ "node_modules/@noble/hashes/esm/utils.js"() {
506
+ isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
507
+ swap32IfBE = isLE ? (u) => u : byteSwap32;
508
+ Hash = class {
509
+ };
510
+ }
511
+ });
512
+
513
+ // node_modules/@noble/hashes/esm/sha3.js
514
+ function keccakP(s, rounds = 24) {
515
+ const B = new Uint32Array(5 * 2);
516
+ for (let round = 24 - rounds; round < 24; round++) {
517
+ for (let x = 0; x < 10; x++)
518
+ B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
519
+ for (let x = 0; x < 10; x += 2) {
520
+ const idx1 = (x + 8) % 10;
521
+ const idx0 = (x + 2) % 10;
522
+ const B0 = B[idx0];
523
+ const B1 = B[idx0 + 1];
524
+ const Th = rotlH(B0, B1, 1) ^ B[idx1];
525
+ const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
526
+ for (let y = 0; y < 50; y += 10) {
527
+ s[x + y] ^= Th;
528
+ s[x + y + 1] ^= Tl;
529
+ }
530
+ }
531
+ let curH = s[2];
532
+ let curL = s[3];
533
+ for (let t = 0; t < 24; t++) {
534
+ const shift = SHA3_ROTL[t];
535
+ const Th = rotlH(curH, curL, shift);
536
+ const Tl = rotlL(curH, curL, shift);
537
+ const PI = SHA3_PI[t];
538
+ curH = s[PI];
539
+ curL = s[PI + 1];
540
+ s[PI] = Th;
541
+ s[PI + 1] = Tl;
542
+ }
543
+ for (let y = 0; y < 50; y += 10) {
544
+ for (let x = 0; x < 10; x++)
545
+ B[x] = s[y + x];
546
+ for (let x = 0; x < 10; x++)
547
+ s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
548
+ }
549
+ s[0] ^= SHA3_IOTA_H[round];
550
+ s[1] ^= SHA3_IOTA_L[round];
551
+ }
552
+ clean(B);
553
+ }
554
+ var _0n, _1n, _2n, _7n, _256n, _0x71n, SHA3_PI, SHA3_ROTL, _SHA3_IOTA, IOTAS, SHA3_IOTA_H, SHA3_IOTA_L, rotlH, rotlL, Keccak, gen, keccak_256;
555
+ var init_sha3 = __esm({
556
+ "node_modules/@noble/hashes/esm/sha3.js"() {
557
+ init_u64();
558
+ init_utils();
559
+ _0n = BigInt(0);
560
+ _1n = BigInt(1);
561
+ _2n = BigInt(2);
562
+ _7n = BigInt(7);
563
+ _256n = BigInt(256);
564
+ _0x71n = BigInt(113);
565
+ SHA3_PI = [];
566
+ SHA3_ROTL = [];
567
+ _SHA3_IOTA = [];
568
+ for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
569
+ [x, y] = [y, (2 * x + 3 * y) % 5];
570
+ SHA3_PI.push(2 * (5 * y + x));
571
+ SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
572
+ let t = _0n;
573
+ for (let j = 0; j < 7; j++) {
574
+ R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
575
+ if (R & _2n)
576
+ t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
577
+ }
578
+ _SHA3_IOTA.push(t);
579
+ }
580
+ IOTAS = split(_SHA3_IOTA, true);
581
+ SHA3_IOTA_H = IOTAS[0];
582
+ SHA3_IOTA_L = IOTAS[1];
583
+ rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
584
+ rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
585
+ Keccak = class _Keccak extends Hash {
586
+ // NOTE: we accept arguments in bytes instead of bits here.
587
+ constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
588
+ super();
589
+ this.pos = 0;
590
+ this.posOut = 0;
591
+ this.finished = false;
592
+ this.destroyed = false;
593
+ this.enableXOF = false;
594
+ this.blockLen = blockLen;
595
+ this.suffix = suffix;
596
+ this.outputLen = outputLen;
597
+ this.enableXOF = enableXOF;
598
+ this.rounds = rounds;
599
+ anumber(outputLen);
600
+ if (!(0 < blockLen && blockLen < 200))
601
+ throw new Error("only keccak-f1600 function is supported");
602
+ this.state = new Uint8Array(200);
603
+ this.state32 = u32(this.state);
604
+ }
605
+ clone() {
606
+ return this._cloneInto();
607
+ }
608
+ keccak() {
609
+ swap32IfBE(this.state32);
610
+ keccakP(this.state32, this.rounds);
611
+ swap32IfBE(this.state32);
612
+ this.posOut = 0;
613
+ this.pos = 0;
614
+ }
615
+ update(data) {
616
+ aexists(this);
617
+ data = toBytes2(data);
618
+ abytes(data);
619
+ const { blockLen, state } = this;
620
+ const len = data.length;
621
+ for (let pos = 0; pos < len; ) {
622
+ const take = Math.min(blockLen - this.pos, len - pos);
623
+ for (let i = 0; i < take; i++)
624
+ state[this.pos++] ^= data[pos++];
625
+ if (this.pos === blockLen)
626
+ this.keccak();
627
+ }
628
+ return this;
629
+ }
630
+ finish() {
631
+ if (this.finished)
632
+ return;
633
+ this.finished = true;
634
+ const { state, suffix, pos, blockLen } = this;
635
+ state[pos] ^= suffix;
636
+ if ((suffix & 128) !== 0 && pos === blockLen - 1)
637
+ this.keccak();
638
+ state[blockLen - 1] ^= 128;
639
+ this.keccak();
640
+ }
641
+ writeInto(out) {
642
+ aexists(this, false);
643
+ abytes(out);
644
+ this.finish();
645
+ const bufferOut = this.state;
646
+ const { blockLen } = this;
647
+ for (let pos = 0, len = out.length; pos < len; ) {
648
+ if (this.posOut >= blockLen)
649
+ this.keccak();
650
+ const take = Math.min(blockLen - this.posOut, len - pos);
651
+ out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
652
+ this.posOut += take;
653
+ pos += take;
654
+ }
655
+ return out;
656
+ }
657
+ xofInto(out) {
658
+ if (!this.enableXOF)
659
+ throw new Error("XOF is not possible for this instance");
660
+ return this.writeInto(out);
661
+ }
662
+ xof(bytes) {
663
+ anumber(bytes);
664
+ return this.xofInto(new Uint8Array(bytes));
665
+ }
666
+ digestInto(out) {
667
+ aoutput(out, this);
668
+ if (this.finished)
669
+ throw new Error("digest() was already called");
670
+ this.writeInto(out);
671
+ this.destroy();
672
+ return out;
673
+ }
674
+ digest() {
675
+ return this.digestInto(new Uint8Array(this.outputLen));
676
+ }
677
+ destroy() {
678
+ this.destroyed = true;
679
+ clean(this.state);
680
+ }
681
+ _cloneInto(to) {
682
+ const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
683
+ to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
684
+ to.state32.set(this.state32);
685
+ to.pos = this.pos;
686
+ to.posOut = this.posOut;
687
+ to.finished = this.finished;
688
+ to.rounds = rounds;
689
+ to.suffix = suffix;
690
+ to.outputLen = outputLen;
691
+ to.enableXOF = enableXOF;
692
+ to.destroyed = this.destroyed;
693
+ return to;
694
+ }
695
+ };
696
+ gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));
697
+ keccak_256 = /* @__PURE__ */ (() => gen(1, 136, 256 / 8))();
698
+ }
699
+ });
700
+
701
+ // node_modules/viem/_esm/utils/hash/keccak256.js
702
+ function keccak256(value, to_) {
703
+ const to = to_ || "hex";
704
+ const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);
705
+ if (to === "bytes")
706
+ return bytes;
707
+ return toHex(bytes);
708
+ }
709
+ var init_keccak256 = __esm({
710
+ "node_modules/viem/_esm/utils/hash/keccak256.js"() {
711
+ init_sha3();
712
+ init_isHex();
713
+ init_toBytes();
714
+ init_toHex();
715
+ }
716
+ });
717
+
44
718
  // node_modules/@noble/hashes/cryptoNode.js
45
719
  var require_cryptoNode = __commonJS({
46
720
  "node_modules/@noble/hashes/cryptoNode.js"(exports) {
@@ -58,43 +732,43 @@ var require_utils = __commonJS({
58
732
  "use strict";
59
733
  Object.defineProperty(exports, "__esModule", { value: true });
60
734
  exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
61
- exports.isBytes = isBytes;
62
- exports.anumber = anumber;
63
- exports.abytes = abytes;
735
+ exports.isBytes = isBytes2;
736
+ exports.anumber = anumber2;
737
+ exports.abytes = abytes2;
64
738
  exports.ahash = ahash;
65
- exports.aexists = aexists;
66
- exports.aoutput = aoutput;
739
+ exports.aexists = aexists2;
740
+ exports.aoutput = aoutput2;
67
741
  exports.u8 = u86;
68
- exports.u32 = u323;
69
- exports.clean = clean;
742
+ exports.u32 = u324;
743
+ exports.clean = clean2;
70
744
  exports.createView = createView;
71
745
  exports.rotr = rotr;
72
746
  exports.rotl = rotl;
73
- exports.byteSwap = byteSwap;
74
- exports.byteSwap32 = byteSwap32;
75
- exports.bytesToHex = bytesToHex;
76
- exports.hexToBytes = hexToBytes;
747
+ exports.byteSwap = byteSwap2;
748
+ exports.byteSwap32 = byteSwap322;
749
+ exports.bytesToHex = bytesToHex2;
750
+ exports.hexToBytes = hexToBytes2;
77
751
  exports.asyncLoop = asyncLoop;
78
- exports.utf8ToBytes = utf8ToBytes;
752
+ exports.utf8ToBytes = utf8ToBytes2;
79
753
  exports.bytesToUtf8 = bytesToUtf8;
80
- exports.toBytes = toBytes;
754
+ exports.toBytes = toBytes3;
81
755
  exports.kdfInputToBytes = kdfInputToBytes;
82
756
  exports.concatBytes = concatBytes;
83
757
  exports.checkOpts = checkOpts;
84
- exports.createHasher = createHasher;
758
+ exports.createHasher = createHasher2;
85
759
  exports.createOptHasher = createOptHasher;
86
- exports.createXOFer = createXOFer;
760
+ exports.createXOFer = createXOFer2;
87
761
  exports.randomBytes = randomBytes;
88
762
  var crypto_1 = require_cryptoNode();
89
- function isBytes(a) {
763
+ function isBytes2(a) {
90
764
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
91
765
  }
92
- function anumber(n) {
766
+ function anumber2(n) {
93
767
  if (!Number.isSafeInteger(n) || n < 0)
94
768
  throw new Error("positive integer expected, got " + n);
95
769
  }
96
- function abytes(b, ...lengths) {
97
- if (!isBytes(b))
770
+ function abytes2(b, ...lengths) {
771
+ if (!isBytes2(b))
98
772
  throw new Error("Uint8Array expected");
99
773
  if (lengths.length > 0 && !lengths.includes(b.length))
100
774
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
@@ -102,17 +776,17 @@ var require_utils = __commonJS({
102
776
  function ahash(h) {
103
777
  if (typeof h !== "function" || typeof h.create !== "function")
104
778
  throw new Error("Hash should be wrapped by utils.createHasher");
105
- anumber(h.outputLen);
106
- anumber(h.blockLen);
779
+ anumber2(h.outputLen);
780
+ anumber2(h.blockLen);
107
781
  }
108
- function aexists(instance, checkFinished = true) {
782
+ function aexists2(instance, checkFinished = true) {
109
783
  if (instance.destroyed)
110
784
  throw new Error("Hash instance has been destroyed");
111
785
  if (checkFinished && instance.finished)
112
786
  throw new Error("Hash#digest() has already been called");
113
787
  }
114
- function aoutput(out, instance) {
115
- abytes(out);
788
+ function aoutput2(out, instance) {
789
+ abytes2(out);
116
790
  const min = instance.outputLen;
117
791
  if (out.length < min) {
118
792
  throw new Error("digestInto() expects output buffer of length at least " + min);
@@ -121,10 +795,10 @@ var require_utils = __commonJS({
121
795
  function u86(arr) {
122
796
  return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
123
797
  }
124
- function u323(arr) {
798
+ function u324(arr) {
125
799
  return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
126
800
  }
127
- function clean(...arrays) {
801
+ function clean2(...arrays) {
128
802
  for (let i = 0; i < arrays.length; i++) {
129
803
  arrays[i].fill(0);
130
804
  }
@@ -139,30 +813,30 @@ var require_utils = __commonJS({
139
813
  return word << shift | word >>> 32 - shift >>> 0;
140
814
  }
141
815
  exports.isLE = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
142
- function byteSwap(word) {
816
+ function byteSwap2(word) {
143
817
  return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
144
818
  }
145
- exports.swap8IfBE = exports.isLE ? (n) => n : (n) => byteSwap(n);
819
+ exports.swap8IfBE = exports.isLE ? (n) => n : (n) => byteSwap2(n);
146
820
  exports.byteSwapIfBE = exports.swap8IfBE;
147
- function byteSwap32(arr) {
821
+ function byteSwap322(arr) {
148
822
  for (let i = 0; i < arr.length; i++) {
149
- arr[i] = byteSwap(arr[i]);
823
+ arr[i] = byteSwap2(arr[i]);
150
824
  }
151
825
  return arr;
152
826
  }
153
- exports.swap32IfBE = exports.isLE ? (u) => u : byteSwap32;
827
+ exports.swap32IfBE = exports.isLE ? (u) => u : byteSwap322;
154
828
  var hasHexBuiltin = /* @__PURE__ */ (() => (
155
829
  // @ts-ignore
156
830
  typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
157
831
  ))();
158
- var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
159
- function bytesToHex(bytes) {
160
- abytes(bytes);
832
+ var hexes2 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
833
+ function bytesToHex2(bytes) {
834
+ abytes2(bytes);
161
835
  if (hasHexBuiltin)
162
836
  return bytes.toHex();
163
837
  let hex = "";
164
838
  for (let i = 0; i < bytes.length; i++) {
165
- hex += hexes[bytes[i]];
839
+ hex += hexes2[bytes[i]];
166
840
  }
167
841
  return hex;
168
842
  }
@@ -176,7 +850,7 @@ var require_utils = __commonJS({
176
850
  return ch - (asciis.a - 10);
177
851
  return;
178
852
  }
179
- function hexToBytes(hex) {
853
+ function hexToBytes2(hex) {
180
854
  if (typeof hex !== "string")
181
855
  throw new Error("hex string expected, got " + typeof hex);
182
856
  if (hasHexBuiltin)
@@ -211,7 +885,7 @@ var require_utils = __commonJS({
211
885
  ts += diff;
212
886
  }
213
887
  }
214
- function utf8ToBytes(str) {
888
+ function utf8ToBytes2(str) {
215
889
  if (typeof str !== "string")
216
890
  throw new Error("string expected");
217
891
  return new Uint8Array(new TextEncoder().encode(str));
@@ -219,30 +893,30 @@ var require_utils = __commonJS({
219
893
  function bytesToUtf8(bytes) {
220
894
  return new TextDecoder().decode(bytes);
221
895
  }
222
- function toBytes(data) {
896
+ function toBytes3(data) {
223
897
  if (typeof data === "string")
224
- data = utf8ToBytes(data);
225
- abytes(data);
898
+ data = utf8ToBytes2(data);
899
+ abytes2(data);
226
900
  return data;
227
901
  }
228
902
  function kdfInputToBytes(data) {
229
903
  if (typeof data === "string")
230
- data = utf8ToBytes(data);
231
- abytes(data);
904
+ data = utf8ToBytes2(data);
905
+ abytes2(data);
232
906
  return data;
233
907
  }
234
908
  function concatBytes(...arrays) {
235
909
  let sum = 0;
236
910
  for (let i = 0; i < arrays.length; i++) {
237
911
  const a = arrays[i];
238
- abytes(a);
912
+ abytes2(a);
239
913
  sum += a.length;
240
914
  }
241
915
  const res = new Uint8Array(sum);
242
- for (let i = 0, pad = 0; i < arrays.length; i++) {
916
+ for (let i = 0, pad2 = 0; i < arrays.length; i++) {
243
917
  const a = arrays[i];
244
- res.set(a, pad);
245
- pad += a.length;
918
+ res.set(a, pad2);
919
+ pad2 += a.length;
246
920
  }
247
921
  return res;
248
922
  }
@@ -252,11 +926,11 @@ var require_utils = __commonJS({
252
926
  const merged = Object.assign(defaults, opts);
253
927
  return merged;
254
928
  }
255
- var Hash = class {
929
+ var Hash2 = class {
256
930
  };
257
- exports.Hash = Hash;
258
- function createHasher(hashCons) {
259
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
931
+ exports.Hash = Hash2;
932
+ function createHasher2(hashCons) {
933
+ const hashC = (msg) => hashCons().update(toBytes3(msg)).digest();
260
934
  const tmp = hashCons();
261
935
  hashC.outputLen = tmp.outputLen;
262
936
  hashC.blockLen = tmp.blockLen;
@@ -264,24 +938,24 @@ var require_utils = __commonJS({
264
938
  return hashC;
265
939
  }
266
940
  function createOptHasher(hashCons) {
267
- const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
941
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes3(msg)).digest();
268
942
  const tmp = hashCons({});
269
943
  hashC.outputLen = tmp.outputLen;
270
944
  hashC.blockLen = tmp.blockLen;
271
945
  hashC.create = (opts) => hashCons(opts);
272
946
  return hashC;
273
947
  }
274
- function createXOFer(hashCons) {
275
- const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
948
+ function createXOFer2(hashCons) {
949
+ const hashC = (msg, opts) => hashCons(opts).update(toBytes3(msg)).digest();
276
950
  const tmp = hashCons({});
277
951
  hashC.outputLen = tmp.outputLen;
278
952
  hashC.blockLen = tmp.blockLen;
279
953
  hashC.create = (opts) => hashCons(opts);
280
954
  return hashC;
281
955
  }
282
- exports.wrapConstructor = createHasher;
956
+ exports.wrapConstructor = createHasher2;
283
957
  exports.wrapConstructorWithOpts = createOptHasher;
284
- exports.wrapXOFConstructorWithOpts = createXOFer;
958
+ exports.wrapXOFConstructorWithOpts = createXOFer2;
285
959
  function randomBytes(bytesLength = 32) {
286
960
  if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
287
961
  return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
@@ -304,17 +978,17 @@ var require_md = __commonJS({
304
978
  exports.Chi = Chi;
305
979
  exports.Maj = Maj;
306
980
  var utils_ts_1 = require_utils();
307
- function setBigUint64(view, byteOffset, value, isLE) {
981
+ function setBigUint64(view, byteOffset, value, isLE2) {
308
982
  if (typeof view.setBigUint64 === "function")
309
- return view.setBigUint64(byteOffset, value, isLE);
310
- const _32n = BigInt(32);
983
+ return view.setBigUint64(byteOffset, value, isLE2);
984
+ const _32n2 = BigInt(32);
311
985
  const _u32_max = BigInt(4294967295);
312
- const wh = Number(value >> _32n & _u32_max);
986
+ const wh = Number(value >> _32n2 & _u32_max);
313
987
  const wl = Number(value & _u32_max);
314
- const h = isLE ? 4 : 0;
315
- const l = isLE ? 0 : 4;
316
- view.setUint32(byteOffset + h, wh, isLE);
317
- view.setUint32(byteOffset + l, wl, isLE);
988
+ const h = isLE2 ? 4 : 0;
989
+ const l = isLE2 ? 0 : 4;
990
+ view.setUint32(byteOffset + h, wh, isLE2);
991
+ view.setUint32(byteOffset + l, wl, isLE2);
318
992
  }
319
993
  function Chi(a, b, c) {
320
994
  return a & b ^ ~a & c;
@@ -323,7 +997,7 @@ var require_md = __commonJS({
323
997
  return a & b ^ a & c ^ b & c;
324
998
  }
325
999
  var HashMD = class extends utils_ts_1.Hash {
326
- constructor(blockLen, outputLen, padOffset, isLE) {
1000
+ constructor(blockLen, outputLen, padOffset, isLE2) {
327
1001
  super();
328
1002
  this.finished = false;
329
1003
  this.length = 0;
@@ -332,7 +1006,7 @@ var require_md = __commonJS({
332
1006
  this.blockLen = blockLen;
333
1007
  this.outputLen = outputLen;
334
1008
  this.padOffset = padOffset;
335
- this.isLE = isLE;
1009
+ this.isLE = isLE2;
336
1010
  this.buffer = new Uint8Array(blockLen);
337
1011
  this.view = (0, utils_ts_1.createView)(this.buffer);
338
1012
  }
@@ -366,7 +1040,7 @@ var require_md = __commonJS({
366
1040
  (0, utils_ts_1.aexists)(this);
367
1041
  (0, utils_ts_1.aoutput)(out, this);
368
1042
  this.finished = true;
369
- const { buffer, view, blockLen, isLE } = this;
1043
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
370
1044
  let { pos } = this;
371
1045
  buffer[pos++] = 128;
372
1046
  (0, utils_ts_1.clean)(this.buffer.subarray(pos));
@@ -376,7 +1050,7 @@ var require_md = __commonJS({
376
1050
  }
377
1051
  for (let i = pos; i < blockLen; i++)
378
1052
  buffer[i] = 0;
379
- setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);
1053
+ setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2);
380
1054
  this.process(view, 0);
381
1055
  const oview = (0, utils_ts_1.createView)(out);
382
1056
  const len = this.outputLen;
@@ -387,7 +1061,7 @@ var require_md = __commonJS({
387
1061
  if (outLen > state.length)
388
1062
  throw new Error("_sha2: outputLen bigger than state");
389
1063
  for (let i = 0; i < outLen; i++)
390
- oview.setUint32(4 * i, state[i], isLE);
1064
+ oview.setUint32(4 * i, state[i], isLE2);
391
1065
  }
392
1066
  digest() {
393
1067
  const { buffer, outputLen } = this;
@@ -479,26 +1153,26 @@ var require_u64 = __commonJS({
479
1153
  Object.defineProperty(exports, "__esModule", { value: true });
480
1154
  exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
481
1155
  exports.add = add;
482
- exports.fromBig = fromBig;
483
- exports.split = split;
484
- var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
485
- var _32n = /* @__PURE__ */ BigInt(32);
486
- function fromBig(n, le = false) {
1156
+ exports.fromBig = fromBig2;
1157
+ exports.split = split2;
1158
+ var U32_MASK642 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
1159
+ var _32n2 = /* @__PURE__ */ BigInt(32);
1160
+ function fromBig2(n, le = false) {
487
1161
  if (le)
488
- return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
489
- return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
1162
+ return { h: Number(n & U32_MASK642), l: Number(n >> _32n2 & U32_MASK642) };
1163
+ return { h: Number(n >> _32n2 & U32_MASK642) | 0, l: Number(n & U32_MASK642) | 0 };
490
1164
  }
491
- function split(lst, le = false) {
1165
+ function split2(lst, le = false) {
492
1166
  const len = lst.length;
493
1167
  let Ah = new Uint32Array(len);
494
1168
  let Al = new Uint32Array(len);
495
1169
  for (let i = 0; i < len; i++) {
496
- const { h, l } = fromBig(lst[i], le);
1170
+ const { h, l } = fromBig2(lst[i], le);
497
1171
  [Ah[i], Al[i]] = [h, l];
498
1172
  }
499
1173
  return [Ah, Al];
500
1174
  }
501
- var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
1175
+ var toBig = (h, l) => BigInt(h >>> 0) << _32n2 | BigInt(l >>> 0);
502
1176
  exports.toBig = toBig;
503
1177
  var shrSH = (h, _l, s) => h >>> s;
504
1178
  exports.shrSH = shrSH;
@@ -516,14 +1190,14 @@ var require_u64 = __commonJS({
516
1190
  exports.rotr32H = rotr32H;
517
1191
  var rotr32L = (h, _l) => h;
518
1192
  exports.rotr32L = rotr32L;
519
- var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
520
- exports.rotlSH = rotlSH;
521
- var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
522
- exports.rotlSL = rotlSL;
523
- var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
524
- exports.rotlBH = rotlBH;
525
- var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
526
- exports.rotlBL = rotlBL;
1193
+ var rotlSH2 = (h, l, s) => h << s | l >>> 32 - s;
1194
+ exports.rotlSH = rotlSH2;
1195
+ var rotlSL2 = (h, l, s) => l << s | h >>> 32 - s;
1196
+ exports.rotlSL = rotlSL2;
1197
+ var rotlBH2 = (h, l, s) => l << s - 32 | h >>> 64 - s;
1198
+ exports.rotlBH = rotlBH2;
1199
+ var rotlBL2 = (h, l, s) => h << s - 32 | l >>> 64 - s;
1200
+ exports.rotlBL = rotlBL2;
527
1201
  function add(Ah, Al, Bh, Bl) {
528
1202
  const l = (Al >>> 0) + (Bl >>> 0);
529
1203
  return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
@@ -541,8 +1215,8 @@ var require_u64 = __commonJS({
541
1215
  var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
542
1216
  exports.add5H = add5H;
543
1217
  var u642 = {
544
- fromBig,
545
- split,
1218
+ fromBig: fromBig2,
1219
+ split: split2,
546
1220
  toBig,
547
1221
  shrSH,
548
1222
  shrSL,
@@ -552,10 +1226,10 @@ var require_u64 = __commonJS({
552
1226
  rotrBL,
553
1227
  rotr32H,
554
1228
  rotr32L,
555
- rotlSH,
556
- rotlSL,
557
- rotlBH,
558
- rotlBL,
1229
+ rotlSH: rotlSH2,
1230
+ rotlSL: rotlSL2,
1231
+ rotlBH: rotlBH2,
1232
+ rotlBL: rotlBL2,
559
1233
  add,
560
1234
  add3L,
561
1235
  add3H,
@@ -1097,8 +1771,8 @@ var require_utils2 = __commonJS({
1097
1771
  Object.defineProperty(exports, "utf8ToBytes", { enumerable: true, get: function() {
1098
1772
  return utils_js_2.utf8ToBytes;
1099
1773
  } });
1100
- var _0n = /* @__PURE__ */ BigInt(0);
1101
- var _1n = /* @__PURE__ */ BigInt(1);
1774
+ var _0n2 = /* @__PURE__ */ BigInt(0);
1775
+ var _1n2 = /* @__PURE__ */ BigInt(1);
1102
1776
  function abool(title, value) {
1103
1777
  if (typeof value !== "boolean")
1104
1778
  throw new Error(title + " boolean expected, got " + value);
@@ -1129,7 +1803,7 @@ var require_utils2 = __commonJS({
1129
1803
  function hexToNumber(hex) {
1130
1804
  if (typeof hex !== "string")
1131
1805
  throw new Error("hex string expected, got " + typeof hex);
1132
- return hex === "" ? _0n : BigInt("0x" + hex);
1806
+ return hex === "" ? _0n2 : BigInt("0x" + hex);
1133
1807
  }
1134
1808
  function bytesToNumberBE(bytes) {
1135
1809
  return hexToNumber((0, utils_js_1.bytesToHex)(bytes));
@@ -1185,7 +1859,7 @@ var require_utils2 = __commonJS({
1185
1859
  return charCode;
1186
1860
  });
1187
1861
  }
1188
- var isPosBig = (n) => typeof n === "bigint" && _0n <= n;
1862
+ var isPosBig = (n) => typeof n === "bigint" && _0n2 <= n;
1189
1863
  function inRange(n, min, max) {
1190
1864
  return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
1191
1865
  }
@@ -1195,17 +1869,17 @@ var require_utils2 = __commonJS({
1195
1869
  }
1196
1870
  function bitLen(n) {
1197
1871
  let len;
1198
- for (len = 0; n > _0n; n >>= _1n, len += 1)
1872
+ for (len = 0; n > _0n2; n >>= _1n2, len += 1)
1199
1873
  ;
1200
1874
  return len;
1201
1875
  }
1202
1876
  function bitGet(n, pos) {
1203
- return n >> BigInt(pos) & _1n;
1877
+ return n >> BigInt(pos) & _1n2;
1204
1878
  }
1205
1879
  function bitSet(n, pos, value) {
1206
- return n | (value ? _1n : _0n) << BigInt(pos);
1880
+ return n | (value ? _1n2 : _0n2) << BigInt(pos);
1207
1881
  }
1208
- var bitMask = (n) => (_1n << BigInt(n)) - _1n;
1882
+ var bitMask = (n) => (_1n2 << BigInt(n)) - _1n2;
1209
1883
  exports.bitMask = bitMask;
1210
1884
  function createHmacDrbg(hashLen, qByteLen, hmacFn) {
1211
1885
  if (typeof hashLen !== "number" || hashLen < 2)
@@ -1233,7 +1907,7 @@ var require_utils2 = __commonJS({
1233
1907
  k = h(u8of(1), seed);
1234
1908
  v = h();
1235
1909
  };
1236
- const gen = () => {
1910
+ const gen2 = () => {
1237
1911
  if (i++ >= 1e3)
1238
1912
  throw new Error("drbg: tried 1000 values");
1239
1913
  let len = 0;
@@ -1250,7 +1924,7 @@ var require_utils2 = __commonJS({
1250
1924
  reset();
1251
1925
  reseed(seed);
1252
1926
  let res = void 0;
1253
- while (!(res = pred(gen())))
1927
+ while (!(res = pred(gen2())))
1254
1928
  reseed();
1255
1929
  reset();
1256
1930
  return res;
@@ -1348,40 +2022,40 @@ var require_modular = __commonJS({
1348
2022
  exports.getMinHashLength = getMinHashLength;
1349
2023
  exports.mapHashToField = mapHashToField;
1350
2024
  var utils_ts_1 = require_utils2();
1351
- var _0n = BigInt(0);
1352
- var _1n = BigInt(1);
1353
- var _2n = /* @__PURE__ */ BigInt(2);
2025
+ var _0n2 = BigInt(0);
2026
+ var _1n2 = BigInt(1);
2027
+ var _2n2 = /* @__PURE__ */ BigInt(2);
1354
2028
  var _3n = /* @__PURE__ */ BigInt(3);
1355
2029
  var _4n = /* @__PURE__ */ BigInt(4);
1356
2030
  var _5n = /* @__PURE__ */ BigInt(5);
1357
- var _7n = /* @__PURE__ */ BigInt(7);
2031
+ var _7n2 = /* @__PURE__ */ BigInt(7);
1358
2032
  var _8n = /* @__PURE__ */ BigInt(8);
1359
2033
  var _9n = /* @__PURE__ */ BigInt(9);
1360
2034
  var _16n = /* @__PURE__ */ BigInt(16);
1361
2035
  function mod(a, b) {
1362
2036
  const result = a % b;
1363
- return result >= _0n ? result : b + result;
2037
+ return result >= _0n2 ? result : b + result;
1364
2038
  }
1365
2039
  function pow(num, power, modulo) {
1366
2040
  return FpPow(Field(modulo), num, power);
1367
2041
  }
1368
2042
  function pow2(x, power, modulo) {
1369
2043
  let res = x;
1370
- while (power-- > _0n) {
2044
+ while (power-- > _0n2) {
1371
2045
  res *= res;
1372
2046
  res %= modulo;
1373
2047
  }
1374
2048
  return res;
1375
2049
  }
1376
2050
  function invert(number, modulo) {
1377
- if (number === _0n)
2051
+ if (number === _0n2)
1378
2052
  throw new Error("invert: expected non-zero number");
1379
- if (modulo <= _0n)
2053
+ if (modulo <= _0n2)
1380
2054
  throw new Error("invert: expected positive modulus, got " + modulo);
1381
2055
  let a = mod(number, modulo);
1382
2056
  let b = modulo;
1383
- let x = _0n, y = _1n, u = _1n, v = _0n;
1384
- while (a !== _0n) {
2057
+ let x = _0n2, y = _1n2, u = _1n2, v = _0n2;
2058
+ while (a !== _0n2) {
1385
2059
  const q = b / a;
1386
2060
  const r = b % a;
1387
2061
  const m = x - u * q;
@@ -1389,7 +2063,7 @@ var require_modular = __commonJS({
1389
2063
  b = a, a = r, x = u, y = v, u = m, v = n;
1390
2064
  }
1391
2065
  const gcd = b;
1392
- if (gcd !== _1n)
2066
+ if (gcd !== _1n2)
1393
2067
  throw new Error("invert: does not exist");
1394
2068
  return mod(x, modulo);
1395
2069
  }
@@ -1398,17 +2072,17 @@ var require_modular = __commonJS({
1398
2072
  throw new Error("Cannot find square root");
1399
2073
  }
1400
2074
  function sqrt3mod4(Fp, n) {
1401
- const p1div4 = (Fp.ORDER + _1n) / _4n;
2075
+ const p1div4 = (Fp.ORDER + _1n2) / _4n;
1402
2076
  const root = Fp.pow(n, p1div4);
1403
2077
  assertIsSquare(Fp, root, n);
1404
2078
  return root;
1405
2079
  }
1406
2080
  function sqrt5mod8(Fp, n) {
1407
2081
  const p5div8 = (Fp.ORDER - _5n) / _8n;
1408
- const n2 = Fp.mul(n, _2n);
2082
+ const n2 = Fp.mul(n, _2n2);
1409
2083
  const v = Fp.pow(n2, p5div8);
1410
2084
  const nv = Fp.mul(n, v);
1411
- const i = Fp.mul(Fp.mul(nv, _2n), v);
2085
+ const i = Fp.mul(Fp.mul(nv, _2n2), v);
1412
2086
  const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
1413
2087
  assertIsSquare(Fp, root, n);
1414
2088
  return root;
@@ -1419,7 +2093,7 @@ var require_modular = __commonJS({
1419
2093
  const c1 = tn(Fp_, Fp_.neg(Fp_.ONE));
1420
2094
  const c2 = tn(Fp_, c1);
1421
2095
  const c3 = tn(Fp_, Fp_.neg(c1));
1422
- const c4 = (P + _7n) / _16n;
2096
+ const c4 = (P + _7n2) / _16n;
1423
2097
  return (Fp, n) => {
1424
2098
  let tv1 = Fp.pow(n, c4);
1425
2099
  let tv2 = Fp.mul(tv1, c1);
@@ -1438,13 +2112,13 @@ var require_modular = __commonJS({
1438
2112
  function tonelliShanks(P) {
1439
2113
  if (P < _3n)
1440
2114
  throw new Error("sqrt is not defined for small field");
1441
- let Q = P - _1n;
2115
+ let Q = P - _1n2;
1442
2116
  let S = 0;
1443
- while (Q % _2n === _0n) {
1444
- Q /= _2n;
2117
+ while (Q % _2n2 === _0n2) {
2118
+ Q /= _2n2;
1445
2119
  S++;
1446
2120
  }
1447
- let Z = _2n;
2121
+ let Z = _2n2;
1448
2122
  const _Fp = Field(P);
1449
2123
  while (FpLegendre(_Fp, Z) === 1) {
1450
2124
  if (Z++ > 1e3)
@@ -1453,7 +2127,7 @@ var require_modular = __commonJS({
1453
2127
  if (S === 1)
1454
2128
  return sqrt3mod4;
1455
2129
  let cc = _Fp.pow(Z, Q);
1456
- const Q1div2 = (Q + _1n) / _2n;
2130
+ const Q1div2 = (Q + _1n2) / _2n2;
1457
2131
  return function tonelliSlow(Fp, n) {
1458
2132
  if (Fp.is0(n))
1459
2133
  return n;
@@ -1474,7 +2148,7 @@ var require_modular = __commonJS({
1474
2148
  if (i === M)
1475
2149
  throw new Error("Cannot find square root");
1476
2150
  }
1477
- const exponent = _1n << BigInt(M - i - 1);
2151
+ const exponent = _1n2 << BigInt(M - i - 1);
1478
2152
  const b = Fp.pow(c, exponent);
1479
2153
  M = i;
1480
2154
  c = Fp.sqr(b);
@@ -1493,7 +2167,7 @@ var require_modular = __commonJS({
1493
2167
  return sqrt9mod16(P);
1494
2168
  return tonelliShanks(P);
1495
2169
  }
1496
- var isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;
2170
+ var isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n2) === _1n2;
1497
2171
  exports.isNegativeLE = isNegativeLE;
1498
2172
  var FIELD_FIELDS = [
1499
2173
  "create",
@@ -1529,19 +2203,19 @@ var require_modular = __commonJS({
1529
2203
  return field;
1530
2204
  }
1531
2205
  function FpPow(Fp, num, power) {
1532
- if (power < _0n)
2206
+ if (power < _0n2)
1533
2207
  throw new Error("invalid exponent, negatives unsupported");
1534
- if (power === _0n)
2208
+ if (power === _0n2)
1535
2209
  return Fp.ONE;
1536
- if (power === _1n)
2210
+ if (power === _1n2)
1537
2211
  return num;
1538
2212
  let p = Fp.ONE;
1539
2213
  let d = num;
1540
- while (power > _0n) {
1541
- if (power & _1n)
2214
+ while (power > _0n2) {
2215
+ if (power & _1n2)
1542
2216
  p = Fp.mul(p, d);
1543
2217
  d = Fp.sqr(d);
1544
- power >>= _1n;
2218
+ power >>= _1n2;
1545
2219
  }
1546
2220
  return p;
1547
2221
  }
@@ -1566,7 +2240,7 @@ var require_modular = __commonJS({
1566
2240
  return Fp.mul(lhs, typeof rhs === "bigint" ? invert(rhs, Fp.ORDER) : Fp.inv(rhs));
1567
2241
  }
1568
2242
  function FpLegendre(Fp, n) {
1569
- const p1mod2 = (Fp.ORDER - _1n) / _2n;
2243
+ const p1mod2 = (Fp.ORDER - _1n2) / _2n2;
1570
2244
  const powered = Fp.pow(n, p1mod2);
1571
2245
  const yes = Fp.eql(powered, Fp.ONE);
1572
2246
  const zero = Fp.eql(powered, Fp.ZERO);
@@ -1586,15 +2260,15 @@ var require_modular = __commonJS({
1586
2260
  const nByteLength = Math.ceil(_nBitLength / 8);
1587
2261
  return { nBitLength: _nBitLength, nByteLength };
1588
2262
  }
1589
- function Field(ORDER, bitLenOrOpts, isLE = false, opts = {}) {
1590
- if (ORDER <= _0n)
2263
+ function Field(ORDER, bitLenOrOpts, isLE2 = false, opts = {}) {
2264
+ if (ORDER <= _0n2)
1591
2265
  throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
1592
2266
  let _nbitLength = void 0;
1593
2267
  let _sqrt = void 0;
1594
2268
  let modFromBytes = false;
1595
2269
  let allowedLengths = void 0;
1596
2270
  if (typeof bitLenOrOpts === "object" && bitLenOrOpts != null) {
1597
- if (opts.sqrt || isLE)
2271
+ if (opts.sqrt || isLE2)
1598
2272
  throw new Error("cannot specify opts in two arguments");
1599
2273
  const _opts = bitLenOrOpts;
1600
2274
  if (_opts.BITS)
@@ -1602,7 +2276,7 @@ var require_modular = __commonJS({
1602
2276
  if (_opts.sqrt)
1603
2277
  _sqrt = _opts.sqrt;
1604
2278
  if (typeof _opts.isLE === "boolean")
1605
- isLE = _opts.isLE;
2279
+ isLE2 = _opts.isLE;
1606
2280
  if (typeof _opts.modFromBytes === "boolean")
1607
2281
  modFromBytes = _opts.modFromBytes;
1608
2282
  allowedLengths = _opts.allowedLengths;
@@ -1618,23 +2292,23 @@ var require_modular = __commonJS({
1618
2292
  let sqrtP;
1619
2293
  const f = Object.freeze({
1620
2294
  ORDER,
1621
- isLE,
2295
+ isLE: isLE2,
1622
2296
  BITS,
1623
2297
  BYTES,
1624
2298
  MASK: (0, utils_ts_1.bitMask)(BITS),
1625
- ZERO: _0n,
1626
- ONE: _1n,
2299
+ ZERO: _0n2,
2300
+ ONE: _1n2,
1627
2301
  allowedLengths,
1628
2302
  create: (num) => mod(num, ORDER),
1629
2303
  isValid: (num) => {
1630
2304
  if (typeof num !== "bigint")
1631
2305
  throw new Error("invalid field element: expected bigint, got " + typeof num);
1632
- return _0n <= num && num < ORDER;
2306
+ return _0n2 <= num && num < ORDER;
1633
2307
  },
1634
- is0: (num) => num === _0n,
2308
+ is0: (num) => num === _0n2,
1635
2309
  // is valid and invertible
1636
2310
  isValidNot0: (num) => !f.is0(num) && f.isValid(num),
1637
- isOdd: (num) => (num & _1n) === _1n,
2311
+ isOdd: (num) => (num & _1n2) === _1n2,
1638
2312
  neg: (num) => mod(-num, ORDER),
1639
2313
  eql: (lhs, rhs) => lhs === rhs,
1640
2314
  sqr: (num) => mod(num * num, ORDER),
@@ -1654,19 +2328,19 @@ var require_modular = __commonJS({
1654
2328
  sqrtP = FpSqrt(ORDER);
1655
2329
  return sqrtP(f, n);
1656
2330
  }),
1657
- toBytes: (num) => isLE ? (0, utils_ts_1.numberToBytesLE)(num, BYTES) : (0, utils_ts_1.numberToBytesBE)(num, BYTES),
2331
+ toBytes: (num) => isLE2 ? (0, utils_ts_1.numberToBytesLE)(num, BYTES) : (0, utils_ts_1.numberToBytesBE)(num, BYTES),
1658
2332
  fromBytes: (bytes, skipValidation = true) => {
1659
2333
  if (allowedLengths) {
1660
2334
  if (!allowedLengths.includes(bytes.length) || bytes.length > BYTES) {
1661
2335
  throw new Error("Field.fromBytes: expected " + allowedLengths + " bytes, got " + bytes.length);
1662
2336
  }
1663
2337
  const padded = new Uint8Array(BYTES);
1664
- padded.set(bytes, isLE ? 0 : padded.length - bytes.length);
2338
+ padded.set(bytes, isLE2 ? 0 : padded.length - bytes.length);
1665
2339
  bytes = padded;
1666
2340
  }
1667
2341
  if (bytes.length !== BYTES)
1668
2342
  throw new Error("Field.fromBytes: expected " + BYTES + " bytes, got " + bytes.length);
1669
- let scalar = isLE ? (0, utils_ts_1.bytesToNumberLE)(bytes) : (0, utils_ts_1.bytesToNumberBE)(bytes);
2343
+ let scalar = isLE2 ? (0, utils_ts_1.bytesToNumberLE)(bytes) : (0, utils_ts_1.bytesToNumberBE)(bytes);
1670
2344
  if (modFromBytes)
1671
2345
  scalar = mod(scalar, ORDER);
1672
2346
  if (!skipValidation) {
@@ -1695,14 +2369,14 @@ var require_modular = __commonJS({
1695
2369
  const root = Fp.sqrt(elm);
1696
2370
  return Fp.isOdd(root) ? Fp.neg(root) : root;
1697
2371
  }
1698
- function hashToPrivateScalar(hash, groupOrder, isLE = false) {
2372
+ function hashToPrivateScalar(hash, groupOrder, isLE2 = false) {
1699
2373
  hash = (0, utils_ts_1.ensureBytes)("privateHash", hash);
1700
2374
  const hashLen = hash.length;
1701
2375
  const minLen = nLength(groupOrder).nByteLength + 8;
1702
2376
  if (minLen < 24 || hashLen < minLen || hashLen > 1024)
1703
2377
  throw new Error("hashToPrivateScalar: expected " + minLen + "-1024 bytes of input, got " + hashLen);
1704
- const num = isLE ? (0, utils_ts_1.bytesToNumberLE)(hash) : (0, utils_ts_1.bytesToNumberBE)(hash);
1705
- return mod(num, groupOrder - _1n) + _1n;
2378
+ const num = isLE2 ? (0, utils_ts_1.bytesToNumberLE)(hash) : (0, utils_ts_1.bytesToNumberBE)(hash);
2379
+ return mod(num, groupOrder - _1n2) + _1n2;
1706
2380
  }
1707
2381
  function getFieldBytesLength(fieldOrder) {
1708
2382
  if (typeof fieldOrder !== "bigint")
@@ -1714,15 +2388,15 @@ var require_modular = __commonJS({
1714
2388
  const length = getFieldBytesLength(fieldOrder);
1715
2389
  return length + Math.ceil(length / 2);
1716
2390
  }
1717
- function mapHashToField(key, fieldOrder, isLE = false) {
2391
+ function mapHashToField(key, fieldOrder, isLE2 = false) {
1718
2392
  const len = key.length;
1719
2393
  const fieldLen = getFieldBytesLength(fieldOrder);
1720
2394
  const minLen = getMinHashLength(fieldOrder);
1721
2395
  if (len < 16 || len < minLen || len > 1024)
1722
2396
  throw new Error("expected " + minLen + "-1024 bytes of input, got " + len);
1723
- const num = isLE ? (0, utils_ts_1.bytesToNumberLE)(key) : (0, utils_ts_1.bytesToNumberBE)(key);
1724
- const reduced = mod(num, fieldOrder - _1n) + _1n;
1725
- return isLE ? (0, utils_ts_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_ts_1.numberToBytesBE)(reduced, fieldLen);
2397
+ const num = isLE2 ? (0, utils_ts_1.bytesToNumberLE)(key) : (0, utils_ts_1.bytesToNumberBE)(key);
2398
+ const reduced = mod(num, fieldOrder - _1n2) + _1n2;
2399
+ return isLE2 ? (0, utils_ts_1.numberToBytesLE)(reduced, fieldLen) : (0, utils_ts_1.numberToBytesBE)(reduced, fieldLen);
1726
2400
  }
1727
2401
  }
1728
2402
  });
@@ -1742,8 +2416,8 @@ var require_curve = __commonJS({
1742
2416
  exports._createCurveFields = _createCurveFields;
1743
2417
  var utils_ts_1 = require_utils2();
1744
2418
  var modular_ts_1 = require_modular();
1745
- var _0n = BigInt(0);
1746
- var _1n = BigInt(1);
2419
+ var _0n2 = BigInt(0);
2420
+ var _1n2 = BigInt(1);
1747
2421
  function negateCt(condition, item) {
1748
2422
  const neg = item.negate();
1749
2423
  return condition ? neg : item;
@@ -1771,7 +2445,7 @@ var require_curve = __commonJS({
1771
2445
  let nextN = n >> shiftBy;
1772
2446
  if (wbits > windowSize) {
1773
2447
  wbits -= maxNumber;
1774
- nextN += _1n;
2448
+ nextN += _1n2;
1775
2449
  }
1776
2450
  const offsetStart = window2 * windowSize;
1777
2451
  const offset = offsetStart + Math.abs(wbits) - 1;
@@ -1803,7 +2477,7 @@ var require_curve = __commonJS({
1803
2477
  return pointWindowSizes.get(P) || 1;
1804
2478
  }
1805
2479
  function assert0(n) {
1806
- if (n !== _0n)
2480
+ if (n !== _0n2)
1807
2481
  throw new Error("invalid wNAF");
1808
2482
  }
1809
2483
  var wNAF = class {
@@ -1817,11 +2491,11 @@ var require_curve = __commonJS({
1817
2491
  // non-const time multiplication ladder
1818
2492
  _unsafeLadder(elm, n, p = this.ZERO) {
1819
2493
  let d = elm;
1820
- while (n > _0n) {
1821
- if (n & _1n)
2494
+ while (n > _0n2) {
2495
+ if (n & _1n2)
1822
2496
  p = p.add(d);
1823
2497
  d = d.double();
1824
- n >>= _1n;
2498
+ n >>= _1n2;
1825
2499
  }
1826
2500
  return p;
1827
2501
  }
@@ -1885,7 +2559,7 @@ var require_curve = __commonJS({
1885
2559
  wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {
1886
2560
  const wo = calcWOpts(W, this.bits);
1887
2561
  for (let window2 = 0; window2 < wo.windows; window2++) {
1888
- if (n === _0n)
2562
+ if (n === _0n2)
1889
2563
  break;
1890
2564
  const { nextN, offset, isZero, isNeg } = calcOffsets(n, window2, wo);
1891
2565
  n = nextN;
@@ -1938,14 +2612,14 @@ var require_curve = __commonJS({
1938
2612
  let acc = point;
1939
2613
  let p1 = Point.ZERO;
1940
2614
  let p2 = Point.ZERO;
1941
- while (k1 > _0n || k2 > _0n) {
1942
- if (k1 & _1n)
2615
+ while (k1 > _0n2 || k2 > _0n2) {
2616
+ if (k1 & _1n2)
1943
2617
  p1 = p1.add(acc);
1944
- if (k2 & _1n)
2618
+ if (k2 & _1n2)
1945
2619
  p2 = p2.add(acc);
1946
2620
  acc = acc.double();
1947
- k1 >>= _1n;
1948
- k2 >>= _1n;
2621
+ k1 >>= _1n2;
2622
+ k2 >>= _1n2;
1949
2623
  }
1950
2624
  return { p1, p2 };
1951
2625
  }
@@ -2041,14 +2715,14 @@ var require_curve = __commonJS({
2041
2715
  ...{ p: curve.Fp.ORDER }
2042
2716
  });
2043
2717
  }
2044
- function createField(order, field, isLE) {
2718
+ function createField(order, field, isLE2) {
2045
2719
  if (field) {
2046
2720
  if (field.ORDER !== order)
2047
2721
  throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
2048
2722
  (0, modular_ts_1.validateField)(field);
2049
2723
  return field;
2050
2724
  } else {
2051
- return (0, modular_ts_1.Field)(order, { isLE });
2725
+ return (0, modular_ts_1.Field)(order, { isLE: isLE2 });
2052
2726
  }
2053
2727
  }
2054
2728
  function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {
@@ -2058,7 +2732,7 @@ var require_curve = __commonJS({
2058
2732
  throw new Error(`expected valid ${type} CURVE object`);
2059
2733
  for (const p of ["p", "n", "h"]) {
2060
2734
  const val = CURVE[p];
2061
- if (!(typeof val === "bigint" && val > _0n))
2735
+ if (!(typeof val === "bigint" && val > _0n2))
2062
2736
  throw new Error(`CURVE.${p} must be positive bigint`);
2063
2737
  }
2064
2738
  const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);
@@ -2087,9 +2761,9 @@ var require_edwards = __commonJS({
2087
2761
  var utils_ts_1 = require_utils2();
2088
2762
  var curve_ts_1 = require_curve();
2089
2763
  var modular_ts_1 = require_modular();
2090
- var _0n = BigInt(0);
2091
- var _1n = BigInt(1);
2092
- var _2n = BigInt(2);
2764
+ var _0n2 = BigInt(0);
2765
+ var _1n2 = BigInt(1);
2766
+ var _2n2 = BigInt(2);
2093
2767
  var _8n = BigInt(8);
2094
2768
  function isEdValidXY(Fp, CURVE, x, y) {
2095
2769
  const x2 = Fp.sqr(x);
@@ -2104,19 +2778,19 @@ var require_edwards = __commonJS({
2104
2778
  let CURVE = validated.CURVE;
2105
2779
  const { h: cofactor } = CURVE;
2106
2780
  (0, utils_ts_1._validateObject)(extraOpts, {}, { uvRatio: "function" });
2107
- const MASK = _2n << BigInt(Fn.BYTES * 8) - _1n;
2781
+ const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n2;
2108
2782
  const modP = (n) => Fp.create(n);
2109
2783
  const uvRatio = extraOpts.uvRatio || ((u, v) => {
2110
2784
  try {
2111
2785
  return { isValid: true, value: Fp.sqrt(Fp.div(u, v)) };
2112
2786
  } catch (e) {
2113
- return { isValid: false, value: _0n };
2787
+ return { isValid: false, value: _0n2 };
2114
2788
  }
2115
2789
  });
2116
2790
  if (!isEdValidXY(Fp, CURVE, CURVE.Gx, CURVE.Gy))
2117
2791
  throw new Error("bad curve params: generator point");
2118
2792
  function acoord(title, n, banZero = false) {
2119
- const min = banZero ? _1n : _0n;
2793
+ const min = banZero ? _1n2 : _0n2;
2120
2794
  (0, utils_ts_1.aInRange)("coordinate " + title, n, min, MASK);
2121
2795
  return n;
2122
2796
  }
@@ -2133,8 +2807,8 @@ var require_edwards = __commonJS({
2133
2807
  const y = modP(Y * iz);
2134
2808
  const zz = Fp.mul(Z, iz);
2135
2809
  if (is0)
2136
- return { x: _0n, y: _1n };
2137
- if (zz !== _1n)
2810
+ return { x: _0n2, y: _1n2 };
2811
+ if (zz !== _1n2)
2138
2812
  throw new Error("invZ was invalid");
2139
2813
  return { x, y };
2140
2814
  });
@@ -2175,7 +2849,7 @@ var require_edwards = __commonJS({
2175
2849
  const { x, y } = p || {};
2176
2850
  acoord("x", x);
2177
2851
  acoord("y", y);
2178
- return new Point(x, y, _1n, modP(x * y));
2852
+ return new Point(x, y, _1n2, modP(x * y));
2179
2853
  }
2180
2854
  // Uses algo from RFC8032 5.1.3.
2181
2855
  static fromBytes(bytes, zip215 = false) {
@@ -2188,16 +2862,16 @@ var require_edwards = __commonJS({
2188
2862
  normed[len - 1] = lastByte & ~128;
2189
2863
  const y = (0, utils_ts_1.bytesToNumberLE)(normed);
2190
2864
  const max = zip215 ? MASK : Fp.ORDER;
2191
- (0, utils_ts_1.aInRange)("point.y", y, _0n, max);
2865
+ (0, utils_ts_1.aInRange)("point.y", y, _0n2, max);
2192
2866
  const y2 = modP(y * y);
2193
- const u = modP(y2 - _1n);
2867
+ const u = modP(y2 - _1n2);
2194
2868
  const v = modP(d * y2 - a);
2195
2869
  let { isValid, value: x } = uvRatio(u, v);
2196
2870
  if (!isValid)
2197
2871
  throw new Error("bad point: invalid y coordinate");
2198
- const isXOdd = (x & _1n) === _1n;
2872
+ const isXOdd = (x & _1n2) === _1n2;
2199
2873
  const isLastByteOdd = (lastByte & 128) !== 0;
2200
- if (!zip215 && x === _0n && isLastByteOdd)
2874
+ if (!zip215 && x === _0n2 && isLastByteOdd)
2201
2875
  throw new Error("bad point: x=0 and x_0=1");
2202
2876
  if (isLastByteOdd !== isXOdd)
2203
2877
  x = modP(-x);
@@ -2215,7 +2889,7 @@ var require_edwards = __commonJS({
2215
2889
  precompute(windowSize = 8, isLazy = true) {
2216
2890
  wnaf.createCache(this, windowSize);
2217
2891
  if (!isLazy)
2218
- this.multiply(_2n);
2892
+ this.multiply(_2n2);
2219
2893
  return this;
2220
2894
  }
2221
2895
  // Useful in fromAffine() - not for fromBytes(), which always created valid points.
@@ -2247,7 +2921,7 @@ var require_edwards = __commonJS({
2247
2921
  const { X: X1, Y: Y1, Z: Z1 } = this;
2248
2922
  const A = modP(X1 * X1);
2249
2923
  const B = modP(Y1 * Y1);
2250
- const C = modP(_2n * modP(Z1 * Z1));
2924
+ const C = modP(_2n2 * modP(Z1 * Z1));
2251
2925
  const D = modP(a * A);
2252
2926
  const x1y1 = X1 + Y1;
2253
2927
  const E = modP(modP(x1y1 * x1y1) - A - B);
@@ -2300,9 +2974,9 @@ var require_edwards = __commonJS({
2300
2974
  multiplyUnsafe(scalar, acc = Point.ZERO) {
2301
2975
  if (!Fn.isValid(scalar))
2302
2976
  throw new Error("invalid scalar: expected 0 <= sc < curve.n");
2303
- if (scalar === _0n)
2977
+ if (scalar === _0n2)
2304
2978
  return Point.ZERO;
2305
- if (this.is0() || scalar === _1n)
2979
+ if (this.is0() || scalar === _1n2)
2306
2980
  return this;
2307
2981
  return wnaf.unsafe(this, scalar, (p) => (0, curve_ts_1.normalizeZ)(Point, p), acc);
2308
2982
  }
@@ -2324,14 +2998,14 @@ var require_edwards = __commonJS({
2324
2998
  return toAffineMemo(this, invertedZ);
2325
2999
  }
2326
3000
  clearCofactor() {
2327
- if (cofactor === _1n)
3001
+ if (cofactor === _1n2)
2328
3002
  return this;
2329
3003
  return this.multiplyUnsafe(cofactor);
2330
3004
  }
2331
3005
  toBytes() {
2332
3006
  const { x, y } = this.toAffine();
2333
3007
  const bytes = Fp.toBytes(y);
2334
- bytes[bytes.length - 1] |= x & _1n ? 128 : 0;
3008
+ bytes[bytes.length - 1] |= x & _1n2 ? 128 : 0;
2335
3009
  return bytes;
2336
3010
  }
2337
3011
  toHex() {
@@ -2366,8 +3040,8 @@ var require_edwards = __commonJS({
2366
3040
  return this.toBytes();
2367
3041
  }
2368
3042
  }
2369
- Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy));
2370
- Point.ZERO = new Point(_0n, _1n, _1n, _0n);
3043
+ Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n2, modP(CURVE.Gx * CURVE.Gy));
3044
+ Point.ZERO = new Point(_0n2, _1n2, _1n2, _0n2);
2371
3045
  Point.Fp = Fp;
2372
3046
  Point.Fn = Fn;
2373
3047
  const wnaf = new curve_ts_1.wNAF(Point, Fn.BITS);
@@ -2569,18 +3243,18 @@ var require_edwards = __commonJS({
2569
3243
  */
2570
3244
  toMontgomery(publicKey2) {
2571
3245
  const { y } = Point.fromBytes(publicKey2);
2572
- const size = lengths.publicKey;
2573
- const is25519 = size === 32;
2574
- if (!is25519 && size !== 57)
3246
+ const size2 = lengths.publicKey;
3247
+ const is25519 = size2 === 32;
3248
+ if (!is25519 && size2 !== 57)
2575
3249
  throw new Error("only defined for 25519 and 448");
2576
- const u = is25519 ? Fp.div(_1n + y, _1n - y) : Fp.div(y - _1n, y + _1n);
3250
+ const u = is25519 ? Fp.div(_1n2 + y, _1n2 - y) : Fp.div(y - _1n2, y + _1n2);
2577
3251
  return Fp.toBytes(u);
2578
3252
  },
2579
3253
  toMontgomerySecret(secretKey) {
2580
- const size = lengths.secretKey;
2581
- (0, utils_ts_1._abytes2)(secretKey, size);
2582
- const hashed = cHash(secretKey.subarray(0, size));
2583
- return adjustScalarBytes(hashed).subarray(0, size);
3254
+ const size2 = lengths.secretKey;
3255
+ (0, utils_ts_1._abytes2)(secretKey, size2);
3256
+ const hashed = cHash(secretKey.subarray(0, size2));
3257
+ return adjustScalarBytes(hashed).subarray(0, size2);
2584
3258
  },
2585
3259
  /** @deprecated */
2586
3260
  randomPrivateKey: randomSecretKey,
@@ -2650,7 +3324,7 @@ var require_hash_to_curve = __commonJS({
2650
3324
  exports.expand_message_xof = expand_message_xof;
2651
3325
  exports.hash_to_field = hash_to_field;
2652
3326
  exports.isogenyMap = isogenyMap;
2653
- exports.createHasher = createHasher;
3327
+ exports.createHasher = createHasher2;
2654
3328
  var utils_ts_1 = require_utils2();
2655
3329
  var modular_ts_1 = require_modular();
2656
3330
  var os2ip = utils_ts_1.bytesToNumberBE;
@@ -2765,7 +3439,7 @@ var require_hash_to_curve = __commonJS({
2765
3439
  };
2766
3440
  }
2767
3441
  exports._DST_scalar = (0, utils_ts_1.utf8ToBytes)("HashToScalar-");
2768
- function createHasher(Point, mapToCurve, defaults) {
3442
+ function createHasher2(Point, mapToCurve, defaults) {
2769
3443
  if (typeof mapToCurve !== "function")
2770
3444
  throw new Error("mapToCurve() must be defined");
2771
3445
  function map(num) {
@@ -2823,9 +3497,9 @@ var require_montgomery = __commonJS({
2823
3497
  exports.montgomery = montgomery;
2824
3498
  var utils_ts_1 = require_utils2();
2825
3499
  var modular_ts_1 = require_modular();
2826
- var _0n = BigInt(0);
2827
- var _1n = BigInt(1);
2828
- var _2n = BigInt(2);
3500
+ var _0n2 = BigInt(0);
3501
+ var _1n2 = BigInt(1);
3502
+ var _2n2 = BigInt(2);
2829
3503
  function validateOpts(curve) {
2830
3504
  (0, utils_ts_1._validateObject)(curve, {
2831
3505
  adjustScalarBytes: "function",
@@ -2844,9 +3518,9 @@ var require_montgomery = __commonJS({
2844
3518
  const fieldLen = is25519 ? 32 : 56;
2845
3519
  const Gu = is25519 ? BigInt(9) : BigInt(5);
2846
3520
  const a24 = is25519 ? BigInt(121665) : BigInt(39081);
2847
- const minScalar = is25519 ? _2n ** BigInt(254) : _2n ** BigInt(447);
2848
- const maxAdded = is25519 ? BigInt(8) * _2n ** BigInt(251) - _1n : BigInt(4) * _2n ** BigInt(445) - _1n;
2849
- const maxScalar = minScalar + maxAdded + _1n;
3521
+ const minScalar = is25519 ? _2n2 ** BigInt(254) : _2n2 ** BigInt(447);
3522
+ const maxAdded = is25519 ? BigInt(8) * _2n2 ** BigInt(251) - _1n2 : BigInt(4) * _2n2 ** BigInt(445) - _1n2;
3523
+ const maxScalar = minScalar + maxAdded + _1n2;
2850
3524
  const modP = (n) => (0, modular_ts_1.mod)(n, P);
2851
3525
  const GuBytes = encodeU(Gu);
2852
3526
  function encodeU(u) {
@@ -2863,7 +3537,7 @@ var require_montgomery = __commonJS({
2863
3537
  }
2864
3538
  function scalarMult(scalar, u) {
2865
3539
  const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar));
2866
- if (pu === _0n)
3540
+ if (pu === _0n2)
2867
3541
  throw new Error("invalid private or public key received");
2868
3542
  return encodeU(pu);
2869
3543
  }
@@ -2877,17 +3551,17 @@ var require_montgomery = __commonJS({
2877
3551
  return { x_2, x_3 };
2878
3552
  }
2879
3553
  function montgomeryLadder(u, scalar) {
2880
- (0, utils_ts_1.aInRange)("u", u, _0n, P);
3554
+ (0, utils_ts_1.aInRange)("u", u, _0n2, P);
2881
3555
  (0, utils_ts_1.aInRange)("scalar", scalar, minScalar, maxScalar);
2882
3556
  const k = scalar;
2883
3557
  const x_1 = u;
2884
- let x_2 = _1n;
2885
- let z_2 = _0n;
3558
+ let x_2 = _1n2;
3559
+ let z_2 = _0n2;
2886
3560
  let x_3 = u;
2887
- let z_3 = _1n;
2888
- let swap = _0n;
2889
- for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) {
2890
- const k_t = k >> t & _1n;
3561
+ let z_3 = _1n2;
3562
+ let swap = _0n2;
3563
+ for (let t = BigInt(montgomeryBits - 1); t >= _0n2; t--) {
3564
+ const k_t = k >> t & _1n2;
2891
3565
  swap ^= k_t;
2892
3566
  ({ x_2, x_3 } = cswap(swap, x_2, x_3));
2893
3567
  ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));
@@ -2960,9 +3634,9 @@ var require_ed25519 = __commonJS({
2960
3634
  var modular_ts_1 = require_modular();
2961
3635
  var montgomery_ts_1 = require_montgomery();
2962
3636
  var utils_ts_1 = require_utils2();
2963
- var _0n = /* @__PURE__ */ BigInt(0);
2964
- var _1n = BigInt(1);
2965
- var _2n = BigInt(2);
3637
+ var _0n2 = /* @__PURE__ */ BigInt(0);
3638
+ var _1n2 = BigInt(1);
3639
+ var _2n2 = BigInt(2);
2966
3640
  var _3n = BigInt(3);
2967
3641
  var _5n = BigInt(5);
2968
3642
  var _8n = BigInt(8);
@@ -2981,8 +3655,8 @@ var require_ed25519 = __commonJS({
2981
3655
  const P = ed25519_CURVE_p;
2982
3656
  const x2 = x * x % P;
2983
3657
  const b2 = x2 * x % P;
2984
- const b4 = (0, modular_ts_1.pow2)(b2, _2n, P) * b2 % P;
2985
- const b5 = (0, modular_ts_1.pow2)(b4, _1n, P) * x % P;
3658
+ const b4 = (0, modular_ts_1.pow2)(b2, _2n2, P) * b2 % P;
3659
+ const b5 = (0, modular_ts_1.pow2)(b4, _1n2, P) * x % P;
2986
3660
  const b10 = (0, modular_ts_1.pow2)(b5, _5n, P) * b5 % P;
2987
3661
  const b20 = (0, modular_ts_1.pow2)(b10, _10n, P) * b10 % P;
2988
3662
  const b40 = (0, modular_ts_1.pow2)(b20, _20n, P) * b20 % P;
@@ -2990,7 +3664,7 @@ var require_ed25519 = __commonJS({
2990
3664
  const b160 = (0, modular_ts_1.pow2)(b80, _80n, P) * b80 % P;
2991
3665
  const b240 = (0, modular_ts_1.pow2)(b160, _80n, P) * b80 % P;
2992
3666
  const b250 = (0, modular_ts_1.pow2)(b240, _10n, P) * b10 % P;
2993
- const pow_p_5_8 = (0, modular_ts_1.pow2)(b250, _2n, P) * x % P;
3667
+ const pow_p_5_8 = (0, modular_ts_1.pow2)(b250, _2n2, P) * x % P;
2994
3668
  return { pow_p_5_8, b2 };
2995
3669
  }
2996
3670
  function adjustScalarBytes(bytes) {
@@ -3059,13 +3733,13 @@ var require_ed25519 = __commonJS({
3059
3733
  });
3060
3734
  })();
3061
3735
  var ELL2_C1 = /* @__PURE__ */ (() => (ed25519_CURVE_p + _3n) / _8n)();
3062
- var ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(_2n, ELL2_C1))();
3736
+ var ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(_2n2, ELL2_C1))();
3063
3737
  var ELL2_C3 = /* @__PURE__ */ (() => Fp.sqrt(Fp.neg(Fp.ONE)))();
3064
3738
  function map_to_curve_elligator2_curve25519(u) {
3065
3739
  const ELL2_C4 = (ed25519_CURVE_p - _5n) / _8n;
3066
3740
  const ELL2_J = BigInt(486662);
3067
3741
  let tv1 = Fp.sqr(u);
3068
- tv1 = Fp.mul(tv1, _2n);
3742
+ tv1 = Fp.mul(tv1, _2n2);
3069
3743
  let xd = Fp.add(tv1, Fp.ONE);
3070
3744
  let x1n = Fp.neg(ELL2_J);
3071
3745
  let tv2 = Fp.sqr(xd);
@@ -3102,7 +3776,7 @@ var require_ed25519 = __commonJS({
3102
3776
  let y = Fp.cmov(y2, y1, e3);
3103
3777
  let e4 = Fp.isOdd(y);
3104
3778
  y = Fp.cmov(y, Fp.neg(y), e3 !== e4);
3105
- return { xMn: xn, xMd: xd, yMn: y, yMd: _1n };
3779
+ return { xMn: xn, xMd: xd, yMn: y, yMd: _1n2 };
3106
3780
  }
3107
3781
  var ELL2_C1_EDWARDS = /* @__PURE__ */ (() => (0, modular_ts_1.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))))();
3108
3782
  function map_to_curve_elligator2_edwards25519(u) {
@@ -3135,7 +3809,7 @@ var require_ed25519 = __commonJS({
3135
3809
  var INVSQRT_A_MINUS_D = /* @__PURE__ */ BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578");
3136
3810
  var ONE_MINUS_D_SQ = /* @__PURE__ */ BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838");
3137
3811
  var D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");
3138
- var invertSqrt = (number) => uvRatio(_1n, number);
3812
+ var invertSqrt = (number) => uvRatio(_1n2, number);
3139
3813
  var MAX_255B = /* @__PURE__ */ BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
3140
3814
  var bytes255ToNumberLE = (bytes) => exports.ed25519.Point.Fp.create((0, utils_ts_1.bytesToNumberLE)(bytes) & MAX_255B);
3141
3815
  function calcElligatorRistrettoMap(r0) {
@@ -3143,7 +3817,7 @@ var require_ed25519 = __commonJS({
3143
3817
  const P = ed25519_CURVE_p;
3144
3818
  const mod = (n) => Fp.create(n);
3145
3819
  const r = mod(SQRT_M1 * r0 * r0);
3146
- const Ns = mod((r + _1n) * ONE_MINUS_D_SQ);
3820
+ const Ns = mod((r + _1n2) * ONE_MINUS_D_SQ);
3147
3821
  let c = BigInt(-1);
3148
3822
  const D = mod((c - d * r) * mod(r + d));
3149
3823
  let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D);
@@ -3154,12 +3828,12 @@ var require_ed25519 = __commonJS({
3154
3828
  s = s_;
3155
3829
  if (!Ns_D_is_sq)
3156
3830
  c = r;
3157
- const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D);
3831
+ const Nt = mod(c * (r - _1n2) * D_MINUS_ONE_SQ - D);
3158
3832
  const s2 = s * s;
3159
3833
  const W0 = mod((s + s) * D);
3160
3834
  const W1 = mod(Nt * SQRT_AD_MINUS_ONE);
3161
- const W2 = mod(_1n - s2);
3162
- const W3 = mod(_1n + s2);
3835
+ const W2 = mod(_1n2 - s2);
3836
+ const W3 = mod(_1n2 + s2);
3163
3837
  return new exports.ed25519.Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2));
3164
3838
  }
3165
3839
  function ristretto255_map(bytes) {
@@ -3197,8 +3871,8 @@ var require_ed25519 = __commonJS({
3197
3871
  if (!(0, utils_ts_1.equalBytes)(Fp.toBytes(s), bytes) || (0, modular_ts_1.isNegativeLE)(s, P))
3198
3872
  throw new Error("invalid ristretto255 encoding 1");
3199
3873
  const s2 = mod(s * s);
3200
- const u1 = mod(_1n + a * s2);
3201
- const u2 = mod(_1n - a * s2);
3874
+ const u1 = mod(_1n2 + a * s2);
3875
+ const u2 = mod(_1n2 - a * s2);
3202
3876
  const u1_2 = mod(u1 * u1);
3203
3877
  const u2_2 = mod(u2 * u2);
3204
3878
  const v = mod(a * d * u1_2 - u2_2);
@@ -3210,9 +3884,9 @@ var require_ed25519 = __commonJS({
3210
3884
  x = mod(-x);
3211
3885
  const y = mod(u1 * Dy);
3212
3886
  const t = mod(x * y);
3213
- if (!isValid || (0, modular_ts_1.isNegativeLE)(t, P) || y === _0n)
3887
+ if (!isValid || (0, modular_ts_1.isNegativeLE)(t, P) || y === _0n2)
3214
3888
  throw new Error("invalid ristretto255 encoding 2");
3215
- return new __RistrettoPoint(new exports.ed25519.Point(x, y, _1n, t));
3889
+ return new __RistrettoPoint(new exports.ed25519.Point(x, y, _1n2, t));
3216
3890
  }
3217
3891
  /**
3218
3892
  * Converts ristretto-encoded string to ristretto point.
@@ -3604,8 +4278,8 @@ var require_bn = __commonJS({
3604
4278
  this.copy(r);
3605
4279
  return r;
3606
4280
  };
3607
- BN.prototype._expand = function _expand(size) {
3608
- while (this.length < size) {
4281
+ BN.prototype._expand = function _expand(size2) {
4282
+ while (this.length < size2) {
3609
4283
  this.words[this.length++] = 0;
3610
4284
  }
3611
4285
  return this;
@@ -3824,11 +4498,11 @@ var require_bn = __commonJS({
3824
4498
  BN.prototype.toArray = function toArray(endian, length) {
3825
4499
  return this.toArrayLike(Array, endian, length);
3826
4500
  };
3827
- var allocate = function allocate2(ArrayType, size) {
4501
+ var allocate = function allocate2(ArrayType, size2) {
3828
4502
  if (ArrayType.allocUnsafe) {
3829
- return ArrayType.allocUnsafe(size);
4503
+ return ArrayType.allocUnsafe(size2);
3830
4504
  }
3831
- return new ArrayType(size);
4505
+ return new ArrayType(size2);
3832
4506
  };
3833
4507
  BN.prototype.toArrayLike = function toArrayLike(ArrayType, endian, length) {
3834
4508
  this._strip();
@@ -5855,7 +6529,7 @@ var require_bn = __commonJS({
5855
6529
  }
5856
6530
  return r;
5857
6531
  };
5858
- MPrime.prototype.split = function split(input, out) {
6532
+ MPrime.prototype.split = function split2(input, out) {
5859
6533
  input.iushrn(this.n, 0, out);
5860
6534
  };
5861
6535
  MPrime.prototype.imulK = function imulK(num) {
@@ -5869,7 +6543,7 @@ var require_bn = __commonJS({
5869
6543
  );
5870
6544
  }
5871
6545
  inherits(K256, MPrime);
5872
- K256.prototype.split = function split(input, output) {
6546
+ K256.prototype.split = function split2(input, output) {
5873
6547
  var mask = 4194303;
5874
6548
  var outLen = Math.min(input.length, 9);
5875
6549
  for (var i = 0; i < outLen; i++) {
@@ -6242,11 +6916,11 @@ var require_safe_buffer = __commonJS({
6242
6916
  }
6243
6917
  return Buffer3(arg, encodingOrOffset, length);
6244
6918
  };
6245
- SafeBuffer.alloc = function(size, fill, encoding) {
6246
- if (typeof size !== "number") {
6919
+ SafeBuffer.alloc = function(size2, fill, encoding) {
6920
+ if (typeof size2 !== "number") {
6247
6921
  throw new TypeError("Argument must be a number");
6248
6922
  }
6249
- var buf = Buffer3(size);
6923
+ var buf = Buffer3(size2);
6250
6924
  if (fill !== void 0) {
6251
6925
  if (typeof encoding === "string") {
6252
6926
  buf.fill(fill, encoding);
@@ -6258,17 +6932,17 @@ var require_safe_buffer = __commonJS({
6258
6932
  }
6259
6933
  return buf;
6260
6934
  };
6261
- SafeBuffer.allocUnsafe = function(size) {
6262
- if (typeof size !== "number") {
6935
+ SafeBuffer.allocUnsafe = function(size2) {
6936
+ if (typeof size2 !== "number") {
6263
6937
  throw new TypeError("Argument must be a number");
6264
6938
  }
6265
- return Buffer3(size);
6939
+ return Buffer3(size2);
6266
6940
  };
6267
- SafeBuffer.allocUnsafeSlow = function(size) {
6268
- if (typeof size !== "number") {
6941
+ SafeBuffer.allocUnsafeSlow = function(size2) {
6942
+ if (typeof size2 !== "number") {
6269
6943
  throw new TypeError("Argument must be a number");
6270
6944
  }
6271
- return buffer.SlowBuffer(size);
6945
+ return buffer.SlowBuffer(size2);
6272
6946
  };
6273
6947
  }
6274
6948
  });
@@ -6316,12 +6990,12 @@ var require_src = __commonJS({
6316
6990
  pbegin++;
6317
6991
  zeroes++;
6318
6992
  }
6319
- var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
6320
- var b58 = new Uint8Array(size);
6993
+ var size2 = (pend - pbegin) * iFACTOR + 1 >>> 0;
6994
+ var b58 = new Uint8Array(size2);
6321
6995
  while (pbegin !== pend) {
6322
6996
  var carry = source[pbegin];
6323
6997
  var i2 = 0;
6324
- for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {
6998
+ for (var it1 = size2 - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {
6325
6999
  carry += 256 * b58[it1] >>> 0;
6326
7000
  b58[it1] = carry % BASE2 >>> 0;
6327
7001
  carry = carry / BASE2 >>> 0;
@@ -6332,12 +7006,12 @@ var require_src = __commonJS({
6332
7006
  length = i2;
6333
7007
  pbegin++;
6334
7008
  }
6335
- var it2 = size - length;
6336
- while (it2 !== size && b58[it2] === 0) {
7009
+ var it2 = size2 - length;
7010
+ while (it2 !== size2 && b58[it2] === 0) {
6337
7011
  it2++;
6338
7012
  }
6339
7013
  var str = LEADER.repeat(zeroes);
6340
- for (; it2 < size; ++it2) {
7014
+ for (; it2 < size2; ++it2) {
6341
7015
  str += ALPHABET.charAt(b58[it2]);
6342
7016
  }
6343
7017
  return str;
@@ -6356,8 +7030,8 @@ var require_src = __commonJS({
6356
7030
  zeroes++;
6357
7031
  psz++;
6358
7032
  }
6359
- var size = (source.length - psz) * FACTOR + 1 >>> 0;
6360
- var b256 = new Uint8Array(size);
7033
+ var size2 = (source.length - psz) * FACTOR + 1 >>> 0;
7034
+ var b256 = new Uint8Array(size2);
6361
7035
  while (psz < source.length) {
6362
7036
  var charCode = source.charCodeAt(psz);
6363
7037
  if (charCode > 255) {
@@ -6368,7 +7042,7 @@ var require_src = __commonJS({
6368
7042
  return;
6369
7043
  }
6370
7044
  var i2 = 0;
6371
- for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {
7045
+ for (var it3 = size2 - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {
6372
7046
  carry += BASE2 * b256[it3] >>> 0;
6373
7047
  b256[it3] = carry % 256 >>> 0;
6374
7048
  carry = carry / 256 >>> 0;
@@ -6379,14 +7053,14 @@ var require_src = __commonJS({
6379
7053
  length = i2;
6380
7054
  psz++;
6381
7055
  }
6382
- var it4 = size - length;
6383
- while (it4 !== size && b256[it4] === 0) {
7056
+ var it4 = size2 - length;
7057
+ while (it4 !== size2 && b256[it4] === 0) {
6384
7058
  it4++;
6385
7059
  }
6386
- var vch = _Buffer.allocUnsafe(zeroes + (size - it4));
7060
+ var vch = _Buffer.allocUnsafe(zeroes + (size2 - it4));
6387
7061
  vch.fill(0, 0, zeroes);
6388
7062
  var j2 = zeroes;
6389
- while (it4 !== size) {
7063
+ while (it4 !== size2) {
6390
7064
  vch[j2++] = b256[it4++];
6391
7065
  }
6392
7066
  return vch;
@@ -7536,10 +8210,10 @@ var require_Layout = __commonJS({
7536
8210
  }
7537
8211
  /** @override */
7538
8212
  encode(src, b, offset = 0) {
7539
- const split = divmodInt64(src);
8213
+ const split2 = divmodInt64(src);
7540
8214
  const buffer = uint8ArrayToBuffer(b);
7541
- buffer.writeUInt32LE(split.lo32, offset);
7542
- buffer.writeUInt32LE(split.hi32, offset + 4);
8215
+ buffer.writeUInt32LE(split2.lo32, offset);
8216
+ buffer.writeUInt32LE(split2.hi32, offset + 4);
7543
8217
  return 8;
7544
8218
  }
7545
8219
  };
@@ -7557,10 +8231,10 @@ var require_Layout = __commonJS({
7557
8231
  }
7558
8232
  /** @override */
7559
8233
  encode(src, b, offset = 0) {
7560
- const split = divmodInt64(src);
8234
+ const split2 = divmodInt64(src);
7561
8235
  const buffer = uint8ArrayToBuffer(b);
7562
- buffer.writeUInt32BE(split.hi32, offset);
7563
- buffer.writeUInt32BE(split.lo32, offset + 4);
8236
+ buffer.writeUInt32BE(split2.hi32, offset);
8237
+ buffer.writeUInt32BE(split2.lo32, offset + 4);
7564
8238
  return 8;
7565
8239
  }
7566
8240
  };
@@ -7578,10 +8252,10 @@ var require_Layout = __commonJS({
7578
8252
  }
7579
8253
  /** @override */
7580
8254
  encode(src, b, offset = 0) {
7581
- const split = divmodInt64(src);
8255
+ const split2 = divmodInt64(src);
7582
8256
  const buffer = uint8ArrayToBuffer(b);
7583
- buffer.writeUInt32LE(split.lo32, offset);
7584
- buffer.writeInt32LE(split.hi32, offset + 4);
8257
+ buffer.writeUInt32LE(split2.lo32, offset);
8258
+ buffer.writeInt32LE(split2.hi32, offset + 4);
7585
8259
  return 8;
7586
8260
  }
7587
8261
  };
@@ -7599,10 +8273,10 @@ var require_Layout = __commonJS({
7599
8273
  }
7600
8274
  /** @override */
7601
8275
  encode(src, b, offset = 0) {
7602
- const split = divmodInt64(src);
8276
+ const split2 = divmodInt64(src);
7603
8277
  const buffer = uint8ArrayToBuffer(b);
7604
- buffer.writeInt32BE(split.hi32, offset);
7605
- buffer.writeUInt32BE(split.lo32, offset + 4);
8278
+ buffer.writeInt32BE(split2.hi32, offset);
8279
+ buffer.writeUInt32BE(split2.lo32, offset + 4);
7606
8280
  return 8;
7607
8281
  }
7608
8282
  };
@@ -9701,27 +10375,27 @@ var require_index_node2 = __commonJS({
9701
10375
  });
9702
10376
  return result;
9703
10377
  };
9704
- var padBytes = (bytes, length) => {
10378
+ var padBytes2 = (bytes, length) => {
9705
10379
  if (bytes.length >= length) return bytes;
9706
10380
  const paddedBytes = new Uint8Array(length).fill(0);
9707
10381
  paddedBytes.set(bytes);
9708
10382
  return paddedBytes;
9709
10383
  };
9710
- var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
10384
+ var fixBytes = (bytes, length) => padBytes2(bytes.length <= length ? bytes : bytes.slice(0, length), length);
9711
10385
  function containsBytes(data, bytes, offset) {
9712
10386
  const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);
9713
10387
  if (slice.length !== bytes.length) return false;
9714
10388
  return bytes.every((b, i) => b === slice[i]);
9715
10389
  }
9716
- function getEncodedSize(value, encoder) {
9717
- return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
10390
+ function getEncodedSize(value, encoder3) {
10391
+ return "fixedSize" in encoder3 ? encoder3.fixedSize : encoder3.getSizeFromValue(value);
9718
10392
  }
9719
- function createEncoder(encoder) {
10393
+ function createEncoder(encoder3) {
9720
10394
  return Object.freeze({
9721
- ...encoder,
10395
+ ...encoder3,
9722
10396
  encode: (value) => {
9723
- const bytes = new Uint8Array(getEncodedSize(value, encoder));
9724
- encoder.write(value, bytes, 0);
10397
+ const bytes = new Uint8Array(getEncodedSize(value, encoder3));
10398
+ encoder3.write(value, bytes, 0);
9725
10399
  return bytes;
9726
10400
  }
9727
10401
  });
@@ -9759,34 +10433,34 @@ var require_index_node2 = __commonJS({
9759
10433
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH);
9760
10434
  }
9761
10435
  }
9762
- function combineCodec(encoder, decoder) {
9763
- if (isFixedSize(encoder) !== isFixedSize(decoder)) {
10436
+ function combineCodec(encoder3, decoder) {
10437
+ if (isFixedSize(encoder3) !== isFixedSize(decoder)) {
9764
10438
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);
9765
10439
  }
9766
- if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
10440
+ if (isFixedSize(encoder3) && isFixedSize(decoder) && encoder3.fixedSize !== decoder.fixedSize) {
9767
10441
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, {
9768
10442
  decoderFixedSize: decoder.fixedSize,
9769
- encoderFixedSize: encoder.fixedSize
10443
+ encoderFixedSize: encoder3.fixedSize
9770
10444
  });
9771
10445
  }
9772
- if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
10446
+ if (!isFixedSize(encoder3) && !isFixedSize(decoder) && encoder3.maxSize !== decoder.maxSize) {
9773
10447
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, {
9774
10448
  decoderMaxSize: decoder.maxSize,
9775
- encoderMaxSize: encoder.maxSize
10449
+ encoderMaxSize: encoder3.maxSize
9776
10450
  });
9777
10451
  }
9778
10452
  return {
9779
10453
  ...decoder,
9780
- ...encoder,
10454
+ ...encoder3,
9781
10455
  decode: decoder.decode,
9782
- encode: encoder.encode,
10456
+ encode: encoder3.encode,
9783
10457
  read: decoder.read,
9784
- write: encoder.write
10458
+ write: encoder3.write
9785
10459
  };
9786
10460
  }
9787
- function addEncoderSentinel(encoder, sentinel) {
10461
+ function addEncoderSentinel(encoder3, sentinel) {
9788
10462
  const write = (value, bytes, offset) => {
9789
- const encoderBytes = encoder.encode(value);
10463
+ const encoderBytes = encoder3.encode(value);
9790
10464
  if (findSentinelIndex(encoderBytes, sentinel) >= 0) {
9791
10465
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL, {
9792
10466
  encodedBytes: encoderBytes,
@@ -9801,13 +10475,13 @@ var require_index_node2 = __commonJS({
9801
10475
  offset += sentinel.length;
9802
10476
  return offset;
9803
10477
  };
9804
- if (isFixedSize(encoder)) {
9805
- return createEncoder({ ...encoder, fixedSize: encoder.fixedSize + sentinel.length, write });
10478
+ if (isFixedSize(encoder3)) {
10479
+ return createEncoder({ ...encoder3, fixedSize: encoder3.fixedSize + sentinel.length, write });
9806
10480
  }
9807
10481
  return createEncoder({
9808
- ...encoder,
9809
- ...encoder.maxSize != null ? { maxSize: encoder.maxSize + sentinel.length } : {},
9810
- getSizeFromValue: (value) => encoder.getSizeFromValue(value) + sentinel.length,
10482
+ ...encoder3,
10483
+ ...encoder3.maxSize != null ? { maxSize: encoder3.maxSize + sentinel.length } : {},
10484
+ getSizeFromValue: (value) => encoder3.getSizeFromValue(value) + sentinel.length,
9811
10485
  write
9812
10486
  });
9813
10487
  }
@@ -9873,24 +10547,24 @@ var require_index_node2 = __commonJS({
9873
10547
  });
9874
10548
  }
9875
10549
  }
9876
- function addEncoderSizePrefix(encoder, prefix) {
10550
+ function addEncoderSizePrefix(encoder3, prefix) {
9877
10551
  const write = (value, bytes, offset) => {
9878
- const encoderBytes = encoder.encode(value);
10552
+ const encoderBytes = encoder3.encode(value);
9879
10553
  offset = prefix.write(encoderBytes.length, bytes, offset);
9880
10554
  bytes.set(encoderBytes, offset);
9881
10555
  return offset + encoderBytes.length;
9882
10556
  };
9883
- if (isFixedSize(prefix) && isFixedSize(encoder)) {
9884
- return createEncoder({ ...encoder, fixedSize: prefix.fixedSize + encoder.fixedSize, write });
10557
+ if (isFixedSize(prefix) && isFixedSize(encoder3)) {
10558
+ return createEncoder({ ...encoder3, fixedSize: prefix.fixedSize + encoder3.fixedSize, write });
9885
10559
  }
9886
10560
  const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;
9887
- const encoderMaxSize = isFixedSize(encoder) ? encoder.fixedSize : encoder.maxSize ?? null;
10561
+ const encoderMaxSize = isFixedSize(encoder3) ? encoder3.fixedSize : encoder3.maxSize ?? null;
9888
10562
  const maxSize = prefixMaxSize !== null && encoderMaxSize !== null ? prefixMaxSize + encoderMaxSize : null;
9889
10563
  return createEncoder({
9890
- ...encoder,
10564
+ ...encoder3,
9891
10565
  ...maxSize !== null ? { maxSize } : {},
9892
10566
  getSizeFromValue: (value) => {
9893
- const encoderSize = getEncodedSize(value, encoder);
10567
+ const encoderSize = getEncodedSize(value, encoder3);
9894
10568
  return getEncodedSize(encoderSize, prefix) + encoderSize;
9895
10569
  },
9896
10570
  write
@@ -9899,13 +10573,13 @@ var require_index_node2 = __commonJS({
9899
10573
  function addDecoderSizePrefix(decoder, prefix) {
9900
10574
  const read = (bytes, offset) => {
9901
10575
  const [bigintSize, decoderOffset] = prefix.read(bytes, offset);
9902
- const size = Number(bigintSize);
10576
+ const size2 = Number(bigintSize);
9903
10577
  offset = decoderOffset;
9904
- if (offset > 0 || bytes.length > size) {
9905
- bytes = bytes.slice(offset, offset + size);
10578
+ if (offset > 0 || bytes.length > size2) {
10579
+ bytes = bytes.slice(offset, offset + size2);
9906
10580
  }
9907
- assertByteArrayHasEnoughBytesForCodec("addDecoderSizePrefix", size, bytes);
9908
- return [decoder.decode(bytes), offset + size];
10581
+ assertByteArrayHasEnoughBytesForCodec("addDecoderSizePrefix", size2, bytes);
10582
+ return [decoder.decode(bytes), offset + size2];
9909
10583
  };
9910
10584
  if (isFixedSize(prefix) && isFixedSize(decoder)) {
9911
10585
  return createDecoder({ ...decoder, fixedSize: prefix.fixedSize + decoder.fixedSize, read });
@@ -9918,11 +10592,11 @@ var require_index_node2 = __commonJS({
9918
10592
  function addCodecSizePrefix(codec, prefix) {
9919
10593
  return combineCodec(addEncoderSizePrefix(codec, prefix), addDecoderSizePrefix(codec, prefix));
9920
10594
  }
9921
- function fixEncoderSize(encoder, fixedBytes) {
10595
+ function fixEncoderSize(encoder3, fixedBytes) {
9922
10596
  return createEncoder({
9923
10597
  fixedSize: fixedBytes,
9924
10598
  write: (value, bytes, offset) => {
9925
- const variableByteArray = encoder.encode(value);
10599
+ const variableByteArray = encoder3.encode(value);
9926
10600
  const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
9927
10601
  bytes.set(fixedByteArray, offset);
9928
10602
  return offset + fixedBytes;
@@ -9948,14 +10622,14 @@ var require_index_node2 = __commonJS({
9948
10622
  function fixCodecSize(codec, fixedBytes) {
9949
10623
  return combineCodec(fixEncoderSize(codec, fixedBytes), fixDecoderSize(codec, fixedBytes));
9950
10624
  }
9951
- function offsetEncoder(encoder, config) {
10625
+ function offsetEncoder(encoder3, config) {
9952
10626
  return createEncoder({
9953
- ...encoder,
10627
+ ...encoder3,
9954
10628
  write: (value, bytes, preOffset) => {
9955
10629
  const wrapBytes = (offset) => modulo(offset, bytes.length);
9956
10630
  const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset;
9957
10631
  assertByteArrayOffsetIsNotOutOfRange("offsetEncoder", newPreOffset, bytes.length);
9958
- const postOffset = encoder.write(value, bytes, newPreOffset);
10632
+ const postOffset = encoder3.write(value, bytes, newPreOffset);
9959
10633
  const newPostOffset = config.postOffset ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes }) : postOffset;
9960
10634
  assertByteArrayOffsetIsNotOutOfRange("offsetEncoder", newPostOffset, bytes.length);
9961
10635
  return newPostOffset;
@@ -9983,21 +10657,21 @@ var require_index_node2 = __commonJS({
9983
10657
  if (divisor === 0) return 0;
9984
10658
  return (dividend % divisor + divisor) % divisor;
9985
10659
  }
9986
- function resizeEncoder(encoder, resize) {
9987
- if (isFixedSize(encoder)) {
9988
- const fixedSize = resize(encoder.fixedSize);
10660
+ function resizeEncoder(encoder3, resize) {
10661
+ if (isFixedSize(encoder3)) {
10662
+ const fixedSize = resize(encoder3.fixedSize);
9989
10663
  if (fixedSize < 0) {
9990
10664
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {
9991
10665
  bytesLength: fixedSize,
9992
10666
  codecDescription: "resizeEncoder"
9993
10667
  });
9994
10668
  }
9995
- return createEncoder({ ...encoder, fixedSize });
10669
+ return createEncoder({ ...encoder3, fixedSize });
9996
10670
  }
9997
10671
  return createEncoder({
9998
- ...encoder,
10672
+ ...encoder3,
9999
10673
  getSizeFromValue: (value) => {
10000
- const newSize = resize(encoder.getSizeFromValue(value));
10674
+ const newSize = resize(encoder3.getSizeFromValue(value));
10001
10675
  if (newSize < 0) {
10002
10676
  throw new errors.SolanaError(errors.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {
10003
10677
  bytesLength: newSize,
@@ -10024,27 +10698,27 @@ var require_index_node2 = __commonJS({
10024
10698
  function resizeCodec(codec, resize) {
10025
10699
  return combineCodec(resizeEncoder(codec, resize), resizeDecoder(codec, resize));
10026
10700
  }
10027
- function padLeftEncoder(encoder, offset) {
10701
+ function padLeftEncoder(encoder3, offset) {
10028
10702
  return offsetEncoder(
10029
- resizeEncoder(encoder, (size) => size + offset),
10703
+ resizeEncoder(encoder3, (size2) => size2 + offset),
10030
10704
  { preOffset: ({ preOffset }) => preOffset + offset }
10031
10705
  );
10032
10706
  }
10033
- function padRightEncoder(encoder, offset) {
10707
+ function padRightEncoder(encoder3, offset) {
10034
10708
  return offsetEncoder(
10035
- resizeEncoder(encoder, (size) => size + offset),
10709
+ resizeEncoder(encoder3, (size2) => size2 + offset),
10036
10710
  { postOffset: ({ postOffset }) => postOffset + offset }
10037
10711
  );
10038
10712
  }
10039
10713
  function padLeftDecoder(decoder, offset) {
10040
10714
  return offsetDecoder(
10041
- resizeDecoder(decoder, (size) => size + offset),
10715
+ resizeDecoder(decoder, (size2) => size2 + offset),
10042
10716
  { preOffset: ({ preOffset }) => preOffset + offset }
10043
10717
  );
10044
10718
  }
10045
10719
  function padRightDecoder(decoder, offset) {
10046
10720
  return offsetDecoder(
10047
- resizeDecoder(decoder, (size) => size + offset),
10721
+ resizeDecoder(decoder, (size2) => size2 + offset),
10048
10722
  { postOffset: ({ postOffset }) => postOffset + offset }
10049
10723
  );
10050
10724
  }
@@ -10065,17 +10739,17 @@ var require_index_node2 = __commonJS({
10065
10739
  target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceOffset];
10066
10740
  }
10067
10741
  }
10068
- function reverseEncoder(encoder) {
10069
- assertIsFixedSize(encoder);
10742
+ function reverseEncoder(encoder3) {
10743
+ assertIsFixedSize(encoder3);
10070
10744
  return createEncoder({
10071
- ...encoder,
10745
+ ...encoder3,
10072
10746
  write: (value, bytes, offset) => {
10073
- const newOffset = encoder.write(value, bytes, offset);
10747
+ const newOffset = encoder3.write(value, bytes, offset);
10074
10748
  copySourceToTargetInReverse(
10075
10749
  bytes,
10076
10750
  bytes,
10077
10751
  offset,
10078
- offset + encoder.fixedSize
10752
+ offset + encoder3.fixedSize
10079
10753
  );
10080
10754
  return newOffset;
10081
10755
  }
@@ -10100,10 +10774,10 @@ var require_index_node2 = __commonJS({
10100
10774
  function reverseCodec(codec) {
10101
10775
  return combineCodec(reverseEncoder(codec), reverseDecoder(codec));
10102
10776
  }
10103
- function transformEncoder(encoder, unmap) {
10777
+ function transformEncoder(encoder3, unmap) {
10104
10778
  return createEncoder({
10105
- ...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,
10106
- write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)
10779
+ ...isVariableSize(encoder3) ? { ...encoder3, getSizeFromValue: (value) => encoder3.getSizeFromValue(unmap(value)) } : encoder3,
10780
+ write: (value, bytes, offset) => encoder3.write(unmap(value), bytes, offset)
10107
10781
  });
10108
10782
  }
10109
10783
  function transformDecoder(decoder, map) {
@@ -10148,7 +10822,7 @@ var require_index_node2 = __commonJS({
10148
10822
  exports.offsetCodec = offsetCodec;
10149
10823
  exports.offsetDecoder = offsetDecoder;
10150
10824
  exports.offsetEncoder = offsetEncoder;
10151
- exports.padBytes = padBytes;
10825
+ exports.padBytes = padBytes2;
10152
10826
  exports.padLeftCodec = padLeftCodec;
10153
10827
  exports.padLeftDecoder = padLeftDecoder;
10154
10828
  exports.padLeftEncoder = padLeftEncoder;
@@ -10505,8 +11179,8 @@ var require_dist = __commonJS({
10505
11179
  constructor(failure, failures) {
10506
11180
  let cached2;
10507
11181
  const { message, explanation, ...rest } = failure;
10508
- const { path: path3 } = failure;
10509
- const msg = path3.length === 0 ? message : `At path: ${path3.join(".")} -- ${message}`;
11182
+ const { path: path6 } = failure;
11183
+ const msg = path6.length === 0 ? message : `At path: ${path6.join(".")} -- ${message}`;
10510
11184
  super(explanation ?? msg);
10511
11185
  if (explanation != null)
10512
11186
  this.cause = msg;
@@ -10551,15 +11225,15 @@ var require_dist = __commonJS({
10551
11225
  } else if (typeof result === "string") {
10552
11226
  result = { message: result };
10553
11227
  }
10554
- const { path: path3, branch } = context;
11228
+ const { path: path6, branch } = context;
10555
11229
  const { type: type2 } = struct6;
10556
11230
  const { refinement, message = `Expected a value of type \`${type2}\`${refinement ? ` with refinement \`${refinement}\`` : ""}, but received: \`${print(value)}\`` } = result;
10557
11231
  return {
10558
11232
  value,
10559
11233
  type: type2,
10560
11234
  refinement,
10561
- key: path3[path3.length - 1],
10562
- path: path3,
11235
+ key: path6[path6.length - 1],
11236
+ path: path6,
10563
11237
  branch,
10564
11238
  ...result,
10565
11239
  message
@@ -10577,8 +11251,8 @@ var require_dist = __commonJS({
10577
11251
  }
10578
11252
  }
10579
11253
  function* run2(value, struct6, options = {}) {
10580
- const { path: path3 = [], branch = [value], coerce: coerce2 = false, mask: mask2 = false } = options;
10581
- const ctx = { path: path3, branch, mask: mask2 };
11254
+ const { path: path6 = [], branch = [value], coerce: coerce2 = false, mask: mask2 = false } = options;
11255
+ const ctx = { path: path6, branch, mask: mask2 };
10582
11256
  if (coerce2) {
10583
11257
  value = struct6.coercer(value, ctx);
10584
11258
  }
@@ -10590,7 +11264,7 @@ var require_dist = __commonJS({
10590
11264
  }
10591
11265
  for (let [k, v, s] of struct6.entries(value, ctx)) {
10592
11266
  const ts = run2(v, s, {
10593
- path: k === void 0 ? path3 : [...path3, k],
11267
+ path: k === void 0 ? path6 : [...path6, k],
10594
11268
  branch: k === void 0 ? branch : [...branch, v],
10595
11269
  coerce: coerce2,
10596
11270
  mask: mask2,
@@ -11187,8 +11861,8 @@ var require_dist = __commonJS({
11187
11861
  }
11188
11862
  function empty(struct6) {
11189
11863
  return refine(struct6, "empty", (value) => {
11190
- const size2 = getSize(value);
11191
- return size2 === 0 || `Expected an empty ${struct6.type} but received one with a size of \`${size2}\``;
11864
+ const size3 = getSize(value);
11865
+ return size3 === 0 || `Expected an empty ${struct6.type} but received one with a size of \`${size3}\``;
11192
11866
  });
11193
11867
  }
11194
11868
  function getSize(value) {
@@ -11212,8 +11886,8 @@ var require_dist = __commonJS({
11212
11886
  }
11213
11887
  function nonempty(struct6) {
11214
11888
  return refine(struct6, "nonempty", (value) => {
11215
- const size2 = getSize(value);
11216
- return size2 > 0 || `Expected a nonempty ${struct6.type} but received an empty one`;
11889
+ const size3 = getSize(value);
11890
+ return size3 > 0 || `Expected a nonempty ${struct6.type} but received an empty one`;
11217
11891
  });
11218
11892
  }
11219
11893
  function pattern(struct6, regexp2) {
@@ -11221,15 +11895,15 @@ var require_dist = __commonJS({
11221
11895
  return regexp2.test(value) || `Expected a ${struct6.type} matching \`/${regexp2.source}/\` but received "${value}"`;
11222
11896
  });
11223
11897
  }
11224
- function size(struct6, min2, max2 = min2) {
11898
+ function size2(struct6, min2, max2 = min2) {
11225
11899
  const expected = `Expected a ${struct6.type}`;
11226
11900
  const of = min2 === max2 ? `of \`${min2}\`` : `between \`${min2}\` and \`${max2}\``;
11227
11901
  return refine(struct6, "size", (value) => {
11228
11902
  if (typeof value === "number" || value instanceof Date) {
11229
11903
  return min2 <= value && value <= max2 || `${expected} ${of} but received \`${value}\``;
11230
11904
  } else if (value instanceof Map || value instanceof Set) {
11231
- const { size: size2 } = value;
11232
- return min2 <= size2 && size2 <= max2 || `${expected} with a size ${of} but received one with a size of \`${size2}\``;
11905
+ const { size: size3 } = value;
11906
+ return min2 <= size3 && size3 <= max2 || `${expected} with a size ${of} but received one with a size of \`${size3}\``;
11233
11907
  } else {
11234
11908
  const { length } = value;
11235
11909
  return min2 <= length && length <= max2 || `${expected} with a length ${of} but received one with a length of \`${length}\``;
@@ -11291,7 +11965,7 @@ var require_dist = __commonJS({
11291
11965
  exports2.refine = refine;
11292
11966
  exports2.regexp = regexp;
11293
11967
  exports2.set = set;
11294
- exports2.size = size;
11968
+ exports2.size = size2;
11295
11969
  exports2.string = string;
11296
11970
  exports2.struct = struct5;
11297
11971
  exports2.trimmed = trimmed;
@@ -11305,10 +11979,10 @@ var require_dist = __commonJS({
11305
11979
  });
11306
11980
 
11307
11981
  // node_modules/uuid/dist/esm-node/rng.js
11308
- import crypto4 from "crypto";
11982
+ import crypto5 from "crypto";
11309
11983
  function rng() {
11310
11984
  if (poolPtr > rnds8Pool.length - 16) {
11311
- crypto4.randomFillSync(rnds8Pool);
11985
+ crypto5.randomFillSync(rnds8Pool);
11312
11986
  poolPtr = 0;
11313
11987
  }
11314
11988
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
@@ -11455,7 +12129,7 @@ var init_parse = __esm({
11455
12129
  });
11456
12130
 
11457
12131
  // node_modules/uuid/dist/esm-node/v35.js
11458
- function stringToBytes(str) {
12132
+ function stringToBytes2(str) {
11459
12133
  str = unescape(encodeURIComponent(str));
11460
12134
  const bytes = [];
11461
12135
  for (let i = 0; i < str.length; ++i) {
@@ -11463,10 +12137,10 @@ function stringToBytes(str) {
11463
12137
  }
11464
12138
  return bytes;
11465
12139
  }
11466
- function v35_default(name, version3, hashfunc) {
12140
+ function v35_default(name, version4, hashfunc) {
11467
12141
  function generateUUID(value, namespace, buf, offset) {
11468
12142
  if (typeof value === "string") {
11469
- value = stringToBytes(value);
12143
+ value = stringToBytes2(value);
11470
12144
  }
11471
12145
  if (typeof namespace === "string") {
11472
12146
  namespace = parse_default(namespace);
@@ -11478,7 +12152,7 @@ function v35_default(name, version3, hashfunc) {
11478
12152
  bytes.set(namespace);
11479
12153
  bytes.set(value, namespace.length);
11480
12154
  bytes = hashfunc(bytes);
11481
- bytes[6] = bytes[6] & 15 | version3;
12155
+ bytes[6] = bytes[6] & 15 | version4;
11482
12156
  bytes[8] = bytes[8] & 63 | 128;
11483
12157
  if (buf) {
11484
12158
  offset = offset || 0;
@@ -11508,14 +12182,14 @@ var init_v35 = __esm({
11508
12182
  });
11509
12183
 
11510
12184
  // node_modules/uuid/dist/esm-node/md5.js
11511
- import crypto5 from "crypto";
12185
+ import crypto6 from "crypto";
11512
12186
  function md5(bytes) {
11513
12187
  if (Array.isArray(bytes)) {
11514
12188
  bytes = Buffer.from(bytes);
11515
12189
  } else if (typeof bytes === "string") {
11516
12190
  bytes = Buffer.from(bytes, "utf8");
11517
12191
  }
11518
- return crypto5.createHash("md5").update(bytes).digest();
12192
+ return crypto6.createHash("md5").update(bytes).digest();
11519
12193
  }
11520
12194
  var md5_default;
11521
12195
  var init_md5 = __esm({
@@ -11560,14 +12234,14 @@ var init_v4 = __esm({
11560
12234
  });
11561
12235
 
11562
12236
  // node_modules/uuid/dist/esm-node/sha1.js
11563
- import crypto6 from "crypto";
12237
+ import crypto7 from "crypto";
11564
12238
  function sha1(bytes) {
11565
12239
  if (Array.isArray(bytes)) {
11566
12240
  bytes = Buffer.from(bytes);
11567
12241
  } else if (typeof bytes === "string") {
11568
12242
  bytes = Buffer.from(bytes, "utf8");
11569
12243
  }
11570
- return crypto6.createHash("sha1").update(bytes).digest();
12244
+ return crypto7.createHash("sha1").update(bytes).digest();
11571
12245
  }
11572
12246
  var sha1_default;
11573
12247
  var init_sha1 = __esm({
@@ -11596,17 +12270,17 @@ var init_nil = __esm({
11596
12270
  });
11597
12271
 
11598
12272
  // node_modules/uuid/dist/esm-node/version.js
11599
- function version(uuid) {
12273
+ function version2(uuid) {
11600
12274
  if (!validate_default(uuid)) {
11601
12275
  throw TypeError("Invalid UUID");
11602
12276
  }
11603
12277
  return parseInt(uuid.substr(14, 1), 16);
11604
12278
  }
11605
12279
  var version_default;
11606
- var init_version = __esm({
12280
+ var init_version2 = __esm({
11607
12281
  "node_modules/uuid/dist/esm-node/version.js"() {
11608
12282
  init_validate();
11609
- version_default = version;
12283
+ version_default = version2;
11610
12284
  }
11611
12285
  });
11612
12286
 
@@ -11630,7 +12304,7 @@ var init_esm_node = __esm({
11630
12304
  init_v4();
11631
12305
  init_v5();
11632
12306
  init_nil();
11633
- init_version();
12307
+ init_version2();
11634
12308
  init_validate();
11635
12309
  init_stringify();
11636
12310
  init_parse();
@@ -11647,14 +12321,14 @@ var require_generateRequest = __commonJS({
11647
12321
  throw new TypeError(method + " must be a string");
11648
12322
  }
11649
12323
  options = options || {};
11650
- const version3 = typeof options.version === "number" ? options.version : 2;
11651
- if (version3 !== 1 && version3 !== 2) {
11652
- throw new TypeError(version3 + " must be 1 or 2");
12324
+ const version4 = typeof options.version === "number" ? options.version : 2;
12325
+ if (version4 !== 1 && version4 !== 2) {
12326
+ throw new TypeError(version4 + " must be 1 or 2");
11653
12327
  }
11654
12328
  const request2 = {
11655
12329
  method
11656
12330
  };
11657
- if (version3 === 2) {
12331
+ if (version4 === 2) {
11658
12332
  request2.jsonrpc = "2.0";
11659
12333
  }
11660
12334
  if (params) {
@@ -11668,7 +12342,7 @@ var require_generateRequest = __commonJS({
11668
12342
  return uuid();
11669
12343
  };
11670
12344
  request2.id = generator(request2, options);
11671
- } else if (version3 === 2 && id === null) {
12345
+ } else if (version4 === 2 && id === null) {
11672
12346
  if (options.notificationIdNull) {
11673
12347
  request2.id = null;
11674
12348
  }
@@ -12520,14 +13194,14 @@ var require_url_state_machine = __commonJS({
12520
13194
  return url.replace(/\u0009|\u000A|\u000D/g, "");
12521
13195
  }
12522
13196
  function shortenPath(url) {
12523
- const path3 = url.path;
12524
- if (path3.length === 0) {
13197
+ const path6 = url.path;
13198
+ if (path6.length === 0) {
12525
13199
  return;
12526
13200
  }
12527
- if (url.scheme === "file" && path3.length === 1 && isNormalizedWindowsDriveLetter(path3[0])) {
13201
+ if (url.scheme === "file" && path6.length === 1 && isNormalizedWindowsDriveLetter(path6[0])) {
12528
13202
  return;
12529
13203
  }
12530
- path3.pop();
13204
+ path6.pop();
12531
13205
  }
12532
13206
  function includesCredentials(url) {
12533
13207
  return url.username !== "" || url.password !== "";
@@ -13580,7 +14254,7 @@ var require_lib3 = __commonJS({
13580
14254
  const blobParts = arguments[0];
13581
14255
  const options = arguments[1];
13582
14256
  const buffers = [];
13583
- let size = 0;
14257
+ let size2 = 0;
13584
14258
  if (blobParts) {
13585
14259
  const a = blobParts;
13586
14260
  const length = Number(a.length);
@@ -13598,7 +14272,7 @@ var require_lib3 = __commonJS({
13598
14272
  } else {
13599
14273
  buffer = Buffer.from(typeof element === "string" ? element : String(element));
13600
14274
  }
13601
- size += buffer.length;
14275
+ size2 += buffer.length;
13602
14276
  buffers.push(buffer);
13603
14277
  }
13604
14278
  }
@@ -13634,23 +14308,23 @@ var require_lib3 = __commonJS({
13634
14308
  return "[object Blob]";
13635
14309
  }
13636
14310
  slice() {
13637
- const size = this.size;
14311
+ const size2 = this.size;
13638
14312
  const start = arguments[0];
13639
14313
  const end = arguments[1];
13640
14314
  let relativeStart, relativeEnd;
13641
14315
  if (start === void 0) {
13642
14316
  relativeStart = 0;
13643
14317
  } else if (start < 0) {
13644
- relativeStart = Math.max(size + start, 0);
14318
+ relativeStart = Math.max(size2 + start, 0);
13645
14319
  } else {
13646
- relativeStart = Math.min(start, size);
14320
+ relativeStart = Math.min(start, size2);
13647
14321
  }
13648
14322
  if (end === void 0) {
13649
- relativeEnd = size;
14323
+ relativeEnd = size2;
13650
14324
  } else if (end < 0) {
13651
- relativeEnd = Math.max(size + end, 0);
14325
+ relativeEnd = Math.max(size2 + end, 0);
13652
14326
  } else {
13653
- relativeEnd = Math.min(end, size);
14327
+ relativeEnd = Math.min(end, size2);
13654
14328
  }
13655
14329
  const span = Math.max(relativeEnd - relativeStart, 0);
13656
14330
  const buffer = this[BUFFER];
@@ -13693,7 +14367,7 @@ var require_lib3 = __commonJS({
13693
14367
  function Body(body) {
13694
14368
  var _this = this;
13695
14369
  var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref$size = _ref.size;
13696
- let size = _ref$size === void 0 ? 0 : _ref$size;
14370
+ let size2 = _ref$size === void 0 ? 0 : _ref$size;
13697
14371
  var _ref$timeout = _ref.timeout;
13698
14372
  let timeout = _ref$timeout === void 0 ? 0 : _ref$timeout;
13699
14373
  if (body == null) {
@@ -13715,7 +14389,7 @@ var require_lib3 = __commonJS({
13715
14389
  disturbed: false,
13716
14390
  error: null
13717
14391
  };
13718
- this.size = size;
14392
+ this.size = size2;
13719
14393
  this.timeout = timeout;
13720
14394
  if (body instanceof Stream) {
13721
14395
  body.on("error", function(err) {
@@ -14822,16 +15496,16 @@ var require_constants = __commonJS({
14822
15496
  // node_modules/node-gyp-build/node-gyp-build.js
14823
15497
  var require_node_gyp_build = __commonJS({
14824
15498
  "node_modules/node-gyp-build/node-gyp-build.js"(exports, module) {
14825
- var fs4 = __require("fs");
14826
- var path3 = __require("path");
14827
- var os2 = __require("os");
15499
+ var fs6 = __require("fs");
15500
+ var path6 = __require("path");
15501
+ var os3 = __require("os");
14828
15502
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
14829
15503
  var vars = process.config && process.config.variables || {};
14830
15504
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
14831
15505
  var abi = process.versions.modules;
14832
15506
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
14833
- var arch = process.env.npm_config_arch || os2.arch();
14834
- var platform = process.env.npm_config_platform || os2.platform();
15507
+ var arch = process.env.npm_config_arch || os3.arch();
15508
+ var platform = process.env.npm_config_platform || os3.platform();
14835
15509
  var libc = process.env.LIBC || (isAlpine(platform) ? "musl" : "glibc");
14836
15510
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
14837
15511
  var uv = (process.versions.uv || "").split(".")[0];
@@ -14840,21 +15514,21 @@ var require_node_gyp_build = __commonJS({
14840
15514
  return runtimeRequire(load.resolve(dir));
14841
15515
  }
14842
15516
  load.resolve = load.path = function(dir) {
14843
- dir = path3.resolve(dir || ".");
15517
+ dir = path6.resolve(dir || ".");
14844
15518
  try {
14845
- var name = runtimeRequire(path3.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
15519
+ var name = runtimeRequire(path6.join(dir, "package.json")).name.toUpperCase().replace(/-/g, "_");
14846
15520
  if (process.env[name + "_PREBUILD"]) dir = process.env[name + "_PREBUILD"];
14847
15521
  } catch (err) {
14848
15522
  }
14849
15523
  if (!prebuildsOnly) {
14850
- var release = getFirst(path3.join(dir, "build/Release"), matchBuild);
15524
+ var release = getFirst(path6.join(dir, "build/Release"), matchBuild);
14851
15525
  if (release) return release;
14852
- var debug = getFirst(path3.join(dir, "build/Debug"), matchBuild);
15526
+ var debug = getFirst(path6.join(dir, "build/Debug"), matchBuild);
14853
15527
  if (debug) return debug;
14854
15528
  }
14855
15529
  var prebuild = resolve(dir);
14856
15530
  if (prebuild) return prebuild;
14857
- var nearby = resolve(path3.dirname(process.execPath));
15531
+ var nearby = resolve(path6.dirname(process.execPath));
14858
15532
  if (nearby) return nearby;
14859
15533
  var target = [
14860
15534
  "platform=" + platform,
@@ -14871,26 +15545,26 @@ var require_node_gyp_build = __commonJS({
14871
15545
  ].filter(Boolean).join(" ");
14872
15546
  throw new Error("No native build was found for " + target + "\n loaded from: " + dir + "\n");
14873
15547
  function resolve(dir2) {
14874
- var tuples = readdirSync(path3.join(dir2, "prebuilds")).map(parseTuple);
15548
+ var tuples = readdirSync(path6.join(dir2, "prebuilds")).map(parseTuple);
14875
15549
  var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
14876
15550
  if (!tuple) return;
14877
- var prebuilds = path3.join(dir2, "prebuilds", tuple.name);
15551
+ var prebuilds = path6.join(dir2, "prebuilds", tuple.name);
14878
15552
  var parsed = readdirSync(prebuilds).map(parseTags);
14879
15553
  var candidates = parsed.filter(matchTags(runtime, abi));
14880
15554
  var winner = candidates.sort(compareTags(runtime))[0];
14881
- if (winner) return path3.join(prebuilds, winner.file);
15555
+ if (winner) return path6.join(prebuilds, winner.file);
14882
15556
  }
14883
15557
  };
14884
15558
  function readdirSync(dir) {
14885
15559
  try {
14886
- return fs4.readdirSync(dir);
15560
+ return fs6.readdirSync(dir);
14887
15561
  } catch (err) {
14888
15562
  return [];
14889
15563
  }
14890
15564
  }
14891
15565
  function getFirst(dir, filter) {
14892
15566
  var files = readdirSync(dir).filter(filter);
14893
- return files[0] && path3.join(dir, files[0]);
15567
+ return files[0] && path6.join(dir, files[0]);
14894
15568
  }
14895
15569
  function matchBuild(name) {
14896
15570
  return /\.node$/.test(name);
@@ -14977,7 +15651,7 @@ var require_node_gyp_build = __commonJS({
14977
15651
  return typeof window !== "undefined" && window.process && window.process.type === "renderer";
14978
15652
  }
14979
15653
  function isAlpine(platform2) {
14980
- return platform2 === "linux" && fs4.existsSync("/etc/alpine-release");
15654
+ return platform2 === "linux" && fs6.existsSync("/etc/alpine-release");
14981
15655
  }
14982
15656
  load.parseTags = parseTags;
14983
15657
  load.matchTags = matchTags;
@@ -18534,7 +19208,7 @@ var require_websocket_server = __commonJS({
18534
19208
  socket.on("error", socketOnError);
18535
19209
  const key = req.headers["sec-websocket-key"];
18536
19210
  const upgrade = req.headers.upgrade;
18537
- const version3 = +req.headers["sec-websocket-version"];
19211
+ const version4 = +req.headers["sec-websocket-version"];
18538
19212
  if (req.method !== "GET") {
18539
19213
  const message = "Invalid HTTP method";
18540
19214
  abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
@@ -18550,7 +19224,7 @@ var require_websocket_server = __commonJS({
18550
19224
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
18551
19225
  return;
18552
19226
  }
18553
- if (version3 !== 13 && version3 !== 8) {
19227
+ if (version4 !== 13 && version4 !== 8) {
18554
19228
  const message = "Missing or invalid Sec-WebSocket-Version header";
18555
19229
  abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
18556
19230
  "Sec-WebSocket-Version": "13, 8"
@@ -18594,7 +19268,7 @@ var require_websocket_server = __commonJS({
18594
19268
  }
18595
19269
  if (this.options.verifyClient) {
18596
19270
  const info = {
18597
- origin: req.headers[`${version3 === 8 ? "sec-websocket-origin" : "origin"}`],
19271
+ origin: req.headers[`${version4 === 8 ? "sec-websocket-origin" : "origin"}`],
18598
19272
  secure: !!(req.socket.authorized || req.socket.encrypted),
18599
19273
  req
18600
19274
  };
@@ -19120,7 +19794,7 @@ var init_md52 = __esm({
19120
19794
  });
19121
19795
 
19122
19796
  // node_modules/rpc-websockets/node_modules/uuid/dist-node/v35.js
19123
- function stringToBytes2(str) {
19797
+ function stringToBytes3(str) {
19124
19798
  str = unescape(encodeURIComponent(str));
19125
19799
  const bytes = new Uint8Array(str.length);
19126
19800
  for (let i = 0; i < str.length; ++i) {
@@ -19128,8 +19802,8 @@ function stringToBytes2(str) {
19128
19802
  }
19129
19803
  return bytes;
19130
19804
  }
19131
- function v35(version3, hash, value, namespace, buf, offset) {
19132
- const valueBytes = typeof value === "string" ? stringToBytes2(value) : value;
19805
+ function v35(version4, hash, value, namespace, buf, offset) {
19806
+ const valueBytes = typeof value === "string" ? stringToBytes3(value) : value;
19133
19807
  const namespaceBytes = typeof namespace === "string" ? parse_default2(namespace) : namespace;
19134
19808
  if (typeof namespace === "string") {
19135
19809
  namespace = parse_default2(namespace);
@@ -19141,7 +19815,7 @@ function v35(version3, hash, value, namespace, buf, offset) {
19141
19815
  bytes.set(namespaceBytes);
19142
19816
  bytes.set(valueBytes, namespaceBytes.length);
19143
19817
  bytes = hash(bytes);
19144
- bytes[6] = bytes[6] & 15 | version3;
19818
+ bytes[6] = bytes[6] & 15 | version4;
19145
19819
  bytes[8] = bytes[8] & 63 | 128;
19146
19820
  if (buf) {
19147
19821
  offset ??= 0;
@@ -19361,17 +20035,17 @@ var init_v7 = __esm({
19361
20035
  });
19362
20036
 
19363
20037
  // node_modules/rpc-websockets/node_modules/uuid/dist-node/version.js
19364
- function version2(uuid) {
20038
+ function version3(uuid) {
19365
20039
  if (!validate_default2(uuid)) {
19366
20040
  throw TypeError("Invalid UUID");
19367
20041
  }
19368
20042
  return parseInt(uuid.slice(14, 15), 16);
19369
20043
  }
19370
20044
  var version_default2;
19371
- var init_version2 = __esm({
20045
+ var init_version3 = __esm({
19372
20046
  "node_modules/rpc-websockets/node_modules/uuid/dist-node/version.js"() {
19373
20047
  init_validate2();
19374
- version_default2 = version2;
20048
+ version_default2 = version3;
19375
20049
  }
19376
20050
  });
19377
20051
 
@@ -19408,7 +20082,7 @@ var init_dist_node = __esm({
19408
20082
  init_v6ToV1();
19409
20083
  init_v7();
19410
20084
  init_validate2();
19411
- init_version2();
20085
+ init_version3();
19412
20086
  }
19413
20087
  });
19414
20088
 
@@ -20350,36 +21024,36 @@ var require_sha3 = __commonJS({
20350
21024
  "use strict";
20351
21025
  Object.defineProperty(exports, "__esModule", { value: true });
20352
21026
  exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = void 0;
20353
- exports.keccakP = keccakP;
21027
+ exports.keccakP = keccakP2;
20354
21028
  var _u64_ts_1 = require_u64();
20355
21029
  var utils_ts_1 = require_utils();
20356
- var _0n = BigInt(0);
20357
- var _1n = BigInt(1);
20358
- var _2n = BigInt(2);
20359
- var _7n = BigInt(7);
20360
- var _256n = BigInt(256);
20361
- var _0x71n = BigInt(113);
20362
- var SHA3_PI = [];
20363
- var SHA3_ROTL = [];
20364
- var _SHA3_IOTA = [];
20365
- for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
21030
+ var _0n2 = BigInt(0);
21031
+ var _1n2 = BigInt(1);
21032
+ var _2n2 = BigInt(2);
21033
+ var _7n2 = BigInt(7);
21034
+ var _256n2 = BigInt(256);
21035
+ var _0x71n2 = BigInt(113);
21036
+ var SHA3_PI2 = [];
21037
+ var SHA3_ROTL2 = [];
21038
+ var _SHA3_IOTA2 = [];
21039
+ for (let round = 0, R = _1n2, x = 1, y = 0; round < 24; round++) {
20366
21040
  [x, y] = [y, (2 * x + 3 * y) % 5];
20367
- SHA3_PI.push(2 * (5 * y + x));
20368
- SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
20369
- let t = _0n;
21041
+ SHA3_PI2.push(2 * (5 * y + x));
21042
+ SHA3_ROTL2.push((round + 1) * (round + 2) / 2 % 64);
21043
+ let t = _0n2;
20370
21044
  for (let j = 0; j < 7; j++) {
20371
- R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
20372
- if (R & _2n)
20373
- t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
20374
- }
20375
- _SHA3_IOTA.push(t);
20376
- }
20377
- var IOTAS = (0, _u64_ts_1.split)(_SHA3_IOTA, true);
20378
- var SHA3_IOTA_H = IOTAS[0];
20379
- var SHA3_IOTA_L = IOTAS[1];
20380
- var rotlH = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBH)(h, l, s) : (0, _u64_ts_1.rotlSH)(h, l, s);
20381
- var rotlL = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBL)(h, l, s) : (0, _u64_ts_1.rotlSL)(h, l, s);
20382
- function keccakP(s, rounds = 24) {
21045
+ R = (R << _1n2 ^ (R >> _7n2) * _0x71n2) % _256n2;
21046
+ if (R & _2n2)
21047
+ t ^= _1n2 << (_1n2 << /* @__PURE__ */ BigInt(j)) - _1n2;
21048
+ }
21049
+ _SHA3_IOTA2.push(t);
21050
+ }
21051
+ var IOTAS2 = (0, _u64_ts_1.split)(_SHA3_IOTA2, true);
21052
+ var SHA3_IOTA_H2 = IOTAS2[0];
21053
+ var SHA3_IOTA_L2 = IOTAS2[1];
21054
+ var rotlH2 = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBH)(h, l, s) : (0, _u64_ts_1.rotlSH)(h, l, s);
21055
+ var rotlL2 = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBL)(h, l, s) : (0, _u64_ts_1.rotlSL)(h, l, s);
21056
+ function keccakP2(s, rounds = 24) {
20383
21057
  const B = new Uint32Array(5 * 2);
20384
21058
  for (let round = 24 - rounds; round < 24; round++) {
20385
21059
  for (let x = 0; x < 10; x++)
@@ -20389,8 +21063,8 @@ var require_sha3 = __commonJS({
20389
21063
  const idx0 = (x + 2) % 10;
20390
21064
  const B0 = B[idx0];
20391
21065
  const B1 = B[idx0 + 1];
20392
- const Th = rotlH(B0, B1, 1) ^ B[idx1];
20393
- const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
21066
+ const Th = rotlH2(B0, B1, 1) ^ B[idx1];
21067
+ const Tl = rotlL2(B0, B1, 1) ^ B[idx1 + 1];
20394
21068
  for (let y = 0; y < 50; y += 10) {
20395
21069
  s[x + y] ^= Th;
20396
21070
  s[x + y + 1] ^= Tl;
@@ -20399,10 +21073,10 @@ var require_sha3 = __commonJS({
20399
21073
  let curH = s[2];
20400
21074
  let curL = s[3];
20401
21075
  for (let t = 0; t < 24; t++) {
20402
- const shift = SHA3_ROTL[t];
20403
- const Th = rotlH(curH, curL, shift);
20404
- const Tl = rotlL(curH, curL, shift);
20405
- const PI = SHA3_PI[t];
21076
+ const shift = SHA3_ROTL2[t];
21077
+ const Th = rotlH2(curH, curL, shift);
21078
+ const Tl = rotlL2(curH, curL, shift);
21079
+ const PI = SHA3_PI2[t];
20406
21080
  curH = s[PI];
20407
21081
  curL = s[PI + 1];
20408
21082
  s[PI] = Th;
@@ -20414,12 +21088,12 @@ var require_sha3 = __commonJS({
20414
21088
  for (let x = 0; x < 10; x++)
20415
21089
  s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
20416
21090
  }
20417
- s[0] ^= SHA3_IOTA_H[round];
20418
- s[1] ^= SHA3_IOTA_L[round];
21091
+ s[0] ^= SHA3_IOTA_H2[round];
21092
+ s[1] ^= SHA3_IOTA_L2[round];
20419
21093
  }
20420
21094
  (0, utils_ts_1.clean)(B);
20421
21095
  }
20422
- var Keccak = class _Keccak extends utils_ts_1.Hash {
21096
+ var Keccak2 = class _Keccak extends utils_ts_1.Hash {
20423
21097
  // NOTE: we accept arguments in bytes instead of bits here.
20424
21098
  constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
20425
21099
  super();
@@ -20444,7 +21118,7 @@ var require_sha3 = __commonJS({
20444
21118
  }
20445
21119
  keccak() {
20446
21120
  (0, utils_ts_1.swap32IfBE)(this.state32);
20447
- keccakP(this.state32, this.rounds);
21121
+ keccakP2(this.state32, this.rounds);
20448
21122
  (0, utils_ts_1.swap32IfBE)(this.state32);
20449
21123
  this.posOut = 0;
20450
21124
  this.pos = 0;
@@ -20530,17 +21204,17 @@ var require_sha3 = __commonJS({
20530
21204
  return to;
20531
21205
  }
20532
21206
  };
20533
- exports.Keccak = Keccak;
20534
- var gen = (suffix, blockLen, outputLen) => (0, utils_ts_1.createHasher)(() => new Keccak(blockLen, suffix, outputLen));
20535
- exports.sha3_224 = (() => gen(6, 144, 224 / 8))();
20536
- exports.sha3_256 = (() => gen(6, 136, 256 / 8))();
20537
- exports.sha3_384 = (() => gen(6, 104, 384 / 8))();
20538
- exports.sha3_512 = (() => gen(6, 72, 512 / 8))();
20539
- exports.keccak_224 = (() => gen(1, 144, 224 / 8))();
20540
- exports.keccak_256 = (() => gen(1, 136, 256 / 8))();
20541
- exports.keccak_384 = (() => gen(1, 104, 384 / 8))();
20542
- exports.keccak_512 = (() => gen(1, 72, 512 / 8))();
20543
- var genShake = (suffix, blockLen, outputLen) => (0, utils_ts_1.createXOFer)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
21207
+ exports.Keccak = Keccak2;
21208
+ var gen2 = (suffix, blockLen, outputLen) => (0, utils_ts_1.createHasher)(() => new Keccak2(blockLen, suffix, outputLen));
21209
+ exports.sha3_224 = (() => gen2(6, 144, 224 / 8))();
21210
+ exports.sha3_256 = (() => gen2(6, 136, 256 / 8))();
21211
+ exports.sha3_384 = (() => gen2(6, 104, 384 / 8))();
21212
+ exports.sha3_512 = (() => gen2(6, 72, 512 / 8))();
21213
+ exports.keccak_224 = (() => gen2(1, 144, 224 / 8))();
21214
+ exports.keccak_256 = (() => gen2(1, 136, 256 / 8))();
21215
+ exports.keccak_384 = (() => gen2(1, 104, 384 / 8))();
21216
+ exports.keccak_512 = (() => gen2(1, 72, 512 / 8))();
21217
+ var genShake = (suffix, blockLen, outputLen) => (0, utils_ts_1.createXOFer)((opts = {}) => new Keccak2(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
20544
21218
  exports.shake128 = (() => genShake(31, 168, 128 / 8))();
20545
21219
  exports.shake256 = (() => genShake(31, 136, 256 / 8))();
20546
21220
  }
@@ -20566,16 +21240,16 @@ var require_hmac = __commonJS({
20566
21240
  this.blockLen = this.iHash.blockLen;
20567
21241
  this.outputLen = this.iHash.outputLen;
20568
21242
  const blockLen = this.blockLen;
20569
- const pad = new Uint8Array(blockLen);
20570
- pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);
20571
- for (let i = 0; i < pad.length; i++)
20572
- pad[i] ^= 54;
20573
- this.iHash.update(pad);
21243
+ const pad2 = new Uint8Array(blockLen);
21244
+ pad2.set(key.length > blockLen ? hash.create().update(key).digest() : key);
21245
+ for (let i = 0; i < pad2.length; i++)
21246
+ pad2[i] ^= 54;
21247
+ this.iHash.update(pad2);
20574
21248
  this.oHash = hash.create();
20575
- for (let i = 0; i < pad.length; i++)
20576
- pad[i] ^= 54 ^ 92;
20577
- this.oHash.update(pad);
20578
- (0, utils_ts_1.clean)(pad);
21249
+ for (let i = 0; i < pad2.length; i++)
21250
+ pad2[i] ^= 54 ^ 92;
21251
+ this.oHash.update(pad2);
21252
+ (0, utils_ts_1.clean)(pad2);
20579
21253
  }
20580
21254
  update(buf) {
20581
21255
  (0, utils_ts_1.aexists)(this);
@@ -20645,21 +21319,21 @@ var require_weierstrass = __commonJS({
20645
21319
  var utils_ts_1 = require_utils2();
20646
21320
  var curve_ts_1 = require_curve();
20647
21321
  var modular_ts_1 = require_modular();
20648
- var divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n) / den;
21322
+ var divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n2) / den;
20649
21323
  function _splitEndoScalar(k, basis, n) {
20650
21324
  const [[a1, b1], [a2, b2]] = basis;
20651
21325
  const c1 = divNearest(b2 * k, n);
20652
21326
  const c2 = divNearest(-b1 * k, n);
20653
21327
  let k1 = k - c1 * a1 - c2 * a2;
20654
21328
  let k2 = -c1 * b1 - c2 * b2;
20655
- const k1neg = k1 < _0n;
20656
- const k2neg = k2 < _0n;
21329
+ const k1neg = k1 < _0n2;
21330
+ const k2neg = k2 < _0n2;
20657
21331
  if (k1neg)
20658
21332
  k1 = -k1;
20659
21333
  if (k2neg)
20660
21334
  k2 = -k2;
20661
- const MAX_NUM = (0, utils_ts_1.bitMask)(Math.ceil((0, utils_ts_1.bitLen)(n) / 2)) + _1n;
20662
- if (k1 < _0n || k1 >= MAX_NUM || k2 < _0n || k2 >= MAX_NUM) {
21335
+ const MAX_NUM = (0, utils_ts_1.bitMask)(Math.ceil((0, utils_ts_1.bitLen)(n) / 2)) + _1n2;
21336
+ if (k1 < _0n2 || k1 >= MAX_NUM || k2 < _0n2 || k2 >= MAX_NUM) {
20663
21337
  throw new Error("splitScalar (endomorphism): failed, k=" + k);
20664
21338
  }
20665
21339
  return { k1neg, k1, k2neg, k2 };
@@ -20748,7 +21422,7 @@ var require_weierstrass = __commonJS({
20748
21422
  _int: {
20749
21423
  encode(num) {
20750
21424
  const { Err: E } = exports.DER;
20751
- if (num < _0n)
21425
+ if (num < _0n2)
20752
21426
  throw new E("integer: negative integers are not allowed");
20753
21427
  let hex = (0, utils_ts_1.numberToHexUnpadded)(num);
20754
21428
  if (Number.parseInt(hex[0], 16) & 8)
@@ -20786,9 +21460,9 @@ var require_weierstrass = __commonJS({
20786
21460
  return tlv.encode(48, seq);
20787
21461
  }
20788
21462
  };
20789
- var _0n = BigInt(0);
20790
- var _1n = BigInt(1);
20791
- var _2n = BigInt(2);
21463
+ var _0n2 = BigInt(0);
21464
+ var _1n2 = BigInt(1);
21465
+ var _2n2 = BigInt(2);
20792
21466
  var _3n = BigInt(3);
20793
21467
  var _4n = BigInt(4);
20794
21468
  function _normFnElement(Fn, key) {
@@ -21160,9 +21834,9 @@ var require_weierstrass = __commonJS({
21160
21834
  const p = this;
21161
21835
  if (!Fn.isValid(sc))
21162
21836
  throw new Error("invalid scalar: out of range");
21163
- if (sc === _0n || p.is0())
21837
+ if (sc === _0n2 || p.is0())
21164
21838
  return Point.ZERO;
21165
- if (sc === _1n)
21839
+ if (sc === _1n2)
21166
21840
  return p;
21167
21841
  if (wnaf.hasCache(this))
21168
21842
  return this.multiply(sc);
@@ -21191,7 +21865,7 @@ var require_weierstrass = __commonJS({
21191
21865
  */
21192
21866
  isTorsionFree() {
21193
21867
  const { isTorsionFree } = extraOpts;
21194
- if (cofactor === _1n)
21868
+ if (cofactor === _1n2)
21195
21869
  return true;
21196
21870
  if (isTorsionFree)
21197
21871
  return isTorsionFree(Point, this);
@@ -21199,7 +21873,7 @@ var require_weierstrass = __commonJS({
21199
21873
  }
21200
21874
  clearCofactor() {
21201
21875
  const { clearCofactor } = extraOpts;
21202
- if (cofactor === _1n)
21876
+ if (cofactor === _1n2)
21203
21877
  return this;
21204
21878
  if (clearCofactor)
21205
21879
  return clearCofactor(Point, this);
@@ -21259,18 +21933,18 @@ var require_weierstrass = __commonJS({
21259
21933
  }
21260
21934
  function SWUFpSqrtRatio(Fp, Z) {
21261
21935
  const q = Fp.ORDER;
21262
- let l = _0n;
21263
- for (let o = q - _1n; o % _2n === _0n; o /= _2n)
21264
- l += _1n;
21936
+ let l = _0n2;
21937
+ for (let o = q - _1n2; o % _2n2 === _0n2; o /= _2n2)
21938
+ l += _1n2;
21265
21939
  const c1 = l;
21266
- const _2n_pow_c1_1 = _2n << c1 - _1n - _1n;
21267
- const _2n_pow_c1 = _2n_pow_c1_1 * _2n;
21268
- const c2 = (q - _1n) / _2n_pow_c1;
21269
- const c3 = (c2 - _1n) / _2n;
21270
- const c4 = _2n_pow_c1 - _1n;
21940
+ const _2n_pow_c1_1 = _2n2 << c1 - _1n2 - _1n2;
21941
+ const _2n_pow_c1 = _2n_pow_c1_1 * _2n2;
21942
+ const c2 = (q - _1n2) / _2n_pow_c1;
21943
+ const c3 = (c2 - _1n2) / _2n2;
21944
+ const c4 = _2n_pow_c1 - _1n2;
21271
21945
  const c5 = _2n_pow_c1_1;
21272
21946
  const c6 = Fp.pow(Z, c2);
21273
- const c7 = Fp.pow(Z, (c2 + _1n) / _2n);
21947
+ const c7 = Fp.pow(Z, (c2 + _1n2) / _2n2);
21274
21948
  let sqrtRatio = (u, v) => {
21275
21949
  let tv1 = c6;
21276
21950
  let tv2 = Fp.pow(v, c4);
@@ -21288,9 +21962,9 @@ var require_weierstrass = __commonJS({
21288
21962
  tv5 = Fp.mul(tv4, tv1);
21289
21963
  tv3 = Fp.cmov(tv2, tv3, isQR);
21290
21964
  tv4 = Fp.cmov(tv5, tv4, isQR);
21291
- for (let i = c1; i > _1n; i--) {
21292
- let tv52 = i - _2n;
21293
- tv52 = _2n << tv52 - _1n;
21965
+ for (let i = c1; i > _1n2; i--) {
21966
+ let tv52 = i - _2n2;
21967
+ tv52 = _2n2 << tv52 - _1n2;
21294
21968
  let tvv5 = Fp.pow(tv4, tv52);
21295
21969
  const e1 = Fp.eql(tvv5, Fp.ONE);
21296
21970
  tv2 = Fp.mul(tv3, tv1);
@@ -21458,7 +22132,7 @@ var require_weierstrass = __commonJS({
21458
22132
  };
21459
22133
  const defaultSigOpts_format = "compact";
21460
22134
  function isBiggerThanHalfOrder(number) {
21461
- const HALF = CURVE_ORDER >> _1n;
22135
+ const HALF = CURVE_ORDER >> _1n2;
21462
22136
  return number > HALF;
21463
22137
  }
21464
22138
  function validateRS(title, num) {
@@ -21468,8 +22142,8 @@ var require_weierstrass = __commonJS({
21468
22142
  }
21469
22143
  function validateSigLength(bytes, format) {
21470
22144
  validateSigFormat(format);
21471
- const size = lengths.signature;
21472
- const sizer = format === "compact" ? size : format === "recovered" ? size + 1 : void 0;
22145
+ const size2 = lengths.signature;
22146
+ const sizer = format === "compact" ? size2 : format === "recovered" ? size2 + 1 : void 0;
21473
22147
  return (0, utils_ts_1._abytes2)(bytes, sizer, `${format} signature`);
21474
22148
  }
21475
22149
  class Signature {
@@ -21508,7 +22182,7 @@ var require_weierstrass = __commonJS({
21508
22182
  const { r, s, recovery: rec } = this;
21509
22183
  if (rec == null || ![0, 1, 2, 3].includes(rec))
21510
22184
  throw new Error("recovery id invalid");
21511
- const hasCofactor = CURVE_ORDER * _2n < FIELD_ORDER;
22185
+ const hasCofactor = CURVE_ORDER * _2n2 < FIELD_ORDER;
21512
22186
  if (hasCofactor && rec > 1)
21513
22187
  throw new Error("recovery id is ambiguous for h>1 curve");
21514
22188
  const radj = rec === 2 || rec === 3 ? r + CURVE_ORDER : r;
@@ -21583,7 +22257,7 @@ var require_weierstrass = __commonJS({
21583
22257
  };
21584
22258
  const ORDER_MASK = (0, utils_ts_1.bitMask)(fnBits);
21585
22259
  function int2octets(num) {
21586
- (0, utils_ts_1.aInRange)("num < 2^" + fnBits, num, _0n, ORDER_MASK);
22260
+ (0, utils_ts_1.aInRange)("num < 2^" + fnBits, num, _0n2, ORDER_MASK);
21587
22261
  return Fn.toBytes(num);
21588
22262
  }
21589
22263
  function validateMsgAndHash(message, prehash) {
@@ -21611,12 +22285,12 @@ var require_weierstrass = __commonJS({
21611
22285
  const ik = Fn.inv(k);
21612
22286
  const q = Point.BASE.multiply(k).toAffine();
21613
22287
  const r = Fn.create(q.x);
21614
- if (r === _0n)
22288
+ if (r === _0n2)
21615
22289
  return;
21616
22290
  const s = Fn.create(ik * Fn.create(m + r * d));
21617
- if (s === _0n)
22291
+ if (s === _0n2)
21618
22292
  return;
21619
- let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n);
22293
+ let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n2);
21620
22294
  let normS = s;
21621
22295
  if (lowS && isBiggerThanHalfOrder(s)) {
21622
22296
  normS = Fn.neg(s);
@@ -21635,13 +22309,13 @@ var require_weierstrass = __commonJS({
21635
22309
  }
21636
22310
  function tryParsingSig(sg) {
21637
22311
  let sig = void 0;
21638
- const isHex = typeof sg === "string" || (0, utils_ts_1.isBytes)(sg);
21639
- const isObj = !isHex && sg !== null && typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint";
21640
- if (!isHex && !isObj)
22312
+ const isHex2 = typeof sg === "string" || (0, utils_ts_1.isBytes)(sg);
22313
+ const isObj = !isHex2 && sg !== null && typeof sg === "object" && typeof sg.r === "bigint" && typeof sg.s === "bigint";
22314
+ if (!isHex2 && !isObj)
21641
22315
  throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
21642
22316
  if (isObj) {
21643
22317
  sig = new Signature(sg.r, sg.s);
21644
- } else if (isHex) {
22318
+ } else if (isHex2) {
21645
22319
  try {
21646
22320
  sig = Signature.fromBytes((0, utils_ts_1.ensureBytes)("sig", sg), "der");
21647
22321
  } catch (derError) {
@@ -21762,7 +22436,7 @@ var require_weierstrass = __commonJS({
21762
22436
  function _weierstrass_new_output_to_legacy(c, Point) {
21763
22437
  const { Fp, Fn } = Point;
21764
22438
  function isWithinCurveOrder(num) {
21765
- return (0, utils_ts_1.inRange)(num, _1n, Fn.ORDER);
22439
+ return (0, utils_ts_1.inRange)(num, _1n2, Fn.ORDER);
21766
22440
  }
21767
22441
  const weierstrassEquation = _legacyHelperEquat(Fp, c.a, c.b);
21768
22442
  return Object.assign({}, {
@@ -21837,9 +22511,9 @@ var require_secp256k1 = __commonJS({
21837
22511
  [BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
21838
22512
  ]
21839
22513
  };
21840
- var _0n = /* @__PURE__ */ BigInt(0);
21841
- var _1n = /* @__PURE__ */ BigInt(1);
21842
- var _2n = /* @__PURE__ */ BigInt(2);
22514
+ var _0n2 = /* @__PURE__ */ BigInt(0);
22515
+ var _1n2 = /* @__PURE__ */ BigInt(1);
22516
+ var _2n2 = /* @__PURE__ */ BigInt(2);
21843
22517
  function sqrtMod(y) {
21844
22518
  const P = secp256k1_CURVE.p;
21845
22519
  const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);
@@ -21848,7 +22522,7 @@ var require_secp256k1 = __commonJS({
21848
22522
  const b3 = b2 * b2 * y % P;
21849
22523
  const b6 = (0, modular_ts_1.pow2)(b3, _3n, P) * b3 % P;
21850
22524
  const b9 = (0, modular_ts_1.pow2)(b6, _3n, P) * b3 % P;
21851
- const b11 = (0, modular_ts_1.pow2)(b9, _2n, P) * b2 % P;
22525
+ const b11 = (0, modular_ts_1.pow2)(b9, _2n2, P) * b2 % P;
21852
22526
  const b22 = (0, modular_ts_1.pow2)(b11, _11n, P) * b11 % P;
21853
22527
  const b44 = (0, modular_ts_1.pow2)(b22, _22n, P) * b22 % P;
21854
22528
  const b88 = (0, modular_ts_1.pow2)(b44, _44n, P) * b44 % P;
@@ -21857,7 +22531,7 @@ var require_secp256k1 = __commonJS({
21857
22531
  const b223 = (0, modular_ts_1.pow2)(b220, _3n, P) * b3 % P;
21858
22532
  const t1 = (0, modular_ts_1.pow2)(b223, _23n, P) * b22 % P;
21859
22533
  const t2 = (0, modular_ts_1.pow2)(t1, _6n, P) * b2 % P;
21860
- const root = (0, modular_ts_1.pow2)(t2, _2n, P);
22534
+ const root = (0, modular_ts_1.pow2)(t2, _2n2, P);
21861
22535
  if (!Fpk1.eql(Fpk1.sqr(root), y))
21862
22536
  throw new Error("Cannot find square root");
21863
22537
  return root;
@@ -21876,7 +22550,7 @@ var require_secp256k1 = __commonJS({
21876
22550
  }
21877
22551
  var pointToBytes = (point) => point.toBytes(true).slice(1);
21878
22552
  var Pointk1 = /* @__PURE__ */ (() => exports.secp256k1.Point)();
21879
- var hasEven = (y) => y % _2n === _0n;
22553
+ var hasEven = (y) => y % _2n2 === _0n2;
21880
22554
  function schnorrGetExtPubKey(priv) {
21881
22555
  const { Fn, BASE: BASE2 } = Pointk1;
21882
22556
  const d_ = (0, weierstrass_ts_1._normFnElement)(Fn, priv);
@@ -21928,10 +22602,10 @@ var require_secp256k1 = __commonJS({
21928
22602
  try {
21929
22603
  const P = lift_x(num(pub));
21930
22604
  const r = num(sig.subarray(0, 32));
21931
- if (!(0, utils_ts_1.inRange)(r, _1n, secp256k1_CURVE.p))
22605
+ if (!(0, utils_ts_1.inRange)(r, _1n2, secp256k1_CURVE.p))
21932
22606
  return false;
21933
22607
  const s = num(sig.subarray(32, 64));
21934
- if (!(0, utils_ts_1.inRange)(s, _1n, secp256k1_CURVE.n))
22608
+ if (!(0, utils_ts_1.inRange)(s, _1n2, secp256k1_CURVE.n))
21935
22609
  return false;
21936
22610
  const e = challenge(Fn.toBytes(r), pointToBytes(P), m);
21937
22611
  const R = BASE2.multiplyUnsafe(s).add(P.multiplyUnsafe(Fn.neg(e)));
@@ -21944,7 +22618,7 @@ var require_secp256k1 = __commonJS({
21944
22618
  }
21945
22619
  }
21946
22620
  exports.schnorr = (() => {
21947
- const size = 32;
22621
+ const size2 = 32;
21948
22622
  const seedLength = 48;
21949
22623
  const randomSecretKey = (seed = (0, utils_js_1.randomBytes)(seedLength)) => {
21950
22624
  return (0, modular_ts_1.mapHashToField)(seed, secp256k1_CURVE.n);
@@ -21972,10 +22646,10 @@ var require_secp256k1 = __commonJS({
21972
22646
  mod: modular_ts_1.mod
21973
22647
  },
21974
22648
  lengths: {
21975
- secretKey: size,
21976
- publicKey: size,
22649
+ secretKey: size2,
22650
+ publicKey: size2,
21977
22651
  publicKeyHasPrefix: false,
21978
- signature: size * 2,
22652
+ signature: size2 * 2,
21979
22653
  seed: seedLength
21980
22654
  }
21981
22655
  };
@@ -22506,11 +23180,11 @@ var require_index_cjs = __commonJS({
22506
23180
  }
22507
23181
  function decodeLength(bytes) {
22508
23182
  let len = 0;
22509
- let size = 0;
23183
+ let size2 = 0;
22510
23184
  for (; ; ) {
22511
23185
  let elem = bytes.shift();
22512
- len |= (elem & 127) << size * 7;
22513
- size += 1;
23186
+ len |= (elem & 127) << size2 * 7;
23187
+ size2 += 1;
22514
23188
  if ((elem & 128) === 0) {
22515
23189
  break;
22516
23190
  }
@@ -22987,8 +23661,8 @@ var require_index_cjs = __commonJS({
22987
23661
  const prefix = guardedShift(byteArray);
22988
23662
  const maskedPrefix = prefix & VERSION_PREFIX_MASK;
22989
23663
  assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);
22990
- const version3 = maskedPrefix;
22991
- assert(version3 === 0, `Expected versioned message with version 0 but found version ${version3}`);
23664
+ const version4 = maskedPrefix;
23665
+ assert(version4 === 0, `Expected versioned message with version 0 but found version ${version4}`);
22992
23666
  const header = {
22993
23667
  numRequiredSignatures: guardedShift(byteArray),
22994
23668
  numReadonlySignedAccounts: guardedShift(byteArray),
@@ -23047,14 +23721,14 @@ var require_index_cjs = __commonJS({
23047
23721
  return maskedPrefix;
23048
23722
  },
23049
23723
  deserialize: (serializedMessage) => {
23050
- const version3 = VersionedMessage.deserializeMessageVersion(serializedMessage);
23051
- if (version3 === "legacy") {
23724
+ const version4 = VersionedMessage.deserializeMessageVersion(serializedMessage);
23725
+ if (version4 === "legacy") {
23052
23726
  return Message.from(serializedMessage);
23053
23727
  }
23054
- if (version3 === 0) {
23728
+ if (version4 === 0) {
23055
23729
  return MessageV0.deserialize(serializedMessage);
23056
23730
  } else {
23057
- throw new Error(`Transaction message version ${version3} deserialization is not supported`);
23731
+ throw new Error(`Transaction message version ${version4} deserialization is not supported`);
23058
23732
  }
23059
23733
  }
23060
23734
  };
@@ -25789,8 +26463,8 @@ Message: ${transactionMessage}.
25789
26463
  value
25790
26464
  });
25791
26465
  }
25792
- function versionedMessageFromResponse(version3, response) {
25793
- if (version3 === 0) {
26466
+ function versionedMessageFromResponse(version4, response) {
26467
+ if (version4 === 0) {
25794
26468
  return new MessageV0({
25795
26469
  header: response.header,
25796
26470
  staticAccountKeys: response.accountKeys.map((accountKey) => new PublicKey6(accountKey)),
@@ -27734,14 +28408,14 @@ Message: ${transactionMessage}.
27734
28408
  transactions: result.transactions.map(({
27735
28409
  transaction,
27736
28410
  meta,
27737
- version: version3
28411
+ version: version4
27738
28412
  }) => ({
27739
28413
  meta,
27740
28414
  transaction: {
27741
28415
  ...transaction,
27742
- message: versionedMessageFromResponse(version3, transaction.message)
28416
+ message: versionedMessageFromResponse(version4, transaction.message)
27743
28417
  },
27744
- version: version3
28418
+ version: version4
27745
28419
  }))
27746
28420
  } : null;
27747
28421
  }
@@ -31216,20 +31890,20 @@ var require_file_uri_to_path = __commonJS({
31216
31890
  var rest = decodeURI(uri.substring(7));
31217
31891
  var firstSlash = rest.indexOf("/");
31218
31892
  var host = rest.substring(0, firstSlash);
31219
- var path3 = rest.substring(firstSlash + 1);
31893
+ var path6 = rest.substring(firstSlash + 1);
31220
31894
  if ("localhost" == host) host = "";
31221
31895
  if (host) {
31222
31896
  host = sep + sep + host;
31223
31897
  }
31224
- path3 = path3.replace(/^(.+)\|/, "$1:");
31898
+ path6 = path6.replace(/^(.+)\|/, "$1:");
31225
31899
  if (sep == "\\") {
31226
- path3 = path3.replace(/\//g, "\\");
31900
+ path6 = path6.replace(/\//g, "\\");
31227
31901
  }
31228
- if (/^.+\:/.test(path3)) {
31902
+ if (/^.+\:/.test(path6)) {
31229
31903
  } else {
31230
- path3 = sep + path3;
31904
+ path6 = sep + path6;
31231
31905
  }
31232
- return host + path3;
31906
+ return host + path6;
31233
31907
  }
31234
31908
  }
31235
31909
  });
@@ -31237,19 +31911,19 @@ var require_file_uri_to_path = __commonJS({
31237
31911
  // node_modules/bindings/bindings.js
31238
31912
  var require_bindings = __commonJS({
31239
31913
  "node_modules/bindings/bindings.js"(exports, module) {
31240
- var fs4 = __require("fs");
31241
- var path3 = __require("path");
31914
+ var fs6 = __require("fs");
31915
+ var path6 = __require("path");
31242
31916
  var fileURLToPath2 = require_file_uri_to_path();
31243
- var join = path3.join;
31244
- var dirname = path3.dirname;
31245
- var exists = fs4.accessSync && function(path4) {
31917
+ var join = path6.join;
31918
+ var dirname = path6.dirname;
31919
+ var exists = fs6.accessSync && function(path7) {
31246
31920
  try {
31247
- fs4.accessSync(path4);
31921
+ fs6.accessSync(path7);
31248
31922
  } catch (e) {
31249
31923
  return false;
31250
31924
  }
31251
31925
  return true;
31252
- } || fs4.existsSync || path3.existsSync;
31926
+ } || fs6.existsSync || path6.existsSync;
31253
31927
  var defaults = {
31254
31928
  arrow: process.env.NODE_BINDINGS_ARROW || " \u2192 ",
31255
31929
  compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
@@ -31294,7 +31968,7 @@ var require_bindings = __commonJS({
31294
31968
  if (!opts.module_root) {
31295
31969
  opts.module_root = exports.getRoot(exports.getFileName());
31296
31970
  }
31297
- if (path3.extname(opts.bindings) != ".node") {
31971
+ if (path6.extname(opts.bindings) != ".node") {
31298
31972
  opts.bindings += ".node";
31299
31973
  }
31300
31974
  var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
@@ -31675,20 +32349,51 @@ function chainFamily(chainId) {
31675
32349
 
31676
32350
  // scripts/src/lib/keys.mjs
31677
32351
  import fs from "node:fs";
32352
+ import path from "node:path";
31678
32353
  import { execFileSync } from "node:child_process";
31679
- var SOL_KEY_ENV = "ROZO_CHECKOUT_SOL_KEY";
31680
- function readKey(envName) {
31681
- const v = process.env[envName];
31682
- if (!v || !String(v).trim()) {
32354
+ var ENV_FILE_RE = /^\.env(\..+)?$/;
32355
+ var PUBLIC_ENV_RE = /^\.env\.(example|sample|template)$/;
32356
+ function insideGitWorkTree(dir, whatFor) {
32357
+ try {
32358
+ return execFileSync("git", ["rev-parse", "--is-inside-work-tree"], {
32359
+ cwd: dir,
32360
+ stdio: ["ignore", "pipe", "pipe"],
32361
+ encoding: "utf8"
32362
+ }).trim() === "true";
32363
+ } catch (err) {
32364
+ const stderr = String(err?.stderr || "");
32365
+ if (/not a git repository|does not appear to be a git repository/i.test(stderr)) return false;
31683
32366
  throw new SkillError(
31684
- "MISSING_KEY",
31685
- `${envName} is not set. Export it in the shell that runs this script; the script never accepts a key on the command line.`
32367
+ "TRACKED_DOTENV_UNVERIFIABLE",
32368
+ `git could not be consulted (${err?.code || "unknown error"}), so it cannot be proved that ${whatFor} is untracked. Refusing rather than assuming it is safe.`
31686
32369
  );
31687
32370
  }
31688
- return String(v).trim();
31689
32371
  }
31690
- var ENV_FILE_RE = /^\.env(\..+)?$/;
31691
- var PUBLIC_ENV_RE = /^\.env\.(example|sample|template)$/;
32372
+ function assertNotTrackedByGit(file) {
32373
+ const dir = path.dirname(path.resolve(file));
32374
+ const base = path.basename(file);
32375
+ if (!insideGitWorkTree(dir, "this key file")) return { checked: true, tracked: false };
32376
+ let out;
32377
+ try {
32378
+ out = execFileSync("git", ["ls-files", "-z", "--", base], {
32379
+ cwd: dir,
32380
+ stdio: ["ignore", "pipe", "ignore"],
32381
+ encoding: "utf8"
32382
+ });
32383
+ } catch {
32384
+ throw new SkillError(
32385
+ "TRACKED_DOTENV_UNVERIFIABLE",
32386
+ "git could not report whether this key file is tracked. Refusing to use it."
32387
+ );
32388
+ }
32389
+ if (out.split("\0").filter(Boolean).length) {
32390
+ throw new SkillError(
32391
+ "TRACKED_KEYFILE",
32392
+ `${base} is tracked by git. A committed key is one push from being public \u2014 untrack it (git rm --cached ${base}) and gitignore it before using it to sign.`
32393
+ );
32394
+ }
32395
+ return { checked: true, tracked: false };
32396
+ }
31692
32397
  function assertNoTrackedDotEnv(cwd = process.cwd()) {
31693
32398
  let candidates = [];
31694
32399
  try {
@@ -31740,6 +32445,435 @@ function assertNoTrackedDotEnv(cwd = process.cwd()) {
31740
32445
  return { checked: true, tracked: false, candidates };
31741
32446
  }
31742
32447
 
32448
+ // scripts/src/lib/key-source.mjs
32449
+ import fs2 from "node:fs";
32450
+ import path2 from "node:path";
32451
+ import os from "node:os";
32452
+ import crypto2 from "node:crypto";
32453
+
32454
+ // node_modules/viem/_esm/index.js
32455
+ init_keccak256();
32456
+
32457
+ // scripts/src/lib/key-source.mjs
32458
+ var EVM_KEY_ENV = "ROZO_CHECKOUT_EVM_KEY";
32459
+ var SOL_KEY_ENV = "ROZO_CHECKOUT_SOL_KEY";
32460
+ var EVM_KEYSTORE_ENV = "ROZO_CHECKOUT_EVM_KEYSTORE";
32461
+ var KEYSTORE_PASSPHRASE_ENV = "ROZO_CHECKOUT_KEYSTORE_PASSPHRASE";
32462
+ function defaultSolanaKeypairPath() {
32463
+ return path2.join(os.homedir(), ".config", "solana", "id.json");
32464
+ }
32465
+ function assertKeyfileSafe(file) {
32466
+ let stat;
32467
+ try {
32468
+ stat = fs2.statSync(file);
32469
+ } catch (err) {
32470
+ throw new SkillError(
32471
+ "KEYFILE_UNREADABLE",
32472
+ `Cannot read key file (${err.code || "unknown error"}). Check the path.`
32473
+ );
32474
+ }
32475
+ if (!stat.isFile()) {
32476
+ throw new SkillError("KEYFILE_UNREADABLE", "That key file path is not a regular file.");
32477
+ }
32478
+ if (process.platform !== "win32" && stat.mode & 63) {
32479
+ const mode = (stat.mode & 511).toString(8).padStart(3, "0");
32480
+ throw new SkillError(
32481
+ "KEYFILE_PERMISSIONS",
32482
+ `That key file is readable by other users (mode ${mode}). Run: chmod 600 ${file}`
32483
+ );
32484
+ }
32485
+ assertNotTrackedByGit(file);
32486
+ return true;
32487
+ }
32488
+ function parseSolanaKeypairJson(text) {
32489
+ let arr;
32490
+ try {
32491
+ arr = JSON.parse(String(text));
32492
+ } catch {
32493
+ throw new SkillError(
32494
+ "BAD_KEYPAIR_FILE",
32495
+ "That file is not a Solana keypair: expected a JSON array of bytes."
32496
+ );
32497
+ }
32498
+ if (!Array.isArray(arr)) {
32499
+ throw new SkillError("BAD_KEYPAIR_FILE", "A Solana keypair file must contain a JSON array.");
32500
+ }
32501
+ if (arr.length !== 64 && arr.length !== 32) {
32502
+ throw new SkillError(
32503
+ "BAD_KEYPAIR_FILE",
32504
+ `A Solana keypair must be 64 bytes (or a 32-byte seed); this file has ${arr.length}.`
32505
+ );
32506
+ }
32507
+ for (const b of arr) {
32508
+ if (!Number.isInteger(b) || b < 0 || b > 255) {
32509
+ throw new SkillError("BAD_KEYPAIR_FILE", "A Solana keypair must contain byte values 0-255.");
32510
+ }
32511
+ }
32512
+ return Uint8Array.from(arr);
32513
+ }
32514
+ function normalizeEvmPrivateKey(raw) {
32515
+ const s = String(raw ?? "").trim();
32516
+ if (!s) {
32517
+ throw new SkillError("MISSING_KEY", "No EVM private key supplied.");
32518
+ }
32519
+ const body = /^0[xX]/.test(s) ? s.slice(2) : s;
32520
+ if (!/^[0-9a-fA-F]{64}$/.test(body)) {
32521
+ throw new SkillError(
32522
+ "BAD_KEY_FORMAT",
32523
+ `An EVM private key must be 64 hex characters, with or without a 0x prefix (got ${body.length} characters after any prefix). Value withheld.`
32524
+ );
32525
+ }
32526
+ return `0x${body.toLowerCase()}`;
32527
+ }
32528
+ function decodeSolanaEnvKey(raw) {
32529
+ const s = String(raw ?? "").trim();
32530
+ if (!s) throw new SkillError("MISSING_KEY", `${SOL_KEY_ENV} is empty.`);
32531
+ if (s.startsWith("[")) return parseSolanaKeypairJson(s);
32532
+ const bytes = base58Decode(s);
32533
+ if (bytes.length !== 64 && bytes.length !== 32) {
32534
+ throw new SkillError(
32535
+ "BAD_KEY_FORMAT",
32536
+ `${SOL_KEY_ENV} must be a base58 secret key or a JSON byte array.`
32537
+ );
32538
+ }
32539
+ return bytes;
32540
+ }
32541
+ var B58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
32542
+ function base58Decode(str) {
32543
+ let num = 0n;
32544
+ for (const ch of str) {
32545
+ const idx = B58.indexOf(ch);
32546
+ if (idx < 0) throw new SkillError("BAD_KEY_FORMAT", "Not valid base58.");
32547
+ num = num * 58n + BigInt(idx);
32548
+ }
32549
+ const bytes = [];
32550
+ while (num > 0n) {
32551
+ bytes.unshift(Number(num % 256n));
32552
+ num /= 256n;
32553
+ }
32554
+ for (const ch of str) {
32555
+ if (ch === "1") bytes.unshift(0);
32556
+ else break;
32557
+ }
32558
+ return Uint8Array.from(bytes);
32559
+ }
32560
+ function decryptKeystoreV3(keystore, passphrase) {
32561
+ const ks = typeof keystore === "string" ? safeParseJson(keystore) : keystore;
32562
+ if (!ks || typeof ks !== "object" || !ks.crypto) {
32563
+ throw new SkillError(
32564
+ "BAD_KEYSTORE",
32565
+ 'That file is not a V3 keystore (no "crypto" section). Export an encrypted JSON keystore from your wallet, or use a raw key in the environment.'
32566
+ );
32567
+ }
32568
+ if (ks.version !== void 0 && Number(ks.version) !== 3) {
32569
+ throw new SkillError("BAD_KEYSTORE", `Unsupported keystore version ${ks.version}; expected 3.`);
32570
+ }
32571
+ const c = ks.crypto;
32572
+ const kdfparams = c.kdfparams || {};
32573
+ const pass = Buffer.from(String(passphrase ?? ""), "utf8");
32574
+ let derived;
32575
+ if (c.kdf === "scrypt") {
32576
+ const { n, r, p, dklen, salt } = kdfparams;
32577
+ if (!n || !r || !p || !dklen || !salt) {
32578
+ throw new SkillError("BAD_KEYSTORE", "The keystore scrypt parameters are incomplete.");
32579
+ }
32580
+ derived = crypto2.scryptSync(pass, Buffer.from(salt, "hex"), dklen, {
32581
+ N: n,
32582
+ r,
32583
+ p,
32584
+ // geth's default N=262144 needs roughly 256 MB; the Node default cap is
32585
+ // far lower, so raise it with headroom rather than failing on a normal file.
32586
+ maxmem: 256 * n * r + 64 * 1024 * 1024
32587
+ });
32588
+ } else if (c.kdf === "pbkdf2") {
32589
+ const { c: iterations, dklen, salt, prf } = kdfparams;
32590
+ if (prf && prf !== "hmac-sha256") {
32591
+ throw new SkillError("BAD_KEYSTORE", `Unsupported keystore PRF "${prf}".`);
32592
+ }
32593
+ if (!iterations || !dklen || !salt) {
32594
+ throw new SkillError("BAD_KEYSTORE", "The keystore pbkdf2 parameters are incomplete.");
32595
+ }
32596
+ derived = crypto2.pbkdf2Sync(pass, Buffer.from(salt, "hex"), iterations, dklen, "sha256");
32597
+ } else {
32598
+ throw new SkillError("BAD_KEYSTORE", `Unsupported keystore KDF "${c.kdf}".`);
32599
+ }
32600
+ const ciphertext = Buffer.from(c.ciphertext, "hex");
32601
+ const mac = keccak256(Buffer.concat([derived.subarray(16, 32), ciphertext])).slice(2);
32602
+ if (!timingSafeEqualHex(mac, String(c.mac || ""))) {
32603
+ throw new SkillError(
32604
+ "KEYSTORE_BAD_PASSPHRASE",
32605
+ "Wrong passphrase for that keystore (the MAC did not verify)."
32606
+ );
32607
+ }
32608
+ if (c.cipher !== "aes-128-ctr") {
32609
+ throw new SkillError("BAD_KEYSTORE", `Unsupported keystore cipher "${c.cipher}".`);
32610
+ }
32611
+ const decipher = crypto2.createDecipheriv(
32612
+ "aes-128-ctr",
32613
+ derived.subarray(0, 16),
32614
+ Buffer.from(c.cipherparams.iv, "hex")
32615
+ );
32616
+ const secret = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
32617
+ if (secret.length !== 32) {
32618
+ throw new SkillError("BAD_KEYSTORE", "The decrypted key is not 32 bytes.");
32619
+ }
32620
+ return `0x${secret.toString("hex")}`;
32621
+ }
32622
+ function safeParseJson(text) {
32623
+ try {
32624
+ return JSON.parse(text);
32625
+ } catch {
32626
+ throw new SkillError("BAD_KEYSTORE", "That keystore file is not valid JSON.");
32627
+ }
32628
+ }
32629
+ function timingSafeEqualHex(a, b) {
32630
+ const ab = Buffer.from(String(a).toLowerCase(), "hex");
32631
+ const bb = Buffer.from(String(b).toLowerCase(), "hex");
32632
+ if (ab.length === 0 || ab.length !== bb.length) return false;
32633
+ return crypto2.timingSafeEqual(ab, bb);
32634
+ }
32635
+ function looksLikeKeystore(text) {
32636
+ const t = String(text).trimStart();
32637
+ if (!t.startsWith("{")) return false;
32638
+ try {
32639
+ const o = JSON.parse(t);
32640
+ return Boolean(o && typeof o === "object" && o.crypto);
32641
+ } catch {
32642
+ return false;
32643
+ }
32644
+ }
32645
+ function planKeySource({ family, keyfile, env = process.env }) {
32646
+ if (keyfile) {
32647
+ const resolved = expandHome(keyfile);
32648
+ let text;
32649
+ try {
32650
+ text = fs2.readFileSync(resolved, "utf8");
32651
+ } catch (err) {
32652
+ throw new SkillError(
32653
+ "KEYFILE_UNREADABLE",
32654
+ `Cannot read ${displayPath(resolved)} (${err.code || "unknown error"}).`
32655
+ );
32656
+ }
32657
+ const kind = looksLikeKeystore(text) ? "keystore" : "keypair-file";
32658
+ if (kind === "keypair-file" && family === "evm") {
32659
+ throw new SkillError(
32660
+ "BAD_KEYSTORE",
32661
+ "That file is not a V3 keystore. For EVM, --keyfile expects an encrypted JSON keystore."
32662
+ );
32663
+ }
32664
+ if (kind === "keystore" && family === "solana") {
32665
+ throw new SkillError(
32666
+ "BAD_KEYPAIR_FILE",
32667
+ "That looks like an EVM keystore. For Solana, --keyfile expects a solana-keygen keypair file (a JSON array of bytes)."
32668
+ );
32669
+ }
32670
+ return { kind, path: resolved, label: displayPath(resolved) };
32671
+ }
32672
+ if (family === "solana") {
32673
+ const standard = defaultSolanaKeypairPath();
32674
+ if (fs2.existsSync(standard)) {
32675
+ return { kind: "keypair-file", path: standard, label: displayPath(standard) };
32676
+ }
32677
+ if (env[SOL_KEY_ENV]) return { kind: "env", label: SOL_KEY_ENV };
32678
+ throw new SkillError(
32679
+ "NO_KEY_SOURCE",
32680
+ `No signing key found. Either create one with solana-keygen (writes ${displayPath(standard)}), pass --keyfile <path>, or set ${SOL_KEY_ENV}.`
32681
+ );
32682
+ }
32683
+ if (family === "evm") {
32684
+ const fromEnv = env[EVM_KEYSTORE_ENV];
32685
+ if (fromEnv) {
32686
+ const resolved = expandHome(fromEnv);
32687
+ return { kind: "keystore", path: resolved, label: displayPath(resolved) };
32688
+ }
32689
+ if (env[EVM_KEY_ENV]) return { kind: "env", label: EVM_KEY_ENV };
32690
+ throw new SkillError(
32691
+ "NO_KEY_SOURCE",
32692
+ `No signing key found. Either point ${EVM_KEYSTORE_ENV} at an encrypted JSON keystore, pass --keyfile <path>, or set ${EVM_KEY_ENV}.`
32693
+ );
32694
+ }
32695
+ throw new SkillError("NO_KEY_SOURCE", `No key source for family "${family}".`);
32696
+ }
32697
+ async function loadKeySource(plan, { family, env = process.env, askPassphrase } = {}) {
32698
+ if (plan.kind === "env") {
32699
+ const name = family === "evm" ? EVM_KEY_ENV : SOL_KEY_ENV;
32700
+ const raw = env[name];
32701
+ if (!raw || !String(raw).trim()) {
32702
+ throw new SkillError("MISSING_KEY", `${name} is not set.`);
32703
+ }
32704
+ if (family === "evm") {
32705
+ return { privateKey: normalizeEvmPrivateKey(raw), label: plan.label, kind: plan.kind };
32706
+ }
32707
+ return { secretKey: decodeSolanaEnvKey(raw), label: plan.label, kind: plan.kind };
32708
+ }
32709
+ assertKeyfileSafe(plan.path);
32710
+ const text = fs2.readFileSync(plan.path, "utf8");
32711
+ if (plan.kind === "keypair-file") {
32712
+ return { secretKey: parseSolanaKeypairJson(text), label: plan.label, kind: plan.kind };
32713
+ }
32714
+ let passphrase = env[KEYSTORE_PASSPHRASE_ENV];
32715
+ if (passphrase === void 0 || passphrase === "") {
32716
+ if (!askPassphrase) {
32717
+ throw new SkillError(
32718
+ "KEYSTORE_PASSPHRASE_REQUIRED",
32719
+ `That keystore needs a passphrase. Run this on a terminal to be prompted, or set ${KEYSTORE_PASSPHRASE_ENV} for unattended use.`
32720
+ );
32721
+ }
32722
+ passphrase = await askPassphrase();
32723
+ }
32724
+ const privateKey = decryptKeystoreV3(text, passphrase);
32725
+ return { privateKey, label: plan.label, kind: plan.kind };
32726
+ }
32727
+ function expandHome(p) {
32728
+ const s = String(p);
32729
+ if (s === "~") return os.homedir();
32730
+ if (s.startsWith("~/")) return path2.join(os.homedir(), s.slice(2));
32731
+ return s;
32732
+ }
32733
+ function displayPath(p) {
32734
+ const home = os.homedir();
32735
+ const s = String(p);
32736
+ return s.startsWith(home + path2.sep) ? `~${s.slice(home.length)}` : s;
32737
+ }
32738
+
32739
+ // scripts/src/lib/dotenv.mjs
32740
+ import fs3 from "node:fs";
32741
+ import path3 from "node:path";
32742
+ var ALLOWED_KEYS = [
32743
+ "ROZO_CHECKOUT_EVM_KEY",
32744
+ "ROZO_CHECKOUT_SOL_KEY",
32745
+ "ROZO_CHECKOUT_EVM_KEYSTORE",
32746
+ "ROZO_CHECKOUT_KEYSTORE_PASSPHRASE"
32747
+ ];
32748
+ var ALLOWED_PATTERN = /^ROZO_CHECKOUT_RPC_[A-Za-z0-9_]+$/;
32749
+ function isAllowedKey(key) {
32750
+ return ALLOWED_KEYS.includes(key) || ALLOWED_PATTERN.test(key);
32751
+ }
32752
+ function parseDotenv(text) {
32753
+ const vars = {};
32754
+ const lines = String(text).split(/\r?\n/);
32755
+ lines.forEach((rawLine, i) => {
32756
+ const lineNo = i + 1;
32757
+ const line = rawLine.trim();
32758
+ if (!line || line.startsWith("#")) return;
32759
+ const withoutExport = line.startsWith("export ") ? line.slice(7).trim() : line;
32760
+ const eq = withoutExport.indexOf("=");
32761
+ if (eq === -1) {
32762
+ throw new SkillError(
32763
+ "BAD_ENV_FILE",
32764
+ `Malformed .env: line ${lineNo} is not KEY=VALUE. (Content withheld \u2014 it may be a secret.)`
32765
+ );
32766
+ }
32767
+ const key = withoutExport.slice(0, eq).trim();
32768
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
32769
+ throw new SkillError(
32770
+ "BAD_ENV_FILE",
32771
+ `Malformed .env: line ${lineNo} has an invalid key name. (Content withheld.)`
32772
+ );
32773
+ }
32774
+ let value = withoutExport.slice(eq + 1).trim();
32775
+ if (value.length >= 2 && (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'"))) {
32776
+ value = value.slice(1, -1);
32777
+ }
32778
+ vars[key] = value;
32779
+ });
32780
+ return vars;
32781
+ }
32782
+ function filterAllowed(vars) {
32783
+ const out = {};
32784
+ for (const [k, v] of Object.entries(vars)) if (isAllowedKey(k)) out[k] = v;
32785
+ return out;
32786
+ }
32787
+ function resolveEnvFile({ file, cwd = process.cwd() } = {}) {
32788
+ if (file) {
32789
+ const p = path3.resolve(file);
32790
+ if (!fs3.existsSync(p)) {
32791
+ throw new SkillError("ENV_FILE_MISSING", `No such env file: ${file}`);
32792
+ }
32793
+ return p;
32794
+ }
32795
+ const fallback = path3.join(cwd, ".env");
32796
+ return fs3.existsSync(fallback) ? fallback : null;
32797
+ }
32798
+ function applyDotenv({ file, cwd = process.cwd(), env = process.env } = {}) {
32799
+ const target = resolveEnvFile({ file, cwd });
32800
+ if (!target) return null;
32801
+ let stat;
32802
+ try {
32803
+ stat = fs3.statSync(target);
32804
+ } catch (err) {
32805
+ throw new SkillError("ENV_FILE_MISSING", `Cannot read env file (${err.code || "error"}).`);
32806
+ }
32807
+ if (process.platform !== "win32" && stat.mode & 63) {
32808
+ const mode = (stat.mode & 511).toString(8).padStart(3, "0");
32809
+ throw new SkillError(
32810
+ "ENV_FILE_PERMISSIONS",
32811
+ `That .env is readable by other users (mode ${mode}). Run: chmod 600 ${target}`
32812
+ );
32813
+ }
32814
+ assertNotTrackedByGit(target);
32815
+ const parsed = parseDotenv(fs3.readFileSync(target, "utf8"));
32816
+ const allowed = filterAllowed(parsed);
32817
+ const applied = [];
32818
+ for (const [k, v] of Object.entries(allowed)) {
32819
+ const existing = env[k];
32820
+ if (existing !== void 0 && String(existing).trim() !== "") continue;
32821
+ env[k] = v;
32822
+ applied.push(k);
32823
+ }
32824
+ return {
32825
+ path: target,
32826
+ applied,
32827
+ ignored: Object.keys(parsed).length - Object.keys(allowed).length
32828
+ };
32829
+ }
32830
+
32831
+ // scripts/src/lib/passphrase.mjs
32832
+ import readline from "node:readline";
32833
+ function promptPassphrase(prompt = " Keystore passphrase: ") {
32834
+ if (!process.stdin.isTTY) {
32835
+ throw new SkillError(
32836
+ "KEYSTORE_PASSPHRASE_REQUIRED",
32837
+ "A keystore passphrase is needed but this is not a terminal. Set ROZO_CHECKOUT_KEYSTORE_PASSPHRASE for unattended use."
32838
+ );
32839
+ }
32840
+ return new Promise((resolve, reject) => {
32841
+ const rl = readline.createInterface({
32842
+ input: process.stdin,
32843
+ output: process.stdout,
32844
+ terminal: true
32845
+ });
32846
+ let muted = false;
32847
+ const originalWrite = rl._writeToOutput?.bind(rl);
32848
+ rl._writeToOutput = (chunk) => {
32849
+ if (!muted) {
32850
+ if (originalWrite) originalWrite(chunk);
32851
+ else process.stdout.write(chunk);
32852
+ return;
32853
+ }
32854
+ if (chunk.includes(prompt)) process.stdout.write(prompt);
32855
+ };
32856
+ rl.question(prompt, (answer) => {
32857
+ rl._writeToOutput = originalWrite;
32858
+ rl.close();
32859
+ process.stdout.write("\n");
32860
+ const value = String(answer ?? "");
32861
+ if (!value) {
32862
+ reject(new SkillError("KEYSTORE_PASSPHRASE_REQUIRED", "No passphrase entered."));
32863
+ return;
32864
+ }
32865
+ resolve(value);
32866
+ });
32867
+ muted = true;
32868
+ rl.on("SIGINT", () => {
32869
+ rl._writeToOutput = originalWrite;
32870
+ rl.close();
32871
+ process.stdout.write("\n");
32872
+ reject(new SkillError("CANCELLED", "Cancelled."));
32873
+ });
32874
+ });
32875
+ }
32876
+
31743
32877
  // scripts/src/lib/http.mjs
31744
32878
  var DEFAULT_TIMEOUT_MS = 2e4;
31745
32879
  var USER_AGENT = "rozo-checkout-skill/1.0";
@@ -32132,9 +33266,9 @@ function checkExpiry({
32132
33266
  }
32133
33267
 
32134
33268
  // scripts/src/lib/blacklist.mjs
32135
- import fs2 from "node:fs";
32136
- import path from "node:path";
32137
- import crypto2 from "node:crypto";
33269
+ import fs4 from "node:fs";
33270
+ import path4 from "node:path";
33271
+ import crypto3 from "node:crypto";
32138
33272
  import { fileURLToPath } from "node:url";
32139
33273
  var BlacklistError = class extends Error {
32140
33274
  constructor(code, message) {
@@ -32169,7 +33303,7 @@ function parseBlacklist(doc) {
32169
33303
  }
32170
33304
  addresses.push(e.address);
32171
33305
  }
32172
- const digest = crypto2.createHash("sha256").update(JSON.stringify(addresses), "utf8").digest("hex");
33306
+ const digest = crypto3.createHash("sha256").update(JSON.stringify(addresses), "utf8").digest("hex");
32173
33307
  if (typeof provenance.addressesSha256 !== "string" || !provenance.addressesSha256) {
32174
33308
  throw new BlacklistError("BLACKLIST_UNAVAILABLE", "Blacklist provenance digest is missing.");
32175
33309
  }
@@ -32192,11 +33326,11 @@ function parseBlacklist(doc) {
32192
33326
  return { entries, index, provenance, digest };
32193
33327
  }
32194
33328
  function candidatePaths(moduleUrl) {
32195
- const here = path.dirname(fileURLToPath(moduleUrl));
33329
+ const here = path4.dirname(fileURLToPath(moduleUrl));
32196
33330
  return [
32197
- path.join(here, "blacklist.json"),
32198
- path.join(here, "..", "src", "lib", "blacklist.json"),
32199
- path.join(here, "..", "..", "src", "lib", "blacklist.json")
33331
+ path4.join(here, "blacklist.json"),
33332
+ path4.join(here, "..", "src", "lib", "blacklist.json"),
33333
+ path4.join(here, "..", "..", "src", "lib", "blacklist.json")
32200
33334
  ];
32201
33335
  }
32202
33336
  var cached = null;
@@ -32207,7 +33341,7 @@ function loadBlacklist(explicitPath) {
32207
33341
  for (const p of paths) {
32208
33342
  let raw;
32209
33343
  try {
32210
- raw = fs2.readFileSync(p, "utf8");
33344
+ raw = fs4.readFileSync(p, "utf8");
32211
33345
  } catch (err) {
32212
33346
  lastErr = err;
32213
33347
  continue;
@@ -32255,24 +33389,24 @@ function assertNotBlacklisted(targets, blacklist) {
32255
33389
  }
32256
33390
 
32257
33391
  // scripts/src/lib/state.mjs
32258
- import fs3 from "node:fs";
32259
- import path2 from "node:path";
32260
- import os from "node:os";
32261
- import crypto3 from "node:crypto";
33392
+ import fs5 from "node:fs";
33393
+ import path5 from "node:path";
33394
+ import os2 from "node:os";
33395
+ import crypto4 from "node:crypto";
32262
33396
  var LOCK_STALE_MS = 6e4;
32263
33397
  var LOCK_WAIT_MS = 1e4;
32264
33398
  var LOCK_POLL_MS = 25;
32265
33399
  function lockPath() {
32266
- return path2.join(stateRoot(), ".send.lock");
33400
+ return path5.join(stateRoot(), ".send.lock");
32267
33401
  }
32268
33402
  function sleepSync(ms) {
32269
33403
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
32270
33404
  }
32271
33405
  function tryAcquire(file) {
32272
33406
  try {
32273
- const fd = fs3.openSync(file, "wx", 384);
32274
- fs3.writeFileSync(fd, JSON.stringify({ pid: process.pid, at: (/* @__PURE__ */ new Date()).toISOString() }));
32275
- fs3.closeSync(fd);
33407
+ const fd = fs5.openSync(file, "wx", 384);
33408
+ fs5.writeFileSync(fd, JSON.stringify({ pid: process.pid, at: (/* @__PURE__ */ new Date()).toISOString() }));
33409
+ fs5.closeSync(fd);
32276
33410
  return true;
32277
33411
  } catch (err) {
32278
33412
  if (err.code !== "EEXIST") throw err;
@@ -32281,17 +33415,17 @@ function tryAcquire(file) {
32281
33415
  }
32282
33416
  function withLock(fn) {
32283
33417
  const file = lockPath();
32284
- fs3.mkdirSync(path2.dirname(file), { recursive: true, mode: 448 });
33418
+ fs5.mkdirSync(path5.dirname(file), { recursive: true, mode: 448 });
32285
33419
  const deadline = Date.now() + LOCK_WAIT_MS;
32286
33420
  for (; ; ) {
32287
33421
  if (tryAcquire(file)) break;
32288
33422
  try {
32289
- const age = Date.now() - fs3.statSync(file).mtimeMs;
33423
+ const age = Date.now() - fs5.statSync(file).mtimeMs;
32290
33424
  if (age > LOCK_STALE_MS) {
32291
- const stolen = `${file}.stale.${crypto3.randomBytes(4).toString("hex")}`;
33425
+ const stolen = `${file}.stale.${crypto4.randomBytes(4).toString("hex")}`;
32292
33426
  try {
32293
- fs3.renameSync(file, stolen);
32294
- fs3.unlinkSync(stolen);
33427
+ fs5.renameSync(file, stolen);
33428
+ fs5.unlinkSync(stolen);
32295
33429
  } catch {
32296
33430
  }
32297
33431
  continue;
@@ -32312,38 +33446,38 @@ function withLock(fn) {
32312
33446
  return fn();
32313
33447
  } finally {
32314
33448
  try {
32315
- fs3.unlinkSync(file);
33449
+ fs5.unlinkSync(file);
32316
33450
  } catch {
32317
33451
  }
32318
33452
  }
32319
33453
  }
32320
33454
  function stateRoot() {
32321
- return process.env.ROZO_CHECKOUT_STATE_DIR || path2.join(os.homedir(), ".rozo-checkout", "state");
33455
+ return process.env.ROZO_CHECKOUT_STATE_DIR || path5.join(os2.homedir(), ".rozo-checkout", "state");
32322
33456
  }
32323
33457
  function statePath(rozoPaymentId) {
32324
33458
  if (!/^[A-Za-z0-9-]{8,64}$/.test(String(rozoPaymentId || ""))) {
32325
33459
  throw new SkillError("BAD_ROZO_PAYMENT_ID", "Refusing to build a state path from that id.");
32326
33460
  }
32327
- return path2.join(stateRoot(), `${rozoPaymentId}.json`);
33461
+ return path5.join(stateRoot(), `${rozoPaymentId}.json`);
32328
33462
  }
32329
33463
  function writeAtomic(file, data) {
32330
- const dir = path2.dirname(file);
32331
- fs3.mkdirSync(dir, { recursive: true, mode: 448 });
32332
- const tmp = path2.join(dir, `.${path2.basename(file)}.${crypto3.randomBytes(6).toString("hex")}.tmp`);
32333
- const fd = fs3.openSync(tmp, "wx", 384);
33464
+ const dir = path5.dirname(file);
33465
+ fs5.mkdirSync(dir, { recursive: true, mode: 448 });
33466
+ const tmp = path5.join(dir, `.${path5.basename(file)}.${crypto4.randomBytes(6).toString("hex")}.tmp`);
33467
+ const fd = fs5.openSync(tmp, "wx", 384);
32334
33468
  try {
32335
- fs3.writeFileSync(fd, JSON.stringify(data, null, 2) + "\n", "utf8");
32336
- fs3.fsyncSync(fd);
33469
+ fs5.writeFileSync(fd, JSON.stringify(data, null, 2) + "\n", "utf8");
33470
+ fs5.fsyncSync(fd);
32337
33471
  } finally {
32338
- fs3.closeSync(fd);
33472
+ fs5.closeSync(fd);
32339
33473
  }
32340
- fs3.renameSync(tmp, file);
33474
+ fs5.renameSync(tmp, file);
32341
33475
  }
32342
33476
  function readState(rozoPaymentId) {
32343
33477
  const file = statePath(rozoPaymentId);
32344
33478
  let raw;
32345
33479
  try {
32346
- raw = fs3.readFileSync(file, "utf8");
33480
+ raw = fs5.readFileSync(file, "utf8");
32347
33481
  } catch (err) {
32348
33482
  if (err.code === "ENOENT") return null;
32349
33483
  throw new SkillError("STATE_UNREADABLE", `Cannot read local state: ${err.code}`);
@@ -32368,7 +33502,7 @@ function depositDigest(source) {
32368
33502
  amountUnit: source?.amountUnit ?? null,
32369
33503
  lnInvoice: source?.lnInvoice ?? null
32370
33504
  });
32371
- return crypto3.createHash("sha256").update(canonical, "utf8").digest("hex");
33505
+ return crypto4.createHash("sha256").update(canonical, "utf8").digest("hex");
32372
33506
  }
32373
33507
  function claimSend(rozoPaymentId, intent, { skipCaps = false } = {}) {
32374
33508
  return withLock(() => {
@@ -34331,59 +35465,18 @@ async function getAssociatedTokenAddress(mint, owner, allowOwnerOffCurve = false
34331
35465
  // scripts/src/send-sol.mjs
34332
35466
  var MEMO_PROGRAM_ID = new import_web36.PublicKey("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");
34333
35467
  var MAINNET_GENESIS = "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d";
34334
- function decodeSecretKey(raw) {
34335
- const s = raw.trim();
34336
- if (s.startsWith("[")) {
34337
- let arr;
34338
- try {
34339
- arr = JSON.parse(s);
34340
- } catch {
34341
- throw new SkillError("BAD_KEY_FORMAT", `${SOL_KEY_ENV} looks like a JSON array but is malformed.`);
34342
- }
34343
- if (!Array.isArray(arr) || arr.length !== 64 && arr.length !== 32) {
34344
- throw new SkillError("BAD_KEY_FORMAT", `${SOL_KEY_ENV} array must be 32 or 64 bytes.`);
34345
- }
34346
- return Uint8Array.from(arr);
34347
- }
34348
- try {
34349
- const bytes = base58Decode(s);
34350
- if (bytes.length !== 64 && bytes.length !== 32) {
34351
- throw new Error("unexpected length");
34352
- }
34353
- return bytes;
34354
- } catch {
34355
- throw new SkillError(
34356
- "BAD_KEY_FORMAT",
34357
- `${SOL_KEY_ENV} must be a base58 secret key or a JSON byte array.`
34358
- );
34359
- }
34360
- }
34361
35468
  var B58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
34362
- function base58Decode(str) {
34363
- let num = 0n;
34364
- for (const ch of str) {
34365
- const idx = B58_ALPHABET.indexOf(ch);
34366
- if (idx < 0) throw new Error("bad base58");
34367
- num = num * 58n + BigInt(idx);
34368
- }
34369
- const bytes = [];
34370
- while (num > 0n) {
34371
- bytes.unshift(Number(num % 256n));
34372
- num /= 256n;
34373
- }
34374
- for (const ch of str) {
34375
- if (ch === "1") bytes.unshift(0);
34376
- else break;
34377
- }
34378
- return Uint8Array.from(bytes);
34379
- }
34380
35469
  async function main(argv) {
34381
35470
  const args = parseArgs(argv);
34382
35471
  const rozoPaymentId = assertRozoPaymentId(args["rozo-payment-id"] || args._[0]);
34383
35472
  assertNoTrackedDotEnv();
34384
- const secret = decodeSecretKey(readKey(SOL_KEY_ENV));
35473
+ const dotenv = applyDotenv({ file: args["env-file"] });
35474
+ const plan = planKeySource({ family: "solana", keyfile: args.keyfile });
35475
+ const loaded = await loadKeySource(plan, { family: "solana", askPassphrase: promptPassphrase });
35476
+ const secret = loaded.secretKey;
34385
35477
  const keypair = secret.length === 64 ? import_web36.Keypair.fromSecretKey(secret) : import_web36.Keypair.fromSeed(secret);
34386
35478
  const sender = keypair.publicKey.toBase58();
35479
+ const keySource = loaded.label;
34387
35480
  const dryRun = Boolean(args["dry-run"]);
34388
35481
  const { source, state, expiry, amountAtomic, payment } = await preflight({
34389
35482
  rozoPaymentId,
@@ -34483,6 +35576,9 @@ async function main(argv) {
34483
35576
  withMemo: Boolean(source.receiverMemo)
34484
35577
  },
34485
35578
  confirmedAt: state.confirmation?.confirmedAt ?? null,
35579
+ keySource,
35580
+ // Key NAMES only — a value from a .env is never echoed.
35581
+ envFile: dotenv ? { path: dotenv.path, applied: dotenv.applied } : null,
34486
35582
  minutesOfSlack: Math.floor(expiry.msOfSlack / 6e4),
34487
35583
  note: "Nothing was signed or broadcast. Add --send (without --dry-run) to execute."
34488
35584
  });
@@ -34638,7 +35734,8 @@ async function main(argv) {
34638
35734
  amount: source.amount,
34639
35735
  toMasked: maskAddress(source.receiverAddress),
34640
35736
  fromMasked: maskAddress(sender),
34641
- withMemo: Boolean(source.receiverMemo)
35737
+ withMemo: Boolean(source.receiverMemo),
35738
+ keySource
34642
35739
  },
34643
35740
  nextStep: `status.js --rozo-payment-id ${rozoPaymentId} --watch`,
34644
35741
  guidance: "On-chain confirmation is not settlement. Poll status.js until the state is `settled`."