@caspeco/casper-ui-library 10.0.2 → 10.0.4

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.
@@ -1,13 +1,13 @@
1
- import { findWrapping as ye, canJoin as bt, Transform as ke, RemoveMarkStep as we, liftTarget as Me, joinPoint as Lt, canSplit as X, ReplaceStep as xe, ReplaceAroundStep as Se } from "../../../prosemirror-transform/dist/index.js";
2
- import { createParagraphNear as Ee, exitCode as Te, joinUp as Ae, joinDown as Ce, joinBackward as Pe, joinForward as $e, joinTextblockBackward as Ne, joinTextblockForward as Ie, lift as Re, liftEmptyBlock as Oe, newlineInCode as je, selectNodeBackward as Be, selectNodeForward as De, selectParentNode as _e, selectTextblockEnd as Le, selectTextblockStart as ze, setBlockType as Ct, wrapIn as Fe } from "../../../prosemirror-commands/dist/index.js";
3
- import { NodeSelection as st, EditorState as Ve, Selection as F, TextSelection as R, Plugin as O, PluginKey as _, AllSelection as He } from "../../../prosemirror-state/dist/index.js";
4
- import { Node as zt, DOMParser as tt, DOMSerializer as We, Schema as Ft, Fragment as D, Slice as Ue } from "../../../prosemirror-model/dist/index.js";
5
- import { liftListItem as qe, sinkListItem as Je, wrapInList as Ke } from "../../../prosemirror-schema-list/dist/index.js";
6
- import { EditorView as Qe } from "../../../prosemirror-view/dist/index.js";
7
- import { keymap as Ze } from "../../../prosemirror-keymap/dist/index.js";
8
- var Ge = Object.defineProperty, yt = (t, e) => {
1
+ import { findWrapping as we, canJoin as bt, Transform as Me, RemoveMarkStep as xe, liftTarget as Se, joinPoint as zt, canSplit as X, ReplaceStep as Ee, ReplaceAroundStep as Te } from "../../../prosemirror-transform/dist/index.js";
2
+ import { createParagraphNear as Ce, exitCode as Ae, joinUp as Pe, joinDown as $e, joinBackward as Ne, joinForward as Ie, joinTextblockBackward as Re, joinTextblockForward as Oe, lift as je, liftEmptyBlock as Be, newlineInCode as De, selectNodeBackward as _e, selectNodeForward as Le, selectParentNode as ze, selectTextblockEnd as Fe, selectTextblockStart as Ve, setBlockType as At, wrapIn as He } from "../../../prosemirror-commands/dist/index.js";
3
+ import { NodeSelection as st, EditorState as We, Selection as F, TextSelection as R, Plugin as O, PluginKey as _, AllSelection as Ue } from "../../../prosemirror-state/dist/index.js";
4
+ import { Node as Ft, DOMParser as tt, DOMSerializer as qe, Schema as Vt, Fragment as D, Slice as Je } from "../../../prosemirror-model/dist/index.js";
5
+ import { liftListItem as Ke, sinkListItem as Qe, wrapInList as Ge } from "../../../prosemirror-schema-list/dist/index.js";
6
+ import { EditorView as Ze } from "../../../prosemirror-view/dist/index.js";
7
+ import { keymap as Ye } from "../../../prosemirror-keymap/dist/index.js";
8
+ var Xe = Object.defineProperty, yt = (t, e) => {
9
9
  for (var n in e)
10
- Ge(t, n, { get: e[n], enumerable: !0 });
10
+ Xe(t, n, { get: e[n], enumerable: !0 });
11
11
  };
12
12
  function it(t) {
13
13
  const { state: e, transaction: n } = t;
@@ -101,73 +101,73 @@ var at = class {
101
101
  };
102
102
  return i;
103
103
  }
104
- }, Vt = {};
105
- yt(Vt, {
106
- blur: () => Ye,
107
- clearContent: () => Xe,
108
- clearNodes: () => tn,
109
- command: () => en,
110
- createParagraphNear: () => nn,
111
- cut: () => rn,
112
- deleteCurrentNode: () => on,
113
- deleteNode: () => sn,
114
- deleteRange: () => an,
115
- deleteSelection: () => un,
116
- enter: () => dn,
117
- exitCode: () => fn,
118
- extendMarkRange: () => pn,
119
- first: () => mn,
120
- focus: () => gn,
121
- forEach: () => vn,
122
- insertContent: () => bn,
123
- insertContentAt: () => wn,
124
- joinBackward: () => Sn,
125
- joinDown: () => xn,
126
- joinForward: () => En,
127
- joinItemBackward: () => Tn,
128
- joinItemForward: () => An,
129
- joinTextblockBackward: () => Cn,
130
- joinTextblockForward: () => Pn,
131
- joinUp: () => Mn,
132
- keyboardShortcut: () => Nn,
133
- lift: () => In,
134
- liftEmptyBlock: () => Rn,
135
- liftListItem: () => On,
136
- newlineInCode: () => jn,
137
- resetAttributes: () => Bn,
138
- scrollIntoView: () => Dn,
139
- selectAll: () => _n,
140
- selectNodeBackward: () => Ln,
141
- selectNodeForward: () => zn,
142
- selectParentNode: () => Fn,
143
- selectTextblockEnd: () => Vn,
144
- selectTextblockStart: () => Hn,
145
- setContent: () => Wn,
146
- setMark: () => ur,
147
- setMeta: () => dr,
148
- setNode: () => fr,
149
- setNodeSelection: () => pr,
150
- setTextDirection: () => mr,
151
- setTextSelection: () => hr,
152
- sinkListItem: () => gr,
153
- splitBlock: () => vr,
154
- splitListItem: () => br,
155
- toggleList: () => kr,
156
- toggleMark: () => wr,
157
- toggleNode: () => Mr,
158
- toggleWrap: () => xr,
159
- undoInputRule: () => Sr,
160
- unsetAllMarks: () => Er,
161
- unsetMark: () => Tr,
162
- unsetTextDirection: () => Ar,
163
- updateAttributes: () => Cr,
164
- wrapIn: () => Pr,
165
- wrapInList: () => $r
104
+ }, Ht = {};
105
+ yt(Ht, {
106
+ blur: () => tn,
107
+ clearContent: () => en,
108
+ clearNodes: () => nn,
109
+ command: () => rn,
110
+ createParagraphNear: () => on,
111
+ cut: () => sn,
112
+ deleteCurrentNode: () => an,
113
+ deleteNode: () => cn,
114
+ deleteRange: () => ln,
115
+ deleteSelection: () => fn,
116
+ enter: () => pn,
117
+ exitCode: () => mn,
118
+ extendMarkRange: () => hn,
119
+ first: () => gn,
120
+ focus: () => bn,
121
+ forEach: () => yn,
122
+ insertContent: () => kn,
123
+ insertContentAt: () => xn,
124
+ joinBackward: () => Tn,
125
+ joinDown: () => En,
126
+ joinForward: () => Cn,
127
+ joinItemBackward: () => An,
128
+ joinItemForward: () => Pn,
129
+ joinTextblockBackward: () => $n,
130
+ joinTextblockForward: () => Nn,
131
+ joinUp: () => Sn,
132
+ keyboardShortcut: () => Rn,
133
+ lift: () => On,
134
+ liftEmptyBlock: () => jn,
135
+ liftListItem: () => Bn,
136
+ newlineInCode: () => Dn,
137
+ resetAttributes: () => _n,
138
+ scrollIntoView: () => Ln,
139
+ selectAll: () => zn,
140
+ selectNodeBackward: () => Fn,
141
+ selectNodeForward: () => Vn,
142
+ selectParentNode: () => Hn,
143
+ selectTextblockEnd: () => Wn,
144
+ selectTextblockStart: () => Un,
145
+ setContent: () => qn,
146
+ setMark: () => fr,
147
+ setMeta: () => pr,
148
+ setNode: () => mr,
149
+ setNodeSelection: () => hr,
150
+ setTextDirection: () => gr,
151
+ setTextSelection: () => vr,
152
+ sinkListItem: () => br,
153
+ splitBlock: () => yr,
154
+ splitListItem: () => kr,
155
+ toggleList: () => Mr,
156
+ toggleMark: () => xr,
157
+ toggleNode: () => Sr,
158
+ toggleWrap: () => Er,
159
+ undoInputRule: () => Tr,
160
+ unsetAllMarks: () => Cr,
161
+ unsetMark: () => Ar,
162
+ unsetTextDirection: () => Pr,
163
+ updateAttributes: () => $r,
164
+ wrapIn: () => Nr,
165
+ wrapInList: () => Ir
166
166
  });
167
- var Ye = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
167
+ var tn = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
168
168
  var n;
169
169
  t.isDestroyed || (e.dom.blur(), (n = window?.getSelection()) == null || n.removeAllRanges());
170
- }), !0), Xe = (t = !0) => ({ commands: e }) => e.setContent("", { emitUpdate: t }), tn = () => ({ state: t, tr: e, dispatch: n }) => {
170
+ }), !0), en = (t = !0) => ({ commands: e }) => e.setContent("", { emitUpdate: t }), nn = () => ({ state: t, tr: e, dispatch: n }) => {
171
171
  const { selection: r } = e, { ranges: o } = r;
172
172
  return n && o.forEach(({ $from: s, $to: i }) => {
173
173
  t.doc.nodesBetween(s.pos, i.pos, (a, c) => {
@@ -176,7 +176,7 @@ var Ye = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
176
176
  const { doc: l, mapping: f } = e, u = l.resolve(f.map(c)), p = l.resolve(f.map(c + a.nodeSize)), d = u.blockRange(p);
177
177
  if (!d)
178
178
  return;
179
- const h = Me(d);
179
+ const h = Se(d);
180
180
  if (a.type.isTextblock) {
181
181
  const { defaultType: m } = u.parent.contentMatchAt(u.index());
182
182
  e.setNodeMarkup(d.start, m);
@@ -184,12 +184,12 @@ var Ye = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
184
184
  (h || h === 0) && e.lift(d, h);
185
185
  });
186
186
  }), !0;
187
- }, en = (t) => (e) => t(e), nn = () => ({ state: t, dispatch: e }) => Ee(t, e), rn = (t, e) => ({ editor: n, tr: r }) => {
187
+ }, rn = (t) => (e) => t(e), on = () => ({ state: t, dispatch: e }) => Ce(t, e), sn = (t, e) => ({ editor: n, tr: r }) => {
188
188
  const { state: o } = n, s = o.doc.slice(t.from, t.to);
189
189
  r.deleteRange(t.from, t.to);
190
190
  const i = r.mapping.map(e);
191
191
  return r.insert(i, s.content), r.setSelection(new R(r.doc.resolve(Math.max(i - 1, 0)))), !0;
192
- }, on = () => ({ tr: t, dispatch: e }) => {
192
+ }, an = () => ({ tr: t, dispatch: e }) => {
193
193
  const { selection: n } = t, r = n.$anchor.node();
194
194
  if (r.content.size > 0)
195
195
  return !1;
@@ -214,7 +214,7 @@ function T(t, e) {
214
214
  }
215
215
  return t;
216
216
  }
217
- var sn = (t) => ({ tr: e, state: n, dispatch: r }) => {
217
+ var cn = (t) => ({ tr: e, state: n, dispatch: r }) => {
218
218
  const o = T(t, n.schema), s = e.selection.$anchor;
219
219
  for (let i = s.depth; i > 0; i -= 1)
220
220
  if (s.node(i).type === o) {
@@ -225,24 +225,24 @@ var sn = (t) => ({ tr: e, state: n, dispatch: r }) => {
225
225
  return !0;
226
226
  }
227
227
  return !1;
228
- }, an = (t) => ({ tr: e, dispatch: n }) => {
228
+ }, ln = (t) => ({ tr: e, dispatch: n }) => {
229
229
  const { from: r, to: o } = t;
230
230
  return n && e.delete(r, o), !0;
231
- }, cn = (t) => t.content ? /^text(\*|\+)/.test(t.content) : !1, Pt = (t, e, n) => {
231
+ }, un = (t) => t.content ? /^text(\*|\+)/.test(t.content) : !1, Pt = (t, e, n) => {
232
232
  if (!t.parent.isInline || n === "left" && t.pos > t.start() || n === "right" && t.pos < t.end())
233
233
  return t.pos;
234
234
  const r = e.nodes[t.parent.type.name].spec;
235
- return cn(r) ? n === "left" ? t.start() - 1 : t.end() + 1 : t.pos;
236
- }, ln = (t, e, n) => {
235
+ return un(r) ? n === "left" ? t.start() - 1 : t.end() + 1 : t.pos;
236
+ }, dn = (t, e, n) => {
237
237
  const r = Pt(t, n, "left"), o = Pt(e, n, "right");
238
238
  return { from: r, to: o };
239
- }, un = () => ({ state: t, dispatch: e }) => {
239
+ }, fn = () => ({ state: t, dispatch: e }) => {
240
240
  const { $from: n, $to: r } = t.selection;
241
241
  if (t.selection.empty)
242
242
  return !1;
243
- const { from: o, to: s } = ln(n, r, t.schema);
243
+ const { from: o, to: s } = dn(n, r, t.schema);
244
244
  return e && (t.tr.deleteRange(o, s).scrollIntoView(), e(t.tr)), !0;
245
- }, dn = () => ({ commands: t }) => t.keyboardShortcut("Enter"), fn = () => ({ state: t, dispatch: e }) => Te(t, e);
245
+ }, pn = () => ({ commands: t }) => t.keyboardShortcut("Enter"), mn = () => ({ state: t, dispatch: e }) => Ae(t, e);
246
246
  function kt(t) {
247
247
  return Object.prototype.toString.call(t) === "[object RegExp]";
248
248
  }
@@ -250,7 +250,7 @@ function nt(t, e, n = { strict: !0 }) {
250
250
  const r = Object.keys(e);
251
251
  return r.length ? r.every((o) => n.strict ? e[o] === t[o] : kt(e[o]) ? e[o].test(t[o]) : e[o] === t[o]) : !0;
252
252
  }
253
- function Ht(t, e, n = {}) {
253
+ function Wt(t, e, n = {}) {
254
254
  return t.find((r) => r.type === e && nt(
255
255
  // Only check equality for the attributes that are provided
256
256
  Object.fromEntries(Object.keys(n).map((o) => [o, r.attrs[o]])),
@@ -258,7 +258,7 @@ function Ht(t, e, n = {}) {
258
258
  ));
259
259
  }
260
260
  function $t(t, e, n = {}) {
261
- return !!Ht(t, e, n);
261
+ return !!Wt(t, e, n);
262
262
  }
263
263
  function wt(t, e, n) {
264
264
  if (!t || !e)
@@ -270,7 +270,7 @@ function wt(t, e, n) {
270
270
  const l = r.node.marks.find((f) => f.type === e);
271
271
  l && (n = l.attrs);
272
272
  }
273
- if (!Ht([...r.node.marks], e, n))
273
+ if (!Wt([...r.node.marks], e, n))
274
274
  return;
275
275
  let s = r.index, i = t.start() + r.offset, a = s + 1, c = i + r.node.nodeSize;
276
276
  for (; s > 0 && $t([...t.parent.child(s - 1).marks], e, n); )
@@ -292,7 +292,7 @@ function B(t, e) {
292
292
  }
293
293
  return t;
294
294
  }
295
- var pn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
295
+ var hn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
296
296
  const s = B(t, r.schema), { doc: i, selection: a } = n, { $from: c, from: l, to: f } = a;
297
297
  if (o) {
298
298
  const u = wt(c, s, e);
@@ -302,20 +302,20 @@ var pn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
302
302
  }
303
303
  }
304
304
  return !0;
305
- }, mn = (t) => (e) => {
305
+ }, gn = (t) => (e) => {
306
306
  const n = typeof t == "function" ? t(e) : t;
307
307
  for (let r = 0; r < n.length; r += 1)
308
308
  if (n[r](e))
309
309
  return !0;
310
310
  return !1;
311
311
  };
312
- function Wt(t) {
312
+ function Ut(t) {
313
313
  return t instanceof R;
314
314
  }
315
315
  function z(t = 0, e = 0, n = 0) {
316
316
  return Math.min(Math.max(t, e), n);
317
317
  }
318
- function Ut(t, e = null) {
318
+ function qt(t, e = null) {
319
319
  if (!e)
320
320
  return null;
321
321
  const n = F.atStart(t), r = F.atEnd(t);
@@ -343,16 +343,16 @@ function rt() {
343
343
  ) || // iPad on iOS 13 detection
344
344
  navigator.userAgent.includes("Mac") && "ontouchend" in document;
345
345
  }
346
- function hn() {
346
+ function vn() {
347
347
  return typeof navigator < "u" ? /^((?!chrome|android).)*safari/i.test(navigator.userAgent) : !1;
348
348
  }
349
- var gn = (t = null, e = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
349
+ var bn = (t = null, e = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
350
350
  e = {
351
351
  scrollIntoView: !0,
352
352
  ...e
353
353
  };
354
354
  const i = () => {
355
- (rt() || Nt()) && r.dom.focus(), hn() && !rt() && !Nt() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
355
+ (rt() || Nt()) && r.dom.focus(), vn() && !rt() && !Nt() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
356
356
  n.isDestroyed || (r.focus(), e?.scrollIntoView && n.commands.scrollIntoView());
357
357
  });
358
358
  };
@@ -362,19 +362,19 @@ var gn = (t = null, e = {}) => ({ editor: n, view: r, tr: o, dispatch: s }) => {
362
362
  } catch {
363
363
  return !1;
364
364
  }
365
- if (s && t === null && !Wt(n.state.selection))
365
+ if (s && t === null && !Ut(n.state.selection))
366
366
  return i(), !0;
367
- const a = Ut(o.doc, t) || n.state.selection, c = n.state.selection.eq(a);
367
+ const a = qt(o.doc, t) || n.state.selection, c = n.state.selection.eq(a);
368
368
  return s && (c || o.setSelection(a), c && o.storedMarks && o.setStoredMarks(o.storedMarks), i()), !0;
369
- }, vn = (t, e) => (n) => t.every((r, o) => e(r, { ...n, index: o })), bn = (t, e) => ({ tr: n, commands: r }) => r.insertContentAt(
369
+ }, yn = (t, e) => (n) => t.every((r, o) => e(r, { ...n, index: o })), kn = (t, e) => ({ tr: n, commands: r }) => r.insertContentAt(
370
370
  { from: n.selection.from, to: n.selection.to },
371
371
  t,
372
372
  e
373
- ), qt = (t) => {
373
+ ), Jt = (t) => {
374
374
  const e = t.childNodes;
375
375
  for (let n = e.length - 1; n >= 0; n -= 1) {
376
376
  const r = e[n];
377
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? t.removeChild(r) : r.nodeType === 1 && qt(r);
377
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? t.removeChild(r) : r.nodeType === 1 && Jt(r);
378
378
  }
379
379
  return t;
380
380
  };
@@ -384,10 +384,10 @@ function U(t) {
384
384
  "[tiptap error]: there is no window object available, so this function cannot be used"
385
385
  );
386
386
  const e = `<body>${t}</body>`, n = new window.DOMParser().parseFromString(e, "text/html").body;
387
- return qt(n);
387
+ return Jt(n);
388
388
  }
389
389
  function K(t, e, n) {
390
- if (t instanceof zt || t instanceof D)
390
+ if (t instanceof Ft || t instanceof D)
391
391
  return t;
392
392
  n = {
393
393
  slice: !0,
@@ -409,7 +409,7 @@ function K(t, e, n) {
409
409
  if (o) {
410
410
  if (n.errorOnInvalidContent) {
411
411
  let i = !1, a = "";
412
- const c = new Ft({
412
+ const c = new Vt({
413
413
  topNode: e.spec.topNode,
414
414
  marks: e.spec.marks,
415
415
  // Prosemirror's schemas are executed such that: the last to execute, matches last
@@ -443,12 +443,12 @@ function K(t, e, n) {
443
443
  }
444
444
  return K("", e, n);
445
445
  }
446
- function yn(t, e, n) {
446
+ function wn(t, e, n) {
447
447
  const r = t.steps.length - 1;
448
448
  if (r < e)
449
449
  return;
450
450
  const o = t.steps[r];
451
- if (!(o instanceof xe || o instanceof Se))
451
+ if (!(o instanceof Ee || o instanceof Te))
452
452
  return;
453
453
  const s = t.mapping.maps[r];
454
454
  let i = 0;
@@ -456,7 +456,7 @@ function yn(t, e, n) {
456
456
  i === 0 && (i = f);
457
457
  }), t.setSelection(F.near(t.doc.resolve(i), n));
458
458
  }
459
- var kn = (t) => !("type" in t), wn = (t, e, n) => ({ tr: r, dispatch: o, editor: s }) => {
459
+ var Mn = (t) => !("type" in t), xn = (t, e, n) => ({ tr: r, dispatch: o, editor: s }) => {
460
460
  var i;
461
461
  if (o) {
462
462
  n = {
@@ -497,7 +497,7 @@ var kn = (t) => !("type" in t), wn = (t, e, n) => ({ tr: r, dispatch: o, editor:
497
497
  return c(g), !1;
498
498
  }
499
499
  let { from: f, to: u } = typeof t == "number" ? { from: t, to: t } : { from: t.from, to: t.to }, p = !0, d = !0;
500
- if ((kn(a) ? a : [a]).forEach((g) => {
500
+ if ((Mn(a) ? a : [a]).forEach((g) => {
501
501
  g.check(), p = p ? g.isText && g.marks.length === 0 : !1, d = d ? g.isBlock : !1;
502
502
  }), f === u && d) {
503
503
  const { parent: g } = r.doc.resolve(f);
@@ -519,28 +519,28 @@ var kn = (t) => !("type" in t), wn = (t, e, n) => ({ tr: r, dispatch: o, editor:
519
519
  const g = r.doc.resolve(f), v = g.node(), y = g.parentOffset === 0, w = v.isText || v.isTextblock, M = v.content.size > 0;
520
520
  y && w && M && d && (f = Math.max(0, f - 1)), r.replaceWith(f, u, m);
521
521
  }
522
- n.updateSelection && yn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: f, text: m }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: f, text: m });
522
+ n.updateSelection && wn(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: f, text: m }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: f, text: m });
523
523
  }
524
524
  return !0;
525
- }, Mn = () => ({ state: t, dispatch: e }) => Ae(t, e), xn = () => ({ state: t, dispatch: e }) => Ce(t, e), Sn = () => ({ state: t, dispatch: e }) => Pe(t, e), En = () => ({ state: t, dispatch: e }) => $e(t, e), Tn = () => ({ state: t, dispatch: e, tr: n }) => {
525
+ }, Sn = () => ({ state: t, dispatch: e }) => Pe(t, e), En = () => ({ state: t, dispatch: e }) => $e(t, e), Tn = () => ({ state: t, dispatch: e }) => Ne(t, e), Cn = () => ({ state: t, dispatch: e }) => Ie(t, e), An = () => ({ state: t, dispatch: e, tr: n }) => {
526
526
  try {
527
- const r = Lt(t.doc, t.selection.$from.pos, -1);
527
+ const r = zt(t.doc, t.selection.$from.pos, -1);
528
528
  return r == null ? !1 : (n.join(r, 2), e && e(n), !0);
529
529
  } catch {
530
530
  return !1;
531
531
  }
532
- }, An = () => ({ state: t, dispatch: e, tr: n }) => {
532
+ }, Pn = () => ({ state: t, dispatch: e, tr: n }) => {
533
533
  try {
534
- const r = Lt(t.doc, t.selection.$from.pos, 1);
534
+ const r = zt(t.doc, t.selection.$from.pos, 1);
535
535
  return r == null ? !1 : (n.join(r, 2), e && e(n), !0);
536
536
  } catch {
537
537
  return !1;
538
538
  }
539
- }, Cn = () => ({ state: t, dispatch: e }) => Ne(t, e), Pn = () => ({ state: t, dispatch: e }) => Ie(t, e);
540
- function Jt() {
539
+ }, $n = () => ({ state: t, dispatch: e }) => Re(t, e), Nn = () => ({ state: t, dispatch: e }) => Oe(t, e);
540
+ function Kt() {
541
541
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
542
542
  }
543
- function $n(t) {
543
+ function In(t) {
544
544
  const e = t.split(/-(?!$)/);
545
545
  let n = e[e.length - 1];
546
546
  n === "Space" && (n = " ");
@@ -556,14 +556,14 @@ function $n(t) {
556
556
  else if (/^s(hift)?$/i.test(c))
557
557
  s = !0;
558
558
  else if (/^mod$/i.test(c))
559
- rt() || Jt() ? i = !0 : o = !0;
559
+ rt() || Kt() ? i = !0 : o = !0;
560
560
  else
561
561
  throw new Error(`Unrecognized modifier name: ${c}`);
562
562
  }
563
563
  return r && (n = `Alt-${n}`), o && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), s && (n = `Shift-${n}`), n;
564
564
  }
565
- var Nn = (t) => ({ editor: e, view: n, tr: r, dispatch: o }) => {
566
- const s = $n(t).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
565
+ var Rn = (t) => ({ editor: e, view: n, tr: r, dispatch: o }) => {
566
+ const s = In(t).split(/-(?!$)/), i = s.find((l) => !["Alt", "Ctrl", "Meta", "Shift"].includes(l)), a = new KeyboardEvent("keydown", {
567
567
  key: i === "Space" ? " " : i,
568
568
  altKey: s.includes("Alt"),
569
569
  ctrlKey: s.includes("Ctrl"),
@@ -594,13 +594,13 @@ function Q(t, e, n = {}) {
594
594
  const c = o - r, l = a.filter((u) => i ? i.name === u.node.type.name : !0).filter((u) => nt(u.node.attrs, n, { strict: !1 }));
595
595
  return s ? !!l.length : l.reduce((u, p) => u + p.to - p.from, 0) >= c;
596
596
  }
597
- var In = (t, e = {}) => ({ state: n, dispatch: r }) => {
597
+ var On = (t, e = {}) => ({ state: n, dispatch: r }) => {
598
598
  const o = T(t, n.schema);
599
- return Q(n, o, e) ? Re(n, r) : !1;
600
- }, Rn = () => ({ state: t, dispatch: e }) => Oe(t, e), On = (t) => ({ state: e, dispatch: n }) => {
599
+ return Q(n, o, e) ? je(n, r) : !1;
600
+ }, jn = () => ({ state: t, dispatch: e }) => Be(t, e), Bn = (t) => ({ state: e, dispatch: n }) => {
601
601
  const r = T(t, e.schema);
602
- return qe(r)(e, n);
603
- }, jn = () => ({ state: t, dispatch: e }) => je(t, e);
602
+ return Ke(r)(e, n);
603
+ }, Dn = () => ({ state: t, dispatch: e }) => De(t, e);
604
604
  function ct(t, e) {
605
605
  return e.nodes[t] ? "node" : e.marks[t] ? "mark" : null;
606
606
  }
@@ -608,7 +608,7 @@ function It(t, e) {
608
608
  const n = typeof e == "string" ? [e] : e;
609
609
  return Object.keys(t).reduce((r, o) => (n.includes(o) || (r[o] = t[o]), r), {});
610
610
  }
611
- var Bn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
611
+ var _n = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
612
612
  let s = null, i = null;
613
613
  const a = ct(
614
614
  typeof t == "string" ? t : t.name,
@@ -629,13 +629,13 @@ var Bn = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
629
629
  });
630
630
  });
631
631
  }), c;
632
- }, Dn = () => ({ tr: t, dispatch: e }) => (e && t.scrollIntoView(), !0), _n = () => ({ tr: t, dispatch: e }) => {
632
+ }, Ln = () => ({ tr: t, dispatch: e }) => (e && t.scrollIntoView(), !0), zn = () => ({ tr: t, dispatch: e }) => {
633
633
  if (e) {
634
- const n = new He(t.doc);
634
+ const n = new Ue(t.doc);
635
635
  t.setSelection(n);
636
636
  }
637
637
  return !0;
638
- }, Ln = () => ({ state: t, dispatch: e }) => Be(t, e), zn = () => ({ state: t, dispatch: e }) => De(t, e), Fn = () => ({ state: t, dispatch: e }) => _e(t, e), Vn = () => ({ state: t, dispatch: e }) => Le(t, e), Hn = () => ({ state: t, dispatch: e }) => ze(t, e);
638
+ }, Fn = () => ({ state: t, dispatch: e }) => _e(t, e), Vn = () => ({ state: t, dispatch: e }) => Le(t, e), Hn = () => ({ state: t, dispatch: e }) => ze(t, e), Wn = () => ({ state: t, dispatch: e }) => Fe(t, e), Un = () => ({ state: t, dispatch: e }) => Ve(t, e);
639
639
  function gt(t, e, n = {}, r = {}) {
640
640
  return K(t, e, {
641
641
  slice: !1,
@@ -643,7 +643,7 @@ function gt(t, e, n = {}, r = {}) {
643
643
  errorOnInvalidContent: r.errorOnInvalidContent
644
644
  });
645
645
  }
646
- var Wn = (t, { errorOnInvalidContent: e, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands: a }) => {
646
+ var qn = (t, { errorOnInvalidContent: e, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: o, tr: s, dispatch: i, commands: a }) => {
647
647
  const { doc: c } = s;
648
648
  if (r.preserveWhitespace !== "full") {
649
649
  const l = gt(t, o.schema, r, {
@@ -656,7 +656,7 @@ var Wn = (t, { errorOnInvalidContent: e, emitUpdate: n = !0, parseOptions: r = {
656
656
  errorOnInvalidContent: e ?? o.options.enableContentCheck
657
657
  });
658
658
  };
659
- function Kt(t, e) {
659
+ function Qt(t, e) {
660
660
  const n = B(e, t.schema), { from: r, to: o, empty: s } = t.selection, i = [];
661
661
  s ? (t.storedMarks && i.push(...t.storedMarks), i.push(...t.selection.$head.marks())) : t.doc.nodesBetween(r, o, (c) => {
662
662
  i.push(...c.marks);
@@ -664,15 +664,15 @@ function Kt(t, e) {
664
664
  const a = i.find((c) => c.type.name === n.name);
665
665
  return a ? { ...a.attrs } : {};
666
666
  }
667
- function Un(t, e) {
668
- const n = new ke(t);
667
+ function Jn(t, e) {
668
+ const n = new Me(t);
669
669
  return e.forEach((r) => {
670
670
  r.steps.forEach((o) => {
671
671
  n.step(o);
672
672
  });
673
673
  }), n;
674
674
  }
675
- function qn(t) {
675
+ function Kn(t) {
676
676
  for (let e = 0; e < t.edgeCount; e += 1) {
677
677
  const { type: n } = t.edge(e);
678
678
  if (n.isTextblock && !n.hasRequiredAttrs())
@@ -680,7 +680,7 @@ function qn(t) {
680
680
  }
681
681
  return null;
682
682
  }
683
- function co(t, e, n) {
683
+ function uo(t, e, n) {
684
684
  const r = [];
685
685
  return t.nodesBetween(e.from, e.to, (o, s) => {
686
686
  n(o) && r.push({
@@ -689,7 +689,7 @@ function co(t, e, n) {
689
689
  });
690
690
  }), r;
691
691
  }
692
- function Jn(t, e) {
692
+ function Qn(t, e) {
693
693
  for (let n = t.depth; n > 0; n -= 1) {
694
694
  const r = t.node(n);
695
695
  if (e(r))
@@ -702,7 +702,7 @@ function Jn(t, e) {
702
702
  }
703
703
  }
704
704
  function lt(t) {
705
- return (e) => Jn(e.$from, t);
705
+ return (e) => Qn(e.$from, t);
706
706
  }
707
707
  function b(t, e, n) {
708
708
  return t.config[e] === void 0 && t.parent ? b(t.parent, e, n) : typeof t.config[e] == "function" ? t.config[e].bind({
@@ -725,16 +725,16 @@ function Mt(t) {
725
725
  }).flat(10);
726
726
  }
727
727
  function ut(t, e) {
728
- const n = We.fromSchema(e).serializeFragment(t), o = document.implementation.createHTMLDocument().createElement("div");
728
+ const n = qe.fromSchema(e).serializeFragment(t), o = document.implementation.createHTMLDocument().createElement("div");
729
729
  return o.appendChild(n), o.innerHTML;
730
730
  }
731
- function Qt(t) {
731
+ function Gt(t) {
732
732
  return typeof t == "function";
733
733
  }
734
734
  function x(t, e = void 0, ...n) {
735
- return Qt(t) ? e ? t.bind(e)(...n) : t(...n) : t;
735
+ return Gt(t) ? e ? t.bind(e)(...n) : t(...n) : t;
736
736
  }
737
- function Kn(t = {}) {
737
+ function Gn(t = {}) {
738
738
  return Object.keys(t).length === 0 && t.constructor === Object;
739
739
  }
740
740
  function V(t) {
@@ -807,7 +807,7 @@ function Zt(t) {
807
807
  });
808
808
  }), e;
809
809
  }
810
- function Qn(t) {
810
+ function Zn(t) {
811
811
  const e = [];
812
812
  let n = "", r = !1, o = !1, s = 0;
813
813
  const i = t.length;
@@ -840,7 +840,7 @@ function Qn(t) {
840
840
  return n && e.push(n), e;
841
841
  }
842
842
  function Rt(t) {
843
- const e = [], n = Qn(t || ""), r = n.length;
843
+ const e = [], n = Zn(t || ""), r = n.length;
844
844
  for (let o = 0; o < r; o += 1) {
845
845
  const s = n[o], i = s.indexOf(":");
846
846
  if (i === -1)
@@ -850,7 +850,7 @@ function Rt(t) {
850
850
  }
851
851
  return e;
852
852
  }
853
- function Zn(...t) {
853
+ function Yn(...t) {
854
854
  return t.filter((e) => !!e).reduce((e, n) => {
855
855
  const r = { ...e };
856
856
  return Object.entries(n).forEach(([o, s]) => {
@@ -877,9 +877,9 @@ function Zn(...t) {
877
877
  function ot(t, e) {
878
878
  return e.filter((n) => n.type === t.type.name).filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(t.attrs) || {} : {
879
879
  [n.name]: t.attrs[n.name]
880
- }).reduce((n, r) => Zn(n, r), {});
880
+ }).reduce((n, r) => Yn(n, r), {});
881
881
  }
882
- function Gn(t) {
882
+ function Xn(t) {
883
883
  return typeof t != "string" ? t : t.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(t) : t === "true" ? !0 : t === "false" ? !1 : t;
884
884
  }
885
885
  function Ot(t, e) {
@@ -890,7 +890,7 @@ function Ot(t, e) {
890
890
  if (r === !1)
891
891
  return !1;
892
892
  const o = e.reduce((s, i) => {
893
- const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : Gn(n.getAttribute(i.name));
893
+ const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : Xn(n.getAttribute(i.name));
894
894
  return a == null ? s : {
895
895
  ...s,
896
896
  [i.name]: a
@@ -903,7 +903,7 @@ function Ot(t, e) {
903
903
  function jt(t) {
904
904
  return Object.fromEntries(
905
905
  // @ts-ignore
906
- Object.entries(t).filter(([e, n]) => e === "attrs" && Kn(n) ? !1 : n != null)
906
+ Object.entries(t).filter(([e, n]) => e === "attrs" && Gn(n) ? !1 : n != null)
907
907
  );
908
908
  }
909
909
  function Bt(t) {
@@ -911,7 +911,7 @@ function Bt(t) {
911
911
  const r = {};
912
912
  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];
913
913
  }
914
- function Gt(t, e) {
914
+ function Yt(t, e) {
915
915
  var n;
916
916
  const r = Zt(t), { nodeExtensions: o, markExtensions: s } = V(t), i = (n = o.find((l) => b(l, "topNode"))) == null ? void 0 : n.name, a = Object.fromEntries(
917
917
  o.map((l) => {
@@ -1037,13 +1037,13 @@ function Gt(t, e) {
1037
1037
  })), [l.name, d];
1038
1038
  })
1039
1039
  );
1040
- return new Ft({
1040
+ return new Vt({
1041
1041
  topNode: i,
1042
1042
  nodes: a,
1043
1043
  marks: c
1044
1044
  });
1045
1045
  }
1046
- function Yn(t) {
1046
+ function tr(t) {
1047
1047
  const e = t.filter((n, r) => t.indexOf(n) !== r);
1048
1048
  return Array.from(new Set(e));
1049
1049
  }
@@ -1054,24 +1054,24 @@ function J(t) {
1054
1054
  });
1055
1055
  }
1056
1056
  function xt(t) {
1057
- const e = J(Mt(t)), n = Yn(e.map((r) => r.name));
1057
+ const e = J(Mt(t)), n = tr(e.map((r) => r.name));
1058
1058
  return n.length && console.warn(
1059
1059
  `[tiptap warn]: Duplicate extension names found: [${n.map((r) => `'${r}'`).join(", ")}]. This can lead to issues.`
1060
1060
  ), e;
1061
1061
  }
1062
- function Yt(t, e) {
1062
+ function Xt(t, e) {
1063
1063
  const n = xt(t);
1064
- return Gt(n, e);
1064
+ return Yt(n, e);
1065
1065
  }
1066
- function lo(t, e) {
1067
- const n = Yt(e), r = zt.fromJSON(n, t);
1066
+ function fo(t, e) {
1067
+ const n = Xt(e), r = Ft.fromJSON(n, t);
1068
1068
  return ut(r.content, n);
1069
1069
  }
1070
- function uo(t, e) {
1071
- const n = Yt(e), r = U(t);
1070
+ function po(t, e) {
1071
+ const n = Xt(e), r = U(t);
1072
1072
  return tt.fromSchema(n).parse(r).toJSON();
1073
1073
  }
1074
- function Xt(t, e, n) {
1074
+ function te(t, e, n) {
1075
1075
  const { from: r, to: o } = e, { blockSeparator: s = `
1076
1076
 
1077
1077
  `, textSerializers: i = {} } = n || {};
@@ -1091,19 +1091,19 @@ function Xt(t, e, n) {
1091
1091
  c.isText && (a += (p = c?.text) == null ? void 0 : p.slice(Math.max(r, l) - l, o - l));
1092
1092
  }), a;
1093
1093
  }
1094
- function Xn(t, e) {
1094
+ function er(t, e) {
1095
1095
  const n = {
1096
1096
  from: 0,
1097
1097
  to: t.content.size
1098
1098
  };
1099
- return Xt(t, n, e);
1099
+ return te(t, n, e);
1100
1100
  }
1101
- function te(t) {
1101
+ function ee(t) {
1102
1102
  return Object.fromEntries(
1103
1103
  Object.entries(t.nodes).filter(([, e]) => e.spec.toText).map(([e, n]) => [e, n.spec.toText])
1104
1104
  );
1105
1105
  }
1106
- function tr(t, e) {
1106
+ function nr(t, e) {
1107
1107
  const n = T(e, t.schema), { from: r, to: o } = t.selection, s = [];
1108
1108
  t.doc.nodesBetween(r, o, (a) => {
1109
1109
  s.push(a);
@@ -1111,25 +1111,25 @@ function tr(t, e) {
1111
1111
  const i = s.reverse().find((a) => a.type.name === n.name);
1112
1112
  return i ? { ...i.attrs } : {};
1113
1113
  }
1114
- function er(t, e) {
1114
+ function rr(t, e) {
1115
1115
  const n = ct(
1116
1116
  typeof e == "string" ? e : e.name,
1117
1117
  t.schema
1118
1118
  );
1119
- return n === "node" ? tr(t, e) : n === "mark" ? Kt(t, e) : {};
1119
+ return n === "node" ? nr(t, e) : n === "mark" ? Qt(t, e) : {};
1120
1120
  }
1121
- function nr(t, e = JSON.stringify) {
1121
+ function or(t, e = JSON.stringify) {
1122
1122
  const n = {};
1123
1123
  return t.filter((r) => {
1124
1124
  const o = e(r);
1125
1125
  return Object.prototype.hasOwnProperty.call(n, o) ? !1 : n[o] = !0;
1126
1126
  });
1127
1127
  }
1128
- function rr(t) {
1129
- const e = nr(t);
1128
+ function sr(t) {
1129
+ const e = or(t);
1130
1130
  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));
1131
1131
  }
1132
- function or(t) {
1132
+ function ir(t) {
1133
1133
  const { mapping: e, steps: n } = t, r = [];
1134
1134
  return e.maps.forEach((o, s) => {
1135
1135
  const i = [];
@@ -1156,9 +1156,9 @@ function or(t) {
1156
1156
  }
1157
1157
  });
1158
1158
  });
1159
- }), rr(r);
1159
+ }), sr(r);
1160
1160
  }
1161
- function ee(t, e, n) {
1161
+ function ne(t, e, n) {
1162
1162
  const r = [];
1163
1163
  return t === e ? n.resolve(t).marks().forEach((o) => {
1164
1164
  const s = n.resolve(t), i = wt(s, o.type);
@@ -1176,7 +1176,7 @@ function ee(t, e, n) {
1176
1176
  );
1177
1177
  }), r;
1178
1178
  }
1179
- var fo = (t, e, n, r = 20) => {
1179
+ var mo = (t, e, n, r = 20) => {
1180
1180
  const o = t.doc.resolve(n);
1181
1181
  let s = r, i = null;
1182
1182
  for (; s > 0 && i === null; ) {
@@ -1196,7 +1196,7 @@ function et(t, e, n) {
1196
1196
  })
1197
1197
  );
1198
1198
  }
1199
- var sr = (t, e = 500) => {
1199
+ var ar = (t, e = 500) => {
1200
1200
  let n = "";
1201
1201
  const r = t.parentOffset;
1202
1202
  return t.parent.nodesBetween(
@@ -1241,13 +1241,13 @@ function vt(t, e, n = {}) {
1241
1241
  const c = a.filter((u) => s ? s.name === u.mark.type.name : !0).filter((u) => nt(u.mark.attrs, n, { strict: !1 })).reduce((u, p) => u + p.to - p.from, 0), l = a.filter((u) => s ? u.mark.type !== s && u.mark.type.excludes(s) : !0).reduce((u, p) => u + p.to - p.from, 0);
1242
1242
  return (c > 0 ? c + l : c) >= i;
1243
1243
  }
1244
- function ir(t, e, n = {}) {
1244
+ function cr(t, e, n = {}) {
1245
1245
  if (!e)
1246
1246
  return Q(t, null, n) || vt(t, null, n);
1247
1247
  const r = ct(e, t.schema);
1248
1248
  return r === "node" ? Q(t, e, n) : r === "mark" ? vt(t, e, n) : !1;
1249
1249
  }
1250
- var po = (t, e) => {
1250
+ var ho = (t, e) => {
1251
1251
  const { $from: n, $to: r, $anchor: o } = t.selection;
1252
1252
  if (e) {
1253
1253
  const s = lt((a) => a.type.name === e)(t.selection);
@@ -1257,7 +1257,7 @@ var po = (t, e) => {
1257
1257
  return o.pos + 1 === i.end();
1258
1258
  }
1259
1259
  return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1260
- }, mo = (t) => {
1260
+ }, go = (t) => {
1261
1261
  const { $from: e, $to: n } = t.selection;
1262
1262
  return !(e.parentOffset > 0 || e.pos !== n.pos);
1263
1263
  };
@@ -1300,10 +1300,10 @@ function St(t, {
1300
1300
  }
1301
1301
  return !1;
1302
1302
  }
1303
- function ho(t) {
1303
+ function vo(t) {
1304
1304
  return t instanceof st;
1305
1305
  }
1306
- var ne = class re {
1306
+ var re = class oe {
1307
1307
  constructor(e) {
1308
1308
  this.position = e;
1309
1309
  }
@@ -1311,7 +1311,7 @@ var ne = class re {
1311
1311
  * Creates a MappablePosition from a JSON object.
1312
1312
  */
1313
1313
  static fromJSON(e) {
1314
- return new re(e.position);
1314
+ return new oe(e.position);
1315
1315
  }
1316
1316
  /**
1317
1317
  * Converts the MappablePosition to a JSON object.
@@ -1322,21 +1322,21 @@ var ne = class re {
1322
1322
  };
1323
1323
  }
1324
1324
  };
1325
- function ar(t, e) {
1325
+ function lr(t, e) {
1326
1326
  const n = e.mapping.mapResult(t.position);
1327
1327
  return {
1328
- position: new ne(n.pos),
1328
+ position: new re(n.pos),
1329
1329
  mapResult: n
1330
1330
  };
1331
1331
  }
1332
- function cr(t) {
1333
- return new ne(t);
1332
+ function ur(t) {
1333
+ return new re(t);
1334
1334
  }
1335
- function lr(t, e, n) {
1335
+ function dr(t, e, n) {
1336
1336
  var r;
1337
1337
  const { selection: o } = e;
1338
1338
  let s = null;
1339
- if (Wt(o) && (s = o.$cursor), s) {
1339
+ if (Ut(o) && (s = o.$cursor), s) {
1340
1340
  const a = (r = t.storedMarks) != null ? r : s.marks();
1341
1341
  return s.parent.type.allowsMarkType(n) && (!!n.isInSet(a) || !a.some((l) => l.type.excludes(n)));
1342
1342
  }
@@ -1354,11 +1354,11 @@ function lr(t, e, n) {
1354
1354
  }), l;
1355
1355
  });
1356
1356
  }
1357
- var ur = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1357
+ var fr = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1358
1358
  const { selection: s } = n, { empty: i, ranges: a } = s, c = B(t, r.schema);
1359
1359
  if (o)
1360
1360
  if (i) {
1361
- const l = Kt(r, c);
1361
+ const l = Qt(r, c);
1362
1362
  n.addStoredMark(
1363
1363
  c.create({
1364
1364
  ...l,
@@ -1382,18 +1382,18 @@ var ur = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1382
1382
  }) : n.addMark(h, m, c.create(e));
1383
1383
  });
1384
1384
  });
1385
- return lr(r, n, c);
1386
- }, dr = (t, e) => ({ tr: n }) => (n.setMeta(t, e), !0), fr = (t, e = {}) => ({ state: n, dispatch: r, chain: o }) => {
1385
+ return dr(r, n, c);
1386
+ }, pr = (t, e) => ({ tr: n }) => (n.setMeta(t, e), !0), mr = (t, e = {}) => ({ state: n, dispatch: r, chain: o }) => {
1387
1387
  const s = T(t, n.schema);
1388
1388
  let i;
1389
- return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands: a }) => Ct(s, { ...i, ...e })(n) ? !0 : a.clearNodes()).command(({ state: a }) => Ct(s, { ...i, ...e })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1390
- }, pr = (t) => ({ tr: e, dispatch: n }) => {
1389
+ return n.selection.$anchor.sameParent(n.selection.$head) && (i = n.selection.$anchor.parent.attrs), s.isTextblock ? o().command(({ commands: a }) => At(s, { ...i, ...e })(n) ? !0 : a.clearNodes()).command(({ state: a }) => At(s, { ...i, ...e })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1390
+ }, hr = (t) => ({ tr: e, dispatch: n }) => {
1391
1391
  if (n) {
1392
1392
  const { doc: r } = e, o = z(t, 0, r.content.size), s = st.create(r, o);
1393
1393
  e.setSelection(s);
1394
1394
  }
1395
1395
  return !0;
1396
- }, mr = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
1396
+ }, gr = (t, e) => ({ tr: n, state: r, dispatch: o }) => {
1397
1397
  const { selection: s } = r;
1398
1398
  let i, a;
1399
1399
  return typeof e == "number" ? (i = e, a = e) : e && "from" in e && "to" in e ? (i = e.from, a = e.to) : (i = s.from, a = s.to), o && n.doc.nodesBetween(i, a, (c, l) => {
@@ -1402,15 +1402,15 @@ var ur = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1402
1402
  dir: t
1403
1403
  });
1404
1404
  }), !0;
1405
- }, hr = (t) => ({ tr: e, dispatch: n }) => {
1405
+ }, vr = (t) => ({ tr: e, dispatch: n }) => {
1406
1406
  if (n) {
1407
1407
  const { doc: r } = e, { from: o, to: s } = typeof t == "number" ? { from: t, to: t } : t, i = R.atStart(r).from, a = R.atEnd(r).to, c = z(o, i, a), l = z(s, i, a), f = R.create(r, c, l);
1408
1408
  e.setSelection(f);
1409
1409
  }
1410
1410
  return !0;
1411
- }, gr = (t) => ({ state: e, dispatch: n }) => {
1411
+ }, br = (t) => ({ state: e, dispatch: n }) => {
1412
1412
  const r = T(t, e.schema);
1413
- return Je(r)(e, n);
1413
+ return Qe(r)(e, n);
1414
1414
  };
1415
1415
  function _t(t, e) {
1416
1416
  const n = t.storedMarks || t.selection.$to.parentOffset && t.selection.$from.marks();
@@ -1419,7 +1419,7 @@ function _t(t, e) {
1419
1419
  t.tr.ensureMarks(r);
1420
1420
  }
1421
1421
  }
1422
- var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor: o }) => {
1422
+ var yr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor: o }) => {
1423
1423
  const { selection: s, doc: i } = e, { $from: a, $to: c } = s, l = o.extensionManager.attributes, f = et(
1424
1424
  l,
1425
1425
  a.node().type.name,
@@ -1429,7 +1429,7 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
1429
1429
  return !a.parentOffset || !X(i, a.pos) ? !1 : (r && (t && _t(n, o.extensionManager.splittableMarks), e.split(a.pos).scrollIntoView()), !0);
1430
1430
  if (!a.parent.isBlock)
1431
1431
  return !1;
1432
- const u = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : qn(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1432
+ const u = c.parentOffset === c.parent.content.size, p = a.depth === 0 ? void 0 : Kn(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1433
1433
  let d = u && p ? [
1434
1434
  {
1435
1435
  type: p,
@@ -1449,7 +1449,7 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
1449
1449
  t && _t(n, o.extensionManager.splittableMarks), e.scrollIntoView();
1450
1450
  }
1451
1451
  return h;
1452
- }, br = (t, e = {}) => ({ tr: n, state: r, dispatch: o, editor: s }) => {
1452
+ }, kr = (t, e = {}) => ({ tr: n, state: r, dispatch: o, editor: s }) => {
1453
1453
  var i;
1454
1454
  const a = T(t, r.schema), { $from: c, $to: l } = r.selection, f = r.selection.node;
1455
1455
  if (f && f.isBlock || c.depth < 2 || !c.sameParent(l))
@@ -1464,8 +1464,8 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
1464
1464
  if (o) {
1465
1465
  let v = D.empty;
1466
1466
  const y = c.index(-1) ? 1 : c.index(-2) ? 2 : 3;
1467
- for (let A = c.depth - y; A >= c.depth - 3; A -= 1)
1468
- v = D.from(c.node(A).copy(v));
1467
+ for (let C = c.depth - y; C >= c.depth - 3; C -= 1)
1468
+ v = D.from(c.node(C).copy(v));
1469
1469
  const w = (
1470
1470
  // oxlint-disable-next-line no-nested-ternary
1471
1471
  c.indexAfter(-1) < c.node(-2).childCount ? 1 : c.indexAfter(-2) < c.node(-3).childCount ? 2 : 3
@@ -1475,12 +1475,12 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
1475
1475
  }, k = ((i = a.contentMatch.defaultType) == null ? void 0 : i.createAndFill(M)) || void 0;
1476
1476
  v = v.append(D.from(a.createAndFill(null, k) || void 0));
1477
1477
  const S = c.before(c.depth - (y - 1));
1478
- n.replace(S, c.after(-w), new Ue(v, 4 - y, 0));
1478
+ n.replace(S, c.after(-w), new Je(v, 4 - y, 0));
1479
1479
  let E = -1;
1480
- n.doc.nodesBetween(S, n.doc.content.size, (A, C) => {
1480
+ n.doc.nodesBetween(S, n.doc.content.size, (C, A) => {
1481
1481
  if (E > -1)
1482
1482
  return !1;
1483
- A.isTextblock && A.content.size === 0 && (E = C + 1);
1483
+ C.isTextblock && C.content.size === 0 && (E = A + 1);
1484
1484
  }), E > -1 && n.setSelection(R.near(n.doc.resolve(E))), n.scrollIntoView();
1485
1485
  }
1486
1486
  return !0;
@@ -1507,7 +1507,14 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
1507
1507
  n.ensureMarks(k);
1508
1508
  }
1509
1509
  return !0;
1510
- }, mt = (t, e) => {
1510
+ };
1511
+ function Lt(t) {
1512
+ return !t || t === "1" ? null : t;
1513
+ }
1514
+ function se(t, e) {
1515
+ return Lt(t) === Lt(e);
1516
+ }
1517
+ var mt = (t, e) => {
1511
1518
  const n = lt((i) => i.type === e)(t.selection);
1512
1519
  if (!n)
1513
1520
  return !0;
@@ -1515,7 +1522,7 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
1515
1522
  if (r === void 0)
1516
1523
  return !0;
1517
1524
  const o = t.doc.nodeAt(r);
1518
- return n.node.type === o?.type && bt(t.doc, n.pos) && t.join(n.pos), !0;
1525
+ return !(n.node.type === o?.type && bt(t.doc, n.pos)) || !se(n.node.attrs.type, o?.attrs.type) || t.join(n.pos), !0;
1519
1526
  }, ht = (t, e) => {
1520
1527
  const n = lt((i) => i.type === e)(t.selection);
1521
1528
  if (!n)
@@ -1524,27 +1531,27 @@ var vr = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor
1524
1531
  if (r === void 0)
1525
1532
  return !0;
1526
1533
  const o = t.doc.nodeAt(r);
1527
- return n.node.type === o?.type && bt(t.doc, r) && t.join(r), !0;
1534
+ return !(n.node.type === o?.type && bt(t.doc, r)) || !se(n.node.attrs.type, o?.attrs.type) || t.join(r), !0;
1528
1535
  };
1529
- function yr(t) {
1536
+ function wr(t) {
1530
1537
  const e = t.doc, n = e.firstChild;
1531
1538
  if (!n)
1532
1539
  return null;
1533
1540
  const r = e.resolve(1), o = e.resolve(n.nodeSize - 1);
1534
1541
  return R.between(r, o);
1535
1542
  }
1536
- var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain: c, commands: l, can: f }) => {
1543
+ var Mr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain: c, commands: l, can: f }) => {
1537
1544
  const { extensions: u, splittableMarks: p } = o.extensionManager, d = T(t, i.schema), h = T(e, i.schema), { selection: m, storedMarks: g } = i, { $from: v, $to: y } = m, w = v.blockRange(y), M = g || m.$to.parentOffset && m.$from.marks();
1538
1545
  if (!w)
1539
1546
  return !1;
1540
- const k = lt((I) => pt(I.type.name, u))(m), S = m.from === 0 && m.to === i.doc.content.size, E = i.doc.content.content, A = E.length === 1 ? E[0] : null, C = S && A && pt(A.type.name, u) ? {
1541
- node: A,
1547
+ const k = lt((I) => pt(I.type.name, u))(m), S = m.from === 0 && m.to === i.doc.content.size, E = i.doc.content.content, C = E.length === 1 ? E[0] : null, A = S && C && pt(C.type.name, u) ? {
1548
+ node: C,
1542
1549
  pos: 0
1543
- } : null, $ = k ?? C, H = !!k && w.depth >= 1 && w.depth - k.depth <= 1, L = !!C;
1550
+ } : null, $ = k ?? A, H = !!k && w.depth >= 1 && w.depth - k.depth <= 1, L = !!A;
1544
1551
  if ((H || L) && $) {
1545
1552
  if ($.node.type === d)
1546
1553
  return S && L ? c().command(({ tr: I, dispatch: N }) => {
1547
- const P = yr(I);
1554
+ const P = wr(I);
1548
1555
  return P ? (I.setSelection(P), N && N(I), !0) : !1;
1549
1556
  }).liftListItem(h).run() : l.liftListItem(h);
1550
1557
  if (pt($.node.type.name, u) && d.validContent($.node.content))
@@ -1554,17 +1561,17 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain:
1554
1561
  const I = f().wrapInList(d, r), N = M.filter((P) => p.includes(P.type.name));
1555
1562
  return s.ensureMarks(N), I ? !0 : l.clearNodes();
1556
1563
  }).wrapInList(d, r).command(() => mt(s, d)).command(() => ht(s, d)).run();
1557
- }, wr = (t, e = {}, n = {}) => ({ state: r, commands: o }) => {
1564
+ }, xr = (t, e = {}, n = {}) => ({ state: r, commands: o }) => {
1558
1565
  const { extendEmptyMarkRange: s = !1 } = n, i = B(t, r.schema);
1559
1566
  return vt(r, i, e) ? o.unsetMark(i, { extendEmptyMarkRange: s }) : o.setMark(i, e);
1560
- }, Mr = (t, e, n = {}) => ({ state: r, commands: o }) => {
1567
+ }, Sr = (t, e, n = {}) => ({ state: r, commands: o }) => {
1561
1568
  const s = T(t, r.schema), i = T(e, r.schema), a = Q(r, s, n);
1562
1569
  let c;
1563
1570
  return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), a ? o.setNode(i, c) : o.setNode(s, { ...c, ...n });
1564
- }, xr = (t, e = {}) => ({ state: n, commands: r }) => {
1571
+ }, Er = (t, e = {}) => ({ state: n, commands: r }) => {
1565
1572
  const o = T(t, n.schema);
1566
1573
  return Q(n, o, e) ? r.lift(o) : r.wrapIn(o, e);
1567
- }, Sr = () => ({ state: t, dispatch: e }) => {
1574
+ }, Tr = () => ({ state: t, dispatch: e }) => {
1568
1575
  const n = t.plugins;
1569
1576
  for (let r = 0; r < n.length; r += 1) {
1570
1577
  const o = n[r];
@@ -1584,7 +1591,7 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain:
1584
1591
  }
1585
1592
  }
1586
1593
  return !1;
1587
- }, Er = (t = {}) => ({ tr: e, dispatch: n, editor: r }) => {
1594
+ }, Cr = (t = {}) => ({ tr: e, dispatch: n, editor: r }) => {
1588
1595
  const { ignoreClearable: o = !1 } = t, { selection: s } = e, { empty: i, ranges: a } = s;
1589
1596
  if (i)
1590
1597
  return !0;
@@ -1599,7 +1606,7 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain:
1599
1606
  });
1600
1607
  }
1601
1608
  return !0;
1602
- }, Tr = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1609
+ }, Ar = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1603
1610
  var s;
1604
1611
  const { extendEmptyMarkRange: i = !1 } = e, { selection: a } = n, c = B(t, r.schema), { $from: l, empty: f, ranges: u } = a;
1605
1612
  if (!o)
@@ -1613,7 +1620,7 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain:
1613
1620
  n.removeMark(p.$from.pos, p.$to.pos, c);
1614
1621
  });
1615
1622
  return n.removeStoredMark(c), !0;
1616
- }, Ar = (t) => ({ tr: e, state: n, dispatch: r }) => {
1623
+ }, Pr = (t) => ({ tr: e, state: n, dispatch: r }) => {
1617
1624
  const { selection: o } = n;
1618
1625
  let s, i;
1619
1626
  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, (a, c) => {
@@ -1622,7 +1629,7 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain:
1622
1629
  const l = { ...a.attrs };
1623
1630
  delete l.dir, e.setNodeMarkup(c, void 0, l);
1624
1631
  }), !0;
1625
- }, Cr = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1632
+ }, $r = (t, e = {}) => ({ tr: n, state: r, dispatch: o }) => {
1626
1633
  let s = null, i = null;
1627
1634
  const a = ct(
1628
1635
  typeof t == "string" ? t : t.name,
@@ -1668,13 +1675,13 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain:
1668
1675
  );
1669
1676
  }));
1670
1677
  }), c;
1671
- }, Pr = (t, e = {}) => ({ state: n, dispatch: r }) => {
1678
+ }, Nr = (t, e = {}) => ({ state: n, dispatch: r }) => {
1672
1679
  const o = T(t, n.schema);
1673
- return Fe(o, e)(n, r);
1674
- }, $r = (t, e = {}) => ({ state: n, dispatch: r }) => {
1680
+ return He(o, e)(n, r);
1681
+ }, Ir = (t, e = {}) => ({ state: n, dispatch: r }) => {
1675
1682
  const o = T(t, n.schema);
1676
- return Ke(o, e)(n, r);
1677
- }, Nr = class {
1683
+ return Ge(o, e)(n, r);
1684
+ }, Rr = class {
1678
1685
  constructor() {
1679
1686
  this.callbacks = {};
1680
1687
  }
@@ -1698,239 +1705,628 @@ var kr = (t, e, n, r = {}) => ({ editor: o, tr: s, state: i, dispatch: a, chain:
1698
1705
  removeAllListeners() {
1699
1706
  this.callbacks = {};
1700
1707
  }
1701
- }, dt = class {
1702
- constructor(t) {
1703
- var e;
1704
- this.find = t.find, this.handler = t.handler, this.undoable = (e = t.undoable) != null ? e : !0;
1705
- }
1706
- }, Ir = (t, e) => {
1707
- if (kt(e))
1708
- return e.exec(t);
1709
- const n = e(t);
1710
- if (!n)
1711
- return null;
1712
- const r = [n.text];
1713
- return r.index = n.index, r.input = t, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn(
1714
- '[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'
1715
- ), r.push(n.replaceWith)), r;
1716
1708
  };
1717
- function Z(t) {
1718
- var e;
1719
- const { editor: n, from: r, to: o, text: s, rules: i, plugin: a } = t, { view: c } = n;
1720
- if (c.composing)
1721
- return !1;
1722
- const l = c.state.doc.resolve(r);
1723
- if (
1724
- // check for code node
1725
- l.parent.type.spec.code || (e = l.nodeBefore || l.nodeAfter) != null && e.marks.find((p) => p.type.spec.code)
1726
- )
1727
- return !1;
1728
- let f = !1;
1729
- const u = sr(l) + s;
1730
- return i.forEach((p) => {
1731
- if (f)
1732
- return;
1733
- const d = Ir(u, p.find);
1734
- if (!d)
1735
- return;
1736
- const h = c.state.tr, m = it({
1737
- state: c.state,
1738
- transaction: h
1739
- }), g = {
1740
- from: r - (d[0].length - s.length),
1741
- to: o
1742
- }, { commands: v, chain: y, can: w } = new at({
1743
- editor: n,
1744
- state: m
1745
- });
1746
- p.handler({
1747
- state: m,
1748
- range: g,
1749
- match: d,
1750
- commands: v,
1751
- chain: y,
1752
- can: w
1753
- }) === null || !h.steps.length || (p.undoable && h.setMeta(a, {
1754
- transform: h,
1755
- from: r,
1756
- to: o,
1757
- text: s
1758
- }), c.dispatch(h), f = !0);
1759
- }), f;
1709
+ function bo(t, e) {
1710
+ const { selection: n } = t, { $from: r } = n;
1711
+ if (n instanceof st) {
1712
+ const s = r.index();
1713
+ return r.parent.canReplaceWith(s, s + 1, e);
1714
+ }
1715
+ let o = r.depth;
1716
+ for (; o >= 0; ) {
1717
+ const s = r.index(o);
1718
+ if (r.node(o).contentMatchAt(s).matchType(e))
1719
+ return !0;
1720
+ o -= 1;
1721
+ }
1722
+ return !1;
1760
1723
  }
1761
- function Rr(t) {
1762
- const { editor: e, rules: n } = t, r = new O({
1763
- state: {
1764
- init() {
1765
- return null;
1766
- },
1767
- apply(o, s, i) {
1768
- const a = o.getMeta(r);
1769
- if (a)
1770
- return a;
1771
- const c = o.getMeta("applyInputRules");
1772
- return c && setTimeout(() => {
1773
- let { text: f } = c;
1774
- typeof f == "string" ? f = f : f = ut(D.from(f), i.schema);
1775
- const { from: u } = c, p = u + f.length;
1776
- Z({
1777
- editor: e,
1778
- from: u,
1779
- to: p,
1780
- text: f,
1781
- rules: n,
1782
- plugin: r
1783
- });
1784
- }), o.selectionSet || o.docChanged ? null : s;
1785
- }
1786
- },
1787
- props: {
1788
- handleTextInput(o, s, i, a) {
1789
- return Z({
1790
- editor: e,
1791
- from: s,
1792
- to: i,
1793
- text: a,
1794
- rules: n,
1795
- plugin: r
1796
- });
1797
- },
1798
- handleDOMEvents: {
1799
- compositionend: (o) => (setTimeout(() => {
1800
- const { $cursor: s } = o.state.selection;
1801
- s && Z({
1802
- editor: e,
1803
- from: s.pos,
1804
- to: s.pos,
1805
- text: "",
1806
- rules: n,
1807
- plugin: r
1808
- });
1809
- }), !1)
1810
- },
1811
- // add support for input rules to trigger on enter
1812
- // this is useful for example for code blocks
1813
- handleKeyDown(o, s) {
1814
- if (s.key !== "Enter")
1815
- return !1;
1816
- const { $cursor: i } = o.state.selection;
1817
- return i ? Z({
1818
- editor: e,
1819
- from: i.pos,
1820
- to: i.pos,
1821
- text: `
1822
- `,
1823
- rules: n,
1824
- plugin: r
1825
- }) : !1;
1826
- }
1827
- },
1828
- // @ts-ignore
1829
- isInputRules: !0
1830
- });
1831
- return r;
1724
+ function Or(t, e, n) {
1725
+ const r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
1726
+ if (r !== null)
1727
+ return r;
1728
+ const o = document.createElement("style");
1729
+ return e && o.setAttribute("nonce", e), o.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), o.innerHTML = t, document.getElementsByTagName("head")[0].appendChild(o), o;
1730
+ }
1731
+ function jr(t) {
1732
+ return typeof t == "number";
1832
1733
  }
1833
- function Or(t) {
1734
+ function Br(t) {
1834
1735
  return Object.prototype.toString.call(t).slice(8, -1);
1835
1736
  }
1836
1737
  function G(t) {
1837
- return Or(t) !== "Object" ? !1 : t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
1838
- }
1839
- function oe(t, e) {
1840
- const n = { ...t };
1841
- return G(t) && G(e) && Object.keys(e).forEach((r) => {
1842
- G(e[r]) && G(t[r]) ? n[r] = oe(t[r], e[r]) : n[r] = e[r];
1843
- }), n;
1844
- }
1845
- var Et = class {
1846
- constructor(t = {}) {
1847
- this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
1848
- name: this.name
1849
- }, this.config = {
1850
- ...this.config,
1851
- ...t
1852
- }, this.name = this.config.name;
1853
- }
1854
- get options() {
1855
- return {
1856
- ...x(
1857
- b(this, "addOptions", {
1858
- name: this.name
1859
- })
1860
- )
1861
- };
1862
- }
1863
- get storage() {
1864
- return {
1865
- ...x(
1866
- b(this, "addStorage", {
1867
- name: this.name,
1868
- options: this.options
1869
- })
1870
- )
1871
- };
1872
- }
1873
- configure(t = {}) {
1874
- const e = this.extend({
1875
- ...this.config,
1876
- addOptions: () => oe(this.options, t)
1877
- });
1878
- return e.name = this.name, e.parent = this.parent, this.child = null, e;
1879
- }
1880
- extend(t = {}) {
1881
- const e = new this.constructor({ ...this.config, ...t });
1882
- return e.parent = this, this.child = e, e.name = "name" in t ? t.name : e.parent.name, e;
1883
- }
1884
- }, jr = class se extends Et {
1885
- constructor() {
1886
- super(...arguments), this.type = "mark";
1887
- }
1888
- /**
1889
- * Create a new Mark instance
1890
- * @param config - Mark configuration object or a function that returns a configuration object
1891
- */
1892
- static create(e = {}) {
1893
- const n = typeof e == "function" ? e() : e;
1894
- return new se(n);
1895
- }
1896
- static handleExit({ editor: e, mark: n }) {
1897
- const { tr: r } = e.state, o = e.state.selection.$from;
1898
- if (o.pos === o.end()) {
1899
- const i = o.marks();
1900
- if (!!!i.find((l) => l?.type.name === n.name))
1901
- return !1;
1902
- const c = i.find((l) => l?.type.name === n.name);
1903
- return c && r.removeStoredMark(c), r.insertText(" ", o.pos), e.view.dispatch(r), !0;
1904
- }
1905
- return !1;
1906
- }
1907
- configure(e) {
1908
- return super.configure(e);
1909
- }
1910
- extend(e) {
1911
- const n = typeof e == "function" ? e() : e;
1912
- return super.extend(n);
1738
+ return Br(t) !== "Object" ? !1 : t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
1739
+ }
1740
+ var Dr = {};
1741
+ yt(Dr, {
1742
+ createAtomBlockMarkdownSpec: () => _r,
1743
+ createBlockMarkdownSpec: () => Lr,
1744
+ createInlineMarkdownSpec: () => Vr,
1745
+ parseAttributes: () => Et,
1746
+ parseIndentedBlocks: () => Hr,
1747
+ renderNestedMarkdownContent: () => Wr,
1748
+ serializeAttributes: () => Tt
1749
+ });
1750
+ function Et(t) {
1751
+ if (!t?.trim())
1752
+ return {};
1753
+ const e = {}, n = [], r = t.replace(/["']([^"']*)["']/g, (l) => (n.push(l), `__QUOTED_${n.length - 1}__`)), o = r.match(/(?:^|\s)\.([\w-]+)/g);
1754
+ if (o) {
1755
+ const l = o.map((f) => f.trim().slice(1));
1756
+ e.class = l.join(" ");
1913
1757
  }
1914
- };
1915
- function Br(t) {
1916
- return typeof t == "number";
1758
+ const s = r.match(/(?:^|\s)#([\w-]+)/);
1759
+ s && (e.id = s[1]);
1760
+ const i = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
1761
+ Array.from(r.matchAll(i)).forEach(([, l, f]) => {
1762
+ var u;
1763
+ const p = parseInt(((u = f.match(/__QUOTED_(\d+)__/)) == null ? void 0 : u[1]) || "0", 10), d = n[p];
1764
+ d && (e[l] = d.slice(1, -1));
1765
+ });
1766
+ const c = r.replace(/(?:^|\s)\.([\w-]+)/g, "").replace(/(?:^|\s)#([\w-]+)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
1767
+ return c && c.split(/\s+/).filter(Boolean).forEach((f) => {
1768
+ f.match(/^[a-zA-Z][\w-]*$/) && (e[f] = !0);
1769
+ }), e;
1917
1770
  }
1918
- var Dr = class {
1919
- constructor(t) {
1920
- this.find = t.find, this.handler = t.handler;
1921
- }
1922
- }, _r = (t, e, n) => {
1923
- if (kt(e))
1924
- return [...t.matchAll(e)];
1925
- const r = e(t, n);
1926
- return r ? r.map((o) => {
1927
- const s = [o.text];
1928
- return s.index = o.index, s.input = t, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn(
1929
- '[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'
1930
- ), s.push(o.replaceWith)), s;
1771
+ function Tt(t) {
1772
+ if (!t || Object.keys(t).length === 0)
1773
+ return "";
1774
+ const e = [];
1775
+ 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]) => {
1776
+ n === "class" || n === "id" || (r === !0 ? e.push(n) : r !== !1 && r != null && e.push(`${n}="${String(r)}"`));
1777
+ }), e.join(" ");
1778
+ }
1779
+ function _r(t) {
1780
+ const {
1781
+ nodeName: e,
1782
+ name: n,
1783
+ parseAttributes: r = Et,
1784
+ serializeAttributes: o = Tt,
1785
+ defaultAttributes: s = {},
1786
+ requiredAttributes: i = [],
1787
+ allowedAttributes: a
1788
+ } = t, c = n || e, l = (f) => {
1789
+ if (!a)
1790
+ return f;
1791
+ const u = {};
1792
+ return a.forEach((p) => {
1793
+ p in f && (u[p] = f[p]);
1794
+ }), u;
1795
+ };
1796
+ return {
1797
+ parseMarkdown: (f, u) => {
1798
+ const p = { ...s, ...f.attributes };
1799
+ return u.createNode(e, p, []);
1800
+ },
1801
+ markdownTokenizer: {
1802
+ name: e,
1803
+ level: "block",
1804
+ start(f) {
1805
+ var u;
1806
+ const p = new RegExp(`^:::${c}(?:\\s|$)`, "m"), d = (u = f.match(p)) == null ? void 0 : u.index;
1807
+ return d !== void 0 ? d : -1;
1808
+ },
1809
+ tokenize(f, u, p) {
1810
+ const d = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), h = f.match(d);
1811
+ if (!h)
1812
+ return;
1813
+ const m = h[1] || "", g = r(m);
1814
+ if (!i.find((y) => !(y in g)))
1815
+ return {
1816
+ type: e,
1817
+ raw: h[0],
1818
+ attributes: g
1819
+ };
1820
+ }
1821
+ },
1822
+ renderMarkdown: (f) => {
1823
+ const u = l(f.attrs || {}), p = o(u), d = p ? ` {${p}}` : "";
1824
+ return `:::${c}${d} :::`;
1825
+ }
1826
+ };
1827
+ }
1828
+ function Lr(t) {
1829
+ const {
1830
+ nodeName: e,
1831
+ name: n,
1832
+ getContent: r,
1833
+ parseAttributes: o = Et,
1834
+ serializeAttributes: s = Tt,
1835
+ defaultAttributes: i = {},
1836
+ content: a = "block",
1837
+ allowedAttributes: c
1838
+ } = t, l = n || e, f = (u) => {
1839
+ if (!c)
1840
+ return u;
1841
+ const p = {};
1842
+ return c.forEach((d) => {
1843
+ d in u && (p[d] = u[d]);
1844
+ }), p;
1845
+ };
1846
+ return {
1847
+ parseMarkdown: (u, p) => {
1848
+ let d;
1849
+ if (r) {
1850
+ const m = r(u);
1851
+ d = typeof m == "string" ? [{ type: "text", text: m }] : m;
1852
+ } else a === "block" ? d = p.parseChildren(u.tokens || []) : d = p.parseInline(u.tokens || []);
1853
+ const h = { ...i, ...u.attributes };
1854
+ return p.createNode(e, h, d);
1855
+ },
1856
+ markdownTokenizer: {
1857
+ name: e,
1858
+ level: "block",
1859
+ start(u) {
1860
+ var p;
1861
+ const d = new RegExp(`^:::${l}`, "m"), h = (p = u.match(d)) == null ? void 0 : p.index;
1862
+ return h !== void 0 ? h : -1;
1863
+ },
1864
+ tokenize(u, p, d) {
1865
+ var h;
1866
+ const m = new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), g = u.match(m);
1867
+ if (!g)
1868
+ return;
1869
+ const [v, y = ""] = g, w = o(y);
1870
+ let M = 1;
1871
+ const k = v.length;
1872
+ let S = "";
1873
+ const E = /^:::([\w-]*)(\s.*)?/gm, C = u.slice(k);
1874
+ for (E.lastIndex = 0; ; ) {
1875
+ const A = E.exec(C);
1876
+ if (A === null)
1877
+ break;
1878
+ const $ = A.index, H = A[1];
1879
+ if (!((h = A[2]) != null && h.endsWith(":::"))) {
1880
+ if (H)
1881
+ M += 1;
1882
+ else if (M -= 1, M === 0) {
1883
+ const L = C.slice(0, $);
1884
+ S = L.trim();
1885
+ const I = u.slice(0, k + $ + A[0].length);
1886
+ let N = [];
1887
+ if (S)
1888
+ if (a === "block")
1889
+ for (N = d.blockTokens(L), N.forEach((P) => {
1890
+ P.text && (!P.tokens || P.tokens.length === 0) && (P.tokens = d.inlineTokens(P.text));
1891
+ }); N.length > 0; ) {
1892
+ const P = N[N.length - 1];
1893
+ if (P.type === "paragraph" && (!P.text || P.text.trim() === ""))
1894
+ N.pop();
1895
+ else
1896
+ break;
1897
+ }
1898
+ else
1899
+ N = d.inlineTokens(S);
1900
+ return {
1901
+ type: e,
1902
+ raw: I,
1903
+ attributes: w,
1904
+ content: S,
1905
+ tokens: N
1906
+ };
1907
+ }
1908
+ }
1909
+ }
1910
+ }
1911
+ },
1912
+ renderMarkdown: (u, p) => {
1913
+ const d = f(u.attrs || {}), h = s(d), m = h ? ` {${h}}` : "", g = p.renderChildren(u.content || [], `
1914
+
1915
+ `);
1916
+ return `:::${l}${m}
1917
+
1918
+ ${g}
1919
+
1920
+ :::`;
1921
+ }
1922
+ };
1923
+ }
1924
+ function zr(t) {
1925
+ if (!t.trim())
1926
+ return {};
1927
+ const e = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
1928
+ let r = n.exec(t);
1929
+ for (; r !== null; ) {
1930
+ const [, o, s, i] = r;
1931
+ e[o] = s || i, r = n.exec(t);
1932
+ }
1933
+ return e;
1934
+ }
1935
+ function Fr(t) {
1936
+ return Object.entries(t).filter(([, e]) => e != null).map(([e, n]) => `${e}="${n}"`).join(" ");
1937
+ }
1938
+ function Vr(t) {
1939
+ const {
1940
+ nodeName: e,
1941
+ name: n,
1942
+ getContent: r,
1943
+ parseAttributes: o = zr,
1944
+ serializeAttributes: s = Fr,
1945
+ defaultAttributes: i = {},
1946
+ selfClosing: a = !1,
1947
+ allowedAttributes: c
1948
+ } = t, l = n || e, f = (p) => {
1949
+ if (!c)
1950
+ return p;
1951
+ const d = {};
1952
+ return c.forEach((h) => {
1953
+ const m = typeof h == "string" ? h : h.name, g = typeof h == "string" ? void 0 : h.skipIfDefault;
1954
+ if (m in p) {
1955
+ const v = p[m];
1956
+ if (g !== void 0 && v === g)
1957
+ return;
1958
+ d[m] = v;
1959
+ }
1960
+ }), d;
1961
+ }, u = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1962
+ return {
1963
+ parseMarkdown: (p, d) => {
1964
+ const h = { ...i, ...p.attributes };
1965
+ if (a)
1966
+ return d.createNode(e, h);
1967
+ const m = r ? r(p) : p.content || "";
1968
+ return m ? d.createNode(e, h, [d.createTextNode(m)]) : d.createNode(e, h, []);
1969
+ },
1970
+ markdownTokenizer: {
1971
+ name: e,
1972
+ level: "inline",
1973
+ start(p) {
1974
+ const d = a ? new RegExp(`\\[${u}\\s*[^\\]]*\\]`) : new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`), h = p.match(d), m = h?.index;
1975
+ return m !== void 0 ? m : -1;
1976
+ },
1977
+ tokenize(p, d, h) {
1978
+ const m = a ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(
1979
+ `^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`
1980
+ ), g = p.match(m);
1981
+ if (!g)
1982
+ return;
1983
+ let v = "", y = "";
1984
+ if (a) {
1985
+ const [, M] = g;
1986
+ y = M;
1987
+ } else {
1988
+ const [, M, k] = g;
1989
+ y = M, v = k || "";
1990
+ }
1991
+ const w = o(y.trim());
1992
+ return {
1993
+ type: e,
1994
+ raw: g[0],
1995
+ content: v.trim(),
1996
+ attributes: w
1997
+ };
1998
+ }
1999
+ },
2000
+ renderMarkdown: (p) => {
2001
+ let d = "";
2002
+ r ? d = r(p) : p.content && p.content.length > 0 && (d = p.content.filter((v) => v.type === "text").map((v) => v.text).join(""));
2003
+ const h = f(p.attrs || {}), m = s(h), g = m ? ` ${m}` : "";
2004
+ return a ? `[${l}${g}]` : `[${l}${g}]${d}[/${l}]`;
2005
+ }
2006
+ };
2007
+ }
2008
+ function Hr(t, e, n) {
2009
+ var r, o, s, i;
2010
+ const a = t.split(`
2011
+ `), c = [];
2012
+ let l = "", f = 0;
2013
+ const u = e.baseIndentSize || 2;
2014
+ for (; f < a.length; ) {
2015
+ const p = a[f], d = p.match(e.itemPattern);
2016
+ if (!d) {
2017
+ if (c.length > 0)
2018
+ break;
2019
+ if (p.trim() === "") {
2020
+ f += 1, l = `${l}${p}
2021
+ `;
2022
+ continue;
2023
+ } else
2024
+ return;
2025
+ }
2026
+ const h = e.extractItemData(d), { indentLevel: m, mainContent: g } = h;
2027
+ l = `${l}${p}
2028
+ `;
2029
+ const v = [g];
2030
+ for (f += 1; f < a.length; ) {
2031
+ const k = a[f];
2032
+ if (k.trim() === "") {
2033
+ const E = a.slice(f + 1).findIndex(($) => $.trim() !== "");
2034
+ if (E === -1)
2035
+ break;
2036
+ if ((((o = (r = a[f + 1 + E].match(/^(\s*)/)) == null ? void 0 : r[1]) == null ? void 0 : o.length) || 0) > m) {
2037
+ v.push(k), l = `${l}${k}
2038
+ `, f += 1;
2039
+ continue;
2040
+ } else
2041
+ break;
2042
+ }
2043
+ if ((((i = (s = k.match(/^(\s*)/)) == null ? void 0 : s[1]) == null ? void 0 : i.length) || 0) > m)
2044
+ v.push(k), l = `${l}${k}
2045
+ `, f += 1;
2046
+ else
2047
+ break;
2048
+ }
2049
+ let y;
2050
+ const w = v.slice(1);
2051
+ if (w.length > 0) {
2052
+ const k = w.map((S) => S.slice(m + u)).join(`
2053
+ `);
2054
+ k.trim() && (e.customNestedParser ? y = e.customNestedParser(k) : y = n.blockTokens(k));
2055
+ }
2056
+ const M = e.createToken(h, y);
2057
+ c.push(M);
2058
+ }
2059
+ if (c.length !== 0)
2060
+ return {
2061
+ items: c,
2062
+ raw: l
2063
+ };
2064
+ }
2065
+ function Wr(t, e, n, r) {
2066
+ if (!t || !Array.isArray(t.content))
2067
+ return "";
2068
+ const o = typeof n == "function" ? n(r) : n, [s, ...i] = t.content, a = e.renderChildren([s]);
2069
+ let c = `${o}${a}`;
2070
+ return i && i.length > 0 && i.forEach((l, f) => {
2071
+ var u, p;
2072
+ const d = (p = (u = e.renderChild) == null ? void 0 : u.call(e, l, f + 1)) != null ? p : e.renderChildren([l]);
2073
+ if (d != null) {
2074
+ const h = d.split(`
2075
+ `).map((m) => m ? e.indent(m) : e.indent("")).join(`
2076
+ `);
2077
+ c += l.type === "paragraph" ? `
2078
+
2079
+ ${h}` : `
2080
+ ${h}`;
2081
+ }
2082
+ }), c;
2083
+ }
2084
+ function ie(t, e) {
2085
+ const n = { ...t };
2086
+ return G(t) && G(e) && Object.keys(e).forEach((r) => {
2087
+ G(e[r]) && G(t[r]) ? n[r] = ie(t[r], e[r]) : n[r] = e[r];
2088
+ }), n;
2089
+ }
2090
+ function Ur(t, e, n = {}) {
2091
+ const { state: r } = e, { doc: o, tr: s } = r, i = t;
2092
+ o.descendants((a, c) => {
2093
+ const l = s.mapping.map(c), f = s.mapping.map(c) + a.nodeSize;
2094
+ let u = null;
2095
+ if (a.marks.forEach((d) => {
2096
+ if (d !== i)
2097
+ return !1;
2098
+ u = d;
2099
+ }), !u)
2100
+ return;
2101
+ let p = !1;
2102
+ if (Object.keys(n).forEach((d) => {
2103
+ n[d] !== u.attrs[d] && (p = !0);
2104
+ }), p) {
2105
+ const d = t.type.create({
2106
+ ...t.attrs,
2107
+ ...n
2108
+ });
2109
+ s.removeMark(l, f, t.type), s.addMark(l, f, d);
2110
+ }
2111
+ }), s.docChanged && e.view.dispatch(s);
2112
+ }
2113
+ var dt = class {
2114
+ constructor(t) {
2115
+ var e;
2116
+ this.find = t.find, this.handler = t.handler, this.undoable = (e = t.undoable) != null ? e : !0;
2117
+ }
2118
+ }, qr = (t, e) => {
2119
+ if (kt(e))
2120
+ return e.exec(t);
2121
+ const n = e(t);
2122
+ if (!n)
2123
+ return null;
2124
+ const r = [n.text];
2125
+ return r.index = n.index, r.input = t, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn(
2126
+ '[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'
2127
+ ), r.push(n.replaceWith)), r;
2128
+ };
2129
+ function Z(t) {
2130
+ var e;
2131
+ const { editor: n, from: r, to: o, text: s, rules: i, plugin: a } = t, { view: c } = n;
2132
+ if (c.composing)
2133
+ return !1;
2134
+ const l = c.state.doc.resolve(r);
2135
+ if (
2136
+ // check for code node
2137
+ l.parent.type.spec.code || (e = l.nodeBefore || l.nodeAfter) != null && e.marks.find((p) => p.type.spec.code)
2138
+ )
2139
+ return !1;
2140
+ let f = !1;
2141
+ const u = ar(l) + s;
2142
+ return i.forEach((p) => {
2143
+ if (f)
2144
+ return;
2145
+ const d = qr(u, p.find);
2146
+ if (!d)
2147
+ return;
2148
+ const h = c.state.tr, m = it({
2149
+ state: c.state,
2150
+ transaction: h
2151
+ }), g = {
2152
+ from: r - (d[0].length - s.length),
2153
+ to: o
2154
+ }, { commands: v, chain: y, can: w } = new at({
2155
+ editor: n,
2156
+ state: m
2157
+ });
2158
+ p.handler({
2159
+ state: m,
2160
+ range: g,
2161
+ match: d,
2162
+ commands: v,
2163
+ chain: y,
2164
+ can: w
2165
+ }) === null || !h.steps.length || (p.undoable && h.setMeta(a, {
2166
+ transform: h,
2167
+ from: r,
2168
+ to: o,
2169
+ text: s
2170
+ }), c.dispatch(h), f = !0);
2171
+ }), f;
2172
+ }
2173
+ function Jr(t) {
2174
+ const { editor: e, rules: n } = t, r = new O({
2175
+ state: {
2176
+ init() {
2177
+ return null;
2178
+ },
2179
+ apply(o, s, i) {
2180
+ const a = o.getMeta(r);
2181
+ if (a)
2182
+ return a;
2183
+ const c = o.getMeta("applyInputRules");
2184
+ return c && setTimeout(() => {
2185
+ let { text: f } = c;
2186
+ typeof f == "string" ? f = f : f = ut(D.from(f), i.schema);
2187
+ const { from: u } = c, p = u + f.length;
2188
+ Z({
2189
+ editor: e,
2190
+ from: u,
2191
+ to: p,
2192
+ text: f,
2193
+ rules: n,
2194
+ plugin: r
2195
+ });
2196
+ }), o.selectionSet || o.docChanged ? null : s;
2197
+ }
2198
+ },
2199
+ props: {
2200
+ handleTextInput(o, s, i, a) {
2201
+ return Z({
2202
+ editor: e,
2203
+ from: s,
2204
+ to: i,
2205
+ text: a,
2206
+ rules: n,
2207
+ plugin: r
2208
+ });
2209
+ },
2210
+ handleDOMEvents: {
2211
+ compositionend: (o) => (setTimeout(() => {
2212
+ const { $cursor: s } = o.state.selection;
2213
+ s && Z({
2214
+ editor: e,
2215
+ from: s.pos,
2216
+ to: s.pos,
2217
+ text: "",
2218
+ rules: n,
2219
+ plugin: r
2220
+ });
2221
+ }), !1)
2222
+ },
2223
+ // add support for input rules to trigger on enter
2224
+ // this is useful for example for code blocks
2225
+ handleKeyDown(o, s) {
2226
+ if (s.key !== "Enter")
2227
+ return !1;
2228
+ const { $cursor: i } = o.state.selection;
2229
+ return i ? Z({
2230
+ editor: e,
2231
+ from: i.pos,
2232
+ to: i.pos,
2233
+ text: `
2234
+ `,
2235
+ rules: n,
2236
+ plugin: r
2237
+ }) : !1;
2238
+ }
2239
+ },
2240
+ // @ts-ignore
2241
+ isInputRules: !0
2242
+ });
2243
+ return r;
2244
+ }
2245
+ var Ct = class {
2246
+ constructor(t = {}) {
2247
+ this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = {
2248
+ name: this.name
2249
+ }, this.config = {
2250
+ ...this.config,
2251
+ ...t
2252
+ }, this.name = this.config.name;
2253
+ }
2254
+ get options() {
2255
+ return {
2256
+ ...x(
2257
+ b(this, "addOptions", {
2258
+ name: this.name
2259
+ })
2260
+ )
2261
+ };
2262
+ }
2263
+ get storage() {
2264
+ return {
2265
+ ...x(
2266
+ b(this, "addStorage", {
2267
+ name: this.name,
2268
+ options: this.options
2269
+ })
2270
+ )
2271
+ };
2272
+ }
2273
+ configure(t = {}) {
2274
+ const e = this.extend({
2275
+ ...this.config,
2276
+ addOptions: () => ie(this.options, t)
2277
+ });
2278
+ return e.name = this.name, e.parent = this.parent, this.child = null, e;
2279
+ }
2280
+ extend(t = {}) {
2281
+ const e = new this.constructor({ ...this.config, ...t });
2282
+ return e.parent = this, this.child = e, e.name = "name" in t ? t.name : e.parent.name, e;
2283
+ }
2284
+ }, Kr = class ae extends Ct {
2285
+ constructor() {
2286
+ super(...arguments), this.type = "mark";
2287
+ }
2288
+ /**
2289
+ * Create a new Mark instance
2290
+ * @param config - Mark configuration object or a function that returns a configuration object
2291
+ */
2292
+ static create(e = {}) {
2293
+ const n = typeof e == "function" ? e() : e;
2294
+ return new ae(n);
2295
+ }
2296
+ static handleExit({ editor: e, mark: n }) {
2297
+ const { tr: r } = e.state, o = e.state.selection.$from;
2298
+ if (o.pos === o.end()) {
2299
+ const i = o.marks();
2300
+ if (!!!i.find((l) => l?.type.name === n.name))
2301
+ return !1;
2302
+ const c = i.find((l) => l?.type.name === n.name);
2303
+ return c && r.removeStoredMark(c), r.insertText(" ", o.pos), e.view.dispatch(r), !0;
2304
+ }
2305
+ return !1;
2306
+ }
2307
+ configure(e) {
2308
+ return super.configure(e);
2309
+ }
2310
+ extend(e) {
2311
+ const n = typeof e == "function" ? e() : e;
2312
+ return super.extend(n);
2313
+ }
2314
+ }, Qr = class {
2315
+ constructor(t) {
2316
+ this.find = t.find, this.handler = t.handler;
2317
+ }
2318
+ }, Gr = (t, e, n) => {
2319
+ if (kt(e))
2320
+ return [...t.matchAll(e)];
2321
+ const r = e(t, n);
2322
+ return r ? r.map((o) => {
2323
+ const s = [o.text];
2324
+ return s.index = o.index, s.input = t, s.data = o.data, o.replaceWith && (o.text.includes(o.replaceWith) || console.warn(
2325
+ '[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'
2326
+ ), s.push(o.replaceWith)), s;
1931
2327
  }) : [];
1932
2328
  };
1933
- function Lr(t) {
2329
+ function Zr(t) {
1934
2330
  const { editor: e, state: n, from: r, to: o, rule: s, pasteEvent: i, dropEvent: a } = t, { commands: c, chain: l, can: f } = new at({
1935
2331
  editor: e,
1936
2332
  state: n
@@ -1943,16 +2339,16 @@ function Lr(t) {
1943
2339
  if (k >= S)
1944
2340
  return;
1945
2341
  const E = d.isText ? d.text || "" : d.textBetween(k - h, S - h, void 0, "");
1946
- _r(E, s.find, i).forEach((C) => {
1947
- if (C.index === void 0)
2342
+ Gr(E, s.find, i).forEach((A) => {
2343
+ if (A.index === void 0)
1948
2344
  return;
1949
- const $ = k + C.index + 1, H = $ + C[0].length, L = {
2345
+ const $ = k + A.index + 1, H = $ + A[0].length, L = {
1950
2346
  from: n.tr.mapping.map($),
1951
2347
  to: n.tr.mapping.map(H)
1952
2348
  }, I = s.handler({
1953
2349
  state: n,
1954
2350
  range: L,
1955
- match: C,
2351
+ match: A,
1956
2352
  commands: c,
1957
2353
  chain: l,
1958
2354
  can: f,
@@ -1963,14 +2359,14 @@ function Lr(t) {
1963
2359
  });
1964
2360
  }), u.every((d) => d !== null);
1965
2361
  }
1966
- var Y = null, zr = (t) => {
2362
+ var Y = null, Yr = (t) => {
1967
2363
  var e;
1968
2364
  const n = new ClipboardEvent("paste", {
1969
2365
  clipboardData: new DataTransfer()
1970
2366
  });
1971
2367
  return (e = n.clipboardData) == null || e.setData("text/html", t), n;
1972
2368
  };
1973
- function Fr(t) {
2369
+ function Xr(t) {
1974
2370
  const { editor: e, rules: n } = t;
1975
2371
  let r = null, o = !1, s = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a;
1976
2372
  try {
@@ -1989,7 +2385,7 @@ function Fr(t) {
1989
2385
  state: f,
1990
2386
  transaction: m
1991
2387
  });
1992
- if (!(!Lr({
2388
+ if (!(!Zr({
1993
2389
  editor: e,
1994
2390
  state: g,
1995
2391
  from: Math.max(u - 1, 0),
@@ -2050,17 +2446,17 @@ function Fr(t) {
2050
2446
  if (y) {
2051
2447
  let { text: k } = v;
2052
2448
  typeof k == "string" ? k = k : k = ut(D.from(k), d.schema);
2053
- const { from: S } = v, E = S + k.length, A = zr(k);
2449
+ const { from: S } = v, E = S + k.length, C = Yr(k);
2054
2450
  return c({
2055
2451
  rule: f,
2056
2452
  state: d,
2057
2453
  from: S,
2058
2454
  to: { b: E },
2059
- pasteEvt: A
2455
+ pasteEvt: C
2060
2456
  });
2061
2457
  }
2062
2458
  const w = p.doc.content.findDiffStart(d.doc.content), M = p.doc.content.findDiffEnd(d.doc.content);
2063
- if (!(!Br(w) || !M || w === M.b))
2459
+ if (!(!jr(w) || !M || w === M.b))
2064
2460
  return c({
2065
2461
  rule: f,
2066
2462
  state: d,
@@ -2073,7 +2469,7 @@ function Fr(t) {
2073
2469
  }
2074
2470
  var ft = class {
2075
2471
  constructor(t, e) {
2076
- this.splittableMarks = [], this.nonClearableMarks = [], this.editor = e, this.baseExtensions = t, this.extensions = xt(t), this.schema = Gt(this.extensions, e), this.setupExtensions();
2472
+ this.splittableMarks = [], this.nonClearableMarks = [], this.editor = e, this.baseExtensions = t, this.extensions = xt(t), this.schema = Yt(this.extensions, e), this.setupExtensions();
2077
2473
  }
2078
2474
  /**
2079
2475
  * Get all commands from the extensions.
@@ -2117,13 +2513,13 @@ var ft = class {
2117
2513
  o
2118
2514
  );
2119
2515
  let a = {};
2120
- if (r.type === "mark" && b(r, "exitable", o) && (a.ArrowRight = () => jr.handleExit({ editor: t, mark: r })), i) {
2516
+ if (r.type === "mark" && b(r, "exitable", o) && (a.ArrowRight = () => Kr.handleExit({ editor: t, mark: r })), i) {
2121
2517
  const p = Object.fromEntries(
2122
2518
  Object.entries(i()).map(([d, h]) => [d, () => h({ editor: t })])
2123
2519
  );
2124
2520
  a = { ...a, ...p };
2125
2521
  }
2126
- const c = Ze(a);
2522
+ const c = Ye(a);
2127
2523
  s.push(c);
2128
2524
  const l = b(
2129
2525
  r,
@@ -2133,7 +2529,7 @@ var ft = class {
2133
2529
  if (Dt(r, t.options.enableInputRules) && l) {
2134
2530
  const p = l();
2135
2531
  if (p && p.length) {
2136
- const d = Rr({
2532
+ const d = Jr({
2137
2533
  editor: t,
2138
2534
  rules: p
2139
2535
  }), h = Array.isArray(d) ? d : [d];
@@ -2148,7 +2544,7 @@ var ft = class {
2148
2544
  if (Dt(r, t.options.enablePasteRules) && f) {
2149
2545
  const p = f();
2150
2546
  if (p && p.length) {
2151
- const d = Fr({ editor: t, rules: p });
2547
+ const d = Xr({ editor: t, rules: p });
2152
2548
  s.push(...d);
2153
2549
  }
2154
2550
  }
@@ -2299,7 +2695,7 @@ var ft = class {
2299
2695
  extension: n,
2300
2696
  HTMLAttributes: f,
2301
2697
  updateAttributes: (u) => {
2302
- to(a, t, u);
2698
+ Ur(a, t, u);
2303
2699
  }
2304
2700
  });
2305
2701
  };
@@ -2370,21 +2766,21 @@ var ft = class {
2370
2766
  ft.resolve = xt;
2371
2767
  ft.sort = J;
2372
2768
  ft.flatten = Mt;
2373
- var Vr = {};
2374
- yt(Vr, {
2375
- ClipboardTextSerializer: () => ae,
2376
- Commands: () => ce,
2377
- Delete: () => le,
2378
- Drop: () => ue,
2379
- Editable: () => de,
2380
- FocusEvents: () => pe,
2381
- Keymap: () => me,
2382
- Paste: () => he,
2383
- Tabindex: () => ge,
2384
- TextDirection: () => ve,
2385
- focusEventsPluginKey: () => fe
2769
+ var to = {};
2770
+ yt(to, {
2771
+ ClipboardTextSerializer: () => le,
2772
+ Commands: () => ue,
2773
+ Delete: () => de,
2774
+ Drop: () => fe,
2775
+ Editable: () => pe,
2776
+ FocusEvents: () => he,
2777
+ Keymap: () => ge,
2778
+ Paste: () => ve,
2779
+ Tabindex: () => be,
2780
+ TextDirection: () => ye,
2781
+ focusEventsPluginKey: () => me
2386
2782
  });
2387
- var j = class ie extends Et {
2783
+ var j = class ce extends Ct {
2388
2784
  constructor() {
2389
2785
  super(...arguments), this.type = "extension";
2390
2786
  }
@@ -2394,7 +2790,7 @@ var j = class ie extends Et {
2394
2790
  */
2395
2791
  static create(e = {}) {
2396
2792
  const n = typeof e == "function" ? e() : e;
2397
- return new ie(n);
2793
+ return new ce(n);
2398
2794
  }
2399
2795
  configure(e) {
2400
2796
  return super.configure(e);
@@ -2403,7 +2799,7 @@ var j = class ie extends Et {
2403
2799
  const n = typeof e == "function" ? e() : e;
2404
2800
  return super.extend(n);
2405
2801
  }
2406
- }, ae = j.create({
2802
+ }, le = j.create({
2407
2803
  name: "clipboardTextSerializer",
2408
2804
  addOptions() {
2409
2805
  return {
@@ -2416,12 +2812,12 @@ var j = class ie extends Et {
2416
2812
  key: new _("clipboardTextSerializer"),
2417
2813
  props: {
2418
2814
  clipboardTextSerializer: () => {
2419
- const { editor: t } = this, { state: e, schema: n } = t, { doc: r, selection: o } = e, s = te(n), { blockSeparator: i } = this.options, a = {
2815
+ const { editor: t } = this, { state: e, schema: n } = t, { doc: r, selection: o } = e, s = ee(n), { blockSeparator: i } = this.options, a = {
2420
2816
  ...i !== void 0 ? { blockSeparator: i } : {},
2421
2817
  textSerializers: s
2422
2818
  };
2423
2819
  return [...o.ranges].sort((l, f) => l.$from.pos - f.$from.pos).map(
2424
- ({ $from: l, $to: f }) => Xt(r, { from: l.pos, to: f.pos }, a)
2820
+ ({ $from: l, $to: f }) => te(r, { from: l.pos, to: f.pos }, a)
2425
2821
  ).join(i ?? `
2426
2822
 
2427
2823
  `);
@@ -2430,14 +2826,14 @@ var j = class ie extends Et {
2430
2826
  })
2431
2827
  ];
2432
2828
  }
2433
- }), ce = j.create({
2829
+ }), ue = j.create({
2434
2830
  name: "commands",
2435
2831
  addCommands() {
2436
2832
  return {
2437
- ...Vt
2833
+ ...Ht
2438
2834
  };
2439
2835
  }
2440
- }), le = j.create({
2836
+ }), de = j.create({
2441
2837
  name: "delete",
2442
2838
  onUpdate({ transaction: t, appendedTransactions: e }) {
2443
2839
  var n, r, o;
@@ -2445,11 +2841,11 @@ var j = class ie extends Et {
2445
2841
  var i, a, c, l;
2446
2842
  if ((l = (c = (a = (i = this.editor.options.coreExtensionOptions) == null ? void 0 : i.delete) == null ? void 0 : a.filterTransaction) == null ? void 0 : c.call(a, t)) != null ? l : t.getMeta("y-sync$"))
2447
2843
  return;
2448
- const f = Un(t.before, [
2844
+ const f = Jn(t.before, [
2449
2845
  t,
2450
2846
  ...e
2451
2847
  ]);
2452
- or(f).forEach((d) => {
2848
+ ir(f).forEach((d) => {
2453
2849
  f.mapping.mapResult(d.oldRange.from).deletedAfter && f.mapping.mapResult(d.oldRange.to).deletedBefore && f.before.nodesBetween(
2454
2850
  d.oldRange.from,
2455
2851
  d.oldRange.to,
@@ -2475,7 +2871,7 @@ var j = class ie extends Et {
2475
2871
  const p = f.mapping;
2476
2872
  f.steps.forEach((d, h) => {
2477
2873
  var m, g;
2478
- if (d instanceof we) {
2874
+ if (d instanceof xe) {
2479
2875
  const v = p.slice(h).map(d.from, -1), y = p.slice(h).map(d.to), w = p.invert().map(v, -1), M = p.invert().map(y), k = v > 0 ? (m = f.doc.nodeAt(v - 1)) == null ? void 0 : m.marks.some((E) => E.eq(d.mark)) : !1, S = (g = f.doc.nodeAt(y)) == null ? void 0 : g.marks.some((E) => E.eq(d.mark));
2480
2876
  this.editor.emit("delete", {
2481
2877
  type: "mark",
@@ -2500,7 +2896,7 @@ var j = class ie extends Et {
2500
2896
  };
2501
2897
  (o = (r = (n = this.editor.options.coreExtensionOptions) == null ? void 0 : n.delete) == null ? void 0 : r.async) == null || o ? setTimeout(s, 0) : s();
2502
2898
  }
2503
- }), ue = j.create({
2899
+ }), fe = j.create({
2504
2900
  name: "drop",
2505
2901
  addProseMirrorPlugins() {
2506
2902
  return [
@@ -2519,7 +2915,7 @@ var j = class ie extends Et {
2519
2915
  })
2520
2916
  ];
2521
2917
  }
2522
- }), de = j.create({
2918
+ }), pe = j.create({
2523
2919
  name: "editable",
2524
2920
  addProseMirrorPlugins() {
2525
2921
  return [
@@ -2531,13 +2927,13 @@ var j = class ie extends Et {
2531
2927
  })
2532
2928
  ];
2533
2929
  }
2534
- }), fe = new _("focusEvents"), pe = j.create({
2930
+ }), me = new _("focusEvents"), he = j.create({
2535
2931
  name: "focusEvents",
2536
2932
  addProseMirrorPlugins() {
2537
2933
  const { editor: t } = this;
2538
2934
  return [
2539
2935
  new O({
2540
- key: fe,
2936
+ key: me,
2541
2937
  props: {
2542
2938
  handleDOMEvents: {
2543
2939
  focus: (e, n) => {
@@ -2555,7 +2951,7 @@ var j = class ie extends Et {
2555
2951
  })
2556
2952
  ];
2557
2953
  }
2558
- }), me = j.create({
2954
+ }), ge = j.create({
2559
2955
  name: "keymap",
2560
2956
  addKeyboardShortcuts() {
2561
2957
  const t = () => this.editor.commands.first(({ commands: i }) => [
@@ -2600,7 +2996,7 @@ var j = class ie extends Et {
2600
2996
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2601
2997
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2602
2998
  };
2603
- return rt() || Jt() ? s : o;
2999
+ return rt() || Kt() ? s : o;
2604
3000
  },
2605
3001
  addProseMirrorPlugins() {
2606
3002
  return [
@@ -2635,7 +3031,7 @@ var j = class ie extends Et {
2635
3031
  })
2636
3032
  ];
2637
3033
  }
2638
- }), he = j.create({
3034
+ }), ve = j.create({
2639
3035
  name: "paste",
2640
3036
  addProseMirrorPlugins() {
2641
3037
  return [
@@ -2653,7 +3049,7 @@ var j = class ie extends Et {
2653
3049
  })
2654
3050
  ];
2655
3051
  }
2656
- }), ge = j.create({
3052
+ }), be = j.create({
2657
3053
  name: "tabindex",
2658
3054
  addOptions() {
2659
3055
  return {
@@ -2673,7 +3069,7 @@ var j = class ie extends Et {
2673
3069
  })
2674
3070
  ];
2675
3071
  }
2676
- }), ve = j.create({
3072
+ }), ye = j.create({
2677
3073
  name: "textDirection",
2678
3074
  addOptions() {
2679
3075
  return {
@@ -2717,7 +3113,7 @@ var j = class ie extends Et {
2717
3113
  })
2718
3114
  ];
2719
3115
  }
2720
- }), Hr = class q {
3116
+ }), eo = class q {
2721
3117
  constructor(e, n, r = !1, o = null) {
2722
3118
  this.currentNode = null, this.actualDepth = null, this.isBlock = r, this.resolvedPos = e, this.editor = n, this.currentNode = o;
2723
3119
  }
@@ -2851,7 +3247,7 @@ var j = class ie extends Et {
2851
3247
  ...e
2852
3248
  }), this.editor.view.dispatch(n);
2853
3249
  }
2854
- }, Wr = `.ProseMirror {
3250
+ }, no = `.ProseMirror {
2855
3251
  position: relative;
2856
3252
  }
2857
3253
 
@@ -2921,15 +3317,7 @@ img.ProseMirror-separator {
2921
3317
 
2922
3318
  .ProseMirror-focused .ProseMirror-gapcursor {
2923
3319
  display: block;
2924
- }`;
2925
- function Ur(t, e, n) {
2926
- const r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
2927
- if (r !== null)
2928
- return r;
2929
- const o = document.createElement("style");
2930
- return e && o.setAttribute("nonce", e), o.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), o.innerHTML = t, document.getElementsByTagName("head")[0].appendChild(o), o;
2931
- }
2932
- var go = class extends Nr {
3320
+ }`, yo = class extends Rr {
2933
3321
  constructor(t = {}) {
2934
3322
  super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.options = {
2935
3323
  element: typeof document < "u" ? document.createElement("div") : null,
@@ -2966,11 +3354,11 @@ var go = class extends Nr {
2966
3354
  onDelete: () => null,
2967
3355
  enableExtensionDispatchTransaction: !0
2968
3356
  }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
2969
- getUpdatedPosition: ar,
2970
- createMappablePosition: cr
3357
+ getUpdatedPosition: lr,
3358
+ createMappablePosition: ur
2971
3359
  }, 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);
2972
- const e = this.createDoc(), n = Ut(e, this.options.autofocus);
2973
- this.editorState = Ve.create({
3360
+ const e = this.createDoc(), n = qt(e, this.options.autofocus);
3361
+ this.editorState = We.create({
2974
3362
  doc: e,
2975
3363
  schema: this.schema,
2976
3364
  selection: n || void 0
@@ -3032,7 +3420,7 @@ var go = class extends Nr {
3032
3420
  * Inject CSS styles.
3033
3421
  */
3034
3422
  injectCSS() {
3035
- this.options.injectCSS && typeof document < "u" && (this.css = Ur(Wr, this.options.injectNonce));
3423
+ this.options.injectCSS && typeof document < "u" && (this.css = Or(no, this.options.injectNonce));
3036
3424
  }
3037
3425
  /**
3038
3426
  * Update editor options.
@@ -3105,7 +3493,7 @@ var go = class extends Nr {
3105
3493
  * @returns The new editor state
3106
3494
  */
3107
3495
  registerPlugin(t, e) {
3108
- const n = Qt(e) ? e(t, [...this.state.plugins]) : [...this.state.plugins, t], r = this.state.reconfigure({ plugins: n });
3496
+ const n = Gt(e) ? e(t, [...this.state.plugins]) : [...this.state.plugins, t], r = this.state.reconfigure({ plugins: n });
3109
3497
  return this.view.updateState(r), r;
3110
3498
  }
3111
3499
  /**
@@ -3135,20 +3523,20 @@ var go = class extends Nr {
3135
3523
  createExtensionManager() {
3136
3524
  var t, e, n, r;
3137
3525
  const s = [...this.options.enableCoreExtensions ? [
3138
- de,
3139
- ae.configure({
3140
- blockSeparator: (e = (t = this.options.coreExtensionOptions) == null ? void 0 : t.clipboardTextSerializer) == null ? void 0 : e.blockSeparator
3141
- }),
3142
- ce,
3143
3526
  pe,
3144
- me,
3145
- ge.configure({
3146
- value: (r = (n = this.options.coreExtensionOptions) == null ? void 0 : n.tabindex) == null ? void 0 : r.value
3527
+ le.configure({
3528
+ blockSeparator: (e = (t = this.options.coreExtensionOptions) == null ? void 0 : t.clipboardTextSerializer) == null ? void 0 : e.blockSeparator
3147
3529
  }),
3148
3530
  ue,
3149
3531
  he,
3150
- le,
3151
- ve.configure({
3532
+ ge,
3533
+ be.configure({
3534
+ value: (r = (n = this.options.coreExtensionOptions) == null ? void 0 : n.tabindex) == null ? void 0 : r.value
3535
+ }),
3536
+ fe,
3537
+ ve,
3538
+ de,
3539
+ ye.configure({
3152
3540
  direction: this.options.textDirection
3153
3541
  })
3154
3542
  ].filter((i) => typeof this.options.enableCoreExtensions == "object" ? this.options.enableCoreExtensions[i.name] !== !1 : !0) : [], ...this.options.extensions].filter((i) => ["extension", "node", "mark"].includes(i?.type));
@@ -3201,7 +3589,7 @@ var go = class extends Nr {
3201
3589
  */
3202
3590
  createView(t) {
3203
3591
  const { editorProps: e, enableExtensionDispatchTransaction: n } = this.options, r = e.dispatchTransaction || this.dispatchTransaction.bind(this), o = n ? this.extensionManager.dispatchTransaction(r) : r, s = e.transformPastedHTML, i = this.extensionManager.transformPastedHTML(s);
3204
- this.editorView = new Qe(t, {
3592
+ this.editorView = new Ze(t, {
3205
3593
  ...e,
3206
3594
  attributes: {
3207
3595
  // add `role="textbox"` to the editor element
@@ -3296,11 +3684,11 @@ var go = class extends Nr {
3296
3684
  * Get attributes of the currently selected node or mark.
3297
3685
  */
3298
3686
  getAttributes(t) {
3299
- return er(this.state, t);
3687
+ return rr(this.state, t);
3300
3688
  }
3301
3689
  isActive(t, e) {
3302
3690
  const n = typeof t == "string" ? t : null, r = typeof t == "string" ? e : t;
3303
- return ir(this.state, n, r);
3691
+ return cr(this.state, n, r);
3304
3692
  }
3305
3693
  /**
3306
3694
  * Get the document as JSON.
@@ -3321,10 +3709,10 @@ var go = class extends Nr {
3321
3709
  const { blockSeparator: e = `
3322
3710
 
3323
3711
  `, textSerializers: n = {} } = t || {};
3324
- return Xn(this.state.doc, {
3712
+ return er(this.state.doc, {
3325
3713
  blockSeparator: e,
3326
3714
  textSerializers: {
3327
- ...te(this.schema),
3715
+ ...ee(this.schema),
3328
3716
  ...n
3329
3717
  }
3330
3718
  });
@@ -3357,477 +3745,95 @@ var go = class extends Nr {
3357
3745
  return ((n = this.$doc) == null ? void 0 : n.querySelectorAll(t, e)) || null;
3358
3746
  }
3359
3747
  $pos(t) {
3360
- const e = this.state.doc.resolve(t), n = t > 0 && e.nodeAfter && !e.nodeAfter.isText ? e.nodeAfter : null;
3361
- return new Hr(e, this, !1, n);
3362
- }
3363
- get $doc() {
3364
- return this.$pos(0);
3365
- }
3366
- };
3367
- function vo(t) {
3368
- return new dt({
3369
- find: t.find,
3370
- handler: ({ state: e, range: n, match: r }) => {
3371
- const o = x(t.getAttributes, void 0, r);
3372
- if (o === !1 || o === null)
3373
- return null;
3374
- const { tr: s } = e, i = r[r.length - 1], a = r[0];
3375
- if (i) {
3376
- const c = a.search(/\S/), l = n.from + a.indexOf(i), f = l + i.length;
3377
- if (ee(n.from, n.to, e.doc).filter((d) => d.mark.type.excluded.find((m) => m === t.type && m !== d.mark.type)).filter((d) => d.to > l).length)
3378
- return null;
3379
- f < n.to && s.delete(f, n.to), l > n.from && s.delete(n.from + c, l);
3380
- const p = n.from + c + i.length;
3381
- s.addMark(n.from + c, p, t.type.create(o || {})), s.removeStoredMark(t.type);
3382
- }
3383
- },
3384
- undoable: t.undoable
3385
- });
3386
- }
3387
- function bo(t) {
3388
- return new dt({
3389
- find: t.find,
3390
- handler: ({ state: e, range: n, match: r }) => {
3391
- const o = x(t.getAttributes, void 0, r) || {}, { tr: s } = e, i = n.from;
3392
- let a = n.to;
3393
- const c = t.type.create(o);
3394
- if (r[1]) {
3395
- const l = r[0].lastIndexOf(r[1]);
3396
- let f = i + l;
3397
- f > a ? f = a : a = f + r[1].length;
3398
- const u = r[0][r[0].length - 1];
3399
- s.insertText(u, i + r[0].length - 1), s.replaceWith(f, a, c);
3400
- } else if (r[0]) {
3401
- const l = t.type.isInline ? i : i - 1;
3402
- s.insert(l, t.type.create(o)).delete(
3403
- s.mapping.map(i),
3404
- s.mapping.map(a)
3405
- );
3406
- }
3407
- s.scrollIntoView();
3408
- },
3409
- undoable: t.undoable
3410
- });
3411
- }
3412
- function yo(t) {
3413
- return new dt({
3414
- find: t.find,
3415
- handler: ({ state: e, range: n, match: r }) => {
3416
- const o = e.doc.resolve(n.from), s = x(t.getAttributes, void 0, r) || {};
3417
- if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), t.type))
3418
- return null;
3419
- e.tr.delete(n.from, n.to).setBlockType(n.from, n.from, t.type, s);
3420
- },
3421
- undoable: t.undoable
3422
- });
3423
- }
3424
- function ko(t) {
3425
- return new dt({
3426
- find: t.find,
3427
- handler: ({ state: e, range: n, match: r, chain: o }) => {
3428
- const s = x(t.getAttributes, void 0, r) || {}, i = e.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && ye(c, t.type, s);
3429
- if (!l)
3430
- return null;
3431
- if (i.wrap(c, l), t.keepMarks && t.editor) {
3432
- const { selection: u, storedMarks: p } = e, { splittableMarks: d } = t.editor.extensionManager, h = p || u.$to.parentOffset && u.$from.marks();
3433
- if (h) {
3434
- const m = h.filter((g) => d.includes(g.type.name));
3435
- i.ensureMarks(m);
3436
- }
3437
- }
3438
- if (t.keepAttributes) {
3439
- const u = t.type.name === "bulletList" || t.type.name === "orderedList" ? "listItem" : "taskList";
3440
- o().updateAttributes(u, s).run();
3441
- }
3442
- const f = i.doc.resolve(n.from - 1).nodeBefore;
3443
- f && f.type === t.type && bt(i.doc, n.from - 1) && (!t.joinPredicate || t.joinPredicate(r, f)) && i.join(n.from - 1);
3444
- },
3445
- undoable: t.undoable
3446
- });
3447
- }
3448
- function wo(t, e) {
3449
- const { selection: n } = t, { $from: r } = n;
3450
- if (n instanceof st) {
3451
- const s = r.index();
3452
- return r.parent.canReplaceWith(s, s + 1, e);
3453
- }
3454
- let o = r.depth;
3455
- for (; o >= 0; ) {
3456
- const s = r.index(o);
3457
- if (r.node(o).contentMatchAt(s).matchType(e))
3458
- return !0;
3459
- o -= 1;
3460
- }
3461
- return !1;
3462
- }
3463
- var qr = {};
3464
- yt(qr, {
3465
- createAtomBlockMarkdownSpec: () => Jr,
3466
- createBlockMarkdownSpec: () => Kr,
3467
- createInlineMarkdownSpec: () => Gr,
3468
- parseAttributes: () => Tt,
3469
- parseIndentedBlocks: () => Yr,
3470
- renderNestedMarkdownContent: () => Xr,
3471
- serializeAttributes: () => At
3472
- });
3473
- function Tt(t) {
3474
- if (!t?.trim())
3475
- return {};
3476
- const e = {}, n = [], r = t.replace(/["']([^"']*)["']/g, (l) => (n.push(l), `__QUOTED_${n.length - 1}__`)), o = r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);
3477
- if (o) {
3478
- const l = o.map((f) => f.trim().slice(1));
3479
- e.class = l.join(" ");
3480
- }
3481
- const s = r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);
3482
- s && (e.id = s[1]);
3483
- const i = /([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;
3484
- Array.from(r.matchAll(i)).forEach(([, l, f]) => {
3485
- var u;
3486
- const p = parseInt(((u = f.match(/__QUOTED_(\d+)__/)) == null ? void 0 : u[1]) || "0", 10), d = n[p];
3487
- d && (e[l] = d.slice(1, -1));
3488
- });
3489
- const c = 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();
3490
- return c && c.split(/\s+/).filter(Boolean).forEach((f) => {
3491
- f.match(/^[a-zA-Z][\w-]*$/) && (e[f] = !0);
3492
- }), e;
3493
- }
3494
- function At(t) {
3495
- if (!t || Object.keys(t).length === 0)
3496
- return "";
3497
- const e = [];
3498
- 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]) => {
3499
- n === "class" || n === "id" || (r === !0 ? e.push(n) : r !== !1 && r != null && e.push(`${n}="${String(r)}"`));
3500
- }), e.join(" ");
3501
- }
3502
- function Jr(t) {
3503
- const {
3504
- nodeName: e,
3505
- name: n,
3506
- parseAttributes: r = Tt,
3507
- serializeAttributes: o = At,
3508
- defaultAttributes: s = {},
3509
- requiredAttributes: i = [],
3510
- allowedAttributes: a
3511
- } = t, c = n || e, l = (f) => {
3512
- if (!a)
3513
- return f;
3514
- const u = {};
3515
- return a.forEach((p) => {
3516
- p in f && (u[p] = f[p]);
3517
- }), u;
3518
- };
3519
- return {
3520
- parseMarkdown: (f, u) => {
3521
- const p = { ...s, ...f.attributes };
3522
- return u.createNode(e, p, []);
3523
- },
3524
- markdownTokenizer: {
3525
- name: e,
3526
- level: "block",
3527
- start(f) {
3528
- var u;
3529
- const p = new RegExp(`^:::${c}(?:\\s|$)`, "m"), d = (u = f.match(p)) == null ? void 0 : u.index;
3530
- return d !== void 0 ? d : -1;
3531
- },
3532
- tokenize(f, u, p) {
3533
- const d = new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), h = f.match(d);
3534
- if (!h)
3535
- return;
3536
- const m = h[1] || "", g = r(m);
3537
- if (!i.find((y) => !(y in g)))
3538
- return {
3539
- type: e,
3540
- raw: h[0],
3541
- attributes: g
3542
- };
3543
- }
3544
- },
3545
- renderMarkdown: (f) => {
3546
- const u = l(f.attrs || {}), p = o(u), d = p ? ` {${p}}` : "";
3547
- return `:::${c}${d} :::`;
3548
- }
3549
- };
3550
- }
3551
- function Kr(t) {
3552
- const {
3553
- nodeName: e,
3554
- name: n,
3555
- getContent: r,
3556
- parseAttributes: o = Tt,
3557
- serializeAttributes: s = At,
3558
- defaultAttributes: i = {},
3559
- content: a = "block",
3560
- allowedAttributes: c
3561
- } = t, l = n || e, f = (u) => {
3562
- if (!c)
3563
- return u;
3564
- const p = {};
3565
- return c.forEach((d) => {
3566
- d in u && (p[d] = u[d]);
3567
- }), p;
3568
- };
3569
- return {
3570
- parseMarkdown: (u, p) => {
3571
- let d;
3572
- if (r) {
3573
- const m = r(u);
3574
- d = typeof m == "string" ? [{ type: "text", text: m }] : m;
3575
- } else a === "block" ? d = p.parseChildren(u.tokens || []) : d = p.parseInline(u.tokens || []);
3576
- const h = { ...i, ...u.attributes };
3577
- return p.createNode(e, h, d);
3578
- },
3579
- markdownTokenizer: {
3580
- name: e,
3581
- level: "block",
3582
- start(u) {
3583
- var p;
3584
- const d = new RegExp(`^:::${l}`, "m"), h = (p = u.match(d)) == null ? void 0 : p.index;
3585
- return h !== void 0 ? h : -1;
3586
- },
3587
- tokenize(u, p, d) {
3588
- var h;
3589
- const m = new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), g = u.match(m);
3590
- if (!g)
3591
- return;
3592
- const [v, y = ""] = g, w = o(y);
3593
- let M = 1;
3594
- const k = v.length;
3595
- let S = "";
3596
- const E = /^:::([\w-]*)(\s.*)?/gm, A = u.slice(k);
3597
- for (E.lastIndex = 0; ; ) {
3598
- const C = E.exec(A);
3599
- if (C === null)
3600
- break;
3601
- const $ = C.index, H = C[1];
3602
- if (!((h = C[2]) != null && h.endsWith(":::"))) {
3603
- if (H)
3604
- M += 1;
3605
- else if (M -= 1, M === 0) {
3606
- const L = A.slice(0, $);
3607
- S = L.trim();
3608
- const I = u.slice(0, k + $ + C[0].length);
3609
- let N = [];
3610
- if (S)
3611
- if (a === "block")
3612
- for (N = d.blockTokens(L), N.forEach((P) => {
3613
- P.text && (!P.tokens || P.tokens.length === 0) && (P.tokens = d.inlineTokens(P.text));
3614
- }); N.length > 0; ) {
3615
- const P = N[N.length - 1];
3616
- if (P.type === "paragraph" && (!P.text || P.text.trim() === ""))
3617
- N.pop();
3618
- else
3619
- break;
3620
- }
3621
- else
3622
- N = d.inlineTokens(S);
3623
- return {
3624
- type: e,
3625
- raw: I,
3626
- attributes: w,
3627
- content: S,
3628
- tokens: N
3629
- };
3630
- }
3631
- }
3632
- }
3748
+ const e = this.state.doc.resolve(t), n = t > 0 && e.nodeAfter && !e.nodeAfter.isText ? e.nodeAfter : null;
3749
+ return new eo(e, this, !1, n);
3750
+ }
3751
+ get $doc() {
3752
+ return this.$pos(0);
3753
+ }
3754
+ };
3755
+ function ko(t) {
3756
+ return new dt({
3757
+ find: t.find,
3758
+ handler: ({ state: e, range: n, match: r }) => {
3759
+ const o = x(t.getAttributes, void 0, r);
3760
+ if (o === !1 || o === null)
3761
+ return null;
3762
+ const { tr: s } = e, i = r[r.length - 1], a = r[0];
3763
+ if (i) {
3764
+ const c = a.search(/\S/), l = n.from + a.indexOf(i), f = l + i.length;
3765
+ if (ne(n.from, n.to, e.doc).filter((d) => d.mark.type.excluded.find((m) => m === t.type && m !== d.mark.type)).filter((d) => d.to > l).length)
3766
+ return null;
3767
+ f < n.to && s.delete(f, n.to), l > n.from && s.delete(n.from + c, l);
3768
+ const p = n.from + c + i.length;
3769
+ s.addMark(n.from + c, p, t.type.create(o || {})), s.removeStoredMark(t.type);
3633
3770
  }
3634
3771
  },
3635
- renderMarkdown: (u, p) => {
3636
- const d = f(u.attrs || {}), h = s(d), m = h ? ` {${h}}` : "", g = p.renderChildren(u.content || [], `
3637
-
3638
- `);
3639
- return `:::${l}${m}
3640
-
3641
- ${g}
3642
-
3643
- :::`;
3644
- }
3645
- };
3646
- }
3647
- function Qr(t) {
3648
- if (!t.trim())
3649
- return {};
3650
- const e = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
3651
- let r = n.exec(t);
3652
- for (; r !== null; ) {
3653
- const [, o, s, i] = r;
3654
- e[o] = s || i, r = n.exec(t);
3655
- }
3656
- return e;
3657
- }
3658
- function Zr(t) {
3659
- return Object.entries(t).filter(([, e]) => e != null).map(([e, n]) => `${e}="${n}"`).join(" ");
3772
+ undoable: t.undoable
3773
+ });
3660
3774
  }
3661
- function Gr(t) {
3662
- const {
3663
- nodeName: e,
3664
- name: n,
3665
- getContent: r,
3666
- parseAttributes: o = Qr,
3667
- serializeAttributes: s = Zr,
3668
- defaultAttributes: i = {},
3669
- selfClosing: a = !1,
3670
- allowedAttributes: c
3671
- } = t, l = n || e, f = (p) => {
3672
- if (!c)
3673
- return p;
3674
- const d = {};
3675
- return c.forEach((h) => {
3676
- const m = typeof h == "string" ? h : h.name, g = typeof h == "string" ? void 0 : h.skipIfDefault;
3677
- if (m in p) {
3678
- const v = p[m];
3679
- if (g !== void 0 && v === g)
3680
- return;
3681
- d[m] = v;
3775
+ function wo(t) {
3776
+ return new dt({
3777
+ find: t.find,
3778
+ handler: ({ state: e, range: n, match: r }) => {
3779
+ const o = x(t.getAttributes, void 0, r) || {}, { tr: s } = e, i = n.from;
3780
+ let a = n.to;
3781
+ const c = t.type.create(o);
3782
+ if (r[1]) {
3783
+ const l = r[0].lastIndexOf(r[1]);
3784
+ let f = i + l;
3785
+ f > a ? f = a : a = f + r[1].length;
3786
+ const u = r[0][r[0].length - 1];
3787
+ s.insertText(u, i + r[0].length - 1), s.replaceWith(f, a, c);
3788
+ } else if (r[0]) {
3789
+ const l = t.type.isInline ? i : i - 1;
3790
+ s.insert(l, t.type.create(o)).delete(
3791
+ s.mapping.map(i),
3792
+ s.mapping.map(a)
3793
+ );
3682
3794
  }
3683
- }), d;
3684
- }, u = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3685
- return {
3686
- parseMarkdown: (p, d) => {
3687
- const h = { ...i, ...p.attributes };
3688
- if (a)
3689
- return d.createNode(e, h);
3690
- const m = r ? r(p) : p.content || "";
3691
- return m ? d.createNode(e, h, [d.createTextNode(m)]) : d.createNode(e, h, []);
3795
+ s.scrollIntoView();
3692
3796
  },
3693
- markdownTokenizer: {
3694
- name: e,
3695
- level: "inline",
3696
- start(p) {
3697
- const d = a ? new RegExp(`\\[${u}\\s*[^\\]]*\\]`) : new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`), h = p.match(d), m = h?.index;
3698
- return m !== void 0 ? m : -1;
3699
- },
3700
- tokenize(p, d, h) {
3701
- const m = a ? new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`) : new RegExp(
3702
- `^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`
3703
- ), g = p.match(m);
3704
- if (!g)
3705
- return;
3706
- let v = "", y = "";
3707
- if (a) {
3708
- const [, M] = g;
3709
- y = M;
3710
- } else {
3711
- const [, M, k] = g;
3712
- y = M, v = k || "";
3713
- }
3714
- const w = o(y.trim());
3715
- return {
3716
- type: e,
3717
- raw: g[0],
3718
- content: v.trim(),
3719
- attributes: w
3720
- };
3721
- }
3797
+ undoable: t.undoable
3798
+ });
3799
+ }
3800
+ function Mo(t) {
3801
+ return new dt({
3802
+ find: t.find,
3803
+ handler: ({ state: e, range: n, match: r }) => {
3804
+ const o = e.doc.resolve(n.from), s = x(t.getAttributes, void 0, r) || {};
3805
+ if (!o.node(-1).canReplaceWith(o.index(-1), o.indexAfter(-1), t.type))
3806
+ return null;
3807
+ e.tr.delete(n.from, n.to).setBlockType(n.from, n.from, t.type, s);
3722
3808
  },
3723
- renderMarkdown: (p) => {
3724
- let d = "";
3725
- r ? d = r(p) : p.content && p.content.length > 0 && (d = p.content.filter((v) => v.type === "text").map((v) => v.text).join(""));
3726
- const h = f(p.attrs || {}), m = s(h), g = m ? ` ${m}` : "";
3727
- return a ? `[${l}${g}]` : `[${l}${g}]${d}[/${l}]`;
3728
- }
3729
- };
3809
+ undoable: t.undoable
3810
+ });
3730
3811
  }
3731
- function Yr(t, e, n) {
3732
- var r, o, s, i;
3733
- const a = t.split(`
3734
- `), c = [];
3735
- let l = "", f = 0;
3736
- const u = e.baseIndentSize || 2;
3737
- for (; f < a.length; ) {
3738
- const p = a[f], d = p.match(e.itemPattern);
3739
- if (!d) {
3740
- if (c.length > 0)
3741
- break;
3742
- if (p.trim() === "") {
3743
- f += 1, l = `${l}${p}
3744
- `;
3745
- continue;
3746
- } else
3747
- return;
3748
- }
3749
- const h = e.extractItemData(d), { indentLevel: m, mainContent: g } = h;
3750
- l = `${l}${p}
3751
- `;
3752
- const v = [g];
3753
- for (f += 1; f < a.length; ) {
3754
- const k = a[f];
3755
- if (k.trim() === "") {
3756
- const E = a.slice(f + 1).findIndex(($) => $.trim() !== "");
3757
- if (E === -1)
3758
- break;
3759
- if ((((o = (r = a[f + 1 + E].match(/^(\s*)/)) == null ? void 0 : r[1]) == null ? void 0 : o.length) || 0) > m) {
3760
- v.push(k), l = `${l}${k}
3761
- `, f += 1;
3762
- continue;
3763
- } else
3764
- break;
3812
+ function xo(t) {
3813
+ return new dt({
3814
+ find: t.find,
3815
+ handler: ({ state: e, range: n, match: r, chain: o }) => {
3816
+ const s = x(t.getAttributes, void 0, r) || {}, i = e.tr.delete(n.from, n.to), c = i.doc.resolve(n.from).blockRange(), l = c && we(c, t.type, s);
3817
+ if (!l)
3818
+ return null;
3819
+ if (i.wrap(c, l), t.keepMarks && t.editor) {
3820
+ const { selection: u, storedMarks: p } = e, { splittableMarks: d } = t.editor.extensionManager, h = p || u.$to.parentOffset && u.$from.marks();
3821
+ if (h) {
3822
+ const m = h.filter((g) => d.includes(g.type.name));
3823
+ i.ensureMarks(m);
3824
+ }
3765
3825
  }
3766
- if ((((i = (s = k.match(/^(\s*)/)) == null ? void 0 : s[1]) == null ? void 0 : i.length) || 0) > m)
3767
- v.push(k), l = `${l}${k}
3768
- `, f += 1;
3769
- else
3770
- break;
3771
- }
3772
- let y;
3773
- const w = v.slice(1);
3774
- if (w.length > 0) {
3775
- const k = w.map((S) => S.slice(m + u)).join(`
3776
- `);
3777
- k.trim() && (e.customNestedParser ? y = e.customNestedParser(k) : y = n.blockTokens(k));
3778
- }
3779
- const M = e.createToken(h, y);
3780
- c.push(M);
3781
- }
3782
- if (c.length !== 0)
3783
- return {
3784
- items: c,
3785
- raw: l
3786
- };
3787
- }
3788
- function Xr(t, e, n, r) {
3789
- if (!t || !Array.isArray(t.content))
3790
- return "";
3791
- const o = typeof n == "function" ? n(r) : n, [s, ...i] = t.content, a = e.renderChildren([s]);
3792
- let c = `${o}${a}`;
3793
- return i && i.length > 0 && i.forEach((l, f) => {
3794
- var u, p;
3795
- const d = (p = (u = e.renderChild) == null ? void 0 : u.call(e, l, f + 1)) != null ? p : e.renderChildren([l]);
3796
- if (d != null) {
3797
- const h = d.split(`
3798
- `).map((m) => m ? e.indent(m) : e.indent("")).join(`
3799
- `);
3800
- c += l.type === "paragraph" ? `
3801
-
3802
- ${h}` : `
3803
- ${h}`;
3804
- }
3805
- }), c;
3806
- }
3807
- function to(t, e, n = {}) {
3808
- const { state: r } = e, { doc: o, tr: s } = r, i = t;
3809
- o.descendants((a, c) => {
3810
- const l = s.mapping.map(c), f = s.mapping.map(c) + a.nodeSize;
3811
- let u = null;
3812
- if (a.marks.forEach((d) => {
3813
- if (d !== i)
3814
- return !1;
3815
- u = d;
3816
- }), !u)
3817
- return;
3818
- let p = !1;
3819
- if (Object.keys(n).forEach((d) => {
3820
- n[d] !== u.attrs[d] && (p = !0);
3821
- }), p) {
3822
- const d = t.type.create({
3823
- ...t.attrs,
3824
- ...n
3825
- });
3826
- s.removeMark(l, f, t.type), s.addMark(l, f, d);
3827
- }
3828
- }), s.docChanged && e.view.dispatch(s);
3826
+ if (t.keepAttributes) {
3827
+ const u = t.type.name === "bulletList" || t.type.name === "orderedList" ? "listItem" : "taskList";
3828
+ o().updateAttributes(u, s).run();
3829
+ }
3830
+ const f = i.doc.resolve(n.from - 1).nodeBefore;
3831
+ f && f.type === t.type && bt(i.doc, n.from - 1) && (!t.joinPredicate || t.joinPredicate(r, f)) && i.join(n.from - 1);
3832
+ },
3833
+ undoable: t.undoable
3834
+ });
3829
3835
  }
3830
- var Mo = class be extends Et {
3836
+ var So = class ke extends Ct {
3831
3837
  constructor() {
3832
3838
  super(...arguments), this.type = "node";
3833
3839
  }
@@ -3837,7 +3843,7 @@ var Mo = class be extends Et {
3837
3843
  */
3838
3844
  static create(e = {}) {
3839
3845
  const n = typeof e == "function" ? e() : e;
3840
- return new be(n);
3846
+ return new ke(n);
3841
3847
  }
3842
3848
  configure(e) {
3843
3849
  return super.configure(e);
@@ -3847,8 +3853,8 @@ var Mo = class be extends Et {
3847
3853
  return super.extend(n);
3848
3854
  }
3849
3855
  };
3850
- function xo(t) {
3851
- return new Dr({
3856
+ function Eo(t) {
3857
+ return new Qr({
3852
3858
  find: t.find,
3853
3859
  handler: ({ state: e, range: n, match: r, pasteEvent: o }) => {
3854
3860
  const s = x(t.getAttributes, void 0, r, o);
@@ -3858,7 +3864,7 @@ function xo(t) {
3858
3864
  let l = n.to;
3859
3865
  if (a) {
3860
3866
  const f = c.search(/\S/), u = n.from + c.indexOf(a), p = u + a.length;
3861
- if (ee(n.from, n.to, e.doc).filter((m) => m.mark.type.excluded.find((v) => v === t.type && v !== m.mark.type)).filter((m) => m.to > u).length)
3867
+ if (ne(n.from, n.to, e.doc).filter((m) => m.mark.type.excluded.find((v) => v === t.type && v !== m.mark.type)).filter((m) => m.to > u).length)
3862
3868
  return null;
3863
3869
  p < n.to && i.delete(p, n.to), u > n.from && i.delete(n.from + f, u), l = n.from + f + a.length, i.addMark(n.from + f, l, t.type.create(s || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || i.removeStoredMark(t.type);
3864
3870
  }
@@ -3867,103 +3873,103 @@ function xo(t) {
3867
3873
  }
3868
3874
  export {
3869
3875
  at as CommandManager,
3870
- go as Editor,
3871
- Et as Extendable,
3876
+ yo as Editor,
3877
+ Ct as Extendable,
3872
3878
  j as Extension,
3873
3879
  dt as InputRule,
3874
- ne as MappablePosition,
3875
- jr as Mark,
3876
- Mo as Node,
3877
- Hr as NodePos,
3878
- Dr as PasteRule,
3880
+ re as MappablePosition,
3881
+ Kr as Mark,
3882
+ So as Node,
3883
+ eo as NodePos,
3884
+ Qr as PasteRule,
3879
3885
  x as callOrReturn,
3880
- wo as canInsertNode,
3881
- Un as combineTransactionSteps,
3882
- Vt as commands,
3883
- Jr as createAtomBlockMarkdownSpec,
3884
- Kr as createBlockMarkdownSpec,
3886
+ bo as canInsertNode,
3887
+ Jn as combineTransactionSteps,
3888
+ Ht as commands,
3889
+ _r as createAtomBlockMarkdownSpec,
3890
+ Lr as createBlockMarkdownSpec,
3885
3891
  it as createChainableState,
3886
3892
  gt as createDocument,
3887
- Gr as createInlineMarkdownSpec,
3888
- cr as createMappablePosition,
3893
+ Vr as createInlineMarkdownSpec,
3894
+ ur as createMappablePosition,
3889
3895
  K as createNodeFromContent,
3890
- Ur as createStyleTag,
3891
- qn as defaultBlockAt,
3896
+ Or as createStyleTag,
3897
+ Kn as defaultBlockAt,
3892
3898
  It as deleteProps,
3893
3899
  U as elementFromString,
3894
- Vr as extensions,
3895
- co as findChildrenInRange,
3896
- Yn as findDuplicates,
3900
+ to as extensions,
3901
+ uo as findChildrenInRange,
3902
+ tr as findDuplicates,
3897
3903
  lt as findParentNode,
3898
- Jn as findParentNodeClosestToPos,
3904
+ Qn as findParentNodeClosestToPos,
3899
3905
  Mt as flattenExtensions,
3900
- Gn as fromString,
3901
- lo as generateHTML,
3902
- uo as generateJSON,
3903
- er as getAttributes,
3906
+ Xn as fromString,
3907
+ fo as generateHTML,
3908
+ po as generateJSON,
3909
+ rr as getAttributes,
3904
3910
  Zt as getAttributesFromExtensions,
3905
- or as getChangedRanges,
3911
+ ir as getChangedRanges,
3906
3912
  b as getExtensionField,
3907
3913
  ut as getHTMLFromFragment,
3908
- Kt as getMarkAttributes,
3914
+ Qt as getMarkAttributes,
3909
3915
  wt as getMarkRange,
3910
3916
  B as getMarkType,
3911
- ee as getMarksBetween,
3912
- fo as getNodeAtPosition,
3913
- tr as getNodeAttributes,
3917
+ ne as getMarksBetween,
3918
+ mo as getNodeAtPosition,
3919
+ nr as getNodeAttributes,
3914
3920
  T as getNodeType,
3915
3921
  ot as getRenderedAttributes,
3916
- Yt as getSchema,
3917
- Gt as getSchemaByResolvedExtensions,
3922
+ Xt as getSchema,
3923
+ Yt as getSchemaByResolvedExtensions,
3918
3924
  W as getSchemaTypeByName,
3919
3925
  ct as getSchemaTypeNameByName,
3920
3926
  et as getSplittedAttributes,
3921
- Xn as getText,
3922
- Xt as getTextBetween,
3923
- sr as getTextContentFromNodes,
3924
- te as getTextSerializersFromSchema,
3925
- ar as getUpdatedPosition,
3927
+ er as getText,
3928
+ te as getTextBetween,
3929
+ ar as getTextContentFromNodes,
3930
+ ee as getTextSerializersFromSchema,
3931
+ lr as getUpdatedPosition,
3926
3932
  Ot as injectExtensionAttributesToParseRule,
3927
- Rr as inputRulesPlugin,
3928
- ir as isActive,
3933
+ Jr as inputRulesPlugin,
3934
+ cr as isActive,
3929
3935
  Nt as isAndroid,
3930
- po as isAtEndOfNode,
3931
- mo as isAtStartOfNode,
3932
- Kn as isEmptyObject,
3936
+ ho as isAtEndOfNode,
3937
+ go as isAtStartOfNode,
3938
+ Gn as isEmptyObject,
3933
3939
  Dt as isExtensionRulesEnabled,
3934
- Qt as isFunction,
3940
+ Gt as isFunction,
3935
3941
  pt as isList,
3936
- Jt as isMacOS,
3942
+ Kt as isMacOS,
3937
3943
  vt as isMarkActive,
3938
3944
  Q as isNodeActive,
3939
3945
  St as isNodeEmpty,
3940
- ho as isNodeSelection,
3941
- Br as isNumber,
3946
+ vo as isNodeSelection,
3947
+ jr as isNumber,
3942
3948
  G as isPlainObject,
3943
3949
  kt as isRegExp,
3944
- hn as isSafari,
3945
- Wt as isTextSelection,
3950
+ vn as isSafari,
3951
+ Ut as isTextSelection,
3946
3952
  rt as isiOS,
3947
- vo as markInputRule,
3948
- xo as markPasteRule,
3949
- qr as markdown,
3950
- Zn as mergeAttributes,
3951
- oe as mergeDeep,
3953
+ ko as markInputRule,
3954
+ Eo as markPasteRule,
3955
+ Dr as markdown,
3956
+ Yn as mergeAttributes,
3957
+ ie as mergeDeep,
3952
3958
  z as minMax,
3953
- bo as nodeInputRule,
3959
+ wo as nodeInputRule,
3954
3960
  nt as objectIncludes,
3955
- Tt as parseAttributes,
3956
- Yr as parseIndentedBlocks,
3957
- Fr as pasteRulesPlugin,
3958
- nr as removeDuplicates,
3959
- Xr as renderNestedMarkdownContent,
3961
+ Et as parseAttributes,
3962
+ Hr as parseIndentedBlocks,
3963
+ Xr as pasteRulesPlugin,
3964
+ or as removeDuplicates,
3965
+ Wr as renderNestedMarkdownContent,
3960
3966
  xt as resolveExtensions,
3961
- Ut as resolveFocusPosition,
3962
- yn as selectionToInsertionEnd,
3963
- At as serializeAttributes,
3967
+ qt as resolveFocusPosition,
3968
+ wn as selectionToInsertionEnd,
3969
+ Tt as serializeAttributes,
3964
3970
  J as sortExtensions,
3965
3971
  V as splitExtensions,
3966
- yo as textblockTypeInputRule,
3967
- to as updateMarkViewAttributes,
3968
- ko as wrappingInputRule
3972
+ Mo as textblockTypeInputRule,
3973
+ Ur as updateMarkViewAttributes,
3974
+ xo as wrappingInputRule
3969
3975
  };