UNPKG

@btc-vision/transaction

Version:

OPNet transaction library allows you to create and sign transactions for the OPNet network.

1,568 lines 348 kB
var kt = { messagePrefix: `Bitcoin Signed Message: `, bech32: "bc", bech32Opnet: "op", bip32: { public: 76067358, private: 76066276 }, pubKeyHash: 0, scriptHash: 5, wif: 128 }, va = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, bitcoin: kt, bitcoinCash: { messagePrefix: `Bitcoin Signed Message: `, bech32: "bitcoincash", bech32Opnet: "opbch", bip32: { public: 76067358, private: 76066276 }, pubKeyHash: 0, scriptHash: 5, wif: 128 }, bitcoinCashTestnet: { messagePrefix: `Bitcoin Signed Message: `, bech32: "bchtest", bech32Opnet: "opbcht", bip32: { public: 70617039, private: 70615956 }, pubKeyHash: 111, scriptHash: 196, wif: 239 }, dash: { messagePrefix: `DarkCoin Signed Message: `, bech32: "", bech32Opnet: "", bip32: { public: 50221772, private: 50221816 }, pubKeyHash: 76, scriptHash: 16, wif: 204 }, dashTestnet: { messagePrefix: `DarkCoin Signed Message: `, bech32: "", bech32Opnet: "", bip32: { public: 981492128, private: 981489719 }, pubKeyHash: 140, scriptHash: 19, wif: 239 }, dogecoin: { messagePrefix: `Dogecoin Signed Message: `, bech32: "", bech32Opnet: "", bip32: { public: 49990397, private: 49988504 }, pubKeyHash: 30, scriptHash: 22, wif: 158 }, dogecoinTestnet: { messagePrefix: `Dogecoin Signed Message: `, bech32: "", bech32Opnet: "", bip32: { public: 70429096, private: 70427203 }, pubKeyHash: 113, scriptHash: 196, wif: 241 }, litecoin: { messagePrefix: `Litecoin Signed Message: `, bech32: "ltc", bech32Opnet: "opl", bip32: { public: 27108450, private: 27106558 }, pubKeyHash: 48, scriptHash: 50, wif: 176 }, litecoinTestnet: { messagePrefix: `Litecoin Signed Message: `, bech32: "tltc", bech32Opnet: "oplt", bip32: { public: 70709117, private: 70711009 }, pubKeyHash: 111, scriptHash: 58, wif: 239 }, opnetTestnet: { messagePrefix: `Bitcoin Signed Message: `, bech32: "opt", bech32Opnet: "opt", bip32: { public: 70617039, private: 70615956 }, pubKeyHash: 111, scriptHash: 196, wif: 239 }, regtest: { messagePrefix: `Bitcoin Signed Message: `, bech32: "bcrt", bech32Opnet: "opr", bip32: { public: 70617039, private: 70615956 }, pubKeyHash: 111, scriptHash: 196, wif: 239 }, testnet: { messagePrefix: `Bitcoin Signed Message: `, bech32: "tb", bech32Opnet: "opt", bip32: { public: 70617039, private: 70615956 }, pubKeyHash: 111, scriptHash: 196, wif: 239 } }, Symbol.toStringTag, { value: "Module" })), ye = {}, vi; function Ia() { if (vi) return ye; vi = 1, Object.defineProperty(ye, "__esModule", { value: !0 }), ye.bech32m = ye.bech32 = void 0; const e = "qpzry9x8gf2tvdw0s3jn54khce6mua7l", t = {}; for (let p = 0; p < 32; p++) { const u = e.charAt(p); t[u] = p; } function r(p) { const u = p >> 25; return (p & 33554431) << 5 ^ -(u >> 0 & 1) & 996825010 ^ -(u >> 1 & 1) & 642813549 ^ -(u >> 2 & 1) & 513874426 ^ -(u >> 3 & 1) & 1027748829 ^ -(u >> 4 & 1) & 705979059; } function n(p) { let u = 1; for (let d = 0; d < p.length; ++d) { const w = p.charCodeAt(d); if (w < 33 || w > 126) return "Invalid prefix (" + p + ")"; u = r(u) ^ w >> 5; } u = r(u); for (let d = 0; d < p.length; ++d) { const w = p.charCodeAt(d); u = r(u) ^ w & 31; } return u; } function i(p, u, d, w) { let b = 0, m = 0; const v = (1 << d) - 1, I = []; for (let P = 0; P < p.length; ++P) for (b = b << u | p[P], m += u; m >= d; ) m -= d, I.push(b >> m & v); if (w) m > 0 && I.push(b << d - m & v); else { if (m >= u) return "Excess padding"; if (b << d - m & v) return "Non-zero padding"; } return I; } function o(p) { return i(p, 8, 5, !0); } function a(p) { const u = i(p, 5, 8, !1); if (Array.isArray(u)) return u; } function f(p) { const u = i(p, 5, 8, !1); if (Array.isArray(u)) return u; throw new Error(u); } function l(p) { let u; p === "bech32" ? u = 1 : u = 734539939; function d(v, I, P) { if (P = P || 90, v.length + 7 + I.length > P) throw new TypeError("Exceeds length limit"); v = v.toLowerCase(); let S = n(v); if (typeof S == "string") throw new Error(S); let _ = v + "1"; for (let O = 0; O < I.length; ++O) { const z = I[O]; if (z >> 5 !== 0) throw new Error("Non 5-bit word"); S = r(S) ^ z, _ += e.charAt(z); } for (let O = 0; O < 6; ++O) S = r(S); S ^= u; for (let O = 0; O < 6; ++O) { const z = S >> (5 - O) * 5 & 31; _ += e.charAt(z); } return _; } function w(v, I) { if (I = I || 90, v.length < 8) return v + " too short"; if (v.length > I) return "Exceeds length limit"; const P = v.toLowerCase(), S = v.toUpperCase(); if (v !== P && v !== S) return "Mixed-case string " + v; v = P; const _ = v.lastIndexOf("1"); if (_ === -1) return "No separator character for " + v; if (_ === 0) return "Missing prefix for " + v; const O = v.slice(0, _), z = v.slice(_ + 1); if (z.length < 6) return "Data too short"; let D = n(O); if (typeof D == "string") return D; const X = []; for (let at = 0; at < z.length; ++at) { const q = z.charAt(at), Vt = t[q]; if (Vt === void 0) return "Unknown character " + q; D = r(D) ^ Vt, !(at + 6 >= z.length) && X.push(Vt); } return D !== u ? "Invalid checksum for " + v : { prefix: O, words: X }; } function b(v, I) { const P = w(v, I); if (typeof P == "object") return P; } function m(v, I) { const P = w(v, I); if (typeof P == "object") return P; throw new Error(P); } return { decodeUnsafe: b, decode: m, encode: d, toWords: o, fromWordsUnsafe: a, fromWords: f }; } return ye.bech32 = l("bech32"), ye.bech32m = l("bech32m"), ye; } var tt = Ia(); function cr(e) { let t, r; try { t = tt.bech32.decode(e); } catch { } if (t) { if (r = t.words[0], r !== 0) throw new TypeError(e + " uses wrong encoding"); } else if (t = tt.bech32m.decode(e), r = t.words[0], r === 0) throw new TypeError(e + " uses wrong encoding"); const n = tt.bech32.fromWords(t.words.slice(1)); return { version: r, prefix: t.prefix, data: new Uint8Array(n) }; } var Ts = "0123456789abcdefABCDEF"; Ts.split("").map((e) => e.codePointAt(0)); Array(256).fill(!0).map((e, t) => { const r = String.fromCodePoint(t), n = Ts.indexOf(r); return n < 0 ? void 0 : n < 16 ? n : n - 6; }); new TextEncoder(); new TextDecoder(); function Aa(e, t, r, n) { if (t + 2 > e.length) throw new Error("Offset is outside the bounds of Uint8Array"); if (n = n.toUpperCase(), r > 65535) throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 65535. Received ${r}`); n === "LE" ? (e[t] = r & 255, e[t + 1] = r >> 8 & 255) : (e[t] = r >> 8 & 255, e[t + 1] = r & 255); } function Sa(e, t, r, n) { if (t + 4 > e.length) throw new Error("Offset is outside the bounds of Uint8Array"); if (n = n.toUpperCase(), r > 4294967295) throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 4294967295. Received ${r}`); n === "LE" ? (e[t] = r & 255, e[t + 1] = r >> 8 & 255, e[t + 2] = r >> 16 & 255, e[t + 3] = r >> 24 & 255) : (e[t] = r >> 24 & 255, e[t + 1] = r >> 16 & 255, e[t + 2] = r >> 8 & 255, e[t + 3] = r & 255); } function Ta(e, t, r, n) { if (t + 8 > e.length) throw new Error("Offset is outside the bounds of Uint8Array"); if (n = n.toUpperCase(), r > 18446744073709551615n) throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 18446744073709551615. Received ${r}`); n === "LE" ? (e[t] = Number(r & 255n), e[t + 1] = Number(r >> 8n & 255n), e[t + 2] = Number(r >> 16n & 255n), e[t + 3] = Number(r >> 24n & 255n), e[t + 4] = Number(r >> 32n & 255n), e[t + 5] = Number(r >> 40n & 255n), e[t + 6] = Number(r >> 48n & 255n), e[t + 7] = Number(r >> 56n & 255n)) : (e[t] = Number(r >> 56n & 255n), e[t + 1] = Number(r >> 48n & 255n), e[t + 2] = Number(r >> 40n & 255n), e[t + 3] = Number(r >> 32n & 255n), e[t + 4] = Number(r >> 24n & 255n), e[t + 5] = Number(r >> 16n & 255n), e[t + 6] = Number(r >> 8n & 255n), e[t + 7] = Number(r & 255n)); } function ka(e, t, r) { if (t + 2 > e.length) throw new Error("Offset is outside the bounds of Uint8Array"); if (r = r.toUpperCase(), r === "LE") { let n = 0; return n = (n << 8) + e[t + 1], n = (n << 8) + e[t], n; } else { let n = 0; return n = (n << 8) + e[t], n = (n << 8) + e[t + 1], n; } } function Ua(e, t, r) { if (t + 4 > e.length) throw new Error("Offset is outside the bounds of Uint8Array"); if (r = r.toUpperCase(), r === "LE") { let n = 0; return n = (n << 8) + e[t + 3] >>> 0, n = (n << 8) + e[t + 2] >>> 0, n = (n << 8) + e[t + 1] >>> 0, n = (n << 8) + e[t] >>> 0, n; } else { let n = 0; return n = (n << 8) + e[t] >>> 0, n = (n << 8) + e[t + 1] >>> 0, n = (n << 8) + e[t + 2] >>> 0, n = (n << 8) + e[t + 3] >>> 0, n; } } function Oa(e, t, r) { if (t + 8 > e.length) throw new Error("Offset is outside the bounds of Uint8Array"); if (r = r.toUpperCase(), r === "LE") { let n = 0n; return n = (n << 8n) + BigInt(e[t + 7]), n = (n << 8n) + BigInt(e[t + 6]), n = (n << 8n) + BigInt(e[t + 5]), n = (n << 8n) + BigInt(e[t + 4]), n = (n << 8n) + BigInt(e[t + 3]), n = (n << 8n) + BigInt(e[t + 2]), n = (n << 8n) + BigInt(e[t + 1]), n = (n << 8n) + BigInt(e[t]), n; } else { let n = 0n; return n = (n << 8n) + BigInt(e[t]), n = (n << 8n) + BigInt(e[t + 1]), n = (n << 8n) + BigInt(e[t + 2]), n = (n << 8n) + BigInt(e[t + 3]), n = (n << 8n) + BigInt(e[t + 4]), n = (n << 8n) + BigInt(e[t + 5]), n = (n << 8n) + BigInt(e[t + 6]), n = (n << 8n) + BigInt(e[t + 7]), n; } } var Pa = (e) => { if (e < 0 || e > 18446744073709551615n) throw new RangeError("value out of range"); }; function xa(e) { if (e < 0 || e > Number.MAX_SAFE_INTEGER || e % 1 !== 0) throw new RangeError("value out of range"); } function ks(e) { typeof e == "number" ? xa(e) : Pa(e); } function ge(e, t, r) { ks(e), r === void 0 && (r = 0), t === void 0 && (t = new Uint8Array(Ct(e))); let n = 0; return e < 253 ? (t.set([Number(e)], r), n = 1) : e <= 65535 ? (t.set([253], r), Aa(t, r + 1, Number(e), "LE"), n = 3) : e <= 4294967295 ? (t.set([254], r), Sa(t, r + 1, Number(e), "LE"), n = 5) : (t.set([255], r), Ta(t, r + 1, BigInt(e), "LE"), n = 9), { buffer: t, bytes: n }; } function We(e, t) { t === void 0 && (t = 0); const r = e.at(t); if (r === void 0) throw new Error("buffer too small"); if (r < 253) return { numberValue: r, bigintValue: BigInt(r), bytes: 1 }; if (r === 253) { const n = ka(e, t + 1, "LE"); return { numberValue: n, bigintValue: BigInt(n), bytes: 3 }; } else if (r === 254) { const n = Ua(e, t + 1, "LE"); return { numberValue: n, bigintValue: BigInt(n), bytes: 5 }; } else { const n = Oa(e, t + 1, "LE"); return { numberValue: n <= Number.MAX_SAFE_INTEGER ? Number(n) : null, bigintValue: n, bytes: 9 }; } } function Ct(e) { return ks(e), e < 253 ? 1 : e <= 65535 ? 3 : e <= 4294967295 ? 5 : 9; } var Kl = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, decode: We, encode: ge, encodingLength: Ct }, Symbol.toStringTag, { value: "Module" })), Ba = Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0")), Ii = (() => { const e = new Array(128).fill(-1); for (let t = 0; t < 10; t++) e[48 + t] = t; for (let t = 0; t < 6; t++) e[65 + t] = 10 + t, e[97 + t] = 10 + t; return e; })(); function Yt(e) { let t = ""; for (let r = 0; r < e.length; r++) { const n = Ba[e[r]]; t += n; } return t; } function Mt(e) { e.length >= 2 && e[0] === "0" && (e[1] === "x" || e[1] === "X") && (e = e.slice(2)); const t = e.length; if (t % 2 !== 0) throw new TypeError("Invalid hex string: odd length"); const r = t / 2, n = new Uint8Array(r); for (let i = 0; i < r; i++) { const o = i * 2, a = e.charCodeAt(o), f = e.charCodeAt(o + 1); if (a >= 128 || f >= 128) throw new TypeError(`Invalid hex character at position ${o}`); const l = Ii[a], p = Ii[f]; if (l === -1) throw new TypeError(`Invalid hex character at position ${o}`); if (p === -1) throw new TypeError(`Invalid hex character at position ${o + 1}`); n[i] = l << 4 | p; } return n; } var _a = class Us { #t; #a; #e; constructor(t, r = 0) { this.#t = t, this.#a = new DataView(t.buffer, t.byteOffset, t.byteLength), this.#e = r; } get offset() { return this.#e; } set offset(t) { if (t < 0 || t > this.#t.length) throw new RangeError(`Offset ${t} is out of bounds [0, ${this.#t.length}]`); this.#e = t; } get length() { return this.#t.length; } get remaining() { return this.#t.length - this.#e; } get data() { return this.#t; } static fromHex(t) { return new Us(Mt(t)); } readUInt8() { if (this.#e >= this.#t.length) throw new RangeError("Read past end of buffer"); return this.#t[this.#e++]; } readInt8() { const t = this.readUInt8(); return t > 127 ? t - 256 : t; } readUInt16LE() { if (this.#e + 2 > this.#t.length) throw new RangeError("Read past end of buffer"); const t = this.#a.getUint16(this.#e, !0); return this.#e += 2, t; } readInt16LE() { if (this.#e + 2 > this.#t.length) throw new RangeError("Read past end of buffer"); const t = this.#a.getInt16(this.#e, !0); return this.#e += 2, t; } readUInt32LE() { if (this.#e + 4 > this.#t.length) throw new RangeError("Read past end of buffer"); const t = this.#a.getUint32(this.#e, !0); return this.#e += 4, t; } readInt32LE() { if (this.#e + 4 > this.#t.length) throw new RangeError("Read past end of buffer"); const t = this.#a.getInt32(this.#e, !0); return this.#e += 4, t; } readUInt64LE() { if (this.#e + 8 > this.#t.length) throw new RangeError("Read past end of buffer"); const t = this.#a.getBigUint64(this.#e, !0); return this.#e += 8, t; } readInt64LE() { if (this.#e + 8 > this.#t.length) throw new RangeError("Read past end of buffer"); const t = this.#a.getBigInt64(this.#e, !0); return this.#e += 8, t; } readBytes(t) { if (this.#e + t > this.#t.length) throw new RangeError("Read past end of buffer"); const r = this.#t.subarray(this.#e, this.#e + t); return this.#e += t, r; } readBytesCopy(t) { if (this.#e + t > this.#t.length) throw new RangeError("Read past end of buffer"); const r = this.#t.slice(this.#e, this.#e + t); return this.#e += t, r; } readVarInt() { const t = this.readUInt8(); if (t < 253) return t; if (t === 253) return this.readUInt16LE(); if (t === 254) return this.readUInt32LE(); const r = this.readUInt64LE(); if (r > BigInt(Number.MAX_SAFE_INTEGER)) throw new RangeError("VarInt value exceeds MAX_SAFE_INTEGER"); return Number(r); } readVarIntBig() { const t = this.readUInt8(); return t < 253 ? BigInt(t) : t === 253 ? BigInt(this.readUInt16LE()) : t === 254 ? BigInt(this.readUInt32LE()) : this.readUInt64LE(); } readVarBytes() { const t = this.readVarInt(); return this.readBytes(t); } readVector() { const t = this.readVarInt(), r = []; for (let n = 0; n < t; n++) r.push(this.readVarBytes()); return r; } peek() { if (!(this.#e >= this.#t.length)) return this.#t[this.#e]; } skip(t) { if (this.#e + t > this.#t.length) throw new RangeError("Skip past end of buffer"); this.#e += t; } reset() { this.#e = 0; } hasMore() { return this.#e < this.#t.length; } }, dt = class { #t; #a; #e; constructor(e, t = 0) { typeof e == "number" ? (this.#t = new Uint8Array(e), this.#e = 0) : (this.#t = e, this.#e = t), this.#a = new DataView(this.#t.buffer, this.#t.byteOffset, this.#t.byteLength); } get offset() { return this.#e; } set offset(e) { if (e < 0 || e > this.#t.length) throw new RangeError(`Offset ${e} is out of bounds [0, ${this.#t.length}]`); this.#e = e; } get capacity() { return this.#t.length; } get remaining() { return this.#t.length - this.#e; } get data() { return this.#t; } static growable(e = 256) { return new Ra(e); } writeUInt8(e) { if (this.#e >= this.#t.length) throw new RangeError("Write past end of buffer"); return this.#t[this.#e++] = e & 255, this; } writeInt8(e) { return this.writeUInt8(e < 0 ? e + 256 : e); } writeUInt16LE(e) { if (this.#e + 2 > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#a.setUint16(this.#e, e, !0), this.#e += 2, this; } writeInt16LE(e) { if (this.#e + 2 > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#a.setInt16(this.#e, e, !0), this.#e += 2, this; } writeUInt32LE(e) { if (this.#e + 4 > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#a.setUint32(this.#e, e, !0), this.#e += 4, this; } writeInt32LE(e) { if (this.#e + 4 > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#a.setInt32(this.#e, e, !0), this.#e += 4, this; } writeUInt64LE(e) { if (this.#e + 8 > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#a.setBigUint64(this.#e, e, !0), this.#e += 8, this; } writeInt64LE(e) { if (this.#e + 8 > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#a.setBigInt64(this.#e, e, !0), this.#e += 8, this; } writeBytes(e) { if (this.#e + e.length > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#t.set(e, this.#e), this.#e += e.length, this; } writeVarInt(e) { return e < 253 ? this.writeUInt8(e) : e <= 65535 ? (this.writeUInt8(253), this.writeUInt16LE(e)) : e <= 4294967295 ? (this.writeUInt8(254), this.writeUInt32LE(e)) : (this.writeUInt8(255), this.writeUInt64LE(BigInt(e))); } writeVarIntBig(e) { return e < 253n ? this.writeUInt8(Number(e)) : e <= 65535n ? (this.writeUInt8(253), this.writeUInt16LE(Number(e))) : e <= 4294967295n ? (this.writeUInt8(254), this.writeUInt32LE(Number(e))) : (this.writeUInt8(255), this.writeUInt64LE(e)); } writeVarBytes(e) { return this.writeVarInt(e.length), this.writeBytes(e); } writeVector(e) { this.writeVarInt(e.length); for (const t of e) this.writeVarBytes(t); return this; } fill(e, t) { if (this.#e + t > this.#t.length) throw new RangeError("Write past end of buffer"); return this.#t.fill(e, this.#e, this.#e + t), this.#e += t, this; } skip(e) { if (this.#e + e > this.#t.length) throw new RangeError("Skip past end of buffer"); return this.#e += e, this; } reset() { return this.#e = 0, this; } end() { if (this.#e === this.#t.length) return this.#t; throw new Error(`buffer size ${this.#t.length}, offset ${this.#e}`); } finish() { return this.#e === this.#t.length ? this.#t : this.#t.subarray(0, this.#e); } toHex() { return Yt(this.finish()); } }, Ra = class { #t; #a; #e = 0; constructor(e = 256) { this.#t = new Uint8Array(e), this.#a = new DataView(this.#t.buffer); } get offset() { return this.#e; } set offset(e) { if (e < 0) throw new RangeError(`Offset ${e} cannot be negative`); this.#e = e; } get capacity() { return this.#t.length; } writeUInt8(e) { return this.#s(1), this.#t[this.#e++] = e & 255, this; } writeUInt16LE(e) { return this.#s(2), this.#a.setUint16(this.#e, e, !0), this.#e += 2, this; } writeUInt32LE(e) { return this.#s(4), this.#a.setUint32(this.#e, e, !0), this.#e += 4, this; } writeInt32LE(e) { return this.#s(4), this.#a.setInt32(this.#e, e, !0), this.#e += 4, this; } writeUInt64LE(e) { return this.#s(8), this.#a.setBigUint64(this.#e, e, !0), this.#e += 8, this; } writeBytes(e) { return this.#s(e.length), this.#t.set(e, this.#e), this.#e += e.length, this; } writeVarInt(e) { return e < 253 ? this.writeUInt8(e) : e <= 65535 ? (this.writeUInt8(253), this.writeUInt16LE(e)) : e <= 4294967295 ? (this.writeUInt8(254), this.writeUInt32LE(e)) : (this.writeUInt8(255), this.writeUInt64LE(BigInt(e))); } writeVarBytes(e) { return this.writeVarInt(e.length), this.writeBytes(e); } writeVector(e) { this.writeVarInt(e.length); for (const t of e) this.writeVarBytes(t); return this; } finish() { return this.#t.slice(0, this.#e); } toHex() { return Yt(this.finish()); } #s(e) { const t = this.#e + e; if (t <= this.#t.length) return; let r = this.#t.length * 2; for (; r < t; ) r *= 2; const n = new Uint8Array(r); n.set(this.#t.subarray(0, this.#e)), this.#t = n, this.#a = new DataView(this.#t.buffer); } }; function Na(e) { return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array"; } function Os(e, t, r = "") { const n = Na(e), i = e?.length; if (!n || t !== void 0) { const o = r && `"${r}" `, a = n ? `length=${i}` : `type=${typeof e}`; throw new Error(o + "expected Uint8Array, got " + a); } return e; } function Ai(e, t = !0) { if (e.destroyed) throw new Error("Hash instance has been destroyed"); if (t && e.finished) throw new Error("Hash#digest() has already been called"); } function Ha(e, t) { Os(e, void 0, "digestInto() output"); const r = t.outputLen; if (e.length < r) throw new Error('"digestInto() output" expected to be of length >=' + r); } function Te(...e) { for (let t = 0; t < e.length; t++) e[t].fill(0); } function fn(e) { return new DataView(e.buffer, e.byteOffset, e.byteLength); } function Wt(e, t) { return e << 32 - t | e >>> t; } function Ee(e, t) { return e << t | e >>> 32 - t >>> 0; } function Wn(e, t = {}) { const r = (i, o) => e(o).update(i).digest(), n = e(void 0); return r.outputLen = n.outputLen, r.blockLen = n.blockLen, r.create = (i) => e(i), Object.assign(r, t), Object.freeze(r); } var La = (e) => ({ oid: Uint8Array.from([ 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, e ]) }); function Ps(e, t, r) { return e & t ^ ~e & r; } function xs(e, t, r) { return e & t ^ e & r ^ t & r; } var Gn = class { blockLen; outputLen; padOffset; isLE; buffer; view; finished = !1; length = 0; pos = 0; destroyed = !1; constructor(e, t, r, n) { this.blockLen = e, this.outputLen = t, this.padOffset = r, this.isLE = n, this.buffer = new Uint8Array(e), this.view = fn(this.buffer); } update(e) { Ai(this), Os(e); const { view: t, buffer: r, blockLen: n } = this, i = e.length; for (let o = 0; o < i; ) { const a = Math.min(n - this.pos, i - o); if (a === n) { const f = fn(e); for (; n <= i - o; o += n) this.process(f, o); continue; } r.set(e.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === n && (this.process(t, 0), this.pos = 0); } return this.length += e.length, this.roundClean(), this; } digestInto(e) { Ai(this), Ha(e, this), this.finished = !0; const { buffer: t, view: r, blockLen: n, isLE: i } = this; let { pos: o } = this; t[o++] = 128, Te(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(r, 0), o = 0); for (let u = o; u < n; u++) t[u] = 0; r.setBigUint64(n - 8, BigInt(this.length * 8), i), this.process(r, 0); const a = fn(e), f = this.outputLen; if (f % 4) throw new Error("_sha2: outputLen must be aligned to 32bit"); const l = f / 4, p = this.get(); if (l > p.length) throw new Error("_sha2: outputLen bigger than state"); for (let u = 0; u < l; u++) a.setUint32(4 * u, p[u], i); } digest() { const { buffer: e, outputLen: t } = this; this.digestInto(e); const r = e.slice(0, t); return this.destroy(), r; } _cloneInto(e) { e ||= new this.constructor(), e.set(...this.get()); const { blockLen: t, buffer: r, length: n, finished: i, destroyed: o, pos: a } = this; return e.destroyed = o, e.finished = i, e.length = n, e.pos = a, n % t && e.buffer.set(r), e; } clone() { return this._cloneInto(); } }, se = /* @__PURE__ */ Uint32Array.from([ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ]), Ca = /* @__PURE__ */ Uint32Array.from([ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ]), oe = /* @__PURE__ */ new Uint32Array(64), Va = class extends Gn { constructor(e) { super(64, e, 8, !1); } get() { const { A: e, B: t, C: r, D: n, E: i, F: o, G: a, H: f } = this; return [ e, t, r, n, i, o, a, f ]; } set(e, t, r, n, i, o, a, f) { this.A = e | 0, this.B = t | 0, this.C = r | 0, this.D = n | 0, this.E = i | 0, this.F = o | 0, this.G = a | 0, this.H = f | 0; } process(e, t) { for (let u = 0; u < 16; u++, t += 4) oe[u] = e.getUint32(t, !1); for (let u = 16; u < 64; u++) { const d = oe[u - 15], w = oe[u - 2], b = Wt(d, 7) ^ Wt(d, 18) ^ d >>> 3; oe[u] = (Wt(w, 17) ^ Wt(w, 19) ^ w >>> 10) + oe[u - 7] + b + oe[u - 16] | 0; } let { A: r, B: n, C: i, D: o, E: a, F: f, G: l, H: p } = this; for (let u = 0; u < 64; u++) { const d = Wt(a, 6) ^ Wt(a, 11) ^ Wt(a, 25), w = p + d + Ps(a, f, l) + Ca[u] + oe[u] | 0, b = (Wt(r, 2) ^ Wt(r, 13) ^ Wt(r, 22)) + xs(r, n, i) | 0; p = l, l = f, f = a, a = o + w | 0, o = i, i = n, n = r, r = w + b | 0; } r = r + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, f = f + this.F | 0, l = l + this.G | 0, p = p + this.H | 0, this.set(r, n, i, o, a, f, l, p); } roundClean() { Te(oe); } destroy() { this.set(0, 0, 0, 0, 0, 0, 0, 0), Te(this.buffer); } }, $a = class extends Va { A = se[0] | 0; B = se[1] | 0; C = se[2] | 0; D = se[3] | 0; E = se[4] | 0; F = se[5] | 0; G = se[6] | 0; H = se[7] | 0; constructor() { super(32); } }, Ke = /* @__PURE__ */ Wn(() => new $a(), /* @__PURE__ */ La(1)); function Ka(e) { if (e.length >= 255) throw new TypeError("Alphabet too long"); const t = new Uint8Array(256); for (let p = 0; p < t.length; p++) t[p] = 255; for (let p = 0; p < e.length; p++) { const u = e.charAt(p), d = u.charCodeAt(0); if (t[d] !== 255) throw new TypeError(u + " is ambiguous"); t[d] = p; } const r = e.length, n = e.charAt(0), i = Math.log(r) / Math.log(256), o = Math.log(256) / Math.log(r); function a(p) { if (p instanceof Uint8Array || (ArrayBuffer.isView(p) ? p = new Uint8Array(p.buffer, p.byteOffset, p.byteLength) : Array.isArray(p) && (p = Uint8Array.from(p))), !(p instanceof Uint8Array)) throw new TypeError("Expected Uint8Array"); if (p.length === 0) return ""; let u = 0, d = 0, w = 0; const b = p.length; for (; w !== b && p[w] === 0; ) w++, u++; const m = (b - w) * o + 1 >>> 0, v = new Uint8Array(m); for (; w !== b; ) { let S = p[w], _ = 0; for (let O = m - 1; (S !== 0 || _ < d) && O !== -1; O--, _++) S += 256 * v[O] >>> 0, v[O] = S % r >>> 0, S = S / r >>> 0; if (S !== 0) throw new Error("Non-zero carry"); d = _, w++; } let I = m - d; for (; I !== m && v[I] === 0; ) I++; let P = n.repeat(u); for (; I < m; ++I) P += e.charAt(v[I]); return P; } function f(p) { if (typeof p != "string") throw new TypeError("Expected String"); if (p.length === 0) return new Uint8Array(); let u = 0, d = 0, w = 0; for (; p[u] === n; ) d++, u++; const b = (p.length - u) * i + 1 >>> 0, m = new Uint8Array(b); for (; u < p.length; ) { const S = p.charCodeAt(u); if (S > 255) return; let _ = t[S]; if (_ === 255) return; let O = 0; for (let z = b - 1; (_ !== 0 || O < w) && z !== -1; z--, O++) _ += r * m[z] >>> 0, m[z] = _ % 256 >>> 0, _ = _ / 256 >>> 0; if (_ !== 0) throw new Error("Non-zero carry"); w = O, u++; } let v = b - w; for (; v !== b && m[v] === 0; ) v++; const I = new Uint8Array(d + (b - v)); let P = d; for (; v !== b; ) I[P++] = m[v++]; return I; } function l(p) { const u = f(p); if (u) return u; throw new Error("Non-base" + r + " character"); } return { encode: a, decodeUnsafe: f, decode: l }; } var cn = Ka("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"); function Da(e) { function t(o) { const a = e(o), f = o.length + 4, l = new Uint8Array(f); return l.set(o, 0), l.set(a.subarray(0, 4), o.length), cn.encode(l); } function r(o) { const a = o.slice(0, -4), f = o.slice(-4), l = e(a); if (!(f[0] ^ l[0] | f[1] ^ l[1] | f[2] ^ l[2] | f[3] ^ l[3])) return a; } function n(o) { const a = cn.decodeUnsafe(o); if (a !== void 0) return r(a); } function i(o) { const a = r(cn.decode(o)); if (a === void 0) throw new Error("Invalid checksum"); return a; } return { encode: t, decode: i, decodeUnsafe: n }; } function Ma(e) { return Ke(Ke(e)); } var { encode: jn, decode: zn } = Da(Ma); function Bt(e) { let t = 0; for (const i of e) t += i.length; const r = new Uint8Array(t); let n = 0; for (const i of e) r.set(i, n), n += i.length; return r; } function x(e, t) { if (e.length !== t.length) return !1; for (let r = 0; r < e.length; r++) if (e[r] !== t[r]) return !1; return !0; } function De(e, t) { const r = Math.min(e.length, t.length); for (let n = 0; n < r; n++) { const i = e[n] - t[n]; if (i !== 0) return i; } return e.length - t.length; } function Un(e) { for (let t = 0; t < e.length; t++) if (e[t] !== 0) return !1; return !0; } function Si(e) { const t = new Uint8Array(e.length); return t.set(e), t; } function qn(e) { return e.reverse(), e; } function Et(e, t = 0) { const r = new Uint8Array(e); return t !== 0 && r.fill(t), r; } function Dl(e) { return new TextEncoder().encode(e); } function Fa(e) { if (e.length < 8 || e.length > 72 || e[0] !== 48 || e[1] !== e.length - 2 || e[2] !== 2) return !1; const t = e[3]; if (t === 0 || 5 + t >= e.length || e[4 + t] !== 2) return !1; const r = e[5 + t]; return !(r === 0 || 6 + t + r !== e.length || e[4] & 128 || t > 1 && e[4] === 0 && !(e[5] & 128) || e[t + 6] & 128 || r > 1 && e[t + 6] === 0 && !(e[t + 7] & 128)); } function Wa(e) { if (e.length < 8) throw new Error("DER sequence length is too short"); if (e.length > 72) throw new Error("DER sequence length is too long"); if (e[0] !== 48) throw new Error("Expected DER sequence"); if (e[1] !== e.length - 2) throw new Error("DER sequence length is invalid"); if (e[2] !== 2) throw new Error("Expected DER integer"); const t = e[3]; if (t === 0) throw new Error("R length is zero"); if (5 + t >= e.length) throw new Error("R length is too long"); if (e[4 + t] !== 2) throw new Error("Expected DER integer (2)"); const r = e[5 + t]; if (r === 0) throw new Error("S length is zero"); if (6 + t + r !== e.length) throw new Error("S length is invalid"); if (e[4] & 128) throw new Error("R value is negative"); if (t > 1 && e[4] === 0 && !(e[5] & 128)) throw new Error("R value excessively padded"); if (e[t + 6] & 128) throw new Error("S value is negative"); if (r > 1 && e[t + 6] === 0 && !(e[t + 7] & 128)) throw new Error("S value excessively padded"); return { r: e.subarray(4, 4 + t), s: e.subarray(6 + t) }; } function Ga(e, t) { const r = e.length, n = t.length; if (r === 0) throw new Error("R length is zero"); if (n === 0) throw new Error("S length is zero"); if (r > 33) throw new Error("R length is too long"); if (n > 33) throw new Error("S length is too long"); if (e[0] & 128) throw new Error("R value is negative"); if (t[0] & 128) throw new Error("S value is negative"); if (r > 1 && e[0] === 0 && !(e[1] & 128)) throw new Error("R value excessively padded"); if (n > 1 && t[0] === 0 && !(t[1] & 128)) throw new Error("S value excessively padded"); const i = Et(6 + r + n); return i[0] = 48, i[1] = i.length - 2, i[2] = 2, i[3] = e.length, i.set(e, 4), i[4 + r] = 2, i[5 + r] = t.length, i.set(t, 6 + r), i; } var j = { OP_FALSE: 0, OP_0: 0, OP_PUSHDATA1: 76, OP_PUSHDATA2: 77, OP_PUSHDATA4: 78, OP_1NEGATE: 79, OP_RESERVED: 80, OP_TRUE: 81, OP_1: 81, OP_2: 82, OP_3: 83, OP_4: 84, OP_5: 85, OP_6: 86, OP_7: 87, OP_8: 88, OP_9: 89, OP_10: 90, OP_11: 91, OP_12: 92, OP_13: 93, OP_14: 94, OP_15: 95, OP_16: 96, OP_NOP: 97, OP_VER: 98, OP_IF: 99, OP_NOTIF: 100, OP_VERIF: 101, OP_VERNOTIF: 102, OP_ELSE: 103, OP_ENDIF: 104, OP_VERIFY: 105, OP_RETURN: 106, OP_TOALTSTACK: 107, OP_FROMALTSTACK: 108, OP_2DROP: 109, OP_2DUP: 110, OP_3DUP: 111, OP_2OVER: 112, OP_2ROT: 113, OP_2SWAP: 114, OP_IFDUP: 115, OP_DEPTH: 116, OP_DROP: 117, OP_DUP: 118, OP_NIP: 119, OP_OVER: 120, OP_PICK: 121, OP_ROLL: 122, OP_ROT: 123, OP_SWAP: 124, OP_TUCK: 125, OP_CAT: 126, OP_SUBSTR: 127, OP_LEFT: 128, OP_RIGHT: 129, OP_SIZE: 130, OP_INVERT: 131, OP_AND: 132, OP_OR: 133, OP_XOR: 134, OP_EQUAL: 135, OP_EQUALVERIFY: 136, OP_RESERVED1: 137, OP_RESERVED2: 138, OP_1ADD: 139, OP_1SUB: 140, OP_2MUL: 141, OP_2DIV: 142, OP_NEGATE: 143, OP_ABS: 144, OP_NOT: 145, OP_0NOTEQUAL: 146, OP_ADD: 147, OP_SUB: 148, OP_MUL: 149, OP_DIV: 150, OP_MOD: 151, OP_LSHIFT: 152, OP_RSHIFT: 153, OP_BOOLAND: 154, OP_BOOLOR: 155, OP_NUMEQUAL: 156, OP_NUMEQUALVERIFY: 157, OP_NUMNOTEQUAL: 158, OP_LESSTHAN: 159, OP_GREATERTHAN: 160, OP_LESSTHANOREQUAL: 161, OP_GREATERTHANOREQUAL: 162, OP_MIN: 163, OP_MAX: 164, OP_WITHIN: 165, OP_RIPEMD160: 166, OP_SHA1: 167, OP_SHA256: 168, OP_HASH160: 169, OP_HASH256: 170, OP_CODESEPARATOR: 171, OP_CHECKSIG: 172, OP_CHECKSIGVERIFY: 173, OP_CHECKMULTISIG: 174, OP_CHECKMULTISIGVERIFY: 175, OP_NOP1: 176, OP_NOP2: 177, OP_CHECKLOCKTIMEVERIFY: 177, OP_NOP3: 178, OP_CHECKSEQUENCEVERIFY: 178, OP_NOP4: 179, OP_NOP5: 180, OP_NOP6: 181, OP_NOP7: 182, OP_NOP8: 183, OP_NOP9: 184, OP_NOP10: 185, OP_CHECKSIGADD: 186, OP_PUBKEYHASH: 253, OP_PUBKEY: 254, OP_INVALIDOPCODE: 255 }, mr; function Bs() { if (!mr) { mr = {}; for (const e of Object.keys(j)) { const t = j[e]; mr[t] = e; } } return mr; } Bs(); function _s(e) { return e < j.OP_PUSHDATA1 ? 1 : e <= 255 ? 2 : e <= 65535 ? 3 : 5; } function ja(e, t, r) { const n = _s(t), i = new DataView(e.buffer, e.byteOffset, e.byteLength); return n === 1 ? e[r] = t : n === 2 ? (e[r] = j.OP_PUSHDATA1, e[r + 1] = t) : n === 3 ? (e[r] = j.OP_PUSHDATA2, i.setUint16(r + 1, t, !0)) : (e[r] = j.OP_PUSHDATA4, i.setUint32(r + 1, t, !0)), n; } function za(e, t) { const r = new DataView(e.buffer, e.byteOffset, e.byteLength), n = e[t]; let i, o; if (n < j.OP_PUSHDATA1) i = n, o = 1; else if (n === j.OP_PUSHDATA1) { if (t + 2 > e.length) return null; i = e[t + 1], o = 2; } else if (n === j.OP_PUSHDATA2) { if (t + 3 > e.length) return null; i = r.getUint16(t + 1, !0), o = 3; } else { if (t + 5 > e.length) return null; if (n !== j.OP_PUSHDATA4) throw new Error("Unexpected opcode"); i = r.getUint32(t + 1, !0), o = 5; } return { opcode: n, number: i, size: o }; } var Rs = {}, Zr = {}; Zr.byteLength = Xa; Zr.toByteArray = Qa; Zr.fromByteArray = eh; var zt = [], Ht = [], qa = typeof Uint8Array < "u" ? Uint8Array : Array, ln = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; for (var Re = 0, Ya = ln.length; Re < Ya; ++Re) zt[Re] = ln[Re], Ht[ln.charCodeAt(Re)] = Re; Ht[45] = 62; Ht[95] = 63; function Ns(e) { var t = e.length; if (t % 4 > 0) throw new Error("Invalid string. Length must be a multiple of 4"); var r = e.indexOf("="); r === -1 && (r = t); var n = r === t ? 0 : 4 - r % 4; return [r, n]; } function Xa(e) { var t = Ns(e), r = t[0], n = t[1]; return (r + n) * 3 / 4 - n; } function Za(e, t, r) { return (t + r) * 3 / 4 - r; } function Qa(e) { var t, r = Ns(e), n = r[0], i = r[1], o = new qa(Za(e, n, i)), a = 0, f = i > 0 ? n - 4 : n, l; for (l = 0; l < f; l += 4) t = Ht[e.charCodeAt(l)] << 18 | Ht[e.charCodeAt(l + 1)] << 12 | Ht[e.charCodeAt(l + 2)] << 6 | Ht[e.charCodeAt(l + 3)], o[a++] = t >> 16 & 255, o[a++] = t >> 8 & 255, o[a++] = t & 255; return i === 2 && (t = Ht[e.charCodeAt(l)] << 2 | Ht[e.charCodeAt(l + 1)] >> 4, o[a++] = t & 255), i === 1 && (t = Ht[e.charCodeAt(l)] << 10 | Ht[e.charCodeAt(l + 1)] << 4 | Ht[e.charCodeAt(l + 2)] >> 2, o[a++] = t >> 8 & 255, o[a++] = t & 255), o; } function Ja(e) { return zt[e >> 18 & 63] + zt[e >> 12 & 63] + zt[e >> 6 & 63] + zt[e & 63]; } function th(e, t, r) { for (var n, i = [], o = t; o < r; o += 3) n = (e[o] << 16 & 16711680) + (e[o + 1] << 8 & 65280) + (e[o + 2] & 255), i.push(Ja(n)); return i.join(""); } function eh(e) { for (var t, r = e.length, n = r % 3, i = [], o = 16383, a = 0, f = r - n; a < f; a += o) i.push(th(e, a, a + o > f ? f : a + o)); return n === 1 ? (t = e[r - 1], i.push(zt[t >> 2] + zt[t << 4 & 63] + "==")) : n === 2 && (t = (e[r - 2] << 8) + e[r - 1], i.push(zt[t >> 10] + zt[t >> 4 & 63] + zt[t << 2 & 63] + "=")), i.join(""); } var Yn = {}; Yn.read = function(e, t, r, n, i) { var o, a, f = i * 8 - n - 1, l = (1 << f) - 1, p = l >> 1, u = -7, d = r ? i - 1 : 0, w = r ? -1 : 1, b = e[t + d]; for (d += w, o = b & (1 << -u) - 1, b >>= -u, u += f; u > 0; o = o * 256 + e[t + d], d += w, u -= 8) ; for (a = o & (1 << -u) - 1, o >>= -u, u += n; u > 0; a = a * 256 + e[t + d], d += w, u -= 8) ; if (o === 0) o = 1 - p; else { if (o === l) return a ? NaN : (b ? -1 : 1) * (1 / 0); a = a + Math.pow(2, n), o = o - p; } return (b ? -1 : 1) * a * Math.pow(2, o - n); }; Yn.write = function(e, t, r, n, i, o) { var a, f, l, p = o * 8 - i - 1, u = (1 << p) - 1, d = u >> 1, w = i === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, b = n ? 0 : o - 1, m = n ? 1 : -1, v = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0; for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (f = isNaN(t) ? 1 : 0, a = u) : (a = Math.floor(Math.log(t) / Math.LN2), t * (l = Math.pow(2, -a)) < 1 && (a--, l *= 2), a + d >= 1 ? t += w / l : t += w * Math.pow(2, 1 - d), t * l >= 2 && (a++, l /= 2), a + d >= u ? (f = 0, a = u) : a + d >= 1 ? (f = (t * l - 1) * Math.pow(2, i), a = a + d) : (f = t * Math.pow(2, d - 1) * Math.pow(2, i), a = 0)); i >= 8; e[r + b] = f & 255, b += m, f /= 256, i -= 8) ; for (a = a << i | f, p += i; p > 0; e[r + b] = a & 255, b += m, a /= 256, p -= 8) ; e[r + b - m] |= v * 128; }; (function(e) { const t = Zr, r = Yn, n = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null; e.Buffer = u, e.SlowBuffer = z, e.INSPECT_MAX_BYTES = 50; const i = 2147483647; e.kMaxLength = i; const { Uint8Array: o, ArrayBuffer: a, SharedArrayBuffer: f } = globalThis; u.TYPED_ARRAY_SUPPORT = l(), !u.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 l() { try { const s = new o(1), h = { foo: function() { return 42; } }; return Object.setPrototypeOf(h, o.prototype), Object.setPrototypeOf(s, h), s.foo() === 42; } catch { return !1; } } Object.defineProperty(u.prototype, "parent", { enumerable: !0, get: function() { if (u.isBuffer(this)) return this.buffer; } }), Object.defineProperty(u.prototype, "offset", { enumerable: !0, get: function() { if (u.isBuffer(this)) return this.byteOffset; } }); function p(s) { if (s > i) throw new RangeError('The value "' + s + '" is invalid for option "size"'); const h = new o(s); return Object.setPrototypeOf(h, u.prototype), h; } function u(s, h, c) { if (typeof s == "number") { if (typeof h == "string") throw new TypeError('The "string" argument must be of type string. Received type number'); return m(s); } return d(s, h, c); } u.poolSize = 8192; function d(s, h, c) { if (typeof s == "string") return v(s, h); if (a.isView(s)) return P(s); if (s == null) throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s); if (Ft(s, a) || s && Ft(s.buffer, a) || typeof f < "u" && (Ft(s, f) || s && Ft(s.buffer, f))) return S(s, h, c); if (typeof s == "number") throw new TypeError('The "value" argument must not be of type number. Received type number'); const g = s.valueOf && s.valueOf(); if (g != null && g !== s) return u.from(g, h, c); const y = _(s); if (y) return y; if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof s[Symbol.toPrimitive] == "function") return u.from(s[Symbol.toPrimitive]("string"), h, c); throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof s); } u.from = function(s, h, c) { return d(s, h, c); }, Object.setPrototypeOf(u.prototype, o.prototype), Object.setPrototypeOf(u, o); function w(s) { if (typeof s != "number") throw new TypeError('"size" argument must be of type number'); if (s < 0) throw new RangeError('The value "' + s + '" is invalid for option "size"'); } function b(s, h, c) { return w(s), s <= 0 ? p(s) : h !== void 0 ? typeof c == "string" ? p(s).fill(h, c) : p(s).fill(h) : p(s); } u.alloc = function(s, h, c) { return b(s, h, c); }; function m(s) { return w(s), p(s < 0 ? 0 : O(s) | 0); } u.allocUnsafe = function(s) { return m(s); }, u.allocUnsafeSlow = function(s) { return m(s); }; function v(s, h) { if ((typeof h != "string" || h === "") && (h = "utf8"), !u.isEncoding(h)) throw new TypeError("Unknown encoding: " + h); const c = D(s, h) | 0; let g = p(c); const y = g.write(s, h); return y !== c && (g = g.slice(0, y)), g; } function I(s) { const h = s.length < 0 ? 0 : O(s.length) | 0, c = p(h); for (let g = 0; g < h; g += 1) c[g] = s[g] & 255; return c; } function P(s) { if (Ft(s, o)) { const h = new o(s); return S(h.buffer, h.byteOffset, h.byteLength); } return I(s); } function S(s, h, c) { if (h < 0 || s.byteLength < h) throw new RangeError('"offset" is outside of buffer bounds'); if (s.byteLength < h + (c || 0)) throw new RangeError('"length" is outside of buffer bounds'); let g; return h === void 0 && c === void 0 ? g = new o(s) : c === void 0 ? g = new o(s, h) : g = new o(s, h, c), Object.setPrototypeOf(g, u.prototype), g; } function _(s) { if (u.isBuffer(s)) { const h = O(s.length) | 0, c = p(h); return c.length === 0 || s.copy(c, 0, 0, h), c; } if (s.length !== void 0) return typeof s.length != "number" || un(s.length) ? p(0) : I(s); if (s.type === "Buffer" && Array.isArray(s.data)) return I(s.data); } function O(s) { if (s >= i) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i.toString(16) + " bytes"); return s | 0; } function z(s) { return +s != s && (s = 0), u.alloc(+s); } u.isBuffer = function(s) { return s != null && s._isBuffer === !0 && s !== u.prototype; }, u.compare = function(s, h) { if (Ft(s, o) && (s = u.from(s, s.offset, s.byteLength)), Ft(h, o) && (h = u.from(h, h.offset, h.byteLength)), !u.isBuffer(s) || !u.isBuffer(h)) throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'); if (s === h) return 0; let c = s.length, g = h.length; for (let y = 0, E = Math.min(c, g); y < E; ++y) if (s[y] !== h[y]) { c = s[y], g = h[y]; break; } return c < g ? -1 : g < c ? 1 : 0; }, u.isEncoding = function(s) { switch (String(s).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; } }, u.concat = function(s, h) { if (!Array.isArray(s)) throw new TypeError('"list" argument must be an Array of Buffers'); if (s.length === 0) return u.alloc(0); let c; if (h === void 0) for (h = 0, c = 0; c < s.length; ++c) h += s[c].length; const g = u.allocUnsafe(h); let y = 0; for (c = 0; c < s.length; ++c) { let E = s[c]; if (Ft(E, o)) y + E.length > g.length ? (u.isBuffer(E) || (E = u.from(E)), E.copy(g, y)) : o.prototype.set.call(g, E, y); else if (u.isBuffer(E)) E.copy(g, y); else throw new TypeError('"list" argument must be an Array of Buffers'); y += E.length; } return g; }; function D(s, h) { if (u.isBuffer(s)) return s.length; if (a.isView(s) || Ft(s, a)) return s.byteLength; if (typeof s != "string") throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof s); const c = s.length, g = arguments.length > 2 && arguments[2] === !0; if (!g && c === 0) return 0; let y = !1; for (; ; ) switch (h) { case "ascii": case "latin1": case "binary": return c; case "utf8": case "utf-8": return hn(s).length; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return c * 2; case "hex": return c >>> 1; case "base64": return Ei(s).length; default: if (y) return g ? -1 : hn(s).length; h = ("" + h).toLowerCase(), y = !0; } } u.byteLength = D; function X(s, h, c) { let g = !1; if ((h === void 0 || h < 0) && (h = 0), h > this.length || ((c === void 0 || c > this.length) && (c = this.length), c <= 0) || (c >>>= 0, h >>>= 0, c <= h)) return ""; for (s || (s = "utf8"); ; ) switch (s) { case "hex": return F(this, h, c); case "utf8": case "utf-8": return V(this, h, c); case "ascii": return L(this, h, c); case "latin1": case "binary": return M(this, h, c); case "base64": return B(this, h, c); case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return ct(this, h, c); default: if (g) throw new TypeError("Unknown encoding: " + s); s = (s + "").toLowerCase(), g = !0; } } u.prototype._isBuffer = !0; function at(s, h, c) { const g = s[h]; s[h] = s[c], s[c] = g; } u.prototype.swap16 = function() { const s = this.length; if (s % 2 !== 0) throw new RangeError("Buffer size must be a multiple of 16-bits"); for (let h = 0; h < s; h += 2) at(this, h, h + 1); return this; }, u.prototype.swap32 = function() { const s = this.length; if (s % 4 !== 0) throw new RangeError("Buffer size must be a multiple of 32-bits"); for (let h = 0; h < s; h += 4) at(this, h, h + 3), at(this, h + 1, h + 2); return this; }, u.prototype.swap64 = function() { const s = this.length; if (s % 8 !== 0) throw new RangeError("Buffer size must be a multiple of 64-bits"); for (let h = 0; h < s; h += 8) at(this, h, h + 7), at(this, h + 1, h + 6), at(this, h + 2, h + 5), at(this, h + 3, h + 4); return this; }, u.prototype.toString = function() { const s = this.length; return s === 0 ? "" : arguments.length === 0 ? V(this, 0, s) : X.apply(this, arguments); }, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(s) { if (!u.isBuffer(s)) throw new TypeError("Argument must be a Buffer"); return this === s ? !0 : u.compare(this, s) === 0; }, u.prototype.inspect = function() { let s = ""; const h = e.INSPECT_MAX_BYTES; return s = this.toString("hex", 0, h).replace(/(.{2})/g, "$1 ").trim(), this.length > h && (s += " ... "), "<Buffer " + s + ">"; }, n && (u.prototype[n] = u.prototype.inspect), u.prototype.com