@caspeco/casper-ui-library 9.8.0 → 9.10.0

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