@templatical/editor 0.0.1 → 0.0.3

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 (130) hide show
  1. package/dist/AiChatSidebar-busJk9hm.js +214 -0
  2. package/dist/AiFeatureMenu-DLGv_-pj.js +63 -0
  3. package/dist/CloudEditor-BDnHd6Um.js +919 -0
  4. package/dist/CollaboratorBar-Dv3l52vC.js +91 -0
  5. package/dist/CommentsSidebar-4tjp0VU5.js +439 -0
  6. package/dist/DesignReferenceSidebar-CmwXvltV.js +273 -0
  7. package/dist/LoadingTrack-vK8W2PJf.js +10 -0
  8. package/dist/ModuleBrowserModal-lrk3Fr0H.js +205 -0
  9. package/dist/ModulePreviewCanvas-BcBJLnwL.js +106 -0
  10. package/dist/ParagraphEditor-DH8cSC6m.js +625 -0
  11. package/dist/RichTextEditorContent-CQqodi7p.js +133 -0
  12. package/dist/SaveModuleDialog-Bmzi72td.js +122 -0
  13. package/dist/SnapshotHistory-AEgi9Xsn.js +126 -0
  14. package/dist/TemplateScoringPanel-CTgMtc0-.js +249 -0
  15. package/dist/TestEmailModal-Dpq1is9S.js +94 -0
  16. package/dist/TitleEditor-CLcDdcWI.js +167 -0
  17. package/dist/TplModal-CGzRjR96.js +44 -0
  18. package/dist/_plugin-vue_export-helper-B1-bu7yR.js +47 -0
  19. package/dist/blockTypeIcons-BpPTqcok.js +126 -0
  20. package/dist/cdn/chunks/ParagraphEditor-CCtWbGDv.js +3 -0
  21. package/dist/cdn/chunks/ParagraphEditor-CCtWbGDv.js.map +1 -0
  22. package/dist/cdn/chunks/RichTextEditorContent-BUD9veXd.js +2 -0
  23. package/dist/cdn/chunks/RichTextEditorContent-BUD9veXd.js.map +1 -0
  24. package/dist/cdn/chunks/TitleEditor-e_UTyxjd.js +3 -0
  25. package/dist/cdn/chunks/TitleEditor-e_UTyxjd.js.map +1 -0
  26. package/dist/cdn/chunks/dist-0UheN8rK.js +1 -0
  27. package/dist/cdn/chunks/dist-55mmbGQ9.js +1 -0
  28. package/dist/cdn/chunks/dist-B31mxKyP.js +1 -0
  29. package/dist/cdn/chunks/dist-B5JI9nIg.js +1 -0
  30. package/dist/cdn/chunks/dist-B93vLKhU.js +1 -0
  31. package/dist/cdn/chunks/dist-BDt3FJvj.js +1 -0
  32. package/dist/cdn/chunks/dist-BJRuFHmi.js +1 -0
  33. package/dist/cdn/chunks/dist-BKSzrf0L.js +1 -0
  34. package/dist/cdn/chunks/dist-BL8c5gYQ.js +1 -0
  35. package/dist/cdn/chunks/dist-CYThWMP5.js +1 -0
  36. package/dist/cdn/chunks/dist-DxZbPJYt.js +1 -0
  37. package/dist/cdn/chunks/draggable-ClUwYCFL.js +17 -0
  38. package/dist/cdn/chunks/draggable-ClUwYCFL.js.map +1 -0
  39. package/dist/cdn/chunks/emojiData-6fVLNqeH.js +2 -0
  40. package/dist/cdn/chunks/emojiData-6fVLNqeH.js.map +1 -0
  41. package/dist/cdn/chunks/extensions-ea_ewKUl.js +2 -0
  42. package/dist/cdn/chunks/extensions-ea_ewKUl.js.map +1 -0
  43. package/dist/cdn/chunks/icons-vmLJTaJk.js +2 -0
  44. package/dist/cdn/chunks/icons-vmLJTaJk.js.map +1 -0
  45. package/dist/cdn/chunks/rolldown-runtime-BakkzWXw.js +1 -0
  46. package/dist/cdn/chunks/styleConstants-CNejCb-L.js +2 -0
  47. package/dist/cdn/chunks/styleConstants-CNejCb-L.js.map +1 -0
  48. package/dist/cdn/chunks/tiptap-Cya4P9CN.js +145 -0
  49. package/dist/cdn/chunks/tiptap-Cya4P9CN.js.map +1 -0
  50. package/dist/cdn/chunks/useEditorCore-CwuxQuvh.js +2 -0
  51. package/dist/cdn/chunks/useEditorCore-CwuxQuvh.js.map +1 -0
  52. package/dist/cdn/chunks/useMergeTag-DVOz1v9p.js +2 -0
  53. package/dist/cdn/chunks/useMergeTag-DVOz1v9p.js.map +1 -0
  54. package/dist/cdn/editor.css +1 -0
  55. package/dist/cdn/editor.js +2 -0
  56. package/dist/cdn/editor.js.map +1 -0
  57. package/dist/check-B7kDuZmP.js +7 -0
  58. package/dist/chevron-down-DJLW2Q9Z.js +7 -0
  59. package/dist/circle-alert-E2vYPs5r.js +25 -0
  60. package/dist/clock-lWIIQA3C.js +12 -0
  61. package/dist/de-B4Ob4vCo.js +682 -0
  62. package/dist/dist-4LiM9FDd.js +35 -0
  63. package/dist/dist-Bu7veieH.js +776 -0
  64. package/dist/dist-C1BIRHCQ.js +61 -0
  65. package/dist/dist-CG-vEqSU.js +314 -0
  66. package/dist/dist-C_ymrGFi.js +10625 -0
  67. package/dist/dist-ChAGLpWo.js +35 -0
  68. package/dist/dist-D_HQYSY-.js +189 -0
  69. package/dist/dist-DkypH7qG.js +5 -0
  70. package/dist/dist-DmOE-Ubp.js +74 -0
  71. package/dist/dist-DmpMJbmZ.js +513 -0
  72. package/dist/dist-DrvKRSU6.js +47 -0
  73. package/dist/dist-Dxnd0GRf.js +5 -0
  74. package/dist/dist-DysAFIPy.js +2054 -0
  75. package/dist/emojiData-BfWQS72m.js +17 -0
  76. package/dist/en-YXsspZJG.js +682 -0
  77. package/dist/extensions-CKM99njP.js +420 -0
  78. package/dist/formatRelativeTime-DX3FgqN9.js +8 -0
  79. package/dist/i18n-CJsFtdbZ.js +23 -0
  80. package/dist/image-up-X4xIq4ea.js +23 -0
  81. package/dist/keys-Dwa2PmdD.js +10 -0
  82. package/dist/liquid.browser-BemTg3sZ.js +3272 -0
  83. package/dist/loader-circle-BTQQxC3l.js +7 -0
  84. package/dist/message-circle-Blgm6V_h.js +7 -0
  85. package/dist/refresh-cw-Bb4PEeW1.js +44 -0
  86. package/dist/scan-line-7lZPfOdm.js +25 -0
  87. package/dist/send-C0ltAQrv.js +10 -0
  88. package/dist/shield-check-f-qv4RKs.js +10 -0
  89. package/dist/sparkles-KhBCGlqB.js +23 -0
  90. package/dist/styleConstants-D4SOZGBV.js +94 -0
  91. package/dist/styles-DSw1VNU3.js +3406 -0
  92. package/dist/templatical-editor.css +2 -1
  93. package/dist/templatical-editor.js +242 -9
  94. package/dist/templatical-editor.umd.cjs +112 -524
  95. package/dist/timeouts-CmBrLeZA.js +4 -0
  96. package/dist/trash-2-OwjZ-guZ.js +25 -0
  97. package/dist/triangle-alert-DOSRIUYZ.js +17 -0
  98. package/dist/useEditorCore-Cc4RCwWq.js +5556 -0
  99. package/dist/useI18n-DUirdXEX.js +17 -0
  100. package/dist/useMergeTag-DVnlvPYJ.js +33 -0
  101. package/dist/x-CGlq2XQe.js +10 -0
  102. package/package.json +30 -20
  103. package/dist/AiChatSidebar-0vx9TP5B.js +0 -305
  104. package/dist/AiFeatureMenu-CI-v74ND.js +0 -69
  105. package/dist/CloudEditor-Wdfv_9xn.js +0 -1132
  106. package/dist/CollaboratorBar-B3uV4Wtw.js +0 -89
  107. package/dist/CommentsSidebar-PVUlloyB.js +0 -655
  108. package/dist/DesignReferenceSidebar-DAlAWrxU.js +0 -351
  109. package/dist/ModuleBrowserModal-1JEcChd8.js +0 -323
  110. package/dist/ModulePreviewCanvas-Cdp484Ae.js +0 -169
  111. package/dist/SaveModuleDialog-eNyr3XKn.js +0 -168
  112. package/dist/SnapshotHistory-D-ZiIj1v.js +0 -169
  113. package/dist/TemplateScoringPanel-DSZPo15C.js +0 -385
  114. package/dist/TestEmailModal-Cwre5elw.js +0 -128
  115. package/dist/TextEditor-BuUOIByX.js +0 -780
  116. package/dist/de-BWIAblxs.js +0 -685
  117. package/dist/en-cYyUzNV1.js +0 -685
  118. package/dist/index-0tWUczNu.js +0 -47
  119. package/dist/index-4okvXjqk.js +0 -41
  120. package/dist/index-BSc6h5zo.js +0 -967
  121. package/dist/index-CrvwWlhN.js +0 -41
  122. package/dist/index-D-iD-7lO.js +0 -10961
  123. package/dist/index-D-ygXbc8.js +0 -2452
  124. package/dist/index-DbrWKz-e.js +0 -1415
  125. package/dist/index-DeUeHy6g.js +0 -422
  126. package/dist/index-Ude6e9RU.js +0 -41
  127. package/dist/index-ZQzHBwkr.js +0 -12767
  128. package/dist/liquid.browser-CeNxS2GL.js +0 -3493
  129. package/dist/loader-circle-tM9j2mRh.js +0 -13
  130. package/dist/shield-check-Ngi9jAQc.js +0 -20
@@ -0,0 +1,2054 @@
1
+ import { Cn as e, Ct as t, En as n, Ht as r, Mt as i, Nt as a, Sn as o, St as s, Tn as c, Vt as l, Wt as u, Z as d, Zt as f, _ as p, _n as m, at as ee, bn as h, c as g, fn as _, gn as v, hn as te, i as y, jt as b, mn as x, ot as ne, qt as re, rt as ie, tn as S, u as C, v as ae, vn as w, wn as oe, xn as T, yn as E } from "./dist-C_ymrGFi.js";
2
+ import { Link as se } from "./dist-Bu7veieH.js";
3
+ import { Underline as ce } from "./dist-C1BIRHCQ.js";
4
+ //#region ../../node_modules/.bun/@tiptap+core@3.22.1+c79d51da8b4a98f1/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
+ ...u(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 [x({
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 = g.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
+ ...u(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 [l({
110
+ find: de,
111
+ type: this.type
112
+ }), l({
113
+ find: pe,
114
+ type: this.type
115
+ })];
116
+ },
117
+ addPasteRules() {
118
+ return [r({
119
+ find: fe,
120
+ type: this.type
121
+ }), r({
122
+ find: me,
123
+ type: this.type
124
+ })];
125
+ }
126
+ }), ge = /(^|[^`])`([^`]+)`(?!`)$/, _e = /(^|[^`])`([^`]+)`(?!`)/g, ve = g.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
+ u(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 [l({
162
+ find: ge,
163
+ type: this.type
164
+ })];
165
+ },
166
+ addPasteRules() {
167
+ return [r({
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
+ u(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: e }) => {
253
+ if (!this.options.enableTabIndentation) return !1;
254
+ let t = this.options.tabSize ?? O, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
255
+ return i.parent.type === this.type ? a ? e.commands.command(({ tr: e }) => {
256
+ let { pos: r } = i, a = i.start(), s = i.end(), c = n.doc.textBetween(a, s, "\n", "\n").split("\n"), l = 0, u = 0, d = r - a;
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, t);
265
+ if (p === 0) return !0;
266
+ let m = a;
267
+ for (let e = 0; e < l; e += 1) m += c[e].length + 1;
268
+ return e.delete(m, m + p), r - m <= p && e.setSelection(o.create(e.doc, m)), !0;
269
+ }) : e.commands.command(({ tr: e }) => {
270
+ let { from: i, to: a } = r, o = n.doc.textBetween(i, a, "\n", "\n").split("\n").map((e) => {
271
+ let n = e.match(/^ */)?.[0] || "", r = Math.min(n.length, t);
272
+ return e.slice(r);
273
+ }).join("\n");
274
+ return e.replaceWith(i, a, n.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(T.near(r.resolve(o))), !0)) : e.commands.exitCode();
290
+ }
291
+ };
292
+ },
293
+ addInputRules() {
294
+ return [_({
295
+ find: ye,
296
+ type: this.type,
297
+ getAttributes: (e) => ({ language: e[1] })
298
+ }), _({
299
+ find: be,
300
+ type: this.type,
301
+ getAttributes: (e) => ({ language: e[1] })
302
+ })];
303
+ },
304
+ addProseMirrorPlugins() {
305
+ return [new E({
306
+ key: new h("codeBlockVSCodeHandler"),
307
+ props: { handlePaste: (e, t) => {
308
+ if (!t.clipboardData || this.editor.isActive(this.type.name)) return !1;
309
+ let n = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), i = (r ? JSON.parse(r) : void 0)?.mode;
310
+ if (!n || !i) return !1;
311
+ let { tr: a, schema: s } = e.state, c = s.text(n.replace(/\r\n?/g, "\n"));
312
+ return a.replaceSelectionWith(this.type.create({ language: i }, c)), a.selection.$from.parent.type !== this.type && a.setSelection(o.near(a.doc.resolve(Math.max(0, a.selection.from - 2)))), a.setMeta("paste", !0), e.dispatch(a), !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", u(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
+ u(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) => _({
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", u(this.options.HTMLAttributes, e)];
440
+ },
441
+ markdownTokenName: "hr",
442
+ parseMarkdown: (e, t) => t.createNode("horizontalRule"),
443
+ renderMarkdown: () => "---",
444
+ addCommands() {
445
+ return { setHorizontalRule: () => ({ chain: e, state: t }) => {
446
+ if (!ae(t, t.schema.nodes[this.name])) return !1;
447
+ let { selection: n } = t, { $to: r } = n, i = e();
448
+ return a(n) ? i.insertContentAt(r.pos, { type: this.name }) : i.insertContent({ type: this.name }), i.command(({ state: e, tr: t, dispatch: n }) => {
449
+ if (n) {
450
+ let { $to: n } = t.selection, r = n.end();
451
+ if (n.nodeAfter) n.nodeAfter.isTextblock ? t.setSelection(o.create(t.doc, n.pos + 1)) : n.nodeAfter.isBlock ? t.setSelection(w.create(t.doc, n.pos)) : t.setSelection(o.create(t.doc, n.pos));
452
+ else {
453
+ let i = (e.schema.nodes[this.options.nextNodeType] || n.parent.type.contentMatch.defaultType)?.create();
454
+ i && (t.insert(r, i), t.setSelection(o.create(t.doc, r + 1)));
455
+ }
456
+ t.scrollIntoView();
457
+ }
458
+ return !0;
459
+ }).run();
460
+ } };
461
+ },
462
+ addInputRules() {
463
+ return [re({
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 = g.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
+ u(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 [l({
516
+ find: Ee,
517
+ type: this.type
518
+ }), l({
519
+ find: Oe,
520
+ type: this.type
521
+ })];
522
+ },
523
+ addPasteRules() {
524
+ return [r({
525
+ find: De,
526
+ type: this.type
527
+ }), r({
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
+ u(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 = x({
576
+ find: A,
577
+ type: this.type
578
+ });
579
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = x({
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
+ u(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) => S(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: () => R,
647
+ handleDelete: () => z,
648
+ hasListBefore: () => F,
649
+ hasListItemAfter: () => Ie,
650
+ hasListItemBefore: () => I,
651
+ listItemHasSubList: () => L,
652
+ nextListIsDeeper: () => Pe,
653
+ nextListIsHigher: () => Fe
654
+ });
655
+ var N = (e, t) => {
656
+ let { $from: n } = t.selection, r = ee(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
+ }, L = (e, t, n) => {
674
+ if (!n) return !1;
675
+ let r = ee(e, t.schema), i = !1;
676
+ return n.descendants((e) => {
677
+ e.type === r && (i = !0);
678
+ }), i;
679
+ }, R = (e, n, r) => {
680
+ if (e.commands.undoInputRule()) return !0;
681
+ if (e.state.selection.from !== e.state.selection.to) return !1;
682
+ if (!b(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 (!b(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 = L(n, e.state, a);
702
+ return I(n, e.state) && !o ? e.commands.joinItemBackward() : e.chain().liftListItem(n).run();
703
+ }, Pe = (e, t) => {
704
+ let n = P(e, t), r = N(e, t);
705
+ return !r || !n ? !1 : n > r.depth;
706
+ }, Fe = (e, t) => {
707
+ let n = P(e, t), r = N(e, t);
708
+ return !r || !n ? !1 : n < r.depth;
709
+ }, z = (e, t) => {
710
+ if (!b(e.state, t) || !s(e.state, t)) return !1;
711
+ let { selection: n } = e.state, { $from: r, $to: i } = n;
712
+ return !n.empty && r.sameParent(i) ? !1 : Pe(t, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(t).joinBackward().run() : Fe(t, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
713
+ }, Ie = (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
+ }, Le = y.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 && z(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 && z(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 && R(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 && R(e, n, r) && (t = !0);
751
+ }), t;
752
+ }
753
+ };
754
+ }
755
+ }), Re = /^(\s*)(\d+)\.\s+(.*)$/, ze = /^\s/;
756
+ function Be(e) {
757
+ let t = [], n = 0, r = 0;
758
+ for (; n < e.length;) {
759
+ let i = e[n], a = i.match(Re);
760
+ if (!a) break;
761
+ let [, o, s, c] = a, l = o.length, u = c, d = n + 1, f = [i];
762
+ for (; d < e.length;) {
763
+ let t = e[d];
764
+ if (t.match(Re)) break;
765
+ if (t.trim() === "") f.push(t), u += "\n", d += 1;
766
+ else if (t.match(ze)) f.push(t), u += `
767
+ ${t.slice(l + 2)}`, d += 1;
768
+ else break;
769
+ }
770
+ t.push({
771
+ indent: l,
772
+ number: parseInt(s, 10),
773
+ content: u.trim(),
774
+ raw: f.join("\n")
775
+ }), r = d, n = d;
776
+ }
777
+ return [t, r];
778
+ }
779
+ function Ve(e, t, n) {
780
+ let r = [], i = 0;
781
+ for (; i < e.length;) {
782
+ let a = e[i];
783
+ if (a.indent === t) {
784
+ let o = a.content.split("\n"), s = o[0]?.trim() || "", c = [];
785
+ s && c.push({
786
+ type: "paragraph",
787
+ raw: s,
788
+ tokens: n.inlineTokens(s)
789
+ });
790
+ let l = o.slice(1).join("\n").trim();
791
+ if (l) {
792
+ let e = n.blockTokens(l);
793
+ c.push(...e);
794
+ }
795
+ let u = i + 1, d = [];
796
+ for (; u < e.length && e[u].indent > t;) d.push(e[u]), u += 1;
797
+ if (d.length > 0) {
798
+ let e = Ve(d, Math.min(...d.map((e) => e.indent)), n);
799
+ c.push({
800
+ type: "list",
801
+ ordered: !0,
802
+ start: d[0].number,
803
+ items: e,
804
+ raw: d.map((e) => e.raw).join("\n")
805
+ });
806
+ }
807
+ r.push({
808
+ type: "list_item",
809
+ raw: a.raw,
810
+ tokens: c
811
+ }), i = u;
812
+ } else i += 1;
813
+ }
814
+ return r;
815
+ }
816
+ function He(e, t) {
817
+ return e.map((e) => {
818
+ if (e.type !== "list_item") return t.parseChildren([e])[0];
819
+ let n = [];
820
+ return e.tokens && e.tokens.length > 0 && e.tokens.forEach((e) => {
821
+ if (e.type === "paragraph" || e.type === "list" || e.type === "blockquote" || e.type === "code") n.push(...t.parseChildren([e]));
822
+ else if (e.type === "text" && e.tokens) {
823
+ let r = t.parseChildren([e]);
824
+ n.push({
825
+ type: "paragraph",
826
+ content: r
827
+ });
828
+ } else {
829
+ let r = t.parseChildren([e]);
830
+ r.length > 0 && n.push(...r);
831
+ }
832
+ }), {
833
+ type: "listItem",
834
+ content: n
835
+ };
836
+ });
837
+ }
838
+ var Ue = "listItem", We = "textStyle", Ge = /^(\d+)\.\s$/, Ke = C.create({
839
+ name: "orderedList",
840
+ addOptions() {
841
+ return {
842
+ itemTypeName: "listItem",
843
+ HTMLAttributes: {},
844
+ keepMarks: !1,
845
+ keepAttributes: !1
846
+ };
847
+ },
848
+ group: "block list",
849
+ content() {
850
+ return `${this.options.itemTypeName}+`;
851
+ },
852
+ addAttributes() {
853
+ return {
854
+ start: {
855
+ default: 1,
856
+ parseHTML: (e) => e.hasAttribute("start") ? parseInt(e.getAttribute("start") || "", 10) : 1
857
+ },
858
+ type: {
859
+ default: null,
860
+ parseHTML: (e) => e.getAttribute("type")
861
+ }
862
+ };
863
+ },
864
+ parseHTML() {
865
+ return [{ tag: "ol" }];
866
+ },
867
+ renderHTML({ HTMLAttributes: e }) {
868
+ let { start: t, ...n } = e;
869
+ return t === 1 ? [
870
+ "ol",
871
+ u(this.options.HTMLAttributes, n),
872
+ 0
873
+ ] : [
874
+ "ol",
875
+ u(this.options.HTMLAttributes, e),
876
+ 0
877
+ ];
878
+ },
879
+ markdownTokenName: "list",
880
+ parseMarkdown: (e, t) => {
881
+ if (e.type !== "list" || !e.ordered) return [];
882
+ let n = e.start || 1, r = e.items ? He(e.items, t) : [];
883
+ return n === 1 ? {
884
+ type: "orderedList",
885
+ content: r
886
+ } : {
887
+ type: "orderedList",
888
+ attrs: { start: n },
889
+ content: r
890
+ };
891
+ },
892
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
893
+ markdownTokenizer: {
894
+ name: "orderedList",
895
+ level: "block",
896
+ start: (e) => {
897
+ let t = e.match(/^(\s*)(\d+)\.\s+/)?.index;
898
+ return t === void 0 ? -1 : t;
899
+ },
900
+ tokenize: (e, t, n) => {
901
+ let r = e.split("\n"), [i, a] = Be(r);
902
+ if (i.length === 0) return;
903
+ let o = Ve(i, 0, n);
904
+ if (o.length !== 0) return {
905
+ type: "list",
906
+ ordered: !0,
907
+ start: i[0]?.number || 1,
908
+ items: o,
909
+ raw: r.slice(0, a).join("\n")
910
+ };
911
+ }
912
+ },
913
+ markdownOptions: { indentsContent: !0 },
914
+ addCommands() {
915
+ return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ue, this.editor.getAttributes(We)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
916
+ },
917
+ addKeyboardShortcuts() {
918
+ return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
919
+ },
920
+ addInputRules() {
921
+ let e = x({
922
+ find: Ge,
923
+ type: this.type,
924
+ getAttributes: (e) => ({ start: +e[1] }),
925
+ joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1]
926
+ });
927
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = x({
928
+ find: Ge,
929
+ type: this.type,
930
+ keepMarks: this.options.keepMarks,
931
+ keepAttributes: this.options.keepAttributes,
932
+ getAttributes: (e) => ({
933
+ start: +e[1],
934
+ ...this.editor.getAttributes(We)
935
+ }),
936
+ joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1],
937
+ editor: this.editor
938
+ })), [e];
939
+ }
940
+ }), qe = /^\s*(\[([( |x])?\])\s$/, Je = C.create({
941
+ name: "taskItem",
942
+ addOptions() {
943
+ return {
944
+ nested: !1,
945
+ HTMLAttributes: {},
946
+ taskListTypeName: "taskList",
947
+ a11y: void 0
948
+ };
949
+ },
950
+ content() {
951
+ return this.options.nested ? "paragraph block*" : "paragraph+";
952
+ },
953
+ defining: !0,
954
+ addAttributes() {
955
+ return { checked: {
956
+ default: !1,
957
+ keepOnSplit: !1,
958
+ parseHTML: (e) => {
959
+ let t = e.getAttribute("data-checked");
960
+ return t === "" || t === "true";
961
+ },
962
+ renderHTML: (e) => ({ "data-checked": e.checked })
963
+ } };
964
+ },
965
+ parseHTML() {
966
+ return [{
967
+ tag: `li[data-type="${this.name}"]`,
968
+ priority: 51
969
+ }];
970
+ },
971
+ renderHTML({ node: e, HTMLAttributes: t }) {
972
+ return [
973
+ "li",
974
+ u(this.options.HTMLAttributes, t, { "data-type": this.name }),
975
+ [
976
+ "label",
977
+ ["input", {
978
+ type: "checkbox",
979
+ checked: e.attrs.checked ? "checked" : null
980
+ }],
981
+ ["span"]
982
+ ],
983
+ ["div", 0]
984
+ ];
985
+ },
986
+ parseMarkdown: (e, t) => {
987
+ let n = [];
988
+ 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) {
989
+ let r = t.parseChildren(e.nestedTokens);
990
+ n.push(...r);
991
+ }
992
+ return t.createNode("taskItem", { checked: e.checked || !1 }, n);
993
+ },
994
+ renderMarkdown: (e, t) => S(e, t, `- [${e.attrs?.checked ? "x" : " "}] `),
995
+ addKeyboardShortcuts() {
996
+ let e = {
997
+ Enter: () => this.editor.commands.splitListItem(this.name),
998
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
999
+ };
1000
+ return this.options.nested ? {
1001
+ ...e,
1002
+ Tab: () => this.editor.commands.sinkListItem(this.name)
1003
+ } : e;
1004
+ },
1005
+ addNodeView() {
1006
+ return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
1007
+ let i = document.createElement("li"), a = document.createElement("label"), o = document.createElement("span"), s = document.createElement("input"), c = document.createElement("div"), l = (e) => {
1008
+ var t;
1009
+ s.ariaLabel = ((t = this.options.a11y)?.checkboxLabel)?.call(t, e, s.checked) || `Task item checkbox for ${e.textContent || "empty task item"}`;
1010
+ };
1011
+ l(e), a.contentEditable = "false", s.type = "checkbox", s.addEventListener("mousedown", (e) => e.preventDefault()), s.addEventListener("change", (t) => {
1012
+ if (!r.isEditable && !this.options.onReadOnlyChecked) {
1013
+ s.checked = !s.checked;
1014
+ return;
1015
+ }
1016
+ let { checked: i } = t.target;
1017
+ r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: e }) => {
1018
+ let t = n();
1019
+ if (typeof t != "number") return !1;
1020
+ let r = e.doc.nodeAt(t);
1021
+ return e.setNodeMarkup(t, void 0, {
1022
+ ...r?.attrs,
1023
+ checked: i
1024
+ }), !0;
1025
+ }).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(e, i) || (s.checked = !s.checked));
1026
+ }), Object.entries(this.options.HTMLAttributes).forEach(([e, t]) => {
1027
+ i.setAttribute(e, t);
1028
+ }), 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]) => {
1029
+ i.setAttribute(e, t);
1030
+ });
1031
+ let u = new Set(Object.keys(t));
1032
+ return {
1033
+ dom: i,
1034
+ contentDOM: c,
1035
+ update: (e) => {
1036
+ if (e.type !== this.type) return !1;
1037
+ i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, l(e);
1038
+ let t = r.extensionManager.attributes, n = ne(e, t), a = new Set(Object.keys(n)), o = this.options.HTMLAttributes;
1039
+ return u.forEach((e) => {
1040
+ a.has(e) || (e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e));
1041
+ }), Object.entries(n).forEach(([e, t]) => {
1042
+ t == null ? e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e) : i.setAttribute(e, t);
1043
+ }), u = a, !0;
1044
+ }
1045
+ };
1046
+ };
1047
+ },
1048
+ addInputRules() {
1049
+ return [x({
1050
+ find: qe,
1051
+ type: this.type,
1052
+ getAttributes: (e) => ({ checked: e[e.length - 1] === "x" })
1053
+ })];
1054
+ }
1055
+ }), Ye = C.create({
1056
+ name: "taskList",
1057
+ addOptions() {
1058
+ return {
1059
+ itemTypeName: "taskItem",
1060
+ HTMLAttributes: {}
1061
+ };
1062
+ },
1063
+ group: "block list",
1064
+ content() {
1065
+ return `${this.options.itemTypeName}+`;
1066
+ },
1067
+ parseHTML() {
1068
+ return [{
1069
+ tag: `ul[data-type="${this.name}"]`,
1070
+ priority: 51
1071
+ }];
1072
+ },
1073
+ renderHTML({ HTMLAttributes: e }) {
1074
+ return [
1075
+ "ul",
1076
+ u(this.options.HTMLAttributes, e, { "data-type": this.name }),
1077
+ 0
1078
+ ];
1079
+ },
1080
+ parseMarkdown: (e, t) => t.createNode("taskList", {}, t.parseChildren(e.items || [])),
1081
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
1082
+ markdownTokenizer: {
1083
+ name: "taskList",
1084
+ level: "block",
1085
+ start(e) {
1086
+ let t = e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;
1087
+ return t === void 0 ? -1 : t;
1088
+ },
1089
+ tokenize(e, t, n) {
1090
+ let r = (e) => {
1091
+ let t = f(e, {
1092
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1093
+ extractItemData: (e) => ({
1094
+ indentLevel: e[1].length,
1095
+ mainContent: e[4],
1096
+ checked: e[3].toLowerCase() === "x"
1097
+ }),
1098
+ createToken: (e, t) => ({
1099
+ type: "taskItem",
1100
+ raw: "",
1101
+ mainContent: e.mainContent,
1102
+ indentLevel: e.indentLevel,
1103
+ checked: e.checked,
1104
+ text: e.mainContent,
1105
+ tokens: n.inlineTokens(e.mainContent),
1106
+ nestedTokens: t
1107
+ }),
1108
+ customNestedParser: r
1109
+ }, n);
1110
+ return t ? [{
1111
+ type: "taskList",
1112
+ raw: t.raw,
1113
+ items: t.items
1114
+ }] : n.blockTokens(e);
1115
+ }, i = f(e, {
1116
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1117
+ extractItemData: (e) => ({
1118
+ indentLevel: e[1].length,
1119
+ mainContent: e[4],
1120
+ checked: e[3].toLowerCase() === "x"
1121
+ }),
1122
+ createToken: (e, t) => ({
1123
+ type: "taskItem",
1124
+ raw: "",
1125
+ mainContent: e.mainContent,
1126
+ indentLevel: e.indentLevel,
1127
+ checked: e.checked,
1128
+ text: e.mainContent,
1129
+ tokens: n.inlineTokens(e.mainContent),
1130
+ nestedTokens: t
1131
+ }),
1132
+ customNestedParser: r
1133
+ }, n);
1134
+ if (i) return {
1135
+ type: "taskList",
1136
+ raw: i.raw,
1137
+ items: i.items
1138
+ };
1139
+ }
1140
+ },
1141
+ markdownOptions: { indentsContent: !0 },
1142
+ addCommands() {
1143
+ return { toggleTaskList: () => ({ commands: e }) => e.toggleList(this.name, this.options.itemTypeName) };
1144
+ },
1145
+ addKeyboardShortcuts() {
1146
+ return { "Mod-Shift-9": () => this.editor.commands.toggleTaskList() };
1147
+ }
1148
+ });
1149
+ y.create({
1150
+ name: "listKit",
1151
+ addExtensions() {
1152
+ let e = [];
1153
+ 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(Le.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(Ke.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(Je.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(Ye.configure(this.options.taskList)), e;
1154
+ }
1155
+ });
1156
+ //#endregion
1157
+ //#region ../../node_modules/.bun/@tiptap+extension-paragraph@3.22.1+ea875cbca4543ce7/node_modules/@tiptap/extension-paragraph/dist/index.js
1158
+ var B = "&nbsp;", V = "\xA0", Xe = C.create({
1159
+ name: "paragraph",
1160
+ priority: 1e3,
1161
+ addOptions() {
1162
+ return { HTMLAttributes: {} };
1163
+ },
1164
+ group: "block",
1165
+ content: "inline*",
1166
+ parseHTML() {
1167
+ return [{ tag: "p" }];
1168
+ },
1169
+ renderHTML({ HTMLAttributes: e }) {
1170
+ return [
1171
+ "p",
1172
+ u(this.options.HTMLAttributes, e),
1173
+ 0
1174
+ ];
1175
+ },
1176
+ parseMarkdown: (e, t) => {
1177
+ let n = e.tokens || [];
1178
+ if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
1179
+ let r = t.parseInline(n);
1180
+ return n.length === 1 && n[0].type === "text" && (n[0].raw === B || n[0].text === B || n[0].raw === V || n[0].text === V) && r.length === 1 && r[0].type === "text" && (r[0].text === B || r[0].text === V) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
1181
+ },
1182
+ renderMarkdown: (e, t, n) => {
1183
+ if (!e) return "";
1184
+ let r = Array.isArray(e.content) ? e.content : [];
1185
+ if (r.length === 0) {
1186
+ let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
1187
+ return n?.previousNode?.type === "paragraph" && e.length === 0 ? B : "";
1188
+ }
1189
+ return t.renderChildren(r);
1190
+ },
1191
+ addCommands() {
1192
+ return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
1193
+ },
1194
+ addKeyboardShortcuts() {
1195
+ return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
1196
+ }
1197
+ }), Ze = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, Qe = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, $e = g.create({
1198
+ name: "strike",
1199
+ addOptions() {
1200
+ return { HTMLAttributes: {} };
1201
+ },
1202
+ parseHTML() {
1203
+ return [
1204
+ { tag: "s" },
1205
+ { tag: "del" },
1206
+ { tag: "strike" },
1207
+ {
1208
+ style: "text-decoration",
1209
+ consuming: !1,
1210
+ getAttrs: (e) => e.includes("line-through") ? {} : !1
1211
+ }
1212
+ ];
1213
+ },
1214
+ renderHTML({ HTMLAttributes: e }) {
1215
+ return [
1216
+ "s",
1217
+ u(this.options.HTMLAttributes, e),
1218
+ 0
1219
+ ];
1220
+ },
1221
+ markdownTokenName: "del",
1222
+ parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
1223
+ renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
1224
+ addCommands() {
1225
+ return {
1226
+ setStrike: () => ({ commands: e }) => e.setMark(this.name),
1227
+ toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
1228
+ unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
1229
+ };
1230
+ },
1231
+ addKeyboardShortcuts() {
1232
+ return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
1233
+ },
1234
+ addInputRules() {
1235
+ return [l({
1236
+ find: Ze,
1237
+ type: this.type
1238
+ })];
1239
+ },
1240
+ addPasteRules() {
1241
+ return [r({
1242
+ find: Qe,
1243
+ type: this.type
1244
+ })];
1245
+ }
1246
+ }), et = C.create({
1247
+ name: "text",
1248
+ group: "inline",
1249
+ parseMarkdown: (e) => ({
1250
+ type: "text",
1251
+ text: e.text || ""
1252
+ }),
1253
+ renderMarkdown: (e) => e.text || ""
1254
+ });
1255
+ //#endregion
1256
+ //#region ../../node_modules/.bun/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
1257
+ function tt(e = {}) {
1258
+ return new E({ view(t) {
1259
+ return new nt(t, e);
1260
+ } });
1261
+ }
1262
+ var nt = class {
1263
+ constructor(e, t) {
1264
+ 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 = [
1265
+ "dragover",
1266
+ "dragend",
1267
+ "drop",
1268
+ "dragleave"
1269
+ ].map((t) => {
1270
+ let n = (e) => {
1271
+ this[t](e);
1272
+ };
1273
+ return e.dom.addEventListener(t, n), {
1274
+ name: t,
1275
+ handler: n
1276
+ };
1277
+ });
1278
+ }
1279
+ destroy() {
1280
+ this.handlers.forEach(({ name: e, handler: t }) => this.editorView.dom.removeEventListener(e, t));
1281
+ }
1282
+ update(e, t) {
1283
+ this.cursorPos != null && t.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
1284
+ }
1285
+ setCursor(e) {
1286
+ e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
1287
+ }
1288
+ updateOverlay() {
1289
+ 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;
1290
+ if (t) {
1291
+ let t = e.nodeBefore, r = e.nodeAfter;
1292
+ if (t || r) {
1293
+ let e = this.editorView.nodeDOM(this.cursorPos - (t ? t.nodeSize : 0));
1294
+ if (e) {
1295
+ let i = e.getBoundingClientRect(), a = t ? i.bottom : i.top;
1296
+ t && r && (a = (a + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
1297
+ let s = this.width / 2 * o;
1298
+ n = {
1299
+ left: i.left,
1300
+ right: i.right,
1301
+ top: a - s,
1302
+ bottom: a + s
1303
+ };
1304
+ }
1305
+ }
1306
+ }
1307
+ if (!n) {
1308
+ let e = this.editorView.coordsAtPos(this.cursorPos), t = this.width / 2 * a;
1309
+ n = {
1310
+ left: e.left - t,
1311
+ right: e.left + t,
1312
+ top: e.top,
1313
+ bottom: e.bottom
1314
+ };
1315
+ }
1316
+ let s = this.editorView.dom.offsetParent;
1317
+ 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);
1318
+ let c, l;
1319
+ if (!s || s == document.body && getComputedStyle(s).position == "static") c = -pageXOffset, l = -pageYOffset;
1320
+ else {
1321
+ let e = s.getBoundingClientRect(), t = e.width / s.offsetWidth, n = e.height / s.offsetHeight;
1322
+ c = e.left - s.scrollLeft * t, l = e.top - s.scrollTop * n;
1323
+ }
1324
+ 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";
1325
+ }
1326
+ scheduleRemoval(e) {
1327
+ clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
1328
+ }
1329
+ dragover(e) {
1330
+ if (!this.editorView.editable) return;
1331
+ let t = this.editorView.posAtCoords({
1332
+ left: e.clientX,
1333
+ top: e.clientY
1334
+ }), 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;
1335
+ if (t && !i) {
1336
+ let e = t.pos;
1337
+ if (this.editorView.dragging && this.editorView.dragging.slice) {
1338
+ let t = oe(this.editorView.state.doc, e, this.editorView.dragging.slice);
1339
+ t != null && (e = t);
1340
+ }
1341
+ this.setCursor(e), this.scheduleRemoval(5e3);
1342
+ }
1343
+ }
1344
+ dragend() {
1345
+ this.scheduleRemoval(20);
1346
+ }
1347
+ drop() {
1348
+ this.scheduleRemoval(20);
1349
+ }
1350
+ dragleave(e) {
1351
+ this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
1352
+ }
1353
+ }, H = class e extends T {
1354
+ constructor(e) {
1355
+ super(e, e);
1356
+ }
1357
+ map(t, n) {
1358
+ let r = t.resolve(n.map(this.head));
1359
+ return e.valid(r) ? new e(r) : T.near(r);
1360
+ }
1361
+ content() {
1362
+ return n.empty;
1363
+ }
1364
+ eq(t) {
1365
+ return t instanceof e && t.head == this.head;
1366
+ }
1367
+ toJSON() {
1368
+ return {
1369
+ type: "gapcursor",
1370
+ pos: this.head
1371
+ };
1372
+ }
1373
+ static fromJSON(t, n) {
1374
+ if (typeof n.pos != "number") throw RangeError("Invalid input for GapCursor.fromJSON");
1375
+ return new e(t.resolve(n.pos));
1376
+ }
1377
+ getBookmark() {
1378
+ return new rt(this.anchor);
1379
+ }
1380
+ static valid(e) {
1381
+ let t = e.parent;
1382
+ if (t.inlineContent || !at(e) || !ot(e)) return !1;
1383
+ let n = t.type.spec.allowGapCursor;
1384
+ if (n != null) return n;
1385
+ let r = t.contentMatchAt(e.index()).defaultType;
1386
+ return r && r.isTextblock;
1387
+ }
1388
+ static findGapCursorFrom(t, n, r = !1) {
1389
+ search: for (;;) {
1390
+ if (!r && e.valid(t)) return t;
1391
+ let i = t.pos, a = null;
1392
+ for (let r = t.depth;; r--) {
1393
+ let o = t.node(r);
1394
+ if (n > 0 ? t.indexAfter(r) < o.childCount : t.index(r) > 0) {
1395
+ a = o.child(n > 0 ? t.indexAfter(r) : t.index(r) - 1);
1396
+ break;
1397
+ } else if (r == 0) return null;
1398
+ i += n;
1399
+ let s = t.doc.resolve(i);
1400
+ if (e.valid(s)) return s;
1401
+ }
1402
+ for (;;) {
1403
+ let o = n > 0 ? a.firstChild : a.lastChild;
1404
+ if (!o) {
1405
+ if (a.isAtom && !a.isText && !w.isSelectable(a)) {
1406
+ t = t.doc.resolve(i + a.nodeSize * n), r = !1;
1407
+ continue search;
1408
+ }
1409
+ break;
1410
+ }
1411
+ a = o, i += n;
1412
+ let s = t.doc.resolve(i);
1413
+ if (e.valid(s)) return s;
1414
+ }
1415
+ return null;
1416
+ }
1417
+ }
1418
+ };
1419
+ H.prototype.visible = !1, H.findFrom = H.findGapCursorFrom, T.jsonID("gapcursor", H);
1420
+ var rt = class e {
1421
+ constructor(e) {
1422
+ this.pos = e;
1423
+ }
1424
+ map(t) {
1425
+ return new e(t.map(this.pos));
1426
+ }
1427
+ resolve(e) {
1428
+ let t = e.resolve(this.pos);
1429
+ return H.valid(t) ? new H(t) : T.near(t);
1430
+ }
1431
+ };
1432
+ function it(e) {
1433
+ return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
1434
+ }
1435
+ function at(e) {
1436
+ for (let t = e.depth; t >= 0; t--) {
1437
+ let n = e.index(t), r = e.node(t);
1438
+ if (n == 0) {
1439
+ if (r.type.spec.isolating) return !0;
1440
+ continue;
1441
+ }
1442
+ for (let e = r.child(n - 1);; e = e.lastChild) {
1443
+ if (e.childCount == 0 && !e.inlineContent || it(e.type)) return !0;
1444
+ if (e.inlineContent) return !1;
1445
+ }
1446
+ }
1447
+ return !0;
1448
+ }
1449
+ function ot(e) {
1450
+ for (let t = e.depth; t >= 0; t--) {
1451
+ let n = e.indexAfter(t), r = e.node(t);
1452
+ if (n == r.childCount) {
1453
+ if (r.type.spec.isolating) return !0;
1454
+ continue;
1455
+ }
1456
+ for (let e = r.child(n);; e = e.firstChild) {
1457
+ if (e.childCount == 0 && !e.inlineContent || it(e.type)) return !0;
1458
+ if (e.inlineContent) return !1;
1459
+ }
1460
+ }
1461
+ return !0;
1462
+ }
1463
+ function st() {
1464
+ return new E({ props: {
1465
+ decorations: dt,
1466
+ createSelectionBetween(e, t, n) {
1467
+ return t.pos == n.pos && H.valid(n) ? new H(n) : null;
1468
+ },
1469
+ handleClick: lt,
1470
+ handleKeyDown: ct,
1471
+ handleDOMEvents: { beforeinput: ut }
1472
+ } });
1473
+ }
1474
+ var ct = te({
1475
+ ArrowLeft: U("horiz", -1),
1476
+ ArrowRight: U("horiz", 1),
1477
+ ArrowUp: U("vert", -1),
1478
+ ArrowDown: U("vert", 1)
1479
+ });
1480
+ function U(e, t) {
1481
+ let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
1482
+ return function(e, r, i) {
1483
+ let a = e.selection, s = t > 0 ? a.$to : a.$from, c = a.empty;
1484
+ if (a instanceof o) {
1485
+ if (!i.endOfTextblock(n) || s.depth == 0) return !1;
1486
+ c = !1, s = e.doc.resolve(t > 0 ? s.after() : s.before());
1487
+ }
1488
+ let l = H.findGapCursorFrom(s, t, c);
1489
+ return l ? (r && r(e.tr.setSelection(new H(l))), !0) : !1;
1490
+ };
1491
+ }
1492
+ function lt(e, t, n) {
1493
+ if (!e || !e.editable) return !1;
1494
+ let r = e.state.doc.resolve(t);
1495
+ if (!H.valid(r)) return !1;
1496
+ let i = e.posAtCoords({
1497
+ left: n.clientX,
1498
+ top: n.clientY
1499
+ });
1500
+ return i && i.inside > -1 && w.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new H(r))), !0);
1501
+ }
1502
+ function ut(e, t) {
1503
+ if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof H)) return !1;
1504
+ let { $from: r } = e.state.selection, i = r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);
1505
+ if (!i) return !1;
1506
+ let a = c.empty;
1507
+ for (let e = i.length - 1; e >= 0; e--) a = c.from(i[e].createAndFill(null, a));
1508
+ let s = e.state.tr.replace(r.pos, r.pos, new n(a, 0, 0));
1509
+ return s.setSelection(o.near(s.doc.resolve(r.pos + 1))), e.dispatch(s), !1;
1510
+ }
1511
+ function dt(e) {
1512
+ if (!(e.selection instanceof H)) return null;
1513
+ let t = document.createElement("div");
1514
+ return t.className = "ProseMirror-gapcursor", m.create(e.doc, [v.widget(e.selection.head, t, { key: "gapcursor" })]);
1515
+ }
1516
+ //#endregion
1517
+ //#region ../../node_modules/.bun/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
1518
+ var W = 200, G = function() {};
1519
+ G.prototype.append = function(e) {
1520
+ return e.length ? (e = G.from(e), !this.length && e || e.length < W && this.leafAppend(e) || this.length < W && e.leafPrepend(this) || this.appendInner(e)) : this;
1521
+ }, G.prototype.prepend = function(e) {
1522
+ return e.length ? G.from(e).append(this) : this;
1523
+ }, G.prototype.appendInner = function(e) {
1524
+ return new pt(this, e);
1525
+ }, G.prototype.slice = function(e, t) {
1526
+ return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? G.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
1527
+ }, G.prototype.get = function(e) {
1528
+ if (!(e < 0 || e >= this.length)) return this.getInner(e);
1529
+ }, G.prototype.forEach = function(e, t, n) {
1530
+ 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);
1531
+ }, G.prototype.map = function(e, t, n) {
1532
+ t === void 0 && (t = 0), n === void 0 && (n = this.length);
1533
+ var r = [];
1534
+ return this.forEach(function(t, n) {
1535
+ return r.push(e(t, n));
1536
+ }, t, n), r;
1537
+ }, G.from = function(e) {
1538
+ return e instanceof G ? e : e && e.length ? new ft(e) : G.empty;
1539
+ };
1540
+ var ft = /* @__PURE__ */ function(e) {
1541
+ function t(t) {
1542
+ e.call(this), this.values = t;
1543
+ }
1544
+ e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t;
1545
+ var n = {
1546
+ length: { configurable: !0 },
1547
+ depth: { configurable: !0 }
1548
+ };
1549
+ return t.prototype.flatten = function() {
1550
+ return this.values;
1551
+ }, t.prototype.sliceInner = function(e, n) {
1552
+ return e == 0 && n == this.length ? this : new t(this.values.slice(e, n));
1553
+ }, t.prototype.getInner = function(e) {
1554
+ return this.values[e];
1555
+ }, t.prototype.forEachInner = function(e, t, n, r) {
1556
+ for (var i = t; i < n; i++) if (e(this.values[i], r + i) === !1) return !1;
1557
+ }, t.prototype.forEachInvertedInner = function(e, t, n, r) {
1558
+ for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
1559
+ }, t.prototype.leafAppend = function(e) {
1560
+ if (this.length + e.length <= W) return new t(this.values.concat(e.flatten()));
1561
+ }, t.prototype.leafPrepend = function(e) {
1562
+ if (this.length + e.length <= W) return new t(e.flatten().concat(this.values));
1563
+ }, n.length.get = function() {
1564
+ return this.values.length;
1565
+ }, n.depth.get = function() {
1566
+ return 0;
1567
+ }, Object.defineProperties(t.prototype, n), t;
1568
+ }(G);
1569
+ G.empty = new ft([]);
1570
+ var pt = /* @__PURE__ */ function(e) {
1571
+ function t(t, n) {
1572
+ e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
1573
+ }
1574
+ return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t.prototype.flatten = function() {
1575
+ return this.left.flatten().concat(this.right.flatten());
1576
+ }, t.prototype.getInner = function(e) {
1577
+ return e < this.left.length ? this.left.get(e) : this.right.get(e - this.left.length);
1578
+ }, t.prototype.forEachInner = function(e, t, n, r) {
1579
+ var i = this.left.length;
1580
+ 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;
1581
+ }, t.prototype.forEachInvertedInner = function(e, t, n, r) {
1582
+ var i = this.left.length;
1583
+ 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;
1584
+ }, t.prototype.sliceInner = function(e, t) {
1585
+ if (e == 0 && t == this.length) return this;
1586
+ var n = this.left.length;
1587
+ 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));
1588
+ }, t.prototype.leafAppend = function(e) {
1589
+ var n = this.right.leafAppend(e);
1590
+ if (n) return new t(this.left, n);
1591
+ }, t.prototype.leafPrepend = function(e) {
1592
+ var n = this.left.leafPrepend(e);
1593
+ if (n) return new t(n, this.right);
1594
+ }, t.prototype.appendInner = function(e) {
1595
+ 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);
1596
+ }, t;
1597
+ }(G), mt = 500, K = class t {
1598
+ constructor(e, t) {
1599
+ this.items = e, this.eventCount = t;
1600
+ }
1601
+ popEvent(e, n) {
1602
+ if (this.eventCount == 0) return null;
1603
+ let r = this.items.length;
1604
+ for (;; r--) if (this.items.get(r - 1).selection) {
1605
+ --r;
1606
+ break;
1607
+ }
1608
+ let i, a;
1609
+ n && (i = this.remapping(r, this.items.length), a = i.maps.length);
1610
+ let o = e.tr, s, c, l = [], u = [];
1611
+ return this.items.forEach((e, n) => {
1612
+ if (!e.step) {
1613
+ i || (i = this.remapping(r, n + 1), a = i.maps.length), a--, u.push(e);
1614
+ return;
1615
+ }
1616
+ if (i) {
1617
+ u.push(new q(e.map));
1618
+ let t = e.step.map(i.slice(a)), n;
1619
+ t && o.maybeStep(t).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new q(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
1620
+ } else o.maybeStep(e.step);
1621
+ if (e.selection) return s = i ? e.selection.map(i.slice(a)) : e.selection, c = new t(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
1622
+ }, this.items.length, 0), {
1623
+ remaining: c,
1624
+ transform: o,
1625
+ selection: s
1626
+ };
1627
+ }
1628
+ addTransform(e, n, r, i) {
1629
+ let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
1630
+ for (let t = 0; t < e.steps.length; t++) {
1631
+ let r = e.steps[t].invert(e.docs[t]), l = new q(e.mapping.maps[t], r, n), u;
1632
+ (u = c && c.merge(l)) && (l = u, t ? a.pop() : s = s.slice(0, s.length - 1)), a.push(l), n &&= (o++, void 0), i || (c = l);
1633
+ }
1634
+ let l = o - r.depth;
1635
+ return l > gt && (s = ht(s, l), o -= l), new t(s.append(a), o);
1636
+ }
1637
+ remapping(t, n) {
1638
+ let r = new e();
1639
+ return this.items.forEach((e, n) => {
1640
+ let i = e.mirrorOffset != null && n - e.mirrorOffset >= t ? r.maps.length - e.mirrorOffset : void 0;
1641
+ r.appendMap(e.map, i);
1642
+ }, t, n), r;
1643
+ }
1644
+ addMaps(e) {
1645
+ return this.eventCount == 0 ? this : new t(this.items.append(e.map((e) => new q(e))), this.eventCount);
1646
+ }
1647
+ rebased(e, n) {
1648
+ if (!this.eventCount) return this;
1649
+ let r = [], i = Math.max(0, this.items.length - n), a = e.mapping, o = e.steps.length, s = this.eventCount;
1650
+ this.items.forEach((e) => {
1651
+ e.selection && s--;
1652
+ }, i);
1653
+ let c = n;
1654
+ this.items.forEach((t) => {
1655
+ let n = a.getMirror(--c);
1656
+ if (n == null) return;
1657
+ o = Math.min(o, n);
1658
+ let i = a.maps[n];
1659
+ if (t.step) {
1660
+ let o = e.steps[n].invert(e.docs[n]), l = t.selection && t.selection.map(a.slice(c + 1, n));
1661
+ l && s++, r.push(new q(i, o, l));
1662
+ } else r.push(new q(i));
1663
+ }, i);
1664
+ let l = [];
1665
+ for (let e = n; e < o; e++) l.push(new q(a.maps[e]));
1666
+ let u = new t(this.items.slice(0, i).append(l).append(r), s);
1667
+ return u.emptyItemCount() > mt && (u = u.compress(this.items.length - r.length)), u;
1668
+ }
1669
+ emptyItemCount() {
1670
+ let e = 0;
1671
+ return this.items.forEach((t) => {
1672
+ t.step || e++;
1673
+ }), e;
1674
+ }
1675
+ compress(e = this.items.length) {
1676
+ let n = this.remapping(0, e), r = n.maps.length, i = [], a = 0;
1677
+ return this.items.forEach((t, o) => {
1678
+ if (o >= e) i.push(t), t.selection && a++;
1679
+ else if (t.step) {
1680
+ let e = t.step.map(n.slice(r)), o = e && e.getMap();
1681
+ if (r--, o && n.appendMap(o, r), e) {
1682
+ let s = t.selection && t.selection.map(n.slice(r));
1683
+ s && a++;
1684
+ let c = new q(o.invert(), e, s), l, u = i.length - 1;
1685
+ (l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
1686
+ }
1687
+ } else t.map && r--;
1688
+ }, this.items.length, 0), new t(G.from(i.reverse()), a);
1689
+ }
1690
+ };
1691
+ K.empty = new K(G.empty, 0);
1692
+ function ht(e, t) {
1693
+ let n;
1694
+ return e.forEach((e, r) => {
1695
+ if (e.selection && t-- == 0) return n = r, !1;
1696
+ }), e.slice(n);
1697
+ }
1698
+ var q = class e {
1699
+ constructor(e, t, n, r) {
1700
+ this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
1701
+ }
1702
+ merge(t) {
1703
+ if (this.step && t.step && !t.selection) {
1704
+ let n = t.step.merge(this.step);
1705
+ if (n) return new e(n.getMap().invert(), n, this.selection);
1706
+ }
1707
+ }
1708
+ }, J = class {
1709
+ constructor(e, t, n, r, i) {
1710
+ this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
1711
+ }
1712
+ }, gt = 20;
1713
+ function _t(e, t, n, r) {
1714
+ let i = n.getMeta(Q), a;
1715
+ if (i) return i.historyState;
1716
+ n.getMeta(St) && (e = new J(e.done, e.undone, null, 0, -1));
1717
+ let o = n.getMeta("appendedTransaction");
1718
+ if (n.steps.length == 0) return e;
1719
+ if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new J(e.done.addTransform(n, void 0, r, Z(t)), e.undone, yt(n.mapping.maps), e.prevTime, e.prevComposition) : new J(e.done, e.undone.addTransform(n, void 0, r, Z(t)), null, e.prevTime, e.prevComposition);
1720
+ if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
1721
+ let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !vt(n, e.prevRanges)), s = o ? Y(e.prevRanges, n.mapping) : yt(n.mapping.maps);
1722
+ return new J(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, Z(t)), K.empty, s, n.time, i ?? e.prevComposition);
1723
+ } else if (a = n.getMeta("rebased")) return new J(e.done.rebased(n, a), e.undone.rebased(n, a), Y(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
1724
+ else return new J(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), Y(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
1725
+ }
1726
+ function vt(e, t) {
1727
+ if (!t) return !1;
1728
+ if (!e.docChanged) return !0;
1729
+ let n = !1;
1730
+ return e.mapping.maps[0].forEach((e, r) => {
1731
+ for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
1732
+ }), n;
1733
+ }
1734
+ function yt(e) {
1735
+ let t = [];
1736
+ for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
1737
+ return t;
1738
+ }
1739
+ function Y(e, t) {
1740
+ if (!e) return null;
1741
+ let n = [];
1742
+ for (let r = 0; r < e.length; r += 2) {
1743
+ let i = t.map(e[r], 1), a = t.map(e[r + 1], -1);
1744
+ i <= a && n.push(i, a);
1745
+ }
1746
+ return n;
1747
+ }
1748
+ function bt(e, t, n) {
1749
+ let r = Z(t), i = Q.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
1750
+ if (!a) return null;
1751
+ let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new J(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
1752
+ return a.transform.setSelection(o).setMeta(Q, {
1753
+ redo: n,
1754
+ historyState: c
1755
+ });
1756
+ }
1757
+ var X = !1, xt = null;
1758
+ function Z(e) {
1759
+ let t = e.plugins;
1760
+ if (xt != t) {
1761
+ X = !1, xt = t;
1762
+ for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
1763
+ X = !0;
1764
+ break;
1765
+ }
1766
+ }
1767
+ return X;
1768
+ }
1769
+ var Q = new h("history"), St = new h("closeHistory");
1770
+ function Ct(e = {}) {
1771
+ return e = {
1772
+ depth: e.depth || 100,
1773
+ newGroupDelay: e.newGroupDelay || 500
1774
+ }, new E({
1775
+ key: Q,
1776
+ state: {
1777
+ init() {
1778
+ return new J(K.empty, K.empty, null, 0, -1);
1779
+ },
1780
+ apply(t, n, r) {
1781
+ return _t(n, r, t, e);
1782
+ }
1783
+ },
1784
+ config: e,
1785
+ props: { handleDOMEvents: { beforeinput(e, t) {
1786
+ let n = t.inputType, r = n == "historyUndo" ? Tt : n == "historyRedo" ? $ : null;
1787
+ return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
1788
+ } } }
1789
+ });
1790
+ }
1791
+ function wt(e, t) {
1792
+ return (n, r) => {
1793
+ let i = Q.getState(n);
1794
+ if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
1795
+ if (r) {
1796
+ let a = bt(i, n, e);
1797
+ a && r(t ? a.scrollIntoView() : a);
1798
+ }
1799
+ return !0;
1800
+ };
1801
+ }
1802
+ var Tt = wt(!1, !0), $ = wt(!0, !0);
1803
+ y.create({
1804
+ name: "characterCount",
1805
+ addOptions() {
1806
+ return {
1807
+ limit: null,
1808
+ mode: "textSize",
1809
+ textCounter: (e) => e.length,
1810
+ wordCounter: (e) => e.split(" ").filter((e) => e !== "").length
1811
+ };
1812
+ },
1813
+ addStorage() {
1814
+ return {
1815
+ characters: () => 0,
1816
+ words: () => 0
1817
+ };
1818
+ },
1819
+ onBeforeCreate() {
1820
+ this.storage.characters = (e) => {
1821
+ let t = e?.node || this.editor.state.doc;
1822
+ if ((e?.mode || this.options.mode) === "textSize") {
1823
+ let e = t.textBetween(0, t.content.size, void 0, " ");
1824
+ return this.options.textCounter(e);
1825
+ }
1826
+ return t.nodeSize;
1827
+ }, this.storage.words = (e) => {
1828
+ let t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
1829
+ return this.options.wordCounter(n);
1830
+ };
1831
+ },
1832
+ addProseMirrorPlugins() {
1833
+ let e = !1;
1834
+ return [new E({
1835
+ key: new h("characterCount"),
1836
+ appendTransaction: (t, n, r) => {
1837
+ if (e) return;
1838
+ let i = this.options.limit;
1839
+ if (i == null || i === 0) {
1840
+ e = !0;
1841
+ return;
1842
+ }
1843
+ let a = this.storage.characters({ node: r.doc });
1844
+ if (a > i) {
1845
+ let t = a - i;
1846
+ console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);
1847
+ let n = r.tr.deleteRange(0, t);
1848
+ return e = !0, n;
1849
+ }
1850
+ e = !0;
1851
+ },
1852
+ filterTransaction: (e, t) => {
1853
+ let n = this.options.limit;
1854
+ if (!e.docChanged || n === 0 || n == null) return !0;
1855
+ let r = this.storage.characters({ node: t.doc }), i = this.storage.characters({ node: e.doc });
1856
+ if (i <= n || r > n && i > n && i <= r) return !0;
1857
+ if (r > n && i > n && i > r || !e.getMeta("paste")) return !1;
1858
+ let a = e.selection.$head.pos, o = a - (i - n), s = a;
1859
+ return e.deleteRange(o, s), !(this.storage.characters({ node: e.doc }) > n);
1860
+ }
1861
+ })];
1862
+ }
1863
+ });
1864
+ var Et = y.create({
1865
+ name: "dropCursor",
1866
+ addOptions() {
1867
+ return {
1868
+ color: "currentColor",
1869
+ width: 1,
1870
+ class: void 0
1871
+ };
1872
+ },
1873
+ addProseMirrorPlugins() {
1874
+ return [tt(this.options)];
1875
+ }
1876
+ });
1877
+ y.create({
1878
+ name: "focus",
1879
+ addOptions() {
1880
+ return {
1881
+ className: "has-focus",
1882
+ mode: "all"
1883
+ };
1884
+ },
1885
+ addProseMirrorPlugins() {
1886
+ return [new E({
1887
+ key: new h("focus"),
1888
+ props: { decorations: ({ doc: e, selection: t }) => {
1889
+ let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
1890
+ if (!n || !r) return m.create(e, []);
1891
+ let o = 0;
1892
+ this.options.mode === "deepest" && e.descendants((e, t) => {
1893
+ if (!e.isText) {
1894
+ if (!(i >= t && i <= t + e.nodeSize - 1)) return !1;
1895
+ o += 1;
1896
+ }
1897
+ });
1898
+ let s = 0;
1899
+ return e.descendants((e, t) => {
1900
+ if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
1901
+ if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
1902
+ a.push(v.node(t, t + e.nodeSize, { class: this.options.className }));
1903
+ }), m.create(e, a);
1904
+ } }
1905
+ })];
1906
+ }
1907
+ });
1908
+ var Dt = y.create({
1909
+ name: "gapCursor",
1910
+ addProseMirrorPlugins() {
1911
+ return [st()];
1912
+ },
1913
+ extendNodeSchema(e) {
1914
+ return { allowGapCursor: p(d(e, "allowGapCursor", {
1915
+ name: e.name,
1916
+ options: e.options,
1917
+ storage: e.storage
1918
+ })) ?? null };
1919
+ }
1920
+ }), Ot = "placeholder";
1921
+ function kt(e) {
1922
+ return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
1923
+ }
1924
+ y.create({
1925
+ name: "placeholder",
1926
+ addOptions() {
1927
+ return {
1928
+ emptyEditorClass: "is-editor-empty",
1929
+ emptyNodeClass: "is-empty",
1930
+ dataAttribute: Ot,
1931
+ placeholder: "Write something …",
1932
+ showOnlyWhenEditable: !0,
1933
+ showOnlyCurrent: !0,
1934
+ includeChildren: !1
1935
+ };
1936
+ },
1937
+ addProseMirrorPlugins() {
1938
+ let e = this.options.dataAttribute ? `data-${kt(this.options.dataAttribute)}` : `data-${Ot}`;
1939
+ return [new E({
1940
+ key: new h("placeholder"),
1941
+ props: { decorations: ({ doc: t, selection: n }) => {
1942
+ let r = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: a } = n, o = [];
1943
+ if (!r) return null;
1944
+ let s = this.editor.isEmpty;
1945
+ return t.descendants((t, n) => {
1946
+ let r = a >= n && a <= n + t.nodeSize, c = !t.isLeaf && i(t);
1947
+ if (!t.type.isTextblock) return this.options.includeChildren;
1948
+ if ((r || !this.options.showOnlyCurrent) && c) {
1949
+ let i = [this.options.emptyNodeClass];
1950
+ s && i.push(this.options.emptyEditorClass);
1951
+ let a = v.node(n, n + t.nodeSize, {
1952
+ class: i.join(" "),
1953
+ [e]: typeof this.options.placeholder == "function" ? this.options.placeholder({
1954
+ editor: this.editor,
1955
+ node: t,
1956
+ pos: n,
1957
+ hasAnchor: r
1958
+ }) : this.options.placeholder
1959
+ });
1960
+ o.push(a);
1961
+ }
1962
+ return this.options.includeChildren;
1963
+ }), m.create(t, o);
1964
+ } }
1965
+ })];
1966
+ }
1967
+ }), y.create({
1968
+ name: "selection",
1969
+ addOptions() {
1970
+ return { className: "selection" };
1971
+ },
1972
+ addProseMirrorPlugins() {
1973
+ let { editor: e, options: t } = this;
1974
+ return [new E({
1975
+ key: new h("selection"),
1976
+ props: { decorations(n) {
1977
+ return n.selection.empty || e.isFocused || !e.isEditable || a(n.selection) || e.view.dragging ? null : m.create(n.doc, [v.inline(n.selection.from, n.selection.to, { class: t.className })]);
1978
+ } }
1979
+ })];
1980
+ }
1981
+ });
1982
+ function At({ types: e, node: t }) {
1983
+ return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
1984
+ }
1985
+ var jt = y.create({
1986
+ name: "trailingNode",
1987
+ addOptions() {
1988
+ return {
1989
+ node: void 0,
1990
+ notAfter: []
1991
+ };
1992
+ },
1993
+ addProseMirrorPlugins() {
1994
+ let e = new h(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));
1995
+ return [new E({
1996
+ key: e,
1997
+ appendTransaction: (n, r, i) => {
1998
+ let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
1999
+ if (!n.some((e) => e.getMeta("skipTrailingNode")) && c) return o.insert(l, u.create());
2000
+ },
2001
+ state: {
2002
+ init: (e, t) => {
2003
+ let r = t.tr.doc.lastChild;
2004
+ return !At({
2005
+ node: r,
2006
+ types: n
2007
+ });
2008
+ },
2009
+ apply: (e, t) => {
2010
+ if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
2011
+ let r = e.doc.lastChild;
2012
+ return !At({
2013
+ node: r,
2014
+ types: n
2015
+ });
2016
+ }
2017
+ }
2018
+ })];
2019
+ }
2020
+ }), Mt = y.create({
2021
+ name: "undoRedo",
2022
+ addOptions() {
2023
+ return {
2024
+ depth: 100,
2025
+ newGroupDelay: 500
2026
+ };
2027
+ },
2028
+ addCommands() {
2029
+ return {
2030
+ undo: () => ({ state: e, dispatch: t }) => Tt(e, t),
2031
+ redo: () => ({ state: e, dispatch: t }) => $(e, t)
2032
+ };
2033
+ },
2034
+ addProseMirrorPlugins() {
2035
+ return [Ct(this.options)];
2036
+ },
2037
+ addKeyboardShortcuts() {
2038
+ return {
2039
+ "Mod-z": () => this.editor.commands.undo(),
2040
+ "Shift-Mod-z": () => this.editor.commands.redo(),
2041
+ "Mod-y": () => this.editor.commands.redo(),
2042
+ "Mod-я": () => this.editor.commands.undo(),
2043
+ "Shift-Mod-я": () => this.editor.commands.redo()
2044
+ };
2045
+ }
2046
+ }), Nt = y.create({
2047
+ name: "starterKit",
2048
+ addExtensions() {
2049
+ let e = [];
2050
+ 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(Et.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(Dt.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(Mt.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(Le.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(se.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Ke.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(Xe.configure(this.options.paragraph)), this.options.strike !== !1 && e.push($e.configure(this.options.strike)), this.options.text !== !1 && e.push(et.configure(this.options.text)), this.options.underline !== !1 && e.push(ce.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(jt.configure(this.options?.trailingNode)), e;
2051
+ }
2052
+ }), Pt = Nt;
2053
+ //#endregion
2054
+ export { Nt as StarterKit, Pt as default };