@clevertask/scribe 0.1.28 → 0.1.29

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 (40) hide show
  1. package/dist/{BarMenu-BGWT4Oyk.js → BarMenu-BC8XoC6e.js} +1 -1
  2. package/dist/assets/index.css +1 -1
  3. package/dist/components/Menu/BarMenu.js +1 -1
  4. package/dist/components/Menu/BubbleMenu.js +2 -2
  5. package/dist/components/Menu/CalloutBubbleMenu.js +2 -2
  6. package/dist/components/Menu/LinkBubbleMenu.js +2 -2
  7. package/dist/components/Menu/Mobile/ListOptionBar.js +1 -1
  8. package/dist/components/Menu/TableBubbleMenu.js +3 -3
  9. package/dist/components/Menu/TableHeightSettings.js +1 -1
  10. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  11. package/dist/components/Scribe/extension/callout.js +7 -7
  12. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  13. package/dist/components/Scribe/extension/extension-link.js +1 -1
  14. package/dist/components/Scribe/extension/extension-markdown-paste.js +1 -1
  15. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  16. package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
  17. package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
  18. package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
  19. package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
  20. package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
  21. package/dist/components/Scribe/extension/index.js +1 -1
  22. package/dist/components/Scribe/extension/resizable-table.js +2 -2
  23. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  24. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  25. package/dist/components/Scribe/extension/table-layout.js +1 -1
  26. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  27. package/dist/components/Scribe/index.js +3 -3
  28. package/dist/{dist-BiognBi4.js → dist-B0xwy1Q5.js} +175 -154
  29. package/dist/{dist-Dk0fXvrc.js → dist-CDJRm4fL.js} +2 -2
  30. package/dist/{dist-xjmWZ-oh.js → dist-DnVcys79.js} +632 -571
  31. package/dist/document-node-capabilities.js +1 -1
  32. package/dist/{extension-BU2USLV1.js → extension-BPeoqfHR.js} +2 -2
  33. package/dist/{extension-link-DmM_EJTn.js → extension-link-RvaqaDqr.js} +319 -294
  34. package/dist/{menus-BDXjZsFU.js → menus-scgppp2C.js} +25 -25
  35. package/dist/{schema-extensions-DyCk1Goa.js → schema-extensions-ITR9LEgX.js} +2025 -1898
  36. package/dist/schema-extensions.js +1 -1
  37. package/dist/schema.js +1 -1
  38. package/dist/{table-layout-BoDS50DR.js → table-layout-iVolql5p.js} +179 -128
  39. package/dist/utils/index.js +2 -2
  40. package/package.json +51 -51
@@ -1,22 +1,23 @@
1
1
  import { AllSelection as e, EditorState as t, NodeSelection as n, Plugin as r, PluginKey as i, Selection as a, TextSelection as o } from "@tiptap/pm/state";
2
2
  import { RemoveMarkStep as s, ReplaceAroundStep as c, ReplaceStep as l, Transform as u, canJoin as d, canSplit as f, findWrapping as p, joinPoint as m, liftTarget as h } from "@tiptap/pm/transform";
3
- import { createParagraphNear as g, exitCode as _, joinBackward as ee, joinDown as v, joinForward as te, joinTextblockBackward as y, joinTextblockForward as ne, joinUp as re, lift as b, liftEmptyBlock as ie, newlineInCode as x, selectNodeBackward as ae, selectNodeForward as oe, selectParentNode as se, selectTextblockEnd as ce, selectTextblockStart as le, setBlockType as ue, wrapIn as de } from "@tiptap/pm/commands";
4
- import { DOMParser as fe, DOMSerializer as pe, Fragment as S, Schema as me, Slice as he } from "@tiptap/pm/model";
5
- import { liftListItem as ge, sinkListItem as _e, wrapInList as ve } from "@tiptap/pm/schema-list";
6
- import { DecorationSet as C, EditorView as ye } from "@tiptap/pm/view";
7
- import { keymap as be } from "@tiptap/pm/keymap";
8
- //#region node_modules/.pnpm/@tiptap+core@3.31.3_@tiptap+pm@3.31.3/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
9
- var xe = Object.defineProperty, Se = (e, t) => {
3
+ import { createParagraphNear as g, exitCode as _, joinBackward as v, joinDown as y, joinForward as b, joinTextblockBackward as x, joinTextblockForward as ee, joinUp as te, lift as S, liftEmptyBlock as ne, newlineInCode as C, selectNodeBackward as re, selectNodeForward as ie, selectParentNode as ae, selectTextblockEnd as oe, selectTextblockStart as se, setBlockType as ce, wrapIn as le } from "@tiptap/pm/commands";
4
+ import { DOMParser as ue, DOMSerializer as de, Fragment as w, Schema as fe, Slice as pe } from "@tiptap/pm/model";
5
+ import { liftListItem as me, sinkListItem as he, wrapInList as ge } from "@tiptap/pm/schema-list";
6
+ import { DecorationSet as T, EditorView as _e } from "@tiptap/pm/view";
7
+ import { keymap as ve } from "@tiptap/pm/keymap";
8
+ import { closeHistory as ye } from "@tiptap/pm/history";
9
+ //#region node_modules/.pnpm/@tiptap+core@3.31.4_@tiptap+pm@3.31.4/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js
10
+ var be = Object.defineProperty, xe = (e, t) => {
10
11
  let n = {};
11
- for (var r in e) xe(n, r, {
12
+ for (var r in e) be(n, r, {
12
13
  get: e[r],
13
14
  enumerable: !0
14
15
  });
15
- return t || xe(n, Symbol.toStringTag, { value: "Module" }), n;
16
+ return t || be(n, Symbol.toStringTag, { value: "Module" }), n;
16
17
  };
17
18
  //#endregion
18
- //#region node_modules/.pnpm/@tiptap+core@3.31.3_@tiptap+pm@3.31.3/node_modules/@tiptap/core/dist/index.js
19
- function w(e) {
19
+ //#region node_modules/.pnpm/@tiptap+core@3.31.4_@tiptap+pm@3.31.4/node_modules/@tiptap/core/dist/index.js
20
+ function E(e) {
20
21
  let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
21
22
  return {
22
23
  ...t,
@@ -40,7 +41,7 @@ function w(e) {
40
41
  }
41
42
  };
42
43
  }
43
- var T = class e {
44
+ var D = class e {
44
45
  constructor(e) {
45
46
  this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
46
47
  }
@@ -100,7 +101,7 @@ var T = class e {
100
101
  tr: e,
101
102
  editor: r,
102
103
  view: a,
103
- state: w({
104
+ state: E({
104
105
  state: i,
105
106
  transaction: e
106
107
  }),
@@ -113,12 +114,12 @@ var T = class e {
113
114
  };
114
115
  return o;
115
116
  }
116
- }, Ce = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
117
+ }, Se = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
117
118
  if (!e.isDestroyed) {
118
119
  var n;
119
120
  t.dom.blur(), (n = window) == null || (n = n.getSelection()) == null || n.removeAllRanges();
120
121
  }
121
- }), !0), we = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Te = () => ({ state: e, tr: t, dispatch: n }) => {
122
+ }), !0), Ce = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), we = () => ({ state: e, tr: t, dispatch: n }) => {
122
123
  let { selection: r } = t, { ranges: i } = r;
123
124
  return n && i.forEach(({ $from: n, $to: r }) => {
124
125
  e.doc.nodesBetween(n.pos, r.pos, (e, n) => {
@@ -133,12 +134,12 @@ var T = class e {
133
134
  (c || c === 0) && t.lift(s, c);
134
135
  });
135
136
  }), !0;
136
- }, Ee = (e) => (t) => e(t), De = () => ({ state: e, dispatch: t }) => g(e, t), Oe = (e, t) => ({ editor: n, tr: r }) => {
137
+ }, Te = (e) => (t) => e(t), Ee = () => ({ state: e, dispatch: t }) => g(e, t), De = (e, t) => ({ editor: n, tr: r }) => {
137
138
  let { state: i } = n, a = i.doc.slice(e.from, e.to);
138
139
  r.deleteRange(e.from, e.to);
139
140
  let s = r.mapping.map(t);
140
141
  return r.insert(s, a.content), r.setSelection(new o(r.doc.resolve(Math.max(s - 1, 0)))), !0;
141
- }, ke = () => ({ tr: e, dispatch: t }) => {
142
+ }, Oe = () => ({ tr: e, dispatch: t }) => {
142
143
  let { selection: n } = e, r = n.$anchor.node();
143
144
  if (r.content.size > 0) return !1;
144
145
  let i = e.selection.$anchor;
@@ -151,15 +152,15 @@ var T = class e {
151
152
  }
152
153
  return !1;
153
154
  };
154
- function E(e, t) {
155
+ function O(e, t) {
155
156
  if (typeof e == "string") {
156
157
  if (!t.nodes[e]) throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
157
158
  return t.nodes[e];
158
159
  }
159
160
  return e;
160
161
  }
161
- var Ae = (e) => ({ tr: t, state: n, dispatch: r }) => {
162
- let i = E(e, n.schema), a = t.selection.$anchor;
162
+ var ke = (e) => ({ tr: t, state: n, dispatch: r }) => {
163
+ let i = O(e, n.schema), a = t.selection.$anchor;
163
164
  for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
164
165
  if (r) {
165
166
  let n = a.before(e), r = a.after(e);
@@ -168,41 +169,41 @@ var Ae = (e) => ({ tr: t, state: n, dispatch: r }) => {
168
169
  return !0;
169
170
  }
170
171
  return !1;
171
- }, je = (e) => ({ tr: t, dispatch: n }) => {
172
+ }, Ae = (e) => ({ tr: t, dispatch: n }) => {
172
173
  let { from: r, to: i } = e;
173
174
  return n && t.delete(r, i), !0;
174
- }, Me = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Ne = (e, t, n) => {
175
+ }, je = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Me = (e, t, n) => {
175
176
  if (!e.parent.isInline || n === "left" && e.pos > e.start() || n === "right" && e.pos < e.end()) return e.pos;
176
177
  let r = t.nodes[e.parent.type.name].spec;
177
- return Me(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
178
- }, Pe = (e, t, n) => ({
179
- from: Ne(e, n, "left"),
180
- to: Ne(t, n, "right")
181
- }), Fe = () => ({ state: e, dispatch: t }) => {
178
+ return je(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
179
+ }, Ne = (e, t, n) => ({
180
+ from: Me(e, n, "left"),
181
+ to: Me(t, n, "right")
182
+ }), Pe = () => ({ state: e, dispatch: t }) => {
182
183
  if (e.selection.empty) return !1;
183
184
  if (t) {
184
185
  let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
185
186
  r.forEach((t) => {
186
- let r = n.mapping.slice(i), { from: a, to: o } = Pe(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
187
+ let r = n.mapping.slice(i), { from: a, to: o } = Ne(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
187
188
  n.deleteRange(a, o);
188
189
  }), n.selection.empty || n.setSelection(o.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
189
190
  }
190
191
  return !0;
191
- }, Ie = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Le = () => ({ state: e, dispatch: t }) => _(e, t);
192
- function Re(e) {
192
+ }, Fe = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Ie = () => ({ state: e, dispatch: t }) => _(e, t);
193
+ function Le(e) {
193
194
  return Object.prototype.toString.call(e) === "[object RegExp]";
194
195
  }
195
- function D(e, t, n = { strict: !0 }) {
196
+ function Re(e, t, n = { strict: !0 }) {
196
197
  let r = Object.keys(t);
197
- return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Re(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
198
+ return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Le(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
198
199
  }
199
200
  function ze(e, t, n = {}) {
200
- return e.find((e) => e.type === t && D(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
201
+ return e.find((e) => e.type === t && Re(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
201
202
  }
202
203
  function Be(e, t, n = {}) {
203
204
  return !!ze(e, t, n);
204
205
  }
205
- function O(e, t, n) {
206
+ function k(e, t, n) {
206
207
  if (!e || !t) return;
207
208
  let r = e.parent.childAfter(e.parentOffset);
208
209
  if ((!r.node || !r.node.marks.some((e) => e.type === t)) && (r = e.parent.childBefore(e.parentOffset)), !r.node || !r.node.marks.some((e) => e.type === t)) return;
@@ -219,7 +220,7 @@ function O(e, t, n) {
219
220
  to: s
220
221
  };
221
222
  }
222
- function k(e, t) {
223
+ function A(e, t) {
223
224
  if (typeof e == "string") {
224
225
  if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
225
226
  return t.marks[e];
@@ -227,9 +228,9 @@ function k(e, t) {
227
228
  return e;
228
229
  }
229
230
  var Ve = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
230
- let a = k(e, r.schema), { doc: s, selection: c } = n, { $from: l, from: u, to: d } = c;
231
+ let a = A(e, r.schema), { doc: s, selection: c } = n, { $from: l, from: u, to: d } = c;
231
232
  if (i) {
232
- let e = O(l, a, t);
233
+ let e = k(l, a, t);
233
234
  if (e && e.from <= u && e.to >= d) {
234
235
  let t = o.create(s, e.from, e.to);
235
236
  n.setSelection(t);
@@ -244,7 +245,7 @@ var Ve = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
244
245
  function Ue(e) {
245
246
  return e instanceof o;
246
247
  }
247
- function A(e = 0, t = 0, n = 0) {
248
+ function j(e = 0, t = 0, n = 0) {
248
249
  return Math.min(Math.max(e, t), n);
249
250
  }
250
251
  function We(e, t = null) {
@@ -253,12 +254,12 @@ function We(e, t = null) {
253
254
  if (t === "start" || t === !0) return n;
254
255
  if (t === "end") return r;
255
256
  let i = n.from, s = r.to;
256
- return t === "all" ? o.create(e, A(0, i, s), A(e.content.size, i, s)) : o.create(e, A(t, i, s), A(t, i, s));
257
+ return t === "all" ? o.create(e, j(0, i, s), j(e.content.size, i, s)) : o.create(e, j(t, i, s), j(t, i, s));
257
258
  }
258
- function Ge() {
259
+ function M() {
259
260
  return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
260
261
  }
261
- function j() {
262
+ function N() {
262
263
  return [
263
264
  "iPad Simulator",
264
265
  "iPhone Simulator",
@@ -268,16 +269,16 @@ function j() {
268
269
  "iPod"
269
270
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
270
271
  }
271
- function Ke() {
272
+ function Ge() {
272
273
  return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
273
274
  }
274
- var qe = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
275
+ var Ke = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
275
276
  t = {
276
277
  scrollIntoView: !0,
277
278
  ...t
278
279
  };
279
280
  let o = () => {
280
- (j() || Ge()) && r.dom.focus(), Ke() && !j() && !Ge() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
281
+ (N() || M()) && r.dom.focus(), Ge() && !N() && !M() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
281
282
  n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
282
283
  });
283
284
  };
@@ -289,30 +290,30 @@ var qe = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
289
290
  if (a && e === null && !Ue(n.state.selection)) return o(), !0;
290
291
  let s = We(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
291
292
  return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
292
- }, Je = (e, t) => (n) => e.every((e, r) => t(e, {
293
+ }, qe = (e, t) => (n) => e.every((e, r) => t(e, {
293
294
  ...n,
294
295
  index: r
295
- })), Ye = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
296
+ })), Je = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
296
297
  from: n.selection.from,
297
298
  to: n.selection.to
298
- }, e, t), Xe = (e) => {
299
+ }, e, t), Ye = (e) => {
299
300
  let t = e.childNodes;
300
301
  for (let n = t.length - 1; n >= 0; --n) {
301
302
  let r = t[n];
302
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Xe(r);
303
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ye(r);
303
304
  }
304
305
  return e;
305
306
  };
306
- function M(e) {
307
+ function P(e) {
307
308
  if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
308
309
  let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
309
- return Xe(n);
310
+ return Ye(n);
310
311
  }
311
- function Ze(e) {
312
+ function Xe(e) {
312
313
  return typeof e?.nodesBetween == "function";
313
314
  }
314
- function N(e, t, n) {
315
- if (Ze(e)) return e;
315
+ function F(e, t, n) {
316
+ if (Xe(e)) return e;
316
317
  let r = typeof e == "object" && !!e;
317
318
  n = {
318
319
  slice: !0,
@@ -321,16 +322,16 @@ function N(e, t, n) {
321
322
  };
322
323
  let i = typeof e == "string";
323
324
  if (r) try {
324
- if (Array.isArray(e) && e.length > 0) return S.fromArray(e.map((e) => t.nodeFromJSON(e)));
325
+ if (Array.isArray(e) && e.length > 0) return w.fromArray(e.map((e) => t.nodeFromJSON(e)));
325
326
  let r = t.nodeFromJSON(e);
326
327
  return n.errorOnInvalidContent && r.check(), r;
327
328
  } catch (r) {
328
329
  if (n.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: r });
329
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), N("", t, n);
330
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), F("", t, n);
330
331
  }
331
332
  if (i) {
332
333
  if (n.errorOnInvalidContent) {
333
- let r = !1, i = "", a = new me({
334
+ let r = !1, i = "", a = new fe({
334
335
  topNode: t.spec.topNode,
335
336
  marks: t.spec.marks,
336
337
  nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
@@ -342,17 +343,17 @@ function N(e, t, n) {
342
343
  }]
343
344
  } })
344
345
  });
345
- if (n.slice ? fe.fromSchema(a).parseSlice(M(e), n.parseOptions) : fe.fromSchema(a).parse(M(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
346
+ if (n.slice ? ue.fromSchema(a).parseSlice(P(e), n.parseOptions) : ue.fromSchema(a).parse(P(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
346
347
  }
347
- let r = fe.fromSchema(t);
348
- return n.slice ? r.parseSlice(M(e), n.parseOptions).content : r.parse(M(e), n.parseOptions);
348
+ let r = ue.fromSchema(t);
349
+ return n.slice ? r.parseSlice(P(e), n.parseOptions).content : r.parse(P(e), n.parseOptions);
349
350
  }
350
- return N("", t, n);
351
+ return F("", t, n);
351
352
  }
352
- function Qe(e) {
353
+ function Ze(e) {
353
354
  return !("type" in e);
354
355
  }
355
- function $e(e, t, n) {
356
+ function Qe(e, t, n) {
356
357
  let r = e.steps.length - 1;
357
358
  if (r < t) return;
358
359
  let i = e.steps[r];
@@ -362,7 +363,7 @@ function $e(e, t, n) {
362
363
  s === 0 && (s = r);
363
364
  }), e.setSelection(a.near(e.doc.resolve(s), n));
364
365
  }
365
- var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
366
+ var $e = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
366
367
  if (i) {
367
368
  n = {
368
369
  parseOptions: a.options.parseOptions,
@@ -384,7 +385,7 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
384
385
  ...n.parseOptions
385
386
  };
386
387
  if (!n.errorOnInvalidContent && !a.options.enableContentCheck && a.options.emitContentError) try {
387
- N(t, a.schema, {
388
+ F(t, a.schema, {
388
389
  parseOptions: s,
389
390
  errorOnInvalidContent: !0
390
391
  });
@@ -392,7 +393,7 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
392
393
  o(e);
393
394
  }
394
395
  try {
395
- i = N(t, a.schema, {
396
+ i = F(t, a.schema, {
396
397
  parseOptions: s,
397
398
  errorOnInvalidContent: n.errorOnInvalidContent ?? a.options.enableContentCheck
398
399
  });
@@ -405,7 +406,7 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
405
406
  } : {
406
407
  from: e.from,
407
408
  to: e.to
408
- }, u = !0, d = !0, f = Qe(i) ? i.content : [i];
409
+ }, u = !0, d = !0, f = Ze(i) ? i.content : [i];
409
410
  if (f.forEach((e) => {
410
411
  e.check(), u = u ? e.isText && e.marks.length === 0 : !1, d = d ? e.isBlock : !1;
411
412
  }), c === l && d) {
@@ -413,13 +414,13 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
413
414
  e.isTextblock && !e.type.spec.code && !e.childCount && (--c, l += 1);
414
415
  }
415
416
  let p;
416
- if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Ze(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
417
+ if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Xe(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
417
418
  else {
418
- p = S.from(f);
419
+ p = w.from(f);
419
420
  let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
420
421
  n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
421
422
  }
422
- n.updateSelection && $e(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
423
+ n.updateSelection && Qe(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
423
424
  from: c,
424
425
  text: p
425
426
  }), n.applyPasteRules && r.setMeta("applyPasteRules", {
@@ -429,39 +430,42 @@ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
429
430
  }
430
431
  return !0;
431
432
  };
432
- function tt(e) {
433
+ function et(e) {
433
434
  for (let t = 0; t < e.edgeCount; t += 1) {
434
435
  let { type: n } = e.edge(t);
435
436
  if (n.isTextblock && !n.hasRequiredAttrs()) return n;
436
437
  }
437
438
  return null;
438
439
  }
439
- var nt = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
440
+ var tt = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
440
441
  let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
441
442
  c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
442
- let l = tt(c.parent.contentMatchAt(c.index()));
443
+ let l = et(c.parent.contentMatchAt(c.index()));
443
444
  if (!l) return !1;
444
445
  let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
445
446
  if (o) {
446
- let e = N(o, r.schema);
447
+ let e = F(o, r.schema);
447
448
  f = l.createAndFill(d, e);
448
449
  } else f = l.createAndFill(d);
449
- return f ? (n && (t.insert(c.pos, f), s && $e(t, t.steps.length - 1, -1)), !0) : !1;
450
- }, rt = () => ({ state: e, dispatch: t }) => re(e, t), it = () => ({ state: e, dispatch: t }) => v(e, t), at = () => ({ state: e, dispatch: t }) => ee(e, t), ot = () => ({ state: e, dispatch: t }) => te(e, t), st = () => ({ state: e, dispatch: t, tr: n }) => {
450
+ return f ? (n && (t.insert(c.pos, f), s && Qe(t, t.steps.length - 1, -1)), !0) : !1;
451
+ }, nt = () => ({ state: e, dispatch: t }) => te(e, t), rt = () => ({ state: e, dispatch: t }) => y(e, t), it = () => ({ state: e, dispatch: t }) => v(e, t), at = () => ({ state: e, dispatch: t }) => b(e, t), ot = (e, t) => {
452
+ let n = e.resolve(t), r = n.nodeBefore, i = n.nodeAfter;
453
+ return !r || !i ? !1 : !r.type.spec.isolating && !i.type.spec.isolating;
454
+ }, st = () => ({ state: e, dispatch: t, tr: n }) => {
451
455
  try {
452
456
  let r = m(e.doc, e.selection.$from.pos, -1);
453
- return r != null && (n.join(r, 2), t && t(n), !0);
457
+ return r == null || !ot(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
454
458
  } catch {
455
459
  return !1;
456
460
  }
457
461
  }, ct = () => ({ state: e, dispatch: t, tr: n }) => {
458
462
  try {
459
463
  let r = m(e.doc, e.selection.$from.pos, 1);
460
- return r != null && (n.join(r, 2), t && t(n), !0);
464
+ return r == null || !ot(e.doc, r) ? !1 : (n.join(r, 2), t && t(n), !0);
461
465
  } catch {
462
466
  return !1;
463
467
  }
464
- }, lt = () => ({ state: e, dispatch: t }) => y(e, t), ut = () => ({ state: e, dispatch: t }) => ne(e, t);
468
+ }, lt = () => ({ state: e, dispatch: t }) => x(e, t), ut = () => ({ state: e, dispatch: t }) => ee(e, t);
465
469
  function dt() {
466
470
  return typeof navigator < "u" && /Mac/.test(navigator.platform);
467
471
  }
@@ -475,7 +479,7 @@ function ft(e) {
475
479
  else if (/^a(lt)?$/i.test(n)) r = !0;
476
480
  else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
477
481
  else if (/^s(hift)?$/i.test(n)) a = !0;
478
- else if (/^mod$/i.test(n)) j() || dt() ? o = !0 : i = !0;
482
+ else if (/^mod$/i.test(n)) N() || dt() ? o = !0 : i = !0;
479
483
  else throw Error(`Unrecognized modifier name: ${n}`);
480
484
  }
481
485
  return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
@@ -502,8 +506,8 @@ var pt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
502
506
  t && i && r.maybeStep(t);
503
507
  }), !0;
504
508
  };
505
- function P(e, t, n = {}) {
506
- let { from: r, to: i, empty: a } = e.selection, o = t ? E(t, e.schema) : null, s = [];
509
+ function I(e, t, n = {}) {
510
+ let { from: r, to: i, empty: a } = e.selection, o = t ? O(t, e.schema) : null, s = [];
507
511
  e.doc.nodesBetween(r, i, (e, t) => {
508
512
  if (e.isText) return;
509
513
  let n = Math.max(r, t), a = Math.min(i, t + e.nodeSize);
@@ -513,14 +517,14 @@ function P(e, t, n = {}) {
513
517
  to: a
514
518
  });
515
519
  });
516
- let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => D(e.node.attrs, n, { strict: !1 }));
520
+ let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => Re(e.node.attrs, n, { strict: !1 }));
517
521
  return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
518
522
  }
519
- var mt = (e, t = {}) => ({ state: n, dispatch: r }) => P(n, E(e, n.schema), t) ? b(n, r) : !1, ht = () => ({ state: e, dispatch: t }) => ie(e, t), gt = (e) => ({ state: t, dispatch: n }) => {
520
- let r = E(e, t.schema);
521
- return ge(r)(t, n);
522
- }, _t = () => ({ state: e, dispatch: t }) => x(e, t);
523
- function F(e, t) {
523
+ var mt = (e, t = {}) => ({ state: n, dispatch: r }) => I(n, O(e, n.schema), t) ? S(n, r) : !1, ht = () => ({ state: e, dispatch: t }) => ne(e, t), gt = (e) => ({ state: t, dispatch: n }) => {
524
+ let r = O(e, t.schema);
525
+ return me(r)(t, n);
526
+ }, _t = () => ({ state: e, dispatch: t }) => C(e, t);
527
+ function L(e, t) {
524
528
  return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
525
529
  }
526
530
  function vt(e, t) {
@@ -528,9 +532,9 @@ function vt(e, t) {
528
532
  return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
529
533
  }
530
534
  var yt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
531
- let a = null, o = null, s = F(typeof e == "string" ? e : e.name, r.schema);
535
+ let a = null, o = null, s = L(typeof e == "string" ? e : e.name, r.schema);
532
536
  if (!s) return !1;
533
- s === "node" && (a = E(e, r.schema)), s === "mark" && (o = k(e, r.schema));
537
+ s === "node" && (a = O(e, r.schema)), s === "mark" && (o = A(e, r.schema));
534
538
  let c = !1;
535
539
  return n.selection.ranges.forEach((e) => {
536
540
  r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
@@ -545,9 +549,9 @@ var yt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
545
549
  t.setSelection(n);
546
550
  }
547
551
  return !0;
548
- }, St = () => ({ state: e, dispatch: t }) => ae(e, t), Ct = () => ({ state: e, dispatch: t }) => oe(e, t), wt = () => ({ state: e, dispatch: t }) => se(e, t), Tt = () => ({ state: e, dispatch: t }) => ce(e, t), Et = () => ({ state: e, dispatch: t }) => le(e, t);
552
+ }, St = () => ({ state: e, dispatch: t }) => re(e, t), Ct = () => ({ state: e, dispatch: t }) => ie(e, t), wt = () => ({ state: e, dispatch: t }) => ae(e, t), Tt = () => ({ state: e, dispatch: t }) => oe(e, t), Et = () => ({ state: e, dispatch: t }) => se(e, t);
549
553
  function Dt(e, t, n = {}, r = {}) {
550
- return N(e, t, {
554
+ return F(e, t, {
551
555
  slice: !1,
552
556
  parseOptions: n,
553
557
  errorOnInvalidContent: r.errorOnInvalidContent
@@ -558,7 +562,7 @@ var Ot = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
558
562
  if (r.preserveWhitespace !== "full") {
559
563
  let s = Dt(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
560
564
  if (o) {
561
- let e = Qe(s) ? s.content : [s];
565
+ let e = Ze(s) ? s.content : [s];
562
566
  a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
563
567
  }
564
568
  return !0;
@@ -572,7 +576,7 @@ var Ot = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
572
576
  });
573
577
  };
574
578
  function kt(e, t) {
575
- let n = k(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
579
+ let n = A(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
576
580
  a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
577
581
  o.push(...e.marks);
578
582
  });
@@ -607,18 +611,18 @@ function Mt(e, t) {
607
611
  };
608
612
  }
609
613
  }
610
- function I(e) {
614
+ function R(e) {
611
615
  return (t) => Mt(t.$from, e);
612
616
  }
613
- function L(e, t, n) {
614
- return e.config[t] === void 0 && e.parent ? L(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
617
+ function z(e, t, n) {
618
+ return e.config[t] === void 0 && e.parent ? z(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
615
619
  ...n,
616
- parent: e.parent ? L(e.parent, t, n) : null
620
+ parent: e.parent ? z(e.parent, t, n) : null
617
621
  }) : e.config[t];
618
622
  }
619
623
  function Nt(e) {
620
624
  return e.map((e) => {
621
- let t = L(e, "addExtensions", {
625
+ let t = z(e, "addExtensions", {
622
626
  name: e.name,
623
627
  options: e.options,
624
628
  storage: e.storage
@@ -627,19 +631,19 @@ function Nt(e) {
627
631
  }).flat(10);
628
632
  }
629
633
  function Pt(e, t) {
630
- let n = pe.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
634
+ let n = de.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
631
635
  return r.appendChild(n), r.innerHTML;
632
636
  }
633
637
  function Ft(e) {
634
638
  return typeof e == "function";
635
639
  }
636
- function R(e, t = void 0, ...n) {
640
+ function B(e, t = void 0, ...n) {
637
641
  return Ft(e) ? t ? e.bind(t)(...n) : e(...n) : e;
638
642
  }
639
643
  function It(e = {}) {
640
644
  return Object.keys(e).length === 0 && e.constructor === Object;
641
645
  }
642
- function z(e) {
646
+ function V(e) {
643
647
  return {
644
648
  baseExtensions: e.filter((e) => e.type === "extension"),
645
649
  nodeExtensions: e.filter((e) => e.type === "node"),
@@ -647,7 +651,7 @@ function z(e) {
647
651
  };
648
652
  }
649
653
  function Lt(e) {
650
- let t = [], { nodeExtensions: n, markExtensions: r } = z(e), i = [...n, ...r], a = {
654
+ let t = [], { nodeExtensions: n, markExtensions: r } = V(e), i = [...n, ...r], a = {
651
655
  default: null,
652
656
  validate: void 0,
653
657
  rendered: !0,
@@ -657,7 +661,7 @@ function Lt(e) {
657
661
  isRequired: !1
658
662
  }, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
659
663
  return e.forEach((e) => {
660
- let n = L(e, "addGlobalAttributes", {
664
+ let n = z(e, "addGlobalAttributes", {
661
665
  name: e.name,
662
666
  options: e.options,
663
667
  storage: e.storage,
@@ -679,7 +683,7 @@ function Lt(e) {
679
683
  });
680
684
  });
681
685
  }), i.forEach((e) => {
682
- let n = L(e, "addAttributes", {
686
+ let n = z(e, "addAttributes", {
683
687
  name: e.name,
684
688
  options: e.options,
685
689
  storage: e.storage
@@ -766,7 +770,7 @@ function Bt(...e) {
766
770
  }), n;
767
771
  }, {});
768
772
  }
769
- function B(e, t) {
773
+ function H(e, t) {
770
774
  return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => Bt(e, t), {});
771
775
  }
772
776
  function Vt(e) {
@@ -801,7 +805,7 @@ function Wt(e) {
801
805
  return !(e != null && (t = e.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), (e == null || (n = e.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
802
806
  }
803
807
  function Gt(e, t) {
804
- let n = Lt(e), { nodeExtensions: r, markExtensions: i } = z(e), a = r.find((e) => L(e, "topNode"))?.name, o = Object.fromEntries(r.map((r) => {
808
+ let n = Lt(e), { nodeExtensions: r, markExtensions: i } = V(e), a = r.find((e) => z(e, "topNode"))?.name, o = Object.fromEntries(r.map((r) => {
805
809
  let i = n.filter((e) => e.type === r.name), a = {
806
810
  name: r.name,
807
811
  options: r.options,
@@ -809,33 +813,33 @@ function Gt(e, t) {
809
813
  editor: t
810
814
  }, o = Ut({
811
815
  ...e.reduce((e, t) => {
812
- let n = L(t, "extendNodeSchema", a);
816
+ let n = z(t, "extendNodeSchema", a);
813
817
  return {
814
818
  ...e,
815
819
  ...n ? n(r) : {}
816
820
  };
817
821
  }, {}),
818
- content: R(L(r, "content", a)),
819
- marks: R(L(r, "marks", a)),
820
- group: R(L(r, "group", a)),
821
- inline: R(L(r, "inline", a)),
822
- atom: R(L(r, "atom", a)),
823
- selectable: R(L(r, "selectable", a)),
824
- draggable: R(L(r, "draggable", a)),
825
- code: R(L(r, "code", a)),
826
- whitespace: R(L(r, "whitespace", a)),
827
- linebreakReplacement: R(L(r, "linebreakReplacement", a)),
828
- defining: R(L(r, "defining", a)),
829
- isolating: R(L(r, "isolating", a)),
822
+ content: B(z(r, "content", a)),
823
+ marks: B(z(r, "marks", a)),
824
+ group: B(z(r, "group", a)),
825
+ inline: B(z(r, "inline", a)),
826
+ atom: B(z(r, "atom", a)),
827
+ selectable: B(z(r, "selectable", a)),
828
+ draggable: B(z(r, "draggable", a)),
829
+ code: B(z(r, "code", a)),
830
+ whitespace: B(z(r, "whitespace", a)),
831
+ linebreakReplacement: B(z(r, "linebreakReplacement", a)),
832
+ defining: B(z(r, "defining", a)),
833
+ isolating: B(z(r, "isolating", a)),
830
834
  attrs: Object.fromEntries(i.map(Wt))
831
- }), s = R(L(r, "parseHTML", a));
835
+ }), s = B(z(r, "parseHTML", a));
832
836
  s && (o.parseDOM = s.map((e) => Ht(e, i)));
833
- let c = L(r, "renderHTML", a);
837
+ let c = z(r, "renderHTML", a);
834
838
  c && (o.toDOM = (e) => c({
835
839
  node: e,
836
- HTMLAttributes: B(e, i)
840
+ HTMLAttributes: H(e, i)
837
841
  }));
838
- let l = L(r, "renderText", a);
842
+ let l = z(r, "renderText", a);
839
843
  return l && (o.toText = l), [r.name, o];
840
844
  })), s = Object.fromEntries(i.map((r) => {
841
845
  let i = n.filter((e) => e.type === r.name), a = {
@@ -845,27 +849,27 @@ function Gt(e, t) {
845
849
  editor: t
846
850
  }, o = Ut({
847
851
  ...e.reduce((e, t) => {
848
- let n = L(t, "extendMarkSchema", a);
852
+ let n = z(t, "extendMarkSchema", a);
849
853
  return {
850
854
  ...e,
851
855
  ...n ? n(r) : {}
852
856
  };
853
857
  }, {}),
854
- inclusive: R(L(r, "inclusive", a)),
855
- excludes: R(L(r, "excludes", a)),
856
- group: R(L(r, "group", a)),
857
- spanning: R(L(r, "spanning", a)),
858
- code: R(L(r, "code", a)),
858
+ inclusive: B(z(r, "inclusive", a)),
859
+ excludes: B(z(r, "excludes", a)),
860
+ group: B(z(r, "group", a)),
861
+ spanning: B(z(r, "spanning", a)),
862
+ code: B(z(r, "code", a)),
859
863
  attrs: Object.fromEntries(i.map(Wt))
860
- }), s = R(L(r, "parseHTML", a));
864
+ }), s = B(z(r, "parseHTML", a));
861
865
  s && (o.parseDOM = s.map((e) => Ht(e, i)));
862
- let c = L(r, "renderHTML", a);
866
+ let c = z(r, "renderHTML", a);
863
867
  return c && (o.toDOM = (e) => c({
864
868
  mark: e,
865
- HTMLAttributes: B(e, i)
869
+ HTMLAttributes: H(e, i)
866
870
  })), [r.name, o];
867
871
  }));
868
- return new me({
872
+ return new fe({
869
873
  topNode: a,
870
874
  nodes: o,
871
875
  marks: s
@@ -875,14 +879,14 @@ function Kt(e) {
875
879
  let t = e.filter((t, n) => e.indexOf(t) !== n);
876
880
  return Array.from(new Set(t));
877
881
  }
878
- function V(e) {
882
+ function U(e) {
879
883
  return e.sort((e, t) => {
880
- let n = L(e, "priority") || 100, r = L(t, "priority") || 100;
884
+ let n = z(e, "priority") || 100, r = z(t, "priority") || 100;
881
885
  return n > r ? -1 : +(n < r);
882
886
  });
883
887
  }
884
888
  function qt(e) {
885
- let t = V(Nt(e)), n = Kt(t.map((e) => e.name));
889
+ let t = U(Nt(e)), n = Kt(t.map((e) => e.name));
886
890
  return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
887
891
  }
888
892
  function Jt(e, t, n) {
@@ -913,7 +917,7 @@ function Xt(e) {
913
917
  return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
914
918
  }
915
919
  function Zt(e, t) {
916
- let n = E(t, e.schema), { from: r, to: i } = e.selection, a = [];
920
+ let n = O(t, e.schema), { from: r, to: i } = e.selection, a = [];
917
921
  e.doc.nodesBetween(r, i, (e) => {
918
922
  a.push(e);
919
923
  });
@@ -921,7 +925,7 @@ function Zt(e, t) {
921
925
  return o ? { ...o.attrs } : {};
922
926
  }
923
927
  function Qt(e, t) {
924
- let n = F(typeof t == "string" ? t : t.name, e.schema);
928
+ let n = L(typeof t == "string" ? t : t.name, e.schema);
925
929
  return n === "node" ? Zt(e, t) : n === "mark" ? kt(e, t) : {};
926
930
  }
927
931
  function $t(e, t = JSON.stringify) {
@@ -968,10 +972,10 @@ function tn(e) {
968
972
  });
969
973
  }), en(r);
970
974
  }
971
- function H(e, t, n) {
975
+ function nn(e, t, n) {
972
976
  let r = [];
973
977
  return e === t ? n.resolve(e).marks().forEach((t) => {
974
- let i = O(n.resolve(e), t.type);
978
+ let i = k(n.resolve(e), t.type);
975
979
  i && r.push({
976
980
  mark: t,
977
981
  ...i
@@ -984,29 +988,29 @@ function H(e, t, n) {
984
988
  })));
985
989
  }), r;
986
990
  }
987
- var nn = (e, t, n, r = 20) => {
991
+ var rn = (e, t, n, r = 20) => {
988
992
  let i = e.doc.resolve(n), a = r, o = null;
989
993
  for (; a > 0 && o === null;) {
990
994
  let e = i.node(a);
991
995
  e?.type.name === t ? o = e : --a;
992
996
  }
993
997
  return [o, a];
994
- }, rn = (e) => {
998
+ }, an = (e) => {
995
999
  let t = e.depth - 1;
996
1000
  if (t < 0) return null;
997
1001
  let n = e.index(t);
998
1002
  return n === 0 ? null : e.node(t).child(n - 1);
999
1003
  };
1000
- function U(e, t) {
1004
+ function W(e, t) {
1001
1005
  return t.nodes[e] || t.marks[e] || null;
1002
1006
  }
1003
- function W(e, t, n) {
1007
+ function G(e, t, n) {
1004
1008
  return Object.fromEntries(Object.entries(n).filter(([n]) => {
1005
1009
  let r = e.find((e) => e.type === t && e.name === n);
1006
1010
  return r ? r.attribute.keepOnSplit : !1;
1007
1011
  }));
1008
1012
  }
1009
- var an = (e, t = 500) => {
1013
+ var on = (e, t = 500) => {
1010
1014
  let n = "", r = e.parentOffset;
1011
1015
  return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
1012
1016
  var o;
@@ -1019,9 +1023,9 @@ var an = (e, t = 500) => {
1019
1023
  n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
1020
1024
  }), n;
1021
1025
  };
1022
- function on(e, t, n = {}) {
1023
- let { empty: r, ranges: i } = e.selection, a = t ? k(t, e.schema) : null;
1024
- if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => D(e.attrs, n, { strict: !1 }));
1026
+ function sn(e, t, n = {}) {
1027
+ let { empty: r, ranges: i } = e.selection, a = t ? A(t, e.schema) : null;
1028
+ if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => Re(e.attrs, n, { strict: !1 }));
1025
1029
  let o = 0, s = [];
1026
1030
  if (i.forEach(({ $from: t, $to: n }) => {
1027
1031
  let r = t.pos, i = n.pos;
@@ -1036,41 +1040,41 @@ function on(e, t, n = {}) {
1036
1040
  })));
1037
1041
  });
1038
1042
  }), o === 0) return !1;
1039
- let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => D(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
1043
+ let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => Re(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
1040
1044
  return (c > 0 ? c + l : c) >= o;
1041
1045
  }
1042
- function sn(e, t, n = {}) {
1043
- if (!t) return P(e, null, n) || on(e, null, n);
1044
- let r = F(t, e.schema);
1045
- return r === "node" ? P(e, t, n) : r === "mark" && on(e, t, n);
1046
+ function cn(e, t, n = {}) {
1047
+ if (!t) return I(e, null, n) || sn(e, null, n);
1048
+ let r = L(t, e.schema);
1049
+ return r === "node" ? I(e, t, n) : r === "mark" && sn(e, t, n);
1046
1050
  }
1047
- var cn = (e, t) => {
1051
+ var ln = (e, t) => {
1048
1052
  let { $from: n, $to: r, $anchor: i } = e.selection;
1049
1053
  if (t) {
1050
- let n = I((e) => e.type.name === t)(e.selection);
1054
+ let n = R((e) => e.type.name === t)(e.selection);
1051
1055
  if (!n) return !1;
1052
1056
  let r = e.doc.resolve(n.pos + 1);
1053
1057
  return i.pos + 1 === r.end();
1054
1058
  }
1055
1059
  return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1056
- }, ln = (e) => {
1060
+ }, un = (e) => {
1057
1061
  let { $from: t, $to: n } = e.selection;
1058
1062
  return !(t.parentOffset > 0 || t.pos !== n.pos);
1059
1063
  };
1060
- function un(e, t) {
1064
+ function dn(e, t) {
1061
1065
  return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
1062
1066
  }
1063
- function dn(e, t) {
1064
- let { nodeExtensions: n } = z(t), r = n.find((t) => t.name === e);
1067
+ function fn(e, t) {
1068
+ let { nodeExtensions: n } = V(t), r = n.find((t) => t.name === e);
1065
1069
  if (!r) return !1;
1066
- let i = R(L(r, "group", {
1070
+ let i = B(z(r, "group", {
1067
1071
  name: r.name,
1068
1072
  options: r.options,
1069
1073
  storage: r.storage
1070
1074
  }));
1071
1075
  return typeof i == "string" && i.split(" ").includes("list");
1072
1076
  }
1073
- function G(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1077
+ function K(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1074
1078
  if (n) {
1075
1079
  if (e.type.name === "hardBreak") return !0;
1076
1080
  if (e.isText) return !/\S/.test(e.text ?? "");
@@ -1081,7 +1085,7 @@ function G(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1081
1085
  if (t) {
1082
1086
  let r = !0;
1083
1087
  return e.content.forEach((e) => {
1084
- r !== !1 && (G(e, {
1088
+ r !== !1 && (K(e, {
1085
1089
  ignoreWhitespace: n,
1086
1090
  checkChildren: t
1087
1091
  }) || (r = !1));
@@ -1089,10 +1093,10 @@ function G(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1089
1093
  }
1090
1094
  return !1;
1091
1095
  }
1092
- function fn(e) {
1096
+ function pn(e) {
1093
1097
  return e instanceof n;
1094
1098
  }
1095
- var pn = class e {
1099
+ var mn = class e {
1096
1100
  constructor(e) {
1097
1101
  this.position = e;
1098
1102
  }
@@ -1103,18 +1107,18 @@ var pn = class e {
1103
1107
  return { position: this.position };
1104
1108
  }
1105
1109
  };
1106
- function mn(e, t) {
1110
+ function hn(e, t) {
1107
1111
  let n = t.mapping.mapResult(e.position);
1108
1112
  return {
1109
- position: new pn(n.pos),
1113
+ position: new mn(n.pos),
1110
1114
  mapResult: n
1111
1115
  };
1112
1116
  }
1113
- function hn(e) {
1114
- return new pn(e);
1117
+ function gn(e) {
1118
+ return new mn(e);
1115
1119
  }
1116
- function gn(e, t, n) {
1117
- let r = e.state.doc.content.size, i = A(t, 0, r), a = A(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
1120
+ function _n(e, t, n) {
1121
+ let r = e.state.doc.content.size, i = j(t, 0, r), a = j(n, 0, r), o = e.coordsAtPos(i), s = e.coordsAtPos(a, -1), c = Math.min(o.top, s.top), l = Math.max(o.bottom, s.bottom), u = Math.min(o.left, s.left), d = Math.max(o.right, s.right), f = {
1118
1122
  top: c,
1119
1123
  bottom: l,
1120
1124
  left: u,
@@ -1129,7 +1133,7 @@ function gn(e, t, n) {
1129
1133
  toJSON: () => f
1130
1134
  };
1131
1135
  }
1132
- function _n(e, t, n) {
1136
+ function vn(e, t, n) {
1133
1137
  let { selection: r } = t, i = null;
1134
1138
  if (Ue(r) && (i = r.$cursor), i) {
1135
1139
  let t = e.storedMarks ?? i.marks();
@@ -1148,8 +1152,8 @@ function _n(e, t, n) {
1148
1152
  }), i;
1149
1153
  });
1150
1154
  }
1151
- var vn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1152
- let { selection: a } = n, { empty: o, ranges: s } = a, c = k(e, r.schema);
1155
+ var yn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1156
+ let { selection: a } = n, { empty: o, ranges: s } = a, c = A(e, r.schema);
1153
1157
  if (i) {
1154
1158
  if (o) {
1155
1159
  let e = kt(r, c);
@@ -1170,23 +1174,23 @@ var vn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1170
1174
  });
1171
1175
  });
1172
1176
  }
1173
- return _n(r, n, c);
1174
- }, yn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), bn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
1175
- let a = E(e, n.schema), o;
1176
- return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => ue(a, {
1177
+ return vn(r, n, c);
1178
+ }, bn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), xn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
1179
+ let a = O(e, n.schema), o;
1180
+ return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => ce(a, {
1177
1181
  ...o,
1178
1182
  ...t
1179
- })(n) ? !0 : e.clearNodes()).command(({ state: e }) => ue(a, {
1183
+ })(n) ? !0 : e.clearNodes()).command(({ state: e }) => ce(a, {
1180
1184
  ...o,
1181
1185
  ...t
1182
1186
  })(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
1183
- }, xn = (e) => ({ tr: t, dispatch: r }) => {
1187
+ }, Sn = (e) => ({ tr: t, dispatch: r }) => {
1184
1188
  if (r) {
1185
- let { doc: r } = t, i = A(e, 0, r.content.size), a = n.create(r, i);
1189
+ let { doc: r } = t, i = j(e, 0, r.content.size), a = n.create(r, i);
1186
1190
  t.setSelection(a);
1187
1191
  }
1188
1192
  return !0;
1189
- }, Sn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
1193
+ }, Cn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
1190
1194
  let { selection: a } = r, o, s;
1191
1195
  return typeof t == "number" ? (o = t, s = t) : t && "from" in t && "to" in t ? (o = t.from, s = t.to) : (o = a.from, s = a.to), i && n.doc.nodesBetween(o, s, (t, r) => {
1192
1196
  t.isText || n.setNodeMarkup(r, void 0, {
@@ -1194,47 +1198,53 @@ var vn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1194
1198
  dir: e
1195
1199
  });
1196
1200
  }), !0;
1197
- }, Cn = (e) => ({ tr: t, dispatch: n }) => {
1201
+ }, wn = (e) => ({ tr: t, dispatch: n }) => {
1198
1202
  if (n) {
1199
1203
  let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
1200
1204
  from: e,
1201
1205
  to: e
1202
- } : e, a = o.atStart(n).from, s = o.atEnd(n).to, c = A(r, a, s), l = A(i, a, s), u = o.create(n, c, l);
1206
+ } : e, a = o.atStart(n).from, s = o.atEnd(n).to, c = j(r, a, s), l = j(i, a, s), u = o.create(n, c, l);
1203
1207
  t.setSelection(u);
1204
1208
  }
1205
1209
  return !0;
1206
- }, wn = (e) => ({ state: t, dispatch: n }) => {
1207
- let r = E(e, t.schema);
1208
- return _e(r)(t, n);
1210
+ }, Tn = (e) => ({ state: t, dispatch: n }) => {
1211
+ let r = O(e, t.schema);
1212
+ return he(r)(t, n);
1209
1213
  };
1210
- function Tn(e, t) {
1214
+ function En(e, t) {
1211
1215
  let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1212
1216
  if (n) {
1213
1217
  let r = n.filter((e) => t?.includes(e.type.name));
1214
1218
  e.tr.ensureMarks(r);
1215
1219
  }
1216
1220
  }
1217
- var En = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: r, dispatch: i, editor: a }) => {
1218
- let { selection: s, doc: c } = t, { $from: l, $to: u } = s, d = a.extensionManager.attributes, p = W(d, l.node().type.name, l.node().attrs);
1219
- if (s instanceof n && s.node.isBlock) return !l.parentOffset || !f(c, l.pos) ? !1 : (i && (e && Tn(r, a.extensionManager.splittableMarks), t.split(l.pos).scrollIntoView()), !0);
1220
- if (!l.parent.isBlock) return !1;
1221
- let m = u.parentOffset === u.parent.content.size, h = l.depth === 0 ? void 0 : tt(l.node(-1).contentMatchAt(l.indexAfter(-1))), g = m && h ? [{
1222
- type: h,
1223
- attrs: p
1224
- }] : void 0, _ = f(t.doc, t.mapping.map(l.pos), 1, g);
1225
- if (!g && !_ && f(t.doc, t.mapping.map(l.pos), 1, h ? [{ type: h }] : void 0) && (_ = !0, g = h ? [{
1226
- type: h,
1227
- attrs: p
1228
- }] : void 0), i) {
1229
- if (_ && (s instanceof o && t.deleteSelection(), t.split(t.mapping.map(l.pos), 1, g), h && !m && !l.parentOffset && l.parent.type !== h)) {
1230
- let e = t.mapping.map(l.before()), n = t.doc.resolve(e);
1231
- l.node(-1).canReplaceWith(n.index(), n.index() + 1, h) && t.setNodeMarkup(t.mapping.map(l.before()), h);
1221
+ var Dn = ({ keepMarks: e = !0 } = {}) => ({ tr: r, state: i, dispatch: a, editor: s }) => {
1222
+ let { selection: c, doc: l } = r, { $from: u, $to: d } = c, p = s.extensionManager.attributes, m = G(p, u.node().type.name, u.node().attrs);
1223
+ if (c instanceof n && c.node.isBlock) return !u.parentOffset || !f(l, u.pos) ? !1 : (a && (e && En(i, s.extensionManager.splittableMarks), r.split(u.pos).scrollIntoView()), !0);
1224
+ if (!u.parent.isBlock) return !1;
1225
+ let h = d.parentOffset === d.parent.content.size, g = u.depth === 0 ? void 0 : et(u.node(-1).contentMatchAt(u.indexAfter(-1))), _ = h && g ? [{
1226
+ type: g,
1227
+ attrs: m
1228
+ }] : void 0, v = c instanceof o && !c.empty ? t.create({
1229
+ doc: r.doc,
1230
+ selection: c
1231
+ }).tr.deleteSelection() : null, y = v ? v.doc : r.doc, b = v ? v.mapping.map(u.pos) : u.pos, x = f(y, b, 1, _);
1232
+ if (!_ && !x && f(y, b, 1, g ? [{ type: g }] : void 0) && (x = !0, _ = g ? [{
1233
+ type: g,
1234
+ attrs: m
1235
+ }] : void 0), a) {
1236
+ if (x) {
1237
+ let e = r.steps.length;
1238
+ if (c instanceof o && r.deleteSelection(), r.split(r.mapping.slice(e).map(u.pos), 1, _), g && !h && !u.parentOffset && u.parent.type !== g) {
1239
+ let t = r.mapping.slice(e).map(u.before()), n = r.doc.resolve(t);
1240
+ u.node(-1).canReplaceWith(n.index(), n.index() + 1, g) && r.setNodeMarkup(r.mapping.slice(e).map(u.before()), g);
1241
+ }
1232
1242
  }
1233
- e && Tn(r, a.extensionManager.splittableMarks), t.scrollIntoView();
1243
+ e && En(i, s.extensionManager.splittableMarks), r.scrollIntoView();
1234
1244
  }
1235
- return _;
1236
- }, Dn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
1237
- let s = E(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
1245
+ return x;
1246
+ }, On = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: a }) => {
1247
+ let s = O(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
1238
1248
  if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
1239
1249
  let d = c.node(-1);
1240
1250
  if (d.type !== s) return !1;
@@ -1242,15 +1252,15 @@ var En = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: r, dispatch: i, editor
1242
1252
  if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
1243
1253
  if (c.depth === 2 || c.node(-3).type !== s || c.index(-2) !== c.node(-2).childCount - 1) return !1;
1244
1254
  if (i) {
1245
- let e = S.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1246
- for (let t = c.depth - r; t >= c.depth - 3; --t) e = S.from(c.node(t).copy(e));
1255
+ let e = w.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1256
+ for (let t = c.depth - r; t >= c.depth - 3; --t) e = w.from(c.node(t).copy(e));
1247
1257
  let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
1248
- ...W(p, c.node().type.name, c.node().attrs),
1258
+ ...G(p, c.node().type.name, c.node().attrs),
1249
1259
  ...t
1250
1260
  }, l = s.contentMatch.defaultType?.createAndFill(a) || void 0;
1251
- e = e.append(S.from(s.createAndFill(null, l) || void 0));
1261
+ e = e.append(w.from(s.createAndFill(null, l) || void 0));
1252
1262
  let u = c.before(c.depth - (r - 1));
1253
- n.replace(u, c.after(-i), new he(e, 4 - r, 0));
1263
+ n.replace(u, c.after(-i), new pe(e, 4 - r, 0));
1254
1264
  let d = -1;
1255
1265
  n.doc.nodesBetween(u, n.doc.content.size, (e, t) => {
1256
1266
  if (d > -1) return !1;
@@ -1260,91 +1270,91 @@ var En = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: r, dispatch: i, editor
1260
1270
  return !0;
1261
1271
  }
1262
1272
  let m = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, h = {
1263
- ...W(p, d.type.name, d.attrs),
1273
+ ...G(p, d.type.name, d.attrs),
1264
1274
  ...t
1265
1275
  }, g = {
1266
- ...W(p, c.node().type.name, c.node().attrs),
1276
+ ...G(p, c.node().type.name, c.node().attrs),
1267
1277
  ...t
1268
- };
1278
+ }, _ = c.parentOffset === 0 && c.index(-1) === 0, v = c.before(-1);
1269
1279
  n.delete(c.pos, l.pos);
1270
- let _ = m ? [{
1280
+ let y = _ ? d.attrs : h, b = m ? [{
1271
1281
  type: s,
1272
- attrs: h
1282
+ attrs: y
1273
1283
  }, {
1274
1284
  type: m,
1275
1285
  attrs: g
1276
1286
  }] : [{
1277
1287
  type: s,
1278
- attrs: h
1288
+ attrs: y
1279
1289
  }];
1280
1290
  if (!f(n.doc, c.pos, 2)) return !1;
1281
1291
  if (i) {
1282
1292
  let { selection: e, storedMarks: t } = r, { splittableMarks: o } = a.extensionManager, s = t || e.$to.parentOffset && e.$from.marks();
1283
- if (n.split(c.pos, 2, _).scrollIntoView(), !s || !i) return !0;
1293
+ if (n.split(c.pos, 2, b).scrollIntoView(), _ && n.setNodeMarkup(v, void 0, h), !s || !i) return !0;
1284
1294
  let l = s.filter((e) => o.includes(e.type.name));
1285
1295
  n.ensureMarks(l);
1286
1296
  }
1287
1297
  return !0;
1288
1298
  };
1289
- function On(e) {
1299
+ function kn(e) {
1290
1300
  return !e || e === "1" ? null : e;
1291
1301
  }
1292
- function kn(e, t) {
1293
- return On(e) === On(t);
1302
+ function An(e, t) {
1303
+ return kn(e) === kn(t);
1294
1304
  }
1295
- var An = (e, t) => {
1296
- let n = I((e) => e.type === t)(e.selection);
1305
+ var jn = (e, t) => {
1306
+ let n = R((e) => e.type === t)(e.selection);
1297
1307
  if (!n) return !0;
1298
1308
  let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1299
1309
  if (r === void 0) return !0;
1300
1310
  let i = e.doc.nodeAt(r);
1301
- return !(n.node.type === i?.type && d(e.doc, n.pos)) || !kn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
1302
- }, jn = (e, t) => {
1303
- let n = I((e) => e.type === t)(e.selection);
1311
+ return !(n.node.type === i?.type && d(e.doc, n.pos)) || !An(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
1312
+ }, Mn = (e, t) => {
1313
+ let n = R((e) => e.type === t)(e.selection);
1304
1314
  if (!n) return !0;
1305
1315
  let r = e.doc.resolve(n.start).after(n.depth);
1306
1316
  if (r === void 0) return !0;
1307
1317
  let i = e.doc.nodeAt(r);
1308
- return !(n.node.type === i?.type && d(e.doc, r)) || !kn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
1318
+ return !(n.node.type === i?.type && d(e.doc, r)) || !An(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
1309
1319
  };
1310
- function Mn(e) {
1320
+ function Nn(e) {
1311
1321
  let t = e.doc, n = t.firstChild;
1312
1322
  if (!n) return null;
1313
1323
  let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
1314
1324
  return o.between(r, i);
1315
1325
  }
1316
- var Nn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
1317
- let { extensions: d, splittableMarks: f } = i.extensionManager, p = E(e, o.schema), m = E(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: ee } = h, v = _.blockRange(ee), te = g || h.$to.parentOffset && h.$from.marks();
1318
- if (!v) return !1;
1319
- let y = I((e) => dn(e.type.name, d))(h), ne = h.from === 0 && h.to === o.doc.content.size, re = o.doc.content.content, b = re.length === 1 ? re[0] : null, ie = ne && b && dn(b.type.name, d) ? {
1320
- node: b,
1326
+ var Pn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
1327
+ let { extensions: d, splittableMarks: f } = i.extensionManager, p = O(e, o.schema), m = O(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: v } = h, y = _.blockRange(v), b = g || h.$to.parentOffset && h.$from.marks();
1328
+ if (!y) return !1;
1329
+ let x = R((e) => fn(e.type.name, d))(h), ee = h.from === 0 && h.to === o.doc.content.size, te = o.doc.content.content, S = te.length === 1 ? te[0] : null, ne = ee && S && fn(S.type.name, d) ? {
1330
+ node: S,
1321
1331
  pos: 0,
1322
1332
  depth: 0
1323
- } : null, x = y ?? ie, ae = !!y && v.depth >= 1 && v.depth - y.depth <= 1, oe = !!ie;
1324
- if ((ae || oe) && x) {
1325
- if (x.node.type === p) return ne && oe ? c().command(({ tr: e, dispatch: t }) => {
1326
- let n = Mn(e);
1333
+ } : null, C = x ?? ne, re = !!x && y.depth >= 1 && y.depth - x.depth <= 1, ie = !!ne;
1334
+ if ((re || ie) && C) {
1335
+ if (C.node.type === p) return ee && ie ? c().command(({ tr: e, dispatch: t }) => {
1336
+ let n = Nn(e);
1327
1337
  return n ? (e.setSelection(n), t && t(e), !0) : !1;
1328
1338
  }).liftListItem(m).run() : l.liftListItem(m);
1329
- if (dn(x.node.type.name, d) && p.validContent(x.node.content)) return c().command(() => (a.setNodeMarkup(x.pos, p), !0)).command(() => An(a, p)).command(() => jn(a, p)).run();
1339
+ if (fn(C.node.type.name, d) && p.validContent(C.node.content)) return c().command(() => (a.setNodeMarkup(C.pos, p), !0)).command(() => jn(a, p)).command(() => Mn(a, p)).run();
1330
1340
  }
1331
- return !n || !te || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => An(a, p)).command(() => jn(a, p)).run() : c().command(() => {
1332
- let e = u().wrapInList(p, r), t = te.filter((e) => f.includes(e.type.name));
1341
+ return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => jn(a, p)).command(() => Mn(a, p)).run() : c().command(() => {
1342
+ let e = u().wrapInList(p, r), t = b.filter((e) => f.includes(e.type.name));
1333
1343
  return a.ensureMarks(t), e ? !0 : l.clearNodes();
1334
- }).wrapInList(p, r).command(() => An(a, p)).command(() => jn(a, p)).run();
1335
- }, Pn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
1336
- let { extendEmptyMarkRange: a = !1 } = n, o = k(e, r.schema);
1337
- return on(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
1338
- }, Fn = (e, t, n = {}) => ({ state: r, commands: i }) => {
1339
- let a = E(e, r.schema), o = E(t, r.schema), s = P(r, a, n), c;
1344
+ }).wrapInList(p, r).command(() => jn(a, p)).command(() => Mn(a, p)).run();
1345
+ }, Fn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
1346
+ let { extendEmptyMarkRange: a = !1 } = n, o = A(e, r.schema);
1347
+ return sn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
1348
+ }, In = (e, t, n = {}) => ({ state: r, commands: i }) => {
1349
+ let a = O(e, r.schema), o = O(t, r.schema), s = I(r, a, n), c;
1340
1350
  return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
1341
1351
  ...c,
1342
1352
  ...n
1343
1353
  });
1344
- }, In = (e, t = {}) => ({ state: n, commands: r }) => {
1345
- let i = E(e, n.schema);
1346
- return P(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
1347
- }, Ln = () => ({ state: e, dispatch: t }) => {
1354
+ }, Ln = (e, t = {}) => ({ state: n, commands: r }) => {
1355
+ let i = O(e, n.schema);
1356
+ return I(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
1357
+ }, Rn = () => ({ state: e, dispatch: t }) => {
1348
1358
  let n = e.plugins;
1349
1359
  for (let r = 0; r < n.length; r += 1) {
1350
1360
  let i = n[r], a;
@@ -1361,7 +1371,7 @@ var Nn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1361
1371
  }
1362
1372
  }
1363
1373
  return !1;
1364
- }, Rn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
1374
+ }, zn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
1365
1375
  let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
1366
1376
  if (o) return !0;
1367
1377
  let { nonClearableMarks: c } = r.extensionManager;
@@ -1372,27 +1382,27 @@ var Nn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1372
1382
  });
1373
1383
  }
1374
1384
  return !0;
1375
- }, zn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1376
- let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = k(e, r.schema), { $from: c, empty: l, ranges: u } = o;
1385
+ }, Bn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1386
+ let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = A(e, r.schema), { $from: c, empty: l, ranges: u } = o;
1377
1387
  if (!i) return !0;
1378
1388
  if (l && a) {
1379
- let { from: e, to: t } = o, r = O(c, s, c.marks().find((e) => e.type === s)?.attrs);
1389
+ let { from: e, to: t } = o, r = k(c, s, c.marks().find((e) => e.type === s)?.attrs);
1380
1390
  r && (e = r.from, t = r.to), n.removeMark(e, t, s);
1381
1391
  } else u.forEach((e) => {
1382
1392
  n.removeMark(e.$from.pos, e.$to.pos, s);
1383
1393
  });
1384
1394
  return n.removeStoredMark(s), !0;
1385
- }, Bn = (e) => ({ tr: t, state: n, dispatch: r }) => {
1395
+ }, Vn = (e) => ({ tr: t, state: n, dispatch: r }) => {
1386
1396
  let { selection: i } = n, a, o;
1387
1397
  return typeof e == "number" ? (a = e, o = e) : e && "from" in e && "to" in e ? (a = e.from, o = e.to) : (a = i.from, o = i.to), r && t.doc.nodesBetween(a, o, (e, n) => {
1388
1398
  if (e.isText) return;
1389
1399
  let r = { ...e.attrs };
1390
1400
  delete r.dir, t.setNodeMarkup(n, void 0, r);
1391
1401
  }), !0;
1392
- }, Vn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1393
- let a = null, o = null, s = F(typeof e == "string" ? e : e.name, r.schema);
1402
+ }, Hn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1403
+ let a = null, o = null, s = L(typeof e == "string" ? e : e.name, r.schema);
1394
1404
  if (!s) return !1;
1395
- s === "node" && (a = E(e, r.schema)), s === "mark" && (o = k(e, r.schema));
1405
+ s === "node" && (a = O(e, r.schema)), s === "mark" && (o = A(e, r.schema));
1396
1406
  let c = !1;
1397
1407
  return n.selection.ranges.forEach((e) => {
1398
1408
  let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
@@ -1421,43 +1431,43 @@ var Nn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1421
1431
  }));
1422
1432
  }));
1423
1433
  }), c;
1424
- }, K = new i("__tiptap_decorations__"), Hn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(K, {
1434
+ }, q = new i("__tiptap_decorations__"), Un = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(q, {
1425
1435
  type: "force",
1426
1436
  name: e
1427
- }), !0), Un = (e, t = {}) => ({ state: n, dispatch: r }) => {
1428
- let i = E(e, n.schema);
1429
- return de(i, t)(n, r);
1430
- }, Wn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1431
- let i = E(e, n.schema);
1432
- return ve(i, t)(n, r);
1433
- }, Gn = /* @__PURE__ */ Se({
1434
- blur: () => Ce,
1435
- clearContent: () => we,
1436
- clearNodes: () => Te,
1437
- command: () => Ee,
1438
- createParagraphNear: () => De,
1439
- cut: () => Oe,
1440
- deleteCurrentNode: () => ke,
1441
- deleteNode: () => Ae,
1442
- deleteRange: () => je,
1443
- deleteSelection: () => Fe,
1444
- enter: () => Ie,
1445
- exitCode: () => Le,
1437
+ }), !0), Wn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1438
+ let i = O(e, n.schema);
1439
+ return le(i, t)(n, r);
1440
+ }, Gn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1441
+ let i = O(e, n.schema);
1442
+ return ge(i, t)(n, r);
1443
+ }, Kn = /* @__PURE__ */ xe({
1444
+ blur: () => Se,
1445
+ clearContent: () => Ce,
1446
+ clearNodes: () => we,
1447
+ command: () => Te,
1448
+ createParagraphNear: () => Ee,
1449
+ cut: () => De,
1450
+ deleteCurrentNode: () => Oe,
1451
+ deleteNode: () => ke,
1452
+ deleteRange: () => Ae,
1453
+ deleteSelection: () => Pe,
1454
+ enter: () => Fe,
1455
+ exitCode: () => Ie,
1446
1456
  extendMarkRange: () => Ve,
1447
1457
  first: () => He,
1448
- focus: () => qe,
1449
- forEach: () => Je,
1450
- insertContent: () => Ye,
1451
- insertContentAt: () => et,
1452
- insertDefaultBlock: () => nt,
1453
- joinBackward: () => at,
1454
- joinDown: () => it,
1455
- joinForward: () => ot,
1458
+ focus: () => Ke,
1459
+ forEach: () => qe,
1460
+ insertContent: () => Je,
1461
+ insertContentAt: () => $e,
1462
+ insertDefaultBlock: () => tt,
1463
+ joinBackward: () => it,
1464
+ joinDown: () => rt,
1465
+ joinForward: () => at,
1456
1466
  joinItemBackward: () => st,
1457
1467
  joinItemForward: () => ct,
1458
1468
  joinTextblockBackward: () => lt,
1459
1469
  joinTextblockForward: () => ut,
1460
- joinUp: () => rt,
1470
+ joinUp: () => nt,
1461
1471
  keyboardShortcut: () => pt,
1462
1472
  lift: () => mt,
1463
1473
  liftEmptyBlock: () => ht,
@@ -1472,41 +1482,41 @@ var Nn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1472
1482
  selectTextblockEnd: () => Tt,
1473
1483
  selectTextblockStart: () => Et,
1474
1484
  setContent: () => Ot,
1475
- setMark: () => vn,
1476
- setMeta: () => yn,
1477
- setNode: () => bn,
1478
- setNodeSelection: () => xn,
1479
- setTextDirection: () => Sn,
1480
- setTextSelection: () => Cn,
1481
- sinkListItem: () => wn,
1482
- splitBlock: () => En,
1483
- splitListItem: () => Dn,
1484
- toggleList: () => Nn,
1485
- toggleMark: () => Pn,
1486
- toggleNode: () => Fn,
1487
- toggleWrap: () => In,
1488
- undoInputRule: () => Ln,
1489
- unsetAllMarks: () => Rn,
1490
- unsetMark: () => zn,
1491
- unsetTextDirection: () => Bn,
1492
- updateAttributes: () => Vn,
1493
- updateDecorations: () => Hn,
1494
- wrapIn: () => Un,
1495
- wrapInList: () => Wn
1496
- }), q = /* @__PURE__ */ new WeakMap();
1497
- function Kn(e, t) {
1498
- q.set(e, (q.get(e) ?? 0) + 1);
1485
+ setMark: () => yn,
1486
+ setMeta: () => bn,
1487
+ setNode: () => xn,
1488
+ setNodeSelection: () => Sn,
1489
+ setTextDirection: () => Cn,
1490
+ setTextSelection: () => wn,
1491
+ sinkListItem: () => Tn,
1492
+ splitBlock: () => Dn,
1493
+ splitListItem: () => On,
1494
+ toggleList: () => Pn,
1495
+ toggleMark: () => Fn,
1496
+ toggleNode: () => In,
1497
+ toggleWrap: () => Ln,
1498
+ undoInputRule: () => Rn,
1499
+ unsetAllMarks: () => zn,
1500
+ unsetMark: () => Bn,
1501
+ unsetTextDirection: () => Vn,
1502
+ updateAttributes: () => Hn,
1503
+ updateDecorations: () => Un,
1504
+ wrapIn: () => Wn,
1505
+ wrapInList: () => Gn
1506
+ }), J = /* @__PURE__ */ new WeakMap();
1507
+ function qn(e, t) {
1508
+ J.set(e, (J.get(e) ?? 0) + 1);
1499
1509
  try {
1500
1510
  return t();
1501
1511
  } finally {
1502
- let t = (q.get(e) ?? 1) - 1;
1503
- t > 0 ? q.set(e, t) : q.delete(e);
1512
+ let t = (J.get(e) ?? 1) - 1;
1513
+ t > 0 ? J.set(e, t) : J.delete(e);
1504
1514
  }
1505
1515
  }
1506
- function qn(e) {
1507
- return q.has(e);
1516
+ function Jn(e) {
1517
+ return J.has(e);
1508
1518
  }
1509
- var Jn = class {
1519
+ var Yn = class {
1510
1520
  constructor() {
1511
1521
  this.callbacks = {};
1512
1522
  }
@@ -1530,44 +1540,44 @@ var Jn = class {
1530
1540
  removeAllListeners() {
1531
1541
  this.callbacks = {};
1532
1542
  }
1533
- }, Yn = typeof process < "u" && process.env.NODE_ENV !== "production";
1534
- function Xn(e) {
1543
+ }, Xn = typeof process < "u" && process.env.NODE_ENV !== "production";
1544
+ function Zn(e) {
1535
1545
  return e.kind === "widget";
1536
1546
  }
1537
- function Zn(e, t) {
1547
+ function Qn(e, t) {
1538
1548
  let n = [], r = /* @__PURE__ */ new Set();
1539
- for (let i of e) i.kind === "widget" && Xn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
1549
+ for (let i of e) i.kind === "widget" && Zn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
1540
1550
  return {
1541
1551
  decorations: n,
1542
1552
  widgetKeys: r
1543
1553
  };
1544
1554
  }
1545
- function Qn(e, t, n) {
1546
- let { decorations: r, widgetKeys: i } = Zn(t, n);
1555
+ function $n(e, t, n) {
1556
+ let { decorations: r, widgetKeys: i } = Qn(t, n);
1547
1557
  return {
1548
- set: C.create(e, r),
1558
+ set: T.create(e, r),
1549
1559
  widgetKeys: i
1550
1560
  };
1551
1561
  }
1552
- function $n({ position: e, from: t, to: n, docSize: r }) {
1562
+ function er({ position: e, from: t, to: n, docSize: r }) {
1553
1563
  return e < t ? !1 : e < n || e === n && n === r;
1554
1564
  }
1555
- function er({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
1556
- return e.filter((e) => $n({
1565
+ function tr({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
1566
+ return e.filter((e) => er({
1557
1567
  position: e.anchor,
1558
1568
  from: t,
1559
1569
  to: n,
1560
1570
  docSize: r
1561
1571
  }) ? !0 : (e.anchor === n || a.has(i) || (a.add(i), console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)), !1));
1562
1572
  }
1563
- function tr(e) {
1573
+ function nr(e) {
1564
1574
  let t = e.spec?.key;
1565
1575
  return typeof t == "string" ? t : void 0;
1566
1576
  }
1567
- function nr(e) {
1577
+ function rr(e) {
1568
1578
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1569
1579
  for (let r of e.find()) {
1570
- let e = tr(r);
1580
+ let e = nr(r);
1571
1581
  if (!e) continue;
1572
1582
  let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
1573
1583
  a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
@@ -1577,18 +1587,18 @@ function nr(e) {
1577
1587
  extensions: t
1578
1588
  })).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
1579
1589
  }
1580
- function rr(e) {
1590
+ function ir(e) {
1581
1591
  return e.jsonID === "attr";
1582
1592
  }
1583
- function ir(e) {
1593
+ function ar(e) {
1584
1594
  let t = !1;
1585
1595
  if (e.getMap().forEach(() => {
1586
1596
  t = !0;
1587
- }), t || rr(e)) return !0;
1597
+ }), t || ir(e)) return !0;
1588
1598
  let n = e;
1589
1599
  return typeof n.from == "number" && typeof n.to == "number";
1590
1600
  }
1591
- function ar(e, t) {
1601
+ function or(e, t) {
1592
1602
  let n = null, r = 0, i = 0;
1593
1603
  for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
1594
1604
  let o = i + e.child(a).nodeSize;
@@ -1599,11 +1609,11 @@ function ar(e, t) {
1599
1609
  to: r
1600
1610
  };
1601
1611
  }
1602
- function or(e, t) {
1603
- if (e.steps.some((e) => !ir(e))) return { type: "full" };
1612
+ function sr(e, t) {
1613
+ if (e.steps.some((e) => !ar(e))) return { type: "full" };
1604
1614
  let n = tn(e).map(({ newRange: e }) => e);
1605
1615
  e.steps.forEach((t, r) => {
1606
- if (!rr(t)) return;
1616
+ if (!ir(t)) return;
1607
1617
  let i = e.mapping.slice(r);
1608
1618
  n.push({
1609
1619
  from: i.map(t.pos, -1),
@@ -1612,7 +1622,7 @@ function or(e, t) {
1612
1622
  });
1613
1623
  let r = [];
1614
1624
  for (let e of n) {
1615
- let n = ar(t, e);
1625
+ let n = or(t, e);
1616
1626
  n && r.push(n);
1617
1627
  }
1618
1628
  r.sort((e, t) => e.from - t.from);
@@ -1626,29 +1636,29 @@ function or(e, t) {
1626
1636
  ranges: i
1627
1637
  };
1628
1638
  }
1629
- function sr(e, t, n, r) {
1639
+ function cr(e, t, n, r) {
1630
1640
  return e.map(t, n, { onRemove: (e) => {
1631
1641
  let t = e?.key;
1632
1642
  typeof t == "string" && r.delete(t);
1633
1643
  } });
1634
1644
  }
1635
- function cr(e, t, n) {
1636
- let r = t.decorationSetsByExtension[e] ?? C.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
1645
+ function lr(e, t, n) {
1646
+ let r = t.decorationSetsByExtension[e] ?? T.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
1637
1647
  return {
1638
- set: sr(r, n.mapping, n.doc, i),
1648
+ set: cr(r, n.mapping, n.doc, i),
1639
1649
  widgetKeys: i
1640
1650
  };
1641
1651
  }
1642
- function lr(e, t) {
1652
+ function ur(e, t) {
1643
1653
  let n = Object.values(t).flatMap((e) => e.find());
1644
- return C.create(e, n);
1654
+ return T.create(e, n);
1645
1655
  }
1646
- function ur(e) {
1656
+ function dr(e) {
1647
1657
  let t = /* @__PURE__ */ new Set();
1648
1658
  for (let n of Object.values(e)) for (let e of n) t.add(e);
1649
1659
  return t;
1650
1660
  }
1651
- function dr(e, t) {
1661
+ function fr(e, t) {
1652
1662
  switch (t.update ?? "document") {
1653
1663
  case "document":
1654
1664
  if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
@@ -1663,21 +1673,21 @@ function dr(e, t) {
1663
1673
  default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
1664
1674
  }
1665
1675
  }
1666
- function fr(e, t, n) {
1676
+ function pr(e, t, n) {
1667
1677
  return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
1668
1678
  }
1669
- var pr = /* @__PURE__ */ new Set(), mr = class {
1679
+ var mr = /* @__PURE__ */ new Set(), hr = class {
1670
1680
  constructor(e) {
1671
1681
  this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
1672
- let t = K.getState(e);
1682
+ let t = q.getState(e);
1673
1683
  t && this.warnDuplicateWidgetKeys(t);
1674
- }, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => dr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
1684
+ }, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => fr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
1675
1685
  }
1676
1686
  destroy() {
1677
1687
  this.editor.off("beforeTransaction", this.handleBeforeTransaction);
1678
1688
  }
1679
1689
  liveWidgetKeys() {
1680
- return K.getState(this.editor.state)?.widgetKeys ?? pr;
1690
+ return q.getState(this.editor.state)?.widgetKeys ?? mr;
1681
1691
  }
1682
1692
  get mountedView() {
1683
1693
  return this.editor.isDestroyed ? null : this.editor.view;
@@ -1696,7 +1706,7 @@ var pr = /* @__PURE__ */ new Set(), mr = class {
1696
1706
  createPlugin() {
1697
1707
  let { editor: e, entries: t } = this;
1698
1708
  return new r({
1699
- key: K,
1709
+ key: q,
1700
1710
  state: {
1701
1711
  init: (e, n) => {
1702
1712
  let r = {}, i = {};
@@ -1708,22 +1718,22 @@ var pr = /* @__PURE__ */ new Set(), mr = class {
1708
1718
  decorationSetsByExtension: r,
1709
1719
  widgetKeysByExtension: i,
1710
1720
  mergedDecorationSet: this.buildMergedSet(n.doc, r),
1711
- widgetKeys: ur(i)
1721
+ widgetKeys: dr(i)
1712
1722
  };
1713
1723
  return this.warnDuplicateWidgetKeys(a), a;
1714
1724
  },
1715
1725
  apply: (n, r, i, a) => {
1716
- let o = n.getMeta(K), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
1717
- return Kn(e, () => {
1726
+ let o = n.getMeta(q), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
1727
+ return qn(e, () => {
1718
1728
  for (let { name: o, spec: f } of t) {
1719
1729
  let t = s || c === o;
1720
- if (!fr(f, {
1730
+ if (!pr(f, {
1721
1731
  editor: e,
1722
1732
  tr: n,
1723
1733
  oldState: i,
1724
1734
  newState: a
1725
1735
  }, t)) {
1726
- let e = cr(o, r, n);
1736
+ let e = lr(o, r, n);
1727
1737
  l[o] = e.set, u[o] = e.widgetKeys;
1728
1738
  } else if (f.update === "changedRanges" && n.docChanged && !t) {
1729
1739
  let e = this.applyChangedRangesRecompute(o, f, r, n, a);
@@ -1743,34 +1753,34 @@ var pr = /* @__PURE__ */ new Set(), mr = class {
1743
1753
  decorationSetsByExtension: l,
1744
1754
  recomputedNames: d
1745
1755
  }),
1746
- widgetKeys: ur(u)
1756
+ widgetKeys: dr(u)
1747
1757
  };
1748
1758
  }
1749
1759
  },
1750
1760
  props: { decorations(e) {
1751
- return K.getState(e)?.mergedDecorationSet ?? C.empty;
1761
+ return q.getState(e)?.mergedDecorationSet ?? T.empty;
1752
1762
  } }
1753
1763
  });
1754
1764
  }
1755
1765
  applyChangedRangesRecompute(e, t, n, r, i) {
1756
- let a = or(r, i.doc);
1766
+ let a = sr(r, i.doc);
1757
1767
  return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
1758
1768
  }
1759
1769
  rebuildRanges(e, t, n, r, i, a) {
1760
- let o = n.decorationSetsByExtension[e] ?? C.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = sr(o, r.mapping, r.doc, s), l = i.doc.content.size;
1770
+ let o = n.decorationSetsByExtension[e] ?? T.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = cr(o, r.mapping, r.doc, s), l = i.doc.content.size;
1761
1771
  for (let { from: n, to: r } of a) {
1762
- let a = c.find(n, r).filter((e) => $n({
1772
+ let a = c.find(n, r).filter((e) => er({
1763
1773
  position: e.from,
1764
1774
  from: n,
1765
1775
  to: r,
1766
1776
  docSize: l
1767
1777
  }));
1768
1778
  for (let e of a) {
1769
- let t = tr(e);
1779
+ let t = nr(e);
1770
1780
  t && s.delete(t);
1771
1781
  }
1772
1782
  c = c.remove(a);
1773
- let { decorations: o, widgetKeys: u } = Zn(er({
1783
+ let { decorations: o, widgetKeys: u } = Qn(tr({
1774
1784
  decorations: this.runCreate(e, "createInRange", () => t.createInRange({
1775
1785
  editor: this.editor,
1776
1786
  state: i,
@@ -1798,7 +1808,7 @@ var pr = /* @__PURE__ */ new Set(), mr = class {
1798
1808
  state: n,
1799
1809
  view: this.mountedView
1800
1810
  }));
1801
- return Qn(n.doc, r, e);
1811
+ return $n(n.doc, r, e);
1802
1812
  }
1803
1813
  runCreate(e, t, n) {
1804
1814
  try {
@@ -1808,12 +1818,12 @@ var pr = /* @__PURE__ */ new Set(), mr = class {
1808
1818
  }
1809
1819
  }
1810
1820
  warnDuplicateWidgetKeys(e) {
1811
- if (!Yn) return;
1821
+ if (!Xn) return;
1812
1822
  if (e.widgetKeys.size === 0) {
1813
1823
  this.warnedWidgetKeys.clear();
1814
1824
  return;
1815
1825
  }
1816
- let t = nr(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
1826
+ let t = rr(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
1817
1827
  for (let { key: e, extensions: n } of t) {
1818
1828
  if (this.warnedWidgetKeys.has(e)) continue;
1819
1829
  let t = Array.from(n).map((e) => `"${e}"`).join(", ");
@@ -1823,13 +1833,13 @@ var pr = /* @__PURE__ */ new Set(), mr = class {
1823
1833
  }
1824
1834
  buildMergedSet(e, t) {
1825
1835
  let n = Object.keys(t);
1826
- return n.length === 1 ? t[n[0]] : lr(e, t);
1836
+ return n.length === 1 ? t[n[0]] : ur(e, t);
1827
1837
  }
1828
1838
  mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
1829
- return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : lr(n.doc, r);
1839
+ return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : ur(n.doc, r);
1830
1840
  }
1831
1841
  };
1832
- function hr(e, t) {
1842
+ function gr(e, t) {
1833
1843
  let { selection: r } = e, { $from: i } = r;
1834
1844
  if (r instanceof n) {
1835
1845
  let e = i.index();
@@ -1843,16 +1853,16 @@ function hr(e, t) {
1843
1853
  }
1844
1854
  return !1;
1845
1855
  }
1846
- function gr(e, t, n) {
1856
+ function _r(e, t, n) {
1847
1857
  let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
1848
1858
  if (r !== null) return r;
1849
1859
  let i = document.createElement("style");
1850
1860
  return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
1851
1861
  }
1852
- function _r(e) {
1862
+ function vr(e) {
1853
1863
  return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
1854
1864
  }
1855
- function vr(e, t) {
1865
+ function yr(e, t) {
1856
1866
  let n = e.getAttribute("style");
1857
1867
  if (!n) return null;
1858
1868
  let r = n.split(";").map((e) => e.trim()).filter(Boolean), i = t.toLowerCase();
@@ -1862,19 +1872,22 @@ function vr(e, t) {
1862
1872
  }
1863
1873
  return null;
1864
1874
  }
1865
- function yr() {
1875
+ function br() {
1866
1876
  return typeof navigator < "u" && /Firefox/.test(navigator.userAgent);
1867
1877
  }
1868
- function br(e) {
1878
+ function xr(e) {
1869
1879
  return typeof e == "number";
1870
1880
  }
1871
- function xr(e) {
1881
+ function Sr(e) {
1872
1882
  return Object.prototype.toString.call(e).slice(8, -1);
1873
1883
  }
1874
- function J(e) {
1875
- return xr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1884
+ function Y(e) {
1885
+ return Sr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1886
+ }
1887
+ function Cr(e) {
1888
+ return typeof e == "string" && e.trim().length > 0 && !/[;{}]/.test(e);
1876
1889
  }
1877
- function Sr(e, t, n) {
1890
+ function wr(e, t, n) {
1878
1891
  let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
1879
1892
  for (; o < r.length;) {
1880
1893
  let e = r[o], u = e.match(t.itemPattern);
@@ -1918,13 +1931,13 @@ function Sr(e, t, n) {
1918
1931
  raw: a
1919
1932
  };
1920
1933
  }
1921
- var Cr = 4;
1922
- function wr(e) {
1934
+ var Tr = 4;
1935
+ function Er(e) {
1923
1936
  let t = 0;
1924
- for (let n of e) t = n === " " ? t + Cr - t % Cr : t + 1;
1937
+ for (let n of e) t = n === " " ? t + Tr - t % Tr : t + 1;
1925
1938
  return t;
1926
1939
  }
1927
- function Tr(e, t, n, r, i) {
1940
+ function Dr(e, t, n, r, i) {
1928
1941
  if (!e || !Array.isArray(e.content)) return "";
1929
1942
  let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = `${a}${t.renderChildren([o])}`;
1930
1943
  return s && s.length > 0 && s.forEach((e, n) => {
@@ -1932,20 +1945,20 @@ function Tr(e, t, n, r, i) {
1932
1945
  if (r != null) {
1933
1946
  let n = (e) => {
1934
1947
  if (!i?.alignNestedToPrefix) return t.indent(e);
1935
- let n = t.indent(""), r = wr(a);
1936
- return (wr(n) >= r ? n : " ".repeat(r)) + e;
1948
+ let n = t.indent(""), r = Er(a);
1949
+ return (Er(n) >= r ? n : " ".repeat(r)) + e;
1937
1950
  }, o = r.split("\n").map((e) => n(e || "")).join("\n");
1938
1951
  c += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
1939
1952
  }
1940
1953
  }), c;
1941
1954
  }
1942
- function Er(e, t) {
1955
+ function Or(e, t) {
1943
1956
  let n = { ...e };
1944
- return J(e) && J(t) && Object.keys(t).forEach((r) => {
1945
- J(t[r]) && J(e[r]) ? n[r] = Er(e[r], t[r]) : n[r] = t[r];
1957
+ return Y(e) && Y(t) && Object.keys(t).forEach((r) => {
1958
+ Y(t[r]) && Y(e[r]) ? n[r] = Or(e[r], t[r]) : n[r] = t[r];
1946
1959
  }), n;
1947
1960
  }
1948
- function Dr(e, t, n = {}) {
1961
+ function kr(e, t, n = {}) {
1949
1962
  let { state: r } = t, { doc: i, tr: a } = r, o = e;
1950
1963
  i.descendants((t, r) => {
1951
1964
  let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
@@ -1965,58 +1978,92 @@ function Dr(e, t, n = {}) {
1965
1978
  }
1966
1979
  }), a.docChanged && t.view.dispatch(a);
1967
1980
  }
1968
- var Y = class {
1981
+ var X = class {
1969
1982
  constructor(e) {
1970
1983
  this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
1971
1984
  }
1972
- }, Or = (e, t) => {
1973
- if (Re(t)) return t.exec(e);
1985
+ }, Ar = (e, t) => {
1986
+ if (Le(t)) return t.exec(e);
1974
1987
  let n = t(e);
1975
1988
  if (!n) return null;
1976
1989
  let r = [n.text];
1977
1990
  return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn("[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\"."), r.push(n.replaceWith)), r;
1978
1991
  };
1979
- function X(e) {
1980
- let { editor: t, from: n, to: r, text: i, rules: a, plugin: o } = e, { view: s } = t;
1981
- if (s.composing) return !1;
1982
- let c = s.state.doc.resolve(n);
1983
- if (c.parent.type.spec.code || (c.nodeBefore || c.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
1984
- let l = !1, u = an(c) + i;
1985
- return a.forEach((e) => {
1986
- if (l) return;
1987
- let a = Or(u, e.find);
1988
- if (!a) return;
1989
- let d = a[0].length - i.length;
1990
- if (d > 0) {
1991
- let e = c.parentOffset - d;
1992
- if (e < 0 || c.parent.textBetween(e, c.parentOffset) !== a[0].slice(0, d)) return;
1993
- }
1994
- let f = s.state.tr, p = w({
1995
- state: s.state,
1996
- transaction: f
1997
- }), m = {
1998
- from: n - (a[0].length - i.length),
1999
- to: r
2000
- }, { commands: h, chain: g, can: _ } = new T({
1992
+ function jr(e) {
1993
+ let { editor: n, from: r, to: i, text: a, insertText: o } = e;
1994
+ if (!o) return {
1995
+ inputTransaction: null,
1996
+ tr: n.view.state.tr
1997
+ };
1998
+ let s = n.view.state.tr.insertText(a, r, i);
1999
+ return {
2000
+ inputTransaction: s,
2001
+ tr: t.create({
2002
+ doc: s.doc,
2003
+ selection: s.selection,
2004
+ storedMarks: s.storedMarks
2005
+ }).tr
2006
+ };
2007
+ }
2008
+ function Mr(e) {
2009
+ let { editor: t, from: n, to: r, text: i, rule: a, match: o, plugin: s, insertText: c } = e, { view: l } = t, { inputTransaction: u, tr: d } = jr({
2010
+ editor: t,
2011
+ from: n,
2012
+ to: r,
2013
+ text: i,
2014
+ insertText: c
2015
+ }), f = u ? n + i.length : r, p = E({
2016
+ state: l.state,
2017
+ transaction: d
2018
+ }), m = {
2019
+ from: n - (o[0].length - i.length),
2020
+ to: f
2021
+ }, { commands: h, chain: g, can: _ } = new D({
2022
+ editor: t,
2023
+ state: p
2024
+ });
2025
+ return a.handler({
2026
+ state: p,
2027
+ range: m,
2028
+ match: o,
2029
+ commands: h,
2030
+ chain: g,
2031
+ can: _
2032
+ }) === null || !d.steps.length ? !1 : u && (l.dispatch(u), !l.state.doc.eq(u.doc)) ? !0 : (ye(d), d.setMeta("inputRule", !0), a.undoable && d.setMeta(s, {
2033
+ transform: d,
2034
+ from: n,
2035
+ to: f,
2036
+ text: i
2037
+ }), l.dispatch(d), !0);
2038
+ }
2039
+ function Nr(e, t, n) {
2040
+ let r = t[0].length - n.length;
2041
+ if (r <= 0) return !0;
2042
+ let i = e.parentOffset - r;
2043
+ return i >= 0 && e.parent.textBetween(i, e.parentOffset) === t[0].slice(0, r);
2044
+ }
2045
+ function Z(e) {
2046
+ let { editor: t, from: n, to: r, text: i, rules: a, plugin: o, insertText: s } = e, { view: c } = t;
2047
+ if (c.composing) return !1;
2048
+ let l = c.state.doc.resolve(n);
2049
+ if (l.parent.type.spec.code || (l.nodeBefore || l.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
2050
+ let u = on(l) + i;
2051
+ for (let e of a) {
2052
+ let a = Ar(u, e.find);
2053
+ if (a && Nr(l, a, i) && Mr({
2001
2054
  editor: t,
2002
- state: p
2003
- });
2004
- e.handler({
2005
- state: p,
2006
- range: m,
2007
- match: a,
2008
- commands: h,
2009
- chain: g,
2010
- can: _
2011
- }) !== null && f.steps.length && (e.undoable && f.setMeta(o, {
2012
- transform: f,
2013
2055
  from: n,
2014
2056
  to: r,
2015
- text: i
2016
- }), s.dispatch(f), l = !0);
2017
- }), l;
2057
+ text: i,
2058
+ rule: e,
2059
+ match: a,
2060
+ plugin: o,
2061
+ insertText: s
2062
+ })) return !0;
2063
+ }
2064
+ return !1;
2018
2065
  }
2019
- function kr(e) {
2066
+ function Pr(e) {
2020
2067
  let { editor: t, rules: n } = e, i = new r({
2021
2068
  state: {
2022
2069
  init() {
@@ -2028,9 +2075,9 @@ function kr(e) {
2028
2075
  let s = e.getMeta("applyInputRules");
2029
2076
  return s && setTimeout(() => {
2030
2077
  let { text: e } = s;
2031
- e = typeof e == "string" ? e : Pt(S.from(e), a.schema);
2078
+ e = typeof e == "string" ? e : Pt(w.from(e), a.schema);
2032
2079
  let { from: r } = s, o = r + e.length;
2033
- X({
2080
+ Z({
2034
2081
  editor: t,
2035
2082
  from: r,
2036
2083
  to: o,
@@ -2043,18 +2090,19 @@ function kr(e) {
2043
2090
  },
2044
2091
  props: {
2045
2092
  handleTextInput(e, r, a, o) {
2046
- return X({
2093
+ return Z({
2047
2094
  editor: t,
2048
2095
  from: r,
2049
2096
  to: a,
2050
2097
  text: o,
2051
2098
  rules: n,
2052
- plugin: i
2099
+ plugin: i,
2100
+ insertText: !0
2053
2101
  });
2054
2102
  },
2055
2103
  handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
2056
2104
  let { $cursor: r } = e.state.selection;
2057
- r && X({
2105
+ r && Z({
2058
2106
  editor: t,
2059
2107
  from: r.pos,
2060
2108
  to: r.pos,
@@ -2066,7 +2114,7 @@ function kr(e) {
2066
2114
  handleKeyDown(e, r) {
2067
2115
  if (r.key !== "Enter") return !1;
2068
2116
  let { $cursor: a } = e.state.selection;
2069
- return a ? X({
2117
+ return a ? Z({
2070
2118
  editor: t,
2071
2119
  from: a.pos,
2072
2120
  to: a.pos,
@@ -2080,7 +2128,7 @@ function kr(e) {
2080
2128
  });
2081
2129
  return i;
2082
2130
  }
2083
- var Ar = class {
2131
+ var Fr = class {
2084
2132
  constructor(e = {}) {
2085
2133
  this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
2086
2134
  ...this.config,
@@ -2088,10 +2136,10 @@ var Ar = class {
2088
2136
  }, this.name = this.config.name;
2089
2137
  }
2090
2138
  get options() {
2091
- return { ...R(L(this, "addOptions", { name: this.name })) };
2139
+ return { ...B(z(this, "addOptions", { name: this.name })) };
2092
2140
  }
2093
2141
  get storage() {
2094
- return { ...R(L(this, "addStorage", {
2142
+ return { ...B(z(this, "addStorage", {
2095
2143
  name: this.name,
2096
2144
  options: this.options
2097
2145
  })) };
@@ -2099,7 +2147,7 @@ var Ar = class {
2099
2147
  configure(e = {}) {
2100
2148
  let t = this.extend({
2101
2149
  ...this.config,
2102
- addOptions: () => Er(this.options, e)
2150
+ addOptions: () => Or(this.options, e)
2103
2151
  });
2104
2152
  return t.name = this.name, t.parent = this.parent, this.child = null, t;
2105
2153
  }
@@ -2110,7 +2158,7 @@ var Ar = class {
2110
2158
  });
2111
2159
  return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
2112
2160
  }
2113
- }, jr = class e extends Ar {
2161
+ }, Ir = class e extends Fr {
2114
2162
  constructor(...e) {
2115
2163
  super(...e), this.type = "mark";
2116
2164
  }
@@ -2135,20 +2183,20 @@ var Ar = class {
2135
2183
  let t = typeof e == "function" ? e() : e;
2136
2184
  return super.extend(t);
2137
2185
  }
2138
- }, Mr = class {
2186
+ }, Lr = class {
2139
2187
  constructor(e) {
2140
2188
  this.find = e.find, this.handler = e.handler;
2141
2189
  }
2142
- }, Nr = (e, t, n) => {
2143
- if (Re(t)) return [...e.matchAll(t)];
2190
+ }, Rr = (e, t, n) => {
2191
+ if (Le(t)) return [...e.matchAll(t)];
2144
2192
  let r = t(e, n);
2145
2193
  return r ? r.map((t) => {
2146
2194
  let n = [t.text];
2147
2195
  return n.index = t.index, n.input = e, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\"."), n.push(t.replaceWith)), n;
2148
2196
  }) : [];
2149
2197
  };
2150
- function Pr(e) {
2151
- let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new T({
2198
+ function zr(e) {
2199
+ let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new D({
2152
2200
  editor: t,
2153
2201
  state: n
2154
2202
  }), d = [];
@@ -2156,7 +2204,7 @@ function Pr(e) {
2156
2204
  var f;
2157
2205
  if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
2158
2206
  let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
2159
- m >= h || Nr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
2207
+ m >= h || Rr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
2160
2208
  if (e.index === void 0) return;
2161
2209
  let t = m + e.index + 1, r = t + e[0].length, i = {
2162
2210
  from: n.tr.mapping.map(t),
@@ -2175,12 +2223,12 @@ function Pr(e) {
2175
2223
  });
2176
2224
  }), d.every((e) => e !== null);
2177
2225
  }
2178
- var Z = null, Fr = (e) => {
2226
+ var Q = null, Br = (e) => {
2179
2227
  var t;
2180
2228
  let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
2181
2229
  return (t = n.clipboardData) == null || t.setData("text/html", e), n;
2182
2230
  };
2183
- function Ir(e) {
2231
+ function Vr(e) {
2184
2232
  let { editor: t, rules: n } = e, i = null, a = !1, o = !1, s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
2185
2233
  try {
2186
2234
  c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
@@ -2188,11 +2236,11 @@ function Ir(e) {
2188
2236
  c = null;
2189
2237
  }
2190
2238
  let l = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
2191
- let o = e.tr, l = w({
2239
+ let o = e.tr, l = E({
2192
2240
  state: e,
2193
2241
  transaction: o
2194
2242
  });
2195
- if (Pr({
2243
+ if (zr({
2196
2244
  editor: t,
2197
2245
  state: l,
2198
2246
  from: Math.max(n - 1, 0),
@@ -2209,12 +2257,14 @@ function Ir(e) {
2209
2257
  return s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, o;
2210
2258
  }
2211
2259
  };
2212
- return n.map((e) => new r({
2260
+ return t.on("destroy", () => {
2261
+ Q === t && (Q = null);
2262
+ }), n.map((e) => new r({
2213
2263
  view(e) {
2214
2264
  let n = (n) => {
2215
- i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Z = t);
2265
+ i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Q = t);
2216
2266
  }, r = () => {
2217
- Z &&= null;
2267
+ Q &&= null;
2218
2268
  };
2219
2269
  return window.addEventListener("dragstart", n), window.addEventListener("dragend", r), { destroy() {
2220
2270
  window.removeEventListener("dragstart", n), window.removeEventListener("dragend", r);
@@ -2223,8 +2273,9 @@ function Ir(e) {
2223
2273
  props: { handleDOMEvents: {
2224
2274
  drop: (e, t) => {
2225
2275
  if (o = i === e.dom.parentElement, c = t, !o) {
2226
- let e = Z;
2276
+ let e = Q;
2227
2277
  e?.isEditable && setTimeout(() => {
2278
+ if (e.isDestroyed) return;
2228
2279
  let t = e.state.selection;
2229
2280
  t && e.commands.deleteRange({
2230
2281
  from: t.from,
@@ -2244,8 +2295,8 @@ function Ir(e) {
2244
2295
  if (!c && !u && !f) return;
2245
2296
  if (f) {
2246
2297
  let { text: t } = d;
2247
- t = typeof t == "string" ? t : Pt(S.from(t), r.schema);
2248
- let { from: n } = d, i = n + t.length, a = Fr(t);
2298
+ t = typeof t == "string" ? t : Pt(w.from(t), r.schema);
2299
+ let { from: n } = d, i = n + t.length, a = Br(t);
2249
2300
  return l({
2250
2301
  rule: e,
2251
2302
  state: r,
@@ -2255,7 +2306,7 @@ function Ir(e) {
2255
2306
  });
2256
2307
  }
2257
2308
  let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
2258
- if (br(p) && m && p !== m.b) return l({
2309
+ if (xr(p) && m && p !== m.b) return l({
2259
2310
  rule: e,
2260
2311
  state: r,
2261
2312
  from: p,
@@ -2265,18 +2316,18 @@ function Ir(e) {
2265
2316
  }
2266
2317
  }));
2267
2318
  }
2268
- var Q = class {
2319
+ var Hr = class {
2269
2320
  constructor(e, t) {
2270
2321
  this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = qt(e), this.schema = Gt(this.extensions, t), this.setupExtensions();
2271
2322
  }
2272
2323
  get commands() {
2273
2324
  return this.extensions.reduce((e, t) => {
2274
- let n = L(t, "addCommands", {
2325
+ let n = z(t, "addCommands", {
2275
2326
  name: t.name,
2276
2327
  options: t.options,
2277
2328
  storage: this.editor.extensionStorage[t.name],
2278
2329
  editor: this.editor,
2279
- type: U(t.name, this.schema)
2330
+ type: W(t.name, this.schema)
2280
2331
  });
2281
2332
  return n ? {
2282
2333
  ...e,
@@ -2285,15 +2336,15 @@ var Q = class {
2285
2336
  }, {});
2286
2337
  }
2287
2338
  get plugins() {
2288
- let { editor: e } = this, t = V([...this.extensions].reverse()).flatMap((t) => {
2339
+ let { editor: e } = this, t = U([...this.extensions].reverse()).flatMap((t) => {
2289
2340
  let n = {
2290
2341
  name: t.name,
2291
2342
  options: t.options,
2292
2343
  storage: this.editor.extensionStorage[t.name],
2293
2344
  editor: e,
2294
- type: U(t.name, this.schema)
2295
- }, r = [], i = L(t, "addKeyboardShortcuts", n), a = {};
2296
- if (t.type === "mark" && L(t, "exitable", n) && (a.ArrowRight = () => jr.handleExit({
2345
+ type: W(t.name, this.schema)
2346
+ }, r = [], i = z(t, "addKeyboardShortcuts", n), a = {};
2347
+ if (t.type === "mark" && z(t, "exitable", n) && (a.ArrowRight = () => Ir.handleExit({
2297
2348
  editor: e,
2298
2349
  mark: t
2299
2350
  })), i) {
@@ -2303,31 +2354,31 @@ var Q = class {
2303
2354
  ...t
2304
2355
  };
2305
2356
  }
2306
- let o = be(a);
2357
+ let o = ve(a);
2307
2358
  r.push(o);
2308
- let s = L(t, "addInputRules", n);
2309
- if (un(t, e.options.enableInputRules) && s) {
2359
+ let s = z(t, "addInputRules", n);
2360
+ if (dn(t, e.options.enableInputRules) && s) {
2310
2361
  let t = s();
2311
2362
  if (t && t.length) {
2312
- let n = kr({
2363
+ let n = Pr({
2313
2364
  editor: e,
2314
2365
  rules: t
2315
2366
  }), i = Array.isArray(n) ? n : [n];
2316
2367
  r.push(...i);
2317
2368
  }
2318
2369
  }
2319
- let c = L(t, "addPasteRules", n);
2320
- if (un(t, e.options.enablePasteRules) && c) {
2370
+ let c = z(t, "addPasteRules", n);
2371
+ if (dn(t, e.options.enablePasteRules) && c) {
2321
2372
  let t = c();
2322
2373
  if (t && t.length) {
2323
- let n = Ir({
2374
+ let n = Vr({
2324
2375
  editor: e,
2325
2376
  rules: t
2326
2377
  });
2327
2378
  r.push(...n);
2328
2379
  }
2329
2380
  }
2330
- let l = L(t, "addProseMirrorPlugins", n);
2381
+ let l = z(t, "addProseMirrorPlugins", n);
2331
2382
  if (l) {
2332
2383
  let e = l();
2333
2384
  r.push(...e);
@@ -2342,18 +2393,18 @@ var Q = class {
2342
2393
  (e = this.decorationManager) == null || e.destroy();
2343
2394
  let n = [];
2344
2395
  return this.extensions.forEach((e) => {
2345
- let r = L(e, "addDecorations", {
2396
+ let r = z(e, "addDecorations", {
2346
2397
  name: e.name,
2347
2398
  options: e.options,
2348
2399
  storage: this.editor.extensionStorage[e.name],
2349
2400
  editor: t,
2350
- type: U(e.name, this.schema)
2401
+ type: W(e.name, this.schema)
2351
2402
  });
2352
2403
  r && n.push({
2353
2404
  name: e.name,
2354
2405
  addDecorations: r
2355
2406
  });
2356
- }), this.decorationManager = new mr({
2407
+ }), this.decorationManager = new hr({
2357
2408
  editor: t,
2358
2409
  entries: n
2359
2410
  }), this.decorationManager.plugin;
@@ -2362,19 +2413,19 @@ var Q = class {
2362
2413
  return Lt(this.extensions);
2363
2414
  }
2364
2415
  get nodeViews() {
2365
- let { editor: e } = this, { nodeExtensions: t } = z(this.extensions);
2366
- return Object.fromEntries(t.filter((e) => !!L(e, "addNodeView")).map((t) => {
2367
- let n = this.attributes.filter((e) => e.type === t.name), r = L(t, "addNodeView", {
2416
+ let { editor: e } = this, { nodeExtensions: t } = V(this.extensions);
2417
+ return Object.fromEntries(t.filter((e) => !!z(e, "addNodeView")).map((t) => {
2418
+ let n = this.attributes.filter((e) => e.type === t.name), r = z(t, "addNodeView", {
2368
2419
  name: t.name,
2369
2420
  options: t.options,
2370
2421
  storage: this.editor.extensionStorage[t.name],
2371
2422
  editor: e,
2372
- type: E(t.name, this.schema)
2423
+ type: O(t.name, this.schema)
2373
2424
  });
2374
2425
  if (!r) return [];
2375
2426
  let i = r();
2376
2427
  return i ? [t.name, (r, a, o, s, c) => {
2377
- let l = B(r, n);
2428
+ let l = H(r, n);
2378
2429
  return i({
2379
2430
  node: r,
2380
2431
  view: a,
@@ -2390,14 +2441,14 @@ var Q = class {
2390
2441
  }
2391
2442
  dispatchTransaction(e) {
2392
2443
  let { editor: t } = this;
2393
- return V([...this.extensions].reverse()).reduceRight((e, n) => {
2444
+ return U([...this.extensions].reverse()).reduceRight((e, n) => {
2394
2445
  let r = {
2395
2446
  name: n.name,
2396
2447
  options: n.options,
2397
2448
  storage: this.editor.extensionStorage[n.name],
2398
2449
  editor: t,
2399
- type: U(n.name, this.schema)
2400
- }, i = L(n, "dispatchTransaction", r);
2450
+ type: W(n.name, this.schema)
2451
+ }, i = z(n, "dispatchTransaction", r);
2401
2452
  return i ? (t) => {
2402
2453
  i.call(r, {
2403
2454
  transaction: t,
@@ -2408,14 +2459,14 @@ var Q = class {
2408
2459
  }
2409
2460
  transformPastedHTML(e) {
2410
2461
  let { editor: t } = this;
2411
- return V([...this.extensions]).reduce((e, n) => {
2462
+ return U([...this.extensions]).reduce((e, n) => {
2412
2463
  let r = {
2413
2464
  name: n.name,
2414
2465
  options: n.options,
2415
2466
  storage: this.editor.extensionStorage[n.name],
2416
2467
  editor: t,
2417
- type: U(n.name, this.schema)
2418
- }, i = L(n, "transformPastedHTML", r);
2468
+ type: W(n.name, this.schema)
2469
+ }, i = z(n, "transformPastedHTML", r);
2419
2470
  return i ? (t, n) => {
2420
2471
  let a = e(t, n);
2421
2472
  return i.call(r, a);
@@ -2423,17 +2474,17 @@ var Q = class {
2423
2474
  }, e || ((e) => e));
2424
2475
  }
2425
2476
  get markViews() {
2426
- let { editor: e } = this, { markExtensions: t } = z(this.extensions);
2427
- return Object.fromEntries(t.filter((e) => !!L(e, "addMarkView")).map((t) => {
2428
- let n = this.attributes.filter((e) => e.type === t.name), r = L(t, "addMarkView", {
2477
+ let { editor: e } = this, { markExtensions: t } = V(this.extensions);
2478
+ return Object.fromEntries(t.filter((e) => !!z(e, "addMarkView")).map((t) => {
2479
+ let n = this.attributes.filter((e) => e.type === t.name), r = z(t, "addMarkView", {
2429
2480
  name: t.name,
2430
2481
  options: t.options,
2431
2482
  storage: this.editor.extensionStorage[t.name],
2432
2483
  editor: e,
2433
- type: k(t.name, this.schema)
2484
+ type: A(t.name, this.schema)
2434
2485
  });
2435
2486
  return r ? [t.name, (i, a, o) => {
2436
- let s = B(i, n);
2487
+ let s = H(i, n);
2437
2488
  return r()({
2438
2489
  mark: i,
2439
2490
  view: a,
@@ -2442,7 +2493,7 @@ var Q = class {
2442
2493
  extension: t,
2443
2494
  HTMLAttributes: s,
2444
2495
  updateAttributes: (t) => {
2445
- Dr(i, e, t);
2496
+ kr(i, e, t);
2446
2497
  }
2447
2498
  });
2448
2499
  }] : [];
@@ -2466,16 +2517,16 @@ var Q = class {
2466
2517
  options: e.options,
2467
2518
  storage: this.editor.extensionStorage[e.name],
2468
2519
  editor: this.editor,
2469
- type: U(e.name, this.schema)
2520
+ type: W(e.name, this.schema)
2470
2521
  };
2471
- e.type === "mark" && ((R(L(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (R(L(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
2472
- let n = L(e, "onBeforeCreate", t), r = L(e, "onCreate", t), i = L(e, "onUpdate", t), a = L(e, "onSelectionUpdate", t), o = L(e, "onTransaction", t), s = L(e, "onFocus", t), c = L(e, "onBlur", t), l = L(e, "onDestroy", t);
2522
+ e.type === "mark" && ((B(z(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (B(z(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
2523
+ let n = z(e, "onBeforeCreate", t), r = z(e, "onCreate", t), i = z(e, "onUpdate", t), a = z(e, "onSelectionUpdate", t), o = z(e, "onTransaction", t), s = z(e, "onFocus", t), c = z(e, "onBlur", t), l = z(e, "onDestroy", t);
2473
2524
  n && this.editor.on("beforeCreate", n), r && this.editor.on("create", r), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), o && this.editor.on("transaction", o), s && this.editor.on("focus", s), c && this.editor.on("blur", c), l && this.editor.on("destroy", l);
2474
2525
  });
2475
2526
  }
2476
2527
  };
2477
- Q.resolve = qt, Q.sort = V, Q.flatten = Nt;
2478
- var $ = class e extends Ar {
2528
+ Hr.resolve = qt, Hr.sort = U, Hr.flatten = Nt;
2529
+ var $ = class e extends Fr {
2479
2530
  constructor(...e) {
2480
2531
  super(...e), this.type = "extension";
2481
2532
  }
@@ -2490,7 +2541,7 @@ var $ = class e extends Ar {
2490
2541
  let t = typeof e == "function" ? e() : e;
2491
2542
  return super.extend(t);
2492
2543
  }
2493
- }, Lr = $.create({
2544
+ }, Ur = $.create({
2494
2545
  name: "clipboardTextSerializer",
2495
2546
  addOptions() {
2496
2547
  return { blockSeparator: void 0 };
@@ -2510,12 +2561,12 @@ var $ = class e extends Ar {
2510
2561
  } }
2511
2562
  })];
2512
2563
  }
2513
- }), Rr = $.create({
2564
+ }), Wr = $.create({
2514
2565
  name: "commands",
2515
2566
  addCommands() {
2516
- return { ...Gn };
2567
+ return { ...Kn };
2517
2568
  }
2518
- }), zr = $.create({
2569
+ }), Gr = $.create({
2519
2570
  name: "delete",
2520
2571
  onUpdate({ transaction: e, appendedTransactions: t }) {
2521
2572
  var n;
@@ -2569,7 +2620,7 @@ var $ = class e extends Ar {
2569
2620
  };
2570
2621
  ((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null ? void 0 : n.async) ?? !0 ? setTimeout(r, 0) : r();
2571
2622
  }
2572
- }), Br = $.create({
2623
+ }), Kr = $.create({
2573
2624
  name: "drop",
2574
2625
  addProseMirrorPlugins() {
2575
2626
  return [new r({
@@ -2584,7 +2635,7 @@ var $ = class e extends Ar {
2584
2635
  } }
2585
2636
  })];
2586
2637
  }
2587
- }), Vr = $.create({
2638
+ }), qr = $.create({
2588
2639
  name: "editable",
2589
2640
  addProseMirrorPlugins() {
2590
2641
  return [new r({
@@ -2592,12 +2643,12 @@ var $ = class e extends Ar {
2592
2643
  props: { editable: () => this.editor.options.editable }
2593
2644
  })];
2594
2645
  }
2595
- }), Hr = new i("focusEvents"), Ur = $.create({
2646
+ }), Jr = new i("focusEvents"), Yr = $.create({
2596
2647
  name: "focusEvents",
2597
2648
  addProseMirrorPlugins() {
2598
2649
  let { editor: e } = this;
2599
2650
  return [new r({
2600
- key: Hr,
2651
+ key: Jr,
2601
2652
  props: { handleDOMEvents: {
2602
2653
  focus: (t, n) => {
2603
2654
  e.isFocused = !0;
@@ -2612,7 +2663,7 @@ var $ = class e extends Ar {
2612
2663
  } }
2613
2664
  })];
2614
2665
  }
2615
- }), Wr = $.create({
2666
+ }), Xr = $.create({
2616
2667
  name: "keymap",
2617
2668
  addKeyboardShortcuts() {
2618
2669
  let e = () => this.editor.commands.first(({ commands: e }) => [
@@ -2654,7 +2705,7 @@ var $ = class e extends Ar {
2654
2705
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2655
2706
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2656
2707
  };
2657
- return j() || dt() ? i : r;
2708
+ return N() || dt() ? i : r;
2658
2709
  },
2659
2710
  addProseMirrorPlugins() {
2660
2711
  return [new r({
@@ -2664,11 +2715,11 @@ var $ = class e extends Ar {
2664
2715
  let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
2665
2716
  if (!r || i) return;
2666
2717
  let { empty: o, from: s, to: c } = t.selection, l = a.atStart(t.doc).from, u = a.atEnd(t.doc).to;
2667
- if (o || s !== l || c !== u || !G(n.doc)) return;
2668
- let d = n.tr, f = w({
2718
+ if (o || s !== l || c !== u || !K(n.doc)) return;
2719
+ let d = n.tr, f = E({
2669
2720
  state: n,
2670
2721
  transaction: d
2671
- }), { commands: p } = new T({
2722
+ }), { commands: p } = new D({
2672
2723
  editor: this.editor,
2673
2724
  state: f
2674
2725
  });
@@ -2676,7 +2727,7 @@ var $ = class e extends Ar {
2676
2727
  }
2677
2728
  })];
2678
2729
  }
2679
- }), Gr = $.create({
2730
+ }), Zr = $.create({
2680
2731
  name: "paste",
2681
2732
  addProseMirrorPlugins() {
2682
2733
  return [new r({
@@ -2690,7 +2741,7 @@ var $ = class e extends Ar {
2690
2741
  } }
2691
2742
  })];
2692
2743
  }
2693
- }), Kr = $.create({
2744
+ }), Qr = $.create({
2694
2745
  name: "tabindex",
2695
2746
  addOptions() {
2696
2747
  return { value: void 0 };
@@ -2701,14 +2752,14 @@ var $ = class e extends Ar {
2701
2752
  props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
2702
2753
  })];
2703
2754
  }
2704
- }), qr = $.create({
2755
+ }), $r = $.create({
2705
2756
  name: "textDirection",
2706
2757
  addOptions() {
2707
2758
  return { direction: void 0 };
2708
2759
  },
2709
2760
  addGlobalAttributes() {
2710
2761
  if (!this.options.direction) return [];
2711
- let { nodeExtensions: e } = z(this.extensions);
2762
+ let { nodeExtensions: e } = V(this.extensions);
2712
2763
  return [{
2713
2764
  types: e.filter((e) => e.name !== "text").map((e) => e.name),
2714
2765
  attributes: { dir: {
@@ -2730,10 +2781,10 @@ var $ = class e extends Ar {
2730
2781
  } }
2731
2782
  })];
2732
2783
  }
2733
- }), Jr = !1;
2734
- function Yr(e) {
2735
- if (Jr) return;
2736
- Jr = !0;
2784
+ }), ei = !1;
2785
+ function ti(e) {
2786
+ if (ei) return;
2787
+ ei = !0;
2737
2788
  let t;
2738
2789
  try {
2739
2790
  t = l.fromJSON(e, {
@@ -2743,9 +2794,9 @@ function Yr(e) {
2743
2794
  } catch {
2744
2795
  return;
2745
2796
  }
2746
- t instanceof S || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
2797
+ t instanceof w || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
2747
2798
  }
2748
- var Xr = class e {
2799
+ var ni = class e {
2749
2800
  get name() {
2750
2801
  return this.node.type.name;
2751
2802
  }
@@ -2867,7 +2918,7 @@ var Xr = class e {
2867
2918
  ...e
2868
2919
  }), this.editor.view.dispatch(t);
2869
2920
  }
2870
- }, Zr = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", Qr = class extends Jn {
2921
+ }, ri = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", ii = class extends Yn {
2871
2922
  constructor(e = {}) {
2872
2923
  super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.hasWarnedStaleDecorationRead = !1, this.options = {
2873
2924
  element: typeof document < "u" ? document.createElement("div") : null,
@@ -2904,8 +2955,8 @@ var Xr = class e {
2904
2955
  onDelete: () => null,
2905
2956
  enableExtensionDispatchTransaction: !0
2906
2957
  }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2907
- getUpdatedPosition: mn,
2908
- createMappablePosition: hn
2958
+ getUpdatedPosition: hn,
2959
+ createMappablePosition: gn
2909
2960
  }, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
2910
2961
  let n = this.createDoc();
2911
2962
  if (!this.editorState) {
@@ -2916,7 +2967,7 @@ var Xr = class e {
2916
2967
  selection: e || void 0
2917
2968
  });
2918
2969
  }
2919
- Yr(this.schema), this.options.element && this.mount(this.options.element);
2970
+ ti(this.schema), this.options.element && this.mount(this.options.element);
2920
2971
  }
2921
2972
  mount(e) {
2922
2973
  if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
@@ -2944,19 +2995,22 @@ var Xr = class e {
2944
2995
  return this.commandManager.commands;
2945
2996
  }
2946
2997
  chain() {
2947
- return this.commandManager ? this.commandManager.chain() : T.createFakeChain();
2998
+ return this.commandManager ? this.commandManager.chain() : D.createFakeChain();
2948
2999
  }
2949
3000
  can() {
2950
- return this.commandManager ? this.commandManager.can() : T.createFallbackCan();
3001
+ return this.commandManager ? this.commandManager.can() : D.createFallbackCan();
2951
3002
  }
2952
3003
  injectCSS() {
2953
- this.options.injectCSS && typeof document < "u" && (this.css = gr(Zr, this.options.injectNonce));
3004
+ this.options.injectCSS && typeof document < "u" && (this.css = _r(ri, this.options.injectNonce));
2954
3005
  }
2955
3006
  setOptions(e = {}) {
2956
3007
  this.options = {
2957
3008
  ...this.options,
2958
3009
  ...e
2959
- }, this.editorView && this.state && !this.isDestroyed && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
3010
+ }, this.editorView && this.state && !this.isDestroyed && (this.options.editorProps && this.view.setProps({
3011
+ ...this.options.editorProps,
3012
+ attributes: this.getEditorViewAttributes()
3013
+ }), this.view.updateState(this.state));
2960
3014
  }
2961
3015
  setEditable(e, t = !0) {
2962
3016
  this.setOptions({ editable: e }), t && this.emit("update", {
@@ -2989,7 +3043,7 @@ var Xr = class e {
2989
3043
  } });
2990
3044
  }
2991
3045
  get state() {
2992
- return Yn && !this.hasWarnedStaleDecorationRead && qn(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
3046
+ return Xn && !this.hasWarnedStaleDecorationRead && Jn(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
2993
3047
  }
2994
3048
  registerPlugin(e, t) {
2995
3049
  let n = Ft(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
@@ -3008,25 +3062,25 @@ var Xr = class e {
3008
3062
  createExtensionManager() {
3009
3063
  var e, t;
3010
3064
  let n = [...this.options.enableCoreExtensions ? [
3011
- Vr,
3012
- Lr.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
3013
- Rr,
3014
- Ur,
3065
+ qr,
3066
+ Ur.configure({ blockSeparator: (e = this.options.coreExtensionOptions) == null || (e = e.clipboardTextSerializer) == null ? void 0 : e.blockSeparator }),
3015
3067
  Wr,
3016
- Kr.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
3017
- Br,
3068
+ Yr,
3069
+ Xr,
3070
+ Qr.configure({ value: (t = this.options.coreExtensionOptions) == null || (t = t.tabindex) == null ? void 0 : t.value }),
3071
+ Kr,
3072
+ Zr,
3018
3073
  Gr,
3019
- zr,
3020
- qr.configure({ direction: this.options.textDirection })
3074
+ $r.configure({ direction: this.options.textDirection })
3021
3075
  ].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
3022
3076
  "extension",
3023
3077
  "node",
3024
3078
  "mark"
3025
3079
  ].includes(e?.type));
3026
- this.extensionManager = new Q(n, this);
3080
+ this.extensionManager = new Hr(n, this);
3027
3081
  }
3028
3082
  createCommandManager() {
3029
- this.commandManager = new T({ editor: this });
3083
+ this.commandManager = new D({ editor: this });
3030
3084
  }
3031
3085
  createSchema() {
3032
3086
  this.schema = this.extensionManager.schema;
@@ -3052,14 +3106,21 @@ var Xr = class e {
3052
3106
  }
3053
3107
  return e;
3054
3108
  }
3109
+ getEditorViewAttributes() {
3110
+ let e = this.options.editorProps?.attributes;
3111
+ return Ft(e) ? (t) => ({
3112
+ role: "textbox",
3113
+ ...e(t)
3114
+ }) : {
3115
+ role: "textbox",
3116
+ ...e
3117
+ };
3118
+ }
3055
3119
  createView(e) {
3056
3120
  let { editorProps: t, enableExtensionDispatchTransaction: n } = this.options, r = t.dispatchTransaction || this.dispatchTransaction.bind(this), i = n ? this.extensionManager.dispatchTransaction(r) : r, a = t.transformPastedHTML, o = this.extensionManager.transformPastedHTML(a);
3057
- this.editorView = new ye(e, {
3121
+ this.editorView = new _e(e, {
3058
3122
  ...t,
3059
- attributes: {
3060
- role: "textbox",
3061
- ...t?.attributes
3062
- },
3123
+ attributes: this.getEditorViewAttributes(),
3063
3124
  dispatchTransaction: i,
3064
3125
  transformPastedHTML: o,
3065
3126
  state: this.editorState,
@@ -3129,7 +3190,7 @@ var Xr = class e {
3129
3190
  }
3130
3191
  isActive(e, t) {
3131
3192
  let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
3132
- return sn(this.state, n, r);
3193
+ return cn(this.state, n, r);
3133
3194
  }
3134
3195
  getJSON() {
3135
3196
  return this.state.doc.toJSON();
@@ -3148,7 +3209,7 @@ var Xr = class e {
3148
3209
  });
3149
3210
  }
3150
3211
  get isEmpty() {
3151
- return G(this.state.doc);
3212
+ return K(this.state.doc);
3152
3213
  }
3153
3214
  destroy() {
3154
3215
  this.destroyed || (this.destroyed = !0, this.emit("destroy"), this.unmount(), this.removeAllListeners(), this.extensionManager.destroy(), this.extensionManager = null, this.schema = null, this.commandManager = null, this.extensionStorage = {});
@@ -3164,22 +3225,22 @@ var Xr = class e {
3164
3225
  }
3165
3226
  $pos(e) {
3166
3227
  let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
3167
- return new Xr(t, this, !1, n);
3228
+ return new ni(t, this, !1, n);
3168
3229
  }
3169
3230
  get $doc() {
3170
3231
  return this.$pos(0);
3171
3232
  }
3172
3233
  };
3173
- function $r(e) {
3174
- return new Y({
3234
+ function ai(e) {
3235
+ return new X({
3175
3236
  find: e.find,
3176
3237
  handler: ({ state: t, range: n, match: r }) => {
3177
- let i = R(e.getAttributes, void 0, r);
3238
+ let i = B(e.getAttributes, void 0, r);
3178
3239
  if (i === !1 || i === null) return null;
3179
3240
  let { tr: a } = t, o = r[r.length - 1], s = r[0];
3180
3241
  if (o) {
3181
3242
  let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
3182
- if (H(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
3243
+ if (nn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
3183
3244
  l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
3184
3245
  let u = n.from + r + o.length;
3185
3246
  a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
@@ -3188,11 +3249,11 @@ function $r(e) {
3188
3249
  undoable: e.undoable
3189
3250
  });
3190
3251
  }
3191
- function ei(e) {
3192
- return new Y({
3252
+ function oi(e) {
3253
+ return new X({
3193
3254
  find: e.find,
3194
3255
  handler: ({ state: t, range: n, match: r }) => {
3195
- let i = R(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
3256
+ let i = B(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
3196
3257
  if (r[1]) {
3197
3258
  let e = o + r[0].lastIndexOf(r[1]);
3198
3259
  e > s ? e = s : s = e + r[1].length;
@@ -3207,19 +3268,19 @@ function ei(e) {
3207
3268
  undoable: e.undoable
3208
3269
  });
3209
3270
  }
3210
- function ti(e) {
3211
- return new Y({
3271
+ function si(e) {
3272
+ return new X({
3212
3273
  find: e.find,
3213
3274
  handler: ({ state: t, range: n, match: r }) => {
3214
- let i = t.doc.resolve(n.from), a = R(e.getAttributes, void 0, r) || {};
3275
+ let i = t.doc.resolve(n.from), a = B(e.getAttributes, void 0, r) || {};
3215
3276
  if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
3216
3277
  t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
3217
3278
  },
3218
3279
  undoable: e.undoable
3219
3280
  });
3220
3281
  }
3221
- function ni(e) {
3222
- return new Y({
3282
+ function ci(e) {
3283
+ return new X({
3223
3284
  find: e.find,
3224
3285
  handler: ({ state: t, range: n, match: r }) => {
3225
3286
  let i = e.replace, a = n.from, o = n.to;
@@ -3234,11 +3295,11 @@ function ni(e) {
3234
3295
  undoable: e.undoable
3235
3296
  });
3236
3297
  }
3237
- function ri(e) {
3238
- return new Y({
3298
+ function li(e) {
3299
+ return new X({
3239
3300
  find: e.find,
3240
3301
  handler: ({ state: t, range: n, match: r, chain: i }) => {
3241
- let a = R(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && p(s, e.type, a);
3302
+ let a = B(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && p(s, e.type, a);
3242
3303
  if (!c) return null;
3243
3304
  if (o.wrap(s, c), e.keepMarks && e.editor) {
3244
3305
  let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
@@ -3257,7 +3318,7 @@ function ri(e) {
3257
3318
  undoable: e.undoable
3258
3319
  });
3259
3320
  }
3260
- var ii = (e) => "touches" in e, ai = class {
3321
+ var ui = (e) => "touches" in e, di = class {
3261
3322
  constructor(e) {
3262
3323
  var t;
3263
3324
  this.directions = [
@@ -3347,7 +3408,7 @@ var ii = (e) => "touches" in e, ai = class {
3347
3408
  e ? (this.element.style.width = `${e}px`, this.initialWidth = e) : this.initialWidth = this.element.offsetWidth, t ? (this.element.style.height = `${t}px`, this.initialHeight = t) : this.initialHeight = this.element.offsetHeight, this.initialWidth > 0 && this.initialHeight > 0 && (this.aspectRatio = this.initialWidth / this.initialHeight);
3348
3409
  }
3349
3410
  handleResizeStart(e, t) {
3350
- e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, ii(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
3411
+ e.preventDefault(), e.stopPropagation(), this.isResizing = !0, this.activeHandle = t, ui(e) ? (this.startX = e.touches[0].clientX, this.startY = e.touches[0].clientY) : (this.startX = e.clientX, this.startY = e.clientY), this.startWidth = this.element.offsetWidth, this.startHeight = this.element.offsetHeight, this.startWidth > 0 && this.startHeight > 0 && (this.aspectRatio = this.startWidth / this.startHeight), this.getPos(), this.container.dataset.resizeState = "true", this.classNames.resizing && this.container.classList.add(this.classNames.resizing), document.addEventListener("mousemove", this.handleMouseMove), document.addEventListener("touchmove", this.handleTouchMove), document.addEventListener("mouseup", this.handleMouseUp), document.addEventListener("keydown", this.handleKeyDown), document.addEventListener("keyup", this.handleKeyUp);
3351
3412
  }
3352
3413
  handleResize(e, t) {
3353
3414
  if (!this.activeHandle) return;
@@ -3387,7 +3448,7 @@ var ii = (e) => "touches" in e, ai = class {
3387
3448
  height: e / this.aspectRatio
3388
3449
  };
3389
3450
  }
3390
- }, oi = class e extends Ar {
3451
+ }, fi = class e extends Fr {
3391
3452
  constructor(...e) {
3392
3453
  super(...e), this.type = "node";
3393
3454
  }
@@ -3402,7 +3463,7 @@ var ii = (e) => "touches" in e, ai = class {
3402
3463
  let t = typeof e == "function" ? e() : e;
3403
3464
  return super.extend(t);
3404
3465
  }
3405
- }, si = class {
3466
+ }, pi = class {
3406
3467
  constructor(e, t, n) {
3407
3468
  this.isDragging = !1, this.component = e, this.editor = t.editor, this.options = {
3408
3469
  stopEvent: null,
@@ -3479,7 +3540,7 @@ var ii = (e) => "touches" in e, ai = class {
3479
3540
  return !(s || i || a || u || d || f || p && l);
3480
3541
  }
3481
3542
  ignoreMutation(e) {
3482
- return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: e }) : this.node.isLeaf || this.node.isAtom ? !0 : e.type === "selection" || this.contentDOM.contains(e.target) && e.type === "childList" && (j() || Ge()) && this.editor.isFocused && [...Array.from(e.addedNodes), ...Array.from(e.removedNodes)].every((e) => e.isContentEditable) ? !1 : this.contentDOM === e.target && e.type === "attributes" || !this.contentDOM.contains(e.target);
3543
+ return this.dom ? this.contentDOM ? typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: e }) : this.node.isLeaf || this.node.isAtom ? !0 : e.type === "selection" || this.contentDOM.contains(e.target) && e.type === "childList" && (N() || M()) && this.editor.isFocused && [...Array.from(e.addedNodes), ...Array.from(e.removedNodes)].every((e) => e.isContentEditable) ? !1 : this.contentDOM === e.target && e.type === "attributes" || !this.contentDOM.contains(e.target) : e.type !== "selection" : !0;
3483
3544
  }
3484
3545
  updateAttributes(e) {
3485
3546
  this.editor.commands.command(({ tr: t }) => {
@@ -3500,20 +3561,20 @@ var ii = (e) => "touches" in e, ai = class {
3500
3561
  });
3501
3562
  }
3502
3563
  };
3503
- function ci(e) {
3504
- return new Mr({
3564
+ function mi(e) {
3565
+ return new Lr({
3505
3566
  find: e.find,
3506
3567
  handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
3507
- let a = R(e.getAttributes, void 0, r, i);
3568
+ let a = B(e.getAttributes, void 0, r, i);
3508
3569
  if (a === !1 || a === null) return null;
3509
3570
  let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
3510
3571
  if (s) {
3511
3572
  let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
3512
- if (H(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
3573
+ if (nn(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
3513
3574
  d < n.to && o.delete(d, n.to), u > n.from && o.delete(n.from + i, u), l = n.from + i + s.length, o.addMark(n.from + i, l, e.type.create(a || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || o.removeStoredMark(e.type);
3514
3575
  }
3515
3576
  }
3516
3577
  });
3517
3578
  }
3518
3579
  //#endregion
3519
- export { P as A, Tr as B, B as C, cn as D, Xt as E, ci as F, ti as H, Bt as I, ei as L, fn as M, Ue as N, ln as O, $r as P, Sr as R, rn as S, Yt as T, ri as U, ni as V, L as _, oi as a, nn as b, ai as c, At as d, _r as f, tn as g, Qt as h, jr as i, G as j, yr as k, R as l, Mt as m, $ as n, si as o, jt as p, Y as r, Mr as s, Qr as t, hr as u, O as v, vr as w, E as x, H as y, gn as z };
3580
+ export { br as A, oi as B, H as C, M as D, Xt as E, Cr as F, si as G, _n as H, N as I, li as K, ai as L, K as M, pn as N, ln as O, Ue as P, mi as R, an as S, Yt as T, Dr as U, wr as V, ci as W, z as _, fi as a, rn as b, di as c, At as d, vr as f, tn as g, Qt as h, Ir as i, I as j, un as k, B as l, Mt as m, $ as n, pi as o, jt as p, X as r, Lr as s, ii as t, gr as u, k as v, yr as w, O as x, nn as y, Bt as z };