UNPKG

@danidoble/webserial

Version:
1,285 lines 226 kB
import { K as On, s as Dn, i as $, a as Te, w as Ae } from "./kernel-D9C1iBu-.js"; import { D as Re } from "./devices-CzEcntFZ.js"; var In = "0123456789abcdefghijklmnopqrstuvwxyz"; function Y(i) { return In.charAt(i); } function Nn(i, t) { return i & t; } function Bt(i, t) { return i | t; } function Ce(i, t) { return i ^ t; } function Oe(i, t) { return i & ~t; } function Bn(i) { if (i == 0) return -1; var t = 0; return (i & 65535) == 0 && (i >>= 16, t += 16), (i & 255) == 0 && (i >>= 8, t += 8), (i & 15) == 0 && (i >>= 4, t += 4), (i & 3) == 0 && (i >>= 2, t += 2), (i & 1) == 0 && ++t, t; } function xn(i) { for (var t = 0; i != 0; ) i &= i - 1, ++t; return t; } var gt = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", tn = "="; function Tt(i) { var t, e, n = ""; for (t = 0; t + 3 <= i.length; t += 3) e = parseInt(i.substring(t, t + 3), 16), n += gt.charAt(e >> 6) + gt.charAt(e & 63); for (t + 1 == i.length ? (e = parseInt(i.substring(t, t + 1), 16), n += gt.charAt(e << 2)) : t + 2 == i.length && (e = parseInt(i.substring(t, t + 2), 16), n += gt.charAt(e >> 2) + gt.charAt((e & 3) << 4)); (n.length & 3) > 0; ) n += tn; return n; } function De(i) { var t = "", e, n = 0, r = 0; for (e = 0; e < i.length && i.charAt(e) != tn; ++e) { var s = gt.indexOf(i.charAt(e)); s < 0 || (n == 0 ? (t += Y(s >> 2), r = s & 3, n = 1) : n == 1 ? (t += Y(r << 2 | s >> 4), r = s & 15, n = 2) : n == 2 ? (t += Y(r), t += Y(s >> 2), r = s & 3, n = 3) : (t += Y(r << 2 | s >> 4), t += Y(s & 15), n = 0)); } return n == 1 && (t += Y(r << 2)), t; } var pt, Ln = { decode: function(i) { var t; if (pt === void 0) { var e = "0123456789ABCDEF", n = ` \f \r  \u2028\u2029`; for (pt = {}, t = 0; t < 16; ++t) pt[e.charAt(t)] = t; for (e = e.toLowerCase(), t = 10; t < 16; ++t) pt[e.charAt(t)] = t; for (t = 0; t < n.length; ++t) pt[n.charAt(t)] = -1; } var r = [], s = 0, a = 0; for (t = 0; t < i.length; ++t) { var o = i.charAt(t); if (o == "=") break; if (o = pt[o], o != -1) { if (o === void 0) throw new Error("Illegal character at offset " + t); s |= o, ++a >= 2 ? (r[r.length] = s, s = 0, a = 0) : s <<= 4; } } if (a) throw new Error("Hex encoding incomplete: 4 bits missing"); return r; } }, ot, ce = { decode: function(i) { var t; if (ot === void 0) { var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", n = `= \f \r  \u2028\u2029`; for (ot = /* @__PURE__ */ Object.create(null), t = 0; t < 64; ++t) ot[e.charAt(t)] = t; for (ot["-"] = 62, ot._ = 63, t = 0; t < n.length; ++t) ot[n.charAt(t)] = -1; } var r = [], s = 0, a = 0; for (t = 0; t < i.length; ++t) { var o = i.charAt(t); if (o == "=") break; if (o = ot[o], o != -1) { if (o === void 0) throw new Error("Illegal character at offset " + t); s |= o, ++a >= 4 ? (r[r.length] = s >> 16, r[r.length] = s >> 8 & 255, r[r.length] = s & 255, s = 0, a = 0) : s <<= 6; } } switch (a) { case 1: throw new Error("Base64 encoding incomplete: at least 2 bits missing"); case 2: r[r.length] = s >> 10; break; case 3: r[r.length] = s >> 16, r[r.length] = s >> 8 & 255; break; } return r; }, re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/, unarmor: function(i) { var t = ce.re.exec(i); if (t) if (t[1]) i = t[1]; else if (t[2]) i = t[2]; else throw new Error("RegExp out of sync"); return ce.decode(i); } }, dt = 1e13, St = ( /** @class */ (function() { function i(t) { this.buf = [+t || 0]; } return i.prototype.mulAdd = function(t, e) { var n = this.buf, r = n.length, s, a; for (s = 0; s < r; ++s) a = n[s] * t + e, a < dt ? e = 0 : (e = 0 | a / dt, a -= e * dt), n[s] = a; e > 0 && (n[s] = e); }, i.prototype.sub = function(t) { var e = this.buf, n = e.length, r, s; for (r = 0; r < n; ++r) s = e[r] - t, s < 0 ? (s += dt, t = 1) : t = 0, e[r] = s; for (; e[e.length - 1] === 0; ) e.pop(); }, i.prototype.toString = function(t) { if ((t || 10) != 10) throw new Error("only base 10 is supported"); for (var e = this.buf, n = e[e.length - 1].toString(), r = e.length - 2; r >= 0; --r) n += (dt + e[r]).toString().substring(1); return n; }, i.prototype.valueOf = function() { for (var t = this.buf, e = 0, n = t.length - 1; n >= 0; --n) e = e * dt + t[n]; return e; }, i.prototype.simplify = function() { var t = this.buf; return t.length == 1 ? t[0] : this; }, i; })() ), en = "…", Un = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, Vn = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/; function mt(i, t) { return i.length > t && (i = i.substring(0, t) + en), i; } var ee = ( /** @class */ (function() { function i(t, e) { this.hexDigits = "0123456789ABCDEF", t instanceof i ? (this.enc = t.enc, this.pos = t.pos) : (this.enc = t, this.pos = e); } return i.prototype.get = function(t) { if (t === void 0 && (t = this.pos++), t >= this.enc.length) throw new Error("Requesting byte offset ".concat(t, " on a stream of length ").concat(this.enc.length)); return typeof this.enc == "string" ? this.enc.charCodeAt(t) : this.enc[t]; }, i.prototype.hexByte = function(t) { return this.hexDigits.charAt(t >> 4 & 15) + this.hexDigits.charAt(t & 15); }, i.prototype.hexDump = function(t, e, n) { for (var r = "", s = t; s < e; ++s) if (r += this.hexByte(this.get(s)), n !== !0) switch (s & 15) { case 7: r += " "; break; case 15: r += ` `; break; default: r += " "; } return r; }, i.prototype.isASCII = function(t, e) { for (var n = t; n < e; ++n) { var r = this.get(n); if (r < 32 || r > 176) return !1; } return !0; }, i.prototype.parseStringISO = function(t, e) { for (var n = "", r = t; r < e; ++r) n += String.fromCharCode(this.get(r)); return n; }, i.prototype.parseStringUTF = function(t, e) { for (var n = "", r = t; r < e; ) { var s = this.get(r++); s < 128 ? n += String.fromCharCode(s) : s > 191 && s < 224 ? n += String.fromCharCode((s & 31) << 6 | this.get(r++) & 63) : n += String.fromCharCode((s & 15) << 12 | (this.get(r++) & 63) << 6 | this.get(r++) & 63); } return n; }, i.prototype.parseStringBMP = function(t, e) { for (var n = "", r, s, a = t; a < e; ) r = this.get(a++), s = this.get(a++), n += String.fromCharCode(r << 8 | s); return n; }, i.prototype.parseTime = function(t, e, n) { var r = this.parseStringISO(t, e), s = (n ? Un : Vn).exec(r); return s ? (n && (s[1] = +s[1], s[1] += +s[1] < 70 ? 2e3 : 1900), r = s[1] + "-" + s[2] + "-" + s[3] + " " + s[4], s[5] && (r += ":" + s[5], s[6] && (r += ":" + s[6], s[7] && (r += "." + s[7]))), s[8] && (r += " UTC", s[8] != "Z" && (r += s[8], s[9] && (r += ":" + s[9]))), r) : "Unrecognized time: " + r; }, i.prototype.parseInteger = function(t, e) { for (var n = this.get(t), r = n > 127, s = r ? 255 : 0, a, o = ""; n == s && ++t < e; ) n = this.get(t); if (a = e - t, a === 0) return r ? -1 : 0; if (a > 4) { for (o = n, a <<= 3; ((+o ^ s) & 128) == 0; ) o = +o << 1, --a; o = "(" + a + ` bit) `; } r && (n = n - 256); for (var c = new St(n), u = t + 1; u < e; ++u) c.mulAdd(256, this.get(u)); return o + c.toString(); }, i.prototype.parseBitString = function(t, e, n) { for (var r = this.get(t), s = (e - t - 1 << 3) - r, a = "(" + s + ` bit) `, o = "", c = t + 1; c < e; ++c) { for (var u = this.get(c), l = c == e - 1 ? r : 0, f = 7; f >= l; --f) o += u >> f & 1 ? "1" : "0"; if (o.length > n) return a + mt(o, n); } return a + o; }, i.prototype.parseOctetString = function(t, e, n) { if (this.isASCII(t, e)) return mt(this.parseStringISO(t, e), n); var r = e - t, s = "(" + r + ` byte) `; n /= 2, r > n && (e = t + n); for (var a = t; a < e; ++a) s += this.hexByte(this.get(a)); return r > n && (s += en), s; }, i.prototype.parseOID = function(t, e, n) { for (var r = "", s = new St(), a = 0, o = t; o < e; ++o) { var c = this.get(o); if (s.mulAdd(128, c & 127), a += 7, !(c & 128)) { if (r === "") if (s = s.simplify(), s instanceof St) s.sub(80), r = "2." + s.toString(); else { var u = s < 80 ? s < 40 ? 0 : 1 : 2; r = u + "." + (s - u * 40); } else r += "." + s.toString(); if (r.length > n) return mt(r, n); s = new St(), a = 0; } } return a > 0 && (r += ".incomplete"), r; }, i; })() ), Mn = ( /** @class */ (function() { function i(t, e, n, r, s) { if (!(r instanceof Ie)) throw new Error("Invalid tag value."); this.stream = t, this.header = e, this.length = n, this.tag = r, this.sub = s; } return i.prototype.typeName = function() { switch (this.tag.tagClass) { case 0: switch (this.tag.tagNumber) { case 0: return "EOC"; case 1: return "BOOLEAN"; case 2: return "INTEGER"; case 3: return "BIT_STRING"; case 4: return "OCTET_STRING"; case 5: return "NULL"; case 6: return "OBJECT_IDENTIFIER"; case 7: return "ObjectDescriptor"; case 8: return "EXTERNAL"; case 9: return "REAL"; case 10: return "ENUMERATED"; case 11: return "EMBEDDED_PDV"; case 12: return "UTF8String"; case 16: return "SEQUENCE"; case 17: return "SET"; case 18: return "NumericString"; case 19: return "PrintableString"; // ASCII subset case 20: return "TeletexString"; // aka T61String case 21: return "VideotexString"; case 22: return "IA5String"; // ASCII case 23: return "UTCTime"; case 24: return "GeneralizedTime"; case 25: return "GraphicString"; case 26: return "VisibleString"; // ASCII subset case 27: return "GeneralString"; case 28: return "UniversalString"; case 30: return "BMPString"; } return "Universal_" + this.tag.tagNumber.toString(); case 1: return "Application_" + this.tag.tagNumber.toString(); case 2: return "[" + this.tag.tagNumber.toString() + "]"; // Context case 3: return "Private_" + this.tag.tagNumber.toString(); } }, i.prototype.content = function(t) { if (this.tag === void 0) return null; t === void 0 && (t = 1 / 0); var e = this.posContent(), n = Math.abs(this.length); if (!this.tag.isUniversal()) return this.sub !== null ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + n, t); switch (this.tag.tagNumber) { case 1: return this.stream.get(e) === 0 ? "false" : "true"; case 2: return this.stream.parseInteger(e, e + n); case 3: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(e, e + n, t); case 4: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(e, e + n, t); // case 0x05: // NULL case 6: return this.stream.parseOID(e, e + n, t); // case 0x07: // ObjectDescriptor // case 0x08: // EXTERNAL // case 0x09: // REAL // case 0x0A: // ENUMERATED // case 0x0B: // EMBEDDED_PDV case 16: // SEQUENCE case 17: return this.sub !== null ? "(" + this.sub.length + " elem)" : "(no elem)"; case 12: return mt(this.stream.parseStringUTF(e, e + n), t); case 18: // NumericString case 19: // PrintableString case 20: // TeletexString case 21: // VideotexString case 22: // IA5String // case 0x19: // GraphicString case 26: return mt(this.stream.parseStringISO(e, e + n), t); case 30: return mt(this.stream.parseStringBMP(e, e + n), t); case 23: // UTCTime case 24: return this.stream.parseTime(e, e + n, this.tag.tagNumber == 23); } return null; }, i.prototype.toString = function() { return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]"; }, i.prototype.toPrettyString = function(t) { t === void 0 && (t = ""); var e = t + this.typeName() + " @" + this.stream.pos; if (this.length >= 0 && (e += "+"), e += this.length, this.tag.tagConstructed ? e += " (constructed)" : this.tag.isUniversal() && (this.tag.tagNumber == 3 || this.tag.tagNumber == 4) && this.sub !== null && (e += " (encapsulates)"), e += ` `, this.sub !== null) { t += " "; for (var n = 0, r = this.sub.length; n < r; ++n) e += this.sub[n].toPrettyString(t); } return e; }, i.prototype.posStart = function() { return this.stream.pos; }, i.prototype.posContent = function() { return this.stream.pos + this.header; }, i.prototype.posEnd = function() { return this.stream.pos + this.header + Math.abs(this.length); }, i.prototype.toHexString = function() { return this.stream.hexDump(this.posStart(), this.posEnd(), !0); }, i.decodeLength = function(t) { var e = t.get(), n = e & 127; if (n == e) return n; if (n > 6) throw new Error("Length over 48 bits not supported at position " + (t.pos - 1)); if (n === 0) return null; e = 0; for (var r = 0; r < n; ++r) e = e * 256 + t.get(); return e; }, i.prototype.getHexStringValue = function() { var t = this.toHexString(), e = this.header * 2, n = this.length * 2; return t.substring(e, e + n); }, i.decode = function(t) { var e; t instanceof ee ? e = t : e = new ee(t, 0); var n = new ee(e), r = new Ie(e), s = i.decodeLength(e), a = e.pos, o = a - n.pos, c = null, u = function() { var f = []; if (s !== null) { for (var d = a + s; e.pos < d; ) f[f.length] = i.decode(e); if (e.pos != d) throw new Error("Content size is not correct for container starting at offset " + a); } else try { for (; ; ) { var g = i.decode(e); if (g.tag.isEOC()) break; f[f.length] = g; } s = a - e.pos; } catch (P) { throw new Error("Exception while decoding undefined length content: " + P); } return f; }; if (r.tagConstructed) c = u(); else if (r.isUniversal() && (r.tagNumber == 3 || r.tagNumber == 4)) try { if (r.tagNumber == 3 && e.get() != 0) throw new Error("BIT STRINGs with unused bits cannot encapsulate."); c = u(); for (var l = 0; l < c.length; ++l) if (c[l].tag.isEOC()) throw new Error("EOC is not supposed to be actual content."); } catch { c = null; } if (c === null) { if (s === null) throw new Error("We can't skip over an invalid tag with undefined length at offset " + a); e.pos = a + Math.abs(s); } return new i(n, o, s, r, c); }, i; })() ), Ie = ( /** @class */ (function() { function i(t) { var e = t.get(); if (this.tagClass = e >> 6, this.tagConstructed = (e & 32) !== 0, this.tagNumber = e & 31, this.tagNumber == 31) { var n = new St(); do e = t.get(), n.mulAdd(128, e & 127); while (e & 128); this.tagNumber = n.simplify(); } } return i.prototype.isUniversal = function() { return this.tagClass === 0; }, i.prototype.isEOC = function() { return this.tagClass === 0 && this.tagNumber === 0; }, i; })() ), rt, Fn = 244837814094590, Ne = (Fn & 16777215) == 15715070, U = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], kn = (1 << 26) / U[U.length - 1], w = ( /** @class */ (function() { function i(t, e, n) { t != null && (typeof t == "number" ? this.fromNumber(t, e, n) : e == null && typeof t != "string" ? this.fromString(t, 256) : this.fromString(t, e)); } return i.prototype.toString = function(t) { if (this.s < 0) return "-" + this.negate().toString(t); var e; if (t == 16) e = 4; else if (t == 8) e = 3; else if (t == 2) e = 1; else if (t == 32) e = 5; else if (t == 4) e = 2; else return this.toRadix(t); var n = (1 << e) - 1, r, s = !1, a = "", o = this.t, c = this.DB - o * this.DB % e; if (o-- > 0) for (c < this.DB && (r = this[o] >> c) > 0 && (s = !0, a = Y(r)); o >= 0; ) c < e ? (r = (this[o] & (1 << c) - 1) << e - c, r |= this[--o] >> (c += this.DB - e)) : (r = this[o] >> (c -= e) & n, c <= 0 && (c += this.DB, --o)), r > 0 && (s = !0), s && (a += Y(r)); return s ? a : "0"; }, i.prototype.negate = function() { var t = S(); return i.ZERO.subTo(this, t), t; }, i.prototype.abs = function() { return this.s < 0 ? this.negate() : this; }, i.prototype.compareTo = function(t) { var e = this.s - t.s; if (e != 0) return e; var n = this.t; if (e = n - t.t, e != 0) return this.s < 0 ? -e : e; for (; --n >= 0; ) if ((e = this[n] - t[n]) != 0) return e; return 0; }, i.prototype.bitLength = function() { return this.t <= 0 ? 0 : this.DB * (this.t - 1) + xt(this[this.t - 1] ^ this.s & this.DM); }, i.prototype.mod = function(t) { var e = S(); return this.abs().divRemTo(t, null, e), this.s < 0 && e.compareTo(i.ZERO) > 0 && t.subTo(e, e), e; }, i.prototype.modPowInt = function(t, e) { var n; return t < 256 || e.isEven() ? n = new Be(e) : n = new xe(e), this.exp(t, n); }, i.prototype.clone = function() { var t = S(); return this.copyTo(t), t; }, i.prototype.intValue = function() { if (this.s < 0) { if (this.t == 1) return this[0] - this.DV; if (this.t == 0) return -1; } else { if (this.t == 1) return this[0]; if (this.t == 0) return 0; } return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0]; }, i.prototype.byteValue = function() { return this.t == 0 ? this.s : this[0] << 24 >> 24; }, i.prototype.shortValue = function() { return this.t == 0 ? this.s : this[0] << 16 >> 16; }, i.prototype.signum = function() { return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1; }, i.prototype.toByteArray = function() { var t = this.t, e = []; e[0] = this.s; var n = this.DB - t * this.DB % 8, r, s = 0; if (t-- > 0) for (n < this.DB && (r = this[t] >> n) != (this.s & this.DM) >> n && (e[s++] = r | this.s << this.DB - n); t >= 0; ) n < 8 ? (r = (this[t] & (1 << n) - 1) << 8 - n, r |= this[--t] >> (n += this.DB - 8)) : (r = this[t] >> (n -= 8) & 255, n <= 0 && (n += this.DB, --t)), (r & 128) != 0 && (r |= -256), s == 0 && (this.s & 128) != (r & 128) && ++s, (s > 0 || r != this.s) && (e[s++] = r); return e; }, i.prototype.equals = function(t) { return this.compareTo(t) == 0; }, i.prototype.min = function(t) { return this.compareTo(t) < 0 ? this : t; }, i.prototype.max = function(t) { return this.compareTo(t) > 0 ? this : t; }, i.prototype.and = function(t) { var e = S(); return this.bitwiseTo(t, Nn, e), e; }, i.prototype.or = function(t) { var e = S(); return this.bitwiseTo(t, Bt, e), e; }, i.prototype.xor = function(t) { var e = S(); return this.bitwiseTo(t, Ce, e), e; }, i.prototype.andNot = function(t) { var e = S(); return this.bitwiseTo(t, Oe, e), e; }, i.prototype.not = function() { for (var t = S(), e = 0; e < this.t; ++e) t[e] = this.DM & ~this[e]; return t.t = this.t, t.s = ~this.s, t; }, i.prototype.shiftLeft = function(t) { var e = S(); return t < 0 ? this.rShiftTo(-t, e) : this.lShiftTo(t, e), e; }, i.prototype.shiftRight = function(t) { var e = S(); return t < 0 ? this.lShiftTo(-t, e) : this.rShiftTo(t, e), e; }, i.prototype.getLowestSetBit = function() { for (var t = 0; t < this.t; ++t) if (this[t] != 0) return t * this.DB + Bn(this[t]); return this.s < 0 ? this.t * this.DB : -1; }, i.prototype.bitCount = function() { for (var t = 0, e = this.s & this.DM, n = 0; n < this.t; ++n) t += xn(this[n] ^ e); return t; }, i.prototype.testBit = function(t) { var e = Math.floor(t / this.DB); return e >= this.t ? this.s != 0 : (this[e] & 1 << t % this.DB) != 0; }, i.prototype.setBit = function(t) { return this.changeBit(t, Bt); }, i.prototype.clearBit = function(t) { return this.changeBit(t, Oe); }, i.prototype.flipBit = function(t) { return this.changeBit(t, Ce); }, i.prototype.add = function(t) { var e = S(); return this.addTo(t, e), e; }, i.prototype.subtract = function(t) { var e = S(); return this.subTo(t, e), e; }, i.prototype.multiply = function(t) { var e = S(); return this.multiplyTo(t, e), e; }, i.prototype.divide = function(t) { var e = S(); return this.divRemTo(t, e, null), e; }, i.prototype.remainder = function(t) { var e = S(); return this.divRemTo(t, null, e), e; }, i.prototype.divideAndRemainder = function(t) { var e = S(), n = S(); return this.divRemTo(t, e, n), [e, n]; }, i.prototype.modPow = function(t, e) { var n = t.bitLength(), r, s = nt(1), a; if (n <= 0) return s; n < 18 ? r = 1 : n < 48 ? r = 3 : n < 144 ? r = 4 : n < 768 ? r = 5 : r = 6, n < 8 ? a = new Be(e) : e.isEven() ? a = new qn(e) : a = new xe(e); var o = [], c = 3, u = r - 1, l = (1 << r) - 1; if (o[1] = a.convert(this), r > 1) { var f = S(); for (a.sqrTo(o[1], f); c <= l; ) o[c] = S(), a.mulTo(f, o[c - 2], o[c]), c += 2; } var d = t.t - 1, g, P = !0, m = S(), _; for (n = xt(t[d]) - 1; d >= 0; ) { for (n >= u ? g = t[d] >> n - u & l : (g = (t[d] & (1 << n + 1) - 1) << u - n, d > 0 && (g |= t[d - 1] >> this.DB + n - u)), c = r; (g & 1) == 0; ) g >>= 1, --c; if ((n -= c) < 0 && (n += this.DB, --d), P) o[g].copyTo(s), P = !1; else { for (; c > 1; ) a.sqrTo(s, m), a.sqrTo(m, s), c -= 2; c > 0 ? a.sqrTo(s, m) : (_ = s, s = m, m = _), a.mulTo(m, o[g], s); } for (; d >= 0 && (t[d] & 1 << n) == 0; ) a.sqrTo(s, m), _ = s, s = m, m = _, --n < 0 && (n = this.DB - 1, --d); } return a.revert(s); }, i.prototype.modInverse = function(t) { var e = t.isEven(); if (this.isEven() && e || t.signum() == 0) return i.ZERO; for (var n = t.clone(), r = this.clone(), s = nt(1), a = nt(0), o = nt(0), c = nt(1); n.signum() != 0; ) { for (; n.isEven(); ) n.rShiftTo(1, n), e ? ((!s.isEven() || !a.isEven()) && (s.addTo(this, s), a.subTo(t, a)), s.rShiftTo(1, s)) : a.isEven() || a.subTo(t, a), a.rShiftTo(1, a); for (; r.isEven(); ) r.rShiftTo(1, r), e ? ((!o.isEven() || !c.isEven()) && (o.addTo(this, o), c.subTo(t, c)), o.rShiftTo(1, o)) : c.isEven() || c.subTo(t, c), c.rShiftTo(1, c); n.compareTo(r) >= 0 ? (n.subTo(r, n), e && s.subTo(o, s), a.subTo(c, a)) : (r.subTo(n, r), e && o.subTo(s, o), c.subTo(a, c)); } if (r.compareTo(i.ONE) != 0) return i.ZERO; if (c.compareTo(t) >= 0) return c.subtract(t); if (c.signum() < 0) c.addTo(t, c); else return c; return c.signum() < 0 ? c.add(t) : c; }, i.prototype.pow = function(t) { return this.exp(t, new jn()); }, i.prototype.gcd = function(t) { var e = this.s < 0 ? this.negate() : this.clone(), n = t.s < 0 ? t.negate() : t.clone(); if (e.compareTo(n) < 0) { var r = e; e = n, n = r; } var s = e.getLowestSetBit(), a = n.getLowestSetBit(); if (a < 0) return e; for (s < a && (a = s), a > 0 && (e.rShiftTo(a, e), n.rShiftTo(a, n)); e.signum() > 0; ) (s = e.getLowestSetBit()) > 0 && e.rShiftTo(s, e), (s = n.getLowestSetBit()) > 0 && n.rShiftTo(s, n), e.compareTo(n) >= 0 ? (e.subTo(n, e), e.rShiftTo(1, e)) : (n.subTo(e, n), n.rShiftTo(1, n)); return a > 0 && n.lShiftTo(a, n), n; }, i.prototype.isProbablePrime = function(t) { var e, n = this.abs(); if (n.t == 1 && n[0] <= U[U.length - 1]) { for (e = 0; e < U.length; ++e) if (n[0] == U[e]) return !0; return !1; } if (n.isEven()) return !1; for (e = 1; e < U.length; ) { for (var r = U[e], s = e + 1; s < U.length && r < kn; ) r *= U[s++]; for (r = n.modInt(r); e < s; ) if (r % U[e++] == 0) return !1; } return n.millerRabin(t); }, i.prototype.copyTo = function(t) { for (var e = this.t - 1; e >= 0; --e) t[e] = this[e]; t.t = this.t, t.s = this.s; }, i.prototype.fromInt = function(t) { this.t = 1, this.s = t < 0 ? -1 : 0, t > 0 ? this[0] = t : t < -1 ? this[0] = t + this.DV : this.t = 0; }, i.prototype.fromString = function(t, e) { var n; if (e == 16) n = 4; else if (e == 8) n = 3; else if (e == 256) n = 8; else if (e == 2) n = 1; else if (e == 32) n = 5; else if (e == 4) n = 2; else { this.fromRadix(t, e); return; } this.t = 0, this.s = 0; for (var r = t.length, s = !1, a = 0; --r >= 0; ) { var o = n == 8 ? +t[r] & 255 : Ue(t, r); if (o < 0) { t.charAt(r) == "-" && (s = !0); continue; } s = !1, a == 0 ? this[this.t++] = o : a + n > this.DB ? (this[this.t - 1] |= (o & (1 << this.DB - a) - 1) << a, this[this.t++] = o >> this.DB - a) : this[this.t - 1] |= o << a, a += n, a >= this.DB && (a -= this.DB); } n == 8 && (+t[0] & 128) != 0 && (this.s = -1, a > 0 && (this[this.t - 1] |= (1 << this.DB - a) - 1 << a)), this.clamp(), s && i.ZERO.subTo(this, this); }, i.prototype.clamp = function() { for (var t = this.s & this.DM; this.t > 0 && this[this.t - 1] == t; ) --this.t; }, i.prototype.dlShiftTo = function(t, e) { var n; for (n = this.t - 1; n >= 0; --n) e[n + t] = this[n]; for (n = t - 1; n >= 0; --n) e[n] = 0; e.t = this.t + t, e.s = this.s; }, i.prototype.drShiftTo = function(t, e) { for (var n = t; n < this.t; ++n) e[n - t] = this[n]; e.t = Math.max(this.t - t, 0), e.s = this.s; }, i.prototype.lShiftTo = function(t, e) { for (var n = t % this.DB, r = this.DB - n, s = (1 << r) - 1, a = Math.floor(t / this.DB), o = this.s << n & this.DM, c = this.t - 1; c >= 0; --c) e[c + a + 1] = this[c] >> r | o, o = (this[c] & s) << n; for (var c = a - 1; c >= 0; --c) e[c] = 0; e[a] = o, e.t = this.t + a + 1, e.s = this.s, e.clamp(); }, i.prototype.rShiftTo = function(t, e) { e.s = this.s; var n = Math.floor(t / this.DB); if (n >= this.t) { e.t = 0; return; } var r = t % this.DB, s = this.DB - r, a = (1 << r) - 1; e[0] = this[n] >> r; for (var o = n + 1; o < this.t; ++o) e[o - n - 1] |= (this[o] & a) << s, e[o - n] = this[o] >> r; r > 0 && (e[this.t - n - 1] |= (this.s & a) << s), e.t = this.t - n, e.clamp(); }, i.prototype.subTo = function(t, e) { for (var n = 0, r = 0, s = Math.min(t.t, this.t); n < s; ) r += this[n] - t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r -= t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r -= t[n], e[n++] = r & this.DM, r >>= this.DB; r -= t.s; } e.s = r < 0 ? -1 : 0, r < -1 ? e[n++] = this.DV + r : r > 0 && (e[n++] = r), e.t = n, e.clamp(); }, i.prototype.multiplyTo = function(t, e) { var n = this.abs(), r = t.abs(), s = n.t; for (e.t = s + r.t; --s >= 0; ) e[s] = 0; for (s = 0; s < r.t; ++s) e[s + n.t] = n.am(0, r[s], e, s, 0, n.t); e.s = 0, e.clamp(), this.s != t.s && i.ZERO.subTo(e, e); }, i.prototype.squareTo = function(t) { for (var e = this.abs(), n = t.t = 2 * e.t; --n >= 0; ) t[n] = 0; for (n = 0; n < e.t - 1; ++n) { var r = e.am(n, e[n], t, 2 * n, 0, 1); (t[n + e.t] += e.am(n + 1, 2 * e[n], t, 2 * n + 1, r, e.t - n - 1)) >= e.DV && (t[n + e.t] -= e.DV, t[n + e.t + 1] = 1); } t.t > 0 && (t[t.t - 1] += e.am(n, e[n], t, 2 * n, 0, 1)), t.s = 0, t.clamp(); }, i.prototype.divRemTo = function(t, e, n) { var r = t.abs(); if (!(r.t <= 0)) { var s = this.abs(); if (s.t < r.t) { e?.fromInt(0), n != null && this.copyTo(n); return; } n == null && (n = S()); var a = S(), o = this.s, c = t.s, u = this.DB - xt(r[r.t - 1]); u > 0 ? (r.lShiftTo(u, a), s.lShiftTo(u, n)) : (r.copyTo(a), s.copyTo(n)); var l = a.t, f = a[l - 1]; if (f != 0) { var d = f * (1 << this.F1) + (l > 1 ? a[l - 2] >> this.F2 : 0), g = this.FV / d, P = (1 << this.F1) / d, m = 1 << this.F2, _ = n.t, b = _ - l, v = e ?? S(); for (a.dlShiftTo(b, v), n.compareTo(v) >= 0 && (n[n.t++] = 1, n.subTo(v, n)), i.ONE.dlShiftTo(l, v), v.subTo(a, a); a.t < l; ) a[a.t++] = 0; for (; --b >= 0; ) { var T = n[--_] == f ? this.DM : Math.floor(n[_] * g + (n[_ - 1] + m) * P); if ((n[_] += a.am(0, T, n, b, 0, l)) < T) for (a.dlShiftTo(b, v), n.subTo(v, n); n[_] < --T; ) n.subTo(v, n); } e != null && (n.drShiftTo(l, e), o != c && i.ZERO.subTo(e, e)), n.t = l, n.clamp(), u > 0 && n.rShiftTo(u, n), o < 0 && i.ZERO.subTo(n, n); } } }, i.prototype.invDigit = function() { if (this.t < 1) return 0; var t = this[0]; if ((t & 1) == 0) return 0; var e = t & 3; return e = e * (2 - (t & 15) * e) & 15, e = e * (2 - (t & 255) * e) & 255, e = e * (2 - ((t & 65535) * e & 65535)) & 65535, e = e * (2 - t * e % this.DV) % this.DV, e > 0 ? this.DV - e : -e; }, i.prototype.isEven = function() { return (this.t > 0 ? this[0] & 1 : this.s) == 0; }, i.prototype.exp = function(t, e) { if (t > 4294967295 || t < 1) return i.ONE; var n = S(), r = S(), s = e.convert(this), a = xt(t) - 1; for (s.copyTo(n); --a >= 0; ) if (e.sqrTo(n, r), (t & 1 << a) > 0) e.mulTo(r, s, n); else { var o = n; n = r, r = o; } return e.revert(n); }, i.prototype.chunkSize = function(t) { return Math.floor(Math.LN2 * this.DB / Math.log(t)); }, i.prototype.toRadix = function(t) { if (t == null && (t = 10), this.signum() == 0 || t < 2 || t > 36) return "0"; var e = this.chunkSize(t), n = Math.pow(t, e), r = nt(n), s = S(), a = S(), o = ""; for (this.divRemTo(r, s, a); s.signum() > 0; ) o = (n + a.intValue()).toString(t).substring(1) + o, s.divRemTo(r, s, a); return a.intValue().toString(t) + o; }, i.prototype.fromRadix = function(t, e) { this.fromInt(0), e == null && (e = 10); for (var n = this.chunkSize(e), r = Math.pow(e, n), s = !1, a = 0, o = 0, c = 0; c < t.length; ++c) { var u = Ue(t, c); if (u < 0) { t.charAt(c) == "-" && this.signum() == 0 && (s = !0); continue; } o = e * o + u, ++a >= n && (this.dMultiply(r), this.dAddOffset(o, 0), a = 0, o = 0); } a > 0 && (this.dMultiply(Math.pow(e, a)), this.dAddOffset(o, 0)), s && i.ZERO.subTo(this, this); }, i.prototype.fromNumber = function(t, e, n) { if (typeof e == "number") if (t < 2) this.fromInt(1); else for (this.fromNumber(t, n), this.testBit(t - 1) || this.bitwiseTo(i.ONE.shiftLeft(t - 1), Bt, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(e); ) this.dAddOffset(2, 0), this.bitLength() > t && this.subTo(i.ONE.shiftLeft(t - 1), this); else { var r = [], s = t & 7; r.length = (t >> 3) + 1, e.nextBytes(r), s > 0 ? r[0] &= (1 << s) - 1 : r[0] = 0, this.fromString(r, 256); } }, i.prototype.bitwiseTo = function(t, e, n) { var r, s, a = Math.min(t.t, this.t); for (r = 0; r < a; ++r) n[r] = e(this[r], t[r]); if (t.t < this.t) { for (s = t.s & this.DM, r = a; r < this.t; ++r) n[r] = e(this[r], s); n.t = this.t; } else { for (s = this.s & this.DM, r = a; r < t.t; ++r) n[r] = e(s, t[r]); n.t = t.t; } n.s = e(this.s, t.s), n.clamp(); }, i.prototype.changeBit = function(t, e) { var n = i.ONE.shiftLeft(t); return this.bitwiseTo(n, e, n), n; }, i.prototype.addTo = function(t, e) { for (var n = 0, r = 0, s = Math.min(t.t, this.t); n < s; ) r += this[n] + t[n], e[n++] = r & this.DM, r >>= this.DB; if (t.t < this.t) { for (r += t.s; n < this.t; ) r += this[n], e[n++] = r & this.DM, r >>= this.DB; r += this.s; } else { for (r += this.s; n < t.t; ) r += t[n], e[n++] = r & this.DM, r >>= this.DB; r += t.s; } e.s = r < 0 ? -1 : 0, r > 0 ? e[n++] = r : r < -1 && (e[n++] = this.DV + r), e.t = n, e.clamp(); }, i.prototype.dMultiply = function(t) { this[this.t] = this.am(0, t - 1, this, 0, 0, this.t), ++this.t, this.clamp(); }, i.prototype.dAddOffset = function(t, e) { if (t != 0) { for (; this.t <= e; ) this[this.t++] = 0; for (this[e] += t; this[e] >= this.DV; ) this[e] -= this.DV, ++e >= this.t && (this[this.t++] = 0), ++this[e]; } }, i.prototype.multiplyLowerTo = function(t, e, n) { var r = Math.min(this.t + t.t, e); for (n.s = 0, n.t = r; r > 0; ) n[--r] = 0; for (var s = n.t - this.t; r < s; ++r) n[r + this.t] = this.am(0, t[r], n, r, 0, this.t); for (var s = Math.min(t.t, e); r < s; ++r) this.am(0, t[r], n, r, 0, e - r); n.clamp(); }, i.prototype.multiplyUpperTo = function(t, e, n) { --e; var r = n.t = this.t + t.t - e; for (n.s = 0; --r >= 0; ) n[r] = 0; for (r = Math.max(e - this.t, 0); r < t.t; ++r) n[this.t + r - e] = this.am(e - r, t[r], n, 0, 0, this.t + r - e); n.clamp(), n.drShiftTo(1, n); }, i.prototype.modInt = function(t) { if (t <= 0) return 0; var e = this.DV % t, n = this.s < 0 ? t - 1 : 0; if (this.t > 0) if (e == 0) n = this[0] % t; else for (var r = this.t - 1; r >= 0; --r) n = (e * n + this[r]) % t; return n; }, i.prototype.millerRabin = function(t) { var e = this.subtract(i.ONE), n = e.getLowestSetBit(); if (n <= 0) return !1; var r = e.shiftRight(n); t = t + 1 >> 1, t > U.length && (t = U.length); for (var s = S(), a = 0; a < t; ++a) { s.fromInt(U[Math.floor(Math.random() * U.length)]); var o = s.modPow(r, this); if (o.compareTo(i.ONE) != 0 && o.compareTo(e) != 0) { for (var c = 1; c++ < n && o.compareTo(e) != 0; ) if (o = o.modPowInt(2, this), o.compareTo(i.ONE) == 0) return !1; if (o.compareTo(e) != 0) return !1; } } return !0; }, i.prototype.square = function() { var t = S(); return this.squareTo(t), t; }, i.prototype.gcda = function(t, e) { var n = this.s < 0 ? this.negate() : this.clone(), r = t.s < 0 ? t.negate() : t.clone(); if (n.compareTo(r) < 0) { var s = n; n = r, r = s; } var a = n.getLowestSetBit(), o = r.getLowestSetBit(); if (o < 0) { e(n); return; } a < o && (o = a), o > 0 && (n.rShiftTo(o, n), r.rShiftTo(o, r)); var c = function() { (a = n.getLowestSetBit()) > 0 && n.rShiftTo(a, n), (a = r.getLowestSetBit()) > 0 && r.rShiftTo(a, r), n.compareTo(r) >= 0 ? (n.subTo(r, n), n.rShiftTo(1, n)) : (r.subTo(n, r), r.rShiftTo(1, r)), n.signum() > 0 ? setTimeout(c, 0) : (o > 0 && r.lShiftTo(o, r), setTimeout(function() { e(r); }, 0)); }; setTimeout(c, 10); }, i.prototype.fromNumberAsync = function(t, e, n, r) { if (typeof e == "number") if (t < 2) this.fromInt(1); else { this.fromNumber(t, n), this.testBit(t - 1) || this.bitwiseTo(i.ONE.shiftLeft(t - 1), Bt, this), this.isEven() && this.dAddOffset(1, 0); var s = this, a = function() { s.dAddOffset(2, 0), s.bitLength() > t && s.subTo(i.ONE.shiftLeft(t - 1), s), s.isProbablePrime(e) ? setTimeout(function() { r(); }, 0) : setTimeout(a, 0); }; setTimeout(a, 0); } else { var o = [], c = t & 7; o.length = (t >> 3) + 1, e.nextBytes(o), c > 0 ? o[0] &= (1 << c) - 1 : o[0] = 0, this.fromString(o, 256); } }, i; })() ), jn = ( /** @class */ (function() { function i() { } return i.prototype.convert = function(t) { return t; }, i.prototype.revert = function(t) { return t; }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e); }, i; })() ), Be = ( /** @class */ (function() { function i(t) { this.m = t; } return i.prototype.convert = function(t) { return t.s < 0 || t.compareTo(this.m) >= 0 ? t.mod(this.m) : t; }, i.prototype.revert = function(t) { return t; }, i.prototype.reduce = function(t) { t.divRemTo(this.m, null, t); }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n), this.reduce(n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e), this.reduce(e); }, i; })() ), xe = ( /** @class */ (function() { function i(t) { this.m = t, this.mp = t.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << t.DB - 15) - 1, this.mt2 = 2 * t.t; } return i.prototype.convert = function(t) { var e = S(); return t.abs().dlShiftTo(this.m.t, e), e.divRemTo(this.m, null, e), t.s < 0 && e.compareTo(w.ZERO) > 0 && this.m.subTo(e, e), e; }, i.prototype.revert = function(t) { var e = S(); return t.copyTo(e), this.reduce(e), e; }, i.prototype.reduce = function(t) { for (; t.t <= this.mt2; ) t[t.t++] = 0; for (var e = 0; e < this.m.t; ++e) { var n = t[e] & 32767, r = n * this.mpl + ((n * this.mph + (t[e] >> 15) * this.mpl & this.um) << 15) & t.DM; for (n = e + this.m.t, t[n] += this.m.am(0, r, t, e, 0, this.m.t); t[n] >= t.DV; ) t[n] -= t.DV, t[++n]++; } t.clamp(), t.drShiftTo(this.m.t, t), t.compareTo(this.m) >= 0 && t.subTo(this.m, t); }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n), this.reduce(n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e), this.reduce(e); }, i; })() ), qn = ( /** @class */ (function() { function i(t) { this.m = t, this.r2 = S(), this.q3 = S(), w.ONE.dlShiftTo(2 * t.t, this.r2), this.mu = this.r2.divide(t); } return i.prototype.convert = function(t) { if (t.s < 0 || t.t > 2 * this.m.t) return t.mod(this.m); if (t.compareTo(this.m) < 0) return t; var e = S(); return t.copyTo(e), this.reduce(e), e; }, i.prototype.revert = function(t) { return t; }, i.prototype.reduce = function(t) { for (t.drShiftTo(this.m.t - 1, this.r2), t.t > this.m.t + 1 && (t.t = this.m.t + 1, t.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); t.compareTo(this.r2) < 0; ) t.dAddOffset(1, this.m.t + 1); for (t.subTo(this.r2, t); t.compareTo(this.m) >= 0; ) t.subTo(this.m, t); }, i.prototype.mulTo = function(t, e, n) { t.multiplyTo(e, n), this.reduce(n); }, i.prototype.sqrTo = function(t, e) { t.squareTo(e), this.reduce(e); }, i; })() ); function S() { return new w(null); } function O(i, t) { return new w(i, t); } var Le = typeof navigator < "u"; Le && Ne && navigator.appName == "Microsoft Internet Explorer" ? (w.prototype.am = function(t, e, n, r, s, a) { for (var o = e & 32767, c = e >> 15; --a >= 0; ) { var u = this[t] & 32767, l = this[t++] >> 15, f = c * u + l * o; u = o * u + ((f & 32767) << 15) + n[r] + (s & 1073741823), s = (u >>> 30) + (f >>> 15) + c * l + (s >>> 30), n[r++] = u & 1073741823; } return s; }, rt = 30) : Le && Ne && navigator.appName != "Netscape" ? (w.prototype.am = function(t, e, n, r, s, a) { for (; --a >= 0; ) { var o = e * this[t++] + n[r] + s; s = Math.floor(o / 67108864), n[r++] = o & 67108863; } return s; }, rt = 26) : (w.prototype.am = function(t, e, n, r, s, a) { for (var o = e & 16383, c = e >> 14; --a >= 0; ) { var u = this[t] & 16383, l = this[t++] >> 14, f = c * u + l * o; u = o * u + ((f & 16383) << 14) + n[r] + s, s = (u >> 28) + (f >> 14) + c * l, n[r++] = u & 268435455; } return s; }, rt = 28); w.prototype.DB = rt; w.prototype.DM = (1 << rt) - 1; w.prototype.DV = 1 << rt; var _e = 52; w.prototype.FV = Math.pow(2, _e); w.prototype.F1 = _e - rt; w.prototype.F2 = 2 * rt - _e; var Xt = [], bt, q; bt = 48; for (q = 0; q <= 9; ++q) Xt[bt++] = q; bt = 97; for (q = 10; q < 36; ++q) Xt[bt++] = q; bt = 65; for (q = 10; q < 36; ++q) Xt[bt++] = q; function Ue(i, t) { var e = Xt[i.charCodeAt(t)]; return e ?? -1; } function nt(i) { var t = S(); return t.fromInt(i), t; } function xt(i) { var t = 1, e; return (e = i >>> 16) != 0 && (i = e, t += 16), (e = i >> 8) != 0 && (i = e, t += 8), (e = i >> 4) != 0 && (i = e, t += 4), (e = i >> 2) != 0 && (i = e, t += 2), (e = i >> 1) != 0 && (i = e, t += 1), t; } w.ZERO = nt(0); w.ONE = nt(1); var Kn = ( /** @class */ (function() { function i() { this.i = 0, this.j = 0, this.S = []; } return i.prototype.init = function(t) { var e, n, r; for (e = 0; e < 256; ++e) this.S[e] = e; for (n = 0, e = 0; e < 256; ++e) n = n + this.S[e] + t[e % t.length] & 255, r = this.S[e], this.S[e] = this.S[n], this.S[n] = r; this.i = 0, this.j = 0; }, i.prototype.next = function() { var t; return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, t = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = t, this.S[t + this.S[this.i] & 255]; }, i; })() ); function Hn() { return new Kn(); } var nn = 256, Lt, it = null, H; if (it == null) { it = [], H = 0; var Ut = void 0; if (typeof window < "u" && self.crypto && self.crypto.getRandomValues) { var ne = new Uint32Array(256); for (self.crypto.getRandomValues(ne), Ut = 0; Ut < ne.length; ++Ut) it[H++] = ne[Ut] & 255; } var Vt = 0, Mt = function(i) { if (Vt = Vt || 0, Vt >= 256 || H >= nn) { self.removeEventListener ? self.removeEventListener("mousemove", Mt, !1) : self.detachEvent && self.detachEvent("onmousemove", Mt); return; } try { var t = i.x + i.y; it[H++] = t & 255, Vt += 1; } catch { } }; typeof window < "u" && (self.addEventListener ? self.addEventListener("mousemove", Mt, !1) : self.attachEvent && self.attachEvent("onmousemove", Mt)); } function Wn() { if (Lt == null) { for (Lt = Hn(); H < nn; ) { var i = Math.floor(65536 * Math.random()); it[H++] = i & 255; } for (Lt.init(it), H = 0; H < it.length; ++H) it[H] = 0; H = 0; } return Lt.next(); } var Ht = ( /** @class */ (function() { function i() { } return i.prototype.nextBytes = function(t) { for (var e = 0; e < t.length; ++e) t[e] = Wn(); }, i; })() ); function ue(i) { return zn(ei(Xn(i), i.length * 8)); } function Ve(i) { for (var t = "0123456789abcdef", e = "", n = 0; n < i.length; n++) { var r = i.charCodeAt(n); e += t.charAt(r >>> 4 & 15) + t.charAt(r & 15); } return e; } function Xn(i) { for (var t = Array(i.length >> 2), e = 0; e < t.length; e++) t[e] = 0; for (var e = 0; e < i.length * 8; e += 8) t[e >> 5] |= (i.charCodeAt(e / 8) & 255) << 24 - e % 32; return t; } function zn(i) { for (var t = "", e = 0; e < i.length * 32; e += 8) t += String.fromCharCode(i[e >> 5] >>> 24 - e % 32 & 255); return t; } function J(i, t) { return i >>> t | i << 32 - t; } function rn(i, t) { return i >>> t; } function Gn(i, t, e) { return i & t ^ ~i & e; } function $n(i, t, e) { return i & t ^ i & e ^ t & e; } function Jn(i) { return J(i, 2) ^ J(i, 13) ^ J(i, 22); } function Qn(i) { return J(i, 6) ^ J(i, 11) ^ J(i, 25); } function Zn(i) { return J(i, 7) ^ J(i, 18) ^ rn(i, 3); } function Yn(i) { return J(i, 17) ^ J(i, 19) ^ rn(i, 10); } var ti = new Array(1116352408, 1899447441, -1245643825, -373957723, 961987163, 1508970993, -1841331548, -1424204075, -670586216, 310598401, 607225278, 1426881987, 1925078388, -2132889090, -1680079193, -1046744716, -459576895, -272742522, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, -1740746414, -1473132947, -1341970488, -1084653625, -958395405, -710438585, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, -2117940946, -1838011259, -1564481375, -1474664885, -1035236496, -949202525, -778901479, -694614492, -200395387, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, -2067236844, -1933114872, -1866530822, -1538233109, -1090935817, -965641998); function ei(i, t) { var e = new Array(1779033703, -1150833019, 1013904242, -1521486534, 1359893119, -1694144372, 528734635, 1541459225), n = new Array(64), r, s, a, o, c, u, l, f, d, g, P, m; for (i[t >> 5] |= 128 << 24 - t % 32, i[(t + 64 >> 9 << 4) + 15] = t, d = 0; d < i.length; d += 16) { for (r = e[0], s = e[1], a = e[2], o = e[3], c = e[4], u = e[5], l = e[6], f = e[7], g = 0; g < 64; g++) g < 16 ? n[g] = i[g + d] : n[g] = N(N(N(Yn(n[g - 2]), n[g - 7]), Zn(n[g - 15])), n[g - 16]), P = N(N(N(N(f, Qn(c)), Gn(c, u, l)), ti[g]), n[g]), m = N(Jn(r), $n(r, s, a)), f = l, l = u, u = c, c = N(o, P), o = a, a = s, s = r, r = N(P, m); e[0] = N(r, e[0]), e[1] = N(s, e[1]), e[2] = N(a, e[2]), e[3] = N(o, e[3]), e[4] = N(c, e[4]), e[5] = N(u, e[5]), e[6] = N(l, e[6]), e[7] = N(f, e[7]); } return e; } function N(i, t) { var e = (i & 65535) + (t & 65535), n = (i >> 16) + (t >> 16) + (e >> 16); return n << 16 | e & 65535; } function ni(i, t) { if (t < i.length + 22) return console.er