@pi-outpost/embed 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CodeEditor-84sk1WGW.cjs +9 -0
- package/dist/{CodeEditor-CxKTvrhG.js → CodeEditor-CNBsvq8Z.js} +1081 -698
- package/dist/{dist-BDenKBYL.cjs → dist-B9TXDASo.cjs} +1 -1
- package/dist/{dist-AeGgfThs.cjs → dist-BF9tfVH8.cjs} +1 -1
- package/dist/{dist-BWEDf1a-.js → dist-BIMxMB--.js} +49 -49
- package/dist/{dist-C6eKaA9j.cjs → dist-BLS46S7g.cjs} +2 -2
- package/dist/{dist-CGZbBQje.js → dist-BWAsFrsx.js} +69 -69
- package/dist/{dist-DaJf_JYz.js → dist-BZ1m84Kh.js} +56 -56
- package/dist/{dist-CYUF5YPj.js → dist-Bg1-NGne.js} +13 -13
- package/dist/{dist-gn9y7Yb8.js → dist-BjQ1Exnz.js} +26 -26
- package/dist/{dist-DEZD35IP.cjs → dist-BlUoR-U1.cjs} +1 -1
- package/dist/{dist-DNg4hNu7.js → dist-BnXHuZGz.js} +93 -93
- package/dist/{dist-Kg2QsUg8.js → dist-C2UMsquH.js} +74 -74
- package/dist/{dist-D_oMTxAl.cjs → dist-CELe3Rxj.cjs} +2 -2
- package/dist/{dist-CmF-TINl.cjs → dist-CEPd6ecF.cjs} +1 -1
- package/dist/{dist-Cz8GulTe.cjs → dist-CGPxOMk5.cjs} +2 -2
- package/dist/{dist-CCIM600Y.cjs → dist-CPxwFKs7.cjs} +3 -3
- package/dist/{dist-CIBKGNWD.js → dist-Ca51SM3i.js} +141 -141
- package/dist/{dist-BWVp6Da-.js → dist-CcTOENSK.js} +21 -21
- package/dist/{dist-M4fo1U45.cjs → dist-CkDnvyBs.cjs} +1 -1
- package/dist/{dist-BTD5L343.js → dist-CpOA8cNn.js} +121 -121
- package/dist/{dist-CQNYwGEy.cjs → dist-CpsCEkIr.cjs} +1 -1
- package/dist/{dist-LM11INLG.js → dist-CwPu13CG.js} +38 -38
- package/dist/{dist-lPCEVnGX.js → dist-DCT8mdeU.js} +47 -47
- package/dist/{dist-rfjaCa2V.cjs → dist-DJYmQsI-.cjs} +1 -1
- package/dist/{dist-DszFZlYh.js → dist-DeLxY4Ia.js} +32 -32
- package/dist/{dist-2ynRxsSC.cjs → dist-Lxxq5IH0.cjs} +1 -1
- package/dist/{dist-hv72z6I6.js → dist-SqwJhRs0.js} +65 -65
- package/dist/{dist-D6LkseRA.cjs → dist-W-WjEDJm.cjs} +1 -1
- package/dist/{dist-CFf_g4kk.cjs → dist-c-DRw6Dh.cjs} +1 -1
- package/dist/{dist-ChWDi62w.js → dist-iZeihidk.js} +296 -296
- package/dist/{dist-BJHB0x8Y.js → dist-qeX2QqDc.js} +1 -1
- package/dist/{dist-Dpu_aN4m.cjs → dist-sM-IE5EO.cjs} +1 -1
- package/dist/{dist-CT7H4C9g.cjs → dist-vBlUeRrZ.cjs} +1 -1
- package/dist/pi-outpost-embed.cjs +29 -28
- package/dist/pi-outpost-embed.js +3039 -2734
- package/package.json +1 -1
- package/dist/CodeEditor-B699PZlx.cjs +0 -6
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { html as
|
|
3
|
-
import { n as
|
|
1
|
+
import { Ct as e, Dt as t, M as n, Ot as r, T as i, Tt as a, W as o, _ as s, _t as c, a as l, bt as u, d, et as f, i as p, it as m, k as h, kt as ee, mt as g, o as te, r as ne, tt as re, v as ie, w as ae, wt as oe, x as se, yt as ce } from "./dist-qeX2QqDc.js";
|
|
2
|
+
import { html as le, htmlCompletionSource as ue } from "./dist-BZ1m84Kh.js";
|
|
3
|
+
import { n as de } from "./CodeEditor-CNBsvq8Z.js";
|
|
4
4
|
//#region ../node_modules/@lezer/markdown/dist/index.js
|
|
5
|
-
var
|
|
6
|
-
static create(
|
|
7
|
-
let o = i + (i << 8) +
|
|
8
|
-
return new e
|
|
5
|
+
var fe = class t {
|
|
6
|
+
static create(e, n, r, i, a) {
|
|
7
|
+
let o = i + (i << 8) + e + (n << 4) | 0;
|
|
8
|
+
return new t(e, n, r, o, a, [], []);
|
|
9
9
|
}
|
|
10
|
-
constructor(
|
|
11
|
-
this.type =
|
|
10
|
+
constructor(t, n, r, i, a, o, s) {
|
|
11
|
+
this.type = t, this.value = n, this.from = r, this.hash = i, this.end = a, this.children = o, this.positions = s, this.hashProp = [[e.contextHash, i]];
|
|
12
12
|
}
|
|
13
|
-
addChild(
|
|
14
|
-
|
|
13
|
+
addChild(t, n) {
|
|
14
|
+
t.prop(e.contextHash) != this.hash && (t = new r(t.type, t.children, t.positions, t.length, this.hashProp)), this.children.push(t), this.positions.push(n);
|
|
15
15
|
}
|
|
16
|
-
toTree(e,
|
|
17
|
-
let
|
|
18
|
-
return
|
|
16
|
+
toTree(e, t = this.end) {
|
|
17
|
+
let n = this.children.length - 1;
|
|
18
|
+
return n >= 0 && (t = Math.max(t, this.positions[n] + this.children[n].length + this.from)), new r(e.types[this.type], this.children, this.positions, t - this.from).balance({ makeTree: (e, t, n) => new r(a.none, e, t, n, this.hashProp) });
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, _;
|
|
21
21
|
(function(e) {
|
|
22
22
|
e[e.Document = 1] = "Document", e[e.CodeBlock = 2] = "CodeBlock", e[e.FencedCode = 3] = "FencedCode", e[e.Blockquote = 4] = "Blockquote", e[e.HorizontalRule = 5] = "HorizontalRule", e[e.BulletList = 6] = "BulletList", e[e.OrderedList = 7] = "OrderedList", e[e.ListItem = 8] = "ListItem", e[e.ATXHeading1 = 9] = "ATXHeading1", e[e.ATXHeading2 = 10] = "ATXHeading2", e[e.ATXHeading3 = 11] = "ATXHeading3", e[e.ATXHeading4 = 12] = "ATXHeading4", e[e.ATXHeading5 = 13] = "ATXHeading5", e[e.ATXHeading6 = 14] = "ATXHeading6", e[e.SetextHeading1 = 15] = "SetextHeading1", e[e.SetextHeading2 = 16] = "SetextHeading2", e[e.HTMLBlock = 17] = "HTMLBlock", e[e.LinkReference = 18] = "LinkReference", e[e.Paragraph = 19] = "Paragraph", e[e.CommentBlock = 20] = "CommentBlock", e[e.ProcessingInstructionBlock = 21] = "ProcessingInstructionBlock", e[e.Escape = 22] = "Escape", e[e.Entity = 23] = "Entity", e[e.HardBreak = 24] = "HardBreak", e[e.Emphasis = 25] = "Emphasis", e[e.StrongEmphasis = 26] = "StrongEmphasis", e[e.Link = 27] = "Link", e[e.Image = 28] = "Image", e[e.InlineCode = 29] = "InlineCode", e[e.HTMLTag = 30] = "HTMLTag", e[e.Comment = 31] = "Comment", e[e.ProcessingInstruction = 32] = "ProcessingInstruction", e[e.Autolink = 33] = "Autolink", e[e.HeaderMark = 34] = "HeaderMark", e[e.QuoteMark = 35] = "QuoteMark", e[e.ListMark = 36] = "ListMark", e[e.LinkMark = 37] = "LinkMark", e[e.EmphasisMark = 38] = "EmphasisMark", e[e.CodeMark = 39] = "CodeMark", e[e.CodeText = 40] = "CodeText", e[e.CodeInfo = 41] = "CodeInfo", e[e.LinkTitle = 42] = "LinkTitle", e[e.LinkLabel = 43] = "LinkLabel", e[e.URL = 44] = "URL";
|
|
23
|
-
})(
|
|
24
|
-
var
|
|
23
|
+
})(_ ||= {});
|
|
24
|
+
var pe = class {
|
|
25
25
|
constructor(e, t) {
|
|
26
26
|
this.start = e, this.content = t, this.marks = [], this.parsers = [];
|
|
27
27
|
}
|
|
28
|
-
},
|
|
28
|
+
}, me = class {
|
|
29
29
|
constructor() {
|
|
30
30
|
this.text = "", this.baseIndent = 0, this.basePos = 0, this.depth = 0, this.markers = [], this.pos = 0, this.indent = 0, this.next = -1;
|
|
31
31
|
}
|
|
@@ -37,7 +37,7 @@ var ue = class {
|
|
|
37
37
|
this.indent = this.countIndent(e, this.pos, this.indent), this.pos = e, this.next = e == this.text.length ? -1 : this.text.charCodeAt(e);
|
|
38
38
|
}
|
|
39
39
|
skipSpace(e) {
|
|
40
|
-
return
|
|
40
|
+
return y(this.text, e);
|
|
41
41
|
}
|
|
42
42
|
reset(e) {
|
|
43
43
|
for (this.text = e, this.baseIndent = this.basePos = this.pos = this.indent = 0, this.forwardInner(), this.depth = 1; this.markers.length;) this.markers.pop();
|
|
@@ -67,37 +67,37 @@ var ue = class {
|
|
|
67
67
|
return e + this.text.slice(this.basePos);
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
function
|
|
70
|
+
function he(e, t, n) {
|
|
71
71
|
if (n.pos == n.text.length || e != t.block && n.indent >= t.stack[n.depth + 1].value + n.baseIndent) return !0;
|
|
72
72
|
if (n.indent >= n.baseIndent + 4) return !1;
|
|
73
|
-
let r = (e.type ==
|
|
74
|
-
return r > 0 && (e.type !=
|
|
73
|
+
let r = (e.type == _.OrderedList ? w : C)(n, t, !1);
|
|
74
|
+
return r > 0 && (e.type != _.BulletList || S(n, t, !1) < 0) && n.text.charCodeAt(n.pos + r - 1) == e.value;
|
|
75
75
|
}
|
|
76
|
-
var
|
|
77
|
-
[
|
|
78
|
-
return n.next == 62 && (n.markers.push(I(
|
|
76
|
+
var ge = {
|
|
77
|
+
[_.Blockquote](e, t, n) {
|
|
78
|
+
return n.next == 62 && (n.markers.push(I(_.QuoteMark, t.lineStart + n.pos, t.lineStart + n.pos + 1)), n.moveBase(n.pos + (v(n.text.charCodeAt(n.pos + 1)) ? 2 : 1)), e.end = t.lineStart + n.text.length, !0);
|
|
79
79
|
},
|
|
80
|
-
[
|
|
80
|
+
[_.ListItem](e, t, n) {
|
|
81
81
|
return n.indent < n.baseIndent + e.value && n.next > -1 ? !1 : (n.moveBaseColumn(n.baseIndent + e.value), !0);
|
|
82
82
|
},
|
|
83
|
-
[
|
|
84
|
-
[
|
|
85
|
-
[
|
|
83
|
+
[_.OrderedList]: he,
|
|
84
|
+
[_.BulletList]: he,
|
|
85
|
+
[_.Document]() {
|
|
86
86
|
return !0;
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
|
-
function
|
|
89
|
+
function v(e) {
|
|
90
90
|
return e == 32 || e == 9 || e == 10 || e == 13;
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
for (; t < e.length &&
|
|
92
|
+
function y(e, t = 0) {
|
|
93
|
+
for (; t < e.length && v(e.charCodeAt(t));) t++;
|
|
94
94
|
return t;
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
for (; t > n &&
|
|
96
|
+
function _e(e, t, n) {
|
|
97
|
+
for (; t > n && v(e.charCodeAt(t - 1));) t--;
|
|
98
98
|
return t;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function b(e) {
|
|
101
101
|
if (e.next != 96 && e.next != 126) return -1;
|
|
102
102
|
let t = e.pos + 1;
|
|
103
103
|
for (; t < e.text.length && e.text.charCodeAt(t) == e.next;) t++;
|
|
@@ -107,35 +107,35 @@ function he(e) {
|
|
|
107
107
|
}
|
|
108
108
|
return t;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function x(e) {
|
|
111
111
|
return e.next == 62 ? e.text.charCodeAt(e.pos + 1) == 32 ? 2 : 1 : -1;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function S(e, t, n) {
|
|
114
114
|
if (e.next != 42 && e.next != 45 && e.next != 95) return -1;
|
|
115
115
|
let r = 1;
|
|
116
116
|
for (let t = e.pos + 1; t < e.text.length; t++) {
|
|
117
117
|
let n = e.text.charCodeAt(t);
|
|
118
118
|
if (n == e.next) r++;
|
|
119
|
-
else if (!
|
|
119
|
+
else if (!v(n)) return -1;
|
|
120
120
|
}
|
|
121
|
-
return n && e.next == 45 &&
|
|
121
|
+
return n && e.next == 45 && be(e) > -1 && e.depth == t.stack.length && t.parser.leafBlockParsers.indexOf(A.SetextHeading) > -1 || r < 3 ? -1 : 1;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function ve(e, t) {
|
|
124
124
|
for (let n = e.stack.length - 1; n >= 0; n--) if (e.stack[n].type == t) return !0;
|
|
125
125
|
return !1;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
return (e.next == 45 || e.next == 43 || e.next == 42) && (e.pos == e.text.length - 1 ||
|
|
127
|
+
function C(e, t, n) {
|
|
128
|
+
return (e.next == 45 || e.next == 43 || e.next == 42) && (e.pos == e.text.length - 1 || v(e.text.charCodeAt(e.pos + 1))) && (!n || ve(t, _.BulletList) || e.skipSpace(e.pos + 2) < e.text.length) ? 1 : -1;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function w(e, t, n) {
|
|
131
131
|
let r = e.pos, i = e.next;
|
|
132
132
|
for (; i >= 48 && i <= 57;) {
|
|
133
133
|
if (r++, r == e.text.length) return -1;
|
|
134
134
|
i = e.text.charCodeAt(r);
|
|
135
135
|
}
|
|
136
|
-
return r == e.pos || r > e.pos + 9 || i != 46 && i != 41 || r < e.text.length - 1 && !
|
|
136
|
+
return r == e.pos || r > e.pos + 9 || i != 46 && i != 41 || r < e.text.length - 1 && !v(e.text.charCodeAt(r + 1)) || n && !ve(t, _.OrderedList) && (e.skipSpace(r + 1) == e.text.length || r > e.pos + 1 || e.next != 49) ? -1 : r + 1 - e.pos;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function ye(e) {
|
|
139
139
|
if (e.next != 35) return -1;
|
|
140
140
|
let t = e.pos + 1;
|
|
141
141
|
for (; t < e.text.length && e.text.charCodeAt(t) == 35;) t++;
|
|
@@ -143,120 +143,120 @@ function ve(e) {
|
|
|
143
143
|
let n = t - e.pos;
|
|
144
144
|
return n > 6 ? -1 : n;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
function be(e) {
|
|
147
147
|
if (e.next != 45 && e.next != 61 || e.indent >= e.baseIndent + 4) return -1;
|
|
148
148
|
let t = e.pos + 1;
|
|
149
149
|
for (; t < e.text.length && e.text.charCodeAt(t) == e.next;) t++;
|
|
150
150
|
let n = t;
|
|
151
|
-
for (; t < e.text.length &&
|
|
151
|
+
for (; t < e.text.length && v(e.text.charCodeAt(t));) t++;
|
|
152
152
|
return t == e.text.length ? n : -1;
|
|
153
153
|
}
|
|
154
|
-
var
|
|
154
|
+
var T = /^[ \t]*$/, xe = /-->/, Se = /\?>/, E = [
|
|
155
155
|
[/^<(?:script|pre|style)(?:\s|>|$)/i, /<\/(?:script|pre|style)>/i],
|
|
156
|
-
[/^\s*<!--/,
|
|
157
|
-
[/^\s*<\?/,
|
|
156
|
+
[/^\s*<!--/, xe],
|
|
157
|
+
[/^\s*<\?/, Se],
|
|
158
158
|
[/^\s*<![A-Z]/, />/],
|
|
159
159
|
[/^\s*<!\[CDATA\[/, /\]\]>/],
|
|
160
|
-
[/^\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,
|
|
161
|
-
[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,
|
|
160
|
+
[/^\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, T],
|
|
161
|
+
[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i, T]
|
|
162
162
|
];
|
|
163
|
-
function
|
|
163
|
+
function Ce(e, t, n) {
|
|
164
164
|
if (e.next != 60) return -1;
|
|
165
165
|
let r = e.text.slice(e.pos);
|
|
166
|
-
for (let e = 0, t =
|
|
166
|
+
for (let e = 0, t = E.length - +!!n; e < t; e++) if (E[e][0].test(r)) return e;
|
|
167
167
|
return -1;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function we(e, t) {
|
|
170
170
|
let n = e.countIndent(t, e.pos, e.indent), r = e.skipSpace(t), i = e.countIndent(r, t, n);
|
|
171
171
|
return i >= n + 5 || r == e.text.length ? n + 1 : i;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function D(e, t, n) {
|
|
174
174
|
let r = e.length - 1;
|
|
175
|
-
r >= 0 && e[r].to == t && e[r].type ==
|
|
175
|
+
r >= 0 && e[r].to == t && e[r].type == _.CodeText ? e[r].to = n : e.push(I(_.CodeText, t, n));
|
|
176
176
|
}
|
|
177
|
-
var
|
|
177
|
+
var O = {
|
|
178
178
|
LinkReference: void 0,
|
|
179
179
|
IndentedCode(e, t) {
|
|
180
180
|
let n = t.baseIndent + 4;
|
|
181
181
|
if (t.indent < n) return !1;
|
|
182
182
|
let r = t.findColumn(n), i = e.lineStart + r, a = e.lineStart + t.text.length, o = [], s = [];
|
|
183
|
-
for (
|
|
184
|
-
|
|
183
|
+
for (D(o, i, a); e.nextLine() && t.depth >= e.stack.length;) if (t.pos == t.text.length) {
|
|
184
|
+
D(s, e.lineStart - 1, e.lineStart);
|
|
185
185
|
for (let e of t.markers) s.push(e);
|
|
186
186
|
} else if (t.indent < n) break;
|
|
187
187
|
else {
|
|
188
188
|
if (s.length) {
|
|
189
|
-
for (let e of s) e.type ==
|
|
189
|
+
for (let e of s) e.type == _.CodeText ? D(o, e.from, e.to) : o.push(e);
|
|
190
190
|
s = [];
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
D(o, e.lineStart - 1, e.lineStart);
|
|
193
193
|
for (let e of t.markers) o.push(e);
|
|
194
194
|
a = e.lineStart + t.text.length;
|
|
195
195
|
let n = e.lineStart + t.findColumn(t.baseIndent + 4);
|
|
196
|
-
n < a &&
|
|
196
|
+
n < a && D(o, n, a);
|
|
197
197
|
}
|
|
198
|
-
return s.length && (s = s.filter((e) => e.type !=
|
|
198
|
+
return s.length && (s = s.filter((e) => e.type != _.CodeText), s.length && (t.markers = s.concat(t.markers))), e.addNode(e.buffer.writeElements(o, -i).finish(_.CodeBlock, a - i), i), !0;
|
|
199
199
|
},
|
|
200
200
|
FencedCode(e, t) {
|
|
201
|
-
let n =
|
|
201
|
+
let n = b(t);
|
|
202
202
|
if (n < 0) return !1;
|
|
203
|
-
let r = e.lineStart + t.pos, i = t.next, a = n - t.pos, o = t.skipSpace(n), s =
|
|
204
|
-
o < s && c.push(I(
|
|
203
|
+
let r = e.lineStart + t.pos, i = t.next, a = n - t.pos, o = t.skipSpace(n), s = _e(t.text, t.text.length, o), c = [I(_.CodeMark, r, r + a)];
|
|
204
|
+
o < s && c.push(I(_.CodeInfo, e.lineStart + o, e.lineStart + s));
|
|
205
205
|
for (let n = !0, r = !0, o = !1; e.nextLine() && t.depth >= e.stack.length; n = !1) {
|
|
206
206
|
let s = t.pos;
|
|
207
207
|
if (t.indent - t.baseIndent < 4) for (; s < t.text.length && t.text.charCodeAt(s) == i;) s++;
|
|
208
208
|
if (s - t.pos >= a && t.skipSpace(s) == t.text.length) {
|
|
209
209
|
for (let e of t.markers) c.push(e);
|
|
210
|
-
r && o &&
|
|
210
|
+
r && o && D(c, e.lineStart - 1, e.lineStart), c.push(I(_.CodeMark, e.lineStart + t.pos, e.lineStart + s)), e.nextLine();
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
213
|
{
|
|
214
|
-
o = !0, n || (
|
|
214
|
+
o = !0, n || (D(c, e.lineStart - 1, e.lineStart), r = !1);
|
|
215
215
|
for (let e of t.markers) c.push(e);
|
|
216
216
|
let i = e.lineStart + t.basePos, a = e.lineStart + t.text.length;
|
|
217
|
-
i < a && (
|
|
217
|
+
i < a && (D(c, i, a), r = !1);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
return e.addNode(e.buffer.writeElements(c, -r).finish(
|
|
220
|
+
return e.addNode(e.buffer.writeElements(c, -r).finish(_.FencedCode, e.prevLineEnd() - r), r), !0;
|
|
221
221
|
},
|
|
222
222
|
Blockquote(e, t) {
|
|
223
|
-
let n =
|
|
224
|
-
return n < 0 ? !1 : (e.startContext(
|
|
223
|
+
let n = x(t);
|
|
224
|
+
return n < 0 ? !1 : (e.startContext(_.Blockquote, t.pos), e.addNode(_.QuoteMark, e.lineStart + t.pos, e.lineStart + t.pos + 1), t.moveBase(t.pos + n), null);
|
|
225
225
|
},
|
|
226
226
|
HorizontalRule(e, t) {
|
|
227
|
-
if (
|
|
227
|
+
if (S(t, e, !1) < 0) return !1;
|
|
228
228
|
let n = e.lineStart + t.pos;
|
|
229
|
-
return e.nextLine(), e.addNode(
|
|
229
|
+
return e.nextLine(), e.addNode(_.HorizontalRule, n), !0;
|
|
230
230
|
},
|
|
231
231
|
BulletList(e, t) {
|
|
232
|
-
let n =
|
|
232
|
+
let n = C(t, e, !1);
|
|
233
233
|
if (n < 0) return !1;
|
|
234
|
-
e.block.type !=
|
|
235
|
-
let r =
|
|
236
|
-
return e.startContext(
|
|
234
|
+
e.block.type != _.BulletList && e.startContext(_.BulletList, t.basePos, t.next);
|
|
235
|
+
let r = we(t, t.pos + 1);
|
|
236
|
+
return e.startContext(_.ListItem, t.basePos, r - t.baseIndent), e.addNode(_.ListMark, e.lineStart + t.pos, e.lineStart + t.pos + n), t.moveBaseColumn(r), null;
|
|
237
237
|
},
|
|
238
238
|
OrderedList(e, t) {
|
|
239
|
-
let n =
|
|
239
|
+
let n = w(t, e, !1);
|
|
240
240
|
if (n < 0) return !1;
|
|
241
|
-
e.block.type !=
|
|
242
|
-
let r =
|
|
243
|
-
return e.startContext(
|
|
241
|
+
e.block.type != _.OrderedList && e.startContext(_.OrderedList, t.basePos, t.text.charCodeAt(t.pos + n - 1));
|
|
242
|
+
let r = we(t, t.pos + n);
|
|
243
|
+
return e.startContext(_.ListItem, t.basePos, r - t.baseIndent), e.addNode(_.ListMark, e.lineStart + t.pos, e.lineStart + t.pos + n), t.moveBaseColumn(r), null;
|
|
244
244
|
},
|
|
245
245
|
ATXHeading(e, t) {
|
|
246
|
-
let n =
|
|
246
|
+
let n = ye(t);
|
|
247
247
|
if (n < 0) return !1;
|
|
248
|
-
let r = t.pos, i = e.lineStart + r, a =
|
|
248
|
+
let r = t.pos, i = e.lineStart + r, a = _e(t.text, t.text.length, r), o = a;
|
|
249
249
|
for (; o > r && t.text.charCodeAt(o - 1) == t.next;) o--;
|
|
250
|
-
(o == a || o == r || !
|
|
251
|
-
let s = e.buffer.write(
|
|
252
|
-
o < t.text.length && s.write(
|
|
253
|
-
let c = s.finish(
|
|
250
|
+
(o == a || o == r || !v(t.text.charCodeAt(o - 1))) && (o = t.text.length);
|
|
251
|
+
let s = e.buffer.write(_.HeaderMark, 0, n).writeElements(e.parser.parseInline(t.text.slice(r + n + 1, o), i + n + 1), -i);
|
|
252
|
+
o < t.text.length && s.write(_.HeaderMark, o - r, a - r);
|
|
253
|
+
let c = s.finish(_.ATXHeading1 - 1 + n, t.text.length - r);
|
|
254
254
|
return e.nextLine(), e.addNode(c, i), !0;
|
|
255
255
|
},
|
|
256
256
|
HTMLBlock(e, t) {
|
|
257
|
-
let n =
|
|
257
|
+
let n = Ce(t, e, !1);
|
|
258
258
|
if (n < 0) return !1;
|
|
259
|
-
let r = e.lineStart + t.pos, i =
|
|
259
|
+
let r = e.lineStart + t.pos, i = E[n][1], a = [], o = i != T;
|
|
260
260
|
for (; !i.test(t.text) && e.nextLine();) {
|
|
261
261
|
if (t.depth < e.stack.length) {
|
|
262
262
|
o = !1;
|
|
@@ -265,11 +265,11 @@ var k = {
|
|
|
265
265
|
for (let e of t.markers) a.push(e);
|
|
266
266
|
}
|
|
267
267
|
o && e.nextLine();
|
|
268
|
-
let s = i ==
|
|
268
|
+
let s = i == xe ? _.CommentBlock : i == Se ? _.ProcessingInstructionBlock : _.HTMLBlock, c = e.prevLineEnd();
|
|
269
269
|
return e.addNode(e.buffer.writeElements(a, -r).finish(s, c - r), r), !0;
|
|
270
270
|
},
|
|
271
271
|
SetextHeading: void 0
|
|
272
|
-
},
|
|
272
|
+
}, Te = class {
|
|
273
273
|
constructor(e) {
|
|
274
274
|
this.stage = 0, this.elts = [], this.pos = 0, this.start = e.start, this.advance(e.content);
|
|
275
275
|
}
|
|
@@ -279,10 +279,10 @@ var k = {
|
|
|
279
279
|
return i > -1 && i < r.length && this.complete(e, n, i);
|
|
280
280
|
}
|
|
281
281
|
finish(e, t) {
|
|
282
|
-
return (this.stage == 2 || this.stage == 3) &&
|
|
282
|
+
return (this.stage == 2 || this.stage == 3) && y(t.content, this.pos) == t.content.length && this.complete(e, t, t.content.length);
|
|
283
283
|
}
|
|
284
284
|
complete(e, t, n) {
|
|
285
|
-
return e.addLeafElement(t, I(
|
|
285
|
+
return e.addLeafElement(t, I(_.LinkReference, this.start, this.start + n, this.elts)), !0;
|
|
286
286
|
}
|
|
287
287
|
nextStage(e) {
|
|
288
288
|
return e ? (this.pos = e.to - this.start, this.elts.push(e), this.stage++, !0) : (e === !1 && (this.stage = -1), !1);
|
|
@@ -292,61 +292,61 @@ var k = {
|
|
|
292
292
|
else if (this.stage == 0) {
|
|
293
293
|
if (!this.nextStage(ze(e, this.pos, this.start, !0))) return -1;
|
|
294
294
|
if (e.charCodeAt(this.pos) != 58) return this.stage = -1;
|
|
295
|
-
this.elts.push(I(
|
|
295
|
+
this.elts.push(I(_.LinkMark, this.pos + this.start, this.pos + this.start + 1)), this.pos++;
|
|
296
296
|
} else if (this.stage == 1) {
|
|
297
|
-
if (!this.nextStage(Le(e,
|
|
297
|
+
if (!this.nextStage(Le(e, y(e, this.pos), this.start))) return -1;
|
|
298
298
|
} else if (this.stage == 2) {
|
|
299
|
-
let t =
|
|
299
|
+
let t = y(e, this.pos), n = 0;
|
|
300
300
|
if (t > this.pos) {
|
|
301
301
|
let r = Re(e, t, this.start);
|
|
302
302
|
if (r) {
|
|
303
|
-
let t =
|
|
303
|
+
let t = k(e, r.to - this.start);
|
|
304
304
|
t > 0 && (this.nextStage(r), n = t);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
return n ||=
|
|
308
|
-
} else return
|
|
307
|
+
return n ||= k(e, this.pos), n > 0 && n < e.length ? n : -1;
|
|
308
|
+
} else return k(e, this.pos);
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
|
-
function
|
|
311
|
+
function k(e, t) {
|
|
312
312
|
for (; t < e.length; t++) {
|
|
313
313
|
let n = e.charCodeAt(t);
|
|
314
314
|
if (n == 10) break;
|
|
315
|
-
if (!
|
|
315
|
+
if (!v(n)) return -1;
|
|
316
316
|
}
|
|
317
317
|
return t;
|
|
318
318
|
}
|
|
319
|
-
var
|
|
319
|
+
var Ee = class {
|
|
320
320
|
nextLine(e, t, n) {
|
|
321
|
-
let r = t.depth < e.stack.length ? -1 :
|
|
321
|
+
let r = t.depth < e.stack.length ? -1 : be(t), i = t.next;
|
|
322
322
|
if (r < 0) return !1;
|
|
323
|
-
let a = I(
|
|
324
|
-
return e.nextLine(), e.addLeafElement(n, I(i == 61 ?
|
|
323
|
+
let a = I(_.HeaderMark, e.lineStart + t.pos, e.lineStart + r);
|
|
324
|
+
return e.nextLine(), e.addLeafElement(n, I(i == 61 ? _.SetextHeading1 : _.SetextHeading2, n.start, e.prevLineEnd(), [...e.parser.parseInline(n.content, n.start), a])), !0;
|
|
325
325
|
}
|
|
326
326
|
finish() {
|
|
327
327
|
return !1;
|
|
328
328
|
}
|
|
329
|
-
},
|
|
329
|
+
}, A = {
|
|
330
330
|
LinkReference(e, t) {
|
|
331
|
-
return t.content.charCodeAt(0) == 91 ? new
|
|
331
|
+
return t.content.charCodeAt(0) == 91 ? new Te(t) : null;
|
|
332
332
|
},
|
|
333
333
|
SetextHeading() {
|
|
334
|
-
return new
|
|
334
|
+
return new Ee();
|
|
335
335
|
}
|
|
336
336
|
}, De = [
|
|
337
|
-
(e, t) =>
|
|
338
|
-
(e, t) =>
|
|
339
|
-
(e, t) =>
|
|
340
|
-
(e, t) => w(t, e, !0) >= 0,
|
|
341
|
-
(e, t) => T(t, e, !0) >= 0,
|
|
337
|
+
(e, t) => ye(t) >= 0,
|
|
338
|
+
(e, t) => b(t) >= 0,
|
|
339
|
+
(e, t) => x(t) >= 0,
|
|
342
340
|
(e, t) => C(t, e, !0) >= 0,
|
|
343
|
-
(e, t) =>
|
|
341
|
+
(e, t) => w(t, e, !0) >= 0,
|
|
342
|
+
(e, t) => S(t, e, !0) >= 0,
|
|
343
|
+
(e, t) => Ce(t, e, !0) >= 0
|
|
344
344
|
], Oe = {
|
|
345
345
|
text: "",
|
|
346
346
|
end: 0
|
|
347
347
|
}, ke = class {
|
|
348
348
|
constructor(e, t, n, r) {
|
|
349
|
-
this.parser = e, this.input = t, this.ranges = r, this.line = new
|
|
349
|
+
this.parser = e, this.input = t, this.ranges = r, this.line = new me(), 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 = fe.create(_.Document, 0, this.lineStart, 0, 0), this.stack = [this.block], this.fragments = n.length ? new Ve(n, t) : null, this.readLine();
|
|
350
350
|
}
|
|
351
351
|
get parsedPos() {
|
|
352
352
|
return this.absoluteLineStart;
|
|
@@ -380,7 +380,7 @@ var Te = class {
|
|
|
380
380
|
break;
|
|
381
381
|
}
|
|
382
382
|
if (e.pos == e.text.length) return this.nextLine() ? null : this.finish();
|
|
383
|
-
let t = new
|
|
383
|
+
let t = new pe(this.lineStart + e.pos, e.text.slice(e.pos));
|
|
384
384
|
for (let e of this.parser.leafBlockParsers) if (e) {
|
|
385
385
|
let n = e(this, t);
|
|
386
386
|
n && t.parsers.push(n);
|
|
@@ -436,7 +436,7 @@ var Te = class {
|
|
|
436
436
|
let { line: e } = this, { text: t, end: n } = this.scanLine(this.absoluteLineStart);
|
|
437
437
|
for (this.absoluteLineEnd = n, e.reset(t); e.depth < this.stack.length; e.depth++) {
|
|
438
438
|
let t = this.stack[e.depth], n = this.parser.skipContextMarkup[t.type];
|
|
439
|
-
if (!n) throw Error("Unhandled block context " +
|
|
439
|
+
if (!n) throw Error("Unhandled block context " + _[t.type]);
|
|
440
440
|
let r = this.line.markers.length;
|
|
441
441
|
if (!n(t, this, e)) {
|
|
442
442
|
this.line.markers.length > r && (t.end = this.line.markers[this.line.markers.length - 1].to), e.forward();
|
|
@@ -458,7 +458,7 @@ var Te = class {
|
|
|
458
458
|
return this.atEnd ? this.lineStart : this.lineStart - 1;
|
|
459
459
|
}
|
|
460
460
|
startContext(e, t, n = 0) {
|
|
461
|
-
this.block =
|
|
461
|
+
this.block = fe.create(e, n, this.lineStart + t, this.block.hash, this.lineStart + this.line.text.length), this.stack.push(this.block);
|
|
462
462
|
}
|
|
463
463
|
startComposite(e, t, n = 0) {
|
|
464
464
|
this.startContext(this.parser.getNodeType(e), t, n);
|
|
@@ -486,7 +486,7 @@ var Te = class {
|
|
|
486
486
|
finishLeaf(e) {
|
|
487
487
|
for (let t of e.parsers) if (t.finish(this, e)) return;
|
|
488
488
|
let t = G(this.parser.parseInline(e.content, e.start), e.marks);
|
|
489
|
-
this.addNode(this.buffer.writeElements(t, -e.start).finish(
|
|
489
|
+
this.addNode(this.buffer.writeElements(t, -e.start).finish(_.Paragraph, e.content.length), e.start);
|
|
490
490
|
}
|
|
491
491
|
elt(e, t, n, r) {
|
|
492
492
|
return typeof e == "string" ? I(this.parser.getNodeType(e), t, n, r) : new Pe(e, t);
|
|
@@ -510,7 +510,7 @@ function Ae(e, t, n, i, a) {
|
|
|
510
510
|
}
|
|
511
511
|
return u(n.to + i, !1), new r(n.type, s, c, n.to + i - l, n.tree ? n.tree.propValues : void 0);
|
|
512
512
|
}
|
|
513
|
-
var je = class
|
|
513
|
+
var je = class n extends t {
|
|
514
514
|
constructor(e, t, n, r, i, a, o, s, c) {
|
|
515
515
|
super(), this.nodeSet = e, this.blockParsers = t, this.leafBlockParsers = n, this.blockNames = r, this.endLeafBlock = i, this.skipContextMarkup = a, this.inlineParsers = o, this.inlineNames = s, this.wrappers = c, this.nodeTypes = Object.create(null);
|
|
516
516
|
for (let t of e.types) this.nodeTypes[t.name] = t.id;
|
|
@@ -520,52 +520,52 @@ var je = class e extends l {
|
|
|
520
520
|
for (let i of this.wrappers) r = i(r, e, t, n);
|
|
521
521
|
return r;
|
|
522
522
|
}
|
|
523
|
-
configure(
|
|
524
|
-
let r = M(
|
|
523
|
+
configure(t) {
|
|
524
|
+
let r = M(t);
|
|
525
525
|
if (!r) return this;
|
|
526
|
-
let { nodeSet: i, skipContextMarkup:
|
|
526
|
+
let { nodeSet: i, skipContextMarkup: o } = this, s = this.blockParsers.slice(), l = this.leafBlockParsers.slice(), u = this.blockNames.slice(), d = this.inlineParsers.slice(), f = this.inlineNames.slice(), p = this.endLeafBlock.slice(), m = this.wrappers;
|
|
527
527
|
if (j(r.defineNodes)) {
|
|
528
|
-
|
|
529
|
-
let
|
|
528
|
+
o = Object.assign({}, o);
|
|
529
|
+
let t = i.types.slice(), n;
|
|
530
530
|
for (let i of r.defineNodes) {
|
|
531
|
-
let { name: r, block:
|
|
532
|
-
if (
|
|
533
|
-
|
|
534
|
-
let
|
|
531
|
+
let { name: r, block: s, composite: l, style: u } = typeof i == "string" ? { name: i } : i;
|
|
532
|
+
if (t.some((e) => e.name == r)) continue;
|
|
533
|
+
l && (o[t.length] = (e, t, n) => l(t, n, e.value));
|
|
534
|
+
let d = t.length, f = l ? ["Block", "BlockContext"] : s ? d >= _.ATXHeading1 && d <= _.SetextHeading2 ? [
|
|
535
535
|
"Block",
|
|
536
536
|
"LeafBlock",
|
|
537
537
|
"Heading"
|
|
538
538
|
] : ["Block", "LeafBlock"] : void 0;
|
|
539
|
-
|
|
540
|
-
id:
|
|
539
|
+
t.push(a.define({
|
|
540
|
+
id: d,
|
|
541
541
|
name: r,
|
|
542
|
-
props:
|
|
543
|
-
})),
|
|
542
|
+
props: f && [[e.group, f]]
|
|
543
|
+
})), u && (n ||= {}, Array.isArray(u) || u instanceof c ? n[r] = u : Object.assign(n, u));
|
|
544
544
|
}
|
|
545
|
-
i = new
|
|
545
|
+
i = new oe(t), n && (i = i.extend(ce(n)));
|
|
546
546
|
}
|
|
547
547
|
if (j(r.props) && (i = i.extend(...r.props)), j(r.remove)) for (let e of r.remove) {
|
|
548
548
|
let t = this.blockNames.indexOf(e), n = this.inlineNames.indexOf(e);
|
|
549
|
-
t > -1 && (
|
|
549
|
+
t > -1 && (s[t] = l[t] = void 0), n > -1 && (d[n] = void 0);
|
|
550
550
|
}
|
|
551
551
|
if (j(r.parseBlock)) for (let e of r.parseBlock) {
|
|
552
|
-
let t =
|
|
553
|
-
if (t > -1)
|
|
552
|
+
let t = u.indexOf(e.name);
|
|
553
|
+
if (t > -1) s[t] = e.parse, l[t] = e.leaf;
|
|
554
554
|
else {
|
|
555
|
-
let t = e.before ? N(
|
|
556
|
-
|
|
555
|
+
let t = e.before ? N(u, e.before) : e.after ? N(u, e.after) + 1 : u.length - 1;
|
|
556
|
+
s.splice(t, 0, e.parse), l.splice(t, 0, e.leaf), u.splice(t, 0, e.name);
|
|
557
557
|
}
|
|
558
558
|
e.endLeaf && p.push(e.endLeaf);
|
|
559
559
|
}
|
|
560
560
|
if (j(r.parseInline)) for (let e of r.parseInline) {
|
|
561
561
|
let t = f.indexOf(e.name);
|
|
562
|
-
if (t > -1)
|
|
562
|
+
if (t > -1) d[t] = e.parse;
|
|
563
563
|
else {
|
|
564
564
|
let t = e.before ? N(f, e.before) : e.after ? N(f, e.after) + 1 : f.length - 1;
|
|
565
|
-
|
|
565
|
+
d.splice(t, 0, e.parse), f.splice(t, 0, e.name);
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
|
-
return r.wrap && (m = m.concat(r.wrap)), new
|
|
568
|
+
return r.wrap && (m = m.concat(r.wrap)), new n(i, s, l, u, p, o, d, f, m);
|
|
569
569
|
}
|
|
570
570
|
getNodeType(e) {
|
|
571
571
|
let t = this.nodeTypes[e];
|
|
@@ -613,11 +613,11 @@ function N(e, t) {
|
|
|
613
613
|
if (n < 0) throw RangeError(`Position specified relative to unknown parser ${t}`);
|
|
614
614
|
return n;
|
|
615
615
|
}
|
|
616
|
-
var Me = [
|
|
617
|
-
for (let
|
|
618
|
-
id:
|
|
616
|
+
var Me = [a.none];
|
|
617
|
+
for (let t = 1, n; n = _[t]; t++) Me[t] = a.define({
|
|
618
|
+
id: t,
|
|
619
619
|
name: n,
|
|
620
|
-
props:
|
|
620
|
+
props: t >= _.Escape ? [] : [[e.group, t in ge ? ["Block", "BlockContext"] : ["Block", "LeafBlock"]]],
|
|
621
621
|
top: n == "Document"
|
|
622
622
|
});
|
|
623
623
|
var P = [], Ne = class {
|
|
@@ -692,13 +692,13 @@ var U = {
|
|
|
692
692
|
Escape(e, t, n) {
|
|
693
693
|
if (t != 92 || n == e.end - 1) return -1;
|
|
694
694
|
let r = e.char(n + 1);
|
|
695
|
-
for (let t = 0; t < 32; t++) if (Fe.charCodeAt(t) == r) return e.append(I(
|
|
695
|
+
for (let t = 0; t < 32; t++) if (Fe.charCodeAt(t) == r) return e.append(I(_.Escape, n, n + 2));
|
|
696
696
|
return -1;
|
|
697
697
|
},
|
|
698
698
|
Entity(e, t, n) {
|
|
699
699
|
if (t != 38) return -1;
|
|
700
700
|
let r = /^(?:#\d+|#x[a-f\d]+|\w+);/i.exec(e.slice(n + 1, n + 31));
|
|
701
|
-
return r ? e.append(I(
|
|
701
|
+
return r ? e.append(I(_.Entity, n, n + 1 + r[0].length)) : -1;
|
|
702
702
|
},
|
|
703
703
|
InlineCode(e, t, n) {
|
|
704
704
|
if (t != 96 || n && e.char(n - 1) == 96) return -1;
|
|
@@ -706,24 +706,24 @@ var U = {
|
|
|
706
706
|
for (; r < e.end && e.char(r) == 96;) r++;
|
|
707
707
|
let i = r - n, a = 0;
|
|
708
708
|
for (; r < e.end; r++) if (e.char(r) == 96) {
|
|
709
|
-
if (a++, a == i && e.char(r + 1) != 96) return e.append(I(
|
|
709
|
+
if (a++, a == i && e.char(r + 1) != 96) return e.append(I(_.InlineCode, n, r + 1, [I(_.CodeMark, n, n + i), I(_.CodeMark, r + 1 - i, r + 1)]));
|
|
710
710
|
} else a = 0;
|
|
711
711
|
return -1;
|
|
712
712
|
},
|
|
713
713
|
HTMLTag(e, t, n) {
|
|
714
714
|
if (t != 60 || n == e.end - 1) return -1;
|
|
715
715
|
let r = e.slice(n + 1, e.end), i = /^(?:[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(r);
|
|
716
|
-
if (i) return e.append(I(
|
|
717
|
-
I(
|
|
718
|
-
I(
|
|
719
|
-
I(
|
|
716
|
+
if (i) return e.append(I(_.Autolink, n, n + 1 + i[0].length, [
|
|
717
|
+
I(_.LinkMark, n, n + 1),
|
|
718
|
+
I(_.URL, n + 1, n + i[0].length),
|
|
719
|
+
I(_.LinkMark, n + i[0].length, n + 1 + i[0].length)
|
|
720
720
|
]));
|
|
721
721
|
let a = /^!--[^>](?:-[^-]|[^-])*?-->/i.exec(r);
|
|
722
|
-
if (a) return e.append(I(
|
|
722
|
+
if (a) return e.append(I(_.Comment, n, n + 1 + a[0].length));
|
|
723
723
|
let o = /^\?[^]*?\?>/.exec(r);
|
|
724
|
-
if (o) return e.append(I(
|
|
724
|
+
if (o) return e.append(I(_.ProcessingInstruction, n, n + 1 + o[0].length));
|
|
725
725
|
let s = /^(?:![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(r);
|
|
726
|
-
return s ? e.append(I(
|
|
726
|
+
return s ? e.append(I(_.HTMLTag, n, n + 1 + s[0].length)) : -1;
|
|
727
727
|
},
|
|
728
728
|
Emphasis(e, t, n) {
|
|
729
729
|
if (t != 95 && t != 42) return -1;
|
|
@@ -733,11 +733,11 @@ var U = {
|
|
|
733
733
|
return e.append(new V(t == 95 ? L : R, n, r, !!f | (p ? 2 : 0)));
|
|
734
734
|
},
|
|
735
735
|
HardBreak(e, t, n) {
|
|
736
|
-
if (t == 92 && e.char(n + 1) == 10) return e.append(I(
|
|
736
|
+
if (t == 92 && e.char(n + 1) == 10) return e.append(I(_.HardBreak, n, n + 2));
|
|
737
737
|
if (t == 32) {
|
|
738
738
|
let t = n + 1;
|
|
739
739
|
for (; e.char(t) == 32;) t++;
|
|
740
|
-
if (e.char(t) == 10 && t >= n + 2) return e.append(I(
|
|
740
|
+
if (e.char(t) == 10 && t >= n + 2) return e.append(I(_.HardBreak, n, t + 1));
|
|
741
741
|
}
|
|
742
742
|
return -1;
|
|
743
743
|
},
|
|
@@ -753,7 +753,7 @@ var U = {
|
|
|
753
753
|
let r = e.parts[t];
|
|
754
754
|
if (r instanceof V && (r.type == z || r.type == B)) {
|
|
755
755
|
if (!r.side || e.skipSpace(r.to) == n && !/[(\[]/.test(e.slice(n + 1, n + 2))) return e.parts[t] = null, -1;
|
|
756
|
-
let i = e.takeContent(t), a = e.parts[t] = Ie(e, i, r.type == z ?
|
|
756
|
+
let i = e.takeContent(t), a = e.parts[t] = Ie(e, i, r.type == z ? _.Link : _.Image, r.from, n + 1);
|
|
757
757
|
if (r.type == z) for (let n = 0; n < t; n++) {
|
|
758
758
|
let t = e.parts[n];
|
|
759
759
|
t instanceof V && t.type == z && (t.side = 0);
|
|
@@ -766,9 +766,9 @@ var U = {
|
|
|
766
766
|
};
|
|
767
767
|
function Ie(e, t, n, r, i) {
|
|
768
768
|
let { text: a } = e, o = e.char(i), s = i;
|
|
769
|
-
if (t.unshift(I(
|
|
769
|
+
if (t.unshift(I(_.LinkMark, r, r + (n == _.Image ? 2 : 1))), t.push(I(_.LinkMark, i - 1, i)), o == 40) {
|
|
770
770
|
let n = e.skipSpace(i + 1), r = Le(a, n - e.offset, e.offset), o;
|
|
771
|
-
r && (n = e.skipSpace(r.to), n != r.to && (o = Re(a, n - e.offset, e.offset), o && (n = e.skipSpace(o.to)))), e.char(n) == 41 && (t.push(I(
|
|
771
|
+
r && (n = e.skipSpace(r.to), n != r.to && (o = Re(a, n - e.offset, e.offset), o && (n = e.skipSpace(o.to)))), e.char(n) == 41 && (t.push(I(_.LinkMark, i, i + 1)), s = n + 1, r && t.push(r), o && t.push(o), t.push(I(_.LinkMark, n, s)));
|
|
772
772
|
} else if (o == 91) {
|
|
773
773
|
let n = ze(a, i - e.offset, e.offset, !1);
|
|
774
774
|
n && (t.push(n), s = n.to);
|
|
@@ -779,7 +779,7 @@ function Le(e, t, n) {
|
|
|
779
779
|
if (e.charCodeAt(t) == 60) {
|
|
780
780
|
for (let r = t + 1; r < e.length; r++) {
|
|
781
781
|
let i = e.charCodeAt(r);
|
|
782
|
-
if (i == 62) return I(
|
|
782
|
+
if (i == 62) return I(_.URL, t + n, r + 1 + n);
|
|
783
783
|
if (i == 60 || i == 10) return !1;
|
|
784
784
|
}
|
|
785
785
|
return null;
|
|
@@ -788,7 +788,7 @@ function Le(e, t, n) {
|
|
|
788
788
|
let r = 0, i = t;
|
|
789
789
|
for (let t = !1; i < e.length; i++) {
|
|
790
790
|
let n = e.charCodeAt(i);
|
|
791
|
-
if (
|
|
791
|
+
if (v(n)) break;
|
|
792
792
|
if (t) t = !1;
|
|
793
793
|
else if (n == 40) r++;
|
|
794
794
|
else if (n == 41) {
|
|
@@ -796,7 +796,7 @@ function Le(e, t, n) {
|
|
|
796
796
|
r--;
|
|
797
797
|
} else n == 92 && (t = !0);
|
|
798
798
|
}
|
|
799
|
-
return i > t ? I(
|
|
799
|
+
return i > t ? I(_.URL, t + n, i + n) : i == e.length && null;
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
function Re(e, t, n) {
|
|
@@ -806,7 +806,7 @@ function Re(e, t, n) {
|
|
|
806
806
|
for (let r = t + 1, a = !1; r < e.length; r++) {
|
|
807
807
|
let o = e.charCodeAt(r);
|
|
808
808
|
if (a) a = !1;
|
|
809
|
-
else if (o == i) return I(
|
|
809
|
+
else if (o == i) return I(_.LinkTitle, t + n, r + 1 + n);
|
|
810
810
|
else o == 92 && (a = !0);
|
|
811
811
|
}
|
|
812
812
|
return null;
|
|
@@ -815,9 +815,9 @@ function ze(e, t, n, r) {
|
|
|
815
815
|
for (let i = !1, a = t + 1, o = Math.min(e.length, a + 999); a < o; a++) {
|
|
816
816
|
let o = e.charCodeAt(a);
|
|
817
817
|
if (i) i = !1;
|
|
818
|
-
else if (o == 93) return !r && I(
|
|
818
|
+
else if (o == 93) return !r && I(_.LinkLabel, t + n, a + 1 + n);
|
|
819
819
|
else {
|
|
820
|
-
if (r && !
|
|
820
|
+
if (r && !v(o) && (r = !1), o == 91) return !1;
|
|
821
821
|
o == 92 && (i = !0);
|
|
822
822
|
}
|
|
823
823
|
}
|
|
@@ -899,7 +899,7 @@ var W = class {
|
|
|
899
899
|
return t instanceof V ? t : null;
|
|
900
900
|
}
|
|
901
901
|
skipSpace(e) {
|
|
902
|
-
return
|
|
902
|
+
return y(this.text, e - this.offset) + this.offset;
|
|
903
903
|
}
|
|
904
904
|
elt(e, t, n, r) {
|
|
905
905
|
return typeof e == "string" ? I(this.parser.getNodeType(e), t, n, r) : new Pe(e, t);
|
|
@@ -920,10 +920,10 @@ function G(e, t) {
|
|
|
920
920
|
return n;
|
|
921
921
|
}
|
|
922
922
|
var Be = [
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
923
|
+
_.CodeBlock,
|
|
924
|
+
_.ListItem,
|
|
925
|
+
_.OrderedList,
|
|
926
|
+
_.BulletList
|
|
927
927
|
], Ve = class {
|
|
928
928
|
constructor(e, t) {
|
|
929
929
|
this.fragments = e, this.input = t, this.i = 0, this.fragment = null, this.fragmentEnd = -1, this.cursor = null, e.length && (this.fragment = e[this.i++]);
|
|
@@ -948,9 +948,9 @@ var Be = [
|
|
|
948
948
|
if (!n.childAfter(r)) return !1;
|
|
949
949
|
}
|
|
950
950
|
}
|
|
951
|
-
matches(
|
|
952
|
-
let
|
|
953
|
-
return
|
|
951
|
+
matches(t) {
|
|
952
|
+
let n = this.cursor.tree;
|
|
953
|
+
return n && n.prop(e.contextHash) == t;
|
|
954
954
|
}
|
|
955
955
|
takeNodes(e) {
|
|
956
956
|
let t = this.cursor, n = this.fragment.offset, i = this.fragmentEnd - +!!this.fragment.openEnd, a = e.absoluteLineStart, o = a, s = e.block.children.length, c = o, l = s;
|
|
@@ -962,7 +962,7 @@ var Be = [
|
|
|
962
962
|
let a = He(t.from - n, e.ranges);
|
|
963
963
|
if (t.to - n <= e.ranges[e.rangeI].to) e.addNode(t.tree, a);
|
|
964
964
|
else {
|
|
965
|
-
let n = new r(e.parser.nodeSet.types[
|
|
965
|
+
let n = new r(e.parser.nodeSet.types[_.Paragraph], [], [], 0, e.block.hashProp);
|
|
966
966
|
e.reusePlaceholders.set(n, t.tree), e.addNode(n, a);
|
|
967
967
|
}
|
|
968
968
|
if (t.type.is("Block") && (Be.indexOf(t.type.id) < 0 ? (o = t.to - n, s = e.block.children.length) : (o = c, s = l), c = t.to - n, l = e.block.children.length), !t.nextSibling()) break;
|
|
@@ -979,30 +979,30 @@ function He(e, t) {
|
|
|
979
979
|
}
|
|
980
980
|
return n;
|
|
981
981
|
}
|
|
982
|
-
var Ue =
|
|
983
|
-
"Blockquote/...":
|
|
984
|
-
HorizontalRule:
|
|
985
|
-
"ATXHeading1/... SetextHeading1/...":
|
|
986
|
-
"ATXHeading2/... SetextHeading2/...":
|
|
987
|
-
"ATXHeading3/...":
|
|
988
|
-
"ATXHeading4/...":
|
|
989
|
-
"ATXHeading5/...":
|
|
990
|
-
"ATXHeading6/...":
|
|
991
|
-
"Comment CommentBlock":
|
|
992
|
-
Escape:
|
|
993
|
-
Entity:
|
|
994
|
-
"Emphasis/...":
|
|
995
|
-
"StrongEmphasis/...":
|
|
996
|
-
"Link/... Image/...":
|
|
997
|
-
"OrderedList/... BulletList/...":
|
|
998
|
-
"BlockQuote/...":
|
|
999
|
-
"InlineCode CodeText":
|
|
1000
|
-
"URL Autolink":
|
|
1001
|
-
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":
|
|
1002
|
-
"CodeInfo LinkLabel":
|
|
1003
|
-
LinkTitle:
|
|
1004
|
-
Paragraph:
|
|
1005
|
-
}), We = new je(new
|
|
982
|
+
var Ue = ce({
|
|
983
|
+
"Blockquote/...": u.quote,
|
|
984
|
+
HorizontalRule: u.contentSeparator,
|
|
985
|
+
"ATXHeading1/... SetextHeading1/...": u.heading1,
|
|
986
|
+
"ATXHeading2/... SetextHeading2/...": u.heading2,
|
|
987
|
+
"ATXHeading3/...": u.heading3,
|
|
988
|
+
"ATXHeading4/...": u.heading4,
|
|
989
|
+
"ATXHeading5/...": u.heading5,
|
|
990
|
+
"ATXHeading6/...": u.heading6,
|
|
991
|
+
"Comment CommentBlock": u.comment,
|
|
992
|
+
Escape: u.escape,
|
|
993
|
+
Entity: u.character,
|
|
994
|
+
"Emphasis/...": u.emphasis,
|
|
995
|
+
"StrongEmphasis/...": u.strong,
|
|
996
|
+
"Link/... Image/...": u.link,
|
|
997
|
+
"OrderedList/... BulletList/...": u.list,
|
|
998
|
+
"BlockQuote/...": u.quote,
|
|
999
|
+
"InlineCode CodeText": u.monospace,
|
|
1000
|
+
"URL Autolink": u.url,
|
|
1001
|
+
"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark": u.processingInstruction,
|
|
1002
|
+
"CodeInfo LinkLabel": u.labelName,
|
|
1003
|
+
LinkTitle: u.string,
|
|
1004
|
+
Paragraph: u.content
|
|
1005
|
+
}), We = new je(new oe(Me).extend(Ue), Object.keys(O).map((e) => O[e]), Object.keys(O).map((e) => A[e]), Object.keys(O), De, ge, Object.keys(U).map((e) => U[e]), Object.keys(U), []);
|
|
1006
1006
|
function Ge(e, t, n) {
|
|
1007
1007
|
let r = [];
|
|
1008
1008
|
for (let i = e.firstChild, a = t;; i = i.nextSibling) {
|
|
@@ -1016,23 +1016,23 @@ function Ge(e, t, n) {
|
|
|
1016
1016
|
return r;
|
|
1017
1017
|
}
|
|
1018
1018
|
function Ke(e) {
|
|
1019
|
-
let { codeParser: t, htmlParser:
|
|
1020
|
-
return { wrap:
|
|
1019
|
+
let { codeParser: t, htmlParser: n } = e;
|
|
1020
|
+
return { wrap: ee((e, r) => {
|
|
1021
1021
|
let i = e.type.id;
|
|
1022
|
-
if (t && (i ==
|
|
1023
|
-
let
|
|
1024
|
-
if (i ==
|
|
1025
|
-
let t = e.node.getChild(
|
|
1026
|
-
t && (
|
|
1022
|
+
if (t && (i == _.CodeBlock || i == _.FencedCode)) {
|
|
1023
|
+
let n = "";
|
|
1024
|
+
if (i == _.FencedCode) {
|
|
1025
|
+
let t = e.node.getChild(_.CodeInfo);
|
|
1026
|
+
t && (n = r.read(t.from, t.to));
|
|
1027
1027
|
}
|
|
1028
|
-
let a = t(
|
|
1028
|
+
let a = t(n);
|
|
1029
1029
|
if (a) return {
|
|
1030
1030
|
parser: a,
|
|
1031
|
-
overlay: (e) => e.type.id ==
|
|
1032
|
-
bracketed: i ==
|
|
1031
|
+
overlay: (e) => e.type.id == _.CodeText,
|
|
1032
|
+
bracketed: i == _.FencedCode
|
|
1033
1033
|
};
|
|
1034
|
-
} else if (
|
|
1035
|
-
parser:
|
|
1034
|
+
} else if (n && (i == _.HTMLBlock || i == _.HTMLTag || i == _.CommentBlock)) return {
|
|
1035
|
+
parser: n,
|
|
1036
1036
|
overlay: Ge(e.node, e.from, e.to)
|
|
1037
1037
|
};
|
|
1038
1038
|
return null;
|
|
@@ -1044,10 +1044,10 @@ var qe = {
|
|
|
1044
1044
|
}, Je = {
|
|
1045
1045
|
defineNodes: [{
|
|
1046
1046
|
name: "Strikethrough",
|
|
1047
|
-
style: { "Strikethrough/...":
|
|
1047
|
+
style: { "Strikethrough/...": u.strikethrough }
|
|
1048
1048
|
}, {
|
|
1049
1049
|
name: "StrikethroughMark",
|
|
1050
|
-
style:
|
|
1050
|
+
style: u.processingInstruction
|
|
1051
1051
|
}],
|
|
1052
1052
|
parseInline: [{
|
|
1053
1053
|
name: "Strikethrough",
|
|
@@ -1106,16 +1106,16 @@ var Xe = /^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/, Ze = class {
|
|
|
1106
1106
|
},
|
|
1107
1107
|
{
|
|
1108
1108
|
name: "TableHeader",
|
|
1109
|
-
style: { "TableHeader/...":
|
|
1109
|
+
style: { "TableHeader/...": u.heading }
|
|
1110
1110
|
},
|
|
1111
1111
|
"TableRow",
|
|
1112
1112
|
{
|
|
1113
1113
|
name: "TableCell",
|
|
1114
|
-
style:
|
|
1114
|
+
style: u.content
|
|
1115
1115
|
},
|
|
1116
1116
|
{
|
|
1117
1117
|
name: "TableDelimiter",
|
|
1118
|
-
style:
|
|
1118
|
+
style: u.processingInstruction
|
|
1119
1119
|
}
|
|
1120
1120
|
],
|
|
1121
1121
|
parseBlock: [{
|
|
@@ -1141,10 +1141,10 @@ var Xe = /^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/, Ze = class {
|
|
|
1141
1141
|
defineNodes: [{
|
|
1142
1142
|
name: "Task",
|
|
1143
1143
|
block: !0,
|
|
1144
|
-
style:
|
|
1144
|
+
style: u.list
|
|
1145
1145
|
}, {
|
|
1146
1146
|
name: "TaskMarker",
|
|
1147
|
-
style:
|
|
1147
|
+
style: u.atom
|
|
1148
1148
|
}],
|
|
1149
1149
|
parseBlock: [{
|
|
1150
1150
|
name: "TaskList",
|
|
@@ -1201,7 +1201,7 @@ function ut(e, t, n) {
|
|
|
1201
1201
|
for (let i = a + 1; i < r.end; i++) {
|
|
1202
1202
|
let s = r.char(i);
|
|
1203
1203
|
if (s == e) return r.addElement(r.elt(t, a, i + 1, o.concat(r.elt(n, i, i + 1))));
|
|
1204
|
-
if (s == 92 && o.push(r.elt("Escape", i, i++ + 2)),
|
|
1204
|
+
if (s == 92 && o.push(r.elt("Escape", i, i++ + 2)), v(s)) break;
|
|
1205
1205
|
}
|
|
1206
1206
|
return -1;
|
|
1207
1207
|
};
|
|
@@ -1209,10 +1209,10 @@ function ut(e, t, n) {
|
|
|
1209
1209
|
var dt = {
|
|
1210
1210
|
defineNodes: [{
|
|
1211
1211
|
name: "Superscript",
|
|
1212
|
-
style:
|
|
1212
|
+
style: u.special(u.content)
|
|
1213
1213
|
}, {
|
|
1214
1214
|
name: "SuperscriptMark",
|
|
1215
|
-
style:
|
|
1215
|
+
style: u.processingInstruction
|
|
1216
1216
|
}],
|
|
1217
1217
|
parseInline: [{
|
|
1218
1218
|
name: "Superscript",
|
|
@@ -1221,10 +1221,10 @@ var dt = {
|
|
|
1221
1221
|
}, ft = {
|
|
1222
1222
|
defineNodes: [{
|
|
1223
1223
|
name: "Subscript",
|
|
1224
|
-
style:
|
|
1224
|
+
style: u.special(u.content)
|
|
1225
1225
|
}, {
|
|
1226
1226
|
name: "SubscriptMark",
|
|
1227
|
-
style:
|
|
1227
|
+
style: u.processingInstruction
|
|
1228
1228
|
}],
|
|
1229
1229
|
parseInline: [{
|
|
1230
1230
|
name: "Subscript",
|
|
@@ -1233,7 +1233,7 @@ var dt = {
|
|
|
1233
1233
|
}, pt = {
|
|
1234
1234
|
defineNodes: [{
|
|
1235
1235
|
name: "Emoji",
|
|
1236
|
-
style:
|
|
1236
|
+
style: u.character
|
|
1237
1237
|
}],
|
|
1238
1238
|
parseInline: [{
|
|
1239
1239
|
name: "Emoji",
|
|
@@ -1242,17 +1242,17 @@ var dt = {
|
|
|
1242
1242
|
return t != 58 || !(r = /^[a-zA-Z_0-9]+:/.exec(e.slice(n + 1, e.end))) ? -1 : e.addElement(e.elt("Emoji", n, n + 1 + r[0].length));
|
|
1243
1243
|
}
|
|
1244
1244
|
}]
|
|
1245
|
-
}, mt = /*@__PURE__*/
|
|
1245
|
+
}, mt = /*@__PURE__*/ d({ commentTokens: { block: {
|
|
1246
1246
|
open: "<!--",
|
|
1247
1247
|
close: "-->"
|
|
1248
|
-
} } }), ht = /*@__PURE__*/ new
|
|
1249
|
-
/*@__PURE__*/
|
|
1248
|
+
} } }), ht = /*@__PURE__*/ new e(), gt = /*@__PURE__*/ We.configure({ props: [
|
|
1249
|
+
/*@__PURE__*/ s.add((e) => !e.is("Block") || e.is("Document") || q(e) != null || _t(e) ? void 0 : (e, t) => ({
|
|
1250
1250
|
from: t.doc.lineAt(e.from).to,
|
|
1251
1251
|
to: e.to
|
|
1252
1252
|
})),
|
|
1253
1253
|
/*@__PURE__*/ ht.add(q),
|
|
1254
|
-
/*@__PURE__*/
|
|
1255
|
-
/*@__PURE__*/
|
|
1254
|
+
/*@__PURE__*/ se.add({ Document: () => null }),
|
|
1255
|
+
/*@__PURE__*/ i.add({ Document: mt })
|
|
1256
1256
|
] });
|
|
1257
1257
|
function q(e) {
|
|
1258
1258
|
let t = /^(?:ATX|Setext)Heading(\d)$/.exec(e.name);
|
|
@@ -1270,8 +1270,8 @@ function vt(e, t) {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
return n.to;
|
|
1272
1272
|
}
|
|
1273
|
-
var yt = /*@__PURE__*/
|
|
1274
|
-
for (let r =
|
|
1273
|
+
var yt = /*@__PURE__*/ ie.of((e, t, n) => {
|
|
1274
|
+
for (let r = h(e).resolveInner(n, -1); r && !(r.from < t); r = r.parent) {
|
|
1275
1275
|
let e = r.type.prop(ht);
|
|
1276
1276
|
if (e == null) continue;
|
|
1277
1277
|
let t = vt(r, e);
|
|
@@ -1290,7 +1290,7 @@ var bt = /*@__PURE__*/ J(gt), Y = /*@__PURE__*/ J(/* @__PURE__ */ gt.configure([
|
|
|
1290
1290
|
ft,
|
|
1291
1291
|
dt,
|
|
1292
1292
|
pt,
|
|
1293
|
-
{ props: [/*@__PURE__*/
|
|
1293
|
+
{ props: [/*@__PURE__*/ s.add({ Table: (e, t) => ({
|
|
1294
1294
|
from: t.doc.lineAt(e.from).to,
|
|
1295
1295
|
to: e.to
|
|
1296
1296
|
}) })] }
|
|
@@ -1299,7 +1299,7 @@ function xt(e, t) {
|
|
|
1299
1299
|
return (n) => {
|
|
1300
1300
|
if (n && e) {
|
|
1301
1301
|
let t = null;
|
|
1302
|
-
if (n = /\S*/.exec(n)[0], t = typeof e == "function" ? e(n) :
|
|
1302
|
+
if (n = /\S*/.exec(n)[0], t = typeof e == "function" ? e(n) : p.matchLanguageName(e, n, !0), t instanceof p) return t.support ? t.support.language.parser : te.getSkippingParser(t.load());
|
|
1303
1303
|
if (t) return t.parser;
|
|
1304
1304
|
}
|
|
1305
1305
|
return t ? t.parser : null;
|
|
@@ -1368,56 +1368,56 @@ function Z(e, t, n, r = 0) {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
function Q(e, t) {
|
|
1370
1370
|
let n = /^[ \t]*/.exec(e)[0].length;
|
|
1371
|
-
if (!n || t.facet(
|
|
1372
|
-
let r =
|
|
1371
|
+
if (!n || t.facet(ae) != " ") return e;
|
|
1372
|
+
let r = g(e, 4, n), i = "";
|
|
1373
1373
|
for (let e = r; e > 0;) e >= 4 ? (i += " ", e -= 4) : (i += " ", e--);
|
|
1374
1374
|
return i + e.slice(n);
|
|
1375
1375
|
}
|
|
1376
1376
|
var wt = /*@__PURE__*/ ((e = {}) => ({ state: t, dispatch: n }) => {
|
|
1377
|
-
let r =
|
|
1377
|
+
let r = h(t), { doc: i } = t, a = null, o = t.changeByRange((n) => {
|
|
1378
1378
|
if (!n.empty || !Y.isActiveAt(t, n.from, -1) && !Y.isActiveAt(t, n.from, 1)) return a = { range: n };
|
|
1379
|
-
let
|
|
1380
|
-
for (;
|
|
1381
|
-
if (!
|
|
1382
|
-
let
|
|
1383
|
-
if (
|
|
1384
|
-
let
|
|
1385
|
-
if (
|
|
1386
|
-
if (
|
|
1387
|
-
let r =
|
|
1388
|
-
if (r.to >=
|
|
1389
|
-
let e =
|
|
1390
|
-
e && e.item ? (t =
|
|
1379
|
+
let o = n.from, s = i.lineAt(o), c = St(r.resolveInner(o, -1), i);
|
|
1380
|
+
for (; c.length && c[c.length - 1].from > o - s.from;) c.pop();
|
|
1381
|
+
if (!c.length) return a = { range: n };
|
|
1382
|
+
let l = c[c.length - 1];
|
|
1383
|
+
if (l.to - l.spaceAfter.length > o - s.from) return a = { range: n };
|
|
1384
|
+
let u = o >= l.to - l.spaceAfter.length && !/\S/.test(s.text.slice(l.to));
|
|
1385
|
+
if (l.item && u) {
|
|
1386
|
+
if (l.item.from < s.from && !/^[\s>]*$/.test(s.text.slice(0, l.to))) return a = { range: n };
|
|
1387
|
+
let r = l.node.firstChild, u = l.node.getChild("ListItem", "ListItem");
|
|
1388
|
+
if (r.to >= o || u && u.to < o || s.from > 0 && !/[^\s>]/.test(i.lineAt(s.from - 1).text) || e.nonTightLists === !1) {
|
|
1389
|
+
let e = c.length > 1 ? c[c.length - 2] : null, t, n = "";
|
|
1390
|
+
e && e.item ? (t = s.from + e.from, n = e.marker(i, 1)) : t = s.from + (e ? e.to : 0);
|
|
1391
1391
|
let r = [{
|
|
1392
1392
|
from: t,
|
|
1393
|
-
to:
|
|
1393
|
+
to: o,
|
|
1394
1394
|
insert: n
|
|
1395
1395
|
}];
|
|
1396
|
-
return
|
|
1397
|
-
range:
|
|
1396
|
+
return l.node.name == "OrderedList" && Z(l.item, i, r, -2), e && e.node.name == "OrderedList" && Z(e.item, i, r), {
|
|
1397
|
+
range: f.cursor(t + n.length),
|
|
1398
1398
|
changes: r
|
|
1399
1399
|
};
|
|
1400
1400
|
}
|
|
1401
1401
|
{
|
|
1402
|
-
let e = Dt(
|
|
1402
|
+
let e = Dt(c, t, s);
|
|
1403
1403
|
return {
|
|
1404
|
-
range:
|
|
1404
|
+
range: f.cursor(o + e.length + 1),
|
|
1405
1405
|
changes: {
|
|
1406
|
-
from:
|
|
1406
|
+
from: s.from,
|
|
1407
1407
|
insert: e + t.lineBreak
|
|
1408
1408
|
}
|
|
1409
1409
|
};
|
|
1410
1410
|
}
|
|
1411
1411
|
}
|
|
1412
|
-
if (
|
|
1413
|
-
let e = i.lineAt(
|
|
1414
|
-
if (r && r.index ==
|
|
1412
|
+
if (l.node.name == "Blockquote" && u && s.from) {
|
|
1413
|
+
let e = i.lineAt(s.from - 1), r = />\s*$/.exec(e.text);
|
|
1414
|
+
if (r && r.index == l.from) {
|
|
1415
1415
|
let i = t.changes([{
|
|
1416
1416
|
from: e.from + r.index,
|
|
1417
1417
|
to: e.to
|
|
1418
1418
|
}, {
|
|
1419
|
-
from:
|
|
1420
|
-
to:
|
|
1419
|
+
from: s.from + l.from,
|
|
1420
|
+
to: s.to
|
|
1421
1421
|
}]);
|
|
1422
1422
|
return {
|
|
1423
1423
|
range: n.map(i),
|
|
@@ -1425,22 +1425,22 @@ var wt = /*@__PURE__*/ ((e = {}) => ({ state: t, dispatch: n }) => {
|
|
|
1425
1425
|
};
|
|
1426
1426
|
}
|
|
1427
1427
|
}
|
|
1428
|
-
let
|
|
1429
|
-
|
|
1430
|
-
let p =
|
|
1431
|
-
if (!p || /^[\s\d.)\-+*>]*/.exec(
|
|
1432
|
-
let
|
|
1433
|
-
for (;
|
|
1434
|
-
return
|
|
1435
|
-
from:
|
|
1436
|
-
to:
|
|
1437
|
-
insert: t.lineBreak +
|
|
1428
|
+
let d = [];
|
|
1429
|
+
l.node.name == "OrderedList" && Z(l.item, i, d);
|
|
1430
|
+
let p = l.item && l.item.from < s.from, m = "";
|
|
1431
|
+
if (!p || /^[\s\d.)\-+*>]*/.exec(s.text)[0].length >= l.to) for (let e = 0, t = c.length - 1; e <= t; e++) m += e == t && !p ? c[e].marker(i, 1) : c[e].blank(e < t ? g(s.text, 4, c[e + 1].from) - m.length : null);
|
|
1432
|
+
let h = o;
|
|
1433
|
+
for (; h > s.from && /\s/.test(s.text.charAt(h - s.from - 1));) h--;
|
|
1434
|
+
return m = Q(m, t), Et(l.node, t.doc) && (m = Dt(c, t, s) + t.lineBreak + m), d.push({
|
|
1435
|
+
from: h,
|
|
1436
|
+
to: o,
|
|
1437
|
+
insert: t.lineBreak + m
|
|
1438
1438
|
}), {
|
|
1439
|
-
range:
|
|
1440
|
-
changes:
|
|
1439
|
+
range: f.cursor(h + m.length + 1),
|
|
1440
|
+
changes: d
|
|
1441
1441
|
};
|
|
1442
1442
|
});
|
|
1443
|
-
return !a && (n(t.update(
|
|
1443
|
+
return !a && (n(t.update(o, {
|
|
1444
1444
|
scrollIntoView: !0,
|
|
1445
1445
|
userEvent: "input"
|
|
1446
1446
|
})), !0);
|
|
@@ -1457,7 +1457,7 @@ function Et(e, t) {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
function Dt(e, t, n) {
|
|
1459
1459
|
let r = "";
|
|
1460
|
-
for (let t = 0, i = e.length - 2; t <= i; t++) r += e[t].blank(t < i ?
|
|
1460
|
+
for (let t = 0, i = e.length - 2; t <= i; t++) r += e[t].blank(t < i ? g(n.text, 4, e[t + 1].from) - r.length : null, t < i);
|
|
1461
1461
|
return Q(r, t);
|
|
1462
1462
|
}
|
|
1463
1463
|
function Ot(e, t) {
|
|
@@ -1474,14 +1474,14 @@ var kt = [{
|
|
|
1474
1474
|
}, {
|
|
1475
1475
|
key: "Backspace",
|
|
1476
1476
|
run: ({ state: e, dispatch: t }) => {
|
|
1477
|
-
let n =
|
|
1477
|
+
let n = h(e), r = null, i = e.changeByRange((t) => {
|
|
1478
1478
|
let i = t.from, { doc: a } = e;
|
|
1479
1479
|
if (t.empty && Y.isActiveAt(e, t.from)) {
|
|
1480
1480
|
let t = a.lineAt(i), r = St(Ot(n, i), a);
|
|
1481
1481
|
if (r.length) {
|
|
1482
1482
|
let n = r[r.length - 1], a = n.to - n.spaceAfter.length + +!!n.spaceAfter;
|
|
1483
1483
|
if (i - t.from > a && !/\S/.test(t.text.slice(a, i - t.from))) return {
|
|
1484
|
-
range:
|
|
1484
|
+
range: f.cursor(t.from + a),
|
|
1485
1485
|
changes: {
|
|
1486
1486
|
from: t.from + a,
|
|
1487
1487
|
to: i
|
|
@@ -1490,9 +1490,9 @@ var kt = [{
|
|
|
1490
1490
|
if (i - t.from == a && (n.item && t.from <= n.item.from || /^[\s>]*$/.test(t.text.slice(0, n.to)))) {
|
|
1491
1491
|
let r = t.from + n.from;
|
|
1492
1492
|
if (n.item && n.node.from < n.item.from && /\S/.test(t.text.slice(n.from, n.to))) {
|
|
1493
|
-
let i = n.blank(
|
|
1493
|
+
let i = n.blank(g(t.text, 4, n.to) - g(t.text, 4, n.from));
|
|
1494
1494
|
return r == t.from && (i = Q(i, e)), {
|
|
1495
|
-
range:
|
|
1495
|
+
range: f.cursor(r + i.length),
|
|
1496
1496
|
changes: {
|
|
1497
1497
|
from: r,
|
|
1498
1498
|
to: t.from + n.to,
|
|
@@ -1501,7 +1501,7 @@ var kt = [{
|
|
|
1501
1501
|
};
|
|
1502
1502
|
}
|
|
1503
1503
|
if (r < i) return {
|
|
1504
|
-
range:
|
|
1504
|
+
range: f.cursor(r),
|
|
1505
1505
|
changes: {
|
|
1506
1506
|
from: r,
|
|
1507
1507
|
to: i
|
|
@@ -1517,24 +1517,24 @@ var kt = [{
|
|
|
1517
1517
|
userEvent: "delete"
|
|
1518
1518
|
})), !0);
|
|
1519
1519
|
}
|
|
1520
|
-
}], At = /*@__PURE__*/
|
|
1520
|
+
}], At = /*@__PURE__*/ le({ matchClosingTags: !1 });
|
|
1521
1521
|
function jt(e = {}) {
|
|
1522
|
-
let { codeLanguages: t, defaultCodeLanguage: n, addKeymap: r = !0, base: { parser:
|
|
1523
|
-
if (!(
|
|
1524
|
-
let
|
|
1525
|
-
s &&
|
|
1526
|
-
let p = t ||
|
|
1527
|
-
|
|
1522
|
+
let { codeLanguages: t, defaultCodeLanguage: n, addKeymap: r = !0, base: { parser: i } = bt, completeHTMLTags: a = !0, pasteURLAsLink: s = !0, htmlTagLanguage: c = At } = e;
|
|
1523
|
+
if (!(i instanceof je)) throw RangeError("Base parser provided to `markdown` should be a Markdown parser");
|
|
1524
|
+
let u = e.extensions ? [e.extensions] : [], d = [c.support, yt], f;
|
|
1525
|
+
s && d.push(Ft), n instanceof l ? (d.push(n.support), f = n.language) : n && (f = n);
|
|
1526
|
+
let p = t || f ? xt(t, f) : void 0;
|
|
1527
|
+
u.push(Ke({
|
|
1528
1528
|
codeParser: p,
|
|
1529
1529
|
htmlParser: c.language.parser
|
|
1530
|
-
})), r &&
|
|
1531
|
-
let
|
|
1532
|
-
return
|
|
1530
|
+
})), r && d.push(m.high(o.of(kt)));
|
|
1531
|
+
let h = J(i.configure(u));
|
|
1532
|
+
return a && d.push(h.data.of({ autocomplete: Mt })), new l(h, d);
|
|
1533
1533
|
}
|
|
1534
1534
|
function Mt(e) {
|
|
1535
1535
|
let { state: t, pos: n } = e, r = /<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n - 25, n));
|
|
1536
1536
|
if (!r) return null;
|
|
1537
|
-
let i =
|
|
1537
|
+
let i = h(t).resolveInner(n, -1);
|
|
1538
1538
|
for (; i && !i.type.isTop;) {
|
|
1539
1539
|
if (i.name == "CodeBlock" || i.name == "FencedCode" || i.name == "ProcessingInstructionBlock" || i.name == "CommentBlock" || i.name == "Link" || i.name == "Image") return null;
|
|
1540
1540
|
i = i.parent;
|
|
@@ -1549,15 +1549,15 @@ function Mt(e) {
|
|
|
1549
1549
|
var $ = null;
|
|
1550
1550
|
function Nt() {
|
|
1551
1551
|
if ($) return $;
|
|
1552
|
-
let
|
|
1553
|
-
return $ =
|
|
1552
|
+
let e = ue(new de(re.create({ extensions: At }), 0, !0));
|
|
1553
|
+
return $ = e ? e.options : [];
|
|
1554
1554
|
}
|
|
1555
|
-
var Pt = /code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i, Ft = /*@__PURE__*/
|
|
1555
|
+
var Pt = /code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i, Ft = /*@__PURE__*/ n.domEventHandlers({ paste: (e, t) => {
|
|
1556
1556
|
let { main: n } = t.state.selection;
|
|
1557
1557
|
if (n.empty) return !1;
|
|
1558
1558
|
let r = e.clipboardData?.getData("text/plain");
|
|
1559
1559
|
if (!r || !/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r) || (/^www\./.test(r) && (r = "https://" + r), !Y.isActiveAt(t.state, n.from, 1))) return !1;
|
|
1560
|
-
let i =
|
|
1560
|
+
let i = h(t.state), a = !1;
|
|
1561
1561
|
return i.iterate({
|
|
1562
1562
|
from: n.from,
|
|
1563
1563
|
to: n.to,
|