@aiao/code-editor-react 0.0.9 → 0.0.11

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 (121) hide show
  1. package/dist/index.js +118 -2
  2. package/package.json +5 -5
  3. package/dist/apl-B2DGVGxc-Dd6D39pP.js +0 -76
  4. package/dist/asciiarmor-2LVJmxlE-CAn4gnoC.js +0 -34
  5. package/dist/asn1-jKiBa2Ya-xsKwdyq9.js +0 -95
  6. package/dist/asterisk-DS281yxp-B5eTWk_B.js +0 -271
  7. package/dist/brainfuck-C_p9pTT8-DKVQ9poL.js +0 -34
  8. package/dist/clike-BMALKCNj-Ck7Gc35_.js +0 -620
  9. package/dist/clojure-CCKyeQKf-N9sg777Z.js +0 -800
  10. package/dist/cmake-CuaCgAKt-BbEgXraO.js +0 -28
  11. package/dist/cobol-BlTKFDRj-CHCoWafp.js +0 -72
  12. package/dist/coffeescript-BVCvwO8I-Z15ai5ac.js +0 -179
  13. package/dist/commonlisp-D_kxz07b-Ce7sn14o.js +0 -75
  14. package/dist/crystal-D309uH6_-DS6LrXoE.js +0 -217
  15. package/dist/css-BkF-NPzE-DiJu9Nkd.js +0 -1553
  16. package/dist/cypher-BMq4Fwjl-Ml-omWgp.js +0 -68
  17. package/dist/d-BZcgY6La-KCW6-bIm.js +0 -127
  18. package/dist/diff-Cg9d_RX2-C01qBVFc.js +0 -18
  19. package/dist/dockerfile-DFX8bq9N-BIbYUQV0.js +0 -194
  20. package/dist/dtd-CtLokQ-U-DCbNdeIA.js +0 -84
  21. package/dist/dylan-QYeExnWK-DIUVpsct.js +0 -234
  22. package/dist/ebnf-DUPDuY4r-7HIXKmWn.js +0 -78
  23. package/dist/ecl-CiXN-g_D-DOI-W0if.js +0 -121
  24. package/dist/eiffel-yQhjl4T1-DIX8Ceq1.js +0 -110
  25. package/dist/elm-CNT9vbN0-BcYlydpO.js +0 -108
  26. package/dist/erlang-CFOYdy9e-DULXsFZl.js +0 -487
  27. package/dist/factor-Clf6BoVk-DBb2EHMF.js +0 -65
  28. package/dist/fcl-CPC2WYrI-CuXG3fcK.js +0 -103
  29. package/dist/forth-BmxRyE9S-BcFwWpeL.js +0 -60
  30. package/dist/fortran-9bvPyrOW-CuLcq-Iu.js +0 -442
  31. package/dist/gas-cpmYfFX2-sZgGhMxB.js +0 -183
  32. package/dist/gherkin-CJuwpceU-BRrr8yjO.js +0 -34
  33. package/dist/groovy-DZeT_VM--CmF8wcSo.js +0 -146
  34. package/dist/haskell-CxiO_7JL-BuULsXvv.js +0 -375
  35. package/dist/haxe-70NVW1pR-CM27SfgM.js +0 -359
  36. package/dist/http-D9LttvKF-j9E8oQ7o.js +0 -44
  37. package/dist/idl-B6TRFYjl-B6TRFYjl.js +0 -947
  38. package/dist/index-4oLq9F9B-CiG9J_wS.js +0 -944
  39. package/dist/index-9NH8hlZ--ZzqmPLCF.js +0 -342
  40. package/dist/index-BFXNCCbG-LloeVRnr.js +0 -253
  41. package/dist/index-BLHYcXXK-BxaAXMNw.js +0 -101
  42. package/dist/index-BQU3Rb2C-DeyQP3x_.js +0 -290
  43. package/dist/index-Bg18ePld-Di0FNEJ4.js +0 -157
  44. package/dist/index-Bp5lqnbN-BM2h2Xfi.js +0 -555
  45. package/dist/index-Bqzq8A1N-Dn1yj5KO.js +0 -59
  46. package/dist/index-Bx-s4g99-QIFA9lMK.js +0 -76
  47. package/dist/index-BxX25QmV-Cnf0cb51.js +0 -248
  48. package/dist/index-CFCzgc33-MPwtm3eY.js +0 -1917
  49. package/dist/index-CL7JTU9M-Bl8j0-fU.js +0 -136
  50. package/dist/index-CgClvcTI.js +0 -35617
  51. package/dist/index-CipmEceX-D1vXXSTd.js +0 -74
  52. package/dist/index-Cv4vvpa2-B8Ojlo_m.js +0 -1305
  53. package/dist/index-D4hhdPbZ-DXEZQFco.js +0 -6152
  54. package/dist/index-DhNQ8g9I-CjBYiskZ.js +0 -270
  55. package/dist/index-Djp53tAP-DnPgUG4S.js +0 -94
  56. package/dist/index-KlsAFhIj-Dzil0Vr8.js +0 -566
  57. package/dist/index-OntZqtu6-DPgaaGGJ.js +0 -305
  58. package/dist/index-PGnZjMCR-BPDty4q0.js +0 -301
  59. package/dist/index-TyYoYgss-BIjAZ6j1.js +0 -613
  60. package/dist/index-oMSPmlXA-CoPtKzNe.js +0 -960
  61. package/dist/index-rQC6Gbk0-BZ6M0IzM.js +0 -138
  62. package/dist/javascript-DOuB9oqA-BxiygWgm.js +0 -691
  63. package/dist/julia-DpvXAuO6-Bk_IfD8X.js +0 -241
  64. package/dist/livescript-CanGTf8u-Cx6PrvS4.js +0 -272
  65. package/dist/lua-XplVlWi_-8f8obHzY.js +0 -217
  66. package/dist/mathematica-jaRHnSxC-B83gQsL2.js +0 -35
  67. package/dist/mbox-BctzC1hL-Hg5U2B4l.js +0 -76
  68. package/dist/mirc-CFBPAOaF-CfzSSk9W.js +0 -72
  69. package/dist/mllike-BSnXJBGA-Ao1NpT2u.js +0 -272
  70. package/dist/modelica-vUgVs--1-BObVpYBg.js +0 -93
  71. package/dist/mscgen-Cpl0NYLN-DqNArLGH.js +0 -104
  72. package/dist/mumps-CQoS1kWX-CkTUOQnt.js +0 -25
  73. package/dist/nginx-zDPm3Z74-DJk4KP7N.js +0 -87
  74. package/dist/nsis-BCLyjY7m-C2MffOQ3.js +0 -62
  75. package/dist/ntriples-CsNjv2QF-C4aZn3EO.js +0 -79
  76. package/dist/octave-C8PmmSRH-DM5vTWlU.js +0 -143
  77. package/dist/oz-Ce8aN8oE-BcJM4SVy.js +0 -151
  78. package/dist/pascal-De0D6mP7-D7DGFFKL.js +0 -77
  79. package/dist/perl-B4bSCe1C-6aIa2glS.js +0 -915
  80. package/dist/pig-D24Z8EXi-BD-qt5FU.js +0 -54
  81. package/dist/powershell-DkYVfTzP-Blt1Rodi.js +0 -249
  82. package/dist/properties-Dn9wna3M-EOOwnCnk.js +0 -26
  83. package/dist/protobuf-BPIjwpzm-DAButU8_.js +0 -49
  84. package/dist/pug-TGXr6c5j-C9HfQ86E.js +0 -248
  85. package/dist/puppet-nyd4dhjf-CGzH5dsa.js +0 -45
  86. package/dist/python-BkR3uSy8-CjDnyp3B.js +0 -313
  87. package/dist/q-DyHZGnqm-DGuqeH_T.js +0 -86
  88. package/dist/r-LKEuhEGI-BFQhJnTP.js +0 -104
  89. package/dist/rpm-IznJm2Xc-CbZqrWCM.js +0 -57
  90. package/dist/ruby-CcYfvIk6-DzPSfSGo.js +0 -228
  91. package/dist/sas-7E8yHoCW-D726Uzkw.js +0 -105
  92. package/dist/scheme-DjibxsNh-Bp5gVFkm.js +0 -124
  93. package/dist/shell-C0C2sNA_-BTeYg6ir.js +0 -182
  94. package/dist/sieve-Bwz7vjP5-Cw8iTBf7.js +0 -72
  95. package/dist/simple-mode-mNVtnu0l-BC8mf7KF.js +0 -89
  96. package/dist/smalltalk-Bhddl2pB-B7URiJSp.js +0 -48
  97. package/dist/solr-BNlsLglM-BM2OpfTI.js +0 -41
  98. package/dist/sparql-FarWu_Gb-FN_uQNd4.js +0 -197
  99. package/dist/spreadsheet-C-cy4P5N-5CSTwVYq.js +0 -49
  100. package/dist/sql-CfG5lQ3l-Bd4dgm_8.js +0 -278
  101. package/dist/stex-Du4h4KAU-QOov_zHj.js +0 -129
  102. package/dist/stylus-CAdqWld3-BcRBbBxD.js +0 -250
  103. package/dist/swift-DSxqR9R6-2Hz4NOoF.js +0 -230
  104. package/dist/tcl-xfoLljhY-DAZBRGQI.js +0 -81
  105. package/dist/textile-D1AWE-pc-DuiIfEnb.js +0 -295
  106. package/dist/tiddlywiki-5wqsXtSk-WuF_8VUv.js +0 -155
  107. package/dist/tiki-__Kn3CeS-CWcR9ib_.js +0 -181
  108. package/dist/toml-DWAmxCjl-CyJoDzs6.js +0 -56
  109. package/dist/troff-D2UO-fKf-DVoIzS-O.js +0 -35
  110. package/dist/ttcn-Bsa4sfRm-hoy08sYQ.js +0 -123
  111. package/dist/ttcn-cfg-Bac_acMi-DaC4kQpd.js +0 -88
  112. package/dist/turtle-xwJUxoPV-fs94wdNM.js +0 -80
  113. package/dist/vb-c2kQGd6--DU726qF0.js +0 -74
  114. package/dist/vbscript-1f_Dhg5H-DriA32xD.js +0 -324
  115. package/dist/velocity-DJd0pTTC-BG368IR6.js +0 -96
  116. package/dist/verilog-CiS1jyi5-giQA8J-e.js +0 -259
  117. package/dist/vhdl-T9HkrbI2-BJ8LEDog.js +0 -106
  118. package/dist/webidl-CjfDENEo-BM8KXKJ5.js +0 -155
  119. package/dist/xquery-Ct6lEb4B-C5KDc61l.js +0 -422
  120. package/dist/yacas-C0absKBh-B82QJ76F.js +0 -73
  121. package/dist/z80-Pki2zAjW-B0IQoIbR.js +0 -61
@@ -1,1917 +0,0 @@
1
- import { a as rt, e as it, x as fe, w as ot, i as at, c as lt, C as ht, R as D, S as M, X as $, d as ft, l as Q, f as v, g as ut, N as Ie, u as Te, J as ct, y as dt, P as g, n as Be, b as pt, h as mt, V as E, j as gt, k as ue, m as kt } from "./index-CgClvcTI.js";
2
- import { H as xt } from "./index-D4hhdPbZ-DXEZQFco.js";
3
- import { html as Lt, htmlCompletionSource as bt } from "./index-4oLq9F9B-CiG9J_wS.js";
4
- class j {
5
- static create(e, n, s, r, i) {
6
- let o = r + (r << 8) + e + (n << 4) | 0;
7
- return new j(e, n, s, o, i, [], []);
8
- }
9
- constructor(e, n, s, r, i, o, a) {
10
- this.type = e, this.value = n, this.from = s, this.hash = r, this.end = i, this.children = o, this.positions = a, this.hashProp = [[v.contextHash, r]];
11
- }
12
- addChild(e, n) {
13
- e.prop(v.contextHash) != this.hash && (e = new E(e.type, e.children, e.positions, e.length, this.hashProp)), this.children.push(e), this.positions.push(n);
14
- }
15
- toTree(e, n = this.end) {
16
- let s = this.children.length - 1;
17
- return s >= 0 && (n = Math.max(n, this.positions[s] + this.children[s].length + this.from)), new E(e.types[this.type], this.children, this.positions, n - this.from).balance({
18
- makeTree: (r, i, o) => new E(Q.none, r, i, o, this.hashProp)
19
- });
20
- }
21
- }
22
- var u;
23
- (function(t) {
24
- t[t.Document = 1] = "Document", t[t.CodeBlock = 2] = "CodeBlock", t[t.FencedCode = 3] = "FencedCode", t[t.Blockquote = 4] = "Blockquote", t[t.HorizontalRule = 5] = "HorizontalRule", t[t.BulletList = 6] = "BulletList", t[t.OrderedList = 7] = "OrderedList", t[t.ListItem = 8] = "ListItem", t[t.ATXHeading1 = 9] = "ATXHeading1", t[t.ATXHeading2 = 10] = "ATXHeading2", t[t.ATXHeading3 = 11] = "ATXHeading3", t[t.ATXHeading4 = 12] = "ATXHeading4", t[t.ATXHeading5 = 13] = "ATXHeading5", t[t.ATXHeading6 = 14] = "ATXHeading6", t[t.SetextHeading1 = 15] = "SetextHeading1", t[t.SetextHeading2 = 16] = "SetextHeading2", t[t.HTMLBlock = 17] = "HTMLBlock", t[t.LinkReference = 18] = "LinkReference", t[t.Paragraph = 19] = "Paragraph", t[t.CommentBlock = 20] = "CommentBlock", t[t.ProcessingInstructionBlock = 21] = "ProcessingInstructionBlock", t[t.Escape = 22] = "Escape", t[t.Entity = 23] = "Entity", t[t.HardBreak = 24] = "HardBreak", t[t.Emphasis = 25] = "Emphasis", t[t.StrongEmphasis = 26] = "StrongEmphasis", t[t.Link = 27] = "Link", t[t.Image = 28] = "Image", t[t.InlineCode = 29] = "InlineCode", t[t.HTMLTag = 30] = "HTMLTag", t[t.Comment = 31] = "Comment", t[t.ProcessingInstruction = 32] = "ProcessingInstruction", t[t.Autolink = 33] = "Autolink", t[t.HeaderMark = 34] = "HeaderMark", t[t.QuoteMark = 35] = "QuoteMark", t[t.ListMark = 36] = "ListMark", t[t.LinkMark = 37] = "LinkMark", t[t.EmphasisMark = 38] = "EmphasisMark", t[t.CodeMark = 39] = "CodeMark", t[t.CodeText = 40] = "CodeText", t[t.CodeInfo = 41] = "CodeInfo", t[t.LinkTitle = 42] = "LinkTitle", t[t.LinkLabel = 43] = "LinkLabel", t[t.URL = 44] = "URL";
25
- })(u || (u = {}));
26
- class St {
27
- /**
28
- @internal
29
- */
30
- constructor(e, n) {
31
- this.start = e, this.content = n, this.marks = [], this.parsers = [];
32
- }
33
- }
34
- class Ct {
35
- constructor() {
36
- this.text = "", this.baseIndent = 0, this.basePos = 0, this.depth = 0, this.markers = [], this.pos = 0, this.indent = 0, this.next = -1;
37
- }
38
- /**
39
- @internal
40
- */
41
- forward() {
42
- this.basePos > this.pos && this.forwardInner();
43
- }
44
- /**
45
- @internal
46
- */
47
- forwardInner() {
48
- let e = this.skipSpace(this.basePos);
49
- this.indent = this.countIndent(e, this.pos, this.indent), this.pos = e, this.next = e == this.text.length ? -1 : this.text.charCodeAt(e);
50
- }
51
- /**
52
- Skip whitespace after the given position, return the position of
53
- the next non-space character or the end of the line if there's
54
- only space after `from`.
55
- */
56
- skipSpace(e) {
57
- return O(this.text, e);
58
- }
59
- /**
60
- @internal
61
- */
62
- reset(e) {
63
- for (this.text = e, this.baseIndent = this.basePos = this.pos = this.indent = 0, this.forwardInner(), this.depth = 1; this.markers.length; )
64
- this.markers.pop();
65
- }
66
- /**
67
- Move the line's base position forward to the given position.
68
- This should only be called by composite [block
69
- parsers](#BlockParser.parse) or [markup skipping
70
- functions](#NodeSpec.composite).
71
- */
72
- moveBase(e) {
73
- this.basePos = e, this.baseIndent = this.countIndent(e, this.pos, this.indent);
74
- }
75
- /**
76
- Move the line's base position forward to the given _column_.
77
- */
78
- moveBaseColumn(e) {
79
- this.baseIndent = e, this.basePos = this.findColumn(e);
80
- }
81
- /**
82
- Store a composite-block-level marker. Should be called from
83
- [markup skipping functions](#NodeSpec.composite) when they
84
- consume any non-whitespace characters.
85
- */
86
- addMarker(e) {
87
- this.markers.push(e);
88
- }
89
- /**
90
- Find the column position at `to`, optionally starting at a given
91
- position and column.
92
- */
93
- countIndent(e, n = 0, s = 0) {
94
- for (let r = n; r < e; r++)
95
- s += this.text.charCodeAt(r) == 9 ? 4 - s % 4 : 1;
96
- return s;
97
- }
98
- /**
99
- Find the position corresponding to the given column.
100
- */
101
- findColumn(e) {
102
- let n = 0;
103
- for (let s = 0; n < this.text.length && s < e; n++)
104
- s += this.text.charCodeAt(n) == 9 ? 4 - s % 4 : 1;
105
- return n;
106
- }
107
- /**
108
- @internal
109
- */
110
- scrub() {
111
- if (!this.baseIndent)
112
- return this.text;
113
- let e = "";
114
- for (let n = 0; n < this.basePos; n++)
115
- e += " ";
116
- return e + this.text.slice(this.basePos);
117
- }
118
- }
119
- function ce(t, e, n) {
120
- if (n.pos == n.text.length || t != e.block && n.indent >= e.stack[n.depth + 1].value + n.baseIndent)
121
- return !0;
122
- if (n.indent >= n.baseIndent + 4)
123
- return !1;
124
- let s = (t.type == u.OrderedList ? oe : ie)(n, e, !1);
125
- return s > 0 && (t.type != u.BulletList || re(n, e, !1) < 0) && n.text.charCodeAt(n.pos + s - 1) == t.value;
126
- }
127
- const Ee = {
128
- [u.Blockquote](t, e, n) {
129
- return n.next != 62 ? !1 : (n.markers.push(k(u.QuoteMark, e.lineStart + n.pos, e.lineStart + n.pos + 1)), n.moveBase(n.pos + (w(n.text.charCodeAt(n.pos + 1)) ? 2 : 1)), t.end = e.lineStart + n.text.length, !0);
130
- },
131
- [u.ListItem](t, e, n) {
132
- return n.indent < n.baseIndent + t.value && n.next > -1 ? !1 : (n.moveBaseColumn(n.baseIndent + t.value), !0);
133
- },
134
- [u.OrderedList]: ce,
135
- [u.BulletList]: ce,
136
- [u.Document]() {
137
- return !0;
138
- }
139
- };
140
- function w(t) {
141
- return t == 32 || t == 9 || t == 10 || t == 13;
142
- }
143
- function O(t, e = 0) {
144
- for (; e < t.length && w(t.charCodeAt(e)); )
145
- e++;
146
- return e;
147
- }
148
- function de(t, e, n) {
149
- for (; e > n && w(t.charCodeAt(e - 1)); )
150
- e--;
151
- return e;
152
- }
153
- function Me(t) {
154
- if (t.next != 96 && t.next != 126)
155
- return -1;
156
- let e = t.pos + 1;
157
- for (; e < t.text.length && t.text.charCodeAt(e) == t.next; )
158
- e++;
159
- if (e < t.pos + 3)
160
- return -1;
161
- if (t.next == 96) {
162
- for (let n = e; n < t.text.length; n++)
163
- if (t.text.charCodeAt(n) == 96)
164
- return -1;
165
- }
166
- return e;
167
- }
168
- function ve(t) {
169
- return t.next != 62 ? -1 : t.text.charCodeAt(t.pos + 1) == 32 ? 2 : 1;
170
- }
171
- function re(t, e, n) {
172
- if (t.next != 42 && t.next != 45 && t.next != 95)
173
- return -1;
174
- let s = 1;
175
- for (let r = t.pos + 1; r < t.text.length; r++) {
176
- let i = t.text.charCodeAt(r);
177
- if (i == t.next)
178
- s++;
179
- else if (!w(i))
180
- return -1;
181
- }
182
- return n && t.next == 45 && Ne(t) > -1 && t.depth == e.stack.length && e.parser.leafBlockParsers.indexOf(Xe.SetextHeading) > -1 || s < 3 ? -1 : 1;
183
- }
184
- function He(t, e) {
185
- for (let n = t.stack.length - 1; n >= 0; n--)
186
- if (t.stack[n].type == e)
187
- return !0;
188
- return !1;
189
- }
190
- function ie(t, e, n) {
191
- return (t.next == 45 || t.next == 43 || t.next == 42) && (t.pos == t.text.length - 1 || w(t.text.charCodeAt(t.pos + 1))) && (!n || He(e, u.BulletList) || t.skipSpace(t.pos + 2) < t.text.length) ? 1 : -1;
192
- }
193
- function oe(t, e, n) {
194
- let s = t.pos, r = t.next;
195
- for (; r >= 48 && r <= 57; ) {
196
- if (s++, s == t.text.length)
197
- return -1;
198
- r = t.text.charCodeAt(s);
199
- }
200
- return s == t.pos || s > t.pos + 9 || r != 46 && r != 41 || s < t.text.length - 1 && !w(t.text.charCodeAt(s + 1)) || n && !He(e, u.OrderedList) && (t.skipSpace(s + 1) == t.text.length || s > t.pos + 1 || t.next != 49) ? -1 : s + 1 - t.pos;
201
- }
202
- function Pe(t) {
203
- if (t.next != 35)
204
- return -1;
205
- let e = t.pos + 1;
206
- for (; e < t.text.length && t.text.charCodeAt(e) == 35; )
207
- e++;
208
- if (e < t.text.length && t.text.charCodeAt(e) != 32)
209
- return -1;
210
- let n = e - t.pos;
211
- return n > 6 ? -1 : n;
212
- }
213
- function Ne(t) {
214
- if (t.next != 45 && t.next != 61 || t.indent >= t.baseIndent + 4)
215
- return -1;
216
- let e = t.pos + 1;
217
- for (; e < t.text.length && t.text.charCodeAt(e) == t.next; )
218
- e++;
219
- let n = e;
220
- for (; e < t.text.length && w(t.text.charCodeAt(e)); )
221
- e++;
222
- return e == t.text.length ? n : -1;
223
- }
224
- const Y = /^[ \t]*$/, Oe = /-->/, Re = /\?>/, ee = [
225
- [/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i],
226
- [/^\s*<!--/, Oe],
227
- [/^\s*<\?/, Re],
228
- [/^\s*<![A-Z]/, />/],
229
- [/^\s*<!\[CDATA\[/, /\]\]>/],
230
- [/^\s*<\/?(?:address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i, Y],
231
- [/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, Y]
232
- ];
233
- function $e(t, e, n) {
234
- if (t.next != 60)
235
- return -1;
236
- let s = t.text.slice(t.pos);
237
- for (let r = 0, i = ee.length - (n ? 1 : 0); r < i; r++)
238
- if (ee[r][0].test(s))
239
- return r;
240
- return -1;
241
- }
242
- function pe(t, e) {
243
- let n = t.countIndent(e, t.pos, t.indent), s = t.countIndent(t.skipSpace(e), e, n);
244
- return s >= n + 5 ? n + 1 : s;
245
- }
246
- function y(t, e, n) {
247
- let s = t.length - 1;
248
- s >= 0 && t[s].to == e && t[s].type == u.CodeText ? t[s].to = n : t.push(k(u.CodeText, e, n));
249
- }
250
- const q = {
251
- LinkReference: void 0,
252
- IndentedCode(t, e) {
253
- let n = e.baseIndent + 4;
254
- if (e.indent < n)
255
- return !1;
256
- let s = e.findColumn(n), r = t.lineStart + s, i = t.lineStart + e.text.length, o = [], a = [];
257
- for (y(o, r, i); t.nextLine() && e.depth >= t.stack.length; )
258
- if (e.pos == e.text.length) {
259
- y(a, t.lineStart - 1, t.lineStart);
260
- for (let l of e.markers)
261
- a.push(l);
262
- } else {
263
- if (e.indent < n)
264
- break;
265
- {
266
- if (a.length) {
267
- for (let h of a)
268
- h.type == u.CodeText ? y(o, h.from, h.to) : o.push(h);
269
- a = [];
270
- }
271
- y(o, t.lineStart - 1, t.lineStart);
272
- for (let h of e.markers)
273
- o.push(h);
274
- i = t.lineStart + e.text.length;
275
- let l = t.lineStart + e.findColumn(e.baseIndent + 4);
276
- l < i && y(o, l, i);
277
- }
278
- }
279
- return a.length && (a = a.filter((l) => l.type != u.CodeText), a.length && (e.markers = a.concat(e.markers))), t.addNode(t.buffer.writeElements(o, -r).finish(u.CodeBlock, i - r), r), !0;
280
- },
281
- FencedCode(t, e) {
282
- let n = Me(e);
283
- if (n < 0)
284
- return !1;
285
- let s = t.lineStart + e.pos, r = e.next, i = n - e.pos, o = e.skipSpace(n), a = de(e.text, e.text.length, o), l = [k(u.CodeMark, s, s + i)];
286
- o < a && l.push(k(u.CodeInfo, t.lineStart + o, t.lineStart + a));
287
- for (let h = !0, f = !0, d = !1; t.nextLine() && e.depth >= t.stack.length; h = !1) {
288
- let c = e.pos;
289
- if (e.indent - e.baseIndent < 4)
290
- for (; c < e.text.length && e.text.charCodeAt(c) == r; )
291
- c++;
292
- if (c - e.pos >= i && e.skipSpace(c) == e.text.length) {
293
- for (let p of e.markers)
294
- l.push(p);
295
- f && d && y(l, t.lineStart - 1, t.lineStart), l.push(k(u.CodeMark, t.lineStart + e.pos, t.lineStart + c)), t.nextLine();
296
- break;
297
- } else {
298
- d = !0, h || (y(l, t.lineStart - 1, t.lineStart), f = !1);
299
- for (let S of e.markers)
300
- l.push(S);
301
- let p = t.lineStart + e.basePos, m = t.lineStart + e.text.length;
302
- p < m && (y(l, p, m), f = !1);
303
- }
304
- }
305
- return t.addNode(t.buffer.writeElements(l, -s).finish(u.FencedCode, t.prevLineEnd() - s), s), !0;
306
- },
307
- Blockquote(t, e) {
308
- let n = ve(e);
309
- return n < 0 ? !1 : (t.startContext(u.Blockquote, e.pos), t.addNode(u.QuoteMark, t.lineStart + e.pos, t.lineStart + e.pos + 1), e.moveBase(e.pos + n), null);
310
- },
311
- HorizontalRule(t, e) {
312
- if (re(e, t, !1) < 0)
313
- return !1;
314
- let n = t.lineStart + e.pos;
315
- return t.nextLine(), t.addNode(u.HorizontalRule, n), !0;
316
- },
317
- BulletList(t, e) {
318
- let n = ie(e, t, !1);
319
- if (n < 0)
320
- return !1;
321
- t.block.type != u.BulletList && t.startContext(u.BulletList, e.basePos, e.next);
322
- let s = pe(e, e.pos + 1);
323
- return t.startContext(u.ListItem, e.basePos, s - e.baseIndent), t.addNode(u.ListMark, t.lineStart + e.pos, t.lineStart + e.pos + n), e.moveBaseColumn(s), null;
324
- },
325
- OrderedList(t, e) {
326
- let n = oe(e, t, !1);
327
- if (n < 0)
328
- return !1;
329
- t.block.type != u.OrderedList && t.startContext(u.OrderedList, e.basePos, e.text.charCodeAt(e.pos + n - 1));
330
- let s = pe(e, e.pos + n);
331
- return t.startContext(u.ListItem, e.basePos, s - e.baseIndent), t.addNode(u.ListMark, t.lineStart + e.pos, t.lineStart + e.pos + n), e.moveBaseColumn(s), null;
332
- },
333
- ATXHeading(t, e) {
334
- let n = Pe(e);
335
- if (n < 0)
336
- return !1;
337
- let s = e.pos, r = t.lineStart + s, i = de(e.text, e.text.length, s), o = i;
338
- for (; o > s && e.text.charCodeAt(o - 1) == e.next; )
339
- o--;
340
- (o == i || o == s || !w(e.text.charCodeAt(o - 1))) && (o = e.text.length);
341
- let a = t.buffer.write(u.HeaderMark, 0, n).writeElements(t.parser.parseInline(e.text.slice(s + n + 1, o), r + n + 1), -r);
342
- o < e.text.length && a.write(u.HeaderMark, o - s, i - s);
343
- let l = a.finish(u.ATXHeading1 - 1 + n, e.text.length - s);
344
- return t.nextLine(), t.addNode(l, r), !0;
345
- },
346
- HTMLBlock(t, e) {
347
- let n = $e(e, t, !1);
348
- if (n < 0)
349
- return !1;
350
- let s = t.lineStart + e.pos, r = ee[n][1], i = [], o = r != Y;
351
- for (; !r.test(e.text) && t.nextLine(); ) {
352
- if (e.depth < t.stack.length) {
353
- o = !1;
354
- break;
355
- }
356
- for (let h of e.markers)
357
- i.push(h);
358
- }
359
- o && t.nextLine();
360
- let a = r == Oe ? u.CommentBlock : r == Re ? u.ProcessingInstructionBlock : u.HTMLBlock, l = t.prevLineEnd();
361
- return t.addNode(t.buffer.writeElements(i, -s).finish(a, l - s), s), !0;
362
- },
363
- SetextHeading: void 0
364
- // Specifies relative precedence for block-continue function
365
- };
366
- class wt {
367
- constructor(e) {
368
- this.stage = 0, this.elts = [], this.pos = 0, this.start = e.start, this.advance(e.content);
369
- }
370
- nextLine(e, n, s) {
371
- if (this.stage == -1)
372
- return !1;
373
- let r = s.content + `
374
- ` + n.scrub(), i = this.advance(r);
375
- return i > -1 && i < r.length ? this.complete(e, s, i) : !1;
376
- }
377
- finish(e, n) {
378
- return (this.stage == 2 || this.stage == 3) && O(n.content, this.pos) == n.content.length ? this.complete(e, n, n.content.length) : !1;
379
- }
380
- complete(e, n, s) {
381
- return e.addLeafElement(n, k(u.LinkReference, this.start, this.start + s, this.elts)), !0;
382
- }
383
- nextStage(e) {
384
- return e ? (this.pos = e.to - this.start, this.elts.push(e), this.stage++, !0) : (e === !1 && (this.stage = -1), !1);
385
- }
386
- advance(e) {
387
- for (; ; ) {
388
- if (this.stage == -1)
389
- return -1;
390
- if (this.stage == 0) {
391
- if (!this.nextStage(Ve(e, this.pos, this.start, !0)))
392
- return -1;
393
- if (e.charCodeAt(this.pos) != 58)
394
- return this.stage = -1;
395
- this.elts.push(k(u.LinkMark, this.pos + this.start, this.pos + this.start + 1)), this.pos++;
396
- } else if (this.stage == 1) {
397
- if (!this.nextStage(_e(e, O(e, this.pos), this.start)))
398
- return -1;
399
- } else if (this.stage == 2) {
400
- let n = O(e, this.pos), s = 0;
401
- if (n > this.pos) {
402
- let r = Qe(e, n, this.start);
403
- if (r) {
404
- let i = Z(e, r.to - this.start);
405
- i > 0 && (this.nextStage(r), s = i);
406
- }
407
- }
408
- return s || (s = Z(e, this.pos)), s > 0 && s < e.length ? s : -1;
409
- } else
410
- return Z(e, this.pos);
411
- }
412
- }
413
- }
414
- function Z(t, e) {
415
- for (; e < t.length; e++) {
416
- let n = t.charCodeAt(e);
417
- if (n == 10)
418
- break;
419
- if (!w(n))
420
- return -1;
421
- }
422
- return e;
423
- }
424
- class yt {
425
- nextLine(e, n, s) {
426
- let r = n.depth < e.stack.length ? -1 : Ne(n), i = n.next;
427
- if (r < 0)
428
- return !1;
429
- let o = k(u.HeaderMark, e.lineStart + n.pos, e.lineStart + r);
430
- return e.nextLine(), e.addLeafElement(s, k(i == 61 ? u.SetextHeading1 : u.SetextHeading2, s.start, e.prevLineEnd(), [
431
- ...e.parser.parseInline(s.content, s.start),
432
- o
433
- ])), !0;
434
- }
435
- finish() {
436
- return !1;
437
- }
438
- }
439
- const Xe = {
440
- LinkReference(t, e) {
441
- return e.content.charCodeAt(0) == 91 ? new wt(e) : null;
442
- },
443
- SetextHeading() {
444
- return new yt();
445
- }
446
- }, At = [
447
- (t, e) => Pe(e) >= 0,
448
- (t, e) => Me(e) >= 0,
449
- (t, e) => ve(e) >= 0,
450
- (t, e) => ie(e, t, !0) >= 0,
451
- (t, e) => oe(e, t, !0) >= 0,
452
- (t, e) => re(e, t, !0) >= 0,
453
- (t, e) => $e(e, t, !0) >= 0
454
- ], It = { text: "", end: 0 };
455
- class Tt {
456
- /**
457
- @internal
458
- */
459
- constructor(e, n, s, r) {
460
- this.parser = e, this.input = n, this.ranges = r, this.line = new Ct(), this.atEnd = !1, this.reusePlaceholders = /* @__PURE__ */ new Map(), this.stoppedAt = null, this.rangeI = 0, this.to = r[r.length - 1].to, this.lineStart = this.absoluteLineStart = this.absoluteLineEnd = r[0].from, this.block = j.create(u.Document, 0, this.lineStart, 0, 0), this.stack = [this.block], this.fragments = s.length ? new Mt(s, n) : null, this.readLine();
461
- }
462
- get parsedPos() {
463
- return this.absoluteLineStart;
464
- }
465
- advance() {
466
- if (this.stoppedAt != null && this.absoluteLineStart > this.stoppedAt)
467
- return this.finish();
468
- let { line: e } = this;
469
- for (; ; ) {
470
- for (let s = 0; ; ) {
471
- let r = e.depth < this.stack.length ? this.stack[this.stack.length - 1] : null;
472
- for (; s < e.markers.length && (!r || e.markers[s].from < r.end); ) {
473
- let i = e.markers[s++];
474
- this.addNode(i.type, i.from, i.to);
475
- }
476
- if (!r)
477
- break;
478
- this.finishContext();
479
- }
480
- if (e.pos < e.text.length)
481
- break;
482
- if (!this.nextLine())
483
- return this.finish();
484
- }
485
- if (this.fragments && this.reuseFragment(e.basePos))
486
- return null;
487
- e: for (; ; ) {
488
- for (let s of this.parser.blockParsers)
489
- if (s) {
490
- let r = s(this, e);
491
- if (r != !1) {
492
- if (r == !0)
493
- return null;
494
- e.forward();
495
- continue e;
496
- }
497
- }
498
- break;
499
- }
500
- let n = new St(this.lineStart + e.pos, e.text.slice(e.pos));
501
- for (let s of this.parser.leafBlockParsers)
502
- if (s) {
503
- let r = s(this, n);
504
- r && n.parsers.push(r);
505
- }
506
- e: for (; this.nextLine() && e.pos != e.text.length; ) {
507
- if (e.indent < e.baseIndent + 4) {
508
- for (let s of this.parser.endLeafBlock)
509
- if (s(this, e, n))
510
- break e;
511
- }
512
- for (let s of n.parsers)
513
- if (s.nextLine(this, e, n))
514
- return null;
515
- n.content += `
516
- ` + e.scrub();
517
- for (let s of e.markers)
518
- n.marks.push(s);
519
- }
520
- return this.finishLeaf(n), null;
521
- }
522
- stopAt(e) {
523
- if (this.stoppedAt != null && this.stoppedAt < e)
524
- throw new RangeError("Can't move stoppedAt forward");
525
- this.stoppedAt = e;
526
- }
527
- reuseFragment(e) {
528
- if (!this.fragments.moveTo(this.absoluteLineStart + e, this.absoluteLineStart) || !this.fragments.matches(this.block.hash))
529
- return !1;
530
- let n = this.fragments.takeNodes(this);
531
- return n ? (this.absoluteLineStart += n, this.lineStart = Ze(this.absoluteLineStart, this.ranges), this.moveRangeI(), this.absoluteLineStart < this.to ? (this.lineStart++, this.absoluteLineStart++, this.readLine()) : (this.atEnd = !0, this.readLine()), !0) : !1;
532
- }
533
- /**
534
- The number of parent blocks surrounding the current block.
535
- */
536
- get depth() {
537
- return this.stack.length;
538
- }
539
- /**
540
- Get the type of the parent block at the given depth. When no
541
- depth is passed, return the type of the innermost parent.
542
- */
543
- parentType(e = this.depth - 1) {
544
- return this.parser.nodeSet.types[this.stack[e].type];
545
- }
546
- /**
547
- Move to the next input line. This should only be called by
548
- (non-composite) [block parsers](#BlockParser.parse) that consume
549
- the line directly, or leaf block parser
550
- [`nextLine`](#LeafBlockParser.nextLine) methods when they
551
- consume the current line (and return true).
552
- */
553
- nextLine() {
554
- return this.lineStart += this.line.text.length, this.absoluteLineEnd >= this.to ? (this.absoluteLineStart = this.absoluteLineEnd, this.atEnd = !0, this.readLine(), !1) : (this.lineStart++, this.absoluteLineStart = this.absoluteLineEnd + 1, this.moveRangeI(), this.readLine(), !0);
555
- }
556
- /**
557
- Retrieve the text of the line after the current one, without
558
- actually moving the context's current line forward.
559
- */
560
- peekLine() {
561
- return this.scanLine(this.absoluteLineEnd + 1).text;
562
- }
563
- moveRangeI() {
564
- for (; this.rangeI < this.ranges.length - 1 && this.absoluteLineStart >= this.ranges[this.rangeI].to; )
565
- this.rangeI++, this.absoluteLineStart = Math.max(this.absoluteLineStart, this.ranges[this.rangeI].from);
566
- }
567
- /**
568
- @internal
569
- Collect the text for the next line.
570
- */
571
- scanLine(e) {
572
- let n = It;
573
- if (n.end = e, e >= this.to)
574
- n.text = "";
575
- else if (n.text = this.lineChunkAt(e), n.end += n.text.length, this.ranges.length > 1) {
576
- let s = this.absoluteLineStart, r = this.rangeI;
577
- for (; this.ranges[r].to < n.end; ) {
578
- r++;
579
- let i = this.ranges[r].from, o = this.lineChunkAt(i);
580
- n.end = i + o.length, n.text = n.text.slice(0, this.ranges[r - 1].to - s) + o, s = n.end - n.text.length;
581
- }
582
- }
583
- return n;
584
- }
585
- /**
586
- @internal
587
- Populate this.line with the content of the next line. Skip
588
- leading characters covered by composite blocks.
589
- */
590
- readLine() {
591
- let { line: e } = this, { text: n, end: s } = this.scanLine(this.absoluteLineStart);
592
- for (this.absoluteLineEnd = s, e.reset(n); e.depth < this.stack.length; e.depth++) {
593
- let r = this.stack[e.depth], i = this.parser.skipContextMarkup[r.type];
594
- if (!i)
595
- throw new Error("Unhandled block context " + u[r.type]);
596
- let o = this.line.markers.length;
597
- if (!i(r, this, e)) {
598
- this.line.markers.length > o && (r.end = this.line.markers[this.line.markers.length - 1].to), e.forward();
599
- break;
600
- }
601
- e.forward();
602
- }
603
- }
604
- lineChunkAt(e) {
605
- let n = this.input.chunk(e), s;
606
- if (this.input.lineChunks)
607
- s = n == `
608
- ` ? "" : n;
609
- else {
610
- let r = n.indexOf(`
611
- `);
612
- s = r < 0 ? n : n.slice(0, r);
613
- }
614
- return e + s.length > this.to ? s.slice(0, this.to - e) : s;
615
- }
616
- /**
617
- The end position of the previous line.
618
- */
619
- prevLineEnd() {
620
- return this.atEnd ? this.lineStart : this.lineStart - 1;
621
- }
622
- /**
623
- @internal
624
- */
625
- startContext(e, n, s = 0) {
626
- this.block = j.create(e, s, this.lineStart + n, this.block.hash, this.lineStart + this.line.text.length), this.stack.push(this.block);
627
- }
628
- /**
629
- Start a composite block. Should only be called from [block
630
- parser functions](#BlockParser.parse) that return null.
631
- */
632
- startComposite(e, n, s = 0) {
633
- this.startContext(this.parser.getNodeType(e), n, s);
634
- }
635
- /**
636
- @internal
637
- */
638
- addNode(e, n, s) {
639
- typeof e == "number" && (e = new E(this.parser.nodeSet.types[e], H, H, (s ?? this.prevLineEnd()) - n)), this.block.addChild(e, n - this.block.from);
640
- }
641
- /**
642
- Add a block element. Can be called by [block
643
- parsers](#BlockParser.parse).
644
- */
645
- addElement(e) {
646
- this.block.addChild(e.toTree(this.parser.nodeSet), e.from - this.block.from);
647
- }
648
- /**
649
- Add a block element from a [leaf parser](#LeafBlockParser). This
650
- makes sure any extra composite block markup (such as blockquote
651
- markers) inside the block are also added to the syntax tree.
652
- */
653
- addLeafElement(e, n) {
654
- this.addNode(this.buffer.writeElements(ne(n.children, e.marks), -n.from).finish(n.type, n.to - n.from), n.from);
655
- }
656
- /**
657
- @internal
658
- */
659
- finishContext() {
660
- let e = this.stack.pop(), n = this.stack[this.stack.length - 1];
661
- n.addChild(e.toTree(this.parser.nodeSet), e.from - n.from), this.block = n;
662
- }
663
- finish() {
664
- for (; this.stack.length > 1; )
665
- this.finishContext();
666
- return this.addGaps(this.block.toTree(this.parser.nodeSet, this.lineStart));
667
- }
668
- addGaps(e) {
669
- return this.ranges.length > 1 ? ze(this.ranges, 0, e.topNode, this.ranges[0].from, this.reusePlaceholders) : e;
670
- }
671
- /**
672
- @internal
673
- */
674
- finishLeaf(e) {
675
- for (let s of e.parsers)
676
- if (s.finish(this, e))
677
- return;
678
- let n = ne(this.parser.parseInline(e.content, e.start), e.marks);
679
- this.addNode(this.buffer.writeElements(n, -e.start).finish(u.Paragraph, e.content.length), e.start);
680
- }
681
- elt(e, n, s, r) {
682
- return typeof e == "string" ? k(this.parser.getNodeType(e), n, s, r) : new Fe(e, n);
683
- }
684
- /**
685
- @internal
686
- */
687
- get buffer() {
688
- return new qe(this.parser.nodeSet);
689
- }
690
- }
691
- function ze(t, e, n, s, r) {
692
- let i = t[e].to, o = [], a = [], l = n.from + s;
693
- function h(f, d) {
694
- for (; d ? f >= i : f > i; ) {
695
- let c = t[e + 1].from - i;
696
- s += c, f += c, e++, i = t[e].to;
697
- }
698
- }
699
- for (let f = n.firstChild; f; f = f.nextSibling) {
700
- h(f.from + s, !0);
701
- let d = f.from + s, c, p = r.get(f.tree);
702
- p ? c = p : f.to + s > i ? (c = ze(t, e, f, s, r), h(f.to + s, !1)) : c = f.toTree(), o.push(c), a.push(d - l);
703
- }
704
- return h(n.to + s, !1), new E(n.type, o, a, n.to + s - l, n.tree ? n.tree.propValues : void 0);
705
- }
706
- class V extends ft {
707
- /**
708
- @internal
709
- */
710
- constructor(e, n, s, r, i, o, a, l, h) {
711
- super(), this.nodeSet = e, this.blockParsers = n, this.leafBlockParsers = s, this.blockNames = r, this.endLeafBlock = i, this.skipContextMarkup = o, this.inlineParsers = a, this.inlineNames = l, this.wrappers = h, this.nodeTypes = /* @__PURE__ */ Object.create(null);
712
- for (let f of e.types)
713
- this.nodeTypes[f.name] = f.id;
714
- }
715
- createParse(e, n, s) {
716
- let r = new Tt(this, e, n, s);
717
- for (let i of this.wrappers)
718
- r = i(r, e, n, s);
719
- return r;
720
- }
721
- /**
722
- Reconfigure the parser.
723
- */
724
- configure(e) {
725
- let n = te(e);
726
- if (!n)
727
- return this;
728
- let { nodeSet: s, skipContextMarkup: r } = this, i = this.blockParsers.slice(), o = this.leafBlockParsers.slice(), a = this.blockNames.slice(), l = this.inlineParsers.slice(), h = this.inlineNames.slice(), f = this.endLeafBlock.slice(), d = this.wrappers;
729
- if (N(n.defineNodes)) {
730
- r = Object.assign({}, r);
731
- let c = s.types.slice(), p;
732
- for (let m of n.defineNodes) {
733
- let { name: S, block: A, composite: L, style: b } = typeof m == "string" ? { name: m } : m;
734
- if (c.some((T) => T.name == S))
735
- continue;
736
- L && (r[c.length] = (T, P, st) => L(P, st, T.value));
737
- let x = c.length, I = L ? ["Block", "BlockContext"] : A ? x >= u.ATXHeading1 && x <= u.SetextHeading2 ? ["Block", "LeafBlock", "Heading"] : ["Block", "LeafBlock"] : void 0;
738
- c.push(Q.define({
739
- id: x,
740
- name: S,
741
- props: I && [[v.group, I]]
742
- })), b && (p || (p = {}), Array.isArray(b) || b instanceof ut ? p[S] = b : Object.assign(p, b));
743
- }
744
- s = new Ie(c), p && (s = s.extend(Te(p)));
745
- }
746
- if (N(n.props) && (s = s.extend(...n.props)), N(n.remove))
747
- for (let c of n.remove) {
748
- let p = this.blockNames.indexOf(c), m = this.inlineNames.indexOf(c);
749
- p > -1 && (i[p] = o[p] = void 0), m > -1 && (l[m] = void 0);
750
- }
751
- if (N(n.parseBlock))
752
- for (let c of n.parseBlock) {
753
- let p = a.indexOf(c.name);
754
- if (p > -1)
755
- i[p] = c.parse, o[p] = c.leaf;
756
- else {
757
- let m = c.before ? F(a, c.before) : c.after ? F(a, c.after) + 1 : a.length - 1;
758
- i.splice(m, 0, c.parse), o.splice(m, 0, c.leaf), a.splice(m, 0, c.name);
759
- }
760
- c.endLeaf && f.push(c.endLeaf);
761
- }
762
- if (N(n.parseInline))
763
- for (let c of n.parseInline) {
764
- let p = h.indexOf(c.name);
765
- if (p > -1)
766
- l[p] = c.parse;
767
- else {
768
- let m = c.before ? F(h, c.before) : c.after ? F(h, c.after) + 1 : h.length - 1;
769
- l.splice(m, 0, c.parse), h.splice(m, 0, c.name);
770
- }
771
- }
772
- return n.wrap && (d = d.concat(n.wrap)), new V(s, i, o, a, f, r, l, h, d);
773
- }
774
- /**
775
- @internal
776
- */
777
- getNodeType(e) {
778
- let n = this.nodeTypes[e];
779
- if (n == null)
780
- throw new RangeError(`Unknown node type '${e}'`);
781
- return n;
782
- }
783
- /**
784
- Parse the given piece of inline text at the given offset,
785
- returning an array of [`Element`](#Element) objects representing
786
- the inline content.
787
- */
788
- parseInline(e, n) {
789
- let s = new ae(this, e, n);
790
- e: for (let r = n; r < s.end; ) {
791
- let i = s.char(r);
792
- for (let o of this.inlineParsers)
793
- if (o) {
794
- let a = o(s, i, r);
795
- if (a >= 0) {
796
- r = a;
797
- continue e;
798
- }
799
- }
800
- r++;
801
- }
802
- return s.resolveMarkers(0);
803
- }
804
- }
805
- function N(t) {
806
- return t != null && t.length > 0;
807
- }
808
- function te(t) {
809
- if (!Array.isArray(t))
810
- return t;
811
- if (t.length == 0)
812
- return null;
813
- let e = te(t[0]);
814
- if (t.length == 1)
815
- return e;
816
- let n = te(t.slice(1));
817
- if (!n || !e)
818
- return e || n;
819
- let s = (o, a) => (o || H).concat(a || H), r = e.wrap, i = n.wrap;
820
- return {
821
- props: s(e.props, n.props),
822
- defineNodes: s(e.defineNodes, n.defineNodes),
823
- parseBlock: s(e.parseBlock, n.parseBlock),
824
- parseInline: s(e.parseInline, n.parseInline),
825
- remove: s(e.remove, n.remove),
826
- wrap: r ? i ? (o, a, l, h) => r(i(o, a, l, h), a, l, h) : r : i
827
- };
828
- }
829
- function F(t, e) {
830
- let n = t.indexOf(e);
831
- if (n < 0)
832
- throw new RangeError(`Position specified relative to unknown parser ${e}`);
833
- return n;
834
- }
835
- let De = [Q.none];
836
- for (let t = 1, e; e = u[t]; t++)
837
- De[t] = Q.define({
838
- id: t,
839
- name: e,
840
- props: t >= u.Escape ? [] : [[v.group, t in Ee ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]],
841
- top: e == "Document"
842
- });
843
- const H = [];
844
- class qe {
845
- constructor(e) {
846
- this.nodeSet = e, this.content = [], this.nodes = [];
847
- }
848
- write(e, n, s, r = 0) {
849
- return this.content.push(e, n, s, 4 + r * 4), this;
850
- }
851
- writeElements(e, n = 0) {
852
- for (let s of e)
853
- s.writeTo(this, n);
854
- return this;
855
- }
856
- finish(e, n) {
857
- return E.build({
858
- buffer: this.content,
859
- nodeSet: this.nodeSet,
860
- reused: this.nodes,
861
- topID: e,
862
- length: n
863
- });
864
- }
865
- }
866
- class X {
867
- /**
868
- @internal
869
- */
870
- constructor(e, n, s, r = H) {
871
- this.type = e, this.from = n, this.to = s, this.children = r;
872
- }
873
- /**
874
- @internal
875
- */
876
- writeTo(e, n) {
877
- let s = e.content.length;
878
- e.writeElements(this.children, n), e.content.push(this.type, this.from + n, this.to + n, e.content.length + 4 - s);
879
- }
880
- /**
881
- @internal
882
- */
883
- toTree(e) {
884
- return new qe(e).writeElements(this.children, -this.from).finish(this.type, this.to - this.from);
885
- }
886
- }
887
- class Fe {
888
- constructor(e, n) {
889
- this.tree = e, this.from = n;
890
- }
891
- get to() {
892
- return this.from + this.tree.length;
893
- }
894
- get type() {
895
- return this.tree.type.id;
896
- }
897
- get children() {
898
- return H;
899
- }
900
- writeTo(e, n) {
901
- e.nodes.push(this.tree), e.content.push(e.nodes.length - 1, this.from + n, this.to + n, -1);
902
- }
903
- toTree() {
904
- return this.tree;
905
- }
906
- }
907
- function k(t, e, n, s) {
908
- return new X(t, e, n, s);
909
- }
910
- const je = { resolve: "Emphasis", mark: "EmphasisMark" }, Ue = { resolve: "Emphasis", mark: "EmphasisMark" }, B = {}, U = {};
911
- class C {
912
- constructor(e, n, s, r) {
913
- this.type = e, this.from = n, this.to = s, this.side = r;
914
- }
915
- }
916
- const me = "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~";
917
- let z = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\u2010-\u2027]/;
918
- try {
919
- z = new RegExp("[\\p{S}|\\p{P}]", "u");
920
- } catch {
921
- }
922
- const G = {
923
- Escape(t, e, n) {
924
- if (e != 92 || n == t.end - 1)
925
- return -1;
926
- let s = t.char(n + 1);
927
- for (let r = 0; r < me.length; r++)
928
- if (me.charCodeAt(r) == s)
929
- return t.append(k(u.Escape, n, n + 2));
930
- return -1;
931
- },
932
- Entity(t, e, n) {
933
- if (e != 38)
934
- return -1;
935
- let s = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(t.slice(n + 1, n + 31));
936
- return s ? t.append(k(u.Entity, n, n + 1 + s[0].length)) : -1;
937
- },
938
- InlineCode(t, e, n) {
939
- if (e != 96 || n && t.char(n - 1) == 96)
940
- return -1;
941
- let s = n + 1;
942
- for (; s < t.end && t.char(s) == 96; )
943
- s++;
944
- let r = s - n, i = 0;
945
- for (; s < t.end; s++)
946
- if (t.char(s) == 96) {
947
- if (i++, i == r && t.char(s + 1) != 96)
948
- return t.append(k(u.InlineCode, n, s + 1, [
949
- k(u.CodeMark, n, n + r),
950
- k(u.CodeMark, s + 1 - r, s + 1)
951
- ]));
952
- } else
953
- i = 0;
954
- return -1;
955
- },
956
- HTMLTag(t, e, n) {
957
- if (e != 60 || n == t.end - 1)
958
- return -1;
959
- let s = t.slice(n + 1, t.end), r = /^(?:[a-z][-\w+.]+:[^\s>]+|[a-z\d.!#$%&'*+/=?^_`{|}~-]+@[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?(?:\.[a-z\d](?:[a-z\d-]{0,61}[a-z\d])?)*)>/i.exec(s);
960
- if (r)
961
- return t.append(k(u.Autolink, n, n + 1 + r[0].length, [
962
- k(u.LinkMark, n, n + 1),
963
- // url[0] includes the closing bracket, so exclude it from this slice
964
- k(u.URL, n + 1, n + r[0].length),
965
- k(u.LinkMark, n + r[0].length, n + 1 + r[0].length)
966
- ]));
967
- let i = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(s);
968
- if (i)
969
- return t.append(k(u.Comment, n, n + 1 + i[0].length));
970
- let o = /^\?[^]*?\?>/.exec(s);
971
- if (o)
972
- return t.append(k(u.ProcessingInstruction, n, n + 1 + o[0].length));
973
- let a = /^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(s);
974
- return a ? t.append(k(u.HTMLTag, n, n + 1 + a[0].length)) : -1;
975
- },
976
- Emphasis(t, e, n) {
977
- if (e != 95 && e != 42)
978
- return -1;
979
- let s = n + 1;
980
- for (; t.char(s) == e; )
981
- s++;
982
- let r = t.slice(n - 1, n), i = t.slice(s, s + 1), o = z.test(r), a = z.test(i), l = /\s|^$/.test(r), h = /\s|^$/.test(i), f = !h && (!a || l || o), d = !l && (!o || h || a), c = f && (e == 42 || !d || o), p = d && (e == 42 || !f || a);
983
- return t.append(new C(e == 95 ? je : Ue, n, s, (c ? 1 : 0) | (p ? 2 : 0)));
984
- },
985
- HardBreak(t, e, n) {
986
- if (e == 92 && t.char(n + 1) == 10)
987
- return t.append(k(u.HardBreak, n, n + 2));
988
- if (e == 32) {
989
- let s = n + 1;
990
- for (; t.char(s) == 32; )
991
- s++;
992
- if (t.char(s) == 10 && s >= n + 2)
993
- return t.append(k(u.HardBreak, n, s + 1));
994
- }
995
- return -1;
996
- },
997
- Link(t, e, n) {
998
- return e == 91 ? t.append(new C(
999
- B,
1000
- n,
1001
- n + 1,
1002
- 1
1003
- /* Mark.Open */
1004
- )) : -1;
1005
- },
1006
- Image(t, e, n) {
1007
- return e == 33 && t.char(n + 1) == 91 ? t.append(new C(
1008
- U,
1009
- n,
1010
- n + 2,
1011
- 1
1012
- /* Mark.Open */
1013
- )) : -1;
1014
- },
1015
- LinkEnd(t, e, n) {
1016
- if (e != 93)
1017
- return -1;
1018
- for (let s = t.parts.length - 1; s >= 0; s--) {
1019
- let r = t.parts[s];
1020
- if (r instanceof C && (r.type == B || r.type == U)) {
1021
- if (!r.side || t.skipSpace(r.to) == n && !/[(\[]/.test(t.slice(n + 1, n + 2)))
1022
- return t.parts[s] = null, -1;
1023
- let i = t.takeContent(s), o = t.parts[s] = Bt(t, i, r.type == B ? u.Link : u.Image, r.from, n + 1);
1024
- if (r.type == B)
1025
- for (let a = 0; a < s; a++) {
1026
- let l = t.parts[a];
1027
- l instanceof C && l.type == B && (l.side = 0);
1028
- }
1029
- return o.to;
1030
- }
1031
- }
1032
- return -1;
1033
- }
1034
- };
1035
- function Bt(t, e, n, s, r) {
1036
- let { text: i } = t, o = t.char(r), a = r;
1037
- if (e.unshift(k(u.LinkMark, s, s + (n == u.Image ? 2 : 1))), e.push(k(u.LinkMark, r - 1, r)), o == 40) {
1038
- let l = t.skipSpace(r + 1), h = _e(i, l - t.offset, t.offset), f;
1039
- h && (l = t.skipSpace(h.to), l != h.to && (f = Qe(i, l - t.offset, t.offset), f && (l = t.skipSpace(f.to)))), t.char(l) == 41 && (e.push(k(u.LinkMark, r, r + 1)), a = l + 1, h && e.push(h), f && e.push(f), e.push(k(u.LinkMark, l, a)));
1040
- } else if (o == 91) {
1041
- let l = Ve(i, r - t.offset, t.offset, !1);
1042
- l && (e.push(l), a = l.to);
1043
- }
1044
- return k(n, s, a, e);
1045
- }
1046
- function _e(t, e, n) {
1047
- if (t.charCodeAt(e) == 60) {
1048
- for (let s = e + 1; s < t.length; s++) {
1049
- let r = t.charCodeAt(s);
1050
- if (r == 62)
1051
- return k(u.URL, e + n, s + 1 + n);
1052
- if (r == 60 || r == 10)
1053
- return !1;
1054
- }
1055
- return null;
1056
- } else {
1057
- let s = 0, r = e;
1058
- for (let i = !1; r < t.length; r++) {
1059
- let o = t.charCodeAt(r);
1060
- if (w(o))
1061
- break;
1062
- if (i)
1063
- i = !1;
1064
- else if (o == 40)
1065
- s++;
1066
- else if (o == 41) {
1067
- if (!s)
1068
- break;
1069
- s--;
1070
- } else o == 92 && (i = !0);
1071
- }
1072
- return r > e ? k(u.URL, e + n, r + n) : r == t.length ? null : !1;
1073
- }
1074
- }
1075
- function Qe(t, e, n) {
1076
- let s = t.charCodeAt(e);
1077
- if (s != 39 && s != 34 && s != 40)
1078
- return !1;
1079
- let r = s == 40 ? 41 : s;
1080
- for (let i = e + 1, o = !1; i < t.length; i++) {
1081
- let a = t.charCodeAt(i);
1082
- if (o)
1083
- o = !1;
1084
- else {
1085
- if (a == r)
1086
- return k(u.LinkTitle, e + n, i + 1 + n);
1087
- a == 92 && (o = !0);
1088
- }
1089
- }
1090
- return null;
1091
- }
1092
- function Ve(t, e, n, s) {
1093
- for (let r = !1, i = e + 1, o = Math.min(t.length, i + 999); i < o; i++) {
1094
- let a = t.charCodeAt(i);
1095
- if (r)
1096
- r = !1;
1097
- else {
1098
- if (a == 93)
1099
- return s ? !1 : k(u.LinkLabel, e + n, i + 1 + n);
1100
- if (s && !w(a) && (s = !1), a == 91)
1101
- return !1;
1102
- a == 92 && (r = !0);
1103
- }
1104
- }
1105
- return null;
1106
- }
1107
- class ae {
1108
- /**
1109
- @internal
1110
- */
1111
- constructor(e, n, s) {
1112
- this.parser = e, this.text = n, this.offset = s, this.parts = [];
1113
- }
1114
- /**
1115
- Get the character code at the given (document-relative)
1116
- position.
1117
- */
1118
- char(e) {
1119
- return e >= this.end ? -1 : this.text.charCodeAt(e - this.offset);
1120
- }
1121
- /**
1122
- The position of the end of this inline section.
1123
- */
1124
- get end() {
1125
- return this.offset + this.text.length;
1126
- }
1127
- /**
1128
- Get a substring of this inline section. Again uses
1129
- document-relative positions.
1130
- */
1131
- slice(e, n) {
1132
- return this.text.slice(e - this.offset, n - this.offset);
1133
- }
1134
- /**
1135
- @internal
1136
- */
1137
- append(e) {
1138
- return this.parts.push(e), e.to;
1139
- }
1140
- /**
1141
- Add a [delimiter](#DelimiterType) at this given position. `open`
1142
- and `close` indicate whether this delimiter is opening, closing,
1143
- or both. Returns the end of the delimiter, for convenient
1144
- returning from [parse functions](#InlineParser.parse).
1145
- */
1146
- addDelimiter(e, n, s, r, i) {
1147
- return this.append(new C(e, n, s, (r ? 1 : 0) | (i ? 2 : 0)));
1148
- }
1149
- /**
1150
- Returns true when there is an unmatched link or image opening
1151
- token before the current position.
1152
- */
1153
- get hasOpenLink() {
1154
- for (let e = this.parts.length - 1; e >= 0; e--) {
1155
- let n = this.parts[e];
1156
- if (n instanceof C && (n.type == B || n.type == U))
1157
- return !0;
1158
- }
1159
- return !1;
1160
- }
1161
- /**
1162
- Add an inline element. Returns the end of the element.
1163
- */
1164
- addElement(e) {
1165
- return this.append(e);
1166
- }
1167
- /**
1168
- Resolve markers between this.parts.length and from, wrapping matched markers in the
1169
- appropriate node and updating the content of this.parts. @internal
1170
- */
1171
- resolveMarkers(e) {
1172
- for (let s = e; s < this.parts.length; s++) {
1173
- let r = this.parts[s];
1174
- if (!(r instanceof C && r.type.resolve && r.side & 2))
1175
- continue;
1176
- let i = r.type == je || r.type == Ue, o = r.to - r.from, a, l = s - 1;
1177
- for (; l >= e; l--) {
1178
- let m = this.parts[l];
1179
- if (m instanceof C && m.side & 1 && m.type == r.type && // Ignore emphasis delimiters where the character count doesn't match
1180
- !(i && (r.side & 1 || m.side & 2) && (m.to - m.from + o) % 3 == 0 && ((m.to - m.from) % 3 || o % 3))) {
1181
- a = m;
1182
- break;
1183
- }
1184
- }
1185
- if (!a)
1186
- continue;
1187
- let h = r.type.resolve, f = [], d = a.from, c = r.to;
1188
- if (i) {
1189
- let m = Math.min(2, a.to - a.from, o);
1190
- d = a.to - m, c = r.from + m, h = m == 1 ? "Emphasis" : "StrongEmphasis";
1191
- }
1192
- a.type.mark && f.push(this.elt(a.type.mark, d, a.to));
1193
- for (let m = l + 1; m < s; m++)
1194
- this.parts[m] instanceof X && f.push(this.parts[m]), this.parts[m] = null;
1195
- r.type.mark && f.push(this.elt(r.type.mark, r.from, c));
1196
- let p = this.elt(h, d, c, f);
1197
- this.parts[l] = i && a.from != d ? new C(a.type, a.from, d, a.side) : null, (this.parts[s] = i && r.to != c ? new C(r.type, c, r.to, r.side) : null) ? this.parts.splice(s, 0, p) : this.parts[s] = p;
1198
- }
1199
- let n = [];
1200
- for (let s = e; s < this.parts.length; s++) {
1201
- let r = this.parts[s];
1202
- r instanceof X && n.push(r);
1203
- }
1204
- return n;
1205
- }
1206
- /**
1207
- Find an opening delimiter of the given type. Returns `null` if
1208
- no delimiter is found, or an index that can be passed to
1209
- [`takeContent`](#InlineContext.takeContent) otherwise.
1210
- */
1211
- findOpeningDelimiter(e) {
1212
- for (let n = this.parts.length - 1; n >= 0; n--) {
1213
- let s = this.parts[n];
1214
- if (s instanceof C && s.type == e && s.side & 1)
1215
- return n;
1216
- }
1217
- return null;
1218
- }
1219
- /**
1220
- Remove all inline elements and delimiters starting from the
1221
- given index (which you should get from
1222
- [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter),
1223
- resolve delimiters inside of them, and return them as an array
1224
- of elements.
1225
- */
1226
- takeContent(e) {
1227
- let n = this.resolveMarkers(e);
1228
- return this.parts.length = e, n;
1229
- }
1230
- /**
1231
- Return the delimiter at the given index. Mostly useful to get
1232
- additional info out of a delimiter index returned by
1233
- [`findOpeningDelimiter`](#InlineContext.findOpeningDelimiter).
1234
- Returns null if there is no delimiter at this index.
1235
- */
1236
- getDelimiterAt(e) {
1237
- let n = this.parts[e];
1238
- return n instanceof C ? n : null;
1239
- }
1240
- /**
1241
- Skip space after the given (document) position, returning either
1242
- the position of the next non-space character or the end of the
1243
- section.
1244
- */
1245
- skipSpace(e) {
1246
- return O(this.text, e - this.offset) + this.offset;
1247
- }
1248
- elt(e, n, s, r) {
1249
- return typeof e == "string" ? k(this.parser.getNodeType(e), n, s, r) : new Fe(e, n);
1250
- }
1251
- }
1252
- ae.linkStart = B;
1253
- ae.imageStart = U;
1254
- function ne(t, e) {
1255
- if (!e.length)
1256
- return t;
1257
- if (!t.length)
1258
- return e;
1259
- let n = t.slice(), s = 0;
1260
- for (let r of e) {
1261
- for (; s < n.length && n[s].to < r.to; )
1262
- s++;
1263
- if (s < n.length && n[s].from < r.from) {
1264
- let i = n[s];
1265
- i instanceof X && (n[s] = new X(i.type, i.from, i.to, ne(i.children, [r])));
1266
- } else
1267
- n.splice(s++, 0, r);
1268
- }
1269
- return n;
1270
- }
1271
- const Et = [u.CodeBlock, u.ListItem, u.OrderedList, u.BulletList];
1272
- class Mt {
1273
- constructor(e, n) {
1274
- this.fragments = e, this.input = n, this.i = 0, this.fragment = null, this.fragmentEnd = -1, this.cursor = null, e.length && (this.fragment = e[this.i++]);
1275
- }
1276
- nextFragment() {
1277
- this.fragment = this.i < this.fragments.length ? this.fragments[this.i++] : null, this.cursor = null, this.fragmentEnd = -1;
1278
- }
1279
- moveTo(e, n) {
1280
- for (; this.fragment && this.fragment.to <= e; )
1281
- this.nextFragment();
1282
- if (!this.fragment || this.fragment.from > (e ? e - 1 : 0))
1283
- return !1;
1284
- if (this.fragmentEnd < 0) {
1285
- let i = this.fragment.to;
1286
- for (; i > 0 && this.input.read(i - 1, i) != `
1287
- `; )
1288
- i--;
1289
- this.fragmentEnd = i ? i - 1 : 0;
1290
- }
1291
- let s = this.cursor;
1292
- s || (s = this.cursor = this.fragment.tree.cursor(), s.firstChild());
1293
- let r = e + this.fragment.offset;
1294
- for (; s.to <= r; )
1295
- if (!s.parent())
1296
- return !1;
1297
- for (; ; ) {
1298
- if (s.from >= r)
1299
- return this.fragment.from <= n;
1300
- if (!s.childAfter(r))
1301
- return !1;
1302
- }
1303
- }
1304
- matches(e) {
1305
- let n = this.cursor.tree;
1306
- return n && n.prop(v.contextHash) == e;
1307
- }
1308
- takeNodes(e) {
1309
- let n = this.cursor, s = this.fragment.offset, r = this.fragmentEnd - (this.fragment.openEnd ? 1 : 0), i = e.absoluteLineStart, o = i, a = e.block.children.length, l = o, h = a;
1310
- for (; ; ) {
1311
- if (n.to - s > r) {
1312
- if (n.type.isAnonymous && n.firstChild())
1313
- continue;
1314
- break;
1315
- }
1316
- let f = Ze(n.from - s, e.ranges);
1317
- if (n.to - s <= e.ranges[e.rangeI].to)
1318
- e.addNode(n.tree, f);
1319
- else {
1320
- let d = new E(e.parser.nodeSet.types[u.Paragraph], [], [], 0, e.block.hashProp);
1321
- e.reusePlaceholders.set(d, n.tree), e.addNode(d, f);
1322
- }
1323
- if (n.type.is("Block") && (Et.indexOf(n.type.id) < 0 ? (o = n.to - s, a = e.block.children.length) : (o = l, a = h, l = n.to - s, h = e.block.children.length)), !n.nextSibling())
1324
- break;
1325
- }
1326
- for (; e.block.children.length > a; )
1327
- e.block.children.pop(), e.block.positions.pop();
1328
- return o - i;
1329
- }
1330
- }
1331
- function Ze(t, e) {
1332
- let n = t;
1333
- for (let s = 1; s < e.length; s++) {
1334
- let r = e[s - 1].to, i = e[s].from;
1335
- r < t && (n -= i - r);
1336
- }
1337
- return n;
1338
- }
1339
- const vt = Te({
1340
- "Blockquote/...": g.quote,
1341
- HorizontalRule: g.contentSeparator,
1342
- "ATXHeading1/... SetextHeading1/...": g.heading1,
1343
- "ATXHeading2/... SetextHeading2/...": g.heading2,
1344
- "ATXHeading3/...": g.heading3,
1345
- "ATXHeading4/...": g.heading4,
1346
- "ATXHeading5/...": g.heading5,
1347
- "ATXHeading6/...": g.heading6,
1348
- "Comment CommentBlock": g.comment,
1349
- Escape: g.escape,
1350
- Entity: g.character,
1351
- "Emphasis/...": g.emphasis,
1352
- "StrongEmphasis/...": g.strong,
1353
- "Link/... Image/...": g.link,
1354
- "OrderedList/... BulletList/...": g.list,
1355
- "BlockQuote/...": g.quote,
1356
- "InlineCode CodeText": g.monospace,
1357
- "URL Autolink": g.url,
1358
- "HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": g.processingInstruction,
1359
- "CodeInfo LinkLabel": g.labelName,
1360
- LinkTitle: g.string,
1361
- Paragraph: g.content
1362
- }), Ht = new V(new Ie(De).extend(vt), Object.keys(q).map((t) => q[t]), Object.keys(q).map((t) => Xe[t]), Object.keys(q), At, Ee, Object.keys(G).map((t) => G[t]), Object.keys(G), []);
1363
- function Pt(t, e, n) {
1364
- let s = [];
1365
- for (let r = t.firstChild, i = e; ; r = r.nextSibling) {
1366
- let o = r ? r.from : n;
1367
- if (o > i && s.push({ from: i, to: o }), !r)
1368
- break;
1369
- i = r.to;
1370
- }
1371
- return s;
1372
- }
1373
- function Nt(t) {
1374
- let { codeParser: e, htmlParser: n } = t;
1375
- return { wrap: ct((s, r) => {
1376
- let i = s.type.id;
1377
- if (e && (i == u.CodeBlock || i == u.FencedCode)) {
1378
- let o = "";
1379
- if (i == u.FencedCode) {
1380
- let l = s.node.getChild(u.CodeInfo);
1381
- l && (o = r.read(l.from, l.to));
1382
- }
1383
- let a = e(o);
1384
- if (a)
1385
- return { parser: a, overlay: (l) => l.type.id == u.CodeText, bracketed: i == u.FencedCode };
1386
- } else if (n && (i == u.HTMLBlock || i == u.HTMLTag || i == u.CommentBlock))
1387
- return { parser: n, overlay: Pt(s.node, s.from, s.to) };
1388
- return null;
1389
- }) };
1390
- }
1391
- const Ot = { resolve: "Strikethrough", mark: "StrikethroughMark" }, Rt = {
1392
- defineNodes: [{
1393
- name: "Strikethrough",
1394
- style: { "Strikethrough/...": g.strikethrough }
1395
- }, {
1396
- name: "StrikethroughMark",
1397
- style: g.processingInstruction
1398
- }],
1399
- parseInline: [{
1400
- name: "Strikethrough",
1401
- parse(t, e, n) {
1402
- if (e != 126 || t.char(n + 1) != 126 || t.char(n + 2) == 126)
1403
- return -1;
1404
- let s = t.slice(n - 1, n), r = t.slice(n + 2, n + 3), i = /\s|^$/.test(s), o = /\s|^$/.test(r), a = z.test(s), l = z.test(r);
1405
- return t.addDelimiter(Ot, n, n + 2, !o && (!l || i || a), !i && (!a || o || l));
1406
- },
1407
- after: "Emphasis"
1408
- }]
1409
- };
1410
- function R(t, e, n = 0, s, r = 0) {
1411
- let i = 0, o = !0, a = -1, l = -1, h = !1, f = () => {
1412
- s.push(t.elt("TableCell", r + a, r + l, t.parser.parseInline(e.slice(a, l), r + a)));
1413
- };
1414
- for (let d = n; d < e.length; d++) {
1415
- let c = e.charCodeAt(d);
1416
- c == 124 && !h ? ((!o || a > -1) && i++, o = !1, s && (a > -1 && f(), s.push(t.elt("TableDelimiter", d + r, d + r + 1))), a = l = -1) : (h || c != 32 && c != 9) && (a < 0 && (a = d), l = d + 1), h = !h && c == 92;
1417
- }
1418
- return a > -1 && (i++, s && f()), i;
1419
- }
1420
- function ge(t, e) {
1421
- for (let n = e; n < t.length; n++) {
1422
- let s = t.charCodeAt(n);
1423
- if (s == 124)
1424
- return !0;
1425
- s == 92 && n++;
1426
- }
1427
- return !1;
1428
- }
1429
- const Ge = /^\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/;
1430
- class ke {
1431
- constructor() {
1432
- this.rows = null;
1433
- }
1434
- nextLine(e, n, s) {
1435
- if (this.rows == null) {
1436
- this.rows = !1;
1437
- let r;
1438
- if ((n.next == 45 || n.next == 58 || n.next == 124) && Ge.test(r = n.text.slice(n.pos))) {
1439
- let i = [];
1440
- R(e, s.content, 0, i, s.start) == R(e, r, n.pos) && (this.rows = [
1441
- e.elt("TableHeader", s.start, s.start + s.content.length, i),
1442
- e.elt("TableDelimiter", e.lineStart + n.pos, e.lineStart + n.text.length)
1443
- ]);
1444
- }
1445
- } else if (this.rows) {
1446
- let r = [];
1447
- R(e, n.text, n.pos, r, e.lineStart), this.rows.push(e.elt("TableRow", e.lineStart + n.pos, e.lineStart + n.text.length, r));
1448
- }
1449
- return !1;
1450
- }
1451
- finish(e, n) {
1452
- return this.rows ? (e.addLeafElement(n, e.elt("Table", n.start, n.start + n.content.length, this.rows)), !0) : !1;
1453
- }
1454
- }
1455
- const $t = {
1456
- defineNodes: [
1457
- { name: "Table", block: !0 },
1458
- { name: "TableHeader", style: { "TableHeader/...": g.heading } },
1459
- "TableRow",
1460
- { name: "TableCell", style: g.content },
1461
- { name: "TableDelimiter", style: g.processingInstruction }
1462
- ],
1463
- parseBlock: [{
1464
- name: "Table",
1465
- leaf(t, e) {
1466
- return ge(e.content, 0) ? new ke() : null;
1467
- },
1468
- endLeaf(t, e, n) {
1469
- if (n.parsers.some((r) => r instanceof ke) || !ge(e.text, e.basePos))
1470
- return !1;
1471
- let s = t.peekLine();
1472
- return Ge.test(s) && R(t, e.text, e.basePos) == R(t, s, e.basePos);
1473
- },
1474
- before: "SetextHeading"
1475
- }]
1476
- };
1477
- class Xt {
1478
- nextLine() {
1479
- return !1;
1480
- }
1481
- finish(e, n) {
1482
- return e.addLeafElement(n, e.elt("Task", n.start, n.start + n.content.length, [
1483
- e.elt("TaskMarker", n.start, n.start + 3),
1484
- ...e.parser.parseInline(n.content.slice(3), n.start + 3)
1485
- ])), !0;
1486
- }
1487
- }
1488
- const zt = {
1489
- defineNodes: [
1490
- { name: "Task", block: !0, style: g.list },
1491
- { name: "TaskMarker", style: g.atom }
1492
- ],
1493
- parseBlock: [{
1494
- name: "TaskList",
1495
- leaf(t, e) {
1496
- return /^\[[ xX]\][ \t]/.test(e.content) && t.parentType().name == "ListItem" ? new Xt() : null;
1497
- },
1498
- after: "SetextHeading"
1499
- }]
1500
- }, xe = /(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy, Le = /[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy, Dt = /[\w-]+\.[\w-]+($|\/)/, be = /[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy, Se = /\/[a-zA-Z\d@.]+/gy;
1501
- function Ce(t, e, n, s) {
1502
- let r = 0;
1503
- for (let i = e; i < n; i++)
1504
- t[i] == s && r++;
1505
- return r;
1506
- }
1507
- function qt(t, e) {
1508
- Le.lastIndex = e;
1509
- let n = Le.exec(t);
1510
- if (!n || Dt.exec(n[0])[0].indexOf("_") > -1)
1511
- return -1;
1512
- let s = e + n[0].length;
1513
- for (; ; ) {
1514
- let r = t[s - 1], i;
1515
- if (/[?!.,:*_~]/.test(r) || r == ")" && Ce(t, e, s, ")") > Ce(t, e, s, "("))
1516
- s--;
1517
- else if (r == ";" && (i = /&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e, s))))
1518
- s = e + i.index;
1519
- else
1520
- break;
1521
- }
1522
- return s;
1523
- }
1524
- function we(t, e) {
1525
- be.lastIndex = e;
1526
- let n = be.exec(t);
1527
- if (!n)
1528
- return -1;
1529
- let s = n[0][n[0].length - 1];
1530
- return s == "_" || s == "-" ? -1 : e + n[0].length - (s == "." ? 1 : 0);
1531
- }
1532
- const Ft = {
1533
- parseInline: [{
1534
- name: "Autolink",
1535
- parse(t, e, n) {
1536
- let s = n - t.offset;
1537
- if (s && /\w/.test(t.text[s - 1]))
1538
- return -1;
1539
- xe.lastIndex = s;
1540
- let r = xe.exec(t.text), i = -1;
1541
- if (!r)
1542
- return -1;
1543
- if (r[1] || r[2]) {
1544
- if (i = qt(t.text, s + r[0].length), i > -1 && t.hasOpenLink) {
1545
- let o = /([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(s, i));
1546
- i = s + o[0].length;
1547
- }
1548
- } else r[3] ? i = we(t.text, s) : (i = we(t.text, s + r[0].length), i > -1 && r[0] == "xmpp:" && (Se.lastIndex = i, r = Se.exec(t.text), r && (i = r.index + r[0].length)));
1549
- return i < 0 ? -1 : (t.addElement(t.elt("URL", n, i + t.offset)), i + t.offset);
1550
- }
1551
- }]
1552
- }, jt = [$t, zt, Rt, Ft];
1553
- function Je(t, e, n) {
1554
- return (s, r, i) => {
1555
- if (r != t || s.char(i + 1) == t)
1556
- return -1;
1557
- let o = [s.elt(n, i, i + 1)];
1558
- for (let a = i + 1; a < s.end; a++) {
1559
- let l = s.char(a);
1560
- if (l == t)
1561
- return s.addElement(s.elt(e, i, a + 1, o.concat(s.elt(n, a, a + 1))));
1562
- if (l == 92 && o.push(s.elt("Escape", a, a++ + 2)), w(l))
1563
- break;
1564
- }
1565
- return -1;
1566
- };
1567
- }
1568
- const Ut = {
1569
- defineNodes: [
1570
- { name: "Superscript", style: g.special(g.content) },
1571
- { name: "SuperscriptMark", style: g.processingInstruction }
1572
- ],
1573
- parseInline: [{
1574
- name: "Superscript",
1575
- parse: Je(94, "Superscript", "SuperscriptMark")
1576
- }]
1577
- }, _t = {
1578
- defineNodes: [
1579
- { name: "Subscript", style: g.special(g.content) },
1580
- { name: "SubscriptMark", style: g.processingInstruction }
1581
- ],
1582
- parseInline: [{
1583
- name: "Subscript",
1584
- parse: Je(126, "Subscript", "SubscriptMark")
1585
- }]
1586
- }, Qt = {
1587
- defineNodes: [{ name: "Emoji", style: g.character }],
1588
- parseInline: [{
1589
- name: "Emoji",
1590
- parse(t, e, n) {
1591
- let s;
1592
- return e != 58 || !(s = /^[a-zA-Z_0-9]+:/.exec(t.slice(n + 1, t.end))) ? -1 : t.addElement(t.elt("Emoji", n, n + 1 + s[0].length));
1593
- }
1594
- }]
1595
- }, Ke = /* @__PURE__ */ ht({ commentTokens: { block: { open: "<!--", close: "-->" } } }), We = /* @__PURE__ */ new v(), Ye = /* @__PURE__ */ Ht.configure({
1596
- props: [
1597
- /* @__PURE__ */ Be.add((t) => !t.is("Block") || t.is("Document") || se(t) != null || Vt(t) ? void 0 : (e, n) => ({ from: n.doc.lineAt(e.from).to, to: e.to })),
1598
- /* @__PURE__ */ We.add(se),
1599
- /* @__PURE__ */ pt.add({
1600
- Document: () => null
1601
- }),
1602
- /* @__PURE__ */ mt.add({
1603
- Document: Ke
1604
- })
1605
- ]
1606
- });
1607
- function se(t) {
1608
- let e = /^(?:ATX|Setext)Heading(\d)$/.exec(t.name);
1609
- return e ? +e[1] : void 0;
1610
- }
1611
- function Vt(t) {
1612
- return t.name == "OrderedList" || t.name == "BulletList";
1613
- }
1614
- function Zt(t, e) {
1615
- let n = t;
1616
- for (; ; ) {
1617
- let s = n.nextSibling, r;
1618
- if (!s || (r = se(s.type)) != null && r <= e)
1619
- break;
1620
- n = s;
1621
- }
1622
- return n.to;
1623
- }
1624
- const Gt = /* @__PURE__ */ it.of((t, e, n) => {
1625
- for (let s = D(t).resolveInner(n, -1); s && !(s.from < e); s = s.parent) {
1626
- let r = s.type.prop(We);
1627
- if (r == null)
1628
- continue;
1629
- let i = Zt(s, r);
1630
- if (i > n)
1631
- return { from: n, to: i };
1632
- }
1633
- return null;
1634
- });
1635
- function le(t) {
1636
- return new lt(Ke, t, [], "markdown");
1637
- }
1638
- const Jt = /* @__PURE__ */ le(Ye), Kt = /* @__PURE__ */ Ye.configure([jt, _t, Ut, Qt, {
1639
- props: [
1640
- /* @__PURE__ */ Be.add({
1641
- Table: (t, e) => ({ from: e.doc.lineAt(t.from).to, to: t.to })
1642
- })
1643
- ]
1644
- }]), _ = /* @__PURE__ */ le(Kt);
1645
- function Wt(t, e) {
1646
- return (n) => {
1647
- if (n && t) {
1648
- let s = null;
1649
- if (n = /\S*/.exec(n)[0], typeof t == "function" ? s = t(n) : s = ue.matchLanguageName(t, n, !0), s instanceof ue)
1650
- return s.support ? s.support.language.parser : kt.getSkippingParser(s.load());
1651
- if (s)
1652
- return s.parser;
1653
- }
1654
- return e ? e.parser : null;
1655
- };
1656
- }
1657
- class J {
1658
- constructor(e, n, s, r, i, o, a) {
1659
- this.node = e, this.from = n, this.to = s, this.spaceBefore = r, this.spaceAfter = i, this.type = o, this.item = a;
1660
- }
1661
- blank(e, n = !0) {
1662
- let s = this.spaceBefore + (this.node.name == "Blockquote" ? ">" : "");
1663
- if (e != null) {
1664
- for (; s.length < e; )
1665
- s += " ";
1666
- return s;
1667
- } else {
1668
- for (let r = this.to - this.from - s.length - this.spaceAfter.length; r > 0; r--)
1669
- s += " ";
1670
- return s + (n ? this.spaceAfter : "");
1671
- }
1672
- }
1673
- marker(e, n) {
1674
- let s = this.node.name == "OrderedList" ? String(+tt(this.item, e)[2] + n) : "";
1675
- return this.spaceBefore + s + this.type + this.spaceAfter;
1676
- }
1677
- }
1678
- function et(t, e) {
1679
- let n = [], s = [];
1680
- for (let r = t; r; r = r.parent) {
1681
- if (r.name == "FencedCode")
1682
- return s;
1683
- (r.name == "ListItem" || r.name == "Blockquote") && n.push(r);
1684
- }
1685
- for (let r = n.length - 1; r >= 0; r--) {
1686
- let i = n[r], o, a = e.lineAt(i.from), l = i.from - a.from;
1687
- if (i.name == "Blockquote" && (o = /^ *>( ?)/.exec(a.text.slice(l))))
1688
- s.push(new J(i, l, l + o[0].length, "", o[1], ">", null));
1689
- else if (i.name == "ListItem" && i.parent.name == "OrderedList" && (o = /^( *)\d+([.)])( *)/.exec(a.text.slice(l)))) {
1690
- let h = o[3], f = o[0].length;
1691
- h.length >= 4 && (h = h.slice(0, h.length - 4), f -= 4), s.push(new J(i.parent, l, l + f, o[1], h, o[2], i));
1692
- } else if (i.name == "ListItem" && i.parent.name == "BulletList" && (o = /^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))) {
1693
- let h = o[4], f = o[0].length;
1694
- h.length > 4 && (h = h.slice(0, h.length - 4), f -= 4);
1695
- let d = o[2];
1696
- o[3] && (d += o[3].replace(/[xX]/, " ")), s.push(new J(i.parent, l, l + f, o[1], h, d, i));
1697
- }
1698
- }
1699
- return s;
1700
- }
1701
- function tt(t, e) {
1702
- return /^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from, t.from + 10));
1703
- }
1704
- function K(t, e, n, s = 0) {
1705
- for (let r = -1, i = t; ; ) {
1706
- if (i.name == "ListItem") {
1707
- let a = tt(i, e), l = +a[2];
1708
- if (r >= 0) {
1709
- if (l != r + 1)
1710
- return;
1711
- n.push({ from: i.from + a[1].length, to: i.from + a[0].length, insert: String(r + 2 + s) });
1712
- }
1713
- r = l;
1714
- }
1715
- let o = i.nextSibling;
1716
- if (!o)
1717
- break;
1718
- i = o;
1719
- }
1720
- }
1721
- function he(t, e) {
1722
- let n = /^[ \t]*/.exec(t)[0].length;
1723
- if (!n || e.facet(dt) != " ")
1724
- return t;
1725
- let s = $(t, 4, n), r = "";
1726
- for (let i = s; i > 0; )
1727
- i >= 4 ? (r += " ", i -= 4) : (r += " ", i--);
1728
- return r + t.slice(n);
1729
- }
1730
- const Yt = (t = {}) => ({ state: e, dispatch: n }) => {
1731
- let s = D(e), { doc: r } = e, i = null, o = e.changeByRange((a) => {
1732
- if (!a.empty || !_.isActiveAt(e, a.from, -1) && !_.isActiveAt(e, a.from, 1))
1733
- return i = { range: a };
1734
- let l = a.from, h = r.lineAt(l), f = et(s.resolveInner(l, -1), r);
1735
- for (; f.length && f[f.length - 1].from > l - h.from; )
1736
- f.pop();
1737
- if (!f.length)
1738
- return i = { range: a };
1739
- let d = f[f.length - 1];
1740
- if (d.to - d.spaceAfter.length > l - h.from)
1741
- return i = { range: a };
1742
- let c = l >= d.to - d.spaceAfter.length && !/\S/.test(h.text.slice(d.to));
1743
- if (d.item && c) {
1744
- let L = d.node.firstChild, b = d.node.getChild("ListItem", "ListItem");
1745
- if (L.to >= l || b && b.to < l || h.from > 0 && !/[^\s>]/.test(r.lineAt(h.from - 1).text) || t.nonTightLists === !1) {
1746
- let x = f.length > 1 ? f[f.length - 2] : null, I, T = "";
1747
- x && x.item ? (I = h.from + x.from, T = x.marker(r, 1)) : I = h.from + (x ? x.to : 0);
1748
- let P = [{ from: I, to: l, insert: T }];
1749
- return d.node.name == "OrderedList" && K(d.item, r, P, -2), x && x.node.name == "OrderedList" && K(x.item, r, P), { range: M.cursor(I + T.length), changes: P };
1750
- } else {
1751
- let x = Ae(f, e, h);
1752
- return {
1753
- range: M.cursor(l + x.length + 1),
1754
- changes: { from: h.from, insert: x + e.lineBreak }
1755
- };
1756
- }
1757
- }
1758
- if (d.node.name == "Blockquote" && c && h.from) {
1759
- let L = r.lineAt(h.from - 1), b = />\s*$/.exec(L.text);
1760
- if (b && b.index == d.from) {
1761
- let x = e.changes([
1762
- { from: L.from + b.index, to: L.to },
1763
- { from: h.from + d.from, to: h.to }
1764
- ]);
1765
- return { range: a.map(x), changes: x };
1766
- }
1767
- }
1768
- let p = [];
1769
- d.node.name == "OrderedList" && K(d.item, r, p);
1770
- let m = d.item && d.item.from < h.from, S = "";
1771
- if (!m || /^[\s\d.)\-+*>]*/.exec(h.text)[0].length >= d.to)
1772
- for (let L = 0, b = f.length - 1; L <= b; L++)
1773
- S += L == b && !m ? f[L].marker(r, 1) : f[L].blank(L < b ? $(h.text, 4, f[L + 1].from) - S.length : null);
1774
- let A = l;
1775
- for (; A > h.from && /\s/.test(h.text.charAt(A - h.from - 1)); )
1776
- A--;
1777
- return S = he(S, e), tn(d.node, e.doc) && (S = Ae(f, e, h) + e.lineBreak + S), p.push({ from: A, to: l, insert: e.lineBreak + S }), { range: M.cursor(A + S.length + 1), changes: p };
1778
- });
1779
- return i ? !1 : (n(e.update(o, { scrollIntoView: !0, userEvent: "input" })), !0);
1780
- }, en = /* @__PURE__ */ Yt();
1781
- function ye(t) {
1782
- return t.name == "QuoteMark" || t.name == "ListMark";
1783
- }
1784
- function tn(t, e) {
1785
- if (t.name != "OrderedList" && t.name != "BulletList")
1786
- return !1;
1787
- let n = t.firstChild, s = t.getChild("ListItem", "ListItem");
1788
- if (!s)
1789
- return !1;
1790
- let r = e.lineAt(n.to), i = e.lineAt(s.from), o = /^[\s>]*$/.test(r.text);
1791
- return r.number + (o ? 0 : 1) < i.number;
1792
- }
1793
- function Ae(t, e, n) {
1794
- let s = "";
1795
- for (let r = 0, i = t.length - 2; r <= i; r++)
1796
- s += t[r].blank(r < i ? $(n.text, 4, t[r + 1].from) - s.length : null, r < i);
1797
- return he(s, e);
1798
- }
1799
- function nn(t, e) {
1800
- let n = t.resolveInner(e, -1), s = e;
1801
- ye(n) && (s = n.from, n = n.parent);
1802
- for (let r; r = n.childBefore(s); )
1803
- if (ye(r))
1804
- s = r.from;
1805
- else if (r.name == "OrderedList" || r.name == "BulletList")
1806
- n = r.lastChild, s = n.to;
1807
- else
1808
- break;
1809
- return n;
1810
- }
1811
- const sn = ({ state: t, dispatch: e }) => {
1812
- let n = D(t), s = null, r = t.changeByRange((i) => {
1813
- let o = i.from, { doc: a } = t;
1814
- if (i.empty && _.isActiveAt(t, i.from)) {
1815
- let l = a.lineAt(o), h = et(nn(n, o), a);
1816
- if (h.length) {
1817
- let f = h[h.length - 1], d = f.to - f.spaceAfter.length + (f.spaceAfter ? 1 : 0);
1818
- if (o - l.from > d && !/\S/.test(l.text.slice(d, o - l.from)))
1819
- return {
1820
- range: M.cursor(l.from + d),
1821
- changes: { from: l.from + d, to: o }
1822
- };
1823
- if (o - l.from == d && // Only apply this if we're on the line that has the
1824
- // construct's syntax, or there's only indentation in the
1825
- // target range
1826
- (!f.item || l.from <= f.item.from || !/\S/.test(l.text.slice(0, f.to)))) {
1827
- let c = l.from + f.from;
1828
- if (f.item && f.node.from < f.item.from && /\S/.test(l.text.slice(f.from, f.to))) {
1829
- let p = f.blank($(l.text, 4, f.to) - $(l.text, 4, f.from));
1830
- return c == l.from && (p = he(p, t)), {
1831
- range: M.cursor(c + p.length),
1832
- changes: { from: c, to: l.from + f.to, insert: p }
1833
- };
1834
- }
1835
- if (c < o)
1836
- return { range: M.cursor(c), changes: { from: c, to: o } };
1837
- }
1838
- }
1839
- }
1840
- return s = { range: i };
1841
- });
1842
- return s ? !1 : (e(t.update(r, { scrollIntoView: !0, userEvent: "delete" })), !0);
1843
- }, rn = [
1844
- { key: "Enter", run: en },
1845
- { key: "Backspace", run: sn }
1846
- ], nt = /* @__PURE__ */ Lt({ matchClosingTags: !1 });
1847
- function dn(t = {}) {
1848
- let { codeLanguages: e, defaultCodeLanguage: n, addKeymap: s = !0, base: { parser: r } = Jt, completeHTMLTags: i = !0, pasteURLAsLink: o = !0, htmlTagLanguage: a = nt } = t;
1849
- if (!(r instanceof V))
1850
- throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");
1851
- let l = t.extensions ? [t.extensions] : [], h = [a.support, Gt], f;
1852
- o && h.push(hn), n instanceof fe ? (h.push(n.support), f = n.language) : n && (f = n);
1853
- let d = e || f ? Wt(e, f) : void 0;
1854
- l.push(Nt({ codeParser: d, htmlParser: a.language.parser })), s && h.push(ot.high(at.of(rn)));
1855
- let c = le(r.configure(l));
1856
- return i && h.push(c.data.of({ autocomplete: on })), new fe(c, h);
1857
- }
1858
- function on(t) {
1859
- let { state: e, pos: n } = t, s = /<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(n - 25, n));
1860
- if (!s)
1861
- return null;
1862
- let r = D(e).resolveInner(n, -1);
1863
- for (; r && !r.type.isTop; ) {
1864
- if (r.name == "CodeBlock" || r.name == "FencedCode" || r.name == "ProcessingInstructionBlock" || r.name == "CommentBlock" || r.name == "Link" || r.name == "Image")
1865
- return null;
1866
- r = r.parent;
1867
- }
1868
- return {
1869
- from: n - s[0].length,
1870
- to: n,
1871
- options: an(),
1872
- validFor: /^<[:\-\.\w\u00b7-\uffff]*$/
1873
- };
1874
- }
1875
- let W = null;
1876
- function an() {
1877
- if (W)
1878
- return W;
1879
- let t = bt(new xt(gt.create({ extensions: nt }), 0, !0));
1880
- return W = t ? t.options : [];
1881
- }
1882
- const ln = /code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i, hn = /* @__PURE__ */ rt.domEventHandlers({
1883
- paste: (t, e) => {
1884
- var n;
1885
- let { main: s } = e.state.selection;
1886
- if (s.empty)
1887
- return !1;
1888
- let r = (n = t.clipboardData) === null || n === void 0 ? void 0 : n.getData("text/plain");
1889
- if (!r || !/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r) || (/^www\./.test(r) && (r = "https://" + r), !_.isActiveAt(e.state, s.from, 1)))
1890
- return !1;
1891
- let i = D(e.state), o = !1;
1892
- return i.iterate({
1893
- from: s.from,
1894
- to: s.to,
1895
- enter: (a) => {
1896
- (a.from > s.from || ln.test(a.name)) && (o = !0);
1897
- },
1898
- leave: (a) => {
1899
- a.to < s.to && (o = !0);
1900
- }
1901
- }), o ? !1 : (e.dispatch({
1902
- changes: [{ from: s.from, insert: "[" }, { from: s.to, insert: `](${r})` }],
1903
- userEvent: "input.paste",
1904
- scrollIntoView: !0
1905
- }), !0);
1906
- }
1907
- });
1908
- export {
1909
- Jt as commonmarkLanguage,
1910
- sn as deleteMarkupBackward,
1911
- en as insertNewlineContinueMarkup,
1912
- Yt as insertNewlineContinueMarkupCommand,
1913
- dn as markdown,
1914
- rn as markdownKeymap,
1915
- _ as markdownLanguage,
1916
- hn as pasteURLAsLink
1917
- };