@seven.io/client
Version:
Official API client for seven
1,139 lines (1,138 loc) • 121 kB
JavaScript
const Te = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Fe = "ARRAYBUFFER not supported by this environment", ve = "UINT8ARRAY not supported by this environment";
function ue(e, t, i, s) {
let a, c, l;
const g = t || [0], w = (i = i || 0) >>> 3, y = s === -1 ? 3 : 0;
for (a = 0; a < e.length; a += 1) l = a + w, c = l >>> 2, g.length <= c && g.push(0), g[c] |= e[a] << 8 * (y + s * (l % 4));
return { value: g, binLen: 8 * e.length + i };
}
function xt(e, t, i) {
switch (t) {
case "UTF8":
case "UTF16BE":
case "UTF16LE":
break;
default:
throw new Error("encoding must be UTF8, UTF16BE, or UTF16LE");
}
switch (e) {
case "HEX":
return function(s, a, c) {
return (function(l, g, w, y) {
let h, d, b, I;
if (l.length % 2 != 0) throw new Error("String of HEX type must be in byte increments");
const E = g || [0], B = (w = w || 0) >>> 3, S = y === -1 ? 3 : 0;
for (h = 0; h < l.length; h += 2) {
if (d = parseInt(l.substr(h, 2), 16), isNaN(d)) throw new Error("String of HEX type contains invalid characters");
for (I = (h >>> 1) + B, b = I >>> 2; E.length <= b; ) E.push(0);
E[b] |= d << 8 * (S + y * (I % 4));
}
return { value: E, binLen: 4 * l.length + w };
})(s, a, c, i);
};
case "TEXT":
return function(s, a, c) {
return (function(l, g, w, y, h) {
let d, b, I, E, B, S, D, M, _ = 0;
const U = w || [0], H = (y = y || 0) >>> 3;
if (g === "UTF8") for (D = h === -1 ? 3 : 0, I = 0; I < l.length; I += 1) for (d = l.charCodeAt(I), b = [], 128 > d ? b.push(d) : 2048 > d ? (b.push(192 | d >>> 6), b.push(128 | 63 & d)) : 55296 > d || 57344 <= d ? b.push(224 | d >>> 12, 128 | d >>> 6 & 63, 128 | 63 & d) : (I += 1, d = 65536 + ((1023 & d) << 10 | 1023 & l.charCodeAt(I)), b.push(240 | d >>> 18, 128 | d >>> 12 & 63, 128 | d >>> 6 & 63, 128 | 63 & d)), E = 0; E < b.length; E += 1) {
for (S = _ + H, B = S >>> 2; U.length <= B; ) U.push(0);
U[B] |= b[E] << 8 * (D + h * (S % 4)), _ += 1;
}
else for (D = h === -1 ? 2 : 0, M = g === "UTF16LE" && h !== 1 || g !== "UTF16LE" && h === 1, I = 0; I < l.length; I += 1) {
for (d = l.charCodeAt(I), M === !0 && (E = 255 & d, d = E << 8 | d >>> 8), S = _ + H, B = S >>> 2; U.length <= B; ) U.push(0);
U[B] |= d << 8 * (D + h * (S % 4)), _ += 2;
}
return { value: U, binLen: 8 * _ + y };
})(s, t, a, c, i);
};
case "B64":
return function(s, a, c) {
return (function(l, g, w, y) {
let h, d, b, I, E, B, S, D = 0;
const M = g || [0], _ = (w = w || 0) >>> 3, U = y === -1 ? 3 : 0, H = l.indexOf("=");
if (l.search(/^[a-zA-Z0-9=+/]+$/) === -1) throw new Error("Invalid character in base-64 string");
if (l = l.replace(/=/g, ""), H !== -1 && H < l.length) throw new Error("Invalid '=' found in base-64 string");
for (d = 0; d < l.length; d += 4) {
for (E = l.substr(d, 4), I = 0, b = 0; b < E.length; b += 1) h = Te.indexOf(E.charAt(b)), I |= h << 18 - 6 * b;
for (b = 0; b < E.length - 1; b += 1) {
for (S = D + _, B = S >>> 2; M.length <= B; ) M.push(0);
M[B] |= (I >>> 16 - 8 * b & 255) << 8 * (U + y * (S % 4)), D += 1;
}
}
return { value: M, binLen: 8 * D + w };
})(s, a, c, i);
};
case "BYTES":
return function(s, a, c) {
return (function(l, g, w, y) {
let h, d, b, I;
const E = g || [0], B = (w = w || 0) >>> 3, S = y === -1 ? 3 : 0;
for (d = 0; d < l.length; d += 1) h = l.charCodeAt(d), I = d + B, b = I >>> 2, E.length <= b && E.push(0), E[b] |= h << 8 * (S + y * (I % 4));
return { value: E, binLen: 8 * l.length + w };
})(s, a, c, i);
};
case "ARRAYBUFFER":
try {
new ArrayBuffer(0);
} catch {
throw new Error(Fe);
}
return function(s, a, c) {
return (function(l, g, w, y) {
return ue(new Uint8Array(l), g, w, y);
})(s, a, c, i);
};
case "UINT8ARRAY":
try {
new Uint8Array(0);
} catch {
throw new Error(ve);
}
return function(s, a, c) {
return ue(s, a, c, i);
};
default:
throw new Error("format must be HEX, TEXT, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY");
}
}
function ce(e, t, i, s) {
switch (e) {
case "HEX":
return function(a) {
return (function(c, l, g, w) {
const y = "0123456789abcdef";
let h, d, b = "";
const I = l / 8, E = g === -1 ? 3 : 0;
for (h = 0; h < I; h += 1) d = c[h >>> 2] >>> 8 * (E + g * (h % 4)), b += y.charAt(d >>> 4 & 15) + y.charAt(15 & d);
return w.outputUpper ? b.toUpperCase() : b;
})(a, t, i, s);
};
case "B64":
return function(a) {
return (function(c, l, g, w) {
let y, h, d, b, I, E = "";
const B = l / 8, S = g === -1 ? 3 : 0;
for (y = 0; y < B; y += 3) for (b = y + 1 < B ? c[y + 1 >>> 2] : 0, I = y + 2 < B ? c[y + 2 >>> 2] : 0, d = (c[y >>> 2] >>> 8 * (S + g * (y % 4)) & 255) << 16 | (b >>> 8 * (S + g * ((y + 1) % 4)) & 255) << 8 | I >>> 8 * (S + g * ((y + 2) % 4)) & 255, h = 0; h < 4; h += 1) E += 8 * y + 6 * h <= l ? Te.charAt(d >>> 6 * (3 - h) & 63) : w.b64Pad;
return E;
})(a, t, i, s);
};
case "BYTES":
return function(a) {
return (function(c, l, g) {
let w, y, h = "";
const d = l / 8, b = g === -1 ? 3 : 0;
for (w = 0; w < d; w += 1) y = c[w >>> 2] >>> 8 * (b + g * (w % 4)) & 255, h += String.fromCharCode(y);
return h;
})(a, t, i);
};
case "ARRAYBUFFER":
try {
new ArrayBuffer(0);
} catch {
throw new Error(Fe);
}
return function(a) {
return (function(c, l, g) {
let w;
const y = l / 8, h = new ArrayBuffer(y), d = new Uint8Array(h), b = g === -1 ? 3 : 0;
for (w = 0; w < y; w += 1) d[w] = c[w >>> 2] >>> 8 * (b + g * (w % 4)) & 255;
return h;
})(a, t, i);
};
case "UINT8ARRAY":
try {
new Uint8Array(0);
} catch {
throw new Error(ve);
}
return function(a) {
return (function(c, l, g) {
let w;
const y = l / 8, h = g === -1 ? 3 : 0, d = new Uint8Array(y);
for (w = 0; w < y; w += 1) d[w] = c[w >>> 2] >>> 8 * (h + g * (w % 4)) & 255;
return d;
})(a, t, i);
};
default:
throw new Error("format must be HEX, B64, BYTES, ARRAYBUFFER, or UINT8ARRAY");
}
}
const vt = 4294967296, A = [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], et = [3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428], nt = [1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225], Nt = "Chosen SHA variant is not supported", Ne = "Cannot set numRounds with MAC";
function Ut(e, t) {
let i, s;
const a = e.binLen >>> 3, c = t.binLen >>> 3, l = a << 3, g = 4 - a << 3;
if (a % 4 != 0) {
for (i = 0; i < c; i += 4) s = a + i >>> 2, e.value[s] |= t.value[i >>> 2] << l, e.value.push(0), e.value[s + 1] |= t.value[i >>> 2] >>> g;
return (e.value.length << 2) - 4 >= c + a && e.value.pop(), { value: e.value, binLen: e.binLen + t.binLen };
}
return { value: e.value.concat(t.value), binLen: e.binLen + t.binLen };
}
function he(e) {
const t = { outputUpper: !1, b64Pad: "=", outputLen: -1 }, i = e || {}, s = "Output length must be a multiple of 8";
if (t.outputUpper = i.outputUpper || !1, i.b64Pad && (t.b64Pad = i.b64Pad), i.outputLen) {
if (i.outputLen % 8 != 0) throw new Error(s);
t.outputLen = i.outputLen;
} else if (i.shakeLen) {
if (i.shakeLen % 8 != 0) throw new Error(s);
t.outputLen = i.shakeLen;
}
if (typeof t.outputUpper != "boolean") throw new Error("Invalid outputUpper formatting option");
if (typeof t.b64Pad != "string") throw new Error("Invalid b64Pad formatting option");
return t;
}
function ut(e, t, i, s) {
const a = e + " must include a value and format";
if (!t) {
if (!s) throw new Error(a);
return s;
}
if (t.value === void 0 || !t.format) throw new Error(a);
return xt(t.format, t.encoding || "UTF8", i)(t.value);
}
class Dt {
constructor(t, i, s) {
const a = s || {};
if (this.t = i, this.i = a.encoding || "UTF8", this.numRounds = a.numRounds || 1, isNaN(this.numRounds) || this.numRounds !== parseInt(this.numRounds, 10) || 1 > this.numRounds) throw new Error("numRounds must a integer >= 1");
this.o = t, this.h = [], this.u = 0, this.l = !1, this.A = 0, this.H = !1, this.S = [], this.p = [];
}
update(t) {
let i, s = 0;
const a = this.m >>> 5, c = this.C(t, this.h, this.u), l = c.binLen, g = c.value, w = l >>> 5;
for (i = 0; i < w; i += a) s + this.m <= l && (this.U = this.v(g.slice(i, i + a), this.U), s += this.m);
return this.A += s, this.h = g.slice(s >>> 5), this.u = l % this.m, this.l = !0, this;
}
getHash(t, i) {
let s, a, c = this.R;
const l = he(i);
if (this.K) {
if (l.outputLen === -1) throw new Error("Output length must be specified in options");
c = l.outputLen;
}
const g = ce(t, c, this.T, l);
if (this.H && this.g) return g(this.g(l));
for (a = this.F(this.h.slice(), this.u, this.A, this.L(this.U), c), s = 1; s < this.numRounds; s += 1) this.K && c % 32 != 0 && (a[a.length - 1] &= 16777215 >>> 24 - c % 32), a = this.F(a, c, 0, this.B(this.o), c);
return g(a);
}
setHMACKey(t, i, s) {
if (!this.M) throw new Error("Variant does not support HMAC");
if (this.l) throw new Error("Cannot set MAC key after calling update");
const a = xt(i, (s || {}).encoding || "UTF8", this.T);
this.k(a(t));
}
k(t) {
const i = this.m >>> 3, s = i / 4 - 1;
let a;
if (this.numRounds !== 1) throw new Error(Ne);
if (this.H) throw new Error("MAC key already set");
for (i < t.binLen / 8 && (t.value = this.F(t.value, t.binLen, 0, this.B(this.o), this.R)); t.value.length <= s; ) t.value.push(0);
for (a = 0; a <= s; a += 1) this.S[a] = 909522486 ^ t.value[a], this.p[a] = 1549556828 ^ t.value[a];
this.U = this.v(this.S, this.U), this.A = this.m, this.H = !0;
}
getHMAC(t, i) {
const s = he(i);
return ce(t, this.R, this.T, s)(this.Y());
}
Y() {
let t;
if (!this.H) throw new Error("Cannot call getHMAC without first setting MAC key");
const i = this.F(this.h.slice(), this.u, this.A, this.L(this.U), this.R);
return t = this.v(this.p, this.B(this.o)), t = this.F(i, this.R, this.m, t, this.R), t;
}
}
function wt(e, t) {
return e << t | e >>> 32 - t;
}
function z(e, t) {
return e >>> t | e << 32 - t;
}
function Me(e, t) {
return e >>> t;
}
function le(e, t, i) {
return e ^ t ^ i;
}
function Re(e, t, i) {
return e & t ^ ~e & i;
}
function Pe(e, t, i) {
return e & t ^ e & i ^ t & i;
}
function dn(e) {
return z(e, 2) ^ z(e, 13) ^ z(e, 22);
}
function C(e, t) {
const i = (65535 & e) + (65535 & t);
return (65535 & (e >>> 16) + (t >>> 16) + (i >>> 16)) << 16 | 65535 & i;
}
function wn(e, t, i, s) {
const a = (65535 & e) + (65535 & t) + (65535 & i) + (65535 & s);
return (65535 & (e >>> 16) + (t >>> 16) + (i >>> 16) + (s >>> 16) + (a >>> 16)) << 16 | 65535 & a;
}
function St(e, t, i, s, a) {
const c = (65535 & e) + (65535 & t) + (65535 & i) + (65535 & s) + (65535 & a);
return (65535 & (e >>> 16) + (t >>> 16) + (i >>> 16) + (s >>> 16) + (a >>> 16) + (c >>> 16)) << 16 | 65535 & c;
}
function mn(e) {
return z(e, 7) ^ z(e, 18) ^ Me(e, 3);
}
function pn(e) {
return z(e, 6) ^ z(e, 11) ^ z(e, 25);
}
function gn(e) {
return [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
}
function Oe(e, t) {
let i, s, a, c, l, g, w;
const y = [];
for (i = t[0], s = t[1], a = t[2], c = t[3], l = t[4], w = 0; w < 80; w += 1) y[w] = w < 16 ? e[w] : wt(y[w - 3] ^ y[w - 8] ^ y[w - 14] ^ y[w - 16], 1), g = w < 20 ? St(wt(i, 5), Re(s, a, c), l, 1518500249, y[w]) : w < 40 ? St(wt(i, 5), le(s, a, c), l, 1859775393, y[w]) : w < 60 ? St(wt(i, 5), Pe(s, a, c), l, 2400959708, y[w]) : St(wt(i, 5), le(s, a, c), l, 3395469782, y[w]), l = c, c = a, a = wt(s, 30), s = i, i = g;
return t[0] = C(i, t[0]), t[1] = C(s, t[1]), t[2] = C(a, t[2]), t[3] = C(c, t[3]), t[4] = C(l, t[4]), t;
}
function yn(e, t, i, s) {
let a;
const c = 15 + (t + 65 >>> 9 << 4), l = t + i;
for (; e.length <= c; ) e.push(0);
for (e[t >>> 5] |= 128 << 24 - t % 32, e[c] = 4294967295 & l, e[c - 1] = l / vt | 0, a = 0; a < e.length; a += 16) s = Oe(e.slice(a, a + 16), s);
return s;
}
let xn = class extends Dt {
constructor(e, t, i) {
if (e !== "SHA-1") throw new Error(Nt);
super(e, t, i);
const s = i || {};
this.M = !0, this.g = this.Y, this.T = -1, this.C = xt(this.t, this.i, this.T), this.v = Oe, this.L = function(a) {
return a.slice();
}, this.B = gn, this.F = yn, this.U = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], this.m = 512, this.R = 160, this.K = !1, s.hmacKey && this.k(ut("hmacKey", s.hmacKey, this.T));
}
};
function fe(e) {
let t;
return t = e == "SHA-224" ? et.slice() : nt.slice(), t;
}
function de(e, t) {
let i, s, a, c, l, g, w, y, h, d, b;
const I = [];
for (i = t[0], s = t[1], a = t[2], c = t[3], l = t[4], g = t[5], w = t[6], y = t[7], b = 0; b < 64; b += 1) I[b] = b < 16 ? e[b] : wn(z(E = I[b - 2], 17) ^ z(E, 19) ^ Me(E, 10), I[b - 7], mn(I[b - 15]), I[b - 16]), h = St(y, pn(l), Re(l, g, w), A[b], I[b]), d = C(dn(i), Pe(i, s, a)), y = w, w = g, g = l, l = C(c, h), c = a, a = s, s = i, i = C(h, d);
var E;
return t[0] = C(i, t[0]), t[1] = C(s, t[1]), t[2] = C(a, t[2]), t[3] = C(c, t[3]), t[4] = C(l, t[4]), t[5] = C(g, t[5]), t[6] = C(w, t[6]), t[7] = C(y, t[7]), t;
}
let bn = class extends Dt {
constructor(e, t, i) {
if (e !== "SHA-224" && e !== "SHA-256") throw new Error(Nt);
super(e, t, i);
const s = i || {};
this.g = this.Y, this.M = !0, this.T = -1, this.C = xt(this.t, this.i, this.T), this.v = de, this.L = function(a) {
return a.slice();
}, this.B = fe, this.F = function(a, c, l, g) {
return (function(w, y, h, d, b) {
let I, E;
const B = 15 + (y + 65 >>> 9 << 4), S = y + h;
for (; w.length <= B; ) w.push(0);
for (w[y >>> 5] |= 128 << 24 - y % 32, w[B] = 4294967295 & S, w[B - 1] = S / vt | 0, I = 0; I < w.length; I += 16) d = de(w.slice(I, I + 16), d);
return E = b === "SHA-224" ? [d[0], d[1], d[2], d[3], d[4], d[5], d[6]] : d, E;
})(a, c, l, g, e);
}, this.U = fe(e), this.m = 512, this.R = e === "SHA-224" ? 224 : 256, this.K = !1, s.hmacKey && this.k(ut("hmacKey", s.hmacKey, this.T));
}
};
class m {
constructor(t, i) {
this.N = t, this.I = i;
}
}
function we(e, t) {
let i;
return t > 32 ? (i = 64 - t, new m(e.I << t | e.N >>> i, e.N << t | e.I >>> i)) : t !== 0 ? (i = 32 - t, new m(e.N << t | e.I >>> i, e.I << t | e.N >>> i)) : e;
}
function Z(e, t) {
let i;
return t < 32 ? (i = 32 - t, new m(e.N >>> t | e.I << i, e.I >>> t | e.N << i)) : (i = 64 - t, new m(e.I >>> t | e.N << i, e.N >>> t | e.I << i));
}
function Ue(e, t) {
return new m(e.N >>> t, e.I >>> t | e.N << 32 - t);
}
function En(e, t, i) {
return new m(e.N & t.N ^ e.N & i.N ^ t.N & i.N, e.I & t.I ^ e.I & i.I ^ t.I & i.I);
}
function In(e) {
const t = Z(e, 28), i = Z(e, 34), s = Z(e, 39);
return new m(t.N ^ i.N ^ s.N, t.I ^ i.I ^ s.I);
}
function $(e, t) {
let i, s;
i = (65535 & e.I) + (65535 & t.I), s = (e.I >>> 16) + (t.I >>> 16) + (i >>> 16);
const a = (65535 & s) << 16 | 65535 & i;
return i = (65535 & e.N) + (65535 & t.N) + (s >>> 16), s = (e.N >>> 16) + (t.N >>> 16) + (i >>> 16), new m((65535 & s) << 16 | 65535 & i, a);
}
function An(e, t, i, s) {
let a, c;
a = (65535 & e.I) + (65535 & t.I) + (65535 & i.I) + (65535 & s.I), c = (e.I >>> 16) + (t.I >>> 16) + (i.I >>> 16) + (s.I >>> 16) + (a >>> 16);
const l = (65535 & c) << 16 | 65535 & a;
return a = (65535 & e.N) + (65535 & t.N) + (65535 & i.N) + (65535 & s.N) + (c >>> 16), c = (e.N >>> 16) + (t.N >>> 16) + (i.N >>> 16) + (s.N >>> 16) + (a >>> 16), new m((65535 & c) << 16 | 65535 & a, l);
}
function Bn(e, t, i, s, a) {
let c, l;
c = (65535 & e.I) + (65535 & t.I) + (65535 & i.I) + (65535 & s.I) + (65535 & a.I), l = (e.I >>> 16) + (t.I >>> 16) + (i.I >>> 16) + (s.I >>> 16) + (a.I >>> 16) + (c >>> 16);
const g = (65535 & l) << 16 | 65535 & c;
return c = (65535 & e.N) + (65535 & t.N) + (65535 & i.N) + (65535 & s.N) + (65535 & a.N) + (l >>> 16), l = (e.N >>> 16) + (t.N >>> 16) + (i.N >>> 16) + (s.N >>> 16) + (a.N >>> 16) + (c >>> 16), new m((65535 & l) << 16 | 65535 & c, g);
}
function Et(e, t) {
return new m(e.N ^ t.N, e.I ^ t.I);
}
function Sn(e) {
const t = Z(e, 19), i = Z(e, 61), s = Ue(e, 6);
return new m(t.N ^ i.N ^ s.N, t.I ^ i.I ^ s.I);
}
function Tn(e) {
const t = Z(e, 1), i = Z(e, 8), s = Ue(e, 7);
return new m(t.N ^ i.N ^ s.N, t.I ^ i.I ^ s.I);
}
function Fn(e) {
const t = Z(e, 14), i = Z(e, 18), s = Z(e, 41);
return new m(t.N ^ i.N ^ s.N, t.I ^ i.I ^ s.I);
}
const vn = [new m(A[0], 3609767458), new m(A[1], 602891725), new m(A[2], 3964484399), new m(A[3], 2173295548), new m(A[4], 4081628472), new m(A[5], 3053834265), new m(A[6], 2937671579), new m(A[7], 3664609560), new m(A[8], 2734883394), new m(A[9], 1164996542), new m(A[10], 1323610764), new m(A[11], 3590304994), new m(A[12], 4068182383), new m(A[13], 991336113), new m(A[14], 633803317), new m(A[15], 3479774868), new m(A[16], 2666613458), new m(A[17], 944711139), new m(A[18], 2341262773), new m(A[19], 2007800933), new m(A[20], 1495990901), new m(A[21], 1856431235), new m(A[22], 3175218132), new m(A[23], 2198950837), new m(A[24], 3999719339), new m(A[25], 766784016), new m(A[26], 2566594879), new m(A[27], 3203337956), new m(A[28], 1034457026), new m(A[29], 2466948901), new m(A[30], 3758326383), new m(A[31], 168717936), new m(A[32], 1188179964), new m(A[33], 1546045734), new m(A[34], 1522805485), new m(A[35], 2643833823), new m(A[36], 2343527390), new m(A[37], 1014477480), new m(A[38], 1206759142), new m(A[39], 344077627), new m(A[40], 1290863460), new m(A[41], 3158454273), new m(A[42], 3505952657), new m(A[43], 106217008), new m(A[44], 3606008344), new m(A[45], 1432725776), new m(A[46], 1467031594), new m(A[47], 851169720), new m(A[48], 3100823752), new m(A[49], 1363258195), new m(A[50], 3750685593), new m(A[51], 3785050280), new m(A[52], 3318307427), new m(A[53], 3812723403), new m(A[54], 2003034995), new m(A[55], 3602036899), new m(A[56], 1575990012), new m(A[57], 1125592928), new m(A[58], 2716904306), new m(A[59], 442776044), new m(A[60], 593698344), new m(A[61], 3733110249), new m(A[62], 2999351573), new m(A[63], 3815920427), new m(3391569614, 3928383900), new m(3515267271, 566280711), new m(3940187606, 3454069534), new m(4118630271, 4000239992), new m(116418474, 1914138554), new m(174292421, 2731055270), new m(289380356, 3203993006), new m(460393269, 320620315), new m(685471733, 587496836), new m(852142971, 1086792851), new m(1017036298, 365543100), new m(1126000580, 2618297676), new m(1288033470, 3409855158), new m(1501505948, 4234509866), new m(1607167915, 987167468), new m(1816402316, 1246189591)];
function me(e) {
return e === "SHA-384" ? [new m(3418070365, et[0]), new m(1654270250, et[1]), new m(2438529370, et[2]), new m(355462360, et[3]), new m(1731405415, et[4]), new m(41048885895, et[5]), new m(3675008525, et[6]), new m(1203062813, et[7])] : [new m(nt[0], 4089235720), new m(nt[1], 2227873595), new m(nt[2], 4271175723), new m(nt[3], 1595750129), new m(nt[4], 2917565137), new m(nt[5], 725511199), new m(nt[6], 4215389547), new m(nt[7], 327033209)];
}
function pe(e, t) {
let i, s, a, c, l, g, w, y, h, d, b, I;
const E = [];
for (i = t[0], s = t[1], a = t[2], c = t[3], l = t[4], g = t[5], w = t[6], y = t[7], b = 0; b < 80; b += 1) b < 16 ? (I = 2 * b, E[b] = new m(e[I], e[I + 1])) : E[b] = An(Sn(E[b - 2]), E[b - 7], Tn(E[b - 15]), E[b - 16]), h = Bn(y, Fn(l), (S = g, D = w, new m((B = l).N & S.N ^ ~B.N & D.N, B.I & S.I ^ ~B.I & D.I)), vn[b], E[b]), d = $(In(i), En(i, s, a)), y = w, w = g, g = l, l = $(c, h), c = a, a = s, s = i, i = $(h, d);
var B, S, D;
return t[0] = $(i, t[0]), t[1] = $(s, t[1]), t[2] = $(a, t[2]), t[3] = $(c, t[3]), t[4] = $(l, t[4]), t[5] = $(g, t[5]), t[6] = $(w, t[6]), t[7] = $(y, t[7]), t;
}
let Nn = class extends Dt {
constructor(e, t, i) {
if (e !== "SHA-384" && e !== "SHA-512") throw new Error(Nt);
super(e, t, i);
const s = i || {};
this.g = this.Y, this.M = !0, this.T = -1, this.C = xt(this.t, this.i, this.T), this.v = pe, this.L = function(a) {
return a.slice();
}, this.B = me, this.F = function(a, c, l, g) {
return (function(w, y, h, d, b) {
let I, E;
const B = 31 + (y + 129 >>> 10 << 5), S = y + h;
for (; w.length <= B; ) w.push(0);
for (w[y >>> 5] |= 128 << 24 - y % 32, w[B] = 4294967295 & S, w[B - 1] = S / vt | 0, I = 0; I < w.length; I += 32) d = pe(w.slice(I, I + 32), d);
return E = b === "SHA-384" ? [d[0].N, d[0].I, d[1].N, d[1].I, d[2].N, d[2].I, d[3].N, d[3].I, d[4].N, d[4].I, d[5].N, d[5].I] : [d[0].N, d[0].I, d[1].N, d[1].I, d[2].N, d[2].I, d[3].N, d[3].I, d[4].N, d[4].I, d[5].N, d[5].I, d[6].N, d[6].I, d[7].N, d[7].I], E;
})(a, c, l, g, e);
}, this.U = me(e), this.m = 1024, this.R = e === "SHA-384" ? 384 : 512, this.K = !1, s.hmacKey && this.k(ut("hmacKey", s.hmacKey, this.T));
}
};
const Mn = [new m(0, 1), new m(0, 32898), new m(2147483648, 32906), new m(2147483648, 2147516416), new m(0, 32907), new m(0, 2147483649), new m(2147483648, 2147516545), new m(2147483648, 32777), new m(0, 138), new m(0, 136), new m(0, 2147516425), new m(0, 2147483658), new m(0, 2147516555), new m(2147483648, 139), new m(2147483648, 32905), new m(2147483648, 32771), new m(2147483648, 32770), new m(2147483648, 128), new m(0, 32778), new m(2147483648, 2147483658), new m(2147483648, 2147516545), new m(2147483648, 32896), new m(0, 2147483649), new m(2147483648, 2147516424)], Rn = [[0, 36, 3, 41, 18], [1, 44, 10, 45, 2], [62, 6, 43, 15, 61], [28, 55, 25, 21, 56], [27, 20, 39, 8, 14]];
function jt(e) {
let t;
const i = [];
for (t = 0; t < 5; t += 1) i[t] = [new m(0, 0), new m(0, 0), new m(0, 0), new m(0, 0), new m(0, 0)];
return i;
}
function Pn(e) {
let t;
const i = [];
for (t = 0; t < 5; t += 1) i[t] = e[t].slice();
return i;
}
function Rt(e, t) {
let i, s, a, c;
const l = [], g = [];
if (e !== null) for (s = 0; s < e.length; s += 2) t[(s >>> 1) % 5][(s >>> 1) / 5 | 0] = Et(t[(s >>> 1) % 5][(s >>> 1) / 5 | 0], new m(e[s + 1], e[s]));
for (i = 0; i < 24; i += 1) {
for (c = jt(), s = 0; s < 5; s += 1) l[s] = (w = t[s][0], y = t[s][1], h = t[s][2], d = t[s][3], b = t[s][4], new m(w.N ^ y.N ^ h.N ^ d.N ^ b.N, w.I ^ y.I ^ h.I ^ d.I ^ b.I));
for (s = 0; s < 5; s += 1) g[s] = Et(l[(s + 4) % 5], we(l[(s + 1) % 5], 1));
for (s = 0; s < 5; s += 1) for (a = 0; a < 5; a += 1) t[s][a] = Et(t[s][a], g[s]);
for (s = 0; s < 5; s += 1) for (a = 0; a < 5; a += 1) c[a][(2 * s + 3 * a) % 5] = we(t[s][a], Rn[s][a]);
for (s = 0; s < 5; s += 1) for (a = 0; a < 5; a += 1) t[s][a] = Et(c[s][a], new m(~c[(s + 1) % 5][a].N & c[(s + 2) % 5][a].N, ~c[(s + 1) % 5][a].I & c[(s + 2) % 5][a].I));
t[0][0] = Et(t[0][0], Mn[i]);
}
var w, y, h, d, b;
return t;
}
function Le(e) {
let t, i, s = 0;
const a = [0, 0], c = [4294967295 & e, e / vt & 2097151];
for (t = 6; t >= 0; t--) i = c[t >> 2] >>> 8 * t & 255, i === 0 && s === 0 || (a[s + 1 >> 2] |= i << 8 * (s + 1), s += 1);
return s = s !== 0 ? s : 1, a[0] |= s, { value: s + 1 > 4 ? a : [a[0]], binLen: 8 + 8 * s };
}
function qt(e) {
return Ut(Le(e.binLen), e);
}
function ge(e, t) {
let i, s = Le(t);
s = Ut(s, e);
const a = t >>> 2, c = (a - s.value.length % a) % a;
for (i = 0; i < c; i++) s.value.push(0);
return s.value;
}
let On = class extends Dt {
constructor(e, t, i) {
let s = 6, a = 0;
super(e, t, i);
const c = i || {};
if (this.numRounds !== 1) {
if (c.kmacKey || c.hmacKey) throw new Error(Ne);
if (this.o === "CSHAKE128" || this.o === "CSHAKE256") throw new Error("Cannot set numRounds for CSHAKE variants");
}
switch (this.T = 1, this.C = xt(this.t, this.i, this.T), this.v = Rt, this.L = Pn, this.B = jt, this.U = jt(), this.K = !1, e) {
case "SHA3-224":
this.m = a = 1152, this.R = 224, this.M = !0, this.g = this.Y;
break;
case "SHA3-256":
this.m = a = 1088, this.R = 256, this.M = !0, this.g = this.Y;
break;
case "SHA3-384":
this.m = a = 832, this.R = 384, this.M = !0, this.g = this.Y;
break;
case "SHA3-512":
this.m = a = 576, this.R = 512, this.M = !0, this.g = this.Y;
break;
case "SHAKE128":
s = 31, this.m = a = 1344, this.R = -1, this.K = !0, this.M = !1, this.g = null;
break;
case "SHAKE256":
s = 31, this.m = a = 1088, this.R = -1, this.K = !0, this.M = !1, this.g = null;
break;
case "KMAC128":
s = 4, this.m = a = 1344, this.X(i), this.R = -1, this.K = !0, this.M = !1, this.g = this._;
break;
case "KMAC256":
s = 4, this.m = a = 1088, this.X(i), this.R = -1, this.K = !0, this.M = !1, this.g = this._;
break;
case "CSHAKE128":
this.m = a = 1344, s = this.O(i), this.R = -1, this.K = !0, this.M = !1, this.g = null;
break;
case "CSHAKE256":
this.m = a = 1088, s = this.O(i), this.R = -1, this.K = !0, this.M = !1, this.g = null;
break;
default:
throw new Error(Nt);
}
this.F = function(l, g, w, y, h) {
return (function(d, b, I, E, B, S, D) {
let M, _, U = 0;
const H = [], K = B >>> 5, st = b >>> 5;
for (M = 0; M < st && b >= B; M += K) E = Rt(d.slice(M, M + K), E), b -= B;
for (d = d.slice(M), b %= B; d.length < K; ) d.push(0);
for (M = b >>> 3, d[M >> 2] ^= S << M % 4 * 8, d[K - 1] ^= 2147483648, E = Rt(d, E); 32 * H.length < D && (_ = E[U % 5][U / 5 | 0], H.push(_.I), !(32 * H.length >= D)); ) H.push(_.N), U += 1, 64 * U % B == 0 && (Rt(null, E), U = 0);
return H;
})(l, g, 0, y, a, s, h);
}, c.hmacKey && this.k(ut("hmacKey", c.hmacKey, this.T));
}
O(e, t) {
const i = (function(a) {
const c = a || {};
return { funcName: ut("funcName", c.funcName, 1, { value: [], binLen: 0 }), customization: ut("Customization", c.customization, 1, { value: [], binLen: 0 }) };
})(e || {});
t && (i.funcName = t);
const s = Ut(qt(i.funcName), qt(i.customization));
if (i.customization.binLen !== 0 || i.funcName.binLen !== 0) {
const a = ge(s, this.m >>> 3);
for (let c = 0; c < a.length; c += this.m >>> 5) this.U = this.v(a.slice(c, c + (this.m >>> 5)), this.U), this.A += this.m;
return 4;
}
return 31;
}
X(e) {
const t = (function(s) {
const a = s || {};
return { kmacKey: ut("kmacKey", a.kmacKey, 1), funcName: { value: [1128353099], binLen: 32 }, customization: ut("Customization", a.customization, 1, { value: [], binLen: 0 }) };
})(e || {});
this.O(e, t.funcName);
const i = ge(qt(t.kmacKey), this.m >>> 3);
for (let s = 0; s < i.length; s += this.m >>> 5) this.U = this.v(i.slice(s, s + (this.m >>> 5)), this.U), this.A += this.m;
this.H = !0;
}
_(e) {
const t = Ut({ value: this.h.slice(), binLen: this.u }, (function(i) {
let s, a, c = 0;
const l = [0, 0], g = [4294967295 & i, i / vt & 2097151];
for (s = 6; s >= 0; s--) a = g[s >> 2] >>> 8 * s & 255, a === 0 && c === 0 || (l[c >> 2] |= a << 8 * c, c += 1);
return c = c !== 0 ? c : 1, l[c >> 2] |= c << 8 * c, { value: c + 1 > 4 ? l : [l[0]], binLen: 8 + 8 * c };
})(e.outputLen));
return this.F(t.value, t.binLen, this.A, this.L(this.U), e.outputLen);
}
};
class De {
constructor(t, i, s) {
if (t == "SHA-1") this.P = new xn(t, i, s);
else if (t == "SHA-224" || t == "SHA-256") this.P = new bn(t, i, s);
else if (t == "SHA-384" || t == "SHA-512") this.P = new Nn(t, i, s);
else {
if (t != "SHA3-224" && t != "SHA3-256" && t != "SHA3-384" && t != "SHA3-512" && t != "SHAKE128" && t != "SHAKE256" && t != "CSHAKE128" && t != "CSHAKE256" && t != "KMAC128" && t != "KMAC256") throw new Error(Nt);
this.P = new On(t, i, s);
}
}
update(t) {
return this.P.update(t), this;
}
getHash(t, i) {
return this.P.getHash(t, i);
}
setHMACKey(t, i, s) {
this.P.setHMACKey(t, i, s);
}
getHMAC(t, i) {
return this.P.getHMAC(t, i);
}
}
function Un(e) {
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
}
var ke = { exports: {} }, L = ke.exports = {}, V, Q;
function Xt() {
throw new Error("setTimeout has not been defined");
}
function Gt() {
throw new Error("clearTimeout has not been defined");
}
(function() {
try {
typeof setTimeout == "function" ? V = setTimeout : V = Xt;
} catch {
V = Xt;
}
try {
typeof clearTimeout == "function" ? Q = clearTimeout : Q = Gt;
} catch {
Q = Gt;
}
})();
function _e(e) {
if (V === setTimeout)
return setTimeout(e, 0);
if ((V === Xt || !V) && setTimeout)
return V = setTimeout, setTimeout(e, 0);
try {
return V(e, 0);
} catch {
try {
return V.call(null, e, 0);
} catch {
return V.call(this, e, 0);
}
}
}
function Ln(e) {
if (Q === clearTimeout)
return clearTimeout(e);
if ((Q === Gt || !Q) && clearTimeout)
return Q = clearTimeout, clearTimeout(e);
try {
return Q(e);
} catch {
try {
return Q.call(null, e);
} catch {
return Q.call(this, e);
}
}
}
var rt = [], gt = !1, lt, Ot = -1;
function Dn() {
!gt || !lt || (gt = !1, lt.length ? rt = lt.concat(rt) : Ot = -1, rt.length && Ce());
}
function Ce() {
if (!gt) {
var e = _e(Dn);
gt = !0;
for (var t = rt.length; t; ) {
for (lt = rt, rt = []; ++Ot < t; )
lt && lt[Ot].run();
Ot = -1, t = rt.length;
}
lt = null, gt = !1, Ln(e);
}
}
L.nextTick = function(e) {
var t = new Array(arguments.length - 1);
if (arguments.length > 1)
for (var i = 1; i < arguments.length; i++)
t[i - 1] = arguments[i];
rt.push(new He(e, t)), rt.length === 1 && !gt && _e(Ce);
};
function He(e, t) {
this.fun = e, this.array = t;
}
He.prototype.run = function() {
this.fun.apply(null, this.array);
};
L.title = "browser";
L.browser = !0;
L.env = {};
L.argv = [];
L.version = "";
L.versions = {};
function it() {
}
L.on = it;
L.addListener = it;
L.once = it;
L.off = it;
L.removeListener = it;
L.removeAllListeners = it;
L.emit = it;
L.prependListener = it;
L.prependOnceListener = it;
L.listeners = function(e) {
return [];
};
L.binding = function(e) {
throw new Error("process.binding is not supported");
};
L.cwd = function() {
return "/";
};
L.chdir = function(e) {
throw new Error("process.chdir is not supported");
};
L.umask = function() {
return 0;
};
var kn = ke.exports;
const yt = /* @__PURE__ */ Un(kn);
var Ye = typeof window < "u" && typeof window.document < "u";
// @ts-expect-error
typeof yt < "u" && // @ts-expect-error
yt.versions != null && // @ts-expect-error
yt.versions.node != null;
typeof window < "u" && window.name === "nodejs" || typeof navigator < "u" && "userAgent" in navigator && typeof navigator.userAgent == "string" && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
// @ts-expect-error
typeof Deno < "u" && // @ts-expect-error
typeof Deno.version < "u" && // @ts-expect-error
typeof Deno.version.deno < "u";
typeof yt < "u" && yt.versions != null && yt.versions.bun != null;
var j = /* @__PURE__ */ ((e) => (e[e.InvalidCountryCode = 201] = "InvalidCountryCode", e[e.InvalidRecipientNumber = 202] = "InvalidRecipientNumber", e[e.MissingAuthentication = 300] = "MissingAuthentication", e[e.MissingParameterTo = 301] = "MissingParameterTo", e[e.MissingParameterType = 304] = "MissingParameterType", e[e.MissingParameterText = 305] = "MissingParameterText", e[e.InvalidSender = 306] = "InvalidSender", e[e.MissingParameterUrl = 307] = "MissingParameterUrl", e[e.InvalidType = 400] = "InvalidType", e[e.ParameterLongExceedsCharLimit = 401] = "ParameterLongExceedsCharLimit", e[e.PreventedByReloadLock = 402] = "PreventedByReloadLock", e[e.DailyLimitReachedForNumber = 403] = "DailyLimitReachedForNumber", e[e.InsufficientCredits = 500] = "InsufficientCredits", e[e.CarrierFailed = 600] = "CarrierFailed", e[e.UnknownError = 700] = "UnknownError", e[e.MissingLogoFile = 801] = "MissingLogoFile", e[e.NonExistingLogoFile = 802] = "NonExistingLogoFile", e[e.MissingRingTone = 803] = "MissingRingTone", e[e.InvalidApiKey = 900] = "InvalidApiKey", e[e.InvalidMessageId = 901] = "InvalidMessageId", e[e.DeactivatedApi = 902] = "DeactivatedApi", e[e.DisallowedIp = 903] = "DisallowedIp", e))(j || {}), qe = {}, kt = {};
kt.byteLength = Hn;
kt.toByteArray = qn;
kt.fromByteArray = $n;
var J = [], W = [], _n = typeof Uint8Array < "u" ? Uint8Array : Array, Wt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
for (var mt = 0, Cn = Wt.length; mt < Cn; ++mt)
J[mt] = Wt[mt], W[Wt.charCodeAt(mt)] = mt;
W[45] = 62;
W[95] = 63;
function We(e) {
var t = e.length;
if (t % 4 > 0)
throw new Error("Invalid string. Length must be a multiple of 4");
var i = e.indexOf("=");
i === -1 && (i = t);
var s = i === t ? 0 : 4 - i % 4;
return [i, s];
}
function Hn(e) {
var t = We(e), i = t[0], s = t[1];
return (i + s) * 3 / 4 - s;
}
function Yn(e, t, i) {
return (t + i) * 3 / 4 - i;
}
function qn(e) {
var t, i = We(e), s = i[0], a = i[1], c = new _n(Yn(e, s, a)), l = 0, g = a > 0 ? s - 4 : s, w;
for (w = 0; w < g; w += 4)
t = W[e.charCodeAt(w)] << 18 | W[e.charCodeAt(w + 1)] << 12 | W[e.charCodeAt(w + 2)] << 6 | W[e.charCodeAt(w + 3)], c[l++] = t >> 16 & 255, c[l++] = t >> 8 & 255, c[l++] = t & 255;
return a === 2 && (t = W[e.charCodeAt(w)] << 2 | W[e.charCodeAt(w + 1)] >> 4, c[l++] = t & 255), a === 1 && (t = W[e.charCodeAt(w)] << 10 | W[e.charCodeAt(w + 1)] << 4 | W[e.charCodeAt(w + 2)] >> 2, c[l++] = t >> 8 & 255, c[l++] = t & 255), c;
}
function Wn(e) {
return J[e >> 18 & 63] + J[e >> 12 & 63] + J[e >> 6 & 63] + J[e & 63];
}
function Kn(e, t, i) {
for (var s, a = [], c = t; c < i; c += 3)
s = (e[c] << 16 & 16711680) + (e[c + 1] << 8 & 65280) + (e[c + 2] & 255), a.push(Wn(s));
return a.join("");
}
function $n(e) {
for (var t, i = e.length, s = i % 3, a = [], c = 16383, l = 0, g = i - s; l < g; l += c)
a.push(Kn(e, l, l + c > g ? g : l + c));
return s === 1 ? (t = e[i - 1], a.push(
J[t >> 2] + J[t << 4 & 63] + "=="
)) : s === 2 && (t = (e[i - 2] << 8) + e[i - 1], a.push(
J[t >> 10] + J[t >> 4 & 63] + J[t << 2 & 63] + "="
)), a.join("");
}
var Vt = {};
Vt.read = function(e, t, i, s, a) {
var c, l, g = a * 8 - s - 1, w = (1 << g) - 1, y = w >> 1, h = -7, d = i ? a - 1 : 0, b = i ? -1 : 1, I = e[t + d];
for (d += b, c = I & (1 << -h) - 1, I >>= -h, h += g; h > 0; c = c * 256 + e[t + d], d += b, h -= 8)
;
for (l = c & (1 << -h) - 1, c >>= -h, h += s; h > 0; l = l * 256 + e[t + d], d += b, h -= 8)
;
if (c === 0)
c = 1 - y;
else {
if (c === w)
return l ? NaN : (I ? -1 : 1) * (1 / 0);
l = l + Math.pow(2, s), c = c - y;
}
return (I ? -1 : 1) * l * Math.pow(2, c - s);
};
Vt.write = function(e, t, i, s, a, c) {
var l, g, w, y = c * 8 - a - 1, h = (1 << y) - 1, d = h >> 1, b = a === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0, I = s ? 0 : c - 1, E = s ? 1 : -1, B = t < 0 || t === 0 && 1 / t < 0 ? 1 : 0;
for (t = Math.abs(t), isNaN(t) || t === 1 / 0 ? (g = isNaN(t) ? 1 : 0, l = h) : (l = Math.floor(Math.log(t) / Math.LN2), t * (w = Math.pow(2, -l)) < 1 && (l--, w *= 2), l + d >= 1 ? t += b / w : t += b * Math.pow(2, 1 - d), t * w >= 2 && (l++, w /= 2), l + d >= h ? (g = 0, l = h) : l + d >= 1 ? (g = (t * w - 1) * Math.pow(2, a), l = l + d) : (g = t * Math.pow(2, d - 1) * Math.pow(2, a), l = 0)); a >= 8; e[i + I] = g & 255, I += E, g /= 256, a -= 8)
;
for (l = l << a | g, y += a; y > 0; e[i + I] = l & 255, I += E, l /= 256, y -= 8)
;
e[i + I - E] |= B * 128;
};
(function(e) {
const t = kt, i = Vt, s = typeof Symbol == "function" && typeof Symbol.for == "function" ? /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom") : null;
e.Buffer = h, e.SlowBuffer = H, e.INSPECT_MAX_BYTES = 50;
const a = 2147483647;
e.kMaxLength = a;
const { Uint8Array: c, ArrayBuffer: l, SharedArrayBuffer: g } = globalThis;
h.TYPED_ARRAY_SUPPORT = w(), !h.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 w() {
try {
const o = new c(1), n = { foo: function() {
return 42;
} };
return Object.setPrototypeOf(n, c.prototype), Object.setPrototypeOf(o, n), o.foo() === 42;
} catch {
return !1;
}
}
Object.defineProperty(h.prototype, "parent", {
enumerable: !0,
get: function() {
if (h.isBuffer(this))
return this.buffer;
}
}), Object.defineProperty(h.prototype, "offset", {
enumerable: !0,
get: function() {
if (h.isBuffer(this))
return this.byteOffset;
}
});
function y(o) {
if (o > a)
throw new RangeError('The value "' + o + '" is invalid for option "size"');
const n = new c(o);
return Object.setPrototypeOf(n, h.prototype), n;
}
function h(o, n, r) {
if (typeof o == "number") {
if (typeof n == "string")
throw new TypeError(
'The "string" argument must be of type string. Received type number'
);
return E(o);
}
return d(o, n, r);
}
h.poolSize = 8192;
function d(o, n, r) {
if (typeof o == "string")
return B(o, n);
if (l.isView(o))
return D(o);
if (o == null)
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof o
);
if (G(o, l) || o && G(o.buffer, l) || typeof g < "u" && (G(o, g) || o && G(o.buffer, g)))
return M(o, n, r);
if (typeof o == "number")
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
);
const u = o.valueOf && o.valueOf();
if (u != null && u !== o)
return h.from(u, n, r);
const f = _(o);
if (f) return f;
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof o[Symbol.toPrimitive] == "function")
return h.from(o[Symbol.toPrimitive]("string"), n, r);
throw new TypeError(
"The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof o
);
}
h.from = function(o, n, r) {
return d(o, n, r);
}, Object.setPrototypeOf(h.prototype, c.prototype), Object.setPrototypeOf(h, c);
function b(o) {
if (typeof o != "number")
throw new TypeError('"size" argument must be of type number');
if (o < 0)
throw new RangeError('The value "' + o + '" is invalid for option "size"');
}
function I(o, n, r) {
return b(o), o <= 0 ? y(o) : n !== void 0 ? typeof r == "string" ? y(o).fill(n, r) : y(o).fill(n) : y(o);
}
h.alloc = function(o, n, r) {
return I(o, n, r);
};
function E(o) {
return b(o), y(o < 0 ? 0 : U(o) | 0);
}
h.allocUnsafe = function(o) {
return E(o);
}, h.allocUnsafeSlow = function(o) {
return E(o);
};
function B(o, n) {
if ((typeof n != "string" || n === "") && (n = "utf8"), !h.isEncoding(n))
throw new TypeError("Unknown encoding: " + n);
const r = K(o, n) | 0;
let u = y(r);
const f = u.write(o, n);
return f !== r && (u = u.slice(0, f)), u;
}
function S(o) {
const n = o.length < 0 ? 0 : U(o.length) | 0, r = y(n);
for (let u = 0; u < n; u += 1)
r[u] = o[u] & 255;
return r;
}
function D(o) {
if (G(o, c)) {
const n = new c(o);
return M(n.buffer, n.byteOffset, n.byteLength);
}
return S(o);
}
function M(o, n, r) {
if (n < 0 || o.byteLength < n)
throw new RangeError('"offset" is outside of buffer bounds');
if (o.byteLength < n + (r || 0))
throw new RangeError('"length" is outside of buffer bounds');
let u;
return n === void 0 && r === void 0 ? u = new c(o) : r === void 0 ? u = new c(o, n) : u = new c(o, n, r), Object.setPrototypeOf(u, h.prototype), u;
}
function _(o) {
if (h.isBuffer(o)) {
const n = U(o.length) | 0, r = y(n);
return r.length === 0 || o.copy(r, 0, 0, n), r;
}
if (o.length !== void 0)
return typeof o.length != "number" || Yt(o.length) ? y(0) : S(o);
if (o.type === "Buffer" && Array.isArray(o.data))
return S(o.data);
}
function U(o) {
if (o >= a)
throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + a.toString(16) + " bytes");
return o | 0;
}
function H(o) {
return +o != o && (o = 0), h.alloc(+o);
}
h.isBuffer = function(n) {
return n != null && n._isBuffer === !0 && n !== h.prototype;
}, h.compare = function(n, r) {
if (G(n, c) && (n = h.from(n, n.offset, n.byteLength)), G(r, c) && (r = h.from(r, r.offset, r.byteLength)), !h.isBuffer(n) || !h.isBuffer(r))
throw new TypeError(
'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
);
if (n === r) return 0;
let u = n.length, f = r.length;
for (let p = 0, x = Math.min(u, f); p < x; ++p)
if (n[p] !== r[p]) {
u = n[p], f = r[p];
break;
}
return u < f ? -1 : f < u ? 1 : 0;
}, h.isEncoding = function(n) {
switch (String(n).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;
}
}, h.concat = function(n, r) {
if (!Array.isArray(n))
throw new TypeError('"list" argument must be an Array of Buffers');
if (n.length === 0)
return h.alloc(0);
let u;
if (r === void 0)
for (r = 0, u = 0; u < n.length; ++u)
r += n[u].length;
const f = h.allocUnsafe(r);
let p = 0;
for (u = 0; u < n.length; ++u) {
let x = n[u];
if (G(x, c))
p + x.length > f.length ? (h.isBuffer(x) || (x = h.from(x)), x.copy(f, p)) : c.prototype.set.call(
f,
x,
p
);
else if (h.isBuffer(x))
x.copy(f, p);
else
throw new TypeError('"list" argument must be an Array of Buffers');
p += x.length;
}
return f;
};
function K(o, n) {
if (h.isBuffer(o))
return o.length;
if (l.isView(o) || G(o, l))
return o.byteLength;
if (typeof o != "string")
throw new TypeError(
'The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type ' + typeof o
);
const r = o.length, u = arguments.length > 2 && arguments[2] === !0;
if (!u && r === 0) return 0;
let f = !1;
for (; ; )
switch (n) {
case "ascii":
case "latin1":
case "binary":
return r;
case "utf8":
case "utf-8":
return Ht(o).length;
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return r * 2;
case "hex":
return r >>> 1;
case "base64":
return ae(o).length;
default:
if (f)
return u ? -1 : Ht(o).length;
n = ("" + n).toLowerCase(), f = !0;
}
}
h.byteLength = K;
function st(o, n, r) {
let u = !1;
if ((n === void 0 || n < 0) && (n = 0), n > this.length || ((r === void 0 || r > this.length) && (r = this.length), r <= 0) || (r >>>= 0, n >>>= 0, r <= n))
return "";
for (o || (o = "utf8"); ; )
switch (o) {
case "hex":
return rn(this, n, r);
case "utf8":
case "utf-8":
return zt(this, n, r);
case "ascii":
return en(this, n, r);
case "latin1":
case "binary":
return nn(this, n, r);
case "base64":
return Ze(this, n, r);
case "ucs2":
case "ucs-2":
case "utf16le":
case "utf-16le":
return sn(this, n, r);
default:
if (u) throw new TypeError("Unknown encoding: " + o);
o = (o + "").toLowerCase(), u = !0;
}
}
h.prototype._isBuffer = !0;
function tt(o, n, r) {
const u = o[n];
o[n] = o[r], o[r] = u;
}
h.prototype.swap16 = function() {
const n = this.length;
if (n % 2 !== 0)
throw new RangeError("Buffer size must be a multiple of 16-bits");
for (let r = 0; r < n; r += 2)
tt(this, r, r + 1);
return this;
}, h.prototype.swap32 = function() {
const n = this.length;
if (n % 4 !== 0)
throw new RangeError("Buffer size must be a multiple of 32-bits");
for (let r = 0; r < n; r += 4)
tt(this, r, r + 3), tt(this, r + 1, r + 2);
return this;
}, h.prototype.swap64 = function() {
const n = this.length;
if (n % 8 !== 0)
throw new RangeError("Buffer size must be a multiple of 64-bits");
for (let r = 0; r < n; r += 8)
tt(this, r, r + 7), tt(this, r + 1, r + 6), tt(this, r + 2, r + 5), tt(this, r + 3, r + 4);
return this;
}, h.prototype.toString = function() {
const n = this.length;
return n === 0 ? "" : arguments.length === 0 ? zt(this, 0, n) : st.apply(this, arguments);
}, h.prototype.toLocaleString = h.prototype.toString, h.prototype.equals = function(n) {
if (!h.isBuffer(n)) throw new TypeError("Argument must be a Buffer");
return this === n ? !0 : h.compare(this, n) === 0;
}, h.prototype.inspect = function() {
let n = "";
const r = e.INSPECT_MAX_BYTES;
return n = this.toString("hex", 0, r).replace(/(.{2})/g, "$1 ").trim(), this.length > r && (n += " ... "), "<Buffer " + n + ">";
}, s && (h.prototype[s] = h.prototype.inspect), h.prototype.compare = function(n, r, u, f, p) {
if (G(n, c) && (n = h.from(n, n.offset, n.byteLength)), !h.isBuffer(n))
throw new TypeError(
'The "target" argument must be one of type Buffer or Uint8Array. Received type ' + typeof n
);
if (r === void 0 && (r = 0), u === void 0 && (u = n ? n.length : 0), f === void 0 && (f = 0), p === void 0 && (p = this.length), r < 0 || u > n.length || f < 0 || p > this.length)
throw new RangeError("out of range index");
if (f >= p && r >= u)
return 0;
if (f >= p)
return -1;
if (r >= u)
return 1;
if (r >>>= 0, u >>>= 0, f >>>= 0, p >>>= 0, this === n) return 0;
let x = p - f, T = u - r;
const P = Math.min(x, T), R = this.slice(f, p), O = n.slice(r, u);
for (let N = 0; N < P; ++N)
if (R[N] !== O[N]) {
x = R[N], T = O[N];
break;
}
return x < T ? -1 : T < x ? 1 : 0;
};
function Qt(o, n, r, u, f) {
if (o.length === 0) return -1;
if (typeof r == "string" ? (u = r, r = 0) : r > 2147483647 ? r = 2147483647 : r < -2147483648 && (r = -2147483648), r = +r, Yt(r) && (r = f ? 0 : o.length - 1), r < 0 && (r = o.length + r), r >= o.length) {
if (f) return -1;
r = o.length - 1;
} else if (r < 0)
if (f) r = 0;
else return -1;
if (typeof n == "string" && (n = h.from(n, u)), h.isBuffer(n))
return n.length === 0 ? -1 : Jt(o, n, r, u, f);
if (typeof n == "number")
return n = n & 255, typeof c.prototype.indexOf == "function" ? f ? c.prototype.indexOf.call(o, n, r) : c.prototype.lastIndexOf.call(o, n, r) : Jt(o, [n], r, u, f);
throw new TypeError("val must be string, number or Buffer");
}
function Jt(o, n, r, u, f) {
let p = 1, x = o.length, T = n.length;
if (u !== void 0 && (u = String(u).toLowerCase(), u === "ucs2" || u === "ucs-2" || u === "utf16le" || u === "utf-16le")) {
if (o.length < 2 || n.length < 2)
return -1;
p = 2, x /= 2, T /= 2, r /= 2;
}
function P(O, N) {
return p === 1 ? O[N] : O.readUInt16BE(N * p);
}
let R;
if (f) {
let O = -1;
for (R = r; R < x; R++)
if (P(o, R) === P(n, O === -1 ? 0 : R - O)) {
if (O === -1 && (O = R), R - O + 1 === T) return O * p;
} else
O !== -1 && (R -= R - O), O = -1;
} else
for (r + T > x && (r = x - T), R = r; R >= 0; R--) {
let O = !0;
for (let N = 0; N < T; N++)
if (P(o, R + N) !== P(n, N)) {