@burdenoff/microfe-support 2026.819.3 → 2026.819.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/microfe-support.css +1 -1
  2. package/dist/node_modules/@tiptap/core/dist/index.js +3453 -0
  3. package/dist/node_modules/@tiptap/core/dist/index.js.map +1 -0
  4. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +21 -0
  5. package/dist/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js.map +1 -0
  6. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js +76 -0
  7. package/dist/node_modules/@tiptap/extension-blockquote/dist/index.js.map +1 -0
  8. package/dist/node_modules/@tiptap/extension-bold/dist/index.js +74 -0
  9. package/dist/node_modules/@tiptap/extension-bold/dist/index.js.map +1 -0
  10. package/dist/node_modules/@tiptap/extension-code/dist/index.js +68 -0
  11. package/dist/node_modules/@tiptap/extension-code/dist/index.js.map +1 -0
  12. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js +160 -0
  13. package/dist/node_modules/@tiptap/extension-code-block/dist/index.js.map +1 -0
  14. package/dist/node_modules/@tiptap/extension-document/dist/index.js +12 -0
  15. package/dist/node_modules/@tiptap/extension-document/dist/index.js.map +1 -0
  16. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js +51 -0
  17. package/dist/node_modules/@tiptap/extension-hard-break/dist/index.js.map +1 -0
  18. package/dist/node_modules/@tiptap/extension-heading/dist/index.js +68 -0
  19. package/dist/node_modules/@tiptap/extension-heading/dist/index.js.map +1 -0
  20. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +50 -0
  21. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map +1 -0
  22. package/dist/node_modules/@tiptap/extension-italic/dist/index.js +71 -0
  23. package/dist/node_modules/@tiptap/extension-italic/dist/index.js.map +1 -0
  24. package/dist/node_modules/@tiptap/extension-link/dist/index.js +373 -0
  25. package/dist/node_modules/@tiptap/extension-link/dist/index.js.map +1 -0
  26. package/dist/node_modules/@tiptap/extension-list/dist/index.js +964 -0
  27. package/dist/node_modules/@tiptap/extension-list/dist/index.js.map +1 -0
  28. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js +46 -0
  29. package/dist/node_modules/@tiptap/extension-paragraph/dist/index.js.map +1 -0
  30. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js +7 -0
  31. package/dist/node_modules/@tiptap/extension-placeholder/dist/index.js.map +1 -0
  32. package/dist/node_modules/@tiptap/extension-strike/dist/index.js +56 -0
  33. package/dist/node_modules/@tiptap/extension-strike/dist/index.js.map +1 -0
  34. package/dist/node_modules/@tiptap/extension-text/dist/index.js +15 -0
  35. package/dist/node_modules/@tiptap/extension-text/dist/index.js.map +1 -0
  36. package/dist/node_modules/@tiptap/extension-underline/dist/index.js +63 -0
  37. package/dist/node_modules/@tiptap/extension-underline/dist/index.js.map +1 -0
  38. package/dist/node_modules/@tiptap/extensions/dist/index.js +459 -0
  39. package/dist/node_modules/@tiptap/extensions/dist/index.js.map +1 -0
  40. package/dist/node_modules/@tiptap/react/dist/index.js +316 -0
  41. package/dist/node_modules/@tiptap/react/dist/index.js.map +1 -0
  42. package/dist/node_modules/@tiptap/starter-kit/dist/index.js +29 -0
  43. package/dist/node_modules/@tiptap/starter-kit/dist/index.js.map +1 -0
  44. package/dist/node_modules/fast-equals/dist/es/index.js +267 -0
  45. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -0
  46. package/dist/node_modules/linkifyjs/dist/linkify.js +514 -0
  47. package/dist/node_modules/linkifyjs/dist/linkify.js.map +1 -0
  48. package/dist/node_modules/orderedmap/dist/index.js +69 -0
  49. package/dist/node_modules/orderedmap/dist/index.js.map +1 -0
  50. package/dist/node_modules/prosemirror-commands/dist/index.js +335 -0
  51. package/dist/node_modules/prosemirror-commands/dist/index.js.map +1 -0
  52. package/dist/node_modules/prosemirror-dropcursor/dist/index.js +113 -0
  53. package/dist/node_modules/prosemirror-dropcursor/dist/index.js.map +1 -0
  54. package/dist/node_modules/prosemirror-gapcursor/dist/index.js +173 -0
  55. package/dist/node_modules/prosemirror-gapcursor/dist/index.js.map +1 -0
  56. package/dist/node_modules/prosemirror-history/dist/index.js +214 -0
  57. package/dist/node_modules/prosemirror-history/dist/index.js.map +1 -0
  58. package/dist/node_modules/prosemirror-keymap/dist/index.js +52 -0
  59. package/dist/node_modules/prosemirror-keymap/dist/index.js.map +1 -0
  60. package/dist/node_modules/prosemirror-model/dist/index.js +1786 -0
  61. package/dist/node_modules/prosemirror-model/dist/index.js.map +1 -0
  62. package/dist/node_modules/prosemirror-schema-list/dist/index.js +75 -0
  63. package/dist/node_modules/prosemirror-schema-list/dist/index.js.map +1 -0
  64. package/dist/node_modules/prosemirror-state/dist/index.js +527 -0
  65. package/dist/node_modules/prosemirror-state/dist/index.js.map +1 -0
  66. package/dist/node_modules/prosemirror-transform/dist/index.js +1153 -0
  67. package/dist/node_modules/prosemirror-transform/dist/index.js.map +1 -0
  68. package/dist/node_modules/prosemirror-view/dist/index.js +3296 -0
  69. package/dist/node_modules/prosemirror-view/dist/index.js.map +1 -0
  70. package/dist/node_modules/rope-sequence/dist/index.js +85 -0
  71. package/dist/node_modules/rope-sequence/dist/index.js.map +1 -0
  72. package/dist/node_modules/w3c-keyname/index.js +90 -0
  73. package/dist/node_modules/w3c-keyname/index.js.map +1 -0
  74. package/dist/support/components/careers/RichTextEditor.d.ts +16 -0
  75. package/dist/support/components/careers/RichTextEditor.js +87 -0
  76. package/dist/support/components/careers/RichTextEditor.js.map +1 -0
  77. package/dist/support/pages/JobApplicationDetailPage.d.ts +1 -0
  78. package/dist/support/pages/JobApplicationDetailPage.js +338 -336
  79. package/dist/support/pages/JobApplicationDetailPage.js.map +1 -1
  80. package/dist/support/pages/JobPostingDetailPage.js +310 -303
  81. package/dist/support/pages/JobPostingDetailPage.js.map +1 -1
  82. package/package.json +4 -1
@@ -0,0 +1,3453 @@
1
+ import { DOMParser as e, DOMSerializer as t, Fragment as n, Schema as r, Slice as i } from "../../../prosemirror-model/dist/index.js";
2
+ import { RemoveMarkStep as a, ReplaceAroundStep as o, ReplaceStep as s, Transform as c, canJoin as l, canSplit as u, findWrapping as d, joinPoint as f, liftTarget as p } from "../../../prosemirror-transform/dist/index.js";
3
+ import { AllSelection as m, EditorState as h, NodeSelection as g, Plugin as _, PluginKey as v, Selection as y, TextSelection as b } from "../../../prosemirror-state/dist/index.js";
4
+ import { createParagraphNear as x, exitCode as ee, joinBackward as te, joinDown as ne, joinForward as re, joinTextblockBackward as S, joinTextblockForward as ie, joinUp as ae, lift as oe, liftEmptyBlock as se, newlineInCode as ce, selectNodeBackward as le, selectNodeForward as ue, selectParentNode as de, selectTextblockEnd as fe, selectTextblockStart as pe, setBlockType as me, wrapIn as he } from "../../../prosemirror-commands/dist/index.js";
5
+ import { liftListItem as ge, sinkListItem as _e, wrapInList as ve } from "../../../prosemirror-schema-list/dist/index.js";
6
+ import { DecorationSet as C, EditorView as ye } from "../../../prosemirror-view/dist/index.js";
7
+ import { keymap as be } from "../../../prosemirror-keymap/dist/index.js";
8
+ //#region node_modules/@tiptap/core/dist/index.js
9
+ var xe = Object.defineProperty, Se = (e, t) => {
10
+ for (var n in t) xe(e, n, {
11
+ get: t[n],
12
+ enumerable: !0
13
+ });
14
+ };
15
+ function w(e) {
16
+ let { state: t, transaction: n } = e, { selection: r } = n, { doc: i } = n, { storedMarks: a } = n;
17
+ return {
18
+ ...t,
19
+ apply: t.apply.bind(t),
20
+ applyTransaction: t.applyTransaction.bind(t),
21
+ plugins: t.plugins,
22
+ schema: t.schema,
23
+ reconfigure: t.reconfigure.bind(t),
24
+ toJSON: t.toJSON.bind(t),
25
+ get storedMarks() {
26
+ return a;
27
+ },
28
+ get selection() {
29
+ return r;
30
+ },
31
+ get doc() {
32
+ return i;
33
+ },
34
+ get tr() {
35
+ return r = n.selection, i = n.doc, a = n.storedMarks, n;
36
+ }
37
+ };
38
+ }
39
+ var T = class e {
40
+ constructor(e) {
41
+ this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
42
+ }
43
+ get hasCustomState() {
44
+ return !!this.customState;
45
+ }
46
+ get state() {
47
+ return this.customState || this.editor.state;
48
+ }
49
+ get commands() {
50
+ let { rawCommands: e, editor: t, state: n } = this, { view: r } = t, { tr: i } = n, a = this.buildProps(i);
51
+ return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, (...e) => {
52
+ let n = t(...e)(a);
53
+ return !i.getMeta("preventDispatch") && !this.hasCustomState && r.dispatch(i), n;
54
+ }]));
55
+ }
56
+ get chain() {
57
+ return () => this.createChain();
58
+ }
59
+ get can() {
60
+ return () => this.createCan();
61
+ }
62
+ createChain(e, t = !0) {
63
+ let { rawCommands: n, editor: r, state: i } = this, { view: a } = r, o = [], s = !!e, c = e || i.tr, l = () => (!s && t && !c.getMeta("preventDispatch") && !this.hasCustomState && a.dispatch(c), o.every((e) => e === !0)), u = {
64
+ ...Object.fromEntries(Object.entries(n).map(([e, n]) => [e, (...e) => {
65
+ let r = this.buildProps(c, t), i = n(...e)(r);
66
+ return o.push(i), u;
67
+ }])),
68
+ run: l
69
+ };
70
+ return u;
71
+ }
72
+ static createFakeChain() {
73
+ let e = new Proxy({}, { get: (t, n) => {
74
+ if (n !== "then") return n === "run" ? () => !1 : () => e;
75
+ } });
76
+ return e;
77
+ }
78
+ createCan(e) {
79
+ let { rawCommands: t, state: n } = this, r = e || n.tr, i = this.buildProps(r, !1);
80
+ return {
81
+ ...Object.fromEntries(Object.entries(t).map(([e, t]) => [e, (...e) => t(...e)({
82
+ ...i,
83
+ dispatch: void 0
84
+ })])),
85
+ chain: () => this.createChain(r, !1)
86
+ };
87
+ }
88
+ static createFallbackCan() {
89
+ let t = e.createFakeChain();
90
+ return new Proxy({ chain: () => t }, { get: (e, t) => {
91
+ if (t !== "then") return t === "chain" ? e.chain : () => !1;
92
+ } });
93
+ }
94
+ buildProps(e, t = !0) {
95
+ let { rawCommands: n, editor: r, state: i } = this, { view: a } = r, o = {
96
+ tr: e,
97
+ editor: r,
98
+ view: a,
99
+ state: w({
100
+ state: i,
101
+ transaction: e
102
+ }),
103
+ dispatch: t ? () => void 0 : void 0,
104
+ chain: () => this.createChain(e, t),
105
+ can: () => this.createCan(e),
106
+ get commands() {
107
+ return Object.fromEntries(Object.entries(n).map(([e, t]) => [e, (...e) => t(...e)(o)]));
108
+ }
109
+ };
110
+ return o;
111
+ }
112
+ }, Ce = {};
113
+ Se(Ce, {
114
+ blur: () => we,
115
+ clearContent: () => Te,
116
+ clearNodes: () => Ee,
117
+ command: () => De,
118
+ createParagraphNear: () => Oe,
119
+ cut: () => ke,
120
+ deleteCurrentNode: () => Ae,
121
+ deleteNode: () => je,
122
+ deleteRange: () => Me,
123
+ deleteSelection: () => Ie,
124
+ enter: () => Le,
125
+ exitCode: () => Re,
126
+ extendMarkRange: () => Ve,
127
+ first: () => He,
128
+ focus: () => Ke,
129
+ forEach: () => qe,
130
+ insertContent: () => Je,
131
+ insertContentAt: () => $e,
132
+ insertDefaultBlock: () => tt,
133
+ joinBackward: () => it,
134
+ joinDown: () => rt,
135
+ joinForward: () => at,
136
+ joinItemBackward: () => ot,
137
+ joinItemForward: () => st,
138
+ joinTextblockBackward: () => ct,
139
+ joinTextblockForward: () => lt,
140
+ joinUp: () => nt,
141
+ keyboardShortcut: () => ft,
142
+ lift: () => pt,
143
+ liftEmptyBlock: () => mt,
144
+ liftListItem: () => ht,
145
+ newlineInCode: () => gt,
146
+ resetAttributes: () => vt,
147
+ scrollIntoView: () => yt,
148
+ selectAll: () => bt,
149
+ selectNodeBackward: () => xt,
150
+ selectNodeForward: () => St,
151
+ selectParentNode: () => Ct,
152
+ selectTextblockEnd: () => wt,
153
+ selectTextblockStart: () => Tt,
154
+ setContent: () => Et,
155
+ setMark: () => gn,
156
+ setMeta: () => _n,
157
+ setNode: () => vn,
158
+ setNodeSelection: () => yn,
159
+ setTextDirection: () => bn,
160
+ setTextSelection: () => xn,
161
+ sinkListItem: () => Sn,
162
+ splitBlock: () => wn,
163
+ splitListItem: () => Tn,
164
+ toggleList: () => jn,
165
+ toggleMark: () => Mn,
166
+ toggleNode: () => Nn,
167
+ toggleWrap: () => Pn,
168
+ undoInputRule: () => Fn,
169
+ unsetAllMarks: () => In,
170
+ unsetMark: () => Ln,
171
+ unsetTextDirection: () => Rn,
172
+ updateAttributes: () => zn,
173
+ updateDecorations: () => Bn,
174
+ wrapIn: () => Vn,
175
+ wrapInList: () => Hn
176
+ });
177
+ var we = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
178
+ var n;
179
+ e.isDestroyed || (t.dom.blur(), (n = window == null ? void 0 : window.getSelection()) == null || n.removeAllRanges());
180
+ }), !0), Te = (e = !0) => ({ commands: t }) => t.setContent("", { emitUpdate: e }), Ee = () => ({ state: e, tr: t, dispatch: n }) => {
181
+ let { selection: r } = t, { ranges: i } = r;
182
+ return n && i.forEach(({ $from: n, $to: r }) => {
183
+ e.doc.nodesBetween(n.pos, r.pos, (e, n) => {
184
+ if (e.type.isText) return;
185
+ let { doc: r, mapping: i } = t, a = r.resolve(i.map(n)), o = r.resolve(i.map(n + e.nodeSize)), s = a.blockRange(o);
186
+ if (!s) return;
187
+ let c = p(s);
188
+ if (e.type.isTextblock) {
189
+ let { defaultType: e } = a.parent.contentMatchAt(a.index());
190
+ t.setNodeMarkup(s.start, e);
191
+ }
192
+ (c || c === 0) && t.lift(s, c);
193
+ });
194
+ }), !0;
195
+ }, De = (e) => (t) => e(t), Oe = () => ({ state: e, dispatch: t }) => x(e, t), ke = (e, t) => ({ editor: n, tr: r }) => {
196
+ let { state: i } = n, a = i.doc.slice(e.from, e.to);
197
+ r.deleteRange(e.from, e.to);
198
+ let o = r.mapping.map(t);
199
+ return r.insert(o, a.content), r.setSelection(new b(r.doc.resolve(Math.max(o - 1, 0)))), !0;
200
+ }, Ae = () => ({ tr: e, dispatch: t }) => {
201
+ let { selection: n } = e, r = n.$anchor.node();
202
+ if (r.content.size > 0) return !1;
203
+ let i = e.selection.$anchor;
204
+ for (let n = i.depth; n > 0; --n) if (i.node(n).type === r.type) {
205
+ if (t) {
206
+ let t = i.before(n), r = i.after(n);
207
+ e.delete(t, r).scrollIntoView();
208
+ }
209
+ return !0;
210
+ }
211
+ return !1;
212
+ };
213
+ function E(e, t) {
214
+ if (typeof e == "string") {
215
+ if (!t.nodes[e]) throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);
216
+ return t.nodes[e];
217
+ }
218
+ return e;
219
+ }
220
+ var je = (e) => ({ tr: t, state: n, dispatch: r }) => {
221
+ let i = E(e, n.schema), a = t.selection.$anchor;
222
+ for (let e = a.depth; e > 0; --e) if (a.node(e).type === i) {
223
+ if (r) {
224
+ let n = a.before(e), r = a.after(e);
225
+ t.delete(n, r).scrollIntoView();
226
+ }
227
+ return !0;
228
+ }
229
+ return !1;
230
+ }, Me = (e) => ({ tr: t, dispatch: n }) => {
231
+ let { from: r, to: i } = e;
232
+ return n && t.delete(r, i), !0;
233
+ }, Ne = (e) => e.content ? /^text(\*|\+)/.test(e.content) : !1, Pe = (e, t, n) => {
234
+ if (!e.parent.isInline || n === "left" && e.pos > e.start() || n === "right" && e.pos < e.end()) return e.pos;
235
+ let r = t.nodes[e.parent.type.name].spec;
236
+ return Ne(r) ? n === "left" ? e.start() - 1 : e.end() + 1 : e.pos;
237
+ }, Fe = (e, t, n) => ({
238
+ from: Pe(e, n, "left"),
239
+ to: Pe(t, n, "right")
240
+ }), Ie = () => ({ state: e, dispatch: t }) => {
241
+ if (e.selection.empty) return !1;
242
+ if (t) {
243
+ let n = e.tr, { ranges: r } = e.selection, i = n.steps.length;
244
+ r.forEach((t) => {
245
+ let r = n.mapping.slice(i), { from: a, to: o } = Fe(n.doc.resolve(r.map(t.$from.pos)), n.doc.resolve(r.map(t.$to.pos)), e.schema);
246
+ n.deleteRange(a, o);
247
+ }), n.selection.empty || n.setSelection(b.near(n.doc.resolve(n.selection.from))), n.scrollIntoView(), t(n);
248
+ }
249
+ return !0;
250
+ }, Le = () => ({ commands: e }) => e.keyboardShortcut("Enter"), Re = () => ({ state: e, dispatch: t }) => ee(e, t);
251
+ function D(e) {
252
+ return Object.prototype.toString.call(e) === "[object RegExp]";
253
+ }
254
+ function O(e, t, n = { strict: !0 }) {
255
+ let r = Object.keys(t);
256
+ return !r.length || r.every((r) => n.strict ? t[r] === e[r] : D(t[r]) ? t[r].test(e[r]) : t[r] === e[r]);
257
+ }
258
+ function ze(e, t, n = {}) {
259
+ return e.find((e) => e.type === t && O(Object.fromEntries(Object.keys(n).map((t) => [t, e.attrs[t]])), n));
260
+ }
261
+ function Be(e, t, n = {}) {
262
+ return !!ze(e, t, n);
263
+ }
264
+ function k(e, t, n) {
265
+ if (!e || !t) return;
266
+ let r = e.parent.childAfter(e.parentOffset);
267
+ if ((!r.node || !r.node.marks.some((e) => e.type === t)) && (r = e.parent.childBefore(e.parentOffset)), !r.node || !r.node.marks.some((e) => e.type === t)) return;
268
+ if (!n) {
269
+ let e = r.node.marks.find((e) => e.type === t);
270
+ e && (n = e.attrs);
271
+ }
272
+ if (!ze([...r.node.marks], t, n)) return;
273
+ let i = r.index, a = e.start() + r.offset, o = i + 1, s = a + r.node.nodeSize;
274
+ for (; i > 0 && Be([...e.parent.child(i - 1).marks], t, n);) --i, a -= e.parent.child(i).nodeSize;
275
+ for (; o < e.parent.childCount && Be([...e.parent.child(o).marks], t, n);) s += e.parent.child(o).nodeSize, o += 1;
276
+ return {
277
+ from: a,
278
+ to: s
279
+ };
280
+ }
281
+ function A(e, t) {
282
+ if (typeof e == "string") {
283
+ if (!t.marks[e]) throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);
284
+ return t.marks[e];
285
+ }
286
+ return e;
287
+ }
288
+ var Ve = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
289
+ let a = A(e, r.schema), { doc: o, selection: s } = n, { $from: c, from: l, to: u } = s;
290
+ if (i) {
291
+ let e = k(c, a, t);
292
+ if (e && e.from <= l && e.to >= u) {
293
+ let t = b.create(o, e.from, e.to);
294
+ n.setSelection(t);
295
+ }
296
+ }
297
+ return !0;
298
+ }, He = (e) => (t) => {
299
+ let n = typeof e == "function" ? e(t) : e;
300
+ for (let e = 0; e < n.length; e += 1) if (n[e](t)) return !0;
301
+ return !1;
302
+ };
303
+ function Ue(e) {
304
+ return e instanceof b;
305
+ }
306
+ function j(e = 0, t = 0, n = 0) {
307
+ return Math.min(Math.max(e, t), n);
308
+ }
309
+ function M(e, t = null) {
310
+ if (!t) return null;
311
+ let n = y.atStart(e), r = y.atEnd(e);
312
+ if (t === "start" || t === !0) return n;
313
+ if (t === "end") return r;
314
+ let i = n.from, a = r.to;
315
+ return t === "all" ? b.create(e, j(0, i, a), j(e.content.size, i, a)) : b.create(e, j(t, i, a), j(t, i, a));
316
+ }
317
+ function We() {
318
+ return ["Android"].includes(navigator.platform) || /android/i.test(navigator.userAgent);
319
+ }
320
+ function N() {
321
+ return [
322
+ "iPad Simulator",
323
+ "iPhone Simulator",
324
+ "iPod Simulator",
325
+ "iPad",
326
+ "iPhone",
327
+ "iPod"
328
+ ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
329
+ }
330
+ function Ge() {
331
+ return typeof navigator < "u" && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
332
+ }
333
+ var Ke = (e = null, t = {}) => ({ editor: n, view: r, tr: i, dispatch: a }) => {
334
+ t = {
335
+ scrollIntoView: !0,
336
+ ...t
337
+ };
338
+ let o = () => {
339
+ (N() || We()) && r.dom.focus(), Ge() && !N() && !We() && r.dom.focus({ preventScroll: !0 }), requestAnimationFrame(() => {
340
+ n.isDestroyed || (r.focus(), t?.scrollIntoView && n.commands.scrollIntoView());
341
+ });
342
+ };
343
+ try {
344
+ if (r.hasFocus() && e === null || e === !1) return !0;
345
+ } catch {
346
+ return !1;
347
+ }
348
+ if (a && e === null && !Ue(n.state.selection)) return o(), !0;
349
+ let s = M(i.doc, e) || n.state.selection, c = n.state.selection.eq(s);
350
+ return a && (c || i.setSelection(s), c && i.storedMarks && i.setStoredMarks(i.storedMarks), o()), !0;
351
+ }, qe = (e, t) => (n) => e.every((e, r) => t(e, {
352
+ ...n,
353
+ index: r
354
+ })), Je = (e, t) => ({ tr: n, commands: r }) => r.insertContentAt({
355
+ from: n.selection.from,
356
+ to: n.selection.to
357
+ }, e, t), Ye = (e) => {
358
+ let t = e.childNodes;
359
+ for (let n = t.length - 1; n >= 0; --n) {
360
+ let r = t[n];
361
+ r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? e.removeChild(r) : r.nodeType === 1 && Ye(r);
362
+ }
363
+ return e;
364
+ };
365
+ function P(e) {
366
+ if (typeof window > "u") throw Error("[tiptap error]: there is no window object available, so this function cannot be used");
367
+ let t = `<body>${e}</body>`, n = new window.DOMParser().parseFromString(t, "text/html").body;
368
+ return Ye(n);
369
+ }
370
+ function Xe(e) {
371
+ return typeof e?.nodesBetween == "function";
372
+ }
373
+ function F(t, i, a) {
374
+ if (Xe(t)) return t;
375
+ let o = typeof t == "object" && !!t;
376
+ a = {
377
+ slice: !0,
378
+ parseOptions: {},
379
+ ...a
380
+ };
381
+ let s = typeof t == "string";
382
+ if (o) try {
383
+ if (Array.isArray(t) && t.length > 0) return n.fromArray(t.map((e) => i.nodeFromJSON(e)));
384
+ let e = i.nodeFromJSON(t);
385
+ return a.errorOnInvalidContent && e.check(), e;
386
+ } catch (e) {
387
+ if (a.errorOnInvalidContent) throw Error("[tiptap error]: Invalid JSON content", { cause: e });
388
+ return console.warn("[tiptap warn]: Invalid content.", "Passed value:", t, "Error:", e), F("", i, a);
389
+ }
390
+ if (s) {
391
+ if (a.errorOnInvalidContent) {
392
+ let n = !1, o = "", s = new r({
393
+ topNode: i.spec.topNode,
394
+ marks: i.spec.marks,
395
+ nodes: i.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
396
+ content: "inline*",
397
+ group: "block",
398
+ parseDOM: [{
399
+ tag: "*",
400
+ getAttrs: (e) => (n = !0, o = typeof e == "string" ? e : e.outerHTML, null)
401
+ }]
402
+ } })
403
+ });
404
+ if (a.slice ? e.fromSchema(s).parseSlice(P(t), a.parseOptions) : e.fromSchema(s).parse(P(t), a.parseOptions), a.errorOnInvalidContent && n) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${o}`) });
405
+ }
406
+ let n = e.fromSchema(i);
407
+ return a.slice ? n.parseSlice(P(t), a.parseOptions).content : n.parse(P(t), a.parseOptions);
408
+ }
409
+ return F("", i, a);
410
+ }
411
+ function Ze(e) {
412
+ return !("type" in e);
413
+ }
414
+ function Qe(e, t, n) {
415
+ let r = e.steps.length - 1;
416
+ if (r < t) return;
417
+ let i = e.steps[r];
418
+ if (!(i instanceof s || i instanceof o)) return;
419
+ let a = e.mapping.maps[r], c = 0;
420
+ a.forEach((e, t, n, r) => {
421
+ c === 0 && (c = r);
422
+ }), e.setSelection(y.near(e.doc.resolve(c), n));
423
+ }
424
+ var $e = (e, t, r) => ({ tr: i, dispatch: a, editor: o }) => {
425
+ if (a) {
426
+ r = {
427
+ parseOptions: o.options.parseOptions,
428
+ updateSelection: !0,
429
+ applyInputRules: !1,
430
+ applyPasteRules: !1,
431
+ ...r
432
+ };
433
+ let a, s = (e) => {
434
+ o.emit("contentError", {
435
+ editor: o,
436
+ error: e,
437
+ disableCollaboration: () => {
438
+ "collaboration" in o.storage && typeof o.storage.collaboration == "object" && o.storage.collaboration && (o.storage.collaboration.isDisabled = !0);
439
+ }
440
+ });
441
+ }, c = {
442
+ preserveWhitespace: "full",
443
+ ...r.parseOptions
444
+ };
445
+ if (!r.errorOnInvalidContent && !o.options.enableContentCheck && o.options.emitContentError) try {
446
+ F(t, o.schema, {
447
+ parseOptions: c,
448
+ errorOnInvalidContent: !0
449
+ });
450
+ } catch (e) {
451
+ s(e);
452
+ }
453
+ try {
454
+ a = F(t, o.schema, {
455
+ parseOptions: c,
456
+ errorOnInvalidContent: r.errorOnInvalidContent ?? o.options.enableContentCheck
457
+ });
458
+ } catch (e) {
459
+ return s(e), !1;
460
+ }
461
+ let { from: l, to: u } = typeof e == "number" ? {
462
+ from: e,
463
+ to: e
464
+ } : {
465
+ from: e.from,
466
+ to: e.to
467
+ }, d = !0, f = !0, p = Ze(a) ? a.content : [a];
468
+ if (p.forEach((e) => {
469
+ e.check(), d = d ? e.isText && e.marks.length === 0 : !1, f = f ? e.isBlock : !1;
470
+ }), l === u && f) {
471
+ let { parent: e } = i.doc.resolve(l);
472
+ e.isTextblock && !e.type.spec.code && !e.childCount && (--l, u += 1);
473
+ }
474
+ let m;
475
+ if (d) m = Array.isArray(t) ? t.map((e) => e.text || "").join("") : Xe(t) ? p.map((e) => e.text ?? "").join("") : typeof t == "object" && t && t.text ? t.text : t, i.insertText(m, l, u);
476
+ else {
477
+ m = n.from(p);
478
+ let e = i.doc.resolve(l), t = e.node(), r = e.parentOffset === 0, a = t.isText || t.isTextblock, o = t.content.size > 0;
479
+ r && a && o && f && (l = Math.max(0, l - 1)), i.replaceWith(l, u, p);
480
+ }
481
+ r.updateSelection && Qe(i, i.steps.length - 1, -1), r.applyInputRules && i.setMeta("applyInputRules", {
482
+ from: l,
483
+ text: m
484
+ }), r.applyPasteRules && i.setMeta("applyPasteRules", {
485
+ from: l,
486
+ text: m
487
+ });
488
+ }
489
+ return !0;
490
+ };
491
+ function et(e) {
492
+ for (let t = 0; t < e.edgeCount; t += 1) {
493
+ let { type: n } = e.edge(t);
494
+ if (n.isTextblock && !n.hasRequiredAttrs()) return n;
495
+ }
496
+ return null;
497
+ }
498
+ var tt = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
499
+ let { pos: i, attrs: a, content: o, updateSelection: s = !0 } = e, c;
500
+ c = typeof i == "number" ? t.doc.resolve(i) : i || t.selection.$from;
501
+ let l = et(c.parent.contentMatchAt(c.index()));
502
+ if (!l) return !1;
503
+ let u = Object.keys(l.spec.attrs || {}), d = a ? Object.fromEntries(Object.entries(a).filter(([e]) => u.includes(e))) : {}, f;
504
+ if (o) {
505
+ let e = F(o, r.schema);
506
+ f = l.createAndFill(d, e);
507
+ } else f = l.createAndFill(d);
508
+ return f ? (n && (t.insert(c.pos, f), s && Qe(t, t.steps.length - 1, -1)), !0) : !1;
509
+ }, nt = () => ({ state: e, dispatch: t }) => ae(e, t), rt = () => ({ state: e, dispatch: t }) => ne(e, t), it = () => ({ state: e, dispatch: t }) => te(e, t), at = () => ({ state: e, dispatch: t }) => re(e, t), ot = () => ({ state: e, dispatch: t, tr: n }) => {
510
+ try {
511
+ let r = f(e.doc, e.selection.$from.pos, -1);
512
+ return r != null && (n.join(r, 2), t && t(n), !0);
513
+ } catch {
514
+ return !1;
515
+ }
516
+ }, st = () => ({ state: e, dispatch: t, tr: n }) => {
517
+ try {
518
+ let r = f(e.doc, e.selection.$from.pos, 1);
519
+ return r != null && (n.join(r, 2), t && t(n), !0);
520
+ } catch {
521
+ return !1;
522
+ }
523
+ }, ct = () => ({ state: e, dispatch: t }) => S(e, t), lt = () => ({ state: e, dispatch: t }) => ie(e, t);
524
+ function ut() {
525
+ return typeof navigator < "u" && /Mac/.test(navigator.platform);
526
+ }
527
+ function dt(e) {
528
+ let t = e.split(/-(?!$)/), n = t[t.length - 1];
529
+ n === "Space" && (n = " ");
530
+ let r, i, a, o;
531
+ for (let e = 0; e < t.length - 1; e += 1) {
532
+ let n = t[e];
533
+ if (/^(cmd|meta|m)$/i.test(n)) o = !0;
534
+ else if (/^a(lt)?$/i.test(n)) r = !0;
535
+ else if (/^(c|ctrl|control)$/i.test(n)) i = !0;
536
+ else if (/^s(hift)?$/i.test(n)) a = !0;
537
+ else if (/^mod$/i.test(n)) N() || ut() ? o = !0 : i = !0;
538
+ else throw Error(`Unrecognized modifier name: ${n}`);
539
+ }
540
+ return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), o && (n = `Meta-${n}`), a && (n = `Shift-${n}`), n;
541
+ }
542
+ var ft = (e) => ({ editor: t, view: n, tr: r, dispatch: i }) => {
543
+ let a = dt(e).split(/-(?!$)/), o = a.find((e) => ![
544
+ "Alt",
545
+ "Ctrl",
546
+ "Meta",
547
+ "Shift"
548
+ ].includes(e)), s = new KeyboardEvent("keydown", {
549
+ key: o === "Space" ? " " : o,
550
+ altKey: a.includes("Alt"),
551
+ ctrlKey: a.includes("Ctrl"),
552
+ metaKey: a.includes("Meta"),
553
+ shiftKey: a.includes("Shift"),
554
+ bubbles: !0,
555
+ cancelable: !0
556
+ });
557
+ return t.captureTransaction(() => {
558
+ n.someProp("handleKeyDown", (e) => e(n, s));
559
+ })?.steps.forEach((e) => {
560
+ let t = e.map(r.mapping);
561
+ t && i && r.maybeStep(t);
562
+ }), !0;
563
+ };
564
+ function I(e, t, n = {}) {
565
+ let { from: r, to: i, empty: a } = e.selection, o = t ? E(t, e.schema) : null, s = [];
566
+ e.doc.nodesBetween(r, i, (e, t) => {
567
+ if (e.isText) return;
568
+ let n = Math.max(r, t), a = Math.min(i, t + e.nodeSize);
569
+ s.push({
570
+ node: e,
571
+ from: n,
572
+ to: a
573
+ });
574
+ });
575
+ let c = i - r, l = s.filter((e) => !o || o.name === e.node.type.name).filter((e) => O(e.node.attrs, n, { strict: !1 }));
576
+ return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
577
+ }
578
+ var pt = (e, t = {}) => ({ state: n, dispatch: r }) => I(n, E(e, n.schema), t) ? oe(n, r) : !1, mt = () => ({ state: e, dispatch: t }) => se(e, t), ht = (e) => ({ state: t, dispatch: n }) => {
579
+ let r = E(e, t.schema);
580
+ return ge(r)(t, n);
581
+ }, gt = () => ({ state: e, dispatch: t }) => ce(e, t);
582
+ function L(e, t) {
583
+ return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
584
+ }
585
+ function _t(e, t) {
586
+ let n = typeof t == "string" ? [t] : t;
587
+ return Object.keys(e).reduce((t, r) => (n.includes(r) || (t[r] = e[r]), t), {});
588
+ }
589
+ var vt = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
590
+ let a = null, o = null, s = L(typeof e == "string" ? e : e.name, r.schema);
591
+ if (!s) return !1;
592
+ s === "node" && (a = E(e, r.schema)), s === "mark" && (o = A(e, r.schema));
593
+ let c = !1;
594
+ return n.selection.ranges.forEach((e) => {
595
+ r.doc.nodesBetween(e.$from.pos, e.$to.pos, (e, r) => {
596
+ a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0, _t(e.attrs, t))), o && e.marks.length && e.marks.forEach((a) => {
597
+ o === a.type && (c = !0, i && n.addMark(r, r + e.nodeSize, o.create(_t(a.attrs, t))));
598
+ });
599
+ });
600
+ }), c;
601
+ }, yt = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), bt = () => ({ tr: e, dispatch: t }) => {
602
+ if (t) {
603
+ let t = new m(e.doc);
604
+ e.setSelection(t);
605
+ }
606
+ return !0;
607
+ }, xt = () => ({ state: e, dispatch: t }) => le(e, t), St = () => ({ state: e, dispatch: t }) => ue(e, t), Ct = () => ({ state: e, dispatch: t }) => de(e, t), wt = () => ({ state: e, dispatch: t }) => fe(e, t), Tt = () => ({ state: e, dispatch: t }) => pe(e, t);
608
+ function R(e, t, n = {}, r = {}) {
609
+ return F(e, t, {
610
+ slice: !1,
611
+ parseOptions: n,
612
+ errorOnInvalidContent: r.errorOnInvalidContent
613
+ });
614
+ }
615
+ var Et = (e, { errorOnInvalidContent: t, emitUpdate: n = !0, parseOptions: r = {} } = {}) => ({ editor: i, tr: a, dispatch: o, commands: s }) => {
616
+ let { doc: c } = a;
617
+ if (r.preserveWhitespace !== "full") {
618
+ let s = R(e, i.schema, r, { errorOnInvalidContent: t ?? i.options.enableContentCheck });
619
+ if (o) {
620
+ let e = Ze(s) ? s.content : [s];
621
+ a.replaceWith(0, c.content.size, e).setMeta("preventUpdate", !n);
622
+ }
623
+ return !0;
624
+ }
625
+ return o && a.setMeta("preventUpdate", !n), s.insertContentAt({
626
+ from: 0,
627
+ to: c.content.size
628
+ }, e, {
629
+ parseOptions: r,
630
+ errorOnInvalidContent: t ?? i.options.enableContentCheck
631
+ });
632
+ };
633
+ function Dt(e, t) {
634
+ let n = A(t, e.schema), { from: r, to: i, empty: a } = e.selection, o = [];
635
+ a ? (e.storedMarks && o.push(...e.storedMarks), o.push(...e.selection.$head.marks())) : e.doc.nodesBetween(r, i, (e) => {
636
+ o.push(...e.marks);
637
+ });
638
+ let s = o.find((e) => e.type.name === n.name);
639
+ return s ? { ...s.attrs } : {};
640
+ }
641
+ function Ot(e, t) {
642
+ let n = new c(e);
643
+ return t.forEach((e) => {
644
+ e.steps.forEach((e) => {
645
+ n.step(e);
646
+ });
647
+ }), n;
648
+ }
649
+ function kt(e, t, n) {
650
+ let r = [];
651
+ return e.nodesBetween(t.from, t.to, (e, t) => {
652
+ n(e) && r.push({
653
+ node: e,
654
+ pos: t
655
+ });
656
+ }), r;
657
+ }
658
+ function At(e, t) {
659
+ for (let n = e.depth; n > 0; --n) {
660
+ let r = e.node(n);
661
+ if (t(r)) return {
662
+ pos: n > 0 ? e.before(n) : 0,
663
+ start: e.start(n),
664
+ depth: n,
665
+ node: r
666
+ };
667
+ }
668
+ }
669
+ function z(e) {
670
+ return (t) => At(t.$from, e);
671
+ }
672
+ function B(e, t, n) {
673
+ return e.config[t] === void 0 && e.parent ? B(e.parent, t, n) : typeof e.config[t] == "function" ? e.config[t].bind({
674
+ ...n,
675
+ parent: e.parent ? B(e.parent, t, n) : null
676
+ }) : e.config[t];
677
+ }
678
+ function jt(e) {
679
+ return e.map((e) => {
680
+ let t = B(e, "addExtensions", {
681
+ name: e.name,
682
+ options: e.options,
683
+ storage: e.storage
684
+ });
685
+ return t ? [e, ...jt(t())] : e;
686
+ }).flat(10);
687
+ }
688
+ function Mt(e, n) {
689
+ let r = t.fromSchema(n).serializeFragment(e), i = document.implementation.createHTMLDocument().createElement("div");
690
+ return i.appendChild(r), i.innerHTML;
691
+ }
692
+ function Nt(e) {
693
+ return typeof e == "function";
694
+ }
695
+ function V(e, t = void 0, ...n) {
696
+ return Nt(e) ? t ? e.bind(t)(...n) : e(...n) : e;
697
+ }
698
+ function Pt(e = {}) {
699
+ return Object.keys(e).length === 0 && e.constructor === Object;
700
+ }
701
+ function H(e) {
702
+ return {
703
+ baseExtensions: e.filter((e) => e.type === "extension"),
704
+ nodeExtensions: e.filter((e) => e.type === "node"),
705
+ markExtensions: e.filter((e) => e.type === "mark")
706
+ };
707
+ }
708
+ function Ft(e) {
709
+ let t = [], { nodeExtensions: n, markExtensions: r } = H(e), i = [...n, ...r], a = {
710
+ default: null,
711
+ validate: void 0,
712
+ rendered: !0,
713
+ renderHTML: null,
714
+ parseHTML: null,
715
+ keepOnSplit: !0,
716
+ isRequired: !1
717
+ }, o = n.filter((e) => e.name !== "text").map((e) => e.name), s = r.map((e) => e.name), c = [...o, ...s];
718
+ return e.forEach((e) => {
719
+ let n = B(e, "addGlobalAttributes", {
720
+ name: e.name,
721
+ options: e.options,
722
+ storage: e.storage,
723
+ extensions: i
724
+ });
725
+ n && n().forEach((e) => {
726
+ let n;
727
+ n = Array.isArray(e.types) ? e.types : e.types === "*" ? c : e.types === "nodes" ? o : e.types === "marks" ? s : [], n.forEach((n) => {
728
+ Object.entries(e.attributes).forEach(([e, r]) => {
729
+ t.push({
730
+ type: n,
731
+ name: e,
732
+ attribute: {
733
+ ...a,
734
+ ...r
735
+ }
736
+ });
737
+ });
738
+ });
739
+ });
740
+ }), i.forEach((e) => {
741
+ let n = B(e, "addAttributes", {
742
+ name: e.name,
743
+ options: e.options,
744
+ storage: e.storage
745
+ });
746
+ if (!n) return;
747
+ let r = n();
748
+ Object.entries(r).forEach(([n, r]) => {
749
+ let i = {
750
+ ...a,
751
+ ...r
752
+ };
753
+ typeof i?.default == "function" && (i.default = i.default()), i?.isRequired && i?.default === void 0 && delete i.default, t.push({
754
+ type: e.name,
755
+ name: n,
756
+ attribute: i
757
+ });
758
+ });
759
+ }), t;
760
+ }
761
+ function It(e) {
762
+ let t = [], n = "", r = !1, i = !1, a = 0, o = e.length;
763
+ for (let s = 0; s < o; s += 1) {
764
+ let o = e[s];
765
+ if (o === "'" && !i) {
766
+ r = !r, n += o;
767
+ continue;
768
+ }
769
+ if (o === "\"" && !r) {
770
+ i = !i, n += o;
771
+ continue;
772
+ }
773
+ if (!r && !i) {
774
+ if (o === "(") {
775
+ a += 1, n += o;
776
+ continue;
777
+ }
778
+ if (o === ")" && a > 0) {
779
+ --a, n += o;
780
+ continue;
781
+ }
782
+ if (o === ";" && a === 0) {
783
+ t.push(n), n = "";
784
+ continue;
785
+ }
786
+ }
787
+ n += o;
788
+ }
789
+ return n && t.push(n), t;
790
+ }
791
+ function Lt(e) {
792
+ let t = [], n = It(e || ""), r = n.length;
793
+ for (let e = 0; e < r; e += 1) {
794
+ let r = n[e], i = r.indexOf(":");
795
+ if (i === -1) continue;
796
+ let a = r.slice(0, i).trim(), o = r.slice(i + 1).trim();
797
+ a && o && t.push([a, o]);
798
+ }
799
+ return t;
800
+ }
801
+ function Rt(...e) {
802
+ return e.filter((e) => !!e).reduce((e, t) => {
803
+ let n = { ...e };
804
+ return Object.entries(t).forEach(([e, t]) => {
805
+ if (!n[e]) {
806
+ n[e] = t;
807
+ return;
808
+ }
809
+ if (e === "class") {
810
+ let r = t ? String(t).split(" ") : [], i = n[e] ? n[e].split(" ") : [], a = r.filter((e) => !i.includes(e));
811
+ n[e] = [...i, ...a].join(" ");
812
+ } else if (e === "style") {
813
+ let r = new Map([...Lt(n[e]), ...Lt(t)]);
814
+ n[e] = Array.from(r.entries()).map(([e, t]) => `${e}: ${t}`).join("; ");
815
+ } else n[e] = t;
816
+ }), n;
817
+ }, {});
818
+ }
819
+ function U(e, t) {
820
+ return t.filter((t) => t.type === e.type.name).filter((e) => e.attribute.rendered).map((t) => t.attribute.renderHTML ? t.attribute.renderHTML(e.attrs) || {} : { [t.name]: e.attrs[t.name] }).reduce((e, t) => Rt(e, t), {});
821
+ }
822
+ function zt(e) {
823
+ return typeof e == "string" ? e.match(/^[+-]?(?:\d*\.)?\d+$/) ? Number(e) : e === "true" || e !== "false" && e : e;
824
+ }
825
+ function Bt(e, t) {
826
+ return "style" in e ? e : {
827
+ ...e,
828
+ getAttrs: (n) => {
829
+ let r = e.getAttrs ? e.getAttrs(n) : e.attrs;
830
+ if (r === !1) return !1;
831
+ let i = t.reduce((e, t) => {
832
+ let r = t.attribute.parseHTML ? t.attribute.parseHTML(n) : zt(n.getAttribute(t.name));
833
+ return r == null ? e : {
834
+ ...e,
835
+ [t.name]: r
836
+ };
837
+ }, {});
838
+ return {
839
+ ...r,
840
+ ...i
841
+ };
842
+ }
843
+ };
844
+ }
845
+ function Vt(e) {
846
+ return Object.fromEntries(Object.entries(e).filter(([e, t]) => e === "attrs" && Pt(t) ? !1 : t != null));
847
+ }
848
+ function Ht(e) {
849
+ let t = {};
850
+ return !e?.attribute?.isRequired && "default" in (e?.attribute || {}) && (t.default = e.attribute.default), e?.attribute?.validate !== void 0 && (t.validate = e.attribute.validate), [e.name, t];
851
+ }
852
+ function Ut(e, t) {
853
+ let n = Ft(e), { nodeExtensions: i, markExtensions: a } = H(e), o = i.find((e) => B(e, "topNode"))?.name, s = Object.fromEntries(i.map((r) => {
854
+ let i = n.filter((e) => e.type === r.name), a = {
855
+ name: r.name,
856
+ options: r.options,
857
+ storage: r.storage,
858
+ editor: t
859
+ }, o = Vt({
860
+ ...e.reduce((e, t) => {
861
+ let n = B(t, "extendNodeSchema", a);
862
+ return {
863
+ ...e,
864
+ ...n ? n(r) : {}
865
+ };
866
+ }, {}),
867
+ content: V(B(r, "content", a)),
868
+ marks: V(B(r, "marks", a)),
869
+ group: V(B(r, "group", a)),
870
+ inline: V(B(r, "inline", a)),
871
+ atom: V(B(r, "atom", a)),
872
+ selectable: V(B(r, "selectable", a)),
873
+ draggable: V(B(r, "draggable", a)),
874
+ code: V(B(r, "code", a)),
875
+ whitespace: V(B(r, "whitespace", a)),
876
+ linebreakReplacement: V(B(r, "linebreakReplacement", a)),
877
+ defining: V(B(r, "defining", a)),
878
+ isolating: V(B(r, "isolating", a)),
879
+ attrs: Object.fromEntries(i.map(Ht))
880
+ }), s = V(B(r, "parseHTML", a));
881
+ s && (o.parseDOM = s.map((e) => Bt(e, i)));
882
+ let c = B(r, "renderHTML", a);
883
+ c && (o.toDOM = (e) => c({
884
+ node: e,
885
+ HTMLAttributes: U(e, i)
886
+ }));
887
+ let l = B(r, "renderText", a);
888
+ return l && (o.toText = l), [r.name, o];
889
+ })), c = Object.fromEntries(a.map((r) => {
890
+ let i = n.filter((e) => e.type === r.name), a = {
891
+ name: r.name,
892
+ options: r.options,
893
+ storage: r.storage,
894
+ editor: t
895
+ }, o = Vt({
896
+ ...e.reduce((e, t) => {
897
+ let n = B(t, "extendMarkSchema", a);
898
+ return {
899
+ ...e,
900
+ ...n ? n(r) : {}
901
+ };
902
+ }, {}),
903
+ inclusive: V(B(r, "inclusive", a)),
904
+ excludes: V(B(r, "excludes", a)),
905
+ group: V(B(r, "group", a)),
906
+ spanning: V(B(r, "spanning", a)),
907
+ code: V(B(r, "code", a)),
908
+ attrs: Object.fromEntries(i.map(Ht))
909
+ }), s = V(B(r, "parseHTML", a));
910
+ s && (o.parseDOM = s.map((e) => Bt(e, i)));
911
+ let c = B(r, "renderHTML", a);
912
+ return c && (o.toDOM = (e) => c({
913
+ mark: e,
914
+ HTMLAttributes: U(e, i)
915
+ })), [r.name, o];
916
+ }));
917
+ return new r({
918
+ topNode: o,
919
+ nodes: s,
920
+ marks: c
921
+ });
922
+ }
923
+ function Wt(e) {
924
+ let t = e.filter((t, n) => e.indexOf(t) !== n);
925
+ return Array.from(new Set(t));
926
+ }
927
+ function W(e) {
928
+ return e.sort((e, t) => {
929
+ let n = B(e, "priority") || 100, r = B(t, "priority") || 100;
930
+ return n > r ? -1 : +(n < r);
931
+ });
932
+ }
933
+ function Gt(e) {
934
+ let t = W(jt(e)), n = Wt(t.map((e) => e.name));
935
+ return n.length && console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((e) => `'${e}'`).join(", ")}]. This can lead to issues.`), t;
936
+ }
937
+ function Kt(e, t, n) {
938
+ let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
939
+ return e.nodesBetween(r, i, (e, n, c, l) => {
940
+ e.isBlock && n > r && (s += a);
941
+ let u = o?.[e.type.name];
942
+ if (u) return c && (s += u({
943
+ node: e,
944
+ pos: n,
945
+ parent: c,
946
+ index: l,
947
+ range: t
948
+ })), !1;
949
+ e.isText && (s += (e?.text)?.slice(Math.max(r, n) - n, i - n));
950
+ }), s;
951
+ }
952
+ function qt(e, t) {
953
+ return Kt(e, {
954
+ from: 0,
955
+ to: e.content.size
956
+ }, t);
957
+ }
958
+ function Jt(e) {
959
+ return Object.fromEntries(Object.entries(e.nodes).filter(([, e]) => e.spec.toText).map(([e, t]) => [e, t.spec.toText]));
960
+ }
961
+ function Yt(e, t) {
962
+ let n = E(t, e.schema), { from: r, to: i } = e.selection, a = [];
963
+ e.doc.nodesBetween(r, i, (e) => {
964
+ a.push(e);
965
+ });
966
+ let o = a.reverse().find((e) => e.type.name === n.name);
967
+ return o ? { ...o.attrs } : {};
968
+ }
969
+ function Xt(e, t) {
970
+ let n = L(typeof t == "string" ? t : t.name, e.schema);
971
+ return n === "node" ? Yt(e, t) : n === "mark" ? Dt(e, t) : {};
972
+ }
973
+ function Zt(e, t = JSON.stringify) {
974
+ let n = {};
975
+ return e.filter((e) => {
976
+ let r = t(e);
977
+ return Object.prototype.hasOwnProperty.call(n, r) ? !1 : n[r] = !0;
978
+ });
979
+ }
980
+ function Qt(e) {
981
+ let t = Zt(e);
982
+ return t.length === 1 ? t : t.filter((e, n) => !t.filter((e, t) => t !== n).some((t) => e.oldRange.from >= t.oldRange.from && e.oldRange.to <= t.oldRange.to && e.newRange.from >= t.newRange.from && e.newRange.to <= t.newRange.to));
983
+ }
984
+ function $t(e) {
985
+ let { mapping: t, steps: n } = e, r = [];
986
+ return t.maps.forEach((e, i) => {
987
+ let a = [];
988
+ if (e.ranges.length) e.forEach((e, t) => {
989
+ a.push({
990
+ from: e,
991
+ to: t
992
+ });
993
+ });
994
+ else {
995
+ let { from: e, to: t } = n[i];
996
+ if (e === void 0 || t === void 0) return;
997
+ a.push({
998
+ from: e,
999
+ to: t
1000
+ });
1001
+ }
1002
+ a.forEach(({ from: e, to: n }) => {
1003
+ let a = t.slice(i).map(e, -1), o = t.slice(i).map(n), s = t.invert().map(a, -1), c = t.invert().map(o);
1004
+ r.push({
1005
+ oldRange: {
1006
+ from: s,
1007
+ to: c
1008
+ },
1009
+ newRange: {
1010
+ from: a,
1011
+ to: o
1012
+ }
1013
+ });
1014
+ });
1015
+ }), Qt(r);
1016
+ }
1017
+ function en(e, t, n) {
1018
+ let r = [];
1019
+ return e === t ? n.resolve(e).marks().forEach((t) => {
1020
+ let i = k(n.resolve(e), t.type);
1021
+ i && r.push({
1022
+ mark: t,
1023
+ ...i
1024
+ });
1025
+ }) : n.nodesBetween(e, t, (e, t) => {
1026
+ !e || e?.nodeSize === void 0 || r.push(...e.marks.map((n) => ({
1027
+ from: t,
1028
+ to: t + e.nodeSize,
1029
+ mark: n
1030
+ })));
1031
+ }), r;
1032
+ }
1033
+ var tn = (e, t, n, r = 20) => {
1034
+ let i = e.doc.resolve(n), a = r, o = null;
1035
+ for (; a > 0 && o === null;) {
1036
+ let e = i.node(a);
1037
+ e?.type.name === t ? o = e : --a;
1038
+ }
1039
+ return [o, a];
1040
+ }, nn = (e) => {
1041
+ let t = e.depth - 1;
1042
+ if (t < 0) return null;
1043
+ let n = e.index(t);
1044
+ return n === 0 ? null : e.node(t).child(n - 1);
1045
+ };
1046
+ function G(e, t) {
1047
+ return t.nodes[e] || t.marks[e] || null;
1048
+ }
1049
+ function K(e, t, n) {
1050
+ return Object.fromEntries(Object.entries(n).filter(([n]) => {
1051
+ let r = e.find((e) => e.type === t && e.name === n);
1052
+ return r ? r.attribute.keepOnSplit : !1;
1053
+ }));
1054
+ }
1055
+ var rn = (e, t = 500) => {
1056
+ let n = "", r = e.parentOffset;
1057
+ return e.parent.nodesBetween(Math.max(0, r - t), r, (e, t, i, a) => {
1058
+ var o;
1059
+ let s = (o = e.type.spec).toText?.call(o, {
1060
+ node: e,
1061
+ pos: t,
1062
+ parent: i,
1063
+ index: a
1064
+ }) || e.textContent || "%leaf%";
1065
+ n += e.isAtom && !e.isText ? s : s.slice(0, Math.max(0, r - t));
1066
+ }), n;
1067
+ };
1068
+ function an(e, t, n = {}) {
1069
+ let { empty: r, ranges: i } = e.selection, a = t ? A(t, e.schema) : null;
1070
+ if (r) return !!(e.storedMarks || e.selection.$from.marks()).filter((e) => !a || a.name === e.type.name).find((e) => O(e.attrs, n, { strict: !1 }));
1071
+ let o = 0, s = [];
1072
+ if (i.forEach(({ $from: t, $to: n }) => {
1073
+ let r = t.pos, i = n.pos;
1074
+ e.doc.nodesBetween(r, i, (e, t) => {
1075
+ if (a && e.inlineContent && !e.type.allowsMarkType(a)) return !1;
1076
+ if (!e.isText && !e.marks.length) return;
1077
+ let n = Math.max(r, t), c = Math.min(i, t + e.nodeSize), l = c - n;
1078
+ o += l, s.push(...e.marks.map((e) => ({
1079
+ mark: e,
1080
+ from: n,
1081
+ to: c
1082
+ })));
1083
+ });
1084
+ }), o === 0) return !1;
1085
+ let c = s.filter((e) => !a || a.name === e.mark.type.name).filter((e) => O(e.mark.attrs, n, { strict: !1 })).reduce((e, t) => e + t.to - t.from, 0), l = s.filter((e) => !a || e.mark.type !== a && e.mark.type.excludes(a)).reduce((e, t) => e + t.to - t.from, 0);
1086
+ return (c > 0 ? c + l : c) >= o;
1087
+ }
1088
+ function on(e, t, n = {}) {
1089
+ if (!t) return I(e, null, n) || an(e, null, n);
1090
+ let r = L(t, e.schema);
1091
+ return r === "node" ? I(e, t, n) : r === "mark" && an(e, t, n);
1092
+ }
1093
+ var sn = (e, t) => {
1094
+ let { $from: n, $to: r, $anchor: i } = e.selection;
1095
+ if (t) {
1096
+ let n = z((e) => e.type.name === t)(e.selection);
1097
+ if (!n) return !1;
1098
+ let r = e.doc.resolve(n.pos + 1);
1099
+ return i.pos + 1 === r.end();
1100
+ }
1101
+ return !(r.parentOffset < r.parent.nodeSize - 2 || n.pos !== r.pos);
1102
+ }, cn = (e) => {
1103
+ let { $from: t, $to: n } = e.selection;
1104
+ return !(t.parentOffset > 0 || t.pos !== n.pos);
1105
+ };
1106
+ function ln(e, t) {
1107
+ return Array.isArray(t) ? t.some((t) => (typeof t == "string" ? t : t.name) === e.name) : t;
1108
+ }
1109
+ function q(e, t) {
1110
+ let { nodeExtensions: n } = H(t), r = n.find((t) => t.name === e);
1111
+ if (!r) return !1;
1112
+ let i = V(B(r, "group", {
1113
+ name: r.name,
1114
+ options: r.options,
1115
+ storage: r.storage
1116
+ }));
1117
+ return typeof i == "string" && i.split(" ").includes("list");
1118
+ }
1119
+ function un(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
1120
+ if (n) {
1121
+ if (e.type.name === "hardBreak") return !0;
1122
+ if (e.isText) return !/\S/.test(e.text ?? "");
1123
+ }
1124
+ if (e.isText) return !e.text;
1125
+ if (e.isAtom || e.isLeaf) return !1;
1126
+ if (e.content.childCount === 0) return !0;
1127
+ if (t) {
1128
+ let r = !0;
1129
+ return e.content.forEach((e) => {
1130
+ r !== !1 && (un(e, {
1131
+ ignoreWhitespace: n,
1132
+ checkChildren: t
1133
+ }) || (r = !1));
1134
+ }), r;
1135
+ }
1136
+ return !1;
1137
+ }
1138
+ function dn(e) {
1139
+ return e instanceof g;
1140
+ }
1141
+ var fn = class e {
1142
+ constructor(e) {
1143
+ this.position = e;
1144
+ }
1145
+ static fromJSON(t) {
1146
+ return new e(t.position);
1147
+ }
1148
+ toJSON() {
1149
+ return { position: this.position };
1150
+ }
1151
+ };
1152
+ function pn(e, t) {
1153
+ let n = t.mapping.mapResult(e.position);
1154
+ return {
1155
+ position: new fn(n.pos),
1156
+ mapResult: n
1157
+ };
1158
+ }
1159
+ function mn(e) {
1160
+ return new fn(e);
1161
+ }
1162
+ function hn(e, t, n) {
1163
+ let { selection: r } = t, i = null;
1164
+ if (Ue(r) && (i = r.$cursor), i) {
1165
+ let t = e.storedMarks ?? i.marks();
1166
+ return i.parent.type.allowsMarkType(n) && (!!n.isInSet(t) || !t.some((e) => e.type.excludes(n)));
1167
+ }
1168
+ let { ranges: a } = r;
1169
+ return a.some(({ $from: t, $to: r }) => {
1170
+ let i = t.depth === 0 && e.doc.inlineContent && e.doc.type.allowsMarkType(n);
1171
+ return e.doc.nodesBetween(t.pos, r.pos, (e, t, r) => {
1172
+ if (i) return !1;
1173
+ if (e.isInline) {
1174
+ let t = !r || r.type.allowsMarkType(n), a = !!n.isInSet(e.marks) || !e.marks.some((e) => e.type.excludes(n));
1175
+ i = t && a;
1176
+ }
1177
+ return !i;
1178
+ }), i;
1179
+ });
1180
+ }
1181
+ var gn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1182
+ let { selection: a } = n, { empty: o, ranges: s } = a, c = A(e, r.schema);
1183
+ if (i) {
1184
+ if (o) {
1185
+ let e = Dt(r, c);
1186
+ n.addStoredMark(c.create({
1187
+ ...e,
1188
+ ...t
1189
+ }));
1190
+ } else s.forEach((e) => {
1191
+ let i = e.$from.pos, a = e.$to.pos;
1192
+ r.doc.nodesBetween(i, a, (e, r) => {
1193
+ let o = Math.max(r, i), s = Math.min(r + e.nodeSize, a);
1194
+ e.marks.find((e) => e.type === c) ? e.marks.forEach((e) => {
1195
+ c === e.type && n.addMark(o, s, c.create({
1196
+ ...e.attrs,
1197
+ ...t
1198
+ }));
1199
+ }) : n.addMark(o, s, c.create(t));
1200
+ });
1201
+ });
1202
+ }
1203
+ return hn(r, n, c);
1204
+ }, _n = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), vn = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
1205
+ let a = E(e, n.schema), o;
1206
+ return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => me(a, {
1207
+ ...o,
1208
+ ...t
1209
+ })(n) ? !0 : e.clearNodes()).command(({ state: e }) => me(a, {
1210
+ ...o,
1211
+ ...t
1212
+ })(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
1213
+ }, yn = (e) => ({ tr: t, dispatch: n }) => {
1214
+ if (n) {
1215
+ let { doc: n } = t, r = j(e, 0, n.content.size), i = g.create(n, r);
1216
+ t.setSelection(i);
1217
+ }
1218
+ return !0;
1219
+ }, bn = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
1220
+ let { selection: a } = r, o, s;
1221
+ return typeof t == "number" ? (o = t, s = t) : t && "from" in t && "to" in t ? (o = t.from, s = t.to) : (o = a.from, s = a.to), i && n.doc.nodesBetween(o, s, (t, r) => {
1222
+ t.isText || n.setNodeMarkup(r, void 0, {
1223
+ ...t.attrs,
1224
+ dir: e
1225
+ });
1226
+ }), !0;
1227
+ }, xn = (e) => ({ tr: t, dispatch: n }) => {
1228
+ if (n) {
1229
+ let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
1230
+ from: e,
1231
+ to: e
1232
+ } : e, a = b.atStart(n).from, o = b.atEnd(n).to, s = j(r, a, o), c = j(i, a, o), l = b.create(n, s, c);
1233
+ t.setSelection(l);
1234
+ }
1235
+ return !0;
1236
+ }, Sn = (e) => ({ state: t, dispatch: n }) => {
1237
+ let r = E(e, t.schema);
1238
+ return _e(r)(t, n);
1239
+ };
1240
+ function Cn(e, t) {
1241
+ let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
1242
+ if (n) {
1243
+ let r = n.filter((e) => t?.includes(e.type.name));
1244
+ e.tr.ensureMarks(r);
1245
+ }
1246
+ }
1247
+ var wn = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
1248
+ let { selection: a, doc: o } = t, { $from: s, $to: c } = a, l = i.extensionManager.attributes, d = K(l, s.node().type.name, s.node().attrs);
1249
+ if (a instanceof g && a.node.isBlock) return !s.parentOffset || !u(o, s.pos) ? !1 : (r && (e && Cn(n, i.extensionManager.splittableMarks), t.split(s.pos).scrollIntoView()), !0);
1250
+ if (!s.parent.isBlock) return !1;
1251
+ let f = c.parentOffset === c.parent.content.size, p = s.depth === 0 ? void 0 : et(s.node(-1).contentMatchAt(s.indexAfter(-1))), m = f && p ? [{
1252
+ type: p,
1253
+ attrs: d
1254
+ }] : void 0, h = u(t.doc, t.mapping.map(s.pos), 1, m);
1255
+ if (!m && !h && u(t.doc, t.mapping.map(s.pos), 1, p ? [{ type: p }] : void 0) && (h = !0, m = p ? [{
1256
+ type: p,
1257
+ attrs: d
1258
+ }] : void 0), r) {
1259
+ if (h && (a instanceof b && t.deleteSelection(), t.split(t.mapping.map(s.pos), 1, m), p && !f && !s.parentOffset && s.parent.type !== p)) {
1260
+ let e = t.mapping.map(s.before()), n = t.doc.resolve(e);
1261
+ s.node(-1).canReplaceWith(n.index(), n.index() + 1, p) && t.setNodeMarkup(t.mapping.map(s.before()), p);
1262
+ }
1263
+ e && Cn(n, i.extensionManager.splittableMarks), t.scrollIntoView();
1264
+ }
1265
+ return h;
1266
+ }, Tn = (e, t = {}) => ({ tr: r, state: a, dispatch: o, editor: s }) => {
1267
+ let c = E(e, a.schema), { $from: l, $to: d } = a.selection, f = a.selection.node;
1268
+ if (f && f.isBlock || l.depth < 2 || !l.sameParent(d)) return !1;
1269
+ let p = l.node(-1);
1270
+ if (p.type !== c) return !1;
1271
+ let m = s.extensionManager.attributes;
1272
+ if (l.parent.content.size === 0 && l.node(-1).childCount === l.indexAfter(-1)) {
1273
+ if (l.depth === 2 || l.node(-3).type !== c || l.index(-2) !== l.node(-2).childCount - 1) return !1;
1274
+ if (o) {
1275
+ let e = n.empty, a = l.index(-1) ? 1 : l.index(-2) ? 2 : 3;
1276
+ for (let t = l.depth - a; t >= l.depth - 3; --t) e = n.from(l.node(t).copy(e));
1277
+ let o = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, s = {
1278
+ ...K(m, l.node().type.name, l.node().attrs),
1279
+ ...t
1280
+ }, u = c.contentMatch.defaultType?.createAndFill(s) || void 0;
1281
+ e = e.append(n.from(c.createAndFill(null, u) || void 0));
1282
+ let d = l.before(l.depth - (a - 1));
1283
+ r.replace(d, l.after(-o), new i(e, 4 - a, 0));
1284
+ let f = -1;
1285
+ r.doc.nodesBetween(d, r.doc.content.size, (e, t) => {
1286
+ if (f > -1) return !1;
1287
+ e.isTextblock && e.content.size === 0 && (f = t + 1);
1288
+ }), f > -1 && r.setSelection(b.near(r.doc.resolve(f))), r.scrollIntoView();
1289
+ }
1290
+ return !0;
1291
+ }
1292
+ let h = d.pos === l.end() ? p.contentMatchAt(0).defaultType : null, g = {
1293
+ ...K(m, p.type.name, p.attrs),
1294
+ ...t
1295
+ }, _ = {
1296
+ ...K(m, l.node().type.name, l.node().attrs),
1297
+ ...t
1298
+ };
1299
+ r.delete(l.pos, d.pos);
1300
+ let v = h ? [{
1301
+ type: c,
1302
+ attrs: g
1303
+ }, {
1304
+ type: h,
1305
+ attrs: _
1306
+ }] : [{
1307
+ type: c,
1308
+ attrs: g
1309
+ }];
1310
+ if (!u(r.doc, l.pos, 2)) return !1;
1311
+ if (o) {
1312
+ let { selection: e, storedMarks: t } = a, { splittableMarks: n } = s.extensionManager, i = t || e.$to.parentOffset && e.$from.marks();
1313
+ if (r.split(l.pos, 2, v).scrollIntoView(), !i || !o) return !0;
1314
+ let c = i.filter((e) => n.includes(e.type.name));
1315
+ r.ensureMarks(c);
1316
+ }
1317
+ return !0;
1318
+ };
1319
+ function En(e) {
1320
+ return !e || e === "1" ? null : e;
1321
+ }
1322
+ function Dn(e, t) {
1323
+ return En(e) === En(t);
1324
+ }
1325
+ var On = (e, t) => {
1326
+ let n = z((e) => e.type === t)(e.selection);
1327
+ if (!n) return !0;
1328
+ let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
1329
+ if (r === void 0) return !0;
1330
+ let i = e.doc.nodeAt(r);
1331
+ return !(n.node.type === i?.type && l(e.doc, n.pos)) || !Dn(n.node.attrs.type, i?.attrs.type) || e.join(n.pos), !0;
1332
+ }, kn = (e, t) => {
1333
+ let n = z((e) => e.type === t)(e.selection);
1334
+ if (!n) return !0;
1335
+ let r = e.doc.resolve(n.start).after(n.depth);
1336
+ if (r === void 0) return !0;
1337
+ let i = e.doc.nodeAt(r);
1338
+ return !(n.node.type === i?.type && l(e.doc, r)) || !Dn(n.node.attrs.type, i?.attrs.type) || e.join(r), !0;
1339
+ };
1340
+ function An(e) {
1341
+ let t = e.doc, n = t.firstChild;
1342
+ if (!n) return null;
1343
+ let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
1344
+ return b.between(r, i);
1345
+ }
1346
+ var jn = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
1347
+ let { extensions: d, splittableMarks: f } = i.extensionManager, p = E(e, o.schema), m = E(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: v } = h, y = _.blockRange(v), b = g || h.$to.parentOffset && h.$from.marks();
1348
+ if (!y) return !1;
1349
+ let x = z((e) => q(e.type.name, d))(h), ee = h.from === 0 && h.to === o.doc.content.size, te = o.doc.content.content, ne = te.length === 1 ? te[0] : null, re = ee && ne && q(ne.type.name, d) ? {
1350
+ node: ne,
1351
+ pos: 0,
1352
+ depth: 0
1353
+ } : null, S = x ?? re, ie = !!x && y.depth >= 1 && y.depth - x.depth <= 1, ae = !!re;
1354
+ if ((ie || ae) && S) {
1355
+ if (S.node.type === p) return ee && ae ? c().command(({ tr: e, dispatch: t }) => {
1356
+ let n = An(e);
1357
+ return n ? (e.setSelection(n), t && t(e), !0) : !1;
1358
+ }).liftListItem(m).run() : l.liftListItem(m);
1359
+ if (q(S.node.type.name, d) && p.validContent(S.node.content)) return c().command(() => (a.setNodeMarkup(S.pos, p), !0)).command(() => On(a, p)).command(() => kn(a, p)).run();
1360
+ }
1361
+ return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => On(a, p)).command(() => kn(a, p)).run() : c().command(() => {
1362
+ let e = u().wrapInList(p, r), t = b.filter((e) => f.includes(e.type.name));
1363
+ return a.ensureMarks(t), e ? !0 : l.clearNodes();
1364
+ }).wrapInList(p, r).command(() => On(a, p)).command(() => kn(a, p)).run();
1365
+ }, Mn = (e, t = {}, n = {}) => ({ state: r, commands: i }) => {
1366
+ let { extendEmptyMarkRange: a = !1 } = n, o = A(e, r.schema);
1367
+ return an(r, o, t) ? i.unsetMark(o, { extendEmptyMarkRange: a }) : i.setMark(o, t);
1368
+ }, Nn = (e, t, n = {}) => ({ state: r, commands: i }) => {
1369
+ let a = E(e, r.schema), o = E(t, r.schema), s = I(r, a, n), c;
1370
+ return r.selection.$anchor.sameParent(r.selection.$head) && (c = r.selection.$anchor.parent.attrs), s ? i.setNode(o, c) : i.setNode(a, {
1371
+ ...c,
1372
+ ...n
1373
+ });
1374
+ }, Pn = (e, t = {}) => ({ state: n, commands: r }) => {
1375
+ let i = E(e, n.schema);
1376
+ return I(n, i, t) ? r.lift(i) : r.wrapIn(i, t);
1377
+ }, Fn = () => ({ state: e, dispatch: t }) => {
1378
+ let n = e.plugins;
1379
+ for (let r = 0; r < n.length; r += 1) {
1380
+ let i = n[r], a;
1381
+ if (i.spec.isInputRules && (a = i.getState(e))) {
1382
+ if (t) {
1383
+ let t = e.tr, n = a.transform;
1384
+ for (let e = n.steps.length - 1; e >= 0; --e) t.step(n.steps[e].invert(n.docs[e]));
1385
+ if (a.text) {
1386
+ let n = t.doc.resolve(a.from).marks();
1387
+ t.replaceWith(a.from, a.to, e.schema.text(a.text, n));
1388
+ } else t.delete(a.from, a.to);
1389
+ }
1390
+ return !0;
1391
+ }
1392
+ }
1393
+ return !1;
1394
+ }, In = (e = {}) => ({ tr: t, dispatch: n, editor: r }) => {
1395
+ let { ignoreClearable: i = !1 } = e, { selection: a } = t, { empty: o, ranges: s } = a;
1396
+ if (o) return !0;
1397
+ let { nonClearableMarks: c } = r.extensionManager;
1398
+ if (n) {
1399
+ let e = Object.values(r.schema.marks).filter((e) => i || !c.includes(e.name));
1400
+ s.forEach((n) => {
1401
+ for (let r of e) t.removeMark(n.$from.pos, n.$to.pos, r);
1402
+ });
1403
+ }
1404
+ return !0;
1405
+ }, Ln = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1406
+ let { extendEmptyMarkRange: a = !1 } = t, { selection: o } = n, s = A(e, r.schema), { $from: c, empty: l, ranges: u } = o;
1407
+ if (!i) return !0;
1408
+ if (l && a) {
1409
+ let { from: e, to: t } = o, r = k(c, s, c.marks().find((e) => e.type === s)?.attrs);
1410
+ r && (e = r.from, t = r.to), n.removeMark(e, t, s);
1411
+ } else u.forEach((e) => {
1412
+ n.removeMark(e.$from.pos, e.$to.pos, s);
1413
+ });
1414
+ return n.removeStoredMark(s), !0;
1415
+ }, Rn = (e) => ({ tr: t, state: n, dispatch: r }) => {
1416
+ let { selection: i } = n, a, o;
1417
+ return typeof e == "number" ? (a = e, o = e) : e && "from" in e && "to" in e ? (a = e.from, o = e.to) : (a = i.from, o = i.to), r && t.doc.nodesBetween(a, o, (e, n) => {
1418
+ if (e.isText) return;
1419
+ let r = { ...e.attrs };
1420
+ delete r.dir, t.setNodeMarkup(n, void 0, r);
1421
+ }), !0;
1422
+ }, zn = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
1423
+ let a = null, o = null, s = L(typeof e == "string" ? e : e.name, r.schema);
1424
+ if (!s) return !1;
1425
+ s === "node" && (a = E(e, r.schema)), s === "mark" && (o = A(e, r.schema));
1426
+ let c = !1;
1427
+ return n.selection.ranges.forEach((e) => {
1428
+ let s = e.$from.pos, l = e.$to.pos, u, d, f, p;
1429
+ n.selection.empty ? r.doc.nodesBetween(s, l, (e, t) => {
1430
+ a && a === e.type && (c = !0, f = Math.max(t, s), p = Math.min(t + e.nodeSize, l), u = t, d = e);
1431
+ }) : r.doc.nodesBetween(s, l, (e, r) => {
1432
+ r < s && a && a === e.type && (c = !0, f = Math.max(r, s), p = Math.min(r + e.nodeSize, l), u = r, d = e), r >= s && r <= l && (a && a === e.type && (c = !0, i && n.setNodeMarkup(r, void 0, {
1433
+ ...e.attrs,
1434
+ ...t
1435
+ })), o && e.marks.length && e.marks.forEach((a) => {
1436
+ if (o === a.type && (c = !0, i)) {
1437
+ let i = Math.max(r, s), c = Math.min(r + e.nodeSize, l);
1438
+ n.addMark(i, c, o.create({
1439
+ ...a.attrs,
1440
+ ...t
1441
+ }));
1442
+ }
1443
+ }));
1444
+ }), d && (u !== void 0 && i && n.setNodeMarkup(u, void 0, {
1445
+ ...d.attrs,
1446
+ ...t
1447
+ }), o && d.marks.length && d.marks.forEach((e) => {
1448
+ o === e.type && i && n.addMark(f, p, o.create({
1449
+ ...e.attrs,
1450
+ ...t
1451
+ }));
1452
+ }));
1453
+ }), c;
1454
+ }, J = new v("__tiptap_decorations__"), Bn = (e) => ({ tr: t, dispatch: n }) => (n && t.setMeta(J, {
1455
+ type: "force",
1456
+ name: e
1457
+ }), !0), Vn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1458
+ let i = E(e, n.schema);
1459
+ return he(i, t)(n, r);
1460
+ }, Hn = (e, t = {}) => ({ state: n, dispatch: r }) => {
1461
+ let i = E(e, n.schema);
1462
+ return ve(i, t)(n, r);
1463
+ }, Y = /* @__PURE__ */ new WeakMap();
1464
+ function Un(e, t) {
1465
+ Y.set(e, (Y.get(e) ?? 0) + 1);
1466
+ try {
1467
+ return t();
1468
+ } finally {
1469
+ let t = (Y.get(e) ?? 1) - 1;
1470
+ t > 0 ? Y.set(e, t) : Y.delete(e);
1471
+ }
1472
+ }
1473
+ function Wn(e) {
1474
+ return Y.has(e);
1475
+ }
1476
+ var Gn = class {
1477
+ constructor() {
1478
+ this.callbacks = {};
1479
+ }
1480
+ on(e, t) {
1481
+ return this.callbacks[e] || (this.callbacks[e] = []), this.callbacks[e].push(t), this;
1482
+ }
1483
+ emit(e, ...t) {
1484
+ let n = this.callbacks[e];
1485
+ return n && n.forEach((e) => e.apply(this, t)), this;
1486
+ }
1487
+ off(e, t) {
1488
+ let n = this.callbacks[e];
1489
+ return n && (t ? this.callbacks[e] = n.filter((e) => e !== t) : delete this.callbacks[e]), this;
1490
+ }
1491
+ once(e, t) {
1492
+ let n = (...r) => {
1493
+ this.off(e, n), t.apply(this, r);
1494
+ };
1495
+ return this.on(e, n);
1496
+ }
1497
+ removeAllListeners() {
1498
+ this.callbacks = {};
1499
+ }
1500
+ }, Kn = typeof process < "u" && process.env.NODE_ENV !== "production";
1501
+ function qn(e) {
1502
+ return e.kind === "widget";
1503
+ }
1504
+ function Jn(e, t) {
1505
+ let n = [], r = /* @__PURE__ */ new Set();
1506
+ for (let i of e) i.kind === "widget" && qn(i) && r.add(i.key), n.push(i.toPMDecoration(t));
1507
+ return {
1508
+ decorations: n,
1509
+ widgetKeys: r
1510
+ };
1511
+ }
1512
+ function Yn(e, t, n) {
1513
+ let { decorations: r, widgetKeys: i } = Jn(t, n);
1514
+ return {
1515
+ set: C.create(e, r),
1516
+ widgetKeys: i
1517
+ };
1518
+ }
1519
+ function Xn({ position: e, from: t, to: n, docSize: r }) {
1520
+ return e < t ? !1 : e < n || e === n && n === r;
1521
+ }
1522
+ function Zn({ decorations: e, from: t, to: n, docSize: r, extensionName: i, warnedExtensions: a }) {
1523
+ return e.filter((e) => Xn({
1524
+ position: e.anchor,
1525
+ from: t,
1526
+ to: n,
1527
+ docSize: r
1528
+ }) ? !0 : (e.anchor === n || a.has(i) || (a.add(i), console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)), !1));
1529
+ }
1530
+ function Qn(e) {
1531
+ let t = e.spec?.key;
1532
+ return typeof t == "string" ? t : void 0;
1533
+ }
1534
+ function $n(e) {
1535
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1536
+ for (let r of e.find()) {
1537
+ let e = Qn(r);
1538
+ if (!e) continue;
1539
+ let i = r.spec.extensionName ?? "unknown", a = t.get(e) ?? /* @__PURE__ */ new Set();
1540
+ a.add(i), t.set(e, a), n.set(e, (n.get(e) ?? 0) + 1);
1541
+ }
1542
+ return Array.from(t, ([e, t]) => ({
1543
+ key: e,
1544
+ extensions: t
1545
+ })).filter(({ key: e }) => (n.get(e) ?? 0) > 1);
1546
+ }
1547
+ function er(e) {
1548
+ return e.jsonID === "attr";
1549
+ }
1550
+ function tr(e) {
1551
+ let t = !1;
1552
+ if (e.getMap().forEach(() => {
1553
+ t = !0;
1554
+ }), t || er(e)) return !0;
1555
+ let n = e;
1556
+ return typeof n.from == "number" && typeof n.to == "number";
1557
+ }
1558
+ function nr(e, t) {
1559
+ let n = null, r = 0, i = 0;
1560
+ for (let a = 0; a < e.childCount && !(i > t.to); a += 1) {
1561
+ let o = i + e.child(a).nodeSize;
1562
+ o >= t.from && (n === null && (n = i), r = o), i = o;
1563
+ }
1564
+ return n === null ? null : {
1565
+ from: n,
1566
+ to: r
1567
+ };
1568
+ }
1569
+ function rr(e, t) {
1570
+ if (e.steps.some((e) => !tr(e))) return { type: "full" };
1571
+ let n = $t(e).map(({ newRange: e }) => e);
1572
+ e.steps.forEach((t, r) => {
1573
+ if (!er(t)) return;
1574
+ let i = e.mapping.slice(r);
1575
+ n.push({
1576
+ from: i.map(t.pos, -1),
1577
+ to: i.map(t.pos + 1)
1578
+ });
1579
+ });
1580
+ let r = [];
1581
+ for (let e of n) {
1582
+ let n = nr(t, e);
1583
+ n && r.push(n);
1584
+ }
1585
+ r.sort((e, t) => e.from - t.from);
1586
+ let i = [];
1587
+ for (let e of r) {
1588
+ let t = i[i.length - 1];
1589
+ t && e.from <= t.to ? t.to = Math.max(t.to, e.to) : i.push({ ...e });
1590
+ }
1591
+ return {
1592
+ type: "ranges",
1593
+ ranges: i
1594
+ };
1595
+ }
1596
+ function ir(e, t, n, r) {
1597
+ return e.map(t, n, { onRemove: (e) => {
1598
+ let t = e?.key;
1599
+ typeof t == "string" && r.delete(t);
1600
+ } });
1601
+ }
1602
+ function ar(e, t, n) {
1603
+ let r = t.decorationSetsByExtension[e] ?? C.empty, i = new Set(t.widgetKeysByExtension[e] ?? []);
1604
+ return {
1605
+ set: ir(r, n.mapping, n.doc, i),
1606
+ widgetKeys: i
1607
+ };
1608
+ }
1609
+ function or(e, t) {
1610
+ let n = Object.values(t).flatMap((e) => e.find());
1611
+ return C.create(e, n);
1612
+ }
1613
+ function sr(e) {
1614
+ let t = /* @__PURE__ */ new Set();
1615
+ for (let n of Object.values(e)) for (let e of n) t.add(e);
1616
+ return t;
1617
+ }
1618
+ function cr(e, t) {
1619
+ switch (t.update ?? "document") {
1620
+ case "document":
1621
+ if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);
1622
+ return;
1623
+ case "changedRanges":
1624
+ if (!t.createInRange) throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);
1625
+ return;
1626
+ case "manual":
1627
+ if (t.createInRange) throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);
1628
+ if (t.shouldUpdate) throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);
1629
+ return;
1630
+ default: throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`);
1631
+ }
1632
+ }
1633
+ function lr(e, t, n) {
1634
+ return n ? !0 : e.update === "manual" ? !1 : e.shouldUpdate ? e.shouldUpdate(t) : t.tr.docChanged;
1635
+ }
1636
+ var ur = /* @__PURE__ */ new Set(), dr = class {
1637
+ constructor(e) {
1638
+ this.warnedWidgetKeys = /* @__PURE__ */ new Set(), this.warnedOutOfRangeExtensions = /* @__PURE__ */ new Set(), this.handleBeforeTransaction = ({ nextState: e }) => {
1639
+ let t = J.getState(e);
1640
+ t && this.warnDuplicateWidgetKeys(t);
1641
+ }, this.editor = e.editor, this.entries = this.resolveEntries(e.entries), this.entries.forEach(({ name: e, spec: t }) => cr(e, t)), this.plugin = this.entries.length > 0 ? this.createPlugin() : null, this.editor.on("beforeTransaction", this.handleBeforeTransaction);
1642
+ }
1643
+ destroy() {
1644
+ this.editor.off("beforeTransaction", this.handleBeforeTransaction);
1645
+ }
1646
+ liveWidgetKeys() {
1647
+ return J.getState(this.editor.state)?.widgetKeys ?? ur;
1648
+ }
1649
+ get mountedView() {
1650
+ return this.editor.isDestroyed ? null : this.editor.view;
1651
+ }
1652
+ resolveEntries(e) {
1653
+ let t = [];
1654
+ for (let { name: n, addDecorations: r } of e) {
1655
+ let e = r();
1656
+ e && t.push({
1657
+ name: n,
1658
+ spec: e
1659
+ });
1660
+ }
1661
+ return t;
1662
+ }
1663
+ createPlugin() {
1664
+ let { editor: e, entries: t } = this;
1665
+ return new _({
1666
+ key: J,
1667
+ state: {
1668
+ init: (e, n) => {
1669
+ let r = {}, i = {};
1670
+ for (let { name: e, spec: a } of t) {
1671
+ let { set: t, widgetKeys: o } = this.buildFullSet(e, a, n);
1672
+ r[e] = t, i[e] = o;
1673
+ }
1674
+ let a = {
1675
+ decorationSetsByExtension: r,
1676
+ widgetKeysByExtension: i,
1677
+ mergedDecorationSet: this.buildMergedSet(n.doc, r),
1678
+ widgetKeys: sr(i)
1679
+ };
1680
+ return this.warnDuplicateWidgetKeys(a), a;
1681
+ },
1682
+ apply: (n, r, i, a) => {
1683
+ let o = n.getMeta(J), s = o?.type === "force" && !o.name, c = o?.type === "force" ? o.name : void 0, l = {}, u = {}, d = /* @__PURE__ */ new Set();
1684
+ return Un(e, () => {
1685
+ for (let { name: o, spec: f } of t) {
1686
+ let t = s || c === o;
1687
+ if (!lr(f, {
1688
+ editor: e,
1689
+ tr: n,
1690
+ oldState: i,
1691
+ newState: a
1692
+ }, t)) {
1693
+ let e = ar(o, r, n);
1694
+ l[o] = e.set, u[o] = e.widgetKeys;
1695
+ } else if (f.update === "changedRanges" && n.docChanged && !t) {
1696
+ let e = this.applyChangedRangesRecompute(o, f, r, n, a);
1697
+ l[o] = e.set, u[o] = e.widgetKeys, d.add(o);
1698
+ } else {
1699
+ let { set: e, widgetKeys: t } = this.buildFullSet(o, f, a);
1700
+ l[o] = e, u[o] = t, d.add(o);
1701
+ }
1702
+ }
1703
+ }), d.size === 0 && !n.docChanged ? r : {
1704
+ decorationSetsByExtension: l,
1705
+ widgetKeysByExtension: u,
1706
+ mergedDecorationSet: this.mergeAfterApply({
1707
+ entries: t,
1708
+ previous: r,
1709
+ tr: n,
1710
+ decorationSetsByExtension: l,
1711
+ recomputedNames: d
1712
+ }),
1713
+ widgetKeys: sr(u)
1714
+ };
1715
+ }
1716
+ },
1717
+ props: { decorations(e) {
1718
+ return J.getState(e)?.mergedDecorationSet ?? C.empty;
1719
+ } }
1720
+ });
1721
+ }
1722
+ applyChangedRangesRecompute(e, t, n, r, i) {
1723
+ let a = rr(r, i.doc);
1724
+ return a.type === "full" ? this.buildFullSet(e, t, i) : this.rebuildRanges(e, t, n, r, i, a.ranges);
1725
+ }
1726
+ rebuildRanges(e, t, n, r, i, a) {
1727
+ let o = n.decorationSetsByExtension[e] ?? C.empty, s = new Set(n.widgetKeysByExtension[e] ?? []), c = ir(o, r.mapping, r.doc, s), l = i.doc.content.size;
1728
+ for (let { from: n, to: r } of a) {
1729
+ let a = c.find(n, r).filter((e) => Xn({
1730
+ position: e.from,
1731
+ from: n,
1732
+ to: r,
1733
+ docSize: l
1734
+ }));
1735
+ for (let e of a) {
1736
+ let t = Qn(e);
1737
+ t && s.delete(t);
1738
+ }
1739
+ c = c.remove(a);
1740
+ let { decorations: o, widgetKeys: u } = Jn(Zn({
1741
+ decorations: this.runCreate(e, "createInRange", () => t.createInRange({
1742
+ editor: this.editor,
1743
+ state: i,
1744
+ view: this.mountedView,
1745
+ from: n,
1746
+ to: r
1747
+ })),
1748
+ from: n,
1749
+ to: r,
1750
+ docSize: l,
1751
+ extensionName: e,
1752
+ warnedExtensions: this.warnedOutOfRangeExtensions
1753
+ }), e);
1754
+ c = c.add(i.doc, o);
1755
+ for (let e of u) s.add(e);
1756
+ }
1757
+ return {
1758
+ set: c,
1759
+ widgetKeys: s
1760
+ };
1761
+ }
1762
+ buildFullSet(e, t, n) {
1763
+ let r = this.runCreate(e, "create", () => t.create({
1764
+ editor: this.editor,
1765
+ state: n,
1766
+ view: this.mountedView
1767
+ }));
1768
+ return Yn(n.doc, r, e);
1769
+ }
1770
+ runCreate(e, t, n) {
1771
+ try {
1772
+ return n();
1773
+ } catch (n) {
1774
+ return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`, n), [];
1775
+ }
1776
+ }
1777
+ warnDuplicateWidgetKeys(e) {
1778
+ if (!Kn) return;
1779
+ if (e.widgetKeys.size === 0) {
1780
+ this.warnedWidgetKeys.clear();
1781
+ return;
1782
+ }
1783
+ let t = $n(e.mergedDecorationSet), n = new Set(t.map(({ key: e }) => e));
1784
+ for (let { key: e, extensions: n } of t) {
1785
+ if (this.warnedWidgetKeys.has(e)) continue;
1786
+ let t = Array.from(n).map((e) => `"${e}"`).join(", ");
1787
+ console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size === 1 ? "" : "s"} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`);
1788
+ }
1789
+ this.warnedWidgetKeys = n;
1790
+ }
1791
+ buildMergedSet(e, t) {
1792
+ let n = Object.keys(t);
1793
+ return n.length === 1 ? t[n[0]] : or(e, t);
1794
+ }
1795
+ mergeAfterApply({ entries: e, previous: t, tr: n, decorationSetsByExtension: r, recomputedNames: i }) {
1796
+ return e.length === 1 ? r[e[0].name] : i.size === 0 ? t.mergedDecorationSet.map(n.mapping, n.doc) : or(n.doc, r);
1797
+ }
1798
+ };
1799
+ function fr(e, t) {
1800
+ let { selection: n } = e, { $from: r } = n;
1801
+ if (n instanceof g) {
1802
+ let e = r.index();
1803
+ return r.parent.canReplaceWith(e, e + 1, t);
1804
+ }
1805
+ let i = r.depth;
1806
+ for (; i >= 0;) {
1807
+ let e = r.index(i);
1808
+ if (r.node(i).contentMatchAt(e).matchType(t)) return !0;
1809
+ --i;
1810
+ }
1811
+ return !1;
1812
+ }
1813
+ function pr(e, t, n) {
1814
+ let r = document.querySelector(`style[data-tiptap-style${n ? `-${n}` : ""}]`);
1815
+ if (r !== null) return r;
1816
+ let i = document.createElement("style");
1817
+ return t && i.setAttribute("nonce", t), i.setAttribute(`data-tiptap-style${n ? `-${n}` : ""}`, ""), i.innerHTML = e, document.getElementsByTagName("head")[0].appendChild(i), i;
1818
+ }
1819
+ function mr(e) {
1820
+ return typeof e == "number";
1821
+ }
1822
+ function hr(e) {
1823
+ return Object.prototype.toString.call(e).slice(8, -1);
1824
+ }
1825
+ function X(e) {
1826
+ return hr(e) === "Object" && e.constructor === Object && Object.getPrototypeOf(e) === Object.prototype;
1827
+ }
1828
+ var gr = {};
1829
+ Se(gr, {
1830
+ createAtomBlockMarkdownSpec: () => yr,
1831
+ createBlockMarkdownSpec: () => br,
1832
+ createInlineMarkdownSpec: () => Cr,
1833
+ parseAttributes: () => _r,
1834
+ parseIndentedBlocks: () => wr,
1835
+ renderNestedMarkdownContent: () => Tr,
1836
+ serializeAttributes: () => vr
1837
+ });
1838
+ function _r(e) {
1839
+ if (!e?.trim()) return {};
1840
+ let t = {}, n = [], r = e.replace(/["']([^"']*)["']/g, (e) => (n.push(e), `__QUOTED_${n.length - 1}__`)), i = r.match(/(?:^|\s)\.([\w-]+)/g);
1841
+ i && (t.class = i.map((e) => e.trim().slice(1)).join(" "));
1842
+ let a = r.match(/(?:^|\s)#([\w-]+)/);
1843
+ a && (t.id = a[1]), Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([, e, r]) => {
1844
+ let i = parseInt(r.match(/__QUOTED_(\d+)__/)?.[1] || "0", 10), a = n[i];
1845
+ a && (t[e] = a.slice(1, -1));
1846
+ });
1847
+ let o = r.replace(/(?:^|\s)\.([\w-]+)/g, "").replace(/(?:^|\s)#([\w-]+)/g, "").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g, "").trim();
1848
+ return o && o.split(/\s+/).filter(Boolean).forEach((e) => {
1849
+ e.match(/^[a-zA-Z][\w-]*$/) && (t[e] = !0);
1850
+ }), t;
1851
+ }
1852
+ function vr(e) {
1853
+ if (!e || Object.keys(e).length === 0) return "";
1854
+ let t = [];
1855
+ return e.class && String(e.class).split(/\s+/).filter(Boolean).forEach((e) => t.push(`.${e}`)), e.id && t.push(`#${e.id}`), Object.entries(e).forEach(([e, n]) => {
1856
+ e !== "class" && e !== "id" && (n === !0 ? t.push(e) : n !== !1 && n != null && t.push(`${e}="${String(n)}"`));
1857
+ }), t.join(" ");
1858
+ }
1859
+ function yr(e) {
1860
+ let { nodeName: t, name: n, parseAttributes: r = _r, serializeAttributes: i = vr, defaultAttributes: a = {}, requiredAttributes: o = [], allowedAttributes: s } = e, c = n || t, l = (e) => {
1861
+ if (!s) return e;
1862
+ let t = {};
1863
+ return s.forEach((n) => {
1864
+ n in e && (t[n] = e[n]);
1865
+ }), t;
1866
+ };
1867
+ return {
1868
+ parseMarkdown: (e, n) => {
1869
+ let r = {
1870
+ ...a,
1871
+ ...e.attributes
1872
+ };
1873
+ return n.createNode(t, r, []);
1874
+ },
1875
+ markdownTokenizer: {
1876
+ name: t,
1877
+ level: "block",
1878
+ start(e) {
1879
+ let t = RegExp(`^:::${c}(?:\\s|$)`, "m"), n = e.match(t)?.index;
1880
+ return n === void 0 ? -1 : n;
1881
+ },
1882
+ tokenize(e, n, i) {
1883
+ let a = RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`), s = e.match(a);
1884
+ if (!s) return;
1885
+ let l = s[1] || "", u = r(l);
1886
+ if (!o.find((e) => !(e in u))) return {
1887
+ type: t,
1888
+ raw: s[0],
1889
+ attributes: u
1890
+ };
1891
+ }
1892
+ },
1893
+ renderMarkdown: (e) => {
1894
+ let t = l(e.attrs || {}), n = i(t), r = n ? ` {${n}}` : "";
1895
+ return `:::${c}${r} :::`;
1896
+ }
1897
+ };
1898
+ }
1899
+ function br(e) {
1900
+ let { nodeName: t, name: n, getContent: r, parseAttributes: i = _r, serializeAttributes: a = vr, defaultAttributes: o = {}, content: s = "block", allowedAttributes: c } = e, l = n || t, u = (e) => {
1901
+ if (!c) return e;
1902
+ let t = {};
1903
+ return c.forEach((n) => {
1904
+ n in e && (t[n] = e[n]);
1905
+ }), t;
1906
+ };
1907
+ return {
1908
+ parseMarkdown: (e, n) => {
1909
+ let i;
1910
+ if (r) {
1911
+ let t = r(e);
1912
+ i = typeof t == "string" ? [{
1913
+ type: "text",
1914
+ text: t
1915
+ }] : t;
1916
+ } else i = s === "block" ? n.parseChildren(e.tokens || []) : n.parseInline(e.tokens || []);
1917
+ let a = {
1918
+ ...o,
1919
+ ...e.attributes
1920
+ };
1921
+ return n.createNode(t, a, i);
1922
+ },
1923
+ markdownTokenizer: {
1924
+ name: t,
1925
+ level: "block",
1926
+ start(e) {
1927
+ let t = RegExp(`^:::${l}`, "m"), n = e.match(t)?.index;
1928
+ return n === void 0 ? -1 : n;
1929
+ },
1930
+ tokenize(e, n, r) {
1931
+ let a = RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*\\n`), o = e.match(a);
1932
+ if (!o) return;
1933
+ let [c, u = ""] = o, d = i(u), f = 1, p = c.length, m = "", h = /^:::([\w-]*)(\s.*)?/gm, g = e.slice(p);
1934
+ for (h.lastIndex = 0;;) {
1935
+ let n = h.exec(g);
1936
+ if (n === null) break;
1937
+ let i = n.index, a = n[1];
1938
+ if (!n[2]?.endsWith(":::")) {
1939
+ if (a) f += 1;
1940
+ else if (--f, f === 0) {
1941
+ let a = g.slice(0, i);
1942
+ m = a.trim();
1943
+ let o = e.slice(0, p + i + n[0].length), c = [];
1944
+ if (m) {
1945
+ if (s === "block") for (c = r.blockTokens(a), c.forEach((e) => {
1946
+ e.text && (!e.tokens || e.tokens.length === 0) && (e.tokens = r.inlineTokens(e.text));
1947
+ }); c.length > 0;) {
1948
+ let e = c[c.length - 1];
1949
+ if (e.type === "paragraph" && (!e.text || e.text.trim() === "")) c.pop();
1950
+ else break;
1951
+ }
1952
+ else c = r.inlineTokens(m);
1953
+ }
1954
+ return {
1955
+ type: t,
1956
+ raw: o,
1957
+ attributes: d,
1958
+ content: m,
1959
+ tokens: c
1960
+ };
1961
+ }
1962
+ }
1963
+ }
1964
+ }
1965
+ },
1966
+ renderMarkdown: (e, t) => {
1967
+ let n = u(e.attrs || {}), r = a(n), i = r ? ` {${r}}` : "", o = t.renderChildren(e.content || [], "\n\n");
1968
+ return `:::${l}${i}
1969
+
1970
+ ${o}
1971
+
1972
+ :::`;
1973
+ }
1974
+ };
1975
+ }
1976
+ function xr(e) {
1977
+ if (!e.trim()) return {};
1978
+ let t = {}, n = /(\w+)=(?:"([^"]*)"|'([^']*)')/g, r = n.exec(e);
1979
+ for (; r !== null;) {
1980
+ let [, i, a, o] = r;
1981
+ t[i] = a || o, r = n.exec(e);
1982
+ }
1983
+ return t;
1984
+ }
1985
+ function Sr(e) {
1986
+ return Object.entries(e).filter(([, e]) => e != null).map(([e, t]) => `${e}="${t}"`).join(" ");
1987
+ }
1988
+ function Cr(e) {
1989
+ let { nodeName: t, name: n, getContent: r, parseAttributes: i = xr, serializeAttributes: a = Sr, defaultAttributes: o = {}, selfClosing: s = !1, allowedAttributes: c } = e, l = n || t, u = (e) => {
1990
+ if (!c) return e;
1991
+ let t = {};
1992
+ return c.forEach((n) => {
1993
+ let r = typeof n == "string" ? n : n.name, i = typeof n == "string" ? void 0 : n.skipIfDefault;
1994
+ if (r in e) {
1995
+ let n = e[r];
1996
+ if (i !== void 0 && n === i) return;
1997
+ t[r] = n;
1998
+ }
1999
+ }), t;
2000
+ }, d = l.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2001
+ return {
2002
+ parseMarkdown: (e, n) => {
2003
+ let i = {
2004
+ ...o,
2005
+ ...e.attributes
2006
+ };
2007
+ if (s) return n.createNode(t, i);
2008
+ let a = r ? r(e) : e.content || "";
2009
+ return a ? n.createNode(t, i, [n.createTextNode(a)]) : n.createNode(t, i, []);
2010
+ },
2011
+ markdownTokenizer: {
2012
+ name: t,
2013
+ level: "inline",
2014
+ start(e) {
2015
+ let t = RegExp(s ? `\\[${d}\\s*[^\\]]*\\]` : `\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`), n = e.match(t)?.index;
2016
+ return n === void 0 ? -1 : n;
2017
+ },
2018
+ tokenize(e, n, r) {
2019
+ let a = RegExp(s ? `^\\[${d}\\s*([^\\]]*)\\]` : `^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`), o = e.match(a);
2020
+ if (!o) return;
2021
+ let c = "", l = "";
2022
+ if (s) {
2023
+ let [, e] = o;
2024
+ l = e;
2025
+ } else {
2026
+ let [, e, t] = o;
2027
+ l = e, c = t || "";
2028
+ }
2029
+ let u = i(l.trim());
2030
+ return {
2031
+ type: t,
2032
+ raw: o[0],
2033
+ content: c.trim(),
2034
+ attributes: u
2035
+ };
2036
+ }
2037
+ },
2038
+ renderMarkdown: (e) => {
2039
+ let t = "";
2040
+ r ? t = r(e) : e.content && e.content.length > 0 && (t = e.content.filter((e) => e.type === "text").map((e) => e.text).join(""));
2041
+ let n = u(e.attrs || {}), i = a(n), o = i ? ` ${i}` : "";
2042
+ return s ? `[${l}${o}]` : `[${l}${o}]${t}[/${l}]`;
2043
+ }
2044
+ };
2045
+ }
2046
+ function wr(e, t, n) {
2047
+ let r = e.split("\n"), i = [], a = "", o = 0, s = t.baseIndentSize || 2;
2048
+ for (; o < r.length;) {
2049
+ let e = r[o], c = e.match(t.itemPattern);
2050
+ if (!c) {
2051
+ if (i.length > 0) break;
2052
+ if (e.trim() === "") {
2053
+ o += 1, a = `${a}${e}
2054
+ `;
2055
+ continue;
2056
+ }
2057
+ return;
2058
+ }
2059
+ let l = t.extractItemData(c), { indentLevel: u, mainContent: d } = l;
2060
+ a = `${a}${e}
2061
+ `;
2062
+ let f = [d];
2063
+ for (o += 1; o < r.length;) {
2064
+ let e = r[o];
2065
+ if (e.trim() === "") {
2066
+ let t = r.slice(o + 1).findIndex((e) => e.trim() !== "");
2067
+ if (t === -1) break;
2068
+ if ((r[o + 1 + t].match(/^(\s*)/)?.[1]?.length || 0) > u) {
2069
+ f.push(e), a = `${a}${e}
2070
+ `, o += 1;
2071
+ continue;
2072
+ }
2073
+ break;
2074
+ }
2075
+ if ((e.match(/^(\s*)/)?.[1]?.length || 0) > u) f.push(e), a = `${a}${e}
2076
+ `, o += 1;
2077
+ else break;
2078
+ }
2079
+ let p, m = f.slice(1);
2080
+ if (m.length > 0) {
2081
+ let e = m.map((e) => e.slice(u + s)).join("\n");
2082
+ e.trim() && (p = t.customNestedParser ? t.customNestedParser(e) : n.blockTokens(e));
2083
+ }
2084
+ let h = t.createToken(l, p);
2085
+ i.push(h);
2086
+ }
2087
+ if (i.length !== 0) return {
2088
+ items: i,
2089
+ raw: a
2090
+ };
2091
+ }
2092
+ function Tr(e, t, n, r) {
2093
+ if (!e || !Array.isArray(e.content)) return "";
2094
+ let i = typeof n == "function" ? n(r) : n, [a, ...o] = e.content, s = `${i}${t.renderChildren([a])}`;
2095
+ return o && o.length > 0 && o.forEach((e, n) => {
2096
+ let r = t.renderChild?.call(t, e, n + 1) ?? t.renderChildren([e]);
2097
+ if (r != null) {
2098
+ let n = r.split("\n").map((e) => e ? t.indent(e) : t.indent("")).join("\n");
2099
+ s += e.type === "paragraph" ? `
2100
+
2101
+ ${n}` : `
2102
+ ${n}`;
2103
+ }
2104
+ }), s;
2105
+ }
2106
+ function Er(e, t) {
2107
+ let n = { ...e };
2108
+ return X(e) && X(t) && Object.keys(t).forEach((r) => {
2109
+ X(t[r]) && X(e[r]) ? n[r] = Er(e[r], t[r]) : n[r] = t[r];
2110
+ }), n;
2111
+ }
2112
+ function Dr(e, t, n = {}) {
2113
+ let { state: r } = t, { doc: i, tr: a } = r, o = e;
2114
+ i.descendants((t, r) => {
2115
+ let i = a.mapping.map(r), s = a.mapping.map(r) + t.nodeSize, c = null;
2116
+ if (t.marks.forEach((e) => {
2117
+ if (e !== o) return !1;
2118
+ c = e;
2119
+ }), !c) return;
2120
+ let l = !1;
2121
+ if (Object.keys(n).forEach((e) => {
2122
+ n[e] !== c.attrs[e] && (l = !0);
2123
+ }), l) {
2124
+ let t = e.type.create({
2125
+ ...e.attrs,
2126
+ ...n
2127
+ });
2128
+ a.removeMark(i, s, e.type), a.addMark(i, s, t);
2129
+ }
2130
+ }), a.docChanged && t.view.dispatch(a);
2131
+ }
2132
+ var Z = class {
2133
+ constructor(e) {
2134
+ this.find = e.find, this.handler = e.handler, this.undoable = e.undoable ?? !0;
2135
+ }
2136
+ }, Or = (e, t) => {
2137
+ if (D(t)) return t.exec(e);
2138
+ let n = t(e);
2139
+ if (!n) return null;
2140
+ let r = [n.text];
2141
+ 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;
2142
+ };
2143
+ function kr(e) {
2144
+ let { editor: t, from: n, to: r, text: i, rules: a, plugin: o } = e, { view: s } = t;
2145
+ if (s.composing) return !1;
2146
+ let c = s.state.doc.resolve(n);
2147
+ if (c.parent.type.spec.code || (c.nodeBefore || c.nodeAfter)?.marks.find((e) => e.type.spec.code)) return !1;
2148
+ let l = !1, u = rn(c) + i;
2149
+ return a.forEach((e) => {
2150
+ if (l) return;
2151
+ let a = Or(u, e.find);
2152
+ if (!a) return;
2153
+ let d = a[0].length - i.length;
2154
+ if (d > 0) {
2155
+ let e = c.parentOffset - d;
2156
+ if (e < 0 || c.parent.textBetween(e, c.parentOffset) !== a[0].slice(0, d)) return;
2157
+ }
2158
+ let f = s.state.tr, p = w({
2159
+ state: s.state,
2160
+ transaction: f
2161
+ }), m = {
2162
+ from: n - (a[0].length - i.length),
2163
+ to: r
2164
+ }, { commands: h, chain: g, can: _ } = new T({
2165
+ editor: t,
2166
+ state: p
2167
+ });
2168
+ e.handler({
2169
+ state: p,
2170
+ range: m,
2171
+ match: a,
2172
+ commands: h,
2173
+ chain: g,
2174
+ can: _
2175
+ }) === null || !f.steps.length || (e.undoable && f.setMeta(o, {
2176
+ transform: f,
2177
+ from: n,
2178
+ to: r,
2179
+ text: i
2180
+ }), s.dispatch(f), l = !0);
2181
+ }), l;
2182
+ }
2183
+ function Ar(e) {
2184
+ let { editor: t, rules: r } = e, i = new _({
2185
+ state: {
2186
+ init() {
2187
+ return null;
2188
+ },
2189
+ apply(e, a, o) {
2190
+ let s = e.getMeta(i);
2191
+ if (s) return s;
2192
+ let c = e.getMeta("applyInputRules");
2193
+ return c && setTimeout(() => {
2194
+ let { text: e } = c;
2195
+ e = typeof e == "string" ? e : Mt(n.from(e), o.schema);
2196
+ let { from: a } = c, s = a + e.length;
2197
+ kr({
2198
+ editor: t,
2199
+ from: a,
2200
+ to: s,
2201
+ text: e,
2202
+ rules: r,
2203
+ plugin: i
2204
+ });
2205
+ }), e.selectionSet || e.docChanged ? null : a;
2206
+ }
2207
+ },
2208
+ props: {
2209
+ handleTextInput(e, n, a, o) {
2210
+ return kr({
2211
+ editor: t,
2212
+ from: n,
2213
+ to: a,
2214
+ text: o,
2215
+ rules: r,
2216
+ plugin: i
2217
+ });
2218
+ },
2219
+ handleDOMEvents: { compositionend: (e) => (setTimeout(() => {
2220
+ let { $cursor: n } = e.state.selection;
2221
+ n && kr({
2222
+ editor: t,
2223
+ from: n.pos,
2224
+ to: n.pos,
2225
+ text: "",
2226
+ rules: r,
2227
+ plugin: i
2228
+ });
2229
+ }), !1) },
2230
+ handleKeyDown(e, n) {
2231
+ if (n.key !== "Enter") return !1;
2232
+ let { $cursor: a } = e.state.selection;
2233
+ return a ? kr({
2234
+ editor: t,
2235
+ from: a.pos,
2236
+ to: a.pos,
2237
+ text: "\n",
2238
+ rules: r,
2239
+ plugin: i
2240
+ }) : !1;
2241
+ }
2242
+ },
2243
+ isInputRules: !0
2244
+ });
2245
+ return i;
2246
+ }
2247
+ var jr = class {
2248
+ constructor(e = {}) {
2249
+ this.type = "extendable", this.parent = null, this.child = null, this.name = "", this.config = { name: this.name }, this.config = {
2250
+ ...this.config,
2251
+ ...e
2252
+ }, this.name = this.config.name;
2253
+ }
2254
+ get options() {
2255
+ return { ...V(B(this, "addOptions", { name: this.name })) };
2256
+ }
2257
+ get storage() {
2258
+ return { ...V(B(this, "addStorage", {
2259
+ name: this.name,
2260
+ options: this.options
2261
+ })) };
2262
+ }
2263
+ configure(e = {}) {
2264
+ let t = this.extend({
2265
+ ...this.config,
2266
+ addOptions: () => Er(this.options, e)
2267
+ });
2268
+ return t.name = this.name, t.parent = this.parent, this.child = null, t;
2269
+ }
2270
+ extend(e = {}) {
2271
+ let t = new this.constructor({
2272
+ ...this.config,
2273
+ ...e
2274
+ });
2275
+ return t.parent = this, this.child = t, t.name = "name" in e ? e.name : t.parent.name, t;
2276
+ }
2277
+ }, Mr = class e extends jr {
2278
+ constructor() {
2279
+ super(...arguments), this.type = "mark";
2280
+ }
2281
+ static create(t = {}) {
2282
+ let n = typeof t == "function" ? t() : t;
2283
+ return new e(n);
2284
+ }
2285
+ static handleExit({ editor: e, mark: t }) {
2286
+ let { tr: n } = e.state, r = e.state.selection.$from;
2287
+ if (r.pos === r.end()) {
2288
+ let i = r.marks();
2289
+ if (!i.find((e) => e?.type.name === t.name)) return !1;
2290
+ let a = i.find((e) => e?.type.name === t.name);
2291
+ return a && n.removeStoredMark(a), n.insertText(" ", r.pos), e.view.dispatch(n), !0;
2292
+ }
2293
+ return !1;
2294
+ }
2295
+ configure(e) {
2296
+ return super.configure(e);
2297
+ }
2298
+ extend(e) {
2299
+ let t = typeof e == "function" ? e() : e;
2300
+ return super.extend(t);
2301
+ }
2302
+ }, Nr = class {
2303
+ constructor(e) {
2304
+ this.find = e.find, this.handler = e.handler;
2305
+ }
2306
+ }, Pr = (e, t, n) => {
2307
+ if (D(t)) return [...e.matchAll(t)];
2308
+ let r = t(e, n);
2309
+ return r ? r.map((t) => {
2310
+ let n = [t.text];
2311
+ return n.index = t.index, n.input = e, n.data = t.data, t.replaceWith && (t.text.includes(t.replaceWith) || console.warn("[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\"."), n.push(t.replaceWith)), n;
2312
+ }) : [];
2313
+ };
2314
+ function Fr(e) {
2315
+ let { editor: t, state: n, from: r, to: i, rule: a, pasteEvent: o, dropEvent: s } = e, { commands: c, chain: l, can: u } = new T({
2316
+ editor: t,
2317
+ state: n
2318
+ }), d = [];
2319
+ return n.doc.nodesBetween(r, i, (e, t) => {
2320
+ if (e.type?.spec?.code || !(e.isText || e.isTextblock || e.isInline)) return;
2321
+ let f = e.content?.size ?? e.nodeSize ?? 0, p = Math.max(r, t), m = Math.min(i, t + f);
2322
+ p >= m || Pr(e.isText ? e.text || "" : e.textBetween(p - t, m - t, void 0, ""), a.find, o).forEach((e) => {
2323
+ if (e.index === void 0) return;
2324
+ let t = p + e.index + 1, r = t + e[0].length, i = {
2325
+ from: n.tr.mapping.map(t),
2326
+ to: n.tr.mapping.map(r)
2327
+ }, f = a.handler({
2328
+ state: n,
2329
+ range: i,
2330
+ match: e,
2331
+ commands: c,
2332
+ chain: l,
2333
+ can: u,
2334
+ pasteEvent: o,
2335
+ dropEvent: s
2336
+ });
2337
+ d.push(f);
2338
+ });
2339
+ }), d.every((e) => e !== null);
2340
+ }
2341
+ var Ir = null, Lr = (e) => {
2342
+ var t;
2343
+ let n = new ClipboardEvent("paste", { clipboardData: new DataTransfer() });
2344
+ return (t = n.clipboardData) == null || t.setData("text/html", e), n;
2345
+ };
2346
+ function Rr(e) {
2347
+ let { editor: t, rules: r } = e, i = null, a = !1, o = !1, s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, c;
2348
+ try {
2349
+ c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
2350
+ } catch {
2351
+ c = null;
2352
+ }
2353
+ let l = ({ state: e, from: n, to: r, rule: i, pasteEvt: a }) => {
2354
+ let o = e.tr, l = w({
2355
+ state: e,
2356
+ transaction: o
2357
+ });
2358
+ if (!(!Fr({
2359
+ editor: t,
2360
+ state: l,
2361
+ from: Math.max(n - 1, 0),
2362
+ to: r.b - 1,
2363
+ rule: i,
2364
+ pasteEvent: a,
2365
+ dropEvent: c
2366
+ }) || !o.steps.length)) {
2367
+ try {
2368
+ c = typeof DragEvent < "u" ? new DragEvent("drop") : null;
2369
+ } catch {
2370
+ c = null;
2371
+ }
2372
+ return s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, o;
2373
+ }
2374
+ };
2375
+ return r.map((e) => new _({
2376
+ view(e) {
2377
+ let n = (n) => {
2378
+ i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (Ir = t);
2379
+ }, r = () => {
2380
+ Ir &&= null;
2381
+ };
2382
+ return window.addEventListener("dragstart", n), window.addEventListener("dragend", r), { destroy() {
2383
+ window.removeEventListener("dragstart", n), window.removeEventListener("dragend", r);
2384
+ } };
2385
+ },
2386
+ props: { handleDOMEvents: {
2387
+ drop: (e, t) => {
2388
+ if (o = i === e.dom.parentElement, c = t, !o) {
2389
+ let e = Ir;
2390
+ e?.isEditable && setTimeout(() => {
2391
+ let t = e.state.selection;
2392
+ t && e.commands.deleteRange({
2393
+ from: t.from,
2394
+ to: t.to
2395
+ });
2396
+ }, 10);
2397
+ }
2398
+ return !1;
2399
+ },
2400
+ paste: (e, t) => {
2401
+ let n = t.clipboardData?.getData("text/html");
2402
+ return s = t, a = !!n?.includes("data-pm-slice"), !1;
2403
+ }
2404
+ } },
2405
+ appendTransaction: (t, r, i) => {
2406
+ let c = t[0], u = c.getMeta("uiEvent") === "paste" && !a, d = c.getMeta("uiEvent") === "drop" && !o, f = c.getMeta("applyPasteRules"), p = !!f;
2407
+ if (!u && !d && !p) return;
2408
+ if (p) {
2409
+ let { text: t } = f;
2410
+ t = typeof t == "string" ? t : Mt(n.from(t), i.schema);
2411
+ let { from: r } = f, a = r + t.length, o = Lr(t);
2412
+ return l({
2413
+ rule: e,
2414
+ state: i,
2415
+ from: r,
2416
+ to: { b: a },
2417
+ pasteEvt: o
2418
+ });
2419
+ }
2420
+ let m = r.doc.content.findDiffStart(i.doc.content), h = r.doc.content.findDiffEnd(i.doc.content);
2421
+ if (!(!mr(m) || !h || m === h.b)) return l({
2422
+ rule: e,
2423
+ state: i,
2424
+ from: m,
2425
+ to: h,
2426
+ pasteEvt: s
2427
+ });
2428
+ }
2429
+ }));
2430
+ }
2431
+ var Q = class {
2432
+ constructor(e, t) {
2433
+ this.splittableMarks = [], this.nonClearableMarks = [], this.decorationManager = null, this.editor = t, this.baseExtensions = e, this.extensions = Gt(e), this.schema = Ut(this.extensions, t), this.setupExtensions();
2434
+ }
2435
+ get commands() {
2436
+ return this.extensions.reduce((e, t) => {
2437
+ let n = B(t, "addCommands", {
2438
+ name: t.name,
2439
+ options: t.options,
2440
+ storage: this.editor.extensionStorage[t.name],
2441
+ editor: this.editor,
2442
+ type: G(t.name, this.schema)
2443
+ });
2444
+ return n ? {
2445
+ ...e,
2446
+ ...n()
2447
+ } : e;
2448
+ }, {});
2449
+ }
2450
+ get plugins() {
2451
+ let { editor: e } = this, t = W([...this.extensions].reverse()).flatMap((t) => {
2452
+ let n = {
2453
+ name: t.name,
2454
+ options: t.options,
2455
+ storage: this.editor.extensionStorage[t.name],
2456
+ editor: e,
2457
+ type: G(t.name, this.schema)
2458
+ }, r = [], i = B(t, "addKeyboardShortcuts", n), a = {};
2459
+ if (t.type === "mark" && B(t, "exitable", n) && (a.ArrowRight = () => Mr.handleExit({
2460
+ editor: e,
2461
+ mark: t
2462
+ })), i) {
2463
+ let t = Object.fromEntries(Object.entries(i()).map(([t, n]) => [t, () => n({ editor: e })]));
2464
+ a = {
2465
+ ...a,
2466
+ ...t
2467
+ };
2468
+ }
2469
+ let o = be(a);
2470
+ r.push(o);
2471
+ let s = B(t, "addInputRules", n);
2472
+ if (ln(t, e.options.enableInputRules) && s) {
2473
+ let t = s();
2474
+ if (t && t.length) {
2475
+ let n = Ar({
2476
+ editor: e,
2477
+ rules: t
2478
+ }), i = Array.isArray(n) ? n : [n];
2479
+ r.push(...i);
2480
+ }
2481
+ }
2482
+ let c = B(t, "addPasteRules", n);
2483
+ if (ln(t, e.options.enablePasteRules) && c) {
2484
+ let t = c();
2485
+ if (t && t.length) {
2486
+ let n = Rr({
2487
+ editor: e,
2488
+ rules: t
2489
+ });
2490
+ r.push(...n);
2491
+ }
2492
+ }
2493
+ let l = B(t, "addProseMirrorPlugins", n);
2494
+ if (l) {
2495
+ let e = l();
2496
+ r.push(...e);
2497
+ }
2498
+ return r;
2499
+ }), n = this.createDecorationPlugin();
2500
+ return n && t.push(n), t;
2501
+ }
2502
+ createDecorationPlugin() {
2503
+ var e;
2504
+ let { editor: t } = this;
2505
+ (e = this.decorationManager) == null || e.destroy();
2506
+ let n = [];
2507
+ return this.extensions.forEach((e) => {
2508
+ let r = B(e, "addDecorations", {
2509
+ name: e.name,
2510
+ options: e.options,
2511
+ storage: this.editor.extensionStorage[e.name],
2512
+ editor: t,
2513
+ type: G(e.name, this.schema)
2514
+ });
2515
+ r && n.push({
2516
+ name: e.name,
2517
+ addDecorations: r
2518
+ });
2519
+ }), this.decorationManager = new dr({
2520
+ editor: t,
2521
+ entries: n
2522
+ }), this.decorationManager.plugin;
2523
+ }
2524
+ get attributes() {
2525
+ return Ft(this.extensions);
2526
+ }
2527
+ get nodeViews() {
2528
+ let { editor: e } = this, { nodeExtensions: t } = H(this.extensions);
2529
+ return Object.fromEntries(t.filter((e) => !!B(e, "addNodeView")).map((t) => {
2530
+ let n = this.attributes.filter((e) => e.type === t.name), r = B(t, "addNodeView", {
2531
+ name: t.name,
2532
+ options: t.options,
2533
+ storage: this.editor.extensionStorage[t.name],
2534
+ editor: e,
2535
+ type: E(t.name, this.schema)
2536
+ });
2537
+ if (!r) return [];
2538
+ let i = r();
2539
+ return i ? [t.name, (r, a, o, s, c) => {
2540
+ let l = U(r, n);
2541
+ return i({
2542
+ node: r,
2543
+ view: a,
2544
+ getPos: o,
2545
+ decorations: s,
2546
+ innerDecorations: c,
2547
+ editor: e,
2548
+ extension: t,
2549
+ HTMLAttributes: l
2550
+ });
2551
+ }] : [];
2552
+ }));
2553
+ }
2554
+ dispatchTransaction(e) {
2555
+ let { editor: t } = this;
2556
+ return W([...this.extensions].reverse()).reduceRight((e, n) => {
2557
+ let r = {
2558
+ name: n.name,
2559
+ options: n.options,
2560
+ storage: this.editor.extensionStorage[n.name],
2561
+ editor: t,
2562
+ type: G(n.name, this.schema)
2563
+ }, i = B(n, "dispatchTransaction", r);
2564
+ return i ? (t) => {
2565
+ i.call(r, {
2566
+ transaction: t,
2567
+ next: e
2568
+ });
2569
+ } : e;
2570
+ }, e);
2571
+ }
2572
+ transformPastedHTML(e) {
2573
+ let { editor: t } = this;
2574
+ return W([...this.extensions]).reduce((e, n) => {
2575
+ let r = {
2576
+ name: n.name,
2577
+ options: n.options,
2578
+ storage: this.editor.extensionStorage[n.name],
2579
+ editor: t,
2580
+ type: G(n.name, this.schema)
2581
+ }, i = B(n, "transformPastedHTML", r);
2582
+ return i ? (t, n) => {
2583
+ let a = e(t, n);
2584
+ return i.call(r, a);
2585
+ } : e;
2586
+ }, e || ((e) => e));
2587
+ }
2588
+ get markViews() {
2589
+ let { editor: e } = this, { markExtensions: t } = H(this.extensions);
2590
+ return Object.fromEntries(t.filter((e) => !!B(e, "addMarkView")).map((t) => {
2591
+ let n = this.attributes.filter((e) => e.type === t.name), r = B(t, "addMarkView", {
2592
+ name: t.name,
2593
+ options: t.options,
2594
+ storage: this.editor.extensionStorage[t.name],
2595
+ editor: e,
2596
+ type: A(t.name, this.schema)
2597
+ });
2598
+ return r ? [t.name, (i, a, o) => {
2599
+ let s = U(i, n);
2600
+ return r()({
2601
+ mark: i,
2602
+ view: a,
2603
+ inline: o,
2604
+ editor: e,
2605
+ extension: t,
2606
+ HTMLAttributes: s,
2607
+ updateAttributes: (t) => {
2608
+ Dr(i, e, t);
2609
+ }
2610
+ });
2611
+ }] : [];
2612
+ }));
2613
+ }
2614
+ destroy() {
2615
+ var e;
2616
+ (e = this.decorationManager) == null || e.destroy(), this.extensions.forEach((e) => {
2617
+ let t = e;
2618
+ for (; t.parent;) {
2619
+ let e = t.parent;
2620
+ e.child === t && (e.child = null), t = e;
2621
+ }
2622
+ }), this.extensions = [], this.baseExtensions = [], this.decorationManager = null, this.schema = null, this.editor = null;
2623
+ }
2624
+ setupExtensions() {
2625
+ let e = this.extensions;
2626
+ this.editor.extensionStorage = Object.fromEntries(e.map((e) => [e.name, e.storage])), e.forEach((e) => {
2627
+ let t = {
2628
+ name: e.name,
2629
+ options: e.options,
2630
+ storage: this.editor.extensionStorage[e.name],
2631
+ editor: this.editor,
2632
+ type: G(e.name, this.schema)
2633
+ };
2634
+ e.type === "mark" && ((V(B(e, "keepOnSplit", t)) ?? !0) && this.splittableMarks.push(e.name), (V(B(e, "clearable", t)) ?? !0) || this.nonClearableMarks.push(e.name));
2635
+ let n = B(e, "onBeforeCreate", t), r = B(e, "onCreate", t), i = B(e, "onUpdate", t), a = B(e, "onSelectionUpdate", t), o = B(e, "onTransaction", t), s = B(e, "onFocus", t), c = B(e, "onBlur", t), l = B(e, "onDestroy", t);
2636
+ n && this.editor.on("beforeCreate", n), r && this.editor.on("create", r), i && this.editor.on("update", i), a && this.editor.on("selectionUpdate", a), o && this.editor.on("transaction", o), s && this.editor.on("focus", s), c && this.editor.on("blur", c), l && this.editor.on("destroy", l);
2637
+ });
2638
+ }
2639
+ };
2640
+ Q.resolve = Gt, Q.sort = W, Q.flatten = jt;
2641
+ var zr = {};
2642
+ Se(zr, {
2643
+ ClipboardTextSerializer: () => Br,
2644
+ Commands: () => Vr,
2645
+ Delete: () => Hr,
2646
+ Drop: () => Ur,
2647
+ Editable: () => Wr,
2648
+ FocusEvents: () => Kr,
2649
+ Keymap: () => qr,
2650
+ Paste: () => Jr,
2651
+ Tabindex: () => Yr,
2652
+ TextDirection: () => Xr,
2653
+ focusEventsPluginKey: () => Gr
2654
+ });
2655
+ var $ = class e extends jr {
2656
+ constructor() {
2657
+ super(...arguments), this.type = "extension";
2658
+ }
2659
+ static create(t = {}) {
2660
+ let n = typeof t == "function" ? t() : t;
2661
+ return new e(n);
2662
+ }
2663
+ configure(e) {
2664
+ return super.configure(e);
2665
+ }
2666
+ extend(e) {
2667
+ let t = typeof e == "function" ? e() : e;
2668
+ return super.extend(t);
2669
+ }
2670
+ }, Br = $.create({
2671
+ name: "clipboardTextSerializer",
2672
+ addOptions() {
2673
+ return { blockSeparator: void 0 };
2674
+ },
2675
+ addProseMirrorPlugins() {
2676
+ return [new _({
2677
+ key: new v("clipboardTextSerializer"),
2678
+ props: { clipboardTextSerializer: () => {
2679
+ let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, a = Jt(n), { blockSeparator: o } = this.options, s = {
2680
+ ...o === void 0 ? {} : { blockSeparator: o },
2681
+ textSerializers: a
2682
+ };
2683
+ return [...i.ranges].sort((e, t) => e.$from.pos - t.$from.pos).map(({ $from: e, $to: t }) => Kt(r, {
2684
+ from: e.pos,
2685
+ to: t.pos
2686
+ }, s)).join(o ?? "\n\n");
2687
+ } }
2688
+ })];
2689
+ }
2690
+ }), Vr = $.create({
2691
+ name: "commands",
2692
+ addCommands() {
2693
+ return { ...Ce };
2694
+ }
2695
+ }), Hr = $.create({
2696
+ name: "delete",
2697
+ onUpdate({ transaction: e, appendedTransactions: t }) {
2698
+ let n = () => {
2699
+ var n;
2700
+ if (((n = this.editor.options.coreExtensionOptions?.delete)?.filterTransaction)?.call(n, e) ?? e.getMeta("y-sync$")) return;
2701
+ let r = Ot(e.before, [e, ...t]);
2702
+ $t(r).forEach((t) => {
2703
+ r.mapping.mapResult(t.oldRange.from).deletedAfter && r.mapping.mapResult(t.oldRange.to).deletedBefore && r.before.nodesBetween(t.oldRange.from, t.oldRange.to, (n, i) => {
2704
+ let a = i + n.nodeSize - 2, o = t.oldRange.from <= i && a <= t.oldRange.to;
2705
+ this.editor.emit("delete", {
2706
+ type: "node",
2707
+ node: n,
2708
+ from: i,
2709
+ to: a,
2710
+ newFrom: r.mapping.map(i),
2711
+ newTo: r.mapping.map(a),
2712
+ deletedRange: t.oldRange,
2713
+ newRange: t.newRange,
2714
+ partial: !o,
2715
+ editor: this.editor,
2716
+ transaction: e,
2717
+ combinedTransform: r
2718
+ });
2719
+ });
2720
+ });
2721
+ let i = r.mapping;
2722
+ r.steps.forEach((t, n) => {
2723
+ if (t instanceof a) {
2724
+ let a = i.slice(n).map(t.from, -1), o = i.slice(n).map(t.to), s = i.invert().map(a, -1), c = i.invert().map(o), l = a > 0 && r.doc.nodeAt(a - 1)?.marks.some((e) => e.eq(t.mark)), u = r.doc.nodeAt(o)?.marks.some((e) => e.eq(t.mark));
2725
+ this.editor.emit("delete", {
2726
+ type: "mark",
2727
+ mark: t.mark,
2728
+ from: t.from,
2729
+ to: t.to,
2730
+ deletedRange: {
2731
+ from: s,
2732
+ to: c
2733
+ },
2734
+ newRange: {
2735
+ from: a,
2736
+ to: o
2737
+ },
2738
+ partial: !!(u || l),
2739
+ editor: this.editor,
2740
+ transaction: e,
2741
+ combinedTransform: r
2742
+ });
2743
+ }
2744
+ });
2745
+ };
2746
+ this.editor.options.coreExtensionOptions?.delete?.async ?? !0 ? setTimeout(n, 0) : n();
2747
+ }
2748
+ }), Ur = $.create({
2749
+ name: "drop",
2750
+ addProseMirrorPlugins() {
2751
+ return [new _({
2752
+ key: new v("tiptapDrop"),
2753
+ props: { handleDrop: (e, t, n, r) => {
2754
+ this.editor.emit("drop", {
2755
+ editor: this.editor,
2756
+ event: t,
2757
+ slice: n,
2758
+ moved: r
2759
+ });
2760
+ } }
2761
+ })];
2762
+ }
2763
+ }), Wr = $.create({
2764
+ name: "editable",
2765
+ addProseMirrorPlugins() {
2766
+ return [new _({
2767
+ key: new v("editable"),
2768
+ props: { editable: () => this.editor.options.editable }
2769
+ })];
2770
+ }
2771
+ }), Gr = new v("focusEvents"), Kr = $.create({
2772
+ name: "focusEvents",
2773
+ addProseMirrorPlugins() {
2774
+ let { editor: e } = this;
2775
+ return [new _({
2776
+ key: Gr,
2777
+ props: { handleDOMEvents: {
2778
+ focus: (t, n) => {
2779
+ e.isFocused = !0;
2780
+ let r = e.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
2781
+ return t.dispatch(r), !1;
2782
+ },
2783
+ blur: (t, n) => {
2784
+ e.isFocused = !1;
2785
+ let r = e.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
2786
+ return t.dispatch(r), !1;
2787
+ }
2788
+ } }
2789
+ })];
2790
+ }
2791
+ }), qr = $.create({
2792
+ name: "keymap",
2793
+ addKeyboardShortcuts() {
2794
+ let e = () => this.editor.commands.first(({ commands: e }) => [
2795
+ () => e.undoInputRule(),
2796
+ () => e.command(({ tr: t }) => {
2797
+ let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos : y.atStart(r).from === o;
2798
+ return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
2799
+ }),
2800
+ () => e.deleteSelection(),
2801
+ () => e.joinBackward(),
2802
+ () => e.selectNodeBackward()
2803
+ ]), t = () => this.editor.commands.first(({ commands: e }) => [
2804
+ () => e.deleteSelection(),
2805
+ () => e.deleteCurrentNode(),
2806
+ () => e.joinForward(),
2807
+ () => e.selectNodeForward()
2808
+ ]), n = {
2809
+ Enter: () => this.editor.commands.first(({ commands: e }) => [
2810
+ () => e.newlineInCode(),
2811
+ () => e.createParagraphNear(),
2812
+ () => e.liftEmptyBlock(),
2813
+ () => e.splitBlock()
2814
+ ]),
2815
+ "Mod-Enter": () => this.editor.commands.exitCode(),
2816
+ Backspace: e,
2817
+ "Mod-Backspace": e,
2818
+ "Shift-Backspace": e,
2819
+ Delete: t,
2820
+ "Mod-Delete": t,
2821
+ "Mod-a": () => this.editor.commands.selectAll()
2822
+ }, r = { ...n }, i = {
2823
+ ...n,
2824
+ "Ctrl-h": e,
2825
+ "Alt-Backspace": e,
2826
+ "Ctrl-d": t,
2827
+ "Ctrl-Alt-Backspace": t,
2828
+ "Alt-Delete": t,
2829
+ "Alt-d": t,
2830
+ "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
2831
+ "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
2832
+ };
2833
+ return N() || ut() ? i : r;
2834
+ },
2835
+ addProseMirrorPlugins() {
2836
+ return [new _({
2837
+ key: new v("clearDocument"),
2838
+ appendTransaction: (e, t, n) => {
2839
+ if (e.some((e) => e.getMeta("composition"))) return;
2840
+ let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
2841
+ if (!r || i) return;
2842
+ let { empty: a, from: o, to: s } = t.selection, c = y.atStart(t.doc).from, l = y.atEnd(t.doc).to;
2843
+ if (a || o !== c || s !== l || !un(n.doc)) return;
2844
+ let u = n.tr, d = w({
2845
+ state: n,
2846
+ transaction: u
2847
+ }), { commands: f } = new T({
2848
+ editor: this.editor,
2849
+ state: d
2850
+ });
2851
+ if (f.clearNodes(), u.steps.length) return u;
2852
+ }
2853
+ })];
2854
+ }
2855
+ }), Jr = $.create({
2856
+ name: "paste",
2857
+ addProseMirrorPlugins() {
2858
+ return [new _({
2859
+ key: new v("tiptapPaste"),
2860
+ props: { handlePaste: (e, t, n) => {
2861
+ this.editor.emit("paste", {
2862
+ editor: this.editor,
2863
+ event: t,
2864
+ slice: n
2865
+ });
2866
+ } }
2867
+ })];
2868
+ }
2869
+ }), Yr = $.create({
2870
+ name: "tabindex",
2871
+ addOptions() {
2872
+ return { value: void 0 };
2873
+ },
2874
+ addProseMirrorPlugins() {
2875
+ return [new _({
2876
+ key: new v("tabindex"),
2877
+ props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
2878
+ })];
2879
+ }
2880
+ }), Xr = $.create({
2881
+ name: "textDirection",
2882
+ addOptions() {
2883
+ return { direction: void 0 };
2884
+ },
2885
+ addGlobalAttributes() {
2886
+ if (!this.options.direction) return [];
2887
+ let { nodeExtensions: e } = H(this.extensions);
2888
+ return [{
2889
+ types: e.filter((e) => e.name !== "text").map((e) => e.name),
2890
+ attributes: { dir: {
2891
+ default: this.options.direction,
2892
+ parseHTML: (e) => {
2893
+ let t = e.getAttribute("dir");
2894
+ return t && (t === "ltr" || t === "rtl" || t === "auto") ? t : this.options.direction;
2895
+ },
2896
+ renderHTML: (e) => e.dir ? { dir: e.dir } : {}
2897
+ } }
2898
+ }];
2899
+ },
2900
+ addProseMirrorPlugins() {
2901
+ return [new _({
2902
+ key: new v("textDirection"),
2903
+ props: { attributes: () => {
2904
+ let e = this.options.direction;
2905
+ return e ? { dir: e } : {};
2906
+ } }
2907
+ })];
2908
+ }
2909
+ }), Zr = !1;
2910
+ function Qr(e) {
2911
+ if (Zr) return;
2912
+ Zr = !0;
2913
+ let t;
2914
+ try {
2915
+ t = s.fromJSON(e, {
2916
+ from: 0,
2917
+ to: 0
2918
+ }).slice.content;
2919
+ } catch {
2920
+ return;
2921
+ }
2922
+ t instanceof n || console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.");
2923
+ }
2924
+ var $r = class e {
2925
+ constructor(e, t, n = !1, r = null) {
2926
+ this.currentNode = null, this.actualDepth = null, this.isBlock = n, this.resolvedPos = e, this.editor = t, this.currentNode = r;
2927
+ }
2928
+ get name() {
2929
+ return this.node.type.name;
2930
+ }
2931
+ get node() {
2932
+ return this.currentNode || this.resolvedPos.node();
2933
+ }
2934
+ get element() {
2935
+ return this.editor.view.domAtPos(this.pos).node;
2936
+ }
2937
+ get depth() {
2938
+ return this.actualDepth ?? this.resolvedPos.depth;
2939
+ }
2940
+ get pos() {
2941
+ return this.resolvedPos.pos;
2942
+ }
2943
+ get content() {
2944
+ return this.node.content;
2945
+ }
2946
+ set content(e) {
2947
+ let t = this.from, n = this.to;
2948
+ if (this.isBlock) {
2949
+ if (this.content.size === 0) {
2950
+ console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);
2951
+ return;
2952
+ }
2953
+ t = this.from + 1, n = this.to - 1;
2954
+ }
2955
+ this.editor.commands.insertContentAt({
2956
+ from: t,
2957
+ to: n
2958
+ }, e);
2959
+ }
2960
+ get attributes() {
2961
+ return this.node.attrs;
2962
+ }
2963
+ get textContent() {
2964
+ return this.node.textContent;
2965
+ }
2966
+ get size() {
2967
+ return this.node.nodeSize;
2968
+ }
2969
+ get from() {
2970
+ return this.isBlock ? this.pos : this.resolvedPos.start(this.resolvedPos.depth);
2971
+ }
2972
+ get range() {
2973
+ return {
2974
+ from: this.from,
2975
+ to: this.to
2976
+ };
2977
+ }
2978
+ get to() {
2979
+ return this.isBlock ? this.pos + this.size : this.resolvedPos.end(this.resolvedPos.depth) + +!this.node.isText;
2980
+ }
2981
+ get parent() {
2982
+ if (this.depth === 0) return null;
2983
+ let t = this.resolvedPos.start(this.resolvedPos.depth - 1), n = this.resolvedPos.doc.resolve(t);
2984
+ return new e(n, this.editor);
2985
+ }
2986
+ get before() {
2987
+ let t = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));
2988
+ return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.from - 3)), new e(t, this.editor);
2989
+ }
2990
+ get after() {
2991
+ let t = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));
2992
+ return t.depth !== this.depth && (t = this.resolvedPos.doc.resolve(this.to + 3)), new e(t, this.editor);
2993
+ }
2994
+ get children() {
2995
+ let t = [];
2996
+ return this.node.content.forEach((n, r) => {
2997
+ let i = n.isBlock && !n.isTextblock, a = n.isAtom && !n.isText, o = n.isInline, s = this.pos + r + +!a;
2998
+ if (s < 0 || s > this.resolvedPos.doc.nodeSize - 2) return;
2999
+ let c = this.resolvedPos.doc.resolve(s);
3000
+ if (!i && !o && c.depth <= this.depth) return;
3001
+ let l = new e(c, this.editor, i, i || o ? n : null);
3002
+ i && (l.actualDepth = this.depth + 1), t.push(l);
3003
+ }), t;
3004
+ }
3005
+ get firstChild() {
3006
+ return this.children[0] || null;
3007
+ }
3008
+ get lastChild() {
3009
+ let e = this.children;
3010
+ return e[e.length - 1] || null;
3011
+ }
3012
+ closest(e, t = {}) {
3013
+ let n = null, r = this.parent;
3014
+ for (; r && !n;) {
3015
+ if (r.node.type.name === e) {
3016
+ if (Object.keys(t).length > 0) {
3017
+ let e = r.node.attrs, n = Object.keys(t);
3018
+ for (let r = 0; r < n.length; r += 1) {
3019
+ let i = n[r];
3020
+ if (e[i] !== t[i]) break;
3021
+ }
3022
+ } else n = r;
3023
+ }
3024
+ r = r.parent;
3025
+ }
3026
+ return n;
3027
+ }
3028
+ querySelector(e, t = {}) {
3029
+ return this.querySelectorAll(e, t, !0)[0] || null;
3030
+ }
3031
+ querySelectorAll(e, t = {}, n = !1) {
3032
+ let r = [];
3033
+ if (!this.children || this.children.length === 0) return r;
3034
+ let i = Object.keys(t);
3035
+ return this.children.forEach((a) => {
3036
+ n && r.length > 0 || (a.node.type.name === e && i.every((e) => t[e] === a.node.attrs[e]) && r.push(a), !(n && r.length > 0) && (r = r.concat(a.querySelectorAll(e, t, n))));
3037
+ }), r;
3038
+ }
3039
+ setAttribute(e) {
3040
+ let { tr: t } = this.editor.state;
3041
+ t.setNodeMarkup(this.from, void 0, {
3042
+ ...this.node.attrs,
3043
+ ...e
3044
+ }), this.editor.view.dispatch(t);
3045
+ }
3046
+ }, ei = ".ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}", ti = class extends Gn {
3047
+ constructor(e = {}) {
3048
+ super(), this.css = null, this.className = "tiptap", this.editorView = null, this.isFocused = !1, this.destroyed = !1, this.isInitialized = !1, this.extensionStorage = {}, this.instanceId = Math.random().toString(36).slice(2, 9), this.hasWarnedStaleDecorationRead = !1, this.options = {
3049
+ element: typeof document < "u" ? document.createElement("div") : null,
3050
+ content: "",
3051
+ injectCSS: !0,
3052
+ injectNonce: void 0,
3053
+ extensions: [],
3054
+ autofocus: !1,
3055
+ editable: !0,
3056
+ textDirection: void 0,
3057
+ editorProps: {},
3058
+ parseOptions: {},
3059
+ coreExtensionOptions: {},
3060
+ enableInputRules: !0,
3061
+ enablePasteRules: !0,
3062
+ enableCoreExtensions: !0,
3063
+ enableContentCheck: !1,
3064
+ emitContentError: !1,
3065
+ onBeforeCreate: () => null,
3066
+ onCreate: () => null,
3067
+ onMount: () => null,
3068
+ onUnmount: () => null,
3069
+ onUpdate: () => null,
3070
+ onSelectionUpdate: () => null,
3071
+ onTransaction: () => null,
3072
+ onFocus: () => null,
3073
+ onBlur: () => null,
3074
+ onDestroy: () => null,
3075
+ onContentError: ({ error: e }) => {
3076
+ throw e;
3077
+ },
3078
+ onPaste: () => null,
3079
+ onDrop: () => null,
3080
+ onDelete: () => null,
3081
+ enableExtensionDispatchTransaction: !0
3082
+ }, this.isCapturingTransaction = !1, this.capturedTransaction = null, this.utils = {
3083
+ getUpdatedPosition: pn,
3084
+ createMappablePosition: mn
3085
+ }, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
3086
+ let t = this.createDoc();
3087
+ if (!this.editorState) {
3088
+ let e = M(t, this.options.autofocus);
3089
+ this.editorState = h.create({
3090
+ doc: t,
3091
+ schema: this.schema,
3092
+ selection: e || void 0
3093
+ });
3094
+ }
3095
+ Qr(this.schema), this.options.element && this.mount(this.options.element);
3096
+ }
3097
+ mount(e) {
3098
+ if (typeof document > "u") throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");
3099
+ this.createView(e), this.emit("mount", { editor: this }), this.css && !document.head.contains(this.css) && document.head.appendChild(this.css), window.setTimeout(() => {
3100
+ this.isDestroyed || (this.options.autofocus !== !1 && this.options.autofocus !== null && this.commands.focus(this.options.autofocus), this.emit("create", { editor: this }), this.isInitialized = !0);
3101
+ }, 0);
3102
+ }
3103
+ unmount() {
3104
+ if (this.editorView) {
3105
+ this.editorState = this.editorView.state;
3106
+ let e = this.editorView.dom;
3107
+ e?.editor && delete e.editor, this.editorView.destroy();
3108
+ }
3109
+ if (this.editorView = null, this.isInitialized = !1, this.css && !document.querySelectorAll(`.${this.className}`).length) try {
3110
+ typeof this.css.remove == "function" ? this.css.remove() : this.css.parentNode && this.css.parentNode.removeChild(this.css);
3111
+ } catch (e) {
3112
+ console.warn("Failed to remove CSS element:", e);
3113
+ }
3114
+ this.css = null, this.emit("unmount", { editor: this });
3115
+ }
3116
+ get storage() {
3117
+ return this.extensionStorage;
3118
+ }
3119
+ get commands() {
3120
+ return this.commandManager.commands;
3121
+ }
3122
+ chain() {
3123
+ return this.commandManager ? this.commandManager.chain() : T.createFakeChain();
3124
+ }
3125
+ can() {
3126
+ return this.commandManager ? this.commandManager.can() : T.createFallbackCan();
3127
+ }
3128
+ injectCSS() {
3129
+ this.options.injectCSS && typeof document < "u" && (this.css = pr(ei, this.options.injectNonce));
3130
+ }
3131
+ setOptions(e = {}) {
3132
+ this.options = {
3133
+ ...this.options,
3134
+ ...e
3135
+ }, !(!this.editorView || !this.state || this.isDestroyed) && (this.options.editorProps && this.view.setProps(this.options.editorProps), this.view.updateState(this.state));
3136
+ }
3137
+ setEditable(e, t = !0) {
3138
+ this.setOptions({ editable: e }), t && this.emit("update", {
3139
+ editor: this,
3140
+ transaction: this.state.tr,
3141
+ appendedTransactions: []
3142
+ });
3143
+ }
3144
+ get isEditable() {
3145
+ return this.options.editable && this.view && this.view.editable;
3146
+ }
3147
+ get view() {
3148
+ return this.editorView ? this.editorView : new Proxy({
3149
+ state: this.editorState,
3150
+ updateState: (e) => {
3151
+ this.editorState = e;
3152
+ },
3153
+ dispatch: (e) => {
3154
+ this.dispatchTransaction(e);
3155
+ },
3156
+ composing: !1,
3157
+ dragging: null,
3158
+ editable: !0,
3159
+ isDestroyed: !1
3160
+ }, { get: (e, t) => {
3161
+ if (this.editorView) return this.editorView[t];
3162
+ if (t === "state") return this.editorState;
3163
+ if (t in e) return Reflect.get(e, t);
3164
+ throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`);
3165
+ } });
3166
+ }
3167
+ get state() {
3168
+ return Kn && !this.hasWarnedStaleDecorationRead && Wn(this) && (this.hasWarnedStaleDecorationRead = !0, console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")), this.editorView && (this.editorState = this.view.state), this.editorState;
3169
+ }
3170
+ registerPlugin(e, t) {
3171
+ let n = Nt(t) ? t(e, [...this.state.plugins]) : [...this.state.plugins, e], r = this.state.reconfigure({ plugins: n });
3172
+ return this.view.updateState(r), r;
3173
+ }
3174
+ unregisterPlugin(e) {
3175
+ if (this.isDestroyed) return;
3176
+ let t = this.state.plugins, n = t;
3177
+ if ([].concat(e).forEach((e) => {
3178
+ let t = typeof e == "string" ? `${e}$` : e.key;
3179
+ n = n.filter((e) => !e.key.startsWith(t));
3180
+ }), t.length === n.length) return;
3181
+ let r = this.state.reconfigure({ plugins: n });
3182
+ return this.view.updateState(r), r;
3183
+ }
3184
+ createExtensionManager() {
3185
+ let e = [...this.options.enableCoreExtensions ? [
3186
+ Wr,
3187
+ Br.configure({ blockSeparator: this.options.coreExtensionOptions?.clipboardTextSerializer?.blockSeparator }),
3188
+ Vr,
3189
+ Kr,
3190
+ qr,
3191
+ Yr.configure({ value: this.options.coreExtensionOptions?.tabindex?.value }),
3192
+ Ur,
3193
+ Jr,
3194
+ Hr,
3195
+ Xr.configure({ direction: this.options.textDirection })
3196
+ ].filter((e) => typeof this.options.enableCoreExtensions != "object" || this.options.enableCoreExtensions[e.name] !== !1) : [], ...this.options.extensions].filter((e) => [
3197
+ "extension",
3198
+ "node",
3199
+ "mark"
3200
+ ].includes(e?.type));
3201
+ this.extensionManager = new Q(e, this);
3202
+ }
3203
+ createCommandManager() {
3204
+ this.commandManager = new T({ editor: this });
3205
+ }
3206
+ createSchema() {
3207
+ this.schema = this.extensionManager.schema;
3208
+ }
3209
+ createDoc() {
3210
+ let e;
3211
+ try {
3212
+ e = R(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: this.options.enableContentCheck });
3213
+ } catch (e) {
3214
+ if (!(e instanceof Error) || !["[tiptap error]: Invalid JSON content", "[tiptap error]: Invalid HTML content"].includes(e.message)) throw e;
3215
+ let t = R(this.options.content, this.schema, this.options.parseOptions, { errorOnInvalidContent: !1 });
3216
+ return this.editorState = h.create({
3217
+ doc: t,
3218
+ schema: this.schema,
3219
+ selection: M(t, this.options.autofocus) || void 0
3220
+ }), this.emit("contentError", {
3221
+ editor: this,
3222
+ error: e,
3223
+ disableCollaboration: () => {
3224
+ "collaboration" in this.storage && typeof this.storage.collaboration == "object" && this.storage.collaboration && (this.storage.collaboration.isDisabled = !0), this.options.extensions = this.options.extensions.filter((e) => e.name !== "collaboration"), this.createExtensionManager();
3225
+ }
3226
+ }), this.editorState.doc;
3227
+ }
3228
+ return e;
3229
+ }
3230
+ createView(e) {
3231
+ let { editorProps: t, enableExtensionDispatchTransaction: n } = this.options, r = t.dispatchTransaction || this.dispatchTransaction.bind(this), i = n ? this.extensionManager.dispatchTransaction(r) : r, a = t.transformPastedHTML, o = this.extensionManager.transformPastedHTML(a);
3232
+ this.editorView = new ye(e, {
3233
+ ...t,
3234
+ attributes: {
3235
+ role: "textbox",
3236
+ ...t?.attributes
3237
+ },
3238
+ dispatchTransaction: i,
3239
+ transformPastedHTML: o,
3240
+ state: this.editorState,
3241
+ markViews: this.extensionManager.markViews,
3242
+ nodeViews: this.extensionManager.nodeViews
3243
+ });
3244
+ let s = this.state.reconfigure({ plugins: this.extensionManager.plugins });
3245
+ this.view.updateState(s), this.prependClass(), this.injectCSS();
3246
+ let c = this.view.dom;
3247
+ c.editor = this;
3248
+ }
3249
+ createNodeViews() {
3250
+ this.view.isDestroyed || this.view.setProps({
3251
+ markViews: this.extensionManager.markViews,
3252
+ nodeViews: this.extensionManager.nodeViews
3253
+ });
3254
+ }
3255
+ prependClass() {
3256
+ this.view.dom.className = `${this.className} ${this.view.dom.className}`;
3257
+ }
3258
+ captureTransaction(e) {
3259
+ this.isCapturingTransaction = !0, e(), this.isCapturingTransaction = !1;
3260
+ let t = this.capturedTransaction;
3261
+ return this.capturedTransaction = null, t;
3262
+ }
3263
+ dispatchTransaction(e) {
3264
+ if (this.view.isDestroyed) return;
3265
+ if (this.isCapturingTransaction) {
3266
+ if (!this.capturedTransaction) {
3267
+ this.capturedTransaction = e;
3268
+ return;
3269
+ }
3270
+ e.steps.forEach((e) => this.capturedTransaction?.step(e));
3271
+ return;
3272
+ }
3273
+ let { state: t, transactions: n } = this.state.applyTransaction(e), r = !this.state.selection.eq(t.selection), i = n.includes(e), a = this.state;
3274
+ if (this.emit("beforeTransaction", {
3275
+ editor: this,
3276
+ transaction: e,
3277
+ nextState: t
3278
+ }), !i) return;
3279
+ this.view.updateState(t), this.emit("transaction", {
3280
+ editor: this,
3281
+ transaction: e,
3282
+ appendedTransactions: n.slice(1)
3283
+ }), r && this.emit("selectionUpdate", {
3284
+ editor: this,
3285
+ transaction: e
3286
+ });
3287
+ let o = n.findLast((e) => e.getMeta("focus") || e.getMeta("blur")), s = o?.getMeta("focus"), c = o?.getMeta("blur");
3288
+ s && this.emit("focus", {
3289
+ editor: this,
3290
+ event: s.event,
3291
+ transaction: o
3292
+ }), c && this.emit("blur", {
3293
+ editor: this,
3294
+ event: c.event,
3295
+ transaction: o
3296
+ }), !(e.getMeta("preventUpdate") || !n.some((e) => e.docChanged) || a.doc.eq(t.doc)) && this.emit("update", {
3297
+ editor: this,
3298
+ transaction: e,
3299
+ appendedTransactions: n.slice(1)
3300
+ });
3301
+ }
3302
+ getAttributes(e) {
3303
+ return Xt(this.state, e);
3304
+ }
3305
+ isActive(e, t) {
3306
+ let n = typeof e == "string" ? e : null, r = typeof e == "string" ? t : e;
3307
+ return on(this.state, n, r);
3308
+ }
3309
+ getJSON() {
3310
+ return this.state.doc.toJSON();
3311
+ }
3312
+ getHTML() {
3313
+ return Mt(this.state.doc.content, this.schema);
3314
+ }
3315
+ getText(e) {
3316
+ let { blockSeparator: t = "\n\n", textSerializers: n = {} } = e || {};
3317
+ return qt(this.state.doc, {
3318
+ blockSeparator: t,
3319
+ textSerializers: {
3320
+ ...Jt(this.schema),
3321
+ ...n
3322
+ }
3323
+ });
3324
+ }
3325
+ get isEmpty() {
3326
+ return un(this.state.doc);
3327
+ }
3328
+ destroy() {
3329
+ this.destroyed || (this.destroyed = !0, this.emit("destroy"), this.unmount(), this.removeAllListeners(), this.extensionManager.destroy(), this.extensionManager = null, this.schema = null, this.commandManager = null, this.extensionStorage = {});
3330
+ }
3331
+ get isDestroyed() {
3332
+ return this.editorView?.isDestroyed ?? !0;
3333
+ }
3334
+ $node(e, t) {
3335
+ return this.$doc?.querySelector(e, t) || null;
3336
+ }
3337
+ $nodes(e, t) {
3338
+ return this.$doc?.querySelectorAll(e, t) || null;
3339
+ }
3340
+ $pos(e) {
3341
+ let t = this.state.doc.resolve(e), n = e > 0 && t.nodeAfter && !t.nodeAfter.isText && t.nodeAfter.isAtom ? t.nodeAfter : null;
3342
+ return new $r(t, this, !1, n);
3343
+ }
3344
+ get $doc() {
3345
+ return this.$pos(0);
3346
+ }
3347
+ };
3348
+ function ni(e) {
3349
+ return new Z({
3350
+ find: e.find,
3351
+ handler: ({ state: t, range: n, match: r }) => {
3352
+ let i = V(e.getAttributes, void 0, r);
3353
+ if (i === !1 || i === null) return null;
3354
+ let { tr: a } = t, o = r[r.length - 1], s = r[0];
3355
+ if (o) {
3356
+ let r = s.search(/\S/), c = n.from + s.indexOf(o), l = c + o.length;
3357
+ if (en(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > c).length) return null;
3358
+ l < n.to && a.delete(l, n.to), c > n.from && a.delete(n.from + r, c);
3359
+ let u = n.from + r + o.length;
3360
+ a.addMark(n.from + r, u, e.type.create(i || {})), a.removeStoredMark(e.type);
3361
+ }
3362
+ },
3363
+ undoable: e.undoable
3364
+ });
3365
+ }
3366
+ function ri(e) {
3367
+ return new Z({
3368
+ find: e.find,
3369
+ handler: ({ state: t, range: n, match: r }) => {
3370
+ let i = V(e.getAttributes, void 0, r) || {}, { tr: a } = t, o = n.from, s = n.to, c = e.type.create(i);
3371
+ if (r[1]) {
3372
+ let e = o + r[0].lastIndexOf(r[1]);
3373
+ e > s ? e = s : s = e + r[1].length;
3374
+ let t = r[0][r[0].length - 1];
3375
+ a.insertText(t, o + r[0].length - 1), a.replaceWith(e, s, c);
3376
+ } else if (r[0]) {
3377
+ let t = e.type.isInline ? o : o - 1;
3378
+ a.insert(t, e.type.create(i)).delete(a.mapping.map(o), a.mapping.map(s));
3379
+ }
3380
+ a.scrollIntoView();
3381
+ },
3382
+ undoable: e.undoable
3383
+ });
3384
+ }
3385
+ function ii(e) {
3386
+ return new Z({
3387
+ find: e.find,
3388
+ handler: ({ state: t, range: n, match: r }) => {
3389
+ let i = t.doc.resolve(n.from), a = V(e.getAttributes, void 0, r) || {};
3390
+ if (!i.node(-1).canReplaceWith(i.index(-1), i.indexAfter(-1), e.type)) return null;
3391
+ t.tr.delete(n.from, n.to).setBlockType(n.from, n.from, e.type, a);
3392
+ },
3393
+ undoable: e.undoable
3394
+ });
3395
+ }
3396
+ function ai(e) {
3397
+ return new Z({
3398
+ find: e.find,
3399
+ handler: ({ state: t, range: n, match: r, chain: i }) => {
3400
+ let a = V(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && d(s, e.type, a);
3401
+ if (!c) return null;
3402
+ if (o.wrap(s, c), e.keepMarks && e.editor) {
3403
+ let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
3404
+ if (a) {
3405
+ let e = a.filter((e) => i.includes(e.type.name));
3406
+ o.ensureMarks(e);
3407
+ }
3408
+ }
3409
+ if (e.keepAttributes) {
3410
+ let t = e.type.name === "bulletList" || e.type.name === "orderedList" ? "listItem" : "taskList";
3411
+ i().updateAttributes(t, a).run();
3412
+ }
3413
+ let u = o.doc.resolve(n.from - 1).nodeBefore;
3414
+ u && u.type === e.type && l(o.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, u)) && o.join(n.from - 1);
3415
+ },
3416
+ undoable: e.undoable
3417
+ });
3418
+ }
3419
+ var oi = class e extends jr {
3420
+ constructor() {
3421
+ super(...arguments), this.type = "node";
3422
+ }
3423
+ static create(t = {}) {
3424
+ let n = typeof t == "function" ? t() : t;
3425
+ return new e(n);
3426
+ }
3427
+ configure(e) {
3428
+ return super.configure(e);
3429
+ }
3430
+ extend(e) {
3431
+ let t = typeof e == "function" ? e() : e;
3432
+ return super.extend(t);
3433
+ }
3434
+ };
3435
+ function si(e) {
3436
+ return new Nr({
3437
+ find: e.find,
3438
+ handler: ({ state: t, range: n, match: r, pasteEvent: i }) => {
3439
+ let a = V(e.getAttributes, void 0, r, i);
3440
+ if (a === !1 || a === null) return null;
3441
+ let { tr: o } = t, s = r[r.length - 1], c = r[0], l = n.to;
3442
+ if (s) {
3443
+ let i = c.search(/\S/), u = n.from + c.indexOf(s), d = u + s.length;
3444
+ if (en(n.from, n.to, t.doc).filter((t) => t.mark.type.excluded.find((n) => n === e.type && n !== t.mark.type)).filter((e) => e.to > u).length) return null;
3445
+ d < n.to && o.delete(d, n.to), u > n.from && o.delete(n.from + i, u), l = n.from + i + s.length, o.addMark(n.from + i, l, e.type.create(a || {})), r.index !== void 0 && r.input !== void 0 && r.index + r[0].length >= r.input.length || o.removeStoredMark(e.type);
3446
+ }
3447
+ }
3448
+ });
3449
+ }
3450
+ //#endregion
3451
+ export { T as CommandManager, J as DECORATION_MANAGER_PLUGIN_KEY, dr as DecorationManager, ti as Editor, jr as Extendable, $ as Extension, Z as InputRule, fn as MappablePosition, Mr as Mark, oi as Node, $r as NodePos, Nr as PasteRule, V as callOrReturn, fr as canInsertNode, Ot as combineTransactionSteps, Ce as commands, yr as createAtomBlockMarkdownSpec, br as createBlockMarkdownSpec, w as createChainableState, R as createDocument, Cr as createInlineMarkdownSpec, mn as createMappablePosition, F as createNodeFromContent, pr as createStyleTag, et as defaultBlockAt, _t as deleteProps, P as elementFromString, zr as extensions, kt as findChildrenInRange, Wt as findDuplicates, z as findParentNode, At as findParentNodeClosestToPos, jt as flattenExtensions, zt as fromString, Xt as getAttributes, Ft as getAttributesFromExtensions, $t as getChangedRanges, B as getExtensionField, Mt as getHTMLFromFragment, Dt as getMarkAttributes, k as getMarkRange, A as getMarkType, en as getMarksBetween, tn as getNodeAtPosition, Yt as getNodeAttributes, E as getNodeType, nn as getPreviousBlockSibling, U as getRenderedAttributes, Ut as getSchemaByResolvedExtensions, G as getSchemaTypeByName, L as getSchemaTypeNameByName, K as getSplittedAttributes, qt as getText, Kt as getTextBetween, rn as getTextContentFromNodes, Jt as getTextSerializersFromSchema, pn as getUpdatedPosition, Bt as injectExtensionAttributesToParseRule, Ar as inputRulesPlugin, on as isActive, We as isAndroid, sn as isAtEndOfNode, cn as isAtStartOfNode, Pt as isEmptyObject, ln as isExtensionRulesEnabled, Nt as isFunction, q as isList, ut as isMacOS, an as isMarkActive, I as isNodeActive, un as isNodeEmpty, dn as isNodeSelection, mr as isNumber, X as isPlainObject, D as isRegExp, Ge as isSafari, Ue as isTextSelection, N as isiOS, ni as markInputRule, si as markPasteRule, gr as markdown, Rt as mergeAttributes, Er as mergeDeep, j as minMax, ri as nodeInputRule, O as objectIncludes, _r as parseAttributes, wr as parseIndentedBlocks, Rr as pasteRulesPlugin, Zt as removeDuplicates, Tr as renderNestedMarkdownContent, Gt as resolveExtensions, M as resolveFocusPosition, Qe as selectionToInsertionEnd, vr as serializeAttributes, W as sortExtensions, H as splitExtensions, ii as textblockTypeInputRule, Dr as updateMarkViewAttributes, ai as wrappingInputRule };
3452
+
3453
+ //# sourceMappingURL=index.js.map