@pretextbook/import 0.3.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.
@@ -0,0 +1,4774 @@
1
+ import { formatPretext as Xe } from "@pretextbook/format";
2
+ import { latexToPretext as He } from "@pretextbook/latex-pretext";
3
+ import { markdownToPretext as Ke } from "@pretextbook/remark-pretext";
4
+ const Ye = [
5
+ "\\documentclass",
6
+ "\\begin{document}",
7
+ "\\begin{",
8
+ "\\section",
9
+ "\\chapter",
10
+ "\\title",
11
+ "\\author"
12
+ ], Ve = ["# ", "## ", "### ", "#### "];
13
+ function Gt(n) {
14
+ const r = n.trim();
15
+ return !r || r.startsWith("<") ? "pretext" : Ye.some((t) => r.includes(t)) ? "latex" : Ve.some((t) => r.startsWith(t)) ? "markdown" : "pretext";
16
+ }
17
+ const Je = [
18
+ {
19
+ kind: "presentation",
20
+ category: "latex_fonts",
21
+ macros: ["textrm", "textit", "textbf", "textsc", "texttt"]
22
+ }
23
+ ], se = {
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
+ }, qe = [
38
+ {
39
+ kind: "accessibility",
40
+ category: "consistency",
41
+ macros: ["renewcommand"]
42
+ }
43
+ ], Qe = [
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
+ ], tn = [
114
+ {
115
+ kind: "archaic",
116
+ category: "low_level_tex",
117
+ macros: ["catcode", "newtheorem", "maketitle", "setlength"]
118
+ }
119
+ ], en = [
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
+ ], nn = [
137
+ {
138
+ kind: "archaic",
139
+ category: "use_newcommand_only",
140
+ macros: ["def", "let", "edef", "gdef", "xdef", "global", "long"]
141
+ }
142
+ ], rn = [
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
+ ], sn = [
164
+ {
165
+ kind: "presentation",
166
+ category: "nonstructural",
167
+ environments: ["center", "minipage"]
168
+ }
169
+ ];
170
+ function ae(n) {
171
+ return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
172
+ }
173
+ function oe(n, r) {
174
+ let t = n;
175
+ const u = [];
176
+ for (const { from: s, to: i } of r.pairs) {
177
+ let e, o;
178
+ r.category === "tex_fonts" ? (e = `\\{ *\\\\${ae(s)}\\b *`, o = `\\${i}{`) : (e = `\\\\${ae(s)}\\b *`, o = `\\${i}`);
179
+ const l = new RegExp(e, "g"), d = t.match(l);
180
+ d && (u.push({
181
+ action: "replace",
182
+ severity: "info",
183
+ kind: r.kind,
184
+ category: r.category,
185
+ macro: s,
186
+ replacement: i,
187
+ occurrences: d.length
188
+ }), t = t.replace(l, o));
189
+ }
190
+ return { output: t, warnings: u };
191
+ }
192
+ function an(n) {
193
+ let r = n;
194
+ const t = [], u = r.match(/\(\\ref\{([^{}]+)\}\)/g);
195
+ u && (t.push({
196
+ action: "rewrite",
197
+ severity: "info",
198
+ kind: "presentation",
199
+ category: "math_refs",
200
+ macro: "(\\ref{...})",
201
+ replacement: "\\eqref{...}",
202
+ occurrences: u.length
203
+ }), r = r.replace(/\(\\ref\{([^{}]+)\}\)/g, "\\eqref{$1}")), r = r.replace(/(\\vfil)l\b/g, "$1"), r = r.replace(/(\\vfil)(\s*\\vfil\b)+\b/g, "$1");
204
+ const s = r.match(/(\\vfil)\b/g);
205
+ return s && (t.push({
206
+ action: "rewrite",
207
+ severity: "info",
208
+ kind: "presentation",
209
+ category: "spacing_vertical",
210
+ macro: "vfil",
211
+ replacement: "\\vspace{1in}",
212
+ occurrences: s.length
213
+ }), r = r.replace(/(\\vfil)\b/g, "\\vspace{1in}")), r = r.replace(
214
+ /\\vskip\*? *([0-9]+|-) *([a-zA-Z]+).*/g,
215
+ "\\vspace{$1$2}"
216
+ ), r = r.replace(/(\\vspace)\*? */g, "$1"), r = r.replace(
217
+ /(\\vspace) *\{([0-9]+|-) *([a-zA-Z]+).*?\}/g,
218
+ "$1{$2$3}"
219
+ ), { output: r, warnings: t };
220
+ }
221
+ function on(n) {
222
+ const r = n.split("\\begin{document}");
223
+ if (r.length < 2)
224
+ return { preamble: "", body: n, bibliography: "" };
225
+ const t = r[0];
226
+ let u = r.slice(1).join("\\begin{document}"), s = "";
227
+ if (/\\begin\{thebibliography\}/.test(u)) {
228
+ const [i, ...e] = u.split("\\begin{thebibliography}");
229
+ u = i, s = e.join("\\begin{thebibliography}");
230
+ }
231
+ return { preamble: t, body: u, bibliography: s };
232
+ }
233
+ function we(n) {
234
+ return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
235
+ }
236
+ function cn(n, r, t) {
237
+ const u = we(n);
238
+ if (r === "hasarg") {
239
+ let s = `\\\\${u}\\b\\*?`;
240
+ for (let i = 0; i < t; i += 1)
241
+ s += "\\{[^{}]*\\}";
242
+ return new RegExp(`(${s})`, "g");
243
+ }
244
+ return r === "line" ? new RegExp(`(\\\\${u}\\b.*)`, "g") : new RegExp(`(\\\\${u}\\b)`, "g");
245
+ }
246
+ function ut(n, r, t, u) {
247
+ const { type: s = "", action: i = "mark", extra: e = "", save: o = !1 } = t;
248
+ "macros" in r && r.macros[0];
249
+ let l = n;
250
+ const d = r.macros;
251
+ for (const _ of d) {
252
+ const m = typeof _ == "string" ? _ : _.name, v = typeof _ == "string" ? 0 : _.arity, h = cn(m, s, v), g = l.match(h);
253
+ !g || g.length === 0 || (o && u.push({
254
+ action: "save",
255
+ severity: "warning",
256
+ kind: r.kind,
257
+ category: r.category,
258
+ macro: m,
259
+ occurrences: g.length,
260
+ examples: g.slice(0, 5),
261
+ message: e || void 0
262
+ }), i === "delete" ? (u.push({
263
+ action: "delete",
264
+ severity: "info",
265
+ kind: r.kind,
266
+ category: r.category,
267
+ macro: m,
268
+ occurrences: g.length,
269
+ message: e || void 0
270
+ }), l = l.replace(h, "")) : u.push({
271
+ action: "anomaly",
272
+ severity: "warning",
273
+ kind: r.kind,
274
+ category: r.category,
275
+ macro: m,
276
+ occurrences: g.length,
277
+ message: e || void 0,
278
+ examples: g.slice(0, 5)
279
+ }));
280
+ }
281
+ return l;
282
+ }
283
+ function ln(n, r, t) {
284
+ let u = n;
285
+ for (const s of r.environments) {
286
+ const i = we(s), e = new RegExp(`(\\\\(begin|end)\\{\\s*${i}\\})`, "g"), o = u.match(e);
287
+ o && o.length > 0 && (t.push({
288
+ action: "delete",
289
+ severity: "info",
290
+ kind: r.kind,
291
+ category: r.category,
292
+ macro: s,
293
+ occurrences: o.length
294
+ }), u = u.replace(e, ""));
295
+ }
296
+ return u;
297
+ }
298
+ function un(n) {
299
+ const r = [], t = on(n);
300
+ let { preamble: u, body: s } = t;
301
+ const { bibliography: i } = t;
302
+ for (const d of Qe)
303
+ u = ut(u, d, { action: "delete" }, r), s = ut(s, d, { action: "delete" }, r);
304
+ for (const d of qe)
305
+ u = ut(
306
+ u,
307
+ d,
308
+ { type: "line", action: "delete", extra: "in the preamble", save: !0 },
309
+ r
310
+ ), s = ut(
311
+ s,
312
+ d,
313
+ { type: "line", action: "delete", extra: "in the main text", save: !0 },
314
+ r
315
+ );
316
+ for (const d of nn)
317
+ u = ut(
318
+ u,
319
+ d,
320
+ { type: "line", action: "delete", extra: "in the preamble", save: !0 },
321
+ r
322
+ ), s = ut(
323
+ s,
324
+ d,
325
+ { type: "line", action: "delete", extra: "in the main text", save: !0 },
326
+ r
327
+ );
328
+ for (const d of rn)
329
+ u = ut(
330
+ u,
331
+ d,
332
+ { type: "hasarg", action: "delete" },
333
+ r
334
+ ), s = ut(
335
+ s,
336
+ d,
337
+ { type: "hasarg", action: "delete" },
338
+ r
339
+ );
340
+ for (const d of tn)
341
+ u = ut(
342
+ u,
343
+ d,
344
+ { type: "line", action: "delete" },
345
+ r
346
+ ), s = ut(
347
+ s,
348
+ d,
349
+ { type: "line", action: "delete" },
350
+ r
351
+ );
352
+ for (const d of en)
353
+ u = ut(
354
+ u,
355
+ d,
356
+ {
357
+ type: "line",
358
+ action: "delete",
359
+ extra: "this is a publisher choice in PreTeXt"
360
+ },
361
+ r
362
+ ), s = ut(
363
+ s,
364
+ d,
365
+ {
366
+ type: "line",
367
+ action: "delete",
368
+ extra: "this is a publisher choice in PreTeXt"
369
+ },
370
+ r
371
+ );
372
+ for (const d of Je)
373
+ s = ut(s, d, { action: "mark" }, r);
374
+ for (const d of sn)
375
+ s = ln(s, d, r);
376
+ const e = n.includes("\\begin{document}"), o = i.length > 0;
377
+ let l = u;
378
+ return e ? l += `\\begin{document}
379
+ ` + s : l = s, o && (l += `\\begin{thebibliography}
380
+ ` + i), { output: l, warnings: r };
381
+ }
382
+ function fn(n) {
383
+ let r = n;
384
+ return r = r.replace(/\s+%.*/g, ""), r = r.replace(/([^\\])%.*/g, "$1"), r = r.replace(/^%.*/, ""), r;
385
+ }
386
+ function dn(n) {
387
+ return n.replace(/(.*\{)([^{}]+)(\}.*)/, (r, t, u, s) => {
388
+ const i = String(u).replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "-");
389
+ return `${t}${i}${s}`;
390
+ });
391
+ }
392
+ function hn(n) {
393
+ let r = n;
394
+ return r = r.replace(/> */g, "\\gt "), r = r.replace(/< */g, "\\lt "), r = r.replace(
395
+ /(\\(ref|eqref|cref|Cref|label)\{([^{}]+)\})/g,
396
+ dn
397
+ ), r;
398
+ }
399
+ function pn(n) {
400
+ let r = n;
401
+ return r = r.replace(/\\begin +/g, "\\begin"), r = r.replace(/\\chapter +/g, "\\chapter"), r = r.replace(/\\section +/g, "\\section"), r = r.replace(/\\section\*/g, "\\section"), r = fn(r), r = hn(r), r = r.replace(/\\end\{document\}.*/s, ""), r = r.replace(/^\s+/, ""), r = r.replace(/\n{3,}/g, `
402
+
403
+ `), r;
404
+ }
405
+ function ce(n, r = 0, t = "{", u = "}") {
406
+ let s = n.trimStart();
407
+ if (!s)
408
+ return ["", ""];
409
+ let i = "", e = "", o = r;
410
+ if (o === 0 && s[0] !== t)
411
+ return ["", s];
412
+ for (o === 0 && (e = t, o = 1, s = s.substring(1)); o > 0 && s; ) {
413
+ const l = s[0];
414
+ l === t && i !== "\\" ? o += 1 : l === u && i !== "\\" && (o -= 1), e += l, i === "\\" && l === "\\" ? i = `
415
+ ` : i = l, s = s.substring(1);
416
+ }
417
+ return o === 0 ? [e, s] : ["", e.substring(1)];
418
+ }
419
+ function mn(n) {
420
+ const r = [];
421
+ let t = pn(n).replace(/(\n *){3,}/g, `
422
+
423
+ `);
424
+ const u = an(t);
425
+ t = u.output, r.push(...u.warnings);
426
+ const s = oe(t, se);
427
+ t = s.output, r.push(...s.warnings);
428
+ const i = oe(t, se);
429
+ t = i.output, r.push(...i.warnings);
430
+ const e = un(t);
431
+ return t = e.output.replace(/(\n *){3,}/g, `
432
+
433
+ `), r.push(...e.warnings), { output: t, warnings: r };
434
+ }
435
+ function zt(n) {
436
+ const r = "\\begin{document}", t = "\\end{document}", u = n.indexOf(r);
437
+ if (u === -1)
438
+ return { preamble: "", body: n };
439
+ const s = n.slice(0, u).trim(), i = n.slice(u + r.length), e = i.indexOf(t), o = (e === -1 ? i : i.slice(0, e)).trim();
440
+ return { preamble: s, body: o };
441
+ }
442
+ function Pt(n, r) {
443
+ const u = new RegExp(`\\\\${r}(?![a-zA-Z])`).exec(n);
444
+ if (!u) return "";
445
+ let s = n.slice(u.index + u[0].length).trimStart();
446
+ if (s.startsWith("[")) {
447
+ const [e, o] = ce(s, 0, "[", "]");
448
+ e && (s = o.trimStart());
449
+ }
450
+ const [i] = ce(s);
451
+ return i ? i.slice(1, -1).trim() : "";
452
+ }
453
+ const gn = /^[ \t]*(\\(?:new|renew|provide)command\*?|\\DeclareMathOperator\*?|\\newenvironment\*?)\b/;
454
+ function le(n) {
455
+ let r = 0;
456
+ for (let t = 0; t < n.length; t++) {
457
+ if (n[t] === "\\") {
458
+ t++;
459
+ continue;
460
+ }
461
+ n[t] === "{" ? r++ : n[t] === "}" && r--;
462
+ }
463
+ return r;
464
+ }
465
+ function xe(n) {
466
+ const r = n.split(`
467
+ `), t = [];
468
+ let u = 0;
469
+ for (; u < r.length; ) {
470
+ if (!gn.test(r[u])) {
471
+ u++;
472
+ continue;
473
+ }
474
+ let s = r[u], i = le(r[u]);
475
+ for (u++; i > 0 && u < r.length; )
476
+ s += `
477
+ ` + r[u], i += le(r[u]), u++;
478
+ t.push(s.trim());
479
+ }
480
+ return t.join(`
481
+ `);
482
+ }
483
+ function _n(n) {
484
+ const r = /\\documentclass(?:\[[^\]]*\])?\{([^}]+)\}/.exec(n);
485
+ return r ? r[1].trim() : "article";
486
+ }
487
+ function bn(n) {
488
+ const r = n.replace(/(^|[^\\])%[^\n]*/gm, "$1");
489
+ return {
490
+ documentClass: _n(r),
491
+ title: Pt(r, "title"),
492
+ author: Pt(r, "author"),
493
+ macros: xe(r)
494
+ };
495
+ }
496
+ function yn(n) {
497
+ if (typeof n == "string")
498
+ return n;
499
+ if (typeof n == "object" && n !== null && "value" in n) {
500
+ const r = n.value;
501
+ if (typeof r == "string")
502
+ return r;
503
+ if (r != null)
504
+ return String(r);
505
+ }
506
+ return String(n);
507
+ }
508
+ function ke(n) {
509
+ return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
510
+ }
511
+ function Se(n) {
512
+ return n.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 vn(n) {
515
+ const r = [];
516
+ if (n.macros) {
517
+ const t = n.macros.split(`
518
+ `).map((u) => ` ${u}`).join(`
519
+ `);
520
+ r.push(` <macros>
521
+ ${t}
522
+ </macros>`);
523
+ }
524
+ if (n.author) {
525
+ const t = n.author.split(/\s+\\and\s+/)[0].trim(), u = ke(Se(t));
526
+ u && r.push(
527
+ ` <author>
528
+ <personname>${u}</personname>
529
+ </author>`
530
+ );
531
+ }
532
+ return r.length === 0 ? "" : `<docinfo>
533
+ ${r.join(`
534
+ `)}
535
+ </docinfo>`;
536
+ }
537
+ function wn(n, r) {
538
+ const t = n.replace(/^\s*<p\s*\/>\s*/g, "").replace(/^\s*<p>\s*<\/p>\s*/g, "").trim();
539
+ if (!t) return "";
540
+ const s = /<chapter[\s>]/.test(t) ? "book" : "article", i = vn(r), e = r.title ? ` <title>${ke(Se(r.title))}</title>
541
+ ` : "", o = `<${s}>
542
+ ${e}${t}
543
+ </${s}>`;
544
+ return `<pretext>
545
+ ${[i, o].filter(Boolean).join(`
546
+ `)}
547
+ </pretext>`;
548
+ }
549
+ function Jt(n) {
550
+ const r = n.trim();
551
+ return r ? Xe(r) : "";
552
+ }
553
+ function xn(n) {
554
+ const r = n.trim();
555
+ if (!r)
556
+ return { pretext: "", cleanedLatex: "", warnings: [] };
557
+ const { preamble: t, body: u } = zt(r), s = bn(t), i = u ? [
558
+ `\\documentclass{${s.documentClass}}`,
559
+ s.macros,
560
+ "\\begin{document}",
561
+ u,
562
+ "\\end{document}"
563
+ ].filter(Boolean).join(`
564
+ `) : r, { output: e, warnings: o } = mn(i);
565
+ if (!e.trim())
566
+ return { pretext: "", cleanedLatex: e, warnings: o };
567
+ const l = u ? e + `
568
+ \\end{document}` : e, d = yn(
569
+ He(l)
570
+ ).trim();
571
+ if (!d)
572
+ return { pretext: "", cleanedLatex: e, warnings: o };
573
+ const _ = wn(d, s);
574
+ return { pretext: _ ? Jt(_) : "", cleanedLatex: e, warnings: o };
575
+ }
576
+ function kn(n) {
577
+ const r = n.trim();
578
+ if (!r)
579
+ return { pretext: "", cleanedMarkdown: "" };
580
+ const t = String(Ke(r)).trim();
581
+ return { pretext: t ? Jt(t) : "", cleanedMarkdown: r };
582
+ }
583
+ function Sn(n) {
584
+ return n instanceof Error && n.message.trim() ? n.message.trim() : "Could not convert source content to PreTeXt.";
585
+ }
586
+ function En(n, r) {
587
+ const t = Gt(n), u = r ?? t;
588
+ try {
589
+ if (u === "pretext")
590
+ return {
591
+ sourceFormat: u,
592
+ detectedSourceFormat: t,
593
+ pretextSource: Jt(n),
594
+ warnings: []
595
+ };
596
+ if (u === "markdown") {
597
+ const { pretext: o, cleanedMarkdown: l } = kn(n);
598
+ return {
599
+ sourceFormat: u,
600
+ detectedSourceFormat: t,
601
+ pretextSource: o,
602
+ cleanedNativeSource: l,
603
+ warnings: []
604
+ };
605
+ }
606
+ const { pretext: s, cleanedLatex: i, warnings: e } = xn(n);
607
+ return {
608
+ sourceFormat: u,
609
+ detectedSourceFormat: t,
610
+ pretextSource: s,
611
+ cleanedNativeSource: i,
612
+ warnings: e
613
+ };
614
+ } catch (s) {
615
+ return {
616
+ sourceFormat: u,
617
+ detectedSourceFormat: t,
618
+ pretextError: Sn(s),
619
+ warnings: []
620
+ };
621
+ }
622
+ }
623
+ var It = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
624
+ function zn(n) {
625
+ return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
626
+ }
627
+ function Ot(n) {
628
+ throw new Error('Could not dynamically require "' + n + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
629
+ }
630
+ var Ut = { exports: {} };
631
+ var ue;
632
+ function Cn() {
633
+ return ue || (ue = 1, (function(n, r) {
634
+ (function(t) {
635
+ n.exports = t();
636
+ })(function() {
637
+ return (function t(u, s, i) {
638
+ function e(d, _) {
639
+ if (!s[d]) {
640
+ if (!u[d]) {
641
+ var m = typeof Ot == "function" && Ot;
642
+ if (!_ && m) return m(d, !0);
643
+ if (o) return o(d, !0);
644
+ var v = new Error("Cannot find module '" + d + "'");
645
+ throw v.code = "MODULE_NOT_FOUND", v;
646
+ }
647
+ var h = s[d] = { exports: {} };
648
+ u[d][0].call(h.exports, function(g) {
649
+ var f = u[d][1][g];
650
+ return e(f || g);
651
+ }, h, h.exports, t, u, s, i);
652
+ }
653
+ return s[d].exports;
654
+ }
655
+ for (var o = typeof Ot == "function" && Ot, l = 0; l < i.length; l++) e(i[l]);
656
+ return e;
657
+ })({ 1: [function(t, u, s) {
658
+ var i = t("./utils"), e = t("./support"), o = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
659
+ s.encode = function(l) {
660
+ for (var d, _, m, v, h, g, f, b = [], p = 0, w = l.length, S = w, E = i.getTypeOf(l) !== "string"; p < l.length; ) S = w - p, m = E ? (d = l[p++], _ = p < w ? l[p++] : 0, p < w ? l[p++] : 0) : (d = l.charCodeAt(p++), _ = p < w ? l.charCodeAt(p++) : 0, p < w ? l.charCodeAt(p++) : 0), v = d >> 2, h = (3 & d) << 4 | _ >> 4, g = 1 < S ? (15 & _) << 2 | m >> 6 : 64, f = 2 < S ? 63 & m : 64, b.push(o.charAt(v) + o.charAt(h) + o.charAt(g) + o.charAt(f));
661
+ return b.join("");
662
+ }, s.decode = function(l) {
663
+ var d, _, m, v, h, g, f = 0, b = 0, p = "data:";
664
+ if (l.substr(0, p.length) === p) throw new Error("Invalid base64 input, it looks like a data url.");
665
+ var w, S = 3 * (l = l.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
666
+ if (l.charAt(l.length - 1) === o.charAt(64) && S--, l.charAt(l.length - 2) === o.charAt(64) && S--, S % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
667
+ for (w = e.uint8array ? new Uint8Array(0 | S) : new Array(0 | S); f < l.length; ) d = o.indexOf(l.charAt(f++)) << 2 | (v = o.indexOf(l.charAt(f++))) >> 4, _ = (15 & v) << 4 | (h = o.indexOf(l.charAt(f++))) >> 2, m = (3 & h) << 6 | (g = o.indexOf(l.charAt(f++))), w[b++] = d, h !== 64 && (w[b++] = _), g !== 64 && (w[b++] = m);
668
+ return w;
669
+ };
670
+ }, { "./support": 30, "./utils": 32 }], 2: [function(t, u, s) {
671
+ var i = t("./external"), e = t("./stream/DataWorker"), o = t("./stream/Crc32Probe"), l = t("./stream/DataLengthProbe");
672
+ function d(_, m, v, h, g) {
673
+ this.compressedSize = _, this.uncompressedSize = m, this.crc32 = v, this.compression = h, this.compressedContent = g;
674
+ }
675
+ d.prototype = { getContentWorker: function() {
676
+ var _ = new e(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")), m = this;
677
+ return _.on("end", function() {
678
+ if (this.streamInfo.data_length !== m.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
679
+ }), _;
680
+ }, getCompressedWorker: function() {
681
+ return new e(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
682
+ } }, d.createWorkerFrom = function(_, m, v) {
683
+ return _.pipe(new o()).pipe(new l("uncompressedSize")).pipe(m.compressWorker(v)).pipe(new l("compressedSize")).withStreamInfo("compression", m);
684
+ }, u.exports = d;
685
+ }, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(t, u, s) {
686
+ var i = t("./stream/GenericWorker");
687
+ s.STORE = { magic: "\0\0", compressWorker: function() {
688
+ return new i("STORE compression");
689
+ }, uncompressWorker: function() {
690
+ return new i("STORE decompression");
691
+ } }, s.DEFLATE = t("./flate");
692
+ }, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(t, u, s) {
693
+ var i = t("./utils"), e = (function() {
694
+ for (var o, l = [], d = 0; d < 256; d++) {
695
+ o = d;
696
+ for (var _ = 0; _ < 8; _++) o = 1 & o ? 3988292384 ^ o >>> 1 : o >>> 1;
697
+ l[d] = o;
698
+ }
699
+ return l;
700
+ })();
701
+ u.exports = function(o, l) {
702
+ return o !== void 0 && o.length ? i.getTypeOf(o) !== "string" ? (function(d, _, m, v) {
703
+ var h = e, g = v + m;
704
+ d ^= -1;
705
+ for (var f = v; f < g; f++) d = d >>> 8 ^ h[255 & (d ^ _[f])];
706
+ return -1 ^ d;
707
+ })(0 | l, o, o.length, 0) : (function(d, _, m, v) {
708
+ var h = e, g = v + m;
709
+ d ^= -1;
710
+ for (var f = v; f < g; f++) d = d >>> 8 ^ h[255 & (d ^ _.charCodeAt(f))];
711
+ return -1 ^ d;
712
+ })(0 | l, o, o.length, 0) : 0;
713
+ };
714
+ }, { "./utils": 32 }], 5: [function(t, u, s) {
715
+ s.base64 = !1, s.binary = !1, s.dir = !1, s.createFolders = !0, s.date = null, s.compression = null, s.compressionOptions = null, s.comment = null, s.unixPermissions = null, s.dosPermissions = null;
716
+ }, {}], 6: [function(t, u, s) {
717
+ var i = null;
718
+ i = typeof Promise < "u" ? Promise : t("lie"), u.exports = { Promise: i };
719
+ }, { lie: 37 }], 7: [function(t, u, s) {
720
+ var i = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Uint32Array < "u", e = t("pako"), o = t("./utils"), l = t("./stream/GenericWorker"), d = i ? "uint8array" : "array";
721
+ function _(m, v) {
722
+ l.call(this, "FlateWorker/" + m), this._pako = null, this._pakoAction = m, this._pakoOptions = v, this.meta = {};
723
+ }
724
+ s.magic = "\b\0", o.inherits(_, l), _.prototype.processChunk = function(m) {
725
+ this.meta = m.meta, this._pako === null && this._createPako(), this._pako.push(o.transformTo(d, m.data), !1);
726
+ }, _.prototype.flush = function() {
727
+ l.prototype.flush.call(this), this._pako === null && this._createPako(), this._pako.push([], !0);
728
+ }, _.prototype.cleanUp = function() {
729
+ l.prototype.cleanUp.call(this), this._pako = null;
730
+ }, _.prototype._createPako = function() {
731
+ this._pako = new e[this._pakoAction]({ raw: !0, level: this._pakoOptions.level || -1 });
732
+ var m = this;
733
+ this._pako.onData = function(v) {
734
+ m.push({ data: v, meta: m.meta });
735
+ };
736
+ }, s.compressWorker = function(m) {
737
+ return new _("Deflate", m);
738
+ }, s.uncompressWorker = function() {
739
+ return new _("Inflate", {});
740
+ };
741
+ }, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(t, u, s) {
742
+ function i(h, g) {
743
+ var f, b = "";
744
+ for (f = 0; f < g; f++) b += String.fromCharCode(255 & h), h >>>= 8;
745
+ return b;
746
+ }
747
+ function e(h, g, f, b, p, w) {
748
+ var S, E, z = h.file, P = h.compression, D = w !== d.utf8encode, $ = o.transformTo("string", w(z.name)), F = o.transformTo("string", d.utf8encode(z.name)), W = z.comment, J = o.transformTo("string", w(W)), k = o.transformTo("string", d.utf8encode(W)), j = F.length !== z.name.length, c = k.length !== W.length, I = "", Y = "", N = "", tt = z.dir, M = z.date, Q = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
749
+ g && !f || (Q.crc32 = h.crc32, Q.compressedSize = h.compressedSize, Q.uncompressedSize = h.uncompressedSize);
750
+ var O = 0;
751
+ g && (O |= 8), D || !j && !c || (O |= 2048);
752
+ var T = 0, q = 0;
753
+ tt && (T |= 16), p === "UNIX" ? (q = 798, T |= (function(X, st) {
754
+ var lt = X;
755
+ return X || (lt = st ? 16893 : 33204), (65535 & lt) << 16;
756
+ })(z.unixPermissions, tt)) : (q = 20, T |= (function(X) {
757
+ return 63 & (X || 0);
758
+ })(z.dosPermissions)), S = M.getUTCHours(), S <<= 6, S |= M.getUTCMinutes(), S <<= 5, S |= M.getUTCSeconds() / 2, E = M.getUTCFullYear() - 1980, E <<= 4, E |= M.getUTCMonth() + 1, E <<= 5, E |= M.getUTCDate(), j && (Y = i(1, 1) + i(_($), 4) + F, I += "up" + i(Y.length, 2) + Y), c && (N = i(1, 1) + i(_(J), 4) + k, I += "uc" + i(N.length, 2) + N);
759
+ var H = "";
760
+ return H += `
761
+ \0`, H += i(O, 2), H += P.magic, H += i(S, 2), H += i(E, 2), H += i(Q.crc32, 4), H += i(Q.compressedSize, 4), H += i(Q.uncompressedSize, 4), H += i($.length, 2), H += i(I.length, 2), { fileRecord: m.LOCAL_FILE_HEADER + H + $ + I, dirRecord: m.CENTRAL_FILE_HEADER + i(q, 2) + H + i(J.length, 2) + "\0\0\0\0" + i(T, 4) + i(b, 4) + $ + I + J };
762
+ }
763
+ var o = t("../utils"), l = t("../stream/GenericWorker"), d = t("../utf8"), _ = t("../crc32"), m = t("../signature");
764
+ function v(h, g, f, b) {
765
+ l.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = g, this.zipPlatform = f, this.encodeFileName = b, this.streamFiles = h, this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
766
+ }
767
+ o.inherits(v, l), v.prototype.push = function(h) {
768
+ var g = h.meta.percent || 0, f = this.entriesCount, b = this._sources.length;
769
+ this.accumulate ? this.contentBuffer.push(h) : (this.bytesWritten += h.data.length, l.prototype.push.call(this, { data: h.data, meta: { currentFile: this.currentFile, percent: f ? (g + 100 * (f - b - 1)) / f : 100 } }));
770
+ }, v.prototype.openedSource = function(h) {
771
+ this.currentSourceOffset = this.bytesWritten, this.currentFile = h.file.name;
772
+ var g = this.streamFiles && !h.file.dir;
773
+ if (g) {
774
+ var f = e(h, g, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
775
+ this.push({ data: f.fileRecord, meta: { percent: 0 } });
776
+ } else this.accumulate = !0;
777
+ }, v.prototype.closedSource = function(h) {
778
+ this.accumulate = !1;
779
+ var g = this.streamFiles && !h.file.dir, f = e(h, g, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
780
+ if (this.dirRecords.push(f.dirRecord), g) this.push({ data: (function(b) {
781
+ return m.DATA_DESCRIPTOR + i(b.crc32, 4) + i(b.compressedSize, 4) + i(b.uncompressedSize, 4);
782
+ })(h), meta: { percent: 100 } });
783
+ else for (this.push({ data: f.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
784
+ this.currentFile = null;
785
+ }, v.prototype.flush = function() {
786
+ for (var h = this.bytesWritten, g = 0; g < this.dirRecords.length; g++) this.push({ data: this.dirRecords[g], meta: { percent: 100 } });
787
+ var f = this.bytesWritten - h, b = (function(p, w, S, E, z) {
788
+ var P = o.transformTo("string", z(E));
789
+ return m.CENTRAL_DIRECTORY_END + "\0\0\0\0" + i(p, 2) + i(p, 2) + i(w, 4) + i(S, 4) + i(P.length, 2) + P;
790
+ })(this.dirRecords.length, f, h, this.zipComment, this.encodeFileName);
791
+ this.push({ data: b, meta: { percent: 100 } });
792
+ }, v.prototype.prepareNextSource = function() {
793
+ this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
794
+ }, v.prototype.registerPrevious = function(h) {
795
+ this._sources.push(h);
796
+ var g = this;
797
+ return h.on("data", function(f) {
798
+ g.processChunk(f);
799
+ }), h.on("end", function() {
800
+ g.closedSource(g.previous.streamInfo), g._sources.length ? g.prepareNextSource() : g.end();
801
+ }), h.on("error", function(f) {
802
+ g.error(f);
803
+ }), this;
804
+ }, v.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
+ }, v.prototype.error = function(h) {
807
+ var g = this._sources;
808
+ if (!l.prototype.error.call(this, h)) return !1;
809
+ for (var f = 0; f < g.length; f++) try {
810
+ g[f].error(h);
811
+ } catch {
812
+ }
813
+ return !0;
814
+ }, v.prototype.lock = function() {
815
+ l.prototype.lock.call(this);
816
+ for (var h = this._sources, g = 0; g < h.length; g++) h[g].lock();
817
+ }, u.exports = v;
818
+ }, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(t, u, s) {
819
+ var i = t("../compressions"), e = t("./ZipFileWorker");
820
+ s.generateWorker = function(o, l, d) {
821
+ var _ = new e(l.streamFiles, d, l.platform, l.encodeFileName), m = 0;
822
+ try {
823
+ o.forEach(function(v, h) {
824
+ m++;
825
+ var g = (function(w, S) {
826
+ var E = w || S, z = i[E];
827
+ if (!z) throw new Error(E + " is not a valid compression method !");
828
+ return z;
829
+ })(h.options.compression, l.compression), f = h.options.compressionOptions || l.compressionOptions || {}, b = h.dir, p = h.date;
830
+ h._compressWorker(g, f).withStreamInfo("file", { name: v, dir: b, date: p, comment: h.comment || "", unixPermissions: h.unixPermissions, dosPermissions: h.dosPermissions }).pipe(_);
831
+ }), _.entriesCount = m;
832
+ } catch (v) {
833
+ _.error(v);
834
+ }
835
+ return _;
836
+ };
837
+ }, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(t, u, s) {
838
+ function i() {
839
+ if (!(this instanceof i)) return new i();
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 e = new i();
843
+ for (var o in this) typeof this[o] != "function" && (e[o] = this[o]);
844
+ return e;
845
+ };
846
+ }
847
+ (i.prototype = t("./object")).loadAsync = t("./load"), i.support = t("./support"), i.defaults = t("./defaults"), i.version = "3.10.1", i.loadAsync = function(e, o) {
848
+ return new i().loadAsync(e, o);
849
+ }, i.external = t("./external"), u.exports = i;
850
+ }, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(t, u, s) {
851
+ var i = t("./utils"), e = t("./external"), o = t("./utf8"), l = t("./zipEntries"), d = t("./stream/Crc32Probe"), _ = t("./nodejsUtils");
852
+ function m(v) {
853
+ return new e.Promise(function(h, g) {
854
+ var f = v.decompressed.getContentWorker().pipe(new d());
855
+ f.on("error", function(b) {
856
+ g(b);
857
+ }).on("end", function() {
858
+ f.streamInfo.crc32 !== v.decompressed.crc32 ? g(new Error("Corrupted zip : CRC32 mismatch")) : h();
859
+ }).resume();
860
+ });
861
+ }
862
+ u.exports = function(v, h) {
863
+ var g = this;
864
+ return h = i.extend(h || {}, { base64: !1, checkCRC32: !1, optimizedBinaryString: !1, createFolders: !1, decodeFileName: o.utf8decode }), _.isNode && _.isStream(v) ? e.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : i.prepareContent("the loaded zip file", v, !0, h.optimizedBinaryString, h.base64).then(function(f) {
865
+ var b = new l(h);
866
+ return b.load(f), b;
867
+ }).then(function(f) {
868
+ var b = [e.Promise.resolve(f)], p = f.files;
869
+ if (h.checkCRC32) for (var w = 0; w < p.length; w++) b.push(m(p[w]));
870
+ return e.Promise.all(b);
871
+ }).then(function(f) {
872
+ for (var b = f.shift(), p = b.files, w = 0; w < p.length; w++) {
873
+ var S = p[w], E = S.fileNameStr, z = i.resolve(S.fileNameStr);
874
+ g.file(z, 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: h.createFolders }), S.dir || (g.file(z).unsafeOriginalName = E);
875
+ }
876
+ return b.zipComment.length && (g.comment = b.zipComment), g;
877
+ });
878
+ };
879
+ }, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(t, u, s) {
880
+ var i = t("../utils"), e = t("../stream/GenericWorker");
881
+ function o(l, d) {
882
+ e.call(this, "Nodejs stream input adapter for " + l), this._upstreamEnded = !1, this._bindStream(d);
883
+ }
884
+ i.inherits(o, e), o.prototype._bindStream = function(l) {
885
+ var d = this;
886
+ (this._stream = l).pause(), l.on("data", function(_) {
887
+ d.push({ data: _, meta: { percent: 0 } });
888
+ }).on("error", function(_) {
889
+ d.isPaused ? this.generatedError = _ : d.error(_);
890
+ }).on("end", function() {
891
+ d.isPaused ? d._upstreamEnded = !0 : d.end();
892
+ });
893
+ }, o.prototype.pause = function() {
894
+ return !!e.prototype.pause.call(this) && (this._stream.pause(), !0);
895
+ }, o.prototype.resume = function() {
896
+ return !!e.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), !0);
897
+ }, u.exports = o;
898
+ }, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(t, u, s) {
899
+ var i = t("readable-stream").Readable;
900
+ function e(o, l, d) {
901
+ i.call(this, l), this._helper = o;
902
+ var _ = this;
903
+ o.on("data", function(m, v) {
904
+ _.push(m) || _._helper.pause(), d && d(v);
905
+ }).on("error", function(m) {
906
+ _.emit("error", m);
907
+ }).on("end", function() {
908
+ _.push(null);
909
+ });
910
+ }
911
+ t("../utils").inherits(e, i), e.prototype._read = function() {
912
+ this._helper.resume();
913
+ }, u.exports = e;
914
+ }, { "../utils": 32, "readable-stream": 16 }], 14: [function(t, u, s) {
915
+ u.exports = { isNode: typeof Buffer < "u", newBufferFrom: function(i, e) {
916
+ if (Buffer.from && Buffer.from !== Uint8Array.from) return Buffer.from(i, e);
917
+ if (typeof i == "number") throw new Error('The "data" argument must not be a number');
918
+ return new Buffer(i, e);
919
+ }, allocBuffer: function(i) {
920
+ if (Buffer.alloc) return Buffer.alloc(i);
921
+ var e = new Buffer(i);
922
+ return e.fill(0), e;
923
+ }, isBuffer: function(i) {
924
+ return Buffer.isBuffer(i);
925
+ }, isStream: function(i) {
926
+ return i && typeof i.on == "function" && typeof i.pause == "function" && typeof i.resume == "function";
927
+ } };
928
+ }, {}], 15: [function(t, u, s) {
929
+ function i(z, P, D) {
930
+ var $, F = o.getTypeOf(P), W = o.extend(D || {}, _);
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 && (z = p(z)), W.createFolders && ($ = b(z)) && w.call(this, $, !0);
932
+ var J = F === "string" && W.binary === !1 && W.base64 === !1;
933
+ D && D.binary !== void 0 || (W.binary = !J), (P instanceof m && P.uncompressedSize === 0 || W.dir || !P || P.length === 0) && (W.base64 = !1, W.binary = !0, P = "", W.compression = "STORE", F = "string");
934
+ var k = null;
935
+ k = P instanceof m || P instanceof l ? P : g.isNode && g.isStream(P) ? new f(z, P) : o.prepareContent(z, P, W.binary, W.optimizedBinaryString, W.base64);
936
+ var j = new v(z, k, W);
937
+ this.files[z] = j;
938
+ }
939
+ var e = t("./utf8"), o = t("./utils"), l = t("./stream/GenericWorker"), d = t("./stream/StreamHelper"), _ = t("./defaults"), m = t("./compressedObject"), v = t("./zipObject"), h = t("./generate"), g = t("./nodejsUtils"), f = t("./nodejs/NodejsStreamInputAdapter"), b = function(z) {
940
+ z.slice(-1) === "/" && (z = z.substring(0, z.length - 1));
941
+ var P = z.lastIndexOf("/");
942
+ return 0 < P ? z.substring(0, P) : "";
943
+ }, p = function(z) {
944
+ return z.slice(-1) !== "/" && (z += "/"), z;
945
+ }, w = function(z, P) {
946
+ return P = P !== void 0 ? P : _.createFolders, z = p(z), this.files[z] || i.call(this, z, null, { dir: !0, createFolders: P }), this.files[z];
947
+ };
948
+ function S(z) {
949
+ return Object.prototype.toString.call(z) === "[object RegExp]";
950
+ }
951
+ var E = { load: function() {
952
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
953
+ }, forEach: function(z) {
954
+ var P, D, $;
955
+ for (P in this.files) $ = this.files[P], (D = P.slice(this.root.length, P.length)) && P.slice(0, this.root.length) === this.root && z(D, $);
956
+ }, filter: function(z) {
957
+ var P = [];
958
+ return this.forEach(function(D, $) {
959
+ z(D, $) && P.push($);
960
+ }), P;
961
+ }, file: function(z, P, D) {
962
+ if (arguments.length !== 1) return z = this.root + z, i.call(this, z, P, D), this;
963
+ if (S(z)) {
964
+ var $ = z;
965
+ return this.filter(function(W, J) {
966
+ return !J.dir && $.test(W);
967
+ });
968
+ }
969
+ var F = this.files[this.root + z];
970
+ return F && !F.dir ? F : null;
971
+ }, folder: function(z) {
972
+ if (!z) return this;
973
+ if (S(z)) return this.filter(function(F, W) {
974
+ return W.dir && z.test(F);
975
+ });
976
+ var P = this.root + z, D = w.call(this, P), $ = this.clone();
977
+ return $.root = D.name, $;
978
+ }, remove: function(z) {
979
+ z = this.root + z;
980
+ var P = this.files[z];
981
+ if (P || (z.slice(-1) !== "/" && (z += "/"), P = this.files[z]), P && !P.dir) delete this.files[z];
982
+ else for (var D = this.filter(function(F, W) {
983
+ return W.name.slice(0, z.length) === z;
984
+ }), $ = 0; $ < D.length; $++) delete this.files[D[$].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(z) {
989
+ var P, D = {};
990
+ try {
991
+ if ((D = o.extend(z || {}, { streamFiles: !1, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: e.utf8encode })).type = D.type.toLowerCase(), D.compression = D.compression.toUpperCase(), D.type === "binarystring" && (D.type = "string"), !D.type) throw new Error("No output type specified.");
992
+ o.checkSupport(D.type), D.platform !== "darwin" && D.platform !== "freebsd" && D.platform !== "linux" && D.platform !== "sunos" || (D.platform = "UNIX"), D.platform === "win32" && (D.platform = "DOS");
993
+ var $ = D.comment || this.comment || "";
994
+ P = h.generateWorker(this, D, $);
995
+ } catch (F) {
996
+ (P = new l("error")).error(F);
997
+ }
998
+ return new d(P, D.type || "string", D.mimeType);
999
+ }, generateAsync: function(z, P) {
1000
+ return this.generateInternalStream(z).accumulate(P);
1001
+ }, generateNodeStream: function(z, P) {
1002
+ return (z = z || {}).type || (z.type = "nodebuffer"), this.generateInternalStream(z).toNodejsStream(P);
1003
+ } };
1004
+ u.exports = E;
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(t, u, s) {
1006
+ u.exports = t("stream");
1007
+ }, { stream: void 0 }], 17: [function(t, u, s) {
1008
+ var i = t("./DataReader");
1009
+ function e(o) {
1010
+ i.call(this, o);
1011
+ for (var l = 0; l < this.data.length; l++) o[l] = 255 & o[l];
1012
+ }
1013
+ t("../utils").inherits(e, i), e.prototype.byteAt = function(o) {
1014
+ return this.data[this.zero + o];
1015
+ }, e.prototype.lastIndexOfSignature = function(o) {
1016
+ for (var l = o.charCodeAt(0), d = o.charCodeAt(1), _ = o.charCodeAt(2), m = o.charCodeAt(3), v = this.length - 4; 0 <= v; --v) if (this.data[v] === l && this.data[v + 1] === d && this.data[v + 2] === _ && this.data[v + 3] === m) return v - this.zero;
1017
+ return -1;
1018
+ }, e.prototype.readAndCheckSignature = function(o) {
1019
+ var l = o.charCodeAt(0), d = o.charCodeAt(1), _ = o.charCodeAt(2), m = o.charCodeAt(3), v = this.readData(4);
1020
+ return l === v[0] && d === v[1] && _ === v[2] && m === v[3];
1021
+ }, e.prototype.readData = function(o) {
1022
+ if (this.checkOffset(o), o === 0) return [];
1023
+ var l = this.data.slice(this.zero + this.index, this.zero + this.index + o);
1024
+ return this.index += o, l;
1025
+ }, u.exports = e;
1026
+ }, { "../utils": 32, "./DataReader": 18 }], 18: [function(t, u, s) {
1027
+ var i = t("../utils");
1028
+ function e(o) {
1029
+ this.data = o, this.length = o.length, this.index = 0, this.zero = 0;
1030
+ }
1031
+ e.prototype = { checkOffset: function(o) {
1032
+ this.checkIndex(this.index + o);
1033
+ }, checkIndex: function(o) {
1034
+ if (this.length < this.zero + o || o < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + o + "). Corrupted zip ?");
1035
+ }, setIndex: function(o) {
1036
+ this.checkIndex(o), this.index = o;
1037
+ }, skip: function(o) {
1038
+ this.setIndex(this.index + o);
1039
+ }, byteAt: function() {
1040
+ }, readInt: function(o) {
1041
+ var l, d = 0;
1042
+ for (this.checkOffset(o), l = this.index + o - 1; l >= this.index; l--) d = (d << 8) + this.byteAt(l);
1043
+ return this.index += o, d;
1044
+ }, readString: function(o) {
1045
+ return i.transformTo("string", this.readData(o));
1046
+ }, readData: function() {
1047
+ }, lastIndexOfSignature: function() {
1048
+ }, readAndCheckSignature: function() {
1049
+ }, readDate: function() {
1050
+ var o = this.readInt(4);
1051
+ return new Date(Date.UTC(1980 + (o >> 25 & 127), (o >> 21 & 15) - 1, o >> 16 & 31, o >> 11 & 31, o >> 5 & 63, (31 & o) << 1));
1052
+ } }, u.exports = e;
1053
+ }, { "../utils": 32 }], 19: [function(t, u, s) {
1054
+ var i = t("./Uint8ArrayReader");
1055
+ function e(o) {
1056
+ i.call(this, o);
1057
+ }
1058
+ t("../utils").inherits(e, i), e.prototype.readData = function(o) {
1059
+ this.checkOffset(o);
1060
+ var l = this.data.slice(this.zero + this.index, this.zero + this.index + o);
1061
+ return this.index += o, l;
1062
+ }, u.exports = e;
1063
+ }, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(t, u, s) {
1064
+ var i = t("./DataReader");
1065
+ function e(o) {
1066
+ i.call(this, o);
1067
+ }
1068
+ t("../utils").inherits(e, i), e.prototype.byteAt = function(o) {
1069
+ return this.data.charCodeAt(this.zero + o);
1070
+ }, e.prototype.lastIndexOfSignature = function(o) {
1071
+ return this.data.lastIndexOf(o) - this.zero;
1072
+ }, e.prototype.readAndCheckSignature = function(o) {
1073
+ return o === this.readData(4);
1074
+ }, e.prototype.readData = function(o) {
1075
+ this.checkOffset(o);
1076
+ var l = this.data.slice(this.zero + this.index, this.zero + this.index + o);
1077
+ return this.index += o, l;
1078
+ }, u.exports = e;
1079
+ }, { "../utils": 32, "./DataReader": 18 }], 21: [function(t, u, s) {
1080
+ var i = t("./ArrayReader");
1081
+ function e(o) {
1082
+ i.call(this, o);
1083
+ }
1084
+ t("../utils").inherits(e, i), e.prototype.readData = function(o) {
1085
+ if (this.checkOffset(o), o === 0) return new Uint8Array(0);
1086
+ var l = this.data.subarray(this.zero + this.index, this.zero + this.index + o);
1087
+ return this.index += o, l;
1088
+ }, u.exports = e;
1089
+ }, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(t, u, s) {
1090
+ var i = t("../utils"), e = t("../support"), o = t("./ArrayReader"), l = t("./StringReader"), d = t("./NodeBufferReader"), _ = t("./Uint8ArrayReader");
1091
+ u.exports = function(m) {
1092
+ var v = i.getTypeOf(m);
1093
+ return i.checkSupport(v), v !== "string" || e.uint8array ? v === "nodebuffer" ? new d(m) : e.uint8array ? new _(i.transformTo("uint8array", m)) : new o(i.transformTo("array", m)) : new l(m);
1094
+ };
1095
+ }, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(t, u, s) {
1096
+ s.LOCAL_FILE_HEADER = "PK", s.CENTRAL_FILE_HEADER = "PK", s.CENTRAL_DIRECTORY_END = "PK", s.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", s.ZIP64_CENTRAL_DIRECTORY_END = "PK", s.DATA_DESCRIPTOR = "PK\x07\b";
1097
+ }, {}], 24: [function(t, u, s) {
1098
+ var i = t("./GenericWorker"), e = t("../utils");
1099
+ function o(l) {
1100
+ i.call(this, "ConvertWorker to " + l), this.destType = l;
1101
+ }
1102
+ e.inherits(o, i), o.prototype.processChunk = function(l) {
1103
+ this.push({ data: e.transformTo(this.destType, l.data), meta: l.meta });
1104
+ }, u.exports = o;
1105
+ }, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(t, u, s) {
1106
+ var i = t("./GenericWorker"), e = t("../crc32");
1107
+ function o() {
1108
+ i.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
1109
+ }
1110
+ t("../utils").inherits(o, i), o.prototype.processChunk = function(l) {
1111
+ this.streamInfo.crc32 = e(l.data, this.streamInfo.crc32 || 0), this.push(l);
1112
+ }, u.exports = o;
1113
+ }, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(t, u, s) {
1114
+ var i = t("../utils"), e = t("./GenericWorker");
1115
+ function o(l) {
1116
+ e.call(this, "DataLengthProbe for " + l), this.propName = l, this.withStreamInfo(l, 0);
1117
+ }
1118
+ i.inherits(o, e), o.prototype.processChunk = function(l) {
1119
+ if (l) {
1120
+ var d = this.streamInfo[this.propName] || 0;
1121
+ this.streamInfo[this.propName] = d + l.data.length;
1122
+ }
1123
+ e.prototype.processChunk.call(this, l);
1124
+ }, u.exports = o;
1125
+ }, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(t, u, s) {
1126
+ var i = t("../utils"), e = t("./GenericWorker");
1127
+ function o(l) {
1128
+ e.call(this, "DataWorker");
1129
+ var d = this;
1130
+ this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = !1, l.then(function(_) {
1131
+ d.dataIsReady = !0, d.data = _, d.max = _ && _.length || 0, d.type = i.getTypeOf(_), d.isPaused || d._tickAndRepeat();
1132
+ }, function(_) {
1133
+ d.error(_);
1134
+ });
1135
+ }
1136
+ i.inherits(o, e), o.prototype.cleanUp = function() {
1137
+ e.prototype.cleanUp.call(this), this.data = null;
1138
+ }, o.prototype.resume = function() {
1139
+ return !!e.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, i.delay(this._tickAndRepeat, [], this)), !0);
1140
+ }, o.prototype._tickAndRepeat = function() {
1141
+ this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (i.delay(this._tickAndRepeat, [], this), this._tickScheduled = !0));
1142
+ }, o.prototype._tick = function() {
1143
+ if (this.isPaused || this.isFinished) return !1;
1144
+ var l = null, d = 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, d);
1149
+ break;
1150
+ case "uint8array":
1151
+ l = this.data.subarray(this.index, d);
1152
+ break;
1153
+ case "array":
1154
+ case "nodebuffer":
1155
+ l = this.data.slice(this.index, d);
1156
+ }
1157
+ return this.index = d, this.push({ data: l, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
1158
+ }, u.exports = o;
1159
+ }, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(t, u, s) {
1160
+ function i(e) {
1161
+ this.name = e || "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
+ i.prototype = { push: function(e) {
1164
+ this.emit("data", e);
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 (e) {
1171
+ this.emit("error", e);
1172
+ }
1173
+ return !0;
1174
+ }, error: function(e) {
1175
+ return !this.isFinished && (this.isPaused ? this.generatedError = e : (this.isFinished = !0, this.emit("error", e), this.previous && this.previous.error(e), this.cleanUp()), !0);
1176
+ }, on: function(e, o) {
1177
+ return this._listeners[e].push(o), this;
1178
+ }, cleanUp: function() {
1179
+ this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
1180
+ }, emit: function(e, o) {
1181
+ if (this._listeners[e]) for (var l = 0; l < this._listeners[e].length; l++) this._listeners[e][l].call(this, o);
1182
+ }, pipe: function(e) {
1183
+ return e.registerPrevious(this);
1184
+ }, registerPrevious: function(e) {
1185
+ if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
1186
+ this.streamInfo = e.streamInfo, this.mergeStreamInfo(), this.previous = e;
1187
+ var o = this;
1188
+ return e.on("data", function(l) {
1189
+ o.processChunk(l);
1190
+ }), e.on("end", function() {
1191
+ o.end();
1192
+ }), e.on("error", function(l) {
1193
+ o.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 e = this.isPaused = !1;
1200
+ return this.generatedError && (this.error(this.generatedError), e = !0), this.previous && this.previous.resume(), !e;
1201
+ }, flush: function() {
1202
+ }, processChunk: function(e) {
1203
+ this.push(e);
1204
+ }, withStreamInfo: function(e, o) {
1205
+ return this.extraStreamInfo[e] = o, this.mergeStreamInfo(), this;
1206
+ }, mergeStreamInfo: function() {
1207
+ for (var e in this.extraStreamInfo) Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e) && (this.streamInfo[e] = this.extraStreamInfo[e]);
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 e = "Worker " + this.name;
1213
+ return this.previous ? this.previous + " -> " + e : e;
1214
+ } }, u.exports = i;
1215
+ }, {}], 29: [function(t, u, s) {
1216
+ var i = t("../utils"), e = t("./ConvertWorker"), o = t("./GenericWorker"), l = t("../base64"), d = t("../support"), _ = t("../external"), m = null;
1217
+ if (d.nodestream) try {
1218
+ m = t("../nodejs/NodejsStreamOutputAdapter");
1219
+ } catch {
1220
+ }
1221
+ function v(g, f) {
1222
+ return new _.Promise(function(b, p) {
1223
+ var w = [], S = g._internalType, E = g._outputType, z = g._mimeType;
1224
+ g.on("data", function(P, D) {
1225
+ w.push(P), f && f(D);
1226
+ }).on("error", function(P) {
1227
+ w = [], p(P);
1228
+ }).on("end", function() {
1229
+ try {
1230
+ var P = (function(D, $, F) {
1231
+ switch (D) {
1232
+ case "blob":
1233
+ return i.newBlob(i.transformTo("arraybuffer", $), F);
1234
+ case "base64":
1235
+ return l.encode($);
1236
+ default:
1237
+ return i.transformTo(D, $);
1238
+ }
1239
+ })(E, (function(D, $) {
1240
+ var F, W = 0, J = null, k = 0;
1241
+ for (F = 0; F < $.length; F++) k += $[F].length;
1242
+ switch (D) {
1243
+ case "string":
1244
+ return $.join("");
1245
+ case "array":
1246
+ return Array.prototype.concat.apply([], $);
1247
+ case "uint8array":
1248
+ for (J = new Uint8Array(k), F = 0; F < $.length; F++) J.set($[F], W), W += $[F].length;
1249
+ return J;
1250
+ case "nodebuffer":
1251
+ return Buffer.concat($);
1252
+ default:
1253
+ throw new Error("concat : unsupported type '" + D + "'");
1254
+ }
1255
+ })(S, w), z);
1256
+ b(P);
1257
+ } catch (D) {
1258
+ p(D);
1259
+ }
1260
+ w = [];
1261
+ }).resume();
1262
+ });
1263
+ }
1264
+ function h(g, f, b) {
1265
+ var p = f;
1266
+ switch (f) {
1267
+ case "blob":
1268
+ case "arraybuffer":
1269
+ p = "uint8array";
1270
+ break;
1271
+ case "base64":
1272
+ p = "string";
1273
+ }
1274
+ try {
1275
+ this._internalType = p, this._outputType = f, this._mimeType = b, i.checkSupport(p), this._worker = g.pipe(new e(p)), g.lock();
1276
+ } catch (w) {
1277
+ this._worker = new o("error"), this._worker.error(w);
1278
+ }
1279
+ }
1280
+ h.prototype = { accumulate: function(g) {
1281
+ return v(this, g);
1282
+ }, on: function(g, f) {
1283
+ var b = this;
1284
+ return g === "data" ? this._worker.on(g, function(p) {
1285
+ f.call(b, p.data, p.meta);
1286
+ }) : this._worker.on(g, function() {
1287
+ i.delay(f, arguments, b);
1288
+ }), this;
1289
+ }, resume: function() {
1290
+ return i.delay(this._worker.resume, [], this._worker), this;
1291
+ }, pause: function() {
1292
+ return this._worker.pause(), this;
1293
+ }, toNodejsStream: function(g) {
1294
+ if (i.checkSupport("nodestream"), this._outputType !== "nodebuffer") throw new Error(this._outputType + " is not supported by this method");
1295
+ return new m(this, { objectMode: this._outputType !== "nodebuffer" }, g);
1296
+ } }, u.exports = h;
1297
+ }, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(t, u, s) {
1298
+ if (s.base64 = !0, s.array = !0, s.string = !0, s.arraybuffer = typeof ArrayBuffer < "u" && typeof Uint8Array < "u", s.nodebuffer = typeof Buffer < "u", s.uint8array = typeof Uint8Array < "u", typeof ArrayBuffer > "u") s.blob = !1;
1299
+ else {
1300
+ var i = new ArrayBuffer(0);
1301
+ try {
1302
+ s.blob = new Blob([i], { type: "application/zip" }).size === 0;
1303
+ } catch {
1304
+ try {
1305
+ var e = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1306
+ e.append(i), s.blob = e.getBlob("application/zip").size === 0;
1307
+ } catch {
1308
+ s.blob = !1;
1309
+ }
1310
+ }
1311
+ }
1312
+ try {
1313
+ s.nodestream = !!t("readable-stream").Readable;
1314
+ } catch {
1315
+ s.nodestream = !1;
1316
+ }
1317
+ }, { "readable-stream": 16 }], 31: [function(t, u, s) {
1318
+ for (var i = t("./utils"), e = t("./support"), o = t("./nodejsUtils"), l = t("./stream/GenericWorker"), d = new Array(256), _ = 0; _ < 256; _++) d[_] = 252 <= _ ? 6 : 248 <= _ ? 5 : 240 <= _ ? 4 : 224 <= _ ? 3 : 192 <= _ ? 2 : 1;
1319
+ d[254] = d[254] = 1;
1320
+ function m() {
1321
+ l.call(this, "utf-8 decode"), this.leftOver = null;
1322
+ }
1323
+ function v() {
1324
+ l.call(this, "utf-8 encode");
1325
+ }
1326
+ s.utf8encode = function(h) {
1327
+ return e.nodebuffer ? o.newBufferFrom(h, "utf-8") : (function(g) {
1328
+ var f, b, p, w, S, E = g.length, z = 0;
1329
+ for (w = 0; w < E; w++) (64512 & (b = g.charCodeAt(w))) == 55296 && w + 1 < E && (64512 & (p = g.charCodeAt(w + 1))) == 56320 && (b = 65536 + (b - 55296 << 10) + (p - 56320), w++), z += b < 128 ? 1 : b < 2048 ? 2 : b < 65536 ? 3 : 4;
1330
+ for (f = e.uint8array ? new Uint8Array(z) : new Array(z), w = S = 0; S < z; w++) (64512 & (b = g.charCodeAt(w))) == 55296 && w + 1 < E && (64512 & (p = g.charCodeAt(w + 1))) == 56320 && (b = 65536 + (b - 55296 << 10) + (p - 56320), w++), b < 128 ? f[S++] = b : (b < 2048 ? f[S++] = 192 | b >>> 6 : (b < 65536 ? f[S++] = 224 | b >>> 12 : (f[S++] = 240 | b >>> 18, f[S++] = 128 | b >>> 12 & 63), f[S++] = 128 | b >>> 6 & 63), f[S++] = 128 | 63 & b);
1331
+ return f;
1332
+ })(h);
1333
+ }, s.utf8decode = function(h) {
1334
+ return e.nodebuffer ? i.transformTo("nodebuffer", h).toString("utf-8") : (function(g) {
1335
+ var f, b, p, w, S = g.length, E = new Array(2 * S);
1336
+ for (f = b = 0; f < S; ) if ((p = g[f++]) < 128) E[b++] = p;
1337
+ else if (4 < (w = d[p])) E[b++] = 65533, f += w - 1;
1338
+ else {
1339
+ for (p &= w === 2 ? 31 : w === 3 ? 15 : 7; 1 < w && f < S; ) p = p << 6 | 63 & g[f++], w--;
1340
+ 1 < w ? E[b++] = 65533 : p < 65536 ? E[b++] = p : (p -= 65536, E[b++] = 55296 | p >> 10 & 1023, E[b++] = 56320 | 1023 & p);
1341
+ }
1342
+ return E.length !== b && (E.subarray ? E = E.subarray(0, b) : E.length = b), i.applyFromCharCode(E);
1343
+ })(h = i.transformTo(e.uint8array ? "uint8array" : "array", h));
1344
+ }, i.inherits(m, l), m.prototype.processChunk = function(h) {
1345
+ var g = i.transformTo(e.uint8array ? "uint8array" : "array", h.data);
1346
+ if (this.leftOver && this.leftOver.length) {
1347
+ if (e.uint8array) {
1348
+ var f = g;
1349
+ (g = new Uint8Array(f.length + this.leftOver.length)).set(this.leftOver, 0), g.set(f, this.leftOver.length);
1350
+ } else g = this.leftOver.concat(g);
1351
+ this.leftOver = null;
1352
+ }
1353
+ var b = (function(w, S) {
1354
+ var E;
1355
+ for ((S = S || w.length) > w.length && (S = w.length), E = S - 1; 0 <= E && (192 & w[E]) == 128; ) E--;
1356
+ return E < 0 || E === 0 ? S : E + d[w[E]] > S ? E : S;
1357
+ })(g), p = g;
1358
+ b !== g.length && (e.uint8array ? (p = g.subarray(0, b), this.leftOver = g.subarray(b, g.length)) : (p = g.slice(0, b), this.leftOver = g.slice(b, g.length))), this.push({ data: s.utf8decode(p), meta: h.meta });
1359
+ }, m.prototype.flush = function() {
1360
+ this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
1361
+ }, s.Utf8DecodeWorker = m, i.inherits(v, l), v.prototype.processChunk = function(h) {
1362
+ this.push({ data: s.utf8encode(h.data), meta: h.meta });
1363
+ }, s.Utf8EncodeWorker = v;
1364
+ }, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(t, u, s) {
1365
+ var i = t("./support"), e = t("./base64"), o = t("./nodejsUtils"), l = t("./external");
1366
+ function d(f) {
1367
+ return f;
1368
+ }
1369
+ function _(f, b) {
1370
+ for (var p = 0; p < f.length; ++p) b[p] = 255 & f.charCodeAt(p);
1371
+ return b;
1372
+ }
1373
+ t("setimmediate"), s.newBlob = function(f, b) {
1374
+ s.checkSupport("blob");
1375
+ try {
1376
+ return new Blob([f], { type: b });
1377
+ } catch {
1378
+ try {
1379
+ var p = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
1380
+ return p.append(f), p.getBlob(b);
1381
+ } catch {
1382
+ throw new Error("Bug : can't construct the Blob.");
1383
+ }
1384
+ }
1385
+ };
1386
+ var m = { stringifyByChunk: function(f, b, p) {
1387
+ var w = [], S = 0, E = f.length;
1388
+ if (E <= p) return String.fromCharCode.apply(null, f);
1389
+ for (; S < E; ) b === "array" || b === "nodebuffer" ? w.push(String.fromCharCode.apply(null, f.slice(S, Math.min(S + p, E)))) : w.push(String.fromCharCode.apply(null, f.subarray(S, Math.min(S + p, E)))), S += p;
1390
+ return w.join("");
1391
+ }, stringifyByChar: function(f) {
1392
+ for (var b = "", p = 0; p < f.length; p++) b += String.fromCharCode(f[p]);
1393
+ return b;
1394
+ }, applyCanBeUsed: { uint8array: (function() {
1395
+ try {
1396
+ return i.uint8array && String.fromCharCode.apply(null, new Uint8Array(1)).length === 1;
1397
+ } catch {
1398
+ return !1;
1399
+ }
1400
+ })(), nodebuffer: (function() {
1401
+ try {
1402
+ return i.nodebuffer && String.fromCharCode.apply(null, o.allocBuffer(1)).length === 1;
1403
+ } catch {
1404
+ return !1;
1405
+ }
1406
+ })() } };
1407
+ function v(f) {
1408
+ var b = 65536, p = s.getTypeOf(f), w = !0;
1409
+ if (p === "uint8array" ? w = m.applyCanBeUsed.uint8array : p === "nodebuffer" && (w = m.applyCanBeUsed.nodebuffer), w) for (; 1 < b; ) try {
1410
+ return m.stringifyByChunk(f, p, b);
1411
+ } catch {
1412
+ b = Math.floor(b / 2);
1413
+ }
1414
+ return m.stringifyByChar(f);
1415
+ }
1416
+ function h(f, b) {
1417
+ for (var p = 0; p < f.length; p++) b[p] = f[p];
1418
+ return b;
1419
+ }
1420
+ s.applyFromCharCode = v;
1421
+ var g = {};
1422
+ g.string = { string: d, array: function(f) {
1423
+ return _(f, new Array(f.length));
1424
+ }, arraybuffer: function(f) {
1425
+ return g.string.uint8array(f).buffer;
1426
+ }, uint8array: function(f) {
1427
+ return _(f, new Uint8Array(f.length));
1428
+ }, nodebuffer: function(f) {
1429
+ return _(f, o.allocBuffer(f.length));
1430
+ } }, g.array = { string: v, array: d, arraybuffer: function(f) {
1431
+ return new Uint8Array(f).buffer;
1432
+ }, uint8array: function(f) {
1433
+ return new Uint8Array(f);
1434
+ }, nodebuffer: function(f) {
1435
+ return o.newBufferFrom(f);
1436
+ } }, g.arraybuffer = { string: function(f) {
1437
+ return v(new Uint8Array(f));
1438
+ }, array: function(f) {
1439
+ return h(new Uint8Array(f), new Array(f.byteLength));
1440
+ }, arraybuffer: d, uint8array: function(f) {
1441
+ return new Uint8Array(f);
1442
+ }, nodebuffer: function(f) {
1443
+ return o.newBufferFrom(new Uint8Array(f));
1444
+ } }, g.uint8array = { string: v, array: function(f) {
1445
+ return h(f, new Array(f.length));
1446
+ }, arraybuffer: function(f) {
1447
+ return f.buffer;
1448
+ }, uint8array: d, nodebuffer: function(f) {
1449
+ return o.newBufferFrom(f);
1450
+ } }, g.nodebuffer = { string: v, array: function(f) {
1451
+ return h(f, new Array(f.length));
1452
+ }, arraybuffer: function(f) {
1453
+ return g.nodebuffer.uint8array(f).buffer;
1454
+ }, uint8array: function(f) {
1455
+ return h(f, new Uint8Array(f.length));
1456
+ }, nodebuffer: d }, s.transformTo = function(f, b) {
1457
+ if (b = b || "", !f) return b;
1458
+ s.checkSupport(f);
1459
+ var p = s.getTypeOf(b);
1460
+ return g[p][f](b);
1461
+ }, s.resolve = function(f) {
1462
+ for (var b = f.split("/"), p = [], w = 0; w < b.length; w++) {
1463
+ var S = b[w];
1464
+ S === "." || S === "" && w !== 0 && w !== b.length - 1 || (S === ".." ? p.pop() : p.push(S));
1465
+ }
1466
+ return p.join("/");
1467
+ }, s.getTypeOf = function(f) {
1468
+ return typeof f == "string" ? "string" : Object.prototype.toString.call(f) === "[object Array]" ? "array" : i.nodebuffer && o.isBuffer(f) ? "nodebuffer" : i.uint8array && f instanceof Uint8Array ? "uint8array" : i.arraybuffer && f instanceof ArrayBuffer ? "arraybuffer" : void 0;
1469
+ }, s.checkSupport = function(f) {
1470
+ if (!i[f.toLowerCase()]) throw new Error(f + " is not supported by this platform");
1471
+ }, s.MAX_VALUE_16BITS = 65535, s.MAX_VALUE_32BITS = -1, s.pretty = function(f) {
1472
+ var b, p, w = "";
1473
+ for (p = 0; p < (f || "").length; p++) w += "\\x" + ((b = f.charCodeAt(p)) < 16 ? "0" : "") + b.toString(16).toUpperCase();
1474
+ return w;
1475
+ }, s.delay = function(f, b, p) {
1476
+ setImmediate(function() {
1477
+ f.apply(p || null, b || []);
1478
+ });
1479
+ }, s.inherits = function(f, b) {
1480
+ function p() {
1481
+ }
1482
+ p.prototype = b.prototype, f.prototype = new p();
1483
+ }, s.extend = function() {
1484
+ var f, b, p = {};
1485
+ for (f = 0; f < arguments.length; f++) for (b in arguments[f]) Object.prototype.hasOwnProperty.call(arguments[f], b) && p[b] === void 0 && (p[b] = arguments[f][b]);
1486
+ return p;
1487
+ }, s.prepareContent = function(f, b, p, w, S) {
1488
+ return l.Promise.resolve(b).then(function(E) {
1489
+ return i.blob && (E instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(E)) !== -1) && typeof FileReader < "u" ? new l.Promise(function(z, P) {
1490
+ var D = new FileReader();
1491
+ D.onload = function($) {
1492
+ z($.target.result);
1493
+ }, D.onerror = function($) {
1494
+ P($.target.error);
1495
+ }, D.readAsArrayBuffer(E);
1496
+ }) : E;
1497
+ }).then(function(E) {
1498
+ var z = s.getTypeOf(E);
1499
+ return z ? (z === "arraybuffer" ? E = s.transformTo("uint8array", E) : z === "string" && (S ? E = e.decode(E) : p && w !== !0 && (E = (function(P) {
1500
+ return _(P, i.uint8array ? new Uint8Array(P.length) : new Array(P.length));
1501
+ })(E))), E) : l.Promise.reject(new Error("Can't read the data of '" + f + "'. 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(t, u, s) {
1505
+ var i = t("./reader/readerFor"), e = t("./utils"), o = t("./signature"), l = t("./zipEntry"), d = t("./support");
1506
+ function _(m) {
1507
+ this.files = [], this.loadOptions = m;
1508
+ }
1509
+ _.prototype = { checkSignature: function(m) {
1510
+ if (!this.reader.readAndCheckSignature(m)) {
1511
+ this.reader.index -= 4;
1512
+ var v = this.reader.readString(4);
1513
+ throw new Error("Corrupted zip or bug: unexpected signature (" + e.pretty(v) + ", expected " + e.pretty(m) + ")");
1514
+ }
1515
+ }, isSignature: function(m, v) {
1516
+ var h = this.reader.index;
1517
+ this.reader.setIndex(m);
1518
+ var g = this.reader.readString(4) === v;
1519
+ return this.reader.setIndex(h), g;
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 m = this.reader.readData(this.zipCommentLength), v = d.uint8array ? "uint8array" : "array", h = e.transformTo(v, m);
1523
+ this.zipComment = this.loadOptions.decodeFileName(h);
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 m, v, h, g = this.zip64EndOfCentralSize - 44; 0 < g; ) m = this.reader.readInt(2), v = this.reader.readInt(4), h = this.reader.readData(v), this.zip64ExtensibleData[m] = { id: m, length: v, value: h };
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 m, v;
1531
+ for (m = 0; m < this.files.length; m++) v = this.files[m], this.reader.setIndex(v.localHeaderOffset), this.checkSignature(o.LOCAL_FILE_HEADER), v.readLocalPart(this.reader), v.handleUTF8(), v.processAttributes();
1532
+ }, readCentralDir: function() {
1533
+ var m;
1534
+ for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(o.CENTRAL_FILE_HEADER); ) (m = new l({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(m);
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 m = this.reader.lastIndexOfSignature(o.CENTRAL_DIRECTORY_END);
1538
+ if (m < 0) throw this.isSignature(0, o.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(m);
1540
+ var v = m;
1541
+ if (this.checkSignature(o.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === e.MAX_VALUE_16BITS || this.diskWithCentralDirStart === e.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === e.MAX_VALUE_16BITS || this.centralDirRecords === e.MAX_VALUE_16BITS || this.centralDirSize === e.MAX_VALUE_32BITS || this.centralDirOffset === e.MAX_VALUE_32BITS) {
1542
+ if (this.zip64 = !0, (m = this.reader.lastIndexOfSignature(o.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(m), this.checkSignature(o.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, o.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(o.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(o.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
1545
+ }
1546
+ var h = this.centralDirOffset + this.centralDirSize;
1547
+ this.zip64 && (h += 20, h += 12 + this.zip64EndOfCentralSize);
1548
+ var g = v - h;
1549
+ if (0 < g) this.isSignature(v, o.CENTRAL_FILE_HEADER) || (this.reader.zero = g);
1550
+ else if (g < 0) throw new Error("Corrupted zip: missing " + Math.abs(g) + " bytes.");
1551
+ }, prepareReader: function(m) {
1552
+ this.reader = i(m);
1553
+ }, load: function(m) {
1554
+ this.prepareReader(m), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
1555
+ } }, u.exports = _;
1556
+ }, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(t, u, s) {
1557
+ var i = t("./reader/readerFor"), e = t("./utils"), o = t("./compressedObject"), l = t("./crc32"), d = t("./utf8"), _ = t("./compressions"), m = t("./support");
1558
+ function v(h, g) {
1559
+ this.options = h, this.loadOptions = g;
1560
+ }
1561
+ v.prototype = { isEncrypted: function() {
1562
+ return (1 & this.bitFlag) == 1;
1563
+ }, useUTF8: function() {
1564
+ return (2048 & this.bitFlag) == 2048;
1565
+ }, readLocalPart: function(h) {
1566
+ var g, f;
1567
+ if (h.skip(22), this.fileNameLength = h.readInt(2), f = h.readInt(2), this.fileName = h.readData(this.fileNameLength), h.skip(f), 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 ((g = (function(b) {
1569
+ for (var p in _) if (Object.prototype.hasOwnProperty.call(_, p) && _[p].magic === b) return _[p];
1570
+ return null;
1571
+ })(this.compressionMethod)) === null) throw new Error("Corrupted zip : compression " + e.pretty(this.compressionMethod) + " unknown (inner file : " + e.transformTo("string", this.fileName) + ")");
1572
+ this.decompressed = new o(this.compressedSize, this.uncompressedSize, this.crc32, g, h.readData(this.compressedSize));
1573
+ }, readCentralPart: function(h) {
1574
+ this.versionMadeBy = h.readInt(2), h.skip(2), this.bitFlag = h.readInt(2), this.compressionMethod = h.readString(2), this.date = h.readDate(), this.crc32 = h.readInt(4), this.compressedSize = h.readInt(4), this.uncompressedSize = h.readInt(4);
1575
+ var g = h.readInt(2);
1576
+ if (this.extraFieldsLength = h.readInt(2), this.fileCommentLength = h.readInt(2), this.diskNumberStart = h.readInt(2), this.internalFileAttributes = h.readInt(2), this.externalFileAttributes = h.readInt(4), this.localHeaderOffset = h.readInt(4), this.isEncrypted()) throw new Error("Encrypted zip are not supported");
1577
+ h.skip(g), this.readExtraFields(h), this.parseZIP64ExtraField(h), this.fileComment = h.readData(this.fileCommentLength);
1578
+ }, processAttributes: function() {
1579
+ this.unixPermissions = null, this.dosPermissions = null;
1580
+ var h = this.versionMadeBy >> 8;
1581
+ this.dir = !!(16 & this.externalFileAttributes), h == 0 && (this.dosPermissions = 63 & this.externalFileAttributes), h == 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 h = i(this.extraFields[1].value);
1585
+ this.uncompressedSize === e.MAX_VALUE_32BITS && (this.uncompressedSize = h.readInt(8)), this.compressedSize === e.MAX_VALUE_32BITS && (this.compressedSize = h.readInt(8)), this.localHeaderOffset === e.MAX_VALUE_32BITS && (this.localHeaderOffset = h.readInt(8)), this.diskNumberStart === e.MAX_VALUE_32BITS && (this.diskNumberStart = h.readInt(4));
1586
+ }
1587
+ }, readExtraFields: function(h) {
1588
+ var g, f, b, p = h.index + this.extraFieldsLength;
1589
+ for (this.extraFields || (this.extraFields = {}); h.index + 4 < p; ) g = h.readInt(2), f = h.readInt(2), b = h.readData(f), this.extraFields[g] = { id: g, length: f, value: b };
1590
+ h.setIndex(p);
1591
+ }, handleUTF8: function() {
1592
+ var h = m.uint8array ? "uint8array" : "array";
1593
+ if (this.useUTF8()) this.fileNameStr = d.utf8decode(this.fileName), this.fileCommentStr = d.utf8decode(this.fileComment);
1594
+ else {
1595
+ var g = this.findExtraFieldUnicodePath();
1596
+ if (g !== null) this.fileNameStr = g;
1597
+ else {
1598
+ var f = e.transformTo(h, this.fileName);
1599
+ this.fileNameStr = this.loadOptions.decodeFileName(f);
1600
+ }
1601
+ var b = this.findExtraFieldUnicodeComment();
1602
+ if (b !== null) this.fileCommentStr = b;
1603
+ else {
1604
+ var p = e.transformTo(h, this.fileComment);
1605
+ this.fileCommentStr = this.loadOptions.decodeFileName(p);
1606
+ }
1607
+ }
1608
+ }, findExtraFieldUnicodePath: function() {
1609
+ var h = this.extraFields[28789];
1610
+ if (h) {
1611
+ var g = i(h.value);
1612
+ return g.readInt(1) !== 1 || l(this.fileName) !== g.readInt(4) ? null : d.utf8decode(g.readData(h.length - 5));
1613
+ }
1614
+ return null;
1615
+ }, findExtraFieldUnicodeComment: function() {
1616
+ var h = this.extraFields[25461];
1617
+ if (h) {
1618
+ var g = i(h.value);
1619
+ return g.readInt(1) !== 1 || l(this.fileComment) !== g.readInt(4) ? null : d.utf8decode(g.readData(h.length - 5));
1620
+ }
1621
+ return null;
1622
+ } }, u.exports = v;
1623
+ }, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(t, u, s) {
1624
+ function i(g, f, b) {
1625
+ this.name = g, this.dir = b.dir, this.date = b.date, this.comment = b.comment, this.unixPermissions = b.unixPermissions, this.dosPermissions = b.dosPermissions, this._data = f, this._dataBinary = b.binary, this.options = { compression: b.compression, compressionOptions: b.compressionOptions };
1626
+ }
1627
+ var e = t("./stream/StreamHelper"), o = t("./stream/DataWorker"), l = t("./utf8"), d = t("./compressedObject"), _ = t("./stream/GenericWorker");
1628
+ i.prototype = { internalStream: function(g) {
1629
+ var f = null, b = "string";
1630
+ try {
1631
+ if (!g) throw new Error("No output type specified.");
1632
+ var p = (b = g.toLowerCase()) === "string" || b === "text";
1633
+ b !== "binarystring" && b !== "text" || (b = "string"), f = this._decompressWorker();
1634
+ var w = !this._dataBinary;
1635
+ w && !p && (f = f.pipe(new l.Utf8EncodeWorker())), !w && p && (f = f.pipe(new l.Utf8DecodeWorker()));
1636
+ } catch (S) {
1637
+ (f = new _("error")).error(S);
1638
+ }
1639
+ return new e(f, b, "");
1640
+ }, async: function(g, f) {
1641
+ return this.internalStream(g).accumulate(f);
1642
+ }, nodeStream: function(g, f) {
1643
+ return this.internalStream(g || "nodebuffer").toNodejsStream(f);
1644
+ }, _compressWorker: function(g, f) {
1645
+ if (this._data instanceof d && this._data.compression.magic === g.magic) return this._data.getCompressedWorker();
1646
+ var b = this._decompressWorker();
1647
+ return this._dataBinary || (b = b.pipe(new l.Utf8EncodeWorker())), d.createWorkerFrom(b, g, f);
1648
+ }, _decompressWorker: function() {
1649
+ return this._data instanceof d ? this._data.getContentWorker() : this._data instanceof _ ? this._data : new o(this._data);
1650
+ } };
1651
+ for (var m = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], v = function() {
1652
+ throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
1653
+ }, h = 0; h < m.length; h++) i.prototype[m[h]] = v;
1654
+ u.exports = i;
1655
+ }, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(t, u, s) {
1656
+ (function(i) {
1657
+ var e, o, l = i.MutationObserver || i.WebKitMutationObserver;
1658
+ if (l) {
1659
+ var d = 0, _ = new l(g), m = i.document.createTextNode("");
1660
+ _.observe(m, { characterData: !0 }), e = function() {
1661
+ m.data = d = ++d % 2;
1662
+ };
1663
+ } else if (i.setImmediate || i.MessageChannel === void 0) e = "document" in i && "onreadystatechange" in i.document.createElement("script") ? function() {
1664
+ var f = i.document.createElement("script");
1665
+ f.onreadystatechange = function() {
1666
+ g(), f.onreadystatechange = null, f.parentNode.removeChild(f), f = null;
1667
+ }, i.document.documentElement.appendChild(f);
1668
+ } : function() {
1669
+ setTimeout(g, 0);
1670
+ };
1671
+ else {
1672
+ var v = new i.MessageChannel();
1673
+ v.port1.onmessage = g, e = function() {
1674
+ v.port2.postMessage(0);
1675
+ };
1676
+ }
1677
+ var h = [];
1678
+ function g() {
1679
+ var f, b;
1680
+ o = !0;
1681
+ for (var p = h.length; p; ) {
1682
+ for (b = h, h = [], f = -1; ++f < p; ) b[f]();
1683
+ p = h.length;
1684
+ }
1685
+ o = !1;
1686
+ }
1687
+ u.exports = function(f) {
1688
+ h.push(f) !== 1 || o || e();
1689
+ };
1690
+ }).call(this, typeof It < "u" ? It : typeof self < "u" ? self : typeof window < "u" ? window : {});
1691
+ }, {}], 37: [function(t, u, s) {
1692
+ var i = t("immediate");
1693
+ function e() {
1694
+ }
1695
+ var o = {}, l = ["REJECTED"], d = ["FULFILLED"], _ = ["PENDING"];
1696
+ function m(p) {
1697
+ if (typeof p != "function") throw new TypeError("resolver must be a function");
1698
+ this.state = _, this.queue = [], this.outcome = void 0, p !== e && f(this, p);
1699
+ }
1700
+ function v(p, w, S) {
1701
+ this.promise = p, typeof w == "function" && (this.onFulfilled = w, this.callFulfilled = this.otherCallFulfilled), typeof S == "function" && (this.onRejected = S, this.callRejected = this.otherCallRejected);
1702
+ }
1703
+ function h(p, w, S) {
1704
+ i(function() {
1705
+ var E;
1706
+ try {
1707
+ E = w(S);
1708
+ } catch (z) {
1709
+ return o.reject(p, z);
1710
+ }
1711
+ E === p ? o.reject(p, new TypeError("Cannot resolve promise with itself")) : o.resolve(p, E);
1712
+ });
1713
+ }
1714
+ function g(p) {
1715
+ var w = p && p.then;
1716
+ if (p && (typeof p == "object" || typeof p == "function") && typeof w == "function") return function() {
1717
+ w.apply(p, arguments);
1718
+ };
1719
+ }
1720
+ function f(p, w) {
1721
+ var S = !1;
1722
+ function E(D) {
1723
+ S || (S = !0, o.reject(p, D));
1724
+ }
1725
+ function z(D) {
1726
+ S || (S = !0, o.resolve(p, D));
1727
+ }
1728
+ var P = b(function() {
1729
+ w(z, E);
1730
+ });
1731
+ P.status === "error" && E(P.value);
1732
+ }
1733
+ function b(p, w) {
1734
+ var S = {};
1735
+ try {
1736
+ S.value = p(w), S.status = "success";
1737
+ } catch (E) {
1738
+ S.status = "error", S.value = E;
1739
+ }
1740
+ return S;
1741
+ }
1742
+ (u.exports = m).prototype.finally = function(p) {
1743
+ if (typeof p != "function") return this;
1744
+ var w = this.constructor;
1745
+ return this.then(function(S) {
1746
+ return w.resolve(p()).then(function() {
1747
+ return S;
1748
+ });
1749
+ }, function(S) {
1750
+ return w.resolve(p()).then(function() {
1751
+ throw S;
1752
+ });
1753
+ });
1754
+ }, m.prototype.catch = function(p) {
1755
+ return this.then(null, p);
1756
+ }, m.prototype.then = function(p, w) {
1757
+ if (typeof p != "function" && this.state === d || typeof w != "function" && this.state === l) return this;
1758
+ var S = new this.constructor(e);
1759
+ return this.state !== _ ? h(S, this.state === d ? p : w, this.outcome) : this.queue.push(new v(S, p, w)), S;
1760
+ }, v.prototype.callFulfilled = function(p) {
1761
+ o.resolve(this.promise, p);
1762
+ }, v.prototype.otherCallFulfilled = function(p) {
1763
+ h(this.promise, this.onFulfilled, p);
1764
+ }, v.prototype.callRejected = function(p) {
1765
+ o.reject(this.promise, p);
1766
+ }, v.prototype.otherCallRejected = function(p) {
1767
+ h(this.promise, this.onRejected, p);
1768
+ }, o.resolve = function(p, w) {
1769
+ var S = b(g, w);
1770
+ if (S.status === "error") return o.reject(p, S.value);
1771
+ var E = S.value;
1772
+ if (E) f(p, E);
1773
+ else {
1774
+ p.state = d, p.outcome = w;
1775
+ for (var z = -1, P = p.queue.length; ++z < P; ) p.queue[z].callFulfilled(w);
1776
+ }
1777
+ return p;
1778
+ }, o.reject = function(p, w) {
1779
+ p.state = l, p.outcome = w;
1780
+ for (var S = -1, E = p.queue.length; ++S < E; ) p.queue[S].callRejected(w);
1781
+ return p;
1782
+ }, m.resolve = function(p) {
1783
+ return p instanceof this ? p : o.resolve(new this(e), p);
1784
+ }, m.reject = function(p) {
1785
+ var w = new this(e);
1786
+ return o.reject(w, p);
1787
+ }, m.all = function(p) {
1788
+ var w = this;
1789
+ if (Object.prototype.toString.call(p) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1790
+ var S = p.length, E = !1;
1791
+ if (!S) return this.resolve([]);
1792
+ for (var z = new Array(S), P = 0, D = -1, $ = new this(e); ++D < S; ) F(p[D], D);
1793
+ return $;
1794
+ function F(W, J) {
1795
+ w.resolve(W).then(function(k) {
1796
+ z[J] = k, ++P !== S || E || (E = !0, o.resolve($, z));
1797
+ }, function(k) {
1798
+ E || (E = !0, o.reject($, k));
1799
+ });
1800
+ }
1801
+ }, m.race = function(p) {
1802
+ var w = this;
1803
+ if (Object.prototype.toString.call(p) !== "[object Array]") return this.reject(new TypeError("must be an array"));
1804
+ var S = p.length, E = !1;
1805
+ if (!S) return this.resolve([]);
1806
+ for (var z = -1, P = new this(e); ++z < S; ) D = p[z], w.resolve(D).then(function($) {
1807
+ E || (E = !0, o.resolve(P, $));
1808
+ }, function($) {
1809
+ E || (E = !0, o.reject(P, $));
1810
+ });
1811
+ var D;
1812
+ return P;
1813
+ };
1814
+ }, { immediate: 36 }], 38: [function(t, u, s) {
1815
+ var i = {};
1816
+ (0, t("./lib/utils/common").assign)(i, t("./lib/deflate"), t("./lib/inflate"), t("./lib/zlib/constants")), u.exports = i;
1817
+ }, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(t, u, s) {
1818
+ var i = t("./zlib/deflate"), e = t("./utils/common"), o = t("./utils/strings"), l = t("./zlib/messages"), d = t("./zlib/zstream"), _ = Object.prototype.toString, m = 0, v = -1, h = 0, g = 8;
1819
+ function f(p) {
1820
+ if (!(this instanceof f)) return new f(p);
1821
+ this.options = e.assign({ level: v, method: g, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: h, to: "" }, p || {});
1822
+ var w = this.options;
1823
+ w.raw && 0 < w.windowBits ? w.windowBits = -w.windowBits : w.gzip && 0 < w.windowBits && w.windowBits < 16 && (w.windowBits += 16), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new d(), this.strm.avail_out = 0;
1824
+ var S = i.deflateInit2(this.strm, w.level, w.method, w.windowBits, w.memLevel, w.strategy);
1825
+ if (S !== m) throw new Error(l[S]);
1826
+ if (w.header && i.deflateSetHeader(this.strm, w.header), w.dictionary) {
1827
+ var E;
1828
+ if (E = typeof w.dictionary == "string" ? o.string2buf(w.dictionary) : _.call(w.dictionary) === "[object ArrayBuffer]" ? new Uint8Array(w.dictionary) : w.dictionary, (S = i.deflateSetDictionary(this.strm, E)) !== m) throw new Error(l[S]);
1829
+ this._dict_set = !0;
1830
+ }
1831
+ }
1832
+ function b(p, w) {
1833
+ var S = new f(w);
1834
+ if (S.push(p, !0), S.err) throw S.msg || l[S.err];
1835
+ return S.result;
1836
+ }
1837
+ f.prototype.push = function(p, w) {
1838
+ var S, E, z = this.strm, P = this.options.chunkSize;
1839
+ if (this.ended) return !1;
1840
+ E = w === ~~w ? w : w === !0 ? 4 : 0, typeof p == "string" ? z.input = o.string2buf(p) : _.call(p) === "[object ArrayBuffer]" ? z.input = new Uint8Array(p) : z.input = p, z.next_in = 0, z.avail_in = z.input.length;
1841
+ do {
1842
+ if (z.avail_out === 0 && (z.output = new e.Buf8(P), z.next_out = 0, z.avail_out = P), (S = i.deflate(z, E)) !== 1 && S !== m) return this.onEnd(S), !(this.ended = !0);
1843
+ z.avail_out !== 0 && (z.avail_in !== 0 || E !== 4 && E !== 2) || (this.options.to === "string" ? this.onData(o.buf2binstring(e.shrinkBuf(z.output, z.next_out))) : this.onData(e.shrinkBuf(z.output, z.next_out)));
1844
+ } while ((0 < z.avail_in || z.avail_out === 0) && S !== 1);
1845
+ return E === 4 ? (S = i.deflateEnd(this.strm), this.onEnd(S), this.ended = !0, S === m) : E !== 2 || (this.onEnd(m), !(z.avail_out = 0));
1846
+ }, f.prototype.onData = function(p) {
1847
+ this.chunks.push(p);
1848
+ }, f.prototype.onEnd = function(p) {
1849
+ p === m && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = e.flattenChunks(this.chunks)), this.chunks = [], this.err = p, this.msg = this.strm.msg;
1850
+ }, s.Deflate = f, s.deflate = b, s.deflateRaw = function(p, w) {
1851
+ return (w = w || {}).raw = !0, b(p, w);
1852
+ }, s.gzip = function(p, w) {
1853
+ return (w = w || {}).gzip = !0, b(p, w);
1854
+ };
1855
+ }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(t, u, s) {
1856
+ var i = t("./zlib/inflate"), e = t("./utils/common"), o = t("./utils/strings"), l = t("./zlib/constants"), d = t("./zlib/messages"), _ = t("./zlib/zstream"), m = t("./zlib/gzheader"), v = Object.prototype.toString;
1857
+ function h(f) {
1858
+ if (!(this instanceof h)) return new h(f);
1859
+ this.options = e.assign({ chunkSize: 16384, windowBits: 0, to: "" }, f || {});
1860
+ var b = this.options;
1861
+ b.raw && 0 <= b.windowBits && b.windowBits < 16 && (b.windowBits = -b.windowBits, b.windowBits === 0 && (b.windowBits = -15)), !(0 <= b.windowBits && b.windowBits < 16) || f && f.windowBits || (b.windowBits += 32), 15 < b.windowBits && b.windowBits < 48 && (15 & b.windowBits) == 0 && (b.windowBits |= 15), this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new _(), this.strm.avail_out = 0;
1862
+ var p = i.inflateInit2(this.strm, b.windowBits);
1863
+ if (p !== l.Z_OK) throw new Error(d[p]);
1864
+ this.header = new m(), i.inflateGetHeader(this.strm, this.header);
1865
+ }
1866
+ function g(f, b) {
1867
+ var p = new h(b);
1868
+ if (p.push(f, !0), p.err) throw p.msg || d[p.err];
1869
+ return p.result;
1870
+ }
1871
+ h.prototype.push = function(f, b) {
1872
+ var p, w, S, E, z, P, D = this.strm, $ = this.options.chunkSize, F = this.options.dictionary, W = !1;
1873
+ if (this.ended) return !1;
1874
+ w = b === ~~b ? b : b === !0 ? l.Z_FINISH : l.Z_NO_FLUSH, typeof f == "string" ? D.input = o.binstring2buf(f) : v.call(f) === "[object ArrayBuffer]" ? D.input = new Uint8Array(f) : D.input = f, D.next_in = 0, D.avail_in = D.input.length;
1875
+ do {
1876
+ if (D.avail_out === 0 && (D.output = new e.Buf8($), D.next_out = 0, D.avail_out = $), (p = i.inflate(D, l.Z_NO_FLUSH)) === l.Z_NEED_DICT && F && (P = typeof F == "string" ? o.string2buf(F) : v.call(F) === "[object ArrayBuffer]" ? new Uint8Array(F) : F, p = i.inflateSetDictionary(this.strm, P)), p === l.Z_BUF_ERROR && W === !0 && (p = l.Z_OK, W = !1), p !== l.Z_STREAM_END && p !== l.Z_OK) return this.onEnd(p), !(this.ended = !0);
1877
+ D.next_out && (D.avail_out !== 0 && p !== l.Z_STREAM_END && (D.avail_in !== 0 || w !== l.Z_FINISH && w !== l.Z_SYNC_FLUSH) || (this.options.to === "string" ? (S = o.utf8border(D.output, D.next_out), E = D.next_out - S, z = o.buf2string(D.output, S), D.next_out = E, D.avail_out = $ - E, E && e.arraySet(D.output, D.output, S, E, 0), this.onData(z)) : this.onData(e.shrinkBuf(D.output, D.next_out)))), D.avail_in === 0 && D.avail_out === 0 && (W = !0);
1878
+ } while ((0 < D.avail_in || D.avail_out === 0) && p !== l.Z_STREAM_END);
1879
+ return p === l.Z_STREAM_END && (w = l.Z_FINISH), w === l.Z_FINISH ? (p = i.inflateEnd(this.strm), this.onEnd(p), this.ended = !0, p === l.Z_OK) : w !== l.Z_SYNC_FLUSH || (this.onEnd(l.Z_OK), !(D.avail_out = 0));
1880
+ }, h.prototype.onData = function(f) {
1881
+ this.chunks.push(f);
1882
+ }, h.prototype.onEnd = function(f) {
1883
+ f === l.Z_OK && (this.options.to === "string" ? this.result = this.chunks.join("") : this.result = e.flattenChunks(this.chunks)), this.chunks = [], this.err = f, this.msg = this.strm.msg;
1884
+ }, s.Inflate = h, s.inflate = g, s.inflateRaw = function(f, b) {
1885
+ return (b = b || {}).raw = !0, g(f, b);
1886
+ }, s.ungzip = g;
1887
+ }, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(t, u, s) {
1888
+ var i = typeof Uint8Array < "u" && typeof Uint16Array < "u" && typeof Int32Array < "u";
1889
+ s.assign = function(l) {
1890
+ for (var d = Array.prototype.slice.call(arguments, 1); d.length; ) {
1891
+ var _ = d.shift();
1892
+ if (_) {
1893
+ if (typeof _ != "object") throw new TypeError(_ + "must be non-object");
1894
+ for (var m in _) _.hasOwnProperty(m) && (l[m] = _[m]);
1895
+ }
1896
+ }
1897
+ return l;
1898
+ }, s.shrinkBuf = function(l, d) {
1899
+ return l.length === d ? l : l.subarray ? l.subarray(0, d) : (l.length = d, l);
1900
+ };
1901
+ var e = { arraySet: function(l, d, _, m, v) {
1902
+ if (d.subarray && l.subarray) l.set(d.subarray(_, _ + m), v);
1903
+ else for (var h = 0; h < m; h++) l[v + h] = d[_ + h];
1904
+ }, flattenChunks: function(l) {
1905
+ var d, _, m, v, h, g;
1906
+ for (d = m = 0, _ = l.length; d < _; d++) m += l[d].length;
1907
+ for (g = new Uint8Array(m), d = v = 0, _ = l.length; d < _; d++) h = l[d], g.set(h, v), v += h.length;
1908
+ return g;
1909
+ } }, o = { arraySet: function(l, d, _, m, v) {
1910
+ for (var h = 0; h < m; h++) l[v + h] = d[_ + h];
1911
+ }, flattenChunks: function(l) {
1912
+ return [].concat.apply([], l);
1913
+ } };
1914
+ s.setTyped = function(l) {
1915
+ l ? (s.Buf8 = Uint8Array, s.Buf16 = Uint16Array, s.Buf32 = Int32Array, s.assign(s, e)) : (s.Buf8 = Array, s.Buf16 = Array, s.Buf32 = Array, s.assign(s, o));
1916
+ }, s.setTyped(i);
1917
+ }, {}], 42: [function(t, u, s) {
1918
+ var i = t("./common"), e = !0, o = !0;
1919
+ try {
1920
+ String.fromCharCode.apply(null, [0]);
1921
+ } catch {
1922
+ e = !1;
1923
+ }
1924
+ try {
1925
+ String.fromCharCode.apply(null, new Uint8Array(1));
1926
+ } catch {
1927
+ o = !1;
1928
+ }
1929
+ for (var l = new i.Buf8(256), d = 0; d < 256; d++) l[d] = 252 <= d ? 6 : 248 <= d ? 5 : 240 <= d ? 4 : 224 <= d ? 3 : 192 <= d ? 2 : 1;
1930
+ function _(m, v) {
1931
+ if (v < 65537 && (m.subarray && o || !m.subarray && e)) return String.fromCharCode.apply(null, i.shrinkBuf(m, v));
1932
+ for (var h = "", g = 0; g < v; g++) h += String.fromCharCode(m[g]);
1933
+ return h;
1934
+ }
1935
+ l[254] = l[254] = 1, s.string2buf = function(m) {
1936
+ var v, h, g, f, b, p = m.length, w = 0;
1937
+ for (f = 0; f < p; f++) (64512 & (h = m.charCodeAt(f))) == 55296 && f + 1 < p && (64512 & (g = m.charCodeAt(f + 1))) == 56320 && (h = 65536 + (h - 55296 << 10) + (g - 56320), f++), w += h < 128 ? 1 : h < 2048 ? 2 : h < 65536 ? 3 : 4;
1938
+ for (v = new i.Buf8(w), f = b = 0; b < w; f++) (64512 & (h = m.charCodeAt(f))) == 55296 && f + 1 < p && (64512 & (g = m.charCodeAt(f + 1))) == 56320 && (h = 65536 + (h - 55296 << 10) + (g - 56320), f++), h < 128 ? v[b++] = h : (h < 2048 ? v[b++] = 192 | h >>> 6 : (h < 65536 ? v[b++] = 224 | h >>> 12 : (v[b++] = 240 | h >>> 18, v[b++] = 128 | h >>> 12 & 63), v[b++] = 128 | h >>> 6 & 63), v[b++] = 128 | 63 & h);
1939
+ return v;
1940
+ }, s.buf2binstring = function(m) {
1941
+ return _(m, m.length);
1942
+ }, s.binstring2buf = function(m) {
1943
+ for (var v = new i.Buf8(m.length), h = 0, g = v.length; h < g; h++) v[h] = m.charCodeAt(h);
1944
+ return v;
1945
+ }, s.buf2string = function(m, v) {
1946
+ var h, g, f, b, p = v || m.length, w = new Array(2 * p);
1947
+ for (h = g = 0; h < p; ) if ((f = m[h++]) < 128) w[g++] = f;
1948
+ else if (4 < (b = l[f])) w[g++] = 65533, h += b - 1;
1949
+ else {
1950
+ for (f &= b === 2 ? 31 : b === 3 ? 15 : 7; 1 < b && h < p; ) f = f << 6 | 63 & m[h++], b--;
1951
+ 1 < b ? w[g++] = 65533 : f < 65536 ? w[g++] = f : (f -= 65536, w[g++] = 55296 | f >> 10 & 1023, w[g++] = 56320 | 1023 & f);
1952
+ }
1953
+ return _(w, g);
1954
+ }, s.utf8border = function(m, v) {
1955
+ var h;
1956
+ for ((v = v || m.length) > m.length && (v = m.length), h = v - 1; 0 <= h && (192 & m[h]) == 128; ) h--;
1957
+ return h < 0 || h === 0 ? v : h + l[m[h]] > v ? h : v;
1958
+ };
1959
+ }, { "./common": 41 }], 43: [function(t, u, s) {
1960
+ u.exports = function(i, e, o, l) {
1961
+ for (var d = 65535 & i | 0, _ = i >>> 16 & 65535 | 0, m = 0; o !== 0; ) {
1962
+ for (o -= m = 2e3 < o ? 2e3 : o; _ = _ + (d = d + e[l++] | 0) | 0, --m; ) ;
1963
+ d %= 65521, _ %= 65521;
1964
+ }
1965
+ return d | _ << 16 | 0;
1966
+ };
1967
+ }, {}], 44: [function(t, u, s) {
1968
+ u.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(t, u, s) {
1970
+ var i = (function() {
1971
+ for (var e, o = [], l = 0; l < 256; l++) {
1972
+ e = l;
1973
+ for (var d = 0; d < 8; d++) e = 1 & e ? 3988292384 ^ e >>> 1 : e >>> 1;
1974
+ o[l] = e;
1975
+ }
1976
+ return o;
1977
+ })();
1978
+ u.exports = function(e, o, l, d) {
1979
+ var _ = i, m = d + l;
1980
+ e ^= -1;
1981
+ for (var v = d; v < m; v++) e = e >>> 8 ^ _[255 & (e ^ o[v])];
1982
+ return -1 ^ e;
1983
+ };
1984
+ }, {}], 46: [function(t, u, s) {
1985
+ var i, e = t("../utils/common"), o = t("./trees"), l = t("./adler32"), d = t("./crc32"), _ = t("./messages"), m = 0, v = 4, h = 0, g = -2, f = -1, b = 4, p = 2, w = 8, S = 9, E = 286, z = 30, P = 19, D = 2 * E + 1, $ = 15, F = 3, W = 258, J = W + F + 1, k = 42, j = 113, c = 1, I = 2, Y = 3, N = 4;
1986
+ function tt(a, B) {
1987
+ return a.msg = _[B], B;
1988
+ }
1989
+ function M(a) {
1990
+ return (a << 1) - (4 < a ? 9 : 0);
1991
+ }
1992
+ function Q(a) {
1993
+ for (var B = a.length; 0 <= --B; ) a[B] = 0;
1994
+ }
1995
+ function O(a) {
1996
+ var B = a.state, R = B.pending;
1997
+ R > a.avail_out && (R = a.avail_out), R !== 0 && (e.arraySet(a.output, B.pending_buf, B.pending_out, R, a.next_out), a.next_out += R, B.pending_out += R, a.total_out += R, a.avail_out -= R, B.pending -= R, B.pending === 0 && (B.pending_out = 0));
1998
+ }
1999
+ function T(a, B) {
2000
+ o._tr_flush_block(a, 0 <= a.block_start ? a.block_start : -1, a.strstart - a.block_start, B), a.block_start = a.strstart, O(a.strm);
2001
+ }
2002
+ function q(a, B) {
2003
+ a.pending_buf[a.pending++] = B;
2004
+ }
2005
+ function H(a, B) {
2006
+ a.pending_buf[a.pending++] = B >>> 8 & 255, a.pending_buf[a.pending++] = 255 & B;
2007
+ }
2008
+ function X(a, B) {
2009
+ var R, x, y = a.max_chain_length, C = a.strstart, L = a.prev_length, U = a.nice_match, A = a.strstart > a.w_size - J ? a.strstart - (a.w_size - J) : 0, Z = a.window, K = a.w_mask, G = a.prev, V = a.strstart + W, it = Z[C + L - 1], nt = Z[C + L];
2010
+ a.prev_length >= a.good_match && (y >>= 2), U > a.lookahead && (U = a.lookahead);
2011
+ do
2012
+ if (Z[(R = B) + L] === nt && Z[R + L - 1] === it && Z[R] === Z[C] && Z[++R] === Z[C + 1]) {
2013
+ C += 2, R++;
2014
+ do
2015
+ ;
2016
+ while (Z[++C] === Z[++R] && Z[++C] === Z[++R] && Z[++C] === Z[++R] && Z[++C] === Z[++R] && Z[++C] === Z[++R] && Z[++C] === Z[++R] && Z[++C] === Z[++R] && Z[++C] === Z[++R] && C < V);
2017
+ if (x = W - (V - C), C = V - W, L < x) {
2018
+ if (a.match_start = B, U <= (L = x)) break;
2019
+ it = Z[C + L - 1], nt = Z[C + L];
2020
+ }
2021
+ }
2022
+ while ((B = G[B & K]) > A && --y != 0);
2023
+ return L <= a.lookahead ? L : a.lookahead;
2024
+ }
2025
+ function st(a) {
2026
+ var B, R, x, y, C, L, U, A, Z, K, G = a.w_size;
2027
+ do {
2028
+ if (y = a.window_size - a.lookahead - a.strstart, a.strstart >= G + (G - J)) {
2029
+ for (e.arraySet(a.window, a.window, G, G, 0), a.match_start -= G, a.strstart -= G, a.block_start -= G, B = R = a.hash_size; x = a.head[--B], a.head[B] = G <= x ? x - G : 0, --R; ) ;
2030
+ for (B = R = G; x = a.prev[--B], a.prev[B] = G <= x ? x - G : 0, --R; ) ;
2031
+ y += G;
2032
+ }
2033
+ if (a.strm.avail_in === 0) break;
2034
+ if (L = a.strm, U = a.window, A = a.strstart + a.lookahead, Z = y, K = void 0, K = L.avail_in, Z < K && (K = Z), R = K === 0 ? 0 : (L.avail_in -= K, e.arraySet(U, L.input, L.next_in, K, A), L.state.wrap === 1 ? L.adler = l(L.adler, U, K, A) : L.state.wrap === 2 && (L.adler = d(L.adler, U, K, A)), L.next_in += K, L.total_in += K, K), a.lookahead += R, a.lookahead + a.insert >= F) for (C = a.strstart - a.insert, a.ins_h = a.window[C], a.ins_h = (a.ins_h << a.hash_shift ^ a.window[C + 1]) & a.hash_mask; a.insert && (a.ins_h = (a.ins_h << a.hash_shift ^ a.window[C + F - 1]) & a.hash_mask, a.prev[C & a.w_mask] = a.head[a.ins_h], a.head[a.ins_h] = C, C++, a.insert--, !(a.lookahead + a.insert < F)); ) ;
2035
+ } while (a.lookahead < J && a.strm.avail_in !== 0);
2036
+ }
2037
+ function lt(a, B) {
2038
+ for (var R, x; ; ) {
2039
+ if (a.lookahead < J) {
2040
+ if (st(a), a.lookahead < J && B === m) return c;
2041
+ if (a.lookahead === 0) break;
2042
+ }
2043
+ if (R = 0, a.lookahead >= F && (a.ins_h = (a.ins_h << a.hash_shift ^ a.window[a.strstart + F - 1]) & a.hash_mask, R = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h], a.head[a.ins_h] = a.strstart), R !== 0 && a.strstart - R <= a.w_size - J && (a.match_length = X(a, R)), a.match_length >= F) if (x = o._tr_tally(a, a.strstart - a.match_start, a.match_length - F), a.lookahead -= a.match_length, a.match_length <= a.max_lazy_match && a.lookahead >= F) {
2044
+ for (a.match_length--; a.strstart++, a.ins_h = (a.ins_h << a.hash_shift ^ a.window[a.strstart + F - 1]) & a.hash_mask, R = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h], a.head[a.ins_h] = a.strstart, --a.match_length != 0; ) ;
2045
+ a.strstart++;
2046
+ } else a.strstart += a.match_length, a.match_length = 0, a.ins_h = a.window[a.strstart], a.ins_h = (a.ins_h << a.hash_shift ^ a.window[a.strstart + 1]) & a.hash_mask;
2047
+ else x = o._tr_tally(a, 0, a.window[a.strstart]), a.lookahead--, a.strstart++;
2048
+ if (x && (T(a, !1), a.strm.avail_out === 0)) return c;
2049
+ }
2050
+ return a.insert = a.strstart < F - 1 ? a.strstart : F - 1, B === v ? (T(a, !0), a.strm.avail_out === 0 ? Y : N) : a.last_lit && (T(a, !1), a.strm.avail_out === 0) ? c : I;
2051
+ }
2052
+ function et(a, B) {
2053
+ for (var R, x, y; ; ) {
2054
+ if (a.lookahead < J) {
2055
+ if (st(a), a.lookahead < J && B === m) return c;
2056
+ if (a.lookahead === 0) break;
2057
+ }
2058
+ if (R = 0, a.lookahead >= F && (a.ins_h = (a.ins_h << a.hash_shift ^ a.window[a.strstart + F - 1]) & a.hash_mask, R = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h], a.head[a.ins_h] = a.strstart), a.prev_length = a.match_length, a.prev_match = a.match_start, a.match_length = F - 1, R !== 0 && a.prev_length < a.max_lazy_match && a.strstart - R <= a.w_size - J && (a.match_length = X(a, R), a.match_length <= 5 && (a.strategy === 1 || a.match_length === F && 4096 < a.strstart - a.match_start) && (a.match_length = F - 1)), a.prev_length >= F && a.match_length <= a.prev_length) {
2059
+ for (y = a.strstart + a.lookahead - F, x = o._tr_tally(a, a.strstart - 1 - a.prev_match, a.prev_length - F), a.lookahead -= a.prev_length - 1, a.prev_length -= 2; ++a.strstart <= y && (a.ins_h = (a.ins_h << a.hash_shift ^ a.window[a.strstart + F - 1]) & a.hash_mask, R = a.prev[a.strstart & a.w_mask] = a.head[a.ins_h], a.head[a.ins_h] = a.strstart), --a.prev_length != 0; ) ;
2060
+ if (a.match_available = 0, a.match_length = F - 1, a.strstart++, x && (T(a, !1), a.strm.avail_out === 0)) return c;
2061
+ } else if (a.match_available) {
2062
+ if ((x = o._tr_tally(a, 0, a.window[a.strstart - 1])) && T(a, !1), a.strstart++, a.lookahead--, a.strm.avail_out === 0) return c;
2063
+ } else a.match_available = 1, a.strstart++, a.lookahead--;
2064
+ }
2065
+ return a.match_available && (x = o._tr_tally(a, 0, a.window[a.strstart - 1]), a.match_available = 0), a.insert = a.strstart < F - 1 ? a.strstart : F - 1, B === v ? (T(a, !0), a.strm.avail_out === 0 ? Y : N) : a.last_lit && (T(a, !1), a.strm.avail_out === 0) ? c : I;
2066
+ }
2067
+ function rt(a, B, R, x, y) {
2068
+ this.good_length = a, this.max_lazy = B, this.nice_length = R, this.max_chain = x, this.func = y;
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 = w, 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 e.Buf16(2 * D), this.dyn_dtree = new e.Buf16(2 * (2 * z + 1)), this.bl_tree = new e.Buf16(2 * (2 * P + 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 e.Buf16($ + 1), this.heap = new e.Buf16(2 * E + 1), Q(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new e.Buf16(2 * E + 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(a) {
2074
+ var B;
2075
+ return a && a.state ? (a.total_in = a.total_out = 0, a.data_type = p, (B = a.state).pending = 0, B.pending_out = 0, B.wrap < 0 && (B.wrap = -B.wrap), B.status = B.wrap ? k : j, a.adler = B.wrap === 2 ? 0 : 1, B.last_flush = m, o._tr_init(B), h) : tt(a, g);
2076
+ }
2077
+ function mt(a) {
2078
+ var B = at(a);
2079
+ return B === h && (function(R) {
2080
+ R.window_size = 2 * R.w_size, Q(R.head), R.max_lazy_match = i[R.level].max_lazy, R.good_match = i[R.level].good_length, R.nice_match = i[R.level].nice_length, R.max_chain_length = i[R.level].max_chain, R.strstart = 0, R.block_start = 0, R.lookahead = 0, R.insert = 0, R.match_length = R.prev_length = F - 1, R.match_available = 0, R.ins_h = 0;
2081
+ })(a.state), B;
2082
+ }
2083
+ function pt(a, B, R, x, y, C) {
2084
+ if (!a) return g;
2085
+ var L = 1;
2086
+ if (B === f && (B = 6), x < 0 ? (L = 0, x = -x) : 15 < x && (L = 2, x -= 16), y < 1 || S < y || R !== w || x < 8 || 15 < x || B < 0 || 9 < B || C < 0 || b < C) return tt(a, g);
2087
+ x === 8 && (x = 9);
2088
+ var U = new ct();
2089
+ return (a.state = U).strm = a, U.wrap = L, U.gzhead = null, U.w_bits = x, U.w_size = 1 << U.w_bits, U.w_mask = U.w_size - 1, U.hash_bits = y + 7, U.hash_size = 1 << U.hash_bits, U.hash_mask = U.hash_size - 1, U.hash_shift = ~~((U.hash_bits + F - 1) / F), U.window = new e.Buf8(2 * U.w_size), U.head = new e.Buf16(U.hash_size), U.prev = new e.Buf16(U.w_size), U.lit_bufsize = 1 << y + 6, U.pending_buf_size = 4 * U.lit_bufsize, U.pending_buf = new e.Buf8(U.pending_buf_size), U.d_buf = 1 * U.lit_bufsize, U.l_buf = 3 * U.lit_bufsize, U.level = B, U.strategy = C, U.method = R, mt(a);
2090
+ }
2091
+ i = [new rt(0, 0, 0, 0, function(a, B) {
2092
+ var R = 65535;
2093
+ for (R > a.pending_buf_size - 5 && (R = a.pending_buf_size - 5); ; ) {
2094
+ if (a.lookahead <= 1) {
2095
+ if (st(a), a.lookahead === 0 && B === m) return c;
2096
+ if (a.lookahead === 0) break;
2097
+ }
2098
+ a.strstart += a.lookahead, a.lookahead = 0;
2099
+ var x = a.block_start + R;
2100
+ if ((a.strstart === 0 || a.strstart >= x) && (a.lookahead = a.strstart - x, a.strstart = x, T(a, !1), a.strm.avail_out === 0) || a.strstart - a.block_start >= a.w_size - J && (T(a, !1), a.strm.avail_out === 0)) return c;
2101
+ }
2102
+ return a.insert = 0, B === v ? (T(a, !0), a.strm.avail_out === 0 ? Y : N) : (a.strstart > a.block_start && (T(a, !1), a.strm.avail_out), c);
2103
+ }), new rt(4, 4, 8, 4, lt), new rt(4, 5, 16, 8, lt), new rt(4, 6, 32, 32, lt), new rt(4, 4, 16, 16, et), new rt(8, 16, 32, 32, et), new rt(8, 16, 128, 128, et), new rt(8, 32, 128, 256, et), new rt(32, 128, 258, 1024, et), new rt(32, 258, 258, 4096, et)], s.deflateInit = function(a, B) {
2104
+ return pt(a, B, w, 15, 8, 0);
2105
+ }, s.deflateInit2 = pt, s.deflateReset = mt, s.deflateResetKeep = at, s.deflateSetHeader = function(a, B) {
2106
+ return a && a.state ? a.state.wrap !== 2 ? g : (a.state.gzhead = B, h) : g;
2107
+ }, s.deflate = function(a, B) {
2108
+ var R, x, y, C;
2109
+ if (!a || !a.state || 5 < B || B < 0) return a ? tt(a, g) : g;
2110
+ if (x = a.state, !a.output || !a.input && a.avail_in !== 0 || x.status === 666 && B !== v) return tt(a, a.avail_out === 0 ? -5 : g);
2111
+ if (x.strm = a, R = x.last_flush, x.last_flush = B, x.status === k) if (x.wrap === 2) a.adler = 0, q(x, 31), q(x, 139), q(x, 8), x.gzhead ? (q(x, (x.gzhead.text ? 1 : 0) + (x.gzhead.hcrc ? 2 : 0) + (x.gzhead.extra ? 4 : 0) + (x.gzhead.name ? 8 : 0) + (x.gzhead.comment ? 16 : 0)), q(x, 255 & x.gzhead.time), q(x, x.gzhead.time >> 8 & 255), q(x, x.gzhead.time >> 16 & 255), q(x, x.gzhead.time >> 24 & 255), q(x, x.level === 9 ? 2 : 2 <= x.strategy || x.level < 2 ? 4 : 0), q(x, 255 & x.gzhead.os), x.gzhead.extra && x.gzhead.extra.length && (q(x, 255 & x.gzhead.extra.length), q(x, x.gzhead.extra.length >> 8 & 255)), x.gzhead.hcrc && (a.adler = d(a.adler, x.pending_buf, x.pending, 0)), x.gzindex = 0, x.status = 69) : (q(x, 0), q(x, 0), q(x, 0), q(x, 0), q(x, 0), q(x, x.level === 9 ? 2 : 2 <= x.strategy || x.level < 2 ? 4 : 0), q(x, 3), x.status = j);
2112
+ else {
2113
+ var L = w + (x.w_bits - 8 << 4) << 8;
2114
+ L |= (2 <= x.strategy || x.level < 2 ? 0 : x.level < 6 ? 1 : x.level === 6 ? 2 : 3) << 6, x.strstart !== 0 && (L |= 32), L += 31 - L % 31, x.status = j, H(x, L), x.strstart !== 0 && (H(x, a.adler >>> 16), H(x, 65535 & a.adler)), a.adler = 1;
2115
+ }
2116
+ if (x.status === 69) if (x.gzhead.extra) {
2117
+ for (y = x.pending; x.gzindex < (65535 & x.gzhead.extra.length) && (x.pending !== x.pending_buf_size || (x.gzhead.hcrc && x.pending > y && (a.adler = d(a.adler, x.pending_buf, x.pending - y, y)), O(a), y = x.pending, x.pending !== x.pending_buf_size)); ) q(x, 255 & x.gzhead.extra[x.gzindex]), x.gzindex++;
2118
+ x.gzhead.hcrc && x.pending > y && (a.adler = d(a.adler, x.pending_buf, x.pending - y, y)), x.gzindex === x.gzhead.extra.length && (x.gzindex = 0, x.status = 73);
2119
+ } else x.status = 73;
2120
+ if (x.status === 73) if (x.gzhead.name) {
2121
+ y = x.pending;
2122
+ do {
2123
+ if (x.pending === x.pending_buf_size && (x.gzhead.hcrc && x.pending > y && (a.adler = d(a.adler, x.pending_buf, x.pending - y, y)), O(a), y = x.pending, x.pending === x.pending_buf_size)) {
2124
+ C = 1;
2125
+ break;
2126
+ }
2127
+ C = x.gzindex < x.gzhead.name.length ? 255 & x.gzhead.name.charCodeAt(x.gzindex++) : 0, q(x, C);
2128
+ } while (C !== 0);
2129
+ x.gzhead.hcrc && x.pending > y && (a.adler = d(a.adler, x.pending_buf, x.pending - y, y)), C === 0 && (x.gzindex = 0, x.status = 91);
2130
+ } else x.status = 91;
2131
+ if (x.status === 91) if (x.gzhead.comment) {
2132
+ y = x.pending;
2133
+ do {
2134
+ if (x.pending === x.pending_buf_size && (x.gzhead.hcrc && x.pending > y && (a.adler = d(a.adler, x.pending_buf, x.pending - y, y)), O(a), y = x.pending, x.pending === x.pending_buf_size)) {
2135
+ C = 1;
2136
+ break;
2137
+ }
2138
+ C = x.gzindex < x.gzhead.comment.length ? 255 & x.gzhead.comment.charCodeAt(x.gzindex++) : 0, q(x, C);
2139
+ } while (C !== 0);
2140
+ x.gzhead.hcrc && x.pending > y && (a.adler = d(a.adler, x.pending_buf, x.pending - y, y)), C === 0 && (x.status = 103);
2141
+ } else x.status = 103;
2142
+ if (x.status === 103 && (x.gzhead.hcrc ? (x.pending + 2 > x.pending_buf_size && O(a), x.pending + 2 <= x.pending_buf_size && (q(x, 255 & a.adler), q(x, a.adler >> 8 & 255), a.adler = 0, x.status = j)) : x.status = j), x.pending !== 0) {
2143
+ if (O(a), a.avail_out === 0) return x.last_flush = -1, h;
2144
+ } else if (a.avail_in === 0 && M(B) <= M(R) && B !== v) return tt(a, -5);
2145
+ if (x.status === 666 && a.avail_in !== 0) return tt(a, -5);
2146
+ if (a.avail_in !== 0 || x.lookahead !== 0 || B !== m && x.status !== 666) {
2147
+ var U = x.strategy === 2 ? (function(A, Z) {
2148
+ for (var K; ; ) {
2149
+ if (A.lookahead === 0 && (st(A), A.lookahead === 0)) {
2150
+ if (Z === m) return c;
2151
+ break;
2152
+ }
2153
+ if (A.match_length = 0, K = o._tr_tally(A, 0, A.window[A.strstart]), A.lookahead--, A.strstart++, K && (T(A, !1), A.strm.avail_out === 0)) return c;
2154
+ }
2155
+ return A.insert = 0, Z === v ? (T(A, !0), A.strm.avail_out === 0 ? Y : N) : A.last_lit && (T(A, !1), A.strm.avail_out === 0) ? c : I;
2156
+ })(x, B) : x.strategy === 3 ? (function(A, Z) {
2157
+ for (var K, G, V, it, nt = A.window; ; ) {
2158
+ if (A.lookahead <= W) {
2159
+ if (st(A), A.lookahead <= W && Z === m) return c;
2160
+ if (A.lookahead === 0) break;
2161
+ }
2162
+ if (A.match_length = 0, A.lookahead >= F && 0 < A.strstart && (G = nt[V = A.strstart - 1]) === nt[++V] && G === nt[++V] && G === nt[++V]) {
2163
+ it = A.strstart + W;
2164
+ do
2165
+ ;
2166
+ while (G === nt[++V] && G === nt[++V] && G === nt[++V] && G === nt[++V] && G === nt[++V] && G === nt[++V] && G === nt[++V] && G === nt[++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 >= F ? (K = o._tr_tally(A, 1, A.match_length - F), A.lookahead -= A.match_length, A.strstart += A.match_length, A.match_length = 0) : (K = o._tr_tally(A, 0, A.window[A.strstart]), A.lookahead--, A.strstart++), K && (T(A, !1), A.strm.avail_out === 0)) return c;
2170
+ }
2171
+ return A.insert = 0, Z === v ? (T(A, !0), A.strm.avail_out === 0 ? Y : N) : A.last_lit && (T(A, !1), A.strm.avail_out === 0) ? c : I;
2172
+ })(x, B) : i[x.level].func(x, B);
2173
+ if (U !== Y && U !== N || (x.status = 666), U === c || U === Y) return a.avail_out === 0 && (x.last_flush = -1), h;
2174
+ if (U === I && (B === 1 ? o._tr_align(x) : B !== 5 && (o._tr_stored_block(x, 0, 0, !1), B === 3 && (Q(x.head), x.lookahead === 0 && (x.strstart = 0, x.block_start = 0, x.insert = 0))), O(a), a.avail_out === 0)) return x.last_flush = -1, h;
2175
+ }
2176
+ return B !== v ? h : x.wrap <= 0 ? 1 : (x.wrap === 2 ? (q(x, 255 & a.adler), q(x, a.adler >> 8 & 255), q(x, a.adler >> 16 & 255), q(x, a.adler >> 24 & 255), q(x, 255 & a.total_in), q(x, a.total_in >> 8 & 255), q(x, a.total_in >> 16 & 255), q(x, a.total_in >> 24 & 255)) : (H(x, a.adler >>> 16), H(x, 65535 & a.adler)), O(a), 0 < x.wrap && (x.wrap = -x.wrap), x.pending !== 0 ? h : 1);
2177
+ }, s.deflateEnd = function(a) {
2178
+ var B;
2179
+ return a && a.state ? (B = a.state.status) !== k && B !== 69 && B !== 73 && B !== 91 && B !== 103 && B !== j && B !== 666 ? tt(a, g) : (a.state = null, B === j ? tt(a, -3) : h) : g;
2180
+ }, s.deflateSetDictionary = function(a, B) {
2181
+ var R, x, y, C, L, U, A, Z, K = B.length;
2182
+ if (!a || !a.state || (C = (R = a.state).wrap) === 2 || C === 1 && R.status !== k || R.lookahead) return g;
2183
+ for (C === 1 && (a.adler = l(a.adler, B, K, 0)), R.wrap = 0, K >= R.w_size && (C === 0 && (Q(R.head), R.strstart = 0, R.block_start = 0, R.insert = 0), Z = new e.Buf8(R.w_size), e.arraySet(Z, B, K - R.w_size, R.w_size, 0), B = Z, K = R.w_size), L = a.avail_in, U = a.next_in, A = a.input, a.avail_in = K, a.next_in = 0, a.input = B, st(R); R.lookahead >= F; ) {
2184
+ for (x = R.strstart, y = R.lookahead - (F - 1); R.ins_h = (R.ins_h << R.hash_shift ^ R.window[x + F - 1]) & R.hash_mask, R.prev[x & R.w_mask] = R.head[R.ins_h], R.head[R.ins_h] = x, x++, --y; ) ;
2185
+ R.strstart = x, R.lookahead = F - 1, st(R);
2186
+ }
2187
+ return R.strstart += R.lookahead, R.block_start = R.strstart, R.insert = R.lookahead, R.lookahead = 0, R.match_length = R.prev_length = F - 1, R.match_available = 0, a.next_in = U, a.input = A, a.avail_in = L, R.wrap = C, h;
2188
+ }, s.deflateInfo = "pako deflate (from Nodeca project)";
2189
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(t, u, s) {
2190
+ u.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(t, u, s) {
2194
+ u.exports = function(i, e) {
2195
+ var o, l, d, _, m, v, h, g, f, b, p, w, S, E, z, P, D, $, F, W, J, k, j, c, I;
2196
+ o = i.state, l = i.next_in, c = i.input, d = l + (i.avail_in - 5), _ = i.next_out, I = i.output, m = _ - (e - i.avail_out), v = _ + (i.avail_out - 257), h = o.dmax, g = o.wsize, f = o.whave, b = o.wnext, p = o.window, w = o.hold, S = o.bits, E = o.lencode, z = o.distcode, P = (1 << o.lenbits) - 1, D = (1 << o.distbits) - 1;
2197
+ t: do {
2198
+ S < 15 && (w += c[l++] << S, S += 8, w += c[l++] << S, S += 8), $ = E[w & P];
2199
+ e: for (; ; ) {
2200
+ if (w >>>= F = $ >>> 24, S -= F, (F = $ >>> 16 & 255) === 0) I[_++] = 65535 & $;
2201
+ else {
2202
+ if (!(16 & F)) {
2203
+ if ((64 & F) == 0) {
2204
+ $ = E[(65535 & $) + (w & (1 << F) - 1)];
2205
+ continue e;
2206
+ }
2207
+ if (32 & F) {
2208
+ o.mode = 12;
2209
+ break t;
2210
+ }
2211
+ i.msg = "invalid literal/length code", o.mode = 30;
2212
+ break t;
2213
+ }
2214
+ W = 65535 & $, (F &= 15) && (S < F && (w += c[l++] << S, S += 8), W += w & (1 << F) - 1, w >>>= F, S -= F), S < 15 && (w += c[l++] << S, S += 8, w += c[l++] << S, S += 8), $ = z[w & D];
2215
+ n: for (; ; ) {
2216
+ if (w >>>= F = $ >>> 24, S -= F, !(16 & (F = $ >>> 16 & 255))) {
2217
+ if ((64 & F) == 0) {
2218
+ $ = z[(65535 & $) + (w & (1 << F) - 1)];
2219
+ continue n;
2220
+ }
2221
+ i.msg = "invalid distance code", o.mode = 30;
2222
+ break t;
2223
+ }
2224
+ if (J = 65535 & $, S < (F &= 15) && (w += c[l++] << S, (S += 8) < F && (w += c[l++] << S, S += 8)), h < (J += w & (1 << F) - 1)) {
2225
+ i.msg = "invalid distance too far back", o.mode = 30;
2226
+ break t;
2227
+ }
2228
+ if (w >>>= F, S -= F, (F = _ - m) < J) {
2229
+ if (f < (F = J - F) && o.sane) {
2230
+ i.msg = "invalid distance too far back", o.mode = 30;
2231
+ break t;
2232
+ }
2233
+ if (j = p, (k = 0) === b) {
2234
+ if (k += g - F, F < W) {
2235
+ for (W -= F; I[_++] = p[k++], --F; ) ;
2236
+ k = _ - J, j = I;
2237
+ }
2238
+ } else if (b < F) {
2239
+ if (k += g + b - F, (F -= b) < W) {
2240
+ for (W -= F; I[_++] = p[k++], --F; ) ;
2241
+ if (k = 0, b < W) {
2242
+ for (W -= F = b; I[_++] = p[k++], --F; ) ;
2243
+ k = _ - J, j = I;
2244
+ }
2245
+ }
2246
+ } else if (k += b - F, F < W) {
2247
+ for (W -= F; I[_++] = p[k++], --F; ) ;
2248
+ k = _ - J, j = I;
2249
+ }
2250
+ for (; 2 < W; ) I[_++] = j[k++], I[_++] = j[k++], I[_++] = j[k++], W -= 3;
2251
+ W && (I[_++] = j[k++], 1 < W && (I[_++] = j[k++]));
2252
+ } else {
2253
+ for (k = _ - J; I[_++] = I[k++], I[_++] = I[k++], I[_++] = I[k++], 2 < (W -= 3); ) ;
2254
+ W && (I[_++] = I[k++], 1 < W && (I[_++] = I[k++]));
2255
+ }
2256
+ break;
2257
+ }
2258
+ }
2259
+ break;
2260
+ }
2261
+ } while (l < d && _ < v);
2262
+ l -= W = S >> 3, w &= (1 << (S -= W << 3)) - 1, i.next_in = l, i.next_out = _, i.avail_in = l < d ? d - l + 5 : 5 - (l - d), i.avail_out = _ < v ? v - _ + 257 : 257 - (_ - v), o.hold = w, o.bits = S;
2263
+ };
2264
+ }, {}], 49: [function(t, u, s) {
2265
+ var i = t("../utils/common"), e = t("./adler32"), o = t("./crc32"), l = t("./inffast"), d = t("./inftrees"), _ = 1, m = 2, v = 0, h = -2, g = 1, f = 852, b = 592;
2266
+ function p(k) {
2267
+ return (k >>> 24 & 255) + (k >>> 8 & 65280) + ((65280 & k) << 8) + ((255 & k) << 24);
2268
+ }
2269
+ function w() {
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 i.Buf16(320), this.work = new i.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
2271
+ }
2272
+ function S(k) {
2273
+ var j;
2274
+ return k && k.state ? (j = k.state, k.total_in = k.total_out = j.total = 0, k.msg = "", j.wrap && (k.adler = 1 & j.wrap), j.mode = g, j.last = 0, j.havedict = 0, j.dmax = 32768, j.head = null, j.hold = 0, j.bits = 0, j.lencode = j.lendyn = new i.Buf32(f), j.distcode = j.distdyn = new i.Buf32(b), j.sane = 1, j.back = -1, v) : h;
2275
+ }
2276
+ function E(k) {
2277
+ var j;
2278
+ return k && k.state ? ((j = k.state).wsize = 0, j.whave = 0, j.wnext = 0, S(k)) : h;
2279
+ }
2280
+ function z(k, j) {
2281
+ var c, I;
2282
+ return k && k.state ? (I = k.state, j < 0 ? (c = 0, j = -j) : (c = 1 + (j >> 4), j < 48 && (j &= 15)), j && (j < 8 || 15 < j) ? h : (I.window !== null && I.wbits !== j && (I.window = null), I.wrap = c, I.wbits = j, E(k))) : h;
2283
+ }
2284
+ function P(k, j) {
2285
+ var c, I;
2286
+ return k ? (I = new w(), (k.state = I).window = null, (c = z(k, j)) !== v && (k.state = null), c) : h;
2287
+ }
2288
+ var D, $, F = !0;
2289
+ function W(k) {
2290
+ if (F) {
2291
+ var j;
2292
+ for (D = new i.Buf32(512), $ = new i.Buf32(32), j = 0; j < 144; ) k.lens[j++] = 8;
2293
+ for (; j < 256; ) k.lens[j++] = 9;
2294
+ for (; j < 280; ) k.lens[j++] = 7;
2295
+ for (; j < 288; ) k.lens[j++] = 8;
2296
+ for (d(_, k.lens, 0, 288, D, 0, k.work, { bits: 9 }), j = 0; j < 32; ) k.lens[j++] = 5;
2297
+ d(m, k.lens, 0, 32, $, 0, k.work, { bits: 5 }), F = !1;
2298
+ }
2299
+ k.lencode = D, k.lenbits = 9, k.distcode = $, k.distbits = 5;
2300
+ }
2301
+ function J(k, j, c, I) {
2302
+ var Y, N = k.state;
2303
+ return N.window === null && (N.wsize = 1 << N.wbits, N.wnext = 0, N.whave = 0, N.window = new i.Buf8(N.wsize)), I >= N.wsize ? (i.arraySet(N.window, j, c - N.wsize, N.wsize, 0), N.wnext = 0, N.whave = N.wsize) : (I < (Y = N.wsize - N.wnext) && (Y = I), i.arraySet(N.window, j, c - I, Y, N.wnext), (I -= Y) ? (i.arraySet(N.window, j, c - I, I, 0), N.wnext = I, N.whave = N.wsize) : (N.wnext += Y, N.wnext === N.wsize && (N.wnext = 0), N.whave < N.wsize && (N.whave += Y))), 0;
2304
+ }
2305
+ s.inflateReset = E, s.inflateReset2 = z, s.inflateResetKeep = S, s.inflateInit = function(k) {
2306
+ return P(k, 15);
2307
+ }, s.inflateInit2 = P, s.inflate = function(k, j) {
2308
+ var c, I, Y, N, tt, M, Q, O, T, q, H, X, st, lt, et, rt, ct, at, mt, pt, a, B, R, x, y = 0, C = new i.Buf8(4), L = [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 h;
2310
+ (c = k.state).mode === 12 && (c.mode = 13), tt = k.next_out, Y = k.output, Q = k.avail_out, N = k.next_in, I = k.input, M = k.avail_in, O = c.hold, T = c.bits, q = M, H = Q, B = v;
2311
+ t: for (; ; ) switch (c.mode) {
2312
+ case g:
2313
+ if (c.wrap === 0) {
2314
+ c.mode = 13;
2315
+ break;
2316
+ }
2317
+ for (; T < 16; ) {
2318
+ if (M === 0) break t;
2319
+ M--, O += I[N++] << T, T += 8;
2320
+ }
2321
+ if (2 & c.wrap && O === 35615) {
2322
+ C[c.check = 0] = 255 & O, C[1] = O >>> 8 & 255, c.check = o(c.check, C, 2, 0), T = O = 0, c.mode = 2;
2323
+ break;
2324
+ }
2325
+ if (c.flags = 0, c.head && (c.head.done = !1), !(1 & c.wrap) || (((255 & O) << 8) + (O >> 8)) % 31) {
2326
+ k.msg = "incorrect header check", c.mode = 30;
2327
+ break;
2328
+ }
2329
+ if ((15 & O) != 8) {
2330
+ k.msg = "unknown compression method", c.mode = 30;
2331
+ break;
2332
+ }
2333
+ if (T -= 4, a = 8 + (15 & (O >>>= 4)), c.wbits === 0) c.wbits = a;
2334
+ else if (a > c.wbits) {
2335
+ k.msg = "invalid window size", c.mode = 30;
2336
+ break;
2337
+ }
2338
+ c.dmax = 1 << a, k.adler = c.check = 1, c.mode = 512 & O ? 10 : 12, T = O = 0;
2339
+ break;
2340
+ case 2:
2341
+ for (; T < 16; ) {
2342
+ if (M === 0) break t;
2343
+ M--, O += I[N++] << T, T += 8;
2344
+ }
2345
+ if (c.flags = O, (255 & c.flags) != 8) {
2346
+ k.msg = "unknown compression method", c.mode = 30;
2347
+ break;
2348
+ }
2349
+ if (57344 & c.flags) {
2350
+ k.msg = "unknown header flags set", c.mode = 30;
2351
+ break;
2352
+ }
2353
+ c.head && (c.head.text = O >> 8 & 1), 512 & c.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, c.check = o(c.check, C, 2, 0)), T = O = 0, c.mode = 3;
2354
+ case 3:
2355
+ for (; T < 32; ) {
2356
+ if (M === 0) break t;
2357
+ M--, O += I[N++] << T, T += 8;
2358
+ }
2359
+ c.head && (c.head.time = O), 512 & c.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, C[2] = O >>> 16 & 255, C[3] = O >>> 24 & 255, c.check = o(c.check, C, 4, 0)), T = O = 0, c.mode = 4;
2360
+ case 4:
2361
+ for (; T < 16; ) {
2362
+ if (M === 0) break t;
2363
+ M--, O += I[N++] << T, T += 8;
2364
+ }
2365
+ c.head && (c.head.xflags = 255 & O, c.head.os = O >> 8), 512 & c.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, c.check = o(c.check, C, 2, 0)), T = O = 0, c.mode = 5;
2366
+ case 5:
2367
+ if (1024 & c.flags) {
2368
+ for (; T < 16; ) {
2369
+ if (M === 0) break t;
2370
+ M--, O += I[N++] << T, T += 8;
2371
+ }
2372
+ c.length = O, c.head && (c.head.extra_len = O), 512 & c.flags && (C[0] = 255 & O, C[1] = O >>> 8 & 255, c.check = o(c.check, C, 2, 0)), T = O = 0;
2373
+ } else c.head && (c.head.extra = null);
2374
+ c.mode = 6;
2375
+ case 6:
2376
+ if (1024 & c.flags && (M < (X = c.length) && (X = M), X && (c.head && (a = c.head.extra_len - c.length, c.head.extra || (c.head.extra = new Array(c.head.extra_len)), i.arraySet(c.head.extra, I, N, X, a)), 512 & c.flags && (c.check = o(c.check, I, X, N)), M -= X, N += X, c.length -= X), c.length)) break t;
2377
+ c.length = 0, c.mode = 7;
2378
+ case 7:
2379
+ if (2048 & c.flags) {
2380
+ if (M === 0) break t;
2381
+ for (X = 0; a = I[N + X++], c.head && a && c.length < 65536 && (c.head.name += String.fromCharCode(a)), a && X < M; ) ;
2382
+ if (512 & c.flags && (c.check = o(c.check, I, X, N)), M -= X, N += X, a) break t;
2383
+ } else c.head && (c.head.name = null);
2384
+ c.length = 0, c.mode = 8;
2385
+ case 8:
2386
+ if (4096 & c.flags) {
2387
+ if (M === 0) break t;
2388
+ for (X = 0; a = I[N + X++], c.head && a && c.length < 65536 && (c.head.comment += String.fromCharCode(a)), a && X < M; ) ;
2389
+ if (512 & c.flags && (c.check = o(c.check, I, X, N)), M -= X, N += X, a) break t;
2390
+ } else c.head && (c.head.comment = null);
2391
+ c.mode = 9;
2392
+ case 9:
2393
+ if (512 & c.flags) {
2394
+ for (; T < 16; ) {
2395
+ if (M === 0) break t;
2396
+ M--, O += I[N++] << T, T += 8;
2397
+ }
2398
+ if (O !== (65535 & c.check)) {
2399
+ k.msg = "header crc mismatch", c.mode = 30;
2400
+ break;
2401
+ }
2402
+ T = O = 0;
2403
+ }
2404
+ c.head && (c.head.hcrc = c.flags >> 9 & 1, c.head.done = !0), k.adler = c.check = 0, c.mode = 12;
2405
+ break;
2406
+ case 10:
2407
+ for (; T < 32; ) {
2408
+ if (M === 0) break t;
2409
+ M--, O += I[N++] << T, T += 8;
2410
+ }
2411
+ k.adler = c.check = p(O), T = O = 0, c.mode = 11;
2412
+ case 11:
2413
+ if (c.havedict === 0) return k.next_out = tt, k.avail_out = Q, k.next_in = N, k.avail_in = M, c.hold = O, c.bits = T, 2;
2414
+ k.adler = c.check = 1, c.mode = 12;
2415
+ case 12:
2416
+ if (j === 5 || j === 6) break t;
2417
+ case 13:
2418
+ if (c.last) {
2419
+ O >>>= 7 & T, T -= 7 & T, c.mode = 27;
2420
+ break;
2421
+ }
2422
+ for (; T < 3; ) {
2423
+ if (M === 0) break t;
2424
+ M--, O += I[N++] << T, T += 8;
2425
+ }
2426
+ switch (c.last = 1 & O, T -= 1, 3 & (O >>>= 1)) {
2427
+ case 0:
2428
+ c.mode = 14;
2429
+ break;
2430
+ case 1:
2431
+ if (W(c), c.mode = 20, j !== 6) break;
2432
+ O >>>= 2, T -= 2;
2433
+ break t;
2434
+ case 2:
2435
+ c.mode = 17;
2436
+ break;
2437
+ case 3:
2438
+ k.msg = "invalid block type", c.mode = 30;
2439
+ }
2440
+ O >>>= 2, T -= 2;
2441
+ break;
2442
+ case 14:
2443
+ for (O >>>= 7 & T, T -= 7 & T; T < 32; ) {
2444
+ if (M === 0) break t;
2445
+ M--, O += I[N++] << T, T += 8;
2446
+ }
2447
+ if ((65535 & O) != (O >>> 16 ^ 65535)) {
2448
+ k.msg = "invalid stored block lengths", c.mode = 30;
2449
+ break;
2450
+ }
2451
+ if (c.length = 65535 & O, T = O = 0, c.mode = 15, j === 6) break t;
2452
+ case 15:
2453
+ c.mode = 16;
2454
+ case 16:
2455
+ if (X = c.length) {
2456
+ if (M < X && (X = M), Q < X && (X = Q), X === 0) break t;
2457
+ i.arraySet(Y, I, N, X, tt), M -= X, N += X, Q -= X, tt += X, c.length -= X;
2458
+ break;
2459
+ }
2460
+ c.mode = 12;
2461
+ break;
2462
+ case 17:
2463
+ for (; T < 14; ) {
2464
+ if (M === 0) break t;
2465
+ M--, O += I[N++] << T, T += 8;
2466
+ }
2467
+ if (c.nlen = 257 + (31 & O), O >>>= 5, T -= 5, c.ndist = 1 + (31 & O), O >>>= 5, T -= 5, c.ncode = 4 + (15 & O), O >>>= 4, T -= 4, 286 < c.nlen || 30 < c.ndist) {
2468
+ k.msg = "too many length or distance symbols", c.mode = 30;
2469
+ break;
2470
+ }
2471
+ c.have = 0, c.mode = 18;
2472
+ case 18:
2473
+ for (; c.have < c.ncode; ) {
2474
+ for (; T < 3; ) {
2475
+ if (M === 0) break t;
2476
+ M--, O += I[N++] << T, T += 8;
2477
+ }
2478
+ c.lens[L[c.have++]] = 7 & O, O >>>= 3, T -= 3;
2479
+ }
2480
+ for (; c.have < 19; ) c.lens[L[c.have++]] = 0;
2481
+ if (c.lencode = c.lendyn, c.lenbits = 7, R = { bits: c.lenbits }, B = d(0, c.lens, 0, 19, c.lencode, 0, c.work, R), c.lenbits = R.bits, B) {
2482
+ k.msg = "invalid code lengths set", c.mode = 30;
2483
+ break;
2484
+ }
2485
+ c.have = 0, c.mode = 19;
2486
+ case 19:
2487
+ for (; c.have < c.nlen + c.ndist; ) {
2488
+ for (; rt = (y = c.lencode[O & (1 << c.lenbits) - 1]) >>> 16 & 255, ct = 65535 & y, !((et = y >>> 24) <= T); ) {
2489
+ if (M === 0) break t;
2490
+ M--, O += I[N++] << T, T += 8;
2491
+ }
2492
+ if (ct < 16) O >>>= et, T -= et, c.lens[c.have++] = ct;
2493
+ else {
2494
+ if (ct === 16) {
2495
+ for (x = et + 2; T < x; ) {
2496
+ if (M === 0) break t;
2497
+ M--, O += I[N++] << T, T += 8;
2498
+ }
2499
+ if (O >>>= et, T -= et, c.have === 0) {
2500
+ k.msg = "invalid bit length repeat", c.mode = 30;
2501
+ break;
2502
+ }
2503
+ a = c.lens[c.have - 1], X = 3 + (3 & O), O >>>= 2, T -= 2;
2504
+ } else if (ct === 17) {
2505
+ for (x = et + 3; T < x; ) {
2506
+ if (M === 0) break t;
2507
+ M--, O += I[N++] << T, T += 8;
2508
+ }
2509
+ T -= et, a = 0, X = 3 + (7 & (O >>>= et)), O >>>= 3, T -= 3;
2510
+ } else {
2511
+ for (x = et + 7; T < x; ) {
2512
+ if (M === 0) break t;
2513
+ M--, O += I[N++] << T, T += 8;
2514
+ }
2515
+ T -= et, a = 0, X = 11 + (127 & (O >>>= et)), O >>>= 7, T -= 7;
2516
+ }
2517
+ if (c.have + X > c.nlen + c.ndist) {
2518
+ k.msg = "invalid bit length repeat", c.mode = 30;
2519
+ break;
2520
+ }
2521
+ for (; X--; ) c.lens[c.have++] = a;
2522
+ }
2523
+ }
2524
+ if (c.mode === 30) break;
2525
+ if (c.lens[256] === 0) {
2526
+ k.msg = "invalid code -- missing end-of-block", c.mode = 30;
2527
+ break;
2528
+ }
2529
+ if (c.lenbits = 9, R = { bits: c.lenbits }, B = d(_, c.lens, 0, c.nlen, c.lencode, 0, c.work, R), c.lenbits = R.bits, B) {
2530
+ k.msg = "invalid literal/lengths set", c.mode = 30;
2531
+ break;
2532
+ }
2533
+ if (c.distbits = 6, c.distcode = c.distdyn, R = { bits: c.distbits }, B = d(m, c.lens, c.nlen, c.ndist, c.distcode, 0, c.work, R), c.distbits = R.bits, B) {
2534
+ k.msg = "invalid distances set", c.mode = 30;
2535
+ break;
2536
+ }
2537
+ if (c.mode = 20, j === 6) break t;
2538
+ case 20:
2539
+ c.mode = 21;
2540
+ case 21:
2541
+ if (6 <= M && 258 <= Q) {
2542
+ k.next_out = tt, k.avail_out = Q, k.next_in = N, k.avail_in = M, c.hold = O, c.bits = T, l(k, H), tt = k.next_out, Y = k.output, Q = k.avail_out, N = k.next_in, I = k.input, M = k.avail_in, O = c.hold, T = c.bits, c.mode === 12 && (c.back = -1);
2543
+ break;
2544
+ }
2545
+ for (c.back = 0; rt = (y = c.lencode[O & (1 << c.lenbits) - 1]) >>> 16 & 255, ct = 65535 & y, !((et = y >>> 24) <= T); ) {
2546
+ if (M === 0) break t;
2547
+ M--, O += I[N++] << T, T += 8;
2548
+ }
2549
+ if (rt && (240 & rt) == 0) {
2550
+ for (at = et, mt = rt, pt = ct; rt = (y = c.lencode[pt + ((O & (1 << at + mt) - 1) >> at)]) >>> 16 & 255, ct = 65535 & y, !(at + (et = y >>> 24) <= T); ) {
2551
+ if (M === 0) break t;
2552
+ M--, O += I[N++] << T, T += 8;
2553
+ }
2554
+ O >>>= at, T -= at, c.back += at;
2555
+ }
2556
+ if (O >>>= et, T -= et, c.back += et, c.length = ct, rt === 0) {
2557
+ c.mode = 26;
2558
+ break;
2559
+ }
2560
+ if (32 & rt) {
2561
+ c.back = -1, c.mode = 12;
2562
+ break;
2563
+ }
2564
+ if (64 & rt) {
2565
+ k.msg = "invalid literal/length code", c.mode = 30;
2566
+ break;
2567
+ }
2568
+ c.extra = 15 & rt, c.mode = 22;
2569
+ case 22:
2570
+ if (c.extra) {
2571
+ for (x = c.extra; T < x; ) {
2572
+ if (M === 0) break t;
2573
+ M--, O += I[N++] << T, T += 8;
2574
+ }
2575
+ c.length += O & (1 << c.extra) - 1, O >>>= c.extra, T -= c.extra, c.back += c.extra;
2576
+ }
2577
+ c.was = c.length, c.mode = 23;
2578
+ case 23:
2579
+ for (; rt = (y = c.distcode[O & (1 << c.distbits) - 1]) >>> 16 & 255, ct = 65535 & y, !((et = y >>> 24) <= T); ) {
2580
+ if (M === 0) break t;
2581
+ M--, O += I[N++] << T, T += 8;
2582
+ }
2583
+ if ((240 & rt) == 0) {
2584
+ for (at = et, mt = rt, pt = ct; rt = (y = c.distcode[pt + ((O & (1 << at + mt) - 1) >> at)]) >>> 16 & 255, ct = 65535 & y, !(at + (et = y >>> 24) <= T); ) {
2585
+ if (M === 0) break t;
2586
+ M--, O += I[N++] << T, T += 8;
2587
+ }
2588
+ O >>>= at, T -= at, c.back += at;
2589
+ }
2590
+ if (O >>>= et, T -= et, c.back += et, 64 & rt) {
2591
+ k.msg = "invalid distance code", c.mode = 30;
2592
+ break;
2593
+ }
2594
+ c.offset = ct, c.extra = 15 & rt, c.mode = 24;
2595
+ case 24:
2596
+ if (c.extra) {
2597
+ for (x = c.extra; T < x; ) {
2598
+ if (M === 0) break t;
2599
+ M--, O += I[N++] << T, T += 8;
2600
+ }
2601
+ c.offset += O & (1 << c.extra) - 1, O >>>= c.extra, T -= c.extra, c.back += c.extra;
2602
+ }
2603
+ if (c.offset > c.dmax) {
2604
+ k.msg = "invalid distance too far back", c.mode = 30;
2605
+ break;
2606
+ }
2607
+ c.mode = 25;
2608
+ case 25:
2609
+ if (Q === 0) break t;
2610
+ if (X = H - Q, c.offset > X) {
2611
+ if ((X = c.offset - X) > c.whave && c.sane) {
2612
+ k.msg = "invalid distance too far back", c.mode = 30;
2613
+ break;
2614
+ }
2615
+ st = X > c.wnext ? (X -= c.wnext, c.wsize - X) : c.wnext - X, X > c.length && (X = c.length), lt = c.window;
2616
+ } else lt = Y, st = tt - c.offset, X = c.length;
2617
+ for (Q < X && (X = Q), Q -= X, c.length -= X; Y[tt++] = lt[st++], --X; ) ;
2618
+ c.length === 0 && (c.mode = 21);
2619
+ break;
2620
+ case 26:
2621
+ if (Q === 0) break t;
2622
+ Y[tt++] = c.length, Q--, c.mode = 21;
2623
+ break;
2624
+ case 27:
2625
+ if (c.wrap) {
2626
+ for (; T < 32; ) {
2627
+ if (M === 0) break t;
2628
+ M--, O |= I[N++] << T, T += 8;
2629
+ }
2630
+ if (H -= Q, k.total_out += H, c.total += H, H && (k.adler = c.check = c.flags ? o(c.check, Y, H, tt - H) : e(c.check, Y, H, tt - H)), H = Q, (c.flags ? O : p(O)) !== c.check) {
2631
+ k.msg = "incorrect data check", c.mode = 30;
2632
+ break;
2633
+ }
2634
+ T = O = 0;
2635
+ }
2636
+ c.mode = 28;
2637
+ case 28:
2638
+ if (c.wrap && c.flags) {
2639
+ for (; T < 32; ) {
2640
+ if (M === 0) break t;
2641
+ M--, O += I[N++] << T, T += 8;
2642
+ }
2643
+ if (O !== (4294967295 & c.total)) {
2644
+ k.msg = "incorrect length check", c.mode = 30;
2645
+ break;
2646
+ }
2647
+ T = O = 0;
2648
+ }
2649
+ c.mode = 29;
2650
+ case 29:
2651
+ B = 1;
2652
+ break t;
2653
+ case 30:
2654
+ B = -3;
2655
+ break t;
2656
+ case 31:
2657
+ return -4;
2658
+ default:
2659
+ return h;
2660
+ }
2661
+ return k.next_out = tt, k.avail_out = Q, k.next_in = N, k.avail_in = M, c.hold = O, c.bits = T, (c.wsize || H !== k.avail_out && c.mode < 30 && (c.mode < 27 || j !== 4)) && J(k, k.output, k.next_out, H - k.avail_out) ? (c.mode = 31, -4) : (q -= k.avail_in, H -= k.avail_out, k.total_in += q, k.total_out += H, c.total += H, c.wrap && H && (k.adler = c.check = c.flags ? o(c.check, Y, H, k.next_out - H) : e(c.check, Y, H, k.next_out - H)), k.data_type = c.bits + (c.last ? 64 : 0) + (c.mode === 12 ? 128 : 0) + (c.mode === 20 || c.mode === 15 ? 256 : 0), (q == 0 && H === 0 || j === 4) && B === v && (B = -5), B);
2662
+ }, s.inflateEnd = function(k) {
2663
+ if (!k || !k.state) return h;
2664
+ var j = k.state;
2665
+ return j.window && (j.window = null), k.state = null, v;
2666
+ }, s.inflateGetHeader = function(k, j) {
2667
+ var c;
2668
+ return k && k.state ? (2 & (c = k.state).wrap) == 0 ? h : ((c.head = j).done = !1, v) : h;
2669
+ }, s.inflateSetDictionary = function(k, j) {
2670
+ var c, I = j.length;
2671
+ return k && k.state ? (c = k.state).wrap !== 0 && c.mode !== 11 ? h : c.mode === 11 && e(1, j, I, 0) !== c.check ? -3 : J(k, j, I, I) ? (c.mode = 31, -4) : (c.havedict = 1, v) : h;
2672
+ }, s.inflateInfo = "pako inflate (from Nodeca project)";
2673
+ }, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(t, u, s) {
2674
+ var i = t("../utils/common"), e = [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], o = [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], d = [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
+ u.exports = function(_, m, v, h, g, f, b, p) {
2676
+ var w, S, E, z, P, D, $, F, W, J = p.bits, k = 0, j = 0, c = 0, I = 0, Y = 0, N = 0, tt = 0, M = 0, Q = 0, O = 0, T = null, q = 0, H = new i.Buf16(16), X = new i.Buf16(16), st = null, lt = 0;
2677
+ for (k = 0; k <= 15; k++) H[k] = 0;
2678
+ for (j = 0; j < h; j++) H[m[v + j]]++;
2679
+ for (Y = J, I = 15; 1 <= I && H[I] === 0; I--) ;
2680
+ if (I < Y && (Y = I), I === 0) return g[f++] = 20971520, g[f++] = 20971520, p.bits = 1, 0;
2681
+ for (c = 1; c < I && H[c] === 0; c++) ;
2682
+ for (Y < c && (Y = c), k = M = 1; k <= 15; k++) if (M <<= 1, (M -= H[k]) < 0) return -1;
2683
+ if (0 < M && (_ === 0 || I !== 1)) return -1;
2684
+ for (X[1] = 0, k = 1; k < 15; k++) X[k + 1] = X[k] + H[k];
2685
+ for (j = 0; j < h; j++) m[v + j] !== 0 && (b[X[m[v + j]]++] = j);
2686
+ if (D = _ === 0 ? (T = st = b, 19) : _ === 1 ? (T = e, q -= 257, st = o, lt -= 257, 256) : (T = l, st = d, -1), k = c, P = f, tt = j = O = 0, E = -1, z = (Q = 1 << (N = Y)) - 1, _ === 1 && 852 < Q || _ === 2 && 592 < Q) return 1;
2687
+ for (; ; ) {
2688
+ for ($ = k - tt, W = b[j] < D ? (F = 0, b[j]) : b[j] > D ? (F = st[lt + b[j]], T[q + b[j]]) : (F = 96, 0), w = 1 << k - tt, c = S = 1 << N; g[P + (O >> tt) + (S -= w)] = $ << 24 | F << 16 | W | 0, S !== 0; ) ;
2689
+ for (w = 1 << k - 1; O & w; ) w >>= 1;
2690
+ if (w !== 0 ? (O &= w - 1, O += w) : O = 0, j++, --H[k] == 0) {
2691
+ if (k === I) break;
2692
+ k = m[v + b[j]];
2693
+ }
2694
+ if (Y < k && (O & z) !== E) {
2695
+ for (tt === 0 && (tt = Y), P += c, M = 1 << (N = k - tt); N + tt < I && !((M -= H[N + tt]) <= 0); ) N++, M <<= 1;
2696
+ if (Q += 1 << N, _ === 1 && 852 < Q || _ === 2 && 592 < Q) return 1;
2697
+ g[E = O & z] = Y << 24 | N << 16 | P - f | 0;
2698
+ }
2699
+ }
2700
+ return O !== 0 && (g[P + O] = k - tt << 24 | 64 << 16 | 0), p.bits = Y, 0;
2701
+ };
2702
+ }, { "../utils/common": 41 }], 51: [function(t, u, s) {
2703
+ u.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(t, u, s) {
2705
+ var i = t("../utils/common"), e = 0, o = 1;
2706
+ function l(y) {
2707
+ for (var C = y.length; 0 <= --C; ) y[C] = 0;
2708
+ }
2709
+ var d = 0, _ = 29, m = 256, v = m + 1 + _, h = 30, g = 19, f = 2 * v + 1, b = 15, p = 16, w = 7, S = 256, E = 16, z = 17, P = 18, D = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], $ = [0, 0, 0, 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], F = [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], J = new Array(2 * (v + 2));
2710
+ l(J);
2711
+ var k = new Array(2 * h);
2712
+ l(k);
2713
+ var j = new Array(512);
2714
+ l(j);
2715
+ var c = new Array(256);
2716
+ l(c);
2717
+ var I = new Array(_);
2718
+ l(I);
2719
+ var Y, N, tt, M = new Array(h);
2720
+ function Q(y, C, L, U, A) {
2721
+ this.static_tree = y, this.extra_bits = C, this.extra_base = L, this.elems = U, this.max_length = A, this.has_stree = y && y.length;
2722
+ }
2723
+ function O(y, C) {
2724
+ this.dyn_tree = y, this.max_code = 0, this.stat_desc = C;
2725
+ }
2726
+ function T(y) {
2727
+ return y < 256 ? j[y] : j[256 + (y >>> 7)];
2728
+ }
2729
+ function q(y, C) {
2730
+ y.pending_buf[y.pending++] = 255 & C, y.pending_buf[y.pending++] = C >>> 8 & 255;
2731
+ }
2732
+ function H(y, C, L) {
2733
+ y.bi_valid > p - L ? (y.bi_buf |= C << y.bi_valid & 65535, q(y, y.bi_buf), y.bi_buf = C >> p - y.bi_valid, y.bi_valid += L - p) : (y.bi_buf |= C << y.bi_valid & 65535, y.bi_valid += L);
2734
+ }
2735
+ function X(y, C, L) {
2736
+ H(y, L[2 * C], L[2 * C + 1]);
2737
+ }
2738
+ function st(y, C) {
2739
+ for (var L = 0; L |= 1 & y, y >>>= 1, L <<= 1, 0 < --C; ) ;
2740
+ return L >>> 1;
2741
+ }
2742
+ function lt(y, C, L) {
2743
+ var U, A, Z = new Array(b + 1), K = 0;
2744
+ for (U = 1; U <= b; U++) Z[U] = K = K + L[U - 1] << 1;
2745
+ for (A = 0; A <= C; A++) {
2746
+ var G = y[2 * A + 1];
2747
+ G !== 0 && (y[2 * A] = st(Z[G]++, G));
2748
+ }
2749
+ }
2750
+ function et(y) {
2751
+ var C;
2752
+ for (C = 0; C < v; C++) y.dyn_ltree[2 * C] = 0;
2753
+ for (C = 0; C < h; C++) y.dyn_dtree[2 * C] = 0;
2754
+ for (C = 0; C < g; C++) y.bl_tree[2 * C] = 0;
2755
+ y.dyn_ltree[2 * S] = 1, y.opt_len = y.static_len = 0, y.last_lit = y.matches = 0;
2756
+ }
2757
+ function rt(y) {
2758
+ 8 < y.bi_valid ? q(y, y.bi_buf) : 0 < y.bi_valid && (y.pending_buf[y.pending++] = y.bi_buf), y.bi_buf = 0, y.bi_valid = 0;
2759
+ }
2760
+ function ct(y, C, L, U) {
2761
+ var A = 2 * C, Z = 2 * L;
2762
+ return y[A] < y[Z] || y[A] === y[Z] && U[C] <= U[L];
2763
+ }
2764
+ function at(y, C, L) {
2765
+ for (var U = y.heap[L], A = L << 1; A <= y.heap_len && (A < y.heap_len && ct(C, y.heap[A + 1], y.heap[A], y.depth) && A++, !ct(C, U, y.heap[A], y.depth)); ) y.heap[L] = y.heap[A], L = A, A <<= 1;
2766
+ y.heap[L] = U;
2767
+ }
2768
+ function mt(y, C, L) {
2769
+ var U, A, Z, K, G = 0;
2770
+ if (y.last_lit !== 0) for (; U = y.pending_buf[y.d_buf + 2 * G] << 8 | y.pending_buf[y.d_buf + 2 * G + 1], A = y.pending_buf[y.l_buf + G], G++, U === 0 ? X(y, A, C) : (X(y, (Z = c[A]) + m + 1, C), (K = D[Z]) !== 0 && H(y, A -= I[Z], K), X(y, Z = T(--U), L), (K = $[Z]) !== 0 && H(y, U -= M[Z], K)), G < y.last_lit; ) ;
2771
+ X(y, S, C);
2772
+ }
2773
+ function pt(y, C) {
2774
+ var L, U, A, Z = C.dyn_tree, K = C.stat_desc.static_tree, G = C.stat_desc.has_stree, V = C.stat_desc.elems, it = -1;
2775
+ for (y.heap_len = 0, y.heap_max = f, L = 0; L < V; L++) Z[2 * L] !== 0 ? (y.heap[++y.heap_len] = it = L, y.depth[L] = 0) : Z[2 * L + 1] = 0;
2776
+ for (; y.heap_len < 2; ) Z[2 * (A = y.heap[++y.heap_len] = it < 2 ? ++it : 0)] = 1, y.depth[A] = 0, y.opt_len--, G && (y.static_len -= K[2 * A + 1]);
2777
+ for (C.max_code = it, L = y.heap_len >> 1; 1 <= L; L--) at(y, Z, L);
2778
+ for (A = V; L = y.heap[1], y.heap[1] = y.heap[y.heap_len--], at(y, Z, 1), U = y.heap[1], y.heap[--y.heap_max] = L, y.heap[--y.heap_max] = U, Z[2 * A] = Z[2 * L] + Z[2 * U], y.depth[A] = (y.depth[L] >= y.depth[U] ? y.depth[L] : y.depth[U]) + 1, Z[2 * L + 1] = Z[2 * U + 1] = A, y.heap[1] = A++, at(y, Z, 1), 2 <= y.heap_len; ) ;
2779
+ y.heap[--y.heap_max] = y.heap[1], (function(nt, dt) {
2780
+ var xt, gt, kt, ot, At, Nt, _t = dt.dyn_tree, re = dt.max_code, We = dt.stat_desc.static_tree, Ze = dt.stat_desc.has_stree, Ge = dt.stat_desc.extra_bits, ie = dt.stat_desc.extra_base, St = dt.stat_desc.max_length, Tt = 0;
2781
+ for (ot = 0; ot <= b; ot++) nt.bl_count[ot] = 0;
2782
+ for (_t[2 * nt.heap[nt.heap_max] + 1] = 0, xt = nt.heap_max + 1; xt < f; xt++) St < (ot = _t[2 * _t[2 * (gt = nt.heap[xt]) + 1] + 1] + 1) && (ot = St, Tt++), _t[2 * gt + 1] = ot, re < gt || (nt.bl_count[ot]++, At = 0, ie <= gt && (At = Ge[gt - ie]), Nt = _t[2 * gt], nt.opt_len += Nt * (ot + At), Ze && (nt.static_len += Nt * (We[2 * gt + 1] + At)));
2783
+ if (Tt !== 0) {
2784
+ do {
2785
+ for (ot = St - 1; nt.bl_count[ot] === 0; ) ot--;
2786
+ nt.bl_count[ot]--, nt.bl_count[ot + 1] += 2, nt.bl_count[St]--, Tt -= 2;
2787
+ } while (0 < Tt);
2788
+ for (ot = St; ot !== 0; ot--) for (gt = nt.bl_count[ot]; gt !== 0; ) re < (kt = nt.heap[--xt]) || (_t[2 * kt + 1] !== ot && (nt.opt_len += (ot - _t[2 * kt + 1]) * _t[2 * kt], _t[2 * kt + 1] = ot), gt--);
2789
+ }
2790
+ })(y, C), lt(Z, it, y.bl_count);
2791
+ }
2792
+ function a(y, C, L) {
2793
+ var U, A, Z = -1, K = C[1], G = 0, V = 7, it = 4;
2794
+ for (K === 0 && (V = 138, it = 3), C[2 * (L + 1) + 1] = 65535, U = 0; U <= L; U++) A = K, K = C[2 * (U + 1) + 1], ++G < V && A === K || (G < it ? y.bl_tree[2 * A] += G : A !== 0 ? (A !== Z && y.bl_tree[2 * A]++, y.bl_tree[2 * E]++) : G <= 10 ? y.bl_tree[2 * z]++ : y.bl_tree[2 * P]++, Z = A, it = (G = 0) === K ? (V = 138, 3) : A === K ? (V = 6, 3) : (V = 7, 4));
2795
+ }
2796
+ function B(y, C, L) {
2797
+ var U, A, Z = -1, K = C[1], G = 0, V = 7, it = 4;
2798
+ for (K === 0 && (V = 138, it = 3), U = 0; U <= L; U++) if (A = K, K = C[2 * (U + 1) + 1], !(++G < V && A === K)) {
2799
+ if (G < it) for (; X(y, A, y.bl_tree), --G != 0; ) ;
2800
+ else A !== 0 ? (A !== Z && (X(y, A, y.bl_tree), G--), X(y, E, y.bl_tree), H(y, G - 3, 2)) : G <= 10 ? (X(y, z, y.bl_tree), H(y, G - 3, 3)) : (X(y, P, y.bl_tree), H(y, G - 11, 7));
2801
+ Z = A, it = (G = 0) === K ? (V = 138, 3) : A === K ? (V = 6, 3) : (V = 7, 4);
2802
+ }
2803
+ }
2804
+ l(M);
2805
+ var R = !1;
2806
+ function x(y, C, L, U) {
2807
+ H(y, (d << 1) + (U ? 1 : 0), 3), (function(A, Z, K, G) {
2808
+ rt(A), q(A, K), q(A, ~K), i.arraySet(A.pending_buf, A.window, Z, K, A.pending), A.pending += K;
2809
+ })(y, C, L);
2810
+ }
2811
+ s._tr_init = function(y) {
2812
+ R || ((function() {
2813
+ var C, L, U, A, Z, K = new Array(b + 1);
2814
+ for (A = U = 0; A < _ - 1; A++) for (I[A] = U, C = 0; C < 1 << D[A]; C++) c[U++] = A;
2815
+ for (c[U - 1] = A, A = Z = 0; A < 16; A++) for (M[A] = Z, C = 0; C < 1 << $[A]; C++) j[Z++] = A;
2816
+ for (Z >>= 7; A < h; A++) for (M[A] = Z << 7, C = 0; C < 1 << $[A] - 7; C++) j[256 + Z++] = A;
2817
+ for (L = 0; L <= b; L++) K[L] = 0;
2818
+ for (C = 0; C <= 143; ) J[2 * C + 1] = 8, C++, K[8]++;
2819
+ for (; C <= 255; ) J[2 * C + 1] = 9, C++, K[9]++;
2820
+ for (; C <= 279; ) J[2 * C + 1] = 7, C++, K[7]++;
2821
+ for (; C <= 287; ) J[2 * C + 1] = 8, C++, K[8]++;
2822
+ for (lt(J, v + 1, K), C = 0; C < h; C++) k[2 * C + 1] = 5, k[2 * C] = st(C, 5);
2823
+ Y = new Q(J, D, m + 1, v, b), N = new Q(k, $, 0, h, b), tt = new Q(new Array(0), F, 0, g, w);
2824
+ })(), R = !0), y.l_desc = new O(y.dyn_ltree, Y), y.d_desc = new O(y.dyn_dtree, N), y.bl_desc = new O(y.bl_tree, tt), y.bi_buf = 0, y.bi_valid = 0, et(y);
2825
+ }, s._tr_stored_block = x, s._tr_flush_block = function(y, C, L, U) {
2826
+ var A, Z, K = 0;
2827
+ 0 < y.level ? (y.strm.data_type === 2 && (y.strm.data_type = (function(G) {
2828
+ var V, it = 4093624447;
2829
+ for (V = 0; V <= 31; V++, it >>>= 1) if (1 & it && G.dyn_ltree[2 * V] !== 0) return e;
2830
+ if (G.dyn_ltree[18] !== 0 || G.dyn_ltree[20] !== 0 || G.dyn_ltree[26] !== 0) return o;
2831
+ for (V = 32; V < m; V++) if (G.dyn_ltree[2 * V] !== 0) return o;
2832
+ return e;
2833
+ })(y)), pt(y, y.l_desc), pt(y, y.d_desc), K = (function(G) {
2834
+ var V;
2835
+ for (a(G, G.dyn_ltree, G.l_desc.max_code), a(G, G.dyn_dtree, G.d_desc.max_code), pt(G, G.bl_desc), V = g - 1; 3 <= V && G.bl_tree[2 * W[V] + 1] === 0; V--) ;
2836
+ return G.opt_len += 3 * (V + 1) + 5 + 5 + 4, V;
2837
+ })(y), A = y.opt_len + 3 + 7 >>> 3, (Z = y.static_len + 3 + 7 >>> 3) <= A && (A = Z)) : A = Z = L + 5, L + 4 <= A && C !== -1 ? x(y, C, L, U) : y.strategy === 4 || Z === A ? (H(y, 2 + (U ? 1 : 0), 3), mt(y, J, k)) : (H(y, 4 + (U ? 1 : 0), 3), (function(G, V, it, nt) {
2838
+ var dt;
2839
+ for (H(G, V - 257, 5), H(G, it - 1, 5), H(G, nt - 4, 4), dt = 0; dt < nt; dt++) H(G, G.bl_tree[2 * W[dt] + 1], 3);
2840
+ B(G, G.dyn_ltree, V - 1), B(G, G.dyn_dtree, it - 1);
2841
+ })(y, y.l_desc.max_code + 1, y.d_desc.max_code + 1, K + 1), mt(y, y.dyn_ltree, y.dyn_dtree)), et(y), U && rt(y);
2842
+ }, s._tr_tally = function(y, C, L) {
2843
+ return y.pending_buf[y.d_buf + 2 * y.last_lit] = C >>> 8 & 255, y.pending_buf[y.d_buf + 2 * y.last_lit + 1] = 255 & C, y.pending_buf[y.l_buf + y.last_lit] = 255 & L, y.last_lit++, C === 0 ? y.dyn_ltree[2 * L]++ : (y.matches++, C--, y.dyn_ltree[2 * (c[L] + m + 1)]++, y.dyn_dtree[2 * T(C)]++), y.last_lit === y.lit_bufsize - 1;
2844
+ }, s._tr_align = function(y) {
2845
+ H(y, 2, 3), X(y, S, J), (function(C) {
2846
+ C.bi_valid === 16 ? (q(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
+ })(y);
2848
+ };
2849
+ }, { "../utils/common": 41 }], 53: [function(t, u, s) {
2850
+ u.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(t, u, s) {
2854
+ (function(i) {
2855
+ (function(e, o) {
2856
+ if (!e.setImmediate) {
2857
+ var l, d, _, m, v = 1, h = {}, g = !1, f = e.document, b = Object.getPrototypeOf && Object.getPrototypeOf(e);
2858
+ b = b && b.setTimeout ? b : e, l = {}.toString.call(e.process) === "[object process]" ? function(E) {
2859
+ process.nextTick(function() {
2860
+ w(E);
2861
+ });
2862
+ } : (function() {
2863
+ if (e.postMessage && !e.importScripts) {
2864
+ var E = !0, z = e.onmessage;
2865
+ return e.onmessage = function() {
2866
+ E = !1;
2867
+ }, e.postMessage("", "*"), e.onmessage = z, E;
2868
+ }
2869
+ })() ? (m = "setImmediate$" + Math.random() + "$", e.addEventListener ? e.addEventListener("message", S, !1) : e.attachEvent("onmessage", S), function(E) {
2870
+ e.postMessage(m + E, "*");
2871
+ }) : e.MessageChannel ? ((_ = new MessageChannel()).port1.onmessage = function(E) {
2872
+ w(E.data);
2873
+ }, function(E) {
2874
+ _.port2.postMessage(E);
2875
+ }) : f && "onreadystatechange" in f.createElement("script") ? (d = f.documentElement, function(E) {
2876
+ var z = f.createElement("script");
2877
+ z.onreadystatechange = function() {
2878
+ w(E), z.onreadystatechange = null, d.removeChild(z), z = null;
2879
+ }, d.appendChild(z);
2880
+ }) : function(E) {
2881
+ setTimeout(w, 0, E);
2882
+ }, b.setImmediate = function(E) {
2883
+ typeof E != "function" && (E = new Function("" + E));
2884
+ for (var z = new Array(arguments.length - 1), P = 0; P < z.length; P++) z[P] = arguments[P + 1];
2885
+ var D = { callback: E, args: z };
2886
+ return h[v] = D, l(v), v++;
2887
+ }, b.clearImmediate = p;
2888
+ }
2889
+ function p(E) {
2890
+ delete h[E];
2891
+ }
2892
+ function w(E) {
2893
+ if (g) setTimeout(w, 0, E);
2894
+ else {
2895
+ var z = h[E];
2896
+ if (z) {
2897
+ g = !0;
2898
+ try {
2899
+ (function(P) {
2900
+ var D = P.callback, $ = P.args;
2901
+ switch ($.length) {
2902
+ case 0:
2903
+ D();
2904
+ break;
2905
+ case 1:
2906
+ D($[0]);
2907
+ break;
2908
+ case 2:
2909
+ D($[0], $[1]);
2910
+ break;
2911
+ case 3:
2912
+ D($[0], $[1], $[2]);
2913
+ break;
2914
+ default:
2915
+ D.apply(o, $);
2916
+ }
2917
+ })(z);
2918
+ } finally {
2919
+ p(E), g = !1;
2920
+ }
2921
+ }
2922
+ }
2923
+ }
2924
+ function S(E) {
2925
+ E.source === e && typeof E.data == "string" && E.data.indexOf(m) === 0 && w(+E.data.slice(m.length));
2926
+ }
2927
+ })(typeof self > "u" ? i === void 0 ? this : i : self);
2928
+ }).call(this, typeof It < "u" ? It : typeof self < "u" ? self : typeof window < "u" ? window : {});
2929
+ }, {}] }, {}, [10])(10);
2930
+ });
2931
+ })(Ut)), Ut.exports;
2932
+ }
2933
+ var An = Cn();
2934
+ const Tn = /* @__PURE__ */ zn(An);
2935
+ function ft(n) {
2936
+ const r = n.replace(/\\/g, "/"), t = r.startsWith("/"), u = [];
2937
+ for (const s of r.split("/"))
2938
+ if (!(s === "" || s === ".")) {
2939
+ if (s === "..") {
2940
+ u.length > 0 && u[u.length - 1] !== ".." ? u.pop() : t || u.push("..");
2941
+ continue;
2942
+ }
2943
+ u.push(s);
2944
+ }
2945
+ return (t ? "/" : "") + u.join("/");
2946
+ }
2947
+ function qt(n) {
2948
+ const r = n.lastIndexOf("/");
2949
+ return r >= 0 ? n.slice(0, r) : "";
2950
+ }
2951
+ function yt(n) {
2952
+ return n.split("/").pop() ?? n;
2953
+ }
2954
+ function vt(n) {
2955
+ const r = yt(n).toLowerCase().match(/\.([^.]+)$/);
2956
+ return r ? r[1] : "";
2957
+ }
2958
+ function Dt(n) {
2959
+ return yt(n).replace(/\.[^.]+$/, "");
2960
+ }
2961
+ function bt(...n) {
2962
+ return ft(n.filter((r) => !!r).join("/"));
2963
+ }
2964
+ function In(n, r) {
2965
+ if (!n)
2966
+ return r;
2967
+ const t = n.endsWith("/") ? n : `${n}/`;
2968
+ return r.startsWith(t) ? r.slice(t.length) : r;
2969
+ }
2970
+ const Xt = /(\\(input|include) *\{([^{}]+)\})/g;
2971
+ function Qt(n, r, t) {
2972
+ const u = qt(r);
2973
+ return [
2974
+ n,
2975
+ `${n}.tex`,
2976
+ u ? bt(u, n) : n,
2977
+ u ? bt(u, `${n}.tex`) : `${n}.tex`
2978
+ ].map(ft).find((i) => i in t) ?? null;
2979
+ }
2980
+ function fe(n, r, t, u = 3) {
2981
+ let s = 0;
2982
+ const i = [], e = /* @__PURE__ */ new Set(), o = (d) => {
2983
+ let _ = !1;
2984
+ return { output: d.replace(
2985
+ Xt,
2986
+ (v, h, g, f) => {
2987
+ const b = Qt(f, r, t);
2988
+ return b ? e.has(b) ? "" : (_ = !0, s += 1, e.add(b), t[b]) : (i.includes(f) || i.push(f), v);
2989
+ }
2990
+ ), changed: _ };
2991
+ };
2992
+ let l = n;
2993
+ for (let d = 0; d < u; d += 1) {
2994
+ const { output: _, changed: m } = o(l);
2995
+ if (l = _, !m)
2996
+ break;
2997
+ }
2998
+ return {
2999
+ expandedText: l,
3000
+ expandedCount: s,
3001
+ missingInputs: i,
3002
+ consumedPaths: [...e]
3003
+ };
3004
+ }
3005
+ function On(n) {
3006
+ const r = /* @__PURE__ */ new Set();
3007
+ for (const [t, u] of Object.entries(n)) {
3008
+ Xt.lastIndex = 0;
3009
+ let s;
3010
+ for (; (s = Xt.exec(u)) !== null; ) {
3011
+ const i = Qt(s[3], t, n);
3012
+ i && i !== t && r.add(i);
3013
+ }
3014
+ }
3015
+ return r;
3016
+ }
3017
+ const Ht = /<xi:include\b[^>]*\bhref\s*=\s*(?:"([^"]+)"|'([^']+)')[^>]*\/>/g;
3018
+ function Ee(n, r, t) {
3019
+ const u = qt(r), s = [
3020
+ n,
3021
+ `${n}.ptx`,
3022
+ `${n}.xml`,
3023
+ u ? bt(u, n) : null,
3024
+ u ? bt(u, `${n}.ptx`) : `${n}.ptx`,
3025
+ u ? bt(u, `${n}.xml`) : `${n}.xml`
3026
+ ].filter((i) => i !== null);
3027
+ for (const i of s) {
3028
+ const e = ft(i);
3029
+ if (e in t)
3030
+ return e;
3031
+ }
3032
+ return null;
3033
+ }
3034
+ function Rn(n) {
3035
+ return n.replace(/^\s*<\?xml[^?]*\?>\s*/, "");
3036
+ }
3037
+ function Fn(n, r, t, u = 5) {
3038
+ let s = 0;
3039
+ const i = [], e = [], o = /* @__PURE__ */ new Set(), l = (_, m) => {
3040
+ let v = !1;
3041
+ return { output: _.replace(
3042
+ Ht,
3043
+ (g, f, b) => {
3044
+ const p = f ?? b ?? "", w = Ee(p, m, t);
3045
+ return w ? e.includes(w) ? g : (v = !0, s += 1, o.add(w), Rn(t[w])) : (i.includes(p) || i.push(p), g);
3046
+ }
3047
+ ), changed: v };
3048
+ };
3049
+ let d = n;
3050
+ for (let _ = 0; _ < u; _ += 1) {
3051
+ e.push(r);
3052
+ const { output: m, changed: v } = l(d, r);
3053
+ if (e.pop(), d = m, !v)
3054
+ break;
3055
+ }
3056
+ return {
3057
+ expandedText: d,
3058
+ expandedCount: s,
3059
+ missingIncludes: i,
3060
+ consumedPaths: [...o]
3061
+ };
3062
+ }
3063
+ function Pn(n) {
3064
+ const r = /* @__PURE__ */ new Set();
3065
+ for (const [t, u] of Object.entries(n)) {
3066
+ Ht.lastIndex = 0;
3067
+ let s;
3068
+ for (; (s = Ht.exec(u)) !== null; ) {
3069
+ const i = s[1] ?? s[2] ?? "", e = Ee(i, t, n);
3070
+ e && e !== t && r.add(e);
3071
+ }
3072
+ }
3073
+ return r;
3074
+ }
3075
+ function Dn(n) {
3076
+ const { mainSource: r, publication: t, outputBase: u = "output" } = n;
3077
+ return `<?xml version="1.0" encoding="UTF-8"?>
3078
+ <project ptx-version="2">
3079
+ <targets>
3080
+ <target name="web">
3081
+ <format>html</format>
3082
+ <source>${r}</source>
3083
+ <publication>${t}</publication>
3084
+ <output-dir>${u}/web</output-dir>
3085
+ </target>
3086
+ <target name="print">
3087
+ <format>pdf</format>
3088
+ <source>${r}</source>
3089
+ <publication>${t}</publication>
3090
+ <output-dir>${u}/print</output-dir>
3091
+ </target>
3092
+ </targets>
3093
+ </project>
3094
+ `;
3095
+ }
3096
+ function ze() {
3097
+ return `<?xml version="1.0" encoding="UTF-8"?>
3098
+ <publication>
3099
+ <source>
3100
+ <directories external="external" generated="generated"/>
3101
+ </source>
3102
+ <common>
3103
+ <chunking level="1"/>
3104
+ </common>
3105
+ </publication>
3106
+ `;
3107
+ }
3108
+ function jn() {
3109
+ return `<?xml version="1.0" encoding="UTF-8"?>
3110
+ `;
3111
+ }
3112
+ const de = /([a-zA-Z_:][\w:.-]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
3113
+ function jt(n) {
3114
+ const r = {};
3115
+ let t;
3116
+ for (de.lastIndex = 0; (t = de.exec(n)) !== null; )
3117
+ r[t[1]] = t[2] ?? t[3] ?? "";
3118
+ return r;
3119
+ }
3120
+ function Ce(n) {
3121
+ const r = [];
3122
+ let t = 0;
3123
+ const u = n.length;
3124
+ for (; t < u; ) {
3125
+ const s = n.indexOf("<", t);
3126
+ if (s < 0) break;
3127
+ if (n.startsWith("<!--", s)) {
3128
+ const f = n.indexOf("-->", s + 4);
3129
+ t = f < 0 ? u : f + 3;
3130
+ continue;
3131
+ }
3132
+ if (n.startsWith("<![CDATA[", s)) {
3133
+ const f = n.indexOf("]]>", s + 9);
3134
+ t = f < 0 ? u : f + 3;
3135
+ continue;
3136
+ }
3137
+ if (n.startsWith("<?", s)) {
3138
+ const f = n.indexOf("?>", s + 2);
3139
+ t = f < 0 ? u : f + 2;
3140
+ continue;
3141
+ }
3142
+ if (n.startsWith("<!", s)) {
3143
+ const f = n.indexOf(">", s + 2);
3144
+ t = f < 0 ? u : f + 1;
3145
+ continue;
3146
+ }
3147
+ let i = s + 1, e = !1;
3148
+ n[i] === "/" && (e = !0, i += 1);
3149
+ const o = /^[a-zA-Z_:][\w:.-]*/.exec(n.slice(i));
3150
+ if (!o) {
3151
+ t = s + 1;
3152
+ continue;
3153
+ }
3154
+ const l = o[0];
3155
+ i += l.length;
3156
+ let d = i, _ = null;
3157
+ for (; i < u; ) {
3158
+ const f = n[i];
3159
+ if (_) {
3160
+ f === _ && (_ = null), i += 1;
3161
+ continue;
3162
+ }
3163
+ if (f === '"' || f === "'") {
3164
+ _ = f, i += 1;
3165
+ continue;
3166
+ }
3167
+ if (f === ">")
3168
+ break;
3169
+ i += 1;
3170
+ }
3171
+ if (i >= u) break;
3172
+ const m = i + 1, v = n.slice(d, i), h = !e && v.trimEnd().endsWith("/"), g = h ? v.replace(/\/\s*$/, "") : v;
3173
+ e ? r.push({ kind: "close", name: l, pos: s, end: m }) : h ? r.push({ kind: "selfclose", name: l, attrs: g, pos: s, end: m }) : r.push({ kind: "open", name: l, attrs: g, pos: s, end: m }), t = m;
3174
+ }
3175
+ return r;
3176
+ }
3177
+ function Ae(n, r) {
3178
+ return Te(n, (t) => t === r);
3179
+ }
3180
+ function Te(n, r) {
3181
+ const t = Ce(n), u = [];
3182
+ let s = 0, i = null;
3183
+ for (const e of t) {
3184
+ if (e.kind === "selfclose") {
3185
+ s === 0 && r(e.name) && u.push({
3186
+ name: e.name,
3187
+ start: e.pos,
3188
+ startTagEnd: e.end,
3189
+ contentEnd: e.end,
3190
+ end: e.end,
3191
+ inner: "",
3192
+ outer: n.slice(e.pos, e.end),
3193
+ attributes: jt(e.attrs)
3194
+ });
3195
+ continue;
3196
+ }
3197
+ if (e.kind === "open") {
3198
+ s === 0 && r(e.name) && !i && (i = e), s += 1;
3199
+ continue;
3200
+ }
3201
+ s -= 1, s < 0 && (s = 0), i && s === 0 && e.name === i.name && (u.push({
3202
+ name: i.name,
3203
+ start: i.pos,
3204
+ startTagEnd: i.end,
3205
+ contentEnd: e.pos,
3206
+ end: e.end,
3207
+ inner: n.slice(i.end, e.pos),
3208
+ outer: n.slice(i.pos, e.end),
3209
+ attributes: jt(i.attrs)
3210
+ }), i = null);
3211
+ }
3212
+ return u;
3213
+ }
3214
+ function ht(n, r) {
3215
+ return Ae(n, r)[0] ?? null;
3216
+ }
3217
+ function Rt(n, r) {
3218
+ const t = Ce(n);
3219
+ let u = 0, s = null, i = -1;
3220
+ for (const e of t) {
3221
+ if (e.kind === "selfclose") {
3222
+ if (!s && e.name === r)
3223
+ return {
3224
+ name: r,
3225
+ start: e.pos,
3226
+ startTagEnd: e.end,
3227
+ contentEnd: e.end,
3228
+ end: e.end,
3229
+ inner: "",
3230
+ outer: n.slice(e.pos, e.end),
3231
+ attributes: jt(e.attrs)
3232
+ };
3233
+ continue;
3234
+ }
3235
+ if (e.kind === "open") {
3236
+ !s && e.name === r && (s = e, i = u), u += 1;
3237
+ continue;
3238
+ }
3239
+ if (u -= 1, u < 0 && (u = 0), s && e.name === r && u === i) {
3240
+ const o = s.attrs;
3241
+ return {
3242
+ name: r,
3243
+ start: s.pos,
3244
+ startTagEnd: s.end,
3245
+ contentEnd: e.pos,
3246
+ end: e.end,
3247
+ inner: n.slice(s.end, e.pos),
3248
+ outer: n.slice(s.pos, e.end),
3249
+ attributes: jt(o)
3250
+ };
3251
+ }
3252
+ }
3253
+ return null;
3254
+ }
3255
+ function Bn(n) {
3256
+ return Rt(n, "book") ? "book" : Rt(n, "article") ? "article" : Rt(n, "chapter") ? "book" : "article";
3257
+ }
3258
+ const $n = "http://www.w3.org/2001/XInclude";
3259
+ function Ie(n) {
3260
+ return n.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 60);
3261
+ }
3262
+ function Ct(n, r) {
3263
+ const t = String(r).length;
3264
+ return String(n).padStart(Math.max(t, 2), "0");
3265
+ }
3266
+ function Ln(n, r) {
3267
+ const t = [...r].sort((i, e) => i.start - e.start);
3268
+ let u = "", s = 0;
3269
+ for (const i of t)
3270
+ u += n.slice(s, i.start), u += i.replacement, s = i.end;
3271
+ return u += n.slice(s), u;
3272
+ }
3273
+ function he(n) {
3274
+ return n.replace(
3275
+ /<([a-zA-Z_][\w:.-]*)\b([^>]*)>/,
3276
+ (r, t, u) => /\bxmlns:xi\s*=/.test(u) ? r : `<${t}${u} xmlns:xi="${$n}">`
3277
+ );
3278
+ }
3279
+ function pe(n) {
3280
+ return n.startsWith("<?xml") ? n : jn() + n;
3281
+ }
3282
+ const Qr = ["book", "article"], Nn = [
3283
+ "frontmatter",
3284
+ "preface",
3285
+ "acknowledgement",
3286
+ "dedication",
3287
+ "biography",
3288
+ "contributors",
3289
+ "part",
3290
+ "chapter",
3291
+ "section",
3292
+ "subsection",
3293
+ "subsubsection",
3294
+ "exercises",
3295
+ "worksheet",
3296
+ "reading-questions",
3297
+ "references",
3298
+ "solutions",
3299
+ "glossary",
3300
+ "backmatter",
3301
+ "appendix",
3302
+ "index",
3303
+ "colophon"
3304
+ ], Un = new Set(Nn);
3305
+ function Mn(n) {
3306
+ return Un.has(n);
3307
+ }
3308
+ const Wn = {
3309
+ chapter: "ch",
3310
+ section: "sec",
3311
+ subsection: "subsec",
3312
+ subsubsection: "subsubsec",
3313
+ appendix: "app"
3314
+ };
3315
+ function Oe(n) {
3316
+ return Wn[n] ?? n;
3317
+ }
3318
+ const Zn = /* @__PURE__ */ new Set([
3319
+ "frontmatter",
3320
+ "backmatter",
3321
+ "preface",
3322
+ "acknowledgement",
3323
+ "dedication",
3324
+ "biography",
3325
+ "contributors",
3326
+ "colophon",
3327
+ "glossary",
3328
+ "index"
3329
+ ]);
3330
+ function Gn(n) {
3331
+ return Zn.has(n);
3332
+ }
3333
+ function te(n) {
3334
+ return n.trim().replace(/[^a-zA-Z0-9\-_]+/g, "-").replace(/^[^a-zA-Z_]+/, "").replace(/-+$/, "");
3335
+ }
3336
+ class ee {
3337
+ used = /* @__PURE__ */ new Set();
3338
+ claim(r) {
3339
+ let t = r, u = 2;
3340
+ for (; this.used.has(t); )
3341
+ t = `${r}-${u}`, u += 1;
3342
+ return this.used.add(t), t;
3343
+ }
3344
+ has(r) {
3345
+ return this.used.has(r);
3346
+ }
3347
+ }
3348
+ function Kt(n, r, t) {
3349
+ if (n) {
3350
+ const u = te(n) || t, s = r.claim(u);
3351
+ return s !== n ? { ref: s, renamedFrom: n, generated: !1 } : { ref: s, generated: !1 };
3352
+ }
3353
+ return { ref: r.claim(t), generated: !0 };
3354
+ }
3355
+ function Bt(n, r, t, u) {
3356
+ r.renamedFrom !== void 0 ? n.push({
3357
+ action: "anomaly",
3358
+ severity: "warning",
3359
+ kind: "structure",
3360
+ category: "renamed_xml_id",
3361
+ macro: t,
3362
+ occurrences: 1,
3363
+ message: `${t} id \`${r.renamedFrom}\` is not a valid ref (or collides with another); renamed to \`${r.ref}\`. Cross-references to the old id will break.`
3364
+ }) : r.generated && n.push({
3365
+ action: "anomaly",
3366
+ severity: "info",
3367
+ kind: "structure",
3368
+ category: "missing_xml_id",
3369
+ macro: t,
3370
+ occurrences: 1,
3371
+ message: `${t} at position ${u} has no id; assigned \`${r.ref}\`.`
3372
+ });
3373
+ }
3374
+ function $t(n, r) {
3375
+ return Object.entries(n).map(([t, u]) => {
3376
+ const s = t.split("/").pop() ?? t, i = s.replace(/\.[^.]+$/, "");
3377
+ return { ref: r.claim(te(i) || "asset"), fileName: s, data: u };
3378
+ });
3379
+ }
3380
+ function Xn(n, r) {
3381
+ return n.splitLevel !== void 0 ? Math.max(0, n.splitLevel) : n.splitChapters === !1 ? 0 : n.splitSections ? r === "book" ? 2 : 1 : r === "book" ? 1 : 0;
3382
+ }
3383
+ function Re(n, r, t) {
3384
+ const u = n.slice(0, r), s = n.slice(r);
3385
+ return /\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/.test(u) ? u.replace(
3386
+ /\bxml:id\s*=\s*(?:"[^"]*"|'[^']*')/,
3387
+ `xml:id="${t}"`
3388
+ ) + s : u.replace(/^<([a-zA-Z_:][\w:.-]*)/, `<$1 xml:id="${t}"`) + s;
3389
+ }
3390
+ function Fe(n) {
3391
+ const r = ht(n, "title");
3392
+ return r ? r.inner.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim() : "";
3393
+ }
3394
+ function Pe(n, r, t) {
3395
+ return Kt(n.attributes["xml:id"], r, t);
3396
+ }
3397
+ function De(n, r) {
3398
+ const t = n.outer.slice(0, n.startTagEnd - n.start), u = n.outer.slice(n.contentEnd - n.start);
3399
+ return t + r + u;
3400
+ }
3401
+ function je(n, r, t, u) {
3402
+ if (t > u.maxDepth)
3403
+ return n;
3404
+ const s = Te(n, Mn);
3405
+ if (s.length === 0)
3406
+ return n;
3407
+ const i = s.map((e, o) => {
3408
+ const l = o + 1, _ = `${Oe(e.name)}-${Ct(l, s.length)}`, m = t === 1 ? _ : `${r}-${_}`, v = Pe(e, u.refs, m);
3409
+ Bt(u.warnings, v, e.name, l);
3410
+ const h = je(
3411
+ e.inner,
3412
+ v.ref,
3413
+ t + 1,
3414
+ u
3415
+ );
3416
+ return u.divisions.push({
3417
+ xmlId: v.ref,
3418
+ type: e.name,
3419
+ title: Fe(e.inner),
3420
+ sourceFormat: "pretext",
3421
+ content: Re(
3422
+ De(e, h),
3423
+ e.startTagEnd - e.start,
3424
+ v.ref
3425
+ ),
3426
+ isRoot: !1
3427
+ }), {
3428
+ start: e.start,
3429
+ end: e.end,
3430
+ replacement: `<plus:${e.name} ref="${v.ref}"/>`
3431
+ };
3432
+ });
3433
+ return Ln(n, i);
3434
+ }
3435
+ function Hn(n, r = {}) {
3436
+ const t = [], u = r.documentKind ?? Bn(n), s = Xn(r, u), i = Rt(n, "pretext"), e = i ? i.inner : n, o = ht(e, "docinfo"), l = o?.outer.trim() ?? "";
3437
+ let d = ht(e, "book") ?? ht(e, "article");
3438
+ if (!d) {
3439
+ const p = u === "book" ? "book" : "article", w = (o ? e.slice(0, o.start) + e.slice(o.end) : e).trim();
3440
+ d = ht(
3441
+ `<${p}>
3442
+ ${w}
3443
+ </${p}>`,
3444
+ p
3445
+ );
3446
+ }
3447
+ if (!d)
3448
+ throw new Error("Could not locate a root element for the division pool.");
3449
+ u === "book" && d.name !== "book" && t.push({
3450
+ action: "anomaly",
3451
+ severity: "warning",
3452
+ kind: "structure",
3453
+ category: "missing_root",
3454
+ macro: "book",
3455
+ occurrences: 1,
3456
+ message: "Document was treated as a book but no <book> element found; importing with the existing root."
3457
+ });
3458
+ const _ = new ee(), m = [], v = Pe(d, _, "document");
3459
+ v.renamedFrom !== void 0 && Bt(t, v, d.name, 1);
3460
+ const h = Fe(d.inner), g = je(d.inner, v.ref, 1, {
3461
+ refs: _,
3462
+ divisions: m,
3463
+ warnings: t,
3464
+ maxDepth: s
3465
+ }), f = {
3466
+ xmlId: v.ref,
3467
+ type: d.name === "book" ? "book" : "article",
3468
+ title: h,
3469
+ sourceFormat: "pretext",
3470
+ content: Re(
3471
+ De(d, g),
3472
+ d.startTagEnd - d.start,
3473
+ v.ref
3474
+ ),
3475
+ isRoot: !0
3476
+ };
3477
+ m.unshift(f);
3478
+ const b = $t(r.assets ?? {}, _);
3479
+ return {
3480
+ project: {
3481
+ title: h,
3482
+ docinfo: l,
3483
+ documentKind: u,
3484
+ divisions: m,
3485
+ assets: b
3486
+ },
3487
+ warnings: t
3488
+ };
3489
+ }
3490
+ function Kn(n, r, t = {}) {
3491
+ return r === "latex" ? qn(n, t) : tr(n, t);
3492
+ }
3493
+ function me(n) {
3494
+ return te(Ie(n));
3495
+ }
3496
+ function Lt(n, r, t, u, s, i, e) {
3497
+ if (n) {
3498
+ const d = Kt(
3499
+ n,
3500
+ t,
3501
+ me(r) || u
3502
+ );
3503
+ return Bt(e, d, s, i), d.ref;
3504
+ }
3505
+ const o = me(r);
3506
+ if (o)
3507
+ return t.claim(o);
3508
+ const l = Kt(void 0, t, u);
3509
+ return Bt(e, l, s, i), l.ref;
3510
+ }
3511
+ function Be(n) {
3512
+ return n.replace(/\\[a-zA-Z]+\{([^{}]*)\}/g, "$1").replace(/\\[a-zA-Z]+/g, "").replace(/[{}]/g, "").replace(/\s+/g, " ").trim();
3513
+ }
3514
+ function Yn(n, r) {
3515
+ let t = r;
3516
+ for (; t < n.length && /\s/.test(n[t]); ) t++;
3517
+ if (n[t] !== "{") return null;
3518
+ const u = t;
3519
+ let s = 0;
3520
+ for (; t < n.length; t++) {
3521
+ const i = n[t];
3522
+ if (i === "\\") {
3523
+ t++;
3524
+ continue;
3525
+ }
3526
+ if (i === "{") s++;
3527
+ else if (i === "}" && (s--, s === 0))
3528
+ return { inner: n.slice(u + 1, t), end: t + 1 };
3529
+ }
3530
+ return null;
3531
+ }
3532
+ function Vn(n, r) {
3533
+ let t = r;
3534
+ for (; t < n.length && /\s/.test(n[t]); ) t++;
3535
+ if (n[t] !== "[") return r;
3536
+ let u = 0;
3537
+ for (; t < n.length; t++) {
3538
+ const s = n[t];
3539
+ if (s === "\\") {
3540
+ t++;
3541
+ continue;
3542
+ }
3543
+ if (s === "[") u++;
3544
+ else if (s === "]" && (u--, u === 0))
3545
+ return t + 1;
3546
+ }
3547
+ return r;
3548
+ }
3549
+ function Jn(n, r) {
3550
+ let t = 0;
3551
+ for (let u = 0; u < r; u++) {
3552
+ const s = n[u];
3553
+ if (s === "\\") {
3554
+ u++;
3555
+ continue;
3556
+ }
3557
+ s === "{" ? t++ : s === "}" && t--;
3558
+ }
3559
+ return t;
3560
+ }
3561
+ function $e(n, r) {
3562
+ const t = [], u = new RegExp(`\\\\${r}\\*?(?![a-zA-Z])`, "g");
3563
+ let s;
3564
+ for (; (s = u.exec(n)) !== null; ) {
3565
+ const i = s.index;
3566
+ if (Jn(n, i) !== 0) continue;
3567
+ const e = Yn(
3568
+ n,
3569
+ Vn(n, i + s[0].length)
3570
+ );
3571
+ if (!e) continue;
3572
+ let o = e.end, l;
3573
+ const d = /^\s*\\label\s*\{([^{}]*)\}/.exec(n.slice(e.end));
3574
+ d && (l = d[1].trim(), o = e.end + d[0].length), t.push({ start: i, rawTitle: e.inner, contentStart: o, labelId: l });
3575
+ }
3576
+ return t;
3577
+ }
3578
+ function qn(n, r) {
3579
+ const t = [], { body: u } = zt(n), s = (u || n).trim(), i = $e(s, "chapter"), e = r.documentKind ?? (i.length > 0 ? "book" : "article"), o = r.splitChapters ?? e === "book", l = r.splitSections ?? !1, d = new ee(), _ = d.claim("document"), m = [];
3580
+ let v = s;
3581
+ if (o && e === "book" && i.length > 0) {
3582
+ const b = [s.slice(0, i[0].start)];
3583
+ i.forEach((p, w) => {
3584
+ const S = i[w + 1]?.start ?? s.length, E = Be(p.rawTitle), z = Lt(
3585
+ p.labelId,
3586
+ E,
3587
+ d,
3588
+ `ch-${Ct(w + 1, i.length)}`,
3589
+ "chapter",
3590
+ w + 1,
3591
+ t
3592
+ );
3593
+ let P = s.slice(p.contentStart, S);
3594
+ l && (P = Qn(
3595
+ P,
3596
+ z,
3597
+ d,
3598
+ m,
3599
+ t
3600
+ )), m.push({
3601
+ xmlId: z,
3602
+ type: "chapter",
3603
+ title: E,
3604
+ sourceFormat: "latex",
3605
+ content: `\\chapter{${p.rawTitle}}\\label{${z}}
3606
+ ${P.trim()}`,
3607
+ isRoot: !1
3608
+ }), b.push(`\\plus{chapter}{${z}}`);
3609
+ }), v = b.join(`
3610
+
3611
+ `).trim();
3612
+ }
3613
+ const h = e === "book" ? "book" : "article", g = r.title ?? "", f = `\\${h}{${g}}\\label{${_}}`;
3614
+ return m.unshift({
3615
+ xmlId: _,
3616
+ type: h,
3617
+ title: g,
3618
+ sourceFormat: "latex",
3619
+ content: v ? `${f}
3620
+ ${v}` : f,
3621
+ isRoot: !0
3622
+ }), {
3623
+ project: {
3624
+ title: r.title ?? "",
3625
+ docinfo: r.docinfo ?? "",
3626
+ documentKind: e,
3627
+ divisions: m,
3628
+ assets: $t(r.assets ?? {}, d)
3629
+ },
3630
+ warnings: t
3631
+ };
3632
+ }
3633
+ function Qn(n, r, t, u, s) {
3634
+ const i = $e(n, "section");
3635
+ if (i.length === 0) return n;
3636
+ const e = [n.slice(0, i[0].start)];
3637
+ return i.forEach((o, l) => {
3638
+ const d = i[l + 1]?.start ?? n.length, _ = Be(o.rawTitle), m = Lt(
3639
+ o.labelId,
3640
+ _,
3641
+ t,
3642
+ `${r}-sec-${Ct(l + 1, i.length)}`,
3643
+ "section",
3644
+ l + 1,
3645
+ s
3646
+ ), v = n.slice(o.contentStart, d).trim();
3647
+ u.push({
3648
+ xmlId: m,
3649
+ type: "section",
3650
+ title: _,
3651
+ sourceFormat: "latex",
3652
+ content: `\\section{${o.rawTitle}}\\label{${m}}
3653
+ ${v}`,
3654
+ isRoot: !1
3655
+ }), e.push(`\\plus{section}{${m}}`);
3656
+ }), e.join(`
3657
+
3658
+ `).trim();
3659
+ }
3660
+ function Le(n, r) {
3661
+ const t = new RegExp(`^#{${r}}\\s+(.*)$`), u = [], s = [];
3662
+ let i = null, e = !1, o = "";
3663
+ for (const l of n.split(`
3664
+ `)) {
3665
+ const d = /^\s*(```+|~~~+)/.exec(l);
3666
+ if (d) {
3667
+ const m = d[1][0];
3668
+ e ? m === o && (e = !1) : (e = !0, o = m), (i ? i.bodyLines : s).push(l);
3669
+ continue;
3670
+ }
3671
+ const _ = e ? null : t.exec(l);
3672
+ _ ? (i && u.push(i), i = { headingText: _[1].trim(), bodyLines: [] }) : (i ? i.bodyLines : s).push(l);
3673
+ }
3674
+ return i && u.push(i), {
3675
+ preamble: s.join(`
3676
+ `).trim(),
3677
+ sections: u.map((l) => ({
3678
+ headingText: l.headingText,
3679
+ body: l.bodyLines.join(`
3680
+ `).trim()
3681
+ }))
3682
+ };
3683
+ }
3684
+ function Ft(n) {
3685
+ return `---
3686
+ ${Object.entries(n).map(([t, u]) => `${t}: ${u}`).join(`
3687
+ `)}
3688
+ ---`;
3689
+ }
3690
+ function tr(n, r) {
3691
+ const t = [], u = n.trim(), s = r.documentKind ?? "article", i = r.splitChapters ?? s === "book", e = r.splitSections ?? !1, o = new ee(), l = o.claim("document"), d = [];
3692
+ if (!(i && s === "book"))
3693
+ return d.push({
3694
+ xmlId: l,
3695
+ type: s === "book" ? "book" : "article",
3696
+ title: r.title ?? "",
3697
+ sourceFormat: "markdown",
3698
+ content: `${Ft({
3699
+ division: s,
3700
+ id: l,
3701
+ title: r.title ?? ""
3702
+ })}
3703
+
3704
+ ${u}`.trim(),
3705
+ isRoot: !0
3706
+ }), {
3707
+ project: {
3708
+ title: r.title ?? "",
3709
+ docinfo: r.docinfo ?? "",
3710
+ documentKind: s,
3711
+ divisions: d,
3712
+ assets: $t(r.assets ?? {}, o)
3713
+ },
3714
+ warnings: t
3715
+ };
3716
+ const { preamble: _, sections: m } = Le(u, 1), v = _ ? [_] : [];
3717
+ return m.forEach((h, g) => {
3718
+ const f = Lt(
3719
+ void 0,
3720
+ h.headingText,
3721
+ o,
3722
+ `ch-${Ct(g + 1, m.length)}`,
3723
+ "chapter",
3724
+ g + 1,
3725
+ t
3726
+ );
3727
+ let b = h.body;
3728
+ e && (b = er(
3729
+ h.body,
3730
+ f,
3731
+ o,
3732
+ d,
3733
+ t
3734
+ )), d.push({
3735
+ xmlId: f,
3736
+ type: "chapter",
3737
+ title: h.headingText,
3738
+ sourceFormat: "markdown",
3739
+ content: `${Ft({
3740
+ division: "chapter",
3741
+ id: f,
3742
+ title: h.headingText
3743
+ })}
3744
+
3745
+ # ${h.headingText}
3746
+
3747
+ ${b}`.trim(),
3748
+ isRoot: !1
3749
+ }), v.push(`::chapter{ref="${f}"}`);
3750
+ }), d.unshift({
3751
+ xmlId: l,
3752
+ type: "book",
3753
+ title: r.title ?? "",
3754
+ sourceFormat: "markdown",
3755
+ content: `${Ft({
3756
+ division: "book",
3757
+ id: l,
3758
+ title: r.title ?? ""
3759
+ })}
3760
+
3761
+ ${v.join(`
3762
+
3763
+ `)}`.trim(),
3764
+ isRoot: !0
3765
+ }), {
3766
+ project: {
3767
+ title: r.title ?? "",
3768
+ docinfo: r.docinfo ?? "",
3769
+ documentKind: s,
3770
+ divisions: d,
3771
+ assets: $t(r.assets ?? {}, o)
3772
+ },
3773
+ warnings: t
3774
+ };
3775
+ }
3776
+ function er(n, r, t, u, s) {
3777
+ const { preamble: i, sections: e } = Le(n, 2);
3778
+ if (e.length === 0) return n;
3779
+ const o = i ? [i] : [];
3780
+ return e.forEach((l, d) => {
3781
+ const _ = Lt(
3782
+ void 0,
3783
+ l.headingText,
3784
+ t,
3785
+ `${r}-sec-${Ct(d + 1, e.length)}`,
3786
+ "section",
3787
+ d + 1,
3788
+ s
3789
+ );
3790
+ u.push({
3791
+ xmlId: _,
3792
+ type: "section",
3793
+ title: l.headingText,
3794
+ sourceFormat: "markdown",
3795
+ content: `${Ft({
3796
+ division: "section",
3797
+ id: _,
3798
+ title: l.headingText
3799
+ })}
3800
+
3801
+ # ${l.headingText}
3802
+
3803
+ ${l.body}`.trim(),
3804
+ isRoot: !1
3805
+ }), o.push(`::section{ref="${_}"}`);
3806
+ }), o.join(`
3807
+
3808
+ `).trim();
3809
+ }
3810
+ const Mt = {
3811
+ mainSourcePath: "source/main.ptx",
3812
+ publicationPath: "publication/publication.ptx",
3813
+ projectFilePath: "project.ptx"
3814
+ }, Yt = /<plus:([a-zA-Z][a-zA-Z-]*)\s+ref="([^"]+)"\s*\/>/g;
3815
+ function Wt(n) {
3816
+ const r = [];
3817
+ Yt.lastIndex = 0;
3818
+ let t;
3819
+ for (; (t = Yt.exec(n)) !== null; )
3820
+ r.push(t[2]);
3821
+ return r;
3822
+ }
3823
+ function nr(n, r) {
3824
+ const t = Ie(n) || "division";
3825
+ return t.startsWith(`${r}-`) ? t : `${r}-${t}`;
3826
+ }
3827
+ function rr(n, r) {
3828
+ let t = r, u = 2;
3829
+ for (; n.has(t); )
3830
+ t = `${r}-${u}`, u += 1;
3831
+ return n.add(t), t;
3832
+ }
3833
+ function ir(n, r) {
3834
+ const t = `${r}-`;
3835
+ return n.startsWith(t) ? n.slice(t.length) : n;
3836
+ }
3837
+ function ge(n, r) {
3838
+ return n.replace(
3839
+ Yt,
3840
+ (t, u, s) => {
3841
+ const i = r.get(s);
3842
+ return i ? `<xi:include href="${i}"/>` : t;
3843
+ }
3844
+ );
3845
+ }
3846
+ function sr(n, r = {}) {
3847
+ const t = r.mainSourcePath ?? Mt.mainSourcePath, u = r.publicationPath ?? Mt.publicationPath, s = r.projectFilePath ?? Mt.projectFilePath, i = r.includeScaffold ?? !0, e = {}, o = new Map(
3848
+ n.divisions.map((E) => [E.xmlId, E])
3849
+ ), l = n.divisions.find((E) => E.isRoot);
3850
+ if (!l)
3851
+ throw new Error("Division pool has no root division.");
3852
+ const d = /* @__PURE__ */ new Map(), _ = t.includes("/") ? t.slice(0, t.lastIndexOf("/") + 1) : "", m = [], v = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map();
3853
+ function g(E, z) {
3854
+ let P = h.get(E);
3855
+ return P || (P = /* @__PURE__ */ new Set(), h.set(E, P)), rr(P, z);
3856
+ }
3857
+ function f(E, z, P, D) {
3858
+ if (v.has(E.xmlId))
3859
+ return;
3860
+ v.add(E.xmlId);
3861
+ const $ = g(
3862
+ z,
3863
+ Gn(E.type) ? E.type : nr(
3864
+ ir(E.xmlId, D),
3865
+ Oe(E.type)
3866
+ )
3867
+ );
3868
+ d.set(E.xmlId, `${P}${$}.ptx`), m.push({ division: E, filePath: `${z}${$}.ptx` });
3869
+ for (const F of Wt(E.content)) {
3870
+ const W = o.get(F);
3871
+ W && f(W, `${z}${$}/`, `${$}/`, E.xmlId);
3872
+ }
3873
+ }
3874
+ for (const E of Wt(l.content)) {
3875
+ const z = o.get(E);
3876
+ z && f(z, _, "", l.xmlId);
3877
+ }
3878
+ const b = /* @__PURE__ */ new Set();
3879
+ for (const E of n.divisions)
3880
+ for (const z of Wt(E.content))
3881
+ b.add(z);
3882
+ for (const E of n.divisions)
3883
+ E.isRoot || b.has(E.xmlId) || f(E, _, "", l.xmlId);
3884
+ for (const { division: E, filePath: z } of m) {
3885
+ const P = ge(E.content, d), D = P === E.content ? P : he(P);
3886
+ e[z] = pe(D);
3887
+ }
3888
+ const p = ge(l.content, d), S = `<pretext>
3889
+ ${n.docinfo ? `${n.docinfo}
3890
+ ` : ""}${p}
3891
+ </pretext>`;
3892
+ return e[t] = pe(
3893
+ p === l.content ? S : he(S)
3894
+ ), i && (e[s] = Dn({
3895
+ mainSource: t,
3896
+ publication: u
3897
+ }), e[u] = ze()), { files: e };
3898
+ }
3899
+ const ar = "source", or = "publication", _e = "main.ptx";
3900
+ function Et(n, r) {
3901
+ const t = ht(n.inner, r);
3902
+ if (!t)
3903
+ return;
3904
+ const u = t.inner.trim();
3905
+ return u.length > 0 ? u : void 0;
3906
+ }
3907
+ function Zt(n, r, t) {
3908
+ const u = Et(n, r);
3909
+ if (u !== void 0)
3910
+ return ft(u);
3911
+ const s = n.attributes[r];
3912
+ if (s !== void 0 && s.trim().length > 0)
3913
+ return bt(t, s.trim());
3914
+ }
3915
+ function cr(n, r) {
3916
+ const t = ht(n, "project");
3917
+ if (!t)
3918
+ return null;
3919
+ const u = qt(ft(r)), s = t.attributes.source?.trim() || ar, i = t.attributes.publication?.trim() || or, e = t.attributes.output?.trim() || "output", o = {
3920
+ manifestPath: ft(r),
3921
+ projectRoot: u,
3922
+ ptxVersion: t.attributes["ptx-version"],
3923
+ sourceDir: s,
3924
+ publicationDir: i,
3925
+ targets: []
3926
+ }, l = ht(t.inner, "targets"), d = l ? Ae(l.inner, "target") : [];
3927
+ for (const _ of d)
3928
+ o.targets.push({
3929
+ name: _.attributes.name ?? "",
3930
+ // v2 manifests carry the format as an attribute; legacy v1 manifests
3931
+ // use a `<format>` child element.
3932
+ format: _.attributes.format ?? Et(_, "format") ?? "",
3933
+ source: Zt(_, "source", s) ?? bt(s, _e),
3934
+ publication: Zt(_, "publication", i),
3935
+ outputDir: Zt(_, "output-dir", e),
3936
+ standalone: _.attributes.standalone !== void 0 && _.attributes.standalone !== "no"
3937
+ });
3938
+ if (o.targets.length === 0) {
3939
+ const _ = Et(t, "source");
3940
+ o.targets.push({
3941
+ name: "default",
3942
+ format: Et(t, "format") ?? "",
3943
+ source: _ ? ft(_) : bt(s, _e),
3944
+ publication: Et(t, "publication"),
3945
+ standalone: !1
3946
+ });
3947
+ }
3948
+ return o;
3949
+ }
3950
+ function lr(n) {
3951
+ const r = Object.keys(n).filter((t) => yt(t).toLowerCase() === "project.ptx").sort((t, u) => {
3952
+ const s = t.split("/").length - u.split("/").length;
3953
+ return s !== 0 ? s : t.localeCompare(u);
3954
+ });
3955
+ for (const t of r) {
3956
+ const u = cr(n[t], t);
3957
+ if (u)
3958
+ return u;
3959
+ }
3960
+ return null;
3961
+ }
3962
+ function ur(n) {
3963
+ return n.targets.find((r) => !r.standalone) ?? n.targets[0];
3964
+ }
3965
+ const fr = /* @__PURE__ */ new Set(["md", "markdown"]), dr = /* @__PURE__ */ new Set(["ptx", "xml"]), hr = /* @__PURE__ */ new Set([
3966
+ "readme",
3967
+ "changelog",
3968
+ "contributing",
3969
+ "license"
3970
+ ]), be = [
3971
+ "main",
3972
+ "book",
3973
+ "index",
3974
+ "root",
3975
+ "master",
3976
+ "thesis",
3977
+ "dissertation",
3978
+ "article",
3979
+ "paper"
3980
+ ];
3981
+ function ne(n, r) {
3982
+ return Object.fromEntries(
3983
+ Object.entries(n).filter(([t]) => r.has(vt(t)))
3984
+ );
3985
+ }
3986
+ function Ne(n) {
3987
+ const r = ht(n, "pretext") ?? ht(n, "book") ?? ht(n, "article"), t = r ? r.inner : n;
3988
+ return ht(t, "title")?.inner.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").trim() || void 0;
3989
+ }
3990
+ function pr(n) {
3991
+ const r = /^#\s+(.+)$/m.exec(n);
3992
+ return r ? r[1].trim() : void 0;
3993
+ }
3994
+ function ye(n) {
3995
+ return Pt(n, "title") || void 0;
3996
+ }
3997
+ function mr(n) {
3998
+ return /\\documentclass\b/.test(n) || /\\begin *\{document\}/.test(n);
3999
+ }
4000
+ const gr = /<(pretext|book|article)\b/;
4001
+ function _r(n, r) {
4002
+ const t = ur(n), u = t ? [t, ...n.targets.filter((e) => e !== t)] : n.targets, s = /* @__PURE__ */ new Set(), i = [];
4003
+ for (const e of u) {
4004
+ const o = bt(n.projectRoot, e.source);
4005
+ s.has(o) || !(o in r) || (s.add(o), i.push({
4006
+ path: o,
4007
+ format: "pretext",
4008
+ reason: "manifest-target",
4009
+ title: Ne(r[o]),
4010
+ targetName: e.name,
4011
+ targetFormat: e.format
4012
+ }));
4013
+ }
4014
+ return i;
4015
+ }
4016
+ function br(n) {
4017
+ const r = ne(n, /* @__PURE__ */ new Set(["tex", "ltx"])), t = On(r), u = Object.keys(r).filter((l) => !t.has(l) && mr(r[l])).sort(), s = (l) => {
4018
+ let d = 0;
4019
+ const _ = r[l].match(/\\(input|include) *\{[^{}]+\}/g) ?? [];
4020
+ for (const m of _) {
4021
+ const v = /\{([^{}]+)\}/.exec(m)?.[1];
4022
+ v && Qt(v, l, r) && (d += 1);
4023
+ }
4024
+ return d;
4025
+ }, i = (l) => {
4026
+ const d = be.indexOf(Dt(l).toLowerCase());
4027
+ return d >= 0 ? d : be.length;
4028
+ }, o = [...u].sort((l, d) => {
4029
+ const _ = +!/\\documentclass\b/.test(r[l]) - +!/\\documentclass\b/.test(r[d]);
4030
+ if (_ !== 0) return _;
4031
+ const m = i(l) - i(d);
4032
+ if (m !== 0) return m;
4033
+ const v = s(d) - s(l);
4034
+ return v !== 0 ? v : l.localeCompare(d);
4035
+ }).map((l) => ({
4036
+ path: l,
4037
+ format: "latex",
4038
+ reason: "latex-root",
4039
+ title: ye(r[l])
4040
+ }));
4041
+ return o.length > 0 ? o : Object.keys(r).sort().map((l) => ({
4042
+ path: l,
4043
+ format: "latex",
4044
+ reason: "fallback",
4045
+ title: ye(r[l])
4046
+ }));
4047
+ }
4048
+ function yr(n) {
4049
+ const r = ne(n, fr), t = Object.keys(r).sort(), u = (e) => hr.has(Dt(e).toLowerCase()), s = ["main", "index", "book", "article"], i = (e) => u(e) ? 2 : s.indexOf(Dt(e).toLowerCase()) >= 0 ? 0 : 1;
4050
+ return [...t].sort((e, o) => i(e) - i(o) || e.localeCompare(o)).map((e) => ({
4051
+ path: e,
4052
+ format: "markdown",
4053
+ reason: "markdown-root",
4054
+ title: pr(r[e])
4055
+ }));
4056
+ }
4057
+ function vr(n) {
4058
+ const r = ne(n, dr), t = Pn(r);
4059
+ return Object.keys(r).filter(
4060
+ (s) => !t.has(s) && gr.test(r[s]) && yt(s).toLowerCase() !== "project.ptx" && yt(s).toLowerCase() !== "publication.ptx"
4061
+ ).sort().map((s) => ({
4062
+ path: s,
4063
+ format: "pretext",
4064
+ reason: "pretext-root",
4065
+ title: Ne(r[s])
4066
+ }));
4067
+ }
4068
+ function wr(n, r = {}) {
4069
+ const t = lr(n), u = [
4070
+ ...t ? _r(t, n) : [],
4071
+ ...br(n),
4072
+ ...yr(n),
4073
+ ...vr(n)
4074
+ ], s = [], i = /* @__PURE__ */ new Set();
4075
+ for (const m of u)
4076
+ i.has(m.path) || (i.add(m.path), s.push(m));
4077
+ const e = r.sourceFormat ? s.filter((m) => m.format === r.sourceFormat) : s, o = [];
4078
+ for (const m of s)
4079
+ o.includes(m.format) || o.push(m.format);
4080
+ let l = e[0] ?? null;
4081
+ if (r.mainFile) {
4082
+ const m = r.mainFile;
4083
+ l = e.find((v) => v.path === m) ?? s.find((v) => v.path === m) ?? (m in n ? {
4084
+ path: m,
4085
+ format: r.sourceFormat ?? Gt(n[m]),
4086
+ reason: "fallback"
4087
+ } : l);
4088
+ }
4089
+ if (!l) {
4090
+ const m = Object.keys(n).sort()[0];
4091
+ l = m ? {
4092
+ path: m,
4093
+ format: r.sourceFormat ?? Gt(n[m]),
4094
+ reason: "fallback"
4095
+ } : null;
4096
+ }
4097
+ const d = l, _ = d && (d.format === "latex" || d.format === "markdown") ? e.filter(
4098
+ (m) => m.path !== d.path && m.format === d.format && m.reason !== "manifest-target"
4099
+ ) : [];
4100
+ return { manifest: t, candidates: e, formats: o, primary: l, extraRoots: _ };
4101
+ }
4102
+ const ve = "\\begin{document}", xr = "\\end{document}", kr = /\\documentclass\s*(?:\[[^\]]*\])?\s*\{(book|report|memoir|scrbook|scrreprt|amsbook)\}/;
4103
+ function Ue(n) {
4104
+ return Dt(n).replace(/[-_]+/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (r) => r.toUpperCase()) || "Untitled";
4105
+ }
4106
+ function Vt(n, r) {
4107
+ return {
4108
+ action: "anomaly",
4109
+ severity: "info",
4110
+ kind: "structure",
4111
+ category: "attached_root",
4112
+ macro: n.level,
4113
+ occurrences: 1,
4114
+ message: r
4115
+ };
4116
+ }
4117
+ function Sr(n) {
4118
+ const { preamble: r, body: t } = zt(n);
4119
+ return kr.test(r) || /\\chapter\b/.test(t) ? "chapter" : "section";
4120
+ }
4121
+ function Er(n, r) {
4122
+ const t = n.replace(/^\s*(%[^\n]*\n\s*)*/, "");
4123
+ return r === "chapter" ? /^\\(chapter|part)\b/.test(t) : /^\\(section|chapter|part)\b/.test(t);
4124
+ }
4125
+ function zr(n, r, t) {
4126
+ const u = r.filter((g) => g.include !== !1);
4127
+ if (u.length === 0)
4128
+ return { source: n, attached: [], warnings: [] };
4129
+ const s = n.includes(ve), { preamble: i, body: e } = zt(n), o = Sr(n), l = [], d = [], _ = [], m = [];
4130
+ for (const g of u) {
4131
+ const f = t[g.path];
4132
+ if (f === void 0) {
4133
+ d.push({
4134
+ action: "anomaly",
4135
+ severity: "warning",
4136
+ kind: "structure",
4137
+ category: "attached_root_missing",
4138
+ macro: g.path,
4139
+ occurrences: 1,
4140
+ message: `Cannot attach \`${g.path}\`: it is not among the uploaded files.`
4141
+ });
4142
+ continue;
4143
+ }
4144
+ const b = g.level ?? o, p = g.title || Pt(f, "title") || Ue(g.path), w = {
4145
+ path: g.path,
4146
+ title: p,
4147
+ level: b
4148
+ }, S = zt(f), E = xe(S.preamble);
4149
+ E && _.push(E);
4150
+ const z = S.body.trim();
4151
+ if (!z) {
4152
+ d.push(
4153
+ Vt(w, `\`${g.path}\` is empty; skipped.`)
4154
+ );
4155
+ continue;
4156
+ }
4157
+ m.push(
4158
+ Er(z, b) ? z : `\\${b}{${p}}
4159
+
4160
+ ${z}`
4161
+ ), l.push(w), d.push(
4162
+ Vt(
4163
+ w,
4164
+ `Attached \`${g.path}\` as a ${b}: “${p}”.`
4165
+ )
4166
+ );
4167
+ }
4168
+ if (m.length === 0)
4169
+ return { source: n, attached: l, warnings: d };
4170
+ const v = [e.trim(), ...m].filter(Boolean).join(`
4171
+
4172
+ `);
4173
+ return s ? { source: [
4174
+ [i, ..._].filter(Boolean).join(`
4175
+ `),
4176
+ ve,
4177
+ v,
4178
+ xr
4179
+ ].join(`
4180
+ `), attached: l, warnings: d } : {
4181
+ source: [i, ..._, v].filter(Boolean).join(`
4182
+
4183
+ `),
4184
+ attached: l,
4185
+ warnings: d
4186
+ };
4187
+ }
4188
+ function Cr(n, r, t) {
4189
+ const u = r.filter((o) => o.include !== !1), s = [], i = [], e = [];
4190
+ for (const o of u) {
4191
+ const l = t[o.path];
4192
+ if (l === void 0) {
4193
+ i.push({
4194
+ action: "anomaly",
4195
+ severity: "warning",
4196
+ kind: "structure",
4197
+ category: "attached_root_missing",
4198
+ macro: o.path,
4199
+ occurrences: 1,
4200
+ message: `Cannot attach \`${o.path}\`: it is not among the uploaded files.`
4201
+ });
4202
+ continue;
4203
+ }
4204
+ const d = l.trim();
4205
+ if (!d)
4206
+ continue;
4207
+ const _ = /^#\s+(.+)$/m.exec(d), m = o.title || _?.[1]?.trim() || Ue(o.path), v = {
4208
+ path: o.path,
4209
+ title: m,
4210
+ level: o.level ?? "chapter"
4211
+ };
4212
+ e.push(d.startsWith("# ") ? d : `# ${m}
4213
+
4214
+ ${d}`), s.push(v), i.push(
4215
+ Vt(v, `Attached \`${o.path}\`: “${m}”.`)
4216
+ );
4217
+ }
4218
+ return e.length === 0 ? { source: n, attached: s, warnings: i } : {
4219
+ source: [n.trim(), ...e].filter(Boolean).join(`
4220
+
4221
+ `),
4222
+ attached: s,
4223
+ warnings: i
4224
+ };
4225
+ }
4226
+ const Ar = [
4227
+ "output",
4228
+ ".git",
4229
+ ".github/workflows/.cache",
4230
+ "node_modules",
4231
+ ".ptx",
4232
+ "__pycache__",
4233
+ ".venv",
4234
+ "__MACOSX"
4235
+ ];
4236
+ function Tr(n, r) {
4237
+ const t = n.toLowerCase();
4238
+ return [...Ar, ...r].some(
4239
+ (u) => u.length > 0 && t.startsWith(`${u.toLowerCase()}/`)
4240
+ );
4241
+ }
4242
+ function Ir(n) {
4243
+ const { manifest: r, files: t, assets: u } = n, s = r.projectRoot, i = new Set(n.consumedPaths), e = [
4244
+ ...new Set(
4245
+ r.targets.map((d) => d.outputDir?.split("/")[0]).filter((d) => !!d)
4246
+ )
4247
+ ], o = { files: {}, assets: {}, skipped: [] }, l = (d, _) => {
4248
+ if (s && !d.startsWith(`${s}/`))
4249
+ return;
4250
+ const m = In(s, d);
4251
+ if (!(i.has(d) || d === r.manifestPath)) {
4252
+ if (Tr(m, e)) {
4253
+ o.skipped.push(m);
4254
+ return;
4255
+ }
4256
+ _(m);
4257
+ }
4258
+ };
4259
+ for (const [d, _] of Object.entries(t))
4260
+ l(d, (m) => {
4261
+ o.files[m] = _;
4262
+ });
4263
+ for (const [d, _] of Object.entries(u))
4264
+ l(d, (m) => {
4265
+ o.assets[m] = _;
4266
+ });
4267
+ return o;
4268
+ }
4269
+ function Or(n, r, t) {
4270
+ return `<?xml version="1.0" encoding="UTF-8"?>
4271
+ <project ptx-version="2">
4272
+ <targets>
4273
+ ${n.targets.map((s) => {
4274
+ const i = s.source === r.source, e = i ? t.mainSource : s.source, o = i ? t.publication ?? s.publication : s.publication;
4275
+ return [
4276
+ ` <target name="${s.name}"${s.standalone ? ' standalone="yes"' : ""}>`,
4277
+ s.format ? ` <format>${s.format}</format>` : "",
4278
+ ` <source>${e}</source>`,
4279
+ o ? ` <publication>${o}</publication>` : "",
4280
+ s.outputDir ? ` <output-dir>${s.outputDir}</output-dir>` : "",
4281
+ " </target>"
4282
+ ].filter(Boolean).join(`
4283
+ `);
4284
+ }).join(`
4285
+ `)}
4286
+ </targets>
4287
+ </project>
4288
+ `;
4289
+ }
4290
+ const Rr = /\.(tex|zip|md|markdown|ptx|xml|tar\.gz|tgz)$/i, Fr = [
4291
+ "tex",
4292
+ "md",
4293
+ "markdown",
4294
+ "ptx",
4295
+ "xml",
4296
+ "bib",
4297
+ "sty",
4298
+ "txt",
4299
+ "pdf",
4300
+ "eps",
4301
+ "png",
4302
+ "ps",
4303
+ "bbl"
4304
+ ], Pr = /* @__PURE__ */ new Set([
4305
+ "png",
4306
+ "jpg",
4307
+ "jpeg",
4308
+ "gif",
4309
+ "pdf",
4310
+ "eps",
4311
+ "ps",
4312
+ "bmp",
4313
+ "tiff",
4314
+ "tif",
4315
+ "webp",
4316
+ "ico"
4317
+ ]), Dr = /* @__PURE__ */ new Set([
4318
+ "png",
4319
+ "jpg",
4320
+ "jpeg",
4321
+ "gif",
4322
+ "svg",
4323
+ "bmp",
4324
+ "tiff",
4325
+ "tif",
4326
+ "webp",
4327
+ "ico",
4328
+ "pdf",
4329
+ "eps",
4330
+ "ps"
4331
+ ]);
4332
+ function Me(n) {
4333
+ return Pr.has(n.toLowerCase());
4334
+ }
4335
+ function jr(n) {
4336
+ const r = yt(n), t = vt(r);
4337
+ return Dr.has(t) ? `source/assets/${r}` : null;
4338
+ }
4339
+ function Br(n) {
4340
+ const r = yt(n);
4341
+ return vt(r) === "bib" ? `source/${r}` : null;
4342
+ }
4343
+ function wt(n) {
4344
+ return n.replace(/\r\n?/g, `
4345
+ `).replace(/(\n *){3,}/g, `
4346
+
4347
+ `);
4348
+ }
4349
+ function $r(n) {
4350
+ const r = n.toLowerCase();
4351
+ return r.endsWith(".tar.gz") || r.endsWith(".tgz") ? "tar.gz" : r.endsWith(".zip") ? "zip" : r.endsWith(".tex") ? "tex" : r.endsWith(".md") || r.endsWith(".markdown") ? "markdown" : r.endsWith(".ptx") || r.endsWith(".xml") ? "pretext" : null;
4352
+ }
4353
+ function Lr(n) {
4354
+ const r = (t, u) => new TextDecoder().decode(n.slice(t, u)).split("\0")[0];
4355
+ return {
4356
+ name: r(0, 100),
4357
+ size: parseInt(r(124, 136), 8) || 0,
4358
+ type: r(156, 157)
4359
+ };
4360
+ }
4361
+ async function Nr(n) {
4362
+ if (typeof DecompressionStream > "u")
4363
+ throw new Error("This runtime does not support gzip decompression.");
4364
+ const u = new ReadableStream({
4365
+ start(l) {
4366
+ l.enqueue(new Uint8Array(n)), l.close();
4367
+ }
4368
+ }).pipeThrough(
4369
+ new DecompressionStream("gzip")
4370
+ ).getReader(), s = [];
4371
+ for (; ; ) {
4372
+ const { done: l, value: d } = await u.read();
4373
+ if (l)
4374
+ break;
4375
+ s.push(d);
4376
+ }
4377
+ const i = s.reduce((l, d) => l + d.length, 0), e = new Uint8Array(i);
4378
+ let o = 0;
4379
+ for (const l of s)
4380
+ e.set(l, o), o += l.length;
4381
+ return e.buffer;
4382
+ }
4383
+ function Ur(n) {
4384
+ const r = {}, t = {};
4385
+ let u = 0;
4386
+ for (; u < n.length && !(u + 512 > n.length); ) {
4387
+ const s = n.slice(u, u + 512), i = Lr(s);
4388
+ if (!i.name)
4389
+ break;
4390
+ u += 512;
4391
+ const e = i.size, o = Math.ceil(e / 512) * 512;
4392
+ if (i.type === "0" || i.type === "") {
4393
+ const l = n.slice(u, u + e), d = ft(i.name);
4394
+ if (Me(vt(d)))
4395
+ t[d] = l;
4396
+ else {
4397
+ const _ = new TextDecoder().decode(l);
4398
+ r[d] = wt(_);
4399
+ }
4400
+ }
4401
+ u += o;
4402
+ }
4403
+ return { files: r, assets: t };
4404
+ }
4405
+ async function Mr(n) {
4406
+ const r = $r(n.name);
4407
+ if (!r)
4408
+ throw new Error(
4409
+ "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."
4410
+ );
4411
+ if (r === "tex" || r === "markdown" || r === "pretext") {
4412
+ const s = await n.text();
4413
+ return {
4414
+ files: { [ft(n.name)]: wt(s) },
4415
+ assets: {}
4416
+ };
4417
+ }
4418
+ if (r === "zip") {
4419
+ const i = await new Tn().loadAsync(n), e = {}, o = {};
4420
+ for (const [l, d] of Object.entries(i.files)) {
4421
+ if (d.dir)
4422
+ continue;
4423
+ const _ = ft(l);
4424
+ if (Me(vt(_)))
4425
+ o[_] = await d.async("uint8array");
4426
+ else {
4427
+ const m = await d.async("string");
4428
+ e[_] = wt(m);
4429
+ }
4430
+ }
4431
+ return { files: e, assets: o };
4432
+ }
4433
+ const t = await n.arrayBuffer(), u = await Nr(t);
4434
+ return Ur(new Uint8Array(u));
4435
+ }
4436
+ function Wr(n) {
4437
+ const r = { other: 0 };
4438
+ for (const t of Fr)
4439
+ r[t] = 0;
4440
+ for (const t of Object.keys(n)) {
4441
+ const u = vt(t);
4442
+ u in r ? r[u] += 1 : r.other += 1;
4443
+ }
4444
+ return r;
4445
+ }
4446
+ function Zr(n, r) {
4447
+ const t = Wr(r);
4448
+ n.push({ type: "success", message: "File types:" });
4449
+ for (const u of Object.keys(t).sort())
4450
+ t[u] && n.push({ type: "success", message: `${u}: ${t[u]}` });
4451
+ }
4452
+ function Gr(n) {
4453
+ return n === "latex" ? "tex" : n === "markdown" ? "markdown" : "pretext";
4454
+ }
4455
+ function Xr(n, r) {
4456
+ return n.targets.find(
4457
+ (t) => t.source === r
4458
+ );
4459
+ }
4460
+ function Hr(n, r) {
4461
+ return n === !1 ? [] : Array.isArray(n) ? n.filter((t) => t.include !== !1) : r.extraRoots.map((t) => ({ path: t.path }));
4462
+ }
4463
+ function Kr(n) {
4464
+ if (n.reason === "manifest-target") {
4465
+ const r = n.targetName ? ` (target \`${n.targetName}\`)` : "";
4466
+ return `Main source file: ${n.path}${r}`;
4467
+ }
4468
+ return `Main source file: ${n.path}`;
4469
+ }
4470
+ function Yr(n, r = {}) {
4471
+ const t = [];
4472
+ try {
4473
+ const u = Object.fromEntries(
4474
+ Object.entries(n).map(([c, I]) => [
4475
+ ft(c),
4476
+ wt(I)
4477
+ ])
4478
+ ), s = Object.keys(u).length;
4479
+ t.push({
4480
+ type: "success",
4481
+ message: `Found ${s} file${s === 1 ? "" : "s"}.`
4482
+ }), Zr(t, u);
4483
+ const i = wr(u, {
4484
+ sourceFormat: r.sourceFormat,
4485
+ mainFile: r.mainFile ? ft(r.mainFile) : void 0
4486
+ }), e = i.primary;
4487
+ if (!e)
4488
+ throw new Error("No files were found in the uploaded source.");
4489
+ const o = e.path, l = Gr(e.format);
4490
+ let d = u[o] ?? "";
4491
+ const _ = /* @__PURE__ */ new Set([o]);
4492
+ if (i.manifest) {
4493
+ const c = i.manifest.targets.length;
4494
+ t.push({
4495
+ type: "success",
4496
+ message: `Found ${i.manifest.manifestPath} with ${c} target${c === 1 ? "" : "s"}: ${i.manifest.targets.map((I) => I.name).join(", ")}.`
4497
+ });
4498
+ }
4499
+ const m = Hr(r.attachRoots, i);
4500
+ let v = [];
4501
+ const h = [];
4502
+ if (e.format === "latex") {
4503
+ const c = Object.fromEntries(
4504
+ Object.entries(u).filter(
4505
+ ([Y]) => vt(Y) === "tex"
4506
+ )
4507
+ ), I = fe(d, o, c);
4508
+ if (d = wt(I.expandedText), I.consumedPaths.forEach((Y) => _.add(Y)), I.expandedCount > 0 && t.push({
4509
+ type: "success",
4510
+ message: `Expanded ${I.expandedCount} input/include reference${I.expandedCount === 1 ? "" : "s"}.`
4511
+ }), I.missingInputs.length > 0 && t.push({
4512
+ type: "error",
4513
+ message: `Missing input/include files: ${I.missingInputs.join(", ")}.`
4514
+ }), m.length > 0) {
4515
+ const Y = {};
4516
+ for (const tt of m) {
4517
+ const M = u[tt.path];
4518
+ if (M === void 0)
4519
+ continue;
4520
+ const Q = fe(
4521
+ M,
4522
+ tt.path,
4523
+ c
4524
+ );
4525
+ Y[tt.path] = Q.expandedText, Q.consumedPaths.forEach(
4526
+ (O) => _.add(O)
4527
+ ), _.add(tt.path);
4528
+ }
4529
+ const N = zr(d, m, Y);
4530
+ d = wt(N.source), v = N.attached, h.push(...N.warnings);
4531
+ }
4532
+ } else if (e.format === "markdown") {
4533
+ if (m.length > 0) {
4534
+ const c = Cr(
4535
+ d,
4536
+ m,
4537
+ u
4538
+ );
4539
+ d = wt(c.source), v = c.attached, h.push(...c.warnings), v.forEach((I) => _.add(I.path));
4540
+ }
4541
+ } else {
4542
+ const c = Object.fromEntries(
4543
+ Object.entries(u).filter(([Y]) => {
4544
+ const N = vt(Y);
4545
+ return N === "ptx" || N === "xml";
4546
+ })
4547
+ ), I = Fn(d, o, c);
4548
+ d = I.expandedText, I.consumedPaths.forEach((Y) => _.add(Y)), I.expandedCount > 0 && t.push({
4549
+ type: "success",
4550
+ message: `Expanded ${I.expandedCount} xi:include reference${I.expandedCount === 1 ? "" : "s"}.`
4551
+ }), I.missingIncludes.length > 0 && t.push({
4552
+ type: "error",
4553
+ message: `Missing xi:include targets: ${I.missingIncludes.join(", ")}.`
4554
+ });
4555
+ }
4556
+ t.push({ type: "success", message: Kr(e) });
4557
+ for (const c of v)
4558
+ t.push({
4559
+ type: "success",
4560
+ message: `Attached ${c.path} as a ${c.level}: ${c.title}`
4561
+ });
4562
+ const g = En(d, e.format);
4563
+ if ("pretextError" in g)
4564
+ return {
4565
+ pretextError: g.pretextError,
4566
+ statusMessages: t,
4567
+ warnings: [...g.warnings, ...h]
4568
+ };
4569
+ const {
4570
+ buildLayout: f = !0,
4571
+ assets: b = {},
4572
+ ...p
4573
+ } = r, w = i.manifest, S = w && e.reason === "manifest-target" ? Xr(
4574
+ w,
4575
+ e.path.slice(
4576
+ w.projectRoot ? w.projectRoot.length + 1 : 0
4577
+ )
4578
+ ) : void 0, E = f && w !== null && S !== void 0 && (r.preserveProjectLayout ?? !0), z = {
4579
+ mainSourcePath: p.mainSourcePath ?? (E && S ? S.source : "source/main.ptx"),
4580
+ publicationPath: p.publicationPath ?? (E && S?.publication ? S.publication : "publication/publication.ptx"),
4581
+ projectFilePath: p.projectFilePath ?? "project.ptx",
4582
+ preserved: E
4583
+ }, P = {}, D = {}, $ = {};
4584
+ if (E && w && S) {
4585
+ const c = Ir({
4586
+ manifest: w,
4587
+ target: S,
4588
+ files: u,
4589
+ assets: b,
4590
+ consumedPaths: _
4591
+ });
4592
+ Object.assign($, c.files), Object.assign(P, c.assets);
4593
+ for (const [I, Y] of Object.entries(b))
4594
+ D[I] = Y;
4595
+ t.push({
4596
+ type: "success",
4597
+ message: `Carried over ${Object.keys(c.files).length} project file${Object.keys(c.files).length === 1 ? "" : "s"} and ${Object.keys(c.assets).length} asset${Object.keys(c.assets).length === 1 ? "" : "s"} unchanged.`
4598
+ }), c.skipped.length > 0 && t.push({
4599
+ type: "success",
4600
+ message: `Skipped build output: ${c.skipped.length} file${c.skipped.length === 1 ? "" : "s"}.`
4601
+ });
4602
+ } else
4603
+ for (const [c, I] of Object.entries(b)) {
4604
+ const Y = jr(c);
4605
+ Y && (P[Y] = I, D[c] = I);
4606
+ }
4607
+ const F = Hn(g.pretextSource, {
4608
+ documentKind: p.documentKind,
4609
+ splitLevel: f ? p.splitLevel : 0,
4610
+ splitChapters: f ? p.splitChapters : !1,
4611
+ splitSections: f ? p.splitSections : !1,
4612
+ assets: D
4613
+ });
4614
+ f ? (Object.assign(
4615
+ $,
4616
+ sr(F.project, {
4617
+ mainSourcePath: z.mainSourcePath,
4618
+ publicationPath: z.publicationPath,
4619
+ projectFilePath: z.projectFilePath,
4620
+ // A preserved project brings its own publication file; only the
4621
+ // manifest is regenerated, from the original targets.
4622
+ includeScaffold: !E
4623
+ }).files
4624
+ ), E && w && S && ($[z.projectFilePath] = Or(w, S, {
4625
+ mainSource: z.mainSourcePath,
4626
+ publication: z.publicationPath
4627
+ }), z.publicationPath in $ || ($[z.publicationPath] = ze()))) : $["source/main.ptx"] = g.pretextSource;
4628
+ for (const [c, I] of Object.entries(u)) {
4629
+ const Y = Br(c);
4630
+ Y && !(Y in $) && ($[Y] = I);
4631
+ }
4632
+ const W = F.project.documentKind, J = [
4633
+ ...g.warnings,
4634
+ ...h,
4635
+ ...F.warnings
4636
+ ];
4637
+ let k, j;
4638
+ return g.cleanedNativeSource !== void 0 && g.cleanedNativeSource.length > 0 && (g.sourceFormat === "latex" || g.sourceFormat === "markdown") && (k = {
4639
+ [g.sourceFormat === "latex" ? "source/main.tex" : "source/main.md"]: g.cleanedNativeSource
4640
+ }, j = Kn(
4641
+ g.cleanedNativeSource,
4642
+ g.sourceFormat,
4643
+ {
4644
+ documentKind: W,
4645
+ splitChapters: f ? p.splitChapters : !1,
4646
+ splitSections: f ? p.splitSections : !1,
4647
+ title: F.project.title,
4648
+ docinfo: F.project.docinfo,
4649
+ assets: D
4650
+ }
4651
+ ).project), Object.keys(b).length > 0 && t.push({
4652
+ type: "success",
4653
+ message: `Routed ${Object.keys(P).length} binary asset${Object.keys(P).length === 1 ? "" : "s"}.`
4654
+ }), {
4655
+ ...g,
4656
+ warnings: J,
4657
+ sourcePath: o,
4658
+ sourceName: yt(o),
4659
+ sourceType: l,
4660
+ analysis: i,
4661
+ attachedRoots: v,
4662
+ projectLayout: z,
4663
+ project: F.project,
4664
+ nativeProject: j,
4665
+ files: u,
4666
+ assets: b,
4667
+ outputFiles: $,
4668
+ outputAssets: P,
4669
+ nativeOutputFiles: k,
4670
+ documentKind: W,
4671
+ statusMessages: t
4672
+ };
4673
+ } catch (u) {
4674
+ const s = u instanceof Error ? u.message : String(u);
4675
+ return t.push({ type: "error", message: s }), {
4676
+ pretextError: s,
4677
+ statusMessages: t,
4678
+ warnings: []
4679
+ };
4680
+ }
4681
+ }
4682
+ async function ti(n, r = {}) {
4683
+ const t = [], u = ft(n.name);
4684
+ if (!Rr.test(u.toLowerCase()))
4685
+ return {
4686
+ pretextError: "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz.",
4687
+ statusMessages: [
4688
+ {
4689
+ type: "error",
4690
+ message: "File format not supported: please upload .tex, .md, .ptx, .xml, .zip, or .tar.gz."
4691
+ }
4692
+ ],
4693
+ warnings: []
4694
+ };
4695
+ t.push({
4696
+ type: "loading",
4697
+ message: `Processing ${u}...`
4698
+ });
4699
+ try {
4700
+ const { files: s, assets: i } = await Mr(n), e = Yr(s, { ...r, assets: i });
4701
+ return {
4702
+ ...e,
4703
+ statusMessages: [...t, ...e.statusMessages]
4704
+ };
4705
+ } catch (s) {
4706
+ const i = s instanceof Error ? s.message : String(s);
4707
+ return {
4708
+ pretextError: i,
4709
+ statusMessages: [...t, { type: "error", message: i }],
4710
+ warnings: []
4711
+ };
4712
+ }
4713
+ }
4714
+ function ei(n, r) {
4715
+ return r === "native" ? n.nativeProject ?? n.project : n.project;
4716
+ }
4717
+ function ni(n, r) {
4718
+ return r === "converted" ? n.outputFiles : n.nativeOutputFiles ?? n.files;
4719
+ }
4720
+ function ri(n, r) {
4721
+ return r === "converted" ? n.outputAssets : n.assets;
4722
+ }
4723
+ function ii(n) {
4724
+ const r = n.action === "replace" || n.action === "rewrite" ? `replaced with \`${n.replacement}\`` : n.message ?? n.action, t = n.occurrences > 1 ? ` (x${n.occurrences})` : "";
4725
+ return `[${n.severity}] ${n.macro}: ${r}${t}`;
4726
+ }
4727
+ export {
4728
+ Fn as A,
4729
+ Mr as B,
4730
+ Oe as C,
4731
+ ni as D,
4732
+ lr as E,
4733
+ ii as F,
4734
+ Sn as G,
4735
+ ti as H,
4736
+ Yr as I,
4737
+ Mn as J,
4738
+ Jt as K,
4739
+ Ye as L,
4740
+ Ve as M,
4741
+ cr as N,
4742
+ ei as O,
4743
+ Nn as P,
4744
+ Or as Q,
4745
+ Xn as R,
4746
+ te as S,
4747
+ sr as T,
4748
+ ze as a,
4749
+ Ae as b,
4750
+ Ie as c,
4751
+ Bn as d,
4752
+ he as e,
4753
+ Rt as f,
4754
+ Qr as g,
4755
+ wr as h,
4756
+ ri as i,
4757
+ zr as j,
4758
+ Cr as k,
4759
+ Hn as l,
4760
+ Kn as m,
4761
+ Ir as n,
4762
+ mn as o,
4763
+ Ct as p,
4764
+ xn as q,
4765
+ Dn as r,
4766
+ Ln as s,
4767
+ kn as t,
4768
+ En as u,
4769
+ Sr as v,
4770
+ pe as w,
4771
+ ur as x,
4772
+ Gt as y,
4773
+ Wt as z
4774
+ };