vue-book-reader 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -15
- package/lib/index.css +32 -32
- package/lib/overlayer.js +175 -0
- package/lib/vue-book-reader.es.js +8868 -1065
- package/lib/vue-book-reader.umd.js +1704 -1120
- package/package.json +14 -8
- package/lib/comic-book-Bjl5tZ3h.cjs +0 -45
- package/lib/comic-book-PSmOcoJj.js +0 -45
- package/lib/epub-2C1S8RbY.js +0 -969
- package/lib/epub-CeaB7HuF.cjs +0 -969
- package/lib/fb2-BZ-PbCUN.js +0 -323
- package/lib/fb2-COptS59M.cjs +0 -323
- package/lib/fflate-CXkSS9we.cjs +0 -145
- package/lib/fflate-_abAaq3-.js +0 -145
- package/lib/fixed-layout-BhGoTqYn.cjs +0 -289
- package/lib/fixed-layout-CiUiCen-.js +0 -289
- package/lib/mobi-BKd5Fggk.cjs +0 -1222
- package/lib/mobi-M3pI3jcR.js +0 -1222
- package/lib/paginator-BdBNKhdV.cjs +0 -1028
- package/lib/paginator-D5cTls8p.js +0 -1028
- package/lib/pdf-DYzRHfF8.js +0 -137
- package/lib/pdf-vLpNJVyc.cjs +0 -137
- package/lib/search-CQGJojwL.js +0 -115
- package/lib/search-DauBnLi1.cjs +0 -115
- package/lib/tts-CTh0nMvu.js +0 -290
- package/lib/tts-Du0MFg8M.cjs +0 -290
- package/lib/view--95lChht.cjs +0 -1139
- package/lib/view-T2ghn1aG.js +0 -1140
- package/lib/vue-book-reader.cjs.js +0 -1357
- package/lib/zip-BtClDCuW.cjs +0 -1513
- package/lib/zip-DbJSXXRR.js +0 -1513
package/lib/fflate-CXkSS9we.cjs
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
var r = Uint8Array, a = Uint16Array, e = Int32Array, n = new r([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, 0, 0, 0]), i = new r([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, 0, 0]), t = new r([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), f = function(r2, n2) {
|
|
4
|
-
for (var i2 = new a(31), t2 = 0; t2 < 31; ++t2) i2[t2] = n2 += 1 << r2[t2 - 1];
|
|
5
|
-
var f2 = new e(i2[30]);
|
|
6
|
-
for (t2 = 1; t2 < 30; ++t2) for (var o2 = i2[t2]; o2 < i2[t2 + 1]; ++o2) f2[o2] = o2 - i2[t2] << 5 | t2;
|
|
7
|
-
return { b: i2, r: f2 };
|
|
8
|
-
}, o = f(n, 2), v = o.b, l = o.r;
|
|
9
|
-
v[28] = 258, l[258] = 28;
|
|
10
|
-
for (var u = f(i, 0).b, c = new a(32768), d = 0; d < 32768; ++d) {
|
|
11
|
-
var w = (43690 & d) >> 1 | (21845 & d) << 1;
|
|
12
|
-
w = (61680 & (w = (52428 & w) >> 2 | (13107 & w) << 2)) >> 4 | (3855 & w) << 4, c[d] = ((65280 & w) >> 8 | (255 & w) << 8) >> 1;
|
|
13
|
-
}
|
|
14
|
-
var b = function(r2, e2, n2) {
|
|
15
|
-
for (var i2 = r2.length, t2 = 0, f2 = new a(e2); t2 < i2; ++t2) r2[t2] && ++f2[r2[t2] - 1];
|
|
16
|
-
var o2, v2 = new a(e2);
|
|
17
|
-
for (t2 = 1; t2 < e2; ++t2) v2[t2] = v2[t2 - 1] + f2[t2 - 1] << 1;
|
|
18
|
-
{
|
|
19
|
-
o2 = new a(1 << e2);
|
|
20
|
-
var l2 = 15 - e2;
|
|
21
|
-
for (t2 = 0; t2 < i2; ++t2) if (r2[t2]) for (var u = t2 << 4 | r2[t2], d = e2 - r2[t2], w = v2[r2[t2] - 1]++ << d, b2 = w | (1 << d) - 1; w <= b2; ++w) o2[c[w] >> l2] = u;
|
|
22
|
-
}
|
|
23
|
-
return o2;
|
|
24
|
-
}, s = new r(288);
|
|
25
|
-
for (d = 0; d < 144; ++d) s[d] = 8;
|
|
26
|
-
for (d = 144; d < 256; ++d) s[d] = 9;
|
|
27
|
-
for (d = 256; d < 280; ++d) s[d] = 7;
|
|
28
|
-
for (d = 280; d < 288; ++d) s[d] = 8;
|
|
29
|
-
var h = new r(32);
|
|
30
|
-
for (d = 0; d < 32; ++d) h[d] = 5;
|
|
31
|
-
var y = b(s, 9), g = b(h, 5), p = function(r2) {
|
|
32
|
-
for (var a2 = r2[0], e2 = 1; e2 < r2.length; ++e2) r2[e2] > a2 && (a2 = r2[e2]);
|
|
33
|
-
return a2;
|
|
34
|
-
}, k = function(r2, a2, e2) {
|
|
35
|
-
var n2 = a2 / 8 | 0;
|
|
36
|
-
return (r2[n2] | r2[n2 + 1] << 8) >> (7 & a2) & e2;
|
|
37
|
-
}, m = function(r2, a2) {
|
|
38
|
-
var e2 = a2 / 8 | 0;
|
|
39
|
-
return (r2[e2] | r2[e2 + 1] << 8 | r2[e2 + 2] << 16) >> (7 & a2);
|
|
40
|
-
}, x = ["unexpected EOF", "invalid block type", "invalid length/literal", "invalid distance", "stream finished", "no stream handler", , "no callback", "invalid UTF-8 data", "extra field too long", "date not in range 1980-2099", "filename too long", "stream finishing", "invalid zip data"], T = function(r2, a2, e2) {
|
|
41
|
-
var n2 = new Error(a2 || x[r2]);
|
|
42
|
-
if (n2.code = r2, Error.captureStackTrace && Error.captureStackTrace(n2, T), !e2) throw n2;
|
|
43
|
-
return n2;
|
|
44
|
-
}, E = function(a2, e2, f2, o2) {
|
|
45
|
-
var l2 = a2.length, c = o2 ? o2.length : 0;
|
|
46
|
-
if (!l2 || e2.f && !e2.l) return f2 || new r(0);
|
|
47
|
-
var d = !f2, w = d || 2 != e2.i, s2 = e2.i;
|
|
48
|
-
d && (f2 = new r(3 * l2));
|
|
49
|
-
var h2 = function(a3) {
|
|
50
|
-
var e3 = f2.length;
|
|
51
|
-
if (a3 > e3) {
|
|
52
|
-
var n2 = new r(Math.max(2 * e3, a3));
|
|
53
|
-
n2.set(f2), f2 = n2;
|
|
54
|
-
}
|
|
55
|
-
}, x2 = e2.f || 0, E2 = e2.p || 0, z2 = e2.b || 0, A2 = e2.l, U2 = e2.d, D = e2.m, F = e2.n, M = 8 * l2;
|
|
56
|
-
do {
|
|
57
|
-
if (!A2) {
|
|
58
|
-
x2 = k(a2, E2, 1);
|
|
59
|
-
var S = k(a2, E2 + 1, 3);
|
|
60
|
-
if (E2 += 3, !S) {
|
|
61
|
-
var I = a2[(N = 4 + ((E2 + 7) / 8 | 0)) - 4] | a2[N - 3] << 8, O = N + I;
|
|
62
|
-
if (O > l2) {
|
|
63
|
-
s2 && T(0);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
w && h2(z2 + I), f2.set(a2.subarray(N, O), z2), e2.b = z2 += I, e2.p = E2 = 8 * O, e2.f = x2;
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (1 == S) A2 = y, U2 = g, D = 9, F = 5;
|
|
70
|
-
else if (2 == S) {
|
|
71
|
-
var j = k(a2, E2, 31) + 257, q = k(a2, E2 + 10, 15) + 4, B = j + k(a2, E2 + 5, 31) + 1;
|
|
72
|
-
E2 += 14;
|
|
73
|
-
for (var C = new r(B), G = new r(19), H = 0; H < q; ++H) G[t[H]] = k(a2, E2 + 3 * H, 7);
|
|
74
|
-
E2 += 3 * q;
|
|
75
|
-
var J = p(G), K = (1 << J) - 1, L = b(G, J);
|
|
76
|
-
for (H = 0; H < B; ) {
|
|
77
|
-
var N, P = L[k(a2, E2, K)];
|
|
78
|
-
if (E2 += 15 & P, (N = P >> 4) < 16) C[H++] = N;
|
|
79
|
-
else {
|
|
80
|
-
var Q = 0, R = 0;
|
|
81
|
-
for (16 == N ? (R = 3 + k(a2, E2, 3), E2 += 2, Q = C[H - 1]) : 17 == N ? (R = 3 + k(a2, E2, 7), E2 += 3) : 18 == N && (R = 11 + k(a2, E2, 127), E2 += 7); R--; ) C[H++] = Q;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
var V = C.subarray(0, j), W = C.subarray(j);
|
|
85
|
-
D = p(V), F = p(W), A2 = b(V, D), U2 = b(W, F);
|
|
86
|
-
} else T(1);
|
|
87
|
-
if (E2 > M) {
|
|
88
|
-
s2 && T(0);
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
w && h2(z2 + 131072);
|
|
93
|
-
for (var X = (1 << D) - 1, Y = (1 << F) - 1, Z = E2; ; Z = E2) {
|
|
94
|
-
var $ = (Q = A2[m(a2, E2) & X]) >> 4;
|
|
95
|
-
if ((E2 += 15 & Q) > M) {
|
|
96
|
-
s2 && T(0);
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
if (Q || T(2), $ < 256) f2[z2++] = $;
|
|
100
|
-
else {
|
|
101
|
-
if (256 == $) {
|
|
102
|
-
Z = E2, A2 = null;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
var _ = $ - 254;
|
|
106
|
-
if ($ > 264) {
|
|
107
|
-
var rr = n[H = $ - 257];
|
|
108
|
-
_ = k(a2, E2, (1 << rr) - 1) + v[H], E2 += rr;
|
|
109
|
-
}
|
|
110
|
-
var ar = U2[m(a2, E2) & Y], er = ar >> 4;
|
|
111
|
-
ar || T(3), E2 += 15 & ar;
|
|
112
|
-
W = u[er];
|
|
113
|
-
if (er > 3) {
|
|
114
|
-
rr = i[er];
|
|
115
|
-
W += m(a2, E2) & (1 << rr) - 1, E2 += rr;
|
|
116
|
-
}
|
|
117
|
-
if (E2 > M) {
|
|
118
|
-
s2 && T(0);
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
w && h2(z2 + 131072);
|
|
122
|
-
var nr = z2 + _;
|
|
123
|
-
if (z2 < W) {
|
|
124
|
-
var ir = c - W, tr = Math.min(W, nr);
|
|
125
|
-
for (ir + z2 < 0 && T(3); z2 < tr; ++z2) f2[z2] = o2[ir + z2];
|
|
126
|
-
}
|
|
127
|
-
for (; z2 < nr; ++z2) f2[z2] = f2[z2 - W];
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
e2.l = A2, e2.p = Z, e2.b = z2, e2.f = x2, A2 && (x2 = 1, e2.m = D, e2.d = U2, e2.n = F);
|
|
131
|
-
} while (!x2);
|
|
132
|
-
return z2 != f2.length && d ? function(a3, e3, n2) {
|
|
133
|
-
return (null == n2 || n2 > a3.length) && (n2 = a3.length), new r(a3.subarray(e3, n2));
|
|
134
|
-
}(f2, 0, z2) : f2.subarray(0, z2);
|
|
135
|
-
}, z = new r(0);
|
|
136
|
-
function A(r2, a2) {
|
|
137
|
-
return E(r2.subarray((e2 = r2, n2 = a2 && a2.dictionary, (8 != (15 & e2[0]) || e2[0] >> 4 > 7 || (e2[0] << 8 | e2[1]) % 31) && T(6, "invalid zlib data"), (e2[1] >> 5 & 1) == +!n2 && T(6, "invalid zlib data: " + (32 & e2[1] ? "need" : "unexpected") + " dictionary"), 2 + (e2[1] >> 3 & 4)), -4), { i: 2 }, a2 && a2.out, a2 && a2.dictionary);
|
|
138
|
-
var e2, n2;
|
|
139
|
-
}
|
|
140
|
-
var U = "undefined" != typeof TextDecoder && new TextDecoder();
|
|
141
|
-
try {
|
|
142
|
-
U.decode(z, { stream: true });
|
|
143
|
-
} catch (r2) {
|
|
144
|
-
}
|
|
145
|
-
exports.unzlibSync = A;
|
package/lib/fflate-_abAaq3-.js
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
var r = Uint8Array, a = Uint16Array, e = Int32Array, n = new r([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, 0, 0, 0]), i = new r([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, 0, 0]), t = new r([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), f = function(r2, n2) {
|
|
2
|
-
for (var i2 = new a(31), t2 = 0; t2 < 31; ++t2) i2[t2] = n2 += 1 << r2[t2 - 1];
|
|
3
|
-
var f2 = new e(i2[30]);
|
|
4
|
-
for (t2 = 1; t2 < 30; ++t2) for (var o2 = i2[t2]; o2 < i2[t2 + 1]; ++o2) f2[o2] = o2 - i2[t2] << 5 | t2;
|
|
5
|
-
return { b: i2, r: f2 };
|
|
6
|
-
}, o = f(n, 2), v = o.b, l = o.r;
|
|
7
|
-
v[28] = 258, l[258] = 28;
|
|
8
|
-
for (var u = f(i, 0).b, c = new a(32768), d = 0; d < 32768; ++d) {
|
|
9
|
-
var w = (43690 & d) >> 1 | (21845 & d) << 1;
|
|
10
|
-
w = (61680 & (w = (52428 & w) >> 2 | (13107 & w) << 2)) >> 4 | (3855 & w) << 4, c[d] = ((65280 & w) >> 8 | (255 & w) << 8) >> 1;
|
|
11
|
-
}
|
|
12
|
-
var b = function(r2, e2, n2) {
|
|
13
|
-
for (var i2 = r2.length, t2 = 0, f2 = new a(e2); t2 < i2; ++t2) r2[t2] && ++f2[r2[t2] - 1];
|
|
14
|
-
var o2, v2 = new a(e2);
|
|
15
|
-
for (t2 = 1; t2 < e2; ++t2) v2[t2] = v2[t2 - 1] + f2[t2 - 1] << 1;
|
|
16
|
-
{
|
|
17
|
-
o2 = new a(1 << e2);
|
|
18
|
-
var l2 = 15 - e2;
|
|
19
|
-
for (t2 = 0; t2 < i2; ++t2) if (r2[t2]) for (var u = t2 << 4 | r2[t2], d = e2 - r2[t2], w = v2[r2[t2] - 1]++ << d, b2 = w | (1 << d) - 1; w <= b2; ++w) o2[c[w] >> l2] = u;
|
|
20
|
-
}
|
|
21
|
-
return o2;
|
|
22
|
-
}, s = new r(288);
|
|
23
|
-
for (d = 0; d < 144; ++d) s[d] = 8;
|
|
24
|
-
for (d = 144; d < 256; ++d) s[d] = 9;
|
|
25
|
-
for (d = 256; d < 280; ++d) s[d] = 7;
|
|
26
|
-
for (d = 280; d < 288; ++d) s[d] = 8;
|
|
27
|
-
var h = new r(32);
|
|
28
|
-
for (d = 0; d < 32; ++d) h[d] = 5;
|
|
29
|
-
var y = b(s, 9), g = b(h, 5), p = function(r2) {
|
|
30
|
-
for (var a2 = r2[0], e2 = 1; e2 < r2.length; ++e2) r2[e2] > a2 && (a2 = r2[e2]);
|
|
31
|
-
return a2;
|
|
32
|
-
}, k = function(r2, a2, e2) {
|
|
33
|
-
var n2 = a2 / 8 | 0;
|
|
34
|
-
return (r2[n2] | r2[n2 + 1] << 8) >> (7 & a2) & e2;
|
|
35
|
-
}, m = function(r2, a2) {
|
|
36
|
-
var e2 = a2 / 8 | 0;
|
|
37
|
-
return (r2[e2] | r2[e2 + 1] << 8 | r2[e2 + 2] << 16) >> (7 & a2);
|
|
38
|
-
}, x = ["unexpected EOF", "invalid block type", "invalid length/literal", "invalid distance", "stream finished", "no stream handler", , "no callback", "invalid UTF-8 data", "extra field too long", "date not in range 1980-2099", "filename too long", "stream finishing", "invalid zip data"], T = function(r2, a2, e2) {
|
|
39
|
-
var n2 = new Error(a2 || x[r2]);
|
|
40
|
-
if (n2.code = r2, Error.captureStackTrace && Error.captureStackTrace(n2, T), !e2) throw n2;
|
|
41
|
-
return n2;
|
|
42
|
-
}, E = function(a2, e2, f2, o2) {
|
|
43
|
-
var l2 = a2.length, c = o2 ? o2.length : 0;
|
|
44
|
-
if (!l2 || e2.f && !e2.l) return f2 || new r(0);
|
|
45
|
-
var d = !f2, w = d || 2 != e2.i, s2 = e2.i;
|
|
46
|
-
d && (f2 = new r(3 * l2));
|
|
47
|
-
var h2 = function(a3) {
|
|
48
|
-
var e3 = f2.length;
|
|
49
|
-
if (a3 > e3) {
|
|
50
|
-
var n2 = new r(Math.max(2 * e3, a3));
|
|
51
|
-
n2.set(f2), f2 = n2;
|
|
52
|
-
}
|
|
53
|
-
}, x2 = e2.f || 0, E2 = e2.p || 0, z2 = e2.b || 0, A2 = e2.l, U2 = e2.d, D = e2.m, F = e2.n, M = 8 * l2;
|
|
54
|
-
do {
|
|
55
|
-
if (!A2) {
|
|
56
|
-
x2 = k(a2, E2, 1);
|
|
57
|
-
var S = k(a2, E2 + 1, 3);
|
|
58
|
-
if (E2 += 3, !S) {
|
|
59
|
-
var I = a2[(N = 4 + ((E2 + 7) / 8 | 0)) - 4] | a2[N - 3] << 8, O = N + I;
|
|
60
|
-
if (O > l2) {
|
|
61
|
-
s2 && T(0);
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
w && h2(z2 + I), f2.set(a2.subarray(N, O), z2), e2.b = z2 += I, e2.p = E2 = 8 * O, e2.f = x2;
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (1 == S) A2 = y, U2 = g, D = 9, F = 5;
|
|
68
|
-
else if (2 == S) {
|
|
69
|
-
var j = k(a2, E2, 31) + 257, q = k(a2, E2 + 10, 15) + 4, B = j + k(a2, E2 + 5, 31) + 1;
|
|
70
|
-
E2 += 14;
|
|
71
|
-
for (var C = new r(B), G = new r(19), H = 0; H < q; ++H) G[t[H]] = k(a2, E2 + 3 * H, 7);
|
|
72
|
-
E2 += 3 * q;
|
|
73
|
-
var J = p(G), K = (1 << J) - 1, L = b(G, J);
|
|
74
|
-
for (H = 0; H < B; ) {
|
|
75
|
-
var N, P = L[k(a2, E2, K)];
|
|
76
|
-
if (E2 += 15 & P, (N = P >> 4) < 16) C[H++] = N;
|
|
77
|
-
else {
|
|
78
|
-
var Q = 0, R = 0;
|
|
79
|
-
for (16 == N ? (R = 3 + k(a2, E2, 3), E2 += 2, Q = C[H - 1]) : 17 == N ? (R = 3 + k(a2, E2, 7), E2 += 3) : 18 == N && (R = 11 + k(a2, E2, 127), E2 += 7); R--; ) C[H++] = Q;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
var V = C.subarray(0, j), W = C.subarray(j);
|
|
83
|
-
D = p(V), F = p(W), A2 = b(V, D), U2 = b(W, F);
|
|
84
|
-
} else T(1);
|
|
85
|
-
if (E2 > M) {
|
|
86
|
-
s2 && T(0);
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
w && h2(z2 + 131072);
|
|
91
|
-
for (var X = (1 << D) - 1, Y = (1 << F) - 1, Z = E2; ; Z = E2) {
|
|
92
|
-
var $ = (Q = A2[m(a2, E2) & X]) >> 4;
|
|
93
|
-
if ((E2 += 15 & Q) > M) {
|
|
94
|
-
s2 && T(0);
|
|
95
|
-
break;
|
|
96
|
-
}
|
|
97
|
-
if (Q || T(2), $ < 256) f2[z2++] = $;
|
|
98
|
-
else {
|
|
99
|
-
if (256 == $) {
|
|
100
|
-
Z = E2, A2 = null;
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
var _ = $ - 254;
|
|
104
|
-
if ($ > 264) {
|
|
105
|
-
var rr = n[H = $ - 257];
|
|
106
|
-
_ = k(a2, E2, (1 << rr) - 1) + v[H], E2 += rr;
|
|
107
|
-
}
|
|
108
|
-
var ar = U2[m(a2, E2) & Y], er = ar >> 4;
|
|
109
|
-
ar || T(3), E2 += 15 & ar;
|
|
110
|
-
W = u[er];
|
|
111
|
-
if (er > 3) {
|
|
112
|
-
rr = i[er];
|
|
113
|
-
W += m(a2, E2) & (1 << rr) - 1, E2 += rr;
|
|
114
|
-
}
|
|
115
|
-
if (E2 > M) {
|
|
116
|
-
s2 && T(0);
|
|
117
|
-
break;
|
|
118
|
-
}
|
|
119
|
-
w && h2(z2 + 131072);
|
|
120
|
-
var nr = z2 + _;
|
|
121
|
-
if (z2 < W) {
|
|
122
|
-
var ir = c - W, tr = Math.min(W, nr);
|
|
123
|
-
for (ir + z2 < 0 && T(3); z2 < tr; ++z2) f2[z2] = o2[ir + z2];
|
|
124
|
-
}
|
|
125
|
-
for (; z2 < nr; ++z2) f2[z2] = f2[z2 - W];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
e2.l = A2, e2.p = Z, e2.b = z2, e2.f = x2, A2 && (x2 = 1, e2.m = D, e2.d = U2, e2.n = F);
|
|
129
|
-
} while (!x2);
|
|
130
|
-
return z2 != f2.length && d ? function(a3, e3, n2) {
|
|
131
|
-
return (null == n2 || n2 > a3.length) && (n2 = a3.length), new r(a3.subarray(e3, n2));
|
|
132
|
-
}(f2, 0, z2) : f2.subarray(0, z2);
|
|
133
|
-
}, z = new r(0);
|
|
134
|
-
function A(r2, a2) {
|
|
135
|
-
return E(r2.subarray((e2 = r2, n2 = a2 && a2.dictionary, (8 != (15 & e2[0]) || e2[0] >> 4 > 7 || (e2[0] << 8 | e2[1]) % 31) && T(6, "invalid zlib data"), (e2[1] >> 5 & 1) == +!n2 && T(6, "invalid zlib data: " + (32 & e2[1] ? "need" : "unexpected") + " dictionary"), 2 + (e2[1] >> 3 & 4)), -4), { i: 2 }, a2 && a2.out, a2 && a2.dictionary);
|
|
136
|
-
var e2, n2;
|
|
137
|
-
}
|
|
138
|
-
var U = "undefined" != typeof TextDecoder && new TextDecoder();
|
|
139
|
-
try {
|
|
140
|
-
U.decode(z, { stream: true });
|
|
141
|
-
} catch (r2) {
|
|
142
|
-
}
|
|
143
|
-
export {
|
|
144
|
-
A as unzlibSync
|
|
145
|
-
};
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const parseViewport = (str) => {
|
|
4
|
-
var _a, _b;
|
|
5
|
-
return (_b = (_a = str == null ? void 0 : str.split(/[,;\s]/)) == null ? void 0 : _a.filter((x) => x)) == null ? void 0 : _b.map((x) => x.split("=").map((x2) => x2.trim()));
|
|
6
|
-
};
|
|
7
|
-
const getViewport = (doc, viewport) => {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
if (doc.documentElement.localName === "svg") {
|
|
10
|
-
const [, , width, height] = ((_a = doc.documentElement.getAttribute("viewBox")) == null ? void 0 : _a.split(/\s/)) ?? [];
|
|
11
|
-
return { width, height };
|
|
12
|
-
}
|
|
13
|
-
const meta = parseViewport((_b = doc.querySelector('meta[name="viewport"]')) == null ? void 0 : _b.getAttribute("content"));
|
|
14
|
-
if (meta) return Object.fromEntries(meta);
|
|
15
|
-
if (typeof viewport === "string") return parseViewport(viewport);
|
|
16
|
-
if ((viewport == null ? void 0 : viewport.width) && viewport.height) return viewport;
|
|
17
|
-
const img = doc.querySelector("img");
|
|
18
|
-
if (img) return { width: img.naturalWidth, height: img.naturalHeight };
|
|
19
|
-
console.warn(new Error("Missing viewport properties"));
|
|
20
|
-
return { width: 1e3, height: 2e3 };
|
|
21
|
-
};
|
|
22
|
-
class FixedLayout extends HTMLElement {
|
|
23
|
-
static observedAttributes = ["zoom"];
|
|
24
|
-
#root = this.attachShadow({ mode: "closed" });
|
|
25
|
-
#observer = new ResizeObserver(() => this.#render());
|
|
26
|
-
#spreads;
|
|
27
|
-
#index = -1;
|
|
28
|
-
defaultViewport;
|
|
29
|
-
spread;
|
|
30
|
-
#portrait = false;
|
|
31
|
-
#left;
|
|
32
|
-
#right;
|
|
33
|
-
#center;
|
|
34
|
-
#side;
|
|
35
|
-
#zoom;
|
|
36
|
-
constructor() {
|
|
37
|
-
super();
|
|
38
|
-
const sheet = new CSSStyleSheet();
|
|
39
|
-
this.#root.adoptedStyleSheets = [sheet];
|
|
40
|
-
sheet.replaceSync(`:host {
|
|
41
|
-
width: 100%;
|
|
42
|
-
height: 100%;
|
|
43
|
-
display: flex;
|
|
44
|
-
justify-content: center;
|
|
45
|
-
align-items: center;
|
|
46
|
-
overflow: auto;
|
|
47
|
-
}`);
|
|
48
|
-
this.#observer.observe(this);
|
|
49
|
-
}
|
|
50
|
-
attributeChangedCallback(name, _, value) {
|
|
51
|
-
switch (name) {
|
|
52
|
-
case "zoom":
|
|
53
|
-
this.#zoom = value !== "fit-width" && value !== "fit-page" ? parseFloat(value) : value;
|
|
54
|
-
this.#render();
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
async #createFrame({ index, src: srcOption }) {
|
|
59
|
-
const srcOptionIsString = typeof srcOption === "string";
|
|
60
|
-
const src = srcOptionIsString ? srcOption : srcOption == null ? void 0 : srcOption.src;
|
|
61
|
-
const onZoom = srcOptionIsString ? null : srcOption == null ? void 0 : srcOption.onZoom;
|
|
62
|
-
const element = document.createElement("div");
|
|
63
|
-
element.setAttribute("dir", "ltr");
|
|
64
|
-
const iframe = document.createElement("iframe");
|
|
65
|
-
element.append(iframe);
|
|
66
|
-
Object.assign(iframe.style, {
|
|
67
|
-
border: "0",
|
|
68
|
-
display: "none",
|
|
69
|
-
overflow: "hidden"
|
|
70
|
-
});
|
|
71
|
-
iframe.setAttribute("sandbox", "allow-same-origin allow-scripts");
|
|
72
|
-
iframe.setAttribute("scrolling", "no");
|
|
73
|
-
iframe.setAttribute("part", "filter");
|
|
74
|
-
this.#root.append(element);
|
|
75
|
-
if (!src) return { blank: true, element, iframe };
|
|
76
|
-
return new Promise((resolve) => {
|
|
77
|
-
iframe.addEventListener("load", () => {
|
|
78
|
-
const doc = iframe.contentDocument;
|
|
79
|
-
this.dispatchEvent(new CustomEvent("load", { detail: { doc, index } }));
|
|
80
|
-
const { width, height } = getViewport(doc, this.defaultViewport);
|
|
81
|
-
resolve({
|
|
82
|
-
element,
|
|
83
|
-
iframe,
|
|
84
|
-
width: parseFloat(width),
|
|
85
|
-
height: parseFloat(height),
|
|
86
|
-
onZoom
|
|
87
|
-
});
|
|
88
|
-
}, { once: true });
|
|
89
|
-
iframe.src = src;
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
#render(side = this.#side) {
|
|
93
|
-
if (!side) return;
|
|
94
|
-
const left = this.#left ?? {};
|
|
95
|
-
const right = this.#center ?? this.#right ?? {};
|
|
96
|
-
const target = side === "left" ? left : right;
|
|
97
|
-
const { width, height } = this.getBoundingClientRect();
|
|
98
|
-
const portrait = this.spread !== "both" && this.spread !== "portrait" && height > width;
|
|
99
|
-
this.#portrait = portrait;
|
|
100
|
-
const blankWidth = left.width ?? right.width ?? 0;
|
|
101
|
-
const blankHeight = left.height ?? right.height ?? 0;
|
|
102
|
-
const scale = typeof this.#zoom === "number" && !isNaN(this.#zoom) ? this.#zoom : (this.#zoom === "fit-width" ? portrait || this.#center ? width / (target.width ?? blankWidth) : width / ((left.width ?? blankWidth) + (right.width ?? blankWidth)) : portrait || this.#center ? Math.min(
|
|
103
|
-
width / (target.width ?? blankWidth),
|
|
104
|
-
height / (target.height ?? blankHeight)
|
|
105
|
-
) : Math.min(
|
|
106
|
-
width / ((left.width ?? blankWidth) + (right.width ?? blankWidth)),
|
|
107
|
-
height / Math.max(
|
|
108
|
-
left.height ?? blankHeight,
|
|
109
|
-
right.height ?? blankHeight
|
|
110
|
-
)
|
|
111
|
-
)) || 1;
|
|
112
|
-
const transform = (frame) => {
|
|
113
|
-
let { element, iframe, width: width2, height: height2, blank, onZoom } = frame;
|
|
114
|
-
if (!iframe) return;
|
|
115
|
-
if (onZoom) onZoom({ doc: frame.iframe.contentDocument, scale });
|
|
116
|
-
const iframeScale = onZoom ? scale : 1;
|
|
117
|
-
Object.assign(iframe.style, {
|
|
118
|
-
width: `${width2 * iframeScale}px`,
|
|
119
|
-
height: `${height2 * iframeScale}px`,
|
|
120
|
-
transform: onZoom ? "none" : `scale(${scale})`,
|
|
121
|
-
transformOrigin: "top left",
|
|
122
|
-
display: blank ? "none" : "block"
|
|
123
|
-
});
|
|
124
|
-
Object.assign(element.style, {
|
|
125
|
-
width: `${(width2 ?? blankWidth) * scale}px`,
|
|
126
|
-
height: `${(height2 ?? blankHeight) * scale}px`,
|
|
127
|
-
overflow: "hidden",
|
|
128
|
-
display: "block",
|
|
129
|
-
flexShrink: "0",
|
|
130
|
-
marginBlock: "auto"
|
|
131
|
-
});
|
|
132
|
-
if (portrait && frame !== target) {
|
|
133
|
-
element.style.display = "none";
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
if (this.#center) {
|
|
137
|
-
transform(this.#center);
|
|
138
|
-
} else {
|
|
139
|
-
transform(left);
|
|
140
|
-
transform(right);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
async #showSpread({ left, right, center, side }) {
|
|
144
|
-
this.#root.replaceChildren();
|
|
145
|
-
this.#left = null;
|
|
146
|
-
this.#right = null;
|
|
147
|
-
this.#center = null;
|
|
148
|
-
if (center) {
|
|
149
|
-
this.#center = await this.#createFrame(center);
|
|
150
|
-
this.#side = "center";
|
|
151
|
-
this.#render();
|
|
152
|
-
} else {
|
|
153
|
-
this.#left = await this.#createFrame(left);
|
|
154
|
-
this.#right = await this.#createFrame(right);
|
|
155
|
-
this.#side = this.#left.blank ? "right" : this.#right.blank ? "left" : side;
|
|
156
|
-
this.#render();
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
#goLeft() {
|
|
160
|
-
var _a, _b, _c, _d;
|
|
161
|
-
if (this.#center || ((_a = this.#left) == null ? void 0 : _a.blank)) return;
|
|
162
|
-
if (this.#portrait && ((_d = (_c = (_b = this.#left) == null ? void 0 : _b.element) == null ? void 0 : _c.style) == null ? void 0 : _d.display) === "none") {
|
|
163
|
-
this.#side = "left";
|
|
164
|
-
this.#render();
|
|
165
|
-
this.#reportLocation("page");
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
#goRight() {
|
|
170
|
-
var _a, _b, _c, _d;
|
|
171
|
-
if (this.#center || ((_a = this.#right) == null ? void 0 : _a.blank)) return;
|
|
172
|
-
if (this.#portrait && ((_d = (_c = (_b = this.#right) == null ? void 0 : _b.element) == null ? void 0 : _c.style) == null ? void 0 : _d.display) === "none") {
|
|
173
|
-
this.#side = "right";
|
|
174
|
-
this.#render();
|
|
175
|
-
this.#reportLocation("page");
|
|
176
|
-
return true;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
open(book) {
|
|
180
|
-
this.book = book;
|
|
181
|
-
const { rendition } = book;
|
|
182
|
-
this.spread = rendition == null ? void 0 : rendition.spread;
|
|
183
|
-
this.defaultViewport = rendition == null ? void 0 : rendition.viewport;
|
|
184
|
-
const rtl = book.dir === "rtl";
|
|
185
|
-
const ltr = !rtl;
|
|
186
|
-
this.rtl = rtl;
|
|
187
|
-
if ((rendition == null ? void 0 : rendition.spread) === "none")
|
|
188
|
-
this.#spreads = book.sections.map((section) => ({ center: section }));
|
|
189
|
-
else this.#spreads = book.sections.reduce((arr, section, i) => {
|
|
190
|
-
const last = arr[arr.length - 1];
|
|
191
|
-
const { pageSpread } = section;
|
|
192
|
-
const newSpread = () => {
|
|
193
|
-
const spread = {};
|
|
194
|
-
arr.push(spread);
|
|
195
|
-
return spread;
|
|
196
|
-
};
|
|
197
|
-
if (pageSpread === "center") {
|
|
198
|
-
const spread = last.left || last.right ? newSpread() : last;
|
|
199
|
-
spread.center = section;
|
|
200
|
-
} else if (pageSpread === "left") {
|
|
201
|
-
const spread = last.center || last.left || ltr && i ? newSpread() : last;
|
|
202
|
-
spread.left = section;
|
|
203
|
-
} else if (pageSpread === "right") {
|
|
204
|
-
const spread = last.center || last.right || rtl && i ? newSpread() : last;
|
|
205
|
-
spread.right = section;
|
|
206
|
-
} else if (ltr) {
|
|
207
|
-
if (last.center || last.right) newSpread().left = section;
|
|
208
|
-
else if (last.left || !i) last.right = section;
|
|
209
|
-
else last.left = section;
|
|
210
|
-
} else {
|
|
211
|
-
if (last.center || last.left) newSpread().right = section;
|
|
212
|
-
else if (last.right || !i) last.left = section;
|
|
213
|
-
else last.right = section;
|
|
214
|
-
}
|
|
215
|
-
return arr;
|
|
216
|
-
}, [{}]);
|
|
217
|
-
}
|
|
218
|
-
get index() {
|
|
219
|
-
const spread = this.#spreads[this.#index];
|
|
220
|
-
const section = (spread == null ? void 0 : spread.center) ?? (this.#side === "left" ? spread.left ?? spread.right : spread.right ?? spread.left);
|
|
221
|
-
return this.book.sections.indexOf(section);
|
|
222
|
-
}
|
|
223
|
-
#reportLocation(reason) {
|
|
224
|
-
this.dispatchEvent(new CustomEvent("relocate", { detail: { reason, range: null, index: this.index, fraction: 0, size: 1 } }));
|
|
225
|
-
}
|
|
226
|
-
getSpreadOf(section) {
|
|
227
|
-
const spreads = this.#spreads;
|
|
228
|
-
for (let index = 0; index < spreads.length; index++) {
|
|
229
|
-
const { left, right, center } = spreads[index];
|
|
230
|
-
if (left === section) return { index, side: "left" };
|
|
231
|
-
if (right === section) return { index, side: "right" };
|
|
232
|
-
if (center === section) return { index, side: "center" };
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
async goToSpread(index, side, reason) {
|
|
236
|
-
var _a, _b, _c, _d, _e, _f;
|
|
237
|
-
if (index < 0 || index > this.#spreads.length - 1) return;
|
|
238
|
-
if (index === this.#index) {
|
|
239
|
-
this.#render(side);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
this.#index = index;
|
|
243
|
-
const spread = this.#spreads[index];
|
|
244
|
-
if (spread.center) {
|
|
245
|
-
const index2 = this.book.sections.indexOf(spread.center);
|
|
246
|
-
const src = await ((_b = (_a = spread.center) == null ? void 0 : _a.load) == null ? void 0 : _b.call(_a));
|
|
247
|
-
await this.#showSpread({ center: { index: index2, src } });
|
|
248
|
-
} else {
|
|
249
|
-
const indexL = this.book.sections.indexOf(spread.left);
|
|
250
|
-
const indexR = this.book.sections.indexOf(spread.right);
|
|
251
|
-
const srcL = await ((_d = (_c = spread.left) == null ? void 0 : _c.load) == null ? void 0 : _d.call(_c));
|
|
252
|
-
const srcR = await ((_f = (_e = spread.right) == null ? void 0 : _e.load) == null ? void 0 : _f.call(_e));
|
|
253
|
-
const left = { index: indexL, src: srcL };
|
|
254
|
-
const right = { index: indexR, src: srcR };
|
|
255
|
-
await this.#showSpread({ left, right, side });
|
|
256
|
-
}
|
|
257
|
-
this.#reportLocation(reason);
|
|
258
|
-
}
|
|
259
|
-
async select(target) {
|
|
260
|
-
await this.goTo(target);
|
|
261
|
-
}
|
|
262
|
-
async goTo(target) {
|
|
263
|
-
const { book } = this;
|
|
264
|
-
const resolved = await target;
|
|
265
|
-
const section = book.sections[resolved.index];
|
|
266
|
-
if (!section) return;
|
|
267
|
-
const { index, side } = this.getSpreadOf(section);
|
|
268
|
-
await this.goToSpread(index, side);
|
|
269
|
-
}
|
|
270
|
-
async next() {
|
|
271
|
-
const s = this.rtl ? this.#goLeft() : this.#goRight();
|
|
272
|
-
if (!s) return this.goToSpread(this.#index + 1, this.rtl ? "right" : "left", "page");
|
|
273
|
-
}
|
|
274
|
-
async prev() {
|
|
275
|
-
const s = this.rtl ? this.#goRight() : this.#goLeft();
|
|
276
|
-
if (!s) return this.goToSpread(this.#index - 1, this.rtl ? "left" : "right", "page");
|
|
277
|
-
}
|
|
278
|
-
getContents() {
|
|
279
|
-
return Array.from(this.#root.querySelectorAll("iframe"), (frame) => ({
|
|
280
|
-
doc: frame.contentDocument
|
|
281
|
-
// TODO: index, overlayer
|
|
282
|
-
}));
|
|
283
|
-
}
|
|
284
|
-
destroy() {
|
|
285
|
-
this.#observer.unobserve(this);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
customElements.define("foliate-fxl", FixedLayout);
|
|
289
|
-
exports.FixedLayout = FixedLayout;
|