@damiro/stylo 0.10.1 → 0.12.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 (46) hide show
  1. package/README.md +15 -3
  2. package/dist/{InPlaceView-CkbMemAa.js → InPlaceView-BWc06Jso.js} +491 -486
  3. package/dist/InPlaceView-BWc06Jso.js.map +1 -0
  4. package/dist/{Preview-AaGGwLQP.js → Preview-DIsFdBFA.js} +3 -3
  5. package/dist/{Preview-AaGGwLQP.js.map → Preview-DIsFdBFA.js.map} +1 -1
  6. package/dist/SplitView.d.ts +8 -2
  7. package/dist/SplitView.d.ts.map +1 -1
  8. package/dist/Stylo.d.ts.map +1 -1
  9. package/dist/editor/SourceView.d.ts +10 -3
  10. package/dist/editor/SourceView.d.ts.map +1 -1
  11. package/dist/editor/canvas-header-panel.d.ts +27 -0
  12. package/dist/editor/canvas-header-panel.d.ts.map +1 -0
  13. package/dist/editor/extensions.d.ts +2 -2
  14. package/dist/editor/extensions.d.ts.map +1 -1
  15. package/dist/editor/tag-complete.d.ts +16 -0
  16. package/dist/editor/tag-complete.d.ts.map +1 -0
  17. package/dist/editor/useCodeMirror.d.ts +8 -3
  18. package/dist/editor/useCodeMirror.d.ts.map +1 -1
  19. package/dist/{embed-B2Dfkpd_.js → embed-Dsu6b-MV.js} +16 -9
  20. package/dist/embed-Dsu6b-MV.js.map +1 -0
  21. package/dist/frontmatter-DTCC0gaa.js +40 -0
  22. package/dist/frontmatter-DTCC0gaa.js.map +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/inplace/InPlaceView.d.ts +10 -3
  26. package/dist/inplace/InPlaceView.d.ts.map +1 -1
  27. package/dist/inplace/table-widget.d.ts +10 -5
  28. package/dist/inplace/table-widget.d.ts.map +1 -1
  29. package/dist/inplace/theme-canvas.d.ts +7 -1
  30. package/dist/inplace/theme-canvas.d.ts.map +1 -1
  31. package/dist/render/Embed.d.ts.map +1 -1
  32. package/dist/styles.css +1 -1
  33. package/dist/stylo.js +200 -168
  34. package/dist/stylo.js.map +1 -1
  35. package/dist/toolbar/Toolbar.d.ts.map +1 -1
  36. package/dist/toolbar/commands.d.ts.map +1 -1
  37. package/dist/types.d.ts +38 -6
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/{useCodeMirror-CpE_Ncfn.js → useCodeMirror-BI1kEPRE.js} +402 -334
  40. package/dist/useCodeMirror-BI1kEPRE.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/InPlaceView-CkbMemAa.js.map +0 -1
  43. package/dist/embed-B2Dfkpd_.js.map +0 -1
  44. package/dist/frontmatter-DGUkb9z-.js +0 -39
  45. package/dist/frontmatter-DGUkb9z-.js.map +0 -1
  46. package/dist/useCodeMirror-CpE_Ncfn.js.map +0 -1
@@ -1,16 +1,16 @@
1
- import { i as e, r as t, t as n } from "./frontmatter-DGUkb9z-.js";
2
- import { _ as r, a as i, b as a, c as o, d as s, f as c, g as l, h as u, i as d, l as f, m as p, n as m, o as h, p as g, r as ee, s as te, t as ne, u as re, v as ie, x as _, y as ae } from "./useCodeMirror-CpE_Ncfn.js";
3
- import { a as oe, i as v } from "./config-DTBxVhtH.js";
4
- import { a as se, n as ce, o as le, r as ue, t as y } from "./embed-B2Dfkpd_.js";
5
- import { t as de } from "./katex-BfiLlqfN.js";
6
- import { useRef as fe, useState as pe, useSyncExternalStore as me } from "react";
7
- import { Decoration as b, EditorView as x, ViewPlugin as S, WidgetType as C, hoverTooltip as he, keymap as w } from "@codemirror/view";
8
- import { Annotation as ge, EditorSelection as _e, EditorState as ve, Facet as T, Prec as E, StateEffect as ye, StateField as D } from "@codemirror/state";
9
- import { syntaxTree as O } from "@codemirror/language";
10
- import { jsx as be } from "react/jsx-runtime";
11
- import { createPortal as xe } from "react-dom";
1
+ import { i as e, r as t, t as n } from "./frontmatter-DTCC0gaa.js";
2
+ import { S as r, _ as i, a, b as o, c as s, d as c, f as l, g as u, h as d, i as f, l as p, m, n as h, o as g, p as _, r as ee, s as v, t as te, u as ne, v as re, x as y, y as b } from "./useCodeMirror-BI1kEPRE.js";
3
+ import { a as ie, i as x } from "./config-DTBxVhtH.js";
4
+ import { a as S, n as ae, o as oe, r as C, t as w } from "./embed-Dsu6b-MV.js";
5
+ import { t as se } from "./katex-BfiLlqfN.js";
6
+ import { useRef as T, useState as E, useSyncExternalStore as ce } from "react";
7
+ import { Decoration as D, EditorView as O, ViewPlugin as k, WidgetType as A, hoverTooltip as le, keymap as j, showPanel as ue } from "@codemirror/view";
8
+ import { createPortal as de } from "react-dom";
9
+ import { Annotation as fe, EditorSelection as pe, EditorState as me, Facet as M, Prec as N, StateEffect as he, StateField as P } from "@codemirror/state";
10
+ import { syntaxTree as F } from "@codemirror/language";
11
+ import { jsx as ge, jsxs as _e } from "react/jsx-runtime";
12
12
  //#region src/inplace/embed-registry.ts
13
- var Se = class {
13
+ var ve = class {
14
14
  slots = /* @__PURE__ */ new Map();
15
15
  listeners = /* @__PURE__ */ new Set();
16
16
  snapshot = [];
@@ -33,7 +33,7 @@ var Se = class {
33
33
  for (let e of this.listeners) e();
34
34
  }));
35
35
  }
36
- }, Ce = {
36
+ }, ye = {
37
37
  headings: !0,
38
38
  emphasis: !0,
39
39
  links: !0,
@@ -48,19 +48,19 @@ var Se = class {
48
48
  tables: !0,
49
49
  embeds: !0
50
50
  };
51
- function we(e) {
51
+ function be(e) {
52
52
  return {
53
- ...Ce,
53
+ ...ye,
54
54
  ...e?.decorations
55
55
  };
56
56
  }
57
- var k = T.define({ combine: (e) => e[0] ?? Ce }), A = T.define({ combine: (e) => e[0] ?? null }), j = T.define({ combine: (e) => e[0] ?? "source" }), M = T.define({ combine: (e) => e[0] ?? "caret" }), Te = T.define({ combine: (e) => e[0] ?? null }), Ee = T.define({ combine: (e) => e[0] ?? !0 }), De = [
57
+ var I = M.define({ combine: (e) => e[0] ?? ye }), L = M.define({ combine: (e) => e[0] ?? null }), xe = M.define({ combine: (e) => e[0] ?? "source" }), R = M.define({ combine: (e) => e[0] ?? "caret" }), Se = M.define({ combine: (e) => e[0] ?? null }), Ce = M.define({ combine: (e) => e[0] ?? !0 }), we = [
58
58
  "link",
59
59
  "format",
60
60
  "paragraph",
61
61
  "insert",
62
62
  "clipboard"
63
- ], N = [
63
+ ], z = [
64
64
  "bold",
65
65
  "italic",
66
66
  "strike",
@@ -69,54 +69,54 @@ var k = T.define({ combine: (e) => e[0] ?? Ce }), A = T.define({ combine: (e) =>
69
69
  "wikilink",
70
70
  "math"
71
71
  ];
72
- function Oe(e) {
72
+ function Te(e) {
73
73
  return e === !1 ? {
74
74
  enabled: !1,
75
75
  groups: []
76
76
  } : e == null || e === !0 ? {
77
77
  enabled: !0,
78
- groups: De
78
+ groups: we
79
79
  } : {
80
80
  enabled: !0,
81
- groups: e.groups?.length ? e.groups : De
81
+ groups: e.groups?.length ? e.groups : we
82
82
  };
83
83
  }
84
- var ke = T.define({ combine: (e) => e[0] ?? De });
85
- function Ae(e) {
86
- if (!e?.length) return N;
87
- let t = e.filter((e) => N.includes(e));
88
- return t.length ? t : N;
84
+ var Ee = M.define({ combine: (e) => e[0] ?? we });
85
+ function De(e) {
86
+ if (!e?.length) return z;
87
+ let t = e.filter((e) => z.includes(e));
88
+ return t.length ? t : z;
89
89
  }
90
- var je = T.define({ combine: (e) => e[0] ?? N }), Me = T.define({ combine: (e) => e[0] ?? "menu" });
90
+ var Oe = M.define({ combine: (e) => e[0] ?? z }), ke = M.define({ combine: (e) => e[0] ?? "menu" });
91
91
  //#endregion
92
92
  //#region src/inplace/frontmatter.ts
93
- function Ne(e) {
94
- if (!e.facet(k).frontmatter) return b.none;
93
+ function Ae(e) {
94
+ if (!e.facet(I).frontmatter) return D.none;
95
95
  let t = n(e.doc);
96
- if (!t) return b.none;
96
+ if (!t) return D.none;
97
97
  let r = e.doc.lineAt(t.from).number, i = e.doc.lineAt(t.to).number, a = e.selection.ranges.some((t) => {
98
98
  let n = e.doc.lineAt(t.from).number;
99
99
  return n >= r && n <= i;
100
100
  }), o = [];
101
101
  for (let t = r; t <= i; t++) {
102
102
  let n = e.doc.line(t), s = t === r ? "cm-inplace-fm cm-inplace-fm-first" : "cm-inplace-fm";
103
- o.push(b.line({ class: s }).range(n.from)), (t === r || t === i) && !a && n.to > n.from && o.push(b.replace({}).range(n.from, n.to));
103
+ o.push(D.line({ class: s }).range(n.from)), (t === r || t === i) && !a && n.to > n.from && o.push(D.replace({}).range(n.from, n.to));
104
104
  }
105
- return b.set(o, !0);
105
+ return D.set(o, !0);
106
106
  }
107
- var Pe = D.define({
108
- create: Ne,
109
- update: (e, t) => t.docChanged || t.selection ? Ne(t.state) : e,
110
- provide: (e) => x.decorations.from(e)
107
+ var je = P.define({
108
+ create: Ae,
109
+ update: (e, t) => t.docChanged || t.selection ? Ae(t.state) : e,
110
+ provide: (e) => O.decorations.from(e)
111
111
  });
112
112
  //#endregion
113
113
  //#region src/inplace/list-guides.ts
114
- function Fe(e) {
114
+ function Me(e) {
115
115
  let t = 1;
116
116
  for (let n = e.node.parent; n; n = n.parent) n.name === "ListItem" && t++;
117
117
  return t;
118
118
  }
119
- function Ie(e, t, n, r, i, a) {
119
+ function Ne(e, t, n, r, i, a) {
120
120
  if (!i.lists) return;
121
121
  let o = /* @__PURE__ */ new Set();
122
122
  n.iterate({
@@ -124,10 +124,10 @@ function Ie(e, t, n, r, i, a) {
124
124
  to: t,
125
125
  enter: (e) => {
126
126
  if (e.name !== "ListItem") return;
127
- let t = Fe(e) - 1;
127
+ let t = Me(e) - 1;
128
128
  if (t < 1) return;
129
129
  let n = r.lineAt(e.from).number, i = e.node.getChild("BulletList") ?? e.node.getChild("OrderedList"), s = r.lineAt(i ? i.from - 1 : Math.min(e.to, r.length)).number;
130
- for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(b.line({
130
+ for (let e = n; e <= s; e++) o.has(e) || (o.add(e), a.push(D.line({
131
131
  class: "cm-inplace-li",
132
132
  attributes: { style: `--sl-li-depth:${t}` }
133
133
  }).range(r.line(e).from)));
@@ -136,7 +136,7 @@ function Ie(e, t, n, r, i, a) {
136
136
  }
137
137
  //#endregion
138
138
  //#region src/inplace/reveal.ts
139
- function P(e) {
139
+ function B(e) {
140
140
  let t = /* @__PURE__ */ new Set();
141
141
  for (let n of e.selection.ranges) {
142
142
  let r = e.doc.lineAt(n.from).number, i = e.doc.lineAt(n.to).number;
@@ -146,22 +146,22 @@ function P(e) {
146
146
  }
147
147
  //#endregion
148
148
  //#region src/inplace/scan.ts
149
- var Le = /* @__PURE__ */ new Set([
149
+ var Pe = /* @__PURE__ */ new Set([
150
150
  "InlineCode",
151
151
  "FencedCode",
152
152
  "CodeBlock",
153
153
  "CodeText"
154
154
  ]);
155
- function F(e, t) {
155
+ function V(e, t) {
156
156
  let n = e.resolveInner(t, 1);
157
157
  for (;;) {
158
- if (Le.has(n.name)) return !0;
158
+ if (Pe.has(n.name)) return !0;
159
159
  let e = n.parent;
160
160
  if (!e) return !1;
161
161
  n = e;
162
162
  }
163
163
  }
164
- function Re(e, t) {
164
+ function Fe(e, t) {
165
165
  let n = e.resolveInner(t, 1);
166
166
  for (;;) {
167
167
  if (n.name === "Table") return !0;
@@ -170,16 +170,16 @@ function Re(e, t) {
170
170
  n = e;
171
171
  }
172
172
  }
173
- function I(e, t, n, r) {
173
+ function Ie(e, t, n, r) {
174
174
  let i = t.lineAt(n).number, a = t.lineAt(r).number;
175
175
  for (let t = i; t <= a; t++) if (e.has(t)) return !0;
176
176
  return !1;
177
177
  }
178
178
  //#endregion
179
179
  //#region src/inplace/math.ts
180
- var ze = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, Be = /(?<![\w$])\$\$([^\n$]+?)\$\$(?![\w$])/g, Ve = /(?<![\w$])\$\$([^]+?)\$\$/g;
181
- function L(e, t) {
182
- for (let n of e.matchAll(Be)) {
180
+ var Le = /(?<![\w$])\$(?!\s)([^\n$]+?)(?<!\s)\$(?![\w$])/g, Re = /(?<![\w$])\$\$([^\n$]+?)\$\$(?![\w$])/g, ze = /(?<![\w$])\$\$([^]+?)\$\$/g;
181
+ function Be(e, t) {
182
+ for (let n of e.matchAll(Re)) {
183
183
  let e = n.index ?? 0, r = e + (n[0] ?? "").length;
184
184
  if (t >= e && t <= r) return {
185
185
  from: e,
@@ -188,7 +188,7 @@ function L(e, t) {
188
188
  block: !0
189
189
  };
190
190
  }
191
- for (let n of e.matchAll(ze)) {
191
+ for (let n of e.matchAll(Le)) {
192
192
  let e = n.index ?? 0, r = e + (n[0] ?? "").length;
193
193
  if (t >= e && t <= r) return {
194
194
  from: e,
@@ -199,7 +199,7 @@ function L(e, t) {
199
199
  }
200
200
  return null;
201
201
  }
202
- var R = class extends C {
202
+ var Ve = class extends A {
203
203
  src;
204
204
  block;
205
205
  constructor(e, t) {
@@ -212,7 +212,7 @@ var R = class extends C {
212
212
  let e = document.createElement(this.block ? "div" : "span");
213
213
  e.className = this.block ? "cm-inplace-math cm-inplace-math-block" : "cm-inplace-math";
214
214
  try {
215
- de.render(this.src, e, {
215
+ se.render(this.src, e, {
216
216
  displayMode: this.block,
217
217
  throwOnError: !1
218
218
  });
@@ -229,37 +229,37 @@ function He(e, t, n, r, i, a) {
229
229
  let o = e.state.doc.sliceString(t, n);
230
230
  if (!o.includes("$")) return;
231
231
  let { doc: s } = e.state, c = [];
232
- for (let e of o.matchAll(Be)) {
232
+ for (let e of o.matchAll(Re)) {
233
233
  let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
234
- !n || F(i, o + 2) || (c.push([o, l]), !I(r, s, o, l) && a.push(b.replace({ widget: new R(n, !0) }).range(o, l)));
234
+ !n || V(i, o + 2) || (c.push([o, l]), !Ie(r, s, o, l) && a.push(D.replace({ widget: new Ve(n, !0) }).range(o, l)));
235
235
  }
236
- for (let e of o.matchAll(ze)) {
236
+ for (let e of o.matchAll(Le)) {
237
237
  let n = (e[1] ?? "").trim(), o = t + (e.index ?? 0), l = o + (e[0] ?? "").length;
238
- !n || F(i, o + 1) || c.some(([e, t]) => o >= e && l <= t) || I(r, s, o, l) || a.push(b.replace({ widget: new R(n, !1) }).range(o, l));
238
+ !n || V(i, o + 1) || c.some(([e, t]) => o >= e && l <= t) || Ie(r, s, o, l) || a.push(D.replace({ widget: new Ve(n, !1) }).range(o, l));
239
239
  }
240
240
  }
241
- var Ue = D.define({
241
+ var Ue = P.define({
242
242
  create: We,
243
243
  update(e, t) {
244
244
  return t.docChanged || t.selection ? We(t.state) : e;
245
245
  },
246
- provide: (e) => [x.decorations.from(e), x.atomicRanges.of((t) => t.state.field(e))]
246
+ provide: (e) => [O.decorations.from(e), O.atomicRanges.of((t) => t.state.field(e))]
247
247
  });
248
248
  function We(e) {
249
- if (!e.facet(k).math) return b.none;
249
+ if (!e.facet(I).math) return D.none;
250
250
  let t = e.doc.toString();
251
- if (!t.includes("$$")) return b.none;
252
- let n = [], r = P(e), i = O(e);
253
- for (let a of t.matchAll(Ve)) {
251
+ if (!t.includes("$$")) return D.none;
252
+ let n = [], r = B(e), i = F(e);
253
+ for (let a of t.matchAll(ze)) {
254
254
  let t = a[0] ?? "", o = (a[1] ?? "").trim();
255
255
  if (!o || !t.includes("\n")) continue;
256
256
  let s = a.index ?? 0, c = s + t.length, l = e.doc.lineAt(s), u = e.doc.lineAt(c), d = e.doc.sliceString(l.from, s).trim(), f = e.doc.sliceString(c, u.to).trim();
257
- d === "" && f === "" && (F(i, s + 2) || I(r, e.doc, s, c) || n.push(b.replace({
258
- widget: new R(o, !0),
257
+ d === "" && f === "" && (V(i, s + 2) || Ie(r, e.doc, s, c) || n.push(D.replace({
258
+ widget: new Ve(o, !0),
259
259
  block: !0
260
260
  }).range(s, c)));
261
261
  }
262
- return b.set(n, !0);
262
+ return D.set(n, !0);
263
263
  }
264
264
  //#endregion
265
265
  //#region src/inplace/nodes-inline.ts
@@ -289,22 +289,22 @@ function Ke(e, t, n) {
289
289
  let { doc: r, revealed: i, out: a, toggles: o } = t;
290
290
  if (!o[n.toggle]) return;
291
291
  let s = e.node.getChildren(n.mark), c = s[0], l = s[s.length - 1], u = c && l && c !== l, d = u ? c.to : e.from, f = u ? l.from : e.to;
292
- f > d && a.push(b.mark({ class: n.className }).range(d, f)), u && !i.has(r.lineAt(e.from).number) && (a.push(b.replace({}).range(c.from, c.to)), a.push(b.replace({}).range(l.from, l.to)));
292
+ f > d && a.push(D.mark({ class: n.className }).range(d, f)), u && !i.has(r.lineAt(e.from).number) && (a.push(D.replace({}).range(c.from, c.to)), a.push(D.replace({}).range(l.from, l.to)));
293
293
  }
294
294
  function qe(e, t) {
295
295
  let { doc: n, revealed: r, out: i, toggles: a } = t, o = n.sliceString(Math.max(0, e.from - 1), e.from), s = n.sliceString(e.to, e.to + 1);
296
296
  if (o === "[" && s === "]" || !a.links) return !1;
297
- let c = n.lineAt(e.from), l = ue.exec(c.text);
297
+ let c = n.lineAt(e.from), l = C.exec(c.text);
298
298
  if (l && e.from - c.from < l[1].length + l[2].length) return !1;
299
299
  let u = e.node.getChildren("LinkMark");
300
300
  if (u.length >= 2) {
301
301
  let t = u[0], a = u[1];
302
- a.from > t.to && i.push(b.mark({ class: "cm-inplace-link" }).range(t.to, a.from)), r.has(n.lineAt(e.from).number) || (i.push(b.replace({}).range(e.from, t.to)), i.push(b.replace({}).range(a.from, e.to)));
302
+ a.from > t.to && i.push(D.mark({ class: "cm-inplace-link" }).range(t.to, a.from)), r.has(n.lineAt(e.from).number) || (i.push(D.replace({}).range(e.from, t.to)), i.push(D.replace({}).range(a.from, e.to)));
303
303
  }
304
304
  }
305
305
  //#endregion
306
306
  //#region src/inplace/widgets.ts
307
- var Je = class extends C {
307
+ var Je = class extends A {
308
308
  eq() {
309
309
  return !0;
310
310
  }
@@ -315,7 +315,7 @@ var Je = class extends C {
315
315
  ignoreEvent() {
316
316
  return !1;
317
317
  }
318
- }, Ye = class extends C {
318
+ }, Ye = class extends A {
319
319
  eq() {
320
320
  return !0;
321
321
  }
@@ -326,7 +326,7 @@ var Je = class extends C {
326
326
  ignoreEvent() {
327
327
  return !1;
328
328
  }
329
- }, Xe = class extends C {
329
+ }, Xe = class extends A {
330
330
  checked;
331
331
  constructor(e) {
332
332
  super(), this.checked = e;
@@ -353,26 +353,26 @@ function Qe(e, t) {
353
353
  let { doc: n, revealed: r, out: i, toggles: a } = t;
354
354
  if (!a.horizontalRule) return !1;
355
355
  let o = n.lineAt(e.from);
356
- return r.has(o.number) || (i.push(b.line({ class: "cm-inplace-hr-line" }).range(o.from)), i.push(b.replace({ widget: new Je() }).range(o.from, o.to))), !1;
356
+ return r.has(o.number) || (i.push(D.line({ class: "cm-inplace-hr-line" }).range(o.from)), i.push(D.replace({ widget: new Je() }).range(o.from, o.to))), !1;
357
357
  }
358
358
  function $e(e, t) {
359
359
  let { doc: n, revealed: r, caretRevealed: i, out: a, toggles: o, quoteRevealed: s } = t;
360
360
  if (o.blockquote) {
361
- let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, c = n.line(t), l = ue.exec(c.text), u = l ? se(l[3]) : null, d = !1;
361
+ let t = n.lineAt(e.from).number, o = n.lineAt(Math.min(e.to, n.length)).number, c = n.line(t), l = C.exec(c.text), u = l ? S(l[3]) : null, d = !1;
362
362
  for (let e = t; e <= o; e++) i.has(e) && (d = !0);
363
363
  if (d) for (let e = t; e <= o; e++) s.add(e);
364
364
  for (let e = t; e <= o; e++) {
365
365
  let r = u ? `cm-inplace-callout cm-inplace-callout-${u}` : "cm-inplace-quote";
366
366
  u && e === t && (r += " cm-inplace-callout-head"), u && e === o && (r += " cm-inplace-callout-foot");
367
367
  let i = {};
368
- u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(b.line({
368
+ u && (i["data-callout"] = l[3].toLowerCase()), u && d && (i["data-revealed"] = ""), a.push(D.line({
369
369
  class: r,
370
370
  attributes: i
371
371
  }).range(n.line(e).from));
372
372
  }
373
373
  if (u && !d && !r.has(t)) {
374
374
  let e = c.from + l[1].length;
375
- a.push(b.replace({}).range(e, e + l[2].length));
375
+ a.push(D.replace({}).range(e, e + l[2].length));
376
376
  }
377
377
  }
378
378
  }
@@ -381,21 +381,21 @@ function et(e, t) {
381
381
  if (!a.blockquote) return !1;
382
382
  let s = n.lineAt(e.from);
383
383
  if (!r.has(s.number) && !o.has(s.number)) {
384
- let t = Math.min(e.to + 1, s.to), n = ue.exec(s.text), r = n ? s.text.slice(n[1].length + n[2].length) : s.text.slice(t - s.from);
385
- i.push(b.replace({}).range(e.from, r.trim() === "" ? e.to : t));
384
+ let t = Math.min(e.to + 1, s.to), n = C.exec(s.text), r = n ? s.text.slice(n[1].length + n[2].length) : s.text.slice(t - s.from);
385
+ i.push(D.replace({}).range(e.from, r.trim() === "" ? e.to : t));
386
386
  }
387
387
  return !1;
388
388
  }
389
389
  function tt(e, t) {
390
390
  let { doc: n, revealed: r, out: i, toggles: a } = t, o = n.sliceString(e.from, e.to), s = n.lineAt(e.from), c = e.node.parent, l = !!(c?.getChild("Task") ?? c?.getChild("TaskMarker"));
391
- return r.has(s.number) || (l ? a.tasks && i.push(b.replace({}).range(e.from, Math.min(e.to + 1, s.to))) : a.lists && Ze.test(o) && i.push(b.replace({ widget: new Ye() }).range(e.from, e.to))), !1;
391
+ return r.has(s.number) || (l ? a.tasks && i.push(D.replace({}).range(e.from, Math.min(e.to + 1, s.to))) : a.lists && Ze.test(o) && i.push(D.replace({ widget: new Ye() }).range(e.from, e.to))), !1;
392
392
  }
393
393
  function nt(e, t) {
394
394
  let { doc: n, revealed: r, out: i, toggles: a } = t;
395
395
  if (!a.tasks) return !1;
396
396
  if (!r.has(n.lineAt(e.from).number)) {
397
397
  let t = n.sliceString(e.from + 1, e.to - 1).toLowerCase() === "x";
398
- i.push(b.replace({ widget: new Xe(t) }).range(e.from, e.to));
398
+ i.push(D.replace({ widget: new Xe(t) }).range(e.from, e.to));
399
399
  }
400
400
  return !1;
401
401
  }
@@ -409,7 +409,7 @@ function rt(e, t) {
409
409
  let t = s && (e === c || e === l), r = "cm-inplace-mono";
410
410
  e === c && (r += " cm-inplace-code-top"), e === l && (r += " cm-inplace-code-bottom"), t && (r += f ? " cm-inplace-code-pad" : " cm-inplace-fence");
411
411
  let i = n.line(e);
412
- a.push(b.line({ class: r }).range(i.from)), t && f && i.to > i.from && a.push(b.replace({}).range(i.from, i.to));
412
+ a.push(D.line({ class: r }).range(i.from)), t && f && i.to > i.from && a.push(D.replace({}).range(i.from, i.to));
413
413
  }
414
414
  return !1;
415
415
  }
@@ -420,7 +420,7 @@ function ot(e, t, n) {
420
420
  let { doc: r, revealed: i, out: a, toggles: o } = t;
421
421
  if (o.headings) {
422
422
  let t = r.lineAt(e.from);
423
- if (a.push(b.line({
423
+ if (a.push(D.line({
424
424
  class: `cm-inplace-heading cm-inplace-h${n}`,
425
425
  attributes: {
426
426
  role: "heading",
@@ -428,7 +428,7 @@ function ot(e, t, n) {
428
428
  }
429
429
  }).range(t.from)), !i.has(t.number)) {
430
430
  let n = e.node.firstChild;
431
- n?.name === "HeaderMark" && a.push(b.replace({}).range(n.from, Math.min(n.to + 1, t.to)));
431
+ n?.name === "HeaderMark" && a.push(D.replace({}).range(n.from, Math.min(n.to + 1, t.to)));
432
432
  }
433
433
  }
434
434
  }
@@ -436,7 +436,7 @@ function st(e, t, n) {
436
436
  let { doc: r, caretRevealed: i, out: a, toggles: o } = t;
437
437
  if (o.headings) {
438
438
  let t = r.lineAt(e.from);
439
- a.push(b.line({
439
+ a.push(D.line({
440
440
  class: `cm-inplace-heading cm-inplace-h${n}`,
441
441
  attributes: {
442
442
  role: "heading",
@@ -446,7 +446,7 @@ function st(e, t, n) {
446
446
  let o = e.node.getChild("HeaderMark");
447
447
  if (o) {
448
448
  let e = r.lineAt(o.from);
449
- !i.has(t.number) && !i.has(e.number) && (a.push(b.line({ class: "cm-inplace-setext-rule" }).range(e.from)), a.push(b.replace({}).range(o.from, o.to)));
449
+ !i.has(t.number) && !i.has(e.number) && (a.push(D.line({ class: "cm-inplace-setext-rule" }).range(e.from)), a.push(D.replace({}).range(o.from, o.to)));
450
450
  }
451
451
  }
452
452
  }
@@ -471,22 +471,22 @@ function ct(e, t) {
471
471
  function lt(e, n, r, i, a, o) {
472
472
  let s = e.state.doc.sliceString(n, r);
473
473
  if (!s.includes("[[")) return;
474
- let c = e.state.facet(A) != null;
474
+ let c = e.state.facet(L) != null;
475
475
  for (let r of s.matchAll(t)) {
476
476
  let [t = "", s = "", l] = r, u = s.trim(), d = n + (r.index ?? 0);
477
- if (!u || F(a, d + 1) || c && d > 0 && e.state.doc.sliceString(d - 1, d) === "!") continue;
477
+ if (!u || V(a, d + 1) || c && d > 0 && e.state.doc.sliceString(d - 1, d) === "!") continue;
478
478
  let f = d + t.length, p = l == null ? d + 2 : d + 2 + s.length + 1, m = f - 2;
479
- o.push(b.mark({
479
+ o.push(D.mark({
480
480
  class: "cm-inplace-link cm-inplace-wikilink",
481
481
  attributes: { "data-stylo-wikilink": u }
482
- }).range(p, m)), i.has(e.state.doc.lineAt(d).number) || (o.push(b.replace({}).range(d, p)), o.push(b.replace({}).range(m, f)));
482
+ }).range(p, m)), i.has(e.state.doc.lineAt(d).number) || (o.push(D.replace({}).range(d, p)), o.push(D.replace({}).range(m, f)));
483
483
  }
484
484
  }
485
485
  //#endregion
486
486
  //#region src/inplace/decorate.ts
487
- var ut = /* @__PURE__ */ new Set(), dt = b.replace({});
487
+ var ut = /* @__PURE__ */ new Set(), dt = D.replace({});
488
488
  function ft(e) {
489
- let t = [], r = P(e.state), i = e.state.facet(M) === "never" ? ut : r, a = O(e.state), { doc: o } = e.state, s = e.state.facet(k), c = {
489
+ let t = [], r = B(e.state), i = e.state.facet(R) === "never" ? ut : r, a = F(e.state), { doc: o } = e.state, s = e.state.facet(I), c = {
490
490
  doc: o,
491
491
  revealed: i,
492
492
  caretRevealed: r,
@@ -499,7 +499,7 @@ function ft(e) {
499
499
  from: n.from,
500
500
  to: n.to,
501
501
  enter: (e) => ct(e, c)
502
- }), s.wikilinks && lt(e, n.from, n.to, i, a, t), s.math && He(e, n.from, n.to, i, a, t), Ie(n.from, n.to, a, o, s, t);
502
+ }), s.wikilinks && lt(e, n.from, n.to, i, a, t), s.math && He(e, n.from, n.to, i, a, t), Ne(n.from, n.to, a, o, s, t);
503
503
  let l = t.filter((e) => e.from < e.to && !e.value.spec.class).sort((e, t) => e.from - t.from || e.to - t.to), u = [];
504
504
  for (let e of l) {
505
505
  if (!e.value.spec.widget) {
@@ -510,13 +510,13 @@ function ft(e) {
510
510
  t && e.from <= t.to ? e.to > t.to && (u[u.length - 1] = dt.range(t.from, e.to)) : u.push(dt.range(e.from, e.to));
511
511
  }
512
512
  return {
513
- decorations: b.set(t, !0),
514
- atomic: b.set(u, !0)
513
+ decorations: D.set(t, !0),
514
+ atomic: D.set(u, !0)
515
515
  };
516
516
  }
517
517
  //#endregion
518
518
  //#region src/inplace/plugin.ts
519
- var pt = S.fromClass(class {
519
+ var pt = k.fromClass(class {
520
520
  decorations;
521
521
  atomic;
522
522
  constructor(e) {
@@ -531,7 +531,7 @@ var pt = S.fromClass(class {
531
531
  }
532
532
  }, {
533
533
  decorations: (e) => e.decorations,
534
- provide: (e) => x.atomicRanges.of((t) => t.plugin(e)?.atomic ?? b.none)
534
+ provide: (e) => O.atomicRanges.of((t) => t.plugin(e)?.atomic ?? D.none)
535
535
  });
536
536
  function mt() {
537
537
  return pt;
@@ -556,13 +556,13 @@ var ht = {
556
556
  toggle: "code"
557
557
  }
558
558
  };
559
- function z(e, t) {
560
- return e.facet(M) === "never" || !P(e).has(t);
559
+ function H(e, t) {
560
+ return e.facet(R) === "never" || !B(e).has(t);
561
561
  }
562
- function B(e, n, r = !1, i = !1) {
562
+ function U(e, n, r = !1, i = !1) {
563
563
  let a = e.doc.lineAt(n);
564
- if (!i && !z(e, a.number)) return null;
565
- let o = e.facet(k), s = O(e);
564
+ if (!i && !H(e, a.number)) return null;
565
+ let o = e.facet(I), s = F(e);
566
566
  for (let t of [-1, 1]) for (let i = s.resolveInner(n, t); i; i = i.parent) {
567
567
  let t = ht[i.name];
568
568
  if (t) {
@@ -616,17 +616,17 @@ function gt(e, t, n) {
616
616
  return a;
617
617
  }
618
618
  var _t = (e) => (t) => {
619
- if (f(t)) return !1;
619
+ if (p(t)) return !1;
620
620
  let n = t.state.selection.main;
621
621
  if (!n.empty) return !1;
622
622
  let { state: r } = t;
623
- if (!z(r, r.doc.lineAt(n.head).number)) return !1;
623
+ if (!H(r, r.doc.lineAt(n.head).number)) return !1;
624
624
  let i = gt(t, n.head, e);
625
625
  if (i === n.head) return !1;
626
626
  let a = r.doc;
627
627
  if (e < 0 ? i <= 0 : i >= a.length) return !0;
628
628
  let o = e < 0 ? i - 1 : i, s = e < 0 ? i : i + 1;
629
- for (let e = B(r, o); e && o <= e.contentFrom && s >= e.contentTo && e.contentTo > e.contentFrom && !(e.from >= o && e.to <= s); e = B(r, o)) o = Math.min(o, e.from), s = Math.max(s, e.to);
629
+ for (let e = U(r, o); e && o <= e.contentFrom && s >= e.contentTo && e.contentTo > e.contentFrom && !(e.from >= o && e.to <= s); e = U(r, o)) o = Math.min(o, e.from), s = Math.max(s, e.to);
630
630
  return t.dispatch({
631
631
  changes: {
632
632
  from: o,
@@ -647,18 +647,18 @@ function bt(e, t, n) {
647
647
  n.spec.widget || n.spec.class || t <= e || e <= i && (i = Math.max(i, t));
648
648
  }), i >= n;
649
649
  }
650
- var V = (e, t) => (n) => {
651
- if (f(n)) return !1;
650
+ var W = (e, t) => (n) => {
651
+ if (p(n)) return !1;
652
652
  let r = n.state.selection.main;
653
- if (!t && !r.empty || !z(n.state, n.state.doc.lineAt(r.head).number)) return !1;
653
+ if (!t && !r.empty || !H(n.state, n.state.doc.lineAt(r.head).number)) return !1;
654
654
  let i = n.moveByChar(r, e);
655
655
  if (bt(n, Math.min(r.head, i.head), Math.max(r.head, i.head)) && (i = n.moveByChar(i, e)), i.head === r.head) return !1;
656
- let a = t ? _e.range(r.anchor, i.head) : _e.cursor(i.head);
656
+ let a = t ? pe.range(r.anchor, i.head) : pe.cursor(i.head);
657
657
  return n.dispatch({
658
658
  selection: a,
659
659
  userEvent: "select"
660
660
  }), !0;
661
- }, xt = V(!1, !1), St = V(!0, !1), Ct = V(!1, !0), wt = V(!0, !0), Tt = E.high(w.of([
661
+ }, xt = W(!1, !1), St = W(!0, !1), Ct = W(!1, !0), wt = W(!0, !0), Tt = N.high(j.of([
662
662
  {
663
663
  key: "Backspace",
664
664
  run: vt
@@ -683,7 +683,7 @@ var V = (e, t) => (n) => {
683
683
  key: "Shift-ArrowRight",
684
684
  run: wt
685
685
  }
686
- ])), Et = (e) => e === "h1" || e === "h2" || e === "h3" ? v.heading : v[e], Dt = [
686
+ ])), Et = (e) => e === "h1" || e === "h2" || e === "h3" ? x.heading : x[e], Dt = [
687
687
  "bold",
688
688
  "italic",
689
689
  "strike"
@@ -700,7 +700,7 @@ var V = (e, t) => (n) => {
700
700
  "mathBlock",
701
701
  "frontmatter"
702
702
  ], Nt = (e, t, n = !1) => {
703
- let r = m[t];
703
+ let r = h[t];
704
704
  return r ? {
705
705
  label: r.title,
706
706
  icon: Et(t),
@@ -710,14 +710,14 @@ var V = (e, t) => (n) => {
710
710
  r.run(e), e.focus();
711
711
  }
712
712
  } : null;
713
- }, H = (e, t, n = !1, r = !1) => {
713
+ }, G = (e, t, n = !1, r = !1) => {
714
714
  let i = [];
715
715
  for (let a of t) {
716
716
  let t = Nt(e, a, r);
717
717
  t && !(n && t.disabled) && i.push(t);
718
718
  }
719
719
  return i;
720
- }, U = (e) => {
720
+ }, K = (e) => {
721
721
  let t = e.contentDOM.ownerDocument, n = (n) => () => {
722
722
  e.focus();
723
723
  try {
@@ -727,38 +727,38 @@ var V = (e, t) => (n) => {
727
727
  return [
728
728
  {
729
729
  label: "Cut",
730
- icon: v.cut,
730
+ icon: x.cut,
731
731
  onSelect: n("cut")
732
732
  },
733
733
  {
734
734
  label: "Copy",
735
- icon: v.copy,
735
+ icon: x.copy,
736
736
  onSelect: n("copy")
737
737
  },
738
738
  i ? {
739
739
  label: "Paste",
740
- icon: v.paste,
740
+ icon: x.paste,
741
741
  onSelect: () => {
742
- let n = f(e);
742
+ let n = p(e);
743
743
  n || e.focus(), r?.readText().then((r) => {
744
744
  r && (n ? t.execCommand("insertText", !1, r) : e.dispatch(e.state.replaceSelection(r)));
745
745
  }).catch(() => {});
746
746
  }
747
747
  } : {
748
748
  label: "Paste",
749
- icon: v.paste,
749
+ icon: x.paste,
750
750
  disabled: !0,
751
751
  title: "Paste with the keyboard shortcut",
752
752
  onSelect: () => {}
753
753
  }
754
754
  ];
755
- }, W = (e, t, n, r = !1) => ({
755
+ }, q = (e, t, n, r = !1) => ({
756
756
  label: e,
757
757
  icon: t,
758
758
  rows: n,
759
759
  disabled: r
760
760
  });
761
- function G(e, t) {
761
+ function J(e, t) {
762
762
  t.length && (e.length && e.push("separator"), e.push(...t));
763
763
  }
764
764
  //#endregion
@@ -767,14 +767,14 @@ function Pt(e) {
767
767
  let t = e.selection.main;
768
768
  if (!t.empty) return !1;
769
769
  let n = e.doc.lineAt(t.head);
770
- if (!z(e, n.number)) return !1;
771
- for (let t = O(e).resolveInner(n.from, 1); t; t = t.parent) {
770
+ if (!H(e, n.number)) return !1;
771
+ for (let t = F(e).resolveInner(n.from, 1); t; t = t.parent) {
772
772
  if (t.name === "HorizontalRule") return !0;
773
773
  if (!t.parent) break;
774
774
  }
775
775
  return !1;
776
776
  }
777
- var Ft = (e) => f(e) || !Pt(e.state) ? !1 : ee(e), It = E.high(w.of([{
777
+ var Ft = (e) => p(e) || !Pt(e.state) ? !1 : ee(e), It = N.high(j.of([{
778
778
  key: "Backspace",
779
779
  run: Ft
780
780
  }, {
@@ -784,9 +784,9 @@ var Ft = (e) => f(e) || !Pt(e.state) ? !1 : ee(e), It = E.high(w.of([{
784
784
  function Lt(e) {
785
785
  return {
786
786
  label: "Remove divider",
787
- icon: v.hr,
787
+ icon: x.hr,
788
788
  onSelect: () => {
789
- m.hr?.run(e), e.focus();
789
+ h.hr?.run(e), e.focus();
790
790
  }
791
791
  };
792
792
  }
@@ -799,26 +799,26 @@ var Rt = (e) => {
799
799
  function Bt(e, t) {
800
800
  let n = e.doc.lineAt(t.from);
801
801
  if (e.doc.lineAt(t.to).number !== n.number) return null;
802
- let r = t.from - n.from, i = t.to - n.from, a = _(n.text, r) ?? _(n.text, i);
802
+ let r = t.from - n.from, i = t.to - n.from, a = y(n.text, r) ?? y(n.text, i);
803
803
  if (a) return {
804
804
  from: n.from + a.from,
805
805
  to: n.from + a.to,
806
806
  text: a.label
807
807
  };
808
- let o = ae(n.text, r) ?? ae(n.text, i);
808
+ let o = b(n.text, r) ?? b(n.text, i);
809
809
  return o ? {
810
810
  from: n.from + o.from,
811
811
  to: n.from + o.to,
812
812
  text: o.label
813
813
  } : null;
814
814
  }
815
- function K(e) {
816
- let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = _(r.text, n.head - r.from);
815
+ function Vt(e) {
816
+ let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = y(r.text, n.head - r.from);
817
817
  if (i) {
818
- let n = r.from + i.from, a = r.from + i.to, o = r.from + i.urlFrom, s = r.from + i.urlTo, c = t.facet(Te), l = [];
818
+ let n = r.from + i.from, a = r.from + i.to, o = r.from + i.urlFrom, s = r.from + i.urlTo, c = t.facet(Se), l = [];
819
819
  return c && i.url && l.push({
820
820
  label: "Open link",
821
- icon: v.link,
821
+ icon: x.link,
822
822
  onSelect: () => c(i.url)
823
823
  }), l.push({
824
824
  label: "Remove link",
@@ -838,7 +838,7 @@ function K(e) {
838
838
  }), {
839
839
  field: !0,
840
840
  label: "Edit external link",
841
- icon: v.link,
841
+ icon: x.link,
842
842
  value: zt(i.url),
843
843
  placeholder: "https://…",
844
844
  onSubmit: (t) => {
@@ -855,7 +855,7 @@ function K(e) {
855
855
  return {
856
856
  field: !0,
857
857
  label: "Add external link",
858
- icon: v.link,
858
+ icon: x.link,
859
859
  value: "",
860
860
  placeholder: "https://…",
861
861
  onSubmit: (t) => {
@@ -873,14 +873,14 @@ function K(e) {
873
873
  }
874
874
  };
875
875
  }
876
- function Vt(e) {
877
- let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = a(r.text, n.head - r.from);
876
+ function Ht(e) {
877
+ let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = o(r.text, n.head - r.from);
878
878
  if (i) {
879
879
  let t = r.from + i.from, n = r.from + i.to, a = r.from + i.targetFrom, o = r.from + i.targetTo, s = i.label || i.target;
880
880
  return {
881
881
  field: !0,
882
882
  label: "Edit link",
883
- icon: v.wikilink,
883
+ icon: x.wikilink,
884
884
  value: i.target,
885
885
  placeholder: "note or path",
886
886
  onSubmit: (t) => {
@@ -908,11 +908,11 @@ function Vt(e) {
908
908
  }]
909
909
  };
910
910
  }
911
- let o = Bt(t, n), s = o ? o.from : n.from, c = o ? o.to : n.to, l = o ? o.text : t.sliceDoc(n.from, n.to);
911
+ let a = Bt(t, n), s = a ? a.from : n.from, c = a ? a.to : n.to, l = a ? a.text : t.sliceDoc(n.from, n.to);
912
912
  return {
913
913
  field: !0,
914
914
  label: "Add link",
915
- icon: v.wikilink,
915
+ icon: x.wikilink,
916
916
  value: "",
917
917
  placeholder: "note or path",
918
918
  onSubmit: (t) => {
@@ -933,19 +933,19 @@ function Vt(e) {
933
933
  }
934
934
  //#endregion
935
935
  //#region src/inplace/context-menu-shell.ts
936
- function Ht(e, t, n, r) {
936
+ function Ut(e, t, n, r) {
937
937
  let i = r?.innerWidth ?? 0, a = r?.innerHeight ?? 0;
938
938
  e.style.left = "0", e.style.top = "0";
939
939
  let { width: o, height: s } = e.getBoundingClientRect();
940
940
  e.style.left = `${Math.max(4, Math.min(t, i - o - 4))}px`, e.style.top = `${Math.max(4, Math.min(n, a - s - 4))}px`;
941
941
  }
942
- function Ut(e, t, n) {
942
+ function Wt(e, t, n) {
943
943
  let r = n?.innerWidth ?? 0, i = n?.innerHeight ?? 0;
944
944
  e.style.left = "0", e.style.top = "0";
945
945
  let { width: a, height: o } = e.getBoundingClientRect(), s = t.right - 4, c = s + a > r - 4 ? t.left - a + 4 : s;
946
946
  e.style.left = `${Math.max(4, c)}px`, e.style.top = `${Math.max(4, Math.min(t.top - 4, i - o - 4))}px`;
947
947
  }
948
- function Wt(e, t, n, r = 350) {
948
+ function Gt(e, t, n, r = 350) {
949
949
  let i = Date.now(), a = (e) => !t.contains(e.target), o = (e) => {
950
950
  a(e) && n();
951
951
  }, s = (e) => {
@@ -959,10 +959,10 @@ function Wt(e, t, n, r = 350) {
959
959
  }
960
960
  //#endregion
961
961
  //#region src/inplace/context-menu-types.ts
962
- var Gt = (e) => typeof e != "string" && "rows" in e, Kt = (e) => typeof e != "string" && "field" in e;
962
+ var Kt = (e) => typeof e != "string" && "rows" in e, qt = (e) => typeof e != "string" && "field" in e;
963
963
  //#endregion
964
964
  //#region src/inplace/context-menu.ts
965
- function q(e, t = "cm-inplace-menu", n) {
965
+ function Y(e, t = "cm-inplace-menu", n) {
966
966
  let r = e.defaultView, i = e.createElement("div");
967
967
  i.className = t, i.setAttribute("contenteditable", "false"), i.hidden = !0;
968
968
  let a = null, o = null, s = () => {
@@ -972,7 +972,7 @@ function q(e, t = "cm-inplace-menu", n) {
972
972
  }, l = (e) => e.addEventListener("mousedown", (e) => {
973
973
  e.preventDefault(), e.stopPropagation();
974
974
  }), u = (t, n, r) => {
975
- r && t.appendChild(oe(e, r));
975
+ r && t.appendChild(ie(e, r));
976
976
  let i = e.createElement("span");
977
977
  i.textContent = n, t.appendChild(i);
978
978
  }, d = (n) => {
@@ -990,7 +990,7 @@ function q(e, t = "cm-inplace-menu", n) {
990
990
  if (a?.dataset.for === n) return;
991
991
  s();
992
992
  let e = c();
993
- e.dataset.for = n, i.appendChild(e), Ut(e, f.getBoundingClientRect(), r), a = e, e.querySelector("input")?.focus({ preventScroll: !0 });
993
+ e.dataset.for = n, i.appendChild(e), Wt(e, f.getBoundingClientRect(), r), a = e, e.querySelector("input")?.focus({ preventScroll: !0 });
994
994
  };
995
995
  return f.addEventListener("pointerenter", p), f.addEventListener("click", (e) => {
996
996
  e.stopPropagation(), p();
@@ -1013,7 +1013,7 @@ function q(e, t = "cm-inplace-menu", n) {
1013
1013
  for (let i of n) if (i === "separator") {
1014
1014
  let n = e.createElement("div");
1015
1015
  n.className = `${t}-sep`, r.appendChild(n);
1016
- } else Gt(i) ? r.appendChild(f(i.label, i.icon, () => m(i.rows), i.disabled)) : Kt(i) ? r.appendChild(f(i.label, i.icon, () => p(i))) : r.appendChild(d(i));
1016
+ } else Kt(i) ? r.appendChild(f(i.label, i.icon, () => m(i.rows), i.disabled)) : qt(i) ? r.appendChild(f(i.label, i.icon, () => p(i))) : r.appendChild(d(i));
1017
1017
  return r;
1018
1018
  };
1019
1019
  return {
@@ -1024,12 +1024,12 @@ function q(e, t = "cm-inplace-menu", n) {
1024
1024
  show: (t, a, s) => {
1025
1025
  c();
1026
1026
  let l = m(t);
1027
- i.appendChild(l), i.hidden = !1, Ht(l, a, s, r), o = Wt(e, i, c), n?.(!0);
1027
+ i.appendChild(l), i.hidden = !1, Ut(l, a, s, r), o = Gt(e, i, c), n?.(!0);
1028
1028
  },
1029
1029
  showField: (t, a, s) => {
1030
1030
  c();
1031
1031
  let l = p(t);
1032
- i.appendChild(l), i.hidden = !1, Ht(l, a, s, r), l.querySelector("input")?.focus({ preventScroll: !0 }), o = Wt(e, i, c), n?.(!0);
1032
+ i.appendChild(l), i.hidden = !1, Ut(l, a, s, r), l.querySelector("input")?.focus({ preventScroll: !0 }), o = Gt(e, i, c), n?.(!0);
1033
1033
  },
1034
1034
  hide: c,
1035
1035
  destroy: () => {
@@ -1039,14 +1039,14 @@ function q(e, t = "cm-inplace-menu", n) {
1039
1039
  }
1040
1040
  //#endregion
1041
1041
  //#region src/inplace/math-edit.ts
1042
- function qt(e) {
1043
- let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = L(r.text, n.head - r.from);
1042
+ function Jt(e) {
1043
+ let { state: t } = e, n = t.selection.main, r = t.doc.lineAt(n.head), i = Be(r.text, n.head - r.from);
1044
1044
  if (i) {
1045
1045
  let t = r.from + i.from, n = r.from + i.to, a = i.block ? "$$" : "$";
1046
1046
  return {
1047
1047
  field: !0,
1048
1048
  label: "Edit math",
1049
- icon: v.math,
1049
+ icon: x.math,
1050
1050
  value: i.src,
1051
1051
  placeholder: "e^{i\\pi} + 1 = 0",
1052
1052
  onSubmit: (r) => {
@@ -1079,7 +1079,7 @@ function qt(e) {
1079
1079
  return {
1080
1080
  field: !0,
1081
1081
  label: "Add math",
1082
- icon: v.math,
1082
+ icon: x.math,
1083
1083
  value: "",
1084
1084
  placeholder: "e^{i\\pi} + 1 = 0",
1085
1085
  onSubmit: (t) => {
@@ -1098,27 +1098,27 @@ function qt(e) {
1098
1098
  }
1099
1099
  };
1100
1100
  }
1101
- var Jt = class {
1101
+ var Yt = class {
1102
1102
  menu;
1103
1103
  contentDOM;
1104
1104
  onClick;
1105
1105
  constructor(e) {
1106
- this.menu = q(e.dom.ownerDocument), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onClick = (t) => {
1107
- if (!e.state.facet(k).math) return;
1106
+ this.menu = Y(e.dom.ownerDocument), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onClick = (t) => {
1107
+ if (!e.state.facet(I).math) return;
1108
1108
  let n = t.target?.closest(".cm-inplace-math");
1109
1109
  if (!n) return;
1110
1110
  let r = e.posAtDOM(n);
1111
1111
  if (r < 0) return;
1112
1112
  let i = e.state.doc.lineAt(r);
1113
- L(i.text, r - i.from) && (e.dispatch({ selection: { anchor: r } }), this.menu.showField(qt(e), t.clientX, t.clientY));
1113
+ Be(i.text, r - i.from) && (e.dispatch({ selection: { anchor: r } }), this.menu.showField(Jt(e), t.clientX, t.clientY));
1114
1114
  }, this.contentDOM.addEventListener("click", this.onClick);
1115
1115
  }
1116
1116
  destroy() {
1117
1117
  this.contentDOM.removeEventListener("click", this.onClick), this.menu.destroy();
1118
1118
  }
1119
- }, Yt = S.fromClass(Jt), Xt = he((e, t) => {
1120
- if (!e.state.facet(k).math) return null;
1121
- let n = e.state.doc.lineAt(t), r = L(n.text, t - n.from);
1119
+ }, Xt = k.fromClass(Yt), Zt = le((e, t) => {
1120
+ if (!e.state.facet(I).math) return null;
1121
+ let n = e.state.doc.lineAt(t), r = Be(n.text, t - n.from);
1122
1122
  return r ? {
1123
1123
  pos: n.from + r.from,
1124
1124
  end: n.from + r.to,
@@ -1131,18 +1131,18 @@ var Jt = class {
1131
1131
  });
1132
1132
  //#endregion
1133
1133
  //#region src/inplace/context-menu-actions.ts
1134
- function J(e) {
1135
- let t = f(e);
1134
+ function X(e) {
1135
+ let t = p(e);
1136
1136
  if (!t) return !1;
1137
- let { from: n, to: r } = l(t);
1137
+ let { from: n, to: r } = u(t);
1138
1138
  return r > n;
1139
1139
  }
1140
- function Zt(e) {
1141
- let t = te(e.state);
1140
+ function Qt(e) {
1141
+ let t = v(e.state);
1142
1142
  return {
1143
1143
  field: !0,
1144
1144
  label: "Language",
1145
- icon: v.codeBlock,
1145
+ icon: x.codeBlock,
1146
1146
  value: t?.lang ?? "",
1147
1147
  placeholder: "ts, python, …",
1148
1148
  onSubmit: (n) => {
@@ -1155,49 +1155,49 @@ function Zt(e) {
1155
1155
  actions: [{
1156
1156
  label: "Remove code block",
1157
1157
  onSelect: () => {
1158
- m.codeBlock?.run(e), e.focus();
1158
+ h.codeBlock?.run(e), e.focus();
1159
1159
  }
1160
1160
  }]
1161
1161
  };
1162
1162
  }
1163
- var Qt = (e, t = !1) => [
1164
- ...H(e, Dt, !1, t),
1163
+ var $t = (e, t = !1) => [
1164
+ ...G(e, Dt, !1, t),
1165
1165
  "separator",
1166
- ...t ? H(e, Ot, !1, !0) : [Nt(e, "code", !1), qt(e)]
1166
+ ...t ? G(e, Ot, !1, !0) : [Nt(e, "code", !1), Jt(e)]
1167
1167
  ];
1168
- function $t(e) {
1169
- let t = e.state.facet(ke), n = [];
1170
- return t.includes("format") && G(n, [W("Format", v.format, Qt(e, !0))]), t.includes("clipboard") && G(n, U(e)), n;
1168
+ function en(e) {
1169
+ let t = e.state.facet(Ee), n = [];
1170
+ return t.includes("format") && J(n, [q("Format", x.format, $t(e, !0))]), t.includes("clipboard") && J(n, K(e)), n;
1171
1171
  }
1172
- var en = (e) => [
1173
- ...H(e, kt),
1172
+ var tn = (e) => [
1173
+ ...G(e, kt),
1174
1174
  "separator",
1175
- ...H(e, [...At, "body"]),
1175
+ ...G(e, [...At, "body"]),
1176
1176
  "separator",
1177
- ...H(e, ["quote"])
1178
- ], tn = (e) => [
1179
- ...H(e, jt),
1177
+ ...G(e, ["quote"])
1178
+ ], nn = (e) => [
1179
+ ...G(e, jt),
1180
1180
  "separator",
1181
- ...H(e, Mt)
1181
+ ...G(e, Mt)
1182
1182
  ];
1183
- function nn(e) {
1184
- let { state: t } = e, n = t.facet(ke), r = (e) => n.includes(e);
1185
- if (J(e)) return $t(e);
1186
- if (o(t)) {
1187
- let t = [Zt(e)];
1188
- return r("clipboard") && G(t, U(e)), t;
1183
+ function rn(e) {
1184
+ let { state: t } = e, n = t.facet(Ee), r = (e) => n.includes(e);
1185
+ if (X(e)) return en(e);
1186
+ if (s(t)) {
1187
+ let t = [Qt(e)];
1188
+ return r("clipboard") && J(t, K(e)), t;
1189
1189
  }
1190
1190
  if (Pt(t)) {
1191
1191
  let t = [Lt(e)];
1192
- return r("clipboard") && G(t, U(e)), t;
1192
+ return r("clipboard") && J(t, K(e)), t;
1193
1193
  }
1194
- let i = t.selection.main, a = t.doc.lineAt(i.head).text.trim() === "", s = !i.empty || !!t.wordAt(i.head), c = t.facet(Me) === "menu", l = [];
1195
- for (let t of n) t === "link" && c ? G(l, [Vt(e), K(e)]) : t === "format" && c ? G(l, [W("Format", v.format, Qt(e), !s)]) : t === "paragraph" ? G(l, [W("Paragraph", v.paragraph, en(e))]) : t === "insert" ? G(l, [W("Insert", v.insert, tn(e), !a)]) : t === "clipboard" && G(l, U(e));
1194
+ let i = t.selection.main, a = t.doc.lineAt(i.head).text.trim() === "", o = !i.empty || !!t.wordAt(i.head), c = t.facet(ke) === "menu", l = [];
1195
+ for (let t of n) t === "link" && c ? J(l, [Ht(e), Vt(e)]) : t === "format" && c ? J(l, [q("Format", x.format, $t(e), !o)]) : t === "paragraph" ? J(l, [q("Paragraph", x.paragraph, tn(e))]) : t === "insert" ? J(l, [q("Insert", x.insert, nn(e), !a)]) : t === "clipboard" && J(l, K(e));
1196
1196
  return l;
1197
1197
  }
1198
1198
  //#endregion
1199
1199
  //#region src/inplace/long-press.ts
1200
- function rn(e, t) {
1200
+ function an(e, t) {
1201
1201
  let n = t.delay ?? 450, r = t.slop ?? 20, i = null, a = 0, o = 0, s = () => {
1202
1202
  i != null && (clearTimeout(i), i = null);
1203
1203
  }, c = (e) => {
@@ -1219,10 +1219,10 @@ function rn(e, t) {
1219
1219
  }
1220
1220
  //#endregion
1221
1221
  //#region src/inplace/table-gizmos.ts
1222
- function an(e, t) {
1222
+ function on(e, t) {
1223
1223
  let n = e.createElement("div");
1224
1224
  n.className = "cm-inplace-table-gizmos", n.setAttribute("contenteditable", "false");
1225
- let r = q(e), i = (t, n, r) => {
1225
+ let r = Y(e), i = (t, n, r) => {
1226
1226
  let i = e.createElement("button");
1227
1227
  return i.type = "button", i.className = t, i.setAttribute("aria-label", n), i.addEventListener("mousedown", (e) => {
1228
1228
  e.preventDefault(), e.stopPropagation();
@@ -1305,7 +1305,7 @@ function an(e, t) {
1305
1305
  }
1306
1306
  //#endregion
1307
1307
  //#region src/inplace/table-widget-caret.ts
1308
- function on(e) {
1308
+ function sn(e) {
1309
1309
  let t = e.ownerDocument.getSelection(), n = e.firstChild, r = (e.textContent ?? "").length, i = t?.anchorNode === n ? t?.anchorOffset ?? 0 : r;
1310
1310
  return {
1311
1311
  offset: i,
@@ -1314,66 +1314,66 @@ function on(e) {
1314
1314
  }
1315
1315
  //#endregion
1316
1316
  //#region src/inplace/inline-md.ts
1317
- function sn(e, t = !1) {
1317
+ function cn(e, t = !1) {
1318
1318
  let n = document.createDocumentFragment();
1319
- return un(n, e, t), n;
1319
+ return dn(n, e, t), n;
1320
1320
  }
1321
- var cn = /!\[\[[^\]\n]+?\]\]/, ln = [
1321
+ var ln = /!\[\[[^\]\n]+?\]\]/, un = [
1322
1322
  {
1323
1323
  re: /`([^`\n]+)`/,
1324
- build: (e) => Y("code", "cm-inplace-code", document.createTextNode(e[1]))
1324
+ build: (e) => Z("code", "cm-inplace-code", document.createTextNode(e[1]))
1325
1325
  },
1326
1326
  {
1327
1327
  re: /(?<![\d$])\$(?!\s)([^$\n]+?)(?<!\s)\$(?![\d$])/,
1328
1328
  build: (e) => {
1329
- let t = Y("span", "cm-inplace-math");
1330
- return de.render(e[1], t, { throwOnError: !1 }), t;
1329
+ let t = Z("span", "cm-inplace-math");
1330
+ return se.render(e[1], t, { throwOnError: !1 }), t;
1331
1331
  }
1332
1332
  },
1333
1333
  {
1334
1334
  re: new RegExp(t.source),
1335
1335
  build: (e) => {
1336
- let t = Y("span", "cm-inplace-wikilink", document.createTextNode(e[2] || e[1] || ""));
1336
+ let t = Z("span", "cm-inplace-wikilink", document.createTextNode(e[2] || e[1] || ""));
1337
1337
  return t.dataset.styloWikilink = e[1] ?? "", t;
1338
1338
  }
1339
1339
  },
1340
1340
  {
1341
1341
  re: /\[([^\]\n]*)\]\(([^)\n]*)\)/,
1342
1342
  build: (e, t) => {
1343
- let n = Y("a", "cm-inplace-link");
1344
- return n.href = e[2] ?? "", n.append(X(e[1] ?? "", t)), n;
1343
+ let n = Z("a", "cm-inplace-link");
1344
+ return n.href = e[2] ?? "", n.append(Q(e[1] ?? "", t)), n;
1345
1345
  }
1346
1346
  },
1347
1347
  {
1348
1348
  re: /\*\*\*([^*\n]+?)\*\*\*/,
1349
- build: (e, t) => Y("strong", "cm-inplace-strong", Y("em", "cm-inplace-em", X(e[1], t)))
1349
+ build: (e, t) => Z("strong", "cm-inplace-strong", Z("em", "cm-inplace-em", Q(e[1], t)))
1350
1350
  },
1351
1351
  {
1352
1352
  re: /\*\*([^\n]+?)\*\*/,
1353
- build: (e, t) => Y("strong", "cm-inplace-strong", X(e[1], t))
1353
+ build: (e, t) => Z("strong", "cm-inplace-strong", Q(e[1], t))
1354
1354
  },
1355
1355
  {
1356
1356
  re: /~~([^\n]+?)~~/,
1357
- build: (e, t) => Y("span", "cm-inplace-strike", X(e[1], t))
1357
+ build: (e, t) => Z("span", "cm-inplace-strike", Q(e[1], t))
1358
1358
  },
1359
1359
  {
1360
1360
  re: /(?<!\*)\*(?!\*|\s)([^\n]+?)(?<!\s)\*(?!\*)/,
1361
- build: (e, t) => Y("em", "cm-inplace-em", X(e[1], t))
1361
+ build: (e, t) => Z("em", "cm-inplace-em", Q(e[1], t))
1362
1362
  }
1363
1363
  ];
1364
- function Y(e, t, ...n) {
1364
+ function Z(e, t, ...n) {
1365
1365
  let r = document.createElement(e);
1366
1366
  return r.className = t, r.append(...n), r;
1367
1367
  }
1368
- function X(e, t) {
1368
+ function Q(e, t) {
1369
1369
  let n = document.createDocumentFragment();
1370
- return un(n, e, t), n;
1370
+ return dn(n, e, t), n;
1371
1371
  }
1372
- function un(e, t, n) {
1372
+ function dn(e, t, n) {
1373
1373
  for (; t;) {
1374
- let r = -1, i = null, a = n ? cn.exec(t) : null;
1374
+ let r = -1, i = null, a = n ? ln.exec(t) : null;
1375
1375
  a && (r = a.index, i = { literal: a[0] });
1376
- for (let e of ln) {
1376
+ for (let e of un) {
1377
1377
  let n = e.re.exec(t);
1378
1378
  n && (r < 0 || n.index < r) && (r = n.index, i = {
1379
1379
  rule: e,
@@ -1389,53 +1389,121 @@ function un(e, t, n) {
1389
1389
  }
1390
1390
  //#endregion
1391
1391
  //#region src/inplace/table-widget-render.ts
1392
- function dn(e, t, n) {
1392
+ function fn(e, t, n) {
1393
1393
  let r = Number(e.dataset.r), i = Number(e.dataset.c), a = t.rows[r]?.[i] ?? "";
1394
- e.replaceChildren(n ? e.ownerDocument.createTextNode(a) : sn(ie(a), t.embeds));
1394
+ e.replaceChildren(n ? e.ownerDocument.createTextNode(a) : cn(re(a), t.embeds));
1395
1395
  }
1396
- function fn(e, t, n, r) {
1396
+ function pn(e, t, n, r) {
1397
1397
  let i = document.createElement(r ? "th" : "td");
1398
1398
  i.className = "cm-inplace-tcell", i.setAttribute("contenteditable", "true"), i.dataset.r = String(t), i.dataset.c = String(n);
1399
1399
  let a = e.aligns[n];
1400
- return a && (i.style.textAlign = a), dn(i, e, !1), i;
1400
+ return a && (i.style.textAlign = a), fn(i, e, !1), i;
1401
1401
  }
1402
- function pn(e, t) {
1402
+ function mn(e, t) {
1403
1403
  e.replaceChildren();
1404
1404
  let n = t.aligns.length, r = e.createTHead().insertRow();
1405
- for (let e = 0; e < n; e++) r.appendChild(fn(t, 0, e, !0));
1405
+ for (let e = 0; e < n; e++) r.appendChild(pn(t, 0, e, !0));
1406
1406
  let i = e.createTBody();
1407
1407
  for (let e = 1; e < t.rows.length; e++) {
1408
1408
  let r = i.insertRow();
1409
- for (let i = 0; i < n; i++) r.appendChild(fn(t, e, i, !1));
1409
+ for (let i = 0; i < n; i++) r.appendChild(pn(t, e, i, !1));
1410
1410
  }
1411
1411
  }
1412
1412
  //#endregion
1413
1413
  //#region src/inplace/table-structure.ts
1414
- var Z = (e) => e.aligns.length;
1415
- function mn(e, t) {
1416
- let n = Math.max(0, Math.min(t, Z(e)));
1414
+ var $ = (e) => e.aligns.length;
1415
+ function hn(e, t) {
1416
+ let n = Math.max(0, Math.min(t, $(e)));
1417
1417
  for (let t of e.rows) t.splice(n, 0, "");
1418
1418
  e.aligns.splice(n, 0, "");
1419
1419
  }
1420
- function hn(e, t) {
1421
- if (!(Z(e) <= 1 || t < 0 || t >= Z(e))) {
1420
+ function gn(e, t) {
1421
+ if (!($(e) <= 1 || t < 0 || t >= $(e))) {
1422
1422
  for (let n of e.rows) n.splice(t, 1);
1423
1423
  e.aligns.splice(t, 1);
1424
1424
  }
1425
1425
  }
1426
- function gn(e, t) {
1426
+ function _n(e, t) {
1427
1427
  let n = Math.max(1, Math.min(t, e.rows.length));
1428
- e.rows.splice(n, 0, Array(Z(e)).fill(""));
1428
+ e.rows.splice(n, 0, Array($(e)).fill(""));
1429
1429
  }
1430
- function _n(e, t) {
1430
+ function vn(e, t) {
1431
1431
  t <= 0 || t >= e.rows.length || e.rows.length <= 2 || e.rows.splice(t, 1);
1432
1432
  }
1433
- function vn(e, t, n) {
1434
- t >= 0 && t < Z(e) && (e.aligns[t] = n);
1433
+ function yn(e, t, n) {
1434
+ t >= 0 && t < $(e) && (e.aligns[t] = n);
1435
1435
  }
1436
1436
  //#endregion
1437
- //#region src/inplace/table-widget.ts
1438
- var Q = ge.define(), yn = class extends C {
1437
+ //#region src/inplace/tables.ts
1438
+ var bn = class extends A {
1439
+ table;
1440
+ embeds;
1441
+ constructor(e, t) {
1442
+ super(), this.table = e, this.embeds = t;
1443
+ }
1444
+ eq(e) {
1445
+ return JSON.stringify(this.table) === JSON.stringify(e.table);
1446
+ }
1447
+ toDOM() {
1448
+ let { head: e, body: t, aligns: n } = this.table, r = document.createElement("table");
1449
+ r.className = "cm-inplace-table";
1450
+ let i = (e) => cn(e.replace(/\\\|/g, "|"), this.embeds), a = r.createTHead().insertRow();
1451
+ e.forEach((e, t) => {
1452
+ let r = document.createElement("th");
1453
+ r.appendChild(i(e)), r.dataset.styloRow = "0", r.dataset.styloCol = String(t), xn(r, n[t]), a.appendChild(r);
1454
+ });
1455
+ let o = r.createTBody();
1456
+ return t.forEach((t, r) => {
1457
+ let a = o.insertRow();
1458
+ for (let o = 0; o < e.length; o++) {
1459
+ let e = a.insertCell();
1460
+ e.appendChild(i(t[o] ?? "")), e.dataset.styloRow = String(r + 1), e.dataset.styloCol = String(o), xn(e, n[o]);
1461
+ }
1462
+ }), r;
1463
+ }
1464
+ ignoreEvent() {
1465
+ return !1;
1466
+ }
1467
+ };
1468
+ function xn(e, t) {
1469
+ t && (e.style.textAlign = t);
1470
+ }
1471
+ function Sn(e, t) {
1472
+ let n = t.lineAt(e.from).number, r = t.lineAt(e.to).number, i = [];
1473
+ for (let e = n; e <= r; e++) i.push(t.line(e).text);
1474
+ let o = a(i);
1475
+ return !o || o.rows.length === 0 ? null : {
1476
+ head: o.rows[0],
1477
+ body: o.rows.slice(1),
1478
+ aligns: o.aligns
1479
+ };
1480
+ }
1481
+ function Cn(e) {
1482
+ if (!e.facet(I).tables) return D.none;
1483
+ let t = e.facet(xe) === "cells", r = e.facet(L) != null && e.facet(I).embeds, i = F(e), a = n(e.doc), o = t ? null : B(e), s = [];
1484
+ return i.iterate({ enter: (n) => {
1485
+ if (n.name !== "Table") return;
1486
+ if (a && n.from < a.to) return !1;
1487
+ if (o) {
1488
+ let t = e.doc.lineAt(n.from).number, r = e.doc.lineAt(n.to).number;
1489
+ for (let e = t; e <= r; e++) if (o.has(e)) return !1;
1490
+ }
1491
+ let i = Sn(n.node, e.doc);
1492
+ if (i) {
1493
+ let e = t ? new En(i, r) : new bn(i, r);
1494
+ s.push(D.replace({
1495
+ widget: e,
1496
+ block: !0
1497
+ }).range(n.from, n.to));
1498
+ }
1499
+ return !1;
1500
+ } }), D.set(s, !0);
1501
+ }
1502
+ var wn = P.define({
1503
+ create: Cn,
1504
+ update: (e, t) => t.annotation(Tn) ? e.map(t.changes) : t.state.facet(xe) === "cells" ? t.docChanged ? Cn(t.state) : e.map(t.changes) : t.docChanged || t.selection ? Cn(t.state) : e,
1505
+ provide: (e) => [O.decorations.from(e), O.atomicRanges.of((t) => t.state.field(e))]
1506
+ }), Tn = fe.define(), En = class extends A {
1439
1507
  data;
1440
1508
  embeds;
1441
1509
  table = null;
@@ -1448,7 +1516,7 @@ var Q = ge.define(), yn = class extends C {
1448
1516
  longPress = null;
1449
1517
  longPressAt = 0;
1450
1518
  constructor(e, t = !1) {
1451
- super(), this.data = e, this.embeds = t, this.rows = s(e), this.current = r(this.rows);
1519
+ super(), this.data = e, this.embeds = t, this.rows = c(e), this.current = i(this.rows);
1452
1520
  }
1453
1521
  eq(e) {
1454
1522
  return !this.table && JSON.stringify(this.current) === JSON.stringify(e.current);
@@ -1460,16 +1528,11 @@ var Q = ge.define(), yn = class extends C {
1460
1528
  return this.data.aligns.length;
1461
1529
  }
1462
1530
  bounds(e) {
1463
- let t = e.state.doc, n = (e) => {
1464
- let n = t.line(e).text;
1465
- return n.trim() !== "" && n.includes("|");
1466
- }, r = t.lineAt(e.posAtDOM(this.table)).number, i = r;
1467
- for (; r > 1 && n(r - 1);) r--;
1468
- for (; i < t.lines && n(i + 1);) i++;
1469
- return {
1470
- from: t.line(r).from,
1471
- to: t.line(i).to
1472
- };
1531
+ let t = e.posAtDOM(this.table), n = null;
1532
+ return e.state.field(wn).between(t, t, (e, t) => (n = {
1533
+ from: e,
1534
+ to: t
1535
+ }, !1)), n ?? e.state.doc.lineAt(t);
1473
1536
  }
1474
1537
  cellAt(e, t) {
1475
1538
  return this.table ? (e === 0 ? this.table.tHead.rows[0] : this.table.tBodies[0].rows[e - 1])?.cells[t] ?? null : null;
@@ -1481,21 +1544,21 @@ var Q = ge.define(), yn = class extends C {
1481
1544
  };
1482
1545
  }
1483
1546
  paint(e, t) {
1484
- dn(e, {
1547
+ fn(e, {
1485
1548
  rows: this.rows,
1486
1549
  aligns: this.data.aligns,
1487
1550
  embeds: this.embeds
1488
1551
  }, t);
1489
1552
  }
1490
1553
  renderCells() {
1491
- pn(this.table, {
1554
+ mn(this.table, {
1492
1555
  rows: this.rows,
1493
1556
  aligns: this.data.aligns,
1494
1557
  embeds: this.embeds
1495
1558
  });
1496
1559
  }
1497
1560
  appendRow() {
1498
- gn(this.model(), this.rows.length), this.renderCells(), this.gizmos?.layout(this.table);
1561
+ _n(this.model(), this.rows.length), this.renderCells(), this.gizmos?.layout(this.table);
1499
1562
  }
1500
1563
  model() {
1501
1564
  return {
@@ -1506,7 +1569,7 @@ var Q = ge.define(), yn = class extends C {
1506
1569
  runOp(e, t) {
1507
1570
  if (!this.table) return;
1508
1571
  let n = this.model();
1509
- if (t.kind === "insertColumn" ? mn(n, t.at) : t.kind === "deleteColumn" ? hn(n, t.at) : t.kind === "insertRow" ? gn(n, t.at) : t.kind === "deleteRow" ? _n(n, t.at) : vn(n, t.at, n.aligns[t.at] === t.value ? "" : t.value), this.editing = null, this.sync(e), this.renderCells(), this.gizmos?.layout(this.table), t.kind !== "align") {
1572
+ if (t.kind === "insertColumn" ? hn(n, t.at) : t.kind === "deleteColumn" ? gn(n, t.at) : t.kind === "insertRow" ? _n(n, t.at) : t.kind === "deleteRow" ? vn(n, t.at) : yn(n, t.at, n.aligns[t.at] === t.value ? "" : t.value), this.editing = null, this.sync(e), this.renderCells(), this.gizmos?.layout(this.table), t.kind !== "align") {
1510
1573
  let e = Math.max(0, Math.min(t.focus[0], this.rows.length - 1)), n = Math.max(0, Math.min(t.focus[1], this.cols() - 1));
1511
1574
  this.cellAt(e, n)?.focus();
1512
1575
  }
@@ -1518,8 +1581,8 @@ var Q = ge.define(), yn = class extends C {
1518
1581
  onFocusIn(e) {
1519
1582
  let t = e.target.closest("td, th");
1520
1583
  if (!t || t === this.editing) return;
1521
- let n = this.pendingOffset ?? p(t);
1522
- this.pendingOffset = null, this.editing && this.finish(this.editing, !1), this.editing = t, this.paint(t, !0), g(t, n);
1584
+ let n = this.pendingOffset ?? m(t);
1585
+ this.pendingOffset = null, this.editing && this.finish(this.editing, !1), this.editing = t, this.paint(t, !0), _(t, n);
1523
1586
  }
1524
1587
  onFocusOut(e) {
1525
1588
  if (this.syncing || !this.editing) return;
@@ -1532,28 +1595,28 @@ var Q = ge.define(), yn = class extends C {
1532
1595
  return {
1533
1596
  r: e,
1534
1597
  c: t,
1535
- ...on(this.editing)
1598
+ ...sn(this.editing)
1536
1599
  };
1537
1600
  }
1538
1601
  writeCaret(e) {
1539
1602
  let t = this.cellAt(e.r, e.c);
1540
- t && g(t, e.offset, e.head);
1603
+ t && _(t, e.offset, e.head);
1541
1604
  }
1542
1605
  sync(e) {
1543
1606
  if (!this.table) return;
1544
- let t = this.readCaret(), n = h({
1607
+ let t = this.readCaret(), n = g({
1545
1608
  rows: this.rows,
1546
1609
  aligns: this.data.aligns
1547
1610
  });
1548
- this.current = r(this.rows);
1549
- let { from: i, to: a } = this.bounds(e);
1550
- e.state.sliceDoc(i, a) !== n && (this.syncing = !0, e.dispatch({
1611
+ this.current = i(this.rows);
1612
+ let { from: r, to: a } = this.bounds(e);
1613
+ e.state.sliceDoc(r, a) !== n && (this.syncing = !0, e.dispatch({
1551
1614
  changes: {
1552
- from: i,
1615
+ from: r,
1553
1616
  to: a,
1554
1617
  insert: n
1555
1618
  },
1556
- annotations: Q.of(!0),
1619
+ annotations: Tn.of(!0),
1557
1620
  userEvent: "input"
1558
1621
  }), this.syncing = !1, t && (this.writeCaret(t), requestAnimationFrame(() => {
1559
1622
  this.table && t && this.writeCaret(t);
@@ -1562,7 +1625,7 @@ var Q = ge.define(), yn = class extends C {
1562
1625
  onKey(e, t) {
1563
1626
  let n = e.target.closest("td, th");
1564
1627
  if (!n || !this.table) return;
1565
- if (re(e, n)) {
1628
+ if (ne(e, n)) {
1566
1629
  e.stopPropagation();
1567
1630
  return;
1568
1631
  }
@@ -1621,8 +1684,8 @@ var Q = ge.define(), yn = class extends C {
1621
1684
  openCellMenuAt(e, t, n, r) {
1622
1685
  let i = r?.closest("td, th");
1623
1686
  if (!i) return;
1624
- this.editing === i && !J(e) && u(i, t, n);
1625
- let a = J(e) ? $t(e) : void 0;
1687
+ this.editing === i && !X(e) && d(i, t, n);
1688
+ let a = X(e) ? en(e) : void 0;
1626
1689
  this.gizmos?.openFor(i, t, n, a);
1627
1690
  }
1628
1691
  toDOM(e) {
@@ -1632,7 +1695,7 @@ var Q = ge.define(), yn = class extends C {
1632
1695
  this.table = n, this.editing = null, n.className = "cm-inplace-table cm-inplace-table-edit", this.renderCells(), n.addEventListener("mousedown", (e) => {
1633
1696
  e.stopPropagation();
1634
1697
  let t = e.target.closest("td, th");
1635
- this.pendingOffset = t && t !== this.editing ? c(t, e.clientX, e.clientY) : null;
1698
+ this.pendingOffset = t && t !== this.editing ? l(t, e.clientX, e.clientY) : null;
1636
1699
  }), n.addEventListener("focusin", (e) => this.onFocusIn(e)), n.addEventListener("focusout", (e) => this.onFocusOut(e));
1637
1700
  let r = (t) => {
1638
1701
  t && (this.editing = t, this.finish(t, !0), this.sync(e));
@@ -1645,9 +1708,9 @@ var Q = ge.define(), yn = class extends C {
1645
1708
  document.execCommand("insertText", !1, t);
1646
1709
  }), n.addEventListener("contextmenu", (t) => {
1647
1710
  t.target.closest("td, th") && (t.preventDefault(), t.stopPropagation(), this.longPress?.cancel(), !(Date.now() - this.longPressAt < 700) && this.openCellMenuAt(e, t.clientX, t.clientY, t.target));
1648
- }), this.longPress = rn(n, { onLongPress: (t, n, r) => {
1711
+ }), this.longPress = an(n, { onLongPress: (t, n, r) => {
1649
1712
  this.longPressAt = Date.now(), this.openCellMenuAt(e, t, n, r);
1650
- } }), this.gizmos = an(document, {
1713
+ } }), this.gizmos = on(document, {
1651
1714
  dims: () => ({
1652
1715
  cols: this.cols(),
1653
1716
  rows: this.rows.length,
@@ -1659,12 +1722,12 @@ var Q = ge.define(), yn = class extends C {
1659
1722
  destroy() {
1660
1723
  this.longPress?.dispose(), this.longPress = null, this.gizmos?.destroy(), this.gizmos = null, this.table = null, this.editing = null;
1661
1724
  }
1662
- }, bn = /* @__PURE__ */ new Set([
1725
+ }, Dn = /* @__PURE__ */ new Set([
1663
1726
  "-",
1664
1727
  "*",
1665
1728
  "_"
1666
- ]), xn = ve.transactionFilter.of((e) => {
1667
- if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(Q) || !e.startState.selection.main.empty) return e;
1729
+ ]), On = me.transactionFilter.of((e) => {
1730
+ if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(Tn) || !e.startState.selection.main.empty) return e;
1668
1731
  let t = e.startState.selection.main.head, n = "", r = 0;
1669
1732
  if (e.changes.iterChanges((e, i, a, o, s) => {
1670
1733
  r += 1, e === i && e === t && (n = s.toString());
@@ -1694,7 +1757,7 @@ var Q = ge.define(), yn = class extends C {
1694
1757
  },
1695
1758
  anchor: a + 1
1696
1759
  };
1697
- else if (bn.has(n) && RegExp(`^\\${n}{3,}$`).test(s)) {
1760
+ else if (Dn.has(n) && RegExp(`^\\${n}{3,}$`).test(s)) {
1698
1761
  let e = o.number === 1 || i.line(o.number - 1).text.trim() === "", t = n === "-" && !e, r = o.number === i.lines;
1699
1762
  if (t || r) {
1700
1763
  let e = [];
@@ -1717,38 +1780,38 @@ var Q = ge.define(), yn = class extends C {
1717
1780
  scrollIntoView: !0,
1718
1781
  userEvent: "input.autoformat"
1719
1782
  }] : e;
1720
- }), Sn = /* @__PURE__ */ new Set([
1783
+ }), kn = /* @__PURE__ */ new Set([
1721
1784
  "EmphasisMark",
1722
1785
  "CodeMark",
1723
1786
  "StrikethroughMark"
1724
1787
  ]);
1725
- function Cn(e, t, n) {
1788
+ function An(e, t, n) {
1726
1789
  let r = t;
1727
1790
  for (;;) {
1728
1791
  let t = e.resolveInner(r, n);
1729
- if (!Sn.has(t.name) || t.from >= t.to) return r;
1792
+ if (!kn.has(t.name) || t.from >= t.to) return r;
1730
1793
  let i = n < 0 ? t.from : t.to;
1731
1794
  if (i === r) return r;
1732
1795
  r = i;
1733
1796
  }
1734
1797
  }
1735
- function wn(e, t) {
1736
- let n = B(e, t, !0);
1798
+ function jn(e, t) {
1799
+ let n = U(e, t, !0);
1737
1800
  if (!n) return t;
1738
- let r = O(e);
1739
- return t === n.contentTo ? Cn(r, t, 1) : t === n.contentFrom ? Cn(r, t, -1) : t;
1801
+ let r = F(e);
1802
+ return t === n.contentTo ? An(r, t, 1) : t === n.contentFrom ? An(r, t, -1) : t;
1740
1803
  }
1741
- var Tn = ve.transactionFilter.of((e) => {
1742
- if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(Q)) return e;
1804
+ var Mn = me.transactionFilter.of((e) => {
1805
+ if (!e.docChanged || e.isUserEvent("undo") || e.isUserEvent("redo") || e.annotation(Tn)) return e;
1743
1806
  let t = e.startState, n = t.selection.main;
1744
- if (!n.empty || !z(t, t.doc.lineAt(n.head).number)) return e;
1807
+ if (!n.empty || !H(t, t.doc.lineAt(n.head).number)) return e;
1745
1808
  let r = [], i = 0;
1746
1809
  e.changes.iterChanges((e, t, a, o, s) => {
1747
1810
  i++, e === t && e === n.head && s.length > 0 && r.push(s.toString());
1748
1811
  });
1749
1812
  let a = r[0];
1750
1813
  if (i !== 1 || a === void 0) return e;
1751
- let o = wn(t, n.head);
1814
+ let o = jn(t, n.head);
1752
1815
  return o === n.head ? e : {
1753
1816
  changes: {
1754
1817
  from: o,
@@ -1761,7 +1824,7 @@ var Tn = ve.transactionFilter.of((e) => {
1761
1824
  });
1762
1825
  //#endregion
1763
1826
  //#region src/inplace/edit-line-prefix.ts
1764
- function En(e) {
1827
+ function Nn(e) {
1765
1828
  let t = /^#{1,6} /.exec(e);
1766
1829
  if (t) return {
1767
1830
  prefixLen: t[0].length,
@@ -1797,15 +1860,15 @@ function En(e) {
1797
1860
  }
1798
1861
  return null;
1799
1862
  }
1800
- var Dn = E.high(w.of([{
1863
+ var Pn = N.high(j.of([{
1801
1864
  key: "Backspace",
1802
1865
  run: (e) => {
1803
- if (f(e)) return !1;
1866
+ if (p(e)) return !1;
1804
1867
  let { state: t } = e, n = t.selection.main;
1805
1868
  if (!n.empty) return !1;
1806
1869
  let r = t.doc.lineAt(n.head);
1807
- if (!z(t, r.number)) return !1;
1808
- let i = En(r.text);
1870
+ if (!H(t, r.number)) return !1;
1871
+ let i = Nn(r.text);
1809
1872
  if (!i || n.head < r.from || n.head > r.from + i.prefixLen) return !1;
1810
1873
  let [a, o] = i.drop;
1811
1874
  return e.dispatch({
@@ -1819,13 +1882,13 @@ var Dn = E.high(w.of([{
1819
1882
  scrollIntoView: !0
1820
1883
  }), !0;
1821
1884
  }
1822
- }])), On = class {
1885
+ }])), Fn = class {
1823
1886
  menu;
1824
1887
  contentDOM;
1825
1888
  onClick;
1826
1889
  constructor(e) {
1827
- this.menu = q(e.dom.ownerDocument), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onClick = (t) => {
1828
- if (e.state.facet(M) !== "never" || !e.state.facet(k).links) return;
1890
+ this.menu = Y(e.dom.ownerDocument), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onClick = (t) => {
1891
+ if (e.state.facet(R) !== "never" || !e.state.facet(I).links) return;
1829
1892
  let n = t.target?.closest(".cm-inplace-link");
1830
1893
  if (!n || n.classList.contains("cm-inplace-wikilink")) return;
1831
1894
  let r = e.posAtDOM(n);
@@ -1837,13 +1900,13 @@ var Dn = E.high(w.of([{
1837
1900
  if (n == null) return;
1838
1901
  r = n;
1839
1902
  }
1840
- e.dispatch({ selection: { anchor: r } }), this.menu.showField(K(e), t.clientX, t.clientY);
1903
+ e.dispatch({ selection: { anchor: r } }), this.menu.showField(Vt(e), t.clientX, t.clientY);
1841
1904
  }, this.contentDOM.addEventListener("click", this.onClick);
1842
1905
  }
1843
1906
  destroy() {
1844
1907
  this.contentDOM.removeEventListener("click", this.onClick), this.menu.destroy();
1845
1908
  }
1846
- }, kn = S.fromClass(On), An = (e) => e.replace(/^<([^]*)>$/, "$1").trim(), jn = (e, t, n) => n ? {
1909
+ }, In = k.fromClass(Fn), Ln = (e) => e.replace(/^<([^]*)>$/, "$1").trim(), Rn = (e, t, n) => n ? {
1847
1910
  pos: e,
1848
1911
  end: t,
1849
1912
  above: !0,
@@ -1852,27 +1915,27 @@ var Dn = E.high(w.of([{
1852
1915
  return e.className = "cm-inplace-href-tip", e.textContent = n, { dom: e };
1853
1916
  }
1854
1917
  } : null;
1855
- function Mn(e, t) {
1856
- for (let n = O(e.state).resolveInner(t, -1); n; n = n.parent) {
1918
+ function zn(e, t) {
1919
+ for (let n = F(e.state).resolveInner(t, -1); n; n = n.parent) {
1857
1920
  if (n.name !== "Link") continue;
1858
1921
  if (e.state.doc.sliceString(Math.max(0, n.from - 1), n.from) === "[") break;
1859
1922
  let t = n.getChild("URL"), r = t ? e.state.sliceDoc(t.from, t.to) : e.state.sliceDoc(n.from, n.to);
1860
- return jn(n.from, n.to, An(r));
1923
+ return Rn(n.from, n.to, Ln(r));
1861
1924
  }
1862
1925
  return null;
1863
1926
  }
1864
- function Nn(e, n) {
1927
+ function Bn(e, n) {
1865
1928
  let r = e.state.doc.lineAt(n);
1866
1929
  for (let e of r.text.matchAll(t)) {
1867
1930
  let t = r.from + (e.index ?? 0), i = t + e[0].length;
1868
- if (!(n < t || n > i)) return jn(t, i, (e[1] ?? "").trim());
1931
+ if (!(n < t || n > i)) return Rn(t, i, (e[1] ?? "").trim());
1869
1932
  }
1870
1933
  return null;
1871
1934
  }
1872
- var Pn = he((e, t) => {
1873
- let n = e.state.facet(k);
1874
- return (n.links ? Mn(e, t) : null) ?? (n.wikilinks ? Nn(e, t) : null);
1875
- }), Fn = class extends C {
1935
+ var Vn = le((e, t) => {
1936
+ let n = e.state.facet(I);
1937
+ return (n.links ? zn(e, t) : null) ?? (n.wikilinks ? Bn(e, t) : null);
1938
+ }), Hn = class extends A {
1876
1939
  ref;
1877
1940
  inline;
1878
1941
  registry;
@@ -1899,45 +1962,45 @@ var Pn = he((e, t) => {
1899
1962
  return !1;
1900
1963
  }
1901
1964
  };
1902
- function In(e) {
1903
- let t = e.facet(A);
1904
- if (!t || !e.facet(k).embeds || !e.doc.toString().includes("![[")) return b.none;
1905
- let n = P(e), r = O(e), i = [];
1965
+ function Un(e) {
1966
+ let t = e.facet(L);
1967
+ if (!t || !e.facet(I).embeds || !e.doc.toString().includes("![[")) return D.none;
1968
+ let n = B(e), r = F(e), i = [];
1906
1969
  for (let a = 1; a <= e.doc.lines; a++) {
1907
1970
  let o = e.doc.line(a);
1908
1971
  if (!(!o.text.includes("![[") || n.has(a))) {
1909
- if (ce(o.text)) {
1910
- y.lastIndex = 0;
1911
- let e = (y.exec(o.text.trim())?.[1] ?? "").trim();
1912
- if (!e || F(r, o.from + o.text.indexOf("!["))) continue;
1913
- i.push(b.replace({
1914
- widget: new Fn(e, !1, t),
1972
+ if (ae(o.text)) {
1973
+ w.lastIndex = 0;
1974
+ let e = (w.exec(o.text.trim())?.[1] ?? "").trim();
1975
+ if (!e || V(r, o.from + o.text.indexOf("!["))) continue;
1976
+ i.push(D.replace({
1977
+ widget: new Hn(e, !1, t),
1915
1978
  block: !0
1916
1979
  }).range(o.from, o.to));
1917
1980
  continue;
1918
1981
  }
1919
- y.lastIndex = 0;
1920
- for (let e of o.text.matchAll(y)) {
1982
+ w.lastIndex = 0;
1983
+ for (let e of o.text.matchAll(w)) {
1921
1984
  let n = (e[1] ?? "").trim();
1922
1985
  if (!n) continue;
1923
1986
  let a = o.from + (e.index ?? 0);
1924
- F(r, a + 2) || Re(r, a + 2) || i.push(b.replace({ widget: new Fn(n, !0, t) }).range(a, a + e[0].length));
1987
+ V(r, a + 2) || Fe(r, a + 2) || i.push(D.replace({ widget: new Hn(n, !0, t) }).range(a, a + e[0].length));
1925
1988
  }
1926
1989
  }
1927
1990
  }
1928
- return b.set(i, !0);
1991
+ return D.set(i, !0);
1929
1992
  }
1930
- var Ln = D.define({
1931
- create: In,
1932
- update: (e, t) => t.docChanged || t.selection ? In(t.state) : e,
1933
- provide: (e) => [x.decorations.from(e), x.atomicRanges.of((t) => t.state.field(e))]
1934
- }), Rn = ye.define(), $ = D.define({
1993
+ var Wn = P.define({
1994
+ create: Un,
1995
+ update: (e, t) => t.docChanged || t.selection ? Un(t.state) : e,
1996
+ provide: (e) => [O.decorations.from(e), O.atomicRanges.of((t) => t.state.field(e))]
1997
+ }), Gn = he.define(), Kn = P.define({
1935
1998
  create: () => !1,
1936
1999
  update(e, t) {
1937
- for (let n of t.effects) n.is(Rn) && (e = n.value);
2000
+ for (let n of t.effects) n.is(Gn) && (e = n.value);
1938
2001
  return e;
1939
2002
  }
1940
- }), zn = class {
2003
+ }), qn = class {
1941
2004
  view;
1942
2005
  menu;
1943
2006
  onContextMenu;
@@ -1948,8 +2011,8 @@ var Ln = D.define({
1948
2011
  longPressAt = 0;
1949
2012
  destroyed = !1;
1950
2013
  constructor(e) {
1951
- this.view = e, this.menu = q(e.dom.ownerDocument, "cm-inplace-menu", (t) => {
1952
- this.destroyed || e.dispatch({ effects: Rn.of(t) });
2014
+ this.view = e, this.menu = Y(e.dom.ownerDocument, "cm-inplace-menu", (t) => {
2015
+ this.destroyed || e.dispatch({ effects: Gn.of(t) });
1953
2016
  }), e.dom.appendChild(this.menu.el), this.contentDOM = e.contentDOM, this.onPointerDown = () => {
1954
2017
  let t = e.state.selection.main;
1955
2018
  this.stashed = t.empty ? null : {
@@ -1958,18 +2021,18 @@ var Ln = D.define({
1958
2021
  };
1959
2022
  }, this.contentDOM.addEventListener("pointerdown", this.onPointerDown, !0), this.onContextMenu = (t) => {
1960
2023
  let n = t.target;
1961
- e.state.facet(Ee) && (n?.closest(".cm-inplace-table-edit") || (t.preventDefault(), this.longPress.cancel(), !(Date.now() - this.longPressAt < 700) && this.openMenuAt(t.clientX, t.clientY, n)));
1962
- }, this.contentDOM.addEventListener("contextmenu", this.onContextMenu), this.longPress = rn(this.contentDOM, { onLongPress: (e, t, n) => {
2024
+ e.state.facet(Ce) && (n?.closest(".cm-inplace-table-edit") || (t.preventDefault(), this.longPress.cancel(), !(Date.now() - this.longPressAt < 700) && this.openMenuAt(t.clientX, t.clientY, n)));
2025
+ }, this.contentDOM.addEventListener("contextmenu", this.onContextMenu), this.longPress = an(this.contentDOM, { onLongPress: (e, t, n) => {
1963
2026
  this.longPressAt = Date.now(), this.openMenuAt(e, t, n);
1964
2027
  } });
1965
2028
  }
1966
2029
  openMenuAt(e, t, n) {
1967
2030
  let r = this.view;
1968
- if (!r.state.facet(Ee) || n?.closest(".cm-inplace-table-edit")) return;
2031
+ if (!r.state.facet(Ce) || n?.closest(".cm-inplace-table-edit")) return;
1969
2032
  let i = n?.closest(".cm-inplace-hr");
1970
2033
  if (i) {
1971
2034
  let n = r.posAtDOM(i);
1972
- n >= 0 && r.dispatch({ selection: { anchor: n } }), this.menu.show(nn(r), e, t);
2035
+ n >= 0 && r.dispatch({ selection: { anchor: n } }), this.menu.show(rn(r), e, t);
1973
2036
  return;
1974
2037
  }
1975
2038
  if (this.stashed && r.state.selection.main.empty) r.dispatch({ selection: this.stashed });
@@ -1979,7 +2042,7 @@ var Ln = D.define({
1979
2042
  y: t
1980
2043
  });
1981
2044
  if (n != null) {
1982
- let e = B(r.state, n, !1, !0), t = r.state.wordAt(n) ?? { anchor: n };
2045
+ let e = U(r.state, n, !1, !0), t = r.state.wordAt(n) ?? { anchor: n };
1983
2046
  e?.kind === "link" ? t = {
1984
2047
  anchor: e.from,
1985
2048
  head: e.to
@@ -1989,15 +2052,15 @@ var Ln = D.define({
1989
2052
  }), r.dispatch({ selection: t });
1990
2053
  }
1991
2054
  }
1992
- this.menu.show(nn(r), e, t);
2055
+ this.menu.show(rn(r), e, t);
1993
2056
  }
1994
2057
  destroy() {
1995
2058
  this.destroyed = !0, this.contentDOM.removeEventListener("pointerdown", this.onPointerDown, !0), this.contentDOM.removeEventListener("contextmenu", this.onContextMenu), this.longPress.dispose(), this.menu.destroy();
1996
2059
  }
1997
- }, Bn = S.fromClass(zn);
2060
+ }, Jn = k.fromClass(qn);
1998
2061
  //#endregion
1999
2062
  //#region src/inplace/selection-bar-position.ts
2000
- function Vn(e) {
2063
+ function Yn(e) {
2001
2064
  let t = e.state.selection.main;
2002
2065
  if (!t.empty) {
2003
2066
  let n = e.coordsAtPos(t.from), r = e.coordsAtPos(t.to);
@@ -2011,7 +2074,7 @@ function Vn(e) {
2011
2074
  }
2012
2075
  };
2013
2076
  }
2014
- if (!J(e)) return null;
2077
+ if (!X(e)) return null;
2015
2078
  let n = e.dom.ownerDocument.getSelection();
2016
2079
  if (!n || n.rangeCount === 0) return null;
2017
2080
  let r = n.getRangeAt(0).getBoundingClientRect();
@@ -2025,15 +2088,15 @@ function Vn(e) {
2025
2088
  }
2026
2089
  };
2027
2090
  }
2028
- function Hn(e, t, n) {
2029
- if (e.state.facet(Me) !== "bar" || e.state.field($, !1)) return null;
2030
- let r = Vn(e);
2091
+ function Xn(e, t, n) {
2092
+ if (e.state.facet(ke) !== "bar" || e.state.field(Kn, !1)) return null;
2093
+ let r = Yn(e);
2031
2094
  if (!r) return null;
2032
2095
  let { box: i, inCell: a } = r;
2033
2096
  if (!a && !e.hasFocus) return null;
2034
2097
  let o = t.getBoundingClientRect(), s = e.dom.ownerDocument.defaultView?.innerWidth ?? 0, c = (i.left + i.right) / 2, l = e.dom.getBoundingClientRect().top, u = i.top - o.height - 6, d = i.bottom + 6, f = {}, p = {};
2035
2098
  for (let t of n) {
2036
- let n = m[t], r = !a && !!n.disabled?.(e.state);
2099
+ let n = h[t], r = !a && !!n.disabled?.(e.state);
2037
2100
  f[t] = r, p[t] = !r && !a && !!n.isActive?.(e.state);
2038
2101
  }
2039
2102
  return n.every((e) => f[e]) ? null : {
@@ -2045,7 +2108,7 @@ function Hn(e, t, n) {
2045
2108
  }
2046
2109
  //#endregion
2047
2110
  //#region src/inplace/selection-bar.ts
2048
- var Un = class {
2111
+ var Zn = class {
2049
2112
  view;
2050
2113
  bar;
2051
2114
  ids;
@@ -2055,17 +2118,17 @@ var Un = class {
2055
2118
  this.bar.hidden = !0;
2056
2119
  };
2057
2120
  onSelectionChange = () => {
2058
- f(this.view) && this.schedule();
2121
+ p(this.view) && this.schedule();
2059
2122
  };
2060
2123
  constructor(e) {
2061
2124
  this.view = e;
2062
2125
  let t = e.dom.ownerDocument;
2063
- this.ids = e.state.facet(je), this.linkMenu = q(t), e.dom.appendChild(this.linkMenu.el), this.bar = t.createElement("div"), this.bar.className = "cm-inplace-selbar", this.bar.setAttribute("contenteditable", "false"), this.bar.hidden = !0;
2126
+ this.ids = e.state.facet(Oe), this.linkMenu = Y(t), e.dom.appendChild(this.linkMenu.el), this.bar = t.createElement("div"), this.bar.className = "cm-inplace-selbar", this.bar.setAttribute("contenteditable", "false"), this.bar.hidden = !0;
2064
2127
  for (let n of this.ids) {
2065
- let r = m[n], i = t.createElement("button");
2066
- i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(oe(t, v[n] ?? "")), i.addEventListener("mousedown", (e) => e.preventDefault()), i.addEventListener("click", (t) => {
2128
+ let r = h[n], i = t.createElement("button");
2129
+ i.type = "button", i.className = "cm-inplace-selbar-btn", i.title = r.title, i.setAttribute("aria-label", r.title), i.appendChild(ie(t, x[n] ?? "")), i.addEventListener("mousedown", (e) => e.preventDefault()), i.addEventListener("click", (t) => {
2067
2130
  t.preventDefault();
2068
- let a = !!f(e), o = !a && n === "link" ? K(e) : !a && n === "wikilink" ? Vt(e) : null;
2131
+ let a = !!p(e), o = !a && n === "link" ? Vt(e) : !a && n === "wikilink" ? Ht(e) : null;
2069
2132
  if (o) {
2070
2133
  let e = i.getBoundingClientRect();
2071
2134
  this.linkMenu.showField(o, e.left, e.bottom + 6);
@@ -2077,7 +2140,7 @@ var Un = class {
2077
2140
  e.dom.appendChild(this.bar), t.addEventListener("scroll", this.onScroll, !0), t.addEventListener("selectionchange", this.onSelectionChange);
2078
2141
  }
2079
2142
  update(e) {
2080
- let t = e.startState.field($, !1) !== e.state.field($, !1);
2143
+ let t = e.startState.field(Kn, !1) !== e.state.field(Kn, !1);
2081
2144
  (e.selectionSet || e.docChanged || e.focusChanged || t) && this.schedule();
2082
2145
  }
2083
2146
  schedule() {
@@ -2088,7 +2151,7 @@ var Un = class {
2088
2151
  });
2089
2152
  }
2090
2153
  measure() {
2091
- return Hn(this.view, this.bar, this.ids);
2154
+ return Xn(this.view, this.bar, this.ids);
2092
2155
  }
2093
2156
  apply(e) {
2094
2157
  if (!e) {
@@ -2102,98 +2165,30 @@ var Un = class {
2102
2165
  let e = this.view.dom.ownerDocument;
2103
2166
  e.removeEventListener("scroll", this.onScroll, !0), e.removeEventListener("selectionchange", this.onSelectionChange), this.linkMenu.destroy(), this.bar.remove();
2104
2167
  }
2105
- }, Wn = S.fromClass(Un), Gn = class extends C {
2106
- table;
2107
- embeds;
2108
- constructor(e, t) {
2109
- super(), this.table = e, this.embeds = t;
2110
- }
2111
- eq(e) {
2112
- return JSON.stringify(this.table) === JSON.stringify(e.table);
2113
- }
2114
- toDOM() {
2115
- let { head: e, body: t, aligns: n } = this.table, r = document.createElement("table");
2116
- r.className = "cm-inplace-table";
2117
- let i = (e) => sn(e.replace(/\\\|/g, "|"), this.embeds), a = r.createTHead().insertRow();
2118
- e.forEach((e, t) => {
2119
- let r = document.createElement("th");
2120
- r.appendChild(i(e)), r.dataset.styloRow = "0", r.dataset.styloCol = String(t), Kn(r, n[t]), a.appendChild(r);
2121
- });
2122
- let o = r.createTBody();
2123
- return t.forEach((t, r) => {
2124
- let a = o.insertRow();
2125
- for (let o = 0; o < e.length; o++) {
2126
- let e = a.insertCell();
2127
- e.appendChild(i(t[o] ?? "")), e.dataset.styloRow = String(r + 1), e.dataset.styloCol = String(o), Kn(e, n[o]);
2128
- }
2129
- }), r;
2130
- }
2131
- ignoreEvent() {
2132
- return !1;
2133
- }
2134
- };
2135
- function Kn(e, t) {
2136
- t && (e.style.textAlign = t);
2137
- }
2138
- function qn(e, t) {
2139
- let n = t.lineAt(e.from).number, r = t.lineAt(e.to).number, a = [];
2140
- for (let e = n; e <= r; e++) a.push(t.line(e).text);
2141
- let o = i(a);
2142
- return !o || o.rows.length === 0 ? null : {
2143
- head: o.rows[0],
2144
- body: o.rows.slice(1),
2145
- aligns: o.aligns
2146
- };
2147
- }
2148
- function Jn(e) {
2149
- if (!e.facet(k).tables) return b.none;
2150
- let t = e.facet(j) === "cells", r = e.facet(A) != null && e.facet(k).embeds, i = O(e), a = n(e.doc), o = t ? null : P(e), s = [];
2151
- return i.iterate({ enter: (n) => {
2152
- if (n.name !== "Table") return;
2153
- if (a && n.from < a.to) return !1;
2154
- if (o) {
2155
- let t = e.doc.lineAt(n.from).number, r = e.doc.lineAt(n.to).number;
2156
- for (let e = t; e <= r; e++) if (o.has(e)) return !1;
2157
- }
2158
- let i = qn(n.node, e.doc);
2159
- if (i) {
2160
- let e = t ? new yn(i, r) : new Gn(i, r);
2161
- s.push(b.replace({
2162
- widget: e,
2163
- block: !0
2164
- }).range(n.from, n.to));
2165
- }
2166
- return !1;
2167
- } }), b.set(s, !0);
2168
- }
2169
- var Yn = D.define({
2170
- create: Jn,
2171
- update: (e, t) => t.annotation(Q) ? e.map(t.changes) : t.state.facet(j) === "cells" ? t.docChanged ? Jn(t.state) : e.map(t.changes) : t.docChanged || t.selection ? Jn(t.state) : e,
2172
- provide: (e) => [x.decorations.from(e), x.atomicRanges.of((t) => t.state.field(e))]
2173
- }), Xn = (e) => (t) => {
2174
- if (f(t)) return !1;
2168
+ }, Qn = k.fromClass(Zn), $n = (e) => (t) => {
2169
+ if (p(t)) return !1;
2175
2170
  let n = t.state.selection.main;
2176
2171
  if (!n.empty) return !1;
2177
2172
  let { doc: r } = t.state, i = r.lineAt(n.head), a = e ? i.number + 1 : i.number - 1;
2178
2173
  if (a < 1 || a > r.lines) return !1;
2179
2174
  let o = r.line(a), s = -1, c = -1, l;
2180
- if (t.state.field(Yn).between(o.from, o.to, (t, n, r) => {
2175
+ if (t.state.field(wn).between(o.from, o.to, (t, n, r) => {
2181
2176
  if (e ? t === o.from : n === o.to) return s = t, c = n, l = r.spec.widget, !1;
2182
2177
  }), s < 0) return !1;
2183
- if (t.state.facet(j) === "cells") return l instanceof yn && l.focusEdge(e ? "first" : "last");
2178
+ if (t.state.facet(xe) === "cells") return l instanceof En && l.focusEdge(e ? "first" : "last");
2184
2179
  let u = e ? r.lineAt(s).from : r.lineAt(c).to;
2185
2180
  return t.dispatch({
2186
2181
  selection: { anchor: u },
2187
2182
  userEvent: "select",
2188
2183
  scrollIntoView: !0
2189
2184
  }), !0;
2190
- }, Zn = Xn(!0), Qn = Xn(!1), $n = E.high(w.of([{
2185
+ }, er = $n(!0), tr = $n(!1), nr = N.high(j.of([{
2191
2186
  key: "ArrowDown",
2192
- run: Zn
2187
+ run: er
2193
2188
  }, {
2194
2189
  key: "ArrowUp",
2195
- run: Qn
2196
- }])), er = {
2190
+ run: tr
2191
+ }])), rr = {
2197
2192
  ".cm-inplace-callout": {
2198
2193
  borderLeft: "0.25rem solid var(--stylo-callout-accent, var(--stylo-border))",
2199
2194
  padding: "0 1rem",
@@ -2227,9 +2222,9 @@ var Yn = D.define({
2227
2222
  content: "\"\"",
2228
2223
  display: "none"
2229
2224
  }
2230
- }, tr = "var(--stylo-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)", nr = "var(--stylo-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif)", rr = {
2225
+ }, ir = "var(--stylo-font-family-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)", ar = "var(--stylo-font-family, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif)", or = {
2231
2226
  "& .cm-content": {
2232
- fontFamily: nr,
2227
+ fontFamily: ar,
2233
2228
  lineHeight: "1.75",
2234
2229
  padding: "0.75rem",
2235
2230
  WebkitTouchCallout: "none"
@@ -2268,14 +2263,14 @@ var Yn = D.define({
2268
2263
  ".cm-inplace-em": { fontStyle: "italic" },
2269
2264
  ".cm-inplace-strike": { textDecoration: "line-through" },
2270
2265
  ".cm-inplace-code": {
2271
- fontFamily: tr,
2266
+ fontFamily: ir,
2272
2267
  fontSize: "0.9em",
2273
2268
  padding: "0.1em 0.35em",
2274
2269
  borderRadius: "3px",
2275
2270
  background: "color-mix(in srgb, var(--stylo-border) 45%, transparent)"
2276
2271
  },
2277
2272
  ".cm-inplace-mono": {
2278
- fontFamily: tr,
2273
+ fontFamily: ir,
2279
2274
  fontSize: "0.9em",
2280
2275
  background: "color-mix(in srgb, var(--stylo-border) 35%, transparent)",
2281
2276
  padding: "0 0.9rem"
@@ -2309,12 +2304,14 @@ var Yn = D.define({
2309
2304
  ".cm-inplace-math-block .katex-display": { margin: "0" },
2310
2305
  ".cm-inplace-embed": {
2311
2306
  display: "block",
2312
- margin: "0.9em 0"
2307
+ padding: "0.9em 0"
2313
2308
  },
2314
2309
  ".cm-inplace-embed .stylo-embed-content": {
2315
2310
  borderLeft: "3px solid var(--stylo-embed-accent, var(--stylo-border))",
2316
2311
  paddingLeft: "1rem"
2317
2312
  },
2313
+ ".cm-inplace-embed .stylo-embed-content > :first-child": { marginTop: "0" },
2314
+ ".cm-inplace-embed .stylo-embed-content > :last-child": { marginBottom: "0" },
2318
2315
  ".cm-inplace-embed-inline": { display: "inline" },
2319
2316
  ".cm-inplace-hr-line": {
2320
2317
  fontSize: "0",
@@ -2349,21 +2346,21 @@ var Yn = D.define({
2349
2346
  cursor: "pointer"
2350
2347
  },
2351
2348
  ".cm-inplace-fm": {
2352
- fontFamily: tr,
2349
+ fontFamily: ir,
2353
2350
  fontSize: "0.85em",
2354
2351
  color: "var(--stylo-text-muted)"
2355
2352
  },
2356
2353
  ".cm-inplace-fm-first::before": {
2357
2354
  content: "\"Frontmatter\"",
2358
2355
  marginRight: "0.6em",
2359
- fontFamily: nr,
2356
+ fontFamily: ar,
2360
2357
  fontSize: "0.8rem",
2361
2358
  fontWeight: "600",
2362
2359
  textTransform: "uppercase",
2363
2360
  letterSpacing: "0.04em",
2364
2361
  color: "var(--stylo-text-muted)"
2365
2362
  }
2366
- }, ir = {
2363
+ }, sr = {
2367
2364
  ".cm-inplace-menu": {
2368
2365
  position: "fixed",
2369
2366
  inset: "0",
@@ -2437,7 +2434,7 @@ var Yn = D.define({
2437
2434
  outline: "none"
2438
2435
  },
2439
2436
  ".cm-inplace-menu-input:focus": { borderColor: "var(--stylo-ring)" }
2440
- }, ar = {
2437
+ }, cr = {
2441
2438
  ".cm-inplace-selbar": {
2442
2439
  position: "fixed",
2443
2440
  zIndex: "20",
@@ -2522,7 +2519,7 @@ var Yn = D.define({
2522
2519
  lineHeight: "1.4",
2523
2520
  wordBreak: "break-all"
2524
2521
  }
2525
- }, or = {
2522
+ }, lr = {
2526
2523
  ".cm-inplace-table": {
2527
2524
  borderCollapse: "collapse",
2528
2525
  padding: "1em 0 1.4em",
@@ -2545,7 +2542,7 @@ var Yn = D.define({
2545
2542
  outline: "none"
2546
2543
  },
2547
2544
  ".cm-inplace-table-edit .cm-inplace-tcell:focus": { boxShadow: "inset 0 0 0 2px var(--stylo-ring)" }
2548
- }, sr = {
2545
+ }, ur = {
2549
2546
  ".cm-inplace-table-wrap": {
2550
2547
  position: "relative",
2551
2548
  display: "inline-block",
@@ -2586,15 +2583,15 @@ var Yn = D.define({
2586
2583
  },
2587
2584
  ".cm-inplace-tg-edge:hover .cm-inplace-tg-plus": { color: "var(--stylo-text)" },
2588
2585
  "@media (hover: none)": { ".cm-inplace-tg-edge": { opacity: "0.5" } }
2589
- }, cr = x.theme({
2590
- ...rr,
2591
- ...er,
2586
+ }, dr = O.theme({
2592
2587
  ...or,
2588
+ ...rr,
2589
+ ...lr,
2590
+ ...ur,
2593
2591
  ...sr,
2594
- ...ir,
2595
- ...ar
2596
- }), lr = ".cm-inplace-math, .cm-inplace-hr, .cm-inplace-table, .cm-inplace-embed, .cm-inplace-embed-inline";
2597
- function ur(e, t, n) {
2592
+ ...cr
2593
+ }), fr = ".cm-inplace-math, .cm-inplace-hr, .cm-inplace-table, .cm-inplace-embed, .cm-inplace-embed-inline";
2594
+ function pr(e, t, n) {
2598
2595
  let r = e.firstChild, i = e.textContent?.length ?? 0;
2599
2596
  if (!r || r.nodeType !== Node.TEXT_NODE || i === 0) return 0;
2600
2597
  let a = e.ownerDocument, o = null, s = 0;
@@ -2607,49 +2604,49 @@ function ur(e, t, n) {
2607
2604
  }
2608
2605
  return o === r ? Math.min(s, i) : o === e && s > 0 ? i : 0;
2609
2606
  }
2610
- function dr(e = {}) {
2611
- let t = Oe(e.inPlace?.contextMenu);
2607
+ function mr(e = {}) {
2608
+ let t = Te(e.inPlace?.contextMenu);
2612
2609
  return [
2613
- k.of(we(e.inPlace)),
2614
- A.of(e.embedRegistry ?? null),
2615
- j.of(e.inPlace?.table ?? "source"),
2616
- M.of(e.inPlace?.reveal ?? "caret"),
2617
- Te.of(e.onLinkClick ?? null),
2618
- Ee.of(t.enabled),
2619
- ke.of(t.groups),
2620
- Me.of(e.inPlace?.selectionUI ?? "menu"),
2621
- je.of(Ae(e.inPlace?.selectionBarItems)),
2610
+ I.of(be(e.inPlace)),
2611
+ L.of(e.embedRegistry ?? null),
2612
+ xe.of(e.inPlace?.table ?? "source"),
2613
+ R.of(e.inPlace?.reveal ?? "caret"),
2614
+ Se.of(e.onLinkClick ?? null),
2615
+ Ce.of(t.enabled),
2616
+ Ee.of(t.groups),
2617
+ ke.of(e.inPlace?.selectionUI ?? "menu"),
2618
+ Oe.of(De(e.inPlace?.selectionBarItems)),
2622
2619
  mt(),
2623
- Dn,
2620
+ Pn,
2624
2621
  It,
2625
2622
  Tt,
2626
- $n,
2627
- Tn,
2628
- xn,
2623
+ nr,
2624
+ Mn,
2625
+ On,
2629
2626
  Ue,
2630
- Ln,
2631
- Pe,
2632
- Yn,
2633
- $,
2634
- Bn,
2635
2627
  Wn,
2636
- kn,
2637
- Pn,
2638
- Yt,
2628
+ je,
2629
+ wn,
2630
+ Kn,
2631
+ Jn,
2632
+ Qn,
2633
+ In,
2634
+ Vn,
2639
2635
  Xt,
2640
- E.high(cr),
2641
- x.domEventHandlers({
2636
+ Zt,
2637
+ N.high(dr),
2638
+ O.domEventHandlers({
2642
2639
  mousedown(e, t) {
2643
2640
  let n = e.target;
2644
2641
  if (n?.closest(".cm-inplace-table-edit") || n?.closest(".stylo-embed-content")) return !1;
2645
- let r = n?.closest(lr);
2642
+ let r = n?.closest(fr);
2646
2643
  if (!r) return !1;
2647
2644
  let i = t.posAtDOM(r);
2648
2645
  if (i < 0) return !1;
2649
2646
  let a = n?.closest("[data-stylo-row]");
2650
2647
  if (a && r.contains(a)) {
2651
- let n = d(t.state.doc, i, Number(a.dataset.styloRow), Number(a.dataset.styloCol));
2652
- n != null && (i = n + ur(a, e.clientX, e.clientY));
2648
+ let n = f(t.state.doc, i, Number(a.dataset.styloRow), Number(a.dataset.styloCol));
2649
+ n != null && (i = n + pr(a, e.clientX, e.clientY));
2653
2650
  }
2654
2651
  return t.focus(), t.dispatch({ selection: { anchor: i } }), !0;
2655
2652
  },
@@ -2663,40 +2660,48 @@ function dr(e = {}) {
2663
2660
  }
2664
2661
  //#endregion
2665
2662
  //#region src/inplace/InPlaceView.tsx
2666
- function fr({ value: t, onChange: n, readOnly: r, placeholder: i, onWikiLinkClick: a, onLinkClick: o, inPlace: s, codeLanguages: c, wikiLinkSource: l, embedSource: u, onResolveError: d, onSave: f, onViewChange: p }) {
2667
- let m = fe(a);
2668
- m.current = a;
2669
- let h = fe(o);
2670
- h.current = o;
2671
- let [g] = pe(() => new Se()), ee = me(g.subscribe, g.getSnapshot, g.getSnapshot), [te] = pe(() => [dr({
2672
- onWikiLinkClick: (e) => m.current?.(e),
2673
- onLinkClick: (e) => h.current?.(e),
2674
- inPlace: s,
2675
- embedRegistry: u ? g : void 0
2676
- })]), re = ne({
2663
+ var hr = () => () => {}, gr = () => null;
2664
+ function _r({ value: t, onChange: n, readOnly: i, placeholder: a, onWikiLinkClick: o, onLinkClick: s, inPlace: c, codeLanguages: l, wikiLinkSource: u, tagSource: d, embedSource: f, onResolveError: p, onSave: m, onViewChange: h, canvasHeader: g }) {
2665
+ let _ = T(o);
2666
+ _.current = o;
2667
+ let ee = T(s);
2668
+ ee.current = s;
2669
+ let [v] = E(() => new ve()), ne = ce(v.subscribe, v.getSnapshot, v.getSnapshot), [re, y] = E(null), b = T(h);
2670
+ b.current = h;
2671
+ let ie = T((e) => {
2672
+ y(e), b.current?.(e);
2673
+ }).current, x = T(g);
2674
+ x.current = g;
2675
+ let [S] = E(() => g ? new r() : null), ae = ce(S?.subscribe ?? hr, S?.getSnapshot ?? gr), [C] = E(() => [mr({
2676
+ onWikiLinkClick: (e) => _.current?.(e),
2677
+ onLinkClick: (e) => ee.current?.(e),
2678
+ inPlace: c,
2679
+ embedRegistry: f ? v : void 0
2680
+ }), ...S ? [ue.of(S.panel)] : []]), w = te({
2677
2681
  value: t,
2678
2682
  onChange: n,
2679
- readOnly: r,
2680
- placeholder: i,
2681
- extensions: te,
2682
- codeLanguages: c,
2683
- wikiLinkSource: l,
2684
- onResolveError: d,
2685
- onSave: f,
2686
- onViewChange: p
2683
+ readOnly: i,
2684
+ placeholder: a,
2685
+ extensions: C,
2686
+ codeLanguages: l,
2687
+ wikiLinkSource: u,
2688
+ tagSource: d,
2689
+ onResolveError: p,
2690
+ onSave: m,
2691
+ onViewChange: ie
2687
2692
  });
2688
- return /* @__PURE__ */ be("div", {
2693
+ return /* @__PURE__ */ _e("div", {
2689
2694
  className: e.inplace,
2690
- ref: re,
2691
- children: u && ee.map((e) => xe(/* @__PURE__ */ be(le, {
2695
+ ref: w,
2696
+ children: [f && ne.map((e) => de(/* @__PURE__ */ ge(oe, {
2692
2697
  reference: e.ref,
2693
- source: u,
2694
- onError: d,
2698
+ source: f,
2699
+ onError: p,
2695
2700
  inline: e.inline
2696
- }), e.el, String(e.id)))
2701
+ }), e.el, String(e.id))), ae && x.current && de(x.current({ view: re }), ae)]
2697
2702
  });
2698
2703
  }
2699
2704
  //#endregion
2700
- export { fr as InPlaceView };
2705
+ export { _r as InPlaceView };
2701
2706
 
2702
- //# sourceMappingURL=InPlaceView-CkbMemAa.js.map
2707
+ //# sourceMappingURL=InPlaceView-BWc06Jso.js.map