@aswin.dev/editor 0.6.3 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +3 -3
  2. package/dist/AccessibilityPanel-COL6Wm7p.js +108 -0
  3. package/dist/AiChatSidebar-DWGPVtvC.js +229 -0
  4. package/dist/AiFeatureMenu-duUFSfDf.js +63 -0
  5. package/dist/BlockA11yBadge-Qs6HtXid.js +34 -0
  6. package/dist/CloudEditor-CFldoCOb.js +1207 -0
  7. package/dist/CollaboratorBar-Bw-lbt61.js +95 -0
  8. package/dist/CommentsSidebar-BaD5F53-.js +436 -0
  9. package/dist/CountdownBlock-DaYGxKqo.js +92 -0
  10. package/dist/CountdownToolbar-Dg4F8MTk.js +210 -0
  11. package/dist/DesignReferenceSidebar-BSH7uNP_.js +276 -0
  12. package/dist/LoadingTrack-Ba2pfF57.js +10 -0
  13. package/dist/ModuleBrowserModal-6phxZSKI.js +206 -0
  14. package/dist/ModulePreviewCanvas-BW8L3eQX.js +108 -0
  15. package/dist/NumberWithSuffix-BpUzQOJt.js +422 -0
  16. package/dist/ParagraphEditor-DNSzAB-I.js +695 -0
  17. package/dist/RichTextEditorContent-CrqPQdnk.js +137 -0
  18. package/dist/SaveModuleDialog-zMQTpez7.js +123 -0
  19. package/dist/SnapshotHistory-Do-A5rYU.js +122 -0
  20. package/dist/TemplateScoringPanel-CS7o62zS.js +256 -0
  21. package/dist/TestEmailModal-DGj_9V1u.js +94 -0
  22. package/dist/TitleEditor-C7IDnAoS.js +172 -0
  23. package/dist/TplModal-BAsVzcTb.js +44 -0
  24. package/dist/_plugin-vue_export-helper-BVAJ4lgT.js +8 -0
  25. package/dist/accessibility-BU09xZrQ.js +27 -0
  26. package/dist/blockTypeIcons-C6LDKvmd.js +140 -0
  27. package/dist/bundle-stats.json +10 -0
  28. package/dist/check-DJrpDKO_.js +7 -0
  29. package/dist/chevron-down-C5oBUhT8.js +7 -0
  30. package/dist/chevron-right-BqCptpdp.js +10 -0
  31. package/dist/circle-alert-ZQQc98HC.js +25 -0
  32. package/dist/clock-ik2pRJKG.js +12 -0
  33. package/dist/cloud-6ZmAvF0j.js +1791 -0
  34. package/dist/createLucideIcon-ClREiSx3.js +43 -0
  35. package/dist/de-DWcgp-7T.js +729 -0
  36. package/dist/de-GOtR9DwW.js +207 -0
  37. package/dist/dist-BUzw1buG.js +35 -0
  38. package/dist/dist-BZyY-SS4.js +74 -0
  39. package/dist/dist-BadNx4qo.js +5 -0
  40. package/dist/dist-BesOh2mk.js +35 -0
  41. package/dist/dist-Bz3M4RXG.js +2082 -0
  42. package/dist/dist-C04s_fLA.js +563 -0
  43. package/dist/dist-C3T2AKtB.js +776 -0
  44. package/dist/dist-C9ckKEZL.js +519 -0
  45. package/dist/dist-CBItRG-Z.js +47 -0
  46. package/dist/dist-COSzWQUs.js +5 -0
  47. package/dist/dist-CivF9P8b.js +382 -0
  48. package/dist/dist-DXa1uAMh.js +10658 -0
  49. package/dist/dist-DtiDUrX-.js +189 -0
  50. package/dist/dist-Dzt5foyL.js +61 -0
  51. package/dist/emojiData-DrBuvEoP.js +17 -0
  52. package/dist/en-Cxd4fhNm.js +729 -0
  53. package/dist/en-dFFQVzNn.js +207 -0
  54. package/dist/extensions-D__hOlV1.js +799 -0
  55. package/dist/formatRelativeTime-BhhO8yCl.js +12 -0
  56. package/dist/image-up-DT7gcJLN.js +23 -0
  57. package/dist/index.d.ts +352 -0
  58. package/dist/info-BSPGcsSM.js +19 -0
  59. package/dist/keys-CvX8D-8C.js +10 -0
  60. package/dist/liquid.browser-BvCyLQII.js +3277 -0
  61. package/dist/loader-circle-Balo8p3d.js +7 -0
  62. package/dist/message-circle-B39qAHxs.js +7 -0
  63. package/dist/pencil-BZJPNYWR.js +10 -0
  64. package/dist/readableTextColor-DVuzNX1y.js +30 -0
  65. package/dist/refresh-cw-DwDqGUM0.js +29 -0
  66. package/dist/rolldown-runtime-BZGGJVDF.js +20 -0
  67. package/dist/scan-line-CzfFJO1o.js +25 -0
  68. package/dist/send-D2eSo4GH.js +10 -0
  69. package/dist/shield-check-jkpgcC0-.js +10 -0
  70. package/dist/sparkles-Chm5CZfb.js +23 -0
  71. package/dist/style.css +2 -0
  72. package/dist/styleConstants-34eUKPOZ.js +55 -0
  73. package/dist/styles-B4tjX5SP.js +5224 -0
  74. package/dist/templatical-editor.js +312 -0
  75. package/dist/text-align-start-CzBnJsW8.js +43 -0
  76. package/dist/timeouts-BSGxjuUF.js +4 -0
  77. package/dist/trash-2-CtK2apEH.js +25 -0
  78. package/dist/triangle-alert-KpDVNbpn.js +17 -0
  79. package/dist/useCloudI18n-DOKSZql1.js +23 -0
  80. package/dist/useEditorCore-wslttMH-.js +9517 -0
  81. package/dist/useI18n-C2xQZ6K9.js +17 -0
  82. package/dist/useMergeTag-DX0XG5V9.js +34 -0
  83. package/dist/vue.runtime.esm-bundler-CjauPXjj.js +5775 -0
  84. package/dist/x-BkaOMosX.js +10 -0
  85. package/package.json +10 -10
@@ -0,0 +1,2082 @@
1
+ import { Cn as e, Ct as t, Dn as n, En as r, Gt as i, Ht as a, Jt as o, Mt as s, Nt as c, Qt as l, Sn as u, St as d, Tn as f, Ut as p, Z as m, _ as ee, _n as h, at as g, bn as _, c as v, gn as te, hn as y, i as b, jt as x, nn as ne, ot as re, pn as S, rt as ie, u as C, v as ae, vn as w, wn as oe, xn as T, yn as E } from "./dist-DXa1uAMh.js";
2
+ import { Link as se } from "./dist-C3T2AKtB.js";
3
+ import { Underline as ce } from "./dist-Dzt5foyL.js";
4
+ //#region ../../node_modules/.pnpm/@tiptap+core@3.22.5_@tiptap+pm@3.22.5/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js
5
+ var D = (e, t) => {
6
+ if (e === "slot") return 0;
7
+ if (e instanceof Function) return e(t);
8
+ let { children: n, ...r } = t ?? {};
9
+ if (e === "svg") throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
10
+ return [
11
+ e,
12
+ r,
13
+ n
14
+ ];
15
+ }, le = /^\s*>\s$/, ue = C.create({
16
+ name: "blockquote",
17
+ addOptions() {
18
+ return { HTMLAttributes: {} };
19
+ },
20
+ content: "block+",
21
+ group: "block",
22
+ defining: !0,
23
+ parseHTML() {
24
+ return [{ tag: "blockquote" }];
25
+ },
26
+ renderHTML({ HTMLAttributes: e }) {
27
+ return /* @__PURE__ */ D("blockquote", {
28
+ ...i(this.options.HTMLAttributes, e),
29
+ children: /* @__PURE__ */ D("slot", {})
30
+ });
31
+ },
32
+ parseMarkdown: (e, t) => {
33
+ let n = t.parseBlockChildren ?? t.parseChildren;
34
+ return t.createNode("blockquote", void 0, n(e.tokens || []));
35
+ },
36
+ renderMarkdown: (e, t) => {
37
+ if (!e.content) return "";
38
+ let n = [];
39
+ return e.content.forEach((e, r) => {
40
+ let i = (t.renderChild?.call(t, e, r) ?? t.renderChildren([e])).split("\n").map((e) => e.trim() === "" ? ">" : `> ${e}`);
41
+ n.push(i.join("\n"));
42
+ }), n.join("\n>\n");
43
+ },
44
+ addCommands() {
45
+ return {
46
+ setBlockquote: () => ({ commands: e }) => e.wrapIn(this.name),
47
+ toggleBlockquote: () => ({ commands: e }) => e.toggleWrap(this.name),
48
+ unsetBlockquote: () => ({ commands: e }) => e.lift(this.name)
49
+ };
50
+ },
51
+ addKeyboardShortcuts() {
52
+ return { "Mod-Shift-b": () => this.editor.commands.toggleBlockquote() };
53
+ },
54
+ addInputRules() {
55
+ return [y({
56
+ find: le,
57
+ type: this.type
58
+ })];
59
+ }
60
+ }), de = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, fe = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, pe = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, me = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, he = v.create({
61
+ name: "bold",
62
+ addOptions() {
63
+ return { HTMLAttributes: {} };
64
+ },
65
+ parseHTML() {
66
+ return [
67
+ { tag: "strong" },
68
+ {
69
+ tag: "b",
70
+ getAttrs: (e) => e.style.fontWeight !== "normal" && null
71
+ },
72
+ {
73
+ style: "font-weight=400",
74
+ clearMark: (e) => e.type.name === this.name
75
+ },
76
+ {
77
+ style: "font-weight",
78
+ getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
79
+ }
80
+ ];
81
+ },
82
+ renderHTML({ HTMLAttributes: e }) {
83
+ return /* @__PURE__ */ D("strong", {
84
+ ...i(this.options.HTMLAttributes, e),
85
+ children: /* @__PURE__ */ D("slot", {})
86
+ });
87
+ },
88
+ markdownTokenName: "strong",
89
+ parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
90
+ markdownOptions: { htmlReopen: {
91
+ open: "<strong>",
92
+ close: "</strong>"
93
+ } },
94
+ renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
95
+ addCommands() {
96
+ return {
97
+ setBold: () => ({ commands: e }) => e.setMark(this.name),
98
+ toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
99
+ unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
100
+ };
101
+ },
102
+ addKeyboardShortcuts() {
103
+ return {
104
+ "Mod-b": () => this.editor.commands.toggleBold(),
105
+ "Mod-B": () => this.editor.commands.toggleBold()
106
+ };
107
+ },
108
+ addInputRules() {
109
+ return [a({
110
+ find: de,
111
+ type: this.type
112
+ }), a({
113
+ find: pe,
114
+ type: this.type
115
+ })];
116
+ },
117
+ addPasteRules() {
118
+ return [p({
119
+ find: fe,
120
+ type: this.type
121
+ }), p({
122
+ find: me,
123
+ type: this.type
124
+ })];
125
+ }
126
+ }), ge = /(^|[^`])`([^`]+)`(?!`)$/, _e = /(^|[^`])`([^`]+)`(?!`)/g, ve = v.create({
127
+ name: "code",
128
+ addOptions() {
129
+ return { HTMLAttributes: {} };
130
+ },
131
+ excludes: "_",
132
+ code: !0,
133
+ exitable: !0,
134
+ parseHTML() {
135
+ return [{ tag: "code" }];
136
+ },
137
+ renderHTML({ HTMLAttributes: e }) {
138
+ return [
139
+ "code",
140
+ i(this.options.HTMLAttributes, e),
141
+ 0
142
+ ];
143
+ },
144
+ markdownTokenName: "codespan",
145
+ parseMarkdown: (e, t) => t.applyMark("code", [{
146
+ type: "text",
147
+ text: e.text || ""
148
+ }]),
149
+ renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
150
+ addCommands() {
151
+ return {
152
+ setCode: () => ({ commands: e }) => e.setMark(this.name),
153
+ toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
154
+ unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
155
+ };
156
+ },
157
+ addKeyboardShortcuts() {
158
+ return { "Mod-e": () => this.editor.commands.toggleCode() };
159
+ },
160
+ addInputRules() {
161
+ return [a({
162
+ find: ge,
163
+ type: this.type
164
+ })];
165
+ },
166
+ addPasteRules() {
167
+ return [p({
168
+ find: _e,
169
+ type: this.type
170
+ })];
171
+ }
172
+ }), O = 4, ye = /^```([a-z]+)?[\s\n]$/, be = /^~~~([a-z]+)?[\s\n]$/, xe = C.create({
173
+ name: "codeBlock",
174
+ addOptions() {
175
+ return {
176
+ languageClassPrefix: "language-",
177
+ exitOnTripleEnter: !0,
178
+ exitOnArrowDown: !0,
179
+ defaultLanguage: null,
180
+ enableTabIndentation: !1,
181
+ tabSize: O,
182
+ HTMLAttributes: {}
183
+ };
184
+ },
185
+ content: "text*",
186
+ marks: "",
187
+ group: "block",
188
+ code: !0,
189
+ defining: !0,
190
+ addAttributes() {
191
+ return { language: {
192
+ default: this.options.defaultLanguage,
193
+ parseHTML: (e) => {
194
+ let { languageClassPrefix: t } = this.options;
195
+ return t && [...e.firstElementChild?.classList || []].filter((e) => e.startsWith(t)).map((e) => e.replace(t, ""))[0] || null;
196
+ },
197
+ rendered: !1
198
+ } };
199
+ },
200
+ parseHTML() {
201
+ return [{
202
+ tag: "pre",
203
+ preserveWhitespace: "full"
204
+ }];
205
+ },
206
+ renderHTML({ node: e, HTMLAttributes: t }) {
207
+ return [
208
+ "pre",
209
+ i(this.options.HTMLAttributes, t),
210
+ [
211
+ "code",
212
+ { class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null },
213
+ 0
214
+ ]
215
+ ];
216
+ },
217
+ markdownTokenName: "code",
218
+ parseMarkdown: (e, t) => e.raw?.startsWith("```") === !1 && e.raw?.startsWith("~~~") === !1 && e.codeBlockStyle !== "indented" ? [] : t.createNode("codeBlock", { language: e.lang || null }, e.text ? [t.createTextNode(e.text)] : []),
219
+ renderMarkdown: (e, t) => {
220
+ let n = "", r = e.attrs?.language || "";
221
+ return n = e.content ? [
222
+ `\`\`\`${r}`,
223
+ t.renderChildren(e.content),
224
+ "```"
225
+ ].join("\n") : `\`\`\`${r}
226
+
227
+ \`\`\``, n;
228
+ },
229
+ addCommands() {
230
+ return {
231
+ setCodeBlock: (e) => ({ commands: t }) => t.setNode(this.name, e),
232
+ toggleCodeBlock: (e) => ({ commands: t }) => t.toggleNode(this.name, "paragraph", e)
233
+ };
234
+ },
235
+ addKeyboardShortcuts() {
236
+ return {
237
+ "Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
238
+ Backspace: () => {
239
+ let { empty: e, $anchor: t } = this.editor.state.selection, n = t.pos === 1;
240
+ return !e || t.parent.type.name !== this.name ? !1 : n || !t.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
241
+ },
242
+ Tab: ({ editor: e }) => {
243
+ if (!this.options.enableTabIndentation) return !1;
244
+ let t = this.options.tabSize ?? O, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
245
+ if (i.parent.type !== this.type) return !1;
246
+ let o = " ".repeat(t);
247
+ return a ? e.commands.insertContent(o) : e.commands.command(({ tr: e }) => {
248
+ let { from: t, to: i } = r, a = n.doc.textBetween(t, i, "\n", "\n").split("\n").map((e) => o + e).join("\n");
249
+ return e.replaceWith(t, i, n.schema.text(a)), !0;
250
+ });
251
+ },
252
+ "Shift-Tab": ({ editor: t }) => {
253
+ if (!this.options.enableTabIndentation) return !1;
254
+ let n = this.options.tabSize ?? O, { state: r } = t, { selection: i } = r, { $from: a, empty: o } = i;
255
+ return a.parent.type === this.type ? o ? t.commands.command(({ tr: t }) => {
256
+ let { pos: i } = a, o = a.start(), s = a.end(), c = r.doc.textBetween(o, s, "\n", "\n").split("\n"), l = 0, u = 0, d = i - o;
257
+ for (let e = 0; e < c.length; e += 1) {
258
+ if (u + c[e].length >= d) {
259
+ l = e;
260
+ break;
261
+ }
262
+ u += c[e].length + 1;
263
+ }
264
+ let f = c[l].match(/^ */)?.[0] || "", p = Math.min(f.length, n);
265
+ if (p === 0) return !0;
266
+ let m = o;
267
+ for (let e = 0; e < l; e += 1) m += c[e].length + 1;
268
+ return t.delete(m, m + p), i - m <= p && t.setSelection(e.create(t.doc, m)), !0;
269
+ }) : t.commands.command(({ tr: e }) => {
270
+ let { from: t, to: a } = i, o = r.doc.textBetween(t, a, "\n", "\n").split("\n").map((e) => {
271
+ let t = e.match(/^ */)?.[0] || "", r = Math.min(t.length, n);
272
+ return e.slice(r);
273
+ }).join("\n");
274
+ return e.replaceWith(t, a, r.schema.text(o)), !0;
275
+ }) : !1;
276
+ },
277
+ Enter: ({ editor: e }) => {
278
+ if (!this.options.exitOnTripleEnter) return !1;
279
+ let { state: t } = e, { selection: n } = t, { $from: r, empty: i } = n;
280
+ if (!i || r.parent.type !== this.type) return !1;
281
+ let a = r.parentOffset === r.parent.nodeSize - 2, o = r.parent.textContent.endsWith("\n\n");
282
+ return !a || !o ? !1 : e.chain().command(({ tr: e }) => (e.delete(r.pos - 2, r.pos), !0)).exitCode().run();
283
+ },
284
+ ArrowDown: ({ editor: e }) => {
285
+ if (!this.options.exitOnArrowDown) return !1;
286
+ let { state: t } = e, { selection: n, doc: r } = t, { $from: i, empty: a } = n;
287
+ if (!a || i.parent.type !== this.type || i.parentOffset !== i.parent.nodeSize - 2) return !1;
288
+ let o = i.after();
289
+ return o === void 0 ? !1 : r.nodeAt(o) ? e.commands.command(({ tr: e }) => (e.setSelection(u.near(r.resolve(o))), !0)) : e.commands.exitCode();
290
+ }
291
+ };
292
+ },
293
+ addInputRules() {
294
+ return [S({
295
+ find: ye,
296
+ type: this.type,
297
+ getAttributes: (e) => ({ language: e[1] })
298
+ }), S({
299
+ find: be,
300
+ type: this.type,
301
+ getAttributes: (e) => ({ language: e[1] })
302
+ })];
303
+ },
304
+ addProseMirrorPlugins() {
305
+ return [new _({
306
+ key: new T("codeBlockVSCodeHandler"),
307
+ props: { handlePaste: (t, n) => {
308
+ if (!n.clipboardData || this.editor.isActive(this.type.name)) return !1;
309
+ let r = n.clipboardData.getData("text/plain"), i = n.clipboardData.getData("vscode-editor-data"), a = (i ? JSON.parse(i) : void 0)?.mode;
310
+ if (!r || !a) return !1;
311
+ let { tr: o, schema: s } = t.state, c = s.text(r.replace(/\r\n?/g, "\n"));
312
+ return o.replaceSelectionWith(this.type.create({ language: a }, c)), o.selection.$from.parent.type !== this.type && o.setSelection(e.near(o.doc.resolve(Math.max(0, o.selection.from - 2)))), o.setMeta("paste", !0), t.dispatch(o), !0;
313
+ } }
314
+ })];
315
+ }
316
+ }), Se = C.create({
317
+ name: "doc",
318
+ topNode: !0,
319
+ content: "block+",
320
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n\n") : ""
321
+ }), Ce = C.create({
322
+ name: "hardBreak",
323
+ markdownTokenName: "br",
324
+ addOptions() {
325
+ return {
326
+ keepMarks: !0,
327
+ HTMLAttributes: {}
328
+ };
329
+ },
330
+ inline: !0,
331
+ group: "inline",
332
+ selectable: !1,
333
+ linebreakReplacement: !0,
334
+ parseHTML() {
335
+ return [{ tag: "br" }];
336
+ },
337
+ renderHTML({ HTMLAttributes: e }) {
338
+ return ["br", i(this.options.HTMLAttributes, e)];
339
+ },
340
+ renderText() {
341
+ return "\n";
342
+ },
343
+ renderMarkdown: () => " \n",
344
+ parseMarkdown: () => ({ type: "hardBreak" }),
345
+ addCommands() {
346
+ return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
347
+ let { selection: e, storedMarks: i } = n;
348
+ if (e.$from.parent.type.spec.isolating) return !1;
349
+ let { keepMarks: a } = this.options, { splittableMarks: o } = r.extensionManager, s = i || e.$to.parentOffset && e.$from.marks();
350
+ return t().insertContent({ type: this.name }).command(({ tr: e, dispatch: t }) => {
351
+ if (t && s && a) {
352
+ let t = s.filter((e) => o.includes(e.type.name));
353
+ e.ensureMarks(t);
354
+ }
355
+ return !0;
356
+ }).run();
357
+ })]) };
358
+ },
359
+ addKeyboardShortcuts() {
360
+ return {
361
+ "Mod-Enter": () => this.editor.commands.setHardBreak(),
362
+ "Shift-Enter": () => this.editor.commands.setHardBreak()
363
+ };
364
+ }
365
+ }), we = C.create({
366
+ name: "heading",
367
+ addOptions() {
368
+ return {
369
+ levels: [
370
+ 1,
371
+ 2,
372
+ 3,
373
+ 4,
374
+ 5,
375
+ 6
376
+ ],
377
+ HTMLAttributes: {}
378
+ };
379
+ },
380
+ content: "inline*",
381
+ group: "block",
382
+ defining: !0,
383
+ addAttributes() {
384
+ return { level: {
385
+ default: 1,
386
+ rendered: !1
387
+ } };
388
+ },
389
+ parseHTML() {
390
+ return this.options.levels.map((e) => ({
391
+ tag: `h${e}`,
392
+ attrs: { level: e }
393
+ }));
394
+ },
395
+ renderHTML({ node: e, HTMLAttributes: t }) {
396
+ return [
397
+ `h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
398
+ i(this.options.HTMLAttributes, t),
399
+ 0
400
+ ];
401
+ },
402
+ parseMarkdown: (e, t) => t.createNode("heading", { level: e.depth || 1 }, t.parseInline(e.tokens || [])),
403
+ renderMarkdown: (e, t) => {
404
+ let n = e.attrs?.level ? parseInt(e.attrs.level, 10) : 1, r = "#".repeat(n);
405
+ return e.content ? `${r} ${t.renderChildren(e.content)}` : "";
406
+ },
407
+ addCommands() {
408
+ return {
409
+ setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
410
+ toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
411
+ };
412
+ },
413
+ addKeyboardShortcuts() {
414
+ return this.options.levels.reduce((e, t) => ({
415
+ ...e,
416
+ [`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
417
+ }), {});
418
+ },
419
+ addInputRules() {
420
+ return this.options.levels.map((e) => S({
421
+ find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
422
+ type: this.type,
423
+ getAttributes: { level: e }
424
+ }));
425
+ }
426
+ }), Te = C.create({
427
+ name: "horizontalRule",
428
+ addOptions() {
429
+ return {
430
+ HTMLAttributes: {},
431
+ nextNodeType: "paragraph"
432
+ };
433
+ },
434
+ group: "block",
435
+ parseHTML() {
436
+ return [{ tag: "hr" }];
437
+ },
438
+ renderHTML({ HTMLAttributes: e }) {
439
+ return ["hr", i(this.options.HTMLAttributes, e)];
440
+ },
441
+ markdownTokenName: "hr",
442
+ parseMarkdown: (e, t) => t.createNode("horizontalRule"),
443
+ renderMarkdown: () => "---",
444
+ addCommands() {
445
+ return { setHorizontalRule: () => ({ chain: t, state: n }) => {
446
+ if (!ae(n, n.schema.nodes[this.name])) return !1;
447
+ let { selection: r } = n, { $to: i } = r, a = t();
448
+ return c(r) ? a.insertContentAt(i.pos, { type: this.name }) : a.insertContent({ type: this.name }), a.command(({ state: t, tr: n, dispatch: r }) => {
449
+ if (r) {
450
+ let { $to: r } = n.selection, i = r.end();
451
+ if (r.nodeAfter) r.nodeAfter.isTextblock ? n.setSelection(e.create(n.doc, r.pos + 1)) : r.nodeAfter.isBlock ? n.setSelection(E.create(n.doc, r.pos)) : n.setSelection(e.create(n.doc, r.pos));
452
+ else {
453
+ let a = (t.schema.nodes[this.options.nextNodeType] || r.parent.type.contentMatch.defaultType)?.create();
454
+ a && (n.insert(i, a), n.setSelection(e.create(n.doc, i + 1)));
455
+ }
456
+ n.scrollIntoView();
457
+ }
458
+ return !0;
459
+ }).run();
460
+ } };
461
+ },
462
+ addInputRules() {
463
+ return [o({
464
+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,
465
+ type: this.type
466
+ })];
467
+ }
468
+ }), Ee = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, De = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Oe = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, ke = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Ae = v.create({
469
+ name: "italic",
470
+ addOptions() {
471
+ return { HTMLAttributes: {} };
472
+ },
473
+ parseHTML() {
474
+ return [
475
+ { tag: "em" },
476
+ {
477
+ tag: "i",
478
+ getAttrs: (e) => e.style.fontStyle !== "normal" && null
479
+ },
480
+ {
481
+ style: "font-style=normal",
482
+ clearMark: (e) => e.type.name === this.name
483
+ },
484
+ { style: "font-style=italic" }
485
+ ];
486
+ },
487
+ renderHTML({ HTMLAttributes: e }) {
488
+ return [
489
+ "em",
490
+ i(this.options.HTMLAttributes, e),
491
+ 0
492
+ ];
493
+ },
494
+ addCommands() {
495
+ return {
496
+ setItalic: () => ({ commands: e }) => e.setMark(this.name),
497
+ toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
498
+ unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
499
+ };
500
+ },
501
+ markdownTokenName: "em",
502
+ parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
503
+ markdownOptions: { htmlReopen: {
504
+ open: "<em>",
505
+ close: "</em>"
506
+ } },
507
+ renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
508
+ addKeyboardShortcuts() {
509
+ return {
510
+ "Mod-i": () => this.editor.commands.toggleItalic(),
511
+ "Mod-I": () => this.editor.commands.toggleItalic()
512
+ };
513
+ },
514
+ addInputRules() {
515
+ return [a({
516
+ find: Ee,
517
+ type: this.type
518
+ }), a({
519
+ find: Oe,
520
+ type: this.type
521
+ })];
522
+ },
523
+ addPasteRules() {
524
+ return [p({
525
+ find: De,
526
+ type: this.type
527
+ }), p({
528
+ find: ke,
529
+ type: this.type
530
+ })];
531
+ }
532
+ }), je = Object.defineProperty, Me = (e, t) => {
533
+ for (var n in t) je(e, n, {
534
+ get: t[n],
535
+ enumerable: !0
536
+ });
537
+ }, Ne = "listItem", k = "textStyle", A = /^\s*([-+*])\s$/, j = C.create({
538
+ name: "bulletList",
539
+ addOptions() {
540
+ return {
541
+ itemTypeName: "listItem",
542
+ HTMLAttributes: {},
543
+ keepMarks: !1,
544
+ keepAttributes: !1
545
+ };
546
+ },
547
+ group: "block list",
548
+ content() {
549
+ return `${this.options.itemTypeName}+`;
550
+ },
551
+ parseHTML() {
552
+ return [{ tag: "ul" }];
553
+ },
554
+ renderHTML({ HTMLAttributes: e }) {
555
+ return [
556
+ "ul",
557
+ i(this.options.HTMLAttributes, e),
558
+ 0
559
+ ];
560
+ },
561
+ markdownTokenName: "list",
562
+ parseMarkdown: (e, t) => e.type !== "list" || e.ordered ? [] : {
563
+ type: "bulletList",
564
+ content: e.items ? t.parseChildren(e.items) : []
565
+ },
566
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
567
+ markdownOptions: { indentsContent: !0 },
568
+ addCommands() {
569
+ return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ne, this.editor.getAttributes(k)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
570
+ },
571
+ addKeyboardShortcuts() {
572
+ return { "Mod-Shift-8": () => this.editor.commands.toggleBulletList() };
573
+ },
574
+ addInputRules() {
575
+ let e = y({
576
+ find: A,
577
+ type: this.type
578
+ });
579
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = y({
580
+ find: A,
581
+ type: this.type,
582
+ keepMarks: this.options.keepMarks,
583
+ keepAttributes: this.options.keepAttributes,
584
+ getAttributes: () => this.editor.getAttributes(k),
585
+ editor: this.editor
586
+ })), [e];
587
+ }
588
+ }), M = C.create({
589
+ name: "listItem",
590
+ addOptions() {
591
+ return {
592
+ HTMLAttributes: {},
593
+ bulletListTypeName: "bulletList",
594
+ orderedListTypeName: "orderedList"
595
+ };
596
+ },
597
+ content: "paragraph block*",
598
+ defining: !0,
599
+ parseHTML() {
600
+ return [{ tag: "li" }];
601
+ },
602
+ renderHTML({ HTMLAttributes: e }) {
603
+ return [
604
+ "li",
605
+ i(this.options.HTMLAttributes, e),
606
+ 0
607
+ ];
608
+ },
609
+ markdownTokenName: "list_item",
610
+ parseMarkdown: (e, t) => {
611
+ if (e.type !== "list_item") return [];
612
+ let n = t.parseBlockChildren ?? t.parseChildren, r = [];
613
+ if (e.tokens && e.tokens.length > 0) if (e.tokens.some((e) => e.type === "paragraph")) r = n(e.tokens);
614
+ else {
615
+ let i = e.tokens[0];
616
+ if (i && i.type === "text" && i.tokens && i.tokens.length > 0) {
617
+ if (r = [{
618
+ type: "paragraph",
619
+ content: t.parseInline(i.tokens)
620
+ }], e.tokens.length > 1) {
621
+ let t = n(e.tokens.slice(1));
622
+ r.push(...t);
623
+ }
624
+ } else r = n(e.tokens);
625
+ }
626
+ return r.length === 0 && (r = [{
627
+ type: "paragraph",
628
+ content: []
629
+ }]), {
630
+ type: "listItem",
631
+ content: r
632
+ };
633
+ },
634
+ renderMarkdown: (e, t, n) => ne(e, t, (e) => e.parentType === "bulletList" ? "- " : e.parentType === "orderedList" ? `${(e.meta?.parentAttrs?.start || 1) + e.index}. ` : "- ", n),
635
+ addKeyboardShortcuts() {
636
+ return {
637
+ Enter: () => this.editor.commands.splitListItem(this.name),
638
+ Tab: () => this.editor.commands.sinkListItem(this.name),
639
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
640
+ };
641
+ }
642
+ });
643
+ Me({}, {
644
+ findListItemPos: () => N,
645
+ getNextListDepth: () => P,
646
+ handleBackspace: () => L,
647
+ handleDelete: () => R,
648
+ hasListBefore: () => F,
649
+ hasListItemAfter: () => Le,
650
+ hasListItemBefore: () => I,
651
+ listItemHasSubList: () => Pe,
652
+ nextListIsDeeper: () => Fe,
653
+ nextListIsHigher: () => Ie
654
+ });
655
+ var N = (e, t) => {
656
+ let { $from: n } = t.selection, r = g(e, t.schema), i = null, a = n.depth, o = n.pos, s = null;
657
+ for (; a > 0 && s === null;) i = n.node(a), i.type === r ? s = a : (--a, --o);
658
+ return s === null ? null : {
659
+ $pos: t.doc.resolve(o),
660
+ depth: s
661
+ };
662
+ }, P = (e, t) => {
663
+ let n = N(e, t);
664
+ if (!n) return !1;
665
+ let [, r] = ie(t, e, n.$pos.pos + 4);
666
+ return r;
667
+ }, F = (e, t, n) => {
668
+ let { $anchor: r } = e.selection, i = Math.max(0, r.pos - 2), a = e.doc.resolve(i).node();
669
+ return !(!a || !n.includes(a.type.name));
670
+ }, I = (e, t) => {
671
+ let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - 2);
672
+ return !(r.index() === 0 || r.nodeBefore?.type.name !== e);
673
+ }, Pe = (e, t, n) => {
674
+ if (!n) return !1;
675
+ let r = g(e, t.schema), i = !1;
676
+ return n.descendants((e) => {
677
+ e.type === r && (i = !0);
678
+ }), i;
679
+ }, L = (e, n, r) => {
680
+ if (e.commands.undoInputRule()) return !0;
681
+ if (e.state.selection.from !== e.state.selection.to) return !1;
682
+ if (!x(e.state, n) && F(e.state, n, r)) {
683
+ let { $anchor: t } = e.state.selection, r = e.state.doc.resolve(t.before() - 1), i = [];
684
+ r.node().descendants((e, t) => {
685
+ e.type.name === n && i.push({
686
+ node: e,
687
+ pos: t
688
+ });
689
+ });
690
+ let a = i.at(-1);
691
+ if (!a) return !1;
692
+ let o = e.state.doc.resolve(r.start() + a.pos + 1);
693
+ return e.chain().cut({
694
+ from: t.start() - 1,
695
+ to: t.end() + 1
696
+ }, o.end()).joinForward().run();
697
+ }
698
+ if (!x(e.state, n) || !t(e.state)) return !1;
699
+ let i = N(n, e.state);
700
+ if (!i) return !1;
701
+ let a = e.state.doc.resolve(i.$pos.pos - 2).node(i.depth), o = Pe(n, e.state, a);
702
+ return I(n, e.state) && !o ? e.commands.joinItemBackward() : e.chain().liftListItem(n).run();
703
+ }, Fe = (e, t) => {
704
+ let n = P(e, t), r = N(e, t);
705
+ return !r || !n ? !1 : n > r.depth;
706
+ }, Ie = (e, t) => {
707
+ let n = P(e, t), r = N(e, t);
708
+ return !r || !n ? !1 : n < r.depth;
709
+ }, R = (e, t) => {
710
+ if (!x(e.state, t) || !d(e.state, t)) return !1;
711
+ let { selection: n } = e.state, { $from: r, $to: i } = n;
712
+ return !n.empty && r.sameParent(i) ? !1 : Fe(t, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(t).joinBackward().run() : Ie(t, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
713
+ }, Le = (e, t) => {
714
+ let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - n.parentOffset - 2);
715
+ return !(r.index() === r.parent.childCount - 1 || r.nodeAfter?.type.name !== e);
716
+ }, Re = b.create({
717
+ name: "listKeymap",
718
+ addOptions() {
719
+ return { listTypes: [{
720
+ itemName: "listItem",
721
+ wrapperNames: ["bulletList", "orderedList"]
722
+ }, {
723
+ itemName: "taskItem",
724
+ wrapperNames: ["taskList"]
725
+ }] };
726
+ },
727
+ addKeyboardShortcuts() {
728
+ return {
729
+ Delete: ({ editor: e }) => {
730
+ let t = !1;
731
+ return this.options.listTypes.forEach(({ itemName: n }) => {
732
+ e.state.schema.nodes[n] !== void 0 && R(e, n) && (t = !0);
733
+ }), t;
734
+ },
735
+ "Mod-Delete": ({ editor: e }) => {
736
+ let t = !1;
737
+ return this.options.listTypes.forEach(({ itemName: n }) => {
738
+ e.state.schema.nodes[n] !== void 0 && R(e, n) && (t = !0);
739
+ }), t;
740
+ },
741
+ Backspace: ({ editor: e }) => {
742
+ let t = !1;
743
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
744
+ e.state.schema.nodes[n] !== void 0 && L(e, n, r) && (t = !0);
745
+ }), t;
746
+ },
747
+ "Mod-Backspace": ({ editor: e }) => {
748
+ let t = !1;
749
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
750
+ e.state.schema.nodes[n] !== void 0 && L(e, n, r) && (t = !0);
751
+ }), t;
752
+ }
753
+ };
754
+ }
755
+ }), ze = /^(\s*)(\d+)\.\s+(.*)$/, Be = /^\s/;
756
+ function Ve(e) {
757
+ let t = e.trimStart();
758
+ return /^[-+*]\s+/.test(t) || /^\d+\.\s+/.test(t) || /^>\s?/.test(t) || /^```/.test(t) || /^~~~/.test(t);
759
+ }
760
+ function He(e) {
761
+ let t = [], n = [], r = !1;
762
+ return e.forEach((e) => {
763
+ if (r) {
764
+ n.push(e);
765
+ return;
766
+ }
767
+ if (e.trim() === "") {
768
+ r = !0, n.push(e);
769
+ return;
770
+ }
771
+ if (t.length > 0 && Ve(e)) {
772
+ r = !0, n.push(e);
773
+ return;
774
+ }
775
+ t.push(e);
776
+ }), {
777
+ paragraphLines: t,
778
+ blockLines: n
779
+ };
780
+ }
781
+ function Ue(e) {
782
+ let t = [], n = 0, r = 0;
783
+ for (; n < e.length;) {
784
+ let i = e[n], a = i.match(ze);
785
+ if (!a) break;
786
+ let [, o, s, c] = a, l = o.length, u = [c], d = n + 1, f = [i], p = !1;
787
+ for (; d < e.length;) {
788
+ let t = e[d];
789
+ if (t.match(ze)) break;
790
+ if (t.trim() === "") f.push(t), u.push(""), p = !0, d += 1;
791
+ else if (t.match(Be)) f.push(t), u.push(t.slice(l + 2)), d += 1;
792
+ else {
793
+ if (p) break;
794
+ f.push(t), u.push(t), d += 1;
795
+ }
796
+ }
797
+ t.push({
798
+ indent: l,
799
+ number: parseInt(s, 10),
800
+ content: u.join("\n").trim(),
801
+ contentLines: u,
802
+ raw: f.join("\n")
803
+ }), r = d, n = d;
804
+ }
805
+ return [t, r];
806
+ }
807
+ function We(e, t, n) {
808
+ let r = [], i = 0;
809
+ for (; i < e.length;) {
810
+ let a = e[i];
811
+ if (a.indent === t) {
812
+ let { paragraphLines: o, blockLines: s } = He(a.contentLines), c = o.join("\n").trim(), l = [];
813
+ c && l.push({
814
+ type: "paragraph",
815
+ raw: c,
816
+ tokens: n.inlineTokens(c)
817
+ });
818
+ let u = s.join("\n").trim();
819
+ if (u) {
820
+ let e = n.blockTokens(u);
821
+ l.push(...e);
822
+ }
823
+ let d = i + 1, f = [];
824
+ for (; d < e.length && e[d].indent > t;) f.push(e[d]), d += 1;
825
+ if (f.length > 0) {
826
+ let e = We(f, Math.min(...f.map((e) => e.indent)), n);
827
+ l.push({
828
+ type: "list",
829
+ ordered: !0,
830
+ start: f[0].number,
831
+ items: e,
832
+ raw: f.map((e) => e.raw).join("\n")
833
+ });
834
+ }
835
+ r.push({
836
+ type: "list_item",
837
+ raw: a.raw,
838
+ tokens: l
839
+ }), i = d;
840
+ } else i += 1;
841
+ }
842
+ return r;
843
+ }
844
+ function Ge(e, t) {
845
+ return e.map((e) => {
846
+ if (e.type !== "list_item") return t.parseChildren([e])[0];
847
+ let n = [];
848
+ return e.tokens && e.tokens.length > 0 && e.tokens.forEach((e) => {
849
+ if (e.type === "paragraph" || e.type === "list" || e.type === "blockquote" || e.type === "code") n.push(...t.parseChildren([e]));
850
+ else if (e.type === "text" && e.tokens) {
851
+ let r = t.parseChildren([e]);
852
+ n.push({
853
+ type: "paragraph",
854
+ content: r
855
+ });
856
+ } else {
857
+ let r = t.parseChildren([e]);
858
+ r.length > 0 && n.push(...r);
859
+ }
860
+ }), {
861
+ type: "listItem",
862
+ content: n
863
+ };
864
+ });
865
+ }
866
+ var Ke = "listItem", qe = "textStyle", Je = /^(\d+)\.\s$/, Ye = C.create({
867
+ name: "orderedList",
868
+ addOptions() {
869
+ return {
870
+ itemTypeName: "listItem",
871
+ HTMLAttributes: {},
872
+ keepMarks: !1,
873
+ keepAttributes: !1
874
+ };
875
+ },
876
+ group: "block list",
877
+ content() {
878
+ return `${this.options.itemTypeName}+`;
879
+ },
880
+ addAttributes() {
881
+ return {
882
+ start: {
883
+ default: 1,
884
+ parseHTML: (e) => e.hasAttribute("start") ? parseInt(e.getAttribute("start") || "", 10) : 1
885
+ },
886
+ type: {
887
+ default: null,
888
+ parseHTML: (e) => e.getAttribute("type")
889
+ }
890
+ };
891
+ },
892
+ parseHTML() {
893
+ return [{ tag: "ol" }];
894
+ },
895
+ renderHTML({ HTMLAttributes: e }) {
896
+ let { start: t, ...n } = e;
897
+ return t === 1 ? [
898
+ "ol",
899
+ i(this.options.HTMLAttributes, n),
900
+ 0
901
+ ] : [
902
+ "ol",
903
+ i(this.options.HTMLAttributes, e),
904
+ 0
905
+ ];
906
+ },
907
+ markdownTokenName: "list",
908
+ parseMarkdown: (e, t) => {
909
+ if (e.type !== "list" || !e.ordered) return [];
910
+ let n = e.start || 1, r = e.items ? Ge(e.items, t) : [];
911
+ return n === 1 ? {
912
+ type: "orderedList",
913
+ content: r
914
+ } : {
915
+ type: "orderedList",
916
+ attrs: { start: n },
917
+ content: r
918
+ };
919
+ },
920
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
921
+ markdownTokenizer: {
922
+ name: "orderedList",
923
+ level: "block",
924
+ start: (e) => {
925
+ let t = e.match(/^(\s*)(\d+)\.\s+/)?.index;
926
+ return t === void 0 ? -1 : t;
927
+ },
928
+ tokenize: (e, t, n) => {
929
+ let r = e.split("\n"), [i, a] = Ue(r);
930
+ if (i.length === 0) return;
931
+ let o = We(i, 0, n);
932
+ if (o.length !== 0) return {
933
+ type: "list",
934
+ ordered: !0,
935
+ start: i[0]?.number || 1,
936
+ items: o,
937
+ raw: r.slice(0, a).join("\n")
938
+ };
939
+ }
940
+ },
941
+ markdownOptions: { indentsContent: !0 },
942
+ addCommands() {
943
+ return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ke, this.editor.getAttributes(qe)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
944
+ },
945
+ addKeyboardShortcuts() {
946
+ return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
947
+ },
948
+ addInputRules() {
949
+ let e = y({
950
+ find: Je,
951
+ type: this.type,
952
+ getAttributes: (e) => ({ start: +e[1] }),
953
+ joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1]
954
+ });
955
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = y({
956
+ find: Je,
957
+ type: this.type,
958
+ keepMarks: this.options.keepMarks,
959
+ keepAttributes: this.options.keepAttributes,
960
+ getAttributes: (e) => ({
961
+ start: +e[1],
962
+ ...this.editor.getAttributes(qe)
963
+ }),
964
+ joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1],
965
+ editor: this.editor
966
+ })), [e];
967
+ }
968
+ }), Xe = /^\s*(\[([( |x])?\])\s$/, Ze = C.create({
969
+ name: "taskItem",
970
+ addOptions() {
971
+ return {
972
+ nested: !1,
973
+ HTMLAttributes: {},
974
+ taskListTypeName: "taskList",
975
+ a11y: void 0
976
+ };
977
+ },
978
+ content() {
979
+ return this.options.nested ? "paragraph block*" : "paragraph+";
980
+ },
981
+ defining: !0,
982
+ addAttributes() {
983
+ return { checked: {
984
+ default: !1,
985
+ keepOnSplit: !1,
986
+ parseHTML: (e) => {
987
+ let t = e.getAttribute("data-checked");
988
+ return t === "" || t === "true";
989
+ },
990
+ renderHTML: (e) => ({ "data-checked": e.checked })
991
+ } };
992
+ },
993
+ parseHTML() {
994
+ return [{
995
+ tag: `li[data-type="${this.name}"]`,
996
+ priority: 51
997
+ }];
998
+ },
999
+ renderHTML({ node: e, HTMLAttributes: t }) {
1000
+ return [
1001
+ "li",
1002
+ i(this.options.HTMLAttributes, t, { "data-type": this.name }),
1003
+ [
1004
+ "label",
1005
+ ["input", {
1006
+ type: "checkbox",
1007
+ checked: e.attrs.checked ? "checked" : null
1008
+ }],
1009
+ ["span"]
1010
+ ],
1011
+ ["div", 0]
1012
+ ];
1013
+ },
1014
+ parseMarkdown: (e, t) => {
1015
+ let n = [];
1016
+ if (e.tokens && e.tokens.length > 0 ? n.push(t.createNode("paragraph", {}, t.parseInline(e.tokens))) : e.text ? n.push(t.createNode("paragraph", {}, [t.createNode("text", { text: e.text })])) : n.push(t.createNode("paragraph", {}, [])), e.nestedTokens && e.nestedTokens.length > 0) {
1017
+ let r = t.parseChildren(e.nestedTokens);
1018
+ n.push(...r);
1019
+ }
1020
+ return t.createNode("taskItem", { checked: e.checked || !1 }, n);
1021
+ },
1022
+ renderMarkdown: (e, t) => ne(e, t, `- [${e.attrs?.checked ? "x" : " "}] `),
1023
+ addKeyboardShortcuts() {
1024
+ let e = {
1025
+ Enter: () => this.editor.commands.splitListItem(this.name),
1026
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
1027
+ };
1028
+ return this.options.nested ? {
1029
+ ...e,
1030
+ Tab: () => this.editor.commands.sinkListItem(this.name)
1031
+ } : e;
1032
+ },
1033
+ addNodeView() {
1034
+ return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
1035
+ let i = document.createElement("li"), a = document.createElement("label"), o = document.createElement("span"), s = document.createElement("input"), c = document.createElement("div"), l = (e) => {
1036
+ var t;
1037
+ s.ariaLabel = ((t = this.options.a11y)?.checkboxLabel)?.call(t, e, s.checked) || `Task item checkbox for ${e.textContent || "empty task item"}`;
1038
+ };
1039
+ l(e), a.contentEditable = "false", s.type = "checkbox", s.addEventListener("mousedown", (e) => e.preventDefault()), s.addEventListener("change", (t) => {
1040
+ if (!r.isEditable && !this.options.onReadOnlyChecked) {
1041
+ s.checked = !s.checked;
1042
+ return;
1043
+ }
1044
+ let { checked: i } = t.target;
1045
+ r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: e }) => {
1046
+ let t = n();
1047
+ if (typeof t != "number") return !1;
1048
+ let r = e.doc.nodeAt(t);
1049
+ return e.setNodeMarkup(t, void 0, {
1050
+ ...r?.attrs,
1051
+ checked: i
1052
+ }), !0;
1053
+ }).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(e, i) || (s.checked = !s.checked));
1054
+ }), Object.entries(this.options.HTMLAttributes).forEach(([e, t]) => {
1055
+ i.setAttribute(e, t);
1056
+ }), i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, a.append(s, o), i.append(a, c), Object.entries(t).forEach(([e, t]) => {
1057
+ i.setAttribute(e, t);
1058
+ });
1059
+ let u = new Set(Object.keys(t));
1060
+ return {
1061
+ dom: i,
1062
+ contentDOM: c,
1063
+ update: (e) => {
1064
+ if (e.type !== this.type) return !1;
1065
+ i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, l(e);
1066
+ let t = r.extensionManager.attributes, n = re(e, t), a = new Set(Object.keys(n)), o = this.options.HTMLAttributes;
1067
+ return u.forEach((e) => {
1068
+ a.has(e) || (e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e));
1069
+ }), Object.entries(n).forEach(([e, t]) => {
1070
+ t == null ? e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e) : i.setAttribute(e, t);
1071
+ }), u = a, !0;
1072
+ }
1073
+ };
1074
+ };
1075
+ },
1076
+ addInputRules() {
1077
+ return [y({
1078
+ find: Xe,
1079
+ type: this.type,
1080
+ getAttributes: (e) => ({ checked: e[e.length - 1] === "x" })
1081
+ })];
1082
+ }
1083
+ }), Qe = C.create({
1084
+ name: "taskList",
1085
+ addOptions() {
1086
+ return {
1087
+ itemTypeName: "taskItem",
1088
+ HTMLAttributes: {}
1089
+ };
1090
+ },
1091
+ group: "block list",
1092
+ content() {
1093
+ return `${this.options.itemTypeName}+`;
1094
+ },
1095
+ parseHTML() {
1096
+ return [{
1097
+ tag: `ul[data-type="${this.name}"]`,
1098
+ priority: 51
1099
+ }];
1100
+ },
1101
+ renderHTML({ HTMLAttributes: e }) {
1102
+ return [
1103
+ "ul",
1104
+ i(this.options.HTMLAttributes, e, { "data-type": this.name }),
1105
+ 0
1106
+ ];
1107
+ },
1108
+ parseMarkdown: (e, t) => t.createNode("taskList", {}, t.parseChildren(e.items || [])),
1109
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
1110
+ markdownTokenizer: {
1111
+ name: "taskList",
1112
+ level: "block",
1113
+ start(e) {
1114
+ let t = e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;
1115
+ return t === void 0 ? -1 : t;
1116
+ },
1117
+ tokenize(e, t, n) {
1118
+ let r = (e) => {
1119
+ let t = l(e, {
1120
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1121
+ extractItemData: (e) => ({
1122
+ indentLevel: e[1].length,
1123
+ mainContent: e[4],
1124
+ checked: e[3].toLowerCase() === "x"
1125
+ }),
1126
+ createToken: (e, t) => ({
1127
+ type: "taskItem",
1128
+ raw: "",
1129
+ mainContent: e.mainContent,
1130
+ indentLevel: e.indentLevel,
1131
+ checked: e.checked,
1132
+ text: e.mainContent,
1133
+ tokens: n.inlineTokens(e.mainContent),
1134
+ nestedTokens: t
1135
+ }),
1136
+ customNestedParser: r
1137
+ }, n);
1138
+ return t ? [{
1139
+ type: "taskList",
1140
+ raw: t.raw,
1141
+ items: t.items
1142
+ }] : n.blockTokens(e);
1143
+ }, i = l(e, {
1144
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1145
+ extractItemData: (e) => ({
1146
+ indentLevel: e[1].length,
1147
+ mainContent: e[4],
1148
+ checked: e[3].toLowerCase() === "x"
1149
+ }),
1150
+ createToken: (e, t) => ({
1151
+ type: "taskItem",
1152
+ raw: "",
1153
+ mainContent: e.mainContent,
1154
+ indentLevel: e.indentLevel,
1155
+ checked: e.checked,
1156
+ text: e.mainContent,
1157
+ tokens: n.inlineTokens(e.mainContent),
1158
+ nestedTokens: t
1159
+ }),
1160
+ customNestedParser: r
1161
+ }, n);
1162
+ if (i) return {
1163
+ type: "taskList",
1164
+ raw: i.raw,
1165
+ items: i.items
1166
+ };
1167
+ }
1168
+ },
1169
+ markdownOptions: { indentsContent: !0 },
1170
+ addCommands() {
1171
+ return { toggleTaskList: () => ({ commands: e }) => e.toggleList(this.name, this.options.itemTypeName) };
1172
+ },
1173
+ addKeyboardShortcuts() {
1174
+ return { "Mod-Shift-9": () => this.editor.commands.toggleTaskList() };
1175
+ }
1176
+ });
1177
+ b.create({
1178
+ name: "listKit",
1179
+ addExtensions() {
1180
+ let e = [];
1181
+ return this.options.bulletList !== !1 && e.push(j.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(M.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Re.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(Ye.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(Ze.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(Qe.configure(this.options.taskList)), e;
1182
+ }
1183
+ });
1184
+ //#endregion
1185
+ //#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@3.22.5_@tiptap+core@3.22.5_@tiptap+pm@3.22.5_/node_modules/@tiptap/extension-paragraph/dist/index.js
1186
+ var z = "&nbsp;", B = "\xA0", $e = C.create({
1187
+ name: "paragraph",
1188
+ priority: 1e3,
1189
+ addOptions() {
1190
+ return { HTMLAttributes: {} };
1191
+ },
1192
+ group: "block",
1193
+ content: "inline*",
1194
+ parseHTML() {
1195
+ return [{ tag: "p" }];
1196
+ },
1197
+ renderHTML({ HTMLAttributes: e }) {
1198
+ return [
1199
+ "p",
1200
+ i(this.options.HTMLAttributes, e),
1201
+ 0
1202
+ ];
1203
+ },
1204
+ parseMarkdown: (e, t) => {
1205
+ let n = e.tokens || [];
1206
+ if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
1207
+ let r = t.parseInline(n);
1208
+ return n.length === 1 && n[0].type === "text" && (n[0].raw === z || n[0].text === z || n[0].raw === B || n[0].text === B) && r.length === 1 && r[0].type === "text" && (r[0].text === z || r[0].text === B) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
1209
+ },
1210
+ renderMarkdown: (e, t, n) => {
1211
+ if (!e) return "";
1212
+ let r = Array.isArray(e.content) ? e.content : [];
1213
+ if (r.length === 0) {
1214
+ let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
1215
+ return n?.previousNode?.type === "paragraph" && e.length === 0 ? z : "";
1216
+ }
1217
+ return t.renderChildren(r);
1218
+ },
1219
+ addCommands() {
1220
+ return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
1221
+ },
1222
+ addKeyboardShortcuts() {
1223
+ return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
1224
+ }
1225
+ }), et = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, tt = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, nt = v.create({
1226
+ name: "strike",
1227
+ addOptions() {
1228
+ return { HTMLAttributes: {} };
1229
+ },
1230
+ parseHTML() {
1231
+ return [
1232
+ { tag: "s" },
1233
+ { tag: "del" },
1234
+ { tag: "strike" },
1235
+ {
1236
+ style: "text-decoration",
1237
+ consuming: !1,
1238
+ getAttrs: (e) => e.includes("line-through") ? {} : !1
1239
+ }
1240
+ ];
1241
+ },
1242
+ renderHTML({ HTMLAttributes: e }) {
1243
+ return [
1244
+ "s",
1245
+ i(this.options.HTMLAttributes, e),
1246
+ 0
1247
+ ];
1248
+ },
1249
+ markdownTokenName: "del",
1250
+ parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
1251
+ renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
1252
+ addCommands() {
1253
+ return {
1254
+ setStrike: () => ({ commands: e }) => e.setMark(this.name),
1255
+ toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
1256
+ unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
1257
+ };
1258
+ },
1259
+ addKeyboardShortcuts() {
1260
+ return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
1261
+ },
1262
+ addInputRules() {
1263
+ return [a({
1264
+ find: et,
1265
+ type: this.type
1266
+ })];
1267
+ },
1268
+ addPasteRules() {
1269
+ return [p({
1270
+ find: tt,
1271
+ type: this.type
1272
+ })];
1273
+ }
1274
+ }), rt = C.create({
1275
+ name: "text",
1276
+ group: "inline",
1277
+ parseMarkdown: (e) => ({
1278
+ type: "text",
1279
+ text: e.text || ""
1280
+ }),
1281
+ renderMarkdown: (e) => e.text || ""
1282
+ });
1283
+ //#endregion
1284
+ //#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
1285
+ function it(e = {}) {
1286
+ return new _({ view(t) {
1287
+ return new at(t, e);
1288
+ } });
1289
+ }
1290
+ var at = class {
1291
+ constructor(e, t) {
1292
+ this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = t.width ?? 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = [
1293
+ "dragover",
1294
+ "dragend",
1295
+ "drop",
1296
+ "dragleave"
1297
+ ].map((t) => {
1298
+ let n = (e) => {
1299
+ this[t](e);
1300
+ };
1301
+ return e.dom.addEventListener(t, n), {
1302
+ name: t,
1303
+ handler: n
1304
+ };
1305
+ });
1306
+ }
1307
+ destroy() {
1308
+ this.handlers.forEach(({ name: e, handler: t }) => this.editorView.dom.removeEventListener(e, t));
1309
+ }
1310
+ update(e, t) {
1311
+ this.cursorPos != null && t.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
1312
+ }
1313
+ setCursor(e) {
1314
+ e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
1315
+ }
1316
+ updateOverlay() {
1317
+ let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, n, r = this.editorView.dom, i = r.getBoundingClientRect(), a = i.width / r.offsetWidth, o = i.height / r.offsetHeight;
1318
+ if (t) {
1319
+ let t = e.nodeBefore, r = e.nodeAfter;
1320
+ if (t || r) {
1321
+ let e = this.editorView.nodeDOM(this.cursorPos - (t ? t.nodeSize : 0));
1322
+ if (e) {
1323
+ let i = e.getBoundingClientRect(), a = t ? i.bottom : i.top;
1324
+ t && r && (a = (a + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
1325
+ let s = this.width / 2 * o;
1326
+ n = {
1327
+ left: i.left,
1328
+ right: i.right,
1329
+ top: a - s,
1330
+ bottom: a + s
1331
+ };
1332
+ }
1333
+ }
1334
+ }
1335
+ if (!n) {
1336
+ let e = this.editorView.coordsAtPos(this.cursorPos), t = this.width / 2 * a;
1337
+ n = {
1338
+ left: e.left - t,
1339
+ right: e.left + t,
1340
+ top: e.top,
1341
+ bottom: e.bottom
1342
+ };
1343
+ }
1344
+ let s = this.editorView.dom.offsetParent;
1345
+ this.element || (this.element = s.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
1346
+ let c, l;
1347
+ if (!s || s == document.body && getComputedStyle(s).position == "static") c = -pageXOffset, l = -pageYOffset;
1348
+ else {
1349
+ let e = s.getBoundingClientRect(), t = e.width / s.offsetWidth, n = e.height / s.offsetHeight;
1350
+ c = e.left - s.scrollLeft * t, l = e.top - s.scrollTop * n;
1351
+ }
1352
+ this.element.style.left = (n.left - c) / a + "px", this.element.style.top = (n.top - l) / o + "px", this.element.style.width = (n.right - n.left) / a + "px", this.element.style.height = (n.bottom - n.top) / o + "px";
1353
+ }
1354
+ scheduleRemoval(e) {
1355
+ clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
1356
+ }
1357
+ dragover(e) {
1358
+ if (!this.editorView.editable) return;
1359
+ let t = this.editorView.posAtCoords({
1360
+ left: e.clientX,
1361
+ top: e.clientY
1362
+ }), n = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), r = n && n.type.spec.disableDropCursor, i = typeof r == "function" ? r(this.editorView, t, e) : r;
1363
+ if (t && !i) {
1364
+ let e = t.pos;
1365
+ if (this.editorView.dragging && this.editorView.dragging.slice) {
1366
+ let t = f(this.editorView.state.doc, e, this.editorView.dragging.slice);
1367
+ t != null && (e = t);
1368
+ }
1369
+ this.setCursor(e), this.scheduleRemoval(5e3);
1370
+ }
1371
+ }
1372
+ dragend() {
1373
+ this.scheduleRemoval(20);
1374
+ }
1375
+ drop() {
1376
+ this.scheduleRemoval(20);
1377
+ }
1378
+ dragleave(e) {
1379
+ this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
1380
+ }
1381
+ }, V = class e extends u {
1382
+ constructor(e) {
1383
+ super(e, e);
1384
+ }
1385
+ map(t, n) {
1386
+ let r = t.resolve(n.map(this.head));
1387
+ return e.valid(r) ? new e(r) : u.near(r);
1388
+ }
1389
+ content() {
1390
+ return n.empty;
1391
+ }
1392
+ eq(t) {
1393
+ return t instanceof e && t.head == this.head;
1394
+ }
1395
+ toJSON() {
1396
+ return {
1397
+ type: "gapcursor",
1398
+ pos: this.head
1399
+ };
1400
+ }
1401
+ static fromJSON(t, n) {
1402
+ if (typeof n.pos != "number") throw RangeError("Invalid input for GapCursor.fromJSON");
1403
+ return new e(t.resolve(n.pos));
1404
+ }
1405
+ getBookmark() {
1406
+ return new ot(this.anchor);
1407
+ }
1408
+ static valid(e) {
1409
+ let t = e.parent;
1410
+ if (t.inlineContent || !ct(e) || !lt(e)) return !1;
1411
+ let n = t.type.spec.allowGapCursor;
1412
+ if (n != null) return n;
1413
+ let r = t.contentMatchAt(e.index()).defaultType;
1414
+ return r && r.isTextblock;
1415
+ }
1416
+ static findGapCursorFrom(t, n, r = !1) {
1417
+ search: for (;;) {
1418
+ if (!r && e.valid(t)) return t;
1419
+ let i = t.pos, a = null;
1420
+ for (let r = t.depth;; r--) {
1421
+ let o = t.node(r);
1422
+ if (n > 0 ? t.indexAfter(r) < o.childCount : t.index(r) > 0) {
1423
+ a = o.child(n > 0 ? t.indexAfter(r) : t.index(r) - 1);
1424
+ break;
1425
+ } else if (r == 0) return null;
1426
+ i += n;
1427
+ let s = t.doc.resolve(i);
1428
+ if (e.valid(s)) return s;
1429
+ }
1430
+ for (;;) {
1431
+ let o = n > 0 ? a.firstChild : a.lastChild;
1432
+ if (!o) {
1433
+ if (a.isAtom && !a.isText && !E.isSelectable(a)) {
1434
+ t = t.doc.resolve(i + a.nodeSize * n), r = !1;
1435
+ continue search;
1436
+ }
1437
+ break;
1438
+ }
1439
+ a = o, i += n;
1440
+ let s = t.doc.resolve(i);
1441
+ if (e.valid(s)) return s;
1442
+ }
1443
+ return null;
1444
+ }
1445
+ }
1446
+ };
1447
+ V.prototype.visible = !1, V.findFrom = V.findGapCursorFrom, u.jsonID("gapcursor", V);
1448
+ var ot = class e {
1449
+ constructor(e) {
1450
+ this.pos = e;
1451
+ }
1452
+ map(t) {
1453
+ return new e(t.map(this.pos));
1454
+ }
1455
+ resolve(e) {
1456
+ let t = e.resolve(this.pos);
1457
+ return V.valid(t) ? new V(t) : u.near(t);
1458
+ }
1459
+ };
1460
+ function st(e) {
1461
+ return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
1462
+ }
1463
+ function ct(e) {
1464
+ for (let t = e.depth; t >= 0; t--) {
1465
+ let n = e.index(t), r = e.node(t);
1466
+ if (n == 0) {
1467
+ if (r.type.spec.isolating) return !0;
1468
+ continue;
1469
+ }
1470
+ for (let e = r.child(n - 1);; e = e.lastChild) {
1471
+ if (e.childCount == 0 && !e.inlineContent || st(e.type)) return !0;
1472
+ if (e.inlineContent) return !1;
1473
+ }
1474
+ }
1475
+ return !0;
1476
+ }
1477
+ function lt(e) {
1478
+ for (let t = e.depth; t >= 0; t--) {
1479
+ let n = e.indexAfter(t), r = e.node(t);
1480
+ if (n == r.childCount) {
1481
+ if (r.type.spec.isolating) return !0;
1482
+ continue;
1483
+ }
1484
+ for (let e = r.child(n);; e = e.firstChild) {
1485
+ if (e.childCount == 0 && !e.inlineContent || st(e.type)) return !0;
1486
+ if (e.inlineContent) return !1;
1487
+ }
1488
+ }
1489
+ return !0;
1490
+ }
1491
+ function ut() {
1492
+ return new _({ props: {
1493
+ decorations: mt,
1494
+ createSelectionBetween(e, t, n) {
1495
+ return t.pos == n.pos && V.valid(n) ? new V(n) : null;
1496
+ },
1497
+ handleClick: ft,
1498
+ handleKeyDown: dt,
1499
+ handleDOMEvents: { beforeinput: pt }
1500
+ } });
1501
+ }
1502
+ var dt = te({
1503
+ ArrowLeft: H("horiz", -1),
1504
+ ArrowRight: H("horiz", 1),
1505
+ ArrowUp: H("vert", -1),
1506
+ ArrowDown: H("vert", 1)
1507
+ });
1508
+ function H(t, n) {
1509
+ let r = t == "vert" ? n > 0 ? "down" : "up" : n > 0 ? "right" : "left";
1510
+ return function(t, i, a) {
1511
+ let o = t.selection, s = n > 0 ? o.$to : o.$from, c = o.empty;
1512
+ if (o instanceof e) {
1513
+ if (!a.endOfTextblock(r) || s.depth == 0) return !1;
1514
+ c = !1, s = t.doc.resolve(n > 0 ? s.after() : s.before());
1515
+ }
1516
+ let l = V.findGapCursorFrom(s, n, c);
1517
+ return l ? (i && i(t.tr.setSelection(new V(l))), !0) : !1;
1518
+ };
1519
+ }
1520
+ function ft(e, t, n) {
1521
+ if (!e || !e.editable) return !1;
1522
+ let r = e.state.doc.resolve(t);
1523
+ if (!V.valid(r)) return !1;
1524
+ let i = e.posAtCoords({
1525
+ left: n.clientX,
1526
+ top: n.clientY
1527
+ });
1528
+ return i && i.inside > -1 && E.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new V(r))), !0);
1529
+ }
1530
+ function pt(t, i) {
1531
+ if (i.inputType != "insertCompositionText" || !(t.state.selection instanceof V)) return !1;
1532
+ let { $from: a } = t.state.selection, o = a.parent.contentMatchAt(a.index()).findWrapping(t.state.schema.nodes.text);
1533
+ if (!o) return !1;
1534
+ let s = r.empty;
1535
+ for (let e = o.length - 1; e >= 0; e--) s = r.from(o[e].createAndFill(null, s));
1536
+ let c = t.state.tr.replace(a.pos, a.pos, new n(s, 0, 0));
1537
+ return c.setSelection(e.near(c.doc.resolve(a.pos + 1))), t.dispatch(c), !1;
1538
+ }
1539
+ function mt(e) {
1540
+ if (!(e.selection instanceof V)) return null;
1541
+ let t = document.createElement("div");
1542
+ return t.className = "ProseMirror-gapcursor", w.create(e.doc, [h.widget(e.selection.head, t, { key: "gapcursor" })]);
1543
+ }
1544
+ //#endregion
1545
+ //#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
1546
+ var U = 200, W = function() {};
1547
+ W.prototype.append = function(e) {
1548
+ return e.length ? (e = W.from(e), !this.length && e || e.length < U && this.leafAppend(e) || this.length < U && e.leafPrepend(this) || this.appendInner(e)) : this;
1549
+ }, W.prototype.prepend = function(e) {
1550
+ return e.length ? W.from(e).append(this) : this;
1551
+ }, W.prototype.appendInner = function(e) {
1552
+ return new gt(this, e);
1553
+ }, W.prototype.slice = function(e, t) {
1554
+ return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? W.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
1555
+ }, W.prototype.get = function(e) {
1556
+ if (!(e < 0 || e >= this.length)) return this.getInner(e);
1557
+ }, W.prototype.forEach = function(e, t, n) {
1558
+ t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
1559
+ }, W.prototype.map = function(e, t, n) {
1560
+ t === void 0 && (t = 0), n === void 0 && (n = this.length);
1561
+ var r = [];
1562
+ return this.forEach(function(t, n) {
1563
+ return r.push(e(t, n));
1564
+ }, t, n), r;
1565
+ }, W.from = function(e) {
1566
+ return e instanceof W ? e : e && e.length ? new ht(e) : W.empty;
1567
+ };
1568
+ var ht = /* @__PURE__ */ function(e) {
1569
+ function t(t) {
1570
+ e.call(this), this.values = t;
1571
+ }
1572
+ e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t;
1573
+ var n = {
1574
+ length: { configurable: !0 },
1575
+ depth: { configurable: !0 }
1576
+ };
1577
+ return t.prototype.flatten = function() {
1578
+ return this.values;
1579
+ }, t.prototype.sliceInner = function(e, n) {
1580
+ return e == 0 && n == this.length ? this : new t(this.values.slice(e, n));
1581
+ }, t.prototype.getInner = function(e) {
1582
+ return this.values[e];
1583
+ }, t.prototype.forEachInner = function(e, t, n, r) {
1584
+ for (var i = t; i < n; i++) if (e(this.values[i], r + i) === !1) return !1;
1585
+ }, t.prototype.forEachInvertedInner = function(e, t, n, r) {
1586
+ for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
1587
+ }, t.prototype.leafAppend = function(e) {
1588
+ if (this.length + e.length <= U) return new t(this.values.concat(e.flatten()));
1589
+ }, t.prototype.leafPrepend = function(e) {
1590
+ if (this.length + e.length <= U) return new t(e.flatten().concat(this.values));
1591
+ }, n.length.get = function() {
1592
+ return this.values.length;
1593
+ }, n.depth.get = function() {
1594
+ return 0;
1595
+ }, Object.defineProperties(t.prototype, n), t;
1596
+ }(W);
1597
+ W.empty = new ht([]);
1598
+ var gt = /* @__PURE__ */ function(e) {
1599
+ function t(t, n) {
1600
+ e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
1601
+ }
1602
+ return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t.prototype.flatten = function() {
1603
+ return this.left.flatten().concat(this.right.flatten());
1604
+ }, t.prototype.getInner = function(e) {
1605
+ return e < this.left.length ? this.left.get(e) : this.right.get(e - this.left.length);
1606
+ }, t.prototype.forEachInner = function(e, t, n, r) {
1607
+ var i = this.left.length;
1608
+ if (t < i && this.left.forEachInner(e, t, Math.min(n, i), r) === !1 || n > i && this.right.forEachInner(e, Math.max(t - i, 0), Math.min(this.length, n) - i, r + i) === !1) return !1;
1609
+ }, t.prototype.forEachInvertedInner = function(e, t, n, r) {
1610
+ var i = this.left.length;
1611
+ if (t > i && this.right.forEachInvertedInner(e, t - i, Math.max(n, i) - i, r + i) === !1 || n < i && this.left.forEachInvertedInner(e, Math.min(t, i), n, r) === !1) return !1;
1612
+ }, t.prototype.sliceInner = function(e, t) {
1613
+ if (e == 0 && t == this.length) return this;
1614
+ var n = this.left.length;
1615
+ return t <= n ? this.left.slice(e, t) : e >= n ? this.right.slice(e - n, t - n) : this.left.slice(e, n).append(this.right.slice(0, t - n));
1616
+ }, t.prototype.leafAppend = function(e) {
1617
+ var n = this.right.leafAppend(e);
1618
+ if (n) return new t(this.left, n);
1619
+ }, t.prototype.leafPrepend = function(e) {
1620
+ var n = this.left.leafPrepend(e);
1621
+ if (n) return new t(n, this.right);
1622
+ }, t.prototype.appendInner = function(e) {
1623
+ return this.left.depth >= Math.max(this.right.depth, e.depth) + 1 ? new t(this.left, new t(this.right, e)) : new t(this, e);
1624
+ }, t;
1625
+ }(W), _t = 500, G = class e {
1626
+ constructor(e, t) {
1627
+ this.items = e, this.eventCount = t;
1628
+ }
1629
+ popEvent(t, n) {
1630
+ if (this.eventCount == 0) return null;
1631
+ let r = this.items.length;
1632
+ for (;; r--) if (this.items.get(r - 1).selection) {
1633
+ --r;
1634
+ break;
1635
+ }
1636
+ let i, a;
1637
+ n && (i = this.remapping(r, this.items.length), a = i.maps.length);
1638
+ let o = t.tr, s, c, l = [], u = [];
1639
+ return this.items.forEach((t, n) => {
1640
+ if (!t.step) {
1641
+ i || (i = this.remapping(r, n + 1), a = i.maps.length), a--, u.push(t);
1642
+ return;
1643
+ }
1644
+ if (i) {
1645
+ u.push(new K(t.map));
1646
+ let e = t.step.map(i.slice(a)), n;
1647
+ e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new K(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
1648
+ } else o.maybeStep(t.step);
1649
+ if (t.selection) return s = i ? t.selection.map(i.slice(a)) : t.selection, c = new e(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
1650
+ }, this.items.length, 0), {
1651
+ remaining: c,
1652
+ transform: o,
1653
+ selection: s
1654
+ };
1655
+ }
1656
+ addTransform(t, n, r, i) {
1657
+ let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
1658
+ for (let e = 0; e < t.steps.length; e++) {
1659
+ let r = t.steps[e].invert(t.docs[e]), l = new K(t.mapping.maps[e], r, n), u;
1660
+ (u = c && c.merge(l)) && (l = u, e ? a.pop() : s = s.slice(0, s.length - 1)), a.push(l), n &&= (o++, void 0), i || (c = l);
1661
+ }
1662
+ let l = o - r.depth;
1663
+ return l > yt && (s = vt(s, l), o -= l), new e(s.append(a), o);
1664
+ }
1665
+ remapping(e, t) {
1666
+ let n = new oe();
1667
+ return this.items.forEach((t, r) => {
1668
+ let i = t.mirrorOffset != null && r - t.mirrorOffset >= e ? n.maps.length - t.mirrorOffset : void 0;
1669
+ n.appendMap(t.map, i);
1670
+ }, e, t), n;
1671
+ }
1672
+ addMaps(t) {
1673
+ return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new K(e))), this.eventCount);
1674
+ }
1675
+ rebased(t, n) {
1676
+ if (!this.eventCount) return this;
1677
+ let r = [], i = Math.max(0, this.items.length - n), a = t.mapping, o = t.steps.length, s = this.eventCount;
1678
+ this.items.forEach((e) => {
1679
+ e.selection && s--;
1680
+ }, i);
1681
+ let c = n;
1682
+ this.items.forEach((e) => {
1683
+ let n = a.getMirror(--c);
1684
+ if (n == null) return;
1685
+ o = Math.min(o, n);
1686
+ let i = a.maps[n];
1687
+ if (e.step) {
1688
+ let o = t.steps[n].invert(t.docs[n]), l = e.selection && e.selection.map(a.slice(c + 1, n));
1689
+ l && s++, r.push(new K(i, o, l));
1690
+ } else r.push(new K(i));
1691
+ }, i);
1692
+ let l = [];
1693
+ for (let e = n; e < o; e++) l.push(new K(a.maps[e]));
1694
+ let u = new e(this.items.slice(0, i).append(l).append(r), s);
1695
+ return u.emptyItemCount() > _t && (u = u.compress(this.items.length - r.length)), u;
1696
+ }
1697
+ emptyItemCount() {
1698
+ let e = 0;
1699
+ return this.items.forEach((t) => {
1700
+ t.step || e++;
1701
+ }), e;
1702
+ }
1703
+ compress(t = this.items.length) {
1704
+ let n = this.remapping(0, t), r = n.maps.length, i = [], a = 0;
1705
+ return this.items.forEach((e, o) => {
1706
+ if (o >= t) i.push(e), e.selection && a++;
1707
+ else if (e.step) {
1708
+ let t = e.step.map(n.slice(r)), o = t && t.getMap();
1709
+ if (r--, o && n.appendMap(o, r), t) {
1710
+ let s = e.selection && e.selection.map(n.slice(r));
1711
+ s && a++;
1712
+ let c = new K(o.invert(), t, s), l, u = i.length - 1;
1713
+ (l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
1714
+ }
1715
+ } else e.map && r--;
1716
+ }, this.items.length, 0), new e(W.from(i.reverse()), a);
1717
+ }
1718
+ };
1719
+ G.empty = new G(W.empty, 0);
1720
+ function vt(e, t) {
1721
+ let n;
1722
+ return e.forEach((e, r) => {
1723
+ if (e.selection && t-- == 0) return n = r, !1;
1724
+ }), e.slice(n);
1725
+ }
1726
+ var K = class e {
1727
+ constructor(e, t, n, r) {
1728
+ this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
1729
+ }
1730
+ merge(t) {
1731
+ if (this.step && t.step && !t.selection) {
1732
+ let n = t.step.merge(this.step);
1733
+ if (n) return new e(n.getMap().invert(), n, this.selection);
1734
+ }
1735
+ }
1736
+ }, q = class {
1737
+ constructor(e, t, n, r, i) {
1738
+ this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
1739
+ }
1740
+ }, yt = 20;
1741
+ function bt(e, t, n, r) {
1742
+ let i = n.getMeta(Z), a;
1743
+ if (i) return i.historyState;
1744
+ n.getMeta(Tt) && (e = new q(e.done, e.undone, null, 0, -1));
1745
+ let o = n.getMeta("appendedTransaction");
1746
+ if (n.steps.length == 0) return e;
1747
+ if (o && o.getMeta(Z)) return o.getMeta(Z).redo ? new q(e.done.addTransform(n, void 0, r, X(t)), e.undone, St(n.mapping.maps), e.prevTime, e.prevComposition) : new q(e.done, e.undone.addTransform(n, void 0, r, X(t)), null, e.prevTime, e.prevComposition);
1748
+ if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
1749
+ let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !xt(n, e.prevRanges)), s = o ? J(e.prevRanges, n.mapping) : St(n.mapping.maps);
1750
+ return new q(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, X(t)), G.empty, s, n.time, i ?? e.prevComposition);
1751
+ } else if (a = n.getMeta("rebased")) return new q(e.done.rebased(n, a), e.undone.rebased(n, a), J(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
1752
+ else return new q(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), J(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
1753
+ }
1754
+ function xt(e, t) {
1755
+ if (!t) return !1;
1756
+ if (!e.docChanged) return !0;
1757
+ let n = !1;
1758
+ return e.mapping.maps[0].forEach((e, r) => {
1759
+ for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
1760
+ }), n;
1761
+ }
1762
+ function St(e) {
1763
+ let t = [];
1764
+ for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
1765
+ return t;
1766
+ }
1767
+ function J(e, t) {
1768
+ if (!e) return null;
1769
+ let n = [];
1770
+ for (let r = 0; r < e.length; r += 2) {
1771
+ let i = t.map(e[r], 1), a = t.map(e[r + 1], -1);
1772
+ i <= a && n.push(i, a);
1773
+ }
1774
+ return n;
1775
+ }
1776
+ function Ct(e, t, n) {
1777
+ let r = X(t), i = Z.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
1778
+ if (!a) return null;
1779
+ let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new q(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
1780
+ return a.transform.setSelection(o).setMeta(Z, {
1781
+ redo: n,
1782
+ historyState: c
1783
+ });
1784
+ }
1785
+ var Y = !1, wt = null;
1786
+ function X(e) {
1787
+ let t = e.plugins;
1788
+ if (wt != t) {
1789
+ Y = !1, wt = t;
1790
+ for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
1791
+ Y = !0;
1792
+ break;
1793
+ }
1794
+ }
1795
+ return Y;
1796
+ }
1797
+ var Z = new T("history"), Tt = new T("closeHistory");
1798
+ function Et(e = {}) {
1799
+ return e = {
1800
+ depth: e.depth || 100,
1801
+ newGroupDelay: e.newGroupDelay || 500
1802
+ }, new _({
1803
+ key: Z,
1804
+ state: {
1805
+ init() {
1806
+ return new q(G.empty, G.empty, null, 0, -1);
1807
+ },
1808
+ apply(t, n, r) {
1809
+ return bt(n, r, t, e);
1810
+ }
1811
+ },
1812
+ config: e,
1813
+ props: { handleDOMEvents: { beforeinput(e, t) {
1814
+ let n = t.inputType, r = n == "historyUndo" ? Q : n == "historyRedo" ? Ot : null;
1815
+ return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
1816
+ } } }
1817
+ });
1818
+ }
1819
+ function Dt(e, t) {
1820
+ return (n, r) => {
1821
+ let i = Z.getState(n);
1822
+ if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
1823
+ if (r) {
1824
+ let a = Ct(i, n, e);
1825
+ a && r(t ? a.scrollIntoView() : a);
1826
+ }
1827
+ return !0;
1828
+ };
1829
+ }
1830
+ var Q = Dt(!1, !0), Ot = Dt(!0, !0);
1831
+ b.create({
1832
+ name: "characterCount",
1833
+ addOptions() {
1834
+ return {
1835
+ limit: null,
1836
+ mode: "textSize",
1837
+ textCounter: (e) => e.length,
1838
+ wordCounter: (e) => e.split(" ").filter((e) => e !== "").length
1839
+ };
1840
+ },
1841
+ addStorage() {
1842
+ return {
1843
+ characters: () => 0,
1844
+ words: () => 0
1845
+ };
1846
+ },
1847
+ onBeforeCreate() {
1848
+ this.storage.characters = (e) => {
1849
+ let t = e?.node || this.editor.state.doc;
1850
+ if ((e?.mode || this.options.mode) === "textSize") {
1851
+ let e = t.textBetween(0, t.content.size, void 0, " ");
1852
+ return this.options.textCounter(e);
1853
+ }
1854
+ return t.nodeSize;
1855
+ }, this.storage.words = (e) => {
1856
+ let t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
1857
+ return this.options.wordCounter(n);
1858
+ };
1859
+ },
1860
+ addProseMirrorPlugins() {
1861
+ let e = !1;
1862
+ return [new _({
1863
+ key: new T("characterCount"),
1864
+ appendTransaction: (t, n, r) => {
1865
+ if (e) return;
1866
+ let i = this.options.limit;
1867
+ if (i == null || i === 0) {
1868
+ e = !0;
1869
+ return;
1870
+ }
1871
+ let a = this.storage.characters({ node: r.doc });
1872
+ if (a > i) {
1873
+ let t = a - i;
1874
+ console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);
1875
+ let n = r.tr.deleteRange(0, t);
1876
+ return e = !0, n;
1877
+ }
1878
+ e = !0;
1879
+ },
1880
+ filterTransaction: (e, t) => {
1881
+ let n = this.options.limit;
1882
+ if (!e.docChanged || n === 0 || n == null) return !0;
1883
+ let r = this.storage.characters({ node: t.doc }), i = this.storage.characters({ node: e.doc });
1884
+ if (i <= n || r > n && i > n && i <= r) return !0;
1885
+ if (r > n && i > n && i > r || !e.getMeta("paste")) return !1;
1886
+ let a = e.selection.$head.pos, o = a - (i - n), s = a;
1887
+ return e.deleteRange(o, s), !(this.storage.characters({ node: e.doc }) > n);
1888
+ }
1889
+ })];
1890
+ }
1891
+ });
1892
+ var kt = b.create({
1893
+ name: "dropCursor",
1894
+ addOptions() {
1895
+ return {
1896
+ color: "currentColor",
1897
+ width: 1,
1898
+ class: void 0
1899
+ };
1900
+ },
1901
+ addProseMirrorPlugins() {
1902
+ return [it(this.options)];
1903
+ }
1904
+ });
1905
+ b.create({
1906
+ name: "focus",
1907
+ addOptions() {
1908
+ return {
1909
+ className: "has-focus",
1910
+ mode: "all"
1911
+ };
1912
+ },
1913
+ addProseMirrorPlugins() {
1914
+ return [new _({
1915
+ key: new T("focus"),
1916
+ props: { decorations: ({ doc: e, selection: t }) => {
1917
+ let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
1918
+ if (!n || !r) return w.create(e, []);
1919
+ let o = 0;
1920
+ this.options.mode === "deepest" && e.descendants((e, t) => {
1921
+ if (!e.isText) {
1922
+ if (!(i >= t && i <= t + e.nodeSize - 1)) return !1;
1923
+ o += 1;
1924
+ }
1925
+ });
1926
+ let s = 0;
1927
+ return e.descendants((e, t) => {
1928
+ if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
1929
+ if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
1930
+ a.push(h.node(t, t + e.nodeSize, { class: this.options.className }));
1931
+ }), w.create(e, a);
1932
+ } }
1933
+ })];
1934
+ }
1935
+ });
1936
+ var At = b.create({
1937
+ name: "gapCursor",
1938
+ addProseMirrorPlugins() {
1939
+ return [ut()];
1940
+ },
1941
+ extendNodeSchema(e) {
1942
+ return { allowGapCursor: ee(m(e, "allowGapCursor", {
1943
+ name: e.name,
1944
+ options: e.options,
1945
+ storage: e.storage
1946
+ })) ?? null };
1947
+ }
1948
+ }), jt = "placeholder";
1949
+ function Mt(e) {
1950
+ return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
1951
+ }
1952
+ b.create({
1953
+ name: "placeholder",
1954
+ addOptions() {
1955
+ return {
1956
+ emptyEditorClass: "is-editor-empty",
1957
+ emptyNodeClass: "is-empty",
1958
+ dataAttribute: jt,
1959
+ placeholder: "Write something …",
1960
+ showOnlyWhenEditable: !0,
1961
+ showOnlyCurrent: !0,
1962
+ includeChildren: !1
1963
+ };
1964
+ },
1965
+ addProseMirrorPlugins() {
1966
+ let e = this.options.dataAttribute ? `data-${Mt(this.options.dataAttribute)}` : `data-${jt}`;
1967
+ return [new _({
1968
+ key: new T("placeholder"),
1969
+ props: { decorations: ({ doc: t, selection: n }) => {
1970
+ let r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: i } = n, a = [];
1971
+ if (!r) return null;
1972
+ let o = this.editor.isEmpty;
1973
+ return t.descendants((t, n) => {
1974
+ let r = i >= n && i <= n + t.nodeSize, c = !t.isLeaf && s(t);
1975
+ if (!t.type.isTextblock) return this.options.includeChildren;
1976
+ if ((r || !this.options.showOnlyCurrent) && c) {
1977
+ let i = [this.options.emptyNodeClass];
1978
+ o && i.push(this.options.emptyEditorClass);
1979
+ let s = h.node(n, n + t.nodeSize, {
1980
+ class: i.join(" "),
1981
+ [e]: typeof this.options.placeholder == "function" ? this.options.placeholder({
1982
+ editor: this.editor,
1983
+ node: t,
1984
+ pos: n,
1985
+ hasAnchor: r
1986
+ }) : this.options.placeholder
1987
+ });
1988
+ a.push(s);
1989
+ }
1990
+ return this.options.includeChildren;
1991
+ }), w.create(t, a);
1992
+ } }
1993
+ })];
1994
+ }
1995
+ }), b.create({
1996
+ name: "selection",
1997
+ addOptions() {
1998
+ return { className: "selection" };
1999
+ },
2000
+ addProseMirrorPlugins() {
2001
+ let { editor: e, options: t } = this;
2002
+ return [new _({
2003
+ key: new T("selection"),
2004
+ props: { decorations(n) {
2005
+ return n.selection.empty || e.isFocused || !e.isEditable || c(n.selection) || e.view.dragging ? null : w.create(n.doc, [h.inline(n.selection.from, n.selection.to, { class: t.className })]);
2006
+ } }
2007
+ })];
2008
+ }
2009
+ });
2010
+ function Nt({ types: e, node: t }) {
2011
+ return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
2012
+ }
2013
+ var Pt = b.create({
2014
+ name: "trailingNode",
2015
+ addOptions() {
2016
+ return {
2017
+ node: void 0,
2018
+ notAfter: []
2019
+ };
2020
+ },
2021
+ addProseMirrorPlugins() {
2022
+ let e = new T(this.name), t = this.options.node || this.editor.schema.topNodeType.contentMatch.defaultType?.name || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, e]) => e).filter((e) => (this.options.notAfter || []).concat(t).includes(e.name));
2023
+ return [new _({
2024
+ key: e,
2025
+ appendTransaction: (n, r, i) => {
2026
+ let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
2027
+ if (!n.some((e) => e.getMeta("skipTrailingNode")) && c) return o.insert(l, u.create());
2028
+ },
2029
+ state: {
2030
+ init: (e, t) => {
2031
+ let r = t.tr.doc.lastChild;
2032
+ return !Nt({
2033
+ node: r,
2034
+ types: n
2035
+ });
2036
+ },
2037
+ apply: (e, t) => {
2038
+ if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
2039
+ let r = e.doc.lastChild;
2040
+ return !Nt({
2041
+ node: r,
2042
+ types: n
2043
+ });
2044
+ }
2045
+ }
2046
+ })];
2047
+ }
2048
+ }), Ft = b.create({
2049
+ name: "undoRedo",
2050
+ addOptions() {
2051
+ return {
2052
+ depth: 100,
2053
+ newGroupDelay: 500
2054
+ };
2055
+ },
2056
+ addCommands() {
2057
+ return {
2058
+ undo: () => ({ state: e, dispatch: t }) => Q(e, t),
2059
+ redo: () => ({ state: e, dispatch: t }) => Ot(e, t)
2060
+ };
2061
+ },
2062
+ addProseMirrorPlugins() {
2063
+ return [Et(this.options)];
2064
+ },
2065
+ addKeyboardShortcuts() {
2066
+ return {
2067
+ "Mod-z": () => this.editor.commands.undo(),
2068
+ "Shift-Mod-z": () => this.editor.commands.redo(),
2069
+ "Mod-y": () => this.editor.commands.redo(),
2070
+ "Mod-я": () => this.editor.commands.undo(),
2071
+ "Shift-Mod-я": () => this.editor.commands.redo()
2072
+ };
2073
+ }
2074
+ }), $ = b.create({
2075
+ name: "starterKit",
2076
+ addExtensions() {
2077
+ let e = [];
2078
+ return this.options.bold !== !1 && e.push(he.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(ue.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(j.configure(this.options.bulletList)), this.options.code !== !1 && e.push(ve.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(xe.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(Se.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(kt.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(At.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Ce.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(we.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(Ft.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(Te.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(Ae.configure(this.options.italic)), this.options.listItem !== !1 && e.push(M.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Re.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(se.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Ye.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push($e.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(nt.configure(this.options.strike)), this.options.text !== !1 && e.push(rt.configure(this.options.text)), this.options.underline !== !1 && e.push(ce.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(Pt.configure(this.options?.trailingNode)), e;
2079
+ }
2080
+ }), It = $;
2081
+ //#endregion
2082
+ export { $ as StarterKit, It as default };