You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5158 lines
181 KiB

/*! For license information please see safari-notifications.js.LICENSE.txt */
let customModule;
(() => {
const t = {
82: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.createCurve = e.getHash = void 0);
const n = r(569),
o = r(89),
i = r(551);
function s(t) {
return {
hash: t,
hmac: (e, ...r) => (0, n.hmac)(t, e, (0, o.concatBytes)(...r)),
randomBytes: o.randomBytes,
};
}
(e.getHash = s),
(e.createCurve = function (t, e) {
const r = (e) => (0, i.weierstrass)({ ...t, ...s(e) });
return Object.freeze({ ...r(e), create: r });
});
},
525: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.validateBasic = e.wNAF = void 0);
const n = r(632),
o = r(219),
i = BigInt(0),
s = BigInt(1);
(e.wNAF = function (t, e) {
const r = (t, e) => {
const r = e.negate();
return t ? r : e;
},
n = (t) => ({
windows: Math.ceil(e / t) + 1,
windowSize: 2 ** (t - 1),
});
return {
constTimeNegate: r,
unsafeLadder(e, r) {
let n = t.ZERO,
o = e;
for (; r > i; )
r & s && (n = n.add(o)), (o = o.double()), (r >>= s);
return n;
},
precomputeWindow(t, e) {
const { windows: r, windowSize: o } = n(e),
i = [];
let s = t,
a = s;
for (let t = 0; t < r; t++) {
(a = s), i.push(a);
for (let t = 1; t < o; t++) (a = a.add(s)), i.push(a);
s = a.double();
}
return i;
},
wNAF(e, o, i) {
const { windows: a, windowSize: f } = n(e);
let c = t.ZERO,
u = t.BASE;
const h = BigInt(2 ** e - 1),
l = 2 ** e,
d = BigInt(e);
for (let t = 0; t < a; t++) {
const e = t * f;
let n = Number(i & h);
(i >>= d), n > f && ((n -= l), (i += s));
const a = e,
y = e + Math.abs(n) - 1,
p = t % 2 != 0,
g = n < 0;
0 === n ? (u = u.add(r(p, o[a]))) : (c = c.add(r(g, o[y])));
}
return { p: c, f: u };
},
wNAFCached(t, e, r, n) {
const o = t._WINDOW_SIZE || 1;
let i = e.get(t);
return (
i ||
((i = this.precomputeWindow(t, o)),
1 !== o && e.set(t, n(i))),
this.wNAF(o, i, r)
);
},
};
}),
(e.validateBasic = function (t) {
return (
(0, n.validateField)(t.Fp),
(0, o.validateObject)(
t,
{ n: "bigint", h: "bigint", Gx: "field", Gy: "field" },
{ nBitLength: "isSafeInteger", nByteLength: "isSafeInteger" },
),
Object.freeze({
...(0, n.nLength)(t.n, t.nBitLength),
...t,
p: t.Fp.ORDER,
})
);
});
},
134: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.createHasher =
e.isogenyMap =
e.hash_to_field =
e.expand_message_xof =
e.expand_message_xmd =
void 0);
const n = r(632),
o = r(219),
i = o.bytesToNumberBE;
function s(t, e) {
if (t < 0 || t >= 1 << (8 * e))
throw new Error(`bad I2OSP call: value=${t} length=${e}`);
const r = Array.from({ length: e }).fill(0);
for (let n = e - 1; n >= 0; n--) (r[n] = 255 & t), (t >>>= 8);
return new Uint8Array(r);
}
function a(t, e) {
const r = new Uint8Array(t.length);
for (let n = 0; n < t.length; n++) r[n] = t[n] ^ e[n];
return r;
}
function f(t) {
if (!(t instanceof Uint8Array))
throw new Error("Uint8Array expected");
}
function c(t) {
if (!Number.isSafeInteger(t)) throw new Error("number expected");
}
function u(t, e, r, n) {
f(t),
f(e),
c(r),
e.length > 255 &&
(e = n(
(0, o.concatBytes)((0, o.utf8ToBytes)("H2C-OVERSIZE-DST-"), e),
));
const { outputLen: i, blockLen: u } = n,
h = Math.ceil(r / i);
if (h > 255) throw new Error("Invalid xmd length");
const l = (0, o.concatBytes)(e, s(e.length, 1)),
d = s(0, u),
y = s(r, 2),
p = new Array(h),
g = n((0, o.concatBytes)(d, t, y, s(0, 1), l));
p[0] = n((0, o.concatBytes)(g, s(1, 1), l));
for (let t = 1; t <= h; t++) {
const e = [a(g, p[t - 1]), s(t + 1, 1), l];
p[t] = n((0, o.concatBytes)(...e));
}
return (0, o.concatBytes)(...p).slice(0, r);
}
function h(t, e, r, n, i) {
if ((f(t), f(e), c(r), e.length > 255)) {
const t = Math.ceil((2 * n) / 8);
e = i
.create({ dkLen: t })
.update((0, o.utf8ToBytes)("H2C-OVERSIZE-DST-"))
.update(e)
.digest();
}
if (r > 65535 || e.length > 255)
throw new Error("expand_message_xof: invalid lenInBytes");
return i
.create({ dkLen: r })
.update(t)
.update(s(r, 2))
.update(e)
.update(s(e.length, 1))
.digest();
}
function l(t, e, r) {
(0, o.validateObject)(r, {
DST: "stringOrUint8Array",
p: "bigint",
m: "isSafeInteger",
k: "isSafeInteger",
hash: "hash",
});
const { p: s, k: a, m: l, hash: d, expand: y, DST: p } = r;
f(t), c(e);
const g = (function (t) {
if (t instanceof Uint8Array) return t;
if ("string" == typeof t) return (0, o.utf8ToBytes)(t);
throw new Error("DST must be Uint8Array or string");
})(p),
w = s.toString(2).length,
b = Math.ceil((w + a) / 8),
m = e * l * b;
let E;
if ("xmd" === y) E = u(t, g, m, d);
else if ("xof" === y) E = h(t, g, m, a, d);
else {
if ("_internal_pass" !== y)
throw new Error('expand must be "xmd" or "xof"');
E = t;
}
const v = new Array(e);
for (let t = 0; t < e; t++) {
const e = new Array(l);
for (let r = 0; r < l; r++) {
const o = b * (r + t * l),
a = E.subarray(o, o + b);
e[r] = (0, n.mod)(i(a), s);
}
v[t] = e;
}
return v;
}
(e.expand_message_xmd = u),
(e.expand_message_xof = h),
(e.hash_to_field = l),
(e.isogenyMap = function (t, e) {
const r = e.map((t) => Array.from(t).reverse());
return (e, n) => {
const [o, i, s, a] = r.map((r) =>
r.reduce((r, n) => t.add(t.mul(r, e), n)),
);
return (
(e = t.div(o, i)), (n = t.mul(n, t.div(s, a))), { x: e, y: n }
);
};
}),
(e.createHasher = function (t, e, r) {
if ("function" != typeof e)
throw new Error("mapToCurve() must be defined");
return {
hashToCurve(n, o) {
const i = l(n, 2, { ...r, DST: r.DST, ...o }),
s = t.fromAffine(e(i[0])),
a = t.fromAffine(e(i[1])),
f = s.add(a).clearCofactor();
return f.assertValidity(), f;
},
encodeToCurve(n, o) {
const i = l(n, 1, { ...r, DST: r.encodeDST, ...o }),
s = t.fromAffine(e(i[0])).clearCofactor();
return s.assertValidity(), s;
},
};
});
},
632: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.mapHashToField =
e.getMinHashLength =
e.getFieldBytesLength =
e.hashToPrivateScalar =
e.FpSqrtEven =
e.FpSqrtOdd =
e.Field =
e.nLength =
e.FpIsSquare =
e.FpDiv =
e.FpInvertBatch =
e.FpPow =
e.validateField =
e.isNegativeLE =
e.FpSqrt =
e.tonelliShanks =
e.invert =
e.pow2 =
e.pow =
e.mod =
void 0);
const n = r(219),
o = BigInt(0),
i = BigInt(1),
s = BigInt(2),
a = BigInt(3),
f = BigInt(4),
c = BigInt(5),
u = BigInt(8);
function h(t, e) {
const r = t % e;
return r >= o ? r : e + r;
}
function l(t, e, r) {
if (r <= o || e < o) throw new Error("Expected power/modulo > 0");
if (r === i) return o;
let n = i;
for (; e > o; )
e & i && (n = (n * t) % r), (t = (t * t) % r), (e >>= i);
return n;
}
function d(t, e) {
if (t === o || e <= o)
throw new Error(
`invert: expected positive integers, got n=${t} mod=${e}`,
);
let r = h(t, e),
n = e,
s = o,
a = i,
f = i,
c = o;
for (; r !== o; ) {
const t = n / r,
e = n % r,
o = s - f * t,
i = a - c * t;
(n = r), (r = e), (s = f), (a = c), (f = o), (c = i);
}
if (n !== i) throw new Error("invert: does not exist");
return h(s, e);
}
function y(t) {
const e = (t - i) / s;
let r, n, a;
for (r = t - i, n = 0; r % s === o; r /= s, n++);
for (a = s; a < t && l(a, e, t) !== t - i; a++);
if (1 === n) {
const e = (t + i) / f;
return function (t, r) {
const n = t.pow(r, e);
if (!t.eql(t.sqr(n), r))
throw new Error("Cannot find square root");
return n;
};
}
const c = (r + i) / s;
return function (t, o) {
if (t.pow(o, e) === t.neg(t.ONE))
throw new Error("Cannot find square root");
let s = n,
f = t.pow(t.mul(t.ONE, a), r),
u = t.pow(o, c),
h = t.pow(o, r);
for (; !t.eql(h, t.ONE); ) {
if (t.eql(h, t.ZERO)) return t.ZERO;
let e = 1;
for (let r = t.sqr(h); e < s && !t.eql(r, t.ONE); e++)
r = t.sqr(r);
const r = t.pow(f, i << BigInt(s - e - 1));
(f = t.sqr(r)), (u = t.mul(u, r)), (h = t.mul(h, f)), (s = e);
}
return u;
};
}
function p(t) {
if (t % f === a) {
const e = (t + i) / f;
return function (t, r) {
const n = t.pow(r, e);
if (!t.eql(t.sqr(n), r))
throw new Error("Cannot find square root");
return n;
};
}
if (t % u === c) {
const e = (t - c) / u;
return function (t, r) {
const n = t.mul(r, s),
o = t.pow(n, e),
i = t.mul(r, o),
a = t.mul(t.mul(i, s), o),
f = t.mul(i, t.sub(a, t.ONE));
if (!t.eql(t.sqr(f), r))
throw new Error("Cannot find square root");
return f;
};
}
return y(t);
}
BigInt(9),
BigInt(16),
(e.mod = h),
(e.pow = l),
(e.pow2 = function (t, e, r) {
let n = t;
for (; e-- > o; ) (n *= n), (n %= r);
return n;
}),
(e.invert = d),
(e.tonelliShanks = y),
(e.FpSqrt = p),
(e.isNegativeLE = (t, e) => (h(t, e) & i) === i);
const g = [
"create",
"isValid",
"is0",
"neg",
"inv",
"sqrt",
"sqr",
"eql",
"add",
"sub",
"mul",
"pow",
"div",
"addN",
"subN",
"mulN",
"sqrN",
];
function w(t, e, r) {
if (r < o) throw new Error("Expected power > 0");
if (r === o) return t.ONE;
if (r === i) return e;
let n = t.ONE,
s = e;
for (; r > o; ) r & i && (n = t.mul(n, s)), (s = t.sqr(s)), (r >>= i);
return n;
}
function b(t, e) {
const r = new Array(e.length),
n = e.reduce(
(e, n, o) => (t.is0(n) ? e : ((r[o] = e), t.mul(e, n))),
t.ONE,
),
o = t.inv(n);
return (
e.reduceRight(
(e, n, o) =>
t.is0(n) ? e : ((r[o] = t.mul(e, r[o])), t.mul(e, n)),
o,
),
r
);
}
function m(t, e) {
const r = void 0 !== e ? e : t.toString(2).length;
return { nBitLength: r, nByteLength: Math.ceil(r / 8) };
}
function E(t) {
if ("bigint" != typeof t)
throw new Error("field order must be bigint");
const e = t.toString(2).length;
return Math.ceil(e / 8);
}
function v(t) {
const e = E(t);
return e + Math.ceil(e / 2);
}
(e.validateField = function (t) {
const e = g.reduce((t, e) => ((t[e] = "function"), t), {
ORDER: "bigint",
MASK: "bigint",
BYTES: "isSafeInteger",
BITS: "isSafeInteger",
});
return (0, n.validateObject)(t, e);
}),
(e.FpPow = w),
(e.FpInvertBatch = b),
(e.FpDiv = function (t, e, r) {
return t.mul(e, "bigint" == typeof r ? d(r, t.ORDER) : t.inv(r));
}),
(e.FpIsSquare = function (t) {
const e = (t.ORDER - i) / s;
return (r) => {
const n = t.pow(r, e);
return t.eql(n, t.ZERO) || t.eql(n, t.ONE);
};
}),
(e.nLength = m),
(e.Field = function (t, e, r = !1, s = {}) {
if (t <= o) throw new Error(`Expected Field ORDER > 0, got ${t}`);
const { nBitLength: a, nByteLength: f } = m(t, e);
if (f > 2048)
throw new Error(
"Field lengths over 2048 bytes are not supported",
);
const c = p(t),
u = Object.freeze({
ORDER: t,
BITS: a,
BYTES: f,
MASK: (0, n.bitMask)(a),
ZERO: o,
ONE: i,
create: (e) => h(e, t),
isValid: (e) => {
if ("bigint" != typeof e)
throw new Error(
"Invalid field element: expected bigint, got " + typeof e,
);
return o <= e && e < t;
},
is0: (t) => t === o,
isOdd: (t) => (t & i) === i,
neg: (e) => h(-e, t),
eql: (t, e) => t === e,
sqr: (e) => h(e * e, t),
add: (e, r) => h(e + r, t),
sub: (e, r) => h(e - r, t),
mul: (e, r) => h(e * r, t),
pow: (t, e) => w(u, t, e),
div: (e, r) => h(e * d(r, t), t),
sqrN: (t) => t * t,
addN: (t, e) => t + e,
subN: (t, e) => t - e,
mulN: (t, e) => t * e,
inv: (e) => d(e, t),
sqrt: s.sqrt || ((t) => c(u, t)),
invertBatch: (t) => b(u, t),
cmov: (t, e, r) => (r ? e : t),
toBytes: (t) =>
r
? (0, n.numberToBytesLE)(t, f)
: (0, n.numberToBytesBE)(t, f),
fromBytes: (t) => {
if (t.length !== f)
throw new Error(
`Fp.fromBytes: expected ${f}, got ${t.length}`,
);
return r
? (0, n.bytesToNumberLE)(t)
: (0, n.bytesToNumberBE)(t);
},
});
return Object.freeze(u);
}),
(e.FpSqrtOdd = function (t, e) {
if (!t.isOdd) throw new Error("Field doesn't have isOdd");
const r = t.sqrt(e);
return t.isOdd(r) ? r : t.neg(r);
}),
(e.FpSqrtEven = function (t, e) {
if (!t.isOdd) throw new Error("Field doesn't have isOdd");
const r = t.sqrt(e);
return t.isOdd(r) ? t.neg(r) : r;
}),
(e.hashToPrivateScalar = function (t, e, r = !1) {
const o = (t = (0, n.ensureBytes)("privateHash", t)).length,
s = m(e).nByteLength + 8;
if (s < 24 || o < s || o > 1024)
throw new Error(
`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${o}`,
);
return (
h(
r ? (0, n.bytesToNumberLE)(t) : (0, n.bytesToNumberBE)(t),
e - i,
) + i
);
}),
(e.getFieldBytesLength = E),
(e.getMinHashLength = v),
(e.mapHashToField = function (t, e, r = !1) {
const o = t.length,
s = E(e),
a = v(e);
if (o < 16 || o < a || o > 1024)
throw new Error(`expected ${a}-1024 bytes of input, got ${o}`);
const f =
h(
r ? (0, n.bytesToNumberBE)(t) : (0, n.bytesToNumberLE)(t),
e - i,
) + i;
return r
? (0, n.numberToBytesLE)(f, s)
: (0, n.numberToBytesBE)(f, s);
});
},
219: (t, e) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.validateObject =
e.createHmacDrbg =
e.bitMask =
e.bitSet =
e.bitGet =
e.bitLen =
e.utf8ToBytes =
e.equalBytes =
e.concatBytes =
e.ensureBytes =
e.numberToVarBytesBE =
e.numberToBytesLE =
e.numberToBytesBE =
e.bytesToNumberLE =
e.bytesToNumberBE =
e.hexToBytes =
e.hexToNumber =
e.numberToHexUnpadded =
e.bytesToHex =
void 0);
const r = BigInt(0),
n = BigInt(1),
o = BigInt(2),
i = (t) => t instanceof Uint8Array,
s = Array.from({ length: 256 }, (t, e) =>
e.toString(16).padStart(2, "0"),
);
function a(t) {
if (!i(t)) throw new Error("Uint8Array expected");
let e = "";
for (let r = 0; r < t.length; r++) e += s[t[r]];
return e;
}
function f(t) {
const e = t.toString(16);
return 1 & e.length ? `0${e}` : e;
}
function c(t) {
if ("string" != typeof t)
throw new Error("hex string expected, got " + typeof t);
return BigInt("" === t ? "0" : `0x${t}`);
}
function u(t) {
if ("string" != typeof t)
throw new Error("hex string expected, got " + typeof t);
const e = t.length;
if (e % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + e,
);
const r = new Uint8Array(e / 2);
for (let e = 0; e < r.length; e++) {
const n = 2 * e,
o = t.slice(n, n + 2),
i = Number.parseInt(o, 16);
if (Number.isNaN(i) || i < 0)
throw new Error("Invalid byte sequence");
r[e] = i;
}
return r;
}
function h(t, e) {
return u(t.toString(16).padStart(2 * e, "0"));
}
function l(...t) {
const e = new Uint8Array(t.reduce((t, e) => t + e.length, 0));
let r = 0;
return (
t.forEach((t) => {
if (!i(t)) throw new Error("Uint8Array expected");
e.set(t, r), (r += t.length);
}),
e
);
}
(e.bytesToHex = a),
(e.numberToHexUnpadded = f),
(e.hexToNumber = c),
(e.hexToBytes = u),
(e.bytesToNumberBE = function (t) {
return c(a(t));
}),
(e.bytesToNumberLE = function (t) {
if (!i(t)) throw new Error("Uint8Array expected");
return c(a(Uint8Array.from(t).reverse()));
}),
(e.numberToBytesBE = h),
(e.numberToBytesLE = function (t, e) {
return h(t, e).reverse();
}),
(e.numberToVarBytesBE = function (t) {
return u(f(t));
}),
(e.ensureBytes = function (t, e, r) {
let n;
if ("string" == typeof e)
try {
n = u(e);
} catch (r) {
throw new Error(
`${t} must be valid hex string, got "${e}". Cause: ${r}`,
);
}
else {
if (!i(e))
throw new Error(`${t} must be hex string or Uint8Array`);
n = Uint8Array.from(e);
}
const o = n.length;
if ("number" == typeof r && o !== r)
throw new Error(`${t} expected ${r} bytes, got ${o}`);
return n;
}),
(e.concatBytes = l),
(e.equalBytes = function (t, e) {
if (t.length !== e.length) return !1;
for (let r = 0; r < t.length; r++) if (t[r] !== e[r]) return !1;
return !0;
}),
(e.utf8ToBytes = function (t) {
if ("string" != typeof t)
throw new Error("utf8ToBytes expected string, got " + typeof t);
return new Uint8Array(new TextEncoder().encode(t));
}),
(e.bitLen = function (t) {
let e;
for (e = 0; t > r; t >>= n, e += 1);
return e;
}),
(e.bitGet = function (t, e) {
return (t >> BigInt(e)) & n;
}),
(e.bitSet = (t, e, o) => t | ((o ? n : r) << BigInt(e))),
(e.bitMask = (t) => (o << BigInt(t - 1)) - n);
const d = (t) => new Uint8Array(t),
y = (t) => Uint8Array.from(t);
e.createHmacDrbg = function (t, e, r) {
if ("number" != typeof t || t < 2)
throw new Error("hashLen must be a number");
if ("number" != typeof e || e < 2)
throw new Error("qByteLen must be a number");
if ("function" != typeof r)
throw new Error("hmacFn must be a function");
let n = d(t),
o = d(t),
i = 0;
const s = () => {
n.fill(1), o.fill(0), (i = 0);
},
a = (...t) => r(o, n, ...t),
f = (t = d()) => {
(o = a(y([0]), t)),
(n = a()),
0 !== t.length && ((o = a(y([1]), t)), (n = a()));
},
c = () => {
if (i++ >= 1e3) throw new Error("drbg: tried 1000 values");
let t = 0;
const r = [];
for (; t < e; ) {
n = a();
const e = n.slice();
r.push(e), (t += n.length);
}
return l(...r);
};
return (t, e) => {
let r;
for (s(), f(t); !(r = e(c())); ) f();
return s(), r;
};
};
const p = {
bigint: (t) => "bigint" == typeof t,
function: (t) => "function" == typeof t,
boolean: (t) => "boolean" == typeof t,
string: (t) => "string" == typeof t,
stringOrUint8Array: (t) =>
"string" == typeof t || t instanceof Uint8Array,
isSafeInteger: (t) => Number.isSafeInteger(t),
array: (t) => Array.isArray(t),
field: (t, e) => e.Fp.isValid(t),
hash: (t) =>
"function" == typeof t && Number.isSafeInteger(t.outputLen),
};
e.validateObject = function (t, e, r = {}) {
const n = (e, r, n) => {
const o = p[r];
if ("function" != typeof o)
throw new Error(`Invalid validator "${r}", expected function`);
const i = t[e];
if (!((n && void 0 === i) || o(i, t)))
throw new Error(
`Invalid param ${String(e)}=${i} (${typeof i}), expected ${r}`,
);
};
for (const [t, r] of Object.entries(e)) n(t, r, !1);
for (const [t, e] of Object.entries(r)) n(t, e, !0);
return t;
};
},
551: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.mapToCurveSimpleSWU =
e.SWUFpSqrtRatio =
e.weierstrass =
e.weierstrassPoints =
e.DER =
void 0);
const n = r(632),
o = r(219),
i = r(219),
s = r(525),
{ bytesToNumberBE: a, hexToBytes: f } = o;
e.DER = {
Err: class extends Error {
constructor(t = "") {
super(t);
}
},
_parseInt(t) {
const { Err: r } = e.DER;
if (t.length < 2 || 2 !== t[0])
throw new r("Invalid signature integer tag");
const n = t[1],
o = t.subarray(2, n + 2);
if (!n || o.length !== n)
throw new r("Invalid signature integer: wrong length");
if (128 & o[0]) throw new r("Invalid signature integer: negative");
if (0 === o[0] && !(128 & o[1]))
throw new r(
"Invalid signature integer: unnecessary leading zero",
);
return { d: a(o), l: t.subarray(n + 2) };
},
toSig(t) {
const { Err: r } = e.DER,
n = "string" == typeof t ? f(t) : t;
if (!(n instanceof Uint8Array)) throw new Error("ui8a expected");
const o = n.length;
if (o < 2 || 48 != n[0]) throw new r("Invalid signature tag");
if (n[1] !== o - 2)
throw new r("Invalid signature: incorrect length");
const { d: i, l: s } = e.DER._parseInt(n.subarray(2)),
{ d: a, l: c } = e.DER._parseInt(s);
if (c.length)
throw new r("Invalid signature: left bytes after parsing");
return { r: i, s: a };
},
hexFromSig(t) {
const e = (t) => (8 & Number.parseInt(t[0], 16) ? "00" + t : t),
r = (t) => {
const e = t.toString(16);
return 1 & e.length ? `0${e}` : e;
},
n = e(r(t.s)),
o = e(r(t.r)),
i = n.length / 2,
s = o.length / 2,
a = r(i),
f = r(s);
return `30${r(s + i + 4)}02${f}${o}02${a}${n}`;
},
};
const c = BigInt(0),
u = BigInt(1),
h = BigInt(2),
l = BigInt(3),
d = BigInt(4);
function y(t) {
const e = (function (t) {
const e = (0, s.validateBasic)(t);
o.validateObject(
e,
{ a: "field", b: "field" },
{
allowedPrivateKeyLengths: "array",
wrapPrivateKey: "boolean",
isTorsionFree: "function",
clearCofactor: "function",
allowInfinityPoint: "boolean",
fromBytes: "function",
toBytes: "function",
},
);
const { endo: r, Fp: n, a: i } = e;
if (r) {
if (!n.eql(i, n.ZERO))
throw new Error(
"Endomorphism can only be defined for Koblitz curves that have a=0",
);
if (
"object" != typeof r ||
"bigint" != typeof r.beta ||
"function" != typeof r.splitScalar
)
throw new Error(
"Expected endomorphism with beta: bigint and splitScalar: function",
);
}
return Object.freeze({ ...e });
})(t),
{ Fp: r } = e,
a =
e.toBytes ||
((t, e, n) => {
const i = e.toAffine();
return o.concatBytes(
Uint8Array.from([4]),
r.toBytes(i.x),
r.toBytes(i.y),
);
}),
f =
e.fromBytes ||
((t) => {
const e = t.subarray(1);
return {
x: r.fromBytes(e.subarray(0, r.BYTES)),
y: r.fromBytes(e.subarray(r.BYTES, 2 * r.BYTES)),
};
});
function h(t) {
const { a: n, b: o } = e,
i = r.sqr(t),
s = r.mul(i, t);
return r.add(r.add(s, r.mul(t, n)), o);
}
if (!r.eql(r.sqr(e.Gy), h(e.Gx)))
throw new Error("bad generator point: equation left != right");
function d(t) {
return "bigint" == typeof t && c < t && t < e.n;
}
function y(t) {
if (!d(t))
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
}
function p(t) {
const {
allowedPrivateKeyLengths: r,
nByteLength: s,
wrapPrivateKey: a,
n: f,
} = e;
if (r && "bigint" != typeof t) {
if (
(t instanceof Uint8Array && (t = o.bytesToHex(t)),
"string" != typeof t || !r.includes(t.length))
)
throw new Error("Invalid key");
t = t.padStart(2 * s, "0");
}
let c;
try {
c =
"bigint" == typeof t
? t
: o.bytesToNumberBE((0, i.ensureBytes)("private key", t, s));
} catch (e) {
throw new Error(
`private key must be ${s} bytes, hex or bigint, not ${typeof t}`,
);
}
return a && (c = n.mod(c, f)), y(c), c;
}
const g = new Map();
function w(t) {
if (!(t instanceof b)) throw new Error("ProjectivePoint expected");
}
class b {
constructor(t, e, n) {
if (
((this.px = t),
(this.py = e),
(this.pz = n),
null == t || !r.isValid(t))
)
throw new Error("x required");
if (null == e || !r.isValid(e)) throw new Error("y required");
if (null == n || !r.isValid(n)) throw new Error("z required");
}
static fromAffine(t) {
const { x: e, y: n } = t || {};
if (!t || !r.isValid(e) || !r.isValid(n))
throw new Error("invalid affine point");
if (t instanceof b)
throw new Error("projective point not allowed");
const o = (t) => r.eql(t, r.ZERO);
return o(e) && o(n) ? b.ZERO : new b(e, n, r.ONE);
}
get x() {
return this.toAffine().x;
}
get y() {
return this.toAffine().y;
}
static normalizeZ(t) {
const e = r.invertBatch(t.map((t) => t.pz));
return t.map((t, r) => t.toAffine(e[r])).map(b.fromAffine);
}
static fromHex(t) {
const e = b.fromAffine(f((0, i.ensureBytes)("pointHex", t)));
return e.assertValidity(), e;
}
static fromPrivateKey(t) {
return b.BASE.multiply(p(t));
}
_setWindowSize(t) {
(this._WINDOW_SIZE = t), g.delete(this);
}
assertValidity() {
if (this.is0()) {
if (e.allowInfinityPoint && !r.is0(this.py)) return;
throw new Error("bad point: ZERO");
}
const { x: t, y: n } = this.toAffine();
if (!r.isValid(t) || !r.isValid(n))
throw new Error("bad point: x or y not FE");
const o = r.sqr(n),
i = h(t);
if (!r.eql(o, i))
throw new Error("bad point: equation left != right");
if (!this.isTorsionFree())
throw new Error("bad point: not in prime-order subgroup");
}
hasEvenY() {
const { y: t } = this.toAffine();
if (r.isOdd) return !r.isOdd(t);
throw new Error("Field doesn't support isOdd");
}
equals(t) {
w(t);
const { px: e, py: n, pz: o } = this,
{ px: i, py: s, pz: a } = t,
f = r.eql(r.mul(e, a), r.mul(i, o)),
c = r.eql(r.mul(n, a), r.mul(s, o));
return f && c;
}
negate() {
return new b(this.px, r.neg(this.py), this.pz);
}
double() {
const { a: t, b: n } = e,
o = r.mul(n, l),
{ px: i, py: s, pz: a } = this;
let f = r.ZERO,
c = r.ZERO,
u = r.ZERO,
h = r.mul(i, i),
d = r.mul(s, s),
y = r.mul(a, a),
p = r.mul(i, s);
return (
(p = r.add(p, p)),
(u = r.mul(i, a)),
(u = r.add(u, u)),
(f = r.mul(t, u)),
(c = r.mul(o, y)),
(c = r.add(f, c)),
(f = r.sub(d, c)),
(c = r.add(d, c)),
(c = r.mul(f, c)),
(f = r.mul(p, f)),
(u = r.mul(o, u)),
(y = r.mul(t, y)),
(p = r.sub(h, y)),
(p = r.mul(t, p)),
(p = r.add(p, u)),
(u = r.add(h, h)),
(h = r.add(u, h)),
(h = r.add(h, y)),
(h = r.mul(h, p)),
(c = r.add(c, h)),
(y = r.mul(s, a)),
(y = r.add(y, y)),
(h = r.mul(y, p)),
(f = r.sub(f, h)),
(u = r.mul(y, d)),
(u = r.add(u, u)),
(u = r.add(u, u)),
new b(f, c, u)
);
}
add(t) {
w(t);
const { px: n, py: o, pz: i } = this,
{ px: s, py: a, pz: f } = t;
let c = r.ZERO,
u = r.ZERO,
h = r.ZERO;
const d = e.a,
y = r.mul(e.b, l);
let p = r.mul(n, s),
g = r.mul(o, a),
m = r.mul(i, f),
E = r.add(n, o),
v = r.add(s, a);
(E = r.mul(E, v)),
(v = r.add(p, g)),
(E = r.sub(E, v)),
(v = r.add(n, i));
let B = r.add(s, f);
return (
(v = r.mul(v, B)),
(B = r.add(p, m)),
(v = r.sub(v, B)),
(B = r.add(o, i)),
(c = r.add(a, f)),
(B = r.mul(B, c)),
(c = r.add(g, m)),
(B = r.sub(B, c)),
(h = r.mul(d, v)),
(c = r.mul(y, m)),
(h = r.add(c, h)),
(c = r.sub(g, h)),
(h = r.add(g, h)),
(u = r.mul(c, h)),
(g = r.add(p, p)),
(g = r.add(g, p)),
(m = r.mul(d, m)),
(v = r.mul(y, v)),
(g = r.add(g, m)),
(m = r.sub(p, m)),
(m = r.mul(d, m)),
(v = r.add(v, m)),
(p = r.mul(g, v)),
(u = r.add(u, p)),
(p = r.mul(B, v)),
(c = r.mul(E, c)),
(c = r.sub(c, p)),
(p = r.mul(E, g)),
(h = r.mul(B, h)),
(h = r.add(h, p)),
new b(c, u, h)
);
}
subtract(t) {
return this.add(t.negate());
}
is0() {
return this.equals(b.ZERO);
}
wNAF(t) {
return E.wNAFCached(this, g, t, (t) => {
const e = r.invertBatch(t.map((t) => t.pz));
return t.map((t, r) => t.toAffine(e[r])).map(b.fromAffine);
});
}
multiplyUnsafe(t) {
const n = b.ZERO;
if (t === c) return n;
if ((y(t), t === u)) return this;
const { endo: o } = e;
if (!o) return E.unsafeLadder(this, t);
let { k1neg: i, k1: s, k2neg: a, k2: f } = o.splitScalar(t),
h = n,
l = n,
d = this;
for (; s > c || f > c; )
s & u && (h = h.add(d)),
f & u && (l = l.add(d)),
(d = d.double()),
(s >>= u),
(f >>= u);
return (
i && (h = h.negate()),
a && (l = l.negate()),
(l = new b(r.mul(l.px, o.beta), l.py, l.pz)),
h.add(l)
);
}
multiply(t) {
y(t);
let n,
o,
i = t;
const { endo: s } = e;
if (s) {
const { k1neg: t, k1: e, k2neg: a, k2: f } = s.splitScalar(i);
let { p: c, f: u } = this.wNAF(e),
{ p: h, f: l } = this.wNAF(f);
(c = E.constTimeNegate(t, c)),
(h = E.constTimeNegate(a, h)),
(h = new b(r.mul(h.px, s.beta), h.py, h.pz)),
(n = c.add(h)),
(o = u.add(l));
} else {
const { p: t, f: e } = this.wNAF(i);
(n = t), (o = e);
}
return b.normalizeZ([n, o])[0];
}
multiplyAndAddUnsafe(t, e, r) {
const n = b.BASE,
o = (t, e) =>
e !== c && e !== u && t.equals(n)
? t.multiply(e)
: t.multiplyUnsafe(e),
i = o(this, e).add(o(t, r));
return i.is0() ? void 0 : i;
}
toAffine(t) {
const { px: e, py: n, pz: o } = this,
i = this.is0();
null == t && (t = i ? r.ONE : r.inv(o));
const s = r.mul(e, t),
a = r.mul(n, t),
f = r.mul(o, t);
if (i) return { x: r.ZERO, y: r.ZERO };
if (!r.eql(f, r.ONE)) throw new Error("invZ was invalid");
return { x: s, y: a };
}
isTorsionFree() {
const { h: t, isTorsionFree: r } = e;
if (t === u) return !0;
if (r) return r(b, this);
throw new Error(
"isTorsionFree() has not been declared for the elliptic curve",
);
}
clearCofactor() {
const { h: t, clearCofactor: r } = e;
return t === u ? this : r ? r(b, this) : this.multiplyUnsafe(e.h);
}
toRawBytes(t = !0) {
return this.assertValidity(), a(b, this, t);
}
toHex(t = !0) {
return o.bytesToHex(this.toRawBytes(t));
}
}
(b.BASE = new b(e.Gx, e.Gy, r.ONE)),
(b.ZERO = new b(r.ZERO, r.ONE, r.ZERO));
const m = e.nBitLength,
E = (0, s.wNAF)(b, e.endo ? Math.ceil(m / 2) : m);
return {
CURVE: e,
ProjectivePoint: b,
normPrivateKeyToScalar: p,
weierstrassEquation: h,
isWithinCurveOrder: d,
};
}
function p(t, e) {
const r = t.ORDER;
let n = c;
for (let t = r - u; t % h === c; t /= h) n += u;
const o = n,
i = h << (o - u - u),
s = i * h,
a = (r - u) / s,
f = (a - u) / h,
y = s - u,
p = i,
g = t.pow(e, a),
w = t.pow(e, (a + u) / h);
let b = (e, r) => {
let n = g,
i = t.pow(r, y),
s = t.sqr(i);
s = t.mul(s, r);
let a = t.mul(e, s);
(a = t.pow(a, f)),
(a = t.mul(a, i)),
(i = t.mul(a, r)),
(s = t.mul(a, e));
let c = t.mul(s, i);
a = t.pow(c, p);
const l = t.eql(a, t.ONE);
(i = t.mul(s, w)),
(a = t.mul(c, n)),
(s = t.cmov(i, s, l)),
(c = t.cmov(a, c, l));
for (let e = o; e > u; e--) {
let r = e - h;
r = h << (r - u);
let o = t.pow(c, r);
const a = t.eql(o, t.ONE);
(i = t.mul(s, n)),
(n = t.mul(n, n)),
(o = t.mul(c, n)),
(s = t.cmov(i, s, a)),
(c = t.cmov(o, c, a));
}
return { isValid: l, value: s };
};
if (t.ORDER % d === l) {
const r = (t.ORDER - l) / d,
n = t.sqrt(t.neg(e));
b = (e, o) => {
let i = t.sqr(o);
const s = t.mul(e, o);
i = t.mul(i, s);
let a = t.pow(i, r);
a = t.mul(a, s);
const f = t.mul(a, n),
c = t.mul(t.sqr(a), o),
u = t.eql(c, e);
return { isValid: u, value: t.cmov(f, a, u) };
};
}
return b;
}
(e.weierstrassPoints = y),
(e.weierstrass = function (t) {
const r = (function (t) {
const e = (0, s.validateBasic)(t);
return (
o.validateObject(
e,
{ hash: "hash", hmac: "function", randomBytes: "function" },
{
bits2int: "function",
bits2int_modN: "function",
lowS: "boolean",
},
),
Object.freeze({ lowS: !0, ...e })
);
})(t),
{ Fp: a, n: f } = r,
h = a.BYTES + 1,
l = 2 * a.BYTES + 1;
function d(t) {
return n.mod(t, f);
}
function p(t) {
return n.invert(t, f);
}
const {
ProjectivePoint: g,
normPrivateKeyToScalar: w,
weierstrassEquation: b,
isWithinCurveOrder: m,
} = y({
...r,
toBytes(t, e, r) {
const n = e.toAffine(),
i = a.toBytes(n.x),
s = o.concatBytes;
return r
? s(Uint8Array.from([e.hasEvenY() ? 2 : 3]), i)
: s(Uint8Array.from([4]), i, a.toBytes(n.y));
},
fromBytes(t) {
const e = t.length,
r = t[0],
n = t.subarray(1);
if (e !== h || (2 !== r && 3 !== r)) {
if (e === l && 4 === r)
return {
x: a.fromBytes(n.subarray(0, a.BYTES)),
y: a.fromBytes(n.subarray(a.BYTES, 2 * a.BYTES)),
};
throw new Error(
`Point of length ${e} was invalid. Expected ${h} compressed bytes or ${l} uncompressed bytes`,
);
}
{
const t = o.bytesToNumberBE(n);
if (!(c < (i = t) && i < a.ORDER))
throw new Error("Point is not on curve");
const e = b(t);
let s = a.sqrt(e);
return (
(1 == (1 & r)) != ((s & u) === u) && (s = a.neg(s)),
{ x: t, y: s }
);
}
let i;
},
}),
E = (t) => o.bytesToHex(o.numberToBytesBE(t, r.nByteLength));
function v(t) {
return t > f >> u;
}
const B = (t, e, r) => o.bytesToNumberBE(t.slice(e, r));
class x {
constructor(t, e, r) {
(this.r = t),
(this.s = e),
(this.recovery = r),
this.assertValidity();
}
static fromCompact(t) {
const e = r.nByteLength;
return (
(t = (0, i.ensureBytes)("compactSignature", t, 2 * e)),
new x(B(t, 0, e), B(t, e, 2 * e))
);
}
static fromDER(t) {
const { r, s: n } = e.DER.toSig((0, i.ensureBytes)("DER", t));
return new x(r, n);
}
assertValidity() {
if (!m(this.r)) throw new Error("r must be 0 < r < CURVE.n");
if (!m(this.s)) throw new Error("s must be 0 < s < CURVE.n");
}
addRecoveryBit(t) {
return new x(this.r, this.s, t);
}
recoverPublicKey(t) {
const { r: e, s: n, recovery: o } = this,
s = U((0, i.ensureBytes)("msgHash", t));
if (null == o || ![0, 1, 2, 3].includes(o))
throw new Error("recovery id invalid");
const f = 2 === o || 3 === o ? e + r.n : e;
if (f >= a.ORDER) throw new Error("recovery id 2 or 3 invalid");
const c = 0 == (1 & o) ? "02" : "03",
u = g.fromHex(c + E(f)),
h = p(f),
l = d(-s * h),
y = d(n * h),
w = g.BASE.multiplyAndAddUnsafe(u, l, y);
if (!w) throw new Error("point at infinify");
return w.assertValidity(), w;
}
hasHighS() {
return v(this.s);
}
normalizeS() {
return this.hasHighS()
? new x(this.r, d(-this.s), this.recovery)
: this;
}
toDERRawBytes() {
return o.hexToBytes(this.toDERHex());
}
toDERHex() {
return e.DER.hexFromSig({ r: this.r, s: this.s });
}
toCompactRawBytes() {
return o.hexToBytes(this.toCompactHex());
}
toCompactHex() {
return E(this.r) + E(this.s);
}
}
const A = {
isValidPrivateKey(t) {
try {
return w(t), !0;
} catch (t) {
return !1;
}
},
normPrivateKeyToScalar: w,
randomPrivateKey: () => {
const t = n.getMinHashLength(r.n);
return n.mapHashToField(r.randomBytes(t), r.n);
},
precompute: (t = 8, e = g.BASE) => (
e._setWindowSize(t), e.multiply(BigInt(3)), e
),
};
function S(t) {
const e = t instanceof Uint8Array,
r = "string" == typeof t,
n = (e || r) && t.length;
return e
? n === h || n === l
: r
? n === 2 * h || n === 2 * l
: t instanceof g;
}
const T =
r.bits2int ||
function (t) {
const e = o.bytesToNumberBE(t),
n = 8 * t.length - r.nBitLength;
return n > 0 ? e >> BigInt(n) : e;
},
U =
r.bits2int_modN ||
function (t) {
return d(T(t));
},
_ = o.bitMask(r.nBitLength);
function O(t) {
if ("bigint" != typeof t) throw new Error("bigint expected");
if (!(c <= t && t < _))
throw new Error(`bigint expected < 2^${r.nBitLength}`);
return o.numberToBytesBE(t, r.nByteLength);
}
const I = { lowS: r.lowS, prehash: !1 },
L = { lowS: r.lowS, prehash: !1 };
return (
g.BASE._setWindowSize(8),
{
CURVE: r,
getPublicKey: function (t, e = !0) {
return g.fromPrivateKey(t).toRawBytes(e);
},
getSharedSecret: function (t, e, r = !0) {
if (S(t)) throw new Error("first arg must be private key");
if (!S(e)) throw new Error("second arg must be public key");
return g.fromHex(e).multiply(w(t)).toRawBytes(r);
},
sign: function (t, e, n = I) {
const { seed: s, k2sig: f } = (function (t, e, n = I) {
if (["recovered", "canonical"].some((t) => t in n))
throw new Error("sign() legacy options not supported");
const { hash: s, randomBytes: f } = r;
let { lowS: h, prehash: l, extraEntropy: y } = n;
null == h && (h = !0),
(t = (0, i.ensureBytes)("msgHash", t)),
l &&
(t = (0, i.ensureBytes)("prehashed msgHash", s(t)));
const b = U(t),
E = w(e),
B = [O(E), O(b)];
if (null != y) {
const t = !0 === y ? f(a.BYTES) : y;
B.push((0, i.ensureBytes)("extraEntropy", t));
}
const A = o.concatBytes(...B),
S = b;
return {
seed: A,
k2sig: function (t) {
const e = T(t);
if (!m(e)) return;
const r = p(e),
n = g.BASE.multiply(e).toAffine(),
o = d(n.x);
if (o === c) return;
const i = d(r * d(S + o * E));
if (i === c) return;
let s = (n.x === o ? 0 : 2) | Number(n.y & u),
a = i;
return (
h &&
v(i) &&
((a = (function (t) {
return v(t) ? d(-t) : t;
})(i)),
(s ^= 1)),
new x(o, a, s)
);
},
};
})(t, e, n),
h = r;
return o.createHmacDrbg(
h.hash.outputLen,
h.nByteLength,
h.hmac,
)(s, f);
},
verify: function (t, n, o, s = L) {
const a = t;
if (
((n = (0, i.ensureBytes)("msgHash", n)),
(o = (0, i.ensureBytes)("publicKey", o)),
"strict" in s)
)
throw new Error("options.strict was renamed to lowS");
const { lowS: f, prehash: c } = s;
let u, h;
try {
if ("string" == typeof a || a instanceof Uint8Array)
try {
u = x.fromDER(a);
} catch (t) {
if (!(t instanceof e.DER.Err)) throw t;
u = x.fromCompact(a);
}
else {
if (
"object" != typeof a ||
"bigint" != typeof a.r ||
"bigint" != typeof a.s
)
throw new Error("PARSE");
{
const { r: t, s: e } = a;
u = new x(t, e);
}
}
h = g.fromHex(o);
} catch (t) {
if ("PARSE" === t.message)
throw new Error(
"signature must be Signature instance, Uint8Array or hex string",
);
return !1;
}
if (f && u.hasHighS()) return !1;
c && (n = r.hash(n));
const { r: l, s: y } = u,
w = U(n),
b = p(y),
m = d(w * b),
E = d(l * b),
v = g.BASE.multiplyAndAddUnsafe(h, m, E)?.toAffine();
return !!v && d(v.x) === l;
},
ProjectivePoint: g,
Signature: x,
utils: A,
}
);
}),
(e.SWUFpSqrtRatio = p),
(e.mapToCurveSimpleSWU = function (t, e) {
if (
(n.validateField(t),
!t.isValid(e.A) || !t.isValid(e.B) || !t.isValid(e.Z))
)
throw new Error("mapToCurveSimpleSWU: invalid opts");
const r = p(t, e.Z);
if (!t.isOdd) throw new Error("Fp.isOdd is not implemented!");
return (n) => {
let o, i, s, a, f, c, u, h;
(o = t.sqr(n)),
(o = t.mul(o, e.Z)),
(i = t.sqr(o)),
(i = t.add(i, o)),
(s = t.add(i, t.ONE)),
(s = t.mul(s, e.B)),
(a = t.cmov(e.Z, t.neg(i), !t.eql(i, t.ZERO))),
(a = t.mul(a, e.A)),
(i = t.sqr(s)),
(c = t.sqr(a)),
(f = t.mul(c, e.A)),
(i = t.add(i, f)),
(i = t.mul(i, s)),
(c = t.mul(c, a)),
(f = t.mul(c, e.B)),
(i = t.add(i, f)),
(u = t.mul(o, s));
const { isValid: l, value: d } = r(i, c);
(h = t.mul(o, n)),
(h = t.mul(h, d)),
(u = t.cmov(u, s, l)),
(h = t.cmov(h, d, l));
const y = t.isOdd(n) === t.isOdd(h);
return (
(h = t.cmov(t.neg(h), h, y)), (u = t.div(u, a)), { x: u, y: h }
);
};
});
},
497: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.encodeToCurve = e.hashToCurve = e.schnorr = e.secp256k1 = void 0);
const n = r(61),
o = r(89),
i = r(632),
s = r(551),
a = r(219),
f = r(134),
c = r(82),
u = BigInt(
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
),
h = BigInt(
"0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",
),
l = BigInt(1),
d = BigInt(2),
y = (t, e) => (t + e / d) / e;
function p(t) {
const e = u,
r = BigInt(3),
n = BigInt(6),
o = BigInt(11),
s = BigInt(22),
a = BigInt(23),
f = BigInt(44),
c = BigInt(88),
h = (t * t * t) % e,
l = (h * h * t) % e,
y = ((0, i.pow2)(l, r, e) * l) % e,
p = ((0, i.pow2)(y, r, e) * l) % e,
w = ((0, i.pow2)(p, d, e) * h) % e,
b = ((0, i.pow2)(w, o, e) * w) % e,
m = ((0, i.pow2)(b, s, e) * b) % e,
E = ((0, i.pow2)(m, f, e) * m) % e,
v = ((0, i.pow2)(E, c, e) * E) % e,
B = ((0, i.pow2)(v, f, e) * m) % e,
x = ((0, i.pow2)(B, r, e) * l) % e,
A = ((0, i.pow2)(x, a, e) * b) % e,
S = ((0, i.pow2)(A, n, e) * h) % e,
T = (0, i.pow2)(S, d, e);
if (!g.eql(g.sqr(T), t)) throw new Error("Cannot find square root");
return T;
}
const g = (0, i.Field)(u, void 0, void 0, { sqrt: p });
e.secp256k1 = (0, c.createCurve)(
{
a: BigInt(0),
b: BigInt(7),
Fp: g,
n: h,
Gx: BigInt(
"55066263022277343669578718895168534326250603453777594175500187360389116729240",
),
Gy: BigInt(
"32670510020758816978083085130507043184471273380659243275938904335757337482424",
),
h: BigInt(1),
lowS: !0,
endo: {
beta: BigInt(
"0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",
),
splitScalar: (t) => {
const e = h,
r = BigInt("0x3086d221a7d46bcde86c90e49284eb15"),
n = -l * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),
o = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),
s = r,
a = BigInt("0x100000000000000000000000000000000"),
f = y(s * t, e),
c = y(-n * t, e);
let u = (0, i.mod)(t - f * r - c * o, e),
d = (0, i.mod)(-f * n - c * s, e);
const p = u > a,
g = d > a;
if ((p && (u = e - u), g && (d = e - d), u > a || d > a))
throw new Error("splitScalar: Endomorphism failed, k=" + t);
return { k1neg: p, k1: u, k2neg: g, k2: d };
},
},
},
n.sha256,
);
const w = BigInt(0),
b = (t) => "bigint" == typeof t && w < t && t < u,
m = (t) => "bigint" == typeof t && w < t && t < h,
E = {};
function v(t, ...e) {
let r = E[t];
if (void 0 === r) {
const e = (0, n.sha256)(Uint8Array.from(t, (t) => t.charCodeAt(0)));
(r = (0, a.concatBytes)(e, e)), (E[t] = r);
}
return (0, n.sha256)((0, a.concatBytes)(r, ...e));
}
const B = (t) => t.toRawBytes(!0).slice(1),
x = (t) => (0, a.numberToBytesBE)(t, 32),
A = (t) => (0, i.mod)(t, u),
S = (t) => (0, i.mod)(t, h),
T = e.secp256k1.ProjectivePoint,
U = (t, e, r) => T.BASE.multiplyAndAddUnsafe(t, e, r);
function _(t) {
const r = e.secp256k1.utils.normPrivateKeyToScalar(t),
n = T.fromPrivateKey(r);
return { scalar: n.hasEvenY() ? r : S(-r), bytes: B(n) };
}
function O(t) {
if (!b(t)) throw new Error("bad x: need 0 < x < p");
const e = A(t * t);
let r = p(A(e * t + BigInt(7)));
r % d !== w && (r = A(-r));
const n = new T(t, r, l);
return n.assertValidity(), n;
}
function I(...t) {
return S((0, a.bytesToNumberBE)(v("BIP0340/challenge", ...t)));
}
function L(t, e, r) {
const n = (0, a.ensureBytes)("signature", t, 64),
o = (0, a.ensureBytes)("message", e),
i = (0, a.ensureBytes)("publicKey", r, 32);
try {
const t = O((0, a.bytesToNumberBE)(i)),
e = (0, a.bytesToNumberBE)(n.subarray(0, 32));
if (!b(e)) return !1;
const r = (0, a.bytesToNumberBE)(n.subarray(32, 64));
if (!m(r)) return !1;
const s = I(x(e), B(t), o),
f = U(t, r, S(-s));
return !(!f || !f.hasEvenY() || f.toAffine().x !== e);
} catch (t) {
return !1;
}
}
e.schnorr = {
getPublicKey: function (t) {
return _(t).bytes;
},
sign: function (t, e, r = (0, o.randomBytes)(32)) {
const n = (0, a.ensureBytes)("message", t),
{ bytes: i, scalar: s } = _(e),
f = (0, a.ensureBytes)("auxRand", r, 32),
c = x(s ^ (0, a.bytesToNumberBE)(v("BIP0340/aux", f))),
u = v("BIP0340/nonce", c, i, n),
h = S((0, a.bytesToNumberBE)(u));
if (h === w) throw new Error("sign failed: k is zero");
const { bytes: l, scalar: d } = _(h),
y = I(l, i, n),
p = new Uint8Array(64);
if ((p.set(l, 0), p.set(x(S(d + y * s)), 32), !L(p, n, i)))
throw new Error("sign: Invalid signature produced");
return p;
},
verify: L,
utils: {
randomPrivateKey: e.secp256k1.utils.randomPrivateKey,
lift_x: O,
pointToBytes: B,
numberToBytesBE: a.numberToBytesBE,
bytesToNumberBE: a.bytesToNumberBE,
taggedHash: v,
mod: i.mod,
},
};
const N = (() =>
(0, f.isogenyMap)(
g,
[
[
"0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7",
"0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581",
"0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262",
"0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c",
],
[
"0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b",
"0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14",
"0x0000000000000000000000000000000000000000000000000000000000000001",
],
[
"0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c",
"0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3",
"0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931",
"0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84",
],
[
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b",
"0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573",
"0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f",
"0x0000000000000000000000000000000000000000000000000000000000000001",
],
].map((t) => t.map((t) => BigInt(t))),
))(),
R = (() =>
(0, s.mapToCurveSimpleSWU)(g, {
A: BigInt(
"0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533",
),
B: BigInt("1771"),
Z: g.create(BigInt("-11")),
}))(),
k = (() =>
(0, f.createHasher)(
e.secp256k1.ProjectivePoint,
(t) => {
const { x: e, y: r } = R(g.create(t[0]));
return N(e, r);
},
{
DST: "secp256k1_XMD:SHA-256_SSWU_RO_",
encodeDST: "secp256k1_XMD:SHA-256_SSWU_NU_",
p: g.ORDER,
m: 1,
k: 128,
expand: "xmd",
hash: n.sha256,
},
))();
(e.hashToCurve = k.hashToCurve), (e.encodeToCurve = k.encodeToCurve);
},
320: (t, e) => {
"use strict";
function r(t) {
if (!Number.isSafeInteger(t) || t < 0)
throw new Error(`Wrong positive integer: ${t}`);
}
function n(t) {
if ("boolean" != typeof t)
throw new Error(`Expected boolean, not ${t}`);
}
function o(t, ...e) {
if (!(t instanceof Uint8Array))
throw new Error("Expected Uint8Array");
if (e.length > 0 && !e.includes(t.length))
throw new Error(
`Expected Uint8Array of length ${e}, not of length=${t.length}`,
);
}
function i(t) {
if ("function" != typeof t || "function" != typeof t.create)
throw new Error("Hash should be wrapped by utils.wrapConstructor");
r(t.outputLen), r(t.blockLen);
}
function s(t, e = !0) {
if (t.destroyed) throw new Error("Hash instance has been destroyed");
if (e && t.finished)
throw new Error("Hash#digest() has already been called");
}
function a(t, e) {
o(t);
const r = e.outputLen;
if (t.length < r)
throw new Error(
`digestInto() expects output buffer of length at least ${r}`,
);
}
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.output = e.exists = e.hash = e.bytes = e.bool = e.number = void 0),
(e.number = r),
(e.bool = n),
(e.bytes = o),
(e.hash = i),
(e.exists = s),
(e.output = a);
const f = {
number: r,
bool: n,
bytes: o,
hash: i,
exists: s,
output: a,
};
e.default = f;
},
505: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.SHA2 = void 0);
const n = r(320),
o = r(89);
class i extends o.Hash {
constructor(t, e, r, n) {
super(),
(this.blockLen = t),
(this.outputLen = e),
(this.padOffset = r),
(this.isLE = n),
(this.finished = !1),
(this.length = 0),
(this.pos = 0),
(this.destroyed = !1),
(this.buffer = new Uint8Array(t)),
(this.view = (0, o.createView)(this.buffer));
}
update(t) {
(0, n.exists)(this);
const { view: e, buffer: r, blockLen: i } = this,
s = (t = (0, o.toBytes)(t)).length;
for (let n = 0; n < s; ) {
const a = Math.min(i - this.pos, s - n);
if (a !== i)
r.set(t.subarray(n, n + a), this.pos),
(this.pos += a),
(n += a),
this.pos === i && (this.process(e, 0), (this.pos = 0));
else {
const e = (0, o.createView)(t);
for (; i <= s - n; n += i) this.process(e, n);
}
}
return (this.length += t.length), this.roundClean(), this;
}
digestInto(t) {
(0, n.exists)(this), (0, n.output)(t, this), (this.finished = !0);
const { buffer: e, view: r, blockLen: i, isLE: s } = this;
let { pos: a } = this;
(e[a++] = 128),
this.buffer.subarray(a).fill(0),
this.padOffset > i - a && (this.process(r, 0), (a = 0));
for (let t = a; t < i; t++) e[t] = 0;
!(function (t, e, r, n) {
if ("function" == typeof t.setBigUint64)
return t.setBigUint64(e, r, n);
const o = BigInt(32),
i = BigInt(4294967295),
s = Number((r >> o) & i),
a = Number(r & i),
f = n ? 4 : 0,
c = n ? 0 : 4;
t.setUint32(e + f, s, n), t.setUint32(e + c, a, n);
})(r, i - 8, BigInt(8 * this.length), s),
this.process(r, 0);
const f = (0, o.createView)(t),
c = this.outputLen;
if (c % 4)
throw new Error("_sha2: outputLen should be aligned to 32bit");
const u = c / 4,
h = this.get();
if (u > h.length)
throw new Error("_sha2: outputLen bigger than state");
for (let t = 0; t < u; t++) f.setUint32(4 * t, h[t], s);
}
digest() {
const { buffer: t, outputLen: e } = this;
this.digestInto(t);
const r = t.slice(0, e);
return this.destroy(), r;
}
_cloneInto(t) {
t || (t = new this.constructor()), t.set(...this.get());
const {
blockLen: e,
buffer: r,
length: n,
finished: o,
destroyed: i,
pos: s,
} = this;
return (
(t.length = n),
(t.pos = s),
(t.finished = o),
(t.destroyed = i),
n % e && t.buffer.set(r),
t
);
}
}
e.SHA2 = i;
},
945: (t, e) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.crypto = void 0),
(e.crypto =
"object" == typeof globalThis && "crypto" in globalThis
? globalThis.crypto
: void 0);
},
569: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.hmac = e.HMAC = void 0);
const n = r(320),
o = r(89);
class i extends o.Hash {
constructor(t, e) {
super(),
(this.finished = !1),
(this.destroyed = !1),
(0, n.hash)(t);
const r = (0, o.toBytes)(e);
if (
((this.iHash = t.create()),
"function" != typeof this.iHash.update)
)
throw new Error(
"Expected instance of class which extends utils.Hash",
);
(this.blockLen = this.iHash.blockLen),
(this.outputLen = this.iHash.outputLen);
const i = this.blockLen,
s = new Uint8Array(i);
s.set(r.length > i ? t.create().update(r).digest() : r);
for (let t = 0; t < s.length; t++) s[t] ^= 54;
this.iHash.update(s), (this.oHash = t.create());
for (let t = 0; t < s.length; t++) s[t] ^= 106;
this.oHash.update(s), s.fill(0);
}
update(t) {
return (0, n.exists)(this), this.iHash.update(t), this;
}
digestInto(t) {
(0, n.exists)(this),
(0, n.bytes)(t, this.outputLen),
(this.finished = !0),
this.iHash.digestInto(t),
this.oHash.update(t),
this.oHash.digestInto(t),
this.destroy();
}
digest() {
const t = new Uint8Array(this.oHash.outputLen);
return this.digestInto(t), t;
}
_cloneInto(t) {
t || (t = Object.create(Object.getPrototypeOf(this), {}));
const {
oHash: e,
iHash: r,
finished: n,
destroyed: o,
blockLen: i,
outputLen: s,
} = this;
return (
(t.finished = n),
(t.destroyed = o),
(t.blockLen = i),
(t.outputLen = s),
(t.oHash = e._cloneInto(t.oHash)),
(t.iHash = r._cloneInto(t.iHash)),
t
);
}
destroy() {
(this.destroyed = !0), this.oHash.destroy(), this.iHash.destroy();
}
}
(e.HMAC = i),
(e.hmac = (t, e, r) => new i(t, e).update(r).digest()),
(e.hmac.create = (t, e) => new i(t, e));
},
61: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.sha224 = e.sha256 = void 0);
const n = r(505),
o = r(89),
i = (t, e, r) => (t & e) ^ (t & r) ^ (e & r),
s = new Uint32Array([
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,
]),
a = new Uint32Array([
1779033703, 3144134277, 1013904242, 2773480762, 1359893119,
2600822924, 528734635, 1541459225,
]),
f = new Uint32Array(64);
class c extends n.SHA2 {
constructor() {
super(64, 32, 8, !1),
(this.A = 0 | a[0]),
(this.B = 0 | a[1]),
(this.C = 0 | a[2]),
(this.D = 0 | a[3]),
(this.E = 0 | a[4]),
(this.F = 0 | a[5]),
(this.G = 0 | a[6]),
(this.H = 0 | a[7]);
}
get() {
const { A: t, B: e, C: r, D: n, E: o, F: i, G: s, H: a } = this;
return [t, e, r, n, o, i, s, a];
}
set(t, e, r, n, o, i, s, a) {
(this.A = 0 | t),
(this.B = 0 | e),
(this.C = 0 | r),
(this.D = 0 | n),
(this.E = 0 | o),
(this.F = 0 | i),
(this.G = 0 | s),
(this.H = 0 | a);
}
process(t, e) {
for (let r = 0; r < 16; r++, e += 4) f[r] = t.getUint32(e, !1);
for (let t = 16; t < 64; t++) {
const e = f[t - 15],
r = f[t - 2],
n = (0, o.rotr)(e, 7) ^ (0, o.rotr)(e, 18) ^ (e >>> 3),
i = (0, o.rotr)(r, 17) ^ (0, o.rotr)(r, 19) ^ (r >>> 10);
f[t] = (i + f[t - 7] + n + f[t - 16]) | 0;
}
let { A: r, B: n, C: a, D: c, E: u, F: h, G: l, H: d } = this;
for (let t = 0; t < 64; t++) {
const e =
(d +
((0, o.rotr)(u, 6) ^
(0, o.rotr)(u, 11) ^
(0, o.rotr)(u, 25)) +
(((y = u) & h) ^ (~y & l)) +
s[t] +
f[t]) |
0,
p =
(((0, o.rotr)(r, 2) ^
(0, o.rotr)(r, 13) ^
(0, o.rotr)(r, 22)) +
i(r, n, a)) |
0;
(d = l),
(l = h),
(h = u),
(u = (c + e) | 0),
(c = a),
(a = n),
(n = r),
(r = (e + p) | 0);
}
let y;
(r = (r + this.A) | 0),
(n = (n + this.B) | 0),
(a = (a + this.C) | 0),
(c = (c + this.D) | 0),
(u = (u + this.E) | 0),
(h = (h + this.F) | 0),
(l = (l + this.G) | 0),
(d = (d + this.H) | 0),
this.set(r, n, a, c, u, h, l, d);
}
roundClean() {
f.fill(0);
}
destroy() {
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
}
}
class u extends c {
constructor() {
super(),
(this.A = -1056596264),
(this.B = 914150663),
(this.C = 812702999),
(this.D = -150054599),
(this.E = -4191439),
(this.F = 1750603025),
(this.G = 1694076839),
(this.H = -1090891868),
(this.outputLen = 28);
}
}
(e.sha256 = (0, o.wrapConstructor)(() => new c())),
(e.sha224 = (0, o.wrapConstructor)(() => new u()));
},
89: (t, e, r) => {
"use strict";
Object.defineProperty(e, "__esModule", { value: !0 }),
(e.randomBytes =
e.wrapXOFConstructorWithOpts =
e.wrapConstructorWithOpts =
e.wrapConstructor =
e.checkOpts =
e.Hash =
e.concatBytes =
e.toBytes =
e.utf8ToBytes =
e.asyncLoop =
e.nextTick =
e.hexToBytes =
e.bytesToHex =
e.isLE =
e.rotr =
e.createView =
e.u32 =
e.u8 =
void 0);
const n = r(945),
o = (t) => t instanceof Uint8Array;
if (
((e.u8 = (t) => new Uint8Array(t.buffer, t.byteOffset, t.byteLength)),
(e.u32 = (t) =>
new Uint32Array(
t.buffer,
t.byteOffset,
Math.floor(t.byteLength / 4),
)),
(e.createView = (t) =>
new DataView(t.buffer, t.byteOffset, t.byteLength)),
(e.rotr = (t, e) => (t << (32 - e)) | (t >>> e)),
(e.isLE =
68 === new Uint8Array(new Uint32Array([287454020]).buffer)[0]),
!e.isLE)
)
throw new Error("Non little-endian hardware is not supported");
const i = Array.from({ length: 256 }, (t, e) =>
e.toString(16).padStart(2, "0"),
);
function s(t) {
if ("string" != typeof t)
throw new Error("utf8ToBytes expected string, got " + typeof t);
return new Uint8Array(new TextEncoder().encode(t));
}
function a(t) {
if (("string" == typeof t && (t = s(t)), !o(t)))
throw new Error("expected Uint8Array, got " + typeof t);
return t;
}
(e.bytesToHex = function (t) {
if (!o(t)) throw new Error("Uint8Array expected");
let e = "";
for (let r = 0; r < t.length; r++) e += i[t[r]];
return e;
}),
(e.hexToBytes = function (t) {
if ("string" != typeof t)
throw new Error("hex string expected, got " + typeof t);
const e = t.length;
if (e % 2)
throw new Error(
"padded hex string expected, got unpadded hex of length " + e,
);
const r = new Uint8Array(e / 2);
for (let e = 0; e < r.length; e++) {
const n = 2 * e,
o = t.slice(n, n + 2),
i = Number.parseInt(o, 16);
if (Number.isNaN(i) || i < 0)
throw new Error("Invalid byte sequence");
r[e] = i;
}
return r;
}),
(e.nextTick = async () => {}),
(e.asyncLoop = async function (t, r, n) {
let o = Date.now();
for (let i = 0; i < t; i++) {
n(i);
const t = Date.now() - o;
(t >= 0 && t < r) || (await (0, e.nextTick)(), (o += t));
}
}),
(e.utf8ToBytes = s),
(e.toBytes = a),
(e.concatBytes = function (...t) {
const e = new Uint8Array(t.reduce((t, e) => t + e.length, 0));
let r = 0;
return (
t.forEach((t) => {
if (!o(t)) throw new Error("Uint8Array expected");
e.set(t, r), (r += t.length);
}),
e
);
}),
(e.Hash = class {
clone() {
return this._cloneInto();
}
});
const f = {}.toString;
(e.checkOpts = function (t, e) {
if (void 0 !== e && "[object Object]" !== f.call(e))
throw new Error("Options should be object or undefined");
return Object.assign(t, e);
}),
(e.wrapConstructor = function (t) {
const e = (e) => t().update(a(e)).digest(),
r = t();
return (
(e.outputLen = r.outputLen),
(e.blockLen = r.blockLen),
(e.create = () => t()),
e
);
}),
(e.wrapConstructorWithOpts = function (t) {
const e = (e, r) => t(r).update(a(e)).digest(),
r = t({});
return (
(e.outputLen = r.outputLen),
(e.blockLen = r.blockLen),
(e.create = (e) => t(e)),
e
);
}),
(e.wrapXOFConstructorWithOpts = function (t) {
const e = (e, r) => t(r).update(a(e)).digest(),
r = t({});
return (
(e.outputLen = r.outputLen),
(e.blockLen = r.blockLen),
(e.create = (e) => t(e)),
e
);
}),
(e.randomBytes = function (t = 32) {
if (n.crypto && "function" == typeof n.crypto.getRandomValues)
return n.crypto.getRandomValues(new Uint8Array(t));
throw new Error("crypto.getRandomValues must be defined");
});
},
885: function (t) {
!(function (e, r) {
"use strict";
t.exports
? (t.exports = r())
: (e.nacl || (e.nacl = {}), (e.nacl.util = r()));
})(this, function () {
"use strict";
const t = {};
function e(t) {
if (
!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(
t,
)
)
throw new TypeError("invalid encoding");
}
return (
(t.decodeUTF8 = function (t) {
if ("string" != typeof t) throw new TypeError("expected string");
let e,
r = unescape(encodeURIComponent(t)),
n = new Uint8Array(r.length);
for (e = 0; e < r.length; e++) n[e] = r.charCodeAt(e);
return n;
}),
(t.encodeUTF8 = function (t) {
let e,
r = [];
for (e = 0; e < t.length; e++) r.push(String.fromCharCode(t[e]));
return decodeURIComponent(escape(r.join("")));
}),
"undefined" == typeof atob
? void 0 !== Buffer.from
? ((t.encodeBase64 = function (t) {
return Buffer.from(t).toString("base64");
}),
(t.decodeBase64 = function (t) {
return (
e(t),
new Uint8Array(
Array.prototype.slice.call(Buffer.from(t, "base64"), 0),
)
);
}))
: ((t.encodeBase64 = function (t) {
return new Buffer(t).toString("base64");
}),
(t.decodeBase64 = function (t) {
return (
e(t),
new Uint8Array(
Array.prototype.slice.call(new Buffer(t, "base64"), 0),
)
);
}))
: ((t.encodeBase64 = function (t) {
let e,
r = [],
n = t.length;
for (e = 0; e < n; e++) r.push(String.fromCharCode(t[e]));
return btoa(r.join(""));
}),
(t.decodeBase64 = function (t) {
e(t);
let r,
n = atob(t),
o = new Uint8Array(n.length);
for (r = 0; r < n.length; r++) o[r] = n.charCodeAt(r);
return o;
})),
t
);
});
},
780: (t, e, r) => {
!(function (t) {
"use strict";
let e = function (t) {
let e,
r = new Float64Array(16);
if (t) for (e = 0; e < t.length; e++) r[e] = t[e];
return r;
},
n = function () {
throw new Error("no PRNG");
},
o = new Uint8Array(16),
i = new Uint8Array(32);
i[0] = 9;
const s = e(),
a = e([1]),
f = e([56129, 1]),
c = e([
30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585,
16505, 36039, 65139, 11119, 27886, 20995,
]),
u = e([
61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171,
33010, 6542, 64743, 22239, 55772, 9222,
]),
h = e([
54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412,
64982, 57905, 49316, 21502, 52590, 14035, 8553,
]),
l = e([
26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214,
26214, 26214, 26214, 26214, 26214, 26214, 26214,
]),
d = e([
41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207,
15867, 153, 11085, 57099, 20417, 9344, 11139,
]);
function y(t, e, r, n) {
(t[e] = (r >> 24) & 255),
(t[e + 1] = (r >> 16) & 255),
(t[e + 2] = (r >> 8) & 255),
(t[e + 3] = 255 & r),
(t[e + 4] = (n >> 24) & 255),
(t[e + 5] = (n >> 16) & 255),
(t[e + 6] = (n >> 8) & 255),
(t[e + 7] = 255 & n);
}
function p(t, e, r, n, o) {
let i,
s = 0;
for (i = 0; i < o; i++) s |= t[e + i] ^ r[n + i];
return (1 & ((s - 1) >>> 8)) - 1;
}
function g(t, e, r, n) {
return p(t, e, r, n, 16);
}
function w(t, e, r, n) {
return p(t, e, r, n, 32);
}
function b(t, e, r, n) {
!(function (t, e, r, n) {
for (
var o,
i =
(255 & n[0]) |
((255 & n[1]) << 8) |
((255 & n[2]) << 16) |
((255 & n[3]) << 24),
s =
(255 & r[0]) |
((255 & r[1]) << 8) |
((255 & r[2]) << 16) |
((255 & r[3]) << 24),
a =
(255 & r[4]) |
((255 & r[5]) << 8) |
((255 & r[6]) << 16) |
((255 & r[7]) << 24),
f =
(255 & r[8]) |
((255 & r[9]) << 8) |
((255 & r[10]) << 16) |
((255 & r[11]) << 24),
c =
(255 & r[12]) |
((255 & r[13]) << 8) |
((255 & r[14]) << 16) |
((255 & r[15]) << 24),
u =
(255 & n[4]) |
((255 & n[5]) << 8) |
((255 & n[6]) << 16) |
((255 & n[7]) << 24),
h =
(255 & e[0]) |
((255 & e[1]) << 8) |
((255 & e[2]) << 16) |
((255 & e[3]) << 24),
l =
(255 & e[4]) |
((255 & e[5]) << 8) |
((255 & e[6]) << 16) |
((255 & e[7]) << 24),
d =
(255 & e[8]) |
((255 & e[9]) << 8) |
((255 & e[10]) << 16) |
((255 & e[11]) << 24),
y =
(255 & e[12]) |
((255 & e[13]) << 8) |
((255 & e[14]) << 16) |
((255 & e[15]) << 24),
p =
(255 & n[8]) |
((255 & n[9]) << 8) |
((255 & n[10]) << 16) |
((255 & n[11]) << 24),
g =
(255 & r[16]) |
((255 & r[17]) << 8) |
((255 & r[18]) << 16) |
((255 & r[19]) << 24),
w =
(255 & r[20]) |
((255 & r[21]) << 8) |
((255 & r[22]) << 16) |
((255 & r[23]) << 24),
b =
(255 & r[24]) |
((255 & r[25]) << 8) |
((255 & r[26]) << 16) |
((255 & r[27]) << 24),
m =
(255 & r[28]) |
((255 & r[29]) << 8) |
((255 & r[30]) << 16) |
((255 & r[31]) << 24),
E =
(255 & n[12]) |
((255 & n[13]) << 8) |
((255 & n[14]) << 16) |
((255 & n[15]) << 24),
v = i,
B = s,
x = a,
A = f,
S = c,
T = u,
U = h,
_ = l,
O = d,
I = y,
L = p,
N = g,
R = w,
k = b,
H = m,
M = E,
q = 0;
q < 20;
q += 2
)
(v ^=
((o =
((R ^=
((o =
((O ^=
((o =
((S ^= ((o = (v + R) | 0) << 7) | (o >>> 25)) + v) |
0) <<
9) |
(o >>> 23)) +
S) |
0) <<
13) |
(o >>> 19)) +
O) |
0) <<
18) |
(o >>> 14)),
(T ^=
((o =
((B ^=
((o =
((k ^=
((o =
((I ^= ((o = (T + B) | 0) << 7) | (o >>> 25)) +
T) |
0) <<
9) |
(o >>> 23)) +
I) |
0) <<
13) |
(o >>> 19)) +
k) |
0) <<
18) |
(o >>> 14)),
(L ^=
((o =
((U ^=
((o =
((x ^=
((o =
((H ^= ((o = (L + U) | 0) << 7) | (o >>> 25)) +
L) |
0) <<
9) |
(o >>> 23)) +
H) |
0) <<
13) |
(o >>> 19)) +
x) |
0) <<
18) |
(o >>> 14)),
(M ^=
((o =
((N ^=
((o =
((_ ^=
((o =
((A ^= ((o = (M + N) | 0) << 7) | (o >>> 25)) +
M) |
0) <<
9) |
(o >>> 23)) +
A) |
0) <<
13) |
(o >>> 19)) +
_) |
0) <<
18) |
(o >>> 14)),
(v ^=
((o =
((A ^=
((o =
((x ^=
((o =
((B ^= ((o = (v + A) | 0) << 7) | (o >>> 25)) +
v) |
0) <<
9) |
(o >>> 23)) +
B) |
0) <<
13) |
(o >>> 19)) +
x) |
0) <<
18) |
(o >>> 14)),
(T ^=
((o =
((S ^=
((o =
((_ ^=
((o =
((U ^= ((o = (T + S) | 0) << 7) | (o >>> 25)) +
T) |
0) <<
9) |
(o >>> 23)) +
U) |
0) <<
13) |
(o >>> 19)) +
_) |
0) <<
18) |
(o >>> 14)),
(L ^=
((o =
((I ^=
((o =
((O ^=
((o =
((N ^= ((o = (L + I) | 0) << 7) | (o >>> 25)) +
L) |
0) <<
9) |
(o >>> 23)) +
N) |
0) <<
13) |
(o >>> 19)) +
O) |
0) <<
18) |
(o >>> 14)),
(M ^=
((o =
((H ^=
((o =
((k ^=
((o =
((R ^= ((o = (M + H) | 0) << 7) | (o >>> 25)) +
M) |
0) <<
9) |
(o >>> 23)) +
R) |
0) <<
13) |
(o >>> 19)) +
k) |
0) <<
18) |
(o >>> 14));
(v = (v + i) | 0),
(B = (B + s) | 0),
(x = (x + a) | 0),
(A = (A + f) | 0),
(S = (S + c) | 0),
(T = (T + u) | 0),
(U = (U + h) | 0),
(_ = (_ + l) | 0),
(O = (O + d) | 0),
(I = (I + y) | 0),
(L = (L + p) | 0),
(N = (N + g) | 0),
(R = (R + w) | 0),
(k = (k + b) | 0),
(H = (H + m) | 0),
(M = (M + E) | 0),
(t[0] = (v >>> 0) & 255),
(t[1] = (v >>> 8) & 255),
(t[2] = (v >>> 16) & 255),
(t[3] = (v >>> 24) & 255),
(t[4] = (B >>> 0) & 255),
(t[5] = (B >>> 8) & 255),
(t[6] = (B >>> 16) & 255),
(t[7] = (B >>> 24) & 255),
(t[8] = (x >>> 0) & 255),
(t[9] = (x >>> 8) & 255),
(t[10] = (x >>> 16) & 255),
(t[11] = (x >>> 24) & 255),
(t[12] = (A >>> 0) & 255),
(t[13] = (A >>> 8) & 255),
(t[14] = (A >>> 16) & 255),
(t[15] = (A >>> 24) & 255),
(t[16] = (S >>> 0) & 255),
(t[17] = (S >>> 8) & 255),
(t[18] = (S >>> 16) & 255),
(t[19] = (S >>> 24) & 255),
(t[20] = (T >>> 0) & 255),
(t[21] = (T >>> 8) & 255),
(t[22] = (T >>> 16) & 255),
(t[23] = (T >>> 24) & 255),
(t[24] = (U >>> 0) & 255),
(t[25] = (U >>> 8) & 255),
(t[26] = (U >>> 16) & 255),
(t[27] = (U >>> 24) & 255),
(t[28] = (_ >>> 0) & 255),
(t[29] = (_ >>> 8) & 255),
(t[30] = (_ >>> 16) & 255),
(t[31] = (_ >>> 24) & 255),
(t[32] = (O >>> 0) & 255),
(t[33] = (O >>> 8) & 255),
(t[34] = (O >>> 16) & 255),
(t[35] = (O >>> 24) & 255),
(t[36] = (I >>> 0) & 255),
(t[37] = (I >>> 8) & 255),
(t[38] = (I >>> 16) & 255),
(t[39] = (I >>> 24) & 255),
(t[40] = (L >>> 0) & 255),
(t[41] = (L >>> 8) & 255),
(t[42] = (L >>> 16) & 255),
(t[43] = (L >>> 24) & 255),
(t[44] = (N >>> 0) & 255),
(t[45] = (N >>> 8) & 255),
(t[46] = (N >>> 16) & 255),
(t[47] = (N >>> 24) & 255),
(t[48] = (R >>> 0) & 255),
(t[49] = (R >>> 8) & 255),
(t[50] = (R >>> 16) & 255),
(t[51] = (R >>> 24) & 255),
(t[52] = (k >>> 0) & 255),
(t[53] = (k >>> 8) & 255),
(t[54] = (k >>> 16) & 255),
(t[55] = (k >>> 24) & 255),
(t[56] = (H >>> 0) & 255),
(t[57] = (H >>> 8) & 255),
(t[58] = (H >>> 16) & 255),
(t[59] = (H >>> 24) & 255),
(t[60] = (M >>> 0) & 255),
(t[61] = (M >>> 8) & 255),
(t[62] = (M >>> 16) & 255),
(t[63] = (M >>> 24) & 255);
})(t, e, r, n);
}
function m(t, e, r, n) {
!(function (t, e, r, n) {
for (
var o,
i =
(255 & n[0]) |
((255 & n[1]) << 8) |
((255 & n[2]) << 16) |
((255 & n[3]) << 24),
s =
(255 & r[0]) |
((255 & r[1]) << 8) |
((255 & r[2]) << 16) |
((255 & r[3]) << 24),
a =
(255 & r[4]) |
((255 & r[5]) << 8) |
((255 & r[6]) << 16) |
((255 & r[7]) << 24),
f =
(255 & r[8]) |
((255 & r[9]) << 8) |
((255 & r[10]) << 16) |
((255 & r[11]) << 24),
c =
(255 & r[12]) |
((255 & r[13]) << 8) |
((255 & r[14]) << 16) |
((255 & r[15]) << 24),
u =
(255 & n[4]) |
((255 & n[5]) << 8) |
((255 & n[6]) << 16) |
((255 & n[7]) << 24),
h =
(255 & e[0]) |
((255 & e[1]) << 8) |
((255 & e[2]) << 16) |
((255 & e[3]) << 24),
l =
(255 & e[4]) |
((255 & e[5]) << 8) |
((255 & e[6]) << 16) |
((255 & e[7]) << 24),
d =
(255 & e[8]) |
((255 & e[9]) << 8) |
((255 & e[10]) << 16) |
((255 & e[11]) << 24),
y =
(255 & e[12]) |
((255 & e[13]) << 8) |
((255 & e[14]) << 16) |
((255 & e[15]) << 24),
p =
(255 & n[8]) |
((255 & n[9]) << 8) |
((255 & n[10]) << 16) |
((255 & n[11]) << 24),
g =
(255 & r[16]) |
((255 & r[17]) << 8) |
((255 & r[18]) << 16) |
((255 & r[19]) << 24),
w =
(255 & r[20]) |
((255 & r[21]) << 8) |
((255 & r[22]) << 16) |
((255 & r[23]) << 24),
b =
(255 & r[24]) |
((255 & r[25]) << 8) |
((255 & r[26]) << 16) |
((255 & r[27]) << 24),
m =
(255 & r[28]) |
((255 & r[29]) << 8) |
((255 & r[30]) << 16) |
((255 & r[31]) << 24),
E =
(255 & n[12]) |
((255 & n[13]) << 8) |
((255 & n[14]) << 16) |
((255 & n[15]) << 24),
v = 0;
v < 20;
v += 2
)
(i ^=
((o =
((w ^=
((o =
((d ^=
((o =
((c ^= ((o = (i + w) | 0) << 7) | (o >>> 25)) + i) |
0) <<
9) |
(o >>> 23)) +
c) |
0) <<
13) |
(o >>> 19)) +
d) |
0) <<
18) |
(o >>> 14)),
(u ^=
((o =
((s ^=
((o =
((b ^=
((o =
((y ^= ((o = (u + s) | 0) << 7) | (o >>> 25)) +
u) |
0) <<
9) |
(o >>> 23)) +
y) |
0) <<
13) |
(o >>> 19)) +
b) |
0) <<
18) |
(o >>> 14)),
(p ^=
((o =
((h ^=
((o =
((a ^=
((o =
((m ^= ((o = (p + h) | 0) << 7) | (o >>> 25)) +
p) |
0) <<
9) |
(o >>> 23)) +
m) |
0) <<
13) |
(o >>> 19)) +
a) |
0) <<
18) |
(o >>> 14)),
(E ^=
((o =
((g ^=
((o =
((l ^=
((o =
((f ^= ((o = (E + g) | 0) << 7) | (o >>> 25)) +
E) |
0) <<
9) |
(o >>> 23)) +
f) |
0) <<
13) |
(o >>> 19)) +
l) |
0) <<
18) |
(o >>> 14)),
(i ^=
((o =
((f ^=
((o =
((a ^=
((o =
((s ^= ((o = (i + f) | 0) << 7) | (o >>> 25)) +
i) |
0) <<
9) |
(o >>> 23)) +
s) |
0) <<
13) |
(o >>> 19)) +
a) |
0) <<
18) |
(o >>> 14)),
(u ^=
((o =
((c ^=
((o =
((l ^=
((o =
((h ^= ((o = (u + c) | 0) << 7) | (o >>> 25)) +
u) |
0) <<
9) |
(o >>> 23)) +
h) |
0) <<
13) |
(o >>> 19)) +
l) |
0) <<
18) |
(o >>> 14)),
(p ^=
((o =
((y ^=
((o =
((d ^=
((o =
((g ^= ((o = (p + y) | 0) << 7) | (o >>> 25)) +
p) |
0) <<
9) |
(o >>> 23)) +
g) |
0) <<
13) |
(o >>> 19)) +
d) |
0) <<
18) |
(o >>> 14)),
(E ^=
((o =
((m ^=
((o =
((b ^=
((o =
((w ^= ((o = (E + m) | 0) << 7) | (o >>> 25)) +
E) |
0) <<
9) |
(o >>> 23)) +
w) |
0) <<
13) |
(o >>> 19)) +
b) |
0) <<
18) |
(o >>> 14));
(t[0] = (i >>> 0) & 255),
(t[1] = (i >>> 8) & 255),
(t[2] = (i >>> 16) & 255),
(t[3] = (i >>> 24) & 255),
(t[4] = (u >>> 0) & 255),
(t[5] = (u >>> 8) & 255),
(t[6] = (u >>> 16) & 255),
(t[7] = (u >>> 24) & 255),
(t[8] = (p >>> 0) & 255),
(t[9] = (p >>> 8) & 255),
(t[10] = (p >>> 16) & 255),
(t[11] = (p >>> 24) & 255),
(t[12] = (E >>> 0) & 255),
(t[13] = (E >>> 8) & 255),
(t[14] = (E >>> 16) & 255),
(t[15] = (E >>> 24) & 255),
(t[16] = (h >>> 0) & 255),
(t[17] = (h >>> 8) & 255),
(t[18] = (h >>> 16) & 255),
(t[19] = (h >>> 24) & 255),
(t[20] = (l >>> 0) & 255),
(t[21] = (l >>> 8) & 255),
(t[22] = (l >>> 16) & 255),
(t[23] = (l >>> 24) & 255),
(t[24] = (d >>> 0) & 255),
(t[25] = (d >>> 8) & 255),
(t[26] = (d >>> 16) & 255),
(t[27] = (d >>> 24) & 255),
(t[28] = (y >>> 0) & 255),
(t[29] = (y >>> 8) & 255),
(t[30] = (y >>> 16) & 255),
(t[31] = (y >>> 24) & 255);
})(t, e, r, n);
}
const E = new Uint8Array([
101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32,
107,
]);
function v(t, e, r, n, o, i, s) {
let a,
f,
c = new Uint8Array(16),
u = new Uint8Array(64);
for (f = 0; f < 16; f++) c[f] = 0;
for (f = 0; f < 8; f++) c[f] = i[f];
for (; o >= 64; ) {
for (b(u, c, s, E), f = 0; f < 64; f++)
t[e + f] = r[n + f] ^ u[f];
for (a = 1, f = 8; f < 16; f++)
(a = (a + (255 & c[f])) | 0), (c[f] = 255 & a), (a >>>= 8);
(o -= 64), (e += 64), (n += 64);
}
if (o > 0)
for (b(u, c, s, E), f = 0; f < o; f++) t[e + f] = r[n + f] ^ u[f];
return 0;
}
function B(t, e, r, n, o) {
let i,
s,
a = new Uint8Array(16),
f = new Uint8Array(64);
for (s = 0; s < 16; s++) a[s] = 0;
for (s = 0; s < 8; s++) a[s] = n[s];
for (; r >= 64; ) {
for (b(f, a, o, E), s = 0; s < 64; s++) t[e + s] = f[s];
for (i = 1, s = 8; s < 16; s++)
(i = (i + (255 & a[s])) | 0), (a[s] = 255 & i), (i >>>= 8);
(r -= 64), (e += 64);
}
if (r > 0) for (b(f, a, o, E), s = 0; s < r; s++) t[e + s] = f[s];
return 0;
}
function x(t, e, r, n, o) {
const i = new Uint8Array(32);
m(i, n, o, E);
for (var s = new Uint8Array(8), a = 0; a < 8; a++) s[a] = n[a + 16];
return B(t, e, r, s, i);
}
function A(t, e, r, n, o, i, s) {
const a = new Uint8Array(32);
m(a, i, s, E);
for (var f = new Uint8Array(8), c = 0; c < 8; c++) f[c] = i[c + 16];
return v(t, e, r, n, o, f, a);
}
const S = function (t) {
let e, r, n, o, i, s, a, f;
(this.buffer = new Uint8Array(16)),
(this.r = new Uint16Array(10)),
(this.h = new Uint16Array(10)),
(this.pad = new Uint16Array(8)),
(this.leftover = 0),
(this.fin = 0),
(e = (255 & t[0]) | ((255 & t[1]) << 8)),
(this.r[0] = 8191 & e),
(r = (255 & t[2]) | ((255 & t[3]) << 8)),
(this.r[1] = 8191 & ((e >>> 13) | (r << 3))),
(n = (255 & t[4]) | ((255 & t[5]) << 8)),
(this.r[2] = 7939 & ((r >>> 10) | (n << 6))),
(o = (255 & t[6]) | ((255 & t[7]) << 8)),
(this.r[3] = 8191 & ((n >>> 7) | (o << 9))),
(i = (255 & t[8]) | ((255 & t[9]) << 8)),
(this.r[4] = 255 & ((o >>> 4) | (i << 12))),
(this.r[5] = (i >>> 1) & 8190),
(s = (255 & t[10]) | ((255 & t[11]) << 8)),
(this.r[6] = 8191 & ((i >>> 14) | (s << 2))),
(a = (255 & t[12]) | ((255 & t[13]) << 8)),
(this.r[7] = 8065 & ((s >>> 11) | (a << 5))),
(f = (255 & t[14]) | ((255 & t[15]) << 8)),
(this.r[8] = 8191 & ((a >>> 8) | (f << 8))),
(this.r[9] = (f >>> 5) & 127),
(this.pad[0] = (255 & t[16]) | ((255 & t[17]) << 8)),
(this.pad[1] = (255 & t[18]) | ((255 & t[19]) << 8)),
(this.pad[2] = (255 & t[20]) | ((255 & t[21]) << 8)),
(this.pad[3] = (255 & t[22]) | ((255 & t[23]) << 8)),
(this.pad[4] = (255 & t[24]) | ((255 & t[25]) << 8)),
(this.pad[5] = (255 & t[26]) | ((255 & t[27]) << 8)),
(this.pad[6] = (255 & t[28]) | ((255 & t[29]) << 8)),
(this.pad[7] = (255 & t[30]) | ((255 & t[31]) << 8));
};
function T(t, e, r, n, o, i) {
const s = new S(i);
return s.update(r, n, o), s.finish(t, e), 0;
}
function U(t, e, r, n, o, i) {
const s = new Uint8Array(16);
return T(s, 0, r, n, o, i), g(t, e, s, 0);
}
function _(t, e, r, n, o) {
let i;
if (r < 32) return -1;
for (
A(t, 0, e, 0, r, n, o), T(t, 16, t, 32, r - 32, t), i = 0;
i < 16;
i++
)
t[i] = 0;
return 0;
}
function O(t, e, r, n, o) {
let i,
s = new Uint8Array(32);
if (r < 32) return -1;
if ((x(s, 0, 32, n, o), 0 !== U(e, 16, e, 32, r - 32, s)))
return -1;
for (A(t, 0, e, 0, r, n, o), i = 0; i < 32; i++) t[i] = 0;
return 0;
}
function I(t, e) {
let r;
for (r = 0; r < 16; r++) t[r] = 0 | e[r];
}
function L(t) {
let e,
r,
n = 1;
for (e = 0; e < 16; e++)
(r = t[e] + n + 65535),
(n = Math.floor(r / 65536)),
(t[e] = r - 65536 * n);
t[0] += n - 1 + 37 * (n - 1);
}
function N(t, e, r) {
for (var n, o = ~(r - 1), i = 0; i < 16; i++)
(n = o & (t[i] ^ e[i])), (t[i] ^= n), (e[i] ^= n);
}
function R(t, r) {
let n,
o,
i,
s = e(),
a = e();
for (n = 0; n < 16; n++) a[n] = r[n];
for (L(a), L(a), L(a), o = 0; o < 2; o++) {
for (s[0] = a[0] - 65517, n = 1; n < 15; n++)
(s[n] = a[n] - 65535 - ((s[n - 1] >> 16) & 1)),
(s[n - 1] &= 65535);
(s[15] = a[15] - 32767 - ((s[14] >> 16) & 1)),
(i = (s[15] >> 16) & 1),
(s[14] &= 65535),
N(a, s, 1 - i);
}
for (n = 0; n < 16; n++)
(t[2 * n] = 255 & a[n]), (t[2 * n + 1] = a[n] >> 8);
}
function k(t, e) {
const r = new Uint8Array(32),
n = new Uint8Array(32);
return R(r, t), R(n, e), w(r, 0, n, 0);
}
function H(t) {
const e = new Uint8Array(32);
return R(e, t), 1 & e[0];
}
function M(t, e) {
let r;
for (r = 0; r < 16; r++) t[r] = e[2 * r] + (e[2 * r + 1] << 8);
t[15] &= 32767;
}
function q(t, e, r) {
for (let n = 0; n < 16; n++) t[n] = e[n] + r[n];
}
function C(t, e, r) {
for (let n = 0; n < 16; n++) t[n] = e[n] - r[n];
}
function F(t, e, r) {
let n,
o,
i = 0,
s = 0,
a = 0,
f = 0,
c = 0,
u = 0,
h = 0,
l = 0,
d = 0,
y = 0,
p = 0,
g = 0,
w = 0,
b = 0,
m = 0,
E = 0,
v = 0,
B = 0,
x = 0,
A = 0,
S = 0,
T = 0,
U = 0,
_ = 0,
O = 0,
I = 0,
L = 0,
N = 0,
R = 0,
k = 0,
H = 0,
M = r[0],
q = r[1],
C = r[2],
F = r[3],
P = r[4],
D = r[5],
j = r[6],
z = r[7],
$ = r[8],
K = r[9],
V = r[10],
Z = r[11],
Y = r[12],
W = r[13],
G = r[14],
J = r[15];
(i += (n = e[0]) * M),
(s += n * q),
(a += n * C),
(f += n * F),
(c += n * P),
(u += n * D),
(h += n * j),
(l += n * z),
(d += n * $),
(y += n * K),
(p += n * V),
(g += n * Z),
(w += n * Y),
(b += n * W),
(m += n * G),
(E += n * J),
(s += (n = e[1]) * M),
(a += n * q),
(f += n * C),
(c += n * F),
(u += n * P),
(h += n * D),
(l += n * j),
(d += n * z),
(y += n * $),
(p += n * K),
(g += n * V),
(w += n * Z),
(b += n * Y),
(m += n * W),
(E += n * G),
(v += n * J),
(a += (n = e[2]) * M),
(f += n * q),
(c += n * C),
(u += n * F),
(h += n * P),
(l += n * D),
(d += n * j),
(y += n * z),
(p += n * $),
(g += n * K),
(w += n * V),
(b += n * Z),
(m += n * Y),
(E += n * W),
(v += n * G),
(B += n * J),
(f += (n = e[3]) * M),
(c += n * q),
(u += n * C),
(h += n * F),
(l += n * P),
(d += n * D),
(y += n * j),
(p += n * z),
(g += n * $),
(w += n * K),
(b += n * V),
(m += n * Z),
(E += n * Y),
(v += n * W),
(B += n * G),
(x += n * J),
(c += (n = e[4]) * M),
(u += n * q),
(h += n * C),
(l += n * F),
(d += n * P),
(y += n * D),
(p += n * j),
(g += n * z),
(w += n * $),
(b += n * K),
(m += n * V),
(E += n * Z),
(v += n * Y),
(B += n * W),
(x += n * G),
(A += n * J),
(u += (n = e[5]) * M),
(h += n * q),
(l += n * C),
(d += n * F),
(y += n * P),
(p += n * D),
(g += n * j),
(w += n * z),
(b += n * $),
(m += n * K),
(E += n * V),
(v += n * Z),
(B += n * Y),
(x += n * W),
(A += n * G),
(S += n * J),
(h += (n = e[6]) * M),
(l += n * q),
(d += n * C),
(y += n * F),
(p += n * P),
(g += n * D),
(w += n * j),
(b += n * z),
(m += n * $),
(E += n * K),
(v += n * V),
(B += n * Z),
(x += n * Y),
(A += n * W),
(S += n * G),
(T += n * J),
(l += (n = e[7]) * M),
(d += n * q),
(y += n * C),
(p += n * F),
(g += n * P),
(w += n * D),
(b += n * j),
(m += n * z),
(E += n * $),
(v += n * K),
(B += n * V),
(x += n * Z),
(A += n * Y),
(S += n * W),
(T += n * G),
(U += n * J),
(d += (n = e[8]) * M),
(y += n * q),
(p += n * C),
(g += n * F),
(w += n * P),
(b += n * D),
(m += n * j),
(E += n * z),
(v += n * $),
(B += n * K),
(x += n * V),
(A += n * Z),
(S += n * Y),
(T += n * W),
(U += n * G),
(_ += n * J),
(y += (n = e[9]) * M),
(p += n * q),
(g += n * C),
(w += n * F),
(b += n * P),
(m += n * D),
(E += n * j),
(v += n * z),
(B += n * $),
(x += n * K),
(A += n * V),
(S += n * Z),
(T += n * Y),
(U += n * W),
(_ += n * G),
(O += n * J),
(p += (n = e[10]) * M),
(g += n * q),
(w += n * C),
(b += n * F),
(m += n * P),
(E += n * D),
(v += n * j),
(B += n * z),
(x += n * $),
(A += n * K),
(S += n * V),
(T += n * Z),
(U += n * Y),
(_ += n * W),
(O += n * G),
(I += n * J),
(g += (n = e[11]) * M),
(w += n * q),
(b += n * C),
(m += n * F),
(E += n * P),
(v += n * D),
(B += n * j),
(x += n * z),
(A += n * $),
(S += n * K),
(T += n * V),
(U += n * Z),
(_ += n * Y),
(O += n * W),
(I += n * G),
(L += n * J),
(w += (n = e[12]) * M),
(b += n * q),
(m += n * C),
(E += n * F),
(v += n * P),
(B += n * D),
(x += n * j),
(A += n * z),
(S += n * $),
(T += n * K),
(U += n * V),
(_ += n * Z),
(O += n * Y),
(I += n * W),
(L += n * G),
(N += n * J),
(b += (n = e[13]) * M),
(m += n * q),
(E += n * C),
(v += n * F),
(B += n * P),
(x += n * D),
(A += n * j),
(S += n * z),
(T += n * $),
(U += n * K),
(_ += n * V),
(O += n * Z),
(I += n * Y),
(L += n * W),
(N += n * G),
(R += n * J),
(m += (n = e[14]) * M),
(E += n * q),
(v += n * C),
(B += n * F),
(x += n * P),
(A += n * D),
(S += n * j),
(T += n * z),
(U += n * $),
(_ += n * K),
(O += n * V),
(I += n * Z),
(L += n * Y),
(N += n * W),
(R += n * G),
(k += n * J),
(E += (n = e[15]) * M),
(s += 38 * (B += n * C)),
(a += 38 * (x += n * F)),
(f += 38 * (A += n * P)),
(c += 38 * (S += n * D)),
(u += 38 * (T += n * j)),
(h += 38 * (U += n * z)),
(l += 38 * (_ += n * $)),
(d += 38 * (O += n * K)),
(y += 38 * (I += n * V)),
(p += 38 * (L += n * Z)),
(g += 38 * (N += n * Y)),
(w += 38 * (R += n * W)),
(b += 38 * (k += n * G)),
(m += 38 * (H += n * J)),
(i =
(n = (i += 38 * (v += n * q)) + (o = 1) + 65535) -
65536 * (o = Math.floor(n / 65536))),
(s = (n = s + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(a = (n = a + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(f = (n = f + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(c = (n = c + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(u = (n = u + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(h = (n = h + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(l = (n = l + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(d = (n = d + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(y = (n = y + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(p = (n = p + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(g = (n = g + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(w = (n = w + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(b = (n = b + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(m = (n = m + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(E = (n = E + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(i =
(n = (i += o - 1 + 37 * (o - 1)) + (o = 1) + 65535) -
65536 * (o = Math.floor(n / 65536))),
(s = (n = s + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(a = (n = a + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(f = (n = f + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(c = (n = c + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(u = (n = u + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(h = (n = h + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(l = (n = l + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(d = (n = d + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(y = (n = y + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(p = (n = p + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(g = (n = g + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(w = (n = w + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(b = (n = b + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(m = (n = m + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(E = (n = E + o + 65535) - 65536 * (o = Math.floor(n / 65536))),
(i += o - 1 + 37 * (o - 1)),
(t[0] = i),
(t[1] = s),
(t[2] = a),
(t[3] = f),
(t[4] = c),
(t[5] = u),
(t[6] = h),
(t[7] = l),
(t[8] = d),
(t[9] = y),
(t[10] = p),
(t[11] = g),
(t[12] = w),
(t[13] = b),
(t[14] = m),
(t[15] = E);
}
function P(t, e) {
F(t, e, e);
}
function D(t, r) {
let n,
o = e();
for (n = 0; n < 16; n++) o[n] = r[n];
for (n = 253; n >= 0; n--)
P(o, o), 2 !== n && 4 !== n && F(o, o, r);
for (n = 0; n < 16; n++) t[n] = o[n];
}
function j(t, r) {
let n,
o = e();
for (n = 0; n < 16; n++) o[n] = r[n];
for (n = 250; n >= 0; n--) P(o, o), 1 !== n && F(o, o, r);
for (n = 0; n < 16; n++) t[n] = o[n];
}
function z(t, r, n) {
let o,
i,
s = new Uint8Array(32),
a = new Float64Array(80),
c = e(),
u = e(),
h = e(),
l = e(),
d = e(),
y = e();
for (i = 0; i < 31; i++) s[i] = r[i];
for (
s[31] = (127 & r[31]) | 64, s[0] &= 248, M(a, n), i = 0;
i < 16;
i++
)
(u[i] = a[i]), (l[i] = c[i] = h[i] = 0);
for (c[0] = l[0] = 1, i = 254; i >= 0; --i)
N(c, u, (o = (s[i >>> 3] >>> (7 & i)) & 1)),
N(h, l, o),
q(d, c, h),
C(c, c, h),
q(h, u, l),
C(u, u, l),
P(l, d),
P(y, c),
F(c, h, c),
F(h, u, d),
q(d, c, h),
C(c, c, h),
P(u, c),
C(h, l, y),
F(c, h, f),
q(c, c, l),
F(h, h, c),
F(c, l, y),
F(l, u, a),
P(u, d),
N(c, u, o),
N(h, l, o);
for (i = 0; i < 16; i++)
(a[i + 16] = c[i]),
(a[i + 32] = h[i]),
(a[i + 48] = u[i]),
(a[i + 64] = l[i]);
const p = a.subarray(32),
g = a.subarray(16);
return D(p, p), F(g, g, p), R(t, g), 0;
}
function $(t, e) {
return z(t, e, i);
}
function K(t, e) {
return n(e, 32), $(t, e);
}
function V(t, e, r) {
const n = new Uint8Array(32);
return z(n, r, e), m(t, o, n, E);
}
(S.prototype.blocks = function (t, e, r) {
for (
var n,
o,
i,
s,
a,
f,
c,
u,
h,
l,
d,
y,
p,
g,
w,
b,
m,
E,
v,
B = this.fin ? 0 : 2048,
x = this.h[0],
A = this.h[1],
S = this.h[2],
T = this.h[3],
U = this.h[4],
_ = this.h[5],
O = this.h[6],
I = this.h[7],
L = this.h[8],
N = this.h[9],
R = this.r[0],
k = this.r[1],
H = this.r[2],
M = this.r[3],
q = this.r[4],
C = this.r[5],
F = this.r[6],
P = this.r[7],
D = this.r[8],
j = this.r[9];
r >= 16;
)
(l = h = 0),
(l +=
(x +=
8191 & (n = (255 & t[e + 0]) | ((255 & t[e + 1]) << 8))) *
R),
(l +=
(A +=
8191 &
((n >>> 13) |
((o = (255 & t[e + 2]) | ((255 & t[e + 3]) << 8)) <<
3))) *
(5 * j)),
(l +=
(S +=
8191 &
((o >>> 10) |
((i = (255 & t[e + 4]) | ((255 & t[e + 5]) << 8)) <<
6))) *
(5 * D)),
(l +=
(T +=
8191 &
((i >>> 7) |
((s = (255 & t[e + 6]) | ((255 & t[e + 7]) << 8)) <<
9))) *
(5 * P)),
(h =
(l +=
(U +=
8191 &
((s >>> 4) |
((a = (255 & t[e + 8]) | ((255 & t[e + 9]) << 8)) <<
12))) *
(5 * F)) >>> 13),
(l &= 8191),
(l += (_ += (a >>> 1) & 8191) * (5 * C)),
(l +=
(O +=
8191 &
((a >>> 14) |
((f = (255 & t[e + 10]) | ((255 & t[e + 11]) << 8)) <<
2))) *
(5 * q)),
(l +=
(I +=
8191 &
((f >>> 11) |
((c = (255 & t[e + 12]) | ((255 & t[e + 13]) << 8)) <<
5))) *
(5 * M)),
(l +=
(L +=
8191 &
((c >>> 8) |
((u = (255 & t[e + 14]) | ((255 & t[e + 15]) << 8)) <<
8))) *
(5 * H)),
(d = h += (l += (N += (u >>> 5) | B) * (5 * k)) >>> 13),
(d += x * k),
(d += A * R),
(d += S * (5 * j)),
(d += T * (5 * D)),
(h = (d += U * (5 * P)) >>> 13),
(d &= 8191),
(d += _ * (5 * F)),
(d += O * (5 * C)),
(d += I * (5 * q)),
(d += L * (5 * M)),
(h += (d += N * (5 * H)) >>> 13),
(d &= 8191),
(y = h),
(y += x * H),
(y += A * k),
(y += S * R),
(y += T * (5 * j)),
(h = (y += U * (5 * D)) >>> 13),
(y &= 8191),
(y += _ * (5 * P)),
(y += O * (5 * F)),
(y += I * (5 * C)),
(y += L * (5 * q)),
(p = h += (y += N * (5 * M)) >>> 13),
(p += x * M),
(p += A * H),
(p += S * k),
(p += T * R),
(h = (p += U * (5 * j)) >>> 13),
(p &= 8191),
(p += _ * (5 * D)),
(p += O * (5 * P)),
(p += I * (5 * F)),
(p += L * (5 * C)),
(g = h += (p += N * (5 * q)) >>> 13),
(g += x * q),
(g += A * M),
(g += S * H),
(g += T * k),
(h = (g += U * R) >>> 13),
(g &= 8191),
(g += _ * (5 * j)),
(g += O * (5 * D)),
(g += I * (5 * P)),
(g += L * (5 * F)),
(w = h += (g += N * (5 * C)) >>> 13),
(w += x * C),
(w += A * q),
(w += S * M),
(w += T * H),
(h = (w += U * k) >>> 13),
(w &= 8191),
(w += _ * R),
(w += O * (5 * j)),
(w += I * (5 * D)),
(w += L * (5 * P)),
(b = h += (w += N * (5 * F)) >>> 13),
(b += x * F),
(b += A * C),
(b += S * q),
(b += T * M),
(h = (b += U * H) >>> 13),
(b &= 8191),
(b += _ * k),
(b += O * R),
(b += I * (5 * j)),
(b += L * (5 * D)),
(m = h += (b += N * (5 * P)) >>> 13),
(m += x * P),
(m += A * F),
(m += S * C),
(m += T * q),
(h = (m += U * M) >>> 13),
(m &= 8191),
(m += _ * H),
(m += O * k),
(m += I * R),
(m += L * (5 * j)),
(E = h += (m += N * (5 * D)) >>> 13),
(E += x * D),
(E += A * P),
(E += S * F),
(E += T * C),
(h = (E += U * q) >>> 13),
(E &= 8191),
(E += _ * M),
(E += O * H),
(E += I * k),
(E += L * R),
(v = h += (E += N * (5 * j)) >>> 13),
(v += x * j),
(v += A * D),
(v += S * P),
(v += T * F),
(h = (v += U * C) >>> 13),
(v &= 8191),
(v += _ * q),
(v += O * M),
(v += I * H),
(v += L * k),
(x = l =
8191 &
(h =
((h = (((h += (v += N * R) >>> 13) << 2) + h) | 0) +
(l &= 8191)) |
0)),
(A = d += h >>>= 13),
(S = y &= 8191),
(T = p &= 8191),
(U = g &= 8191),
(_ = w &= 8191),
(O = b &= 8191),
(I = m &= 8191),
(L = E &= 8191),
(N = v &= 8191),
(e += 16),
(r -= 16);
(this.h[0] = x),
(this.h[1] = A),
(this.h[2] = S),
(this.h[3] = T),
(this.h[4] = U),
(this.h[5] = _),
(this.h[6] = O),
(this.h[7] = I),
(this.h[8] = L),
(this.h[9] = N);
}),
(S.prototype.finish = function (t, e) {
let r,
n,
o,
i,
s = new Uint16Array(10);
if (this.leftover) {
for (i = this.leftover, this.buffer[i++] = 1; i < 16; i++)
this.buffer[i] = 0;
(this.fin = 1), this.blocks(this.buffer, 0, 16);
}
for (r = this.h[1] >>> 13, this.h[1] &= 8191, i = 2; i < 10; i++)
(this.h[i] += r), (r = this.h[i] >>> 13), (this.h[i] &= 8191);
for (
this.h[0] += 5 * r,
r = this.h[0] >>> 13,
this.h[0] &= 8191,
this.h[1] += r,
r = this.h[1] >>> 13,
this.h[1] &= 8191,
this.h[2] += r,
s[0] = this.h[0] + 5,
r = s[0] >>> 13,
s[0] &= 8191,
i = 1;
i < 10;
i++
)
(s[i] = this.h[i] + r), (r = s[i] >>> 13), (s[i] &= 8191);
for (s[9] -= 8192, n = (1 ^ r) - 1, i = 0; i < 10; i++) s[i] &= n;
for (n = ~n, i = 0; i < 10; i++)
this.h[i] = (this.h[i] & n) | s[i];
for (
this.h[0] = 65535 & (this.h[0] | (this.h[1] << 13)),
this.h[1] = 65535 & ((this.h[1] >>> 3) | (this.h[2] << 10)),
this.h[2] = 65535 & ((this.h[2] >>> 6) | (this.h[3] << 7)),
this.h[3] = 65535 & ((this.h[3] >>> 9) | (this.h[4] << 4)),
this.h[4] =
65535 &
((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)),
this.h[5] = 65535 & ((this.h[6] >>> 2) | (this.h[7] << 11)),
this.h[6] = 65535 & ((this.h[7] >>> 5) | (this.h[8] << 8)),
this.h[7] = 65535 & ((this.h[8] >>> 8) | (this.h[9] << 5)),
o = this.h[0] + this.pad[0],
this.h[0] = 65535 & o,
i = 1;
i < 8;
i++
)
(o = (((this.h[i] + this.pad[i]) | 0) + (o >>> 16)) | 0),
(this.h[i] = 65535 & o);
(t[e + 0] = (this.h[0] >>> 0) & 255),
(t[e + 1] = (this.h[0] >>> 8) & 255),
(t[e + 2] = (this.h[1] >>> 0) & 255),
(t[e + 3] = (this.h[1] >>> 8) & 255),
(t[e + 4] = (this.h[2] >>> 0) & 255),
(t[e + 5] = (this.h[2] >>> 8) & 255),
(t[e + 6] = (this.h[3] >>> 0) & 255),
(t[e + 7] = (this.h[3] >>> 8) & 255),
(t[e + 8] = (this.h[4] >>> 0) & 255),
(t[e + 9] = (this.h[4] >>> 8) & 255),
(t[e + 10] = (this.h[5] >>> 0) & 255),
(t[e + 11] = (this.h[5] >>> 8) & 255),
(t[e + 12] = (this.h[6] >>> 0) & 255),
(t[e + 13] = (this.h[6] >>> 8) & 255),
(t[e + 14] = (this.h[7] >>> 0) & 255),
(t[e + 15] = (this.h[7] >>> 8) & 255);
}),
(S.prototype.update = function (t, e, r) {
let n, o;
if (this.leftover) {
for ((o = 16 - this.leftover) > r && (o = r), n = 0; n < o; n++)
this.buffer[this.leftover + n] = t[e + n];
if (
((r -= o), (e += o), (this.leftover += o), this.leftover < 16)
)
return;
this.blocks(this.buffer, 0, 16), (this.leftover = 0);
}
if (
(r >= 16 &&
((o = r - (r % 16)),
this.blocks(t, e, o),
(e += o),
(r -= o)),
r)
) {
for (n = 0; n < r; n++)
this.buffer[this.leftover + n] = t[e + n];
this.leftover += r;
}
});
const Z = _,
Y = O,
W = [
1116352408, 3609767458, 1899447441, 602891725, 3049323471,
3964484399, 3921009573, 2173295548, 961987163, 4081628472,
1508970993, 3053834265, 2453635748, 2937671579, 2870763221,
3664609560, 3624381080, 2734883394, 310598401, 1164996542,
607225278, 1323610764, 1426881987, 3590304994, 1925078388,
4068182383, 2162078206, 991336113, 2614888103, 633803317,
3248222580, 3479774868, 3835390401, 2666613458, 4022224774,
944711139, 264347078, 2341262773, 604807628, 2007800933,
770255983, 1495990901, 1249150122, 1856431235, 1555081692,
3175218132, 1996064986, 2198950837, 2554220882, 3999719339,
2821834349, 766784016, 2952996808, 2566594879, 3210313671,
3203337956, 3336571891, 1034457026, 3584528711, 2466948901,
113926993, 3758326383, 338241895, 168717936, 666307205,
1188179964, 773529912, 1546045734, 1294757372, 1522805485,
1396182291, 2643833823, 1695183700, 2343527390, 1986661051,
1014477480, 2177026350, 1206759142, 2456956037, 344077627,
2730485921, 1290863460, 2820302411, 3158454273, 3259730800,
3505952657, 3345764771, 106217008, 3516065817, 3606008344,
3600352804, 1432725776, 4094571909, 1467031594, 275423344,
851169720, 430227734, 3100823752, 506948616, 1363258195,
659060556, 3750685593, 883997877, 3785050280, 958139571,
3318307427, 1322822218, 3812723403, 1537002063, 2003034995,
1747873779, 3602036899, 1955562222, 1575990012, 2024104815,
1125592928, 2227730452, 2716904306, 2361852424, 442776044,
2428436474, 593698344, 2756734187, 3733110249, 3204031479,
2999351573, 3329325298, 3815920427, 3391569614, 3928383900,
3515267271, 566280711, 3940187606, 3454069534, 4118630271,
4000239992, 116418474, 1914138554, 174292421, 2731055270,
289380356, 3203993006, 460393269, 320620315, 685471733, 587496836,
852142971, 1086792851, 1017036298, 365543100, 1126000580,
2618297676, 1288033470, 3409855158, 1501505948, 4234509866,
1607167915, 987167468, 1816402316, 1246189591,
];
function G(t, e, r, n) {
for (
var o,
i,
s,
a,
f,
c,
u,
h,
l,
d,
y,
p,
g,
w,
b,
m,
E,
v,
B,
x,
A,
S,
T,
U,
_,
O,
I = new Int32Array(16),
L = new Int32Array(16),
N = t[0],
R = t[1],
k = t[2],
H = t[3],
M = t[4],
q = t[5],
C = t[6],
F = t[7],
P = e[0],
D = e[1],
j = e[2],
z = e[3],
$ = e[4],
K = e[5],
V = e[6],
Z = e[7],
Y = 0;
n >= 128;
) {
for (B = 0; B < 16; B++)
(x = 8 * B + Y),
(I[B] =
(r[x + 0] << 24) |
(r[x + 1] << 16) |
(r[x + 2] << 8) |
r[x + 3]),
(L[B] =
(r[x + 4] << 24) |
(r[x + 5] << 16) |
(r[x + 6] << 8) |
r[x + 7]);
for (B = 0; B < 80; B++)
if (
((o = N),
(i = R),
(s = k),
(a = H),
(f = M),
(c = q),
(u = C),
(l = P),
(d = D),
(y = j),
(p = z),
(g = $),
(w = K),
(b = V),
(T = 65535 & (S = Z)),
(U = S >>> 16),
(_ = 65535 & (A = F)),
(O = A >>> 16),
(T +=
65535 &
(S =
(($ >>> 14) | (M << 18)) ^
(($ >>> 18) | (M << 14)) ^
((M >>> 9) | ($ << 23)))),
(U += S >>> 16),
(_ +=
65535 &
(A =
((M >>> 14) | ($ << 18)) ^
((M >>> 18) | ($ << 14)) ^
(($ >>> 9) | (M << 23)))),
(O += A >>> 16),
(T += 65535 & (S = ($ & K) ^ (~$ & V))),
(U += S >>> 16),
(_ += 65535 & (A = (M & q) ^ (~M & C))),
(O += A >>> 16),
(A = W[2 * B]),
(T += 65535 & (S = W[2 * B + 1])),
(U += S >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(A = I[B % 16]),
(U += (S = L[B % 16]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(_ += (U += (T += 65535 & S) >>> 16) >>> 16),
(T = 65535 & (S = v = (65535 & T) | (U << 16))),
(U = S >>> 16),
(_ = 65535 & (A = E = (65535 & _) | ((O += _ >>> 16) << 16))),
(O = A >>> 16),
(T +=
65535 &
(S =
((P >>> 28) | (N << 4)) ^
((N >>> 2) | (P << 30)) ^
((N >>> 7) | (P << 25)))),
(U += S >>> 16),
(_ +=
65535 &
(A =
((N >>> 28) | (P << 4)) ^
((P >>> 2) | (N << 30)) ^
((P >>> 7) | (N << 25)))),
(O += A >>> 16),
(U += (S = (P & D) ^ (P & j) ^ (D & j)) >>> 16),
(_ += 65535 & (A = (N & R) ^ (N & k) ^ (R & k))),
(O += A >>> 16),
(h =
(65535 & (_ += (U += (T += 65535 & S) >>> 16) >>> 16)) |
((O += _ >>> 16) << 16)),
(m = (65535 & T) | (U << 16)),
(T = 65535 & (S = p)),
(U = S >>> 16),
(_ = 65535 & (A = a)),
(O = A >>> 16),
(U += (S = v) >>> 16),
(_ += 65535 & (A = E)),
(O += A >>> 16),
(R = o),
(k = i),
(H = s),
(M = a =
(65535 & (_ += (U += (T += 65535 & S) >>> 16) >>> 16)) |
((O += _ >>> 16) << 16)),
(q = f),
(C = c),
(F = u),
(N = h),
(D = l),
(j = d),
(z = y),
($ = p = (65535 & T) | (U << 16)),
(K = g),
(V = w),
(Z = b),
(P = m),
B % 16 == 15)
)
for (x = 0; x < 16; x++)
(A = I[x]),
(T = 65535 & (S = L[x])),
(U = S >>> 16),
(_ = 65535 & A),
(O = A >>> 16),
(A = I[(x + 9) % 16]),
(T += 65535 & (S = L[(x + 9) % 16])),
(U += S >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(E = I[(x + 1) % 16]),
(T +=
65535 &
(S =
(((v = L[(x + 1) % 16]) >>> 1) | (E << 31)) ^
((v >>> 8) | (E << 24)) ^
((v >>> 7) | (E << 25)))),
(U += S >>> 16),
(_ +=
65535 &
(A =
((E >>> 1) | (v << 31)) ^
((E >>> 8) | (v << 24)) ^
(E >>> 7))),
(O += A >>> 16),
(E = I[(x + 14) % 16]),
(U +=
(S =
(((v = L[(x + 14) % 16]) >>> 19) | (E << 13)) ^
((E >>> 29) | (v << 3)) ^
((v >>> 6) | (E << 26))) >>> 16),
(_ +=
65535 &
(A =
((E >>> 19) | (v << 13)) ^
((v >>> 29) | (E << 3)) ^
(E >>> 6))),
(O += A >>> 16),
(O +=
(_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(I[x] = (65535 & _) | (O << 16)),
(L[x] = (65535 & T) | (U << 16));
(T = 65535 & (S = P)),
(U = S >>> 16),
(_ = 65535 & (A = N)),
(O = A >>> 16),
(A = t[0]),
(U += (S = e[0]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[0] = N = (65535 & _) | (O << 16)),
(e[0] = P = (65535 & T) | (U << 16)),
(T = 65535 & (S = D)),
(U = S >>> 16),
(_ = 65535 & (A = R)),
(O = A >>> 16),
(A = t[1]),
(U += (S = e[1]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[1] = R = (65535 & _) | (O << 16)),
(e[1] = D = (65535 & T) | (U << 16)),
(T = 65535 & (S = j)),
(U = S >>> 16),
(_ = 65535 & (A = k)),
(O = A >>> 16),
(A = t[2]),
(U += (S = e[2]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[2] = k = (65535 & _) | (O << 16)),
(e[2] = j = (65535 & T) | (U << 16)),
(T = 65535 & (S = z)),
(U = S >>> 16),
(_ = 65535 & (A = H)),
(O = A >>> 16),
(A = t[3]),
(U += (S = e[3]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[3] = H = (65535 & _) | (O << 16)),
(e[3] = z = (65535 & T) | (U << 16)),
(T = 65535 & (S = $)),
(U = S >>> 16),
(_ = 65535 & (A = M)),
(O = A >>> 16),
(A = t[4]),
(U += (S = e[4]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[4] = M = (65535 & _) | (O << 16)),
(e[4] = $ = (65535 & T) | (U << 16)),
(T = 65535 & (S = K)),
(U = S >>> 16),
(_ = 65535 & (A = q)),
(O = A >>> 16),
(A = t[5]),
(U += (S = e[5]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[5] = q = (65535 & _) | (O << 16)),
(e[5] = K = (65535 & T) | (U << 16)),
(T = 65535 & (S = V)),
(U = S >>> 16),
(_ = 65535 & (A = C)),
(O = A >>> 16),
(A = t[6]),
(U += (S = e[6]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[6] = C = (65535 & _) | (O << 16)),
(e[6] = V = (65535 & T) | (U << 16)),
(T = 65535 & (S = Z)),
(U = S >>> 16),
(_ = 65535 & (A = F)),
(O = A >>> 16),
(A = t[7]),
(U += (S = e[7]) >>> 16),
(_ += 65535 & A),
(O += A >>> 16),
(O += (_ += (U += (T += 65535 & S) >>> 16) >>> 16) >>> 16),
(t[7] = F = (65535 & _) | (O << 16)),
(e[7] = Z = (65535 & T) | (U << 16)),
(Y += 128),
(n -= 128);
}
return n;
}
function J(t, e, r) {
let n,
o = new Int32Array(8),
i = new Int32Array(8),
s = new Uint8Array(256),
a = r;
for (
o[0] = 1779033703,
o[1] = 3144134277,
o[2] = 1013904242,
o[3] = 2773480762,
o[4] = 1359893119,
o[5] = 2600822924,
o[6] = 528734635,
o[7] = 1541459225,
i[0] = 4089235720,
i[1] = 2227873595,
i[2] = 4271175723,
i[3] = 1595750129,
i[4] = 2917565137,
i[5] = 725511199,
i[6] = 4215389547,
i[7] = 327033209,
G(o, i, e, r),
r %= 128,
n = 0;
n < r;
n++
)
s[n] = e[a - r + n];
for (
s[r] = 128,
s[(r = 256 - 128 * (r < 112 ? 1 : 0)) - 9] = 0,
y(s, r - 8, (a / 536870912) | 0, a << 3),
G(o, i, s, r),
n = 0;
n < 8;
n++
)
y(t, 8 * n, o[n], i[n]);
return 0;
}
function X(t, r) {
const n = e(),
o = e(),
i = e(),
s = e(),
a = e(),
f = e(),
c = e(),
h = e(),
l = e();
C(n, t[1], t[0]),
C(l, r[1], r[0]),
F(n, n, l),
q(o, t[0], t[1]),
q(l, r[0], r[1]),
F(o, o, l),
F(i, t[3], r[3]),
F(i, i, u),
F(s, t[2], r[2]),
q(s, s, s),
C(a, o, n),
C(f, s, i),
q(c, s, i),
q(h, o, n),
F(t[0], a, f),
F(t[1], h, c),
F(t[2], c, f),
F(t[3], a, h);
}
function Q(t, e, r) {
let n;
for (n = 0; n < 4; n++) N(t[n], e[n], r);
}
function tt(t, r) {
const n = e(),
o = e(),
i = e();
D(i, r[2]),
F(n, r[0], i),
F(o, r[1], i),
R(t, o),
(t[31] ^= H(n) << 7);
}
function et(t, e, r) {
let n, o;
for (
I(t[0], s), I(t[1], a), I(t[2], a), I(t[3], s), o = 255;
o >= 0;
--o
)
Q(t, e, (n = (r[(o / 8) | 0] >> (7 & o)) & 1)),
X(e, t),
X(t, t),
Q(t, e, n);
}
function rt(t, r) {
const n = [e(), e(), e(), e()];
I(n[0], h), I(n[1], l), I(n[2], a), F(n[3], h, l), et(t, n, r);
}
function nt(t, r, o) {
let i,
s = new Uint8Array(64),
a = [e(), e(), e(), e()];
for (
o || n(r, 32),
J(s, r, 32),
s[0] &= 248,
s[31] &= 127,
s[31] |= 64,
rt(a, s),
tt(t, a),
i = 0;
i < 32;
i++
)
r[i + 32] = t[i];
return 0;
}
const ot = new Float64Array([
237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249,
222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16,
]);
function it(t, e) {
let r, n, o, i;
for (n = 63; n >= 32; --n) {
for (r = 0, o = n - 32, i = n - 12; o < i; ++o)
(e[o] += r - 16 * e[n] * ot[o - (n - 32)]),
(r = Math.floor((e[o] + 128) / 256)),
(e[o] -= 256 * r);
(e[o] += r), (e[n] = 0);
}
for (r = 0, o = 0; o < 32; o++)
(e[o] += r - (e[31] >> 4) * ot[o]),
(r = e[o] >> 8),
(e[o] &= 255);
for (o = 0; o < 32; o++) e[o] -= r * ot[o];
for (n = 0; n < 32; n++)
(e[n + 1] += e[n] >> 8), (t[n] = 255 & e[n]);
}
function st(t) {
let e,
r = new Float64Array(64);
for (e = 0; e < 64; e++) r[e] = t[e];
for (e = 0; e < 64; e++) t[e] = 0;
it(t, r);
}
function at(t, r, n, o) {
let i,
s,
a = new Uint8Array(64),
f = new Uint8Array(64),
c = new Uint8Array(64),
u = new Float64Array(64),
h = [e(), e(), e(), e()];
J(a, o, 32), (a[0] &= 248), (a[31] &= 127), (a[31] |= 64);
const l = n + 64;
for (i = 0; i < n; i++) t[64 + i] = r[i];
for (i = 0; i < 32; i++) t[32 + i] = a[32 + i];
for (
J(c, t.subarray(32), n + 32), st(c), rt(h, c), tt(t, h), i = 32;
i < 64;
i++
)
t[i] = o[i];
for (J(f, t, n + 64), st(f), i = 0; i < 64; i++) u[i] = 0;
for (i = 0; i < 32; i++) u[i] = c[i];
for (i = 0; i < 32; i++)
for (s = 0; s < 32; s++) u[i + s] += f[i] * a[s];
return it(t.subarray(32), u), l;
}
function ft(t, r, n, o) {
let i,
f = new Uint8Array(32),
u = new Uint8Array(64),
h = [e(), e(), e(), e()],
l = [e(), e(), e(), e()];
if (n < 64) return -1;
if (
(function (t, r) {
const n = e(),
o = e(),
i = e(),
f = e(),
u = e(),
h = e(),
l = e();
return (
I(t[2], a),
M(t[1], r),
P(i, t[1]),
F(f, i, c),
C(i, i, t[2]),
q(f, t[2], f),
P(u, f),
P(h, u),
F(l, h, u),
F(n, l, i),
F(n, n, f),
j(n, n),
F(n, n, i),
F(n, n, f),
F(n, n, f),
F(t[0], n, f),
P(o, t[0]),
F(o, o, f),
k(o, i) && F(t[0], t[0], d),
P(o, t[0]),
F(o, o, f),
k(o, i)
? -1
: (H(t[0]) === r[31] >> 7 && C(t[0], s, t[0]),
F(t[3], t[0], t[1]),
0)
);
})(l, o)
)
return -1;
for (i = 0; i < n; i++) t[i] = r[i];
for (i = 0; i < 32; i++) t[i + 32] = o[i];
if (
(J(u, t, n),
st(u),
et(h, l, u),
rt(l, r.subarray(32)),
X(h, l),
tt(f, h),
(n -= 64),
w(r, 0, f, 0))
) {
for (i = 0; i < n; i++) t[i] = 0;
return -1;
}
for (i = 0; i < n; i++) t[i] = r[i + 64];
return n;
}
let ct,
ut = 64,
ht = 32,
lt = 64;
function dt(t, e) {
if (32 !== t.length) throw new Error("bad key size");
if (24 !== e.length) throw new Error("bad nonce size");
}
function yt() {
for (let t = 0; t < arguments.length; t++)
if (!(arguments[t] instanceof Uint8Array))
throw new TypeError("unexpected type, use Uint8Array");
}
function pt(t) {
for (let e = 0; e < t.length; e++) t[e] = 0;
}
(t.lowlevel = {
crypto_core_hsalsa20: m,
crypto_stream_xor: A,
crypto_stream: x,
crypto_stream_salsa20_xor: v,
crypto_stream_salsa20: B,
crypto_onetimeauth: T,
crypto_onetimeauth_verify: U,
crypto_verify_16: g,
crypto_verify_32: w,
crypto_secretbox: _,
crypto_secretbox_open: O,
crypto_scalarmult: z,
crypto_scalarmult_base: $,
crypto_box_beforenm: V,
crypto_box_afternm: Z,
crypto_box: function (t, e, r, n, o, i) {
const s = new Uint8Array(32);
return V(s, o, i), Z(t, e, r, n, s);
},
crypto_box_open: function (t, e, r, n, o, i) {
const s = new Uint8Array(32);
return V(s, o, i), Y(t, e, r, n, s);
},
crypto_box_keypair: K,
crypto_hash: J,
crypto_sign: at,
crypto_sign_keypair: nt,
crypto_sign_open: ft,
crypto_secretbox_KEYBYTES: 32,
crypto_secretbox_NONCEBYTES: 24,
crypto_secretbox_ZEROBYTES: 32,
crypto_secretbox_BOXZEROBYTES: 16,
crypto_scalarmult_BYTES: 32,
crypto_scalarmult_SCALARBYTES: 32,
crypto_box_PUBLICKEYBYTES: 32,
crypto_box_SECRETKEYBYTES: 32,
crypto_box_BEFORENMBYTES: 32,
crypto_box_NONCEBYTES: 24,
crypto_box_ZEROBYTES: 32,
crypto_box_BOXZEROBYTES: 16,
crypto_sign_BYTES: ut,
crypto_sign_PUBLICKEYBYTES: ht,
crypto_sign_SECRETKEYBYTES: lt,
crypto_sign_SEEDBYTES: 32,
crypto_hash_BYTES: 64,
gf: e,
D: c,
L: ot,
pack25519: R,
unpack25519: M,
M: F,
A: q,
S: P,
Z: C,
pow2523: j,
add: X,
set25519: I,
modL: it,
scalarmult: et,
scalarbase: rt,
}),
(t.randomBytes = function (t) {
const e = new Uint8Array(t);
return n(e, t), e;
}),
(t.secretbox = function (t, e, r) {
yt(t, e, r), dt(r, e);
for (
var n = new Uint8Array(32 + t.length),
o = new Uint8Array(n.length),
i = 0;
i < t.length;
i++
)
n[i + 32] = t[i];
return _(o, n, n.length, e, r), o.subarray(16);
}),
(t.secretbox.open = function (t, e, r) {
yt(t, e, r), dt(r, e);
for (
var n = new Uint8Array(16 + t.length),
o = new Uint8Array(n.length),
i = 0;
i < t.length;
i++
)
n[i + 16] = t[i];
return n.length < 32 || 0 !== O(o, n, n.length, e, r)
? null
: o.subarray(32);
}),
(t.secretbox.keyLength = 32),
(t.secretbox.nonceLength = 24),
(t.secretbox.overheadLength = 16),
(t.scalarMult = function (t, e) {
if ((yt(t, e), 32 !== t.length)) throw new Error("bad n size");
if (32 !== e.length) throw new Error("bad p size");
const r = new Uint8Array(32);
return z(r, t, e), r;
}),
(t.scalarMult.base = function (t) {
if ((yt(t), 32 !== t.length)) throw new Error("bad n size");
const e = new Uint8Array(32);
return $(e, t), e;
}),
(t.scalarMult.scalarLength = 32),
(t.scalarMult.groupElementLength = 32),
(t.box = function (e, r, n, o) {
const i = t.box.before(n, o);
return t.secretbox(e, r, i);
}),
(t.box.before = function (t, e) {
yt(t, e),
(function (t, e) {
if (32 !== t.length) throw new Error("bad public key size");
if (32 !== e.length) throw new Error("bad secret key size");
})(t, e);
const r = new Uint8Array(32);
return V(r, t, e), r;
}),
(t.box.after = t.secretbox),
(t.box.open = function (e, r, n, o) {
const i = t.box.before(n, o);
return t.secretbox.open(e, r, i);
}),
(t.box.open.after = t.secretbox.open),
(t.box.keyPair = function () {
const t = new Uint8Array(32),
e = new Uint8Array(32);
return K(t, e), { publicKey: t, secretKey: e };
}),
(t.box.keyPair.fromSecretKey = function (t) {
if ((yt(t), 32 !== t.length))
throw new Error("bad secret key size");
const e = new Uint8Array(32);
return $(e, t), { publicKey: e, secretKey: new Uint8Array(t) };
}),
(t.box.publicKeyLength = 32),
(t.box.secretKeyLength = 32),
(t.box.sharedKeyLength = 32),
(t.box.nonceLength = 24),
(t.box.overheadLength = t.secretbox.overheadLength),
(t.sign = function (t, e) {
if ((yt(t, e), e.length !== lt))
throw new Error("bad secret key size");
const r = new Uint8Array(ut + t.length);
return at(r, t, t.length, e), r;
}),
(t.sign.open = function (t, e) {
if ((yt(t, e), e.length !== ht))
throw new Error("bad public key size");
const r = new Uint8Array(t.length),
n = ft(r, t, t.length, e);
if (n < 0) return null;
for (var o = new Uint8Array(n), i = 0; i < o.length; i++)
o[i] = r[i];
return o;
}),
(t.sign.detached = function (e, r) {
for (
var n = t.sign(e, r), o = new Uint8Array(ut), i = 0;
i < o.length;
i++
)
o[i] = n[i];
return o;
}),
(t.sign.detached.verify = function (t, e, r) {
if ((yt(t, e, r), e.length !== ut))
throw new Error("bad signature size");
if (r.length !== ht) throw new Error("bad public key size");
let n,
o = new Uint8Array(ut + t.length),
i = new Uint8Array(ut + t.length);
for (n = 0; n < ut; n++) o[n] = e[n];
for (n = 0; n < t.length; n++) o[n + ut] = t[n];
return ft(i, o, o.length, r) >= 0;
}),
(t.sign.keyPair = function () {
const t = new Uint8Array(ht),
e = new Uint8Array(lt);
return nt(t, e), { publicKey: t, secretKey: e };
}),
(t.sign.keyPair.fromSecretKey = function (t) {
if ((yt(t), t.length !== lt))
throw new Error("bad secret key size");
for (var e = new Uint8Array(ht), r = 0; r < e.length; r++)
e[r] = t[32 + r];
return { publicKey: e, secretKey: new Uint8Array(t) };
}),
(t.sign.keyPair.fromSeed = function (t) {
if ((yt(t), 32 !== t.length)) throw new Error("bad seed size");
for (
var e = new Uint8Array(ht), r = new Uint8Array(lt), n = 0;
n < 32;
n++
)
r[n] = t[n];
return nt(e, r, !0), { publicKey: e, secretKey: r };
}),
(t.sign.publicKeyLength = ht),
(t.sign.secretKeyLength = lt),
(t.sign.seedLength = 32),
(t.sign.signatureLength = ut),
(t.hash = function (t) {
yt(t);
const e = new Uint8Array(64);
return J(e, t, t.length), e;
}),
(t.hash.hashLength = 64),
(t.verify = function (t, e) {
return (
yt(t, e),
0 !== t.length &&
0 !== e.length &&
t.length === e.length &&
0 === p(t, 0, e, 0, t.length)
);
}),
(t.setPRNG = function (t) {
n = t;
}),
(ct =
"undefined" != typeof self
? self.crypto || self.msCrypto
: null) && ct.getRandomValues
? t.setPRNG(function (t, e) {
let r,
n = new Uint8Array(e);
for (r = 0; r < e; r += 65536)
ct.getRandomValues(
n.subarray(r, r + Math.min(e - r, 65536)),
);
for (r = 0; r < e; r++) t[r] = n[r];
pt(n);
})
: (ct = r(24)) &&
ct.randomBytes &&
t.setPRNG(function (t, e) {
let r,
n = ct.randomBytes(e);
for (r = 0; r < e; r++) t[r] = n[r];
pt(n);
});
})(t.exports ? t.exports : (self.nacl = self.nacl || {}));
},
67: (t, e, r) => {
const n = r(780),
o = r(885),
i = r(497),
s = r(61),
a = {
toString: function (t, e = "utf8") {
switch (e) {
case "utf8":
return (function (t) {
return new TextDecoder().decode(t);
})(t);
case "base16":
return (function (t) {
return Array.from(t)
.map((t) => t.toString(16).padStart(2, "0"))
.join("");
})(t);
case "base64url":
return (function (t) {
return Buffer.from(t)
.toString("base64")
.replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=+$/, "");
})(t);
default:
throw new Error(`Unsupported encoding "${e}"`);
}
},
fromString: function (t, e = "utf8") {
if ("utf8" === e) return new TextEncoder().encode(t);
if ("base16" === e) {
if (t.length % 2 != 0)
throw new Error("Invalid hex string length.");
const e = new Uint8Array(t.length / 2);
for (let r = 0; r < t.length; r += 2)
e[r / 2] = parseInt(t.substring(r, r + 2), 16);
return e;
}
if ("base64url" === e) {
for (
t = t.replace(/-/g, "+").replace(/_/g, "/");
t.length % 4;
)
t += "=";
return new Uint8Array(Buffer.from(t, "base64"));
}
throw new Error(`Unsupported encoding "${e}"`);
},
};
async function f(t) {
const e = t.did,
r = t.keys[0].privateKeyHex,
n = await (async function (t) {
const e = await (function (t, e = !1) {
const r = t;
if (32 !== r.length)
throw new Error(
`bad_key: Invalid private key format. Expecting 32 bytes, but got ${r.length}`,
);
return async function (t) {
const n = i.secp256k1.sign(
(function (t) {
const e = "string" == typeof t ? a.fromString(t) : t;
return s.sha256(e);
})(t),
r,
);
return (
console.log(n),
l(
{
r: h(n.r.toString(16)),
s: h(n.s.toString(16)),
recoveryParam: n.recovery,
},
e,
)
);
};
})(
(function (t, e) {
let r = t.startsWith("0x") ? t.substring(2) : t;
return (
r.length % 2 != 0 && (r = `0${r}`),
a.fromString(r.toLowerCase(), "base16")
);
})(t),
!0,
);
return async (t) => p(await e(t));
})(r),
o = Math.floor(Date.now() / 1e3),
f = { exp: o + 60, iat: o, iss: e },
d = await (async function (t, e, r = {}) {
const {
issuer: n,
signer: o,
alg: i,
expiresIn: s,
canonicalize: a,
} = e;
if (!o)
throw new Error(
"missing_signer: No Signer functionality has been configured",
);
if (!n)
throw new Error(
"missing_issuer: No issuing DID has been configured",
);
r.typ || (r.typ = "JWT"), r.alg || (r.alg = i);
const f = { iat: Math.floor(Date.now() / 1e3), exp: void 0 };
if (s) {
if ("number" != typeof s)
throw new Error(
"invalid_argument: JWT expiresIn is not a number",
);
f.exp = (t.nbf || f.iat) + Math.floor(s);
}
return (async function (t, e, r = {}, n = {}) {
r.alg || (r.alg = c);
const o = "string" == typeof t ? t : u(t, n.canonicalize),
i = [u(r, n.canonicalize), o].join("."),
s =
(!1,
async function (t, e) {
const r = await e(t);
return "object" == typeof (n = r) && "r" in n && "s" in n
? l(r, false)
: r;
let n;
});
return [i, await s(i, e)].join(".");
})({ ...f, ...t, iss: n }, o, r, { canonicalize: a });
})(f, { alg: void 0, issuer: e, signer: n });
return d;
}
const c = "ES256K";
function u(t, e = !1) {
return (
(r = e
? (function (t) {
if ("number" == typeof t && isNaN(t))
throw new Error("NaN is not allowed");
if ("number" == typeof t && !isFinite(t))
throw new Error("Infinity is not allowed");
return null === t || "object" != typeof t
? JSON.stringify(t)
: t.toJSON instanceof Function
? serialize(t.toJSON())
: Array.isArray(t)
? `[${t.reduce(
(t, e, r) =>
`${t}${0 === r ? "" : ","}${serialize(
void 0 === e || "symbol" == typeof e ? null : e,
)}`,
"",
)}]`
: `{${Object.keys(t)
.sort()
.reduce(
(e, r) =>
void 0 === t[r] || "symbol" == typeof t[r]
? e
: `${e}${0 === e.length ? "" : ","}${serialize(
r,
)}:${serialize(t[r])}`,
"",
)}}`;
})(t)
: JSON.stringify(t)),
d(a.fromString(r))
);
let r;
}
function h(t, e = 64) {
return t.length === e ? t : "0".repeat(e - t.length) + t;
}
function l(t, e) {
const { r, s: n, recoveryParam: o } = t,
i = new Uint8Array(e ? 65 : 64);
if (
(i.set(a.fromString(r, "base16"), 0),
i.set(a.fromString(n, "base16"), 32),
e)
) {
if (void 0 === o)
throw new Error("Signer did not return a recoveryParam");
i[64] = o;
}
return d(i);
}
function d(t) {
return a.toString(t, "base64url");
}
function y(t) {
return a.toString(t, "base16");
}
function p(t) {
const e = (function (t) {
const e = t
.replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=/g, "");
return a.fromString(e, "base64url");
})(t);
if (e.length < 64 || e.length > 65)
throw new TypeError(
`Wrong size for signature. Expected 64 or 65 bytes, but got ${e.length}`,
);
return {
r: y(e.slice(0, 32)),
s: y(e.slice(32, 64)),
recoveryParam: 65 === e.length ? e[64] : void 0,
};
}
t.exports = {
getNotificationCount: async function () {
const t = localStorage.getItem("secret"),
e = o.decodeBase64(t),
r = (
await (async function (t) {
return new Promise((t, e) => {
const r = indexedDB.open("TimeSafari");
(r.onupgradeneeded = (t) => {
const e = t.target.result;
e.objectStoreNames.contains("settings") ||
e.createObjectStore("settings", { keyPath: "id" });
}),
(r.onsuccess = (r) => {
const n = r.target.result
.transaction("settings", "readonly")
.objectStore("settings")
.get(1);
(n.onsuccess = () => t(n.result)),
(n.onerror = () => e(n.error));
}),
(r.onerror = () => e(r.error));
});
})()
).activeDid,
i = await (async function () {
try {
const t = await new Promise((t, e) => {
const r = indexedDB.open("TimeSafariAccounts");
(r.onupgradeneeded = (t) => {
const e = t.target.result;
e.objectStoreNames.contains("accounts") ||
e.createObjectStore("accounts", { keyPath: "id" });
}),
(r.onsuccess = (r) => {
const n = r.target.result
.transaction("accounts", "readonly")
.objectStore("accounts")
.getAll();
(n.onsuccess = () => t(n.result)),
(n.onerror = () => e(n.error));
}),
(r.onerror = () => e(r.error));
});
return console.log("Accounts:", t), t;
} catch (t) {
console.error("Could not get accounts:", t);
}
})();
let s = null;
for (let a = 0; a < i.length; a++) {
const t = i[a],
c = t.did;
if (c == r) {
t.publicKeyHex;
const r = t.identity;
const i = o.decodeBase64(r),
a = i.slice(0, 24),
u = i.slice(24, r.length),
h = n.secretbox.open(u, a, e),
l = new TextDecoder("utf-8").decode(h),
d = JSON.parse(JSON.parse(l)),
y = { "Content-Type": "application/json" };
y.Authorization = "Bearer " + (await f(d));
const p = await fetch(
"https://test-api.endorser.ch/api/v2/report/claims",
{ method: "GET", headers: y },
);
(p.status_code = -200) &&
((data = p.json().data), (s = { [c]: data.length }));
break;
}
}
return s;
},
};
},
24: () => {},
},
e = {},
r = (function r(n) {
const o = e[n];
if (void 0 !== o) return o.exports;
const i = (e[n] = { exports: {} });
return t[n].call(i.exports, i, i.exports, r), i.exports;
})(67);
customModule = r;
})();