@treinetic/treinetic-epub-reader 1.3.2 → 2.0.0

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.
Files changed (54) hide show
  1. package/README.md +126 -155
  2. package/dist/style.css +1 -0
  3. package/dist/treinetic-epub-reader.es.js +3286 -0
  4. package/dist/treinetic-epub-reader.umd.js +38 -0
  5. package/license.txt +25 -0
  6. package/package.json +55 -153
  7. package/dist/TreineticEpubReader.css +0 -1324
  8. package/dist/TreineticEpubReader.js +0 -58314
  9. package/dist/TreineticEpubReader.min.css +0 -1
  10. package/dist/TreineticEpubReader.min.js +0 -2
  11. package/dist/TreineticEpubReader.min.js.map +0 -1
  12. package/dist/sample/assets/epub/epub_1.epub +0 -0
  13. package/dist/sample/assets/epub/epub_2/META-INF/container.xml +0 -6
  14. package/dist/sample/assets/epub/epub_2/OEBPS/0.css +0 -101
  15. package/dist/sample/assets/epub/epub_2/OEBPS/1.css +0 -12
  16. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-0.htm.html +0 -26
  17. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-1.htm.html +0 -27
  18. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-10.htm.html +0 -49
  19. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-11.htm.html +0 -152
  20. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-12.htm.html +0 -111
  21. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-13.htm.html +0 -136
  22. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-14.htm.html +0 -177
  23. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-15.htm.html +0 -144
  24. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-16.htm.html +0 -105
  25. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-17.htm.html +0 -52
  26. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-2.htm.html +0 -83
  27. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-3.htm.html +0 -84
  28. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-4.htm.html +0 -69
  29. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-5.htm.html +0 -158
  30. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-6.htm.html +0 -154
  31. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-7.htm.html +0 -163
  32. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-8.htm.html +0 -94
  33. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@2852-h-9.htm.html +0 -154
  34. package/dist/sample/assets/epub/epub_2/OEBPS/@public@vhost@g@gutenberg@html@files@2852@2852-h@images@cover.jpg +0 -0
  35. package/dist/sample/assets/epub/epub_2/OEBPS/content.opf +0 -91
  36. package/dist/sample/assets/epub/epub_2/OEBPS/pgepub.css +0 -30
  37. package/dist/sample/assets/epub/epub_2/OEBPS/toc.ncx +0 -125
  38. package/dist/sample/assets/epub/epub_2/OEBPS/wrap0000.html +0 -16
  39. package/dist/sample/assets/epub/epub_2/mimetype +0 -1
  40. package/dist/sample/assets/images/horizontal.png +0 -0
  41. package/dist/sample/assets/images/horizontal@2x.png +0 -0
  42. package/dist/sample/assets/images/vertical.png +0 -0
  43. package/dist/sample/assets/images/vertical@2x.png +0 -0
  44. package/dist/sample/assets/workers/deflate.js +0 -2
  45. package/dist/sample/assets/workers/inflate.js +0 -2
  46. package/dist/sample/assets/workers/z-worker.js +0 -2
  47. package/dist/sample/css/TreineticEpubReader.css +0 -1324
  48. package/dist/sample/css/style.css +0 -248
  49. package/dist/sample/index.html +0 -63
  50. package/dist/sample/js/TreineticEpubReader.js +0 -58314
  51. package/dist/sample/js/main.js +0 -218
  52. package/dist/workers/deflate.js +0 -2
  53. package/dist/workers/inflate.js +0 -2
  54. package/dist/workers/z-worker.js +0 -2
@@ -0,0 +1,3286 @@
1
+ var Zt = Object.defineProperty;
2
+ var Mt = (G, l, e) => l in G ? Zt(G, l, { enumerable: !0, configurable: !0, writable: !0, value: e }) : G[l] = e;
3
+ var $ = (G, l, e) => Mt(G, typeof l != "symbol" ? l + "" : l, e);
4
+ const zt = () => {
5
+ try {
6
+ return window.localStorage ? (localStorage.setItem("_isLocalStorageEnabled", "?"), localStorage.removeItem("_isLocalStorageEnabled"), !0) : !1;
7
+ } catch {
8
+ return !1;
9
+ }
10
+ }, Ct = {
11
+ put: (G, l, e) => {
12
+ if (!zt()) {
13
+ e && e();
14
+ return;
15
+ }
16
+ const p = JSON.stringify(l);
17
+ localStorage.setItem(G, p), e && e();
18
+ },
19
+ clear: (G, l) => {
20
+ if (!zt()) {
21
+ l && l();
22
+ return;
23
+ }
24
+ localStorage.removeItem(G), l && l();
25
+ },
26
+ get: (G, l) => {
27
+ if (!zt())
28
+ return l && l(null), null;
29
+ const e = localStorage.getItem(G), p = e ? JSON.parse(e) : null;
30
+ return l && l(p), p;
31
+ },
32
+ getMultiple: (G, l) => {
33
+ if (!zt())
34
+ return l && l({}), {};
35
+ const e = {};
36
+ for (const p of G) {
37
+ const u = localStorage.getItem(p);
38
+ u && (e[p] = u);
39
+ }
40
+ return l && l(e), e;
41
+ }
42
+ }, kt = class kt {
43
+ constructor() {
44
+ $(this, "themes", /* @__PURE__ */ new Map());
45
+ this.registerDefaultThemes();
46
+ }
47
+ static getInstance() {
48
+ return kt.instance || (kt.instance = new kt()), kt.instance;
49
+ }
50
+ registerTheme(l) {
51
+ this.themes.set(l.name, l);
52
+ }
53
+ getTheme(l) {
54
+ const e = this.resolveThemeAlias(l);
55
+ return this.themes.get(e);
56
+ }
57
+ resolveThemeAlias(l) {
58
+ switch (l) {
59
+ case "day":
60
+ return "default-theme";
61
+ case "night":
62
+ return "night-theme";
63
+ case "sepia":
64
+ return "parchment-theme";
65
+ case "kindle":
66
+ return "kindle-paper-theme";
67
+ case "navy":
68
+ return "navy-theme";
69
+ case "author-theme":
70
+ return "default-theme";
71
+ default:
72
+ return l;
73
+ }
74
+ }
75
+ registerDefaultThemes() {
76
+ this.registerTheme({
77
+ name: "default-theme",
78
+ properties: {
79
+ "background-color": "white",
80
+ color: "black"
81
+ }
82
+ }), this.registerTheme({
83
+ name: "night-theme",
84
+ properties: {
85
+ "background-color": "#141414",
86
+ color: "white"
87
+ }
88
+ }), this.registerTheme({
89
+ name: "parchment-theme",
90
+ properties: {
91
+ "background-color": "#f7f1cf",
92
+ color: "#774c27"
93
+ }
94
+ }), this.registerTheme({
95
+ name: "kindle-paper-theme",
96
+ properties: {
97
+ "background-color": "#f6efdf",
98
+ color: "#2e2e2e",
99
+ "font-family": "'Bookerly', 'Georgia', serif"
100
+ }
101
+ }), this.registerTheme({
102
+ name: "ballard-theme",
103
+ properties: {
104
+ "background-color": "#576b96",
105
+ color: "#DDD"
106
+ }
107
+ }), this.registerTheme({
108
+ name: "vancouver-theme",
109
+ properties: {
110
+ "background-color": "#DDD",
111
+ color: "#576b96"
112
+ }
113
+ }), this.registerTheme({
114
+ name: "navy-theme",
115
+ properties: {
116
+ "background-color": "#1c2938",
117
+ color: "#DDD"
118
+ }
119
+ });
120
+ }
121
+ };
122
+ $(kt, "instance");
123
+ let Pt = kt;
124
+ const wt = {
125
+ updateReader: (G, l) => {
126
+ if (G) {
127
+ if (G.updateSettings(l), l.theme) {
128
+ document.documentElement.setAttribute("data-theme", l.theme);
129
+ const e = wt.getBookStyles(l.theme);
130
+ G.setBookStyles(e);
131
+ const p = document.querySelector("#reader-wrapper");
132
+ p && e[0].declarations.backgroundColor && (p.style.backgroundColor = e[0].declarations.backgroundColor);
133
+ }
134
+ Ct.put("reader", l);
135
+ }
136
+ },
137
+ getBookStyles: (G) => {
138
+ const l = G === "author-theme", e = wt.getPropertyFromThemeClass(G, "background-color"), p = wt.getPropertyFromThemeClass(G, "color"), u = wt.getPropertyFromThemeClass(G, "font-family");
139
+ return [{
140
+ selector: ":not(a):not(hypothesis-highlight)",
141
+ declarations: {
142
+ backgroundColor: l ? "" : e,
143
+ color: l ? "" : p,
144
+ fontFamily: l ? "" : u || ""
145
+ }
146
+ }, {
147
+ selector: "a",
148
+ declarations: {
149
+ backgroundColor: l ? "" : e,
150
+ color: l ? "" : p
151
+ }
152
+ }];
153
+ },
154
+ getPropertyFromThemeClass: (G, l) => {
155
+ const e = Pt.getInstance().getTheme(G);
156
+ return e ? e.properties[l] : null;
157
+ }
158
+ }, vt = class vt {
159
+ constructor() {
160
+ // Properties
161
+ $(this, "metadata", null);
162
+ $(this, "reader", null);
163
+ $(this, "channel", null);
164
+ $(this, "auto_bookmark", !0);
165
+ $(this, "TocJsonObject", null);
166
+ $(this, "currentPackageDocument", null);
167
+ $(this, "readerSettings", null);
168
+ $(this, "callbackFunctions", {});
169
+ }
170
+ static getInstance() {
171
+ return vt.instance === null && (vt.instance = new vt()), vt.instance;
172
+ }
173
+ static createInstance() {
174
+ vt.instance = new vt();
175
+ }
176
+ // Methods
177
+ epubLoaded(l, e, p) {
178
+ this.metadata = l, this.reader = p, this.currentPackageDocument = e, Ct.get("reader", (u) => {
179
+ this.readerSettings = u || this.readerSettings;
180
+ }), this.callbackFunctions.onEpubLoadSuccess && this.callbackFunctions.onEpubLoadSuccess();
181
+ }
182
+ registerEvent(l, e) {
183
+ this.callbackFunctions[l] = e;
184
+ }
185
+ epubFailed(l) {
186
+ this.callbackFunctions.onEpubLoadFail && this.callbackFunctions.onEpubLoadFail(l);
187
+ }
188
+ registerChannel(l) {
189
+ this.channel = l;
190
+ }
191
+ onTOCLoad(l) {
192
+ this.TocJsonObject = l, this.callbackFunctions.onTOCLoaded && this.callbackFunctions.onTOCLoaded(this.TocJsonObject);
193
+ }
194
+ getReaderHeight() {
195
+ return this.callbackFunctions.onReaderHeightRequest ? this.callbackFunctions.onReaderHeightRequest() : null;
196
+ }
197
+ // Navigation
198
+ nextPage() {
199
+ this.reader && this.reader.openPageRight();
200
+ }
201
+ prevPage() {
202
+ this.reader && this.reader.openPageLeft();
203
+ }
204
+ hasNextPage() {
205
+ var l;
206
+ return this.reader && ((l = this.reader.getPaginationInfo()) == null ? void 0 : l.canGoRight());
207
+ }
208
+ hasPrevPage() {
209
+ var l;
210
+ return this.reader && ((l = this.reader.getPaginationInfo()) == null ? void 0 : l.canGoPrev());
211
+ }
212
+ // Bookmarking
213
+ makeBookMark() {
214
+ this.channel && this.channel("BOOKMARK_CURRENT_PAGE");
215
+ }
216
+ setAutoBookmark(l) {
217
+ this.auto_bookmark = l;
218
+ }
219
+ isAutoBookmark() {
220
+ return this.auto_bookmark;
221
+ }
222
+ // TOC
223
+ getTOCJson() {
224
+ return JSON.stringify(this.TocJsonObject ? this.TocJsonObject : []);
225
+ }
226
+ hasTOC() {
227
+ return this.TocJsonObject != null;
228
+ }
229
+ goToPage(l) {
230
+ this.reader && this.reader.openContentUrl(l);
231
+ }
232
+ // Settings
233
+ changeFontSize(l) {
234
+ this.readerSettings = this.cloneUpdate(this.readerSettings, "fontSize", l), wt.updateReader(this.reader, this.readerSettings);
235
+ }
236
+ getRecommendedFontSizeRange() {
237
+ return { min: 60, max: 170 };
238
+ }
239
+ setTheme(l) {
240
+ this.readerSettings = this.cloneUpdate(this.readerSettings, "theme", l), this.reader && wt.updateReader(this.reader, this.readerSettings);
241
+ }
242
+ setScrollOption(l) {
243
+ this.readerSettings = this.cloneUpdate(this.readerSettings, "scroll", l), this.reader && wt.updateReader(this.reader, this.readerSettings);
244
+ }
245
+ // ... helpers
246
+ cloneUpdate(l, e, p) {
247
+ const u = l ? JSON.parse(JSON.stringify(l)) : {};
248
+ return u[e] = p, u;
249
+ }
250
+ };
251
+ $(vt, "instance", null);
252
+ let pt = vt;
253
+ const ft = {
254
+ scope: "reader",
255
+ handlers: {},
256
+ init: () => {
257
+ document.addEventListener("keydown", ft.handleKey);
258
+ },
259
+ on: (G, l, e) => {
260
+ const p = `${l}:${G} `;
261
+ ft.handlers[p] || (ft.handlers[p] = []), ft.handlers[p].push(e);
262
+ },
263
+ handleKey: (G) => {
264
+ let l = "";
265
+ G.key === "ArrowRight" && (l = "PageNext"), G.key === "ArrowLeft" && (l = "PagePrevious"), l && ft.dispatch(l);
266
+ },
267
+ dispatch: (G) => {
268
+ const l = `${ft.scope}:${G} `;
269
+ ft.handlers[l] && ft.handlers[l].forEach((e) => e());
270
+ },
271
+ // Constants matching legacy
272
+ PagePrevious: "PagePrevious",
273
+ PageNext: "PageNext",
274
+ NightTheme: "NightTheme",
275
+ applySettings: (G) => {
276
+ }
277
+ };
278
+ ft.init();
279
+ var Ot = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
280
+ function Ht(G) {
281
+ return G && G.__esModule && Object.prototype.hasOwnProperty.call(G, "default") ? G.default : G;
282
+ }
283
+ function Tt(G) {
284
+ throw new Error('Could not dynamically require "' + G + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
285
+ }
286
+ var Nt = { exports: {} };
287
+ /*!
288
+
289
+ JSZip v3.10.1 - A JavaScript class for generating and reading zip files
290
+ <http://stuartk.com/jszip>
291
+
292
+ (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
293
+ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
294
+
295
+ JSZip uses the library pako released under the MIT license :
296
+ https://github.com/nodeca/pako/blob/main/LICENSE
297
+ */
298
+ (function(G, l) {
299
+ (function(e) {
300
+ G.exports = e();
301
+ })(function() {
302
+ return function e(p, u, s) {
303
+ function o(w, b) {
304
+ if (!u[w]) {
305
+ if (!p[w]) {
306
+ var _ = typeof Tt == "function" && Tt;
307
+ if (!b && _) return _(w, !0);
308
+ if (n) return n(w, !0);
309
+ var v = new Error("Cannot find module '" + w + "'");
310
+ throw v.code = "MODULE_NOT_FOUND", v;
311
+ }
312
+ var a = u[w] = { exports: {} };
313
+ p[w][0].call(a.exports, function(g) {
314
+ var i = p[w][1][g];
315
+ return o(i || g);
316
+ }, a, a.exports, e, p, u, s);
317
+ }
318
+ return u[w].exports;
319
+ }
320
+ for (var n = typeof Tt == "function" && Tt, h = 0; h < s.length; h++) o(s[h]);
321
+ return o;
322
+ }({ 1: [function(e, p, u) {
323
+ var s = e("./utils"), o = e("./support"), n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
324
+ u.encode = function(h) {
325
+ for (var w, b, _, v, a, g, i, f = [], c = 0, y = h.length, x = y, C = s.getTypeOf(h) !== "string"; c < h.length; ) x = y - c, _ = C ? (w = h[c++], b = c < y ? h[c++] : 0, c < y ? h[c++] : 0) : (w = h.charCodeAt(c++), b = c < y ? h.charCodeAt(c++) : 0, c < y ? h.charCodeAt(c++) : 0), v = w >> 2, a = (3 & w) << 4 | b >> 4, g = 1 < x ? (15 & b) << 2 | _ >> 6 : 64, i = 2 < x ? 63 & _ : 64, f.push(n.charAt(v) + n.charAt(a) + n.charAt(g) + n.charAt(i));
326
+ return f.join("");
327
+ }, u.decode = function(h) {
328
+ var w, b, _, v, a, g, i = 0, f = 0, c = "data:";
329
+ if (h.substr(0, c.length) === c) throw new Error("Invalid base64 input, it looks like a data url.");
330
+ var y, x = 3 * (h = h.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
331
+ if (h.charAt(h.length - 1) === n.charAt(64) && x--, h.charAt(h.length - 2) === n.charAt(64) && x--, x % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
332
+ for (y = o.uint8array ? new Uint8Array(0 | x) : new Array(0 | x); i < h.length; ) w = n.indexOf(h.charAt(i++)) << 2 | (v = n.indexOf(h.charAt(i++))) >> 4, b = (15 & v) << 4 | (a = n.indexOf(h.charAt(i++))) >> 2, _ = (3 & a) << 6 | (g = n.indexOf(h.charAt(i++))), y[f++] = w, a !== 64 && (y[f++] = b), g !== 64 && (y[f++] = _);
333
+ return y;
334
+ };
335
+ }, { "./support": 30, "./utils": 32 }], 2: [function(e, p, u) {
336
+ var s = e("./external"), o = e("./stream/DataWorker"), n = e("./stream/Crc32Probe"), h = e("./stream/DataLengthProbe");
337
+ function w(b, _, v, a, g) {
338
+ this.compressedSize = b, this.uncompressedSize = _, this.crc32 = v, this.compression = a, this.compressedContent = g;
339
+ }
340
+ w.prototype = { getContentWorker: function() {
341
+ var b = new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")), _ = this;
342
+ return b.on("end", function() {
343
+ if (this.streamInfo.data_length !== _.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
344
+ }), b;
345
+ }, getCompressedWorker: function() {
346
+ return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
347
+ } }, w.createWorkerFrom = function(b, _, v) {
348
+ return b.pipe(new n()).pipe(new h("uncompressedSize")).pipe(_.compressWorker(v)).pipe(new h("compressedSize")).withStreamInfo("compression", _);
349
+ }, p.exports = w;
350
+ }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, p, u) {
351
+ var s = e("./stream/GenericWorker");
352
+ u.STORE = { magic: "\0\0", compressWorker: function() {
353
+ return new s("STORE compression");
354
+ }, uncompressWorker: function() {
355
+ return new s("STORE decompression");
356
+ } }, u.DEFLATE = e("./flate");
357
+ }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, p, u) {
358
+ var s = e("./utils"), o = function() {
359
+ for (var n, h = [], w = 0; w < 256; w++) {
360
+ n = w;
361
+ for (var b = 0; b < 8; b++) n = 1 & n ? 3988292384 ^ n >>> 1 : n >>> 1;
362
+ h[w] = n;
363
+ }
364
+ return h;
365
+ }();
366
+ p.exports = function(n, h) {
367
+ return n !== void 0 && n.length ? s.getTypeOf(n) !== "string" ? function(w, b, _, v) {
368
+ var a = o, g = v + _;
369
+ w ^= -1;
370
+ for (var i = v; i < g; i++) w = w >>> 8 ^ a[255 & (w ^ b[i])];
371
+ return -1 ^ w;
372
+ }(0 | h, n, n.length, 0) : function(w, b, _, v) {
373
+ var a = o, g = v + _;
374
+ w ^= -1;
375
+ for (var i = v; i < g; i++) w = w >>> 8 ^ a[255 & (w ^ b.charCodeAt(i))];
376
+ return -1 ^ w;
377
+ }(0 | h, n, n.length, 0) : 0;
378
+ };
379
+ }, { "./utils": 32 }], 5: [function(e, p, u) {
380
+ u.base64 = !1, u.binary = !1, u.dir = !1, u.createFolders = !0, u.date = null, u.compression = null, u.compressionOptions = null, u.comment = null, u.unixPermissions = null, u.dosPermissions = null;
381
+ }, {}], 6: [function(e, p, u) {
382
+ var s = null;
383
+ s = typeof Promise < "u" ? Promise : e("lie"), p.exports = { Promise: s };
384
+ }, { lie: 37 }], 7: [function(e, p, u) {
385
+ var s = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Uint32Array < "u", o = e("pako"), n = e("./utils"), h = e("./stream/GenericWorker"), w = s ? "uint8array" : "array";
386
+ function b(_, v) {
387
+ h.call(this, "FlateWorker/" + _), this._pako = null, this._pakoAction = _, this._pakoOptions = v, this.meta = {};
388
+ }
389
+ u.magic = "\b\0", n.inherits(b, h), b.prototype.processChunk = function(_) {
390
+ this.meta = _.meta, this._pako === null && this._createPako(), this._pako.push(n.transformTo(w, _.data), !1);
391
+ }, b.prototype.flush = function() {
392
+ h.prototype.flush.call(this), this._pako === null && this._createPako(), this._pako.push([], !0);
393
+ }, b.prototype.cleanUp = function() {
394
+ h.prototype.cleanUp.call(this), this._pako = null;
395
+ }, b.prototype._createPako = function() {
396
+ this._pako = new o[this._pakoAction]({ raw: !0, level: this._pakoOptions.level || -1 });
397
+ var _ = this;
398
+ this._pako.onData = function(v) {
399
+ _.push({ data: v, meta: _.meta });
400
+ };
401
+ }, u.compressWorker = function(_) {
402
+ return new b("Deflate", _);
403
+ }, u.uncompressWorker = function() {
404
+ return new b("Inflate", {});
405
+ };
406
+ }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, p, u) {
407
+ function s(a, g) {
408
+ var i, f = "";
409
+ for (i = 0; i < g; i++) f += String.fromCharCode(255 & a), a >>>= 8;
410
+ return f;
411
+ }
412
+ function o(a, g, i, f, c, y) {
413
+ var x, C, E = a.file, D = a.compression, P = y !== w.utf8encode, U = n.transformTo("string", y(E.name)), T = n.transformTo("string", w.utf8encode(E.name)), M = E.comment, X = n.transformTo("string", y(M)), k = n.transformTo("string", w.utf8encode(M)), R = T.length !== E.name.length, r = k.length !== M.length, B = "", tt = "", W = "", et = E.dir, j = E.date, Q = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
414
+ g && !i || (Q.crc32 = a.crc32, Q.compressedSize = a.compressedSize, Q.uncompressedSize = a.uncompressedSize);
415
+ var z = 0;
416
+ g && (z |= 8), P || !R && !r || (z |= 2048);
417
+ var I = 0, J = 0;
418
+ et && (I |= 16), c === "UNIX" ? (J = 798, I |= function(q, at) {
419
+ var dt = q;
420
+ return q || (dt = at ? 16893 : 33204), (65535 & dt) << 16;
421
+ }(E.unixPermissions, et)) : (J = 20, I |= function(q) {
422
+ return 63 & (q || 0);
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);
424
+ var V = "";
425
+ return V += `
426
+ \0`, V += s(z, 2), V += D.magic, V += s(x, 2), V += s(C, 2), V += s(Q.crc32, 4), V += s(Q.compressedSize, 4), V += s(Q.uncompressedSize, 4), V += s(U.length, 2), V += s(B.length, 2), { fileRecord: _.LOCAL_FILE_HEADER + V + U + B, dirRecord: _.CENTRAL_FILE_HEADER + s(J, 2) + V + s(X.length, 2) + "\0\0\0\0" + s(I, 4) + s(f, 4) + U + B + X };
427
+ }
428
+ var n = e("../utils"), h = e("../stream/GenericWorker"), w = e("../utf8"), b = e("../crc32"), _ = e("../signature");
429
+ function v(a, g, i, f) {
430
+ h.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = g, this.zipPlatform = i, this.encodeFileName = f, this.streamFiles = a, this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
431
+ }
432
+ n.inherits(v, h), v.prototype.push = function(a) {
433
+ var g = a.meta.percent || 0, i = this.entriesCount, f = this._sources.length;
434
+ this.accumulate ? this.contentBuffer.push(a) : (this.bytesWritten += a.data.length, h.prototype.push.call(this, { data: a.data, meta: { currentFile: this.currentFile, percent: i ? (g + 100 * (i - f - 1)) / i : 100 } }));
435
+ }, v.prototype.openedSource = function(a) {
436
+ this.currentSourceOffset = this.bytesWritten, this.currentFile = a.file.name;
437
+ var g = this.streamFiles && !a.file.dir;
438
+ if (g) {
439
+ var i = o(a, g, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
440
+ this.push({ data: i.fileRecord, meta: { percent: 0 } });
441
+ } else this.accumulate = !0;
442
+ }, v.prototype.closedSource = function(a) {
443
+ this.accumulate = !1;
444
+ var g = this.streamFiles && !a.file.dir, i = o(a, g, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
445
+ if (this.dirRecords.push(i.dirRecord), g) this.push({ data: function(f) {
446
+ return _.DATA_DESCRIPTOR + s(f.crc32, 4) + s(f.compressedSize, 4) + s(f.uncompressedSize, 4);
447
+ }(a), meta: { percent: 100 } });
448
+ else for (this.push({ data: i.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
449
+ this.currentFile = null;
450
+ }, v.prototype.flush = function() {
451
+ for (var a = this.bytesWritten, g = 0; g < this.dirRecords.length; g++) this.push({ data: this.dirRecords[g], meta: { percent: 100 } });
452
+ var i = this.bytesWritten - a, f = function(c, y, x, C, E) {
453
+ var D = n.transformTo("string", E(C));
454
+ return _.CENTRAL_DIRECTORY_END + "\0\0\0\0" + s(c, 2) + s(c, 2) + s(y, 4) + s(x, 4) + s(D.length, 2) + D;
455
+ }(this.dirRecords.length, i, a, this.zipComment, this.encodeFileName);
456
+ this.push({ data: f, meta: { percent: 100 } });
457
+ }, v.prototype.prepareNextSource = function() {
458
+ this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
459
+ }, v.prototype.registerPrevious = function(a) {
460
+ this._sources.push(a);
461
+ var g = this;
462
+ return a.on("data", function(i) {
463
+ g.processChunk(i);
464
+ }), a.on("end", function() {
465
+ g.closedSource(g.previous.streamInfo), g._sources.length ? g.prepareNextSource() : g.end();
466
+ }), a.on("error", function(i) {
467
+ g.error(i);
468
+ }), this;
469
+ }, v.prototype.resume = function() {
470
+ return !!h.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), !0) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), !0));
471
+ }, v.prototype.error = function(a) {
472
+ var g = this._sources;
473
+ if (!h.prototype.error.call(this, a)) return !1;
474
+ for (var i = 0; i < g.length; i++) try {
475
+ g[i].error(a);
476
+ } catch {
477
+ }
478
+ return !0;
479
+ }, v.prototype.lock = function() {
480
+ h.prototype.lock.call(this);
481
+ for (var a = this._sources, g = 0; g < a.length; g++) a[g].lock();
482
+ }, p.exports = v;
483
+ }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, p, u) {
484
+ var s = e("../compressions"), o = e("./ZipFileWorker");
485
+ u.generateWorker = function(n, h, w) {
486
+ var b = new o(h.streamFiles, w, h.platform, h.encodeFileName), _ = 0;
487
+ try {
488
+ n.forEach(function(v, a) {
489
+ _++;
490
+ var g = function(y, x) {
491
+ var C = y || x, E = s[C];
492
+ if (!E) throw new Error(C + " is not a valid compression method !");
493
+ return E;
494
+ }(a.options.compression, h.compression), i = a.options.compressionOptions || h.compressionOptions || {}, f = a.dir, c = a.date;
495
+ a._compressWorker(g, i).withStreamInfo("file", { name: v, dir: f, date: c, comment: a.comment || "", unixPermissions: a.unixPermissions, dosPermissions: a.dosPermissions }).pipe(b);
496
+ }), b.entriesCount = _;
497
+ } catch (v) {
498
+ b.error(v);
499
+ }
500
+ return b;
501
+ };
502
+ }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, p, u) {
503
+ function s() {
504
+ if (!(this instanceof s)) return new s();
505
+ if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
506
+ this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
507
+ var o = new s();
508
+ for (var n in this) typeof this[n] != "function" && (o[n] = this[n]);
509
+ return o;
510
+ };
511
+ }
512
+ (s.prototype = e("./object")).loadAsync = e("./load"), s.support = e("./support"), s.defaults = e("./defaults"), s.version = "3.10.1", s.loadAsync = function(o, n) {
513
+ return new s().loadAsync(o, n);
514
+ }, s.external = e("./external"), p.exports = s;
515
+ }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, p, u) {
516
+ var s = e("./utils"), o = e("./external"), n = e("./utf8"), h = e("./zipEntries"), w = e("./stream/Crc32Probe"), b = e("./nodejsUtils");
517
+ function _(v) {
518
+ return new o.Promise(function(a, g) {
519
+ var i = v.decompressed.getContentWorker().pipe(new w());
520
+ i.on("error", function(f) {
521
+ g(f);
522
+ }).on("end", function() {
523
+ i.streamInfo.crc32 !== v.decompressed.crc32 ? g(new Error("Corrupted zip : CRC32 mismatch")) : a();
524
+ }).resume();
525
+ });
526
+ }
527
+ p.exports = function(v, a) {
528
+ var g = this;
529
+ return a = s.extend(a || {}, { base64: !1, checkCRC32: !1, optimizedBinaryString: !1, createFolders: !1, decodeFileName: n.utf8decode }), b.isNode && b.isStream(v) ? o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : s.prepareContent("the loaded zip file", v, !0, a.optimizedBinaryString, a.base64).then(function(i) {
530
+ var f = new h(a);
531
+ return f.load(i), f;
532
+ }).then(function(i) {
533
+ var f = [o.Promise.resolve(i)], c = i.files;
534
+ if (a.checkCRC32) for (var y = 0; y < c.length; y++) f.push(_(c[y]));
535
+ return o.Promise.all(f);
536
+ }).then(function(i) {
537
+ for (var f = i.shift(), c = f.files, y = 0; y < c.length; y++) {
538
+ var x = c[y], C = x.fileNameStr, E = s.resolve(x.fileNameStr);
539
+ g.file(E, x.decompressed, { binary: !0, optimizedBinaryString: !0, date: x.date, dir: x.dir, comment: x.fileCommentStr.length ? x.fileCommentStr : null, unixPermissions: x.unixPermissions, dosPermissions: x.dosPermissions, createFolders: a.createFolders }), x.dir || (g.file(E).unsafeOriginalName = C);
540
+ }
541
+ return f.zipComment.length && (g.comment = f.zipComment), g;
542
+ });
543
+ };
544
+ }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, p, u) {
545
+ var s = e("../utils"), o = e("../stream/GenericWorker");
546
+ function n(h, w) {
547
+ o.call(this, "Nodejs stream input adapter for " + h), this._upstreamEnded = !1, this._bindStream(w);
548
+ }
549
+ s.inherits(n, o), n.prototype._bindStream = function(h) {
550
+ var w = this;
551
+ (this._stream = h).pause(), h.on("data", function(b) {
552
+ w.push({ data: b, meta: { percent: 0 } });
553
+ }).on("error", function(b) {
554
+ w.isPaused ? this.generatedError = b : w.error(b);
555
+ }).on("end", function() {
556
+ w.isPaused ? w._upstreamEnded = !0 : w.end();
557
+ });
558
+ }, n.prototype.pause = function() {
559
+ return !!o.prototype.pause.call(this) && (this._stream.pause(), !0);
560
+ }, n.prototype.resume = function() {
561
+ return !!o.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), !0);
562
+ }, p.exports = n;
563
+ }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, p, u) {
564
+ var s = e("readable-stream").Readable;
565
+ function o(n, h, w) {
566
+ s.call(this, h), this._helper = n;
567
+ var b = this;
568
+ n.on("data", function(_, v) {
569
+ b.push(_) || b._helper.pause(), w && w(v);
570
+ }).on("error", function(_) {
571
+ b.emit("error", _);
572
+ }).on("end", function() {
573
+ b.push(null);
574
+ });
575
+ }
576
+ e("../utils").inherits(o, s), o.prototype._read = function() {
577
+ this._helper.resume();
578
+ }, p.exports = o;
579
+ }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, p, u) {
580
+ p.exports = { isNode: typeof Buffer < "u", newBufferFrom: function(s, o) {
581
+ if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(s, o);
582
+ if (typeof s == "number") throw new Error('The "data" argument must not be a number');
583
+ return new Buffer(s, o);
584
+ }, allocBuffer: function(s) {
585
+ if (Buffer.alloc) return Buffer.alloc(s);
586
+ var o = new Buffer(s);
587
+ return o.fill(0), o;
588
+ }, isBuffer: function(s) {
589
+ return Buffer.isBuffer(s);
590
+ }, isStream: function(s) {
591
+ return s && typeof s.on == "function" && typeof s.pause == "function" && typeof s.resume == "function";
592
+ } };
593
+ }, {}], 15: [function(e, p, u) {
594
+ function s(E, D, P) {
595
+ var U, T = n.getTypeOf(D), M = n.extend(P || {}, b);
596
+ M.date = M.date || /* @__PURE__ */ new Date(), M.compression !== null && (M.compression = M.compression.toUpperCase()), typeof M.unixPermissions == "string" && (M.unixPermissions = parseInt(M.unixPermissions, 8)), M.unixPermissions && 16384 & M.unixPermissions && (M.dir = !0), M.dosPermissions && 16 & M.dosPermissions && (M.dir = !0), M.dir && (E = c(E)), M.createFolders && (U = f(E)) && y.call(this, U, !0);
597
+ var X = T === "string" && M.binary === !1 && M.base64 === !1;
598
+ P && P.binary !== void 0 || (M.binary = !X), (D instanceof _ && D.uncompressedSize === 0 || M.dir || !D || D.length === 0) && (M.base64 = !1, M.binary = !0, D = "", M.compression = "STORE", T = "string");
599
+ var k = null;
600
+ k = D instanceof _ || D instanceof h ? D : g.isNode && g.isStream(D) ? new i(E, D) : n.prepareContent(E, D, M.binary, M.optimizedBinaryString, M.base64);
601
+ var R = new v(E, k, M);
602
+ this.files[E] = R;
603
+ }
604
+ var o = e("./utf8"), n = e("./utils"), h = e("./stream/GenericWorker"), w = e("./stream/StreamHelper"), b = e("./defaults"), _ = e("./compressedObject"), v = e("./zipObject"), a = e("./generate"), g = e("./nodejsUtils"), i = e("./nodejs/NodejsStreamInputAdapter"), f = function(E) {
605
+ E.slice(-1) === "/" && (E = E.substring(0, E.length - 1));
606
+ var D = E.lastIndexOf("/");
607
+ return 0 < D ? E.substring(0, D) : "";
608
+ }, c = function(E) {
609
+ return E.slice(-1) !== "/" && (E += "/"), E;
610
+ }, y = function(E, D) {
611
+ return D = D !== void 0 ? D : b.createFolders, E = c(E), this.files[E] || s.call(this, E, null, { dir: !0, createFolders: D }), this.files[E];
612
+ };
613
+ function x(E) {
614
+ return Object.prototype.toString.call(E) === "[object RegExp]";
615
+ }
616
+ var C = { load: function() {
617
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
618
+ }, forEach: function(E) {
619
+ var D, P, U;
620
+ for (D in this.files) U = this.files[D], (P = D.slice(this.root.length, D.length)) && D.slice(0, this.root.length) === this.root && E(P, U);
621
+ }, filter: function(E) {
622
+ var D = [];
623
+ return this.forEach(function(P, U) {
624
+ E(P, U) && D.push(U);
625
+ }), D;
626
+ }, file: function(E, D, P) {
627
+ if (arguments.length !== 1) return E = this.root + E, s.call(this, E, D, P), this;
628
+ if (x(E)) {
629
+ var U = E;
630
+ return this.filter(function(M, X) {
631
+ return !X.dir && U.test(M);
632
+ });
633
+ }
634
+ var T = this.files[this.root + E];
635
+ return T && !T.dir ? T : null;
636
+ }, folder: function(E) {
637
+ if (!E) return this;
638
+ if (x(E)) return this.filter(function(T, M) {
639
+ return M.dir && E.test(T);
640
+ });
641
+ var D = this.root + E, P = y.call(this, D), U = this.clone();
642
+ return U.root = P.name, U;
643
+ }, remove: function(E) {
644
+ E = this.root + E;
645
+ var D = this.files[E];
646
+ if (D || (E.slice(-1) !== "/" && (E += "/"), D = this.files[E]), D && !D.dir) delete this.files[E];
647
+ else for (var P = this.filter(function(T, M) {
648
+ return M.name.slice(0, E.length) === E;
649
+ }), U = 0; U < P.length; U++) delete this.files[P[U].name];
650
+ return this;
651
+ }, generate: function() {
652
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
653
+ }, generateInternalStream: function(E) {
654
+ var D, P = {};
655
+ try {
656
+ if ((P = n.extend(E || {}, { streamFiles: !1, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: o.utf8encode })).type = P.type.toLowerCase(), P.compression = P.compression.toUpperCase(), P.type === "binarystring" && (P.type = "string"), !P.type) throw new Error("No output type specified.");
657
+ n.checkSupport(P.type), P.platform !== "darwin" && P.platform !== "freebsd" && P.platform !== "linux" && P.platform !== "sunos" || (P.platform = "UNIX"), P.platform === "win32" && (P.platform = "DOS");
658
+ var U = P.comment || this.comment || "";
659
+ D = a.generateWorker(this, P, U);
660
+ } catch (T) {
661
+ (D = new h("error")).error(T);
662
+ }
663
+ return new w(D, P.type || "string", P.mimeType);
664
+ }, generateAsync: function(E, D) {
665
+ return this.generateInternalStream(E).accumulate(D);
666
+ }, generateNodeStream: function(E, D) {
667
+ return (E = E || {}).type || (E.type = "nodebuffer"), this.generateInternalStream(E).toNodejsStream(D);
668
+ } };
669
+ p.exports = C;
670
+ }, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, p, u) {
671
+ p.exports = e("stream");
672
+ }, { stream: void 0 }], 17: [function(e, p, u) {
673
+ var s = e("./DataReader");
674
+ function o(n) {
675
+ s.call(this, n);
676
+ for (var h = 0; h < this.data.length; h++) n[h] = 255 & n[h];
677
+ }
678
+ e("../utils").inherits(o, s), o.prototype.byteAt = function(n) {
679
+ return this.data[this.zero + n];
680
+ }, o.prototype.lastIndexOfSignature = function(n) {
681
+ for (var h = n.charCodeAt(0), w = n.charCodeAt(1), b = n.charCodeAt(2), _ = n.charCodeAt(3), v = this.length - 4; 0 <= v; --v) if (this.data[v] === h && this.data[v + 1] === w && this.data[v + 2] === b && this.data[v + 3] === _) return v - this.zero;
682
+ return -1;
683
+ }, o.prototype.readAndCheckSignature = function(n) {
684
+ var h = n.charCodeAt(0), w = n.charCodeAt(1), b = n.charCodeAt(2), _ = n.charCodeAt(3), v = this.readData(4);
685
+ return h === v[0] && w === v[1] && b === v[2] && _ === v[3];
686
+ }, o.prototype.readData = function(n) {
687
+ if (this.checkOffset(n), n === 0) return [];
688
+ var h = this.data.slice(this.zero + this.index, this.zero + this.index + n);
689
+ return this.index += n, h;
690
+ }, p.exports = o;
691
+ }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, p, u) {
692
+ var s = e("../utils");
693
+ function o(n) {
694
+ this.data = n, this.length = n.length, this.index = 0, this.zero = 0;
695
+ }
696
+ o.prototype = { checkOffset: function(n) {
697
+ this.checkIndex(this.index + n);
698
+ }, checkIndex: function(n) {
699
+ if (this.length < this.zero + n || n < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + n + "). Corrupted zip ?");
700
+ }, setIndex: function(n) {
701
+ this.checkIndex(n), this.index = n;
702
+ }, skip: function(n) {
703
+ this.setIndex(this.index + n);
704
+ }, byteAt: function() {
705
+ }, readInt: function(n) {
706
+ var h, w = 0;
707
+ for (this.checkOffset(n), h = this.index + n - 1; h >= this.index; h--) w = (w << 8) + this.byteAt(h);
708
+ return this.index += n, w;
709
+ }, readString: function(n) {
710
+ return s.transformTo("string", this.readData(n));
711
+ }, readData: function() {
712
+ }, lastIndexOfSignature: function() {
713
+ }, readAndCheckSignature: function() {
714
+ }, readDate: function() {
715
+ var n = this.readInt(4);
716
+ return new Date(Date.UTC(1980 + (n >> 25 & 127), (n >> 21 & 15) - 1, n >> 16 & 31, n >> 11 & 31, n >> 5 & 63, (31 & n) << 1));
717
+ } }, p.exports = o;
718
+ }, { "../utils": 32 }], 19: [function(e, p, u) {
719
+ var s = e("./Uint8ArrayReader");
720
+ function o(n) {
721
+ s.call(this, n);
722
+ }
723
+ e("../utils").inherits(o, s), o.prototype.readData = function(n) {
724
+ this.checkOffset(n);
725
+ var h = this.data.slice(this.zero + this.index, this.zero + this.index + n);
726
+ return this.index += n, h;
727
+ }, p.exports = o;
728
+ }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, p, u) {
729
+ var s = e("./DataReader");
730
+ function o(n) {
731
+ s.call(this, n);
732
+ }
733
+ e("../utils").inherits(o, s), o.prototype.byteAt = function(n) {
734
+ return this.data.charCodeAt(this.zero + n);
735
+ }, o.prototype.lastIndexOfSignature = function(n) {
736
+ return this.data.lastIndexOf(n) - this.zero;
737
+ }, o.prototype.readAndCheckSignature = function(n) {
738
+ return n === this.readData(4);
739
+ }, o.prototype.readData = function(n) {
740
+ this.checkOffset(n);
741
+ var h = this.data.slice(this.zero + this.index, this.zero + this.index + n);
742
+ return this.index += n, h;
743
+ }, p.exports = o;
744
+ }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, p, u) {
745
+ var s = e("./ArrayReader");
746
+ function o(n) {
747
+ s.call(this, n);
748
+ }
749
+ e("../utils").inherits(o, s), o.prototype.readData = function(n) {
750
+ if (this.checkOffset(n), n === 0) return new Uint8Array(0);
751
+ var h = this.data.subarray(this.zero + this.index, this.zero + this.index + n);
752
+ return this.index += n, h;
753
+ }, p.exports = o;
754
+ }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, p, u) {
755
+ var s = e("../utils"), o = e("../support"), n = e("./ArrayReader"), h = e("./StringReader"), w = e("./NodeBufferReader"), b = e("./Uint8ArrayReader");
756
+ p.exports = function(_) {
757
+ var v = s.getTypeOf(_);
758
+ return s.checkSupport(v), v !== "string" || o.uint8array ? v === "nodebuffer" ? new w(_) : o.uint8array ? new b(s.transformTo("uint8array", _)) : new n(s.transformTo("array", _)) : new h(_);
759
+ };
760
+ }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, p, u) {
761
+ u.LOCAL_FILE_HEADER = "PK", u.CENTRAL_FILE_HEADER = "PK", u.CENTRAL_DIRECTORY_END = "PK", u.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", u.ZIP64_CENTRAL_DIRECTORY_END = "PK", u.DATA_DESCRIPTOR = "PK\x07\b";
762
+ }, {}], 24: [function(e, p, u) {
763
+ var s = e("./GenericWorker"), o = e("../utils");
764
+ function n(h) {
765
+ s.call(this, "ConvertWorker to " + h), this.destType = h;
766
+ }
767
+ o.inherits(n, s), n.prototype.processChunk = function(h) {
768
+ this.push({ data: o.transformTo(this.destType, h.data), meta: h.meta });
769
+ }, p.exports = n;
770
+ }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, p, u) {
771
+ var s = e("./GenericWorker"), o = e("../crc32");
772
+ function n() {
773
+ s.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
774
+ }
775
+ e("../utils").inherits(n, s), n.prototype.processChunk = function(h) {
776
+ this.streamInfo.crc32 = o(h.data, this.streamInfo.crc32 || 0), this.push(h);
777
+ }, p.exports = n;
778
+ }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, p, u) {
779
+ var s = e("../utils"), o = e("./GenericWorker");
780
+ function n(h) {
781
+ o.call(this, "DataLengthProbe for " + h), this.propName = h, this.withStreamInfo(h, 0);
782
+ }
783
+ s.inherits(n, o), n.prototype.processChunk = function(h) {
784
+ if (h) {
785
+ var w = this.streamInfo[this.propName] || 0;
786
+ this.streamInfo[this.propName] = w + h.data.length;
787
+ }
788
+ o.prototype.processChunk.call(this, h);
789
+ }, p.exports = n;
790
+ }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, p, u) {
791
+ var s = e("../utils"), o = e("./GenericWorker");
792
+ function n(h) {
793
+ o.call(this, "DataWorker");
794
+ var w = this;
795
+ this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = !1, h.then(function(b) {
796
+ w.dataIsReady = !0, w.data = b, w.max = b && b.length || 0, w.type = s.getTypeOf(b), w.isPaused || w._tickAndRepeat();
797
+ }, function(b) {
798
+ w.error(b);
799
+ });
800
+ }
801
+ s.inherits(n, o), n.prototype.cleanUp = function() {
802
+ o.prototype.cleanUp.call(this), this.data = null;
803
+ }, n.prototype.resume = function() {
804
+ return !!o.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, s.delay(this._tickAndRepeat, [], this)), !0);
805
+ }, n.prototype._tickAndRepeat = function() {
806
+ this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (s.delay(this._tickAndRepeat, [], this), this._tickScheduled = !0));
807
+ }, n.prototype._tick = function() {
808
+ if (this.isPaused || this.isFinished) return !1;
809
+ var h = null, w = Math.min(this.max, this.index + 16384);
810
+ if (this.index >= this.max) return this.end();
811
+ switch (this.type) {
812
+ case "string":
813
+ h = this.data.substring(this.index, w);
814
+ break;
815
+ case "uint8array":
816
+ h = this.data.subarray(this.index, w);
817
+ break;
818
+ case "array":
819
+ case "nodebuffer":
820
+ h = this.data.slice(this.index, w);
821
+ }
822
+ return this.index = w, this.push({ data: h, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
823
+ }, p.exports = n;
824
+ }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, p, u) {
825
+ function s(o) {
826
+ this.name = o || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = !0, this.isFinished = !1, this.isLocked = !1, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
827
+ }
828
+ s.prototype = { push: function(o) {
829
+ this.emit("data", o);
830
+ }, end: function() {
831
+ if (this.isFinished) return !1;
832
+ this.flush();
833
+ try {
834
+ this.emit("end"), this.cleanUp(), this.isFinished = !0;
835
+ } catch (o) {
836
+ this.emit("error", o);
837
+ }
838
+ return !0;
839
+ }, error: function(o) {
840
+ return !this.isFinished && (this.isPaused ? this.generatedError = o : (this.isFinished = !0, this.emit("error", o), this.previous && this.previous.error(o), this.cleanUp()), !0);
841
+ }, on: function(o, n) {
842
+ return this._listeners[o].push(n), this;
843
+ }, cleanUp: function() {
844
+ this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
845
+ }, emit: function(o, n) {
846
+ if (this._listeners[o]) for (var h = 0; h < this._listeners[o].length; h++) this._listeners[o][h].call(this, n);
847
+ }, pipe: function(o) {
848
+ return o.registerPrevious(this);
849
+ }, registerPrevious: function(o) {
850
+ if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
851
+ this.streamInfo = o.streamInfo, this.mergeStreamInfo(), this.previous = o;
852
+ var n = this;
853
+ return o.on("data", function(h) {
854
+ n.processChunk(h);
855
+ }), o.on("end", function() {
856
+ n.end();
857
+ }), o.on("error", function(h) {
858
+ n.error(h);
859
+ }), this;
860
+ }, pause: function() {
861
+ return !this.isPaused && !this.isFinished && (this.isPaused = !0, this.previous && this.previous.pause(), !0);
862
+ }, resume: function() {
863
+ if (!this.isPaused || this.isFinished) return !1;
864
+ var o = this.isPaused = !1;
865
+ return this.generatedError && (this.error(this.generatedError), o = !0), this.previous && this.previous.resume(), !o;
866
+ }, flush: function() {
867
+ }, processChunk: function(o) {
868
+ this.push(o);
869
+ }, withStreamInfo: function(o, n) {
870
+ return this.extraStreamInfo[o] = n, this.mergeStreamInfo(), this;
871
+ }, mergeStreamInfo: function() {
872
+ for (var o in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, o) && (this.streamInfo[o] = this.extraStreamInfo[o]);
873
+ }, lock: function() {
874
+ if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
875
+ this.isLocked = !0, this.previous && this.previous.lock();
876
+ }, toString: function() {
877
+ var o = "Worker " + this.name;
878
+ return this.previous ? this.previous + " -> " + o : o;
879
+ } }, p.exports = s;
880
+ }, {}], 29: [function(e, p, u) {
881
+ var s = e("../utils"), o = e("./ConvertWorker"), n = e("./GenericWorker"), h = e("../base64"), w = e("../support"), b = e("../external"), _ = null;
882
+ if (w.nodestream) try {
883
+ _ = e("../nodejs/NodejsStreamOutputAdapter");
884
+ } catch {
885
+ }
886
+ function v(g, i) {
887
+ return new b.Promise(function(f, c) {
888
+ var y = [], x = g._internalType, C = g._outputType, E = g._mimeType;
889
+ g.on("data", function(D, P) {
890
+ y.push(D), i && i(P);
891
+ }).on("error", function(D) {
892
+ y = [], c(D);
893
+ }).on("end", function() {
894
+ try {
895
+ var D = function(P, U, T) {
896
+ switch (P) {
897
+ case "blob":
898
+ return s.newBlob(s.transformTo("arraybuffer", U), T);
899
+ case "base64":
900
+ return h.encode(U);
901
+ default:
902
+ return s.transformTo(P, U);
903
+ }
904
+ }(C, function(P, U) {
905
+ var T, M = 0, X = null, k = 0;
906
+ for (T = 0; T < U.length; T++) k += U[T].length;
907
+ switch (P) {
908
+ case "string":
909
+ return U.join("");
910
+ case "array":
911
+ return Array.prototype.concat.apply([], U);
912
+ case "uint8array":
913
+ for (X = new Uint8Array(k), T = 0; T < U.length; T++) X.set(U[T], M), M += U[T].length;
914
+ return X;
915
+ case "nodebuffer":
916
+ return Buffer.concat(U);
917
+ default:
918
+ throw new Error("concat : unsupported type '" + P + "'");
919
+ }
920
+ }(x, y), E);
921
+ f(D);
922
+ } catch (P) {
923
+ c(P);
924
+ }
925
+ y = [];
926
+ }).resume();
927
+ });
928
+ }
929
+ function a(g, i, f) {
930
+ var c = i;
931
+ switch (i) {
932
+ case "blob":
933
+ case "arraybuffer":
934
+ c = "uint8array";
935
+ break;
936
+ case "base64":
937
+ c = "string";
938
+ }
939
+ try {
940
+ this._internalType = c, this._outputType = i, this._mimeType = f, s.checkSupport(c), this._worker = g.pipe(new o(c)), g.lock();
941
+ } catch (y) {
942
+ this._worker = new n("error"), this._worker.error(y);
943
+ }
944
+ }
945
+ a.prototype = { accumulate: function(g) {
946
+ return v(this, g);
947
+ }, on: function(g, i) {
948
+ var f = this;
949
+ return g === "data" ? this._worker.on(g, function(c) {
950
+ i.call(f, c.data, c.meta);
951
+ }) : this._worker.on(g, function() {
952
+ s.delay(i, arguments, f);
953
+ }), this;
954
+ }, resume: function() {
955
+ return s.delay(this._worker.resume, [], this._worker), this;
956
+ }, pause: function() {
957
+ return this._worker.pause(), this;
958
+ }, toNodejsStream: function(g) {
959
+ if (s.checkSupport("nodestream"), this._outputType !== "nodebuffer") throw new Error(this._outputType + " is not supported by this method");
960
+ return new _(this, { objectMode: this._outputType !== "nodebuffer" }, g);
961
+ } }, p.exports = a;
962
+ }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, p, u) {
963
+ if (u.base64 = !0, u.array = !0, u.string = !0, u.arraybuffer = typeof ArrayBuffer < "u" && typeof Uint8Array < "u", u.nodebuffer = typeof Buffer < "u", u.uint8array = typeof Uint8Array < "u", typeof ArrayBuffer > "u") u.blob = !1;
964
+ else {
965
+ var s = new ArrayBuffer(0);
966
+ try {
967
+ u.blob = new Blob([s], { type: "application/zip" }).size === 0;
968
+ } catch {
969
+ try {
970
+ var o = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
971
+ o.append(s), u.blob = o.getBlob("application/zip").size === 0;
972
+ } catch {
973
+ u.blob = !1;
974
+ }
975
+ }
976
+ }
977
+ try {
978
+ u.nodestream = !!e("readable-stream").Readable;
979
+ } catch {
980
+ u.nodestream = !1;
981
+ }
982
+ }, { "readable-stream": 16 }], 31: [function(e, p, u) {
983
+ for (var s = e("./utils"), o = e("./support"), n = e("./nodejsUtils"), h = e("./stream/GenericWorker"), w = new Array(256), b = 0; b < 256; b++) w[b] = 252 <= b ? 6 : 248 <= b ? 5 : 240 <= b ? 4 : 224 <= b ? 3 : 192 <= b ? 2 : 1;
984
+ w[254] = w[254] = 1;
985
+ function _() {
986
+ h.call(this, "utf-8 decode"), this.leftOver = null;
987
+ }
988
+ function v() {
989
+ h.call(this, "utf-8 encode");
990
+ }
991
+ u.utf8encode = function(a) {
992
+ return o.nodebuffer ? n.newBufferFrom(a, "utf-8") : function(g) {
993
+ var i, f, c, y, x, C = g.length, E = 0;
994
+ for (y = 0; y < C; y++) (64512 & (f = g.charCodeAt(y))) == 55296 && y + 1 < C && (64512 & (c = g.charCodeAt(y + 1))) == 56320 && (f = 65536 + (f - 55296 << 10) + (c - 56320), y++), E += f < 128 ? 1 : f < 2048 ? 2 : f < 65536 ? 3 : 4;
995
+ for (i = o.uint8array ? new Uint8Array(E) : new Array(E), y = x = 0; x < E; y++) (64512 & (f = g.charCodeAt(y))) == 55296 && y + 1 < C && (64512 & (c = g.charCodeAt(y + 1))) == 56320 && (f = 65536 + (f - 55296 << 10) + (c - 56320), y++), f < 128 ? i[x++] = f : (f < 2048 ? i[x++] = 192 | f >>> 6 : (f < 65536 ? i[x++] = 224 | f >>> 12 : (i[x++] = 240 | f >>> 18, i[x++] = 128 | f >>> 12 & 63), i[x++] = 128 | f >>> 6 & 63), i[x++] = 128 | 63 & f);
996
+ return i;
997
+ }(a);
998
+ }, u.utf8decode = function(a) {
999
+ return o.nodebuffer ? s.transformTo("nodebuffer", a).toString("utf-8") : function(g) {
1000
+ var i, f, c, y, x = g.length, C = new Array(2 * x);
1001
+ for (i = f = 0; i < x; ) if ((c = g[i++]) < 128) C[f++] = c;
1002
+ else if (4 < (y = w[c])) C[f++] = 65533, i += y - 1;
1003
+ else {
1004
+ for (c &= y === 2 ? 31 : y === 3 ? 15 : 7; 1 < y && i < x; ) c = c << 6 | 63 & g[i++], y--;
1005
+ 1 < y ? C[f++] = 65533 : c < 65536 ? C[f++] = c : (c -= 65536, C[f++] = 55296 | c >> 10 & 1023, C[f++] = 56320 | 1023 & c);
1006
+ }
1007
+ return C.length !== f && (C.subarray ? C = C.subarray(0, f) : C.length = f), s.applyFromCharCode(C);
1008
+ }(a = s.transformTo(o.uint8array ? "uint8array" : "array", a));
1009
+ }, s.inherits(_, h), _.prototype.processChunk = function(a) {
1010
+ var g = s.transformTo(o.uint8array ? "uint8array" : "array", a.data);
1011
+ if (this.leftOver && this.leftOver.length) {
1012
+ if (o.uint8array) {
1013
+ var i = g;
1014
+ (g = new Uint8Array(i.length + this.leftOver.length)).set(this.leftOver, 0), g.set(i, this.leftOver.length);
1015
+ } else g = this.leftOver.concat(g);
1016
+ this.leftOver = null;
1017
+ }
1018
+ var f = function(y, x) {
1019
+ var C;
1020
+ for ((x = x || y.length) > y.length && (x = y.length), C = x - 1; 0 <= C && (192 & y[C]) == 128; ) C--;
1021
+ return C < 0 || C === 0 ? x : C + w[y[C]] > x ? C : x;
1022
+ }(g), c = g;
1023
+ f !== g.length && (o.uint8array ? (c = g.subarray(0, f), this.leftOver = g.subarray(f, g.length)) : (c = g.slice(0, f), this.leftOver = g.slice(f, g.length))), this.push({ data: u.utf8decode(c), meta: a.meta });
1024
+ }, _.prototype.flush = function() {
1025
+ this.leftOver && this.leftOver.length && (this.push({ data: u.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
1026
+ }, u.Utf8DecodeWorker = _, s.inherits(v, h), v.prototype.processChunk = function(a) {
1027
+ this.push({ data: u.utf8encode(a.data), meta: a.meta });
1028
+ }, u.Utf8EncodeWorker = v;
1029
+ }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, p, u) {
1030
+ var s = e("./support"), o = e("./base64"), n = e("./nodejsUtils"), h = e("./external");
1031
+ function w(i) {
1032
+ return i;
1033
+ }
1034
+ function b(i, f) {
1035
+ for (var c = 0; c < i.length; ++c) f[c] = 255 & i.charCodeAt(c);
1036
+ return f;
1037
+ }
1038
+ e("setimmediate"), u.newBlob = function(i, f) {
1039
+ u.checkSupport("blob");
1040
+ try {
1041
+ return new Blob([i], { type: f });
1042
+ } catch {
1043
+ try {
1044
+ var c = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1045
+ return c.append(i), c.getBlob(f);
1046
+ } catch {
1047
+ throw new Error("Bug : can't construct the Blob.");
1048
+ }
1049
+ }
1050
+ };
1051
+ var _ = { stringifyByChunk: function(i, f, c) {
1052
+ var y = [], x = 0, C = i.length;
1053
+ if (C <= c) return String.fromCharCode.apply(null, i);
1054
+ for (; x < C; ) f === "array" || f === "nodebuffer" ? y.push(String.fromCharCode.apply(null, i.slice(x, Math.min(x + c, C)))) : y.push(String.fromCharCode.apply(null, i.subarray(x, Math.min(x + c, C)))), x += c;
1055
+ return y.join("");
1056
+ }, stringifyByChar: function(i) {
1057
+ for (var f = "", c = 0; c < i.length; c++) f += String.fromCharCode(i[c]);
1058
+ return f;
1059
+ }, applyCanBeUsed: { uint8array: function() {
1060
+ try {
1061
+ return s.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
1062
+ } catch {
1063
+ return !1;
1064
+ }
1065
+ }(), nodebuffer: function() {
1066
+ try {
1067
+ return s.nodebuffer && String.fromCharCode.apply(null, n.allocBuffer(1)).length === 1;
1068
+ } catch {
1069
+ return !1;
1070
+ }
1071
+ }() } };
1072
+ function v(i) {
1073
+ var f = 65536, c = u.getTypeOf(i), y = !0;
1074
+ if (c === "uint8array" ? y = _.applyCanBeUsed.uint8array : c === "nodebuffer" && (y = _.applyCanBeUsed.nodebuffer), y) for (; 1 < f; ) try {
1075
+ return _.stringifyByChunk(i, c, f);
1076
+ } catch {
1077
+ f = Math.floor(f / 2);
1078
+ }
1079
+ return _.stringifyByChar(i);
1080
+ }
1081
+ function a(i, f) {
1082
+ for (var c = 0; c < i.length; c++) f[c] = i[c];
1083
+ return f;
1084
+ }
1085
+ u.applyFromCharCode = v;
1086
+ var g = {};
1087
+ g.string = { string: w, array: function(i) {
1088
+ return b(i, new Array(i.length));
1089
+ }, arraybuffer: function(i) {
1090
+ return g.string.uint8array(i).buffer;
1091
+ }, uint8array: function(i) {
1092
+ return b(i, new Uint8Array(i.length));
1093
+ }, nodebuffer: function(i) {
1094
+ return b(i, n.allocBuffer(i.length));
1095
+ } }, g.array = { string: v, array: w, arraybuffer: function(i) {
1096
+ return new Uint8Array(i).buffer;
1097
+ }, uint8array: function(i) {
1098
+ return new Uint8Array(i);
1099
+ }, nodebuffer: function(i) {
1100
+ return n.newBufferFrom(i);
1101
+ } }, g.arraybuffer = { string: function(i) {
1102
+ return v(new Uint8Array(i));
1103
+ }, array: function(i) {
1104
+ return a(new Uint8Array(i), new Array(i.byteLength));
1105
+ }, arraybuffer: w, uint8array: function(i) {
1106
+ return new Uint8Array(i);
1107
+ }, nodebuffer: function(i) {
1108
+ return n.newBufferFrom(new Uint8Array(i));
1109
+ } }, g.uint8array = { string: v, array: function(i) {
1110
+ return a(i, new Array(i.length));
1111
+ }, arraybuffer: function(i) {
1112
+ return i.buffer;
1113
+ }, uint8array: w, nodebuffer: function(i) {
1114
+ return n.newBufferFrom(i);
1115
+ } }, g.nodebuffer = { string: v, array: function(i) {
1116
+ return a(i, new Array(i.length));
1117
+ }, arraybuffer: function(i) {
1118
+ return g.nodebuffer.uint8array(i).buffer;
1119
+ }, uint8array: function(i) {
1120
+ return a(i, new Uint8Array(i.length));
1121
+ }, nodebuffer: w }, u.transformTo = function(i, f) {
1122
+ if (f = f || "", !i) return f;
1123
+ u.checkSupport(i);
1124
+ var c = u.getTypeOf(f);
1125
+ return g[c][i](f);
1126
+ }, u.resolve = function(i) {
1127
+ for (var f = i.split("/"), c = [], y = 0; y < f.length; y++) {
1128
+ var x = f[y];
1129
+ x === "." || x === "" && y !== 0 && y !== f.length - 1 || (x === ".." ? c.pop() : c.push(x));
1130
+ }
1131
+ return c.join("/");
1132
+ }, u.getTypeOf = function(i) {
1133
+ return typeof i == "string" ? "string" : Object.prototype.toString.call(i) === "[object Array]" ? "array" : s.nodebuffer && n.isBuffer(i) ? "nodebuffer" : s.uint8array && i instanceof Uint8Array ? "uint8array" : s.arraybuffer && i instanceof ArrayBuffer ? "arraybuffer" : void 0;
1134
+ }, u.checkSupport = function(i) {
1135
+ if (!s[i.toLowerCase()]) throw new Error(i + " is not supported by this platform");
1136
+ }, u.MAX_VALUE_16BITS = 65535, u.MAX_VALUE_32BITS = -1, u.pretty = function(i) {
1137
+ var f, c, y = "";
1138
+ for (c = 0; c < (i || "").length; c++) y += "\\x" + ((f = i.charCodeAt(c)) < 16 ? "0" : "") + f.toString(16).toUpperCase();
1139
+ return y;
1140
+ }, u.delay = function(i, f, c) {
1141
+ setImmediate(function() {
1142
+ i.apply(c || null, f || []);
1143
+ });
1144
+ }, u.inherits = function(i, f) {
1145
+ function c() {
1146
+ }
1147
+ c.prototype = f.prototype, i.prototype = new c();
1148
+ }, u.extend = function() {
1149
+ var i, f, c = {};
1150
+ for (i = 0; i < arguments.length; i++) for (f in arguments[i]) Object.prototype.hasOwnProperty.call(arguments[i], f) && c[f] === void 0 && (c[f] = arguments[i][f]);
1151
+ return c;
1152
+ }, u.prepareContent = function(i, f, c, y, x) {
1153
+ return h.Promise.resolve(f).then(function(C) {
1154
+ return s.blob && (C instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(C)) !== -1) && typeof FileReader < "u" ? new h.Promise(function(E, D) {
1155
+ var P = new FileReader();
1156
+ P.onload = function(U) {
1157
+ E(U.target.result);
1158
+ }, P.onerror = function(U) {
1159
+ D(U.target.error);
1160
+ }, P.readAsArrayBuffer(C);
1161
+ }) : C;
1162
+ }).then(function(C) {
1163
+ var E = u.getTypeOf(C);
1164
+ return E ? (E === "arraybuffer" ? C = u.transformTo("uint8array", C) : E === "string" && (x ? C = o.decode(C) : c && y !== !0 && (C = function(D) {
1165
+ return b(D, s.uint8array ? new Uint8Array(D.length) : new Array(D.length));
1166
+ }(C))), C) : h.Promise.reject(new Error("Can't read the data of '" + i + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
1167
+ });
1168
+ };
1169
+ }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, p, u) {
1170
+ var s = e("./reader/readerFor"), o = e("./utils"), n = e("./signature"), h = e("./zipEntry"), w = e("./support");
1171
+ function b(_) {
1172
+ this.files = [], this.loadOptions = _;
1173
+ }
1174
+ b.prototype = { checkSignature: function(_) {
1175
+ if (!this.reader.readAndCheckSignature(_)) {
1176
+ this.reader.index -= 4;
1177
+ var v = this.reader.readString(4);
1178
+ throw new Error("Corrupted zip or bug: unexpected signature (" + o.pretty(v) + ", expected " + o.pretty(_) + ")");
1179
+ }
1180
+ }, isSignature: function(_, v) {
1181
+ var a = this.reader.index;
1182
+ this.reader.setIndex(_);
1183
+ var g = this.reader.readString(4) === v;
1184
+ return this.reader.setIndex(a), g;
1185
+ }, readBlockEndOfCentral: function() {
1186
+ this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2);
1187
+ var _ = this.reader.readData(this.zipCommentLength), v = w.uint8array ? "uint8array" : "array", a = o.transformTo(v, _);
1188
+ this.zipComment = this.loadOptions.decodeFileName(a);
1189
+ }, readBlockZip64EndOfCentral: function() {
1190
+ this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {};
1191
+ for (var _, v, a, g = this.zip64EndOfCentralSize - 44; 0 < g; ) _ = this.reader.readInt(2), v = this.reader.readInt(4), a = this.reader.readData(v), this.zip64ExtensibleData[_] = { id: _, length: v, value: a };
1192
+ }, readBlockZip64EndOfCentralLocator: function() {
1193
+ if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported");
1194
+ }, readLocalFiles: function() {
1195
+ var _, v;
1196
+ for (_ = 0; _ < this.files.length; _++) v = this.files[_], this.reader.setIndex(v.localHeaderOffset), this.checkSignature(n.LOCAL_FILE_HEADER), v.readLocalPart(this.reader), v.handleUTF8(), v.processAttributes();
1197
+ }, readCentralDir: function() {
1198
+ var _;
1199
+ for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(n.CENTRAL_FILE_HEADER); ) (_ = new h({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(_);
1200
+ if (this.centralDirRecords !== this.files.length && this.centralDirRecords !== 0 && this.files.length === 0) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
1201
+ }, readEndOfCentral: function() {
1202
+ var _ = this.reader.lastIndexOfSignature(n.CENTRAL_DIRECTORY_END);
1203
+ if (_ < 0) throw this.isSignature(0, n.LOCAL_FILE_HEADER) ? new Error("Corrupted zip: can't find end of central directory") : new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");
1204
+ this.reader.setIndex(_);
1205
+ var v = _;
1206
+ if (this.checkSignature(n.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === o.MAX_VALUE_16BITS || this.diskWithCentralDirStart === o.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === o.MAX_VALUE_16BITS || this.centralDirRecords === o.MAX_VALUE_16BITS || this.centralDirSize === o.MAX_VALUE_32BITS || this.centralDirOffset === o.MAX_VALUE_32BITS) {
1207
+ if (this.zip64 = !0, (_ = this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
1208
+ if (this.reader.setIndex(_), this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, n.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(n.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
1209
+ this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(n.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
1210
+ }
1211
+ var a = this.centralDirOffset + this.centralDirSize;
1212
+ this.zip64 && (a += 20, a += 12 + this.zip64EndOfCentralSize);
1213
+ var g = v - a;
1214
+ if (0 < g) this.isSignature(v, n.CENTRAL_FILE_HEADER) || (this.reader.zero = g);
1215
+ else if (g < 0) throw new Error("Corrupted zip: missing " + Math.abs(g) + " bytes.");
1216
+ }, prepareReader: function(_) {
1217
+ this.reader = s(_);
1218
+ }, load: function(_) {
1219
+ this.prepareReader(_), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
1220
+ } }, p.exports = b;
1221
+ }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, p, u) {
1222
+ var s = e("./reader/readerFor"), o = e("./utils"), n = e("./compressedObject"), h = e("./crc32"), w = e("./utf8"), b = e("./compressions"), _ = e("./support");
1223
+ function v(a, g) {
1224
+ this.options = a, this.loadOptions = g;
1225
+ }
1226
+ v.prototype = { isEncrypted: function() {
1227
+ return (1 & this.bitFlag) == 1;
1228
+ }, useUTF8: function() {
1229
+ return (2048 & this.bitFlag) == 2048;
1230
+ }, readLocalPart: function(a) {
1231
+ var g, i;
1232
+ if (a.skip(22), this.fileNameLength = a.readInt(2), i = a.readInt(2), this.fileName = a.readData(this.fileNameLength), a.skip(i), this.compressedSize === -1 || this.uncompressedSize === -1) throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
1233
+ if ((g = function(f) {
1234
+ for (var c in b) if (Object.prototype.hasOwnProperty.call(b, c) && b[c].magic === f) return b[c];
1235
+ return null;
1236
+ }(this.compressionMethod)) === null) throw new Error("Corrupted zip : compression " + o.pretty(this.compressionMethod) + " unknown (inner file : " + o.transformTo("string", this.fileName) + ")");
1237
+ this.decompressed = new n(this.compressedSize, this.uncompressedSize, this.crc32, g, a.readData(this.compressedSize));
1238
+ }, readCentralPart: function(a) {
1239
+ this.versionMadeBy = a.readInt(2), a.skip(2), this.bitFlag = a.readInt(2), this.compressionMethod = a.readString(2), this.date = a.readDate(), this.crc32 = a.readInt(4), this.compressedSize = a.readInt(4), this.uncompressedSize = a.readInt(4);
1240
+ var g = a.readInt(2);
1241
+ if (this.extraFieldsLength = a.readInt(2), this.fileCommentLength = a.readInt(2), this.diskNumberStart = a.readInt(2), this.internalFileAttributes = a.readInt(2), this.externalFileAttributes = a.readInt(4), this.localHeaderOffset = a.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
1242
+ a.skip(g), this.readExtraFields(a), this.parseZIP64ExtraField(a), this.fileComment = a.readData(this.fileCommentLength);
1243
+ }, processAttributes: function() {
1244
+ this.unixPermissions = null, this.dosPermissions = null;
1245
+ var a = this.versionMadeBy >> 8;
1246
+ this.dir = !!(16 & this.externalFileAttributes), a == 0 && (this.dosPermissions = 63 & this.externalFileAttributes), a == 3 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || this.fileNameStr.slice(-1) !== "/" || (this.dir = !0);
1247
+ }, parseZIP64ExtraField: function() {
1248
+ if (this.extraFields[1]) {
1249
+ var a = s(this.extraFields[1].value);
1250
+ this.uncompressedSize === o.MAX_VALUE_32BITS && (this.uncompressedSize = a.readInt(8)), this.compressedSize === o.MAX_VALUE_32BITS && (this.compressedSize = a.readInt(8)), this.localHeaderOffset === o.MAX_VALUE_32BITS && (this.localHeaderOffset = a.readInt(8)), this.diskNumberStart === o.MAX_VALUE_32BITS && (this.diskNumberStart = a.readInt(4));
1251
+ }
1252
+ }, readExtraFields: function(a) {
1253
+ var g, i, f, c = a.index + this.extraFieldsLength;
1254
+ for (this.extraFields || (this.extraFields = {}); a.index + 4 < c; ) g = a.readInt(2), i = a.readInt(2), f = a.readData(i), this.extraFields[g] = { id: g, length: i, value: f };
1255
+ a.setIndex(c);
1256
+ }, handleUTF8: function() {
1257
+ var a = _.uint8array ? "uint8array" : "array";
1258
+ if (this.useUTF8()) this.fileNameStr = w.utf8decode(this.fileName), this.fileCommentStr = w.utf8decode(this.fileComment);
1259
+ else {
1260
+ var g = this.findExtraFieldUnicodePath();
1261
+ if (g !== null) this.fileNameStr = g;
1262
+ else {
1263
+ var i = o.transformTo(a, this.fileName);
1264
+ this.fileNameStr = this.loadOptions.decodeFileName(i);
1265
+ }
1266
+ var f = this.findExtraFieldUnicodeComment();
1267
+ if (f !== null) this.fileCommentStr = f;
1268
+ else {
1269
+ var c = o.transformTo(a, this.fileComment);
1270
+ this.fileCommentStr = this.loadOptions.decodeFileName(c);
1271
+ }
1272
+ }
1273
+ }, findExtraFieldUnicodePath: function() {
1274
+ var a = this.extraFields[28789];
1275
+ if (a) {
1276
+ var g = s(a.value);
1277
+ return g.readInt(1) !== 1 || h(this.fileName) !== g.readInt(4) ? null : w.utf8decode(g.readData(a.length - 5));
1278
+ }
1279
+ return null;
1280
+ }, findExtraFieldUnicodeComment: function() {
1281
+ var a = this.extraFields[25461];
1282
+ if (a) {
1283
+ var g = s(a.value);
1284
+ return g.readInt(1) !== 1 || h(this.fileComment) !== g.readInt(4) ? null : w.utf8decode(g.readData(a.length - 5));
1285
+ }
1286
+ return null;
1287
+ } }, p.exports = v;
1288
+ }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, p, u) {
1289
+ function s(g, i, f) {
1290
+ this.name = g, this.dir = f.dir, this.date = f.date, this.comment = f.comment, this.unixPermissions = f.unixPermissions, this.dosPermissions = f.dosPermissions, this._data = i, this._dataBinary = f.binary, this.options = { compression: f.compression, compressionOptions: f.compressionOptions };
1291
+ }
1292
+ var o = e("./stream/StreamHelper"), n = e("./stream/DataWorker"), h = e("./utf8"), w = e("./compressedObject"), b = e("./stream/GenericWorker");
1293
+ s.prototype = { internalStream: function(g) {
1294
+ var i = null, f = "string";
1295
+ try {
1296
+ if (!g) throw new Error("No output type specified.");
1297
+ var c = (f = g.toLowerCase()) === "string" || f === "text";
1298
+ f !== "binarystring" && f !== "text" || (f = "string"), i = this._decompressWorker();
1299
+ var y = !this._dataBinary;
1300
+ y && !c && (i = i.pipe(new h.Utf8EncodeWorker())), !y && c && (i = i.pipe(new h.Utf8DecodeWorker()));
1301
+ } catch (x) {
1302
+ (i = new b("error")).error(x);
1303
+ }
1304
+ return new o(i, f, "");
1305
+ }, async: function(g, i) {
1306
+ return this.internalStream(g).accumulate(i);
1307
+ }, nodeStream: function(g, i) {
1308
+ return this.internalStream(g || "nodebuffer").toNodejsStream(i);
1309
+ }, _compressWorker: function(g, i) {
1310
+ if (this._data instanceof w && this._data.compression.magic === g.magic) return this._data.getCompressedWorker();
1311
+ var f = this._decompressWorker();
1312
+ return this._dataBinary || (f = f.pipe(new h.Utf8EncodeWorker())), w.createWorkerFrom(f, g, i);
1313
+ }, _decompressWorker: function() {
1314
+ return this._data instanceof w ? this._data.getContentWorker() : this._data instanceof b ? this._data : new n(this._data);
1315
+ } };
1316
+ for (var _ = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], v = function() {
1317
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
1318
+ }, a = 0; a < _.length; a++) s.prototype[_[a]] = v;
1319
+ p.exports = s;
1320
+ }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, p, u) {
1321
+ (function(s) {
1322
+ var o, n, h = s.MutationObserver || s.WebKitMutationObserver;
1323
+ if (h) {
1324
+ var w = 0, b = new h(g), _ = s.document.createTextNode("");
1325
+ b.observe(_, { characterData: !0 }), o = function() {
1326
+ _.data = w = ++w % 2;
1327
+ };
1328
+ } else if (s.setImmediate || s.MessageChannel === void 0) o = "document" in s && "onreadystatechange" in s.document.createElement("script") ? function() {
1329
+ var i = s.document.createElement("script");
1330
+ i.onreadystatechange = function() {
1331
+ g(), i.onreadystatechange = null, i.parentNode.removeChild(i), i = null;
1332
+ }, s.document.documentElement.appendChild(i);
1333
+ } : function() {
1334
+ setTimeout(g, 0);
1335
+ };
1336
+ else {
1337
+ var v = new s.MessageChannel();
1338
+ v.port1.onmessage = g, o = function() {
1339
+ v.port2.postMessage(0);
1340
+ };
1341
+ }
1342
+ var a = [];
1343
+ function g() {
1344
+ var i, f;
1345
+ n = !0;
1346
+ for (var c = a.length; c; ) {
1347
+ for (f = a, a = [], i = -1; ++i < c; ) f[i]();
1348
+ c = a.length;
1349
+ }
1350
+ n = !1;
1351
+ }
1352
+ p.exports = function(i) {
1353
+ a.push(i) !== 1 || n || o();
1354
+ };
1355
+ }).call(this, typeof Ot < "u" ? Ot : typeof self < "u" ? self : typeof window < "u" ? window : {});
1356
+ }, {}], 37: [function(e, p, u) {
1357
+ var s = e("immediate");
1358
+ function o() {
1359
+ }
1360
+ var n = {}, h = ["REJECTED"], w = ["FULFILLED"], b = ["PENDING"];
1361
+ function _(c) {
1362
+ if (typeof c != "function") throw new TypeError("resolver must be a function");
1363
+ this.state = b, this.queue = [], this.outcome = void 0, c !== o && i(this, c);
1364
+ }
1365
+ function v(c, y, x) {
1366
+ this.promise = c, typeof y == "function" && (this.onFulfilled = y, this.callFulfilled = this.otherCallFulfilled), typeof x == "function" && (this.onRejected = x, this.callRejected = this.otherCallRejected);
1367
+ }
1368
+ function a(c, y, x) {
1369
+ s(function() {
1370
+ var C;
1371
+ try {
1372
+ C = y(x);
1373
+ } catch (E) {
1374
+ return n.reject(c, E);
1375
+ }
1376
+ C === c ? n.reject(c, new TypeError("Cannot resolve promise with itself")) : n.resolve(c, C);
1377
+ });
1378
+ }
1379
+ function g(c) {
1380
+ var y = c && c.then;
1381
+ if (c && (typeof c == "object" || typeof c == "function") && typeof y == "function") return function() {
1382
+ y.apply(c, arguments);
1383
+ };
1384
+ }
1385
+ function i(c, y) {
1386
+ var x = !1;
1387
+ function C(P) {
1388
+ x || (x = !0, n.reject(c, P));
1389
+ }
1390
+ function E(P) {
1391
+ x || (x = !0, n.resolve(c, P));
1392
+ }
1393
+ var D = f(function() {
1394
+ y(E, C);
1395
+ });
1396
+ D.status === "error" && C(D.value);
1397
+ }
1398
+ function f(c, y) {
1399
+ var x = {};
1400
+ try {
1401
+ x.value = c(y), x.status = "success";
1402
+ } catch (C) {
1403
+ x.status = "error", x.value = C;
1404
+ }
1405
+ return x;
1406
+ }
1407
+ (p.exports = _).prototype.finally = function(c) {
1408
+ if (typeof c != "function") return this;
1409
+ var y = this.constructor;
1410
+ return this.then(function(x) {
1411
+ return y.resolve(c()).then(function() {
1412
+ return x;
1413
+ });
1414
+ }, function(x) {
1415
+ return y.resolve(c()).then(function() {
1416
+ throw x;
1417
+ });
1418
+ });
1419
+ }, _.prototype.catch = function(c) {
1420
+ return this.then(null, c);
1421
+ }, _.prototype.then = function(c, y) {
1422
+ if (typeof c != "function" && this.state === w || typeof y != "function" && this.state === h) return this;
1423
+ var x = new this.constructor(o);
1424
+ return this.state !== b ? a(x, this.state === w ? c : y, this.outcome) : this.queue.push(new v(x, c, y)), x;
1425
+ }, v.prototype.callFulfilled = function(c) {
1426
+ n.resolve(this.promise, c);
1427
+ }, v.prototype.otherCallFulfilled = function(c) {
1428
+ a(this.promise, this.onFulfilled, c);
1429
+ }, v.prototype.callRejected = function(c) {
1430
+ n.reject(this.promise, c);
1431
+ }, v.prototype.otherCallRejected = function(c) {
1432
+ a(this.promise, this.onRejected, c);
1433
+ }, n.resolve = function(c, y) {
1434
+ var x = f(g, y);
1435
+ if (x.status === "error") return n.reject(c, x.value);
1436
+ var C = x.value;
1437
+ if (C) i(c, C);
1438
+ else {
1439
+ c.state = w, c.outcome = y;
1440
+ for (var E = -1, D = c.queue.length; ++E < D; ) c.queue[E].callFulfilled(y);
1441
+ }
1442
+ return c;
1443
+ }, n.reject = function(c, y) {
1444
+ c.state = h, c.outcome = y;
1445
+ for (var x = -1, C = c.queue.length; ++x < C; ) c.queue[x].callRejected(y);
1446
+ return c;
1447
+ }, _.resolve = function(c) {
1448
+ return c instanceof this ? c : n.resolve(new this(o), c);
1449
+ }, _.reject = function(c) {
1450
+ var y = new this(o);
1451
+ return n.reject(y, c);
1452
+ }, _.all = function(c) {
1453
+ var y = this;
1454
+ if (Object.prototype.toString.call(c) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1455
+ var x = c.length, C = !1;
1456
+ if (!x) return this.resolve([]);
1457
+ for (var E = new Array(x), D = 0, P = -1, U = new this(o); ++P < x; ) T(c[P], P);
1458
+ return U;
1459
+ function T(M, X) {
1460
+ y.resolve(M).then(function(k) {
1461
+ E[X] = k, ++D !== x || C || (C = !0, n.resolve(U, E));
1462
+ }, function(k) {
1463
+ C || (C = !0, n.reject(U, k));
1464
+ });
1465
+ }
1466
+ }, _.race = function(c) {
1467
+ var y = this;
1468
+ if (Object.prototype.toString.call(c) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1469
+ var x = c.length, C = !1;
1470
+ if (!x) return this.resolve([]);
1471
+ for (var E = -1, D = new this(o); ++E < x; ) P = c[E], y.resolve(P).then(function(U) {
1472
+ C || (C = !0, n.resolve(D, U));
1473
+ }, function(U) {
1474
+ C || (C = !0, n.reject(D, U));
1475
+ });
1476
+ var P;
1477
+ return D;
1478
+ };
1479
+ }, { immediate: 36 }], 38: [function(e, p, u) {
1480
+ var s = {};
1481
+ (0, e("./lib/utils/common").assign)(s, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), p.exports = s;
1482
+ }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, p, u) {
1483
+ var s = e("./zlib/deflate"), o = e("./utils/common"), n = e("./utils/strings"), h = e("./zlib/messages"), w = e("./zlib/zstream"), b = Object.prototype.toString, _ = 0, v = -1, a = 0, g = 8;
1484
+ function i(c) {
1485
+ if (!(this instanceof i)) return new i(c);
1486
+ this.options = o.assign({ level: v, method: g, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: a, to: "" }, c || {});
1487
+ var y = this.options;
1488
+ y.raw && 0 < y.windowBits ? y.windowBits = -y.windowBits : y.gzip && 0 < y.windowBits && y.windowBits < 16 && (y.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new w(), this.strm.avail_out = 0;
1489
+ var x = s.deflateInit2(this.strm, y.level, y.method, y.windowBits, y.memLevel, y.strategy);
1490
+ if (x !== _) throw new Error(h[x]);
1491
+ if (y.header && s.deflateSetHeader(this.strm, y.header), y.dictionary) {
1492
+ var C;
1493
+ if (C = typeof y.dictionary == "string" ? n.string2buf(y.dictionary) : b.call(y.dictionary) === "[object ArrayBuffer]" ? new Uint8Array(y.dictionary) : y.dictionary, (x = s.deflateSetDictionary(this.strm, C)) !== _) throw new Error(h[x]);
1494
+ this._dict_set = !0;
1495
+ }
1496
+ }
1497
+ function f(c, y) {
1498
+ var x = new i(y);
1499
+ if (x.push(c, !0), x.err) throw x.msg || h[x.err];
1500
+ return x.result;
1501
+ }
1502
+ i.prototype.push = function(c, y) {
1503
+ var x, C, E = this.strm, D = this.options.chunkSize;
1504
+ if (this.ended) return !1;
1505
+ C = y === ~~y ? y : y === !0 ? 4 : 0, typeof c == "string" ? E.input = n.string2buf(c) : b.call(c) === "[object ArrayBuffer]" ? E.input = new Uint8Array(c) : E.input = c, E.next_in = 0, E.avail_in = E.input.length;
1506
+ do {
1507
+ if (E.avail_out === 0 && (E.output = new o.Buf8(D), E.next_out = 0, E.avail_out = D), (x = s.deflate(E, C)) !== 1 && x !== _) return this.onEnd(x), !(this.ended = !0);
1508
+ E.avail_out !== 0 && (E.avail_in !== 0 || C !== 4 && C !== 2) || (this.options.to === "string" ? this.onData(n.buf2binstring(o.shrinkBuf(E.output, E.next_out))) : this.onData(o.shrinkBuf(E.output, E.next_out)));
1509
+ } while ((0 < E.avail_in || E.avail_out === 0) && x !== 1);
1510
+ return C === 4 ? (x = s.deflateEnd(this.strm), this.onEnd(x), this.ended = !0, x === _) : C !== 2 || (this.onEnd(_), !(E.avail_out = 0));
1511
+ }, i.prototype.onData = function(c) {
1512
+ this.chunks.push(c);
1513
+ }, i.prototype.onEnd = function(c) {
1514
+ c === _ && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = c, this.msg = this.strm.msg;
1515
+ }, u.Deflate = i, u.deflate = f, u.deflateRaw = function(c, y) {
1516
+ return (y = y || {}).raw = !0, f(c, y);
1517
+ }, u.gzip = function(c, y) {
1518
+ return (y = y || {}).gzip = !0, f(c, y);
1519
+ };
1520
+ }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, p, u) {
1521
+ var s = e("./zlib/inflate"), o = e("./utils/common"), n = e("./utils/strings"), h = e("./zlib/constants"), w = e("./zlib/messages"), b = e("./zlib/zstream"), _ = e("./zlib/gzheader"), v = Object.prototype.toString;
1522
+ function a(i) {
1523
+ if (!(this instanceof a)) return new a(i);
1524
+ this.options = o.assign({ chunkSize: 16384, windowBits: 0, to: "" }, i || {});
1525
+ var f = this.options;
1526
+ f.raw && 0 <= f.windowBits && f.windowBits < 16 && (f.windowBits = -f.windowBits, f.windowBits === 0 && (f.windowBits = -15)), !(0 <= f.windowBits && f.windowBits < 16) || i && i.windowBits || (f.windowBits += 32), 15 < f.windowBits && f.windowBits < 48 && !(15 & f.windowBits) && (f.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new b(), this.strm.avail_out = 0;
1527
+ var c = s.inflateInit2(this.strm, f.windowBits);
1528
+ if (c !== h.Z_OK) throw new Error(w[c]);
1529
+ this.header = new _(), s.inflateGetHeader(this.strm, this.header);
1530
+ }
1531
+ function g(i, f) {
1532
+ var c = new a(f);
1533
+ if (c.push(i, !0), c.err) throw c.msg || w[c.err];
1534
+ return c.result;
1535
+ }
1536
+ a.prototype.push = function(i, f) {
1537
+ var c, y, x, C, E, D, P = this.strm, U = this.options.chunkSize, T = this.options.dictionary, M = !1;
1538
+ if (this.ended) return !1;
1539
+ y = f === ~~f ? f : f === !0 ? h.Z_FINISH : h.Z_NO_FLUSH, typeof i == "string" ? P.input = n.binstring2buf(i) : v.call(i) === "[object ArrayBuffer]" ? P.input = new Uint8Array(i) : P.input = i, P.next_in = 0, P.avail_in = P.input.length;
1540
+ do {
1541
+ if (P.avail_out === 0 && (P.output = new o.Buf8(U), P.next_out = 0, P.avail_out = U), (c = s.inflate(P, h.Z_NO_FLUSH)) === h.Z_NEED_DICT && T && (D = typeof T == "string" ? n.string2buf(T) : v.call(T) === "[object ArrayBuffer]" ? new Uint8Array(T) : T, c = s.inflateSetDictionary(this.strm, D)), c === h.Z_BUF_ERROR && M === !0 && (c = h.Z_OK, M = !1), c !== h.Z_STREAM_END && c !== h.Z_OK) return this.onEnd(c), !(this.ended = !0);
1542
+ P.next_out && (P.avail_out !== 0 && c !== h.Z_STREAM_END && (P.avail_in !== 0 || y !== h.Z_FINISH && y !== h.Z_SYNC_FLUSH) || (this.options.to === "string" ? (x = n.utf8border(P.output, P.next_out), C = P.next_out - x, E = n.buf2string(P.output, x), P.next_out = C, P.avail_out = U - C, C && o.arraySet(P.output, P.output, x, C, 0), this.onData(E)) : this.onData(o.shrinkBuf(P.output, P.next_out)))), P.avail_in === 0 && P.avail_out === 0 && (M = !0);
1543
+ } while ((0 < P.avail_in || P.avail_out === 0) && c !== h.Z_STREAM_END);
1544
+ return c === h.Z_STREAM_END && (y = h.Z_FINISH), y === h.Z_FINISH ? (c = s.inflateEnd(this.strm), this.onEnd(c), this.ended = !0, c === h.Z_OK) : y !== h.Z_SYNC_FLUSH || (this.onEnd(h.Z_OK), !(P.avail_out = 0));
1545
+ }, a.prototype.onData = function(i) {
1546
+ this.chunks.push(i);
1547
+ }, a.prototype.onEnd = function(i) {
1548
+ i === h.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = i, this.msg = this.strm.msg;
1549
+ }, u.Inflate = a, u.inflate = g, u.inflateRaw = function(i, f) {
1550
+ return (f = f || {}).raw = !0, g(i, f);
1551
+ }, u.ungzip = g;
1552
+ }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, p, u) {
1553
+ var s = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
1554
+ u.assign = function(h) {
1555
+ for (var w = Array.prototype.slice.call(arguments, 1); w.length; ) {
1556
+ var b = w.shift();
1557
+ if (b) {
1558
+ if (typeof b != "object") throw new TypeError(b + "must be non-object");
1559
+ for (var _ in b) b.hasOwnProperty(_) && (h[_] = b[_]);
1560
+ }
1561
+ }
1562
+ return h;
1563
+ }, u.shrinkBuf = function(h, w) {
1564
+ return h.length === w ? h : h.subarray ? h.subarray(0, w) : (h.length = w, h);
1565
+ };
1566
+ var o = { arraySet: function(h, w, b, _, v) {
1567
+ if (w.subarray && h.subarray) h.set(w.subarray(b, b + _), v);
1568
+ else for (var a = 0; a < _; a++) h[v + a] = w[b + a];
1569
+ }, flattenChunks: function(h) {
1570
+ var w, b, _, v, a, g;
1571
+ for (w = _ = 0, b = h.length; w < b; w++) _ += h[w].length;
1572
+ for (g = new Uint8Array(_), w = v = 0, b = h.length; w < b; w++) a = h[w], g.set(a, v), v += a.length;
1573
+ return g;
1574
+ } }, n = { arraySet: function(h, w, b, _, v) {
1575
+ for (var a = 0; a < _; a++) h[v + a] = w[b + a];
1576
+ }, flattenChunks: function(h) {
1577
+ return [].concat.apply([], h);
1578
+ } };
1579
+ u.setTyped = function(h) {
1580
+ h ? (u.Buf8 = Uint8Array, u.Buf16 = Uint16Array, u.Buf32 = Int32Array, u.assign(u, o)) : (u.Buf8 = Array, u.Buf16 = Array, u.Buf32 = Array, u.assign(u, n));
1581
+ }, u.setTyped(s);
1582
+ }, {}], 42: [function(e, p, u) {
1583
+ var s = e("./common"), o = !0, n = !0;
1584
+ try {
1585
+ String.fromCharCode.apply(null, [0]);
1586
+ } catch {
1587
+ o = !1;
1588
+ }
1589
+ try {
1590
+ String.fromCharCode.apply(null, new Uint8Array(1));
1591
+ } catch {
1592
+ n = !1;
1593
+ }
1594
+ for (var h = new s.Buf8(256), w = 0; w < 256; w++) h[w] = 252 <= w ? 6 : 248 <= w ? 5 : 240 <= w ? 4 : 224 <= w ? 3 : 192 <= w ? 2 : 1;
1595
+ function b(_, v) {
1596
+ if (v < 65537 && (_.subarray && n || !_.subarray && o)) return String.fromCharCode.apply(null, s.shrinkBuf(_, v));
1597
+ for (var a = "", g = 0; g < v; g++) a += String.fromCharCode(_[g]);
1598
+ return a;
1599
+ }
1600
+ h[254] = h[254] = 1, u.string2buf = function(_) {
1601
+ var v, a, g, i, f, c = _.length, y = 0;
1602
+ for (i = 0; i < c; i++) (64512 & (a = _.charCodeAt(i))) == 55296 && i + 1 < c && (64512 & (g = _.charCodeAt(i + 1))) == 56320 && (a = 65536 + (a - 55296 << 10) + (g - 56320), i++), y += a < 128 ? 1 : a < 2048 ? 2 : a < 65536 ? 3 : 4;
1603
+ for (v = new s.Buf8(y), i = f = 0; f < y; i++) (64512 & (a = _.charCodeAt(i))) == 55296 && i + 1 < c && (64512 & (g = _.charCodeAt(i + 1))) == 56320 && (a = 65536 + (a - 55296 << 10) + (g - 56320), i++), a < 128 ? v[f++] = a : (a < 2048 ? v[f++] = 192 | a >>> 6 : (a < 65536 ? v[f++] = 224 | a >>> 12 : (v[f++] = 240 | a >>> 18, v[f++] = 128 | a >>> 12 & 63), v[f++] = 128 | a >>> 6 & 63), v[f++] = 128 | 63 & a);
1604
+ return v;
1605
+ }, u.buf2binstring = function(_) {
1606
+ return b(_, _.length);
1607
+ }, u.binstring2buf = function(_) {
1608
+ for (var v = new s.Buf8(_.length), a = 0, g = v.length; a < g; a++) v[a] = _.charCodeAt(a);
1609
+ return v;
1610
+ }, u.buf2string = function(_, v) {
1611
+ var a, g, i, f, c = v || _.length, y = new Array(2 * c);
1612
+ for (a = g = 0; a < c; ) if ((i = _[a++]) < 128) y[g++] = i;
1613
+ else if (4 < (f = h[i])) y[g++] = 65533, a += f - 1;
1614
+ else {
1615
+ for (i &= f === 2 ? 31 : f === 3 ? 15 : 7; 1 < f && a < c; ) i = i << 6 | 63 & _[a++], f--;
1616
+ 1 < f ? y[g++] = 65533 : i < 65536 ? y[g++] = i : (i -= 65536, y[g++] = 55296 | i >> 10 & 1023, y[g++] = 56320 | 1023 & i);
1617
+ }
1618
+ return b(y, g);
1619
+ }, u.utf8border = function(_, v) {
1620
+ var a;
1621
+ for ((v = v || _.length) > _.length && (v = _.length), a = v - 1; 0 <= a && (192 & _[a]) == 128; ) a--;
1622
+ return a < 0 || a === 0 ? v : a + h[_[a]] > v ? a : v;
1623
+ };
1624
+ }, { "./common": 41 }], 43: [function(e, p, u) {
1625
+ p.exports = function(s, o, n, h) {
1626
+ for (var w = 65535 & s | 0, b = s >>> 16 & 65535 | 0, _ = 0; n !== 0; ) {
1627
+ for (n -= _ = 2e3 < n ? 2e3 : n; b = b + (w = w + o[h++] | 0) | 0, --_; ) ;
1628
+ w %= 65521, b %= 65521;
1629
+ }
1630
+ return w | b << 16 | 0;
1631
+ };
1632
+ }, {}], 44: [function(e, p, u) {
1633
+ p.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
1634
+ }, {}], 45: [function(e, p, u) {
1635
+ var s = function() {
1636
+ for (var o, n = [], h = 0; h < 256; h++) {
1637
+ o = h;
1638
+ for (var w = 0; w < 8; w++) o = 1 & o ? 3988292384 ^ o >>> 1 : o >>> 1;
1639
+ n[h] = o;
1640
+ }
1641
+ return n;
1642
+ }();
1643
+ p.exports = function(o, n, h, w) {
1644
+ var b = s, _ = w + h;
1645
+ o ^= -1;
1646
+ for (var v = w; v < _; v++) o = o >>> 8 ^ b[255 & (o ^ n[v])];
1647
+ return -1 ^ o;
1648
+ };
1649
+ }, {}], 46: [function(e, p, u) {
1650
+ var s, o = e("../utils/common"), n = e("./trees"), h = e("./adler32"), w = e("./crc32"), b = e("./messages"), _ = 0, v = 4, a = 0, g = -2, i = -1, f = 4, c = 2, y = 8, x = 9, C = 286, E = 30, D = 19, P = 2 * C + 1, U = 15, T = 3, M = 258, X = M + T + 1, k = 42, R = 113, r = 1, B = 2, tt = 3, W = 4;
1651
+ function et(t, F) {
1652
+ return t.msg = b[F], F;
1653
+ }
1654
+ function j(t) {
1655
+ return (t << 1) - (4 < t ? 9 : 0);
1656
+ }
1657
+ function Q(t) {
1658
+ for (var F = t.length; 0 <= --F; ) t[F] = 0;
1659
+ }
1660
+ function z(t) {
1661
+ var F = t.state, O = F.pending;
1662
+ O > t.avail_out && (O = t.avail_out), O !== 0 && (o.arraySet(t.output, F.pending_buf, F.pending_out, O, t.next_out), t.next_out += O, F.pending_out += O, t.total_out += O, t.avail_out -= O, F.pending -= O, F.pending === 0 && (F.pending_out = 0));
1663
+ }
1664
+ function I(t, F) {
1665
+ n._tr_flush_block(t, 0 <= t.block_start ? t.block_start : -1, t.strstart - t.block_start, F), t.block_start = t.strstart, z(t.strm);
1666
+ }
1667
+ function J(t, F) {
1668
+ t.pending_buf[t.pending++] = F;
1669
+ }
1670
+ function V(t, F) {
1671
+ t.pending_buf[t.pending++] = F >>> 8 & 255, t.pending_buf[t.pending++] = 255 & F;
1672
+ }
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, H = t.prev, Y = t.strstart + M, st = Z[S + L - 1], nt = Z[S + L];
1675
+ t.prev_length >= t.good_match && (d >>= 2), N > t.lookahead && (N = t.lookahead);
1676
+ do
1677
+ if (Z[(O = F) + L] === nt && Z[O + L - 1] === st && Z[O] === Z[S] && Z[++O] === Z[S + 1]) {
1678
+ S += 2, O++;
1679
+ do
1680
+ ;
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
+ if (m = M - (Y - S), S = Y - M, L < m) {
1683
+ if (t.match_start = F, N <= (L = m)) break;
1684
+ st = Z[S + L - 1], nt = Z[S + L];
1685
+ }
1686
+ }
1687
+ while ((F = H[F & K]) > A && --d != 0);
1688
+ return L <= t.lookahead ? L : t.lookahead;
1689
+ }
1690
+ function at(t) {
1691
+ var F, O, m, d, S, L, N, A, Z, K, H = t.w_size;
1692
+ do {
1693
+ if (d = t.window_size - t.lookahead - t.strstart, t.strstart >= H + (H - X)) {
1694
+ for (o.arraySet(t.window, t.window, H, H, 0), t.match_start -= H, t.strstart -= H, t.block_start -= H, F = O = t.hash_size; m = t.head[--F], t.head[F] = H <= m ? m - H : 0, --O; ) ;
1695
+ for (F = O = H; m = t.prev[--F], t.prev[F] = H <= m ? m - H : 0, --O; ) ;
1696
+ d += H;
1697
+ }
1698
+ if (t.strm.avail_in === 0) break;
1699
+ if (L = t.strm, N = t.window, A = t.strstart + t.lookahead, Z = d, K = void 0, K = L.avail_in, Z < K && (K = Z), O = K === 0 ? 0 : (L.avail_in -= K, o.arraySet(N, L.input, L.next_in, K, A), L.state.wrap === 1 ? L.adler = h(L.adler, N, K, A) : L.state.wrap === 2 && (L.adler = w(L.adler, N, K, A)), L.next_in += K, L.total_in += K, K), t.lookahead += O, t.lookahead + t.insert >= T) for (S = t.strstart - t.insert, t.ins_h = t.window[S], t.ins_h = (t.ins_h << t.hash_shift ^ t.window[S + 1]) & t.hash_mask; t.insert && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[S + T - 1]) & t.hash_mask, t.prev[S & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = S, S++, t.insert--, !(t.lookahead + t.insert < T)); ) ;
1700
+ } while (t.lookahead < X && t.strm.avail_in !== 0);
1701
+ }
1702
+ function dt(t, F) {
1703
+ for (var O, m; ; ) {
1704
+ if (t.lookahead < X) {
1705
+ if (at(t), t.lookahead < X && F === _) return r;
1706
+ if (t.lookahead === 0) break;
1707
+ }
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) {
1709
+ for (t.match_length--; t.strstart++, 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.match_length != 0; ) ;
1710
+ t.strstart++;
1711
+ } else t.strstart += t.match_length, t.match_length = 0, t.ins_h = t.window[t.strstart], t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + 1]) & t.hash_mask;
1712
+ else m = n._tr_tally(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++;
1713
+ if (m && (I(t, !1), t.strm.avail_out === 0)) return r;
1714
+ }
1715
+ return 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;
1716
+ }
1717
+ function rt(t, F) {
1718
+ for (var O, m, d; ; ) {
1719
+ if (t.lookahead < X) {
1720
+ if (at(t), t.lookahead < X && F === _) return r;
1721
+ if (t.lookahead === 0) break;
1722
+ }
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) {
1724
+ for (d = t.strstart + t.lookahead - T, m = n._tr_tally(t, t.strstart - 1 - t.prev_match, t.prev_length - T), t.lookahead -= t.prev_length - 1, t.prev_length -= 2; ++t.strstart <= d && (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 != 0; ) ;
1725
+ if (t.match_available = 0, t.match_length = T - 1, t.strstart++, m && (I(t, !1), t.strm.avail_out === 0)) return r;
1726
+ } else if (t.match_available) {
1727
+ if ((m = n._tr_tally(t, 0, t.window[t.strstart - 1])) && I(t, !1), t.strstart++, t.lookahead--, t.strm.avail_out === 0) return r;
1728
+ } else t.match_available = 1, t.strstart++, t.lookahead--;
1729
+ }
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
+ }
1732
+ function it(t, F, O, m, d) {
1733
+ this.good_length = t, this.max_lazy = F, this.nice_length = O, this.max_chain = m, this.func = d;
1734
+ }
1735
+ function ut() {
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
+ }
1738
+ function ot(t) {
1739
+ var F;
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
+ }
1742
+ function _t(t) {
1743
+ var F = ot(t);
1744
+ return F === a && function(O) {
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
+ }(t.state), F;
1747
+ }
1748
+ function gt(t, F, O, m, d, S) {
1749
+ if (!t) return g;
1750
+ var L = 1;
1751
+ if (F === i && (F = 6), m < 0 ? (L = 0, m = -m) : 15 < m && (L = 2, m -= 16), d < 1 || x < d || O !== y || m < 8 || 15 < m || F < 0 || 9 < F || S < 0 || f < S) return et(t, g);
1752
+ m === 8 && (m = 9);
1753
+ var N = new ut();
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
+ }
1756
+ s = [new it(0, 0, 0, 0, function(t, F) {
1757
+ var O = 65535;
1758
+ for (O > t.pending_buf_size - 5 && (O = t.pending_buf_size - 5); ; ) {
1759
+ if (t.lookahead <= 1) {
1760
+ if (at(t), t.lookahead === 0 && F === _) return r;
1761
+ if (t.lookahead === 0) break;
1762
+ }
1763
+ t.strstart += t.lookahead, t.lookahead = 0;
1764
+ var m = t.block_start + O;
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
+ }
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 it(4, 4, 8, 4, dt), new it(4, 5, 16, 8, dt), new it(4, 6, 32, 32, dt), new it(4, 4, 16, 16, rt), new it(8, 16, 32, 32, rt), new it(8, 16, 128, 128, rt), new it(8, 32, 128, 256, rt), new it(32, 128, 258, 1024, rt), new it(32, 258, 258, 4096, rt)], u.deflateInit = function(t, F) {
1769
+ return gt(t, F, y, 15, 8, 0);
1770
+ }, u.deflateInit2 = gt, u.deflateReset = _t, u.deflateResetKeep = ot, u.deflateSetHeader = function(t, F) {
1771
+ return t && t.state ? t.state.wrap !== 2 ? g : (t.state.gzhead = F, a) : g;
1772
+ }, u.deflate = function(t, F) {
1773
+ var O, m, d, S;
1774
+ if (!t || !t.state || 5 < F || F < 0) return t ? et(t, g) : g;
1775
+ if (m = t.state, !t.output || !t.input && t.avail_in !== 0 || m.status === 666 && F !== v) return et(t, t.avail_out === 0 ? -5 : g);
1776
+ if (m.strm = t, O = m.last_flush, m.last_flush = F, m.status === k) if (m.wrap === 2) t.adler = 0, J(m, 31), J(m, 139), J(m, 8), m.gzhead ? (J(m, (m.gzhead.text ? 1 : 0) + (m.gzhead.hcrc ? 2 : 0) + (m.gzhead.extra ? 4 : 0) + (m.gzhead.name ? 8 : 0) + (m.gzhead.comment ? 16 : 0)), J(m, 255 & m.gzhead.time), J(m, m.gzhead.time >> 8 & 255), J(m, m.gzhead.time >> 16 & 255), J(m, m.gzhead.time >> 24 & 255), J(m, m.level === 9 ? 2 : 2 <= m.strategy || m.level < 2 ? 4 : 0), J(m, 255 & m.gzhead.os), m.gzhead.extra && m.gzhead.extra.length && (J(m, 255 & m.gzhead.extra.length), J(m, m.gzhead.extra.length >> 8 & 255)), m.gzhead.hcrc && (t.adler = w(t.adler, m.pending_buf, m.pending, 0)), m.gzindex = 0, m.status = 69) : (J(m, 0), J(m, 0), J(m, 0), J(m, 0), J(m, 0), J(m, m.level === 9 ? 2 : 2 <= m.strategy || m.level < 2 ? 4 : 0), J(m, 3), m.status = R);
1777
+ else {
1778
+ var L = y + (m.w_bits - 8 << 4) << 8;
1779
+ L |= (2 <= m.strategy || m.level < 2 ? 0 : m.level < 6 ? 1 : m.level === 6 ? 2 : 3) << 6, m.strstart !== 0 && (L |= 32), L += 31 - L % 31, m.status = R, V(m, L), m.strstart !== 0 && (V(m, t.adler >>> 16), V(m, 65535 & t.adler)), t.adler = 1;
1780
+ }
1781
+ if (m.status === 69) if (m.gzhead.extra) {
1782
+ for (d = m.pending; m.gzindex < (65535 & m.gzhead.extra.length) && (m.pending !== m.pending_buf_size || (m.gzhead.hcrc && m.pending > d && (t.adler = w(t.adler, m.pending_buf, m.pending - d, d)), z(t), d = m.pending, m.pending !== m.pending_buf_size)); ) J(m, 255 & m.gzhead.extra[m.gzindex]), m.gzindex++;
1783
+ m.gzhead.hcrc && m.pending > d && (t.adler = w(t.adler, m.pending_buf, m.pending - d, d)), m.gzindex === m.gzhead.extra.length && (m.gzindex = 0, m.status = 73);
1784
+ } else m.status = 73;
1785
+ if (m.status === 73) if (m.gzhead.name) {
1786
+ d = m.pending;
1787
+ do {
1788
+ if (m.pending === m.pending_buf_size && (m.gzhead.hcrc && m.pending > d && (t.adler = w(t.adler, m.pending_buf, m.pending - d, d)), z(t), d = m.pending, m.pending === m.pending_buf_size)) {
1789
+ S = 1;
1790
+ break;
1791
+ }
1792
+ S = m.gzindex < m.gzhead.name.length ? 255 & m.gzhead.name.charCodeAt(m.gzindex++) : 0, J(m, S);
1793
+ } while (S !== 0);
1794
+ m.gzhead.hcrc && m.pending > d && (t.adler = w(t.adler, m.pending_buf, m.pending - d, d)), S === 0 && (m.gzindex = 0, m.status = 91);
1795
+ } else m.status = 91;
1796
+ if (m.status === 91) if (m.gzhead.comment) {
1797
+ d = m.pending;
1798
+ do {
1799
+ if (m.pending === m.pending_buf_size && (m.gzhead.hcrc && m.pending > d && (t.adler = w(t.adler, m.pending_buf, m.pending - d, d)), z(t), d = m.pending, m.pending === m.pending_buf_size)) {
1800
+ S = 1;
1801
+ break;
1802
+ }
1803
+ S = m.gzindex < m.gzhead.comment.length ? 255 & m.gzhead.comment.charCodeAt(m.gzindex++) : 0, J(m, S);
1804
+ } while (S !== 0);
1805
+ m.gzhead.hcrc && m.pending > d && (t.adler = w(t.adler, m.pending_buf, m.pending - d, d)), S === 0 && (m.status = 103);
1806
+ } else m.status = 103;
1807
+ if (m.status === 103 && (m.gzhead.hcrc ? (m.pending + 2 > m.pending_buf_size && z(t), m.pending + 2 <= m.pending_buf_size && (J(m, 255 & t.adler), J(m, t.adler >> 8 & 255), t.adler = 0, m.status = R)) : m.status = R), m.pending !== 0) {
1808
+ if (z(t), t.avail_out === 0) return m.last_flush = -1, a;
1809
+ } else if (t.avail_in === 0 && j(F) <= j(O) && F !== v) return et(t, -5);
1810
+ if (m.status === 666 && t.avail_in !== 0) return et(t, -5);
1811
+ if (t.avail_in !== 0 || m.lookahead !== 0 || F !== _ && m.status !== 666) {
1812
+ var N = m.strategy === 2 ? function(A, Z) {
1813
+ for (var K; ; ) {
1814
+ if (A.lookahead === 0 && (at(A), A.lookahead === 0)) {
1815
+ if (Z === _) return r;
1816
+ break;
1817
+ }
1818
+ if (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;
1819
+ }
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
+ }(m, F) : m.strategy === 3 ? function(A, Z) {
1822
+ for (var K, H, Y, st, nt = A.window; ; ) {
1823
+ if (A.lookahead <= M) {
1824
+ if (at(A), A.lookahead <= M && Z === _) return r;
1825
+ if (A.lookahead === 0) break;
1826
+ }
1827
+ if (A.match_length = 0, A.lookahead >= T && 0 < A.strstart && (H = nt[Y = A.strstart - 1]) === nt[++Y] && H === nt[++Y] && H === nt[++Y]) {
1828
+ st = A.strstart + M;
1829
+ do
1830
+ ;
1831
+ while (H === nt[++Y] && H === nt[++Y] && H === nt[++Y] && H === nt[++Y] && H === nt[++Y] && H === nt[++Y] && H === nt[++Y] && H === nt[++Y] && Y < st);
1832
+ A.match_length = M - (st - Y), A.match_length > A.lookahead && (A.match_length = A.lookahead);
1833
+ }
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
+ }
1836
+ 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;
1837
+ }(m, F) : s[m.level].func(m, F);
1838
+ if (N !== tt && N !== W || (m.status = 666), N === r || N === tt) return t.avail_out === 0 && (m.last_flush = -1), a;
1839
+ if (N === B && (F === 1 ? n._tr_align(m) : F !== 5 && (n._tr_stored_block(m, 0, 0, !1), F === 3 && (Q(m.head), m.lookahead === 0 && (m.strstart = 0, m.block_start = 0, m.insert = 0))), z(t), t.avail_out === 0)) return m.last_flush = -1, a;
1840
+ }
1841
+ return F !== v ? a : m.wrap <= 0 ? 1 : (m.wrap === 2 ? (J(m, 255 & t.adler), J(m, t.adler >> 8 & 255), J(m, t.adler >> 16 & 255), J(m, t.adler >> 24 & 255), J(m, 255 & t.total_in), J(m, t.total_in >> 8 & 255), J(m, t.total_in >> 16 & 255), J(m, t.total_in >> 24 & 255)) : (V(m, t.adler >>> 16), V(m, 65535 & t.adler)), z(t), 0 < m.wrap && (m.wrap = -m.wrap), m.pending !== 0 ? a : 1);
1842
+ }, u.deflateEnd = function(t) {
1843
+ var F;
1844
+ return t && t.state ? (F = t.state.status) !== k && F !== 69 && F !== 73 && F !== 91 && F !== 103 && F !== R && F !== 666 ? et(t, g) : (t.state = null, F === R ? et(t, -3) : a) : g;
1845
+ }, u.deflateSetDictionary = function(t, F) {
1846
+ var O, m, d, S, L, N, A, Z, K = F.length;
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, at(O); O.lookahead >= T; ) {
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, at(O);
1851
+ }
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
+ }, u.deflateInfo = "pako deflate (from Nodeca project)";
1854
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, p, u) {
1855
+ p.exports = function() {
1856
+ this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = !1;
1857
+ };
1858
+ }, {}], 48: [function(e, p, u) {
1859
+ p.exports = function(s, o) {
1860
+ var n, h, w, b, _, v, a, g, i, f, c, y, x, C, E, D, P, U, T, M, X, k, R, r, B;
1861
+ n = s.state, h = s.next_in, r = s.input, w = h + (s.avail_in - 5), b = s.next_out, B = s.output, _ = b - (o - s.avail_out), v = b + (s.avail_out - 257), a = n.dmax, g = n.wsize, i = n.whave, f = n.wnext, c = n.window, y = n.hold, x = n.bits, C = n.lencode, E = n.distcode, D = (1 << n.lenbits) - 1, P = (1 << n.distbits) - 1;
1862
+ t: do {
1863
+ x < 15 && (y += r[h++] << x, x += 8, y += r[h++] << x, x += 8), U = C[y & D];
1864
+ e: for (; ; ) {
1865
+ if (y >>>= T = U >>> 24, x -= T, (T = U >>> 16 & 255) === 0) B[b++] = 65535 & U;
1866
+ else {
1867
+ if (!(16 & T)) {
1868
+ if (!(64 & T)) {
1869
+ U = C[(65535 & U) + (y & (1 << T) - 1)];
1870
+ continue e;
1871
+ }
1872
+ if (32 & T) {
1873
+ n.mode = 12;
1874
+ break t;
1875
+ }
1876
+ s.msg = "invalid literal/length code", n.mode = 30;
1877
+ break t;
1878
+ }
1879
+ M = 65535 & U, (T &= 15) && (x < T && (y += r[h++] << x, x += 8), M += y & (1 << T) - 1, y >>>= T, x -= T), x < 15 && (y += r[h++] << x, x += 8, y += r[h++] << x, x += 8), U = E[y & P];
1880
+ r: for (; ; ) {
1881
+ if (y >>>= T = U >>> 24, x -= T, !(16 & (T = U >>> 16 & 255))) {
1882
+ if (!(64 & T)) {
1883
+ U = E[(65535 & U) + (y & (1 << T) - 1)];
1884
+ continue r;
1885
+ }
1886
+ s.msg = "invalid distance code", n.mode = 30;
1887
+ break t;
1888
+ }
1889
+ if (X = 65535 & U, x < (T &= 15) && (y += r[h++] << x, (x += 8) < T && (y += r[h++] << x, x += 8)), a < (X += y & (1 << T) - 1)) {
1890
+ s.msg = "invalid distance too far back", n.mode = 30;
1891
+ break t;
1892
+ }
1893
+ if (y >>>= T, x -= T, (T = b - _) < X) {
1894
+ if (i < (T = X - T) && n.sane) {
1895
+ s.msg = "invalid distance too far back", n.mode = 30;
1896
+ break t;
1897
+ }
1898
+ if (R = c, (k = 0) === f) {
1899
+ if (k += g - T, T < M) {
1900
+ for (M -= T; B[b++] = c[k++], --T; ) ;
1901
+ k = b - X, R = B;
1902
+ }
1903
+ } else if (f < T) {
1904
+ if (k += g + f - T, (T -= f) < M) {
1905
+ for (M -= T; B[b++] = c[k++], --T; ) ;
1906
+ if (k = 0, f < M) {
1907
+ for (M -= T = f; B[b++] = c[k++], --T; ) ;
1908
+ k = b - X, R = B;
1909
+ }
1910
+ }
1911
+ } else if (k += f - T, T < M) {
1912
+ for (M -= T; B[b++] = c[k++], --T; ) ;
1913
+ k = b - X, R = B;
1914
+ }
1915
+ for (; 2 < M; ) B[b++] = R[k++], B[b++] = R[k++], B[b++] = R[k++], M -= 3;
1916
+ M && (B[b++] = R[k++], 1 < M && (B[b++] = R[k++]));
1917
+ } else {
1918
+ for (k = b - X; B[b++] = B[k++], B[b++] = B[k++], B[b++] = B[k++], 2 < (M -= 3); ) ;
1919
+ M && (B[b++] = B[k++], 1 < M && (B[b++] = B[k++]));
1920
+ }
1921
+ break;
1922
+ }
1923
+ }
1924
+ break;
1925
+ }
1926
+ } while (h < w && b < v);
1927
+ h -= M = x >> 3, y &= (1 << (x -= M << 3)) - 1, s.next_in = h, s.next_out = b, s.avail_in = h < w ? w - h + 5 : 5 - (h - w), s.avail_out = b < v ? v - b + 257 : 257 - (b - v), n.hold = y, n.bits = x;
1928
+ };
1929
+ }, {}], 49: [function(e, p, u) {
1930
+ var s = e("../utils/common"), o = e("./adler32"), n = e("./crc32"), h = e("./inffast"), w = e("./inftrees"), b = 1, _ = 2, v = 0, a = -2, g = 1, i = 852, f = 592;
1931
+ function c(k) {
1932
+ return (k >>> 24 & 255) + (k >>> 8 & 65280) + ((65280 & k) << 8) + ((255 & k) << 24);
1933
+ }
1934
+ function y() {
1935
+ this.mode = 0, this.last = !1, this.wrap = 0, this.havedict = !1, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new s.Buf16(320), this.work = new s.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
1936
+ }
1937
+ function x(k) {
1938
+ var R;
1939
+ return k && k.state ? (R = k.state, k.total_in = k.total_out = R.total = 0, k.msg = "", R.wrap && (k.adler = 1 & R.wrap), R.mode = g, R.last = 0, R.havedict = 0, R.dmax = 32768, R.head = null, R.hold = 0, R.bits = 0, R.lencode = R.lendyn = new s.Buf32(i), R.distcode = R.distdyn = new s.Buf32(f), R.sane = 1, R.back = -1, v) : a;
1940
+ }
1941
+ function C(k) {
1942
+ var R;
1943
+ return k && k.state ? ((R = k.state).wsize = 0, R.whave = 0, R.wnext = 0, x(k)) : a;
1944
+ }
1945
+ function E(k, R) {
1946
+ var r, B;
1947
+ return k && k.state ? (B = k.state, R < 0 ? (r = 0, R = -R) : (r = 1 + (R >> 4), R < 48 && (R &= 15)), R && (R < 8 || 15 < R) ? a : (B.window !== null && B.wbits !== R && (B.window = null), B.wrap = r, B.wbits = R, C(k))) : a;
1948
+ }
1949
+ function D(k, R) {
1950
+ var r, B;
1951
+ return k ? (B = new y(), (k.state = B).window = null, (r = E(k, R)) !== v && (k.state = null), r) : a;
1952
+ }
1953
+ var P, U, T = !0;
1954
+ function M(k) {
1955
+ if (T) {
1956
+ var R;
1957
+ for (P = new s.Buf32(512), U = new s.Buf32(32), R = 0; R < 144; ) k.lens[R++] = 8;
1958
+ for (; R < 256; ) k.lens[R++] = 9;
1959
+ for (; R < 280; ) k.lens[R++] = 7;
1960
+ for (; R < 288; ) k.lens[R++] = 8;
1961
+ for (w(b, k.lens, 0, 288, P, 0, k.work, { bits: 9 }), R = 0; R < 32; ) k.lens[R++] = 5;
1962
+ w(_, k.lens, 0, 32, U, 0, k.work, { bits: 5 }), T = !1;
1963
+ }
1964
+ k.lencode = P, k.lenbits = 9, k.distcode = U, k.distbits = 5;
1965
+ }
1966
+ function X(k, R, r, B) {
1967
+ var tt, W = k.state;
1968
+ return W.window === null && (W.wsize = 1 << W.wbits, W.wnext = 0, W.whave = 0, W.window = new s.Buf8(W.wsize)), B >= W.wsize ? (s.arraySet(W.window, R, r - W.wsize, W.wsize, 0), W.wnext = 0, W.whave = W.wsize) : (B < (tt = W.wsize - W.wnext) && (tt = B), s.arraySet(W.window, R, r - B, tt, W.wnext), (B -= tt) ? (s.arraySet(W.window, R, r - B, B, 0), W.wnext = B, W.whave = W.wsize) : (W.wnext += tt, W.wnext === W.wsize && (W.wnext = 0), W.whave < W.wsize && (W.whave += tt))), 0;
1969
+ }
1970
+ u.inflateReset = C, u.inflateReset2 = E, u.inflateResetKeep = x, u.inflateInit = function(k) {
1971
+ return D(k, 15);
1972
+ }, u.inflateInit2 = D, u.inflate = function(k, R) {
1973
+ var r, B, tt, W, et, j, Q, z, I, J, V, q, at, dt, rt, it, ut, ot, _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
+ if (!k || !k.state || !k.output || !k.input && k.avail_in !== 0) return a;
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
+ t: for (; ; ) switch (r.mode) {
1977
+ case g:
1978
+ if (r.wrap === 0) {
1979
+ r.mode = 13;
1980
+ break;
1981
+ }
1982
+ for (; I < 16; ) {
1983
+ if (j === 0) break t;
1984
+ j--, z += B[W++] << I, I += 8;
1985
+ }
1986
+ if (2 & r.wrap && z === 35615) {
1987
+ S[r.check = 0] = 255 & z, S[1] = z >>> 8 & 255, r.check = n(r.check, S, 2, 0), I = z = 0, r.mode = 2;
1988
+ break;
1989
+ }
1990
+ if (r.flags = 0, r.head && (r.head.done = !1), !(1 & r.wrap) || (((255 & z) << 8) + (z >> 8)) % 31) {
1991
+ k.msg = "incorrect header check", r.mode = 30;
1992
+ break;
1993
+ }
1994
+ if ((15 & z) != 8) {
1995
+ k.msg = "unknown compression method", r.mode = 30;
1996
+ break;
1997
+ }
1998
+ if (I -= 4, t = 8 + (15 & (z >>>= 4)), r.wbits === 0) r.wbits = t;
1999
+ else if (t > r.wbits) {
2000
+ k.msg = "invalid window size", r.mode = 30;
2001
+ break;
2002
+ }
2003
+ r.dmax = 1 << t, k.adler = r.check = 1, r.mode = 512 & z ? 10 : 12, I = z = 0;
2004
+ break;
2005
+ case 2:
2006
+ for (; I < 16; ) {
2007
+ if (j === 0) break t;
2008
+ j--, z += B[W++] << I, I += 8;
2009
+ }
2010
+ if (r.flags = z, (255 & r.flags) != 8) {
2011
+ k.msg = "unknown compression method", r.mode = 30;
2012
+ break;
2013
+ }
2014
+ if (57344 & r.flags) {
2015
+ k.msg = "unknown header flags set", r.mode = 30;
2016
+ break;
2017
+ }
2018
+ r.head && (r.head.text = z >> 8 & 1), 512 & r.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, r.check = n(r.check, S, 2, 0)), I = z = 0, r.mode = 3;
2019
+ case 3:
2020
+ for (; I < 32; ) {
2021
+ if (j === 0) break t;
2022
+ j--, z += B[W++] << I, I += 8;
2023
+ }
2024
+ r.head && (r.head.time = z), 512 & r.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, S[2] = z >>> 16 & 255, S[3] = z >>> 24 & 255, r.check = n(r.check, S, 4, 0)), I = z = 0, r.mode = 4;
2025
+ case 4:
2026
+ for (; I < 16; ) {
2027
+ if (j === 0) break t;
2028
+ j--, z += B[W++] << I, I += 8;
2029
+ }
2030
+ r.head && (r.head.xflags = 255 & z, r.head.os = z >> 8), 512 & r.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, r.check = n(r.check, S, 2, 0)), I = z = 0, r.mode = 5;
2031
+ case 5:
2032
+ if (1024 & r.flags) {
2033
+ for (; I < 16; ) {
2034
+ if (j === 0) break t;
2035
+ j--, z += B[W++] << I, I += 8;
2036
+ }
2037
+ r.length = z, r.head && (r.head.extra_len = z), 512 & r.flags && (S[0] = 255 & z, S[1] = z >>> 8 & 255, r.check = n(r.check, S, 2, 0)), I = z = 0;
2038
+ } else r.head && (r.head.extra = null);
2039
+ r.mode = 6;
2040
+ case 6:
2041
+ if (1024 & r.flags && (j < (q = r.length) && (q = j), q && (r.head && (t = r.head.extra_len - r.length, r.head.extra || (r.head.extra = new Array(r.head.extra_len)), s.arraySet(r.head.extra, B, W, q, t)), 512 & r.flags && (r.check = n(r.check, B, q, W)), j -= q, W += q, r.length -= q), r.length)) break t;
2042
+ r.length = 0, r.mode = 7;
2043
+ case 7:
2044
+ if (2048 & r.flags) {
2045
+ if (j === 0) break t;
2046
+ for (q = 0; t = B[W + q++], r.head && t && r.length < 65536 && (r.head.name += String.fromCharCode(t)), t && q < j; ) ;
2047
+ if (512 & r.flags && (r.check = n(r.check, B, q, W)), j -= q, W += q, t) break t;
2048
+ } else r.head && (r.head.name = null);
2049
+ r.length = 0, r.mode = 8;
2050
+ case 8:
2051
+ if (4096 & r.flags) {
2052
+ if (j === 0) break t;
2053
+ for (q = 0; t = B[W + q++], r.head && t && r.length < 65536 && (r.head.comment += String.fromCharCode(t)), t && q < j; ) ;
2054
+ if (512 & r.flags && (r.check = n(r.check, B, q, W)), j -= q, W += q, t) break t;
2055
+ } else r.head && (r.head.comment = null);
2056
+ r.mode = 9;
2057
+ case 9:
2058
+ if (512 & r.flags) {
2059
+ for (; I < 16; ) {
2060
+ if (j === 0) break t;
2061
+ j--, z += B[W++] << I, I += 8;
2062
+ }
2063
+ if (z !== (65535 & r.check)) {
2064
+ k.msg = "header crc mismatch", r.mode = 30;
2065
+ break;
2066
+ }
2067
+ I = z = 0;
2068
+ }
2069
+ r.head && (r.head.hcrc = r.flags >> 9 & 1, r.head.done = !0), k.adler = r.check = 0, r.mode = 12;
2070
+ break;
2071
+ case 10:
2072
+ for (; I < 32; ) {
2073
+ if (j === 0) break t;
2074
+ j--, z += B[W++] << I, I += 8;
2075
+ }
2076
+ k.adler = r.check = c(z), I = z = 0, r.mode = 11;
2077
+ case 11:
2078
+ if (r.havedict === 0) return k.next_out = et, k.avail_out = Q, k.next_in = W, k.avail_in = j, r.hold = z, r.bits = I, 2;
2079
+ k.adler = r.check = 1, r.mode = 12;
2080
+ case 12:
2081
+ if (R === 5 || R === 6) break t;
2082
+ case 13:
2083
+ if (r.last) {
2084
+ z >>>= 7 & I, I -= 7 & I, r.mode = 27;
2085
+ break;
2086
+ }
2087
+ for (; I < 3; ) {
2088
+ if (j === 0) break t;
2089
+ j--, z += B[W++] << I, I += 8;
2090
+ }
2091
+ switch (r.last = 1 & z, I -= 1, 3 & (z >>>= 1)) {
2092
+ case 0:
2093
+ r.mode = 14;
2094
+ break;
2095
+ case 1:
2096
+ if (M(r), r.mode = 20, R !== 6) break;
2097
+ z >>>= 2, I -= 2;
2098
+ break t;
2099
+ case 2:
2100
+ r.mode = 17;
2101
+ break;
2102
+ case 3:
2103
+ k.msg = "invalid block type", r.mode = 30;
2104
+ }
2105
+ z >>>= 2, I -= 2;
2106
+ break;
2107
+ case 14:
2108
+ for (z >>>= 7 & I, I -= 7 & I; I < 32; ) {
2109
+ if (j === 0) break t;
2110
+ j--, z += B[W++] << I, I += 8;
2111
+ }
2112
+ if ((65535 & z) != (z >>> 16 ^ 65535)) {
2113
+ k.msg = "invalid stored block lengths", r.mode = 30;
2114
+ break;
2115
+ }
2116
+ if (r.length = 65535 & z, I = z = 0, r.mode = 15, R === 6) break t;
2117
+ case 15:
2118
+ r.mode = 16;
2119
+ case 16:
2120
+ if (q = r.length) {
2121
+ if (j < q && (q = j), Q < q && (q = Q), q === 0) break t;
2122
+ s.arraySet(tt, B, W, q, et), j -= q, W += q, Q -= q, et += q, r.length -= q;
2123
+ break;
2124
+ }
2125
+ r.mode = 12;
2126
+ break;
2127
+ case 17:
2128
+ for (; I < 14; ) {
2129
+ if (j === 0) break t;
2130
+ j--, z += B[W++] << I, I += 8;
2131
+ }
2132
+ if (r.nlen = 257 + (31 & z), z >>>= 5, I -= 5, r.ndist = 1 + (31 & z), z >>>= 5, I -= 5, r.ncode = 4 + (15 & z), z >>>= 4, I -= 4, 286 < r.nlen || 30 < r.ndist) {
2133
+ k.msg = "too many length or distance symbols", r.mode = 30;
2134
+ break;
2135
+ }
2136
+ r.have = 0, r.mode = 18;
2137
+ case 18:
2138
+ for (; r.have < r.ncode; ) {
2139
+ for (; I < 3; ) {
2140
+ if (j === 0) break t;
2141
+ j--, z += B[W++] << I, I += 8;
2142
+ }
2143
+ r.lens[L[r.have++]] = 7 & z, z >>>= 3, I -= 3;
2144
+ }
2145
+ for (; r.have < 19; ) r.lens[L[r.have++]] = 0;
2146
+ if (r.lencode = r.lendyn, r.lenbits = 7, O = { bits: r.lenbits }, F = w(0, r.lens, 0, 19, r.lencode, 0, r.work, O), r.lenbits = O.bits, F) {
2147
+ k.msg = "invalid code lengths set", r.mode = 30;
2148
+ break;
2149
+ }
2150
+ r.have = 0, r.mode = 19;
2151
+ case 19:
2152
+ for (; r.have < r.nlen + r.ndist; ) {
2153
+ for (; it = (d = r.lencode[z & (1 << r.lenbits) - 1]) >>> 16 & 255, ut = 65535 & d, !((rt = d >>> 24) <= I); ) {
2154
+ if (j === 0) break t;
2155
+ j--, z += B[W++] << I, I += 8;
2156
+ }
2157
+ if (ut < 16) z >>>= rt, I -= rt, r.lens[r.have++] = ut;
2158
+ else {
2159
+ if (ut === 16) {
2160
+ for (m = rt + 2; I < m; ) {
2161
+ if (j === 0) break t;
2162
+ j--, z += B[W++] << I, I += 8;
2163
+ }
2164
+ if (z >>>= rt, I -= rt, r.have === 0) {
2165
+ k.msg = "invalid bit length repeat", r.mode = 30;
2166
+ break;
2167
+ }
2168
+ t = r.lens[r.have - 1], q = 3 + (3 & z), z >>>= 2, I -= 2;
2169
+ } else if (ut === 17) {
2170
+ for (m = rt + 3; I < m; ) {
2171
+ if (j === 0) break t;
2172
+ j--, z += B[W++] << I, I += 8;
2173
+ }
2174
+ I -= rt, t = 0, q = 3 + (7 & (z >>>= rt)), z >>>= 3, I -= 3;
2175
+ } else {
2176
+ for (m = rt + 7; I < m; ) {
2177
+ if (j === 0) break t;
2178
+ j--, z += B[W++] << I, I += 8;
2179
+ }
2180
+ I -= rt, t = 0, q = 11 + (127 & (z >>>= rt)), z >>>= 7, I -= 7;
2181
+ }
2182
+ if (r.have + q > r.nlen + r.ndist) {
2183
+ k.msg = "invalid bit length repeat", r.mode = 30;
2184
+ break;
2185
+ }
2186
+ for (; q--; ) r.lens[r.have++] = t;
2187
+ }
2188
+ }
2189
+ if (r.mode === 30) break;
2190
+ if (r.lens[256] === 0) {
2191
+ k.msg = "invalid code -- missing end-of-block", r.mode = 30;
2192
+ break;
2193
+ }
2194
+ if (r.lenbits = 9, O = { bits: r.lenbits }, F = w(b, r.lens, 0, r.nlen, r.lencode, 0, r.work, O), r.lenbits = O.bits, F) {
2195
+ k.msg = "invalid literal/lengths set", r.mode = 30;
2196
+ break;
2197
+ }
2198
+ if (r.distbits = 6, r.distcode = r.distdyn, O = { bits: r.distbits }, F = w(_, r.lens, r.nlen, r.ndist, r.distcode, 0, r.work, O), r.distbits = O.bits, F) {
2199
+ k.msg = "invalid distances set", r.mode = 30;
2200
+ break;
2201
+ }
2202
+ if (r.mode = 20, R === 6) break t;
2203
+ case 20:
2204
+ r.mode = 21;
2205
+ case 21:
2206
+ if (6 <= j && 258 <= Q) {
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
+ break;
2209
+ }
2210
+ for (r.back = 0; it = (d = r.lencode[z & (1 << r.lenbits) - 1]) >>> 16 & 255, ut = 65535 & d, !((rt = d >>> 24) <= I); ) {
2211
+ if (j === 0) break t;
2212
+ j--, z += B[W++] << I, I += 8;
2213
+ }
2214
+ if (it && !(240 & it)) {
2215
+ for (ot = rt, _t = it, gt = ut; it = (d = r.lencode[gt + ((z & (1 << ot + _t) - 1) >> ot)]) >>> 16 & 255, ut = 65535 & d, !(ot + (rt = d >>> 24) <= I); ) {
2216
+ if (j === 0) break t;
2217
+ j--, z += B[W++] << I, I += 8;
2218
+ }
2219
+ z >>>= ot, I -= ot, r.back += ot;
2220
+ }
2221
+ if (z >>>= rt, I -= rt, r.back += rt, r.length = ut, it === 0) {
2222
+ r.mode = 26;
2223
+ break;
2224
+ }
2225
+ if (32 & it) {
2226
+ r.back = -1, r.mode = 12;
2227
+ break;
2228
+ }
2229
+ if (64 & it) {
2230
+ k.msg = "invalid literal/length code", r.mode = 30;
2231
+ break;
2232
+ }
2233
+ r.extra = 15 & it, r.mode = 22;
2234
+ case 22:
2235
+ if (r.extra) {
2236
+ for (m = r.extra; I < m; ) {
2237
+ if (j === 0) break t;
2238
+ j--, z += B[W++] << I, I += 8;
2239
+ }
2240
+ r.length += z & (1 << r.extra) - 1, z >>>= r.extra, I -= r.extra, r.back += r.extra;
2241
+ }
2242
+ r.was = r.length, r.mode = 23;
2243
+ case 23:
2244
+ for (; it = (d = r.distcode[z & (1 << r.distbits) - 1]) >>> 16 & 255, ut = 65535 & d, !((rt = d >>> 24) <= I); ) {
2245
+ if (j === 0) break t;
2246
+ j--, z += B[W++] << I, I += 8;
2247
+ }
2248
+ if (!(240 & it)) {
2249
+ for (ot = rt, _t = it, gt = ut; it = (d = r.distcode[gt + ((z & (1 << ot + _t) - 1) >> ot)]) >>> 16 & 255, ut = 65535 & d, !(ot + (rt = d >>> 24) <= I); ) {
2250
+ if (j === 0) break t;
2251
+ j--, z += B[W++] << I, I += 8;
2252
+ }
2253
+ z >>>= ot, I -= ot, r.back += ot;
2254
+ }
2255
+ if (z >>>= rt, I -= rt, r.back += rt, 64 & it) {
2256
+ k.msg = "invalid distance code", r.mode = 30;
2257
+ break;
2258
+ }
2259
+ r.offset = ut, r.extra = 15 & it, r.mode = 24;
2260
+ case 24:
2261
+ if (r.extra) {
2262
+ for (m = r.extra; I < m; ) {
2263
+ if (j === 0) break t;
2264
+ j--, z += B[W++] << I, I += 8;
2265
+ }
2266
+ r.offset += z & (1 << r.extra) - 1, z >>>= r.extra, I -= r.extra, r.back += r.extra;
2267
+ }
2268
+ if (r.offset > r.dmax) {
2269
+ k.msg = "invalid distance too far back", r.mode = 30;
2270
+ break;
2271
+ }
2272
+ r.mode = 25;
2273
+ case 25:
2274
+ if (Q === 0) break t;
2275
+ if (q = V - Q, r.offset > q) {
2276
+ if ((q = r.offset - q) > r.whave && r.sane) {
2277
+ k.msg = "invalid distance too far back", r.mode = 30;
2278
+ break;
2279
+ }
2280
+ at = 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, at = et - r.offset, q = r.length;
2282
+ for (Q < q && (q = Q), Q -= q, r.length -= q; tt[et++] = dt[at++], --q; ) ;
2283
+ r.length === 0 && (r.mode = 21);
2284
+ break;
2285
+ case 26:
2286
+ if (Q === 0) break t;
2287
+ tt[et++] = r.length, Q--, r.mode = 21;
2288
+ break;
2289
+ case 27:
2290
+ if (r.wrap) {
2291
+ for (; I < 32; ) {
2292
+ if (j === 0) break t;
2293
+ j--, z |= B[W++] << I, I += 8;
2294
+ }
2295
+ if (V -= Q, k.total_out += V, r.total += V, V && (k.adler = r.check = r.flags ? n(r.check, tt, V, et - V) : o(r.check, tt, V, et - V)), V = Q, (r.flags ? z : c(z)) !== r.check) {
2296
+ k.msg = "incorrect data check", r.mode = 30;
2297
+ break;
2298
+ }
2299
+ I = z = 0;
2300
+ }
2301
+ r.mode = 28;
2302
+ case 28:
2303
+ if (r.wrap && r.flags) {
2304
+ for (; I < 32; ) {
2305
+ if (j === 0) break t;
2306
+ j--, z += B[W++] << I, I += 8;
2307
+ }
2308
+ if (z !== (4294967295 & r.total)) {
2309
+ k.msg = "incorrect length check", r.mode = 30;
2310
+ break;
2311
+ }
2312
+ I = z = 0;
2313
+ }
2314
+ r.mode = 29;
2315
+ case 29:
2316
+ F = 1;
2317
+ break t;
2318
+ case 30:
2319
+ F = -3;
2320
+ break t;
2321
+ case 31:
2322
+ return -4;
2323
+ case 32:
2324
+ default:
2325
+ return a;
2326
+ }
2327
+ return k.next_out = et, k.avail_out = Q, k.next_in = W, k.avail_in = j, r.hold = z, r.bits = I, (r.wsize || V !== k.avail_out && r.mode < 30 && (r.mode < 27 || R !== 4)) && X(k, k.output, k.next_out, V - k.avail_out) ? (r.mode = 31, -4) : (J -= k.avail_in, V -= k.avail_out, k.total_in += J, k.total_out += V, r.total += V, r.wrap && V && (k.adler = r.check = r.flags ? n(r.check, tt, V, k.next_out - V) : o(r.check, tt, V, k.next_out - V)), k.data_type = r.bits + (r.last ? 64 : 0) + (r.mode === 12 ? 128 : 0) + (r.mode === 20 || r.mode === 15 ? 256 : 0), (J == 0 && V === 0 || R === 4) && F === v && (F = -5), F);
2328
+ }, u.inflateEnd = function(k) {
2329
+ if (!k || !k.state) return a;
2330
+ var R = k.state;
2331
+ return R.window && (R.window = null), k.state = null, v;
2332
+ }, u.inflateGetHeader = function(k, R) {
2333
+ var r;
2334
+ return k && k.state && 2 & (r = k.state).wrap ? ((r.head = R).done = !1, v) : a;
2335
+ }, u.inflateSetDictionary = function(k, R) {
2336
+ var r, B = R.length;
2337
+ return k && k.state ? (r = k.state).wrap !== 0 && r.mode !== 11 ? a : r.mode === 11 && o(1, R, B, 0) !== r.check ? -3 : X(k, R, B, B) ? (r.mode = 31, -4) : (r.havedict = 1, v) : a;
2338
+ }, u.inflateInfo = "pako inflate (from Nodeca project)";
2339
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, p, u) {
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
+ 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), at = null, dt = 0;
2343
+ for (k = 0; k <= 15; k++) V[k] = 0;
2344
+ for (R = 0; R < a; R++) V[_[v + R]]++;
2345
+ for (tt = X, B = 15; 1 <= B && V[B] === 0; B--) ;
2346
+ if (B < tt && (tt = B), B === 0) return g[i++] = 20971520, g[i++] = 20971520, c.bits = 1, 0;
2347
+ for (r = 1; r < B && V[r] === 0; r++) ;
2348
+ for (tt < r && (tt = r), k = j = 1; k <= 15; k++) if (j <<= 1, (j -= V[k]) < 0) return -1;
2349
+ if (0 < j && (b === 0 || B !== 1)) return -1;
2350
+ for (q[1] = 0, k = 1; k < 15; k++) q[k + 1] = q[k] + V[k];
2351
+ for (R = 0; R < a; R++) _[v + R] !== 0 && (f[q[_[v + R]]++] = R);
2352
+ if (P = b === 0 ? (I = at = f, 19) : b === 1 ? (I = o, J -= 257, at = n, dt -= 257, 256) : (I = h, at = 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
+ for (; ; ) {
2354
+ for (U = k - et, M = f[R] < P ? (T = 0, f[R]) : f[R] > P ? (T = at[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
+ for (y = 1 << k - 1; z & y; ) y >>= 1;
2356
+ if (y !== 0 ? (z &= y - 1, z += y) : z = 0, R++, --V[k] == 0) {
2357
+ if (k === B) break;
2358
+ k = _[v + f[R]];
2359
+ }
2360
+ if (tt < k && (z & E) !== C) {
2361
+ for (et === 0 && (et = tt), D += r, j = 1 << (W = k - et); W + et < B && !((j -= V[W + et]) <= 0); ) W++, j <<= 1;
2362
+ if (Q += 1 << W, b === 1 && 852 < Q || b === 2 && 592 < Q) return 1;
2363
+ g[C = z & E] = tt << 24 | W << 16 | D - i | 0;
2364
+ }
2365
+ }
2366
+ return z !== 0 && (g[D + z] = k - et << 24 | 64 << 16 | 0), c.bits = tt, 0;
2367
+ };
2368
+ }, { "../utils/common": 41 }], 51: [function(e, p, u) {
2369
+ p.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" };
2370
+ }, {}], 52: [function(e, p, u) {
2371
+ var s = e("../utils/common"), o = 0, n = 1;
2372
+ function h(d) {
2373
+ for (var S = d.length; 0 <= --S; ) d[S] = 0;
2374
+ }
2375
+ var w = 0, b = 29, _ = 256, v = _ + 1 + b, a = 30, g = 19, i = 2 * v + 1, f = 15, c = 16, y = 7, x = 256, C = 16, E = 17, D = 18, P = [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], U = [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], T = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], M = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], X = new Array(2 * (v + 2));
2376
+ h(X);
2377
+ var k = new Array(2 * a);
2378
+ h(k);
2379
+ var R = new Array(512);
2380
+ h(R);
2381
+ var r = new Array(256);
2382
+ h(r);
2383
+ var B = new Array(b);
2384
+ h(B);
2385
+ var tt, W, et, j = new Array(a);
2386
+ function Q(d, S, L, N, A) {
2387
+ this.static_tree = d, this.extra_bits = S, this.extra_base = L, this.elems = N, this.max_length = A, this.has_stree = d && d.length;
2388
+ }
2389
+ function z(d, S) {
2390
+ this.dyn_tree = d, this.max_code = 0, this.stat_desc = S;
2391
+ }
2392
+ function I(d) {
2393
+ return d < 256 ? R[d] : R[256 + (d >>> 7)];
2394
+ }
2395
+ function J(d, S) {
2396
+ d.pending_buf[d.pending++] = 255 & S, d.pending_buf[d.pending++] = S >>> 8 & 255;
2397
+ }
2398
+ function V(d, S, L) {
2399
+ d.bi_valid > c - L ? (d.bi_buf |= S << d.bi_valid & 65535, J(d, d.bi_buf), d.bi_buf = S >> c - d.bi_valid, d.bi_valid += L - c) : (d.bi_buf |= S << d.bi_valid & 65535, d.bi_valid += L);
2400
+ }
2401
+ function q(d, S, L) {
2402
+ V(d, L[2 * S], L[2 * S + 1]);
2403
+ }
2404
+ function at(d, S) {
2405
+ for (var L = 0; L |= 1 & d, d >>>= 1, L <<= 1, 0 < --S; ) ;
2406
+ return L >>> 1;
2407
+ }
2408
+ function dt(d, S, L) {
2409
+ var N, A, Z = new Array(f + 1), K = 0;
2410
+ for (N = 1; N <= f; N++) Z[N] = K = K + L[N - 1] << 1;
2411
+ for (A = 0; A <= S; A++) {
2412
+ var H = d[2 * A + 1];
2413
+ H !== 0 && (d[2 * A] = at(Z[H]++, H));
2414
+ }
2415
+ }
2416
+ function rt(d) {
2417
+ var S;
2418
+ for (S = 0; S < v; S++) d.dyn_ltree[2 * S] = 0;
2419
+ for (S = 0; S < a; S++) d.dyn_dtree[2 * S] = 0;
2420
+ for (S = 0; S < g; S++) d.bl_tree[2 * S] = 0;
2421
+ d.dyn_ltree[2 * x] = 1, d.opt_len = d.static_len = 0, d.last_lit = d.matches = 0;
2422
+ }
2423
+ function it(d) {
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
+ }
2426
+ function ut(d, S, L, N) {
2427
+ var A = 2 * S, Z = 2 * L;
2428
+ return d[A] < d[Z] || d[A] === d[Z] && N[S] <= N[L];
2429
+ }
2430
+ function ot(d, S, L) {
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
+ d.heap[L] = N;
2433
+ }
2434
+ function _t(d, S, L) {
2435
+ var N, A, Z, K, H = 0;
2436
+ if (d.last_lit !== 0) for (; N = d.pending_buf[d.d_buf + 2 * H] << 8 | d.pending_buf[d.d_buf + 2 * H + 1], A = d.pending_buf[d.l_buf + H], H++, N === 0 ? q(d, A, S) : (q(d, (Z = r[A]) + _ + 1, S), (K = P[Z]) !== 0 && V(d, A -= B[Z], K), q(d, Z = I(--N), L), (K = U[Z]) !== 0 && V(d, N -= j[Z], K)), H < d.last_lit; ) ;
2437
+ q(d, x, S);
2438
+ }
2439
+ function gt(d, S) {
2440
+ var L, N, A, Z = S.dyn_tree, K = S.stat_desc.static_tree, H = S.stat_desc.has_stree, Y = S.stat_desc.elems, st = -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] = st = L, d.depth[L] = 0) : Z[2 * L + 1] = 0;
2442
+ for (; d.heap_len < 2; ) Z[2 * (A = d.heap[++d.heap_len] = st < 2 ? ++st : 0)] = 1, d.depth[A] = 0, d.opt_len--, H && (d.static_len -= K[2 * A + 1]);
2443
+ for (S.max_code = st, L = d.heap_len >> 1; 1 <= L; L--) ot(d, Z, L);
2444
+ for (A = Y; L = d.heap[1], d.heap[1] = d.heap[d.heap_len--], ot(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++, ot(d, Z, 1), 2 <= d.heap_len; ) ;
2445
+ d.heap[--d.heap_max] = d.heap[1], function(nt, mt) {
2446
+ var xt, yt, St, lt, 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 (lt = 0; lt <= f; lt++) nt.bl_count[lt] = 0;
2448
+ for (bt[2 * nt.heap[nt.heap_max] + 1] = 0, xt = nt.heap_max + 1; xt < i; xt++) Et < (lt = bt[2 * bt[2 * (yt = nt.heap[xt]) + 1] + 1] + 1) && (lt = Et, It++), bt[2 * yt + 1] = lt, Bt < yt || (nt.bl_count[lt]++, At = 0, Lt <= yt && (At = jt[yt - Lt]), Dt = bt[2 * yt], nt.opt_len += Dt * (lt + At), Wt && (nt.static_len += Dt * (Ut[2 * yt + 1] + At)));
2449
+ if (It !== 0) {
2450
+ do {
2451
+ for (lt = Et - 1; nt.bl_count[lt] === 0; ) lt--;
2452
+ nt.bl_count[lt]--, nt.bl_count[lt + 1] += 2, nt.bl_count[Et]--, It -= 2;
2453
+ } while (0 < It);
2454
+ for (lt = Et; lt !== 0; lt--) for (yt = nt.bl_count[lt]; yt !== 0; ) Bt < (St = nt.heap[--xt]) || (bt[2 * St + 1] !== lt && (nt.opt_len += (lt - bt[2 * St + 1]) * bt[2 * St], bt[2 * St + 1] = lt), yt--);
2455
+ }
2456
+ }(d, S), dt(Z, st, d.bl_count);
2457
+ }
2458
+ function t(d, S, L) {
2459
+ var N, A, Z = -1, K = S[1], H = 0, Y = 7, st = 4;
2460
+ for (K === 0 && (Y = 138, st = 3), S[2 * (L + 1) + 1] = 65535, N = 0; N <= L; N++) A = K, K = S[2 * (N + 1) + 1], ++H < Y && A === K || (H < st ? d.bl_tree[2 * A] += H : A !== 0 ? (A !== Z && d.bl_tree[2 * A]++, d.bl_tree[2 * C]++) : H <= 10 ? d.bl_tree[2 * E]++ : d.bl_tree[2 * D]++, Z = A, st = (H = 0) === K ? (Y = 138, 3) : A === K ? (Y = 6, 3) : (Y = 7, 4));
2461
+ }
2462
+ function F(d, S, L) {
2463
+ var N, A, Z = -1, K = S[1], H = 0, Y = 7, st = 4;
2464
+ for (K === 0 && (Y = 138, st = 3), N = 0; N <= L; N++) if (A = K, K = S[2 * (N + 1) + 1], !(++H < Y && A === K)) {
2465
+ if (H < st) for (; q(d, A, d.bl_tree), --H != 0; ) ;
2466
+ else A !== 0 ? (A !== Z && (q(d, A, d.bl_tree), H--), q(d, C, d.bl_tree), V(d, H - 3, 2)) : H <= 10 ? (q(d, E, d.bl_tree), V(d, H - 3, 3)) : (q(d, D, d.bl_tree), V(d, H - 11, 7));
2467
+ Z = A, st = (H = 0) === K ? (Y = 138, 3) : A === K ? (Y = 6, 3) : (Y = 7, 4);
2468
+ }
2469
+ }
2470
+ h(j);
2471
+ var O = !1;
2472
+ function m(d, S, L, N) {
2473
+ V(d, (w << 1) + (N ? 1 : 0), 3), function(A, Z, K, H) {
2474
+ it(A), J(A, K), J(A, ~K), s.arraySet(A.pending_buf, A.window, Z, K, A.pending), A.pending += K;
2475
+ }(d, S, L);
2476
+ }
2477
+ u._tr_init = function(d) {
2478
+ O || (function() {
2479
+ var S, L, N, A, Z, K = new Array(f + 1);
2480
+ for (A = N = 0; A < b - 1; A++) for (B[A] = N, S = 0; S < 1 << P[A]; S++) r[N++] = A;
2481
+ for (r[N - 1] = A, A = Z = 0; A < 16; A++) for (j[A] = Z, S = 0; S < 1 << U[A]; S++) R[Z++] = A;
2482
+ for (Z >>= 7; A < a; A++) for (j[A] = Z << 7, S = 0; S < 1 << U[A] - 7; S++) R[256 + Z++] = A;
2483
+ for (L = 0; L <= f; L++) K[L] = 0;
2484
+ for (S = 0; S <= 143; ) X[2 * S + 1] = 8, S++, K[8]++;
2485
+ for (; S <= 255; ) X[2 * S + 1] = 9, S++, K[9]++;
2486
+ for (; S <= 279; ) X[2 * S + 1] = 7, S++, K[7]++;
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] = at(S, 5);
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
+ }(), 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
+ }, u._tr_stored_block = m, u._tr_flush_block = function(d, S, L, N) {
2492
+ var A, Z, K = 0;
2493
+ 0 < d.level ? (d.strm.data_type === 2 && (d.strm.data_type = function(H) {
2494
+ var Y, st = 4093624447;
2495
+ for (Y = 0; Y <= 31; Y++, st >>>= 1) if (1 & st && H.dyn_ltree[2 * Y] !== 0) return o;
2496
+ if (H.dyn_ltree[18] !== 0 || H.dyn_ltree[20] !== 0 || H.dyn_ltree[26] !== 0) return n;
2497
+ for (Y = 32; Y < _; Y++) if (H.dyn_ltree[2 * Y] !== 0) return n;
2498
+ return o;
2499
+ }(d)), gt(d, d.l_desc), gt(d, d.d_desc), K = function(H) {
2500
+ var Y;
2501
+ for (t(H, H.dyn_ltree, H.l_desc.max_code), t(H, H.dyn_dtree, H.d_desc.max_code), gt(H, H.bl_desc), Y = g - 1; 3 <= Y && H.bl_tree[2 * M[Y] + 1] === 0; Y--) ;
2502
+ return H.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(H, Y, st, nt) {
2504
+ var mt;
2505
+ for (V(H, Y - 257, 5), V(H, st - 1, 5), V(H, nt - 4, 4), mt = 0; mt < nt; mt++) V(H, H.bl_tree[2 * M[mt] + 1], 3);
2506
+ F(H, H.dyn_ltree, Y - 1), F(H, H.dyn_dtree, st - 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 && it(d);
2508
+ }, u._tr_tally = function(d, S, L) {
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
+ }, u._tr_align = function(d) {
2511
+ V(d, 2, 3), q(d, x, X), function(S) {
2512
+ S.bi_valid === 16 ? (J(S, S.bi_buf), S.bi_buf = 0, S.bi_valid = 0) : 8 <= S.bi_valid && (S.pending_buf[S.pending++] = 255 & S.bi_buf, S.bi_buf >>= 8, S.bi_valid -= 8);
2513
+ }(d);
2514
+ };
2515
+ }, { "../utils/common": 41 }], 53: [function(e, p, u) {
2516
+ p.exports = function() {
2517
+ this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
2518
+ };
2519
+ }, {}], 54: [function(e, p, u) {
2520
+ (function(s) {
2521
+ (function(o, n) {
2522
+ if (!o.setImmediate) {
2523
+ var h, w, b, _, v = 1, a = {}, g = !1, i = o.document, f = Object.getPrototypeOf && Object.getPrototypeOf(o);
2524
+ f = f && f.setTimeout ? f : o, h = {}.toString.call(o.process) === "[object process]" ? function(C) {
2525
+ process.nextTick(function() {
2526
+ y(C);
2527
+ });
2528
+ } : function() {
2529
+ if (o.postMessage && !o.importScripts) {
2530
+ var C = !0, E = o.onmessage;
2531
+ return o.onmessage = function() {
2532
+ C = !1;
2533
+ }, o.postMessage("", "*"), o.onmessage = E, C;
2534
+ }
2535
+ }() ? (_ = "setImmediate$" + Math.random() + "$", o.addEventListener ? o.addEventListener("message", x, !1) : o.attachEvent("onmessage", x), function(C) {
2536
+ o.postMessage(_ + C, "*");
2537
+ }) : o.MessageChannel ? ((b = new MessageChannel()).port1.onmessage = function(C) {
2538
+ y(C.data);
2539
+ }, function(C) {
2540
+ b.port2.postMessage(C);
2541
+ }) : i && "onreadystatechange" in i.createElement("script") ? (w = i.documentElement, function(C) {
2542
+ var E = i.createElement("script");
2543
+ E.onreadystatechange = function() {
2544
+ y(C), E.onreadystatechange = null, w.removeChild(E), E = null;
2545
+ }, w.appendChild(E);
2546
+ }) : function(C) {
2547
+ setTimeout(y, 0, C);
2548
+ }, f.setImmediate = function(C) {
2549
+ typeof C != "function" && (C = new Function("" + C));
2550
+ for (var E = new Array(arguments.length - 1), D = 0; D < E.length; D++) E[D] = arguments[D + 1];
2551
+ var P = { callback: C, args: E };
2552
+ return a[v] = P, h(v), v++;
2553
+ }, f.clearImmediate = c;
2554
+ }
2555
+ function c(C) {
2556
+ delete a[C];
2557
+ }
2558
+ function y(C) {
2559
+ if (g) setTimeout(y, 0, C);
2560
+ else {
2561
+ var E = a[C];
2562
+ if (E) {
2563
+ g = !0;
2564
+ try {
2565
+ (function(D) {
2566
+ var P = D.callback, U = D.args;
2567
+ switch (U.length) {
2568
+ case 0:
2569
+ P();
2570
+ break;
2571
+ case 1:
2572
+ P(U[0]);
2573
+ break;
2574
+ case 2:
2575
+ P(U[0], U[1]);
2576
+ break;
2577
+ case 3:
2578
+ P(U[0], U[1], U[2]);
2579
+ break;
2580
+ default:
2581
+ P.apply(n, U);
2582
+ }
2583
+ })(E);
2584
+ } finally {
2585
+ c(C), g = !1;
2586
+ }
2587
+ }
2588
+ }
2589
+ }
2590
+ function x(C) {
2591
+ C.source === o && typeof C.data == "string" && C.data.indexOf(_) === 0 && y(+C.data.slice(_.length));
2592
+ }
2593
+ })(typeof self > "u" ? s === void 0 ? this : s : self);
2594
+ }).call(this, typeof Ot < "u" ? Ot : typeof self < "u" ? self : typeof window < "u" ? window : {});
2595
+ }, {}] }, {}, [10])(10);
2596
+ });
2597
+ })(Nt);
2598
+ var Gt = Nt.exports;
2599
+ const qt = /* @__PURE__ */ Ht(Gt), ht = class ht {
2600
+ constructor(l, e, p) {
2601
+ $(this, "idref");
2602
+ $(this, "href");
2603
+ $(this, "cfi");
2604
+ $(this, "linear");
2605
+ $(this, "page_spread");
2606
+ $(this, "rendition_viewport");
2607
+ $(this, "rendition_spread");
2608
+ $(this, "rendition_orientation");
2609
+ $(this, "rendition_layout");
2610
+ $(this, "rendition_flow");
2611
+ $(this, "media_overlay_id");
2612
+ $(this, "media_type");
2613
+ $(this, "index");
2614
+ $(this, "spine");
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
+ }
2617
+ validateSpread() {
2618
+ this.page_spread && this.page_spread !== ht.SPREAD_LEFT && this.page_spread !== ht.SPREAD_RIGHT && this.page_spread !== ht.SPREAD_CENTER && console.warn(`${this.page_spread} is not a recognized spread type`);
2619
+ }
2620
+ // Helpers
2621
+ isReflowable() {
2622
+ return !this.isFixedLayout();
2623
+ }
2624
+ isFixedLayout() {
2625
+ const l = this.getRenditionLayout();
2626
+ return l ? l === ht.RENDITION_LAYOUT_PREPAGINATED : this.spine.package.isFixedLayout();
2627
+ }
2628
+ getRenditionLayout() {
2629
+ return this.rendition_layout || this.spine.package.rendition_layout;
2630
+ }
2631
+ // Additional methods based on legacy SpineItem.js...
2632
+ static alternateSpread(l) {
2633
+ return l === ht.SPREAD_LEFT ? ht.SPREAD_RIGHT : l === ht.SPREAD_RIGHT ? ht.SPREAD_LEFT : l;
2634
+ }
2635
+ };
2636
+ $(ht, "readonlyRENDITION_LAYOUT_REFLOWABLE", "reflowable"), $(ht, "RENDITION_LAYOUT_PREPAGINATED", "pre-paginated"), $(ht, "SPREAD_LEFT", "page-spread-left"), $(ht, "SPREAD_RIGHT", "page-spread-right"), $(ht, "SPREAD_CENTER", "page-spread-center"), $(ht, "SPREAD_NONE", "none"), $(ht, "SPREAD_AUTO", "auto"), $(ht, "FLOW_PAGINATED", "paginated"), $(ht, "FLOW_SCROLLED_CONTINUOUS", "scrolled-continuous"), $(ht, "FLOW_SCROLLED_DOC", "scrolled-doc"), $(ht, "FLOW_AUTO", "auto");
2637
+ let Ft = ht;
2638
+ class $t {
2639
+ // Default behavior
2640
+ constructor(l, e) {
2641
+ $(this, "package");
2642
+ $(this, "items", []);
2643
+ $(this, "direction", "ltr");
2644
+ $(this, "handleLinear", !0);
2645
+ this.package = l, e && (this.direction = e.direction || "ltr", e.items && e.items.forEach((p, u) => {
2646
+ this.items.push(new Ft(p, u, this));
2647
+ }));
2648
+ }
2649
+ isValidLinearItem(l) {
2650
+ if (l < 0 || l >= this.items.length) return !1;
2651
+ const e = this.items[l];
2652
+ return this.handleLinear ? e.linear !== "no" : !0;
2653
+ }
2654
+ item(l) {
2655
+ return this.items[l];
2656
+ }
2657
+ getItemByHref(l) {
2658
+ return this.items.find((e) => l.endsWith(e.href) || e.href.endsWith(l));
2659
+ }
2660
+ first() {
2661
+ return this.items[0];
2662
+ }
2663
+ firstLinear() {
2664
+ return this.items.find((l) => l.linear !== "no");
2665
+ }
2666
+ nextItem(l) {
2667
+ const e = l.index + 1;
2668
+ if (e < this.items.length) return this.items[e];
2669
+ }
2670
+ prevItem(l) {
2671
+ const e = l.index - 1;
2672
+ if (e >= 0) return this.items[e];
2673
+ }
2674
+ nextLinear(l) {
2675
+ let e = l.index + 1;
2676
+ for (; e < this.items.length; ) {
2677
+ if (this.items[e].linear !== "no") return this.items[e];
2678
+ e++;
2679
+ }
2680
+ }
2681
+ prevLinear(l) {
2682
+ let e = l.index - 1;
2683
+ for (; e >= 0; ) {
2684
+ if (this.items[e].linear !== "no") return this.items[e];
2685
+ e--;
2686
+ }
2687
+ }
2688
+ last() {
2689
+ return this.items[this.items.length - 1];
2690
+ }
2691
+ }
2692
+ class Vt {
2693
+ constructor(l) {
2694
+ $(this, "identifier");
2695
+ $(this, "title");
2696
+ $(this, "author");
2697
+ $(this, "description");
2698
+ $(this, "publisher");
2699
+ $(this, "language");
2700
+ $(this, "rights");
2701
+ $(this, "modifiedDate");
2702
+ $(this, "publishedDate");
2703
+ $(this, "epubVersion");
2704
+ l && (this.identifier = l.id, this.title = l.title, this.author = l.author, this.description = l.description, this.language = l.language, this.publisher = l.publisher, this.rights = l.rights, this.modifiedDate = l.modified_date, this.publishedDate = l.pubdate, this.epubVersion = l.epub_version);
2705
+ }
2706
+ }
2707
+ class Kt {
2708
+ constructor(l) {
2709
+ $(this, "rootUrl");
2710
+ $(this, "rootUrlMO");
2711
+ $(this, "spine");
2712
+ $(this, "metadata");
2713
+ // Add metadata
2714
+ $(this, "zip");
2715
+ // Add zip property
2716
+ $(this, "rendition_viewport");
2717
+ $(this, "rendition_layout");
2718
+ $(this, "rendition_flow");
2719
+ $(this, "rendition_orientation");
2720
+ $(this, "rendition_spread");
2721
+ $(this, "toc");
2722
+ this.rootUrl = l.rootUrl, this.rootUrlMO = l.rootUrlMO, this.rendition_layout = l.rendition_layout, this.rendition_flow = l.rendition_flow, this.rendition_spread = l.rendition_spread, this.spine = new $t(this, l.spine), this.metadata = new Vt(l.metadata), this.toc = l.toc, this.zip = l.zip || null;
2723
+ }
2724
+ resolveRelativeUrl(l) {
2725
+ return this.rootUrl ? this.rootUrl.endsWith("/") ? this.rootUrl + l : this.rootUrl + "/" + l : l;
2726
+ }
2727
+ isFixedLayout() {
2728
+ return this.rendition_layout === "pre-paginated";
2729
+ }
2730
+ async loadFile(l) {
2731
+ if (this.zip) {
2732
+ let e = this.zip.file(l);
2733
+ if (e) return await e.async("string");
2734
+ const p = this.resolveRelativeUrl(l), u = p.indexOf(".epub");
2735
+ if (u !== -1) {
2736
+ let s = p.substring(u + 5);
2737
+ if (s.startsWith("/") && (s = s.substring(1)), e = this.zip.file(s), e) return await e.async("string");
2738
+ }
2739
+ if (l.startsWith("/")) {
2740
+ const s = l.substring(1);
2741
+ if (e = this.zip.file(s), e) return await e.async("string");
2742
+ }
2743
+ return console.warn("File not found in zip:", l), null;
2744
+ } else {
2745
+ const e = this.resolveRelativeUrl(l), p = await fetch(e);
2746
+ return p.ok ? await p.text() : null;
2747
+ }
2748
+ }
2749
+ async loadBlob(l) {
2750
+ if (this.zip) {
2751
+ let e = this.zip.file(l);
2752
+ if (!e) {
2753
+ const p = this.resolveRelativeUrl(l), u = p.indexOf(".epub");
2754
+ if (u !== -1) {
2755
+ let s = p.substring(u + 5);
2756
+ s.startsWith("/") && (s = s.substring(1)), e = this.zip.file(s);
2757
+ }
2758
+ }
2759
+ return !e && l.startsWith("/") && (e = this.zip.file(l.substring(1))), e ? await e.async("blob") : null;
2760
+ } else {
2761
+ const e = this.resolveRelativeUrl(l), p = await fetch(e);
2762
+ return p.ok ? await p.blob() : null;
2763
+ }
2764
+ }
2765
+ }
2766
+ class Rt {
2767
+ static async load(l) {
2768
+ let e = null, p = async (_) => {
2769
+ const v = await fetch(l + (l.endsWith("/") ? "" : "/") + _);
2770
+ return v.ok ? v.text() : null;
2771
+ };
2772
+ if (l.toLowerCase().endsWith(".epub"))
2773
+ try {
2774
+ const v = await (await fetch(l)).blob();
2775
+ e = await qt.loadAsync(v), p = async (g) => {
2776
+ const i = e == null ? void 0 : e.file(g);
2777
+ return i ? await i.async("string") : null;
2778
+ };
2779
+ } catch (_) {
2780
+ console.warn("Retrying as unzipped folder...", _);
2781
+ }
2782
+ const u = await p("META-INF/container.xml");
2783
+ if (!u) throw new Error("Could not find META-INF/container.xml");
2784
+ const s = new DOMParser(), n = s.parseFromString(u, "application/xml").querySelector("rootfile");
2785
+ if (!n) throw new Error("No rootfile in container.xml");
2786
+ const h = n.getAttribute("full-path");
2787
+ if (!h) throw new Error("No full-path in rootfile");
2788
+ const w = await p(h);
2789
+ if (!w) throw new Error("Could not find OPF: " + h);
2790
+ const b = s.parseFromString(w, "application/xml");
2791
+ return await Rt.parseOpf(b, l, h, p, e);
2792
+ }
2793
+ static async parseOpf(l, e, p, u, s) {
2794
+ var f, c, y, x, C, E;
2795
+ const o = l.querySelector("metadata"), n = l.querySelector("manifest"), h = l.querySelector("spine");
2796
+ if (!o || !n || !h) throw new Error("Invalid OPF");
2797
+ const w = {
2798
+ title: ((f = o.querySelector("title")) == null ? void 0 : f.textContent) || "Unknown Title",
2799
+ creator: ((c = o.querySelector("creator")) == null ? void 0 : c.textContent) || "",
2800
+ language: ((y = o.querySelector("language")) == null ? void 0 : y.textContent) || "",
2801
+ identifier: ((x = o.querySelector("identifier")) == null ? void 0 : x.textContent) || "",
2802
+ pubDate: ((C = o.querySelector("date")) == null ? void 0 : C.textContent) || ""
2803
+ }, b = {};
2804
+ n.querySelectorAll("item").forEach((D) => {
2805
+ const P = D.getAttribute("id"), U = D.getAttribute("href");
2806
+ P && U && (b[P] = U);
2807
+ });
2808
+ const _ = [], v = p.substring(0, p.lastIndexOf("/") + 1), a = e + v;
2809
+ h.querySelectorAll("itemref").forEach((D) => {
2810
+ const P = D.getAttribute("idref");
2811
+ P && b[P] && _.push({
2812
+ idref: P,
2813
+ href: b[P],
2814
+ // This is relative to OPF
2815
+ linear: D.getAttribute("linear") || "yes"
2816
+ });
2817
+ });
2818
+ let g = [];
2819
+ const i = h.getAttribute("toc");
2820
+ if (i && b[i]) {
2821
+ const D = b[i], U = p.substring(0, p.lastIndexOf("/") + 1) + D;
2822
+ try {
2823
+ const T = await u(U);
2824
+ if (T) {
2825
+ const X = new DOMParser().parseFromString(T, "application/xml");
2826
+ g = Rt.parseNcx(X);
2827
+ }
2828
+ } catch (T) {
2829
+ console.warn("Failed to parse NCX", T);
2830
+ }
2831
+ }
2832
+ return new Kt({
2833
+ rootUrl: a,
2834
+ // The root for resolving spine items
2835
+ metadata: w,
2836
+ spine: {
2837
+ items: _
2838
+ },
2839
+ toc: g,
2840
+ zip: s,
2841
+ rendition_layout: ((E = o.querySelector("meta[property='rendition:layout']")) == null ? void 0 : E.textContent) || "reflowable"
2842
+ });
2843
+ }
2844
+ static parseNcx(l) {
2845
+ const e = l.querySelector("navMap");
2846
+ if (!e) return [];
2847
+ const p = (u) => {
2848
+ const s = [];
2849
+ return Array.from(u.children).forEach((o) => {
2850
+ var n, h;
2851
+ if (o.tagName.toLowerCase() === "navpoint") {
2852
+ const w = ((n = o.querySelector("navLabel > text")) == null ? void 0 : n.textContent) || "Untitled", b = ((h = o.querySelector("content")) == null ? void 0 : h.getAttribute("src")) || "", _ = p(o);
2853
+ s.push({ name: w, Id_link: b, sub: _ });
2854
+ }
2855
+ }), s;
2856
+ };
2857
+ return p(e);
2858
+ }
2859
+ }
2860
+ class Yt {
2861
+ constructor(l) {
2862
+ $(this, "container");
2863
+ $(this, "epubPackage");
2864
+ $(this, "iframe");
2865
+ $(this, "internalWrapper");
2866
+ // Wrapper for responsive padding
2867
+ $(this, "resizeObserver");
2868
+ $(this, "isSingleImageMode", !1);
2869
+ // Pagination & Style State
2870
+ $(this, "columnGap", 40);
2871
+ $(this, "currentPageIndex", 0);
2872
+ $(this, "pageCount", 0);
2873
+ $(this, "currentSettings", {});
2874
+ $(this, "currentBookStyles", []);
2875
+ // Frame Management
2876
+ $(this, "frames", []);
2877
+ $(this, "isLoadingNext", !1);
2878
+ $(this, "activeFrameObserver", null);
2879
+ $(this, "currentItem");
2880
+ this.container = l, this.internalWrapper = document.createElement("div"), this.internalWrapper.classList.add("tr-internal-wrapper"), this.container.appendChild(this.internalWrapper), console.log("ReaderView: Internal wrapper created and appended", this.internalWrapper), this.container.addEventListener("scroll", this.onContainerScroll.bind(this)), this.resizeObserver = new ResizeObserver(() => {
2881
+ this.onContainerResize();
2882
+ }), this.resizeObserver.observe(this.container);
2883
+ }
2884
+ onContainerResize() {
2885
+ if (!this.iframe) return;
2886
+ let l = null;
2887
+ const e = this.currentSettings.scroll !== "scroll-continuous";
2888
+ if (e && this.iframe.contentDocument && (l = this.getVisibleElement()), this.updatePagination(this.iframe), l ? this.scrollToElement(l) : e && this.scrollToPage(this.currentPageIndex), this.currentSettings.scroll === "scroll-continuous" && this.isSingleImageMode) {
2889
+ const p = this.container.clientHeight, u = this.container.clientWidth;
2890
+ if (this.iframe.style.height = `${p}px`, this.iframe.contentDocument) {
2891
+ const s = this.iframe.contentDocument.getElementsByTagName("svg");
2892
+ if (s.length > 0) {
2893
+ const n = s[0];
2894
+ n.style.height = `${p}px`, n.style.width = `${u}px`, n.style.maxHeight = "100%", n.style.maxWidth = "100%";
2895
+ }
2896
+ const o = this.iframe.contentDocument.getElementsByTagName("img");
2897
+ if (o.length > 0) {
2898
+ const n = o[0];
2899
+ n.style.maxHeight = "100%", n.style.maxWidth = "100%";
2900
+ }
2901
+ }
2902
+ console.log("Syncing Single Image Height:", p);
2903
+ }
2904
+ }
2905
+ openBook(l) {
2906
+ this.epubPackage = l;
2907
+ const e = l.spine.firstLinear();
2908
+ e && this.openSpineItem(e);
2909
+ }
2910
+ // ... Methods ...
2911
+ // ... (rest of method)
2912
+ async openPageRight() {
2913
+ if (this.currentPageIndex < this.pageCount - 1)
2914
+ this.currentPageIndex++, this.scrollToPage(this.currentPageIndex);
2915
+ else {
2916
+ if (!this.epubPackage || !this.currentItem) return;
2917
+ const l = this.epubPackage.spine.nextLinear(this.currentItem);
2918
+ l && (this.currentPageIndex = 0, await this.openSpineItem(l));
2919
+ }
2920
+ }
2921
+ async openPageLeft() {
2922
+ if (this.currentPageIndex > 0)
2923
+ this.currentPageIndex--, this.scrollToPage(this.currentPageIndex);
2924
+ else {
2925
+ if (!this.epubPackage || !this.currentItem) return;
2926
+ const l = this.epubPackage.spine.prevLinear(this.currentItem);
2927
+ l && (this.currentPageIndex = -1, await this.openSpineItem(l));
2928
+ }
2929
+ }
2930
+ async openSpineItem(l, e = !1) {
2931
+ e || (this.internalWrapper.innerHTML = "", this.frames = [], this.iframe = void 0);
2932
+ const p = document.createElement("iframe");
2933
+ if (p.style.width = "100%", p.style.border = "none", this.currentSettings.scroll === "scroll-continuous" ? (p.style.height = "100vh", p.scrolling = "no", this.container.style.overflowY = "auto") : (p.style.height = "100%", this.container.style.overflowY = "hidden"), this.internalWrapper.appendChild(p), this.frames.push({ item: l, element: p }), e || (this.iframe = p), this.epubPackage) {
2934
+ let u = null;
2935
+ if (l.media_type && l.media_type.startsWith("image/")) {
2936
+ const s = await this.epubPackage.loadBlob(l.href);
2937
+ s && (u = `<!DOCTYPE html>
2938
+ <html style="height:100%"><head>
2939
+ <title>Image Content</title>
2940
+ <style>
2941
+ body { margin:0; padding:0; height:100%; display:flex;
2942
+ align-items:center; justify-content:center; }
2943
+ img { max-height:100%; max-width:100%; object-fit:contain; }
2944
+ </style>
2945
+ </head><body>
2946
+ <img src="${URL.createObjectURL(s)}">
2947
+ </body></html>`);
2948
+ } else
2949
+ u = await this.epubPackage.loadFile(l.href), u && this.epubPackage.zip && (u = await this.injectResources(u, l.href));
2950
+ u ? (p.srcdoc = u, p.onload = () => {
2951
+ this.initFrameContent(p);
2952
+ }, console.log(`Loading spine item: ${l.href}`), e || (this.currentItem = l)) : console.error("Failed to load content for", l.href);
2953
+ }
2954
+ }
2955
+ onContainerScroll() {
2956
+ if (this.currentSettings.scroll !== "scroll-continuous" || this.isLoadingNext) return;
2957
+ const { scrollTop: l, scrollHeight: e, clientHeight: p } = this.container;
2958
+ l + p > e - 500 && this.loadNextChapter();
2959
+ }
2960
+ async loadNextChapter() {
2961
+ if (!this.epubPackage || !this.frames.length) return;
2962
+ const l = this.frames[this.frames.length - 1], e = this.epubPackage.spine.nextLinear(l.item);
2963
+ e && (console.log("Auto-loading next chapter:", e.href), this.isLoadingNext = !0, await this.openSpineItem(e, !0), this.isLoadingNext = !1);
2964
+ }
2965
+ initFrameContent(l) {
2966
+ if (!l || !l.contentDocument) return;
2967
+ const e = l.contentDocument, p = e.documentElement, u = e.body;
2968
+ u.addEventListener("click", (b) => {
2969
+ let _ = b.target;
2970
+ for (; _ && _ !== u && _.tagName !== "A"; )
2971
+ _ = _.parentElement;
2972
+ if (_ && _.tagName === "A") {
2973
+ const v = _.getAttribute("href");
2974
+ v && (b.preventDefault(), this.handleLinkClick(v));
2975
+ }
2976
+ }), this.applySettingsToDoc(e, l), this.applyStylesToFrame(l);
2977
+ const s = u.getElementsByTagName("img"), o = u.getElementsByTagName("svg"), h = (u.textContent || "").replace(/\s/g, "").length < 50;
2978
+ let w = !1;
2979
+ if (s.length === 1 && o.length === 0 && h || o.length === 1 && s.length === 0 && h) {
2980
+ if (w = !0, console.log("Detected Single Image / Cover Page. Applying 'Contain' styles."), p.style.height = "100%", u.style.height = "100%", u.style.margin = "0", u.style.display = "flex", u.style.flexDirection = "column", u.style.justifyContent = "center", u.style.alignItems = "center", u.style.overflow = "hidden", s.length > 0) {
2981
+ const b = s[0];
2982
+ b.style.maxWidth = "100%", b.style.maxHeight = "100%", b.style.objectFit = "contain", b.style.margin = "0 auto", b.style.display = "block";
2983
+ } else if (o.length > 0) {
2984
+ const b = o[0];
2985
+ b.style.width = "100%", b.style.height = "100%", b.style.maxHeight = "100%", b.style.maxWidth = "100%", b.style.margin = "0 auto", b.style.display = "block", b.style.backgroundColor = "transparent", this.currentSettings.scroll === "scroll-continuous" && (b.style.height = "100vh", b.style.maxHeight = "100vh");
2986
+ }
2987
+ }
2988
+ this.isSingleImageMode = w, this.updatePagination(l), window.addEventListener("resize", () => {
2989
+ this.updatePagination(l);
2990
+ }), this.setupFrameHeightLogic(l, w), this.currentSettings.scroll !== "scroll-continuous" && this.currentPageIndex < 0 && (this.currentPageIndex = this.pageCount - 1, this.scrollToPage(this.currentPageIndex));
2991
+ }
2992
+ updateSettings(l) {
2993
+ let e = null;
2994
+ this.currentSettings.scroll !== "scroll-continuous" && this.iframe && (e = this.getVisibleElement()), this.currentSettings = { ...this.currentSettings, ...l }, this.frames.forEach((p) => {
2995
+ p.element.contentDocument && (this.setupFrameHeightLogic(p.element, this.isSingleImageMode), this.applySettingsToDoc(p.element.contentDocument, p.element), this.updatePagination(p.element));
2996
+ }), e && this.iframe && (console.log("Restoring position to anchor element:", e), this.scrollToElement(e)), this.currentSettings.scroll === "scroll-continuous" ? this.container.style.overflowY = "auto" : (this.container.style.overflowY = "hidden", this.activeFrameObserver && (this.activeFrameObserver.disconnect(), this.activeFrameObserver = null));
2997
+ }
2998
+ getVisibleElement() {
2999
+ if (!this.iframe || !this.iframe.contentDocument) return null;
3000
+ const e = this.iframe.contentDocument.body, p = this.iframe.clientWidth, u = Array.from(e.querySelectorAll("p, h1, h2, h3, h4, h5, h6, li, blockquote, div"));
3001
+ for (const s of u) {
3002
+ const o = s.getBoundingClientRect();
3003
+ if (o.left >= -50 && o.top >= 0 && o.left < p)
3004
+ return s;
3005
+ }
3006
+ return null;
3007
+ }
3008
+ scrollToElement(l) {
3009
+ if (!this.iframe || !this.iframe.contentDocument) return;
3010
+ const e = this.iframe.contentDocument.documentElement, p = Math.abs(parseFloat(e.style.left || "0")), s = l.getBoundingClientRect().left + p, n = this.iframe.clientWidth + this.columnGap, h = Math.floor(s / n);
3011
+ console.log(`Restoring Element: absoluteLeft=${s}, newPageIndex=${h}`), this.currentPageIndex = h, this.currentPageIndex >= this.pageCount && (this.currentPageIndex = this.pageCount - 1), this.currentPageIndex < 0 && (this.currentPageIndex = 0), this.scrollToPage(this.currentPageIndex);
3012
+ }
3013
+ setBookStyles(l) {
3014
+ this.currentBookStyles = l;
3015
+ const e = document.querySelector(".tr-epub-reader-element"), p = l.find((u) => u.selector === "body" || u.selector === ":not(a):not(hypothesis-highlight)") || (l.length > 0 ? l[0] : null);
3016
+ console.log("setBookStyles: Applying styles to container. Found element:", !!e, e), console.log("setBookStyles: Body style found:", p), e ? p && p.declarations && p.declarations.backgroundColor ? (console.log("setBookStyles: Setting background color to", p.declarations.backgroundColor), e.style.backgroundColor = p.declarations.backgroundColor) : (console.log("setBookStyles: Clearing background color"), e.style.backgroundColor = "") : console.warn("setBookStyles: .tr-epub-reader-element NOT FOUND in DOM"), this.frames.forEach((u) => {
3017
+ this.applyStylesToFrame(u.element);
3018
+ });
3019
+ }
3020
+ applyStylesToFrame(l) {
3021
+ if (!l || !l.contentDocument) return;
3022
+ const e = l.contentDocument, p = e.getElementById("readium-theme-style");
3023
+ p && p.remove();
3024
+ const u = e.createElement("style");
3025
+ u.id = "readium-theme-style";
3026
+ let s = "";
3027
+ this.currentBookStyles && this.currentBookStyles.length > 0 && this.currentBookStyles.forEach((o) => {
3028
+ let n = "";
3029
+ for (const [h, w] of Object.entries(o.declarations)) {
3030
+ const b = h.replace(/[A-Z]/g, (_) => "-" + _.toLowerCase());
3031
+ n += `${b}: ${w} !important; `;
3032
+ }
3033
+ s += `${o.selector} { ${n} }
3034
+ `;
3035
+ }), s += `
3036
+ img { max-width: 100%; box-sizing: border-box; break-inside: avoid; page-break-inside: avoid; }
3037
+ p, h1, h2, h3, h4, h5, h6 { break-inside: avoid; page-break-inside: avoid; }
3038
+
3039
+ /* User Request: Force specific EPUB cover class to be transparent */
3040
+ .x-ebookmaker-cover { background-color: transparent !important; background: transparent !important; }
3041
+
3042
+ /* User Request: Hide Scrollbars inside iframe (Horizontal & Vertical) */
3043
+ html, body {
3044
+ scrollbar-width: none; /* Firefox */
3045
+ -ms-overflow-style: none; /* IE/Edge */
3046
+ }
3047
+ html::-webkit-scrollbar, body::-webkit-scrollbar {
3048
+ display: none; /* Chrome/Safari */
3049
+ }
3050
+ `, u.textContent = s, e.head.appendChild(u);
3051
+ }
3052
+ applySettingsToDoc(l, e) {
3053
+ const p = l.documentElement, u = l.body;
3054
+ this.currentSettings.fontSize && (p.style.fontSize = `${this.currentSettings.fontSize}%`);
3055
+ const s = this.iframe.clientWidth, o = this.iframe.clientHeight, n = this.currentSettings.scroll === "scroll-continuous";
3056
+ if (e.style.borderLeft = "0", e.style.borderRight = "0", n) {
3057
+ if (this.isSingleImageMode) {
3058
+ p.style.height = "100%", p.style.width = "100%", p.style.overflow = "hidden", u.style.height = "100%", u.style.overflow = "hidden";
3059
+ const h = u.querySelector("svg");
3060
+ h && (h.style.height = "100vh", h.style.maxHeight = "100vh");
3061
+ } else
3062
+ p.style.height = "auto", p.style.width = "100vw", p.style.overflowY = "auto";
3063
+ p.style.overflowX = "hidden", u.style.height = "auto", u.style.overflowY = "visible", p.style.columnWidth = "auto", p.style.columnGap = "0", p.style.position = "static", p.style.left = "0", e.style.overflow = "hidden";
3064
+ } else {
3065
+ e.style.height = "100%", p.style.height = `${o}px`, p.style.width = "100%", p.style.position = "relative", p.style.margin = "0", p.style.padding = "0", p.style.top = "0", p.style.left = "0";
3066
+ const h = s > o, w = this.currentSettings.syntheticSpread;
3067
+ let b = w === "double";
3068
+ if ((!w || w === "auto") && (b = h && s > 800), b) {
3069
+ const _ = (s - this.columnGap) / 2;
3070
+ p.style.columnWidth = `${_}px`;
3071
+ } else
3072
+ p.style.columnWidth = `${s - this.columnGap}px`;
3073
+ p.style.columnGap = `${this.columnGap}px`, p.style.columnFill = "auto", u.style.margin = "0", u.style.padding = "0", e && (e.style.overflow = "hidden");
3074
+ }
3075
+ }
3076
+ setupFrameHeightLogic(l, e) {
3077
+ var s;
3078
+ const p = l.contentDocument;
3079
+ if (!p) return;
3080
+ const u = p.body;
3081
+ if (this.currentSettings.scroll === "scroll-continuous")
3082
+ if (e)
3083
+ this.activeFrameObserver && (this.activeFrameObserver.disconnect(), this.activeFrameObserver = null), l.style.height = "100%", l.scrolling = "no";
3084
+ else {
3085
+ const o = () => {
3086
+ if (this.currentSettings.scroll !== "scroll-continuous") {
3087
+ l.style.height = "100%", this.activeFrameObserver && (this.activeFrameObserver.disconnect(), this.activeFrameObserver = null);
3088
+ return;
3089
+ }
3090
+ if (l.contentDocument) {
3091
+ const n = l.contentDocument.documentElement.scrollHeight;
3092
+ l.style.height = `${n}px`;
3093
+ }
3094
+ };
3095
+ this.activeFrameObserver && this.activeFrameObserver.disconnect(), this.activeFrameObserver = new ResizeObserver(o), this.activeFrameObserver.observe(u), setTimeout(o, 100), (s = l.contentWindow) == null || s.addEventListener("load", o);
3096
+ }
3097
+ else
3098
+ this.activeFrameObserver && (this.activeFrameObserver.disconnect(), this.activeFrameObserver = null), l.style.height = "100%";
3099
+ }
3100
+ handleLinkClick(l) {
3101
+ if (console.log("Internal link clicked:", l), l.startsWith("http")) {
3102
+ window.open(l, "_blank");
3103
+ return;
3104
+ }
3105
+ if (this.currentItem) {
3106
+ if (l.startsWith("#")) {
3107
+ this.scrollToAnchor(l.substring(1));
3108
+ return;
3109
+ }
3110
+ const e = this.resolvePath(this.currentItem.href, l);
3111
+ console.log("Resolved link path:", e), this.openContentUrl(e);
3112
+ }
3113
+ }
3114
+ updatePagination(l) {
3115
+ if (!l || !l.contentDocument || this.currentSettings.scroll === "scroll-continuous") return;
3116
+ console.log("updatePagination executing..."), l.style.height = "100%", l.style.width = "100%";
3117
+ const e = l.contentDocument.documentElement, p = l.clientWidth, u = e.scrollWidth;
3118
+ this.pageCount = Math.ceil(u / (p + this.columnGap)), this.pageCount === 0 && (this.pageCount = 1), console.log(`Pagination: ${u} / ${p} = ${this.pageCount} pages`), this.currentPageIndex >= this.pageCount && (this.currentPageIndex = this.pageCount - 1), this.currentPageIndex < 0 && (this.currentPageIndex = 0), this.scrollToPage(this.currentPageIndex);
3119
+ }
3120
+ scrollToPage(l) {
3121
+ if (!this.iframe || !this.iframe.contentDocument) return;
3122
+ const e = this.iframe.contentDocument.documentElement, p = this.iframe.clientWidth, u = l * (p + this.columnGap);
3123
+ console.log(`scrollToPage: index=${l}, offset=${u}`), e.style.left = `-${u}px`;
3124
+ }
3125
+ async openContentUrl(l) {
3126
+ if (!this.epubPackage) return;
3127
+ console.log("ReaderView.openContentUrl called with:", l);
3128
+ const [e, p] = l.split("#");
3129
+ console.log("Looking for spine item with path:", e);
3130
+ const u = this.epubPackage.spine.getItemByHref(e);
3131
+ if (u) {
3132
+ if (console.log("Found item:", u), this.currentItem && this.currentItem.href === u.href) {
3133
+ p && this.scrollToAnchor(p);
3134
+ return;
3135
+ }
3136
+ this.currentPageIndex = 0, await this.openSpineItem(u), p && setTimeout(() => {
3137
+ this.scrollToAnchor(p);
3138
+ }, 100);
3139
+ } else
3140
+ console.warn("Item not found for href", l), console.log("Available spine items:", this.epubPackage.spine.items.map((s) => s.href));
3141
+ }
3142
+ scrollToAnchor(l) {
3143
+ if (!this.iframe || !this.iframe.contentDocument) return;
3144
+ const e = this.iframe.contentDocument, p = e.getElementById(l);
3145
+ if (p) {
3146
+ const u = e.documentElement, s = Math.abs(parseFloat(u.style.left || "0")), n = p.getBoundingClientRect().left + s, w = this.iframe.clientWidth + this.columnGap;
3147
+ if (this.currentSettings.scroll === "scroll-continuous") {
3148
+ p.scrollIntoView();
3149
+ return;
3150
+ }
3151
+ let b = Math.floor(n / w);
3152
+ console.log(`Scrolling to anchor #${l}: absLeft=${n}, pageIndex=${b}`), this.currentPageIndex = b, this.currentPageIndex >= this.pageCount && (this.currentPageIndex = this.pageCount - 1), this.currentPageIndex < 0 && (this.currentPageIndex = 0), this.scrollToPage(this.currentPageIndex);
3153
+ } else
3154
+ console.warn(`Anchor element #${l} not found`);
3155
+ }
3156
+ async injectResources(l, e) {
3157
+ var h, w, b;
3158
+ const u = new DOMParser().parseFromString(l, "text/html"), s = Array.from(u.querySelectorAll("img"));
3159
+ for (const _ of s) {
3160
+ const v = _.getAttribute("src");
3161
+ if (v && !v.startsWith("http") && !v.startsWith("data:")) {
3162
+ const a = this.resolvePath(e, v), g = await ((h = this.epubPackage) == null ? void 0 : h.loadBlob(a));
3163
+ g && (_.src = URL.createObjectURL(g));
3164
+ }
3165
+ }
3166
+ const o = Array.from(u.querySelectorAll("image"));
3167
+ for (const _ of o) {
3168
+ const v = _.getAttribute("xlink:href") || _.getAttribute("href");
3169
+ if (v && !v.startsWith("http") && !v.startsWith("data:")) {
3170
+ const a = this.resolvePath(e, v), g = await ((w = this.epubPackage) == null ? void 0 : w.loadBlob(a));
3171
+ g && (_.setAttribute("xlink:href", URL.createObjectURL(g)), _.setAttribute("href", URL.createObjectURL(g)));
3172
+ }
3173
+ }
3174
+ const n = Array.from(u.querySelectorAll('link[rel="stylesheet"]'));
3175
+ for (const _ of n) {
3176
+ const v = _.getAttribute("href");
3177
+ if (v && !v.startsWith("http")) {
3178
+ const a = this.resolvePath(e, v), g = await ((b = this.epubPackage) == null ? void 0 : b.loadFile(a));
3179
+ if (g) {
3180
+ const i = u.createElement("style");
3181
+ i.textContent = g, _.replaceWith(i);
3182
+ }
3183
+ }
3184
+ }
3185
+ return u.documentElement.outerHTML;
3186
+ }
3187
+ resolvePath(l, e) {
3188
+ try {
3189
+ if (e.startsWith("/")) return e.substring(1);
3190
+ const p = l.split("/");
3191
+ p.pop();
3192
+ const u = e.split("/");
3193
+ for (const s of u)
3194
+ s !== "." && (s === ".." ? p.pop() : p.push(s));
3195
+ return p.join("/");
3196
+ } catch {
3197
+ return console.error("Path resolution error", l, e), e;
3198
+ }
3199
+ }
3200
+ }
3201
+ const ct = {
3202
+ readium: null,
3203
+ readerView: null,
3204
+ // Added property
3205
+ currentPackageDocument: null,
3206
+ ebookURL_filepath: null,
3207
+ embeded: !0,
3208
+ init: (G) => {
3209
+ console.log("Initializing Modern TreineticEpubReader..."), ft.init();
3210
+ const l = document.querySelector(G);
3211
+ if (!l) {
3212
+ console.error(`Element ${G} not found`);
3213
+ return;
3214
+ }
3215
+ return ct.initReader(l), pt.getInstance();
3216
+ },
3217
+ open: (G) => {
3218
+ console.log("Opening: ", G);
3219
+ const l = ct.setReaderPreferences();
3220
+ ct.ebookURL_filepath = G;
3221
+ const e = ct.getOpenPageRequest(l, G);
3222
+ let p = { syntheticSpread: "auto", scroll: "auto" };
3223
+ ct.embeded && l && l.reader && (p = l.reader), ct.loadEpub(p, G, e);
3224
+ },
3225
+ initReader: (G) => {
3226
+ G.classList.add("tr-epub-reader-element");
3227
+ const l = ct.setReaderPreferences();
3228
+ ct.readerView = new Yt(G), ft.init(), ft.on(ft.PageNext, "reader", () => ct.nextPage()), ft.on(ft.PagePrevious, "reader", () => ct.prevPage());
3229
+ let e = { syntheticSpread: "auto", scroll: "auto" };
3230
+ ct.embeded && l && l.reader && (e = l.reader), wt.updateReader(ct.readerView, e);
3231
+ },
3232
+ handleReaderEvents: () => {
3233
+ var u, s, o;
3234
+ if (!ct.readium) return;
3235
+ const G = ct.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
+ G.on(l, (n, h) => {
3237
+ console.log("Event: Load Start");
3238
+ }), G.on(e, (n, h) => {
3239
+ console.log("Event: Loaded");
3240
+ }), G.on(p, (n) => {
3241
+ console.log("Event: Pagination Changed"), pt.getInstance().isAutoBookmark() && ct.savePlace();
3242
+ });
3243
+ },
3244
+ loadEpub: async (G, l, e) => {
3245
+ try {
3246
+ console.log("Loading epub via modern parser:", l);
3247
+ const p = await Rt.load(l);
3248
+ ct.readerView && (ct.readerView.openBook(p), ct.currentPackageDocument = p, p.toc && pt.getInstance().onTOCLoad(p.toc), pt.getInstance().epubLoaded(
3249
+ p.metadata,
3250
+ p,
3251
+ ct.readerView
3252
+ ));
3253
+ } catch (p) {
3254
+ console.error("Failed to load epub", p), pt.getInstance().epubFailed("Indeterminate error");
3255
+ }
3256
+ },
3257
+ setReaderPreferences: () => {
3258
+ let G = Ct.get("reader") || { fontSize: 100, theme: "default-theme", scroll: "auto" };
3259
+ return G.scroll === "scroll-continuous" && (G.scroll = "auto"), Ct.put("reader", G), { reader: G };
3260
+ },
3261
+ getOpenPageRequest: (G, l) => null,
3262
+ savePlace: () => {
3263
+ },
3264
+ // Public API Methods (proxied to handler/helpers)
3265
+ nextPage: () => pt.getInstance().nextPage(),
3266
+ prevPage: () => pt.getInstance().prevPage(),
3267
+ goToPage: (G) => pt.getInstance().goToPage(G),
3268
+ setTheme: (G) => {
3269
+ pt.getInstance().setTheme(G);
3270
+ },
3271
+ registerTheme: (G) => {
3272
+ Pt.getInstance().registerTheme(G);
3273
+ },
3274
+ setFontSize: (G) => {
3275
+ pt.getInstance().changeFontSize(G);
3276
+ },
3277
+ setScrollOption: (G) => {
3278
+ pt.getInstance().setScrollOption(G);
3279
+ },
3280
+ clearSettings: () => {
3281
+ Ct.clear("reader"), console.log("Reader settings cleared.");
3282
+ }
3283
+ };
3284
+ export {
3285
+ ct as default
3286
+ };