@metamask/connect-multichain 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/dist/browser/es/connect-multichain.mjs +48 -40
  3. package/dist/browser/es/connect-multichain.mjs.map +1 -1
  4. package/dist/browser/es/metafile-esm.json +1 -1
  5. package/dist/browser/iife/connect-multichain.js +1887 -91
  6. package/dist/browser/iife/connect-multichain.js.map +1 -1
  7. package/dist/browser/iife/metafile-iife.json +1 -1
  8. package/dist/browser/umd/connect-multichain.js +48 -40
  9. package/dist/browser/umd/connect-multichain.js.map +1 -1
  10. package/dist/browser/umd/metafile-cjs.json +1 -1
  11. package/dist/node/cjs/connect-multichain.js +41 -40
  12. package/dist/node/cjs/connect-multichain.js.map +1 -1
  13. package/dist/node/cjs/metafile-cjs.json +1 -1
  14. package/dist/node/es/connect-multichain.mjs +41 -40
  15. package/dist/node/es/connect-multichain.mjs.map +1 -1
  16. package/dist/node/es/metafile-esm.json +1 -1
  17. package/dist/react-native/es/connect-multichain.mjs +48 -40
  18. package/dist/react-native/es/connect-multichain.mjs.map +1 -1
  19. package/dist/react-native/es/metafile-esm.json +1 -1
  20. package/dist/src/index.browser.d.ts +1 -0
  21. package/dist/src/index.browser.d.ts.map +1 -1
  22. package/dist/src/index.browser.js +4 -2
  23. package/dist/src/index.browser.js.map +1 -1
  24. package/dist/src/index.native.d.ts +1 -0
  25. package/dist/src/index.native.d.ts.map +1 -1
  26. package/dist/src/index.native.js +4 -2
  27. package/dist/src/index.native.js.map +1 -1
  28. package/dist/src/index.node.js +2 -2
  29. package/dist/src/index.node.js.map +1 -1
  30. package/dist/src/multichain/index.d.ts +2 -2
  31. package/dist/src/multichain/index.d.ts.map +1 -1
  32. package/dist/src/multichain/index.js +82 -80
  33. package/dist/src/multichain/index.js.map +1 -1
  34. package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts +3 -3
  35. package/dist/src/multichain/transports/multichainApiClientWrapper/index.d.ts.map +1 -1
  36. package/dist/src/multichain/transports/multichainApiClientWrapper/index.js +10 -10
  37. package/dist/src/multichain/transports/multichainApiClientWrapper/index.js.map +1 -1
  38. package/dist/src/polyfills/buffer-shim.d.ts +2 -0
  39. package/dist/src/polyfills/buffer-shim.d.ts.map +1 -0
  40. package/dist/src/polyfills/buffer-shim.js +22 -0
  41. package/dist/src/polyfills/buffer-shim.js.map +1 -0
  42. package/package.json +6 -2
@@ -132,6 +132,1783 @@ var MetaMaskSDK = (() => {
132
132
  }, "return" in obj && method("return"), it;
133
133
  };
134
134
 
135
+ // ../../node_modules/base64-js/index.js
136
+ var require_base64_js = __commonJS({
137
+ "../../node_modules/base64-js/index.js"(exports) {
138
+ "use strict";
139
+ exports.byteLength = byteLength;
140
+ exports.toByteArray = toByteArray;
141
+ exports.fromByteArray = fromByteArray;
142
+ var lookup = [];
143
+ var revLookup = [];
144
+ var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
145
+ var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
146
+ for (i = 0, len = code.length; i < len; ++i) {
147
+ lookup[i] = code[i];
148
+ revLookup[code.charCodeAt(i)] = i;
149
+ }
150
+ var i;
151
+ var len;
152
+ revLookup["-".charCodeAt(0)] = 62;
153
+ revLookup["_".charCodeAt(0)] = 63;
154
+ function getLens(b64) {
155
+ var len2 = b64.length;
156
+ if (len2 % 4 > 0) {
157
+ throw new Error("Invalid string. Length must be a multiple of 4");
158
+ }
159
+ var validLen = b64.indexOf("=");
160
+ if (validLen === -1) validLen = len2;
161
+ var placeHoldersLen = validLen === len2 ? 0 : 4 - validLen % 4;
162
+ return [validLen, placeHoldersLen];
163
+ }
164
+ function byteLength(b64) {
165
+ var lens = getLens(b64);
166
+ var validLen = lens[0];
167
+ var placeHoldersLen = lens[1];
168
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
169
+ }
170
+ function _byteLength(b64, validLen, placeHoldersLen) {
171
+ return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
172
+ }
173
+ function toByteArray(b64) {
174
+ var tmp;
175
+ var lens = getLens(b64);
176
+ var validLen = lens[0];
177
+ var placeHoldersLen = lens[1];
178
+ var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));
179
+ var curByte = 0;
180
+ var len2 = placeHoldersLen > 0 ? validLen - 4 : validLen;
181
+ var i2;
182
+ for (i2 = 0; i2 < len2; i2 += 4) {
183
+ tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)];
184
+ arr[curByte++] = tmp >> 16 & 255;
185
+ arr[curByte++] = tmp >> 8 & 255;
186
+ arr[curByte++] = tmp & 255;
187
+ }
188
+ if (placeHoldersLen === 2) {
189
+ tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4;
190
+ arr[curByte++] = tmp & 255;
191
+ }
192
+ if (placeHoldersLen === 1) {
193
+ tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2;
194
+ arr[curByte++] = tmp >> 8 & 255;
195
+ arr[curByte++] = tmp & 255;
196
+ }
197
+ return arr;
198
+ }
199
+ function tripletToBase64(num) {
200
+ return lookup[num >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[num & 63];
201
+ }
202
+ function encodeChunk(uint8, start, end) {
203
+ var tmp;
204
+ var output = [];
205
+ for (var i2 = start; i2 < end; i2 += 3) {
206
+ tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255);
207
+ output.push(tripletToBase64(tmp));
208
+ }
209
+ return output.join("");
210
+ }
211
+ function fromByteArray(uint8) {
212
+ var tmp;
213
+ var len2 = uint8.length;
214
+ var extraBytes = len2 % 3;
215
+ var parts = [];
216
+ var maxChunkLength = 16383;
217
+ for (var i2 = 0, len22 = len2 - extraBytes; i2 < len22; i2 += maxChunkLength) {
218
+ parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len22 ? len22 : i2 + maxChunkLength));
219
+ }
220
+ if (extraBytes === 1) {
221
+ tmp = uint8[len2 - 1];
222
+ parts.push(
223
+ lookup[tmp >> 2] + lookup[tmp << 4 & 63] + "=="
224
+ );
225
+ } else if (extraBytes === 2) {
226
+ tmp = (uint8[len2 - 2] << 8) + uint8[len2 - 1];
227
+ parts.push(
228
+ lookup[tmp >> 10] + lookup[tmp >> 4 & 63] + lookup[tmp << 2 & 63] + "="
229
+ );
230
+ }
231
+ return parts.join("");
232
+ }
233
+ }
234
+ });
235
+
236
+ // ../../node_modules/ieee754/index.js
237
+ var require_ieee754 = __commonJS({
238
+ "../../node_modules/ieee754/index.js"(exports) {
239
+ "use strict";
240
+ exports.read = function(buffer, offset, isLE2, mLen, nBytes) {
241
+ var e, m;
242
+ var eLen = nBytes * 8 - mLen - 1;
243
+ var eMax = (1 << eLen) - 1;
244
+ var eBias = eMax >> 1;
245
+ var nBits = -7;
246
+ var i = isLE2 ? nBytes - 1 : 0;
247
+ var d = isLE2 ? -1 : 1;
248
+ var s = buffer[offset + i];
249
+ i += d;
250
+ e = s & (1 << -nBits) - 1;
251
+ s >>= -nBits;
252
+ nBits += eLen;
253
+ for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {
254
+ }
255
+ m = e & (1 << -nBits) - 1;
256
+ e >>= -nBits;
257
+ nBits += mLen;
258
+ for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {
259
+ }
260
+ if (e === 0) {
261
+ e = 1 - eBias;
262
+ } else if (e === eMax) {
263
+ return m ? NaN : (s ? -1 : 1) * Infinity;
264
+ } else {
265
+ m = m + Math.pow(2, mLen);
266
+ e = e - eBias;
267
+ }
268
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen);
269
+ };
270
+ exports.write = function(buffer, value, offset, isLE2, mLen, nBytes) {
271
+ var e, m, c;
272
+ var eLen = nBytes * 8 - mLen - 1;
273
+ var eMax = (1 << eLen) - 1;
274
+ var eBias = eMax >> 1;
275
+ var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
276
+ var i = isLE2 ? 0 : nBytes - 1;
277
+ var d = isLE2 ? 1 : -1;
278
+ var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
279
+ value = Math.abs(value);
280
+ if (isNaN(value) || value === Infinity) {
281
+ m = isNaN(value) ? 1 : 0;
282
+ e = eMax;
283
+ } else {
284
+ e = Math.floor(Math.log(value) / Math.LN2);
285
+ if (value * (c = Math.pow(2, -e)) < 1) {
286
+ e--;
287
+ c *= 2;
288
+ }
289
+ if (e + eBias >= 1) {
290
+ value += rt / c;
291
+ } else {
292
+ value += rt * Math.pow(2, 1 - eBias);
293
+ }
294
+ if (value * c >= 2) {
295
+ e++;
296
+ c /= 2;
297
+ }
298
+ if (e + eBias >= eMax) {
299
+ m = 0;
300
+ e = eMax;
301
+ } else if (e + eBias >= 1) {
302
+ m = (value * c - 1) * Math.pow(2, mLen);
303
+ e = e + eBias;
304
+ } else {
305
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen);
306
+ e = 0;
307
+ }
308
+ }
309
+ for (; mLen >= 8; buffer[offset + i] = m & 255, i += d, m /= 256, mLen -= 8) {
310
+ }
311
+ e = e << mLen | m;
312
+ eLen += mLen;
313
+ for (; eLen > 0; buffer[offset + i] = e & 255, i += d, e /= 256, eLen -= 8) {
314
+ }
315
+ buffer[offset + i - d] |= s * 128;
316
+ };
317
+ }
318
+ });
319
+
320
+ // ../../node_modules/buffer/index.js
321
+ var require_buffer = __commonJS({
322
+ "../../node_modules/buffer/index.js"(exports) {
323
+ "use strict";
324
+ var base642 = require_base64_js();
325
+ var ieee754 = require_ieee754();
326
+ var customInspectSymbol = typeof Symbol === "function" && typeof Symbol["for"] === "function" ? Symbol["for"]("nodejs.util.inspect.custom") : null;
327
+ exports.Buffer = Buffer3;
328
+ exports.SlowBuffer = SlowBuffer;
329
+ exports.INSPECT_MAX_BYTES = 50;
330
+ var K_MAX_LENGTH = 2147483647;
331
+ exports.kMaxLength = K_MAX_LENGTH;
332
+ Buffer3.TYPED_ARRAY_SUPPORT = typedArraySupport();
333
+ if (!Buffer3.TYPED_ARRAY_SUPPORT && typeof console !== "undefined" && typeof console.error === "function") {
334
+ console.error(
335
+ "This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
336
+ );
337
+ }
338
+ function typedArraySupport() {
339
+ try {
340
+ const arr = new Uint8Array(1);
341
+ const proto = { foo: function() {
342
+ return 42;
343
+ } };
344
+ Object.setPrototypeOf(proto, Uint8Array.prototype);
345
+ Object.setPrototypeOf(arr, proto);
346
+ return arr.foo() === 42;
347
+ } catch (e) {
348
+ return false;
349
+ }
350
+ }
351
+ Object.defineProperty(Buffer3.prototype, "parent", {
352
+ enumerable: true,
353
+ get: function() {
354
+ if (!Buffer3.isBuffer(this)) return void 0;
355
+ return this.buffer;
356
+ }
357
+ });
358
+ Object.defineProperty(Buffer3.prototype, "offset", {
359
+ enumerable: true,
360
+ get: function() {
361
+ if (!Buffer3.isBuffer(this)) return void 0;
362
+ return this.byteOffset;
363
+ }
364
+ });
365
+ function createBuffer(length) {
366
+ if (length > K_MAX_LENGTH) {
367
+ throw new RangeError('The value "' + length + '" is invalid for option "size"');
368
+ }
369
+ const buf = new Uint8Array(length);
370
+ Object.setPrototypeOf(buf, Buffer3.prototype);
371
+ return buf;
372
+ }
373
+ function Buffer3(arg, encodingOrOffset, length) {
374
+ if (typeof arg === "number") {
375
+ if (typeof encodingOrOffset === "string") {
376
+ throw new TypeError(
377
+ 'The "string" argument must be of type string. Received type number'
378
+ );
379
+ }
380
+ return allocUnsafe(arg);
381
+ }
382
+ return from(arg, encodingOrOffset, length);
383
+ }
384
+ Buffer3.poolSize = 8192;
385
+ function from(value, encodingOrOffset, length) {
386
+ if (typeof value === "string") {
387
+ return fromString(value, encodingOrOffset);
388
+ }
389
+ if (ArrayBuffer.isView(value)) {
390
+ return fromArrayView(value);
391
+ }
392
+ if (value == null) {
393
+ throw new TypeError(
394
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
395
+ );
396
+ }
397
+ if (isInstance(value, ArrayBuffer) || value && isInstance(value.buffer, ArrayBuffer)) {
398
+ return fromArrayBuffer(value, encodingOrOffset, length);
399
+ }
400
+ if (typeof SharedArrayBuffer !== "undefined" && (isInstance(value, SharedArrayBuffer) || value && isInstance(value.buffer, SharedArrayBuffer))) {
401
+ return fromArrayBuffer(value, encodingOrOffset, length);
402
+ }
403
+ if (typeof value === "number") {
404
+ throw new TypeError(
405
+ 'The "value" argument must not be of type number. Received type number'
406
+ );
407
+ }
408
+ const valueOf = value.valueOf && value.valueOf();
409
+ if (valueOf != null && valueOf !== value) {
410
+ return Buffer3.from(valueOf, encodingOrOffset, length);
411
+ }
412
+ const b = fromObject(value);
413
+ if (b) return b;
414
+ if (typeof Symbol !== "undefined" && Symbol.toPrimitive != null && typeof value[Symbol.toPrimitive] === "function") {
415
+ return Buffer3.from(value[Symbol.toPrimitive]("string"), encodingOrOffset, length);
416
+ }
417
+ throw new TypeError(
418
+ "The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof value
419
+ );
420
+ }
421
+ Buffer3.from = function(value, encodingOrOffset, length) {
422
+ return from(value, encodingOrOffset, length);
423
+ };
424
+ Object.setPrototypeOf(Buffer3.prototype, Uint8Array.prototype);
425
+ Object.setPrototypeOf(Buffer3, Uint8Array);
426
+ function assertSize(size2) {
427
+ if (typeof size2 !== "number") {
428
+ throw new TypeError('"size" argument must be of type number');
429
+ } else if (size2 < 0) {
430
+ throw new RangeError('The value "' + size2 + '" is invalid for option "size"');
431
+ }
432
+ }
433
+ function alloc(size2, fill, encoding) {
434
+ assertSize(size2);
435
+ if (size2 <= 0) {
436
+ return createBuffer(size2);
437
+ }
438
+ if (fill !== void 0) {
439
+ return typeof encoding === "string" ? createBuffer(size2).fill(fill, encoding) : createBuffer(size2).fill(fill);
440
+ }
441
+ return createBuffer(size2);
442
+ }
443
+ Buffer3.alloc = function(size2, fill, encoding) {
444
+ return alloc(size2, fill, encoding);
445
+ };
446
+ function allocUnsafe(size2) {
447
+ assertSize(size2);
448
+ return createBuffer(size2 < 0 ? 0 : checked(size2) | 0);
449
+ }
450
+ Buffer3.allocUnsafe = function(size2) {
451
+ return allocUnsafe(size2);
452
+ };
453
+ Buffer3.allocUnsafeSlow = function(size2) {
454
+ return allocUnsafe(size2);
455
+ };
456
+ function fromString(string2, encoding) {
457
+ if (typeof encoding !== "string" || encoding === "") {
458
+ encoding = "utf8";
459
+ }
460
+ if (!Buffer3.isEncoding(encoding)) {
461
+ throw new TypeError("Unknown encoding: " + encoding);
462
+ }
463
+ const length = byteLength(string2, encoding) | 0;
464
+ let buf = createBuffer(length);
465
+ const actual = buf.write(string2, encoding);
466
+ if (actual !== length) {
467
+ buf = buf.slice(0, actual);
468
+ }
469
+ return buf;
470
+ }
471
+ function fromArrayLike(array2) {
472
+ const length = array2.length < 0 ? 0 : checked(array2.length) | 0;
473
+ const buf = createBuffer(length);
474
+ for (let i = 0; i < length; i += 1) {
475
+ buf[i] = array2[i] & 255;
476
+ }
477
+ return buf;
478
+ }
479
+ function fromArrayView(arrayView) {
480
+ if (isInstance(arrayView, Uint8Array)) {
481
+ const copy = new Uint8Array(arrayView);
482
+ return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength);
483
+ }
484
+ return fromArrayLike(arrayView);
485
+ }
486
+ function fromArrayBuffer(array2, byteOffset, length) {
487
+ if (byteOffset < 0 || array2.byteLength < byteOffset) {
488
+ throw new RangeError('"offset" is outside of buffer bounds');
489
+ }
490
+ if (array2.byteLength < byteOffset + (length || 0)) {
491
+ throw new RangeError('"length" is outside of buffer bounds');
492
+ }
493
+ let buf;
494
+ if (byteOffset === void 0 && length === void 0) {
495
+ buf = new Uint8Array(array2);
496
+ } else if (length === void 0) {
497
+ buf = new Uint8Array(array2, byteOffset);
498
+ } else {
499
+ buf = new Uint8Array(array2, byteOffset, length);
500
+ }
501
+ Object.setPrototypeOf(buf, Buffer3.prototype);
502
+ return buf;
503
+ }
504
+ function fromObject(obj) {
505
+ if (Buffer3.isBuffer(obj)) {
506
+ const len = checked(obj.length) | 0;
507
+ const buf = createBuffer(len);
508
+ if (buf.length === 0) {
509
+ return buf;
510
+ }
511
+ obj.copy(buf, 0, 0, len);
512
+ return buf;
513
+ }
514
+ if (obj.length !== void 0) {
515
+ if (typeof obj.length !== "number" || numberIsNaN(obj.length)) {
516
+ return createBuffer(0);
517
+ }
518
+ return fromArrayLike(obj);
519
+ }
520
+ if (obj.type === "Buffer" && Array.isArray(obj.data)) {
521
+ return fromArrayLike(obj.data);
522
+ }
523
+ }
524
+ function checked(length) {
525
+ if (length >= K_MAX_LENGTH) {
526
+ throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
527
+ }
528
+ return length | 0;
529
+ }
530
+ function SlowBuffer(length) {
531
+ if (+length != length) {
532
+ length = 0;
533
+ }
534
+ return Buffer3.alloc(+length);
535
+ }
536
+ Buffer3.isBuffer = function isBuffer(b) {
537
+ return b != null && b._isBuffer === true && b !== Buffer3.prototype;
538
+ };
539
+ Buffer3.compare = function compare(a, b) {
540
+ if (isInstance(a, Uint8Array)) a = Buffer3.from(a, a.offset, a.byteLength);
541
+ if (isInstance(b, Uint8Array)) b = Buffer3.from(b, b.offset, b.byteLength);
542
+ if (!Buffer3.isBuffer(a) || !Buffer3.isBuffer(b)) {
543
+ throw new TypeError(
544
+ 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
545
+ );
546
+ }
547
+ if (a === b) return 0;
548
+ let x = a.length;
549
+ let y = b.length;
550
+ for (let i = 0, len = Math.min(x, y); i < len; ++i) {
551
+ if (a[i] !== b[i]) {
552
+ x = a[i];
553
+ y = b[i];
554
+ break;
555
+ }
556
+ }
557
+ if (x < y) return -1;
558
+ if (y < x) return 1;
559
+ return 0;
560
+ };
561
+ Buffer3.isEncoding = function isEncoding(encoding) {
562
+ switch (String(encoding).toLowerCase()) {
563
+ case "hex":
564
+ case "utf8":
565
+ case "utf-8":
566
+ case "ascii":
567
+ case "latin1":
568
+ case "binary":
569
+ case "base64":
570
+ case "ucs2":
571
+ case "ucs-2":
572
+ case "utf16le":
573
+ case "utf-16le":
574
+ return true;
575
+ default:
576
+ return false;
577
+ }
578
+ };
579
+ Buffer3.concat = function concat(list, length) {
580
+ if (!Array.isArray(list)) {
581
+ throw new TypeError('"list" argument must be an Array of Buffers');
582
+ }
583
+ if (list.length === 0) {
584
+ return Buffer3.alloc(0);
585
+ }
586
+ let i;
587
+ if (length === void 0) {
588
+ length = 0;
589
+ for (i = 0; i < list.length; ++i) {
590
+ length += list[i].length;
591
+ }
592
+ }
593
+ const buffer = Buffer3.allocUnsafe(length);
594
+ let pos = 0;
595
+ for (i = 0; i < list.length; ++i) {
596
+ let buf = list[i];
597
+ if (isInstance(buf, Uint8Array)) {
598
+ if (pos + buf.length > buffer.length) {
599
+ if (!Buffer3.isBuffer(buf)) buf = Buffer3.from(buf);
600
+ buf.copy(buffer, pos);
601
+ } else {
602
+ Uint8Array.prototype.set.call(
603
+ buffer,
604
+ buf,
605
+ pos
606
+ );
607
+ }
608
+ } else if (!Buffer3.isBuffer(buf)) {
609
+ throw new TypeError('"list" argument must be an Array of Buffers');
610
+ } else {
611
+ buf.copy(buffer, pos);
612
+ }
613
+ pos += buf.length;
614
+ }
615
+ return buffer;
616
+ };
617
+ function byteLength(string2, encoding) {
618
+ if (Buffer3.isBuffer(string2)) {
619
+ return string2.length;
620
+ }
621
+ if (ArrayBuffer.isView(string2) || isInstance(string2, ArrayBuffer)) {
622
+ return string2.byteLength;
623
+ }
624
+ if (typeof string2 !== "string") {
625
+ throw new TypeError(
626
+ 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof string2
627
+ );
628
+ }
629
+ const len = string2.length;
630
+ const mustMatch = arguments.length > 2 && arguments[2] === true;
631
+ if (!mustMatch && len === 0) return 0;
632
+ let loweredCase = false;
633
+ for (; ; ) {
634
+ switch (encoding) {
635
+ case "ascii":
636
+ case "latin1":
637
+ case "binary":
638
+ return len;
639
+ case "utf8":
640
+ case "utf-8":
641
+ return utf8ToBytes2(string2).length;
642
+ case "ucs2":
643
+ case "ucs-2":
644
+ case "utf16le":
645
+ case "utf-16le":
646
+ return len * 2;
647
+ case "hex":
648
+ return len >>> 1;
649
+ case "base64":
650
+ return base64ToBytes(string2).length;
651
+ default:
652
+ if (loweredCase) {
653
+ return mustMatch ? -1 : utf8ToBytes2(string2).length;
654
+ }
655
+ encoding = ("" + encoding).toLowerCase();
656
+ loweredCase = true;
657
+ }
658
+ }
659
+ }
660
+ Buffer3.byteLength = byteLength;
661
+ function slowToString(encoding, start, end) {
662
+ let loweredCase = false;
663
+ if (start === void 0 || start < 0) {
664
+ start = 0;
665
+ }
666
+ if (start > this.length) {
667
+ return "";
668
+ }
669
+ if (end === void 0 || end > this.length) {
670
+ end = this.length;
671
+ }
672
+ if (end <= 0) {
673
+ return "";
674
+ }
675
+ end >>>= 0;
676
+ start >>>= 0;
677
+ if (end <= start) {
678
+ return "";
679
+ }
680
+ if (!encoding) encoding = "utf8";
681
+ while (true) {
682
+ switch (encoding) {
683
+ case "hex":
684
+ return hexSlice(this, start, end);
685
+ case "utf8":
686
+ case "utf-8":
687
+ return utf8Slice(this, start, end);
688
+ case "ascii":
689
+ return asciiSlice(this, start, end);
690
+ case "latin1":
691
+ case "binary":
692
+ return latin1Slice(this, start, end);
693
+ case "base64":
694
+ return base64Slice(this, start, end);
695
+ case "ucs2":
696
+ case "ucs-2":
697
+ case "utf16le":
698
+ case "utf-16le":
699
+ return utf16leSlice(this, start, end);
700
+ default:
701
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
702
+ encoding = (encoding + "").toLowerCase();
703
+ loweredCase = true;
704
+ }
705
+ }
706
+ }
707
+ Buffer3.prototype._isBuffer = true;
708
+ function swap(b, n, m) {
709
+ const i = b[n];
710
+ b[n] = b[m];
711
+ b[m] = i;
712
+ }
713
+ Buffer3.prototype.swap16 = function swap16() {
714
+ const len = this.length;
715
+ if (len % 2 !== 0) {
716
+ throw new RangeError("Buffer size must be a multiple of 16-bits");
717
+ }
718
+ for (let i = 0; i < len; i += 2) {
719
+ swap(this, i, i + 1);
720
+ }
721
+ return this;
722
+ };
723
+ Buffer3.prototype.swap32 = function swap32() {
724
+ const len = this.length;
725
+ if (len % 4 !== 0) {
726
+ throw new RangeError("Buffer size must be a multiple of 32-bits");
727
+ }
728
+ for (let i = 0; i < len; i += 4) {
729
+ swap(this, i, i + 3);
730
+ swap(this, i + 1, i + 2);
731
+ }
732
+ return this;
733
+ };
734
+ Buffer3.prototype.swap64 = function swap64() {
735
+ const len = this.length;
736
+ if (len % 8 !== 0) {
737
+ throw new RangeError("Buffer size must be a multiple of 64-bits");
738
+ }
739
+ for (let i = 0; i < len; i += 8) {
740
+ swap(this, i, i + 7);
741
+ swap(this, i + 1, i + 6);
742
+ swap(this, i + 2, i + 5);
743
+ swap(this, i + 3, i + 4);
744
+ }
745
+ return this;
746
+ };
747
+ Buffer3.prototype.toString = function toString2() {
748
+ const length = this.length;
749
+ if (length === 0) return "";
750
+ if (arguments.length === 0) return utf8Slice(this, 0, length);
751
+ return slowToString.apply(this, arguments);
752
+ };
753
+ Buffer3.prototype.toLocaleString = Buffer3.prototype.toString;
754
+ Buffer3.prototype.equals = function equals(b) {
755
+ if (!Buffer3.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
756
+ if (this === b) return true;
757
+ return Buffer3.compare(this, b) === 0;
758
+ };
759
+ Buffer3.prototype.inspect = function inspect() {
760
+ let str = "";
761
+ const max = exports.INSPECT_MAX_BYTES;
762
+ str = this.toString("hex", 0, max).replace(/(.{2})/g, "$1 ").trim();
763
+ if (this.length > max) str += " ... ";
764
+ return "<Buffer " + str + ">";
765
+ };
766
+ if (customInspectSymbol) {
767
+ Buffer3.prototype[customInspectSymbol] = Buffer3.prototype.inspect;
768
+ }
769
+ Buffer3.prototype.compare = function compare(target, start, end, thisStart, thisEnd) {
770
+ if (isInstance(target, Uint8Array)) {
771
+ target = Buffer3.from(target, target.offset, target.byteLength);
772
+ }
773
+ if (!Buffer3.isBuffer(target)) {
774
+ throw new TypeError(
775
+ 'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof target
776
+ );
777
+ }
778
+ if (start === void 0) {
779
+ start = 0;
780
+ }
781
+ if (end === void 0) {
782
+ end = target ? target.length : 0;
783
+ }
784
+ if (thisStart === void 0) {
785
+ thisStart = 0;
786
+ }
787
+ if (thisEnd === void 0) {
788
+ thisEnd = this.length;
789
+ }
790
+ if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
791
+ throw new RangeError("out of range index");
792
+ }
793
+ if (thisStart >= thisEnd && start >= end) {
794
+ return 0;
795
+ }
796
+ if (thisStart >= thisEnd) {
797
+ return -1;
798
+ }
799
+ if (start >= end) {
800
+ return 1;
801
+ }
802
+ start >>>= 0;
803
+ end >>>= 0;
804
+ thisStart >>>= 0;
805
+ thisEnd >>>= 0;
806
+ if (this === target) return 0;
807
+ let x = thisEnd - thisStart;
808
+ let y = end - start;
809
+ const len = Math.min(x, y);
810
+ const thisCopy = this.slice(thisStart, thisEnd);
811
+ const targetCopy = target.slice(start, end);
812
+ for (let i = 0; i < len; ++i) {
813
+ if (thisCopy[i] !== targetCopy[i]) {
814
+ x = thisCopy[i];
815
+ y = targetCopy[i];
816
+ break;
817
+ }
818
+ }
819
+ if (x < y) return -1;
820
+ if (y < x) return 1;
821
+ return 0;
822
+ };
823
+ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
824
+ if (buffer.length === 0) return -1;
825
+ if (typeof byteOffset === "string") {
826
+ encoding = byteOffset;
827
+ byteOffset = 0;
828
+ } else if (byteOffset > 2147483647) {
829
+ byteOffset = 2147483647;
830
+ } else if (byteOffset < -2147483648) {
831
+ byteOffset = -2147483648;
832
+ }
833
+ byteOffset = +byteOffset;
834
+ if (numberIsNaN(byteOffset)) {
835
+ byteOffset = dir ? 0 : buffer.length - 1;
836
+ }
837
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset;
838
+ if (byteOffset >= buffer.length) {
839
+ if (dir) return -1;
840
+ else byteOffset = buffer.length - 1;
841
+ } else if (byteOffset < 0) {
842
+ if (dir) byteOffset = 0;
843
+ else return -1;
844
+ }
845
+ if (typeof val === "string") {
846
+ val = Buffer3.from(val, encoding);
847
+ }
848
+ if (Buffer3.isBuffer(val)) {
849
+ if (val.length === 0) {
850
+ return -1;
851
+ }
852
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir);
853
+ } else if (typeof val === "number") {
854
+ val = val & 255;
855
+ if (typeof Uint8Array.prototype.indexOf === "function") {
856
+ if (dir) {
857
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset);
858
+ } else {
859
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset);
860
+ }
861
+ }
862
+ return arrayIndexOf(buffer, [val], byteOffset, encoding, dir);
863
+ }
864
+ throw new TypeError("val must be string, number or Buffer");
865
+ }
866
+ function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
867
+ let indexSize = 1;
868
+ let arrLength = arr.length;
869
+ let valLength = val.length;
870
+ if (encoding !== void 0) {
871
+ encoding = String(encoding).toLowerCase();
872
+ if (encoding === "ucs2" || encoding === "ucs-2" || encoding === "utf16le" || encoding === "utf-16le") {
873
+ if (arr.length < 2 || val.length < 2) {
874
+ return -1;
875
+ }
876
+ indexSize = 2;
877
+ arrLength /= 2;
878
+ valLength /= 2;
879
+ byteOffset /= 2;
880
+ }
881
+ }
882
+ function read(buf, i2) {
883
+ if (indexSize === 1) {
884
+ return buf[i2];
885
+ } else {
886
+ return buf.readUInt16BE(i2 * indexSize);
887
+ }
888
+ }
889
+ let i;
890
+ if (dir) {
891
+ let foundIndex = -1;
892
+ for (i = byteOffset; i < arrLength; i++) {
893
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
894
+ if (foundIndex === -1) foundIndex = i;
895
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize;
896
+ } else {
897
+ if (foundIndex !== -1) i -= i - foundIndex;
898
+ foundIndex = -1;
899
+ }
900
+ }
901
+ } else {
902
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength;
903
+ for (i = byteOffset; i >= 0; i--) {
904
+ let found = true;
905
+ for (let j = 0; j < valLength; j++) {
906
+ if (read(arr, i + j) !== read(val, j)) {
907
+ found = false;
908
+ break;
909
+ }
910
+ }
911
+ if (found) return i;
912
+ }
913
+ }
914
+ return -1;
915
+ }
916
+ Buffer3.prototype.includes = function includes(val, byteOffset, encoding) {
917
+ return this.indexOf(val, byteOffset, encoding) !== -1;
918
+ };
919
+ Buffer3.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
920
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
921
+ };
922
+ Buffer3.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
923
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
924
+ };
925
+ function hexWrite(buf, string2, offset, length) {
926
+ offset = Number(offset) || 0;
927
+ const remaining = buf.length - offset;
928
+ if (!length) {
929
+ length = remaining;
930
+ } else {
931
+ length = Number(length);
932
+ if (length > remaining) {
933
+ length = remaining;
934
+ }
935
+ }
936
+ const strLen = string2.length;
937
+ if (length > strLen / 2) {
938
+ length = strLen / 2;
939
+ }
940
+ let i;
941
+ for (i = 0; i < length; ++i) {
942
+ const parsed = parseInt(string2.substr(i * 2, 2), 16);
943
+ if (numberIsNaN(parsed)) return i;
944
+ buf[offset + i] = parsed;
945
+ }
946
+ return i;
947
+ }
948
+ function utf8Write(buf, string2, offset, length) {
949
+ return blitBuffer(utf8ToBytes2(string2, buf.length - offset), buf, offset, length);
950
+ }
951
+ function asciiWrite(buf, string2, offset, length) {
952
+ return blitBuffer(asciiToBytes(string2), buf, offset, length);
953
+ }
954
+ function base64Write(buf, string2, offset, length) {
955
+ return blitBuffer(base64ToBytes(string2), buf, offset, length);
956
+ }
957
+ function ucs2Write(buf, string2, offset, length) {
958
+ return blitBuffer(utf16leToBytes(string2, buf.length - offset), buf, offset, length);
959
+ }
960
+ Buffer3.prototype.write = function write(string2, offset, length, encoding) {
961
+ if (offset === void 0) {
962
+ encoding = "utf8";
963
+ length = this.length;
964
+ offset = 0;
965
+ } else if (length === void 0 && typeof offset === "string") {
966
+ encoding = offset;
967
+ length = this.length;
968
+ offset = 0;
969
+ } else if (isFinite(offset)) {
970
+ offset = offset >>> 0;
971
+ if (isFinite(length)) {
972
+ length = length >>> 0;
973
+ if (encoding === void 0) encoding = "utf8";
974
+ } else {
975
+ encoding = length;
976
+ length = void 0;
977
+ }
978
+ } else {
979
+ throw new Error(
980
+ "Buffer.write(string, encoding, offset[, length]) is no longer supported"
981
+ );
982
+ }
983
+ const remaining = this.length - offset;
984
+ if (length === void 0 || length > remaining) length = remaining;
985
+ if (string2.length > 0 && (length < 0 || offset < 0) || offset > this.length) {
986
+ throw new RangeError("Attempt to write outside buffer bounds");
987
+ }
988
+ if (!encoding) encoding = "utf8";
989
+ let loweredCase = false;
990
+ for (; ; ) {
991
+ switch (encoding) {
992
+ case "hex":
993
+ return hexWrite(this, string2, offset, length);
994
+ case "utf8":
995
+ case "utf-8":
996
+ return utf8Write(this, string2, offset, length);
997
+ case "ascii":
998
+ case "latin1":
999
+ case "binary":
1000
+ return asciiWrite(this, string2, offset, length);
1001
+ case "base64":
1002
+ return base64Write(this, string2, offset, length);
1003
+ case "ucs2":
1004
+ case "ucs-2":
1005
+ case "utf16le":
1006
+ case "utf-16le":
1007
+ return ucs2Write(this, string2, offset, length);
1008
+ default:
1009
+ if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
1010
+ encoding = ("" + encoding).toLowerCase();
1011
+ loweredCase = true;
1012
+ }
1013
+ }
1014
+ };
1015
+ Buffer3.prototype.toJSON = function toJSON() {
1016
+ return {
1017
+ type: "Buffer",
1018
+ data: Array.prototype.slice.call(this._arr || this, 0)
1019
+ };
1020
+ };
1021
+ function base64Slice(buf, start, end) {
1022
+ if (start === 0 && end === buf.length) {
1023
+ return base642.fromByteArray(buf);
1024
+ } else {
1025
+ return base642.fromByteArray(buf.slice(start, end));
1026
+ }
1027
+ }
1028
+ function utf8Slice(buf, start, end) {
1029
+ end = Math.min(buf.length, end);
1030
+ const res = [];
1031
+ let i = start;
1032
+ while (i < end) {
1033
+ const firstByte = buf[i];
1034
+ let codePoint = null;
1035
+ let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1;
1036
+ if (i + bytesPerSequence <= end) {
1037
+ let secondByte, thirdByte, fourthByte, tempCodePoint;
1038
+ switch (bytesPerSequence) {
1039
+ case 1:
1040
+ if (firstByte < 128) {
1041
+ codePoint = firstByte;
1042
+ }
1043
+ break;
1044
+ case 2:
1045
+ secondByte = buf[i + 1];
1046
+ if ((secondByte & 192) === 128) {
1047
+ tempCodePoint = (firstByte & 31) << 6 | secondByte & 63;
1048
+ if (tempCodePoint > 127) {
1049
+ codePoint = tempCodePoint;
1050
+ }
1051
+ }
1052
+ break;
1053
+ case 3:
1054
+ secondByte = buf[i + 1];
1055
+ thirdByte = buf[i + 2];
1056
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) {
1057
+ tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63;
1058
+ if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) {
1059
+ codePoint = tempCodePoint;
1060
+ }
1061
+ }
1062
+ break;
1063
+ case 4:
1064
+ secondByte = buf[i + 1];
1065
+ thirdByte = buf[i + 2];
1066
+ fourthByte = buf[i + 3];
1067
+ if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) {
1068
+ tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63;
1069
+ if (tempCodePoint > 65535 && tempCodePoint < 1114112) {
1070
+ codePoint = tempCodePoint;
1071
+ }
1072
+ }
1073
+ }
1074
+ }
1075
+ if (codePoint === null) {
1076
+ codePoint = 65533;
1077
+ bytesPerSequence = 1;
1078
+ } else if (codePoint > 65535) {
1079
+ codePoint -= 65536;
1080
+ res.push(codePoint >>> 10 & 1023 | 55296);
1081
+ codePoint = 56320 | codePoint & 1023;
1082
+ }
1083
+ res.push(codePoint);
1084
+ i += bytesPerSequence;
1085
+ }
1086
+ return decodeCodePointsArray(res);
1087
+ }
1088
+ var MAX_ARGUMENTS_LENGTH = 4096;
1089
+ function decodeCodePointsArray(codePoints) {
1090
+ const len = codePoints.length;
1091
+ if (len <= MAX_ARGUMENTS_LENGTH) {
1092
+ return String.fromCharCode.apply(String, codePoints);
1093
+ }
1094
+ let res = "";
1095
+ let i = 0;
1096
+ while (i < len) {
1097
+ res += String.fromCharCode.apply(
1098
+ String,
1099
+ codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
1100
+ );
1101
+ }
1102
+ return res;
1103
+ }
1104
+ function asciiSlice(buf, start, end) {
1105
+ let ret = "";
1106
+ end = Math.min(buf.length, end);
1107
+ for (let i = start; i < end; ++i) {
1108
+ ret += String.fromCharCode(buf[i] & 127);
1109
+ }
1110
+ return ret;
1111
+ }
1112
+ function latin1Slice(buf, start, end) {
1113
+ let ret = "";
1114
+ end = Math.min(buf.length, end);
1115
+ for (let i = start; i < end; ++i) {
1116
+ ret += String.fromCharCode(buf[i]);
1117
+ }
1118
+ return ret;
1119
+ }
1120
+ function hexSlice(buf, start, end) {
1121
+ const len = buf.length;
1122
+ if (!start || start < 0) start = 0;
1123
+ if (!end || end < 0 || end > len) end = len;
1124
+ let out = "";
1125
+ for (let i = start; i < end; ++i) {
1126
+ out += hexSliceLookupTable[buf[i]];
1127
+ }
1128
+ return out;
1129
+ }
1130
+ function utf16leSlice(buf, start, end) {
1131
+ const bytes = buf.slice(start, end);
1132
+ let res = "";
1133
+ for (let i = 0; i < bytes.length - 1; i += 2) {
1134
+ res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256);
1135
+ }
1136
+ return res;
1137
+ }
1138
+ Buffer3.prototype.slice = function slice(start, end) {
1139
+ const len = this.length;
1140
+ start = ~~start;
1141
+ end = end === void 0 ? len : ~~end;
1142
+ if (start < 0) {
1143
+ start += len;
1144
+ if (start < 0) start = 0;
1145
+ } else if (start > len) {
1146
+ start = len;
1147
+ }
1148
+ if (end < 0) {
1149
+ end += len;
1150
+ if (end < 0) end = 0;
1151
+ } else if (end > len) {
1152
+ end = len;
1153
+ }
1154
+ if (end < start) end = start;
1155
+ const newBuf = this.subarray(start, end);
1156
+ Object.setPrototypeOf(newBuf, Buffer3.prototype);
1157
+ return newBuf;
1158
+ };
1159
+ function checkOffset(offset, ext, length) {
1160
+ if (offset % 1 !== 0 || offset < 0) throw new RangeError("offset is not uint");
1161
+ if (offset + ext > length) throw new RangeError("Trying to access beyond buffer length");
1162
+ }
1163
+ Buffer3.prototype.readUintLE = Buffer3.prototype.readUIntLE = function readUIntLE(offset, byteLength2, noAssert) {
1164
+ offset = offset >>> 0;
1165
+ byteLength2 = byteLength2 >>> 0;
1166
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1167
+ let val = this[offset];
1168
+ let mul = 1;
1169
+ let i = 0;
1170
+ while (++i < byteLength2 && (mul *= 256)) {
1171
+ val += this[offset + i] * mul;
1172
+ }
1173
+ return val;
1174
+ };
1175
+ Buffer3.prototype.readUintBE = Buffer3.prototype.readUIntBE = function readUIntBE(offset, byteLength2, noAssert) {
1176
+ offset = offset >>> 0;
1177
+ byteLength2 = byteLength2 >>> 0;
1178
+ if (!noAssert) {
1179
+ checkOffset(offset, byteLength2, this.length);
1180
+ }
1181
+ let val = this[offset + --byteLength2];
1182
+ let mul = 1;
1183
+ while (byteLength2 > 0 && (mul *= 256)) {
1184
+ val += this[offset + --byteLength2] * mul;
1185
+ }
1186
+ return val;
1187
+ };
1188
+ Buffer3.prototype.readUint8 = Buffer3.prototype.readUInt8 = function readUInt8(offset, noAssert) {
1189
+ offset = offset >>> 0;
1190
+ if (!noAssert) checkOffset(offset, 1, this.length);
1191
+ return this[offset];
1192
+ };
1193
+ Buffer3.prototype.readUint16LE = Buffer3.prototype.readUInt16LE = function readUInt16LE(offset, noAssert) {
1194
+ offset = offset >>> 0;
1195
+ if (!noAssert) checkOffset(offset, 2, this.length);
1196
+ return this[offset] | this[offset + 1] << 8;
1197
+ };
1198
+ Buffer3.prototype.readUint16BE = Buffer3.prototype.readUInt16BE = function readUInt16BE(offset, noAssert) {
1199
+ offset = offset >>> 0;
1200
+ if (!noAssert) checkOffset(offset, 2, this.length);
1201
+ return this[offset] << 8 | this[offset + 1];
1202
+ };
1203
+ Buffer3.prototype.readUint32LE = Buffer3.prototype.readUInt32LE = function readUInt32LE(offset, noAssert) {
1204
+ offset = offset >>> 0;
1205
+ if (!noAssert) checkOffset(offset, 4, this.length);
1206
+ return (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + this[offset + 3] * 16777216;
1207
+ };
1208
+ Buffer3.prototype.readUint32BE = Buffer3.prototype.readUInt32BE = function readUInt32BE(offset, noAssert) {
1209
+ offset = offset >>> 0;
1210
+ if (!noAssert) checkOffset(offset, 4, this.length);
1211
+ return this[offset] * 16777216 + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
1212
+ };
1213
+ Buffer3.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE(offset) {
1214
+ offset = offset >>> 0;
1215
+ validateNumber(offset, "offset");
1216
+ const first = this[offset];
1217
+ const last = this[offset + 7];
1218
+ if (first === void 0 || last === void 0) {
1219
+ boundsError(offset, this.length - 8);
1220
+ }
1221
+ const lo = first + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 24);
1222
+ const hi = this[++offset] + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + last * __pow(2, 24);
1223
+ return BigInt(lo) + (BigInt(hi) << BigInt(32));
1224
+ });
1225
+ Buffer3.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE(offset) {
1226
+ offset = offset >>> 0;
1227
+ validateNumber(offset, "offset");
1228
+ const first = this[offset];
1229
+ const last = this[offset + 7];
1230
+ if (first === void 0 || last === void 0) {
1231
+ boundsError(offset, this.length - 8);
1232
+ }
1233
+ const hi = first * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + this[++offset];
1234
+ const lo = this[++offset] * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + last;
1235
+ return (BigInt(hi) << BigInt(32)) + BigInt(lo);
1236
+ });
1237
+ Buffer3.prototype.readIntLE = function readIntLE(offset, byteLength2, noAssert) {
1238
+ offset = offset >>> 0;
1239
+ byteLength2 = byteLength2 >>> 0;
1240
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1241
+ let val = this[offset];
1242
+ let mul = 1;
1243
+ let i = 0;
1244
+ while (++i < byteLength2 && (mul *= 256)) {
1245
+ val += this[offset + i] * mul;
1246
+ }
1247
+ mul *= 128;
1248
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
1249
+ return val;
1250
+ };
1251
+ Buffer3.prototype.readIntBE = function readIntBE(offset, byteLength2, noAssert) {
1252
+ offset = offset >>> 0;
1253
+ byteLength2 = byteLength2 >>> 0;
1254
+ if (!noAssert) checkOffset(offset, byteLength2, this.length);
1255
+ let i = byteLength2;
1256
+ let mul = 1;
1257
+ let val = this[offset + --i];
1258
+ while (i > 0 && (mul *= 256)) {
1259
+ val += this[offset + --i] * mul;
1260
+ }
1261
+ mul *= 128;
1262
+ if (val >= mul) val -= Math.pow(2, 8 * byteLength2);
1263
+ return val;
1264
+ };
1265
+ Buffer3.prototype.readInt8 = function readInt8(offset, noAssert) {
1266
+ offset = offset >>> 0;
1267
+ if (!noAssert) checkOffset(offset, 1, this.length);
1268
+ if (!(this[offset] & 128)) return this[offset];
1269
+ return (255 - this[offset] + 1) * -1;
1270
+ };
1271
+ Buffer3.prototype.readInt16LE = function readInt16LE(offset, noAssert) {
1272
+ offset = offset >>> 0;
1273
+ if (!noAssert) checkOffset(offset, 2, this.length);
1274
+ const val = this[offset] | this[offset + 1] << 8;
1275
+ return val & 32768 ? val | 4294901760 : val;
1276
+ };
1277
+ Buffer3.prototype.readInt16BE = function readInt16BE(offset, noAssert) {
1278
+ offset = offset >>> 0;
1279
+ if (!noAssert) checkOffset(offset, 2, this.length);
1280
+ const val = this[offset + 1] | this[offset] << 8;
1281
+ return val & 32768 ? val | 4294901760 : val;
1282
+ };
1283
+ Buffer3.prototype.readInt32LE = function readInt32LE(offset, noAssert) {
1284
+ offset = offset >>> 0;
1285
+ if (!noAssert) checkOffset(offset, 4, this.length);
1286
+ return this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
1287
+ };
1288
+ Buffer3.prototype.readInt32BE = function readInt32BE(offset, noAssert) {
1289
+ offset = offset >>> 0;
1290
+ if (!noAssert) checkOffset(offset, 4, this.length);
1291
+ return this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
1292
+ };
1293
+ Buffer3.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE(offset) {
1294
+ offset = offset >>> 0;
1295
+ validateNumber(offset, "offset");
1296
+ const first = this[offset];
1297
+ const last = this[offset + 7];
1298
+ if (first === void 0 || last === void 0) {
1299
+ boundsError(offset, this.length - 8);
1300
+ }
1301
+ const val = this[offset + 4] + this[offset + 5] * __pow(2, 8) + this[offset + 6] * __pow(2, 16) + (last << 24);
1302
+ return (BigInt(val) << BigInt(32)) + BigInt(first + this[++offset] * __pow(2, 8) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 24));
1303
+ });
1304
+ Buffer3.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE(offset) {
1305
+ offset = offset >>> 0;
1306
+ validateNumber(offset, "offset");
1307
+ const first = this[offset];
1308
+ const last = this[offset + 7];
1309
+ if (first === void 0 || last === void 0) {
1310
+ boundsError(offset, this.length - 8);
1311
+ }
1312
+ const val = (first << 24) + // Overflow
1313
+ this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + this[++offset];
1314
+ return (BigInt(val) << BigInt(32)) + BigInt(this[++offset] * __pow(2, 24) + this[++offset] * __pow(2, 16) + this[++offset] * __pow(2, 8) + last);
1315
+ });
1316
+ Buffer3.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
1317
+ offset = offset >>> 0;
1318
+ if (!noAssert) checkOffset(offset, 4, this.length);
1319
+ return ieee754.read(this, offset, true, 23, 4);
1320
+ };
1321
+ Buffer3.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
1322
+ offset = offset >>> 0;
1323
+ if (!noAssert) checkOffset(offset, 4, this.length);
1324
+ return ieee754.read(this, offset, false, 23, 4);
1325
+ };
1326
+ Buffer3.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
1327
+ offset = offset >>> 0;
1328
+ if (!noAssert) checkOffset(offset, 8, this.length);
1329
+ return ieee754.read(this, offset, true, 52, 8);
1330
+ };
1331
+ Buffer3.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
1332
+ offset = offset >>> 0;
1333
+ if (!noAssert) checkOffset(offset, 8, this.length);
1334
+ return ieee754.read(this, offset, false, 52, 8);
1335
+ };
1336
+ function checkInt(buf, value, offset, ext, max, min) {
1337
+ if (!Buffer3.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
1338
+ if (value > max || value < min) throw new RangeError('"value" argument is out of bounds');
1339
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
1340
+ }
1341
+ Buffer3.prototype.writeUintLE = Buffer3.prototype.writeUIntLE = function writeUIntLE(value, offset, byteLength2, noAssert) {
1342
+ value = +value;
1343
+ offset = offset >>> 0;
1344
+ byteLength2 = byteLength2 >>> 0;
1345
+ if (!noAssert) {
1346
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
1347
+ checkInt(this, value, offset, byteLength2, maxBytes, 0);
1348
+ }
1349
+ let mul = 1;
1350
+ let i = 0;
1351
+ this[offset] = value & 255;
1352
+ while (++i < byteLength2 && (mul *= 256)) {
1353
+ this[offset + i] = value / mul & 255;
1354
+ }
1355
+ return offset + byteLength2;
1356
+ };
1357
+ Buffer3.prototype.writeUintBE = Buffer3.prototype.writeUIntBE = function writeUIntBE(value, offset, byteLength2, noAssert) {
1358
+ value = +value;
1359
+ offset = offset >>> 0;
1360
+ byteLength2 = byteLength2 >>> 0;
1361
+ if (!noAssert) {
1362
+ const maxBytes = Math.pow(2, 8 * byteLength2) - 1;
1363
+ checkInt(this, value, offset, byteLength2, maxBytes, 0);
1364
+ }
1365
+ let i = byteLength2 - 1;
1366
+ let mul = 1;
1367
+ this[offset + i] = value & 255;
1368
+ while (--i >= 0 && (mul *= 256)) {
1369
+ this[offset + i] = value / mul & 255;
1370
+ }
1371
+ return offset + byteLength2;
1372
+ };
1373
+ Buffer3.prototype.writeUint8 = Buffer3.prototype.writeUInt8 = function writeUInt8(value, offset, noAssert) {
1374
+ value = +value;
1375
+ offset = offset >>> 0;
1376
+ if (!noAssert) checkInt(this, value, offset, 1, 255, 0);
1377
+ this[offset] = value & 255;
1378
+ return offset + 1;
1379
+ };
1380
+ Buffer3.prototype.writeUint16LE = Buffer3.prototype.writeUInt16LE = function writeUInt16LE(value, offset, noAssert) {
1381
+ value = +value;
1382
+ offset = offset >>> 0;
1383
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1384
+ this[offset] = value & 255;
1385
+ this[offset + 1] = value >>> 8;
1386
+ return offset + 2;
1387
+ };
1388
+ Buffer3.prototype.writeUint16BE = Buffer3.prototype.writeUInt16BE = function writeUInt16BE(value, offset, noAssert) {
1389
+ value = +value;
1390
+ offset = offset >>> 0;
1391
+ if (!noAssert) checkInt(this, value, offset, 2, 65535, 0);
1392
+ this[offset] = value >>> 8;
1393
+ this[offset + 1] = value & 255;
1394
+ return offset + 2;
1395
+ };
1396
+ Buffer3.prototype.writeUint32LE = Buffer3.prototype.writeUInt32LE = function writeUInt32LE(value, offset, noAssert) {
1397
+ value = +value;
1398
+ offset = offset >>> 0;
1399
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1400
+ this[offset + 3] = value >>> 24;
1401
+ this[offset + 2] = value >>> 16;
1402
+ this[offset + 1] = value >>> 8;
1403
+ this[offset] = value & 255;
1404
+ return offset + 4;
1405
+ };
1406
+ Buffer3.prototype.writeUint32BE = Buffer3.prototype.writeUInt32BE = function writeUInt32BE(value, offset, noAssert) {
1407
+ value = +value;
1408
+ offset = offset >>> 0;
1409
+ if (!noAssert) checkInt(this, value, offset, 4, 4294967295, 0);
1410
+ this[offset] = value >>> 24;
1411
+ this[offset + 1] = value >>> 16;
1412
+ this[offset + 2] = value >>> 8;
1413
+ this[offset + 3] = value & 255;
1414
+ return offset + 4;
1415
+ };
1416
+ function wrtBigUInt64LE(buf, value, offset, min, max) {
1417
+ checkIntBI(value, min, max, buf, offset, 7);
1418
+ let lo = Number(value & BigInt(4294967295));
1419
+ buf[offset++] = lo;
1420
+ lo = lo >> 8;
1421
+ buf[offset++] = lo;
1422
+ lo = lo >> 8;
1423
+ buf[offset++] = lo;
1424
+ lo = lo >> 8;
1425
+ buf[offset++] = lo;
1426
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
1427
+ buf[offset++] = hi;
1428
+ hi = hi >> 8;
1429
+ buf[offset++] = hi;
1430
+ hi = hi >> 8;
1431
+ buf[offset++] = hi;
1432
+ hi = hi >> 8;
1433
+ buf[offset++] = hi;
1434
+ return offset;
1435
+ }
1436
+ function wrtBigUInt64BE(buf, value, offset, min, max) {
1437
+ checkIntBI(value, min, max, buf, offset, 7);
1438
+ let lo = Number(value & BigInt(4294967295));
1439
+ buf[offset + 7] = lo;
1440
+ lo = lo >> 8;
1441
+ buf[offset + 6] = lo;
1442
+ lo = lo >> 8;
1443
+ buf[offset + 5] = lo;
1444
+ lo = lo >> 8;
1445
+ buf[offset + 4] = lo;
1446
+ let hi = Number(value >> BigInt(32) & BigInt(4294967295));
1447
+ buf[offset + 3] = hi;
1448
+ hi = hi >> 8;
1449
+ buf[offset + 2] = hi;
1450
+ hi = hi >> 8;
1451
+ buf[offset + 1] = hi;
1452
+ hi = hi >> 8;
1453
+ buf[offset] = hi;
1454
+ return offset + 8;
1455
+ }
1456
+ Buffer3.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE(value, offset = 0) {
1457
+ return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
1458
+ });
1459
+ Buffer3.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE(value, offset = 0) {
1460
+ return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt("0xffffffffffffffff"));
1461
+ });
1462
+ Buffer3.prototype.writeIntLE = function writeIntLE(value, offset, byteLength2, noAssert) {
1463
+ value = +value;
1464
+ offset = offset >>> 0;
1465
+ if (!noAssert) {
1466
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
1467
+ checkInt(this, value, offset, byteLength2, limit - 1, -limit);
1468
+ }
1469
+ let i = 0;
1470
+ let mul = 1;
1471
+ let sub = 0;
1472
+ this[offset] = value & 255;
1473
+ while (++i < byteLength2 && (mul *= 256)) {
1474
+ if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
1475
+ sub = 1;
1476
+ }
1477
+ this[offset + i] = (value / mul >> 0) - sub & 255;
1478
+ }
1479
+ return offset + byteLength2;
1480
+ };
1481
+ Buffer3.prototype.writeIntBE = function writeIntBE(value, offset, byteLength2, noAssert) {
1482
+ value = +value;
1483
+ offset = offset >>> 0;
1484
+ if (!noAssert) {
1485
+ const limit = Math.pow(2, 8 * byteLength2 - 1);
1486
+ checkInt(this, value, offset, byteLength2, limit - 1, -limit);
1487
+ }
1488
+ let i = byteLength2 - 1;
1489
+ let mul = 1;
1490
+ let sub = 0;
1491
+ this[offset + i] = value & 255;
1492
+ while (--i >= 0 && (mul *= 256)) {
1493
+ if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
1494
+ sub = 1;
1495
+ }
1496
+ this[offset + i] = (value / mul >> 0) - sub & 255;
1497
+ }
1498
+ return offset + byteLength2;
1499
+ };
1500
+ Buffer3.prototype.writeInt8 = function writeInt8(value, offset, noAssert) {
1501
+ value = +value;
1502
+ offset = offset >>> 0;
1503
+ if (!noAssert) checkInt(this, value, offset, 1, 127, -128);
1504
+ if (value < 0) value = 255 + value + 1;
1505
+ this[offset] = value & 255;
1506
+ return offset + 1;
1507
+ };
1508
+ Buffer3.prototype.writeInt16LE = function writeInt16LE(value, offset, noAssert) {
1509
+ value = +value;
1510
+ offset = offset >>> 0;
1511
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
1512
+ this[offset] = value & 255;
1513
+ this[offset + 1] = value >>> 8;
1514
+ return offset + 2;
1515
+ };
1516
+ Buffer3.prototype.writeInt16BE = function writeInt16BE(value, offset, noAssert) {
1517
+ value = +value;
1518
+ offset = offset >>> 0;
1519
+ if (!noAssert) checkInt(this, value, offset, 2, 32767, -32768);
1520
+ this[offset] = value >>> 8;
1521
+ this[offset + 1] = value & 255;
1522
+ return offset + 2;
1523
+ };
1524
+ Buffer3.prototype.writeInt32LE = function writeInt32LE(value, offset, noAssert) {
1525
+ value = +value;
1526
+ offset = offset >>> 0;
1527
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
1528
+ this[offset] = value & 255;
1529
+ this[offset + 1] = value >>> 8;
1530
+ this[offset + 2] = value >>> 16;
1531
+ this[offset + 3] = value >>> 24;
1532
+ return offset + 4;
1533
+ };
1534
+ Buffer3.prototype.writeInt32BE = function writeInt32BE(value, offset, noAssert) {
1535
+ value = +value;
1536
+ offset = offset >>> 0;
1537
+ if (!noAssert) checkInt(this, value, offset, 4, 2147483647, -2147483648);
1538
+ if (value < 0) value = 4294967295 + value + 1;
1539
+ this[offset] = value >>> 24;
1540
+ this[offset + 1] = value >>> 16;
1541
+ this[offset + 2] = value >>> 8;
1542
+ this[offset + 3] = value & 255;
1543
+ return offset + 4;
1544
+ };
1545
+ Buffer3.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE(value, offset = 0) {
1546
+ return wrtBigUInt64LE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1547
+ });
1548
+ Buffer3.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE(value, offset = 0) {
1549
+ return wrtBigUInt64BE(this, value, offset, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
1550
+ });
1551
+ function checkIEEE754(buf, value, offset, ext, max, min) {
1552
+ if (offset + ext > buf.length) throw new RangeError("Index out of range");
1553
+ if (offset < 0) throw new RangeError("Index out of range");
1554
+ }
1555
+ function writeFloat(buf, value, offset, littleEndian, noAssert) {
1556
+ value = +value;
1557
+ offset = offset >>> 0;
1558
+ if (!noAssert) {
1559
+ checkIEEE754(buf, value, offset, 4, 34028234663852886e22, -34028234663852886e22);
1560
+ }
1561
+ ieee754.write(buf, value, offset, littleEndian, 23, 4);
1562
+ return offset + 4;
1563
+ }
1564
+ Buffer3.prototype.writeFloatLE = function writeFloatLE(value, offset, noAssert) {
1565
+ return writeFloat(this, value, offset, true, noAssert);
1566
+ };
1567
+ Buffer3.prototype.writeFloatBE = function writeFloatBE(value, offset, noAssert) {
1568
+ return writeFloat(this, value, offset, false, noAssert);
1569
+ };
1570
+ function writeDouble(buf, value, offset, littleEndian, noAssert) {
1571
+ value = +value;
1572
+ offset = offset >>> 0;
1573
+ if (!noAssert) {
1574
+ checkIEEE754(buf, value, offset, 8, 17976931348623157e292, -17976931348623157e292);
1575
+ }
1576
+ ieee754.write(buf, value, offset, littleEndian, 52, 8);
1577
+ return offset + 8;
1578
+ }
1579
+ Buffer3.prototype.writeDoubleLE = function writeDoubleLE(value, offset, noAssert) {
1580
+ return writeDouble(this, value, offset, true, noAssert);
1581
+ };
1582
+ Buffer3.prototype.writeDoubleBE = function writeDoubleBE(value, offset, noAssert) {
1583
+ return writeDouble(this, value, offset, false, noAssert);
1584
+ };
1585
+ Buffer3.prototype.copy = function copy(target, targetStart, start, end) {
1586
+ if (!Buffer3.isBuffer(target)) throw new TypeError("argument should be a Buffer");
1587
+ if (!start) start = 0;
1588
+ if (!end && end !== 0) end = this.length;
1589
+ if (targetStart >= target.length) targetStart = target.length;
1590
+ if (!targetStart) targetStart = 0;
1591
+ if (end > 0 && end < start) end = start;
1592
+ if (end === start) return 0;
1593
+ if (target.length === 0 || this.length === 0) return 0;
1594
+ if (targetStart < 0) {
1595
+ throw new RangeError("targetStart out of bounds");
1596
+ }
1597
+ if (start < 0 || start >= this.length) throw new RangeError("Index out of range");
1598
+ if (end < 0) throw new RangeError("sourceEnd out of bounds");
1599
+ if (end > this.length) end = this.length;
1600
+ if (target.length - targetStart < end - start) {
1601
+ end = target.length - targetStart + start;
1602
+ }
1603
+ const len = end - start;
1604
+ if (this === target && typeof Uint8Array.prototype.copyWithin === "function") {
1605
+ this.copyWithin(targetStart, start, end);
1606
+ } else {
1607
+ Uint8Array.prototype.set.call(
1608
+ target,
1609
+ this.subarray(start, end),
1610
+ targetStart
1611
+ );
1612
+ }
1613
+ return len;
1614
+ };
1615
+ Buffer3.prototype.fill = function fill(val, start, end, encoding) {
1616
+ if (typeof val === "string") {
1617
+ if (typeof start === "string") {
1618
+ encoding = start;
1619
+ start = 0;
1620
+ end = this.length;
1621
+ } else if (typeof end === "string") {
1622
+ encoding = end;
1623
+ end = this.length;
1624
+ }
1625
+ if (encoding !== void 0 && typeof encoding !== "string") {
1626
+ throw new TypeError("encoding must be a string");
1627
+ }
1628
+ if (typeof encoding === "string" && !Buffer3.isEncoding(encoding)) {
1629
+ throw new TypeError("Unknown encoding: " + encoding);
1630
+ }
1631
+ if (val.length === 1) {
1632
+ const code = val.charCodeAt(0);
1633
+ if (encoding === "utf8" && code < 128 || encoding === "latin1") {
1634
+ val = code;
1635
+ }
1636
+ }
1637
+ } else if (typeof val === "number") {
1638
+ val = val & 255;
1639
+ } else if (typeof val === "boolean") {
1640
+ val = Number(val);
1641
+ }
1642
+ if (start < 0 || this.length < start || this.length < end) {
1643
+ throw new RangeError("Out of range index");
1644
+ }
1645
+ if (end <= start) {
1646
+ return this;
1647
+ }
1648
+ start = start >>> 0;
1649
+ end = end === void 0 ? this.length : end >>> 0;
1650
+ if (!val) val = 0;
1651
+ let i;
1652
+ if (typeof val === "number") {
1653
+ for (i = start; i < end; ++i) {
1654
+ this[i] = val;
1655
+ }
1656
+ } else {
1657
+ const bytes = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding);
1658
+ const len = bytes.length;
1659
+ if (len === 0) {
1660
+ throw new TypeError('The value "' + val + '" is invalid for argument "value"');
1661
+ }
1662
+ for (i = 0; i < end - start; ++i) {
1663
+ this[i + start] = bytes[i % len];
1664
+ }
1665
+ }
1666
+ return this;
1667
+ };
1668
+ var errors = {};
1669
+ function E(sym, getMessage, Base) {
1670
+ errors[sym] = class NodeError extends Base {
1671
+ constructor() {
1672
+ super();
1673
+ Object.defineProperty(this, "message", {
1674
+ value: getMessage.apply(this, arguments),
1675
+ writable: true,
1676
+ configurable: true
1677
+ });
1678
+ this.name = `${this.name} [${sym}]`;
1679
+ this.stack;
1680
+ delete this.name;
1681
+ }
1682
+ get code() {
1683
+ return sym;
1684
+ }
1685
+ set code(value) {
1686
+ Object.defineProperty(this, "code", {
1687
+ configurable: true,
1688
+ enumerable: true,
1689
+ value,
1690
+ writable: true
1691
+ });
1692
+ }
1693
+ toString() {
1694
+ return `${this.name} [${sym}]: ${this.message}`;
1695
+ }
1696
+ };
1697
+ }
1698
+ E(
1699
+ "ERR_BUFFER_OUT_OF_BOUNDS",
1700
+ function(name) {
1701
+ if (name) {
1702
+ return `${name} is outside of buffer bounds`;
1703
+ }
1704
+ return "Attempt to access memory outside buffer bounds";
1705
+ },
1706
+ RangeError
1707
+ );
1708
+ E(
1709
+ "ERR_INVALID_ARG_TYPE",
1710
+ function(name, actual) {
1711
+ return `The "${name}" argument must be of type number. Received type ${typeof actual}`;
1712
+ },
1713
+ TypeError
1714
+ );
1715
+ E(
1716
+ "ERR_OUT_OF_RANGE",
1717
+ function(str, range, input) {
1718
+ let msg = `The value of "${str}" is out of range.`;
1719
+ let received = input;
1720
+ if (Number.isInteger(input) && Math.abs(input) > __pow(2, 32)) {
1721
+ received = addNumericalSeparator(String(input));
1722
+ } else if (typeof input === "bigint") {
1723
+ received = String(input);
1724
+ if (input > __pow(BigInt(2), BigInt(32)) || input < -__pow(BigInt(2), BigInt(32))) {
1725
+ received = addNumericalSeparator(received);
1726
+ }
1727
+ received += "n";
1728
+ }
1729
+ msg += ` It must be ${range}. Received ${received}`;
1730
+ return msg;
1731
+ },
1732
+ RangeError
1733
+ );
1734
+ function addNumericalSeparator(val) {
1735
+ let res = "";
1736
+ let i = val.length;
1737
+ const start = val[0] === "-" ? 1 : 0;
1738
+ for (; i >= start + 4; i -= 3) {
1739
+ res = `_${val.slice(i - 3, i)}${res}`;
1740
+ }
1741
+ return `${val.slice(0, i)}${res}`;
1742
+ }
1743
+ function checkBounds(buf, offset, byteLength2) {
1744
+ validateNumber(offset, "offset");
1745
+ if (buf[offset] === void 0 || buf[offset + byteLength2] === void 0) {
1746
+ boundsError(offset, buf.length - (byteLength2 + 1));
1747
+ }
1748
+ }
1749
+ function checkIntBI(value, min, max, buf, offset, byteLength2) {
1750
+ if (value > max || value < min) {
1751
+ const n = typeof min === "bigint" ? "n" : "";
1752
+ let range;
1753
+ if (byteLength2 > 3) {
1754
+ if (min === 0 || min === BigInt(0)) {
1755
+ range = `>= 0${n} and < 2${n} ** ${(byteLength2 + 1) * 8}${n}`;
1756
+ } else {
1757
+ range = `>= -(2${n} ** ${(byteLength2 + 1) * 8 - 1}${n}) and < 2 ** ${(byteLength2 + 1) * 8 - 1}${n}`;
1758
+ }
1759
+ } else {
1760
+ range = `>= ${min}${n} and <= ${max}${n}`;
1761
+ }
1762
+ throw new errors.ERR_OUT_OF_RANGE("value", range, value);
1763
+ }
1764
+ checkBounds(buf, offset, byteLength2);
1765
+ }
1766
+ function validateNumber(value, name) {
1767
+ if (typeof value !== "number") {
1768
+ throw new errors.ERR_INVALID_ARG_TYPE(name, "number", value);
1769
+ }
1770
+ }
1771
+ function boundsError(value, length, type) {
1772
+ if (Math.floor(value) !== value) {
1773
+ validateNumber(value, type);
1774
+ throw new errors.ERR_OUT_OF_RANGE(type || "offset", "an integer", value);
1775
+ }
1776
+ if (length < 0) {
1777
+ throw new errors.ERR_BUFFER_OUT_OF_BOUNDS();
1778
+ }
1779
+ throw new errors.ERR_OUT_OF_RANGE(
1780
+ type || "offset",
1781
+ `>= ${type ? 1 : 0} and <= ${length}`,
1782
+ value
1783
+ );
1784
+ }
1785
+ var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
1786
+ function base64clean(str) {
1787
+ str = str.split("=")[0];
1788
+ str = str.trim().replace(INVALID_BASE64_RE, "");
1789
+ if (str.length < 2) return "";
1790
+ while (str.length % 4 !== 0) {
1791
+ str = str + "=";
1792
+ }
1793
+ return str;
1794
+ }
1795
+ function utf8ToBytes2(string2, units) {
1796
+ units = units || Infinity;
1797
+ let codePoint;
1798
+ const length = string2.length;
1799
+ let leadSurrogate = null;
1800
+ const bytes = [];
1801
+ for (let i = 0; i < length; ++i) {
1802
+ codePoint = string2.charCodeAt(i);
1803
+ if (codePoint > 55295 && codePoint < 57344) {
1804
+ if (!leadSurrogate) {
1805
+ if (codePoint > 56319) {
1806
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1807
+ continue;
1808
+ } else if (i + 1 === length) {
1809
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1810
+ continue;
1811
+ }
1812
+ leadSurrogate = codePoint;
1813
+ continue;
1814
+ }
1815
+ if (codePoint < 56320) {
1816
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1817
+ leadSurrogate = codePoint;
1818
+ continue;
1819
+ }
1820
+ codePoint = (leadSurrogate - 55296 << 10 | codePoint - 56320) + 65536;
1821
+ } else if (leadSurrogate) {
1822
+ if ((units -= 3) > -1) bytes.push(239, 191, 189);
1823
+ }
1824
+ leadSurrogate = null;
1825
+ if (codePoint < 128) {
1826
+ if ((units -= 1) < 0) break;
1827
+ bytes.push(codePoint);
1828
+ } else if (codePoint < 2048) {
1829
+ if ((units -= 2) < 0) break;
1830
+ bytes.push(
1831
+ codePoint >> 6 | 192,
1832
+ codePoint & 63 | 128
1833
+ );
1834
+ } else if (codePoint < 65536) {
1835
+ if ((units -= 3) < 0) break;
1836
+ bytes.push(
1837
+ codePoint >> 12 | 224,
1838
+ codePoint >> 6 & 63 | 128,
1839
+ codePoint & 63 | 128
1840
+ );
1841
+ } else if (codePoint < 1114112) {
1842
+ if ((units -= 4) < 0) break;
1843
+ bytes.push(
1844
+ codePoint >> 18 | 240,
1845
+ codePoint >> 12 & 63 | 128,
1846
+ codePoint >> 6 & 63 | 128,
1847
+ codePoint & 63 | 128
1848
+ );
1849
+ } else {
1850
+ throw new Error("Invalid code point");
1851
+ }
1852
+ }
1853
+ return bytes;
1854
+ }
1855
+ function asciiToBytes(str) {
1856
+ const byteArray = [];
1857
+ for (let i = 0; i < str.length; ++i) {
1858
+ byteArray.push(str.charCodeAt(i) & 255);
1859
+ }
1860
+ return byteArray;
1861
+ }
1862
+ function utf16leToBytes(str, units) {
1863
+ let c, hi, lo;
1864
+ const byteArray = [];
1865
+ for (let i = 0; i < str.length; ++i) {
1866
+ if ((units -= 2) < 0) break;
1867
+ c = str.charCodeAt(i);
1868
+ hi = c >> 8;
1869
+ lo = c % 256;
1870
+ byteArray.push(lo);
1871
+ byteArray.push(hi);
1872
+ }
1873
+ return byteArray;
1874
+ }
1875
+ function base64ToBytes(str) {
1876
+ return base642.toByteArray(base64clean(str));
1877
+ }
1878
+ function blitBuffer(src, dst, offset, length) {
1879
+ let i;
1880
+ for (i = 0; i < length; ++i) {
1881
+ if (i + offset >= dst.length || i >= src.length) break;
1882
+ dst[i + offset] = src[i];
1883
+ }
1884
+ return i;
1885
+ }
1886
+ function isInstance(obj, type) {
1887
+ return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name;
1888
+ }
1889
+ function numberIsNaN(obj) {
1890
+ return obj !== obj;
1891
+ }
1892
+ var hexSliceLookupTable = (function() {
1893
+ const alphabet = "0123456789abcdef";
1894
+ const table = new Array(256);
1895
+ for (let i = 0; i < 16; ++i) {
1896
+ const i16 = i * 16;
1897
+ for (let j = 0; j < 16; ++j) {
1898
+ table[i16 + j] = alphabet[i] + alphabet[j];
1899
+ }
1900
+ }
1901
+ return table;
1902
+ })();
1903
+ function defineBigIntMethod(fn) {
1904
+ return typeof BigInt === "undefined" ? BufferBigIntNotDefined : fn;
1905
+ }
1906
+ function BufferBigIntNotDefined() {
1907
+ throw new Error("BigInt not supported");
1908
+ }
1909
+ }
1910
+ });
1911
+
135
1912
  // ../../node_modules/eventemitter3/index.js
136
1913
  var require_eventemitter3 = __commonJS({
137
1914
  "../../node_modules/eventemitter3/index.js"(exports, module) {
@@ -19474,7 +21251,7 @@ var MetaMaskSDK = (() => {
19474
21251
  var reIsNative = RegExp2(
19475
21252
  "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
19476
21253
  );
19477
- var Buffer2 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
21254
+ var Buffer3 = moduleExports ? context.Buffer : undefined2, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer3 ? Buffer3.allocUnsafe : undefined2, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined2, symIterator = Symbol2 ? Symbol2.iterator : undefined2, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined2;
19478
21255
  var defineProperty = (function() {
19479
21256
  try {
19480
21257
  var func = getNative(Object2, "defineProperty");
@@ -19484,7 +21261,7 @@ var MetaMaskSDK = (() => {
19484
21261
  }
19485
21262
  })();
19486
21263
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date2 && Date2.now !== root.Date.now && Date2.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
19487
- var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
21264
+ var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer3 ? Buffer3.isBuffer : undefined2, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date2.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
19488
21265
  var DataView2 = getNative(context, "DataView"), Map2 = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set2 = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
19489
21266
  var metaMap = WeakMap2 && new WeakMap2();
19490
21267
  var realNames = {};
@@ -25097,12 +26874,12 @@ var MetaMaskSDK = (() => {
25097
26874
  })();
25098
26875
  (function(globalThis2) {
25099
26876
  var irrelevant = (function(exports2) {
25100
- var g = typeof globalThis2 !== "undefined" && globalThis2 || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
26877
+ var g2 = typeof globalThis2 !== "undefined" && globalThis2 || typeof self !== "undefined" && self || // eslint-disable-next-line no-undef
25101
26878
  typeof global !== "undefined" && global || {};
25102
26879
  var support = {
25103
- searchParams: "URLSearchParams" in g,
25104
- iterable: "Symbol" in g && "iterator" in Symbol,
25105
- blob: "FileReader" in g && "Blob" in g && (function() {
26880
+ searchParams: "URLSearchParams" in g2,
26881
+ iterable: "Symbol" in g2 && "iterator" in Symbol,
26882
+ blob: "FileReader" in g2 && "Blob" in g2 && (function() {
25106
26883
  try {
25107
26884
  new Blob();
25108
26885
  return true;
@@ -25110,8 +26887,8 @@ var MetaMaskSDK = (() => {
25110
26887
  return false;
25111
26888
  }
25112
26889
  })(),
25113
- formData: "FormData" in g,
25114
- arrayBuffer: "ArrayBuffer" in g
26890
+ formData: "FormData" in g2,
26891
+ arrayBuffer: "ArrayBuffer" in g2
25115
26892
  };
25116
26893
  function isDataView(obj) {
25117
26894
  return obj && DataView.prototype.isPrototypeOf(obj);
@@ -25412,7 +27189,7 @@ var MetaMaskSDK = (() => {
25412
27189
  this.method = normalizeMethod(options.method || this.method || "GET");
25413
27190
  this.mode = options.mode || this.mode || null;
25414
27191
  this.signal = options.signal || this.signal || (function() {
25415
- if ("AbortController" in g) {
27192
+ if ("AbortController" in g2) {
25416
27193
  var ctrl = new AbortController();
25417
27194
  return ctrl.signal;
25418
27195
  }
@@ -25510,7 +27287,7 @@ var MetaMaskSDK = (() => {
25510
27287
  }
25511
27288
  return new Response2(null, { status, headers: { location: url } });
25512
27289
  };
25513
- exports2.DOMException = g.DOMException;
27290
+ exports2.DOMException = g2.DOMException;
25514
27291
  try {
25515
27292
  new exports2.DOMException();
25516
27293
  } catch (err3) {
@@ -25566,7 +27343,7 @@ var MetaMaskSDK = (() => {
25566
27343
  };
25567
27344
  function fixUrl(url) {
25568
27345
  try {
25569
- return url === "" && g.location.href ? g.location.href : url;
27346
+ return url === "" && g2.location.href ? g2.location.href : url;
25570
27347
  } catch (e) {
25571
27348
  return url;
25572
27349
  }
@@ -25584,7 +27361,7 @@ var MetaMaskSDK = (() => {
25584
27361
  xhr.responseType = "arraybuffer";
25585
27362
  }
25586
27363
  }
25587
- if (init && typeof init.headers === "object" && !(init.headers instanceof Headers2 || g.Headers && init.headers instanceof g.Headers)) {
27364
+ if (init && typeof init.headers === "object" && !(init.headers instanceof Headers2 || g2.Headers && init.headers instanceof g2.Headers)) {
25588
27365
  var names = [];
25589
27366
  Object.getOwnPropertyNames(init.headers).forEach(function(name) {
25590
27367
  names.push(normalizeName(name));
@@ -25612,11 +27389,11 @@ var MetaMaskSDK = (() => {
25612
27389
  });
25613
27390
  }
25614
27391
  fetch3.polyfill = true;
25615
- if (!g.fetch) {
25616
- g.fetch = fetch3;
25617
- g.Headers = Headers2;
25618
- g.Request = Request;
25619
- g.Response = Response2;
27392
+ if (!g2.fetch) {
27393
+ g2.fetch = fetch3;
27394
+ g2.Headers = Headers2;
27395
+ g2.Request = Request;
27396
+ g2.Response = Response2;
25620
27397
  }
25621
27398
  exports2.Headers = Headers2;
25622
27399
  exports2.Request = Request;
@@ -31381,9 +33158,9 @@ var MetaMaskSDK = (() => {
31381
33158
  const nonceLen = EMPTY_BLOCK.slice();
31382
33159
  const view = (0, utils_ts_1.createView)(nonceLen);
31383
33160
  (0, utils_ts_1.setBigUint64)(view, 8, BigInt(nonce.length * 8), false);
31384
- const g = _polyval_ts_1.ghash.create(authKey).update(nonce).update(nonceLen);
31385
- g.digestInto(counter);
31386
- g.destroy();
33161
+ const g2 = _polyval_ts_1.ghash.create(authKey).update(nonce).update(nonceLen);
33162
+ g2.digestInto(counter);
33163
+ g2.destroy();
31387
33164
  }
31388
33165
  const tagMask = ctr32(xk, false, counter, EMPTY_BLOCK);
31389
33166
  return { xk, authKey, counter, tagMask };
@@ -31943,7 +33720,7 @@ var MetaMaskSDK = (() => {
31943
33720
  }
31944
33721
  finalize() {
31945
33722
  const { h: h2, pad } = this;
31946
- const g = new Uint16Array(10);
33723
+ const g2 = new Uint16Array(10);
31947
33724
  let c = h2[1] >>> 13;
31948
33725
  h2[1] &= 8191;
31949
33726
  for (let i = 2; i < 10; i++) {
@@ -31958,21 +33735,21 @@ var MetaMaskSDK = (() => {
31958
33735
  c = h2[1] >>> 13;
31959
33736
  h2[1] &= 8191;
31960
33737
  h2[2] += c;
31961
- g[0] = h2[0] + 5;
31962
- c = g[0] >>> 13;
31963
- g[0] &= 8191;
33738
+ g2[0] = h2[0] + 5;
33739
+ c = g2[0] >>> 13;
33740
+ g2[0] &= 8191;
31964
33741
  for (let i = 1; i < 10; i++) {
31965
- g[i] = h2[i] + c;
31966
- c = g[i] >>> 13;
31967
- g[i] &= 8191;
33742
+ g2[i] = h2[i] + c;
33743
+ c = g2[i] >>> 13;
33744
+ g2[i] &= 8191;
31968
33745
  }
31969
- g[9] -= 1 << 13;
33746
+ g2[9] -= 1 << 13;
31970
33747
  let mask2 = (c ^ 1) - 1;
31971
33748
  for (let i = 0; i < 10; i++)
31972
- g[i] &= mask2;
33749
+ g2[i] &= mask2;
31973
33750
  mask2 = ~mask2;
31974
33751
  for (let i = 0; i < 10; i++)
31975
- h2[i] = h2[i] & mask2 | g[i];
33752
+ h2[i] = h2[i] & mask2 | g2[i];
31976
33753
  h2[0] = (h2[0] | h2[1] << 13) & 65535;
31977
33754
  h2[1] = (h2[1] >>> 3 | h2[2] << 10) & 65535;
31978
33755
  h2[2] = (h2[2] >>> 6 | h2[3] << 7) & 65535;
@@ -31987,7 +33764,7 @@ var MetaMaskSDK = (() => {
31987
33764
  f = (h2[i] + pad[i] | 0) + (f >>> 16) | 0;
31988
33765
  h2[i] = f & 65535;
31989
33766
  }
31990
- (0, utils_ts_1.clean)(g);
33767
+ (0, utils_ts_1.clean)(g2);
31991
33768
  }
31992
33769
  update(data) {
31993
33770
  (0, utils_ts_1.aexists)(this);
@@ -32942,8 +34719,8 @@ var MetaMaskSDK = (() => {
32942
34719
  r6 = Math.max(r6, u2), n5 = Math.max(n5, c2), o4[h5] = new Array(u2);
32943
34720
  for (var l2 = 0; l2 < o4[h5].length; l2 += 1) o4[h5][l2] = 255 & t6.getBuffer()[l2 + i6];
32944
34721
  i6 += u2;
32945
- var g2 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h5], g2.getLength() - 1).mod(g2);
32946
- for (s3[h5] = new Array(g2.getLength() - 1), l2 = 0; l2 < s3[h5].length; l2 += 1) {
34722
+ var g3 = a.getErrorCorrectPolynomial(c2), f2 = d(o4[h5], g3.getLength() - 1).mod(g3);
34723
+ for (s3[h5] = new Array(g3.getLength() - 1), l2 = 0; l2 < s3[h5].length; l2 += 1) {
32947
34724
  var w2 = l2 + f2.getLength() - s3[h5].length;
32948
34725
  s3[h5][l2] = w2 >= 0 ? f2.getAt(w2) : 0;
32949
34726
  }
@@ -32963,7 +34740,7 @@ var MetaMaskSDK = (() => {
32963
34740
  i5 = l(t5);
32964
34741
  break;
32965
34742
  case "Alphanumeric":
32966
- i5 = g(t5);
34743
+ i5 = g2(t5);
32967
34744
  break;
32968
34745
  case "Byte":
32969
34746
  i5 = f(t5);
@@ -33302,7 +35079,7 @@ var MetaMaskSDK = (() => {
33302
35079
  throw "illegal char :" + t5;
33303
35080
  };
33304
35081
  return i4;
33305
- }, g = function(t4) {
35082
+ }, g2 = function(t4) {
33306
35083
  var e4 = t4, i4 = { getMode: function() {
33307
35084
  return 2;
33308
35085
  }, getLength: function(t5) {
@@ -33432,10 +35209,10 @@ var MetaMaskSDK = (() => {
33432
35209
  d3 > 0 && h4.writeByte(u2);
33433
35210
  } });
33434
35211
  l2.write(e6, r6);
33435
- var g2 = 0, f2 = String.fromCharCode(n4[g2]);
33436
- for (g2 += 1; g2 < n4.length; ) {
33437
- var w2 = String.fromCharCode(n4[g2]);
33438
- g2 += 1, o4.contains(f2 + w2) ? f2 += w2 : (l2.write(o4.indexOf(f2), r6), o4.size() < 4095 && (o4.size() == 1 << r6 && (r6 += 1), o4.add(f2 + w2)), f2 = w2);
35212
+ var g3 = 0, f2 = String.fromCharCode(n4[g3]);
35213
+ for (g3 += 1; g3 < n4.length; ) {
35214
+ var w2 = String.fromCharCode(n4[g3]);
35215
+ g3 += 1, o4.contains(f2 + w2) ? f2 += w2 : (l2.write(o4.indexOf(f2), r6), o4.size() < 4095 && (o4.size() == 1 << r6 && (r6 += 1), o4.add(f2 + w2)), f2 = w2);
33439
35216
  }
33440
35217
  return l2.write(o4.indexOf(f2), r6), l2.write(i6, r6), l2.flush(), c2.toByteArray();
33441
35218
  }, a3 = function() {
@@ -33720,7 +35497,7 @@ var MetaMaskSDK = (() => {
33720
35497
  this._basicSquare({ x: t3, y: e3, size: i2, rotation: r2 });
33721
35498
  }
33722
35499
  }
33723
- const g = "circle", f = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], w = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
35500
+ const g2 = "circle", f = [[1, 1, 1, 1, 1, 1, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 1, 1]], w = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
33724
35501
  class p {
33725
35502
  constructor(t3, e3) {
33726
35503
  this._roundSize = (t4) => this._options.dotsOptions.roundSize ? Math.floor(t4) : t4, this._window = e3, this._element = this._window.document.createElementNS("http://www.w3.org/2000/svg", "svg"), this._element.setAttribute("width", String(t3.width)), this._element.setAttribute("height", String(t3.height)), this._element.setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"), t3.dotsOptions.roundSize || this._element.setAttribute("shape-rendering", "crispEdges"), this._element.setAttribute("viewBox", `0 0 ${t3.width} ${t3.height}`), this._defs = this._window.document.createElementNS("http://www.w3.org/2000/svg", "defs"), this._element.appendChild(this._defs), this._imageUri = t3.image, this._instanceId = p.instanceCount++, this._options = t3;
@@ -33736,7 +35513,7 @@ var MetaMaskSDK = (() => {
33736
35513
  }
33737
35514
  drawQR(t3) {
33738
35515
  return __async(this, null, function* () {
33739
- const e3 = t3.getModuleCount(), i2 = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r2 = this._options.shape === g ? i2 / Math.sqrt(2) : i2, n2 = this._roundSize(r2 / e3);
35516
+ const e3 = t3.getModuleCount(), i2 = Math.min(this._options.width, this._options.height) - 2 * this._options.margin, r2 = this._options.shape === g2 ? i2 / Math.sqrt(2) : i2, n2 = this._roundSize(r2 / e3);
33740
35517
  let s2 = { hideXDots: 0, hideYDots: 0, width: 0, height: 0 };
33741
35518
  if (this._qr = t3, this._options.image) {
33742
35519
  if (yield this.loadImage(), !this._image) return;
@@ -33771,10 +35548,10 @@ var MetaMaskSDK = (() => {
33771
35548
  if (!this._qr) throw "QR code is not defined";
33772
35549
  const r2 = this._options, n2 = this._qr.getModuleCount();
33773
35550
  if (n2 > r2.width || n2 > r2.height) throw "The canvas is too small.";
33774
- const o2 = Math.min(r2.width, r2.height) - 2 * r2.margin, a2 = r2.shape === g ? o2 / Math.sqrt(2) : o2, h3 = this._roundSize(a2 / n2), d2 = this._roundSize((r2.width - n2 * h3) / 2), u2 = this._roundSize((r2.height - n2 * h3) / 2), c2 = new s({ svg: this._element, type: r2.dotsOptions.type, window: this._window });
35551
+ const o2 = Math.min(r2.width, r2.height) - 2 * r2.margin, a2 = r2.shape === g2 ? o2 / Math.sqrt(2) : o2, h3 = this._roundSize(a2 / n2), d2 = this._roundSize((r2.width - n2 * h3) / 2), u2 = this._roundSize((r2.height - n2 * h3) / 2), c2 = new s({ svg: this._element, type: r2.dotsOptions.type, window: this._window });
33775
35552
  this._dotsClipPath = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), this._dotsClipPath.setAttribute("id", `clip-path-dot-color-${this._instanceId}`), this._defs.appendChild(this._dotsClipPath), this._createColor({ options: null === (e3 = r2.dotsOptions) || void 0 === e3 ? void 0 : e3.gradient, color: r2.dotsOptions.color, additionalRotation: 0, x: 0, y: 0, height: r2.height, width: r2.width, name: `dot-color-${this._instanceId}` });
33776
35553
  for (let e4 = 0; e4 < n2; e4++) for (let r3 = 0; r3 < n2; r3++) t3 && !t3(e4, r3) || (null === (i2 = this._qr) || void 0 === i2 ? void 0 : i2.isDark(e4, r3)) && (c2.draw(d2 + r3 * h3, u2 + e4 * h3, h3, ((i3, o3) => !(r3 + i3 < 0 || e4 + o3 < 0 || r3 + i3 >= n2 || e4 + o3 >= n2) && !(t3 && !t3(e4 + o3, r3 + i3)) && !!this._qr && this._qr.isDark(e4 + o3, r3 + i3))), c2._element && this._dotsClipPath && this._dotsClipPath.appendChild(c2._element));
33777
- if (r2.shape === g) {
35554
+ if (r2.shape === g2) {
33778
35555
  const t4 = this._roundSize((o2 / h3 - n2) / 2), e4 = n2 + 2 * t4, i3 = d2 - t4 * h3, r3 = u2 - t4 * h3, s2 = [], a3 = this._roundSize(e4 / 2);
33779
35556
  for (let i4 = 0; i4 < e4; i4++) {
33780
35557
  s2[i4] = [];
@@ -33790,12 +35567,12 @@ var MetaMaskSDK = (() => {
33790
35567
  if (!this._qr) throw "QR code is not defined";
33791
35568
  const t3 = this._element, e3 = this._options;
33792
35569
  if (!t3) throw "Element code is not defined";
33793
- const i2 = this._qr.getModuleCount(), r2 = Math.min(e3.width, e3.height) - 2 * e3.margin, n2 = e3.shape === g ? r2 / Math.sqrt(2) : r2, o2 = this._roundSize(n2 / i2), a2 = 7 * o2, u2 = 3 * o2, p2 = this._roundSize((e3.width - i2 * o2) / 2), v2 = this._roundSize((e3.height - i2 * o2) / 2);
35570
+ const i2 = this._qr.getModuleCount(), r2 = Math.min(e3.width, e3.height) - 2 * e3.margin, n2 = e3.shape === g2 ? r2 / Math.sqrt(2) : r2, o2 = this._roundSize(n2 / i2), a2 = 7 * o2, u2 = 3 * o2, p2 = this._roundSize((e3.width - i2 * o2) / 2), v2 = this._roundSize((e3.height - i2 * o2) / 2);
33794
35571
  [[0, 0, 0], [1, 0, Math.PI / 2], [0, 1, -Math.PI / 2]].forEach((([t4, r3, n3]) => {
33795
- var g2, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
35572
+ var g3, _2, m2, b2, y2, x2, S2, C2, A2, M2, $2, O, D, k;
33796
35573
  const z = p2 + t4 * o2 * (i2 - 7), B = v2 + r3 * o2 * (i2 - 7);
33797
35574
  let P = this._dotsClipPath, I = this._dotsClipPath;
33798
- if (((null === (g2 = e3.cornersSquareOptions) || void 0 === g2 ? void 0 : g2.gradient) || (null === (_2 = e3.cornersSquareOptions) || void 0 === _2 ? void 0 : _2.color)) && (P = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", `clip-path-corners-square-color-${t4}-${r3}-${this._instanceId}`), this._defs.appendChild(P), this._cornersSquareClipPath = this._cornersDotClipPath = I = P, this._createColor({ options: null === (m2 = e3.cornersSquareOptions) || void 0 === m2 ? void 0 : m2.gradient, color: null === (b2 = e3.cornersSquareOptions) || void 0 === b2 ? void 0 : b2.color, additionalRotation: n3, x: z, y: B, height: a2, width: a2, name: `corners-square-color-${t4}-${r3}-${this._instanceId}` })), (null === (y2 = e3.cornersSquareOptions) || void 0 === y2 ? void 0 : y2.type) && h2.includes(e3.cornersSquareOptions.type)) {
35575
+ if (((null === (g3 = e3.cornersSquareOptions) || void 0 === g3 ? void 0 : g3.gradient) || (null === (_2 = e3.cornersSquareOptions) || void 0 === _2 ? void 0 : _2.color)) && (P = this._window.document.createElementNS("http://www.w3.org/2000/svg", "clipPath"), P.setAttribute("id", `clip-path-corners-square-color-${t4}-${r3}-${this._instanceId}`), this._defs.appendChild(P), this._cornersSquareClipPath = this._cornersDotClipPath = I = P, this._createColor({ options: null === (m2 = e3.cornersSquareOptions) || void 0 === m2 ? void 0 : m2.gradient, color: null === (b2 = e3.cornersSquareOptions) || void 0 === b2 ? void 0 : b2.color, additionalRotation: n3, x: z, y: B, height: a2, width: a2, name: `corners-square-color-${t4}-${r3}-${this._instanceId}` })), (null === (y2 = e3.cornersSquareOptions) || void 0 === y2 ? void 0 : y2.type) && h2.includes(e3.cornersSquareOptions.type)) {
33799
35576
  const t5 = new d({ svg: this._element, type: e3.cornersSquareOptions.type, window: this._window });
33800
35577
  t5.draw(z, B, a2, n3), t5._element && P && P.appendChild(t5._element);
33801
35578
  } else {
@@ -33863,8 +35640,8 @@ var MetaMaskSDK = (() => {
33863
35640
  if ("radial" === t3.type) e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "radialGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("fx", String(r2 + s2 / 2)), e4.setAttribute("fy", String(n2 + o2 / 2)), e4.setAttribute("cx", String(r2 + s2 / 2)), e4.setAttribute("cy", String(n2 + o2 / 2)), e4.setAttribute("r", String(h3 / 2));
33864
35641
  else {
33865
35642
  const h4 = ((t3.rotation || 0) + i2) % (2 * Math.PI), d3 = (h4 + 2 * Math.PI) % (2 * Math.PI);
33866
- let u2 = r2 + s2 / 2, c2 = n2 + o2 / 2, l2 = r2 + s2 / 2, g2 = n2 + o2 / 2;
33867
- d3 >= 0 && d3 <= 0.25 * Math.PI || d3 > 1.75 * Math.PI && d3 <= 2 * Math.PI ? (u2 -= s2 / 2, c2 -= o2 / 2 * Math.tan(h4), l2 += s2 / 2, g2 += o2 / 2 * Math.tan(h4)) : d3 > 0.25 * Math.PI && d3 <= 0.75 * Math.PI ? (c2 -= o2 / 2, u2 -= s2 / 2 / Math.tan(h4), g2 += o2 / 2, l2 += s2 / 2 / Math.tan(h4)) : d3 > 0.75 * Math.PI && d3 <= 1.25 * Math.PI ? (u2 += s2 / 2, c2 += o2 / 2 * Math.tan(h4), l2 -= s2 / 2, g2 -= o2 / 2 * Math.tan(h4)) : d3 > 1.25 * Math.PI && d3 <= 1.75 * Math.PI && (c2 += o2 / 2, u2 += s2 / 2 / Math.tan(h4), g2 -= o2 / 2, l2 -= s2 / 2 / Math.tan(h4)), e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("x1", String(Math.round(u2))), e4.setAttribute("y1", String(Math.round(c2))), e4.setAttribute("x2", String(Math.round(l2))), e4.setAttribute("y2", String(Math.round(g2)));
35643
+ let u2 = r2 + s2 / 2, c2 = n2 + o2 / 2, l2 = r2 + s2 / 2, g3 = n2 + o2 / 2;
35644
+ d3 >= 0 && d3 <= 0.25 * Math.PI || d3 > 1.75 * Math.PI && d3 <= 2 * Math.PI ? (u2 -= s2 / 2, c2 -= o2 / 2 * Math.tan(h4), l2 += s2 / 2, g3 += o2 / 2 * Math.tan(h4)) : d3 > 0.25 * Math.PI && d3 <= 0.75 * Math.PI ? (c2 -= o2 / 2, u2 -= s2 / 2 / Math.tan(h4), g3 += o2 / 2, l2 += s2 / 2 / Math.tan(h4)) : d3 > 0.75 * Math.PI && d3 <= 1.25 * Math.PI ? (u2 += s2 / 2, c2 += o2 / 2 * Math.tan(h4), l2 -= s2 / 2, g3 -= o2 / 2 * Math.tan(h4)) : d3 > 1.25 * Math.PI && d3 <= 1.75 * Math.PI && (c2 += o2 / 2, u2 += s2 / 2 / Math.tan(h4), g3 -= o2 / 2, l2 -= s2 / 2 / Math.tan(h4)), e4 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "linearGradient"), e4.setAttribute("id", a2), e4.setAttribute("gradientUnits", "userSpaceOnUse"), e4.setAttribute("x1", String(Math.round(u2))), e4.setAttribute("y1", String(Math.round(c2))), e4.setAttribute("x2", String(Math.round(l2))), e4.setAttribute("y2", String(Math.round(g3)));
33868
35645
  }
33869
35646
  t3.colorStops.forEach((({ offset: t4, color: i3 }) => {
33870
35647
  const r3 = this._window.document.createElementNS("http://www.w3.org/2000/svg", "stop");
@@ -35927,6 +37704,13 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
35927
37704
  isSecure: () => isSecure
35928
37705
  });
35929
37706
 
37707
+ // src/polyfills/buffer-shim.ts
37708
+ var import_buffer = __toESM(require_buffer());
37709
+ var g = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {};
37710
+ if (!g.Buffer) {
37711
+ g.Buffer = import_buffer.Buffer;
37712
+ }
37713
+
35930
37714
  // ../../node_modules/openapi-fetch/dist/index.js
35931
37715
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
35932
37716
  var supportsRequestInitExt = () => {
@@ -38265,15 +40049,15 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38265
40049
  };
38266
40050
  var _MultichainApiClientWrapperTransport_instances, walletCreateSession_fn, walletGetSession_fn, walletRevokeSession_fn, walletInvokeMethod_fn;
38267
40051
  var MultichainApiClientWrapperTransport = class {
38268
- constructor(multichainSDK) {
38269
- this.multichainSDK = multichainSDK;
40052
+ constructor(metamaskConnectMultichain) {
40053
+ this.metamaskConnectMultichain = metamaskConnectMultichain;
38270
40054
  __privateAdd(this, _MultichainApiClientWrapperTransport_instances);
38271
40055
  this.requestId = getUniqueId2();
38272
40056
  this.notificationCallbacks = /* @__PURE__ */ new Set();
38273
40057
  }
38274
40058
  isTransportDefined() {
38275
40059
  try {
38276
- return Boolean(this.multichainSDK.transport);
40060
+ return Boolean(this.metamaskConnectMultichain.transport);
38277
40061
  } catch (error) {
38278
40062
  return false;
38279
40063
  }
@@ -38287,7 +40071,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38287
40071
  });
38288
40072
  }
38289
40073
  setupNotifcationListener() {
38290
- this.multichainSDK.transport.onNotification(
40074
+ this.metamaskConnectMultichain.transport.onNotification(
38291
40075
  this.notifyCallbacks.bind(this)
38292
40076
  );
38293
40077
  }
@@ -38334,7 +40118,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38334
40118
  this.notificationCallbacks.delete(callback);
38335
40119
  };
38336
40120
  }
38337
- return this.multichainSDK.transport.onNotification(callback);
40121
+ return this.metamaskConnectMultichain.transport.onNotification(callback);
38338
40122
  }
38339
40123
  };
38340
40124
  _MultichainApiClientWrapperTransport_instances = new WeakSet();
@@ -38357,13 +40141,13 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38357
40141
  });
38358
40142
  const accounts = [...new Set(scopeAccounts)];
38359
40143
  console.log("\u{1F4DA} SDK connect");
38360
- yield this.multichainSDK.connect(
40144
+ yield this.metamaskConnectMultichain.connect(
38361
40145
  scopes,
38362
40146
  accounts,
38363
40147
  createSessionParams.sessionProperties
38364
40148
  );
38365
40149
  console.log("\u{1F4DA} SDK connected");
38366
- return this.multichainSDK.transport.request({
40150
+ return this.metamaskConnectMultichain.transport.request({
38367
40151
  method: "wallet_getSession"
38368
40152
  });
38369
40153
  });
@@ -38379,7 +40163,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38379
40163
  }
38380
40164
  };
38381
40165
  }
38382
- return this.multichainSDK.transport.request({
40166
+ return this.metamaskConnectMultichain.transport.request({
38383
40167
  method: "wallet_getSession"
38384
40168
  });
38385
40169
  });
@@ -38390,7 +40174,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38390
40174
  return { jsonrpc: "2.0", id: request2.id, result: true };
38391
40175
  }
38392
40176
  try {
38393
- this.multichainSDK.disconnect();
40177
+ this.metamaskConnectMultichain.disconnect();
38394
40178
  return { jsonrpc: "2.0", id: request2.id, result: true };
38395
40179
  } catch (error) {
38396
40180
  return { jsonrpc: "2.0", id: request2.id, result: false };
@@ -38402,7 +40186,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38402
40186
  if (!this.isTransportDefined()) {
38403
40187
  return { error: providerErrors.unauthorized() };
38404
40188
  }
38405
- const result = this.multichainSDK.invokeMethod(
40189
+ const result = this.metamaskConnectMultichain.invokeMethod(
38406
40190
  request2.params
38407
40191
  );
38408
40192
  return {
@@ -38413,8 +40197,8 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38413
40197
 
38414
40198
  // src/multichain/index.ts
38415
40199
  var logger2 = createLogger("metamask-sdk:core");
38416
- var _a2, _provider, _providerTransportWrapper, _transport2, _dappClient, _beforeUnloadListener, _listener, _sdkInfo, _MultichainSDK_instances, setupAnalytics_fn, onTransportNotification_fn, getStoredTransport_fn, setupTransport_fn, init_fn, createDappClient_fn, setupMWP_fn, onBeforeUnload_fn, createBeforeUnloadListener_fn, renderInstallModalAsync_fn, showInstallModal_fn, headlessConnect_fn, setupDefaultTransport_fn, deeplinkConnect_fn, handleConnection_fn;
38417
- var _MultichainSDK = class _MultichainSDK extends MultichainCore {
40200
+ var _a2, _provider, _providerTransportWrapper, _transport2, _dappClient, _beforeUnloadListener, _listener, _sdkInfo, _MetaMaskConnectMultichain_instances, setupAnalytics_fn, onTransportNotification_fn, getStoredTransport_fn, setupTransport_fn, init_fn, createDappClient_fn, setupMWP_fn, onBeforeUnload_fn, createBeforeUnloadListener_fn, renderInstallModalAsync_fn, showInstallModal_fn, headlessConnect_fn, setupDefaultTransport_fn, deeplinkConnect_fn, handleConnection_fn;
40201
+ var _MetaMaskConnectMultichain = class _MetaMaskConnectMultichain extends MultichainCore {
38418
40202
  constructor(options) {
38419
40203
  var _a3, _b, _c, _d, _e, _f;
38420
40204
  const withDappMetadata = setupDappMetadata(options);
@@ -38430,7 +40214,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38430
40214
  })
38431
40215
  });
38432
40216
  super(allOptions);
38433
- __privateAdd(this, _MultichainSDK_instances);
40217
+ __privateAdd(this, _MetaMaskConnectMultichain_instances);
38434
40218
  __privateAdd(this, _provider);
38435
40219
  __privateAdd(this, _providerTransportWrapper);
38436
40220
  __privateAdd(this, _transport2);
@@ -38477,7 +40261,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38477
40261
  static create(options) {
38478
40262
  return __async(this, null, function* () {
38479
40263
  var _a3;
38480
- const instance2 = new _MultichainSDK(options);
40264
+ const instance2 = new _MetaMaskConnectMultichain(options);
38481
40265
  const isEnabled2 = yield isEnabled(
38482
40266
  "metamask-sdk:core",
38483
40267
  instance2.options.storage
@@ -38485,7 +40269,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38485
40269
  if (isEnabled2) {
38486
40270
  enableDebug("metamask-sdk:core");
38487
40271
  }
38488
- yield __privateMethod(_a3 = instance2, _MultichainSDK_instances, init_fn).call(_a3);
40272
+ yield __privateMethod(_a3 = instance2, _MetaMaskConnectMultichain_instances, init_fn).call(_a3);
38489
40273
  return instance2;
38490
40274
  });
38491
40275
  }
@@ -38524,8 +40308,9 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38524
40308
  } catch (error) {
38525
40309
  logger2("Error tracking connection_initiated event", error);
38526
40310
  }
40311
+ const nonEmptySessionProperites = Object.keys(sessionProperties != null ? sessionProperties : {}).length > 0 ? sessionProperties : void 0;
38527
40312
  if (((_a3 = __privateGet(this, _transport2)) == null ? void 0 : _a3.isConnected()) && !secure) {
38528
- return __privateMethod(this, _MultichainSDK_instances, handleConnection_fn).call(this, __privateGet(this, _transport2).connect({ scopes, caipAccountIds, sessionProperties, forceRequest }).then(() => __async(this, null, function* () {
40313
+ return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, __privateGet(this, _transport2).connect({ scopes, caipAccountIds, sessionProperties: nonEmptySessionProperites, forceRequest }).then(() => __async(this, null, function* () {
38529
40314
  if (__privateGet(this, _transport2) instanceof MWPTransport) {
38530
40315
  return this.storage.setTransport("mwp" /* MWP */);
38531
40316
  }
@@ -38533,19 +40318,19 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38533
40318
  })), scopes, transportType);
38534
40319
  }
38535
40320
  if (platformType === "in-app-browser" /* MetaMaskMobileWebview */) {
38536
- const defaultTransport = yield __privateMethod(this, _MultichainSDK_instances, setupDefaultTransport_fn).call(this);
38537
- return __privateMethod(this, _MultichainSDK_instances, handleConnection_fn).call(this, defaultTransport.connect({ scopes, caipAccountIds, sessionProperties, forceRequest }), scopes, transportType);
40321
+ const defaultTransport = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupDefaultTransport_fn).call(this);
40322
+ return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, defaultTransport.connect({ scopes, caipAccountIds, sessionProperties: nonEmptySessionProperites, forceRequest }), scopes, transportType);
38538
40323
  }
38539
40324
  if (isWeb && hasExtensionInstalled && preferExtension) {
38540
- const defaultTransport = yield __privateMethod(this, _MultichainSDK_instances, setupDefaultTransport_fn).call(this);
38541
- return __privateMethod(this, _MultichainSDK_instances, handleConnection_fn).call(this, defaultTransport.connect({ scopes, caipAccountIds, sessionProperties, forceRequest }), scopes, transportType);
40325
+ const defaultTransport = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupDefaultTransport_fn).call(this);
40326
+ return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, defaultTransport.connect({ scopes, caipAccountIds, sessionProperties: nonEmptySessionProperites, forceRequest }), scopes, transportType);
38542
40327
  }
38543
- yield __privateMethod(this, _MultichainSDK_instances, setupMWP_fn).call(this);
40328
+ yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupMWP_fn).call(this);
38544
40329
  const shouldShowInstallModal = hasExtensionInstalled ? showInstallModal : !preferExtension || showInstallModal;
38545
40330
  if (secure && !shouldShowInstallModal) {
38546
- return __privateMethod(this, _MultichainSDK_instances, handleConnection_fn).call(this, __privateMethod(this, _MultichainSDK_instances, deeplinkConnect_fn).call(this, scopes, caipAccountIds, sessionProperties), scopes, transportType);
40331
+ return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, __privateMethod(this, _MetaMaskConnectMultichain_instances, deeplinkConnect_fn).call(this, scopes, caipAccountIds, nonEmptySessionProperites), scopes, transportType);
38547
40332
  }
38548
- return __privateMethod(this, _MultichainSDK_instances, handleConnection_fn).call(this, __privateMethod(this, _MultichainSDK_instances, showInstallModal_fn).call(this, shouldShowInstallModal, scopes, caipAccountIds, sessionProperties), scopes, transportType);
40333
+ return __privateMethod(this, _MetaMaskConnectMultichain_instances, handleConnection_fn).call(this, __privateMethod(this, _MetaMaskConnectMultichain_instances, showInstallModal_fn).call(this, shouldShowInstallModal, scopes, caipAccountIds, nonEmptySessionProperites), scopes, transportType);
38549
40334
  });
38550
40335
  }
38551
40336
  emit(event, args) {
@@ -38605,7 +40390,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38605
40390
  _beforeUnloadListener = new WeakMap();
38606
40391
  _listener = new WeakMap();
38607
40392
  _sdkInfo = new WeakMap();
38608
- _MultichainSDK_instances = new WeakSet();
40393
+ _MetaMaskConnectMultichain_instances = new WeakSet();
38609
40394
  setupAnalytics_fn = function() {
38610
40395
  return __async(this, null, function* () {
38611
40396
  var _a3;
@@ -38648,19 +40433,19 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38648
40433
  __privateSet(this, _transport2, apiTransport);
38649
40434
  __privateGet(this, _providerTransportWrapper).setupNotifcationListener();
38650
40435
  __privateSet(this, _listener, apiTransport.onNotification(
38651
- __privateMethod(this, _MultichainSDK_instances, onTransportNotification_fn).bind(this)
40436
+ __privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
38652
40437
  ));
38653
40438
  return apiTransport;
38654
40439
  }
38655
40440
  } else if (transportType === "mwp" /* MWP */) {
38656
40441
  const { adapter: kvstore } = this.options.storage;
38657
- const dappClient = yield __privateMethod(this, _MultichainSDK_instances, createDappClient_fn).call(this);
40442
+ const dappClient = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, createDappClient_fn).call(this);
38658
40443
  const apiTransport = new MWPTransport(dappClient, kvstore);
38659
40444
  __privateSet(this, _dappClient, dappClient);
38660
40445
  __privateSet(this, _transport2, apiTransport);
38661
40446
  __privateGet(this, _providerTransportWrapper).setupNotifcationListener();
38662
40447
  __privateSet(this, _listener, apiTransport.onNotification(
38663
- __privateMethod(this, _MultichainSDK_instances, onTransportNotification_fn).bind(this)
40448
+ __privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
38664
40449
  ));
38665
40450
  return apiTransport;
38666
40451
  }
@@ -38671,7 +40456,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38671
40456
  };
38672
40457
  setupTransport_fn = function() {
38673
40458
  return __async(this, null, function* () {
38674
- const transport = yield __privateMethod(this, _MultichainSDK_instances, getStoredTransport_fn).call(this);
40459
+ const transport = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, getStoredTransport_fn).call(this);
38675
40460
  if (transport) {
38676
40461
  if (!this.transport.isConnected()) {
38677
40462
  this.status = "connecting";
@@ -38695,8 +40480,8 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38695
40480
  if (typeof window !== "undefined" && ((_a3 = window.mmsdk) == null ? void 0 : _a3.isInitialized)) {
38696
40481
  logger2("MetaMaskSDK: init already initialized");
38697
40482
  } else {
38698
- yield __privateMethod(this, _MultichainSDK_instances, setupAnalytics_fn).call(this);
38699
- yield __privateMethod(this, _MultichainSDK_instances, setupTransport_fn).call(this);
40483
+ yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupAnalytics_fn).call(this);
40484
+ yield __privateMethod(this, _MetaMaskConnectMultichain_instances, setupTransport_fn).call(this);
38700
40485
  try {
38701
40486
  const baseProps = yield getBaseAnalyticsProperties(
38702
40487
  this.options,
@@ -38740,13 +40525,13 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38740
40525
  return;
38741
40526
  }
38742
40527
  const { adapter: kvstore } = this.options.storage;
38743
- const dappClient = yield __privateMethod(this, _MultichainSDK_instances, createDappClient_fn).call(this);
40528
+ const dappClient = yield __privateMethod(this, _MetaMaskConnectMultichain_instances, createDappClient_fn).call(this);
38744
40529
  __privateSet(this, _dappClient, dappClient);
38745
40530
  const apiTransport = new MWPTransport(dappClient, kvstore);
38746
40531
  __privateSet(this, _transport2, apiTransport);
38747
40532
  __privateGet(this, _providerTransportWrapper).setupNotifcationListener();
38748
40533
  __privateSet(this, _listener, this.transport.onNotification(
38749
- __privateMethod(this, _MultichainSDK_instances, onTransportNotification_fn).bind(this)
40534
+ __privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
38750
40535
  ));
38751
40536
  yield this.storage.setTransport("mwp" /* MWP */);
38752
40537
  });
@@ -38761,13 +40546,13 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38761
40546
  };
38762
40547
  createBeforeUnloadListener_fn = function() {
38763
40548
  if (typeof window !== "undefined" && typeof window.addEventListener !== "undefined") {
38764
- window.addEventListener("beforeunload", __privateMethod(this, _MultichainSDK_instances, onBeforeUnload_fn).bind(this));
40549
+ window.addEventListener("beforeunload", __privateMethod(this, _MetaMaskConnectMultichain_instances, onBeforeUnload_fn).bind(this));
38765
40550
  }
38766
40551
  return () => {
38767
40552
  if (typeof window !== "undefined" && typeof window.removeEventListener !== "undefined") {
38768
40553
  window.removeEventListener(
38769
40554
  "beforeunload",
38770
- __privateMethod(this, _MultichainSDK_instances, onBeforeUnload_fn).bind(this)
40555
+ __privateMethod(this, _MetaMaskConnectMultichain_instances, onBeforeUnload_fn).bind(this)
38771
40556
  );
38772
40557
  }
38773
40558
  };
@@ -38843,11 +40628,11 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38843
40628
  showInstallModal_fn = function(desktopPreferred, scopes, caipAccountIds, sessionProperties) {
38844
40629
  return __async(this, null, function* () {
38845
40630
  var _a3;
38846
- (_a3 = __privateGet(this, _beforeUnloadListener)) != null ? _a3 : __privateSet(this, _beforeUnloadListener, __privateMethod(this, _MultichainSDK_instances, createBeforeUnloadListener_fn).call(this));
40631
+ (_a3 = __privateGet(this, _beforeUnloadListener)) != null ? _a3 : __privateSet(this, _beforeUnloadListener, __privateMethod(this, _MetaMaskConnectMultichain_instances, createBeforeUnloadListener_fn).call(this));
38847
40632
  if (this.options.ui.headless) {
38848
- yield __privateMethod(this, _MultichainSDK_instances, headlessConnect_fn).call(this, scopes, caipAccountIds, sessionProperties);
40633
+ yield __privateMethod(this, _MetaMaskConnectMultichain_instances, headlessConnect_fn).call(this, scopes, caipAccountIds, sessionProperties);
38849
40634
  } else {
38850
- yield __privateMethod(this, _MultichainSDK_instances, renderInstallModalAsync_fn).call(this, desktopPreferred, scopes, caipAccountIds, sessionProperties);
40635
+ yield __privateMethod(this, _MetaMaskConnectMultichain_instances, renderInstallModalAsync_fn).call(this, desktopPreferred, scopes, caipAccountIds, sessionProperties);
38851
40636
  }
38852
40637
  });
38853
40638
  };
@@ -38899,7 +40684,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
38899
40684
  yield this.storage.setTransport("browser" /* Browser */);
38900
40685
  const transport = new DefaultTransport();
38901
40686
  __privateSet(this, _listener, transport.onNotification(
38902
- __privateMethod(this, _MultichainSDK_instances, onTransportNotification_fn).bind(this)
40687
+ __privateMethod(this, _MetaMaskConnectMultichain_instances, onTransportNotification_fn).bind(this)
38903
40688
  ));
38904
40689
  __privateSet(this, _transport2, transport);
38905
40690
  __privateGet(this, _providerTransportWrapper).setupNotifcationListener();
@@ -39012,7 +40797,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
39012
40797
  }));
39013
40798
  });
39014
40799
  };
39015
- var MultichainSDK = _MultichainSDK;
40800
+ var MetaMaskConnectMultichain = _MetaMaskConnectMultichain;
39016
40801
 
39017
40802
  // ../../node_modules/uuid/dist/esm-browser/stringify.js
39018
40803
  var byteToHex = [];
@@ -39276,10 +41061,10 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
39276
41061
  var _ = { label: 0, sent: function() {
39277
41062
  if (t[0] & 1) throw t[1];
39278
41063
  return t[1];
39279
- }, trys: [], ops: [] }, f, y, t, g;
39280
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
41064
+ }, trys: [], ops: [] }, f, y, t, g2;
41065
+ return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() {
39281
41066
  return this;
39282
- }), g;
41067
+ }), g2;
39283
41068
  function verb(n) {
39284
41069
  return function(v) {
39285
41070
  return step([n, v]);
@@ -39695,7 +41480,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
39695
41480
  storage = options.storage;
39696
41481
  }
39697
41482
  const factory = new ModalFactory(uiModules);
39698
- return MultichainSDK.create(__spreadProps(__spreadValues({}, options), {
41483
+ return MetaMaskConnectMultichain.create(__spreadProps(__spreadValues({}, options), {
39699
41484
  storage,
39700
41485
  ui: __spreadProps(__spreadValues({}, options.ui), {
39701
41486
  factory
@@ -39706,6 +41491,17 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
39706
41491
  })();
39707
41492
  /*! Bundled license information:
39708
41493
 
41494
+ ieee754/index.js:
41495
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
41496
+
41497
+ buffer/index.js:
41498
+ (*!
41499
+ * The buffer module from node.js, for the browser.
41500
+ *
41501
+ * @author Feross Aboukhadijeh <https://feross.org>
41502
+ * @license MIT
41503
+ *)
41504
+
39709
41505
  @scure/base/lib/index.js:
39710
41506
  (*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
39711
41507