@pretextbook/import 0.2.0 → 0.4.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.
@@ -1,3873 +0,0 @@
1
- import { formatPretext as me } from "@pretextbook/format";
2
- import { latexToPretext as ge } from "@pretextbook/latex-pretext";
3
- import { markdownToPretext as _e } from "@pretextbook/remark-pretext";
4
- const be = [
5
- "\\documentclass",
6
- "\\begin{document}",
7
- "\\begin{",
8
- "\\section",
9
- "\\chapter",
10
- "\\title",
11
- "\\author"
12
- ], ye = ["# ", "## ", "### ", "#### "];
13
- function ie(d) {
14
- const c = d.trim();
15
- return !c || c.startsWith("<") ? "pretext" : be.some((e) => c.includes(e)) ? "latex" : ye.some((e) => c.startsWith(e)) ? "markdown" : "pretext";
16
- }
17
- const ve = [
18
- {
19
- kind: "presentation",
20
- category: "latex_fonts",
21
- macros: ["textrm", "textit", "textbf", "textsc", "texttt"]
22
- }
23
- ], Mt = {
24
- kind: "presentation",
25
- category: "tex_fonts",
26
- pairs: [
27
- { from: "rm", to: "textrm" },
28
- { from: "em", to: "emph" },
29
- { from: "it", to: "textit" },
30
- { from: "itshape", to: "textit" },
31
- { from: "bf", to: "textbf" },
32
- { from: "bfseries", to: "textbf" },
33
- { from: "sf", to: "textsf" },
34
- { from: "sffamily", to: "textss" },
35
- { from: "textsl", to: "testsl" }
36
- ]
37
- }, we = [
38
- {
39
- kind: "accessibility",
40
- category: "consistency",
41
- macros: ["renewcommand"]
42
- }
43
- ], xe = [
44
- {
45
- kind: "unused",
46
- category: "conditionals",
47
- macros: ["if", "fi", "iffalse", "then", "else", "loop", "repeat"]
48
- },
49
- {
50
- kind: "presentation",
51
- category: "font_size",
52
- macros: [
53
- "tiny",
54
- "scriptsize",
55
- "footnotesize",
56
- "small",
57
- "normalsize",
58
- "large",
59
- "Large",
60
- "LARGE",
61
- "huge",
62
- "Huge",
63
- "normalfont"
64
- ]
65
- },
66
- {
67
- kind: "presentation",
68
- category: "spacing_vertical",
69
- macros: ["smallskip", "medskip", "bigskip", "vfil", "vfill"]
70
- },
71
- {
72
- kind: "presentation",
73
- category: "archaic_tex",
74
- macros: ["centerline", "centering", "noindent", "par", "linebreak"]
75
- },
76
- {
77
- kind: "mistake",
78
- category: "nonstructural",
79
- macros: ["ensuremath"]
80
- },
81
- {
82
- kind: "archaic",
83
- category: "low_level_tex",
84
- macros: [
85
- "relax",
86
- "makeatletter",
87
- "makeatother",
88
- "csname",
89
- "endcsname",
90
- "shipout",
91
- "noexpand",
92
- "expandafter",
93
- "clearpage"
94
- ]
95
- },
96
- {
97
- kind: "archaic",
98
- category: "file_manipulation",
99
- macros: [
100
- "newwrite",
101
- "newread",
102
- "immediate",
103
- "write",
104
- "write18",
105
- "read",
106
- "readline",
107
- "readfile",
108
- "openin",
109
- "openout",
110
- "jobname"
111
- ]
112
- }
113
- ], ke = [
114
- {
115
- kind: "archaic",
116
- category: "low_level_tex",
117
- macros: ["catcode", "newtheorem", "maketitle", "setlength"]
118
- }
119
- ], Se = [
120
- {
121
- kind: "publisher",
122
- category: "zzzzz",
123
- macros: [
124
- "theoremstyle",
125
- "makeindex",
126
- "allowdisplaybreaks",
127
- "frontmatter",
128
- "mainmatter",
129
- "appendix",
130
- "numberwithin",
131
- "setcounter",
132
- "tableofcontents",
133
- "FloatBarrier"
134
- ]
135
- }
136
- ], ze = [
137
- {
138
- kind: "archaic",
139
- category: "use_newcommand_only",
140
- macros: ["def", "let", "edef", "gdef", "xdef", "global", "long"]
141
- }
142
- ], Ee = [
143
- {
144
- kind: "presentation",
145
- category: "spacing_horizontal",
146
- macros: [{ name: "hspace", arity: 1 }]
147
- },
148
- {
149
- kind: "other",
150
- category: "other",
151
- macros: [{ name: "date", arity: 1 }]
152
- },
153
- {
154
- kind: "accessibility",
155
- category: "colors",
156
- macros: [
157
- { name: "color", arity: 1 },
158
- { name: "textcolor", arity: 1 },
159
- { name: "mathcolor", arity: 1 },
160
- { name: "definecolor", arity: 3 }
161
- ]
162
- }
163
- ], Ce = [
164
- {
165
- kind: "presentation",
166
- category: "nonstructural",
167
- environments: ["center", "minipage"]
168
- }
169
- ];
170
- function Zt(d) {
171
- return d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
172
- }
173
- function Ht(d, c) {
174
- let e = d;
175
- const f = [];
176
- for (const { from: a, to: n } of c.pairs) {
177
- let r, i;
178
- c.category === "tex_fonts" ? (r = `\\{ *\\\\${Zt(a)}\\b *`, i = `\\${n}{`) : (r = `\\\\${Zt(a)}\\b *`, i = `\\${n}`);
179
- const l = new RegExp(r, "g"), p = e.match(l);
180
- p && (f.push({
181
- action: "replace",
182
- severity: "info",
183
- kind: c.kind,
184
- category: c.category,
185
- macro: a,
186
- replacement: n,
187
- occurrences: p.length
188
- }), e = e.replace(l, i));
189
- }
190
- return { output: e, warnings: f };
191
- }
192
- function Ae(d) {
193
- let c = d;
194
- const e = [], f = c.match(/\(\\ref\{([^{}]+)\}\)/g);
195
- f && (e.push({
196
- action: "rewrite",
197
- severity: "info",
198
- kind: "presentation",
199
- category: "math_refs",
200
- macro: "(\\ref{...})",
201
- replacement: "\\eqref{...}",
202
- occurrences: f.length
203
- }), c = c.replace(/\(\\ref\{([^{}]+)\}\)/g, "\\eqref{$1}")), c = c.replace(/(\\vfil)l\b/g, "$1"), c = c.replace(/(\\vfil)(\s*\\vfil\b)+\b/g, "$1");
204
- const a = c.match(/(\\vfil)\b/g);
205
- return a && (e.push({
206
- action: "rewrite",
207
- severity: "info",
208
- kind: "presentation",
209
- category: "spacing_vertical",
210
- macro: "vfil",
211
- replacement: "\\vspace{1in}",
212
- occurrences: a.length
213
- }), c = c.replace(/(\\vfil)\b/g, "\\vspace{1in}")), c = c.replace(
214
- /\\vskip\*? *([0-9]+|-) *([a-zA-Z]+).*/g,
215
- "\\vspace{$1$2}"
216
- ), c = c.replace(/(\\vspace)\*? */g, "$1"), c = c.replace(
217
- /(\\vspace) *\{([0-9]+|-) *([a-zA-Z]+).*?\}/g,
218
- "$1{$2$3}"
219
- ), { output: c, warnings: e };
220
- }
221
- function Ie(d) {
222
- const c = d.split("\\begin{document}");
223
- if (c.length < 2)
224
- return { preamble: "", body: d, bibliography: "" };
225
- const e = c[0];
226
- let f = c.slice(1).join("\\begin{document}"), a = "";
227
- if (/\\begin\{thebibliography\}/.test(f)) {
228
- const [n, ...r] = f.split("\\begin{thebibliography}");
229
- f = n, a = r.join("\\begin{thebibliography}");
230
- }
231
- return { preamble: e, body: f, bibliography: a };
232
- }
233
- function se(d) {
234
- return d.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
235
- }
236
- function Oe(d, c, e) {
237
- const f = se(d);
238
- if (c === "hasarg") {
239
- let a = `\\\\${f}\\b\\*?`;
240
- for (let n = 0; n < e; n += 1)
241
- a += "\\{[^{}]*\\}";
242
- return new RegExp(`(${a})`, "g");
243
- }
244
- return c === "line" ? new RegExp(`(\\\\${f}\\b.*)`, "g") : new RegExp(`(\\\\${f}\\b)`, "g");
245
- }
246
- function ut(d, c, e, f) {
247
- const { type: a = "", action: n = "mark", extra: r = "", save: i = !1 } = e;
248
- "macros" in c && c.macros[0];
249
- let l = d;
250
- const p = c.macros;
251
- for (const w of p) {
252
- const v = typeof w == "string" ? w : w.name, x = typeof w == "string" ? 0 : w.arity, u = Oe(v, a, x), _ = l.match(u);
253
- !_ || _.length === 0 || (i && f.push({
254
- action: "save",
255
- severity: "warning",
256
- kind: c.kind,
257
- category: c.category,
258
- macro: v,
259
- occurrences: _.length,
260
- examples: _.slice(0, 5),
261
- message: r || void 0
262
- }), n === "delete" ? (f.push({
263
- action: "delete",
264
- severity: "info",
265
- kind: c.kind,
266
- category: c.category,
267
- macro: v,
268
- occurrences: _.length,
269
- message: r || void 0
270
- }), l = l.replace(u, "")) : f.push({
271
- action: "anomaly",
272
- severity: "warning",
273
- kind: c.kind,
274
- category: c.category,
275
- macro: v,
276
- occurrences: _.length,
277
- message: r || void 0,
278
- examples: _.slice(0, 5)
279
- }));
280
- }
281
- return l;
282
- }
283
- function Te(d, c, e) {
284
- let f = d;
285
- for (const a of c.environments) {
286
- const n = se(a), r = new RegExp(`(\\\\(begin|end)\\{\\s*${n}\\})`, "g"), i = f.match(r);
287
- i && i.length > 0 && (e.push({
288
- action: "delete",
289
- severity: "info",
290
- kind: c.kind,
291
- category: c.category,
292
- macro: a,
293
- occurrences: i.length
294
- }), f = f.replace(r, ""));
295
- }
296
- return f;
297
- }
298
- function Re(d) {
299
- const c = [], e = Ie(d);
300
- let { preamble: f, body: a } = e;
301
- const { bibliography: n } = e;
302
- for (const p of xe)
303
- f = ut(f, p, { action: "delete" }, c), a = ut(a, p, { action: "delete" }, c);
304
- for (const p of we)
305
- f = ut(
306
- f,
307
- p,
308
- { type: "line", action: "delete", extra: "in the preamble", save: !0 },
309
- c
310
- ), a = ut(
311
- a,
312
- p,
313
- { type: "line", action: "delete", extra: "in the main text", save: !0 },
314
- c
315
- );
316
- for (const p of ze)
317
- f = ut(
318
- f,
319
- p,
320
- { type: "line", action: "delete", extra: "in the preamble", save: !0 },
321
- c
322
- ), a = ut(
323
- a,
324
- p,
325
- { type: "line", action: "delete", extra: "in the main text", save: !0 },
326
- c
327
- );
328
- for (const p of Ee)
329
- f = ut(
330
- f,
331
- p,
332
- { type: "hasarg", action: "delete" },
333
- c
334
- ), a = ut(
335
- a,
336
- p,
337
- { type: "hasarg", action: "delete" },
338
- c
339
- );
340
- for (const p of ke)
341
- f = ut(
342
- f,
343
- p,
344
- { type: "line", action: "delete" },
345
- c
346
- ), a = ut(
347
- a,
348
- p,
349
- { type: "line", action: "delete" },
350
- c
351
- );
352
- for (const p of Se)
353
- f = ut(
354
- f,
355
- p,
356
- {
357
- type: "line",
358
- action: "delete",
359
- extra: "this is a publisher choice in PreTeXt"
360
- },
361
- c
362
- ), a = ut(
363
- a,
364
- p,
365
- {
366
- type: "line",
367
- action: "delete",
368
- extra: "this is a publisher choice in PreTeXt"
369
- },
370
- c
371
- );
372
- for (const p of ve)
373
- a = ut(a, p, { action: "mark" }, c);
374
- for (const p of Ce)
375
- a = Te(a, p, c);
376
- const r = d.includes("\\begin{document}"), i = n.length > 0;
377
- let l = f;
378
- return r ? l += `\\begin{document}
379
- ` + a : l = a, i && (l += `\\begin{thebibliography}
380
- ` + n), { output: l, warnings: c };
381
- }
382
- function Be(d) {
383
- let c = d;
384
- return c = c.replace(/\s+%.*/g, ""), c = c.replace(/([^\\])%.*/g, "$1"), c = c.replace(/^%.*/, ""), c;
385
- }
386
- function Pe(d) {
387
- return d.replace(/(.*\{)([^{}]+)(\}.*)/, (c, e, f, a) => {
388
- const n = String(f).replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "-");
389
- return `${e}${n}${a}`;
390
- });
391
- }
392
- function Fe(d) {
393
- let c = d;
394
- return c = c.replace(/> */g, "\\gt "), c = c.replace(/< */g, "\\lt "), c = c.replace(
395
- /(\\(ref|eqref|cref|Cref|label)\{([^{}]+)\})/g,
396
- Pe
397
- ), c;
398
- }
399
- function De(d) {
400
- let c = d;
401
- return c = c.replace(/\\begin +/g, "\\begin"), c = c.replace(/\\chapter +/g, "\\chapter"), c = c.replace(/\\section +/g, "\\section"), c = c.replace(/\\section\*/g, "\\section"), c = Be(c), c = Fe(c), c = c.replace(/\\end\{document\}.*/s, ""), c = c.replace(/^\s+/, ""), c = c.replace(/\n{3,}/g, `
402
-
403
- `), c;
404
- }
405
- function Xt(d, c = 0, e = "{", f = "}") {
406
- let a = d.trimStart();
407
- if (!a)
408
- return ["", ""];
409
- let n = "", r = "", i = c;
410
- if (i === 0 && a[0] !== e)
411
- return ["", a];
412
- for (i === 0 && (r = e, i = 1, a = a.substring(1)); i > 0 && a; ) {
413
- const l = a[0];
414
- l === e && n !== "\\" ? i += 1 : l === f && n !== "\\" && (i -= 1), r += l, n === "\\" && l === "\\" ? n = `
415
- ` : n = l, a = a.substring(1);
416
- }
417
- return i === 0 ? [r, a] : ["", r.substring(1)];
418
- }
419
- function je(d) {
420
- const c = [];
421
- let e = De(d).replace(/(\n *){3,}/g, `
422
-
423
- `);
424
- const f = Ae(e);
425
- e = f.output, c.push(...f.warnings);
426
- const a = Ht(e, Mt);
427
- e = a.output, c.push(...a.warnings);
428
- const n = Ht(e, Mt);
429
- e = n.output, c.push(...n.warnings);
430
- const r = Re(e);
431
- return e = r.output.replace(/(\n *){3,}/g, `
432
-
433
- `), c.push(...r.warnings), { output: e, warnings: c };
434
- }
435
- function Ne(d) {
436
- const c = "\\begin{document}", e = "\\end{document}", f = d.indexOf(c);
437
- if (f === -1)
438
- return { preamble: "", body: d };
439
- const a = d.slice(0, f).trim(), n = d.slice(f + c.length), r = n.indexOf(e), i = (r === -1 ? n : n.slice(0, r)).trim();
440
- return { preamble: a, body: i };
441
- }
442
- function Gt(d, c) {
443
- const f = new RegExp(`\\\\${c}(?![a-zA-Z])`).exec(d);
444
- if (!f) return "";
445
- let a = d.slice(f.index + f[0].length).trimStart();
446
- if (a.startsWith("[")) {
447
- const [r, i] = Xt(a, 0, "[", "]");
448
- r && (a = i.trimStart());
449
- }
450
- const [n] = Xt(a);
451
- return n ? n.slice(1, -1).trim() : "";
452
- }
453
- const $e = /^[ \t]*(\\(?:new|renew|provide)command\*?|\\DeclareMathOperator\*?|\\newenvironment\*?)\b/;
454
- function Kt(d) {
455
- let c = 0;
456
- for (let e = 0; e < d.length; e++) {
457
- if (d[e] === "\\") {
458
- e++;
459
- continue;
460
- }
461
- d[e] === "{" ? c++ : d[e] === "}" && c--;
462
- }
463
- return c;
464
- }
465
- function Le(d) {
466
- const c = d.split(`
467
- `), e = [];
468
- let f = 0;
469
- for (; f < c.length; ) {
470
- if (!$e.test(c[f])) {
471
- f++;
472
- continue;
473
- }
474
- let a = c[f], n = Kt(c[f]);
475
- for (f++; n > 0 && f < c.length; )
476
- a += `
477
- ` + c[f], n += Kt(c[f]), f++;
478
- e.push(a.trim());
479
- }
480
- return e.join(`
481
- `);
482
- }
483
- function Ue(d) {
484
- const c = /\\documentclass(?:\[[^\]]*\])?\{([^}]+)\}/.exec(d);
485
- return c ? c[1].trim() : "article";
486
- }
487
- function We(d) {
488
- const c = d.replace(/(^|[^\\])%[^\n]*/gm, "$1");
489
- return {
490
- documentClass: Ue(c),
491
- title: Gt(c, "title"),
492
- author: Gt(c, "author"),
493
- macros: Le(c)
494
- };
495
- }
496
- function Me(d) {
497
- if (typeof d == "string")
498
- return d;
499
- if (typeof d == "object" && d !== null && "value" in d) {
500
- const c = d.value;
501
- if (typeof c == "string")
502
- return c;
503
- if (c != null)
504
- return String(c);
505
- }
506
- return String(d);
507
- }
508
- function ae(d) {
509
- return d.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
510
- }
511
- function oe(d) {
512
- return d.replace(/\\LaTeX\b/g, "LaTeX").replace(/\\TeX\b/g, "TeX").replace(/\\thanks\{[^{}]*(?:\{[^{}]*\}[^{}]*)?\}/g, "").replace(/\\inst\{[^{}]*\}/g, "").replace(/\\email\{[^{}]*\}/g, "").replace(/\\[a-zA-Z]+\{([^{}]*)\}/g, "$1").replace(/\\\s/g, " ").replace(/~/g, " ").replace(/\s+/g, " ").trim();
513
- }
514
- function Ze(d) {
515
- const c = [];
516
- if (d.macros) {
517
- const e = d.macros.split(`
518
- `).map((f) => ` ${f}`).join(`
519
- `);
520
- c.push(` <macros>
521
- ${e}
522
- </macros>`);
523
- }
524
- if (d.author) {
525
- const e = d.author.split(/\s+\\and\s+/)[0].trim(), f = ae(oe(e));
526
- f && c.push(
527
- ` <author>
528
- <personname>${f}</personname>
529
- </author>`
530
- );
531
- }
532
- return c.length === 0 ? "" : `<docinfo>
533
- ${c.join(`
534
- `)}
535
- </docinfo>`;
536
- }
537
- function He(d, c) {
538
- const e = d.replace(/^\s*<p\s*\/>\s*/g, "").replace(/^\s*<p>\s*<\/p>\s*/g, "").trim();
539
- if (!e) return "";
540
- const a = /<chapter[\s>]/.test(e) ? "book" : "article", n = Ze(c), r = c.title ? ` <title>${ae(oe(c.title))}</title>
541
- ` : "", i = `<${a}>
542
- ${r}${e}
543
- </${a}>`;
544
- return `<pretext>
545
- ${[n, i].filter(Boolean).join(`
546
- `)}
547
- </pretext>`;
548
- }
549
- function Lt(d) {
550
- const c = d.trim();
551
- return c ? me(c) : "";
552
- }
553
- function Xe(d) {
554
- const c = d.trim();
555
- if (!c)
556
- return { pretext: "", cleanedLatex: "", warnings: [] };
557
- const { preamble: e, body: f } = Ne(c), a = We(e), n = f ? [
558
- `\\documentclass{${a.documentClass}}`,
559
- a.macros,
560
- "\\begin{document}",
561
- f,
562
- "\\end{document}"
563
- ].filter(Boolean).join(`
564
- `) : c, { output: r, warnings: i } = je(n);
565
- if (!r.trim())
566
- return { pretext: "", cleanedLatex: r, warnings: i };
567
- const l = f ? r + `
568
- \\end{document}` : r, p = Me(
569
- ge(l)
570
- ).trim();
571
- if (!p)
572
- return { pretext: "", cleanedLatex: r, warnings: i };
573
- const w = He(p, a);
574
- return { pretext: w ? Lt(w) : "", cleanedLatex: r, warnings: i };
575
- }
576
- function Ge(d) {
577
- const c = d.trim();
578
- if (!c)
579
- return { pretext: "", cleanedMarkdown: "" };
580
- const e = String(_e(c)).trim();
581
- return { pretext: e ? Lt(e) : "", cleanedMarkdown: c };
582
- }
583
- function Ke(d) {
584
- return d instanceof Error && d.message.trim() ? d.message.trim() : "Could not convert source content to PreTeXt.";
585
- }
586
- function Ye(d, c) {
587
- const e = ie(d), f = c ?? e;
588
- try {
589
- if (f === "pretext")
590
- return {
591
- sourceFormat: f,
592
- detectedSourceFormat: e,
593
- pretextSource: Lt(d),
594
- warnings: []
595
- };
596
- if (f === "markdown") {
597
- const { pretext: i, cleanedMarkdown: l } = Ge(d);
598
- return {
599
- sourceFormat: f,
600
- detectedSourceFormat: e,
601
- pretextSource: i,
602
- cleanedNativeSource: l,
603
- warnings: []
604
- };
605
- }
606
- const { pretext: a, cleanedLatex: n, warnings: r } = Xe(d);
607
- return {
608
- sourceFormat: f,
609
- detectedSourceFormat: e,
610
- pretextSource: a,
611
- cleanedNativeSource: n,
612
- warnings: r
613
- };
614
- } catch (a) {
615
- return {
616
- sourceFormat: f,
617
- detectedSourceFormat: e,
618
- pretextError: Ke(a),
619
- warnings: []
620
- };
621
- }
622
- }
623
- var zt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
624
- function Ve(d) {
625
- return d && d.__esModule && Object.prototype.hasOwnProperty.call(d, "default") ? d.default : d;
626
- }
627
- function Et(d) {
628
- throw new Error('Could not dynamically require "' + d + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
629
- }
630
- var Ot = { exports: {} };
631
- var Yt;
632
- function Je() {
633
- return Yt || (Yt = 1, (function(d, c) {
634
- (function(e) {
635
- d.exports = e();
636
- })(function() {
637
- return (function e(f, a, n) {
638
- function r(p, w) {
639
- if (!a[p]) {
640
- if (!f[p]) {
641
- var v = typeof Et == "function" && Et;
642
- if (!w && v) return v(p, !0);
643
- if (i) return i(p, !0);
644
- var x = new Error("Cannot find module '" + p + "'");
645
- throw x.code = "MODULE_NOT_FOUND", x;
646
- }
647
- var u = a[p] = { exports: {} };
648
- f[p][0].call(u.exports, function(_) {
649
- var o = f[p][1][_];
650
- return r(o || _);
651
- }, u, u.exports, e, f, a, n);
652
- }
653
- return a[p].exports;
654
- }
655
- for (var i = typeof Et == "function" && Et, l = 0; l < n.length; l++) r(n[l]);
656
- return r;
657
- })({ 1: [function(e, f, a) {
658
- var n = e("./utils"), r = e("./support"), i = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
659
- a.encode = function(l) {
660
- for (var p, w, v, x, u, _, o, g = [], h = 0, b = l.length, S = b, z = n.getTypeOf(l) !== "string"; h < l.length; ) S = b - h, v = z ? (p = l[h++], w = h < b ? l[h++] : 0, h < b ? l[h++] : 0) : (p = l.charCodeAt(h++), w = h < b ? l.charCodeAt(h++) : 0, h < b ? l.charCodeAt(h++) : 0), x = p >> 2, u = (3 & p) << 4 | w >> 4, _ = 1 < S ? (15 & w) << 2 | v >> 6 : 64, o = 2 < S ? 63 & v : 64, g.push(i.charAt(x) + i.charAt(u) + i.charAt(_) + i.charAt(o));
661
- return g.join("");
662
- }, a.decode = function(l) {
663
- var p, w, v, x, u, _, o = 0, g = 0, h = "data:";
664
- if (l.substr(0, h.length) === h) throw new Error("Invalid base64 input, it looks like a data url.");
665
- var b, S = 3 * (l = l.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
666
- if (l.charAt(l.length - 1) === i.charAt(64) && S--, l.charAt(l.length - 2) === i.charAt(64) && S--, S % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
667
- for (b = r.uint8array ? new Uint8Array(0 | S) : new Array(0 | S); o < l.length; ) p = i.indexOf(l.charAt(o++)) << 2 | (x = i.indexOf(l.charAt(o++))) >> 4, w = (15 & x) << 4 | (u = i.indexOf(l.charAt(o++))) >> 2, v = (3 & u) << 6 | (_ = i.indexOf(l.charAt(o++))), b[g++] = p, u !== 64 && (b[g++] = w), _ !== 64 && (b[g++] = v);
668
- return b;
669
- };
670
- }, { "./support": 30, "./utils": 32 }], 2: [function(e, f, a) {
671
- var n = e("./external"), r = e("./stream/DataWorker"), i = e("./stream/Crc32Probe"), l = e("./stream/DataLengthProbe");
672
- function p(w, v, x, u, _) {
673
- this.compressedSize = w, this.uncompressedSize = v, this.crc32 = x, this.compression = u, this.compressedContent = _;
674
- }
675
- p.prototype = { getContentWorker: function() {
676
- var w = new r(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")), v = this;
677
- return w.on("end", function() {
678
- if (this.streamInfo.data_length !== v.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
679
- }), w;
680
- }, getCompressedWorker: function() {
681
- return new r(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
682
- } }, p.createWorkerFrom = function(w, v, x) {
683
- return w.pipe(new i()).pipe(new l("uncompressedSize")).pipe(v.compressWorker(x)).pipe(new l("compressedSize")).withStreamInfo("compression", v);
684
- }, f.exports = p;
685
- }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, f, a) {
686
- var n = e("./stream/GenericWorker");
687
- a.STORE = { magic: "\0\0", compressWorker: function() {
688
- return new n("STORE compression");
689
- }, uncompressWorker: function() {
690
- return new n("STORE decompression");
691
- } }, a.DEFLATE = e("./flate");
692
- }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, f, a) {
693
- var n = e("./utils"), r = (function() {
694
- for (var i, l = [], p = 0; p < 256; p++) {
695
- i = p;
696
- for (var w = 0; w < 8; w++) i = 1 & i ? 3988292384 ^ i >>> 1 : i >>> 1;
697
- l[p] = i;
698
- }
699
- return l;
700
- })();
701
- f.exports = function(i, l) {
702
- return i !== void 0 && i.length ? n.getTypeOf(i) !== "string" ? (function(p, w, v, x) {
703
- var u = r, _ = x + v;
704
- p ^= -1;
705
- for (var o = x; o < _; o++) p = p >>> 8 ^ u[255 & (p ^ w[o])];
706
- return -1 ^ p;
707
- })(0 | l, i, i.length, 0) : (function(p, w, v, x) {
708
- var u = r, _ = x + v;
709
- p ^= -1;
710
- for (var o = x; o < _; o++) p = p >>> 8 ^ u[255 & (p ^ w.charCodeAt(o))];
711
- return -1 ^ p;
712
- })(0 | l, i, i.length, 0) : 0;
713
- };
714
- }, { "./utils": 32 }], 5: [function(e, f, a) {
715
- a.base64 = !1, a.binary = !1, a.dir = !1, a.createFolders = !0, a.date = null, a.compression = null, a.compressionOptions = null, a.comment = null, a.unixPermissions = null, a.dosPermissions = null;
716
- }, {}], 6: [function(e, f, a) {
717
- var n = null;
718
- n = typeof Promise < "u" ? Promise : e("lie"), f.exports = { Promise: n };
719
- }, { lie: 37 }], 7: [function(e, f, a) {
720
- var n = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Uint32Array < "u", r = e("pako"), i = e("./utils"), l = e("./stream/GenericWorker"), p = n ? "uint8array" : "array";
721
- function w(v, x) {
722
- l.call(this, "FlateWorker/" + v), this._pako = null, this._pakoAction = v, this._pakoOptions = x, this.meta = {};
723
- }
724
- a.magic = "\b\0", i.inherits(w, l), w.prototype.processChunk = function(v) {
725
- this.meta = v.meta, this._pako === null && this._createPako(), this._pako.push(i.transformTo(p, v.data), !1);
726
- }, w.prototype.flush = function() {
727
- l.prototype.flush.call(this), this._pako === null && this._createPako(), this._pako.push([], !0);
728
- }, w.prototype.cleanUp = function() {
729
- l.prototype.cleanUp.call(this), this._pako = null;
730
- }, w.prototype._createPako = function() {
731
- this._pako = new r[this._pakoAction]({ raw: !0, level: this._pakoOptions.level || -1 });
732
- var v = this;
733
- this._pako.onData = function(x) {
734
- v.push({ data: x, meta: v.meta });
735
- };
736
- }, a.compressWorker = function(v) {
737
- return new w("Deflate", v);
738
- }, a.uncompressWorker = function() {
739
- return new w("Inflate", {});
740
- };
741
- }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, f, a) {
742
- function n(u, _) {
743
- var o, g = "";
744
- for (o = 0; o < _; o++) g += String.fromCharCode(255 & u), u >>>= 8;
745
- return g;
746
- }
747
- function r(u, _, o, g, h, b) {
748
- var S, z, E = u.file, R = u.compression, B = b !== p.utf8encode, L = i.transformTo("string", b(E.name)), P = i.transformTo("string", p.utf8encode(E.name)), W = E.comment, Y = i.transformTo("string", b(W)), k = i.transformTo("string", p.utf8encode(W)), F = P.length !== E.name.length, s = k.length !== W.length, j = "", Q = "", U = "", tt = E.dir, M = E.date, q = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
749
- _ && !o || (q.crc32 = u.crc32, q.compressedSize = u.compressedSize, q.uncompressedSize = u.uncompressedSize);
750
- var O = 0;
751
- _ && (O |= 8), B || !F && !s || (O |= 2048);
752
- var I = 0, J = 0;
753
- tt && (I |= 16), h === "UNIX" ? (J = 798, I |= (function(X, st) {
754
- var lt = X;
755
- return X || (lt = st ? 16893 : 33204), (65535 & lt) << 16;
756
- })(E.unixPermissions, tt)) : (J = 20, I |= (function(X) {
757
- return 63 & (X || 0);
758
- })(E.dosPermissions)), S = M.getUTCHours(), S <<= 6, S |= M.getUTCMinutes(), S <<= 5, S |= M.getUTCSeconds() / 2, z = M.getUTCFullYear() - 1980, z <<= 4, z |= M.getUTCMonth() + 1, z <<= 5, z |= M.getUTCDate(), F && (Q = n(1, 1) + n(w(L), 4) + P, j += "up" + n(Q.length, 2) + Q), s && (U = n(1, 1) + n(w(Y), 4) + k, j += "uc" + n(U.length, 2) + U);
759
- var G = "";
760
- return G += `
761
- \0`, G += n(O, 2), G += R.magic, G += n(S, 2), G += n(z, 2), G += n(q.crc32, 4), G += n(q.compressedSize, 4), G += n(q.uncompressedSize, 4), G += n(L.length, 2), G += n(j.length, 2), { fileRecord: v.LOCAL_FILE_HEADER + G + L + j, dirRecord: v.CENTRAL_FILE_HEADER + n(J, 2) + G + n(Y.length, 2) + "\0\0\0\0" + n(I, 4) + n(g, 4) + L + j + Y };
762
- }
763
- var i = e("../utils"), l = e("../stream/GenericWorker"), p = e("../utf8"), w = e("../crc32"), v = e("../signature");
764
- function x(u, _, o, g) {
765
- l.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = _, this.zipPlatform = o, this.encodeFileName = g, this.streamFiles = u, this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
766
- }
767
- i.inherits(x, l), x.prototype.push = function(u) {
768
- var _ = u.meta.percent || 0, o = this.entriesCount, g = this._sources.length;
769
- this.accumulate ? this.contentBuffer.push(u) : (this.bytesWritten += u.data.length, l.prototype.push.call(this, { data: u.data, meta: { currentFile: this.currentFile, percent: o ? (_ + 100 * (o - g - 1)) / o : 100 } }));
770
- }, x.prototype.openedSource = function(u) {
771
- this.currentSourceOffset = this.bytesWritten, this.currentFile = u.file.name;
772
- var _ = this.streamFiles && !u.file.dir;
773
- if (_) {
774
- var o = r(u, _, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
775
- this.push({ data: o.fileRecord, meta: { percent: 0 } });
776
- } else this.accumulate = !0;
777
- }, x.prototype.closedSource = function(u) {
778
- this.accumulate = !1;
779
- var _ = this.streamFiles && !u.file.dir, o = r(u, _, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
780
- if (this.dirRecords.push(o.dirRecord), _) this.push({ data: (function(g) {
781
- return v.DATA_DESCRIPTOR + n(g.crc32, 4) + n(g.compressedSize, 4) + n(g.uncompressedSize, 4);
782
- })(u), meta: { percent: 100 } });
783
- else for (this.push({ data: o.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
784
- this.currentFile = null;
785
- }, x.prototype.flush = function() {
786
- for (var u = this.bytesWritten, _ = 0; _ < this.dirRecords.length; _++) this.push({ data: this.dirRecords[_], meta: { percent: 100 } });
787
- var o = this.bytesWritten - u, g = (function(h, b, S, z, E) {
788
- var R = i.transformTo("string", E(z));
789
- return v.CENTRAL_DIRECTORY_END + "\0\0\0\0" + n(h, 2) + n(h, 2) + n(b, 4) + n(S, 4) + n(R.length, 2) + R;
790
- })(this.dirRecords.length, o, u, this.zipComment, this.encodeFileName);
791
- this.push({ data: g, meta: { percent: 100 } });
792
- }, x.prototype.prepareNextSource = function() {
793
- this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
794
- }, x.prototype.registerPrevious = function(u) {
795
- this._sources.push(u);
796
- var _ = this;
797
- return u.on("data", function(o) {
798
- _.processChunk(o);
799
- }), u.on("end", function() {
800
- _.closedSource(_.previous.streamInfo), _._sources.length ? _.prepareNextSource() : _.end();
801
- }), u.on("error", function(o) {
802
- _.error(o);
803
- }), this;
804
- }, x.prototype.resume = function() {
805
- return !!l.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), !0) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), !0));
806
- }, x.prototype.error = function(u) {
807
- var _ = this._sources;
808
- if (!l.prototype.error.call(this, u)) return !1;
809
- for (var o = 0; o < _.length; o++) try {
810
- _[o].error(u);
811
- } catch {
812
- }
813
- return !0;
814
- }, x.prototype.lock = function() {
815
- l.prototype.lock.call(this);
816
- for (var u = this._sources, _ = 0; _ < u.length; _++) u[_].lock();
817
- }, f.exports = x;
818
- }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, f, a) {
819
- var n = e("../compressions"), r = e("./ZipFileWorker");
820
- a.generateWorker = function(i, l, p) {
821
- var w = new r(l.streamFiles, p, l.platform, l.encodeFileName), v = 0;
822
- try {
823
- i.forEach(function(x, u) {
824
- v++;
825
- var _ = (function(b, S) {
826
- var z = b || S, E = n[z];
827
- if (!E) throw new Error(z + " is not a valid compression method !");
828
- return E;
829
- })(u.options.compression, l.compression), o = u.options.compressionOptions || l.compressionOptions || {}, g = u.dir, h = u.date;
830
- u._compressWorker(_, o).withStreamInfo("file", { name: x, dir: g, date: h, comment: u.comment || "", unixPermissions: u.unixPermissions, dosPermissions: u.dosPermissions }).pipe(w);
831
- }), w.entriesCount = v;
832
- } catch (x) {
833
- w.error(x);
834
- }
835
- return w;
836
- };
837
- }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, f, a) {
838
- function n() {
839
- if (!(this instanceof n)) return new n();
840
- if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
841
- this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
842
- var r = new n();
843
- for (var i in this) typeof this[i] != "function" && (r[i] = this[i]);
844
- return r;
845
- };
846
- }
847
- (n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(r, i) {
848
- return new n().loadAsync(r, i);
849
- }, n.external = e("./external"), f.exports = n;
850
- }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, f, a) {
851
- var n = e("./utils"), r = e("./external"), i = e("./utf8"), l = e("./zipEntries"), p = e("./stream/Crc32Probe"), w = e("./nodejsUtils");
852
- function v(x) {
853
- return new r.Promise(function(u, _) {
854
- var o = x.decompressed.getContentWorker().pipe(new p());
855
- o.on("error", function(g) {
856
- _(g);
857
- }).on("end", function() {
858
- o.streamInfo.crc32 !== x.decompressed.crc32 ? _(new Error("Corrupted zip : CRC32 mismatch")) : u();
859
- }).resume();
860
- });
861
- }
862
- f.exports = function(x, u) {
863
- var _ = this;
864
- return u = n.extend(u || {}, { base64: !1, checkCRC32: !1, optimizedBinaryString: !1, createFolders: !1, decodeFileName: i.utf8decode }), w.isNode && w.isStream(x) ? r.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : n.prepareContent("the loaded zip file", x, !0, u.optimizedBinaryString, u.base64).then(function(o) {
865
- var g = new l(u);
866
- return g.load(o), g;
867
- }).then(function(o) {
868
- var g = [r.Promise.resolve(o)], h = o.files;
869
- if (u.checkCRC32) for (var b = 0; b < h.length; b++) g.push(v(h[b]));
870
- return r.Promise.all(g);
871
- }).then(function(o) {
872
- for (var g = o.shift(), h = g.files, b = 0; b < h.length; b++) {
873
- var S = h[b], z = S.fileNameStr, E = n.resolve(S.fileNameStr);
874
- _.file(E, S.decompressed, { binary: !0, optimizedBinaryString: !0, date: S.date, dir: S.dir, comment: S.fileCommentStr.length ? S.fileCommentStr : null, unixPermissions: S.unixPermissions, dosPermissions: S.dosPermissions, createFolders: u.createFolders }), S.dir || (_.file(E).unsafeOriginalName = z);
875
- }
876
- return g.zipComment.length && (_.comment = g.zipComment), _;
877
- });
878
- };
879
- }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, f, a) {
880
- var n = e("../utils"), r = e("../stream/GenericWorker");
881
- function i(l, p) {
882
- r.call(this, "Nodejs stream input adapter for " + l), this._upstreamEnded = !1, this._bindStream(p);
883
- }
884
- n.inherits(i, r), i.prototype._bindStream = function(l) {
885
- var p = this;
886
- (this._stream = l).pause(), l.on("data", function(w) {
887
- p.push({ data: w, meta: { percent: 0 } });
888
- }).on("error", function(w) {
889
- p.isPaused ? this.generatedError = w : p.error(w);
890
- }).on("end", function() {
891
- p.isPaused ? p._upstreamEnded = !0 : p.end();
892
- });
893
- }, i.prototype.pause = function() {
894
- return !!r.prototype.pause.call(this) && (this._stream.pause(), !0);
895
- }, i.prototype.resume = function() {
896
- return !!r.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), !0);
897
- }, f.exports = i;
898
- }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, f, a) {
899
- var n = e("readable-stream").Readable;
900
- function r(i, l, p) {
901
- n.call(this, l), this._helper = i;
902
- var w = this;
903
- i.on("data", function(v, x) {
904
- w.push(v) || w._helper.pause(), p && p(x);
905
- }).on("error", function(v) {
906
- w.emit("error", v);
907
- }).on("end", function() {
908
- w.push(null);
909
- });
910
- }
911
- e("../utils").inherits(r, n), r.prototype._read = function() {
912
- this._helper.resume();
913
- }, f.exports = r;
914
- }, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, f, a) {
915
- f.exports = { isNode: typeof Buffer < "u", newBufferFrom: function(n, r) {
916
- if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(n, r);
917
- if (typeof n == "number") throw new Error('The "data" argument must not be a number');
918
- return new Buffer(n, r);
919
- }, allocBuffer: function(n) {
920
- if (Buffer.alloc) return Buffer.alloc(n);
921
- var r = new Buffer(n);
922
- return r.fill(0), r;
923
- }, isBuffer: function(n) {
924
- return Buffer.isBuffer(n);
925
- }, isStream: function(n) {
926
- return n && typeof n.on == "function" && typeof n.pause == "function" && typeof n.resume == "function";
927
- } };
928
- }, {}], 15: [function(e, f, a) {
929
- function n(E, R, B) {
930
- var L, P = i.getTypeOf(R), W = i.extend(B || {}, w);
931
- W.date = W.date || /* @__PURE__ */ new Date(), W.compression !== null && (W.compression = W.compression.toUpperCase()), typeof W.unixPermissions == "string" && (W.unixPermissions = parseInt(W.unixPermissions, 8)), W.unixPermissions && 16384 & W.unixPermissions && (W.dir = !0), W.dosPermissions && 16 & W.dosPermissions && (W.dir = !0), W.dir && (E = h(E)), W.createFolders && (L = g(E)) && b.call(this, L, !0);
932
- var Y = P === "string" && W.binary === !1 && W.base64 === !1;
933
- B && B.binary !== void 0 || (W.binary = !Y), (R instanceof v && R.uncompressedSize === 0 || W.dir || !R || R.length === 0) && (W.base64 = !1, W.binary = !0, R = "", W.compression = "STORE", P = "string");
934
- var k = null;
935
- k = R instanceof v || R instanceof l ? R : _.isNode && _.isStream(R) ? new o(E, R) : i.prepareContent(E, R, W.binary, W.optimizedBinaryString, W.base64);
936
- var F = new x(E, k, W);
937
- this.files[E] = F;
938
- }
939
- var r = e("./utf8"), i = e("./utils"), l = e("./stream/GenericWorker"), p = e("./stream/StreamHelper"), w = e("./defaults"), v = e("./compressedObject"), x = e("./zipObject"), u = e("./generate"), _ = e("./nodejsUtils"), o = e("./nodejs/NodejsStreamInputAdapter"), g = function(E) {
940
- E.slice(-1) === "/" && (E = E.substring(0, E.length - 1));
941
- var R = E.lastIndexOf("/");
942
- return 0 < R ? E.substring(0, R) : "";
943
- }, h = function(E) {
944
- return E.slice(-1) !== "/" && (E += "/"), E;
945
- }, b = function(E, R) {
946
- return R = R !== void 0 ? R : w.createFolders, E = h(E), this.files[E] || n.call(this, E, null, { dir: !0, createFolders: R }), this.files[E];
947
- };
948
- function S(E) {
949
- return Object.prototype.toString.call(E) === "[object RegExp]";
950
- }
951
- var z = { load: function() {
952
- throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
953
- }, forEach: function(E) {
954
- var R, B, L;
955
- for (R in this.files) L = this.files[R], (B = R.slice(this.root.length, R.length)) && R.slice(0, this.root.length) === this.root && E(B, L);
956
- }, filter: function(E) {
957
- var R = [];
958
- return this.forEach(function(B, L) {
959
- E(B, L) && R.push(L);
960
- }), R;
961
- }, file: function(E, R, B) {
962
- if (arguments.length !== 1) return E = this.root + E, n.call(this, E, R, B), this;
963
- if (S(E)) {
964
- var L = E;
965
- return this.filter(function(W, Y) {
966
- return !Y.dir && L.test(W);
967
- });
968
- }
969
- var P = this.files[this.root + E];
970
- return P && !P.dir ? P : null;
971
- }, folder: function(E) {
972
- if (!E) return this;
973
- if (S(E)) return this.filter(function(P, W) {
974
- return W.dir && E.test(P);
975
- });
976
- var R = this.root + E, B = b.call(this, R), L = this.clone();
977
- return L.root = B.name, L;
978
- }, remove: function(E) {
979
- E = this.root + E;
980
- var R = this.files[E];
981
- if (R || (E.slice(-1) !== "/" && (E += "/"), R = this.files[E]), R && !R.dir) delete this.files[E];
982
- else for (var B = this.filter(function(P, W) {
983
- return W.name.slice(0, E.length) === E;
984
- }), L = 0; L < B.length; L++) delete this.files[B[L].name];
985
- return this;
986
- }, generate: function() {
987
- throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
988
- }, generateInternalStream: function(E) {
989
- var R, B = {};
990
- try {
991
- if ((B = i.extend(E || {}, { streamFiles: !1, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: r.utf8encode })).type = B.type.toLowerCase(), B.compression = B.compression.toUpperCase(), B.type === "binarystring" && (B.type = "string"), !B.type) throw new Error("No output type specified.");
992
- i.checkSupport(B.type), B.platform !== "darwin" && B.platform !== "freebsd" && B.platform !== "linux" && B.platform !== "sunos" || (B.platform = "UNIX"), B.platform === "win32" && (B.platform = "DOS");
993
- var L = B.comment || this.comment || "";
994
- R = u.generateWorker(this, B, L);
995
- } catch (P) {
996
- (R = new l("error")).error(P);
997
- }
998
- return new p(R, B.type || "string", B.mimeType);
999
- }, generateAsync: function(E, R) {
1000
- return this.generateInternalStream(E).accumulate(R);
1001
- }, generateNodeStream: function(E, R) {
1002
- return (E = E || {}).type || (E.type = "nodebuffer"), this.generateInternalStream(E).toNodejsStream(R);
1003
- } };
1004
- f.exports = z;
1005
- }, { "./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, f, a) {
1006
- f.exports = e("stream");
1007
- }, { stream: void 0 }], 17: [function(e, f, a) {
1008
- var n = e("./DataReader");
1009
- function r(i) {
1010
- n.call(this, i);
1011
- for (var l = 0; l < this.data.length; l++) i[l] = 255 & i[l];
1012
- }
1013
- e("../utils").inherits(r, n), r.prototype.byteAt = function(i) {
1014
- return this.data[this.zero + i];
1015
- }, r.prototype.lastIndexOfSignature = function(i) {
1016
- for (var l = i.charCodeAt(0), p = i.charCodeAt(1), w = i.charCodeAt(2), v = i.charCodeAt(3), x = this.length - 4; 0 <= x; --x) if (this.data[x] === l && this.data[x + 1] === p && this.data[x + 2] === w && this.data[x + 3] === v) return x - this.zero;
1017
- return -1;
1018
- }, r.prototype.readAndCheckSignature = function(i) {
1019
- var l = i.charCodeAt(0), p = i.charCodeAt(1), w = i.charCodeAt(2), v = i.charCodeAt(3), x = this.readData(4);
1020
- return l === x[0] && p === x[1] && w === x[2] && v === x[3];
1021
- }, r.prototype.readData = function(i) {
1022
- if (this.checkOffset(i), i === 0) return [];
1023
- var l = this.data.slice(this.zero + this.index, this.zero + this.index + i);
1024
- return this.index += i, l;
1025
- }, f.exports = r;
1026
- }, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, f, a) {
1027
- var n = e("../utils");
1028
- function r(i) {
1029
- this.data = i, this.length = i.length, this.index = 0, this.zero = 0;
1030
- }
1031
- r.prototype = { checkOffset: function(i) {
1032
- this.checkIndex(this.index + i);
1033
- }, checkIndex: function(i) {
1034
- if (this.length < this.zero + i || i < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + i + "). Corrupted zip ?");
1035
- }, setIndex: function(i) {
1036
- this.checkIndex(i), this.index = i;
1037
- }, skip: function(i) {
1038
- this.setIndex(this.index + i);
1039
- }, byteAt: function() {
1040
- }, readInt: function(i) {
1041
- var l, p = 0;
1042
- for (this.checkOffset(i), l = this.index + i - 1; l >= this.index; l--) p = (p << 8) + this.byteAt(l);
1043
- return this.index += i, p;
1044
- }, readString: function(i) {
1045
- return n.transformTo("string", this.readData(i));
1046
- }, readData: function() {
1047
- }, lastIndexOfSignature: function() {
1048
- }, readAndCheckSignature: function() {
1049
- }, readDate: function() {
1050
- var i = this.readInt(4);
1051
- return new Date(Date.UTC(1980 + (i >> 25 & 127), (i >> 21 & 15) - 1, i >> 16 & 31, i >> 11 & 31, i >> 5 & 63, (31 & i) << 1));
1052
- } }, f.exports = r;
1053
- }, { "../utils": 32 }], 19: [function(e, f, a) {
1054
- var n = e("./Uint8ArrayReader");
1055
- function r(i) {
1056
- n.call(this, i);
1057
- }
1058
- e("../utils").inherits(r, n), r.prototype.readData = function(i) {
1059
- this.checkOffset(i);
1060
- var l = this.data.slice(this.zero + this.index, this.zero + this.index + i);
1061
- return this.index += i, l;
1062
- }, f.exports = r;
1063
- }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, f, a) {
1064
- var n = e("./DataReader");
1065
- function r(i) {
1066
- n.call(this, i);
1067
- }
1068
- e("../utils").inherits(r, n), r.prototype.byteAt = function(i) {
1069
- return this.data.charCodeAt(this.zero + i);
1070
- }, r.prototype.lastIndexOfSignature = function(i) {
1071
- return this.data.lastIndexOf(i) - this.zero;
1072
- }, r.prototype.readAndCheckSignature = function(i) {
1073
- return i === this.readData(4);
1074
- }, r.prototype.readData = function(i) {
1075
- this.checkOffset(i);
1076
- var l = this.data.slice(this.zero + this.index, this.zero + this.index + i);
1077
- return this.index += i, l;
1078
- }, f.exports = r;
1079
- }, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, f, a) {
1080
- var n = e("./ArrayReader");
1081
- function r(i) {
1082
- n.call(this, i);
1083
- }
1084
- e("../utils").inherits(r, n), r.prototype.readData = function(i) {
1085
- if (this.checkOffset(i), i === 0) return new Uint8Array(0);
1086
- var l = this.data.subarray(this.zero + this.index, this.zero + this.index + i);
1087
- return this.index += i, l;
1088
- }, f.exports = r;
1089
- }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, f, a) {
1090
- var n = e("../utils"), r = e("../support"), i = e("./ArrayReader"), l = e("./StringReader"), p = e("./NodeBufferReader"), w = e("./Uint8ArrayReader");
1091
- f.exports = function(v) {
1092
- var x = n.getTypeOf(v);
1093
- return n.checkSupport(x), x !== "string" || r.uint8array ? x === "nodebuffer" ? new p(v) : r.uint8array ? new w(n.transformTo("uint8array", v)) : new i(n.transformTo("array", v)) : new l(v);
1094
- };
1095
- }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, f, a) {
1096
- a.LOCAL_FILE_HEADER = "PK", a.CENTRAL_FILE_HEADER = "PK", a.CENTRAL_DIRECTORY_END = "PK", a.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", a.ZIP64_CENTRAL_DIRECTORY_END = "PK", a.DATA_DESCRIPTOR = "PK\x07\b";
1097
- }, {}], 24: [function(e, f, a) {
1098
- var n = e("./GenericWorker"), r = e("../utils");
1099
- function i(l) {
1100
- n.call(this, "ConvertWorker to " + l), this.destType = l;
1101
- }
1102
- r.inherits(i, n), i.prototype.processChunk = function(l) {
1103
- this.push({ data: r.transformTo(this.destType, l.data), meta: l.meta });
1104
- }, f.exports = i;
1105
- }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, f, a) {
1106
- var n = e("./GenericWorker"), r = e("../crc32");
1107
- function i() {
1108
- n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
1109
- }
1110
- e("../utils").inherits(i, n), i.prototype.processChunk = function(l) {
1111
- this.streamInfo.crc32 = r(l.data, this.streamInfo.crc32 || 0), this.push(l);
1112
- }, f.exports = i;
1113
- }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, f, a) {
1114
- var n = e("../utils"), r = e("./GenericWorker");
1115
- function i(l) {
1116
- r.call(this, "DataLengthProbe for " + l), this.propName = l, this.withStreamInfo(l, 0);
1117
- }
1118
- n.inherits(i, r), i.prototype.processChunk = function(l) {
1119
- if (l) {
1120
- var p = this.streamInfo[this.propName] || 0;
1121
- this.streamInfo[this.propName] = p + l.data.length;
1122
- }
1123
- r.prototype.processChunk.call(this, l);
1124
- }, f.exports = i;
1125
- }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, f, a) {
1126
- var n = e("../utils"), r = e("./GenericWorker");
1127
- function i(l) {
1128
- r.call(this, "DataWorker");
1129
- var p = this;
1130
- this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = !1, l.then(function(w) {
1131
- p.dataIsReady = !0, p.data = w, p.max = w && w.length || 0, p.type = n.getTypeOf(w), p.isPaused || p._tickAndRepeat();
1132
- }, function(w) {
1133
- p.error(w);
1134
- });
1135
- }
1136
- n.inherits(i, r), i.prototype.cleanUp = function() {
1137
- r.prototype.cleanUp.call(this), this.data = null;
1138
- }, i.prototype.resume = function() {
1139
- return !!r.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, n.delay(this._tickAndRepeat, [], this)), !0);
1140
- }, i.prototype._tickAndRepeat = function() {
1141
- this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = !0));
1142
- }, i.prototype._tick = function() {
1143
- if (this.isPaused || this.isFinished) return !1;
1144
- var l = null, p = Math.min(this.max, this.index + 16384);
1145
- if (this.index >= this.max) return this.end();
1146
- switch (this.type) {
1147
- case "string":
1148
- l = this.data.substring(this.index, p);
1149
- break;
1150
- case "uint8array":
1151
- l = this.data.subarray(this.index, p);
1152
- break;
1153
- case "array":
1154
- case "nodebuffer":
1155
- l = this.data.slice(this.index, p);
1156
- }
1157
- return this.index = p, this.push({ data: l, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
1158
- }, f.exports = i;
1159
- }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, f, a) {
1160
- function n(r) {
1161
- this.name = r || "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;
1162
- }
1163
- n.prototype = { push: function(r) {
1164
- this.emit("data", r);
1165
- }, end: function() {
1166
- if (this.isFinished) return !1;
1167
- this.flush();
1168
- try {
1169
- this.emit("end"), this.cleanUp(), this.isFinished = !0;
1170
- } catch (r) {
1171
- this.emit("error", r);
1172
- }
1173
- return !0;
1174
- }, error: function(r) {
1175
- return !this.isFinished && (this.isPaused ? this.generatedError = r : (this.isFinished = !0, this.emit("error", r), this.previous && this.previous.error(r), this.cleanUp()), !0);
1176
- }, on: function(r, i) {
1177
- return this._listeners[r].push(i), this;
1178
- }, cleanUp: function() {
1179
- this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
1180
- }, emit: function(r, i) {
1181
- if (this._listeners[r]) for (var l = 0; l < this._listeners[r].length; l++) this._listeners[r][l].call(this, i);
1182
- }, pipe: function(r) {
1183
- return r.registerPrevious(this);
1184
- }, registerPrevious: function(r) {
1185
- if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
1186
- this.streamInfo = r.streamInfo, this.mergeStreamInfo(), this.previous = r;
1187
- var i = this;
1188
- return r.on("data", function(l) {
1189
- i.processChunk(l);
1190
- }), r.on("end", function() {
1191
- i.end();
1192
- }), r.on("error", function(l) {
1193
- i.error(l);
1194
- }), this;
1195
- }, pause: function() {
1196
- return !this.isPaused && !this.isFinished && (this.isPaused = !0, this.previous && this.previous.pause(), !0);
1197
- }, resume: function() {
1198
- if (!this.isPaused || this.isFinished) return !1;
1199
- var r = this.isPaused = !1;
1200
- return this.generatedError && (this.error(this.generatedError), r = !0), this.previous && this.previous.resume(), !r;
1201
- }, flush: function() {
1202
- }, processChunk: function(r) {
1203
- this.push(r);
1204
- }, withStreamInfo: function(r, i) {
1205
- return this.extraStreamInfo[r] = i, this.mergeStreamInfo(), this;
1206
- }, mergeStreamInfo: function() {
1207
- for (var r in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, r) && (this.streamInfo[r] = this.extraStreamInfo[r]);
1208
- }, lock: function() {
1209
- if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
1210
- this.isLocked = !0, this.previous && this.previous.lock();
1211
- }, toString: function() {
1212
- var r = "Worker " + this.name;
1213
- return this.previous ? this.previous + " -> " + r : r;
1214
- } }, f.exports = n;
1215
- }, {}], 29: [function(e, f, a) {
1216
- var n = e("../utils"), r = e("./ConvertWorker"), i = e("./GenericWorker"), l = e("../base64"), p = e("../support"), w = e("../external"), v = null;
1217
- if (p.nodestream) try {
1218
- v = e("../nodejs/NodejsStreamOutputAdapter");
1219
- } catch {
1220
- }
1221
- function x(_, o) {
1222
- return new w.Promise(function(g, h) {
1223
- var b = [], S = _._internalType, z = _._outputType, E = _._mimeType;
1224
- _.on("data", function(R, B) {
1225
- b.push(R), o && o(B);
1226
- }).on("error", function(R) {
1227
- b = [], h(R);
1228
- }).on("end", function() {
1229
- try {
1230
- var R = (function(B, L, P) {
1231
- switch (B) {
1232
- case "blob":
1233
- return n.newBlob(n.transformTo("arraybuffer", L), P);
1234
- case "base64":
1235
- return l.encode(L);
1236
- default:
1237
- return n.transformTo(B, L);
1238
- }
1239
- })(z, (function(B, L) {
1240
- var P, W = 0, Y = null, k = 0;
1241
- for (P = 0; P < L.length; P++) k += L[P].length;
1242
- switch (B) {
1243
- case "string":
1244
- return L.join("");
1245
- case "array":
1246
- return Array.prototype.concat.apply([], L);
1247
- case "uint8array":
1248
- for (Y = new Uint8Array(k), P = 0; P < L.length; P++) Y.set(L[P], W), W += L[P].length;
1249
- return Y;
1250
- case "nodebuffer":
1251
- return Buffer.concat(L);
1252
- default:
1253
- throw new Error("concat : unsupported type '" + B + "'");
1254
- }
1255
- })(S, b), E);
1256
- g(R);
1257
- } catch (B) {
1258
- h(B);
1259
- }
1260
- b = [];
1261
- }).resume();
1262
- });
1263
- }
1264
- function u(_, o, g) {
1265
- var h = o;
1266
- switch (o) {
1267
- case "blob":
1268
- case "arraybuffer":
1269
- h = "uint8array";
1270
- break;
1271
- case "base64":
1272
- h = "string";
1273
- }
1274
- try {
1275
- this._internalType = h, this._outputType = o, this._mimeType = g, n.checkSupport(h), this._worker = _.pipe(new r(h)), _.lock();
1276
- } catch (b) {
1277
- this._worker = new i("error"), this._worker.error(b);
1278
- }
1279
- }
1280
- u.prototype = { accumulate: function(_) {
1281
- return x(this, _);
1282
- }, on: function(_, o) {
1283
- var g = this;
1284
- return _ === "data" ? this._worker.on(_, function(h) {
1285
- o.call(g, h.data, h.meta);
1286
- }) : this._worker.on(_, function() {
1287
- n.delay(o, arguments, g);
1288
- }), this;
1289
- }, resume: function() {
1290
- return n.delay(this._worker.resume, [], this._worker), this;
1291
- }, pause: function() {
1292
- return this._worker.pause(), this;
1293
- }, toNodejsStream: function(_) {
1294
- if (n.checkSupport("nodestream"), this._outputType !== "nodebuffer") throw new Error(this._outputType + " is not supported by this method");
1295
- return new v(this, { objectMode: this._outputType !== "nodebuffer" }, _);
1296
- } }, f.exports = u;
1297
- }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, f, a) {
1298
- if (a.base64 = !0, a.array = !0, a.string = !0, a.arraybuffer = typeof ArrayBuffer < "u" && typeof Uint8Array < "u", a.nodebuffer = typeof Buffer < "u", a.uint8array = typeof Uint8Array < "u", typeof ArrayBuffer > "u") a.blob = !1;
1299
- else {
1300
- var n = new ArrayBuffer(0);
1301
- try {
1302
- a.blob = new Blob([n], { type: "application/zip" }).size === 0;
1303
- } catch {
1304
- try {
1305
- var r = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1306
- r.append(n), a.blob = r.getBlob("application/zip").size === 0;
1307
- } catch {
1308
- a.blob = !1;
1309
- }
1310
- }
1311
- }
1312
- try {
1313
- a.nodestream = !!e("readable-stream").Readable;
1314
- } catch {
1315
- a.nodestream = !1;
1316
- }
1317
- }, { "readable-stream": 16 }], 31: [function(e, f, a) {
1318
- for (var n = e("./utils"), r = e("./support"), i = e("./nodejsUtils"), l = e("./stream/GenericWorker"), p = new Array(256), w = 0; w < 256; w++) p[w] = 252 <= w ? 6 : 248 <= w ? 5 : 240 <= w ? 4 : 224 <= w ? 3 : 192 <= w ? 2 : 1;
1319
- p[254] = p[254] = 1;
1320
- function v() {
1321
- l.call(this, "utf-8 decode"), this.leftOver = null;
1322
- }
1323
- function x() {
1324
- l.call(this, "utf-8 encode");
1325
- }
1326
- a.utf8encode = function(u) {
1327
- return r.nodebuffer ? i.newBufferFrom(u, "utf-8") : (function(_) {
1328
- var o, g, h, b, S, z = _.length, E = 0;
1329
- for (b = 0; b < z; b++) (64512 & (g = _.charCodeAt(b))) == 55296 && b + 1 < z && (64512 & (h = _.charCodeAt(b + 1))) == 56320 && (g = 65536 + (g - 55296 << 10) + (h - 56320), b++), E += g < 128 ? 1 : g < 2048 ? 2 : g < 65536 ? 3 : 4;
1330
- for (o = r.uint8array ? new Uint8Array(E) : new Array(E), b = S = 0; S < E; b++) (64512 & (g = _.charCodeAt(b))) == 55296 && b + 1 < z && (64512 & (h = _.charCodeAt(b + 1))) == 56320 && (g = 65536 + (g - 55296 << 10) + (h - 56320), b++), g < 128 ? o[S++] = g : (g < 2048 ? o[S++] = 192 | g >>> 6 : (g < 65536 ? o[S++] = 224 | g >>> 12 : (o[S++] = 240 | g >>> 18, o[S++] = 128 | g >>> 12 & 63), o[S++] = 128 | g >>> 6 & 63), o[S++] = 128 | 63 & g);
1331
- return o;
1332
- })(u);
1333
- }, a.utf8decode = function(u) {
1334
- return r.nodebuffer ? n.transformTo("nodebuffer", u).toString("utf-8") : (function(_) {
1335
- var o, g, h, b, S = _.length, z = new Array(2 * S);
1336
- for (o = g = 0; o < S; ) if ((h = _[o++]) < 128) z[g++] = h;
1337
- else if (4 < (b = p[h])) z[g++] = 65533, o += b - 1;
1338
- else {
1339
- for (h &= b === 2 ? 31 : b === 3 ? 15 : 7; 1 < b && o < S; ) h = h << 6 | 63 & _[o++], b--;
1340
- 1 < b ? z[g++] = 65533 : h < 65536 ? z[g++] = h : (h -= 65536, z[g++] = 55296 | h >> 10 & 1023, z[g++] = 56320 | 1023 & h);
1341
- }
1342
- return z.length !== g && (z.subarray ? z = z.subarray(0, g) : z.length = g), n.applyFromCharCode(z);
1343
- })(u = n.transformTo(r.uint8array ? "uint8array" : "array", u));
1344
- }, n.inherits(v, l), v.prototype.processChunk = function(u) {
1345
- var _ = n.transformTo(r.uint8array ? "uint8array" : "array", u.data);
1346
- if (this.leftOver && this.leftOver.length) {
1347
- if (r.uint8array) {
1348
- var o = _;
1349
- (_ = new Uint8Array(o.length + this.leftOver.length)).set(this.leftOver, 0), _.set(o, this.leftOver.length);
1350
- } else _ = this.leftOver.concat(_);
1351
- this.leftOver = null;
1352
- }
1353
- var g = (function(b, S) {
1354
- var z;
1355
- for ((S = S || b.length) > b.length && (S = b.length), z = S - 1; 0 <= z && (192 & b[z]) == 128; ) z--;
1356
- return z < 0 || z === 0 ? S : z + p[b[z]] > S ? z : S;
1357
- })(_), h = _;
1358
- g !== _.length && (r.uint8array ? (h = _.subarray(0, g), this.leftOver = _.subarray(g, _.length)) : (h = _.slice(0, g), this.leftOver = _.slice(g, _.length))), this.push({ data: a.utf8decode(h), meta: u.meta });
1359
- }, v.prototype.flush = function() {
1360
- this.leftOver && this.leftOver.length && (this.push({ data: a.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
1361
- }, a.Utf8DecodeWorker = v, n.inherits(x, l), x.prototype.processChunk = function(u) {
1362
- this.push({ data: a.utf8encode(u.data), meta: u.meta });
1363
- }, a.Utf8EncodeWorker = x;
1364
- }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, f, a) {
1365
- var n = e("./support"), r = e("./base64"), i = e("./nodejsUtils"), l = e("./external");
1366
- function p(o) {
1367
- return o;
1368
- }
1369
- function w(o, g) {
1370
- for (var h = 0; h < o.length; ++h) g[h] = 255 & o.charCodeAt(h);
1371
- return g;
1372
- }
1373
- e("setimmediate"), a.newBlob = function(o, g) {
1374
- a.checkSupport("blob");
1375
- try {
1376
- return new Blob([o], { type: g });
1377
- } catch {
1378
- try {
1379
- var h = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1380
- return h.append(o), h.getBlob(g);
1381
- } catch {
1382
- throw new Error("Bug : can't construct the Blob.");
1383
- }
1384
- }
1385
- };
1386
- var v = { stringifyByChunk: function(o, g, h) {
1387
- var b = [], S = 0, z = o.length;
1388
- if (z <= h) return String.fromCharCode.apply(null, o);
1389
- for (; S < z; ) g === "array" || g === "nodebuffer" ? b.push(String.fromCharCode.apply(null, o.slice(S, Math.min(S + h, z)))) : b.push(String.fromCharCode.apply(null, o.subarray(S, Math.min(S + h, z)))), S += h;
1390
- return b.join("");
1391
- }, stringifyByChar: function(o) {
1392
- for (var g = "", h = 0; h < o.length; h++) g += String.fromCharCode(o[h]);
1393
- return g;
1394
- }, applyCanBeUsed: { uint8array: (function() {
1395
- try {
1396
- return n.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
1397
- } catch {
1398
- return !1;
1399
- }
1400
- })(), nodebuffer: (function() {
1401
- try {
1402
- return n.nodebuffer && String.fromCharCode.apply(null, i.allocBuffer(1)).length === 1;
1403
- } catch {
1404
- return !1;
1405
- }
1406
- })() } };
1407
- function x(o) {
1408
- var g = 65536, h = a.getTypeOf(o), b = !0;
1409
- if (h === "uint8array" ? b = v.applyCanBeUsed.uint8array : h === "nodebuffer" && (b = v.applyCanBeUsed.nodebuffer), b) for (; 1 < g; ) try {
1410
- return v.stringifyByChunk(o, h, g);
1411
- } catch {
1412
- g = Math.floor(g / 2);
1413
- }
1414
- return v.stringifyByChar(o);
1415
- }
1416
- function u(o, g) {
1417
- for (var h = 0; h < o.length; h++) g[h] = o[h];
1418
- return g;
1419
- }
1420
- a.applyFromCharCode = x;
1421
- var _ = {};
1422
- _.string = { string: p, array: function(o) {
1423
- return w(o, new Array(o.length));
1424
- }, arraybuffer: function(o) {
1425
- return _.string.uint8array(o).buffer;
1426
- }, uint8array: function(o) {
1427
- return w(o, new Uint8Array(o.length));
1428
- }, nodebuffer: function(o) {
1429
- return w(o, i.allocBuffer(o.length));
1430
- } }, _.array = { string: x, array: p, arraybuffer: function(o) {
1431
- return new Uint8Array(o).buffer;
1432
- }, uint8array: function(o) {
1433
- return new Uint8Array(o);
1434
- }, nodebuffer: function(o) {
1435
- return i.newBufferFrom(o);
1436
- } }, _.arraybuffer = { string: function(o) {
1437
- return x(new Uint8Array(o));
1438
- }, array: function(o) {
1439
- return u(new Uint8Array(o), new Array(o.byteLength));
1440
- }, arraybuffer: p, uint8array: function(o) {
1441
- return new Uint8Array(o);
1442
- }, nodebuffer: function(o) {
1443
- return i.newBufferFrom(new Uint8Array(o));
1444
- } }, _.uint8array = { string: x, array: function(o) {
1445
- return u(o, new Array(o.length));
1446
- }, arraybuffer: function(o) {
1447
- return o.buffer;
1448
- }, uint8array: p, nodebuffer: function(o) {
1449
- return i.newBufferFrom(o);
1450
- } }, _.nodebuffer = { string: x, array: function(o) {
1451
- return u(o, new Array(o.length));
1452
- }, arraybuffer: function(o) {
1453
- return _.nodebuffer.uint8array(o).buffer;
1454
- }, uint8array: function(o) {
1455
- return u(o, new Uint8Array(o.length));
1456
- }, nodebuffer: p }, a.transformTo = function(o, g) {
1457
- if (g = g || "", !o) return g;
1458
- a.checkSupport(o);
1459
- var h = a.getTypeOf(g);
1460
- return _[h][o](g);
1461
- }, a.resolve = function(o) {
1462
- for (var g = o.split("/"), h = [], b = 0; b < g.length; b++) {
1463
- var S = g[b];
1464
- S === "." || S === "" && b !== 0 && b !== g.length - 1 || (S === ".." ? h.pop() : h.push(S));
1465
- }
1466
- return h.join("/");
1467
- }, a.getTypeOf = function(o) {
1468
- return typeof o == "string" ? "string" : Object.prototype.toString.call(o) === "[object Array]" ? "array" : n.nodebuffer && i.isBuffer(o) ? "nodebuffer" : n.uint8array && o instanceof Uint8Array ? "uint8array" : n.arraybuffer && o instanceof ArrayBuffer ? "arraybuffer" : void 0;
1469
- }, a.checkSupport = function(o) {
1470
- if (!n[o.toLowerCase()]) throw new Error(o + " is not supported by this platform");
1471
- }, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(o) {
1472
- var g, h, b = "";
1473
- for (h = 0; h < (o || "").length; h++) b += "\\x" + ((g = o.charCodeAt(h)) < 16 ? "0" : "") + g.toString(16).toUpperCase();
1474
- return b;
1475
- }, a.delay = function(o, g, h) {
1476
- setImmediate(function() {
1477
- o.apply(h || null, g || []);
1478
- });
1479
- }, a.inherits = function(o, g) {
1480
- function h() {
1481
- }
1482
- h.prototype = g.prototype, o.prototype = new h();
1483
- }, a.extend = function() {
1484
- var o, g, h = {};
1485
- for (o = 0; o < arguments.length; o++) for (g in arguments[o]) Object.prototype.hasOwnProperty.call(arguments[o], g) && h[g] === void 0 && (h[g] = arguments[o][g]);
1486
- return h;
1487
- }, a.prepareContent = function(o, g, h, b, S) {
1488
- return l.Promise.resolve(g).then(function(z) {
1489
- return n.blob && (z instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(z)) !== -1) && typeof FileReader < "u" ? new l.Promise(function(E, R) {
1490
- var B = new FileReader();
1491
- B.onload = function(L) {
1492
- E(L.target.result);
1493
- }, B.onerror = function(L) {
1494
- R(L.target.error);
1495
- }, B.readAsArrayBuffer(z);
1496
- }) : z;
1497
- }).then(function(z) {
1498
- var E = a.getTypeOf(z);
1499
- return E ? (E === "arraybuffer" ? z = a.transformTo("uint8array", z) : E === "string" && (S ? z = r.decode(z) : h && b !== !0 && (z = (function(R) {
1500
- return w(R, n.uint8array ? new Uint8Array(R.length) : new Array(R.length));
1501
- })(z))), z) : l.Promise.reject(new Error("Can't read the data of '" + o + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
1502
- });
1503
- };
1504
- }, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, f, a) {
1505
- var n = e("./reader/readerFor"), r = e("./utils"), i = e("./signature"), l = e("./zipEntry"), p = e("./support");
1506
- function w(v) {
1507
- this.files = [], this.loadOptions = v;
1508
- }
1509
- w.prototype = { checkSignature: function(v) {
1510
- if (!this.reader.readAndCheckSignature(v)) {
1511
- this.reader.index -= 4;
1512
- var x = this.reader.readString(4);
1513
- throw new Error("Corrupted zip or bug: unexpected signature (" + r.pretty(x) + ", expected " + r.pretty(v) + ")");
1514
- }
1515
- }, isSignature: function(v, x) {
1516
- var u = this.reader.index;
1517
- this.reader.setIndex(v);
1518
- var _ = this.reader.readString(4) === x;
1519
- return this.reader.setIndex(u), _;
1520
- }, readBlockEndOfCentral: function() {
1521
- 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);
1522
- var v = this.reader.readData(this.zipCommentLength), x = p.uint8array ? "uint8array" : "array", u = r.transformTo(x, v);
1523
- this.zipComment = this.loadOptions.decodeFileName(u);
1524
- }, readBlockZip64EndOfCentral: function() {
1525
- 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 = {};
1526
- for (var v, x, u, _ = this.zip64EndOfCentralSize - 44; 0 < _; ) v = this.reader.readInt(2), x = this.reader.readInt(4), u = this.reader.readData(x), this.zip64ExtensibleData[v] = { id: v, length: x, value: u };
1527
- }, readBlockZip64EndOfCentralLocator: function() {
1528
- 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");
1529
- }, readLocalFiles: function() {
1530
- var v, x;
1531
- for (v = 0; v < this.files.length; v++) x = this.files[v], this.reader.setIndex(x.localHeaderOffset), this.checkSignature(i.LOCAL_FILE_HEADER), x.readLocalPart(this.reader), x.handleUTF8(), x.processAttributes();
1532
- }, readCentralDir: function() {
1533
- var v;
1534
- for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(i.CENTRAL_FILE_HEADER); ) (v = new l({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(v);
1535
- 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);
1536
- }, readEndOfCentral: function() {
1537
- var v = this.reader.lastIndexOfSignature(i.CENTRAL_DIRECTORY_END);
1538
- if (v < 0) throw this.isSignature(0, i.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");
1539
- this.reader.setIndex(v);
1540
- var x = v;
1541
- if (this.checkSignature(i.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === r.MAX_VALUE_16BITS || this.diskWithCentralDirStart === r.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === r.MAX_VALUE_16BITS || this.centralDirRecords === r.MAX_VALUE_16BITS || this.centralDirSize === r.MAX_VALUE_32BITS || this.centralDirOffset === r.MAX_VALUE_32BITS) {
1542
- if (this.zip64 = !0, (v = this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
1543
- if (this.reader.setIndex(v), this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, i.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(i.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
1544
- this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(i.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
1545
- }
1546
- var u = this.centralDirOffset + this.centralDirSize;
1547
- this.zip64 && (u += 20, u += 12 + this.zip64EndOfCentralSize);
1548
- var _ = x - u;
1549
- if (0 < _) this.isSignature(x, i.CENTRAL_FILE_HEADER) || (this.reader.zero = _);
1550
- else if (_ < 0) throw new Error("Corrupted zip: missing " + Math.abs(_) + " bytes.");
1551
- }, prepareReader: function(v) {
1552
- this.reader = n(v);
1553
- }, load: function(v) {
1554
- this.prepareReader(v), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
1555
- } }, f.exports = w;
1556
- }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, f, a) {
1557
- var n = e("./reader/readerFor"), r = e("./utils"), i = e("./compressedObject"), l = e("./crc32"), p = e("./utf8"), w = e("./compressions"), v = e("./support");
1558
- function x(u, _) {
1559
- this.options = u, this.loadOptions = _;
1560
- }
1561
- x.prototype = { isEncrypted: function() {
1562
- return (1 & this.bitFlag) == 1;
1563
- }, useUTF8: function() {
1564
- return (2048 & this.bitFlag) == 2048;
1565
- }, readLocalPart: function(u) {
1566
- var _, o;
1567
- if (u.skip(22), this.fileNameLength = u.readInt(2), o = u.readInt(2), this.fileName = u.readData(this.fileNameLength), u.skip(o), 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)");
1568
- if ((_ = (function(g) {
1569
- for (var h in w) if (Object.prototype.hasOwnProperty.call(w, h) && w[h].magic === g) return w[h];
1570
- return null;
1571
- })(this.compressionMethod)) === null) throw new Error("Corrupted zip : compression " + r.pretty(this.compressionMethod) + " unknown (inner file : " + r.transformTo("string", this.fileName) + ")");
1572
- this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, _, u.readData(this.compressedSize));
1573
- }, readCentralPart: function(u) {
1574
- this.versionMadeBy = u.readInt(2), u.skip(2), this.bitFlag = u.readInt(2), this.compressionMethod = u.readString(2), this.date = u.readDate(), this.crc32 = u.readInt(4), this.compressedSize = u.readInt(4), this.uncompressedSize = u.readInt(4);
1575
- var _ = u.readInt(2);
1576
- if (this.extraFieldsLength = u.readInt(2), this.fileCommentLength = u.readInt(2), this.diskNumberStart = u.readInt(2), this.internalFileAttributes = u.readInt(2), this.externalFileAttributes = u.readInt(4), this.localHeaderOffset = u.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
1577
- u.skip(_), this.readExtraFields(u), this.parseZIP64ExtraField(u), this.fileComment = u.readData(this.fileCommentLength);
1578
- }, processAttributes: function() {
1579
- this.unixPermissions = null, this.dosPermissions = null;
1580
- var u = this.versionMadeBy >> 8;
1581
- this.dir = !!(16 & this.externalFileAttributes), u == 0 && (this.dosPermissions = 63 & this.externalFileAttributes), u == 3 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || this.fileNameStr.slice(-1) !== "/" || (this.dir = !0);
1582
- }, parseZIP64ExtraField: function() {
1583
- if (this.extraFields[1]) {
1584
- var u = n(this.extraFields[1].value);
1585
- this.uncompressedSize === r.MAX_VALUE_32BITS && (this.uncompressedSize = u.readInt(8)), this.compressedSize === r.MAX_VALUE_32BITS && (this.compressedSize = u.readInt(8)), this.localHeaderOffset === r.MAX_VALUE_32BITS && (this.localHeaderOffset = u.readInt(8)), this.diskNumberStart === r.MAX_VALUE_32BITS && (this.diskNumberStart = u.readInt(4));
1586
- }
1587
- }, readExtraFields: function(u) {
1588
- var _, o, g, h = u.index + this.extraFieldsLength;
1589
- for (this.extraFields || (this.extraFields = {}); u.index + 4 < h; ) _ = u.readInt(2), o = u.readInt(2), g = u.readData(o), this.extraFields[_] = { id: _, length: o, value: g };
1590
- u.setIndex(h);
1591
- }, handleUTF8: function() {
1592
- var u = v.uint8array ? "uint8array" : "array";
1593
- if (this.useUTF8()) this.fileNameStr = p.utf8decode(this.fileName), this.fileCommentStr = p.utf8decode(this.fileComment);
1594
- else {
1595
- var _ = this.findExtraFieldUnicodePath();
1596
- if (_ !== null) this.fileNameStr = _;
1597
- else {
1598
- var o = r.transformTo(u, this.fileName);
1599
- this.fileNameStr = this.loadOptions.decodeFileName(o);
1600
- }
1601
- var g = this.findExtraFieldUnicodeComment();
1602
- if (g !== null) this.fileCommentStr = g;
1603
- else {
1604
- var h = r.transformTo(u, this.fileComment);
1605
- this.fileCommentStr = this.loadOptions.decodeFileName(h);
1606
- }
1607
- }
1608
- }, findExtraFieldUnicodePath: function() {
1609
- var u = this.extraFields[28789];
1610
- if (u) {
1611
- var _ = n(u.value);
1612
- return _.readInt(1) !== 1 || l(this.fileName) !== _.readInt(4) ? null : p.utf8decode(_.readData(u.length - 5));
1613
- }
1614
- return null;
1615
- }, findExtraFieldUnicodeComment: function() {
1616
- var u = this.extraFields[25461];
1617
- if (u) {
1618
- var _ = n(u.value);
1619
- return _.readInt(1) !== 1 || l(this.fileComment) !== _.readInt(4) ? null : p.utf8decode(_.readData(u.length - 5));
1620
- }
1621
- return null;
1622
- } }, f.exports = x;
1623
- }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, f, a) {
1624
- function n(_, o, g) {
1625
- this.name = _, this.dir = g.dir, this.date = g.date, this.comment = g.comment, this.unixPermissions = g.unixPermissions, this.dosPermissions = g.dosPermissions, this._data = o, this._dataBinary = g.binary, this.options = { compression: g.compression, compressionOptions: g.compressionOptions };
1626
- }
1627
- var r = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), l = e("./utf8"), p = e("./compressedObject"), w = e("./stream/GenericWorker");
1628
- n.prototype = { internalStream: function(_) {
1629
- var o = null, g = "string";
1630
- try {
1631
- if (!_) throw new Error("No output type specified.");
1632
- var h = (g = _.toLowerCase()) === "string" || g === "text";
1633
- g !== "binarystring" && g !== "text" || (g = "string"), o = this._decompressWorker();
1634
- var b = !this._dataBinary;
1635
- b && !h && (o = o.pipe(new l.Utf8EncodeWorker())), !b && h && (o = o.pipe(new l.Utf8DecodeWorker()));
1636
- } catch (S) {
1637
- (o = new w("error")).error(S);
1638
- }
1639
- return new r(o, g, "");
1640
- }, async: function(_, o) {
1641
- return this.internalStream(_).accumulate(o);
1642
- }, nodeStream: function(_, o) {
1643
- return this.internalStream(_ || "nodebuffer").toNodejsStream(o);
1644
- }, _compressWorker: function(_, o) {
1645
- if (this._data instanceof p && this._data.compression.magic === _.magic) return this._data.getCompressedWorker();
1646
- var g = this._decompressWorker();
1647
- return this._dataBinary || (g = g.pipe(new l.Utf8EncodeWorker())), p.createWorkerFrom(g, _, o);
1648
- }, _decompressWorker: function() {
1649
- return this._data instanceof p ? this._data.getContentWorker() : this._data instanceof w ? this._data : new i(this._data);
1650
- } };
1651
- for (var v = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], x = function() {
1652
- throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
1653
- }, u = 0; u < v.length; u++) n.prototype[v[u]] = x;
1654
- f.exports = n;
1655
- }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, f, a) {
1656
- (function(n) {
1657
- var r, i, l = n.MutationObserver || n.WebKitMutationObserver;
1658
- if (l) {
1659
- var p = 0, w = new l(_), v = n.document.createTextNode("");
1660
- w.observe(v, { characterData: !0 }), r = function() {
1661
- v.data = p = ++p % 2;
1662
- };
1663
- } else if (n.setImmediate || n.MessageChannel === void 0) r = "document" in n && "onreadystatechange" in n.document.createElement("script") ? function() {
1664
- var o = n.document.createElement("script");
1665
- o.onreadystatechange = function() {
1666
- _(), o.onreadystatechange = null, o.parentNode.removeChild(o), o = null;
1667
- }, n.document.documentElement.appendChild(o);
1668
- } : function() {
1669
- setTimeout(_, 0);
1670
- };
1671
- else {
1672
- var x = new n.MessageChannel();
1673
- x.port1.onmessage = _, r = function() {
1674
- x.port2.postMessage(0);
1675
- };
1676
- }
1677
- var u = [];
1678
- function _() {
1679
- var o, g;
1680
- i = !0;
1681
- for (var h = u.length; h; ) {
1682
- for (g = u, u = [], o = -1; ++o < h; ) g[o]();
1683
- h = u.length;
1684
- }
1685
- i = !1;
1686
- }
1687
- f.exports = function(o) {
1688
- u.push(o) !== 1 || i || r();
1689
- };
1690
- }).call(this, typeof zt < "u" ? zt : typeof self < "u" ? self : typeof window < "u" ? window : {});
1691
- }, {}], 37: [function(e, f, a) {
1692
- var n = e("immediate");
1693
- function r() {
1694
- }
1695
- var i = {}, l = ["REJECTED"], p = ["FULFILLED"], w = ["PENDING"];
1696
- function v(h) {
1697
- if (typeof h != "function") throw new TypeError("resolver must be a function");
1698
- this.state = w, this.queue = [], this.outcome = void 0, h !== r && o(this, h);
1699
- }
1700
- function x(h, b, S) {
1701
- this.promise = h, typeof b == "function" && (this.onFulfilled = b, this.callFulfilled = this.otherCallFulfilled), typeof S == "function" && (this.onRejected = S, this.callRejected = this.otherCallRejected);
1702
- }
1703
- function u(h, b, S) {
1704
- n(function() {
1705
- var z;
1706
- try {
1707
- z = b(S);
1708
- } catch (E) {
1709
- return i.reject(h, E);
1710
- }
1711
- z === h ? i.reject(h, new TypeError("Cannot resolve promise with itself")) : i.resolve(h, z);
1712
- });
1713
- }
1714
- function _(h) {
1715
- var b = h && h.then;
1716
- if (h && (typeof h == "object" || typeof h == "function") && typeof b == "function") return function() {
1717
- b.apply(h, arguments);
1718
- };
1719
- }
1720
- function o(h, b) {
1721
- var S = !1;
1722
- function z(B) {
1723
- S || (S = !0, i.reject(h, B));
1724
- }
1725
- function E(B) {
1726
- S || (S = !0, i.resolve(h, B));
1727
- }
1728
- var R = g(function() {
1729
- b(E, z);
1730
- });
1731
- R.status === "error" && z(R.value);
1732
- }
1733
- function g(h, b) {
1734
- var S = {};
1735
- try {
1736
- S.value = h(b), S.status = "success";
1737
- } catch (z) {
1738
- S.status = "error", S.value = z;
1739
- }
1740
- return S;
1741
- }
1742
- (f.exports = v).prototype.finally = function(h) {
1743
- if (typeof h != "function") return this;
1744
- var b = this.constructor;
1745
- return this.then(function(S) {
1746
- return b.resolve(h()).then(function() {
1747
- return S;
1748
- });
1749
- }, function(S) {
1750
- return b.resolve(h()).then(function() {
1751
- throw S;
1752
- });
1753
- });
1754
- }, v.prototype.catch = function(h) {
1755
- return this.then(null, h);
1756
- }, v.prototype.then = function(h, b) {
1757
- if (typeof h != "function" && this.state === p || typeof b != "function" && this.state === l) return this;
1758
- var S = new this.constructor(r);
1759
- return this.state !== w ? u(S, this.state === p ? h : b, this.outcome) : this.queue.push(new x(S, h, b)), S;
1760
- }, x.prototype.callFulfilled = function(h) {
1761
- i.resolve(this.promise, h);
1762
- }, x.prototype.otherCallFulfilled = function(h) {
1763
- u(this.promise, this.onFulfilled, h);
1764
- }, x.prototype.callRejected = function(h) {
1765
- i.reject(this.promise, h);
1766
- }, x.prototype.otherCallRejected = function(h) {
1767
- u(this.promise, this.onRejected, h);
1768
- }, i.resolve = function(h, b) {
1769
- var S = g(_, b);
1770
- if (S.status === "error") return i.reject(h, S.value);
1771
- var z = S.value;
1772
- if (z) o(h, z);
1773
- else {
1774
- h.state = p, h.outcome = b;
1775
- for (var E = -1, R = h.queue.length; ++E < R; ) h.queue[E].callFulfilled(b);
1776
- }
1777
- return h;
1778
- }, i.reject = function(h, b) {
1779
- h.state = l, h.outcome = b;
1780
- for (var S = -1, z = h.queue.length; ++S < z; ) h.queue[S].callRejected(b);
1781
- return h;
1782
- }, v.resolve = function(h) {
1783
- return h instanceof this ? h : i.resolve(new this(r), h);
1784
- }, v.reject = function(h) {
1785
- var b = new this(r);
1786
- return i.reject(b, h);
1787
- }, v.all = function(h) {
1788
- var b = this;
1789
- if (Object.prototype.toString.call(h) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1790
- var S = h.length, z = !1;
1791
- if (!S) return this.resolve([]);
1792
- for (var E = new Array(S), R = 0, B = -1, L = new this(r); ++B < S; ) P(h[B], B);
1793
- return L;
1794
- function P(W, Y) {
1795
- b.resolve(W).then(function(k) {
1796
- E[Y] = k, ++R !== S || z || (z = !0, i.resolve(L, E));
1797
- }, function(k) {
1798
- z || (z = !0, i.reject(L, k));
1799
- });
1800
- }
1801
- }, v.race = function(h) {
1802
- var b = this;
1803
- if (Object.prototype.toString.call(h) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1804
- var S = h.length, z = !1;
1805
- if (!S) return this.resolve([]);
1806
- for (var E = -1, R = new this(r); ++E < S; ) B = h[E], b.resolve(B).then(function(L) {
1807
- z || (z = !0, i.resolve(R, L));
1808
- }, function(L) {
1809
- z || (z = !0, i.reject(R, L));
1810
- });
1811
- var B;
1812
- return R;
1813
- };
1814
- }, { immediate: 36 }], 38: [function(e, f, a) {
1815
- var n = {};
1816
- (0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), f.exports = n;
1817
- }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, f, a) {
1818
- var n = e("./zlib/deflate"), r = e("./utils/common"), i = e("./utils/strings"), l = e("./zlib/messages"), p = e("./zlib/zstream"), w = Object.prototype.toString, v = 0, x = -1, u = 0, _ = 8;
1819
- function o(h) {
1820
- if (!(this instanceof o)) return new o(h);
1821
- this.options = r.assign({ level: x, method: _, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: u, to: "" }, h || {});
1822
- var b = this.options;
1823
- b.raw && 0 < b.windowBits ? b.windowBits = -b.windowBits : b.gzip && 0 < b.windowBits && b.windowBits < 16 && (b.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new p(), this.strm.avail_out = 0;
1824
- var S = n.deflateInit2(this.strm, b.level, b.method, b.windowBits, b.memLevel, b.strategy);
1825
- if (S !== v) throw new Error(l[S]);
1826
- if (b.header && n.deflateSetHeader(this.strm, b.header), b.dictionary) {
1827
- var z;
1828
- if (z = typeof b.dictionary == "string" ? i.string2buf(b.dictionary) : w.call(b.dictionary) === "[object ArrayBuffer]" ? new Uint8Array(b.dictionary) : b.dictionary, (S = n.deflateSetDictionary(this.strm, z)) !== v) throw new Error(l[S]);
1829
- this._dict_set = !0;
1830
- }
1831
- }
1832
- function g(h, b) {
1833
- var S = new o(b);
1834
- if (S.push(h, !0), S.err) throw S.msg || l[S.err];
1835
- return S.result;
1836
- }
1837
- o.prototype.push = function(h, b) {
1838
- var S, z, E = this.strm, R = this.options.chunkSize;
1839
- if (this.ended) return !1;
1840
- z = b === ~~b ? b : b === !0 ? 4 : 0, typeof h == "string" ? E.input = i.string2buf(h) : w.call(h) === "[object ArrayBuffer]" ? E.input = new Uint8Array(h) : E.input = h, E.next_in = 0, E.avail_in = E.input.length;
1841
- do {
1842
- if (E.avail_out === 0 && (E.output = new r.Buf8(R), E.next_out = 0, E.avail_out = R), (S = n.deflate(E, z)) !== 1 && S !== v) return this.onEnd(S), !(this.ended = !0);
1843
- E.avail_out !== 0 && (E.avail_in !== 0 || z !== 4 && z !== 2) || (this.options.to === "string" ? this.onData(i.buf2binstring(r.shrinkBuf(E.output, E.next_out))) : this.onData(r.shrinkBuf(E.output, E.next_out)));
1844
- } while ((0 < E.avail_in || E.avail_out === 0) && S !== 1);
1845
- return z === 4 ? (S = n.deflateEnd(this.strm), this.onEnd(S), this.ended = !0, S === v) : z !== 2 || (this.onEnd(v), !(E.avail_out = 0));
1846
- }, o.prototype.onData = function(h) {
1847
- this.chunks.push(h);
1848
- }, o.prototype.onEnd = function(h) {
1849
- h === v && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = r.flattenChunks(this.chunks)), this.chunks = [], this.err = h, this.msg = this.strm.msg;
1850
- }, a.Deflate = o, a.deflate = g, a.deflateRaw = function(h, b) {
1851
- return (b = b || {}).raw = !0, g(h, b);
1852
- }, a.gzip = function(h, b) {
1853
- return (b = b || {}).gzip = !0, g(h, b);
1854
- };
1855
- }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, f, a) {
1856
- var n = e("./zlib/inflate"), r = e("./utils/common"), i = e("./utils/strings"), l = e("./zlib/constants"), p = e("./zlib/messages"), w = e("./zlib/zstream"), v = e("./zlib/gzheader"), x = Object.prototype.toString;
1857
- function u(o) {
1858
- if (!(this instanceof u)) return new u(o);
1859
- this.options = r.assign({ chunkSize: 16384, windowBits: 0, to: "" }, o || {});
1860
- var g = this.options;
1861
- g.raw && 0 <= g.windowBits && g.windowBits < 16 && (g.windowBits = -g.windowBits, g.windowBits === 0 && (g.windowBits = -15)), !(0 <= g.windowBits && g.windowBits < 16) || o && o.windowBits || (g.windowBits += 32), 15 < g.windowBits && g.windowBits < 48 && (15 & g.windowBits) == 0 && (g.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new w(), this.strm.avail_out = 0;
1862
- var h = n.inflateInit2(this.strm, g.windowBits);
1863
- if (h !== l.Z_OK) throw new Error(p[h]);
1864
- this.header = new v(), n.inflateGetHeader(this.strm, this.header);
1865
- }
1866
- function _(o, g) {
1867
- var h = new u(g);
1868
- if (h.push(o, !0), h.err) throw h.msg || p[h.err];
1869
- return h.result;
1870
- }
1871
- u.prototype.push = function(o, g) {
1872
- var h, b, S, z, E, R, B = this.strm, L = this.options.chunkSize, P = this.options.dictionary, W = !1;
1873
- if (this.ended) return !1;
1874
- b = g === ~~g ? g : g === !0 ? l.Z_FINISH : l.Z_NO_FLUSH, typeof o == "string" ? B.input = i.binstring2buf(o) : x.call(o) === "[object ArrayBuffer]" ? B.input = new Uint8Array(o) : B.input = o, B.next_in = 0, B.avail_in = B.input.length;
1875
- do {
1876
- if (B.avail_out === 0 && (B.output = new r.Buf8(L), B.next_out = 0, B.avail_out = L), (h = n.inflate(B, l.Z_NO_FLUSH)) === l.Z_NEED_DICT && P && (R = typeof P == "string" ? i.string2buf(P) : x.call(P) === "[object ArrayBuffer]" ? new Uint8Array(P) : P, h = n.inflateSetDictionary(this.strm, R)), h === l.Z_BUF_ERROR && W === !0 && (h = l.Z_OK, W = !1), h !== l.Z_STREAM_END && h !== l.Z_OK) return this.onEnd(h), !(this.ended = !0);
1877
- B.next_out && (B.avail_out !== 0 && h !== l.Z_STREAM_END && (B.avail_in !== 0 || b !== l.Z_FINISH && b !== l.Z_SYNC_FLUSH) || (this.options.to === "string" ? (S = i.utf8border(B.output, B.next_out), z = B.next_out - S, E = i.buf2string(B.output, S), B.next_out = z, B.avail_out = L - z, z && r.arraySet(B.output, B.output, S, z, 0), this.onData(E)) : this.onData(r.shrinkBuf(B.output, B.next_out)))), B.avail_in === 0 && B.avail_out === 0 && (W = !0);
1878
- } while ((0 < B.avail_in || B.avail_out === 0) && h !== l.Z_STREAM_END);
1879
- return h === l.Z_STREAM_END && (b = l.Z_FINISH), b === l.Z_FINISH ? (h = n.inflateEnd(this.strm), this.onEnd(h), this.ended = !0, h === l.Z_OK) : b !== l.Z_SYNC_FLUSH || (this.onEnd(l.Z_OK), !(B.avail_out = 0));
1880
- }, u.prototype.onData = function(o) {
1881
- this.chunks.push(o);
1882
- }, u.prototype.onEnd = function(o) {
1883
- o === l.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = r.flattenChunks(this.chunks)), this.chunks = [], this.err = o, this.msg = this.strm.msg;
1884
- }, a.Inflate = u, a.inflate = _, a.inflateRaw = function(o, g) {
1885
- return (g = g || {}).raw = !0, _(o, g);
1886
- }, a.ungzip = _;
1887
- }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, f, a) {
1888
- var n = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
1889
- a.assign = function(l) {
1890
- for (var p = Array.prototype.slice.call(arguments, 1); p.length; ) {
1891
- var w = p.shift();
1892
- if (w) {
1893
- if (typeof w != "object") throw new TypeError(w + "must be non-object");
1894
- for (var v in w) w.hasOwnProperty(v) && (l[v] = w[v]);
1895
- }
1896
- }
1897
- return l;
1898
- }, a.shrinkBuf = function(l, p) {
1899
- return l.length === p ? l : l.subarray ? l.subarray(0, p) : (l.length = p, l);
1900
- };
1901
- var r = { arraySet: function(l, p, w, v, x) {
1902
- if (p.subarray && l.subarray) l.set(p.subarray(w, w + v), x);
1903
- else for (var u = 0; u < v; u++) l[x + u] = p[w + u];
1904
- }, flattenChunks: function(l) {
1905
- var p, w, v, x, u, _;
1906
- for (p = v = 0, w = l.length; p < w; p++) v += l[p].length;
1907
- for (_ = new Uint8Array(v), p = x = 0, w = l.length; p < w; p++) u = l[p], _.set(u, x), x += u.length;
1908
- return _;
1909
- } }, i = { arraySet: function(l, p, w, v, x) {
1910
- for (var u = 0; u < v; u++) l[x + u] = p[w + u];
1911
- }, flattenChunks: function(l) {
1912
- return [].concat.apply([], l);
1913
- } };
1914
- a.setTyped = function(l) {
1915
- l ? (a.Buf8 = Uint8Array, a.Buf16 = Uint16Array, a.Buf32 = Int32Array, a.assign(a, r)) : (a.Buf8 = Array, a.Buf16 = Array, a.Buf32 = Array, a.assign(a, i));
1916
- }, a.setTyped(n);
1917
- }, {}], 42: [function(e, f, a) {
1918
- var n = e("./common"), r = !0, i = !0;
1919
- try {
1920
- String.fromCharCode.apply(null, [0]);
1921
- } catch {
1922
- r = !1;
1923
- }
1924
- try {
1925
- String.fromCharCode.apply(null, new Uint8Array(1));
1926
- } catch {
1927
- i = !1;
1928
- }
1929
- for (var l = new n.Buf8(256), p = 0; p < 256; p++) l[p] = 252 <= p ? 6 : 248 <= p ? 5 : 240 <= p ? 4 : 224 <= p ? 3 : 192 <= p ? 2 : 1;
1930
- function w(v, x) {
1931
- if (x < 65537 && (v.subarray && i || !v.subarray && r)) return String.fromCharCode.apply(null, n.shrinkBuf(v, x));
1932
- for (var u = "", _ = 0; _ < x; _++) u += String.fromCharCode(v[_]);
1933
- return u;
1934
- }
1935
- l[254] = l[254] = 1, a.string2buf = function(v) {
1936
- var x, u, _, o, g, h = v.length, b = 0;
1937
- for (o = 0; o < h; o++) (64512 & (u = v.charCodeAt(o))) == 55296 && o + 1 < h && (64512 & (_ = v.charCodeAt(o + 1))) == 56320 && (u = 65536 + (u - 55296 << 10) + (_ - 56320), o++), b += u < 128 ? 1 : u < 2048 ? 2 : u < 65536 ? 3 : 4;
1938
- for (x = new n.Buf8(b), o = g = 0; g < b; o++) (64512 & (u = v.charCodeAt(o))) == 55296 && o + 1 < h && (64512 & (_ = v.charCodeAt(o + 1))) == 56320 && (u = 65536 + (u - 55296 << 10) + (_ - 56320), o++), u < 128 ? x[g++] = u : (u < 2048 ? x[g++] = 192 | u >>> 6 : (u < 65536 ? x[g++] = 224 | u >>> 12 : (x[g++] = 240 | u >>> 18, x[g++] = 128 | u >>> 12 & 63), x[g++] = 128 | u >>> 6 & 63), x[g++] = 128 | 63 & u);
1939
- return x;
1940
- }, a.buf2binstring = function(v) {
1941
- return w(v, v.length);
1942
- }, a.binstring2buf = function(v) {
1943
- for (var x = new n.Buf8(v.length), u = 0, _ = x.length; u < _; u++) x[u] = v.charCodeAt(u);
1944
- return x;
1945
- }, a.buf2string = function(v, x) {
1946
- var u, _, o, g, h = x || v.length, b = new Array(2 * h);
1947
- for (u = _ = 0; u < h; ) if ((o = v[u++]) < 128) b[_++] = o;
1948
- else if (4 < (g = l[o])) b[_++] = 65533, u += g - 1;
1949
- else {
1950
- for (o &= g === 2 ? 31 : g === 3 ? 15 : 7; 1 < g && u < h; ) o = o << 6 | 63 & v[u++], g--;
1951
- 1 < g ? b[_++] = 65533 : o < 65536 ? b[_++] = o : (o -= 65536, b[_++] = 55296 | o >> 10 & 1023, b[_++] = 56320 | 1023 & o);
1952
- }
1953
- return w(b, _);
1954
- }, a.utf8border = function(v, x) {
1955
- var u;
1956
- for ((x = x || v.length) > v.length && (x = v.length), u = x - 1; 0 <= u && (192 & v[u]) == 128; ) u--;
1957
- return u < 0 || u === 0 ? x : u + l[v[u]] > x ? u : x;
1958
- };
1959
- }, { "./common": 41 }], 43: [function(e, f, a) {
1960
- f.exports = function(n, r, i, l) {
1961
- for (var p = 65535 & n | 0, w = n >>> 16 & 65535 | 0, v = 0; i !== 0; ) {
1962
- for (i -= v = 2e3 < i ? 2e3 : i; w = w + (p = p + r[l++] | 0) | 0, --v; ) ;
1963
- p %= 65521, w %= 65521;
1964
- }
1965
- return p | w << 16 | 0;
1966
- };
1967
- }, {}], 44: [function(e, f, a) {
1968
- f.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 };
1969
- }, {}], 45: [function(e, f, a) {
1970
- var n = (function() {
1971
- for (var r, i = [], l = 0; l < 256; l++) {
1972
- r = l;
1973
- for (var p = 0; p < 8; p++) r = 1 & r ? 3988292384 ^ r >>> 1 : r >>> 1;
1974
- i[l] = r;
1975
- }
1976
- return i;
1977
- })();
1978
- f.exports = function(r, i, l, p) {
1979
- var w = n, v = p + l;
1980
- r ^= -1;
1981
- for (var x = p; x < v; x++) r = r >>> 8 ^ w[255 & (r ^ i[x])];
1982
- return -1 ^ r;
1983
- };
1984
- }, {}], 46: [function(e, f, a) {
1985
- var n, r = e("../utils/common"), i = e("./trees"), l = e("./adler32"), p = e("./crc32"), w = e("./messages"), v = 0, x = 4, u = 0, _ = -2, o = -1, g = 4, h = 2, b = 8, S = 9, z = 286, E = 30, R = 19, B = 2 * z + 1, L = 15, P = 3, W = 258, Y = W + P + 1, k = 42, F = 113, s = 1, j = 2, Q = 3, U = 4;
1986
- function tt(t, D) {
1987
- return t.msg = w[D], D;
1988
- }
1989
- function M(t) {
1990
- return (t << 1) - (4 < t ? 9 : 0);
1991
- }
1992
- function q(t) {
1993
- for (var D = t.length; 0 <= --D; ) t[D] = 0;
1994
- }
1995
- function O(t) {
1996
- var D = t.state, T = D.pending;
1997
- T > t.avail_out && (T = t.avail_out), T !== 0 && (r.arraySet(t.output, D.pending_buf, D.pending_out, T, t.next_out), t.next_out += T, D.pending_out += T, t.total_out += T, t.avail_out -= T, D.pending -= T, D.pending === 0 && (D.pending_out = 0));
1998
- }
1999
- function I(t, D) {
2000
- i._tr_flush_block(t, 0 <= t.block_start ? t.block_start : -1, t.strstart - t.block_start, D), t.block_start = t.strstart, O(t.strm);
2001
- }
2002
- function J(t, D) {
2003
- t.pending_buf[t.pending++] = D;
2004
- }
2005
- function G(t, D) {
2006
- t.pending_buf[t.pending++] = D >>> 8 & 255, t.pending_buf[t.pending++] = 255 & D;
2007
- }
2008
- function X(t, D) {
2009
- var T, y, m = t.max_chain_length, C = t.strstart, N = t.prev_length, $ = t.nice_match, A = t.strstart > t.w_size - Y ? t.strstart - (t.w_size - Y) : 0, Z = t.window, K = t.w_mask, H = t.prev, V = t.strstart + W, it = Z[C + N - 1], rt = Z[C + N];
2010
- t.prev_length >= t.good_match && (m >>= 2), $ > t.lookahead && ($ = t.lookahead);
2011
- do
2012
- if (Z[(T = D) + N] === rt && Z[T + N - 1] === it && Z[T] === Z[C] && Z[++T] === Z[C + 1]) {
2013
- C += 2, T++;
2014
- do
2015
- ;
2016
- while (Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && Z[++C] === Z[++T] && C < V);
2017
- if (y = W - (V - C), C = V - W, N < y) {
2018
- if (t.match_start = D, $ <= (N = y)) break;
2019
- it = Z[C + N - 1], rt = Z[C + N];
2020
- }
2021
- }
2022
- while ((D = H[D & K]) > A && --m != 0);
2023
- return N <= t.lookahead ? N : t.lookahead;
2024
- }
2025
- function st(t) {
2026
- var D, T, y, m, C, N, $, A, Z, K, H = t.w_size;
2027
- do {
2028
- if (m = t.window_size - t.lookahead - t.strstart, t.strstart >= H + (H - Y)) {
2029
- for (r.arraySet(t.window, t.window, H, H, 0), t.match_start -= H, t.strstart -= H, t.block_start -= H, D = T = t.hash_size; y = t.head[--D], t.head[D] = H <= y ? y - H : 0, --T; ) ;
2030
- for (D = T = H; y = t.prev[--D], t.prev[D] = H <= y ? y - H : 0, --T; ) ;
2031
- m += H;
2032
- }
2033
- if (t.strm.avail_in === 0) break;
2034
- if (N = t.strm, $ = t.window, A = t.strstart + t.lookahead, Z = m, K = void 0, K = N.avail_in, Z < K && (K = Z), T = K === 0 ? 0 : (N.avail_in -= K, r.arraySet($, N.input, N.next_in, K, A), N.state.wrap === 1 ? N.adler = l(N.adler, $, K, A) : N.state.wrap === 2 && (N.adler = p(N.adler, $, K, A)), N.next_in += K, N.total_in += K, K), t.lookahead += T, t.lookahead + t.insert >= P) for (C = t.strstart - t.insert, t.ins_h = t.window[C], t.ins_h = (t.ins_h << t.hash_shift ^ t.window[C + 1]) & t.hash_mask; t.insert && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[C + P - 1]) & t.hash_mask, t.prev[C & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = C, C++, t.insert--, !(t.lookahead + t.insert < P)); ) ;
2035
- } while (t.lookahead < Y && t.strm.avail_in !== 0);
2036
- }
2037
- function lt(t, D) {
2038
- for (var T, y; ; ) {
2039
- if (t.lookahead < Y) {
2040
- if (st(t), t.lookahead < Y && D === v) return s;
2041
- if (t.lookahead === 0) break;
2042
- }
2043
- if (T = 0, t.lookahead >= P && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), T !== 0 && t.strstart - T <= t.w_size - Y && (t.match_length = X(t, T)), t.match_length >= P) if (y = i._tr_tally(t, t.strstart - t.match_start, t.match_length - P), t.lookahead -= t.match_length, t.match_length <= t.max_lazy_match && t.lookahead >= P) {
2044
- for (t.match_length--; t.strstart++, t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart, --t.match_length != 0; ) ;
2045
- t.strstart++;
2046
- } 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;
2047
- else y = i._tr_tally(t, 0, t.window[t.strstart]), t.lookahead--, t.strstart++;
2048
- if (y && (I(t, !1), t.strm.avail_out === 0)) return s;
2049
- }
2050
- return t.insert = t.strstart < P - 1 ? t.strstart : P - 1, D === x ? (I(t, !0), t.strm.avail_out === 0 ? Q : U) : t.last_lit && (I(t, !1), t.strm.avail_out === 0) ? s : j;
2051
- }
2052
- function et(t, D) {
2053
- for (var T, y, m; ; ) {
2054
- if (t.lookahead < Y) {
2055
- if (st(t), t.lookahead < Y && D === v) return s;
2056
- if (t.lookahead === 0) break;
2057
- }
2058
- if (T = 0, t.lookahead >= P && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = 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 = P - 1, T !== 0 && t.prev_length < t.max_lazy_match && t.strstart - T <= t.w_size - Y && (t.match_length = X(t, T), t.match_length <= 5 && (t.strategy === 1 || t.match_length === P && 4096 < t.strstart - t.match_start) && (t.match_length = P - 1)), t.prev_length >= P && t.match_length <= t.prev_length) {
2059
- for (m = t.strstart + t.lookahead - P, y = i._tr_tally(t, t.strstart - 1 - t.prev_match, t.prev_length - P), t.lookahead -= t.prev_length - 1, t.prev_length -= 2; ++t.strstart <= m && (t.ins_h = (t.ins_h << t.hash_shift ^ t.window[t.strstart + P - 1]) & t.hash_mask, T = t.prev[t.strstart & t.w_mask] = t.head[t.ins_h], t.head[t.ins_h] = t.strstart), --t.prev_length != 0; ) ;
2060
- if (t.match_available = 0, t.match_length = P - 1, t.strstart++, y && (I(t, !1), t.strm.avail_out === 0)) return s;
2061
- } else if (t.match_available) {
2062
- if ((y = i._tr_tally(t, 0, t.window[t.strstart - 1])) && I(t, !1), t.strstart++, t.lookahead--, t.strm.avail_out === 0) return s;
2063
- } else t.match_available = 1, t.strstart++, t.lookahead--;
2064
- }
2065
- return t.match_available && (y = i._tr_tally(t, 0, t.window[t.strstart - 1]), t.match_available = 0), t.insert = t.strstart < P - 1 ? t.strstart : P - 1, D === x ? (I(t, !0), t.strm.avail_out === 0 ? Q : U) : t.last_lit && (I(t, !1), t.strm.avail_out === 0) ? s : j;
2066
- }
2067
- function nt(t, D, T, y, m) {
2068
- this.good_length = t, this.max_lazy = D, this.nice_length = T, this.max_chain = y, this.func = m;
2069
- }
2070
- function ct() {
2071
- 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 = b, 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 r.Buf16(2 * B), this.dyn_dtree = new r.Buf16(2 * (2 * E + 1)), this.bl_tree = new r.Buf16(2 * (2 * R + 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 r.Buf16(L + 1), this.heap = new r.Buf16(2 * z + 1), q(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new r.Buf16(2 * z + 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;
2072
- }
2073
- function at(t) {
2074
- var D;
2075
- return t && t.state ? (t.total_in = t.total_out = 0, t.data_type = h, (D = t.state).pending = 0, D.pending_out = 0, D.wrap < 0 && (D.wrap = -D.wrap), D.status = D.wrap ? k : F, t.adler = D.wrap === 2 ? 0 : 1, D.last_flush = v, i._tr_init(D), u) : tt(t, _);
2076
- }
2077
- function dt(t) {
2078
- var D = at(t);
2079
- return D === u && (function(T) {
2080
- T.window_size = 2 * T.w_size, q(T.head), T.max_lazy_match = n[T.level].max_lazy, T.good_match = n[T.level].good_length, T.nice_match = n[T.level].nice_length, T.max_chain_length = n[T.level].max_chain, T.strstart = 0, T.block_start = 0, T.lookahead = 0, T.insert = 0, T.match_length = T.prev_length = P - 1, T.match_available = 0, T.ins_h = 0;
2081
- })(t.state), D;
2082
- }
2083
- function ht(t, D, T, y, m, C) {
2084
- if (!t) return _;
2085
- var N = 1;
2086
- if (D === o && (D = 6), y < 0 ? (N = 0, y = -y) : 15 < y && (N = 2, y -= 16), m < 1 || S < m || T !== b || y < 8 || 15 < y || D < 0 || 9 < D || C < 0 || g < C) return tt(t, _);
2087
- y === 8 && (y = 9);
2088
- var $ = new ct();
2089
- return (t.state = $).strm = t, $.wrap = N, $.gzhead = null, $.w_bits = y, $.w_size = 1 << $.w_bits, $.w_mask = $.w_size - 1, $.hash_bits = m + 7, $.hash_size = 1 << $.hash_bits, $.hash_mask = $.hash_size - 1, $.hash_shift = ~~(($.hash_bits + P - 1) / P), $.window = new r.Buf8(2 * $.w_size), $.head = new r.Buf16($.hash_size), $.prev = new r.Buf16($.w_size), $.lit_bufsize = 1 << m + 6, $.pending_buf_size = 4 * $.lit_bufsize, $.pending_buf = new r.Buf8($.pending_buf_size), $.d_buf = 1 * $.lit_bufsize, $.l_buf = 3 * $.lit_bufsize, $.level = D, $.strategy = C, $.method = T, dt(t);
2090
- }
2091
- n = [new nt(0, 0, 0, 0, function(t, D) {
2092
- var T = 65535;
2093
- for (T > t.pending_buf_size - 5 && (T = t.pending_buf_size - 5); ; ) {
2094
- if (t.lookahead <= 1) {
2095
- if (st(t), t.lookahead === 0 && D === v) return s;
2096
- if (t.lookahead === 0) break;
2097
- }
2098
- t.strstart += t.lookahead, t.lookahead = 0;
2099
- var y = t.block_start + T;
2100
- if ((t.strstart === 0 || t.strstart >= y) && (t.lookahead = t.strstart - y, t.strstart = y, I(t, !1), t.strm.avail_out === 0) || t.strstart - t.block_start >= t.w_size - Y && (I(t, !1), t.strm.avail_out === 0)) return s;
2101
- }
2102
- return t.insert = 0, D === x ? (I(t, !0), t.strm.avail_out === 0 ? Q : U) : (t.strstart > t.block_start && (I(t, !1), t.strm.avail_out), s);
2103
- }), new nt(4, 4, 8, 4, lt), new nt(4, 5, 16, 8, lt), new nt(4, 6, 32, 32, lt), new nt(4, 4, 16, 16, et), new nt(8, 16, 32, 32, et), new nt(8, 16, 128, 128, et), new nt(8, 32, 128, 256, et), new nt(32, 128, 258, 1024, et), new nt(32, 258, 258, 4096, et)], a.deflateInit = function(t, D) {
2104
- return ht(t, D, b, 15, 8, 0);
2105
- }, a.deflateInit2 = ht, a.deflateReset = dt, a.deflateResetKeep = at, a.deflateSetHeader = function(t, D) {
2106
- return t && t.state ? t.state.wrap !== 2 ? _ : (t.state.gzhead = D, u) : _;
2107
- }, a.deflate = function(t, D) {
2108
- var T, y, m, C;
2109
- if (!t || !t.state || 5 < D || D < 0) return t ? tt(t, _) : _;
2110
- if (y = t.state, !t.output || !t.input && t.avail_in !== 0 || y.status === 666 && D !== x) return tt(t, t.avail_out === 0 ? -5 : _);
2111
- if (y.strm = t, T = y.last_flush, y.last_flush = D, y.status === k) if (y.wrap === 2) t.adler = 0, J(y, 31), J(y, 139), J(y, 8), y.gzhead ? (J(y, (y.gzhead.text ? 1 : 0) + (y.gzhead.hcrc ? 2 : 0) + (y.gzhead.extra ? 4 : 0) + (y.gzhead.name ? 8 : 0) + (y.gzhead.comment ? 16 : 0)), J(y, 255 & y.gzhead.time), J(y, y.gzhead.time >> 8 & 255), J(y, y.gzhead.time >> 16 & 255), J(y, y.gzhead.time >> 24 & 255), J(y, y.level === 9 ? 2 : 2 <= y.strategy || y.level < 2 ? 4 : 0), J(y, 255 & y.gzhead.os), y.gzhead.extra && y.gzhead.extra.length && (J(y, 255 & y.gzhead.extra.length), J(y, y.gzhead.extra.length >> 8 & 255)), y.gzhead.hcrc && (t.adler = p(t.adler, y.pending_buf, y.pending, 0)), y.gzindex = 0, y.status = 69) : (J(y, 0), J(y, 0), J(y, 0), J(y, 0), J(y, 0), J(y, y.level === 9 ? 2 : 2 <= y.strategy || y.level < 2 ? 4 : 0), J(y, 3), y.status = F);
2112
- else {
2113
- var N = b + (y.w_bits - 8 << 4) << 8;
2114
- N |= (2 <= y.strategy || y.level < 2 ? 0 : y.level < 6 ? 1 : y.level === 6 ? 2 : 3) << 6, y.strstart !== 0 && (N |= 32), N += 31 - N % 31, y.status = F, G(y, N), y.strstart !== 0 && (G(y, t.adler >>> 16), G(y, 65535 & t.adler)), t.adler = 1;
2115
- }
2116
- if (y.status === 69) if (y.gzhead.extra) {
2117
- for (m = y.pending; y.gzindex < (65535 & y.gzhead.extra.length) && (y.pending !== y.pending_buf_size || (y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), O(t), m = y.pending, y.pending !== y.pending_buf_size)); ) J(y, 255 & y.gzhead.extra[y.gzindex]), y.gzindex++;
2118
- y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), y.gzindex === y.gzhead.extra.length && (y.gzindex = 0, y.status = 73);
2119
- } else y.status = 73;
2120
- if (y.status === 73) if (y.gzhead.name) {
2121
- m = y.pending;
2122
- do {
2123
- if (y.pending === y.pending_buf_size && (y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), O(t), m = y.pending, y.pending === y.pending_buf_size)) {
2124
- C = 1;
2125
- break;
2126
- }
2127
- C = y.gzindex < y.gzhead.name.length ? 255 & y.gzhead.name.charCodeAt(y.gzindex++) : 0, J(y, C);
2128
- } while (C !== 0);
2129
- y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), C === 0 && (y.gzindex = 0, y.status = 91);
2130
- } else y.status = 91;
2131
- if (y.status === 91) if (y.gzhead.comment) {
2132
- m = y.pending;
2133
- do {
2134
- if (y.pending === y.pending_buf_size && (y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), O(t), m = y.pending, y.pending === y.pending_buf_size)) {
2135
- C = 1;
2136
- break;
2137
- }
2138
- C = y.gzindex < y.gzhead.comment.length ? 255 & y.gzhead.comment.charCodeAt(y.gzindex++) : 0, J(y, C);
2139
- } while (C !== 0);
2140
- y.gzhead.hcrc && y.pending > m && (t.adler = p(t.adler, y.pending_buf, y.pending - m, m)), C === 0 && (y.status = 103);
2141
- } else y.status = 103;
2142
- if (y.status === 103 && (y.gzhead.hcrc ? (y.pending + 2 > y.pending_buf_size && O(t), y.pending + 2 <= y.pending_buf_size && (J(y, 255 & t.adler), J(y, t.adler >> 8 & 255), t.adler = 0, y.status = F)) : y.status = F), y.pending !== 0) {
2143
- if (O(t), t.avail_out === 0) return y.last_flush = -1, u;
2144
- } else if (t.avail_in === 0 && M(D) <= M(T) && D !== x) return tt(t, -5);
2145
- if (y.status === 666 && t.avail_in !== 0) return tt(t, -5);
2146
- if (t.avail_in !== 0 || y.lookahead !== 0 || D !== v && y.status !== 666) {
2147
- var $ = y.strategy === 2 ? (function(A, Z) {
2148
- for (var K; ; ) {
2149
- if (A.lookahead === 0 && (st(A), A.lookahead === 0)) {
2150
- if (Z === v) return s;
2151
- break;
2152
- }
2153
- if (A.match_length = 0, K = i._tr_tally(A, 0, A.window[A.strstart]), A.lookahead--, A.strstart++, K && (I(A, !1), A.strm.avail_out === 0)) return s;
2154
- }
2155
- return A.insert = 0, Z === x ? (I(A, !0), A.strm.avail_out === 0 ? Q : U) : A.last_lit && (I(A, !1), A.strm.avail_out === 0) ? s : j;
2156
- })(y, D) : y.strategy === 3 ? (function(A, Z) {
2157
- for (var K, H, V, it, rt = A.window; ; ) {
2158
- if (A.lookahead <= W) {
2159
- if (st(A), A.lookahead <= W && Z === v) return s;
2160
- if (A.lookahead === 0) break;
2161
- }
2162
- if (A.match_length = 0, A.lookahead >= P && 0 < A.strstart && (H = rt[V = A.strstart - 1]) === rt[++V] && H === rt[++V] && H === rt[++V]) {
2163
- it = A.strstart + W;
2164
- do
2165
- ;
2166
- while (H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && H === rt[++V] && V < it);
2167
- A.match_length = W - (it - V), A.match_length > A.lookahead && (A.match_length = A.lookahead);
2168
- }
2169
- if (A.match_length >= P ? (K = i._tr_tally(A, 1, A.match_length - P), A.lookahead -= A.match_length, A.strstart += A.match_length, A.match_length = 0) : (K = i._tr_tally(A, 0, A.window[A.strstart]), A.lookahead--, A.strstart++), K && (I(A, !1), A.strm.avail_out === 0)) return s;
2170
- }
2171
- return A.insert = 0, Z === x ? (I(A, !0), A.strm.avail_out === 0 ? Q : U) : A.last_lit && (I(A, !1), A.strm.avail_out === 0) ? s : j;
2172
- })(y, D) : n[y.level].func(y, D);
2173
- if ($ !== Q && $ !== U || (y.status = 666), $ === s || $ === Q) return t.avail_out === 0 && (y.last_flush = -1), u;
2174
- if ($ === j && (D === 1 ? i._tr_align(y) : D !== 5 && (i._tr_stored_block(y, 0, 0, !1), D === 3 && (q(y.head), y.lookahead === 0 && (y.strstart = 0, y.block_start = 0, y.insert = 0))), O(t), t.avail_out === 0)) return y.last_flush = -1, u;
2175
- }
2176
- return D !== x ? u : y.wrap <= 0 ? 1 : (y.wrap === 2 ? (J(y, 255 & t.adler), J(y, t.adler >> 8 & 255), J(y, t.adler >> 16 & 255), J(y, t.adler >> 24 & 255), J(y, 255 & t.total_in), J(y, t.total_in >> 8 & 255), J(y, t.total_in >> 16 & 255), J(y, t.total_in >> 24 & 255)) : (G(y, t.adler >>> 16), G(y, 65535 & t.adler)), O(t), 0 < y.wrap && (y.wrap = -y.wrap), y.pending !== 0 ? u : 1);
2177
- }, a.deflateEnd = function(t) {
2178
- var D;
2179
- return t && t.state ? (D = t.state.status) !== k && D !== 69 && D !== 73 && D !== 91 && D !== 103 && D !== F && D !== 666 ? tt(t, _) : (t.state = null, D === F ? tt(t, -3) : u) : _;
2180
- }, a.deflateSetDictionary = function(t, D) {
2181
- var T, y, m, C, N, $, A, Z, K = D.length;
2182
- if (!t || !t.state || (C = (T = t.state).wrap) === 2 || C === 1 && T.status !== k || T.lookahead) return _;
2183
- for (C === 1 && (t.adler = l(t.adler, D, K, 0)), T.wrap = 0, K >= T.w_size && (C === 0 && (q(T.head), T.strstart = 0, T.block_start = 0, T.insert = 0), Z = new r.Buf8(T.w_size), r.arraySet(Z, D, K - T.w_size, T.w_size, 0), D = Z, K = T.w_size), N = t.avail_in, $ = t.next_in, A = t.input, t.avail_in = K, t.next_in = 0, t.input = D, st(T); T.lookahead >= P; ) {
2184
- for (y = T.strstart, m = T.lookahead - (P - 1); T.ins_h = (T.ins_h << T.hash_shift ^ T.window[y + P - 1]) & T.hash_mask, T.prev[y & T.w_mask] = T.head[T.ins_h], T.head[T.ins_h] = y, y++, --m; ) ;
2185
- T.strstart = y, T.lookahead = P - 1, st(T);
2186
- }
2187
- return T.strstart += T.lookahead, T.block_start = T.strstart, T.insert = T.lookahead, T.lookahead = 0, T.match_length = T.prev_length = P - 1, T.match_available = 0, t.next_in = $, t.input = A, t.avail_in = N, T.wrap = C, u;
2188
- }, a.deflateInfo = "pako deflate (from Nodeca project)";
2189
- }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, f, a) {
2190
- f.exports = function() {
2191
- 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;
2192
- };
2193
- }, {}], 48: [function(e, f, a) {
2194
- f.exports = function(n, r) {
2195
- var i, l, p, w, v, x, u, _, o, g, h, b, S, z, E, R, B, L, P, W, Y, k, F, s, j;
2196
- i = n.state, l = n.next_in, s = n.input, p = l + (n.avail_in - 5), w = n.next_out, j = n.output, v = w - (r - n.avail_out), x = w + (n.avail_out - 257), u = i.dmax, _ = i.wsize, o = i.whave, g = i.wnext, h = i.window, b = i.hold, S = i.bits, z = i.lencode, E = i.distcode, R = (1 << i.lenbits) - 1, B = (1 << i.distbits) - 1;
2197
- t: do {
2198
- S < 15 && (b += s[l++] << S, S += 8, b += s[l++] << S, S += 8), L = z[b & R];
2199
- e: for (; ; ) {
2200
- if (b >>>= P = L >>> 24, S -= P, (P = L >>> 16 & 255) === 0) j[w++] = 65535 & L;
2201
- else {
2202
- if (!(16 & P)) {
2203
- if ((64 & P) == 0) {
2204
- L = z[(65535 & L) + (b & (1 << P) - 1)];
2205
- continue e;
2206
- }
2207
- if (32 & P) {
2208
- i.mode = 12;
2209
- break t;
2210
- }
2211
- n.msg = "invalid literal/length code", i.mode = 30;
2212
- break t;
2213
- }
2214
- W = 65535 & L, (P &= 15) && (S < P && (b += s[l++] << S, S += 8), W += b & (1 << P) - 1, b >>>= P, S -= P), S < 15 && (b += s[l++] << S, S += 8, b += s[l++] << S, S += 8), L = E[b & B];
2215
- r: for (; ; ) {
2216
- if (b >>>= P = L >>> 24, S -= P, !(16 & (P = L >>> 16 & 255))) {
2217
- if ((64 & P) == 0) {
2218
- L = E[(65535 & L) + (b & (1 << P) - 1)];
2219
- continue r;
2220
- }
2221
- n.msg = "invalid distance code", i.mode = 30;
2222
- break t;
2223
- }
2224
- if (Y = 65535 & L, S < (P &= 15) && (b += s[l++] << S, (S += 8) < P && (b += s[l++] << S, S += 8)), u < (Y += b & (1 << P) - 1)) {
2225
- n.msg = "invalid distance too far back", i.mode = 30;
2226
- break t;
2227
- }
2228
- if (b >>>= P, S -= P, (P = w - v) < Y) {
2229
- if (o < (P = Y - P) && i.sane) {
2230
- n.msg = "invalid distance too far back", i.mode = 30;
2231
- break t;
2232
- }
2233
- if (F = h, (k = 0) === g) {
2234
- if (k += _ - P, P < W) {
2235
- for (W -= P; j[w++] = h[k++], --P; ) ;
2236
- k = w - Y, F = j;
2237
- }
2238
- } else if (g < P) {
2239
- if (k += _ + g - P, (P -= g) < W) {
2240
- for (W -= P; j[w++] = h[k++], --P; ) ;
2241
- if (k = 0, g < W) {
2242
- for (W -= P = g; j[w++] = h[k++], --P; ) ;
2243
- k = w - Y, F = j;
2244
- }
2245
- }
2246
- } else if (k += g - P, P < W) {
2247
- for (W -= P; j[w++] = h[k++], --P; ) ;
2248
- k = w - Y, F = j;
2249
- }
2250
- for (; 2 < W; ) j[w++] = F[k++], j[w++] = F[k++], j[w++] = F[k++], W -= 3;
2251
- W && (j[w++] = F[k++], 1 < W && (j[w++] = F[k++]));
2252
- } else {
2253
- for (k = w - Y; j[w++] = j[k++], j[w++] = j[k++], j[w++] = j[k++], 2 < (W -= 3); ) ;
2254
- W && (j[w++] = j[k++], 1 < W && (j[w++] = j[k++]));
2255
- }
2256
- break;
2257
- }
2258
- }
2259
- break;
2260
- }
2261
- } while (l < p && w < x);
2262
- l -= W = S >> 3, b &= (1 << (S -= W << 3)) - 1, n.next_in = l, n.next_out = w, n.avail_in = l < p ? p - l + 5 : 5 - (l - p), n.avail_out = w < x ? x - w + 257 : 257 - (w - x), i.hold = b, i.bits = S;
2263
- };
2264
- }, {}], 49: [function(e, f, a) {
2265
- var n = e("../utils/common"), r = e("./adler32"), i = e("./crc32"), l = e("./inffast"), p = e("./inftrees"), w = 1, v = 2, x = 0, u = -2, _ = 1, o = 852, g = 592;
2266
- function h(k) {
2267
- return (k >>> 24 & 255) + (k >>> 8 & 65280) + ((65280 & k) << 8) + ((255 & k) << 24);
2268
- }
2269
- function b() {
2270
- 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 n.Buf16(320), this.work = new n.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
2271
- }
2272
- function S(k) {
2273
- var F;
2274
- return k && k.state ? (F = k.state, k.total_in = k.total_out = F.total = 0, k.msg = "", F.wrap && (k.adler = 1 & F.wrap), F.mode = _, F.last = 0, F.havedict = 0, F.dmax = 32768, F.head = null, F.hold = 0, F.bits = 0, F.lencode = F.lendyn = new n.Buf32(o), F.distcode = F.distdyn = new n.Buf32(g), F.sane = 1, F.back = -1, x) : u;
2275
- }
2276
- function z(k) {
2277
- var F;
2278
- return k && k.state ? ((F = k.state).wsize = 0, F.whave = 0, F.wnext = 0, S(k)) : u;
2279
- }
2280
- function E(k, F) {
2281
- var s, j;
2282
- return k && k.state ? (j = k.state, F < 0 ? (s = 0, F = -F) : (s = 1 + (F >> 4), F < 48 && (F &= 15)), F && (F < 8 || 15 < F) ? u : (j.window !== null && j.wbits !== F && (j.window = null), j.wrap = s, j.wbits = F, z(k))) : u;
2283
- }
2284
- function R(k, F) {
2285
- var s, j;
2286
- return k ? (j = new b(), (k.state = j).window = null, (s = E(k, F)) !== x && (k.state = null), s) : u;
2287
- }
2288
- var B, L, P = !0;
2289
- function W(k) {
2290
- if (P) {
2291
- var F;
2292
- for (B = new n.Buf32(512), L = new n.Buf32(32), F = 0; F < 144; ) k.lens[F++] = 8;
2293
- for (; F < 256; ) k.lens[F++] = 9;
2294
- for (; F < 280; ) k.lens[F++] = 7;
2295
- for (; F < 288; ) k.lens[F++] = 8;
2296
- for (p(w, k.lens, 0, 288, B, 0, k.work, { bits: 9 }), F = 0; F < 32; ) k.lens[F++] = 5;
2297
- p(v, k.lens, 0, 32, L, 0, k.work, { bits: 5 }), P = !1;
2298
- }
2299
- k.lencode = B, k.lenbits = 9, k.distcode = L, k.distbits = 5;
2300
- }
2301
- function Y(k, F, s, j) {
2302
- var Q, U = k.state;
2303
- return U.window === null && (U.wsize = 1 << U.wbits, U.wnext = 0, U.whave = 0, U.window = new n.Buf8(U.wsize)), j >= U.wsize ? (n.arraySet(U.window, F, s - U.wsize, U.wsize, 0), U.wnext = 0, U.whave = U.wsize) : (j < (Q = U.wsize - U.wnext) && (Q = j), n.arraySet(U.window, F, s - j, Q, U.wnext), (j -= Q) ? (n.arraySet(U.window, F, s - j, j, 0), U.wnext = j, U.whave = U.wsize) : (U.wnext += Q, U.wnext === U.wsize && (U.wnext = 0), U.whave < U.wsize && (U.whave += Q))), 0;
2304
- }
2305
- a.inflateReset = z, a.inflateReset2 = E, a.inflateResetKeep = S, a.inflateInit = function(k) {
2306
- return R(k, 15);
2307
- }, a.inflateInit2 = R, a.inflate = function(k, F) {
2308
- var s, j, Q, U, tt, M, q, O, I, J, G, X, st, lt, et, nt, ct, at, dt, ht, t, D, T, y, m = 0, C = new n.Buf8(4), N = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
2309
- if (!k || !k.state || !k.output || !k.input && k.avail_in !== 0) return u;
2310
- (s = k.state).mode === 12 && (s.mode = 13), tt = k.next_out, Q = k.output, q = k.avail_out, U = k.next_in, j = k.input, M = k.avail_in, O = s.hold, I = s.bits, J = M, G = q, D = x;
2311
- t: for (; ; ) switch (s.mode) {
2312
- case _:
2313
- if (s.wrap === 0) {
2314
- s.mode = 13;
2315
- break;
2316
- }
2317
- for (; I < 16; ) {
2318
- if (M === 0) break t;
2319
- M--, O += j[U++] << I, I += 8;
2320
- }
2321
- if (2 & s.wrap && O === 35615) {
2322
- C[s.check = 0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0), I = O = 0, s.mode = 2;
2323
- break;
2324
- }
2325
- if (s.flags = 0, s.head && (s.head.done = !1), !(1 & s.wrap) || (((255 & O) << 8) + (O >> 8)) % 31) {
2326
- k.msg = "incorrect header check", s.mode = 30;
2327
- break;
2328
- }
2329
- if ((15 & O) != 8) {
2330
- k.msg = "unknown compression method", s.mode = 30;
2331
- break;
2332
- }
2333
- if (I -= 4, t = 8 + (15 & (O >>>= 4)), s.wbits === 0) s.wbits = t;
2334
- else if (t > s.wbits) {
2335
- k.msg = "invalid window size", s.mode = 30;
2336
- break;
2337
- }
2338
- s.dmax = 1 << t, k.adler = s.check = 1, s.mode = 512 & O ? 10 : 12, I = O = 0;
2339
- break;
2340
- case 2:
2341
- for (; I < 16; ) {
2342
- if (M === 0) break t;
2343
- M--, O += j[U++] << I, I += 8;
2344
- }
2345
- if (s.flags = O, (255 & s.flags) != 8) {
2346
- k.msg = "unknown compression method", s.mode = 30;
2347
- break;
2348
- }
2349
- if (57344 & s.flags) {
2350
- k.msg = "unknown header flags set", s.mode = 30;
2351
- break;
2352
- }
2353
- s.head && (s.head.text = O >> 8 & 1), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0)), I = O = 0, s.mode = 3;
2354
- case 3:
2355
- for (; I < 32; ) {
2356
- if (M === 0) break t;
2357
- M--, O += j[U++] << I, I += 8;
2358
- }
2359
- s.head && (s.head.time = O), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, C[2] = O >>> 16 & 255, C[3] = O >>> 24 & 255, s.check = i(s.check, C, 4, 0)), I = O = 0, s.mode = 4;
2360
- case 4:
2361
- for (; I < 16; ) {
2362
- if (M === 0) break t;
2363
- M--, O += j[U++] << I, I += 8;
2364
- }
2365
- s.head && (s.head.xflags = 255 & O, s.head.os = O >> 8), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0)), I = O = 0, s.mode = 5;
2366
- case 5:
2367
- if (1024 & s.flags) {
2368
- for (; I < 16; ) {
2369
- if (M === 0) break t;
2370
- M--, O += j[U++] << I, I += 8;
2371
- }
2372
- s.length = O, s.head && (s.head.extra_len = O), 512 & s.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, s.check = i(s.check, C, 2, 0)), I = O = 0;
2373
- } else s.head && (s.head.extra = null);
2374
- s.mode = 6;
2375
- case 6:
2376
- if (1024 & s.flags && (M < (X = s.length) && (X = M), X && (s.head && (t = s.head.extra_len - s.length, s.head.extra || (s.head.extra = new Array(s.head.extra_len)), n.arraySet(s.head.extra, j, U, X, t)), 512 & s.flags && (s.check = i(s.check, j, X, U)), M -= X, U += X, s.length -= X), s.length)) break t;
2377
- s.length = 0, s.mode = 7;
2378
- case 7:
2379
- if (2048 & s.flags) {
2380
- if (M === 0) break t;
2381
- for (X = 0; t = j[U + X++], s.head && t && s.length < 65536 && (s.head.name += String.fromCharCode(t)), t && X < M; ) ;
2382
- if (512 & s.flags && (s.check = i(s.check, j, X, U)), M -= X, U += X, t) break t;
2383
- } else s.head && (s.head.name = null);
2384
- s.length = 0, s.mode = 8;
2385
- case 8:
2386
- if (4096 & s.flags) {
2387
- if (M === 0) break t;
2388
- for (X = 0; t = j[U + X++], s.head && t && s.length < 65536 && (s.head.comment += String.fromCharCode(t)), t && X < M; ) ;
2389
- if (512 & s.flags && (s.check = i(s.check, j, X, U)), M -= X, U += X, t) break t;
2390
- } else s.head && (s.head.comment = null);
2391
- s.mode = 9;
2392
- case 9:
2393
- if (512 & s.flags) {
2394
- for (; I < 16; ) {
2395
- if (M === 0) break t;
2396
- M--, O += j[U++] << I, I += 8;
2397
- }
2398
- if (O !== (65535 & s.check)) {
2399
- k.msg = "header crc mismatch", s.mode = 30;
2400
- break;
2401
- }
2402
- I = O = 0;
2403
- }
2404
- s.head && (s.head.hcrc = s.flags >> 9 & 1, s.head.done = !0), k.adler = s.check = 0, s.mode = 12;
2405
- break;
2406
- case 10:
2407
- for (; I < 32; ) {
2408
- if (M === 0) break t;
2409
- M--, O += j[U++] << I, I += 8;
2410
- }
2411
- k.adler = s.check = h(O), I = O = 0, s.mode = 11;
2412
- case 11:
2413
- if (s.havedict === 0) return k.next_out = tt, k.avail_out = q, k.next_in = U, k.avail_in = M, s.hold = O, s.bits = I, 2;
2414
- k.adler = s.check = 1, s.mode = 12;
2415
- case 12:
2416
- if (F === 5 || F === 6) break t;
2417
- case 13:
2418
- if (s.last) {
2419
- O >>>= 7 & I, I -= 7 & I, s.mode = 27;
2420
- break;
2421
- }
2422
- for (; I < 3; ) {
2423
- if (M === 0) break t;
2424
- M--, O += j[U++] << I, I += 8;
2425
- }
2426
- switch (s.last = 1 & O, I -= 1, 3 & (O >>>= 1)) {
2427
- case 0:
2428
- s.mode = 14;
2429
- break;
2430
- case 1:
2431
- if (W(s), s.mode = 20, F !== 6) break;
2432
- O >>>= 2, I -= 2;
2433
- break t;
2434
- case 2:
2435
- s.mode = 17;
2436
- break;
2437
- case 3:
2438
- k.msg = "invalid block type", s.mode = 30;
2439
- }
2440
- O >>>= 2, I -= 2;
2441
- break;
2442
- case 14:
2443
- for (O >>>= 7 & I, I -= 7 & I; I < 32; ) {
2444
- if (M === 0) break t;
2445
- M--, O += j[U++] << I, I += 8;
2446
- }
2447
- if ((65535 & O) != (O >>> 16 ^ 65535)) {
2448
- k.msg = "invalid stored block lengths", s.mode = 30;
2449
- break;
2450
- }
2451
- if (s.length = 65535 & O, I = O = 0, s.mode = 15, F === 6) break t;
2452
- case 15:
2453
- s.mode = 16;
2454
- case 16:
2455
- if (X = s.length) {
2456
- if (M < X && (X = M), q < X && (X = q), X === 0) break t;
2457
- n.arraySet(Q, j, U, X, tt), M -= X, U += X, q -= X, tt += X, s.length -= X;
2458
- break;
2459
- }
2460
- s.mode = 12;
2461
- break;
2462
- case 17:
2463
- for (; I < 14; ) {
2464
- if (M === 0) break t;
2465
- M--, O += j[U++] << I, I += 8;
2466
- }
2467
- if (s.nlen = 257 + (31 & O), O >>>= 5, I -= 5, s.ndist = 1 + (31 & O), O >>>= 5, I -= 5, s.ncode = 4 + (15 & O), O >>>= 4, I -= 4, 286 < s.nlen || 30 < s.ndist) {
2468
- k.msg = "too many length or distance symbols", s.mode = 30;
2469
- break;
2470
- }
2471
- s.have = 0, s.mode = 18;
2472
- case 18:
2473
- for (; s.have < s.ncode; ) {
2474
- for (; I < 3; ) {
2475
- if (M === 0) break t;
2476
- M--, O += j[U++] << I, I += 8;
2477
- }
2478
- s.lens[N[s.have++]] = 7 & O, O >>>= 3, I -= 3;
2479
- }
2480
- for (; s.have < 19; ) s.lens[N[s.have++]] = 0;
2481
- if (s.lencode = s.lendyn, s.lenbits = 7, T = { bits: s.lenbits }, D = p(0, s.lens, 0, 19, s.lencode, 0, s.work, T), s.lenbits = T.bits, D) {
2482
- k.msg = "invalid code lengths set", s.mode = 30;
2483
- break;
2484
- }
2485
- s.have = 0, s.mode = 19;
2486
- case 19:
2487
- for (; s.have < s.nlen + s.ndist; ) {
2488
- for (; nt = (m = s.lencode[O & (1 << s.lenbits) - 1]) >>> 16 & 255, ct = 65535 & m, !((et = m >>> 24) <= I); ) {
2489
- if (M === 0) break t;
2490
- M--, O += j[U++] << I, I += 8;
2491
- }
2492
- if (ct < 16) O >>>= et, I -= et, s.lens[s.have++] = ct;
2493
- else {
2494
- if (ct === 16) {
2495
- for (y = et + 2; I < y; ) {
2496
- if (M === 0) break t;
2497
- M--, O += j[U++] << I, I += 8;
2498
- }
2499
- if (O >>>= et, I -= et, s.have === 0) {
2500
- k.msg = "invalid bit length repeat", s.mode = 30;
2501
- break;
2502
- }
2503
- t = s.lens[s.have - 1], X = 3 + (3 & O), O >>>= 2, I -= 2;
2504
- } else if (ct === 17) {
2505
- for (y = et + 3; I < y; ) {
2506
- if (M === 0) break t;
2507
- M--, O += j[U++] << I, I += 8;
2508
- }
2509
- I -= et, t = 0, X = 3 + (7 & (O >>>= et)), O >>>= 3, I -= 3;
2510
- } else {
2511
- for (y = et + 7; I < y; ) {
2512
- if (M === 0) break t;
2513
- M--, O += j[U++] << I, I += 8;
2514
- }
2515
- I -= et, t = 0, X = 11 + (127 & (O >>>= et)), O >>>= 7, I -= 7;
2516
- }
2517
- if (s.have + X > s.nlen + s.ndist) {
2518
- k.msg = "invalid bit length repeat", s.mode = 30;
2519
- break;
2520
- }
2521
- for (; X--; ) s.lens[s.have++] = t;
2522
- }
2523
- }
2524
- if (s.mode === 30) break;
2525
- if (s.lens[256] === 0) {
2526
- k.msg = "invalid code -- missing end-of-block", s.mode = 30;
2527
- break;
2528
- }
2529
- if (s.lenbits = 9, T = { bits: s.lenbits }, D = p(w, s.lens, 0, s.nlen, s.lencode, 0, s.work, T), s.lenbits = T.bits, D) {
2530
- k.msg = "invalid literal/lengths set", s.mode = 30;
2531
- break;
2532
- }
2533
- if (s.distbits = 6, s.distcode = s.distdyn, T = { bits: s.distbits }, D = p(v, s.lens, s.nlen, s.ndist, s.distcode, 0, s.work, T), s.distbits = T.bits, D) {
2534
- k.msg = "invalid distances set", s.mode = 30;
2535
- break;
2536
- }
2537
- if (s.mode = 20, F === 6) break t;
2538
- case 20:
2539
- s.mode = 21;
2540
- case 21:
2541
- if (6 <= M && 258 <= q) {
2542
- k.next_out = tt, k.avail_out = q, k.next_in = U, k.avail_in = M, s.hold = O, s.bits = I, l(k, G), tt = k.next_out, Q = k.output, q = k.avail_out, U = k.next_in, j = k.input, M = k.avail_in, O = s.hold, I = s.bits, s.mode === 12 && (s.back = -1);
2543
- break;
2544
- }
2545
- for (s.back = 0; nt = (m = s.lencode[O & (1 << s.lenbits) - 1]) >>> 16 & 255, ct = 65535 & m, !((et = m >>> 24) <= I); ) {
2546
- if (M === 0) break t;
2547
- M--, O += j[U++] << I, I += 8;
2548
- }
2549
- if (nt && (240 & nt) == 0) {
2550
- for (at = et, dt = nt, ht = ct; nt = (m = s.lencode[ht + ((O & (1 << at + dt) - 1) >> at)]) >>> 16 & 255, ct = 65535 & m, !(at + (et = m >>> 24) <= I); ) {
2551
- if (M === 0) break t;
2552
- M--, O += j[U++] << I, I += 8;
2553
- }
2554
- O >>>= at, I -= at, s.back += at;
2555
- }
2556
- if (O >>>= et, I -= et, s.back += et, s.length = ct, nt === 0) {
2557
- s.mode = 26;
2558
- break;
2559
- }
2560
- if (32 & nt) {
2561
- s.back = -1, s.mode = 12;
2562
- break;
2563
- }
2564
- if (64 & nt) {
2565
- k.msg = "invalid literal/length code", s.mode = 30;
2566
- break;
2567
- }
2568
- s.extra = 15 & nt, s.mode = 22;
2569
- case 22:
2570
- if (s.extra) {
2571
- for (y = s.extra; I < y; ) {
2572
- if (M === 0) break t;
2573
- M--, O += j[U++] << I, I += 8;
2574
- }
2575
- s.length += O & (1 << s.extra) - 1, O >>>= s.extra, I -= s.extra, s.back += s.extra;
2576
- }
2577
- s.was = s.length, s.mode = 23;
2578
- case 23:
2579
- for (; nt = (m = s.distcode[O & (1 << s.distbits) - 1]) >>> 16 & 255, ct = 65535 & m, !((et = m >>> 24) <= I); ) {
2580
- if (M === 0) break t;
2581
- M--, O += j[U++] << I, I += 8;
2582
- }
2583
- if ((240 & nt) == 0) {
2584
- for (at = et, dt = nt, ht = ct; nt = (m = s.distcode[ht + ((O & (1 << at + dt) - 1) >> at)]) >>> 16 & 255, ct = 65535 & m, !(at + (et = m >>> 24) <= I); ) {
2585
- if (M === 0) break t;
2586
- M--, O += j[U++] << I, I += 8;
2587
- }
2588
- O >>>= at, I -= at, s.back += at;
2589
- }
2590
- if (O >>>= et, I -= et, s.back += et, 64 & nt) {
2591
- k.msg = "invalid distance code", s.mode = 30;
2592
- break;
2593
- }
2594
- s.offset = ct, s.extra = 15 & nt, s.mode = 24;
2595
- case 24:
2596
- if (s.extra) {
2597
- for (y = s.extra; I < y; ) {
2598
- if (M === 0) break t;
2599
- M--, O += j[U++] << I, I += 8;
2600
- }
2601
- s.offset += O & (1 << s.extra) - 1, O >>>= s.extra, I -= s.extra, s.back += s.extra;
2602
- }
2603
- if (s.offset > s.dmax) {
2604
- k.msg = "invalid distance too far back", s.mode = 30;
2605
- break;
2606
- }
2607
- s.mode = 25;
2608
- case 25:
2609
- if (q === 0) break t;
2610
- if (X = G - q, s.offset > X) {
2611
- if ((X = s.offset - X) > s.whave && s.sane) {
2612
- k.msg = "invalid distance too far back", s.mode = 30;
2613
- break;
2614
- }
2615
- st = X > s.wnext ? (X -= s.wnext, s.wsize - X) : s.wnext - X, X > s.length && (X = s.length), lt = s.window;
2616
- } else lt = Q, st = tt - s.offset, X = s.length;
2617
- for (q < X && (X = q), q -= X, s.length -= X; Q[tt++] = lt[st++], --X; ) ;
2618
- s.length === 0 && (s.mode = 21);
2619
- break;
2620
- case 26:
2621
- if (q === 0) break t;
2622
- Q[tt++] = s.length, q--, s.mode = 21;
2623
- break;
2624
- case 27:
2625
- if (s.wrap) {
2626
- for (; I < 32; ) {
2627
- if (M === 0) break t;
2628
- M--, O |= j[U++] << I, I += 8;
2629
- }
2630
- if (G -= q, k.total_out += G, s.total += G, G && (k.adler = s.check = s.flags ? i(s.check, Q, G, tt - G) : r(s.check, Q, G, tt - G)), G = q, (s.flags ? O : h(O)) !== s.check) {
2631
- k.msg = "incorrect data check", s.mode = 30;
2632
- break;
2633
- }
2634
- I = O = 0;
2635
- }
2636
- s.mode = 28;
2637
- case 28:
2638
- if (s.wrap && s.flags) {
2639
- for (; I < 32; ) {
2640
- if (M === 0) break t;
2641
- M--, O += j[U++] << I, I += 8;
2642
- }
2643
- if (O !== (4294967295 & s.total)) {
2644
- k.msg = "incorrect length check", s.mode = 30;
2645
- break;
2646
- }
2647
- I = O = 0;
2648
- }
2649
- s.mode = 29;
2650
- case 29:
2651
- D = 1;
2652
- break t;
2653
- case 30:
2654
- D = -3;
2655
- break t;
2656
- case 31:
2657
- return -4;
2658
- default:
2659
- return u;
2660
- }
2661
- return k.next_out = tt, k.avail_out = q, k.next_in = U, k.avail_in = M, s.hold = O, s.bits = I, (s.wsize || G !== k.avail_out && s.mode < 30 && (s.mode < 27 || F !== 4)) && Y(k, k.output, k.next_out, G - k.avail_out) ? (s.mode = 31, -4) : (J -= k.avail_in, G -= k.avail_out, k.total_in += J, k.total_out += G, s.total += G, s.wrap && G && (k.adler = s.check = s.flags ? i(s.check, Q, G, k.next_out - G) : r(s.check, Q, G, k.next_out - G)), k.data_type = s.bits + (s.last ? 64 : 0) + (s.mode === 12 ? 128 : 0) + (s.mode === 20 || s.mode === 15 ? 256 : 0), (J == 0 && G === 0 || F === 4) && D === x && (D = -5), D);
2662
- }, a.inflateEnd = function(k) {
2663
- if (!k || !k.state) return u;
2664
- var F = k.state;
2665
- return F.window && (F.window = null), k.state = null, x;
2666
- }, a.inflateGetHeader = function(k, F) {
2667
- var s;
2668
- return k && k.state ? (2 & (s = k.state).wrap) == 0 ? u : ((s.head = F).done = !1, x) : u;
2669
- }, a.inflateSetDictionary = function(k, F) {
2670
- var s, j = F.length;
2671
- return k && k.state ? (s = k.state).wrap !== 0 && s.mode !== 11 ? u : s.mode === 11 && r(1, F, j, 0) !== s.check ? -3 : Y(k, F, j, j) ? (s.mode = 31, -4) : (s.havedict = 1, x) : u;
2672
- }, a.inflateInfo = "pako inflate (from Nodeca project)";
2673
- }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, f, a) {
2674
- var n = e("../utils/common"), r = [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], i = [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], l = [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], p = [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];
2675
- f.exports = function(w, v, x, u, _, o, g, h) {
2676
- var b, S, z, E, R, B, L, P, W, Y = h.bits, k = 0, F = 0, s = 0, j = 0, Q = 0, U = 0, tt = 0, M = 0, q = 0, O = 0, I = null, J = 0, G = new n.Buf16(16), X = new n.Buf16(16), st = null, lt = 0;
2677
- for (k = 0; k <= 15; k++) G[k] = 0;
2678
- for (F = 0; F < u; F++) G[v[x + F]]++;
2679
- for (Q = Y, j = 15; 1 <= j && G[j] === 0; j--) ;
2680
- if (j < Q && (Q = j), j === 0) return _[o++] = 20971520, _[o++] = 20971520, h.bits = 1, 0;
2681
- for (s = 1; s < j && G[s] === 0; s++) ;
2682
- for (Q < s && (Q = s), k = M = 1; k <= 15; k++) if (M <<= 1, (M -= G[k]) < 0) return -1;
2683
- if (0 < M && (w === 0 || j !== 1)) return -1;
2684
- for (X[1] = 0, k = 1; k < 15; k++) X[k + 1] = X[k] + G[k];
2685
- for (F = 0; F < u; F++) v[x + F] !== 0 && (g[X[v[x + F]]++] = F);
2686
- if (B = w === 0 ? (I = st = g, 19) : w === 1 ? (I = r, J -= 257, st = i, lt -= 257, 256) : (I = l, st = p, -1), k = s, R = o, tt = F = O = 0, z = -1, E = (q = 1 << (U = Q)) - 1, w === 1 && 852 < q || w === 2 && 592 < q) return 1;
2687
- for (; ; ) {
2688
- for (L = k - tt, W = g[F] < B ? (P = 0, g[F]) : g[F] > B ? (P = st[lt + g[F]], I[J + g[F]]) : (P = 96, 0), b = 1 << k - tt, s = S = 1 << U; _[R + (O >> tt) + (S -= b)] = L << 24 | P << 16 | W | 0, S !== 0; ) ;
2689
- for (b = 1 << k - 1; O & b; ) b >>= 1;
2690
- if (b !== 0 ? (O &= b - 1, O += b) : O = 0, F++, --G[k] == 0) {
2691
- if (k === j) break;
2692
- k = v[x + g[F]];
2693
- }
2694
- if (Q < k && (O & E) !== z) {
2695
- for (tt === 0 && (tt = Q), R += s, M = 1 << (U = k - tt); U + tt < j && !((M -= G[U + tt]) <= 0); ) U++, M <<= 1;
2696
- if (q += 1 << U, w === 1 && 852 < q || w === 2 && 592 < q) return 1;
2697
- _[z = O & E] = Q << 24 | U << 16 | R - o | 0;
2698
- }
2699
- }
2700
- return O !== 0 && (_[R + O] = k - tt << 24 | 64 << 16 | 0), h.bits = Q, 0;
2701
- };
2702
- }, { "../utils/common": 41 }], 51: [function(e, f, a) {
2703
- f.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" };
2704
- }, {}], 52: [function(e, f, a) {
2705
- var n = e("../utils/common"), r = 0, i = 1;
2706
- function l(m) {
2707
- for (var C = m.length; 0 <= --C; ) m[C] = 0;
2708
- }
2709
- var p = 0, w = 29, v = 256, x = v + 1 + w, u = 30, _ = 19, o = 2 * x + 1, g = 15, h = 16, b = 7, S = 256, z = 16, E = 17, R = 18, B = [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], L = [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], P = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], W = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], Y = new Array(2 * (x + 2));
2710
- l(Y);
2711
- var k = new Array(2 * u);
2712
- l(k);
2713
- var F = new Array(512);
2714
- l(F);
2715
- var s = new Array(256);
2716
- l(s);
2717
- var j = new Array(w);
2718
- l(j);
2719
- var Q, U, tt, M = new Array(u);
2720
- function q(m, C, N, $, A) {
2721
- this.static_tree = m, this.extra_bits = C, this.extra_base = N, this.elems = $, this.max_length = A, this.has_stree = m && m.length;
2722
- }
2723
- function O(m, C) {
2724
- this.dyn_tree = m, this.max_code = 0, this.stat_desc = C;
2725
- }
2726
- function I(m) {
2727
- return m < 256 ? F[m] : F[256 + (m >>> 7)];
2728
- }
2729
- function J(m, C) {
2730
- m.pending_buf[m.pending++] = 255 & C, m.pending_buf[m.pending++] = C >>> 8 & 255;
2731
- }
2732
- function G(m, C, N) {
2733
- m.bi_valid > h - N ? (m.bi_buf |= C << m.bi_valid & 65535, J(m, m.bi_buf), m.bi_buf = C >> h - m.bi_valid, m.bi_valid += N - h) : (m.bi_buf |= C << m.bi_valid & 65535, m.bi_valid += N);
2734
- }
2735
- function X(m, C, N) {
2736
- G(m, N[2 * C], N[2 * C + 1]);
2737
- }
2738
- function st(m, C) {
2739
- for (var N = 0; N |= 1 & m, m >>>= 1, N <<= 1, 0 < --C; ) ;
2740
- return N >>> 1;
2741
- }
2742
- function lt(m, C, N) {
2743
- var $, A, Z = new Array(g + 1), K = 0;
2744
- for ($ = 1; $ <= g; $++) Z[$] = K = K + N[$ - 1] << 1;
2745
- for (A = 0; A <= C; A++) {
2746
- var H = m[2 * A + 1];
2747
- H !== 0 && (m[2 * A] = st(Z[H]++, H));
2748
- }
2749
- }
2750
- function et(m) {
2751
- var C;
2752
- for (C = 0; C < x; C++) m.dyn_ltree[2 * C] = 0;
2753
- for (C = 0; C < u; C++) m.dyn_dtree[2 * C] = 0;
2754
- for (C = 0; C < _; C++) m.bl_tree[2 * C] = 0;
2755
- m.dyn_ltree[2 * S] = 1, m.opt_len = m.static_len = 0, m.last_lit = m.matches = 0;
2756
- }
2757
- function nt(m) {
2758
- 8 < m.bi_valid ? J(m, m.bi_buf) : 0 < m.bi_valid && (m.pending_buf[m.pending++] = m.bi_buf), m.bi_buf = 0, m.bi_valid = 0;
2759
- }
2760
- function ct(m, C, N, $) {
2761
- var A = 2 * C, Z = 2 * N;
2762
- return m[A] < m[Z] || m[A] === m[Z] && $[C] <= $[N];
2763
- }
2764
- function at(m, C, N) {
2765
- for (var $ = m.heap[N], A = N << 1; A <= m.heap_len && (A < m.heap_len && ct(C, m.heap[A + 1], m.heap[A], m.depth) && A++, !ct(C, $, m.heap[A], m.depth)); ) m.heap[N] = m.heap[A], N = A, A <<= 1;
2766
- m.heap[N] = $;
2767
- }
2768
- function dt(m, C, N) {
2769
- var $, A, Z, K, H = 0;
2770
- if (m.last_lit !== 0) for (; $ = m.pending_buf[m.d_buf + 2 * H] << 8 | m.pending_buf[m.d_buf + 2 * H + 1], A = m.pending_buf[m.l_buf + H], H++, $ === 0 ? X(m, A, C) : (X(m, (Z = s[A]) + v + 1, C), (K = B[Z]) !== 0 && G(m, A -= j[Z], K), X(m, Z = I(--$), N), (K = L[Z]) !== 0 && G(m, $ -= M[Z], K)), H < m.last_lit; ) ;
2771
- X(m, S, C);
2772
- }
2773
- function ht(m, C) {
2774
- var N, $, A, Z = C.dyn_tree, K = C.stat_desc.static_tree, H = C.stat_desc.has_stree, V = C.stat_desc.elems, it = -1;
2775
- for (m.heap_len = 0, m.heap_max = o, N = 0; N < V; N++) Z[2 * N] !== 0 ? (m.heap[++m.heap_len] = it = N, m.depth[N] = 0) : Z[2 * N + 1] = 0;
2776
- for (; m.heap_len < 2; ) Z[2 * (A = m.heap[++m.heap_len] = it < 2 ? ++it : 0)] = 1, m.depth[A] = 0, m.opt_len--, H && (m.static_len -= K[2 * A + 1]);
2777
- for (C.max_code = it, N = m.heap_len >> 1; 1 <= N; N--) at(m, Z, N);
2778
- for (A = V; N = m.heap[1], m.heap[1] = m.heap[m.heap_len--], at(m, Z, 1), $ = m.heap[1], m.heap[--m.heap_max] = N, m.heap[--m.heap_max] = $, Z[2 * A] = Z[2 * N] + Z[2 * $], m.depth[A] = (m.depth[N] >= m.depth[$] ? m.depth[N] : m.depth[$]) + 1, Z[2 * N + 1] = Z[2 * $ + 1] = A, m.heap[1] = A++, at(m, Z, 1), 2 <= m.heap_len; ) ;
2779
- m.heap[--m.heap_max] = m.heap[1], (function(rt, ft) {
2780
- var bt, pt, yt, ot, kt, It, mt = ft.dyn_tree, Ut = ft.max_code, he = ft.stat_desc.static_tree, de = ft.stat_desc.has_stree, pe = ft.stat_desc.extra_bits, Wt = ft.stat_desc.extra_base, vt = ft.stat_desc.max_length, St = 0;
2781
- for (ot = 0; ot <= g; ot++) rt.bl_count[ot] = 0;
2782
- for (mt[2 * rt.heap[rt.heap_max] + 1] = 0, bt = rt.heap_max + 1; bt < o; bt++) vt < (ot = mt[2 * mt[2 * (pt = rt.heap[bt]) + 1] + 1] + 1) && (ot = vt, St++), mt[2 * pt + 1] = ot, Ut < pt || (rt.bl_count[ot]++, kt = 0, Wt <= pt && (kt = pe[pt - Wt]), It = mt[2 * pt], rt.opt_len += It * (ot + kt), de && (rt.static_len += It * (he[2 * pt + 1] + kt)));
2783
- if (St !== 0) {
2784
- do {
2785
- for (ot = vt - 1; rt.bl_count[ot] === 0; ) ot--;
2786
- rt.bl_count[ot]--, rt.bl_count[ot + 1] += 2, rt.bl_count[vt]--, St -= 2;
2787
- } while (0 < St);
2788
- for (ot = vt; ot !== 0; ot--) for (pt = rt.bl_count[ot]; pt !== 0; ) Ut < (yt = rt.heap[--bt]) || (mt[2 * yt + 1] !== ot && (rt.opt_len += (ot - mt[2 * yt + 1]) * mt[2 * yt], mt[2 * yt + 1] = ot), pt--);
2789
- }
2790
- })(m, C), lt(Z, it, m.bl_count);
2791
- }
2792
- function t(m, C, N) {
2793
- var $, A, Z = -1, K = C[1], H = 0, V = 7, it = 4;
2794
- for (K === 0 && (V = 138, it = 3), C[2 * (N + 1) + 1] = 65535, $ = 0; $ <= N; $++) A = K, K = C[2 * ($ + 1) + 1], ++H < V && A === K || (H < it ? m.bl_tree[2 * A] += H : A !== 0 ? (A !== Z && m.bl_tree[2 * A]++, m.bl_tree[2 * z]++) : H <= 10 ? m.bl_tree[2 * E]++ : m.bl_tree[2 * R]++, Z = A, it = (H = 0) === K ? (V = 138, 3) : A === K ? (V = 6, 3) : (V = 7, 4));
2795
- }
2796
- function D(m, C, N) {
2797
- var $, A, Z = -1, K = C[1], H = 0, V = 7, it = 4;
2798
- for (K === 0 && (V = 138, it = 3), $ = 0; $ <= N; $++) if (A = K, K = C[2 * ($ + 1) + 1], !(++H < V && A === K)) {
2799
- if (H < it) for (; X(m, A, m.bl_tree), --H != 0; ) ;
2800
- else A !== 0 ? (A !== Z && (X(m, A, m.bl_tree), H--), X(m, z, m.bl_tree), G(m, H - 3, 2)) : H <= 10 ? (X(m, E, m.bl_tree), G(m, H - 3, 3)) : (X(m, R, m.bl_tree), G(m, H - 11, 7));
2801
- Z = A, it = (H = 0) === K ? (V = 138, 3) : A === K ? (V = 6, 3) : (V = 7, 4);
2802
- }
2803
- }
2804
- l(M);
2805
- var T = !1;
2806
- function y(m, C, N, $) {
2807
- G(m, (p << 1) + ($ ? 1 : 0), 3), (function(A, Z, K, H) {
2808
- nt(A), J(A, K), J(A, ~K), n.arraySet(A.pending_buf, A.window, Z, K, A.pending), A.pending += K;
2809
- })(m, C, N);
2810
- }
2811
- a._tr_init = function(m) {
2812
- T || ((function() {
2813
- var C, N, $, A, Z, K = new Array(g + 1);
2814
- for (A = $ = 0; A < w - 1; A++) for (j[A] = $, C = 0; C < 1 << B[A]; C++) s[$++] = A;
2815
- for (s[$ - 1] = A, A = Z = 0; A < 16; A++) for (M[A] = Z, C = 0; C < 1 << L[A]; C++) F[Z++] = A;
2816
- for (Z >>= 7; A < u; A++) for (M[A] = Z << 7, C = 0; C < 1 << L[A] - 7; C++) F[256 + Z++] = A;
2817
- for (N = 0; N <= g; N++) K[N] = 0;
2818
- for (C = 0; C <= 143; ) Y[2 * C + 1] = 8, C++, K[8]++;
2819
- for (; C <= 255; ) Y[2 * C + 1] = 9, C++, K[9]++;
2820
- for (; C <= 279; ) Y[2 * C + 1] = 7, C++, K[7]++;
2821
- for (; C <= 287; ) Y[2 * C + 1] = 8, C++, K[8]++;
2822
- for (lt(Y, x + 1, K), C = 0; C < u; C++) k[2 * C + 1] = 5, k[2 * C] = st(C, 5);
2823
- Q = new q(Y, B, v + 1, x, g), U = new q(k, L, 0, u, g), tt = new q(new Array(0), P, 0, _, b);
2824
- })(), T = !0), m.l_desc = new O(m.dyn_ltree, Q), m.d_desc = new O(m.dyn_dtree, U), m.bl_desc = new O(m.bl_tree, tt), m.bi_buf = 0, m.bi_valid = 0, et(m);
2825
- }, a._tr_stored_block = y, a._tr_flush_block = function(m, C, N, $) {
2826
- var A, Z, K = 0;
2827
- 0 < m.level ? (m.strm.data_type === 2 && (m.strm.data_type = (function(H) {
2828
- var V, it = 4093624447;
2829
- for (V = 0; V <= 31; V++, it >>>= 1) if (1 & it && H.dyn_ltree[2 * V] !== 0) return r;
2830
- if (H.dyn_ltree[18] !== 0 || H.dyn_ltree[20] !== 0 || H.dyn_ltree[26] !== 0) return i;
2831
- for (V = 32; V < v; V++) if (H.dyn_ltree[2 * V] !== 0) return i;
2832
- return r;
2833
- })(m)), ht(m, m.l_desc), ht(m, m.d_desc), K = (function(H) {
2834
- var V;
2835
- for (t(H, H.dyn_ltree, H.l_desc.max_code), t(H, H.dyn_dtree, H.d_desc.max_code), ht(H, H.bl_desc), V = _ - 1; 3 <= V && H.bl_tree[2 * W[V] + 1] === 0; V--) ;
2836
- return H.opt_len += 3 * (V + 1) + 5 + 5 + 4, V;
2837
- })(m), A = m.opt_len + 3 + 7 >>> 3, (Z = m.static_len + 3 + 7 >>> 3) <= A && (A = Z)) : A = Z = N + 5, N + 4 <= A && C !== -1 ? y(m, C, N, $) : m.strategy === 4 || Z === A ? (G(m, 2 + ($ ? 1 : 0), 3), dt(m, Y, k)) : (G(m, 4 + ($ ? 1 : 0), 3), (function(H, V, it, rt) {
2838
- var ft;
2839
- for (G(H, V - 257, 5), G(H, it - 1, 5), G(H, rt - 4, 4), ft = 0; ft < rt; ft++) G(H, H.bl_tree[2 * W[ft] + 1], 3);
2840
- D(H, H.dyn_ltree, V - 1), D(H, H.dyn_dtree, it - 1);
2841
- })(m, m.l_desc.max_code + 1, m.d_desc.max_code + 1, K + 1), dt(m, m.dyn_ltree, m.dyn_dtree)), et(m), $ && nt(m);
2842
- }, a._tr_tally = function(m, C, N) {
2843
- return m.pending_buf[m.d_buf + 2 * m.last_lit] = C >>> 8 & 255, m.pending_buf[m.d_buf + 2 * m.last_lit + 1] = 255 & C, m.pending_buf[m.l_buf + m.last_lit] = 255 & N, m.last_lit++, C === 0 ? m.dyn_ltree[2 * N]++ : (m.matches++, C--, m.dyn_ltree[2 * (s[N] + v + 1)]++, m.dyn_dtree[2 * I(C)]++), m.last_lit === m.lit_bufsize - 1;
2844
- }, a._tr_align = function(m) {
2845
- G(m, 2, 3), X(m, S, Y), (function(C) {
2846
- C.bi_valid === 16 ? (J(C, C.bi_buf), C.bi_buf = 0, C.bi_valid = 0) : 8 <= C.bi_valid && (C.pending_buf[C.pending++] = 255 & C.bi_buf, C.bi_buf >>= 8, C.bi_valid -= 8);
2847
- })(m);
2848
- };
2849
- }, { "../utils/common": 41 }], 53: [function(e, f, a) {
2850
- f.exports = function() {
2851
- 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;
2852
- };
2853
- }, {}], 54: [function(e, f, a) {
2854
- (function(n) {
2855
- (function(r, i) {
2856
- if (!r.setImmediate) {
2857
- var l, p, w, v, x = 1, u = {}, _ = !1, o = r.document, g = Object.getPrototypeOf && Object.getPrototypeOf(r);
2858
- g = g && g.setTimeout ? g : r, l = {}.toString.call(r.process) === "[object process]" ? function(z) {
2859
- process.nextTick(function() {
2860
- b(z);
2861
- });
2862
- } : (function() {
2863
- if (r.postMessage && !r.importScripts) {
2864
- var z = !0, E = r.onmessage;
2865
- return r.onmessage = function() {
2866
- z = !1;
2867
- }, r.postMessage("", "*"), r.onmessage = E, z;
2868
- }
2869
- })() ? (v = "setImmediate$" + Math.random() + "$", r.addEventListener ? r.addEventListener("message", S, !1) : r.attachEvent("onmessage", S), function(z) {
2870
- r.postMessage(v + z, "*");
2871
- }) : r.MessageChannel ? ((w = new MessageChannel()).port1.onmessage = function(z) {
2872
- b(z.data);
2873
- }, function(z) {
2874
- w.port2.postMessage(z);
2875
- }) : o && "onreadystatechange" in o.createElement("script") ? (p = o.documentElement, function(z) {
2876
- var E = o.createElement("script");
2877
- E.onreadystatechange = function() {
2878
- b(z), E.onreadystatechange = null, p.removeChild(E), E = null;
2879
- }, p.appendChild(E);
2880
- }) : function(z) {
2881
- setTimeout(b, 0, z);
2882
- }, g.setImmediate = function(z) {
2883
- typeof z != "function" && (z = new Function("" + z));
2884
- for (var E = new Array(arguments.length - 1), R = 0; R < E.length; R++) E[R] = arguments[R + 1];
2885
- var B = { callback: z, args: E };
2886
- return u[x] = B, l(x), x++;
2887
- }, g.clearImmediate = h;
2888
- }
2889
- function h(z) {
2890
- delete u[z];
2891
- }
2892
- function b(z) {
2893
- if (_) setTimeout(b, 0, z);
2894
- else {
2895
- var E = u[z];
2896
- if (E) {
2897
- _ = !0;
2898
- try {
2899
- (function(R) {
2900
- var B = R.callback, L = R.args;
2901
- switch (L.length) {
2902
- case 0:
2903
- B();
2904
- break;
2905
- case 1:
2906
- B(L[0]);
2907
- break;
2908
- case 2:
2909
- B(L[0], L[1]);
2910
- break;
2911
- case 3:
2912
- B(L[0], L[1], L[2]);
2913
- break;
2914
- default:
2915
- B.apply(i, L);
2916
- }
2917
- })(E);
2918
- } finally {
2919
- h(z), _ = !1;
2920
- }
2921
- }
2922
- }
2923
- }
2924
- function S(z) {
2925
- z.source === r && typeof z.data == "string" && z.data.indexOf(v) === 0 && b(+z.data.slice(v.length));
2926
- }
2927
- })(typeof self > "u" ? n === void 0 ? this : n : self);
2928
- }).call(this, typeof zt < "u" ? zt : typeof self < "u" ? self : typeof window < "u" ? window : {});
2929
- }, {}] }, {}, [10])(10);
2930
- });
2931
- })(Ot)), Ot.exports;
2932
- }
2933
- var qe = Je();
2934
- const Qe = /* @__PURE__ */ Ve(qe), tr = /<xi:include\b[^>]*\bhref\s*=\s*(?:"([^"]+)"|'([^']+)')[^>]*\/>/g;
2935
- function er(d) {
2936
- const c = d.lastIndexOf("/");
2937
- return c >= 0 ? d.slice(0, c) : "";
2938
- }
2939
- function rr(d) {
2940
- return d.replace(/\\/g, "/").replace(/^\.\//, "");
2941
- }
2942
- function nr(d, c, e) {
2943
- const f = er(c), a = [
2944
- d,
2945
- `${d}.ptx`,
2946
- `${d}.xml`,
2947
- f ? `${f}/${d}` : null,
2948
- f ? `${f}/${d}.ptx` : `${d}.ptx`,
2949
- f ? `${f}/${d}.xml` : `${d}.xml`
2950
- ].filter((n) => n !== null);
2951
- for (const n of a) {
2952
- const r = rr(n);
2953
- if (r in e)
2954
- return r;
2955
- }
2956
- return null;
2957
- }
2958
- function ir(d) {
2959
- return d.replace(/^\s*<\?xml[^?]*\?>\s*/, "");
2960
- }
2961
- function sr(d, c, e, f = 5) {
2962
- let a = 0;
2963
- const n = [], r = [], i = (p, w) => {
2964
- let v = !1;
2965
- return { output: p.replace(
2966
- tr,
2967
- (u, _, o) => {
2968
- const g = _ ?? o ?? "", h = nr(g, w, e);
2969
- return h ? r.includes(h) ? u : (v = !0, a += 1, ir(e[h])) : (n.includes(g) || n.push(g), u);
2970
- }
2971
- ), changed: v };
2972
- };
2973
- let l = d;
2974
- for (let p = 0; p < f; p += 1) {
2975
- r.push(c);
2976
- const { output: w, changed: v } = i(l, c);
2977
- if (r.pop(), l = w, !v)
2978
- break;
2979
- }
2980
- return {
2981
- expandedText: l,
2982
- expandedCount: a,
2983
- missingIncludes: n
2984
- };
2985
- }
2986
- const ar = /<(pretext|book|article)\b/;
2987
- function or(d) {
2988
- const c = Object.keys(d).filter((f) => /\.(ptx|xml)$/i.test(f)).sort();
2989
- return c.length === 0 ? null : c.find((f) => ar.test(d[f])) ?? c[0];
2990
- }
2991
- const Vt = /([a-zA-Z_:][\w:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
2992
- function At(d) {
2993
- const c = {};
2994
- let e;
2995
- for (Vt.lastIndex = 0; (e = Vt.exec(d)) !== null; )
2996
- c[e[1]] = e[2] ?? e[3] ?? "";
2997
- return c;
2998
- }
2999
- function ce(d) {
3000
- const c = [];
3001
- let e = 0;
3002
- const f = d.length;
3003
- for (; e < f; ) {
3004
- const a = d.indexOf("<", e);
3005
- if (a < 0) break;
3006
- if (d.startsWith("<!--", a)) {
3007
- const o = d.indexOf("-->", a + 4);
3008
- e = o < 0 ? f : o + 3;
3009
- continue;
3010
- }
3011
- if (d.startsWith("<![CDATA[", a)) {
3012
- const o = d.indexOf("]]>", a + 9);
3013
- e = o < 0 ? f : o + 3;
3014
- continue;
3015
- }
3016
- if (d.startsWith("<?", a)) {
3017
- const o = d.indexOf("?>", a + 2);
3018
- e = o < 0 ? f : o + 2;
3019
- continue;
3020
- }
3021
- if (d.startsWith("<!", a)) {
3022
- const o = d.indexOf(">", a + 2);
3023
- e = o < 0 ? f : o + 1;
3024
- continue;
3025
- }
3026
- let n = a + 1, r = !1;
3027
- d[n] === "/" && (r = !0, n += 1);
3028
- const i = /^[a-zA-Z_:][\w:.-]*/.exec(d.slice(n));
3029
- if (!i) {
3030
- e = a + 1;
3031
- continue;
3032
- }
3033
- const l = i[0];
3034
- n += l.length;
3035
- let p = n, w = null;
3036
- for (; n < f; ) {
3037
- const o = d[n];
3038
- if (w) {
3039
- o === w && (w = null), n += 1;
3040
- continue;
3041
- }
3042
- if (o === '"' || o === "'") {
3043
- w = o, n += 1;
3044
- continue;
3045
- }
3046
- if (o === ">")
3047
- break;
3048
- n += 1;
3049
- }
3050
- if (n >= f) break;
3051
- const v = n + 1, x = d.slice(p, n), u = !r && x.trimEnd().endsWith("/"), _ = u ? x.replace(/\/\s*$/, "") : x;
3052
- r ? c.push({ kind: "close", name: l, pos: a, end: v }) : u ? c.push({ kind: "selfclose", name: l, attrs: _, pos: a, end: v }) : c.push({ kind: "open", name: l, attrs: _, pos: a, end: v }), e = v;
3053
- }
3054
- return c;
3055
- }
3056
- function Nt(d, c) {
3057
- const e = ce(d), f = [];
3058
- let a = 0, n = null;
3059
- for (const r of e) {
3060
- if (r.kind === "selfclose") {
3061
- a === 0 && r.name === c && f.push({
3062
- name: c,
3063
- start: r.pos,
3064
- startTagEnd: r.end,
3065
- contentEnd: r.end,
3066
- end: r.end,
3067
- inner: "",
3068
- outer: d.slice(r.pos, r.end),
3069
- attributes: At(r.attrs)
3070
- });
3071
- continue;
3072
- }
3073
- if (r.kind === "open") {
3074
- a === 0 && r.name === c && !n && (n = r), a += 1;
3075
- continue;
3076
- }
3077
- a -= 1, a < 0 && (a = 0), n && a === 0 && r.name === c && (f.push({
3078
- name: c,
3079
- start: n.pos,
3080
- startTagEnd: n.end,
3081
- contentEnd: r.pos,
3082
- end: r.end,
3083
- inner: d.slice(n.end, r.pos),
3084
- outer: d.slice(n.pos, r.end),
3085
- attributes: At(n.attrs)
3086
- }), n = null);
3087
- }
3088
- return f;
3089
- }
3090
- function wt(d, c) {
3091
- return Nt(d, c)[0] ?? null;
3092
- }
3093
- function Ct(d, c) {
3094
- const e = ce(d);
3095
- let f = 0, a = null, n = -1;
3096
- for (const r of e) {
3097
- if (r.kind === "selfclose") {
3098
- if (!a && r.name === c)
3099
- return {
3100
- name: c,
3101
- start: r.pos,
3102
- startTagEnd: r.end,
3103
- contentEnd: r.end,
3104
- end: r.end,
3105
- inner: "",
3106
- outer: d.slice(r.pos, r.end),
3107
- attributes: At(r.attrs)
3108
- };
3109
- continue;
3110
- }
3111
- if (r.kind === "open") {
3112
- !a && r.name === c && (a = r, n = f), f += 1;
3113
- continue;
3114
- }
3115
- if (f -= 1, f < 0 && (f = 0), a && r.name === c && f === n) {
3116
- const i = a.attrs;
3117
- return {
3118
- name: c,
3119
- start: a.pos,
3120
- startTagEnd: a.end,
3121
- contentEnd: r.pos,
3122
- end: r.end,
3123
- inner: d.slice(a.end, r.pos),
3124
- outer: d.slice(a.pos, r.end),
3125
- attributes: At(i)
3126
- };
3127
- }
3128
- }
3129
- return null;
3130
- }
3131
- function cr(d) {
3132
- return Ct(d, "book") ? "book" : Ct(d, "article") ? "article" : Ct(d, "chapter") ? "book" : "article";
3133
- }
3134
- function lr(d) {
3135
- const { mainSource: c, publication: e, outputBase: f = "output" } = d;
3136
- return `<?xml version="1.0" encoding="UTF-8"?>
3137
- <project ptx-version="2">
3138
- <targets>
3139
- <target name="web">
3140
- <format>html</format>
3141
- <source>${c}</source>
3142
- <publication>${e}</publication>
3143
- <output-dir>${f}/web</output-dir>
3144
- </target>
3145
- <target name="print">
3146
- <format>pdf</format>
3147
- <source>${c}</source>
3148
- <publication>${e}</publication>
3149
- <output-dir>${f}/print</output-dir>
3150
- </target>
3151
- </targets>
3152
- </project>
3153
- `;
3154
- }
3155
- function ur() {
3156
- return `<?xml version="1.0" encoding="UTF-8"?>
3157
- <publication>
3158
- <source>
3159
- <directories external="external" generated="generated"/>
3160
- </source>
3161
- <common>
3162
- <chunking level="1"/>
3163
- </common>
3164
- </publication>
3165
- `;
3166
- }
3167
- function fr() {
3168
- return `<?xml version="1.0" encoding="UTF-8"?>
3169
- `;
3170
- }
3171
- const hr = "http://www.w3.org/2001/XInclude";
3172
- function dr(d) {
3173
- return d.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
3174
- }
3175
- function Jt(d, c) {
3176
- const e = String(c).length;
3177
- return String(d).padStart(Math.max(e, 2), "0");
3178
- }
3179
- function qt(d, c) {
3180
- const e = [...c].sort((n, r) => n.start - r.start);
3181
- let f = "", a = 0;
3182
- for (const n of e)
3183
- f += d.slice(a, n.start), f += n.replacement, a = n.end;
3184
- return f += d.slice(a), f;
3185
- }
3186
- function Qt(d) {
3187
- return d.replace(
3188
- /<(pretext|book|article|chapter)\b([^>]*)>/,
3189
- (c, e, f) => /\bxmlns:xi\s*=/.test(f) ? c : `<${e}${f} xmlns:xi="${hr}">`
3190
- );
3191
- }
3192
- function te(d) {
3193
- return d.startsWith("<?xml") ? d : fr() + d;
3194
- }
3195
- function le(d) {
3196
- return d.trim().replace(/[^a-zA-Z0-9\-_]+/g, "-").replace(/^[^a-zA-Z_]+/, "").replace(/-+$/, "");
3197
- }
3198
- class pr {
3199
- used = /* @__PURE__ */ new Set();
3200
- claim(c) {
3201
- let e = c, f = 2;
3202
- for (; this.used.has(e); )
3203
- e = `${c}-${f}`, f += 1;
3204
- return this.used.add(e), e;
3205
- }
3206
- has(c) {
3207
- return this.used.has(c);
3208
- }
3209
- }
3210
- function Tt(d, c, e) {
3211
- const f = d.slice(0, c), a = d.slice(c);
3212
- return /\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/.test(f) ? f.replace(
3213
- /\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/,
3214
- `xml:id="${e}"`
3215
- ) + a : f.replace(/^<([a-zA-Z_:][\w:.-]*)/, `<$1 xml:id="${e}"`) + a;
3216
- }
3217
- function Rt(d) {
3218
- const c = wt(d, "title");
3219
- return c ? c.inner.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim() : "";
3220
- }
3221
- function Bt(d, c, e) {
3222
- const f = d.attributes["xml:id"];
3223
- if (f) {
3224
- const a = le(f) || e, n = c.claim(a);
3225
- return n !== f ? { ref: n, renamedFrom: f, generated: !1 } : { ref: n, generated: !1 };
3226
- }
3227
- return { ref: c.claim(e), generated: !0 };
3228
- }
3229
- function Pt(d, c, e, f) {
3230
- c.renamedFrom !== void 0 ? d.push({
3231
- action: "anomaly",
3232
- severity: "warning",
3233
- kind: "structure",
3234
- category: "renamed_xml_id",
3235
- macro: e,
3236
- occurrences: 1,
3237
- message: `<${e}> xml:id \`${c.renamedFrom}\` is not a valid ref (or collides with another); renamed to \`${c.ref}\`. Cross-references to the old id will break.`
3238
- }) : c.generated && d.push({
3239
- action: "anomaly",
3240
- severity: "info",
3241
- kind: "structure",
3242
- category: "missing_xml_id",
3243
- macro: e,
3244
- occurrences: 1,
3245
- message: `<${e}> at position ${f} has no xml:id; assigned \`${c.ref}\`.`
3246
- });
3247
- }
3248
- function ee(d, c) {
3249
- const e = d.outer.slice(0, d.startTagEnd - d.start), f = d.outer.slice(d.contentEnd - d.start);
3250
- return e + c + f;
3251
- }
3252
- function mr(d, c) {
3253
- return Object.entries(d).map(([e, f]) => {
3254
- const a = e.split("/").pop() ?? e, n = a.replace(/\.[^.]+$/, "");
3255
- return { ref: c.claim(le(n) || "asset"), fileName: a, data: f };
3256
- });
3257
- }
3258
- function gr(d, c = {}) {
3259
- const e = [], f = c.documentKind ?? cr(d), a = c.splitChapters ?? f === "book", n = c.splitSections ?? !1, r = Ct(d, "pretext"), i = r ? r.inner : d, l = wt(i, "docinfo"), p = l?.outer.trim() ?? "";
3260
- let w = wt(i, "book") ?? wt(i, "article");
3261
- if (!w) {
3262
- const b = f === "book" ? "book" : "article", S = (l ? i.slice(0, l.start) + i.slice(l.end) : i).trim();
3263
- w = wt(
3264
- `<${b}>
3265
- ${S}
3266
- </${b}>`,
3267
- b
3268
- );
3269
- }
3270
- if (!w)
3271
- throw new Error("Could not locate a root element for the division pool.");
3272
- f === "book" && w.name !== "book" && e.push({
3273
- action: "anomaly",
3274
- severity: "warning",
3275
- kind: "structure",
3276
- category: "missing_root",
3277
- macro: "book",
3278
- occurrences: 1,
3279
- message: "Document was treated as a book but no <book> element found; importing with the existing root."
3280
- });
3281
- const v = new pr(), x = [], u = Bt(w, v, "document");
3282
- u.renamedFrom !== void 0 && Pt(e, u, w.name, 1);
3283
- const _ = Rt(w.inner);
3284
- let o = w.inner;
3285
- if (a && f === "book") {
3286
- const b = Nt(w.inner, "chapter"), S = b.map((z, E) => {
3287
- const R = Bt(
3288
- z,
3289
- v,
3290
- `ch-${Jt(E + 1, b.length)}`
3291
- );
3292
- Pt(e, R, "chapter", E + 1);
3293
- let B = z.inner;
3294
- if (n) {
3295
- const L = Nt(z.inner, "section"), P = L.map((W, Y) => {
3296
- const k = Bt(
3297
- W,
3298
- v,
3299
- `${R.ref}-sec-${Jt(Y + 1, L.length)}`
3300
- );
3301
- return Pt(e, k, "section", Y + 1), x.push({
3302
- xmlId: k.ref,
3303
- type: "section",
3304
- title: Rt(W.inner),
3305
- sourceFormat: "pretext",
3306
- content: Tt(
3307
- W.outer,
3308
- W.startTagEnd - W.start,
3309
- k.ref
3310
- ),
3311
- isRoot: !1
3312
- }), {
3313
- start: W.start,
3314
- end: W.end,
3315
- replacement: `<plus:section ref="${k.ref}"/>`
3316
- };
3317
- });
3318
- B = qt(
3319
- z.inner,
3320
- P
3321
- );
3322
- }
3323
- return x.push({
3324
- xmlId: R.ref,
3325
- type: "chapter",
3326
- title: Rt(z.inner),
3327
- sourceFormat: "pretext",
3328
- content: Tt(
3329
- ee(z, B),
3330
- z.startTagEnd - z.start,
3331
- R.ref
3332
- ),
3333
- isRoot: !1
3334
- }), {
3335
- start: z.start,
3336
- end: z.end,
3337
- replacement: `<plus:chapter ref="${R.ref}"/>`
3338
- };
3339
- });
3340
- o = qt(w.inner, S);
3341
- }
3342
- const g = {
3343
- xmlId: u.ref,
3344
- type: w.name === "book" ? "book" : "article",
3345
- title: _,
3346
- sourceFormat: "pretext",
3347
- content: Tt(
3348
- ee(w, o),
3349
- w.startTagEnd - w.start,
3350
- u.ref
3351
- ),
3352
- isRoot: !0
3353
- };
3354
- x.unshift(g);
3355
- const h = mr(c.assets ?? {}, v);
3356
- return {
3357
- project: {
3358
- title: _,
3359
- docinfo: p,
3360
- documentKind: f,
3361
- divisions: x,
3362
- assets: h
3363
- },
3364
- warnings: e
3365
- };
3366
- }
3367
- const Ft = {
3368
- mainSourcePath: "source/main.ptx",
3369
- publicationPath: "publication/publication.ptx",
3370
- projectFilePath: "project.ptx"
3371
- }, $t = /<plus:([a-zA-Z][a-zA-Z-]*)\s+ref="([^"]+)"\s*\/>/g;
3372
- function re(d) {
3373
- const c = [];
3374
- $t.lastIndex = 0;
3375
- let e;
3376
- for (; (e = $t.exec(d)) !== null; )
3377
- c.push(e[2]);
3378
- return c;
3379
- }
3380
- function Dt(d, c) {
3381
- const e = dr(d) || "division";
3382
- return e.startsWith(`${c}-`) ? e : `${c}-${e}`;
3383
- }
3384
- function jt(d, c) {
3385
- let e = c, f = 2;
3386
- for (; d.has(e); )
3387
- e = `${c}-${f}`, f += 1;
3388
- return d.add(e), e;
3389
- }
3390
- function _r(d, c) {
3391
- const e = `${c}-`;
3392
- return d.startsWith(e) ? d.slice(e.length) : d;
3393
- }
3394
- function ne(d, c) {
3395
- return d.replace(
3396
- $t,
3397
- (e, f, a) => {
3398
- const n = c.get(a);
3399
- return n ? `<xi:include href="${n}"/>` : e;
3400
- }
3401
- );
3402
- }
3403
- function br(d, c = {}) {
3404
- const e = c.mainSourcePath ?? Ft.mainSourcePath, f = c.publicationPath ?? Ft.publicationPath, a = c.projectFilePath ?? Ft.projectFilePath, n = c.includeScaffold ?? !0, r = {}, i = new Map(
3405
- d.divisions.map((h) => [h.xmlId, h])
3406
- ), l = d.divisions.find((h) => h.isRoot);
3407
- if (!l)
3408
- throw new Error("Division pool has no root division.");
3409
- const p = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map(), v = e.includes("/") ? e.slice(0, e.lastIndexOf("/") + 1) : "", x = [];
3410
- for (const h of re(l.content)) {
3411
- const b = i.get(h);
3412
- if (!b) continue;
3413
- const S = jt(
3414
- p,
3415
- Dt(b.xmlId, "ch")
3416
- );
3417
- w.set(b.xmlId, `${S}.ptx`), x.push({
3418
- division: b,
3419
- filePath: `${v}${S}.ptx`
3420
- });
3421
- const z = /* @__PURE__ */ new Set();
3422
- for (const E of re(b.content)) {
3423
- const R = i.get(E);
3424
- if (!R) continue;
3425
- const B = jt(
3426
- z,
3427
- Dt(_r(R.xmlId, b.xmlId), "sec")
3428
- );
3429
- w.set(R.xmlId, `${S}/${B}.ptx`), x.push({
3430
- division: R,
3431
- filePath: `${v}${S}/${B}.ptx`
3432
- });
3433
- }
3434
- }
3435
- const u = new Set(x.map((h) => h.division.xmlId));
3436
- for (const h of d.divisions) {
3437
- if (h.isRoot || u.has(h.xmlId)) continue;
3438
- const b = h.type === "section" ? "sec" : "ch", S = jt(p, Dt(h.xmlId, b));
3439
- w.set(h.xmlId, `${S}.ptx`), x.push({ division: h, filePath: `${v}${S}.ptx` });
3440
- }
3441
- for (const { division: h, filePath: b } of x) {
3442
- const S = ne(h.content, w), z = S === h.content ? S : Qt(S);
3443
- r[b] = te(z);
3444
- }
3445
- const _ = ne(l.content, w), g = `<pretext>
3446
- ${d.docinfo ? `${d.docinfo}
3447
- ` : ""}${_}
3448
- </pretext>`;
3449
- return r[e] = te(
3450
- _ === l.content ? g : Qt(g)
3451
- ), n && (r[a] = lr({
3452
- mainSource: e,
3453
- publication: f
3454
- }), r[f] = ur()), { files: r };
3455
- }
3456
- const yr = /\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i, vr = [
3457
- "tex",
3458
- "md",
3459
- "markdown",
3460
- "ptx",
3461
- "xml",
3462
- "bib",
3463
- "sty",
3464
- "txt",
3465
- "pdf",
3466
- "eps",
3467
- "png",
3468
- "ps",
3469
- "bbl"
3470
- ], wr = /* @__PURE__ */ new Set([
3471
- "png",
3472
- "jpg",
3473
- "jpeg",
3474
- "gif",
3475
- "pdf",
3476
- "eps",
3477
- "ps",
3478
- "bmp",
3479
- "tiff",
3480
- "tif",
3481
- "webp",
3482
- "ico"
3483
- ]), xr = /* @__PURE__ */ new Set([
3484
- "png",
3485
- "jpg",
3486
- "jpeg",
3487
- "gif",
3488
- "svg",
3489
- "bmp",
3490
- "tiff",
3491
- "tif",
3492
- "webp",
3493
- "ico",
3494
- "pdf",
3495
- "eps",
3496
- "ps"
3497
- ]);
3498
- function ue(d) {
3499
- return wr.has(d.toLowerCase());
3500
- }
3501
- function fe(d) {
3502
- return d.split("/").pop() ?? d;
3503
- }
3504
- function kr(d) {
3505
- const c = fe(d), e = gt(c);
3506
- return xr.has(e) ? `source/assets/${c}` : null;
3507
- }
3508
- function Sr(d) {
3509
- const c = fe(d);
3510
- return gt(c) === "bib" ? `source/${c}` : null;
3511
- }
3512
- function xt(d) {
3513
- return d.replace(/\r\n?/g, `
3514
- `).replace(/(\n *){3,}/g, `
3515
-
3516
- `);
3517
- }
3518
- function _t(d) {
3519
- return d.replace(/\\/g, "/").replace(/^\.\//, "");
3520
- }
3521
- function zr(d) {
3522
- const c = d.toLowerCase();
3523
- return c.endsWith(".tar.gz") || c.endsWith(".tgz") ? "tar.gz" : c.endsWith(".zip") ? "zip" : c.endsWith(".tex") ? "tex" : c.endsWith(".md") || c.endsWith(".markdown") ? "markdown" : c.endsWith(".ptx") || c.endsWith(".xml") ? "pretext" : null;
3524
- }
3525
- function Er(d) {
3526
- const c = (e, f) => new TextDecoder().decode(d.slice(e, f)).split("\0")[0];
3527
- return {
3528
- name: c(0, 100),
3529
- size: parseInt(c(124, 136), 8) || 0,
3530
- type: c(156, 157)
3531
- };
3532
- }
3533
- async function Cr(d) {
3534
- if (typeof DecompressionStream > "u")
3535
- throw new Error("This runtime does not support gzip decompression.");
3536
- const f = new ReadableStream({
3537
- start(l) {
3538
- l.enqueue(new Uint8Array(d)), l.close();
3539
- }
3540
- }).pipeThrough(
3541
- new DecompressionStream("gzip")
3542
- ).getReader(), a = [];
3543
- for (; ; ) {
3544
- const { done: l, value: p } = await f.read();
3545
- if (l)
3546
- break;
3547
- a.push(p);
3548
- }
3549
- const n = a.reduce((l, p) => l + p.length, 0), r = new Uint8Array(n);
3550
- let i = 0;
3551
- for (const l of a)
3552
- r.set(l, i), i += l.length;
3553
- return r.buffer;
3554
- }
3555
- function Ar(d) {
3556
- const c = {}, e = {};
3557
- let f = 0;
3558
- for (; f < d.length && !(f + 512 > d.length); ) {
3559
- const a = d.slice(f, f + 512), n = Er(a);
3560
- if (!n.name)
3561
- break;
3562
- f += 512;
3563
- const r = n.size, i = Math.ceil(r / 512) * 512;
3564
- if (n.type === "0" || n.type === "") {
3565
- const l = d.slice(f, f + r), p = _t(n.name);
3566
- if (ue(gt(p)))
3567
- e[p] = l;
3568
- else {
3569
- const w = new TextDecoder().decode(l);
3570
- c[p] = xt(w);
3571
- }
3572
- }
3573
- f += i;
3574
- }
3575
- return { files: c, assets: e };
3576
- }
3577
- async function Ir(d) {
3578
- const c = zr(d.name);
3579
- if (!c)
3580
- throw new Error(
3581
- "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."
3582
- );
3583
- if (c === "tex" || c === "markdown" || c === "pretext") {
3584
- const a = await d.text();
3585
- return {
3586
- files: { [_t(d.name)]: xt(a) },
3587
- assets: {}
3588
- };
3589
- }
3590
- if (c === "zip") {
3591
- const n = await new Qe().loadAsync(d), r = {}, i = {};
3592
- for (const [l, p] of Object.entries(n.files)) {
3593
- if (p.dir)
3594
- continue;
3595
- const w = _t(l);
3596
- if (ue(gt(w)))
3597
- i[w] = await p.async("uint8array");
3598
- else {
3599
- const v = await p.async("string");
3600
- r[w] = xt(v);
3601
- }
3602
- }
3603
- return { files: r, assets: i };
3604
- }
3605
- const e = await d.arrayBuffer(), f = await Cr(e);
3606
- return Ar(new Uint8Array(f));
3607
- }
3608
- function gt(d) {
3609
- const c = d.toLowerCase().match(/\.([^.\/]+)$/);
3610
- return c ? c[1] : "";
3611
- }
3612
- function Or(d) {
3613
- const c = Object.keys(d).filter((f) => gt(f) === "tex").sort();
3614
- return c.length === 0 ? null : c.find(
3615
- (f) => /\\begin *\{document\}/.test(d[f])
3616
- ) ?? c[0];
3617
- }
3618
- function Tr(d) {
3619
- const c = d.lastIndexOf("/");
3620
- return c >= 0 ? d.slice(0, c) : "";
3621
- }
3622
- function Rr(d, c, e) {
3623
- const f = Tr(c);
3624
- return [
3625
- d,
3626
- `${d}.tex`,
3627
- f ? `${f}/${d}` : d,
3628
- f ? `${f}/${d}.tex` : `${d}.tex`
3629
- ].map(_t).find((n) => n in e) ?? null;
3630
- }
3631
- function Br(d, c, e) {
3632
- let f = 0;
3633
- const a = [], n = (i) => {
3634
- let l = !1;
3635
- return { output: i.replace(
3636
- /(\\(input|include) *\{([^{}]+)\})/g,
3637
- (w, v, x, u) => {
3638
- const _ = Rr(u, c, e);
3639
- return _ ? (l = !0, f += 1, e[_]) : (a.includes(u) || a.push(u), w);
3640
- }
3641
- ), changed: l };
3642
- };
3643
- let r = d;
3644
- for (let i = 0; i < 3; i += 1) {
3645
- const { output: l, changed: p } = n(r);
3646
- if (r = l, !p)
3647
- break;
3648
- }
3649
- return { expandedText: xt(r), expandedCount: f, missingInputs: a };
3650
- }
3651
- function Pr(d) {
3652
- const c = Or(d);
3653
- if (c)
3654
- return { sourcePath: c, sourceType: "tex" };
3655
- const e = Object.keys(d).sort(), f = e.find((i) => {
3656
- const l = gt(i);
3657
- return l === "md" || l === "markdown";
3658
- });
3659
- if (f)
3660
- return { sourcePath: f, sourceType: "markdown" };
3661
- const a = or(d);
3662
- if (a)
3663
- return { sourcePath: a, sourceType: "pretext" };
3664
- if (e.length === 0)
3665
- throw new Error("No files were found in the uploaded source.");
3666
- const n = e[0], r = ie(d[n]);
3667
- return {
3668
- sourcePath: n,
3669
- sourceType: r === "latex" ? "tex" : r
3670
- };
3671
- }
3672
- function Fr(d) {
3673
- const c = { other: 0 };
3674
- for (const e of vr)
3675
- c[e] = 0;
3676
- for (const e of Object.keys(d)) {
3677
- const f = gt(e);
3678
- f in c ? c[f] += 1 : c.other += 1;
3679
- }
3680
- return c;
3681
- }
3682
- function Dr(d, c) {
3683
- const e = Fr(c);
3684
- d.push({ type: "success", message: "File types:" });
3685
- for (const f of Object.keys(e).sort())
3686
- e[f] && d.push({ type: "success", message: `${f}: ${e[f]}` });
3687
- }
3688
- function jr(d) {
3689
- return d === "tex" ? "latex" : d === "markdown" ? "markdown" : "pretext";
3690
- }
3691
- function Nr(d, c = {}) {
3692
- const e = [];
3693
- try {
3694
- const f = Object.fromEntries(
3695
- Object.entries(d).map(([z, E]) => [
3696
- _t(z),
3697
- xt(E)
3698
- ])
3699
- ), a = Object.keys(f).length;
3700
- e.push({
3701
- type: "success",
3702
- message: `Found ${a} file${a === 1 ? "" : "s"}.`
3703
- }), Dr(e, f);
3704
- const { sourcePath: n, sourceType: r } = Pr(f);
3705
- let i = f[n] ?? "";
3706
- if (r === "tex") {
3707
- const z = Object.fromEntries(
3708
- Object.entries(f).filter(
3709
- ([L]) => gt(L) === "tex"
3710
- )
3711
- ), { expandedText: E, expandedCount: R, missingInputs: B } = Br(
3712
- i,
3713
- n,
3714
- z
3715
- );
3716
- i = E, R > 0 && e.push({
3717
- type: "success",
3718
- message: `Expanded ${R} input/include reference${R === 1 ? "" : "s"}.`
3719
- }), B.length > 0 && e.push({
3720
- type: "error",
3721
- message: `Missing input/include files: ${B.join(", ")}.`
3722
- });
3723
- } else if (r === "pretext") {
3724
- const z = Object.fromEntries(
3725
- Object.entries(f).filter(([L]) => {
3726
- const P = gt(L);
3727
- return P === "ptx" || P === "xml";
3728
- })
3729
- ), { expandedText: E, expandedCount: R, missingIncludes: B } = sr(i, n, z);
3730
- i = E, R > 0 && e.push({
3731
- type: "success",
3732
- message: `Expanded ${R} xi:include reference${R === 1 ? "" : "s"}.`
3733
- }), B.length > 0 && e.push({
3734
- type: "error",
3735
- message: `Missing xi:include targets: ${B.join(", ")}.`
3736
- });
3737
- }
3738
- e.push({
3739
- type: "success",
3740
- message: `Main source file: ${n}`
3741
- });
3742
- const l = jr(r), p = Ye(i, l);
3743
- if ("pretextError" in p)
3744
- return {
3745
- pretextError: p.pretextError,
3746
- statusMessages: e,
3747
- warnings: p.warnings
3748
- };
3749
- const {
3750
- buildLayout: w = !0,
3751
- assets: v = {},
3752
- ...x
3753
- } = c, u = {}, _ = {};
3754
- for (const [z, E] of Object.entries(v)) {
3755
- const R = kr(z);
3756
- R && (u[R] = E, _[z] = E);
3757
- }
3758
- const o = gr(p.pretextSource, {
3759
- documentKind: x.documentKind,
3760
- splitChapters: w ? x.splitChapters : !1,
3761
- splitSections: w ? x.splitSections : !1,
3762
- assets: _
3763
- }), g = w ? br(o.project, {
3764
- mainSourcePath: x.mainSourcePath,
3765
- publicationPath: x.publicationPath,
3766
- projectFilePath: x.projectFilePath
3767
- }).files : { "source/main.ptx": p.pretextSource };
3768
- for (const [z, E] of Object.entries(f)) {
3769
- const R = Sr(z);
3770
- R && !(R in g) && (g[R] = E);
3771
- }
3772
- const h = o.project.documentKind, b = [...p.warnings, ...o.warnings];
3773
- let S;
3774
- return p.cleanedNativeSource !== void 0 && p.cleanedNativeSource.length > 0 && (p.sourceFormat === "latex" ? S = { "source/main.tex": p.cleanedNativeSource } : p.sourceFormat === "markdown" && (S = { "source/main.md": p.cleanedNativeSource })), Object.keys(v).length > 0 && e.push({
3775
- type: "success",
3776
- message: `Routed ${Object.keys(u).length} binary asset${Object.keys(u).length === 1 ? "" : "s"}.`
3777
- }), {
3778
- ...p,
3779
- warnings: b,
3780
- sourcePath: n,
3781
- sourceName: n.split("/").pop() ?? n,
3782
- sourceType: r,
3783
- project: o.project,
3784
- files: f,
3785
- assets: v,
3786
- outputFiles: g,
3787
- outputAssets: u,
3788
- nativeOutputFiles: S,
3789
- documentKind: h,
3790
- statusMessages: e
3791
- };
3792
- } catch (f) {
3793
- const a = f instanceof Error ? f.message : String(f);
3794
- return e.push({ type: "error", message: a }), {
3795
- pretextError: a,
3796
- statusMessages: e,
3797
- warnings: []
3798
- };
3799
- }
3800
- }
3801
- async function Wr(d, c = {}) {
3802
- const e = [], f = _t(d.name);
3803
- if (!yr.test(f.toLowerCase()))
3804
- return {
3805
- pretextError: "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz.",
3806
- statusMessages: [
3807
- {
3808
- type: "error",
3809
- message: "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."
3810
- }
3811
- ],
3812
- warnings: []
3813
- };
3814
- e.push({
3815
- type: "loading",
3816
- message: `Processing ${f}...`
3817
- });
3818
- try {
3819
- const { files: a, assets: n } = await Ir(d), r = Nr(a, { ...c, assets: n });
3820
- return {
3821
- ...r,
3822
- statusMessages: [...e, ...r.statusMessages]
3823
- };
3824
- } catch (a) {
3825
- const n = a instanceof Error ? a.message : String(a);
3826
- return {
3827
- pretextError: n,
3828
- statusMessages: [...e, { type: "error", message: n }],
3829
- warnings: []
3830
- };
3831
- }
3832
- }
3833
- function Mr(d, c) {
3834
- return c === "converted" ? d.outputFiles : d.nativeOutputFiles ?? d.files;
3835
- }
3836
- function Zr(d, c) {
3837
- return c === "converted" ? d.outputAssets : d.assets;
3838
- }
3839
- function Hr(d) {
3840
- const c = d.action === "replace" || d.action === "rewrite" ? `replaced with \`${d.replacement}\`` : d.message ?? d.action, e = d.occurrences > 1 ? ` (x${d.occurrences})` : "";
3841
- return `[${d.severity}] ${d.macro}: ${c}${e}`;
3842
- }
3843
- export {
3844
- br as A,
3845
- be as L,
3846
- ye as M,
3847
- ur as a,
3848
- Nt as b,
3849
- dr as c,
3850
- cr as d,
3851
- Qt as e,
3852
- Ct as f,
3853
- Zr as g,
3854
- gr as h,
3855
- je as i,
3856
- Xe as j,
3857
- Ge as k,
3858
- Ye as l,
3859
- ie as m,
3860
- re as n,
3861
- sr as o,
3862
- Jt as p,
3863
- Mr as q,
3864
- lr as r,
3865
- qt as s,
3866
- Hr as t,
3867
- Ke as u,
3868
- Wr as v,
3869
- te as w,
3870
- Nr as x,
3871
- Lt as y,
3872
- le as z
3873
- };