reactjs-tiptap-editor 0.0.28 → 0.0.30

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,10 +1,8 @@
1
- var tn = Object.defineProperty;
2
- var en = (e, t, n) => t in e ? tn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var ot = (e, t, n) => en(e, typeof t != "symbol" ? t + "" : t, n);
4
- import { P as _, g as $, N as tt, S as W, i as nn, j as Wt, T as rn, k as sn, m as on, n as N, q as an, r as ln, t as cn, v as dn, w as un, x as pn, y as Le, z as hn, A as fn, B as mn, C as gn, D as yn, E as bn, F as vn, G as Mn, H as Sn, I as kn, J as wn, K as ne, L as En, M as ut, O as pt, Q as Tn, U as Cn, V as xn, W as An, X as On, Y as Ln, Z as Re, _ as Ct, $ as Rn, a0 as Hn, a1 as Pn, a2 as He, a3 as _n, a4 as In, a5 as $n, a6 as Nn, a7 as re, a8 as Pe, a9 as Dn, aa as Bn, ab as jn, ac as Fn, ad as zn, ae as Wn, af as ft, ag as Vt, ah as Vn, ai as Kn, aj as Un, ak as qn, al as Gn, am as Jn, an as Yn, ao as Xn, ap as se, aq as oe, ar as ie, as as Qn, at as Zn, au as ae, av as tr, aw as _e, ax as er, ay as nr } from "./vendor-CCqRdwcC.js";
5
- import R, { forwardRef as rr, useRef as sr, useState as Kt, useDebugValue as Ie, useEffect as Ut, createContext as $e, useContext as Ne } from "react";
6
- import or, { flushSync as ir } from "react-dom";
7
- function yt(e) {
1
+ import ze from "tippy.js";
2
+ import { P, a as $, N as Z, S as G, f as We, c as Bt, T as Ve, l as Ke, b as Ue, d as N, e as qe, g as Ge, j as Je, h as Ye, i as Xe, k as Qe, m as Me, n as Ze, o as tn, p as en, q as nn, r as rn, s as sn, t as on, u as an, v as ln, w as cn, x as dn, y as Yt, z as un, A as lt, F as ct, B as pn, C as hn, D as fn, E as mn, G as gn, H as yn, I as Se, J as wt, R as bn, K as vn, L as Mn, M as Xt, O as ke, Q as Sn, U as kn, V as wn, W as Tn, X as En, Y as Cn, Z as ut, _ as jt, $ as xn, a0 as An, a1 as On, a2 as Ln, a3 as Rn, a4 as _n, a5 as Hn, a6 as In, a7 as Qt, a8 as Zt, a9 as te, aa as Pn, ab as Nn, ac as ee, ad as $n, ae as we, af as Dn, ag as Bn } from "./vendor-D533qV8r.js";
3
+ import L, { forwardRef as jn, useRef as Fn, useState as Ft, useDebugValue as Te, useEffect as zt, createContext as Ee, useContext as Ce } from "react";
4
+ import zn, { flushSync as Wn } from "react-dom";
5
+ function ft(e) {
8
6
  const { state: t, transaction: n } = e;
9
7
  let { selection: r } = n, { doc: s } = n, { storedMarks: o } = n;
10
8
  return {
@@ -29,7 +27,7 @@ function yt(e) {
29
27
  }
30
28
  };
31
29
  }
32
- class bt {
30
+ class mt {
33
31
  constructor(t) {
34
32
  this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
35
33
  }
@@ -53,10 +51,10 @@ class bt {
53
51
  return () => this.createCan();
54
52
  }
55
53
  createChain(t, n = !0) {
56
- const { rawCommands: r, editor: s, state: o } = this, { view: i } = s, a = [], l = !!t, c = t || o.tr, u = () => (!l && n && !c.getMeta("preventDispatch") && !this.hasCustomState && i.dispatch(c), a.every((h) => h === !0)), d = {
57
- ...Object.fromEntries(Object.entries(r).map(([h, p]) => [h, (...g) => {
58
- const m = this.buildProps(c, n), y = p(...g)(m);
59
- return a.push(y), d;
54
+ const { rawCommands: r, editor: s, state: o } = this, { view: i } = s, a = [], l = !!t, c = t || o.tr, u = () => (!l && n && !c.getMeta("preventDispatch") && !this.hasCustomState && i.dispatch(c), a.every((p) => p === !0)), d = {
55
+ ...Object.fromEntries(Object.entries(r).map(([p, h]) => [p, (...y) => {
56
+ const g = this.buildProps(c, n), m = h(...y)(g);
57
+ return a.push(m), d;
60
58
  }])),
61
59
  run: u
62
60
  };
@@ -74,7 +72,7 @@ class bt {
74
72
  tr: t,
75
73
  editor: s,
76
74
  view: i,
77
- state: yt({
75
+ state: ft({
78
76
  state: o,
79
77
  transaction: t
80
78
  }),
@@ -89,7 +87,7 @@ class bt {
89
87
  return a;
90
88
  }
91
89
  }
92
- class ar {
90
+ class Vn {
93
91
  constructor() {
94
92
  this.callbacks = {};
95
93
  }
@@ -108,13 +106,13 @@ class ar {
108
106
  this.callbacks = {};
109
107
  }
110
108
  }
111
- function S(e, t, n) {
112
- return e.config[t] === void 0 && e.parent ? S(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
109
+ function v(e, t, n) {
110
+ return e.config[t] === void 0 && e.parent ? v(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
113
111
  ...n,
114
- parent: e.parent ? S(e.parent, t, n) : null
112
+ parent: e.parent ? v(e.parent, t, n) : null
115
113
  }) : e.config[t];
116
114
  }
117
- function vt(e) {
115
+ function gt(e) {
118
116
  const t = e.filter((s) => s.type === "extension"), n = e.filter((s) => s.type === "node"), r = e.filter((s) => s.type === "mark");
119
117
  return {
120
118
  baseExtensions: t,
@@ -122,8 +120,8 @@ function vt(e) {
122
120
  markExtensions: r
123
121
  };
124
122
  }
125
- function De(e) {
126
- const t = [], { nodeExtensions: n, markExtensions: r } = vt(e), s = [...n, ...r], o = {
123
+ function xe(e) {
124
+ const t = [], { nodeExtensions: n, markExtensions: r } = gt(e), s = [...n, ...r], o = {
127
125
  default: null,
128
126
  rendered: !0,
129
127
  renderHTML: null,
@@ -137,18 +135,18 @@ function De(e) {
137
135
  options: i.options,
138
136
  storage: i.storage,
139
137
  extensions: s
140
- }, l = S(i, "addGlobalAttributes", a);
138
+ }, l = v(i, "addGlobalAttributes", a);
141
139
  if (!l)
142
140
  return;
143
141
  l().forEach((u) => {
144
142
  u.types.forEach((d) => {
145
- Object.entries(u.attributes).forEach(([h, p]) => {
143
+ Object.entries(u.attributes).forEach(([p, h]) => {
146
144
  t.push({
147
145
  type: d,
148
- name: h,
146
+ name: p,
149
147
  attribute: {
150
148
  ...o,
151
- ...p
149
+ ...h
152
150
  }
153
151
  });
154
152
  });
@@ -159,24 +157,24 @@ function De(e) {
159
157
  name: i.name,
160
158
  options: i.options,
161
159
  storage: i.storage
162
- }, l = S(i, "addAttributes", a);
160
+ }, l = v(i, "addAttributes", a);
163
161
  if (!l)
164
162
  return;
165
163
  const c = l();
166
164
  Object.entries(c).forEach(([u, d]) => {
167
- const h = {
165
+ const p = {
168
166
  ...o,
169
167
  ...d
170
168
  };
171
- typeof (h == null ? void 0 : h.default) == "function" && (h.default = h.default()), h != null && h.isRequired && (h == null ? void 0 : h.default) === void 0 && delete h.default, t.push({
169
+ typeof (p == null ? void 0 : p.default) == "function" && (p.default = p.default()), p != null && p.isRequired && (p == null ? void 0 : p.default) === void 0 && delete p.default, t.push({
172
170
  type: i.name,
173
171
  name: u,
174
- attribute: h
172
+ attribute: p
175
173
  });
176
174
  });
177
175
  }), t;
178
176
  }
179
- function P(e, t) {
177
+ function H(e, t) {
180
178
  if (typeof e == "string") {
181
179
  if (!t.nodes[e])
182
180
  throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
@@ -199,24 +197,24 @@ function x(...e) {
199
197
  }), r;
200
198
  }, {});
201
199
  }
202
- function It(e, t) {
200
+ function Rt(e, t) {
203
201
  return t.filter((n) => n.attribute.rendered).map((n) => n.attribute.renderHTML ? n.attribute.renderHTML(e.attrs) || {} : {
204
202
  [n.name]: e.attrs[n.name]
205
203
  }).reduce((n, r) => x(n, r), {});
206
204
  }
207
- function Be(e) {
205
+ function Ae(e) {
208
206
  return typeof e == "function";
209
207
  }
210
- function C(e, t = void 0, ...n) {
211
- return Be(e) ? t ? e.bind(t)(...n) : e(...n) : e;
208
+ function T(e, t = void 0, ...n) {
209
+ return Ae(e) ? t ? e.bind(t)(...n) : e(...n) : e;
212
210
  }
213
- function lr(e = {}) {
211
+ function Kn(e = {}) {
214
212
  return Object.keys(e).length === 0 && e.constructor === Object;
215
213
  }
216
- function cr(e) {
214
+ function Un(e) {
217
215
  return typeof e != "string" ? e : e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" ? !0 : e === "false" ? !1 : e;
218
216
  }
219
- function le(e, t) {
217
+ function ne(e, t) {
220
218
  return "style" in e ? e : {
221
219
  ...e,
222
220
  getAttrs: (n) => {
@@ -224,7 +222,7 @@ function le(e, t) {
224
222
  if (r === !1)
225
223
  return !1;
226
224
  const s = t.reduce((o, i) => {
227
- const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : cr(n.getAttribute(i.name));
225
+ const a = i.attribute.parseHTML ? i.attribute.parseHTML(n) : Un(n.getAttribute(i.name));
228
226
  return a == null ? o : {
229
227
  ...o,
230
228
  [i.name]: a
@@ -234,96 +232,96 @@ function le(e, t) {
234
232
  }
235
233
  };
236
234
  }
237
- function ce(e) {
235
+ function re(e) {
238
236
  return Object.fromEntries(
239
237
  // @ts-ignore
240
- Object.entries(e).filter(([t, n]) => t === "attrs" && lr(n) ? !1 : n != null)
238
+ Object.entries(e).filter(([t, n]) => t === "attrs" && Kn(n) ? !1 : n != null)
241
239
  );
242
240
  }
243
- function dr(e, t) {
241
+ function qn(e, t) {
244
242
  var n;
245
- const r = De(e), { nodeExtensions: s, markExtensions: o } = vt(e), i = (n = s.find((c) => S(c, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((c) => {
246
- const u = r.filter((y) => y.type === c.name), d = {
243
+ const r = xe(e), { nodeExtensions: s, markExtensions: o } = gt(e), i = (n = s.find((c) => v(c, "topNode"))) === null || n === void 0 ? void 0 : n.name, a = Object.fromEntries(s.map((c) => {
244
+ const u = r.filter((m) => m.type === c.name), d = {
247
245
  name: c.name,
248
246
  options: c.options,
249
247
  storage: c.storage,
250
248
  editor: t
251
- }, h = e.reduce((y, k) => {
252
- const v = S(k, "extendNodeSchema", d);
249
+ }, p = e.reduce((m, k) => {
250
+ const b = v(k, "extendNodeSchema", d);
253
251
  return {
254
- ...y,
255
- ...v ? v(c) : {}
252
+ ...m,
253
+ ...b ? b(c) : {}
256
254
  };
257
- }, {}), p = ce({
258
- ...h,
259
- content: C(S(c, "content", d)),
260
- marks: C(S(c, "marks", d)),
261
- group: C(S(c, "group", d)),
262
- inline: C(S(c, "inline", d)),
263
- atom: C(S(c, "atom", d)),
264
- selectable: C(S(c, "selectable", d)),
265
- draggable: C(S(c, "draggable", d)),
266
- code: C(S(c, "code", d)),
267
- whitespace: C(S(c, "whitespace", d)),
268
- defining: C(S(c, "defining", d)),
269
- isolating: C(S(c, "isolating", d)),
270
- attrs: Object.fromEntries(u.map((y) => {
255
+ }, {}), h = re({
256
+ ...p,
257
+ content: T(v(c, "content", d)),
258
+ marks: T(v(c, "marks", d)),
259
+ group: T(v(c, "group", d)),
260
+ inline: T(v(c, "inline", d)),
261
+ atom: T(v(c, "atom", d)),
262
+ selectable: T(v(c, "selectable", d)),
263
+ draggable: T(v(c, "draggable", d)),
264
+ code: T(v(c, "code", d)),
265
+ whitespace: T(v(c, "whitespace", d)),
266
+ defining: T(v(c, "defining", d)),
267
+ isolating: T(v(c, "isolating", d)),
268
+ attrs: Object.fromEntries(u.map((m) => {
271
269
  var k;
272
- return [y.name, { default: (k = y == null ? void 0 : y.attribute) === null || k === void 0 ? void 0 : k.default }];
270
+ return [m.name, { default: (k = m == null ? void 0 : m.attribute) === null || k === void 0 ? void 0 : k.default }];
273
271
  }))
274
- }), f = C(S(c, "parseHTML", d));
275
- f && (p.parseDOM = f.map((y) => le(y, u)));
276
- const g = S(c, "renderHTML", d);
277
- g && (p.toDOM = (y) => g({
278
- node: y,
279
- HTMLAttributes: It(y, u)
272
+ }), f = T(v(c, "parseHTML", d));
273
+ f && (h.parseDOM = f.map((m) => ne(m, u)));
274
+ const y = v(c, "renderHTML", d);
275
+ y && (h.toDOM = (m) => y({
276
+ node: m,
277
+ HTMLAttributes: Rt(m, u)
280
278
  }));
281
- const m = S(c, "renderText", d);
282
- return m && (p.toText = m), [c.name, p];
279
+ const g = v(c, "renderText", d);
280
+ return g && (h.toText = g), [c.name, h];
283
281
  })), l = Object.fromEntries(o.map((c) => {
284
- const u = r.filter((m) => m.type === c.name), d = {
282
+ const u = r.filter((g) => g.type === c.name), d = {
285
283
  name: c.name,
286
284
  options: c.options,
287
285
  storage: c.storage,
288
286
  editor: t
289
- }, h = e.reduce((m, y) => {
290
- const k = S(y, "extendMarkSchema", d);
287
+ }, p = e.reduce((g, m) => {
288
+ const k = v(m, "extendMarkSchema", d);
291
289
  return {
292
- ...m,
290
+ ...g,
293
291
  ...k ? k(c) : {}
294
292
  };
295
- }, {}), p = ce({
296
- ...h,
297
- inclusive: C(S(c, "inclusive", d)),
298
- excludes: C(S(c, "excludes", d)),
299
- group: C(S(c, "group", d)),
300
- spanning: C(S(c, "spanning", d)),
301
- code: C(S(c, "code", d)),
302
- attrs: Object.fromEntries(u.map((m) => {
303
- var y;
304
- return [m.name, { default: (y = m == null ? void 0 : m.attribute) === null || y === void 0 ? void 0 : y.default }];
293
+ }, {}), h = re({
294
+ ...p,
295
+ inclusive: T(v(c, "inclusive", d)),
296
+ excludes: T(v(c, "excludes", d)),
297
+ group: T(v(c, "group", d)),
298
+ spanning: T(v(c, "spanning", d)),
299
+ code: T(v(c, "code", d)),
300
+ attrs: Object.fromEntries(u.map((g) => {
301
+ var m;
302
+ return [g.name, { default: (m = g == null ? void 0 : g.attribute) === null || m === void 0 ? void 0 : m.default }];
305
303
  }))
306
- }), f = C(S(c, "parseHTML", d));
307
- f && (p.parseDOM = f.map((m) => le(m, u)));
308
- const g = S(c, "renderHTML", d);
309
- return g && (p.toDOM = (m) => g({
310
- mark: m,
311
- HTMLAttributes: It(m, u)
312
- })), [c.name, p];
304
+ }), f = T(v(c, "parseHTML", d));
305
+ f && (h.parseDOM = f.map((g) => ne(g, u)));
306
+ const y = v(c, "renderHTML", d);
307
+ return y && (h.toDOM = (g) => y({
308
+ mark: g,
309
+ HTMLAttributes: Rt(g, u)
310
+ })), [c.name, h];
313
311
  }));
314
- return new Re({
312
+ return new Se({
315
313
  topNode: i,
316
314
  nodes: a,
317
315
  marks: l
318
316
  });
319
317
  }
320
- function xt(e, t) {
318
+ function Tt(e, t) {
321
319
  return t.nodes[e] || t.marks[e] || null;
322
320
  }
323
- function de(e, t) {
321
+ function se(e, t) {
324
322
  return Array.isArray(t) ? t.some((n) => (typeof n == "string" ? n : n.name) === e.name) : t;
325
323
  }
326
- const ur = (e, t = 500) => {
324
+ const Gn = (e, t = 500) => {
327
325
  let n = "";
328
326
  const r = e.parentOffset;
329
327
  return e.parent.nodesBetween(Math.max(0, r - t), r, (s, o, i, a) => {
@@ -337,16 +335,16 @@ const ur = (e, t = 500) => {
337
335
  n += s.isAtom && !s.isText ? u : u.slice(0, Math.max(0, r - o));
338
336
  }), n;
339
337
  };
340
- function qt(e) {
338
+ function Wt(e) {
341
339
  return Object.prototype.toString.call(e) === "[object RegExp]";
342
340
  }
343
- class Mt {
341
+ class yt {
344
342
  constructor(t) {
345
343
  this.find = t.find, this.handler = t.handler;
346
344
  }
347
345
  }
348
- const pr = (e, t) => {
349
- if (qt(t))
346
+ const Jn = (e, t) => {
347
+ if (Wt(t))
350
348
  return t.exec(e);
351
349
  const n = t(e);
352
350
  if (!n)
@@ -354,7 +352,7 @@ const pr = (e, t) => {
354
352
  const r = [n.text];
355
353
  return r.index = n.index, r.input = e, r.data = n.data, n.replaceWith && (n.text.includes(n.replaceWith) || console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'), r.push(n.replaceWith)), r;
356
354
  };
357
- function it(e) {
355
+ function st(e) {
358
356
  var t;
359
357
  const { editor: n, from: r, to: s, text: o, rules: i, plugin: a } = e, { view: l } = n;
360
358
  if (l.composing)
@@ -362,34 +360,34 @@ function it(e) {
362
360
  const c = l.state.doc.resolve(r);
363
361
  if (
364
362
  // check for code node
365
- c.parent.type.spec.code || !((t = c.nodeBefore || c.nodeAfter) === null || t === void 0) && t.marks.find((h) => h.type.spec.code)
363
+ c.parent.type.spec.code || !((t = c.nodeBefore || c.nodeAfter) === null || t === void 0) && t.marks.find((p) => p.type.spec.code)
366
364
  )
367
365
  return !1;
368
366
  let u = !1;
369
- const d = ur(c) + o;
370
- return i.forEach((h) => {
367
+ const d = Gn(c) + o;
368
+ return i.forEach((p) => {
371
369
  if (u)
372
370
  return;
373
- const p = pr(d, h.find);
374
- if (!p)
371
+ const h = Jn(d, p.find);
372
+ if (!h)
375
373
  return;
376
- const f = l.state.tr, g = yt({
374
+ const f = l.state.tr, y = ft({
377
375
  state: l.state,
378
376
  transaction: f
379
- }), m = {
380
- from: r - (p[0].length - o.length),
377
+ }), g = {
378
+ from: r - (h[0].length - o.length),
381
379
  to: s
382
- }, { commands: y, chain: k, can: v } = new bt({
380
+ }, { commands: m, chain: k, can: b } = new mt({
383
381
  editor: n,
384
- state: g
382
+ state: y
385
383
  });
386
- h.handler({
387
- state: g,
388
- range: m,
389
- match: p,
390
- commands: y,
384
+ p.handler({
385
+ state: y,
386
+ range: g,
387
+ match: h,
388
+ commands: m,
391
389
  chain: k,
392
- can: v
390
+ can: b
393
391
  }) === null || !f.steps.length || (f.setMeta(a, {
394
392
  transform: f,
395
393
  from: r,
@@ -398,8 +396,8 @@ function it(e) {
398
396
  }), l.dispatch(f), u = !0);
399
397
  }), u;
400
398
  }
401
- function hr(e) {
402
- const { editor: t, rules: n } = e, r = new _({
399
+ function Yn(e) {
400
+ const { editor: t, rules: n } = e, r = new P({
403
401
  state: {
404
402
  init() {
405
403
  return null;
@@ -411,7 +409,7 @@ function hr(e) {
411
409
  const a = s.getMeta("applyInputRules");
412
410
  return !!a && setTimeout(() => {
413
411
  const { from: c, text: u } = a, d = c + u.length;
414
- it({
412
+ st({
415
413
  editor: t,
416
414
  from: c,
417
415
  to: d,
@@ -424,7 +422,7 @@ function hr(e) {
424
422
  },
425
423
  props: {
426
424
  handleTextInput(s, o, i, a) {
427
- return it({
425
+ return st({
428
426
  editor: t,
429
427
  from: o,
430
428
  to: i,
@@ -436,7 +434,7 @@ function hr(e) {
436
434
  handleDOMEvents: {
437
435
  compositionend: (s) => (setTimeout(() => {
438
436
  const { $cursor: o } = s.state.selection;
439
- o && it({
437
+ o && st({
440
438
  editor: t,
441
439
  from: o.pos,
442
440
  to: o.pos,
@@ -452,7 +450,7 @@ function hr(e) {
452
450
  if (o.key !== "Enter")
453
451
  return !1;
454
452
  const { $cursor: i } = s.state.selection;
455
- return i ? it({
453
+ return i ? st({
456
454
  editor: t,
457
455
  from: i.pos,
458
456
  to: i.pos,
@@ -468,16 +466,16 @@ function hr(e) {
468
466
  });
469
467
  return r;
470
468
  }
471
- function fr(e) {
469
+ function Xn(e) {
472
470
  return typeof e == "number";
473
471
  }
474
- class mr {
472
+ class Qn {
475
473
  constructor(t) {
476
474
  this.find = t.find, this.handler = t.handler;
477
475
  }
478
476
  }
479
- const gr = (e, t, n) => {
480
- if (qt(t))
477
+ const Zn = (e, t, n) => {
478
+ if (Wt(t))
481
479
  return [...e.matchAll(t)];
482
480
  const r = t(e, n);
483
481
  return r ? r.map((s) => {
@@ -485,117 +483,117 @@ const gr = (e, t, n) => {
485
483
  return o.index = s.index, o.input = e, o.data = s.data, s.replaceWith && (s.text.includes(s.replaceWith) || console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'), o.push(s.replaceWith)), o;
486
484
  }) : [];
487
485
  };
488
- function yr(e) {
489
- const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new bt({
486
+ function tr(e) {
487
+ const { editor: t, state: n, from: r, to: s, rule: o, pasteEvent: i, dropEvent: a } = e, { commands: l, chain: c, can: u } = new mt({
490
488
  editor: t,
491
489
  state: n
492
490
  }), d = [];
493
- return n.doc.nodesBetween(r, s, (p, f) => {
494
- if (!p.isTextblock || p.type.spec.code)
491
+ return n.doc.nodesBetween(r, s, (h, f) => {
492
+ if (!h.isTextblock || h.type.spec.code)
495
493
  return;
496
- const g = Math.max(r, f), m = Math.min(s, f + p.content.size), y = p.textBetween(g - f, m - f, void 0, "");
497
- gr(y, o.find, i).forEach((v) => {
498
- if (v.index === void 0)
494
+ const y = Math.max(r, f), g = Math.min(s, f + h.content.size), m = h.textBetween(y - f, g - f, void 0, "");
495
+ Zn(m, o.find, i).forEach((b) => {
496
+ if (b.index === void 0)
499
497
  return;
500
- const b = g + v.index + 1, E = b + v[0].length, M = {
501
- from: n.tr.mapping.map(b),
502
- to: n.tr.mapping.map(E)
503
- }, T = o.handler({
498
+ const S = y + b.index + 1, w = S + b[0].length, M = {
499
+ from: n.tr.mapping.map(S),
500
+ to: n.tr.mapping.map(w)
501
+ }, C = o.handler({
504
502
  state: n,
505
503
  range: M,
506
- match: v,
504
+ match: b,
507
505
  commands: l,
508
506
  chain: c,
509
507
  can: u,
510
508
  pasteEvent: i,
511
509
  dropEvent: a
512
510
  });
513
- d.push(T);
511
+ d.push(C);
514
512
  });
515
- }), d.every((p) => p !== null);
513
+ }), d.every((h) => h !== null);
516
514
  }
517
- const br = (e) => {
515
+ const er = (e) => {
518
516
  var t;
519
517
  const n = new ClipboardEvent("paste", {
520
518
  clipboardData: new DataTransfer()
521
519
  });
522
520
  return (t = n.clipboardData) === null || t === void 0 || t.setData("text/html", e), n;
523
521
  };
524
- function vr(e) {
522
+ function nr(e) {
525
523
  const { editor: t, rules: n } = e;
526
524
  let r = null, s = !1, o = !1, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, a = typeof DragEvent < "u" ? new DragEvent("drop") : null;
527
- const l = ({ state: u, from: d, to: h, rule: p, pasteEvt: f }) => {
528
- const g = u.tr, m = yt({
525
+ const l = ({ state: u, from: d, to: p, rule: h, pasteEvt: f }) => {
526
+ const y = u.tr, g = ft({
529
527
  state: u,
530
- transaction: g
528
+ transaction: y
531
529
  });
532
- if (!(!yr({
530
+ if (!(!tr({
533
531
  editor: t,
534
- state: m,
532
+ state: g,
535
533
  from: Math.max(d - 1, 0),
536
- to: h.b - 1,
537
- rule: p,
534
+ to: p.b - 1,
535
+ rule: h,
538
536
  pasteEvent: f,
539
537
  dropEvent: a
540
- }) || !g.steps.length))
541
- return a = typeof DragEvent < "u" ? new DragEvent("drop") : null, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, g;
538
+ }) || !y.steps.length))
539
+ return a = typeof DragEvent < "u" ? new DragEvent("drop") : null, i = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, y;
542
540
  };
543
- return n.map((u) => new _({
541
+ return n.map((u) => new P({
544
542
  // we register a global drag handler to track the current drag source element
545
543
  view(d) {
546
- const h = (p) => {
544
+ const p = (h) => {
547
545
  var f;
548
- r = !((f = d.dom.parentElement) === null || f === void 0) && f.contains(p.target) ? d.dom.parentElement : null;
546
+ r = !((f = d.dom.parentElement) === null || f === void 0) && f.contains(h.target) ? d.dom.parentElement : null;
549
547
  };
550
- return window.addEventListener("dragstart", h), {
548
+ return window.addEventListener("dragstart", p), {
551
549
  destroy() {
552
- window.removeEventListener("dragstart", h);
550
+ window.removeEventListener("dragstart", p);
553
551
  }
554
552
  };
555
553
  },
556
554
  props: {
557
555
  handleDOMEvents: {
558
- drop: (d, h) => (o = r === d.dom.parentElement, a = h, !1),
559
- paste: (d, h) => {
560
- var p;
561
- const f = (p = h.clipboardData) === null || p === void 0 ? void 0 : p.getData("text/html");
562
- return i = h, s = !!(f != null && f.includes("data-pm-slice")), !1;
556
+ drop: (d, p) => (o = r === d.dom.parentElement, a = p, !1),
557
+ paste: (d, p) => {
558
+ var h;
559
+ const f = (h = p.clipboardData) === null || h === void 0 ? void 0 : h.getData("text/html");
560
+ return i = p, s = !!(f != null && f.includes("data-pm-slice")), !1;
563
561
  }
564
562
  }
565
563
  },
566
- appendTransaction: (d, h, p) => {
567
- const f = d[0], g = f.getMeta("uiEvent") === "paste" && !s, m = f.getMeta("uiEvent") === "drop" && !o, y = f.getMeta("applyPasteRules"), k = !!y;
568
- if (!g && !m && !k)
564
+ appendTransaction: (d, p, h) => {
565
+ const f = d[0], y = f.getMeta("uiEvent") === "paste" && !s, g = f.getMeta("uiEvent") === "drop" && !o, m = f.getMeta("applyPasteRules"), k = !!m;
566
+ if (!y && !g && !k)
569
567
  return;
570
568
  if (k) {
571
- const { from: E, text: M } = y, T = E + M.length, A = br(M);
569
+ const { from: w, text: M } = m, C = w + M.length, A = er(M);
572
570
  return l({
573
571
  rule: u,
574
- state: p,
575
- from: E,
576
- to: { b: T },
572
+ state: h,
573
+ from: w,
574
+ to: { b: C },
577
575
  pasteEvt: A
578
576
  });
579
577
  }
580
- const v = h.doc.content.findDiffStart(p.doc.content), b = h.doc.content.findDiffEnd(p.doc.content);
581
- if (!(!fr(v) || !b || v === b.b))
578
+ const b = p.doc.content.findDiffStart(h.doc.content), S = p.doc.content.findDiffEnd(h.doc.content);
579
+ if (!(!Xn(b) || !S || b === S.b))
582
580
  return l({
583
581
  rule: u,
584
- state: p,
585
- from: v,
586
- to: b,
582
+ state: h,
583
+ from: b,
584
+ to: S,
587
585
  pasteEvt: i
588
586
  });
589
587
  }
590
588
  }));
591
589
  }
592
- function Mr(e) {
590
+ function rr(e) {
593
591
  const t = e.filter((n, r) => e.indexOf(n) !== r);
594
592
  return Array.from(new Set(t));
595
593
  }
596
- class Z {
594
+ class Q {
597
595
  constructor(t, n) {
598
- this.splittableMarks = [], this.editor = n, this.extensions = Z.resolve(t), this.schema = dr(this.extensions, n), this.setupExtensions();
596
+ this.splittableMarks = [], this.editor = n, this.extensions = Q.resolve(t), this.schema = qn(this.extensions, n), this.setupExtensions();
599
597
  }
600
598
  /**
601
599
  * Returns a flattened and sorted extension list while
@@ -604,7 +602,7 @@ class Z {
604
602
  * @returns An flattened and sorted array of Tiptap extensions
605
603
  */
606
604
  static resolve(t) {
607
- const n = Z.sort(Z.flatten(t)), r = Mr(n.map((s) => s.name));
605
+ const n = Q.sort(Q.flatten(t)), r = rr(n.map((s) => s.name));
608
606
  return r.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((s) => `'${s}'`).join(", ")}]. This can lead to issues.`), n;
609
607
  }
610
608
  /**
@@ -618,7 +616,7 @@ class Z {
618
616
  name: n.name,
619
617
  options: n.options,
620
618
  storage: n.storage
621
- }, s = S(n, "addExtensions", r);
619
+ }, s = v(n, "addExtensions", r);
622
620
  return s ? [n, ...this.flatten(s())] : n;
623
621
  }).flat(10);
624
622
  }
@@ -629,7 +627,7 @@ class Z {
629
627
  */
630
628
  static sort(t) {
631
629
  return t.sort((r, s) => {
632
- const o = S(r, "priority") || 100, i = S(s, "priority") || 100;
630
+ const o = v(r, "priority") || 100, i = v(s, "priority") || 100;
633
631
  return o > i ? -1 : o < i ? 1 : 0;
634
632
  });
635
633
  }
@@ -644,8 +642,8 @@ class Z {
644
642
  options: n.options,
645
643
  storage: n.storage,
646
644
  editor: this.editor,
647
- type: xt(n.name, this.schema)
648
- }, s = S(n, "addCommands", r);
645
+ type: Tt(n.name, this.schema)
646
+ }, s = v(n, "addCommands", r);
649
647
  return s ? {
650
648
  ...t,
651
649
  ...s()
@@ -657,38 +655,38 @@ class Z {
657
655
  * @returns An array of Prosemirror plugins
658
656
  */
659
657
  get plugins() {
660
- const { editor: t } = this, n = Z.sort([...this.extensions].reverse()), r = [], s = [], o = n.map((i) => {
658
+ const { editor: t } = this, n = Q.sort([...this.extensions].reverse()), r = [], s = [], o = n.map((i) => {
661
659
  const a = {
662
660
  name: i.name,
663
661
  options: i.options,
664
662
  storage: i.storage,
665
663
  editor: t,
666
- type: xt(i.name, this.schema)
667
- }, l = [], c = S(i, "addKeyboardShortcuts", a);
664
+ type: Tt(i.name, this.schema)
665
+ }, l = [], c = v(i, "addKeyboardShortcuts", a);
668
666
  let u = {};
669
- if (i.type === "mark" && S(i, "exitable", a) && (u.ArrowRight = () => I.handleExit({ editor: t, mark: i })), c) {
670
- const g = Object.fromEntries(Object.entries(c()).map(([m, y]) => [m, () => y({ editor: t })]));
671
- u = { ...u, ...g };
667
+ if (i.type === "mark" && v(i, "exitable", a) && (u.ArrowRight = () => I.handleExit({ editor: t, mark: i })), c) {
668
+ const y = Object.fromEntries(Object.entries(c()).map(([g, m]) => [g, () => m({ editor: t })]));
669
+ u = { ...u, ...y };
672
670
  }
673
- const d = Ln(u);
671
+ const d = yn(u);
674
672
  l.push(d);
675
- const h = S(i, "addInputRules", a);
676
- de(i, t.options.enableInputRules) && h && r.push(...h());
677
- const p = S(i, "addPasteRules", a);
678
- de(i, t.options.enablePasteRules) && p && s.push(...p());
679
- const f = S(i, "addProseMirrorPlugins", a);
673
+ const p = v(i, "addInputRules", a);
674
+ se(i, t.options.enableInputRules) && p && r.push(...p());
675
+ const h = v(i, "addPasteRules", a);
676
+ se(i, t.options.enablePasteRules) && h && s.push(...h());
677
+ const f = v(i, "addProseMirrorPlugins", a);
680
678
  if (f) {
681
- const g = f();
682
- l.push(...g);
679
+ const y = f();
680
+ l.push(...y);
683
681
  }
684
682
  return l;
685
683
  }).flat();
686
684
  return [
687
- hr({
685
+ Yn({
688
686
  editor: t,
689
687
  rules: r
690
688
  }),
691
- ...vr({
689
+ ...nr({
692
690
  editor: t,
693
691
  rules: s
694
692
  }),
@@ -700,32 +698,32 @@ class Z {
700
698
  * @returns An array of attributes
701
699
  */
702
700
  get attributes() {
703
- return De(this.extensions);
701
+ return xe(this.extensions);
704
702
  }
705
703
  /**
706
704
  * Get all node views from the extensions.
707
705
  * @returns An object with all node views where the key is the node name and the value is the node view function
708
706
  */
709
707
  get nodeViews() {
710
- const { editor: t } = this, { nodeExtensions: n } = vt(this.extensions);
711
- return Object.fromEntries(n.filter((r) => !!S(r, "addNodeView")).map((r) => {
708
+ const { editor: t } = this, { nodeExtensions: n } = gt(this.extensions);
709
+ return Object.fromEntries(n.filter((r) => !!v(r, "addNodeView")).map((r) => {
712
710
  const s = this.attributes.filter((l) => l.type === r.name), o = {
713
711
  name: r.name,
714
712
  options: r.options,
715
713
  storage: r.storage,
716
714
  editor: t,
717
- type: P(r.name, this.schema)
718
- }, i = S(r, "addNodeView", o);
715
+ type: H(r.name, this.schema)
716
+ }, i = v(r, "addNodeView", o);
719
717
  if (!i)
720
718
  return [];
721
719
  const a = (l, c, u, d) => {
722
- const h = It(l, s);
720
+ const p = Rt(l, s);
723
721
  return i()({
724
722
  editor: t,
725
723
  node: l,
726
724
  getPos: u,
727
725
  decorations: d,
728
- HTMLAttributes: h,
726
+ HTMLAttributes: p,
729
727
  extension: r
730
728
  });
731
729
  };
@@ -745,27 +743,27 @@ class Z {
745
743
  options: t.options,
746
744
  storage: t.storage,
747
745
  editor: this.editor,
748
- type: xt(t.name, this.schema)
746
+ type: Tt(t.name, this.schema)
749
747
  };
750
- t.type === "mark" && (!((n = C(S(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
751
- const s = S(t, "onBeforeCreate", r), o = S(t, "onCreate", r), i = S(t, "onUpdate", r), a = S(t, "onSelectionUpdate", r), l = S(t, "onTransaction", r), c = S(t, "onFocus", r), u = S(t, "onBlur", r), d = S(t, "onDestroy", r);
748
+ t.type === "mark" && (!((n = T(v(t, "keepOnSplit", r))) !== null && n !== void 0) || n) && this.splittableMarks.push(t.name);
749
+ const s = v(t, "onBeforeCreate", r), o = v(t, "onCreate", r), i = v(t, "onUpdate", r), a = v(t, "onSelectionUpdate", r), l = v(t, "onTransaction", r), c = v(t, "onFocus", r), u = v(t, "onBlur", r), d = v(t, "onDestroy", r);
752
750
  s && this.editor.on("beforeCreate", s), o && this.editor.on("create", o), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), l && this.editor.on("transaction", l), c && this.editor.on("focus", c), u && this.editor.on("blur", u), d && this.editor.on("destroy", d);
753
751
  });
754
752
  }
755
753
  }
756
- function Sr(e) {
754
+ function sr(e) {
757
755
  return Object.prototype.toString.call(e).slice(8, -1);
758
756
  }
759
- function at(e) {
760
- return Sr(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
757
+ function ot(e) {
758
+ return sr(e) !== "Object" ? !1 : e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
761
759
  }
762
- function St(e, t) {
760
+ function bt(e, t) {
763
761
  const n = { ...e };
764
- return at(e) && at(t) && Object.keys(t).forEach((r) => {
765
- at(t[r]) && at(e[r]) ? n[r] = St(e[r], t[r]) : n[r] = t[r];
762
+ return ot(e) && ot(t) && Object.keys(t).forEach((r) => {
763
+ ot(t[r]) && ot(e[r]) ? n[r] = bt(e[r], t[r]) : n[r] = t[r];
766
764
  }), n;
767
765
  }
768
- class H {
766
+ class R {
769
767
  constructor(t = {}) {
770
768
  this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
771
769
  name: this.name,
@@ -773,57 +771,57 @@ class H {
773
771
  }, this.config = {
774
772
  ...this.config,
775
773
  ...t
776
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = C(S(this, "addOptions", {
774
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = T(v(this, "addOptions", {
777
775
  name: this.name
778
- }))), this.storage = C(S(this, "addStorage", {
776
+ }))), this.storage = T(v(this, "addStorage", {
779
777
  name: this.name,
780
778
  options: this.options
781
779
  })) || {};
782
780
  }
783
781
  static create(t = {}) {
784
- return new H(t);
782
+ return new R(t);
785
783
  }
786
784
  configure(t = {}) {
787
785
  const n = this.extend({
788
786
  ...this.config,
789
- addOptions: () => St(this.options, t)
787
+ addOptions: () => bt(this.options, t)
790
788
  });
791
789
  return n.name = this.name, n.parent = this.parent, n;
792
790
  }
793
791
  extend(t = {}) {
794
- const n = new H({ ...this.config, ...t });
795
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = C(S(n, "addOptions", {
792
+ const n = new R({ ...this.config, ...t });
793
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = T(v(n, "addOptions", {
796
794
  name: n.name
797
- })), n.storage = C(S(n, "addStorage", {
795
+ })), n.storage = T(v(n, "addStorage", {
798
796
  name: n.name,
799
797
  options: n.options
800
798
  })), n;
801
799
  }
802
800
  }
803
- function je(e, t, n) {
801
+ function Oe(e, t, n) {
804
802
  const { from: r, to: s } = t, { blockSeparator: o = `
805
803
 
806
804
  `, textSerializers: i = {} } = n || {};
807
805
  let a = "";
808
806
  return e.nodesBetween(r, s, (l, c, u, d) => {
809
- var h;
807
+ var p;
810
808
  l.isBlock && c > r && (a += o);
811
- const p = i == null ? void 0 : i[l.type.name];
812
- if (p)
813
- return u && (a += p({
809
+ const h = i == null ? void 0 : i[l.type.name];
810
+ if (h)
811
+ return u && (a += h({
814
812
  node: l,
815
813
  pos: c,
816
814
  parent: u,
817
815
  index: d,
818
816
  range: t
819
817
  })), !1;
820
- l.isText && (a += (h = l == null ? void 0 : l.text) === null || h === void 0 ? void 0 : h.slice(Math.max(r, c) - c, s - c));
818
+ l.isText && (a += (p = l == null ? void 0 : l.text) === null || p === void 0 ? void 0 : p.slice(Math.max(r, c) - c, s - c));
821
819
  }), a;
822
820
  }
823
- function Fe(e) {
821
+ function Le(e) {
824
822
  return Object.fromEntries(Object.entries(e.nodes).filter(([, t]) => t.spec.toText).map(([t, n]) => [t, n.spec.toText]));
825
823
  }
826
- const kr = H.create({
824
+ const or = R.create({
827
825
  name: "clipboardTextSerializer",
828
826
  addOptions() {
829
827
  return {
@@ -832,12 +830,12 @@ const kr = H.create({
832
830
  },
833
831
  addProseMirrorPlugins() {
834
832
  return [
835
- new _({
833
+ new P({
836
834
  key: new $("clipboardTextSerializer"),
837
835
  props: {
838
836
  clipboardTextSerializer: () => {
839
- const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), l = Fe(n);
840
- return je(r, { from: i, to: a }, {
837
+ const { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: s } = t, { ranges: o } = s, i = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), l = Le(n);
838
+ return Oe(r, { from: i, to: a }, {
841
839
  ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
842
840
  textSerializers: l
843
841
  });
@@ -846,32 +844,32 @@ const kr = H.create({
846
844
  })
847
845
  ];
848
846
  }
849
- }), wr = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
847
+ }), ir = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
850
848
  var n;
851
849
  e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) === null || n === void 0 || n.removeAllRanges());
852
- }), !0), Er = (e = !1) => ({ commands: t }) => t.setContent("", e), Tr = () => ({ state: e, tr: t, dispatch: n }) => {
850
+ }), !0), ar = (e = !1) => ({ commands: t }) => t.setContent("", e), lr = () => ({ state: e, tr: t, dispatch: n }) => {
853
851
  const { selection: r } = t, { ranges: s } = r;
854
852
  return n && s.forEach(({ $from: o, $to: i }) => {
855
853
  e.doc.nodesBetween(o.pos, i.pos, (a, l) => {
856
854
  if (a.type.isText)
857
855
  return;
858
- const { doc: c, mapping: u } = t, d = c.resolve(u.map(l)), h = c.resolve(u.map(l + a.nodeSize)), p = d.blockRange(h);
859
- if (!p)
856
+ const { doc: c, mapping: u } = t, d = c.resolve(u.map(l)), p = c.resolve(u.map(l + a.nodeSize)), h = d.blockRange(p);
857
+ if (!h)
860
858
  return;
861
- const f = sn(p);
859
+ const f = Ke(h);
862
860
  if (a.type.isTextblock) {
863
- const { defaultType: g } = d.parent.contentMatchAt(d.index());
864
- t.setNodeMarkup(p.start, g);
861
+ const { defaultType: y } = d.parent.contentMatchAt(d.index());
862
+ t.setNodeMarkup(h.start, y);
865
863
  }
866
- (f || f === 0) && t.lift(p, f);
864
+ (f || f === 0) && t.lift(h, f);
867
865
  });
868
866
  }), !0;
869
- }, Cr = (e) => (t) => e(t), xr = () => ({ state: e, dispatch: t }) => on(e, t), Ar = (e, t) => ({ editor: n, tr: r }) => {
867
+ }, cr = (e) => (t) => e(t), dr = () => ({ state: e, dispatch: t }) => Ue(e, t), ur = (e, t) => ({ editor: n, tr: r }) => {
870
868
  const { state: s } = n, o = s.doc.slice(e.from, e.to);
871
869
  r.deleteRange(e.from, e.to);
872
870
  const i = r.mapping.map(t);
873
871
  return r.insert(i, o.content), r.setSelection(new N(r.doc.resolve(i - 1))), !0;
874
- }, Or = () => ({ tr: e, dispatch: t }) => {
872
+ }, pr = () => ({ tr: e, dispatch: t }) => {
875
873
  const { selection: n } = e, r = n.$anchor.node();
876
874
  if (r.content.size > 0)
877
875
  return !1;
@@ -885,8 +883,8 @@ const kr = H.create({
885
883
  return !0;
886
884
  }
887
885
  return !1;
888
- }, Lr = (e) => ({ tr: t, state: n, dispatch: r }) => {
889
- const s = P(e, n.schema), o = t.selection.$anchor;
886
+ }, hr = (e) => ({ tr: t, state: n, dispatch: r }) => {
887
+ const s = H(e, n.schema), o = t.selection.$anchor;
890
888
  for (let i = o.depth; i > 0; i -= 1)
891
889
  if (o.node(i).type === s) {
892
890
  if (r) {
@@ -896,40 +894,40 @@ const kr = H.create({
896
894
  return !0;
897
895
  }
898
896
  return !1;
899
- }, Rr = (e) => ({ tr: t, dispatch: n }) => {
897
+ }, fr = (e) => ({ tr: t, dispatch: n }) => {
900
898
  const { from: r, to: s } = e;
901
899
  return n && t.delete(r, s), !0;
902
- }, Hr = () => ({ state: e, dispatch: t }) => an(e, t), Pr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), _r = () => ({ state: e, dispatch: t }) => ln(e, t);
903
- function mt(e, t, n = { strict: !0 }) {
900
+ }, mr = () => ({ state: e, dispatch: t }) => qe(e, t), gr = () => ({ commands: e }) => e.keyboardShortcut("Enter"), yr = () => ({ state: e, dispatch: t }) => Ge(e, t);
901
+ function pt(e, t, n = { strict: !0 }) {
904
902
  const r = Object.keys(t);
905
- return r.length ? r.every((s) => n.strict ? t[s] === e[s] : qt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
903
+ return r.length ? r.every((s) => n.strict ? t[s] === e[s] : Wt(t[s]) ? t[s].test(e[s]) : t[s] === e[s]) : !0;
906
904
  }
907
- function $t(e, t, n = {}) {
908
- return e.find((r) => r.type === t && mt(r.attrs, n));
905
+ function _t(e, t, n = {}) {
906
+ return e.find((r) => r.type === t && pt(r.attrs, n));
909
907
  }
910
- function Ir(e, t, n = {}) {
911
- return !!$t(e, t, n);
908
+ function br(e, t, n = {}) {
909
+ return !!_t(e, t, n);
912
910
  }
913
- function Gt(e, t, n = {}) {
911
+ function Vt(e, t, n = {}) {
914
912
  if (!e || !t)
915
913
  return;
916
914
  let r = e.parent.childAfter(e.parentOffset);
917
915
  if (e.parentOffset === r.offset && r.offset !== 0 && (r = e.parent.childBefore(e.parentOffset)), !r.node)
918
916
  return;
919
- const s = $t([...r.node.marks], t, n);
917
+ const s = _t([...r.node.marks], t, n);
920
918
  if (!s)
921
919
  return;
922
920
  let o = r.index, i = e.start() + r.offset, a = o + 1, l = i + r.node.nodeSize;
923
- for ($t([...r.node.marks], t, n); o > 0 && s.isInSet(e.parent.child(o - 1).marks); )
921
+ for (_t([...r.node.marks], t, n); o > 0 && s.isInSet(e.parent.child(o - 1).marks); )
924
922
  o -= 1, i -= e.parent.child(o).nodeSize;
925
- for (; a < e.parent.childCount && Ir([...e.parent.child(a).marks], t, n); )
923
+ for (; a < e.parent.childCount && br([...e.parent.child(a).marks], t, n); )
926
924
  l += e.parent.child(a).nodeSize, a += 1;
927
925
  return {
928
926
  from: i,
929
927
  to: l
930
928
  };
931
929
  }
932
- function K(e, t) {
930
+ function W(e, t) {
933
931
  if (typeof e == "string") {
934
932
  if (!t.marks[e])
935
933
  throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
@@ -937,41 +935,41 @@ function K(e, t) {
937
935
  }
938
936
  return e;
939
937
  }
940
- const $r = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
941
- const o = K(e, r.schema), { doc: i, selection: a } = n, { $from: l, from: c, to: u } = a;
938
+ const vr = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
939
+ const o = W(e, r.schema), { doc: i, selection: a } = n, { $from: l, from: c, to: u } = a;
942
940
  if (s) {
943
- const d = Gt(l, o, t);
941
+ const d = Vt(l, o, t);
944
942
  if (d && d.from <= c && d.to >= u) {
945
- const h = N.create(i, d.from, d.to);
946
- n.setSelection(h);
943
+ const p = N.create(i, d.from, d.to);
944
+ n.setSelection(p);
947
945
  }
948
946
  }
949
947
  return !0;
950
- }, Nr = (e) => (t) => {
948
+ }, Mr = (e) => (t) => {
951
949
  const n = typeof e == "function" ? e(t) : e;
952
950
  for (let r = 0; r < n.length; r += 1)
953
951
  if (n[r](t))
954
952
  return !0;
955
953
  return !1;
956
954
  };
957
- function Jt(e) {
955
+ function Kt(e) {
958
956
  return e instanceof N;
959
957
  }
960
- function j(e = 0, t = 0, n = 0) {
958
+ function B(e = 0, t = 0, n = 0) {
961
959
  return Math.min(Math.max(e, t), n);
962
960
  }
963
- function ze(e, t = null) {
961
+ function Re(e, t = null) {
964
962
  if (!t)
965
963
  return null;
966
- const n = W.atStart(e), r = W.atEnd(e);
964
+ const n = G.atStart(e), r = G.atEnd(e);
967
965
  if (t === "start" || t === !0)
968
966
  return n;
969
967
  if (t === "end")
970
968
  return r;
971
969
  const s = n.from, o = r.to;
972
- return t === "all" ? N.create(e, j(0, s, o), j(e.content.size, s, o)) : N.create(e, j(t, s, o), j(t, s, o));
970
+ return t === "all" ? N.create(e, B(0, s, o), B(e.content.size, s, o)) : N.create(e, B(t, s, o), B(t, s, o));
973
971
  }
974
- function kt() {
972
+ function vt() {
975
973
  return [
976
974
  "iPad Simulator",
977
975
  "iPhone Simulator",
@@ -981,35 +979,35 @@ function kt() {
981
979
  "iPod"
982
980
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
983
981
  }
984
- const Dr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
982
+ const Sr = (e = null, t = {}) => ({ editor: n, view: r, tr: s, dispatch: o }) => {
985
983
  t = {
986
984
  scrollIntoView: !0,
987
985
  ...t
988
986
  };
989
987
  const i = () => {
990
- kt() && r.dom.focus(), requestAnimationFrame(() => {
988
+ vt() && r.dom.focus(), requestAnimationFrame(() => {
991
989
  n.isDestroyed || (r.focus(), t != null && t.scrollIntoView && n.commands.scrollIntoView());
992
990
  });
993
991
  };
994
992
  if (r.hasFocus() && e === null || e === !1)
995
993
  return !0;
996
- if (o && e === null && !Jt(n.state.selection))
994
+ if (o && e === null && !Kt(n.state.selection))
997
995
  return i(), !0;
998
- const a = ze(s.doc, e) || n.state.selection, l = n.state.selection.eq(a);
996
+ const a = Re(s.doc, e) || n.state.selection, l = n.state.selection.eq(a);
999
997
  return o && (l || s.setSelection(a), l && s.storedMarks && s.setStoredMarks(s.storedMarks), i()), !0;
1000
- }, Br = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), jr = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), We = (e) => {
998
+ }, kr = (e, t) => (n) => e.every((r, s) => t(r, { ...n, index: s })), wr = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, e, t), _e = (e) => {
1001
999
  const t = e.childNodes;
1002
1000
  for (let n = t.length - 1; n >= 0; n -= 1) {
1003
1001
  const r = t[n];
1004
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && We(r);
1002
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && _e(r);
1005
1003
  }
1006
1004
  return e;
1007
1005
  };
1008
- function lt(e) {
1006
+ function it(e) {
1009
1007
  const t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
1010
- return We(n);
1008
+ return _e(n);
1011
1009
  }
1012
- function gt(e, t, n) {
1010
+ function ht(e, t, n) {
1013
1011
  n = {
1014
1012
  slice: !0,
1015
1013
  parseOptions: {},
@@ -1019,18 +1017,18 @@ function gt(e, t, n) {
1019
1017
  if (r)
1020
1018
  try {
1021
1019
  if (Array.isArray(e) && e.length > 0)
1022
- return pt.fromArray(e.map((a) => t.nodeFromJSON(a)));
1020
+ return ct.fromArray(e.map((a) => t.nodeFromJSON(a)));
1023
1021
  const i = t.nodeFromJSON(e);
1024
1022
  return n.errorOnInvalidContent && i.check(), i;
1025
1023
  } catch (o) {
1026
1024
  if (n.errorOnInvalidContent)
1027
1025
  throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
1028
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), gt("", t, n);
1026
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", e, "Error:", o), ht("", t, n);
1029
1027
  }
1030
1028
  if (s) {
1031
1029
  if (n.errorOnInvalidContent) {
1032
1030
  let i = !1, a = "";
1033
- const l = new Re({
1031
+ const l = new Se({
1034
1032
  topNode: t.spec.topNode,
1035
1033
  marks: t.spec.marks,
1036
1034
  // Prosemirror's schemas are executed such that: the last to execute, matches last
@@ -1048,28 +1046,28 @@ function gt(e, t, n) {
1048
1046
  }
1049
1047
  })
1050
1048
  });
1051
- if (n.slice ? Ct.fromSchema(l).parseSlice(lt(e), n.parseOptions) : Ct.fromSchema(l).parse(lt(e), n.parseOptions), n.errorOnInvalidContent && i)
1049
+ if (n.slice ? wt.fromSchema(l).parseSlice(it(e), n.parseOptions) : wt.fromSchema(l).parse(it(e), n.parseOptions), n.errorOnInvalidContent && i)
1052
1050
  throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
1053
1051
  }
1054
- const o = Ct.fromSchema(t);
1055
- return n.slice ? o.parseSlice(lt(e), n.parseOptions).content : o.parse(lt(e), n.parseOptions);
1052
+ const o = wt.fromSchema(t);
1053
+ return n.slice ? o.parseSlice(it(e), n.parseOptions).content : o.parse(it(e), n.parseOptions);
1056
1054
  }
1057
- return gt("", t, n);
1055
+ return ht("", t, n);
1058
1056
  }
1059
- function Fr(e, t, n) {
1057
+ function Tr(e, t, n) {
1060
1058
  const r = e.steps.length - 1;
1061
1059
  if (r < t)
1062
1060
  return;
1063
1061
  const s = e.steps[r];
1064
- if (!(s instanceof Rn || s instanceof Hn))
1062
+ if (!(s instanceof bn || s instanceof vn))
1065
1063
  return;
1066
1064
  const o = e.mapping.maps[r];
1067
1065
  let i = 0;
1068
1066
  o.forEach((a, l, c, u) => {
1069
1067
  i === 0 && (i = u);
1070
- }), e.setSelection(W.near(e.doc.resolve(i), n));
1068
+ }), e.setSelection(G.near(e.doc.resolve(i), n));
1071
1069
  }
1072
- const zr = (e) => !("type" in e), Wr = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
1070
+ const Er = (e) => !("type" in e), Cr = (e, t, n) => ({ tr: r, dispatch: s, editor: o }) => {
1073
1071
  var i;
1074
1072
  if (s) {
1075
1073
  n = {
@@ -1081,7 +1079,7 @@ const zr = (e) => !("type" in e), Wr = (e, t, n) => ({ tr: r, dispatch: s, edito
1081
1079
  };
1082
1080
  let a;
1083
1081
  try {
1084
- a = gt(t, o.schema, {
1082
+ a = ht(t, o.schema, {
1085
1083
  parseOptions: {
1086
1084
  preserveWhitespace: "full",
1087
1085
  ...n.parseOptions
@@ -1098,35 +1096,35 @@ const zr = (e) => !("type" in e), Wr = (e, t, n) => ({ tr: r, dispatch: s, edito
1098
1096
  }), !1;
1099
1097
  }
1100
1098
  let { from: l, to: c } = typeof e == "number" ? { from: e, to: e } : { from: e.from, to: e.to }, u = !0, d = !0;
1101
- if ((zr(a) ? a : [a]).forEach((f) => {
1099
+ if ((Er(a) ? a : [a]).forEach((f) => {
1102
1100
  f.check(), u = u ? f.isText && f.marks.length === 0 : !1, d = d ? f.isBlock : !1;
1103
1101
  }), l === c && d) {
1104
1102
  const { parent: f } = r.doc.resolve(l);
1105
1103
  f.isTextblock && !f.type.spec.code && !f.childCount && (l -= 1, c += 1);
1106
1104
  }
1107
- let p;
1108
- u ? (Array.isArray(t) ? p = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? p = t.text : p = t, r.insertText(p, l, c)) : (p = a, r.replaceWith(l, c, p)), n.updateSelection && Fr(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: l, text: p }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: l, text: p });
1105
+ let h;
1106
+ u ? (Array.isArray(t) ? h = t.map((f) => f.text || "").join("") : typeof t == "object" && t && t.text ? h = t.text : h = t, r.insertText(h, l, c)) : (h = a, r.replaceWith(l, c, h)), n.updateSelection && Tr(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: l, text: h }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: l, text: h });
1109
1107
  }
1110
1108
  return !0;
1111
- }, Vr = () => ({ state: e, dispatch: t }) => cn(e, t), Kr = () => ({ state: e, dispatch: t }) => dn(e, t), Ur = () => ({ state: e, dispatch: t }) => un(e, t), qr = () => ({ state: e, dispatch: t }) => pn(e, t), Gr = () => ({ state: e, dispatch: t, tr: n }) => {
1109
+ }, xr = () => ({ state: e, dispatch: t }) => Je(e, t), Ar = () => ({ state: e, dispatch: t }) => Ye(e, t), Or = () => ({ state: e, dispatch: t }) => Xe(e, t), Lr = () => ({ state: e, dispatch: t }) => Qe(e, t), Rr = () => ({ state: e, dispatch: t, tr: n }) => {
1112
1110
  try {
1113
- const r = Le(e.doc, e.selection.$from.pos, -1);
1111
+ const r = Me(e.doc, e.selection.$from.pos, -1);
1114
1112
  return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
1115
1113
  } catch {
1116
1114
  return !1;
1117
1115
  }
1118
- }, Jr = () => ({ state: e, dispatch: t, tr: n }) => {
1116
+ }, _r = () => ({ state: e, dispatch: t, tr: n }) => {
1119
1117
  try {
1120
- const r = Le(e.doc, e.selection.$from.pos, 1);
1118
+ const r = Me(e.doc, e.selection.$from.pos, 1);
1121
1119
  return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
1122
1120
  } catch {
1123
1121
  return !1;
1124
1122
  }
1125
- }, Yr = () => ({ state: e, dispatch: t }) => hn(e, t), Xr = () => ({ state: e, dispatch: t }) => fn(e, t);
1126
- function Ve() {
1123
+ }, Hr = () => ({ state: e, dispatch: t }) => Ze(e, t), Ir = () => ({ state: e, dispatch: t }) => tn(e, t);
1124
+ function He() {
1127
1125
  return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
1128
1126
  }
1129
- function Qr(e) {
1127
+ function Pr(e) {
1130
1128
  const t = e.split(/-(?!$)/);
1131
1129
  let n = t[t.length - 1];
1132
1130
  n === "Space" && (n = " ");
@@ -1142,14 +1140,14 @@ function Qr(e) {
1142
1140
  else if (/^s(hift)?$/i.test(l))
1143
1141
  o = !0;
1144
1142
  else if (/^mod$/i.test(l))
1145
- kt() || Ve() ? i = !0 : s = !0;
1143
+ vt() || He() ? i = !0 : s = !0;
1146
1144
  else
1147
1145
  throw new Error(`Unrecognized modifier name: ${l}`);
1148
1146
  }
1149
1147
  return r && (n = `Alt-${n}`), s && (n = `Ctrl-${n}`), i && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
1150
1148
  }
1151
- const Zr = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
1152
- const o = Qr(e).split(/-(?!$)/), i = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), a = new KeyboardEvent("keydown", {
1149
+ const Nr = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
1150
+ const o = Pr(e).split(/-(?!$)/), i = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), a = new KeyboardEvent("keydown", {
1153
1151
  key: i === "Space" ? " " : i,
1154
1152
  altKey: o.includes("Alt"),
1155
1153
  ctrlKey: o.includes("Ctrl"),
@@ -1165,61 +1163,61 @@ const Zr = (e) => ({ editor: t, view: n, tr: r, dispatch: s }) => {
1165
1163
  u && s && r.maybeStep(u);
1166
1164
  }), !0;
1167
1165
  };
1168
- function rt(e, t, n = {}) {
1169
- const { from: r, to: s, empty: o } = e.selection, i = t ? P(t, e.schema) : null, a = [];
1170
- e.doc.nodesBetween(r, s, (d, h) => {
1166
+ function nt(e, t, n = {}) {
1167
+ const { from: r, to: s, empty: o } = e.selection, i = t ? H(t, e.schema) : null, a = [];
1168
+ e.doc.nodesBetween(r, s, (d, p) => {
1171
1169
  if (d.isText)
1172
1170
  return;
1173
- const p = Math.max(r, h), f = Math.min(s, h + d.nodeSize);
1171
+ const h = Math.max(r, p), f = Math.min(s, p + d.nodeSize);
1174
1172
  a.push({
1175
1173
  node: d,
1176
- from: p,
1174
+ from: h,
1177
1175
  to: f
1178
1176
  });
1179
1177
  });
1180
- const l = s - r, c = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => mt(d.node.attrs, n, { strict: !1 }));
1181
- return o ? !!c.length : c.reduce((d, h) => d + h.to - h.from, 0) >= l;
1182
- }
1183
- const ts = (e, t = {}) => ({ state: n, dispatch: r }) => {
1184
- const s = P(e, n.schema);
1185
- return rt(n, s, t) ? mn(n, r) : !1;
1186
- }, es = () => ({ state: e, dispatch: t }) => gn(e, t), ns = (e) => ({ state: t, dispatch: n }) => {
1187
- const r = P(e, t.schema);
1188
- return yn(r)(t, n);
1189
- }, rs = () => ({ state: e, dispatch: t }) => bn(e, t);
1190
- function wt(e, t) {
1178
+ const l = s - r, c = a.filter((d) => i ? i.name === d.node.type.name : !0).filter((d) => pt(d.node.attrs, n, { strict: !1 }));
1179
+ return o ? !!c.length : c.reduce((d, p) => d + p.to - p.from, 0) >= l;
1180
+ }
1181
+ const $r = (e, t = {}) => ({ state: n, dispatch: r }) => {
1182
+ const s = H(e, n.schema);
1183
+ return nt(n, s, t) ? en(n, r) : !1;
1184
+ }, Dr = () => ({ state: e, dispatch: t }) => nn(e, t), Br = (e) => ({ state: t, dispatch: n }) => {
1185
+ const r = H(e, t.schema);
1186
+ return rn(r)(t, n);
1187
+ }, jr = () => ({ state: e, dispatch: t }) => sn(e, t);
1188
+ function Mt(e, t) {
1191
1189
  return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
1192
1190
  }
1193
- function ue(e, t) {
1191
+ function oe(e, t) {
1194
1192
  const n = typeof t == "string" ? [t] : t;
1195
1193
  return Object.keys(e).reduce((r, s) => (n.includes(s) || (r[s] = e[s]), r), {});
1196
1194
  }
1197
- const ss = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
1195
+ const Fr = (e, t) => ({ tr: n, state: r, dispatch: s }) => {
1198
1196
  let o = null, i = null;
1199
- const a = wt(typeof e == "string" ? e : e.name, r.schema);
1200
- return a ? (a === "node" && (o = P(e, r.schema)), a === "mark" && (i = K(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1197
+ const a = Mt(typeof e == "string" ? e : e.name, r.schema);
1198
+ return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = W(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1201
1199
  r.doc.nodesBetween(l.$from.pos, l.$to.pos, (c, u) => {
1202
- o && o === c.type && n.setNodeMarkup(u, void 0, ue(c.attrs, t)), i && c.marks.length && c.marks.forEach((d) => {
1203
- i === d.type && n.addMark(u, u + c.nodeSize, i.create(ue(d.attrs, t)));
1200
+ o && o === c.type && n.setNodeMarkup(u, void 0, oe(c.attrs, t)), i && c.marks.length && c.marks.forEach((d) => {
1201
+ i === d.type && n.addMark(u, u + c.nodeSize, i.create(oe(d.attrs, t)));
1204
1202
  });
1205
1203
  });
1206
1204
  }), !0) : !1;
1207
- }, os = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), is = () => ({ tr: e, commands: t }) => t.setTextSelection({
1205
+ }, zr = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Wr = () => ({ tr: e, commands: t }) => t.setTextSelection({
1208
1206
  from: 0,
1209
1207
  to: e.doc.content.size
1210
- }), as = () => ({ state: e, dispatch: t }) => vn(e, t), ls = () => ({ state: e, dispatch: t }) => Mn(e, t), cs = () => ({ state: e, dispatch: t }) => Sn(e, t), ds = () => ({ state: e, dispatch: t }) => kn(e, t), us = () => ({ state: e, dispatch: t }) => wn(e, t);
1211
- function Nt(e, t, n = {}, r = {}) {
1212
- return gt(e, t, {
1208
+ }), Vr = () => ({ state: e, dispatch: t }) => on(e, t), Kr = () => ({ state: e, dispatch: t }) => an(e, t), Ur = () => ({ state: e, dispatch: t }) => ln(e, t), qr = () => ({ state: e, dispatch: t }) => cn(e, t), Gr = () => ({ state: e, dispatch: t }) => dn(e, t);
1209
+ function Ht(e, t, n = {}, r = {}) {
1210
+ return ht(e, t, {
1213
1211
  slice: !1,
1214
1212
  parseOptions: n,
1215
1213
  errorOnInvalidContent: r.errorOnInvalidContent
1216
1214
  });
1217
1215
  }
1218
- const ps = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
1216
+ const Jr = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, commands: a }) => {
1219
1217
  var l, c;
1220
1218
  const { doc: u } = o;
1221
1219
  if (n.preserveWhitespace !== "full") {
1222
- const d = Nt(e, s.schema, n, {
1220
+ const d = Ht(e, s.schema, n, {
1223
1221
  errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : s.options.enableContentCheck
1224
1222
  });
1225
1223
  return i && o.replaceWith(0, u.content.size, d).setMeta("preventUpdate", !t), !0;
@@ -1229,23 +1227,23 @@ const ps = (e, t = !1, n = {}, r = {}) => ({ editor: s, tr: o, dispatch: i, comm
1229
1227
  errorOnInvalidContent: (c = r.errorOnInvalidContent) !== null && c !== void 0 ? c : s.options.enableContentCheck
1230
1228
  });
1231
1229
  };
1232
- function st(e, t) {
1233
- const n = K(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
1230
+ function rt(e, t) {
1231
+ const n = W(t, e.schema), { from: r, to: s, empty: o } = e.selection, i = [];
1234
1232
  o ? (e.storedMarks && i.push(...e.storedMarks), i.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, s, (l) => {
1235
1233
  i.push(...l.marks);
1236
1234
  });
1237
1235
  const a = i.find((l) => l.type.name === n.name);
1238
1236
  return a ? { ...a.attrs } : {};
1239
1237
  }
1240
- function hs(e, t) {
1241
- const n = new rn(e);
1238
+ function Yr(e, t) {
1239
+ const n = new Ve(e);
1242
1240
  return t.forEach((r) => {
1243
1241
  r.steps.forEach((s) => {
1244
1242
  n.step(s);
1245
1243
  });
1246
1244
  }), n;
1247
1245
  }
1248
- function fs(e) {
1246
+ function Xr(e) {
1249
1247
  for (let t = 0; t < e.edgeCount; t += 1) {
1250
1248
  const { type: n } = e.edge(t);
1251
1249
  if (n.isTextblock && !n.hasRequiredAttrs())
@@ -1253,7 +1251,7 @@ function fs(e) {
1253
1251
  }
1254
1252
  return null;
1255
1253
  }
1256
- function di(e, t) {
1254
+ function Wo(e, t) {
1257
1255
  const n = [];
1258
1256
  return e.descendants((r, s) => {
1259
1257
  t(r) && n.push({
@@ -1262,7 +1260,7 @@ function di(e, t) {
1262
1260
  });
1263
1261
  }), n;
1264
1262
  }
1265
- function ms(e, t, n) {
1263
+ function Qr(e, t, n) {
1266
1264
  const r = [];
1267
1265
  return e.nodesBetween(t.from, t.to, (s, o) => {
1268
1266
  n(s) && r.push({
@@ -1271,7 +1269,7 @@ function ms(e, t, n) {
1271
1269
  });
1272
1270
  }), r;
1273
1271
  }
1274
- function Ke(e, t) {
1272
+ function Ie(e, t) {
1275
1273
  for (let n = e.depth; n > 0; n -= 1) {
1276
1274
  const r = e.node(n);
1277
1275
  if (t(r))
@@ -1283,44 +1281,44 @@ function Ke(e, t) {
1283
1281
  };
1284
1282
  }
1285
1283
  }
1286
- function Yt(e) {
1287
- return (t) => Ke(t.$from, e);
1284
+ function Ut(e) {
1285
+ return (t) => Ie(t.$from, e);
1288
1286
  }
1289
- function gs(e, t) {
1290
- const n = Pn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
1287
+ function Zr(e, t) {
1288
+ const n = Mn.fromSchema(t).serializeFragment(e), s = document.implementation.createHTMLDocument().createElement("div");
1291
1289
  return s.appendChild(n), s.innerHTML;
1292
1290
  }
1293
- function ys(e, t) {
1291
+ function ts(e, t) {
1294
1292
  const n = {
1295
1293
  from: 0,
1296
1294
  to: e.content.size
1297
1295
  };
1298
- return je(e, n, t);
1296
+ return Oe(e, n, t);
1299
1297
  }
1300
- function bs(e, t) {
1301
- const n = P(t, e.schema), { from: r, to: s } = e.selection, o = [];
1298
+ function es(e, t) {
1299
+ const n = H(t, e.schema), { from: r, to: s } = e.selection, o = [];
1302
1300
  e.doc.nodesBetween(r, s, (a) => {
1303
1301
  o.push(a);
1304
1302
  });
1305
1303
  const i = o.reverse().find((a) => a.type.name === n.name);
1306
1304
  return i ? { ...i.attrs } : {};
1307
1305
  }
1308
- function Ue(e, t) {
1309
- const n = wt(typeof t == "string" ? t : t.name, e.schema);
1310
- return n === "node" ? bs(e, t) : n === "mark" ? st(e, t) : {};
1306
+ function Pe(e, t) {
1307
+ const n = Mt(typeof t == "string" ? t : t.name, e.schema);
1308
+ return n === "node" ? es(e, t) : n === "mark" ? rt(e, t) : {};
1311
1309
  }
1312
- function vs(e, t = JSON.stringify) {
1310
+ function ns(e, t = JSON.stringify) {
1313
1311
  const n = {};
1314
1312
  return e.filter((r) => {
1315
1313
  const s = t(r);
1316
1314
  return Object.prototype.hasOwnProperty.call(n, s) ? !1 : n[s] = !0;
1317
1315
  });
1318
1316
  }
1319
- function Ms(e) {
1320
- const t = vs(e);
1317
+ function rs(e) {
1318
+ const t = ns(e);
1321
1319
  return t.length === 1 ? t : t.filter((n, r) => !t.filter((o, i) => i !== r).some((o) => n.oldRange.from >= o.oldRange.from && n.oldRange.to <= o.oldRange.to && n.newRange.from >= o.newRange.from && n.newRange.to <= o.newRange.to));
1322
1320
  }
1323
- function Ss(e) {
1321
+ function ss(e) {
1324
1322
  const { mapping: t, steps: n } = e, r = [];
1325
1323
  return t.maps.forEach((s, o) => {
1326
1324
  const i = [];
@@ -1335,11 +1333,11 @@ function Ss(e) {
1335
1333
  i.push({ from: a, to: l });
1336
1334
  }
1337
1335
  i.forEach(({ from: a, to: l }) => {
1338
- const c = t.slice(o).map(a, -1), u = t.slice(o).map(l), d = t.invert().map(c, -1), h = t.invert().map(u);
1336
+ const c = t.slice(o).map(a, -1), u = t.slice(o).map(l), d = t.invert().map(c, -1), p = t.invert().map(u);
1339
1337
  r.push({
1340
1338
  oldRange: {
1341
1339
  from: d,
1342
- to: h
1340
+ to: p
1343
1341
  },
1344
1342
  newRange: {
1345
1343
  from: c,
@@ -1347,12 +1345,12 @@ function Ss(e) {
1347
1345
  }
1348
1346
  });
1349
1347
  });
1350
- }), Ms(r);
1348
+ }), rs(r);
1351
1349
  }
1352
- function Xt(e, t, n) {
1350
+ function qt(e, t, n) {
1353
1351
  const r = [];
1354
1352
  return e === t ? n.resolve(e).marks().forEach((s) => {
1355
- const o = n.resolve(e), i = Gt(o, s.type);
1353
+ const o = n.resolve(e), i = Vt(o, s.type);
1356
1354
  i && r.push({
1357
1355
  mark: s,
1358
1356
  ...i
@@ -1365,53 +1363,53 @@ function Xt(e, t, n) {
1365
1363
  })));
1366
1364
  }), r;
1367
1365
  }
1368
- function ht(e, t, n) {
1366
+ function dt(e, t, n) {
1369
1367
  return Object.fromEntries(Object.entries(n).filter(([r]) => {
1370
1368
  const s = e.find((o) => o.type === t && o.name === r);
1371
1369
  return s ? s.attribute.keepOnSplit : !1;
1372
1370
  }));
1373
1371
  }
1374
- function Dt(e, t, n = {}) {
1375
- const { empty: r, ranges: s } = e.selection, o = t ? K(t, e.schema) : null;
1372
+ function It(e, t, n = {}) {
1373
+ const { empty: r, ranges: s } = e.selection, o = t ? W(t, e.schema) : null;
1376
1374
  if (r)
1377
- return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => mt(d.attrs, n, { strict: !1 }));
1375
+ return !!(e.storedMarks || e.selection.$from.marks()).filter((d) => o ? o.name === d.type.name : !0).find((d) => pt(d.attrs, n, { strict: !1 }));
1378
1376
  let i = 0;
1379
1377
  const a = [];
1380
- if (s.forEach(({ $from: d, $to: h }) => {
1381
- const p = d.pos, f = h.pos;
1382
- e.doc.nodesBetween(p, f, (g, m) => {
1383
- if (!g.isText && !g.marks.length)
1378
+ if (s.forEach(({ $from: d, $to: p }) => {
1379
+ const h = d.pos, f = p.pos;
1380
+ e.doc.nodesBetween(h, f, (y, g) => {
1381
+ if (!y.isText && !y.marks.length)
1384
1382
  return;
1385
- const y = Math.max(p, m), k = Math.min(f, m + g.nodeSize), v = k - y;
1386
- i += v, a.push(...g.marks.map((b) => ({
1387
- mark: b,
1388
- from: y,
1383
+ const m = Math.max(h, g), k = Math.min(f, g + y.nodeSize), b = k - m;
1384
+ i += b, a.push(...y.marks.map((S) => ({
1385
+ mark: S,
1386
+ from: m,
1389
1387
  to: k
1390
1388
  })));
1391
1389
  });
1392
1390
  }), i === 0)
1393
1391
  return !1;
1394
- const l = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => mt(d.mark.attrs, n, { strict: !1 })).reduce((d, h) => d + h.to - h.from, 0), c = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, h) => d + h.to - h.from, 0);
1392
+ const l = a.filter((d) => o ? o.name === d.mark.type.name : !0).filter((d) => pt(d.mark.attrs, n, { strict: !1 })).reduce((d, p) => d + p.to - p.from, 0), c = a.filter((d) => o ? d.mark.type !== o && d.mark.type.excludes(o) : !0).reduce((d, p) => d + p.to - p.from, 0);
1395
1393
  return (l > 0 ? l + c : l) >= i;
1396
1394
  }
1397
- function ks(e, t, n = {}) {
1395
+ function os(e, t, n = {}) {
1398
1396
  if (!t)
1399
- return rt(e, null, n) || Dt(e, null, n);
1400
- const r = wt(t, e.schema);
1401
- return r === "node" ? rt(e, t, n) : r === "mark" ? Dt(e, t, n) : !1;
1397
+ return nt(e, null, n) || It(e, null, n);
1398
+ const r = Mt(t, e.schema);
1399
+ return r === "node" ? nt(e, t, n) : r === "mark" ? It(e, t, n) : !1;
1402
1400
  }
1403
- function pe(e, t) {
1404
- const { nodeExtensions: n } = vt(t), r = n.find((i) => i.name === e);
1401
+ function ie(e, t) {
1402
+ const { nodeExtensions: n } = gt(t), r = n.find((i) => i.name === e);
1405
1403
  if (!r)
1406
1404
  return !1;
1407
1405
  const s = {
1408
1406
  name: r.name,
1409
1407
  options: r.options,
1410
1408
  storage: r.storage
1411
- }, o = C(S(r, "group", s));
1409
+ }, o = T(v(r, "group", s));
1412
1410
  return typeof o != "string" ? !1 : o.split(" ").includes("list");
1413
1411
  }
1414
- function Qt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1412
+ function Gt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1415
1413
  var r;
1416
1414
  if (n) {
1417
1415
  if (e.type.name === "hardBreak")
@@ -1428,57 +1426,57 @@ function Qt(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1428
1426
  if (t) {
1429
1427
  let s = !0;
1430
1428
  return e.content.forEach((o) => {
1431
- s !== !1 && (Qt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
1429
+ s !== !1 && (Gt(o, { ignoreWhitespace: n, checkChildren: t }) || (s = !1));
1432
1430
  }), s;
1433
1431
  }
1434
1432
  return !1;
1435
1433
  }
1436
- function qe(e) {
1437
- return e instanceof tt;
1434
+ function Ne(e) {
1435
+ return e instanceof Z;
1438
1436
  }
1439
- function ws(e, t, n) {
1440
- const s = e.state.doc.content.size, o = j(t, 0, s), i = j(n, 0, s), a = e.coordsAtPos(o), l = e.coordsAtPos(i, -1), c = Math.min(a.top, l.top), u = Math.max(a.bottom, l.bottom), d = Math.min(a.left, l.left), h = Math.max(a.right, l.right), p = h - d, f = u - c, y = {
1437
+ function is(e, t, n) {
1438
+ const s = e.state.doc.content.size, o = B(t, 0, s), i = B(n, 0, s), a = e.coordsAtPos(o), l = e.coordsAtPos(i, -1), c = Math.min(a.top, l.top), u = Math.max(a.bottom, l.bottom), d = Math.min(a.left, l.left), p = Math.max(a.right, l.right), h = p - d, f = u - c, m = {
1441
1439
  top: c,
1442
1440
  bottom: u,
1443
1441
  left: d,
1444
- right: h,
1445
- width: p,
1442
+ right: p,
1443
+ width: h,
1446
1444
  height: f,
1447
1445
  x: d,
1448
1446
  y: c
1449
1447
  };
1450
1448
  return {
1451
- ...y,
1452
- toJSON: () => y
1449
+ ...m,
1450
+ toJSON: () => m
1453
1451
  };
1454
1452
  }
1455
- function Es(e, t, n) {
1453
+ function as(e, t, n) {
1456
1454
  var r;
1457
1455
  const { selection: s } = t;
1458
1456
  let o = null;
1459
- if (Jt(s) && (o = s.$cursor), o) {
1457
+ if (Kt(s) && (o = s.$cursor), o) {
1460
1458
  const a = (r = e.storedMarks) !== null && r !== void 0 ? r : o.marks();
1461
1459
  return !!n.isInSet(a) || !a.some((l) => l.type.excludes(n));
1462
1460
  }
1463
1461
  const { ranges: i } = s;
1464
1462
  return i.some(({ $from: a, $to: l }) => {
1465
1463
  let c = a.depth === 0 ? e.doc.inlineContent && e.doc.type.allowsMarkType(n) : !1;
1466
- return e.doc.nodesBetween(a.pos, l.pos, (u, d, h) => {
1464
+ return e.doc.nodesBetween(a.pos, l.pos, (u, d, p) => {
1467
1465
  if (c)
1468
1466
  return !1;
1469
1467
  if (u.isInline) {
1470
- const p = !h || h.type.allowsMarkType(n), f = !!n.isInSet(u.marks) || !u.marks.some((g) => g.type.excludes(n));
1471
- c = p && f;
1468
+ const h = !p || p.type.allowsMarkType(n), f = !!n.isInSet(u.marks) || !u.marks.some((y) => y.type.excludes(n));
1469
+ c = h && f;
1472
1470
  }
1473
1471
  return !c;
1474
1472
  }), c;
1475
1473
  });
1476
1474
  }
1477
- const Ts = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1478
- const { selection: o } = n, { empty: i, ranges: a } = o, l = K(e, r.schema);
1475
+ const ls = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1476
+ const { selection: o } = n, { empty: i, ranges: a } = o, l = W(e, r.schema);
1479
1477
  if (s)
1480
1478
  if (i) {
1481
- const c = st(r, l);
1479
+ const c = rt(r, l);
1482
1480
  n.addStoredMark(l.create({
1483
1481
  ...c,
1484
1482
  ...t
@@ -1486,167 +1484,167 @@ const Ts = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1486
1484
  } else
1487
1485
  a.forEach((c) => {
1488
1486
  const u = c.$from.pos, d = c.$to.pos;
1489
- r.doc.nodesBetween(u, d, (h, p) => {
1490
- const f = Math.max(p, u), g = Math.min(p + h.nodeSize, d);
1491
- h.marks.find((y) => y.type === l) ? h.marks.forEach((y) => {
1492
- l === y.type && n.addMark(f, g, l.create({
1493
- ...y.attrs,
1487
+ r.doc.nodesBetween(u, d, (p, h) => {
1488
+ const f = Math.max(h, u), y = Math.min(h + p.nodeSize, d);
1489
+ p.marks.find((m) => m.type === l) ? p.marks.forEach((m) => {
1490
+ l === m.type && n.addMark(f, y, l.create({
1491
+ ...m.attrs,
1494
1492
  ...t
1495
1493
  }));
1496
- }) : n.addMark(f, g, l.create(t));
1494
+ }) : n.addMark(f, y, l.create(t));
1497
1495
  });
1498
1496
  });
1499
- return Es(r, n, l);
1500
- }, Cs = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), xs = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
1501
- const o = P(e, n.schema);
1502
- return o.isTextblock ? s().command(({ commands: i }) => ne(o, t)(n) ? !0 : i.clearNodes()).command(({ state: i }) => ne(o, t)(i, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1503
- }, As = (e) => ({ tr: t, dispatch: n }) => {
1497
+ return as(r, n, l);
1498
+ }, cs = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), ds = (e, t = {}) => ({ state: n, dispatch: r, chain: s }) => {
1499
+ const o = H(e, n.schema);
1500
+ return o.isTextblock ? s().command(({ commands: i }) => Yt(o, t)(n) ? !0 : i.clearNodes()).command(({ state: i }) => Yt(o, t)(i, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
1501
+ }, us = (e) => ({ tr: t, dispatch: n }) => {
1504
1502
  if (n) {
1505
- const { doc: r } = t, s = j(e, 0, r.content.size), o = tt.create(r, s);
1503
+ const { doc: r } = t, s = B(e, 0, r.content.size), o = Z.create(r, s);
1506
1504
  t.setSelection(o);
1507
1505
  }
1508
1506
  return !0;
1509
- }, Os = (e) => ({ tr: t, dispatch: n }) => {
1507
+ }, ps = (e) => ({ tr: t, dispatch: n }) => {
1510
1508
  if (n) {
1511
- const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = N.atStart(r).from, a = N.atEnd(r).to, l = j(s, i, a), c = j(o, i, a), u = N.create(r, l, c);
1509
+ const { doc: r } = t, { from: s, to: o } = typeof e == "number" ? { from: e, to: e } : e, i = N.atStart(r).from, a = N.atEnd(r).to, l = B(s, i, a), c = B(o, i, a), u = N.create(r, l, c);
1512
1510
  t.setSelection(u);
1513
1511
  }
1514
1512
  return !0;
1515
- }, Ls = (e) => ({ state: t, dispatch: n }) => {
1516
- const r = P(e, t.schema);
1517
- return En(r)(t, n);
1513
+ }, hs = (e) => ({ state: t, dispatch: n }) => {
1514
+ const r = H(e, t.schema);
1515
+ return un(r)(t, n);
1518
1516
  };
1519
- function he(e, t) {
1517
+ function ae(e, t) {
1520
1518
  const n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1521
1519
  if (n) {
1522
1520
  const r = n.filter((s) => t == null ? void 0 : t.includes(s.type.name));
1523
1521
  e.tr.ensureMarks(r);
1524
1522
  }
1525
1523
  }
1526
- const Rs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
1527
- const { selection: o, doc: i } = t, { $from: a, $to: l } = o, c = s.extensionManager.attributes, u = ht(c, a.node().type.name, a.node().attrs);
1528
- if (o instanceof tt && o.node.isBlock)
1529
- return !a.parentOffset || !ut(i, a.pos) ? !1 : (r && (e && he(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
1524
+ const fs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: s }) => {
1525
+ const { selection: o, doc: i } = t, { $from: a, $to: l } = o, c = s.extensionManager.attributes, u = dt(c, a.node().type.name, a.node().attrs);
1526
+ if (o instanceof Z && o.node.isBlock)
1527
+ return !a.parentOffset || !lt(i, a.pos) ? !1 : (r && (e && ae(n, s.extensionManager.splittableMarks), t.split(a.pos).scrollIntoView()), !0);
1530
1528
  if (!a.parent.isBlock)
1531
1529
  return !1;
1532
- const d = l.parentOffset === l.parent.content.size, h = a.depth === 0 ? void 0 : fs(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1533
- let p = d && h ? [
1530
+ const d = l.parentOffset === l.parent.content.size, p = a.depth === 0 ? void 0 : Xr(a.node(-1).contentMatchAt(a.indexAfter(-1)));
1531
+ let h = d && p ? [
1534
1532
  {
1535
- type: h,
1533
+ type: p,
1536
1534
  attrs: u
1537
1535
  }
1538
- ] : void 0, f = ut(t.doc, t.mapping.map(a.pos), 1, p);
1539
- if (!p && !f && ut(t.doc, t.mapping.map(a.pos), 1, h ? [{ type: h }] : void 0) && (f = !0, p = h ? [
1536
+ ] : void 0, f = lt(t.doc, t.mapping.map(a.pos), 1, h);
1537
+ if (!h && !f && lt(t.doc, t.mapping.map(a.pos), 1, p ? [{ type: p }] : void 0) && (f = !0, h = p ? [
1540
1538
  {
1541
- type: h,
1539
+ type: p,
1542
1540
  attrs: u
1543
1541
  }
1544
1542
  ] : void 0), r) {
1545
- if (f && (o instanceof N && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, p), h && !d && !a.parentOffset && a.parent.type !== h)) {
1546
- const g = t.mapping.map(a.before()), m = t.doc.resolve(g);
1547
- a.node(-1).canReplaceWith(m.index(), m.index() + 1, h) && t.setNodeMarkup(t.mapping.map(a.before()), h);
1543
+ if (f && (o instanceof N && t.deleteSelection(), t.split(t.mapping.map(a.pos), 1, h), p && !d && !a.parentOffset && a.parent.type !== p)) {
1544
+ const y = t.mapping.map(a.before()), g = t.doc.resolve(y);
1545
+ a.node(-1).canReplaceWith(g.index(), g.index() + 1, p) && t.setNodeMarkup(t.mapping.map(a.before()), p);
1548
1546
  }
1549
- e && he(n, s.extensionManager.splittableMarks), t.scrollIntoView();
1547
+ e && ae(n, s.extensionManager.splittableMarks), t.scrollIntoView();
1550
1548
  }
1551
1549
  return f;
1552
- }, Hs = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
1550
+ }, ms = (e, t = {}) => ({ tr: n, state: r, dispatch: s, editor: o }) => {
1553
1551
  var i;
1554
- const a = P(e, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
1552
+ const a = H(e, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
1555
1553
  if (u && u.isBlock || l.depth < 2 || !l.sameParent(c))
1556
1554
  return !1;
1557
1555
  const d = l.node(-1);
1558
1556
  if (d.type !== a)
1559
1557
  return !1;
1560
- const h = o.extensionManager.attributes;
1558
+ const p = o.extensionManager.attributes;
1561
1559
  if (l.parent.content.size === 0 && l.node(-1).childCount === l.indexAfter(-1)) {
1562
1560
  if (l.depth === 2 || l.node(-3).type !== a || l.index(-2) !== l.node(-2).childCount - 1)
1563
1561
  return !1;
1564
1562
  if (s) {
1565
- let y = pt.empty;
1563
+ let m = ct.empty;
1566
1564
  const k = l.index(-1) ? 1 : l.index(-2) ? 2 : 3;
1567
1565
  for (let A = l.depth - k; A >= l.depth - 3; A -= 1)
1568
- y = pt.from(l.node(A).copy(y));
1569
- const v = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, b = {
1570
- ...ht(h, l.node().type.name, l.node().attrs),
1566
+ m = ct.from(l.node(A).copy(m));
1567
+ const b = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, S = {
1568
+ ...dt(p, l.node().type.name, l.node().attrs),
1571
1569
  ...t
1572
- }, E = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(b)) || void 0;
1573
- y = y.append(pt.from(a.createAndFill(null, E) || void 0));
1570
+ }, w = ((i = a.contentMatch.defaultType) === null || i === void 0 ? void 0 : i.createAndFill(S)) || void 0;
1571
+ m = m.append(ct.from(a.createAndFill(null, w) || void 0));
1574
1572
  const M = l.before(l.depth - (k - 1));
1575
- n.replace(M, l.after(-v), new Tn(y, 4 - k, 0));
1576
- let T = -1;
1577
- n.doc.nodesBetween(M, n.doc.content.size, (A, w) => {
1578
- if (T > -1)
1573
+ n.replace(M, l.after(-b), new pn(m, 4 - k, 0));
1574
+ let C = -1;
1575
+ n.doc.nodesBetween(M, n.doc.content.size, (A, E) => {
1576
+ if (C > -1)
1579
1577
  return !1;
1580
- A.isTextblock && A.content.size === 0 && (T = w + 1);
1581
- }), T > -1 && n.setSelection(N.near(n.doc.resolve(T))), n.scrollIntoView();
1578
+ A.isTextblock && A.content.size === 0 && (C = E + 1);
1579
+ }), C > -1 && n.setSelection(N.near(n.doc.resolve(C))), n.scrollIntoView();
1582
1580
  }
1583
1581
  return !0;
1584
1582
  }
1585
- const p = c.pos === l.end() ? d.contentMatchAt(0).defaultType : null, f = {
1586
- ...ht(h, d.type.name, d.attrs),
1583
+ const h = c.pos === l.end() ? d.contentMatchAt(0).defaultType : null, f = {
1584
+ ...dt(p, d.type.name, d.attrs),
1587
1585
  ...t
1588
- }, g = {
1589
- ...ht(h, l.node().type.name, l.node().attrs),
1586
+ }, y = {
1587
+ ...dt(p, l.node().type.name, l.node().attrs),
1590
1588
  ...t
1591
1589
  };
1592
1590
  n.delete(l.pos, c.pos);
1593
- const m = p ? [
1591
+ const g = h ? [
1594
1592
  { type: a, attrs: f },
1595
- { type: p, attrs: g }
1593
+ { type: h, attrs: y }
1596
1594
  ] : [{ type: a, attrs: f }];
1597
- if (!ut(n.doc, l.pos, 2))
1595
+ if (!lt(n.doc, l.pos, 2))
1598
1596
  return !1;
1599
1597
  if (s) {
1600
- const { selection: y, storedMarks: k } = r, { splittableMarks: v } = o.extensionManager, b = k || y.$to.parentOffset && y.$from.marks();
1601
- if (n.split(l.pos, 2, m).scrollIntoView(), !b || !s)
1598
+ const { selection: m, storedMarks: k } = r, { splittableMarks: b } = o.extensionManager, S = k || m.$to.parentOffset && m.$from.marks();
1599
+ if (n.split(l.pos, 2, g).scrollIntoView(), !S || !s)
1602
1600
  return !0;
1603
- const E = b.filter((M) => v.includes(M.type.name));
1604
- n.ensureMarks(E);
1601
+ const w = S.filter((M) => b.includes(M.type.name));
1602
+ n.ensureMarks(w);
1605
1603
  }
1606
1604
  return !0;
1607
- }, At = (e, t) => {
1608
- const n = Yt((i) => i.type === t)(e.selection);
1605
+ }, Et = (e, t) => {
1606
+ const n = Ut((i) => i.type === t)(e.selection);
1609
1607
  if (!n)
1610
1608
  return !0;
1611
1609
  const r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1612
1610
  if (r === void 0)
1613
1611
  return !0;
1614
1612
  const s = e.doc.nodeAt(r);
1615
- return n.node.type === (s == null ? void 0 : s.type) && Wt(e.doc, n.pos) && e.join(n.pos), !0;
1616
- }, Ot = (e, t) => {
1617
- const n = Yt((i) => i.type === t)(e.selection);
1613
+ return n.node.type === (s == null ? void 0 : s.type) && Bt(e.doc, n.pos) && e.join(n.pos), !0;
1614
+ }, Ct = (e, t) => {
1615
+ const n = Ut((i) => i.type === t)(e.selection);
1618
1616
  if (!n)
1619
1617
  return !0;
1620
1618
  const r = e.doc.resolve(n.start).after(n.depth);
1621
1619
  if (r === void 0)
1622
1620
  return !0;
1623
1621
  const s = e.doc.nodeAt(r);
1624
- return n.node.type === (s == null ? void 0 : s.type) && Wt(e.doc, r) && e.join(r), !0;
1625
- }, Ps = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: l, commands: c, can: u }) => {
1626
- const { extensions: d, splittableMarks: h } = s.extensionManager, p = P(e, i.schema), f = P(t, i.schema), { selection: g, storedMarks: m } = i, { $from: y, $to: k } = g, v = y.blockRange(k), b = m || g.$to.parentOffset && g.$from.marks();
1627
- if (!v)
1622
+ return n.node.type === (s == null ? void 0 : s.type) && Bt(e.doc, r) && e.join(r), !0;
1623
+ }, gs = (e, t, n, r = {}) => ({ editor: s, tr: o, state: i, dispatch: a, chain: l, commands: c, can: u }) => {
1624
+ const { extensions: d, splittableMarks: p } = s.extensionManager, h = H(e, i.schema), f = H(t, i.schema), { selection: y, storedMarks: g } = i, { $from: m, $to: k } = y, b = m.blockRange(k), S = g || y.$to.parentOffset && y.$from.marks();
1625
+ if (!b)
1628
1626
  return !1;
1629
- const E = Yt((M) => pe(M.type.name, d))(g);
1630
- if (v.depth >= 1 && E && v.depth - E.depth <= 1) {
1631
- if (E.node.type === p)
1627
+ const w = Ut((M) => ie(M.type.name, d))(y);
1628
+ if (b.depth >= 1 && w && b.depth - w.depth <= 1) {
1629
+ if (w.node.type === h)
1632
1630
  return c.liftListItem(f);
1633
- if (pe(E.node.type.name, d) && p.validContent(E.node.content) && a)
1634
- return l().command(() => (o.setNodeMarkup(E.pos, p), !0)).command(() => At(o, p)).command(() => Ot(o, p)).run();
1635
- }
1636
- return !n || !b || !a ? l().command(() => u().wrapInList(p, r) ? !0 : c.clearNodes()).wrapInList(p, r).command(() => At(o, p)).command(() => Ot(o, p)).run() : l().command(() => {
1637
- const M = u().wrapInList(p, r), T = b.filter((A) => h.includes(A.type.name));
1638
- return o.ensureMarks(T), M ? !0 : c.clearNodes();
1639
- }).wrapInList(p, r).command(() => At(o, p)).command(() => Ot(o, p)).run();
1640
- }, _s = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
1641
- const { extendEmptyMarkRange: o = !1 } = n, i = K(e, r.schema);
1642
- return Dt(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
1643
- }, Is = (e, t, n = {}) => ({ state: r, commands: s }) => {
1644
- const o = P(e, r.schema), i = P(t, r.schema);
1645
- return rt(r, o, n) ? s.setNode(i) : s.setNode(o, n);
1646
- }, $s = (e, t = {}) => ({ state: n, commands: r }) => {
1647
- const s = P(e, n.schema);
1648
- return rt(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
1649
- }, Ns = () => ({ state: e, dispatch: t }) => {
1631
+ if (ie(w.node.type.name, d) && h.validContent(w.node.content) && a)
1632
+ return l().command(() => (o.setNodeMarkup(w.pos, h), !0)).command(() => Et(o, h)).command(() => Ct(o, h)).run();
1633
+ }
1634
+ return !n || !S || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => Et(o, h)).command(() => Ct(o, h)).run() : l().command(() => {
1635
+ const M = u().wrapInList(h, r), C = S.filter((A) => p.includes(A.type.name));
1636
+ return o.ensureMarks(C), M ? !0 : c.clearNodes();
1637
+ }).wrapInList(h, r).command(() => Et(o, h)).command(() => Ct(o, h)).run();
1638
+ }, ys = (e, t = {}, n = {}) => ({ state: r, commands: s }) => {
1639
+ const { extendEmptyMarkRange: o = !1 } = n, i = W(e, r.schema);
1640
+ return It(r, i, t) ? s.unsetMark(i, { extendEmptyMarkRange: o }) : s.setMark(i, t);
1641
+ }, bs = (e, t, n = {}) => ({ state: r, commands: s }) => {
1642
+ const o = H(e, r.schema), i = H(t, r.schema);
1643
+ return nt(r, o, n) ? s.setNode(i) : s.setNode(o, n);
1644
+ }, vs = (e, t = {}) => ({ state: n, commands: r }) => {
1645
+ const s = H(e, n.schema);
1646
+ return nt(n, s, t) ? r.lift(s) : r.wrapIn(s, t);
1647
+ }, Ms = () => ({ state: e, dispatch: t }) => {
1650
1648
  const n = e.plugins;
1651
1649
  for (let r = 0; r < n.length; r += 1) {
1652
1650
  const s = n[r];
@@ -1666,125 +1664,125 @@ const Rs = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, edit
1666
1664
  }
1667
1665
  }
1668
1666
  return !1;
1669
- }, Ds = () => ({ tr: e, dispatch: t }) => {
1667
+ }, Ss = () => ({ tr: e, dispatch: t }) => {
1670
1668
  const { selection: n } = e, { empty: r, ranges: s } = n;
1671
1669
  return r || t && s.forEach((o) => {
1672
1670
  e.removeMark(o.$from.pos, o.$to.pos);
1673
1671
  }), !0;
1674
- }, Bs = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1672
+ }, ks = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1675
1673
  var o;
1676
- const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, l = K(e, r.schema), { $from: c, empty: u, ranges: d } = a;
1674
+ const { extendEmptyMarkRange: i = !1 } = t, { selection: a } = n, l = W(e, r.schema), { $from: c, empty: u, ranges: d } = a;
1677
1675
  if (!s)
1678
1676
  return !0;
1679
1677
  if (u && i) {
1680
- let { from: h, to: p } = a;
1681
- const f = (o = c.marks().find((m) => m.type === l)) === null || o === void 0 ? void 0 : o.attrs, g = Gt(c, l, f);
1682
- g && (h = g.from, p = g.to), n.removeMark(h, p, l);
1678
+ let { from: p, to: h } = a;
1679
+ const f = (o = c.marks().find((g) => g.type === l)) === null || o === void 0 ? void 0 : o.attrs, y = Vt(c, l, f);
1680
+ y && (p = y.from, h = y.to), n.removeMark(p, h, l);
1683
1681
  } else
1684
- d.forEach((h) => {
1685
- n.removeMark(h.$from.pos, h.$to.pos, l);
1682
+ d.forEach((p) => {
1683
+ n.removeMark(p.$from.pos, p.$to.pos, l);
1686
1684
  });
1687
1685
  return n.removeStoredMark(l), !0;
1688
- }, js = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1686
+ }, ws = (e, t = {}) => ({ tr: n, state: r, dispatch: s }) => {
1689
1687
  let o = null, i = null;
1690
- const a = wt(typeof e == "string" ? e : e.name, r.schema);
1691
- return a ? (a === "node" && (o = P(e, r.schema)), a === "mark" && (i = K(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1688
+ const a = Mt(typeof e == "string" ? e : e.name, r.schema);
1689
+ return a ? (a === "node" && (o = H(e, r.schema)), a === "mark" && (i = W(e, r.schema)), s && n.selection.ranges.forEach((l) => {
1692
1690
  const c = l.$from.pos, u = l.$to.pos;
1693
- r.doc.nodesBetween(c, u, (d, h) => {
1694
- o && o === d.type && n.setNodeMarkup(h, void 0, {
1691
+ r.doc.nodesBetween(c, u, (d, p) => {
1692
+ o && o === d.type && n.setNodeMarkup(p, void 0, {
1695
1693
  ...d.attrs,
1696
1694
  ...t
1697
- }), i && d.marks.length && d.marks.forEach((p) => {
1698
- if (i === p.type) {
1699
- const f = Math.max(h, c), g = Math.min(h + d.nodeSize, u);
1700
- n.addMark(f, g, i.create({
1701
- ...p.attrs,
1695
+ }), i && d.marks.length && d.marks.forEach((h) => {
1696
+ if (i === h.type) {
1697
+ const f = Math.max(p, c), y = Math.min(p + d.nodeSize, u);
1698
+ n.addMark(f, y, i.create({
1699
+ ...h.attrs,
1702
1700
  ...t
1703
1701
  }));
1704
1702
  }
1705
1703
  });
1706
1704
  });
1707
1705
  }), !0) : !1;
1708
- }, Fs = (e, t = {}) => ({ state: n, dispatch: r }) => {
1709
- const s = P(e, n.schema);
1710
- return Cn(s, t)(n, r);
1711
- }, zs = (e, t = {}) => ({ state: n, dispatch: r }) => {
1712
- const s = P(e, n.schema);
1713
- return xn(s, t)(n, r);
1706
+ }, Ts = (e, t = {}) => ({ state: n, dispatch: r }) => {
1707
+ const s = H(e, n.schema);
1708
+ return hn(s, t)(n, r);
1709
+ }, Es = (e, t = {}) => ({ state: n, dispatch: r }) => {
1710
+ const s = H(e, n.schema);
1711
+ return fn(s, t)(n, r);
1714
1712
  };
1715
- var Ws = /* @__PURE__ */ Object.freeze({
1713
+ var Cs = /* @__PURE__ */ Object.freeze({
1716
1714
  __proto__: null,
1717
- blur: wr,
1718
- clearContent: Er,
1719
- clearNodes: Tr,
1720
- command: Cr,
1721
- createParagraphNear: xr,
1722
- cut: Ar,
1723
- deleteCurrentNode: Or,
1724
- deleteNode: Lr,
1725
- deleteRange: Rr,
1726
- deleteSelection: Hr,
1727
- enter: Pr,
1728
- exitCode: _r,
1729
- extendMarkRange: $r,
1730
- first: Nr,
1731
- focus: Dr,
1732
- forEach: Br,
1733
- insertContent: jr,
1734
- insertContentAt: Wr,
1735
- joinBackward: Ur,
1736
- joinDown: Kr,
1737
- joinForward: qr,
1738
- joinItemBackward: Gr,
1739
- joinItemForward: Jr,
1740
- joinTextblockBackward: Yr,
1741
- joinTextblockForward: Xr,
1742
- joinUp: Vr,
1743
- keyboardShortcut: Zr,
1744
- lift: ts,
1745
- liftEmptyBlock: es,
1746
- liftListItem: ns,
1747
- newlineInCode: rs,
1748
- resetAttributes: ss,
1749
- scrollIntoView: os,
1750
- selectAll: is,
1751
- selectNodeBackward: as,
1752
- selectNodeForward: ls,
1753
- selectParentNode: cs,
1754
- selectTextblockEnd: ds,
1755
- selectTextblockStart: us,
1756
- setContent: ps,
1757
- setMark: Ts,
1758
- setMeta: Cs,
1759
- setNode: xs,
1760
- setNodeSelection: As,
1761
- setTextSelection: Os,
1762
- sinkListItem: Ls,
1763
- splitBlock: Rs,
1764
- splitListItem: Hs,
1765
- toggleList: Ps,
1766
- toggleMark: _s,
1767
- toggleNode: Is,
1768
- toggleWrap: $s,
1769
- undoInputRule: Ns,
1770
- unsetAllMarks: Ds,
1771
- unsetMark: Bs,
1772
- updateAttributes: js,
1773
- wrapIn: Fs,
1774
- wrapInList: zs
1715
+ blur: ir,
1716
+ clearContent: ar,
1717
+ clearNodes: lr,
1718
+ command: cr,
1719
+ createParagraphNear: dr,
1720
+ cut: ur,
1721
+ deleteCurrentNode: pr,
1722
+ deleteNode: hr,
1723
+ deleteRange: fr,
1724
+ deleteSelection: mr,
1725
+ enter: gr,
1726
+ exitCode: yr,
1727
+ extendMarkRange: vr,
1728
+ first: Mr,
1729
+ focus: Sr,
1730
+ forEach: kr,
1731
+ insertContent: wr,
1732
+ insertContentAt: Cr,
1733
+ joinBackward: Or,
1734
+ joinDown: Ar,
1735
+ joinForward: Lr,
1736
+ joinItemBackward: Rr,
1737
+ joinItemForward: _r,
1738
+ joinTextblockBackward: Hr,
1739
+ joinTextblockForward: Ir,
1740
+ joinUp: xr,
1741
+ keyboardShortcut: Nr,
1742
+ lift: $r,
1743
+ liftEmptyBlock: Dr,
1744
+ liftListItem: Br,
1745
+ newlineInCode: jr,
1746
+ resetAttributes: Fr,
1747
+ scrollIntoView: zr,
1748
+ selectAll: Wr,
1749
+ selectNodeBackward: Vr,
1750
+ selectNodeForward: Kr,
1751
+ selectParentNode: Ur,
1752
+ selectTextblockEnd: qr,
1753
+ selectTextblockStart: Gr,
1754
+ setContent: Jr,
1755
+ setMark: ls,
1756
+ setMeta: cs,
1757
+ setNode: ds,
1758
+ setNodeSelection: us,
1759
+ setTextSelection: ps,
1760
+ sinkListItem: hs,
1761
+ splitBlock: fs,
1762
+ splitListItem: ms,
1763
+ toggleList: gs,
1764
+ toggleMark: ys,
1765
+ toggleNode: bs,
1766
+ toggleWrap: vs,
1767
+ undoInputRule: Ms,
1768
+ unsetAllMarks: Ss,
1769
+ unsetMark: ks,
1770
+ updateAttributes: ws,
1771
+ wrapIn: Ts,
1772
+ wrapInList: Es
1775
1773
  });
1776
- const Vs = H.create({
1774
+ const xs = R.create({
1777
1775
  name: "commands",
1778
1776
  addCommands() {
1779
1777
  return {
1780
- ...Ws
1778
+ ...Cs
1781
1779
  };
1782
1780
  }
1783
- }), Ks = H.create({
1781
+ }), As = R.create({
1784
1782
  name: "editable",
1785
1783
  addProseMirrorPlugins() {
1786
1784
  return [
1787
- new _({
1785
+ new P({
1788
1786
  key: new $("editable"),
1789
1787
  props: {
1790
1788
  editable: () => this.editor.options.editable
@@ -1792,12 +1790,12 @@ const Vs = H.create({
1792
1790
  })
1793
1791
  ];
1794
1792
  }
1795
- }), Us = H.create({
1793
+ }), Os = R.create({
1796
1794
  name: "focusEvents",
1797
1795
  addProseMirrorPlugins() {
1798
1796
  const { editor: e } = this;
1799
1797
  return [
1800
- new _({
1798
+ new P({
1801
1799
  key: new $("focusEvents"),
1802
1800
  props: {
1803
1801
  handleDOMEvents: {
@@ -1816,15 +1814,15 @@ const Vs = H.create({
1816
1814
  })
1817
1815
  ];
1818
1816
  }
1819
- }), qs = H.create({
1817
+ }), Ls = R.create({
1820
1818
  name: "keymap",
1821
1819
  addKeyboardShortcuts() {
1822
1820
  const e = () => this.editor.commands.first(({ commands: i }) => [
1823
1821
  () => i.undoInputRule(),
1824
1822
  // maybe convert first text block node to default node
1825
1823
  () => i.command(({ tr: a }) => {
1826
- const { selection: l, doc: c } = a, { empty: u, $anchor: d } = l, { pos: h, parent: p } = d, f = d.parent.isTextblock && h > 0 ? a.doc.resolve(h - 1) : d, g = f.parent.type.spec.isolating, m = d.pos - d.parentOffset, y = g && f.parent.childCount === 1 ? m === d.pos : W.atStart(c).from === h;
1827
- return !u || !p.type.isTextblock || p.textContent.length || !y || y && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
1824
+ const { selection: l, doc: c } = a, { empty: u, $anchor: d } = l, { pos: p, parent: h } = d, f = d.parent.isTextblock && p > 0 ? a.doc.resolve(p - 1) : d, y = f.parent.type.spec.isolating, g = d.pos - d.parentOffset, m = y && f.parent.childCount === 1 ? g === d.pos : G.atStart(c).from === p;
1825
+ return !u || !h.type.isTextblock || h.textContent.length || !m || m && d.parent.type.name === "paragraph" ? !1 : i.clearNodes();
1828
1826
  }),
1829
1827
  () => i.deleteSelection(),
1830
1828
  () => i.joinBackward(),
@@ -1861,7 +1859,7 @@ const Vs = H.create({
1861
1859
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
1862
1860
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
1863
1861
  };
1864
- return kt() || Ve() ? o : s;
1862
+ return vt() || He() ? o : s;
1865
1863
  },
1866
1864
  addProseMirrorPlugins() {
1867
1865
  return [
@@ -1870,32 +1868,32 @@ const Vs = H.create({
1870
1868
  // to a paragraph if necessary.
1871
1869
  // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
1872
1870
  // with many other commands.
1873
- new _({
1871
+ new P({
1874
1872
  key: new $("clearDocument"),
1875
1873
  appendTransaction: (e, t, n) => {
1876
1874
  if (!(e.some((f) => f.docChanged) && !t.doc.eq(n.doc)))
1877
1875
  return;
1878
- const { empty: s, from: o, to: i } = t.selection, a = W.atStart(t.doc).from, l = W.atEnd(t.doc).to;
1876
+ const { empty: s, from: o, to: i } = t.selection, a = G.atStart(t.doc).from, l = G.atEnd(t.doc).to;
1879
1877
  if (s || !(o === a && i === l) || !(n.doc.textBetween(0, n.doc.content.size, " ", " ").length === 0))
1880
1878
  return;
1881
- const d = n.tr, h = yt({
1879
+ const d = n.tr, p = ft({
1882
1880
  state: n,
1883
1881
  transaction: d
1884
- }), { commands: p } = new bt({
1882
+ }), { commands: h } = new mt({
1885
1883
  editor: this.editor,
1886
- state: h
1884
+ state: p
1887
1885
  });
1888
- if (p.clearNodes(), !!d.steps.length)
1886
+ if (h.clearNodes(), !!d.steps.length)
1889
1887
  return d;
1890
1888
  }
1891
1889
  })
1892
1890
  ];
1893
1891
  }
1894
- }), Gs = H.create({
1892
+ }), Rs = R.create({
1895
1893
  name: "tabindex",
1896
1894
  addProseMirrorPlugins() {
1897
1895
  return [
1898
- new _({
1896
+ new P({
1899
1897
  key: new $("tabindex"),
1900
1898
  props: {
1901
1899
  attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
@@ -1904,7 +1902,7 @@ const Vs = H.create({
1904
1902
  ];
1905
1903
  }
1906
1904
  });
1907
- class J {
1905
+ class q {
1908
1906
  get name() {
1909
1907
  return this.node.type.name;
1910
1908
  }
@@ -1963,15 +1961,15 @@ class J {
1963
1961
  if (this.depth === 0)
1964
1962
  return null;
1965
1963
  const t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
1966
- return new J(n, this.editor);
1964
+ return new q(n, this.editor);
1967
1965
  }
1968
1966
  get before() {
1969
1967
  let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
1970
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new J(t, this.editor);
1968
+ return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new q(t, this.editor);
1971
1969
  }
1972
1970
  get after() {
1973
1971
  let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
1974
- return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new J(t, this.editor);
1972
+ return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new q(t, this.editor);
1975
1973
  }
1976
1974
  get children() {
1977
1975
  const t = [];
@@ -1979,8 +1977,8 @@ class J {
1979
1977
  const s = n.isBlock && !n.isTextblock, o = this.pos + r + 1, i = this.resolvedPos.doc.resolve(o);
1980
1978
  if (!s && i.depth <= this.depth)
1981
1979
  return;
1982
- const a = new J(i, this.editor, s, s ? n : null);
1983
- s && (a.actualDepth = this.depth + 1), t.push(new J(i, this.editor, s, s ? n : null));
1980
+ const a = new q(i, this.editor, s, s ? n : null);
1981
+ s && (a.actualDepth = this.depth + 1), t.push(new q(i, this.editor, s, s ? n : null));
1984
1982
  }), t;
1985
1983
  }
1986
1984
  get firstChild() {
@@ -2024,7 +2022,7 @@ class J {
2024
2022
  this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name, t).setTextSelection(n.from).run();
2025
2023
  }
2026
2024
  }
2027
- const Js = `.ProseMirror {
2025
+ const _s = `.ProseMirror {
2028
2026
  position: relative;
2029
2027
  }
2030
2028
 
@@ -2099,14 +2097,14 @@ img.ProseMirror-separator {
2099
2097
  .tippy-box[data-animation=fade][data-state=hidden] {
2100
2098
  opacity: 0
2101
2099
  }`;
2102
- function Ys(e, t, n) {
2100
+ function Hs(e, t, n) {
2103
2101
  const r = document.querySelector("style[data-tiptap-style]");
2104
2102
  if (r !== null)
2105
2103
  return r;
2106
2104
  const s = document.createElement("style");
2107
2105
  return t && s.setAttribute("nonce", t), s.setAttribute("data-tiptap-style", ""), s.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(s), s;
2108
2106
  }
2109
- class Xs extends ar {
2107
+ class Is extends Vn {
2110
2108
  constructor(t = {}) {
2111
2109
  super(), this.isFocused = !1, this.isInitialized = !1, this.extensionStorage = {}, this.options = {
2112
2110
  element: document.createElement("div"),
@@ -2166,7 +2164,7 @@ class Xs extends ar {
2166
2164
  * Inject CSS styles.
2167
2165
  */
2168
2166
  injectCSS() {
2169
- this.options.injectCSS && document && (this.css = Ys(Js, this.options.injectNonce));
2167
+ this.options.injectCSS && document && (this.css = Hs(_s, this.options.injectNonce));
2170
2168
  }
2171
2169
  /**
2172
2170
  * Update editor options.
@@ -2204,7 +2202,7 @@ class Xs extends ar {
2204
2202
  * @param handlePlugins Control how to merge the plugin into the existing plugins.
2205
2203
  */
2206
2204
  registerPlugin(t, n) {
2207
- const r = Be(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
2205
+ const r = Ae(n) ? n(t, [...this.state.plugins]) : [...this.state.plugins, t], s = this.state.reconfigure({ plugins: r });
2208
2206
  this.view.updateState(s);
2209
2207
  }
2210
2208
  /**
@@ -2227,22 +2225,22 @@ class Xs extends ar {
2227
2225
  createExtensionManager() {
2228
2226
  var t, n;
2229
2227
  const s = [...this.options.enableCoreExtensions ? [
2230
- Ks,
2231
- kr.configure({
2228
+ As,
2229
+ or.configure({
2232
2230
  blockSeparator: (n = (t = this.options.coreExtensionOptions) === null || t === void 0 ? void 0 : t.clipboardTextSerializer) === null || n === void 0 ? void 0 : n.blockSeparator
2233
2231
  }),
2234
- Vs,
2235
- Us,
2236
- qs,
2237
- Gs
2232
+ xs,
2233
+ Os,
2234
+ Ls,
2235
+ Rs
2238
2236
  ] : [], ...this.options.extensions].filter((o) => ["extension", "node", "mark"].includes(o == null ? void 0 : o.type));
2239
- this.extensionManager = new Z(s, this);
2237
+ this.extensionManager = new Q(s, this);
2240
2238
  }
2241
2239
  /**
2242
2240
  * Creates an command manager.
2243
2241
  */
2244
2242
  createCommandManager() {
2245
- this.commandManager = new bt({
2243
+ this.commandManager = new mt({
2246
2244
  editor: this
2247
2245
  });
2248
2246
  }
@@ -2258,7 +2256,7 @@ class Xs extends ar {
2258
2256
  createView() {
2259
2257
  let t;
2260
2258
  try {
2261
- t = Nt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
2259
+ t = Ht(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
2262
2260
  } catch (o) {
2263
2261
  if (!(o instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(o.message))
2264
2262
  throw o;
@@ -2268,13 +2266,13 @@ class Xs extends ar {
2268
2266
  disableCollaboration: () => {
2269
2267
  this.options.extensions = this.options.extensions.filter((i) => i.name !== "collaboration"), this.createExtensionManager();
2270
2268
  }
2271
- }), t = Nt(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
2269
+ }), t = Ht(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
2272
2270
  }
2273
- const n = ze(t, this.options.autofocus);
2274
- this.view = new An(this.options.element, {
2271
+ const n = Re(t, this.options.autofocus);
2272
+ this.view = new mn(this.options.element, {
2275
2273
  ...this.options.editorProps,
2276
2274
  dispatchTransaction: this.dispatchTransaction.bind(this),
2277
- state: On.create({
2275
+ state: gn.create({
2278
2276
  doc: t,
2279
2277
  selection: n || void 0
2280
2278
  })
@@ -2354,11 +2352,11 @@ class Xs extends ar {
2354
2352
  * Get attributes of the currently selected node or mark.
2355
2353
  */
2356
2354
  getAttributes(t) {
2357
- return Ue(this.state, t);
2355
+ return Pe(this.state, t);
2358
2356
  }
2359
2357
  isActive(t, n) {
2360
2358
  const r = typeof t == "string" ? t : null, s = typeof t == "string" ? n : t;
2361
- return ks(this.state, r, s);
2359
+ return os(this.state, r, s);
2362
2360
  }
2363
2361
  /**
2364
2362
  * Get the document as JSON.
@@ -2370,7 +2368,7 @@ class Xs extends ar {
2370
2368
  * Get the document as HTML.
2371
2369
  */
2372
2370
  getHTML() {
2373
- return gs(this.state.doc.content, this.schema);
2371
+ return Zr(this.state.doc.content, this.schema);
2374
2372
  }
2375
2373
  /**
2376
2374
  * Get the document as text.
@@ -2379,10 +2377,10 @@ class Xs extends ar {
2379
2377
  const { blockSeparator: n = `
2380
2378
 
2381
2379
  `, textSerializers: r = {} } = t || {};
2382
- return ys(this.state.doc, {
2380
+ return ts(this.state.doc, {
2383
2381
  blockSeparator: n,
2384
2382
  textSerializers: {
2385
- ...Fe(this.schema),
2383
+ ...Le(this.schema),
2386
2384
  ...r
2387
2385
  }
2388
2386
  });
@@ -2391,7 +2389,7 @@ class Xs extends ar {
2391
2389
  * Check if there is no content.
2392
2390
  */
2393
2391
  get isEmpty() {
2394
- return Qt(this.state.doc);
2392
+ return Gt(this.state.doc);
2395
2393
  }
2396
2394
  /**
2397
2395
  * Get the number of characters for the current document.
@@ -2424,36 +2422,36 @@ class Xs extends ar {
2424
2422
  }
2425
2423
  $pos(t) {
2426
2424
  const n = this.state.doc.resolve(t);
2427
- return new J(n, this);
2425
+ return new q(n, this);
2428
2426
  }
2429
2427
  get $doc() {
2430
2428
  return this.$pos(0);
2431
2429
  }
2432
2430
  }
2433
- function Y(e) {
2434
- return new Mt({
2431
+ function J(e) {
2432
+ return new yt({
2435
2433
  find: e.find,
2436
2434
  handler: ({ state: t, range: n, match: r }) => {
2437
- const s = C(e.getAttributes, void 0, r);
2435
+ const s = T(e.getAttributes, void 0, r);
2438
2436
  if (s === !1 || s === null)
2439
2437
  return null;
2440
2438
  const { tr: o } = t, i = r[r.length - 1], a = r[0];
2441
2439
  if (i) {
2442
2440
  const l = a.search(/\S/), c = n.from + a.indexOf(i), u = c + i.length;
2443
- if (Xt(n.from, n.to, t.doc).filter((p) => p.mark.type.excluded.find((g) => g === e.type && g !== p.mark.type)).filter((p) => p.to > c).length)
2441
+ if (qt(n.from, n.to, t.doc).filter((h) => h.mark.type.excluded.find((y) => y === e.type && y !== h.mark.type)).filter((h) => h.to > c).length)
2444
2442
  return null;
2445
2443
  u < n.to && o.delete(u, n.to), c > n.from && o.delete(n.from + l, c);
2446
- const h = n.from + l + i.length;
2447
- o.addMark(n.from + l, h, e.type.create(s || {})), o.removeStoredMark(e.type);
2444
+ const p = n.from + l + i.length;
2445
+ o.addMark(n.from + l, p, e.type.create(s || {})), o.removeStoredMark(e.type);
2448
2446
  }
2449
2447
  }
2450
2448
  });
2451
2449
  }
2452
- function Ge(e) {
2453
- return new Mt({
2450
+ function $e(e) {
2451
+ return new yt({
2454
2452
  find: e.find,
2455
2453
  handler: ({ state: t, range: n, match: r }) => {
2456
- const s = C(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
2454
+ const s = T(e.getAttributes, void 0, r) || {}, { tr: o } = t, i = n.from;
2457
2455
  let a = n.to;
2458
2456
  const l = e.type.create(s);
2459
2457
  if (r[1]) {
@@ -2470,29 +2468,29 @@ function Ge(e) {
2470
2468
  }
2471
2469
  });
2472
2470
  }
2473
- function Bt(e) {
2474
- return new Mt({
2471
+ function Pt(e) {
2472
+ return new yt({
2475
2473
  find: e.find,
2476
2474
  handler: ({ state: t, range: n, match: r }) => {
2477
- const s = t.doc.resolve(n.from), o = C(e.getAttributes, void 0, r) || {};
2475
+ const s = t.doc.resolve(n.from), o = T(e.getAttributes, void 0, r) || {};
2478
2476
  if (!s.node(-1).canReplaceWith(s.index(-1), s.indexAfter(-1), e.type))
2479
2477
  return null;
2480
2478
  t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, o);
2481
2479
  }
2482
2480
  });
2483
2481
  }
2484
- function et(e) {
2485
- return new Mt({
2482
+ function tt(e) {
2483
+ return new yt({
2486
2484
  find: e.find,
2487
2485
  handler: ({ state: t, range: n, match: r, chain: s }) => {
2488
- const o = C(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), l = i.doc.resolve(n.from).blockRange(), c = l && nn(l, e.type, o);
2486
+ const o = T(e.getAttributes, void 0, r) || {}, i = t.tr.delete(n.from, n.to), l = i.doc.resolve(n.from).blockRange(), c = l && We(l, e.type, o);
2489
2487
  if (!c)
2490
2488
  return null;
2491
2489
  if (i.wrap(l, c), e.keepMarks && e.editor) {
2492
- const { selection: d, storedMarks: h } = t, { splittableMarks: p } = e.editor.extensionManager, f = h || d.$to.parentOffset && d.$from.marks();
2490
+ const { selection: d, storedMarks: p } = t, { splittableMarks: h } = e.editor.extensionManager, f = p || d.$to.parentOffset && d.$from.marks();
2493
2491
  if (f) {
2494
- const g = f.filter((m) => p.includes(m.type.name));
2495
- i.ensureMarks(g);
2492
+ const y = f.filter((g) => h.includes(g.type.name));
2493
+ i.ensureMarks(y);
2496
2494
  }
2497
2495
  }
2498
2496
  if (e.keepAttributes) {
@@ -2500,7 +2498,7 @@ function et(e) {
2500
2498
  s().updateAttributes(d, o).run();
2501
2499
  }
2502
2500
  const u = i.doc.resolve(n.from - 1).nodeBefore;
2503
- u && u.type === e.type && Wt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
2501
+ u && u.type === e.type && Bt(i.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && i.join(n.from - 1);
2504
2502
  }
2505
2503
  });
2506
2504
  }
@@ -2512,9 +2510,9 @@ class I {
2512
2510
  }, this.config = {
2513
2511
  ...this.config,
2514
2512
  ...t
2515
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = C(S(this, "addOptions", {
2513
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = T(v(this, "addOptions", {
2516
2514
  name: this.name
2517
- }))), this.storage = C(S(this, "addStorage", {
2515
+ }))), this.storage = T(v(this, "addStorage", {
2518
2516
  name: this.name,
2519
2517
  options: this.options
2520
2518
  })) || {};
@@ -2525,15 +2523,15 @@ class I {
2525
2523
  configure(t = {}) {
2526
2524
  const n = this.extend({
2527
2525
  ...this.config,
2528
- addOptions: () => St(this.options, t)
2526
+ addOptions: () => bt(this.options, t)
2529
2527
  });
2530
2528
  return n.name = this.name, n.parent = this.parent, n;
2531
2529
  }
2532
2530
  extend(t = {}) {
2533
2531
  const n = new I(t);
2534
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = C(S(n, "addOptions", {
2532
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = T(v(n, "addOptions", {
2535
2533
  name: n.name
2536
- })), n.storage = C(S(n, "addStorage", {
2534
+ })), n.storage = T(v(n, "addStorage", {
2537
2535
  name: n.name,
2538
2536
  options: n.options
2539
2537
  })), n;
@@ -2550,7 +2548,7 @@ class I {
2550
2548
  return !1;
2551
2549
  }
2552
2550
  }
2553
- class L {
2551
+ class O {
2554
2552
  constructor(t = {}) {
2555
2553
  this.type = "node", this.name = "node", this.parent = null, this.child = null, this.config = {
2556
2554
  name: this.name,
@@ -2558,37 +2556,37 @@ class L {
2558
2556
  }, this.config = {
2559
2557
  ...this.config,
2560
2558
  ...t
2561
- }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = C(S(this, "addOptions", {
2559
+ }, this.name = this.config.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = T(v(this, "addOptions", {
2562
2560
  name: this.name
2563
- }))), this.storage = C(S(this, "addStorage", {
2561
+ }))), this.storage = T(v(this, "addStorage", {
2564
2562
  name: this.name,
2565
2563
  options: this.options
2566
2564
  })) || {};
2567
2565
  }
2568
2566
  static create(t = {}) {
2569
- return new L(t);
2567
+ return new O(t);
2570
2568
  }
2571
2569
  configure(t = {}) {
2572
2570
  const n = this.extend({
2573
2571
  ...this.config,
2574
- addOptions: () => St(this.options, t)
2572
+ addOptions: () => bt(this.options, t)
2575
2573
  });
2576
2574
  return n.name = this.name, n.parent = this.parent, n;
2577
2575
  }
2578
2576
  extend(t = {}) {
2579
- const n = new L(t);
2580
- return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = C(S(n, "addOptions", {
2577
+ const n = new O(t);
2578
+ return n.parent = this, this.child = n, n.name = t.name ? t.name : n.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = T(v(n, "addOptions", {
2581
2579
  name: n.name
2582
- })), n.storage = C(S(n, "addStorage", {
2580
+ })), n.storage = T(v(n, "addStorage", {
2583
2581
  name: n.name,
2584
2582
  options: n.options
2585
2583
  })), n;
2586
2584
  }
2587
2585
  }
2588
- function Qs() {
2586
+ function Ps() {
2589
2587
  return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
2590
2588
  }
2591
- class Zs {
2589
+ class Ns {
2592
2590
  constructor(t, n, r) {
2593
2591
  this.isDragging = !1, this.component = t, this.editor = n.editor, this.options = {
2594
2592
  stopEvent: null,
@@ -2609,14 +2607,14 @@ class Zs {
2609
2607
  const { view: c } = this.editor, u = t.target, d = u.nodeType === 3 ? (n = u.parentElement) === null || n === void 0 ? void 0 : n.closest("[data-drag-handle]") : u.closest("[data-drag-handle]");
2610
2608
  if (!this.dom || !((r = this.contentDOM) === null || r === void 0) && r.contains(u) || !d)
2611
2609
  return;
2612
- let h = 0, p = 0;
2610
+ let p = 0, h = 0;
2613
2611
  if (this.dom !== d) {
2614
- const m = this.dom.getBoundingClientRect(), y = d.getBoundingClientRect(), k = (s = t.offsetX) !== null && s !== void 0 ? s : (o = t.nativeEvent) === null || o === void 0 ? void 0 : o.offsetX, v = (i = t.offsetY) !== null && i !== void 0 ? i : (a = t.nativeEvent) === null || a === void 0 ? void 0 : a.offsetY;
2615
- h = y.x - m.x + k, p = y.y - m.y + v;
2612
+ const g = this.dom.getBoundingClientRect(), m = d.getBoundingClientRect(), k = (s = t.offsetX) !== null && s !== void 0 ? s : (o = t.nativeEvent) === null || o === void 0 ? void 0 : o.offsetX, b = (i = t.offsetY) !== null && i !== void 0 ? i : (a = t.nativeEvent) === null || a === void 0 ? void 0 : a.offsetY;
2613
+ p = m.x - g.x + k, h = m.y - g.y + b;
2616
2614
  }
2617
- (l = t.dataTransfer) === null || l === void 0 || l.setDragImage(this.dom, h, p);
2618
- const f = tt.create(c.state.doc, this.getPos()), g = c.state.tr.setSelection(f);
2619
- c.dispatch(g);
2615
+ (l = t.dataTransfer) === null || l === void 0 || l.setDragImage(this.dom, p, h);
2616
+ const f = Z.create(c.state.doc, this.getPos()), y = c.state.tr.setSelection(f);
2617
+ c.dispatch(y);
2620
2618
  }
2621
2619
  stopEvent(t) {
2622
2620
  var n;
@@ -2630,12 +2628,12 @@ class Zs {
2630
2628
  const o = t.type.startsWith("drag"), i = t.type === "drop";
2631
2629
  if ((["INPUT", "BUTTON", "SELECT", "TEXTAREA"].includes(r.tagName) || r.isContentEditable) && !i && !o)
2632
2630
  return !0;
2633
- const { isEditable: l } = this.editor, { isDragging: c } = this, u = !!this.node.type.spec.draggable, d = tt.isSelectable(this.node), h = t.type === "copy", p = t.type === "paste", f = t.type === "cut", g = t.type === "mousedown";
2631
+ const { isEditable: l } = this.editor, { isDragging: c } = this, u = !!this.node.type.spec.draggable, d = Z.isSelectable(this.node), p = t.type === "copy", h = t.type === "paste", f = t.type === "cut", y = t.type === "mousedown";
2634
2632
  if (!u && d && o && t.preventDefault(), u && o && !c)
2635
2633
  return t.preventDefault(), !1;
2636
- if (u && l && !c && g) {
2637
- const m = r.closest("[data-drag-handle]");
2638
- m && (this.dom === m || this.dom.contains(m)) && (this.isDragging = !0, document.addEventListener("dragend", () => {
2634
+ if (u && l && !c && y) {
2635
+ const g = r.closest("[data-drag-handle]");
2636
+ g && (this.dom === g || this.dom.contains(g)) && (this.isDragging = !0, document.addEventListener("dragend", () => {
2639
2637
  this.isDragging = !1;
2640
2638
  }, { once: !0 }), document.addEventListener("drop", () => {
2641
2639
  this.isDragging = !1;
@@ -2643,10 +2641,10 @@ class Zs {
2643
2641
  this.isDragging = !1;
2644
2642
  }, { once: !0 }));
2645
2643
  }
2646
- return !(c || i || h || p || f || g && d);
2644
+ return !(c || i || p || h || f || y && d);
2647
2645
  }
2648
2646
  ignoreMutation(t) {
2649
- return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (kt() || Qs()) && this.editor.isFocused && [
2647
+ return !this.dom || !this.contentDOM ? !0 : typeof this.options.ignoreMutation == "function" ? this.options.ignoreMutation({ mutation: t }) : this.node.isLeaf || this.node.isAtom ? !0 : t.type === "selection" || this.dom.contains(t.target) && t.type === "childList" && (vt() || Ps()) && this.editor.isFocused && [
2650
2648
  ...Array.from(t.addedNodes),
2651
2649
  ...Array.from(t.removedNodes)
2652
2650
  ].every((r) => r.isContentEditable) ? !1 : this.contentDOM === t.target && t.type === "attributes" ? !0 : !this.contentDOM.contains(t.target);
@@ -2665,28 +2663,28 @@ class Zs {
2665
2663
  this.editor.commands.deleteRange({ from: t, to: n });
2666
2664
  }
2667
2665
  }
2668
- function V(e) {
2669
- return new mr({
2666
+ function z(e) {
2667
+ return new Qn({
2670
2668
  find: e.find,
2671
2669
  handler: ({ state: t, range: n, match: r, pasteEvent: s }) => {
2672
- const o = C(e.getAttributes, void 0, r, s);
2670
+ const o = T(e.getAttributes, void 0, r, s);
2673
2671
  if (o === !1 || o === null)
2674
2672
  return null;
2675
2673
  const { tr: i } = t, a = r[r.length - 1], l = r[0];
2676
2674
  let c = n.to;
2677
2675
  if (a) {
2678
- const u = l.search(/\S/), d = n.from + l.indexOf(a), h = d + a.length;
2679
- if (Xt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((m) => m === e.type && m !== f.mark.type)).filter((f) => f.to > d).length)
2676
+ const u = l.search(/\S/), d = n.from + l.indexOf(a), p = d + a.length;
2677
+ if (qt(n.from, n.to, t.doc).filter((f) => f.mark.type.excluded.find((g) => g === e.type && g !== f.mark.type)).filter((f) => f.to > d).length)
2680
2678
  return null;
2681
- h < n.to && i.delete(h, n.to), d > n.from && i.delete(n.from + u, d), c = n.from + u + a.length, i.addMark(n.from + u, c, e.type.create(o || {})), i.removeStoredMark(e.type);
2679
+ p < n.to && i.delete(p, n.to), d > n.from && i.delete(n.from + u, d), c = n.from + u + a.length, i.addMark(n.from + u, c, e.type.create(o || {})), i.removeStoredMark(e.type);
2682
2680
  }
2683
2681
  }
2684
2682
  });
2685
2683
  }
2686
- function to(e) {
2684
+ function $s(e) {
2687
2685
  return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2688
2686
  }
2689
- const eo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, no = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, ro = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, so = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, ui = I.create({
2687
+ const Ds = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Bs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, js = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Fs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Vo = I.create({
2690
2688
  name: "bold",
2691
2689
  addOptions() {
2692
2690
  return {
@@ -2726,34 +2724,34 @@ const eo = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, no = /(?:^|\s
2726
2724
  },
2727
2725
  addInputRules() {
2728
2726
  return [
2729
- Y({
2730
- find: eo,
2727
+ J({
2728
+ find: Ds,
2731
2729
  type: this.type
2732
2730
  }),
2733
- Y({
2734
- find: ro,
2731
+ J({
2732
+ find: js,
2735
2733
  type: this.type
2736
2734
  })
2737
2735
  ];
2738
2736
  },
2739
2737
  addPasteRules() {
2740
2738
  return [
2741
- V({
2742
- find: no,
2739
+ z({
2740
+ find: Bs,
2743
2741
  type: this.type
2744
2742
  }),
2745
- V({
2746
- find: so,
2743
+ z({
2744
+ find: Fs,
2747
2745
  type: this.type
2748
2746
  })
2749
2747
  ];
2750
2748
  }
2751
2749
  });
2752
- class oo {
2750
+ class zs {
2753
2751
  constructor({ editor: t, element: n, view: r, tippyOptions: s = {}, updateDelay: o = 250, shouldShow: i }) {
2754
2752
  this.preventHide = !1, this.shouldShow = ({ view: a, state: l, from: c, to: u }) => {
2755
- const { doc: d, selection: h } = l, { empty: p } = h, f = !d.textBetween(c, u).length && Jt(l.selection), g = this.element.contains(document.activeElement);
2756
- return !(!(a.hasFocus() || g) || p || f || !this.editor.isEditable);
2753
+ const { doc: d, selection: p } = l, { empty: h } = p, f = !d.textBetween(c, u).length && Kt(l.selection), y = this.element.contains(document.activeElement);
2754
+ return !(!(a.hasFocus() || y) || h || f || !this.editor.isEditable);
2757
2755
  }, this.mousedownHandler = () => {
2758
2756
  this.preventHide = !0;
2759
2757
  }, this.dragstartHandler = () => {
@@ -2775,39 +2773,39 @@ class oo {
2775
2773
  this.updateHandler(a, c, u, l);
2776
2774
  }, this.updateDelay));
2777
2775
  }, this.updateHandler = (a, l, c, u) => {
2778
- var d, h, p;
2779
- const { state: f, composing: g } = a, { selection: m } = f;
2780
- if (g || !l && !c)
2776
+ var d, p, h;
2777
+ const { state: f, composing: y } = a, { selection: g } = f;
2778
+ if (y || !l && !c)
2781
2779
  return;
2782
2780
  this.createTooltip();
2783
- const { ranges: k } = m, v = Math.min(...k.map((M) => M.$from.pos)), b = Math.max(...k.map((M) => M.$to.pos));
2781
+ const { ranges: k } = g, b = Math.min(...k.map((M) => M.$from.pos)), S = Math.max(...k.map((M) => M.$to.pos));
2784
2782
  if (!((d = this.shouldShow) === null || d === void 0 ? void 0 : d.call(this, {
2785
2783
  editor: this.editor,
2786
2784
  view: a,
2787
2785
  state: f,
2788
2786
  oldState: u,
2789
- from: v,
2790
- to: b
2787
+ from: b,
2788
+ to: S
2791
2789
  }))) {
2792
2790
  this.hide();
2793
2791
  return;
2794
2792
  }
2795
- (h = this.tippy) === null || h === void 0 || h.setProps({
2796
- getReferenceClientRect: ((p = this.tippyOptions) === null || p === void 0 ? void 0 : p.getReferenceClientRect) || (() => {
2797
- if (qe(f.selection)) {
2798
- let M = a.nodeDOM(v);
2799
- const T = M.dataset.nodeViewWrapper ? M : M.querySelector("[data-node-view-wrapper]");
2800
- if (T && (M = T.firstChild), M)
2793
+ (p = this.tippy) === null || p === void 0 || p.setProps({
2794
+ getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
2795
+ if (Ne(f.selection)) {
2796
+ let M = a.nodeDOM(b);
2797
+ const C = M.dataset.nodeViewWrapper ? M : M.querySelector("[data-node-view-wrapper]");
2798
+ if (C && (M = C.firstChild), M)
2801
2799
  return M.getBoundingClientRect();
2802
2800
  }
2803
- return ws(a, v, b);
2801
+ return is(a, b, S);
2804
2802
  })
2805
2803
  }), this.show();
2806
2804
  }, this.editor = t, this.element = n, this.view = r, this.updateDelay = o, i && (this.shouldShow = i), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = s, this.element.remove(), this.element.style.visibility = "visible";
2807
2805
  }
2808
2806
  createTooltip() {
2809
2807
  const { element: t } = this.editor.options, n = !!t.parentElement;
2810
- this.tippy || !n || (this.tippy = He(t, {
2808
+ this.tippy || !n || (this.tippy = ze(t, {
2811
2809
  duration: 0,
2812
2810
  getReferenceClientRect: null,
2813
2811
  content: this.element,
@@ -2840,11 +2838,11 @@ class oo {
2840
2838
  !((t = this.tippy) === null || t === void 0) && t.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (n = this.tippy) === null || n === void 0 || n.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
2841
2839
  }
2842
2840
  }
2843
- const Je = (e) => new _({
2841
+ const De = (e) => new P({
2844
2842
  key: typeof e.pluginKey == "string" ? new $(e.pluginKey) : e.pluginKey,
2845
- view: (t) => new oo({ view: t, ...e })
2843
+ view: (t) => new zs({ view: t, ...e })
2846
2844
  });
2847
- H.create({
2845
+ R.create({
2848
2846
  name: "bubbleMenu",
2849
2847
  addOptions() {
2850
2848
  return {
@@ -2857,7 +2855,7 @@ H.create({
2857
2855
  },
2858
2856
  addProseMirrorPlugins() {
2859
2857
  return this.options.element ? [
2860
- Je({
2858
+ De({
2861
2859
  pluginKey: this.options.pluginKey,
2862
2860
  editor: this.editor,
2863
2861
  element: this.options.element,
@@ -2868,7 +2866,7 @@ H.create({
2868
2866
  ] : [];
2869
2867
  }
2870
2868
  });
2871
- var jt = { exports: {} }, Lt = {};
2869
+ var Nt = { exports: {} }, xt = {};
2872
2870
  /**
2873
2871
  * @license React
2874
2872
  * use-sync-external-store-shim.production.min.js
@@ -2878,42 +2876,42 @@ var jt = { exports: {} }, Lt = {};
2878
2876
  * This source code is licensed under the MIT license found in the
2879
2877
  * LICENSE file in the root directory of this source tree.
2880
2878
  */
2881
- var fe;
2882
- function io() {
2883
- if (fe) return Lt;
2884
- fe = 1;
2885
- var e = R;
2886
- function t(d, h) {
2887
- return d === h && (d !== 0 || 1 / d === 1 / h) || d !== d && h !== h;
2879
+ var le;
2880
+ function Ws() {
2881
+ if (le) return xt;
2882
+ le = 1;
2883
+ var e = L;
2884
+ function t(d, p) {
2885
+ return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
2888
2886
  }
2889
2887
  var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, s = e.useEffect, o = e.useLayoutEffect, i = e.useDebugValue;
2890
- function a(d, h) {
2891
- var p = h(), f = r({ inst: { value: p, getSnapshot: h } }), g = f[0].inst, m = f[1];
2888
+ function a(d, p) {
2889
+ var h = p(), f = r({ inst: { value: h, getSnapshot: p } }), y = f[0].inst, g = f[1];
2892
2890
  return o(function() {
2893
- g.value = p, g.getSnapshot = h, l(g) && m({ inst: g });
2894
- }, [d, p, h]), s(function() {
2895
- return l(g) && m({ inst: g }), d(function() {
2896
- l(g) && m({ inst: g });
2891
+ y.value = h, y.getSnapshot = p, l(y) && g({ inst: y });
2892
+ }, [d, h, p]), s(function() {
2893
+ return l(y) && g({ inst: y }), d(function() {
2894
+ l(y) && g({ inst: y });
2897
2895
  });
2898
- }, [d]), i(p), p;
2896
+ }, [d]), i(h), h;
2899
2897
  }
2900
2898
  function l(d) {
2901
- var h = d.getSnapshot;
2899
+ var p = d.getSnapshot;
2902
2900
  d = d.value;
2903
2901
  try {
2904
- var p = h();
2905
- return !n(d, p);
2902
+ var h = p();
2903
+ return !n(d, h);
2906
2904
  } catch {
2907
2905
  return !0;
2908
2906
  }
2909
2907
  }
2910
- function c(d, h) {
2911
- return h();
2908
+ function c(d, p) {
2909
+ return p();
2912
2910
  }
2913
2911
  var u = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? c : a;
2914
- return Lt.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, Lt;
2912
+ return xt.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u, xt;
2915
2913
  }
2916
- var Rt = {};
2914
+ var At = {};
2917
2915
  /**
2918
2916
  * @license React
2919
2917
  * use-sync-external-store-shim.development.js
@@ -2923,88 +2921,88 @@ var Rt = {};
2923
2921
  * This source code is licensed under the MIT license found in the
2924
2922
  * LICENSE file in the root directory of this source tree.
2925
2923
  */
2926
- var me;
2927
- function ao() {
2928
- return me || (me = 1, process.env.NODE_ENV !== "production" && function() {
2924
+ var ce;
2925
+ function Vs() {
2926
+ return ce || (ce = 1, process.env.NODE_ENV !== "production" && function() {
2929
2927
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2930
- var e = R, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2931
- function n(v) {
2928
+ var e = L, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2929
+ function n(b) {
2932
2930
  {
2933
- for (var b = arguments.length, E = new Array(b > 1 ? b - 1 : 0), M = 1; M < b; M++)
2934
- E[M - 1] = arguments[M];
2935
- r("error", v, E);
2931
+ for (var S = arguments.length, w = new Array(S > 1 ? S - 1 : 0), M = 1; M < S; M++)
2932
+ w[M - 1] = arguments[M];
2933
+ r("error", b, w);
2936
2934
  }
2937
2935
  }
2938
- function r(v, b, E) {
2936
+ function r(b, S, w) {
2939
2937
  {
2940
- var M = t.ReactDebugCurrentFrame, T = M.getStackAddendum();
2941
- T !== "" && (b += "%s", E = E.concat([T]));
2942
- var A = E.map(function(w) {
2943
- return String(w);
2938
+ var M = t.ReactDebugCurrentFrame, C = M.getStackAddendum();
2939
+ C !== "" && (S += "%s", w = w.concat([C]));
2940
+ var A = w.map(function(E) {
2941
+ return String(E);
2944
2942
  });
2945
- A.unshift("Warning: " + b), Function.prototype.apply.call(console[v], console, A);
2943
+ A.unshift("Warning: " + S), Function.prototype.apply.call(console[b], console, A);
2946
2944
  }
2947
2945
  }
2948
- function s(v, b) {
2949
- return v === b && (v !== 0 || 1 / v === 1 / b) || v !== v && b !== b;
2946
+ function s(b, S) {
2947
+ return b === S && (b !== 0 || 1 / b === 1 / S) || b !== b && S !== S;
2950
2948
  }
2951
2949
  var o = typeof Object.is == "function" ? Object.is : s, i = e.useState, a = e.useEffect, l = e.useLayoutEffect, c = e.useDebugValue, u = !1, d = !1;
2952
- function h(v, b, E) {
2950
+ function p(b, S, w) {
2953
2951
  u || e.startTransition !== void 0 && (u = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
2954
- var M = b();
2952
+ var M = S();
2955
2953
  if (!d) {
2956
- var T = b();
2957
- o(M, T) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), d = !0);
2954
+ var C = S();
2955
+ o(M, C) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), d = !0);
2958
2956
  }
2959
2957
  var A = i({
2960
2958
  inst: {
2961
2959
  value: M,
2962
- getSnapshot: b
2960
+ getSnapshot: S
2963
2961
  }
2964
- }), w = A[0].inst, O = A[1];
2962
+ }), E = A[0].inst, _ = A[1];
2965
2963
  return l(function() {
2966
- w.value = M, w.getSnapshot = b, p(w) && O({
2967
- inst: w
2964
+ E.value = M, E.getSnapshot = S, h(E) && _({
2965
+ inst: E
2968
2966
  });
2969
- }, [v, M, b]), a(function() {
2970
- p(w) && O({
2971
- inst: w
2967
+ }, [b, M, S]), a(function() {
2968
+ h(E) && _({
2969
+ inst: E
2972
2970
  });
2973
- var B = function() {
2974
- p(w) && O({
2975
- inst: w
2971
+ var D = function() {
2972
+ h(E) && _({
2973
+ inst: E
2976
2974
  });
2977
2975
  };
2978
- return v(B);
2979
- }, [v]), c(M), M;
2976
+ return b(D);
2977
+ }, [b]), c(M), M;
2980
2978
  }
2981
- function p(v) {
2982
- var b = v.getSnapshot, E = v.value;
2979
+ function h(b) {
2980
+ var S = b.getSnapshot, w = b.value;
2983
2981
  try {
2984
- var M = b();
2985
- return !o(E, M);
2982
+ var M = S();
2983
+ return !o(w, M);
2986
2984
  } catch {
2987
2985
  return !0;
2988
2986
  }
2989
2987
  }
2990
- function f(v, b, E) {
2991
- return b();
2988
+ function f(b, S, w) {
2989
+ return S();
2992
2990
  }
2993
- var g = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", m = !g, y = m ? f : h, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : y;
2994
- Rt.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2995
- }()), Rt;
2991
+ var y = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", g = !y, m = g ? f : p, k = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : m;
2992
+ At.useSyncExternalStore = k, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
2993
+ }()), At;
2996
2994
  }
2997
- process.env.NODE_ENV === "production" ? jt.exports = io() : jt.exports = ao();
2998
- var Et = jt.exports;
2999
- const lo = (...e) => (t) => {
2995
+ process.env.NODE_ENV === "production" ? Nt.exports = Ws() : Nt.exports = Vs();
2996
+ var St = Nt.exports;
2997
+ const Ks = (...e) => (t) => {
3000
2998
  e.forEach((n) => {
3001
2999
  typeof n == "function" ? n(t) : n && (n.current = t);
3002
3000
  });
3003
- }, co = ({ contentComponent: e }) => {
3004
- const t = Et.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
3005
- return R.createElement(R.Fragment, null, Object.values(t));
3001
+ }, Us = ({ contentComponent: e }) => {
3002
+ const t = St.useSyncExternalStore(e.subscribe, e.getSnapshot, e.getServerSnapshot);
3003
+ return L.createElement(L.Fragment, null, Object.values(t));
3006
3004
  };
3007
- function uo() {
3005
+ function qs() {
3008
3006
  const e = /* @__PURE__ */ new Set();
3009
3007
  let t = {};
3010
3008
  return {
@@ -3028,7 +3026,7 @@ function uo() {
3028
3026
  setRenderer(n, r) {
3029
3027
  t = {
3030
3028
  ...t,
3031
- [n]: or.createPortal(r.reactElement, r.element, n)
3029
+ [n]: zn.createPortal(r.reactElement, r.element, n)
3032
3030
  }, e.forEach((s) => s());
3033
3031
  },
3034
3032
  /**
@@ -3040,10 +3038,10 @@ function uo() {
3040
3038
  }
3041
3039
  };
3042
3040
  }
3043
- class po extends R.Component {
3041
+ class Gs extends L.Component {
3044
3042
  constructor(t) {
3045
3043
  var n;
3046
- super(t), this.editorContentRef = R.createRef(), this.initialized = !1, this.state = {
3044
+ super(t), this.editorContentRef = L.createRef(), this.initialized = !1, this.state = {
3047
3045
  hasContentComponentInitialized: !!(!((n = t.editor) === null || n === void 0) && n.contentComponent)
3048
3046
  };
3049
3047
  }
@@ -3061,7 +3059,7 @@ class po extends R.Component {
3061
3059
  const n = this.editorContentRef.current;
3062
3060
  n.append(...t.options.element.childNodes), t.setOptions({
3063
3061
  element: n
3064
- }), t.contentComponent = uo(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
3062
+ }), t.contentComponent = qs(), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => {
3065
3063
  this.setState((r) => r.hasContentComponentInitialized ? r : {
3066
3064
  hasContentComponentInitialized: !0
3067
3065
  }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent();
@@ -3081,23 +3079,23 @@ class po extends R.Component {
3081
3079
  }
3082
3080
  render() {
3083
3081
  const { editor: t, innerRef: n, ...r } = this.props;
3084
- return R.createElement(
3085
- R.Fragment,
3082
+ return L.createElement(
3083
+ L.Fragment,
3086
3084
  null,
3087
- R.createElement("div", { ref: lo(n, this.editorContentRef), ...r }),
3088
- (t == null ? void 0 : t.contentComponent) && R.createElement(co, { contentComponent: t.contentComponent })
3085
+ L.createElement("div", { ref: Ks(n, this.editorContentRef), ...r }),
3086
+ (t == null ? void 0 : t.contentComponent) && L.createElement(Us, { contentComponent: t.contentComponent })
3089
3087
  );
3090
3088
  }
3091
3089
  }
3092
- const ho = rr((e, t) => {
3093
- const n = R.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
3094
- return R.createElement(po, {
3090
+ const Js = jn((e, t) => {
3091
+ const n = L.useMemo(() => Math.floor(Math.random() * 4294967295).toString(), [e.editor]);
3092
+ return L.createElement(Gs, {
3095
3093
  key: n,
3096
3094
  innerRef: t,
3097
3095
  ...e
3098
3096
  });
3099
- }), pi = R.memo(ho);
3100
- var Ft = { exports: {} }, Ht = {};
3097
+ }), Ko = L.memo(Js);
3098
+ var $t = { exports: {} }, Ot = {};
3101
3099
  /**
3102
3100
  * @license React
3103
3101
  * use-sync-external-store-shim/with-selector.production.min.js
@@ -3107,48 +3105,48 @@ var Ft = { exports: {} }, Ht = {};
3107
3105
  * This source code is licensed under the MIT license found in the
3108
3106
  * LICENSE file in the root directory of this source tree.
3109
3107
  */
3110
- var ge;
3111
- function fo() {
3112
- if (ge) return Ht;
3113
- ge = 1;
3114
- var e = R, t = Et;
3108
+ var de;
3109
+ function Ys() {
3110
+ if (de) return Ot;
3111
+ de = 1;
3112
+ var e = L, t = St;
3115
3113
  function n(c, u) {
3116
3114
  return c === u && (c !== 0 || 1 / c === 1 / u) || c !== c && u !== u;
3117
3115
  }
3118
3116
  var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
3119
- return Ht.useSyncExternalStoreWithSelector = function(c, u, d, h, p) {
3117
+ return Ot.useSyncExternalStoreWithSelector = function(c, u, d, p, h) {
3120
3118
  var f = o(null);
3121
3119
  if (f.current === null) {
3122
- var g = { hasValue: !1, value: null };
3123
- f.current = g;
3124
- } else g = f.current;
3120
+ var y = { hasValue: !1, value: null };
3121
+ f.current = y;
3122
+ } else y = f.current;
3125
3123
  f = a(function() {
3126
- function y(M) {
3124
+ function m(M) {
3127
3125
  if (!k) {
3128
- if (k = !0, v = M, M = h(M), p !== void 0 && g.hasValue) {
3129
- var T = g.value;
3130
- if (p(T, M)) return b = T;
3126
+ if (k = !0, b = M, M = p(M), h !== void 0 && y.hasValue) {
3127
+ var C = y.value;
3128
+ if (h(C, M)) return S = C;
3131
3129
  }
3132
- return b = M;
3130
+ return S = M;
3133
3131
  }
3134
- if (T = b, r(v, M)) return T;
3135
- var A = h(M);
3136
- return p !== void 0 && p(T, A) ? T : (v = M, b = A);
3132
+ if (C = S, r(b, M)) return C;
3133
+ var A = p(M);
3134
+ return h !== void 0 && h(C, A) ? C : (b = M, S = A);
3137
3135
  }
3138
- var k = !1, v, b, E = d === void 0 ? null : d;
3136
+ var k = !1, b, S, w = d === void 0 ? null : d;
3139
3137
  return [function() {
3140
- return y(u());
3141
- }, E === null ? void 0 : function() {
3142
- return y(E());
3138
+ return m(u());
3139
+ }, w === null ? void 0 : function() {
3140
+ return m(w());
3143
3141
  }];
3144
- }, [u, d, h, p]);
3145
- var m = s(c, f[0], f[1]);
3142
+ }, [u, d, p, h]);
3143
+ var g = s(c, f[0], f[1]);
3146
3144
  return i(function() {
3147
- g.hasValue = !0, g.value = m;
3148
- }, [m]), l(m), m;
3149
- }, Ht;
3145
+ y.hasValue = !0, y.value = g;
3146
+ }, [g]), l(g), g;
3147
+ }, Ot;
3150
3148
  }
3151
- var Pt = {};
3149
+ var Lt = {};
3152
3150
  /**
3153
3151
  * @license React
3154
3152
  * use-sync-external-store-shim/with-selector.development.js
@@ -3158,55 +3156,55 @@ var Pt = {};
3158
3156
  * This source code is licensed under the MIT license found in the
3159
3157
  * LICENSE file in the root directory of this source tree.
3160
3158
  */
3161
- var ye;
3162
- function mo() {
3163
- return ye || (ye = 1, process.env.NODE_ENV !== "production" && function() {
3159
+ var ue;
3160
+ function Xs() {
3161
+ return ue || (ue = 1, process.env.NODE_ENV !== "production" && function() {
3164
3162
  typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
3165
- var e = R, t = Et;
3163
+ var e = L, t = St;
3166
3164
  function n(u, d) {
3167
3165
  return u === d && (u !== 0 || 1 / u === 1 / d) || u !== u && d !== d;
3168
3166
  }
3169
3167
  var r = typeof Object.is == "function" ? Object.is : n, s = t.useSyncExternalStore, o = e.useRef, i = e.useEffect, a = e.useMemo, l = e.useDebugValue;
3170
- function c(u, d, h, p, f) {
3171
- var g = o(null), m;
3172
- g.current === null ? (m = {
3168
+ function c(u, d, p, h, f) {
3169
+ var y = o(null), g;
3170
+ y.current === null ? (g = {
3173
3171
  hasValue: !1,
3174
3172
  value: null
3175
- }, g.current = m) : m = g.current;
3176
- var y = a(function() {
3177
- var E = !1, M, T, A = function(F) {
3178
- if (!E) {
3179
- E = !0, M = F;
3180
- var X = p(F);
3181
- if (f !== void 0 && m.hasValue) {
3182
- var U = m.value;
3183
- if (f(U, X))
3184
- return T = U, U;
3173
+ }, y.current = g) : g = y.current;
3174
+ var m = a(function() {
3175
+ var w = !1, M, C, A = function(j) {
3176
+ if (!w) {
3177
+ w = !0, M = j;
3178
+ var Y = h(j);
3179
+ if (f !== void 0 && g.hasValue) {
3180
+ var V = g.value;
3181
+ if (f(V, Y))
3182
+ return C = V, V;
3185
3183
  }
3186
- return T = X, X;
3184
+ return C = Y, Y;
3187
3185
  }
3188
- var q = M, z = T;
3189
- if (r(q, F))
3190
- return z;
3191
- var G = p(F);
3192
- return f !== void 0 && f(z, G) ? z : (M = F, T = G, G);
3193
- }, w = h === void 0 ? null : h, O = function() {
3186
+ var K = M, F = C;
3187
+ if (r(K, j))
3188
+ return F;
3189
+ var U = h(j);
3190
+ return f !== void 0 && f(F, U) ? F : (M = j, C = U, U);
3191
+ }, E = p === void 0 ? null : p, _ = function() {
3194
3192
  return A(d());
3195
- }, B = w === null ? void 0 : function() {
3196
- return A(w());
3193
+ }, D = E === null ? void 0 : function() {
3194
+ return A(E());
3197
3195
  };
3198
- return [O, B];
3199
- }, [d, h, p, f]), k = y[0], v = y[1], b = s(u, k, v);
3196
+ return [_, D];
3197
+ }, [d, p, h, f]), k = m[0], b = m[1], S = s(u, k, b);
3200
3198
  return i(function() {
3201
- m.hasValue = !0, m.value = b;
3202
- }, [b]), l(b), b;
3199
+ g.hasValue = !0, g.value = S;
3200
+ }, [S]), l(S), S;
3203
3201
  }
3204
- Pt.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
3205
- }()), Pt;
3202
+ Lt.useSyncExternalStoreWithSelector = c, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
3203
+ }()), Lt;
3206
3204
  }
3207
- process.env.NODE_ENV === "production" ? Ft.exports = fo() : Ft.exports = mo();
3208
- var go = Ft.exports;
3209
- class yo {
3205
+ process.env.NODE_ENV === "production" ? $t.exports = Ys() : $t.exports = Xs();
3206
+ var Qs = $t.exports;
3207
+ class Zs {
3210
3208
  constructor(t) {
3211
3209
  this.transactionNumber = 0, this.lastTransactionNumber = 0, this.subscribers = /* @__PURE__ */ new Set(), this.editor = t, this.lastSnapshot = { editor: t, transactionNumber: 0 }, this.getSnapshot = this.getSnapshot.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.watch = this.watch.bind(this), this.subscribe = this.subscribe.bind(this);
3212
3210
  }
@@ -3244,12 +3242,12 @@ class yo {
3244
3242
  }
3245
3243
  }
3246
3244
  }
3247
- function bo(e) {
3248
- const [t] = Kt(() => new yo(e.editor)), n = go.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn);
3249
- return Ut(() => t.watch(e.editor), [e.editor, t]), Ie(n), n;
3245
+ function to(e) {
3246
+ const [t] = Ft(() => new Zs(e.editor)), n = Qs.useSyncExternalStoreWithSelector(t.subscribe, t.getSnapshot, t.getServerSnapshot, e.selector, e.equalityFn);
3247
+ return zt(() => t.watch(e.editor), [e.editor, t]), Te(n), n;
3250
3248
  }
3251
- const be = process.env.NODE_ENV !== "production", zt = typeof window > "u", vo = zt || !!(typeof window < "u" && window.next);
3252
- class Mo {
3249
+ const pe = process.env.NODE_ENV !== "production", Dt = typeof window > "u", eo = Dt || !!(typeof window < "u" && window.next);
3250
+ class no {
3253
3251
  constructor(t) {
3254
3252
  this.editor = null, this.subscriptions = /* @__PURE__ */ new Set(), this.isComponentMounted = !1, this.previousDeps = null, this.instanceId = "", this.options = t, this.subscriptions = /* @__PURE__ */ new Set(), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), this.getEditor = this.getEditor.bind(this), this.getServerSnapshot = this.getServerSnapshot.bind(this), this.subscribe = this.subscribe.bind(this), this.refreshEditorInstance = this.refreshEditorInstance.bind(this), this.scheduleDestroy = this.scheduleDestroy.bind(this), this.onRender = this.onRender.bind(this), this.createEditor = this.createEditor.bind(this);
3255
3253
  }
@@ -3258,8 +3256,8 @@ class Mo {
3258
3256
  }
3259
3257
  getInitialEditor() {
3260
3258
  if (this.options.current.immediatelyRender === void 0)
3261
- return zt || vo ? (be && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
3262
- if (this.options.current.immediatelyRender && zt && be)
3259
+ return Dt || eo ? (pe && console.warn("Tiptap Error: SSR has been detected, please set `immediatelyRender` explicitly to `false` to avoid hydration mismatches."), null) : this.createEditor();
3260
+ if (this.options.current.immediatelyRender && Dt && pe)
3263
3261
  throw new Error("Tiptap Error: SSR has been detected, and `immediatelyRender` has been set to `true` this is an unsupported configuration that may result in errors, explicitly set `immediatelyRender` to `false` to avoid hydration mismatches.");
3264
3262
  return this.options.current.immediatelyRender ? this.createEditor() : null;
3265
3263
  }
@@ -3307,7 +3305,7 @@ class Mo {
3307
3305
  return (o = (s = this.options.current).onContentError) === null || o === void 0 ? void 0 : o.call(s, ...r);
3308
3306
  }
3309
3307
  };
3310
- return new Xs(t);
3308
+ return new Is(t);
3311
3309
  }
3312
3310
  /**
3313
3311
  * Get the current editor instance.
@@ -3369,22 +3367,22 @@ class Mo {
3369
3367
  }, 1);
3370
3368
  }
3371
3369
  }
3372
- function hi(e = {}, t = []) {
3373
- const n = sr(e);
3370
+ function Uo(e = {}, t = []) {
3371
+ const n = Fn(e);
3374
3372
  n.current = e;
3375
- const [r] = Kt(() => new Mo(n)), s = Et.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
3376
- return Ie(s), Ut(r.onRender(t)), bo({
3373
+ const [r] = Ft(() => new no(n)), s = St.useSyncExternalStore(r.subscribe, r.getEditor, r.getServerSnapshot);
3374
+ return Te(s), zt(r.onRender(t)), to({
3377
3375
  editor: s,
3378
3376
  selector: ({ transactionNumber: o }) => e.shouldRerenderOnTransaction === !1 ? null : e.immediatelyRender && o === 0 ? 0 : o + 1
3379
3377
  }), s;
3380
3378
  }
3381
- const Ye = $e({
3379
+ const Be = Ee({
3382
3380
  editor: null
3383
3381
  });
3384
- Ye.Consumer;
3385
- const So = () => Ne(Ye), fi = (e) => {
3386
- const [t, n] = Kt(null), { editor: r } = So();
3387
- return Ut(() => {
3382
+ Be.Consumer;
3383
+ const ro = () => Ce(Be), qo = (e) => {
3384
+ const [t, n] = Ft(null), { editor: r } = ro();
3385
+ return zt(() => {
3388
3386
  var s;
3389
3387
  if (!t || !((s = e.editor) === null || s === void 0) && s.isDestroyed || r != null && r.isDestroyed)
3390
3388
  return;
@@ -3393,7 +3391,7 @@ const So = () => Ne(Ye), fi = (e) => {
3393
3391
  console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
3394
3392
  return;
3395
3393
  }
3396
- const d = Je({
3394
+ const d = De({
3397
3395
  updateDelay: l,
3398
3396
  editor: u,
3399
3397
  element: t,
@@ -3402,40 +3400,40 @@ const So = () => Ne(Ye), fi = (e) => {
3402
3400
  tippyOptions: a
3403
3401
  });
3404
3402
  return u.registerPlugin(d), () => u.unregisterPlugin(o);
3405
- }, [e.editor, r, t]), R.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
3406
- }, Xe = $e({
3403
+ }, [e.editor, r, t]), L.createElement("div", { ref: n, className: e.className, style: { visibility: "hidden" } }, e.children);
3404
+ }, je = Ee({
3407
3405
  onDragStart: void 0
3408
- }), ko = () => Ne(Xe), mi = R.forwardRef((e, t) => {
3409
- const { onDragStart: n } = ko(), r = e.as || "div";
3406
+ }), so = () => Ce(je), Go = L.forwardRef((e, t) => {
3407
+ const { onDragStart: n } = so(), r = e.as || "div";
3410
3408
  return (
3411
3409
  // @ts-ignore
3412
- R.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
3410
+ L.createElement(r, { ...e, ref: t, "data-node-view-wrapper": "", onDragStart: n, style: {
3413
3411
  whiteSpace: "normal",
3414
3412
  ...e.style
3415
3413
  } })
3416
3414
  );
3417
3415
  });
3418
- function wo(e) {
3416
+ function oo(e) {
3419
3417
  return !!(typeof e == "function" && e.prototype && e.prototype.isReactComponent);
3420
3418
  }
3421
- function Eo(e) {
3419
+ function io(e) {
3422
3420
  var t;
3423
3421
  return typeof e == "object" && ((t = e.$$typeof) === null || t === void 0 ? void 0 : t.toString()) === "Symbol(react.forward_ref)";
3424
3422
  }
3425
- class To {
3423
+ class ao {
3426
3424
  constructor(t, { editor: n, props: r = {}, as: s = "div", className: o = "", attrs: i }) {
3427
3425
  this.ref = null, this.id = Math.floor(Math.random() * 4294967295).toString(), this.component = t, this.editor = n, this.props = r, this.element = document.createElement(s), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), i && Object.keys(i).forEach((a) => {
3428
3426
  this.element.setAttribute(a, i[a]);
3429
- }), this.editor.isInitialized ? ir(() => {
3427
+ }), this.editor.isInitialized ? Wn(() => {
3430
3428
  this.render();
3431
3429
  }) : this.render();
3432
3430
  }
3433
3431
  render() {
3434
3432
  var t;
3435
3433
  const n = this.component, r = this.props, s = this.editor;
3436
- (wo(n) || Eo(n)) && (r.ref = (o) => {
3434
+ (oo(n) || io(n)) && (r.ref = (o) => {
3437
3435
  this.ref = o;
3438
- }), this.reactElement = R.createElement(n, r), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
3436
+ }), this.reactElement = L.createElement(n, r), (t = s == null ? void 0 : s.contentComponent) === null || t === void 0 || t.setRenderer(this.id, this);
3439
3437
  }
3440
3438
  updateProps(t = {}) {
3441
3439
  this.props = {
@@ -3449,7 +3447,7 @@ class To {
3449
3447
  (t = n == null ? void 0 : n.contentComponent) === null || t === void 0 || t.removeRenderer(this.id);
3450
3448
  }
3451
3449
  }
3452
- class Co extends Zs {
3450
+ class lo extends Ns {
3453
3451
  mount() {
3454
3452
  const t = {
3455
3453
  editor: this.editor,
@@ -3467,12 +3465,12 @@ class Co extends Zs {
3467
3465
  }
3468
3466
  const s = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (c) => {
3469
3467
  c && this.contentDOMElement && c.firstChild !== this.contentDOMElement && c.appendChild(this.contentDOMElement);
3470
- } }, o = this.component, i = R.memo((c) => R.createElement(Xe.Provider, { value: s }, R.createElement(o, c)));
3468
+ } }, o = this.component, i = L.memo((c) => L.createElement(je.Provider, { value: s }, L.createElement(o, c)));
3471
3469
  i.displayName = "ReactNodeView", this.node.isLeaf ? this.contentDOMElement = null : this.options.contentDOMElementTag ? this.contentDOMElement = document.createElement(this.options.contentDOMElementTag) : this.contentDOMElement = document.createElement(this.node.isInline ? "span" : "div"), this.contentDOMElement && (this.contentDOMElement.style.whiteSpace = "inherit");
3472
3470
  let a = this.node.isInline ? "span" : "div";
3473
3471
  this.options.as && (a = this.options.as);
3474
3472
  const { className: l = "" } = this.options;
3475
- this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new To(i, {
3473
+ this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.renderer = new ao(i, {
3476
3474
  editor: this.editor,
3477
3475
  props: t,
3478
3476
  as: a,
@@ -3533,255 +3531,10 @@ class Co extends Zs {
3533
3531
  this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), this.contentDOMElement = null;
3534
3532
  }
3535
3533
  }
3536
- function gi(e, t) {
3537
- return (n) => n.editor.contentComponent ? new Co(e, n, t) : {};
3538
- }
3539
- function Zt(e, t, n) {
3540
- const r = [], s = e.node(0);
3541
- n = typeof n == "number" && n >= 0 ? n : e.sameParent(t) ? Math.max(0, e.sharedDepth(t.pos) - 1) : e.sharedDepth(t.pos);
3542
- const o = new Nn(e, t, n), i = o.depth === 0 ? 0 : s.resolve(o.start).posAtIndex(0);
3543
- return o.parent.forEach((a, l) => {
3544
- const c = i + l, u = c + a.nodeSize;
3545
- if (c < o.start || c >= o.end)
3546
- return;
3547
- const d = new _n(s.resolve(c), s.resolve(u));
3548
- r.push(d);
3549
- }), r;
3550
- }
3551
- class te {
3552
- constructor(t, n) {
3553
- ot(this, "anchor");
3554
- ot(this, "head");
3555
- this.anchor = t, this.head = n;
3556
- }
3557
- map(t) {
3558
- return new te(t.map(this.anchor), t.map(this.head));
3559
- }
3560
- resolve(t) {
3561
- const n = t.resolve(this.anchor), r = t.resolve(this.head);
3562
- return new D(n, r);
3563
- }
3564
- }
3565
- class D extends W {
3566
- constructor(n, r, s, o = 1) {
3567
- const { doc: i } = n, a = n === r, l = n.pos === i.content.size && r.pos === i.content.size, c = a && !l ? i.resolve(r.pos + (o > 0 ? 1 : -1)) : r, u = a && l ? i.resolve(n.pos - (o > 0 ? 1 : -1)) : n, d = Zt(u.min(c), u.max(c), s);
3568
- super(c.pos >= n.pos ? d[0].$from : d[d.length - 1].$to, c.pos >= n.pos ? d[d.length - 1].$to : d[0].$from, d);
3569
- ot(this, "depth");
3570
- this.depth = s;
3571
- }
3572
- get $to() {
3573
- return this.ranges[this.ranges.length - 1].$to;
3574
- }
3575
- eq(n) {
3576
- return n instanceof D && n.$from.pos === this.$from.pos && n.$to.pos === this.$to.pos;
3577
- }
3578
- map(n, r) {
3579
- const s = n.resolve(r.map(this.anchor)), o = n.resolve(r.map(this.head));
3580
- return new D(s, o);
3581
- }
3582
- toJSON() {
3583
- return { type: "nodeRange", anchor: this.anchor, head: this.head };
3584
- }
3585
- get isForwards() {
3586
- return this.head >= this.anchor;
3587
- }
3588
- get isBackwards() {
3589
- return !this.isForwards;
3590
- }
3591
- extendBackwards() {
3592
- const { doc: n } = this.$from;
3593
- if (this.isForwards && this.ranges.length > 1) {
3594
- const o = this.ranges.slice(0, -1), i = o[0].$from, a = o[o.length - 1].$to;
3595
- return new D(i, a, this.depth);
3596
- }
3597
- const r = this.ranges[0], s = n.resolve(Math.max(0, r.$from.pos - 1));
3598
- return new D(this.$anchor, s, this.depth);
3599
- }
3600
- extendForwards() {
3601
- const { doc: n } = this.$from;
3602
- if (this.isBackwards && this.ranges.length > 1) {
3603
- const o = this.ranges.slice(1), i = o[0].$from, a = o[o.length - 1].$to;
3604
- return new D(a, i, this.depth);
3605
- }
3606
- const r = this.ranges[this.ranges.length - 1], s = n.resolve(Math.min(n.content.size, r.$to.pos + 1));
3607
- return new D(this.$anchor, s, this.depth);
3608
- }
3609
- static fromJSON(n, r) {
3610
- return new D(n.resolve(r.anchor), n.resolve(r.head));
3611
- }
3612
- static create(n, r, s, o, i = 1) {
3613
- return new this(n.resolve(r), n.resolve(s), o, i);
3614
- }
3615
- getBookmark() {
3616
- return new te(this.anchor, this.head);
3617
- }
3534
+ function Jo(e, t) {
3535
+ return (n) => n.editor.contentComponent ? new lo(e, n, t) : {};
3618
3536
  }
3619
- function xo(e) {
3620
- const t = e.cloneNode(!0), n = [e, ...Array.from(e.getElementsByTagName("*"))], r = [t, ...Array.from(t.getElementsByTagName("*"))];
3621
- return n.forEach((s, o) => {
3622
- r[o].style.cssText = function(i) {
3623
- let a = "";
3624
- const l = getComputedStyle(i);
3625
- for (let c = 0; c < l.length; c += 1)
3626
- a += `${l[c]}:${l.getPropertyValue(l[c])};`;
3627
- return a;
3628
- }(s);
3629
- }), t;
3630
- }
3631
- function ct(e, t) {
3632
- return window.getComputedStyle(e)[t];
3633
- }
3634
- function Ao(e = 0, t = 0, n = 0) {
3635
- return Math.min(Math.max(e, t), n);
3636
- }
3637
- function ve(e) {
3638
- e.parentNode !== null && e.parentNode !== void 0 && e.parentNode.removeChild(e);
3639
- }
3640
- const Qe = (e) => {
3641
- const { x: t, y: n, direction: r, editor: s } = e;
3642
- let o = null, i = null, a = null, l = t;
3643
- for (; i === null && l < window.innerWidth && l > 0; ) {
3644
- const c = document.elementsFromPoint(l, n), u = c.findIndex((h) => h.classList.contains("ProseMirror")), d = c.slice(0, u);
3645
- if (d.length > 0) {
3646
- const h = d[0];
3647
- if (o = h, a = s.view.posAtDOM(h, 0), a >= 0) {
3648
- i = s.state.doc.nodeAt(Math.max(a - 1, 0)), (i === null || i.isText) && (i = s.state.doc.nodeAt(Math.max(a - 1, 0))), i || (i = s.state.doc.nodeAt(Math.max(a, 0)));
3649
- break;
3650
- }
3651
- }
3652
- r === "left" ? l -= 1 : l += 1;
3653
- }
3654
- return { resultElement: o, resultNode: i, pos: a !== null ? a : null };
3655
- };
3656
- function Oo(e, t) {
3657
- const { doc: n } = t.view.state, r = Qe({ editor: t, x: e.clientX, y: e.clientY, direction: "right" });
3658
- if (!r.resultNode || r.pos === null)
3659
- return [];
3660
- const s = e.clientX, o = function(u, d, h) {
3661
- const p = parseInt(ct(u.dom, "paddingLeft"), 10), f = parseInt(ct(u.dom, "paddingRight"), 10), g = parseInt(ct(u.dom, "borderLeftWidth"), 10), m = parseInt(ct(u.dom, "borderLeftWidth"), 10), y = u.dom.getBoundingClientRect();
3662
- return { left: Ao(d, y.left + p + g, y.right - f - m), top: h };
3663
- }(t.view, s, e.clientY), i = t.view.posAtCoords(o);
3664
- if (!i)
3665
- return [];
3666
- const { pos: a } = i;
3667
- if (!n.resolve(a).parent)
3668
- return [];
3669
- const l = n.resolve(r.pos), c = n.resolve(r.pos + 1);
3670
- return Zt(l, c, 0);
3671
- }
3672
- const Me = (e, t) => {
3673
- const n = e.resolve(t), { depth: r } = n;
3674
- return r === 0 ? t : n.pos - n.parentOffset - 1;
3675
- }, Se = (e, t) => {
3676
- const n = e.nodeAt(t), r = e.resolve(t);
3677
- let { depth: s } = r, o = n;
3678
- for (; s > 0; ) {
3679
- const i = r.node(s);
3680
- s -= 1, s === 0 && (o = i);
3681
- }
3682
- return o;
3683
- }, _t = (e, t) => {
3684
- const n = In.getState(e);
3685
- return n ? $n(t, n.type, n.binding.mapping) : null;
3686
- }, ke = (e, t) => {
3687
- let n = t;
3688
- for (; n && n.parentNode && n.parentNode !== e.dom; )
3689
- n = n.parentNode;
3690
- return n;
3691
- }, Lo = new $("dragHandle"), yi = ({ pluginKey: e = Lo, element: t, editor: n, tippyOptions: r, onNodeChange: s }) => {
3692
- const o = document.createElement("div");
3693
- let i = null, a = !1, l = null, c = -1;
3694
- return t.addEventListener("dragstart", (u) => {
3695
- const { view: d } = n;
3696
- if (!u.dataTransfer)
3697
- return;
3698
- const { empty: h, $from: p, $to: f } = d.state.selection, g = Oo(u, n), m = Zt(p, f, 0), y = m.some((w) => g.find((O) => O.$from === w.$from && O.$to === w.$to)), k = h || !y ? g : m;
3699
- if (!k.length)
3700
- return;
3701
- const { tr: v } = d.state, b = document.createElement("div"), E = k[0].$from.pos, M = k[k.length - 1].$to.pos, T = D.create(d.state.doc, E, M), A = T.content();
3702
- k.forEach((w) => {
3703
- const O = xo(d.nodeDOM(w.$from.pos));
3704
- b.append(O);
3705
- }), b.style.position = "absolute", b.style.top = "-10000px", document.body.append(b), u.dataTransfer.clearData(), u.dataTransfer.setDragImage(b, 0, 0), d.dragging = { slice: A, move: !0 }, v.setSelection(T), d.dispatch(v), document.addEventListener("drop", () => ve(b), { once: !0 }), setTimeout(() => {
3706
- t && (t.style.pointerEvents = "none");
3707
- }, 0);
3708
- }), t.addEventListener("dragend", () => {
3709
- t && (t.style.pointerEvents = "auto");
3710
- }), new _({
3711
- key: typeof e == "string" ? new $(e) : e,
3712
- state: {
3713
- init: () => ({ locked: !1 }),
3714
- apply(u, d, h, p) {
3715
- const f = u.getMeta("lockDragHandle"), g = u.getMeta("hideDragHandle");
3716
- if (f !== void 0 && (a = f), g && i)
3717
- return i.hide(), a = !1, l = null, c = -1, s == null || s({ editor: n, node: null, pos: -1 }), d;
3718
- if (u.docChanged && c !== -1 && t && i) {
3719
- const m = u.mapping.map(c);
3720
- m !== c && (c = m, _t(p, c));
3721
- }
3722
- return d;
3723
- }
3724
- },
3725
- view: (u) => {
3726
- var d;
3727
- return t.draggable = !0, t.style.pointerEvents = "auto", (d = n.view.dom.parentElement) === null || d === void 0 || d.appendChild(o), o.appendChild(t), o.style.pointerEvents = "none", o.style.position = "absolute", o.style.top = "0", o.style.left = "0", i = He(u.dom, {
3728
- getReferenceClientRect: null,
3729
- interactive: !0,
3730
- trigger: "manual",
3731
- placement: "left-start",
3732
- hideOnClick: !1,
3733
- duration: 100,
3734
- zIndex: 10,
3735
- popperOptions: {
3736
- modifiers: [
3737
- { name: "flip", enabled: !1 },
3738
- { name: "preventOverflow", options: { rootBoundary: "document", mainAxis: !1 } }
3739
- ]
3740
- },
3741
- ...r,
3742
- appendTo: o,
3743
- content: t
3744
- }), {
3745
- update(h, p) {
3746
- if (!t || !i || (t.draggable = !a, u.state.doc.eq(p.doc) || c === -1))
3747
- return;
3748
- let f = u.nodeDOM(c);
3749
- if (f = ke(u, f), f === u.dom || (f == null ? void 0 : f.nodeType) !== 1)
3750
- return;
3751
- const g = u.posAtDOM(f, 0), m = Se(n.state.doc, g);
3752
- if (m !== l) {
3753
- const y = Me(n.state.doc, g);
3754
- l = m, c = y, _t(u.state, c), s == null || s({ editor: n, node: l, pos: c }), i.setProps({ getReferenceClientRect: () => f.getBoundingClientRect() }), i.show();
3755
- }
3756
- },
3757
- destroy() {
3758
- i == null || i.destroy(), t && ve(o);
3759
- }
3760
- };
3761
- },
3762
- props: {
3763
- handleDOMEvents: {
3764
- mouseleave: (u, d) => (a || d.target && !o.contains(d.relatedTarget) && (i == null || i.hide(), l = null, c = -1, s == null || s({ editor: n, node: null, pos: -1 })), !1),
3765
- mousemove(u, d) {
3766
- if (!t || !i || a)
3767
- return !1;
3768
- const h = Qe({ x: d.clientX, y: d.clientY, direction: "right", editor: n });
3769
- if (!h.resultElement)
3770
- return !1;
3771
- let p = h.resultElement;
3772
- if (p = ke(u, p), p === u.dom || (p == null ? void 0 : p.nodeType) !== 1)
3773
- return !1;
3774
- const f = u.posAtDOM(p, 0), g = Se(n.state.doc, f);
3775
- if (g !== l) {
3776
- const m = Me(n.state.doc, f);
3777
- l = g, c = m, _t(u.state, c), s == null || s({ editor: n, node: l, pos: c }), i.setProps({ getReferenceClientRect: () => p.getBoundingClientRect() }), i.show();
3778
- }
3779
- return !1;
3780
- }
3781
- }
3782
- }
3783
- });
3784
- }, Ro = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Ho = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Po = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, _o = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, bi = I.create({
3537
+ const co = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, uo = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, po = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, ho = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Yo = I.create({
3785
3538
  name: "italic",
3786
3539
  addOptions() {
3787
3540
  return {
@@ -3820,29 +3573,29 @@ const Me = (e, t) => {
3820
3573
  },
3821
3574
  addInputRules() {
3822
3575
  return [
3823
- Y({
3824
- find: Ro,
3576
+ J({
3577
+ find: co,
3825
3578
  type: this.type
3826
3579
  }),
3827
- Y({
3828
- find: Po,
3580
+ J({
3581
+ find: po,
3829
3582
  type: this.type
3830
3583
  })
3831
3584
  ];
3832
3585
  },
3833
3586
  addPasteRules() {
3834
3587
  return [
3835
- V({
3836
- find: Ho,
3588
+ z({
3589
+ find: uo,
3837
3590
  type: this.type
3838
3591
  }),
3839
- V({
3840
- find: _o,
3592
+ z({
3593
+ find: ho,
3841
3594
  type: this.type
3842
3595
  })
3843
3596
  ];
3844
3597
  }
3845
- }), vi = I.create({
3598
+ }), Xo = I.create({
3846
3599
  name: "underline",
3847
3600
  addOptions() {
3848
3601
  return {
@@ -3877,7 +3630,7 @@ const Me = (e, t) => {
3877
3630
  "Mod-U": () => this.editor.commands.toggleUnderline()
3878
3631
  };
3879
3632
  }
3880
- }), Io = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, $o = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Mi = I.create({
3633
+ }), fo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, mo = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Qo = I.create({
3881
3634
  name: "strike",
3882
3635
  addOptions() {
3883
3636
  return {
@@ -3919,21 +3672,21 @@ const Me = (e, t) => {
3919
3672
  },
3920
3673
  addInputRules() {
3921
3674
  return [
3922
- Y({
3923
- find: Io,
3675
+ J({
3676
+ find: fo,
3924
3677
  type: this.type
3925
3678
  })
3926
3679
  ];
3927
3680
  },
3928
3681
  addPasteRules() {
3929
3682
  return [
3930
- V({
3931
- find: $o,
3683
+ z({
3684
+ find: mo,
3932
3685
  type: this.type
3933
3686
  })
3934
3687
  ];
3935
3688
  }
3936
- }), No = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, Do = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g, Si = I.create({
3689
+ }), go = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/, yo = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g, Zo = I.create({
3937
3690
  name: "code",
3938
3691
  addOptions() {
3939
3692
  return {
@@ -3965,21 +3718,21 @@ const Me = (e, t) => {
3965
3718
  },
3966
3719
  addInputRules() {
3967
3720
  return [
3968
- Y({
3969
- find: No,
3721
+ J({
3722
+ find: go,
3970
3723
  type: this.type
3971
3724
  })
3972
3725
  ];
3973
3726
  },
3974
3727
  addPasteRules() {
3975
3728
  return [
3976
- V({
3977
- find: Do,
3729
+ z({
3730
+ find: yo,
3978
3731
  type: this.type
3979
3732
  })
3980
3733
  ];
3981
3734
  }
3982
- }), Bo = /^```([a-z]+)?[\s\n]$/, jo = /^~~~([a-z]+)?[\s\n]$/, ki = L.create({
3735
+ }), bo = /^```([a-z]+)?[\s\n]$/, vo = /^~~~([a-z]+)?[\s\n]$/, ti = O.create({
3983
3736
  name: "codeBlock",
3984
3737
  addOptions() {
3985
3738
  return {
@@ -4063,21 +3816,21 @@ const Me = (e, t) => {
4063
3816
  if (!o || s.parent.type !== this.type || !(s.parentOffset === s.parent.nodeSize - 2))
4064
3817
  return !1;
4065
3818
  const a = s.after();
4066
- return a === void 0 ? !1 : r.nodeAt(a) ? e.commands.command(({ tr: c }) => (c.setSelection(W.near(r.resolve(a))), !0)) : e.commands.exitCode();
3819
+ return a === void 0 ? !1 : r.nodeAt(a) ? e.commands.command(({ tr: c }) => (c.setSelection(G.near(r.resolve(a))), !0)) : e.commands.exitCode();
4067
3820
  }
4068
3821
  };
4069
3822
  },
4070
3823
  addInputRules() {
4071
3824
  return [
4072
- Bt({
4073
- find: Bo,
3825
+ Pt({
3826
+ find: bo,
4074
3827
  type: this.type,
4075
3828
  getAttributes: (e) => ({
4076
3829
  language: e[1]
4077
3830
  })
4078
3831
  }),
4079
- Bt({
4080
- find: jo,
3832
+ Pt({
3833
+ find: vo,
4081
3834
  type: this.type,
4082
3835
  getAttributes: (e) => ({
4083
3836
  language: e[1]
@@ -4089,7 +3842,7 @@ const Me = (e, t) => {
4089
3842
  return [
4090
3843
  // this plugin creates a code block for pasted content from VS Code
4091
3844
  // we can also detect the copied code language
4092
- new _({
3845
+ new P({
4093
3846
  key: new $("codeBlockVSCodeHandler"),
4094
3847
  props: {
4095
3848
  handlePaste: (e, t) => {
@@ -4106,7 +3859,7 @@ const Me = (e, t) => {
4106
3859
  })
4107
3860
  ];
4108
3861
  }
4109
- }), wi = I.create({
3862
+ }), ei = I.create({
4110
3863
  name: "textStyle",
4111
3864
  priority: 101,
4112
3865
  addOptions() {
@@ -4128,12 +3881,12 @@ const Me = (e, t) => {
4128
3881
  addCommands() {
4129
3882
  return {
4130
3883
  removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
4131
- const n = st(e, this.type);
3884
+ const n = rt(e, this.type);
4132
3885
  return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
4133
3886
  }
4134
3887
  };
4135
3888
  }
4136
- }), Ei = H.create({
3889
+ }), ni = R.create({
4137
3890
  name: "fontFamily",
4138
3891
  addOptions() {
4139
3892
  return {
@@ -4165,7 +3918,7 @@ const Me = (e, t) => {
4165
3918
  unsetFontFamily: () => ({ chain: e }) => e().setMark("textStyle", { fontFamily: null }).removeEmptyTextStyle().run()
4166
3919
  };
4167
3920
  }
4168
- }), Ti = L.create({
3921
+ }), ri = O.create({
4169
3922
  name: "heading",
4170
3923
  addOptions() {
4171
3924
  return {
@@ -4206,7 +3959,7 @@ const Me = (e, t) => {
4206
3959
  }), {});
4207
3960
  },
4208
3961
  addInputRules() {
4209
- return this.options.levels.map((e) => Bt({
3962
+ return this.options.levels.map((e) => Pt({
4210
3963
  find: new RegExp(`^(#{1,${e}})\\s$`),
4211
3964
  type: this.type,
4212
3965
  getAttributes: {
@@ -4214,7 +3967,7 @@ const Me = (e, t) => {
4214
3967
  }
4215
3968
  }));
4216
3969
  }
4217
- }), Ci = H.create({
3970
+ }), si = R.create({
4218
3971
  name: "textAlign",
4219
3972
  addOptions() {
4220
3973
  return {
@@ -4254,7 +4007,7 @@ const Me = (e, t) => {
4254
4007
  "Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
4255
4008
  };
4256
4009
  }
4257
- }), xi = H.create({
4010
+ }), oi = R.create({
4258
4011
  name: "color",
4259
4012
  addOptions() {
4260
4013
  return {
@@ -4286,7 +4039,7 @@ const Me = (e, t) => {
4286
4039
  unsetColor: () => ({ chain: e }) => e().setMark("textStyle", { color: null }).removeEmptyTextStyle().run()
4287
4040
  };
4288
4041
  }
4289
- }), Fo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, zo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, Ai = I.create({
4042
+ }), Mo = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/, So = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g, ii = I.create({
4290
4043
  name: "highlight",
4291
4044
  addOptions() {
4292
4045
  return {
@@ -4330,21 +4083,21 @@ const Me = (e, t) => {
4330
4083
  },
4331
4084
  addInputRules() {
4332
4085
  return [
4333
- Y({
4334
- find: Fo,
4086
+ J({
4087
+ find: Mo,
4335
4088
  type: this.type
4336
4089
  })
4337
4090
  ];
4338
4091
  },
4339
4092
  addPasteRules() {
4340
4093
  return [
4341
- V({
4342
- find: zo,
4094
+ z({
4095
+ find: So,
4343
4096
  type: this.type
4344
4097
  })
4345
4098
  ];
4346
4099
  }
4347
- }), Wo = L.create({
4100
+ }), ko = O.create({
4348
4101
  name: "listItem",
4349
4102
  addOptions() {
4350
4103
  return {
@@ -4372,7 +4125,7 @@ const Me = (e, t) => {
4372
4125
  "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
4373
4126
  };
4374
4127
  }
4375
- }), we = I.create({
4128
+ }), he = I.create({
4376
4129
  name: "textStyle",
4377
4130
  priority: 101,
4378
4131
  addOptions() {
@@ -4394,12 +4147,12 @@ const Me = (e, t) => {
4394
4147
  addCommands() {
4395
4148
  return {
4396
4149
  removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
4397
- const n = st(e, this.type);
4150
+ const n = rt(e, this.type);
4398
4151
  return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
4399
4152
  }
4400
4153
  };
4401
4154
  }
4402
- }), Ee = /^\s*([-+*])\s$/, Oi = L.create({
4155
+ }), fe = /^\s*([-+*])\s$/, ai = O.create({
4403
4156
  name: "bulletList",
4404
4157
  addOptions() {
4405
4158
  return {
@@ -4423,7 +4176,7 @@ const Me = (e, t) => {
4423
4176
  },
4424
4177
  addCommands() {
4425
4178
  return {
4426
- toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Wo.name, this.editor.getAttributes(we.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4179
+ toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ko.name, this.editor.getAttributes(he.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4427
4180
  };
4428
4181
  },
4429
4182
  addKeyboardShortcuts() {
@@ -4432,22 +4185,22 @@ const Me = (e, t) => {
4432
4185
  };
4433
4186
  },
4434
4187
  addInputRules() {
4435
- let e = et({
4436
- find: Ee,
4188
+ let e = tt({
4189
+ find: fe,
4437
4190
  type: this.type
4438
4191
  });
4439
- return (this.options.keepMarks || this.options.keepAttributes) && (e = et({
4440
- find: Ee,
4192
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = tt({
4193
+ find: fe,
4441
4194
  type: this.type,
4442
4195
  keepMarks: this.options.keepMarks,
4443
4196
  keepAttributes: this.options.keepAttributes,
4444
- getAttributes: () => this.editor.getAttributes(we.name),
4197
+ getAttributes: () => this.editor.getAttributes(he.name),
4445
4198
  editor: this.editor
4446
4199
  })), [
4447
4200
  e
4448
4201
  ];
4449
4202
  }
4450
- }), Vo = L.create({
4203
+ }), wo = O.create({
4451
4204
  name: "listItem",
4452
4205
  addOptions() {
4453
4206
  return {
@@ -4475,7 +4228,7 @@ const Me = (e, t) => {
4475
4228
  "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
4476
4229
  };
4477
4230
  }
4478
- }), Te = I.create({
4231
+ }), me = I.create({
4479
4232
  name: "textStyle",
4480
4233
  priority: 101,
4481
4234
  addOptions() {
@@ -4497,12 +4250,12 @@ const Me = (e, t) => {
4497
4250
  addCommands() {
4498
4251
  return {
4499
4252
  removeEmptyTextStyle: () => ({ state: e, commands: t }) => {
4500
- const n = st(e, this.type);
4253
+ const n = rt(e, this.type);
4501
4254
  return Object.entries(n).some(([, s]) => !!s) ? !0 : t.unsetMark(this.name);
4502
4255
  }
4503
4256
  };
4504
4257
  }
4505
- }), Ce = /^(\d+)\.\s$/, Li = L.create({
4258
+ }), ge = /^(\d+)\.\s$/, li = O.create({
4506
4259
  name: "orderedList",
4507
4260
  addOptions() {
4508
4261
  return {
@@ -4541,7 +4294,7 @@ const Me = (e, t) => {
4541
4294
  },
4542
4295
  addCommands() {
4543
4296
  return {
4544
- toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Vo.name, this.editor.getAttributes(Te.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4297
+ toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(wo.name, this.editor.getAttributes(me.name)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
4545
4298
  };
4546
4299
  },
4547
4300
  addKeyboardShortcuts() {
@@ -4550,25 +4303,25 @@ const Me = (e, t) => {
4550
4303
  };
4551
4304
  },
4552
4305
  addInputRules() {
4553
- let e = et({
4554
- find: Ce,
4306
+ let e = tt({
4307
+ find: ge,
4555
4308
  type: this.type,
4556
4309
  getAttributes: (t) => ({ start: +t[1] }),
4557
4310
  joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1]
4558
4311
  });
4559
- return (this.options.keepMarks || this.options.keepAttributes) && (e = et({
4560
- find: Ce,
4312
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = tt({
4313
+ find: ge,
4561
4314
  type: this.type,
4562
4315
  keepMarks: this.options.keepMarks,
4563
4316
  keepAttributes: this.options.keepAttributes,
4564
- getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(Te.name) }),
4317
+ getAttributes: (t) => ({ start: +t[1], ...this.editor.getAttributes(me.name) }),
4565
4318
  joinPredicate: (t, n) => n.childCount + n.attrs.start === +t[1],
4566
4319
  editor: this.editor
4567
4320
  })), [
4568
4321
  e
4569
4322
  ];
4570
4323
  }
4571
- }), Ko = /^\s*(\[([( |x])?\])\s$/, Ri = L.create({
4324
+ }), To = /^\s*(\[([( |x])?\])\s$/, ci = O.create({
4572
4325
  name: "taskItem",
4573
4326
  addOptions() {
4574
4327
  return {
@@ -4644,9 +4397,9 @@ const Me = (e, t) => {
4644
4397
  }
4645
4398
  const { checked: u } = c.target;
4646
4399
  r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: d }) => {
4647
- const h = n(), p = d.doc.nodeAt(h);
4648
- return d.setNodeMarkup(h, void 0, {
4649
- ...p == null ? void 0 : p.attrs,
4400
+ const p = n(), h = d.doc.nodeAt(p);
4401
+ return d.setNodeMarkup(p, void 0, {
4402
+ ...h == null ? void 0 : h.attrs,
4650
4403
  checked: u
4651
4404
  }), !0;
4652
4405
  }).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(e, u) || (a.checked = !a.checked));
@@ -4663,8 +4416,8 @@ const Me = (e, t) => {
4663
4416
  },
4664
4417
  addInputRules() {
4665
4418
  return [
4666
- et({
4667
- find: Ko,
4419
+ tt({
4420
+ find: To,
4668
4421
  type: this.type,
4669
4422
  getAttributes: (e) => ({
4670
4423
  checked: e[e.length - 1] === "x"
@@ -4672,7 +4425,7 @@ const Me = (e, t) => {
4672
4425
  })
4673
4426
  ];
4674
4427
  }
4675
- }), Hi = L.create({
4428
+ }), di = O.create({
4676
4429
  name: "taskList",
4677
4430
  addOptions() {
4678
4431
  return {
@@ -4705,7 +4458,7 @@ const Me = (e, t) => {
4705
4458
  "Mod-Shift-9": () => this.editor.commands.toggleTaskList()
4706
4459
  };
4707
4460
  }
4708
- }), Uo = /^\s*>\s$/, Pi = L.create({
4461
+ }), Eo = /^\s*>\s$/, ui = O.create({
4709
4462
  name: "blockquote",
4710
4463
  addOptions() {
4711
4464
  return {
@@ -4737,44 +4490,44 @@ const Me = (e, t) => {
4737
4490
  },
4738
4491
  addInputRules() {
4739
4492
  return [
4740
- et({
4741
- find: Uo,
4493
+ tt({
4494
+ find: Eo,
4742
4495
  type: this.type
4743
4496
  })
4744
4497
  ];
4745
4498
  }
4746
4499
  });
4747
- function qo(e) {
4500
+ function Co(e) {
4748
4501
  return e.length === 1 ? e[0].isLink : e.length === 3 && e[1].isLink ? ["()", "[]"].includes(e[0].value + e[2].value) : !1;
4749
4502
  }
4750
- function Go(e) {
4751
- return new _({
4503
+ function xo(e) {
4504
+ return new P({
4752
4505
  key: new $("autolink"),
4753
4506
  appendTransaction: (t, n, r) => {
4754
4507
  const s = t.some((c) => c.docChanged) && !n.doc.eq(r.doc), o = t.some((c) => c.getMeta("preventAutolink"));
4755
4508
  if (!s || o)
4756
4509
  return;
4757
- const { tr: i } = r, a = hs(n.doc, [...t]);
4758
- if (Ss(a).forEach(({ newRange: c }) => {
4759
- const u = ms(r.doc, c, (p) => p.isTextblock);
4760
- let d, h;
4761
- if (u.length > 1 ? (d = u[0], h = r.doc.textBetween(d.pos, d.pos + d.node.nodeSize, void 0, " ")) : u.length && r.doc.textBetween(c.from, c.to, " ", " ").endsWith(" ") && (d = u[0], h = r.doc.textBetween(d.pos, c.to, void 0, " ")), d && h) {
4762
- const p = h.split(" ").filter((y) => y !== "");
4763
- if (p.length <= 0)
4510
+ const { tr: i } = r, a = Yr(n.doc, [...t]);
4511
+ if (ss(a).forEach(({ newRange: c }) => {
4512
+ const u = Qr(r.doc, c, (h) => h.isTextblock);
4513
+ let d, p;
4514
+ if (u.length > 1 ? (d = u[0], p = r.doc.textBetween(d.pos, d.pos + d.node.nodeSize, void 0, " ")) : u.length && r.doc.textBetween(c.from, c.to, " ", " ").endsWith(" ") && (d = u[0], p = r.doc.textBetween(d.pos, c.to, void 0, " ")), d && p) {
4515
+ const h = p.split(" ").filter((m) => m !== "");
4516
+ if (h.length <= 0)
4764
4517
  return !1;
4765
- const f = p[p.length - 1], g = d.pos + h.lastIndexOf(f);
4518
+ const f = h[h.length - 1], y = d.pos + p.lastIndexOf(f);
4766
4519
  if (!f)
4767
4520
  return !1;
4768
- const m = Dn(f).map((y) => y.toObject(e.defaultProtocol));
4769
- if (!qo(m))
4521
+ const g = Sn(f).map((m) => m.toObject(e.defaultProtocol));
4522
+ if (!Co(g))
4770
4523
  return !1;
4771
- m.filter((y) => y.isLink).map((y) => ({
4772
- ...y,
4773
- from: g + y.start + 1,
4774
- to: g + y.end + 1
4775
- })).filter((y) => r.schema.marks.code ? !r.doc.rangeHasMark(y.from, y.to, r.schema.marks.code) : !0).filter((y) => e.validate(y.value)).forEach((y) => {
4776
- Xt(y.from, y.to, r.doc).some((k) => k.mark.type === e.type) || i.addMark(y.from, y.to, e.type.create({
4777
- href: y.href
4524
+ g.filter((m) => m.isLink).map((m) => ({
4525
+ ...m,
4526
+ from: y + m.start + 1,
4527
+ to: y + m.end + 1
4528
+ })).filter((m) => r.schema.marks.code ? !r.doc.rangeHasMark(m.from, m.to, r.schema.marks.code) : !0).filter((m) => e.validate(m.value)).forEach((m) => {
4529
+ qt(m.from, m.to, r.doc).some((k) => k.mark.type === e.type) || i.addMark(m.from, m.to, e.type.create({
4530
+ href: m.href
4778
4531
  }));
4779
4532
  });
4780
4533
  }
@@ -4783,8 +4536,8 @@ function Go(e) {
4783
4536
  }
4784
4537
  });
4785
4538
  }
4786
- function Jo(e) {
4787
- return new _({
4539
+ function Ao(e) {
4540
+ return new P({
4788
4541
  key: new $("handleClickLink"),
4789
4542
  props: {
4790
4543
  handleClick: (t, n, r) => {
@@ -4795,16 +4548,16 @@ function Jo(e) {
4795
4548
  const a = [];
4796
4549
  for (; i.nodeName !== "DIV"; )
4797
4550
  a.push(i), i = i.parentNode;
4798
- if (!a.find((h) => h.nodeName === "A"))
4551
+ if (!a.find((p) => p.nodeName === "A"))
4799
4552
  return !1;
4800
- const l = Ue(t.state, e.type.name), c = r.target, u = (s = c == null ? void 0 : c.href) !== null && s !== void 0 ? s : l.href, d = (o = c == null ? void 0 : c.target) !== null && o !== void 0 ? o : l.target;
4553
+ const l = Pe(t.state, e.type.name), c = r.target, u = (s = c == null ? void 0 : c.href) !== null && s !== void 0 ? s : l.href, d = (o = c == null ? void 0 : c.target) !== null && o !== void 0 ? o : l.target;
4801
4554
  return c && u ? (window.open(u, d), !0) : !1;
4802
4555
  }
4803
4556
  }
4804
4557
  });
4805
4558
  }
4806
- function Yo(e) {
4807
- return new _({
4559
+ function Oo(e) {
4560
+ return new P({
4808
4561
  key: new $("handlePasteLink"),
4809
4562
  props: {
4810
4563
  handlePaste: (t, n, r) => {
@@ -4815,7 +4568,7 @@ function Yo(e) {
4815
4568
  r.content.forEach((c) => {
4816
4569
  a += c.textContent;
4817
4570
  });
4818
- const l = Pe(a, { defaultProtocol: e.defaultProtocol }).find((c) => c.isLink && c.value === a);
4571
+ const l = ke(a, { defaultProtocol: e.defaultProtocol }).find((c) => c.isLink && c.value === a);
4819
4572
  return !a || !l ? !1 : (e.editor.commands.setMark(e.type, {
4820
4573
  href: l.href
4821
4574
  }), !0);
@@ -4823,15 +4576,15 @@ function Yo(e) {
4823
4576
  }
4824
4577
  });
4825
4578
  }
4826
- const Xo = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
4827
- function xe(e, t) {
4579
+ const Lo = /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;
4580
+ function ye(e, t) {
4828
4581
  const n = ["http", "https", "ftp", "ftps", "mailto", "tel", "callto", "sms", "cid", "xmpp"];
4829
4582
  return t && t.forEach((r) => {
4830
4583
  const s = typeof r == "string" ? r : r.scheme;
4831
4584
  s && n.push(s);
4832
- }), !e || e.replace(Xo, "").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`, "i"));
4585
+ }), !e || e.replace(Lo, "").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`, "i"));
4833
4586
  }
4834
- const _i = I.create({
4587
+ const pi = I.create({
4835
4588
  name: "link",
4836
4589
  priority: 1e3,
4837
4590
  keepOnSplit: !1,
@@ -4839,14 +4592,14 @@ const _i = I.create({
4839
4592
  onCreate() {
4840
4593
  this.options.protocols.forEach((e) => {
4841
4594
  if (typeof e == "string") {
4842
- re(e);
4595
+ Xt(e);
4843
4596
  return;
4844
4597
  }
4845
- re(e.scheme, e.optionalSlashes);
4598
+ Xt(e.scheme, e.optionalSlashes);
4846
4599
  });
4847
4600
  },
4848
4601
  onDestroy() {
4849
- Bn();
4602
+ kn();
4850
4603
  },
4851
4604
  inclusive() {
4852
4605
  return this.options.autolink;
@@ -4890,12 +4643,12 @@ const _i = I.create({
4890
4643
  tag: "a[href]",
4891
4644
  getAttrs: (e) => {
4892
4645
  const t = e.getAttribute("href");
4893
- return !t || !xe(t, this.options.protocols) ? !1 : null;
4646
+ return !t || !ye(t, this.options.protocols) ? !1 : null;
4894
4647
  }
4895
4648
  }];
4896
4649
  },
4897
4650
  renderHTML({ HTMLAttributes: e }) {
4898
- return xe(e.href, this.options.protocols) ? ["a", x(this.options.HTMLAttributes, e), 0] : ["a", x(this.options.HTMLAttributes, { ...e, href: "" }), 0];
4651
+ return ye(e.href, this.options.protocols) ? ["a", x(this.options.HTMLAttributes, e), 0] : ["a", x(this.options.HTMLAttributes, { ...e, href: "" }), 0];
4899
4652
  },
4900
4653
  addCommands() {
4901
4654
  return {
@@ -4906,11 +4659,11 @@ const _i = I.create({
4906
4659
  },
4907
4660
  addPasteRules() {
4908
4661
  return [
4909
- V({
4662
+ z({
4910
4663
  find: (e) => {
4911
4664
  const t = [];
4912
4665
  if (e) {
4913
- const { validate: n } = this.options, r = Pe(e).filter((s) => s.isLink && n(s.value));
4666
+ const { validate: n } = this.options, r = ke(e).filter((s) => s.isLink && n(s.value));
4914
4667
  r.length && r.forEach((s) => t.push({
4915
4668
  text: s.value,
4916
4669
  data: {
@@ -4933,19 +4686,19 @@ const _i = I.create({
4933
4686
  },
4934
4687
  addProseMirrorPlugins() {
4935
4688
  const e = [];
4936
- return this.options.autolink && e.push(Go({
4689
+ return this.options.autolink && e.push(xo({
4937
4690
  type: this.type,
4938
4691
  defaultProtocol: this.options.defaultProtocol,
4939
4692
  validate: this.options.validate
4940
- })), this.options.openOnClick === !0 && e.push(Jo({
4693
+ })), this.options.openOnClick === !0 && e.push(Ao({
4941
4694
  type: this.type
4942
- })), this.options.linkOnPaste && e.push(Yo({
4695
+ })), this.options.linkOnPaste && e.push(Oo({
4943
4696
  editor: this.editor,
4944
4697
  defaultProtocol: this.options.defaultProtocol,
4945
4698
  type: this.type
4946
4699
  })), e;
4947
4700
  }
4948
- }), Ii = L.create({
4701
+ }), hi = O.create({
4949
4702
  name: "horizontalRule",
4950
4703
  addOptions() {
4951
4704
  return {
@@ -4968,14 +4721,14 @@ const _i = I.create({
4968
4721
  to: s.pos
4969
4722
  }, {
4970
4723
  type: this.name
4971
- }) : qe(n) ? o.insertContentAt(s.pos, {
4724
+ }) : Ne(n) ? o.insertContentAt(s.pos, {
4972
4725
  type: this.name
4973
4726
  }) : o.insertContent({ type: this.name }), o.command(({ tr: i, dispatch: a }) => {
4974
4727
  var l;
4975
4728
  if (a) {
4976
4729
  const { $to: c } = i.selection, u = c.end();
4977
4730
  if (c.nodeAfter)
4978
- c.nodeAfter.isTextblock ? i.setSelection(N.create(i.doc, c.pos + 1)) : c.nodeAfter.isBlock ? i.setSelection(tt.create(i.doc, c.pos)) : i.setSelection(N.create(i.doc, c.pos));
4731
+ c.nodeAfter.isTextblock ? i.setSelection(N.create(i.doc, c.pos + 1)) : c.nodeAfter.isBlock ? i.setSelection(Z.create(i.doc, c.pos)) : i.setSelection(N.create(i.doc, c.pos));
4979
4732
  else {
4980
4733
  const d = (l = c.parent.type.contentMatch.defaultType) === null || l === void 0 ? void 0 : l.create();
4981
4734
  d && (i.insert(u, d), i.setSelection(N.create(i.doc, u + 1)));
@@ -4989,13 +4742,13 @@ const _i = I.create({
4989
4742
  },
4990
4743
  addInputRules() {
4991
4744
  return [
4992
- Ge({
4745
+ $e({
4993
4746
  find: /^(?:---|—-|___\s|\*\*\*\s)$/,
4994
4747
  type: this.type
4995
4748
  })
4996
4749
  ];
4997
4750
  }
4998
- }), $i = H.create({
4751
+ }), fi = R.create({
4999
4752
  name: "history",
5000
4753
  addOptions() {
5001
4754
  return {
@@ -5005,13 +4758,13 @@ const _i = I.create({
5005
4758
  },
5006
4759
  addCommands() {
5007
4760
  return {
5008
- undo: () => ({ state: e, dispatch: t }) => jn(e, t),
5009
- redo: () => ({ state: e, dispatch: t }) => Fn(e, t)
4761
+ undo: () => ({ state: e, dispatch: t }) => wn(e, t),
4762
+ redo: () => ({ state: e, dispatch: t }) => Tn(e, t)
5010
4763
  };
5011
4764
  },
5012
4765
  addProseMirrorPlugins() {
5013
4766
  return [
5014
- zn(this.options)
4767
+ En(this.options)
5015
4768
  ];
5016
4769
  },
5017
4770
  addKeyboardShortcuts() {
@@ -5024,7 +4777,7 @@ const _i = I.create({
5024
4777
  "Shift-Mod-я": () => this.editor.commands.redo()
5025
4778
  };
5026
4779
  }
5027
- }), Ni = H.create({
4780
+ }), mi = R.create({
5028
4781
  name: "characterCount",
5029
4782
  addOptions() {
5030
4783
  return {
@@ -5049,7 +4802,7 @@ const _i = I.create({
5049
4802
  },
5050
4803
  addProseMirrorPlugins() {
5051
4804
  return [
5052
- new _({
4805
+ new P({
5053
4806
  key: new $("characterCount"),
5054
4807
  filterTransaction: (e, t) => {
5055
4808
  const n = this.options.limit;
@@ -5066,7 +4819,7 @@ const _i = I.create({
5066
4819
  })
5067
4820
  ];
5068
4821
  }
5069
- }), Di = H.create({
4822
+ }), gi = R.create({
5070
4823
  name: "dropCursor",
5071
4824
  addOptions() {
5072
4825
  return {
@@ -5077,10 +4830,10 @@ const _i = I.create({
5077
4830
  },
5078
4831
  addProseMirrorPlugins() {
5079
4832
  return [
5080
- Wn(this.options)
4833
+ Cn(this.options)
5081
4834
  ];
5082
4835
  }
5083
- }), Bi = H.create({
4836
+ }), yi = R.create({
5084
4837
  name: "focus",
5085
4838
  addOptions() {
5086
4839
  return {
@@ -5090,13 +4843,13 @@ const _i = I.create({
5090
4843
  },
5091
4844
  addProseMirrorPlugins() {
5092
4845
  return [
5093
- new _({
4846
+ new P({
5094
4847
  key: new $("focus"),
5095
4848
  props: {
5096
4849
  decorations: ({ doc: e, selection: t }) => {
5097
4850
  const { isEditable: n, isFocused: r } = this.editor, { anchor: s } = t, o = [];
5098
4851
  if (!n || !r)
5099
- return ft.create(e, []);
4852
+ return ut.create(e, []);
5100
4853
  let i = 0;
5101
4854
  this.options.mode === "deepest" && e.descendants((l, c) => {
5102
4855
  if (l.isText)
@@ -5111,20 +4864,20 @@ const _i = I.create({
5111
4864
  return !1;
5112
4865
  if (a += 1, this.options.mode === "deepest" && i - a > 0 || this.options.mode === "shallowest" && a > 1)
5113
4866
  return this.options.mode === "deepest";
5114
- o.push(Vt.node(c, c + l.nodeSize, {
4867
+ o.push(jt.node(c, c + l.nodeSize, {
5115
4868
  class: this.options.className
5116
4869
  }));
5117
- }), ft.create(e, o);
4870
+ }), ut.create(e, o);
5118
4871
  }
5119
4872
  }
5120
4873
  })
5121
4874
  ];
5122
4875
  }
5123
- }), ji = H.create({
4876
+ }), bi = R.create({
5124
4877
  name: "gapCursor",
5125
4878
  addProseMirrorPlugins() {
5126
4879
  return [
5127
- Vn()
4880
+ xn()
5128
4881
  ];
5129
4882
  },
5130
4883
  extendNodeSchema(e) {
@@ -5135,10 +4888,10 @@ const _i = I.create({
5135
4888
  storage: e.storage
5136
4889
  };
5137
4890
  return {
5138
- allowGapCursor: (t = C(S(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
4891
+ allowGapCursor: (t = T(v(e, "allowGapCursor", n))) !== null && t !== void 0 ? t : null
5139
4892
  };
5140
4893
  }
5141
- }), Fi = L.create({
4894
+ }), vi = O.create({
5142
4895
  name: "hardBreak",
5143
4896
  addOptions() {
5144
4897
  return {
@@ -5172,7 +4925,7 @@ const _i = I.create({
5172
4925
  const { keepMarks: i } = this.options, { splittableMarks: a } = r.extensionManager, l = o || s.$to.parentOffset && s.$from.marks();
5173
4926
  return t().insertContent({ type: this.name }).command(({ tr: c, dispatch: u }) => {
5174
4927
  if (u && l && i) {
5175
- const d = l.filter((h) => a.includes(h.type.name));
4928
+ const d = l.filter((p) => a.includes(p.type.name));
5176
4929
  c.ensureMarks(d);
5177
4930
  }
5178
4931
  return !0;
@@ -5187,7 +4940,7 @@ const _i = I.create({
5187
4940
  "Shift-Enter": () => this.editor.commands.setHardBreak()
5188
4941
  };
5189
4942
  }
5190
- }), zi = L.create({
4943
+ }), Mi = O.create({
5191
4944
  name: "listItem",
5192
4945
  addOptions() {
5193
4946
  return {
@@ -5215,7 +4968,7 @@ const _i = I.create({
5215
4968
  "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
5216
4969
  };
5217
4970
  }
5218
- }), Wi = L.create({
4971
+ }), Si = O.create({
5219
4972
  name: "paragraph",
5220
4973
  priority: 1e3,
5221
4974
  addOptions() {
@@ -5243,7 +4996,7 @@ const _i = I.create({
5243
4996
  "Mod-Alt-0": () => this.editor.commands.setParagraph()
5244
4997
  };
5245
4998
  }
5246
- }), Vi = H.create({
4999
+ }), ki = R.create({
5247
5000
  name: "placeholder",
5248
5001
  addOptions() {
5249
5002
  return {
@@ -5257,7 +5010,7 @@ const _i = I.create({
5257
5010
  },
5258
5011
  addProseMirrorPlugins() {
5259
5012
  return [
5260
- new _({
5013
+ new P({
5261
5014
  key: new $("placeholder"),
5262
5015
  props: {
5263
5016
  decorations: ({ doc: e, selection: t }) => {
@@ -5266,11 +5019,11 @@ const _i = I.create({
5266
5019
  return null;
5267
5020
  const o = this.editor.isEmpty;
5268
5021
  return e.descendants((i, a) => {
5269
- const l = r >= a && r <= a + i.nodeSize, c = !i.isLeaf && Qt(i);
5022
+ const l = r >= a && r <= a + i.nodeSize, c = !i.isLeaf && Gt(i);
5270
5023
  if ((l || !this.options.showOnlyCurrent) && c) {
5271
5024
  const u = [this.options.emptyNodeClass];
5272
5025
  o && u.push(this.options.emptyEditorClass);
5273
- const d = Vt.node(a, a + i.nodeSize, {
5026
+ const d = jt.node(a, a + i.nodeSize, {
5274
5027
  class: u.join(" "),
5275
5028
  "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
5276
5029
  editor: this.editor,
@@ -5282,20 +5035,20 @@ const _i = I.create({
5282
5035
  s.push(d);
5283
5036
  }
5284
5037
  return this.options.includeChildren;
5285
- }), ft.create(e, s);
5038
+ }), ut.create(e, s);
5286
5039
  }
5287
5040
  }
5288
5041
  })
5289
5042
  ];
5290
5043
  }
5291
- }), Ki = L.create({
5044
+ }), wi = O.create({
5292
5045
  name: "text",
5293
5046
  group: "inline"
5294
- }), Ui = L.create({
5047
+ }), Ti = O.create({
5295
5048
  name: "doc",
5296
5049
  topNode: !0,
5297
5050
  content: "block+"
5298
- }), qi = I.create({
5051
+ }), Ei = I.create({
5299
5052
  name: "subscript",
5300
5053
  addOptions() {
5301
5054
  return {
@@ -5330,7 +5083,7 @@ const _i = I.create({
5330
5083
  "Mod-,": () => this.editor.commands.toggleSubscript()
5331
5084
  };
5332
5085
  }
5333
- }), Gi = I.create({
5086
+ }), Ci = I.create({
5334
5087
  name: "superscript",
5335
5088
  addOptions() {
5336
5089
  return {
@@ -5366,68 +5119,68 @@ const _i = I.create({
5366
5119
  };
5367
5120
  }
5368
5121
  });
5369
- function Qo(e) {
5122
+ function Ro(e) {
5370
5123
  var t;
5371
- const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = to(n), l = new RegExp(`\\s${a}$`), c = o ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), d = ((t = i.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && i.nodeBefore.text;
5124
+ const { char: n, allowSpaces: r, allowedPrefixes: s, startOfLine: o, $position: i } = e, a = $s(n), l = new RegExp(`\\s${a}$`), c = o ? "^" : "", u = r ? new RegExp(`${c}${a}.*?(?=\\s${a}|$)`, "gm") : new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`, "gm"), d = ((t = i.nodeBefore) === null || t === void 0 ? void 0 : t.isText) && i.nodeBefore.text;
5372
5125
  if (!d)
5373
5126
  return null;
5374
- const h = i.pos - d.length, p = Array.from(d.matchAll(u)).pop();
5375
- if (!p || p.input === void 0 || p.index === void 0)
5127
+ const p = i.pos - d.length, h = Array.from(d.matchAll(u)).pop();
5128
+ if (!h || h.input === void 0 || h.index === void 0)
5376
5129
  return null;
5377
- const f = p.input.slice(Math.max(0, p.index - 1), p.index), g = new RegExp(`^[${s == null ? void 0 : s.join("")}\0]?$`).test(f);
5378
- if (s !== null && !g)
5130
+ const f = h.input.slice(Math.max(0, h.index - 1), h.index), y = new RegExp(`^[${s == null ? void 0 : s.join("")}\0]?$`).test(f);
5131
+ if (s !== null && !y)
5379
5132
  return null;
5380
- const m = h + p.index;
5381
- let y = m + p[0].length;
5382
- return r && l.test(d.slice(y - 1, y + 1)) && (p[0] += " ", y += 1), m < i.pos && y >= i.pos ? {
5133
+ const g = p + h.index;
5134
+ let m = g + h[0].length;
5135
+ return r && l.test(d.slice(m - 1, m + 1)) && (h[0] += " ", m += 1), g < i.pos && m >= i.pos ? {
5383
5136
  range: {
5384
- from: m,
5385
- to: y
5137
+ from: g,
5138
+ to: m
5386
5139
  },
5387
- query: p[0].slice(n.length),
5388
- text: p[0]
5140
+ query: h[0].slice(n.length),
5141
+ text: h[0]
5389
5142
  } : null;
5390
5143
  }
5391
- const Zo = new $("suggestion");
5392
- function Ji({ pluginKey: e = Zo, editor: t, char: n = "@", allowSpaces: r = !1, allowedPrefixes: s = [" "], startOfLine: o = !1, decorationTag: i = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: d = () => !0, findSuggestionMatch: h = Qo }) {
5393
- let p;
5394
- const f = u == null ? void 0 : u(), g = new _({
5144
+ const _o = new $("suggestion");
5145
+ function xi({ pluginKey: e = _o, editor: t, char: n = "@", allowSpaces: r = !1, allowedPrefixes: s = [" "], startOfLine: o = !1, decorationTag: i = "span", decorationClass: a = "suggestion", command: l = () => null, items: c = () => [], render: u = () => ({}), allow: d = () => !0, findSuggestionMatch: p = Ro }) {
5146
+ let h;
5147
+ const f = u == null ? void 0 : u(), y = new P({
5395
5148
  key: e,
5396
5149
  view() {
5397
5150
  return {
5398
- update: async (m, y) => {
5399
- var k, v, b, E, M, T, A;
5400
- const w = (k = this.key) === null || k === void 0 ? void 0 : k.getState(y), O = (v = this.key) === null || v === void 0 ? void 0 : v.getState(m.state), B = w.active && O.active && w.range.from !== O.range.from, F = !w.active && O.active, X = w.active && !O.active, U = !F && !X && w.query !== O.query, q = F || B && U, z = U || B, G = X || B && U;
5401
- if (!q && !z && !G)
5151
+ update: async (g, m) => {
5152
+ var k, b, S, w, M, C, A;
5153
+ const E = (k = this.key) === null || k === void 0 ? void 0 : k.getState(m), _ = (b = this.key) === null || b === void 0 ? void 0 : b.getState(g.state), D = E.active && _.active && E.range.from !== _.range.from, j = !E.active && _.active, Y = E.active && !_.active, V = !j && !Y && E.query !== _.query, K = j || D && V, F = V || D, U = Y || D && V;
5154
+ if (!K && !F && !U)
5402
5155
  return;
5403
- const Q = G && !q ? w : O, ee = m.dom.querySelector(`[data-decoration-id="${Q.decorationId}"]`);
5404
- p = {
5156
+ const X = U && !K ? E : _, Jt = g.dom.querySelector(`[data-decoration-id="${X.decorationId}"]`);
5157
+ h = {
5405
5158
  editor: t,
5406
- range: Q.range,
5407
- query: Q.query,
5408
- text: Q.text,
5159
+ range: X.range,
5160
+ query: X.query,
5161
+ text: X.text,
5409
5162
  items: [],
5410
- command: (nt) => l({
5163
+ command: (et) => l({
5411
5164
  editor: t,
5412
- range: Q.range,
5413
- props: nt
5165
+ range: X.range,
5166
+ props: et
5414
5167
  }),
5415
- decorationNode: ee,
5168
+ decorationNode: Jt,
5416
5169
  // virtual node for popper.js or tippy.js
5417
5170
  // this can be used for building popups without a DOM node
5418
- clientRect: ee ? () => {
5419
- var nt;
5420
- const { decorationId: Ze } = (nt = this.key) === null || nt === void 0 ? void 0 : nt.getState(t.state), Tt = m.dom.querySelector(`[data-decoration-id="${Ze}"]`);
5421
- return (Tt == null ? void 0 : Tt.getBoundingClientRect()) || null;
5171
+ clientRect: Jt ? () => {
5172
+ var et;
5173
+ const { decorationId: Fe } = (et = this.key) === null || et === void 0 ? void 0 : et.getState(t.state), kt = g.dom.querySelector(`[data-decoration-id="${Fe}"]`);
5174
+ return (kt == null ? void 0 : kt.getBoundingClientRect()) || null;
5422
5175
  } : null
5423
- }, q && ((b = f == null ? void 0 : f.onBeforeStart) === null || b === void 0 || b.call(f, p)), z && ((E = f == null ? void 0 : f.onBeforeUpdate) === null || E === void 0 || E.call(f, p)), (z || q) && (p.items = await c({
5176
+ }, K && ((S = f == null ? void 0 : f.onBeforeStart) === null || S === void 0 || S.call(f, h)), F && ((w = f == null ? void 0 : f.onBeforeUpdate) === null || w === void 0 || w.call(f, h)), (F || K) && (h.items = await c({
5424
5177
  editor: t,
5425
- query: Q.query
5426
- })), G && ((M = f == null ? void 0 : f.onExit) === null || M === void 0 || M.call(f, p)), z && ((T = f == null ? void 0 : f.onUpdate) === null || T === void 0 || T.call(f, p)), q && ((A = f == null ? void 0 : f.onStart) === null || A === void 0 || A.call(f, p));
5178
+ query: X.query
5179
+ })), U && ((M = f == null ? void 0 : f.onExit) === null || M === void 0 || M.call(f, h)), F && ((C = f == null ? void 0 : f.onUpdate) === null || C === void 0 || C.call(f, h)), K && ((A = f == null ? void 0 : f.onStart) === null || A === void 0 || A.call(f, h));
5427
5180
  },
5428
5181
  destroy: () => {
5429
- var m;
5430
- p && ((m = f == null ? void 0 : f.onExit) === null || m === void 0 || m.call(f, p));
5182
+ var g;
5183
+ h && ((g = f == null ? void 0 : f.onExit) === null || g === void 0 || g.call(f, h));
5431
5184
  }
5432
5185
  };
5433
5186
  },
@@ -5446,51 +5199,51 @@ function Ji({ pluginKey: e = Zo, editor: t, char: n = "@", allowSpaces: r = !1,
5446
5199
  };
5447
5200
  },
5448
5201
  // Apply changes to the plugin state from a view transaction.
5449
- apply(m, y, k, v) {
5450
- const { isEditable: b } = t, { composing: E } = t.view, { selection: M } = m, { empty: T, from: A } = M, w = { ...y };
5451
- if (w.composing = E, b && (T || t.view.composing)) {
5452
- (A < y.range.from || A > y.range.to) && !E && !y.composing && (w.active = !1);
5453
- const O = h({
5202
+ apply(g, m, k, b) {
5203
+ const { isEditable: S } = t, { composing: w } = t.view, { selection: M } = g, { empty: C, from: A } = M, E = { ...m };
5204
+ if (E.composing = w, S && (C || t.view.composing)) {
5205
+ (A < m.range.from || A > m.range.to) && !w && !m.composing && (E.active = !1);
5206
+ const _ = p({
5454
5207
  char: n,
5455
5208
  allowSpaces: r,
5456
5209
  allowedPrefixes: s,
5457
5210
  startOfLine: o,
5458
5211
  $position: M.$from
5459
- }), B = `id_${Math.floor(Math.random() * 4294967295)}`;
5460
- O && d({
5212
+ }), D = `id_${Math.floor(Math.random() * 4294967295)}`;
5213
+ _ && d({
5461
5214
  editor: t,
5462
- state: v,
5463
- range: O.range,
5464
- isActive: y.active
5465
- }) ? (w.active = !0, w.decorationId = y.decorationId ? y.decorationId : B, w.range = O.range, w.query = O.query, w.text = O.text) : w.active = !1;
5215
+ state: b,
5216
+ range: _.range,
5217
+ isActive: m.active
5218
+ }) ? (E.active = !0, E.decorationId = m.decorationId ? m.decorationId : D, E.range = _.range, E.query = _.query, E.text = _.text) : E.active = !1;
5466
5219
  } else
5467
- w.active = !1;
5468
- return w.active || (w.decorationId = null, w.range = { from: 0, to: 0 }, w.query = null, w.text = null), w;
5220
+ E.active = !1;
5221
+ return E.active || (E.decorationId = null, E.range = { from: 0, to: 0 }, E.query = null, E.text = null), E;
5469
5222
  }
5470
5223
  },
5471
5224
  props: {
5472
5225
  // Call the keydown hook if suggestion is active.
5473
- handleKeyDown(m, y) {
5226
+ handleKeyDown(g, m) {
5474
5227
  var k;
5475
- const { active: v, range: b } = g.getState(m.state);
5476
- return v && ((k = f == null ? void 0 : f.onKeyDown) === null || k === void 0 ? void 0 : k.call(f, { view: m, event: y, range: b })) || !1;
5228
+ const { active: b, range: S } = y.getState(g.state);
5229
+ return b && ((k = f == null ? void 0 : f.onKeyDown) === null || k === void 0 ? void 0 : k.call(f, { view: g, event: m, range: S })) || !1;
5477
5230
  },
5478
5231
  // Setup decorator on the currently active suggestion.
5479
- decorations(m) {
5480
- const { active: y, range: k, decorationId: v } = g.getState(m);
5481
- return y ? ft.create(m.doc, [
5482
- Vt.inline(k.from, k.to, {
5232
+ decorations(g) {
5233
+ const { active: m, range: k, decorationId: b } = y.getState(g);
5234
+ return m ? ut.create(g.doc, [
5235
+ jt.inline(k.from, k.to, {
5483
5236
  nodeName: i,
5484
5237
  class: a,
5485
- "data-decoration-id": v
5238
+ "data-decoration-id": b
5486
5239
  })
5487
5240
  ]) : null;
5488
5241
  }
5489
5242
  }
5490
5243
  });
5491
- return g;
5244
+ return y;
5492
5245
  }
5493
- const ti = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Yi = L.create({
5246
+ const Ho = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Ai = O.create({
5494
5247
  name: "image",
5495
5248
  addOptions() {
5496
5249
  return {
@@ -5539,8 +5292,8 @@ const ti = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Yi = L.cr
5539
5292
  },
5540
5293
  addInputRules() {
5541
5294
  return [
5542
- Ge({
5543
- find: ti,
5295
+ $e({
5296
+ find: Ho,
5544
5297
  type: this.type,
5545
5298
  getAttributes: (e) => {
5546
5299
  const [, , t, n, r] = e;
@@ -5549,7 +5302,7 @@ const ti = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Yi = L.cr
5549
5302
  })
5550
5303
  ];
5551
5304
  }
5552
- }), Xi = L.create({
5305
+ }), Oi = O.create({
5553
5306
  name: "tableRow",
5554
5307
  addOptions() {
5555
5308
  return {
@@ -5567,14 +5320,14 @@ const ti = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/, Yi = L.cr
5567
5320
  return ["tr", x(this.options.HTMLAttributes, e), 0];
5568
5321
  }
5569
5322
  });
5570
- function Ae(e, t, n, r, s, o) {
5323
+ function be(e, t, n, r, s, o) {
5571
5324
  let i = 0, a = !0, l = t.firstChild;
5572
5325
  const c = e.firstChild;
5573
5326
  for (let u = 0, d = 0; u < c.childCount; u += 1) {
5574
- const { colspan: h, colwidth: p } = c.child(u).attrs;
5575
- for (let f = 0; f < h; f += 1, d += 1) {
5576
- const g = s === d ? o : p && p[f], m = g ? `${g}px` : "";
5577
- i += g || r, g || (a = !1), l ? (l.style.width !== m && (l.style.width = m), l = l.nextSibling) : t.appendChild(document.createElement("col")).style.width = m;
5327
+ const { colspan: p, colwidth: h } = c.child(u).attrs;
5328
+ for (let f = 0; f < p; f += 1, d += 1) {
5329
+ const y = s === d ? o : h && h[f], g = y ? `${y}px` : "";
5330
+ i += y || r, y || (a = !1), l ? (l.style.width !== g && (l.style.width = g), l = l.nextSibling) : t.appendChild(document.createElement("col")).style.width = g;
5578
5331
  }
5579
5332
  }
5580
5333
  for (; l; ) {
@@ -5583,36 +5336,36 @@ function Ae(e, t, n, r, s, o) {
5583
5336
  }
5584
5337
  a ? (n.style.width = `${i}px`, n.style.minWidth = "") : (n.style.width = "", n.style.minWidth = `${i}px`);
5585
5338
  }
5586
- class ei {
5339
+ class Io {
5587
5340
  constructor(t, n) {
5588
- this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), Ae(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
5341
+ this.node = t, this.cellMinWidth = n, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), this.colgroup = this.table.appendChild(document.createElement("colgroup")), be(t, this.colgroup, this.table, n), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
5589
5342
  }
5590
5343
  update(t) {
5591
- return t.type !== this.node.type ? !1 : (this.node = t, Ae(t, this.colgroup, this.table, this.cellMinWidth), !0);
5344
+ return t.type !== this.node.type ? !1 : (this.node = t, be(t, this.colgroup, this.table, this.cellMinWidth), !0);
5592
5345
  }
5593
5346
  ignoreMutation(t) {
5594
5347
  return t.type === "attributes" && (t.target === this.table || this.colgroup.contains(t.target));
5595
5348
  }
5596
5349
  }
5597
- function ni(e, t, n, r) {
5350
+ function Po(e, t, n, r) {
5598
5351
  let s = 0, o = !0;
5599
5352
  const i = [], a = e.firstChild;
5600
5353
  if (!a)
5601
5354
  return {};
5602
- for (let d = 0, h = 0; d < a.childCount; d += 1) {
5603
- const { colspan: p, colwidth: f } = a.child(d).attrs;
5604
- for (let g = 0; g < p; g += 1, h += 1) {
5605
- const m = n === h ? r : f && f[g], y = m ? `${m}px` : "";
5606
- s += m || t, m || (o = !1), i.push(["col", y ? { style: `width: ${y}` } : {}]);
5355
+ for (let d = 0, p = 0; d < a.childCount; d += 1) {
5356
+ const { colspan: h, colwidth: f } = a.child(d).attrs;
5357
+ for (let y = 0; y < h; y += 1, p += 1) {
5358
+ const g = n === p ? r : f && f[y], m = g ? `${g}px` : "";
5359
+ s += g || t, g || (o = !1), i.push(["col", m ? { style: `width: ${m}` } : {}]);
5607
5360
  }
5608
5361
  }
5609
5362
  const l = o ? `${s}px` : "", c = o ? "" : `${s}px`;
5610
5363
  return { colgroup: ["colgroup", {}, ...i], tableWidth: l, tableMinWidth: c };
5611
5364
  }
5612
- function Oe(e, t) {
5365
+ function ve(e, t) {
5613
5366
  return e.createAndFill();
5614
5367
  }
5615
- function ri(e) {
5368
+ function No(e) {
5616
5369
  if (e.cached.tableNodeTypes)
5617
5370
  return e.cached.tableNodeTypes;
5618
5371
  const t = {};
@@ -5621,12 +5374,12 @@ function ri(e) {
5621
5374
  r.spec.tableRole && (t[r.spec.tableRole] = r);
5622
5375
  }), e.cached.tableNodeTypes = t, t;
5623
5376
  }
5624
- function si(e, t, n, r, s) {
5625
- const o = ri(e), i = [], a = [];
5377
+ function $o(e, t, n, r, s) {
5378
+ const o = No(e), i = [], a = [];
5626
5379
  for (let c = 0; c < n; c += 1) {
5627
- const u = Oe(o.cell);
5380
+ const u = ve(o.cell);
5628
5381
  if (u && a.push(u), r) {
5629
- const d = Oe(o.header_cell);
5382
+ const d = ve(o.header_cell);
5630
5383
  d && i.push(d);
5631
5384
  }
5632
5385
  }
@@ -5635,21 +5388,21 @@ function si(e, t, n, r, s) {
5635
5388
  l.push(o.row.createChecked(null, r && c === 0 ? i : a));
5636
5389
  return o.table.createChecked(null, l);
5637
5390
  }
5638
- function oi(e) {
5639
- return e instanceof _e;
5391
+ function Do(e) {
5392
+ return e instanceof we;
5640
5393
  }
5641
- const dt = ({ editor: e }) => {
5394
+ const at = ({ editor: e }) => {
5642
5395
  const { selection: t } = e.state;
5643
- if (!oi(t))
5396
+ if (!Do(t))
5644
5397
  return !1;
5645
5398
  let n = 0;
5646
- const r = Ke(t.ranges[0].$from, (o) => o.type.name === "table");
5399
+ const r = Ie(t.ranges[0].$from, (o) => o.type.name === "table");
5647
5400
  return r == null || r.node.descendants((o) => {
5648
5401
  if (o.type.name === "table")
5649
5402
  return !1;
5650
5403
  ["tableCell", "tableHeader"].includes(o.type.name) && (n += 1);
5651
5404
  }), n === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
5652
- }, Qi = L.create({
5405
+ }, Li = O.create({
5653
5406
  name: "table",
5654
5407
  // @ts-ignore
5655
5408
  addOptions() {
@@ -5659,7 +5412,7 @@ const dt = ({ editor: e }) => {
5659
5412
  handleWidth: 5,
5660
5413
  cellMinWidth: 25,
5661
5414
  // TODO: fix
5662
- View: ei,
5415
+ View: Io,
5663
5416
  lastColumnResizable: !0,
5664
5417
  allowTableNodeSelection: !1
5665
5418
  };
@@ -5672,7 +5425,7 @@ const dt = ({ editor: e }) => {
5672
5425
  return [{ tag: "table" }];
5673
5426
  },
5674
5427
  renderHTML({ node: e, HTMLAttributes: t }) {
5675
- const { colgroup: n, tableWidth: r, tableMinWidth: s } = ni(e, this.options.cellMinWidth);
5428
+ const { colgroup: n, tableWidth: r, tableMinWidth: s } = Po(e, this.options.cellMinWidth);
5676
5429
  return [
5677
5430
  "table",
5678
5431
  x(this.options.HTMLAttributes, t, {
@@ -5685,33 +5438,33 @@ const dt = ({ editor: e }) => {
5685
5438
  addCommands() {
5686
5439
  return {
5687
5440
  insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: n = !0 } = {}) => ({ tr: r, dispatch: s, editor: o }) => {
5688
- const i = si(o.schema, e, t, n);
5441
+ const i = $o(o.schema, e, t, n);
5689
5442
  if (s) {
5690
5443
  const a = r.selection.from + 1;
5691
5444
  r.replaceSelectionWith(i).scrollIntoView().setSelection(N.near(r.doc.resolve(a)));
5692
5445
  }
5693
5446
  return !0;
5694
5447
  },
5695
- addColumnBefore: () => ({ state: e, dispatch: t }) => Kn(e, t),
5696
- addColumnAfter: () => ({ state: e, dispatch: t }) => Un(e, t),
5697
- deleteColumn: () => ({ state: e, dispatch: t }) => qn(e, t),
5698
- addRowBefore: () => ({ state: e, dispatch: t }) => Gn(e, t),
5699
- addRowAfter: () => ({ state: e, dispatch: t }) => Jn(e, t),
5700
- deleteRow: () => ({ state: e, dispatch: t }) => Yn(e, t),
5701
- deleteTable: () => ({ state: e, dispatch: t }) => Xn(e, t),
5702
- mergeCells: () => ({ state: e, dispatch: t }) => se(e, t),
5703
- splitCell: () => ({ state: e, dispatch: t }) => oe(e, t),
5704
- toggleHeaderColumn: () => ({ state: e, dispatch: t }) => ie("column")(e, t),
5705
- toggleHeaderRow: () => ({ state: e, dispatch: t }) => ie("row")(e, t),
5706
- toggleHeaderCell: () => ({ state: e, dispatch: t }) => Qn(e, t),
5707
- mergeOrSplit: () => ({ state: e, dispatch: t }) => se(e, t) ? !0 : oe(e, t),
5708
- setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => Zn(e, t)(n, r),
5709
- goToNextCell: () => ({ state: e, dispatch: t }) => ae(1)(e, t),
5710
- goToPreviousCell: () => ({ state: e, dispatch: t }) => ae(-1)(e, t),
5711
- fixTables: () => ({ state: e, dispatch: t }) => (t && tr(e), !0),
5448
+ addColumnBefore: () => ({ state: e, dispatch: t }) => An(e, t),
5449
+ addColumnAfter: () => ({ state: e, dispatch: t }) => On(e, t),
5450
+ deleteColumn: () => ({ state: e, dispatch: t }) => Ln(e, t),
5451
+ addRowBefore: () => ({ state: e, dispatch: t }) => Rn(e, t),
5452
+ addRowAfter: () => ({ state: e, dispatch: t }) => _n(e, t),
5453
+ deleteRow: () => ({ state: e, dispatch: t }) => Hn(e, t),
5454
+ deleteTable: () => ({ state: e, dispatch: t }) => In(e, t),
5455
+ mergeCells: () => ({ state: e, dispatch: t }) => Qt(e, t),
5456
+ splitCell: () => ({ state: e, dispatch: t }) => Zt(e, t),
5457
+ toggleHeaderColumn: () => ({ state: e, dispatch: t }) => te("column")(e, t),
5458
+ toggleHeaderRow: () => ({ state: e, dispatch: t }) => te("row")(e, t),
5459
+ toggleHeaderCell: () => ({ state: e, dispatch: t }) => Pn(e, t),
5460
+ mergeOrSplit: () => ({ state: e, dispatch: t }) => Qt(e, t) ? !0 : Zt(e, t),
5461
+ setCellAttribute: (e, t) => ({ state: n, dispatch: r }) => Nn(e, t)(n, r),
5462
+ goToNextCell: () => ({ state: e, dispatch: t }) => ee(1)(e, t),
5463
+ goToPreviousCell: () => ({ state: e, dispatch: t }) => ee(-1)(e, t),
5464
+ fixTables: () => ({ state: e, dispatch: t }) => (t && $n(e), !0),
5712
5465
  setCellSelection: (e) => ({ tr: t, dispatch: n }) => {
5713
5466
  if (n) {
5714
- const r = _e.create(t.doc, e.anchorCell, e.headCell);
5467
+ const r = we.create(t.doc, e.anchorCell, e.headCell);
5715
5468
  t.setSelection(r);
5716
5469
  }
5717
5470
  return !0;
@@ -5722,23 +5475,23 @@ const dt = ({ editor: e }) => {
5722
5475
  return {
5723
5476
  Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
5724
5477
  "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
5725
- Backspace: dt,
5726
- "Mod-Backspace": dt,
5727
- Delete: dt,
5728
- "Mod-Delete": dt
5478
+ Backspace: at,
5479
+ "Mod-Backspace": at,
5480
+ Delete: at,
5481
+ "Mod-Delete": at
5729
5482
  };
5730
5483
  },
5731
5484
  addProseMirrorPlugins() {
5732
5485
  return [
5733
5486
  ...this.options.resizable && this.editor.isEditable ? [
5734
- er({
5487
+ Dn({
5735
5488
  handleWidth: this.options.handleWidth,
5736
5489
  cellMinWidth: this.options.cellMinWidth,
5737
5490
  View: this.options.View,
5738
5491
  lastColumnResizable: this.options.lastColumnResizable
5739
5492
  })
5740
5493
  ] : [],
5741
- nr({
5494
+ Bn({
5742
5495
  allowTableNodeSelection: this.options.allowTableNodeSelection
5743
5496
  })
5744
5497
  ];
@@ -5750,10 +5503,10 @@ const dt = ({ editor: e }) => {
5750
5503
  storage: e.storage
5751
5504
  };
5752
5505
  return {
5753
- tableRole: C(S(e, "tableRole", t))
5506
+ tableRole: T(v(e, "tableRole", t))
5754
5507
  };
5755
5508
  }
5756
- }), Zi = L.create({
5509
+ }), Ri = O.create({
5757
5510
  name: "tableCell",
5758
5511
  addOptions() {
5759
5512
  return {
@@ -5788,7 +5541,7 @@ const dt = ({ editor: e }) => {
5788
5541
  renderHTML({ HTMLAttributes: e }) {
5789
5542
  return ["td", x(this.options.HTMLAttributes, e), 0];
5790
5543
  }
5791
- }), ta = L.create({
5544
+ }), _i = O.create({
5792
5545
  name: "tableHeader",
5793
5546
  addOptions() {
5794
5547
  return {
@@ -5825,60 +5578,57 @@ const dt = ({ editor: e }) => {
5825
5578
  }
5826
5579
  });
5827
5580
  export {
5828
- Zi as $,
5829
- zi as A,
5830
- fi as B,
5831
- Si as C,
5832
- yi as D,
5833
- pi as E,
5834
- Ei as F,
5835
- ji as G,
5836
- Ti as H,
5837
- bi as I,
5838
- wi as J,
5839
- qi as K,
5840
- _i as L,
5841
- Gi as M,
5842
- L as N,
5843
- Li as O,
5844
- Vi as P,
5845
- Ji as Q,
5846
- To as R,
5847
- Mi as S,
5848
- Ci as T,
5849
- vi as U,
5850
- mi as V,
5851
- Yi as W,
5852
- gi as X,
5853
- Qi as Y,
5854
- Xi as Z,
5855
- ta as _,
5856
- ks as a,
5857
- Ge as a0,
5858
- ui as b,
5859
- ki as c,
5860
- Lo as d,
5861
- H as e,
5862
- di as f,
5863
- xi as g,
5864
- Ai as h,
5865
- pe as i,
5866
- Oi as j,
5867
- Hi as k,
5868
- Ri as l,
5869
- Pi as m,
5870
- x as n,
5871
- Gt as o,
5872
- Ii as p,
5873
- $i as q,
5874
- Ui as r,
5875
- Yt as s,
5876
- Bi as t,
5877
- hi as u,
5878
- Ki as v,
5879
- Di as w,
5880
- Ni as x,
5881
- Wi as y,
5882
- Fi as z
5581
+ Ei as A,
5582
+ qo as B,
5583
+ Zo as C,
5584
+ Ti as D,
5585
+ Ko as E,
5586
+ ni as F,
5587
+ bi as G,
5588
+ ri as H,
5589
+ Yo as I,
5590
+ Ci as J,
5591
+ xi as K,
5592
+ pi as L,
5593
+ Go as M,
5594
+ O as N,
5595
+ li as O,
5596
+ ki as P,
5597
+ Ai as Q,
5598
+ ao as R,
5599
+ Qo as S,
5600
+ si as T,
5601
+ Xo as U,
5602
+ Jo as V,
5603
+ Li as W,
5604
+ Oi as X,
5605
+ _i as Y,
5606
+ Ri as Z,
5607
+ $e as _,
5608
+ os as a,
5609
+ Vo as b,
5610
+ ti as c,
5611
+ R as d,
5612
+ oi as e,
5613
+ Wo as f,
5614
+ ii as g,
5615
+ ai as h,
5616
+ ie as i,
5617
+ di as j,
5618
+ ci as k,
5619
+ ui as l,
5620
+ x as m,
5621
+ Vt as n,
5622
+ hi as o,
5623
+ fi as p,
5624
+ Ut as q,
5625
+ yi as r,
5626
+ wi as s,
5627
+ gi as t,
5628
+ Uo as u,
5629
+ mi as v,
5630
+ Si as w,
5631
+ vi as x,
5632
+ Mi as y,
5633
+ ei as z
5883
5634
  };
5884
- //# sourceMappingURL=tiptap-oijPpdck.js.map