@treinetic/treinetic-epub-reader 2.0.1 → 2.0.3
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 +11 -5
- package/dist/TreineticEpubReader.d.ts +11 -0
- package/dist/treinetic-epub-reader.es.js +109 -98
- package/dist/treinetic-epub-reader.umd.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Treinetic Epub Reader 2.0.
|
|
1
|
+
# Treinetic Epub Reader 2.0.3
|
|
2
2
|
|
|
3
3
|
A modern, lightweight, and framework-agnostic EPUB reader for the web, built with TypeScript.
|
|
4
4
|
This project is an initiative of Treinetic (Pvt) Ltd, Sri Lanka.
|
|
@@ -58,17 +58,23 @@ This will start a local server at `http://localhost:3001` with hot-reloading.
|
|
|
58
58
|
|
|
59
59
|
### Basic Usage
|
|
60
60
|
|
|
61
|
-
First, import the necessary
|
|
61
|
+
First, import the necessary methods and CSS.
|
|
62
|
+
|
|
63
|
+
> [!NOTE]
|
|
64
|
+
> **v2.0.3 Update:** You can now use Named Exports for better compatibility with Vite and modern bundlers.
|
|
62
65
|
|
|
63
66
|
```typescript
|
|
64
|
-
import
|
|
67
|
+
import { create } from '@treinetic/treinetic-epub-reader';
|
|
65
68
|
import '@treinetic/treinetic-epub-reader/dist/style.css';
|
|
66
69
|
|
|
67
70
|
// Create the reader instance targeting your container
|
|
68
|
-
const reader =
|
|
71
|
+
const reader = create("#epub-reader-frame");
|
|
69
72
|
|
|
70
73
|
// Load an EPUB file (url or base64)
|
|
71
|
-
|
|
74
|
+
// Note: Must be a valid .epub file, not a PDF.
|
|
75
|
+
// For correct path resolution in Vite, ensure files are in 'public/' or imported as assets.
|
|
76
|
+
import { open } from '@treinetic/treinetic-epub-reader';
|
|
77
|
+
open("path/to/book.epub");
|
|
72
78
|
```
|
|
73
79
|
|
|
74
80
|
### HTML Structure
|
|
@@ -36,3 +36,14 @@ declare const TreineticEpubReader: {
|
|
|
36
36
|
clearSettings: () => void;
|
|
37
37
|
};
|
|
38
38
|
export default TreineticEpubReader;
|
|
39
|
+
export declare const create: (selectorOrElement: string | HTMLElement) => ExternalControls | null;
|
|
40
|
+
export declare const init: (selectorOrElement: string | HTMLElement) => ExternalControls | null;
|
|
41
|
+
export declare const open: (epubUrlOrFolder: string) => void;
|
|
42
|
+
export declare const setScrollOption: (type: "auto" | "scroll-continuous") => void;
|
|
43
|
+
export declare const setTheme: (theme: string) => void;
|
|
44
|
+
export declare const registerTheme: (theme: ReaderTheme) => void;
|
|
45
|
+
export declare const clearSettings: () => void;
|
|
46
|
+
export declare const setFontSize: (size: number) => void;
|
|
47
|
+
export declare const goToPage: (href: string) => void;
|
|
48
|
+
export declare const nextPage: () => void;
|
|
49
|
+
export declare const prevPage: () => void;
|
|
@@ -415,9 +415,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
415
415
|
var z = 0;
|
|
416
416
|
g && (z |= 8), P || !R && !r || (z |= 2048);
|
|
417
417
|
var I = 0, J = 0;
|
|
418
|
-
et && (I |= 16), c === "UNIX" ? (J = 798, I |= function(q,
|
|
418
|
+
et && (I |= 16), c === "UNIX" ? (J = 798, I |= function(q, ot) {
|
|
419
419
|
var dt = q;
|
|
420
|
-
return q || (dt =
|
|
420
|
+
return q || (dt = ot ? 16893 : 33204), (65535 & dt) << 16;
|
|
421
421
|
}(E.unixPermissions, et)) : (J = 20, I |= function(q) {
|
|
422
422
|
return 63 & (q || 0);
|
|
423
423
|
}(E.dosPermissions)), x = j.getUTCHours(), x <<= 6, x |= j.getUTCMinutes(), x <<= 5, x |= j.getUTCSeconds() / 2, C = j.getUTCFullYear() - 1980, C <<= 4, C |= j.getUTCMonth() + 1, C <<= 5, C |= j.getUTCDate(), R && (tt = s(1, 1) + s(b(U), 4) + T, B += "up" + s(tt.length, 2) + tt), r && (W = s(1, 1) + s(b(X), 4) + k, B += "uc" + s(W.length, 2) + W);
|
|
@@ -1671,23 +1671,23 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1671
1671
|
t.pending_buf[t.pending++] = F >>> 8 & 255, t.pending_buf[t.pending++] = 255 & F;
|
|
1672
1672
|
}
|
|
1673
1673
|
function q(t, F) {
|
|
1674
|
-
var O, m, d = t.max_chain_length, S = t.strstart, L = t.prev_length, N = t.nice_match, A = t.strstart > t.w_size - X ? t.strstart - (t.w_size - X) : 0, Z = t.window, K = t.w_mask, G = t.prev, Y = t.strstart + M,
|
|
1674
|
+
var O, m, d = t.max_chain_length, S = t.strstart, L = t.prev_length, N = t.nice_match, A = t.strstart > t.w_size - X ? t.strstart - (t.w_size - X) : 0, Z = t.window, K = t.w_mask, G = t.prev, Y = t.strstart + M, at = Z[S + L - 1], nt = Z[S + L];
|
|
1675
1675
|
t.prev_length >= t.good_match && (d >>= 2), N > t.lookahead && (N = t.lookahead);
|
|
1676
1676
|
do
|
|
1677
|
-
if (Z[(O = F) + L] === nt && Z[O + L - 1] ===
|
|
1677
|
+
if (Z[(O = F) + L] === nt && Z[O + L - 1] === at && Z[O] === Z[S] && Z[++O] === Z[S + 1]) {
|
|
1678
1678
|
S += 2, O++;
|
|
1679
1679
|
do
|
|
1680
1680
|
;
|
|
1681
1681
|
while (Z[++S] === Z[++O] && Z[++S] === Z[++O] && Z[++S] === Z[++O] && Z[++S] === Z[++O] && Z[++S] === Z[++O] && Z[++S] === Z[++O] && Z[++S] === Z[++O] && Z[++S] === Z[++O] && S < Y);
|
|
1682
1682
|
if (m = M - (Y - S), S = Y - M, L < m) {
|
|
1683
1683
|
if (t.match_start = F, N <= (L = m)) break;
|
|
1684
|
-
|
|
1684
|
+
at = Z[S + L - 1], nt = Z[S + L];
|
|
1685
1685
|
}
|
|
1686
1686
|
}
|
|
1687
1687
|
while ((F = G[F & K]) > A && --d != 0);
|
|
1688
1688
|
return L <= t.lookahead ? L : t.lookahead;
|
|
1689
1689
|
}
|
|
1690
|
-
function
|
|
1690
|
+
function ot(t) {
|
|
1691
1691
|
var F, O, m, d, S, L, N, A, Z, K, G = t.w_size;
|
|
1692
1692
|
do {
|
|
1693
1693
|
if (d = t.window_size - t.lookahead - t.strstart, t.strstart >= G + (G - X)) {
|
|
@@ -1702,7 +1702,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1702
1702
|
function dt(t, F) {
|
|
1703
1703
|
for (var O, m; ; ) {
|
|
1704
1704
|
if (t.lookahead < X) {
|
|
1705
|
-
if (
|
|
1705
|
+
if (ot(t), t.lookahead < X && F === _) return r;
|
|
1706
1706
|
if (t.lookahead === 0) break;
|
|
1707
1707
|
}
|
|
1708
1708
|
if (O = 0, t.lookahead >= T && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + T - 1]) & t.hash_mask, O = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), O !== 0 && t.strstart - O <= t.w_size - X && (t.match_length = q(t, O)), t.match_length >= T) if (m = n._tr_tally(t, t.strstart - t.match_start, t.match_length - T), t.lookahead -= t.match_length, t.match_length <= t.max_lazy_match && t.lookahead >= T) {
|
|
@@ -1717,7 +1717,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1717
1717
|
function rt(t, F) {
|
|
1718
1718
|
for (var O, m, d; ; ) {
|
|
1719
1719
|
if (t.lookahead < X) {
|
|
1720
|
-
if (
|
|
1720
|
+
if (ot(t), t.lookahead < X && F === _) return r;
|
|
1721
1721
|
if (t.lookahead === 0) break;
|
|
1722
1722
|
}
|
|
1723
1723
|
if (O = 0, t.lookahead >= T && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + T - 1]) & t.hash_mask, O = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), t.prev_length = t.match_length, t.prev_match = t.match_start, t.match_length = T - 1, O !== 0 && t.prev_length < t.max_lazy_match && t.strstart - O <= t.w_size - X && (t.match_length = q(t, O), t.match_length <= 5 && (t.strategy === 1 || t.match_length === T && 4096 < t.strstart - t.match_start) && (t.match_length = T - 1)), t.prev_length >= T && t.match_length <= t.prev_length) {
|
|
@@ -1729,18 +1729,18 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1729
1729
|
}
|
|
1730
1730
|
return t.match_available && (m = n._tr_tally(t, 0, t.window[t.strstart - 1]), t.match_available = 0), t.insert = t.strstart < T - 1 ? t.strstart : T - 1, F === v ? (I(t, !0), t.strm.avail_out === 0 ? tt : W) : t.last_lit && (I(t, !1), t.strm.avail_out === 0) ? r : B;
|
|
1731
1731
|
}
|
|
1732
|
-
function
|
|
1732
|
+
function st(t, F, O, m, d) {
|
|
1733
1733
|
this.good_length = t, this.max_lazy = F, this.nice_length = O, this.max_chain = m, this.func = d;
|
|
1734
1734
|
}
|
|
1735
1735
|
function ut() {
|
|
1736
1736
|
this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = y, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new o.Buf16(2 * P), this.dyn_dtree = new o.Buf16(2 * (2 * E + 1)), this.bl_tree = new o.Buf16(2 * (2 * D + 1)), Q(this.dyn_ltree), Q(this.dyn_dtree), Q(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new o.Buf16(U + 1), this.heap = new o.Buf16(2 * C + 1), Q(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new o.Buf16(2 * C + 1), Q(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
|
|
1737
1737
|
}
|
|
1738
|
-
function
|
|
1738
|
+
function lt(t) {
|
|
1739
1739
|
var F;
|
|
1740
1740
|
return t && t.state ? (t.total_in = t.total_out = 0, t.data_type = c, (F = t.state).pending = 0, F.pending_out = 0, F.wrap < 0 && (F.wrap = -F.wrap), F.status = F.wrap ? k : R, t.adler = F.wrap === 2 ? 0 : 1, F.last_flush = _, n._tr_init(F), a) : et(t, g);
|
|
1741
1741
|
}
|
|
1742
1742
|
function _t(t) {
|
|
1743
|
-
var F =
|
|
1743
|
+
var F = lt(t);
|
|
1744
1744
|
return F === a && function(O) {
|
|
1745
1745
|
O.window_size = 2 * O.w_size, Q(O.head), O.max_lazy_match = s[O.level].max_lazy, O.good_match = s[O.level].good_length, O.nice_match = s[O.level].nice_length, O.max_chain_length = s[O.level].max_chain, O.strstart = 0, O.block_start = 0, O.lookahead = 0, O.insert = 0, O.match_length = O.prev_length = T - 1, O.match_available = 0, O.ins_h = 0;
|
|
1746
1746
|
}(t.state), F;
|
|
@@ -1753,11 +1753,11 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1753
1753
|
var N = new ut();
|
|
1754
1754
|
return (t.state = N).strm = t, N.wrap = L, N.gzhead = null, N.w_bits = m, N.w_size = 1 << N.w_bits, N.w_mask = N.w_size - 1, N.hash_bits = d + 7, N.hash_size = 1 << N.hash_bits, N.hash_mask = N.hash_size - 1, N.hash_shift = ~~((N.hash_bits + T - 1) / T), N.window = new o.Buf8(2 * N.w_size), N.head = new o.Buf16(N.hash_size), N.prev = new o.Buf16(N.w_size), N.lit_bufsize = 1 << d + 6, N.pending_buf_size = 4 * N.lit_bufsize, N.pending_buf = new o.Buf8(N.pending_buf_size), N.d_buf = 1 * N.lit_bufsize, N.l_buf = 3 * N.lit_bufsize, N.level = F, N.strategy = S, N.method = O, _t(t);
|
|
1755
1755
|
}
|
|
1756
|
-
s = [new
|
|
1756
|
+
s = [new st(0, 0, 0, 0, function(t, F) {
|
|
1757
1757
|
var O = 65535;
|
|
1758
1758
|
for (O > t.pending_buf_size - 5 && (O = t.pending_buf_size - 5); ; ) {
|
|
1759
1759
|
if (t.lookahead <= 1) {
|
|
1760
|
-
if (
|
|
1760
|
+
if (ot(t), t.lookahead === 0 && F === _) return r;
|
|
1761
1761
|
if (t.lookahead === 0) break;
|
|
1762
1762
|
}
|
|
1763
1763
|
t.strstart += t.lookahead, t.lookahead = 0;
|
|
@@ -1765,9 +1765,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1765
1765
|
if ((t.strstart === 0 || t.strstart >= m) && (t.lookahead = t.strstart - m, t.strstart = m, I(t, !1), t.strm.avail_out === 0) || t.strstart - t.block_start >= t.w_size - X && (I(t, !1), t.strm.avail_out === 0)) return r;
|
|
1766
1766
|
}
|
|
1767
1767
|
return t.insert = 0, F === v ? (I(t, !0), t.strm.avail_out === 0 ? tt : W) : (t.strstart > t.block_start && (I(t, !1), t.strm.avail_out), r);
|
|
1768
|
-
}), new
|
|
1768
|
+
}), new st(4, 4, 8, 4, dt), new st(4, 5, 16, 8, dt), new st(4, 6, 32, 32, dt), new st(4, 4, 16, 16, rt), new st(8, 16, 32, 32, rt), new st(8, 16, 128, 128, rt), new st(8, 32, 128, 256, rt), new st(32, 128, 258, 1024, rt), new st(32, 258, 258, 4096, rt)], u.deflateInit = function(t, F) {
|
|
1769
1769
|
return gt(t, F, y, 15, 8, 0);
|
|
1770
|
-
}, u.deflateInit2 = gt, u.deflateReset = _t, u.deflateResetKeep =
|
|
1770
|
+
}, u.deflateInit2 = gt, u.deflateReset = _t, u.deflateResetKeep = lt, u.deflateSetHeader = function(t, F) {
|
|
1771
1771
|
return t && t.state ? t.state.wrap !== 2 ? g : (t.state.gzhead = F, a) : g;
|
|
1772
1772
|
}, u.deflate = function(t, F) {
|
|
1773
1773
|
var O, m, d, S;
|
|
@@ -1811,7 +1811,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1811
1811
|
if (t.avail_in !== 0 || m.lookahead !== 0 || F !== _ && m.status !== 666) {
|
|
1812
1812
|
var N = m.strategy === 2 ? function(A, Z) {
|
|
1813
1813
|
for (var K; ; ) {
|
|
1814
|
-
if (A.lookahead === 0 && (
|
|
1814
|
+
if (A.lookahead === 0 && (ot(A), A.lookahead === 0)) {
|
|
1815
1815
|
if (Z === _) return r;
|
|
1816
1816
|
break;
|
|
1817
1817
|
}
|
|
@@ -1819,17 +1819,17 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1819
1819
|
}
|
|
1820
1820
|
return A.insert = 0, Z === v ? (I(A, !0), A.strm.avail_out === 0 ? tt : W) : A.last_lit && (I(A, !1), A.strm.avail_out === 0) ? r : B;
|
|
1821
1821
|
}(m, F) : m.strategy === 3 ? function(A, Z) {
|
|
1822
|
-
for (var K, G, Y,
|
|
1822
|
+
for (var K, G, Y, at, nt = A.window; ; ) {
|
|
1823
1823
|
if (A.lookahead <= M) {
|
|
1824
|
-
if (
|
|
1824
|
+
if (ot(A), A.lookahead <= M && Z === _) return r;
|
|
1825
1825
|
if (A.lookahead === 0) break;
|
|
1826
1826
|
}
|
|
1827
1827
|
if (A.match_length = 0, A.lookahead >= T && 0 < A.strstart && (G = nt[Y = A.strstart - 1]) === nt[++Y] && G === nt[++Y] && G === nt[++Y]) {
|
|
1828
|
-
|
|
1828
|
+
at = A.strstart + M;
|
|
1829
1829
|
do
|
|
1830
1830
|
;
|
|
1831
|
-
while (G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && Y <
|
|
1832
|
-
A.match_length = M - (
|
|
1831
|
+
while (G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && G === nt[++Y] && Y < at);
|
|
1832
|
+
A.match_length = M - (at - Y), A.match_length > A.lookahead && (A.match_length = A.lookahead);
|
|
1833
1833
|
}
|
|
1834
1834
|
if (A.match_length >= T ? (K = n._tr_tally(A, 1, A.match_length - T), A.lookahead -= A.match_length, A.strstart += A.match_length, A.match_length = 0) : (K = n._tr_tally(A, 0, A.window[A.strstart]), A.lookahead--, A.strstart++), K && (I(A, !1), A.strm.avail_out === 0)) return r;
|
|
1835
1835
|
}
|
|
@@ -1845,9 +1845,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1845
1845
|
}, u.deflateSetDictionary = function(t, F) {
|
|
1846
1846
|
var O, m, d, S, L, N, A, Z, K = F.length;
|
|
1847
1847
|
if (!t || !t.state || (S = (O = t.state).wrap) === 2 || S === 1 && O.status !== k || O.lookahead) return g;
|
|
1848
|
-
for (S === 1 && (t.adler = h(t.adler, F, K, 0)), O.wrap = 0, K >= O.w_size && (S === 0 && (Q(O.head), O.strstart = 0, O.block_start = 0, O.insert = 0), Z = new o.Buf8(O.w_size), o.arraySet(Z, F, K - O.w_size, O.w_size, 0), F = Z, K = O.w_size), L = t.avail_in, N = t.next_in, A = t.input, t.avail_in = K, t.next_in = 0, t.input = F,
|
|
1848
|
+
for (S === 1 && (t.adler = h(t.adler, F, K, 0)), O.wrap = 0, K >= O.w_size && (S === 0 && (Q(O.head), O.strstart = 0, O.block_start = 0, O.insert = 0), Z = new o.Buf8(O.w_size), o.arraySet(Z, F, K - O.w_size, O.w_size, 0), F = Z, K = O.w_size), L = t.avail_in, N = t.next_in, A = t.input, t.avail_in = K, t.next_in = 0, t.input = F, ot(O); O.lookahead >= T; ) {
|
|
1849
1849
|
for (m = O.strstart, d = O.lookahead - (T - 1); O.ins_h = (O.ins_h << O.hash_shift ^ O.window[m + T - 1]) & O.hash_mask, O.prev[m & O.w_mask] = O.head[O.ins_h], O.head[O.ins_h] = m, m++, --d; ) ;
|
|
1850
|
-
O.strstart = m, O.lookahead = T - 1,
|
|
1850
|
+
O.strstart = m, O.lookahead = T - 1, ot(O);
|
|
1851
1851
|
}
|
|
1852
1852
|
return O.strstart += O.lookahead, O.block_start = O.strstart, O.insert = O.lookahead, O.lookahead = 0, O.match_length = O.prev_length = T - 1, O.match_available = 0, t.next_in = N, t.input = A, t.avail_in = L, O.wrap = S, a;
|
|
1853
1853
|
}, u.deflateInfo = "pako deflate (from Nodeca project)";
|
|
@@ -1970,7 +1970,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
1970
1970
|
u.inflateReset = C, u.inflateReset2 = E, u.inflateResetKeep = x, u.inflateInit = function(k) {
|
|
1971
1971
|
return D(k, 15);
|
|
1972
1972
|
}, u.inflateInit2 = D, u.inflate = function(k, R) {
|
|
1973
|
-
var r, B, tt, W, et, j, Q, z, I, J, V, q,
|
|
1973
|
+
var r, B, tt, W, et, j, Q, z, I, J, V, q, ot, dt, rt, st, ut, lt, _t, gt, t, F, O, m, d = 0, S = new s.Buf8(4), L = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
|
|
1974
1974
|
if (!k || !k.state || !k.output || !k.input && k.avail_in !== 0) return a;
|
|
1975
1975
|
(r = k.state).mode === 12 && (r.mode = 13), et = k.next_out, tt = k.output, Q = k.avail_out, W = k.next_in, B = k.input, j = k.avail_in, z = r.hold, I = r.bits, J = j, V = Q, F = v;
|
|
1976
1976
|
t: for (; ; ) switch (r.mode) {
|
|
@@ -2150,7 +2150,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2150
2150
|
r.have = 0, r.mode = 19;
|
|
2151
2151
|
case 19:
|
|
2152
2152
|
for (; r.have < r.nlen + r.ndist; ) {
|
|
2153
|
-
for (;
|
|
2153
|
+
for (; st = (d = r.lencode[z & (1 << r.lenbits) - 1]) >>> 16 & 255, ut = 65535 & d, !((rt = d >>> 24) <= I); ) {
|
|
2154
2154
|
if (j === 0) break t;
|
|
2155
2155
|
j--, z += B[W++] << I, I += 8;
|
|
2156
2156
|
}
|
|
@@ -2207,30 +2207,30 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2207
2207
|
k.next_out = et, k.avail_out = Q, k.next_in = W, k.avail_in = j, r.hold = z, r.bits = I, h(k, V), et = k.next_out, tt = k.output, Q = k.avail_out, W = k.next_in, B = k.input, j = k.avail_in, z = r.hold, I = r.bits, r.mode === 12 && (r.back = -1);
|
|
2208
2208
|
break;
|
|
2209
2209
|
}
|
|
2210
|
-
for (r.back = 0;
|
|
2210
|
+
for (r.back = 0; st = (d = r.lencode[z & (1 << r.lenbits) - 1]) >>> 16 & 255, ut = 65535 & d, !((rt = d >>> 24) <= I); ) {
|
|
2211
2211
|
if (j === 0) break t;
|
|
2212
2212
|
j--, z += B[W++] << I, I += 8;
|
|
2213
2213
|
}
|
|
2214
|
-
if (
|
|
2215
|
-
for (
|
|
2214
|
+
if (st && !(240 & st)) {
|
|
2215
|
+
for (lt = rt, _t = st, gt = ut; st = (d = r.lencode[gt + ((z & (1 << lt + _t) - 1) >> lt)]) >>> 16 & 255, ut = 65535 & d, !(lt + (rt = d >>> 24) <= I); ) {
|
|
2216
2216
|
if (j === 0) break t;
|
|
2217
2217
|
j--, z += B[W++] << I, I += 8;
|
|
2218
2218
|
}
|
|
2219
|
-
z >>>=
|
|
2219
|
+
z >>>= lt, I -= lt, r.back += lt;
|
|
2220
2220
|
}
|
|
2221
|
-
if (z >>>= rt, I -= rt, r.back += rt, r.length = ut,
|
|
2221
|
+
if (z >>>= rt, I -= rt, r.back += rt, r.length = ut, st === 0) {
|
|
2222
2222
|
r.mode = 26;
|
|
2223
2223
|
break;
|
|
2224
2224
|
}
|
|
2225
|
-
if (32 &
|
|
2225
|
+
if (32 & st) {
|
|
2226
2226
|
r.back = -1, r.mode = 12;
|
|
2227
2227
|
break;
|
|
2228
2228
|
}
|
|
2229
|
-
if (64 &
|
|
2229
|
+
if (64 & st) {
|
|
2230
2230
|
k.msg = "invalid literal/length code", r.mode = 30;
|
|
2231
2231
|
break;
|
|
2232
2232
|
}
|
|
2233
|
-
r.extra = 15 &
|
|
2233
|
+
r.extra = 15 & st, r.mode = 22;
|
|
2234
2234
|
case 22:
|
|
2235
2235
|
if (r.extra) {
|
|
2236
2236
|
for (m = r.extra; I < m; ) {
|
|
@@ -2241,22 +2241,22 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2241
2241
|
}
|
|
2242
2242
|
r.was = r.length, r.mode = 23;
|
|
2243
2243
|
case 23:
|
|
2244
|
-
for (;
|
|
2244
|
+
for (; st = (d = r.distcode[z & (1 << r.distbits) - 1]) >>> 16 & 255, ut = 65535 & d, !((rt = d >>> 24) <= I); ) {
|
|
2245
2245
|
if (j === 0) break t;
|
|
2246
2246
|
j--, z += B[W++] << I, I += 8;
|
|
2247
2247
|
}
|
|
2248
|
-
if (!(240 &
|
|
2249
|
-
for (
|
|
2248
|
+
if (!(240 & st)) {
|
|
2249
|
+
for (lt = rt, _t = st, gt = ut; st = (d = r.distcode[gt + ((z & (1 << lt + _t) - 1) >> lt)]) >>> 16 & 255, ut = 65535 & d, !(lt + (rt = d >>> 24) <= I); ) {
|
|
2250
2250
|
if (j === 0) break t;
|
|
2251
2251
|
j--, z += B[W++] << I, I += 8;
|
|
2252
2252
|
}
|
|
2253
|
-
z >>>=
|
|
2253
|
+
z >>>= lt, I -= lt, r.back += lt;
|
|
2254
2254
|
}
|
|
2255
|
-
if (z >>>= rt, I -= rt, r.back += rt, 64 &
|
|
2255
|
+
if (z >>>= rt, I -= rt, r.back += rt, 64 & st) {
|
|
2256
2256
|
k.msg = "invalid distance code", r.mode = 30;
|
|
2257
2257
|
break;
|
|
2258
2258
|
}
|
|
2259
|
-
r.offset = ut, r.extra = 15 &
|
|
2259
|
+
r.offset = ut, r.extra = 15 & st, r.mode = 24;
|
|
2260
2260
|
case 24:
|
|
2261
2261
|
if (r.extra) {
|
|
2262
2262
|
for (m = r.extra; I < m; ) {
|
|
@@ -2277,9 +2277,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2277
2277
|
k.msg = "invalid distance too far back", r.mode = 30;
|
|
2278
2278
|
break;
|
|
2279
2279
|
}
|
|
2280
|
-
|
|
2281
|
-
} else dt = tt,
|
|
2282
|
-
for (Q < q && (q = Q), Q -= q, r.length -= q; tt[et++] = dt[
|
|
2280
|
+
ot = q > r.wnext ? (q -= r.wnext, r.wsize - q) : r.wnext - q, q > r.length && (q = r.length), dt = r.window;
|
|
2281
|
+
} else dt = tt, ot = et - r.offset, q = r.length;
|
|
2282
|
+
for (Q < q && (q = Q), Q -= q, r.length -= q; tt[et++] = dt[ot++], --q; ) ;
|
|
2283
2283
|
r.length === 0 && (r.mode = 21);
|
|
2284
2284
|
break;
|
|
2285
2285
|
case 26:
|
|
@@ -2339,7 +2339,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2339
2339
|
}, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, p, u) {
|
|
2340
2340
|
var s = e("../utils/common"), o = [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], n = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], h = [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, 0, 0], w = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
|
|
2341
2341
|
p.exports = function(b, _, v, a, g, i, f, c) {
|
|
2342
|
-
var y, x, C, E, D, P, U, T, M, X = c.bits, k = 0, R = 0, r = 0, B = 0, tt = 0, W = 0, et = 0, j = 0, Q = 0, z = 0, I = null, J = 0, V = new s.Buf16(16), q = new s.Buf16(16),
|
|
2342
|
+
var y, x, C, E, D, P, U, T, M, X = c.bits, k = 0, R = 0, r = 0, B = 0, tt = 0, W = 0, et = 0, j = 0, Q = 0, z = 0, I = null, J = 0, V = new s.Buf16(16), q = new s.Buf16(16), ot = null, dt = 0;
|
|
2343
2343
|
for (k = 0; k <= 15; k++) V[k] = 0;
|
|
2344
2344
|
for (R = 0; R < a; R++) V[_[v + R]]++;
|
|
2345
2345
|
for (tt = X, B = 15; 1 <= B && V[B] === 0; B--) ;
|
|
@@ -2349,9 +2349,9 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2349
2349
|
if (0 < j && (b === 0 || B !== 1)) return -1;
|
|
2350
2350
|
for (q[1] = 0, k = 1; k < 15; k++) q[k + 1] = q[k] + V[k];
|
|
2351
2351
|
for (R = 0; R < a; R++) _[v + R] !== 0 && (f[q[_[v + R]]++] = R);
|
|
2352
|
-
if (P = b === 0 ? (I =
|
|
2352
|
+
if (P = b === 0 ? (I = ot = f, 19) : b === 1 ? (I = o, J -= 257, ot = n, dt -= 257, 256) : (I = h, ot = w, -1), k = r, D = i, et = R = z = 0, C = -1, E = (Q = 1 << (W = tt)) - 1, b === 1 && 852 < Q || b === 2 && 592 < Q) return 1;
|
|
2353
2353
|
for (; ; ) {
|
|
2354
|
-
for (U = k - et, M = f[R] < P ? (T = 0, f[R]) : f[R] > P ? (T =
|
|
2354
|
+
for (U = k - et, M = f[R] < P ? (T = 0, f[R]) : f[R] > P ? (T = ot[dt + f[R]], I[J + f[R]]) : (T = 96, 0), y = 1 << k - et, r = x = 1 << W; g[D + (z >> et) + (x -= y)] = U << 24 | T << 16 | M | 0, x !== 0; ) ;
|
|
2355
2355
|
for (y = 1 << k - 1; z & y; ) y >>= 1;
|
|
2356
2356
|
if (y !== 0 ? (z &= y - 1, z += y) : z = 0, R++, --V[k] == 0) {
|
|
2357
2357
|
if (k === B) break;
|
|
@@ -2401,7 +2401,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2401
2401
|
function q(d, S, L) {
|
|
2402
2402
|
V(d, L[2 * S], L[2 * S + 1]);
|
|
2403
2403
|
}
|
|
2404
|
-
function
|
|
2404
|
+
function ot(d, S) {
|
|
2405
2405
|
for (var L = 0; L |= 1 & d, d >>>= 1, L <<= 1, 0 < --S; ) ;
|
|
2406
2406
|
return L >>> 1;
|
|
2407
2407
|
}
|
|
@@ -2410,7 +2410,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2410
2410
|
for (N = 1; N <= f; N++) Z[N] = K = K + L[N - 1] << 1;
|
|
2411
2411
|
for (A = 0; A <= S; A++) {
|
|
2412
2412
|
var G = d[2 * A + 1];
|
|
2413
|
-
G !== 0 && (d[2 * A] =
|
|
2413
|
+
G !== 0 && (d[2 * A] = ot(Z[G]++, G));
|
|
2414
2414
|
}
|
|
2415
2415
|
}
|
|
2416
2416
|
function rt(d) {
|
|
@@ -2420,14 +2420,14 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2420
2420
|
for (S = 0; S < g; S++) d.bl_tree[2 * S] = 0;
|
|
2421
2421
|
d.dyn_ltree[2 * x] = 1, d.opt_len = d.static_len = 0, d.last_lit = d.matches = 0;
|
|
2422
2422
|
}
|
|
2423
|
-
function
|
|
2423
|
+
function st(d) {
|
|
2424
2424
|
8 < d.bi_valid ? J(d, d.bi_buf) : 0 < d.bi_valid && (d.pending_buf[d.pending++] = d.bi_buf), d.bi_buf = 0, d.bi_valid = 0;
|
|
2425
2425
|
}
|
|
2426
2426
|
function ut(d, S, L, N) {
|
|
2427
2427
|
var A = 2 * S, Z = 2 * L;
|
|
2428
2428
|
return d[A] < d[Z] || d[A] === d[Z] && N[S] <= N[L];
|
|
2429
2429
|
}
|
|
2430
|
-
function
|
|
2430
|
+
function lt(d, S, L) {
|
|
2431
2431
|
for (var N = d.heap[L], A = L << 1; A <= d.heap_len && (A < d.heap_len && ut(S, d.heap[A + 1], d.heap[A], d.depth) && A++, !ut(S, N, d.heap[A], d.depth)); ) d.heap[L] = d.heap[A], L = A, A <<= 1;
|
|
2432
2432
|
d.heap[L] = N;
|
|
2433
2433
|
}
|
|
@@ -2437,41 +2437,41 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2437
2437
|
q(d, x, S);
|
|
2438
2438
|
}
|
|
2439
2439
|
function gt(d, S) {
|
|
2440
|
-
var L, N, A, Z = S.dyn_tree, K = S.stat_desc.static_tree, G = S.stat_desc.has_stree, Y = S.stat_desc.elems,
|
|
2441
|
-
for (d.heap_len = 0, d.heap_max = i, L = 0; L < Y; L++) Z[2 * L] !== 0 ? (d.heap[++d.heap_len] =
|
|
2442
|
-
for (; d.heap_len < 2; ) Z[2 * (A = d.heap[++d.heap_len] =
|
|
2443
|
-
for (S.max_code =
|
|
2444
|
-
for (A = Y; L = d.heap[1], d.heap[1] = d.heap[d.heap_len--],
|
|
2440
|
+
var L, N, A, Z = S.dyn_tree, K = S.stat_desc.static_tree, G = S.stat_desc.has_stree, Y = S.stat_desc.elems, at = -1;
|
|
2441
|
+
for (d.heap_len = 0, d.heap_max = i, L = 0; L < Y; L++) Z[2 * L] !== 0 ? (d.heap[++d.heap_len] = at = L, d.depth[L] = 0) : Z[2 * L + 1] = 0;
|
|
2442
|
+
for (; d.heap_len < 2; ) Z[2 * (A = d.heap[++d.heap_len] = at < 2 ? ++at : 0)] = 1, d.depth[A] = 0, d.opt_len--, G && (d.static_len -= K[2 * A + 1]);
|
|
2443
|
+
for (S.max_code = at, L = d.heap_len >> 1; 1 <= L; L--) lt(d, Z, L);
|
|
2444
|
+
for (A = Y; L = d.heap[1], d.heap[1] = d.heap[d.heap_len--], lt(d, Z, 1), N = d.heap[1], d.heap[--d.heap_max] = L, d.heap[--d.heap_max] = N, Z[2 * A] = Z[2 * L] + Z[2 * N], d.depth[A] = (d.depth[L] >= d.depth[N] ? d.depth[L] : d.depth[N]) + 1, Z[2 * L + 1] = Z[2 * N + 1] = A, d.heap[1] = A++, lt(d, Z, 1), 2 <= d.heap_len; ) ;
|
|
2445
2445
|
d.heap[--d.heap_max] = d.heap[1], function(nt, mt) {
|
|
2446
|
-
var xt, yt, St,
|
|
2447
|
-
for (
|
|
2448
|
-
for (bt[2 * nt.heap[nt.heap_max] + 1] = 0, xt = nt.heap_max + 1; xt < i; xt++) Et < (
|
|
2446
|
+
var xt, yt, St, ht, At, Dt, bt = mt.dyn_tree, Bt = mt.max_code, Ut = mt.stat_desc.static_tree, Wt = mt.stat_desc.has_stree, jt = mt.stat_desc.extra_bits, Lt = mt.stat_desc.extra_base, Et = mt.stat_desc.max_length, It = 0;
|
|
2447
|
+
for (ht = 0; ht <= f; ht++) nt.bl_count[ht] = 0;
|
|
2448
|
+
for (bt[2 * nt.heap[nt.heap_max] + 1] = 0, xt = nt.heap_max + 1; xt < i; xt++) Et < (ht = bt[2 * bt[2 * (yt = nt.heap[xt]) + 1] + 1] + 1) && (ht = Et, It++), bt[2 * yt + 1] = ht, Bt < yt || (nt.bl_count[ht]++, At = 0, Lt <= yt && (At = jt[yt - Lt]), Dt = bt[2 * yt], nt.opt_len += Dt * (ht + At), Wt && (nt.static_len += Dt * (Ut[2 * yt + 1] + At)));
|
|
2449
2449
|
if (It !== 0) {
|
|
2450
2450
|
do {
|
|
2451
|
-
for (
|
|
2452
|
-
nt.bl_count[
|
|
2451
|
+
for (ht = Et - 1; nt.bl_count[ht] === 0; ) ht--;
|
|
2452
|
+
nt.bl_count[ht]--, nt.bl_count[ht + 1] += 2, nt.bl_count[Et]--, It -= 2;
|
|
2453
2453
|
} while (0 < It);
|
|
2454
|
-
for (
|
|
2454
|
+
for (ht = Et; ht !== 0; ht--) for (yt = nt.bl_count[ht]; yt !== 0; ) Bt < (St = nt.heap[--xt]) || (bt[2 * St + 1] !== ht && (nt.opt_len += (ht - bt[2 * St + 1]) * bt[2 * St], bt[2 * St + 1] = ht), yt--);
|
|
2455
2455
|
}
|
|
2456
|
-
}(d, S), dt(Z,
|
|
2456
|
+
}(d, S), dt(Z, at, d.bl_count);
|
|
2457
2457
|
}
|
|
2458
2458
|
function t(d, S, L) {
|
|
2459
|
-
var N, A, Z = -1, K = S[1], G = 0, Y = 7,
|
|
2460
|
-
for (K === 0 && (Y = 138,
|
|
2459
|
+
var N, A, Z = -1, K = S[1], G = 0, Y = 7, at = 4;
|
|
2460
|
+
for (K === 0 && (Y = 138, at = 3), S[2 * (L + 1) + 1] = 65535, N = 0; N <= L; N++) A = K, K = S[2 * (N + 1) + 1], ++G < Y && A === K || (G < at ? d.bl_tree[2 * A] += G : A !== 0 ? (A !== Z && d.bl_tree[2 * A]++, d.bl_tree[2 * C]++) : G <= 10 ? d.bl_tree[2 * E]++ : d.bl_tree[2 * D]++, Z = A, at = (G = 0) === K ? (Y = 138, 3) : A === K ? (Y = 6, 3) : (Y = 7, 4));
|
|
2461
2461
|
}
|
|
2462
2462
|
function F(d, S, L) {
|
|
2463
|
-
var N, A, Z = -1, K = S[1], G = 0, Y = 7,
|
|
2464
|
-
for (K === 0 && (Y = 138,
|
|
2465
|
-
if (G <
|
|
2463
|
+
var N, A, Z = -1, K = S[1], G = 0, Y = 7, at = 4;
|
|
2464
|
+
for (K === 0 && (Y = 138, at = 3), N = 0; N <= L; N++) if (A = K, K = S[2 * (N + 1) + 1], !(++G < Y && A === K)) {
|
|
2465
|
+
if (G < at) for (; q(d, A, d.bl_tree), --G != 0; ) ;
|
|
2466
2466
|
else A !== 0 ? (A !== Z && (q(d, A, d.bl_tree), G--), q(d, C, d.bl_tree), V(d, G - 3, 2)) : G <= 10 ? (q(d, E, d.bl_tree), V(d, G - 3, 3)) : (q(d, D, d.bl_tree), V(d, G - 11, 7));
|
|
2467
|
-
Z = A,
|
|
2467
|
+
Z = A, at = (G = 0) === K ? (Y = 138, 3) : A === K ? (Y = 6, 3) : (Y = 7, 4);
|
|
2468
2468
|
}
|
|
2469
2469
|
}
|
|
2470
2470
|
h(j);
|
|
2471
2471
|
var O = !1;
|
|
2472
2472
|
function m(d, S, L, N) {
|
|
2473
2473
|
V(d, (w << 1) + (N ? 1 : 0), 3), function(A, Z, K, G) {
|
|
2474
|
-
|
|
2474
|
+
st(A), J(A, K), J(A, ~K), s.arraySet(A.pending_buf, A.window, Z, K, A.pending), A.pending += K;
|
|
2475
2475
|
}(d, S, L);
|
|
2476
2476
|
}
|
|
2477
2477
|
u._tr_init = function(d) {
|
|
@@ -2485,14 +2485,14 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2485
2485
|
for (; S <= 255; ) X[2 * S + 1] = 9, S++, K[9]++;
|
|
2486
2486
|
for (; S <= 279; ) X[2 * S + 1] = 7, S++, K[7]++;
|
|
2487
2487
|
for (; S <= 287; ) X[2 * S + 1] = 8, S++, K[8]++;
|
|
2488
|
-
for (dt(X, v + 1, K), S = 0; S < a; S++) k[2 * S + 1] = 5, k[2 * S] =
|
|
2488
|
+
for (dt(X, v + 1, K), S = 0; S < a; S++) k[2 * S + 1] = 5, k[2 * S] = ot(S, 5);
|
|
2489
2489
|
tt = new Q(X, P, _ + 1, v, f), W = new Q(k, U, 0, a, f), et = new Q(new Array(0), T, 0, g, y);
|
|
2490
2490
|
}(), O = !0), d.l_desc = new z(d.dyn_ltree, tt), d.d_desc = new z(d.dyn_dtree, W), d.bl_desc = new z(d.bl_tree, et), d.bi_buf = 0, d.bi_valid = 0, rt(d);
|
|
2491
2491
|
}, u._tr_stored_block = m, u._tr_flush_block = function(d, S, L, N) {
|
|
2492
2492
|
var A, Z, K = 0;
|
|
2493
2493
|
0 < d.level ? (d.strm.data_type === 2 && (d.strm.data_type = function(G) {
|
|
2494
|
-
var Y,
|
|
2495
|
-
for (Y = 0; Y <= 31; Y++,
|
|
2494
|
+
var Y, at = 4093624447;
|
|
2495
|
+
for (Y = 0; Y <= 31; Y++, at >>>= 1) if (1 & at && G.dyn_ltree[2 * Y] !== 0) return o;
|
|
2496
2496
|
if (G.dyn_ltree[18] !== 0 || G.dyn_ltree[20] !== 0 || G.dyn_ltree[26] !== 0) return n;
|
|
2497
2497
|
for (Y = 32; Y < _; Y++) if (G.dyn_ltree[2 * Y] !== 0) return n;
|
|
2498
2498
|
return o;
|
|
@@ -2500,11 +2500,11 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2500
2500
|
var Y;
|
|
2501
2501
|
for (t(G, G.dyn_ltree, G.l_desc.max_code), t(G, G.dyn_dtree, G.d_desc.max_code), gt(G, G.bl_desc), Y = g - 1; 3 <= Y && G.bl_tree[2 * M[Y] + 1] === 0; Y--) ;
|
|
2502
2502
|
return G.opt_len += 3 * (Y + 1) + 5 + 5 + 4, Y;
|
|
2503
|
-
}(d), A = d.opt_len + 3 + 7 >>> 3, (Z = d.static_len + 3 + 7 >>> 3) <= A && (A = Z)) : A = Z = L + 5, L + 4 <= A && S !== -1 ? m(d, S, L, N) : d.strategy === 4 || Z === A ? (V(d, 2 + (N ? 1 : 0), 3), _t(d, X, k)) : (V(d, 4 + (N ? 1 : 0), 3), function(G, Y,
|
|
2503
|
+
}(d), A = d.opt_len + 3 + 7 >>> 3, (Z = d.static_len + 3 + 7 >>> 3) <= A && (A = Z)) : A = Z = L + 5, L + 4 <= A && S !== -1 ? m(d, S, L, N) : d.strategy === 4 || Z === A ? (V(d, 2 + (N ? 1 : 0), 3), _t(d, X, k)) : (V(d, 4 + (N ? 1 : 0), 3), function(G, Y, at, nt) {
|
|
2504
2504
|
var mt;
|
|
2505
|
-
for (V(G, Y - 257, 5), V(G,
|
|
2506
|
-
F(G, G.dyn_ltree, Y - 1), F(G, G.dyn_dtree,
|
|
2507
|
-
}(d, d.l_desc.max_code + 1, d.d_desc.max_code + 1, K + 1), _t(d, d.dyn_ltree, d.dyn_dtree)), rt(d), N &&
|
|
2505
|
+
for (V(G, Y - 257, 5), V(G, at - 1, 5), V(G, nt - 4, 4), mt = 0; mt < nt; mt++) V(G, G.bl_tree[2 * M[mt] + 1], 3);
|
|
2506
|
+
F(G, G.dyn_ltree, Y - 1), F(G, G.dyn_dtree, at - 1);
|
|
2507
|
+
}(d, d.l_desc.max_code + 1, d.d_desc.max_code + 1, K + 1), _t(d, d.dyn_ltree, d.dyn_dtree)), rt(d), N && st(d);
|
|
2508
2508
|
}, u._tr_tally = function(d, S, L) {
|
|
2509
2509
|
return d.pending_buf[d.d_buf + 2 * d.last_lit] = S >>> 8 & 255, d.pending_buf[d.d_buf + 2 * d.last_lit + 1] = 255 & S, d.pending_buf[d.l_buf + d.last_lit] = 255 & L, d.last_lit++, S === 0 ? d.dyn_ltree[2 * L]++ : (d.matches++, S--, d.dyn_ltree[2 * (r[L] + _ + 1)]++, d.dyn_dtree[2 * I(S)]++), d.last_lit === d.lit_bufsize - 1;
|
|
2510
2510
|
}, u._tr_align = function(d) {
|
|
@@ -2596,7 +2596,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE
|
|
|
2596
2596
|
});
|
|
2597
2597
|
})(Nt);
|
|
2598
2598
|
var Gt = Nt.exports;
|
|
2599
|
-
const qt = /* @__PURE__ */ Ht(Gt),
|
|
2599
|
+
const qt = /* @__PURE__ */ Ht(Gt), ct = class ct {
|
|
2600
2600
|
constructor(l, e, p) {
|
|
2601
2601
|
$(this, "idref");
|
|
2602
2602
|
$(this, "href");
|
|
@@ -2615,7 +2615,7 @@ const qt = /* @__PURE__ */ Ht(Gt), ht = class ht {
|
|
|
2615
2615
|
this.idref = l.idref, this.href = l.href, this.cfi = l.cfi, this.linear = l.linear ? l.linear.toLowerCase() : "yes", this.page_spread = l.page_spread, this.index = e, this.spine = p, this.rendition_viewport = l.rendition_viewport, this.rendition_spread = l.rendition_spread, this.rendition_layout = l.rendition_layout, this.rendition_flow = l.rendition_flow, this.media_type = l.media_type, this.media_overlay_id = l.media_overlay_id, this.validateSpread();
|
|
2616
2616
|
}
|
|
2617
2617
|
validateSpread() {
|
|
2618
|
-
this.page_spread && this.page_spread !==
|
|
2618
|
+
this.page_spread && this.page_spread !== ct.SPREAD_LEFT && this.page_spread !== ct.SPREAD_RIGHT && this.page_spread !== ct.SPREAD_CENTER && console.warn(`${this.page_spread} is not a recognized spread type`);
|
|
2619
2619
|
}
|
|
2620
2620
|
// Helpers
|
|
2621
2621
|
isReflowable() {
|
|
@@ -2623,18 +2623,18 @@ const qt = /* @__PURE__ */ Ht(Gt), ht = class ht {
|
|
|
2623
2623
|
}
|
|
2624
2624
|
isFixedLayout() {
|
|
2625
2625
|
const l = this.getRenditionLayout();
|
|
2626
|
-
return l ? l ===
|
|
2626
|
+
return l ? l === ct.RENDITION_LAYOUT_PREPAGINATED : this.spine.package.isFixedLayout();
|
|
2627
2627
|
}
|
|
2628
2628
|
getRenditionLayout() {
|
|
2629
2629
|
return this.rendition_layout || this.spine.package.rendition_layout;
|
|
2630
2630
|
}
|
|
2631
2631
|
// Additional methods based on legacy SpineItem.js...
|
|
2632
2632
|
static alternateSpread(l) {
|
|
2633
|
-
return l ===
|
|
2633
|
+
return l === ct.SPREAD_LEFT ? ct.SPREAD_RIGHT : l === ct.SPREAD_RIGHT ? ct.SPREAD_LEFT : l;
|
|
2634
2634
|
}
|
|
2635
2635
|
};
|
|
2636
|
-
$(
|
|
2637
|
-
let Ft =
|
|
2636
|
+
$(ct, "readonlyRENDITION_LAYOUT_REFLOWABLE", "reflowable"), $(ct, "RENDITION_LAYOUT_PREPAGINATED", "pre-paginated"), $(ct, "SPREAD_LEFT", "page-spread-left"), $(ct, "SPREAD_RIGHT", "page-spread-right"), $(ct, "SPREAD_CENTER", "page-spread-center"), $(ct, "SPREAD_NONE", "none"), $(ct, "SPREAD_AUTO", "auto"), $(ct, "FLOW_PAGINATED", "paginated"), $(ct, "FLOW_SCROLLED_CONTINUOUS", "scrolled-continuous"), $(ct, "FLOW_SCROLLED_DOC", "scrolled-doc"), $(ct, "FLOW_AUTO", "auto");
|
|
2637
|
+
let Ft = ct;
|
|
2638
2638
|
class $t {
|
|
2639
2639
|
// Default behavior
|
|
2640
2640
|
constructor(l, e) {
|
|
@@ -3198,7 +3198,7 @@ class Yt {
|
|
|
3198
3198
|
}
|
|
3199
3199
|
}
|
|
3200
3200
|
}
|
|
3201
|
-
const
|
|
3201
|
+
const it = {
|
|
3202
3202
|
readium: null,
|
|
3203
3203
|
readerView: null,
|
|
3204
3204
|
// Added property
|
|
@@ -3208,47 +3208,47 @@ const ct = {
|
|
|
3208
3208
|
init: (H) => {
|
|
3209
3209
|
console.log("Initializing Modern TreineticEpubReader..."), ft.init();
|
|
3210
3210
|
let l;
|
|
3211
|
-
return typeof H == "string" ? l = document.querySelector(H) : l = H, l ? (
|
|
3211
|
+
return typeof H == "string" ? l = document.querySelector(H) : l = H, l ? (it.initReader(l), pt.getInstance()) : (console.error("TreineticEpubReader: Element not found", H), null);
|
|
3212
3212
|
},
|
|
3213
3213
|
/**
|
|
3214
3214
|
* Alias for init() to align with standard library patterns.
|
|
3215
3215
|
*/
|
|
3216
|
-
create: (H) =>
|
|
3216
|
+
create: (H) => it.init(H),
|
|
3217
3217
|
open: (H) => {
|
|
3218
3218
|
console.log("Opening: ", H);
|
|
3219
|
-
const l =
|
|
3220
|
-
|
|
3221
|
-
const e =
|
|
3219
|
+
const l = it.setReaderPreferences();
|
|
3220
|
+
it.ebookURL_filepath = H;
|
|
3221
|
+
const e = it.getOpenPageRequest(l, H);
|
|
3222
3222
|
let p = { syntheticSpread: "auto", scroll: "auto" };
|
|
3223
|
-
|
|
3223
|
+
it.embeded && l && l.reader && (p = l.reader), it.loadEpub(p, H, e);
|
|
3224
3224
|
},
|
|
3225
3225
|
initReader: (H) => {
|
|
3226
3226
|
H.classList.add("tr-epub-reader-element");
|
|
3227
|
-
const l =
|
|
3228
|
-
|
|
3227
|
+
const l = it.setReaderPreferences();
|
|
3228
|
+
it.readerView = new Yt(H), ft.init(), ft.on(ft.PageNext, "reader", () => it.nextPage()), ft.on(ft.PagePrevious, "reader", () => it.prevPage());
|
|
3229
3229
|
let e = { syntheticSpread: "auto", scroll: "auto" };
|
|
3230
|
-
|
|
3230
|
+
it.embeded && l && l.reader && (e = l.reader), wt.updateReader(it.readerView, e);
|
|
3231
3231
|
},
|
|
3232
3232
|
handleReaderEvents: () => {
|
|
3233
3233
|
var u, s, o;
|
|
3234
|
-
if (!
|
|
3235
|
-
const H =
|
|
3234
|
+
if (!it.readium) return;
|
|
3235
|
+
const H = it.readium.reader, l = ((u = ReadiumSDK == null ? void 0 : ReadiumSDK.Events) == null ? void 0 : u.CONTENT_DOCUMENT_LOAD_START) || "CONTENT_DOCUMENT_LOAD_START", e = ((s = ReadiumSDK == null ? void 0 : ReadiumSDK.Events) == null ? void 0 : s.CONTENT_DOCUMENT_LOADED) || "CONTENT_DOCUMENT_LOADED", p = ((o = ReadiumSDK == null ? void 0 : ReadiumSDK.Events) == null ? void 0 : o.PAGINATION_CHANGED) || "PAGINATION_CHANGED";
|
|
3236
3236
|
H.on(l, (n, h) => {
|
|
3237
3237
|
console.log("Event: Load Start");
|
|
3238
3238
|
}), H.on(e, (n, h) => {
|
|
3239
3239
|
console.log("Event: Loaded");
|
|
3240
3240
|
}), H.on(p, (n) => {
|
|
3241
|
-
console.log("Event: Pagination Changed"), pt.getInstance().isAutoBookmark() &&
|
|
3241
|
+
console.log("Event: Pagination Changed"), pt.getInstance().isAutoBookmark() && it.savePlace();
|
|
3242
3242
|
});
|
|
3243
3243
|
},
|
|
3244
3244
|
loadEpub: async (H, l, e) => {
|
|
3245
3245
|
try {
|
|
3246
3246
|
console.log("Loading epub via modern parser:", l);
|
|
3247
3247
|
const p = await Rt.load(l);
|
|
3248
|
-
|
|
3248
|
+
it.readerView && (it.readerView.openBook(p), it.currentPackageDocument = p, p.toc && pt.getInstance().onTOCLoad(p.toc), pt.getInstance().epubLoaded(
|
|
3249
3249
|
p.metadata,
|
|
3250
3250
|
p,
|
|
3251
|
-
|
|
3251
|
+
it.readerView
|
|
3252
3252
|
));
|
|
3253
3253
|
} catch (p) {
|
|
3254
3254
|
console.error("Failed to load epub", p), pt.getInstance().epubFailed("Indeterminate error");
|
|
@@ -3280,7 +3280,18 @@ const ct = {
|
|
|
3280
3280
|
clearSettings: () => {
|
|
3281
3281
|
Ct.clear("reader"), console.log("Reader settings cleared.");
|
|
3282
3282
|
}
|
|
3283
|
-
};
|
|
3283
|
+
}, Jt = it.create, Qt = it.init, te = it.open, ee = it.setScrollOption, re = it.setTheme, ne = it.registerTheme, ie = it.clearSettings, se = it.setFontSize, ae = it.goToPage, oe = it.nextPage, le = it.prevPage;
|
|
3284
3284
|
export {
|
|
3285
|
-
|
|
3285
|
+
ie as clearSettings,
|
|
3286
|
+
Jt as create,
|
|
3287
|
+
it as default,
|
|
3288
|
+
ae as goToPage,
|
|
3289
|
+
Qt as init,
|
|
3290
|
+
oe as nextPage,
|
|
3291
|
+
te as open,
|
|
3292
|
+
le as prevPage,
|
|
3293
|
+
ne as registerTheme,
|
|
3294
|
+
se as setFontSize,
|
|
3295
|
+
ee as setScrollOption,
|
|
3296
|
+
re as setTheme
|
|
3286
3297
|
};
|