UNPKG

@triabin/vue-book-reader

Version:

Forked from jinhuan138/vue-book-reader, add some features

879 lines 77.2 kB
const Z = [0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535], nn = [96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115, 82, 7, 31, 0, 8, 112, 0, 8, 48, 0, 9, 192, 80, 7, 10, 0, 8, 96, 0, 8, 32, 0, 9, 160, 0, 8, 0, 0, 8, 128, 0, 8, 64, 0, 9, 224, 80, 7, 6, 0, 8, 88, 0, 8, 24, 0, 9, 144, 83, 7, 59, 0, 8, 120, 0, 8, 56, 0, 9, 208, 81, 7, 17, 0, 8, 104, 0, 8, 40, 0, 9, 176, 0, 8, 8, 0, 8, 136, 0, 8, 72, 0, 9, 240, 80, 7, 4, 0, 8, 84, 0, 8, 20, 85, 8, 227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9, 200, 81, 7, 13, 0, 8, 100, 0, 8, 36, 0, 9, 168, 0, 8, 4, 0, 8, 132, 0, 8, 68, 0, 9, 232, 80, 7, 8, 0, 8, 92, 0, 8, 28, 0, 9, 152, 84, 7, 83, 0, 8, 124, 0, 8, 60, 0, 9, 216, 82, 7, 23, 0, 8, 108, 0, 8, 44, 0, 9, 184, 0, 8, 12, 0, 8, 140, 0, 8, 76, 0, 9, 248, 80, 7, 3, 0, 8, 82, 0, 8, 18, 85, 8, 163, 83, 7, 35, 0, 8, 114, 0, 8, 50, 0, 9, 196, 81, 7, 11, 0, 8, 98, 0, 8, 34, 0, 9, 164, 0, 8, 2, 0, 8, 130, 0, 8, 66, 0, 9, 228, 80, 7, 7, 0, 8, 90, 0, 8, 26, 0, 9, 148, 84, 7, 67, 0, 8, 122, 0, 8, 58, 0, 9, 212, 82, 7, 19, 0, 8, 106, 0, 8, 42, 0, 9, 180, 0, 8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 244, 80, 7, 5, 0, 8, 86, 0, 8, 22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54, 0, 9, 204, 81, 7, 15, 0, 8, 102, 0, 8, 38, 0, 9, 172, 0, 8, 6, 0, 8, 134, 0, 8, 70, 0, 9, 236, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9, 156, 84, 7, 99, 0, 8, 126, 0, 8, 62, 0, 9, 220, 82, 7, 27, 0, 8, 110, 0, 8, 46, 0, 9, 188, 0, 8, 14, 0, 8, 142, 0, 8, 78, 0, 9, 252, 96, 7, 256, 0, 8, 81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0, 8, 113, 0, 8, 49, 0, 9, 194, 80, 7, 10, 0, 8, 97, 0, 8, 33, 0, 9, 162, 0, 8, 1, 0, 8, 129, 0, 8, 65, 0, 9, 226, 80, 7, 6, 0, 8, 89, 0, 8, 25, 0, 9, 146, 83, 7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 210, 81, 7, 17, 0, 8, 105, 0, 8, 41, 0, 9, 178, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9, 242, 80, 7, 4, 0, 8, 85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8, 117, 0, 8, 53, 0, 9, 202, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9, 170, 0, 8, 5, 0, 8, 133, 0, 8, 69, 0, 9, 234, 80, 7, 8, 0, 8, 93, 0, 8, 29, 0, 9, 154, 84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 218, 82, 7, 23, 0, 8, 109, 0, 8, 45, 0, 9, 186, 0, 8, 13, 0, 8, 141, 0, 8, 77, 0, 9, 250, 80, 7, 3, 0, 8, 83, 0, 8, 19, 85, 8, 195, 83, 7, 35, 0, 8, 115, 0, 8, 51, 0, 9, 198, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0, 9, 166, 0, 8, 3, 0, 8, 131, 0, 8, 67, 0, 9, 230, 80, 7, 7, 0, 8, 91, 0, 8, 27, 0, 9, 150, 84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 214, 82, 7, 19, 0, 8, 107, 0, 8, 43, 0, 9, 182, 0, 8, 11, 0, 8, 139, 0, 8, 75, 0, 9, 246, 80, 7, 5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7, 51, 0, 8, 119, 0, 8, 55, 0, 9, 206, 81, 7, 15, 0, 8, 103, 0, 8, 39, 0, 9, 174, 0, 8, 7, 0, 8, 135, 0, 8, 71, 0, 9, 238, 80, 7, 9, 0, 8, 95, 0, 8, 31, 0, 9, 158, 84, 7, 99, 0, 8, 127, 0, 8, 63, 0, 9, 222, 82, 7, 27, 0, 8, 111, 0, 8, 47, 0, 9, 190, 0, 8, 15, 0, 8, 143, 0, 8, 79, 0, 9, 254, 96, 7, 256, 0, 8, 80, 0, 8, 16, 84, 8, 115, 82, 7, 31, 0, 8, 112, 0, 8, 48, 0, 9, 193, 80, 7, 10, 0, 8, 96, 0, 8, 32, 0, 9, 161, 0, 8, 0, 0, 8, 128, 0, 8, 64, 0, 9, 225, 80, 7, 6, 0, 8, 88, 0, 8, 24, 0, 9, 145, 83, 7, 59, 0, 8, 120, 0, 8, 56, 0, 9, 209, 81, 7, 17, 0, 8, 104, 0, 8, 40, 0, 9, 177, 0, 8, 8, 0, 8, 136, 0, 8, 72, 0, 9, 241, 80, 7, 4, 0, 8, 84, 0, 8, 20, 85, 8, 227, 83, 7, 43, 0, 8, 116, 0, 8, 52, 0, 9, 201, 81, 7, 13, 0, 8, 100, 0, 8, 36, 0, 9, 169, 0, 8, 4, 0, 8, 132, 0, 8, 68, 0, 9, 233, 80, 7, 8, 0, 8, 92, 0, 8, 28, 0, 9, 153, 84, 7, 83, 0, 8, 124, 0, 8, 60, 0, 9, 217, 82, 7, 23, 0, 8, 108, 0, 8, 44, 0, 9, 185, 0, 8, 12, 0, 8, 140, 0, 8, 76, 0, 9, 249, 80, 7, 3, 0, 8, 82, 0, 8, 18, 85, 8, 163, 83, 7, 35, 0, 8, 114, 0, 8, 50, 0, 9, 197, 81, 7, 11, 0, 8, 98, 0, 8, 34, 0, 9, 165, 0, 8, 2, 0, 8, 130, 0, 8, 66, 0, 9, 229, 80, 7, 7, 0, 8, 90, 0, 8, 26, 0, 9, 149, 84, 7, 67, 0, 8, 122, 0, 8, 58, 0, 9, 213, 82, 7, 19, 0, 8, 106, 0, 8, 42, 0, 9, 181, 0, 8, 10, 0, 8, 138, 0, 8, 74, 0, 9, 245, 80, 7, 5, 0, 8, 86, 0, 8, 22, 192, 8, 0, 83, 7, 51, 0, 8, 118, 0, 8, 54, 0, 9, 205, 81, 7, 15, 0, 8, 102, 0, 8, 38, 0, 9, 173, 0, 8, 6, 0, 8, 134, 0, 8, 70, 0, 9, 237, 80, 7, 9, 0, 8, 94, 0, 8, 30, 0, 9, 157, 84, 7, 99, 0, 8, 126, 0, 8, 62, 0, 9, 221, 82, 7, 27, 0, 8, 110, 0, 8, 46, 0, 9, 189, 0, 8, 14, 0, 8, 142, 0, 8, 78, 0, 9, 253, 96, 7, 256, 0, 8, 81, 0, 8, 17, 85, 8, 131, 82, 7, 31, 0, 8, 113, 0, 8, 49, 0, 9, 195, 80, 7, 10, 0, 8, 97, 0, 8, 33, 0, 9, 163, 0, 8, 1, 0, 8, 129, 0, 8, 65, 0, 9, 227, 80, 7, 6, 0, 8, 89, 0, 8, 25, 0, 9, 147, 83, 7, 59, 0, 8, 121, 0, 8, 57, 0, 9, 211, 81, 7, 17, 0, 8, 105, 0, 8, 41, 0, 9, 179, 0, 8, 9, 0, 8, 137, 0, 8, 73, 0, 9, 243, 80, 7, 4, 0, 8, 85, 0, 8, 21, 80, 8, 258, 83, 7, 43, 0, 8, 117, 0, 8, 53, 0, 9, 203, 81, 7, 13, 0, 8, 101, 0, 8, 37, 0, 9, 171, 0, 8, 5, 0, 8, 133, 0, 8, 69, 0, 9, 235, 80, 7, 8, 0, 8, 93, 0, 8, 29, 0, 9, 155, 84, 7, 83, 0, 8, 125, 0, 8, 61, 0, 9, 219, 82, 7, 23, 0, 8, 109, 0, 8, 45, 0, 9, 187, 0, 8, 13, 0, 8, 141, 0, 8, 77, 0, 9, 251, 80, 7, 3, 0, 8, 83, 0, 8, 19, 85, 8, 195, 83, 7, 35, 0, 8, 115, 0, 8, 51, 0, 9, 199, 81, 7, 11, 0, 8, 99, 0, 8, 35, 0, 9, 167, 0, 8, 3, 0, 8, 131, 0, 8, 67, 0, 9, 231, 80, 7, 7, 0, 8, 91, 0, 8, 27, 0, 9, 151, 84, 7, 67, 0, 8, 123, 0, 8, 59, 0, 9, 215, 82, 7, 19, 0, 8, 107, 0, 8, 43, 0, 9, 183, 0, 8, 11, 0, 8, 139, 0, 8, 75, 0, 9, 247, 80, 7, 5, 0, 8, 87, 0, 8, 23, 192, 8, 0, 83, 7, 51, 0, 8, 119, 0, 8, 55, 0, 9, 207, 81, 7, 15, 0, 8, 103, 0, 8, 39, 0, 9, 175, 0, 8, 7, 0, 8, 135, 0, 8, 71, 0, 9, 239, 80, 7, 9, 0, 8, 95, 0, 8, 31, 0, 9, 159, 84, 7, 99, 0, 8, 127, 0, 8, 63, 0, 9, 223, 82, 7, 27, 0, 8, 111, 0, 8, 47, 0, 9, 191, 0, 8, 15, 0, 8, 143, 0, 8, 79, 0, 9, 255], rn = [80, 5, 1, 87, 5, 257, 83, 5, 17, 91, 5, 4097, 81, 5, 5, 89, 5, 1025, 85, 5, 65, 93, 5, 16385, 80, 5, 3, 88, 5, 513, 84, 5, 33, 92, 5, 8193, 82, 5, 9, 90, 5, 2049, 86, 5, 129, 192, 5, 24577, 80, 5, 2, 87, 5, 385, 83, 5, 25, 91, 5, 6145, 81, 5, 7, 89, 5, 1537, 85, 5, 97, 93, 5, 24577, 80, 5, 4, 88, 5, 769, 84, 5, 49, 92, 5, 12289, 82, 5, 13, 90, 5, 3073, 86, 5, 193, 192, 5, 24577], an = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], sn = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112], on = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], ln = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], be = 15; function Ce() { let n, t, e, r, a, l; function s(f, _, w, k, g, z, c, p, i, o, u) { let b, x, v, m, h, A, D, U, y, S, E, O, W, T, C; S = 0, h = w; do e[f[_ + S]]++, S++, h--; while (h !== 0); if (e[0] == w) return c[0] = -1, p[0] = 0, 0; for (U = p[0], A = 1; A <= be && e[A] === 0; A++) ; for (D = A, U < A && (U = A), h = be; h !== 0 && e[h] === 0; h--) ; for (v = h, U > h && (U = h), p[0] = U, T = 1 << A; A < h; A++, T <<= 1) if ((T -= e[A]) < 0) return -3; if ((T -= e[h]) < 0) return -3; for (e[h] += T, l[1] = A = 0, S = 1, W = 2; --h != 0; ) l[W] = A += e[S], W++, S++; h = 0, S = 0; do (A = f[_ + S]) !== 0 && (u[l[A]++] = h), S++; while (++h < w); for (w = l[v], l[0] = h = 0, S = 0, m = -1, O = -U, a[0] = 0, E = 0, C = 0; D <= v; D++) for (b = e[D]; b-- != 0; ) { for (; D > O + U; ) { if (m++, O += U, C = v - O, C = C > U ? U : C, (x = 1 << (A = D - O)) > b + 1 && (x -= b + 1, W = D, A < C)) for (; ++A < C && !((x <<= 1) <= e[++W]); ) x -= e[W]; if (C = 1 << A, o[0] + C > 1440) return -3; a[m] = E = o[0], o[0] += C, m !== 0 ? (l[m] = h, r[0] = A, r[1] = U, A = h >>> O - U, r[2] = E - a[m - 1] - A, i.set(r, 3 * (a[m - 1] + A))) : c[0] = E; } for (r[1] = D - O, S >= w ? r[0] = 192 : u[S] < k ? (r[0] = u[S] < 256 ? 0 : 96, r[2] = u[S++]) : (r[0] = z[u[S] - k] + 16 + 64, r[2] = g[u[S++] - k]), x = 1 << D - O, A = h >>> O; A < C; A += x) i.set(r, 3 * (E + A)); for (A = 1 << D - 1; h & A; A >>>= 1) h ^= A; for (h ^= A, y = (1 << O) - 1; (h & y) != l[m]; ) m--, O -= U, y = (1 << O) - 1; } return T !== 0 && v != 1 ? -5 : 0; } function d(f) { let _; for (n || (n = [], t = [], e = new Int32Array(16), r = [], a = new Int32Array(be), l = new Int32Array(16)), t.length < f && (t = []), _ = 0; _ < f; _++) t[_] = 0; for (_ = 0; _ < 16; _++) e[_] = 0; for (_ = 0; _ < 3; _++) r[_] = 0; a.set(e.subarray(0, be), 0), l.set(e.subarray(0, 16), 0); } this.inflate_trees_bits = function(f, _, w, k, g) { let z; return d(19), n[0] = 0, z = s(f, 0, 19, 19, null, null, w, _, k, n, t), z == -3 ? g.msg = "oversubscribed dynamic bit lengths tree" : z != -5 && _[0] !== 0 || (g.msg = "incomplete dynamic bit lengths tree", z = -3), z; }, this.inflate_trees_dynamic = function(f, _, w, k, g, z, c, p, i) { let o; return d(288), n[0] = 0, o = s(w, 0, f, 257, an, sn, z, k, p, n, t), o != 0 || k[0] === 0 ? (o == -3 ? i.msg = "oversubscribed literal/length tree" : o != -4 && (i.msg = "incomplete literal/length tree", o = -3), o) : (d(288), o = s(w, f, _, 0, on, ln, c, g, p, n, t), o != 0 || g[0] === 0 && f > 257 ? (o == -3 ? i.msg = "oversubscribed distance tree" : o == -5 ? (i.msg = "incomplete distance tree", o = -3) : o != -4 && (i.msg = "empty distance tree with lengths", o = -3), o) : 0); }; } Ce.inflate_trees_fixed = function(n, t, e, r) { return n[0] = 9, t[0] = 5, e[0] = nn, r[0] = rn, 0; }; function cn() { const n = this; let t, e, r, a, l = 0, s = 0, d = 0, f = 0, _ = 0, w = 0, k = 0, g = 0, z = 0, c = 0; function p(i, o, u, b, x, v, m, h) { let A, D, U, y, S, E, O, W, T, C, M, I, F, N, j, L; O = h.next_in_index, W = h.avail_in, S = m.bitb, E = m.bitk, T = m.write, C = T < m.read ? m.read - T - 1 : m.end - T, M = Z[i], I = Z[o]; do { for (; E < 20; ) W--, S |= (255 & h.read_byte(O++)) << E, E += 8; if (A = S & M, D = u, U = b, L = 3 * (U + A), (y = D[L]) !== 0) for (; ; ) { if (S >>= D[L + 1], E -= D[L + 1], 16 & y) { for (y &= 15, F = D[L + 2] + (S & Z[y]), S >>= y, E -= y; E < 15; ) W--, S |= (255 & h.read_byte(O++)) << E, E += 8; for (A = S & I, D = x, U = v, L = 3 * (U + A), y = D[L]; ; ) { if (S >>= D[L + 1], E -= D[L + 1], 16 & y) { for (y &= 15; E < y; ) W--, S |= (255 & h.read_byte(O++)) << E, E += 8; if (N = D[L + 2] + (S & Z[y]), S >>= y, E -= y, C -= F, T >= N) j = T - N, T - j > 0 && 2 > T - j ? (m.win[T++] = m.win[j++], m.win[T++] = m.win[j++], F -= 2) : (m.win.set(m.win.subarray(j, j + 2), T), T += 2, j += 2, F -= 2); else { j = T - N; do j += m.end; while (j < 0); if (y = m.end - j, F > y) { if (F -= y, T - j > 0 && y > T - j) do m.win[T++] = m.win[j++]; while (--y != 0); else m.win.set(m.win.subarray(j, j + y), T), T += y, j += y, y = 0; j = 0; } } if (T - j > 0 && F > T - j) do m.win[T++] = m.win[j++]; while (--F != 0); else m.win.set(m.win.subarray(j, j + F), T), T += F, j += F, F = 0; break; } if (64 & y) return h.msg = "invalid distance code", F = h.avail_in - W, F = E >> 3 < F ? E >> 3 : F, W += F, O -= F, E -= F << 3, m.bitb = S, m.bitk = E, h.avail_in = W, h.total_in += O - h.next_in_index, h.next_in_index = O, m.write = T, -3; A += D[L + 2], A += S & Z[y], L = 3 * (U + A), y = D[L]; } break; } if (64 & y) return 32 & y ? (F = h.avail_in - W, F = E >> 3 < F ? E >> 3 : F, W += F, O -= F, E -= F << 3, m.bitb = S, m.bitk = E, h.avail_in = W, h.total_in += O - h.next_in_index, h.next_in_index = O, m.write = T, 1) : (h.msg = "invalid literal/length code", F = h.avail_in - W, F = E >> 3 < F ? E >> 3 : F, W += F, O -= F, E -= F << 3, m.bitb = S, m.bitk = E, h.avail_in = W, h.total_in += O - h.next_in_index, h.next_in_index = O, m.write = T, -3); if (A += D[L + 2], A += S & Z[y], L = 3 * (U + A), (y = D[L]) === 0) { S >>= D[L + 1], E -= D[L + 1], m.win[T++] = D[L + 2], C--; break; } } else S >>= D[L + 1], E -= D[L + 1], m.win[T++] = D[L + 2], C--; } while (C >= 258 && W >= 10); return F = h.avail_in - W, F = E >> 3 < F ? E >> 3 : F, W += F, O -= F, E -= F << 3, m.bitb = S, m.bitk = E, h.avail_in = W, h.total_in += O - h.next_in_index, h.next_in_index = O, m.write = T, 0; } n.init = function(i, o, u, b, x, v) { t = 0, k = i, g = o, r = u, z = b, a = x, c = v, e = null; }, n.proc = function(i, o, u) { let b, x, v, m, h, A, D, U = 0, y = 0, S = 0; for (S = o.next_in_index, m = o.avail_in, U = i.bitb, y = i.bitk, h = i.write, A = h < i.read ? i.read - h - 1 : i.end - h; ; ) switch (t) { case 0: if (A >= 258 && m >= 10 && (i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, u = p(k, g, r, z, a, c, i, o), S = o.next_in_index, m = o.avail_in, U = i.bitb, y = i.bitk, h = i.write, A = h < i.read ? i.read - h - 1 : i.end - h, u != 0)) { t = u == 1 ? 7 : 9; break; } d = k, e = r, s = z, t = 1; case 1: for (b = d; y < b; ) { if (m === 0) return i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); u = 0, m--, U |= (255 & o.read_byte(S++)) << y, y += 8; } if (x = 3 * (s + (U & Z[b])), U >>>= e[x + 1], y -= e[x + 1], v = e[x], v === 0) { f = e[x + 2], t = 6; break; } if (16 & v) { _ = 15 & v, l = e[x + 2], t = 2; break; } if (!(64 & v)) { d = v, s = x / 3 + e[x + 2]; break; } if (32 & v) { t = 7; break; } return t = 9, o.msg = "invalid literal/length code", u = -3, i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); case 2: for (b = _; y < b; ) { if (m === 0) return i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); u = 0, m--, U |= (255 & o.read_byte(S++)) << y, y += 8; } l += U & Z[b], U >>= b, y -= b, d = g, e = a, s = c, t = 3; case 3: for (b = d; y < b; ) { if (m === 0) return i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); u = 0, m--, U |= (255 & o.read_byte(S++)) << y, y += 8; } if (x = 3 * (s + (U & Z[b])), U >>= e[x + 1], y -= e[x + 1], v = e[x], 16 & v) { _ = 15 & v, w = e[x + 2], t = 4; break; } if (!(64 & v)) { d = v, s = x / 3 + e[x + 2]; break; } return t = 9, o.msg = "invalid distance code", u = -3, i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); case 4: for (b = _; y < b; ) { if (m === 0) return i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); u = 0, m--, U |= (255 & o.read_byte(S++)) << y, y += 8; } w += U & Z[b], U >>= b, y -= b, t = 5; case 5: for (D = h - w; D < 0; ) D += i.end; for (; l !== 0; ) { if (A === 0 && (h == i.end && i.read !== 0 && (h = 0, A = h < i.read ? i.read - h - 1 : i.end - h), A === 0 && (i.write = h, u = i.inflate_flush(o, u), h = i.write, A = h < i.read ? i.read - h - 1 : i.end - h, h == i.end && i.read !== 0 && (h = 0, A = h < i.read ? i.read - h - 1 : i.end - h), A === 0))) return i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); i.win[h++] = i.win[D++], A--, D == i.end && (D = 0), l--; } t = 0; break; case 6: if (A === 0 && (h == i.end && i.read !== 0 && (h = 0, A = h < i.read ? i.read - h - 1 : i.end - h), A === 0 && (i.write = h, u = i.inflate_flush(o, u), h = i.write, A = h < i.read ? i.read - h - 1 : i.end - h, h == i.end && i.read !== 0 && (h = 0, A = h < i.read ? i.read - h - 1 : i.end - h), A === 0))) return i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); u = 0, i.win[h++] = f, A--, t = 0; break; case 7: if (y > 7 && (y -= 8, m++, S--), i.write = h, u = i.inflate_flush(o, u), h = i.write, A = h < i.read ? i.read - h - 1 : i.end - h, i.read != i.write) return i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); t = 8; case 8: return u = 1, i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); case 9: return u = -3, i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); default: return u = -2, i.bitb = U, i.bitk = y, o.avail_in = m, o.total_in += S - o.next_in_index, o.next_in_index = S, i.write = h, i.inflate_flush(o, u); } }, n.free = function() { }; } const Qe = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]; function un(n, t) { const e = this; let r, a = 0, l = 0, s = 0, d = 0; const f = [0], _ = [0], w = new cn(); let k = 0, g = new Int32Array(4320); const z = new Ce(); e.bitk = 0, e.bitb = 0, e.win = new Uint8Array(t), e.end = t, e.read = 0, e.write = 0, e.reset = function(c, p) { p && (p[0] = 0), a == 6 && w.free(c), a = 0, e.bitk = 0, e.bitb = 0, e.read = e.write = 0; }, e.reset(n, null), e.inflate_flush = function(c, p) { let i, o, u; return o = c.next_out_index, u = e.read, i = (u <= e.write ? e.write : e.end) - u, i > c.avail_out && (i = c.avail_out), i !== 0 && p == -5 && (p = 0), c.avail_out -= i, c.total_out += i, c.next_out.set(e.win.subarray(u, u + i), o), o += i, u += i, u == e.end && (u = 0, e.write == e.end && (e.write = 0), i = e.write - u, i > c.avail_out && (i = c.avail_out), i !== 0 && p == -5 && (p = 0), c.avail_out -= i, c.total_out += i, c.next_out.set(e.win.subarray(u, u + i), o), o += i, u += i), c.next_out_index = o, e.read = u, p; }, e.proc = function(c, p) { let i, o, u, b, x, v, m, h; for (b = c.next_in_index, x = c.avail_in, o = e.bitb, u = e.bitk, v = e.write, m = v < e.read ? e.read - v - 1 : e.end - v; ; ) { let A, D, U, y, S, E, O, W; switch (a) { case 0: for (; u < 3; ) { if (x === 0) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); p = 0, x--, o |= (255 & c.read_byte(b++)) << u, u += 8; } switch (i = 7 & o, k = 1 & i, i >>> 1) { case 0: o >>>= 3, u -= 3, i = 7 & u, o >>>= i, u -= i, a = 1; break; case 1: A = [], D = [], U = [[]], y = [[]], Ce.inflate_trees_fixed(A, D, U, y), w.init(A[0], D[0], U[0], 0, y[0], 0), o >>>= 3, u -= 3, a = 6; break; case 2: o >>>= 3, u -= 3, a = 3; break; case 3: return o >>>= 3, u -= 3, a = 9, c.msg = "invalid block type", p = -3, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); } break; case 1: for (; u < 32; ) { if (x === 0) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); p = 0, x--, o |= (255 & c.read_byte(b++)) << u, u += 8; } if ((~o >>> 16 & 65535) != (65535 & o)) return a = 9, c.msg = "invalid stored block lengths", p = -3, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); l = 65535 & o, o = u = 0, a = l !== 0 ? 2 : k !== 0 ? 7 : 0; break; case 2: if (x === 0 || m === 0 && (v == e.end && e.read !== 0 && (v = 0, m = v < e.read ? e.read - v - 1 : e.end - v), m === 0 && (e.write = v, p = e.inflate_flush(c, p), v = e.write, m = v < e.read ? e.read - v - 1 : e.end - v, v == e.end && e.read !== 0 && (v = 0, m = v < e.read ? e.read - v - 1 : e.end - v), m === 0))) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); if (p = 0, i = l, i > x && (i = x), i > m && (i = m), e.win.set(c.read_buf(b, i), v), b += i, x -= i, v += i, m -= i, (l -= i) != 0) break; a = k !== 0 ? 7 : 0; break; case 3: for (; u < 14; ) { if (x === 0) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); p = 0, x--, o |= (255 & c.read_byte(b++)) << u, u += 8; } if (s = i = 16383 & o, (31 & i) > 29 || (i >> 5 & 31) > 29) return a = 9, c.msg = "too many length or distance symbols", p = -3, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); if (i = 258 + (31 & i) + (i >> 5 & 31), !r || r.length < i) r = []; else for (h = 0; h < i; h++) r[h] = 0; o >>>= 14, u -= 14, d = 0, a = 4; case 4: for (; d < 4 + (s >>> 10); ) { for (; u < 3; ) { if (x === 0) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); p = 0, x--, o |= (255 & c.read_byte(b++)) << u, u += 8; } r[Qe[d++]] = 7 & o, o >>>= 3, u -= 3; } for (; d < 19; ) r[Qe[d++]] = 0; if (f[0] = 7, i = z.inflate_trees_bits(r, f, _, g, c), i != 0) return (p = i) == -3 && (r = null, a = 9), e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); d = 0, a = 5; case 5: for (; i = s, !(d >= 258 + (31 & i) + (i >> 5 & 31)); ) { let T, C; for (i = f[0]; u < i; ) { if (x === 0) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); p = 0, x--, o |= (255 & c.read_byte(b++)) << u, u += 8; } if (i = g[3 * (_[0] + (o & Z[i])) + 1], C = g[3 * (_[0] + (o & Z[i])) + 2], C < 16) o >>>= i, u -= i, r[d++] = C; else { for (h = C == 18 ? 7 : C - 14, T = C == 18 ? 11 : 3; u < i + h; ) { if (x === 0) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); p = 0, x--, o |= (255 & c.read_byte(b++)) << u, u += 8; } if (o >>>= i, u -= i, T += o & Z[h], o >>>= h, u -= h, h = d, i = s, h + T > 258 + (31 & i) + (i >> 5 & 31) || C == 16 && h < 1) return r = null, a = 9, c.msg = "invalid bit length repeat", p = -3, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); C = C == 16 ? r[h - 1] : 0; do r[h++] = C; while (--T != 0); d = h; } } if (_[0] = -1, S = [], E = [], O = [], W = [], S[0] = 9, E[0] = 6, i = s, i = z.inflate_trees_dynamic(257 + (31 & i), 1 + (i >> 5 & 31), r, S, E, O, W, g, c), i != 0) return i == -3 && (r = null, a = 9), p = i, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); w.init(S[0], E[0], g, O[0], g, W[0]), a = 6; case 6: if (e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, (p = w.proc(e, c, p)) != 1) return e.inflate_flush(c, p); if (p = 0, w.free(c), b = c.next_in_index, x = c.avail_in, o = e.bitb, u = e.bitk, v = e.write, m = v < e.read ? e.read - v - 1 : e.end - v, k === 0) { a = 0; break; } a = 7; case 7: if (e.write = v, p = e.inflate_flush(c, p), v = e.write, m = v < e.read ? e.read - v - 1 : e.end - v, e.read != e.write) return e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); a = 8; case 8: return p = 1, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); case 9: return p = -3, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); default: return p = -2, e.bitb = o, e.bitk = u, c.avail_in = x, c.total_in += b - c.next_in_index, c.next_in_index = b, e.write = v, e.inflate_flush(c, p); } } }, e.free = function(c) { e.reset(c, null), e.win = null, g = null; }, e.set_dictionary = function(c, p, i) { e.win.set(c.subarray(p, p + i), 0), e.read = e.write = i; }, e.sync_point = function() { return a == 1 ? 1 : 0; }; } const X = 13, fn = [0, 0, 255, 255]; function dn() { const n = this; function t(e) { return e && e.istate ? (e.total_in = e.total_out = 0, e.msg = null, e.istate.mode = 7, e.istate.blocks.reset(e, null), 0) : -2; } n.mode = 0, n.method = 0, n.was = [0], n.need = 0, n.marker = 0, n.wbits = 0, n.inflateEnd = function(e) { return n.blocks && n.blocks.free(e), n.blocks = null, 0; }, n.inflateInit = function(e, r) { return e.msg = null, n.blocks = null, r < 8 || r > 15 ? (n.inflateEnd(e), -2) : (n.wbits = r, e.istate.blocks = new un(e, 1 << r), t(e), 0); }, n.inflate = function(e, r) { let a, l; if (!e || !e.istate || !e.next_in) return -2; const s = e.istate; for (r = r == 4 ? -5 : 0, a = -5; ; ) switch (s.mode) { case 0: if (e.avail_in === 0) return a; if (a = r, e.avail_in--, e.total_in++, (15 & (s.method = e.read_byte(e.next_in_index++))) != 8) { s.mode = X, e.msg = "unknown compression method", s.marker = 5; break; } if (8 + (s.method >> 4) > s.wbits) { s.mode = X, e.msg = "invalid win size", s.marker = 5; break; } s.mode = 1; case 1: if (e.avail_in === 0) return a; if (a = r, e.avail_in--, e.total_in++, l = 255 & e.read_byte(e.next_in_index++), ((s.method << 8) + l) % 31 != 0) { s.mode = X, e.msg = "incorrect header check", s.marker = 5; break; } if (!(32 & l)) { s.mode = 7; break; } s.mode = 2; case 2: if (e.avail_in === 0) return a; a = r, e.avail_in--, e.total_in++, s.need = (255 & e.read_byte(e.next_in_index++)) << 24 & 4278190080, s.mode = 3; case 3: if (e.avail_in === 0) return a; a = r, e.avail_in--, e.total_in++, s.need += (255 & e.read_byte(e.next_in_index++)) << 16 & 16711680, s.mode = 4; case 4: if (e.avail_in === 0) return a; a = r, e.avail_in--, e.total_in++, s.need += (255 & e.read_byte(e.next_in_index++)) << 8 & 65280, s.mode = 5; case 5: return e.avail_in === 0 ? a : (a = r, e.avail_in--, e.total_in++, s.need += 255 & e.read_byte(e.next_in_index++), s.mode = 6, 2); case 6: return s.mode = X, e.msg = "need dictionary", s.marker = 0, -2; case 7: if (a = s.blocks.proc(e, a), a == -3) { s.mode = X, s.marker = 0; break; } if (a == 0 && (a = r), a != 1) return a; a = r, s.blocks.reset(e, s.was), s.mode = 12; case 12: return e.avail_in = 0, 1; case X: return -3; default: return -2; } }, n.inflateSetDictionary = function(e, r, a) { let l = 0, s = a; if (!e || !e.istate || e.istate.mode != 6) return -2; const d = e.istate; return s >= 1 << d.wbits && (s = (1 << d.wbits) - 1, l = a - s), d.blocks.set_dictionary(r, l, s), d.mode = 7, 0; }, n.inflateSync = function(e) { let r, a, l, s, d; if (!e || !e.istate) return -2; const f = e.istate; if (f.mode != X && (f.mode = X, f.marker = 0), (r = e.avail_in) === 0) return -5; for (a = e.next_in_index, l = f.marker; r !== 0 && l < 4; ) e.read_byte(a) == fn[l] ? l++ : l = e.read_byte(a) !== 0 ? 0 : 4 - l, a++, r--; return e.total_in += a - e.next_in_index, e.next_in_index = a, e.avail_in = r, f.marker = l, l != 4 ? -3 : (s = e.total_in, d = e.total_out, t(e), e.total_in = s, e.total_out = d, f.mode = 7, 0); }, n.inflateSyncPoint = function(e) { return e && e.istate && e.istate.blocks ? e.istate.blocks.sync_point() : -2; }; } function xt() { } xt.prototype = { inflateInit(n) { const t = this; return t.istate = new dn(), n || (n = 15), t.istate.inflateInit(t, n); }, inflate(n) { const t = this; return t.istate ? t.istate.inflate(t, n) : -2; }, inflateEnd() { const n = this; if (!n.istate) return -2; const t = n.istate.inflateEnd(n); return n.istate = null, t; }, inflateSync() { const n = this; return n.istate ? n.istate.inflateSync(n) : -2; }, inflateSetDictionary(n, t) { const e = this; return e.istate ? e.istate.inflateSetDictionary(e, n, t) : -2; }, read_byte(n) { return this.next_in[n]; }, read_buf(n, t) { return this.next_in.subarray(n, n + t); } }; const ie = 4294967295, re = 65535, Xe = 33639248, Ye = 101075792, ae = 22, V = void 0, te = "undefined", _e = "function"; class $e { constructor(t) { return class extends TransformStream { constructor(e, r) { const a = new t(r); super({ transform(l, s) { s.enqueue(a.append(l)); }, flush(l) { const s = a.flush(); s && l.enqueue(s); } }); } }; } } let yt = 2; try { typeof navigator != te && navigator.hardwareConcurrency && (yt = navigator.hardwareConcurrency); } catch { } const hn = { chunkSize: 524288, maxWorkers: yt, terminateWorkerTimeout: 5e3, useWebWorkers: !0, useCompressionStream: !0, workerScripts: V, CompressionStreamNative: typeof CompressionStream != te && CompressionStream, DecompressionStreamNative: typeof DecompressionStream != te && DecompressionStream }, ee = Object.assign({}, hn); function _n(n) { const { baseURL: t, chunkSize: e, maxWorkers: r, terminateWorkerTimeout: a, useCompressionStream: l, useWebWorkers: s, Deflate: d, Inflate: f, CompressionStream: _, DecompressionStream: w, workerScripts: k } = n; if (Y("baseURL", t), Y("chunkSize", e), Y("maxWorkers", r), Y("terminateWorkerTimeout", a), Y("useCompressionStream", l), Y("useWebWorkers", s), d && (ee.CompressionStream = new $e(d)), f && (ee.DecompressionStream = new $e(f)), Y("CompressionStream", _), Y("DecompressionStream", w), k !== V) { const { deflate: g, inflate: z } = k; if ((g || z) && (ee.workerScripts || (ee.workerScripts = {})), g) { if (!Array.isArray(g)) throw new Error("workerScripts.deflate must be an array"); ee.workerScripts.deflate = g; } if (z) { if (!Array.isArray(z)) throw new Error("workerScripts.inflate must be an array"); ee.workerScripts.inflate = z; } } } function Y(n, t) { t !== V && (ee[n] = t); } const gt = []; for (let n = 0; n < 256; n++) { let t = n; for (let e = 0; e < 8; e++) 1 & t ? t = t >>> 1 ^ 3988292384 : t >>>= 1; gt[n] = t; } class ye { constructor(t) { this.crc = t || -1; } append(t) { let e = 0 | this.crc; for (let r = 0, a = 0 | t.length; r < a; r++) e = e >>> 8 ^ gt[255 & (e ^ t[r])]; this.crc = e; } get() { return ~this.crc; } } class kt extends TransformStream { constructor() { let t; const e = new ye(); super({ transform(r, a) { e.append(r), a.enqueue(r); }, flush() { const r = new Uint8Array(4); new DataView(r.buffer).setUint32(0, e.get()), t.value = r; } }), t = this; } } const K = { concat(n, t) { if (n.length === 0 || t.length === 0) return n.concat(t); const e = n[n.length - 1], r = K.getPartial(e); return r === 32 ? n.concat(t) : K._shiftRight(t, r, 0 | e, n.slice(0, n.length - 1)); }, bitLength(n) { const t = n.length; if (t === 0) return 0; const e = n[t - 1]; return 32 * (t - 1) + K.getPartial(e); }, clamp(n, t) { if (32 * n.length < t) return n; const e = (n = n.slice(0, Math.ceil(t / 32))).length; return t &= 31, e > 0 && t && (n[e - 1] = K.partial(t, n[e - 1] & 2147483648 >> t - 1, 1)), n; }, partial: (n, t, e) => n === 32 ? t : (e ? 0 | t : t << 32 - n) + 1099511627776 * n, getPartial: (n) => Math.round(n / 1099511627776) || 32, _shiftRight(n, t, e, r) { for (r === void 0 && (r = []); t >= 32; t -= 32) r.push(e), e = 0; if (t === 0) return r.concat(n); for (let s = 0; s < n.length; s++) r.push(e | n[s] >>> t), e = n[s] << 32 - t; const a = n.length ? n[n.length - 1] : 0, l = K.getPartial(a); return r.push(K.partial(t + l & 31, t + l > 32 ? e : r.pop(), 1)), r; } }, ge = { bytes: { fromBits(n) { const t = K.bitLength(n) / 8, e = new Uint8Array(t); let r; for (let a = 0; a < t; a++) 3 & a || (r = n[a / 4]), e[a] = r >>> 24, r <<= 8; return e; }, toBits(n) { const t = []; let e, r = 0; for (e = 0; e < n.length; e++) r = r << 8 | n[e], 3 & ~e || (t.push(r), r = 0); return 3 & e && t.push(K.partial(8 * (3 & e), r)), t; } } }, wn = { sha1: class { constructor(n) { const t = this; t.blockSize = 512, t._init = [1732584193, 4023233417, 2562383102, 271733878, 3285377520], t._key = [1518500249, 1859775393, 2400959708, 3395469782], n ? (t._h = n._h.slice(0), t._buffer = n._buffer.slice(0), t._length = n._length) : t.reset(); } reset() { const n = this; return n._h = n._init.slice(0), n._buffer = [], n._length = 0, n; } update(n) { const t = this; typeof n == "string" && (n = ge.utf8String.toBits(n)); const e = t._buffer = K.concat(t._buffer, n), r = t._length, a = t._length = r + K.bitLength(n); if (a > 9007199254740991) throw new Error("Cannot hash more than 2^53 - 1 bits"); const l = new Uint32Array(e); let s = 0; for (let d = t.blockSize + r - (t.blockSize + r & t.blockSize - 1); d <= a; d += t.blockSize) t._block(l.subarray(16 * s, 16 * (s + 1))), s += 1; return e.splice(0, 16 * s), t; } finalize() { const n = this; let t = n._buffer; const e = n._h; t = K.concat(t, [K.partial(1, 1)]); for (let r = t.length + 2; 15 & r; r++) t.push(0); for (t.push(Math.floor(n._length / 4294967296)), t.push(0 | n._length); t.length; ) n._block(t.splice(0, 16)); return n.reset(), e; } _f(n, t, e, r) { return n <= 19 ? t & e | ~t & r : n <= 39 ? t ^ e ^ r : n <= 59 ? t & e | t & r | e & r : n <= 79 ? t ^ e ^ r : void 0; } _S(n, t) { return t << n | t >>> 32 - n; } _block(n) { const t = this, e = t._h, r = Array(80); for (let _ = 0; _ < 16; _++) r[_] = n[_]; let a = e[0], l = e[1], s = e[2], d = e[3], f = e[4]; for (let _ = 0; _ <= 79; _++) { _ >= 16 && (r[_] = t._S(1, r[_ - 3] ^ r[_ - 8] ^ r[_ - 14] ^ r[_ - 16])); const w = t._S(5, a) + t._f(_, l, s, d) + f + r[_] + t._key[Math.floor(_ / 20)] | 0; f = d, d = s, s = t._S(30, l), l = a, a = w; } e[0] = e[0] + a | 0, e[1] = e[1] + l | 0, e[2] = e[2] + s | 0, e[3] = e[3] + d | 0, e[4] = e[4] + f | 0; } } }, bn = { aes: class { constructor(n) { const t = this; t._tables = [[[], [], [], [], []], [[], [], [], [], []]], t._tables[0][0][0] || t._precompute(); const e = t._tables[0][4], r = t._tables[1], a = n.length; let l, s, d, f = 1; if (a !== 4 && a !== 6 && a !== 8) throw new Error("invalid aes key size"); for (t._key = [s = n.slice(0), d = []], l = a; l < 4 * a + 28; l++) { let _ = s[l - 1]; (l % a == 0 || a === 8 && l % a == 4) && (_ = e[_ >>> 24] << 24 ^ e[_ >> 16 & 255] << 16 ^ e[_ >> 8 & 255] << 8 ^ e[255 & _], l % a == 0 && (_ = _ << 8 ^ _ >>> 24 ^ f << 24, f = f << 1 ^ 283 * (f >> 7))), s[l] = s[l - a] ^ _; } for (let _ = 0; l; _++, l--) { const w = s[3 & _ ? l : l - 4]; d[_] = l <= 4 || _ < 4 ? w : r[0][e[w >>> 24]] ^ r[1][e[w >> 16 & 255]] ^ r[2][e[w >> 8 & 255]] ^ r[3][e[255 & w]]; } } encrypt(n) { return this._crypt(n, 0); } decrypt(n) { return this._crypt(n, 1); } _precompute() { const n = this._tables[0], t = this._tables[1], e = n[4], r = t[4], a = [], l = []; let s, d, f, _; for (let w = 0; w < 256; w++) l[(a[w] = w << 1 ^ 283 * (w >> 7)) ^ w] = w; for (let w = s = 0; !e[w]; w ^= d || 1, s = l[s] || 1) { let k = s ^ s << 1 ^ s << 2 ^ s << 3 ^ s << 4; k = k >> 8 ^ 255 & k ^ 99, e[w] = k, r[k] = w, _ = a[f = a[d = a[w]]]; let g = 16843009 * _ ^ 65537 * f ^ 257 * d ^ 16843008 * w, z = 257 * a[k] ^ 16843008 * k; for (let c = 0; c < 4; c++) n[c][w] = z = z << 24 ^ z >>> 8, t[c][k] = g = g << 24 ^ g >>> 8; } for (let w = 0; w < 5; w++) n[w] = n[w].slice(0), t[w] = t[w].slice(0); } _crypt(n, t) { if (n.length !== 4) throw new Error("invalid aes block size"); const e = this._key[t], r = e.length / 4 - 2, a = [0, 0, 0, 0], l = this._tables[t], s = l[0], d = l[1], f = l[2], _ = l[3], w = l[4]; let k, g, z, c = n[0] ^ e[0], p = n[t ? 3 : 1] ^ e[1], i = n[2] ^ e[2], o = n[t ? 1 : 3] ^ e[3], u = 4; for (let b = 0; b < r; b++) k = s[c >>> 24] ^ d[p >> 16 & 255] ^ f[i >> 8 & 255] ^ _[255 & o] ^ e[u], g = s[p >>> 24] ^ d[i >> 16 & 255] ^ f[o >> 8 & 255] ^ _[255 & c] ^ e[u + 1], z = s[i >>> 24] ^ d[o >> 16 & 255] ^ f[c >> 8 & 255] ^ _[255 & p] ^ e[u + 2], o = s[o >>> 24] ^ d[c >> 16 & 255] ^ f[p >> 8 & 255] ^ _[255 & i] ^ e[u + 3], u += 4, c = k, p = g, i = z; for (let b = 0; b < 4; b++) a[t ? 3 & -b : b] = w[c >>> 24] << 24 ^ w[p >> 16 & 255] << 16 ^ w[i >> 8 & 255] << 8 ^ w[255 & o] ^ e[u++], k = c, c = p, p = i, i = o, o = k; return a; } } }, pn = { getRandomValues(n) { const t = new Uint32Array(n.buffer), e = (r) => { let a = 987654321; const l = 4294967295; return function() { return a = 36969 * (65535 & a) + (a >> 16) & l, (((a << 16) + (r = 18e3 * (65535 & r) + (r >> 16) & l) & l) / 4294967296 + 0.5) * (Math.random() > 0.5 ? 1 : -1); }; }; for (let r, a = 0; a < n.length; a += 4) { const l = e(4294967296 * (r || Math.random())); r = 987654071 * l(), t[a / 4] = 4294967296 * l() | 0; } return n; } }, mn = { ctrGladman: class { constructor(n, t) { this._prf = n, this._initIv = t, this._iv = t; } reset() { this._iv = this._initIv; } update(n) { return this.calculate(this._prf, n, this._iv); } incWord(n) { if (255 & ~(n >> 24)) n += 1 << 24; else { let t = n >> 16 & 255, e = n >> 8 & 255, r = 255 & n; t === 255 ? (t = 0, e === 255 ? (e = 0, r === 255 ? r = 0 : ++r) : ++e) : ++t, n = 0, n += t << 16, n += e << 8, n += r; } return n; } incCounter(n) { (n[0] = this.incWord(n[0])) === 0 && (n[1] = this.incWord(n[1])); } calculate(n, t, e) { let r; if (!(r = t.length)) return []; const a = K.bitLength(t); for (let l = 0; l < r; l += 4) { this.incCounter(e); const s = n.encrypt(e); t[l] ^= s[0], t[l + 1] ^= s[1], t[l + 2] ^= s[2], t[l + 3] ^= s[3]; } return K.clamp(t, a); } } }, se = { importKey: (n) => new se.hmacSha1(ge.bytes.toBits(n)), pbkdf2(n, t, e, r) { if (e = e || 1e4, r < 0 || e < 0) throw new Error("invalid params to pbkdf2"); const a = 1 + (r >> 5) << 2; let l, s, d, f, _; const w = new ArrayBuffer(a), k = new DataView(w); let g = 0; const z = K; for (t = ge.bytes.toBits(t), _ = 1; g < (a || 1); _++) { for (l = s = n.encrypt(z.concat(t, [_])), d = 1; d < e; d++) for (s = n.encrypt(s), f = 0; f < s.length; f++) l[f] ^= s[f]; for (d = 0; g < (a || 1) && d < l.length; d++) k.setInt32(g, l[d]), g += 4; } return w.slice(0, r / 8); }, hmacSha1: class { constructor(n) { const t = this, e = t._hash = wn.sha1, r = [[], []]; t._baseHash = [new e(), new e()]; const a = t._baseHash[0].blockSize / 32; n.length > a && (n = new e().update(n).finalize()); for (let l = 0; l < a; l++) r[0][l] = 909522486 ^ n[l], r[1][l] = 1549556828 ^ n[l]; t._baseHash[0].update(r[0]), t._baseHash[1].update(r[1]), t._resultHash = new e(t._baseHash[0]); } reset() { const n = this; n._resultHash = new n._hash(n._baseHash[0]), n._updated = !1; } update(n) { this._updated = !0, this._resultHash.update(n); } digest() { const n = this, t = n._resultHash.finalize(), e = new n._hash(n._baseHash[1]).update(t).finalize(); return n.reset(), e; } encrypt(n) { if (this._updated) throw new Error("encrypt on already updated hmac called!"); return this.update(n), this.digest(n); } } }, xn = typeof crypto != te && typeof crypto.getRandomValues == _e, vt = "Invalid password", St = "Invalid signature", Re = "zipjs-abort-check-password"; function zt(n) { return xn ? crypto.getRandomValues(n) : pn.getRandomValues(n); } const oe = 16, At = { name: "PBKDF2" }, yn = Object.assign({ hash: { name: "HMAC" } }, At), De = Object.assign({ iterations: 1e3, hash: { name: "SHA-1" } }, At), gn = ["deriveBits"], ue = [8, 12, 16], ce = [16, 24, 32], $ = 10, kn = [0, 0, 0, 0], Se = typeof crypto != te, fe = Se && crypto.subtle, Ut = Se && typeof fe != te, J = ge.bytes, vn = bn.aes, Sn = mn.ctrGladman, zn = se.hmacSha1; let et = Se && Ut && typeof fe.importKey == _e, tt = Se && Ut && typeof fe.deriveBits == _e; class An extends TransformStream { constructor({ password: t, rawPassword: e, signed: r, encryptionStrength: a, checkPasswordOnly: l }) { super({ start() { Object.assign(this, { ready: new Promise((s) => this.resolveReady = s), password: Ft(t, e), signed: r, strength: a - 1, pending: new Uint8Array() }); }, async transform(s, d) { const f = this, { password: _, strength: w, resolveReady: k, ready: g } = f; _ ? (await async function(c, p, i, o) { const u = await Et(c, p, i, G(o, 0, ue[p])), b = G(o, ue[p]); if (u[0] != b[0] || u[1] != b[1]) throw new Error(vt); }(f, w, _, G(s, 0, ue[w] + 2)), s = G(s, ue[w] + 2), l ? d.error(new Error(Re)) : k()) : await g; const z = new Uint8Array(s.length - $ - (s.length - $) % oe); d.enqueue(Dt(f, s, z, 0, $, !0)); }, async flush(s) { const { signed: d, ctr: f, hmac: _, pending: w, ready: k } = this; if (_ && f) { await k; const g = G(w, 0, w.length - $), z = G(w, w.length - $); let c = new Uint8Array(); if (g.length) { const p = he(J, g); _.update(p); const i = f.update(p); c = de(J, i); } if (d) { const p = G(de(J, _.digest()), 0, $); for (let i = 0; i < $; i++) if (p[i] != z[i]) throw new Error(St); } s.enqueue(c); } } }); } } class Un extends TransformStream { constructor({ password: t, rawPassword: e, encryptionStrength: r }) { let a; super({ start() { Object.assign(this, { ready: new Promise((l) => this.resolveReady = l), password: Ft(t, e), strength: r - 1, pending: new Uint8Array() }); }, async transform(l, s) { const d = this, { password: f, strength: _, resolveReady: w, ready: k } = d; let g = new Uint8Array(); f ? (g = await async function(c, p, i) { const o = zt(new Uint8Array(ue[p])), u = await Et(c, p, i, o); return je(o, u); }(d, _, f), w()) : await k; const z = new Uint8Array(g.length + l.length - l.length % oe); z.set(g, 0), s.enqueue(Dt(d, l, z, g.length, 0)); }, async flush(l) { const { ctr: s, hmac: d, pending: f, ready: _ } = this; if (d && s) { await _; let w = new Uint8Array(); if (f.length) { const k = s.update(he(J, f)); d.update(k), w = de(J, k); } a.signature = de(J, d.digest()).slice(0, $), l.enqueue(je(w, a.signature)); } } }), a = this; } } function Dt(n, t, e, r, a, l) { const { ctr: s, hmac: d, pending: f } = n, _ = t.length - a; let w; for (f.length && (t = je(f, t), e = function(k, g) { if (g && g > k.length) { const z = k; (k = new Uint8Array(g)).set(z, 0); } return k; }(e, _ - _ % oe)), w = 0; w <= _ - oe; w += oe) { const k = he(J, G(t, w, w + oe)); l && d.update(k); const g = s.update(k); l || d.update(g), e.set(de(J, g), w + r); } return n.pending = G(t, w), e; } async function Et(n, t, e, r) { n.password = null; const a = await async function(w, k, g, z, c) { if (!et) return se.importKey(k); try { return await fe.importKey(w, k, g, z, c); } catch { return et = !1, se.importKey(k); } }("raw", e, yn, !1, gn), l = await async function(w, k, g) { if (!tt) return se.pbkdf2(k, w.salt, De.iterations, g); try { return await fe.deriveBits(w, k, g); } catch { return tt = !1, se.pbkdf2(k, w.salt, De.iterations, g); } }(Object.assign({ salt: r }, De), a, 8 * (2 * ce[t] + 2)), s = new Uint8Array(l), d = he(J, G(s, 0, ce[t])), f = he(J, G(s, ce[t], 2 * ce[t])), _ = G(s, 2 * ce[t]); return Object.assign(n, { keys: { key: d, authentication: f, passwordVerification: _ }, ctr: new Sn(new vn(d), Array.from(kn)), hmac: new zn(f) }), _; } function Ft(n, t) { return t === V ? function(e) { if (typeof TextEncoder == te) { e = unescape(encodeURIComponent(e)); const r = new Uint8Array(e.length); for (let a = 0; a < r.length; a++) r[a] = e.charCodeAt(a); return r; } return new TextEncoder().encode(e); }(n) : t; } function je(n, t) { let e = n; return n.length + t.length && (e = new Uint8Array(n.length + t.length), e.set(n, 0), e.set(t, n.length)), e; } function G(n, t, e) { return n.subarray(t, e); } function de(n, t) { return n.fromBits(t); } function he(n, t) { return n.toBits(t); } const ke = 12; class Dn extends TransformStream { constructor({ password: t, passwordVerification: e, checkPasswordOnly: r }) { super({ start() { Object.assign(this, { password: t, passwordVerification: e }), Tt(this, t); }, transform(a, l) { const s = this; if (s.password) { const d = nt(s, a.subarray(0, ke)); if (s.password = null, d[11] != s.passwordVerification) throw new Error(vt); a = a.subarray(ke); } r ? l.error(new Error(Re)) : l.enqueue(nt(s, a)); } }); } } class En extends TransformStream { constructor({ password: t, passwordVerification: e }) { super({ start() { Object.assign(this, { password: t, passwordVerification: e }), Tt(this, t); }, transform(r, a) { const l = this; let s, d; if (l.password) { l.password = null; const f = zt(new Uint8Array(ke)); f[11] = l.passwordVerification, s = new Uint8Array(r.length + f.length), s.set(rt(l, f), 0), d = ke; } else s = new Uint8Array(r.length), d = 0; s.set(rt(l, r), d), a.enqueue(s); } }); } } function nt(n, t) { const e = new Uint8Array(t.length); for (let r = 0; r < t.length; r++) e[r] = Ot(n) ^ t[r], Be(n, e[r]); return e; } function rt(n, t) { const e = new Uint8Array(t.length); for (let r = 0; r < t.length; r++) e[r] = Ot(n) ^ t[r], Be(n, t[r]); return e; } function Tt(n, t) { const e = [305419896, 591751049, 878082192]; Object.assign(n, { keys: e, crcKey0: new ye(e[0]), crcKey2: new ye(e[2]) }); for (let r = 0; r < t.length; r++) Be(n, t.charCodeAt(r)); } function Be(n, t) { let [e, r, a] = n.keys; n.crcKey0.append([t]), e = ~n.crcKey0.get(), r = it(Math.imul(it(r + Wt(e)), 134775813) + 1), n.crcKey2.append([r >>> 24]), a = ~n.crcKey2.get(), n.keys = [e, r, a]; } function Ot(n) { const t = 2 | n.keys[2]; return Wt(Math.imul(t, 1 ^ t) >>> 8); } function Wt(n) { return 255 & n; } function it(n) { return 4294967295 & n; } const at = "deflate-raw"; class Fn extends TransformStream { constructor(t, { chunkSize: e, CompressionStream: r, CompressionStreamNative: a }) { super({}); const { compressed: l, encrypted: s, useCompressionStream: d, zipCrypto: f, signed: _, level: w } = t, k = this; let g, z, c = Ct(super.readable); s && !f || !_ || (g = new kt(), c = Q(c, g)), l && (c = Mt(c, d, { level: w, chunkSize: e }, a, r)), s && (f ? c = Q(c, new En(t)) : (z = new Un(t), c = Q(c, z))), jt(k, c, () => { let p; s && !f && (p = z.signature), s && !f || !_ || (p = new DataView(g.value.buffer).getUint32(0)), k.signature = p; }); } } class Tn extends TransformStream { constructor(t, { chunkSize: e, DecompressionStream: r, DecompressionStreamNative: a }) { super({}); const { zipCrypto: l, encrypted: s, signed: d, signature: f, compressed: _, useCompressionStream: w } = t; let k, g, z = Ct(super.readable); s && (l ? z = Q(z, new Dn(t)) : (g = new An(t), z = Q(z, g))), _ && (z = Mt(z, w, { chunkSize: e }, a, r)), s && !l || !d || (k = new kt(), z = Q(z, k)), jt(this, z, () => { if ((!s || l) && d) { const c