@pretextbook/pretext-html 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +106 -10
  2. package/assets/preview-html.xsl +8 -4
  3. package/assets/preview-revealjs.xsl +85 -0
  4. package/assets/upstream.json +1 -1
  5. package/assets/xsl/LICENSE-pretext +16 -0
  6. package/assets/xsl/README.md +25 -24
  7. package/assets/xsl/entities.ent +27 -0
  8. package/assets/xsl/extract-biblio-csl.xsl +6 -4
  9. package/assets/xsl/extract-dynamic.xsl +14 -12
  10. package/assets/xsl/extract-interactive.xsl +2 -2
  11. package/assets/xsl/extract-pg.xsl +123 -306
  12. package/assets/xsl/extract-qrcode.xsl +12 -2
  13. package/assets/xsl/extract-sageplot.xsl +1 -1
  14. package/assets/xsl/extract-trace.xsl +3 -3
  15. package/assets/xsl/extract-youtube.xsl +1 -1
  16. package/assets/xsl/latex/pretext-latex-texstyle.xsl +4 -5
  17. package/assets/xsl/localizations/README.md +24 -24
  18. package/assets/xsl/pretext-assembly.xsl +463 -368
  19. package/assets/xsl/pretext-beamer.xsl +43 -146
  20. package/assets/xsl/pretext-braille-preprint.xsl +458 -202
  21. package/assets/xsl/pretext-common.xsl +486 -510
  22. package/assets/xsl/pretext-epub.xsl +318 -78
  23. package/assets/xsl/pretext-fo.xsl +80 -96
  24. package/assets/xsl/pretext-html.xsl +413 -318
  25. package/assets/xsl/pretext-jupyter.xsl +534 -322
  26. package/assets/xsl/pretext-latex-classic.xsl +14 -15
  27. package/assets/xsl/pretext-latex-common.xsl +393 -2397
  28. package/assets/xsl/pretext-latex.xsl +1995 -5
  29. package/assets/xsl/pretext-markdown.xsl +919 -0
  30. package/assets/xsl/pretext-numbers.xsl +57 -39
  31. package/assets/xsl/pretext-revealjs.xsl +241 -33
  32. package/assets/xsl/pretext-runestone-fitb.xsl +34 -35
  33. package/assets/xsl/pretext-runestone-static.xsl +17 -17
  34. package/assets/xsl/pretext-runestone.xsl +36 -34
  35. package/assets/xsl/pretext-sage-doctest.xsl +2 -2
  36. package/assets/xsl/pretext-text-utilities.xsl +69 -1
  37. package/assets/xsl/pretext-text.xsl +1077 -107
  38. package/assets/xsl/pretext-view-source.xsl +5 -3
  39. package/assets/xsl/pretext-ww-problem-sets.xsl +6 -1
  40. package/assets/xsl/publisher-variables.xsl +397 -477
  41. package/assets/xsl/support/play-button/README.md +1 -3
  42. package/assets/xsl/tests/README.md +1 -1
  43. package/assets/xsl/utilities/README.md +6 -8
  44. package/assets/xsl/utilities/report-publisher-variables.xsl +15 -0
  45. package/assets/xsl-bundle.json +1 -1
  46. package/dist/cli-DZsyZERX.js +694 -0
  47. package/dist/cli.js +1 -1
  48. package/dist/index.browser.d.ts +5 -0
  49. package/dist/index.browser.js +499 -344
  50. package/dist/index.d.ts +5 -0
  51. package/dist/index.js +23 -18
  52. package/dist/publication.d.ts +26 -12
  53. package/dist/renderer.d.ts +68 -0
  54. package/dist/reveal.d.ts +77 -0
  55. package/dist/reveal.js +110 -0
  56. package/dist/target.d.ts +34 -0
  57. package/package.json +12 -1
  58. package/dist/cli-CzoinNle.js +0 -639
@@ -1,155 +1,155 @@
1
- import { fromXml as x } from "xast-util-from-xml";
2
- import { toXml as $ } from "xast-util-to-xml";
3
- const P = "/";
4
- function me(e) {
1
+ import { fromXml as E } from "xast-util-from-xml";
2
+ import { toXml as S } from "xast-util-to-xml";
3
+ const D = "/";
4
+ function ge(e) {
5
5
  if (!e)
6
6
  return ".";
7
- const t = e.startsWith("/"), n = e.length > 1 && e.endsWith("/"), r = [];
8
- for (const i of e.split("/"))
9
- if (!(!i || i === ".")) {
10
- if (i === "..") {
7
+ const n = e.startsWith("/"), t = e.length > 1 && e.endsWith("/"), r = [];
8
+ for (const o of e.split("/"))
9
+ if (!(!o || o === ".")) {
10
+ if (o === "..") {
11
11
  const s = r[r.length - 1];
12
- r.length > 0 && s !== ".." ? r.pop() : t || r.push("..");
12
+ r.length > 0 && s !== ".." ? r.pop() : n || r.push("..");
13
13
  continue;
14
14
  }
15
- r.push(i);
15
+ r.push(o);
16
16
  }
17
- let o = r.join("/");
18
- return t && (o = `/${o}`), o ? (n && !o.endsWith("/") && (o += "/"), o) : t ? "/" : ".";
17
+ let i = r.join("/");
18
+ return n && (i = `/${i}`), i ? (t && !i.endsWith("/") && (i += "/"), i) : n ? "/" : ".";
19
19
  }
20
20
  function h(...e) {
21
- let t = "";
21
+ let n = "";
22
22
  for (let r = e.length - 1; r >= 0; r--) {
23
- const o = e[r];
24
- if (o && (t = t ? `${o}/${t}` : o, o.startsWith("/")))
23
+ const i = e[r];
24
+ if (i && (n = n ? `${i}/${n}` : i, i.startsWith("/")))
25
25
  break;
26
26
  }
27
- t.startsWith("/") || (t = `/${t}`);
28
- const n = me(t);
29
- return n.length > 1 && n.endsWith("/") ? n.slice(0, -1) : n;
27
+ n.startsWith("/") || (n = `/${n}`);
28
+ const t = ge(n);
29
+ return t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
30
30
  }
31
31
  function b(e) {
32
- const t = e.replace(/\/+$/, "");
33
- if (!t)
32
+ const n = e.replace(/\/+$/, "");
33
+ if (!n)
34
34
  return e.startsWith("/") ? "/" : ".";
35
- const n = t.lastIndexOf("/");
36
- return n < 0 ? "." : n === 0 ? "/" : t.slice(0, n);
37
- }
38
- function S(e, t) {
39
- const n = h(e).split("/").filter(Boolean), r = h(t).split("/").filter(Boolean);
40
- let o = 0;
41
- for (; o < n.length && o < r.length && n[o] === r[o]; )
42
- o += 1;
43
- return [...new Array(n.length - o).fill(".."), ...r.slice(o)].join("/");
44
- }
45
- const pe = "https://cdn.jsdelivr.net/npm/@pretextbook/pretext-html@0.3.0/assets";
46
- let V;
47
- function Ge(e) {
48
- V = e.replace(/\/+$/, "");
35
+ const t = n.lastIndexOf("/");
36
+ return t < 0 ? "." : t === 0 ? "/" : n.slice(0, t);
37
+ }
38
+ function k(e, n) {
39
+ const t = h(e).split("/").filter(Boolean), r = h(n).split("/").filter(Boolean);
40
+ let i = 0;
41
+ for (; i < t.length && i < r.length && t[i] === r[i]; )
42
+ i += 1;
43
+ return [...new Array(t.length - i).fill(".."), ...r.slice(i)].join("/");
44
+ }
45
+ const ve = "https://cdn.jsdelivr.net/npm/@pretextbook/pretext-html@0.5.0/assets";
46
+ let Z;
47
+ function bt(e) {
48
+ Z = e.replace(/\/+$/, "");
49
49
  }
50
- function T() {
51
- return V ?? pe;
50
+ function $() {
51
+ return Z ?? ve;
52
52
  }
53
- function Q(e, t) {
54
- return `${e.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
53
+ function Q(e, n) {
54
+ return `${e.replace(/\/+$/, "")}/${n.replace(/^\/+/, "")}`;
55
55
  }
56
- const C = /* @__PURE__ */ new Map();
57
- function we(e) {
56
+ const U = /* @__PURE__ */ new Map();
57
+ function be(e) {
58
58
  return `${e.replace(/\/+$/, "")}-bundle.json`;
59
59
  }
60
- function ge(e) {
61
- let t = C.get(e);
62
- return t || (t = (async () => {
60
+ function ye(e) {
61
+ let n = U.get(e);
62
+ return n || (n = (async () => {
63
63
  try {
64
- const n = await fetch(we(e));
65
- if (!n.ok)
64
+ const t = await fetch(be(e));
65
+ if (!t.ok)
66
66
  return /* @__PURE__ */ new Map();
67
- const r = await n.json();
67
+ const r = await t.json();
68
68
  return new Map(Object.entries(r));
69
69
  } catch {
70
70
  return /* @__PURE__ */ new Map();
71
71
  }
72
- })(), C.set(e, t)), t;
72
+ })(), U.set(e, n)), n;
73
73
  }
74
- function ye(e) {
75
- return e === Q(T(), "xsl");
74
+ function Ee(e) {
75
+ return e === Q($(), "xsl");
76
76
  }
77
- async function Z(e, t) {
78
- if (ye(e)) {
79
- const i = (await ge(e)).get(t.replace(/^\/+/, ""));
80
- if (i !== void 0)
81
- return new TextEncoder().encode(i);
77
+ async function ee(e, n) {
78
+ if (Ee(e)) {
79
+ const o = (await ye(e)).get(n.replace(/^\/+/, ""));
80
+ if (o !== void 0)
81
+ return new TextEncoder().encode(o);
82
82
  }
83
- const n = `${e.replace(/\/+$/, "")}/`;
83
+ const t = `${e.replace(/\/+$/, "")}/`;
84
84
  let r;
85
85
  try {
86
- r = new URL(t.replace(/^\/+/, ""), n);
86
+ r = new URL(n.replace(/^\/+/, ""), t);
87
87
  } catch {
88
88
  return;
89
89
  }
90
- if (!r.href.startsWith(n)) {
90
+ if (!r.href.startsWith(t)) {
91
91
  console.error(
92
- `pretext-html: refusing to serve ${t} from outside ${e}`
92
+ `pretext-html: refusing to serve ${n} from outside ${e}`
93
93
  );
94
94
  return;
95
95
  }
96
96
  try {
97
- const o = await fetch(r.href);
98
- return o.ok ? new Uint8Array(await o.arrayBuffer()) : void 0;
97
+ const i = await fetch(r.href);
98
+ return i.ok ? new Uint8Array(await i.arrayBuffer()) : void 0;
99
99
  } catch {
100
100
  return;
101
101
  }
102
102
  }
103
- async function L(e) {
103
+ async function P(e) {
104
104
  if (/^[a-z][a-z0-9+.-]*:\/\//i.test(e))
105
105
  try {
106
- const t = await fetch(e);
107
- return t.ok ? await t.text() : void 0;
106
+ const n = await fetch(e);
107
+ return n.ok ? await n.text() : void 0;
108
108
  } catch {
109
109
  return;
110
110
  }
111
111
  }
112
- const F = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map();
113
- let _, be = 0, te = Z;
114
- function Ke(e) {
115
- te = e;
112
+ const C = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Map();
113
+ let L, xe = 0, ne = ee;
114
+ function yt(e) {
115
+ ne = e;
116
116
  }
117
- function ve(e, t) {
118
- const n = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, r = ee.get(n);
117
+ function Te(e, n) {
118
+ const t = typeof e == "string" ? e : e instanceof URL ? e.href : e.url, r = te.get(t);
119
119
  if (r !== void 0)
120
120
  return Promise.resolve(new Response(r, { status: 200 }));
121
- let o;
121
+ let i;
122
122
  try {
123
- o = new URL(n).host;
123
+ i = new URL(t).host;
124
124
  } catch {
125
- o = "";
125
+ i = "";
126
126
  }
127
- const i = F.get(o);
128
- return i !== void 0 ? Ee(i, n) : _(e, t);
127
+ const o = C.get(i);
128
+ return o !== void 0 ? $e(o, t) : L(e, n);
129
129
  }
130
- const xe = '<?xml version="1.0"?><pretext-preview-missing-file/>';
131
- async function Ee(e, t) {
132
- const n = decodeURIComponent(new URL(t).pathname), r = await te(e, n);
130
+ const Se = '<?xml version="1.0"?><pretext-preview-missing-file/>';
131
+ async function $e(e, n) {
132
+ const t = decodeURIComponent(new URL(n).pathname), r = await ne(e, t);
133
133
  if (r === void 0)
134
- return new Response(xe, { status: 200 });
135
- const o = typeof r == "string" ? r : new Uint8Array(r);
136
- return new Response(o, { status: 200 });
134
+ return new Response(Se, { status: 200 });
135
+ const i = typeof r == "string" ? r : new Uint8Array(r);
136
+ return new Response(i, { status: 200 });
137
137
  }
138
- function ne() {
139
- _ || (_ = globalThis.fetch, globalThis.fetch = ve);
138
+ function re() {
139
+ L || (L = globalThis.fetch, globalThis.fetch = Te);
140
140
  }
141
- function re(e) {
142
- ne();
143
- const t = `mnt${++be}.ptx.invalid`;
144
- return F.set(t, e), `http://${t}`;
141
+ function ie(e) {
142
+ re();
143
+ const n = `mnt${++xe}.ptx.invalid`;
144
+ return C.set(n, e), `http://${n}`;
145
145
  }
146
- function $e(e) {
147
- F.delete(new URL(e).host);
146
+ function _e(e) {
147
+ C.delete(new URL(e).host);
148
148
  }
149
- function Te(e, t) {
150
- ne(), ee.set(e, t);
149
+ function Re(e, n) {
150
+ re(), te.set(e, n);
151
151
  }
152
- const oe = `<?xml version="1.0" encoding="UTF-8"?>
152
+ const A = `<?xml version="1.0" encoding="UTF-8"?>
153
153
  <publication>
154
154
  <source>
155
155
  <directories external="../assets" generated="../generated-assets" />
@@ -158,113 +158,244 @@ const oe = `<?xml version="1.0" encoding="UTF-8"?>
158
158
  <platform portable="yes"/>
159
159
  </html>
160
160
  </publication>
161
- `;
162
- function y(e, t) {
163
- for (const n of e.children)
164
- if (n.type === "element" && n.name === t)
165
- return n;
161
+ `, ke = ["theme", "style", "shell"];
162
+ function w(e, n) {
163
+ for (const t of e.children)
164
+ if (t.type === "element" && t.name === n)
165
+ return t;
166
+ }
167
+ function g(e, n) {
168
+ let t = w(e, n);
169
+ return t || (t = { type: "element", name: n, attributes: {}, children: [] }, e.children.push(t)), t;
170
+ }
171
+ function Ie(e, n) {
172
+ const t = w(e, "css");
173
+ if (t && ke.some((i) => t.attributes?.[i]))
174
+ return;
175
+ const r = t ?? g(e, "css");
176
+ r.attributes = { ...r.attributes, theme: n };
166
177
  }
167
- function U(e, t) {
168
- let n = y(e, t);
169
- return n || (n = { type: "element", name: t, attributes: {}, children: [] }, e.children.push(n)), n;
178
+ function Me(e, n) {
179
+ const t = w(e, "appearance");
180
+ if (t?.attributes?.theme)
181
+ return;
182
+ const r = t ?? g(e, "appearance");
183
+ r.attributes = { ...r.attributes, theme: n };
170
184
  }
171
- function H(e) {
172
- if (!e)
173
- return oe;
174
- const t = x(e), n = y(t, "publication");
175
- if (!n)
185
+ function De(e) {
186
+ const n = g(e, "resources");
187
+ n.attributes = {
188
+ ...n.attributes,
189
+ host: "cdn",
190
+ math: "online"
191
+ };
192
+ }
193
+ function Le(e, n = {}) {
194
+ const t = n.cssTheme?.trim(), r = n.revealTheme?.trim(), i = n.target === "slides";
195
+ if (!e && !t && !i)
196
+ return A;
197
+ const o = E(e ?? A), s = w(o, "publication");
198
+ if (!s)
176
199
  throw new Error(
177
200
  "Invalid publication file: no root <publication> element found"
178
201
  );
179
- const r = U(n, "html"), o = U(r, "platform");
180
- return o.attributes = { ...o.attributes, portable: "yes" }, $(t);
202
+ const a = g(s, "html"), u = g(a, "platform");
203
+ if (u.attributes = { ...u.attributes, portable: "yes" }, t && Ie(a, t), i) {
204
+ const c = g(s, "revealjs");
205
+ De(c), r && Me(c, r);
206
+ }
207
+ return S(o);
181
208
  }
182
- function O(e) {
209
+ function V(e) {
183
210
  if (!(e === void 0 || e === "" || e.startsWith("/")))
184
211
  return e.endsWith("/") ? e : `${e}/`;
185
212
  }
186
- function ke(e) {
187
- const t = x(e ?? oe), n = y(t, "publication"), r = n && y(n, "source"), o = r && y(r, "directories"), i = O(
188
- o?.attributes?.external ?? void 0
189
- ), s = O(
190
- o?.attributes?.generated ?? void 0
213
+ function Ae(e) {
214
+ const n = E(e ?? A), t = w(n, "publication"), r = t && w(t, "source"), i = r && w(r, "directories"), o = V(
215
+ i?.attributes?.external ?? void 0
216
+ ), s = V(
217
+ i?.attributes?.generated ?? void 0
191
218
  );
192
219
  return {
193
- external: i,
220
+ external: o,
194
221
  generated: s,
195
- managed: i !== void 0 && s !== void 0
222
+ managed: o !== void 0 && s !== void 0
223
+ };
224
+ }
225
+ function Et(e) {
226
+ return e === "slides" || e === "scroll";
227
+ }
228
+ const oe = 960, se = 700, Pe = 1, Ce = 0.04;
229
+ function je(e) {
230
+ const n = typeof e == "number" && isFinite(e) ? e : Pe, t = Math.min(1, Math.max(0.25, n));
231
+ return {
232
+ width: Math.round(oe / t),
233
+ height: Math.round(se / t)
234
+ };
235
+ }
236
+ function Fe(e) {
237
+ return {
238
+ view: "scroll",
239
+ scrollLayout: "compact",
240
+ scrollSnap: !1,
241
+ scrollProgress: !0,
242
+ fragments: !1,
243
+ controls: !1,
244
+ controlsTutorial: !1,
245
+ hash: !1,
246
+ ...je(e.zoom),
247
+ margin: Ce
196
248
  };
197
249
  }
198
- const ie = "http://www.w3.org/2001/XInclude", N = 64;
199
- async function Me(e, t, n) {
200
- return e.includes("include") ? (await se(e, t, n)).content : e;
250
+ function We() {
251
+ return {
252
+ // Explicitly null rather than absent: the same page may have been
253
+ // delivered in scroll view a moment ago, and an embedder that re-injects
254
+ // over already-injected HTML would otherwise leave the old value standing.
255
+ view: null,
256
+ // See scrollViewConfig; the webview objection to hash applies either way.
257
+ hash: !1,
258
+ // The nominal size matters just as much here: a deck previewed at pane
259
+ // size with a percentage width renders its text far larger, relative to
260
+ // the slide, than the same deck will on a projector. No zoom margin
261
+ // though — presenting means filling whatever it is shown in.
262
+ width: oe,
263
+ height: se
264
+ };
265
+ }
266
+ const Be = [
267
+ "<style>",
268
+ ".reveal-viewport.reveal-scroll .scroll-page section {",
269
+ " box-shadow: inset 0 0 0 calc(1px / var(--slide-scale, 1))",
270
+ " rgba(128, 128, 128, 0.5);",
271
+ "}",
272
+ "</style>"
273
+ ].join(`
274
+ `), Oe = [
275
+ " var paused = document.querySelectorAll('.reveal .fragment');",
276
+ " for (var i = 0; i < paused.length; i++) {",
277
+ " paused[i].classList.remove('fragment');",
278
+ " }"
279
+ ];
280
+ function Xe(e, n = {}) {
281
+ const t = e === "scroll" ? Fe(n) : We();
282
+ return [
283
+ "<script>",
284
+ "(function () {",
285
+ " var OVERRIDES = " + JSON.stringify(t) + ";",
286
+ // Nothing to wrap if reveal.js failed to load (offline, CDN blocked). The
287
+ // deck is broken either way, but throwing here would replace the browser's
288
+ // useful network error with a confusing one from an injected script.
289
+ " if (typeof Reveal === 'undefined' || !Reveal.initialize) { return; }",
290
+ // Guard against double-wrapping: an embedder may inject into HTML that was
291
+ // already injected into, and wrapping a wrapper would still work but grows
292
+ // a chain on every redelivery.
293
+ " if (Reveal.__ptxViewWrapped) {",
294
+ " Reveal.__ptxViewOverrides = OVERRIDES;",
295
+ " return;",
296
+ " }",
297
+ " Reveal.__ptxViewWrapped = true;",
298
+ " Reveal.__ptxViewOverrides = OVERRIDES;",
299
+ " var initialize = Reveal.initialize.bind(Reveal);",
300
+ " Reveal.initialize = function (config) {",
301
+ " var merged = {};",
302
+ " var key;",
303
+ " for (key in config || {}) { merged[key] = config[key]; }",
304
+ " var o = Reveal.__ptxViewOverrides;",
305
+ " for (key in o) { merged[key] = o[key]; }",
306
+ // Inside the wrapper rather than at top level: this script sits in <head>,
307
+ // where the slides have not been parsed yet, but the deck calls initialize
308
+ // from the end of the document, by which time they have.
309
+ ...e === "scroll" ? Oe : [],
310
+ " return initialize(merged);",
311
+ " };",
312
+ "})();",
313
+ "<\/script>"
314
+ ].join(`
315
+ `);
201
316
  }
202
- async function se(e, t, n) {
203
- const r = x(e), o = {
204
- projectDir: h(n),
205
- stack: [h(t)]
206
- }, i = await v(
317
+ const He = /<script\b[^>]*\bsrc=["'][^"']*\breveal\.js["'][^>]*>\s*<\/script>/i, Ue = "<!--ptx-reveal-view-->", Ve = "<!--/ptx-reveal-view-->", Ne = /\n?<!--ptx-reveal-view-->[\s\S]*?<!--\/ptx-reveal-view-->/;
318
+ function ze(e, n, t = {}) {
319
+ const r = Ne.exec(e), i = r ? e.slice(0, r.index) + e.slice(r.index + r[0].length) : e, o = He.exec(i);
320
+ if (!o)
321
+ return i;
322
+ const s = o.index + o[0].length, a = `
323
+ ${Ue}
324
+ ${Be}
325
+ ${Xe(n, t)}
326
+ ${Ve}`;
327
+ return i.slice(0, s) + a + i.slice(s);
328
+ }
329
+ const ae = "http://www.w3.org/2001/XInclude", N = 64;
330
+ async function Je(e, n, t) {
331
+ return e.includes("include") ? (await ce(e, n, t)).content : e;
332
+ }
333
+ async function ce(e, n, t) {
334
+ const r = E(e), i = {
335
+ projectDir: h(t),
336
+ stack: [h(n)]
337
+ }, o = await y(
207
338
  r,
208
- b(h(t)),
339
+ b(h(n)),
209
340
  { "": "" },
210
- o
341
+ i
211
342
  );
212
- return { tree: r, content: i ? $(r) : e };
343
+ return { tree: r, content: o ? S(r) : e };
213
344
  }
214
- function De(e) {
345
+ function Ge(e) {
215
346
  return e.data?.ptxIncludedFile;
216
347
  }
217
- function Se(e, t) {
218
- const n = e.data ?? (e.data = {});
219
- n.ptxIncludedFile = t;
348
+ function Ye(e, n) {
349
+ const t = e.data ?? (e.data = {});
350
+ t.ptxIncludedFile = n;
220
351
  }
221
- function k(e, t) {
222
- let n = e;
223
- for (const [r, o] of Object.entries(t.attributes))
224
- (r === "xmlns" || r.startsWith("xmlns:")) && (n === e && (n = { ...e }), n[r === "xmlns" ? "" : r.slice(6)] = o ?? "");
225
- return n;
352
+ function _(e, n) {
353
+ let t = e;
354
+ for (const [r, i] of Object.entries(n.attributes))
355
+ (r === "xmlns" || r.startsWith("xmlns:")) && (t === e && (t = { ...e }), t[r === "xmlns" ? "" : r.slice(6)] = i ?? "");
356
+ return t;
226
357
  }
227
- function ae(e, t) {
228
- const n = e.name.indexOf(":"), r = n === -1 ? "" : e.name.slice(0, n);
229
- return (n === -1 ? e.name : e.name.slice(n + 1)) === "include" && t[r] === ie;
358
+ function le(e, n) {
359
+ const t = e.name.indexOf(":"), r = t === -1 ? "" : e.name.slice(0, t);
360
+ return (t === -1 ? e.name : e.name.slice(t + 1)) === "include" && n[r] === ae;
230
361
  }
231
- async function v(e, t, n, r) {
232
- let o = !1;
233
- for (let i = 0; i < e.children.length; i++) {
234
- const s = e.children[i];
362
+ async function y(e, n, t, r) {
363
+ let i = !1;
364
+ for (let o = 0; o < e.children.length; o++) {
365
+ const s = e.children[o];
235
366
  if (s.type !== "element")
236
367
  continue;
237
- const a = k(n, s);
238
- if (ae(s, a)) {
239
- const d = await ce(
368
+ const a = _(t, s);
369
+ if (le(s, a)) {
370
+ const u = await ue(
240
371
  s,
241
- t,
372
+ n,
242
373
  a,
243
374
  r
244
375
  );
245
- e.children.splice(i, 1, ...d), i += d.length - 1, o = !0;
246
- } else await v(s, t, a, r) && (o = !0);
376
+ e.children.splice(o, 1, ...u), o += u.length - 1, i = !0;
377
+ } else await y(s, n, a, r) && (i = !0);
247
378
  }
248
- return o;
379
+ return i;
249
380
  }
250
- async function ce(e, t, n, r) {
251
- const o = r.stack[r.stack.length - 1];
381
+ async function ue(e, n, t, r) {
382
+ const i = r.stack[r.stack.length - 1];
252
383
  if (e.attributes.xpointer)
253
384
  throw new Error(
254
- `xi:include with xpointer is not supported by the JS preview build (in ${o})`
385
+ `xi:include with xpointer is not supported by the JS preview build (in ${i})`
255
386
  );
256
- const i = e.attributes.href;
257
- if (!i)
258
- throw new Error(`xi:include without href (in ${o})`);
259
- let s = i;
387
+ const o = e.attributes.href;
388
+ if (!o)
389
+ throw new Error(`xi:include without href (in ${i})`);
390
+ let s = o;
260
391
  try {
261
- s = decodeURIComponent(i);
392
+ s = decodeURIComponent(o);
262
393
  } catch {
263
394
  }
264
- const a = h(t, s);
265
- if (a !== r.projectDir && !a.startsWith(r.projectDir + P))
395
+ const a = h(n, s);
396
+ if (a !== r.projectDir && !a.startsWith(r.projectDir + D))
266
397
  throw new Error(
267
- `xi:include escapes the project directory: ${i} (in ${o})`
398
+ `xi:include escapes the project directory: ${o} (in ${i})`
268
399
  );
269
400
  if (r.stack.includes(a))
270
401
  throw new Error(
@@ -272,18 +403,18 @@ async function ce(e, t, n, r) {
272
403
  );
273
404
  if (r.stack.length >= N)
274
405
  throw new Error(`xi:include nesting exceeds ${N} levels`);
275
- const d = await L(a);
276
- if (d === void 0) {
277
- const f = Ae(e, n);
406
+ const u = await P(a);
407
+ if (u === void 0) {
408
+ const f = qe(e, t);
278
409
  if (f)
279
- return await v(f, t, n, r), f.children;
280
- throw new Error(`xi:include target not found: ${i} (in ${o})`);
410
+ return await y(f, n, t, r), f.children;
411
+ throw new Error(`xi:include target not found: ${o} (in ${i})`);
281
412
  }
282
413
  if (e.attributes.parse === "text")
283
- return [{ type: "text", value: d }];
414
+ return [{ type: "text", value: u }];
284
415
  let c;
285
416
  try {
286
- c = x(d);
417
+ c = E(u);
287
418
  } catch (f) {
288
419
  throw new Error(
289
420
  `Could not parse xi:include target ${a} as XML: ${f instanceof Error ? f.message : f}. (Included files must be well-formed, with a single root element.)`
@@ -291,48 +422,48 @@ async function ce(e, t, n, r) {
291
422
  }
292
423
  r.stack.push(a);
293
424
  try {
294
- await v(c, b(a), { "": "" }, r);
425
+ await y(c, b(a), { "": "" }, r);
295
426
  } finally {
296
427
  r.stack.pop();
297
428
  }
298
- const u = c.children.filter(
429
+ const d = c.children.filter(
299
430
  (f) => f.type === "element"
300
431
  );
301
- for (const f of u)
302
- Se(f, a);
303
- return u;
432
+ for (const f of d)
433
+ Ye(f, a);
434
+ return d;
304
435
  }
305
436
  function z(e) {
306
437
  return e.name === "docinfo";
307
438
  }
308
- async function Ie(e, t, n) {
439
+ async function Ke(e, n, t) {
309
440
  try {
310
- const o = x(e).children.find(
441
+ const i = E(e).children.find(
311
442
  (c) => c.type === "element"
312
443
  );
313
- if (!o)
444
+ if (!i)
314
445
  return;
315
- const i = h(t), s = b(i), a = {
316
- projectDir: h(n),
317
- stack: [i]
318
- }, d = k({ "": "" }, o);
319
- for (const c of o.children) {
446
+ const o = h(n), s = b(o), a = {
447
+ projectDir: h(t),
448
+ stack: [o]
449
+ }, u = _({ "": "" }, i);
450
+ for (const c of i.children) {
320
451
  if (c.type !== "element")
321
452
  continue;
322
- const u = k(d, c);
453
+ const d = _(u, c);
323
454
  if (z(c))
324
- return await v(c, s, u, a), $(c);
325
- if (ae(c, u)) {
326
- const m = (await ce(
455
+ return await y(c, s, d, a), S(c);
456
+ if (le(c, d)) {
457
+ const p = (await ue(
327
458
  c,
328
459
  s,
329
- u,
460
+ d,
330
461
  a
331
462
  )).find(
332
- (w) => w.type === "element" && z(w)
463
+ (m) => m.type === "element" && z(m)
333
464
  );
334
- if (m)
335
- return $(m);
465
+ if (p)
466
+ return S(p);
336
467
  continue;
337
468
  }
338
469
  break;
@@ -342,74 +473,78 @@ async function Ie(e, t, n) {
342
473
  return;
343
474
  }
344
475
  }
345
- function Ae(e, t) {
346
- for (const n of e.children) {
347
- if (n.type !== "element")
476
+ function qe(e, n) {
477
+ for (const t of e.children) {
478
+ if (t.type !== "element")
348
479
  continue;
349
- const r = k(t, n), o = n.name.indexOf(":"), i = o === -1 ? "" : n.name.slice(0, o);
350
- if ((o === -1 ? n.name : n.name.slice(o + 1)) === "fallback" && r[i] === ie)
351
- return n;
480
+ const r = _(n, t), i = t.name.indexOf(":"), o = i === -1 ? "" : t.name.slice(0, i);
481
+ if ((i === -1 ? t.name : t.name.slice(i + 1)) === "fallback" && r[o] === ae)
482
+ return t;
352
483
  }
353
484
  }
354
- function le(e) {
485
+ function de(e) {
355
486
  return typeof e == "object" && e !== null && e.type === "element";
356
487
  }
357
- function Pe(e) {
488
+ function Ze(e) {
358
489
  return /^(pf|xhtml):/.test(e.name);
359
490
  }
360
- function _e(e, t, n) {
361
- const r = [], o = e.children.find(le);
362
- if (o) {
363
- const i = n?.parentId ?? "root";
364
- de(o, i, n?.position ?? 1, t, i, r);
491
+ function Qe(e, n, t) {
492
+ const r = [], i = e.children.find(de);
493
+ if (i) {
494
+ const o = t?.parentId ?? "root";
495
+ fe(i, o, t?.position ?? 1, n, o, r);
365
496
  }
366
497
  return r;
367
498
  }
368
- function de(e, t, n, r, o, i) {
369
- const s = De(e) ?? r;
370
- let a, d;
371
- if (Pe(e))
372
- d = "root";
499
+ function fe(e, n, t, r, i, o) {
500
+ const s = Ge(e) ?? r;
501
+ let a, u;
502
+ if (Ze(e))
503
+ u = "root";
373
504
  else {
374
- const u = e.attributes.label ?? e.attributes["xml:id"];
375
- a = u ?? `${t}-${n}`, i.push({
505
+ const d = e.attributes.label ?? e.attributes["xml:id"];
506
+ a = d ?? `${n}-${t}`, o.push({
376
507
  id: a,
377
508
  file: s,
378
509
  line: e.position?.start.line ?? 1,
379
510
  column: e.position?.start.column ?? 1,
380
511
  endLine: e.position?.end.line ?? e.position?.start.line ?? 1,
381
- parent: o
382
- }), d = a;
512
+ parent: i
513
+ }), u = a;
383
514
  }
384
515
  let c = 0;
385
- for (const u of e.children)
386
- le(u) && (c += 1, de(
387
- u,
516
+ for (const d of e.children)
517
+ de(d) && (c += 1, fe(
388
518
  d,
519
+ u,
389
520
  c,
390
521
  s,
391
- a ?? o,
392
- i
522
+ a ?? i,
523
+ o
393
524
  ));
394
525
  }
395
- function qe(e, t) {
396
- let n;
526
+ function xt(e, n) {
527
+ let t;
397
528
  for (const r of e)
398
- r.line <= t && (n = r);
399
- return n ?? e[0];
529
+ r.line <= n && (t = r);
530
+ return t ?? e[0];
400
531
  }
401
- const ue = "pretext-html:set-theme";
402
- function Ve(e) {
532
+ function et(e) {
533
+ const n = e.replace(/<!--[\s\S]*?-->/g, " ").replace(/<!\[CDATA\[[\s\S]*?\]\]>/g, " ");
534
+ return /<\s*slide(?:show)?[\s/>]/.test(n) ? "slides" : "html";
535
+ }
536
+ const he = "pretext-html:set-theme";
537
+ function Tt(e) {
403
538
  return e === "dark" || e === "light" || e === "system";
404
539
  }
405
- function Qe(e) {
406
- return { type: ue, theme: e };
540
+ function St(e) {
541
+ return { type: he, theme: e };
407
542
  }
408
- function Le(e) {
543
+ function tt(e) {
409
544
  return [
410
545
  "<script>",
411
546
  "(function () {",
412
- " var CFG = " + JSON.stringify({ msg: ue, initial: e }) + ";",
547
+ " var CFG = " + JSON.stringify({ msg: he, initial: e }) + ";",
413
548
  // Where the last requested theme is remembered so it survives an in-place
414
549
  // document rewrite (same Window) and outranks the baked initial value.
415
550
  " var KEY = '__ptxPreviewTheme';",
@@ -479,223 +614,243 @@ function Le(e) {
479
614
  ].join(`
480
615
  `);
481
616
  }
482
- function Fe(e, t) {
483
- const n = Le(t);
617
+ function nt(e, n) {
618
+ const t = tt(n);
484
619
  return /<head[^>]*>/i.test(e) ? e.replace(/<head([^>]*)>/i, `<head$1>
485
- ${n}`) : e;
620
+ ${t}`) : e;
486
621
  }
487
- function je() {
488
- return Q(T(), "xsl");
622
+ function rt() {
623
+ return Q($(), "xsl");
489
624
  }
490
- function Re() {
625
+ function it() {
491
626
  return "Suspending" in WebAssembly;
492
627
  }
493
- function We() {
494
- if (!Re())
628
+ function ot() {
629
+ if (!it())
495
630
  throw new Error(
496
631
  "WebAssembly JSPI is not enabled. Run Node with --experimental-wasm-jspi (or use the pretext-html CLI, which re-launches itself with the flag)."
497
632
  );
498
633
  }
499
634
  function J(e) {
500
- return e.includes("'") ? e.includes('"') ? `concat(${e.split("'").map((n) => `'${n}'`).join(`, "'", `)})` : `"${e}"` : `'${e}'`;
635
+ return e.includes("'") ? e.includes('"') ? `concat(${e.split("'").map((t) => `'${t}'`).join(`, "'", `)})` : `"${e}"` : `'${e}'`;
501
636
  }
502
- function Be(e) {
637
+ function st(e) {
503
638
  return e.replace(
504
639
  /from '\.\/(https:\/\/[^']+)'/g,
505
- (t, n) => `from '${n}'`
640
+ (n, t) => `from '${t}'`
506
641
  );
507
642
  }
508
- function Xe(e) {
643
+ const at = "https://cdn.jsdelivr.net/gh/PreTeXtBook/html-static@latest/dist/";
644
+ function ct(e) {
645
+ return e.replace(
646
+ /(<link\b[^>]*\bhref=["'])_static\//gi,
647
+ `$1${at}_static/`
648
+ );
649
+ }
650
+ function lt(e) {
509
651
  return e.slice(0, 65536).replace(/<\?[\s\S]*?\?>/g, " ").replace(/<!--[\s\S]*?-->/g, " ").replace(/<!DOCTYPE[^>]*>/gi, " ").match(/<\s*([A-Za-z][\w:-]*)/)?.[1];
510
652
  }
511
- async function Y(e) {
512
- const t = await L(e);
513
- if (t === void 0)
653
+ async function G(e) {
654
+ const n = await P(e);
655
+ if (n === void 0)
514
656
  throw new Error(
515
657
  `Could not read ${e}. (In the browser build only absolute URLs are readable — pass sourceContent instead of relying on sourcePath.)`
516
658
  );
517
- return t;
659
+ return n;
518
660
  }
519
- async function Ce(e, t) {
520
- const n = h(e), r = await L(n);
661
+ async function ut(e, n) {
662
+ const t = h(e), r = await P(t);
521
663
  if (r !== void 0)
522
- return Ie(r, n, t);
664
+ return Ke(r, t, n);
523
665
  }
524
- function Ue(e, t, n) {
525
- const r = e.replace(/^\uFEFF/, "").replace(/<\?xml[\s\S]*?\?>/, "").replace(/<!DOCTYPE[^>]*>/i, ""), o = t === "chapter" || t === "part" ? "book" : "article";
666
+ function dt(e, n, t, r) {
667
+ const i = e.replace(/^\uFEFF/, "").replace(/<\?xml[\s\S]*?\?>/, "").replace(/<!DOCTYPE[^>]*>/i, ""), o = t === "slides" ? "slideshow" : n === "chapter" || n === "part" ? "book" : "article";
526
668
  return `<pretext>
527
- ${n?.trim() ? `${n.trim()}
669
+ ${r?.trim() ? `${r.trim()}
528
670
  ` : ""}<${o}>
529
671
  <title/>
530
- ${r}
672
+ ${i}
531
673
  </${o}>
532
674
  </pretext>
533
675
  `;
534
676
  }
535
- let fe = !1;
536
- function He(e) {
677
+ let pe = !1;
678
+ function ft(e) {
537
679
  return e instanceof Error && /\bAborted\(/.test(e.message);
538
680
  }
539
- function Oe(e) {
681
+ function ht(e) {
540
682
  return e instanceof Error && /memory access|out of bounds/i.test(e.message);
541
683
  }
542
- function Ne() {
543
- if (fe)
684
+ function pt() {
685
+ if (pe)
544
686
  throw new Error(
545
687
  "The WebAssembly renderer aborted earlier in this process and cannot be reused. Restart the process (or reload the page) to render again."
546
688
  );
547
689
  }
548
- function G(e) {
549
- if (He(e))
550
- throw fe = !0, new Error(
690
+ function Y(e) {
691
+ if (ft(e))
692
+ throw pe = !0, new Error(
551
693
  "The WebAssembly renderer aborted and cannot be reused. Restart the process (or reload the page) to render again.",
552
694
  { cause: e }
553
695
  );
554
- if (Oe(e))
696
+ if (ht(e))
555
697
  throw new Error(
556
698
  "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.",
557
699
  { cause: e }
558
700
  );
559
701
  }
560
702
  let I;
561
- async function he() {
703
+ async function me() {
562
704
  return I || (I = (async () => {
563
- const [e, t] = await Promise.all([
705
+ const [e, n] = await Promise.all([
564
706
  import("@pretextbook/libxslt-wasm"),
565
707
  import("@pretextbook/libxslt-wasm/exslt")
566
708
  ]);
567
- return t.registerAll(), e;
709
+ return n.registerAll(), e;
568
710
  })()), I;
569
711
  }
570
- const A = /* @__PURE__ */ new Map();
571
- async function ze(e) {
572
- const t = e;
573
- let n = A.get(t);
574
- return n || (n = (async () => {
575
- const { XmlDocument: r, XsltStylesheet: o } = await he(), i = re(t), s = await Z(
576
- T(),
577
- "/preview-html.xsl"
578
- );
579
- if (s === void 0)
712
+ const M = /* @__PURE__ */ new Map(), mt = {
713
+ html: "preview-html.xsl",
714
+ slides: "preview-revealjs.xsl"
715
+ };
716
+ async function wt(e, n) {
717
+ const t = mt[n], r = `${n}\0${e}`;
718
+ let i = M.get(r);
719
+ return i || (i = (async () => {
720
+ const { XmlDocument: o, XsltStylesheet: s } = await me(), a = ie(e), u = await ee($(), `/${t}`);
721
+ if (u === void 0)
580
722
  throw new Error(
581
- `Could not read preview-html.xsl from ${T()}. Check the assets location (PRETEXT_HTML_ASSETS under Node, setAssetsBase() in the browser).`
723
+ `Could not read ${t} from ${$()}. Check the assets location (PRETEXT_HTML_ASSETS under Node, setAssetsBase() in the browser).`
582
724
  );
583
- const a = new TextDecoder().decode(s), d = await r.fromString(a, {
584
- url: `${i}/preview-html.xsl`,
725
+ const c = new TextDecoder().decode(u), d = await o.fromString(c, {
726
+ url: `${a}/${t}`,
585
727
  options: { noEnt: !0, dtdLoad: !0, huge: !0 }
586
728
  });
587
- return o.fromXmlDocument(d);
588
- })(), A.set(t, n), n.catch(() => A.delete(t))), n;
729
+ return s.fromXmlDocument(d);
730
+ })(), M.set(r, i), i.catch(() => M.delete(r))), i;
589
731
  }
590
732
  let K = Promise.resolve();
591
- function Ze(e) {
592
- const t = K.then(
733
+ function $t(e) {
734
+ const n = K.then(
593
735
  () => q(e),
594
736
  () => q(e)
595
737
  );
596
- return K = t.catch(() => {
597
- }), t;
738
+ return K = n.catch(() => {
739
+ }), n;
598
740
  }
599
741
  async function q(e) {
600
- We(), Ne();
601
- const { XmlDocument: t } = await he(), n = await ze(e.xslDir ?? je()), r = h(e.sourcePath), o = h(
602
- e.projectDir ?? b(r)
603
- ), i = e.sourceContent ?? await Y(r), s = S(o, r);
604
- if (s.startsWith(".."))
742
+ ot(), pt();
743
+ const { XmlDocument: n } = await me(), t = h(e.sourcePath), r = h(
744
+ e.projectDir ?? b(t)
745
+ ), i = e.sourceContent ?? await G(t), o = k(r, t);
746
+ if (o.startsWith(".."))
605
747
  throw new Error(
606
- `sourcePath (${r}) must live inside projectDir (${o})`
748
+ `sourcePath (${t}) must live inside projectDir (${r})`
607
749
  );
608
- const a = S(
609
- o,
610
- h(e.mainSourcePath ?? r)
611
- ), d = a.startsWith("..") ? s : a, c = re(o);
750
+ const s = k(
751
+ r,
752
+ h(e.mainSourcePath ?? t)
753
+ ), a = s.startsWith("..") ? o : s, u = ie(r);
612
754
  try {
613
- let u, f = `${c}/__pretext-preview-publication.xml`;
755
+ let c, d = `${u}/__pretext-preview-publication.xml`;
614
756
  if (e.publicationPath) {
615
757
  const l = h(e.publicationPath);
616
- u = H(
617
- await Y(l)
618
- );
619
- const g = S(o, l);
620
- g.startsWith("..") || (f = `${c}/${g.split(P).join("/")}`);
621
- } else
622
- u = H();
623
- Te(f, u);
624
- const m = ke(u), w = b(h(o, d)), j = m.external !== void 0 && m.generated !== void 0 ? {
625
- external: h(w, m.external),
626
- generated: h(w, m.generated)
627
- } : void 0;
628
- let M, p;
758
+ c = await G(l);
759
+ const v = k(r, l);
760
+ v.startsWith("..") || (d = `${u}/${v.split(D).join("/")}`);
761
+ }
762
+ let f, p;
629
763
  if (e.sourceMap) {
630
- const l = await se(
764
+ const l = await ce(
631
765
  i,
632
- r,
633
- o
766
+ t,
767
+ r
634
768
  );
635
- M = l.tree, p = l.content;
769
+ f = l.tree, p = l.content;
636
770
  } else
637
- p = await Me(
771
+ p = await Je(
638
772
  i,
639
- r,
640
- o
773
+ t,
774
+ r
641
775
  );
642
- const E = Xe(p);
643
- let R = { parentId: "root", position: 1 };
644
- if (E !== "pretext" && E !== "mathbook")
776
+ const m = e.target ?? et(p), we = await wt(e.xslDir ?? rt(), m), j = Le(c, {
777
+ cssTheme: e.cssTheme,
778
+ revealTheme: e.revealTheme,
779
+ target: m
780
+ });
781
+ Re(d, j);
782
+ const x = Ae(j), F = b(h(r, a)), W = x.external !== void 0 && x.generated !== void 0 ? {
783
+ external: h(F, x.external),
784
+ generated: h(F, x.generated)
785
+ } : void 0, T = lt(p);
786
+ let B = { parentId: "root", position: 1 };
787
+ if (T !== "pretext" && T !== "mathbook")
645
788
  if (e.fragment) {
646
- const l = e.docinfo ?? (e.docinfoSourcePath ? await Ce(e.docinfoSourcePath, o) : void 0);
647
- p = Ue(p, E, l), R = { parentId: l?.trim() ? "root-1-2" : "root-1-1", position: 2 };
789
+ const l = e.docinfo ?? (e.docinfoSourcePath ? await ut(e.docinfoSourcePath, r) : void 0);
790
+ p = dt(
791
+ p,
792
+ T,
793
+ m,
794
+ l
795
+ ), B = { parentId: l?.trim() ? "root-1-2" : "root-1-1", position: 2 };
648
796
  } else
649
797
  throw new Error(
650
- `The document root is <${E ?? "?"}>, not <pretext> — this looks like an xi:included fragment. Render the project's main source file instead, or pass the fragment option.`
798
+ `The document root is <${T ?? "?"}>, not <pretext> — this looks like an xi:included fragment. Render the project's main source file instead, or pass the fragment option.`
651
799
  );
652
- const W = M ? _e(M, r, R) : void 0, B = await t.fromString(p, {
653
- url: `${c}/${d.split(P).join("/")}`,
800
+ const O = f ? Qe(f, t, B) : void 0, X = await n.fromString(p, {
801
+ url: `${u}/${a.split(D).join("/")}`,
654
802
  options: { noEnt: !0, dtdLoad: !0, huge: !0 }
655
- }), X = {
656
- publisher: J(f)
803
+ }), H = {
804
+ publisher: J(d)
657
805
  };
658
- for (const [l, g] of Object.entries(e.stringParams ?? {}))
659
- X[l] = J(g);
660
- let D;
806
+ for (const [l, v] of Object.entries(e.stringParams ?? {}))
807
+ H[l] = J(v);
808
+ let R;
661
809
  try {
662
- D = await n.apply(B, X);
810
+ R = await we.apply(X, H);
663
811
  } catch (l) {
664
- throw G(l), new Error(
812
+ throw Y(l), new Error(
665
813
  "PreTeXt XSLT transform failed; see the PTX:ERROR/PTX:FATAL messages on stderr for details.",
666
814
  { cause: l }
667
815
  );
668
816
  } finally {
669
- B.delete();
817
+ X.delete();
670
818
  }
671
819
  try {
672
- let l = Be(D.toHtmlString());
673
- return e.theme && (l = Fe(l, e.theme)), {
820
+ let l = st(R.toHtmlString());
821
+ return m === "slides" ? (l = ct(l), l = ze(l, e.revealView ?? "scroll", {
822
+ zoom: e.revealZoom
823
+ })) : e.theme && (l = nt(l, e.theme)), {
674
824
  html: l,
675
- ...W ? { sourceMap: W } : {},
676
- ...j ? { assetDirs: j } : {}
825
+ target: m,
826
+ ...O ? { sourceMap: O } : {},
827
+ ...W ? { assetDirs: W } : {}
677
828
  };
678
829
  } catch (l) {
679
- throw G(l), l;
830
+ throw Y(l), l;
680
831
  } finally {
681
- D.delete();
832
+ R.delete();
682
833
  }
683
834
  } finally {
684
- $e(c);
835
+ _e(u);
685
836
  }
686
837
  }
687
838
  export {
688
- ue as PREVIEW_THEME_MESSAGE,
689
- je as defaultXslDir,
690
- qe as findSourceMapEntry,
691
- H as forcePortablePublication,
692
- Fe as injectThemeBridge,
693
- Re as isJspiAvailable,
694
- Ve as isPreviewTheme,
695
- Qe as previewThemeMessage,
696
- Ze as renderHtml,
697
- Ge as setAssetsBase,
698
- Ke as setMountReader,
699
- Le as themeBridgeScript,
839
+ he as PREVIEW_THEME_MESSAGE,
840
+ rt as defaultXslDir,
841
+ et as detectRenderTarget,
842
+ xt as findSourceMapEntry,
843
+ Le as forcePortablePublication,
844
+ ze as injectRevealBridge,
845
+ nt as injectThemeBridge,
846
+ it as isJspiAvailable,
847
+ Tt as isPreviewTheme,
848
+ Et as isRevealView,
849
+ St as previewThemeMessage,
850
+ $t as renderHtml,
851
+ Xe as revealBridgeScript,
852
+ bt as setAssetsBase,
853
+ yt as setMountReader,
854
+ tt as themeBridgeScript,
700
855
  J as xpathStringLiteral
701
856
  };