bsv2
Version:
Javascript library for Bitcoin SV (BSV).
1,145 lines • 1.31 MB
JavaScript
var it = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function Rr(M) {
return M && M.__esModule && Object.prototype.hasOwnProperty.call(M, "default") ? M.default : M;
}
function cl(M) {
if (Object.prototype.hasOwnProperty.call(M, "__esModule")) return M;
var a = M.default;
if (typeof a == "function") {
var c = function h() {
return this instanceof h ? Reflect.construct(a, arguments, this.constructor) : a.apply(this, arguments);
};
c.prototype = a.prototype;
} else c = {};
return Object.defineProperty(c, "__esModule", { value: !0 }), Object.keys(M).forEach(function(h) {
var x = Object.getOwnPropertyDescriptor(M, h);
Object.defineProperty(c, h, x.get ? x : {
enumerable: !0,
get: function() {
return M[h];
}
});
}), c;
}
var Ni, js;
function ll() {
if (js) return Ni;
js = 1, Ni = M;
function M(a) {
this._tables[0][0][0] || this._precompute();
var c, h, x, n = this._tables[0][4], y = this._tables[1], g = a.length, b = 1;
if (g !== 4 && g !== 6 && g !== 8)
throw new Error("invalid aes key size");
this._key = [h = a.slice(0), x = []];
for (var p = g; p < 4 * g + 28; p++)
c = h[p - 1], (p % g === 0 || g === 8 && p % g === 4) && (c = n[c >>> 24] << 24 ^ n[c >> 16 & 255] << 16 ^ n[c >> 8 & 255] << 8 ^ n[c & 255], p % g === 0 && (c = c << 8 ^ c >>> 24 ^ b << 24, b = b << 1 ^ (b >> 7) * 283)), h[p] = h[p - g] ^ c;
for (var l = 0; p; l++, p--)
c = h[l & 3 ? p : p - 4], p <= 4 || l < 4 ? x[l] = c : x[l] = y[0][n[c >>> 24]] ^ y[1][n[c >> 16 & 255]] ^ y[2][n[c >> 8 & 255]] ^ y[3][n[c & 255]];
}
return M.prototype = {
/**
* Encrypt an array of 4 big-endian words.
* @param {Array} data The plaintext.
* @return {Array} The ciphertext.
*/
encrypt: function(a) {
return this._crypt(a, 0);
},
/**
* Decrypt an array of 4 big-endian words.
* @param {Array} data The ciphertext.
* @return {Array} The plaintext.
*/
decrypt: function(a) {
return this._crypt(a, 1);
},
/**
* The expanded S-box and inverse S-box tables. These will be computed
* on the client so that we don't have to send them down the wire.
*
* There are two tables, _tables[0] is for encryption and
* _tables[1] is for decryption.
*
* The first 4 sub-tables are the expanded S-box with MixColumns. The
* last (_tables[01][4]) is the S-box itself.
*
* @private
*/
_tables: [
[new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)],
[new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256), new Uint32Array(256)]
],
//Expand the S-box tables.
_precompute: function() {
var a = this._tables[0], c = this._tables[1], h = a[4], x = c[4], n, y, g, b = new Uint8Array(256), p = new Uint8Array(256), l, w, _, S, B, A;
for (n = 0; n < 256; n++)
p[(b[n] = n << 1 ^ (n >> 7) * 283) ^ n] = n;
for (y = g = 0; !h[y]; y ^= l || 1, g = p[g] || 1)
for (S = g ^ g << 1 ^ g << 2 ^ g << 3 ^ g << 4, S = S >> 8 ^ S & 255 ^ 99, h[y] = S, x[S] = y, _ = b[w = b[l = b[y]]], A = _ * 16843009 ^ w * 65537 ^ l * 257 ^ y * 16843008, B = b[S] * 257 ^ S * 16843008, n = 0; n < 4; n++)
a[n][y] = B = B << 24 ^ B >>> 8, c[n][S] = A = A << 24 ^ A >>> 8;
},
/**
* Encryption and decryption core.
* @param {Array} input Four words to be encrypted or decrypted.
* @param dir The direction, 0 for encrypt and 1 for decrypt.
* @return {Array} The four encrypted or decrypted words.
* @private
*/
_crypt: function(a, c) {
if (a.length !== 4)
throw new Error("invalid aes block size");
var h = this._key[c], x = a[0] ^ h[0], n = a[c ? 3 : 1] ^ h[1], y = a[2] ^ h[2], g = a[c ? 1 : 3] ^ h[3], b, p, l, w = h.length / 4 - 2, _, S = 4, B = new Uint32Array(4), A = this._tables[c], k = A[0], R = A[1], O = A[2], L = A[3], N = A[4];
for (_ = 0; _ < w; _++)
b = k[x >>> 24] ^ R[n >> 16 & 255] ^ O[y >> 8 & 255] ^ L[g & 255] ^ h[S], p = k[n >>> 24] ^ R[y >> 16 & 255] ^ O[g >> 8 & 255] ^ L[x & 255] ^ h[S + 1], l = k[y >>> 24] ^ R[g >> 16 & 255] ^ O[x >> 8 & 255] ^ L[n & 255] ^ h[S + 2], g = k[g >>> 24] ^ R[x >> 16 & 255] ^ O[n >> 8 & 255] ^ L[y & 255] ^ h[S + 3], S += 4, x = b, n = p, y = l;
for (_ = 0; _ < 4; _++)
B[c ? 3 & -_ : _] = N[x >>> 24] << 24 ^ N[n >> 16 & 255] << 16 ^ N[y >> 8 & 255] << 8 ^ N[g & 255] ^ h[S++], b = x, x = n, n = y, y = g, g = b;
return B;
}
}, Ni;
}
var dl = ll();
const ws = /* @__PURE__ */ Rr(dl);
var ci = { exports: {} }, Ci = {}, Vs;
function Nt() {
return Vs || (Vs = 1, function(M) {
Object.defineProperties(M, { __esModule: { value: !0 }, [Symbol.toStringTag]: { value: "Module" } });
var a = {}, c = {};
c.byteLength = l, c.toByteArray = _, c.fromByteArray = A;
for (var h = [], x = [], n = typeof Uint8Array < "u" ? Uint8Array : Array, y = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", g = 0, b = y.length; g < b; ++g)
h[g] = y[g], x[y.charCodeAt(g)] = g;
x[45] = 62, x[95] = 63;
function p(O) {
var L = O.length;
if (L % 4 > 0)
throw new Error("Invalid string. Length must be a multiple of 4");
var N = O.indexOf("=");
N === -1 && (N = L);
var q = N === L ? 0 : 4 - N % 4;
return [N, q];
}
function l(O) {
var L = p(O), N = L[0], q = L[1];
return (N + q) * 3 / 4 - q;
}
function w(O, L, N) {
return (L + N) * 3 / 4 - N;
}
function _(O) {
var L, N = p(O), q = N[0], j = N[1], Q = new n(w(O, q, j)), ie = 0, Y = j > 0 ? q - 4 : q, ue;
for (ue = 0; ue < Y; ue += 4)
L = x[O.charCodeAt(ue)] << 18 | x[O.charCodeAt(ue + 1)] << 12 | x[O.charCodeAt(ue + 2)] << 6 | x[O.charCodeAt(ue + 3)], Q[ie++] = L >> 16 & 255, Q[ie++] = L >> 8 & 255, Q[ie++] = L & 255;
return j === 2 && (L = x[O.charCodeAt(ue)] << 2 | x[O.charCodeAt(ue + 1)] >> 4, Q[ie++] = L & 255), j === 1 && (L = x[O.charCodeAt(ue)] << 10 | x[O.charCodeAt(ue + 1)] << 4 | x[O.charCodeAt(ue + 2)] >> 2, Q[ie++] = L >> 8 & 255, Q[ie++] = L & 255), Q;
}
function S(O) {
return h[O >> 18 & 63] + h[O >> 12 & 63] + h[O >> 6 & 63] + h[O & 63];
}
function B(O, L, N) {
for (var q, j = [], Q = L; Q < N; Q += 3)
q = (O[Q] << 16 & 16711680) + (O[Q + 1] << 8 & 65280) + (O[Q + 2] & 255), j.push(S(q));
return j.join("");
}
function A(O) {
for (var L, N = O.length, q = N % 3, j = [], Q = 16383, ie = 0, Y = N - q; ie < Y; ie += Q)
j.push(B(O, ie, ie + Q > Y ? Y : ie + Q));
return q === 1 ? (L = O[N - 1], j.push(
h[L >> 2] + h[L << 4 & 63] + "=="
)) : q === 2 && (L = (O[N - 2] << 8) + O[N - 1], j.push(
h[L >> 10] + h[L >> 4 & 63] + h[L << 2 & 63] + "="
)), j.join("");
}
var k = {};
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
k.read = function(O, L, N, q, j) {
var Q, ie, Y = j * 8 - q - 1, ue = (1 << Y) - 1, v = ue >> 1, e = -7, r = N ? j - 1 : 0, i = N ? -1 : 1, f = O[L + r];
for (r += i, Q = f & (1 << -e) - 1, f >>= -e, e += Y; e > 0; Q = Q * 256 + O[L + r], r += i, e -= 8)
;
for (ie = Q & (1 << -e) - 1, Q >>= -e, e += q; e > 0; ie = ie * 256 + O[L + r], r += i, e -= 8)
;
if (Q === 0)
Q = 1 - v;
else {
if (Q === ue)
return ie ? NaN : (f ? -1 : 1) * (1 / 0);
ie = ie + Math.pow(2, q), Q = Q - v;
}
return (f ? -1 : 1) * ie * Math.pow(2, Q - q);
}, k.write = function(O, L, N, q, j, Q) {
var ie, Y, ue, v = Q * 8 - j - 1, e = (1 << v) - 1, r = e >> 1, i = j === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, f = q ? 0 : Q - 1, o = q ? 1 : -1, d = L < 0 || L === 0 && 1 / L < 0 ? 1 : 0;
for (L = Math.abs(L), isNaN(L) || L === 1 / 0 ? (Y = isNaN(L) ? 1 : 0, ie = e) : (ie = Math.floor(Math.log(L) / Math.LN2), L * (ue = Math.pow(2, -ie)) < 1 && (ie--, ue *= 2), ie + r >= 1 ? L += i / ue : L += i * Math.pow(2, 1 - r), L * ue >= 2 && (ie++, ue /= 2), ie + r >= e ? (Y = 0, ie = e) : ie + r >= 1 ? (Y = (L * ue - 1) * Math.pow(2, j), ie = ie + r) : (Y = L * Math.pow(2, r - 1) * Math.pow(2, j), ie = 0)); j >= 8; O[N + f] = Y & 255, f += o, Y /= 256, j -= 8)
;
for (ie = ie << j | Y, v += j; v > 0; O[N + f] = ie & 255, f += o, ie /= 256, v -= 8)
;
O[N + f - o] |= d * 128;
};
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
(function(O) {
const L = c, N = k, q = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
O.Buffer = e, O.SlowBuffer = I, O.INSPECT_MAX_BYTES = 50;
const j = 2147483647;
O.kMaxLength = j;
const { Uint8Array: Q, ArrayBuffer: ie, SharedArrayBuffer: Y } = globalThis;
e.TYPED_ARRAY_SUPPORT = ue(), !e.TYPED_ARRAY_SUPPORT && typeof console < "u" && typeof console.error == "function" && console.error(
"This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."
);
function ue() {
try {
const K = new Q(1), T = { foo: function() {
return 42;
} };
return Object.setPrototypeOf(T, Q.prototype), Object.setPrototypeOf(K, T), K.foo() === 42;
} catch {
return !1;
}
}
Object.defineProperty(e.prototype, "parent", {
enumerable: !0,
get: function() {
if (e.isBuffer(this))
return this.buffer;
}
}), Object.defineProperty(e.prototype, "offset", {
enumerable: !0,
get: function() {
if (e.isBuffer(this))
return this.byteOffset;
}
});
function v(K) {
if (K > j)
throw new RangeError('The value "' + K + '" is invalid for option "size"');
const T = new Q(K);
return Object.setPrototypeOf(T, e.prototype), T;
}
function e(K, T, D) {
if (typeof K == "number") {
if (typeof T == "string")
throw new TypeError(
'The "string" argument must be of type string. Received type number'
);
return o(K);
}
return r(K, T, D);
}
e.poolSize = 8192;
function r(K, T, D) {
if (typeof K == "string")
return d(K, T);
if (ie.isView(K))
return s(K);
if (K == null)
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof K
);
if (Te(K, ie) || K && Te(K.buffer, ie) || typeof Y < "u" && (Te(K, Y) || K && Te(K.buffer, Y)))
return t(K, T, D);
if (typeof K == "number")
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
);
const W = K.valueOf && K.valueOf();
if (W != null && W !== K)
return e.from(W, T, D);
const re = u(K);
if (re) return re;
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof K[Symbol.toPrimitive] == "function")
return e.from(K[Symbol.toPrimitive]("string"), T, D);
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof K
);
}
e.from = function(K, T, D) {
return r(K, T, D);
}, Object.setPrototypeOf(e.prototype, Q.prototype), Object.setPrototypeOf(e, Q);
function i(K) {
if (typeof K != "number")
throw new TypeError('"size" argument must be of type number');
if (K < 0)
throw new RangeError('The value "' + K + '" is invalid for option "size"');
}
function f(K, T, D) {
return i(K), K <= 0 ? v(K) : T !== void 0 ? typeof D == "string" ? v(K).fill(T, D) : v(K).fill(T) : v(K);
}
e.alloc = function(K, T, D) {
return f(K, T, D);
};
function o(K) {
return i(K), v(K < 0 ? 0 : E(K) | 0);
}
e.allocUnsafe = function(K) {
return o(K);
}, e.allocUnsafeSlow = function(K) {
return o(K);
};
function d(K, T) {
if ((typeof T != "string" || T === "") && (T = "utf8"), !e.isEncoding(T))
throw new TypeError("Unknown encoding: " + T);
const D = U(K, T) | 0;
let W = v(D);
const re = W.write(K, T);
return re !== D && (W = W.slice(0, re)), W;
}
function m(K) {
const T = K.length < 0 ? 0 : E(K.length) | 0, D = v(T);
for (let W = 0; W < T; W += 1)
D[W] = K[W] & 255;
return D;
}
function s(K) {
if (Te(K, Q)) {
const T = new Q(K);
return t(T.buffer, T.byteOffset, T.byteLength);
}
return m(K);
}
function t(K, T, D) {
if (T < 0 || K.byteLength < T)
throw new RangeError('"offset" is outside of buffer bounds');
if (K.byteLength < T + (D || 0))
throw new RangeError('"length" is outside of buffer bounds');
let W;
return T === void 0 && D === void 0 ? W = new Q(K) : D === void 0 ? W = new Q(K, T) : W = new Q(K, T, D), Object.setPrototypeOf(W, e.prototype), W;
}
function u(K) {
if (e.isBuffer(K)) {
const T = E(K.length) | 0, D = v(T);
return D.length === 0 || K.copy(D, 0, 0, T), D;
}
if (K.length !== void 0)
return typeof K.length != "number" || Qe(K.length) ? v(0) : m(K);
if (K.type === "Buffer" && Array.isArray(K.data))
return m(K.data);
}
function E(K) {
if (K >= j)
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + j.toString(16) + " bytes");
return K | 0;
}
function I(K) {
return +K != K && (K = 0), e.alloc(+K);
}
e.isBuffer = function(T) {
return T != null && T._isBuffer === !0 && T !== e.prototype;
}, e.compare = function(T, D) {
if (Te(T, Q) && (T = e.from(T, T.offset, T.byteLength)), Te(D, Q) && (D = e.from(D, D.offset, D.byteLength)), !e.isBuffer(T) || !e.isBuffer(D))
throw new TypeError(
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
);
if (T === D) return 0;
let W = T.length, re = D.length;
for (let ve = 0, fe = Math.min(W, re); ve < fe; ++ve)
if (T[ve] !== D[ve]) {
W = T[ve], re = D[ve];
break;
}
return W < re ? -1 : re < W ? 1 : 0;
}, e.isEncoding = function(T) {
switch (String(T).toLowerCase()) {
case "hex":
case "utf8":
case "utf-8":
case "ascii":
case "latin1":
case "binary":
case "base64":
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return !0;
default:
return !1;
}
}, e.concat = function(T, D) {
if (!Array.isArray(T))
throw new TypeError('"list" argument must be an Array of Buffers');
if (T.length === 0)
return e.alloc(0);
let W;
if (D === void 0)
for (D = 0, W = 0; W < T.length; ++W)
D += T[W].length;
const re = e.allocUnsafe(D);
let ve = 0;
for (W = 0; W < T.length; ++W) {
let fe = T[W];
if (Te(fe, Q))
ve + fe.length > re.length ? (e.isBuffer(fe) || (fe = e.from(fe)), fe.copy(re, ve)) : Q.prototype.set.call(
re,
fe,
ve
);
else if (e.isBuffer(fe))
fe.copy(re, ve);
else
throw new TypeError('"list" argument must be an Array of Buffers');
ve += fe.length;
}
return re;
};
function U(K, T) {
if (e.isBuffer(K))
return K.length;
if (ie.isView(K) || Te(K, ie))
return K.byteLength;
if (typeof K != "string")
throw new TypeError(
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof K
);
const D = K.length, W = arguments.length > 2 && arguments[2] === !0;
if (!W && D === 0) return 0;
let re = !1;
for (; ; )
switch (T) {
case "ascii":
case "latin1":
case "binary":
return D;
case "utf8":
case "utf-8":
return ze(K).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return D * 2;
case "hex":
return D >>> 1;
case "base64":
return Ue(K).length;
default:
if (re)
return W ? -1 : ze(K).length;
T = ("" + T).toLowerCase(), re = !0;
}
}
e.byteLength = U;
function J(K, T, D) {
let W = !1;
if ((T === void 0 || T < 0) && (T = 0), T > this.length || ((D === void 0 || D > this.length) && (D = this.length), D <= 0) || (D >>>= 0, T >>>= 0, D <= T))
return "";
for (K || (K = "utf8"); ; )
switch (K) {
case "hex":
return Ke(this, T, D);
case "utf8":
case "utf-8":
return le(this, T, D);
case "ascii":
return be(this, T, D);
case "latin1":
case "binary":
return se(this, T, D);
case "base64":
return Pe(this, T, D);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return pe(this, T, D);
default:
if (W) throw new TypeError("Unknown encoding: " + K);
K = (K + "").toLowerCase(), W = !0;
}
}
e.prototype._isBuffer = !0;
function $(K, T, D) {
const W = K[T];
K[T] = K[D], K[D] = W;
}
e.prototype.swap16 = function() {
const T = this.length;
if (T % 2 !== 0)
throw new RangeError("Buffer size must be a multiple of 16-bits");
for (let D = 0; D < T; D += 2)
$(this, D, D + 1);
return this;
}, e.prototype.swap32 = function() {
const T = this.length;
if (T % 4 !== 0)
throw new RangeError("Buffer size must be a multiple of 32-bits");
for (let D = 0; D < T; D += 4)
$(this, D, D + 3), $(this, D + 1, D + 2);
return this;
}, e.prototype.swap64 = function() {
const T = this.length;
if (T % 8 !== 0)
throw new RangeError("Buffer size must be a multiple of 64-bits");
for (let D = 0; D < T; D += 8)
$(this, D, D + 7), $(this, D + 1, D + 6), $(this, D + 2, D + 5), $(this, D + 3, D + 4);
return this;
}, e.prototype.toString = function() {
const T = this.length;
return T === 0 ? "" : arguments.length === 0 ? le(this, 0, T) : J.apply(this, arguments);
}, e.prototype.toLocaleString = e.prototype.toString, e.prototype.equals = function(T) {
if (!e.isBuffer(T)) throw new TypeError("Argument must be a Buffer");
return this === T ? !0 : e.compare(this, T) === 0;
}, e.prototype.inspect = function() {
let T = "";
const D = O.INSPECT_MAX_BYTES;
return T = this.toString("hex", 0, D).replace(/(.{2})/g, "$1 ").trim(), this.length > D && (T += " ... "), "<Buffer " + T + ">";
}, q && (e.prototype[q] = e.prototype.inspect), e.prototype.compare = function(T, D, W, re, ve) {
if (Te(T, Q) && (T = e.from(T, T.offset, T.byteLength)), !e.isBuffer(T))
throw new TypeError(
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof T
);
if (D === void 0 && (D = 0), W === void 0 && (W = T ? T.length : 0), re === void 0 && (re = 0), ve === void 0 && (ve = this.length), D < 0 || W > T.length || re < 0 || ve > this.length)
throw new RangeError("out of range index");
if (re >= ve && D >= W)
return 0;
if (re >= ve)
return -1;
if (D >= W)
return 1;
if (D >>>= 0, W >>>= 0, re >>>= 0, ve >>>= 0, this === T) return 0;
let fe = ve - re, Me = W - D;
const je = Math.min(fe, Me), we = this.slice(re, ve), Re = T.slice(D, W);
for (let He = 0; He < je; ++He)
if (we[He] !== Re[He]) {
fe = we[He], Me = Re[He];
break;
}
return fe < Me ? -1 : Me < fe ? 1 : 0;
};
function C(K, T, D, W, re) {
if (K.length === 0) return -1;
if (typeof D == "string" ? (W = D, D = 0) : D > 2147483647 ? D = 2147483647 : D < -2147483648 && (D = -2147483648), D = +D, Qe(D) && (D = re ? 0 : K.length - 1), D < 0 && (D = K.length + D), D >= K.length) {
if (re) return -1;
D = K.length - 1;
} else if (D < 0)
if (re) D = 0;
else return -1;
if (typeof T == "string" && (T = e.from(T, W)), e.isBuffer(T))
return T.length === 0 ? -1 : V(K, T, D, W, re);
if (typeof T == "number")
return T = T & 255, typeof Q.prototype.indexOf == "function" ? re ? Q.prototype.indexOf.call(K, T, D) : Q.prototype.lastIndexOf.call(K, T, D) : V(K, [T], D, W, re);
throw new TypeError("val must be string, number or Buffer");
}
function V(K, T, D, W, re) {
let ve = 1, fe = K.length, Me = T.length;
if (W !== void 0 && (W = String(W).toLowerCase(), W === "ucs2" || W === "ucs-2" || W === "utf16le" || W === "utf-16le")) {
if (K.length < 2 || T.length < 2)
return -1;
ve = 2, fe /= 2, Me /= 2, D /= 2;
}
function je(Re, He) {
return ve === 1 ? Re[He] : Re.readUInt16BE(He * ve);
}
let we;
if (re) {
let Re = -1;
for (we = D; we < fe; we++)
if (je(K, we) === je(T, Re === -1 ? 0 : we - Re)) {
if (Re === -1 && (Re = we), we - Re + 1 === Me) return Re * ve;
} else
Re !== -1 && (we -= we - Re), Re = -1;
} else
for (D + Me > fe && (D = fe - Me), we = D; we >= 0; we--) {
let Re = !0;
for (let He = 0; He < Me; He++)
if (je(K, we + He) !== je(T, He)) {
Re = !1;
break;
}
if (Re) return we;
}
return -1;
}
e.prototype.includes = function(T, D, W) {
return this.indexOf(T, D, W) !== -1;
}, e.prototype.indexOf = function(T, D, W) {
return C(this, T, D, W, !0);
}, e.prototype.lastIndexOf = function(T, D, W) {
return C(this, T, D, W, !1);
};
function Z(K, T, D, W) {
D = Number(D) || 0;
const re = K.length - D;
W ? (W = Number(W), W > re && (W = re)) : W = re;
const ve = T.length;
W > ve / 2 && (W = ve / 2);
let fe;
for (fe = 0; fe < W; ++fe) {
const Me = parseInt(T.substr(fe * 2, 2), 16);
if (Qe(Me)) return fe;
K[D + fe] = Me;
}
return fe;
}
function ee(K, T, D, W) {
return Ae(ze(T, K.length - D), K, D, W);
}
function X(K, T, D, W) {
return Ae(ye(T), K, D, W);
}
function z(K, T, D, W) {
return Ae(Ue(T), K, D, W);
}
function ne(K, T, D, W) {
return Ae(Ee(T, K.length - D), K, D, W);
}
e.prototype.write = function(T, D, W, re) {
if (D === void 0)
re = "utf8", W = this.length, D = 0;
else if (W === void 0 && typeof D == "string")
re = D, W = this.length, D = 0;
else if (isFinite(D))
D = D >>> 0, isFinite(W) ? (W = W >>> 0, re === void 0 && (re = "utf8")) : (re = W, W = void 0);
else
throw new Error(
"Buffer.write(string, encoding, offset[, length]) is no longer supported"
);
const ve = this.length - D;
if ((W === void 0 || W > ve) && (W = ve), T.length > 0 && (W < 0 || D < 0) || D > this.length)
throw new RangeError("Attempt to write outside buffer bounds");
re || (re = "utf8");
let fe = !1;
for (; ; )
switch (re) {
case "hex":
return Z(this, T, D, W);
case "utf8":
case "utf-8":
return ee(this, T, D, W);
case "ascii":
case "latin1":
case "binary":
return X(this, T, D, W);
case "base64":
return z(this, T, D, W);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return ne(this, T, D, W);
default:
if (fe) throw new TypeError("Unknown encoding: " + re);
re = ("" + re).toLowerCase(), fe = !0;
}
}, e.prototype.toJSON = function() {
return {
type: "Buffer",
data: Array.prototype.slice.call(this._arr || this, 0)
};
};
function Pe(K, T, D) {
return T === 0 && D === K.length ? L.fromByteArray(K) : L.fromByteArray(K.slice(T, D));
}
function le(K, T, D) {
D = Math.min(K.length, D);
const W = [];
let re = T;
for (; re < D; ) {
const ve = K[re];
let fe = null, Me = ve > 239 ? 4 : ve > 223 ? 3 : ve > 191 ? 2 : 1;
if (re + Me <= D) {
let je, we, Re, He;
switch (Me) {
case 1:
ve < 128 && (fe = ve);
break;
case 2:
je = K[re + 1], (je & 192) === 128 && (He = (ve & 31) << 6 | je & 63, He > 127 && (fe = He));
break;
case 3:
je = K[re + 1], we = K[re + 2], (je & 192) === 128 && (we & 192) === 128 && (He = (ve & 15) << 12 | (je & 63) << 6 | we & 63, He > 2047 && (He < 55296 || He > 57343) && (fe = He));
break;
case 4:
je = K[re + 1], we = K[re + 2], Re = K[re + 3], (je & 192) === 128 && (we & 192) === 128 && (Re & 192) === 128 && (He = (ve & 15) << 18 | (je & 63) << 12 | (we & 63) << 6 | Re & 63, He > 65535 && He < 1114112 && (fe = He));
}
}
fe === null ? (fe = 65533, Me = 1) : fe > 65535 && (fe -= 65536, W.push(fe >>> 10 & 1023 | 55296), fe = 56320 | fe & 1023), W.push(fe), re += Me;
}
return Le(W);
}
const ce = 4096;
function Le(K) {
const T = K.length;
if (T <= ce)
return String.fromCharCode.apply(String, K);
let D = "", W = 0;
for (; W < T; )
D += String.fromCharCode.apply(
String,
K.slice(W, W += ce)
);
return D;
}
function be(K, T, D) {
let W = "";
D = Math.min(K.length, D);
for (let re = T; re < D; ++re)
W += String.fromCharCode(K[re] & 127);
return W;
}
function se(K, T, D) {
let W = "";
D = Math.min(K.length, D);
for (let re = T; re < D; ++re)
W += String.fromCharCode(K[re]);
return W;
}
function Ke(K, T, D) {
const W = K.length;
(!T || T < 0) && (T = 0), (!D || D < 0 || D > W) && (D = W);
let re = "";
for (let ve = T; ve < D; ++ve)
re += Ie[K[ve]];
return re;
}
function pe(K, T, D) {
const W = K.slice(T, D);
let re = "";
for (let ve = 0; ve < W.length - 1; ve += 2)
re += String.fromCharCode(W[ve] + W[ve + 1] * 256);
return re;
}
e.prototype.slice = function(T, D) {
const W = this.length;
T = ~~T, D = D === void 0 ? W : ~~D, T < 0 ? (T += W, T < 0 && (T = 0)) : T > W && (T = W), D < 0 ? (D += W, D < 0 && (D = 0)) : D > W && (D = W), D < T && (D = T);
const re = this.subarray(T, D);
return Object.setPrototypeOf(re, e.prototype), re;
};
function ge(K, T, D) {
if (K % 1 !== 0 || K < 0) throw new RangeError("offset is not uint");
if (K + T > D) throw new RangeError("Trying to access beyond buffer length");
}
e.prototype.readUintLE = e.prototype.readUIntLE = function(T, D, W) {
T = T >>> 0, D = D >>> 0, W || ge(T, D, this.length);
let re = this[T], ve = 1, fe = 0;
for (; ++fe < D && (ve *= 256); )
re += this[T + fe] * ve;
return re;
}, e.prototype.readUintBE = e.prototype.readUIntBE = function(T, D, W) {
T = T >>> 0, D = D >>> 0, W || ge(T, D, this.length);
let re = this[T + --D], ve = 1;
for (; D > 0 && (ve *= 256); )
re += this[T + --D] * ve;
return re;
}, e.prototype.readUint8 = e.prototype.readUInt8 = function(T, D) {
return T = T >>> 0, D || ge(T, 1, this.length), this[T];
}, e.prototype.readUint16LE = e.prototype.readUInt16LE = function(T, D) {
return T = T >>> 0, D || ge(T, 2, this.length), this[T] | this[T + 1] << 8;
}, e.prototype.readUint16BE = e.prototype.readUInt16BE = function(T, D) {
return T = T >>> 0, D || ge(T, 2, this.length), this[T] << 8 | this[T + 1];
}, e.prototype.readUint32LE = e.prototype.readUInt32LE = function(T, D) {
return T = T >>> 0, D || ge(T, 4, this.length), (this[T] | this[T + 1] << 8 | this[T + 2] << 16) + this[T + 3] * 16777216;
}, e.prototype.readUint32BE = e.prototype.readUInt32BE = function(T, D) {
return T = T >>> 0, D || ge(T, 4, this.length), this[T] * 16777216 + (this[T + 1] << 16 | this[T + 2] << 8 | this[T + 3]);
}, e.prototype.readBigUInt64LE = Ne(function(T) {
T = T >>> 0, te(T, "offset");
const D = this[T], W = this[T + 7];
(D === void 0 || W === void 0) && de(T, this.length - 8);
const re = D + this[++T] * 2 ** 8 + this[++T] * 2 ** 16 + this[++T] * 2 ** 24, ve = this[++T] + this[++T] * 2 ** 8 + this[++T] * 2 ** 16 + W * 2 ** 24;
return BigInt(re) + (BigInt(ve) << BigInt(32));
}), e.prototype.readBigUInt64BE = Ne(function(T) {
T = T >>> 0, te(T, "offset");
const D = this[T], W = this[T + 7];
(D === void 0 || W === void 0) && de(T, this.length - 8);
const re = D * 2 ** 24 + this[++T] * 2 ** 16 + this[++T] * 2 ** 8 + this[++T], ve = this[++T] * 2 ** 24 + this[++T] * 2 ** 16 + this[++T] * 2 ** 8 + W;
return (BigInt(re) << BigInt(32)) + BigInt(ve);
}), e.prototype.readIntLE = function(T, D, W) {
T = T >>> 0, D = D >>> 0, W || ge(T, D, this.length);
let re = this[T], ve = 1, fe = 0;
for (; ++fe < D && (ve *= 256); )
re += this[T + fe] * ve;
return ve *= 128, re >= ve && (re -= Math.pow(2, 8 * D)), re;
}, e.prototype.readIntBE = function(T, D, W) {
T = T >>> 0, D = D >>> 0, W || ge(T, D, this.length);
let re = D, ve = 1, fe = this[T + --re];
for (; re > 0 && (ve *= 256); )
fe += this[T + --re] * ve;
return ve *= 128, fe >= ve && (fe -= Math.pow(2, 8 * D)), fe;
}, e.prototype.readInt8 = function(T, D) {
return T = T >>> 0, D || ge(T, 1, this.length), this[T] & 128 ? (255 - this[T] + 1) * -1 : this[T];
}, e.prototype.readInt16LE = function(T, D) {
T = T >>> 0, D || ge(T, 2, this.length);
const W = this[T] | this[T + 1] << 8;
return W & 32768 ? W | 4294901760 : W;
}, e.prototype.readInt16BE = function(T, D) {
T = T >>> 0, D || ge(T, 2, this.length);
const W = this[T + 1] | this[T] << 8;
return W & 32768 ? W | 4294901760 : W;
}, e.prototype.readInt32LE = function(T, D) {
return T = T >>> 0, D || ge(T, 4, this.length), this[T] | this[T + 1] << 8 | this[T + 2] << 16 | this[T + 3] << 24;
}, e.prototype.readInt32BE = function(T, D) {
return T = T >>> 0, D || ge(T, 4, this.length), this[T] << 24 | this[T + 1] << 16 | this[T + 2] << 8 | this[T + 3];
}, e.prototype.readBigInt64LE = Ne(function(T) {
T = T >>> 0, te(T, "offset");
const D = this[T], W = this[T + 7];
(D === void 0 || W === void 0) && de(T, this.length - 8);
const re = this[T + 4] + this[T + 5] * 2 ** 8 + this[T + 6] * 2 ** 16 + (W << 24);
return (BigInt(re) << BigInt(32)) + BigInt(D + this[++T] * 2 ** 8 + this[++T] * 2 ** 16 + this[++T] * 2 ** 24);
}), e.prototype.readBigInt64BE = Ne(function(T) {
T = T >>> 0, te(T, "offset");
const D = this[T], W = this[T + 7];
(D === void 0 || W === void 0) && de(T, this.length - 8);
const re = (D << 24) + // Overflow
this[++T] * 2 ** 16 + this[++T] * 2 ** 8 + this[++T];
return (BigInt(re) << BigInt(32)) + BigInt(this[++T] * 2 ** 24 + this[++T] * 2 ** 16 + this[++T] * 2 ** 8 + W);
}), e.prototype.readFloatLE = function(T, D) {
return T = T >>> 0, D || ge(T, 4, this.length), N.read(this, T, !0, 23, 4);
}, e.prototype.readFloatBE = function(T, D) {
return T = T >>> 0, D || ge(T, 4, this.length), N.read(this, T, !1, 23, 4);
}, e.prototype.readDoubleLE = function(T, D) {
return T = T >>> 0, D || ge(T, 8, this.length), N.read(this, T, !0, 52, 8);
}, e.prototype.readDoubleBE = function(T, D) {
return T = T >>> 0, D || ge(T, 8, this.length), N.read(this, T, !1, 52, 8);
};
function De(K, T, D, W, re, ve) {
if (!e.isBuffer(K)) throw new TypeError('"buffer" argument must be a Buffer instance');
if (T > re || T < ve) throw new RangeError('"value" argument is out of bounds');
if (D + W > K.length) throw new RangeError("Index out of range");
}
e.prototype.writeUintLE = e.prototype.writeUIntLE = function(T, D, W, re) {
if (T = +T, D = D >>> 0, W = W >>> 0, !re) {
const Me = Math.pow(2, 8 * W) - 1;
De(this, T, D, W, Me, 0);
}
let ve = 1, fe = 0;
for (this[D] = T & 255; ++fe < W && (ve *= 256); )
this[D + fe] = T / ve & 255;
return D + W;
}, e.prototype.writeUintBE = e.prototype.writeUIntBE = function(T, D, W, re) {
if (T = +T, D = D >>> 0, W = W >>> 0, !re) {
const Me = Math.pow(2, 8 * W) - 1;
De(this, T, D, W, Me, 0);
}
let ve = W - 1, fe = 1;
for (this[D + ve] = T & 255; --ve >= 0 && (fe *= 256); )
this[D + ve] = T / fe & 255;
return D + W;
}, e.prototype.writeUint8 = e.prototype.writeUInt8 = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 1, 255, 0), this[D] = T & 255, D + 1;
}, e.prototype.writeUint16LE = e.prototype.writeUInt16LE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 2, 65535, 0), this[D] = T & 255, this[D + 1] = T >>> 8, D + 2;
}, e.prototype.writeUint16BE = e.prototype.writeUInt16BE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 2, 65535, 0), this[D] = T >>> 8, this[D + 1] = T & 255, D + 2;
}, e.prototype.writeUint32LE = e.prototype.writeUInt32LE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 4, 4294967295, 0), this[D + 3] = T >>> 24, this[D + 2] = T >>> 16, this[D + 1] = T >>> 8, this[D] = T & 255, D + 4;
}, e.prototype.writeUint32BE = e.prototype.writeUInt32BE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 4, 4294967295, 0), this[D] = T >>> 24, this[D + 1] = T >>> 16, this[D + 2] = T >>> 8, this[D + 3] = T & 255, D + 4;
};
function me(K, T, D, W, re) {
G(T, W, re, K, D, 7);
let ve = Number(T & BigInt(4294967295));
K[D++] = ve, ve = ve >> 8, K[D++] = ve, ve = ve >> 8, K[D++] = ve, ve = ve >> 8, K[D++] = ve;
let fe = Number(T >> BigInt(32) & BigInt(4294967295));
return K[D++] = fe, fe = fe >> 8, K[D++] = fe, fe = fe >> 8, K[D++] = fe, fe = fe >> 8, K[D++] = fe, D;
}
function Se(K, T, D, W, re) {
G(T, W, re, K, D, 7);
let ve = Number(T & BigInt(4294967295));
K[D + 7] = ve, ve = ve >> 8, K[D + 6] = ve, ve = ve >> 8, K[D + 5] = ve, ve = ve >> 8, K[D + 4] = ve;
let fe = Number(T >> BigInt(32) & BigInt(4294967295));
return K[D + 3] = fe, fe = fe >> 8, K[D + 2] = fe, fe = fe >> 8, K[D + 1] = fe, fe = fe >> 8, K[D] = fe, D + 8;
}
e.prototype.writeBigUInt64LE = Ne(function(T, D = 0) {
return me(this, T, D, BigInt(0), BigInt("0xffffffffffffffff"));
}), e.prototype.writeBigUInt64BE = Ne(function(T, D = 0) {
return Se(this, T, D, BigInt(0), BigInt("0xffffffffffffffff"));
}), e.prototype.writeIntLE = function(T, D, W, re) {
if (T = +T, D = D >>> 0, !re) {
const je = Math.pow(2, 8 * W - 1);
De(this, T, D, W, je - 1, -je);
}
let ve = 0, fe = 1, Me = 0;
for (this[D] = T & 255; ++ve < W && (fe *= 256); )
T < 0 && Me === 0 && this[D + ve - 1] !== 0 && (Me = 1), this[D + ve] = (T / fe >> 0) - Me & 255;
return D + W;
}, e.prototype.writeIntBE = function(T, D, W, re) {
if (T = +T, D = D >>> 0, !re) {
const je = Math.pow(2, 8 * W - 1);
De(this, T, D, W, je - 1, -je);
}
let ve = W - 1, fe = 1, Me = 0;
for (this[D + ve] = T & 255; --ve >= 0 && (fe *= 256); )
T < 0 && Me === 0 && this[D + ve + 1] !== 0 && (Me = 1), this[D + ve] = (T / fe >> 0) - Me & 255;
return D + W;
}, e.prototype.writeInt8 = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 1, 127, -128), T < 0 && (T = 255 + T + 1), this[D] = T & 255, D + 1;
}, e.prototype.writeInt16LE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 2, 32767, -32768), this[D] = T & 255, this[D + 1] = T >>> 8, D + 2;
}, e.prototype.writeInt16BE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 2, 32767, -32768), this[D] = T >>> 8, this[D + 1] = T & 255, D + 2;
}, e.prototype.writeInt32LE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 4, 2147483647, -2147483648), this[D] = T & 255, this[D + 1] = T >>> 8, this[D + 2] = T >>> 16, this[D + 3] = T >>> 24, D + 4;
}, e.prototype.writeInt32BE = function(T, D, W) {
return T = +T, D = D >>> 0, W || De(this, T, D, 4, 2147483647, -2147483648), T < 0 && (T = 4294967295 + T + 1), this[D] = T >>> 24, this[D + 1] = T >>> 16, this[D + 2] = T >>> 8, this[D + 3] = T & 255, D + 4;
}, e.prototype.writeBigInt64LE = Ne(function(T, D = 0) {
return me(this, T, D, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
}), e.prototype.writeBigInt64BE = Ne(function(T, D = 0) {
return Se(this, T, D, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
});
function $e(K, T, D, W, re, ve) {
if (D + W > K.length) throw new RangeError("Index out of range");
if (D < 0) throw new RangeError("Index out of range");
}
function _e(K, T, D, W, re) {
return T = +T, D = D >>> 0, re || $e(K, T, D, 4), N.write(K, T, D, W, 23, 4), D + 4;
}
e.prototype.writeFloatLE = function(T, D, W) {
return _e(this, T, D, !0, W);
}, e.prototype.writeFloatBE = function(T, D, W) {
return _e(this, T, D, !1, W);
};
function Oe(K, T, D, W, re) {
return T = +T, D = D >>> 0, re || $e(K, T, D, 8), N.write(K, T, D, W, 52, 8), D + 8;
}
e.prototype.writeDoubleLE = function(T, D, W) {
return Oe(this, T, D, !0, W);
}, e.prototype.writeDoubleBE = function(T, D, W) {
return Oe(this, T, D, !1, W);
}, e.prototype.copy = function(T, D, W, re) {
if (!e.isBuffer(T)) throw new TypeError("argument should be a Buffer");
if (W || (W = 0), !re && re !== 0 && (re = this.length), D >= T.length && (D = T.length), D || (D = 0), re > 0 && re < W && (re = W), re === W || T.length === 0 || this.length === 0) return 0;
if (D < 0)
throw new RangeError("targetStart out of bounds");
if (W < 0 || W >= this.length) throw new RangeError("Index out of range");
if (re < 0) throw new RangeError("sourceEnd out of bounds");
re > this.length && (re = this.length), T.length - D < re - W && (re = T.length - D + W);
const ve = re - W;
return this === T && typeof Q.prototype.copyWithin == "function" ? this.copyWithin(D, W, re) : Q.prototype.set.call(
T,
this.subarray(W, re),
D
), ve;
}, e.prototype.fill = function(T, D, W, re) {
if (typeof T == "string") {
if (typeof D == "string" ? (re = D, D = 0, W = this.length) : typeof W == "string" && (re = W, W = this.length), re !== void 0 && typeof re != "string")
throw new TypeError("encoding must be a string");
if (typeof re == "string" && !e.isEncoding(re))
throw new TypeError("Unknown encoding: " + re);
if (T.length === 1) {
const fe = T.charCodeAt(0);
(re === "utf8" && fe < 128 || re === "latin1") && (T = fe);
}
} else typeof T == "number" ? T = T & 255 : typeof T == "boolean" && (T = Number(T));
if (D < 0 || this.length < D || this.length < W)
throw new RangeError("Out of range index");
if (W <= D)
return this;
D = D >>> 0, W = W === void 0 ? this.length : W >>> 0, T || (T = 0);
let ve;
if (typeof T == "number")
for (ve = D; ve < W; ++ve)
this[ve] = T;
else {
const fe = e.isBuffer(T) ? T : e.from(T, re), Me = fe.length;
if (Me === 0)
throw new TypeError('The value "' + T + '" is invalid for argument "value"');
for (ve = 0; ve < W - D; ++ve)
this[ve + D] = fe[ve % Me];
}
return this;
};
const Ye = {};
function H(K, T, D) {
Ye[K] = class extends D {
constructor() {
super(), Object.defineProperty(this, "message", {
value: T.apply(this, arguments),
writable: !0,
configurable: !0
}), this.name = `${this.name} [${K}]`, this.stack, delete this.name;
}
get code() {
return K;
}
set code(re) {
Object.defineProperty(this, "code", {
configurable: !0,
enumerable: !0,
value: re,
writable: !0
});
}
toString() {
return `${this.name} [${K}]: ${this.message}`;
}
};
}
H(
"ERR_BUFFER_OUT_OF_BOUNDS",
function(K) {
return K ? `${K} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
},
RangeError
), H(
"ERR_INVALID_ARG_TYPE",
function(K, T) {
return `The "${K}" argument must be of type number. Received type ${typeof T}`;
},
TypeError
), H(
"ERR_OUT_OF_RANGE",
function(K, T, D) {
let W = `The value of "${K}" is out of range.`, re = D;
return Number.isInteger(D) && Math.abs(D) > 2 ** 32 ? re = P(String(D)) : typeof D == "bigint" && (re = String(D), (D > BigInt(2) ** BigInt(32) || D < -(BigInt(2) ** BigInt(32))) && (re = P(re)), re += "n"), W += ` It must be ${T}. Received ${re}`, W;
},
RangeError
);
function P(K) {
let T = "", D = K.length;
const W = K[0] === "-" ? 1 : 0;
for (; D >= W + 4; D -= 3)
T = `_${K.slice(D - 3, D)}${T}`;
return `${K.slice(0, D)}${T}`;
}
function F(K, T, D) {
te(T, "offset"), (K[T] === void 0 || K[T + D] === void 0) && de(T, K.length - (D + 1));
}
function G(K, T, D, W, re, ve) {
if (K > D || K < T) {
const fe = typeof T == "bigint" ? "n" : "";
let Me;
throw T === 0 || T === BigInt(0) ? Me = `>= 0${fe} and < 2${fe} ** ${(ve + 1) * 8}${fe}` : Me = `>= -(2${fe} ** ${(ve + 1) * 8 - 1}${fe}) and < 2 ** ${(ve + 1) * 8 - 1}${fe}`, new Ye.ERR_OUT_OF_RANGE("value", Me, K);
}
F(W, re, ve);
}
function te(K, T) {
if (typeof K != "number")
throw new Ye.ERR_INVALID_ARG_TYPE(T, "number", K);
}
function de(K, T, D) {
throw Math.floor(K) !== K ? (te(K, D), new Ye.ERR_OUT_OF_RANGE("offset", "an integer", K)) : T < 0 ? new Ye.ERR_BUFFER_OUT_OF_BOUNDS() : new Ye.ERR_OUT_OF_RANGE(
"offset",
`>= 0 and <= ${T}`,
K
);
}
const ae = /[^+/0-9A-Za-z-_]/g;
function xe(K) {
if (K = K.split("=")[0], K = K.trim().replace(ae, ""), K.length < 2) return "";
for (; K.length % 4 !== 0; )
K = K + "=";
return K;
}
function ze(K, T) {
T = T || 1 / 0;
let D;
const W = K.length;
let re = null;
const ve = [];
for (let fe = 0; fe < W; ++fe) {
if (D = K.charCodeAt(fe), D > 55295 && D < 57344) {
if (!re) {
if (D > 56319) {
(T -= 3) > -1 && ve.push(239, 191, 189);
continue;
} else if (fe + 1 === W) {
(T -= 3) > -1 && ve.push(239, 191, 189);
continue;
}
re = D;
continue;
}
if (D < 56320) {
(T -= 3) > -1 && ve.push(239, 191, 189), re = D;
continue;
}
D = (re - 55296 << 10 | D - 56320) + 65536;
} else re && (T -= 3) > -1 && ve.push(239, 191, 189);
if (re = null, D < 128) {
if ((T -= 1) < 0) break;
ve.push(D);
} else if (D < 2048) {
if ((T -= 2) < 0) break;
ve.push(
D >> 6 | 192,
D & 63 | 128
);
} else if (D < 65536) {
if ((T -= 3) < 0) break;
ve.push(
D >> 12 | 224,
D >> 6 & 63 | 128,
D & 63 | 128
);
} else if (D < 1114112) {
if ((T -= 4) < 0) break;
ve.push(
D >> 18 | 240,
D >> 12 & 63 | 128,
D >> 6 & 63 | 128,
D & 63 | 128
);
} else
throw new Error("Invalid code point");
}
return ve;
}
function ye(K) {
const T = [];
for (let D = 0; D < K.length; ++D)
T.push(K.charCodeAt(D) & 255);
return T;
}
function Ee(K, T) {
let D, W, re;
const ve = [];
for (let fe = 0; fe < K.length && !((T -= 2) < 0); ++fe)
D = K.charCodeAt(fe), W = D >> 8, re = D % 256, ve.push(re), ve.push(W);
return ve;
}
function Ue(K) {
return L.toByteArray(xe(K));
}
function Ae(K, T, D, W) {
let re;
for (re = 0; re < W && !(re + D >= T.length || re >= K.length); ++re)
T[re + D] = K[re];
return re;
}
function Te(K, T) {
return K instanceof T || K != null && K.constructor != null && K.constructor.name != null && K.constructor.name === T.name;
}
function Qe(K) {
return K !== K;
}
const Ie = function() {
const K = "0123456789abcdef", T = new Array(256);
for (let D = 0; D < 16; ++D) {
const W = D * 16;
for (let re = 0; re < 16; ++re)
T[W + re] = K[D] + K[re];
}
return T;
}();
function Ne(K) {
return typeof BigInt > "u" ? tt : K;
}
function tt() {
throw new Error("BigInt not supported");
}
})(a);
const R = a.Buffer;
M.Blob = a.Blob, M.BlobOptions = a.BlobOptions, M.Buffer = a.Buffer, M.File = a.File, M.FileOptions = a.FileOptions, M.INSPECT_MAX_BYTES = a.INSPECT_MAX_BYTES, M.SlowBuffer = a.SlowBuffer, M.TranscodeEncoding = a.TranscodeEncoding, M.atob = a.atob, M.btoa = a.btoa, M.constants = a.constants, M.default = R, M.isAscii = a.isAscii, M.isUtf8 = a.isUtf8, M.kMaxLength = a.kMaxLength, M.kStringMaxLength = a.kStringMaxLength, M.resolveObjectURL = a.resolveObjectURL, M.transcode = a.transcode;
}(Ci)), Ci;
}
var pl = ci.exports, $s;
function ir() {
return $s || ($s = 1, function(M) {
(function(a, c) {
function h(r, i) {
if (!r) throw new Error(i || "Assertion failed");
}
function x(r, i) {
r.super_ = i;
var f = function() {
};
f.prototype = i.prototype, r.prototype = new f(), r.prototype.constructor = r;
}
function n(r, i, f) {
if (n.isBN(r))
return r;
this.negative = 0, this.words = null, this.length = 0, this.red = null, r !== null && ((i === "le" || i === "be") && (f = i, i = 10), this._init(r || 0, i || 10, f || "be"));
}
typeof a == "object" ? a.exports = n : c.BN = n, n.BN = n, n.wordSize = 26;
var y;
try {
typeof window < "u" &&