@clevertask/scribe 0.1.23 → 0.1.25

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 (47) hide show
  1. package/README.md +53 -0
  2. package/dist/{BarMenu-DW95OBe1.js → BarMenu-CP5BJhc-.js} +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 +2 -2
  9. package/dist/components/Menu/linkBubbleMenuPlugin.js +1 -1
  10. package/dist/components/Scribe/extension/callout.js +1 -1
  11. package/dist/components/Scribe/extension/emoji/suggest.js +1 -1
  12. package/dist/components/Scribe/extension/extension-link.js +1 -1
  13. package/dist/components/Scribe/extension/extension-markdown-paste.js +1 -1
  14. package/dist/components/Scribe/extension/extension-selectedText.js +1 -1
  15. package/dist/components/Scribe/extension/external-link-preview/commands.js +1 -1
  16. package/dist/components/Scribe/extension/external-link-preview/index.js +1 -1
  17. package/dist/components/Scribe/extension/external-link-preview/node-view.js +1 -1
  18. package/dist/components/Scribe/extension/external-link-preview/render-html.js +1 -1
  19. package/dist/components/Scribe/extension/external-link-preview/schema.js +1 -1
  20. package/dist/components/Scribe/extension/index.js +1 -1
  21. package/dist/components/Scribe/extension/resizable-table.d.ts +2 -0
  22. package/dist/components/Scribe/extension/resizable-table.d.ts.map +1 -1
  23. package/dist/components/Scribe/extension/resizable-table.js +2 -2
  24. package/dist/components/Scribe/extension/slashCommand/index.js +2 -2
  25. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  26. package/dist/components/Scribe/extension/slashCommand/items.js +35 -33
  27. package/dist/components/Scribe/extension/slashCommand/renderItems.js +1 -1
  28. package/dist/components/Scribe/extension/tableOfContents.js +1 -1
  29. package/dist/components/Scribe/index.js +3 -3
  30. package/dist/{dist-_L8dTDsy.js → dist-Cwbl2Okw.js} +1 -1
  31. package/dist/{dist-Cer8ra_P.js → dist-Dk0fXvrc.js} +1 -1
  32. package/dist/{dist-ClNucvAM.js → dist-xjmWZ-oh.js} +785 -785
  33. package/dist/document-node-capabilities.js +4 -1
  34. package/dist/{extension-B7i7CZ1Y.js → extension-9Oc-QD39.js} +1 -1
  35. package/dist/{extension-link-BQrkQZHi.js → extension-link-DmM_EJTn.js} +1 -1
  36. package/dist/{menus-BhM4ctz2.js → menus-B0uyLVhs.js} +2 -2
  37. package/dist/{resizable-table-DgMCiXeO.js → resizable-table-JZOaj_L3.js} +88 -78
  38. package/dist/{schema-extensions-ggKYCkRf.js → schema-extensions-LzyMpyWW.js} +4 -4
  39. package/dist/schema-extensions.js +1 -1
  40. package/dist/schema.d.ts +1 -0
  41. package/dist/schema.d.ts.map +1 -1
  42. package/dist/schema.js +5 -4
  43. package/dist/table-transforms.d.ts +58 -0
  44. package/dist/table-transforms.d.ts.map +1 -0
  45. package/dist/table-transforms.js +166 -0
  46. package/dist/utils/index.js +2 -2
  47. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
- import { RemoveMarkStep as e, ReplaceAroundStep as t, ReplaceStep as n, Transform as r, canJoin as i, canSplit as a, findWrapping as o, joinPoint as s, liftTarget as c } from "@tiptap/pm/transform";
2
- import { createParagraphNear as l, exitCode as u, joinBackward as d, joinDown as f, joinForward as p, joinTextblockBackward as m, joinTextblockForward as h, joinUp as g, lift as ee, liftEmptyBlock as te, newlineInCode as _, selectNodeBackward as ne, selectNodeForward as v, selectParentNode as re, selectTextblockEnd as ie, selectTextblockStart as y, setBlockType as b, wrapIn as x } from "@tiptap/pm/commands";
3
- import { AllSelection as ae, EditorState as oe, NodeSelection as S, Plugin as C, PluginKey as w, Selection as T, TextSelection as E } from "@tiptap/pm/state";
4
- import { DOMParser as se, DOMSerializer as ce, Fragment as D, Schema as le, Slice as ue } from "@tiptap/pm/model";
5
- import { liftListItem as de, sinkListItem as fe, wrapInList as pe } from "@tiptap/pm/schema-list";
6
- import { DecorationSet as O, EditorView as me } from "@tiptap/pm/view";
7
- import { keymap as he } from "@tiptap/pm/keymap";
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
+ 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
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 ge = Object.defineProperty, _e = (e, t) => {
9
+ var xe = Object.defineProperty, Se = (e, t) => {
10
10
  let n = {};
11
- for (var r in e) ge(n, r, {
11
+ for (var r in e) xe(n, r, {
12
12
  get: e[r],
13
13
  enumerable: !0
14
14
  });
15
- return t || ge(n, Symbol.toStringTag, { value: "Module" }), n;
15
+ return t || xe(n, Symbol.toStringTag, { value: "Module" }), n;
16
16
  };
17
17
  //#endregion
18
18
  //#region node_modules/.pnpm/@tiptap+core@3.31.3_@tiptap+pm@3.31.3/node_modules/@tiptap/core/dist/index.js
19
- function k(e) {
19
+ function w(e) {
20
20
  let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
21
21
  return {
22
22
  ...t,
@@ -40,7 +40,7 @@ function k(e) {
40
40
  }
41
41
  };
42
42
  }
43
- var A = class e {
43
+ var T = class e {
44
44
  constructor(e) {
45
45
  this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
46
46
  }
@@ -100,7 +100,7 @@ var A = class e {
100
100
  tr: e,
101
101
  editor: r,
102
102
  view: a,
103
- state: k({
103
+ state: w({
104
104
  state: i,
105
105
  transaction: e
106
106
  }),
@@ -113,32 +113,32 @@ var A = class e {
113
113
  };
114
114
  return o;
115
115
  }
116
- }, ve = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
116
+ }, Ce = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
117
117
  if (!e.isDestroyed) {
118
118
  var n;
119
119
  t.dom.blur(), (n = window) == null || (n = n.getSelection()) == null || n.removeAllRanges();
120
120
  }
121
- }), !0), ye = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), be = () => ({ state: e, tr: t, dispatch: n }) => {
121
+ }), !0), we = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Te = () => ({ state: e, tr: t, dispatch: n }) => {
122
122
  let { selection: r } = t, { ranges: i } = r;
123
123
  return n && i.forEach(({ $from: n, $to: r }) => {
124
124
  e.doc.nodesBetween(n.pos, r.pos, (e, n) => {
125
125
  if (e.type.isText) return;
126
126
  let { doc: r, mapping: i } = t, a = r.resolve(i.map(n)), o = r.resolve(i.map(n + e.nodeSize)), s = a.blockRange(o);
127
127
  if (!s) return;
128
- let l = c(s);
128
+ let c = h(s);
129
129
  if (e.type.isTextblock) {
130
130
  let { defaultType: e } = a.parent.contentMatchAt(a.index());
131
131
  t.setNodeMarkup(s.start, e);
132
132
  }
133
- (l || l === 0) && t.lift(s, l);
133
+ (c || c === 0) && t.lift(s, c);
134
134
  });
135
135
  }), !0;
136
- }, xe = (e) => (t) => e(t), Se = () => ({ state: e, dispatch: t }) => l(e, t), Ce = (e, t) => ({ editor: n, tr: r }) => {
136
+ }, Ee = (e) => (t) => e(t), De = () => ({ state: e, dispatch: t }) => g(e, t), Oe = (e, t) => ({ editor: n, tr: r }) => {
137
137
  let { state: i } = n, a = i.doc.slice(e.from, e.to);
138
138
  r.deleteRange(e.from, e.to);
139
- let o = r.mapping.map(t);
140
- return r.insert(o, a.content), r.setSelection(new E(r.doc.resolve(Math.max(o - 1, 0)))), !0;
141
- }, we = () => ({ tr: e, dispatch: t }) => {
139
+ let s = r.mapping.map(t);
140
+ 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
142
  let { selection: n } = e, r = n.$anchor.node();
143
143
  if (r.content.size > 0) return !1;
144
144
  let i = e.selection.$anchor;
@@ -151,15 +151,15 @@ var A = class e {
151
151
  }
152
152
  return !1;
153
153
  };
154
- function j(e, t) {
154
+ function E(e, t) {
155
155
  if (typeof e == "string") {
156
156
  if (!t.nodes[e]) throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
157
157
  return t.nodes[e];
158
158
  }
159
159
  return e;
160
160
  }
161
- var Te = (e) => ({ tr: t, state: n, dispatch: r }) => {
162
- let i = j(e, n.schema), a = t.selection.$anchor;
161
+ var Ae = (e) => ({ tr: t, state: n, dispatch: r }) => {
162
+ let i = E(e, n.schema), a = t.selection.$anchor;
163
163
  for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
164
164
  if (r) {
165
165
  let n = a.before(e), r = a.after(e);
@@ -168,41 +168,41 @@ var Te = (e) => ({ tr: t, state: n, dispatch: r }) => {
168
168
  return !0;
169
169
  }
170
170
  return !1;
171
- }, Ee = (e) => ({ tr: t, dispatch: n }) => {
171
+ }, je = (e) => ({ tr: t, dispatch: n }) => {
172
172
  let { from: r, to: i } = e;
173
173
  return n && t.delete(r, i), !0;
174
- }, De = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Oe = (e, t, n) => {
174
+ }, Me = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Ne = (e, t, n) => {
175
175
  if (!e.parent.isInline || n === "left" && e.pos > e.start() || n === "right" && e.pos < e.end()) return e.pos;
176
176
  let r = t.nodes[e.parent.type.name].spec;
177
- return De(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
178
- }, ke = (e, t, n) => ({
179
- from: Oe(e, n, "left"),
180
- to: Oe(t, n, "right")
181
- }), Ae = () => ({ state: e, dispatch: t }) => {
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 }) => {
182
182
  if (e.selection.empty) return !1;
183
183
  if (t) {
184
184
  let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
185
185
  r.forEach((t) => {
186
- let r = n.mapping.slice(i), { from: a, to: o } = ke(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
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
187
  n.deleteRange(a, o);
188
- }), n.selection.empty || n.setSelection(E.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
188
+ }), n.selection.empty || n.setSelection(o.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
189
189
  }
190
190
  return !0;
191
- }, je = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Me = () => ({ state: e, dispatch: t }) => u(e, t);
192
- function Ne(e) {
191
+ }, Ie = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Le = () => ({ state: e, dispatch: t }) => _(e, t);
192
+ function Re(e) {
193
193
  return Object.prototype.toString.call(e) === "[object RegExp]";
194
194
  }
195
- function M(e, t, n = { strict: !0 }) {
195
+ function D(e, t, n = { strict: !0 }) {
196
196
  let r = Object.keys(t);
197
- return !r.length || r.every((r) => n.strict ? t[r] === e[r] : Ne(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
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
198
  }
199
- function Pe(e, t, n = {}) {
200
- return e.find((e) => e.type === t && M(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
199
+ 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
201
  }
202
- function Fe(e, t, n = {}) {
203
- return !!Pe(e, t, n);
202
+ function Be(e, t, n = {}) {
203
+ return !!ze(e, t, n);
204
204
  }
205
- function N(e, t, n) {
205
+ function O(e, t, n) {
206
206
  if (!e || !t) return;
207
207
  let r = e.parent.childAfter(e.parentOffset);
208
208
  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;
@@ -210,55 +210,55 @@ function N(e, t, n) {
210
210
  let e = r.node.marks.find((e) => e.type === t);
211
211
  e && (n = e.attrs);
212
212
  }
213
- if (!Pe([...r.node.marks], t, n)) return;
213
+ if (!ze([...r.node.marks], t, n)) return;
214
214
  let i = r.index, a = e.start() + r.offset, o = i + 1, s = a + r.node.nodeSize;
215
- for (; i > 0 && Fe([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
216
- for (; o < e.parent.childCount && Fe([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
215
+ for (; i > 0 && Be([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
216
+ for (; o < e.parent.childCount && Be([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
217
217
  return {
218
218
  from: a,
219
219
  to: s
220
220
  };
221
221
  }
222
- function P(e, t) {
222
+ function k(e, t) {
223
223
  if (typeof e == "string") {
224
224
  if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
225
225
  return t.marks[e];
226
226
  }
227
227
  return e;
228
228
  }
229
- var Ie = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
230
- let a = P(e, r.schema), { doc: o, selection: s } = n, { $from: c, from: l, to: u } = s;
229
+ 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
231
  if (i) {
232
- let e = N(c, a, t);
233
- if (e && e.from <= l && e.to >= u) {
234
- let t = E.create(o, e.from, e.to);
232
+ let e = O(l, a, t);
233
+ if (e && e.from <= u && e.to >= d) {
234
+ let t = o.create(s, e.from, e.to);
235
235
  n.setSelection(t);
236
236
  }
237
237
  }
238
238
  return !0;
239
- }, Le = (e) => (t) => {
239
+ }, He = (e) => (t) => {
240
240
  let n = typeof e == "function" ? e(t) : e;
241
241
  for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
242
242
  return !1;
243
243
  };
244
- function Re(e) {
245
- return e instanceof E;
244
+ function Ue(e) {
245
+ return e instanceof o;
246
246
  }
247
- function F(e = 0, t = 0, n = 0) {
247
+ function A(e = 0, t = 0, n = 0) {
248
248
  return Math.min(Math.max(e, t), n);
249
249
  }
250
- function ze(e, t = null) {
250
+ function We(e, t = null) {
251
251
  if (!t) return null;
252
- let n = T.atStart(e), r = T.atEnd(e);
252
+ let n = a.atStart(e), r = a.atEnd(e);
253
253
  if (t === "start" || t === !0) return n;
254
254
  if (t === "end") return r;
255
- let i = n.from, a = r.to;
256
- return t === "all" ? E.create(e, F(0, i, a), F(e.content.size, i, a)) : E.create(e, F(t, i, a), F(t, i, a));
255
+ 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
257
  }
258
- function Be() {
258
+ function Ge() {
259
259
  return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
260
260
  }
261
- function I() {
261
+ function j() {
262
262
  return [
263
263
  "iPad Simulator",
264
264
  "iPhone Simulator",
@@ -268,16 +268,16 @@ function I() {
268
268
  "iPod"
269
269
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
270
270
  }
271
- function Ve() {
271
+ function Ke() {
272
272
  return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
273
273
  }
274
- var He = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
274
+ var qe = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
275
275
  t = {
276
276
  scrollIntoView: !0,
277
277
  ...t
278
278
  };
279
279
  let o = () => {
280
- (I() || Be()) && r.dom.focus(), Ve() && !I() && !Be() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
280
+ (j() || Ge()) && r.dom.focus(), Ke() && !j() && !Ge() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
281
281
  n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
282
282
  });
283
283
  };
@@ -286,33 +286,33 @@ var He = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
286
286
  } catch {
287
287
  return !1;
288
288
  }
289
- if (a && e === null && !Re(n.state.selection)) return o(), !0;
290
- let s = ze(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
289
+ if (a && e === null && !Ue(n.state.selection)) return o(), !0;
290
+ let s = We(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
291
291
  return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
292
- }, Ue = (e, t) => (n) => e.every((e, r) => t(e, {
292
+ }, Je = (e, t) => (n) => e.every((e, r) => t(e, {
293
293
  ...n,
294
294
  index: r
295
- })), We = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
295
+ })), Ye = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
296
296
  from: n.selection.from,
297
297
  to: n.selection.to
298
- }, e, t), Ge = (e) => {
298
+ }, e, t), Xe = (e) => {
299
299
  let t = e.childNodes;
300
300
  for (let n = t.length - 1; n >= 0; --n) {
301
301
  let r = t[n];
302
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ge(r);
302
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Xe(r);
303
303
  }
304
304
  return e;
305
305
  };
306
- function L(e) {
306
+ function M(e) {
307
307
  if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
308
308
  let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
309
- return Ge(n);
309
+ return Xe(n);
310
310
  }
311
- function Ke(e) {
311
+ function Ze(e) {
312
312
  return typeof e?.nodesBetween == "function";
313
313
  }
314
- function R(e, t, n) {
315
- if (Ke(e)) return e;
314
+ function N(e, t, n) {
315
+ if (Ze(e)) return e;
316
316
  let r = typeof e == "object" && !!e;
317
317
  n = {
318
318
  slice: !0,
@@ -321,16 +321,16 @@ function R(e, t, n) {
321
321
  };
322
322
  let i = typeof e == "string";
323
323
  if (r) try {
324
- if (Array.isArray(e) && e.length > 0) return D.fromArray(e.map((e) => t.nodeFromJSON(e)));
324
+ if (Array.isArray(e) && e.length > 0) return S.fromArray(e.map((e) => t.nodeFromJSON(e)));
325
325
  let r = t.nodeFromJSON(e);
326
326
  return n.errorOnInvalidContent && r.check(), r;
327
327
  } catch (r) {
328
328
  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), R("", t, n);
329
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", r), N("", t, n);
330
330
  }
331
331
  if (i) {
332
332
  if (n.errorOnInvalidContent) {
333
- let r = !1, i = "", a = new le({
333
+ let r = !1, i = "", a = new me({
334
334
  topNode: t.spec.topNode,
335
335
  marks: t.spec.marks,
336
336
  nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
@@ -342,27 +342,27 @@ function R(e, t, n) {
342
342
  }]
343
343
  } })
344
344
  });
345
- if (n.slice ? se.fromSchema(a).parseSlice(L(e), n.parseOptions) : se.fromSchema(a).parse(L(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
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
346
  }
347
- let r = se.fromSchema(t);
348
- return n.slice ? r.parseSlice(L(e), n.parseOptions).content : r.parse(L(e), n.parseOptions);
347
+ let r = fe.fromSchema(t);
348
+ return n.slice ? r.parseSlice(M(e), n.parseOptions).content : r.parse(M(e), n.parseOptions);
349
349
  }
350
- return R("", t, n);
350
+ return N("", t, n);
351
351
  }
352
- function qe(e) {
352
+ function Qe(e) {
353
353
  return !("type" in e);
354
354
  }
355
- function Je(e, r, i) {
356
- let a = e.steps.length - 1;
357
- if (a < r) return;
358
- let o = e.steps[a];
359
- if (!(o instanceof n || o instanceof t)) return;
360
- let s = e.mapping.maps[a], c = 0;
361
- s.forEach((e, t, n, r) => {
362
- c === 0 && (c = r);
363
- }), e.setSelection(T.near(e.doc.resolve(c), i));
364
- }
365
- var Ye = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
355
+ function $e(e, t, n) {
356
+ let r = e.steps.length - 1;
357
+ if (r < t) return;
358
+ let i = e.steps[r];
359
+ if (!(i instanceof l || i instanceof c)) return;
360
+ let o = e.mapping.maps[r], s = 0;
361
+ o.forEach((e, t, n, r) => {
362
+ s === 0 && (s = r);
363
+ }), e.setSelection(a.near(e.doc.resolve(s), n));
364
+ }
365
+ var et = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
366
366
  if (i) {
367
367
  n = {
368
368
  parseOptions: a.options.parseOptions,
@@ -384,7 +384,7 @@ var Ye = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
384
384
  ...n.parseOptions
385
385
  };
386
386
  if (!n.errorOnInvalidContent && !a.options.enableContentCheck && a.options.emitContentError) try {
387
- R(t, a.schema, {
387
+ N(t, a.schema, {
388
388
  parseOptions: s,
389
389
  errorOnInvalidContent: !0
390
390
  });
@@ -392,7 +392,7 @@ var Ye = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
392
392
  o(e);
393
393
  }
394
394
  try {
395
- i = R(t, a.schema, {
395
+ i = N(t, a.schema, {
396
396
  parseOptions: s,
397
397
  errorOnInvalidContent: n.errorOnInvalidContent ?? a.options.enableContentCheck
398
398
  });
@@ -405,7 +405,7 @@ var Ye = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
405
405
  } : {
406
406
  from: e.from,
407
407
  to: e.to
408
- }, u = !0, d = !0, f = qe(i) ? i.content : [i];
408
+ }, u = !0, d = !0, f = Qe(i) ? i.content : [i];
409
409
  if (f.forEach((e) => {
410
410
  e.check(), u = u ? e.isText && e.marks.length === 0 : !1, d = d ? e.isBlock : !1;
411
411
  }), c === l && d) {
@@ -413,13 +413,13 @@ var Ye = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
413
413
  e.isTextblock && !e.type.spec.code && !e.childCount && (--c, l += 1);
414
414
  }
415
415
  let p;
416
- if (u) p = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Ke(t) ? f.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, r.insertText(p, c, l);
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
417
  else {
418
- p = D.from(f);
418
+ p = S.from(f);
419
419
  let e = r.doc.resolve(c), t = e.node(), n = e.parentOffset === 0, i = t.isText || t.isTextblock, a = t.content.size > 0;
420
420
  n && i && a && d && (c = Math.max(0, c - 1)), r.replaceWith(c, l, f);
421
421
  }
422
- n.updateSelection && Je(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
422
+ n.updateSelection && $e(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", {
423
423
  from: c,
424
424
  text: p
425
425
  }), n.applyPasteRules && r.setMeta("applyPasteRules", {
@@ -429,43 +429,43 @@ var Ye = (e, t, n) => ({ tr: r, dispatch: i, editor: a }) => {
429
429
  }
430
430
  return !0;
431
431
  };
432
- function Xe(e) {
432
+ function tt(e) {
433
433
  for (let t = 0; t < e.edgeCount; t += 1) {
434
434
  let { type: n } = e.edge(t);
435
435
  if (n.isTextblock && !n.hasRequiredAttrs()) return n;
436
436
  }
437
437
  return null;
438
438
  }
439
- var Ze = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
439
+ var nt = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
440
440
  let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
441
441
  c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
442
- let l = Xe(c.parent.contentMatchAt(c.index()));
442
+ let l = tt(c.parent.contentMatchAt(c.index()));
443
443
  if (!l) return !1;
444
444
  let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
445
445
  if (o) {
446
- let e = R(o, r.schema);
446
+ let e = N(o, r.schema);
447
447
  f = l.createAndFill(d, e);
448
448
  } else f = l.createAndFill(d);
449
- return f ? (n && (t.insert(c.pos, f), s && Je(t, t.steps.length - 1, -1)), !0) : !1;
450
- }, Qe = () => ({ state: e, dispatch: t }) => g(e, t), $e = () => ({ state: e, dispatch: t }) => f(e, t), et = () => ({ state: e, dispatch: t }) => d(e, t), tt = () => ({ state: e, dispatch: t }) => p(e, t), nt = () => ({ state: e, dispatch: t, tr: n }) => {
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 }) => {
451
451
  try {
452
- let r = s(e.doc, e.selection.$from.pos, -1);
452
+ let r = m(e.doc, e.selection.$from.pos, -1);
453
453
  return r != null && (n.join(r, 2), t && t(n), !0);
454
454
  } catch {
455
455
  return !1;
456
456
  }
457
- }, rt = () => ({ state: e, dispatch: t, tr: n }) => {
457
+ }, ct = () => ({ state: e, dispatch: t, tr: n }) => {
458
458
  try {
459
- let r = s(e.doc, e.selection.$from.pos, 1);
459
+ let r = m(e.doc, e.selection.$from.pos, 1);
460
460
  return r != null && (n.join(r, 2), t && t(n), !0);
461
461
  } catch {
462
462
  return !1;
463
463
  }
464
- }, it = () => ({ state: e, dispatch: t }) => m(e, t), at = () => ({ state: e, dispatch: t }) => h(e, t);
465
- function ot() {
464
+ }, lt = () => ({ state: e, dispatch: t }) => y(e, t), ut = () => ({ state: e, dispatch: t }) => ne(e, t);
465
+ function dt() {
466
466
  return typeof navigator < "u" && /Mac/.test(navigator.platform);
467
467
  }
468
- function st(e) {
468
+ function ft(e) {
469
469
  let t = e.split(/-(?!$)/), n = t[t.length - 1];
470
470
  n === "Space" && (n = " ");
471
471
  let r, i, a, o;
@@ -475,13 +475,13 @@ function st(e) {
475
475
  else if (/^a(lt)?$/i.test(n)) r = !0;
476
476
  else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
477
477
  else if (/^s(hift)?$/i.test(n)) a = !0;
478
- else if (/^mod$/i.test(n)) I() || ot() ? o = !0 : i = !0;
478
+ else if (/^mod$/i.test(n)) j() || dt() ? o = !0 : i = !0;
479
479
  else throw Error(`Unrecognized modifier name: ${n}`);
480
480
  }
481
481
  return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
482
482
  }
483
- var ct = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
484
- let a = st(e).split(/-(?!$)/), o = a.find((e) => ![
483
+ var pt = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
484
+ let a = ft(e).split(/-(?!$)/), o = a.find((e) => ![
485
485
  "Alt",
486
486
  "Ctrl",
487
487
  "Meta",
@@ -502,8 +502,8 @@ var ct = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
502
502
  t && i && r.maybeStep(t);
503
503
  }), !0;
504
504
  };
505
- function z(e, t, n = {}) {
506
- let { from: r, to: i, empty: a } = e.selection, o = t ? j(t, e.schema) : null, s = [];
505
+ function P(e, t, n = {}) {
506
+ let { from: r, to: i, empty: a } = e.selection, o = t ? E(t, e.schema) : null, s = [];
507
507
  e.doc.nodesBetween(r, i, (e, t) => {
508
508
  if (e.isText) return;
509
509
  let n = Math.max(r, t), a = Math.min(i, t + e.nodeSize);
@@ -513,52 +513,52 @@ function z(e, t, n = {}) {
513
513
  to: a
514
514
  });
515
515
  });
516
- let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => M(e.node.attrs, n, { strict: !1 }));
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 }));
517
517
  return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
518
518
  }
519
- var lt = (e, t = {}) => ({ state: n, dispatch: r }) => z(n, j(e, n.schema), t) ? ee(n, r) : !1, ut = () => ({ state: e, dispatch: t }) => te(e, t), dt = (e) => ({ state: t, dispatch: n }) => {
520
- let r = j(e, t.schema);
521
- return de(r)(t, n);
522
- }, ft = () => ({ state: e, dispatch: t }) => _(e, t);
523
- function B(e, t) {
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) {
524
524
  return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
525
525
  }
526
- function pt(e, t) {
526
+ function vt(e, t) {
527
527
  let n = typeof t == "string" ? [t] : t;
528
528
  return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
529
529
  }
530
- var mt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
531
- let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
530
+ 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);
532
532
  if (!s) return !1;
533
- s === "node" && (a = j(e, r.schema)), s === "mark" && (o = P(e, r.schema));
533
+ s === "node" && (a = E(e, r.schema)), s === "mark" && (o = k(e, r.schema));
534
534
  let c = !1;
535
535
  return n.selection.ranges.forEach((e) => {
536
536
  r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
537
- a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0, pt(e.attrs, t))), o && e.marks.length && e.marks.forEach((a) => {
538
- o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(pt(a.attrs, t))));
537
+ a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0, vt(e.attrs, t))), o && e.marks.length && e.marks.forEach((a) => {
538
+ o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(vt(a.attrs, t))));
539
539
  });
540
540
  });
541
541
  }), c;
542
- }, ht = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), gt = () => ({ tr: e, dispatch: t }) => {
543
- if (t) {
544
- let t = new ae(e.doc);
545
- e.setSelection(t);
542
+ }, bt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), xt = () => ({ tr: t, dispatch: n }) => {
543
+ if (n) {
544
+ let n = new e(t.doc);
545
+ t.setSelection(n);
546
546
  }
547
547
  return !0;
548
- }, _t = () => ({ state: e, dispatch: t }) => ne(e, t), vt = () => ({ state: e, dispatch: t }) => v(e, t), yt = () => ({ state: e, dispatch: t }) => re(e, t), bt = () => ({ state: e, dispatch: t }) => ie(e, t), xt = () => ({ state: e, dispatch: t }) => y(e, t);
549
- function St(e, t, n = {}, r = {}) {
550
- return R(e, t, {
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);
549
+ function Dt(e, t, n = {}, r = {}) {
550
+ return N(e, t, {
551
551
  slice: !1,
552
552
  parseOptions: n,
553
553
  errorOnInvalidContent: r.errorOnInvalidContent
554
554
  });
555
555
  }
556
- var Ct = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: i, tr: a, dispatch: o, commands: s }) => {
556
+ var Ot = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: i, tr: a, dispatch: o, commands: s }) => {
557
557
  let { doc: c } = a;
558
558
  if (r.preserveWhitespace !== "full") {
559
- let s = St(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
559
+ let s = Dt(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
560
560
  if (o) {
561
- let e = qe(s) ? s.content : [s];
561
+ let e = Qe(s) ? s.content : [s];
562
562
  a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
563
563
  }
564
564
  return !0;
@@ -571,23 +571,23 @@ var Ct = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {
571
571
  errorOnInvalidContent: t ?? i.options.enableContentCheck
572
572
  });
573
573
  };
574
- function wt(e, t) {
575
- let n = P(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
574
+ function kt(e, t) {
575
+ let n = k(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
576
576
  a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
577
577
  o.push(...e.marks);
578
578
  });
579
579
  let s = o.find((e) => e.type.name === n.name);
580
580
  return s ? { ...s.attrs } : {};
581
581
  }
582
- function Tt(e, t) {
583
- let n = new r(e);
582
+ function At(e, t) {
583
+ let n = new u(e);
584
584
  return t.forEach((e) => {
585
585
  e.steps.forEach((e) => {
586
586
  n.step(e);
587
587
  });
588
588
  }), n;
589
589
  }
590
- function Et(e, t, n) {
590
+ function jt(e, t, n) {
591
591
  let r = [];
592
592
  return e.nodesBetween(t.from, t.to, (e, t) => {
593
593
  n(e) && r.push({
@@ -596,7 +596,7 @@ function Et(e, t, n) {
596
596
  });
597
597
  }), r;
598
598
  }
599
- function Dt(e, t) {
599
+ function Mt(e, t) {
600
600
  for (let n = e.depth; n > 0; --n) {
601
601
  let r = e.node(n);
602
602
  if (t(r)) return {
@@ -607,47 +607,47 @@ function Dt(e, t) {
607
607
  };
608
608
  }
609
609
  }
610
- function Ot(e) {
611
- return (t) => Dt(t.$from, e);
610
+ function I(e) {
611
+ return (t) => Mt(t.$from, e);
612
612
  }
613
- function V(e, t, n) {
614
- return e.config[t] === void 0 && e.parent ? V(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
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({
615
615
  ...n,
616
- parent: e.parent ? V(e.parent, t, n) : null
616
+ parent: e.parent ? L(e.parent, t, n) : null
617
617
  }) : e.config[t];
618
618
  }
619
- function kt(e) {
619
+ function Nt(e) {
620
620
  return e.map((e) => {
621
- let t = V(e, "addExtensions", {
621
+ let t = L(e, "addExtensions", {
622
622
  name: e.name,
623
623
  options: e.options,
624
624
  storage: e.storage
625
625
  });
626
- return t ? [e, ...kt(t())] : e;
626
+ return t ? [e, ...Nt(t())] : e;
627
627
  }).flat(10);
628
628
  }
629
- function At(e, t) {
630
- let n = ce.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
629
+ function Pt(e, t) {
630
+ let n = pe.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
631
631
  return r.appendChild(n), r.innerHTML;
632
632
  }
633
- function jt(e) {
633
+ function Ft(e) {
634
634
  return typeof e == "function";
635
635
  }
636
- function H(e, t = void 0, ...n) {
637
- return jt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
636
+ function R(e, t = void 0, ...n) {
637
+ return Ft(e) ? t ? e.bind(t)(...n) : e(...n) : e;
638
638
  }
639
- function Mt(e = {}) {
639
+ function It(e = {}) {
640
640
  return Object.keys(e).length === 0 && e.constructor === Object;
641
641
  }
642
- function U(e) {
642
+ function z(e) {
643
643
  return {
644
644
  baseExtensions: e.filter((e) => e.type === "extension"),
645
645
  nodeExtensions: e.filter((e) => e.type === "node"),
646
646
  markExtensions: e.filter((e) => e.type === "mark")
647
647
  };
648
648
  }
649
- function Nt(e) {
650
- let t = [], { nodeExtensions: n, markExtensions: r } = U(e), i = [...n, ...r], a = {
649
+ function Lt(e) {
650
+ let t = [], { nodeExtensions: n, markExtensions: r } = z(e), i = [...n, ...r], a = {
651
651
  default: null,
652
652
  validate: void 0,
653
653
  rendered: !0,
@@ -657,7 +657,7 @@ function Nt(e) {
657
657
  isRequired: !1
658
658
  }, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
659
659
  return e.forEach((e) => {
660
- let n = V(e, "addGlobalAttributes", {
660
+ let n = L(e, "addGlobalAttributes", {
661
661
  name: e.name,
662
662
  options: e.options,
663
663
  storage: e.storage,
@@ -679,7 +679,7 @@ function Nt(e) {
679
679
  });
680
680
  });
681
681
  }), i.forEach((e) => {
682
- let n = V(e, "addAttributes", {
682
+ let n = L(e, "addAttributes", {
683
683
  name: e.name,
684
684
  options: e.options,
685
685
  storage: e.storage
@@ -699,7 +699,7 @@ function Nt(e) {
699
699
  });
700
700
  }), t;
701
701
  }
702
- function Pt(e) {
702
+ function Rt(e) {
703
703
  let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
704
704
  for (let s = 0; s < o; s += 1) {
705
705
  let o = e[s];
@@ -729,8 +729,8 @@ function Pt(e) {
729
729
  }
730
730
  return n && t.push(n), t;
731
731
  }
732
- function Ft(e) {
733
- let t = [], n = Pt(e || ""), r = n.length;
732
+ function zt(e) {
733
+ let t = [], n = Rt(e || ""), r = n.length;
734
734
  for (let e = 0; e < r; e += 1) {
735
735
  let r = n[e], i = r.indexOf(":");
736
736
  if (i === -1) continue;
@@ -739,7 +739,7 @@ function Ft(e) {
739
739
  }
740
740
  return t;
741
741
  }
742
- function It(...e) {
742
+ function Bt(...e) {
743
743
  return e.filter((e) => !!e).reduce((e, t) => {
744
744
  let n = { ...e };
745
745
  return Object.entries(t).forEach(([e, t]) => {
@@ -760,26 +760,26 @@ function It(...e) {
760
760
  let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
761
761
  n[e] = [...i, ...a].join(" ");
762
762
  } else if (e === "style") {
763
- let r = new Map([...Ft(n[e]), ...Ft(t)]);
763
+ let r = new Map([...zt(n[e]), ...zt(t)]);
764
764
  n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
765
765
  } else n[e] = t;
766
766
  }), n;
767
767
  }, {});
768
768
  }
769
- function W(e, t) {
770
- 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) => It(e, t), {});
769
+ function B(e, t) {
770
+ 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
771
  }
772
- function Lt(e) {
772
+ function Vt(e) {
773
773
  return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
774
774
  }
775
- function Rt(e, t) {
775
+ function Ht(e, t) {
776
776
  return "style" in e ? e : {
777
777
  ...e,
778
778
  getAttrs: (n) => {
779
779
  let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
780
780
  if (r === !1) return !1;
781
781
  let i = t.reduce((e, t) => {
782
- let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Lt(n.getAttribute(t.name));
782
+ let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : Vt(n.getAttribute(t.name));
783
783
  return r == null ? e : {
784
784
  ...e,
785
785
  [t.name]: r
@@ -792,50 +792,50 @@ function Rt(e, t) {
792
792
  }
793
793
  };
794
794
  }
795
- function zt(e) {
796
- return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Mt(t) ? !1 : t != null));
795
+ function Ut(e) {
796
+ return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && It(t) ? !1 : t != null));
797
797
  }
798
- function Bt(e) {
798
+ function Wt(e) {
799
799
  var t, n;
800
800
  let r = {};
801
801
  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
802
  }
803
- function Vt(e, t) {
804
- let n = Nt(e), { nodeExtensions: r, markExtensions: i } = U(e), a = r.find((e) => V(e, "topNode"))?.name, o = Object.fromEntries(r.map((r) => {
803
+ 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) => {
805
805
  let i = n.filter((e) => e.type === r.name), a = {
806
806
  name: r.name,
807
807
  options: r.options,
808
808
  storage: r.storage,
809
809
  editor: t
810
- }, o = zt({
810
+ }, o = Ut({
811
811
  ...e.reduce((e, t) => {
812
- let n = V(t, "extendNodeSchema", a);
812
+ let n = L(t, "extendNodeSchema", a);
813
813
  return {
814
814
  ...e,
815
815
  ...n ? n(r) : {}
816
816
  };
817
817
  }, {}),
818
- content: H(V(r, "content", a)),
819
- marks: H(V(r, "marks", a)),
820
- group: H(V(r, "group", a)),
821
- inline: H(V(r, "inline", a)),
822
- atom: H(V(r, "atom", a)),
823
- selectable: H(V(r, "selectable", a)),
824
- draggable: H(V(r, "draggable", a)),
825
- code: H(V(r, "code", a)),
826
- whitespace: H(V(r, "whitespace", a)),
827
- linebreakReplacement: H(V(r, "linebreakReplacement", a)),
828
- defining: H(V(r, "defining", a)),
829
- isolating: H(V(r, "isolating", a)),
830
- attrs: Object.fromEntries(i.map(Bt))
831
- }), s = H(V(r, "parseHTML", a));
832
- s && (o.parseDOM = s.map((e) => Rt(e, i)));
833
- let c = V(r, "renderHTML", a);
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)),
830
+ attrs: Object.fromEntries(i.map(Wt))
831
+ }), s = R(L(r, "parseHTML", a));
832
+ s && (o.parseDOM = s.map((e) => Ht(e, i)));
833
+ let c = L(r, "renderHTML", a);
834
834
  c && (o.toDOM = (e) => c({
835
835
  node: e,
836
- HTMLAttributes: W(e, i)
836
+ HTMLAttributes: B(e, i)
837
837
  }));
838
- let l = V(r, "renderText", a);
838
+ let l = L(r, "renderText", a);
839
839
  return l && (o.toText = l), [r.name, o];
840
840
  })), s = Object.fromEntries(i.map((r) => {
841
841
  let i = n.filter((e) => e.type === r.name), a = {
@@ -843,49 +843,49 @@ function Vt(e, t) {
843
843
  options: r.options,
844
844
  storage: r.storage,
845
845
  editor: t
846
- }, o = zt({
846
+ }, o = Ut({
847
847
  ...e.reduce((e, t) => {
848
- let n = V(t, "extendMarkSchema", a);
848
+ let n = L(t, "extendMarkSchema", a);
849
849
  return {
850
850
  ...e,
851
851
  ...n ? n(r) : {}
852
852
  };
853
853
  }, {}),
854
- inclusive: H(V(r, "inclusive", a)),
855
- excludes: H(V(r, "excludes", a)),
856
- group: H(V(r, "group", a)),
857
- spanning: H(V(r, "spanning", a)),
858
- code: H(V(r, "code", a)),
859
- attrs: Object.fromEntries(i.map(Bt))
860
- }), s = H(V(r, "parseHTML", a));
861
- s && (o.parseDOM = s.map((e) => Rt(e, i)));
862
- let c = V(r, "renderHTML", a);
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)),
859
+ attrs: Object.fromEntries(i.map(Wt))
860
+ }), s = R(L(r, "parseHTML", a));
861
+ s && (o.parseDOM = s.map((e) => Ht(e, i)));
862
+ let c = L(r, "renderHTML", a);
863
863
  return c && (o.toDOM = (e) => c({
864
864
  mark: e,
865
- HTMLAttributes: W(e, i)
865
+ HTMLAttributes: B(e, i)
866
866
  })), [r.name, o];
867
867
  }));
868
- return new le({
868
+ return new me({
869
869
  topNode: a,
870
870
  nodes: o,
871
871
  marks: s
872
872
  });
873
873
  }
874
- function Ht(e) {
874
+ function Kt(e) {
875
875
  let t = e.filter((t, n) => e.indexOf(t) !== n);
876
876
  return Array.from(new Set(t));
877
877
  }
878
- function G(e) {
878
+ function V(e) {
879
879
  return e.sort((e, t) => {
880
- let n = V(e, "priority") || 100, r = V(t, "priority") || 100;
880
+ let n = L(e, "priority") || 100, r = L(t, "priority") || 100;
881
881
  return n > r ? -1 : +(n < r);
882
882
  });
883
883
  }
884
- function Ut(e) {
885
- let t = G(kt(e)), n = Ht(t.map((e) => e.name));
884
+ function qt(e) {
885
+ let t = V(Nt(e)), n = Kt(t.map((e) => e.name));
886
886
  return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
887
887
  }
888
- function Wt(e, t, n) {
888
+ function Jt(e, t, n) {
889
889
  let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
890
890
  return e.nodesBetween(r, i, (e, n, c, l) => {
891
891
  e.isBlock && n > r && (s += a);
@@ -903,39 +903,39 @@ function Wt(e, t, n) {
903
903
  }
904
904
  }), s;
905
905
  }
906
- function Gt(e, t) {
907
- return Wt(e, {
906
+ function Yt(e, t) {
907
+ return Jt(e, {
908
908
  from: 0,
909
909
  to: e.content.size
910
910
  }, t);
911
911
  }
912
- function Kt(e) {
912
+ function Xt(e) {
913
913
  return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
914
914
  }
915
- function qt(e, t) {
916
- let n = j(t, e.schema), { from: r, to: i } = e.selection, a = [];
915
+ function Zt(e, t) {
916
+ let n = E(t, e.schema), { from: r, to: i } = e.selection, a = [];
917
917
  e.doc.nodesBetween(r, i, (e) => {
918
918
  a.push(e);
919
919
  });
920
920
  let o = a.reverse().find((e) => e.type.name === n.name);
921
921
  return o ? { ...o.attrs } : {};
922
922
  }
923
- function Jt(e, t) {
924
- let n = B(typeof t == "string" ? t : t.name, e.schema);
925
- return n === "node" ? qt(e, t) : n === "mark" ? wt(e, t) : {};
923
+ function Qt(e, t) {
924
+ let n = F(typeof t == "string" ? t : t.name, e.schema);
925
+ return n === "node" ? Zt(e, t) : n === "mark" ? kt(e, t) : {};
926
926
  }
927
- function Yt(e, t = JSON.stringify) {
927
+ function $t(e, t = JSON.stringify) {
928
928
  let n = {};
929
929
  return e.filter((e) => {
930
930
  let r = t(e);
931
931
  return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
932
932
  });
933
933
  }
934
- function Xt(e) {
935
- let t = Yt(e);
934
+ function en(e) {
935
+ let t = $t(e);
936
936
  return t.length === 1 ? t : t.filter((e, n) => !t.filter((e, t) => t !== n).some((t) => e.oldRange.from >= t.oldRange.from && e.oldRange.to <= t.oldRange.to && e.newRange.from >= t.newRange.from && e.newRange.to <= t.newRange.to));
937
937
  }
938
- function Zt(e) {
938
+ function tn(e) {
939
939
  let { mapping: t, steps: n } = e, r = [];
940
940
  return t.maps.forEach((e, i) => {
941
941
  let a = [];
@@ -966,12 +966,12 @@ function Zt(e) {
966
966
  }
967
967
  });
968
968
  });
969
- }), Xt(r);
969
+ }), en(r);
970
970
  }
971
- function Qt(e, t, n) {
971
+ function H(e, t, n) {
972
972
  let r = [];
973
973
  return e === t ? n.resolve(e).marks().forEach((t) => {
974
- let i = N(n.resolve(e), t.type);
974
+ let i = O(n.resolve(e), t.type);
975
975
  i && r.push({
976
976
  mark: t,
977
977
  ...i
@@ -984,29 +984,29 @@ function Qt(e, t, n) {
984
984
  })));
985
985
  }), r;
986
986
  }
987
- var $t = (e, t, n, r = 20) => {
987
+ var nn = (e, t, n, r = 20) => {
988
988
  let i = e.doc.resolve(n), a = r, o = null;
989
989
  for (; a > 0 && o === null;) {
990
990
  let e = i.node(a);
991
991
  e?.type.name === t ? o = e : --a;
992
992
  }
993
993
  return [o, a];
994
- }, en = (e) => {
994
+ }, rn = (e) => {
995
995
  let t = e.depth - 1;
996
996
  if (t < 0) return null;
997
997
  let n = e.index(t);
998
998
  return n === 0 ? null : e.node(t).child(n - 1);
999
999
  };
1000
- function K(e, t) {
1000
+ function U(e, t) {
1001
1001
  return t.nodes[e] || t.marks[e] || null;
1002
1002
  }
1003
- function q(e, t, n) {
1003
+ function W(e, t, n) {
1004
1004
  return Object.fromEntries(Object.entries(n).filter(([n]) => {
1005
1005
  let r = e.find((e) => e.type === t && e.name === n);
1006
1006
  return r ? r.attribute.keepOnSplit : !1;
1007
1007
  }));
1008
1008
  }
1009
- var tn = (e, t = 500) => {
1009
+ var an = (e, t = 500) => {
1010
1010
  let n = "", r = e.parentOffset;
1011
1011
  return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
1012
1012
  var o;
@@ -1019,9 +1019,9 @@ var tn = (e, t = 500) => {
1019
1019
  n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
1020
1020
  }), n;
1021
1021
  };
1022
- function nn(e, t, n = {}) {
1023
- let { empty: r, ranges: i } = e.selection, a = t ? P(t, e.schema) : null;
1024
- if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => M(e.attrs, n, { strict: !1 }));
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 }));
1025
1025
  let o = 0, s = [];
1026
1026
  if (i.forEach(({ $from: t, $to: n }) => {
1027
1027
  let r = t.pos, i = n.pos;
@@ -1036,41 +1036,41 @@ function nn(e, t, n = {}) {
1036
1036
  })));
1037
1037
  });
1038
1038
  }), o === 0) return !1;
1039
- let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => M(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);
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);
1040
1040
  return (c > 0 ? c + l : c) >= o;
1041
1041
  }
1042
- function rn(e, t, n = {}) {
1043
- if (!t) return z(e, null, n) || nn(e, null, n);
1044
- let r = B(t, e.schema);
1045
- return r === "node" ? z(e, t, n) : r === "mark" && nn(e, t, n);
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
1046
  }
1047
- var an = (e, t) => {
1047
+ var cn = (e, t) => {
1048
1048
  let { $from: n, $to: r, $anchor: i } = e.selection;
1049
1049
  if (t) {
1050
- let n = Ot((e) => e.type.name === t)(e.selection);
1050
+ let n = I((e) => e.type.name === t)(e.selection);
1051
1051
  if (!n) return !1;
1052
1052
  let r = e.doc.resolve(n.pos + 1);
1053
1053
  return i.pos + 1 === r.end();
1054
1054
  }
1055
1055
  return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1056
- }, on = (e) => {
1056
+ }, ln = (e) => {
1057
1057
  let { $from: t, $to: n } = e.selection;
1058
1058
  return !(t.parentOffset > 0 || t.pos !== n.pos);
1059
1059
  };
1060
- function sn(e, t) {
1060
+ function un(e, t) {
1061
1061
  return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
1062
1062
  }
1063
- function cn(e, t) {
1064
- let { nodeExtensions: n } = U(t), r = n.find((t) => t.name === e);
1063
+ function dn(e, t) {
1064
+ let { nodeExtensions: n } = z(t), r = n.find((t) => t.name === e);
1065
1065
  if (!r) return !1;
1066
- let i = H(V(r, "group", {
1066
+ let i = R(L(r, "group", {
1067
1067
  name: r.name,
1068
1068
  options: r.options,
1069
1069
  storage: r.storage
1070
1070
  }));
1071
1071
  return typeof i == "string" && i.split(" ").includes("list");
1072
1072
  }
1073
- function J(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1073
+ function G(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1074
1074
  if (n) {
1075
1075
  if (e.type.name === "hardBreak") return !0;
1076
1076
  if (e.isText) return !/\S/.test(e.text ?? "");
@@ -1081,7 +1081,7 @@ function J(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1081
1081
  if (t) {
1082
1082
  let r = !0;
1083
1083
  return e.content.forEach((e) => {
1084
- r !== !1 && (J(e, {
1084
+ r !== !1 && (G(e, {
1085
1085
  ignoreWhitespace: n,
1086
1086
  checkChildren: t
1087
1087
  }) || (r = !1));
@@ -1089,10 +1089,10 @@ function J(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1089
1089
  }
1090
1090
  return !1;
1091
1091
  }
1092
- function ln(e) {
1093
- return e instanceof S;
1092
+ function fn(e) {
1093
+ return e instanceof n;
1094
1094
  }
1095
- var un = class e {
1095
+ var pn = class e {
1096
1096
  constructor(e) {
1097
1097
  this.position = e;
1098
1098
  }
@@ -1103,18 +1103,18 @@ var un = class e {
1103
1103
  return { position: this.position };
1104
1104
  }
1105
1105
  };
1106
- function dn(e, t) {
1106
+ function mn(e, t) {
1107
1107
  let n = t.mapping.mapResult(e.position);
1108
1108
  return {
1109
- position: new un(n.pos),
1109
+ position: new pn(n.pos),
1110
1110
  mapResult: n
1111
1111
  };
1112
1112
  }
1113
- function fn(e) {
1114
- return new un(e);
1113
+ function hn(e) {
1114
+ return new pn(e);
1115
1115
  }
1116
- function pn(e, t, n) {
1117
- let r = e.state.doc.content.size, i = F(t, 0, r), a = F(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 = {
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 = {
1118
1118
  top: c,
1119
1119
  bottom: l,
1120
1120
  left: u,
@@ -1129,9 +1129,9 @@ function pn(e, t, n) {
1129
1129
  toJSON: () => f
1130
1130
  };
1131
1131
  }
1132
- function mn(e, t, n) {
1132
+ function _n(e, t, n) {
1133
1133
  let { selection: r } = t, i = null;
1134
- if (Re(r) && (i = r.$cursor), i) {
1134
+ if (Ue(r) && (i = r.$cursor), i) {
1135
1135
  let t = e.storedMarks ?? i.marks();
1136
1136
  return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
1137
1137
  }
@@ -1148,11 +1148,11 @@ function mn(e, t, n) {
1148
1148
  }), i;
1149
1149
  });
1150
1150
  }
1151
- var hn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1152
- let { selection: a } = n, { empty: o, ranges: s } = a, c = P(e, r.schema);
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);
1153
1153
  if (i) {
1154
1154
  if (o) {
1155
- let e = wt(r, c);
1155
+ let e = kt(r, c);
1156
1156
  n.addStoredMark(c.create({
1157
1157
  ...e,
1158
1158
  ...t
@@ -1170,23 +1170,23 @@ var hn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1170
1170
  });
1171
1171
  });
1172
1172
  }
1173
- return mn(r, n, c);
1174
- }, gn = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), _n = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
1175
- let a = j(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 }) => b(a, {
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
1177
  ...o,
1178
1178
  ...t
1179
- })(n) ? !0 : e.clearNodes()).command(({ state: e }) => b(a, {
1179
+ })(n) ? !0 : e.clearNodes()).command(({ state: e }) => ue(a, {
1180
1180
  ...o,
1181
1181
  ...t
1182
1182
  })(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
1183
- }, vn = (e) => ({ tr: t, dispatch: n }) => {
1184
- if (n) {
1185
- let { doc: n } = t, r = F(e, 0, n.content.size), i = S.create(n, r);
1186
- t.setSelection(i);
1183
+ }, xn = (e) => ({ tr: t, dispatch: r }) => {
1184
+ if (r) {
1185
+ let { doc: r } = t, i = A(e, 0, r.content.size), a = n.create(r, i);
1186
+ t.setSelection(a);
1187
1187
  }
1188
1188
  return !0;
1189
- }, yn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
1189
+ }, Sn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
1190
1190
  let { selection: a } = r, o, s;
1191
1191
  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
1192
  t.isText || n.setNodeMarkup(r, void 0, {
@@ -1194,157 +1194,157 @@ var hn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1194
1194
  dir: e
1195
1195
  });
1196
1196
  }), !0;
1197
- }, bn = (e) => ({ tr: t, dispatch: n }) => {
1197
+ }, Cn = (e) => ({ tr: t, dispatch: n }) => {
1198
1198
  if (n) {
1199
1199
  let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
1200
1200
  from: e,
1201
1201
  to: e
1202
- } : e, a = E.atStart(n).from, o = E.atEnd(n).to, s = F(r, a, o), c = F(i, a, o), l = E.create(n, s, c);
1203
- t.setSelection(l);
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);
1203
+ t.setSelection(u);
1204
1204
  }
1205
1205
  return !0;
1206
- }, xn = (e) => ({ state: t, dispatch: n }) => {
1207
- let r = j(e, t.schema);
1208
- return fe(r)(t, n);
1206
+ }, wn = (e) => ({ state: t, dispatch: n }) => {
1207
+ let r = E(e, t.schema);
1208
+ return _e(r)(t, n);
1209
1209
  };
1210
- function Sn(e, t) {
1210
+ function Tn(e, t) {
1211
1211
  let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1212
1212
  if (n) {
1213
1213
  let r = n.filter((e) => t?.includes(e.type.name));
1214
1214
  e.tr.ensureMarks(r);
1215
1215
  }
1216
1216
  }
1217
- var Cn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
1218
- let { selection: o, doc: s } = t, { $from: c, $to: l } = o, u = i.extensionManager.attributes, d = q(u, c.node().type.name, c.node().attrs);
1219
- if (o instanceof S && o.node.isBlock) return !c.parentOffset || !a(s, c.pos) ? !1 : (r && (e && Sn(n, i.extensionManager.splittableMarks), t.split(c.pos).scrollIntoView()), !0);
1220
- if (!c.parent.isBlock) return !1;
1221
- let f = l.parentOffset === l.parent.content.size, p = c.depth === 0 ? void 0 : Xe(c.node(-1).contentMatchAt(c.indexAfter(-1))), m = f && p ? [{
1222
- type: p,
1223
- attrs: d
1224
- }] : void 0, h = a(t.doc, t.mapping.map(c.pos), 1, m);
1225
- if (!m && !h && a(t.doc, t.mapping.map(c.pos), 1, p ? [{ type: p }] : void 0) && (h = !0, m = p ? [{
1226
- type: p,
1227
- attrs: d
1228
- }] : void 0), r) {
1229
- if (h && (o instanceof E && t.deleteSelection(), t.split(t.mapping.map(c.pos), 1, m), p && !f && !c.parentOffset && c.parent.type !== p)) {
1230
- let e = t.mapping.map(c.before()), n = t.doc.resolve(e);
1231
- c.node(-1).canReplaceWith(n.index(), n.index() + 1, p) && t.setNodeMarkup(t.mapping.map(c.before()), p);
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);
1232
1232
  }
1233
- e && Sn(n, i.extensionManager.splittableMarks), t.scrollIntoView();
1233
+ e && Tn(r, a.extensionManager.splittableMarks), t.scrollIntoView();
1234
1234
  }
1235
- return h;
1236
- }, wn = (e, t = {}) => ({ tr: n, state: r, dispatch: i, editor: o }) => {
1237
- let s = j(e, r.schema), { $from: c, $to: l } = r.selection, u = r.selection.node;
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;
1238
1238
  if (u && u.isBlock || c.depth < 2 || !c.sameParent(l)) return !1;
1239
1239
  let d = c.node(-1);
1240
1240
  if (d.type !== s) return !1;
1241
- let f = o.extensionManager.attributes;
1241
+ let p = a.extensionManager.attributes;
1242
1242
  if (c.parent.content.size === 0 && c.node(-1).childCount === c.indexAfter(-1)) {
1243
1243
  if (c.depth === 2 || c.node(-3).type !== s || c.index(-2) !== c.node(-2).childCount - 1) return !1;
1244
1244
  if (i) {
1245
- let e = D.empty, r = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1246
- for (let t = c.depth - r; t >= c.depth - 3; --t) e = D.from(c.node(t).copy(e));
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));
1247
1247
  let i = c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3, a = {
1248
- ...q(f, c.node().type.name, c.node().attrs),
1248
+ ...W(p, c.node().type.name, c.node().attrs),
1249
1249
  ...t
1250
- }, o = s.contentMatch.defaultType?.createAndFill(a) || void 0;
1251
- e = e.append(D.from(s.createAndFill(null, o) || void 0));
1252
- let l = c.before(c.depth - (r - 1));
1253
- n.replace(l, c.after(-i), new ue(e, 4 - r, 0));
1254
- let u = -1;
1255
- n.doc.nodesBetween(l, n.doc.content.size, (e, t) => {
1256
- if (u > -1) return !1;
1257
- e.isTextblock && e.content.size === 0 && (u = t + 1);
1258
- }), u > -1 && n.setSelection(E.near(n.doc.resolve(u))), n.scrollIntoView();
1250
+ }, l = s.contentMatch.defaultType?.createAndFill(a) || void 0;
1251
+ e = e.append(S.from(s.createAndFill(null, l) || void 0));
1252
+ let u = c.before(c.depth - (r - 1));
1253
+ n.replace(u, c.after(-i), new he(e, 4 - r, 0));
1254
+ let d = -1;
1255
+ n.doc.nodesBetween(u, n.doc.content.size, (e, t) => {
1256
+ if (d > -1) return !1;
1257
+ e.isTextblock && e.content.size === 0 && (d = t + 1);
1258
+ }), d > -1 && n.setSelection(o.near(n.doc.resolve(d))), n.scrollIntoView();
1259
1259
  }
1260
1260
  return !0;
1261
1261
  }
1262
- let p = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, m = {
1263
- ...q(f, d.type.name, d.attrs),
1262
+ let m = l.pos === c.end() ? d.contentMatchAt(0).defaultType : null, h = {
1263
+ ...W(p, d.type.name, d.attrs),
1264
1264
  ...t
1265
- }, h = {
1266
- ...q(f, c.node().type.name, c.node().attrs),
1265
+ }, g = {
1266
+ ...W(p, c.node().type.name, c.node().attrs),
1267
1267
  ...t
1268
1268
  };
1269
1269
  n.delete(c.pos, l.pos);
1270
- let g = p ? [{
1270
+ let _ = m ? [{
1271
1271
  type: s,
1272
- attrs: m
1273
- }, {
1274
- type: p,
1275
1272
  attrs: h
1273
+ }, {
1274
+ type: m,
1275
+ attrs: g
1276
1276
  }] : [{
1277
1277
  type: s,
1278
- attrs: m
1278
+ attrs: h
1279
1279
  }];
1280
- if (!a(n.doc, c.pos, 2)) return !1;
1280
+ if (!f(n.doc, c.pos, 2)) return !1;
1281
1281
  if (i) {
1282
- let { selection: e, storedMarks: t } = r, { splittableMarks: a } = o.extensionManager, s = t || e.$to.parentOffset && e.$from.marks();
1283
- if (n.split(c.pos, 2, g).scrollIntoView(), !s || !i) return !0;
1284
- let l = s.filter((e) => a.includes(e.type.name));
1282
+ 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;
1284
+ let l = s.filter((e) => o.includes(e.type.name));
1285
1285
  n.ensureMarks(l);
1286
1286
  }
1287
1287
  return !0;
1288
1288
  };
1289
- function Tn(e) {
1289
+ function On(e) {
1290
1290
  return !e || e === "1" ? null : e;
1291
1291
  }
1292
- function En(e, t) {
1293
- return Tn(e) === Tn(t);
1292
+ function kn(e, t) {
1293
+ return On(e) === On(t);
1294
1294
  }
1295
- var Dn = (e, t) => {
1296
- let n = Ot((e) => e.type === t)(e.selection);
1295
+ var An = (e, t) => {
1296
+ let n = I((e) => e.type === t)(e.selection);
1297
1297
  if (!n) return !0;
1298
1298
  let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1299
1299
  if (r === void 0) return !0;
1300
- let a = e.doc.nodeAt(r);
1301
- return !(n.node.type === a?.type && i(e.doc, n.pos)) || !En(n.node.attrs.type, a?.attrs.type) || e.join(n.pos), !0;
1302
- }, On = (e, t) => {
1303
- let n = Ot((e) => e.type === t)(e.selection);
1300
+ 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);
1304
1304
  if (!n) return !0;
1305
1305
  let r = e.doc.resolve(n.start).after(n.depth);
1306
1306
  if (r === void 0) return !0;
1307
- let a = e.doc.nodeAt(r);
1308
- return !(n.node.type === a?.type && i(e.doc, r)) || !En(n.node.attrs.type, a?.attrs.type) || e.join(r), !0;
1307
+ 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;
1309
1309
  };
1310
- function kn(e) {
1310
+ function Mn(e) {
1311
1311
  let t = e.doc, n = t.firstChild;
1312
1312
  if (!n) return null;
1313
1313
  let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
1314
- return E.between(r, i);
1314
+ return o.between(r, i);
1315
1315
  }
1316
- var An = (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 = j(e, o.schema), m = j(t, o.schema), { selection: h, storedMarks: g } = o, { $from: ee, $to: te } = h, _ = ee.blockRange(te), ne = g || h.$to.parentOffset && h.$from.marks();
1318
- if (!_) return !1;
1319
- let v = Ot((e) => cn(e.type.name, d))(h), re = h.from === 0 && h.to === o.doc.content.size, ie = o.doc.content.content, y = ie.length === 1 ? ie[0] : null, b = re && y && cn(y.type.name, d) ? {
1320
- node: y,
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,
1321
1321
  pos: 0,
1322
1322
  depth: 0
1323
- } : null, x = v ?? b, ae = !!v && _.depth >= 1 && _.depth - v.depth <= 1, oe = !!b;
1323
+ } : null, x = y ?? ie, ae = !!y && v.depth >= 1 && v.depth - y.depth <= 1, oe = !!ie;
1324
1324
  if ((ae || oe) && x) {
1325
- if (x.node.type === p) return re && oe ? c().command(({ tr: e, dispatch: t }) => {
1326
- let n = kn(e);
1325
+ if (x.node.type === p) return ne && oe ? c().command(({ tr: e, dispatch: t }) => {
1326
+ let n = Mn(e);
1327
1327
  return n ? (e.setSelection(n), t && t(e), !0) : !1;
1328
1328
  }).liftListItem(m).run() : l.liftListItem(m);
1329
- if (cn(x.node.type.name, d) && p.validContent(x.node.content)) return c().command(() => (a.setNodeMarkup(x.pos, p), !0)).command(() => Dn(a, p)).command(() => On(a, p)).run();
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();
1330
1330
  }
1331
- return !n || !ne || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => Dn(a, p)).command(() => On(a, p)).run() : c().command(() => {
1332
- let e = u().wrapInList(p, r), t = ne.filter((e) => f.includes(e.type.name));
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));
1333
1333
  return a.ensureMarks(t), e ? !0 : l.clearNodes();
1334
- }).wrapInList(p, r).command(() => Dn(a, p)).command(() => On(a, p)).run();
1335
- }, jn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
1336
- let { extendEmptyMarkRange: a = !1 } = n, o = P(e, r.schema);
1337
- return nn(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
1338
- }, Mn = (e, t, n = {}) => ({ state: r, commands: i }) => {
1339
- let a = j(e, r.schema), o = j(t, r.schema), s = z(r, a, n), c;
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;
1340
1340
  return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
1341
1341
  ...c,
1342
1342
  ...n
1343
1343
  });
1344
- }, Nn = (e, t = {}) => ({ state: n, commands: r }) => {
1345
- let i = j(e, n.schema);
1346
- return z(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
1347
- }, Pn = () => ({ state: e, dispatch: t }) => {
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 }) => {
1348
1348
  let n = e.plugins;
1349
1349
  for (let r = 0; r < n.length; r += 1) {
1350
1350
  let i = n[r], a;
@@ -1361,7 +1361,7 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1361
1361
  }
1362
1362
  }
1363
1363
  return !1;
1364
- }, Fn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
1364
+ }, Rn = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
1365
1365
  let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
1366
1366
  if (o) return !0;
1367
1367
  let { nonClearableMarks: c } = r.extensionManager;
@@ -1372,27 +1372,27 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1372
1372
  });
1373
1373
  }
1374
1374
  return !0;
1375
- }, In = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1376
- let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = P(e, r.schema), { $from: c, empty: l, ranges: u } = o;
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;
1377
1377
  if (!i) return !0;
1378
1378
  if (l && a) {
1379
- let { from: e, to: t } = o, r = N(c, s, c.marks().find((e) => e.type === s)?.attrs);
1379
+ let { from: e, to: t } = o, r = O(c, s, c.marks().find((e) => e.type === s)?.attrs);
1380
1380
  r && (e = r.from, t = r.to), n.removeMark(e, t, s);
1381
1381
  } else u.forEach((e) => {
1382
1382
  n.removeMark(e.$from.pos, e.$to.pos, s);
1383
1383
  });
1384
1384
  return n.removeStoredMark(s), !0;
1385
- }, Ln = (e) => ({ tr: t, state: n, dispatch: r }) => {
1385
+ }, Bn = (e) => ({ tr: t, state: n, dispatch: r }) => {
1386
1386
  let { selection: i } = n, a, o;
1387
1387
  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
1388
  if (e.isText) return;
1389
1389
  let r = { ...e.attrs };
1390
1390
  delete r.dir, t.setNodeMarkup(n, void 0, r);
1391
1391
  }), !0;
1392
- }, Rn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1393
- let a = null, o = null, s = B(typeof e == "string" ? e : e.name, r.schema);
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);
1394
1394
  if (!s) return !1;
1395
- s === "node" && (a = j(e, r.schema)), s === "mark" && (o = P(e, r.schema));
1395
+ s === "node" && (a = E(e, r.schema)), s === "mark" && (o = k(e, r.schema));
1396
1396
  let c = !1;
1397
1397
  return n.selection.ranges.forEach((e) => {
1398
1398
  let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
@@ -1421,92 +1421,92 @@ var An = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
1421
1421
  }));
1422
1422
  }));
1423
1423
  }), c;
1424
- }, Y = new w("__tiptap_decorations__"), zn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(Y, {
1424
+ }, K = new i("__tiptap_decorations__"), Hn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(K, {
1425
1425
  type: "force",
1426
1426
  name: e
1427
- }), !0), Bn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1428
- let i = j(e, n.schema);
1429
- return x(i, t)(n, r);
1430
- }, Vn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1431
- let i = j(e, n.schema);
1432
- return pe(i, t)(n, r);
1433
- }, Hn = /* @__PURE__ */ _e({
1434
- blur: () => ve,
1435
- clearContent: () => ye,
1436
- clearNodes: () => be,
1437
- command: () => xe,
1438
- createParagraphNear: () => Se,
1439
- cut: () => Ce,
1440
- deleteCurrentNode: () => we,
1441
- deleteNode: () => Te,
1442
- deleteRange: () => Ee,
1443
- deleteSelection: () => Ae,
1444
- enter: () => je,
1445
- exitCode: () => Me,
1446
- extendMarkRange: () => Ie,
1447
- first: () => Le,
1448
- focus: () => He,
1449
- forEach: () => Ue,
1450
- insertContent: () => We,
1451
- insertContentAt: () => Ye,
1452
- insertDefaultBlock: () => Ze,
1453
- joinBackward: () => et,
1454
- joinDown: () => $e,
1455
- joinForward: () => tt,
1456
- joinItemBackward: () => nt,
1457
- joinItemForward: () => rt,
1458
- joinTextblockBackward: () => it,
1459
- joinTextblockForward: () => at,
1460
- joinUp: () => Qe,
1461
- keyboardShortcut: () => ct,
1462
- lift: () => lt,
1463
- liftEmptyBlock: () => ut,
1464
- liftListItem: () => dt,
1465
- newlineInCode: () => ft,
1466
- resetAttributes: () => mt,
1467
- scrollIntoView: () => ht,
1468
- selectAll: () => gt,
1469
- selectNodeBackward: () => _t,
1470
- selectNodeForward: () => vt,
1471
- selectParentNode: () => yt,
1472
- selectTextblockEnd: () => bt,
1473
- selectTextblockStart: () => xt,
1474
- setContent: () => Ct,
1475
- setMark: () => hn,
1476
- setMeta: () => gn,
1477
- setNode: () => _n,
1478
- setNodeSelection: () => vn,
1479
- setTextDirection: () => yn,
1480
- setTextSelection: () => bn,
1481
- sinkListItem: () => xn,
1482
- splitBlock: () => Cn,
1483
- splitListItem: () => wn,
1484
- toggleList: () => An,
1485
- toggleMark: () => jn,
1486
- toggleNode: () => Mn,
1487
- toggleWrap: () => Nn,
1488
- undoInputRule: () => Pn,
1489
- unsetAllMarks: () => Fn,
1490
- unsetMark: () => In,
1491
- unsetTextDirection: () => Ln,
1492
- updateAttributes: () => Rn,
1493
- updateDecorations: () => zn,
1494
- wrapIn: () => Bn,
1495
- wrapInList: () => Vn
1496
- }), X = /* @__PURE__ */ new WeakMap();
1497
- function Un(e, t) {
1498
- X.set(e, (X.get(e) ?? 0) + 1);
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,
1446
+ extendMarkRange: () => Ve,
1447
+ 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,
1456
+ joinItemBackward: () => st,
1457
+ joinItemForward: () => ct,
1458
+ joinTextblockBackward: () => lt,
1459
+ joinTextblockForward: () => ut,
1460
+ joinUp: () => rt,
1461
+ keyboardShortcut: () => pt,
1462
+ lift: () => mt,
1463
+ liftEmptyBlock: () => ht,
1464
+ liftListItem: () => gt,
1465
+ newlineInCode: () => _t,
1466
+ resetAttributes: () => yt,
1467
+ scrollIntoView: () => bt,
1468
+ selectAll: () => xt,
1469
+ selectNodeBackward: () => St,
1470
+ selectNodeForward: () => Ct,
1471
+ selectParentNode: () => wt,
1472
+ selectTextblockEnd: () => Tt,
1473
+ selectTextblockStart: () => Et,
1474
+ 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);
1499
1499
  try {
1500
1500
  return t();
1501
1501
  } finally {
1502
- let t = (X.get(e) ?? 1) - 1;
1503
- t > 0 ? X.set(e, t) : X.delete(e);
1502
+ let t = (q.get(e) ?? 1) - 1;
1503
+ t > 0 ? q.set(e, t) : q.delete(e);
1504
1504
  }
1505
1505
  }
1506
- function Wn(e) {
1507
- return X.has(e);
1506
+ function qn(e) {
1507
+ return q.has(e);
1508
1508
  }
1509
- var Gn = class {
1509
+ var Jn = class {
1510
1510
  constructor() {
1511
1511
  this.callbacks = {};
1512
1512
  }
@@ -1530,44 +1530,44 @@ var Gn = class {
1530
1530
  removeAllListeners() {
1531
1531
  this.callbacks = {};
1532
1532
  }
1533
- }, Kn = typeof process < "u" && process.env.NODE_ENV !== "production";
1534
- function qn(e) {
1533
+ }, Yn = typeof process < "u" && process.env.NODE_ENV !== "production";
1534
+ function Xn(e) {
1535
1535
  return e.kind === "widget";
1536
1536
  }
1537
- function Jn(e, t) {
1537
+ function Zn(e, t) {
1538
1538
  let n = [], r = /* @__PURE__ */ new Set();
1539
- for (let i of e) i.kind === "widget" && qn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
1539
+ for (let i of e) i.kind === "widget" && Xn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
1540
1540
  return {
1541
1541
  decorations: n,
1542
1542
  widgetKeys: r
1543
1543
  };
1544
1544
  }
1545
- function Yn(e, t, n) {
1546
- let { decorations: r, widgetKeys: i } = Jn(t, n);
1545
+ function Qn(e, t, n) {
1546
+ let { decorations: r, widgetKeys: i } = Zn(t, n);
1547
1547
  return {
1548
- set: O.create(e, r),
1548
+ set: C.create(e, r),
1549
1549
  widgetKeys: i
1550
1550
  };
1551
1551
  }
1552
- function Xn({ position: e, from: t, to: n, docSize: r }) {
1552
+ function $n({ position: e, from: t, to: n, docSize: r }) {
1553
1553
  return e < t ? !1 : e < n || e === n && n === r;
1554
1554
  }
1555
- function Zn({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
1556
- return e.filter((e) => Xn({
1555
+ function er({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
1556
+ return e.filter((e) => $n({
1557
1557
  position: e.anchor,
1558
1558
  from: t,
1559
1559
  to: n,
1560
1560
  docSize: r
1561
1561
  }) ? !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
1562
  }
1563
- function Qn(e) {
1563
+ function tr(e) {
1564
1564
  let t = e.spec?.key;
1565
1565
  return typeof t == "string" ? t : void 0;
1566
1566
  }
1567
- function $n(e) {
1567
+ function nr(e) {
1568
1568
  let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1569
1569
  for (let r of e.find()) {
1570
- let e = Qn(r);
1570
+ let e = tr(r);
1571
1571
  if (!e) continue;
1572
1572
  let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
1573
1573
  a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
@@ -1577,18 +1577,18 @@ function $n(e) {
1577
1577
  extensions: t
1578
1578
  })).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
1579
1579
  }
1580
- function er(e) {
1580
+ function rr(e) {
1581
1581
  return e.jsonID === "attr";
1582
1582
  }
1583
- function tr(e) {
1583
+ function ir(e) {
1584
1584
  let t = !1;
1585
1585
  if (e.getMap().forEach(() => {
1586
1586
  t = !0;
1587
- }), t || er(e)) return !0;
1587
+ }), t || rr(e)) return !0;
1588
1588
  let n = e;
1589
1589
  return typeof n.from == "number" && typeof n.to == "number";
1590
1590
  }
1591
- function nr(e, t) {
1591
+ function ar(e, t) {
1592
1592
  let n = null, r = 0, i = 0;
1593
1593
  for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
1594
1594
  let o = i + e.child(a).nodeSize;
@@ -1599,11 +1599,11 @@ function nr(e, t) {
1599
1599
  to: r
1600
1600
  };
1601
1601
  }
1602
- function rr(e, t) {
1603
- if (e.steps.some((e) => !tr(e))) return { type: "full" };
1604
- let n = Zt(e).map(({ newRange: e }) => e);
1602
+ function or(e, t) {
1603
+ if (e.steps.some((e) => !ir(e))) return { type: "full" };
1604
+ let n = tn(e).map(({ newRange: e }) => e);
1605
1605
  e.steps.forEach((t, r) => {
1606
- if (!er(t)) return;
1606
+ if (!rr(t)) return;
1607
1607
  let i = e.mapping.slice(r);
1608
1608
  n.push({
1609
1609
  from: i.map(t.pos, -1),
@@ -1612,7 +1612,7 @@ function rr(e, t) {
1612
1612
  });
1613
1613
  let r = [];
1614
1614
  for (let e of n) {
1615
- let n = nr(t, e);
1615
+ let n = ar(t, e);
1616
1616
  n && r.push(n);
1617
1617
  }
1618
1618
  r.sort((e, t) => e.from - t.from);
@@ -1626,29 +1626,29 @@ function rr(e, t) {
1626
1626
  ranges: i
1627
1627
  };
1628
1628
  }
1629
- function ir(e, t, n, r) {
1629
+ function sr(e, t, n, r) {
1630
1630
  return e.map(t, n, { onRemove: (e) => {
1631
1631
  let t = e?.key;
1632
1632
  typeof t == "string" && r.delete(t);
1633
1633
  } });
1634
1634
  }
1635
- function ar(e, t, n) {
1636
- let r = t.decorationSetsByExtension[e] ?? O.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
1635
+ function cr(e, t, n) {
1636
+ let r = t.decorationSetsByExtension[e] ?? C.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
1637
1637
  return {
1638
- set: ir(r, n.mapping, n.doc, i),
1638
+ set: sr(r, n.mapping, n.doc, i),
1639
1639
  widgetKeys: i
1640
1640
  };
1641
1641
  }
1642
- function or(e, t) {
1642
+ function lr(e, t) {
1643
1643
  let n = Object.values(t).flatMap((e) => e.find());
1644
- return O.create(e, n);
1644
+ return C.create(e, n);
1645
1645
  }
1646
- function sr(e) {
1646
+ function ur(e) {
1647
1647
  let t = /* @__PURE__ */ new Set();
1648
1648
  for (let n of Object.values(e)) for (let e of n) t.add(e);
1649
1649
  return t;
1650
1650
  }
1651
- function cr(e, t) {
1651
+ function dr(e, t) {
1652
1652
  switch (t.update ?? "document") {
1653
1653
  case "document":
1654
1654
  if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
@@ -1663,21 +1663,21 @@ function cr(e, t) {
1663
1663
  default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
1664
1664
  }
1665
1665
  }
1666
- function lr(e, t, n) {
1666
+ function fr(e, t, n) {
1667
1667
  return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
1668
1668
  }
1669
- var ur = /* @__PURE__ */ new Set(), dr = class {
1669
+ var pr = /* @__PURE__ */ new Set(), mr = class {
1670
1670
  constructor(e) {
1671
1671
  this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
1672
- let t = Y.getState(e);
1672
+ let t = K.getState(e);
1673
1673
  t && this.warnDuplicateWidgetKeys(t);
1674
- }, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => cr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
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);
1675
1675
  }
1676
1676
  destroy() {
1677
1677
  this.editor.off("beforeTransaction", this.handleBeforeTransaction);
1678
1678
  }
1679
1679
  liveWidgetKeys() {
1680
- return Y.getState(this.editor.state)?.widgetKeys ?? ur;
1680
+ return K.getState(this.editor.state)?.widgetKeys ?? pr;
1681
1681
  }
1682
1682
  get mountedView() {
1683
1683
  return this.editor.isDestroyed ? null : this.editor.view;
@@ -1695,8 +1695,8 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
1695
1695
  }
1696
1696
  createPlugin() {
1697
1697
  let { editor: e, entries: t } = this;
1698
- return new C({
1699
- key: Y,
1698
+ return new r({
1699
+ key: K,
1700
1700
  state: {
1701
1701
  init: (e, n) => {
1702
1702
  let r = {}, i = {};
@@ -1708,22 +1708,22 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
1708
1708
  decorationSetsByExtension: r,
1709
1709
  widgetKeysByExtension: i,
1710
1710
  mergedDecorationSet: this.buildMergedSet(n.doc, r),
1711
- widgetKeys: sr(i)
1711
+ widgetKeys: ur(i)
1712
1712
  };
1713
1713
  return this.warnDuplicateWidgetKeys(a), a;
1714
1714
  },
1715
1715
  apply: (n, r, i, a) => {
1716
- let o = n.getMeta(Y), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
1717
- return Un(e, () => {
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, () => {
1718
1718
  for (let { name: o, spec: f } of t) {
1719
1719
  let t = s || c === o;
1720
- if (!lr(f, {
1720
+ if (!fr(f, {
1721
1721
  editor: e,
1722
1722
  tr: n,
1723
1723
  oldState: i,
1724
1724
  newState: a
1725
1725
  }, t)) {
1726
- let e = ar(o, r, n);
1726
+ let e = cr(o, r, n);
1727
1727
  l[o] = e.set, u[o] = e.widgetKeys;
1728
1728
  } else if (f.update === "changedRanges" && n.docChanged && !t) {
1729
1729
  let e = this.applyChangedRangesRecompute(o, f, r, n, a);
@@ -1743,34 +1743,34 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
1743
1743
  decorationSetsByExtension: l,
1744
1744
  recomputedNames: d
1745
1745
  }),
1746
- widgetKeys: sr(u)
1746
+ widgetKeys: ur(u)
1747
1747
  };
1748
1748
  }
1749
1749
  },
1750
1750
  props: { decorations(e) {
1751
- return Y.getState(e)?.mergedDecorationSet ?? O.empty;
1751
+ return K.getState(e)?.mergedDecorationSet ?? C.empty;
1752
1752
  } }
1753
1753
  });
1754
1754
  }
1755
1755
  applyChangedRangesRecompute(e, t, n, r, i) {
1756
- let a = rr(r, i.doc);
1756
+ let a = or(r, i.doc);
1757
1757
  return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
1758
1758
  }
1759
1759
  rebuildRanges(e, t, n, r, i, a) {
1760
- let o = n.decorationSetsByExtension[e] ?? O.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = ir(o, r.mapping, r.doc, s), l = i.doc.content.size;
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;
1761
1761
  for (let { from: n, to: r } of a) {
1762
- let a = c.find(n, r).filter((e) => Xn({
1762
+ let a = c.find(n, r).filter((e) => $n({
1763
1763
  position: e.from,
1764
1764
  from: n,
1765
1765
  to: r,
1766
1766
  docSize: l
1767
1767
  }));
1768
1768
  for (let e of a) {
1769
- let t = Qn(e);
1769
+ let t = tr(e);
1770
1770
  t && s.delete(t);
1771
1771
  }
1772
1772
  c = c.remove(a);
1773
- let { decorations: o, widgetKeys: u } = Jn(Zn({
1773
+ let { decorations: o, widgetKeys: u } = Zn(er({
1774
1774
  decorations: this.runCreate(e, "createInRange", () => t.createInRange({
1775
1775
  editor: this.editor,
1776
1776
  state: i,
@@ -1798,7 +1798,7 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
1798
1798
  state: n,
1799
1799
  view: this.mountedView
1800
1800
  }));
1801
- return Yn(n.doc, r, e);
1801
+ return Qn(n.doc, r, e);
1802
1802
  }
1803
1803
  runCreate(e, t, n) {
1804
1804
  try {
@@ -1808,12 +1808,12 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
1808
1808
  }
1809
1809
  }
1810
1810
  warnDuplicateWidgetKeys(e) {
1811
- if (!Kn) return;
1811
+ if (!Yn) return;
1812
1812
  if (e.widgetKeys.size === 0) {
1813
1813
  this.warnedWidgetKeys.clear();
1814
1814
  return;
1815
1815
  }
1816
- let t = $n(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
1816
+ let t = nr(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
1817
1817
  for (let { key: e, extensions: n } of t) {
1818
1818
  if (this.warnedWidgetKeys.has(e)) continue;
1819
1819
  let t = Array.from(n).map((e) => `"${e}"`).join(", ");
@@ -1823,36 +1823,36 @@ var ur = /* @__PURE__ */ new Set(), dr = class {
1823
1823
  }
1824
1824
  buildMergedSet(e, t) {
1825
1825
  let n = Object.keys(t);
1826
- return n.length === 1 ? t[n[0]] : or(e, t);
1826
+ return n.length === 1 ? t[n[0]] : lr(e, t);
1827
1827
  }
1828
1828
  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) : or(n.doc, r);
1829
+ return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : lr(n.doc, r);
1830
1830
  }
1831
1831
  };
1832
- function fr(e, t) {
1833
- let { selection: n } = e, { $from: r } = n;
1834
- if (n instanceof S) {
1835
- let e = r.index();
1836
- return r.parent.canReplaceWith(e, e + 1, t);
1837
- }
1838
- let i = r.depth;
1839
- for (; i >= 0;) {
1840
- let e = r.index(i);
1841
- if (r.node(i).contentMatchAt(e).matchType(t)) return !0;
1842
- --i;
1832
+ function hr(e, t) {
1833
+ let { selection: r } = e, { $from: i } = r;
1834
+ if (r instanceof n) {
1835
+ let e = i.index();
1836
+ return i.parent.canReplaceWith(e, e + 1, t);
1837
+ }
1838
+ let a = i.depth;
1839
+ for (; a >= 0;) {
1840
+ let e = i.index(a);
1841
+ if (i.node(a).contentMatchAt(e).matchType(t)) return !0;
1842
+ --a;
1843
1843
  }
1844
1844
  return !1;
1845
1845
  }
1846
- function pr(e, t, n) {
1846
+ function gr(e, t, n) {
1847
1847
  let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
1848
1848
  if (r !== null) return r;
1849
1849
  let i = document.createElement("style");
1850
1850
  return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
1851
1851
  }
1852
- function mr(e) {
1852
+ function _r(e) {
1853
1853
  return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
1854
1854
  }
1855
- function hr(e, t) {
1855
+ function vr(e, t) {
1856
1856
  let n = e.getAttribute("style");
1857
1857
  if (!n) return null;
1858
1858
  let r = n.split(";").map((e) => e.trim()).filter(Boolean), i = t.toLowerCase();
@@ -1862,19 +1862,19 @@ function hr(e, t) {
1862
1862
  }
1863
1863
  return null;
1864
1864
  }
1865
- function gr() {
1865
+ function yr() {
1866
1866
  return typeof navigator < "u" && /Firefox/.test(navigator.userAgent);
1867
1867
  }
1868
- function _r(e) {
1868
+ function br(e) {
1869
1869
  return typeof e == "number";
1870
1870
  }
1871
- function vr(e) {
1871
+ function xr(e) {
1872
1872
  return Object.prototype.toString.call(e).slice(8, -1);
1873
1873
  }
1874
- function Z(e) {
1875
- return vr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1874
+ function J(e) {
1875
+ return xr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1876
1876
  }
1877
- function yr(e, t, n) {
1877
+ function Sr(e, t, n) {
1878
1878
  let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
1879
1879
  for (; o < r.length;) {
1880
1880
  let e = r[o], u = e.match(t.itemPattern);
@@ -1910,21 +1910,21 @@ function yr(e, t, n) {
1910
1910
  let e = g.map((e) => e.slice(f + s)).join("\n");
1911
1911
  e.trim() && (h = t.customNestedParser ? t.customNestedParser(e) : n.blockTokens(e));
1912
1912
  }
1913
- let ee = t.createToken(d, h);
1914
- i.push(ee);
1913
+ let _ = t.createToken(d, h);
1914
+ i.push(_);
1915
1915
  }
1916
1916
  if (i.length !== 0) return {
1917
1917
  items: i,
1918
1918
  raw: a
1919
1919
  };
1920
1920
  }
1921
- var br = 4;
1922
- function xr(e) {
1921
+ var Cr = 4;
1922
+ function wr(e) {
1923
1923
  let t = 0;
1924
- for (let n of e) t = n === " " ? t + br - t % br : t + 1;
1924
+ for (let n of e) t = n === " " ? t + Cr - t % Cr : t + 1;
1925
1925
  return t;
1926
1926
  }
1927
- function Sr(e, t, n, r, i) {
1927
+ function Tr(e, t, n, r, i) {
1928
1928
  if (!e || !Array.isArray(e.content)) return "";
1929
1929
  let a = typeof n == "function" ? n(r) : n, [o, ...s] = e.content, c = `${a}${t.renderChildren([o])}`;
1930
1930
  return s && s.length > 0 && s.forEach((e, n) => {
@@ -1932,20 +1932,20 @@ function Sr(e, t, n, r, i) {
1932
1932
  if (r != null) {
1933
1933
  let n = (e) => {
1934
1934
  if (!i?.alignNestedToPrefix) return t.indent(e);
1935
- let n = t.indent(""), r = xr(a);
1936
- return (xr(n) >= r ? n : " ".repeat(r)) + e;
1935
+ let n = t.indent(""), r = wr(a);
1936
+ return (wr(n) >= r ? n : " ".repeat(r)) + e;
1937
1937
  }, o = r.split("\n").map((e) => n(e || "")).join("\n");
1938
1938
  c += e.type === "paragraph" ? `\n\n${o}` : `\n${o}`;
1939
1939
  }
1940
1940
  }), c;
1941
1941
  }
1942
- function Cr(e, t) {
1942
+ function Er(e, t) {
1943
1943
  let n = { ...e };
1944
- return Z(e) && Z(t) && Object.keys(t).forEach((r) => {
1945
- Z(t[r]) && Z(e[r]) ? n[r] = Cr(e[r], t[r]) : n[r] = t[r];
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];
1946
1946
  }), n;
1947
1947
  }
1948
- function wr(e, t, n = {}) {
1948
+ function Dr(e, t, n = {}) {
1949
1949
  let { state: r } = t, { doc: i, tr: a } = r, o = e;
1950
1950
  i.descendants((t, r) => {
1951
1951
  let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
@@ -1965,39 +1965,39 @@ function wr(e, t, n = {}) {
1965
1965
  }
1966
1966
  }), a.docChanged && t.view.dispatch(a);
1967
1967
  }
1968
- var Q = class {
1968
+ var Y = class {
1969
1969
  constructor(e) {
1970
1970
  this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
1971
1971
  }
1972
- }, Tr = (e, t) => {
1973
- if (Ne(t)) return t.exec(e);
1972
+ }, Or = (e, t) => {
1973
+ if (Re(t)) return t.exec(e);
1974
1974
  let n = t(e);
1975
1975
  if (!n) return null;
1976
1976
  let r = [n.text];
1977
1977
  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
1978
  };
1979
- function Er(e) {
1979
+ function X(e) {
1980
1980
  let { editor: t, from: n, to: r, text: i, rules: a, plugin: o } = e, { view: s } = t;
1981
1981
  if (s.composing) return !1;
1982
1982
  let c = s.state.doc.resolve(n);
1983
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 = tn(c) + i;
1984
+ let l = !1, u = an(c) + i;
1985
1985
  return a.forEach((e) => {
1986
1986
  if (l) return;
1987
- let a = Tr(u, e.find);
1987
+ let a = Or(u, e.find);
1988
1988
  if (!a) return;
1989
1989
  let d = a[0].length - i.length;
1990
1990
  if (d > 0) {
1991
1991
  let e = c.parentOffset - d;
1992
1992
  if (e < 0 || c.parent.textBetween(e, c.parentOffset) !== a[0].slice(0, d)) return;
1993
1993
  }
1994
- let f = s.state.tr, p = k({
1994
+ let f = s.state.tr, p = w({
1995
1995
  state: s.state,
1996
1996
  transaction: f
1997
1997
  }), m = {
1998
1998
  from: n - (a[0].length - i.length),
1999
1999
  to: r
2000
- }, { commands: h, chain: g, can: ee } = new A({
2000
+ }, { commands: h, chain: g, can: _ } = new T({
2001
2001
  editor: t,
2002
2002
  state: p
2003
2003
  });
@@ -2007,7 +2007,7 @@ function Er(e) {
2007
2007
  match: a,
2008
2008
  commands: h,
2009
2009
  chain: g,
2010
- can: ee
2010
+ can: _
2011
2011
  }) !== null && f.steps.length && (e.undoable && f.setMeta(o, {
2012
2012
  transform: f,
2013
2013
  from: n,
@@ -2016,71 +2016,71 @@ function Er(e) {
2016
2016
  }), s.dispatch(f), l = !0);
2017
2017
  }), l;
2018
2018
  }
2019
- function Dr(e) {
2020
- let { editor: t, rules: n } = e, r = new C({
2019
+ function kr(e) {
2020
+ let { editor: t, rules: n } = e, i = new r({
2021
2021
  state: {
2022
2022
  init() {
2023
2023
  return null;
2024
2024
  },
2025
- apply(e, i, a) {
2026
- let o = e.getMeta(r);
2025
+ apply(e, r, a) {
2026
+ let o = e.getMeta(i);
2027
2027
  if (o) return o;
2028
2028
  let s = e.getMeta("applyInputRules");
2029
2029
  return s && setTimeout(() => {
2030
2030
  let { text: e } = s;
2031
- e = typeof e == "string" ? e : At(D.from(e), a.schema);
2032
- let { from: i } = s, o = i + e.length;
2033
- Er({
2031
+ e = typeof e == "string" ? e : Pt(S.from(e), a.schema);
2032
+ let { from: r } = s, o = r + e.length;
2033
+ X({
2034
2034
  editor: t,
2035
- from: i,
2035
+ from: r,
2036
2036
  to: o,
2037
2037
  text: e,
2038
2038
  rules: n,
2039
- plugin: r
2039
+ plugin: i
2040
2040
  });
2041
- }), e.selectionSet || e.docChanged ? null : i;
2041
+ }), e.selectionSet || e.docChanged ? null : r;
2042
2042
  }
2043
2043
  },
2044
2044
  props: {
2045
- handleTextInput(e, i, a, o) {
2046
- return Er({
2045
+ handleTextInput(e, r, a, o) {
2046
+ return X({
2047
2047
  editor: t,
2048
- from: i,
2048
+ from: r,
2049
2049
  to: a,
2050
2050
  text: o,
2051
2051
  rules: n,
2052
- plugin: r
2052
+ plugin: i
2053
2053
  });
2054
2054
  },
2055
2055
  handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
2056
- let { $cursor: i } = e.state.selection;
2057
- i && Er({
2056
+ let { $cursor: r } = e.state.selection;
2057
+ r && X({
2058
2058
  editor: t,
2059
- from: i.pos,
2060
- to: i.pos,
2059
+ from: r.pos,
2060
+ to: r.pos,
2061
2061
  text: "",
2062
2062
  rules: n,
2063
- plugin: r
2063
+ plugin: i
2064
2064
  });
2065
2065
  }), !1) },
2066
- handleKeyDown(e, i) {
2067
- if (i.key !== "Enter") return !1;
2066
+ handleKeyDown(e, r) {
2067
+ if (r.key !== "Enter") return !1;
2068
2068
  let { $cursor: a } = e.state.selection;
2069
- return a ? Er({
2069
+ return a ? X({
2070
2070
  editor: t,
2071
2071
  from: a.pos,
2072
2072
  to: a.pos,
2073
2073
  text: "\n",
2074
2074
  rules: n,
2075
- plugin: r
2075
+ plugin: i
2076
2076
  }) : !1;
2077
2077
  }
2078
2078
  },
2079
2079
  isInputRules: !0
2080
2080
  });
2081
- return r;
2081
+ return i;
2082
2082
  }
2083
- var Or = class {
2083
+ var Ar = class {
2084
2084
  constructor(e = {}) {
2085
2085
  this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
2086
2086
  ...this.config,
@@ -2088,10 +2088,10 @@ var Or = class {
2088
2088
  }, this.name = this.config.name;
2089
2089
  }
2090
2090
  get options() {
2091
- return { ...H(V(this, "addOptions", { name: this.name })) };
2091
+ return { ...R(L(this, "addOptions", { name: this.name })) };
2092
2092
  }
2093
2093
  get storage() {
2094
- return { ...H(V(this, "addStorage", {
2094
+ return { ...R(L(this, "addStorage", {
2095
2095
  name: this.name,
2096
2096
  options: this.options
2097
2097
  })) };
@@ -2099,7 +2099,7 @@ var Or = class {
2099
2099
  configure(e = {}) {
2100
2100
  let t = this.extend({
2101
2101
  ...this.config,
2102
- addOptions: () => Cr(this.options, e)
2102
+ addOptions: () => Er(this.options, e)
2103
2103
  });
2104
2104
  return t.name = this.name, t.parent = this.parent, this.child = null, t;
2105
2105
  }
@@ -2110,7 +2110,7 @@ var Or = class {
2110
2110
  });
2111
2111
  return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
2112
2112
  }
2113
- }, kr = class e extends Or {
2113
+ }, jr = class e extends Ar {
2114
2114
  constructor(...e) {
2115
2115
  super(...e), this.type = "mark";
2116
2116
  }
@@ -2135,20 +2135,20 @@ var Or = class {
2135
2135
  let t = typeof e == "function" ? e() : e;
2136
2136
  return super.extend(t);
2137
2137
  }
2138
- }, Ar = class {
2138
+ }, Mr = class {
2139
2139
  constructor(e) {
2140
2140
  this.find = e.find, this.handler = e.handler;
2141
2141
  }
2142
- }, jr = (e, t, n) => {
2143
- if (Ne(t)) return [...e.matchAll(t)];
2142
+ }, Nr = (e, t, n) => {
2143
+ if (Re(t)) return [...e.matchAll(t)];
2144
2144
  let r = t(e, n);
2145
2145
  return r ? r.map((t) => {
2146
2146
  let n = [t.text];
2147
2147
  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
2148
  }) : [];
2149
2149
  };
2150
- function Mr(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 A({
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({
2152
2152
  editor: t,
2153
2153
  state: n
2154
2154
  }), d = [];
@@ -2156,7 +2156,7 @@ function Mr(e) {
2156
2156
  var f;
2157
2157
  if ((f = e.type) != null && (f = f.spec) != null && f.code || !(e.isText || e.isTextblock || e.isInline)) return;
2158
2158
  let p = e.content?.size ?? e.nodeSize ?? 0, m = Math.max(r, t), h = Math.min(i, t + p);
2159
- m >= h || jr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
2159
+ m >= h || Nr(e.isText ? e.text || "" : e.textBetween(m - t, h - t, void 0, ""), a.find, o).forEach((e) => {
2160
2160
  if (e.index === void 0) return;
2161
2161
  let t = m + e.index + 1, r = t + e[0].length, i = {
2162
2162
  from: n.tr.mapping.map(t),
@@ -2175,55 +2175,55 @@ function Mr(e) {
2175
2175
  });
2176
2176
  }), d.every((e) => e !== null);
2177
2177
  }
2178
- var Nr = null, Pr = (e) => {
2178
+ var Z = null, Fr = (e) => {
2179
2179
  var t;
2180
2180
  let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
2181
2181
  return (t = n.clipboardData) == null || t.setData("text/html", e), n;
2182
2182
  };
2183
- function Fr(e) {
2184
- let { editor: t, rules: n } = e, r = null, i = !1, a = !1, o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, s;
2183
+ function Ir(e) {
2184
+ let { editor: t, rules: n } = e, i = null, a = !1, o = !1, s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
2185
2185
  try {
2186
- s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
2186
+ c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
2187
2187
  } catch {
2188
- s = null;
2188
+ c = null;
2189
2189
  }
2190
- let c = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
2191
- let c = e.tr, l = k({
2190
+ let l = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
2191
+ let o = e.tr, l = w({
2192
2192
  state: e,
2193
- transaction: c
2193
+ transaction: o
2194
2194
  });
2195
- if (Mr({
2195
+ if (Pr({
2196
2196
  editor: t,
2197
2197
  state: l,
2198
2198
  from: Math.max(n - 1, 0),
2199
2199
  to: r.b - 1,
2200
2200
  rule: i,
2201
2201
  pasteEvent: a,
2202
- dropEvent: s
2203
- }) && c.steps.length) {
2202
+ dropEvent: c
2203
+ }) && o.steps.length) {
2204
2204
  try {
2205
- s = typeof DragEvent < "u" ? new DragEvent("drop") : null;
2205
+ c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
2206
2206
  } catch {
2207
- s = null;
2207
+ c = null;
2208
2208
  }
2209
- return o = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
2209
+ return s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, o;
2210
2210
  }
2211
2211
  };
2212
- return n.map((e) => new C({
2212
+ return n.map((e) => new r({
2213
2213
  view(e) {
2214
2214
  let n = (n) => {
2215
- r = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, r && (Nr = t);
2216
- }, i = () => {
2217
- Nr &&= null;
2215
+ i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Z = t);
2216
+ }, r = () => {
2217
+ Z &&= null;
2218
2218
  };
2219
- return window.addEventListener("dragstart", n), window.addEventListener("dragend", i), { destroy() {
2220
- window.removeEventListener("dragstart", n), window.removeEventListener("dragend", i);
2219
+ return window.addEventListener("dragstart", n), window.addEventListener("dragend", r), { destroy() {
2220
+ window.removeEventListener("dragstart", n), window.removeEventListener("dragend", r);
2221
2221
  } };
2222
2222
  },
2223
2223
  props: { handleDOMEvents: {
2224
2224
  drop: (e, t) => {
2225
- if (a = r === e.dom.parentElement, s = t, !a) {
2226
- let e = Nr;
2225
+ if (o = i === e.dom.parentElement, c = t, !o) {
2226
+ let e = Z;
2227
2227
  e?.isEditable && setTimeout(() => {
2228
2228
  let t = e.state.selection;
2229
2229
  t && e.commands.deleteRange({
@@ -2236,17 +2236,17 @@ function Fr(e) {
2236
2236
  },
2237
2237
  paste: (e, t) => {
2238
2238
  let n = t.clipboardData?.getData("text/html");
2239
- return o = t, i = !!n?.includes("data-pm-slice"), !1;
2239
+ return s = t, a = !!n?.includes("data-pm-slice"), !1;
2240
2240
  }
2241
2241
  } },
2242
2242
  appendTransaction: (t, n, r) => {
2243
- let s = t[0], l = s.getMeta("uiEvent") === "paste" && !i, u = s.getMeta("uiEvent") === "drop" && !a, d = s.getMeta("applyPasteRules"), f = !!d;
2244
- if (!l && !u && !f) return;
2243
+ let i = t[0], c = i.getMeta("uiEvent") === "paste" && !a, u = i.getMeta("uiEvent") === "drop" && !o, d = i.getMeta("applyPasteRules"), f = !!d;
2244
+ if (!c && !u && !f) return;
2245
2245
  if (f) {
2246
2246
  let { text: t } = d;
2247
- t = typeof t == "string" ? t : At(D.from(t), r.schema);
2248
- let { from: n } = d, i = n + t.length, a = Pr(t);
2249
- return c({
2247
+ t = typeof t == "string" ? t : Pt(S.from(t), r.schema);
2248
+ let { from: n } = d, i = n + t.length, a = Fr(t);
2249
+ return l({
2250
2250
  rule: e,
2251
2251
  state: r,
2252
2252
  from: n,
@@ -2255,28 +2255,28 @@ function Fr(e) {
2255
2255
  });
2256
2256
  }
2257
2257
  let p = n.doc.content.findDiffStart(r.doc.content), m = n.doc.content.findDiffEnd(r.doc.content);
2258
- if (_r(p) && m && p !== m.b) return c({
2258
+ if (br(p) && m && p !== m.b) return l({
2259
2259
  rule: e,
2260
2260
  state: r,
2261
2261
  from: p,
2262
2262
  to: m,
2263
- pasteEvt: o
2263
+ pasteEvt: s
2264
2264
  });
2265
2265
  }
2266
2266
  }));
2267
2267
  }
2268
- var Ir = class {
2268
+ var Q = class {
2269
2269
  constructor(e, t) {
2270
- this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Ut(e), this.schema = Vt(this.extensions, t), this.setupExtensions();
2270
+ 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
2271
  }
2272
2272
  get commands() {
2273
2273
  return this.extensions.reduce((e, t) => {
2274
- let n = V(t, "addCommands", {
2274
+ let n = L(t, "addCommands", {
2275
2275
  name: t.name,
2276
2276
  options: t.options,
2277
2277
  storage: this.editor.extensionStorage[t.name],
2278
2278
  editor: this.editor,
2279
- type: K(t.name, this.schema)
2279
+ type: U(t.name, this.schema)
2280
2280
  });
2281
2281
  return n ? {
2282
2282
  ...e,
@@ -2285,15 +2285,15 @@ var Ir = class {
2285
2285
  }, {});
2286
2286
  }
2287
2287
  get plugins() {
2288
- let { editor: e } = this, t = G([...this.extensions].reverse()).flatMap((t) => {
2288
+ let { editor: e } = this, t = V([...this.extensions].reverse()).flatMap((t) => {
2289
2289
  let n = {
2290
2290
  name: t.name,
2291
2291
  options: t.options,
2292
2292
  storage: this.editor.extensionStorage[t.name],
2293
2293
  editor: e,
2294
- type: K(t.name, this.schema)
2295
- }, r = [], i = V(t, "addKeyboardShortcuts", n), a = {};
2296
- if (t.type === "mark" && V(t, "exitable", n) && (a.ArrowRight = () => kr.handleExit({
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({
2297
2297
  editor: e,
2298
2298
  mark: t
2299
2299
  })), i) {
@@ -2303,31 +2303,31 @@ var Ir = class {
2303
2303
  ...t
2304
2304
  };
2305
2305
  }
2306
- let o = he(a);
2306
+ let o = be(a);
2307
2307
  r.push(o);
2308
- let s = V(t, "addInputRules", n);
2309
- if (sn(t, e.options.enableInputRules) && s) {
2308
+ let s = L(t, "addInputRules", n);
2309
+ if (un(t, e.options.enableInputRules) && s) {
2310
2310
  let t = s();
2311
2311
  if (t && t.length) {
2312
- let n = Dr({
2312
+ let n = kr({
2313
2313
  editor: e,
2314
2314
  rules: t
2315
2315
  }), i = Array.isArray(n) ? n : [n];
2316
2316
  r.push(...i);
2317
2317
  }
2318
2318
  }
2319
- let c = V(t, "addPasteRules", n);
2320
- if (sn(t, e.options.enablePasteRules) && c) {
2319
+ let c = L(t, "addPasteRules", n);
2320
+ if (un(t, e.options.enablePasteRules) && c) {
2321
2321
  let t = c();
2322
2322
  if (t && t.length) {
2323
- let n = Fr({
2323
+ let n = Ir({
2324
2324
  editor: e,
2325
2325
  rules: t
2326
2326
  });
2327
2327
  r.push(...n);
2328
2328
  }
2329
2329
  }
2330
- let l = V(t, "addProseMirrorPlugins", n);
2330
+ let l = L(t, "addProseMirrorPlugins", n);
2331
2331
  if (l) {
2332
2332
  let e = l();
2333
2333
  r.push(...e);
@@ -2342,39 +2342,39 @@ var Ir = class {
2342
2342
  (e = this.decorationManager) == null || e.destroy();
2343
2343
  let n = [];
2344
2344
  return this.extensions.forEach((e) => {
2345
- let r = V(e, "addDecorations", {
2345
+ let r = L(e, "addDecorations", {
2346
2346
  name: e.name,
2347
2347
  options: e.options,
2348
2348
  storage: this.editor.extensionStorage[e.name],
2349
2349
  editor: t,
2350
- type: K(e.name, this.schema)
2350
+ type: U(e.name, this.schema)
2351
2351
  });
2352
2352
  r && n.push({
2353
2353
  name: e.name,
2354
2354
  addDecorations: r
2355
2355
  });
2356
- }), this.decorationManager = new dr({
2356
+ }), this.decorationManager = new mr({
2357
2357
  editor: t,
2358
2358
  entries: n
2359
2359
  }), this.decorationManager.plugin;
2360
2360
  }
2361
2361
  get attributes() {
2362
- return Nt(this.extensions);
2362
+ return Lt(this.extensions);
2363
2363
  }
2364
2364
  get nodeViews() {
2365
- let { editor: e } = this, { nodeExtensions: t } = U(this.extensions);
2366
- return Object.fromEntries(t.filter((e) => !!V(e, "addNodeView")).map((t) => {
2367
- let n = this.attributes.filter((e) => e.type === t.name), r = V(t, "addNodeView", {
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", {
2368
2368
  name: t.name,
2369
2369
  options: t.options,
2370
2370
  storage: this.editor.extensionStorage[t.name],
2371
2371
  editor: e,
2372
- type: j(t.name, this.schema)
2372
+ type: E(t.name, this.schema)
2373
2373
  });
2374
2374
  if (!r) return [];
2375
2375
  let i = r();
2376
2376
  return i ? [t.name, (r, a, o, s, c) => {
2377
- let l = W(r, n);
2377
+ let l = B(r, n);
2378
2378
  return i({
2379
2379
  node: r,
2380
2380
  view: a,
@@ -2390,14 +2390,14 @@ var Ir = class {
2390
2390
  }
2391
2391
  dispatchTransaction(e) {
2392
2392
  let { editor: t } = this;
2393
- return G([...this.extensions].reverse()).reduceRight((e, n) => {
2393
+ return V([...this.extensions].reverse()).reduceRight((e, n) => {
2394
2394
  let r = {
2395
2395
  name: n.name,
2396
2396
  options: n.options,
2397
2397
  storage: this.editor.extensionStorage[n.name],
2398
2398
  editor: t,
2399
- type: K(n.name, this.schema)
2400
- }, i = V(n, "dispatchTransaction", r);
2399
+ type: U(n.name, this.schema)
2400
+ }, i = L(n, "dispatchTransaction", r);
2401
2401
  return i ? (t) => {
2402
2402
  i.call(r, {
2403
2403
  transaction: t,
@@ -2408,14 +2408,14 @@ var Ir = class {
2408
2408
  }
2409
2409
  transformPastedHTML(e) {
2410
2410
  let { editor: t } = this;
2411
- return G([...this.extensions]).reduce((e, n) => {
2411
+ return V([...this.extensions]).reduce((e, n) => {
2412
2412
  let r = {
2413
2413
  name: n.name,
2414
2414
  options: n.options,
2415
2415
  storage: this.editor.extensionStorage[n.name],
2416
2416
  editor: t,
2417
- type: K(n.name, this.schema)
2418
- }, i = V(n, "transformPastedHTML", r);
2417
+ type: U(n.name, this.schema)
2418
+ }, i = L(n, "transformPastedHTML", r);
2419
2419
  return i ? (t, n) => {
2420
2420
  let a = e(t, n);
2421
2421
  return i.call(r, a);
@@ -2423,17 +2423,17 @@ var Ir = class {
2423
2423
  }, e || ((e) => e));
2424
2424
  }
2425
2425
  get markViews() {
2426
- let { editor: e } = this, { markExtensions: t } = U(this.extensions);
2427
- return Object.fromEntries(t.filter((e) => !!V(e, "addMarkView")).map((t) => {
2428
- let n = this.attributes.filter((e) => e.type === t.name), r = V(t, "addMarkView", {
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", {
2429
2429
  name: t.name,
2430
2430
  options: t.options,
2431
2431
  storage: this.editor.extensionStorage[t.name],
2432
2432
  editor: e,
2433
- type: P(t.name, this.schema)
2433
+ type: k(t.name, this.schema)
2434
2434
  });
2435
2435
  return r ? [t.name, (i, a, o) => {
2436
- let s = W(i, n);
2436
+ let s = B(i, n);
2437
2437
  return r()({
2438
2438
  mark: i,
2439
2439
  view: a,
@@ -2442,7 +2442,7 @@ var Ir = class {
2442
2442
  extension: t,
2443
2443
  HTMLAttributes: s,
2444
2444
  updateAttributes: (t) => {
2445
- wr(i, e, t);
2445
+ Dr(i, e, t);
2446
2446
  }
2447
2447
  });
2448
2448
  }] : [];
@@ -2466,16 +2466,16 @@ var Ir = class {
2466
2466
  options: e.options,
2467
2467
  storage: this.editor.extensionStorage[e.name],
2468
2468
  editor: this.editor,
2469
- type: K(e.name, this.schema)
2469
+ type: U(e.name, this.schema)
2470
2470
  };
2471
- e.type === "mark" && ((H(V(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (H(V(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
2472
- let n = V(e, "onBeforeCreate", t), r = V(e, "onCreate", t), i = V(e, "onUpdate", t), a = V(e, "onSelectionUpdate", t), o = V(e, "onTransaction", t), s = V(e, "onFocus", t), c = V(e, "onBlur", t), l = V(e, "onDestroy", t);
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);
2473
2473
  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
2474
  });
2475
2475
  }
2476
2476
  };
2477
- Ir.resolve = Ut, Ir.sort = G, Ir.flatten = kt;
2478
- var $ = class e extends Or {
2477
+ Q.resolve = qt, Q.sort = V, Q.flatten = Nt;
2478
+ var $ = class e extends Ar {
2479
2479
  constructor(...e) {
2480
2480
  super(...e), this.type = "extension";
2481
2481
  }
@@ -2496,14 +2496,14 @@ var $ = class e extends Or {
2496
2496
  return { blockSeparator: void 0 };
2497
2497
  },
2498
2498
  addProseMirrorPlugins() {
2499
- return [new C({
2500
- key: new w("clipboardTextSerializer"),
2499
+ return [new r({
2500
+ key: new i("clipboardTextSerializer"),
2501
2501
  props: { clipboardTextSerializer: () => {
2502
- let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Kt(n), { blockSeparator: o } = this.options, s = {
2502
+ let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Xt(n), { blockSeparator: o } = this.options, s = {
2503
2503
  ...o === void 0 ? {} : { blockSeparator: o },
2504
2504
  textSerializers: a
2505
2505
  };
2506
- return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Wt(r, {
2506
+ return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Jt(r, {
2507
2507
  from: e.pos,
2508
2508
  to: t.pos
2509
2509
  }, s)).join(o ?? "\n\n");
@@ -2513,67 +2513,67 @@ var $ = class e extends Or {
2513
2513
  }), Rr = $.create({
2514
2514
  name: "commands",
2515
2515
  addCommands() {
2516
- return { ...Hn };
2516
+ return { ...Gn };
2517
2517
  }
2518
2518
  }), zr = $.create({
2519
2519
  name: "delete",
2520
- onUpdate({ transaction: t, appendedTransactions: n }) {
2521
- var r;
2522
- let i = () => {
2523
- var r, i;
2524
- if (((r = this.editor.options.coreExtensionOptions) == null || (r = r.delete) == null || (i = r.filterTransaction) == null ? void 0 : i.call(r, t)) ?? t.getMeta("y-sync$")) return;
2525
- let a = Tt(t.before, [t, ...n]);
2526
- Zt(a).forEach((e) => {
2527
- a.mapping.mapResult(e.oldRange.from).deletedAfter && a.mapping.mapResult(e.oldRange.to).deletedBefore && a.before.nodesBetween(e.oldRange.from, e.oldRange.to, (n, r) => {
2528
- let i = r + n.nodeSize - 2, o = e.oldRange.from <= r && i <= e.oldRange.to;
2520
+ onUpdate({ transaction: e, appendedTransactions: t }) {
2521
+ var n;
2522
+ let r = () => {
2523
+ var n, r;
2524
+ if (((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null || (r = n.filterTransaction) == null ? void 0 : r.call(n, e)) ?? e.getMeta("y-sync$")) return;
2525
+ let i = At(e.before, [e, ...t]);
2526
+ tn(i).forEach((t) => {
2527
+ i.mapping.mapResult(t.oldRange.from).deletedAfter && i.mapping.mapResult(t.oldRange.to).deletedBefore && i.before.nodesBetween(t.oldRange.from, t.oldRange.to, (n, r) => {
2528
+ let a = r + n.nodeSize - 2, o = t.oldRange.from <= r && a <= t.oldRange.to;
2529
2529
  this.editor.emit("delete", {
2530
2530
  type: "node",
2531
2531
  node: n,
2532
2532
  from: r,
2533
- to: i,
2534
- newFrom: a.mapping.map(r),
2535
- newTo: a.mapping.map(i),
2536
- deletedRange: e.oldRange,
2537
- newRange: e.newRange,
2533
+ to: a,
2534
+ newFrom: i.mapping.map(r),
2535
+ newTo: i.mapping.map(a),
2536
+ deletedRange: t.oldRange,
2537
+ newRange: t.newRange,
2538
2538
  partial: !o,
2539
2539
  editor: this.editor,
2540
- transaction: t,
2541
- combinedTransform: a
2540
+ transaction: e,
2541
+ combinedTransform: i
2542
2542
  });
2543
2543
  });
2544
2544
  });
2545
- let o = a.mapping;
2546
- a.steps.forEach((n, r) => {
2547
- if (n instanceof e) {
2548
- let e = o.slice(r).map(n.from, -1), i = o.slice(r).map(n.to), s = o.invert().map(e, -1), c = o.invert().map(i), l = e > 0 && a.doc.nodeAt(e - 1)?.marks.some((e) => e.eq(n.mark)), u = a.doc.nodeAt(i)?.marks.some((e) => e.eq(n.mark));
2545
+ let a = i.mapping;
2546
+ i.steps.forEach((t, n) => {
2547
+ if (t instanceof s) {
2548
+ let r = a.slice(n).map(t.from, -1), o = a.slice(n).map(t.to), s = a.invert().map(r, -1), c = a.invert().map(o), l = r > 0 && i.doc.nodeAt(r - 1)?.marks.some((e) => e.eq(t.mark)), u = i.doc.nodeAt(o)?.marks.some((e) => e.eq(t.mark));
2549
2549
  this.editor.emit("delete", {
2550
2550
  type: "mark",
2551
- mark: n.mark,
2552
- from: n.from,
2553
- to: n.to,
2551
+ mark: t.mark,
2552
+ from: t.from,
2553
+ to: t.to,
2554
2554
  deletedRange: {
2555
2555
  from: s,
2556
2556
  to: c
2557
2557
  },
2558
2558
  newRange: {
2559
- from: e,
2560
- to: i
2559
+ from: r,
2560
+ to: o
2561
2561
  },
2562
2562
  partial: !!(u || l),
2563
2563
  editor: this.editor,
2564
- transaction: t,
2565
- combinedTransform: a
2564
+ transaction: e,
2565
+ combinedTransform: i
2566
2566
  });
2567
2567
  }
2568
2568
  });
2569
2569
  };
2570
- ((r = this.editor.options.coreExtensionOptions) == null || (r = r.delete) == null ? void 0 : r.async) ?? !0 ? setTimeout(i, 0) : i();
2570
+ ((n = this.editor.options.coreExtensionOptions) == null || (n = n.delete) == null ? void 0 : n.async) ?? !0 ? setTimeout(r, 0) : r();
2571
2571
  }
2572
2572
  }), Br = $.create({
2573
2573
  name: "drop",
2574
2574
  addProseMirrorPlugins() {
2575
- return [new C({
2576
- key: new w("tiptapDrop"),
2575
+ return [new r({
2576
+ key: new i("tiptapDrop"),
2577
2577
  props: { handleDrop: (e, t, n, r) => {
2578
2578
  this.editor.emit("drop", {
2579
2579
  editor: this.editor,
@@ -2587,16 +2587,16 @@ var $ = class e extends Or {
2587
2587
  }), Vr = $.create({
2588
2588
  name: "editable",
2589
2589
  addProseMirrorPlugins() {
2590
- return [new C({
2591
- key: new w("editable"),
2590
+ return [new r({
2591
+ key: new i("editable"),
2592
2592
  props: { editable: () => this.editor.options.editable }
2593
2593
  })];
2594
2594
  }
2595
- }), Hr = new w("focusEvents"), Ur = $.create({
2595
+ }), Hr = new i("focusEvents"), Ur = $.create({
2596
2596
  name: "focusEvents",
2597
2597
  addProseMirrorPlugins() {
2598
2598
  let { editor: e } = this;
2599
- return [new C({
2599
+ return [new r({
2600
2600
  key: Hr,
2601
2601
  props: { handleDOMEvents: {
2602
2602
  focus: (t, n) => {
@@ -2618,8 +2618,8 @@ var $ = class e extends Or {
2618
2618
  let e = () => this.editor.commands.first(({ commands: e }) => [
2619
2619
  () => e.undoInputRule(),
2620
2620
  () => e.command(({ tr: t }) => {
2621
- let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos : T.atStart(r).from === o;
2622
- return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
2621
+ let { selection: n, doc: r } = t, { empty: i, $anchor: o } = n, { pos: s, parent: c } = o, l = o.parent.isTextblock && s > 0 ? t.doc.resolve(s - 1) : o, u = l.parent.type.spec.isolating, d = o.pos - o.parentOffset, f = u && l.parent.childCount === 1 ? d === o.pos : a.atStart(r).from === s;
2622
+ return !i || !c.type.isTextblock || c.textContent.length || !f || f && o.parent.type.name === "paragraph" ? !1 : e.clearNodes();
2623
2623
  }),
2624
2624
  () => e.deleteSelection(),
2625
2625
  () => e.joinBackward(),
@@ -2654,33 +2654,33 @@ var $ = class e extends Or {
2654
2654
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2655
2655
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2656
2656
  };
2657
- return I() || ot() ? i : r;
2657
+ return j() || dt() ? i : r;
2658
2658
  },
2659
2659
  addProseMirrorPlugins() {
2660
- return [new C({
2661
- key: new w("clearDocument"),
2660
+ return [new r({
2661
+ key: new i("clearDocument"),
2662
2662
  appendTransaction: (e, t, n) => {
2663
2663
  if (e.some((e) => e.getMeta("composition"))) return;
2664
2664
  let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
2665
2665
  if (!r || i) return;
2666
- let { empty: a, from: o, to: s } = t.selection, c = T.atStart(t.doc).from, l = T.atEnd(t.doc).to;
2667
- if (a || o !== c || s !== l || !J(n.doc)) return;
2668
- let u = n.tr, d = k({
2666
+ 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({
2669
2669
  state: n,
2670
- transaction: u
2671
- }), { commands: f } = new A({
2670
+ transaction: d
2671
+ }), { commands: p } = new T({
2672
2672
  editor: this.editor,
2673
- state: d
2673
+ state: f
2674
2674
  });
2675
- if (f.clearNodes(), u.steps.length) return u;
2675
+ if (p.clearNodes(), d.steps.length) return d;
2676
2676
  }
2677
2677
  })];
2678
2678
  }
2679
2679
  }), Gr = $.create({
2680
2680
  name: "paste",
2681
2681
  addProseMirrorPlugins() {
2682
- return [new C({
2683
- key: new w("tiptapPaste"),
2682
+ return [new r({
2683
+ key: new i("tiptapPaste"),
2684
2684
  props: { handlePaste: (e, t, n) => {
2685
2685
  this.editor.emit("paste", {
2686
2686
  editor: this.editor,
@@ -2696,8 +2696,8 @@ var $ = class e extends Or {
2696
2696
  return { value: void 0 };
2697
2697
  },
2698
2698
  addProseMirrorPlugins() {
2699
- return [new C({
2700
- key: new w("tabindex"),
2699
+ return [new r({
2700
+ key: new i("tabindex"),
2701
2701
  props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
2702
2702
  })];
2703
2703
  }
@@ -2708,7 +2708,7 @@ var $ = class e extends Or {
2708
2708
  },
2709
2709
  addGlobalAttributes() {
2710
2710
  if (!this.options.direction) return [];
2711
- let { nodeExtensions: e } = U(this.extensions);
2711
+ let { nodeExtensions: e } = z(this.extensions);
2712
2712
  return [{
2713
2713
  types: e.filter((e) => e.name !== "text").map((e) => e.name),
2714
2714
  attributes: { dir: {
@@ -2722,8 +2722,8 @@ var $ = class e extends Or {
2722
2722
  }];
2723
2723
  },
2724
2724
  addProseMirrorPlugins() {
2725
- return [new C({
2726
- key: new w("textDirection"),
2725
+ return [new r({
2726
+ key: new i("textDirection"),
2727
2727
  props: { attributes: () => {
2728
2728
  let e = this.options.direction;
2729
2729
  return e ? { dir: e } : {};
@@ -2736,14 +2736,14 @@ function Yr(e) {
2736
2736
  Jr = !0;
2737
2737
  let t;
2738
2738
  try {
2739
- t = n.fromJSON(e, {
2739
+ t = l.fromJSON(e, {
2740
2740
  from: 0,
2741
2741
  to: 0
2742
2742
  }).slice.content;
2743
2743
  } catch {
2744
2744
  return;
2745
2745
  }
2746
- t instanceof D || 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.");
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.");
2747
2747
  }
2748
2748
  var Xr = class e {
2749
2749
  get name() {
@@ -2867,7 +2867,7 @@ var Xr = class e {
2867
2867
  ...e
2868
2868
  }), this.editor.view.dispatch(t);
2869
2869
  }
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 Gn {
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 {
2871
2871
  constructor(e = {}) {
2872
2872
  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
2873
  element: typeof document < "u" ? document.createElement("div") : null,
@@ -2904,14 +2904,14 @@ var Xr = class e {
2904
2904
  onDelete: () => null,
2905
2905
  enableExtensionDispatchTransaction: !0
2906
2906
  }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2907
- getUpdatedPosition: dn,
2908
- createMappablePosition: fn
2907
+ getUpdatedPosition: mn,
2908
+ createMappablePosition: hn
2909
2909
  }, 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
- let t = this.createDoc();
2910
+ let n = this.createDoc();
2911
2911
  if (!this.editorState) {
2912
- let e = ze(t, this.options.autofocus);
2913
- this.editorState = oe.create({
2914
- doc: t,
2912
+ let e = We(n, this.options.autofocus);
2913
+ this.editorState = t.create({
2914
+ doc: n,
2915
2915
  schema: this.schema,
2916
2916
  selection: e || void 0
2917
2917
  });
@@ -2944,13 +2944,13 @@ var Xr = class e {
2944
2944
  return this.commandManager.commands;
2945
2945
  }
2946
2946
  chain() {
2947
- return this.commandManager ? this.commandManager.chain() : A.createFakeChain();
2947
+ return this.commandManager ? this.commandManager.chain() : T.createFakeChain();
2948
2948
  }
2949
2949
  can() {
2950
- return this.commandManager ? this.commandManager.can() : A.createFallbackCan();
2950
+ return this.commandManager ? this.commandManager.can() : T.createFallbackCan();
2951
2951
  }
2952
2952
  injectCSS() {
2953
- this.options.injectCSS && typeof document < "u" && (this.css = pr(Zr, this.options.injectNonce));
2953
+ this.options.injectCSS && typeof document < "u" && (this.css = gr(Zr, this.options.injectNonce));
2954
2954
  }
2955
2955
  setOptions(e = {}) {
2956
2956
  this.options = {
@@ -2989,10 +2989,10 @@ var Xr = class e {
2989
2989
  } });
2990
2990
  }
2991
2991
  get state() {
2992
- return Kn && !this.hasWarnedStaleDecorationRead && Wn(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;
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;
2993
2993
  }
2994
2994
  registerPlugin(e, t) {
2995
- let n = jt(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
2995
+ let n = Ft(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
2996
2996
  return this.view.updateState(r), r;
2997
2997
  }
2998
2998
  unregisterPlugin(e) {
@@ -3023,10 +3023,10 @@ var Xr = class e {
3023
3023
  "node",
3024
3024
  "mark"
3025
3025
  ].includes(e?.type));
3026
- this.extensionManager = new Ir(n, this);
3026
+ this.extensionManager = new Q(n, this);
3027
3027
  }
3028
3028
  createCommandManager() {
3029
- this.commandManager = new A({ editor: this });
3029
+ this.commandManager = new T({ editor: this });
3030
3030
  }
3031
3031
  createSchema() {
3032
3032
  this.schema = this.extensionManager.schema;
@@ -3034,14 +3034,14 @@ var Xr = class e {
3034
3034
  createDoc() {
3035
3035
  let e;
3036
3036
  try {
3037
- e = St(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
3037
+ e = Dt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
3038
3038
  } catch (e) {
3039
3039
  if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
3040
- let t = St(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
3041
- return this.editorState = oe.create({
3042
- doc: t,
3040
+ let n = Dt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
3041
+ return this.editorState = t.create({
3042
+ doc: n,
3043
3043
  schema: this.schema,
3044
- selection: ze(t, this.options.autofocus) || void 0
3044
+ selection: We(n, this.options.autofocus) || void 0
3045
3045
  }), this.emit("contentError", {
3046
3046
  editor: this,
3047
3047
  error: e,
@@ -3054,7 +3054,7 @@ var Xr = class e {
3054
3054
  }
3055
3055
  createView(e) {
3056
3056
  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 me(e, {
3057
+ this.editorView = new ye(e, {
3058
3058
  ...t,
3059
3059
  attributes: {
3060
3060
  role: "textbox",
@@ -3125,30 +3125,30 @@ var Xr = class e {
3125
3125
  });
3126
3126
  }
3127
3127
  getAttributes(e) {
3128
- return Jt(this.state, e);
3128
+ return Qt(this.state, e);
3129
3129
  }
3130
3130
  isActive(e, t) {
3131
3131
  let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
3132
- return rn(this.state, n, r);
3132
+ return sn(this.state, n, r);
3133
3133
  }
3134
3134
  getJSON() {
3135
3135
  return this.state.doc.toJSON();
3136
3136
  }
3137
3137
  getHTML() {
3138
- return At(this.state.doc.content, this.schema);
3138
+ return Pt(this.state.doc.content, this.schema);
3139
3139
  }
3140
3140
  getText(e) {
3141
3141
  let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
3142
- return Gt(this.state.doc, {
3142
+ return Yt(this.state.doc, {
3143
3143
  blockSeparator: t,
3144
3144
  textSerializers: {
3145
- ...Kt(this.schema),
3145
+ ...Xt(this.schema),
3146
3146
  ...n
3147
3147
  }
3148
3148
  });
3149
3149
  }
3150
3150
  get isEmpty() {
3151
- return J(this.state.doc);
3151
+ return G(this.state.doc);
3152
3152
  }
3153
3153
  destroy() {
3154
3154
  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 = {});
@@ -3171,15 +3171,15 @@ var Xr = class e {
3171
3171
  }
3172
3172
  };
3173
3173
  function $r(e) {
3174
- return new Q({
3174
+ return new Y({
3175
3175
  find: e.find,
3176
3176
  handler: ({ state: t, range: n, match: r }) => {
3177
- let i = H(e.getAttributes, void 0, r);
3177
+ let i = R(e.getAttributes, void 0, r);
3178
3178
  if (i === !1 || i === null) return null;
3179
3179
  let { tr: a } = t, o = r[r.length - 1], s = r[0];
3180
3180
  if (o) {
3181
3181
  let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
3182
- if (Qt(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;
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;
3183
3183
  l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
3184
3184
  let u = n.from + r + o.length;
3185
3185
  a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
@@ -3189,10 +3189,10 @@ function $r(e) {
3189
3189
  });
3190
3190
  }
3191
3191
  function ei(e) {
3192
- return new Q({
3192
+ return new Y({
3193
3193
  find: e.find,
3194
3194
  handler: ({ state: t, range: n, match: r }) => {
3195
- let i = H(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
3195
+ let i = R(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
3196
3196
  if (r[1]) {
3197
3197
  let e = o + r[0].lastIndexOf(r[1]);
3198
3198
  e > s ? e = s : s = e + r[1].length;
@@ -3208,10 +3208,10 @@ function ei(e) {
3208
3208
  });
3209
3209
  }
3210
3210
  function ti(e) {
3211
- return new Q({
3211
+ return new Y({
3212
3212
  find: e.find,
3213
3213
  handler: ({ state: t, range: n, match: r }) => {
3214
- let i = t.doc.resolve(n.from), a = H(e.getAttributes, void 0, r) || {};
3214
+ let i = t.doc.resolve(n.from), a = R(e.getAttributes, void 0, r) || {};
3215
3215
  if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
3216
3216
  t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
3217
3217
  },
@@ -3219,7 +3219,7 @@ function ti(e) {
3219
3219
  });
3220
3220
  }
3221
3221
  function ni(e) {
3222
- return new Q({
3222
+ return new Y({
3223
3223
  find: e.find,
3224
3224
  handler: ({ state: t, range: n, match: r }) => {
3225
3225
  let i = e.replace, a = n.from, o = n.to;
@@ -3235,24 +3235,24 @@ function ni(e) {
3235
3235
  });
3236
3236
  }
3237
3237
  function ri(e) {
3238
- return new Q({
3238
+ return new Y({
3239
3239
  find: e.find,
3240
- handler: ({ state: t, range: n, match: r, chain: a }) => {
3241
- let s = H(e.getAttributes, void 0, r) || {}, c = t.tr.delete(n.from, n.to), l = c.doc.resolve(n.from).blockRange(), u = l && o(l, e.type, s);
3242
- if (!u) return null;
3243
- if (c.wrap(l, u), e.keepMarks && e.editor) {
3240
+ 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);
3242
+ if (!c) return null;
3243
+ if (o.wrap(s, c), e.keepMarks && e.editor) {
3244
3244
  let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
3245
3245
  if (a) {
3246
3246
  let e = a.filter((e) => i.includes(e.type.name));
3247
- c.ensureMarks(e);
3247
+ o.ensureMarks(e);
3248
3248
  }
3249
3249
  }
3250
3250
  if (e.keepAttributes) {
3251
3251
  let t = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
3252
- a().updateAttributes(t, s).run();
3252
+ i().updateAttributes(t, a).run();
3253
3253
  }
3254
- let d = c.doc.resolve(n.from - 1).nodeBefore;
3255
- d && d.type === e.type && i(c.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, d)) && c.join(n.from - 1);
3254
+ let l = o.doc.resolve(n.from - 1).nodeBefore;
3255
+ l && l.type === e.type && d(o.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, l)) && o.join(n.from - 1);
3256
3256
  },
3257
3257
  undoable: e.undoable
3258
3258
  });
@@ -3387,7 +3387,7 @@ var ii = (e) => "touches" in e, ai = class {
3387
3387
  height: e / this.aspectRatio
3388
3388
  };
3389
3389
  }
3390
- }, oi = class e extends Or {
3390
+ }, oi = class e extends Ar {
3391
3391
  constructor(...e) {
3392
3392
  super(...e), this.type = "node";
3393
3393
  }
@@ -3424,49 +3424,49 @@ var ii = (e) => "touches" in e, ai = class {
3424
3424
  return null;
3425
3425
  }
3426
3426
  onDragStart(e) {
3427
- let { view: t } = this.editor, n = e.target, r = n.nodeType === 3 ? n.parentElement?.closest("[data-drag-handle]") : n.closest("[data-drag-handle]");
3428
- if (!this.dom || this.contentDOM?.contains(n) || !r) return;
3429
- let i = 0, a = 0;
3430
- if (this.dom !== r) {
3431
- let t = this.dom.getBoundingClientRect(), n = r.getBoundingClientRect(), o = e.offsetX ?? e.nativeEvent?.offsetX, s = e.offsetY ?? e.nativeEvent?.offsetY;
3432
- i = n.x - t.x + o, a = n.y - t.y + s;
3427
+ let { view: t } = this.editor, r = e.target, i = r.nodeType === 3 ? r.parentElement?.closest("[data-drag-handle]") : r.closest("[data-drag-handle]");
3428
+ if (!this.dom || this.contentDOM?.contains(r) || !i) return;
3429
+ let a = 0, o = 0;
3430
+ if (this.dom !== i) {
3431
+ let t = this.dom.getBoundingClientRect(), n = i.getBoundingClientRect(), r = e.offsetX ?? e.nativeEvent?.offsetX, s = e.offsetY ?? e.nativeEvent?.offsetY;
3432
+ a = n.x - t.x + r, o = n.y - t.y + s;
3433
3433
  }
3434
- let o = this.dom.cloneNode(!0);
3434
+ let s = this.dom.cloneNode(!0);
3435
3435
  try {
3436
3436
  let e = this.dom.getBoundingClientRect();
3437
- o.style.width = `${Math.round(e.width)}px`, o.style.height = `${Math.round(e.height)}px`, o.style.boxSizing = "border-box", o.style.pointerEvents = "none";
3437
+ s.style.width = `${Math.round(e.width)}px`, s.style.height = `${Math.round(e.height)}px`, s.style.boxSizing = "border-box", s.style.pointerEvents = "none";
3438
3438
  } catch {}
3439
- let s = null;
3439
+ let c = null;
3440
3440
  try {
3441
- var c;
3442
- s = document.createElement("div"), s.style.position = "absolute", s.style.top = "-9999px", s.style.left = "-9999px", s.style.pointerEvents = "none", s.appendChild(o), document.body.appendChild(s), (c = e.dataTransfer) == null || c.setDragImage(o, i, a);
3441
+ var l;
3442
+ c = document.createElement("div"), c.style.position = "absolute", c.style.top = "-9999px", c.style.left = "-9999px", c.style.pointerEvents = "none", c.appendChild(s), document.body.appendChild(c), (l = e.dataTransfer) == null || l.setDragImage(s, a, o);
3443
3443
  } finally {
3444
- s && setTimeout(() => {
3444
+ c && setTimeout(() => {
3445
3445
  try {
3446
- s?.remove();
3446
+ c?.remove();
3447
3447
  } catch {}
3448
3448
  }, 0);
3449
3449
  }
3450
- let l = this.getPos();
3451
- if (typeof l != "number") return;
3452
- let u = S.create(t.state.doc, l), d = t.state.tr.setSelection(u);
3453
- t.dispatch(d);
3450
+ let u = this.getPos();
3451
+ if (typeof u != "number") return;
3452
+ let d = n.create(t.state.doc, u), f = t.state.tr.setSelection(d);
3453
+ t.dispatch(f);
3454
3454
  }
3455
3455
  stopEvent(e) {
3456
3456
  if (!this.dom) return !1;
3457
3457
  if (typeof this.options.stopEvent == "function") return this.options.stopEvent({ event: e });
3458
3458
  let t = e.target;
3459
3459
  if (!this.dom.contains(t) || this.contentDOM?.contains(t)) return !1;
3460
- let n = e.type.startsWith("drag"), r = e.type === "dragover" || e.type === "dragenter", i = e.type === "drop";
3460
+ let r = e.type.startsWith("drag"), i = e.type === "dragover" || e.type === "dragenter", a = e.type === "drop";
3461
3461
  if (([
3462
3462
  "INPUT",
3463
3463
  "BUTTON",
3464
3464
  "SELECT",
3465
3465
  "TEXTAREA"
3466
- ].includes(t.tagName) || t.isContentEditable) && !i && !n) return !0;
3467
- let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c = S.isSelectable(this.node), l = e.type === "copy", u = e.type === "paste", d = e.type === "cut", f = e.type === "mousedown";
3468
- if (!s && c && n && e.target === this.dom && e.preventDefault(), s && n && !o && e.target === this.dom) return e.preventDefault(), !1;
3469
- if (s && a && !o && f) {
3466
+ ].includes(t.tagName) || t.isContentEditable) && !a && !r) return !0;
3467
+ let { isEditable: o } = this.editor, { isDragging: s } = this, c = !!this.node.type.spec.draggable, l = n.isSelectable(this.node), u = e.type === "copy", d = e.type === "paste", f = e.type === "cut", p = e.type === "mousedown";
3468
+ if (!c && l && r && e.target === this.dom && e.preventDefault(), c && r && !s && e.target === this.dom) return e.preventDefault(), !1;
3469
+ if (c && o && !s && p) {
3470
3470
  let e = t.closest("[data-drag-handle]");
3471
3471
  e && (this.dom === e || this.dom.contains(e)) && (this.isDragging = !0, document.addEventListener("dragend", () => {
3472
3472
  this.isDragging = !1;
@@ -3476,10 +3476,10 @@ var ii = (e) => "touches" in e, ai = class {
3476
3476
  this.isDragging = !1;
3477
3477
  }, { once: !0 }));
3478
3478
  }
3479
- return !(o || r || i || l || u || d || f && c);
3479
+ return !(s || i || a || u || d || f || p && l);
3480
3480
  }
3481
3481
  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" && (I() || Be()) && 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);
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);
3483
3483
  }
3484
3484
  updateAttributes(e) {
3485
3485
  this.editor.commands.command(({ tr: t }) => {
@@ -3501,19 +3501,19 @@ var ii = (e) => "touches" in e, ai = class {
3501
3501
  }
3502
3502
  };
3503
3503
  function ci(e) {
3504
- return new Ar({
3504
+ return new Mr({
3505
3505
  find: e.find,
3506
3506
  handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
3507
- let a = H(e.getAttributes, void 0, r, i);
3507
+ let a = R(e.getAttributes, void 0, r, i);
3508
3508
  if (a === !1 || a === null) return null;
3509
3509
  let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
3510
3510
  if (s) {
3511
3511
  let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
3512
- if (Qt(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;
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;
3513
3513
  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
3514
  }
3515
3515
  }
3516
3516
  });
3517
3517
  }
3518
3518
  //#endregion
3519
- export { z as A, Sr as B, W as C, an as D, Kt as E, ci as F, ti as H, It as I, ei as L, ln as M, Re as N, on as O, $r as P, yr as R, en as S, Gt as T, ri as U, ni as V, V as _, oi as a, $t as b, ai as c, Tt as d, mr as f, Zt as g, Jt as h, kr as i, J as j, gr as k, H as l, Dt as m, $ as n, si as o, Et as p, Q as r, Ar as s, Qr as t, fr as u, N as v, hr as w, j as x, Qt as y, pn as z };
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 };