@flyfish-group/file-viewer3 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/dist/components/ImageViewer.js +795 -743
  3. package/dist/components/MarkdownViewer.js +990 -1099
  4. package/dist/components/PdfView.js +20049 -19079
  5. package/dist/components/PptxRender.js +7101 -6518
  6. package/dist/components/XlsxTable.js +48841 -64918
  7. package/dist/components/_commonjsHelpers.js +15 -21
  8. package/dist/components/docx-preview.js +5622 -0
  9. package/dist/components/index.js +819 -702
  10. package/dist/components/utils.d.ts +3 -0
  11. package/dist/index.umd.js +193 -382
  12. package/dist/main.d.ts +0 -0
  13. package/dist/package/components/FileViewer/FileViewer.vue.d.ts +18 -0
  14. package/dist/package/vendors/image/ImageViewer.vue.d.ts +15 -0
  15. package/dist/package/vendors/md/MarkdownViewer.vue.d.ts +15 -0
  16. package/dist/package/vendors/pdf/PdfView.vue.d.ts +15 -0
  17. package/dist/package/vendors/pptx/PptxRender.vue.d.ts +87 -0
  18. package/dist/{src/package → package}/vendors/pptx/index.d.ts +1 -1
  19. package/dist/{src/package → package}/vendors/renders.d.ts +1 -1
  20. package/dist/package/vendors/text/CodeViewer.vue.d.ts +15 -0
  21. package/dist/package/vendors/xlsx/XlsxTable.vue.d.ts +17 -0
  22. package/dist/package/vendors/xlsx/worker/xls/sheet.worker.d.ts +1 -0
  23. package/dist/package/vendors/xlsx/worker/xlsx/xlsx.worker.d.ts +2 -0
  24. package/dist/style.css +23 -23
  25. package/dist/worker/pdf.worker.js +37 -45
  26. package/dist/worker/pptx.worker.js +7 -7
  27. package/dist/worker/sheet.worker.js +24 -24
  28. package/dist/worker/xlsx.worker.js +43 -46
  29. package/package.json +21 -20
  30. package/dist/components/docx-preview.min.js +0 -5287
  31. package/dist/src/package/components/FileViewer/FileViewer.vue.d.ts +0 -25
  32. package/dist/src/package/vendors/image/ImageViewer.vue.d.ts +0 -13
  33. package/dist/src/package/vendors/md/MarkdownViewer.vue.d.ts +0 -13
  34. package/dist/src/package/vendors/pdf/PdfView.vue.d.ts +0 -13
  35. package/dist/src/package/vendors/pptx/PptxRender.vue.d.ts +0 -81
  36. package/dist/src/package/vendors/text/CodeViewer.vue.d.ts +0 -13
  37. package/dist/src/package/vendors/xlsx/XlsxTable.vue.d.ts +0 -21
  38. /package/dist/{src/package → package}/common/type.d.ts +0 -0
  39. /package/dist/{src/package → package}/common/util.d.ts +0 -0
  40. /package/dist/{src/package → package}/common/worker-ref.d.ts +0 -0
  41. /package/dist/{src/package → package}/components/FileViewer/index.d.ts +0 -0
  42. /package/dist/{src/package → package}/components/FileViewer/util.d.ts +0 -0
  43. /package/dist/{src/package → package}/index.d.ts +0 -0
  44. /package/dist/{src/package → package}/use/index.d.ts +0 -0
  45. /package/dist/{src/package → package}/use/worker.d.ts +0 -0
  46. /package/dist/{src/package → package}/vendors/docx/index.d.ts +0 -0
  47. /package/dist/{src/package → package}/vendors/image/index.d.ts +0 -0
  48. /package/dist/{src/package → package}/vendors/md/index.d.ts +0 -0
  49. /package/dist/{src/package → package}/vendors/mp4/index.d.ts +0 -0
  50. /package/dist/{src/package → package}/vendors/pdf/index.d.ts +0 -0
  51. /package/dist/{src/package → package}/vendors/pdf/worker/index.d.ts +0 -0
  52. /package/dist/{src/package → package}/vendors/pptx/options.d.ts +0 -0
  53. /package/dist/{src/package → package}/vendors/pptx/support/chart.d.ts +0 -0
  54. /package/dist/{src/package → package}/vendors/pptx/worker/index.d.ts +0 -0
  55. /package/dist/{src/package → package}/vendors/text/index.d.ts +0 -0
  56. /package/dist/{src/package → package}/vendors/xlsx/index.d.ts +0 -0
  57. /package/dist/{src/package → package}/vendors/xlsx/render.d.ts +0 -0
  58. /package/dist/{src/package → package}/vendors/xlsx/util.d.ts +0 -0
  59. /package/dist/{src/package → package}/vendors/xlsx/worker/index.d.ts +0 -0
  60. /package/dist/{src/package → package}/vendors/xlsx/worker/xls/SheetJsModel.d.ts +0 -0
  61. /package/dist/{src/package → package}/vendors/xlsx/worker/xls/index.d.ts +0 -0
  62. /package/dist/{src/package → package}/vendors/xlsx/worker/xlsx/ExcelJsModel.d.ts +0 -0
  63. /package/dist/{src/package → package}/vendors/xlsx/worker/xlsx/color.d.ts +0 -0
  64. /package/dist/{src/package → package}/vendors/xlsx/worker/xlsx/context.d.ts +0 -0
  65. /package/dist/{src/package → package}/vendors/xlsx/worker/xlsx/index.d.ts +0 -0
  66. /package/dist/{src/package → package}/vendors/xlsx/worker/xlsx/util.d.ts +0 -0
@@ -1,576 +1,576 @@
1
- var Y = Object.defineProperty;
2
- var ee = (o, n, t) => n in o ? Y(o, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[n] = t;
3
- var O = (o, n, t) => (ee(o, typeof n != "symbol" ? n + "" : n, t), t);
4
- import { defineComponent as te, computed as ne, openBlock as ie, createElementBlock as se, unref as re } from "vue";
5
- import { _ as le } from "./index.js";
6
- function F() {
1
+ var we = Object.defineProperty, ye = Object.defineProperties;
2
+ var $e = Object.getOwnPropertyDescriptors;
3
+ var se = Object.getOwnPropertySymbols;
4
+ var Te = Object.prototype.hasOwnProperty, _e = Object.prototype.propertyIsEnumerable;
5
+ var H = (a, t, e) => t in a ? we(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e, x = (a, t) => {
6
+ for (var e in t || (t = {}))
7
+ Te.call(t, e) && H(a, e, t[e]);
8
+ if (se)
9
+ for (var e of se(t))
10
+ _e.call(t, e) && H(a, e, t[e]);
11
+ return a;
12
+ }, R = (a, t) => ye(a, $e(t));
13
+ var d = (a, t, e) => (H(a, typeof t != "symbol" ? t + "" : t, e), e), ze = (a, t, e) => {
14
+ if (!t.has(a))
15
+ throw TypeError("Cannot " + e);
16
+ };
17
+ var N = (a, t, e) => {
18
+ if (t.has(a))
19
+ throw TypeError("Cannot add the same private member more than once");
20
+ t instanceof WeakSet ? t.add(a) : t.set(a, e);
21
+ };
22
+ var v = (a, t, e) => (ze(a, t, "access private method"), e);
23
+ import { defineComponent as Re, computed as Ie, openBlock as Se, createElementBlock as Ae } from "vue";
24
+ import { _ as Ee } from "./index.js";
25
+ function V() {
7
26
  return {
8
27
  async: !1,
9
- baseUrl: null,
10
28
  breaks: !1,
11
29
  extensions: null,
12
30
  gfm: !0,
13
- headerIds: !0,
14
- headerPrefix: "",
15
- highlight: null,
16
31
  hooks: null,
17
- langPrefix: "language-",
18
- mangle: !0,
19
32
  pedantic: !1,
20
33
  renderer: null,
21
- sanitize: !1,
22
- sanitizer: null,
23
34
  silent: !1,
24
- smartypants: !1,
25
35
  tokenizer: null,
26
- walkTokens: null,
27
- xhtml: !1
36
+ walkTokens: null
28
37
  };
29
38
  }
30
- let I = F();
31
- function oe(o) {
32
- I = o;
39
+ let z = V();
40
+ function ce(a) {
41
+ z = a;
33
42
  }
34
- const V = /[&<>"']/, ae = new RegExp(V.source, "g"), X = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, ce = new RegExp(X.source, "g"), he = {
43
+ const he = /[&<>"']/, Le = new RegExp(he.source, "g"), pe = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, Ce = new RegExp(pe.source, "g"), ve = {
35
44
  "&": "&amp;",
36
45
  "<": "&lt;",
37
46
  ">": "&gt;",
38
47
  '"': "&quot;",
39
48
  "'": "&#39;"
40
- }, U = (o) => he[o];
41
- function b(o, n) {
42
- if (n) {
43
- if (V.test(o))
44
- return o.replace(ae, U);
45
- } else if (X.test(o))
46
- return o.replace(ce, U);
47
- return o;
49
+ }, ie = (a) => ve[a];
50
+ function m(a, t) {
51
+ if (t) {
52
+ if (he.test(a))
53
+ return a.replace(Le, ie);
54
+ } else if (pe.test(a))
55
+ return a.replace(Ce, ie);
56
+ return a;
48
57
  }
49
- const ue = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
50
- function W(o) {
51
- return o.replace(ue, (n, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : ""));
58
+ const Be = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
59
+ function Ze(a) {
60
+ return a.replace(Be, (t, e) => (e = e.toLowerCase(), e === "colon" ? ":" : e.charAt(0) === "#" ? e.charAt(1) === "x" ? String.fromCharCode(parseInt(e.substring(2), 16)) : String.fromCharCode(+e.substring(1)) : ""));
52
61
  }
53
- const pe = /(^|[^\[])\^/g;
54
- function m(o, n) {
55
- o = typeof o == "string" ? o : o.source, n = n || "";
56
- const t = {
57
- replace: (e, i) => (i = i.source || i, i = i.replace(pe, "$1"), o = o.replace(e, i), t),
58
- getRegex: () => new RegExp(o, n)
62
+ const Pe = /(^|[^\[])\^/g;
63
+ function k(a, t) {
64
+ let e = typeof a == "string" ? a : a.source;
65
+ t = t || "";
66
+ const n = {
67
+ replace: (r, i) => {
68
+ let s = typeof i == "string" ? i : i.source;
69
+ return s = s.replace(Pe, "$1"), e = e.replace(r, s), n;
70
+ },
71
+ getRegex: () => new RegExp(e, t)
59
72
  };
60
- return t;
73
+ return n;
61
74
  }
62
- const fe = /[^\w:]/g, ge = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
63
- function P(o, n, t) {
64
- if (o) {
65
- let e;
66
- try {
67
- e = decodeURIComponent(W(t)).replace(fe, "").toLowerCase();
68
- } catch {
69
- return null;
70
- }
71
- if (e.indexOf("javascript:") === 0 || e.indexOf("vbscript:") === 0 || e.indexOf("data:") === 0)
72
- return null;
73
- }
74
- n && !ge.test(t) && (t = xe(n, t));
75
+ function re(a) {
75
76
  try {
76
- t = encodeURI(t).replace(/%25/g, "%");
77
- } catch {
77
+ a = encodeURI(a).replace(/%25/g, "%");
78
+ } catch (t) {
78
79
  return null;
79
80
  }
80
- return t;
81
+ return a;
81
82
  }
82
- const L = {}, de = /^[^:]+:\/*[^/]*$/, ke = /^([^:]+:)[\s\S]*$/, me = /^([^:]+:\/*[^/]*)[\s\S]*$/;
83
- function xe(o, n) {
84
- L[" " + o] || (de.test(o) ? L[" " + o] = o + "/" : L[" " + o] = B(o, "/", !0)), o = L[" " + o];
85
- const t = o.indexOf(":") === -1;
86
- return n.substring(0, 2) === "//" ? t ? n : o.replace(ke, "$1") + n : n.charAt(0) === "/" ? t ? n : o.replace(me, "$1") + n : o + n;
87
- }
88
- const Z = { exec: function() {
89
- } };
90
- function Q(o, n) {
91
- const t = o.replace(/\|/g, (s, r, l) => {
92
- let c = !1, d = r;
93
- for (; --d >= 0 && l[d] === "\\"; )
94
- c = !c;
95
- return c ? "|" : " |";
96
- }), e = t.split(/ \|/);
97
- let i = 0;
98
- if (e[0].trim() || e.shift(), e.length > 0 && !e[e.length - 1].trim() && e.pop(), e.length > n)
99
- e.splice(n);
100
- else
101
- for (; e.length < n; )
102
- e.push("");
103
- for (; i < e.length; i++)
104
- e[i] = e[i].trim().replace(/\\\|/g, "|");
105
- return e;
83
+ const S = { exec: () => null };
84
+ function le(a, t) {
85
+ const e = a.replace(/\|/g, (i, s, l) => {
86
+ let o = !1, p = s;
87
+ for (; --p >= 0 && l[p] === "\\"; )
88
+ o = !o;
89
+ return o ? "|" : " |";
90
+ }), n = e.split(/ \|/);
91
+ let r = 0;
92
+ if (n[0].trim() || n.shift(), n.length > 0 && !n[n.length - 1].trim() && n.pop(), t)
93
+ if (n.length > t)
94
+ n.splice(t);
95
+ else
96
+ for (; n.length < t; )
97
+ n.push("");
98
+ for (; r < n.length; r++)
99
+ n[r] = n[r].trim().replace(/\\\|/g, "|");
100
+ return n;
106
101
  }
107
- function B(o, n, t) {
108
- const e = o.length;
109
- if (e === 0)
102
+ function B(a, t, e) {
103
+ const n = a.length;
104
+ if (n === 0)
110
105
  return "";
111
- let i = 0;
112
- for (; i < e; ) {
113
- const s = o.charAt(e - i - 1);
114
- if (s === n && !t)
115
- i++;
116
- else if (s !== n && t)
117
- i++;
106
+ let r = 0;
107
+ for (; r < n; ) {
108
+ const i = a.charAt(n - r - 1);
109
+ if (i === t && !e)
110
+ r++;
111
+ else if (i !== t && e)
112
+ r++;
118
113
  else
119
114
  break;
120
115
  }
121
- return o.slice(0, e - i);
116
+ return a.slice(0, n - r);
122
117
  }
123
- function we(o, n) {
124
- if (o.indexOf(n[1]) === -1)
118
+ function qe(a, t) {
119
+ if (a.indexOf(t[1]) === -1)
125
120
  return -1;
126
- const t = o.length;
127
- let e = 0, i = 0;
128
- for (; i < t; i++)
129
- if (o[i] === "\\")
130
- i++;
131
- else if (o[i] === n[0])
121
+ let e = 0;
122
+ for (let n = 0; n < a.length; n++)
123
+ if (a[n] === "\\")
124
+ n++;
125
+ else if (a[n] === t[0])
132
126
  e++;
133
- else if (o[i] === n[1] && (e--, e < 0))
134
- return i;
127
+ else if (a[n] === t[1] && (e--, e < 0))
128
+ return n;
135
129
  return -1;
136
130
  }
137
- function be(o) {
138
- o && o.sanitize && !o.silent && console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options");
139
- }
140
- function j(o, n) {
141
- if (n < 1)
142
- return "";
143
- let t = "";
144
- for (; n > 1; )
145
- n & 1 && (t += o), n >>= 1, o += o;
146
- return t + o;
147
- }
148
- function N(o, n, t, e) {
149
- const i = n.href, s = n.title ? b(n.title) : null, r = o[1].replace(/\\([\[\]])/g, "$1");
150
- if (o[0].charAt(0) !== "!") {
151
- e.state.inLink = !0;
131
+ function oe(a, t, e, n) {
132
+ const r = t.href, i = t.title ? m(t.title) : null, s = a[1].replace(/\\([\[\]])/g, "$1");
133
+ if (a[0].charAt(0) !== "!") {
134
+ n.state.inLink = !0;
152
135
  const l = {
153
136
  type: "link",
154
- raw: t,
155
- href: i,
156
- title: s,
157
- text: r,
158
- tokens: e.inlineTokens(r)
137
+ raw: e,
138
+ href: r,
139
+ title: i,
140
+ text: s,
141
+ tokens: n.inlineTokens(s)
159
142
  };
160
- return e.state.inLink = !1, l;
143
+ return n.state.inLink = !1, l;
161
144
  }
162
145
  return {
163
146
  type: "image",
164
- raw: t,
165
- href: i,
166
- title: s,
167
- text: b(r)
147
+ raw: e,
148
+ href: r,
149
+ title: i,
150
+ text: m(s)
168
151
  };
169
152
  }
170
- function _e(o, n) {
171
- const t = o.match(/^(\s+)(?:```)/);
172
- if (t === null)
173
- return n;
174
- const e = t[1];
175
- return n.split(`
176
- `).map((i) => {
177
- const s = i.match(/^\s+/);
178
- if (s === null)
179
- return i;
180
- const [r] = s;
181
- return r.length >= e.length ? i.slice(e.length) : i;
153
+ function Me(a, t) {
154
+ const e = a.match(/^(\s+)(?:```)/);
155
+ if (e === null)
156
+ return t;
157
+ const n = e[1];
158
+ return t.split(`
159
+ `).map((r) => {
160
+ const i = r.match(/^\s+/);
161
+ if (i === null)
162
+ return r;
163
+ const [s] = i;
164
+ return s.length >= n.length ? r.slice(n.length) : r;
182
165
  }).join(`
183
166
  `);
184
167
  }
185
- class q {
186
- constructor(n) {
187
- this.options = n || I;
188
- }
189
- space(n) {
190
- const t = this.rules.block.newline.exec(n);
191
- if (t && t[0].length > 0)
168
+ class P {
169
+ // set by the lexer
170
+ constructor(t) {
171
+ d(this, "options");
172
+ d(this, "rules");
173
+ // set by the lexer
174
+ d(this, "lexer");
175
+ this.options = t || z;
176
+ }
177
+ space(t) {
178
+ const e = this.rules.block.newline.exec(t);
179
+ if (e && e[0].length > 0)
192
180
  return {
193
181
  type: "space",
194
- raw: t[0]
182
+ raw: e[0]
195
183
  };
196
184
  }
197
- code(n) {
198
- const t = this.rules.block.code.exec(n);
199
- if (t) {
200
- const e = t[0].replace(/^ {1,4}/gm, "");
185
+ code(t) {
186
+ const e = this.rules.block.code.exec(t);
187
+ if (e) {
188
+ const n = e[0].replace(/^ {1,4}/gm, "");
201
189
  return {
202
190
  type: "code",
203
- raw: t[0],
191
+ raw: e[0],
204
192
  codeBlockStyle: "indented",
205
- text: this.options.pedantic ? e : B(e, `
193
+ text: this.options.pedantic ? n : B(n, `
206
194
  `)
207
195
  };
208
196
  }
209
197
  }
210
- fences(n) {
211
- const t = this.rules.block.fences.exec(n);
212
- if (t) {
213
- const e = t[0], i = _e(e, t[3] || "");
198
+ fences(t) {
199
+ const e = this.rules.block.fences.exec(t);
200
+ if (e) {
201
+ const n = e[0], r = Me(n, e[3] || "");
214
202
  return {
215
203
  type: "code",
216
- raw: e,
217
- lang: t[2] ? t[2].trim().replace(this.rules.inline._escapes, "$1") : t[2],
218
- text: i
204
+ raw: n,
205
+ lang: e[2] ? e[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : e[2],
206
+ text: r
219
207
  };
220
208
  }
221
209
  }
222
- heading(n) {
223
- const t = this.rules.block.heading.exec(n);
224
- if (t) {
225
- let e = t[2].trim();
226
- if (/#$/.test(e)) {
227
- const i = B(e, "#");
228
- (this.options.pedantic || !i || / $/.test(i)) && (e = i.trim());
210
+ heading(t) {
211
+ const e = this.rules.block.heading.exec(t);
212
+ if (e) {
213
+ let n = e[2].trim();
214
+ if (/#$/.test(n)) {
215
+ const r = B(n, "#");
216
+ (this.options.pedantic || !r || / $/.test(r)) && (n = r.trim());
229
217
  }
230
218
  return {
231
219
  type: "heading",
232
- raw: t[0],
233
- depth: t[1].length,
234
- text: e,
235
- tokens: this.lexer.inline(e)
220
+ raw: e[0],
221
+ depth: e[1].length,
222
+ text: n,
223
+ tokens: this.lexer.inline(n)
236
224
  };
237
225
  }
238
226
  }
239
- hr(n) {
240
- const t = this.rules.block.hr.exec(n);
241
- if (t)
227
+ hr(t) {
228
+ const e = this.rules.block.hr.exec(t);
229
+ if (e)
242
230
  return {
243
231
  type: "hr",
244
- raw: t[0]
232
+ raw: e[0]
245
233
  };
246
234
  }
247
- blockquote(n) {
248
- const t = this.rules.block.blockquote.exec(n);
249
- if (t) {
250
- const e = t[0].replace(/^ *>[ \t]?/gm, ""), i = this.lexer.state.top;
235
+ blockquote(t) {
236
+ const e = this.rules.block.blockquote.exec(t);
237
+ if (e) {
238
+ const n = B(e[0].replace(/^ *>[ \t]?/gm, ""), `
239
+ `), r = this.lexer.state.top;
251
240
  this.lexer.state.top = !0;
252
- const s = this.lexer.blockTokens(e);
253
- return this.lexer.state.top = i, {
241
+ const i = this.lexer.blockTokens(n);
242
+ return this.lexer.state.top = r, {
254
243
  type: "blockquote",
255
- raw: t[0],
256
- tokens: s,
257
- text: e
244
+ raw: e[0],
245
+ tokens: i,
246
+ text: n
258
247
  };
259
248
  }
260
249
  }
261
- list(n) {
262
- let t = this.rules.block.list.exec(n);
263
- if (t) {
264
- let e, i, s, r, l, c, d, f, g, k, h, z, _ = t[1].trim();
265
- const T = _.length > 1, x = {
250
+ list(t) {
251
+ let e = this.rules.block.list.exec(t);
252
+ if (e) {
253
+ let n = e[1].trim();
254
+ const r = n.length > 1, i = {
266
255
  type: "list",
267
256
  raw: "",
268
- ordered: T,
269
- start: T ? +_.slice(0, -1) : "",
257
+ ordered: r,
258
+ start: r ? +n.slice(0, -1) : "",
270
259
  loose: !1,
271
260
  items: []
272
261
  };
273
- _ = T ? `\\d{1,9}\\${_.slice(-1)}` : `\\${_}`, this.options.pedantic && (_ = T ? _ : "[*+-]");
274
- const w = new RegExp(`^( {0,3}${_})((?:[ ][^\\n]*)?(?:\\n|$))`);
275
- for (; n && (z = !1, !(!(t = w.exec(n)) || this.rules.block.hr.test(n))); ) {
276
- if (e = t[0], n = n.substring(e.length), f = t[2].split(`
277
- `, 1)[0].replace(/^\t+/, (S) => " ".repeat(3 * S.length)), g = n.split(`
278
- `, 1)[0], this.options.pedantic ? (r = 2, h = f.trimLeft()) : (r = t[2].search(/[^ ]/), r = r > 4 ? 1 : r, h = f.slice(r), r += t[1].length), c = !1, !f && /^ *$/.test(g) && (e += g + `
279
- `, n = n.substring(g.length + 1), z = !0), !z) {
280
- const S = new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), y = new RegExp(`^ {0,${Math.min(3, r - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), $ = new RegExp(`^ {0,${Math.min(3, r - 1)}}(?:\`\`\`|~~~)`), C = new RegExp(`^ {0,${Math.min(3, r - 1)}}#`);
281
- for (; n && (k = n.split(`
282
- `, 1)[0], g = k, this.options.pedantic && (g = g.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), !($.test(g) || C.test(g) || S.test(g) || y.test(n))); ) {
283
- if (g.search(/[^ ]/) >= r || !g.trim())
284
- h += `
285
- ` + g.slice(r);
262
+ n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
263
+ const s = new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`);
264
+ let l = "", o = "", p = !1;
265
+ for (; t; ) {
266
+ let c = !1;
267
+ if (!(e = s.exec(t)) || this.rules.block.hr.test(t))
268
+ break;
269
+ l = e[0], t = t.substring(l.length);
270
+ let u = e[2].split(`
271
+ `, 1)[0].replace(/^\t+/, (O) => " ".repeat(3 * O.length)), h = t.split(`
272
+ `, 1)[0], g = 0;
273
+ this.options.pedantic ? (g = 2, o = u.trimStart()) : (g = e[2].search(/[^ ]/), g = g > 4 ? 1 : g, o = u.slice(g), g += e[1].length);
274
+ let $ = !1;
275
+ if (!u && /^ *$/.test(h) && (l += h + `
276
+ `, t = t.substring(h.length + 1), c = !0), !c) {
277
+ const O = new RegExp(`^ {0,${Math.min(3, g - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), ee = new RegExp(`^ {0,${Math.min(3, g - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), te = new RegExp(`^ {0,${Math.min(3, g - 1)}}(?:\`\`\`|~~~)`), ne = new RegExp(`^ {0,${Math.min(3, g - 1)}}#`);
278
+ for (; t; ) {
279
+ const j = t.split(`
280
+ `, 1)[0];
281
+ if (h = j, this.options.pedantic && (h = h.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), te.test(h) || ne.test(h) || O.test(h) || ee.test(t))
282
+ break;
283
+ if (h.search(/[^ ]/) >= g || !h.trim())
284
+ o += `
285
+ ` + h.slice(g);
286
286
  else {
287
- if (c || f.search(/[^ ]/) >= 4 || $.test(f) || C.test(f) || y.test(f))
287
+ if ($ || u.search(/[^ ]/) >= 4 || te.test(u) || ne.test(u) || ee.test(u))
288
288
  break;
289
- h += `
290
- ` + g;
289
+ o += `
290
+ ` + h;
291
291
  }
292
- !c && !g.trim() && (c = !0), e += k + `
293
- `, n = n.substring(k.length + 1), f = g.slice(r);
292
+ !$ && !h.trim() && ($ = !0), l += j + `
293
+ `, t = t.substring(j.length + 1), u = h.slice(g);
294
294
  }
295
295
  }
296
- x.loose || (d ? x.loose = !0 : /\n *\n *$/.test(e) && (d = !0)), this.options.gfm && (i = /^\[[ xX]\] /.exec(h), i && (s = i[0] !== "[ ] ", h = h.replace(/^\[[ xX]\] +/, ""))), x.items.push({
296
+ i.loose || (p ? i.loose = !0 : /\n *\n *$/.test(l) && (p = !0));
297
+ let b = null, T;
298
+ this.options.gfm && (b = /^\[[ xX]\] /.exec(o), b && (T = b[0] !== "[ ] ", o = o.replace(/^\[[ xX]\] +/, ""))), i.items.push({
297
299
  type: "list_item",
298
- raw: e,
299
- task: !!i,
300
- checked: s,
300
+ raw: l,
301
+ task: !!b,
302
+ checked: T,
301
303
  loose: !1,
302
- text: h
303
- }), x.raw += e;
304
+ text: o,
305
+ tokens: []
306
+ }), i.raw += l;
304
307
  }
305
- x.items[x.items.length - 1].raw = e.trimRight(), x.items[x.items.length - 1].text = h.trimRight(), x.raw = x.raw.trimRight();
306
- const E = x.items.length;
307
- for (l = 0; l < E; l++)
308
- if (this.lexer.state.top = !1, x.items[l].tokens = this.lexer.blockTokens(x.items[l].text, []), !x.loose) {
309
- const S = x.items[l].tokens.filter(($) => $.type === "space"), y = S.length > 0 && S.some(($) => /\n.*\n/.test($.raw));
310
- x.loose = y;
311
- }
312
- if (x.loose)
313
- for (l = 0; l < E; l++)
314
- x.items[l].loose = !0;
315
- return x;
308
+ i.items[i.items.length - 1].raw = l.trimEnd(), i.items[i.items.length - 1].text = o.trimEnd(), i.raw = i.raw.trimEnd();
309
+ for (let c = 0; c < i.items.length; c++)
310
+ if (this.lexer.state.top = !1, i.items[c].tokens = this.lexer.blockTokens(i.items[c].text, []), !i.loose) {
311
+ const u = i.items[c].tokens.filter((g) => g.type === "space"), h = u.length > 0 && u.some((g) => /\n.*\n/.test(g.raw));
312
+ i.loose = h;
313
+ }
314
+ if (i.loose)
315
+ for (let c = 0; c < i.items.length; c++)
316
+ i.items[c].loose = !0;
317
+ return i;
316
318
  }
317
319
  }
318
- html(n) {
319
- const t = this.rules.block.html.exec(n);
320
- if (t) {
321
- const e = {
320
+ html(t) {
321
+ const e = this.rules.block.html.exec(t);
322
+ if (e)
323
+ return {
322
324
  type: "html",
323
- raw: t[0],
324
- pre: !this.options.sanitizer && (t[1] === "pre" || t[1] === "script" || t[1] === "style"),
325
- text: t[0]
325
+ block: !0,
326
+ raw: e[0],
327
+ pre: e[1] === "pre" || e[1] === "script" || e[1] === "style",
328
+ text: e[0]
326
329
  };
327
- if (this.options.sanitize) {
328
- const i = this.options.sanitizer ? this.options.sanitizer(t[0]) : b(t[0]);
329
- e.type = "paragraph", e.text = i, e.tokens = this.lexer.inline(i);
330
- }
331
- return e;
332
- }
333
330
  }
334
- def(n) {
335
- const t = this.rules.block.def.exec(n);
336
- if (t) {
337
- const e = t[1].toLowerCase().replace(/\s+/g, " "), i = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline._escapes, "$1") : "", s = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline._escapes, "$1") : t[3];
331
+ def(t) {
332
+ const e = this.rules.block.def.exec(t);
333
+ if (e) {
334
+ const n = e[1].toLowerCase().replace(/\s+/g, " "), r = e[2] ? e[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = e[3] ? e[3].substring(1, e[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : e[3];
338
335
  return {
339
336
  type: "def",
340
- tag: e,
341
- raw: t[0],
342
- href: i,
343
- title: s
337
+ tag: n,
338
+ raw: e[0],
339
+ href: r,
340
+ title: i
344
341
  };
345
342
  }
346
343
  }
347
- table(n) {
348
- const t = this.rules.block.table.exec(n);
349
- if (t) {
350
- const e = {
351
- type: "table",
352
- header: Q(t[1]).map((i) => ({ text: i })),
353
- align: t[2].replace(/^ *|\| *$/g, "").split(/ *\| */),
354
- rows: t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(`
355
- `) : []
356
- };
357
- if (e.header.length === e.align.length) {
358
- e.raw = t[0];
359
- let i = e.align.length, s, r, l, c;
360
- for (s = 0; s < i; s++)
361
- /^ *-+: *$/.test(e.align[s]) ? e.align[s] = "right" : /^ *:-+: *$/.test(e.align[s]) ? e.align[s] = "center" : /^ *:-+ *$/.test(e.align[s]) ? e.align[s] = "left" : e.align[s] = null;
362
- for (i = e.rows.length, s = 0; s < i; s++)
363
- e.rows[s] = Q(e.rows[s], e.header.length).map((d) => ({ text: d }));
364
- for (i = e.header.length, r = 0; r < i; r++)
365
- e.header[r].tokens = this.lexer.inline(e.header[r].text);
366
- for (i = e.rows.length, r = 0; r < i; r++)
367
- for (c = e.rows[r], l = 0; l < c.length; l++)
368
- c[l].tokens = this.lexer.inline(c[l].text);
369
- return e;
370
- }
344
+ table(t) {
345
+ const e = this.rules.block.table.exec(t);
346
+ if (!e || !/[:|]/.test(e[2]))
347
+ return;
348
+ const n = le(e[1]), r = e[2].replace(/^\||\| *$/g, "").split("|"), i = e[3] && e[3].trim() ? e[3].replace(/\n[ \t]*$/, "").split(`
349
+ `) : [], s = {
350
+ type: "table",
351
+ raw: e[0],
352
+ header: [],
353
+ align: [],
354
+ rows: []
355
+ };
356
+ if (n.length === r.length) {
357
+ for (const l of r)
358
+ /^ *-+: *$/.test(l) ? s.align.push("right") : /^ *:-+: *$/.test(l) ? s.align.push("center") : /^ *:-+ *$/.test(l) ? s.align.push("left") : s.align.push(null);
359
+ for (const l of n)
360
+ s.header.push({
361
+ text: l,
362
+ tokens: this.lexer.inline(l)
363
+ });
364
+ for (const l of i)
365
+ s.rows.push(le(l, s.header.length).map((o) => ({
366
+ text: o,
367
+ tokens: this.lexer.inline(o)
368
+ })));
369
+ return s;
371
370
  }
372
371
  }
373
- lheading(n) {
374
- const t = this.rules.block.lheading.exec(n);
375
- if (t)
372
+ lheading(t) {
373
+ const e = this.rules.block.lheading.exec(t);
374
+ if (e)
376
375
  return {
377
376
  type: "heading",
378
- raw: t[0],
379
- depth: t[2].charAt(0) === "=" ? 1 : 2,
380
- text: t[1],
381
- tokens: this.lexer.inline(t[1])
377
+ raw: e[0],
378
+ depth: e[2].charAt(0) === "=" ? 1 : 2,
379
+ text: e[1],
380
+ tokens: this.lexer.inline(e[1])
382
381
  };
383
382
  }
384
- paragraph(n) {
385
- const t = this.rules.block.paragraph.exec(n);
386
- if (t) {
387
- const e = t[1].charAt(t[1].length - 1) === `
388
- ` ? t[1].slice(0, -1) : t[1];
383
+ paragraph(t) {
384
+ const e = this.rules.block.paragraph.exec(t);
385
+ if (e) {
386
+ const n = e[1].charAt(e[1].length - 1) === `
387
+ ` ? e[1].slice(0, -1) : e[1];
389
388
  return {
390
389
  type: "paragraph",
391
- raw: t[0],
392
- text: e,
393
- tokens: this.lexer.inline(e)
390
+ raw: e[0],
391
+ text: n,
392
+ tokens: this.lexer.inline(n)
394
393
  };
395
394
  }
396
395
  }
397
- text(n) {
398
- const t = this.rules.block.text.exec(n);
399
- if (t)
396
+ text(t) {
397
+ const e = this.rules.block.text.exec(t);
398
+ if (e)
400
399
  return {
401
400
  type: "text",
402
- raw: t[0],
403
- text: t[0],
404
- tokens: this.lexer.inline(t[0])
401
+ raw: e[0],
402
+ text: e[0],
403
+ tokens: this.lexer.inline(e[0])
405
404
  };
406
405
  }
407
- escape(n) {
408
- const t = this.rules.inline.escape.exec(n);
409
- if (t)
406
+ escape(t) {
407
+ const e = this.rules.inline.escape.exec(t);
408
+ if (e)
410
409
  return {
411
410
  type: "escape",
412
- raw: t[0],
413
- text: b(t[1])
411
+ raw: e[0],
412
+ text: m(e[1])
414
413
  };
415
414
  }
416
- tag(n) {
417
- const t = this.rules.inline.tag.exec(n);
418
- if (t)
419
- return !this.lexer.state.inLink && /^<a /i.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
420
- type: this.options.sanitize ? "text" : "html",
421
- raw: t[0],
415
+ tag(t) {
416
+ const e = this.rules.inline.tag.exec(t);
417
+ if (e)
418
+ return !this.lexer.state.inLink && /^<a /i.test(e[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && /^<\/a>/i.test(e[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(e[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(e[0]) && (this.lexer.state.inRawBlock = !1), {
419
+ type: "html",
420
+ raw: e[0],
422
421
  inLink: this.lexer.state.inLink,
423
422
  inRawBlock: this.lexer.state.inRawBlock,
424
- text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(t[0]) : b(t[0]) : t[0]
423
+ block: !1,
424
+ text: e[0]
425
425
  };
426
426
  }
427
- link(n) {
428
- const t = this.rules.inline.link.exec(n);
429
- if (t) {
430
- const e = t[2].trim();
431
- if (!this.options.pedantic && /^</.test(e)) {
432
- if (!/>$/.test(e))
427
+ link(t) {
428
+ const e = this.rules.inline.link.exec(t);
429
+ if (e) {
430
+ const n = e[2].trim();
431
+ if (!this.options.pedantic && /^</.test(n)) {
432
+ if (!/>$/.test(n))
433
433
  return;
434
- const r = B(e.slice(0, -1), "\\");
435
- if ((e.length - r.length) % 2 === 0)
434
+ const s = B(n.slice(0, -1), "\\");
435
+ if ((n.length - s.length) % 2 === 0)
436
436
  return;
437
437
  } else {
438
- const r = we(t[2], "()");
439
- if (r > -1) {
440
- const c = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + r;
441
- t[2] = t[2].substring(0, r), t[0] = t[0].substring(0, c).trim(), t[3] = "";
438
+ const s = qe(e[2], "()");
439
+ if (s > -1) {
440
+ const o = (e[0].indexOf("!") === 0 ? 5 : 4) + e[1].length + s;
441
+ e[2] = e[2].substring(0, s), e[0] = e[0].substring(0, o).trim(), e[3] = "";
442
442
  }
443
443
  }
444
- let i = t[2], s = "";
444
+ let r = e[2], i = "";
445
445
  if (this.options.pedantic) {
446
- const r = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);
447
- r && (i = r[1], s = r[3]);
446
+ const s = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);
447
+ s && (r = s[1], i = s[3]);
448
448
  } else
449
- s = t[3] ? t[3].slice(1, -1) : "";
450
- return i = i.trim(), /^</.test(i) && (this.options.pedantic && !/>$/.test(e) ? i = i.slice(1) : i = i.slice(1, -1)), N(t, {
451
- href: i && i.replace(this.rules.inline._escapes, "$1"),
452
- title: s && s.replace(this.rules.inline._escapes, "$1")
453
- }, t[0], this.lexer);
449
+ i = e[3] ? e[3].slice(1, -1) : "";
450
+ return r = r.trim(), /^</.test(r) && (this.options.pedantic && !/>$/.test(n) ? r = r.slice(1) : r = r.slice(1, -1)), oe(e, {
451
+ href: r && r.replace(this.rules.inline.anyPunctuation, "$1"),
452
+ title: i && i.replace(this.rules.inline.anyPunctuation, "$1")
453
+ }, e[0], this.lexer);
454
454
  }
455
455
  }
456
- reflink(n, t) {
457
- let e;
458
- if ((e = this.rules.inline.reflink.exec(n)) || (e = this.rules.inline.nolink.exec(n))) {
459
- let i = (e[2] || e[1]).replace(/\s+/g, " ");
460
- if (i = t[i.toLowerCase()], !i) {
461
- const s = e[0].charAt(0);
456
+ reflink(t, e) {
457
+ let n;
458
+ if ((n = this.rules.inline.reflink.exec(t)) || (n = this.rules.inline.nolink.exec(t))) {
459
+ const r = (n[2] || n[1]).replace(/\s+/g, " "), i = e[r.toLowerCase()];
460
+ if (!i) {
461
+ const s = n[0].charAt(0);
462
462
  return {
463
463
  type: "text",
464
464
  raw: s,
465
465
  text: s
466
466
  };
467
467
  }
468
- return N(e, i, e[0], this.lexer);
468
+ return oe(n, i, n[0], this.lexer);
469
469
  }
470
470
  }
471
- emStrong(n, t, e = "") {
472
- let i = this.rules.inline.emStrong.lDelim.exec(n);
473
- if (!i || i[3] && e.match(/[\p{L}\p{N}]/u))
471
+ emStrong(t, e, n = "") {
472
+ let r = this.rules.inline.emStrongLDelim.exec(t);
473
+ if (!r || r[3] && n.match(/[\p{L}\p{N}]/u))
474
474
  return;
475
- const s = i[1] || i[2] || "";
476
- if (!s || s && (e === "" || this.rules.inline.punctuation.exec(e))) {
477
- const r = i[0].length - 1;
478
- let l, c, d = r, f = 0;
479
- const g = i[0][0] === "*" ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
480
- for (g.lastIndex = 0, t = t.slice(-1 * n.length + r); (i = g.exec(t)) != null; ) {
481
- if (l = i[1] || i[2] || i[3] || i[4] || i[5] || i[6], !l)
475
+ if (!(r[1] || r[2] || "") || !n || this.rules.inline.punctuation.exec(n)) {
476
+ const s = [...r[0]].length - 1;
477
+ let l, o, p = s, c = 0;
478
+ const u = r[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
479
+ for (u.lastIndex = 0, e = e.slice(-1 * t.length + s); (r = u.exec(e)) != null; ) {
480
+ if (l = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !l)
482
481
  continue;
483
- if (c = l.length, i[3] || i[4]) {
484
- d += c;
482
+ if (o = [...l].length, r[3] || r[4]) {
483
+ p += o;
485
484
  continue;
486
- } else if ((i[5] || i[6]) && r % 3 && !((r + c) % 3)) {
487
- f += c;
485
+ } else if ((r[5] || r[6]) && s % 3 && !((s + o) % 3)) {
486
+ c += o;
488
487
  continue;
489
488
  }
490
- if (d -= c, d > 0)
489
+ if (p -= o, p > 0)
491
490
  continue;
492
- c = Math.min(c, c + d + f);
493
- const k = n.slice(0, r + i.index + (i[0].length - l.length) + c);
494
- if (Math.min(r, c) % 2) {
495
- const z = k.slice(1, -1);
491
+ o = Math.min(o, o + p + c);
492
+ const h = [...r[0]][0].length, g = t.slice(0, s + r.index + h + o);
493
+ if (Math.min(s, o) % 2) {
494
+ const b = g.slice(1, -1);
496
495
  return {
497
496
  type: "em",
498
- raw: k,
499
- text: z,
500
- tokens: this.lexer.inlineTokens(z)
497
+ raw: g,
498
+ text: b,
499
+ tokens: this.lexer.inlineTokens(b)
501
500
  };
502
501
  }
503
- const h = k.slice(2, -2);
502
+ const $ = g.slice(2, -2);
504
503
  return {
505
504
  type: "strong",
506
- raw: k,
507
- text: h,
508
- tokens: this.lexer.inlineTokens(h)
505
+ raw: g,
506
+ text: $,
507
+ tokens: this.lexer.inlineTokens($)
509
508
  };
510
509
  }
511
510
  }
512
511
  }
513
- codespan(n) {
514
- const t = this.rules.inline.code.exec(n);
515
- if (t) {
516
- let e = t[2].replace(/\n/g, " ");
517
- const i = /[^ ]/.test(e), s = /^ /.test(e) && / $/.test(e);
518
- return i && s && (e = e.substring(1, e.length - 1)), e = b(e, !0), {
512
+ codespan(t) {
513
+ const e = this.rules.inline.code.exec(t);
514
+ if (e) {
515
+ let n = e[2].replace(/\n/g, " ");
516
+ const r = /[^ ]/.test(n), i = /^ /.test(n) && / $/.test(n);
517
+ return r && i && (n = n.substring(1, n.length - 1)), n = m(n, !0), {
519
518
  type: "codespan",
520
- raw: t[0],
521
- text: e
519
+ raw: e[0],
520
+ text: n
522
521
  };
523
522
  }
524
523
  }
525
- br(n) {
526
- const t = this.rules.inline.br.exec(n);
527
- if (t)
524
+ br(t) {
525
+ const e = this.rules.inline.br.exec(t);
526
+ if (e)
528
527
  return {
529
528
  type: "br",
530
- raw: t[0]
529
+ raw: e[0]
531
530
  };
532
531
  }
533
- del(n) {
534
- const t = this.rules.inline.del.exec(n);
535
- if (t)
532
+ del(t) {
533
+ const e = this.rules.inline.del.exec(t);
534
+ if (e)
536
535
  return {
537
536
  type: "del",
538
- raw: t[0],
539
- text: t[2],
540
- tokens: this.lexer.inlineTokens(t[2])
537
+ raw: e[0],
538
+ text: e[2],
539
+ tokens: this.lexer.inlineTokens(e[2])
541
540
  };
542
541
  }
543
- autolink(n, t) {
544
- const e = this.rules.inline.autolink.exec(n);
542
+ autolink(t) {
543
+ const e = this.rules.inline.autolink.exec(t);
545
544
  if (e) {
546
- let i, s;
547
- return e[2] === "@" ? (i = b(this.options.mangle ? t(e[1]) : e[1]), s = "mailto:" + i) : (i = b(e[1]), s = i), {
545
+ let n, r;
546
+ return e[2] === "@" ? (n = m(e[1]), r = "mailto:" + n) : (n = m(e[1]), r = n), {
548
547
  type: "link",
549
548
  raw: e[0],
550
- text: i,
551
- href: s,
549
+ text: n,
550
+ href: r,
552
551
  tokens: [
553
552
  {
554
553
  type: "text",
555
- raw: i,
556
- text: i
554
+ raw: n,
555
+ text: n
557
556
  }
558
557
  ]
559
558
  };
560
559
  }
561
560
  }
562
- url(n, t) {
561
+ url(t) {
562
+ var n, r;
563
563
  let e;
564
- if (e = this.rules.inline.url.exec(n)) {
564
+ if (e = this.rules.inline.url.exec(t)) {
565
565
  let i, s;
566
566
  if (e[2] === "@")
567
- i = b(this.options.mangle ? t(e[0]) : e[0]), s = "mailto:" + i;
567
+ i = m(e[0]), s = "mailto:" + i;
568
568
  else {
569
- let r;
569
+ let l;
570
570
  do
571
- r = e[0], e[0] = this.rules.inline._backpedal.exec(e[0])[0];
572
- while (r !== e[0]);
573
- i = b(e[0]), e[1] === "www." ? s = "http://" + e[0] : s = e[0];
571
+ l = e[0], e[0] = (r = (n = this.rules.inline._backpedal.exec(e[0])) == null ? void 0 : n[0]) != null ? r : "";
572
+ while (l !== e[0]);
573
+ i = m(e[0]), e[1] === "www." ? s = "http://" + e[0] : s = e[0];
574
574
  }
575
575
  return {
576
576
  type: "link",
@@ -587,282 +587,217 @@ class q {
587
587
  };
588
588
  }
589
589
  }
590
- inlineText(n, t) {
591
- const e = this.rules.inline.text.exec(n);
590
+ inlineText(t) {
591
+ const e = this.rules.inline.text.exec(t);
592
592
  if (e) {
593
- let i;
594
- return this.lexer.state.inRawBlock ? i = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(e[0]) : b(e[0]) : e[0] : i = b(this.options.smartypants ? t(e[0]) : e[0]), {
593
+ let n;
594
+ return this.lexer.state.inRawBlock ? n = e[0] : n = m(e[0]), {
595
595
  type: "text",
596
596
  raw: e[0],
597
- text: i
597
+ text: n
598
598
  };
599
599
  }
600
600
  }
601
601
  }
602
- const u = {
603
- newline: /^(?: *(?:\n|$))+/,
604
- code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
605
- fences: /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
606
- hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
607
- heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
608
- blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
609
- list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
610
- html: "^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",
611
- def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
612
- table: Z,
613
- lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
614
- // regex template, placeholders will be replaced according to different paragraph
615
- // interruption rules of commonmark and the original markdown spec:
616
- _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
617
- text: /^[^\n]+/
618
- };
619
- u._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
620
- u._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
621
- u.def = m(u.def).replace("label", u._label).replace("title", u._title).getRegex();
622
- u.bullet = /(?:[*+-]|\d{1,9}[.)])/;
623
- u.listItemStart = m(/^( *)(bull) */).replace("bull", u.bullet).getRegex();
624
- u.list = m(u.list).replace(/bull/g, u.bullet).replace("hr", "\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def", "\\n+(?=" + u.def.source + ")").getRegex();
625
- u._tag = "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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
626
- u._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
627
- u.html = m(u.html, "i").replace("comment", u._comment).replace("tag", u._tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
628
- u.paragraph = m(u._paragraph).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", u._tag).getRegex();
629
- u.blockquote = m(u.blockquote).replace("paragraph", u.paragraph).getRegex();
630
- u.normal = { ...u };
631
- u.gfm = {
632
- ...u.normal,
633
- table: "^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"
634
- // Cells
635
- };
636
- u.gfm.table = m(u.gfm.table).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", u._tag).getRegex();
637
- u.gfm.paragraph = m(u._paragraph).replace("hr", u.hr).replace("heading", " {0,3}#{1,6} ").replace("|lheading", "").replace("table", u.gfm.table).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", u._tag).getRegex();
638
- u.pedantic = {
639
- ...u.normal,
640
- html: m(
641
- `^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`
642
- ).replace("comment", u._comment).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
602
+ const Qe = /^(?: *(?:\n|$))+/, De = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, Oe = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, L = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, je = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, ue = /(?:[*+-]|\d{1,9}[.)])/, fe = k(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, ue).getRegex(), X = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, He = /^[^\n]+/, G = /(?!\s*\])(?:\\.|[^\[\]\\])+/, Ne = k(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", G).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Fe = k(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, ue).getRegex(), D = "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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", W = /<!--(?!-?>)[\s\S]*?(?:-->|$)/, Ue = k("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", W).replace("tag", D).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), ge = k(X).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", D).getRegex(), Ve = k(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", ge).getRegex(), J = {
603
+ blockquote: Ve,
604
+ code: De,
605
+ def: Ne,
606
+ fences: Oe,
607
+ heading: je,
608
+ hr: L,
609
+ html: Ue,
610
+ lheading: fe,
611
+ list: Fe,
612
+ newline: Qe,
613
+ paragraph: ge,
614
+ table: S,
615
+ text: He
616
+ }, ae = k("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", D).getRegex(), Xe = R(x({}, J), {
617
+ table: ae,
618
+ paragraph: k(X).replace("hr", L).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ae).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", D).getRegex()
619
+ }), Ge = R(x({}, J), {
620
+ html: k(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", W).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
643
621
  def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
644
622
  heading: /^(#{1,6})(.*)(?:\n+|$)/,
645
- fences: Z,
623
+ fences: S,
646
624
  // fences not supported
647
625
  lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
648
- paragraph: m(u.normal._paragraph).replace("hr", u.hr).replace("heading", ` *#{1,6} *[^
649
- ]`).replace("lheading", u.lheading).replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").getRegex()
650
- };
651
- const a = {
652
- escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
653
- autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
654
- url: Z,
655
- tag: "^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",
656
- // CDATA section
657
- link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
658
- reflink: /^!?\[(label)\]\[(ref)\]/,
659
- nolink: /^!?\[(ref)\](?:\[\])?/,
660
- reflinkSearch: "reflink|nolink(?!\\()",
661
- emStrong: {
662
- lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
663
- // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
664
- // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
665
- rDelimAst: /^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,
666
- rDelimUnd: /^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/
667
- // ^- Not allowed for _
668
- },
669
- code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
670
- br: /^( {2,}|\\)\n(?!\s*$)/,
671
- del: Z,
672
- text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
673
- punctuation: /^([\spunctuation])/
674
- };
675
- a._punctuation = "!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";
676
- a.punctuation = m(a.punctuation).replace(/punctuation/g, a._punctuation).getRegex();
677
- a.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
678
- a.escapedEmSt = /(?:^|[^\\])(?:\\\\)*\\[*_]/g;
679
- a._comment = m(u._comment).replace("(?:-->|$)", "-->").getRegex();
680
- a.emStrong.lDelim = m(a.emStrong.lDelim).replace(/punct/g, a._punctuation).getRegex();
681
- a.emStrong.rDelimAst = m(a.emStrong.rDelimAst, "g").replace(/punct/g, a._punctuation).getRegex();
682
- a.emStrong.rDelimUnd = m(a.emStrong.rDelimUnd, "g").replace(/punct/g, a._punctuation).getRegex();
683
- a._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
684
- a._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
685
- a._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
686
- a.autolink = m(a.autolink).replace("scheme", a._scheme).replace("email", a._email).getRegex();
687
- a._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
688
- a.tag = m(a.tag).replace("comment", a._comment).replace("attribute", a._attribute).getRegex();
689
- a._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
690
- a._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
691
- a._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
692
- a.link = m(a.link).replace("label", a._label).replace("href", a._href).replace("title", a._title).getRegex();
693
- a.reflink = m(a.reflink).replace("label", a._label).replace("ref", u._label).getRegex();
694
- a.nolink = m(a.nolink).replace("ref", u._label).getRegex();
695
- a.reflinkSearch = m(a.reflinkSearch, "g").replace("reflink", a.reflink).replace("nolink", a.nolink).getRegex();
696
- a.normal = { ...a };
697
- a.pedantic = {
698
- ...a.normal,
699
- strong: {
700
- start: /^__|\*\*/,
701
- middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
702
- endAst: /\*\*(?!\*)/g,
703
- endUnd: /__(?!_)/g
704
- },
705
- em: {
706
- start: /^_|\*/,
707
- middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
708
- endAst: /\*(?!\*)/g,
709
- endUnd: /_(?!_)/g
710
- },
711
- link: m(/^!?\[(label)\]\((.*?)\)/).replace("label", a._label).getRegex(),
712
- reflink: m(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", a._label).getRegex()
713
- };
714
- a.gfm = {
715
- ...a.normal,
716
- escape: m(a.escape).replace("])", "~|])").getRegex(),
717
- _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
718
- url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
626
+ paragraph: k(X).replace("hr", L).replace("heading", ` *#{1,6} *[^
627
+ ]`).replace("lheading", fe).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
628
+ }), ke = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, We = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, de = /^( {2,}|\\)\n(?!\s*$)/, Je = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, C = "\\p{P}$+<=>`^|~", Ke = k(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, C).getRegex(), Ye = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g, et = k(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, C).getRegex(), tt = k("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, C).getRegex(), nt = k("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, C).getRegex(), st = k(/\\([punct])/, "gu").replace(/punct/g, C).getRegex(), it = k(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), rt = k(W).replace("(?:-->|$)", "-->").getRegex(), lt = k("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", rt).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), q = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, ot = k(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", q).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), xe = k(/^!?\[(label)\]\[(ref)\]/).replace("label", q).replace("ref", G).getRegex(), me = k(/^!?\[(ref)\](?:\[\])?/).replace("ref", G).getRegex(), at = k("reflink|nolink(?!\\()", "g").replace("reflink", xe).replace("nolink", me).getRegex(), K = {
629
+ _backpedal: S,
630
+ // only used for GFM url
631
+ anyPunctuation: st,
632
+ autolink: it,
633
+ blockSkip: Ye,
634
+ br: de,
635
+ code: We,
636
+ del: S,
637
+ emStrongLDelim: et,
638
+ emStrongRDelimAst: tt,
639
+ emStrongRDelimUnd: nt,
640
+ escape: ke,
641
+ link: ot,
642
+ nolink: me,
643
+ punctuation: Ke,
644
+ reflink: xe,
645
+ reflinkSearch: at,
646
+ tag: lt,
647
+ text: Je,
648
+ url: S
649
+ }, ct = R(x({}, K), {
650
+ link: k(/^!?\[(label)\]\((.*?)\)/).replace("label", q).getRegex(),
651
+ reflink: k(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", q).getRegex()
652
+ }), F = R(x({}, K), {
653
+ escape: k(ke).replace("])", "~|])").getRegex(),
654
+ url: k(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
719
655
  _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
720
656
  del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
721
657
  text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
658
+ }), ht = R(x({}, F), {
659
+ br: k(de).replace("{2,}", "*").getRegex(),
660
+ text: k(F.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
661
+ }), Z = {
662
+ normal: J,
663
+ gfm: Xe,
664
+ pedantic: Ge
665
+ }, I = {
666
+ normal: K,
667
+ gfm: F,
668
+ breaks: ht,
669
+ pedantic: ct
722
670
  };
723
- a.gfm.url = m(a.gfm.url, "i").replace("email", a.gfm._extended_email).getRegex();
724
- a.breaks = {
725
- ...a.gfm,
726
- br: m(a.br).replace("{2,}", "*").getRegex(),
727
- text: m(a.gfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
728
- };
729
- function ye(o) {
730
- return o.replace(/---/g, "—").replace(/--/g, "–").replace(/(^|[-\u2014/(\[{"\s])'/g, "$1‘").replace(/'/g, "’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1“").replace(/"/g, "”").replace(/\.{3}/g, "…");
731
- }
732
- function H(o) {
733
- let n = "", t, e;
734
- const i = o.length;
735
- for (t = 0; t < i; t++)
736
- e = o.charCodeAt(t), Math.random() > 0.5 && (e = "x" + e.toString(16)), n += "&#" + e + ";";
737
- return n;
738
- }
739
- class R {
740
- constructor(n) {
741
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = n || I, this.options.tokenizer = this.options.tokenizer || new q(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
671
+ class w {
672
+ constructor(t) {
673
+ d(this, "tokens");
674
+ d(this, "options");
675
+ d(this, "state");
676
+ d(this, "tokenizer");
677
+ d(this, "inlineQueue");
678
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = t || z, this.options.tokenizer = this.options.tokenizer || new P(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
742
679
  inLink: !1,
743
680
  inRawBlock: !1,
744
681
  top: !0
745
682
  };
746
- const t = {
747
- block: u.normal,
748
- inline: a.normal
683
+ const e = {
684
+ block: Z.normal,
685
+ inline: I.normal
749
686
  };
750
- this.options.pedantic ? (t.block = u.pedantic, t.inline = a.pedantic) : this.options.gfm && (t.block = u.gfm, this.options.breaks ? t.inline = a.breaks : t.inline = a.gfm), this.tokenizer.rules = t;
687
+ this.options.pedantic ? (e.block = Z.pedantic, e.inline = I.pedantic) : this.options.gfm && (e.block = Z.gfm, this.options.breaks ? e.inline = I.breaks : e.inline = I.gfm), this.tokenizer.rules = e;
751
688
  }
752
689
  /**
753
690
  * Expose Rules
754
691
  */
755
692
  static get rules() {
756
693
  return {
757
- block: u,
758
- inline: a
694
+ block: Z,
695
+ inline: I
759
696
  };
760
697
  }
761
698
  /**
762
699
  * Static Lex Method
763
700
  */
764
- static lex(n, t) {
765
- return new R(t).lex(n);
701
+ static lex(t, e) {
702
+ return new w(e).lex(t);
766
703
  }
767
704
  /**
768
705
  * Static Lex Inline Method
769
706
  */
770
- static lexInline(n, t) {
771
- return new R(t).inlineTokens(n);
707
+ static lexInline(t, e) {
708
+ return new w(e).inlineTokens(t);
772
709
  }
773
710
  /**
774
711
  * Preprocessing
775
712
  */
776
- lex(n) {
777
- n = n.replace(/\r\n|\r/g, `
778
- `), this.blockTokens(n, this.tokens);
779
- let t;
780
- for (; t = this.inlineQueue.shift(); )
781
- this.inlineTokens(t.src, t.tokens);
782
- return this.tokens;
783
- }
784
- /**
785
- * Lexing
786
- */
787
- blockTokens(n, t = []) {
788
- this.options.pedantic ? n = n.replace(/\t/g, " ").replace(/^ +$/gm, "") : n = n.replace(/^( *)(\t+)/gm, (l, c, d) => c + " ".repeat(d.length));
789
- let e, i, s, r;
790
- for (; n; )
791
- if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((l) => (e = l.call({ lexer: this }, n, t)) ? (n = n.substring(e.raw.length), t.push(e), !0) : !1))) {
792
- if (e = this.tokenizer.space(n)) {
793
- n = n.substring(e.raw.length), e.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += `
794
- ` : t.push(e);
713
+ lex(t) {
714
+ t = t.replace(/\r\n|\r/g, `
715
+ `), this.blockTokens(t, this.tokens);
716
+ for (let e = 0; e < this.inlineQueue.length; e++) {
717
+ const n = this.inlineQueue[e];
718
+ this.inlineTokens(n.src, n.tokens);
719
+ }
720
+ return this.inlineQueue = [], this.tokens;
721
+ }
722
+ blockTokens(t, e = []) {
723
+ this.options.pedantic ? t = t.replace(/\t/g, " ").replace(/^ +$/gm, "") : t = t.replace(/^( *)(\t+)/gm, (l, o, p) => o + " ".repeat(p.length));
724
+ let n, r, i, s;
725
+ for (; t; )
726
+ if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((l) => (n = l.call({ lexer: this }, t, e)) ? (t = t.substring(n.raw.length), e.push(n), !0) : !1))) {
727
+ if (n = this.tokenizer.space(t)) {
728
+ t = t.substring(n.raw.length), n.raw.length === 1 && e.length > 0 ? e[e.length - 1].raw += `
729
+ ` : e.push(n);
795
730
  continue;
796
731
  }
797
- if (e = this.tokenizer.code(n)) {
798
- n = n.substring(e.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
799
- ` + e.raw, i.text += `
800
- ` + e.text, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(e);
732
+ if (n = this.tokenizer.code(t)) {
733
+ t = t.substring(n.raw.length), r = e[e.length - 1], r && (r.type === "paragraph" || r.type === "text") ? (r.raw += `
734
+ ` + n.raw, r.text += `
735
+ ` + n.text, this.inlineQueue[this.inlineQueue.length - 1].src = r.text) : e.push(n);
801
736
  continue;
802
737
  }
803
- if (e = this.tokenizer.fences(n)) {
804
- n = n.substring(e.raw.length), t.push(e);
738
+ if (n = this.tokenizer.fences(t)) {
739
+ t = t.substring(n.raw.length), e.push(n);
805
740
  continue;
806
741
  }
807
- if (e = this.tokenizer.heading(n)) {
808
- n = n.substring(e.raw.length), t.push(e);
742
+ if (n = this.tokenizer.heading(t)) {
743
+ t = t.substring(n.raw.length), e.push(n);
809
744
  continue;
810
745
  }
811
- if (e = this.tokenizer.hr(n)) {
812
- n = n.substring(e.raw.length), t.push(e);
746
+ if (n = this.tokenizer.hr(t)) {
747
+ t = t.substring(n.raw.length), e.push(n);
813
748
  continue;
814
749
  }
815
- if (e = this.tokenizer.blockquote(n)) {
816
- n = n.substring(e.raw.length), t.push(e);
750
+ if (n = this.tokenizer.blockquote(t)) {
751
+ t = t.substring(n.raw.length), e.push(n);
817
752
  continue;
818
753
  }
819
- if (e = this.tokenizer.list(n)) {
820
- n = n.substring(e.raw.length), t.push(e);
754
+ if (n = this.tokenizer.list(t)) {
755
+ t = t.substring(n.raw.length), e.push(n);
821
756
  continue;
822
757
  }
823
- if (e = this.tokenizer.html(n)) {
824
- n = n.substring(e.raw.length), t.push(e);
758
+ if (n = this.tokenizer.html(t)) {
759
+ t = t.substring(n.raw.length), e.push(n);
825
760
  continue;
826
761
  }
827
- if (e = this.tokenizer.def(n)) {
828
- n = n.substring(e.raw.length), i = t[t.length - 1], i && (i.type === "paragraph" || i.type === "text") ? (i.raw += `
829
- ` + e.raw, i.text += `
830
- ` + e.raw, this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : this.tokens.links[e.tag] || (this.tokens.links[e.tag] = {
831
- href: e.href,
832
- title: e.title
762
+ if (n = this.tokenizer.def(t)) {
763
+ t = t.substring(n.raw.length), r = e[e.length - 1], r && (r.type === "paragraph" || r.type === "text") ? (r.raw += `
764
+ ` + n.raw, r.text += `
765
+ ` + n.raw, this.inlineQueue[this.inlineQueue.length - 1].src = r.text) : this.tokens.links[n.tag] || (this.tokens.links[n.tag] = {
766
+ href: n.href,
767
+ title: n.title
833
768
  });
834
769
  continue;
835
770
  }
836
- if (e = this.tokenizer.table(n)) {
837
- n = n.substring(e.raw.length), t.push(e);
771
+ if (n = this.tokenizer.table(t)) {
772
+ t = t.substring(n.raw.length), e.push(n);
838
773
  continue;
839
774
  }
840
- if (e = this.tokenizer.lheading(n)) {
841
- n = n.substring(e.raw.length), t.push(e);
775
+ if (n = this.tokenizer.lheading(t)) {
776
+ t = t.substring(n.raw.length), e.push(n);
842
777
  continue;
843
778
  }
844
- if (s = n, this.options.extensions && this.options.extensions.startBlock) {
779
+ if (i = t, this.options.extensions && this.options.extensions.startBlock) {
845
780
  let l = 1 / 0;
846
- const c = n.slice(1);
847
- let d;
848
- this.options.extensions.startBlock.forEach(function(f) {
849
- d = f.call({ lexer: this }, c), typeof d == "number" && d >= 0 && (l = Math.min(l, d));
850
- }), l < 1 / 0 && l >= 0 && (s = n.substring(0, l + 1));
851
- }
852
- if (this.state.top && (e = this.tokenizer.paragraph(s))) {
853
- i = t[t.length - 1], r && i.type === "paragraph" ? (i.raw += `
854
- ` + e.raw, i.text += `
855
- ` + e.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(e), r = s.length !== n.length, n = n.substring(e.raw.length);
781
+ const o = t.slice(1);
782
+ let p;
783
+ this.options.extensions.startBlock.forEach((c) => {
784
+ p = c.call({ lexer: this }, o), typeof p == "number" && p >= 0 && (l = Math.min(l, p));
785
+ }), l < 1 / 0 && l >= 0 && (i = t.substring(0, l + 1));
786
+ }
787
+ if (this.state.top && (n = this.tokenizer.paragraph(i))) {
788
+ r = e[e.length - 1], s && r.type === "paragraph" ? (r.raw += `
789
+ ` + n.raw, r.text += `
790
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = r.text) : e.push(n), s = i.length !== t.length, t = t.substring(n.raw.length);
856
791
  continue;
857
792
  }
858
- if (e = this.tokenizer.text(n)) {
859
- n = n.substring(e.raw.length), i = t[t.length - 1], i && i.type === "text" ? (i.raw += `
860
- ` + e.raw, i.text += `
861
- ` + e.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = i.text) : t.push(e);
793
+ if (n = this.tokenizer.text(t)) {
794
+ t = t.substring(n.raw.length), r = e[e.length - 1], r && r.type === "text" ? (r.raw += `
795
+ ` + n.raw, r.text += `
796
+ ` + n.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = r.text) : e.push(n);
862
797
  continue;
863
798
  }
864
- if (n) {
865
- const l = "Infinite loop on byte: " + n.charCodeAt(0);
799
+ if (t) {
800
+ const l = "Infinite loop on byte: " + t.charCodeAt(0);
866
801
  if (this.options.silent) {
867
802
  console.error(l);
868
803
  break;
@@ -870,708 +805,664 @@ class R {
870
805
  throw new Error(l);
871
806
  }
872
807
  }
873
- return this.state.top = !0, t;
808
+ return this.state.top = !0, e;
874
809
  }
875
- inline(n, t = []) {
876
- return this.inlineQueue.push({ src: n, tokens: t }), t;
810
+ inline(t, e = []) {
811
+ return this.inlineQueue.push({ src: t, tokens: e }), e;
877
812
  }
878
813
  /**
879
814
  * Lexing/Compiling
880
815
  */
881
- inlineTokens(n, t = []) {
882
- let e, i, s, r = n, l, c, d;
816
+ inlineTokens(t, e = []) {
817
+ let n, r, i, s = t, l, o, p;
883
818
  if (this.tokens.links) {
884
- const f = Object.keys(this.tokens.links);
885
- if (f.length > 0)
886
- for (; (l = this.tokenizer.rules.inline.reflinkSearch.exec(r)) != null; )
887
- f.includes(l[0].slice(l[0].lastIndexOf("[") + 1, -1)) && (r = r.slice(0, l.index) + "[" + j("a", l[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
819
+ const c = Object.keys(this.tokens.links);
820
+ if (c.length > 0)
821
+ for (; (l = this.tokenizer.rules.inline.reflinkSearch.exec(s)) != null; )
822
+ c.includes(l[0].slice(l[0].lastIndexOf("[") + 1, -1)) && (s = s.slice(0, l.index) + "[" + "a".repeat(l[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex));
888
823
  }
889
- for (; (l = this.tokenizer.rules.inline.blockSkip.exec(r)) != null; )
890
- r = r.slice(0, l.index) + "[" + j("a", l[0].length - 2) + "]" + r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
891
- for (; (l = this.tokenizer.rules.inline.escapedEmSt.exec(r)) != null; )
892
- r = r.slice(0, l.index + l[0].length - 2) + "++" + r.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex), this.tokenizer.rules.inline.escapedEmSt.lastIndex--;
893
- for (; n; )
894
- if (c || (d = ""), c = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((f) => (e = f.call({ lexer: this }, n, t)) ? (n = n.substring(e.raw.length), t.push(e), !0) : !1))) {
895
- if (e = this.tokenizer.escape(n)) {
896
- n = n.substring(e.raw.length), t.push(e);
824
+ for (; (l = this.tokenizer.rules.inline.blockSkip.exec(s)) != null; )
825
+ s = s.slice(0, l.index) + "[" + "a".repeat(l[0].length - 2) + "]" + s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
826
+ for (; (l = this.tokenizer.rules.inline.anyPunctuation.exec(s)) != null; )
827
+ s = s.slice(0, l.index) + "++" + s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
828
+ for (; t; )
829
+ if (o || (p = ""), o = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((c) => (n = c.call({ lexer: this }, t, e)) ? (t = t.substring(n.raw.length), e.push(n), !0) : !1))) {
830
+ if (n = this.tokenizer.escape(t)) {
831
+ t = t.substring(n.raw.length), e.push(n);
897
832
  continue;
898
833
  }
899
- if (e = this.tokenizer.tag(n)) {
900
- n = n.substring(e.raw.length), i = t[t.length - 1], i && e.type === "text" && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : t.push(e);
834
+ if (n = this.tokenizer.tag(t)) {
835
+ t = t.substring(n.raw.length), r = e[e.length - 1], r && n.type === "text" && r.type === "text" ? (r.raw += n.raw, r.text += n.text) : e.push(n);
901
836
  continue;
902
837
  }
903
- if (e = this.tokenizer.link(n)) {
904
- n = n.substring(e.raw.length), t.push(e);
838
+ if (n = this.tokenizer.link(t)) {
839
+ t = t.substring(n.raw.length), e.push(n);
905
840
  continue;
906
841
  }
907
- if (e = this.tokenizer.reflink(n, this.tokens.links)) {
908
- n = n.substring(e.raw.length), i = t[t.length - 1], i && e.type === "text" && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : t.push(e);
842
+ if (n = this.tokenizer.reflink(t, this.tokens.links)) {
843
+ t = t.substring(n.raw.length), r = e[e.length - 1], r && n.type === "text" && r.type === "text" ? (r.raw += n.raw, r.text += n.text) : e.push(n);
909
844
  continue;
910
845
  }
911
- if (e = this.tokenizer.emStrong(n, r, d)) {
912
- n = n.substring(e.raw.length), t.push(e);
846
+ if (n = this.tokenizer.emStrong(t, s, p)) {
847
+ t = t.substring(n.raw.length), e.push(n);
913
848
  continue;
914
849
  }
915
- if (e = this.tokenizer.codespan(n)) {
916
- n = n.substring(e.raw.length), t.push(e);
850
+ if (n = this.tokenizer.codespan(t)) {
851
+ t = t.substring(n.raw.length), e.push(n);
917
852
  continue;
918
853
  }
919
- if (e = this.tokenizer.br(n)) {
920
- n = n.substring(e.raw.length), t.push(e);
854
+ if (n = this.tokenizer.br(t)) {
855
+ t = t.substring(n.raw.length), e.push(n);
921
856
  continue;
922
857
  }
923
- if (e = this.tokenizer.del(n)) {
924
- n = n.substring(e.raw.length), t.push(e);
858
+ if (n = this.tokenizer.del(t)) {
859
+ t = t.substring(n.raw.length), e.push(n);
925
860
  continue;
926
861
  }
927
- if (e = this.tokenizer.autolink(n, H)) {
928
- n = n.substring(e.raw.length), t.push(e);
862
+ if (n = this.tokenizer.autolink(t)) {
863
+ t = t.substring(n.raw.length), e.push(n);
929
864
  continue;
930
865
  }
931
- if (!this.state.inLink && (e = this.tokenizer.url(n, H))) {
932
- n = n.substring(e.raw.length), t.push(e);
866
+ if (!this.state.inLink && (n = this.tokenizer.url(t))) {
867
+ t = t.substring(n.raw.length), e.push(n);
933
868
  continue;
934
869
  }
935
- if (s = n, this.options.extensions && this.options.extensions.startInline) {
936
- let f = 1 / 0;
937
- const g = n.slice(1);
938
- let k;
939
- this.options.extensions.startInline.forEach(function(h) {
940
- k = h.call({ lexer: this }, g), typeof k == "number" && k >= 0 && (f = Math.min(f, k));
941
- }), f < 1 / 0 && f >= 0 && (s = n.substring(0, f + 1));
870
+ if (i = t, this.options.extensions && this.options.extensions.startInline) {
871
+ let c = 1 / 0;
872
+ const u = t.slice(1);
873
+ let h;
874
+ this.options.extensions.startInline.forEach((g) => {
875
+ h = g.call({ lexer: this }, u), typeof h == "number" && h >= 0 && (c = Math.min(c, h));
876
+ }), c < 1 / 0 && c >= 0 && (i = t.substring(0, c + 1));
942
877
  }
943
- if (e = this.tokenizer.inlineText(s, ye)) {
944
- n = n.substring(e.raw.length), e.raw.slice(-1) !== "_" && (d = e.raw.slice(-1)), c = !0, i = t[t.length - 1], i && i.type === "text" ? (i.raw += e.raw, i.text += e.text) : t.push(e);
878
+ if (n = this.tokenizer.inlineText(i)) {
879
+ t = t.substring(n.raw.length), n.raw.slice(-1) !== "_" && (p = n.raw.slice(-1)), o = !0, r = e[e.length - 1], r && r.type === "text" ? (r.raw += n.raw, r.text += n.text) : e.push(n);
945
880
  continue;
946
881
  }
947
- if (n) {
948
- const f = "Infinite loop on byte: " + n.charCodeAt(0);
882
+ if (t) {
883
+ const c = "Infinite loop on byte: " + t.charCodeAt(0);
949
884
  if (this.options.silent) {
950
- console.error(f);
885
+ console.error(c);
951
886
  break;
952
887
  } else
953
- throw new Error(f);
888
+ throw new Error(c);
954
889
  }
955
890
  }
956
- return t;
891
+ return e;
957
892
  }
958
893
  }
959
- class D {
960
- constructor(n) {
961
- this.options = n || I;
962
- }
963
- code(n, t, e) {
964
- const i = (t || "").match(/\S*/)[0];
965
- if (this.options.highlight) {
966
- const s = this.options.highlight(n, i);
967
- s != null && s !== n && (e = !0, n = s);
968
- }
969
- return n = n.replace(/\n$/, "") + `
970
- `, i ? '<pre><code class="' + this.options.langPrefix + b(i) + '">' + (e ? n : b(n, !0)) + `</code></pre>
971
- ` : "<pre><code>" + (e ? n : b(n, !0)) + `</code></pre>
894
+ class M {
895
+ constructor(t) {
896
+ d(this, "options");
897
+ this.options = t || z;
898
+ }
899
+ code(t, e, n) {
900
+ var i;
901
+ const r = (i = (e || "").match(/^\S*/)) == null ? void 0 : i[0];
902
+ return t = t.replace(/\n$/, "") + `
903
+ `, r ? '<pre><code class="language-' + m(r) + '">' + (n ? t : m(t, !0)) + `</code></pre>
904
+ ` : "<pre><code>" + (n ? t : m(t, !0)) + `</code></pre>
972
905
  `;
973
906
  }
974
- /**
975
- * @param {string} quote
976
- */
977
- blockquote(n) {
907
+ blockquote(t) {
978
908
  return `<blockquote>
979
- ${n}</blockquote>
909
+ ${t}</blockquote>
980
910
  `;
981
911
  }
982
- html(n) {
983
- return n;
912
+ html(t, e) {
913
+ return t;
984
914
  }
985
- /**
986
- * @param {string} text
987
- * @param {string} level
988
- * @param {string} raw
989
- * @param {any} slugger
990
- */
991
- heading(n, t, e, i) {
992
- if (this.options.headerIds) {
993
- const s = this.options.headerPrefix + i.slug(e);
994
- return `<h${t} id="${s}">${n}</h${t}>
995
- `;
996
- }
997
- return `<h${t}>${n}</h${t}>
915
+ heading(t, e, n) {
916
+ return `<h${e}>${t}</h${e}>
998
917
  `;
999
918
  }
1000
919
  hr() {
1001
- return this.options.xhtml ? `<hr/>
1002
- ` : `<hr>
920
+ return `<hr>
1003
921
  `;
1004
922
  }
1005
- list(n, t, e) {
1006
- const i = t ? "ol" : "ul", s = t && e !== 1 ? ' start="' + e + '"' : "";
1007
- return "<" + i + s + `>
1008
- ` + n + "</" + i + `>
923
+ list(t, e, n) {
924
+ const r = e ? "ol" : "ul", i = e && n !== 1 ? ' start="' + n + '"' : "";
925
+ return "<" + r + i + `>
926
+ ` + t + "</" + r + `>
1009
927
  `;
1010
928
  }
1011
- /**
1012
- * @param {string} text
1013
- */
1014
- listitem(n) {
1015
- return `<li>${n}</li>
929
+ listitem(t, e, n) {
930
+ return `<li>${t}</li>
1016
931
  `;
1017
932
  }
1018
- checkbox(n) {
1019
- return "<input " + (n ? 'checked="" ' : "") + 'disabled="" type="checkbox"' + (this.options.xhtml ? " /" : "") + "> ";
933
+ checkbox(t) {
934
+ return "<input " + (t ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
1020
935
  }
1021
- /**
1022
- * @param {string} text
1023
- */
1024
- paragraph(n) {
1025
- return `<p>${n}</p>
936
+ paragraph(t) {
937
+ return `<p>${t}</p>
1026
938
  `;
1027
939
  }
1028
- /**
1029
- * @param {string} header
1030
- * @param {string} body
1031
- */
1032
- table(n, t) {
1033
- return t && (t = `<tbody>${t}</tbody>`), `<table>
940
+ table(t, e) {
941
+ return e && (e = `<tbody>${e}</tbody>`), `<table>
1034
942
  <thead>
1035
- ` + n + `</thead>
1036
- ` + t + `</table>
943
+ ` + t + `</thead>
944
+ ` + e + `</table>
1037
945
  `;
1038
946
  }
1039
- /**
1040
- * @param {string} content
1041
- */
1042
- tablerow(n) {
947
+ tablerow(t) {
1043
948
  return `<tr>
1044
- ${n}</tr>
949
+ ${t}</tr>
1045
950
  `;
1046
951
  }
1047
- tablecell(n, t) {
1048
- const e = t.header ? "th" : "td";
1049
- return (t.align ? `<${e} align="${t.align}">` : `<${e}>`) + n + `</${e}>
952
+ tablecell(t, e) {
953
+ const n = e.header ? "th" : "td";
954
+ return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
1050
955
  `;
1051
956
  }
1052
957
  /**
1053
958
  * span level renderer
1054
- * @param {string} text
1055
959
  */
1056
- strong(n) {
1057
- return `<strong>${n}</strong>`;
960
+ strong(t) {
961
+ return `<strong>${t}</strong>`;
1058
962
  }
1059
- /**
1060
- * @param {string} text
1061
- */
1062
- em(n) {
1063
- return `<em>${n}</em>`;
963
+ em(t) {
964
+ return `<em>${t}</em>`;
1064
965
  }
1065
- /**
1066
- * @param {string} text
1067
- */
1068
- codespan(n) {
1069
- return `<code>${n}</code>`;
966
+ codespan(t) {
967
+ return `<code>${t}</code>`;
1070
968
  }
1071
969
  br() {
1072
- return this.options.xhtml ? "<br/>" : "<br>";
1073
- }
1074
- /**
1075
- * @param {string} text
1076
- */
1077
- del(n) {
1078
- return `<del>${n}</del>`;
1079
- }
1080
- /**
1081
- * @param {string} href
1082
- * @param {string} title
1083
- * @param {string} text
1084
- */
1085
- link(n, t, e) {
1086
- if (n = P(this.options.sanitize, this.options.baseUrl, n), n === null)
1087
- return e;
1088
- let i = '<a href="' + n + '"';
1089
- return t && (i += ' title="' + t + '"'), i += ">" + e + "</a>", i;
1090
- }
1091
- /**
1092
- * @param {string} href
1093
- * @param {string} title
1094
- * @param {string} text
1095
- */
1096
- image(n, t, e) {
1097
- if (n = P(this.options.sanitize, this.options.baseUrl, n), n === null)
1098
- return e;
1099
- let i = `<img src="${n}" alt="${e}"`;
1100
- return t && (i += ` title="${t}"`), i += this.options.xhtml ? "/>" : ">", i;
1101
- }
1102
- text(n) {
1103
- return n;
970
+ return "<br>";
971
+ }
972
+ del(t) {
973
+ return `<del>${t}</del>`;
974
+ }
975
+ link(t, e, n) {
976
+ const r = re(t);
977
+ if (r === null)
978
+ return n;
979
+ t = r;
980
+ let i = '<a href="' + t + '"';
981
+ return e && (i += ' title="' + e + '"'), i += ">" + n + "</a>", i;
982
+ }
983
+ image(t, e, n) {
984
+ const r = re(t);
985
+ if (r === null)
986
+ return n;
987
+ t = r;
988
+ let i = `<img src="${t}" alt="${n}"`;
989
+ return e && (i += ` title="${e}"`), i += ">", i;
990
+ }
991
+ text(t) {
992
+ return t;
1104
993
  }
1105
994
  }
1106
- class G {
995
+ class Y {
1107
996
  // no need for block level renderers
1108
- strong(n) {
1109
- return n;
997
+ strong(t) {
998
+ return t;
1110
999
  }
1111
- em(n) {
1112
- return n;
1000
+ em(t) {
1001
+ return t;
1113
1002
  }
1114
- codespan(n) {
1115
- return n;
1003
+ codespan(t) {
1004
+ return t;
1116
1005
  }
1117
- del(n) {
1118
- return n;
1006
+ del(t) {
1007
+ return t;
1119
1008
  }
1120
- html(n) {
1121
- return n;
1009
+ html(t) {
1010
+ return t;
1122
1011
  }
1123
- text(n) {
1124
- return n;
1012
+ text(t) {
1013
+ return t;
1125
1014
  }
1126
- link(n, t, e) {
1127
- return "" + e;
1015
+ link(t, e, n) {
1016
+ return "" + n;
1128
1017
  }
1129
- image(n, t, e) {
1130
- return "" + e;
1018
+ image(t, e, n) {
1019
+ return "" + n;
1131
1020
  }
1132
1021
  br() {
1133
1022
  return "";
1134
1023
  }
1135
1024
  }
1136
- class J {
1137
- constructor() {
1138
- this.seen = {};
1139
- }
1140
- /**
1141
- * @param {string} value
1142
- */
1143
- serialize(n) {
1144
- return n.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig, "").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, "").replace(/\s/g, "-");
1145
- }
1146
- /**
1147
- * Finds the next safe (unique) slug to use
1148
- * @param {string} originalSlug
1149
- * @param {boolean} isDryRun
1150
- */
1151
- getNextSafeSlug(n, t) {
1152
- let e = n, i = 0;
1153
- if (this.seen.hasOwnProperty(e)) {
1154
- i = this.seen[n];
1155
- do
1156
- i++, e = n + "-" + i;
1157
- while (this.seen.hasOwnProperty(e));
1158
- }
1159
- return t || (this.seen[n] = i, this.seen[e] = 0), e;
1160
- }
1161
- /**
1162
- * Convert string to unique id
1163
- * @param {object} [options]
1164
- * @param {boolean} [options.dryrun] Generates the next unique slug without
1165
- * updating the internal accumulator.
1166
- */
1167
- slug(n, t = {}) {
1168
- const e = this.serialize(n);
1169
- return this.getNextSafeSlug(e, t.dryrun);
1170
- }
1171
- }
1172
- class A {
1173
- constructor(n) {
1174
- this.options = n || I, this.options.renderer = this.options.renderer || new D(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new G(), this.slugger = new J();
1025
+ class y {
1026
+ constructor(t) {
1027
+ d(this, "options");
1028
+ d(this, "renderer");
1029
+ d(this, "textRenderer");
1030
+ this.options = t || z, this.options.renderer = this.options.renderer || new M(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.textRenderer = new Y();
1175
1031
  }
1176
1032
  /**
1177
1033
  * Static Parse Method
1178
1034
  */
1179
- static parse(n, t) {
1180
- return new A(t).parse(n);
1035
+ static parse(t, e) {
1036
+ return new y(e).parse(t);
1181
1037
  }
1182
1038
  /**
1183
1039
  * Static Parse Inline Method
1184
1040
  */
1185
- static parseInline(n, t) {
1186
- return new A(t).parseInline(n);
1041
+ static parseInline(t, e) {
1042
+ return new y(e).parseInline(t);
1187
1043
  }
1188
1044
  /**
1189
1045
  * Parse Loop
1190
1046
  */
1191
- parse(n, t = !0) {
1192
- let e = "", i, s, r, l, c, d, f, g, k, h, z, _, T, x, w, E, S, y, $;
1193
- const C = n.length;
1194
- for (i = 0; i < C; i++) {
1195
- if (h = n[i], this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[h.type] && ($ = this.options.extensions.renderers[h.type].call({ parser: this }, h), $ !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(h.type))) {
1196
- e += $ || "";
1197
- continue;
1047
+ parse(t, e = !0) {
1048
+ let n = "";
1049
+ for (let r = 0; r < t.length; r++) {
1050
+ const i = t[r];
1051
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[i.type]) {
1052
+ const s = i, l = this.options.extensions.renderers[s.type].call({ parser: this }, s);
1053
+ if (l !== !1 || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(s.type)) {
1054
+ n += l || "";
1055
+ continue;
1056
+ }
1198
1057
  }
1199
- switch (h.type) {
1058
+ switch (i.type) {
1200
1059
  case "space":
1201
1060
  continue;
1202
1061
  case "hr": {
1203
- e += this.renderer.hr();
1062
+ n += this.renderer.hr();
1204
1063
  continue;
1205
1064
  }
1206
1065
  case "heading": {
1207
- e += this.renderer.heading(
1208
- this.parseInline(h.tokens),
1209
- h.depth,
1210
- W(this.parseInline(h.tokens, this.textRenderer)),
1211
- this.slugger
1212
- );
1066
+ const s = i;
1067
+ n += this.renderer.heading(this.parseInline(s.tokens), s.depth, Ze(this.parseInline(s.tokens, this.textRenderer)));
1213
1068
  continue;
1214
1069
  }
1215
1070
  case "code": {
1216
- e += this.renderer.code(
1217
- h.text,
1218
- h.lang,
1219
- h.escaped
1220
- );
1071
+ const s = i;
1072
+ n += this.renderer.code(s.text, s.lang, !!s.escaped);
1221
1073
  continue;
1222
1074
  }
1223
1075
  case "table": {
1224
- for (g = "", f = "", l = h.header.length, s = 0; s < l; s++)
1225
- f += this.renderer.tablecell(
1226
- this.parseInline(h.header[s].tokens),
1227
- { header: !0, align: h.align[s] }
1228
- );
1229
- for (g += this.renderer.tablerow(f), k = "", l = h.rows.length, s = 0; s < l; s++) {
1230
- for (d = h.rows[s], f = "", c = d.length, r = 0; r < c; r++)
1231
- f += this.renderer.tablecell(
1232
- this.parseInline(d[r].tokens),
1233
- { header: !1, align: h.align[r] }
1234
- );
1235
- k += this.renderer.tablerow(f);
1076
+ const s = i;
1077
+ let l = "", o = "";
1078
+ for (let c = 0; c < s.header.length; c++)
1079
+ o += this.renderer.tablecell(this.parseInline(s.header[c].tokens), { header: !0, align: s.align[c] });
1080
+ l += this.renderer.tablerow(o);
1081
+ let p = "";
1082
+ for (let c = 0; c < s.rows.length; c++) {
1083
+ const u = s.rows[c];
1084
+ o = "";
1085
+ for (let h = 0; h < u.length; h++)
1086
+ o += this.renderer.tablecell(this.parseInline(u[h].tokens), { header: !1, align: s.align[h] });
1087
+ p += this.renderer.tablerow(o);
1236
1088
  }
1237
- e += this.renderer.table(g, k);
1089
+ n += this.renderer.table(l, p);
1238
1090
  continue;
1239
1091
  }
1240
1092
  case "blockquote": {
1241
- k = this.parse(h.tokens), e += this.renderer.blockquote(k);
1093
+ const s = i, l = this.parse(s.tokens);
1094
+ n += this.renderer.blockquote(l);
1242
1095
  continue;
1243
1096
  }
1244
1097
  case "list": {
1245
- for (z = h.ordered, _ = h.start, T = h.loose, l = h.items.length, k = "", s = 0; s < l; s++)
1246
- w = h.items[s], E = w.checked, S = w.task, x = "", w.task && (y = this.renderer.checkbox(E), T ? w.tokens.length > 0 && w.tokens[0].type === "paragraph" ? (w.tokens[0].text = y + " " + w.tokens[0].text, w.tokens[0].tokens && w.tokens[0].tokens.length > 0 && w.tokens[0].tokens[0].type === "text" && (w.tokens[0].tokens[0].text = y + " " + w.tokens[0].tokens[0].text)) : w.tokens.unshift({
1247
- type: "text",
1248
- text: y
1249
- }) : x += y), x += this.parse(w.tokens, T), k += this.renderer.listitem(x, S, E);
1250
- e += this.renderer.list(k, z, _);
1098
+ const s = i, l = s.ordered, o = s.start, p = s.loose;
1099
+ let c = "";
1100
+ for (let u = 0; u < s.items.length; u++) {
1101
+ const h = s.items[u], g = h.checked, $ = h.task;
1102
+ let b = "";
1103
+ if (h.task) {
1104
+ const T = this.renderer.checkbox(!!g);
1105
+ p ? h.tokens.length > 0 && h.tokens[0].type === "paragraph" ? (h.tokens[0].text = T + " " + h.tokens[0].text, h.tokens[0].tokens && h.tokens[0].tokens.length > 0 && h.tokens[0].tokens[0].type === "text" && (h.tokens[0].tokens[0].text = T + " " + h.tokens[0].tokens[0].text)) : h.tokens.unshift({
1106
+ type: "text",
1107
+ text: T + " "
1108
+ }) : b += T + " ";
1109
+ }
1110
+ b += this.parse(h.tokens, p), c += this.renderer.listitem(b, $, !!g);
1111
+ }
1112
+ n += this.renderer.list(c, l, o);
1251
1113
  continue;
1252
1114
  }
1253
1115
  case "html": {
1254
- e += this.renderer.html(h.text);
1116
+ const s = i;
1117
+ n += this.renderer.html(s.text, s.block);
1255
1118
  continue;
1256
1119
  }
1257
1120
  case "paragraph": {
1258
- e += this.renderer.paragraph(this.parseInline(h.tokens));
1121
+ const s = i;
1122
+ n += this.renderer.paragraph(this.parseInline(s.tokens));
1259
1123
  continue;
1260
1124
  }
1261
1125
  case "text": {
1262
- for (k = h.tokens ? this.parseInline(h.tokens) : h.text; i + 1 < C && n[i + 1].type === "text"; )
1263
- h = n[++i], k += `
1264
- ` + (h.tokens ? this.parseInline(h.tokens) : h.text);
1265
- e += t ? this.renderer.paragraph(k) : k;
1126
+ let s = i, l = s.tokens ? this.parseInline(s.tokens) : s.text;
1127
+ for (; r + 1 < t.length && t[r + 1].type === "text"; )
1128
+ s = t[++r], l += `
1129
+ ` + (s.tokens ? this.parseInline(s.tokens) : s.text);
1130
+ n += e ? this.renderer.paragraph(l) : l;
1266
1131
  continue;
1267
1132
  }
1268
1133
  default: {
1269
- const M = 'Token with "' + h.type + '" type was not found.';
1270
- if (this.options.silent) {
1271
- console.error(M);
1272
- return;
1273
- } else
1274
- throw new Error(M);
1134
+ const s = 'Token with "' + i.type + '" type was not found.';
1135
+ if (this.options.silent)
1136
+ return console.error(s), "";
1137
+ throw new Error(s);
1275
1138
  }
1276
1139
  }
1277
1140
  }
1278
- return e;
1141
+ return n;
1279
1142
  }
1280
1143
  /**
1281
1144
  * Parse Inline Tokens
1282
1145
  */
1283
- parseInline(n, t) {
1284
- t = t || this.renderer;
1285
- let e = "", i, s, r;
1286
- const l = n.length;
1287
- for (i = 0; i < l; i++) {
1288
- if (s = n[i], this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[s.type] && (r = this.options.extensions.renderers[s.type].call({ parser: this }, s), r !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(s.type))) {
1289
- e += r || "";
1290
- continue;
1146
+ parseInline(t, e) {
1147
+ e = e || this.renderer;
1148
+ let n = "";
1149
+ for (let r = 0; r < t.length; r++) {
1150
+ const i = t[r];
1151
+ if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[i.type]) {
1152
+ const s = this.options.extensions.renderers[i.type].call({ parser: this }, i);
1153
+ if (s !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) {
1154
+ n += s || "";
1155
+ continue;
1156
+ }
1291
1157
  }
1292
- switch (s.type) {
1158
+ switch (i.type) {
1293
1159
  case "escape": {
1294
- e += t.text(s.text);
1160
+ const s = i;
1161
+ n += e.text(s.text);
1295
1162
  break;
1296
1163
  }
1297
1164
  case "html": {
1298
- e += t.html(s.text);
1165
+ const s = i;
1166
+ n += e.html(s.text);
1299
1167
  break;
1300
1168
  }
1301
1169
  case "link": {
1302
- e += t.link(s.href, s.title, this.parseInline(s.tokens, t));
1170
+ const s = i;
1171
+ n += e.link(s.href, s.title, this.parseInline(s.tokens, e));
1303
1172
  break;
1304
1173
  }
1305
1174
  case "image": {
1306
- e += t.image(s.href, s.title, s.text);
1175
+ const s = i;
1176
+ n += e.image(s.href, s.title, s.text);
1307
1177
  break;
1308
1178
  }
1309
1179
  case "strong": {
1310
- e += t.strong(this.parseInline(s.tokens, t));
1180
+ const s = i;
1181
+ n += e.strong(this.parseInline(s.tokens, e));
1311
1182
  break;
1312
1183
  }
1313
1184
  case "em": {
1314
- e += t.em(this.parseInline(s.tokens, t));
1185
+ const s = i;
1186
+ n += e.em(this.parseInline(s.tokens, e));
1315
1187
  break;
1316
1188
  }
1317
1189
  case "codespan": {
1318
- e += t.codespan(s.text);
1190
+ const s = i;
1191
+ n += e.codespan(s.text);
1319
1192
  break;
1320
1193
  }
1321
1194
  case "br": {
1322
- e += t.br();
1195
+ n += e.br();
1323
1196
  break;
1324
1197
  }
1325
1198
  case "del": {
1326
- e += t.del(this.parseInline(s.tokens, t));
1199
+ const s = i;
1200
+ n += e.del(this.parseInline(s.tokens, e));
1327
1201
  break;
1328
1202
  }
1329
1203
  case "text": {
1330
- e += t.text(s.text);
1204
+ const s = i;
1205
+ n += e.text(s.text);
1331
1206
  break;
1332
1207
  }
1333
1208
  default: {
1334
- const c = 'Token with "' + s.type + '" type was not found.';
1335
- if (this.options.silent) {
1336
- console.error(c);
1337
- return;
1338
- } else
1339
- throw new Error(c);
1209
+ const s = 'Token with "' + i.type + '" type was not found.';
1210
+ if (this.options.silent)
1211
+ return console.error(s), "";
1212
+ throw new Error(s);
1340
1213
  }
1341
1214
  }
1342
1215
  }
1343
- return e;
1216
+ return n;
1344
1217
  }
1345
1218
  }
1346
- class v {
1347
- constructor(n) {
1348
- this.options = n || I;
1219
+ class A {
1220
+ constructor(t) {
1221
+ d(this, "options");
1222
+ this.options = t || z;
1349
1223
  }
1350
1224
  /**
1351
1225
  * Process markdown before marked
1352
1226
  */
1353
- preprocess(n) {
1354
- return n;
1227
+ preprocess(t) {
1228
+ return t;
1355
1229
  }
1356
1230
  /**
1357
1231
  * Process HTML after marked is finished
1358
1232
  */
1359
- postprocess(n) {
1360
- return n;
1233
+ postprocess(t) {
1234
+ return t;
1235
+ }
1236
+ /**
1237
+ * Process all tokens before walk tokens
1238
+ */
1239
+ processAllTokens(t) {
1240
+ return t;
1361
1241
  }
1362
1242
  }
1363
- O(v, "passThroughHooks", /* @__PURE__ */ new Set([
1243
+ d(A, "passThroughHooks", /* @__PURE__ */ new Set([
1364
1244
  "preprocess",
1365
- "postprocess"
1245
+ "postprocess",
1246
+ "processAllTokens"
1366
1247
  ]));
1367
- function $e(o, n, t) {
1368
- return (e) => {
1369
- if (e.message += `
1370
- Please report this to https://github.com/markedjs/marked.`, o) {
1371
- const i = "<p>An error occurred:</p><pre>" + b(e.message + "", !0) + "</pre>";
1372
- if (n)
1373
- return Promise.resolve(i);
1374
- if (t) {
1375
- t(null, i);
1376
- return;
1377
- }
1378
- return i;
1379
- }
1380
- if (n)
1381
- return Promise.reject(e);
1382
- if (t) {
1383
- t(e);
1384
- return;
1385
- }
1386
- throw e;
1387
- };
1388
- }
1389
- function K(o, n) {
1390
- return (t, e, i) => {
1391
- typeof e == "function" && (i = e, e = null);
1392
- const s = { ...e };
1393
- e = { ...p.defaults, ...s };
1394
- const r = $e(e.silent, e.async, i);
1395
- if (typeof t > "u" || t === null)
1396
- return r(new Error("marked(): input parameter is undefined or null"));
1397
- if (typeof t != "string")
1398
- return r(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
1399
- if (be(e), e.hooks && (e.hooks.options = e), i) {
1400
- const l = e.highlight;
1401
- let c;
1402
- try {
1403
- e.hooks && (t = e.hooks.preprocess(t)), c = o(t, e);
1404
- } catch (g) {
1405
- return r(g);
1406
- }
1407
- const d = function(g) {
1408
- let k;
1409
- if (!g)
1410
- try {
1411
- e.walkTokens && p.walkTokens(c, e.walkTokens), k = n(c, e), e.hooks && (k = e.hooks.postprocess(k));
1412
- } catch (h) {
1413
- g = h;
1414
- }
1415
- return e.highlight = l, g ? r(g) : i(null, k);
1416
- };
1417
- if (!l || l.length < 3 || (delete e.highlight, !c.length))
1418
- return d();
1419
- let f = 0;
1420
- p.walkTokens(c, function(g) {
1421
- g.type === "code" && (f++, setTimeout(() => {
1422
- l(g.text, g.lang, function(k, h) {
1423
- if (k)
1424
- return d(k);
1425
- h != null && h !== g.text && (g.text = h, g.escaped = !0), f--, f === 0 && d();
1426
- });
1427
- }, 0));
1428
- }), f === 0 && d();
1429
- return;
1430
- }
1431
- if (e.async)
1432
- return Promise.resolve(e.hooks ? e.hooks.preprocess(t) : t).then((l) => o(l, e)).then((l) => e.walkTokens ? Promise.all(p.walkTokens(l, e.walkTokens)).then(() => l) : l).then((l) => n(l, e)).then((l) => e.hooks ? e.hooks.postprocess(l) : l).catch(r);
1433
- try {
1434
- e.hooks && (t = e.hooks.preprocess(t));
1435
- const l = o(t, e);
1436
- e.walkTokens && p.walkTokens(l, e.walkTokens);
1437
- let c = n(l, e);
1438
- return e.hooks && (c = e.hooks.postprocess(c)), c;
1439
- } catch (l) {
1440
- return r(l);
1441
- }
1442
- };
1443
- }
1444
- function p(o, n, t) {
1445
- return K(R.lex, A.parse)(o, n, t);
1446
- }
1447
- p.options = p.setOptions = function(o) {
1448
- return p.defaults = { ...p.defaults, ...o }, oe(p.defaults), p;
1449
- };
1450
- p.getDefaults = F;
1451
- p.defaults = I;
1452
- p.use = function(...o) {
1453
- const n = p.defaults.extensions || { renderers: {}, childTokens: {} };
1454
- o.forEach((t) => {
1455
- const e = { ...t };
1456
- if (e.async = p.defaults.async || e.async || !1, t.extensions && (t.extensions.forEach((i) => {
1457
- if (!i.name)
1458
- throw new Error("extension name required");
1459
- if (i.renderer) {
1460
- const s = n.renderers[i.name];
1461
- s ? n.renderers[i.name] = function(...r) {
1462
- let l = i.renderer.apply(this, r);
1463
- return l === !1 && (l = s.apply(this, r)), l;
1464
- } : n.renderers[i.name] = i.renderer;
1248
+ var E, U, Q, be;
1249
+ class pt {
1250
+ constructor(...t) {
1251
+ N(this, E);
1252
+ N(this, Q);
1253
+ d(this, "defaults", V());
1254
+ d(this, "options", this.setOptions);
1255
+ d(this, "parse", v(this, E, U).call(this, w.lex, y.parse));
1256
+ d(this, "parseInline", v(this, E, U).call(this, w.lexInline, y.parseInline));
1257
+ d(this, "Parser", y);
1258
+ d(this, "Renderer", M);
1259
+ d(this, "TextRenderer", Y);
1260
+ d(this, "Lexer", w);
1261
+ d(this, "Tokenizer", P);
1262
+ d(this, "Hooks", A);
1263
+ this.use(...t);
1264
+ }
1265
+ /**
1266
+ * Run callback for every token
1267
+ */
1268
+ walkTokens(t, e) {
1269
+ var r, i;
1270
+ let n = [];
1271
+ for (const s of t)
1272
+ switch (n = n.concat(e.call(this, s)), s.type) {
1273
+ case "table": {
1274
+ const l = s;
1275
+ for (const o of l.header)
1276
+ n = n.concat(this.walkTokens(o.tokens, e));
1277
+ for (const o of l.rows)
1278
+ for (const p of o)
1279
+ n = n.concat(this.walkTokens(p.tokens, e));
1280
+ break;
1281
+ }
1282
+ case "list": {
1283
+ const l = s;
1284
+ n = n.concat(this.walkTokens(l.items, e));
1285
+ break;
1286
+ }
1287
+ default: {
1288
+ const l = s;
1289
+ (i = (r = this.defaults.extensions) == null ? void 0 : r.childTokens) != null && i[l.type] ? this.defaults.extensions.childTokens[l.type].forEach((o) => {
1290
+ n = n.concat(this.walkTokens(l[o], e));
1291
+ }) : l.tokens && (n = n.concat(this.walkTokens(l.tokens, e)));
1292
+ }
1465
1293
  }
1466
- if (i.tokenizer) {
1467
- if (!i.level || i.level !== "block" && i.level !== "inline")
1468
- throw new Error("extension level must be 'block' or 'inline'");
1469
- n[i.level] ? n[i.level].unshift(i.tokenizer) : n[i.level] = [i.tokenizer], i.start && (i.level === "block" ? n.startBlock ? n.startBlock.push(i.start) : n.startBlock = [i.start] : i.level === "inline" && (n.startInline ? n.startInline.push(i.start) : n.startInline = [i.start]));
1294
+ return n;
1295
+ }
1296
+ use(...t) {
1297
+ const e = this.defaults.extensions || { renderers: {}, childTokens: {} };
1298
+ return t.forEach((n) => {
1299
+ const r = x({}, n);
1300
+ if (r.async = this.defaults.async || r.async || !1, n.extensions && (n.extensions.forEach((i) => {
1301
+ if (!i.name)
1302
+ throw new Error("extension name required");
1303
+ if ("renderer" in i) {
1304
+ const s = e.renderers[i.name];
1305
+ s ? e.renderers[i.name] = function(...l) {
1306
+ let o = i.renderer.apply(this, l);
1307
+ return o === !1 && (o = s.apply(this, l)), o;
1308
+ } : e.renderers[i.name] = i.renderer;
1309
+ }
1310
+ if ("tokenizer" in i) {
1311
+ if (!i.level || i.level !== "block" && i.level !== "inline")
1312
+ throw new Error("extension level must be 'block' or 'inline'");
1313
+ const s = e[i.level];
1314
+ s ? s.unshift(i.tokenizer) : e[i.level] = [i.tokenizer], i.start && (i.level === "block" ? e.startBlock ? e.startBlock.push(i.start) : e.startBlock = [i.start] : i.level === "inline" && (e.startInline ? e.startInline.push(i.start) : e.startInline = [i.start]));
1315
+ }
1316
+ "childTokens" in i && i.childTokens && (e.childTokens[i.name] = i.childTokens);
1317
+ }), r.extensions = e), n.renderer) {
1318
+ const i = this.defaults.renderer || new M(this.defaults);
1319
+ for (const s in n.renderer) {
1320
+ if (!(s in i))
1321
+ throw new Error(`renderer '${s}' does not exist`);
1322
+ if (s === "options")
1323
+ continue;
1324
+ const l = s, o = n.renderer[l], p = i[l];
1325
+ i[l] = (...c) => {
1326
+ let u = o.apply(i, c);
1327
+ return u === !1 && (u = p.apply(i, c)), u || "";
1328
+ };
1329
+ }
1330
+ r.renderer = i;
1470
1331
  }
1471
- i.childTokens && (n.childTokens[i.name] = i.childTokens);
1472
- }), e.extensions = n), t.renderer) {
1473
- const i = p.defaults.renderer || new D();
1474
- for (const s in t.renderer) {
1475
- const r = i[s];
1476
- i[s] = (...l) => {
1477
- let c = t.renderer[s].apply(i, l);
1478
- return c === !1 && (c = r.apply(i, l)), c;
1479
- };
1332
+ if (n.tokenizer) {
1333
+ const i = this.defaults.tokenizer || new P(this.defaults);
1334
+ for (const s in n.tokenizer) {
1335
+ if (!(s in i))
1336
+ throw new Error(`tokenizer '${s}' does not exist`);
1337
+ if (["options", "rules", "lexer"].includes(s))
1338
+ continue;
1339
+ const l = s, o = n.tokenizer[l], p = i[l];
1340
+ i[l] = (...c) => {
1341
+ let u = o.apply(i, c);
1342
+ return u === !1 && (u = p.apply(i, c)), u;
1343
+ };
1344
+ }
1345
+ r.tokenizer = i;
1480
1346
  }
1481
- e.renderer = i;
1482
- }
1483
- if (t.tokenizer) {
1484
- const i = p.defaults.tokenizer || new q();
1485
- for (const s in t.tokenizer) {
1486
- const r = i[s];
1487
- i[s] = (...l) => {
1488
- let c = t.tokenizer[s].apply(i, l);
1489
- return c === !1 && (c = r.apply(i, l)), c;
1490
- };
1347
+ if (n.hooks) {
1348
+ const i = this.defaults.hooks || new A();
1349
+ for (const s in n.hooks) {
1350
+ if (!(s in i))
1351
+ throw new Error(`hook '${s}' does not exist`);
1352
+ if (s === "options")
1353
+ continue;
1354
+ const l = s, o = n.hooks[l], p = i[l];
1355
+ A.passThroughHooks.has(s) ? i[l] = (c) => {
1356
+ if (this.defaults.async)
1357
+ return Promise.resolve(o.call(i, c)).then((h) => p.call(i, h));
1358
+ const u = o.call(i, c);
1359
+ return p.call(i, u);
1360
+ } : i[l] = (...c) => {
1361
+ let u = o.apply(i, c);
1362
+ return u === !1 && (u = p.apply(i, c)), u;
1363
+ };
1364
+ }
1365
+ r.hooks = i;
1491
1366
  }
1492
- e.tokenizer = i;
1493
- }
1494
- if (t.hooks) {
1495
- const i = p.defaults.hooks || new v();
1496
- for (const s in t.hooks) {
1497
- const r = i[s];
1498
- v.passThroughHooks.has(s) ? i[s] = (l) => {
1499
- if (p.defaults.async)
1500
- return Promise.resolve(t.hooks[s].call(i, l)).then((d) => r.call(i, d));
1501
- const c = t.hooks[s].call(i, l);
1502
- return r.call(i, c);
1503
- } : i[s] = (...l) => {
1504
- let c = t.hooks[s].apply(i, l);
1505
- return c === !1 && (c = r.apply(i, l)), c;
1367
+ if (n.walkTokens) {
1368
+ const i = this.defaults.walkTokens, s = n.walkTokens;
1369
+ r.walkTokens = function(l) {
1370
+ let o = [];
1371
+ return o.push(s.call(this, l)), i && (o = o.concat(i.call(this, l))), o;
1506
1372
  };
1507
1373
  }
1508
- e.hooks = i;
1374
+ this.defaults = x(x({}, this.defaults), r);
1375
+ }), this;
1376
+ }
1377
+ setOptions(t) {
1378
+ return this.defaults = x(x({}, this.defaults), t), this;
1379
+ }
1380
+ lexer(t, e) {
1381
+ return w.lex(t, e != null ? e : this.defaults);
1382
+ }
1383
+ parser(t, e) {
1384
+ return y.parse(t, e != null ? e : this.defaults);
1385
+ }
1386
+ }
1387
+ E = new WeakSet(), U = function(t, e) {
1388
+ return (n, r) => {
1389
+ const i = x({}, r), s = x(x({}, this.defaults), i);
1390
+ this.defaults.async === !0 && i.async === !1 && (s.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), s.async = !0);
1391
+ const l = v(this, Q, be).call(this, !!s.silent, !!s.async);
1392
+ if (typeof n == "undefined" || n === null)
1393
+ return l(new Error("marked(): input parameter is undefined or null"));
1394
+ if (typeof n != "string")
1395
+ return l(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
1396
+ if (s.hooks && (s.hooks.options = s), s.async)
1397
+ return Promise.resolve(s.hooks ? s.hooks.preprocess(n) : n).then((o) => t(o, s)).then((o) => s.hooks ? s.hooks.processAllTokens(o) : o).then((o) => s.walkTokens ? Promise.all(this.walkTokens(o, s.walkTokens)).then(() => o) : o).then((o) => e(o, s)).then((o) => s.hooks ? s.hooks.postprocess(o) : o).catch(l);
1398
+ try {
1399
+ s.hooks && (n = s.hooks.preprocess(n));
1400
+ let o = t(n, s);
1401
+ s.hooks && (o = s.hooks.processAllTokens(o)), s.walkTokens && this.walkTokens(o, s.walkTokens);
1402
+ let p = e(o, s);
1403
+ return s.hooks && (p = s.hooks.postprocess(p)), p;
1404
+ } catch (o) {
1405
+ return l(o);
1509
1406
  }
1510
- if (t.walkTokens) {
1511
- const i = p.defaults.walkTokens;
1512
- e.walkTokens = function(s) {
1513
- let r = [];
1514
- return r.push(t.walkTokens.call(this, s)), i && (r = r.concat(i.call(this, s))), r;
1515
- };
1407
+ };
1408
+ }, Q = new WeakSet(), be = function(t, e) {
1409
+ return (n) => {
1410
+ if (n.message += `
1411
+ Please report this to https://github.com/markedjs/marked.`, t) {
1412
+ const r = "<p>An error occurred:</p><pre>" + m(n.message + "", !0) + "</pre>";
1413
+ return e ? Promise.resolve(r) : r;
1516
1414
  }
1517
- p.setOptions(e);
1518
- });
1415
+ if (e)
1416
+ return Promise.reject(n);
1417
+ throw n;
1418
+ };
1519
1419
  };
1520
- p.walkTokens = function(o, n) {
1521
- let t = [];
1522
- for (const e of o)
1523
- switch (t = t.concat(n.call(p, e)), e.type) {
1524
- case "table": {
1525
- for (const i of e.header)
1526
- t = t.concat(p.walkTokens(i.tokens, n));
1527
- for (const i of e.rows)
1528
- for (const s of i)
1529
- t = t.concat(p.walkTokens(s.tokens, n));
1530
- break;
1531
- }
1532
- case "list": {
1533
- t = t.concat(p.walkTokens(e.items, n));
1534
- break;
1535
- }
1536
- default:
1537
- p.defaults.extensions && p.defaults.extensions.childTokens && p.defaults.extensions.childTokens[e.type] ? p.defaults.extensions.childTokens[e.type].forEach(function(i) {
1538
- t = t.concat(p.walkTokens(e[i], n));
1539
- }) : e.tokens && (t = t.concat(p.walkTokens(e.tokens, n)));
1540
- }
1541
- return t;
1420
+ const _ = new pt();
1421
+ function f(a, t) {
1422
+ return _.parse(a, t);
1423
+ }
1424
+ f.options = f.setOptions = function(a) {
1425
+ return _.setOptions(a), f.defaults = _.defaults, ce(f.defaults), f;
1426
+ };
1427
+ f.getDefaults = V;
1428
+ f.defaults = z;
1429
+ f.use = function(...a) {
1430
+ return _.use(...a), f.defaults = _.defaults, ce(f.defaults), f;
1431
+ };
1432
+ f.walkTokens = function(a, t) {
1433
+ return _.walkTokens(a, t);
1542
1434
  };
1543
- p.parseInline = K(R.lexInline, A.parseInline);
1544
- p.Parser = A;
1545
- p.parser = A.parse;
1546
- p.Renderer = D;
1547
- p.TextRenderer = G;
1548
- p.Lexer = R;
1549
- p.lexer = R.lex;
1550
- p.Tokenizer = q;
1551
- p.Slugger = J;
1552
- p.Hooks = v;
1553
- p.parse = p;
1554
- p.options;
1555
- p.setOptions;
1556
- p.use;
1557
- p.walkTokens;
1558
- p.parseInline;
1559
- A.parse;
1560
- R.lex;
1561
- const ze = ["innerHTML"], Se = /* @__PURE__ */ te({
1435
+ f.parseInline = _.parseInline;
1436
+ f.Parser = y;
1437
+ f.parser = y.parse;
1438
+ f.Renderer = M;
1439
+ f.TextRenderer = Y;
1440
+ f.Lexer = w;
1441
+ f.lexer = w.lex;
1442
+ f.Tokenizer = P;
1443
+ f.Hooks = A;
1444
+ f.parse = f;
1445
+ f.options;
1446
+ f.setOptions;
1447
+ f.use;
1448
+ f.walkTokens;
1449
+ f.parseInline;
1450
+ y.parse;
1451
+ w.lex;
1452
+ const ut = ["innerHTML"], ft = /* @__PURE__ */ Re({
1562
1453
  __name: "MarkdownViewer",
1563
1454
  props: {
1564
- data: null
1455
+ data: {}
1565
1456
  },
1566
- setup(o) {
1567
- const n = o, t = ne(() => p(n.data));
1568
- return (e, i) => (ie(), se("div", {
1457
+ setup(a) {
1458
+ const t = a, e = Ie(() => f(t.data));
1459
+ return (n, r) => (Se(), Ae("div", {
1569
1460
  class: "markdown-body",
1570
- innerHTML: re(t)
1571
- }, null, 8, ze));
1461
+ innerHTML: e.value
1462
+ }, null, 8, ut));
1572
1463
  }
1573
1464
  });
1574
- const Ie = /* @__PURE__ */ le(Se, [["__scopeId", "data-v-e0bd8a5a"]]);
1465
+ const xt = /* @__PURE__ */ Ee(ft, [["__scopeId", "data-v-e0bd8a5a"]]);
1575
1466
  export {
1576
- Ie as default
1467
+ xt as default
1577
1468
  };