@lunejs/admin-ui 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/lib/api/codegen/graphql.d.ts +1 -0
  2. package/dist/lib/api/codegen/graphql.js +8 -8
  3. package/dist/lib/custom-fields/components/details/is-list/custom-field-is-list.js +6 -4
  4. package/dist/lib/custom-fields/components/details/use-form/form-schema.d.ts +1 -0
  5. package/dist/lib/custom-fields/components/details/use-form/form-schema.js +4 -3
  6. package/dist/lib/custom-fields/components/fields/custom-field.js +44 -36
  7. package/dist/lib/custom-fields/components/fields/rich-text.d.ts +8 -0
  8. package/dist/lib/custom-fields/components/fields/rich-text.js +17 -0
  9. package/dist/lib/custom-fields/components/fields/shared/primitive.d.ts +2 -1
  10. package/dist/lib/custom-fields/components/fields/shared/primitive.js +67 -61
  11. package/dist/lib/custom-fields/utils/custom-field.utils.js +63 -51
  12. package/dist/lib/translate/components/form/translate-form-row-data.d.ts +2 -1
  13. package/dist/lib/translate/components/form/translate-form-row-data.js +51 -19
  14. package/dist/lib/translate/components/form/translate-rich-text.d.ts +8 -0
  15. package/dist/lib/translate/components/form/translate-rich-text.js +65 -0
  16. package/dist/lib/translate/components/product-form/custom-fields/translate-product-custom-fields.js +95 -63
  17. package/dist/lib/translate/components/product-form/translate-product-form.js +19 -18
  18. package/dist/node_modules/@tiptap/core/dist/index.js +876 -872
  19. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  20. package/dist/node_modules/@tiptap/react/dist/index.js +35 -34
  21. package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
  22. package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
  23. package/dist/node_modules/lucide-react/dist/esm/icons/layout-list.js +13 -0
  24. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
  25. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
  26. package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
  27. package/dist/node_modules/rope-sequence/dist/index.js +100 -0
  28. package/dist/shared/components/rich-editor/rich-editor.d.ts +3 -1
  29. package/dist/shared/components/rich-editor/rich-editor.js +40 -36
  30. package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +10 -9
  31. package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +1 -0
  32. package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +1 -0
  33. package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +5 -4
  34. package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +8 -7
  35. package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +1 -0
  36. package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +9 -8
  37. package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +7 -6
  38. package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +3 -2
  39. package/package.json +1 -1
@@ -1,25 +1,25 @@
1
- import { Transform as pe, findWrapping as me, canJoin as ft, RemoveMarkStep as he, liftTarget as ge, joinPoint as Rt, canSplit as Z, ReplaceStep as ve, ReplaceAroundStep as be } from "../../../prosemirror-transform/dist/index.js";
2
- import { createParagraphNear as ke, deleteSelection as ye, exitCode as we, joinUp as Me, joinDown as xe, joinBackward as Se, joinForward as Ee, joinTextblockBackward as Te, joinTextblockForward as Ae, lift as Ce, liftEmptyBlock as Pe, newlineInCode as $e, selectNodeBackward as Ne, selectNodeForward as Ie, selectParentNode as Be, selectTextblockEnd as Re, selectTextblockStart as je, setBlockType as Et, wrapIn as Oe } from "../../../prosemirror-commands/dist/index.js";
3
- import { EditorState as De, Selection as F, TextSelection as P, Plugin as $, PluginKey as O, AllSelection as _e, NodeSelection as jt } from "../../../prosemirror-state/dist/index.js";
1
+ import { Transform as pe, findWrapping as me, canJoin as ft, RemoveMarkStep as he, liftTarget as ge, joinPoint as jt, canSplit as Z, ReplaceStep as ve, ReplaceAroundStep as be } from "../../../prosemirror-transform/dist/index.js";
2
+ import { createParagraphNear as ke, deleteSelection as ye, exitCode as we, joinUp as Me, joinDown as xe, joinBackward as Se, joinForward as Ee, joinTextblockBackward as Te, joinTextblockForward as Ae, lift as Ce, liftEmptyBlock as Pe, newlineInCode as $e, selectNodeBackward as Ne, selectNodeForward as Ie, selectParentNode as Be, selectTextblockEnd as Re, selectTextblockStart as je, setBlockType as Tt, wrapIn as Oe } from "../../../prosemirror-commands/dist/index.js";
3
+ import { NodeSelection as pt, EditorState as De, Selection as F, TextSelection as P, Plugin as $, PluginKey as O, AllSelection as _e } from "../../../prosemirror-state/dist/index.js";
4
4
  import { DOMSerializer as ze, Schema as Ot, Fragment as j, Node as Fe, DOMParser as it, Slice as Le } from "../../../prosemirror-model/dist/index.js";
5
5
  import { liftListItem as Ve, sinkListItem as He, wrapInList as Ue } from "../../../prosemirror-schema-list/dist/index.js";
6
6
  import { EditorView as We } from "../../../prosemirror-view/dist/index.js";
7
7
  import { keymap as qe } from "../../../prosemirror-keymap/dist/index.js";
8
- var Ke = Object.defineProperty, pt = (e, t) => {
9
- for (var n in t)
10
- Ke(e, n, { get: t[n], enumerable: !0 });
8
+ var Ke = Object.defineProperty, mt = (t, e) => {
9
+ for (var n in e)
10
+ Ke(t, n, { get: e[n], enumerable: !0 });
11
11
  };
12
- function X(e) {
13
- const { state: t, transaction: n } = e;
12
+ function X(t) {
13
+ const { state: e, transaction: n } = t;
14
14
  let { selection: r } = n, { doc: o } = n, { storedMarks: s } = n;
15
15
  return {
16
- ...t,
17
- apply: t.apply.bind(t),
18
- applyTransaction: t.applyTransaction.bind(t),
19
- plugins: t.plugins,
20
- schema: t.schema,
21
- reconfigure: t.reconfigure.bind(t),
22
- toJSON: t.toJSON.bind(t),
16
+ ...e,
17
+ apply: e.apply.bind(e),
18
+ applyTransaction: e.applyTransaction.bind(e),
19
+ plugins: e.plugins,
20
+ schema: e.schema,
21
+ reconfigure: e.reconfigure.bind(e),
22
+ toJSON: e.toJSON.bind(e),
23
23
  get storedMarks() {
24
24
  return s;
25
25
  },
@@ -35,8 +35,8 @@ function X(e) {
35
35
  };
36
36
  }
37
37
  var tt = class {
38
- constructor(e) {
39
- this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
38
+ constructor(t) {
39
+ this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
40
40
  }
41
41
  get hasCustomState() {
42
42
  return !!this.customState;
@@ -45,9 +45,9 @@ var tt = class {
45
45
  return this.customState || this.editor.state;
46
46
  }
47
47
  get commands() {
48
- const { rawCommands: e, editor: t, state: n } = this, { view: r } = t, { tr: o } = n, s = this.buildProps(o);
48
+ const { rawCommands: t, editor: e, state: n } = this, { view: r } = e, { tr: o } = n, s = this.buildProps(o);
49
49
  return Object.fromEntries(
50
- Object.entries(e).map(([i, c]) => [i, (...l) => {
50
+ Object.entries(t).map(([i, c]) => [i, (...l) => {
51
51
  const u = c(...l)(s);
52
52
  return !o.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(o), u;
53
53
  }])
@@ -59,11 +59,11 @@ var tt = class {
59
59
  get can() {
60
60
  return () => this.createCan();
61
61
  }
62
- createChain(e, t = !0) {
63
- const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = [], c = !!e, a = e || o.tr, l = () => (!c && t && !a.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(a), i.every((d) => d === !0)), u = {
62
+ createChain(t, e = !0) {
63
+ const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = [], c = !!t, a = t || o.tr, l = () => (!c && e && !a.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(a), i.every((d) => d === !0)), u = {
64
64
  ...Object.fromEntries(
65
65
  Object.entries(n).map(([d, f]) => [d, (...m) => {
66
- const h = this.buildProps(a, t), g = f(...m)(h);
66
+ const h = this.buildProps(a, e), g = f(...m)(h);
67
67
  return i.push(g), u;
68
68
  }])
69
69
  ),
@@ -71,28 +71,28 @@ var tt = class {
71
71
  };
72
72
  return u;
73
73
  }
74
- createCan(e) {
75
- const { rawCommands: t, state: n } = this, r = !1, o = e || n.tr, s = this.buildProps(o, r);
74
+ createCan(t) {
75
+ const { rawCommands: e, state: n } = this, r = !1, o = t || n.tr, s = this.buildProps(o, r);
76
76
  return {
77
77
  ...Object.fromEntries(
78
- Object.entries(t).map(([c, a]) => [c, (...l) => a(...l)({ ...s, dispatch: void 0 })])
78
+ Object.entries(e).map(([c, a]) => [c, (...l) => a(...l)({ ...s, dispatch: void 0 })])
79
79
  ),
80
80
  chain: () => this.createChain(o, r)
81
81
  };
82
82
  }
83
- buildProps(e, t = !0) {
83
+ buildProps(t, e = !0) {
84
84
  const { rawCommands: n, editor: r, state: o } = this, { view: s } = r, i = {
85
- tr: e,
85
+ tr: t,
86
86
  editor: r,
87
87
  view: s,
88
88
  state: X({
89
89
  state: o,
90
- transaction: e
90
+ transaction: t
91
91
  }),
92
- dispatch: t ? () => {
92
+ dispatch: e ? () => {
93
93
  } : void 0,
94
- chain: () => this.createChain(e, t),
95
- can: () => this.createCan(e),
94
+ chain: () => this.createChain(t, e),
95
+ can: () => this.createCan(t),
96
96
  get commands() {
97
97
  return Object.fromEntries(
98
98
  Object.entries(n).map(([c, a]) => [c, (...l) => a(...l)(i)])
@@ -102,7 +102,7 @@ var tt = class {
102
102
  return i;
103
103
  }
104
104
  }, Dt = {};
105
- pt(Dt, {
105
+ mt(Dt, {
106
106
  blur: () => Je,
107
107
  clearContent: () => Ze,
108
108
  clearNodes: () => Qe,
@@ -164,211 +164,211 @@ pt(Dt, {
164
164
  wrapIn: () => Mr,
165
165
  wrapInList: () => xr
166
166
  });
167
- var Je = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
167
+ var Je = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
168
168
  var n;
169
- e.isDestroyed || (t.dom.blur(), (n = window?.getSelection()) == null || n.removeAllRanges());
170
- }), !0), Ze = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Qe = () => ({ state: e, tr: t, dispatch: n }) => {
171
- const { selection: r } = t, { ranges: o } = r;
169
+ t.isDestroyed || (e.dom.blur(), (n = window?.getSelection()) == null || n.removeAllRanges());
170
+ }), !0), Ze = (t = !0) => ({ commands: e }) => e.setContent("", { emitUpdate: t }), Qe = () => ({ state: t, tr: e, dispatch: n }) => {
171
+ const { selection: r } = e, { ranges: o } = r;
172
172
  return n && o.forEach(({ $from: s, $to: i }) => {
173
- e.doc.nodesBetween(s.pos, i.pos, (c, a) => {
173
+ t.doc.nodesBetween(s.pos, i.pos, (c, a) => {
174
174
  if (c.type.isText)
175
175
  return;
176
- const { doc: l, mapping: u } = t, d = l.resolve(u.map(a)), f = l.resolve(u.map(a + c.nodeSize)), p = d.blockRange(f);
176
+ const { doc: l, mapping: u } = e, d = l.resolve(u.map(a)), f = l.resolve(u.map(a + c.nodeSize)), p = d.blockRange(f);
177
177
  if (!p)
178
178
  return;
179
179
  const m = ge(p);
180
180
  if (c.type.isTextblock) {
181
181
  const { defaultType: h } = d.parent.contentMatchAt(d.index());
182
- t.setNodeMarkup(p.start, h);
182
+ e.setNodeMarkup(p.start, h);
183
183
  }
184
- (m || m === 0) && t.lift(p, m);
184
+ (m || m === 0) && e.lift(p, m);
185
185
  });
186
186
  }), !0;
187
- }, Ge = (e) => (t) => e(t), Ye = () => ({ state: e, dispatch: t }) => ke(e, t), Xe = (e, t) => ({ editor: n, tr: r }) => {
188
- const { state: o } = n, s = o.doc.slice(e.from, e.to);
189
- r.deleteRange(e.from, e.to);
190
- const i = r.mapping.map(t);
187
+ }, Ge = (t) => (e) => t(e), Ye = () => ({ state: t, dispatch: e }) => ke(t, e), Xe = (t, e) => ({ editor: n, tr: r }) => {
188
+ const { state: o } = n, s = o.doc.slice(t.from, t.to);
189
+ r.deleteRange(t.from, t.to);
190
+ const i = r.mapping.map(e);
191
191
  return r.insert(i, s.content), r.setSelection(new P(r.doc.resolve(Math.max(i - 1, 0)))), !0;
192
- }, tn = () => ({ tr: e, dispatch: t }) => {
193
- const { selection: n } = e, r = n.$anchor.node();
192
+ }, tn = () => ({ tr: t, dispatch: e }) => {
193
+ const { selection: n } = t, r = n.$anchor.node();
194
194
  if (r.content.size > 0)
195
195
  return !1;
196
- const o = e.selection.$anchor;
196
+ const o = t.selection.$anchor;
197
197
  for (let s = o.depth; s > 0; s -= 1)
198
198
  if (o.node(s).type === r.type) {
199
- if (t) {
199
+ if (e) {
200
200
  const c = o.before(s), a = o.after(s);
201
- e.delete(c, a).scrollIntoView();
201
+ t.delete(c, a).scrollIntoView();
202
202
  }
203
203
  return !0;
204
204
  }
205
205
  return !1;
206
206
  };
207
- function T(e, t) {
208
- if (typeof e == "string") {
209
- if (!t.nodes[e])
210
- throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
211
- return t.nodes[e];
207
+ function T(t, e) {
208
+ if (typeof t == "string") {
209
+ if (!e.nodes[t])
210
+ throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);
211
+ return e.nodes[t];
212
212
  }
213
- return e;
213
+ return t;
214
214
  }
215
- var en = (e) => ({ tr: t, state: n, dispatch: r }) => {
216
- const o = T(e, n.schema), s = t.selection.$anchor;
215
+ var en = (t) => ({ tr: e, state: n, dispatch: r }) => {
216
+ const o = T(t, n.schema), s = e.selection.$anchor;
217
217
  for (let i = s.depth; i > 0; i -= 1)
218
218
  if (s.node(i).type === o) {
219
219
  if (r) {
220
220
  const a = s.before(i), l = s.after(i);
221
- t.delete(a, l).scrollIntoView();
221
+ e.delete(a, l).scrollIntoView();
222
222
  }
223
223
  return !0;
224
224
  }
225
225
  return !1;
226
- }, nn = (e) => ({ tr: t, dispatch: n }) => {
227
- const { from: r, to: o } = e;
228
- return n && t.delete(r, o), !0;
229
- }, rn = () => ({ state: e, dispatch: t }) => ye(e, t), on = () => ({ commands: e }) => e.keyboardShortcut("Enter"), sn = () => ({ state: e, dispatch: t }) => we(e, t);
230
- function mt(e) {
231
- return Object.prototype.toString.call(e) === "[object RegExp]";
232
- }
233
- function G(e, t, n = { strict: !0 }) {
234
- const r = Object.keys(t);
235
- return r.length ? r.every((o) => n.strict ? t[o] === e[o] : mt(t[o]) ? t[o].test(e[o]) : t[o] === e[o]) : !0;
236
- }
237
- function _t(e, t, n = {}) {
238
- return e.find((r) => r.type === t && G(
226
+ }, nn = (t) => ({ tr: e, dispatch: n }) => {
227
+ const { from: r, to: o } = t;
228
+ return n && e.delete(r, o), !0;
229
+ }, rn = () => ({ state: t, dispatch: e }) => ye(t, e), on = () => ({ commands: t }) => t.keyboardShortcut("Enter"), sn = () => ({ state: t, dispatch: e }) => we(t, e);
230
+ function ht(t) {
231
+ return Object.prototype.toString.call(t) === "[object RegExp]";
232
+ }
233
+ function G(t, e, n = { strict: !0 }) {
234
+ const r = Object.keys(e);
235
+ return r.length ? r.every((o) => n.strict ? e[o] === t[o] : ht(e[o]) ? e[o].test(t[o]) : e[o] === t[o]) : !0;
236
+ }
237
+ function _t(t, e, n = {}) {
238
+ return t.find((r) => r.type === e && G(
239
239
  // Only check equality for the attributes that are provided
240
240
  Object.fromEntries(Object.keys(n).map((o) => [o, r.attrs[o]])),
241
241
  n
242
242
  ));
243
243
  }
244
- function Tt(e, t, n = {}) {
245
- return !!_t(e, t, n);
244
+ function At(t, e, n = {}) {
245
+ return !!_t(t, e, n);
246
246
  }
247
- function ht(e, t, n) {
247
+ function gt(t, e, n) {
248
248
  var r;
249
- if (!e || !t)
249
+ if (!t || !e)
250
250
  return;
251
- let o = e.parent.childAfter(e.parentOffset);
252
- if ((!o.node || !o.node.marks.some((u) => u.type === t)) && (o = e.parent.childBefore(e.parentOffset)), !o.node || !o.node.marks.some((u) => u.type === t) || (n = n || ((r = o.node.marks[0]) == null ? void 0 : r.attrs), !_t([...o.node.marks], t, n)))
251
+ let o = t.parent.childAfter(t.parentOffset);
252
+ if ((!o.node || !o.node.marks.some((u) => u.type === e)) && (o = t.parent.childBefore(t.parentOffset)), !o.node || !o.node.marks.some((u) => u.type === e) || (n = n || ((r = o.node.marks[0]) == null ? void 0 : r.attrs), !_t([...o.node.marks], e, n)))
253
253
  return;
254
- let i = o.index, c = e.start() + o.offset, a = i + 1, l = c + o.node.nodeSize;
255
- for (; i > 0 && Tt([...e.parent.child(i - 1).marks], t, n); )
256
- i -= 1, c -= e.parent.child(i).nodeSize;
257
- for (; a < e.parent.childCount && Tt([...e.parent.child(a).marks], t, n); )
258
- l += e.parent.child(a).nodeSize, a += 1;
254
+ let i = o.index, c = t.start() + o.offset, a = i + 1, l = c + o.node.nodeSize;
255
+ for (; i > 0 && At([...t.parent.child(i - 1).marks], e, n); )
256
+ i -= 1, c -= t.parent.child(i).nodeSize;
257
+ for (; a < t.parent.childCount && At([...t.parent.child(a).marks], e, n); )
258
+ l += t.parent.child(a).nodeSize, a += 1;
259
259
  return {
260
260
  from: c,
261
261
  to: l
262
262
  };
263
263
  }
264
- function B(e, t) {
265
- if (typeof e == "string") {
266
- if (!t.marks[e])
267
- throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
268
- return t.marks[e];
264
+ function B(t, e) {
265
+ if (typeof t == "string") {
266
+ if (!e.marks[t])
267
+ throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);
268
+ return e.marks[t];
269
269
  }
270
- return e;
270
+ return t;
271
271
  }
272
- var an = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
273
- const s = B(e, r.schema), { doc: i, selection: c } = n, { $from: a, from: l, to: u } = c;
272
+ var an = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
273
+ const s = B(t, r.schema), { doc: i, selection: c } = n, { $from: a, from: l, to: u } = c;
274
274
  if (o) {
275
- const d = ht(a, s, t);
275
+ const d = gt(a, s, e);
276
276
  if (d && d.from <= l && d.to >= u) {
277
277
  const f = P.create(i, d.from, d.to);
278
278
  n.setSelection(f);
279
279
  }
280
280
  }
281
281
  return !0;
282
- }, cn = (e) => (t) => {
283
- const n = typeof e == "function" ? e(t) : e;
282
+ }, cn = (t) => (e) => {
283
+ const n = typeof t == "function" ? t(e) : t;
284
284
  for (let r = 0; r < n.length; r += 1)
285
- if (n[r](t))
285
+ if (n[r](e))
286
286
  return !0;
287
287
  return !1;
288
288
  };
289
- function zt(e) {
290
- return e instanceof P;
289
+ function zt(t) {
290
+ return t instanceof P;
291
291
  }
292
- function _(e = 0, t = 0, n = 0) {
293
- return Math.min(Math.max(e, t), n);
292
+ function _(t = 0, e = 0, n = 0) {
293
+ return Math.min(Math.max(t, e), n);
294
294
  }
295
- function Ft(e, t = null) {
296
- if (!t)
295
+ function Ft(t, e = null) {
296
+ if (!e)
297
297
  return null;
298
- const n = F.atStart(e), r = F.atEnd(e);
299
- if (t === "start" || t === !0)
298
+ const n = F.atStart(t), r = F.atEnd(t);
299
+ if (e === "start" || e === !0)
300
300
  return n;
301
- if (t === "end")
301
+ if (e === "end")
302
302
  return r;
303
303
  const o = n.from, s = r.to;
304
- return t === "all" ? P.create(e, _(0, o, s), _(e.content.size, o, s)) : P.create(e, _(t, o, s), _(t, o, s));
304
+ return e === "all" ? P.create(t, _(0, o, s), _(t.content.size, o, s)) : P.create(t, _(e, o, s), _(e, o, s));
305
305
  }
306
306
  function ln() {
307
307
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
308
308
  }
309
- function gt() {
309
+ function vt() {
310
310
  return ["iPad Simulator", "iPhone Simulator", "iPod Simulator", "iPad", "iPhone", "iPod"].includes(navigator.platform) || // iPad on iOS 13 detection
311
311
  navigator.userAgent.includes("Mac") && "ontouchend" in document;
312
312
  }
313
- var dn = (e = null, t = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
314
- t = {
313
+ var dn = (t = null, e = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
314
+ e = {
315
315
  scrollIntoView: !0,
316
- ...t
316
+ ...e
317
317
  };
318
318
  const i = () => {
319
- (gt() || ln()) && r.dom.focus(), requestAnimationFrame(() => {
320
- n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
319
+ (vt() || ln()) && r.dom.focus(), requestAnimationFrame(() => {
320
+ n.isDestroyed || (r.focus(), e?.scrollIntoView && n.commands.scrollIntoView());
321
321
  });
322
322
  };
323
- if (r.hasFocus() && e === null || e === !1)
323
+ if (r.hasFocus() && t === null || t === !1)
324
324
  return !0;
325
- if (s && e === null && !zt(n.state.selection))
325
+ if (s && t === null && !zt(n.state.selection))
326
326
  return i(), !0;
327
- const c = Ft(o.doc, e) || n.state.selection, a = n.state.selection.eq(c);
327
+ const c = Ft(o.doc, t) || n.state.selection, a = n.state.selection.eq(c);
328
328
  return s && (a || o.setSelection(c), a && o.storedMarks && o.setStoredMarks(o.storedMarks), i()), !0;
329
- }, un = (e, t) => (n) => e.every((r, o) => t(r, { ...n, index: o })), fn = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), Lt = (e) => {
330
- const t = e.childNodes;
331
- for (let n = t.length - 1; n >= 0; n -= 1) {
332
- const r = t[n];
333
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Lt(r);
329
+ }, un = (t, e) => (n) => t.every((r, o) => e(r, { ...n, index: o })), fn = (t, e) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, t, e), Lt = (t) => {
330
+ const e = t.childNodes;
331
+ for (let n = e.length - 1; n >= 0; n -= 1) {
332
+ const r = e[n];
333
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? t.removeChild(r) : r.nodeType === 1 && Lt(r);
334
334
  }
335
- return e;
335
+ return t;
336
336
  };
337
- function W(e) {
337
+ function W(t) {
338
338
  if (typeof window > "u")
339
339
  throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");
340
- const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
340
+ const e = `<body>${t}</body>`, n = new window.DOMParser().parseFromString(e, "text/html").body;
341
341
  return Lt(n);
342
342
  }
343
- function V(e, t, n) {
344
- if (e instanceof Fe || e instanceof j)
345
- return e;
343
+ function V(t, e, n) {
344
+ if (t instanceof Fe || t instanceof j)
345
+ return t;
346
346
  n = {
347
347
  slice: !0,
348
348
  parseOptions: {},
349
349
  ...n
350
350
  };
351
- const r = typeof e == "object" && e !== null, o = typeof e == "string";
351
+ const r = typeof t == "object" && t !== null, o = typeof t == "string";
352
352
  if (r)
353
353
  try {
354
- if (Array.isArray(e) && e.length > 0)
355
- return j.fromArray(e.map((c) => t.nodeFromJSON(c)));
356
- const i = t.nodeFromJSON(e);
354
+ if (Array.isArray(t) && t.length > 0)
355
+ return j.fromArray(t.map((c) => e.nodeFromJSON(c)));
356
+ const i = e.nodeFromJSON(t);
357
357
  return n.errorOnInvalidContent && i.check(), i;
358
358
  } catch (s) {
359
359
  if (n.errorOnInvalidContent)
360
360
  throw new Error("[tiptap error]: Invalid JSON content", { cause: s });
361
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", s), V("", t, n);
361
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", t, "Error:", s), V("", e, n);
362
362
  }
363
363
  if (o) {
364
364
  if (n.errorOnInvalidContent) {
365
365
  let i = !1, c = "";
366
366
  const a = new Ot({
367
- topNode: t.spec.topNode,
368
- marks: t.spec.marks,
367
+ topNode: e.spec.topNode,
368
+ marks: e.spec.marks,
369
369
  // Prosemirror's schemas are executed such that: the last to execute, matches last
370
370
  // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
371
- nodes: t.spec.nodes.append({
371
+ nodes: e.spec.nodes.append({
372
372
  __tiptap__private__unknown__catch__all__node: {
373
373
  content: "inline*",
374
374
  group: "block",
@@ -381,30 +381,30 @@ function V(e, t, n) {
381
381
  }
382
382
  })
383
383
  });
384
- if (n.slice ? it.fromSchema(a).parseSlice(W(e), n.parseOptions) : it.fromSchema(a).parse(W(e), n.parseOptions), n.errorOnInvalidContent && i)
384
+ if (n.slice ? it.fromSchema(a).parseSlice(W(t), n.parseOptions) : it.fromSchema(a).parse(W(t), n.parseOptions), n.errorOnInvalidContent && i)
385
385
  throw new Error("[tiptap error]: Invalid HTML content", {
386
386
  cause: new Error(`Invalid element found: ${c}`)
387
387
  });
388
388
  }
389
- const s = it.fromSchema(t);
390
- return n.slice ? s.parseSlice(W(e), n.parseOptions).content : s.parse(W(e), n.parseOptions);
389
+ const s = it.fromSchema(e);
390
+ return n.slice ? s.parseSlice(W(t), n.parseOptions).content : s.parse(W(t), n.parseOptions);
391
391
  }
392
- return V("", t, n);
392
+ return V("", e, n);
393
393
  }
394
- function pn(e, t, n) {
395
- const r = e.steps.length - 1;
396
- if (r < t)
394
+ function pn(t, e, n) {
395
+ const r = t.steps.length - 1;
396
+ if (r < e)
397
397
  return;
398
- const o = e.steps[r];
398
+ const o = t.steps[r];
399
399
  if (!(o instanceof ve || o instanceof be))
400
400
  return;
401
- const s = e.mapping.maps[r];
401
+ const s = t.mapping.maps[r];
402
402
  let i = 0;
403
403
  s.forEach((c, a, l, u) => {
404
404
  i === 0 && (i = u);
405
- }), e.setSelection(F.near(e.doc.resolve(i), n));
405
+ }), t.setSelection(F.near(t.doc.resolve(i), n));
406
406
  }
407
- var mn = (e) => !("type" in e), hn = (e, t, n) => ({ tr: r, dispatch: o, editor: s }) => {
407
+ var mn = (t) => !("type" in t), hn = (t, e, n) => ({ tr: r, dispatch: o, editor: s }) => {
408
408
  var i;
409
409
  if (o) {
410
410
  n = {
@@ -429,7 +429,7 @@ var mn = (e) => !("type" in e), hn = (e, t, n) => ({ tr: r, dispatch: o, editor:
429
429
  };
430
430
  if (!n.errorOnInvalidContent && !s.options.enableContentCheck && s.options.emitContentError)
431
431
  try {
432
- V(t, s.schema, {
432
+ V(e, s.schema, {
433
433
  parseOptions: l,
434
434
  errorOnInvalidContent: !0
435
435
  });
@@ -437,14 +437,14 @@ var mn = (e) => !("type" in e), hn = (e, t, n) => ({ tr: r, dispatch: o, editor:
437
437
  a(g);
438
438
  }
439
439
  try {
440
- c = V(t, s.schema, {
440
+ c = V(e, s.schema, {
441
441
  parseOptions: l,
442
442
  errorOnInvalidContent: (i = n.errorOnInvalidContent) != null ? i : s.options.enableContentCheck
443
443
  });
444
444
  } catch (g) {
445
445
  return a(g), !1;
446
446
  }
447
- let { from: u, to: d } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, f = !0, p = !0;
447
+ let { from: u, to: d } = typeof t == "number" ? { from: t, to: t } : { from: t.from, to: t.to }, f = !0, p = !0;
448
448
  if ((mn(c) ? c : [c]).forEach((g) => {
449
449
  g.check(), f = f ? g.isText && g.marks.length === 0 : !1, p = p ? g.isBlock : !1;
450
450
  }), u === d && p) {
@@ -453,14 +453,14 @@ var mn = (e) => !("type" in e), hn = (e, t, n) => ({ tr: r, dispatch: o, editor:
453
453
  }
454
454
  let h;
455
455
  if (f) {
456
- if (Array.isArray(t))
457
- h = t.map((g) => g.text || "").join("");
458
- else if (t instanceof j) {
456
+ if (Array.isArray(e))
457
+ h = e.map((g) => g.text || "").join("");
458
+ else if (e instanceof j) {
459
459
  let g = "";
460
- t.forEach((v) => {
460
+ e.forEach((v) => {
461
461
  v.text && (g += v.text);
462
462
  }), h = g;
463
- } else typeof t == "object" && t && t.text ? h = t.text : h = t;
463
+ } else typeof e == "object" && e && e.text ? h = e.text : h = e;
464
464
  r.insertText(h, u, d);
465
465
  } else {
466
466
  h = c;
@@ -470,31 +470,31 @@ var mn = (e) => !("type" in e), hn = (e, t, n) => ({ tr: r, dispatch: o, editor:
470
470
  n.updateSelection && pn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: u, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: u, text: h });
471
471
  }
472
472
  return !0;
473
- }, gn = () => ({ state: e, dispatch: t }) => Me(e, t), vn = () => ({ state: e, dispatch: t }) => xe(e, t), bn = () => ({ state: e, dispatch: t }) => Se(e, t), kn = () => ({ state: e, dispatch: t }) => Ee(e, t), yn = () => ({ state: e, dispatch: t, tr: n }) => {
473
+ }, gn = () => ({ state: t, dispatch: e }) => Me(t, e), vn = () => ({ state: t, dispatch: e }) => xe(t, e), bn = () => ({ state: t, dispatch: e }) => Se(t, e), kn = () => ({ state: t, dispatch: e }) => Ee(t, e), yn = () => ({ state: t, dispatch: e, tr: n }) => {
474
474
  try {
475
- const r = Rt(e.doc, e.selection.$from.pos, -1);
476
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
475
+ const r = jt(t.doc, t.selection.$from.pos, -1);
476
+ return r == null ? !1 : (n.join(r, 2), e && e(n), !0);
477
477
  } catch {
478
478
  return !1;
479
479
  }
480
- }, wn = () => ({ state: e, dispatch: t, tr: n }) => {
480
+ }, wn = () => ({ state: t, dispatch: e, tr: n }) => {
481
481
  try {
482
- const r = Rt(e.doc, e.selection.$from.pos, 1);
483
- return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
482
+ const r = jt(t.doc, t.selection.$from.pos, 1);
483
+ return r == null ? !1 : (n.join(r, 2), e && e(n), !0);
484
484
  } catch {
485
485
  return !1;
486
486
  }
487
- }, Mn = () => ({ state: e, dispatch: t }) => Te(e, t), xn = () => ({ state: e, dispatch: t }) => Ae(e, t);
487
+ }, Mn = () => ({ state: t, dispatch: e }) => Te(t, e), xn = () => ({ state: t, dispatch: e }) => Ae(t, e);
488
488
  function Vt() {
489
489
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
490
490
  }
491
- function Sn(e) {
492
- const t = e.split(/-(?!$)/);
493
- let n = t[t.length - 1];
491
+ function Sn(t) {
492
+ const e = t.split(/-(?!$)/);
493
+ let n = e[e.length - 1];
494
494
  n === "Space" && (n = " ");
495
495
  let r, o, s, i;
496
- for (let c = 0; c < t.length - 1; c += 1) {
497
- const a = t[c];
496
+ for (let c = 0; c < e.length - 1; c += 1) {
497
+ const a = e[c];
498
498
  if (/^(cmd|meta|m)$/i.test(a))
499
499
  i = !0;
500
500
  else if (/^a(lt)?$/i.test(a))
@@ -504,14 +504,14 @@ function Sn(e) {
504
504
  else if (/^s(hift)?$/i.test(a))
505
505
  s = !0;
506
506
  else if (/^mod$/i.test(a))
507
- gt() || Vt() ? i = !0 : o = !0;
507
+ vt() || Vt() ? i = !0 : o = !0;
508
508
  else
509
509
  throw new Error(`Unrecognized modifier name: ${a}`);
510
510
  }
511
511
  return r && (n = `Alt-${n}`), o && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), s && (n = `Shift-${n}`), n;
512
512
  }
513
- var En = (e) => ({ editor: t, view: n, tr: r, dispatch: o }) => {
514
- const s = Sn(e).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), c = new KeyboardEvent("keydown", {
513
+ var En = (t) => ({ editor: e, view: n, tr: r, dispatch: o }) => {
514
+ const s = Sn(t).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), c = new KeyboardEvent("keydown", {
515
515
  key: i === "Space" ? " " : i,
516
516
  altKey: s.includes("Alt"),
517
517
  ctrlKey: s.includes("Ctrl"),
@@ -519,7 +519,7 @@ var En = (e) => ({ editor: t, view: n, tr: r, dispatch: o }) => {
519
519
  shiftKey: s.includes("Shift"),
520
520
  bubbles: !0,
521
521
  cancelable: !0
522
- }), a = t.captureTransaction(() => {
522
+ }), a = e.captureTransaction(() => {
523
523
  n.someProp("handleKeyDown", (l) => l(n, c));
524
524
  });
525
525
  return a?.steps.forEach((l) => {
@@ -527,9 +527,9 @@ var En = (e) => ({ editor: t, view: n, tr: r, dispatch: o }) => {
527
527
  u && o && r.maybeStep(u);
528
528
  }), !0;
529
529
  };
530
- function H(e, t, n = {}) {
531
- const { from: r, to: o, empty: s } = e.selection, i = t ? T(t, e.schema) : null, c = [];
532
- e.doc.nodesBetween(r, o, (d, f) => {
530
+ function H(t, e, n = {}) {
531
+ const { from: r, to: o, empty: s } = t.selection, i = e ? T(e, t.schema) : null, c = [];
532
+ t.doc.nodesBetween(r, o, (d, f) => {
533
533
  if (d.isText)
534
534
  return;
535
535
  const p = Math.max(r, f), m = Math.min(o, f + d.nodeSize);
@@ -542,151 +542,151 @@ function H(e, t, n = {}) {
542
542
  const a = o - r, l = c.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => G(d.node.attrs, n, { strict: !1 }));
543
543
  return s ? !!l.length : l.reduce((d, f) => d + f.to - f.from, 0) >= a;
544
544
  }
545
- var Tn = (e, t = {}) => ({ state: n, dispatch: r }) => {
546
- const o = T(e, n.schema);
547
- return H(n, o, t) ? Ce(n, r) : !1;
548
- }, An = () => ({ state: e, dispatch: t }) => Pe(e, t), Cn = (e) => ({ state: t, dispatch: n }) => {
549
- const r = T(e, t.schema);
550
- return Ve(r)(t, n);
551
- }, Pn = () => ({ state: e, dispatch: t }) => $e(e, t);
552
- function et(e, t) {
553
- return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
554
- }
555
- function At(e, t) {
556
- const n = typeof t == "string" ? [t] : t;
557
- return Object.keys(e).reduce((r, o) => (n.includes(o) || (r[o] = e[o]), r), {});
558
- }
559
- var $n = (e, t) => ({ tr: n, state: r, dispatch: o }) => {
545
+ var Tn = (t, e = {}) => ({ state: n, dispatch: r }) => {
546
+ const o = T(t, n.schema);
547
+ return H(n, o, e) ? Ce(n, r) : !1;
548
+ }, An = () => ({ state: t, dispatch: e }) => Pe(t, e), Cn = (t) => ({ state: e, dispatch: n }) => {
549
+ const r = T(t, e.schema);
550
+ return Ve(r)(e, n);
551
+ }, Pn = () => ({ state: t, dispatch: e }) => $e(t, e);
552
+ function et(t, e) {
553
+ return e.nodes[t] ? "node" : e.marks[t] ? "mark" : null;
554
+ }
555
+ function Ct(t, e) {
556
+ const n = typeof e == "string" ? [e] : e;
557
+ return Object.keys(t).reduce((r, o) => (n.includes(o) || (r[o] = t[o]), r), {});
558
+ }
559
+ var $n = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
560
560
  let s = null, i = null;
561
561
  const c = et(
562
- typeof e == "string" ? e : e.name,
562
+ typeof t == "string" ? t : t.name,
563
563
  r.schema
564
564
  );
565
565
  if (!c)
566
566
  return !1;
567
- c === "node" && (s = T(e, r.schema)), c === "mark" && (i = B(e, r.schema));
567
+ c === "node" && (s = T(t, r.schema)), c === "mark" && (i = B(t, r.schema));
568
568
  let a = !1;
569
569
  return n.selection.ranges.forEach((l) => {
570
570
  r.doc.nodesBetween(l.$from.pos, l.$to.pos, (u, d) => {
571
- s && s === u.type && (a = !0, o && n.setNodeMarkup(d, void 0, At(u.attrs, t))), i && u.marks.length && u.marks.forEach((f) => {
572
- i === f.type && (a = !0, o && n.addMark(d, d + u.nodeSize, i.create(At(f.attrs, t))));
571
+ s && s === u.type && (a = !0, o && n.setNodeMarkup(d, void 0, Ct(u.attrs, e))), i && u.marks.length && u.marks.forEach((f) => {
572
+ i === f.type && (a = !0, o && n.addMark(d, d + u.nodeSize, i.create(Ct(f.attrs, e))));
573
573
  });
574
574
  });
575
575
  }), a;
576
- }, Nn = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), In = () => ({ tr: e, dispatch: t }) => {
577
- if (t) {
578
- const n = new _e(e.doc);
579
- e.setSelection(n);
576
+ }, Nn = () => ({ tr: t, dispatch: e }) => (e && t.scrollIntoView(), !0), In = () => ({ tr: t, dispatch: e }) => {
577
+ if (e) {
578
+ const n = new _e(t.doc);
579
+ t.setSelection(n);
580
580
  }
581
581
  return !0;
582
- }, Bn = () => ({ state: e, dispatch: t }) => Ne(e, t), Rn = () => ({ state: e, dispatch: t }) => Ie(e, t), jn = () => ({ state: e, dispatch: t }) => Be(e, t), On = () => ({ state: e, dispatch: t }) => Re(e, t), Dn = () => ({ state: e, dispatch: t }) => je(e, t);
583
- function dt(e, t, n = {}, r = {}) {
584
- return V(e, t, {
582
+ }, Bn = () => ({ state: t, dispatch: e }) => Ne(t, e), Rn = () => ({ state: t, dispatch: e }) => Ie(t, e), jn = () => ({ state: t, dispatch: e }) => Be(t, e), On = () => ({ state: t, dispatch: e }) => Re(t, e), Dn = () => ({ state: t, dispatch: e }) => je(t, e);
583
+ function dt(t, e, n = {}, r = {}) {
584
+ return V(t, e, {
585
585
  slice: !1,
586
586
  parseOptions: n,
587
587
  errorOnInvalidContent: r.errorOnInvalidContent
588
588
  });
589
589
  }
590
- var _n = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands: c }) => {
590
+ var _n = (t, { errorOnInvalidContent: e, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands: c }) => {
591
591
  const { doc: a } = s;
592
592
  if (r.preserveWhitespace !== "full") {
593
- const l = dt(e, o.schema, r, {
594
- errorOnInvalidContent: t ?? o.options.enableContentCheck
593
+ const l = dt(t, o.schema, r, {
594
+ errorOnInvalidContent: e ?? o.options.enableContentCheck
595
595
  });
596
596
  return i && s.replaceWith(0, a.content.size, l).setMeta("preventUpdate", !n), !0;
597
597
  }
598
- return i && s.setMeta("preventUpdate", !n), c.insertContentAt({ from: 0, to: a.content.size }, e, {
598
+ return i && s.setMeta("preventUpdate", !n), c.insertContentAt({ from: 0, to: a.content.size }, t, {
599
599
  parseOptions: r,
600
- errorOnInvalidContent: t ?? o.options.enableContentCheck
600
+ errorOnInvalidContent: e ?? o.options.enableContentCheck
601
601
  });
602
602
  };
603
- function Ht(e, t) {
604
- const n = B(t, e.schema), { from: r, to: o, empty: s } = e.selection, i = [];
605
- s ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, o, (a) => {
603
+ function Ht(t, e) {
604
+ const n = B(e, t.schema), { from: r, to: o, empty: s } = t.selection, i = [];
605
+ s ? (t.storedMarks && i.push(...t.storedMarks), i.push(...t.selection.$head.marks())) : t.doc.nodesBetween(r, o, (a) => {
606
606
  i.push(...a.marks);
607
607
  });
608
608
  const c = i.find((a) => a.type.name === n.name);
609
609
  return c ? { ...c.attrs } : {};
610
610
  }
611
- function zn(e, t) {
612
- const n = new pe(e);
613
- return t.forEach((r) => {
611
+ function zn(t, e) {
612
+ const n = new pe(t);
613
+ return e.forEach((r) => {
614
614
  r.steps.forEach((o) => {
615
615
  n.step(o);
616
616
  });
617
617
  }), n;
618
618
  }
619
- function Fn(e) {
620
- for (let t = 0; t < e.edgeCount; t += 1) {
621
- const { type: n } = e.edge(t);
619
+ function Fn(t) {
620
+ for (let e = 0; e < t.edgeCount; e += 1) {
621
+ const { type: n } = t.edge(e);
622
622
  if (n.isTextblock && !n.hasRequiredAttrs())
623
623
  return n;
624
624
  }
625
625
  return null;
626
626
  }
627
- function eo(e, t, n) {
627
+ function eo(t, e, n) {
628
628
  const r = [];
629
- return e.nodesBetween(t.from, t.to, (o, s) => {
629
+ return t.nodesBetween(e.from, e.to, (o, s) => {
630
630
  n(o) && r.push({
631
631
  node: o,
632
632
  pos: s
633
633
  });
634
634
  }), r;
635
635
  }
636
- function Ln(e, t) {
637
- for (let n = e.depth; n > 0; n -= 1) {
638
- const r = e.node(n);
639
- if (t(r))
636
+ function Ln(t, e) {
637
+ for (let n = t.depth; n > 0; n -= 1) {
638
+ const r = t.node(n);
639
+ if (e(r))
640
640
  return {
641
- pos: n > 0 ? e.before(n) : 0,
642
- start: e.start(n),
641
+ pos: n > 0 ? t.before(n) : 0,
642
+ start: t.start(n),
643
643
  depth: n,
644
644
  node: r
645
645
  };
646
646
  }
647
647
  }
648
- function nt(e) {
649
- return (t) => Ln(t.$from, e);
648
+ function nt(t) {
649
+ return (e) => Ln(e.$from, t);
650
650
  }
651
- function b(e, t, n) {
652
- return e.config[t] === void 0 && e.parent ? b(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
651
+ function b(t, e, n) {
652
+ return t.config[e] === void 0 && t.parent ? b(t.parent, e, n) : typeof t.config[e] == "function" ? t.config[e].bind({
653
653
  ...n,
654
- parent: e.parent ? b(e.parent, t, n) : null
655
- }) : e.config[t];
654
+ parent: t.parent ? b(t.parent, e, n) : null
655
+ }) : t.config[e];
656
656
  }
657
- function vt(e) {
658
- return e.map((t) => {
657
+ function bt(t) {
658
+ return t.map((e) => {
659
659
  const n = {
660
- name: t.name,
661
- options: t.options,
662
- storage: t.storage
663
- }, r = b(t, "addExtensions", n);
664
- return r ? [t, ...vt(r())] : t;
660
+ name: e.name,
661
+ options: e.options,
662
+ storage: e.storage
663
+ }, r = b(e, "addExtensions", n);
664
+ return r ? [e, ...bt(r())] : e;
665
665
  }).flat(10);
666
666
  }
667
- function bt(e, t) {
668
- const n = ze.fromSchema(t).serializeFragment(e), o = document.implementation.createHTMLDocument().createElement("div");
667
+ function kt(t, e) {
668
+ const n = ze.fromSchema(e).serializeFragment(t), o = document.implementation.createHTMLDocument().createElement("div");
669
669
  return o.appendChild(n), o.innerHTML;
670
670
  }
671
- function Ut(e) {
672
- return typeof e == "function";
671
+ function Ut(t) {
672
+ return typeof t == "function";
673
673
  }
674
- function x(e, t = void 0, ...n) {
675
- return Ut(e) ? t ? e.bind(t)(...n) : e(...n) : e;
674
+ function x(t, e = void 0, ...n) {
675
+ return Ut(t) ? e ? t.bind(e)(...n) : t(...n) : t;
676
676
  }
677
- function Vn(e = {}) {
678
- return Object.keys(e).length === 0 && e.constructor === Object;
677
+ function Vn(t = {}) {
678
+ return Object.keys(t).length === 0 && t.constructor === Object;
679
679
  }
680
- function L(e) {
681
- const t = e.filter((o) => o.type === "extension"), n = e.filter((o) => o.type === "node"), r = e.filter((o) => o.type === "mark");
680
+ function L(t) {
681
+ const e = t.filter((o) => o.type === "extension"), n = t.filter((o) => o.type === "node"), r = t.filter((o) => o.type === "mark");
682
682
  return {
683
- baseExtensions: t,
683
+ baseExtensions: e,
684
684
  nodeExtensions: n,
685
685
  markExtensions: r
686
686
  };
687
687
  }
688
- function Wt(e) {
689
- const t = [], { nodeExtensions: n, markExtensions: r } = L(e), o = [...n, ...r], s = {
688
+ function Wt(t) {
689
+ const e = [], { nodeExtensions: n, markExtensions: r } = L(t), o = [...n, ...r], s = {
690
690
  default: null,
691
691
  validate: void 0,
692
692
  rendered: !0,
@@ -695,7 +695,7 @@ function Wt(e) {
695
695
  keepOnSplit: !0,
696
696
  isRequired: !1
697
697
  };
698
- return e.forEach((i) => {
698
+ return t.forEach((i) => {
699
699
  const c = {
700
700
  name: i.name,
701
701
  options: i.options,
@@ -711,7 +711,7 @@ function Wt(e) {
711
711
  a().forEach((u) => {
712
712
  u.types.forEach((d) => {
713
713
  Object.entries(u.attributes).forEach(([f, p]) => {
714
- t.push({
714
+ e.push({
715
715
  type: d,
716
716
  name: f,
717
717
  attribute: {
@@ -740,17 +740,17 @@ function Wt(e) {
740
740
  ...s,
741
741
  ...d
742
742
  };
743
- typeof f?.default == "function" && (f.default = f.default()), f?.isRequired && f?.default === void 0 && delete f.default, t.push({
743
+ typeof f?.default == "function" && (f.default = f.default()), f?.isRequired && f?.default === void 0 && delete f.default, e.push({
744
744
  type: i.name,
745
745
  name: u,
746
746
  attribute: f
747
747
  });
748
748
  });
749
- }), t;
749
+ }), e;
750
750
  }
751
- function Hn(...e) {
752
- return e.filter((t) => !!t).reduce((t, n) => {
753
- const r = { ...t };
751
+ function Hn(...t) {
752
+ return t.filter((e) => !!e).reduce((e, n) => {
753
+ const r = { ...e };
754
754
  return Object.entries(n).forEach(([o, s]) => {
755
755
  if (!r[o]) {
756
756
  r[o] = s;
@@ -773,22 +773,22 @@ function Hn(...e) {
773
773
  }), r;
774
774
  }, {});
775
775
  }
776
- function Y(e, t) {
777
- return t.filter((n) => n.type === e.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
778
- [n.name]: e.attrs[n.name]
776
+ function Y(t, e) {
777
+ return e.filter((n) => n.type === t.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(t.attrs) || {} : {
778
+ [n.name]: t.attrs[n.name]
779
779
  }).reduce((n, r) => Hn(n, r), {});
780
780
  }
781
- function Un(e) {
782
- return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
781
+ function Un(t) {
782
+ return typeof t != "string" ? t : t.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(t) : t === "true" ? !0 : t === "false" ? !1 : t;
783
783
  }
784
- function Ct(e, t) {
785
- return "style" in e ? e : {
786
- ...e,
784
+ function Pt(t, e) {
785
+ return "style" in t ? t : {
786
+ ...t,
787
787
  getAttrs: (n) => {
788
- const r = e.getAttrs ? e.getAttrs(n) : e.attrs;
788
+ const r = t.getAttrs ? t.getAttrs(n) : t.attrs;
789
789
  if (r === !1)
790
790
  return !1;
791
- const o = t.reduce((s, i) => {
791
+ const o = e.reduce((s, i) => {
792
792
  const c = i.attribute.parseHTML ? i.attribute.parseHTML(n) : Un(n.getAttribute(i.name));
793
793
  return c == null ? s : {
794
794
  ...s,
@@ -799,33 +799,33 @@ function Ct(e, t) {
799
799
  }
800
800
  };
801
801
  }
802
- function Pt(e) {
802
+ function $t(t) {
803
803
  return Object.fromEntries(
804
804
  // @ts-ignore
805
- Object.entries(e).filter(([t, n]) => t === "attrs" && Vn(n) ? !1 : n != null)
805
+ Object.entries(t).filter(([e, n]) => e === "attrs" && Vn(n) ? !1 : n != null)
806
806
  );
807
807
  }
808
- function $t(e) {
809
- var t, n;
808
+ function Nt(t) {
809
+ var e, n;
810
810
  const r = {};
811
- return !((t = e?.attribute) != null && t.isRequired) && "default" in (e?.attribute || {}) && (r.default = e.attribute.default), ((n = e?.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = e.attribute.validate), [e.name, r];
811
+ return !((e = t?.attribute) != null && e.isRequired) && "default" in (t?.attribute || {}) && (r.default = t.attribute.default), ((n = t?.attribute) == null ? void 0 : n.validate) !== void 0 && (r.validate = t.attribute.validate), [t.name, r];
812
812
  }
813
- function Wn(e, t) {
813
+ function Wn(t, e) {
814
814
  var n;
815
- const r = Wt(e), { nodeExtensions: o, markExtensions: s } = L(e), i = (n = o.find((l) => b(l, "topNode"))) == null ? void 0 : n.name, c = Object.fromEntries(
815
+ const r = Wt(t), { nodeExtensions: o, markExtensions: s } = L(t), i = (n = o.find((l) => b(l, "topNode"))) == null ? void 0 : n.name, c = Object.fromEntries(
816
816
  o.map((l) => {
817
817
  const u = r.filter((v) => v.type === l.name), d = {
818
818
  name: l.name,
819
819
  options: l.options,
820
820
  storage: l.storage,
821
- editor: t
822
- }, f = e.reduce((v, k) => {
821
+ editor: e
822
+ }, f = t.reduce((v, k) => {
823
823
  const w = b(k, "extendNodeSchema", d);
824
824
  return {
825
825
  ...v,
826
826
  ...w ? w(l) : {}
827
827
  };
828
- }, {}), p = Pt({
828
+ }, {}), p = $t({
829
829
  ...f,
830
830
  content: x(b(l, "content", d)),
831
831
  marks: x(b(l, "marks", d)),
@@ -841,10 +841,10 @@ function Wn(e, t) {
841
841
  ),
842
842
  defining: x(b(l, "defining", d)),
843
843
  isolating: x(b(l, "isolating", d)),
844
- attrs: Object.fromEntries(u.map($t))
844
+ attrs: Object.fromEntries(u.map(Nt))
845
845
  }), m = x(b(l, "parseHTML", d));
846
846
  m && (p.parseDOM = m.map(
847
- (v) => Ct(v, u)
847
+ (v) => Pt(v, u)
848
848
  ));
849
849
  const h = b(l, "renderHTML", d);
850
850
  h && (p.toDOM = (v) => h({
@@ -860,24 +860,24 @@ function Wn(e, t) {
860
860
  name: l.name,
861
861
  options: l.options,
862
862
  storage: l.storage,
863
- editor: t
864
- }, f = e.reduce((g, v) => {
863
+ editor: e
864
+ }, f = t.reduce((g, v) => {
865
865
  const k = b(v, "extendMarkSchema", d);
866
866
  return {
867
867
  ...g,
868
868
  ...k ? k(l) : {}
869
869
  };
870
- }, {}), p = Pt({
870
+ }, {}), p = $t({
871
871
  ...f,
872
872
  inclusive: x(b(l, "inclusive", d)),
873
873
  excludes: x(b(l, "excludes", d)),
874
874
  group: x(b(l, "group", d)),
875
875
  spanning: x(b(l, "spanning", d)),
876
876
  code: x(b(l, "code", d)),
877
- attrs: Object.fromEntries(u.map($t))
877
+ attrs: Object.fromEntries(u.map(Nt))
878
878
  }), m = x(b(l, "parseHTML", d));
879
879
  m && (p.parseDOM = m.map(
880
- (g) => Ct(g, u)
880
+ (g) => Pt(g, u)
881
881
  ));
882
882
  const h = b(l, "renderHTML", d);
883
883
  return h && (p.toDOM = (g) => h({
@@ -892,28 +892,28 @@ function Wn(e, t) {
892
892
  marks: a
893
893
  });
894
894
  }
895
- function qn(e) {
896
- const t = e.filter((n, r) => e.indexOf(n) !== r);
897
- return Array.from(new Set(t));
895
+ function qn(t) {
896
+ const e = t.filter((n, r) => t.indexOf(n) !== r);
897
+ return Array.from(new Set(e));
898
898
  }
899
- function kt(e) {
900
- return e.sort((n, r) => {
899
+ function yt(t) {
900
+ return t.sort((n, r) => {
901
901
  const o = b(n, "priority") || 100, s = b(r, "priority") || 100;
902
902
  return o > s ? -1 : o < s ? 1 : 0;
903
903
  });
904
904
  }
905
- function qt(e) {
906
- const t = kt(vt(e)), n = qn(t.map((r) => r.name));
905
+ function qt(t) {
906
+ const e = yt(bt(t)), n = qn(e.map((r) => r.name));
907
907
  return n.length && console.warn(
908
908
  `[tiptap warn]: Duplicate extension names found: [${n.map((r) => `'${r}'`).join(", ")}]. This can lead to issues.`
909
- ), t;
909
+ ), e;
910
910
  }
911
- function Kt(e, t, n) {
912
- const { from: r, to: o } = t, { blockSeparator: s = `
911
+ function Kt(t, e, n) {
912
+ const { from: r, to: o } = e, { blockSeparator: s = `
913
913
 
914
914
  `, textSerializers: i = {} } = n || {};
915
915
  let c = "";
916
- return e.nodesBetween(r, o, (a, l, u, d) => {
916
+ return t.nodesBetween(r, o, (a, l, u, d) => {
917
917
  var f;
918
918
  a.isBlock && l > r && (c += s);
919
919
  const p = i?.[a.type.name];
@@ -923,52 +923,52 @@ function Kt(e, t, n) {
923
923
  pos: l,
924
924
  parent: u,
925
925
  index: d,
926
- range: t
926
+ range: e
927
927
  })), !1;
928
928
  a.isText && (c += (f = a?.text) == null ? void 0 : f.slice(Math.max(r, l) - l, o - l));
929
929
  }), c;
930
930
  }
931
- function Kn(e, t) {
931
+ function Kn(t, e) {
932
932
  const n = {
933
933
  from: 0,
934
- to: e.content.size
934
+ to: t.content.size
935
935
  };
936
- return Kt(e, n, t);
936
+ return Kt(t, n, e);
937
937
  }
938
- function Jt(e) {
938
+ function Jt(t) {
939
939
  return Object.fromEntries(
940
- Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText])
940
+ Object.entries(t.nodes).filter(([, e]) => e.spec.toText).map(([e, n]) => [e, n.spec.toText])
941
941
  );
942
942
  }
943
- function Jn(e, t) {
944
- const n = T(t, e.schema), { from: r, to: o } = e.selection, s = [];
945
- e.doc.nodesBetween(r, o, (c) => {
943
+ function Jn(t, e) {
944
+ const n = T(e, t.schema), { from: r, to: o } = t.selection, s = [];
945
+ t.doc.nodesBetween(r, o, (c) => {
946
946
  s.push(c);
947
947
  });
948
948
  const i = s.reverse().find((c) => c.type.name === n.name);
949
949
  return i ? { ...i.attrs } : {};
950
950
  }
951
- function Zn(e, t) {
951
+ function Zn(t, e) {
952
952
  const n = et(
953
- typeof t == "string" ? t : t.name,
954
- e.schema
953
+ typeof e == "string" ? e : e.name,
954
+ t.schema
955
955
  );
956
- return n === "node" ? Jn(e, t) : n === "mark" ? Ht(e, t) : {};
956
+ return n === "node" ? Jn(t, e) : n === "mark" ? Ht(t, e) : {};
957
957
  }
958
- function Qn(e, t = JSON.stringify) {
958
+ function Qn(t, e = JSON.stringify) {
959
959
  const n = {};
960
- return e.filter((r) => {
961
- const o = t(r);
960
+ return t.filter((r) => {
961
+ const o = e(r);
962
962
  return Object.prototype.hasOwnProperty.call(n, o) ? !1 : n[o] = !0;
963
963
  });
964
964
  }
965
- function Gn(e) {
966
- const t = Qn(e);
967
- return t.length === 1 ? t : t.filter((n, r) => !t.filter((s, i) => i !== r).some((s) => n.oldRange.from >= s.oldRange.from && n.oldRange.to <= s.oldRange.to && n.newRange.from >= s.newRange.from && n.newRange.to <= s.newRange.to));
965
+ function Gn(t) {
966
+ const e = Qn(t);
967
+ return e.length === 1 ? e : e.filter((n, r) => !e.filter((s, i) => i !== r).some((s) => n.oldRange.from >= s.oldRange.from && n.oldRange.to <= s.oldRange.to && n.newRange.from >= s.newRange.from && n.newRange.to <= s.newRange.to));
968
968
  }
969
- function Yn(e) {
970
- const { mapping: t, steps: n } = e, r = [];
971
- return t.maps.forEach((o, s) => {
969
+ function Yn(t) {
970
+ const { mapping: e, steps: n } = t, r = [];
971
+ return e.maps.forEach((o, s) => {
972
972
  const i = [];
973
973
  if (o.ranges.length)
974
974
  o.forEach((c, a) => {
@@ -981,7 +981,7 @@ function Yn(e) {
981
981
  i.push({ from: c, to: a });
982
982
  }
983
983
  i.forEach(({ from: c, to: a }) => {
984
- const l = t.slice(s).map(c, -1), u = t.slice(s).map(a), d = t.invert().map(l, -1), f = t.invert().map(u);
984
+ const l = e.slice(s).map(c, -1), u = e.slice(s).map(a), d = e.invert().map(l, -1), f = e.invert().map(u);
985
985
  r.push({
986
986
  oldRange: {
987
987
  from: d,
@@ -995,15 +995,15 @@ function Yn(e) {
995
995
  });
996
996
  }), Gn(r);
997
997
  }
998
- function Zt(e, t, n) {
998
+ function Zt(t, e, n) {
999
999
  const r = [];
1000
- return e === t ? n.resolve(e).marks().forEach((o) => {
1001
- const s = n.resolve(e), i = ht(s, o.type);
1000
+ return t === e ? n.resolve(t).marks().forEach((o) => {
1001
+ const s = n.resolve(t), i = gt(s, o.type);
1002
1002
  i && r.push({
1003
1003
  mark: o,
1004
1004
  ...i
1005
1005
  });
1006
- }) : n.nodesBetween(e, t, (o, s) => {
1006
+ }) : n.nodesBetween(t, e, (o, s) => {
1007
1007
  !o || o?.nodeSize === void 0 || r.push(
1008
1008
  ...o.marks.map((i) => ({
1009
1009
  from: s,
@@ -1013,30 +1013,30 @@ function Zt(e, t, n) {
1013
1013
  );
1014
1014
  }), r;
1015
1015
  }
1016
- var no = (e, t, n, r = 20) => {
1017
- const o = e.doc.resolve(n);
1016
+ var no = (t, e, n, r = 20) => {
1017
+ const o = t.doc.resolve(n);
1018
1018
  let s = r, i = null;
1019
1019
  for (; s > 0 && i === null; ) {
1020
1020
  const c = o.node(s);
1021
- c?.type.name === t ? i = c : s -= 1;
1021
+ c?.type.name === e ? i = c : s -= 1;
1022
1022
  }
1023
1023
  return [i, s];
1024
1024
  };
1025
- function at(e, t) {
1026
- return t.nodes[e] || t.marks[e] || null;
1025
+ function at(t, e) {
1026
+ return e.nodes[t] || e.marks[t] || null;
1027
1027
  }
1028
- function Q(e, t, n) {
1028
+ function Q(t, e, n) {
1029
1029
  return Object.fromEntries(
1030
1030
  Object.entries(n).filter(([r]) => {
1031
- const o = e.find((s) => s.type === t && s.name === r);
1031
+ const o = t.find((s) => s.type === e && s.name === r);
1032
1032
  return o ? o.attribute.keepOnSplit : !1;
1033
1033
  })
1034
1034
  );
1035
1035
  }
1036
- var Xn = (e, t = 500) => {
1036
+ var Xn = (t, e = 500) => {
1037
1037
  let n = "";
1038
- const r = e.parentOffset;
1039
- return e.parent.nodesBetween(Math.max(0, r - t), r, (o, s, i, c) => {
1038
+ const r = t.parentOffset;
1039
+ return t.parent.nodesBetween(Math.max(0, r - e), r, (o, s, i, c) => {
1040
1040
  var a, l;
1041
1041
  const u = ((l = (a = o.type.spec).toText) == null ? void 0 : l.call(a, {
1042
1042
  node: o,
@@ -1047,15 +1047,15 @@ var Xn = (e, t = 500) => {
1047
1047
  n += o.isAtom && !o.isText ? u : u.slice(0, Math.max(0, r - s));
1048
1048
  }), n;
1049
1049
  };
1050
- function ut(e, t, n = {}) {
1051
- const { empty: r, ranges: o } = e.selection, s = t ? B(t, e.schema) : null;
1050
+ function ut(t, e, n = {}) {
1051
+ const { empty: r, ranges: o } = t.selection, s = e ? B(e, t.schema) : null;
1052
1052
  if (r)
1053
- return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => s ? s.name === d.type.name : !0).find((d) => G(d.attrs, n, { strict: !1 }));
1053
+ return !!(t.storedMarks || t.selection.$from.marks()).filter((d) => s ? s.name === d.type.name : !0).find((d) => G(d.attrs, n, { strict: !1 }));
1054
1054
  let i = 0;
1055
1055
  const c = [];
1056
1056
  if (o.forEach(({ $from: d, $to: f }) => {
1057
1057
  const p = d.pos, m = f.pos;
1058
- e.doc.nodesBetween(p, m, (h, g) => {
1058
+ t.doc.nodesBetween(p, m, (h, g) => {
1059
1059
  if (!h.isText && !h.marks.length)
1060
1060
  return;
1061
1061
  const v = Math.max(p, g), k = Math.min(m, g + h.nodeSize), w = k - v;
@@ -1072,31 +1072,31 @@ function ut(e, t, n = {}) {
1072
1072
  const a = c.filter((d) => s ? s.name === d.mark.type.name : !0).filter((d) => G(d.mark.attrs, n, { strict: !1 })).reduce((d, f) => d + f.to - f.from, 0), l = c.filter((d) => s ? d.mark.type !== s && d.mark.type.excludes(s) : !0).reduce((d, f) => d + f.to - f.from, 0);
1073
1073
  return (a > 0 ? a + l : a) >= i;
1074
1074
  }
1075
- function tr(e, t, n = {}) {
1076
- if (!t)
1077
- return H(e, null, n) || ut(e, null, n);
1078
- const r = et(t, e.schema);
1079
- return r === "node" ? H(e, t, n) : r === "mark" ? ut(e, t, n) : !1;
1075
+ function tr(t, e, n = {}) {
1076
+ if (!e)
1077
+ return H(t, null, n) || ut(t, null, n);
1078
+ const r = et(e, t.schema);
1079
+ return r === "node" ? H(t, e, n) : r === "mark" ? ut(t, e, n) : !1;
1080
1080
  }
1081
- var ro = (e, t) => {
1082
- const { $from: n, $to: r, $anchor: o } = e.selection;
1083
- if (t) {
1084
- const s = nt((c) => c.type.name === t)(e.selection);
1081
+ var ro = (t, e) => {
1082
+ const { $from: n, $to: r, $anchor: o } = t.selection;
1083
+ if (e) {
1084
+ const s = nt((c) => c.type.name === e)(t.selection);
1085
1085
  if (!s)
1086
1086
  return !1;
1087
- const i = e.doc.resolve(s.pos + 1);
1087
+ const i = t.doc.resolve(s.pos + 1);
1088
1088
  return o.pos + 1 === i.end();
1089
1089
  }
1090
1090
  return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1091
- }, oo = (e) => {
1092
- const { $from: t, $to: n } = e.selection;
1093
- return !(t.parentOffset > 0 || t.pos !== n.pos);
1091
+ }, oo = (t) => {
1092
+ const { $from: e, $to: n } = t.selection;
1093
+ return !(e.parentOffset > 0 || e.pos !== n.pos);
1094
1094
  };
1095
- function Nt(e, t) {
1096
- return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
1095
+ function It(t, e) {
1096
+ return Array.isArray(e) ? e.some((n) => (typeof n == "string" ? n : n.name) === t.name) : e;
1097
1097
  }
1098
- function It(e, t) {
1099
- const { nodeExtensions: n } = L(t), r = n.find((i) => i.name === e);
1098
+ function Bt(t, e) {
1099
+ const { nodeExtensions: n } = L(e), r = n.find((i) => i.name === t);
1100
1100
  if (!r)
1101
1101
  return !1;
1102
1102
  const o = {
@@ -1106,40 +1106,43 @@ function It(e, t) {
1106
1106
  }, s = x(b(r, "group", o));
1107
1107
  return typeof s != "string" ? !1 : s.split(" ").includes("list");
1108
1108
  }
1109
- function yt(e, {
1110
- checkChildren: t = !0,
1109
+ function wt(t, {
1110
+ checkChildren: e = !0,
1111
1111
  ignoreWhitespace: n = !1
1112
1112
  } = {}) {
1113
1113
  var r;
1114
1114
  if (n) {
1115
- if (e.type.name === "hardBreak")
1115
+ if (t.type.name === "hardBreak")
1116
1116
  return !0;
1117
- if (e.isText)
1118
- return /^\s*$/m.test((r = e.text) != null ? r : "");
1117
+ if (t.isText)
1118
+ return /^\s*$/m.test((r = t.text) != null ? r : "");
1119
1119
  }
1120
- if (e.isText)
1121
- return !e.text;
1122
- if (e.isAtom || e.isLeaf)
1120
+ if (t.isText)
1121
+ return !t.text;
1122
+ if (t.isAtom || t.isLeaf)
1123
1123
  return !1;
1124
- if (e.content.childCount === 0)
1124
+ if (t.content.childCount === 0)
1125
1125
  return !0;
1126
- if (t) {
1126
+ if (e) {
1127
1127
  let o = !0;
1128
- return e.content.forEach((s) => {
1129
- o !== !1 && (yt(s, { ignoreWhitespace: n, checkChildren: t }) || (o = !1));
1128
+ return t.content.forEach((s) => {
1129
+ o !== !1 && (wt(s, { ignoreWhitespace: n, checkChildren: e }) || (o = !1));
1130
1130
  }), o;
1131
1131
  }
1132
1132
  return !1;
1133
1133
  }
1134
+ function so(t) {
1135
+ return t instanceof pt;
1136
+ }
1134
1137
  var Qt = class Gt {
1135
- constructor(t) {
1136
- this.position = t;
1138
+ constructor(e) {
1139
+ this.position = e;
1137
1140
  }
1138
1141
  /**
1139
1142
  * Creates a MappablePosition from a JSON object.
1140
1143
  */
1141
- static fromJSON(t) {
1142
- return new Gt(t.position);
1144
+ static fromJSON(e) {
1145
+ return new Gt(e.position);
1143
1146
  }
1144
1147
  /**
1145
1148
  * Converts the MappablePosition to a JSON object.
@@ -1150,28 +1153,28 @@ var Qt = class Gt {
1150
1153
  };
1151
1154
  }
1152
1155
  };
1153
- function er(e, t) {
1154
- const n = t.mapping.mapResult(e.position);
1156
+ function er(t, e) {
1157
+ const n = e.mapping.mapResult(t.position);
1155
1158
  return {
1156
1159
  position: new Qt(n.pos),
1157
1160
  mapResult: n
1158
1161
  };
1159
1162
  }
1160
- function nr(e) {
1161
- return new Qt(e);
1163
+ function nr(t) {
1164
+ return new Qt(t);
1162
1165
  }
1163
- function rr(e, t, n) {
1166
+ function rr(t, e, n) {
1164
1167
  var r;
1165
- const { selection: o } = t;
1168
+ const { selection: o } = e;
1166
1169
  let s = null;
1167
1170
  if (zt(o) && (s = o.$cursor), s) {
1168
- const c = (r = e.storedMarks) != null ? r : s.marks();
1171
+ const c = (r = t.storedMarks) != null ? r : s.marks();
1169
1172
  return s.parent.type.allowsMarkType(n) && (!!n.isInSet(c) || !c.some((l) => l.type.excludes(n)));
1170
1173
  }
1171
1174
  const { ranges: i } = o;
1172
1175
  return i.some(({ $from: c, $to: a }) => {
1173
- let l = c.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
1174
- return e.doc.nodesBetween(c.pos, a.pos, (u, d, f) => {
1176
+ let l = c.depth === 0 ? t.doc.inlineContent && t.doc.type.allowsMarkType(n) : !1;
1177
+ return t.doc.nodesBetween(c.pos, a.pos, (u, d, f) => {
1175
1178
  if (l)
1176
1179
  return !1;
1177
1180
  if (u.isInline) {
@@ -1182,15 +1185,15 @@ function rr(e, t, n) {
1182
1185
  }), l;
1183
1186
  });
1184
1187
  }
1185
- var or = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1186
- const { selection: s } = n, { empty: i, ranges: c } = s, a = B(e, r.schema);
1188
+ var or = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1189
+ const { selection: s } = n, { empty: i, ranges: c } = s, a = B(t, r.schema);
1187
1190
  if (o)
1188
1191
  if (i) {
1189
1192
  const l = Ht(r, a);
1190
1193
  n.addStoredMark(
1191
1194
  a.create({
1192
1195
  ...l,
1193
- ...t
1196
+ ...e
1194
1197
  })
1195
1198
  );
1196
1199
  } else
@@ -1204,53 +1207,53 @@ var or = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1204
1207
  h,
1205
1208
  a.create({
1206
1209
  ...v.attrs,
1207
- ...t
1210
+ ...e
1208
1211
  })
1209
1212
  );
1210
- }) : n.addMark(m, h, a.create(t));
1213
+ }) : n.addMark(m, h, a.create(e));
1211
1214
  });
1212
1215
  });
1213
1216
  return rr(r, n, a);
1214
- }, sr = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), ir = (e, t = {}) => ({ state: n, dispatch: r, chain: o }) => {
1215
- const s = T(e, n.schema);
1217
+ }, sr = (t, e) => ({ tr: n }) => (n.setMeta(t, e), !0), ir = (t, e = {}) => ({ state: n, dispatch: r, chain: o }) => {
1218
+ const s = T(t, n.schema);
1216
1219
  let i;
1217
- return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands: c }) => Et(s, { ...i, ...t })(n) ? !0 : c.clearNodes()).command(({ state: c }) => Et(s, { ...i, ...t })(c, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1218
- }, ar = (e) => ({ tr: t, dispatch: n }) => {
1220
+ return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands: c }) => Tt(s, { ...i, ...e })(n) ? !0 : c.clearNodes()).command(({ state: c }) => Tt(s, { ...i, ...e })(c, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1221
+ }, ar = (t) => ({ tr: e, dispatch: n }) => {
1219
1222
  if (n) {
1220
- const { doc: r } = t, o = _(e, 0, r.content.size), s = jt.create(r, o);
1221
- t.setSelection(s);
1223
+ const { doc: r } = e, o = _(t, 0, r.content.size), s = pt.create(r, o);
1224
+ e.setSelection(s);
1222
1225
  }
1223
1226
  return !0;
1224
- }, cr = (e, t) => ({ tr: n, state: r, dispatch: o }) => {
1227
+ }, cr = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
1225
1228
  const { selection: s } = r;
1226
1229
  let i, c;
1227
- return typeof t == "number" ? (i = t, c = t) : t && "from" in t && "to" in t ? (i = t.from, c = t.to) : (i = s.from, c = s.to), o && n.doc.nodesBetween(i, c, (a, l) => {
1230
+ return typeof e == "number" ? (i = e, c = e) : e && "from" in e && "to" in e ? (i = e.from, c = e.to) : (i = s.from, c = s.to), o && n.doc.nodesBetween(i, c, (a, l) => {
1228
1231
  a.isText || n.setNodeMarkup(l, void 0, {
1229
1232
  ...a.attrs,
1230
- dir: e
1233
+ dir: t
1231
1234
  });
1232
1235
  }), !0;
1233
- }, lr = (e) => ({ tr: t, dispatch: n }) => {
1236
+ }, lr = (t) => ({ tr: e, dispatch: n }) => {
1234
1237
  if (n) {
1235
- const { doc: r } = t, { from: o, to: s } = typeof e == "number" ? { from: e, to: e } : e, i = P.atStart(r).from, c = P.atEnd(r).to, a = _(o, i, c), l = _(s, i, c), u = P.create(r, a, l);
1236
- t.setSelection(u);
1238
+ const { doc: r } = e, { from: o, to: s } = typeof t == "number" ? { from: t, to: t } : t, i = P.atStart(r).from, c = P.atEnd(r).to, a = _(o, i, c), l = _(s, i, c), u = P.create(r, a, l);
1239
+ e.setSelection(u);
1237
1240
  }
1238
1241
  return !0;
1239
- }, dr = (e) => ({ state: t, dispatch: n }) => {
1240
- const r = T(e, t.schema);
1241
- return He(r)(t, n);
1242
+ }, dr = (t) => ({ state: e, dispatch: n }) => {
1243
+ const r = T(t, e.schema);
1244
+ return He(r)(e, n);
1242
1245
  };
1243
- function Bt(e, t) {
1244
- const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1246
+ function Rt(t, e) {
1247
+ const n = t.storedMarks || t.selection.$to.parentOffset && t.selection.$from.marks();
1245
1248
  if (n) {
1246
- const r = n.filter((o) => t?.includes(o.type.name));
1247
- e.tr.ensureMarks(r);
1249
+ const r = n.filter((o) => e?.includes(o.type.name));
1250
+ t.tr.ensureMarks(r);
1248
1251
  }
1249
1252
  }
1250
- var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: o }) => {
1251
- const { selection: s, doc: i } = t, { $from: c, $to: a } = s, l = o.extensionManager.attributes, u = Q(l, c.node().type.name, c.node().attrs);
1252
- if (s instanceof jt && s.node.isBlock)
1253
- return !c.parentOffset || !Z(i, c.pos) ? !1 : (r && (e && Bt(n, o.extensionManager.splittableMarks), t.split(c.pos).scrollIntoView()), !0);
1253
+ var ur = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor: o }) => {
1254
+ const { selection: s, doc: i } = e, { $from: c, $to: a } = s, l = o.extensionManager.attributes, u = Q(l, c.node().type.name, c.node().attrs);
1255
+ if (s instanceof pt && s.node.isBlock)
1256
+ return !c.parentOffset || !Z(i, c.pos) ? !1 : (r && (t && Rt(n, o.extensionManager.splittableMarks), e.split(c.pos).scrollIntoView()), !0);
1254
1257
  if (!c.parent.isBlock)
1255
1258
  return !1;
1256
1259
  const d = a.parentOffset === a.parent.content.size, f = c.depth === 0 ? void 0 : Fn(c.node(-1).contentMatchAt(c.indexAfter(-1)));
@@ -1259,23 +1262,23 @@ var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
1259
1262
  type: f,
1260
1263
  attrs: u
1261
1264
  }
1262
- ] : void 0, m = Z(t.doc, t.mapping.map(c.pos), 1, p);
1263
- if (!p && !m && Z(t.doc, t.mapping.map(c.pos), 1, f ? [{ type: f }] : void 0) && (m = !0, p = f ? [
1265
+ ] : void 0, m = Z(e.doc, e.mapping.map(c.pos), 1, p);
1266
+ if (!p && !m && Z(e.doc, e.mapping.map(c.pos), 1, f ? [{ type: f }] : void 0) && (m = !0, p = f ? [
1264
1267
  {
1265
1268
  type: f,
1266
1269
  attrs: u
1267
1270
  }
1268
1271
  ] : void 0), r) {
1269
- if (m && (s instanceof P && t.deleteSelection(), t.split(t.mapping.map(c.pos), 1, p), f && !d && !c.parentOffset && c.parent.type !== f)) {
1270
- const h = t.mapping.map(c.before()), g = t.doc.resolve(h);
1271
- c.node(-1).canReplaceWith(g.index(), g.index() + 1, f) && t.setNodeMarkup(t.mapping.map(c.before()), f);
1272
+ if (m && (s instanceof P && e.deleteSelection(), e.split(e.mapping.map(c.pos), 1, p), f && !d && !c.parentOffset && c.parent.type !== f)) {
1273
+ const h = e.mapping.map(c.before()), g = e.doc.resolve(h);
1274
+ c.node(-1).canReplaceWith(g.index(), g.index() + 1, f) && e.setNodeMarkup(e.mapping.map(c.before()), f);
1272
1275
  }
1273
- e && Bt(n, o.extensionManager.splittableMarks), t.scrollIntoView();
1276
+ t && Rt(n, o.extensionManager.splittableMarks), e.scrollIntoView();
1274
1277
  }
1275
1278
  return m;
1276
- }, fr = (e, t = {}) => ({ tr: n, state: r, dispatch: o, editor: s }) => {
1279
+ }, fr = (t, e = {}) => ({ tr: n, state: r, dispatch: o, editor: s }) => {
1277
1280
  var i;
1278
- const c = T(e, r.schema), { $from: a, $to: l } = r.selection, u = r.selection.node;
1281
+ const c = T(t, r.schema), { $from: a, $to: l } = r.selection, u = r.selection.node;
1279
1282
  if (u && u.isBlock || a.depth < 2 || !a.sameParent(l))
1280
1283
  return !1;
1281
1284
  const d = a.node(-1);
@@ -1295,7 +1298,7 @@ var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
1295
1298
  a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3
1296
1299
  ), M = {
1297
1300
  ...Q(f, a.node().type.name, a.node().attrs),
1298
- ...t
1301
+ ...e
1299
1302
  }, y = ((i = c.contentMatch.defaultType) == null ? void 0 : i.createAndFill(M)) || void 0;
1300
1303
  v = v.append(j.from(c.createAndFill(null, y) || void 0));
1301
1304
  const S = a.before(a.depth - (k - 1));
@@ -1311,10 +1314,10 @@ var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
1311
1314
  }
1312
1315
  const p = l.pos === a.end() ? d.contentMatchAt(0).defaultType : null, m = {
1313
1316
  ...Q(f, d.type.name, d.attrs),
1314
- ...t
1317
+ ...e
1315
1318
  }, h = {
1316
1319
  ...Q(f, a.node().type.name, a.node().attrs),
1317
- ...t
1320
+ ...e
1318
1321
  };
1319
1322
  n.delete(a.pos, l.pos);
1320
1323
  const g = p ? [
@@ -1331,62 +1334,62 @@ var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
1331
1334
  n.ensureMarks(y);
1332
1335
  }
1333
1336
  return !0;
1334
- }, ct = (e, t) => {
1335
- const n = nt((i) => i.type === t)(e.selection);
1337
+ }, ct = (t, e) => {
1338
+ const n = nt((i) => i.type === e)(t.selection);
1336
1339
  if (!n)
1337
1340
  return !0;
1338
- const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1341
+ const r = t.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1339
1342
  if (r === void 0)
1340
1343
  return !0;
1341
- const o = e.doc.nodeAt(r);
1342
- return n.node.type === o?.type && ft(e.doc, n.pos) && e.join(n.pos), !0;
1343
- }, lt = (e, t) => {
1344
- const n = nt((i) => i.type === t)(e.selection);
1344
+ const o = t.doc.nodeAt(r);
1345
+ return n.node.type === o?.type && ft(t.doc, n.pos) && t.join(n.pos), !0;
1346
+ }, lt = (t, e) => {
1347
+ const n = nt((i) => i.type === e)(t.selection);
1345
1348
  if (!n)
1346
1349
  return !0;
1347
- const r = e.doc.resolve(n.start).after(n.depth);
1350
+ const r = t.doc.resolve(n.start).after(n.depth);
1348
1351
  if (r === void 0)
1349
1352
  return !0;
1350
- const o = e.doc.nodeAt(r);
1351
- return n.node.type === o?.type && ft(e.doc, r) && e.join(r), !0;
1352
- }, pr = (e, t, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain: a, commands: l, can: u }) => {
1353
- const { extensions: d, splittableMarks: f } = o.extensionManager, p = T(e, i.schema), m = T(t, i.schema), { selection: h, storedMarks: g } = i, { $from: v, $to: k } = h, w = v.blockRange(k), M = g || h.$to.parentOffset && h.$from.marks();
1353
+ const o = t.doc.nodeAt(r);
1354
+ return n.node.type === o?.type && ft(t.doc, r) && t.join(r), !0;
1355
+ }, pr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: c, chain: a, commands: l, can: u }) => {
1356
+ const { extensions: d, splittableMarks: f } = o.extensionManager, p = T(t, i.schema), m = T(e, i.schema), { selection: h, storedMarks: g } = i, { $from: v, $to: k } = h, w = v.blockRange(k), M = g || h.$to.parentOffset && h.$from.marks();
1354
1357
  if (!w)
1355
1358
  return !1;
1356
- const y = nt((S) => It(S.type.name, d))(h);
1359
+ const y = nt((S) => Bt(S.type.name, d))(h);
1357
1360
  if (w.depth >= 1 && y && w.depth - y.depth <= 1) {
1358
1361
  if (y.node.type === p)
1359
1362
  return l.liftListItem(m);
1360
- if (It(y.node.type.name, d) && p.validContent(y.node.content) && c)
1363
+ if (Bt(y.node.type.name, d) && p.validContent(y.node.content) && c)
1361
1364
  return a().command(() => (s.setNodeMarkup(y.pos, p), !0)).command(() => ct(s, p)).command(() => lt(s, p)).run();
1362
1365
  }
1363
1366
  return !n || !M || !c ? a().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => ct(s, p)).command(() => lt(s, p)).run() : a().command(() => {
1364
1367
  const S = u().wrapInList(p, r), E = M.filter((A) => f.includes(A.type.name));
1365
1368
  return s.ensureMarks(E), S ? !0 : l.clearNodes();
1366
1369
  }).wrapInList(p, r).command(() => ct(s, p)).command(() => lt(s, p)).run();
1367
- }, mr = (e, t = {}, n = {}) => ({ state: r, commands: o }) => {
1368
- const { extendEmptyMarkRange: s = !1 } = n, i = B(e, r.schema);
1369
- return ut(r, i, t) ? o.unsetMark(i, { extendEmptyMarkRange: s }) : o.setMark(i, t);
1370
- }, hr = (e, t, n = {}) => ({ state: r, commands: o }) => {
1371
- const s = T(e, r.schema), i = T(t, r.schema), c = H(r, s, n);
1370
+ }, mr = (t, e = {}, n = {}) => ({ state: r, commands: o }) => {
1371
+ const { extendEmptyMarkRange: s = !1 } = n, i = B(t, r.schema);
1372
+ return ut(r, i, e) ? o.unsetMark(i, { extendEmptyMarkRange: s }) : o.setMark(i, e);
1373
+ }, hr = (t, e, n = {}) => ({ state: r, commands: o }) => {
1374
+ const s = T(t, r.schema), i = T(e, r.schema), c = H(r, s, n);
1372
1375
  let a;
1373
1376
  return r.selection.$anchor.sameParent(r.selection.$head) && (a = r.selection.$anchor.parent.attrs), c ? o.setNode(i, a) : o.setNode(s, { ...a, ...n });
1374
- }, gr = (e, t = {}) => ({ state: n, commands: r }) => {
1375
- const o = T(e, n.schema);
1376
- return H(n, o, t) ? r.lift(o) : r.wrapIn(o, t);
1377
- }, vr = () => ({ state: e, dispatch: t }) => {
1378
- const n = e.plugins;
1377
+ }, gr = (t, e = {}) => ({ state: n, commands: r }) => {
1378
+ const o = T(t, n.schema);
1379
+ return H(n, o, e) ? r.lift(o) : r.wrapIn(o, e);
1380
+ }, vr = () => ({ state: t, dispatch: e }) => {
1381
+ const n = t.plugins;
1379
1382
  for (let r = 0; r < n.length; r += 1) {
1380
1383
  const o = n[r];
1381
1384
  let s;
1382
- if (o.spec.isInputRules && (s = o.getState(e))) {
1383
- if (t) {
1384
- const i = e.tr, c = s.transform;
1385
+ if (o.spec.isInputRules && (s = o.getState(t))) {
1386
+ if (e) {
1387
+ const i = t.tr, c = s.transform;
1385
1388
  for (let a = c.steps.length - 1; a >= 0; a -= 1)
1386
1389
  i.step(c.steps[a].invert(c.docs[a]));
1387
1390
  if (s.text) {
1388
1391
  const a = i.doc.resolve(s.from).marks();
1389
- i.replaceWith(s.from, s.to, e.schema.text(s.text, a));
1392
+ i.replaceWith(s.from, s.to, t.schema.text(s.text, a));
1390
1393
  } else
1391
1394
  i.delete(s.from, s.to);
1392
1395
  }
@@ -1394,43 +1397,43 @@ var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
1394
1397
  }
1395
1398
  }
1396
1399
  return !1;
1397
- }, br = () => ({ tr: e, dispatch: t }) => {
1398
- const { selection: n } = e, { empty: r, ranges: o } = n;
1399
- return r || t && o.forEach((s) => {
1400
- e.removeMark(s.$from.pos, s.$to.pos);
1400
+ }, br = () => ({ tr: t, dispatch: e }) => {
1401
+ const { selection: n } = t, { empty: r, ranges: o } = n;
1402
+ return r || e && o.forEach((s) => {
1403
+ t.removeMark(s.$from.pos, s.$to.pos);
1401
1404
  }), !0;
1402
- }, kr = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1405
+ }, kr = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1403
1406
  var s;
1404
- const { extendEmptyMarkRange: i = !1 } = t, { selection: c } = n, a = B(e, r.schema), { $from: l, empty: u, ranges: d } = c;
1407
+ const { extendEmptyMarkRange: i = !1 } = e, { selection: c } = n, a = B(t, r.schema), { $from: l, empty: u, ranges: d } = c;
1405
1408
  if (!o)
1406
1409
  return !0;
1407
1410
  if (u && i) {
1408
1411
  let { from: f, to: p } = c;
1409
- const m = (s = l.marks().find((g) => g.type === a)) == null ? void 0 : s.attrs, h = ht(l, a, m);
1412
+ const m = (s = l.marks().find((g) => g.type === a)) == null ? void 0 : s.attrs, h = gt(l, a, m);
1410
1413
  h && (f = h.from, p = h.to), n.removeMark(f, p, a);
1411
1414
  } else
1412
1415
  d.forEach((f) => {
1413
1416
  n.removeMark(f.$from.pos, f.$to.pos, a);
1414
1417
  });
1415
1418
  return n.removeStoredMark(a), !0;
1416
- }, yr = (e) => ({ tr: t, state: n, dispatch: r }) => {
1419
+ }, yr = (t) => ({ tr: e, state: n, dispatch: r }) => {
1417
1420
  const { selection: o } = n;
1418
1421
  let s, i;
1419
- return typeof e == "number" ? (s = e, i = e) : e && "from" in e && "to" in e ? (s = e.from, i = e.to) : (s = o.from, i = o.to), r && t.doc.nodesBetween(s, i, (c, a) => {
1422
+ return typeof t == "number" ? (s = t, i = t) : t && "from" in t && "to" in t ? (s = t.from, i = t.to) : (s = o.from, i = o.to), r && e.doc.nodesBetween(s, i, (c, a) => {
1420
1423
  if (c.isText)
1421
1424
  return;
1422
1425
  const l = { ...c.attrs };
1423
- delete l.dir, t.setNodeMarkup(a, void 0, l);
1426
+ delete l.dir, e.setNodeMarkup(a, void 0, l);
1424
1427
  }), !0;
1425
- }, wr = (e, t = {}) => ({ tr: n, state: r, dispatch: o }) => {
1428
+ }, wr = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1426
1429
  let s = null, i = null;
1427
1430
  const c = et(
1428
- typeof e == "string" ? e : e.name,
1431
+ typeof t == "string" ? t : t.name,
1429
1432
  r.schema
1430
1433
  );
1431
1434
  if (!c)
1432
1435
  return !1;
1433
- c === "node" && (s = T(e, r.schema)), c === "mark" && (i = B(e, r.schema));
1436
+ c === "node" && (s = T(t, r.schema)), c === "mark" && (i = B(t, r.schema));
1434
1437
  let a = !1;
1435
1438
  return n.selection.ranges.forEach((l) => {
1436
1439
  const u = l.$from.pos, d = l.$to.pos;
@@ -1440,7 +1443,7 @@ var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
1440
1443
  }) : r.doc.nodesBetween(u, d, (g, v) => {
1441
1444
  v < u && s && s === g.type && (a = !0, m = Math.max(v, u), h = Math.min(v + g.nodeSize, d), f = v, p = g), v >= u && v <= d && (s && s === g.type && (a = !0, o && n.setNodeMarkup(v, void 0, {
1442
1445
  ...g.attrs,
1443
- ...t
1446
+ ...e
1444
1447
  })), i && g.marks.length && g.marks.forEach((k) => {
1445
1448
  if (i === k.type && (a = !0, o)) {
1446
1449
  const w = Math.max(v, u), M = Math.min(v + g.nodeSize, d);
@@ -1449,78 +1452,78 @@ var ur = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
1449
1452
  M,
1450
1453
  i.create({
1451
1454
  ...k.attrs,
1452
- ...t
1455
+ ...e
1453
1456
  })
1454
1457
  );
1455
1458
  }
1456
1459
  }));
1457
1460
  }), p && (f !== void 0 && o && n.setNodeMarkup(f, void 0, {
1458
1461
  ...p.attrs,
1459
- ...t
1462
+ ...e
1460
1463
  }), i && p.marks.length && p.marks.forEach((g) => {
1461
1464
  i === g.type && o && n.addMark(
1462
1465
  m,
1463
1466
  h,
1464
1467
  i.create({
1465
1468
  ...g.attrs,
1466
- ...t
1469
+ ...e
1467
1470
  })
1468
1471
  );
1469
1472
  }));
1470
1473
  }), a;
1471
- }, Mr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1472
- const o = T(e, n.schema);
1473
- return Oe(o, t)(n, r);
1474
- }, xr = (e, t = {}) => ({ state: n, dispatch: r }) => {
1475
- const o = T(e, n.schema);
1476
- return Ue(o, t)(n, r);
1474
+ }, Mr = (t, e = {}) => ({ state: n, dispatch: r }) => {
1475
+ const o = T(t, n.schema);
1476
+ return Oe(o, e)(n, r);
1477
+ }, xr = (t, e = {}) => ({ state: n, dispatch: r }) => {
1478
+ const o = T(t, n.schema);
1479
+ return Ue(o, e)(n, r);
1477
1480
  }, Sr = class {
1478
1481
  constructor() {
1479
1482
  this.callbacks = {};
1480
1483
  }
1481
- on(e, t) {
1482
- return this.callbacks[e] || (this.callbacks[e] = []), this.callbacks[e].push(t), this;
1484
+ on(t, e) {
1485
+ return this.callbacks[t] || (this.callbacks[t] = []), this.callbacks[t].push(e), this;
1483
1486
  }
1484
- emit(e, ...t) {
1485
- const n = this.callbacks[e];
1486
- return n && n.forEach((r) => r.apply(this, t)), this;
1487
+ emit(t, ...e) {
1488
+ const n = this.callbacks[t];
1489
+ return n && n.forEach((r) => r.apply(this, e)), this;
1487
1490
  }
1488
- off(e, t) {
1489
- const n = this.callbacks[e];
1490
- return n && (t ? this.callbacks[e] = n.filter((r) => r !== t) : delete this.callbacks[e]), this;
1491
+ off(t, e) {
1492
+ const n = this.callbacks[t];
1493
+ return n && (e ? this.callbacks[t] = n.filter((r) => r !== e) : delete this.callbacks[t]), this;
1491
1494
  }
1492
- once(e, t) {
1495
+ once(t, e) {
1493
1496
  const n = (...r) => {
1494
- this.off(e, n), t.apply(this, r);
1497
+ this.off(t, n), e.apply(this, r);
1495
1498
  };
1496
- return this.on(e, n);
1499
+ return this.on(t, n);
1497
1500
  }
1498
1501
  removeAllListeners() {
1499
1502
  this.callbacks = {};
1500
1503
  }
1501
- }, wt = class {
1502
- constructor(e) {
1503
- var t;
1504
- this.find = e.find, this.handler = e.handler, this.undoable = (t = e.undoable) != null ? t : !0;
1504
+ }, Mt = class {
1505
+ constructor(t) {
1506
+ var e;
1507
+ this.find = t.find, this.handler = t.handler, this.undoable = (e = t.undoable) != null ? e : !0;
1505
1508
  }
1506
- }, Er = (e, t) => {
1507
- if (mt(t))
1508
- return t.exec(e);
1509
- const n = t(e);
1509
+ }, Er = (t, e) => {
1510
+ if (ht(e))
1511
+ return e.exec(t);
1512
+ const n = e(t);
1510
1513
  if (!n)
1511
1514
  return null;
1512
1515
  const r = [n.text];
1513
- 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;
1516
+ return r.index = n.index, r.input = t, 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;
1514
1517
  };
1515
- function q(e) {
1516
- var t;
1517
- const { editor: n, from: r, to: o, text: s, rules: i, plugin: c } = e, { view: a } = n;
1518
+ function q(t) {
1519
+ var e;
1520
+ const { editor: n, from: r, to: o, text: s, rules: i, plugin: c } = t, { view: a } = n;
1518
1521
  if (a.composing)
1519
1522
  return !1;
1520
1523
  const l = a.state.doc.resolve(r);
1521
1524
  if (
1522
1525
  // check for code node
1523
- l.parent.type.spec.code || (t = l.nodeBefore || l.nodeAfter) != null && t.marks.find((f) => f.type.spec.code)
1526
+ l.parent.type.spec.code || (e = l.nodeBefore || l.nodeAfter) != null && e.marks.find((f) => f.type.spec.code)
1524
1527
  )
1525
1528
  return !1;
1526
1529
  let u = !1;
@@ -1556,8 +1559,8 @@ function q(e) {
1556
1559
  }), a.dispatch(m), u = !0);
1557
1560
  }), u;
1558
1561
  }
1559
- function Tr(e) {
1560
- const { editor: t, rules: n } = e, r = new $({
1562
+ function Tr(t) {
1563
+ const { editor: e, rules: n } = t, r = new $({
1561
1564
  state: {
1562
1565
  init() {
1563
1566
  return null;
@@ -1569,10 +1572,10 @@ function Tr(e) {
1569
1572
  const a = o.getMeta("applyInputRules");
1570
1573
  return a && setTimeout(() => {
1571
1574
  let { text: u } = a;
1572
- typeof u == "string" ? u = u : u = bt(j.from(u), i.schema);
1575
+ typeof u == "string" ? u = u : u = kt(j.from(u), i.schema);
1573
1576
  const { from: d } = a, f = d + u.length;
1574
1577
  q({
1575
- editor: t,
1578
+ editor: e,
1576
1579
  from: d,
1577
1580
  to: f,
1578
1581
  text: u,
@@ -1585,7 +1588,7 @@ function Tr(e) {
1585
1588
  props: {
1586
1589
  handleTextInput(o, s, i, c) {
1587
1590
  return q({
1588
- editor: t,
1591
+ editor: e,
1589
1592
  from: s,
1590
1593
  to: i,
1591
1594
  text: c,
@@ -1597,7 +1600,7 @@ function Tr(e) {
1597
1600
  compositionend: (o) => (setTimeout(() => {
1598
1601
  const { $cursor: s } = o.state.selection;
1599
1602
  s && q({
1600
- editor: t,
1603
+ editor: e,
1601
1604
  from: s.pos,
1602
1605
  to: s.pos,
1603
1606
  text: "",
@@ -1613,7 +1616,7 @@ function Tr(e) {
1613
1616
  return !1;
1614
1617
  const { $cursor: i } = o.state.selection;
1615
1618
  return i ? q({
1616
- editor: t,
1619
+ editor: e,
1617
1620
  from: i.pos,
1618
1621
  to: i.pos,
1619
1622
  text: `
@@ -1628,25 +1631,25 @@ function Tr(e) {
1628
1631
  });
1629
1632
  return r;
1630
1633
  }
1631
- function Ar(e) {
1632
- return Object.prototype.toString.call(e).slice(8, -1);
1634
+ function Ar(t) {
1635
+ return Object.prototype.toString.call(t).slice(8, -1);
1633
1636
  }
1634
- function K(e) {
1635
- return Ar(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1637
+ function K(t) {
1638
+ return Ar(t) !== "Object" ? !1 : t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
1636
1639
  }
1637
- function Yt(e, t) {
1638
- const n = { ...e };
1639
- return K(e) && K(t) && Object.keys(t).forEach((r) => {
1640
- K(t[r]) && K(e[r]) ? n[r] = Yt(e[r], t[r]) : n[r] = t[r];
1640
+ function Yt(t, e) {
1641
+ const n = { ...t };
1642
+ return K(t) && K(e) && Object.keys(e).forEach((r) => {
1643
+ K(e[r]) && K(t[r]) ? n[r] = Yt(t[r], e[r]) : n[r] = e[r];
1641
1644
  }), n;
1642
1645
  }
1643
- var Mt = class {
1644
- constructor(e = {}) {
1646
+ var xt = class {
1647
+ constructor(t = {}) {
1645
1648
  this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
1646
1649
  name: this.name
1647
1650
  }, this.config = {
1648
1651
  ...this.config,
1649
- ...e
1652
+ ...t
1650
1653
  }, this.name = this.config.name;
1651
1654
  }
1652
1655
  get options() {
@@ -1668,18 +1671,18 @@ var Mt = class {
1668
1671
  ) || {}
1669
1672
  };
1670
1673
  }
1671
- configure(e = {}) {
1672
- const t = this.extend({
1674
+ configure(t = {}) {
1675
+ const e = this.extend({
1673
1676
  ...this.config,
1674
- addOptions: () => Yt(this.options, e)
1677
+ addOptions: () => Yt(this.options, t)
1675
1678
  });
1676
- return t.name = this.name, t.parent = this.parent, t;
1679
+ return e.name = this.name, e.parent = this.parent, e;
1677
1680
  }
1678
- extend(e = {}) {
1679
- const t = new this.constructor({ ...this.config, ...e });
1680
- return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
1681
+ extend(t = {}) {
1682
+ const e = new this.constructor({ ...this.config, ...t });
1683
+ return e.parent = this, this.child = e, e.name = "name" in t ? t.name : e.parent.name, e;
1681
1684
  }
1682
- }, Cr = class Xt extends Mt {
1685
+ }, Cr = class Xt extends xt {
1683
1686
  constructor() {
1684
1687
  super(...arguments), this.type = "mark";
1685
1688
  }
@@ -1687,48 +1690,48 @@ var Mt = class {
1687
1690
  * Create a new Mark instance
1688
1691
  * @param config - Mark configuration object or a function that returns a configuration object
1689
1692
  */
1690
- static create(t = {}) {
1691
- const n = typeof t == "function" ? t() : t;
1693
+ static create(e = {}) {
1694
+ const n = typeof e == "function" ? e() : e;
1692
1695
  return new Xt(n);
1693
1696
  }
1694
- static handleExit({ editor: t, mark: n }) {
1695
- const { tr: r } = t.state, o = t.state.selection.$from;
1697
+ static handleExit({ editor: e, mark: n }) {
1698
+ const { tr: r } = e.state, o = e.state.selection.$from;
1696
1699
  if (o.pos === o.end()) {
1697
1700
  const i = o.marks();
1698
1701
  if (!!!i.find((l) => l?.type.name === n.name))
1699
1702
  return !1;
1700
1703
  const a = i.find((l) => l?.type.name === n.name);
1701
- return a && r.removeStoredMark(a), r.insertText(" ", o.pos), t.view.dispatch(r), !0;
1704
+ return a && r.removeStoredMark(a), r.insertText(" ", o.pos), e.view.dispatch(r), !0;
1702
1705
  }
1703
1706
  return !1;
1704
1707
  }
1705
- configure(t) {
1706
- return super.configure(t);
1708
+ configure(e) {
1709
+ return super.configure(e);
1707
1710
  }
1708
- extend(t) {
1709
- const n = typeof t == "function" ? t() : t;
1711
+ extend(e) {
1712
+ const n = typeof e == "function" ? e() : e;
1710
1713
  return super.extend(n);
1711
1714
  }
1712
1715
  };
1713
- function Pr(e) {
1714
- return typeof e == "number";
1716
+ function Pr(t) {
1717
+ return typeof t == "number";
1715
1718
  }
1716
1719
  var $r = class {
1717
- constructor(e) {
1718
- this.find = e.find, this.handler = e.handler;
1720
+ constructor(t) {
1721
+ this.find = t.find, this.handler = t.handler;
1719
1722
  }
1720
- }, Nr = (e, t, n) => {
1721
- if (mt(t))
1722
- return [...e.matchAll(t)];
1723
- const r = t(e, n);
1723
+ }, Nr = (t, e, n) => {
1724
+ if (ht(e))
1725
+ return [...t.matchAll(e)];
1726
+ const r = e(t, n);
1724
1727
  return r ? r.map((o) => {
1725
1728
  const s = [o.text];
1726
- return s.index = o.index, s.input = e, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), s.push(o.replaceWith)), s;
1729
+ return s.index = o.index, s.input = t, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), s.push(o.replaceWith)), s;
1727
1730
  }) : [];
1728
1731
  };
1729
- function Ir(e) {
1730
- const { editor: t, state: n, from: r, to: o, rule: s, pasteEvent: i, dropEvent: c } = e, { commands: a, chain: l, can: u } = new tt({
1731
- editor: t,
1732
+ function Ir(t) {
1733
+ const { editor: e, state: n, from: r, to: o, rule: s, pasteEvent: i, dropEvent: c } = t, { commands: a, chain: l, can: u } = new tt({
1734
+ editor: e,
1732
1735
  state: n
1733
1736
  }), d = [];
1734
1737
  return n.doc.nodesBetween(r, o, (p, m) => {
@@ -1759,15 +1762,15 @@ function Ir(e) {
1759
1762
  });
1760
1763
  }), d.every((p) => p !== null);
1761
1764
  }
1762
- var J = null, Br = (e) => {
1763
- var t;
1765
+ var J = null, Br = (t) => {
1766
+ var e;
1764
1767
  const n = new ClipboardEvent("paste", {
1765
1768
  clipboardData: new DataTransfer()
1766
1769
  });
1767
- return (t = n.clipboardData) == null || t.setData("text/html", e), n;
1770
+ return (e = n.clipboardData) == null || e.setData("text/html", t), n;
1768
1771
  };
1769
- function Rr(e) {
1770
- const { editor: t, rules: n } = e;
1772
+ function Rr(t) {
1773
+ const { editor: e, rules: n } = t;
1771
1774
  let r = null, o = !1, s = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
1772
1775
  try {
1773
1776
  c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
@@ -1786,7 +1789,7 @@ function Rr(e) {
1786
1789
  transaction: h
1787
1790
  });
1788
1791
  if (!(!Ir({
1789
- editor: t,
1792
+ editor: e,
1790
1793
  state: g,
1791
1794
  from: Math.max(d - 1, 0),
1792
1795
  to: f.b - 1,
@@ -1807,7 +1810,7 @@ function Rr(e) {
1807
1810
  view(d) {
1808
1811
  const f = (m) => {
1809
1812
  var h;
1810
- r = (h = d.dom.parentElement) != null && h.contains(m.target) ? d.dom.parentElement : null, r && (J = t);
1813
+ r = (h = d.dom.parentElement) != null && h.contains(m.target) ? d.dom.parentElement : null, r && (J = e);
1811
1814
  }, p = () => {
1812
1815
  J && (J = null);
1813
1816
  };
@@ -1842,7 +1845,7 @@ function Rr(e) {
1842
1845
  return;
1843
1846
  if (k) {
1844
1847
  let { text: y } = v;
1845
- typeof y == "string" ? y = y : y = bt(j.from(y), p.schema);
1848
+ typeof y == "string" ? y = y : y = kt(j.from(y), p.schema);
1846
1849
  const { from: S } = v, E = S + y.length, A = Br(y);
1847
1850
  return a({
1848
1851
  rule: u,
@@ -1865,26 +1868,26 @@ function Rr(e) {
1865
1868
  }));
1866
1869
  }
1867
1870
  var rt = class {
1868
- constructor(e, t) {
1869
- this.splittableMarks = [], this.editor = t, this.baseExtensions = e, this.extensions = qt(e), this.schema = Wn(this.extensions, t), this.setupExtensions();
1871
+ constructor(t, e) {
1872
+ this.splittableMarks = [], this.editor = e, this.baseExtensions = t, this.extensions = qt(t), this.schema = Wn(this.extensions, e), this.setupExtensions();
1870
1873
  }
1871
1874
  /**
1872
1875
  * Get all commands from the extensions.
1873
1876
  * @returns An object with all commands where the key is the command name and the value is the command function
1874
1877
  */
1875
1878
  get commands() {
1876
- return this.extensions.reduce((e, t) => {
1879
+ return this.extensions.reduce((t, e) => {
1877
1880
  const n = {
1878
- name: t.name,
1879
- options: t.options,
1880
- storage: this.editor.extensionStorage[t.name],
1881
+ name: e.name,
1882
+ options: e.options,
1883
+ storage: this.editor.extensionStorage[e.name],
1881
1884
  editor: this.editor,
1882
- type: at(t.name, this.schema)
1883
- }, r = b(t, "addCommands", n);
1885
+ type: at(e.name, this.schema)
1886
+ }, r = b(e, "addCommands", n);
1884
1887
  return r ? {
1885
- ...e,
1888
+ ...t,
1886
1889
  ...r()
1887
- } : e;
1890
+ } : t;
1888
1891
  }, {});
1889
1892
  }
1890
1893
  /**
@@ -1892,13 +1895,13 @@ var rt = class {
1892
1895
  * @returns An array of Prosemirror plugins
1893
1896
  */
1894
1897
  get plugins() {
1895
- const { editor: e } = this;
1896
- return kt([...this.extensions].reverse()).flatMap((r) => {
1898
+ const { editor: t } = this;
1899
+ return yt([...this.extensions].reverse()).flatMap((r) => {
1897
1900
  const o = {
1898
1901
  name: r.name,
1899
1902
  options: r.options,
1900
1903
  storage: this.editor.extensionStorage[r.name],
1901
- editor: e,
1904
+ editor: t,
1902
1905
  type: at(r.name, this.schema)
1903
1906
  }, s = [], i = b(
1904
1907
  r,
@@ -1906,30 +1909,30 @@ var rt = class {
1906
1909
  o
1907
1910
  );
1908
1911
  let c = {};
1909
- if (r.type === "mark" && b(r, "exitable", o) && (c.ArrowRight = () => Cr.handleExit({ editor: e, mark: r })), i) {
1912
+ if (r.type === "mark" && b(r, "exitable", o) && (c.ArrowRight = () => Cr.handleExit({ editor: t, mark: r })), i) {
1910
1913
  const f = Object.fromEntries(
1911
- Object.entries(i()).map(([p, m]) => [p, () => m({ editor: e })])
1914
+ Object.entries(i()).map(([p, m]) => [p, () => m({ editor: t })])
1912
1915
  );
1913
1916
  c = { ...c, ...f };
1914
1917
  }
1915
1918
  const a = qe(c);
1916
1919
  s.push(a);
1917
1920
  const l = b(r, "addInputRules", o);
1918
- if (Nt(r, e.options.enableInputRules) && l) {
1921
+ if (It(r, t.options.enableInputRules) && l) {
1919
1922
  const f = l();
1920
1923
  if (f && f.length) {
1921
1924
  const p = Tr({
1922
- editor: e,
1925
+ editor: t,
1923
1926
  rules: f
1924
1927
  }), m = Array.isArray(p) ? p : [p];
1925
1928
  s.push(...m);
1926
1929
  }
1927
1930
  }
1928
1931
  const u = b(r, "addPasteRules", o);
1929
- if (Nt(r, e.options.enablePasteRules) && u) {
1932
+ if (It(r, t.options.enablePasteRules) && u) {
1930
1933
  const f = u();
1931
1934
  if (f && f.length) {
1932
- const p = Rr({ editor: e, rules: f });
1935
+ const p = Rr({ editor: t, rules: f });
1933
1936
  s.push(...p);
1934
1937
  }
1935
1938
  }
@@ -1957,14 +1960,14 @@ var rt = class {
1957
1960
  * @returns An object with all node views where the key is the node name and the value is the node view function
1958
1961
  */
1959
1962
  get nodeViews() {
1960
- const { editor: e } = this, { nodeExtensions: t } = L(this.extensions);
1963
+ const { editor: t } = this, { nodeExtensions: e } = L(this.extensions);
1961
1964
  return Object.fromEntries(
1962
- t.filter((n) => !!b(n, "addNodeView")).map((n) => {
1965
+ e.filter((n) => !!b(n, "addNodeView")).map((n) => {
1963
1966
  const r = this.attributes.filter((a) => a.type === n.name), o = {
1964
1967
  name: n.name,
1965
1968
  options: n.options,
1966
1969
  storage: this.editor.extensionStorage[n.name],
1967
- editor: e,
1970
+ editor: t,
1968
1971
  type: T(n.name, this.schema)
1969
1972
  }, s = b(n, "addNodeView", o);
1970
1973
  if (!s)
@@ -1982,7 +1985,7 @@ var rt = class {
1982
1985
  decorations: d,
1983
1986
  innerDecorations: f,
1984
1987
  // tiptap-specific
1985
- editor: e,
1988
+ editor: t,
1986
1989
  extension: n,
1987
1990
  HTMLAttributes: p
1988
1991
  });
@@ -1992,14 +1995,14 @@ var rt = class {
1992
1995
  );
1993
1996
  }
1994
1997
  get markViews() {
1995
- const { editor: e } = this, { markExtensions: t } = L(this.extensions);
1998
+ const { editor: t } = this, { markExtensions: e } = L(this.extensions);
1996
1999
  return Object.fromEntries(
1997
- t.filter((n) => !!b(n, "addMarkView")).map((n) => {
2000
+ e.filter((n) => !!b(n, "addMarkView")).map((n) => {
1998
2001
  const r = this.attributes.filter((c) => c.type === n.name), o = {
1999
2002
  name: n.name,
2000
2003
  options: n.options,
2001
2004
  storage: this.editor.extensionStorage[n.name],
2002
- editor: e,
2005
+ editor: t,
2003
2006
  type: B(n.name, this.schema)
2004
2007
  }, s = b(n, "addMarkView", o);
2005
2008
  if (!s)
@@ -2012,11 +2015,11 @@ var rt = class {
2012
2015
  view: a,
2013
2016
  inline: l,
2014
2017
  // tiptap-specific
2015
- editor: e,
2018
+ editor: t,
2016
2019
  extension: n,
2017
2020
  HTMLAttributes: u,
2018
2021
  updateAttributes: (d) => {
2019
- Kr(c, e, d);
2022
+ Kr(c, t, d);
2020
2023
  }
2021
2024
  });
2022
2025
  };
@@ -2029,33 +2032,33 @@ var rt = class {
2029
2032
  * & bind editor event listener.
2030
2033
  */
2031
2034
  setupExtensions() {
2032
- const e = this.extensions;
2035
+ const t = this.extensions;
2033
2036
  this.editor.extensionStorage = Object.fromEntries(
2034
- e.map((t) => [t.name, t.storage])
2035
- ), e.forEach((t) => {
2037
+ t.map((e) => [e.name, e.storage])
2038
+ ), t.forEach((e) => {
2036
2039
  var n;
2037
2040
  const r = {
2038
- name: t.name,
2039
- options: t.options,
2040
- storage: this.editor.extensionStorage[t.name],
2041
+ name: e.name,
2042
+ options: e.options,
2043
+ storage: this.editor.extensionStorage[e.name],
2041
2044
  editor: this.editor,
2042
- type: at(t.name, this.schema)
2045
+ type: at(e.name, this.schema)
2043
2046
  };
2044
- t.type === "mark" && ((n = x(b(t, "keepOnSplit", r))) == null || n) && this.splittableMarks.push(t.name);
2045
- const o = b(t, "onBeforeCreate", r), s = b(t, "onCreate", r), i = b(t, "onUpdate", r), c = b(
2046
- t,
2047
+ e.type === "mark" && ((n = x(b(e, "keepOnSplit", r))) == null || n) && this.splittableMarks.push(e.name);
2048
+ const o = b(e, "onBeforeCreate", r), s = b(e, "onCreate", r), i = b(e, "onUpdate", r), c = b(
2049
+ e,
2047
2050
  "onSelectionUpdate",
2048
2051
  r
2049
- ), a = b(t, "onTransaction", r), l = b(t, "onFocus", r), u = b(t, "onBlur", r), d = b(t, "onDestroy", r);
2052
+ ), a = b(e, "onTransaction", r), l = b(e, "onFocus", r), u = b(e, "onBlur", r), d = b(e, "onDestroy", r);
2050
2053
  o && this.editor.on("beforeCreate", o), s && this.editor.on("create", s), i && this.editor.on("update", i), c && this.editor.on("selectionUpdate", c), a && this.editor.on("transaction", a), l && this.editor.on("focus", l), u && this.editor.on("blur", u), d && this.editor.on("destroy", d);
2051
2054
  });
2052
2055
  }
2053
2056
  };
2054
2057
  rt.resolve = qt;
2055
- rt.sort = kt;
2056
- rt.flatten = vt;
2058
+ rt.sort = yt;
2059
+ rt.flatten = bt;
2057
2060
  var jr = {};
2058
- pt(jr, {
2061
+ mt(jr, {
2059
2062
  ClipboardTextSerializer: () => ee,
2060
2063
  Commands: () => ne,
2061
2064
  Delete: () => re,
@@ -2068,7 +2071,7 @@ pt(jr, {
2068
2071
  TextDirection: () => ue,
2069
2072
  focusEventsPluginKey: () => ie
2070
2073
  });
2071
- var N = class te extends Mt {
2074
+ var N = class te extends xt {
2072
2075
  constructor() {
2073
2076
  super(...arguments), this.type = "extension";
2074
2077
  }
@@ -2076,15 +2079,15 @@ var N = class te extends Mt {
2076
2079
  * Create a new Extension instance
2077
2080
  * @param config - Extension configuration object or a function that returns a configuration object
2078
2081
  */
2079
- static create(t = {}) {
2080
- const n = typeof t == "function" ? t() : t;
2082
+ static create(e = {}) {
2083
+ const n = typeof e == "function" ? e() : e;
2081
2084
  return new te(n);
2082
2085
  }
2083
- configure(t) {
2084
- return super.configure(t);
2086
+ configure(e) {
2087
+ return super.configure(e);
2085
2088
  }
2086
- extend(t) {
2087
- const n = typeof t == "function" ? t() : t;
2089
+ extend(e) {
2090
+ const n = typeof e == "function" ? e() : e;
2088
2091
  return super.extend(n);
2089
2092
  }
2090
2093
  }, ee = N.create({
@@ -2100,7 +2103,7 @@ var N = class te extends Mt {
2100
2103
  key: new O("clipboardTextSerializer"),
2101
2104
  props: {
2102
2105
  clipboardTextSerializer: () => {
2103
- const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: o } = t, { ranges: s } = o, i = Math.min(...s.map((u) => u.$from.pos)), c = Math.max(...s.map((u) => u.$to.pos)), a = Jt(n);
2106
+ const { editor: t } = this, { state: e, schema: n } = t, { doc: r, selection: o } = e, { ranges: s } = o, i = Math.min(...s.map((u) => u.$from.pos)), c = Math.max(...s.map((u) => u.$to.pos)), a = Jt(n);
2104
2107
  return Kt(r, { from: i, to: c }, {
2105
2108
  ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
2106
2109
  textSerializers: a
@@ -2119,13 +2122,13 @@ var N = class te extends Mt {
2119
2122
  }
2120
2123
  }), re = N.create({
2121
2124
  name: "delete",
2122
- onUpdate({ transaction: e, appendedTransactions: t }) {
2125
+ onUpdate({ transaction: t, appendedTransactions: e }) {
2123
2126
  var n, r, o;
2124
2127
  const s = () => {
2125
2128
  var i, c, a, l;
2126
- if ((l = (a = (c = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : c.filterTransaction) == null ? void 0 : a.call(c, e)) != null ? l : e.getMeta("y-sync$"))
2129
+ if ((l = (a = (c = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : c.filterTransaction) == null ? void 0 : a.call(c, t)) != null ? l : t.getMeta("y-sync$"))
2127
2130
  return;
2128
- const u = zn(e.before, [e, ...t]);
2131
+ const u = zn(t.before, [t, ...e]);
2129
2132
  Yn(u).forEach((p) => {
2130
2133
  u.mapping.mapResult(p.oldRange.from).deletedAfter && u.mapping.mapResult(p.oldRange.to).deletedBefore && u.before.nodesBetween(p.oldRange.from, p.oldRange.to, (m, h) => {
2131
2134
  const g = h + m.nodeSize - 2, v = p.oldRange.from <= h && g <= p.oldRange.to;
@@ -2140,7 +2143,7 @@ var N = class te extends Mt {
2140
2143
  newRange: p.newRange,
2141
2144
  partial: !v,
2142
2145
  editor: this.editor,
2143
- transaction: e,
2146
+ transaction: t,
2144
2147
  combinedTransform: u
2145
2148
  });
2146
2149
  });
@@ -2165,7 +2168,7 @@ var N = class te extends Mt {
2165
2168
  },
2166
2169
  partial: !!(S || y),
2167
2170
  editor: this.editor,
2168
- transaction: e,
2171
+ transaction: t,
2169
2172
  combinedTransform: u
2170
2173
  });
2171
2174
  }
@@ -2180,10 +2183,10 @@ var N = class te extends Mt {
2180
2183
  new $({
2181
2184
  key: new O("tiptapDrop"),
2182
2185
  props: {
2183
- handleDrop: (e, t, n, r) => {
2186
+ handleDrop: (t, e, n, r) => {
2184
2187
  this.editor.emit("drop", {
2185
2188
  editor: this.editor,
2186
- event: t,
2189
+ event: e,
2187
2190
  slice: n,
2188
2191
  moved: r
2189
2192
  });
@@ -2207,21 +2210,21 @@ var N = class te extends Mt {
2207
2210
  }), ie = new O("focusEvents"), ae = N.create({
2208
2211
  name: "focusEvents",
2209
2212
  addProseMirrorPlugins() {
2210
- const { editor: e } = this;
2213
+ const { editor: t } = this;
2211
2214
  return [
2212
2215
  new $({
2213
2216
  key: ie,
2214
2217
  props: {
2215
2218
  handleDOMEvents: {
2216
- focus: (t, n) => {
2217
- e.isFocused = !0;
2218
- const r = e.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
2219
- return t.dispatch(r), !1;
2219
+ focus: (e, n) => {
2220
+ t.isFocused = !0;
2221
+ const r = t.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
2222
+ return e.dispatch(r), !1;
2220
2223
  },
2221
- blur: (t, n) => {
2222
- e.isFocused = !1;
2223
- const r = e.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
2224
- return t.dispatch(r), !1;
2224
+ blur: (e, n) => {
2225
+ t.isFocused = !1;
2226
+ const r = t.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
2227
+ return e.dispatch(r), !1;
2225
2228
  }
2226
2229
  }
2227
2230
  }
@@ -2231,7 +2234,7 @@ var N = class te extends Mt {
2231
2234
  }), ce = N.create({
2232
2235
  name: "keymap",
2233
2236
  addKeyboardShortcuts() {
2234
- const e = () => this.editor.commands.first(({ commands: i }) => [
2237
+ const t = () => this.editor.commands.first(({ commands: i }) => [
2235
2238
  () => i.undoInputRule(),
2236
2239
  // maybe convert first text block node to default node
2237
2240
  () => i.command(({ tr: c }) => {
@@ -2241,7 +2244,7 @@ var N = class te extends Mt {
2241
2244
  () => i.deleteSelection(),
2242
2245
  () => i.joinBackward(),
2243
2246
  () => i.selectNodeBackward()
2244
- ]), t = () => this.editor.commands.first(({ commands: i }) => [
2247
+ ]), e = () => this.editor.commands.first(({ commands: i }) => [
2245
2248
  () => i.deleteSelection(),
2246
2249
  () => i.deleteCurrentNode(),
2247
2250
  () => i.joinForward(),
@@ -2254,26 +2257,26 @@ var N = class te extends Mt {
2254
2257
  () => i.splitBlock()
2255
2258
  ]),
2256
2259
  "Mod-Enter": () => this.editor.commands.exitCode(),
2257
- Backspace: e,
2258
- "Mod-Backspace": e,
2259
- "Shift-Backspace": e,
2260
- Delete: t,
2261
- "Mod-Delete": t,
2260
+ Backspace: t,
2261
+ "Mod-Backspace": t,
2262
+ "Shift-Backspace": t,
2263
+ Delete: e,
2264
+ "Mod-Delete": e,
2262
2265
  "Mod-a": () => this.editor.commands.selectAll()
2263
2266
  }, o = {
2264
2267
  ...r
2265
2268
  }, s = {
2266
2269
  ...r,
2267
- "Ctrl-h": e,
2268
- "Alt-Backspace": e,
2269
- "Ctrl-d": t,
2270
- "Ctrl-Alt-Backspace": t,
2271
- "Alt-Delete": t,
2272
- "Alt-d": t,
2270
+ "Ctrl-h": t,
2271
+ "Alt-Backspace": t,
2272
+ "Ctrl-d": e,
2273
+ "Ctrl-Alt-Backspace": e,
2274
+ "Alt-Delete": e,
2275
+ "Alt-d": e,
2273
2276
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2274
2277
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2275
2278
  };
2276
- return gt() || Vt() ? s : o;
2279
+ return vt() || Vt() ? s : o;
2277
2280
  },
2278
2281
  addProseMirrorPlugins() {
2279
2282
  return [
@@ -2284,14 +2287,14 @@ var N = class te extends Mt {
2284
2287
  // with many other commands.
2285
2288
  new $({
2286
2289
  key: new O("clearDocument"),
2287
- appendTransaction: (e, t, n) => {
2288
- if (e.some((h) => h.getMeta("composition")))
2290
+ appendTransaction: (t, e, n) => {
2291
+ if (t.some((h) => h.getMeta("composition")))
2289
2292
  return;
2290
- const r = e.some((h) => h.docChanged) && !t.doc.eq(n.doc), o = e.some((h) => h.getMeta("preventClearDocument"));
2293
+ const r = t.some((h) => h.docChanged) && !e.doc.eq(n.doc), o = t.some((h) => h.getMeta("preventClearDocument"));
2291
2294
  if (!r || o)
2292
2295
  return;
2293
- const { empty: s, from: i, to: c } = t.selection, a = F.atStart(t.doc).from, l = F.atEnd(t.doc).to;
2294
- if (s || !(i === a && c === l) || !yt(n.doc))
2296
+ const { empty: s, from: i, to: c } = e.selection, a = F.atStart(e.doc).from, l = F.atEnd(e.doc).to;
2297
+ if (s || !(i === a && c === l) || !wt(n.doc))
2295
2298
  return;
2296
2299
  const f = n.tr, p = X({
2297
2300
  state: n,
@@ -2313,10 +2316,10 @@ var N = class te extends Mt {
2313
2316
  new $({
2314
2317
  key: new O("tiptapPaste"),
2315
2318
  props: {
2316
- handlePaste: (e, t, n) => {
2319
+ handlePaste: (t, e, n) => {
2317
2320
  this.editor.emit("paste", {
2318
2321
  editor: this.editor,
2319
- event: t,
2322
+ event: e,
2320
2323
  slice: n
2321
2324
  });
2322
2325
  }
@@ -2346,19 +2349,19 @@ var N = class te extends Mt {
2346
2349
  addGlobalAttributes() {
2347
2350
  if (!this.options.direction)
2348
2351
  return [];
2349
- const { nodeExtensions: e } = L(this.extensions);
2352
+ const { nodeExtensions: t } = L(this.extensions);
2350
2353
  return [
2351
2354
  {
2352
- types: e.filter((t) => t.name !== "text").map((t) => t.name),
2355
+ types: t.filter((e) => e.name !== "text").map((e) => e.name),
2353
2356
  attributes: {
2354
2357
  dir: {
2355
2358
  default: this.options.direction,
2356
- parseHTML: (t) => {
2357
- const n = t.getAttribute("dir");
2359
+ parseHTML: (e) => {
2360
+ const n = e.getAttribute("dir");
2358
2361
  return n && (n === "ltr" || n === "rtl" || n === "auto") ? n : this.options.direction;
2359
2362
  },
2360
- renderHTML: (t) => t.dir ? {
2361
- dir: t.dir
2363
+ renderHTML: (e) => e.dir ? {
2364
+ dir: e.dir
2362
2365
  } : {}
2363
2366
  }
2364
2367
  }
@@ -2371,9 +2374,9 @@ var N = class te extends Mt {
2371
2374
  key: new O("textDirection"),
2372
2375
  props: {
2373
2376
  attributes: () => {
2374
- const e = this.options.direction;
2375
- return e ? {
2376
- dir: e
2377
+ const t = this.options.direction;
2378
+ return t ? {
2379
+ dir: t
2377
2380
  } : {};
2378
2381
  }
2379
2382
  }
@@ -2381,8 +2384,8 @@ var N = class te extends Mt {
2381
2384
  ];
2382
2385
  }
2383
2386
  }), Or = class z {
2384
- constructor(t, n, r = !1, o = null) {
2385
- this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = t, this.editor = n, this.currentNode = o;
2387
+ constructor(e, n, r = !1, o = null) {
2388
+ this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = e, this.editor = n, this.currentNode = o;
2386
2389
  }
2387
2390
  get name() {
2388
2391
  return this.node.type.name;
@@ -2394,8 +2397,8 @@ var N = class te extends Mt {
2394
2397
  return this.editor.view.domAtPos(this.pos).node;
2395
2398
  }
2396
2399
  get depth() {
2397
- var t;
2398
- return (t = this.actualDepth) != null ? t : this.resolvedPos.depth;
2400
+ var e;
2401
+ return (e = this.actualDepth) != null ? e : this.resolvedPos.depth;
2399
2402
  }
2400
2403
  get pos() {
2401
2404
  return this.resolvedPos.pos;
@@ -2403,7 +2406,7 @@ var N = class te extends Mt {
2403
2406
  get content() {
2404
2407
  return this.node.content;
2405
2408
  }
2406
- set content(t) {
2409
+ set content(e) {
2407
2410
  let n = this.from, r = this.to;
2408
2411
  if (this.isBlock) {
2409
2412
  if (this.content.size === 0) {
@@ -2412,7 +2415,7 @@ var N = class te extends Mt {
2412
2415
  }
2413
2416
  n = this.from + 1, r = this.to - 1;
2414
2417
  }
2415
- this.editor.commands.insertContentAt({ from: n, to: r }, t);
2418
+ this.editor.commands.insertContentAt({ from: n, to: r }, e);
2416
2419
  }
2417
2420
  get attributes() {
2418
2421
  return this.node.attrs;
@@ -2438,19 +2441,19 @@ var N = class te extends Mt {
2438
2441
  get parent() {
2439
2442
  if (this.depth === 0)
2440
2443
  return null;
2441
- const t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
2444
+ const e = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(e);
2442
2445
  return new z(n, this.editor);
2443
2446
  }
2444
2447
  get before() {
2445
- let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
2446
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new z(t, this.editor);
2448
+ let e = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
2449
+ return e.depth !== this.depth && (e = this.resolvedPos.doc.resolve(this.from - 3)), new z(e, this.editor);
2447
2450
  }
2448
2451
  get after() {
2449
- let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
2450
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new z(t, this.editor);
2452
+ let e = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
2453
+ return e.depth !== this.depth && (e = this.resolvedPos.doc.resolve(this.to + 3)), new z(e, this.editor);
2451
2454
  }
2452
2455
  get children() {
2453
- const t = [];
2456
+ const e = [];
2454
2457
  return this.node.content.forEach((n, r) => {
2455
2458
  const o = n.isBlock && !n.isTextblock, s = n.isAtom && !n.isText, i = this.pos + r + (s ? 0 : 1);
2456
2459
  if (i < 0 || i > this.resolvedPos.doc.nodeSize - 2)
@@ -2459,20 +2462,20 @@ var N = class te extends Mt {
2459
2462
  if (!o && c.depth <= this.depth)
2460
2463
  return;
2461
2464
  const a = new z(c, this.editor, o, o ? n : null);
2462
- o && (a.actualDepth = this.depth + 1), t.push(new z(c, this.editor, o, o ? n : null));
2463
- }), t;
2465
+ o && (a.actualDepth = this.depth + 1), e.push(new z(c, this.editor, o, o ? n : null));
2466
+ }), e;
2464
2467
  }
2465
2468
  get firstChild() {
2466
2469
  return this.children[0] || null;
2467
2470
  }
2468
2471
  get lastChild() {
2469
- const t = this.children;
2470
- return t[t.length - 1] || null;
2472
+ const e = this.children;
2473
+ return e[e.length - 1] || null;
2471
2474
  }
2472
- closest(t, n = {}) {
2475
+ closest(e, n = {}) {
2473
2476
  let r = null, o = this.parent;
2474
2477
  for (; o && !r; ) {
2475
- if (o.node.type.name === t)
2478
+ if (o.node.type.name === e)
2476
2479
  if (Object.keys(n).length > 0) {
2477
2480
  const s = o.node.attrs, i = Object.keys(n);
2478
2481
  for (let c = 0; c < i.length; c += 1) {
@@ -2486,23 +2489,23 @@ var N = class te extends Mt {
2486
2489
  }
2487
2490
  return r;
2488
2491
  }
2489
- querySelector(t, n = {}) {
2490
- return this.querySelectorAll(t, n, !0)[0] || null;
2492
+ querySelector(e, n = {}) {
2493
+ return this.querySelectorAll(e, n, !0)[0] || null;
2491
2494
  }
2492
- querySelectorAll(t, n = {}, r = !1) {
2495
+ querySelectorAll(e, n = {}, r = !1) {
2493
2496
  let o = [];
2494
2497
  if (!this.children || this.children.length === 0)
2495
2498
  return o;
2496
2499
  const s = Object.keys(n);
2497
2500
  return this.children.forEach((i) => {
2498
- r && o.length > 0 || (i.node.type.name === t && s.every((a) => n[a] === i.node.attrs[a]) && o.push(i), !(r && o.length > 0) && (o = o.concat(i.querySelectorAll(t, n, r))));
2501
+ r && o.length > 0 || (i.node.type.name === e && s.every((a) => n[a] === i.node.attrs[a]) && o.push(i), !(r && o.length > 0) && (o = o.concat(i.querySelectorAll(e, n, r))));
2499
2502
  }), o;
2500
2503
  }
2501
- setAttribute(t) {
2504
+ setAttribute(e) {
2502
2505
  const { tr: n } = this.editor.state;
2503
2506
  n.setNodeMarkup(this.from, void 0, {
2504
2507
  ...this.node.attrs,
2505
- ...t
2508
+ ...e
2506
2509
  }), this.editor.view.dispatch(n);
2507
2510
  }
2508
2511
  }, Dr = `.ProseMirror {
@@ -2576,15 +2579,15 @@ img.ProseMirror-separator {
2576
2579
  .ProseMirror-focused .ProseMirror-gapcursor {
2577
2580
  display: block;
2578
2581
  }`;
2579
- function _r(e, t, n) {
2582
+ function _r(t, e, n) {
2580
2583
  const r = document.querySelector("style[data-tiptap-style]");
2581
2584
  if (r !== null)
2582
2585
  return r;
2583
2586
  const o = document.createElement("style");
2584
- return t && o.setAttribute("nonce", t), o.setAttribute("data-tiptap-style", ""), o.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(o), o;
2587
+ return e && o.setAttribute("nonce", e), o.setAttribute("data-tiptap-style", ""), o.innerHTML = t, document.getElementsByTagName("head")[0].appendChild(o), o;
2585
2588
  }
2586
- var so = class extends Sr {
2587
- constructor(e = {}) {
2589
+ var io = class extends Sr {
2590
+ constructor(t = {}) {
2588
2591
  super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.options = {
2589
2592
  element: typeof document < "u" ? document.createElement("div") : null,
2590
2593
  content: "",
@@ -2621,10 +2624,10 @@ var so = class extends Sr {
2621
2624
  }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2622
2625
  getUpdatedPosition: er,
2623
2626
  createMappablePosition: nr
2624
- }, 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: r, slice: o, moved: s }) => this.options.onDrop(r, o, s)), this.on("paste", ({ event: r, slice: o }) => this.options.onPaste(r, o)), this.on("delete", this.options.onDelete);
2625
- const t = this.createDoc(), n = Ft(t, this.options.autofocus);
2627
+ }, this.setOptions(t), 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: r, slice: o, moved: s }) => this.options.onDrop(r, o, s)), this.on("paste", ({ event: r, slice: o }) => this.options.onPaste(r, o)), this.on("delete", this.options.onDelete);
2628
+ const e = this.createDoc(), n = Ft(e, this.options.autofocus);
2626
2629
  this.editorState = De.create({
2627
- doc: t,
2630
+ doc: e,
2628
2631
  schema: this.schema,
2629
2632
  selection: n || void 0
2630
2633
  }), this.options.element && this.mount(this.options.element);
@@ -2632,12 +2635,12 @@ var so = class extends Sr {
2632
2635
  /**
2633
2636
  * Attach the editor to the DOM, creating a new editor view.
2634
2637
  */
2635
- mount(e) {
2638
+ mount(t) {
2636
2639
  if (typeof document > "u")
2637
2640
  throw new Error(
2638
2641
  "[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment."
2639
2642
  );
2640
- this.createView(e), this.emit("mount", { editor: this }), this.css && !document.head.contains(this.css) && document.head.appendChild(this.css), window.setTimeout(() => {
2643
+ this.createView(t), this.emit("mount", { editor: this }), this.css && !document.head.contains(this.css) && document.head.appendChild(this.css), window.setTimeout(() => {
2641
2644
  this.isDestroyed || (this.options.autofocus !== !1 && this.options.autofocus !== null && this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
2642
2645
  }, 0);
2643
2646
  }
@@ -2646,14 +2649,14 @@ var so = class extends Sr {
2646
2649
  */
2647
2650
  unmount() {
2648
2651
  if (this.editorView) {
2649
- const e = this.editorView.dom;
2650
- e?.editor && delete e.editor, this.editorView.destroy();
2652
+ const t = this.editorView.dom;
2653
+ t?.editor && delete t.editor, this.editorView.destroy();
2651
2654
  }
2652
2655
  if (this.editorView = null, this.isInitialized = !1, this.css && !document.querySelectorAll(`.${this.className}`).length)
2653
2656
  try {
2654
2657
  typeof this.css.remove == "function" ? this.css.remove() : this.css.parentNode && this.css.parentNode.removeChild(this.css);
2655
- } catch (e) {
2656
- console.warn("Failed to remove CSS element:", e);
2658
+ } catch (t) {
2659
+ console.warn("Failed to remove CSS element:", t);
2657
2660
  }
2658
2661
  this.css = null, this.emit("unmount", { editor: this });
2659
2662
  }
@@ -2692,17 +2695,17 @@ var so = class extends Sr {
2692
2695
  *
2693
2696
  * @param options A list of options
2694
2697
  */
2695
- setOptions(e = {}) {
2698
+ setOptions(t = {}) {
2696
2699
  this.options = {
2697
2700
  ...this.options,
2698
- ...e
2701
+ ...t
2699
2702
  }, !(!this.editorView || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
2700
2703
  }
2701
2704
  /**
2702
2705
  * Update editable state of the editor.
2703
2706
  */
2704
- setEditable(e, t = !0) {
2705
- this.setOptions({ editable: e }), t && this.emit("update", { editor: this, transaction: this.state.tr, appendedTransactions: [] });
2707
+ setEditable(t, e = !0) {
2708
+ this.setOptions({ editable: t }), e && this.emit("update", { editor: this, transaction: this.state.tr, appendedTransactions: [] });
2706
2709
  }
2707
2710
  /**
2708
2711
  * Returns whether the editor is editable.
@@ -2717,11 +2720,11 @@ var so = class extends Sr {
2717
2720
  return this.editorView ? this.editorView : new Proxy(
2718
2721
  {
2719
2722
  state: this.editorState,
2720
- updateState: (e) => {
2721
- this.editorState = e;
2723
+ updateState: (t) => {
2724
+ this.editorState = t;
2722
2725
  },
2723
- dispatch: (e) => {
2724
- this.dispatchTransaction(e);
2726
+ dispatch: (t) => {
2727
+ this.dispatchTransaction(t);
2725
2728
  },
2726
2729
  // Stub some commonly accessed properties to prevent errors
2727
2730
  composing: !1,
@@ -2730,15 +2733,15 @@ var so = class extends Sr {
2730
2733
  isDestroyed: !1
2731
2734
  },
2732
2735
  {
2733
- get: (e, t) => {
2736
+ get: (t, e) => {
2734
2737
  if (this.editorView)
2735
- return this.editorView[t];
2736
- if (t === "state")
2738
+ return this.editorView[e];
2739
+ if (e === "state")
2737
2740
  return this.editorState;
2738
- if (t in e)
2739
- return Reflect.get(e, t);
2741
+ if (e in t)
2742
+ return Reflect.get(t, e);
2740
2743
  throw new Error(
2741
- `[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`
2744
+ `[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`
2742
2745
  );
2743
2746
  }
2744
2747
  }
@@ -2757,8 +2760,8 @@ var so = class extends Sr {
2757
2760
  * @param handlePlugins Control how to merge the plugin into the existing plugins.
2758
2761
  * @returns The new editor state
2759
2762
  */
2760
- registerPlugin(e, t) {
2761
- const n = Ut(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
2763
+ registerPlugin(t, e) {
2764
+ const n = Ut(e) ? e(t, [...this.state.plugins]) : [...this.state.plugins, t], r = this.state.reconfigure({ plugins: n });
2762
2765
  return this.view.updateState(r), r;
2763
2766
  }
2764
2767
  /**
@@ -2767,15 +2770,15 @@ var so = class extends Sr {
2767
2770
  * @param nameOrPluginKeyToRemove The plugins name
2768
2771
  * @returns The new editor state or undefined if the editor is destroyed
2769
2772
  */
2770
- unregisterPlugin(e) {
2773
+ unregisterPlugin(t) {
2771
2774
  if (this.isDestroyed)
2772
2775
  return;
2773
- const t = this.state.plugins;
2774
- let n = t;
2775
- if ([].concat(e).forEach((o) => {
2776
+ const e = this.state.plugins;
2777
+ let n = e;
2778
+ if ([].concat(t).forEach((o) => {
2776
2779
  const s = typeof o == "string" ? `${o}$` : o.key;
2777
2780
  n = n.filter((i) => !i.key.startsWith(s));
2778
- }), t.length === n.length)
2781
+ }), e.length === n.length)
2779
2782
  return;
2780
2783
  const r = this.state.reconfigure({
2781
2784
  plugins: n
@@ -2786,11 +2789,11 @@ var so = class extends Sr {
2786
2789
  * Creates an extension manager.
2787
2790
  */
2788
2791
  createExtensionManager() {
2789
- var e, t;
2792
+ var t, e;
2790
2793
  const r = [...this.options.enableCoreExtensions ? [
2791
2794
  se,
2792
2795
  ee.configure({
2793
- blockSeparator: (t = (e = this.options.coreExtensionOptions) == null ? void 0 : e.clipboardTextSerializer) == null ? void 0 : t.blockSeparator
2796
+ blockSeparator: (e = (t = this.options.coreExtensionOptions) == null ? void 0 : t.clipboardTextSerializer) == null ? void 0 : e.blockSeparator
2794
2797
  }),
2795
2798
  ne,
2796
2799
  ae,
@@ -2823,37 +2826,37 @@ var so = class extends Sr {
2823
2826
  * Creates the initial document.
2824
2827
  */
2825
2828
  createDoc() {
2826
- let e;
2829
+ let t;
2827
2830
  try {
2828
- e = dt(this.options.content, this.schema, this.options.parseOptions, {
2831
+ t = dt(this.options.content, this.schema, this.options.parseOptions, {
2829
2832
  errorOnInvalidContent: this.options.enableContentCheck
2830
2833
  });
2831
- } catch (t) {
2832
- if (!(t instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(t.message))
2833
- throw t;
2834
+ } catch (e) {
2835
+ if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message))
2836
+ throw e;
2834
2837
  this.emit("contentError", {
2835
2838
  editor: this,
2836
- error: t,
2839
+ error: e,
2837
2840
  disableCollaboration: () => {
2838
2841
  "collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((n) => n.name !== "collaboration"), this.createExtensionManager();
2839
2842
  }
2840
- }), e = dt(this.options.content, this.schema, this.options.parseOptions, {
2843
+ }), t = dt(this.options.content, this.schema, this.options.parseOptions, {
2841
2844
  errorOnInvalidContent: !1
2842
2845
  });
2843
2846
  }
2844
- return e;
2847
+ return t;
2845
2848
  }
2846
2849
  /**
2847
2850
  * Creates a ProseMirror view.
2848
2851
  */
2849
- createView(e) {
2850
- var t;
2851
- this.editorView = new We(e, {
2852
+ createView(t) {
2853
+ var e;
2854
+ this.editorView = new We(t, {
2852
2855
  ...this.options.editorProps,
2853
2856
  attributes: {
2854
2857
  // add `role="textbox"` to the editor element
2855
2858
  role: "textbox",
2856
- ...(t = this.options.editorProps) == null ? void 0 : t.attributes
2859
+ ...(e = this.options.editorProps) == null ? void 0 : e.attributes
2857
2860
  },
2858
2861
  dispatchTransaction: this.dispatchTransaction.bind(this),
2859
2862
  state: this.editorState,
@@ -2882,44 +2885,44 @@ var so = class extends Sr {
2882
2885
  prependClass() {
2883
2886
  this.view.dom.className = `${this.className} ${this.view.dom.className}`;
2884
2887
  }
2885
- captureTransaction(e) {
2886
- this.isCapturingTransaction = !0, e(), this.isCapturingTransaction = !1;
2887
- const t = this.capturedTransaction;
2888
- return this.capturedTransaction = null, t;
2888
+ captureTransaction(t) {
2889
+ this.isCapturingTransaction = !0, t(), this.isCapturingTransaction = !1;
2890
+ const e = this.capturedTransaction;
2891
+ return this.capturedTransaction = null, e;
2889
2892
  }
2890
2893
  /**
2891
2894
  * The callback over which to send transactions (state updates) produced by the view.
2892
2895
  *
2893
2896
  * @param transaction An editor state transaction
2894
2897
  */
2895
- dispatchTransaction(e) {
2898
+ dispatchTransaction(t) {
2896
2899
  if (this.view.isDestroyed)
2897
2900
  return;
2898
2901
  if (this.isCapturingTransaction) {
2899
2902
  if (!this.capturedTransaction) {
2900
- this.capturedTransaction = e;
2903
+ this.capturedTransaction = t;
2901
2904
  return;
2902
2905
  }
2903
- e.steps.forEach((l) => {
2906
+ t.steps.forEach((l) => {
2904
2907
  var u;
2905
2908
  return (u = this.capturedTransaction) == null ? void 0 : u.step(l);
2906
2909
  });
2907
2910
  return;
2908
2911
  }
2909
- const { state: t, transactions: n } = this.state.applyTransaction(e), r = !this.state.selection.eq(t.selection), o = n.includes(e), s = this.state;
2912
+ const { state: e, transactions: n } = this.state.applyTransaction(t), r = !this.state.selection.eq(e.selection), o = n.includes(t), s = this.state;
2910
2913
  if (this.emit("beforeTransaction", {
2911
2914
  editor: this,
2912
- transaction: e,
2913
- nextState: t
2915
+ transaction: t,
2916
+ nextState: e
2914
2917
  }), !o)
2915
2918
  return;
2916
- this.view.updateState(t), this.emit("transaction", {
2919
+ this.view.updateState(e), this.emit("transaction", {
2917
2920
  editor: this,
2918
- transaction: e,
2921
+ transaction: t,
2919
2922
  appendedTransactions: n.slice(1)
2920
2923
  }), r && this.emit("selectionUpdate", {
2921
2924
  editor: this,
2922
- transaction: e
2925
+ transaction: t
2923
2926
  });
2924
2927
  const i = n.findLast((l) => l.getMeta("focus") || l.getMeta("blur")), c = i?.getMeta("focus"), a = i?.getMeta("blur");
2925
2928
  c && this.emit("focus", {
@@ -2932,20 +2935,20 @@ var so = class extends Sr {
2932
2935
  event: a.event,
2933
2936
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
2934
2937
  transaction: i
2935
- }), !(e.getMeta("preventUpdate") || !n.some((l) => l.docChanged) || s.doc.eq(t.doc)) && this.emit("update", {
2938
+ }), !(t.getMeta("preventUpdate") || !n.some((l) => l.docChanged) || s.doc.eq(e.doc)) && this.emit("update", {
2936
2939
  editor: this,
2937
- transaction: e,
2940
+ transaction: t,
2938
2941
  appendedTransactions: n.slice(1)
2939
2942
  });
2940
2943
  }
2941
2944
  /**
2942
2945
  * Get attributes of the currently selected node or mark.
2943
2946
  */
2944
- getAttributes(e) {
2945
- return Zn(this.state, e);
2947
+ getAttributes(t) {
2948
+ return Zn(this.state, t);
2946
2949
  }
2947
- isActive(e, t) {
2948
- const n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
2950
+ isActive(t, e) {
2951
+ const n = typeof t == "string" ? t : null, r = typeof t == "string" ? e : t;
2949
2952
  return tr(this.state, n, r);
2950
2953
  }
2951
2954
  /**
@@ -2958,17 +2961,17 @@ var so = class extends Sr {
2958
2961
  * Get the document as HTML.
2959
2962
  */
2960
2963
  getHTML() {
2961
- return bt(this.state.doc.content, this.schema);
2964
+ return kt(this.state.doc.content, this.schema);
2962
2965
  }
2963
2966
  /**
2964
2967
  * Get the document as text.
2965
2968
  */
2966
- getText(e) {
2967
- const { blockSeparator: t = `
2969
+ getText(t) {
2970
+ const { blockSeparator: e = `
2968
2971
 
2969
- `, textSerializers: n = {} } = e || {};
2972
+ `, textSerializers: n = {} } = t || {};
2970
2973
  return Kn(this.state.doc, {
2971
- blockSeparator: t,
2974
+ blockSeparator: e,
2972
2975
  textSerializers: {
2973
2976
  ...Jt(this.schema),
2974
2977
  ...n
@@ -2979,7 +2982,7 @@ var so = class extends Sr {
2979
2982
  * Check if there is no content.
2980
2983
  */
2981
2984
  get isEmpty() {
2982
- return yt(this.state.doc);
2985
+ return wt(this.state.doc);
2983
2986
  }
2984
2987
  /**
2985
2988
  * Destroy the editor.
@@ -2991,130 +2994,130 @@ var so = class extends Sr {
2991
2994
  * Check if the editor is already destroyed.
2992
2995
  */
2993
2996
  get isDestroyed() {
2994
- var e, t;
2995
- return (t = (e = this.editorView) == null ? void 0 : e.isDestroyed) != null ? t : !0;
2997
+ var t, e;
2998
+ return (e = (t = this.editorView) == null ? void 0 : t.isDestroyed) != null ? e : !0;
2996
2999
  }
2997
- $node(e, t) {
3000
+ $node(t, e) {
2998
3001
  var n;
2999
- return ((n = this.$doc) == null ? void 0 : n.querySelector(e, t)) || null;
3002
+ return ((n = this.$doc) == null ? void 0 : n.querySelector(t, e)) || null;
3000
3003
  }
3001
- $nodes(e, t) {
3004
+ $nodes(t, e) {
3002
3005
  var n;
3003
- return ((n = this.$doc) == null ? void 0 : n.querySelectorAll(e, t)) || null;
3006
+ return ((n = this.$doc) == null ? void 0 : n.querySelectorAll(t, e)) || null;
3004
3007
  }
3005
- $pos(e) {
3006
- const t = this.state.doc.resolve(e);
3007
- return new Or(t, this);
3008
+ $pos(t) {
3009
+ const e = this.state.doc.resolve(t);
3010
+ return new Or(e, this);
3008
3011
  }
3009
3012
  get $doc() {
3010
3013
  return this.$pos(0);
3011
3014
  }
3012
3015
  };
3013
- function io(e) {
3014
- return new wt({
3015
- find: e.find,
3016
- handler: ({ state: t, range: n, match: r }) => {
3017
- const o = x(e.getAttributes, void 0, r);
3016
+ function ao(t) {
3017
+ return new Mt({
3018
+ find: t.find,
3019
+ handler: ({ state: e, range: n, match: r }) => {
3020
+ const o = x(t.getAttributes, void 0, r);
3018
3021
  if (o === !1 || o === null)
3019
3022
  return null;
3020
- const { tr: s } = t, i = r[r.length - 1], c = r[0];
3023
+ const { tr: s } = e, i = r[r.length - 1], c = r[0];
3021
3024
  if (i) {
3022
3025
  const a = c.search(/\S/), l = n.from + c.indexOf(i), u = l + i.length;
3023
- if (Zt(n.from, n.to, t.doc).filter((p) => p.mark.type.excluded.find((h) => h === e.type && h !== p.mark.type)).filter((p) => p.to > l).length)
3026
+ if (Zt(n.from, n.to, e.doc).filter((p) => p.mark.type.excluded.find((h) => h === t.type && h !== p.mark.type)).filter((p) => p.to > l).length)
3024
3027
  return null;
3025
3028
  u < n.to && s.delete(u, n.to), l > n.from && s.delete(n.from + a, l);
3026
3029
  const f = n.from + a + i.length;
3027
- s.addMark(n.from + a, f, e.type.create(o || {})), s.removeStoredMark(e.type);
3030
+ s.addMark(n.from + a, f, t.type.create(o || {})), s.removeStoredMark(t.type);
3028
3031
  }
3029
3032
  },
3030
- undoable: e.undoable
3033
+ undoable: t.undoable
3031
3034
  });
3032
3035
  }
3033
- function ao(e) {
3034
- return new wt({
3035
- find: e.find,
3036
- handler: ({ state: t, range: n, match: r }) => {
3037
- const o = t.doc.resolve(n.from), s = x(e.getAttributes, void 0, r) || {};
3038
- if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), e.type))
3036
+ function co(t) {
3037
+ return new Mt({
3038
+ find: t.find,
3039
+ handler: ({ state: e, range: n, match: r }) => {
3040
+ const o = e.doc.resolve(n.from), s = x(t.getAttributes, void 0, r) || {};
3041
+ if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), t.type))
3039
3042
  return null;
3040
- t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, s);
3043
+ e.tr.delete(n.from, n.to).setBlockType(n.from, n.from, t.type, s);
3041
3044
  },
3042
- undoable: e.undoable
3045
+ undoable: t.undoable
3043
3046
  });
3044
3047
  }
3045
- function co(e) {
3046
- return new wt({
3047
- find: e.find,
3048
- handler: ({ state: t, range: n, match: r, chain: o }) => {
3049
- const s = x(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), a = i.doc.resolve(n.from).blockRange(), l = a && me(a, e.type, s);
3048
+ function lo(t) {
3049
+ return new Mt({
3050
+ find: t.find,
3051
+ handler: ({ state: e, range: n, match: r, chain: o }) => {
3052
+ const s = x(t.getAttributes, void 0, r) || {}, i = e.tr.delete(n.from, n.to), a = i.doc.resolve(n.from).blockRange(), l = a && me(a, t.type, s);
3050
3053
  if (!l)
3051
3054
  return null;
3052
- if (i.wrap(a, l), e.keepMarks && e.editor) {
3053
- const { selection: d, storedMarks: f } = t, { splittableMarks: p } = e.editor.extensionManager, m = f || d.$to.parentOffset && d.$from.marks();
3055
+ if (i.wrap(a, l), t.keepMarks && t.editor) {
3056
+ const { selection: d, storedMarks: f } = e, { splittableMarks: p } = t.editor.extensionManager, m = f || d.$to.parentOffset && d.$from.marks();
3054
3057
  if (m) {
3055
3058
  const h = m.filter((g) => p.includes(g.type.name));
3056
3059
  i.ensureMarks(h);
3057
3060
  }
3058
3061
  }
3059
- if (e.keepAttributes) {
3060
- const d = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
3062
+ if (t.keepAttributes) {
3063
+ const d = t.type.name === "bulletList" || t.type.name === "orderedList" ? "listItem" : "taskList";
3061
3064
  o().updateAttributes(d, s).run();
3062
3065
  }
3063
3066
  const u = i.doc.resolve(n.from - 1).nodeBefore;
3064
- u && u.type === e.type && ft(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
3067
+ u && u.type === t.type && ft(i.doc, n.from - 1) && (!t.joinPredicate || t.joinPredicate(r, u)) && i.join(n.from - 1);
3065
3068
  },
3066
- undoable: e.undoable
3069
+ undoable: t.undoable
3067
3070
  });
3068
3071
  }
3069
3072
  var zr = {};
3070
- pt(zr, {
3073
+ mt(zr, {
3071
3074
  createAtomBlockMarkdownSpec: () => Fr,
3072
3075
  createBlockMarkdownSpec: () => Lr,
3073
3076
  createInlineMarkdownSpec: () => Ur,
3074
- parseAttributes: () => xt,
3077
+ parseAttributes: () => St,
3075
3078
  parseIndentedBlocks: () => Wr,
3076
3079
  renderNestedMarkdownContent: () => qr,
3077
- serializeAttributes: () => St
3080
+ serializeAttributes: () => Et
3078
3081
  });
3079
- function xt(e) {
3080
- if (!e?.trim())
3082
+ function St(t) {
3083
+ if (!t?.trim())
3081
3084
  return {};
3082
- const t = {}, n = [], r = e.replace(/["']([^"']*)["']/g, (l) => (n.push(l), `__QUOTED_${n.length - 1}__`)), o = r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
3085
+ const e = {}, n = [], r = t.replace(/["']([^"']*)["']/g, (l) => (n.push(l), `__QUOTED_${n.length - 1}__`)), o = r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
3083
3086
  if (o) {
3084
3087
  const l = o.map((u) => u.trim().slice(1));
3085
- t.class = l.join(" ");
3088
+ e.class = l.join(" ");
3086
3089
  }
3087
3090
  const s = r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
3088
- s && (t.id = s[1]);
3091
+ s && (e.id = s[1]);
3089
3092
  const i = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
3090
3093
  Array.from(r.matchAll(i)).forEach(([, l, u]) => {
3091
3094
  var d;
3092
3095
  const f = parseInt(((d = u.match(/__QUOTED_(\d+)__/)) == null ? void 0 : d[1]) || "0", 10), p = n[f];
3093
- p && (t[l] = p.slice(1, -1));
3096
+ p && (e[l] = p.slice(1, -1));
3094
3097
  });
3095
3098
  const a = r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g, "").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
3096
3099
  return a && a.split(/\s+/).filter(Boolean).forEach((u) => {
3097
- u.match(/^[a-zA-Z][\w-]*$/) && (t[u] = !0);
3098
- }), t;
3100
+ u.match(/^[a-zA-Z][\w-]*$/) && (e[u] = !0);
3101
+ }), e;
3099
3102
  }
3100
- function St(e) {
3101
- if (!e || Object.keys(e).length === 0)
3103
+ function Et(t) {
3104
+ if (!t || Object.keys(t).length === 0)
3102
3105
  return "";
3103
- const t = [];
3104
- return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((r) => t.push(`.${r}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([n, r]) => {
3105
- n === "class" || n === "id" || (r === !0 ? t.push(n) : r !== !1 && r != null && t.push(`${n}="${String(r)}"`));
3106
- }), t.join(" ");
3106
+ const e = [];
3107
+ return t.class && String(t.class).split(/\s+/).filter(Boolean).forEach((r) => e.push(`.${r}`)), t.id && e.push(`#${t.id}`), Object.entries(t).forEach(([n, r]) => {
3108
+ n === "class" || n === "id" || (r === !0 ? e.push(n) : r !== !1 && r != null && e.push(`${n}="${String(r)}"`));
3109
+ }), e.join(" ");
3107
3110
  }
3108
- function Fr(e) {
3111
+ function Fr(t) {
3109
3112
  const {
3110
- nodeName: t,
3113
+ nodeName: e,
3111
3114
  name: n,
3112
- parseAttributes: r = xt,
3113
- serializeAttributes: o = St,
3115
+ parseAttributes: r = St,
3116
+ serializeAttributes: o = Et,
3114
3117
  defaultAttributes: s = {},
3115
3118
  requiredAttributes: i = [],
3116
3119
  allowedAttributes: c
3117
- } = e, a = n || t, l = (u) => {
3120
+ } = t, a = n || e, l = (u) => {
3118
3121
  if (!c)
3119
3122
  return u;
3120
3123
  const d = {};
@@ -3125,10 +3128,10 @@ function Fr(e) {
3125
3128
  return {
3126
3129
  parseMarkdown: (u, d) => {
3127
3130
  const f = { ...s, ...u.attributes };
3128
- return d.createNode(t, f, []);
3131
+ return d.createNode(e, f, []);
3129
3132
  },
3130
3133
  markdownTokenizer: {
3131
- name: t,
3134
+ name: e,
3132
3135
  level: "block",
3133
3136
  start(u) {
3134
3137
  var d;
@@ -3142,7 +3145,7 @@ function Fr(e) {
3142
3145
  const h = m[1] || "", g = r(h);
3143
3146
  if (!i.find((k) => !(k in g)))
3144
3147
  return {
3145
- type: t,
3148
+ type: e,
3146
3149
  raw: m[0],
3147
3150
  attributes: g
3148
3151
  };
@@ -3154,17 +3157,17 @@ function Fr(e) {
3154
3157
  }
3155
3158
  };
3156
3159
  }
3157
- function Lr(e) {
3160
+ function Lr(t) {
3158
3161
  const {
3159
- nodeName: t,
3162
+ nodeName: e,
3160
3163
  name: n,
3161
3164
  getContent: r,
3162
- parseAttributes: o = xt,
3163
- serializeAttributes: s = St,
3165
+ parseAttributes: o = St,
3166
+ serializeAttributes: s = Et,
3164
3167
  defaultAttributes: i = {},
3165
3168
  content: c = "block",
3166
3169
  allowedAttributes: a
3167
- } = e, l = n || t, u = (d) => {
3170
+ } = t, l = n || e, u = (d) => {
3168
3171
  if (!a)
3169
3172
  return d;
3170
3173
  const f = {};
@@ -3180,10 +3183,10 @@ function Lr(e) {
3180
3183
  p = typeof h == "string" ? [{ type: "text", text: h }] : h;
3181
3184
  } else c === "block" ? p = f.parseChildren(d.tokens || []) : p = f.parseInline(d.tokens || []);
3182
3185
  const m = { ...i, ...d.attributes };
3183
- return f.createNode(t, m, p);
3186
+ return f.createNode(e, m, p);
3184
3187
  },
3185
3188
  markdownTokenizer: {
3186
- name: t,
3189
+ name: e,
3187
3190
  level: "block",
3188
3191
  start(d) {
3189
3192
  var f;
@@ -3227,7 +3230,7 @@ function Lr(e) {
3227
3230
  else
3228
3231
  R = p.inlineTokens(S);
3229
3232
  return {
3230
- type: t,
3233
+ type: e,
3231
3234
  raw: st,
3232
3235
  attributes: w,
3233
3236
  content: S,
@@ -3250,23 +3253,23 @@ ${g}
3250
3253
  }
3251
3254
  };
3252
3255
  }
3253
- function Vr(e) {
3254
- if (!e.trim())
3256
+ function Vr(t) {
3257
+ if (!t.trim())
3255
3258
  return {};
3256
- const t = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
3257
- let r = n.exec(e);
3259
+ const e = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
3260
+ let r = n.exec(t);
3258
3261
  for (; r !== null; ) {
3259
3262
  const [, o, s, i] = r;
3260
- t[o] = s || i, r = n.exec(e);
3263
+ e[o] = s || i, r = n.exec(t);
3261
3264
  }
3262
- return t;
3265
+ return e;
3263
3266
  }
3264
- function Hr(e) {
3265
- return Object.entries(e).filter(([, t]) => t != null).map(([t, n]) => `${t}="${n}"`).join(" ");
3267
+ function Hr(t) {
3268
+ return Object.entries(t).filter(([, e]) => e != null).map(([e, n]) => `${e}="${n}"`).join(" ");
3266
3269
  }
3267
- function Ur(e) {
3270
+ function Ur(t) {
3268
3271
  const {
3269
- nodeName: t,
3272
+ nodeName: e,
3270
3273
  name: n,
3271
3274
  getContent: r,
3272
3275
  parseAttributes: o = Vr,
@@ -3274,7 +3277,7 @@ function Ur(e) {
3274
3277
  defaultAttributes: i = {},
3275
3278
  selfClosing: c = !1,
3276
3279
  allowedAttributes: a
3277
- } = e, l = n || t, u = (f) => {
3280
+ } = t, l = n || e, u = (f) => {
3278
3281
  if (!a)
3279
3282
  return f;
3280
3283
  const p = {};
@@ -3292,12 +3295,12 @@ function Ur(e) {
3292
3295
  parseMarkdown: (f, p) => {
3293
3296
  const m = { ...i, ...f.attributes };
3294
3297
  if (c)
3295
- return p.createNode(t, m);
3298
+ return p.createNode(e, m);
3296
3299
  const h = r ? r(f) : f.content || "";
3297
- return h ? p.createNode(t, m, [p.createTextNode(h)]) : p.createNode(t, m, []);
3300
+ return h ? p.createNode(e, m, [p.createTextNode(h)]) : p.createNode(e, m, []);
3298
3301
  },
3299
3302
  markdownTokenizer: {
3300
- name: t,
3303
+ name: e,
3301
3304
  level: "inline",
3302
3305
  start(f) {
3303
3306
  const p = c ? new RegExp(`\\[${d}\\s*[^\\]]*\\]`) : new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`), m = f.match(p), h = m?.index;
@@ -3317,7 +3320,7 @@ function Ur(e) {
3317
3320
  }
3318
3321
  const w = o(k.trim());
3319
3322
  return {
3320
- type: t,
3323
+ type: e,
3321
3324
  raw: g[0],
3322
3325
  content: v.trim(),
3323
3326
  attributes: w
@@ -3332,14 +3335,14 @@ function Ur(e) {
3332
3335
  }
3333
3336
  };
3334
3337
  }
3335
- function Wr(e, t, n) {
3338
+ function Wr(t, e, n) {
3336
3339
  var r, o, s, i;
3337
- const c = e.split(`
3340
+ const c = t.split(`
3338
3341
  `), a = [];
3339
3342
  let l = "", u = 0;
3340
- const d = t.baseIndentSize || 2;
3343
+ const d = e.baseIndentSize || 2;
3341
3344
  for (; u < c.length; ) {
3342
- const f = c[u], p = f.match(t.itemPattern);
3345
+ const f = c[u], p = f.match(e.itemPattern);
3343
3346
  if (!p) {
3344
3347
  if (a.length > 0)
3345
3348
  break;
@@ -3350,7 +3353,7 @@ function Wr(e, t, n) {
3350
3353
  } else
3351
3354
  return;
3352
3355
  }
3353
- const m = t.extractItemData(p), { indentLevel: h, mainContent: g } = m;
3356
+ const m = e.extractItemData(p), { indentLevel: h, mainContent: g } = m;
3354
3357
  l = `${l}${f}
3355
3358
  `;
3356
3359
  const v = [g];
@@ -3378,9 +3381,9 @@ function Wr(e, t, n) {
3378
3381
  if (w.length > 0) {
3379
3382
  const y = w.map((S) => S.slice(h + d)).join(`
3380
3383
  `);
3381
- y.trim() && (t.customNestedParser ? k = t.customNestedParser(y) : k = n.blockTokens(y));
3384
+ y.trim() && (e.customNestedParser ? k = e.customNestedParser(y) : k = n.blockTokens(y));
3382
3385
  }
3383
- const M = t.createToken(m, k);
3386
+ const M = e.createToken(m, k);
3384
3387
  a.push(M);
3385
3388
  }
3386
3389
  if (a.length !== 0)
@@ -3389,23 +3392,23 @@ function Wr(e, t, n) {
3389
3392
  raw: l
3390
3393
  };
3391
3394
  }
3392
- function qr(e, t, n, r) {
3393
- if (!e || !Array.isArray(e.content))
3395
+ function qr(t, e, n, r) {
3396
+ if (!t || !Array.isArray(t.content))
3394
3397
  return "";
3395
- const o = typeof n == "function" ? n(r) : n, [s, ...i] = e.content, c = t.renderChildren([s]), a = [`${o}${c}`];
3398
+ const o = typeof n == "function" ? n(r) : n, [s, ...i] = t.content, c = e.renderChildren([s]), a = [`${o}${c}`];
3396
3399
  return i && i.length > 0 && i.forEach((l) => {
3397
- const u = t.renderChildren([l]);
3400
+ const u = e.renderChildren([l]);
3398
3401
  if (u) {
3399
3402
  const d = u.split(`
3400
- `).map((f) => f ? t.indent(f) : "").join(`
3403
+ `).map((f) => f ? e.indent(f) : "").join(`
3401
3404
  `);
3402
3405
  a.push(d);
3403
3406
  }
3404
3407
  }), a.join(`
3405
3408
  `);
3406
3409
  }
3407
- function Kr(e, t, n = {}) {
3408
- const { state: r } = t, { doc: o, tr: s } = r, i = e;
3410
+ function Kr(t, e, n = {}) {
3411
+ const { state: r } = e, { doc: o, tr: s } = r, i = t;
3409
3412
  o.descendants((c, a) => {
3410
3413
  const l = s.mapping.map(a), u = s.mapping.map(a) + c.nodeSize;
3411
3414
  let d = null;
@@ -3419,15 +3422,15 @@ function Kr(e, t, n = {}) {
3419
3422
  if (Object.keys(n).forEach((p) => {
3420
3423
  n[p] !== d.attrs[p] && (f = !0);
3421
3424
  }), f) {
3422
- const p = e.type.create({
3423
- ...e.attrs,
3425
+ const p = t.type.create({
3426
+ ...t.attrs,
3424
3427
  ...n
3425
3428
  });
3426
- s.removeMark(l, u, e.type), s.addMark(l, u, p);
3429
+ s.removeMark(l, u, t.type), s.addMark(l, u, p);
3427
3430
  }
3428
- }), s.docChanged && t.view.dispatch(s);
3431
+ }), s.docChanged && e.view.dispatch(s);
3429
3432
  }
3430
- var lo = class fe extends Mt {
3433
+ var uo = class fe extends xt {
3431
3434
  constructor() {
3432
3435
  super(...arguments), this.type = "node";
3433
3436
  }
@@ -3435,45 +3438,45 @@ var lo = class fe extends Mt {
3435
3438
  * Create a new Node instance
3436
3439
  * @param config - Node configuration object or a function that returns a configuration object
3437
3440
  */
3438
- static create(t = {}) {
3439
- const n = typeof t == "function" ? t() : t;
3441
+ static create(e = {}) {
3442
+ const n = typeof e == "function" ? e() : e;
3440
3443
  return new fe(n);
3441
3444
  }
3442
- configure(t) {
3443
- return super.configure(t);
3445
+ configure(e) {
3446
+ return super.configure(e);
3444
3447
  }
3445
- extend(t) {
3446
- const n = typeof t == "function" ? t() : t;
3448
+ extend(e) {
3449
+ const n = typeof e == "function" ? e() : e;
3447
3450
  return super.extend(n);
3448
3451
  }
3449
3452
  };
3450
- function uo(e) {
3453
+ function fo(t) {
3451
3454
  return new $r({
3452
- find: e.find,
3453
- handler: ({ state: t, range: n, match: r, pasteEvent: o }) => {
3454
- const s = x(e.getAttributes, void 0, r, o);
3455
+ find: t.find,
3456
+ handler: ({ state: e, range: n, match: r, pasteEvent: o }) => {
3457
+ const s = x(t.getAttributes, void 0, r, o);
3455
3458
  if (s === !1 || s === null)
3456
3459
  return null;
3457
- const { tr: i } = t, c = r[r.length - 1], a = r[0];
3460
+ const { tr: i } = e, c = r[r.length - 1], a = r[0];
3458
3461
  let l = n.to;
3459
3462
  if (c) {
3460
3463
  const u = a.search(/\S/), d = n.from + a.indexOf(c), f = d + c.length;
3461
- if (Zt(n.from, n.to, t.doc).filter((m) => m.mark.type.excluded.find((g) => g === e.type && g !== m.mark.type)).filter((m) => m.to > d).length)
3464
+ if (Zt(n.from, n.to, e.doc).filter((m) => m.mark.type.excluded.find((g) => g === t.type && g !== m.mark.type)).filter((m) => m.to > d).length)
3462
3465
  return null;
3463
- f < n.to && i.delete(f, n.to), d > n.from && i.delete(n.from + u, d), l = n.from + u + c.length, i.addMark(n.from + u, l, e.type.create(s || {})), i.removeStoredMark(e.type);
3466
+ f < n.to && i.delete(f, n.to), d > n.from && i.delete(n.from + u, d), l = n.from + u + c.length, i.addMark(n.from + u, l, t.type.create(s || {})), i.removeStoredMark(t.type);
3464
3467
  }
3465
3468
  }
3466
3469
  });
3467
3470
  }
3468
3471
  export {
3469
3472
  tt as CommandManager,
3470
- so as Editor,
3471
- Mt as Extendable,
3473
+ io as Editor,
3474
+ xt as Extendable,
3472
3475
  N as Extension,
3473
- wt as InputRule,
3476
+ Mt as InputRule,
3474
3477
  Qt as MappablePosition,
3475
3478
  Cr as Mark,
3476
- lo as Node,
3479
+ uo as Node,
3477
3480
  Or as NodePos,
3478
3481
  $r as PasteRule,
3479
3482
  x as callOrReturn,
@@ -3488,22 +3491,22 @@ export {
3488
3491
  V as createNodeFromContent,
3489
3492
  _r as createStyleTag,
3490
3493
  Fn as defaultBlockAt,
3491
- At as deleteProps,
3494
+ Ct as deleteProps,
3492
3495
  W as elementFromString,
3493
3496
  jr as extensions,
3494
3497
  eo as findChildrenInRange,
3495
3498
  qn as findDuplicates,
3496
3499
  nt as findParentNode,
3497
3500
  Ln as findParentNodeClosestToPos,
3498
- vt as flattenExtensions,
3501
+ bt as flattenExtensions,
3499
3502
  Un as fromString,
3500
3503
  Zn as getAttributes,
3501
3504
  Wt as getAttributesFromExtensions,
3502
3505
  Yn as getChangedRanges,
3503
3506
  b as getExtensionField,
3504
- bt as getHTMLFromFragment,
3507
+ kt as getHTMLFromFragment,
3505
3508
  Ht as getMarkAttributes,
3506
- ht as getMarkRange,
3509
+ gt as getMarkRange,
3507
3510
  B as getMarkType,
3508
3511
  Zt as getMarksBetween,
3509
3512
  no as getNodeAtPosition,
@@ -3519,33 +3522,34 @@ export {
3519
3522
  Xn as getTextContentFromNodes,
3520
3523
  Jt as getTextSerializersFromSchema,
3521
3524
  er as getUpdatedPosition,
3522
- Ct as injectExtensionAttributesToParseRule,
3525
+ Pt as injectExtensionAttributesToParseRule,
3523
3526
  Tr as inputRulesPlugin,
3524
3527
  tr as isActive,
3525
3528
  ln as isAndroid,
3526
3529
  ro as isAtEndOfNode,
3527
3530
  oo as isAtStartOfNode,
3528
3531
  Vn as isEmptyObject,
3529
- Nt as isExtensionRulesEnabled,
3532
+ It as isExtensionRulesEnabled,
3530
3533
  Ut as isFunction,
3531
- It as isList,
3534
+ Bt as isList,
3532
3535
  Vt as isMacOS,
3533
3536
  ut as isMarkActive,
3534
3537
  H as isNodeActive,
3535
- yt as isNodeEmpty,
3538
+ wt as isNodeEmpty,
3539
+ so as isNodeSelection,
3536
3540
  Pr as isNumber,
3537
3541
  K as isPlainObject,
3538
- mt as isRegExp,
3542
+ ht as isRegExp,
3539
3543
  zt as isTextSelection,
3540
- gt as isiOS,
3541
- io as markInputRule,
3542
- uo as markPasteRule,
3544
+ vt as isiOS,
3545
+ ao as markInputRule,
3546
+ fo as markPasteRule,
3543
3547
  zr as markdown,
3544
3548
  Hn as mergeAttributes,
3545
3549
  Yt as mergeDeep,
3546
3550
  _ as minMax,
3547
3551
  G as objectIncludes,
3548
- xt as parseAttributes,
3552
+ St as parseAttributes,
3549
3553
  Wr as parseIndentedBlocks,
3550
3554
  Rr as pasteRulesPlugin,
3551
3555
  Qn as removeDuplicates,
@@ -3553,10 +3557,10 @@ export {
3553
3557
  qt as resolveExtensions,
3554
3558
  Ft as resolveFocusPosition,
3555
3559
  pn as selectionToInsertionEnd,
3556
- St as serializeAttributes,
3557
- kt as sortExtensions,
3560
+ Et as serializeAttributes,
3561
+ yt as sortExtensions,
3558
3562
  L as splitExtensions,
3559
- ao as textblockTypeInputRule,
3563
+ co as textblockTypeInputRule,
3560
3564
  Kr as updateMarkViewAttributes,
3561
- co as wrappingInputRule
3565
+ lo as wrappingInputRule
3562
3566
  };