@templatical/editor 0.15.1 → 0.16.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 (176) hide show
  1. package/README.md +1 -1
  2. package/dist/{AiChatSidebar-BIKvYREk.js → AiChatSidebar-EaPCeDXr.js} +14 -14
  3. package/dist/{AiFeatureMenu-CU6kTMTf.js → AiFeatureMenu-Rb8G3EBo.js} +7 -7
  4. package/dist/{BlockIssueBadge-B3xVgMTh.js → BlockIssueBadge-CZYgn-qg.js} +5 -5
  5. package/dist/{CloudEditor-DRPxvUEj.js → CloudEditor-D88gLBXp.js} +25 -25
  6. package/dist/{CollaboratorBar-DMSjd3HZ.js → CollaboratorBar-dxCD8jSi.js} +4 -4
  7. package/dist/ColorPicker-CAgMCX3A.js +442 -0
  8. package/dist/{CommentsSidebar-D_tSGvTX.js → CommentsSidebar-DDKiFsSq.js} +13 -13
  9. package/dist/{CountdownBlock-apiYUhkQ.js → CountdownBlock-173fiO5Z.js} +3 -3
  10. package/dist/{CountdownToolbar-CS0axcjz.js → CountdownToolbar-8XVTOuGX.js} +4 -4
  11. package/dist/{DesignReferenceSidebar-DWYK9nTk.js → DesignReferenceSidebar-D6TfC176.js} +11 -11
  12. package/dist/{IssuesPanel-CR1MPaDE.js → IssuesPanel-CQQipLQP.js} +8 -8
  13. package/dist/{LoadingTrack-DsecR8Rw.js → LoadingTrack-KIcREPlS.js} +1 -1
  14. package/dist/{MergeTagSuggestion-CH2SUxBo.js → MergeTagSuggestion-DrT3LiZ4.js} +4 -4
  15. package/dist/{ModuleBrowserModal-BOzleijA.js → ModuleBrowserModal-l4_RCC8m.js} +11 -11
  16. package/dist/{ModulePreviewCanvas-Cg99Pbde.js → ModulePreviewCanvas-BqYAr4fz.js} +3 -3
  17. package/dist/NumberWithSuffix-Di-cDy_m.js +89 -0
  18. package/dist/{ParagraphEditor-8jnzoL0A.js → ParagraphEditor-DIQ1jmSP.js} +230 -195
  19. package/dist/{RichTextEditorContent-BqLHIZY7.js → RichTextEditorContent-DkTJ6KK8.js} +56 -45
  20. package/dist/{SaveModuleDialog-Cy2XyjYT.js → SaveModuleDialog-DPo3Raon.js} +8 -8
  21. package/dist/{SnapshotHistory-cfxmOsJu.js → SnapshotHistory-m7brKV7C.js} +10 -10
  22. package/dist/{TemplateScoringPanel-CZ62rGHz.js → TemplateScoringPanel-C8VOC6gn.js} +15 -15
  23. package/dist/{TestEmailModal-sr1MaMVX.js → TestEmailModal-BE9sFEIl.js} +6 -6
  24. package/dist/{TitleEditor-CvGTprIg.js → TitleEditor-BATN-k-Q.js} +38 -35
  25. package/dist/{TplModal-BtKB-0Bx.js → TplModal-DHBcZ1gq.js} +5 -5
  26. package/dist/{blockTypeIcons-BxEbbev5.js → blockTypeIcons-wRchKKx0.js} +7 -7
  27. package/dist/bundle-stats.json +7 -7
  28. package/dist/ca-B3eR47lE.js +559 -0
  29. package/dist/cdn/chunks/{AiFeatureMenu-fDUpv_-s.js → AiFeatureMenu-W7VQFAwq.js} +6 -6
  30. package/dist/cdn/chunks/{AiFeatureMenu-fDUpv_-s.js.map → AiFeatureMenu-W7VQFAwq.js.map} +1 -1
  31. package/dist/cdn/chunks/{BlockIssueBadge-Byce0j0W.js → BlockIssueBadge-ww2vNIfJ.js} +5 -5
  32. package/dist/cdn/chunks/{BlockIssueBadge-Byce0j0W.js.map → BlockIssueBadge-ww2vNIfJ.js.map} +1 -1
  33. package/dist/cdn/chunks/{CloudEditor-B4m8ldiE.js → CloudEditor-BVSJ1kvB.js} +161 -161
  34. package/dist/cdn/chunks/{CloudEditor-B4m8ldiE.js.map → CloudEditor-BVSJ1kvB.js.map} +1 -1
  35. package/dist/cdn/chunks/{CollaboratorBar-LnLmjxw_.js → CollaboratorBar-BFrAua9a.js} +4 -4
  36. package/dist/cdn/chunks/{CollaboratorBar-LnLmjxw_.js.map → CollaboratorBar-BFrAua9a.js.map} +1 -1
  37. package/dist/cdn/chunks/ColorPicker-DmxMDn-t.js +439 -0
  38. package/dist/cdn/chunks/ColorPicker-DmxMDn-t.js.map +1 -0
  39. package/dist/cdn/chunks/{CountdownBlock-DxTuMRBM.js → CountdownBlock-MC-mhtQD.js} +3 -3
  40. package/dist/cdn/chunks/{CountdownBlock-DxTuMRBM.js.map → CountdownBlock-MC-mhtQD.js.map} +1 -1
  41. package/dist/cdn/chunks/{CountdownToolbar-DUrVfQZH.js → CountdownToolbar-dXyr7tz-.js} +5 -5
  42. package/dist/cdn/chunks/{CountdownToolbar-DUrVfQZH.js.map → CountdownToolbar-dXyr7tz-.js.map} +1 -1
  43. package/dist/cdn/chunks/{IssuesPanel-CHl90k4h.js → IssuesPanel-CTxSgViL.js} +8 -8
  44. package/dist/cdn/chunks/{IssuesPanel-CHl90k4h.js.map → IssuesPanel-CTxSgViL.js.map} +1 -1
  45. package/dist/cdn/chunks/{MergeTagSuggestion-BsCAo4Co.js → MergeTagSuggestion-jesxS7An.js} +3 -3
  46. package/dist/cdn/chunks/{MergeTagSuggestion-BsCAo4Co.js.map → MergeTagSuggestion-jesxS7An.js.map} +1 -1
  47. package/dist/cdn/chunks/{ModuleBrowserModal-DW0iQW0J.js → ModuleBrowserModal-B5sCsrud.js} +9 -9
  48. package/dist/cdn/chunks/{ModuleBrowserModal-DW0iQW0J.js.map → ModuleBrowserModal-B5sCsrud.js.map} +1 -1
  49. package/dist/cdn/chunks/{ModulePreviewCanvas-Cxo8v8t1.js → ModulePreviewCanvas-DGTGo8kg.js} +11 -11
  50. package/dist/cdn/chunks/{ModulePreviewCanvas-Cxo8v8t1.js.map → ModulePreviewCanvas-DGTGo8kg.js.map} +1 -1
  51. package/dist/cdn/chunks/NumberWithSuffix-tAHfui6k.js +91 -0
  52. package/dist/cdn/chunks/NumberWithSuffix-tAHfui6k.js.map +1 -0
  53. package/dist/cdn/chunks/{ParagraphEditor-iG5cDjH0.js → ParagraphEditor-CB5FGRs3.js} +213 -179
  54. package/dist/cdn/chunks/ParagraphEditor-CB5FGRs3.js.map +1 -0
  55. package/dist/cdn/chunks/{RichTextEditorContent-DQpgeGMj.js → RichTextEditorContent-CPelbtck.js} +53 -42
  56. package/dist/cdn/chunks/RichTextEditorContent-CPelbtck.js.map +1 -0
  57. package/dist/cdn/chunks/{SaveModuleDialog-sJQXg2Mh.js → SaveModuleDialog-7f9uUUEC.js} +6 -6
  58. package/dist/cdn/chunks/{SaveModuleDialog-sJQXg2Mh.js.map → SaveModuleDialog-7f9uUUEC.js.map} +1 -1
  59. package/dist/cdn/chunks/{TitleEditor-C8qIn9Oi.js → TitleEditor-C0mYpgs4.js} +46 -43
  60. package/dist/cdn/chunks/TitleEditor-C0mYpgs4.js.map +1 -0
  61. package/dist/cdn/chunks/{blockTypeIcons-DySnOpPo.js → blockTypeIcons-BtxaUtlx.js} +5 -5
  62. package/dist/cdn/chunks/{blockTypeIcons-DySnOpPo.js.map → blockTypeIcons-BtxaUtlx.js.map} +1 -1
  63. package/dist/cdn/chunks/ca-B3eR47lE.js +561 -0
  64. package/dist/cdn/chunks/ca-B3eR47lE.js.map +1 -0
  65. package/dist/cdn/chunks/ca-CNRWAMHI.js +89 -0
  66. package/dist/cdn/chunks/ca-CNRWAMHI.js.map +1 -0
  67. package/dist/{de-LsV0u1tP.js → cdn/chunks/de-Cy8FB-Ii.js} +7 -1
  68. package/dist/cdn/chunks/de-Cy8FB-Ii.js.map +1 -0
  69. package/dist/cdn/chunks/{draggable-kG-D5Xsm.js → draggable-D840DIZB.js} +52 -39
  70. package/dist/cdn/chunks/draggable-D840DIZB.js.map +1 -0
  71. package/dist/{en-Bb8X1bOs.js → cdn/chunks/en-Bu-zS_5o.js} +7 -1
  72. package/dist/cdn/chunks/en-Bu-zS_5o.js.map +1 -0
  73. package/dist/cdn/chunks/es-CD3ZD6hK.js +561 -0
  74. package/dist/cdn/chunks/es-CD3ZD6hK.js.map +1 -0
  75. package/dist/cdn/chunks/es-OgkdMZGX.js +89 -0
  76. package/dist/cdn/chunks/es-OgkdMZGX.js.map +1 -0
  77. package/dist/cdn/chunks/{extensions-C2pTX899.js → extensions-BJ7vaBol.js} +28 -28
  78. package/dist/cdn/chunks/{extensions-C2pTX899.js.map → extensions-BJ7vaBol.js.map} +1 -1
  79. package/dist/cdn/chunks/{features-CHE3YjQE.js → features-CgbSSCgv.js} +602 -566
  80. package/dist/cdn/chunks/features-CgbSSCgv.js.map +1 -0
  81. package/dist/cdn/chunks/{icons-M4uqBV-_.js → icons-Dlx5MT1V.js} +2 -2
  82. package/dist/cdn/chunks/{icons-M4uqBV-_.js.map → icons-Dlx5MT1V.js.map} +1 -1
  83. package/dist/cdn/chunks/{media-library-Bqr15VN2.js → media-library-BMlykZGq.js} +104 -104
  84. package/dist/cdn/chunks/{media-library-Bqr15VN2.js.map → media-library-BMlykZGq.js.map} +1 -1
  85. package/dist/{pt-BR-BwJY_cvb.js → cdn/chunks/pt-BR-CgICL-CQ.js} +7 -1
  86. package/dist/cdn/chunks/pt-BR-CgICL-CQ.js.map +1 -0
  87. package/dist/cdn/chunks/quality-DsVgXk_j.js +2180 -0
  88. package/dist/cdn/chunks/quality-DsVgXk_j.js.map +1 -0
  89. package/dist/cdn/chunks/{renderer-CyzTR1Vq.js → renderer-DPvEtVGO.js} +35 -38
  90. package/dist/cdn/chunks/renderer-DPvEtVGO.js.map +1 -0
  91. package/dist/cdn/chunks/{src-q-SBgWx7.js → src-CAdirukY.js} +109 -112
  92. package/dist/cdn/chunks/{src-q-SBgWx7.js.map → src-CAdirukY.js.map} +1 -1
  93. package/dist/cdn/chunks/{styles-PWISdaws.js → styles-D7u4vCpH.js} +877 -856
  94. package/dist/cdn/chunks/styles-D7u4vCpH.js.map +1 -0
  95. package/dist/cdn/chunks/{tiptap-DF9PEiqH.js → tiptap-zpXk5mN4.js} +3278 -4992
  96. package/dist/cdn/chunks/tiptap-zpXk5mN4.js.map +1 -0
  97. package/dist/cdn/editor.css +1 -1
  98. package/dist/cdn/editor.js +75 -73
  99. package/dist/cdn/editor.js.map +1 -1
  100. package/dist/{check-rl7ok6uJ.js → check-D1zYtCPK.js} +1 -1
  101. package/dist/{chevron-down-BKe__NOD.js → chevron-down-ByXpufZD.js} +1 -1
  102. package/dist/{circle-alert-C8xmpMsK.js → circle-alert-CjcAORUw.js} +1 -1
  103. package/dist/{clock-BW4JuDCN.js → clock-5lWLadUn.js} +1 -1
  104. package/dist/{cloud-BQusL53H.js → cloud-BogxOeZu.js} +2 -2
  105. package/dist/{createLucideIcon-Dx-EjR9r.js → createLucideIcon-Bh9xOmlW.js} +3 -3
  106. package/dist/{cdn/chunks/de-LsV0u1tP.js → de-Cy8FB-Ii.js} +5 -3
  107. package/dist/dist-BE9m_i60.js +5 -0
  108. package/dist/{dist-BFmE-7hB.js → dist-BPPeDw62.js} +2 -2
  109. package/dist/{dist-BsCGIDSt.js → dist-BReUTadj.js} +4 -4
  110. package/dist/dist-BXR1aBJV.js +5 -0
  111. package/dist/{dist-CRsjOQM-.js → dist-Bm07Z3Es.js} +2 -2
  112. package/dist/{dist-BEWiuOMi.js → dist-CFOQvhSC.js} +3 -3
  113. package/dist/{dist-B5Sov3sS.js → dist-CHLoeloJ.js} +2 -2
  114. package/dist/{dist-COG3IdPK.js → dist-D1WmF8BF.js} +2 -2
  115. package/dist/{dist-itdjZraK.js → dist-D9g4CSnm.js} +1 -1
  116. package/dist/{dist-BMoa33wT.js → dist-DGEaAAIb.js} +2 -2
  117. package/dist/{dist-CTT6WYJ6.js → dist-DYv_Pttj.js} +2 -2
  118. package/dist/{dist-CQZxDvFw.js → dist-DcKlLQ8d.js} +2 -2
  119. package/dist/{dist-SXJJ2v41.js → dist-DhY2di4U.js} +2 -2
  120. package/dist/{dist-BibU4HNl.js → dist-DoRIUsfz.js} +2 -3
  121. package/dist/dist-i_Z7t67A.js +2594 -0
  122. package/dist/{cdn/chunks/en-Bb8X1bOs.js → en-Bu-zS_5o.js} +5 -3
  123. package/dist/es-CD3ZD6hK.js +559 -0
  124. package/dist/{extensions-DwaZAqm6.js → extensions-B2poxDIo.js} +8 -8
  125. package/dist/{image-up-BwBCmQ4P.js → image-up-Bj_nes3f.js} +1 -1
  126. package/dist/{info-TCn7uWR5.js → info-BhSQCxBV.js} +1 -1
  127. package/dist/{keys-Cv8-8GsD.js → keys-BbDgCU6K.js} +1 -1
  128. package/dist/{list-checks-CSrOWNgq.js → list-checks-CgxyUg7i.js} +1 -1
  129. package/dist/{loader-circle-BLmicnPG.js → loader-circle-DFU0HPAa.js} +1 -1
  130. package/dist/{message-circle-C9hHMQCI.js → message-circle-BEBsCHnk.js} +1 -1
  131. package/dist/{cdn/chunks/pt-BR-BwJY_cvb.js → pt-BR-CgICL-CQ.js} +5 -3
  132. package/dist/{refresh-cw-D1JQ1LNa.js → refresh-cw--lvWGy0_.js} +1 -1
  133. package/dist/{runtime-dom.esm-bundler-BzuoCyNp.js → runtime-dom.esm-bundler-GdMI8WqG.js} +6 -7
  134. package/dist/{scan-line-DgijVq9y.js → scan-line-QgyDIgn_.js} +1 -1
  135. package/dist/{send-DjPdq69F.js → send-BMyisUim.js} +1 -1
  136. package/dist/{shield-check-Bqluu8FS.js → shield-check-C49M20le.js} +1 -1
  137. package/dist/{sparkles-M4azPVSP.js → sparkles-DV7Dman6.js} +1 -1
  138. package/dist/style.css +1 -1
  139. package/dist/{styles-B2OrgEnn.js → styles-B-yhoJnH.js} +537 -516
  140. package/dist/templatical-editor.js +62 -60
  141. package/dist/{text-align-start-CMya5pCQ.js → text-align-start-BMU70uAm.js} +1 -1
  142. package/dist/{trash-2-C-81rkLS.js → trash-2-B6M659Ey.js} +1 -1
  143. package/dist/{triangle-alert-BuRWnynk.js → triangle-alert-D1lzx6ds.js} +1 -1
  144. package/dist/{upload-CWBIoLd4.js → upload-3A1oZtOR.js} +1 -1
  145. package/dist/{useAliveFlag-CECL_OUb.js → useAliveFlag-C43EhZFY.js} +1 -1
  146. package/dist/{useCloudI18n-AKCy98qD.js → useCloudI18n-WbfVWq5k.js} +2 -2
  147. package/dist/{useEditorCore-DJeOXVxQ.js → useEditorCore-CV1ct_17.js} +628 -591
  148. package/dist/{useI18n-C-TDeJBt.js → useI18n-eR1yVW0v.js} +2 -2
  149. package/dist/{useMergeTag-DSrBY0-2.js → useMergeTag-C3GfSktg.js} +3 -3
  150. package/dist/usePopoverRoot-C1j0D7cc.js +8 -0
  151. package/dist/{vue.runtime.esm-bundler-l0XAqiyv.js → vue.runtime.esm-bundler-B0xoGkDv.js} +84 -70
  152. package/dist/{x-CQSvXnGR.js → x-CG_NV3nP.js} +1 -1
  153. package/package.json +23 -23
  154. package/dist/NumberWithSuffix-CrA6quxx.js +0 -445
  155. package/dist/cdn/chunks/NumberWithSuffix-CnSRmUMK.js +0 -444
  156. package/dist/cdn/chunks/NumberWithSuffix-CnSRmUMK.js.map +0 -1
  157. package/dist/cdn/chunks/ParagraphEditor-iG5cDjH0.js.map +0 -1
  158. package/dist/cdn/chunks/RichTextEditorContent-DQpgeGMj.js.map +0 -1
  159. package/dist/cdn/chunks/TitleEditor-C8qIn9Oi.js.map +0 -1
  160. package/dist/cdn/chunks/de-LsV0u1tP.js.map +0 -1
  161. package/dist/cdn/chunks/draggable-kG-D5Xsm.js.map +0 -1
  162. package/dist/cdn/chunks/en-Bb8X1bOs.js.map +0 -1
  163. package/dist/cdn/chunks/features-CHE3YjQE.js.map +0 -1
  164. package/dist/cdn/chunks/pt-BR-BwJY_cvb.js.map +0 -1
  165. package/dist/cdn/chunks/quality-DJZ_fqc2.js +0 -2176
  166. package/dist/cdn/chunks/quality-DJZ_fqc2.js.map +0 -1
  167. package/dist/cdn/chunks/renderer-CyzTR1Vq.js.map +0 -1
  168. package/dist/cdn/chunks/styleConstants-lGobwiLH.js +0 -57
  169. package/dist/cdn/chunks/styleConstants-lGobwiLH.js.map +0 -1
  170. package/dist/cdn/chunks/styles-PWISdaws.js.map +0 -1
  171. package/dist/cdn/chunks/tiptap-DF9PEiqH.js.map +0 -1
  172. package/dist/dist-CNLKj9wa.js +0 -5
  173. package/dist/dist-CNXDNYQn.js +0 -4311
  174. package/dist/dist-Cqa6aeAJ.js +0 -5
  175. package/dist/styleConstants-lGobwiLH.js +0 -55
  176. package/dist/usePopoverRoot-DKUDnr55.js +0 -8
@@ -0,0 +1,2594 @@
1
+ import { Cn as e, Ct as t, Dn as n, En as r, Mt as i, Nt as a, On as o, Pt as s, Sn as c, Tn as l, Ut as u, Wt as d, Xt as f, Y as p, Z as m, _n as h, at as g, bn as _, c as v, en as ee, gn as y, i as b, in as te, mn as ne, ot as re, qt as x, rt as ie, u as S, v as ae, vn as C, wn as w, wt as oe, xn as T, y as se, yn as E } from "./dist-D9g4CSnm.js";
2
+ import { Link as ce } from "./dist-CHLoeloJ.js";
3
+ import { Underline as le } from "./dist-DGEaAAIb.js";
4
+ //#region ../../node_modules/.pnpm/@tiptap+core@3.28.0_@tiptap+pm@3.28.0/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
+ }, ue = (e, t) => {
16
+ let { state: n, view: r } = e, { selection: i } = n;
17
+ if (!i.empty) return !1;
18
+ let { $from: a } = i;
19
+ if (a.parentOffset !== 0) return !1;
20
+ let o = a.depth - 1;
21
+ if (o < 0) return !1;
22
+ let s = a.node(o), c = a.index(o);
23
+ if (c === 0) return !1;
24
+ if (s.type === t) return e.commands.lift(t.name);
25
+ let l = s.child(c - 1);
26
+ if (l.type !== t || !l.lastChild?.isTextblock) return !1;
27
+ let u = a.before(), d = u - 1 - 1, { tr: f } = n;
28
+ return f.delete(u, a.after()).insert(d, a.parent.content), f.setSelection(w.create(f.doc, d)), r.dispatch(f.scrollIntoView()), !0;
29
+ }, de = /^\s*>\s$/, fe = S.create({
30
+ name: "blockquote",
31
+ addOptions() {
32
+ return { HTMLAttributes: {} };
33
+ },
34
+ content: "block+",
35
+ group: "block",
36
+ defining: !0,
37
+ parseHTML() {
38
+ return [{ tag: "blockquote" }];
39
+ },
40
+ renderHTML({ HTMLAttributes: e }) {
41
+ return /* @__PURE__ */ D("blockquote", {
42
+ ...x(this.options.HTMLAttributes, e),
43
+ children: /* @__PURE__ */ D("slot", {})
44
+ });
45
+ },
46
+ parseMarkdown: (e, t) => {
47
+ let n = t.parseBlockChildren ?? t.parseChildren;
48
+ return t.createNode("blockquote", void 0, n(e.tokens || []));
49
+ },
50
+ renderMarkdown: (e, t) => {
51
+ if (!e.content) return "";
52
+ let n = [];
53
+ return e.content.forEach((e, r) => {
54
+ let i = (t.renderChild?.call(t, e, r) ?? t.renderChildren([e])).split("\n").map((e) => e.trim() === "" ? ">" : `> ${e}`);
55
+ n.push(i.join("\n"));
56
+ }), n.join("\n>\n");
57
+ },
58
+ addCommands() {
59
+ return {
60
+ setBlockquote: () => ({ commands: e }) => e.wrapIn(this.name),
61
+ toggleBlockquote: () => ({ commands: e }) => e.toggleWrap(this.name),
62
+ unsetBlockquote: () => ({ commands: e }) => e.lift(this.name)
63
+ };
64
+ },
65
+ addKeyboardShortcuts() {
66
+ return {
67
+ "Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
68
+ Backspace: () => ue(this.editor, this.type)
69
+ };
70
+ },
71
+ addInputRules() {
72
+ return [y({
73
+ find: de,
74
+ type: this.type
75
+ })];
76
+ }
77
+ }), pe = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, me = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, he = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, ge = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, _e = v.create({
78
+ name: "bold",
79
+ addOptions() {
80
+ return { HTMLAttributes: {} };
81
+ },
82
+ parseHTML() {
83
+ return [
84
+ { tag: "strong" },
85
+ {
86
+ tag: "b",
87
+ getAttrs: (e) => e.style.fontWeight !== "normal" && null
88
+ },
89
+ {
90
+ style: "font-weight=400",
91
+ clearMark: (e) => e.type.name === this.name
92
+ },
93
+ {
94
+ style: "font-weight",
95
+ getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
96
+ }
97
+ ];
98
+ },
99
+ renderHTML({ HTMLAttributes: e }) {
100
+ return /* @__PURE__ */ D("strong", {
101
+ ...x(this.options.HTMLAttributes, e),
102
+ children: /* @__PURE__ */ D("slot", {})
103
+ });
104
+ },
105
+ markdownTokenName: "strong",
106
+ parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
107
+ markdownOptions: { htmlReopen: {
108
+ open: "<strong>",
109
+ close: "</strong>"
110
+ } },
111
+ renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
112
+ addCommands() {
113
+ return {
114
+ setBold: () => ({ commands: e }) => e.setMark(this.name),
115
+ toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
116
+ unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
117
+ };
118
+ },
119
+ addKeyboardShortcuts() {
120
+ return {
121
+ "Mod-b": () => this.editor.commands.toggleBold(),
122
+ "Mod-B": () => this.editor.commands.toggleBold()
123
+ };
124
+ },
125
+ addInputRules() {
126
+ return [u({
127
+ find: pe,
128
+ type: this.type
129
+ }), u({
130
+ find: he,
131
+ type: this.type
132
+ })];
133
+ },
134
+ addPasteRules() {
135
+ return [d({
136
+ find: me,
137
+ type: this.type
138
+ }), d({
139
+ find: ge,
140
+ type: this.type
141
+ })];
142
+ }
143
+ }), ve = (e) => {
144
+ let t = /`([^`]+)`(?!`)$/.exec(e);
145
+ return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
146
+ index: t.index,
147
+ text: t[0],
148
+ replaceWith: t[1]
149
+ };
150
+ }, ye = (e) => {
151
+ let t = /`([^`]+)`(?!`)/g, n = [], r;
152
+ for (; (r = t.exec(e)) !== null;) r.index > 0 && e[r.index - 1] === "`" || n.push({
153
+ index: r.index,
154
+ text: r[0],
155
+ replaceWith: r[1]
156
+ });
157
+ return n;
158
+ }, be = v.create({
159
+ name: "code",
160
+ addOptions() {
161
+ return { HTMLAttributes: {} };
162
+ },
163
+ excludes: "_",
164
+ code: !0,
165
+ exitable: !0,
166
+ parseHTML() {
167
+ return [{ tag: "code" }];
168
+ },
169
+ renderHTML({ HTMLAttributes: e }) {
170
+ return [
171
+ "code",
172
+ x(this.options.HTMLAttributes, e),
173
+ 0
174
+ ];
175
+ },
176
+ markdownTokenName: "codespan",
177
+ parseMarkdown: (e, t) => t.applyMark("code", [{
178
+ type: "text",
179
+ text: e.text || ""
180
+ }]),
181
+ renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
182
+ addCommands() {
183
+ return {
184
+ setCode: () => ({ commands: e }) => e.setMark(this.name),
185
+ toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
186
+ unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
187
+ };
188
+ },
189
+ addKeyboardShortcuts() {
190
+ return { "Mod-e": () => this.editor.commands.toggleCode() };
191
+ },
192
+ addInputRules() {
193
+ return [u({
194
+ find: ve,
195
+ type: this.type
196
+ })];
197
+ },
198
+ addPasteRules() {
199
+ return [d({
200
+ find: ye,
201
+ type: this.type
202
+ })];
203
+ }
204
+ }), O = 4, xe = /^```([a-z]+)?[\s\n]$/, Se = /^~~~([a-z]+)?[\s\n]$/, Ce = S.create({
205
+ name: "codeBlock",
206
+ addOptions() {
207
+ return {
208
+ languageClassPrefix: "language-",
209
+ exitOnTripleEnter: !0,
210
+ exitOnArrowDown: !0,
211
+ defaultLanguage: null,
212
+ enableTabIndentation: !1,
213
+ tabSize: O,
214
+ HTMLAttributes: {}
215
+ };
216
+ },
217
+ content: "text*",
218
+ marks: "",
219
+ group: "block",
220
+ code: !0,
221
+ defining: !0,
222
+ addAttributes() {
223
+ return { language: {
224
+ default: this.options.defaultLanguage,
225
+ parseHTML: (e) => {
226
+ let { languageClassPrefix: t } = this.options;
227
+ return t && [...e.firstElementChild?.classList || []].filter((e) => e.startsWith(t)).map((e) => e.replace(t, ""))[0] || null;
228
+ },
229
+ rendered: !1
230
+ } };
231
+ },
232
+ parseHTML() {
233
+ return [{
234
+ tag: "pre",
235
+ preserveWhitespace: "full"
236
+ }];
237
+ },
238
+ renderHTML({ node: e, HTMLAttributes: t }) {
239
+ return [
240
+ "pre",
241
+ x(this.options.HTMLAttributes, t),
242
+ [
243
+ "code",
244
+ { class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null },
245
+ 0
246
+ ]
247
+ ];
248
+ },
249
+ markdownTokenName: "code",
250
+ 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)] : []),
251
+ renderMarkdown: (e, t) => {
252
+ let n = "", r = e.attrs?.language || "";
253
+ return n = e.content ? [
254
+ `\`\`\`${r}`,
255
+ t.renderChildren(e.content),
256
+ "```"
257
+ ].join("\n") : `\`\`\`${r}
258
+
259
+ \`\`\``, n;
260
+ },
261
+ addCommands() {
262
+ return {
263
+ setCodeBlock: (e) => ({ commands: t }) => t.setNode(this.name, e),
264
+ toggleCodeBlock: (e) => ({ commands: t }) => t.toggleNode(this.name, "paragraph", e)
265
+ };
266
+ },
267
+ addKeyboardShortcuts() {
268
+ return {
269
+ "Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
270
+ Backspace: () => {
271
+ let { empty: e, $anchor: t } = this.editor.state.selection, n = t.pos === 1;
272
+ return !e || t.parent.type.name !== this.name ? !1 : n || !t.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
273
+ },
274
+ Tab: ({ editor: e }) => {
275
+ if (!this.options.enableTabIndentation) return !1;
276
+ let t = this.options.tabSize ?? O, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
277
+ if (i.parent.type !== this.type) return !1;
278
+ let o = " ".repeat(t);
279
+ return a ? e.commands.insertContent(o) : e.commands.command(({ tr: e }) => {
280
+ let { from: t, to: i } = r, a = n.doc.textBetween(t, i, "\n", "\n").split("\n").map((e) => o + e).join("\n");
281
+ return e.replaceWith(t, i, n.schema.text(a)), !0;
282
+ });
283
+ },
284
+ "Shift-Tab": ({ editor: e }) => {
285
+ if (!this.options.enableTabIndentation) return !1;
286
+ let t = this.options.tabSize ?? O, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
287
+ return i.parent.type === this.type ? a ? e.commands.command(({ tr: e }) => {
288
+ let { pos: r } = i, a = i.start(), o = i.end(), s = n.doc.textBetween(a, o, "\n", "\n").split("\n"), c = 0, l = 0, u = r - a;
289
+ for (let e = 0; e < s.length; e += 1) {
290
+ if (l + s[e].length >= u) {
291
+ c = e;
292
+ break;
293
+ }
294
+ l += s[e].length + 1;
295
+ }
296
+ let d = s[c].match(/^ */)?.[0] || "", f = Math.min(d.length, t);
297
+ if (f === 0) return !0;
298
+ let p = a;
299
+ for (let e = 0; e < c; e += 1) p += s[e].length + 1;
300
+ return e.delete(p, p + f), r - p <= f && e.setSelection(w.create(e.doc, p)), !0;
301
+ }) : e.commands.command(({ tr: e }) => {
302
+ let { from: i, to: a } = r, o = n.doc.textBetween(i, a, "\n", "\n").split("\n").map((e) => {
303
+ let n = e.match(/^ */)?.[0] || "", r = Math.min(n.length, t);
304
+ return e.slice(r);
305
+ }).join("\n");
306
+ return e.replaceWith(i, a, n.schema.text(o)), !0;
307
+ }) : !1;
308
+ },
309
+ Enter: ({ editor: e }) => {
310
+ if (!this.options.exitOnTripleEnter) return !1;
311
+ let { state: t } = e, { selection: n } = t, { $from: r, empty: i } = n;
312
+ if (!i || r.parent.type !== this.type) return !1;
313
+ let a = r.parentOffset === r.parent.nodeSize - 2, o = r.parent.textContent.endsWith("\n\n");
314
+ return !a || !o ? !1 : e.chain().command(({ tr: e }) => (e.delete(r.pos - 2, r.pos), !0)).exitCode().run();
315
+ },
316
+ ArrowDown: ({ editor: t }) => {
317
+ if (!this.options.exitOnArrowDown) return !1;
318
+ let { state: n } = t, { selection: r, doc: i } = n, { $from: a, empty: o } = r;
319
+ if (!o || a.parent.type !== this.type || a.parentOffset !== a.parent.nodeSize - 2) return !1;
320
+ let s = a.after();
321
+ return s === void 0 ? !1 : i.nodeAt(s) ? t.commands.command(({ tr: t }) => (t.setSelection(e.near(i.resolve(s))), !0)) : t.commands.exitCode();
322
+ }
323
+ };
324
+ },
325
+ addInputRules() {
326
+ return [ne({
327
+ find: xe,
328
+ type: this.type,
329
+ getAttributes: (e) => ({ language: e[1] })
330
+ }), ne({
331
+ find: Se,
332
+ type: this.type,
333
+ getAttributes: (e) => ({ language: e[1] })
334
+ })];
335
+ },
336
+ addProseMirrorPlugins() {
337
+ return [new T({
338
+ key: new c("codeBlockVSCodeHandler"),
339
+ props: { handlePaste: (e, t) => {
340
+ if (!t.clipboardData || this.editor.isActive(this.type.name)) return !1;
341
+ let n = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), i = (r ? JSON.parse(r) : void 0)?.mode;
342
+ if (!n || !i) return !1;
343
+ let { tr: a, schema: o } = e.state, s = o.text(n.replace(/\r\n?/g, "\n"));
344
+ return a.replaceSelectionWith(this.type.create({ language: i }, s)), a.selection.$from.parent.type !== this.type && a.setSelection(w.near(a.doc.resolve(Math.max(0, a.selection.from - 2)))), a.setMeta("paste", !0), e.dispatch(a), !0;
345
+ } }
346
+ })];
347
+ }
348
+ }), we = S.create({
349
+ name: "doc",
350
+ topNode: !0,
351
+ content: "block+",
352
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n\n") : ""
353
+ }), Te = S.create({
354
+ name: "hardBreak",
355
+ markdownTokenName: "br",
356
+ addOptions() {
357
+ return {
358
+ keepMarks: !0,
359
+ HTMLAttributes: {}
360
+ };
361
+ },
362
+ inline: !0,
363
+ group: "inline",
364
+ selectable: !1,
365
+ linebreakReplacement: !0,
366
+ parseHTML() {
367
+ return [{ tag: "br" }];
368
+ },
369
+ renderHTML({ HTMLAttributes: e }) {
370
+ return ["br", x(this.options.HTMLAttributes, e)];
371
+ },
372
+ renderText() {
373
+ return "\n";
374
+ },
375
+ renderMarkdown: () => " \n",
376
+ parseMarkdown: () => ({ type: "hardBreak" }),
377
+ addCommands() {
378
+ return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
379
+ let { selection: e, storedMarks: i } = n;
380
+ if (e.$from.parent.type.spec.isolating) return !1;
381
+ let { keepMarks: a } = this.options, { splittableMarks: o } = r.extensionManager, s = i || e.$to.parentOffset && e.$from.marks();
382
+ return t().insertContent({ type: this.name }).command(({ tr: e, dispatch: t }) => {
383
+ if (t && s && a) {
384
+ let t = s.filter((e) => o.includes(e.type.name));
385
+ e.ensureMarks(t);
386
+ }
387
+ return !0;
388
+ }).run();
389
+ })]) };
390
+ },
391
+ addKeyboardShortcuts() {
392
+ return {
393
+ "Mod-Enter": () => this.editor.commands.setHardBreak(),
394
+ "Shift-Enter": () => this.editor.commands.setHardBreak()
395
+ };
396
+ }
397
+ }), Ee = S.create({
398
+ name: "heading",
399
+ addOptions() {
400
+ return {
401
+ levels: [
402
+ 1,
403
+ 2,
404
+ 3,
405
+ 4,
406
+ 5,
407
+ 6
408
+ ],
409
+ HTMLAttributes: {}
410
+ };
411
+ },
412
+ content: "inline*",
413
+ group: "block",
414
+ defining: !0,
415
+ addAttributes() {
416
+ return { level: {
417
+ default: 1,
418
+ rendered: !1
419
+ } };
420
+ },
421
+ parseHTML() {
422
+ return this.options.levels.map((e) => ({
423
+ tag: `h${e}`,
424
+ attrs: { level: e }
425
+ }));
426
+ },
427
+ renderHTML({ node: e, HTMLAttributes: t }) {
428
+ return [
429
+ `h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
430
+ x(this.options.HTMLAttributes, t),
431
+ 0
432
+ ];
433
+ },
434
+ parseMarkdown: (e, t) => t.createNode("heading", { level: e.depth || 1 }, t.parseInline(e.tokens || [])),
435
+ renderMarkdown: (e, t) => {
436
+ let n = e.attrs?.level ? parseInt(e.attrs.level, 10) : 1, r = "#".repeat(n);
437
+ return e.content ? `${r} ${t.renderChildren(e.content)}` : "";
438
+ },
439
+ addCommands() {
440
+ return {
441
+ setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
442
+ toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
443
+ };
444
+ },
445
+ addKeyboardShortcuts() {
446
+ return this.options.levels.reduce((e, t) => ({
447
+ ...e,
448
+ [`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
449
+ }), {});
450
+ },
451
+ addInputRules() {
452
+ return this.options.levels.map((e) => ne({
453
+ find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
454
+ type: this.type,
455
+ getAttributes: { level: e }
456
+ }));
457
+ }
458
+ }), De = S.create({
459
+ name: "horizontalRule",
460
+ addOptions() {
461
+ return {
462
+ HTMLAttributes: {},
463
+ nextNodeType: "paragraph"
464
+ };
465
+ },
466
+ group: "block",
467
+ parseHTML() {
468
+ return [{ tag: "hr" }];
469
+ },
470
+ renderHTML({ HTMLAttributes: e }) {
471
+ return ["hr", x(this.options.HTMLAttributes, e)];
472
+ },
473
+ markdownTokenName: "hr",
474
+ parseMarkdown: (e, t) => t.createNode("horizontalRule"),
475
+ renderMarkdown: () => "---",
476
+ addCommands() {
477
+ return { setHorizontalRule: () => ({ chain: e, state: t }) => {
478
+ if (!se(t, t.schema.nodes[this.name])) return !1;
479
+ let { selection: n } = t, { $to: r } = n, i = e();
480
+ return s(n) ? i.insertContentAt(r.pos, { type: this.name }) : i.insertContent({ type: this.name }), i.command(({ state: e, tr: t, dispatch: n }) => {
481
+ if (n) {
482
+ let { $to: n } = t.selection, r = n.end();
483
+ if (n.nodeAfter) n.nodeAfter.isTextblock ? t.setSelection(w.create(t.doc, n.pos + 1)) : n.nodeAfter.isBlock ? t.setSelection(_.create(t.doc, n.pos)) : t.setSelection(w.create(t.doc, n.pos));
484
+ else {
485
+ let i = (e.schema.nodes[this.options.nextNodeType] || n.parent.type.contentMatch.defaultType)?.create();
486
+ i && (t.insert(r, i), t.setSelection(w.create(t.doc, r + 1)));
487
+ }
488
+ t.scrollIntoView();
489
+ }
490
+ return !0;
491
+ }).run();
492
+ } };
493
+ },
494
+ addInputRules() {
495
+ return [f({
496
+ find: /^(?:---|—-|___\s|\*\*\*\s)$/,
497
+ type: this.type
498
+ })];
499
+ }
500
+ }), Oe = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, ke = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Ae = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, je = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Me = v.create({
501
+ name: "italic",
502
+ addOptions() {
503
+ return { HTMLAttributes: {} };
504
+ },
505
+ parseHTML() {
506
+ return [
507
+ { tag: "em" },
508
+ {
509
+ tag: "i",
510
+ getAttrs: (e) => e.style.fontStyle !== "normal" && null
511
+ },
512
+ {
513
+ style: "font-style=normal",
514
+ clearMark: (e) => e.type.name === this.name
515
+ },
516
+ { style: "font-style=italic" }
517
+ ];
518
+ },
519
+ renderHTML({ HTMLAttributes: e }) {
520
+ return [
521
+ "em",
522
+ x(this.options.HTMLAttributes, e),
523
+ 0
524
+ ];
525
+ },
526
+ addCommands() {
527
+ return {
528
+ setItalic: () => ({ commands: e }) => e.setMark(this.name),
529
+ toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
530
+ unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
531
+ };
532
+ },
533
+ markdownTokenName: "em",
534
+ parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
535
+ markdownOptions: { htmlReopen: {
536
+ open: "<em>",
537
+ close: "</em>"
538
+ } },
539
+ renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
540
+ addKeyboardShortcuts() {
541
+ return {
542
+ "Mod-i": () => this.editor.commands.toggleItalic(),
543
+ "Mod-I": () => this.editor.commands.toggleItalic()
544
+ };
545
+ },
546
+ addInputRules() {
547
+ return [u({
548
+ find: Oe,
549
+ type: this.type
550
+ }), u({
551
+ find: Ae,
552
+ type: this.type
553
+ })];
554
+ },
555
+ addPasteRules() {
556
+ return [d({
557
+ find: ke,
558
+ type: this.type
559
+ }), d({
560
+ find: je,
561
+ type: this.type
562
+ })];
563
+ }
564
+ }), Ne = Object.defineProperty, Pe = (e, t) => {
565
+ for (var n in t) Ne(e, n, {
566
+ get: t[n],
567
+ enumerable: !0
568
+ });
569
+ }, Fe = "listItem", Ie = "textStyle", Le = /^\s*([-+*])\s$/, Re = S.create({
570
+ name: "bulletList",
571
+ addOptions() {
572
+ return {
573
+ itemTypeName: "listItem",
574
+ HTMLAttributes: {},
575
+ keepMarks: !1,
576
+ keepAttributes: !1
577
+ };
578
+ },
579
+ group: "block list",
580
+ content() {
581
+ return `${this.options.itemTypeName}+`;
582
+ },
583
+ parseHTML() {
584
+ return [{ tag: "ul" }];
585
+ },
586
+ renderHTML({ HTMLAttributes: e }) {
587
+ return [
588
+ "ul",
589
+ x(this.options.HTMLAttributes, e),
590
+ 0
591
+ ];
592
+ },
593
+ markdownTokenName: "list",
594
+ parseMarkdown: (e, t) => e.type !== "list" || e.ordered ? [] : {
595
+ type: "bulletList",
596
+ content: e.items ? t.parseChildren(e.items) : []
597
+ },
598
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
599
+ markdownOptions: { indentsContent: !0 },
600
+ addCommands() {
601
+ return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Fe, this.editor.getAttributes(Ie)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
602
+ },
603
+ addKeyboardShortcuts() {
604
+ return { "Mod-Shift-8": () => this.editor.commands.toggleBulletList() };
605
+ },
606
+ addInputRules() {
607
+ let e = y({
608
+ find: Le,
609
+ type: this.type
610
+ });
611
+ return (this.options.keepMarks || this.options.keepAttributes) && (e = y({
612
+ find: Le,
613
+ type: this.type,
614
+ keepMarks: this.options.keepMarks,
615
+ keepAttributes: this.options.keepAttributes,
616
+ getAttributes: () => this.editor.getAttributes(Ie),
617
+ editor: this.editor
618
+ })), [e];
619
+ }
620
+ }), ze = (e, t, n) => {
621
+ let { selection: r } = e;
622
+ if (!r.empty) return null;
623
+ let { $from: i } = r;
624
+ if (!i.parent.isTextblock || i.parentOffset !== i.parent.content.size) return null;
625
+ let a = -1;
626
+ for (let e = i.depth; e > 0; --e) if (i.node(e).type.name === t) {
627
+ a = e;
628
+ break;
629
+ }
630
+ if (a < 0) return null;
631
+ let o = i.node(a), s = i.index(a);
632
+ if (s + 1 >= o.childCount) return null;
633
+ let c = o.child(s + 1);
634
+ if (!n.includes(c.type.name)) return null;
635
+ let l = e.schema.nodes[t], u = !1;
636
+ if (c.forEach((e) => {
637
+ e.type === l && e.childCount > 1 && (u = !0);
638
+ }), !u) return null;
639
+ let d = e.doc.resolve(i.after()).nodeAfter;
640
+ if (!d || !n.includes(d.type.name)) return null;
641
+ let f = [];
642
+ return d.forEach((e) => {
643
+ f.push(e);
644
+ }), f.length === 0 ? null : {
645
+ listItemDepth: a,
646
+ nestedList: d,
647
+ nestedListPos: i.after(),
648
+ insertPos: i.after(a),
649
+ items: f
650
+ };
651
+ }, Be = (e, t, r, i) => {
652
+ let a = ze(e, r, i);
653
+ if (!a) return !1;
654
+ let { selection: o } = e, { nestedList: s, nestedListPos: c, insertPos: l, items: u } = a, d = e.tr;
655
+ d.delete(c, c + s.nodeSize);
656
+ let f = d.mapping.map(l);
657
+ return d.insert(f, n.from(u)), d.setSelection(o.map(d.doc, d.mapping)), t && t(d), !0;
658
+ }, Ve = (e, t, n) => Be(e.state, e.view.dispatch, t, n), He = (e, t) => b.create({
659
+ name: `${e}BranchingDeleteKeymap`,
660
+ priority: 101,
661
+ addKeyboardShortcuts() {
662
+ let n = () => Ve(this.editor, e, t);
663
+ return {
664
+ Delete: n,
665
+ "Mod-Delete": n
666
+ };
667
+ }
668
+ }), Ue = [
669
+ [1e3, "m"],
670
+ [900, "cm"],
671
+ [500, "d"],
672
+ [400, "cd"],
673
+ [100, "c"],
674
+ [90, "xc"],
675
+ [50, "l"],
676
+ [40, "xl"],
677
+ [10, "x"],
678
+ [9, "ix"],
679
+ [5, "v"],
680
+ [4, "iv"],
681
+ [1, "i"]
682
+ ], k = "abcdefghijklmnopqrstuvwxyz", We = String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;
683
+ function A(e) {
684
+ let t = e, n = "";
685
+ for (let [e, r] of Ue) for (; t >= e;) n += r, t -= e;
686
+ return n;
687
+ }
688
+ function j(e) {
689
+ return A(e).toUpperCase();
690
+ }
691
+ function Ge(e) {
692
+ let t = e.toLowerCase(), n = 0, r = 0;
693
+ for (; n < t.length;) {
694
+ let e = !1;
695
+ for (let [i, a] of Ue) if (t.startsWith(a, n)) {
696
+ r += i, n += a.length, e = !0;
697
+ break;
698
+ }
699
+ if (!e) return 0;
700
+ }
701
+ return r;
702
+ }
703
+ function Ke(e) {
704
+ if (!/^[ivxlcdmIVXLCDM]+$/.test(e)) return !1;
705
+ let t = Ge(e);
706
+ return t <= 0 ? !1 : (e === e.toLowerCase() ? A(t) : j(t)) === e;
707
+ }
708
+ function qe(e) {
709
+ let t = e.toLowerCase();
710
+ if (t.length === 1) return t.charCodeAt(0) - 97 + 1;
711
+ if (t.length === 2) {
712
+ let e = t.charCodeAt(0) - 97, n = t.charCodeAt(1) - 97;
713
+ return (e + 1) * 26 + n + 1;
714
+ }
715
+ return 0;
716
+ }
717
+ function M(e) {
718
+ if (e <= 26) return k[e - 1];
719
+ let t = Math.floor((e - 1) / 26) - 1, n = (e - 1) % 26;
720
+ return t < 0 ? k[n] : k[t] + k[n];
721
+ }
722
+ function N(e) {
723
+ if (!(!e || /^\d+$/.test(e))) {
724
+ if (Ke(e)) return e === e.toLowerCase() ? "i" : "I";
725
+ if (/^[a-z]{1,2}$/.test(e)) return "a";
726
+ if (/^[A-Z]{1,2}$/.test(e)) return "A";
727
+ }
728
+ }
729
+ function P(e) {
730
+ if (/^\d+$/.test(e)) return parseInt(e, 10);
731
+ let t = N(e);
732
+ if (t === "i" || t === "I") return Ge(e);
733
+ if (t === "a" || t === "A") {
734
+ let t = qe(e);
735
+ return t > 0 ? t : 1;
736
+ }
737
+ let n = parseInt(e, 10);
738
+ return Number.isNaN(n) ? 1 : n;
739
+ }
740
+ function Je(e, t) {
741
+ if (e === "numeric") return String(t);
742
+ switch (e) {
743
+ case "a": return M(t);
744
+ case "A": return M(t).toUpperCase();
745
+ case "i": return A(t);
746
+ case "I": return j(t);
747
+ default: return String(t);
748
+ }
749
+ }
750
+ function Ye(e) {
751
+ if (e.length === 0) return !1;
752
+ let t = N(e[0]) ?? "numeric", n = P(e[0]);
753
+ if (n < 1) return !1;
754
+ for (let r = 0; r < e.length; r++) {
755
+ let i = Je(t, n + r);
756
+ if (e[r] !== i) return !1;
757
+ }
758
+ return !0;
759
+ }
760
+ function Xe(e) {
761
+ return {
762
+ type: N(e),
763
+ start: P(e)
764
+ };
765
+ }
766
+ function Ze(e) {
767
+ let { type: t, start: n } = Xe(e), r = {};
768
+ return t && (r.type = t), n !== 1 && (r.start = n), r;
769
+ }
770
+ function Qe(e, t, n = ". ") {
771
+ let r = t + 1;
772
+ if (!e || e === "1") return `${r}${n}`;
773
+ switch (e) {
774
+ case "a": return `${M(r)}${n}`;
775
+ case "A": return `${M(r).toUpperCase()}${n}`;
776
+ case "i": return `${A(r)}${n}`;
777
+ case "I": return `${j(r)}${n}`;
778
+ default: return `${r}${n}`;
779
+ }
780
+ }
781
+ function $e(e) {
782
+ let t = e.tokens?.[0];
783
+ return !!(e.text && e.tokens?.length === 1 && t?.type === "list" && t.ordered && t.raw === e.text);
784
+ }
785
+ function et(e, t) {
786
+ return t.tokenizeInline ? t.parseInline(t.tokenizeInline(e)) : t.parseInline([{
787
+ type: "text",
788
+ raw: e,
789
+ text: e
790
+ }]);
791
+ }
792
+ var tt = S.create({
793
+ name: "listItem",
794
+ addOptions() {
795
+ return {
796
+ HTMLAttributes: {},
797
+ bulletListTypeName: "bulletList",
798
+ orderedListTypeName: "orderedList"
799
+ };
800
+ },
801
+ content: "paragraph block*",
802
+ defining: !0,
803
+ parseHTML() {
804
+ return [{ tag: "li" }];
805
+ },
806
+ renderHTML({ HTMLAttributes: e }) {
807
+ return [
808
+ "li",
809
+ x(this.options.HTMLAttributes, e),
810
+ 0
811
+ ];
812
+ },
813
+ markdownTokenName: "list_item",
814
+ parseMarkdown: (e, t) => {
815
+ if (e.type !== "list_item") return [];
816
+ let n = t.parseBlockChildren ?? t.parseChildren, r = [];
817
+ if (e.tokens && e.tokens.length > 0) {
818
+ if ($e(e)) return {
819
+ type: "listItem",
820
+ content: [{
821
+ type: "paragraph",
822
+ content: et(e.text || "", t)
823
+ }]
824
+ };
825
+ if (e.tokens.some((e) => e.type === "paragraph")) r = n(e.tokens);
826
+ else {
827
+ let i = e.tokens[0];
828
+ if (i && i.type === "text" && i.tokens && i.tokens.length > 0) {
829
+ if (r = [{
830
+ type: "paragraph",
831
+ content: t.parseInline(i.tokens)
832
+ }], e.tokens.length > 1) {
833
+ let t = n(e.tokens.slice(1));
834
+ r.push(...t);
835
+ }
836
+ } else r = n(e.tokens);
837
+ }
838
+ }
839
+ return r.length === 0 && (r = [{
840
+ type: "paragraph",
841
+ content: []
842
+ }]), {
843
+ type: "listItem",
844
+ content: r
845
+ };
846
+ },
847
+ renderMarkdown: (e, t, n) => te(e, t, (e) => {
848
+ if (e.parentType === "bulletList") return "- ";
849
+ if (e.parentType === "orderedList") {
850
+ let t = e.meta?.parentAttrs?.start || 1;
851
+ return Qe(e.meta?.parentAttrs?.type, t - 1 + (e.index || 0), ". ");
852
+ }
853
+ return "- ";
854
+ }, n),
855
+ addExtensions() {
856
+ return [He(this.name, [this.options.bulletListTypeName, this.options.orderedListTypeName])];
857
+ },
858
+ addKeyboardShortcuts() {
859
+ return {
860
+ Enter: () => this.editor.commands.splitListItem(this.name),
861
+ Tab: () => this.editor.commands.sinkListItem(this.name),
862
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
863
+ };
864
+ }
865
+ });
866
+ Pe({}, {
867
+ findListItemPos: () => F,
868
+ getNextListDepth: () => I,
869
+ handleBackspace: () => rt,
870
+ handleDelete: () => ot,
871
+ hasListBefore: () => nt,
872
+ hasListItemAfter: () => st,
873
+ hasListItemBefore: () => ct,
874
+ listItemHasSubList: () => lt,
875
+ nextListIsDeeper: () => it,
876
+ nextListIsHigher: () => at
877
+ });
878
+ var F = (e, t) => {
879
+ let { $from: n } = t.selection, r = g(e, t.schema), i = null, a = n.depth, o = n.pos, s = null;
880
+ for (; a > 0 && s === null;) i = n.node(a), i.type === r ? s = a : (--a, --o);
881
+ return s === null ? null : {
882
+ $pos: t.doc.resolve(o),
883
+ depth: s
884
+ };
885
+ }, I = (e, t) => {
886
+ let n = F(e, t);
887
+ if (!n) return !1;
888
+ let [, r] = ie(t, e, n.$pos.pos + 4);
889
+ return r;
890
+ }, nt = (e, t, n) => {
891
+ let { $anchor: r } = e.selection, i = Math.max(0, r.pos - 2), a = e.doc.resolve(i).node();
892
+ return !(!a || !n.includes(a.type.name));
893
+ }, rt = (e, t, n) => {
894
+ if (e.commands.undoInputRule()) return !0;
895
+ if (e.state.selection.from !== e.state.selection.to) return !1;
896
+ if (!i(e.state, t) && nt(e.state, t, n)) {
897
+ let { $anchor: n } = e.state.selection, r = e.state.doc.resolve(n.before() - 1), i = [];
898
+ r.node().descendants((e, n) => {
899
+ e.type.name === t && i.push({
900
+ node: e,
901
+ pos: n
902
+ });
903
+ });
904
+ let a = i.at(-1);
905
+ if (!a) return !1;
906
+ let o = e.state.doc.resolve(r.start() + a.pos + 1);
907
+ return e.chain().cut({
908
+ from: n.start() - 1,
909
+ to: n.end() + 1
910
+ }, o.end()).joinForward().run();
911
+ }
912
+ return !i(e.state, t) || !oe(e.state) ? !1 : e.chain().liftListItem(t).run();
913
+ }, it = (e, t) => {
914
+ let n = I(e, t), r = F(e, t);
915
+ return !r || !n ? !1 : n > r.depth;
916
+ }, at = (e, t) => {
917
+ let n = I(e, t), r = F(e, t);
918
+ return !r || !n ? !1 : n < r.depth;
919
+ }, ot = (e, n) => {
920
+ if (!i(e.state, n) || !t(e.state, n)) return !1;
921
+ let { selection: r } = e.state, { $from: a, $to: o } = r;
922
+ return !r.empty && a.sameParent(o) ? !1 : it(n, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(n).joinBackward().run() : at(n, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
923
+ }, st = (e, t) => {
924
+ let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - n.parentOffset - 2);
925
+ return !(r.index() === r.parent.childCount - 1 || r.nodeAfter?.type.name !== e);
926
+ }, ct = (e, t) => {
927
+ let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - 2);
928
+ return !(r.index() === 0 || r.nodeBefore?.type.name !== e);
929
+ }, lt = (e, t, n) => {
930
+ if (!n) return !1;
931
+ let r = g(e, t.schema), i = !1;
932
+ return n.descendants((e) => {
933
+ e.type === r && (i = !0);
934
+ }), i;
935
+ }, ut = b.create({
936
+ name: "listKeymap",
937
+ addOptions() {
938
+ return { listTypes: [{
939
+ itemName: "listItem",
940
+ wrapperNames: ["bulletList", "orderedList"]
941
+ }, {
942
+ itemName: "taskItem",
943
+ wrapperNames: ["taskList"]
944
+ }] };
945
+ },
946
+ addKeyboardShortcuts() {
947
+ return {
948
+ Delete: ({ editor: e }) => {
949
+ let t = !1;
950
+ return this.options.listTypes.forEach(({ itemName: n }) => {
951
+ e.state.schema.nodes[n] !== void 0 && ot(e, n) && (t = !0);
952
+ }), t;
953
+ },
954
+ "Mod-Delete": ({ editor: e }) => {
955
+ let t = !1;
956
+ return this.options.listTypes.forEach(({ itemName: n }) => {
957
+ e.state.schema.nodes[n] !== void 0 && ot(e, n) && (t = !0);
958
+ }), t;
959
+ },
960
+ Backspace: ({ editor: e }) => {
961
+ let t = !1;
962
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
963
+ e.state.schema.nodes[n] !== void 0 && rt(e, n, r) && (t = !0);
964
+ }), t;
965
+ },
966
+ "Mod-Backspace": ({ editor: e }) => {
967
+ let t = !1;
968
+ return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
969
+ e.state.schema.nodes[n] !== void 0 && rt(e, n, r) && (t = !0);
970
+ }), t;
971
+ }
972
+ };
973
+ }
974
+ }), L = RegExp(`^(\\s*)(${We})([.)])\\s+(.*)$`), dt = /^\s/, R = {
975
+ heading: /^#{1,6}(?:\s|$)/,
976
+ bulletItem: /^[-+*]\s+/,
977
+ codeFence: /^(?:```|~~~)/,
978
+ thematicBreak: /^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/
979
+ };
980
+ function ft(e) {
981
+ return L.test(e.trimStart());
982
+ }
983
+ function pt(e) {
984
+ let t = e.trimStart();
985
+ return R.bulletItem.test(t) || ft(t) || R.heading.test(t) || R.thematicBreak.test(t) && !t.startsWith("-") || /^>\s?/.test(t) || R.codeFence.test(t);
986
+ }
987
+ function mt(e) {
988
+ return Object.values(R).some((t) => t.test(e));
989
+ }
990
+ function ht(e) {
991
+ let t = [], n = [], r = !1;
992
+ return e.forEach((e) => {
993
+ if (r) {
994
+ n.push(e);
995
+ return;
996
+ }
997
+ if (e.trim() === "") {
998
+ r = !0, n.push(e);
999
+ return;
1000
+ }
1001
+ if (t.length > 0 && pt(e)) {
1002
+ r = !0, n.push(e);
1003
+ return;
1004
+ }
1005
+ t.push(e);
1006
+ }), {
1007
+ paragraphLines: t,
1008
+ blockLines: n
1009
+ };
1010
+ }
1011
+ function gt(e) {
1012
+ let t = [], n = 0, r = 0;
1013
+ for (; n < e.length;) {
1014
+ let i = e[n], a = i.match(L);
1015
+ if (!a) break;
1016
+ let [, o, s, c, l] = a, u = o.length, d = parseInt(s, 10), f = isNaN(d) ? N(s) : void 0, p = isNaN(d) ? P(s) : d, m = [l], h = n + 1, g = [i], _ = !1;
1017
+ for (; h < e.length;) {
1018
+ let t = e[h];
1019
+ if (t.match(L)) break;
1020
+ if (t.trim() === "") g.push(t), m.push(""), _ = !0, h += 1;
1021
+ else if (t.match(dt)) {
1022
+ let e = t.length - t.trimStart().length, n = u + s.length + 1;
1023
+ g.push(t), m.push(t.slice(Math.min(e, n))), h += 1;
1024
+ } else {
1025
+ if (_ || mt(t)) break;
1026
+ g.push(t), m.push(t), h += 1;
1027
+ }
1028
+ }
1029
+ t.push({
1030
+ indent: u,
1031
+ number: p,
1032
+ type: f,
1033
+ content: m.join("\n").trim(),
1034
+ contentLines: m,
1035
+ raw: g.join("\n")
1036
+ }), r = h, n = h;
1037
+ }
1038
+ return [t, r];
1039
+ }
1040
+ var _t = RegExp(`^(${We})([.)])\\s+(.+)$`);
1041
+ function vt(e) {
1042
+ let t = e.split("\n").filter((e) => e.trim().length > 0);
1043
+ if (t.length === 0) return null;
1044
+ let n = [];
1045
+ for (let e of t) {
1046
+ let t = e.trim().match(_t);
1047
+ if (!t) return null;
1048
+ n.push({
1049
+ marker: t[1],
1050
+ content: t[3]
1051
+ });
1052
+ }
1053
+ return Ye(n.map((e) => e.marker)) ? {
1054
+ type: "orderedList",
1055
+ attrs: Ze(n[0].marker),
1056
+ content: n.map((e) => ({
1057
+ type: "listItem",
1058
+ content: [{
1059
+ type: "paragraph",
1060
+ content: [{
1061
+ type: "text",
1062
+ text: e.content
1063
+ }]
1064
+ }]
1065
+ }))
1066
+ } : null;
1067
+ }
1068
+ function yt(e, t, n) {
1069
+ let r = [], i = 0;
1070
+ for (; i < e.length;) {
1071
+ let a = e[i];
1072
+ if (a.indent === t) {
1073
+ let { paragraphLines: o, blockLines: s } = ht(a.contentLines), c = o.join("\n").trim(), l = [];
1074
+ c && l.push({
1075
+ type: "paragraph",
1076
+ raw: c,
1077
+ tokens: n.inlineTokens(c)
1078
+ });
1079
+ let u = s.join("\n").trim();
1080
+ if (u) {
1081
+ let e = n.blockTokens(u);
1082
+ l.push(...e);
1083
+ }
1084
+ let d = i + 1, f = [];
1085
+ for (; d < e.length && e[d].indent > t;) f.push(e[d]), d += 1;
1086
+ if (f.length > 0) {
1087
+ let e = yt(f, Math.min(...f.map((e) => e.indent)), n);
1088
+ l.push({
1089
+ type: "list",
1090
+ ordered: !0,
1091
+ start: f[0].number,
1092
+ typeMarker: f[0].type,
1093
+ items: e,
1094
+ raw: f.map((e) => e.raw).join("\n")
1095
+ });
1096
+ }
1097
+ r.push({
1098
+ type: "list_item",
1099
+ raw: a.raw,
1100
+ tokens: l
1101
+ }), i = d;
1102
+ } else i += 1;
1103
+ }
1104
+ return r;
1105
+ }
1106
+ function bt(e, t) {
1107
+ return e.map((e) => {
1108
+ if (e.type !== "list_item") return t.parseChildren([e])[0];
1109
+ let n = [];
1110
+ return e.tokens && e.tokens.length > 0 && e.tokens.forEach((e) => {
1111
+ if (e.type === "paragraph" || e.type === "list" || e.type === "blockquote" || e.type === "code") n.push(...t.parseChildren([e]));
1112
+ else if (e.type === "text" && e.tokens) {
1113
+ let r = t.parseChildren([e]);
1114
+ n.push({
1115
+ type: "paragraph",
1116
+ content: r
1117
+ });
1118
+ } else {
1119
+ let r = t.parseChildren([e]);
1120
+ r.length > 0 && n.push(...r);
1121
+ }
1122
+ }), {
1123
+ type: "listItem",
1124
+ content: n
1125
+ };
1126
+ });
1127
+ }
1128
+ var xt = "listItem", St = "textStyle", Ct = /^(\d+)\.\s$/;
1129
+ function wt(e) {
1130
+ let t = e.match(/list-style-type\s*:\s*([^;]+)/i);
1131
+ if (!t) return null;
1132
+ switch (t[1].trim().toLowerCase()) {
1133
+ case "upper-roman": return "I";
1134
+ case "lower-roman": return "i";
1135
+ case "upper-alpha":
1136
+ case "upper-latin": return "A";
1137
+ case "lower-alpha":
1138
+ case "lower-latin": return "a";
1139
+ default: return null;
1140
+ }
1141
+ }
1142
+ var Tt = S.create({
1143
+ name: "orderedList",
1144
+ addOptions() {
1145
+ return {
1146
+ itemTypeName: "listItem",
1147
+ HTMLAttributes: {},
1148
+ keepMarks: !1,
1149
+ keepAttributes: !1
1150
+ };
1151
+ },
1152
+ group: "block list",
1153
+ content() {
1154
+ return `${this.options.itemTypeName}+`;
1155
+ },
1156
+ addAttributes() {
1157
+ return {
1158
+ start: {
1159
+ default: 1,
1160
+ parseHTML: (e) => e.hasAttribute("start") ? parseInt(e.getAttribute("start") || "", 10) : 1
1161
+ },
1162
+ type: {
1163
+ default: null,
1164
+ parseHTML: (e) => {
1165
+ let t = e.getAttribute("type");
1166
+ if (t) return t;
1167
+ let n = e.getAttribute("style");
1168
+ if (n) {
1169
+ let e = wt(n);
1170
+ if (e) return e;
1171
+ }
1172
+ let r = e.querySelector("li");
1173
+ if (r) {
1174
+ let e = r.getAttribute("style");
1175
+ if (e) {
1176
+ let t = wt(e);
1177
+ if (t) return t;
1178
+ }
1179
+ }
1180
+ return null;
1181
+ }
1182
+ }
1183
+ };
1184
+ },
1185
+ parseHTML() {
1186
+ return [{ tag: "ol" }];
1187
+ },
1188
+ renderHTML({ HTMLAttributes: e }) {
1189
+ let { start: t, type: n, ...r } = e, i = x(this.options.HTMLAttributes, r);
1190
+ return t !== 1 && (i.start = t), n && n !== "1" && (i.type = n), [
1191
+ "ol",
1192
+ i,
1193
+ 0
1194
+ ];
1195
+ },
1196
+ markdownTokenName: "list",
1197
+ parseMarkdown: (e, t) => {
1198
+ if (e.type !== "list" || !e.ordered) return [];
1199
+ let n = e.start || 1, r = e.typeMarker, i = e.items ? bt(e.items, t) : [], a = {};
1200
+ return n !== 1 && (a.start = n), r && (a.type = r), Object.keys(a).length > 0 ? {
1201
+ type: "orderedList",
1202
+ attrs: a,
1203
+ content: i
1204
+ } : {
1205
+ type: "orderedList",
1206
+ content: i
1207
+ };
1208
+ },
1209
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
1210
+ markdownTokenizer: {
1211
+ name: "orderedList",
1212
+ level: "block",
1213
+ start: () => -1,
1214
+ tokenize: (e, t, n) => {
1215
+ let r = e.split("\n"), [i, a] = gt(r);
1216
+ if (i.length === 0) return;
1217
+ let o = yt(i, i[0].indent, n);
1218
+ if (o.length !== 0) return {
1219
+ type: "list",
1220
+ ordered: !0,
1221
+ start: i[0]?.number || 1,
1222
+ typeMarker: i[0]?.type,
1223
+ items: o,
1224
+ raw: r.slice(0, a).join("\n")
1225
+ };
1226
+ }
1227
+ },
1228
+ markdownOptions: { indentsContent: !0 },
1229
+ addCommands() {
1230
+ return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(xt, this.editor.getAttributes(St)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
1231
+ },
1232
+ addKeyboardShortcuts() {
1233
+ return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
1234
+ },
1235
+ addProseMirrorPlugins() {
1236
+ return [new T({ props: { handlePaste: (e, t) => {
1237
+ if ((t.clipboardData?.getData("text/html"))?.trim()) return !1;
1238
+ let n = t.clipboardData?.getData("text/plain");
1239
+ if (!n) return !1;
1240
+ let r = vt(n);
1241
+ if (!r) return !1;
1242
+ try {
1243
+ let t = e.state.schema.nodeFromJSON(r), n = e.state.tr.replaceSelectionWith(t);
1244
+ return e.dispatch(n), !0;
1245
+ } catch {
1246
+ return !1;
1247
+ }
1248
+ } } })];
1249
+ },
1250
+ addInputRules() {
1251
+ let e = (e, t) => (!t.attrs.type || t.attrs.type === "1") && t.childCount + t.attrs.start === +e[1], t = y({
1252
+ find: Ct,
1253
+ type: this.type,
1254
+ getAttributes: (e) => ({ start: +e[1] }),
1255
+ joinPredicate: e
1256
+ });
1257
+ return (this.options.keepMarks || this.options.keepAttributes) && (t = y({
1258
+ find: Ct,
1259
+ type: this.type,
1260
+ keepMarks: this.options.keepMarks,
1261
+ keepAttributes: this.options.keepAttributes,
1262
+ getAttributes: (e) => ({
1263
+ start: +e[1],
1264
+ ...this.editor.getAttributes(St)
1265
+ }),
1266
+ joinPredicate: e,
1267
+ editor: this.editor
1268
+ })), [t];
1269
+ }
1270
+ }), Et = /^\s*(\[([( |x])?\])\s$/, Dt = S.create({
1271
+ name: "taskItem",
1272
+ addOptions() {
1273
+ return {
1274
+ nested: !1,
1275
+ HTMLAttributes: {},
1276
+ taskListTypeName: "taskList",
1277
+ a11y: void 0
1278
+ };
1279
+ },
1280
+ content() {
1281
+ return this.options.nested ? "paragraph block*" : "paragraph+";
1282
+ },
1283
+ defining: !0,
1284
+ addAttributes() {
1285
+ return { checked: {
1286
+ default: !1,
1287
+ keepOnSplit: !1,
1288
+ parseHTML: (e) => {
1289
+ let t = e.getAttribute("data-checked");
1290
+ return t === "" || t === "true";
1291
+ },
1292
+ renderHTML: (e) => ({ "data-checked": e.checked })
1293
+ } };
1294
+ },
1295
+ parseHTML() {
1296
+ return [{
1297
+ tag: `li[data-type="${this.name}"]`,
1298
+ priority: 51
1299
+ }];
1300
+ },
1301
+ renderHTML({ node: e, HTMLAttributes: t }) {
1302
+ return [
1303
+ "li",
1304
+ x(this.options.HTMLAttributes, t, { "data-type": this.name }),
1305
+ [
1306
+ "label",
1307
+ ["input", {
1308
+ type: "checkbox",
1309
+ checked: e.attrs.checked ? "checked" : null
1310
+ }],
1311
+ ["span"]
1312
+ ],
1313
+ ["div", 0]
1314
+ ];
1315
+ },
1316
+ parseMarkdown: (e, t) => {
1317
+ let n = [];
1318
+ 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) {
1319
+ let r = t.parseChildren(e.nestedTokens);
1320
+ n.push(...r);
1321
+ }
1322
+ return t.createNode("taskItem", { checked: e.checked || !1 }, n);
1323
+ },
1324
+ renderMarkdown: (e, t) => te(e, t, `- [${e.attrs?.checked ? "x" : " "}] `),
1325
+ addExtensions() {
1326
+ return this.options.nested ? [He(this.name, [this.options.taskListTypeName])] : [];
1327
+ },
1328
+ addKeyboardShortcuts() {
1329
+ let e = {
1330
+ Enter: () => this.editor.commands.splitListItem(this.name),
1331
+ "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
1332
+ };
1333
+ return this.options.nested ? {
1334
+ ...e,
1335
+ Tab: () => this.editor.commands.sinkListItem(this.name)
1336
+ } : e;
1337
+ },
1338
+ addNodeView() {
1339
+ return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
1340
+ let i = document.createElement("li"), a = document.createElement("label"), o = document.createElement("span"), s = document.createElement("input"), c = document.createElement("div"), l = (e) => {
1341
+ var t;
1342
+ s.ariaLabel = ((t = this.options.a11y)?.checkboxLabel)?.call(t, e, s.checked) || `Task item checkbox for ${e.textContent || "empty task item"}`;
1343
+ };
1344
+ l(e), a.contentEditable = "false", s.type = "checkbox", s.addEventListener("mousedown", (e) => e.preventDefault()), s.addEventListener("change", (t) => {
1345
+ if (!r.isEditable && !this.options.onReadOnlyChecked) {
1346
+ s.checked = !s.checked;
1347
+ return;
1348
+ }
1349
+ let { checked: i } = t.target;
1350
+ r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: e }) => {
1351
+ let t = n();
1352
+ if (typeof t != "number") return !1;
1353
+ let r = e.doc.nodeAt(t);
1354
+ return e.setNodeMarkup(t, void 0, {
1355
+ ...r?.attrs,
1356
+ checked: i
1357
+ }), !0;
1358
+ }).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(e, i) || (s.checked = !s.checked));
1359
+ }), Object.entries(this.options.HTMLAttributes).forEach(([e, t]) => {
1360
+ i.setAttribute(e, t);
1361
+ }), 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]) => {
1362
+ i.setAttribute(e, t);
1363
+ });
1364
+ let u = new Set(Object.keys(t));
1365
+ return {
1366
+ dom: i,
1367
+ contentDOM: c,
1368
+ update: (e) => {
1369
+ if (e.type !== this.type) return !1;
1370
+ i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, l(e);
1371
+ let t = r.extensionManager.attributes, n = re(e, t), a = new Set(Object.keys(n)), o = this.options.HTMLAttributes;
1372
+ return u.forEach((e) => {
1373
+ a.has(e) || (e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e));
1374
+ }), Object.entries(n).forEach(([e, t]) => {
1375
+ t == null ? e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e) : i.setAttribute(e, t);
1376
+ }), u = a, !0;
1377
+ }
1378
+ };
1379
+ };
1380
+ },
1381
+ addInputRules() {
1382
+ return [y({
1383
+ find: Et,
1384
+ type: this.type,
1385
+ getAttributes: (e) => ({ checked: e[e.length - 1] === "x" })
1386
+ })];
1387
+ }
1388
+ }), Ot = S.create({
1389
+ name: "taskList",
1390
+ addOptions() {
1391
+ return {
1392
+ itemTypeName: "taskItem",
1393
+ HTMLAttributes: {}
1394
+ };
1395
+ },
1396
+ group: "block list",
1397
+ content() {
1398
+ return `${this.options.itemTypeName}+`;
1399
+ },
1400
+ parseHTML() {
1401
+ return [{
1402
+ tag: `ul[data-type="${this.name}"]`,
1403
+ priority: 51
1404
+ }];
1405
+ },
1406
+ renderHTML({ HTMLAttributes: e }) {
1407
+ return [
1408
+ "ul",
1409
+ x(this.options.HTMLAttributes, e, { "data-type": this.name }),
1410
+ 0
1411
+ ];
1412
+ },
1413
+ parseMarkdown: (e, t) => t.createNode("taskList", {}, t.parseChildren(e.items || [])),
1414
+ renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
1415
+ markdownTokenizer: {
1416
+ name: "taskList",
1417
+ level: "block",
1418
+ start(e) {
1419
+ let t = e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;
1420
+ return t === void 0 ? -1 : t;
1421
+ },
1422
+ tokenize(e, t, n) {
1423
+ let r = (e) => {
1424
+ let t = ee(e, {
1425
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1426
+ extractItemData: (e) => ({
1427
+ indentLevel: e[1].length,
1428
+ mainContent: e[4],
1429
+ checked: e[3].toLowerCase() === "x"
1430
+ }),
1431
+ createToken: (e, t) => ({
1432
+ type: "taskItem",
1433
+ raw: "",
1434
+ mainContent: e.mainContent,
1435
+ indentLevel: e.indentLevel,
1436
+ checked: e.checked,
1437
+ text: e.mainContent,
1438
+ tokens: n.inlineTokens(e.mainContent),
1439
+ nestedTokens: t
1440
+ }),
1441
+ customNestedParser: r
1442
+ }, n);
1443
+ if (t) {
1444
+ let r = {
1445
+ type: "taskList",
1446
+ raw: t.raw,
1447
+ items: t.items
1448
+ }, i = e.slice(t.raw.length);
1449
+ return i.trim() ? [r, ...n.blockTokens(i)] : [r];
1450
+ }
1451
+ return n.blockTokens(e);
1452
+ }, i = ee(e, {
1453
+ itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
1454
+ extractItemData: (e) => ({
1455
+ indentLevel: e[1].length,
1456
+ mainContent: e[4],
1457
+ checked: e[3].toLowerCase() === "x"
1458
+ }),
1459
+ createToken: (e, t) => ({
1460
+ type: "taskItem",
1461
+ raw: "",
1462
+ mainContent: e.mainContent,
1463
+ indentLevel: e.indentLevel,
1464
+ checked: e.checked,
1465
+ text: e.mainContent,
1466
+ tokens: n.inlineTokens(e.mainContent),
1467
+ nestedTokens: t
1468
+ }),
1469
+ customNestedParser: r
1470
+ }, n);
1471
+ if (i) return {
1472
+ type: "taskList",
1473
+ raw: i.raw,
1474
+ items: i.items
1475
+ };
1476
+ }
1477
+ },
1478
+ markdownOptions: { indentsContent: !0 },
1479
+ addCommands() {
1480
+ return { toggleTaskList: () => ({ commands: e }) => e.toggleList(this.name, this.options.itemTypeName) };
1481
+ },
1482
+ addKeyboardShortcuts() {
1483
+ return { "Mod-Shift-9": () => this.editor.commands.toggleTaskList() };
1484
+ }
1485
+ });
1486
+ b.create({
1487
+ name: "listKit",
1488
+ addExtensions() {
1489
+ let e = [];
1490
+ return this.options.bulletList !== !1 && e.push(Re.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(tt.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(ut.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(Tt.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(Dt.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(Ot.configure(this.options.taskList)), e;
1491
+ }
1492
+ });
1493
+ //#endregion
1494
+ //#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@3.28.0_@tiptap+core@3.28.0_@tiptap+pm@3.28.0_/node_modules/@tiptap/extension-paragraph/dist/index.js
1495
+ var z = "&nbsp;", B = "\xA0", kt = S.create({
1496
+ name: "paragraph",
1497
+ priority: 1e3,
1498
+ addOptions() {
1499
+ return { HTMLAttributes: {} };
1500
+ },
1501
+ group: "block",
1502
+ content: "inline*",
1503
+ parseHTML() {
1504
+ return [{ tag: "p" }];
1505
+ },
1506
+ renderHTML({ HTMLAttributes: e }) {
1507
+ return [
1508
+ "p",
1509
+ x(this.options.HTMLAttributes, e),
1510
+ 0
1511
+ ];
1512
+ },
1513
+ parseMarkdown: (e, t) => {
1514
+ let n = e.tokens || [];
1515
+ if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
1516
+ let r = t.parseInline(n);
1517
+ 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);
1518
+ },
1519
+ renderMarkdown: (e, t, n) => {
1520
+ if (!e) return "";
1521
+ let r = Array.isArray(e.content) ? e.content : [];
1522
+ if (r.length === 0) {
1523
+ let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
1524
+ return n?.previousNode?.type === "paragraph" && e.length === 0 ? z : "";
1525
+ }
1526
+ return t.renderChildren(r);
1527
+ },
1528
+ addCommands() {
1529
+ return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
1530
+ },
1531
+ addKeyboardShortcuts() {
1532
+ return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
1533
+ }
1534
+ }), At = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, jt = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Mt = v.create({
1535
+ name: "strike",
1536
+ addOptions() {
1537
+ return { HTMLAttributes: {} };
1538
+ },
1539
+ parseHTML() {
1540
+ return [
1541
+ { tag: "s" },
1542
+ { tag: "del" },
1543
+ { tag: "strike" },
1544
+ {
1545
+ style: "text-decoration",
1546
+ consuming: !1,
1547
+ getAttrs: (e) => e.includes("line-through") ? {} : !1
1548
+ }
1549
+ ];
1550
+ },
1551
+ renderHTML({ HTMLAttributes: e }) {
1552
+ return [
1553
+ "s",
1554
+ x(this.options.HTMLAttributes, e),
1555
+ 0
1556
+ ];
1557
+ },
1558
+ markdownTokenName: "del",
1559
+ parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
1560
+ renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
1561
+ addCommands() {
1562
+ return {
1563
+ setStrike: () => ({ commands: e }) => e.setMark(this.name),
1564
+ toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
1565
+ unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
1566
+ };
1567
+ },
1568
+ addKeyboardShortcuts() {
1569
+ return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
1570
+ },
1571
+ addInputRules() {
1572
+ return [u({
1573
+ find: At,
1574
+ type: this.type
1575
+ })];
1576
+ },
1577
+ addPasteRules() {
1578
+ return [d({
1579
+ find: jt,
1580
+ type: this.type
1581
+ })];
1582
+ }
1583
+ }), Nt = S.create({
1584
+ name: "text",
1585
+ group: "inline",
1586
+ parseMarkdown: (e) => ({
1587
+ type: "text",
1588
+ text: e.text || ""
1589
+ }),
1590
+ renderMarkdown: (e) => e.text || ""
1591
+ });
1592
+ //#endregion
1593
+ //#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
1594
+ function Pt(e = {}) {
1595
+ return new T({ view(t) {
1596
+ return new Ft(t, e);
1597
+ } });
1598
+ }
1599
+ var Ft = class {
1600
+ constructor(e, t) {
1601
+ 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 = [
1602
+ "dragover",
1603
+ "dragend",
1604
+ "drop",
1605
+ "dragleave"
1606
+ ].map((t) => {
1607
+ let n = (e) => {
1608
+ this[t](e);
1609
+ };
1610
+ return e.dom.addEventListener(t, n), {
1611
+ name: t,
1612
+ handler: n
1613
+ };
1614
+ });
1615
+ }
1616
+ destroy() {
1617
+ this.handlers.forEach(({ name: e, handler: t }) => this.editorView.dom.removeEventListener(e, t));
1618
+ }
1619
+ update(e, t) {
1620
+ this.cursorPos != null && t.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
1621
+ }
1622
+ setCursor(e) {
1623
+ e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
1624
+ }
1625
+ updateOverlay() {
1626
+ 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;
1627
+ if (t) {
1628
+ let t = e.nodeBefore, r = e.nodeAfter;
1629
+ if (t || r) {
1630
+ let e = this.editorView.nodeDOM(this.cursorPos - (t ? t.nodeSize : 0));
1631
+ if (e) {
1632
+ let i = e.getBoundingClientRect(), a = t ? i.bottom : i.top;
1633
+ t && r && (a = (a + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
1634
+ let s = this.width / 2 * o;
1635
+ n = {
1636
+ left: i.left,
1637
+ right: i.right,
1638
+ top: a - s,
1639
+ bottom: a + s
1640
+ };
1641
+ }
1642
+ }
1643
+ }
1644
+ if (!n) {
1645
+ let e = this.editorView.coordsAtPos(this.cursorPos), t = this.width / 2 * a;
1646
+ n = {
1647
+ left: e.left - t,
1648
+ right: e.left + t,
1649
+ top: e.top,
1650
+ bottom: e.bottom
1651
+ };
1652
+ }
1653
+ let s = this.editorView.dom.offsetParent;
1654
+ 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);
1655
+ let c, l;
1656
+ if (!s || s == document.body && getComputedStyle(s).position == "static") c = -pageXOffset, l = -pageYOffset;
1657
+ else {
1658
+ let e = s.getBoundingClientRect(), t = e.width / s.offsetWidth, n = e.height / s.offsetHeight;
1659
+ c = e.left - s.scrollLeft * t, l = e.top - s.scrollTop * n;
1660
+ }
1661
+ 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";
1662
+ }
1663
+ scheduleRemoval(e) {
1664
+ clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
1665
+ }
1666
+ dragover(e) {
1667
+ if (!this.editorView.editable) return;
1668
+ let t = this.editorView.posAtCoords({
1669
+ left: e.clientX,
1670
+ top: e.clientY
1671
+ }), n = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), i = n && n.type.spec.disableDropCursor, a = typeof i == "function" ? i(this.editorView, t, e) : i;
1672
+ if (t && !a) {
1673
+ let e = t.pos;
1674
+ if (this.editorView.dragging && this.editorView.dragging.slice) {
1675
+ let t = r(this.editorView.state.doc, e, this.editorView.dragging.slice);
1676
+ t != null && (e = t);
1677
+ }
1678
+ this.setCursor(e), this.scheduleRemoval(5e3);
1679
+ }
1680
+ }
1681
+ dragend() {
1682
+ this.scheduleRemoval(20);
1683
+ }
1684
+ drop() {
1685
+ this.scheduleRemoval(20);
1686
+ }
1687
+ dragleave(e) {
1688
+ this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
1689
+ }
1690
+ }, V = class t extends e {
1691
+ constructor(e) {
1692
+ super(e, e);
1693
+ }
1694
+ map(n, r) {
1695
+ let i = n.resolve(r.map(this.head));
1696
+ return t.valid(i) ? new t(i) : e.near(i);
1697
+ }
1698
+ content() {
1699
+ return o.empty;
1700
+ }
1701
+ eq(e) {
1702
+ return e instanceof t && e.head == this.head;
1703
+ }
1704
+ toJSON() {
1705
+ return {
1706
+ type: "gapcursor",
1707
+ pos: this.head
1708
+ };
1709
+ }
1710
+ static fromJSON(e, n) {
1711
+ if (typeof n.pos != "number") throw RangeError("Invalid input for GapCursor.fromJSON");
1712
+ return new t(e.resolve(n.pos));
1713
+ }
1714
+ getBookmark() {
1715
+ return new It(this.anchor);
1716
+ }
1717
+ static valid(e) {
1718
+ let t = e.parent;
1719
+ if (t.inlineContent || !Rt(e) || !zt(e)) return !1;
1720
+ let n = t.type.spec.allowGapCursor;
1721
+ if (n != null) return n;
1722
+ let r = t.contentMatchAt(e.index()).defaultType;
1723
+ return r && r.isTextblock;
1724
+ }
1725
+ static findGapCursorFrom(e, n, r = !1) {
1726
+ search: for (;;) {
1727
+ if (!r && t.valid(e)) return e;
1728
+ let i = e.pos, a = null;
1729
+ for (let r = e.depth;; r--) {
1730
+ let o = e.node(r);
1731
+ if (n > 0 ? e.indexAfter(r) < o.childCount : e.index(r) > 0) {
1732
+ a = o.child(n > 0 ? e.indexAfter(r) : e.index(r) - 1);
1733
+ break;
1734
+ } else if (r == 0) return null;
1735
+ i += n;
1736
+ let s = e.doc.resolve(i);
1737
+ if (t.valid(s)) return s;
1738
+ }
1739
+ for (;;) {
1740
+ let o = n > 0 ? a.firstChild : a.lastChild;
1741
+ if (!o) {
1742
+ if (a.isAtom && !a.isText && !_.isSelectable(a)) {
1743
+ e = e.doc.resolve(i + a.nodeSize * n), r = !1;
1744
+ continue search;
1745
+ }
1746
+ break;
1747
+ }
1748
+ a = o, i += n;
1749
+ let s = e.doc.resolve(i);
1750
+ if (t.valid(s)) return s;
1751
+ }
1752
+ return null;
1753
+ }
1754
+ }
1755
+ };
1756
+ V.prototype.visible = !1, V.findFrom = V.findGapCursorFrom, e.jsonID("gapcursor", V);
1757
+ var It = class t {
1758
+ constructor(e) {
1759
+ this.pos = e;
1760
+ }
1761
+ map(e) {
1762
+ return new t(e.map(this.pos));
1763
+ }
1764
+ resolve(t) {
1765
+ let n = t.resolve(this.pos);
1766
+ return V.valid(n) ? new V(n) : e.near(n);
1767
+ }
1768
+ };
1769
+ function Lt(e) {
1770
+ return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
1771
+ }
1772
+ function Rt(e) {
1773
+ for (let t = e.depth; t >= 0; t--) {
1774
+ let n = e.index(t), r = e.node(t);
1775
+ if (n == 0) {
1776
+ if (r.type.spec.isolating) return !0;
1777
+ continue;
1778
+ }
1779
+ for (let e = r.child(n - 1);; e = e.lastChild) {
1780
+ if (e.childCount == 0 && !e.inlineContent || Lt(e.type)) return !0;
1781
+ if (e.inlineContent) return !1;
1782
+ }
1783
+ }
1784
+ return !0;
1785
+ }
1786
+ function zt(e) {
1787
+ for (let t = e.depth; t >= 0; t--) {
1788
+ let n = e.indexAfter(t), r = e.node(t);
1789
+ if (n == r.childCount) {
1790
+ if (r.type.spec.isolating) return !0;
1791
+ continue;
1792
+ }
1793
+ for (let e = r.child(n);; e = e.firstChild) {
1794
+ if (e.childCount == 0 && !e.inlineContent || Lt(e.type)) return !0;
1795
+ if (e.inlineContent) return !1;
1796
+ }
1797
+ }
1798
+ return !0;
1799
+ }
1800
+ function Bt() {
1801
+ return new T({ props: {
1802
+ decorations: Wt,
1803
+ createSelectionBetween(e, t, n) {
1804
+ return t.pos == n.pos && V.valid(n) ? new V(n) : null;
1805
+ },
1806
+ handleClick: Ht,
1807
+ handleKeyDown: Vt,
1808
+ handleDOMEvents: { beforeinput: Ut }
1809
+ } });
1810
+ }
1811
+ var Vt = h({
1812
+ ArrowLeft: H("horiz", -1),
1813
+ ArrowRight: H("horiz", 1),
1814
+ ArrowUp: H("vert", -1),
1815
+ ArrowDown: H("vert", 1)
1816
+ });
1817
+ function H(e, t) {
1818
+ let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
1819
+ return function(e, r, i) {
1820
+ let a = e.selection, o = t > 0 ? a.$to : a.$from, s = a.empty;
1821
+ if (a instanceof w) {
1822
+ if (!i.endOfTextblock(n) || o.depth == 0) return !1;
1823
+ s = !1, o = e.doc.resolve(t > 0 ? o.after() : o.before());
1824
+ }
1825
+ let c = V.findGapCursorFrom(o, t, s);
1826
+ return c ? (r && r(e.tr.setSelection(new V(c))), !0) : !1;
1827
+ };
1828
+ }
1829
+ function Ht(e, t, n) {
1830
+ if (!e || !e.editable) return !1;
1831
+ let r = e.state.doc.resolve(t);
1832
+ if (!V.valid(r)) return !1;
1833
+ let i = e.posAtCoords({
1834
+ left: n.clientX,
1835
+ top: n.clientY
1836
+ });
1837
+ return i && i.inside > -1 && _.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new V(r))), !0);
1838
+ }
1839
+ function Ut(e, t) {
1840
+ if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof V)) return !1;
1841
+ let { $from: r } = e.state.selection, i = r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);
1842
+ if (!i) return !1;
1843
+ let a = n.empty;
1844
+ for (let e = i.length - 1; e >= 0; e--) a = n.from(i[e].createAndFill(null, a));
1845
+ let s = e.state.tr.replace(r.pos, r.pos, new o(a, 0, 0));
1846
+ return s.setSelection(w.near(s.doc.resolve(r.pos + 1))), e.dispatch(s), !1;
1847
+ }
1848
+ function Wt(e) {
1849
+ if (!(e.selection instanceof V)) return null;
1850
+ let t = document.createElement("div");
1851
+ return t.className = "ProseMirror-gapcursor", E.create(e.doc, [C.widget(e.selection.head, t, { key: "gapcursor" })]);
1852
+ }
1853
+ //#endregion
1854
+ //#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
1855
+ var U = 200, W = function() {};
1856
+ W.prototype.append = function(e) {
1857
+ 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;
1858
+ }, W.prototype.prepend = function(e) {
1859
+ return e.length ? W.from(e).append(this) : this;
1860
+ }, W.prototype.appendInner = function(e) {
1861
+ return new Kt(this, e);
1862
+ }, W.prototype.slice = function(e, t) {
1863
+ 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));
1864
+ }, W.prototype.get = function(e) {
1865
+ if (!(e < 0 || e >= this.length)) return this.getInner(e);
1866
+ }, W.prototype.forEach = function(e, t, n) {
1867
+ 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);
1868
+ }, W.prototype.map = function(e, t, n) {
1869
+ t === void 0 && (t = 0), n === void 0 && (n = this.length);
1870
+ var r = [];
1871
+ return this.forEach(function(t, n) {
1872
+ return r.push(e(t, n));
1873
+ }, t, n), r;
1874
+ }, W.from = function(e) {
1875
+ return e instanceof W ? e : e && e.length ? new Gt(e) : W.empty;
1876
+ };
1877
+ var Gt = /* @__PURE__ */ function(e) {
1878
+ function t(t) {
1879
+ e.call(this), this.values = t;
1880
+ }
1881
+ e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t;
1882
+ var n = {
1883
+ length: { configurable: !0 },
1884
+ depth: { configurable: !0 }
1885
+ };
1886
+ return t.prototype.flatten = function() {
1887
+ return this.values;
1888
+ }, t.prototype.sliceInner = function(e, n) {
1889
+ return e == 0 && n == this.length ? this : new t(this.values.slice(e, n));
1890
+ }, t.prototype.getInner = function(e) {
1891
+ return this.values[e];
1892
+ }, t.prototype.forEachInner = function(e, t, n, r) {
1893
+ for (var i = t; i < n; i++) if (e(this.values[i], r + i) === !1) return !1;
1894
+ }, t.prototype.forEachInvertedInner = function(e, t, n, r) {
1895
+ for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
1896
+ }, t.prototype.leafAppend = function(e) {
1897
+ if (this.length + e.length <= U) return new t(this.values.concat(e.flatten()));
1898
+ }, t.prototype.leafPrepend = function(e) {
1899
+ if (this.length + e.length <= U) return new t(e.flatten().concat(this.values));
1900
+ }, n.length.get = function() {
1901
+ return this.values.length;
1902
+ }, n.depth.get = function() {
1903
+ return 0;
1904
+ }, Object.defineProperties(t.prototype, n), t;
1905
+ }(W);
1906
+ W.empty = new Gt([]);
1907
+ var Kt = /* @__PURE__ */ function(e) {
1908
+ function t(t, n) {
1909
+ e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
1910
+ }
1911
+ return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t.prototype.flatten = function() {
1912
+ return this.left.flatten().concat(this.right.flatten());
1913
+ }, t.prototype.getInner = function(e) {
1914
+ return e < this.left.length ? this.left.get(e) : this.right.get(e - this.left.length);
1915
+ }, t.prototype.forEachInner = function(e, t, n, r) {
1916
+ var i = this.left.length;
1917
+ 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;
1918
+ }, t.prototype.forEachInvertedInner = function(e, t, n, r) {
1919
+ var i = this.left.length;
1920
+ 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;
1921
+ }, t.prototype.sliceInner = function(e, t) {
1922
+ if (e == 0 && t == this.length) return this;
1923
+ var n = this.left.length;
1924
+ 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));
1925
+ }, t.prototype.leafAppend = function(e) {
1926
+ var n = this.right.leafAppend(e);
1927
+ if (n) return new t(this.left, n);
1928
+ }, t.prototype.leafPrepend = function(e) {
1929
+ var n = this.left.leafPrepend(e);
1930
+ if (n) return new t(n, this.right);
1931
+ }, t.prototype.appendInner = function(e) {
1932
+ 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);
1933
+ }, t;
1934
+ }(W), qt = 500, G = class e {
1935
+ constructor(e, t) {
1936
+ this.items = e, this.eventCount = t;
1937
+ }
1938
+ popEvent(t, n) {
1939
+ if (this.eventCount == 0) return null;
1940
+ let r = this.items.length;
1941
+ for (;; r--) if (this.items.get(r - 1).selection) {
1942
+ --r;
1943
+ break;
1944
+ }
1945
+ let i, a;
1946
+ n && (i = this.remapping(r, this.items.length), a = i.maps.length);
1947
+ let o = t.tr, s, c, l = [], u = [];
1948
+ return this.items.forEach((t, n) => {
1949
+ if (!t.step) {
1950
+ i || (i = this.remapping(r, n + 1), a = i.maps.length), a--, u.push(t);
1951
+ return;
1952
+ }
1953
+ if (i) {
1954
+ u.push(new K(t.map));
1955
+ let e = t.step.map(i.slice(a)), n;
1956
+ 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);
1957
+ } else o.maybeStep(t.step);
1958
+ 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;
1959
+ }, this.items.length, 0), {
1960
+ remaining: c,
1961
+ transform: o,
1962
+ selection: s
1963
+ };
1964
+ }
1965
+ addTransform(t, n, r, i) {
1966
+ let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
1967
+ for (let e = 0; e < t.steps.length; e++) {
1968
+ let r = t.steps[e].invert(t.docs[e]), l = new K(t.mapping.maps[e], r, n), u;
1969
+ (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);
1970
+ }
1971
+ let l = o - r.depth;
1972
+ return l > Yt && (s = Jt(s, l), o -= l), new e(s.append(a), o);
1973
+ }
1974
+ remapping(e, t) {
1975
+ let n = new l();
1976
+ return this.items.forEach((t, r) => {
1977
+ let i = t.mirrorOffset != null && r - t.mirrorOffset >= e ? n.maps.length - t.mirrorOffset : void 0;
1978
+ n.appendMap(t.map, i);
1979
+ }, e, t), n;
1980
+ }
1981
+ addMaps(t) {
1982
+ return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new K(e))), this.eventCount);
1983
+ }
1984
+ rebased(t, n) {
1985
+ if (!this.eventCount) return this;
1986
+ let r = [], i = Math.max(0, this.items.length - n), a = t.mapping, o = t.steps.length, s = this.eventCount;
1987
+ this.items.forEach((e) => {
1988
+ e.selection && s--;
1989
+ }, i);
1990
+ let c = n;
1991
+ this.items.forEach((e) => {
1992
+ let n = a.getMirror(--c);
1993
+ if (n == null) return;
1994
+ o = Math.min(o, n);
1995
+ let i = a.maps[n];
1996
+ if (e.step) {
1997
+ let o = t.steps[n].invert(t.docs[n]), l = e.selection && e.selection.map(a.slice(c + 1, n));
1998
+ l && s++, r.push(new K(i, o, l));
1999
+ } else r.push(new K(i));
2000
+ }, i);
2001
+ let l = [];
2002
+ for (let e = n; e < o; e++) l.push(new K(a.maps[e]));
2003
+ let u = this.items.slice(0, i).append(l).append(r), d = new e(u, s);
2004
+ return d.emptyItemCount() > qt && (d = d.compress(this.items.length - r.length)), d;
2005
+ }
2006
+ emptyItemCount() {
2007
+ let e = 0;
2008
+ return this.items.forEach((t) => {
2009
+ t.step || e++;
2010
+ }), e;
2011
+ }
2012
+ compress(t = this.items.length) {
2013
+ let n = this.remapping(0, t), r = n.maps.length, i = [], a = 0;
2014
+ return this.items.forEach((e, o) => {
2015
+ if (o >= t) i.push(e), e.selection && a++;
2016
+ else if (e.step) {
2017
+ let t = e.step.map(n.slice(r)), o = t && t.getMap();
2018
+ if (r--, o && n.appendMap(o, r), t) {
2019
+ let s = e.selection && e.selection.map(n.slice(r));
2020
+ s && a++;
2021
+ let c = new K(o.invert(), t, s), l, u = i.length - 1;
2022
+ (l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
2023
+ }
2024
+ } else e.map && r--;
2025
+ }, this.items.length, 0), new e(W.from(i.reverse()), a);
2026
+ }
2027
+ };
2028
+ G.empty = new G(W.empty, 0);
2029
+ function Jt(e, t) {
2030
+ let n;
2031
+ return e.forEach((e, r) => {
2032
+ if (e.selection && t-- == 0) return n = r, !1;
2033
+ }), e.slice(n);
2034
+ }
2035
+ var K = class e {
2036
+ constructor(e, t, n, r) {
2037
+ this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
2038
+ }
2039
+ merge(t) {
2040
+ if (this.step && t.step && !t.selection) {
2041
+ let n = t.step.merge(this.step);
2042
+ if (n) return new e(n.getMap().invert(), n, this.selection);
2043
+ }
2044
+ }
2045
+ }, q = class {
2046
+ constructor(e, t, n, r, i) {
2047
+ this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
2048
+ }
2049
+ }, Yt = 20;
2050
+ function Xt(e, t, n, r) {
2051
+ let i = n.getMeta(Z), a;
2052
+ if (i) return i.historyState;
2053
+ n.getMeta(tn) && (e = new q(e.done, e.undone, null, 0, -1));
2054
+ let o = n.getMeta("appendedTransaction");
2055
+ if (n.steps.length == 0) return e;
2056
+ if (o && o.getMeta(Z)) return o.getMeta(Z).redo ? new q(e.done.addTransform(n, void 0, r, X(t)), e.undone, Qt(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);
2057
+ if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
2058
+ let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !Zt(n, e.prevRanges)), s = o ? J(e.prevRanges, n.mapping) : Qt(n.mapping.maps);
2059
+ return new q(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, X(t)), G.empty, s, n.time, i ?? e.prevComposition);
2060
+ } 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);
2061
+ 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);
2062
+ }
2063
+ function Zt(e, t) {
2064
+ if (!t) return !1;
2065
+ if (!e.docChanged) return !0;
2066
+ let n = !1;
2067
+ return e.mapping.maps[0].forEach((e, r) => {
2068
+ for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
2069
+ }), n;
2070
+ }
2071
+ function Qt(e) {
2072
+ let t = [];
2073
+ for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
2074
+ return t;
2075
+ }
2076
+ function J(e, t) {
2077
+ if (!e) return null;
2078
+ let n = [];
2079
+ for (let r = 0; r < e.length; r += 2) {
2080
+ let i = t.map(e[r], 1), a = t.map(e[r + 1], -1);
2081
+ i <= a && n.push(i, a);
2082
+ }
2083
+ return n;
2084
+ }
2085
+ function $t(e, t, n) {
2086
+ let r = X(t), i = Z.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
2087
+ if (!a) return null;
2088
+ 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);
2089
+ return a.transform.setSelection(o).setMeta(Z, {
2090
+ redo: n,
2091
+ historyState: c
2092
+ });
2093
+ }
2094
+ var Y = !1, en = null;
2095
+ function X(e) {
2096
+ let t = e.plugins;
2097
+ if (en != t) {
2098
+ Y = !1, en = t;
2099
+ for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
2100
+ Y = !0;
2101
+ break;
2102
+ }
2103
+ }
2104
+ return Y;
2105
+ }
2106
+ var Z = new c("history"), tn = new c("closeHistory");
2107
+ function nn(e = {}) {
2108
+ return e = {
2109
+ depth: e.depth || 100,
2110
+ newGroupDelay: e.newGroupDelay || 500
2111
+ }, new T({
2112
+ key: Z,
2113
+ state: {
2114
+ init() {
2115
+ return new q(G.empty, G.empty, null, 0, -1);
2116
+ },
2117
+ apply(t, n, r) {
2118
+ return Xt(n, r, t, e);
2119
+ }
2120
+ },
2121
+ config: e,
2122
+ props: { handleDOMEvents: { beforeinput(e, t) {
2123
+ let n = t.inputType, r = n == "historyUndo" ? an : n == "historyRedo" ? on : null;
2124
+ return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
2125
+ } } }
2126
+ });
2127
+ }
2128
+ function rn(e, t) {
2129
+ return (n, r) => {
2130
+ let i = Z.getState(n);
2131
+ if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
2132
+ if (r) {
2133
+ let a = $t(i, n, e);
2134
+ a && r(t ? a.scrollIntoView() : a);
2135
+ }
2136
+ return !0;
2137
+ };
2138
+ }
2139
+ var an = rn(!1, !0), on = rn(!0, !0);
2140
+ b.create({
2141
+ name: "characterCount",
2142
+ addOptions() {
2143
+ return {
2144
+ limit: null,
2145
+ autoTrim: !0,
2146
+ mode: "textSize",
2147
+ textCounter: (e) => e.length,
2148
+ wordCounter: (e) => e.split(" ").filter((e) => e !== "").length
2149
+ };
2150
+ },
2151
+ addStorage() {
2152
+ return {
2153
+ characters: () => 0,
2154
+ words: () => 0
2155
+ };
2156
+ },
2157
+ onBeforeCreate() {
2158
+ this.storage.characters = (e) => {
2159
+ let t = e?.node || this.editor.state.doc;
2160
+ if ((e?.mode || this.options.mode) === "textSize") {
2161
+ let e = t.textBetween(0, t.content.size, void 0, " ");
2162
+ return this.options.textCounter(e);
2163
+ }
2164
+ return t.nodeSize;
2165
+ }, this.storage.words = (e) => {
2166
+ let t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
2167
+ return this.options.wordCounter(n);
2168
+ };
2169
+ },
2170
+ addProseMirrorPlugins() {
2171
+ let e = !1;
2172
+ return [new T({
2173
+ key: new c("characterCount"),
2174
+ appendTransaction: (t, n, r) => {
2175
+ if (e) return;
2176
+ let i = this.options.limit, a = this.options.autoTrim;
2177
+ if (i == null || i === 0 || a === !1) {
2178
+ e = !0;
2179
+ return;
2180
+ }
2181
+ let o = this.storage.characters({ node: r.doc });
2182
+ if (o > i) {
2183
+ let t = o - i;
2184
+ console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);
2185
+ let n = r.tr.deleteRange(0, t);
2186
+ return e = !0, n;
2187
+ }
2188
+ e = !0;
2189
+ },
2190
+ filterTransaction: (e, t) => {
2191
+ let n = this.options.limit;
2192
+ if (!e.docChanged || n === 0 || n == null) return !0;
2193
+ let r = this.storage.characters({ node: t.doc }), i = this.storage.characters({ node: e.doc });
2194
+ if (i <= n || r > n && i > n && i <= r) return !0;
2195
+ if (r > n && i > n && i > r || !e.getMeta("paste")) return !1;
2196
+ let a = e.selection.$head.pos, o = a - (i - n), s = a;
2197
+ return e.deleteRange(o, s), !(this.storage.characters({ node: e.doc }) > n);
2198
+ }
2199
+ })];
2200
+ }
2201
+ });
2202
+ var sn = b.create({
2203
+ name: "dropCursor",
2204
+ addOptions() {
2205
+ return {
2206
+ color: "currentColor",
2207
+ width: 1,
2208
+ class: void 0
2209
+ };
2210
+ },
2211
+ addProseMirrorPlugins() {
2212
+ return [Pt(this.options)];
2213
+ }
2214
+ });
2215
+ b.create({
2216
+ name: "focus",
2217
+ addOptions() {
2218
+ return {
2219
+ className: "has-focus",
2220
+ mode: "all"
2221
+ };
2222
+ },
2223
+ addProseMirrorPlugins() {
2224
+ return [new T({
2225
+ key: new c("focus"),
2226
+ props: { decorations: ({ doc: e, selection: t }) => {
2227
+ let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
2228
+ if (!n || !r) return E.create(e, []);
2229
+ let o = 0;
2230
+ this.options.mode === "deepest" && e.descendants((e, t) => {
2231
+ if (!e.isText) {
2232
+ if (!(i >= t && i <= t + e.nodeSize - 1)) return !1;
2233
+ o += 1;
2234
+ }
2235
+ });
2236
+ let s = 0;
2237
+ return e.descendants((e, t) => {
2238
+ if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
2239
+ if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
2240
+ a.push(C.node(t, t + e.nodeSize, { class: this.options.className }));
2241
+ }), E.create(e, a);
2242
+ } }
2243
+ })];
2244
+ }
2245
+ });
2246
+ var cn = b.create({
2247
+ name: "gapCursor",
2248
+ addProseMirrorPlugins() {
2249
+ return [Bt()];
2250
+ },
2251
+ extendNodeSchema(e) {
2252
+ return { allowGapCursor: ae(m(e, "allowGapCursor", {
2253
+ name: e.name,
2254
+ options: e.options,
2255
+ storage: e.storage
2256
+ })) ?? null };
2257
+ }
2258
+ }), ln = "placeholder", un = new c("tiptap__placeholder");
2259
+ function dn(e) {
2260
+ let { editor: t, placeholder: n, dataAttribute: r, pos: i, node: a, isEmptyDoc: o, hasAnchor: s, classes: { emptyNode: c, emptyEditor: l } } = e, u = [c];
2261
+ return o && u.push(l), C.node(i, i + a.nodeSize, {
2262
+ class: u.join(" "),
2263
+ [r]: typeof n == "function" ? n({
2264
+ editor: t,
2265
+ node: a,
2266
+ pos: i,
2267
+ hasAnchor: s
2268
+ }) : n
2269
+ });
2270
+ }
2271
+ function fn(e, t) {
2272
+ return typeof e == "function" ? e(t) : e;
2273
+ }
2274
+ function pn({ editor: e, options: t, dataAttribute: n, doc: r, selection: i, from: o, to: s }) {
2275
+ let { anchor: c } = i, l = [], u = e.isEmpty;
2276
+ return r.nodesBetween(o, s, (r, i) => {
2277
+ let o = c >= i && c <= i + r.nodeSize, s = !r.isLeaf && a(r);
2278
+ return r.type.isTextblock && (o || !t.showOnlyCurrent) && s && l.push(dn({
2279
+ editor: e,
2280
+ isEmptyDoc: u,
2281
+ dataAttribute: n,
2282
+ hasAnchor: o,
2283
+ placeholder: t.placeholder,
2284
+ classes: {
2285
+ emptyEditor: t.emptyEditorClass,
2286
+ emptyNode: fn(t.emptyNodeClass, {
2287
+ editor: e,
2288
+ node: r,
2289
+ pos: i,
2290
+ hasAnchor: o
2291
+ })
2292
+ },
2293
+ node: r,
2294
+ pos: i
2295
+ })), t.includeChildren;
2296
+ }), l;
2297
+ }
2298
+ function mn({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
2299
+ if (!(e.isEditable || !t.showOnlyWhenEditable)) return null;
2300
+ let { anchor: o } = i, s = [], c = e.isEmpty;
2301
+ if (t.showOnlyCurrent && !t.includeChildren) {
2302
+ let i = r.resolve(o), l = i.depth > 0 ? i.node(1) : i.nodeAfter, u = i.depth > 0 ? i.before(1) : o;
2303
+ if (l && l.type.isTextblock && a(l)) {
2304
+ let r = o >= u && o <= u + l.nodeSize;
2305
+ s.push(dn({
2306
+ editor: e,
2307
+ isEmptyDoc: c,
2308
+ dataAttribute: n,
2309
+ hasAnchor: r,
2310
+ placeholder: t.placeholder,
2311
+ classes: {
2312
+ emptyEditor: t.emptyEditorClass,
2313
+ emptyNode: fn(t.emptyNodeClass, {
2314
+ editor: e,
2315
+ node: l,
2316
+ pos: u,
2317
+ hasAnchor: r
2318
+ })
2319
+ },
2320
+ node: l,
2321
+ pos: u
2322
+ }));
2323
+ }
2324
+ } else s.push(...pn({
2325
+ editor: e,
2326
+ options: t,
2327
+ dataAttribute: n,
2328
+ doc: r,
2329
+ selection: i,
2330
+ from: 0,
2331
+ to: r.content.size
2332
+ }));
2333
+ return E.create(r, s);
2334
+ }
2335
+ function Q(e, t) {
2336
+ let n = e.resolve(t);
2337
+ if (n.depth === 0) {
2338
+ let e = n.nodeAfter ?? n.nodeBefore;
2339
+ if (!e) return {
2340
+ from: t,
2341
+ to: t
2342
+ };
2343
+ let r = n.nodeAfter ? t : t - e.nodeSize;
2344
+ return {
2345
+ from: r,
2346
+ to: r + e.nodeSize
2347
+ };
2348
+ }
2349
+ let r = n.before(1);
2350
+ return {
2351
+ from: r,
2352
+ to: r + n.node(1).nodeSize
2353
+ };
2354
+ }
2355
+ function $(e, t) {
2356
+ return {
2357
+ from: Math.max(0, t.from - 1),
2358
+ to: Math.min(e.content.size, t.to - 1)
2359
+ };
2360
+ }
2361
+ function hn(e, t, n) {
2362
+ let r = [];
2363
+ return e.forEach((e, i) => {
2364
+ let a = i, o = a + e.nodeSize, s = a + 1, c = o + 1;
2365
+ s < n && c > t && r.push({
2366
+ from: a,
2367
+ to: o
2368
+ });
2369
+ }), r;
2370
+ }
2371
+ function gn(e) {
2372
+ if (e.length === 0) return [];
2373
+ let t = [...e].sort((e, t) => e.from - t.from), n = [{ ...t[0] }];
2374
+ for (let e = 1; e < t.length; e += 1) {
2375
+ let r = n[n.length - 1], i = t[e];
2376
+ i.from <= r.to ? r.to = Math.max(r.to, i.to) : n.push({ ...i });
2377
+ }
2378
+ return n;
2379
+ }
2380
+ function _n(e, t) {
2381
+ let n = hn(e, t.from, t.to);
2382
+ return n.push($(e, Q(e, t.from))), t.to > t.from ? n.push($(e, Q(e, Math.min(t.to, e.content.size + 1) - 1))) : t.from < e.content.size + 1 && n.push($(e, Q(e, Math.min(t.from + 1, e.content.size)))), n;
2383
+ }
2384
+ function vn(e, t, n) {
2385
+ let r = [];
2386
+ if (e.docChanged) {
2387
+ let t = p(e);
2388
+ for (let e of t) r.push(..._n(n.doc, e.newRange));
2389
+ }
2390
+ return e.selectionSet && (r.push($(n.doc, Q(n.doc, e.mapping.map(t.selection.anchor)))), r.push($(n.doc, Q(n.doc, n.selection.anchor)))), gn(r);
2391
+ }
2392
+ function yn(e, t, n) {
2393
+ let r = Math.max(0, Math.min(e, n.content.size));
2394
+ return {
2395
+ from: r,
2396
+ to: Math.max(r, Math.min(t, n.content.size))
2397
+ };
2398
+ }
2399
+ function bn({ decorations: e, ranges: t, editor: n, options: r, dataAttribute: i, doc: a, selection: o }) {
2400
+ let s = e;
2401
+ for (let e of t) {
2402
+ let { from: t, to: c } = yn(e.from, e.to, a), l = s.find(t, c).filter((e) => e.from >= t && e.to <= c);
2403
+ l.length && (s = s.remove(l));
2404
+ let u = pn({
2405
+ editor: n,
2406
+ options: r,
2407
+ dataAttribute: i,
2408
+ doc: a,
2409
+ selection: o,
2410
+ from: t,
2411
+ to: c
2412
+ });
2413
+ u.length && (s = s.add(a, u));
2414
+ }
2415
+ return s;
2416
+ }
2417
+ function xn({ editor: e, options: t, dataAttribute: n }) {
2418
+ return {
2419
+ init(r, i) {
2420
+ return mn({
2421
+ editor: e,
2422
+ options: t,
2423
+ dataAttribute: n,
2424
+ doc: i.doc,
2425
+ selection: i.selection
2426
+ }) ?? E.empty;
2427
+ },
2428
+ apply(r, i, a, o) {
2429
+ return !r.docChanged && !r.selectionSet ? i : bn({
2430
+ decorations: i.map(r.mapping, r.doc),
2431
+ ranges: vn(r, a, o),
2432
+ editor: e,
2433
+ options: t,
2434
+ dataAttribute: n,
2435
+ doc: o.doc,
2436
+ selection: o.selection
2437
+ });
2438
+ }
2439
+ };
2440
+ }
2441
+ function Sn(e) {
2442
+ return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
2443
+ }
2444
+ function Cn({ editor: e, options: t }) {
2445
+ let n = t.dataAttribute ? `data-${Sn(t.dataAttribute)}` : `data-${ln}`, r = t.showOnlyCurrent && !t.includeChildren;
2446
+ return new T({
2447
+ key: un,
2448
+ ...r ? {} : { state: xn({
2449
+ editor: e,
2450
+ options: t,
2451
+ dataAttribute: n
2452
+ }) },
2453
+ props: { decorations: r ? ({ doc: r, selection: i }) => mn({
2454
+ editor: e,
2455
+ options: t,
2456
+ dataAttribute: n,
2457
+ doc: r,
2458
+ selection: i
2459
+ }) : (n) => t.showOnlyWhenEditable && !e.isEditable ? E.empty : un.getState(n) ?? E.empty }
2460
+ });
2461
+ }
2462
+ b.create({
2463
+ name: "placeholder",
2464
+ addOptions() {
2465
+ return {
2466
+ emptyEditorClass: "is-editor-empty",
2467
+ emptyNodeClass: "is-empty",
2468
+ dataAttribute: ln,
2469
+ placeholder: "Write something …",
2470
+ showOnlyWhenEditable: !0,
2471
+ showOnlyCurrent: !0,
2472
+ includeChildren: !1
2473
+ };
2474
+ },
2475
+ addProseMirrorPlugins() {
2476
+ return [Cn({
2477
+ editor: this.editor,
2478
+ options: this.options
2479
+ })];
2480
+ }
2481
+ });
2482
+ function wn(e, t) {
2483
+ return !e.selection.empty && !s(e.selection) && t.isEditable;
2484
+ }
2485
+ function Tn(e, t) {
2486
+ return wn(e, t) && !t.isFocused && !t.view.dragging;
2487
+ }
2488
+ function En() {
2489
+ var e;
2490
+ (e = window.getSelection()) == null || e.removeAllRanges();
2491
+ }
2492
+ function Dn(e) {
2493
+ e.focus();
2494
+ }
2495
+ b.create({
2496
+ name: "selection",
2497
+ addOptions() {
2498
+ return { className: "selection" };
2499
+ },
2500
+ addProseMirrorPlugins() {
2501
+ let { editor: e, options: t } = this;
2502
+ return [new T({
2503
+ key: new c("selection"),
2504
+ props: {
2505
+ decorations(n) {
2506
+ return Tn(n, e) ? E.create(n.doc, [C.inline(n.selection.from, n.selection.to, { class: t.className })]) : null;
2507
+ },
2508
+ handleDOMEvents: {
2509
+ blur(t) {
2510
+ return wn(t.state, e) && En(), !1;
2511
+ },
2512
+ focus(t) {
2513
+ return wn(t.state, e) && requestAnimationFrame(() => {
2514
+ !e.isDestroyed && t.hasFocus() && Dn(t);
2515
+ }), !1;
2516
+ }
2517
+ }
2518
+ }
2519
+ })];
2520
+ }
2521
+ });
2522
+ function On({ types: e, node: t }) {
2523
+ return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
2524
+ }
2525
+ var kn = b.create({
2526
+ name: "trailingNode",
2527
+ addOptions() {
2528
+ return {
2529
+ node: void 0,
2530
+ notAfter: []
2531
+ };
2532
+ },
2533
+ addProseMirrorPlugins() {
2534
+ let e = new c(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));
2535
+ return [new T({
2536
+ key: e,
2537
+ appendTransaction: (n, r, i) => {
2538
+ let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
2539
+ if (!n.some((e) => e.getMeta("skipTrailingNode")) && c) return o.insert(l, u.create());
2540
+ },
2541
+ state: {
2542
+ init: (e, t) => {
2543
+ let r = t.tr.doc.lastChild;
2544
+ return !On({
2545
+ node: r,
2546
+ types: n
2547
+ });
2548
+ },
2549
+ apply: (e, t) => {
2550
+ if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
2551
+ let r = e.doc.lastChild;
2552
+ return !On({
2553
+ node: r,
2554
+ types: n
2555
+ });
2556
+ }
2557
+ }
2558
+ })];
2559
+ }
2560
+ }), An = b.create({
2561
+ name: "undoRedo",
2562
+ addOptions() {
2563
+ return {
2564
+ depth: 100,
2565
+ newGroupDelay: 500
2566
+ };
2567
+ },
2568
+ addCommands() {
2569
+ return {
2570
+ undo: () => ({ state: e, dispatch: t }) => an(e, t),
2571
+ redo: () => ({ state: e, dispatch: t }) => on(e, t)
2572
+ };
2573
+ },
2574
+ addProseMirrorPlugins() {
2575
+ return [nn(this.options)];
2576
+ },
2577
+ addKeyboardShortcuts() {
2578
+ return {
2579
+ "Mod-z": () => this.editor.commands.undo(),
2580
+ "Shift-Mod-z": () => this.editor.commands.redo(),
2581
+ "Mod-y": () => this.editor.commands.redo(),
2582
+ "Mod-я": () => this.editor.commands.undo(),
2583
+ "Shift-Mod-я": () => this.editor.commands.redo()
2584
+ };
2585
+ }
2586
+ }), jn = b.create({
2587
+ name: "starterKit",
2588
+ addExtensions() {
2589
+ let e = [];
2590
+ return this.options.bold !== !1 && e.push(_e.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(fe.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(Re.configure(this.options.bulletList)), this.options.code !== !1 && e.push(be.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(Ce.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(we.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(sn.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(cn.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Te.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(Ee.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(An.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(De.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(Me.configure(this.options.italic)), this.options.listItem !== !1 && e.push(tt.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(ut.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(ce.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Tt.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(kt.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(Mt.configure(this.options.strike)), this.options.text !== !1 && e.push(Nt.configure(this.options.text)), this.options.underline !== !1 && e.push(le.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(kn.configure(this.options?.trailingNode)), e;
2591
+ }
2592
+ }), Mn = jn;
2593
+ //#endregion
2594
+ export { jn as StarterKit, Mn as default };