@blocknote/core 0.54.0 → 0.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/blocknote.cjs +1 -1
  2. package/dist/blocknote.js +6 -6
  3. package/dist/{blocks-CzkqclGj.cjs → blocks-CTB_5Vyj.cjs} +4 -4
  4. package/dist/blocks-CTB_5Vyj.cjs.map +1 -0
  5. package/dist/{blocks-CzQLehlc.js → blocks-Dol85hpH.js} +337 -330
  6. package/dist/blocks-Dol85hpH.js.map +1 -0
  7. package/dist/blocks.cjs +1 -1
  8. package/dist/blocks.js +2 -2
  9. package/dist/extensions-B7Rsp_Ft.cjs +58 -0
  10. package/dist/extensions-B7Rsp_Ft.cjs.map +1 -0
  11. package/dist/{extensions-DGuhtOgB.js → extensions-D6JcJCwd.js} +389 -346
  12. package/dist/extensions-D6JcJCwd.js.map +1 -0
  13. package/dist/extensions.cjs +1 -1
  14. package/dist/extensions.js +3 -3
  15. package/dist/{src-BkfZVfaO.js → src-Buuo5l7X.js} +521 -516
  16. package/dist/{src-BkfZVfaO.js.map → src-Buuo5l7X.js.map} +1 -1
  17. package/dist/{src-DM3syMdf.cjs → src-C54Ok9E0.cjs} +10 -10
  18. package/dist/{src-DM3syMdf.cjs.map → src-C54Ok9E0.cjs.map} +1 -1
  19. package/dist/webpack-stats.json +1 -1
  20. package/dist/y.cjs +1 -1
  21. package/dist/y.cjs.map +1 -1
  22. package/dist/y.js +205 -205
  23. package/dist/y.js.map +1 -1
  24. package/dist/yjs.cjs +1 -1
  25. package/dist/yjs.js +21 -21
  26. package/package.json +1 -1
  27. package/src/api/getBlocksChangedByTransaction.test.ts +211 -0
  28. package/src/api/getBlocksChangedByTransaction.ts +48 -12
  29. package/src/api/getChangedRange.ts +54 -0
  30. package/src/blocks/index.ts +0 -1
  31. package/src/editor/performance.test.ts +45 -0
  32. package/src/exporter/Exporter.test.ts +148 -10
  33. package/src/exporter/Exporter.ts +20 -2
  34. package/src/extensions/PreviousBlockType/PreviousBlockType.test.ts +21 -0
  35. package/src/extensions/PreviousBlockType/PreviousBlockType.ts +5 -3
  36. package/src/extensions/TableHandles/TableHandles.browser.test.ts +305 -0
  37. package/src/extensions/TableHandles/TableHandles.ts +82 -41
  38. package/src/fonts/inter.css +9 -9
  39. package/src/schema/blocks/createSpec.ts +4 -5
  40. package/src/schema/inlineContent/createSpec.ts +4 -5
  41. package/src/schema/nodeViewMutations.test.ts +81 -56
  42. package/src/schema/nodeViewMutations.ts +30 -27
  43. package/src/schema/schema.test.ts +110 -0
  44. package/src/schema/schema.ts +13 -4
  45. package/src/y/extensions/AttributionExtension.test.ts +8 -9
  46. package/src/y/versioning/__test__/yhub.test.ts +92 -59
  47. package/src/y/versioning/yhub.ts +35 -29
  48. package/types/src/api/getChangedRange.d.ts +14 -0
  49. package/types/src/blocks/index.d.ts +0 -1
  50. package/types/src/exporter/Exporter.d.ts +9 -0
  51. package/types/src/extensions/TableHandles/TableHandles.browser.test.d.ts +1 -0
  52. package/types/src/extensions/TableHandles/TableHandles.d.ts +3 -0
  53. package/types/src/schema/nodeViewMutations.d.ts +2 -2
  54. package/types/src/schema/schema.test.d.ts +1 -0
  55. package/types/src/y/versioning/yhub.d.ts +3 -2
  56. package/dist/blocks-CzQLehlc.js.map +0 -1
  57. package/dist/blocks-CzkqclGj.cjs.map +0 -1
  58. package/dist/extensions-CSB9ZvuL.cjs +0 -58
  59. package/dist/extensions-CSB9ZvuL.cjs.map +0 -1
  60. package/dist/extensions-DGuhtOgB.js.map +0 -1
  61. package/src/blocks/File/helpers/uploadToTmpFilesDotOrg_DEV_ONLY.ts +0 -20
  62. package/types/src/blocks/File/helpers/uploadToTmpFilesDotOrg_DEV_ONLY.d.ts +0 -6
@@ -1,9 +1,9 @@
1
- import { Bt as e, En as t, Ft as n, Gt as r, Ht as i, Jt as a, Kt as o, Lt as s, Pt as c, Rt as l, Tn as u, Un as d, Ut as f, Vt as p, Wt as m, _ as h, g, or as _, qt as ee, r as te, v, zt as ne } from "./blocks-CzQLehlc.js";
1
+ import { Bt as e, Gt as t, Hn as n, Ht as r, It as i, Kt as a, Lt as o, Nt as s, Pt as c, Rt as l, Tn as u, Ut as d, Vt as f, Wt as p, _ as m, ar as h, h as g, qt as ee, r as te, v as _, wn as v, zt as ne } from "./blocks-Dol85hpH.js";
2
2
  import { n as y, t as b } from "./BlockNoteExtension-CbvDA0F7.js";
3
3
  import { n as re } from "./UserStore-C4TzkGEn.js";
4
- import { DOMSerializer as ie, Fragment as x, Slice as ae } from "prosemirror-model";
5
- import { Mapping as oe, dropPoint as se } from "prosemirror-transform";
6
- import { combineTransactionSteps as ce, findChildrenInRange as S, posToDOMRect as le } from "@tiptap/core";
4
+ import { DOMSerializer as x, Fragment as S, Slice as ie } from "prosemirror-model";
5
+ import { Mapping as ae, dropPoint as oe } from "prosemirror-transform";
6
+ import { combineTransactionSteps as se, findChildrenInRange as ce, posToDOMRect as le } from "@tiptap/core";
7
7
  import { uuidv4 as ue } from "lib0/random";
8
8
  import { NodeSelection as de, Plugin as C, PluginKey as w, Selection as T, TextSelection as E } from "prosemirror-state";
9
9
  import { DOMParser as fe, Slice as pe } from "@tiptap/pm/model";
@@ -18,44 +18,44 @@ function Me(e) {
18
18
  let t = Array.from(e.classList).filter((e) => !e.startsWith("bn-")) || [];
19
19
  t.length > 0 ? e.className = t.join(" ") : e.removeAttribute("class");
20
20
  }
21
- function Ne(e, n, r, i) {
22
- let a;
23
- if (!n) throw Error("blockContent is required");
24
- if (typeof n == "string") a = s([n], e.pmSchema, i?.blockType);
25
- else if (Array.isArray(n)) a = s(n, e.pmSchema, i?.blockType);
26
- else if (n.type === "tableContent") a = l(n, e.pmSchema);
27
- else throw new d(n.type);
28
- let o = (i?.document ?? document).createDocumentFragment();
29
- for (let n of a) if (n.type.name !== "text" && e.schema.inlineContentSchema[n.type.name]) {
30
- let a = e.schema.inlineContentSpecs[n.type.name].implementation;
31
- if (a) {
32
- let s = t(n, e.schema.inlineContentSchema, e.schema.styleSchema), c = a.toExternalHTML ? a.toExternalHTML(s, e) : a.render.call({
21
+ function Ne(e, t, r, a) {
22
+ let s;
23
+ if (!t) throw Error("blockContent is required");
24
+ if (typeof t == "string") s = i([t], e.pmSchema, a?.blockType);
25
+ else if (Array.isArray(t)) s = i(t, e.pmSchema, a?.blockType);
26
+ else if (t.type === "tableContent") s = o(t, e.pmSchema);
27
+ else throw new n(t.type);
28
+ let c = (a?.document ?? document).createDocumentFragment();
29
+ for (let t of s) if (t.type.name !== "text" && e.schema.inlineContentSchema[t.type.name]) {
30
+ let n = e.schema.inlineContentSpecs[t.type.name].implementation;
31
+ if (n) {
32
+ let i = u(t, e.schema.inlineContentSchema, e.schema.styleSchema), o = n.toExternalHTML ? n.toExternalHTML(i, e) : n.render.call({
33
33
  renderType: "dom",
34
34
  props: void 0
35
- }, s, () => {}, e);
36
- if (c) {
37
- if (o.appendChild(c.dom), c.contentDOM) {
38
- let e = r.serializeFragment(n.content, i);
39
- c.contentDOM.dataset.editable = "", c.contentDOM.appendChild(e);
35
+ }, i, () => {}, e);
36
+ if (o) {
37
+ if (c.appendChild(o.dom), o.contentDOM) {
38
+ let e = r.serializeFragment(t.content, a);
39
+ o.contentDOM.dataset.editable = "", o.contentDOM.appendChild(e);
40
40
  }
41
41
  continue;
42
42
  }
43
43
  }
44
- } else if (n.type.name === "text") {
45
- let t = document.createTextNode(n.textContent);
46
- for (let r of n.marks.toReversed()) if (r.type.name in e.schema.styleSpecs) {
47
- let n = (e.schema.styleSpecs[r.type.name].implementation.toExternalHTML ?? e.schema.styleSpecs[r.type.name].implementation.render)(r.attrs.stringValue, e);
48
- n.contentDOM.appendChild(t), t = n.dom;
44
+ } else if (t.type.name === "text") {
45
+ let n = document.createTextNode(t.textContent);
46
+ for (let r of t.marks.toReversed()) if (r.type.name in e.schema.styleSpecs) {
47
+ let t = (e.schema.styleSpecs[r.type.name].implementation.toExternalHTML ?? e.schema.styleSpecs[r.type.name].implementation.render)(r.attrs.stringValue, e);
48
+ t.contentDOM.appendChild(n), n = t.dom;
49
49
  } else {
50
- let e = r.type.spec.toDOM(r, !0), n = ie.renderSpec(document, e);
51
- n.contentDOM.appendChild(t), t = n.dom;
50
+ let e = r.type.spec.toDOM(r, !0), t = x.renderSpec(document, e);
51
+ t.contentDOM.appendChild(n), n = t.dom;
52
52
  }
53
- o.appendChild(t);
53
+ c.appendChild(n);
54
54
  } else {
55
- let e = r.serializeFragment(x.from([n]), i);
56
- o.appendChild(e);
55
+ let e = r.serializeFragment(S.from([t]), a);
56
+ c.appendChild(e);
57
57
  }
58
- return o.childNodes.length === 1 && o.firstChild?.nodeType === 1 && Me(o.firstChild), o;
58
+ return c.childNodes.length === 1 && c.firstChild?.nodeType === 1 && Me(c.firstChild), c;
59
59
  }
60
60
  function Pe(e, t, n, r, i, a, o, s) {
61
61
  let c = s?.document ?? document, l = t.pmSchema.nodes.blockContainer, u = n.props || {};
@@ -106,7 +106,7 @@ var Fe = (e, t, n, r, i, a, o = 0, s) => {
106
106
  let o = (a?.document ?? document).createDocumentFragment();
107
107
  return Fe(o, e, t, n, r, i, 0, a), o;
108
108
  }, k = (e, t) => {
109
- let n = ie.fromSchema(e);
109
+ let n = x.fromSchema(e);
110
110
  return {
111
111
  exportBlocks: (e, r) => {
112
112
  let i = Ie(t, e, n, /* @__PURE__ */ new Set(["numberedListItem"]), /* @__PURE__ */ new Set([
@@ -123,35 +123,55 @@ var Fe = (e, t, n, r, i, a, o = 0, s) => {
123
123
  };
124
124
  };
125
125
  //#endregion
126
+ //#region src/api/getChangedRange.ts
127
+ function Le(e) {
128
+ let { mapping: t, steps: n } = e, r = Infinity, i = -Infinity;
129
+ for (let e = 0; e < t.maps.length; e++) {
130
+ let a = t.maps[e];
131
+ e && (r = a.map(r, 1), i = a.map(i, -1));
132
+ let o = !1;
133
+ if (a.forEach((e, t, n, a) => {
134
+ o = !0, r = Math.min(r, n), i = Math.max(i, a);
135
+ }), !o) {
136
+ let t = n[e];
137
+ typeof t.pos == "number" ? (r = Math.min(r, t.pos), i = Math.max(i, t.pos + 1)) : typeof t.from == "number" && typeof t.to == "number" && (r = Math.min(r, t.from), i = Math.max(i, t.to));
138
+ }
139
+ }
140
+ return r === Infinity ? null : {
141
+ from: r,
142
+ to: i
143
+ };
144
+ }
145
+ //#endregion
126
146
  //#region src/api/getBlocksChangedByTransaction.ts
127
- function Le(e, t) {
147
+ function Re(e, t) {
128
148
  if (t === 0) return;
129
- let r = e.resolve(t);
130
- for (let t = r.depth; t > 0; t--) {
131
- let i = r.node(t);
132
- if (n(i)) return _(i, e);
149
+ let n = e.resolve(t);
150
+ for (let t = n.depth; t > 0; t--) {
151
+ let r = n.node(t);
152
+ if (c(r)) return h(r, e);
133
153
  }
134
154
  }
135
- function Re(e) {
155
+ function ze(e) {
136
156
  return e.getMeta("paste") ? { type: "paste" } : e.getMeta("uiEvent") === "drop" ? { type: "drop" } : e.getMeta("history$") ? { type: e.getMeta("history$").redo ? "redo" : "undo" } : e.getMeta("y-sync$") ? e.getMeta("y-sync$").isUndoRedoOperation ? { type: "undo-redo" } : { type: "yjs-remote" } : { type: "local" };
137
157
  }
138
- function ze(e) {
139
- let t = {}, r = {};
140
- return e.descendants((i, a) => {
141
- if (!n(i)) return !0;
142
- let o = Le(e, a), s = o ?? "__root__";
143
- r[s] || (r[s] = []);
144
- let c = u(i, e), l = _(i, e);
145
- return t[l] = {
146
- block: c,
147
- parentId: o
148
- }, r[s].push(l), !0;
158
+ function Be(e, t) {
159
+ let n = {}, r = {}, i = Math.max(0, Math.min(t.from, e.content.size)), a = Math.max(i, Math.min(t.to, e.content.size));
160
+ return e.nodesBetween(i, a, (t, i) => {
161
+ if (!c(t)) return !0;
162
+ let a = Re(e, i), o = a ?? "__root__";
163
+ r[o] || (r[o] = []);
164
+ let s = v(t, e), l = h(t, e);
165
+ return n[l] = {
166
+ block: s,
167
+ parentId: a
168
+ }, r[o].push(l), !0;
149
169
  }), {
150
- byId: t,
170
+ byId: n,
151
171
  childrenByParent: r
152
172
  };
153
173
  }
154
- function Be(e, t) {
174
+ function Ve(e, t) {
155
175
  let n = /* @__PURE__ */ new Set();
156
176
  if (!e || !t) return n;
157
177
  let r = new Set(e), i = t.filter((e) => r.has(e)), a = e.filter((e) => i.includes(e));
@@ -175,63 +195,68 @@ function Be(e, t) {
175
195
  for (let e = 0; e < i.length; e++) p.has(e) || n.add(i[e]);
176
196
  return n;
177
197
  }
178
- function Ve(e, t = []) {
179
- let n = Re(e), r = ce(e.before, [e, ...t]), i = ze(r.before), a = ze(r.doc), o = [], s = /* @__PURE__ */ new Set();
180
- Object.keys(a.byId).filter((e) => !(e in i.byId)).forEach((e) => {
181
- o.push({
198
+ function He(e, t = []) {
199
+ let n = ze(e), r = se(e.before, [e, ...t]), i = Le(r);
200
+ if (!i) return [];
201
+ let a = r.mapping.invert(), o = {
202
+ from: a.map(i.from, -1),
203
+ to: a.map(i.to, 1)
204
+ }, s = Be(r.before, o), c = Be(r.doc, i), l = [], u = /* @__PURE__ */ new Set();
205
+ Object.keys(c.byId).filter((e) => !(e in s.byId)).forEach((e) => {
206
+ l.push({
182
207
  type: "insert",
183
- block: a.byId[e].block,
208
+ block: c.byId[e].block,
184
209
  source: n,
185
210
  prevBlock: void 0
186
- }), s.add(e);
187
- }), Object.keys(i.byId).filter((e) => !(e in a.byId)).forEach((e) => {
188
- o.push({
211
+ }), u.add(e);
212
+ }), Object.keys(s.byId).filter((e) => !(e in c.byId)).forEach((e) => {
213
+ l.push({
189
214
  type: "delete",
190
- block: i.byId[e].block,
215
+ block: s.byId[e].block,
191
216
  source: n,
192
217
  prevBlock: void 0
193
- }), s.add(e);
194
- }), Object.keys(a.byId).filter((e) => e in i.byId).forEach((e) => {
195
- let t = i.byId[e], r = a.byId[e];
218
+ }), u.add(e);
219
+ }), Object.keys(c.byId).filter((e) => e in s.byId).forEach((e) => {
220
+ let t = s.byId[e], r = c.byId[e];
196
221
  t.parentId === r.parentId ? Ee({
197
222
  ...t.block,
198
223
  children: void 0
199
224
  }, {
200
225
  ...r.block,
201
226
  children: void 0
202
- }) || (o.push({
227
+ }) || (l.push({
203
228
  type: "update",
204
229
  block: r.block,
205
230
  prevBlock: t.block,
206
231
  source: n
207
- }), s.add(e)) : (o.push({
232
+ }), u.add(e)) : (l.push({
208
233
  type: "move",
209
234
  block: r.block,
210
235
  prevBlock: t.block,
211
236
  source: n,
212
- prevParent: t.parentId ? i.byId[t.parentId]?.block : void 0,
213
- currentParent: r.parentId ? a.byId[r.parentId]?.block : void 0
214
- }), s.add(e));
237
+ prevParent: t.parentId ? s.byId[t.parentId]?.block : void 0,
238
+ currentParent: r.parentId ? c.byId[r.parentId]?.block : void 0
239
+ }), u.add(e));
215
240
  });
216
- let c = i.childrenByParent, l = a.childrenByParent, u = /* @__PURE__ */ new Set([...Object.keys(c), ...Object.keys(l)]), d = /* @__PURE__ */ new Set();
217
- return u.forEach((e) => {
218
- let t = Be(c[e], l[e]);
241
+ let d = s.childrenByParent, f = c.childrenByParent, p = /* @__PURE__ */ new Set([...Object.keys(d), ...Object.keys(f)]), m = /* @__PURE__ */ new Set();
242
+ return p.forEach((e) => {
243
+ let t = Ve(d[e], f[e]);
219
244
  t.size !== 0 && t.forEach((t) => {
220
- let r = i.byId[t], c = a.byId[t];
221
- !r || !c || r.parentId === c.parentId && (s.has(t) || (r.parentId ?? "__root__") === e && (d.has(t) || (d.add(t), o.push({
245
+ let r = s.byId[t], i = c.byId[t];
246
+ !r || !i || r.parentId === i.parentId && (u.has(t) || (r.parentId ?? "__root__") === e && (m.has(t) || (m.add(t), l.push({
222
247
  type: "move",
223
- block: c.block,
248
+ block: i.block,
224
249
  prevBlock: r.block,
225
250
  source: n,
226
- prevParent: r.parentId ? i.byId[r.parentId]?.block : void 0,
227
- currentParent: c.parentId ? a.byId[c.parentId]?.block : void 0
228
- }), s.add(t))));
251
+ prevParent: r.parentId ? s.byId[r.parentId]?.block : void 0,
252
+ currentParent: i.parentId ? c.byId[i.parentId]?.block : void 0
253
+ }), u.add(t))));
229
254
  });
230
- }), o;
255
+ }), l;
231
256
  }
232
257
  //#endregion
233
258
  //#region src/extensions/BlockChange/BlockChange.ts
234
- var He = b(() => {
259
+ var Ue = b(() => {
235
260
  let e = [];
236
261
  return {
237
262
  key: "blockChange",
@@ -241,7 +266,7 @@ var He = b(() => {
241
266
  let n;
242
267
  return e.reduce((e, r) => e === !1 ? e : r({
243
268
  getChanges() {
244
- return n || (n = Ve(t), n);
269
+ return n || (n = He(t), n);
245
270
  },
246
271
  tr: t
247
272
  }) !== !1, !0);
@@ -256,10 +281,10 @@ var He = b(() => {
256
281
  });
257
282
  //#endregion
258
283
  //#region src/extensions/DropCursor/utils.ts
259
- function Ue(e, t) {
284
+ function We(e, t) {
260
285
  return !e || !t ? !1 : !!e.closest(`.${t}`);
261
286
  }
262
- function We(e, t, n, r, i) {
287
+ function Ge(e, t, n, r, i) {
263
288
  let a = e.state.doc.resolve(t.pos);
264
289
  if (a.parent.inlineContent || t.orientation === "inline") return null;
265
290
  let o = a.nodeBefore, s = a.nodeAfter;
@@ -286,7 +311,7 @@ function We(e, t, n, r, i) {
286
311
  bottom: f + p
287
312
  };
288
313
  }
289
- function Ge(e, t, n, r) {
314
+ function Ke(e, t, n, r) {
290
315
  let i = e.coordsAtPos(t.pos), a = n / 2 * r;
291
316
  return {
292
317
  left: i.left - a,
@@ -295,10 +320,10 @@ function Ge(e, t, n, r) {
295
320
  bottom: i.bottom
296
321
  };
297
322
  }
298
- function Ke(e, t) {
323
+ function qe(e, t) {
299
324
  e.classList.toggle("prosemirror-dropcursor-inline", t === "inline"), e.classList.toggle("prosemirror-dropcursor-block-horizontal", t === "block-horizontal"), e.classList.toggle("prosemirror-dropcursor-block-vertical-left", t === "block-vertical-left"), e.classList.toggle("prosemirror-dropcursor-block-vertical-right", t === "block-vertical-right"), e.classList.toggle("prosemirror-dropcursor-block", t === "block-horizontal"), e.classList.toggle("prosemirror-dropcursor-vertical", t === "block-vertical-left" || t === "block-vertical-right");
300
325
  }
301
- function qe(e) {
326
+ function Je(e) {
302
327
  if (!e || e === document.body && getComputedStyle(e).position === "static") return {
303
328
  parentLeft: -window.pageXOffset,
304
329
  parentTop: -window.pageYOffset
@@ -311,7 +336,7 @@ function qe(e) {
311
336
  }
312
337
  //#endregion
313
338
  //#region src/extensions/DropCursor/DropCursor.ts
314
- var Je = "bn-drag-exclude", Ye = b(({ editor: e, options: t }) => {
339
+ var Ye = "bn-drag-exclude", Xe = b(({ editor: e, options: t }) => {
315
340
  let n = null, r = null, i = -1, a = null, o = {
316
341
  width: t.dropCursor?.width ?? 5,
317
342
  color: t.dropCursor?.color ?? "#ddeeff",
@@ -321,9 +346,9 @@ var Je = "bn-drag-exclude", Ye = b(({ editor: e, options: t }) => {
321
346
  (e?.pos !== n?.pos || e?.orientation !== n?.orientation) && (n = e, e == null ? (r && r.parentNode && r.parentNode.removeChild(r), r = null) : c());
322
347
  }, c = () => {
323
348
  if (!n) return;
324
- let t = e.prosemirrorView, i = t.dom, a = i.getBoundingClientRect(), s = a.width / i.offsetWidth, c = a.height / i.offsetHeight, l = We(t, n, o.width, s, c) ?? Ge(t, n, o.width, s), u = t.dom.offsetParent;
325
- r || (r = u.appendChild(document.createElement("div")), r.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", o.color && (r.style.backgroundColor = o.color)), Ke(r, n.orientation);
326
- let { parentLeft: d, parentTop: f } = qe(u);
349
+ let t = e.prosemirrorView, i = t.dom, a = i.getBoundingClientRect(), s = a.width / i.offsetWidth, c = a.height / i.offsetHeight, l = Ge(t, n, o.width, s, c) ?? Ke(t, n, o.width, s), u = t.dom.offsetParent;
350
+ r || (r = u.appendChild(document.createElement("div")), r.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", o.color && (r.style.backgroundColor = o.color)), qe(r, n.orientation);
351
+ let { parentLeft: d, parentTop: f } = Je(u);
327
352
  r.style.left = (l.left - d) / s + "px", r.style.top = (l.top - f) / c + "px", r.style.width = (l.right - l.left) / s + "px", r.style.height = (l.bottom - l.top) / c + "px";
328
353
  }, l = (e) => {
329
354
  clearTimeout(i), i = window.setTimeout(() => s(null), e);
@@ -332,7 +357,7 @@ var Je = "bn-drag-exclude", Ye = b(({ editor: e, options: t }) => {
332
357
  a = t.target instanceof Element ? t.target : null;
333
358
  }, d = (t) => {
334
359
  let n = t;
335
- if (a && Ue(a, o.exclude) || n.target instanceof Element && Ue(n.target, o.exclude)) return;
360
+ if (a && We(a, o.exclude) || n.target instanceof Element && We(n.target, o.exclude)) return;
336
361
  let r = e.prosemirrorView;
337
362
  if (!r.editable) return;
338
363
  let i = r.posAtCoords({
@@ -342,7 +367,7 @@ var Je = "bn-drag-exclude", Ye = b(({ editor: e, options: t }) => {
342
367
  if (i && !d) {
343
368
  let t = i.pos;
344
369
  if (r.dragging && r.dragging.slice) {
345
- let e = se(r.state.doc, t, r.dragging.slice);
370
+ let e = oe(r.state.doc, t, r.dragging.slice);
346
371
  e != null && (t = e);
347
372
  }
348
373
  let a = !r.state.doc.resolve(t).parent.inlineContent, c = {
@@ -383,21 +408,21 @@ var Je = "bn-drag-exclude", Ye = b(({ editor: e, options: t }) => {
383
408
  });
384
409
  }
385
410
  };
386
- }), Xe = b(() => ({
411
+ }), Ze = b(() => ({
387
412
  key: "history",
388
413
  prosemirrorPlugins: [De()],
389
414
  undoCommand: ke,
390
415
  redoCommand: Oe
391
- })), Ze = new w("inline-content-boundary-edit");
392
- function Qe(e, t, n) {
416
+ })), Qe = new w("inline-content-boundary-edit");
417
+ function $e(e, t, n) {
393
418
  if (!e.empty) return e.from <= n.from && e.to >= n.to;
394
419
  let r = n.to - n.from === 1;
395
420
  return t === "Backspace" ? r && e.from === n.to : r && e.from === n.from;
396
421
  }
397
- var $e = b(() => ({
422
+ var et = b(() => ({
398
423
  key: "inlineContentBoundaryEdit",
399
424
  prosemirrorPlugins: [new C({
400
- key: Ze,
425
+ key: Qe,
401
426
  props: { handleKeyDown: (e, t) => {
402
427
  if (!e.editable) return !1;
403
428
  let n = t.key.length === 1 && !t.ctrlKey && !t.metaKey;
@@ -409,7 +434,7 @@ var $e = b(() => ({
409
434
  let n = e.state.tr.insert(o, e.state.schema.text(t.key));
410
435
  return n.setSelection(E.create(n.doc, o + t.key.length)), e.dispatch(n), !0;
411
436
  }
412
- if (i.content.size > 0 && Qe(r, t.key, {
437
+ if (i.content.size > 0 && $e(r, t.key, {
413
438
  from: o,
414
439
  to: s
415
440
  })) {
@@ -419,7 +444,7 @@ var $e = b(() => ({
419
444
  return !1;
420
445
  } }
421
446
  })]
422
- })), et = b(({ editor: e }) => {
447
+ })), tt = b(({ editor: e }) => {
423
448
  function t(t) {
424
449
  let n = e.prosemirrorView.nodeDOM(t);
425
450
  for (; n && n.parentElement;) {
@@ -466,7 +491,7 @@ var $e = b(() => ({
466
491
  e.deleteLink(t);
467
492
  }
468
493
  };
469
- }), tt = [
494
+ }), nt = [
470
495
  "http",
471
496
  "https",
472
497
  "ftp",
@@ -477,10 +502,10 @@ var $e = b(() => ({
477
502
  "sms",
478
503
  "cid",
479
504
  "xmpp"
480
- ], nt = "https", rt = new w("node-selection-keyboard"), it = b(() => ({
505
+ ], rt = "https", it = new w("node-selection-keyboard"), at = b(() => ({
481
506
  key: "nodeSelectionKeyboard",
482
507
  prosemirrorPlugins: [new C({
483
- key: rt,
508
+ key: it,
484
509
  props: { handleKeyDown: (e, t) => {
485
510
  if ("node" in e.state.selection) {
486
511
  if (t.ctrlKey || t.metaKey) return !1;
@@ -493,12 +518,12 @@ var $e = b(() => ({
493
518
  return !1;
494
519
  } }
495
520
  })]
496
- })), at = new w("blocknote-placeholder"), ot = b(({ editor: e, options: t }) => {
521
+ })), ot = new w("blocknote-placeholder"), st = b(({ editor: e, options: t }) => {
497
522
  let n = t.placeholders;
498
523
  return {
499
524
  key: "placeholder",
500
525
  prosemirrorPlugins: [new C({
501
- key: at,
526
+ key: ot,
502
527
  view: (t) => {
503
528
  let r = `placeholder-selector-${ue()}`;
504
529
  t.dom.classList.add(r);
@@ -533,10 +558,10 @@ var $e = b(() => ({
533
558
  } }
534
559
  })]
535
560
  };
536
- }), st = b(({ editor: e }) => {
537
- let t = new oe(), n = 0;
561
+ }), ct = b(({ editor: e }) => {
562
+ let t = new ae(), n = 0;
538
563
  function r() {
539
- t = new oe(), n = 0;
564
+ t = new ae(), n = 0;
540
565
  }
541
566
  let i = typeof FinalizationRegistry < "u" ? new FinalizationRegistry(() => {
542
567
  n--, n === 0 && r();
@@ -555,23 +580,23 @@ var $e = b(() => ({
555
580
  return i && i.register(o, void 0), o;
556
581
  }
557
582
  };
558
- }), A = new w("previous-blocks"), ct = {
583
+ }), lt = new w("previous-blocks"), ut = {
559
584
  index: "index",
560
585
  level: "level",
561
586
  type: "type",
562
587
  depth: "depth",
563
588
  "depth-change": "depth-change"
564
- }, lt = b(() => {
589
+ }, dt = b(() => {
565
590
  let e;
566
591
  return {
567
592
  key: "previousBlockType",
568
593
  prosemirrorPlugins: [new C({
569
- key: A,
594
+ key: lt,
570
595
  view(t) {
571
596
  return {
572
597
  update: async (t, n) => {
573
598
  this.key?.getState(t.state).updatedBlocks.size > 0 && (e = setTimeout(() => {
574
- t.dispatch(t.state.tr.setMeta(A, { clearUpdate: !0 }));
599
+ t.dispatch(t.state.tr.setMeta(lt, { clearUpdate: !0 }));
575
600
  }, 0));
576
601
  },
577
602
  destroy: () => {
@@ -589,14 +614,14 @@ var $e = b(() => ({
589
614
  },
590
615
  apply(e, t, n, r) {
591
616
  if (t.currentTransactionOldBlockAttrs = {}, t.updatedBlocks.clear(), !e.docChanged) return t;
592
- let i = e.changedRange();
617
+ let i = Le(e);
593
618
  if (!i) return t;
594
619
  let a = e.mapping.invert(), o = {
595
620
  from: a.map(i.from, -1),
596
621
  to: a.map(i.to, 1)
597
- }, s = {}, c = S(n.doc, o, (e) => e.attrs.id), l = new Map(c.map((e) => [_(e.node, n.doc), e])), u = S(r.doc, i, (e) => e.attrs.id);
622
+ }, s = {}, c = ce(n.doc, o, (e) => e.attrs.id), l = new Map(c.map((e) => [h(e.node, n.doc), e])), u = ce(r.doc, i, (e) => e.attrs.id);
598
623
  for (let e of u) {
599
- let i = _(e.node, r.doc), a = l.get(i), o = a?.node.firstChild, c = e.node.firstChild;
624
+ let i = h(e.node, r.doc), a = l.get(i), o = a?.node.firstChild, c = e.node.firstChild;
600
625
  if (a && o && c) {
601
626
  let l = {
602
627
  index: c.attrs.index,
@@ -621,10 +646,10 @@ var $e = b(() => ({
621
646
  let n = [];
622
647
  return e.doc.descendants((r, i) => {
623
648
  if (!r.attrs.id) return;
624
- let a = _(r, e.doc);
649
+ let a = h(r, e.doc);
625
650
  if (!t.updatedBlocks.has(a)) return;
626
651
  let o = t.currentTransactionOldBlockAttrs[a], s = {};
627
- for (let [e, t] of Object.entries(o)) s["data-prev-" + ct[e]] = t || "none";
652
+ for (let [e, t] of Object.entries(o)) s["data-prev-" + ut[e]] = t || "none";
628
653
  n.push(D.node(i, i + r.nodeSize, { ...s }));
629
654
  }), O.create(e.doc, n);
630
655
  } }
@@ -633,7 +658,7 @@ var $e = b(() => ({
633
658
  });
634
659
  //#endregion
635
660
  //#region src/extensions/getDraggableBlockFromElement.ts
636
- function ut(e, t) {
661
+ function ft(e, t) {
637
662
  for (; e && e.parentElement && e.parentElement !== t.dom && e.getAttribute?.("data-node-type") !== "blockContainer";) e = e.parentElement;
638
663
  if (e.getAttribute?.("data-node-type") === "blockContainer") return {
639
664
  node: e,
@@ -642,61 +667,61 @@ function ut(e, t) {
642
667
  }
643
668
  //#endregion
644
669
  //#region src/api/exporters/markdown/htmlToMarkdown.ts
645
- function dt(e) {
670
+ function pt(e) {
646
671
  let t = document.createElement("div");
647
- return t.innerHTML = e, j(t, {
672
+ return t.innerHTML = e, A(t, {
648
673
  indent: "",
649
674
  inListItem: !1
650
675
  }).trim() + "\n";
651
676
  }
652
- function j(e, t) {
677
+ function A(e, t) {
653
678
  let n = "", r = Array.from(e.childNodes);
654
679
  for (let e = 0; e < r.length; e++) {
655
680
  let i = r[e];
656
- n += M(i, t);
681
+ n += j(i, t);
657
682
  }
658
683
  return n;
659
684
  }
660
- function M(e, t) {
685
+ function j(e, t) {
661
686
  if (e.nodeType === 3) return e.textContent || "";
662
687
  if (e.nodeType !== 1) return "";
663
688
  let n = e;
664
689
  switch (n.tagName.toLowerCase()) {
665
- case "p": return ft(n, t);
690
+ case "p": return mt(n, t);
666
691
  case "h1":
667
692
  case "h2":
668
693
  case "h3":
669
694
  case "h4":
670
695
  case "h5":
671
- case "h6": return pt(n, t);
672
- case "blockquote": return mt(n, t);
673
- case "pre": return ht(n, t);
674
- case "ul": return bt(n, t);
675
- case "ol": return xt(n, t);
676
- case "table": return wt(n, t);
696
+ case "h6": return ht(n, t);
697
+ case "blockquote": return gt(n, t);
698
+ case "pre": return _t(n, t);
699
+ case "ul": return St(n, t);
700
+ case "ol": return Ct(n, t);
701
+ case "table": return Et(n, t);
677
702
  case "hr": return t.indent + "***\n\n";
678
- case "math": return _t(n, t);
679
- case "img": return Dt(n, t);
680
- case "video": return Ot(n, t);
681
- case "audio": return kt(n, t);
682
- case "embed": return At(n, t);
683
- case "figure": return jt(n, t);
684
- case "a": return I(n, t);
685
- case "details": return Pt(n, t);
686
- case "div": return j(n, t);
703
+ case "math": return yt(n, t);
704
+ case "img": return kt(n, t);
705
+ case "video": return At(n, t);
706
+ case "audio": return jt(n, t);
707
+ case "embed": return Mt(n, t);
708
+ case "figure": return Nt(n, t);
709
+ case "a": return F(n, t);
710
+ case "details": return It(n, t);
711
+ case "div": return A(n, t);
687
712
  case "br": return "";
688
- default: return j(n, t);
713
+ default: return A(n, t);
689
714
  }
690
715
  }
691
- function ft(e, t) {
692
- let n = Ft(R(e));
716
+ function mt(e, t) {
717
+ let n = Lt(L(e));
693
718
  return t.inListItem ? n : t.indent + n + "\n\n";
694
719
  }
695
- function pt(e, t) {
696
- let n = parseInt(e.tagName[1], 10), r = "#".repeat(n) + " ", i = R(e);
720
+ function ht(e, t) {
721
+ let n = parseInt(e.tagName[1], 10), r = "#".repeat(n) + " ", i = L(e);
697
722
  return t.indent + r + i + "\n\n";
698
723
  }
699
- function mt(e, t) {
724
+ function gt(e, t) {
700
725
  let n = Array.from(e.children).filter((e) => {
701
726
  let t = e.tagName.toLowerCase();
702
727
  return [
@@ -711,57 +736,57 @@ function mt(e, t) {
711
736
  }), r;
712
737
  if (n.length > 0) {
713
738
  let e = [];
714
- for (let t of n) t.tagName.toLowerCase() === "p" ? e.push(R(t)) : e.push(M(t, {
739
+ for (let t of n) t.tagName.toLowerCase() === "p" ? e.push(L(t)) : e.push(j(t, {
715
740
  indent: "",
716
741
  inListItem: !1
717
742
  }).trim());
718
743
  r = e.join("\n\n");
719
- } else r = R(e);
744
+ } else r = L(e);
720
745
  return r.split("\n").map((e) => t.indent + "> " + e).join("\n") + "\n\n";
721
746
  }
722
- function ht(e, t) {
747
+ function _t(e, t) {
723
748
  let n = e.querySelector("code");
724
749
  if (!n) return "";
725
- let r = n.getAttribute("data-language") || yt(n.className) || "", i = vt(n), a = Math.max(0, ...(i.match(/`+/g) ?? []).map((e) => e.length)), o = "`".repeat(Math.max(3, a + 1));
750
+ let r = n.getAttribute("data-language") || xt(n.className) || "", i = bt(n), a = Math.max(0, ...(i.match(/`+/g) ?? []).map((e) => e.length)), o = "`".repeat(Math.max(3, a + 1));
726
751
  return i ? [
727
752
  o + r,
728
753
  ...(i.endsWith("\n") ? i.slice(0, -1) : i).split("\n"),
729
754
  o
730
755
  ].map((e) => e && t.indent + e).join("\n") + "\n\n" : t.indent + o + r + "\n" + t.indent + o + "\n\n";
731
756
  }
732
- function gt(e) {
757
+ function vt(e) {
733
758
  return (e.querySelector("annotation[encoding=\"application/x-tex\"]")?.textContent ?? e.textContent ?? "").trim();
734
759
  }
735
- function _t(e, t) {
760
+ function yt(e, t) {
736
761
  return [
737
762
  "$$",
738
- ...gt(e).split("\n"),
763
+ ...vt(e).split("\n"),
739
764
  "$$"
740
765
  ].map((e) => e && t.indent + e).join("\n") + "\n\n";
741
766
  }
742
- function vt(e) {
767
+ function bt(e) {
743
768
  let t = "";
744
- for (let n of Array.from(e.childNodes)) n.nodeType === 3 ? t += n.textContent || "" : n.nodeType === 1 && (n.tagName.toLowerCase() === "br" ? t += "\n" : t += vt(n));
769
+ for (let n of Array.from(e.childNodes)) n.nodeType === 3 ? t += n.textContent || "" : n.nodeType === 1 && (n.tagName.toLowerCase() === "br" ? t += "\n" : t += bt(n));
745
770
  return t;
746
771
  }
747
- function yt(e) {
772
+ function xt(e) {
748
773
  let t = e.match(/language-(\S+)/);
749
774
  return t ? t[1] : "";
750
775
  }
751
- function bt(e, t) {
776
+ function St(e, t) {
752
777
  let n = "", r = Array.from(e.children).filter((e) => e.tagName.toLowerCase() === "li");
753
- for (let e of r) n += St(e, "bullet", t);
778
+ for (let e of r) n += wt(e, "bullet", t);
754
779
  return t.inListItem || (n += "\n"), n;
755
780
  }
756
- function xt(e, t) {
781
+ function Ct(e, t) {
757
782
  let n = "", r = Array.from(e.children).filter((e) => e.tagName.toLowerCase() === "li"), i = parseInt(e.getAttribute("start") || "1", 10);
758
783
  for (let e = 0; e < r.length; e++) {
759
784
  let a = i + e;
760
- n += St(r[e], "ordered", t, a);
785
+ n += wt(r[e], "ordered", t, a);
761
786
  }
762
787
  return t.inListItem || (n += "\n"), n;
763
788
  }
764
- function St(e, t, n, r) {
789
+ function wt(e, t, n, r) {
765
790
  let i = null, a = null;
766
791
  for (let t of Array.from(e.children)) {
767
792
  let e = t.tagName.toLowerCase();
@@ -772,8 +797,8 @@ function St(e, t, n, r) {
772
797
  let c, l;
773
798
  if (a) {
774
799
  let e = a.querySelector("summary")?.querySelector("p");
775
- l = a, c = e ? R(e) : "";
776
- } else l = Ct(e, i), c = l ? R(l) : "";
800
+ l = a, c = e ? L(e) : "";
801
+ } else l = Tt(e, i), c = l ? L(l) : "";
777
802
  let u = n.indent + o + c + "\n", d = n.indent + " ".repeat(s), f = {
778
803
  indent: d,
779
804
  inListItem: !0
@@ -782,25 +807,25 @@ function St(e, t, n, r) {
782
807
  let e = a.querySelector("summary");
783
808
  for (let t of Array.from(a.children)) if (t !== e) {
784
809
  if (t.tagName.toLowerCase() === "p") {
785
- let e = R(t);
810
+ let e = L(t);
786
811
  u += "\n" + d + e + "\n";
787
- } else u += M(t, f);
812
+ } else u += j(t, f);
788
813
  }
789
814
  }
790
815
  let p = Array.from(e.children);
791
816
  for (let e of p) {
792
817
  let t = e.tagName.toLowerCase();
793
818
  if (e !== l && e !== i && t !== "input") {
794
- if (t === "ul" || t === "ol") u += M(e, f);
819
+ if (t === "ul" || t === "ol") u += j(e, f);
795
820
  else if (t === "p") {
796
- let t = R(e);
821
+ let t = L(e);
797
822
  u += "\n" + d + t + "\n";
798
- } else u += "\n" + M(e, f);
823
+ } else u += "\n" + j(e, f);
799
824
  }
800
825
  }
801
826
  return u;
802
827
  }
803
- function Ct(e, t) {
828
+ function Tt(e, t) {
804
829
  for (let n of Array.from(e.children)) {
805
830
  if (n === t || n.tagName.toLowerCase() === "input") continue;
806
831
  let e = n.tagName.toLowerCase();
@@ -808,7 +833,7 @@ function Ct(e, t) {
808
833
  }
809
834
  return null;
810
835
  }
811
- function wt(e, t) {
836
+ function Et(e, t) {
812
837
  let n = e.querySelector("colgroup"), r = 0;
813
838
  n && (r = n.querySelectorAll("col").length);
814
839
  let i = [], a = !1, o = e.querySelectorAll("tr"), s = [];
@@ -818,7 +843,7 @@ function wt(e, t) {
818
843
  n.forEach((e) => {
819
844
  for (; s[t][i] !== void 0;) i++;
820
845
  t === 0 && e.tagName.toLowerCase() === "th" && (a = !0);
821
- let n = Tt(R(e).trim()), r = parseInt(e.getAttribute("colspan") || "1", 10), o = parseInt(e.getAttribute("rowspan") || "1", 10);
846
+ let n = Dt(L(e).trim()), r = parseInt(e.getAttribute("colspan") || "1", 10), o = parseInt(e.getAttribute("rowspan") || "1", 10);
822
847
  for (let e = 0; e < o; e++) for (let a = 0; a < r; a++) {
823
848
  let r = t + e;
824
849
  s[r] || (s[r] = []), s[r][i + a] = e === 0 && a === 0 ? n : "";
@@ -843,19 +868,19 @@ function wt(e, t) {
843
868
  }
844
869
  let l = "";
845
870
  if (a) {
846
- l += t.indent + N(i[0], c, r) + "\n", l += t.indent + Et(c, r) + "\n";
847
- for (let e = 1; e < i.length; e++) l += t.indent + N(i[e], c, r) + "\n";
871
+ l += t.indent + M(i[0], c, r) + "\n", l += t.indent + Ot(c, r) + "\n";
872
+ for (let e = 1; e < i.length; e++) l += t.indent + M(i[e], c, r) + "\n";
848
873
  } else {
849
874
  let e = Array(r).fill("");
850
- l += t.indent + N(e, c, r) + "\n", l += t.indent + Et(c, r) + "\n";
851
- for (let e of i) l += t.indent + N(e, c, r) + "\n";
875
+ l += t.indent + M(e, c, r) + "\n", l += t.indent + Ot(c, r) + "\n";
876
+ for (let e of i) l += t.indent + M(e, c, r) + "\n";
852
877
  }
853
878
  return l += "\n", l;
854
879
  }
855
- function Tt(e) {
880
+ function Dt(e) {
856
881
  return e.replace(/\|/g, "\\|");
857
882
  }
858
- function N(e, t, n) {
883
+ function M(e, t, n) {
859
884
  let r = [];
860
885
  for (let i = 0; i < n; i++) {
861
886
  let n = i < e.length ? e[i] : "";
@@ -863,65 +888,65 @@ function N(e, t, n) {
863
888
  }
864
889
  return "|" + r.join("|") + "|";
865
890
  }
866
- function Et(e, t) {
891
+ function Ot(e, t) {
867
892
  let n = [];
868
893
  for (let r = 0; r < t; r++) n.push(" " + "-".repeat(e[r]) + " ");
869
894
  return "|" + n.join("|") + "|";
870
895
  }
871
- function Dt(e, t) {
896
+ function kt(e, t) {
872
897
  let n = e.getAttribute("src") || "", r = e.getAttribute("alt") || "";
873
898
  return n ? t.indent + `![${r}](${n})\n\n` : "\n\n";
874
899
  }
875
- function Ot(e, t) {
900
+ function At(e, t) {
876
901
  let n = e.getAttribute("src") || e.getAttribute("data-url") || "", r = e.getAttribute("data-name") || e.getAttribute("title") || "";
877
902
  return n ? t.indent + `![${r}](${n})\n\n` : "\n\n";
878
903
  }
879
- function kt(e, t) {
904
+ function jt(e, t) {
880
905
  let n = e.getAttribute("src") || "";
881
- return n ? t.indent + `<audio src="${F(n)}" controls></audio>\n\n` : "\n\n";
906
+ return n ? t.indent + `<audio src="${P(n)}" controls></audio>\n\n` : "\n\n";
882
907
  }
883
- function At(e, t) {
908
+ function Mt(e, t) {
884
909
  let n = e.getAttribute("src") || "";
885
910
  return n ? t.indent + `[](${n})\n\n` : "\n\n";
886
911
  }
887
- function jt(e, t) {
912
+ function Nt(e, t) {
888
913
  let n = e.querySelector("img"), r = e.querySelector("video"), i = e.querySelector("audio"), a = e.querySelector("a"), o = e.querySelector("figcaption")?.textContent?.trim() || "";
889
- return n ? P("img", n.getAttribute("src") || "", n.getAttribute("alt") || "", o, t) : r ? P("video", r.getAttribute("src") || r.getAttribute("data-url") || "", r.getAttribute("data-name") || r.getAttribute("title") || "", o, t) : i ? P("audio", i.getAttribute("src") || "", "", o, t) : a ? I(a, t) : "";
914
+ return n ? N("img", n.getAttribute("src") || "", n.getAttribute("alt") || "", o, t) : r ? N("video", r.getAttribute("src") || r.getAttribute("data-url") || "", r.getAttribute("data-name") || r.getAttribute("title") || "", o, t) : i ? N("audio", i.getAttribute("src") || "", "", o, t) : a ? F(a, t) : "";
890
915
  }
891
- function P(e, t, n, r, i) {
916
+ function N(e, t, n, r, i) {
892
917
  if (!t) return "";
893
918
  if (!r && e !== "audio") return i.indent + `![${n}](${t})\n\n`;
894
- let a = n && n !== r ? e === "img" ? ` alt="${F(n)}"` : e === "video" ? ` data-name="${F(n)}"` : "" : "", o = e === "img" ? `<img${a} src="${F(t)}">` : `<${e} src="${F(t)}"${a} controls></${e}>`, s = r ? `<figcaption>${Mt(r)}</figcaption>` : "";
919
+ let a = n && n !== r ? e === "img" ? ` alt="${P(n)}"` : e === "video" ? ` data-name="${P(n)}"` : "" : "", o = e === "img" ? `<img${a} src="${P(t)}">` : `<${e} src="${P(t)}"${a} controls></${e}>`, s = r ? `<figcaption>${Pt(r)}</figcaption>` : "";
895
920
  return i.indent + `<figure>${o}${s}</figure>\n\n`;
896
921
  }
897
- function F(e) {
922
+ function P(e) {
898
923
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
899
924
  }
900
- function Mt(e) {
925
+ function Pt(e) {
901
926
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
902
927
  }
903
- function I(e, t) {
928
+ function F(e, t) {
904
929
  let n = e.getAttribute("href") || "", r = e.textContent?.trim() || "";
905
- return n ? t.indent + L(r, n) + "\n\n" : t.indent + r + "\n\n";
930
+ return n ? t.indent + I(r, n) + "\n\n" : t.indent + r + "\n\n";
906
931
  }
907
- function L(e, t) {
908
- return !e || e === t ? t : `[${e}](${Nt(t)})`;
932
+ function I(e, t) {
933
+ return !e || e === t ? t : `[${e}](${Ft(t)})`;
909
934
  }
910
- function Nt(e) {
935
+ function Ft(e) {
911
936
  return e.replace(/[\\()]/g, "\\$&");
912
937
  }
913
- function Pt(e, t) {
938
+ function It(e, t) {
914
939
  let n = e.querySelector("summary");
915
- if (!n) return j(e, t);
940
+ if (!n) return A(e, t);
916
941
  let r = n.querySelector("h1, h2, h3, h4, h5, h6");
917
942
  if (r) {
918
- let i = pt(r, t);
919
- for (let r of Array.from(e.children)) r !== n && (i += M(r, t));
943
+ let i = ht(r, t);
944
+ for (let r of Array.from(e.children)) r !== n && (i += j(r, t));
920
945
  return i;
921
946
  }
922
- return j(n, t);
947
+ return A(n, t);
923
948
  }
924
- function R(e) {
949
+ function L(e) {
925
950
  let t = "";
926
951
  for (let n of Array.from(e.childNodes)) if (n.nodeType === 3) t += n.textContent || "";
927
952
  else if (n.nodeType === 1) {
@@ -929,19 +954,19 @@ function R(e) {
929
954
  switch (e.tagName.toLowerCase()) {
930
955
  case "strong":
931
956
  case "b": {
932
- let { content: n, trailing: r } = z(R(e));
957
+ let { content: n, trailing: r } = R(L(e));
933
958
  t += n ? `**${n}**${r}` : r;
934
959
  break;
935
960
  }
936
961
  case "em":
937
962
  case "i": {
938
- let { content: n, trailing: r } = z(R(e));
963
+ let { content: n, trailing: r } = R(L(e));
939
964
  t += n ? `*${n}*${r}` : r;
940
965
  break;
941
966
  }
942
967
  case "s":
943
968
  case "del":
944
- t += `~~${R(e)}~~`;
969
+ t += `~~${L(e)}~~`;
945
970
  break;
946
971
  case "code": {
947
972
  let n = e.textContent || "", r = Math.max(0, ...(n.match(/`+/g) ?? []).map((e) => e.length)), i = "`".repeat(r + 1), a = n.startsWith("`") || n.endsWith("`");
@@ -949,23 +974,23 @@ function R(e) {
949
974
  break;
950
975
  }
951
976
  case "u":
952
- t += R(e);
977
+ t += L(e);
953
978
  break;
954
979
  case "a": {
955
- let n = e.getAttribute("href") || "", r = R(e);
956
- t += L(r, n);
980
+ let n = e.getAttribute("href") || "", r = L(e);
981
+ t += I(r, n);
957
982
  break;
958
983
  }
959
984
  case "br":
960
985
  t += "\\\n";
961
986
  break;
962
987
  case "math": {
963
- let n = gt(e).split("\n").map((e) => e.trim()).join(" ");
988
+ let n = vt(e).split("\n").map((e) => e.trim()).join(" ");
964
989
  t += `$${n}$`;
965
990
  break;
966
991
  }
967
992
  case "span":
968
- t += R(e);
993
+ t += L(e);
969
994
  break;
970
995
  case "img": {
971
996
  let n = e.getAttribute("src") || "", r = e.getAttribute("alt") || "";
@@ -978,15 +1003,15 @@ function R(e) {
978
1003
  break;
979
1004
  }
980
1005
  case "p":
981
- t += R(e);
1006
+ t += L(e);
982
1007
  break;
983
1008
  case "input": break;
984
- default: t += R(e);
1009
+ default: t += L(e);
985
1010
  }
986
1011
  }
987
1012
  return t;
988
1013
  }
989
- function z(e) {
1014
+ function R(e) {
990
1015
  let t = e.match(/^(.*?)(\s*)$/);
991
1016
  return t ? {
992
1017
  content: t[1],
@@ -996,25 +1021,25 @@ function z(e) {
996
1021
  trailing: ""
997
1022
  };
998
1023
  }
999
- function Ft(e) {
1024
+ function Lt(e) {
1000
1025
  let t = e.replace(/^(\\\n)+/, "");
1001
1026
  return t = t.replace(/(\\\n)+$/, ""), t;
1002
1027
  }
1003
1028
  //#endregion
1004
1029
  //#region src/api/exporters/markdown/markdownExporter.ts
1005
- function B(e) {
1006
- return dt(e.split("").join(""));
1030
+ function z(e) {
1031
+ return pt(e.split("").join(""));
1007
1032
  }
1008
- function It(e, t, n, r) {
1009
- return B(k(t, n).exportBlocks(e, r));
1033
+ function Rt(e, t, n, r) {
1034
+ return z(k(t, n).exportBlocks(e, r));
1010
1035
  }
1011
1036
  //#endregion
1012
1037
  //#region src/api/nodeConversions/fragmentToBlocks.ts
1013
- function Lt(e) {
1038
+ function B(e) {
1014
1039
  let t = [];
1015
1040
  return e.descendants((e) => e.type.name === "blockContainer" && e.firstChild?.type.name === "blockGroup" ? !0 : e.type.name === "columnList" && e.childCount === 1 ? (e.firstChild?.forEach((n) => {
1016
- t.push(u(n, e));
1017
- }), !1) : !e.type.isInGroup("bnBlock") || (t.push(u(e, e)), !1)), t;
1041
+ t.push(v(n, e));
1042
+ }), !1) : !e.type.isInGroup("bnBlock") || (t.push(v(e, e)), !1)), t;
1018
1043
  }
1019
1044
  //#endregion
1020
1045
  //#region src/extensions/SideMenu/MultipleNodeSelection.ts
@@ -1031,7 +1056,7 @@ var V = class e extends T {
1031
1056
  return new e(t.resolve(n), t.resolve(r));
1032
1057
  }
1033
1058
  content() {
1034
- return new ae(x.from(this.nodes), 0, 0);
1059
+ return new ie(S.from(this.nodes), 0, 0);
1035
1060
  }
1036
1061
  eq(t) {
1037
1062
  if (!(t instanceof e) || this.nodes.length !== t.nodes.length || this.from !== t.from || this.to !== t.to) return !1;
@@ -1054,7 +1079,7 @@ T.jsonID("multiple-node", V);
1054
1079
  //#endregion
1055
1080
  //#region src/extensions/SideMenu/dragging.ts
1056
1081
  var H;
1057
- function Rt(e, t) {
1082
+ function zt(e, t) {
1058
1083
  let n, r, i = t.resolve(e.from).node().type.spec.group === "blockContent", a = t.resolve(e.to).node().type.spec.group === "blockContent", o = Math.min(e.$anchor.depth, e.$head.depth);
1059
1084
  if (i && a) {
1060
1085
  let i = e.$from.start(o - 1), a = e.$to.end(o - 1);
@@ -1065,40 +1090,40 @@ function Rt(e, t) {
1065
1090
  to: r
1066
1091
  };
1067
1092
  }
1068
- function zt(e, t, n = t) {
1093
+ function Bt(e, t, n = t) {
1069
1094
  t === n && (n += e.state.doc.resolve(t + 1).node().nodeSize);
1070
1095
  let r = e.domAtPos(t).node.cloneNode(!0), i = e.domAtPos(t).node, a = (e, t) => Array.prototype.indexOf.call(e.children, t), o = a(i, e.domAtPos(t + 1).node.parentElement), s = a(i, e.domAtPos(n - 1).node.parentElement);
1071
1096
  for (let e = i.childElementCount - 1; e >= 0; e--) (e > s || e < o) && r.removeChild(r.children[e]);
1072
- Bt(e.root), H = r, H.querySelectorAll("iframe, embed, object").forEach((e) => e.parentElement?.removeChild(e));
1097
+ Vt(e.root), H = r, H.querySelectorAll("iframe, embed, object").forEach((e) => e.parentElement?.removeChild(e));
1073
1098
  let c = e.dom.className.split(" ").filter((e) => e !== "ProseMirror" && e !== "bn-root" && e !== "bn-editor").join(" ");
1074
1099
  H.className = H.className + " bn-drag-preview " + c, e.root instanceof ShadowRoot ? e.root.appendChild(H) : e.root.body.appendChild(H);
1075
1100
  }
1076
- function Bt(e) {
1101
+ function Vt(e) {
1077
1102
  H !== void 0 && (e instanceof ShadowRoot ? e.removeChild(H) : e.body.removeChild(H), H = void 0);
1078
1103
  }
1079
- function Vt(e, t, n) {
1104
+ function Ht(e, t, n) {
1080
1105
  if (!e.dataTransfer || n.headless) return;
1081
- let r = n.prosemirrorView, i = c(t.id, r.state.doc);
1106
+ let r = n.prosemirrorView, i = s(t.id, r.state.doc);
1082
1107
  if (!i) throw Error(`Block with ID ${t.id} not found`);
1083
1108
  let a = i.posBeforeNode;
1084
1109
  if (a != null) {
1085
- let t = r.state.selection, i = r.state.doc, { from: o, to: s } = Rt(t, i), c = o <= a && a < s, l = t.$anchor.node() !== t.$head.node() || t instanceof V;
1086
- c && l ? (r.dispatch(r.state.tr.setSelection(V.create(i, o, s))), zt(r, o, s)) : (r.dispatch(r.state.tr.setSelection(de.create(r.state.doc, a))), zt(r, a));
1087
- let u = r.state.selection.content(), d = n.pmSchema, f = r.serializeForClipboard(u).dom.innerHTML, p = k(d, n), m = Lt(u.content), h = p.exportBlocks(m, {}), g = B(h);
1110
+ let t = r.state.selection, i = r.state.doc, { from: o, to: s } = zt(t, i), c = o <= a && a < s, l = t.$anchor.node() !== t.$head.node() || t instanceof V;
1111
+ c && l ? (r.dispatch(r.state.tr.setSelection(V.create(i, o, s))), Bt(r, o, s)) : (r.dispatch(r.state.tr.setSelection(de.create(r.state.doc, a))), Bt(r, a));
1112
+ let u = r.state.selection.content(), d = n.pmSchema, f = r.serializeForClipboard(u).dom.innerHTML, p = k(d, n), m = B(u.content), h = p.exportBlocks(m, {}), g = z(h);
1088
1113
  e.dataTransfer.clearData(), e.dataTransfer.setData("blocknote/html", f), e.dataTransfer.setData("text/html", h), e.dataTransfer.setData("text/plain", g), e.dataTransfer.effectAllowed = "move", e.dataTransfer.setDragImage(H, 0, 0);
1089
1114
  }
1090
1115
  }
1091
1116
  //#endregion
1092
1117
  //#region src/extensions/SideMenu/SideMenu.ts
1093
- var Ht = 250;
1118
+ var Ut = 250;
1094
1119
  function U(e, t, n = !0) {
1095
1120
  let r = e.root.elementsFromPoint(t.left, t.top);
1096
1121
  for (let i of r) if (e.dom.contains(i)) return n && i.closest("[data-node-type=columnList]") ? U(e, {
1097
1122
  left: t.left + 50,
1098
1123
  top: t.top
1099
- }, !1) : ut(i, e);
1124
+ }, !1) : ft(i, e);
1100
1125
  }
1101
- function Ut(e, t) {
1126
+ function Wt(e, t) {
1102
1127
  if (!t.dom.firstChild) return;
1103
1128
  let n = t.dom.firstChild.getBoundingClientRect(), r = U(t, {
1104
1129
  left: Math.min(Math.max(n.left + 10, e.x), n.right - 10),
@@ -1109,7 +1134,7 @@ function Ut(e, t) {
1109
1134
  top: e.y
1110
1135
  }, !1);
1111
1136
  }
1112
- var Wt = class {
1137
+ var Gt = class {
1113
1138
  editor;
1114
1139
  pmView;
1115
1140
  state;
@@ -1133,11 +1158,11 @@ var Wt = class {
1133
1158
  clientX: this.mousePos.x,
1134
1159
  clientY: this.mousePos.y
1135
1160
  });
1136
- if (e?.element !== this.pmView.dom || e.distance > Ht) {
1161
+ if (e?.element !== this.pmView.dom || e.distance > Ut) {
1137
1162
  this.state?.show && (this.state.show = !1, this.updateState(this.state));
1138
1163
  return;
1139
1164
  }
1140
- let t = Ut(this.mousePos, this.pmView);
1165
+ let t = Wt(this.mousePos, this.pmView);
1141
1166
  if (!t || !this.editor.isEditable) {
1142
1167
  this.state?.show && (this.state.show = !1, this.updateState(this.state));
1143
1168
  return;
@@ -1194,7 +1219,7 @@ var Wt = class {
1194
1219
  getDragEventContext = (e) => {
1195
1220
  if (!(this.pmView.dragging !== null || this.isDragOrigin || e.dataTransfer?.types.includes("blocknote/html") || e.target instanceof Node && this.pmView.dom.contains(e.target))) return;
1196
1221
  let t = !e.dataTransfer?.types.includes("blocknote/html") && !!this.pmView.dragging, n = !!this.isDragOrigin, r = t || n, i = this.findClosestEditorElement(e);
1197
- if (!i || i.distance > Ht) return;
1222
+ if (!i || i.distance > Ut) return;
1198
1223
  let a = i.element === this.pmView.dom, o = a && i.distance === 0;
1199
1224
  if (!(!a && !r)) return {
1200
1225
  isDropPoint: a,
@@ -1249,22 +1274,22 @@ var Wt = class {
1249
1274
  destroy() {
1250
1275
  this.state?.show && (this.state.show = !1, this.emitUpdate(this.state)), this.pmView.root.removeEventListener("mousemove", this.onMouseMove, !0), this.pmView.root.removeEventListener("dragstart", this.onDragStart), this.pmView.root.removeEventListener("dragover", this.onDragOver), this.pmView.root.removeEventListener("drop", this.onDrop, !0), this.pmView.root.removeEventListener("dragend", this.onDragEnd, !0), this.pmView.root.removeEventListener("keydown", this.onKeyDown, !0);
1251
1276
  }
1252
- }, Gt = new we("SideMenuPlugin"), Kt = b(({ editor: e }) => {
1277
+ }, Kt = new we("SideMenuPlugin"), qt = b(({ editor: e }) => {
1253
1278
  let t, n = y(void 0);
1254
1279
  return {
1255
1280
  key: "sideMenu",
1256
1281
  store: n,
1257
1282
  prosemirrorPlugins: [new Ce({
1258
- key: Gt,
1259
- view: (r) => (t = new Wt(e, r, (e) => {
1283
+ key: Kt,
1284
+ view: (r) => (t = new Gt(e, r, (e) => {
1260
1285
  n.setState({ ...e });
1261
1286
  }), t)
1262
1287
  })],
1263
1288
  blockDragStart(n, r) {
1264
- t && (t.isDragOrigin = !0), Vt(n, r, e);
1289
+ t && (t.isDragOrigin = !0), Ht(n, r, e);
1265
1290
  },
1266
1291
  blockDragEnd() {
1267
- Bt(e.prosemirrorView.root), t && (t.isDragOrigin = !1), e.blur();
1292
+ Vt(e.prosemirrorView.root), t && (t.isDragOrigin = !1), e.blur();
1268
1293
  },
1269
1294
  get menuFrozen() {
1270
1295
  return t.menuFrozen;
@@ -1279,7 +1304,7 @@ var Wt = class {
1279
1304
  !t.menuFrozen && t.state?.show && (t.state.show = !1, t.emitUpdate(t.state));
1280
1305
  }
1281
1306
  };
1282
- }), qt = b(({ editor: e }) => {
1307
+ }), Jt = b(({ editor: e }) => {
1283
1308
  let t = y({
1284
1309
  popupOpen: void 0,
1285
1310
  selected: void 0
@@ -1354,7 +1379,7 @@ var Wt = class {
1354
1379
  });
1355
1380
  }
1356
1381
  };
1357
- }), Jt = b(({ editor: e }) => {
1382
+ }), Yt = b(({ editor: e }) => {
1358
1383
  let t = y({ selected: void 0 }), n = (t) => !!e.schema.inlineContentSpecs[t]?.implementation?.meta?.hasPreview, r = (e) => ({ editor: t }) => {
1359
1384
  let { $from: r } = t.prosemirrorState.selection, i = r.node();
1360
1385
  if (!n(i.type.name)) return !1;
@@ -1395,13 +1420,13 @@ var Wt = class {
1395
1420
  });
1396
1421
  }
1397
1422
  };
1398
- }), Yt = Symbol.for("blocknote.shikiParser"), W = Symbol.for("blocknote.shikiHighlighterPromise"), Xt = [
1423
+ }), Xt = Symbol.for("blocknote.shikiParser"), W = Symbol.for("blocknote.shikiHighlighterPromise"), Zt = [
1399
1424
  "text",
1400
1425
  "none",
1401
1426
  "plaintext",
1402
1427
  "txt"
1403
1428
  ];
1404
- function Zt(e, t, n) {
1429
+ function Qt(e, t, n) {
1405
1430
  let r = globalThis, i, a, o = /* @__PURE__ */ new Set();
1406
1431
  return Ae({
1407
1432
  parser: (t) => {
@@ -1410,7 +1435,7 @@ function Zt(e, t, n) {
1410
1435
  i = e;
1411
1436
  });
1412
1437
  let n = t.language;
1413
- return !n || Xt.includes(n) || o.has(n) ? [] : i.getLoadedLanguages().includes(n) ? (a || (a = r[Yt] || je(i, Qt(i)), r[Yt] = a), a(t)) : i.loadLanguage(n).catch(() => {
1438
+ return !n || Zt.includes(n) || o.has(n) ? [] : i.getLoadedLanguages().includes(n) ? (a || (a = r[Xt] || je(i, $t(i)), r[Xt] = a), a(t)) : i.loadLanguage(n).catch(() => {
1414
1439
  o.add(n);
1415
1440
  });
1416
1441
  },
@@ -1424,7 +1449,7 @@ function Zt(e, t, n) {
1424
1449
  nodeTypes: t
1425
1450
  });
1426
1451
  }
1427
- function Qt(e) {
1452
+ function $t(e) {
1428
1453
  let t = e.getLoadedThemes(), n = t.find((e) => /light/i.test(e)), r = t.find((e) => /dark/i.test(e));
1429
1454
  if (n && r) return {
1430
1455
  themes: {
@@ -1436,15 +1461,15 @@ function Qt(e) {
1436
1461
  }
1437
1462
  //#endregion
1438
1463
  //#region src/extensions/SyntaxHighlighting/SyntaxHighlighting.ts
1439
- function $t(e) {
1464
+ function en(e) {
1440
1465
  let t = Object.values(e.blockSpecs).filter((e) => typeof e?.config == "object" && e.config.content === "plain" && !!e.implementation?.meta?.highlight).map((e) => e.config.type), n = Object.values(e.inlineContentSpecs).filter((e) => typeof e?.config == "object" && e.config.content === "plain" && !!e.implementation?.meta?.highlight).map((e) => e.config.type);
1441
1466
  return [...t, ...n];
1442
1467
  }
1443
- var en = b(({ editor: e, options: t }) => ({
1468
+ var tn = b(({ editor: e, options: t }) => ({
1444
1469
  key: "syntaxHighlighting",
1445
- prosemirrorPlugins: [Zt(t, $t(e.schema), e.schema)]
1470
+ prosemirrorPlugins: [Qt(t, en(e.schema), e.schema)]
1446
1471
  })), G;
1447
- async function tn() {
1472
+ async function nn() {
1448
1473
  return G || (G = (async () => {
1449
1474
  let [e, t] = await Promise.all([import("emoji-mart"), import("@emoji-mart/data")]), n = "default" in e ? e.default : e, r = "default" in t ? t.default : t;
1450
1475
  return await n.init({ data: r }), {
@@ -1453,9 +1478,9 @@ async function tn() {
1453
1478
  };
1454
1479
  })(), G);
1455
1480
  }
1456
- async function nn(e, t) {
1481
+ async function rn(e, t) {
1457
1482
  if (!("text" in e.schema.inlineContentSchema) || e.schema.inlineContentSchema.text !== te.text) return [];
1458
- let { emojiData: n, emojiMart: r } = await tn();
1483
+ let { emojiData: n, emojiMart: r } = await nn();
1459
1484
  return (t.trim() === "" ? Object.values(n.emojis) : await r.SearchIndex.search(t)).map((t) => ({
1460
1485
  id: t.skins[0].native,
1461
1486
  onItemClick: () => e.insertInlineContent(t.skins[0].native + " ")
@@ -1464,16 +1489,16 @@ async function nn(e, t) {
1464
1489
  //#endregion
1465
1490
  //#region src/extensions/TableHandles/TableHandles.ts
1466
1491
  var K;
1467
- function rn(e) {
1492
+ function an(e) {
1468
1493
  K || (K = document.createElement("div"), K.innerHTML = "_", K.style.opacity = "0", K.style.height = "1px", K.style.width = "1px", e instanceof Document ? e.body.appendChild(K) : e.appendChild(K));
1469
1494
  }
1470
- function an(e) {
1495
+ function on(e) {
1471
1496
  K &&= (e instanceof Document ? e.body.removeChild(K) : e.removeChild(K), void 0);
1472
1497
  }
1473
1498
  function q(e) {
1474
1499
  return Array.prototype.indexOf.call(e.parentElement.childNodes, e);
1475
1500
  }
1476
- function on(e) {
1501
+ function sn(e) {
1477
1502
  let t = e;
1478
1503
  for (; t && t.nodeName !== "TD" && t.nodeName !== "TH" && !t.classList.contains("tableWrapper");) {
1479
1504
  if (t.classList.contains("ProseMirror")) return;
@@ -1491,11 +1516,11 @@ function on(e) {
1491
1516
  tbodyNode: t.querySelector("tbody")
1492
1517
  };
1493
1518
  }
1494
- function sn(e, t) {
1519
+ function cn(e, t) {
1495
1520
  let n = t.querySelectorAll(e);
1496
1521
  for (let e = 0; e < n.length; e++) n[e].style.visibility = "hidden";
1497
1522
  }
1498
- var cn = class {
1523
+ var ln = class {
1499
1524
  editor;
1500
1525
  pmView;
1501
1526
  state;
@@ -1514,60 +1539,69 @@ var cn = class {
1514
1539
  viewMousedownHandler = () => {
1515
1540
  this.mouseState = "down";
1516
1541
  };
1542
+ hideHandles = () => {
1543
+ this.state?.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1544
+ };
1517
1545
  mouseUpHandler = (e) => {
1518
1546
  this.mouseState = "up", this.mouseMoveHandler(e);
1519
1547
  };
1520
1548
  mouseMoveHandler = (e) => {
1521
1549
  if (this.menuFrozen || this.mouseState === "selecting" || !(e.target instanceof Element) || !this.pmView.dom.contains(e.target)) return;
1522
- let t = on(e.target);
1550
+ let t = sn(e.target);
1523
1551
  if (t?.type === "cell" && this.mouseState === "down" && !this.state?.draggingState) {
1524
- this.mouseState = "selecting", this.state?.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1552
+ this.mouseState = "selecting", this.hideHandles();
1525
1553
  return;
1526
1554
  }
1527
1555
  if (!t || !this.editor.isEditable) {
1528
- this.state?.show && (this.state.show = !1, this.state.showAddOrRemoveRowsButton = !1, this.state.showAddOrRemoveColumnsButton = !1, this.emitUpdate());
1556
+ this.hideHandles();
1529
1557
  return;
1530
1558
  }
1531
1559
  if (!t.tbodyNode) return;
1532
- let n = t.tbodyNode.getBoundingClientRect(), r = ut(t.domNode, this.pmView);
1560
+ let n = t.tbodyNode.getBoundingClientRect(), r = ft(t.domNode, this.pmView);
1533
1561
  if (!r) return;
1534
- this.tableElement = r.node;
1535
- let i, { pmNodeInfo: a, doc: o } = this.editor.transact((e) => ({
1536
- pmNodeInfo: c(r.id, e.doc),
1562
+ let { pmNodeInfo: i, doc: a } = this.editor.transact((e) => ({
1563
+ pmNodeInfo: s(r.id, e.doc),
1537
1564
  doc: e.doc
1538
1565
  }));
1539
- if (!a) throw Error(`Block with ID ${r.id} not found`);
1540
- let s = u(a.node, o);
1541
- if (g(this.editor, "table") && (this.tablePos = a.posBeforeNode + 1, i = s), !i) return;
1542
- this.tableId = r.id;
1566
+ if (!i) {
1567
+ this.hideHandles();
1568
+ return;
1569
+ }
1570
+ let o = v(i.node, a);
1571
+ if (!g(o, this.editor, "table")) {
1572
+ this.hideHandles();
1573
+ return;
1574
+ }
1575
+ let c = o;
1576
+ this.tablePos = i.posBeforeNode + 1, this.tableElement = r.node, this.tableId = r.id;
1543
1577
  let l = t.domNode.closest(".tableWrapper")?.querySelector(".table-widgets-container");
1544
1578
  if (t?.type === "wrapper") {
1545
- let t = e.clientY >= n.bottom - 1 && e.clientY < n.bottom + 20, r = e.clientX >= n.right - 1 && e.clientX < n.right + 20, a = this.state?.block?.id !== i.id || e.clientX > n.right || e.clientY > n.bottom;
1579
+ let t = e.clientY >= n.bottom - 1 && e.clientY < n.bottom + 20, r = e.clientX >= n.right - 1 && e.clientX < n.right + 20, i = this.state?.block?.id !== c.id || e.clientX > n.right || e.clientY > n.bottom;
1546
1580
  this.state = {
1547
1581
  ...this.state,
1548
1582
  show: !0,
1549
1583
  showAddOrRemoveRowsButton: t,
1550
1584
  showAddOrRemoveColumnsButton: r,
1551
1585
  referencePosTable: n,
1552
- block: i,
1586
+ block: c,
1553
1587
  widgetContainer: l,
1554
- colIndex: a ? void 0 : this.state?.colIndex,
1555
- rowIndex: a ? void 0 : this.state?.rowIndex,
1556
- referencePosCell: a ? void 0 : this.state?.referencePosCell
1588
+ colIndex: i ? void 0 : this.state?.colIndex,
1589
+ rowIndex: i ? void 0 : this.state?.rowIndex,
1590
+ referencePosCell: i ? void 0 : this.state?.referencePosCell
1557
1591
  };
1558
1592
  } else {
1559
- let e = q(t.domNode), a = q(t.domNode.parentElement), o = t.domNode.getBoundingClientRect();
1560
- if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === a && this.state.colIndex === e) return;
1593
+ let e = q(t.domNode), i = q(t.domNode.parentElement), a = t.domNode.getBoundingClientRect();
1594
+ if (this.state !== void 0 && this.state.show && this.tableId === r.id && this.state.rowIndex === i && this.state.colIndex === e) return;
1561
1595
  this.state = {
1562
1596
  show: !0,
1563
- showAddOrRemoveColumnsButton: e === i.content.rows[0].cells.length - 1,
1564
- showAddOrRemoveRowsButton: a === i.content.rows.length - 1,
1597
+ showAddOrRemoveColumnsButton: e === c.content.rows[0].cells.length - 1,
1598
+ showAddOrRemoveRowsButton: i === c.content.rows.length - 1,
1565
1599
  referencePosTable: n,
1566
- block: i,
1600
+ block: c,
1567
1601
  draggingState: void 0,
1568
- referencePosCell: o,
1602
+ referencePosCell: a,
1569
1603
  colIndex: e,
1570
- rowIndex: a,
1604
+ rowIndex: i,
1571
1605
  widgetContainer: l
1572
1606
  };
1573
1607
  }
@@ -1575,7 +1609,7 @@ var cn = class {
1575
1609
  };
1576
1610
  dragOverHandler = (e) => {
1577
1611
  if (this.state?.draggingState === void 0) return;
1578
- e.preventDefault(), e.dataTransfer.dropEffect = "move", sn(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline", this.pmView.root);
1612
+ e.preventDefault(), e.dataTransfer.dropEffect = "move", cn(".prosemirror-dropcursor-block, .prosemirror-dropcursor-inline", this.pmView.root);
1579
1613
  let t = {
1580
1614
  left: Math.min(Math.max(e.clientX, this.state.referencePosTable.left + 1), this.state.referencePosTable.right - 1),
1581
1615
  top: Math.min(Math.max(e.clientY, this.state.referencePosTable.top + 1), this.state.referencePosTable.bottom - 1)
@@ -1586,16 +1620,16 @@ var cn = class {
1586
1620
  let l = this.state.draggingState.draggedCellOrientation === "row" ? t.top : t.left;
1587
1621
  this.state.draggingState.mousePos !== l && (this.state.draggingState.mousePos = l, i = !0), i && this.emitUpdate(), c && this.editor.transact((e) => e.setMeta(J, !0));
1588
1622
  };
1589
- dropHandler = (e) => {
1623
+ dropHandler = (t) => {
1590
1624
  if (this.mouseState = "up", this.state === void 0 || this.state.draggingState === void 0) return !1;
1591
1625
  if (this.state.rowIndex === void 0 || this.state.colIndex === void 0) throw Error("Attempted to drop table row or column, but no table block was hovered prior.");
1592
- e.preventDefault();
1593
- let { draggingState: t, colIndex: n, rowIndex: r } = this.state;
1626
+ t.preventDefault();
1627
+ let { draggingState: n, colIndex: r, rowIndex: i } = this.state;
1594
1628
  this.state.draggingState = void 0;
1595
1629
  let o = this.state.block.content.columnWidths;
1596
- if (t.draggedCellOrientation === "row") {
1597
- if (!i(this.state.block, t.originalIndex, r)) return !1;
1598
- let e = a(this.state.block, t.originalIndex, r);
1630
+ if (n.draggedCellOrientation === "row") {
1631
+ if (!f(this.state.block, n.originalIndex, i)) return !1;
1632
+ let e = ee(this.state.block, n.originalIndex, i);
1599
1633
  this.editor.updateBlock(this.state.block, {
1600
1634
  type: "table",
1601
1635
  content: {
@@ -1604,73 +1638,80 @@ var cn = class {
1604
1638
  }
1605
1639
  });
1606
1640
  } else {
1607
- if (!p(this.state.block, t.originalIndex, n)) return !1;
1608
- let e = ee(this.state.block, t.originalIndex, n), [r] = o.splice(t.originalIndex, 1);
1609
- o.splice(n, 0, r), this.editor.updateBlock(this.state.block, {
1641
+ if (!e(this.state.block, n.originalIndex, r)) return !1;
1642
+ let t = a(this.state.block, n.originalIndex, r), [i] = o.splice(n.originalIndex, 1);
1643
+ o.splice(r, 0, i), this.editor.updateBlock(this.state.block, {
1610
1644
  type: "table",
1611
1645
  content: {
1612
1646
  ...this.state.block.content,
1613
1647
  columnWidths: o,
1614
- rows: e
1648
+ rows: t
1615
1649
  }
1616
1650
  });
1617
1651
  }
1618
1652
  return this.editor.setTextCursorPosition(this.state.block.id), !0;
1619
1653
  };
1654
+ getTablePos(e) {
1655
+ if (this.tableId === void 0) return;
1656
+ let t = s(this.tableId, e);
1657
+ return t && t.posBeforeNode + 1;
1658
+ }
1620
1659
  update() {
1621
1660
  if (!this.state || !this.state.show) return;
1622
1661
  let e = this.editor.getBlock(this.state.block.id);
1623
1662
  if (!e || e.type !== "table" || !this.tableElement?.isConnected) {
1624
- this.state = void 0, this.tableId = void 0, this.tableElement = void 0, this.emitUpdate();
1663
+ this.state = void 0, this.tableId = void 0, this.tablePos = void 0, this.tableElement = void 0, this.emitUpdate();
1625
1664
  return;
1626
1665
  }
1627
- this.state.block = e;
1628
- let { height: t, width: n } = o(this.state.block);
1629
- this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= t && (this.state.rowIndex = t - 1), this.state.colIndex >= n && (this.state.colIndex = n - 1));
1630
- let r = this.tableElement.querySelector("tbody");
1631
- if (!r) throw Error("Table block does not contain a 'tbody' HTML element. This should never happen.");
1666
+ this.state.block = e, this.tablePos = this.getTablePos(this.pmView.state.doc);
1667
+ let { height: n, width: r } = t(this.state.block);
1668
+ this.state.rowIndex !== void 0 && this.state.colIndex !== void 0 && (this.state.rowIndex >= n && (this.state.rowIndex = n - 1), this.state.colIndex >= r && (this.state.colIndex = r - 1));
1669
+ let i = this.tableElement.querySelector("tbody");
1670
+ if (!i) throw Error("Table block does not contain a 'tbody' HTML element. This should never happen.");
1632
1671
  if (this.state.rowIndex !== void 0 && this.state.colIndex !== void 0) {
1633
- let e = r.children[this.state.rowIndex].children[this.state.colIndex];
1672
+ let e = i.children[this.state.rowIndex].children[this.state.colIndex];
1634
1673
  e ? this.state.referencePosCell = e.getBoundingClientRect() : (this.state.rowIndex = void 0, this.state.colIndex = void 0);
1635
1674
  }
1636
- this.state.referencePosTable = r.getBoundingClientRect(), this.emitUpdate();
1675
+ this.state.referencePosTable = i.getBoundingClientRect(), this.emitUpdate();
1637
1676
  }
1638
1677
  destroy() {
1639
1678
  this.pmView.dom.removeEventListener("mousemove", this.mouseMoveHandler), window.removeEventListener("mouseup", this.mouseUpHandler), this.pmView.dom.removeEventListener("mousedown", this.viewMousedownHandler), this.pmView.root.removeEventListener("dragover", this.dragOverHandler), this.pmView.root.removeEventListener("drop", this.dropHandler);
1640
1679
  }
1641
- }, J = new w("TableHandlesPlugin"), ln = b(({ editor: t }) => {
1642
- let n, a = y(void 0);
1680
+ }, J = new w("TableHandlesPlugin"), un = b(({ editor: t }) => {
1681
+ let n, i = y(void 0);
1643
1682
  return {
1644
1683
  key: "tableHandles",
1645
- store: a,
1684
+ store: i,
1646
1685
  prosemirrorPlugins: [new C({
1647
1686
  key: J,
1648
- view: (e) => (n = new cn(t, e, (e) => {
1649
- a.setState(e?.block ? {
1687
+ view: (e) => (n = new ln(t, e, (e) => {
1688
+ i.setState(e?.block ? {
1650
1689
  ...e,
1651
1690
  draggingState: e.draggingState ? { ...e.draggingState } : void 0
1652
1691
  } : void 0);
1653
1692
  }), n),
1654
- props: { decorations: (e) => {
1655
- if (n === void 0 || n.state === void 0 || n.state.draggingState === void 0 || n.tablePos === void 0) return;
1656
- let t = n.state.draggingState.draggedCellOrientation === "row" ? n.state.rowIndex : n.state.colIndex;
1657
- if (t === void 0) return;
1693
+ props: { decorations: (t) => {
1694
+ if (n === void 0 || n.state === void 0 || n.state.draggingState === void 0) return;
1695
+ let r = n.getTablePos(t.doc);
1696
+ if (r === void 0) return;
1697
+ let i = n.state.draggingState.draggedCellOrientation === "row" ? n.state.rowIndex : n.state.colIndex;
1698
+ if (i === void 0) return;
1658
1699
  let a = [], { block: o, draggingState: s } = n.state, { originalIndex: c, draggedCellOrientation: l } = s;
1659
- if (t === c || !o || l === "row" && !i(o, c, t) || l === "col" && !p(o, c, t)) return O.create(e.doc, a);
1660
- let u = e.doc.resolve(n.tablePos + 1);
1661
- return n.state.draggingState.draggedCellOrientation === "row" ? r(n.state.block, t).forEach(({ row: n, col: r }) => {
1662
- let i = e.doc.resolve(u.posAtIndex(n) + 1), o = e.doc.resolve(i.posAtIndex(r) + 1), s = o.node(), l = o.pos + (t > c ? s.nodeSize - 2 : 0);
1700
+ if (i === c || !o || l === "row" && !f(o, c, i) || l === "col" && !e(o, c, i)) return O.create(t.doc, a);
1701
+ let u = t.doc.resolve(r + 1);
1702
+ return n.state.draggingState.draggedCellOrientation === "row" ? p(n.state.block, i).forEach(({ row: e, col: n }) => {
1703
+ let r = t.doc.resolve(u.posAtIndex(e) + 1), o = t.doc.resolve(r.posAtIndex(n) + 1), s = o.node(), l = o.pos + (i > c ? s.nodeSize - 2 : 0);
1663
1704
  a.push(D.widget(l, () => {
1664
1705
  let e = document.createElement("div");
1665
- return e.className = "bn-table-drop-cursor", e.style.left = "0", e.style.right = "0", t > c ? e.style.bottom = "-2px" : e.style.top = "-3px", e.style.height = "4px", e;
1706
+ return e.className = "bn-table-drop-cursor", e.style.left = "0", e.style.right = "0", i > c ? e.style.bottom = "-2px" : e.style.top = "-3px", e.style.height = "4px", e;
1666
1707
  }));
1667
- }) : m(n.state.block, t).forEach(({ row: n, col: r }) => {
1668
- let i = e.doc.resolve(u.posAtIndex(n) + 1), o = e.doc.resolve(i.posAtIndex(r) + 1), s = o.node(), l = o.pos + (t > c ? s.nodeSize - 2 : 0);
1708
+ }) : d(n.state.block, i).forEach(({ row: e, col: n }) => {
1709
+ let r = t.doc.resolve(u.posAtIndex(e) + 1), o = t.doc.resolve(r.posAtIndex(n) + 1), s = o.node(), l = o.pos + (i > c ? s.nodeSize - 2 : 0);
1669
1710
  a.push(D.widget(l, () => {
1670
1711
  let e = document.createElement("div");
1671
- return e.className = "bn-table-drop-cursor", e.style.top = "0", e.style.bottom = "0", t > c ? e.style.right = "-2px" : e.style.left = "-3px", e.style.width = "4px", e;
1712
+ return e.className = "bn-table-drop-cursor", e.style.top = "0", e.style.bottom = "0", i > c ? e.style.right = "-2px" : e.style.left = "-3px", e.style.width = "4px", e;
1672
1713
  }));
1673
- }), O.create(e.doc, a);
1714
+ }), O.create(t.doc, a);
1674
1715
  } }
1675
1716
  })],
1676
1717
  colDragStart(e) {
@@ -1684,7 +1725,7 @@ var cn = class {
1684
1725
  originalIndex: n.state.colIndex,
1685
1726
  newIndex: n.state.colIndex,
1686
1727
  tablePos: n.tablePos
1687
- })), !t.headless && (rn(t.prosemirrorView.root), e.dataTransfer.setDragImage(K, 0, 0), e.dataTransfer.effectAllowed = "move");
1728
+ })), !t.headless && (an(t.prosemirrorView.root), e.dataTransfer.setDragImage(K, 0, 0), e.dataTransfer.effectAllowed = "move");
1688
1729
  },
1689
1730
  rowDragStart(e) {
1690
1731
  if (n.state === void 0 || n.state.rowIndex === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
@@ -1697,11 +1738,11 @@ var cn = class {
1697
1738
  originalIndex: n.state.rowIndex,
1698
1739
  newIndex: n.state.rowIndex,
1699
1740
  tablePos: n.tablePos
1700
- })), !t.headless && (rn(t.prosemirrorView.root), e.dataTransfer.setDragImage(K, 0, 0), e.dataTransfer.effectAllowed = "copyMove");
1741
+ })), !t.headless && (an(t.prosemirrorView.root), e.dataTransfer.setDragImage(K, 0, 0), e.dataTransfer.effectAllowed = "copyMove");
1701
1742
  },
1702
1743
  dragEnd() {
1703
1744
  if (n.state === void 0) throw Error("Attempted to drag table row, but no table block was hovered prior.");
1704
- n.state.draggingState = void 0, n.emitUpdate(), t.transact((e) => e.setMeta(J, null)), !t.headless && an(t.prosemirrorView.root);
1745
+ n.state.draggingState = void 0, n.emitUpdate(), t.transact((e) => e.setMeta(J, null)), !t.headless && on(t.prosemirrorView.root);
1705
1746
  },
1706
1747
  freezeHandles() {
1707
1748
  n.menuFrozen = !0;
@@ -1710,18 +1751,20 @@ var cn = class {
1710
1751
  n.menuFrozen = !1;
1711
1752
  },
1712
1753
  hideHandlesIfNotFrozen() {
1713
- !n.menuFrozen && n.state?.show && (n.state.show = !1, n.state.showAddOrRemoveRowsButton = !1, n.state.showAddOrRemoveColumnsButton = !1, n.emitUpdate());
1754
+ n.menuFrozen || n.hideHandles();
1714
1755
  },
1715
1756
  getCellsAtRowHandle(e, t) {
1716
- return r(e, t);
1757
+ return p(e, t);
1717
1758
  },
1718
1759
  getCellsAtColumnHandle(e, t) {
1719
- return m(e, t);
1760
+ return d(e, t);
1720
1761
  },
1721
1762
  setCellSelection(e, t, r = t) {
1722
1763
  if (!n) throw Error("Table handles view not initialized");
1723
- let i = e.doc.resolve(n.tablePos + 1), a = e.doc.resolve(i.posAtIndex(t.row) + 1), o = e.doc.resolve(a.posAtIndex(t.col)), s = e.doc.resolve(i.posAtIndex(r.row) + 1), c = e.doc.resolve(s.posAtIndex(r.col)), l = e.tr;
1724
- return l.setSelection(new me(o, c)), e.apply(l);
1764
+ let i = n.getTablePos(e.doc);
1765
+ if (i === void 0) throw Error("Attempted to select table cells, but the hovered table is no longer in the document.");
1766
+ let a = e.doc.resolve(i + 1), o = e.doc.resolve(a.posAtIndex(t.row) + 1), s = e.doc.resolve(o.posAtIndex(t.col)), c = e.doc.resolve(a.posAtIndex(r.row) + 1), l = e.doc.resolve(c.posAtIndex(r.col)), u = e.tr;
1767
+ return u.setSelection(new me(s, l)), e.apply(u);
1725
1768
  },
1726
1769
  addRowOrColumn(e, n) {
1727
1770
  t.exec((t, r) => {
@@ -1765,14 +1808,14 @@ var cn = class {
1765
1808
  getCellSelection() {
1766
1809
  return t.transact((e) => {
1767
1810
  let t = e.selection, n = t.$from, r = t.$to;
1768
- if (v(t)) {
1811
+ if (_(t)) {
1769
1812
  let { ranges: e } = t;
1770
1813
  e.forEach((e) => {
1771
1814
  n = e.$from.min(n ?? e.$from), r = e.$to.max(r ?? e.$to);
1772
1815
  });
1773
1816
  } else {
1774
1817
  let i = t.$from.pos - t.$from.parentOffset - 1, a = t.$to.pos - t.$to.parentOffset - 1;
1775
- if (i < 0 || a < 0 || (n = e.doc.resolve(i), r = e.doc.resolve(a), !h(n.parent) || !h(r.parent))) return;
1818
+ if (i < 0 || a < 0 || (n = e.doc.resolve(i), r = e.doc.resolve(a), !m(n.parent) || !m(r.parent))) return;
1776
1819
  }
1777
1820
  let i = e.doc.resolve(n.pos - n.parentOffset - 1), a = e.doc.resolve(r.pos - r.parentOffset - 1), o = e.doc.resolve(i.pos - i.parentOffset - 1), s = n.index(i.depth), c = i.index(o.depth), l = r.index(a.depth), u = a.index(o.depth), d = [];
1778
1821
  for (let e = c; e <= u; e++) for (let t = s; t <= l; t++) d.push({
@@ -1792,19 +1835,19 @@ var cn = class {
1792
1835
  };
1793
1836
  });
1794
1837
  },
1795
- getMergeDirection(n) {
1838
+ getMergeDirection(e) {
1796
1839
  return t.transact((t) => {
1797
- let r = v(t.selection) ? t.selection : void 0;
1798
- if (!r || !n || r.ranges.length <= 1) return;
1799
- let i = this.getCellSelection();
1800
- if (i) return e(i.from, i.to, n) ? "vertical" : "horizontal";
1840
+ let n = _(t.selection) ? t.selection : void 0;
1841
+ if (!n || !e || n.ranges.length <= 1) return;
1842
+ let r = this.getCellSelection();
1843
+ if (r) return ne(r.from, r.to, e) ? "vertical" : "horizontal";
1801
1844
  });
1802
1845
  },
1803
1846
  cropEmptyRowsOrColumns(e, t) {
1804
- return f(e, t);
1847
+ return r(e, t);
1805
1848
  },
1806
1849
  addRowsOrColumns(e, t, n) {
1807
- return ne(e, t, n);
1850
+ return l(e, t, n);
1808
1851
  }
1809
1852
  };
1810
1853
  }), Y = new w("trailingNode");
@@ -1812,7 +1855,7 @@ function X(e) {
1812
1855
  let t = e.lastChild, n = t?.firstChild;
1813
1856
  return t?.type.name !== "blockContainer" || n?.type.name !== "paragraph" || n.content.size !== 0;
1814
1857
  }
1815
- function un(e) {
1858
+ function dn(e) {
1816
1859
  if (!e.type.schema.nodes.column) {
1817
1860
  let t = e.lastChild;
1818
1861
  return t && X(t) ? [e.content.size - 1] : [];
@@ -1820,7 +1863,7 @@ function un(e) {
1820
1863
  let t = [];
1821
1864
  return e.descendants((e, n, r) => !e.isTextblock && ((e.type.name === "column" || e.type.name === "blockGroup" && r?.type.name === "doc") && X(e) && t.push(n + e.nodeSize - 1), !0)), t;
1822
1865
  }
1823
- var dn = b(({ editor: e }) => {
1866
+ var fn = b(({ editor: e }) => {
1824
1867
  function t(t) {
1825
1868
  return D.widget(t, () => {
1826
1869
  let t = document.createElement("div");
@@ -1837,7 +1880,7 @@ var dn = b(({ editor: e }) => {
1837
1880
  }, { side: 1 });
1838
1881
  }
1839
1882
  function n(e, n, r) {
1840
- let i = n.map(e.mapping, e.doc), a = new Set(r ? un(e.doc) : []), o = /* @__PURE__ */ new Set(), s = [];
1883
+ let i = n.map(e.mapping, e.doc), a = new Set(r ? dn(e.doc) : []), o = /* @__PURE__ */ new Set(), s = [];
1841
1884
  for (let e of i.find()) a.has(e.from) && !o.has(e.from) ? o.add(e.from) : s.push(e);
1842
1885
  let c = [...a].filter((e) => !o.has(e)), l = i;
1843
1886
  return s.length > 0 && (l = l.remove(s)), c.length > 0 && (l = l.add(e.doc, c.map(t))), l;
@@ -1878,7 +1921,7 @@ function $(e) {
1878
1921
  let t = typeof e == "object" ? e.id : e;
1879
1922
  throw Error(`Snapshot not found: ${String(t)}`);
1880
1923
  }
1881
- var fn = b(({ options: e, editor: t }) => {
1924
+ var pn = b(({ options: e, editor: t }) => {
1882
1925
  let { endpoints: n, preview: r, getCurrentDocument: i, serializeCurrentContent: a, resolveUsers: o } = typeof e == "function" ? e(t) : e, s = typeof n == "function" ? n(t) : n, c = re(o), l = y({
1883
1926
  snapshots: [],
1884
1927
  previewedSnapshotId: void 0,
@@ -1994,10 +2037,10 @@ var fn = b(({ options: e, editor: t }) => {
1994
2037
  });
1995
2038
  //#endregion
1996
2039
  //#region src/extensions/Versioning/inMemoryVersioning.ts
1997
- function pn(e) {
2040
+ function mn(e) {
1998
2041
  return e.id === Z ? "Current version" : e.name ?? "Unnamed version";
1999
2042
  }
2000
- function mn(e) {
2043
+ function hn(e) {
2001
2044
  let t, n = !1, r = (t) => {
2002
2045
  e.replaceBlocks(e.document, t);
2003
2046
  }, i = () => e.getExtension("diffVersioning");
@@ -2009,7 +2052,7 @@ function mn(e) {
2009
2052
  t === void 0 && (t = e.document);
2010
2053
  let l = i();
2011
2054
  if (o && l) {
2012
- l.renderDiff(a, o, c && pn(c.snapshot)), n = !0;
2055
+ l.renderDiff(a, o, c && mn(c.snapshot)), n = !0;
2013
2056
  return;
2014
2057
  }
2015
2058
  n = !1, r(a);
@@ -2026,7 +2069,7 @@ function mn(e) {
2026
2069
  }
2027
2070
  };
2028
2071
  }
2029
- function hn() {
2072
+ function gn() {
2030
2073
  let e = [], t = /* @__PURE__ */ new Map(), n = 1, r = 0;
2031
2074
  function i() {
2032
2075
  return r = Math.max(Date.now(), r + 1), r;
@@ -2073,8 +2116,8 @@ function hn() {
2073
2116
  }
2074
2117
  };
2075
2118
  }
2076
- function gn(e) {
2077
- let t = hn();
2119
+ function _n(e) {
2120
+ let t = gn();
2078
2121
  return {
2079
2122
  endpoints: {
2080
2123
  ...t,
@@ -2084,12 +2127,12 @@ function gn(e) {
2084
2127
  updatedAt: Date.now()
2085
2128
  }, ...await t.list()]
2086
2129
  },
2087
- preview: mn(e),
2130
+ preview: hn(e),
2088
2131
  getCurrentDocument: () => e.document,
2089
2132
  serializeCurrentContent: () => e.document
2090
2133
  };
2091
2134
  }
2092
2135
  //#endregion
2093
- export { Xe as A, st as C, tt as D, nt as E, k as F, Ye as M, He as N, et as O, Ve as P, lt as S, it as T, Wt as _, fn as a, It as b, ln as c, nn as d, en as f, Kt as g, qt as h, Z as i, Je as j, $e as k, cn as l, Jt as m, gn as n, Q as o, $t as p, hn as r, dn as s, mn as t, J as u, Gt as v, ot as w, B as x, Lt as y };
2136
+ export { Ze as A, ct as C, nt as D, rt as E, k as F, Xe as M, Ue as N, tt as O, He as P, dt as S, at as T, Gt as _, pn as a, Rt as b, un as c, rn as d, tn as f, qt as g, Jt as h, Z as i, Ye as j, et as k, ln as l, Yt as m, _n as n, Q as o, en as p, gn as r, fn as s, hn as t, J as u, Kt as v, st as w, z as x, B as y };
2094
2137
 
2095
- //# sourceMappingURL=extensions-DGuhtOgB.js.map
2138
+ //# sourceMappingURL=extensions-D6JcJCwd.js.map