@pretextbook/pretext-html 0.17.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -15
- package/assets/preview-html.xsl +25 -14
- package/assets/preview-revealjs.xsl +7 -2
- package/assets/upstream.json +2 -2
- package/assets/xsl/AGENTS.md +34 -0
- package/assets/xsl/entities.ent +5 -3
- package/assets/xsl/extract-biblio-csl.xsl +55 -48
- package/assets/xsl/pretext-common.xsl +228 -164
- package/assets/xsl/pretext-epub.xsl +10 -0
- package/assets/xsl/pretext-fo.xsl +183 -62
- package/assets/xsl/pretext-html.xsl +92 -20
- package/assets/xsl/pretext-jupyter.xsl +3 -0
- package/assets/xsl/pretext-latex-common.xsl +20 -1
- package/assets/xsl/pretext-numbers.xsl +31 -24
- package/assets/xsl/pretext-revealjs.xsl +3 -2
- package/assets/xsl/pretext-runestone.xsl +162 -9
- package/assets/xsl/publisher-variables.xsl +10 -1
- package/assets/xsl-bundle.json +1 -1
- package/dist/assets.d.ts +9 -5
- package/dist/banner.d.ts +2 -2
- package/dist/{cli-C0JwLhuv.js → cli-CddPgMt-.js} +552 -514
- package/dist/cli.d.ts +12 -1
- package/dist/cli.js +8 -3
- package/dist/html-static.d.ts +2 -2
- package/dist/index.browser.d.ts +1 -1
- package/dist/index.browser.js +767 -751
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -41
- package/dist/publication.d.ts +54 -21
- package/dist/renderer.d.ts +18 -11
- package/dist/target.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.browser.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { fromXml as
|
|
1
|
+
import { fromXml as ne } from "xast-util-from-xml";
|
|
2
2
|
import { toXml as te } from "xast-util-to-xml";
|
|
3
|
-
const
|
|
4
|
-
function
|
|
3
|
+
const Ae = "/";
|
|
4
|
+
function Ge(e) {
|
|
5
5
|
if (!e)
|
|
6
6
|
return ".";
|
|
7
7
|
const t = e.startsWith("/"), n = e.length > 1 && e.endsWith("/"), r = [];
|
|
@@ -17,7 +17,7 @@ function ze(e) {
|
|
|
17
17
|
let i = r.join("/");
|
|
18
18
|
return t && (i = `/${i}`), i ? (n && !i.endsWith("/") && (i += "/"), i) : t ? "/" : ".";
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function S(...e) {
|
|
21
21
|
let t = "";
|
|
22
22
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
23
23
|
const i = e[r];
|
|
@@ -25,14 +25,14 @@ function E(...e) {
|
|
|
25
25
|
break;
|
|
26
26
|
}
|
|
27
27
|
t.startsWith("/") || (t = `/${t}`);
|
|
28
|
-
const n =
|
|
28
|
+
const n = Ge(t);
|
|
29
29
|
return n.length > 1 && n.endsWith("/") ? n.slice(0, -1) : n;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function It(...e) {
|
|
32
32
|
const t = e.filter(Boolean).join("/");
|
|
33
|
-
return t ?
|
|
33
|
+
return t ? Ge(t) : ".";
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function K(e) {
|
|
36
36
|
const t = e.replace(/\/+$/, "");
|
|
37
37
|
if (!t)
|
|
38
38
|
return e.startsWith("/") ? "/" : ".";
|
|
@@ -40,27 +40,27 @@ function Y(e) {
|
|
|
40
40
|
return n < 0 ? "." : n === 0 ? "/" : t.slice(0, n);
|
|
41
41
|
}
|
|
42
42
|
function ye(e, t) {
|
|
43
|
-
const n =
|
|
43
|
+
const n = S(e).split("/").filter(Boolean), r = S(t).split("/").filter(Boolean);
|
|
44
44
|
let i = 0;
|
|
45
45
|
for (; i < n.length && i < r.length && n[i] === r[i]; )
|
|
46
46
|
i += 1;
|
|
47
47
|
return [...new Array(n.length - i).fill(".."), ...r.slice(i)].join("/");
|
|
48
48
|
}
|
|
49
|
-
const
|
|
50
|
-
function
|
|
49
|
+
const At = "ptxPreviewBannerDismissed", Lt = "About live preview";
|
|
50
|
+
function Oe(e) {
|
|
51
51
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function _t(e) {
|
|
54
54
|
return [
|
|
55
55
|
'<div id="ptx-preview-banner" class="ptx-preview-banner" role="note">',
|
|
56
|
-
` <span class="ptx-preview-banner-text">${
|
|
56
|
+
` <span class="ptx-preview-banner-text">${Oe(e)}</span>`,
|
|
57
57
|
' <button type="button" class="ptx-preview-banner-dismiss" aria-label="Dismiss">×</button>',
|
|
58
58
|
"</div>",
|
|
59
|
-
`<button type="button" id="ptx-preview-banner-restore" class="ptx-preview-banner-restore" hidden>${
|
|
59
|
+
`<button type="button" id="ptx-preview-banner-restore" class="ptx-preview-banner-restore" hidden>${Oe(Lt)}</button>`
|
|
60
60
|
].join(`
|
|
61
61
|
`);
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function $t() {
|
|
64
64
|
return [
|
|
65
65
|
"<style>",
|
|
66
66
|
".ptx-preview-banner {",
|
|
@@ -129,11 +129,11 @@ function Lt() {
|
|
|
129
129
|
].join(`
|
|
130
130
|
`);
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function kt() {
|
|
133
133
|
return [
|
|
134
134
|
"<script>",
|
|
135
135
|
"(function () {",
|
|
136
|
-
" var KEY = " + JSON.stringify(
|
|
136
|
+
" var KEY = " + JSON.stringify(At) + ";",
|
|
137
137
|
' var banner = document.getElementById("ptx-preview-banner");',
|
|
138
138
|
' var restore = document.getElementById("ptx-preview-banner-restore");',
|
|
139
139
|
" if (!banner || !restore) { return; }",
|
|
@@ -170,39 +170,39 @@ function $t() {
|
|
|
170
170
|
].join(`
|
|
171
171
|
`);
|
|
172
172
|
}
|
|
173
|
-
const
|
|
174
|
-
function
|
|
175
|
-
const n =
|
|
173
|
+
const Nt = "<!--ptx-preview-banner-->", Rt = "<!--/ptx-preview-banner-->", Pt = /\n?<!--ptx-preview-banner-->[\s\S]*?<!--\/ptx-preview-banner-->/;
|
|
174
|
+
function Ct(e, t) {
|
|
175
|
+
const n = Pt.exec(e), r = n ? e.slice(0, n.index) + e.slice(n.index + n[0].length) : e;
|
|
176
176
|
if (!/<body[^>]*>/i.test(r))
|
|
177
177
|
return r;
|
|
178
178
|
const i = `
|
|
179
|
-
${
|
|
180
|
-
${Lt()}
|
|
181
|
-
${At(t.message)}
|
|
179
|
+
${Nt}
|
|
182
180
|
${$t()}
|
|
183
|
-
${
|
|
181
|
+
${_t(t.message)}
|
|
182
|
+
${kt()}
|
|
183
|
+
${Rt}`;
|
|
184
184
|
return r.replace(/<body([^>]*)>/i, `<body$1>${i}`);
|
|
185
185
|
}
|
|
186
|
-
const
|
|
186
|
+
const Dt = "https://cdn.jsdelivr.net/npm/@pretextbook/pretext-html@0.18.1/assets";
|
|
187
187
|
let Je;
|
|
188
|
-
function
|
|
188
|
+
function $r(e) {
|
|
189
189
|
Je = e.replace(/\/+$/, "");
|
|
190
190
|
}
|
|
191
191
|
function fe() {
|
|
192
|
-
return Je ??
|
|
192
|
+
return Je ?? Dt;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function Ke(e, t) {
|
|
195
195
|
return `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
|
|
196
196
|
}
|
|
197
|
-
const
|
|
198
|
-
function
|
|
197
|
+
const Me = /* @__PURE__ */ new Map();
|
|
198
|
+
function Ot(e) {
|
|
199
199
|
return `${e.replace(/\/+$/, "")}-bundle.json`;
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
let t =
|
|
201
|
+
function Mt(e) {
|
|
202
|
+
let t = Me.get(e);
|
|
203
203
|
return t || (t = (async () => {
|
|
204
204
|
try {
|
|
205
|
-
const n = await fetch(
|
|
205
|
+
const n = await fetch(Ot(e));
|
|
206
206
|
if (!n.ok)
|
|
207
207
|
return /* @__PURE__ */ new Map();
|
|
208
208
|
const r = await n.json();
|
|
@@ -210,14 +210,14 @@ function Dt(e) {
|
|
|
210
210
|
} catch {
|
|
211
211
|
return /* @__PURE__ */ new Map();
|
|
212
212
|
}
|
|
213
|
-
})(),
|
|
213
|
+
})(), Me.set(e, t)), t;
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return e ===
|
|
215
|
+
function Bt(e) {
|
|
216
|
+
return e === Ke(fe(), "xsl");
|
|
217
217
|
}
|
|
218
|
-
async function
|
|
219
|
-
if (
|
|
220
|
-
const o = (await
|
|
218
|
+
async function Ye(e, t) {
|
|
219
|
+
if (Bt(e)) {
|
|
220
|
+
const o = (await Mt(e)).get(t.replace(/^\/+/, ""));
|
|
221
221
|
if (o !== void 0)
|
|
222
222
|
return new TextEncoder().encode(o);
|
|
223
223
|
}
|
|
@@ -241,7 +241,7 @@ async function Ke(e, t) {
|
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
async function
|
|
244
|
+
async function jt(e) {
|
|
245
245
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(e))
|
|
246
246
|
try {
|
|
247
247
|
const t = await fetch(e);
|
|
@@ -250,42 +250,42 @@ async function Ot(e) {
|
|
|
250
250
|
return;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
const
|
|
254
|
-
"prefix-runtime.
|
|
253
|
+
const qe = "2.56.1", Ut = "8.3.6", Ft = [
|
|
254
|
+
"prefix-runtime.4beca1fdeed766a2.bundle.js",
|
|
255
255
|
"prefix-926.5c7038c8ef173faf.bundle.js",
|
|
256
|
-
"prefix-runestone.
|
|
257
|
-
],
|
|
256
|
+
"prefix-runestone.ebd33f6a21eed414.bundle.js"
|
|
257
|
+
], Wt = [
|
|
258
258
|
"prefix-926.229729d09512acc9.css",
|
|
259
|
-
"prefix-runestone.
|
|
260
|
-
],
|
|
261
|
-
function
|
|
259
|
+
"prefix-runestone.9963089870a016c8.css"
|
|
260
|
+
], Ht = "born-hidden-knowl", Vt = /<details\b([^>]*)>(\s*)(?:<summary\b([^>]*)>)?/g;
|
|
261
|
+
function Xt(e) {
|
|
262
262
|
const t = /\bclass="([^"]*)"/.exec(e);
|
|
263
263
|
return t ? t[1].trim().split(/\s+/) : [];
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function zt(e) {
|
|
266
266
|
return /(^|\s)open(\s|=|$)/.test(e);
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
return
|
|
268
|
+
function Be(e) {
|
|
269
|
+
return zt(e) ? e : ` open${e}`;
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function Gt(e) {
|
|
272
272
|
return e.replace(
|
|
273
|
-
|
|
273
|
+
Vt,
|
|
274
274
|
(t, n, r, i) => {
|
|
275
|
-
if (!
|
|
275
|
+
if (!Xt(n).includes(Ht))
|
|
276
276
|
return t;
|
|
277
|
-
const o = `<details${
|
|
278
|
-
return i === void 0 ? `${o}${r}` : `${o}${r}<summary${
|
|
277
|
+
const o = `<details${Be(n)}>`;
|
|
278
|
+
return i === void 0 ? `${o}${r}` : `${o}${r}<summary${Be(i)}>`;
|
|
279
279
|
}
|
|
280
280
|
);
|
|
281
281
|
}
|
|
282
|
-
const
|
|
283
|
-
let
|
|
284
|
-
function
|
|
285
|
-
|
|
282
|
+
const ke = /* @__PURE__ */ new Map(), Ze = /* @__PURE__ */ new Map();
|
|
283
|
+
let Le, Jt = 0, Qe = Ye;
|
|
284
|
+
function kr(e) {
|
|
285
|
+
Qe = e;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
const n = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, r =
|
|
287
|
+
function Kt(e, t) {
|
|
288
|
+
const n = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, r = Ze.get(n);
|
|
289
289
|
if (r !== void 0)
|
|
290
290
|
return Promise.resolve(new Response(r, { status: 200 }));
|
|
291
291
|
let i;
|
|
@@ -294,62 +294,62 @@ function Jt(e, t) {
|
|
|
294
294
|
} catch {
|
|
295
295
|
i = "";
|
|
296
296
|
}
|
|
297
|
-
const o =
|
|
298
|
-
return o !== void 0 ?
|
|
297
|
+
const o = ke.get(i);
|
|
298
|
+
return o !== void 0 ? qt(o, n) : Le(e, t);
|
|
299
299
|
}
|
|
300
|
-
const
|
|
301
|
-
async function
|
|
302
|
-
const n = decodeURIComponent(new URL(t).pathname), r = await
|
|
300
|
+
const Yt = '<?xml version="1.0"?><pretext-preview-missing-file/>';
|
|
301
|
+
async function qt(e, t) {
|
|
302
|
+
const n = decodeURIComponent(new URL(t).pathname), r = await Qe(e, n);
|
|
303
303
|
if (r === void 0)
|
|
304
|
-
return new Response(
|
|
304
|
+
return new Response(Yt, { status: 200 });
|
|
305
305
|
const i = typeof r == "string" ? r : new Uint8Array(r);
|
|
306
306
|
return new Response(i, { status: 200 });
|
|
307
307
|
}
|
|
308
|
-
function
|
|
309
|
-
|
|
308
|
+
function et() {
|
|
309
|
+
Le || (Le = globalThis.fetch, globalThis.fetch = Kt);
|
|
310
310
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
const t = `mnt${++
|
|
314
|
-
return
|
|
311
|
+
function tt(e) {
|
|
312
|
+
et();
|
|
313
|
+
const t = `mnt${++Jt}.ptx.invalid`;
|
|
314
|
+
return ke.set(t, e), `http://${t}`;
|
|
315
315
|
}
|
|
316
|
-
function
|
|
317
|
-
|
|
316
|
+
function Zt(e) {
|
|
317
|
+
ke.delete(new URL(e).host);
|
|
318
318
|
}
|
|
319
|
-
function
|
|
320
|
-
|
|
319
|
+
function Qt(e, t) {
|
|
320
|
+
et(), Ze.set(e, t);
|
|
321
321
|
}
|
|
322
|
-
const
|
|
323
|
-
function
|
|
322
|
+
const en = /<a\b[^>]*\bdata-printout="[^"]*"[^>]*>/gi;
|
|
323
|
+
function le(e, t) {
|
|
324
324
|
const n = new RegExp(`\\b${t}="([^"]*)"`, "i").exec(e);
|
|
325
|
-
return n ?
|
|
325
|
+
return n ? tn(n[1]) : void 0;
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function tn(e) {
|
|
328
328
|
return e.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'|'/g, "'").replace(/'/gi, "'").replace(/&/g, "&");
|
|
329
329
|
}
|
|
330
|
-
function
|
|
330
|
+
function nn(e, t, n) {
|
|
331
331
|
const r = [e, t].filter(Boolean).join(" ");
|
|
332
332
|
return r && n ? `${r}: ${n}` : r || n;
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function nt(e) {
|
|
335
335
|
const t = [], n = /* @__PURE__ */ new Set();
|
|
336
|
-
for (const [r] of e.matchAll(
|
|
337
|
-
const i =
|
|
336
|
+
for (const [r] of e.matchAll(en)) {
|
|
337
|
+
const i = le(r, "data-printout");
|
|
338
338
|
if (!i || n.has(i))
|
|
339
339
|
continue;
|
|
340
340
|
n.add(i);
|
|
341
|
-
const o =
|
|
341
|
+
const o = le(r, "data-printout-type") ?? "", a = le(r, "data-printout-number") ?? "", l = le(r, "data-printout-title") ?? "";
|
|
342
342
|
t.push({
|
|
343
343
|
id: i,
|
|
344
344
|
type: o,
|
|
345
345
|
number: a,
|
|
346
346
|
title: l,
|
|
347
|
-
label:
|
|
347
|
+
label: nn(o, a, l)
|
|
348
348
|
});
|
|
349
349
|
}
|
|
350
350
|
return t;
|
|
351
351
|
}
|
|
352
|
-
const
|
|
352
|
+
const rn = /* @__PURE__ */ new Set([
|
|
353
353
|
"worksheet",
|
|
354
354
|
"handout",
|
|
355
355
|
"project",
|
|
@@ -357,17 +357,17 @@ const tn = /* @__PURE__ */ new Set([
|
|
|
357
357
|
"exploration",
|
|
358
358
|
"investigation"
|
|
359
359
|
]);
|
|
360
|
-
function
|
|
361
|
-
if (!(!t || !
|
|
360
|
+
function on(e, t) {
|
|
361
|
+
if (!(!t || !rn.has(t)))
|
|
362
362
|
return e[0]?.id;
|
|
363
363
|
}
|
|
364
|
-
const
|
|
365
|
-
function
|
|
364
|
+
const sn = "__ptxPrintPreview";
|
|
365
|
+
function an(e) {
|
|
366
366
|
const t = JSON.stringify(e ?? null);
|
|
367
367
|
return [
|
|
368
368
|
"<script>",
|
|
369
369
|
"(function () {",
|
|
370
|
-
" var KEY = " + JSON.stringify(
|
|
370
|
+
" var KEY = " + JSON.stringify(sn) + ";",
|
|
371
371
|
" window[KEY] = " + t + ";",
|
|
372
372
|
// Pin the page to light mode for the print layout; see printPreviewCss.
|
|
373
373
|
// `data-darkmode="disabled"` is upstream's own switch — pretext-core.js
|
|
@@ -402,7 +402,7 @@ function on(e) {
|
|
|
402
402
|
].join(`
|
|
403
403
|
`);
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function cn() {
|
|
406
406
|
return [
|
|
407
407
|
"<style>",
|
|
408
408
|
":root {",
|
|
@@ -422,19 +422,19 @@ function sn() {
|
|
|
422
422
|
].join(`
|
|
423
423
|
`);
|
|
424
424
|
}
|
|
425
|
-
const
|
|
426
|
-
function
|
|
427
|
-
const n =
|
|
425
|
+
const ln = "<!--ptx-print-preview-->", un = "<!--/ptx-print-preview-->", fn = /\n?<!--ptx-print-preview-->[\s\S]*?<!--\/ptx-print-preview-->/;
|
|
426
|
+
function dn(e, t) {
|
|
427
|
+
const n = fn.exec(e), r = n ? e.slice(0, n.index) + e.slice(n.index + n[0].length) : e, i = /<head[^>]*>/i.exec(r);
|
|
428
428
|
if (!i)
|
|
429
429
|
return r;
|
|
430
|
-
const o = t &&
|
|
431
|
-
${
|
|
432
|
-
${
|
|
433
|
-
${o ? `${
|
|
434
|
-
` : ""}${
|
|
430
|
+
const o = t && nt(r).some((d) => d.id === t) ? t : void 0, a = `
|
|
431
|
+
${ln}
|
|
432
|
+
${an(o)}
|
|
433
|
+
${o ? `${cn()}
|
|
434
|
+
` : ""}${un}`, l = i.index + i[0].length;
|
|
435
435
|
return r.slice(0, l) + a + r.slice(l);
|
|
436
436
|
}
|
|
437
|
-
const
|
|
437
|
+
const Ne = `<?xml version="1.0" encoding="UTF-8"?>
|
|
438
438
|
<publication>
|
|
439
439
|
<source>
|
|
440
440
|
<directories external="../assets" generated="../generated-assets" />
|
|
@@ -442,35 +442,37 @@ const de = `<?xml version="1.0" encoding="UTF-8"?>
|
|
|
442
442
|
<common>
|
|
443
443
|
<tableofcontents level="0"/>
|
|
444
444
|
</common>
|
|
445
|
-
<html>
|
|
446
|
-
<platform portable="yes"/>
|
|
447
|
-
</html>
|
|
448
445
|
</publication>
|
|
449
|
-
`,
|
|
450
|
-
|
|
446
|
+
`, hn = [
|
|
447
|
+
[["html", "resources"], "host", "cdn"],
|
|
448
|
+
[["html", "platform"], "portable", "no"],
|
|
449
|
+
[["html", "cross-references"], "knowled", "never"],
|
|
450
|
+
[["common", "chunking"], "level", "0"]
|
|
451
|
+
], pn = ["theme", "style", "shell"];
|
|
452
|
+
function O(e, t) {
|
|
451
453
|
for (const n of e.children)
|
|
452
454
|
if (n.type === "element" && n.name === t)
|
|
453
455
|
return n;
|
|
454
456
|
}
|
|
455
457
|
function ee(e, t) {
|
|
456
|
-
let n =
|
|
458
|
+
let n = O(e, t);
|
|
457
459
|
return n || (n = { type: "element", name: t, attributes: {}, children: [] }, e.children.push(n)), n;
|
|
458
460
|
}
|
|
459
|
-
function
|
|
460
|
-
const n =
|
|
461
|
-
if (n &&
|
|
461
|
+
function mn(e, t) {
|
|
462
|
+
const n = O(e, "css");
|
|
463
|
+
if (n && pn.some((i) => n.attributes?.[i]))
|
|
462
464
|
return;
|
|
463
465
|
const r = n ?? ee(e, "css");
|
|
464
466
|
r.attributes = { ...r.attributes, theme: t };
|
|
465
467
|
}
|
|
466
|
-
function
|
|
467
|
-
const n =
|
|
468
|
+
function vn(e, t) {
|
|
469
|
+
const n = O(e, "appearance");
|
|
468
470
|
if (n?.attributes?.theme)
|
|
469
471
|
return;
|
|
470
472
|
const r = n ?? ee(e, "appearance");
|
|
471
473
|
r.attributes = { ...r.attributes, theme: t };
|
|
472
474
|
}
|
|
473
|
-
function
|
|
475
|
+
function wn(e) {
|
|
474
476
|
const t = ee(e, "resources");
|
|
475
477
|
t.attributes = {
|
|
476
478
|
...t.attributes,
|
|
@@ -478,70 +480,82 @@ function pn(e) {
|
|
|
478
480
|
math: "online"
|
|
479
481
|
};
|
|
480
482
|
}
|
|
481
|
-
function
|
|
482
|
-
const n = t.cssTheme?.trim(), r = t.revealTheme?.trim(), i = t.target === "slides";
|
|
483
|
-
if (!e && !n && !i)
|
|
484
|
-
return de;
|
|
485
|
-
const o = oe(e ?? de), a = j(o, "publication");
|
|
483
|
+
function rt(e, t = {}) {
|
|
484
|
+
const n = t.cssTheme?.trim(), r = t.revealTheme?.trim(), i = t.target === "slides", o = ne(e ?? Ne), a = O(o, "publication");
|
|
486
485
|
if (!a)
|
|
487
486
|
throw new Error(
|
|
488
487
|
"Invalid publication file: no root <publication> element found"
|
|
489
488
|
);
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
489
|
+
for (const [d, p, m] of hn) {
|
|
490
|
+
const h = d.reduce(
|
|
491
|
+
(T, x) => ee(T, x),
|
|
492
|
+
a
|
|
493
|
+
);
|
|
494
|
+
h.attributes = { ...h.attributes, [p]: m };
|
|
495
|
+
}
|
|
496
|
+
const l = ee(a, "html");
|
|
497
|
+
if (n && mn(l, n), i) {
|
|
498
|
+
const d = ee(a, "revealjs");
|
|
499
|
+
wn(d), r && vn(d, r);
|
|
494
500
|
}
|
|
495
501
|
return te(o);
|
|
496
502
|
}
|
|
497
|
-
|
|
503
|
+
const Nr = rt, bn = "generated/";
|
|
504
|
+
function Ee(e) {
|
|
498
505
|
if (!(e === void 0 || e === "" || e.startsWith("/")))
|
|
499
506
|
return e.endsWith("/") ? e : `${e}/`;
|
|
500
507
|
}
|
|
501
|
-
function
|
|
508
|
+
function je(e) {
|
|
502
509
|
const t = e?.attributes?.level;
|
|
503
510
|
if (t == null || t === "") return;
|
|
504
511
|
const n = Number(t);
|
|
505
512
|
return Number.isFinite(n) && n >= 0 ? n : void 0;
|
|
506
513
|
}
|
|
507
|
-
function
|
|
508
|
-
const t =
|
|
514
|
+
function gn(e) {
|
|
515
|
+
const t = ne(e ?? Ne), n = O(t, "publication"), r = n && O(n, "common"), i = r && O(r, "tableofcontents"), o = n && O(n, "numbering");
|
|
509
516
|
let a, l;
|
|
510
|
-
for (const
|
|
511
|
-
if (
|
|
512
|
-
const p =
|
|
513
|
-
p !== void 0 && (
|
|
517
|
+
for (const d of o?.children ?? []) {
|
|
518
|
+
if (d.type !== "element") continue;
|
|
519
|
+
const p = je(d);
|
|
520
|
+
p !== void 0 && (d.name === "divisions" ? l = p : a = Math.max(a ?? 0, p));
|
|
514
521
|
}
|
|
515
522
|
return {
|
|
516
|
-
tocLevel:
|
|
523
|
+
tocLevel: je(i),
|
|
517
524
|
numberingLevel: a,
|
|
518
525
|
maxNumberingLevel: l
|
|
519
526
|
};
|
|
520
527
|
}
|
|
521
|
-
function
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
return {
|
|
528
|
-
external: o,
|
|
529
|
-
generated: a,
|
|
530
|
-
managed: o !== void 0 && a !== void 0
|
|
531
|
-
};
|
|
528
|
+
function yn(e, t) {
|
|
529
|
+
const n = ne(e ?? Ne), r = O(n, "publication"), i = r && O(r, "source"), o = i && O(i, "directories"), a = (p) => {
|
|
530
|
+
const m = o?.attributes?.[p];
|
|
531
|
+
return m == null ? void 0 : String(m);
|
|
532
|
+
}, l = Ee(t !== void 0 ? t : a("external")), d = Ee(a("generated")) ?? bn;
|
|
533
|
+
return l === void 0 ? { generated: d } : { external: l, generated: d };
|
|
532
534
|
}
|
|
533
|
-
function
|
|
535
|
+
function ue(e) {
|
|
536
|
+
if (typeof e == "string")
|
|
537
|
+
try {
|
|
538
|
+
return ue(ne(e));
|
|
539
|
+
} catch {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
const t = e.children.find(
|
|
543
|
+
(o) => o.type === "element"
|
|
544
|
+
), n = t?.name === "docinfo" ? t : t && O(t, "docinfo"), i = (n && O(n, "directories"))?.attributes?.external;
|
|
545
|
+
return i == null ? void 0 : String(i);
|
|
546
|
+
}
|
|
547
|
+
function Rr(e) {
|
|
534
548
|
return e === "slides" || e === "scroll";
|
|
535
549
|
}
|
|
536
|
-
const
|
|
537
|
-
function
|
|
538
|
-
const t = typeof e == "number" && isFinite(e) ? e :
|
|
550
|
+
const it = 960, ot = 700, En = 1, xn = 0.04;
|
|
551
|
+
function Sn(e) {
|
|
552
|
+
const t = typeof e == "number" && isFinite(e) ? e : En, n = Math.min(1, Math.max(0.25, t));
|
|
539
553
|
return {
|
|
540
|
-
width: Math.round(
|
|
541
|
-
height: Math.round(
|
|
554
|
+
width: Math.round(it / n),
|
|
555
|
+
height: Math.round(ot / n)
|
|
542
556
|
};
|
|
543
557
|
}
|
|
544
|
-
function
|
|
558
|
+
function Tn(e) {
|
|
545
559
|
return {
|
|
546
560
|
view: "scroll",
|
|
547
561
|
scrollLayout: "compact",
|
|
@@ -551,11 +565,11 @@ function En(e) {
|
|
|
551
565
|
controls: !1,
|
|
552
566
|
controlsTutorial: !1,
|
|
553
567
|
hash: !1,
|
|
554
|
-
...
|
|
555
|
-
margin:
|
|
568
|
+
...Sn(e.zoom),
|
|
569
|
+
margin: xn
|
|
556
570
|
};
|
|
557
571
|
}
|
|
558
|
-
function
|
|
572
|
+
function In() {
|
|
559
573
|
return {
|
|
560
574
|
// Explicitly null rather than absent: the same page may have been
|
|
561
575
|
// delivered in scroll view a moment ago, and an embedder that re-injects
|
|
@@ -567,11 +581,11 @@ function xn() {
|
|
|
567
581
|
// size with a percentage width renders its text far larger, relative to
|
|
568
582
|
// the slide, than the same deck will on a projector. No zoom margin
|
|
569
583
|
// though — presenting means filling whatever it is shown in.
|
|
570
|
-
width:
|
|
571
|
-
height:
|
|
584
|
+
width: it,
|
|
585
|
+
height: ot
|
|
572
586
|
};
|
|
573
587
|
}
|
|
574
|
-
const
|
|
588
|
+
const An = [
|
|
575
589
|
"<style>",
|
|
576
590
|
".reveal-viewport.reveal-scroll .scroll-page section {",
|
|
577
591
|
" box-shadow: inset 0 0 0 calc(1px / var(--slide-scale, 1))",
|
|
@@ -579,14 +593,14 @@ const Sn = [
|
|
|
579
593
|
"}",
|
|
580
594
|
"</style>"
|
|
581
595
|
].join(`
|
|
582
|
-
`),
|
|
596
|
+
`), Ln = [
|
|
583
597
|
" var paused = document.querySelectorAll('.reveal .fragment');",
|
|
584
598
|
" for (var i = 0; i < paused.length; i++) {",
|
|
585
599
|
" paused[i].classList.remove('fragment');",
|
|
586
600
|
" }"
|
|
587
601
|
];
|
|
588
|
-
function
|
|
589
|
-
const n = e === "scroll" ?
|
|
602
|
+
function _n(e, t = {}) {
|
|
603
|
+
const n = e === "scroll" ? Tn(t) : In();
|
|
590
604
|
return [
|
|
591
605
|
"<script>",
|
|
592
606
|
"(function () {",
|
|
@@ -614,7 +628,7 @@ function In(e, t = {}) {
|
|
|
614
628
|
// Inside the wrapper rather than at top level: this script sits in <head>,
|
|
615
629
|
// where the slides have not been parsed yet, but the deck calls initialize
|
|
616
630
|
// from the end of the document, by which time they have.
|
|
617
|
-
...e === "scroll" ?
|
|
631
|
+
...e === "scroll" ? Ln : [],
|
|
618
632
|
" return initialize(merged);",
|
|
619
633
|
" };",
|
|
620
634
|
"})();",
|
|
@@ -622,35 +636,35 @@ function In(e, t = {}) {
|
|
|
622
636
|
].join(`
|
|
623
637
|
`);
|
|
624
638
|
}
|
|
625
|
-
const
|
|
626
|
-
function
|
|
627
|
-
const r =
|
|
639
|
+
const $n = /<script\b[^>]*\bsrc=["'][^"']*\breveal\.js["'][^>]*>\s*<\/script>/i, kn = "<!--ptx-reveal-view-->", Nn = "<!--/ptx-reveal-view-->", Rn = /\n?<!--ptx-reveal-view-->[\s\S]*?<!--\/ptx-reveal-view-->/;
|
|
640
|
+
function Pn(e, t, n = {}) {
|
|
641
|
+
const r = Rn.exec(e), i = r ? e.slice(0, r.index) + e.slice(r.index + r[0].length) : e, o = $n.exec(i);
|
|
628
642
|
if (!o)
|
|
629
643
|
return i;
|
|
630
644
|
const a = o.index + o[0].length, l = `
|
|
631
|
-
${
|
|
632
|
-
${
|
|
633
|
-
${
|
|
634
|
-
${
|
|
645
|
+
${kn}
|
|
646
|
+
${An}
|
|
647
|
+
${_n(t, n)}
|
|
648
|
+
${Nn}`;
|
|
635
649
|
return i.slice(0, a) + l + i.slice(a);
|
|
636
650
|
}
|
|
637
|
-
const
|
|
638
|
-
async function
|
|
639
|
-
return (e?.readSource ? await e.readSource(t) : void 0) ?? await
|
|
651
|
+
const st = "http://www.w3.org/2001/XInclude", Ue = 64;
|
|
652
|
+
async function we(e, t) {
|
|
653
|
+
return (e?.readSource ? await e.readSource(t) : void 0) ?? await jt(t);
|
|
640
654
|
}
|
|
641
|
-
function
|
|
642
|
-
return e.cache ? e.cache.parse(t, n) :
|
|
655
|
+
function Re(e, t, n) {
|
|
656
|
+
return e.cache ? e.cache.parse(t, n) : ne(n);
|
|
643
657
|
}
|
|
644
|
-
async function
|
|
645
|
-
const i =
|
|
658
|
+
async function Pe(e, t, n, r = {}) {
|
|
659
|
+
const i = S(t), o = Re(r, i, e), a = {
|
|
646
660
|
...r,
|
|
647
|
-
projectDir:
|
|
661
|
+
projectDir: S(n),
|
|
648
662
|
stack: [i],
|
|
649
663
|
files: [i],
|
|
650
664
|
bytes: e.length
|
|
651
|
-
}, l = await
|
|
665
|
+
}, l = await oe(
|
|
652
666
|
o,
|
|
653
|
-
|
|
667
|
+
K(i),
|
|
654
668
|
{ "": "" },
|
|
655
669
|
a
|
|
656
670
|
);
|
|
@@ -661,43 +675,43 @@ async function Ne(e, t, n, r = {}) {
|
|
|
661
675
|
bytes: a.bytes
|
|
662
676
|
};
|
|
663
677
|
}
|
|
664
|
-
function
|
|
678
|
+
function at(e) {
|
|
665
679
|
return e.data?.ptxIncludedFile;
|
|
666
680
|
}
|
|
667
|
-
function
|
|
681
|
+
function ct(e, t) {
|
|
668
682
|
const n = e.data ?? (e.data = {});
|
|
669
683
|
n.ptxIncludedFile = t;
|
|
670
684
|
}
|
|
671
|
-
function
|
|
685
|
+
function de(e, t) {
|
|
672
686
|
let n = e;
|
|
673
687
|
for (const [r, i] of Object.entries(t.attributes))
|
|
674
688
|
(r === "xmlns" || r.startsWith("xmlns:")) && (n === e && (n = { ...e }), n[r === "xmlns" ? "" : r.slice(6)] = i ?? "");
|
|
675
689
|
return n;
|
|
676
690
|
}
|
|
677
|
-
function
|
|
691
|
+
function lt(e, t) {
|
|
678
692
|
const n = e.name.indexOf(":"), r = n === -1 ? "" : e.name.slice(0, n);
|
|
679
|
-
return (n === -1 ? e.name : e.name.slice(n + 1)) === "include" && t[r] ===
|
|
693
|
+
return (n === -1 ? e.name : e.name.slice(n + 1)) === "include" && t[r] === st;
|
|
680
694
|
}
|
|
681
|
-
async function
|
|
695
|
+
async function oe(e, t, n, r) {
|
|
682
696
|
let i = !1;
|
|
683
697
|
for (let o = 0; o < e.children.length; o++) {
|
|
684
698
|
const a = e.children[o];
|
|
685
699
|
if (a.type !== "element")
|
|
686
700
|
continue;
|
|
687
|
-
const l =
|
|
688
|
-
if (
|
|
689
|
-
const
|
|
701
|
+
const l = de(n, a);
|
|
702
|
+
if (lt(a, l)) {
|
|
703
|
+
const d = await ut(
|
|
690
704
|
a,
|
|
691
705
|
t,
|
|
692
706
|
l,
|
|
693
707
|
r
|
|
694
708
|
);
|
|
695
|
-
e.children.splice(o, 1, ...
|
|
696
|
-
} else await
|
|
709
|
+
e.children.splice(o, 1, ...d), o += d.length - 1, i = !0;
|
|
710
|
+
} else await oe(a, t, l, r) && (i = !0);
|
|
697
711
|
}
|
|
698
712
|
return i;
|
|
699
713
|
}
|
|
700
|
-
async function
|
|
714
|
+
async function ut(e, t, n, r) {
|
|
701
715
|
const i = r.stack[r.stack.length - 1];
|
|
702
716
|
if (e.attributes.xpointer)
|
|
703
717
|
throw new Error(
|
|
@@ -711,8 +725,8 @@ async function ct(e, t, n, r) {
|
|
|
711
725
|
a = decodeURIComponent(o);
|
|
712
726
|
} catch {
|
|
713
727
|
}
|
|
714
|
-
const l =
|
|
715
|
-
if (l !== r.projectDir && !l.startsWith(r.projectDir +
|
|
728
|
+
const l = S(t, a);
|
|
729
|
+
if (l !== r.projectDir && !l.startsWith(r.projectDir + Ae))
|
|
716
730
|
throw new Error(
|
|
717
731
|
`xi:include escapes the project directory: ${o} (in ${i})`
|
|
718
732
|
);
|
|
@@ -720,69 +734,69 @@ async function ct(e, t, n, r) {
|
|
|
720
734
|
throw new Error(
|
|
721
735
|
`Circular xi:include: ${[...r.stack, l].join(" -> ")}`
|
|
722
736
|
);
|
|
723
|
-
if (r.stack.length >=
|
|
724
|
-
throw new Error(`xi:include nesting exceeds ${
|
|
725
|
-
const
|
|
726
|
-
if (
|
|
727
|
-
const
|
|
728
|
-
if (
|
|
729
|
-
return await
|
|
737
|
+
if (r.stack.length >= Ue)
|
|
738
|
+
throw new Error(`xi:include nesting exceeds ${Ue} levels`);
|
|
739
|
+
const d = await we(r, l);
|
|
740
|
+
if (d === void 0) {
|
|
741
|
+
const h = Dn(e, n);
|
|
742
|
+
if (h)
|
|
743
|
+
return await oe(h, t, n, r), h.children;
|
|
730
744
|
throw new Error(`xi:include target not found: ${o} (in ${i})`);
|
|
731
745
|
}
|
|
732
|
-
if (r.files.includes(l) || r.files.push(l), r.bytes +=
|
|
733
|
-
return [{ type: "text", value:
|
|
746
|
+
if (r.files.includes(l) || r.files.push(l), r.bytes += d.length, e.attributes.parse === "text")
|
|
747
|
+
return [{ type: "text", value: d }];
|
|
734
748
|
let p;
|
|
735
749
|
try {
|
|
736
|
-
p =
|
|
737
|
-
} catch (
|
|
750
|
+
p = Re(r, l, d);
|
|
751
|
+
} catch (h) {
|
|
738
752
|
throw new Error(
|
|
739
|
-
`Could not parse xi:include target ${l} as XML: ${
|
|
753
|
+
`Could not parse xi:include target ${l} as XML: ${h instanceof Error ? h.message : h}. (Included files must be well-formed, with a single root element.)`
|
|
740
754
|
);
|
|
741
755
|
}
|
|
742
756
|
r.stack.push(l);
|
|
743
757
|
try {
|
|
744
|
-
await
|
|
758
|
+
await oe(p, K(l), { "": "" }, r);
|
|
745
759
|
} finally {
|
|
746
760
|
r.stack.pop();
|
|
747
761
|
}
|
|
748
|
-
const
|
|
749
|
-
(
|
|
762
|
+
const m = p.children.filter(
|
|
763
|
+
(h) => h.type === "element"
|
|
750
764
|
);
|
|
751
|
-
for (const
|
|
752
|
-
|
|
753
|
-
return
|
|
765
|
+
for (const h of m)
|
|
766
|
+
ct(h, l);
|
|
767
|
+
return m;
|
|
754
768
|
}
|
|
755
|
-
function
|
|
769
|
+
function Fe(e) {
|
|
756
770
|
return e.name === "docinfo";
|
|
757
771
|
}
|
|
758
|
-
async function
|
|
772
|
+
async function Cn(e, t, n, r = {}) {
|
|
759
773
|
try {
|
|
760
|
-
const i =
|
|
761
|
-
(
|
|
774
|
+
const i = S(t), a = Re(r, i, e).children.find(
|
|
775
|
+
(m) => m.type === "element"
|
|
762
776
|
);
|
|
763
777
|
if (!a)
|
|
764
778
|
return;
|
|
765
|
-
const l =
|
|
779
|
+
const l = K(i), d = {
|
|
766
780
|
...r,
|
|
767
|
-
projectDir:
|
|
781
|
+
projectDir: S(n),
|
|
768
782
|
stack: [i],
|
|
769
783
|
files: [i],
|
|
770
784
|
bytes: e.length
|
|
771
|
-
}, p =
|
|
772
|
-
for (const
|
|
773
|
-
if (
|
|
785
|
+
}, p = de({ "": "" }, a);
|
|
786
|
+
for (const m of a.children) {
|
|
787
|
+
if (m.type !== "element")
|
|
774
788
|
continue;
|
|
775
|
-
const
|
|
776
|
-
if (
|
|
777
|
-
return await
|
|
778
|
-
if (
|
|
779
|
-
const x = (await
|
|
780
|
-
|
|
789
|
+
const h = de(p, m);
|
|
790
|
+
if (Fe(m))
|
|
791
|
+
return await oe(m, l, h, d), te(m);
|
|
792
|
+
if (lt(m, h)) {
|
|
793
|
+
const x = (await ut(
|
|
794
|
+
m,
|
|
781
795
|
l,
|
|
782
|
-
|
|
783
|
-
|
|
796
|
+
h,
|
|
797
|
+
d
|
|
784
798
|
)).find(
|
|
785
|
-
(_) => _.type === "element" &&
|
|
799
|
+
(_) => _.type === "element" && Fe(_)
|
|
786
800
|
);
|
|
787
801
|
if (x)
|
|
788
802
|
return te(x);
|
|
@@ -795,24 +809,24 @@ async function Nn(e, t, n, r = {}) {
|
|
|
795
809
|
return;
|
|
796
810
|
}
|
|
797
811
|
}
|
|
798
|
-
function
|
|
812
|
+
function Dn(e, t) {
|
|
799
813
|
for (const n of e.children) {
|
|
800
814
|
if (n.type !== "element")
|
|
801
815
|
continue;
|
|
802
|
-
const r =
|
|
803
|
-
if ((i === -1 ? n.name : n.name.slice(i + 1)) === "fallback" && r[o] ===
|
|
816
|
+
const r = de(t, n), i = n.name.indexOf(":"), o = i === -1 ? "" : n.name.slice(0, i);
|
|
817
|
+
if ((i === -1 ? n.name : n.name.slice(i + 1)) === "fallback" && r[o] === st)
|
|
804
818
|
return n;
|
|
805
819
|
}
|
|
806
820
|
}
|
|
807
|
-
function
|
|
821
|
+
function ft(e) {
|
|
808
822
|
return typeof e == "object" && e !== null && e.type === "element";
|
|
809
823
|
}
|
|
810
|
-
function
|
|
824
|
+
function On(e) {
|
|
811
825
|
return /^(pf|xhtml):/.test(e.name);
|
|
812
826
|
}
|
|
813
|
-
function
|
|
827
|
+
function Mn(e, t, n) {
|
|
814
828
|
const r = [];
|
|
815
|
-
return
|
|
829
|
+
return dt(e, t, n, (i, o, a, l) => {
|
|
816
830
|
r.push({
|
|
817
831
|
id: o,
|
|
818
832
|
file: a,
|
|
@@ -823,36 +837,36 @@ function Cn(e, t, n) {
|
|
|
823
837
|
});
|
|
824
838
|
}), r;
|
|
825
839
|
}
|
|
826
|
-
function
|
|
840
|
+
function Bn(e, t, n) {
|
|
827
841
|
let r;
|
|
828
|
-
return
|
|
842
|
+
return dt(e, "", n, (i, o) => {
|
|
829
843
|
if (i === t)
|
|
830
844
|
return r = o, !1;
|
|
831
845
|
}), r;
|
|
832
846
|
}
|
|
833
|
-
function
|
|
834
|
-
const i = e.children.find(
|
|
847
|
+
function dt(e, t, n, r) {
|
|
848
|
+
const i = e.children.find(ft);
|
|
835
849
|
if (i) {
|
|
836
850
|
const o = n?.parentId ?? "root";
|
|
837
|
-
|
|
851
|
+
ht(i, o, n?.position ?? 1, t, o, r);
|
|
838
852
|
}
|
|
839
853
|
}
|
|
840
|
-
function
|
|
841
|
-
const a =
|
|
842
|
-
let l,
|
|
843
|
-
if (
|
|
844
|
-
|
|
854
|
+
function ht(e, t, n, r, i, o) {
|
|
855
|
+
const a = at(e) ?? r;
|
|
856
|
+
let l, d;
|
|
857
|
+
if (On(e))
|
|
858
|
+
d = "root";
|
|
845
859
|
else {
|
|
846
|
-
const
|
|
847
|
-
if (l =
|
|
860
|
+
const m = e.attributes.label ?? e.attributes["xml:id"];
|
|
861
|
+
if (l = m ?? `${t}-${n}`, o(e, l, a, i) === !1)
|
|
848
862
|
return !1;
|
|
849
|
-
|
|
863
|
+
d = l;
|
|
850
864
|
}
|
|
851
865
|
let p = 0;
|
|
852
|
-
for (const
|
|
853
|
-
if (
|
|
854
|
-
|
|
855
|
-
|
|
866
|
+
for (const m of e.children)
|
|
867
|
+
if (ft(m) && (p += 1, !ht(
|
|
868
|
+
m,
|
|
869
|
+
d,
|
|
856
870
|
p,
|
|
857
871
|
a,
|
|
858
872
|
l ?? i,
|
|
@@ -861,28 +875,28 @@ function ft(e, t, n, r, i, o) {
|
|
|
861
875
|
return !1;
|
|
862
876
|
return !0;
|
|
863
877
|
}
|
|
864
|
-
function
|
|
878
|
+
function Pr(e, t) {
|
|
865
879
|
let n;
|
|
866
880
|
for (const r of e)
|
|
867
881
|
r.line <= t && (n = r);
|
|
868
882
|
return n ?? e[0];
|
|
869
883
|
}
|
|
870
|
-
function
|
|
884
|
+
function jn(e) {
|
|
871
885
|
const t = e.replace(/<!--[\s\S]*?-->/g, " ").replace(/<!\[CDATA\[[\s\S]*?\]\]>/g, " ");
|
|
872
886
|
return /<\s*slide(?:show)?[\s/>]/.test(t) ? "slides" : "html";
|
|
873
887
|
}
|
|
874
|
-
const
|
|
875
|
-
function
|
|
888
|
+
const pt = "pretext-html:set-theme";
|
|
889
|
+
function Cr(e) {
|
|
876
890
|
return e === "dark" || e === "light" || e === "system";
|
|
877
891
|
}
|
|
878
|
-
function
|
|
879
|
-
return { type:
|
|
892
|
+
function Dr(e) {
|
|
893
|
+
return { type: pt, theme: e };
|
|
880
894
|
}
|
|
881
|
-
function
|
|
895
|
+
function Un(e) {
|
|
882
896
|
return [
|
|
883
897
|
"<script>",
|
|
884
898
|
"(function () {",
|
|
885
|
-
" var CFG = " + JSON.stringify({ msg:
|
|
899
|
+
" var CFG = " + JSON.stringify({ msg: pt, initial: e }) + ";",
|
|
886
900
|
// Where the last requested theme is remembered so it survives an in-place
|
|
887
901
|
// document rewrite (same Window) and outranks the baked initial value.
|
|
888
902
|
" var KEY = '__ptxPreviewTheme';",
|
|
@@ -952,12 +966,12 @@ function On(e) {
|
|
|
952
966
|
].join(`
|
|
953
967
|
`);
|
|
954
968
|
}
|
|
955
|
-
function
|
|
956
|
-
const n =
|
|
969
|
+
function Fn(e, t) {
|
|
970
|
+
const n = Un(t);
|
|
957
971
|
return /<head[^>]*>/i.test(e) ? e.replace(/<head([^>]*)>/i, `<head$1>
|
|
958
972
|
${n}`) : e;
|
|
959
973
|
}
|
|
960
|
-
const
|
|
974
|
+
const mt = /* @__PURE__ */ new Set([
|
|
961
975
|
"colophon",
|
|
962
976
|
"biography",
|
|
963
977
|
"dedication",
|
|
@@ -977,89 +991,89 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
977
991
|
"glossary",
|
|
978
992
|
"worksheet",
|
|
979
993
|
"handout"
|
|
980
|
-
]),
|
|
994
|
+
]), vt = /* @__PURE__ */ new Set([
|
|
981
995
|
"book",
|
|
982
996
|
"article",
|
|
983
997
|
"slideshow",
|
|
984
998
|
"letter",
|
|
985
999
|
"memo"
|
|
986
1000
|
]), z = /* @__PURE__ */ new Set([
|
|
987
|
-
...
|
|
988
|
-
...
|
|
1001
|
+
...vt,
|
|
1002
|
+
...mt,
|
|
989
1003
|
"part",
|
|
990
1004
|
"foreword",
|
|
991
1005
|
"frontmatter",
|
|
992
1006
|
"backmatter"
|
|
993
1007
|
]);
|
|
994
|
-
function
|
|
1008
|
+
function be(e) {
|
|
995
1009
|
return z.has(e.name);
|
|
996
1010
|
}
|
|
997
|
-
const
|
|
1011
|
+
const Wn = /* @__PURE__ */ new Set(["docinfo"]), wt = /* @__PURE__ */ new Set([
|
|
998
1012
|
"title",
|
|
999
1013
|
"shorttitle",
|
|
1000
1014
|
"plaintitle",
|
|
1001
1015
|
"subtitle",
|
|
1002
1016
|
"caption"
|
|
1003
1017
|
]);
|
|
1004
|
-
function
|
|
1018
|
+
function R(e) {
|
|
1005
1019
|
return e.type === "element";
|
|
1006
1020
|
}
|
|
1007
|
-
function
|
|
1021
|
+
function bt(e) {
|
|
1008
1022
|
return e.attributes["xml:id"] ?? void 0;
|
|
1009
1023
|
}
|
|
1010
|
-
function
|
|
1024
|
+
function he(e, t) {
|
|
1011
1025
|
for (const n of e.children) {
|
|
1012
|
-
if (!
|
|
1013
|
-
if (
|
|
1014
|
-
const r =
|
|
1026
|
+
if (!R(n)) continue;
|
|
1027
|
+
if (bt(n) === t) return n;
|
|
1028
|
+
const r = he(n, t);
|
|
1015
1029
|
if (r) return r;
|
|
1016
1030
|
}
|
|
1017
1031
|
}
|
|
1018
1032
|
function X(e, t) {
|
|
1019
1033
|
for (const n of e.children) {
|
|
1020
|
-
if (!
|
|
1034
|
+
if (!R(n)) continue;
|
|
1021
1035
|
if (n === t) return [n];
|
|
1022
1036
|
const r = X(n, t);
|
|
1023
1037
|
if (r) return [n, ...r];
|
|
1024
1038
|
}
|
|
1025
1039
|
}
|
|
1026
|
-
function
|
|
1027
|
-
return
|
|
1040
|
+
function gt(e, t, n, r) {
|
|
1041
|
+
return vt.has(n) ? 0 : n === "frontmatter" || n === "backmatter" || n === "part" ? t === "book" && r ? 1 : 0 : mt.has(n) ? e + 1 : e;
|
|
1028
1042
|
}
|
|
1029
|
-
function
|
|
1043
|
+
function pe(e, t) {
|
|
1030
1044
|
let n = 0;
|
|
1031
1045
|
for (const [r, i] of e.entries()) {
|
|
1032
1046
|
const o = r === 0 ? void 0 : e[r - 1];
|
|
1033
|
-
n =
|
|
1047
|
+
n = gt(n, o?.name, i.name, t);
|
|
1034
1048
|
}
|
|
1035
1049
|
return n;
|
|
1036
1050
|
}
|
|
1037
|
-
function
|
|
1051
|
+
function Ce(e) {
|
|
1038
1052
|
return e?.name === "book" && e.children.some(
|
|
1039
|
-
(t) =>
|
|
1053
|
+
(t) => R(t) && t.name === "part"
|
|
1040
1054
|
);
|
|
1041
1055
|
}
|
|
1042
1056
|
function Q(e, t) {
|
|
1043
1057
|
return e.children.some(
|
|
1044
|
-
(n) =>
|
|
1058
|
+
(n) => R(n) && t.includes(n.name)
|
|
1045
1059
|
);
|
|
1046
1060
|
}
|
|
1047
|
-
function
|
|
1061
|
+
function Hn(e) {
|
|
1048
1062
|
if (!e) return 0;
|
|
1049
1063
|
const t = e.name;
|
|
1050
1064
|
if (t === "book") {
|
|
1051
|
-
const n =
|
|
1052
|
-
(o) =>
|
|
1065
|
+
const n = Ce(e), r = n ? e.children.some(
|
|
1066
|
+
(o) => R(o) && o.name === "part" && Q(o, ["chapter"])
|
|
1053
1067
|
) : Q(e, ["chapter"]), i = (n ? e.children.flatMap(
|
|
1054
|
-
(o) =>
|
|
1068
|
+
(o) => R(o) && o.name === "part" ? o.children : []
|
|
1055
1069
|
) : e.children).some(
|
|
1056
|
-
(o) =>
|
|
1070
|
+
(o) => R(o) && o.name === "chapter" && Q(o, ["section"])
|
|
1057
1071
|
);
|
|
1058
1072
|
return n && i ? 3 : n && r || i ? 2 : r ? 1 : 0;
|
|
1059
1073
|
}
|
|
1060
1074
|
if (t === "article") {
|
|
1061
1075
|
const n = e.children.filter(
|
|
1062
|
-
(r) =>
|
|
1076
|
+
(r) => R(r) && r.name === "section"
|
|
1063
1077
|
);
|
|
1064
1078
|
if (n.some((r) => Q(r, ["subsection"])))
|
|
1065
1079
|
return 2;
|
|
@@ -1068,21 +1082,21 @@ function Un(e) {
|
|
|
1068
1082
|
}
|
|
1069
1083
|
return 0;
|
|
1070
1084
|
}
|
|
1071
|
-
function
|
|
1072
|
-
return e ? e.name === "book" ?
|
|
1085
|
+
function Vn(e) {
|
|
1086
|
+
return e ? e.name === "book" ? Ce(e) ? 3 : 2 : e.name === "article" && Q(e, ["section", "worksheet", "handout"]) ? 1 : 0 : 0;
|
|
1073
1087
|
}
|
|
1074
|
-
function
|
|
1075
|
-
if (!
|
|
1076
|
-
e.children = e.children.filter(
|
|
1088
|
+
function De(e) {
|
|
1089
|
+
if (!wt.has(e.name)) {
|
|
1090
|
+
e.children = e.children.filter(R);
|
|
1077
1091
|
for (const t of e.children)
|
|
1078
|
-
|
|
1092
|
+
De(t);
|
|
1079
1093
|
}
|
|
1080
1094
|
}
|
|
1081
|
-
function
|
|
1095
|
+
function Xn(e) {
|
|
1082
1096
|
for (const t of e.children)
|
|
1083
|
-
|
|
1097
|
+
R(t) && !z.has(t.name) && De(t);
|
|
1084
1098
|
}
|
|
1085
|
-
function
|
|
1099
|
+
function zn(e, t = !1) {
|
|
1086
1100
|
const n = /* @__PURE__ */ new Set(), r = (i) => {
|
|
1087
1101
|
if (!(t && i !== e && z.has(i.name))) {
|
|
1088
1102
|
if (i.name === "xref") {
|
|
@@ -1096,16 +1110,16 @@ function Hn(e, t = !1) {
|
|
|
1096
1110
|
l && n.add(l);
|
|
1097
1111
|
}
|
|
1098
1112
|
for (const o of i.children)
|
|
1099
|
-
|
|
1113
|
+
R(o) && r(o);
|
|
1100
1114
|
}
|
|
1101
1115
|
};
|
|
1102
1116
|
return r(e), n;
|
|
1103
1117
|
}
|
|
1104
|
-
function
|
|
1118
|
+
function Gn(e, t, n) {
|
|
1105
1119
|
const r = (i) => {
|
|
1106
1120
|
for (const [o, a] of i.children.entries())
|
|
1107
|
-
if (
|
|
1108
|
-
if (
|
|
1121
|
+
if (R(a)) {
|
|
1122
|
+
if (bt(a) === t)
|
|
1109
1123
|
return i.children[o] = n, !0;
|
|
1110
1124
|
if (r(a)) return !0;
|
|
1111
1125
|
}
|
|
@@ -1113,88 +1127,88 @@ function Vn(e, t, n) {
|
|
|
1113
1127
|
};
|
|
1114
1128
|
return r(e);
|
|
1115
1129
|
}
|
|
1116
|
-
function
|
|
1130
|
+
function yt(e, t, n) {
|
|
1117
1131
|
const r = n.contentKept.has(e), i = n.chain.has(e), o = [];
|
|
1118
1132
|
for (const a of e.children) {
|
|
1119
|
-
if (!
|
|
1133
|
+
if (!R(a)) {
|
|
1120
1134
|
r && o.push(a);
|
|
1121
1135
|
continue;
|
|
1122
1136
|
}
|
|
1123
|
-
if (n.verbatim.has(a) ||
|
|
1137
|
+
if (n.verbatim.has(a) || Wn.has(a.name) || wt.has(a.name))
|
|
1124
1138
|
o.push(a);
|
|
1125
1139
|
else if (z.has(a.name)) {
|
|
1126
|
-
const l =
|
|
1140
|
+
const l = gt(
|
|
1127
1141
|
t,
|
|
1128
1142
|
e.name,
|
|
1129
1143
|
a.name,
|
|
1130
1144
|
n.hasParts
|
|
1131
1145
|
);
|
|
1132
|
-
(n.chain.has(a) || i || l <= n.tocLevel) && (
|
|
1146
|
+
(n.chain.has(a) || i || l <= n.tocLevel) && (yt(a, l, n), o.push(a));
|
|
1133
1147
|
} else r && o.push(a);
|
|
1134
1148
|
}
|
|
1135
1149
|
e.children = o;
|
|
1136
1150
|
}
|
|
1137
|
-
function
|
|
1138
|
-
const r =
|
|
1151
|
+
function Jn(e, t, n = {}) {
|
|
1152
|
+
const r = he(e, t);
|
|
1139
1153
|
if (!r) return;
|
|
1140
1154
|
const i = X(e, r);
|
|
1141
1155
|
if (!i) return;
|
|
1142
1156
|
const o = (n.collapseChildren ?? !1) && r.children.some(
|
|
1143
|
-
(g) =>
|
|
1144
|
-
), a = (g) => g.name === "pretext" || g.name === "mathbook", l = i.filter((g) => !a(g)),
|
|
1145
|
-
const
|
|
1146
|
-
return
|
|
1147
|
-
},
|
|
1148
|
-
n.numberingLevel ??
|
|
1149
|
-
|
|
1150
|
-
), _ = n.tocLevel ??
|
|
1157
|
+
(g) => R(g) && z.has(g.name)
|
|
1158
|
+
), a = (g) => g.name === "pretext" || g.name === "mathbook", l = i.filter((g) => !a(g)), d = l[0], p = Ce(d), m = pe(l, p), h = (g) => {
|
|
1159
|
+
const N = X(e, g)?.filter((E) => !a(E)) ?? [];
|
|
1160
|
+
return pe(N, p);
|
|
1161
|
+
}, T = n.maxNumberingLevel ?? 1 / 0, x = Math.min(
|
|
1162
|
+
n.numberingLevel ?? Vn(d),
|
|
1163
|
+
T
|
|
1164
|
+
), _ = n.tocLevel ?? Hn(d), I = {
|
|
1151
1165
|
verbatim: /* @__PURE__ */ new Set(),
|
|
1152
1166
|
chain: new Set(i),
|
|
1153
1167
|
contentKept: /* @__PURE__ */ new Set(),
|
|
1154
1168
|
tocLevel: _,
|
|
1155
1169
|
hasParts: p
|
|
1156
|
-
}, F = /* @__PURE__ */ new Set(),
|
|
1157
|
-
o ?
|
|
1158
|
-
const
|
|
1159
|
-
const
|
|
1160
|
-
if (!
|
|
1161
|
-
const
|
|
1162
|
-
if (!
|
|
1163
|
-
if (i.includes(
|
|
1164
|
-
|
|
1170
|
+
}, F = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Set();
|
|
1171
|
+
o ? I.contentKept.add(r) : I.verbatim.add(r);
|
|
1172
|
+
const Y = (g) => {
|
|
1173
|
+
const N = X(e, g);
|
|
1174
|
+
if (!N) return;
|
|
1175
|
+
const E = N.filter(($) => z.has($.name)), j = E[E.length - 1];
|
|
1176
|
+
if (!j || j === r) return;
|
|
1177
|
+
if (i.includes(j)) {
|
|
1178
|
+
I.contentKept.add(j), M.add(j);
|
|
1165
1179
|
return;
|
|
1166
1180
|
}
|
|
1167
|
-
let
|
|
1168
|
-
for (let
|
|
1169
|
-
|
|
1170
|
-
if (!
|
|
1171
|
-
|
|
1172
|
-
for (const
|
|
1181
|
+
let C = j;
|
|
1182
|
+
for (let $ = E.length - 1; $ >= 0 && !(h(E[$]) <= x || i.includes(E[$ - 1])); $--)
|
|
1183
|
+
C = E[$ - 1] ?? C;
|
|
1184
|
+
if (!I.verbatim.has(C)) {
|
|
1185
|
+
I.verbatim.add(C), F.add(C);
|
|
1186
|
+
for (const $ of X(e, C) ?? []) I.chain.add($);
|
|
1173
1187
|
}
|
|
1174
1188
|
};
|
|
1175
|
-
for (const g of
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1189
|
+
for (const g of zn(r, o)) {
|
|
1190
|
+
const N = he(e, g);
|
|
1191
|
+
N && N !== r && Y(N);
|
|
1178
1192
|
}
|
|
1179
|
-
for (const g of [...
|
|
1180
|
-
if (!z.has(g.name) ||
|
|
1193
|
+
for (const g of [...I.chain]) {
|
|
1194
|
+
if (!z.has(g.name) || h(g) <= x)
|
|
1181
1195
|
continue;
|
|
1182
|
-
const
|
|
1183
|
-
if (
|
|
1184
|
-
for (const
|
|
1185
|
-
if (
|
|
1186
|
-
!
|
|
1196
|
+
const N = X(e, g)?.at(-2);
|
|
1197
|
+
if (N)
|
|
1198
|
+
for (const E of N.children) {
|
|
1199
|
+
if (E === g) break;
|
|
1200
|
+
!R(E) || !z.has(E.name) || I.verbatim.has(E) || I.chain.has(E) || (I.verbatim.add(E), F.add(E));
|
|
1187
1201
|
}
|
|
1188
1202
|
}
|
|
1189
|
-
const
|
|
1190
|
-
|
|
1203
|
+
const B = e.children.find(R);
|
|
1204
|
+
B && yt(B, 0, I);
|
|
1191
1205
|
for (const g of F)
|
|
1192
|
-
|
|
1193
|
-
for (const g of
|
|
1194
|
-
|
|
1195
|
-
return { content: te(e), divisionId: t, level:
|
|
1206
|
+
De(g);
|
|
1207
|
+
for (const g of M)
|
|
1208
|
+
Xn(g);
|
|
1209
|
+
return { content: te(e), divisionId: t, level: m, collapsed: o };
|
|
1196
1210
|
}
|
|
1197
|
-
class
|
|
1211
|
+
class Kn {
|
|
1198
1212
|
entries = /* @__PURE__ */ new Map();
|
|
1199
1213
|
maxEntries;
|
|
1200
1214
|
/** Cumulative hit/miss counts, for diagnostics and tests. */
|
|
@@ -1214,15 +1228,15 @@ class zn {
|
|
|
1214
1228
|
parse(t, n) {
|
|
1215
1229
|
const r = this.entries.get(t);
|
|
1216
1230
|
if (r && r.content === n)
|
|
1217
|
-
return this.hits += 1, this.entries.delete(t), this.entries.set(t, r),
|
|
1231
|
+
return this.hits += 1, this.entries.delete(t), this.entries.set(t, r), _e(r.tree);
|
|
1218
1232
|
this.misses += 1;
|
|
1219
|
-
const i =
|
|
1233
|
+
const i = ne(n);
|
|
1220
1234
|
for (this.entries.delete(t), this.entries.set(t, { content: n, tree: i }); this.entries.size > this.maxEntries; ) {
|
|
1221
1235
|
const o = this.entries.keys().next().value;
|
|
1222
1236
|
if (o === void 0) break;
|
|
1223
1237
|
this.entries.delete(o);
|
|
1224
1238
|
}
|
|
1225
|
-
return
|
|
1239
|
+
return _e(i);
|
|
1226
1240
|
}
|
|
1227
1241
|
/** Number of files currently held. */
|
|
1228
1242
|
get size() {
|
|
@@ -1233,86 +1247,86 @@ class zn {
|
|
|
1233
1247
|
t === void 0 ? this.entries.clear() : this.entries.delete(t);
|
|
1234
1248
|
}
|
|
1235
1249
|
}
|
|
1236
|
-
function
|
|
1250
|
+
function _e(e) {
|
|
1237
1251
|
const t = { ...e };
|
|
1238
|
-
return t.attributes && (t.attributes = { ...t.attributes }), t.children && (t.children = t.children.map((n) =>
|
|
1252
|
+
return t.attributes && (t.attributes = { ...t.attributes }), t.children && (t.children = t.children.map((n) => _e(n))), t.data && (t.data = { ...t.data }), t;
|
|
1239
1253
|
}
|
|
1240
|
-
function
|
|
1254
|
+
function me(e) {
|
|
1241
1255
|
return typeof e == "object" && e !== null && e.type === "element";
|
|
1242
1256
|
}
|
|
1243
|
-
function
|
|
1257
|
+
function Yn(e) {
|
|
1244
1258
|
for (let t = e.length - 1; t >= 0; t--)
|
|
1245
|
-
if (
|
|
1246
|
-
}
|
|
1247
|
-
function
|
|
1248
|
-
const r = [], i = (a, l,
|
|
1249
|
-
const p =
|
|
1250
|
-
p === n &&
|
|
1251
|
-
for (const
|
|
1252
|
-
|
|
1253
|
-
}, o = e.children.find(
|
|
1259
|
+
if (be(e[t])) return e[t];
|
|
1260
|
+
}
|
|
1261
|
+
function qn(e, t, n) {
|
|
1262
|
+
const r = [], i = (a, l, d) => {
|
|
1263
|
+
const p = at(a) ?? l, m = [...d, a];
|
|
1264
|
+
p === n && be(a) && r.push({ element: a, chain: m });
|
|
1265
|
+
for (const h of a.children)
|
|
1266
|
+
me(h) && i(h, p, m);
|
|
1267
|
+
}, o = e.children.find(me);
|
|
1254
1268
|
return o && i(o, t, []), r;
|
|
1255
1269
|
}
|
|
1256
|
-
function
|
|
1257
|
-
const i =
|
|
1270
|
+
function Zn(e, t, n, r) {
|
|
1271
|
+
const i = qn(e, t, n);
|
|
1258
1272
|
let o, a, l;
|
|
1259
|
-
for (const { element:
|
|
1260
|
-
const p =
|
|
1261
|
-
p === void 0 ||
|
|
1273
|
+
for (const { element: d } of i) {
|
|
1274
|
+
const p = d.position?.start.line, m = d.position?.end.line ?? p;
|
|
1275
|
+
p === void 0 || m === void 0 || (p <= r && r <= m ? o = d : p > r ? a ??= d : l = d);
|
|
1262
1276
|
}
|
|
1263
1277
|
return o ?? a ?? l;
|
|
1264
1278
|
}
|
|
1265
|
-
function
|
|
1279
|
+
function Qn(e, t, n) {
|
|
1266
1280
|
let r;
|
|
1267
1281
|
if (t.id !== void 0) {
|
|
1268
|
-
const
|
|
1269
|
-
r =
|
|
1282
|
+
const h = he(e, t.id), T = h && X(e, h);
|
|
1283
|
+
r = T && Yn(T);
|
|
1270
1284
|
} else if (t.line !== void 0) {
|
|
1271
|
-
const
|
|
1272
|
-
r =
|
|
1285
|
+
const h = S(n), T = S(t.file ?? n);
|
|
1286
|
+
r = Zn(e, h, T, t.line);
|
|
1273
1287
|
}
|
|
1274
1288
|
if (!r) return;
|
|
1275
1289
|
const i = t.level ?? 1 / 0;
|
|
1276
1290
|
let o = !1;
|
|
1277
1291
|
const l = (X(e, r) ?? [r]).filter(
|
|
1278
|
-
(
|
|
1279
|
-
),
|
|
1280
|
-
(
|
|
1281
|
-
),
|
|
1282
|
-
if (
|
|
1283
|
-
for (let
|
|
1284
|
-
const
|
|
1285
|
-
if (
|
|
1286
|
-
r =
|
|
1292
|
+
(h) => h.name !== "pretext" && h.name !== "mathbook"
|
|
1293
|
+
), d = l[0], p = d?.name === "book" && d.children.some(
|
|
1294
|
+
(h) => me(h) && h.name === "part"
|
|
1295
|
+
), m = pe(l, p);
|
|
1296
|
+
if (m > i)
|
|
1297
|
+
for (let h = 0; h < l.length; h++) {
|
|
1298
|
+
const T = l[h];
|
|
1299
|
+
if (be(T) && pe(l.slice(0, h + 1), p) >= i) {
|
|
1300
|
+
r = T;
|
|
1287
1301
|
break;
|
|
1288
1302
|
}
|
|
1289
1303
|
}
|
|
1290
|
-
else
|
|
1291
|
-
return { element: r, id:
|
|
1304
|
+
else m < i && (o = !0);
|
|
1305
|
+
return { element: r, id: Et(e, r), collapse: o };
|
|
1292
1306
|
}
|
|
1293
|
-
function
|
|
1307
|
+
function Et(e, t) {
|
|
1294
1308
|
const n = t.attributes["xml:id"];
|
|
1295
1309
|
if (n) return n;
|
|
1296
|
-
const r =
|
|
1310
|
+
const r = Bn(e, t) ?? "root-1";
|
|
1297
1311
|
return t.attributes["xml:id"] = r, r;
|
|
1298
1312
|
}
|
|
1299
1313
|
function ve(e) {
|
|
1300
1314
|
let t = 0;
|
|
1301
1315
|
for (const n of e.children)
|
|
1302
|
-
|
|
1316
|
+
me(n) && (t += 1 + ve(n));
|
|
1303
1317
|
return t;
|
|
1304
1318
|
}
|
|
1305
|
-
const
|
|
1306
|
-
function
|
|
1319
|
+
const er = "This live preview shows a single division, so links into the rest of the document do not work here.", tr = /<a\b([^>]*)>/g, nr = /\sid="([^"]*)"/g, xe = /\shref="([^"]*)"/, rr = /\\href\{([^{}]*)\}/g, We = /\stitle="([^"]*)"/;
|
|
1320
|
+
function ir(e) {
|
|
1307
1321
|
const t = /* @__PURE__ */ new Set();
|
|
1308
|
-
for (const n of e.matchAll(
|
|
1322
|
+
for (const n of e.matchAll(nr))
|
|
1309
1323
|
t.add(n[1]);
|
|
1310
1324
|
return t;
|
|
1311
1325
|
}
|
|
1312
|
-
function
|
|
1326
|
+
function Se(e) {
|
|
1313
1327
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
1314
1328
|
}
|
|
1315
|
-
function
|
|
1329
|
+
function He(e, t) {
|
|
1316
1330
|
if (e.startsWith("#") || e === "") return { kind: "keep" };
|
|
1317
1331
|
if (/^[a-z][a-z0-9+.-]*:/i.test(e) || e.startsWith("//"))
|
|
1318
1332
|
return { kind: "keep" };
|
|
@@ -1321,89 +1335,89 @@ function We(e, t) {
|
|
|
1321
1335
|
const o = e.slice(n + 1);
|
|
1322
1336
|
return t.has(o) && o !== "" ? { kind: "same-page", id: o } : { kind: "off-page", division: i, ...o ? { id: o } : {} };
|
|
1323
1337
|
}
|
|
1324
|
-
function
|
|
1325
|
-
const n = t.offPageMessage ??
|
|
1326
|
-
return e.replace(
|
|
1327
|
-
const l =
|
|
1338
|
+
function or(e, t = {}) {
|
|
1339
|
+
const n = t.offPageMessage ?? er, r = ir(e);
|
|
1340
|
+
return e.replace(tr, (o, a) => {
|
|
1341
|
+
const l = xe.exec(a);
|
|
1328
1342
|
if (!l) return o;
|
|
1329
|
-
const
|
|
1330
|
-
if (
|
|
1331
|
-
if (
|
|
1332
|
-
return `<a${a.replace(
|
|
1333
|
-
const p =
|
|
1334
|
-
return `<a${x} title="${
|
|
1335
|
-
}).replace(
|
|
1336
|
-
const l =
|
|
1343
|
+
const d = He(l[1], r);
|
|
1344
|
+
if (d.kind === "keep") return o;
|
|
1345
|
+
if (d.kind === "same-page")
|
|
1346
|
+
return `<a${a.replace(xe, ` href="#${d.id}"`)}>`;
|
|
1347
|
+
const p = We.exec(a), m = Se(n), h = p ? `${p[1]} — ${m}` : m, x = a.replace(xe, "").replace(We, ""), _ = ` data-ptx-division="${Se(d.division)}"` + (d.id ? ` data-ptx-id="${Se(d.id)}"` : "");
|
|
1348
|
+
return `<a${x} title="${h}" aria-disabled="true" style="cursor:default"${_}>`;
|
|
1349
|
+
}).replace(rr, (o, a) => {
|
|
1350
|
+
const l = He(a, r);
|
|
1337
1351
|
return l.kind === "same-page" ? `\\href{#${l.id}}` : o;
|
|
1338
1352
|
});
|
|
1339
1353
|
}
|
|
1340
|
-
function
|
|
1341
|
-
return
|
|
1354
|
+
function sr() {
|
|
1355
|
+
return Ke(fe(), "xsl");
|
|
1342
1356
|
}
|
|
1343
|
-
function
|
|
1357
|
+
function ar() {
|
|
1344
1358
|
return "Suspending" in WebAssembly;
|
|
1345
1359
|
}
|
|
1346
|
-
function
|
|
1347
|
-
if (!
|
|
1360
|
+
function cr() {
|
|
1361
|
+
if (!ar())
|
|
1348
1362
|
throw new Error(
|
|
1349
1363
|
"WebAssembly JSPI is not enabled. Run Node with --experimental-wasm-jspi (or use the pretext-html CLI, which re-launches itself with the flag)."
|
|
1350
1364
|
);
|
|
1351
1365
|
}
|
|
1352
|
-
function
|
|
1366
|
+
function ie(e) {
|
|
1353
1367
|
return e.includes("'") ? e.includes('"') ? `concat(${e.split("'").map((n) => `'${n}'`).join(`, "'", `)})` : `"${e}"` : `'${e}'`;
|
|
1354
1368
|
}
|
|
1355
|
-
function
|
|
1369
|
+
function lr(e) {
|
|
1356
1370
|
return e.replace(
|
|
1357
1371
|
/from '\.\/(https:\/\/[^']+)'/g,
|
|
1358
1372
|
(t, n) => `from '${n}'`
|
|
1359
1373
|
);
|
|
1360
1374
|
}
|
|
1361
|
-
const
|
|
1362
|
-
"cli.version":
|
|
1375
|
+
const ur = `https://cdn.jsdelivr.net/gh/PreTeXtBook/html-static@${qe}/dist/`, fr = {
|
|
1376
|
+
"cli.version": qe,
|
|
1363
1377
|
// Colon-delimited: pretext-runestone.xsl splits them with str:tokenize.
|
|
1364
|
-
"rs-js":
|
|
1365
|
-
"rs-css":
|
|
1366
|
-
"rs-version":
|
|
1378
|
+
"rs-js": Ft.join(":"),
|
|
1379
|
+
"rs-css": Wt.join(":"),
|
|
1380
|
+
"rs-version": Ut
|
|
1367
1381
|
};
|
|
1368
|
-
function
|
|
1382
|
+
function dr(e) {
|
|
1369
1383
|
return e.replace(
|
|
1370
1384
|
/(<link\b[^>]*\bhref=["'])_static\//gi,
|
|
1371
|
-
`$1${
|
|
1385
|
+
`$1${ur}_static/`
|
|
1372
1386
|
);
|
|
1373
1387
|
}
|
|
1374
|
-
function
|
|
1388
|
+
function hr(e) {
|
|
1375
1389
|
return e.slice(0, 65536).replace(/<\?[\s\S]*?\?>/g, " ").replace(/<!--[\s\S]*?-->/g, " ").replace(/<!DOCTYPE[^>]*>/gi, " ").match(/<\s*([A-Za-z][\w:-]*)/)?.[1];
|
|
1376
1390
|
}
|
|
1377
|
-
let
|
|
1378
|
-
function
|
|
1379
|
-
return
|
|
1391
|
+
let pr;
|
|
1392
|
+
function mr() {
|
|
1393
|
+
return pr ??= new Kn();
|
|
1380
1394
|
}
|
|
1381
|
-
function
|
|
1395
|
+
function xt(e) {
|
|
1382
1396
|
const t = e.files ? new Map(
|
|
1383
1397
|
Object.entries(e.files).map(([o, a]) => [
|
|
1384
|
-
|
|
1398
|
+
S(o),
|
|
1385
1399
|
a
|
|
1386
1400
|
])
|
|
1387
|
-
) : void 0, n = e.readSource, r = t || n ? async (o) => t?.get(o) ?? await n?.(o) : void 0, i = e.cache === !1 ? void 0 : e.cache ??
|
|
1401
|
+
) : void 0, n = e.readSource, r = t || n ? async (o) => t?.get(o) ?? await n?.(o) : void 0, i = e.cache === !1 ? void 0 : e.cache ?? mr();
|
|
1388
1402
|
return { readSource: r, cache: i };
|
|
1389
1403
|
}
|
|
1390
1404
|
async function $e(e, t) {
|
|
1391
|
-
const n = await
|
|
1405
|
+
const n = await we(e, t);
|
|
1392
1406
|
if (n === void 0)
|
|
1393
1407
|
throw new Error(
|
|
1394
1408
|
`Could not read ${t}. (In the browser build only absolute URLs are readable — pass sourceContent instead of relying on sourcePath.)`
|
|
1395
1409
|
);
|
|
1396
1410
|
return n;
|
|
1397
1411
|
}
|
|
1398
|
-
async function
|
|
1399
|
-
const r =
|
|
1412
|
+
async function vr(e, t, n) {
|
|
1413
|
+
const r = S(e), i = await we(n, r);
|
|
1400
1414
|
if (i !== void 0)
|
|
1401
|
-
return
|
|
1415
|
+
return Cn(i, r, t, n);
|
|
1402
1416
|
}
|
|
1403
|
-
async function
|
|
1404
|
-
const t =
|
|
1405
|
-
e.projectDir ??
|
|
1406
|
-
), i = e.sourceContent ?? await $e(t, n), o = await
|
|
1417
|
+
async function Or(e) {
|
|
1418
|
+
const t = xt(e), n = S(e.sourcePath), r = S(
|
|
1419
|
+
e.projectDir ?? K(n)
|
|
1420
|
+
), i = e.sourceContent ?? await $e(t, n), o = await Pe(
|
|
1407
1421
|
i,
|
|
1408
1422
|
n,
|
|
1409
1423
|
r,
|
|
@@ -1415,7 +1429,7 @@ async function Rr(e) {
|
|
|
1415
1429
|
files: o.files
|
|
1416
1430
|
};
|
|
1417
1431
|
}
|
|
1418
|
-
function
|
|
1432
|
+
function wr(e, t, n, r) {
|
|
1419
1433
|
const i = e.replace(/^\uFEFF/, "").replace(/<\?xml[\s\S]*?\?>/, "").replace(/<!DOCTYPE[^>]*>/i, ""), o = n === "slides" ? "slideshow" : t === "chapter" || t === "part" ? "book" : "article";
|
|
1420
1434
|
return `<pretext>
|
|
1421
1435
|
${r?.trim() ? `${r.trim()}
|
|
@@ -1426,15 +1440,15 @@ ${i}
|
|
|
1426
1440
|
</pretext>
|
|
1427
1441
|
`;
|
|
1428
1442
|
}
|
|
1429
|
-
async function
|
|
1443
|
+
async function br(e, t, n, r, i, o) {
|
|
1430
1444
|
const a = e.attributes["xml:id"];
|
|
1431
1445
|
if (!a) return;
|
|
1432
|
-
const l =
|
|
1433
|
-
if (
|
|
1434
|
-
let p,
|
|
1446
|
+
const l = S(n), d = i ?? await we(o, l);
|
|
1447
|
+
if (d === void 0) return;
|
|
1448
|
+
let p, m, h;
|
|
1435
1449
|
try {
|
|
1436
|
-
({ tree: p, files:
|
|
1437
|
-
|
|
1450
|
+
({ tree: p, files: m, bytes: h } = await Pe(
|
|
1451
|
+
d,
|
|
1438
1452
|
l,
|
|
1439
1453
|
r,
|
|
1440
1454
|
o
|
|
@@ -1442,77 +1456,77 @@ async function mr(e, t, n, r, i, o) {
|
|
|
1442
1456
|
} catch {
|
|
1443
1457
|
return;
|
|
1444
1458
|
}
|
|
1445
|
-
if (
|
|
1446
|
-
return
|
|
1459
|
+
if (ct(e, t), !!Gn(p, a, e))
|
|
1460
|
+
return m.includes(t) || m.push(t), { tree: p, divisionId: a, files: m, bytes: h };
|
|
1447
1461
|
}
|
|
1448
|
-
let
|
|
1449
|
-
function
|
|
1462
|
+
let St = !1;
|
|
1463
|
+
function gr(e) {
|
|
1450
1464
|
return e instanceof Error && /\bAborted\(/.test(e.message);
|
|
1451
1465
|
}
|
|
1452
|
-
function
|
|
1466
|
+
function yr(e) {
|
|
1453
1467
|
return e instanceof Error && /memory access|out of bounds/i.test(e.message);
|
|
1454
1468
|
}
|
|
1455
|
-
function
|
|
1456
|
-
if (
|
|
1469
|
+
function Er() {
|
|
1470
|
+
if (St)
|
|
1457
1471
|
throw new Error(
|
|
1458
1472
|
"The WebAssembly renderer aborted earlier in this process and cannot be reused. Restart the process (or reload the page) to render again."
|
|
1459
1473
|
);
|
|
1460
1474
|
}
|
|
1461
|
-
function
|
|
1462
|
-
if (
|
|
1463
|
-
throw
|
|
1475
|
+
function Ve(e) {
|
|
1476
|
+
if (gr(e))
|
|
1477
|
+
throw St = !0, new Error(
|
|
1464
1478
|
"The WebAssembly renderer aborted and cannot be reused. Restart the process (or reload the page) to render again.",
|
|
1465
1479
|
{ cause: e }
|
|
1466
1480
|
);
|
|
1467
|
-
if (
|
|
1481
|
+
if (yr(e))
|
|
1468
1482
|
throw new Error(
|
|
1469
1483
|
"The WebAssembly renderer hit a memory fault. Most often the document is too large for this build's stack — whole-book builds are a known limitation, so try a smaller document, or see the README about rebuilding libxslt-wasm with a larger stack. The same fault also results from running two renders concurrently against the shared libxslt state.",
|
|
1470
1484
|
{ cause: e }
|
|
1471
1485
|
);
|
|
1472
1486
|
}
|
|
1473
|
-
let
|
|
1474
|
-
async function
|
|
1475
|
-
return
|
|
1487
|
+
let Te;
|
|
1488
|
+
async function Tt() {
|
|
1489
|
+
return Te || (Te = (async () => {
|
|
1476
1490
|
const [e, t] = await Promise.all([
|
|
1477
1491
|
import("@pretextbook/libxslt-wasm"),
|
|
1478
1492
|
import("@pretextbook/libxslt-wasm/exslt")
|
|
1479
1493
|
]);
|
|
1480
1494
|
return t.registerAll(), e;
|
|
1481
|
-
})()),
|
|
1495
|
+
})()), Te;
|
|
1482
1496
|
}
|
|
1483
|
-
const
|
|
1497
|
+
const Ie = /* @__PURE__ */ new Map(), xr = {
|
|
1484
1498
|
html: "preview-html.xsl",
|
|
1485
1499
|
slides: "preview-revealjs.xsl"
|
|
1486
1500
|
};
|
|
1487
|
-
async function
|
|
1488
|
-
const n =
|
|
1489
|
-
let i =
|
|
1501
|
+
async function Sr(e, t) {
|
|
1502
|
+
const n = xr[t], r = `${t}\0${e}`;
|
|
1503
|
+
let i = Ie.get(r);
|
|
1490
1504
|
return i || (i = (async () => {
|
|
1491
|
-
const { XmlDocument: o, XsltStylesheet: a } = await
|
|
1492
|
-
if (
|
|
1505
|
+
const { XmlDocument: o, XsltStylesheet: a } = await Tt(), l = tt(e), d = await Ye(fe(), `/${n}`);
|
|
1506
|
+
if (d === void 0)
|
|
1493
1507
|
throw new Error(
|
|
1494
1508
|
`Could not read ${n} from ${fe()}. Check the assets location (PRETEXT_HTML_ASSETS under Node, setAssetsBase() in the browser).`
|
|
1495
1509
|
);
|
|
1496
|
-
const p = new TextDecoder().decode(
|
|
1510
|
+
const p = new TextDecoder().decode(d), m = await o.fromString(p, {
|
|
1497
1511
|
url: `${l}/${n}`,
|
|
1498
1512
|
options: { noEnt: !0, dtdLoad: !0, huge: !0 }
|
|
1499
1513
|
});
|
|
1500
|
-
return a.fromXmlDocument(
|
|
1501
|
-
})(),
|
|
1502
|
-
}
|
|
1503
|
-
let
|
|
1504
|
-
function
|
|
1505
|
-
const t =
|
|
1506
|
-
() =>
|
|
1507
|
-
() =>
|
|
1514
|
+
return a.fromXmlDocument(m);
|
|
1515
|
+
})(), Ie.set(r, i), i.catch(() => Ie.delete(r))), i;
|
|
1516
|
+
}
|
|
1517
|
+
let Xe = Promise.resolve();
|
|
1518
|
+
function Mr(e) {
|
|
1519
|
+
const t = Xe.then(
|
|
1520
|
+
() => ze(e),
|
|
1521
|
+
() => ze(e)
|
|
1508
1522
|
);
|
|
1509
|
-
return
|
|
1523
|
+
return Xe = t.catch(() => {
|
|
1510
1524
|
}), t;
|
|
1511
1525
|
}
|
|
1512
|
-
async function
|
|
1513
|
-
|
|
1514
|
-
const { XmlDocument: t } = await
|
|
1515
|
-
e.projectDir ??
|
|
1526
|
+
async function ze(e) {
|
|
1527
|
+
cr(), Er();
|
|
1528
|
+
const { XmlDocument: t } = await Tt(), n = xt(e), r = S(e.sourcePath), i = S(
|
|
1529
|
+
e.projectDir ?? K(r)
|
|
1516
1530
|
), o = e.sourceContent ?? await $e(n, r), a = ye(i, r);
|
|
1517
1531
|
if (a.startsWith(".."))
|
|
1518
1532
|
throw new Error(
|
|
@@ -1520,140 +1534,141 @@ async function Xe(e) {
|
|
|
1520
1534
|
);
|
|
1521
1535
|
const l = ye(
|
|
1522
1536
|
i,
|
|
1523
|
-
|
|
1524
|
-
),
|
|
1537
|
+
S(e.mainSourcePath ?? r)
|
|
1538
|
+
), d = l.startsWith("..") ? a : l, p = tt(i);
|
|
1525
1539
|
try {
|
|
1526
|
-
let
|
|
1540
|
+
let m, h = `${p}/__pretext-preview-publication.xml`;
|
|
1527
1541
|
if (e.publicationPath) {
|
|
1528
|
-
const s =
|
|
1529
|
-
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1542
|
+
const s = S(e.publicationPath);
|
|
1543
|
+
m = await $e(n, s);
|
|
1544
|
+
const u = ye(i, s);
|
|
1545
|
+
u.startsWith("..") || (h = `${p}/${u.split(Ae).join("/")}`);
|
|
1532
1546
|
}
|
|
1533
|
-
const
|
|
1547
|
+
const T = await Pe(
|
|
1534
1548
|
o,
|
|
1535
1549
|
r,
|
|
1536
1550
|
i,
|
|
1537
1551
|
n
|
|
1538
1552
|
);
|
|
1539
|
-
let x =
|
|
1540
|
-
const
|
|
1553
|
+
let x = T.tree, _ = T.content, I = T.files, F = T.bytes;
|
|
1554
|
+
const M = e.target ?? jn(_), Y = await Sr(e.xslDir ?? sr(), M), B = rt(m, {
|
|
1541
1555
|
cssTheme: e.cssTheme,
|
|
1542
1556
|
revealTheme: e.revealTheme,
|
|
1543
|
-
target:
|
|
1557
|
+
target: M
|
|
1544
1558
|
});
|
|
1545
|
-
|
|
1546
|
-
const g =
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
(
|
|
1559
|
-
).map((y) => gt(s, y)) : [], m = Xn(s, f, {
|
|
1560
|
-
collapseChildren: u?.collapse,
|
|
1561
|
-
...wn(O)
|
|
1559
|
+
Qt(h, B);
|
|
1560
|
+
const g = hr(_);
|
|
1561
|
+
let N = { parentId: "root", position: 1 }, E, j = r, C, $;
|
|
1562
|
+
const se = (s, u) => {
|
|
1563
|
+
C = { bytes: F, elements: ve(s), files: I };
|
|
1564
|
+
const f = e.subtree ? Qn(s, e.subtree, r) : void 0, b = f?.id ?? u;
|
|
1565
|
+
if (!b) return !1;
|
|
1566
|
+
const w = e.subtree?.wholeDocumentUpTo;
|
|
1567
|
+
if (w !== void 0 && C.elements <= w) return !1;
|
|
1568
|
+
const v = f?.collapse && f.element ? f.element.children.filter(
|
|
1569
|
+
(k) => k.type === "element" && be(k)
|
|
1570
|
+
).map((k) => Et(s, k)) : [], y = Jn(s, b, {
|
|
1571
|
+
collapseChildren: f?.collapse,
|
|
1572
|
+
...gn(B)
|
|
1562
1573
|
});
|
|
1563
|
-
return
|
|
1564
|
-
id:
|
|
1565
|
-
level:
|
|
1566
|
-
collapsed:
|
|
1567
|
-
children:
|
|
1574
|
+
return y ? (_ = y.content, E = {
|
|
1575
|
+
id: y.divisionId,
|
|
1576
|
+
level: y.level,
|
|
1577
|
+
collapsed: y.collapsed,
|
|
1578
|
+
children: y.collapsed ? v : []
|
|
1568
1579
|
}, !0) : !1;
|
|
1569
1580
|
};
|
|
1570
|
-
if (
|
|
1581
|
+
if (g !== "pretext" && g !== "mathbook") {
|
|
1571
1582
|
if (!e.fragment)
|
|
1572
1583
|
throw new Error(
|
|
1573
|
-
`The document root is <${
|
|
1584
|
+
`The document root is <${g ?? "?"}>, not <pretext> — this looks like an xi:included fragment. Render the project's main source file instead, or pass the fragment option.`
|
|
1574
1585
|
);
|
|
1575
1586
|
let s = !1;
|
|
1576
1587
|
if (e.contextSourcePath || e.contextSourceContent) {
|
|
1577
|
-
const
|
|
1578
|
-
(
|
|
1579
|
-
),
|
|
1580
|
-
|
|
1588
|
+
const u = e.contextSourcePath ?? It(K(r), "__pretext-preview-context.ptx"), f = x.children.find(
|
|
1589
|
+
(w) => w.type === "element"
|
|
1590
|
+
), b = f ? await br(
|
|
1591
|
+
f,
|
|
1581
1592
|
r,
|
|
1582
|
-
|
|
1593
|
+
u,
|
|
1583
1594
|
i,
|
|
1584
1595
|
e.contextSourceContent,
|
|
1585
1596
|
n
|
|
1586
1597
|
) : void 0;
|
|
1587
|
-
|
|
1598
|
+
b && (s = !0, x = b.tree, $ = ue(x), I = b.files, F = b.bytes, j = S(u), se(x, b.divisionId) || (_ = te(x)));
|
|
1588
1599
|
}
|
|
1589
1600
|
if (!s) {
|
|
1590
|
-
const
|
|
1601
|
+
const u = e.docinfo ?? (e.docinfoSourcePath ? await vr(
|
|
1591
1602
|
e.docinfoSourcePath,
|
|
1592
1603
|
i,
|
|
1593
1604
|
n
|
|
1594
1605
|
) : void 0);
|
|
1595
|
-
_ =
|
|
1606
|
+
_ = wr(
|
|
1596
1607
|
_,
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
),
|
|
1608
|
+
g,
|
|
1609
|
+
M,
|
|
1610
|
+
u
|
|
1611
|
+
), $ = u === void 0 ? void 0 : ue(u), N = { parentId: u?.trim() ? "root-1-2" : "root-1-1", position: 2 };
|
|
1601
1612
|
}
|
|
1602
|
-
} else
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1613
|
+
} else
|
|
1614
|
+
$ = ue(x), e.subtree && se(x);
|
|
1615
|
+
C ??= { bytes: F, elements: ve(x), files: I };
|
|
1616
|
+
const q = yn(B, $), ae = K(S(i, d)), ge = {
|
|
1617
|
+
generated: S(ae, q.generated),
|
|
1618
|
+
...q.external !== void 0 ? { external: S(ae, q.external) } : {}
|
|
1619
|
+
}, re = e.sourceMap ? Mn(x, j, N) : void 0, Z = await t.fromString(_, {
|
|
1620
|
+
url: `${p}/${d.split(Ae).join("/")}`,
|
|
1606
1621
|
options: { noEnt: !0, dtdLoad: !0, huge: !0 }
|
|
1607
|
-
}),
|
|
1608
|
-
publisher:
|
|
1622
|
+
}), H = {
|
|
1623
|
+
publisher: ie(h)
|
|
1609
1624
|
};
|
|
1610
|
-
for (const [s,
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
String(
|
|
1625
|
+
for (const [s, u] of Object.entries(fr))
|
|
1626
|
+
H[s] = ie(u);
|
|
1627
|
+
E && (H.subtree = ie(E.id), H["subtree-level"] = ie(
|
|
1628
|
+
String(E.level + (E.collapsed ? 1 : 0))
|
|
1614
1629
|
));
|
|
1615
|
-
for (const [s,
|
|
1616
|
-
|
|
1617
|
-
let
|
|
1630
|
+
for (const [s, u] of Object.entries(e.stringParams ?? {}))
|
|
1631
|
+
H[s] = ie(u);
|
|
1632
|
+
let c;
|
|
1618
1633
|
try {
|
|
1619
|
-
|
|
1634
|
+
c = await Y.apply(Z, H);
|
|
1620
1635
|
} catch (s) {
|
|
1621
|
-
throw
|
|
1636
|
+
throw Ve(s), new Error(
|
|
1622
1637
|
"PreTeXt XSLT transform failed; see the PTX:ERROR/PTX:FATAL messages on stderr for details.",
|
|
1623
1638
|
{ cause: s }
|
|
1624
1639
|
);
|
|
1625
1640
|
} finally {
|
|
1626
|
-
|
|
1641
|
+
Z.delete();
|
|
1627
1642
|
}
|
|
1628
1643
|
try {
|
|
1629
|
-
let s =
|
|
1630
|
-
s =
|
|
1644
|
+
let s = lr(c.toHtmlString());
|
|
1645
|
+
s = or(s, {
|
|
1631
1646
|
...e.offPageMessage !== void 0 ? { offPageMessage: e.offPageMessage } : {}
|
|
1632
|
-
}), (e.openKnowls ?? !0) && (s =
|
|
1647
|
+
}), (e.openKnowls ?? !0) && (s = Gt(s)), M === "slides" ? (s = dr(s), s = Pn(s, e.revealView ?? "scroll", {
|
|
1633
1648
|
zoom: e.revealZoom
|
|
1634
|
-
})) : e.theme && (s =
|
|
1635
|
-
const
|
|
1636
|
-
return e.printPreview && (s =
|
|
1649
|
+
})) : e.theme && (s = Fn(s, e.theme)), e.previewBanner && (s = Ct(s, e.previewBanner));
|
|
1650
|
+
const u = M === "slides" ? [] : nt(s), f = on(u, g);
|
|
1651
|
+
return e.printPreview && (s = dn(s, e.printPreview)), {
|
|
1637
1652
|
html: s,
|
|
1638
|
-
target:
|
|
1639
|
-
printouts:
|
|
1640
|
-
size:
|
|
1641
|
-
|
|
1642
|
-
...
|
|
1643
|
-
...
|
|
1644
|
-
...
|
|
1653
|
+
target: M,
|
|
1654
|
+
printouts: u,
|
|
1655
|
+
size: C,
|
|
1656
|
+
assetDirs: ge,
|
|
1657
|
+
...E ? { subtree: E } : {},
|
|
1658
|
+
...re ? { sourceMap: re } : {},
|
|
1659
|
+
...f ? { rootPrintout: f } : {}
|
|
1645
1660
|
};
|
|
1646
1661
|
} catch (s) {
|
|
1647
|
-
throw
|
|
1662
|
+
throw Ve(s), s;
|
|
1648
1663
|
} finally {
|
|
1649
|
-
|
|
1664
|
+
c.delete();
|
|
1650
1665
|
}
|
|
1651
1666
|
} finally {
|
|
1652
|
-
|
|
1667
|
+
Zt(p);
|
|
1653
1668
|
}
|
|
1654
1669
|
}
|
|
1655
|
-
const
|
|
1656
|
-
function
|
|
1670
|
+
const Tr = "__ptxLivePatch";
|
|
1671
|
+
function Ir(e, t, n) {
|
|
1657
1672
|
const r = "script, #latex-macros, [data-component], .ptx-runestone-container", i = /* @__PURE__ */ new Set([
|
|
1658
1673
|
"BODY",
|
|
1659
1674
|
"MAIN",
|
|
@@ -1712,257 +1727,257 @@ function xr(e, t, n) {
|
|
|
1712
1727
|
"U",
|
|
1713
1728
|
"VAR",
|
|
1714
1729
|
"WBR"
|
|
1715
|
-
]), a = ["clipboardable"], l = 25e4,
|
|
1716
|
-
function
|
|
1717
|
-
return { bail:
|
|
1730
|
+
]), a = ["clipboardable"], l = 25e4, d = 3, p = [], m = /* @__PURE__ */ new Map();
|
|
1731
|
+
function h(c) {
|
|
1732
|
+
return { bail: c };
|
|
1718
1733
|
}
|
|
1719
|
-
function
|
|
1720
|
-
return typeof
|
|
1734
|
+
function T(c) {
|
|
1735
|
+
return typeof c == "object" && c !== null && typeof c.bail == "string";
|
|
1721
1736
|
}
|
|
1722
|
-
function x(
|
|
1723
|
-
return
|
|
1737
|
+
function x(c) {
|
|
1738
|
+
return c.matches(r) || c.querySelector(r) !== null;
|
|
1724
1739
|
}
|
|
1725
|
-
function _(
|
|
1726
|
-
return
|
|
1740
|
+
function _(c) {
|
|
1741
|
+
return c.tagName === "SCRIPT" && !c.hasAttribute("src") && (c.textContent ?? "").indexOf("ptx_lunr_docs") !== -1;
|
|
1727
1742
|
}
|
|
1728
|
-
function
|
|
1729
|
-
if (!i.has(
|
|
1730
|
-
|
|
1743
|
+
function I(c) {
|
|
1744
|
+
if (!i.has(c.tagName) || c.matches(".process-math") || // Never looked inside: a change anywhere in one is a change to it.
|
|
1745
|
+
c.matches(r))
|
|
1731
1746
|
return !1;
|
|
1732
|
-
for (const
|
|
1733
|
-
if (
|
|
1747
|
+
for (const s of Array.from(c.childNodes))
|
|
1748
|
+
if (s.nodeType === d && /\S/.test(s.nodeValue ?? ""))
|
|
1734
1749
|
return !1;
|
|
1735
|
-
if (
|
|
1736
|
-
for (const
|
|
1737
|
-
if (o.has(
|
|
1750
|
+
if (c.tagName === "DIV" || c.tagName === "LI") {
|
|
1751
|
+
for (const s of Array.from(c.children))
|
|
1752
|
+
if (o.has(s.tagName.toUpperCase()))
|
|
1738
1753
|
return !1;
|
|
1739
1754
|
}
|
|
1740
1755
|
return !0;
|
|
1741
1756
|
}
|
|
1742
|
-
function F(
|
|
1743
|
-
return a.indexOf(
|
|
1757
|
+
function F(c) {
|
|
1758
|
+
return a.indexOf(c) !== -1;
|
|
1744
1759
|
}
|
|
1745
|
-
function
|
|
1746
|
-
if (
|
|
1760
|
+
function M(c, s) {
|
|
1761
|
+
if (c.tagName !== s.tagName)
|
|
1747
1762
|
return !1;
|
|
1748
|
-
const u =
|
|
1749
|
-
if (u !== null &&
|
|
1763
|
+
const u = s.getAttribute("id");
|
|
1764
|
+
if (u !== null && c.getAttribute("id") !== u)
|
|
1750
1765
|
return !1;
|
|
1751
|
-
for (const f of Array.from(
|
|
1766
|
+
for (const f of Array.from(s.classList))
|
|
1752
1767
|
if (!F(f))
|
|
1753
|
-
return
|
|
1768
|
+
return c.classList.contains(f);
|
|
1754
1769
|
return !0;
|
|
1755
1770
|
}
|
|
1756
|
-
function
|
|
1757
|
-
const u = Array.from(
|
|
1771
|
+
function Y(c, s) {
|
|
1772
|
+
const u = Array.from(c.children), f = [];
|
|
1758
1773
|
let b = 0;
|
|
1759
|
-
for (const
|
|
1760
|
-
let
|
|
1761
|
-
for (; !
|
|
1774
|
+
for (const w of s) {
|
|
1775
|
+
let v = null;
|
|
1776
|
+
for (; !v && b < u.length; ) {
|
|
1762
1777
|
const y = u[b++];
|
|
1763
|
-
|
|
1778
|
+
M(y, w) ? v = { inner: y, outer: y } : y.tagName === "DIV" && a.some((k) => y.classList.contains(k)) && y.firstElementChild && M(y.firstElementChild, w) && (v = { inner: y.firstElementChild, outer: y });
|
|
1764
1779
|
}
|
|
1765
|
-
if (!
|
|
1780
|
+
if (!v)
|
|
1766
1781
|
return null;
|
|
1767
|
-
f.push(
|
|
1782
|
+
f.push(v);
|
|
1768
1783
|
}
|
|
1769
1784
|
return f;
|
|
1770
1785
|
}
|
|
1771
|
-
function
|
|
1772
|
-
if (
|
|
1786
|
+
function B(c, s) {
|
|
1787
|
+
if (c.attributes.length !== s.attributes.length)
|
|
1773
1788
|
return !1;
|
|
1774
|
-
for (const u of Array.from(
|
|
1775
|
-
if (
|
|
1789
|
+
for (const u of Array.from(c.attributes))
|
|
1790
|
+
if (s.getAttributeNS(u.namespaceURI, u.localName) !== u.value)
|
|
1776
1791
|
return !1;
|
|
1777
1792
|
return !0;
|
|
1778
1793
|
}
|
|
1779
|
-
function g(
|
|
1780
|
-
return
|
|
1794
|
+
function g(c) {
|
|
1795
|
+
return c.outerHTML.replace(/<([A-Za-z][^\s/>]*)\s[^>]*>/g, "<$1>");
|
|
1781
1796
|
}
|
|
1782
|
-
function
|
|
1783
|
-
let
|
|
1784
|
-
return
|
|
1797
|
+
function N(c) {
|
|
1798
|
+
let s = m.get(c);
|
|
1799
|
+
return s === void 0 && (s = c.outerHTML.replace(/<span class="codenumber">[^<]*<\/span>/g, "").replace(/<([A-Za-z][^\s/>]*)\s[^>]*>/g, "<$1>"), m.set(c, s)), s;
|
|
1785
1800
|
}
|
|
1786
|
-
function
|
|
1787
|
-
const
|
|
1788
|
-
const U =
|
|
1789
|
-
let
|
|
1790
|
-
return
|
|
1791
|
-
}, y =
|
|
1792
|
-
for (let
|
|
1793
|
-
for (let U =
|
|
1794
|
-
|
|
1801
|
+
function E(c, s, u, f, b) {
|
|
1802
|
+
const w = /* @__PURE__ */ new Map(), v = (W) => {
|
|
1803
|
+
const U = N(W);
|
|
1804
|
+
let ce = w.get(U);
|
|
1805
|
+
return ce === void 0 && (ce = w.size, w.set(U, ce)), ce;
|
|
1806
|
+
}, y = c.slice(u, f).map(v), k = s.slice(u, b).map(v), D = y.length, L = k.length, A = L + 1, P = new Uint32Array((D + 1) * A);
|
|
1807
|
+
for (let W = D - 1; W >= 0; W--)
|
|
1808
|
+
for (let U = L - 1; U >= 0; U--)
|
|
1809
|
+
P[W * A + U] = y[W] === k[U] ? P[(W + 1) * A + U + 1] + 1 : Math.max(P[(W + 1) * A + U], P[W * A + U + 1]);
|
|
1795
1810
|
const V = [];
|
|
1796
|
-
let G = 0,
|
|
1797
|
-
for (; G <
|
|
1798
|
-
y[G] ===
|
|
1811
|
+
let G = 0, J = 0;
|
|
1812
|
+
for (; G < D && J < L; )
|
|
1813
|
+
y[G] === k[J] ? (V.push([u + G, u + J]), G++, J++) : P[(G + 1) * A + J] >= P[G * A + J + 1] ? G++ : J++;
|
|
1799
1814
|
return V;
|
|
1800
1815
|
}
|
|
1801
|
-
function
|
|
1802
|
-
const u =
|
|
1816
|
+
function j(c, s) {
|
|
1817
|
+
const u = s.map(() => -1);
|
|
1803
1818
|
let f = 0;
|
|
1804
|
-
for (; f <
|
|
1819
|
+
for (; f < c.length && f < s.length && c[f].isEqualNode(s[f]); )
|
|
1805
1820
|
u[f] = f, f++;
|
|
1806
|
-
let b =
|
|
1807
|
-
for (; b > f &&
|
|
1808
|
-
b--,
|
|
1809
|
-
const
|
|
1810
|
-
if (
|
|
1821
|
+
let b = c.length, w = s.length;
|
|
1822
|
+
for (; b > f && w > f && c[b - 1].isEqualNode(s[w - 1]); )
|
|
1823
|
+
b--, w--, u[w] = b;
|
|
1824
|
+
const v = b - f, y = w - f;
|
|
1825
|
+
if (v === 0 || y === 0)
|
|
1811
1826
|
return u;
|
|
1812
|
-
const
|
|
1813
|
-
|
|
1814
|
-
let
|
|
1815
|
-
for (const [A,
|
|
1816
|
-
for (;
|
|
1817
|
-
if (
|
|
1818
|
-
u[
|
|
1827
|
+
const k = (v > 1 || y > 1) && v * y <= l ? E(c, s, f, b, w) : [];
|
|
1828
|
+
k.push([b, w]);
|
|
1829
|
+
let D = f, L = f;
|
|
1830
|
+
for (const [A, P] of k) {
|
|
1831
|
+
for (; D < A && L < P; ) {
|
|
1832
|
+
if (c[D].tagName === s[L].tagName) {
|
|
1833
|
+
u[L++] = D++;
|
|
1819
1834
|
continue;
|
|
1820
1835
|
}
|
|
1821
|
-
let V =
|
|
1822
|
-
for (; V < A &&
|
|
1836
|
+
let V = D + 1;
|
|
1837
|
+
for (; V < A && c[V].tagName !== s[L].tagName; )
|
|
1823
1838
|
V++;
|
|
1824
|
-
V < A ?
|
|
1839
|
+
V < A ? D = V : L++;
|
|
1825
1840
|
}
|
|
1826
|
-
A < b && (u[
|
|
1841
|
+
A < b && (u[P] = A), D = A + 1, L = P + 1;
|
|
1827
1842
|
}
|
|
1828
1843
|
return u;
|
|
1829
1844
|
}
|
|
1830
|
-
function
|
|
1831
|
-
if (x(
|
|
1832
|
-
throw
|
|
1833
|
-
return { next:
|
|
1845
|
+
function C(c, s) {
|
|
1846
|
+
if (x(c) || x(s))
|
|
1847
|
+
throw h(`<${s.tagName.toLowerCase()}> needs a full page load`);
|
|
1848
|
+
return { next: s, replace: !0 };
|
|
1834
1849
|
}
|
|
1835
|
-
function
|
|
1836
|
-
|
|
1837
|
-
const f = Array.from(
|
|
1850
|
+
function $(c, s, u) {
|
|
1851
|
+
B(s, u) || p.push({ live: c, old: s, next: u });
|
|
1852
|
+
const f = Array.from(s.children), b = Array.from(u.children);
|
|
1838
1853
|
if (f.length !== b.length)
|
|
1839
1854
|
return !1;
|
|
1840
|
-
let
|
|
1841
|
-
for (let
|
|
1842
|
-
if (!f[
|
|
1855
|
+
let w = null;
|
|
1856
|
+
for (let v = 0; v < f.length; v++)
|
|
1857
|
+
if (!f[v].isEqualNode(b[v]) && (w = w ?? Y(c, f), !w || !$(w[v].inner, f[v], b[v])))
|
|
1843
1858
|
return !1;
|
|
1844
1859
|
return !0;
|
|
1845
1860
|
}
|
|
1846
|
-
function se(
|
|
1847
|
-
if (
|
|
1848
|
-
return { next: u, outer:
|
|
1849
|
-
if (
|
|
1850
|
-
const f =
|
|
1861
|
+
function se(c, s, u) {
|
|
1862
|
+
if (s.isEqualNode(u) || _(s) && _(u))
|
|
1863
|
+
return { next: u, outer: c.outer };
|
|
1864
|
+
if (s.tagName === u.tagName && I(s) && I(u)) {
|
|
1865
|
+
const f = q(c.inner, s, u);
|
|
1851
1866
|
if (f)
|
|
1852
|
-
return
|
|
1853
|
-
} else if (g(
|
|
1867
|
+
return B(s, u) || p.push({ live: c.inner, old: s, next: u }), { next: u, outer: c.outer, sub: f };
|
|
1868
|
+
} else if (g(s) === g(u)) {
|
|
1854
1869
|
const f = p.length;
|
|
1855
|
-
if (
|
|
1856
|
-
if (x(
|
|
1857
|
-
throw
|
|
1870
|
+
if ($(c.inner, s, u)) {
|
|
1871
|
+
if (x(s))
|
|
1872
|
+
throw h(
|
|
1858
1873
|
"attributes changed inside an element that needs a full page load"
|
|
1859
1874
|
);
|
|
1860
|
-
return { next: u, outer:
|
|
1875
|
+
return { next: u, outer: c.outer };
|
|
1861
1876
|
}
|
|
1862
1877
|
p.length = f;
|
|
1863
1878
|
}
|
|
1864
|
-
return { ...
|
|
1879
|
+
return { ...C(s, u), outer: c.outer };
|
|
1865
1880
|
}
|
|
1866
|
-
function
|
|
1867
|
-
const f = Array.from(
|
|
1868
|
-
if (!
|
|
1881
|
+
function q(c, s, u) {
|
|
1882
|
+
const f = Array.from(s.children), b = Array.from(u.children), w = Y(c, f);
|
|
1883
|
+
if (!w)
|
|
1869
1884
|
return null;
|
|
1870
|
-
const
|
|
1871
|
-
b.forEach((
|
|
1872
|
-
const
|
|
1873
|
-
if (
|
|
1874
|
-
if (x(
|
|
1875
|
-
throw
|
|
1876
|
-
`new <${
|
|
1885
|
+
const v = j(f, b), y = f.map(() => !1), k = [];
|
|
1886
|
+
b.forEach((L, A) => {
|
|
1887
|
+
const P = v[A];
|
|
1888
|
+
if (P === -1) {
|
|
1889
|
+
if (x(L))
|
|
1890
|
+
throw h(
|
|
1891
|
+
`new <${L.tagName.toLowerCase()}> needs a full page load`
|
|
1877
1892
|
);
|
|
1878
|
-
|
|
1893
|
+
k.push({ next: L });
|
|
1879
1894
|
return;
|
|
1880
1895
|
}
|
|
1881
|
-
y[
|
|
1896
|
+
y[P] = !0, k.push(se(w[P], f[P], L));
|
|
1882
1897
|
});
|
|
1883
|
-
const
|
|
1884
|
-
return f.forEach((
|
|
1898
|
+
const D = [];
|
|
1899
|
+
return f.forEach((L, A) => {
|
|
1885
1900
|
if (!y[A]) {
|
|
1886
|
-
if (x(
|
|
1887
|
-
throw
|
|
1888
|
-
`removing <${
|
|
1901
|
+
if (x(L))
|
|
1902
|
+
throw h(
|
|
1903
|
+
`removing <${L.tagName.toLowerCase()}> needs a full page load`
|
|
1889
1904
|
);
|
|
1890
|
-
|
|
1905
|
+
D.push(w[A].outer);
|
|
1891
1906
|
}
|
|
1892
1907
|
}), {
|
|
1893
|
-
live:
|
|
1894
|
-
first:
|
|
1895
|
-
items:
|
|
1896
|
-
removed:
|
|
1908
|
+
live: c,
|
|
1909
|
+
first: w.length ? w[0].outer : null,
|
|
1910
|
+
items: k,
|
|
1911
|
+
removed: D
|
|
1897
1912
|
};
|
|
1898
1913
|
}
|
|
1899
1914
|
function ae() {
|
|
1900
|
-
const
|
|
1901
|
-
if (
|
|
1902
|
-
throw
|
|
1915
|
+
const c = Array.from(t.head.children), s = Array.from(n.head.children);
|
|
1916
|
+
if (c.length !== s.length)
|
|
1917
|
+
throw h("the page head changed");
|
|
1903
1918
|
let u = null;
|
|
1904
|
-
for (let f = 0; f <
|
|
1905
|
-
const b =
|
|
1906
|
-
if (!b.isEqualNode(
|
|
1907
|
-
if (b.tagName === "TITLE" &&
|
|
1908
|
-
u =
|
|
1909
|
-
else if (b.tagName !== "META" ||
|
|
1910
|
-
throw
|
|
1919
|
+
for (let f = 0; f < c.length; f++) {
|
|
1920
|
+
const b = c[f], w = s[f];
|
|
1921
|
+
if (!b.isEqualNode(w)) {
|
|
1922
|
+
if (b.tagName === "TITLE" && w.tagName === "TITLE")
|
|
1923
|
+
u = w.textContent ?? "";
|
|
1924
|
+
else if (b.tagName !== "META" || w.tagName !== "META")
|
|
1925
|
+
throw h("the page head changed");
|
|
1911
1926
|
}
|
|
1912
1927
|
}
|
|
1913
1928
|
return u;
|
|
1914
1929
|
}
|
|
1915
|
-
function
|
|
1916
|
-
const { live:
|
|
1917
|
-
for (const
|
|
1918
|
-
|
|
1919
|
-
for (const
|
|
1920
|
-
|
|
1921
|
-
const b = Array.from(u.classList),
|
|
1922
|
-
for (const
|
|
1923
|
-
|
|
1924
|
-
for (const
|
|
1925
|
-
b.indexOf(
|
|
1930
|
+
function ge(c) {
|
|
1931
|
+
const { live: s, old: u, next: f } = c;
|
|
1932
|
+
for (const v of Array.from(u.attributes))
|
|
1933
|
+
v.name !== "class" && !f.hasAttributeNS(v.namespaceURI, v.localName) && s.removeAttributeNS(v.namespaceURI, v.localName);
|
|
1934
|
+
for (const v of Array.from(f.attributes))
|
|
1935
|
+
v.name !== "class" && u.getAttributeNS(v.namespaceURI, v.localName) !== v.value && s.setAttributeNS(v.namespaceURI, v.name, v.value);
|
|
1936
|
+
const b = Array.from(u.classList), w = Array.from(f.classList);
|
|
1937
|
+
for (const v of b)
|
|
1938
|
+
w.indexOf(v) === -1 && s.classList.remove(v);
|
|
1939
|
+
for (const v of w)
|
|
1940
|
+
b.indexOf(v) === -1 && s.classList.add(v);
|
|
1926
1941
|
}
|
|
1927
|
-
const
|
|
1928
|
-
function
|
|
1929
|
-
let
|
|
1930
|
-
for (const u of
|
|
1942
|
+
const re = [], Z = [];
|
|
1943
|
+
function H(c) {
|
|
1944
|
+
let s = null;
|
|
1945
|
+
for (const u of c.items) {
|
|
1931
1946
|
if (!u.outer || u.replace) {
|
|
1932
1947
|
const f = e.importNode(u.next, !0);
|
|
1933
|
-
u.outer ? (u.outer.replaceWith(f),
|
|
1948
|
+
u.outer ? (u.outer.replaceWith(f), Z.push(u.outer)) : s ? s.after(f) : c.first ? c.first.before(f) : c.live.appendChild(f), re.push(f), s = f;
|
|
1934
1949
|
continue;
|
|
1935
1950
|
}
|
|
1936
|
-
u.sub &&
|
|
1951
|
+
u.sub && H(u.sub), s = u.outer;
|
|
1937
1952
|
}
|
|
1938
|
-
for (const u of
|
|
1939
|
-
u.remove(),
|
|
1953
|
+
for (const u of c.removed)
|
|
1954
|
+
u.remove(), Z.push(u);
|
|
1940
1955
|
}
|
|
1941
1956
|
try {
|
|
1942
|
-
const
|
|
1957
|
+
const c = ae(), s = {
|
|
1943
1958
|
live: e.documentElement,
|
|
1944
1959
|
old: t.documentElement,
|
|
1945
1960
|
next: n.documentElement
|
|
1946
1961
|
};
|
|
1947
|
-
if (
|
|
1948
|
-
throw
|
|
1949
|
-
const u =
|
|
1962
|
+
if (B(s.old, s.next) || p.push(s), !e.body || !I(t.body) || !I(n.body))
|
|
1963
|
+
throw h("the page body is not patchable");
|
|
1964
|
+
const u = q(e.body, t.body, n.body);
|
|
1950
1965
|
if (!u)
|
|
1951
|
-
throw
|
|
1952
|
-
return
|
|
1953
|
-
} catch (
|
|
1954
|
-
if (
|
|
1966
|
+
throw h("the live page no longer matches the previous render");
|
|
1967
|
+
return B(t.body, n.body) || p.push({ live: e.body, old: t.body, next: n.body }), p.forEach(ge), H(u), c !== null && e.title !== c && (e.title = c), { ok: !0, added: re, removed: Z, attributeUpdates: p.length };
|
|
1968
|
+
} catch (c) {
|
|
1969
|
+
if (T(c))
|
|
1955
1970
|
return {
|
|
1956
1971
|
ok: !1,
|
|
1957
|
-
reason:
|
|
1972
|
+
reason: c.bail,
|
|
1958
1973
|
added: [],
|
|
1959
1974
|
removed: [],
|
|
1960
1975
|
attributeUpdates: 0
|
|
1961
1976
|
};
|
|
1962
|
-
throw
|
|
1977
|
+
throw c;
|
|
1963
1978
|
}
|
|
1964
1979
|
}
|
|
1965
|
-
function
|
|
1980
|
+
function Ar(e, t) {
|
|
1966
1981
|
const n = e.MathJax, r = n && n.startup;
|
|
1967
1982
|
if (!n || !r || !r.promise || typeof n.typesetPromise != "function")
|
|
1968
1983
|
return Promise.resolve();
|
|
@@ -1981,49 +1996,50 @@ function Sr(e, t) {
|
|
|
1981
1996
|
);
|
|
1982
1997
|
return r.promise = a, a;
|
|
1983
1998
|
}
|
|
1984
|
-
function
|
|
1999
|
+
function Br() {
|
|
1985
2000
|
return [
|
|
1986
2001
|
"<script>",
|
|
1987
|
-
`window[${JSON.stringify(
|
|
1988
|
-
` patchDocument: ${
|
|
1989
|
-
` typeset: ${
|
|
2002
|
+
`window[${JSON.stringify(Tr)}] = {`,
|
|
2003
|
+
` patchDocument: ${Ir.toString()},`,
|
|
2004
|
+
` typeset: ${Ar.toString()}`,
|
|
1990
2005
|
"};",
|
|
1991
2006
|
"<\/script>"
|
|
1992
2007
|
].join(`
|
|
1993
2008
|
`);
|
|
1994
2009
|
}
|
|
1995
2010
|
export {
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2011
|
+
Tr as LIVE_PATCH_GLOBAL,
|
|
2012
|
+
At as PREVIEW_BANNER_STORAGE_KEY,
|
|
2013
|
+
pt as PREVIEW_THEME_MESSAGE,
|
|
2014
|
+
sn as PRINT_PREVIEW_GLOBAL,
|
|
2015
|
+
Kn as SourceCache,
|
|
2016
|
+
mr as defaultSourceCache,
|
|
2017
|
+
sr as defaultXslDir,
|
|
2018
|
+
jn as detectRenderTarget,
|
|
2019
|
+
Pr as findSourceMapEntry,
|
|
2020
|
+
Nr as forcePortablePublication,
|
|
2021
|
+
rt as forcePreviewPublication,
|
|
2022
|
+
Ct as injectPreviewBanner,
|
|
2023
|
+
dn as injectPrintPreview,
|
|
2024
|
+
Pn as injectRevealBridge,
|
|
2025
|
+
Fn as injectThemeBridge,
|
|
2026
|
+
ar as isJspiAvailable,
|
|
2027
|
+
Cr as isPreviewTheme,
|
|
2028
|
+
Rr as isRevealView,
|
|
2029
|
+
nt as listPrintouts,
|
|
2030
|
+
Br as livePatchScript,
|
|
2031
|
+
Or as measureDocument,
|
|
2032
|
+
Gt as openBornHiddenKnowls,
|
|
2033
|
+
Ir as patchDocument,
|
|
2034
|
+
kt as previewBannerScript,
|
|
2035
|
+
Dr as previewThemeMessage,
|
|
2036
|
+
an as printPreviewBridgeScript,
|
|
2037
|
+
Mr as renderHtml,
|
|
2038
|
+
_n as revealBridgeScript,
|
|
2039
|
+
on as rootPrintoutId,
|
|
2040
|
+
$r as setAssetsBase,
|
|
2041
|
+
kr as setMountReader,
|
|
2042
|
+
Un as themeBridgeScript,
|
|
2043
|
+
Ar as typesetPatch,
|
|
2044
|
+
ie as xpathStringLiteral
|
|
2029
2045
|
};
|