@bytechain.cn/colamd 2.7.13-rc.1 → 2.7.13

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 (77) hide show
  1. package/README.md +3 -2
  2. package/README_CN.md +3 -2
  3. package/dist/renderer/assets/{2DXBBFLN-zwCk4Mxf.js → 2DXBBFLN-ALNXA0ap.js} +4 -4
  4. package/dist/renderer/assets/{46IJ22JX-CcgX9r7n.js → 46IJ22JX-CwxSS7s2.js} +5 -5
  5. package/dist/renderer/assets/{4TTDE5I4-DseEAfc2.js → 4TTDE5I4-CCaQ-Qhr.js} +3 -3
  6. package/dist/renderer/assets/{4UF3HTLV-B4wB5AKU.js → 4UF3HTLV-DZOYgtOD.js} +4 -4
  7. package/dist/renderer/assets/{AAXQQPKT-DWob5xGg.js → AAXQQPKT-C-1s3Dqf.js} +8 -8
  8. package/dist/renderer/assets/{AKE5O7KZ-vOSPM9bT.js → AKE5O7KZ-BWT9NTVZ.js} +5 -5
  9. package/dist/renderer/assets/{BNMLP6AG-Cm5E3l75.js → BNMLP6AG-ByQWPes6.js} +7 -7
  10. package/dist/renderer/assets/{DR6PKOQU-BY27B6Tm.js → DR6PKOQU-BJHswFty.js} +3 -3
  11. package/dist/renderer/assets/{E4RJ7UJB-B9Qt1DBg.js → E4RJ7UJB-1Eo8TOcw.js} +6 -6
  12. package/dist/renderer/assets/{ELSXBIJH-Dd46ncmF.js → ELSXBIJH-CTihDDj-.js} +1 -1
  13. package/dist/renderer/assets/{ERTIBQVS-Ctuly7ru.js → ERTIBQVS-VlP2Fl8s.js} +4 -4
  14. package/dist/renderer/assets/{F653G4FO-BAG78YUI.js → F653G4FO-BfRMrcT2.js} +8 -8
  15. package/dist/renderer/assets/{FKCDD66M-BYnIt2s5.js → FKCDD66M-Dx6nCace.js} +1 -1
  16. package/dist/renderer/assets/{FP7KDXVC-1kxF0Go3.js → FP7KDXVC-JX4wVWHb.js} +6 -6
  17. package/dist/renderer/assets/{FT5I3RHX-DBz5zOl-.js → FT5I3RHX-BKmbu0Ww.js} +7 -7
  18. package/dist/renderer/assets/{GY35JXOZ-FFtwzQYZ.js → GY35JXOZ-BVBmqsqd.js} +4 -4
  19. package/dist/renderer/assets/{H5EEJPP2-CzwQt4p_.js → H5EEJPP2-BiAAKO-B.js} +9 -9
  20. package/dist/renderer/assets/{HWDLEDTA-BoEElC3j.js → HWDLEDTA-gm8E-Yqq.js} +1 -1
  21. package/dist/renderer/assets/{JZWSX6AR-BJkYh7st.js → JZWSX6AR-B3v8qMsV.js} +2 -2
  22. package/dist/renderer/assets/{KQOEJWJY-B_gT6pV7.js → KQOEJWJY-BMTjDHaU.js} +1 -1
  23. package/dist/renderer/assets/{KS3BB3KE-Bp4Ml3CE.js → KS3BB3KE-UNhg0tjp.js} +5 -5
  24. package/dist/renderer/assets/{KXJRRZHI-Cpc8aBTp.js → KXJRRZHI-BkjpheXn.js} +3 -3
  25. package/dist/renderer/assets/{MFVI5XKI-tGMP0W95.js → MFVI5XKI-BKnsNeAu.js} +1 -1
  26. package/dist/renderer/assets/{MWY2J62P-Dp5JIcym.js → MWY2J62P-C2fXJt2z.js} +5 -5
  27. package/dist/renderer/assets/{MXGNCBL2-_tOBtwJ3.js → MXGNCBL2-OdlMkSYe.js} +5 -5
  28. package/dist/renderer/assets/{N6DAJLIZ-B0Ni9aJP.js → N6DAJLIZ-DZk90zfQ.js} +2 -2
  29. package/dist/renderer/assets/{NU5M23IW-Dq9-m-cn.js → NU5M23IW-CqrkpDmA.js} +5 -5
  30. package/dist/renderer/assets/{NV4XNBIS-DrbQOkvO.js → NV4XNBIS-CEOfa376.js} +7 -7
  31. package/dist/renderer/assets/{OGLU4SIR-Dk2ltttF.js → OGLU4SIR-CXCAJdcN.js} +5 -5
  32. package/dist/renderer/assets/{OUNS5N76-xZZw3I4z.js → OUNS5N76-CaxK8E0B.js} +6 -6
  33. package/dist/renderer/assets/{PU4ISKXV-C2MIDpGs.js → PU4ISKXV-CkQL-IWp.js} +5 -5
  34. package/dist/renderer/assets/{PUZGS23X-DFCoUCN_.js → PUZGS23X-B-CGNpKZ.js} +1 -1
  35. package/dist/renderer/assets/{Q3IYVLG5-D3j0WKcV.js → Q3IYVLG5-CmIlJsgG.js} +5 -5
  36. package/dist/renderer/assets/{QYHQDLKZ-B0CE5fTR.js → QYHQDLKZ-Br57AbVX.js} +9 -9
  37. package/dist/renderer/assets/{RZSVICHU-BSj4YQaY.js → RZSVICHU-DD3CK-Lf.js} +1 -1
  38. package/dist/renderer/assets/{UEXXS2NB-CsxAjwQ4.js → UEXXS2NB-BNdzFN7f.js} +1 -1
  39. package/dist/renderer/assets/{UHTQJXKL-g4xFs4o0.js → UHTQJXKL-Bsu9QNn2.js} +5 -5
  40. package/dist/renderer/assets/{URA2L2QI-CaQCavyx.js → URA2L2QI-BeIBFAAP.js} +1 -1
  41. package/dist/renderer/assets/{UXCHDUKG-SdHIAded.js → UXCHDUKG-BIB6A9DU.js} +5 -5
  42. package/dist/renderer/assets/{VKNV3BUX-CAufMpR3.js → VKNV3BUX-C_MjwJ6m.js} +6 -6
  43. package/dist/renderer/assets/{VMV7XPHP-BTz-DDJE.js → VMV7XPHP-D0cww3Fb.js} +1 -1
  44. package/dist/renderer/assets/{WEVWDWVA-BTzIOcFk.js → WEVWDWVA-CCDvMBKl.js} +1 -1
  45. package/dist/renderer/assets/{XRRJ35LF-CqWXQoQc.js → XRRJ35LF-CRwwhzJ0.js} +4 -4
  46. package/dist/renderer/assets/{YFKBLVVN-CobClKiQ.js → YFKBLVVN-CH_wsIFW.js} +4 -4
  47. package/dist/renderer/assets/{YHRE5QGZ-DJVf9-VA.js → YHRE5QGZ-_1I4H-Cd.js} +7 -7
  48. package/dist/renderer/assets/{ZF3OVT4B-4h2uC2Nf.js → ZF3OVT4B-BqoSMdR7.js} +3 -3
  49. package/dist/renderer/assets/{index-1hwQGecd.js → index-9gnHkoK7.js} +1 -1
  50. package/dist/renderer/assets/{index-3SmJ-5Dc.js → index-B9mxJmxP.js} +1 -1
  51. package/dist/renderer/assets/{index-BZK9uVRR.js → index-BXn8SSRO.js} +1 -1
  52. package/dist/renderer/assets/{index-D9fcCIeQ.js → index-BgSGixdO.js} +1 -1
  53. package/dist/renderer/assets/{index-DgC9JAzE.js → index-BpqOaUd_.js} +3 -3
  54. package/dist/renderer/assets/{index-lPCBuTEj.js → index-C3jLCWOv.js} +1 -1
  55. package/dist/renderer/assets/{index-BHqRO3CW.js → index-CGWaYts7.js} +1 -1
  56. package/dist/renderer/assets/{index-De7RE4Mo.js → index-CU4eUjnS.js} +1 -1
  57. package/dist/renderer/assets/{index-CBD7Wlx8.js → index-CtO7mpP3.js} +1 -1
  58. package/dist/renderer/assets/{index-B6uVUc9e.js → index-CwH04Tq_.js} +3 -3
  59. package/dist/renderer/assets/{index-BwFsNvvN.css → index-D6SLND4G.css} +1028 -0
  60. package/dist/renderer/assets/{index-B0zpPg3h.js → index-DDMRqKv0.js} +1 -1
  61. package/dist/renderer/assets/{index-CpAWIQHT.js → index-DN-WehV_.js} +1 -1
  62. package/dist/renderer/assets/{index-DAwDMFVz.js → index-Dct5tTjE.js} +1076 -149
  63. package/dist/renderer/assets/{index-qlWwPzMe.js → index-DjTtBl71.js} +1 -1
  64. package/dist/renderer/assets/{index-DkTSflhI.js → index-DtH-vuwI.js} +1 -1
  65. package/dist/renderer/assets/{index-_-G3H01P.js → index-Du6z3bAn.js} +1 -1
  66. package/dist/renderer/assets/{index-BqpGj9MR.js → index-Dz7ZQeU1.js} +1 -1
  67. package/dist/renderer/assets/{index-OOnbRmFx.js → index-QzYbuPVg.js} +1 -1
  68. package/dist/renderer/assets/{index-D6i0AdBR.js → index-alRdsw6J.js} +1 -1
  69. package/dist/renderer/assets/{index-Gr-12Gzq.js → index-cLTU2RS5.js} +1 -1
  70. package/dist/renderer/assets/{index-DsYLJ8It.js → index-gvL3lkzR.js} +3 -3
  71. package/dist/renderer/assets/{lazy-DReExUTA.js → lazy-DVWnMOaz.js} +3 -3
  72. package/dist/renderer/assets/{web-h4mYLq72.js → web-BBDWek-d.js} +1 -1
  73. package/dist/renderer/assets/{web-DErzcmb7.js → web-Cmk7I-i1.js} +2 -2
  74. package/dist/renderer/assets/{web-DocK2vhG.js → web-DkHfYGAr.js} +1 -1
  75. package/dist/renderer/index.html +3 -3
  76. package/package.json +1 -1
  77. package/themes/contract.json +1 -1
@@ -2957,10 +2957,10 @@ class RangeSet {
2957
2957
  for (; ; ) {
2958
2958
  let curTo = Math.min(cursor.to, to);
2959
2959
  if (cursor.point) {
2960
- let active = cursor.activeForPoint(cursor.to);
2961
- let openCount = cursor.pointFrom < from ? active.length + 1 : cursor.point.startSide < 0 ? active.length : Math.min(active.length, openRanges);
2962
- iterator.point(pos, curTo, cursor.point, active, openCount, cursor.pointRank);
2963
- openRanges = Math.min(cursor.openEnd(curTo), active.length);
2960
+ let active2 = cursor.activeForPoint(cursor.to);
2961
+ let openCount = cursor.pointFrom < from ? active2.length + 1 : cursor.point.startSide < 0 ? active2.length : Math.min(active2.length, openRanges);
2962
+ iterator.point(pos, curTo, cursor.point, active2, openCount, cursor.pointRank);
2963
+ openRanges = Math.min(cursor.openEnd(curTo), active2.length);
2964
2964
  } else if (curTo > pos) {
2965
2965
  iterator.span(pos, curTo, cursor.active, openRanges);
2966
2966
  openRanges = cursor.openEnd(curTo);
@@ -3374,14 +3374,14 @@ class SpanCursor {
3374
3374
  activeForPoint(to) {
3375
3375
  if (!this.active.length)
3376
3376
  return this.active;
3377
- let active = [];
3377
+ let active2 = [];
3378
3378
  for (let i = this.active.length - 1; i >= 0; i--) {
3379
3379
  if (this.activeRank[i] < this.pointRank)
3380
3380
  break;
3381
3381
  if (this.activeTo[i] > to || this.activeTo[i] == to && this.active[i].endSide >= this.point.endSide)
3382
- active.push(this.active[i]);
3382
+ active2.push(this.active[i]);
3383
3383
  }
3384
- return active.reverse();
3384
+ return active2.reverse();
3385
3385
  }
3386
3386
  openEnd(to) {
3387
3387
  let open2 = 0;
@@ -3710,7 +3710,7 @@ const ie_upto10 = /* @__PURE__ */ /MSIE \d/.test(nav.userAgent);
3710
3710
  const ie_11up = /* @__PURE__ */ /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nav.userAgent);
3711
3711
  const ie = !!(ie_upto10 || ie_11up || ie_edge);
3712
3712
  const gecko = !ie && /* @__PURE__ */ /gecko\/(\d+)/i.test(nav.userAgent);
3713
- const chrome = !ie && /* @__PURE__ */ /Chrome\/(\d+)/.exec(nav.userAgent);
3713
+ const chrome$1 = !ie && /* @__PURE__ */ /Chrome\/(\d+)/.exec(nav.userAgent);
3714
3714
  const webkit = "webkitFontSmoothing" in doc.documentElement.style;
3715
3715
  const safari = !ie && /* @__PURE__ */ /Apple Computer/.test(nav.vendor);
3716
3716
  const ios = safari && (/* @__PURE__ */ /Mobile\/\w+/.test(nav.userAgent) || nav.maxTouchPoints > 2);
@@ -3722,8 +3722,8 @@ var browser = {
3722
3722
  ie_version: ie_upto10 ? doc.documentMode || 6 : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0,
3723
3723
  gecko,
3724
3724
  gecko_version: gecko ? +(/* @__PURE__ */ /Firefox\/(\d+)/.exec(nav.userAgent) || [0, 0])[1] : 0,
3725
- chrome: !!chrome,
3726
- chrome_version: chrome ? +chrome[1] : 0,
3725
+ chrome: !!chrome$1,
3726
+ chrome_version: chrome$1 ? +chrome$1[1] : 0,
3727
3727
  ios,
3728
3728
  android: /* @__PURE__ */ /Android\b/.test(nav.userAgent),
3729
3729
  webkit,
@@ -4991,11 +4991,11 @@ function getIsolatedRanges(view, line) {
4991
4991
  RangeSet.spans(sets, line.from, line.to, {
4992
4992
  point() {
4993
4993
  },
4994
- span(fromDoc, toDoc, active, open2) {
4994
+ span(fromDoc, toDoc, active2, open2) {
4995
4995
  let from = fromDoc - line.from, to = toDoc - line.from;
4996
4996
  let level = result;
4997
- for (let i = active.length - 1; i >= 0; i--, open2--) {
4998
- let direction = active[i].spec.bidiIsolate, update;
4997
+ for (let i = active2.length - 1; i >= 0; i--, open2--) {
4998
+ let direction = active2[i].spec.bidiIsolate, update;
4999
4999
  if (direction == null)
5000
5000
  direction = autoDirection(line.text, from, to);
5001
5001
  if (open2 > 0 && level.length && (update = level[level.length - 1]).to == from && update.direction == direction) {
@@ -6225,7 +6225,7 @@ class TileUpdate {
6225
6225
  let pendingLineAttrs = null;
6226
6226
  let b = this.builder, markCount = -1;
6227
6227
  let openEnd = RangeSet.spans(this.decorations, from, to, {
6228
- point: (from2, to2, deco, active, openStart, index2) => {
6228
+ point: (from2, to2, deco, active2, openStart, index2) => {
6229
6229
  if (deco instanceof PointDecoration) {
6230
6230
  if (this.disallowBlockEffectsFor[index2]) {
6231
6231
  if (deco.block)
@@ -6233,8 +6233,8 @@ class TileUpdate {
6233
6233
  if (to2 > this.view.state.doc.lineAt(from2).to)
6234
6234
  throw new RangeError("Decorations that replace line breaks may not be specified via plugins");
6235
6235
  }
6236
- markCount = active.length;
6237
- if (openStart > active.length) {
6236
+ markCount = active2.length;
6237
+ if (openStart > active2.length) {
6238
6238
  b.continueWidget(to2 - from2);
6239
6239
  } else {
6240
6240
  let widget = deco.widget || (deco.block ? NullWidget.block : NullWidget.inline);
@@ -6246,7 +6246,7 @@ class TileUpdate {
6246
6246
  b.addBlockWidget(tile);
6247
6247
  } else {
6248
6248
  b.ensureLine(pendingLineAttrs);
6249
- b.addInlineWidget(tile, active, openStart);
6249
+ b.addInlineWidget(tile, active2, openStart);
6250
6250
  }
6251
6251
  }
6252
6252
  pendingLineAttrs = null;
@@ -6256,7 +6256,7 @@ class TileUpdate {
6256
6256
  if (to2 > from2)
6257
6257
  this.text.skip(to2 - from2);
6258
6258
  },
6259
- span: (from2, to2, active, openStart) => {
6259
+ span: (from2, to2, active2, openStart) => {
6260
6260
  for (let pos = from2; pos < to2; ) {
6261
6261
  let chars = this.text.next(Math.min(512, to2 - pos));
6262
6262
  if (chars == null) {
@@ -6265,12 +6265,12 @@ class TileUpdate {
6265
6265
  pos++;
6266
6266
  } else {
6267
6267
  b.ensureLine(pendingLineAttrs);
6268
- b.addText(chars, active, pos == from2 ? openStart : active.length);
6268
+ b.addText(chars, active2, pos == from2 ? openStart : active2.length);
6269
6269
  pos += chars.length;
6270
6270
  }
6271
6271
  pendingLineAttrs = null;
6272
6272
  }
6273
- markCount = active.length;
6273
+ markCount = active2.length;
6274
6274
  }
6275
6275
  });
6276
6276
  if (markCount > -1)
@@ -8258,9 +8258,9 @@ handlers.mousedown = (view, event) => {
8258
8258
  if (mustFocus)
8259
8259
  view.observer.ignore(() => {
8260
8260
  focusPreventScroll(view.contentDOM);
8261
- let active = view.root.activeElement;
8262
- if (active && !active.contains(view.contentDOM))
8263
- active.blur();
8261
+ let active2 = view.root.activeElement;
8262
+ if (active2 && !active2.contains(view.contentDOM))
8263
+ active2.blur();
8264
8264
  });
8265
8265
  let mouseSel = view.inputState.mouseSelection;
8266
8266
  if (mouseSel) {
@@ -32954,7 +32954,7 @@ const PRINT_PALETTE = {
32954
32954
  };
32955
32955
  let pele = null;
32956
32956
  function loadPele() {
32957
- pele ??= __vitePreload(() => import("./lazy-DReExUTA.js").then((n) => n.l), true ? [] : void 0, import.meta.url);
32957
+ pele ??= __vitePreload(() => import("./lazy-DVWnMOaz.js").then((n) => n.l), true ? [] : void 0, import.meta.url);
32958
32958
  return pele;
32959
32959
  }
32960
32960
  function withPrintPalette(svg, palette) {
@@ -32978,43 +32978,49 @@ const zoomHosts = /* @__PURE__ */ new Set();
32978
32978
  function isZoomed(record) {
32979
32979
  return !!record.zoom && record.zoom.scale > record.zoom.fit * 1.001;
32980
32980
  }
32981
- function isDiagramZoomed(host) {
32982
- const record = zooms.get(host);
32981
+ function isDiagramZoomed(host2) {
32982
+ const record = zooms.get(host2);
32983
32983
  return !!record && isZoomed(record);
32984
32984
  }
32985
- function attachDiagramZoom(host) {
32986
- if (zooms.has(host)) return;
32985
+ function attachDiagramZoom(host2) {
32986
+ if (zooms.has(host2)) return;
32987
32987
  const record = { zoom: null };
32988
- zooms.set(host, record);
32989
- zoomHosts.add(host);
32988
+ zooms.set(host2, record);
32989
+ zoomHosts.add(host2);
32990
32990
  void loadPele().then(({ enableZoom }) => {
32991
- if (!host.isConnected) return;
32992
- record.zoom = enableZoom(host, {
32991
+ if (!host2.isConnected) return;
32992
+ record.zoom = enableZoom(host2, {
32993
32993
  labels: isChinese$1() ? { zoomIn: "放大", zoomOut: "缩小", reset: "还原到适合宽度" } : { zoomIn: "Zoom in", zoomOut: "Zoom out", reset: "Reset zoom" }
32994
32994
  });
32995
32995
  });
32996
32996
  }
32997
- function detachDiagramZoom(host) {
32998
- const record = zooms.get(host);
32997
+ function detachDiagramZoom(host2) {
32998
+ const record = zooms.get(host2);
32999
32999
  if (!record) return;
33000
- zooms.delete(host);
33001
- zoomHosts.delete(host);
33000
+ zooms.delete(host2);
33001
+ zoomHosts.delete(host2);
33002
33002
  record.zoom?.destroy();
33003
33003
  }
33004
- function withDiagramZoomPaused(run) {
33004
+ function pauseDiagramZoom() {
33005
33005
  const hidden = [];
33006
- for (const host of zoomHosts) {
33007
- zooms.get(host)?.zoom?.reset();
33008
- const controls = host.querySelector(".pele-zoom");
33006
+ for (const host2 of zoomHosts) {
33007
+ zooms.get(host2)?.zoom?.reset();
33008
+ const controls = host2.querySelector(".pele-zoom");
33009
33009
  if (controls && controls.style.display !== "none") {
33010
33010
  hidden.push({ element: controls, display: controls.style.display });
33011
33011
  controls.style.display = "none";
33012
33012
  }
33013
33013
  }
33014
+ return () => {
33015
+ for (const item of hidden) item.element.style.display = item.display;
33016
+ };
33017
+ }
33018
+ function withDiagramZoomPaused(run) {
33019
+ const restore = pauseDiagramZoom();
33014
33020
  try {
33015
33021
  return run();
33016
33022
  } finally {
33017
- for (const item of hidden) item.element.style.display = item.display;
33023
+ restore();
33018
33024
  }
33019
33025
  }
33020
33026
  const BLOCKED_TAGS = /* @__PURE__ */ new Set([
@@ -33184,13 +33190,13 @@ function hideMarker(state, from, to, ranges, visible = false) {
33184
33190
  const end = next === " " || next === " " ? to + 1 : to;
33185
33191
  ranges.push({ from, to: end, deco: visible ? MARK({ class: "cm-md-marker" }) : hide() });
33186
33192
  }
33187
- function inRange(range, pos) {
33193
+ function inRange$1(range, pos) {
33188
33194
  return !!range && pos >= range.from && pos < range.to;
33189
33195
  }
33190
- function iterateContent(state, front, enter) {
33196
+ function iterateContent$1(state, front, enter) {
33191
33197
  syntaxTree(state).iterate({
33192
33198
  enter: (node) => {
33193
- if (front && node.name !== "Document" && inRange(front, node.from)) return false;
33199
+ if (front && node.name !== "Document" && inRange$1(front, node.from)) return false;
33194
33200
  return enter(node);
33195
33201
  }
33196
33202
  });
@@ -33417,7 +33423,7 @@ class TaskCheckboxWidget extends WidgetType {
33417
33423
  }
33418
33424
  }
33419
33425
  function collectTaskItems(state, ranges, front) {
33420
- iterateContent(state, front, (node) => {
33426
+ iterateContent$1(state, front, (node) => {
33421
33427
  if (node.name !== "TaskMarker") return;
33422
33428
  const raw = state.doc.sliceString(node.from, node.to);
33423
33429
  const checked = /x/i.test(raw);
@@ -33464,8 +33470,8 @@ class MermaidWidget extends WidgetType {
33464
33470
  const target = event.target;
33465
33471
  if (!(target instanceof Element)) return false;
33466
33472
  if (target.closest(".pele-zoom")) return true;
33467
- const host = target.closest(".cm-md-mermaid");
33468
- return !!host && isDiagramZoomed(host);
33473
+ const host2 = target.closest(".cm-md-mermaid");
33474
+ return !!host2 && isDiagramZoomed(host2);
33469
33475
  }
33470
33476
  }
33471
33477
  const POINTER_EVENTS = /* @__PURE__ */ new Set([
@@ -33479,7 +33485,7 @@ const POINTER_EVENTS = /* @__PURE__ */ new Set([
33479
33485
  "touchend"
33480
33486
  ]);
33481
33487
  function collectMermaid(state, text2, ranges, front, zones) {
33482
- iterateContent(state, front, (node) => {
33488
+ iterateContent$1(state, front, (node) => {
33483
33489
  if (node.name !== "FencedCode") return;
33484
33490
  const firstLineEnd = text2.indexOf("\n", node.from);
33485
33491
  if (firstLineEnd === -1) return;
@@ -33668,7 +33674,7 @@ function appendInline(parent, text2, base2) {
33668
33674
  if (last2 < text2.length) write(parent, last2, text2.length);
33669
33675
  }
33670
33676
  function collectTables(state, ranges, front, zones) {
33671
- iterateContent(state, front, (node) => {
33677
+ iterateContent$1(state, front, (node) => {
33672
33678
  if (node.name !== "Table") return;
33673
33679
  zones.push({ from: node.from, to: node.to, kind: "block" });
33674
33680
  if (isBlockActive(state, node.from, node.to)) {
@@ -33678,20 +33684,23 @@ function collectTables(state, ranges, front, zones) {
33678
33684
  ranges.push({
33679
33685
  from: node.from,
33680
33686
  to: node.to,
33687
+ // 表格恒为整行 → 恒为 block 装饰:跨行 inline replace 在增量更新时
33688
+ // widget 不会被重建,改完表格退出源码后整块会消失(见 collectMath)。
33681
33689
  deco: Decoration.replace({
33682
33690
  widget: new TableWidget(
33683
33691
  state.doc.sliceString(node.from, node.to),
33684
33692
  state.field(documentFileUrlField, false) ?? documentFileUrl,
33685
33693
  node.from,
33686
33694
  node.to
33687
- )
33695
+ ),
33696
+ block: true
33688
33697
  })
33689
33698
  });
33690
33699
  return false;
33691
33700
  });
33692
33701
  }
33693
33702
  function collectLinks(state, ranges, front) {
33694
- iterateContent(state, front, (node) => {
33703
+ iterateContent$1(state, front, (node) => {
33695
33704
  if (node.name !== "Link") return;
33696
33705
  const url = node.node.getChild("URL");
33697
33706
  if (!url) return false;
@@ -33737,7 +33746,7 @@ function collectFootnotes(state, text2, ranges, front) {
33737
33746
  while ((match = FOOTNOTE_REF_RE.exec(text2)) !== null) {
33738
33747
  const from = match.index;
33739
33748
  const to = from + match[0].length;
33740
- if (front && inRange(front, from)) continue;
33749
+ if (front && inRange$1(front, from)) continue;
33741
33750
  if (definitions.has(match[1]) === false && numbers.has(match[1]) === false) continue;
33742
33751
  ranges.push({
33743
33752
  from,
@@ -33748,7 +33757,7 @@ function collectFootnotes(state, text2, ranges, front) {
33748
33757
  for (let n = 1; n <= state.doc.lines; n++) {
33749
33758
  const line = state.doc.line(n);
33750
33759
  if (!/^ {0,3}\[\^[^\]\s]+\]:/.test(line.text)) continue;
33751
- if (front && inRange(front, line.from)) continue;
33760
+ if (front && inRange$1(front, line.from)) continue;
33752
33761
  ranges.push({ from: line.from, to: line.from, deco: BLOCK("cm-md-footnote-def") });
33753
33762
  }
33754
33763
  }
@@ -33773,7 +33782,7 @@ class HTMLWidget extends WidgetType {
33773
33782
  }
33774
33783
  function collectHTML(state, ranges, front, zones) {
33775
33784
  const paired = /* @__PURE__ */ new Set();
33776
- iterateContent(state, front, (node) => {
33785
+ iterateContent$1(state, front, (node) => {
33777
33786
  const block = node.name === "HTMLBlock";
33778
33787
  if (!block && node.name !== "HTMLTag") return;
33779
33788
  if (block) zones.push({ from: node.from, to: node.to, kind: "block" });
@@ -33794,7 +33803,12 @@ function collectHTML(state, ranges, front, zones) {
33794
33803
  ranges.push({
33795
33804
  from: node.from,
33796
33805
  to: node.to,
33797
- deco: Decoration.replace({ widget: new HTMLWidget(state.doc.sliceString(node.from, node.to), block, node.from, node.to) })
33806
+ // HTML 块跨行 → block 装饰:跨行 inline replace 在增量更新时 widget 不会
33807
+ // 被重建,退出源码后整块消失(见 collectMath)。行内标签不跨行,保持 inline。
33808
+ deco: Decoration.replace({
33809
+ widget: new HTMLWidget(state.doc.sliceString(node.from, node.to), block, node.from, node.to),
33810
+ block: block && state.doc.lineAt(node.from).from === node.from && state.doc.lineAt(Math.min(node.to, state.doc.length)).to === node.to
33811
+ })
33798
33812
  });
33799
33813
  return false;
33800
33814
  });
@@ -33843,7 +33857,7 @@ function codeInsideFence(state, node) {
33843
33857
  }
33844
33858
  function collectImages(state, ranges, front) {
33845
33859
  const base2 = state.field(documentFileUrlField, false) ?? documentFileUrl;
33846
- iterateContent(state, front, (node) => {
33860
+ iterateContent$1(state, front, (node) => {
33847
33861
  if (node.name !== "Image") return;
33848
33862
  if (isActiveRange(state, node.from, node.to)) ;
33849
33863
  const source = state.doc.sliceString(node.from, node.to);
@@ -33858,7 +33872,7 @@ function collectImages(state, ranges, front) {
33858
33872
  });
33859
33873
  }
33860
33874
  function collectBlocks(state, ranges, front) {
33861
- iterateContent(state, front, (node) => {
33875
+ iterateContent$1(state, front, (node) => {
33862
33876
  switch (node.name) {
33863
33877
  case "Blockquote": {
33864
33878
  pushBlockLines(state, node.from, node.to, "cm-md-blockquote", ranges);
@@ -33937,10 +33951,10 @@ function collectBlocks(state, ranges, front) {
33937
33951
  }
33938
33952
  const URL_STOP = /[\u2E80-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3000-\u303F\uFF00-\uFFEF]/;
33939
33953
  function collectInline(state, ranges, front) {
33940
- iterateContent(state, front, (node) => {
33954
+ iterateContent$1(state, front, (node) => {
33941
33955
  const from = node.from;
33942
33956
  const to = node.to;
33943
- const active = isActiveLine();
33957
+ const active2 = isActiveLine();
33944
33958
  switch (node.name) {
33945
33959
  case "ATXHeading1":
33946
33960
  case "ATXHeading2":
@@ -33966,7 +33980,7 @@ function collectInline(state, ranges, front) {
33966
33980
  break;
33967
33981
  }
33968
33982
  case "HeaderMark": {
33969
- hideMarker(state, from, to, ranges, active);
33983
+ hideMarker(state, from, to, ranges, active2);
33970
33984
  break;
33971
33985
  }
33972
33986
  case "InlineCode": {
@@ -33999,7 +34013,7 @@ const PAGE_CLASS_PREFIX = "cm-md-page-";
33999
34013
  const PAGE_START_CLASS = "cm-md-page-start";
34000
34014
  function collectPages(state, ranges, front) {
34001
34015
  const breaks = [];
34002
- iterateContent(state, front, (node) => {
34016
+ iterateContent$1(state, front, (node) => {
34003
34017
  if (node.name !== "HorizontalRule") return;
34004
34018
  breaks.push(state.doc.lineAt(node.from).number);
34005
34019
  });
@@ -34037,7 +34051,7 @@ function activeZonesKey(state, zones) {
34037
34051
  }
34038
34052
  return parts.join("|");
34039
34053
  }
34040
- function buildDecorations(state, flash) {
34054
+ function buildDecorations$1(state, flash) {
34041
34055
  const ranges = [];
34042
34056
  const zones = [];
34043
34057
  const text2 = state.doc.toString();
@@ -34067,7 +34081,7 @@ function buildDecorations(state, flash) {
34067
34081
  return deco;
34068
34082
  }
34069
34083
  const livePreviewField = StateField.define({
34070
- create: (state) => buildDecorations(state, null),
34084
+ create: (state) => buildDecorations$1(state, null),
34071
34085
  update(deco, tr) {
34072
34086
  const flash = tr.effects.find((effect) => effect.is(headingFlashEffect));
34073
34087
  const flashValue = flash ? flash.value : currentFlash;
@@ -34083,7 +34097,7 @@ const livePreviewField = StateField.define({
34083
34097
  return deco;
34084
34098
  }
34085
34099
  }
34086
- return buildDecorations(tr.state, flashValue);
34100
+ return buildDecorations$1(tr.state, flashValue);
34087
34101
  },
34088
34102
  provide: (field) => EditorView.decorations.from(field)
34089
34103
  });
@@ -34469,9 +34483,9 @@ let fieldMarker = /* @__PURE__ */ Decoration.widget({ widget: /* @__PURE__ */ ne
34469
34483
  }() });
34470
34484
  let fieldRange = /* @__PURE__ */ Decoration.mark({ class: "cm-snippetField" });
34471
34485
  class ActiveSnippet {
34472
- constructor(ranges, active) {
34486
+ constructor(ranges, active2) {
34473
34487
  this.ranges = ranges;
34474
- this.active = active;
34488
+ this.active = active2;
34475
34489
  this.deco = Decoration.set(ranges.map((r) => (r.from == r.to ? fieldMarker : fieldRange).range(r.from, r.to)), true);
34476
34490
  }
34477
34491
  map(changes) {
@@ -34529,8 +34543,8 @@ function snippet(template) {
34529
34543
  if (ranges.length)
34530
34544
  spec.selection = fieldSelection(ranges, 0);
34531
34545
  if (ranges.some((r) => r.field > 0)) {
34532
- let active = new ActiveSnippet(ranges, 0);
34533
- let effects = spec.effects = [setActive.of(active)];
34546
+ let active2 = new ActiveSnippet(ranges, 0);
34547
+ let effects = spec.effects = [setActive.of(active2)];
34534
34548
  if (editor.state.field(snippetState, false) === void 0)
34535
34549
  effects.push(StateEffect.appendConfig.of([snippetState, addSnippetKeymap, snippetPointerHandler, baseTheme]));
34536
34550
  }
@@ -34539,21 +34553,21 @@ function snippet(template) {
34539
34553
  }
34540
34554
  function moveField(dir) {
34541
34555
  return ({ state, dispatch }) => {
34542
- let active = state.field(snippetState, false);
34543
- if (!active || dir < 0 && active.active == 0)
34556
+ let active2 = state.field(snippetState, false);
34557
+ if (!active2 || dir < 0 && active2.active == 0)
34544
34558
  return false;
34545
- let next = active.active + dir, last2 = dir > 0 && !active.ranges.some((r) => r.field == next + dir);
34559
+ let next = active2.active + dir, last2 = dir > 0 && !active2.ranges.some((r) => r.field == next + dir);
34546
34560
  dispatch(state.update({
34547
- selection: fieldSelection(active.ranges, next),
34548
- effects: setActive.of(last2 ? null : new ActiveSnippet(active.ranges, next)),
34561
+ selection: fieldSelection(active2.ranges, next),
34562
+ effects: setActive.of(last2 ? null : new ActiveSnippet(active2.ranges, next)),
34549
34563
  scrollIntoView: true
34550
34564
  }));
34551
34565
  return true;
34552
34566
  };
34553
34567
  }
34554
34568
  const clearSnippet = ({ state, dispatch }) => {
34555
- let active = state.field(snippetState, false);
34556
- if (!active)
34569
+ let active2 = state.field(snippetState, false);
34570
+ if (!active2)
34557
34571
  return false;
34558
34572
  dispatch(state.update({ effects: setActive.of(null) }));
34559
34573
  return true;
@@ -34575,15 +34589,15 @@ function snippetCompletion(template, completion) {
34575
34589
  }
34576
34590
  const snippetPointerHandler = /* @__PURE__ */ EditorView.domEventHandlers({
34577
34591
  mousedown(event, view) {
34578
- let active = view.state.field(snippetState, false), pos;
34579
- if (!active || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)
34592
+ let active2 = view.state.field(snippetState, false), pos;
34593
+ if (!active2 || (pos = view.posAtCoords({ x: event.clientX, y: event.clientY })) == null)
34580
34594
  return false;
34581
- let match = active.ranges.find((r) => r.from <= pos && r.to >= pos);
34582
- if (!match || match.field == active.active)
34595
+ let match = active2.ranges.find((r) => r.from <= pos && r.to >= pos);
34596
+ if (!match || match.field == active2.active)
34583
34597
  return false;
34584
34598
  view.dispatch({
34585
- selection: fieldSelection(active.ranges, match.field),
34586
- effects: setActive.of(active.ranges.some((r) => r.field > match.field) ? new ActiveSnippet(active.ranges, match.field) : null),
34599
+ selection: fieldSelection(active2.ranges, match.field),
34600
+ effects: setActive.of(active2.ranges.some((r) => r.field > match.field) ? new ActiveSnippet(active2.ranges, match.field) : null),
34587
34601
  scrollIntoView: true
34588
34602
  });
34589
34603
  return true;
@@ -41780,7 +41794,7 @@ function legacy(parser2) {
41780
41794
  return new LanguageSupport(StreamLanguage.define(parser2));
41781
41795
  }
41782
41796
  function sql(dialectName) {
41783
- return __vitePreload(() => import("./index-CpAWIQHT.js"), true ? [] : void 0, import.meta.url).then((m) => m.sql({ dialect: m[dialectName] }));
41797
+ return __vitePreload(() => import("./index-DN-WehV_.js"), true ? [] : void 0, import.meta.url).then((m) => m.sql({ dialect: m[dialectName] }));
41784
41798
  }
41785
41799
  const languages = [
41786
41800
  // New-style language modes
@@ -41788,7 +41802,7 @@ const languages = [
41788
41802
  name: "C",
41789
41803
  extensions: ["c", "h", "ino"],
41790
41804
  load() {
41791
- return __vitePreload(() => import("./index-lPCBuTEj.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41805
+ return __vitePreload(() => import("./index-C3jLCWOv.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41792
41806
  }
41793
41807
  }),
41794
41808
  /* @__PURE__ */ LanguageDescription.of({
@@ -41796,7 +41810,7 @@ const languages = [
41796
41810
  alias: ["cpp"],
41797
41811
  extensions: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"],
41798
41812
  load() {
41799
- return __vitePreload(() => import("./index-lPCBuTEj.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41813
+ return __vitePreload(() => import("./index-C3jLCWOv.js"), true ? [] : void 0, import.meta.url).then((m) => m.cpp());
41800
41814
  }
41801
41815
  }),
41802
41816
  /* @__PURE__ */ LanguageDescription.of({
@@ -41818,7 +41832,7 @@ const languages = [
41818
41832
  name: "Go",
41819
41833
  extensions: ["go"],
41820
41834
  load() {
41821
- return __vitePreload(() => import("./index-Gr-12Gzq.js"), true ? [] : void 0, import.meta.url).then((m) => m.go());
41835
+ return __vitePreload(() => import("./index-cLTU2RS5.js"), true ? [] : void 0, import.meta.url).then((m) => m.go());
41822
41836
  }
41823
41837
  }),
41824
41838
  /* @__PURE__ */ LanguageDescription.of({
@@ -41833,7 +41847,7 @@ const languages = [
41833
41847
  name: "Java",
41834
41848
  extensions: ["java"],
41835
41849
  load() {
41836
- return __vitePreload(() => import("./index-BZK9uVRR.js"), true ? [] : void 0, import.meta.url).then((m) => m.java());
41850
+ return __vitePreload(() => import("./index-BXn8SSRO.js"), true ? [] : void 0, import.meta.url).then((m) => m.java());
41837
41851
  }
41838
41852
  }),
41839
41853
  /* @__PURE__ */ LanguageDescription.of({
@@ -41848,7 +41862,7 @@ const languages = [
41848
41862
  name: "Jinja",
41849
41863
  extensions: ["j2", "jinja", "jinja2"],
41850
41864
  load() {
41851
- return __vitePreload(() => import("./index-_-G3H01P.js"), true ? [] : void 0, import.meta.url).then((m) => m.jinja());
41865
+ return __vitePreload(() => import("./index-Du6z3bAn.js"), true ? [] : void 0, import.meta.url).then((m) => m.jinja());
41852
41866
  }
41853
41867
  }),
41854
41868
  /* @__PURE__ */ LanguageDescription.of({
@@ -41856,7 +41870,7 @@ const languages = [
41856
41870
  alias: ["json5"],
41857
41871
  extensions: ["json", "map"],
41858
41872
  load() {
41859
- return __vitePreload(() => import("./index-DkTSflhI.js"), true ? [] : void 0, import.meta.url).then((m) => m.json());
41873
+ return __vitePreload(() => import("./index-DtH-vuwI.js"), true ? [] : void 0, import.meta.url).then((m) => m.json());
41860
41874
  }
41861
41875
  }),
41862
41876
  /* @__PURE__ */ LanguageDescription.of({
@@ -41870,14 +41884,14 @@ const languages = [
41870
41884
  name: "LESS",
41871
41885
  extensions: ["less"],
41872
41886
  load() {
41873
- return __vitePreload(() => import("./index-D6i0AdBR.js"), true ? [] : void 0, import.meta.url).then((m) => m.less());
41887
+ return __vitePreload(() => import("./index-alRdsw6J.js"), true ? [] : void 0, import.meta.url).then((m) => m.less());
41874
41888
  }
41875
41889
  }),
41876
41890
  /* @__PURE__ */ LanguageDescription.of({
41877
41891
  name: "Liquid",
41878
41892
  extensions: ["liquid"],
41879
41893
  load() {
41880
- return __vitePreload(() => import("./index-De7RE4Mo.js"), true ? [] : void 0, import.meta.url).then((m) => m.liquid());
41894
+ return __vitePreload(() => import("./index-CU4eUjnS.js"), true ? [] : void 0, import.meta.url).then((m) => m.liquid());
41881
41895
  }
41882
41896
  }),
41883
41897
  /* @__PURE__ */ LanguageDescription.of({
@@ -41909,7 +41923,7 @@ const languages = [
41909
41923
  name: "PHP",
41910
41924
  extensions: ["php", "php3", "php4", "php5", "php7", "phtml"],
41911
41925
  load() {
41912
- return __vitePreload(() => import("./index-qlWwPzMe.js"), true ? [] : void 0, import.meta.url).then((m) => m.php());
41926
+ return __vitePreload(() => import("./index-DjTtBl71.js"), true ? [] : void 0, import.meta.url).then((m) => m.php());
41913
41927
  }
41914
41928
  }),
41915
41929
  /* @__PURE__ */ LanguageDescription.of({
@@ -41930,28 +41944,28 @@ const languages = [
41930
41944
  extensions: ["BUILD", "bzl", "py", "pyw"],
41931
41945
  filename: /^(BUCK|BUILD)$/,
41932
41946
  load() {
41933
- return __vitePreload(() => import("./index-OOnbRmFx.js"), true ? [] : void 0, import.meta.url).then((m) => m.python());
41947
+ return __vitePreload(() => import("./index-QzYbuPVg.js"), true ? [] : void 0, import.meta.url).then((m) => m.python());
41934
41948
  }
41935
41949
  }),
41936
41950
  /* @__PURE__ */ LanguageDescription.of({
41937
41951
  name: "Rust",
41938
41952
  extensions: ["rs"],
41939
41953
  load() {
41940
- return __vitePreload(() => import("./index-1hwQGecd.js"), true ? [] : void 0, import.meta.url).then((m) => m.rust());
41954
+ return __vitePreload(() => import("./index-9gnHkoK7.js"), true ? [] : void 0, import.meta.url).then((m) => m.rust());
41941
41955
  }
41942
41956
  }),
41943
41957
  /* @__PURE__ */ LanguageDescription.of({
41944
41958
  name: "Sass",
41945
41959
  extensions: ["sass"],
41946
41960
  load() {
41947
- return __vitePreload(() => import("./index-D9fcCIeQ.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass({ indented: true }));
41961
+ return __vitePreload(() => import("./index-BgSGixdO.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass({ indented: true }));
41948
41962
  }
41949
41963
  }),
41950
41964
  /* @__PURE__ */ LanguageDescription.of({
41951
41965
  name: "SCSS",
41952
41966
  extensions: ["scss"],
41953
41967
  load() {
41954
- return __vitePreload(() => import("./index-D9fcCIeQ.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass());
41968
+ return __vitePreload(() => import("./index-BgSGixdO.js"), true ? [] : void 0, import.meta.url).then((m) => m.sass());
41955
41969
  }
41956
41970
  }),
41957
41971
  /* @__PURE__ */ LanguageDescription.of({
@@ -41986,7 +42000,7 @@ const languages = [
41986
42000
  name: "WebAssembly",
41987
42001
  extensions: ["wat", "wast"],
41988
42002
  load() {
41989
- return __vitePreload(() => import("./index-3SmJ-5Dc.js"), true ? [] : void 0, import.meta.url).then((m) => m.wast());
42003
+ return __vitePreload(() => import("./index-B9mxJmxP.js"), true ? [] : void 0, import.meta.url).then((m) => m.wast());
41990
42004
  }
41991
42005
  }),
41992
42006
  /* @__PURE__ */ LanguageDescription.of({
@@ -41994,7 +42008,7 @@ const languages = [
41994
42008
  alias: ["rss", "wsdl", "xsd"],
41995
42009
  extensions: ["xml", "xsl", "xsd", "svg"],
41996
42010
  load() {
41997
- return __vitePreload(() => import("./index-BqpGj9MR.js"), true ? [] : void 0, import.meta.url).then((m) => m.xml());
42011
+ return __vitePreload(() => import("./index-Dz7ZQeU1.js"), true ? [] : void 0, import.meta.url).then((m) => m.xml());
41998
42012
  }
41999
42013
  }),
42000
42014
  /* @__PURE__ */ LanguageDescription.of({
@@ -42002,7 +42016,7 @@ const languages = [
42002
42016
  alias: ["yml"],
42003
42017
  extensions: ["yaml", "yml"],
42004
42018
  load() {
42005
- return __vitePreload(() => import("./index-BHqRO3CW.js"), true ? [] : void 0, import.meta.url).then((m) => m.yaml());
42019
+ return __vitePreload(() => import("./index-CGWaYts7.js"), true ? [] : void 0, import.meta.url).then((m) => m.yaml());
42006
42020
  }
42007
42021
  }),
42008
42022
  // Legacy modes ported from CodeMirror 5
@@ -42791,13 +42805,13 @@ const languages = [
42791
42805
  name: "Vue",
42792
42806
  extensions: ["vue"],
42793
42807
  load() {
42794
- return __vitePreload(() => import("./index-CBD7Wlx8.js"), true ? [] : void 0, import.meta.url).then((m) => m.vue());
42808
+ return __vitePreload(() => import("./index-CtO7mpP3.js"), true ? [] : void 0, import.meta.url).then((m) => m.vue());
42795
42809
  }
42796
42810
  }),
42797
42811
  /* @__PURE__ */ LanguageDescription.of({
42798
42812
  name: "Angular Template",
42799
42813
  load() {
42800
- return __vitePreload(() => import("./index-B0zpPg3h.js"), true ? [] : void 0, import.meta.url).then((m) => m.angular());
42814
+ return __vitePreload(() => import("./index-DDMRqKv0.js"), true ? [] : void 0, import.meta.url).then((m) => m.angular());
42801
42815
  }
42802
42816
  })
42803
42817
  ];
@@ -43133,6 +43147,573 @@ const cursorColors = [
43133
43147
  return classes.length ? { class: classes.join(" ") } : {};
43134
43148
  })
43135
43149
  ];
43150
+ const LAYOUT_RE = /^<!--\s*slide\s*:\s*([a-z][a-z0-9-]*)\b([\s\S]*?)-->$/;
43151
+ const DECK_BLOCK_RE = /^<!--\s*deck(?:\s+([\s\S]*?))?-->$/;
43152
+ const PAGE_FIELD_RE = /^([a-z][a-z0-9-]*)\s*:\s*(.+)$/;
43153
+ const PAGE_FIELD_KEYS = /* @__PURE__ */ new Set(["kicker", "label", "chapter"]);
43154
+ const DECK_FIELD_KEYS = /* @__PURE__ */ new Set(["logo", "brand", "title", "meta"]);
43155
+ const CSS_RE = /^<!--\s*slide-css\b\s*([\s\S]*?)-->$/;
43156
+ const JS_RE = /^<!--\s*slide-js\b\s*([\s\S]*?)-->$/;
43157
+ const PAGE_KEY_RE = /^<!--\s*slide-(kicker|label|chapter)\s*:\s*([\s\S]*?)-->$/;
43158
+ const DECK_RE = /^<!--\s*deck-(logo|brand|title|meta)\s*:\s*([\s\S]*?)-->$/;
43159
+ function inRange(range, at) {
43160
+ return at >= range.from && at < range.to;
43161
+ }
43162
+ function iterateContent(state, front, enter) {
43163
+ syntaxTree(state).iterate({
43164
+ enter: (node) => {
43165
+ if (front && node.name !== "Document" && inRange(front, node.from)) return false;
43166
+ return enter(node);
43167
+ }
43168
+ });
43169
+ }
43170
+ function pageOfLines(state, front) {
43171
+ const breaks = [];
43172
+ iterateContent(state, front, (node) => {
43173
+ if (node.name !== "HorizontalRule") return;
43174
+ breaks.push(state.doc.lineAt(node.from).number);
43175
+ });
43176
+ const pageOf = new Array(state.doc.lines);
43177
+ let page = 0;
43178
+ let nextBreak = 0;
43179
+ for (let n = 1; n <= state.doc.lines; n++) {
43180
+ pageOf[n - 1] = page;
43181
+ if (nextBreak < breaks.length && breaks[nextBreak] === n) {
43182
+ page++;
43183
+ nextBreak++;
43184
+ }
43185
+ }
43186
+ return pageOf;
43187
+ }
43188
+ function firstContentLines(state, pageOf, commentLines) {
43189
+ const first = /* @__PURE__ */ new Map();
43190
+ for (let n = 1; n <= state.doc.lines; n++) {
43191
+ const page = pageOf[n - 1];
43192
+ if (first.has(page)) continue;
43193
+ if (state.doc.line(n).text.trim() === "") continue;
43194
+ if (/^ {0,3}(?:---|\*\*\*|___)\s*$/.test(state.doc.line(n).text)) continue;
43195
+ if (commentLines.has(n)) continue;
43196
+ first.set(page, n);
43197
+ }
43198
+ return first;
43199
+ }
43200
+ function lineRange(fromLine, toLine) {
43201
+ const lines = [];
43202
+ for (let n = fromLine; n <= toLine; n++) lines.push(n);
43203
+ return lines;
43204
+ }
43205
+ function isNestedBlock(node) {
43206
+ let parent = node.node.parent;
43207
+ while (parent) {
43208
+ if (parent.name === "ListItem" || parent.name === "Blockquote" || parent.name === "Table") return true;
43209
+ parent = parent.parent;
43210
+ }
43211
+ return false;
43212
+ }
43213
+ function collectRoles(state, front, pageOf, directives) {
43214
+ const headings = /* @__PURE__ */ new Map();
43215
+ const paragraphs = /* @__PURE__ */ new Map();
43216
+ iterateContent(state, front, (node) => {
43217
+ const isHeading2 = /^ATXHeading[1-6]$/.test(node.name);
43218
+ if (!isHeading2 && node.name !== "Paragraph") return;
43219
+ if (isNestedBlock(node)) return;
43220
+ const fromLine = state.doc.lineAt(node.from).number;
43221
+ const toLine = state.doc.lineAt(Math.max(node.from, node.to - 1)).number;
43222
+ const page = pageOf[fromLine - 1];
43223
+ const range = { from: node.from, to: node.to, fromLine, toLine };
43224
+ if (isHeading2) {
43225
+ if (!headings.has(page)) headings.set(page, range);
43226
+ return;
43227
+ }
43228
+ const list = paragraphs.get(page);
43229
+ if (list) list.push(range);
43230
+ else paragraphs.set(page, [range]);
43231
+ });
43232
+ const roles = /* @__PURE__ */ new Map();
43233
+ for (const [page, heading2] of headings) {
43234
+ const paras = paragraphs.get(page) ?? [];
43235
+ const lead = paras.find((p) => p.from > heading2.to);
43236
+ const before = paras.filter((p) => p.to < heading2.from).pop();
43237
+ const role = {
43238
+ titleLines: lineRange(heading2.fromLine, heading2.toLine),
43239
+ leadLines: lead ? lineRange(lead.fromLine, lead.toLine) : [],
43240
+ kickerLines: []
43241
+ };
43242
+ const dirs = directives.get(page);
43243
+ if (!dirs?.kicker && before) {
43244
+ const text2 = state.doc.lineAt(before.from).text.trim();
43245
+ if (text2) {
43246
+ ensure(directives, page).kicker = text2;
43247
+ role.kickerLines = lineRange(before.fromLine, before.toLine);
43248
+ }
43249
+ }
43250
+ roles.set(page, role);
43251
+ }
43252
+ return roles;
43253
+ }
43254
+ function applyFields(source, keys2, apply) {
43255
+ for (const raw of source.split("\n")) {
43256
+ const line = raw.trim();
43257
+ if (!line) continue;
43258
+ const hit = PAGE_FIELD_RE.exec(line);
43259
+ if (!hit || !keys2.has(hit[1])) continue;
43260
+ const value = hit[2].replace(/-->\s*$/, "").trim();
43261
+ if (value) apply(hit[1], value);
43262
+ }
43263
+ }
43264
+ function scanSlideDirectives(state) {
43265
+ const text2 = state.doc.toString();
43266
+ const front = frontmatterRange(text2);
43267
+ const pageOf = pageOfLines(state, front);
43268
+ const directives = /* @__PURE__ */ new Map();
43269
+ const linesByPage = /* @__PURE__ */ new Map();
43270
+ const directiveLines = [];
43271
+ const deck = {};
43272
+ const comments = [];
43273
+ const commentLines = /* @__PURE__ */ new Set();
43274
+ for (let n = 1; n <= state.doc.lines; n++) {
43275
+ const page = pageOf[n - 1];
43276
+ const list = linesByPage.get(page);
43277
+ if (list) list.push(n);
43278
+ else linesByPage.set(page, [n]);
43279
+ }
43280
+ iterateContent(state, front, (node) => {
43281
+ if (node.name !== "CommentBlock" && node.name !== "HTMLBlock") return;
43282
+ const source = state.doc.sliceString(node.from, node.to).trim();
43283
+ if (!source.startsWith("<!--")) return;
43284
+ const fromLine = state.doc.lineAt(node.from).number;
43285
+ const toLine = state.doc.lineAt(Math.max(node.from, node.to - 1)).number;
43286
+ comments.push({ source, from: node.from, to: node.to, fromLine, toLine, page: pageOf[fromLine - 1] });
43287
+ for (let n = fromLine; n <= toLine; n++) commentLines.add(n);
43288
+ });
43289
+ const firstContent = firstContentLines(state, pageOf, commentLines);
43290
+ for (const comment2 of comments) {
43291
+ const { source, fromLine, toLine, page } = comment2;
43292
+ const layout2 = LAYOUT_RE.exec(source);
43293
+ if (layout2) {
43294
+ pushAll(directiveLines, fromLine, toLine);
43295
+ const content2 = firstContent.get(page);
43296
+ if (content2 === void 0 || fromLine < content2) {
43297
+ const dirs = ensure(directives, page);
43298
+ dirs.layout = layout2[1];
43299
+ applyFields(layout2[2], PAGE_FIELD_KEYS, (key, value) => {
43300
+ dirs[key] = value;
43301
+ });
43302
+ }
43303
+ continue;
43304
+ }
43305
+ const deckBlock = DECK_BLOCK_RE.exec(source);
43306
+ if (deckBlock) {
43307
+ pushAll(directiveLines, fromLine, toLine);
43308
+ applyFields(deckBlock[1] ?? "", DECK_FIELD_KEYS, (key, value) => {
43309
+ deck[key] = value;
43310
+ });
43311
+ continue;
43312
+ }
43313
+ const pageKey = PAGE_KEY_RE.exec(source);
43314
+ if (pageKey) {
43315
+ pushAll(directiveLines, fromLine, toLine);
43316
+ ensure(directives, page)[pageKey[1]] = pageKey[2].replace(/\s+/g, " ").trim();
43317
+ continue;
43318
+ }
43319
+ const deckHit = DECK_RE.exec(source);
43320
+ if (deckHit) {
43321
+ pushAll(directiveLines, fromLine, toLine);
43322
+ deck[deckHit[1]] = deckHit[2].trim();
43323
+ continue;
43324
+ }
43325
+ const css2 = CSS_RE.exec(source);
43326
+ if (css2) {
43327
+ pushAll(directiveLines, fromLine, toLine);
43328
+ ensure(directives, page).css.push(css2[1].trim());
43329
+ continue;
43330
+ }
43331
+ const js = JS_RE.exec(source);
43332
+ if (js) {
43333
+ pushAll(directiveLines, fromLine, toLine);
43334
+ ensure(directives, page).js.push(js[1].trim());
43335
+ }
43336
+ }
43337
+ const roles = collectRoles(state, front, pageOf, directives);
43338
+ return { directives, linesByPage, directiveLines, deck, roles };
43339
+ }
43340
+ function pushAll(lines, fromLine, toLine) {
43341
+ for (let n = fromLine; n <= toLine; n++) lines.push(n);
43342
+ }
43343
+ function ensure(map, page) {
43344
+ let dirs = map.get(page);
43345
+ if (!dirs) {
43346
+ dirs = { css: [], js: [] };
43347
+ map.set(page, dirs);
43348
+ }
43349
+ return dirs;
43350
+ }
43351
+ let snapshot = /* @__PURE__ */ new Map();
43352
+ let deckSnapshot = {};
43353
+ let pageCountSnapshot = 0;
43354
+ let documentBaseSnapshot = null;
43355
+ function publishSlideDirectives(directives) {
43356
+ snapshot = directives;
43357
+ }
43358
+ function getSlideDirectives() {
43359
+ return snapshot;
43360
+ }
43361
+ function publishDeckChrome(deck, pageCount) {
43362
+ deckSnapshot = deck;
43363
+ pageCountSnapshot = pageCount;
43364
+ }
43365
+ function getDeckChrome() {
43366
+ return deckSnapshot;
43367
+ }
43368
+ function getDeckPageCount() {
43369
+ return pageCountSnapshot;
43370
+ }
43371
+ function publishDocumentBase(url) {
43372
+ documentBaseSnapshot = url;
43373
+ }
43374
+ function getDocumentBase() {
43375
+ return documentBaseSnapshot;
43376
+ }
43377
+ const SAFE_PROPERTY = /* @__PURE__ */ new Set([
43378
+ "text-align",
43379
+ "text-decoration",
43380
+ "text-transform",
43381
+ "text-indent",
43382
+ "text-shadow",
43383
+ "text-underline-offset",
43384
+ "text-justify",
43385
+ "text-orientation",
43386
+ "text-rendering",
43387
+ "color",
43388
+ "opacity",
43389
+ "visibility",
43390
+ "filter",
43391
+ "backdrop-filter",
43392
+ "mix-blend-mode",
43393
+ "isolation",
43394
+ "background",
43395
+ "background-color",
43396
+ "background-image",
43397
+ "background-size",
43398
+ "background-position",
43399
+ "background-repeat",
43400
+ "background-clip",
43401
+ "background-origin",
43402
+ "background-blend-mode",
43403
+ "font",
43404
+ "font-size",
43405
+ "font-family",
43406
+ "font-weight",
43407
+ "font-style",
43408
+ "font-variant",
43409
+ "font-stretch",
43410
+ "line-height",
43411
+ "letter-spacing",
43412
+ "word-spacing",
43413
+ "white-space",
43414
+ "word-break",
43415
+ "overflow-wrap",
43416
+ "margin",
43417
+ "margin-top",
43418
+ "margin-right",
43419
+ "margin-bottom",
43420
+ "margin-left",
43421
+ "padding",
43422
+ "padding-top",
43423
+ "padding-right",
43424
+ "padding-bottom",
43425
+ "padding-left",
43426
+ "border",
43427
+ "border-top",
43428
+ "border-right",
43429
+ "border-bottom",
43430
+ "border-left",
43431
+ "border-width",
43432
+ "border-style",
43433
+ "border-color",
43434
+ "border-radius",
43435
+ "border-image",
43436
+ "border-top-width",
43437
+ "border-right-width",
43438
+ "border-bottom-width",
43439
+ "border-left-width",
43440
+ "border-top-color",
43441
+ "border-right-color",
43442
+ "border-bottom-color",
43443
+ "border-left-color",
43444
+ "border-top-style",
43445
+ "border-right-style",
43446
+ "border-bottom-style",
43447
+ "border-left-style",
43448
+ "border-top-left-radius",
43449
+ "border-top-right-radius",
43450
+ "border-bottom-left-radius",
43451
+ "border-bottom-right-radius",
43452
+ "outline",
43453
+ "outline-width",
43454
+ "outline-style",
43455
+ "outline-color",
43456
+ "outline-offset",
43457
+ "width",
43458
+ "height",
43459
+ "min-width",
43460
+ "min-height",
43461
+ "max-width",
43462
+ "max-height",
43463
+ "top",
43464
+ "right",
43465
+ "bottom",
43466
+ "left",
43467
+ "inset",
43468
+ "position",
43469
+ "display",
43470
+ "float",
43471
+ "clear",
43472
+ "vertical-align",
43473
+ "overflow",
43474
+ "clip",
43475
+ "flex",
43476
+ "flex-direction",
43477
+ "flex-wrap",
43478
+ "flex-flow",
43479
+ "flex-grow",
43480
+ "flex-shrink",
43481
+ "flex-basis",
43482
+ "order",
43483
+ "align-items",
43484
+ "align-self",
43485
+ "align-content",
43486
+ "justify-content",
43487
+ "justify-items",
43488
+ "justify-self",
43489
+ "gap",
43490
+ "row-gap",
43491
+ "column-gap",
43492
+ "place-items",
43493
+ "place-content",
43494
+ "place-self",
43495
+ "grid",
43496
+ "grid-area",
43497
+ "grid-template",
43498
+ "grid-template-columns",
43499
+ "grid-template-rows",
43500
+ "grid-template-areas",
43501
+ "grid-auto-columns",
43502
+ "grid-auto-rows",
43503
+ "grid-auto-flow",
43504
+ "grid-column",
43505
+ "grid-row",
43506
+ "grid-column-start",
43507
+ "grid-column-end",
43508
+ "grid-row-start",
43509
+ "grid-row-end",
43510
+ "columns",
43511
+ "column-count",
43512
+ "column-width",
43513
+ "column-gap",
43514
+ "column-rule",
43515
+ "column-fill",
43516
+ "column-span",
43517
+ "transform",
43518
+ "transform-origin",
43519
+ "transform-style",
43520
+ "perspective",
43521
+ "perspective-origin",
43522
+ "rotate",
43523
+ "scale",
43524
+ "translate",
43525
+ "animation",
43526
+ "animation-name",
43527
+ "animation-duration",
43528
+ "animation-timing-function",
43529
+ "animation-delay",
43530
+ "animation-iteration-count",
43531
+ "animation-direction",
43532
+ "animation-fill-mode",
43533
+ "animation-play-state",
43534
+ "transition",
43535
+ "transition-property",
43536
+ "transition-duration",
43537
+ "transition-timing-function",
43538
+ "transition-delay",
43539
+ "box-shadow",
43540
+ "clip-path",
43541
+ "object-fit",
43542
+ "object-position",
43543
+ "list-style",
43544
+ "list-style-type",
43545
+ "list-style-position",
43546
+ "list-style-image",
43547
+ "counter-reset",
43548
+ "counter-increment",
43549
+ "content",
43550
+ "quotes",
43551
+ "aspect-ratio",
43552
+ "box-sizing",
43553
+ "resize",
43554
+ "user-select",
43555
+ "pointer-events",
43556
+ "touch-action",
43557
+ "mask",
43558
+ "mask-image",
43559
+ "mask-size",
43560
+ "mask-position",
43561
+ "mask-repeat"
43562
+ ]);
43563
+ const UNSAFE_VALUE = /expression\s*\(|javascript\s*:|vbscript\s*:|data:text\/html|behavior\s*:/i;
43564
+ const UNSAFE_POSITION = /^(?:absolute|fixed)$/i;
43565
+ function safeDeclaration(raw) {
43566
+ const colon2 = raw.indexOf(":");
43567
+ if (colon2 <= 0) return null;
43568
+ const prop = raw.slice(0, colon2).trim().toLowerCase();
43569
+ const value = raw.slice(colon2 + 1).trim();
43570
+ if (!prop || !value) return null;
43571
+ if (!SAFE_PROPERTY.has(prop)) return null;
43572
+ if (UNSAFE_VALUE.test(value)) return null;
43573
+ if (prop === "position" && UNSAFE_POSITION.test(value)) return null;
43574
+ return `${prop}: ${value}`;
43575
+ }
43576
+ function scopeDeclarations(body) {
43577
+ const kept = [];
43578
+ for (const raw of body.split(";")) {
43579
+ if (!raw.trim()) continue;
43580
+ const safe = safeDeclaration(raw);
43581
+ if (safe) kept.push(safe);
43582
+ }
43583
+ return kept.join(";\n");
43584
+ }
43585
+ function scopeSlideCSS(css2, pageClass, guard) {
43586
+ const out = scopeBlock(css2.trim(), pageClass, guard, 0);
43587
+ return out.filter(Boolean).join("\n");
43588
+ }
43589
+ function scopeBlock(css2, pageClass, guard, depth) {
43590
+ if (depth > 8) return [];
43591
+ const out = [];
43592
+ let i = 0;
43593
+ while (i < css2.length) {
43594
+ const open2 = css2.indexOf("{", i);
43595
+ if (open2 === -1) break;
43596
+ const head = css2.slice(i, open2).trim();
43597
+ let level = 1;
43598
+ let close2 = open2 + 1;
43599
+ while (close2 < css2.length && level > 0) {
43600
+ const ch = css2[close2];
43601
+ if (ch === "{") level++;
43602
+ else if (ch === "}") level--;
43603
+ close2++;
43604
+ }
43605
+ if (level !== 0) return [];
43606
+ const body = css2.slice(open2 + 1, close2 - 1);
43607
+ i = close2;
43608
+ if (head.startsWith("@")) {
43609
+ const at = head.toLowerCase();
43610
+ if (at.startsWith("@media") || at.startsWith("@supports")) {
43611
+ const inner2 = scopeBlock(body, pageClass, guard, depth + 1);
43612
+ if (inner2.length > 0) out.push(`${head} {
43613
+ ${inner2.join("\n")}
43614
+ }`);
43615
+ } else if (at.startsWith("@keyframes") || at.startsWith("@counter-style")) {
43616
+ const kept2 = scopeKeyframes(body);
43617
+ if (kept2) out.push(`${head} {
43618
+ ${kept2}
43619
+ }`);
43620
+ }
43621
+ continue;
43622
+ }
43623
+ const selectors = head.split(",").map((s) => s.trim()).filter(Boolean).map((s) => `${guard} .${pageClass} ${s}`);
43624
+ const kept = scopeDeclarations(body);
43625
+ if (selectors.length > 0 && kept) {
43626
+ out.push(`${selectors.join(", ")} {
43627
+ ${kept}
43628
+ }`);
43629
+ }
43630
+ }
43631
+ return out;
43632
+ }
43633
+ function scopeKeyframes(body) {
43634
+ const out = [];
43635
+ let i = 0;
43636
+ while (i < body.length) {
43637
+ const open2 = body.indexOf("{", i);
43638
+ if (open2 === -1) break;
43639
+ const head = body.slice(i, open2).trim();
43640
+ const close2 = body.indexOf("}", open2);
43641
+ if (close2 === -1) return null;
43642
+ const kept = scopeDeclarations(body.slice(open2 + 1, close2));
43643
+ if (head && kept) out.push(`${head} {
43644
+ ${kept}
43645
+ }`);
43646
+ i = close2 + 1;
43647
+ }
43648
+ return out.length > 0 ? out.join("\n") : null;
43649
+ }
43650
+ const SLIDE_CLASS_PREFIX = "cm-md-slide-";
43651
+ const DIRECTIVE_CLASS = "cm-md-slide-directive";
43652
+ function layoutClass(name2) {
43653
+ return /^[a-z][a-z0-9-]*$/.test(name2) ? `${SLIDE_CLASS_PREFIX}${name2}` : null;
43654
+ }
43655
+ function buildDecorations(state) {
43656
+ const scan = scanSlideDirectives(state);
43657
+ publishSlideDirectives(scan.directives);
43658
+ publishDeckChrome(scan.deck, scan.linesByPage.size);
43659
+ publishDocumentBase(state.field(documentFileUrlField, false) ?? null);
43660
+ const specs = /* @__PURE__ */ new Map();
43661
+ const add = (from, cls, attrs) => {
43662
+ let spec = specs.get(from);
43663
+ if (!spec) {
43664
+ spec = { classes: /* @__PURE__ */ new Set(), attributes: {} };
43665
+ specs.set(from, spec);
43666
+ }
43667
+ if (cls) spec.classes.add(cls);
43668
+ if (attrs) Object.assign(spec.attributes, attrs);
43669
+ };
43670
+ for (const [page, dirs] of scan.directives) {
43671
+ if (!dirs.layout) continue;
43672
+ const cls = layoutClass(dirs.layout);
43673
+ if (!cls) continue;
43674
+ const lines = scan.linesByPage.get(page);
43675
+ if (!lines) continue;
43676
+ for (const n of lines) add(state.doc.line(n).from, cls);
43677
+ }
43678
+ for (const [page, lines] of scan.linesByPage) {
43679
+ if (scan.directives.get(page)?.layout) continue;
43680
+ for (const n of lines) add(state.doc.line(n).from, "cm-md-page-default");
43681
+ }
43682
+ for (const n of scan.directiveLines) add(state.doc.line(n).from, DIRECTIVE_CLASS);
43683
+ for (const [page, role] of scan.roles) {
43684
+ const kicker = scan.directives.get(page)?.kicker?.replace(/\s+/g, " ").trim();
43685
+ for (const n of role.titleLines) {
43686
+ const from = state.doc.line(n).from;
43687
+ add(from, "cm-md-page-title", kicker ? { "data-slide-kicker": kicker } : void 0);
43688
+ }
43689
+ for (const n of role.leadLines) add(state.doc.line(n).from, "cm-md-page-lead");
43690
+ for (const n of role.kickerLines) add(state.doc.line(n).from, "cm-md-page-kicker");
43691
+ }
43692
+ const builder = new RangeSetBuilder();
43693
+ const pending = [...specs.entries()].sort((a, b) => a[0] - b[0]);
43694
+ for (const [from, spec] of pending) {
43695
+ builder.add(
43696
+ from,
43697
+ from,
43698
+ Decoration.line({
43699
+ class: [...spec.classes].join(" "),
43700
+ attributes: Object.keys(spec.attributes).length > 0 ? spec.attributes : void 0
43701
+ })
43702
+ );
43703
+ }
43704
+ return builder.finish();
43705
+ }
43706
+ const slideLayoutField = StateField.define({
43707
+ create: (state) => buildDecorations(state),
43708
+ update: (_value, tr) => {
43709
+ if (!tr.docChanged && !tr.effects.some((effect) => effect.is(decorationsRefreshEffect))) {
43710
+ return _value;
43711
+ }
43712
+ return buildDecorations(tr.state);
43713
+ },
43714
+ provide: (field) => EditorView.decorations.from(field)
43715
+ });
43716
+ const slideLayout = [slideLayoutField];
43136
43717
  let handle$1 = null;
43137
43718
  function getEditorHandle() {
43138
43719
  return handle$1;
@@ -43177,6 +43758,9 @@ function editorExtensions(sourceMode, editable2, onChange) {
43177
43758
  // 「没改过的字节不许变」这条纪律。源码模式把它收起来,剩下的就是带 markdown
43178
43759
  // 语法高亮的原文(高亮在 state.ts 的 markdown 扩展里,跟模式无关)。
43179
43760
  livePreviewCompartment.of(sourceMode ? [] : livePreview),
43761
+ // 幻灯片版式:独立于 live-preview 的行装饰(slide-layout.ts),给声明了版式的
43762
+ // 页打 cm-md-slide-* 类。常驻安装:样式只在放映/导出时命中,平时零影响。
43763
+ slideLayout,
43180
43764
  // 焦点变化要重算装饰:只有**正在编辑**的那一行才显示源码(见 live-preview 的 setEditorFocus)。
43181
43765
  // 用 DOM 事件而不是 EditorView.focusChangeEffect,是因为后者在创建时就已带焦点的编辑器上
43182
43766
  // 不会触发;下面创建完 view 之后补了一次初始值。
@@ -44465,10 +45049,11 @@ function readDocxStyle() {
44465
45049
  lineHeight: 1.75
44466
45050
  };
44467
45051
  }
44468
- const PRESENTING_CLASS = "presenting";
44469
- const RULE_STYLE_ID = "slideshow-rules";
45052
+ const PRESENTING_CLASS$1 = "presenting";
45053
+ const RULE_STYLE_ID$1 = "slideshow-rules";
44470
45054
  const DRAG_SLOP = 4;
44471
45055
  let presenting = false;
45056
+ let starting = false;
44472
45057
  let pages = [];
44473
45058
  let index = 0;
44474
45059
  let rules = null;
@@ -44497,6 +45082,9 @@ function pageNumbers(root) {
44497
45082
  const page = pageOfLine$1(line);
44498
45083
  if (page === null) continue;
44499
45084
  if (line.classList.contains("cm-md-hr")) continue;
45085
+ const text2 = (line.textContent ?? "").trim();
45086
+ const visual = line.querySelector("img, svg, .cm-md-mermaid, .cm-md-image, .katex");
45087
+ if (!text2 && !visual) continue;
44500
45088
  found.add(page);
44501
45089
  }
44502
45090
  return [...found].sort((a, b) => a - b);
@@ -44505,6 +45093,23 @@ function deckPages() {
44505
45093
  const root = documentRoot$1();
44506
45094
  return root ? pageNumbers(root) : [];
44507
45095
  }
45096
+ function tagBlockWidgets(root) {
45097
+ for (const child of Array.from(root.children)) {
45098
+ if (child.classList.contains("cm-line")) continue;
45099
+ for (const cls of Array.from(child.classList)) {
45100
+ if (cls.startsWith(PAGE_CLASS_PREFIX)) child.classList.remove(cls);
45101
+ }
45102
+ }
45103
+ let page = null;
45104
+ for (const child of Array.from(root.children)) {
45105
+ const own = Array.from(child.classList).find((cls) => cls.startsWith(PAGE_CLASS_PREFIX));
45106
+ if (own) {
45107
+ page = own;
45108
+ continue;
45109
+ }
45110
+ if (page) child.classList.add(page);
45111
+ }
45112
+ }
44508
45113
  function firstLineOf(page) {
44509
45114
  const root = documentRoot$1();
44510
45115
  if (!root) return null;
@@ -44523,7 +45128,7 @@ function pageAtCaret(root) {
44523
45128
  function applyPage() {
44524
45129
  if (!rules) return;
44525
45130
  const page = pages[index];
44526
- rules.textContent = `body.${PRESENTING_CLASS} #editor .cm-content > :not(.${PAGE_CLASS_PREFIX}${page}) { display: none !important; }
45131
+ rules.textContent = `body.${PRESENTING_CLASS$1} #editor .cm-content > :not(.${PAGE_CLASS_PREFIX}${page}) { display: none !important; }
44527
45132
  `;
44528
45133
  }
44529
45134
  function show(next) {
@@ -44599,13 +45204,26 @@ function onContextMenu(event) {
44599
45204
  event.stopPropagation();
44600
45205
  show(index - 1);
44601
45206
  }
44602
- function startSlideshow(next = {}) {
44603
- if (presenting) return true;
45207
+ async function startSlideshow(next = {}) {
45208
+ if (presenting || starting) return presenting;
45209
+ starting = true;
45210
+ try {
45211
+ return await beginSlideshow(next);
45212
+ } finally {
45213
+ starting = false;
45214
+ }
45215
+ }
45216
+ async function beginSlideshow(next = {}) {
44604
45217
  const editor = editorElement();
44605
45218
  const root = documentRoot$1();
44606
45219
  if (!editor || !root) return false;
45220
+ await renderWholeDocument();
45221
+ tagBlockWidgets(root);
44607
45222
  const deck = pageNumbers(root);
44608
- if (deck.length === 0) return false;
45223
+ if (deck.length === 0) {
45224
+ restoreViewport();
45225
+ return false;
45226
+ }
44609
45227
  pages = deck;
44610
45228
  options = next;
44611
45229
  index = pageAtCaret(root);
@@ -44615,10 +45233,10 @@ function startSlideshow(next = {}) {
44615
45233
  });
44616
45234
  watch.observe(root, { childList: true });
44617
45235
  rules = document.createElement("style");
44618
- rules.id = RULE_STYLE_ID;
45236
+ rules.id = RULE_STYLE_ID$1;
44619
45237
  document.head.appendChild(rules);
44620
45238
  applyPage();
44621
- document.body.classList.add(PRESENTING_CLASS);
45239
+ document.body.classList.add(PRESENTING_CLASS$1);
44622
45240
  layout();
44623
45241
  const scroll = scroller$1();
44624
45242
  if (scroll) scroll.scrollTop = 0;
@@ -44641,7 +45259,8 @@ function stopSlideshow() {
44641
45259
  window.removeEventListener("resize", layout);
44642
45260
  watch?.disconnect();
44643
45261
  watch = null;
44644
- document.body.classList.remove(PRESENTING_CLASS);
45262
+ restoreViewport();
45263
+ document.body.classList.remove(PRESENTING_CLASS$1);
44645
45264
  rules?.remove();
44646
45265
  rules = null;
44647
45266
  const editor = editorElement();
@@ -44661,12 +45280,11 @@ function stopSlideshow() {
44661
45280
  const PAGE_WIDTH_INCHES = 13.3333;
44662
45281
  const PAGE_HEIGHT_INCHES = 7.5;
44663
45282
  const PX_PER_INCH = 96;
44664
- const PAGE_WIDTH_PX = Math.round(PAGE_WIDTH_INCHES * PX_PER_INCH);
44665
45283
  const PAGE_HEIGHT_PX = Math.round(PAGE_HEIGHT_INCHES * PX_PER_INCH);
44666
- const COLUMN_EM = 38;
44667
- const FONT_SIZE_PX = 20;
45284
+ const FONT_SIZE_PX = 24;
45285
+ const PAGE_MARGIN_PX = 77;
44668
45286
  const SAFETY_PX = 4;
44669
- const PRINT_CLASS = "slides-printing";
45287
+ const PRINT_CLASS$1 = "slides-printing";
44670
45288
  const STYLE_ID = "slides-print-style";
44671
45289
  let sheetStyle = null;
44672
45290
  let restoreScrollTop = 0;
@@ -44681,37 +45299,39 @@ function pageOfLine(line) {
44681
45299
  return match ? Number(match[1]) : null;
44682
45300
  }
44683
45301
  function layoutRules(background) {
45302
+ const softened = `color-mix(in srgb, ${background} 95%, var(--pele-accent))`;
44684
45303
  return `/* The sheet is the page: what margins exist in here are the document's own. */
44685
- @page { size: ${PAGE_WIDTH_INCHES}in ${PAGE_HEIGHT_INCHES}in; margin: 0; background: ${background}; }
44686
- html, body { display: block !important; height: auto !important; overflow: visible !important; background: ${background} !important; }
44687
- body.${PRINT_CLASS} #editor {
45304
+ @page { size: ${PAGE_WIDTH_INCHES}in ${PAGE_HEIGHT_INCHES}in; margin: 0; background: ${background}; background: ${softened}; }
45305
+ html, body { display: block !important; height: auto !important; overflow: visible !important; background: ${background} !important; background: ${softened} !important; }
45306
+ body.${PRINT_CLASS$1} #editor {
44688
45307
  position: static !important;
44689
45308
  inset: auto !important;
44690
45309
  height: auto !important;
44691
45310
  overflow: visible !important;
44692
45311
  padding: 0 !important;
44693
45312
  background: ${background} !important;
45313
+ background: ${softened} !important;
44694
45314
  }
44695
45315
  /* 纸是普通的块流:CM6 的编辑器/滚动容器都是 flex 或 auto 高度,强制断开的分页在
44696
45316
  它们里面不会生效,所以这里把它们摊平成块。 */
44697
- body.${PRINT_CLASS} #editor .cm-editor { height: auto !important; }
44698
- body.${PRINT_CLASS} #editor .cm-scroller { display: block !important; height: auto !important; overflow: visible !important; }
44699
- body.${PRINT_CLASS} #editor .cm-content {
45317
+ body.${PRINT_CLASS$1} #editor .cm-editor { height: auto !important; }
45318
+ body.${PRINT_CLASS$1} #editor .cm-scroller { display: block !important; height: auto !important; overflow: visible !important; }
45319
+ body.${PRINT_CLASS$1} #editor .cm-content {
44700
45320
  display: block !important;
44701
- width: min(${COLUMN_EM}em, ${Math.round(PAGE_WIDTH_PX * 0.86)}px) !important;
45321
+ width: auto !important;
44702
45322
  max-width: none !important;
44703
- margin: 0 auto !important;
44704
- padding: 0 !important;
45323
+ margin: 0 !important;
45324
+ padding: 0 ${PAGE_MARGIN_PX}px !important;
44705
45325
  font-size: ${FONT_SIZE_PX}px !important;
44706
- line-height: 1.6;
45326
+ line-height: 1.7;
44707
45327
  }
44708
45328
  /* 分隔线是分页边界,不是正文里的一行。 */
44709
- body.${PRINT_CLASS} #editor .cm-line.cm-md-hr { display: none !important; }
45329
+ body.${PRINT_CLASS$1} #editor .cm-line.cm-md-hr { display: none !important; }
44710
45330
  /* Nothing may be cut off at the sheet's edge: code and cells wrap, a diagram or
44711
45331
  a photo shrinks to fit the page it landed on. */
44712
- body.${PRINT_CLASS} #editor .cm-md-codeblock { white-space: pre-wrap !important; overflow-wrap: anywhere !important; }
44713
- body.${PRINT_CLASS} #editor .cm-md-table-widget th, body.${PRINT_CLASS} #editor .cm-md-table-widget td { overflow-wrap: anywhere !important; word-break: break-word !important; }
44714
- body.${PRINT_CLASS} #editor img, body.${PRINT_CLASS} #editor svg { max-height: ${Math.round(PAGE_HEIGHT_PX * 0.72)}px; }
45332
+ body.${PRINT_CLASS$1} #editor .cm-md-codeblock { white-space: pre-wrap !important; overflow-wrap: anywhere !important; }
45333
+ body.${PRINT_CLASS$1} #editor .cm-md-table-widget th, body.${PRINT_CLASS$1} #editor .cm-md-table-widget td { overflow-wrap: anywhere !important; word-break: break-word !important; }
45334
+ body.${PRINT_CLASS$1} #editor img, body.${PRINT_CLASS$1} #editor svg { max-height: ${Math.round(PAGE_HEIGHT_PX * 0.72)}px; }
44715
45335
  `;
44716
45336
  }
44717
45337
  async function enterPrintLayout$1() {
@@ -44723,11 +45343,12 @@ async function enterPrintLayout$1() {
44723
45343
  sheet.id = STYLE_ID;
44724
45344
  sheet.textContent = layoutRules(background);
44725
45345
  document.head.appendChild(sheet);
44726
- document.body.classList.add(PRINT_CLASS);
45346
+ document.body.classList.add(PRINT_CLASS$1);
44727
45347
  sheetStyle = sheet;
44728
45348
  restoreScrollTop = scroller()?.scrollTop ?? 0;
44729
45349
  root.getBoundingClientRect();
44730
45350
  await renderWholeDocument();
45351
+ tagBlockWidgets(root);
44731
45352
  const deck = deckPages();
44732
45353
  if (deck.length === 0) {
44733
45354
  exitPrintLayout();
@@ -44744,11 +45365,13 @@ async function enterPrintLayout$1() {
44744
45365
  const ownMargin = parseFloat(getComputedStyle(first).marginTop);
44745
45366
  const owned = last2.getBoundingClientRect().bottom - first.getBoundingClientRect().top;
44746
45367
  const used = owned + (Number.isFinite(ownMargin) ? ownMargin : 0);
44747
- const above = Math.max(0, Math.floor((PAGE_HEIGHT_PX - SAFETY_PX - used) / 2));
45368
+ const layout2 = getSlideDirectives().get(page)?.layout;
45369
+ const hero = layout2 === "cover" || layout2 === "section" || layout2 === "closing" || layout2 === "quote";
45370
+ const above = hero ? Math.max(0, Math.floor((PAGE_HEIGHT_PX - SAFETY_PX - used) / 2)) : 0;
44748
45371
  const target = `.cm-content > .${PAGE_CLASS_PREFIX}${page}.${PAGE_START_CLASS}`;
44749
- if (order > 0) rules2.push(`body.${PRINT_CLASS} #editor ${target} { break-before: page; }`);
45372
+ if (order > 0) rules2.push(`body.${PRINT_CLASS$1} #editor ${target} { break-before: page; }`);
44750
45373
  if (above > 0) {
44751
- rules2.push(`body.${PRINT_CLASS} #editor ${target}::before { content: ''; display: block; height: ${above}px; }`);
45374
+ rules2.push(`body.${PRINT_CLASS$1} #editor ${target}::before { content: ''; display: block; height: ${above}px; }`);
44752
45375
  }
44753
45376
  });
44754
45377
  sheet.textContent = layoutRules(background) + rules2.join("\n") + "\n";
@@ -44759,7 +45382,7 @@ function exitPrintLayout() {
44759
45382
  if (!sheetStyle) return;
44760
45383
  sheetStyle.remove();
44761
45384
  sheetStyle = null;
44762
- document.body.classList.remove(PRINT_CLASS);
45385
+ document.body.classList.remove(PRINT_CLASS$1);
44763
45386
  const scroll = scroller();
44764
45387
  if (scroll) scroll.scrollTop = restoreScrollTop;
44765
45388
  }
@@ -44998,10 +45621,10 @@ function applyTheme(name2, customCSS) {
44998
45621
  window.electronAPI?.reportTheme?.(name2);
44999
45622
  const bar = document.getElementById("titlebar");
45000
45623
  if (bar) {
45001
- const surface = getComputedStyle(bar).backgroundColor;
45624
+ const surface2 = getComputedStyle(bar).backgroundColor;
45002
45625
  const iconEl = document.getElementById("file-toggle-btn") ?? document.body;
45003
45626
  const icon = getComputedStyle(iconEl).color;
45004
- const surfaceHex = painted(surface, "#ffffff");
45627
+ const surfaceHex = painted(surface2, "#ffffff");
45005
45628
  window.electronAPI?.reportTitlebarColors?.({ background: surfaceHex, symbol: painted(icon, surfaceHex) });
45006
45629
  }
45007
45630
  window.dispatchEvent(new CustomEvent("colamd:theme-applied"));
@@ -45277,6 +45900,302 @@ function showFontSettingsModal() {
45277
45900
  });
45278
45901
  familyInput.focus();
45279
45902
  }
45903
+ const PRESENTING_CLASS = "presenting";
45904
+ const PRINT_CLASS = "slides-printing";
45905
+ const RULE_STYLE_ID = "slideshow-rules";
45906
+ const PAGE_CSS_ID = "slideshow-page-css";
45907
+ const PRINT_CSS_ID = "slides-page-css";
45908
+ const PAGE_IN_RULES = /cm-md-page-(\d+)/;
45909
+ function surface() {
45910
+ return document.getElementById("editor");
45911
+ }
45912
+ const SAFE_NAME = /^[a-zA-Z][a-zA-Z0-9-]*$/;
45913
+ let active = false;
45914
+ let printing = false;
45915
+ let currentPage = 0;
45916
+ let pageStyle = null;
45917
+ let printStyle = null;
45918
+ let host = null;
45919
+ let hostUrl = null;
45920
+ const appliedClasses = /* @__PURE__ */ new Set();
45921
+ const appliedVars = /* @__PURE__ */ new Set();
45922
+ let initialized = false;
45923
+ function initSlidesEnhance() {
45924
+ if (initialized) return;
45925
+ initialized = true;
45926
+ const onBodyClass = () => {
45927
+ const presenting2 = document.body.classList.contains(PRESENTING_CLASS);
45928
+ if (presenting2 && !active) enterPresentation();
45929
+ if (!presenting2 && active) exitPresentation();
45930
+ const printingNow = document.body.classList.contains(PRINT_CLASS);
45931
+ if (printingNow && !printing) mountPrintCss();
45932
+ if (!printingNow && printing) unmountPrintCss();
45933
+ };
45934
+ new MutationObserver(onBodyClass).observe(document.body, {
45935
+ attributes: true,
45936
+ attributeFilter: ["class"],
45937
+ childList: true,
45938
+ subtree: true
45939
+ });
45940
+ onBodyClass();
45941
+ }
45942
+ let pageWatcher = null;
45943
+ function watchRuleStyle() {
45944
+ pageWatcher?.disconnect();
45945
+ pageWatcher = null;
45946
+ const rules2 = document.getElementById(RULE_STYLE_ID);
45947
+ if (!rules2) return;
45948
+ syncPageFrom(rules2.textContent);
45949
+ pageWatcher = new MutationObserver(() => syncPageFrom(rules2.textContent));
45950
+ pageWatcher.observe(rules2, { characterData: true, childList: true, subtree: true });
45951
+ }
45952
+ function syncPageFrom(text2) {
45953
+ const found = text2?.match(PAGE_IN_RULES);
45954
+ if (!found) return;
45955
+ const page = Number(found[1]);
45956
+ if (page === currentPage) return;
45957
+ currentPage = page;
45958
+ if (active) applyCurrentPage();
45959
+ }
45960
+ function enterPresentation() {
45961
+ active = true;
45962
+ pageStyle = document.createElement("style");
45963
+ pageStyle.id = PAGE_CSS_ID;
45964
+ document.head.appendChild(pageStyle);
45965
+ watchRuleStyle();
45966
+ applyCurrentPage();
45967
+ }
45968
+ function exitPresentation() {
45969
+ active = false;
45970
+ pageWatcher?.disconnect();
45971
+ pageWatcher = null;
45972
+ pageStyle?.remove();
45973
+ pageStyle = null;
45974
+ teardownHost();
45975
+ resetApplied();
45976
+ surface()?.removeAttribute("data-slide-layout");
45977
+ }
45978
+ function applyCurrentPage() {
45979
+ const dirs = getSlideDirectives().get(currentPage);
45980
+ if (pageStyle) {
45981
+ const css2 = (dirs?.css ?? []).map((block) => scopeSlideCSS(block, `${PAGE_CLASS_PREFIX}${currentPage}`, `body.${PRESENTING_CLASS} #editor`));
45982
+ pageStyle.textContent = css2.join("\n");
45983
+ }
45984
+ syncChrome();
45985
+ const name2 = dirs?.layout ?? "";
45986
+ const surface_ = surface();
45987
+ if (surface_) {
45988
+ if (name2 && SAFE_NAME.test(name2)) surface_.dataset.slideLayout = name2;
45989
+ else surface_.removeAttribute("data-slide-layout");
45990
+ }
45991
+ teardownHost();
45992
+ resetApplied();
45993
+ const js = dirs?.js.join("\n;\n");
45994
+ if (js) mountHost(js);
45995
+ }
45996
+ let chrome = null;
45997
+ let chromeLogo = null;
45998
+ let foot = null;
45999
+ let ghost = null;
46000
+ function ensureChromeDom() {
46001
+ if (chrome && foot && ghost) return;
46002
+ chrome = document.createElement("div");
46003
+ chrome.id = "slideshow-chrome";
46004
+ chrome.className = "slide-chrome";
46005
+ chrome.setAttribute("aria-hidden", "true");
46006
+ const left = document.createElement("div");
46007
+ left.className = "slide-chrome-left";
46008
+ const right = document.createElement("div");
46009
+ right.className = "slide-chrome-right";
46010
+ chrome.append(left, right);
46011
+ foot = document.createElement("div");
46012
+ foot.id = "slideshow-foot";
46013
+ foot.className = "slide-foot";
46014
+ foot.setAttribute("aria-hidden", "true");
46015
+ ghost = document.createElement("div");
46016
+ ghost.className = "slide-ghost";
46017
+ ghost.setAttribute("aria-hidden", "true");
46018
+ document.body.append(chrome, foot, ghost);
46019
+ }
46020
+ const pad2 = (n) => String(n).padStart(2, "0");
46021
+ function resolveAsset(raw) {
46022
+ const value = raw.trim().replace(/^<|>$/g, "");
46023
+ if (/^(?:https?:|file:|data:|blob:)/i.test(value)) return value;
46024
+ const base2 = getDocumentBase();
46025
+ if (!base2) return value;
46026
+ try {
46027
+ return new URL(value.replaceAll("\\", "/"), base2).href;
46028
+ } catch {
46029
+ return value;
46030
+ }
46031
+ }
46032
+ function syncChrome() {
46033
+ ensureChromeDom();
46034
+ const deck = getDeckChrome();
46035
+ const dirs = getSlideDirectives().get(currentPage);
46036
+ const pages2 = deckPages();
46037
+ const total = Math.max(pages2.length || getDeckPageCount(), 1);
46038
+ const at = pages2.indexOf(currentPage);
46039
+ const ordinal = at >= 0 ? at + 1 : currentPage + 1;
46040
+ const label = (printing ? deck.title : dirs?.label || deck.title) ?? "";
46041
+ const chapter = (printing ? deck.meta : dirs?.chapter || deck.meta) ?? "";
46042
+ const left = chrome.firstElementChild;
46043
+ const right = chrome.lastElementChild;
46044
+ left.textContent = "";
46045
+ right.textContent = "";
46046
+ if (deck.logo) {
46047
+ if (!chromeLogo) {
46048
+ chromeLogo = document.createElement("img");
46049
+ chromeLogo.className = "slide-chrome-logo";
46050
+ chromeLogo.alt = "";
46051
+ }
46052
+ chromeLogo.src = resolveAsset(deck.logo);
46053
+ left.appendChild(chromeLogo);
46054
+ } else {
46055
+ chromeLogo = null;
46056
+ }
46057
+ if (label) {
46058
+ const t2 = document.createElement("span");
46059
+ t2.className = "slide-chrome-title";
46060
+ t2.textContent = label;
46061
+ left.appendChild(t2);
46062
+ }
46063
+ if (chapter) {
46064
+ const m = document.createElement("span");
46065
+ m.className = "slide-chrome-meta";
46066
+ m.textContent = chapter;
46067
+ right.appendChild(m);
46068
+ }
46069
+ chrome.style.display = deck.logo || label || chapter ? "" : "none";
46070
+ foot.textContent = "";
46071
+ if (deck.brand) {
46072
+ const b = document.createElement("span");
46073
+ b.className = "slide-foot-brand";
46074
+ b.textContent = deck.brand;
46075
+ foot.appendChild(b);
46076
+ }
46077
+ const num = document.createElement("span");
46078
+ num.className = "slide-foot-num";
46079
+ num.textContent = `${pad2(ordinal)} / ${pad2(total)}`;
46080
+ foot.appendChild(num);
46081
+ ghost.textContent = pad2(ordinal);
46082
+ }
46083
+ function newToken() {
46084
+ return Math.random().toString(36).slice(2) + Date.now().toString(36);
46085
+ }
46086
+ let bridgeToken = "";
46087
+ function bootHtml(token) {
46088
+ return `<!doctype html><html><body><script>
46089
+ (function () {
46090
+ var TOKEN = ${JSON.stringify(token)};
46091
+ var slide = {
46092
+ setClass: function (name, value) {
46093
+ parent.postMessage({ __colamdSlide: 1, token: TOKEN, kind: 'class', name: name, value: value }, '*');
46094
+ },
46095
+ setVar: function (name, value) {
46096
+ parent.postMessage({ __colamdSlide: 1, token: TOKEN, kind: 'var', name: name, value: value }, '*');
46097
+ },
46098
+ setTimeout: function (fn, ms) { return setTimeout(fn, ms); },
46099
+ requestAnimationFrame: function (fn) { return requestAnimationFrame(fn); }
46100
+ };
46101
+ window.addEventListener('message', function (event) {
46102
+ var data = event.data;
46103
+ if (!data || data.__colamdSlideRun !== 1 || data.token !== TOKEN) return;
46104
+ try { (new Function('slide', data.code))(slide); }
46105
+ catch (err) { console.warn('[slide-js]', err); }
46106
+ });
46107
+ parent.postMessage({ __colamdSlide: 1, token: TOKEN, ready: true }, '*');
46108
+ })();
46109
+ <\/script></body></html>`;
46110
+ }
46111
+ function mountHost(code) {
46112
+ const target = surface();
46113
+ if (!target) return;
46114
+ bridgeToken = newToken();
46115
+ const html2 = bootHtml(bridgeToken);
46116
+ const blob = new Blob([html2], { type: "text/html" });
46117
+ hostUrl = URL.createObjectURL(blob);
46118
+ host = document.createElement("iframe");
46119
+ host.setAttribute("sandbox", "allow-scripts");
46120
+ host.setAttribute("aria-hidden", "true");
46121
+ host.title = "slide script host";
46122
+ host.style.display = "none";
46123
+ host.src = hostUrl;
46124
+ pendingCode = code;
46125
+ window.addEventListener("message", onBridgeMessage);
46126
+ target.appendChild(host);
46127
+ }
46128
+ let pendingCode = "";
46129
+ function teardownHost() {
46130
+ window.removeEventListener("message", onBridgeMessage);
46131
+ if (host) {
46132
+ host.remove();
46133
+ host = null;
46134
+ }
46135
+ if (hostUrl) {
46136
+ URL.revokeObjectURL(hostUrl);
46137
+ hostUrl = null;
46138
+ }
46139
+ pendingCode = "";
46140
+ }
46141
+ function onBridgeMessage(event) {
46142
+ const data2 = event.data;
46143
+ if (!data2 || data2.__colamdSlide !== 1 || data2.token !== bridgeToken) return;
46144
+ if (event.source !== host?.contentWindow) return;
46145
+ if (data2.ready) {
46146
+ host?.contentWindow?.postMessage({ __colamdSlideRun: 1, token: bridgeToken, code: pendingCode }, "*");
46147
+ return;
46148
+ }
46149
+ if (data2.kind === "class") applyClass(String(data2.name ?? ""), Boolean(data2.value));
46150
+ if (data2.kind === "var") applyVar(String(data2.name ?? ""), data2.value);
46151
+ }
46152
+ function applyClass(name2, value) {
46153
+ if (!SAFE_NAME.test(name2)) return;
46154
+ const surface_ = surface();
46155
+ if (!surface_) return;
46156
+ const cls = `slide-${name2}`;
46157
+ surface_.classList.toggle(cls, value);
46158
+ if (value) appliedClasses.add(cls);
46159
+ else appliedClasses.delete(cls);
46160
+ }
46161
+ function applyVar(name2, value) {
46162
+ if (!SAFE_NAME.test(name2)) return;
46163
+ const surface_ = surface();
46164
+ if (!surface_) return;
46165
+ const prop = `--slide-${name2}`;
46166
+ surface_.style.setProperty(prop, String(value));
46167
+ appliedVars.add(prop);
46168
+ }
46169
+ function resetApplied() {
46170
+ const surface_ = surface();
46171
+ if (surface_) {
46172
+ for (const cls of appliedClasses) surface_.classList.remove(cls);
46173
+ for (const prop of appliedVars) surface_.style.removeProperty(prop);
46174
+ }
46175
+ appliedClasses.clear();
46176
+ appliedVars.clear();
46177
+ }
46178
+ function mountPrintCss() {
46179
+ printing = true;
46180
+ const rules2 = [];
46181
+ for (const [page, dirs] of getSlideDirectives()) {
46182
+ for (const block of dirs.css) {
46183
+ rules2.push(scopeSlideCSS(block, `${PAGE_CLASS_PREFIX}${page}`, `body.${PRINT_CLASS} #editor`));
46184
+ }
46185
+ }
46186
+ printStyle = document.createElement("style");
46187
+ printStyle.id = PRINT_CSS_ID;
46188
+ printStyle.textContent = rules2.join("\n");
46189
+ document.head.appendChild(printStyle);
46190
+ syncChrome();
46191
+ }
46192
+ function unmountPrintCss() {
46193
+ printing = false;
46194
+ printStyle?.remove();
46195
+ printStyle = null;
46196
+ }
46197
+ if (document.body) initSlidesEnhance();
46198
+ else document.addEventListener("DOMContentLoaded", initSlidesEnhance, { once: true });
45280
46199
  /*! Capacitor: https://capacitorjs.com/ - MIT License */
45281
46200
  const createCapacitorPlatforms = (win) => {
45282
46201
  const defaultPlatformMap = /* @__PURE__ */ new Map();
@@ -45878,7 +46797,15 @@ function enterPrintLayout() {
45878
46797
  overflow: "visible"
45879
46798
  });
45880
46799
  override("#editor, .cm-editor, .cm-scroller", { height: "auto", overflow: "visible" });
45881
- return () => undo2.forEach(({ el, cssText }) => el.style.cssText = cssText);
46800
+ const zoomStyle = document.createElement("style");
46801
+ zoomStyle.textContent = ".pele-zoom { display: none !important; }";
46802
+ document.head.append(zoomStyle);
46803
+ const restoreZoom = pauseDiagramZoom();
46804
+ return () => {
46805
+ restoreZoom();
46806
+ zoomStyle.remove();
46807
+ undo2.forEach(({ el, cssText }) => el.style.cssText = cssText);
46808
+ };
45882
46809
  }
45883
46810
  function exportBaseName() {
45884
46811
  const title = (document.title || "").trim();
@@ -45890,8 +46817,8 @@ function isChinese() {
45890
46817
  }
45891
46818
  function defaultBaseName() {
45892
46819
  const d = /* @__PURE__ */ new Date();
45893
- const pad2 = (n) => String(n).padStart(2, "0");
45894
- const stamp = `${d.getFullYear()}${pad2(d.getMonth() + 1)}${pad2(d.getDate())}-${pad2(d.getHours())}${pad2(d.getMinutes())}${pad2(d.getSeconds())}`;
46820
+ const pad3 = (n) => String(n).padStart(2, "0");
46821
+ const stamp = `${d.getFullYear()}${pad3(d.getMonth() + 1)}${pad3(d.getDate())}-${pad3(d.getHours())}${pad3(d.getMinutes())}${pad3(d.getSeconds())}`;
45895
46822
  return `${isChinese() ? "未命名" : "Untitled"}-${stamp}`;
45896
46823
  }
45897
46824
  function escapeHTML(value) {
@@ -45910,11 +46837,11 @@ async function capModule(name2) {
45910
46837
  try {
45911
46838
  switch (name2) {
45912
46839
  case "@capacitor/filesystem":
45913
- return await __vitePreload(() => import("./index-DsYLJ8It.js"), true ? [] : void 0, import.meta.url);
46840
+ return await __vitePreload(() => import("./index-gvL3lkzR.js"), true ? [] : void 0, import.meta.url);
45914
46841
  case "@capacitor/share":
45915
- return await __vitePreload(() => import("./index-B6uVUc9e.js"), true ? [] : void 0, import.meta.url);
46842
+ return await __vitePreload(() => import("./index-CwH04Tq_.js"), true ? [] : void 0, import.meta.url);
45916
46843
  case "@capacitor/app":
45917
- return await __vitePreload(() => import("./index-DgC9JAzE.js"), true ? [] : void 0, import.meta.url);
46844
+ return await __vitePreload(() => import("./index-BpqOaUd_.js"), true ? [] : void 0, import.meta.url);
45918
46845
  default:
45919
46846
  return null;
45920
46847
  }
@@ -46043,28 +46970,28 @@ function createCapacitorAPI() {
46043
46970
  setCleanExport(false);
46044
46971
  }
46045
46972
  },
46046
- exportHTML: async (snapshot) => {
46973
+ exportHTML: async (snapshot2) => {
46047
46974
  const f = await fs();
46048
46975
  if (!f) return false;
46049
46976
  const base2 = exportBaseName().replace(/[\\/:*?"<>|]/g, "_");
46050
46977
  const fileName = `${base2}-${Date.now()}.html`;
46051
46978
  const target = `${DOCS_DIR}/exports/${fileName}`;
46052
46979
  const title = escapeHTML(base2);
46053
- const renderedContent = snapshot.document || snapshot.html || `<pre>${escapeHTML(snapshot.content)}</pre>`;
46980
+ const renderedContent = snapshot2.document || snapshot2.html || `<pre>${escapeHTML(snapshot2.content)}</pre>`;
46054
46981
  const documentHTML = `<!doctype html>
46055
46982
  <html lang="zh-CN">
46056
46983
  <head>
46057
46984
  <meta charset="UTF-8">
46058
46985
  <meta name="viewport" content="width=device-width, initial-scale=1">
46059
46986
  <title>${title}</title>
46060
- <style>${snapshot.styles || ""}
46987
+ <style>${snapshot2.styles || ""}
46061
46988
  html, body { height: auto; overflow: visible; }
46062
46989
  body { min-width: 320px; }
46063
46990
  #titlebar, #file-panel { display: none !important; }
46064
46991
  #editor { height: auto !important; min-height: 100vh; overflow: visible !important; padding: 0 !important; }
46065
46992
  </style>
46066
46993
  </head>
46067
- <body class="${escapeHTML(snapshot.bodyClass || "")}">
46994
+ <body class="${escapeHTML(snapshot2.bodyClass || "")}">
46068
46995
  <article class="colamd-document">${renderedContent}</article>
46069
46996
  </body>
46070
46997
  </html>
@@ -46732,8 +47659,8 @@ function renderTabBar() {
46732
47659
  add.addEventListener("mouseenter", () => scheduleTip(add, isChinese$1() ? "新建标签页 · ⌘T" : "New tab · ⌘T", "below", TAB_TIP_DELAY));
46733
47660
  add.addEventListener("mouseleave", hideTip);
46734
47661
  bar.after(add);
46735
- const active = bar.querySelector(".tab-entry.active");
46736
- active?.scrollIntoView({ block: "nearest", inline: "nearest" });
47662
+ const active2 = bar.querySelector(".tab-entry.active");
47663
+ active2?.scrollIntoView({ block: "nearest", inline: "nearest" });
46737
47664
  window.electronAPI.setTabFiles(tabs.map((tab) => tab.filePath).filter((path2) => !!path2));
46738
47665
  }
46739
47666
  function showBlankDocument() {
@@ -47284,8 +48211,8 @@ function applyOutlineActive() {
47284
48211
  buttons.forEach((button, index2) => {
47285
48212
  button.classList.toggle("active", index2 === outlineActiveIndex);
47286
48213
  });
47287
- const active = buttons[outlineActiveIndex];
47288
- if (active) revealOutlineEntry(active);
48214
+ const active2 = buttons[outlineActiveIndex];
48215
+ if (active2) revealOutlineEntry(active2);
47289
48216
  }
47290
48217
  function revealOutlineEntry(button) {
47291
48218
  const panel = filePanelEl();
@@ -47642,7 +48569,7 @@ async function toggleSlideshow() {
47642
48569
  requestAnimationFrame(() => requestAnimationFrame(() => resolve()));
47643
48570
  });
47644
48571
  }
47645
- const started = startSlideshow({
48572
+ const started = await startSlideshow({
47646
48573
  onStart: () => {
47647
48574
  setEditorEditable(false);
47648
48575
  void window.electronAPI.setSlideshowFullscreen(true);