@8wave/ai-elements 0.99.0-beta.2 → 0.100.0-beta.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.
- package/dist/_chunks/PkLazyImg-BhLarH2R.js +34 -0
- package/dist/_chunks/PkLazyImg-BhLarH2R.js.map +1 -0
- package/{dist-vue/_chunks/PkStreamingMarkdown-CjBMQ18U.js → dist/_chunks/PkStreamingMarkdown-CHhH4FdH.js} +407 -385
- package/dist/_chunks/PkStreamingMarkdown-CHhH4FdH.js.map +1 -0
- package/dist/_chunks/{PkToolShowArtifact-bYYaMGxq.js → PkToolShowArtifact-BRYd-YSp.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-bYYaMGxq.js.map → PkToolShowArtifact-BRYd-YSp.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DtjVW-n6.js → PkToolShowContactForm-vZTYDdfX.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DtjVW-n6.js.map → PkToolShowContactForm-vZTYDdfX.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-BP8asXtz.js → PkToolShowForm-DMmZ34is.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-BP8asXtz.js.map → PkToolShowForm-DMmZ34is.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-WQL3T4Hr.js → PkToolShowImageGallery-B7dClMBr.js} +28 -27
- package/dist/_chunks/PkToolShowImageGallery-B7dClMBr.js.map +1 -0
- package/dist/_chunks/{PkToolShowProductList-BbY4ni7Y.js → PkToolShowProductList-BGqOPGVe.js} +10 -8
- package/dist/_chunks/PkToolShowProductList-BGqOPGVe.js.map +1 -0
- package/dist/_chunks/{PkToolShowSources-D2tBcx7n.js → PkToolShowSources-DwhjDoSn.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-D2tBcx7n.js.map → PkToolShowSources-DwhjDoSn.js.map} +1 -1
- package/dist/_chunks/PkToolShowWebPages-Co1LHj17.js +78 -0
- package/dist/_chunks/PkToolShowWebPages-Co1LHj17.js.map +1 -0
- package/dist/_chunks/useImageFallback-CaxDKce2.js +19 -0
- package/dist/_chunks/useImageFallback-CaxDKce2.js.map +1 -0
- package/dist/ai-elements.es.js +3049 -3015
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotAuth.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/PkChatbotViewFiles.js +1 -1
- package/dist-vue/PkChatbotViewProfile.js +1 -1
- package/dist-vue/_chunks/PkAvatar-paEJByEA.js +42 -0
- package/dist-vue/_chunks/PkAvatar-paEJByEA.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbot-Bf5uY3cO.js → PkChatbot-Cs3GOau6.js} +6 -6
- package/dist-vue/_chunks/{PkChatbot-Bf5uY3cO.js.map → PkChatbot-Cs3GOau6.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotAuth-DV83Fen2.js +349 -0
- package/dist-vue/_chunks/PkChatbotAuth-DV83Fen2.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotEmptyState-CPqLqXek.js → PkChatbotEmptyState-Cxv79prz.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotEmptyState-CPqLqXek.js.map → PkChatbotEmptyState-Cxv79prz.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotFilePreview-DyrszALJ.js.map +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-jvb0vuak.js → PkChatbotInput-BSm3BI7D.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-jvb0vuak.js.map → PkChatbotInput-BSm3BI7D.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-B3G12zah.js → PkChatbotMessages-BDRnBwzT.js} +11 -11
- package/dist-vue/_chunks/{PkChatbotMessages-B3G12zah.js.map → PkChatbotMessages-BDRnBwzT.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-BdU6YC_N.js → PkChatbotSteps-BdycCDRx.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotSteps-BdU6YC_N.js.map → PkChatbotSteps-BdycCDRx.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-c0Ecpzoc.js → PkChatbotViewChat-DwfZGp9d.js} +6 -6
- package/dist-vue/_chunks/{PkChatbotViewChat-c0Ecpzoc.js.map → PkChatbotViewChat-DwfZGp9d.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewFiles-BipRoidH.js → PkChatbotViewFiles-DwrKKSjU.js} +26 -25
- package/dist-vue/_chunks/PkChatbotViewFiles-DwrKKSjU.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewProfile-DuLwYpGZ.js → PkChatbotViewProfile-B7yqkE-h.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewProfile-DuLwYpGZ.js.map → PkChatbotViewProfile-B7yqkE-h.js.map} +1 -1
- package/dist-vue/_chunks/PkLazyImg-CDxX9xnq.js +34 -0
- package/dist-vue/_chunks/PkLazyImg-CDxX9xnq.js.map +1 -0
- package/{dist/_chunks/PkStreamingMarkdown-6Xx9n1ue.js → dist-vue/_chunks/PkStreamingMarkdown-B3OallmC.js} +331 -329
- package/dist-vue/_chunks/PkStreamingMarkdown-B3OallmC.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowArtifact-COwSXmF4.js → PkToolShowArtifact-N7we3fbM.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-COwSXmF4.js.map → PkToolShowArtifact-N7we3fbM.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-DRRtCCxB.js → PkToolShowContactForm-DgVlnLkC.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-DRRtCCxB.js.map → PkToolShowContactForm-DgVlnLkC.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-j7Ha-0X3.js → PkToolShowForm-dp0-LYl1.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowForm-j7Ha-0X3.js.map → PkToolShowForm-dp0-LYl1.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowImageGallery-CoC46nGb.js +75 -0
- package/dist-vue/_chunks/PkToolShowImageGallery-CoC46nGb.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowProductList-DXMN2UuE.js → PkToolShowProductList-C6YoC3sD.js} +25 -23
- package/dist-vue/_chunks/PkToolShowProductList-C6YoC3sD.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowSources-BVLw4W5l.js → PkToolShowSources-DJwpImlN.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-BVLw4W5l.js.map → PkToolShowSources-DJwpImlN.js.map} +1 -1
- package/dist-vue/_chunks/PkToolShowWebPages-B9UeUWfJ.js +79 -0
- package/dist-vue/_chunks/PkToolShowWebPages-B9UeUWfJ.js.map +1 -0
- package/dist-vue/_chunks/useImageFallback-5vQIO0pC.js +18 -0
- package/dist-vue/_chunks/useImageFallback-5vQIO0pC.js.map +1 -0
- package/dist-vue/index.js +3951 -3965
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +2 -2
- package/dist-vue/packages/components/src/PkLazyImg.d.ts +6 -1
- package/dist-vue/packages/components/src/chat/PkAvatar.d.ts +8 -1
- package/dist-vue/packages/components/src/chat/PkChatSidebarConversationItem.d.ts +2 -2
- package/dist-vue/packages/composable/src/index.d.ts +1 -0
- package/dist-vue/packages/composable/src/useImageFallback.d.ts +19 -0
- package/dist-vue/packages/models/src/schema/UserOverview.d.ts +96 -0
- package/dist-vue/packages/models/src/schema/index.d.ts +1 -0
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkStreamingMarkdown-6Xx9n1ue.js.map +0 -1
- package/dist/_chunks/PkToolShowImageGallery-WQL3T4Hr.js.map +0 -1
- package/dist/_chunks/PkToolShowProductList-BbY4ni7Y.js.map +0 -1
- package/dist/_chunks/PkToolShowWebPages-DkMJrWmT.js +0 -76
- package/dist/_chunks/PkToolShowWebPages-DkMJrWmT.js.map +0 -1
- package/dist-vue/_chunks/PkAvatar-CyIgsndA.js +0 -31
- package/dist-vue/_chunks/PkAvatar-CyIgsndA.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotAuth-BGn2MDYD.js +0 -347
- package/dist-vue/_chunks/PkChatbotAuth-BGn2MDYD.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewFiles-BipRoidH.js.map +0 -1
- package/dist-vue/_chunks/PkStreamingMarkdown-CjBMQ18U.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowImageGallery-Bj7YlqbP.js +0 -74
- package/dist-vue/_chunks/PkToolShowImageGallery-Bj7YlqbP.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowProductList-DXMN2UuE.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowWebPages-CsACREOH.js +0 -77
- package/dist-vue/_chunks/PkToolShowWebPages-CsACREOH.js.map +0 -1
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import "./
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { n as e, t } from "./cdn-css-JUUNhyQ6.js";
|
|
2
|
+
import "./src-8QXYVWIx.js";
|
|
3
|
+
import { n } from "./url-validation-uLMZ5-AU.js";
|
|
4
|
+
import { n as r } from "./useShortUrlResolver-DI8ycJiO.js";
|
|
5
|
+
import { computed as i, createElementBlock as a, defineComponent as o, nextTick as s, onBeforeUnmount as c, onMounted as l, openBlock as u, useTemplateRef as d, watch as f } from "vue";
|
|
6
|
+
import { useI18n as p } from "vue-i18n";
|
|
7
7
|
//#region ../../packages/utils/src/citations.ts
|
|
8
|
-
var
|
|
8
|
+
var m = /[ \t]*\uE200[^\uE201]*\uE201/g, ee = /[ \t]*(?:cite|filecite|videocite|audiocite|imagecite|screenshot)(?:turn\d+[a-z]+\d+)+/gi, h = /[\uE200-\uE20F]/g;
|
|
9
9
|
function te(e) {
|
|
10
|
-
return e && e.replace(
|
|
10
|
+
return e && e.replace(m, "").replace(ee, "").replace(h, "");
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
13
|
//#region ../../node_modules/.pnpm/remend@1.3.0/node_modules/remend/dist/index.js
|
|
14
|
-
var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwnPropertyDescriptors,
|
|
14
|
+
var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwnPropertyDescriptors, ae = Object.getOwnPropertySymbols, oe = Object.prototype.hasOwnProperty, se = Object.prototype.propertyIsEnumerable, g = (e, t, n) => t in e ? ne(e, t, {
|
|
15
15
|
enumerable: !0,
|
|
16
16
|
configurable: !0,
|
|
17
17
|
writable: !0,
|
|
18
18
|
value: n
|
|
19
|
-
}) : e[t] = n,
|
|
20
|
-
for (var n in t ||= {})
|
|
21
|
-
if (
|
|
19
|
+
}) : e[t] = n, _ = (e, t) => {
|
|
20
|
+
for (var n in t ||= {}) oe.call(t, n) && g(e, n, t[n]);
|
|
21
|
+
if (ae) for (var n of ae(t)) se.call(t, n) && g(e, n, t[n]);
|
|
22
22
|
return e;
|
|
23
|
-
},
|
|
23
|
+
}, ce = (e, t) => re(e, ie(t)), v = (e, t) => {
|
|
24
24
|
let n = !1, r = !1;
|
|
25
25
|
for (let i = 0; i < t; i += 1) {
|
|
26
26
|
if (e[i] === "\\" && i + 1 < e.length && e[i + 1] === "`") {
|
|
@@ -34,20 +34,20 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
34
34
|
!r && e[i] === "`" && (n = !n);
|
|
35
35
|
}
|
|
36
36
|
return n || r;
|
|
37
|
-
},
|
|
37
|
+
}, le = (e, t) => {
|
|
38
38
|
let n = e.substring(t, t + 3) === "```", r = t > 0 && e.substring(t - 1, t + 2) === "```", i = t > 1 && e.substring(t - 2, t + 1) === "```";
|
|
39
39
|
return n || r || i;
|
|
40
|
-
},
|
|
40
|
+
}, ue = (e) => {
|
|
41
41
|
let t = 0;
|
|
42
42
|
for (let n = 0; n < e.length; n += 1) {
|
|
43
43
|
if (e[n] === "\\" && n + 1 < e.length && e[n + 1] === "`") {
|
|
44
44
|
n += 1;
|
|
45
45
|
continue;
|
|
46
46
|
}
|
|
47
|
-
e[n] === "`" && !
|
|
47
|
+
e[n] === "`" && !le(e, n) && (t += 1);
|
|
48
48
|
}
|
|
49
49
|
return t;
|
|
50
|
-
},
|
|
50
|
+
}, y = (e, t) => {
|
|
51
51
|
let n = !1, r = !1, i = -1;
|
|
52
52
|
for (let a = 0; a < e.length; a += 1) {
|
|
53
53
|
if (e[a] === "\\" && a + 1 < e.length && e[a + 1] === "`") {
|
|
@@ -64,16 +64,16 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
64
64
|
} else n = !0, i = a;
|
|
65
65
|
}
|
|
66
66
|
return !1;
|
|
67
|
-
},
|
|
67
|
+
}, de = /^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm, fe = (e) => !e || typeof e != "string" || !e.includes(">") ? e : e.replace(de, (t, n, r, i) => v(e, i) ? t : `${n}\\>${r}`), b = /(\*\*)([^*]*\*?)$/, pe = /(__)([^_]*?)$/, me = /(\*\*\*)([^*]*?)$/, he = /(\*)([^*]*?)$/, ge = /(_)([^_]*?)$/, _e = /(`)([^`]*?)$/, x = /(~~)([^~]*?)$/, S = /^[\s_~*`]*$/, C = /^[\s]*[-*+][\s]+$/, ve = /[\p{L}\p{N}_]/u, ye = /^```[^`\n]*```?$/, be = /^\*{4,}$/, xe = /(__)([^_]+)_$/, Se = /(~~)([^~]+)~$/, Ce = /~~/g, w = (e) => {
|
|
68
68
|
if (!e) return !1;
|
|
69
69
|
let t = e.charCodeAt(0);
|
|
70
|
-
return t >= 48 && t <= 57 || t >= 65 && t <= 90 || t >= 97 && t <= 122 || t === 95 ||
|
|
71
|
-
},
|
|
70
|
+
return t >= 48 && t <= 57 || t >= 65 && t <= 90 || t >= 97 && t <= 122 || t === 95 || ve.test(e);
|
|
71
|
+
}, we = (e, t) => {
|
|
72
72
|
let n = 1;
|
|
73
73
|
for (let r = t - 1; r >= 0; --r) if (e[r] === "]") n += 1;
|
|
74
74
|
else if (e[r] === "[" && (--n, n === 0)) return r;
|
|
75
75
|
return -1;
|
|
76
|
-
},
|
|
76
|
+
}, Te = (e, t) => {
|
|
77
77
|
let n = 1;
|
|
78
78
|
for (let r = t + 1; r < e.length; r += 1) if (e[r] === "[") n += 1;
|
|
79
79
|
else if (e[r] === "]" && (--n, n === 0)) return r;
|
|
@@ -88,20 +88,20 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
88
88
|
e[i] === "$" && (e[i + 1] === "$" ? (r = !r, i += 1, n = !1) : r || (n = !n));
|
|
89
89
|
}
|
|
90
90
|
return n || r;
|
|
91
|
-
},
|
|
91
|
+
}, Ee = (e, t) => {
|
|
92
92
|
for (let n = t; n < e.length; n += 1) {
|
|
93
93
|
if (e[n] === ")") return !0;
|
|
94
94
|
if (e[n] === "\n") return !1;
|
|
95
95
|
}
|
|
96
96
|
return !1;
|
|
97
|
-
},
|
|
97
|
+
}, De = (e, t) => {
|
|
98
98
|
for (let n = t - 1; n >= 0; --n) {
|
|
99
99
|
if (e[n] === ")") return !1;
|
|
100
|
-
if (e[n] === "(") return n > 0 && e[n - 1] === "]" &&
|
|
100
|
+
if (e[n] === "(") return n > 0 && e[n - 1] === "]" && Ee(e, t);
|
|
101
101
|
if (e[n] === "\n") return !1;
|
|
102
102
|
}
|
|
103
103
|
return !1;
|
|
104
|
-
},
|
|
104
|
+
}, Oe = (e, t) => {
|
|
105
105
|
for (let n = t - 1; n >= 0; --n) {
|
|
106
106
|
if (e[n] === ">") return !1;
|
|
107
107
|
if (e[n] === "<") {
|
|
@@ -129,7 +129,7 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
129
129
|
break;
|
|
130
130
|
}
|
|
131
131
|
return o >= 3 && !s;
|
|
132
|
-
},
|
|
132
|
+
}, ke = (e, t, n, r) => n === "\\" || e.includes("$") && T(e, t) ? !0 : n !== "*" && r === "*" ? (t < e.length - 2 ? e[t + 2] : "") !== "*" : !!(n === "*" || n && r && w(n) && w(r) || (!n || n === " " || n === " " || n === "\n") && (!r || r === " " || r === " " || r === "\n")), Ae = (e) => {
|
|
133
133
|
let t = 0, n = !1, r = e.length;
|
|
134
134
|
for (let i = 0; i < r; i += 1) {
|
|
135
135
|
if (e[i] === "`" && i + 2 < r && e[i + 1] === "`" && e[i + 2] === "`") {
|
|
@@ -138,10 +138,10 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
138
138
|
}
|
|
139
139
|
if (n || e[i] !== "*") continue;
|
|
140
140
|
let a = i > 0 ? e[i - 1] : "", o = i < r - 1 ? e[i + 1] : "";
|
|
141
|
-
|
|
141
|
+
ke(e, i, a, o) || (t += 1);
|
|
142
142
|
}
|
|
143
143
|
return t;
|
|
144
|
-
},
|
|
144
|
+
}, je = (e, t, n, r) => !!(n === "\\" || e.includes("$") && T(e, t) || De(e, t) || Oe(e, t) || n === "_" || r === "_" || n && r && w(n) && w(r)), Me = (e) => {
|
|
145
145
|
let t = 0, n = !1, r = e.length;
|
|
146
146
|
for (let i = 0; i < r; i += 1) {
|
|
147
147
|
if (e[i] === "`" && i + 2 < r && e[i + 1] === "`" && e[i + 2] === "`") {
|
|
@@ -150,10 +150,10 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
150
150
|
}
|
|
151
151
|
if (n || e[i] !== "_") continue;
|
|
152
152
|
let a = i > 0 ? e[i - 1] : "", o = i < r - 1 ? e[i + 1] : "";
|
|
153
|
-
|
|
153
|
+
je(e, i, a, o) || (t += 1);
|
|
154
154
|
}
|
|
155
155
|
return t;
|
|
156
|
-
},
|
|
156
|
+
}, Ne = (e) => {
|
|
157
157
|
let t = 0, n = 0, r = !1;
|
|
158
158
|
for (let i = 0; i < e.length; i += 1) {
|
|
159
159
|
if (e[i] === "`" && i + 2 < e.length && e[i + 1] === "`" && e[i + 2] === "`") {
|
|
@@ -173,7 +173,7 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
173
173
|
n || e[r] === "*" && r + 1 < e.length && e[r + 1] === "*" && (t += 1, r += 1);
|
|
174
174
|
}
|
|
175
175
|
return t;
|
|
176
|
-
},
|
|
176
|
+
}, Pe = (e) => {
|
|
177
177
|
let t = 0, n = !1;
|
|
178
178
|
for (let r = 0; r < e.length; r += 1) {
|
|
179
179
|
if (e[r] === "`" && r + 2 < e.length && e[r + 1] === "`" && e[r + 2] === "`") {
|
|
@@ -183,32 +183,32 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
183
183
|
n || e[r] === "_" && r + 1 < e.length && e[r + 1] === "_" && (t += 1, r += 1);
|
|
184
184
|
}
|
|
185
185
|
return t;
|
|
186
|
-
},
|
|
187
|
-
if (!t ||
|
|
186
|
+
}, Fe = (e, t, n) => {
|
|
187
|
+
if (!t || S.test(t)) return !0;
|
|
188
188
|
let r = e.substring(0, n).lastIndexOf("\n"), i = r === -1 ? 0 : r + 1, a = e.substring(i, n);
|
|
189
|
-
return
|
|
190
|
-
},
|
|
191
|
-
let t = e.match(
|
|
189
|
+
return C.test(a) && t.includes("\n") ? !0 : E(e, n, "*");
|
|
190
|
+
}, Ie = (e) => {
|
|
191
|
+
let t = e.match(b);
|
|
192
192
|
if (!t) return e;
|
|
193
193
|
let n = t[2], r = e.lastIndexOf(t[1]);
|
|
194
|
-
return
|
|
195
|
-
},
|
|
196
|
-
if (!t ||
|
|
194
|
+
return v(e, r) || y(e, r) || Fe(e, n, r) ? e : D(e) % 2 == 1 ? n.endsWith("*") ? `${e}*` : `${e}**` : e;
|
|
195
|
+
}, Le = (e, t, n) => {
|
|
196
|
+
if (!t || S.test(t)) return !0;
|
|
197
197
|
let r = e.substring(0, n).lastIndexOf("\n"), i = r === -1 ? 0 : r + 1, a = e.substring(i, n);
|
|
198
|
-
return
|
|
199
|
-
},
|
|
200
|
-
let t = e.match(
|
|
198
|
+
return C.test(a) && t.includes("\n") ? !0 : E(e, n, "_");
|
|
199
|
+
}, Re = (e) => {
|
|
200
|
+
let t = e.match(pe);
|
|
201
201
|
if (!t) {
|
|
202
|
-
let t = e.match(
|
|
202
|
+
let t = e.match(xe);
|
|
203
203
|
if (t) {
|
|
204
204
|
let n = e.lastIndexOf(t[1]);
|
|
205
|
-
if (!(
|
|
205
|
+
if (!(v(e, n) || y(e, n)) && Pe(e) % 2 == 1) return `${e}_`;
|
|
206
206
|
}
|
|
207
207
|
return e;
|
|
208
208
|
}
|
|
209
209
|
let n = t[2], r = e.lastIndexOf(t[1]);
|
|
210
|
-
return
|
|
211
|
-
},
|
|
210
|
+
return v(e, r) || y(e, r) || Le(e, n, r) ? e : Pe(e) % 2 == 1 ? `${e}__` : e;
|
|
211
|
+
}, ze = (e) => {
|
|
212
212
|
let t = !1;
|
|
213
213
|
for (let n = 0; n < e.length; n += 1) {
|
|
214
214
|
if (e[n] === "`" && n + 2 < e.length && e[n + 1] === "`" && e[n + 2] === "`") {
|
|
@@ -222,104 +222,104 @@ var ne = Object.defineProperty, re = Object.defineProperties, ie = Object.getOwn
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
return -1;
|
|
225
|
-
}, ze = (e) => {
|
|
226
|
-
if (!e.match(fe)) return e;
|
|
227
|
-
let t = Re(e);
|
|
228
|
-
if (t === -1 || b(e, t) || x(e, t)) return e;
|
|
229
|
-
let n = e.substring(t + 1);
|
|
230
|
-
return !n || C.test(n) ? e : ke(e) % 2 == 1 ? `${e}*` : e;
|
|
231
225
|
}, Be = (e) => {
|
|
226
|
+
if (!e.match(he)) return e;
|
|
227
|
+
let t = ze(e);
|
|
228
|
+
if (t === -1 || v(e, t) || y(e, t)) return e;
|
|
229
|
+
let n = e.substring(t + 1);
|
|
230
|
+
return !n || S.test(n) ? e : Ae(e) % 2 == 1 ? `${e}*` : e;
|
|
231
|
+
}, Ve = (e) => {
|
|
232
232
|
let t = !1;
|
|
233
233
|
for (let n = 0; n < e.length; n += 1) {
|
|
234
234
|
if (e[n] === "`" && n + 2 < e.length && e[n + 1] === "`" && e[n + 2] === "`") {
|
|
235
235
|
t = !t, n += 2;
|
|
236
236
|
continue;
|
|
237
237
|
}
|
|
238
|
-
if (!t && e[n] === "_" && e[n - 1] !== "_" && e[n + 1] !== "_" && e[n - 1] !== "\\" && !T(e, n) && !
|
|
238
|
+
if (!t && e[n] === "_" && e[n - 1] !== "_" && e[n + 1] !== "_" && e[n - 1] !== "\\" && !T(e, n) && !De(e, n)) {
|
|
239
239
|
let t = n > 0 ? e[n - 1] : "", r = n < e.length - 1 ? e[n + 1] : "";
|
|
240
240
|
if (t && r && w(t) && w(r)) continue;
|
|
241
241
|
return n;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
return -1;
|
|
245
|
-
},
|
|
245
|
+
}, He = (e) => {
|
|
246
246
|
let t = e.length;
|
|
247
247
|
for (; t > 0 && e[t - 1] === "\n";) --t;
|
|
248
248
|
return t < e.length ? `${e.slice(0, t)}_${e.slice(t)}` : `${e}_`;
|
|
249
|
-
},
|
|
249
|
+
}, Ue = (e) => {
|
|
250
250
|
if (!e.endsWith("**")) return null;
|
|
251
251
|
let t = e.slice(0, -2);
|
|
252
252
|
if (D(t) % 2 != 1) return null;
|
|
253
|
-
let n = t.indexOf("**"), r =
|
|
253
|
+
let n = t.indexOf("**"), r = Ve(t);
|
|
254
254
|
return n !== -1 && r !== -1 && n < r ? `${t}_**` : null;
|
|
255
|
-
},
|
|
256
|
-
if (!e.match(
|
|
257
|
-
let t =
|
|
255
|
+
}, We = (e) => {
|
|
256
|
+
if (!e.match(ge)) return e;
|
|
257
|
+
let t = Ve(e);
|
|
258
258
|
if (t === -1) return e;
|
|
259
259
|
let n = e.substring(t + 1);
|
|
260
|
-
if (!n ||
|
|
261
|
-
if (
|
|
262
|
-
let t =
|
|
263
|
-
return t === null ?
|
|
260
|
+
if (!n || S.test(n) || v(e, t) || y(e, t)) return e;
|
|
261
|
+
if (Me(e) % 2 == 1) {
|
|
262
|
+
let t = Ue(e);
|
|
263
|
+
return t === null ? He(e) : t;
|
|
264
264
|
}
|
|
265
265
|
return e;
|
|
266
|
-
},
|
|
267
|
-
let t = D(e), n =
|
|
266
|
+
}, Ge = (e) => {
|
|
267
|
+
let t = D(e), n = Ae(e);
|
|
268
268
|
return t % 2 == 0 && n % 2 == 0;
|
|
269
|
-
},
|
|
270
|
-
if (
|
|
271
|
-
let t = e.match(
|
|
269
|
+
}, Ke = (e, t, n) => !t || S.test(t) || v(e, n) || y(e, n) ? !0 : E(e, n, "*"), qe = (e) => {
|
|
270
|
+
if (be.test(e)) return e;
|
|
271
|
+
let t = e.match(me);
|
|
272
272
|
if (!t) return e;
|
|
273
273
|
let n = t[2];
|
|
274
|
-
return
|
|
275
|
-
},
|
|
276
|
-
let t = e.match(
|
|
277
|
-
return !t || t.index === void 0 ||
|
|
278
|
-
},
|
|
279
|
-
let t =
|
|
274
|
+
return Ke(e, n, e.lastIndexOf(t[1])) ? e : Ne(e) % 2 == 1 ? Ge(e) ? e : `${e}***` : e;
|
|
275
|
+
}, Je = /<[a-zA-Z/][^>]*$/, Ye = (e) => {
|
|
276
|
+
let t = e.match(Je);
|
|
277
|
+
return !t || t.index === void 0 || v(e, t.index) ? e : e.substring(0, t.index).trimEnd();
|
|
278
|
+
}, Xe = (e) => !e.match(ye) || e.includes("\n") ? null : e.endsWith("``") && !e.endsWith("```") ? `${e}\`` : e, Ze = (e) => (e.match(/```/g) || []).length % 2 == 1, Qe = (e) => {
|
|
279
|
+
let t = Xe(e);
|
|
280
280
|
if (t !== null) return t;
|
|
281
|
-
let n = e.match(
|
|
282
|
-
if (n && !
|
|
281
|
+
let n = e.match(_e);
|
|
282
|
+
if (n && !Ze(e)) {
|
|
283
283
|
let t = n[2];
|
|
284
|
-
if (!t ||
|
|
285
|
-
if (
|
|
284
|
+
if (!t || S.test(t)) return e;
|
|
285
|
+
if (ue(e) % 2 == 1) return `${e}\``;
|
|
286
286
|
}
|
|
287
287
|
return e;
|
|
288
|
-
},
|
|
288
|
+
}, $e = (e, t) => t >= 2 && e.substring(t - 2, t + 1) === "```" || t >= 1 && e.substring(t - 1, t + 2) === "```" || t <= e.length - 3 && e.substring(t, t + 3) === "```", et = (e) => {
|
|
289
289
|
let t = 0, n = !1;
|
|
290
|
-
for (let r = 0; r < e.length - 1; r += 1) e[r] === "`" &&
|
|
290
|
+
for (let r = 0; r < e.length - 1; r += 1) e[r] === "`" && !$e(e, r) && (n = !n), !n && e[r] === "$" && e[r + 1] === "$" && (t += 1, r += 1);
|
|
291
291
|
return t;
|
|
292
|
-
},
|
|
292
|
+
}, tt = (e) => {
|
|
293
293
|
let t = 0, n = !1;
|
|
294
294
|
for (let r = 0; r < e.length; r += 1) {
|
|
295
295
|
if (e[r] === "\\") {
|
|
296
296
|
r += 1;
|
|
297
297
|
continue;
|
|
298
298
|
}
|
|
299
|
-
if (e[r] === "`" &&
|
|
299
|
+
if (e[r] === "`" && !$e(e, r)) {
|
|
300
300
|
n = !n;
|
|
301
301
|
continue;
|
|
302
302
|
}
|
|
303
303
|
!n && e[r] === "$" && (r + 1 < e.length && e[r + 1] === "$" ? r += 1 : t += 1);
|
|
304
304
|
}
|
|
305
305
|
return t;
|
|
306
|
-
},
|
|
306
|
+
}, nt = (e) => {
|
|
307
307
|
if (e.endsWith("$") && !e.endsWith("$$")) return `${e}$`;
|
|
308
308
|
let t = e.indexOf("$$");
|
|
309
309
|
return t !== -1 && e.indexOf("\n", t) !== -1 && !e.endsWith("\n") ? `${e}
|
|
310
310
|
$$` : `${e}$$`;
|
|
311
|
-
},
|
|
311
|
+
}, rt = (e) => et(e) % 2 == 0 ? e : nt(e), it = (e) => tt(e) % 2 == 1 ? `${e}$` : e, at = (e, t, n) => {
|
|
312
312
|
if (e.substring(t + 2).includes(")")) return null;
|
|
313
|
-
let r =
|
|
314
|
-
if (r === -1 ||
|
|
313
|
+
let r = we(e, t);
|
|
314
|
+
if (r === -1 || v(e, r)) return null;
|
|
315
315
|
let i = r > 0 && e[r - 1] === "!", a = i ? r - 1 : r, o = e.substring(0, a);
|
|
316
316
|
if (i) return o;
|
|
317
317
|
let s = e.substring(r + 1, t);
|
|
318
318
|
return n === "text-only" ? `${o}${s}` : `${o}[${s}](streamdown:incomplete-link)`;
|
|
319
|
-
},
|
|
320
|
-
for (let n = 0; n < t; n++) if (e[n] === "[" && !
|
|
319
|
+
}, ot = (e, t) => {
|
|
320
|
+
for (let n = 0; n < t; n++) if (e[n] === "[" && !v(e, n)) {
|
|
321
321
|
if (n > 0 && e[n - 1] === "!") continue;
|
|
322
|
-
let t =
|
|
322
|
+
let t = Te(e, n);
|
|
323
323
|
if (t === -1) return n;
|
|
324
324
|
if (t + 1 < e.length && e[t + 1] === "(") {
|
|
325
325
|
let r = e.indexOf(")", t + 2);
|
|
@@ -327,70 +327,70 @@ $$` : `${e}$$`;
|
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
return t;
|
|
330
|
-
},
|
|
330
|
+
}, st = (e, t, n) => {
|
|
331
331
|
let r = t > 0 && e[t - 1] === "!", i = r ? t - 1 : t;
|
|
332
332
|
if (!e.substring(t + 1).includes("]")) {
|
|
333
333
|
let a = e.substring(0, i);
|
|
334
334
|
if (r) return a;
|
|
335
335
|
if (n === "text-only") {
|
|
336
|
-
let n =
|
|
336
|
+
let n = ot(e, t);
|
|
337
337
|
return e.substring(0, n) + e.substring(n + 1);
|
|
338
338
|
}
|
|
339
339
|
return `${e}](streamdown:incomplete-link)`;
|
|
340
340
|
}
|
|
341
|
-
if (
|
|
341
|
+
if (Te(e, t) === -1) {
|
|
342
342
|
let a = e.substring(0, i);
|
|
343
343
|
if (r) return a;
|
|
344
344
|
if (n === "text-only") {
|
|
345
|
-
let n =
|
|
345
|
+
let n = ot(e, t);
|
|
346
346
|
return e.substring(0, n) + e.substring(n + 1);
|
|
347
347
|
}
|
|
348
348
|
return `${e}](streamdown:incomplete-link)`;
|
|
349
349
|
}
|
|
350
350
|
return null;
|
|
351
|
-
},
|
|
351
|
+
}, ct = (e, t = "protocol") => {
|
|
352
352
|
let n = e.lastIndexOf("](");
|
|
353
|
-
if (n !== -1 && !
|
|
354
|
-
let r =
|
|
353
|
+
if (n !== -1 && !v(e, n)) {
|
|
354
|
+
let r = at(e, n, t);
|
|
355
355
|
if (r !== null) return r;
|
|
356
356
|
}
|
|
357
|
-
for (let n = e.length - 1; n >= 0; --n) if (e[n] === "[" && !
|
|
358
|
-
let r =
|
|
357
|
+
for (let n = e.length - 1; n >= 0; --n) if (e[n] === "[" && !v(e, n)) {
|
|
358
|
+
let r = st(e, n, t);
|
|
359
359
|
if (r !== null) return r;
|
|
360
360
|
}
|
|
361
361
|
return e;
|
|
362
|
-
},
|
|
362
|
+
}, lt = /^-{1,2}$/, ut = /^[\s]*-{1,2}[\s]+$/, dt = /^={1,2}$/, ft = /^[\s]*={1,2}[\s]+$/, pt = (e) => {
|
|
363
363
|
if (!e || typeof e != "string") return e;
|
|
364
364
|
let t = e.lastIndexOf("\n");
|
|
365
365
|
if (t === -1) return e;
|
|
366
366
|
let n = e.substring(t + 1), r = e.substring(0, t), i = n.trim();
|
|
367
|
-
if (
|
|
367
|
+
if (lt.test(i) && !n.match(ut)) {
|
|
368
368
|
let t = r.split("\n").at(-1);
|
|
369
369
|
if (t && t.trim().length > 0) return `${e}\u200B`;
|
|
370
370
|
}
|
|
371
|
-
if (
|
|
371
|
+
if (dt.test(i) && !n.match(ft)) {
|
|
372
372
|
let t = r.split("\n").at(-1);
|
|
373
373
|
if (t && t.trim().length > 0) return `${e}\u200B`;
|
|
374
374
|
}
|
|
375
375
|
return e;
|
|
376
|
-
},
|
|
377
|
-
let t = e.match(
|
|
376
|
+
}, mt = /* @__PURE__ */ RegExp("(?<=[\\p{L}\\p{N}_])~(?!~)(?=[\\p{L}\\p{N}_])", "gu"), ht = (e) => !e || typeof e != "string" || !e.includes("~") ? e : e.replace(mt, (t, n) => v(e, n) ? t : "\\~"), gt = (e) => {
|
|
377
|
+
let t = e.match(x);
|
|
378
378
|
if (t) {
|
|
379
379
|
let n = t[2];
|
|
380
|
-
if (!n ||
|
|
380
|
+
if (!n || S.test(n)) return e;
|
|
381
381
|
let r = e.lastIndexOf(t[1]);
|
|
382
|
-
if (
|
|
383
|
-
if (e.match(
|
|
382
|
+
if (v(e, r) || y(e, r)) return e;
|
|
383
|
+
if (e.match(Ce)?.length % 2 == 1) return `${e}~~`;
|
|
384
384
|
} else {
|
|
385
|
-
let t = e.match(
|
|
385
|
+
let t = e.match(Se);
|
|
386
386
|
if (t) {
|
|
387
387
|
let n = e.lastIndexOf(t[0].slice(0, 2));
|
|
388
|
-
if (
|
|
389
|
-
if (e.match(
|
|
388
|
+
if (v(e, n) || y(e, n)) return e;
|
|
389
|
+
if (e.match(Ce)?.length % 2 == 1) return `${e}~`;
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
return e;
|
|
393
|
-
}, O = (e) => e !== !1,
|
|
393
|
+
}, O = (e) => e !== !1, _t = (e) => e === !0, k = {
|
|
394
394
|
SINGLE_TILDE: 0,
|
|
395
395
|
COMPARISON_OPERATORS: 5,
|
|
396
396
|
HTML_TAGS: 10,
|
|
@@ -406,11 +406,11 @@ $$` : `${e}$$`;
|
|
|
406
406
|
KATEX: 70,
|
|
407
407
|
INLINE_KATEX: 75,
|
|
408
408
|
DEFAULT: 100
|
|
409
|
-
},
|
|
409
|
+
}, vt = [
|
|
410
410
|
{
|
|
411
411
|
handler: {
|
|
412
412
|
name: "singleTilde",
|
|
413
|
-
handle:
|
|
413
|
+
handle: ht,
|
|
414
414
|
priority: k.SINGLE_TILDE
|
|
415
415
|
},
|
|
416
416
|
optionKey: "singleTilde"
|
|
@@ -418,7 +418,7 @@ $$` : `${e}$$`;
|
|
|
418
418
|
{
|
|
419
419
|
handler: {
|
|
420
420
|
name: "comparisonOperators",
|
|
421
|
-
handle:
|
|
421
|
+
handle: fe,
|
|
422
422
|
priority: k.COMPARISON_OPERATORS
|
|
423
423
|
},
|
|
424
424
|
optionKey: "comparisonOperators"
|
|
@@ -426,7 +426,7 @@ $$` : `${e}$$`;
|
|
|
426
426
|
{
|
|
427
427
|
handler: {
|
|
428
428
|
name: "htmlTags",
|
|
429
|
-
handle:
|
|
429
|
+
handle: Ye,
|
|
430
430
|
priority: k.HTML_TAGS
|
|
431
431
|
},
|
|
432
432
|
optionKey: "htmlTags"
|
|
@@ -434,7 +434,7 @@ $$` : `${e}$$`;
|
|
|
434
434
|
{
|
|
435
435
|
handler: {
|
|
436
436
|
name: "setextHeadings",
|
|
437
|
-
handle:
|
|
437
|
+
handle: pt,
|
|
438
438
|
priority: k.SETEXT_HEADINGS
|
|
439
439
|
},
|
|
440
440
|
optionKey: "setextHeadings"
|
|
@@ -442,7 +442,7 @@ $$` : `${e}$$`;
|
|
|
442
442
|
{
|
|
443
443
|
handler: {
|
|
444
444
|
name: "links",
|
|
445
|
-
handle:
|
|
445
|
+
handle: ct,
|
|
446
446
|
priority: k.LINKS
|
|
447
447
|
},
|
|
448
448
|
optionKey: "links",
|
|
@@ -451,7 +451,7 @@ $$` : `${e}$$`;
|
|
|
451
451
|
{
|
|
452
452
|
handler: {
|
|
453
453
|
name: "boldItalic",
|
|
454
|
-
handle:
|
|
454
|
+
handle: qe,
|
|
455
455
|
priority: k.BOLD_ITALIC
|
|
456
456
|
},
|
|
457
457
|
optionKey: "boldItalic"
|
|
@@ -459,7 +459,7 @@ $$` : `${e}$$`;
|
|
|
459
459
|
{
|
|
460
460
|
handler: {
|
|
461
461
|
name: "bold",
|
|
462
|
-
handle:
|
|
462
|
+
handle: Ie,
|
|
463
463
|
priority: k.BOLD
|
|
464
464
|
},
|
|
465
465
|
optionKey: "bold"
|
|
@@ -467,7 +467,7 @@ $$` : `${e}$$`;
|
|
|
467
467
|
{
|
|
468
468
|
handler: {
|
|
469
469
|
name: "italicDoubleUnderscore",
|
|
470
|
-
handle:
|
|
470
|
+
handle: Re,
|
|
471
471
|
priority: k.ITALIC_DOUBLE_UNDERSCORE
|
|
472
472
|
},
|
|
473
473
|
optionKey: "italic"
|
|
@@ -475,7 +475,7 @@ $$` : `${e}$$`;
|
|
|
475
475
|
{
|
|
476
476
|
handler: {
|
|
477
477
|
name: "italicSingleAsterisk",
|
|
478
|
-
handle:
|
|
478
|
+
handle: Be,
|
|
479
479
|
priority: k.ITALIC_SINGLE_ASTERISK
|
|
480
480
|
},
|
|
481
481
|
optionKey: "italic"
|
|
@@ -483,7 +483,7 @@ $$` : `${e}$$`;
|
|
|
483
483
|
{
|
|
484
484
|
handler: {
|
|
485
485
|
name: "italicSingleUnderscore",
|
|
486
|
-
handle:
|
|
486
|
+
handle: We,
|
|
487
487
|
priority: k.ITALIC_SINGLE_UNDERSCORE
|
|
488
488
|
},
|
|
489
489
|
optionKey: "italic"
|
|
@@ -491,7 +491,7 @@ $$` : `${e}$$`;
|
|
|
491
491
|
{
|
|
492
492
|
handler: {
|
|
493
493
|
name: "inlineCode",
|
|
494
|
-
handle:
|
|
494
|
+
handle: Qe,
|
|
495
495
|
priority: k.INLINE_CODE
|
|
496
496
|
},
|
|
497
497
|
optionKey: "inlineCode"
|
|
@@ -499,7 +499,7 @@ $$` : `${e}$$`;
|
|
|
499
499
|
{
|
|
500
500
|
handler: {
|
|
501
501
|
name: "strikethrough",
|
|
502
|
-
handle:
|
|
502
|
+
handle: gt,
|
|
503
503
|
priority: k.STRIKETHROUGH
|
|
504
504
|
},
|
|
505
505
|
optionKey: "strikethrough"
|
|
@@ -507,7 +507,7 @@ $$` : `${e}$$`;
|
|
|
507
507
|
{
|
|
508
508
|
handler: {
|
|
509
509
|
name: "katex",
|
|
510
|
-
handle:
|
|
510
|
+
handle: rt,
|
|
511
511
|
priority: k.KATEX
|
|
512
512
|
},
|
|
513
513
|
optionKey: "katex"
|
|
@@ -515,24 +515,24 @@ $$` : `${e}$$`;
|
|
|
515
515
|
{
|
|
516
516
|
handler: {
|
|
517
517
|
name: "inlineKatex",
|
|
518
|
-
handle:
|
|
518
|
+
handle: it,
|
|
519
519
|
priority: k.INLINE_KATEX
|
|
520
520
|
},
|
|
521
521
|
optionKey: "inlineKatex"
|
|
522
522
|
}
|
|
523
|
-
],
|
|
523
|
+
], yt = (e) => {
|
|
524
524
|
let t = e?.linkMode ?? "protocol";
|
|
525
|
-
return
|
|
526
|
-
handler:
|
|
525
|
+
return vt.filter(({ handler: t, optionKey: n }) => t.name === "links" ? O(e?.links) || O(e?.images) : t.name === "inlineKatex" ? _t(e?.inlineKatex) : O(e?.[n])).map(({ handler: e, earlyReturn: n }) => e.name === "links" ? {
|
|
526
|
+
handler: ce(_({}, e), { handle: (e) => ct(e, t) }),
|
|
527
527
|
earlyReturn: t === "protocol" ? n : void 0
|
|
528
528
|
} : {
|
|
529
529
|
handler: e,
|
|
530
530
|
earlyReturn: n
|
|
531
531
|
});
|
|
532
|
-
},
|
|
532
|
+
}, bt = (e, t) => {
|
|
533
533
|
if (!e || typeof e != "string") return e;
|
|
534
|
-
let n = e.endsWith(" ") && !e.endsWith(" ") ? e.slice(0, -1) : e, r =
|
|
535
|
-
handler:
|
|
534
|
+
let n = e.endsWith(" ") && !e.endsWith(" ") ? e.slice(0, -1) : e, r = yt(t), i = (t?.handlers ?? []).map((e) => ({
|
|
535
|
+
handler: ce(_({}, e), { priority: e.priority ?? k.DEFAULT }),
|
|
536
536
|
earlyReturn: void 0
|
|
537
537
|
})), a = [...r, ...i].sort((e, t) => (e.handler.priority ?? 0) - (t.handler.priority ?? 0));
|
|
538
538
|
for (let { handler: e, earlyReturn: t } of a) if (n = e.handle(n), t != null && t(n)) return n;
|
|
@@ -555,7 +555,7 @@ function A() {
|
|
|
555
555
|
};
|
|
556
556
|
}
|
|
557
557
|
var j = A();
|
|
558
|
-
function
|
|
558
|
+
function xt(e) {
|
|
559
559
|
j = e;
|
|
560
560
|
}
|
|
561
561
|
var M = { exec: () => null };
|
|
@@ -576,7 +576,7 @@ function P(e, t = "") {
|
|
|
576
576
|
};
|
|
577
577
|
return r;
|
|
578
578
|
}
|
|
579
|
-
var
|
|
579
|
+
var St = ((e = "") => {
|
|
580
580
|
try {
|
|
581
581
|
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
582
582
|
} catch {
|
|
@@ -639,96 +639,96 @@ var xt = ((e = "") => {
|
|
|
639
639
|
headingBeginRegex: N((e) => RegExp(`^ {0,${e}}#`)),
|
|
640
640
|
htmlBeginRegex: N((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
|
|
641
641
|
blockquoteBeginRegex: N((e) => RegExp(`^ {0,${e}}>`))
|
|
642
|
-
},
|
|
643
|
-
blockquote: P(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
644
|
-
code:
|
|
645
|
-
def:
|
|
646
|
-
fences:
|
|
647
|
-
heading:
|
|
642
|
+
}, Ct = /^(?:[ \t]*(?:\n|$))+/, wt = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Tt = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, I = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Et = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Dt = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Ot = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, kt = P(Ot).replace(/bull/g, Dt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), At = P(Ot).replace(/bull/g, Dt).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), jt = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, Mt = /^[^\n]+/, Nt = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Pt = P(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Nt).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ft = P(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, Dt).getRegex(), L = "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|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", It = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Lt = P("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\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", It).replace("tag", L).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Rt = (e) => P(jt).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", L).getRegex(), zt = Rt(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), Bt = Rt(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), Vt = {
|
|
643
|
+
blockquote: P(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", Bt).getRegex(),
|
|
644
|
+
code: wt,
|
|
645
|
+
def: Pt,
|
|
646
|
+
fences: Tt,
|
|
647
|
+
heading: Et,
|
|
648
648
|
hr: I,
|
|
649
|
-
html:
|
|
650
|
-
lheading:
|
|
651
|
-
list:
|
|
652
|
-
newline:
|
|
653
|
-
paragraph:
|
|
649
|
+
html: Lt,
|
|
650
|
+
lheading: kt,
|
|
651
|
+
list: Ft,
|
|
652
|
+
newline: Ct,
|
|
653
|
+
paragraph: zt,
|
|
654
654
|
table: M,
|
|
655
|
-
text:
|
|
656
|
-
},
|
|
657
|
-
...
|
|
658
|
-
lheading:
|
|
659
|
-
table:
|
|
660
|
-
paragraph: P(
|
|
661
|
-
},
|
|
662
|
-
...
|
|
663
|
-
html: P("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",
|
|
655
|
+
text: Mt
|
|
656
|
+
}, Ht = P("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", L).getRegex(), Ut = {
|
|
657
|
+
...Vt,
|
|
658
|
+
lheading: At,
|
|
659
|
+
table: Ht,
|
|
660
|
+
paragraph: P(jt).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Ht).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", L).getRegex()
|
|
661
|
+
}, Wt = {
|
|
662
|
+
...Vt,
|
|
663
|
+
html: P("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", It).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(),
|
|
664
664
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
665
665
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
666
666
|
fences: M,
|
|
667
667
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
668
|
-
paragraph: P(
|
|
669
|
-
},
|
|
668
|
+
paragraph: P(jt).replace("hr", I).replace("heading", " *#{1,6} *[^\n]").replace("lheading", kt).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
669
|
+
}, Gt = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Kt = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, qt = /^( {2,}|\\)\n(?!\s*$)/, Jt = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, R = /[\p{P}\p{S}]/u, z = /[\s\p{P}\p{S}]/u, Yt = /[^\s\p{P}\p{S}]/u, Xt = P(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, z).getRegex(), Zt = /(?!~)[\p{P}\p{S}]/u, Qt = /(?!~)[\s\p{P}\p{S}]/u, $t = /(?:[^\s\p{P}\p{S}]|~)/u, en = P(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", St ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), tn = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, nn = P(tn, "u").replace(/punct/g, R).getRegex(), rn = P(tn, "u").replace(/punct/g, Zt).getRegex(), an = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", on = P(an, "gu").replace(/notPunctSpace/g, Yt).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), sn = P(an, "gu").replace(/notPunctSpace/g, $t).replace(/punctSpace/g, Qt).replace(/punct/g, Zt).getRegex(), cn = P("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Yt).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), ln = P(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, R).getRegex(), un = P("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, Yt).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), dn = P(/\\(punct)/, "gu").replace(/punct/g, R).getRegex(), fn = P(/^<(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(), pn = P(It).replace("(?:-->|$)", "-->").getRegex(), mn = P("^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", pn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), B = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, hn = P(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", B).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), gn = P(/^!?\[(label)\]\[(ref)\]/).replace("label", B).replace("ref", Nt).getRegex(), _n = P(/^!?\[(ref)\](?:\[\])?/).replace("ref", Nt).getRegex(), vn = P("reflink|nolink(?!\\()", "g").replace("reflink", gn).replace("nolink", _n).getRegex(), yn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, V = {
|
|
670
670
|
_backpedal: M,
|
|
671
|
-
anyPunctuation:
|
|
672
|
-
autolink:
|
|
673
|
-
blockSkip:
|
|
674
|
-
br:
|
|
675
|
-
code:
|
|
671
|
+
anyPunctuation: dn,
|
|
672
|
+
autolink: fn,
|
|
673
|
+
blockSkip: en,
|
|
674
|
+
br: qt,
|
|
675
|
+
code: Kt,
|
|
676
676
|
del: M,
|
|
677
677
|
delLDelim: M,
|
|
678
678
|
delRDelim: M,
|
|
679
|
-
emStrongLDelim:
|
|
680
|
-
emStrongRDelimAst:
|
|
681
|
-
emStrongRDelimUnd:
|
|
682
|
-
escape:
|
|
683
|
-
link:
|
|
684
|
-
nolink:
|
|
685
|
-
punctuation:
|
|
686
|
-
reflink:
|
|
687
|
-
reflinkSearch:
|
|
688
|
-
tag:
|
|
689
|
-
text:
|
|
679
|
+
emStrongLDelim: nn,
|
|
680
|
+
emStrongRDelimAst: on,
|
|
681
|
+
emStrongRDelimUnd: cn,
|
|
682
|
+
escape: Gt,
|
|
683
|
+
link: hn,
|
|
684
|
+
nolink: _n,
|
|
685
|
+
punctuation: Xt,
|
|
686
|
+
reflink: gn,
|
|
687
|
+
reflinkSearch: vn,
|
|
688
|
+
tag: mn,
|
|
689
|
+
text: Jt,
|
|
690
690
|
url: M
|
|
691
|
-
}, yn = {
|
|
692
|
-
...vn,
|
|
693
|
-
link: P(/^!?\[(label)\]\((.*?)\)/).replace("label", V).getRegex(),
|
|
694
|
-
reflink: P(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", V).getRegex()
|
|
695
691
|
}, bn = {
|
|
696
|
-
...
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
692
|
+
...V,
|
|
693
|
+
link: P(/^!?\[(label)\]\((.*?)\)/).replace("label", B).getRegex(),
|
|
694
|
+
reflink: P(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", B).getRegex()
|
|
695
|
+
}, xn = {
|
|
696
|
+
...V,
|
|
697
|
+
emStrongRDelimAst: sn,
|
|
698
|
+
emStrongLDelim: rn,
|
|
699
|
+
delLDelim: ln,
|
|
700
|
+
delRDelim: un,
|
|
701
|
+
url: P(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", yn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
|
702
702
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
703
703
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
704
|
-
text: P(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",
|
|
705
|
-
},
|
|
706
|
-
...
|
|
707
|
-
br: P(
|
|
708
|
-
text: P(
|
|
704
|
+
text: P(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", yn).getRegex()
|
|
705
|
+
}, Sn = {
|
|
706
|
+
...xn,
|
|
707
|
+
br: P(qt).replace("{2,}", "*").getRegex(),
|
|
708
|
+
text: P(xn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
709
709
|
}, H = {
|
|
710
|
-
normal:
|
|
711
|
-
gfm:
|
|
712
|
-
pedantic:
|
|
710
|
+
normal: Vt,
|
|
711
|
+
gfm: Ut,
|
|
712
|
+
pedantic: Wt
|
|
713
713
|
}, U = {
|
|
714
|
-
normal:
|
|
715
|
-
gfm:
|
|
716
|
-
breaks:
|
|
717
|
-
pedantic:
|
|
718
|
-
},
|
|
714
|
+
normal: V,
|
|
715
|
+
gfm: xn,
|
|
716
|
+
breaks: Sn,
|
|
717
|
+
pedantic: bn
|
|
718
|
+
}, Cn = {
|
|
719
719
|
"&": "&",
|
|
720
720
|
"<": "<",
|
|
721
721
|
">": ">",
|
|
722
722
|
"\"": """,
|
|
723
723
|
"'": "'"
|
|
724
|
-
},
|
|
724
|
+
}, wn = (e) => Cn[e];
|
|
725
725
|
function W(e, t) {
|
|
726
726
|
if (t) {
|
|
727
|
-
if (F.escapeTest.test(e)) return e.replace(F.escapeReplace,
|
|
728
|
-
} else if (F.escapeTestNoEncode.test(e)) return e.replace(F.escapeReplaceNoEncode,
|
|
727
|
+
if (F.escapeTest.test(e)) return e.replace(F.escapeReplace, wn);
|
|
728
|
+
} else if (F.escapeTestNoEncode.test(e)) return e.replace(F.escapeReplaceNoEncode, wn);
|
|
729
729
|
return e;
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function Tn(e) {
|
|
732
732
|
try {
|
|
733
733
|
e = encodeURI(e).replace(F.percentDecode, "%");
|
|
734
734
|
} catch {
|
|
@@ -736,7 +736,7 @@ function wn(e) {
|
|
|
736
736
|
}
|
|
737
737
|
return e;
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function En(e, t) {
|
|
740
740
|
let n = e.replace(F.findPipe, (e, t, n) => {
|
|
741
741
|
let r = !1, i = t;
|
|
742
742
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
@@ -759,12 +759,12 @@ function G(e, t, n) {
|
|
|
759
759
|
}
|
|
760
760
|
return e.slice(0, r - i);
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Dn(e) {
|
|
763
763
|
let t = e.split("\n"), n = t.length - 1;
|
|
764
764
|
for (; n >= 0 && F.blankLine.test(t[n]);) n--;
|
|
765
765
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
766
766
|
}
|
|
767
|
-
function
|
|
767
|
+
function On(e, t) {
|
|
768
768
|
if (e.indexOf(t[1]) === -1) return -1;
|
|
769
769
|
let n = 0;
|
|
770
770
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -772,7 +772,7 @@ function Dn(e, t) {
|
|
|
772
772
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
773
773
|
return n > 0 ? -2 : -1;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function kn(e, t = 0) {
|
|
776
776
|
let n = t, r = "";
|
|
777
777
|
for (let t of e) if (t === " ") {
|
|
778
778
|
let e = 4 - n % 4;
|
|
@@ -780,7 +780,7 @@ function On(e, t = 0) {
|
|
|
780
780
|
} else r += t, n++;
|
|
781
781
|
return r;
|
|
782
782
|
}
|
|
783
|
-
function
|
|
783
|
+
function An(e, t, n, r, i) {
|
|
784
784
|
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
|
|
785
785
|
r.state.inLink = !0;
|
|
786
786
|
let c = {
|
|
@@ -793,7 +793,7 @@ function kn(e, t, n, r, i) {
|
|
|
793
793
|
};
|
|
794
794
|
return r.state.inLink = !1, c;
|
|
795
795
|
}
|
|
796
|
-
function
|
|
796
|
+
function jn(e, t, n) {
|
|
797
797
|
let r = e.match(n.other.indentCodeCompensation);
|
|
798
798
|
if (r === null) return t;
|
|
799
799
|
let i = r[1];
|
|
@@ -821,7 +821,7 @@ var K = class {
|
|
|
821
821
|
code(e) {
|
|
822
822
|
let t = this.rules.block.code.exec(e);
|
|
823
823
|
if (t) {
|
|
824
|
-
let e = this.options.pedantic ? t[0] :
|
|
824
|
+
let e = this.options.pedantic ? t[0] : Dn(t[0]);
|
|
825
825
|
return {
|
|
826
826
|
type: "code",
|
|
827
827
|
raw: e,
|
|
@@ -833,7 +833,7 @@ var K = class {
|
|
|
833
833
|
fences(e) {
|
|
834
834
|
let t = this.rules.block.fences.exec(e);
|
|
835
835
|
if (t) {
|
|
836
|
-
let e = t[0], n =
|
|
836
|
+
let e = t[0], n = jn(e, t[3] || "", this.rules);
|
|
837
837
|
return {
|
|
838
838
|
type: "code",
|
|
839
839
|
raw: e,
|
|
@@ -919,7 +919,7 @@ ${c}` : c;
|
|
|
919
919
|
let n = !1, r = "", s = "";
|
|
920
920
|
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
921
921
|
r = t[0], e = e.substring(r.length);
|
|
922
|
-
let c =
|
|
922
|
+
let c = kn(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
|
|
923
923
|
if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
|
|
924
924
|
let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
|
|
925
925
|
for (; e;) {
|
|
@@ -985,7 +985,7 @@ ${c}` : c;
|
|
|
985
985
|
html(e) {
|
|
986
986
|
let t = this.rules.block.html.exec(e);
|
|
987
987
|
if (t) {
|
|
988
|
-
let e =
|
|
988
|
+
let e = Dn(t[0]);
|
|
989
989
|
return {
|
|
990
990
|
type: "html",
|
|
991
991
|
block: !0,
|
|
@@ -1011,7 +1011,7 @@ ${c}` : c;
|
|
|
1011
1011
|
table(e) {
|
|
1012
1012
|
let t = this.rules.block.table.exec(e);
|
|
1013
1013
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
1014
|
-
let n =
|
|
1014
|
+
let n = En(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
|
|
1015
1015
|
type: "table",
|
|
1016
1016
|
raw: G(t[0], "\n"),
|
|
1017
1017
|
header: [],
|
|
@@ -1026,7 +1026,7 @@ ${c}` : c;
|
|
|
1026
1026
|
header: !0,
|
|
1027
1027
|
align: a.align[e]
|
|
1028
1028
|
});
|
|
1029
|
-
for (let e of i) a.rows.push(
|
|
1029
|
+
for (let e of i) a.rows.push(En(e, a.header.length).map((e, t) => ({
|
|
1030
1030
|
text: e,
|
|
1031
1031
|
tokens: this.lexer.inline(e),
|
|
1032
1032
|
header: !1,
|
|
@@ -1097,7 +1097,7 @@ ${c}` : c;
|
|
|
1097
1097
|
let t = G(e.slice(0, -1), "\\");
|
|
1098
1098
|
if ((e.length - t.length) % 2 == 0) return;
|
|
1099
1099
|
} else {
|
|
1100
|
-
let e =
|
|
1100
|
+
let e = On(t[2], "()");
|
|
1101
1101
|
if (e === -2) return;
|
|
1102
1102
|
if (e > -1) {
|
|
1103
1103
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
@@ -1109,7 +1109,7 @@ ${c}` : c;
|
|
|
1109
1109
|
let e = this.rules.other.pedanticHrefTitle.exec(n);
|
|
1110
1110
|
e && (n = e[1], r = e[3]);
|
|
1111
1111
|
} else r = t[3] ? t[3].slice(1, -1) : "";
|
|
1112
|
-
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)),
|
|
1112
|
+
return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), An(t, {
|
|
1113
1113
|
href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
1114
1114
|
title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
|
|
1115
1115
|
}, t[0], this.lexer, this.rules);
|
|
@@ -1127,7 +1127,7 @@ ${c}` : c;
|
|
|
1127
1127
|
text: e
|
|
1128
1128
|
};
|
|
1129
1129
|
}
|
|
1130
|
-
return
|
|
1130
|
+
return An(n, e, n[0], this.lexer, this.rules);
|
|
1131
1131
|
}
|
|
1132
1132
|
}
|
|
1133
1133
|
emStrong(e, t, n = "") {
|
|
@@ -1571,7 +1571,7 @@ ${e}</tr>
|
|
|
1571
1571
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1572
1572
|
}
|
|
1573
1573
|
link({ href: e, title: t, tokens: n }) {
|
|
1574
|
-
let r = this.parser.parseInline(n), i =
|
|
1574
|
+
let r = this.parser.parseInline(n), i = Tn(e);
|
|
1575
1575
|
if (i === null) return r;
|
|
1576
1576
|
e = i;
|
|
1577
1577
|
let a = "<a href=\"" + e + "\"";
|
|
@@ -1579,7 +1579,7 @@ ${e}</tr>
|
|
|
1579
1579
|
}
|
|
1580
1580
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1581
1581
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1582
|
-
let i =
|
|
1582
|
+
let i = Tn(e);
|
|
1583
1583
|
if (i === null) return W(n);
|
|
1584
1584
|
e = i;
|
|
1585
1585
|
let a = `<img src="${e}" alt="${W(n)}"`;
|
|
@@ -1984,54 +1984,45 @@ ${e}</tr>
|
|
|
1984
1984
|
function $(e, t) {
|
|
1985
1985
|
return Q.parse(e, t);
|
|
1986
1986
|
}
|
|
1987
|
-
//#endregion
|
|
1988
|
-
//#region ../../packages/components/src/chat/PkStreamingMarkdown.vue?vue&type=script&setup=true&lang.ts
|
|
1989
1987
|
$.options = $.setOptions = function(e) {
|
|
1990
|
-
return Q.setOptions(e), $.defaults = Q.defaults,
|
|
1988
|
+
return Q.setOptions(e), $.defaults = Q.defaults, xt($.defaults), $;
|
|
1991
1989
|
}, $.getDefaults = A, $.defaults = j, $.use = function(...e) {
|
|
1992
|
-
return Q.use(...e), $.defaults = Q.defaults,
|
|
1990
|
+
return Q.use(...e), $.defaults = Q.defaults, xt($.defaults), $;
|
|
1993
1991
|
}, $.walkTokens = function(e, t) {
|
|
1994
1992
|
return Q.walkTokens(e, t);
|
|
1995
|
-
}, $.parseInline = Q.parseInline, $.Parser = X, $.parser = X.parse, $.Renderer = J, $.TextRenderer = Y, $.Lexer = q, $.lexer = q.lex, $.Tokenizer = K, $.Hooks = Z, $.parse = $, $.options, $.setOptions, $.use, $.walkTokens, $.parseInline, X.parse, q.lex
|
|
1996
|
-
|
|
1993
|
+
}, $.parseInline = Q.parseInline, $.Parser = X, $.parser = X.parse, $.Renderer = J, $.TextRenderer = Y, $.Lexer = q, $.lexer = q.lex, $.Tokenizer = K, $.Hooks = Z, $.parse = $, $.options, $.setOptions, $.use, $.walkTokens, $.parseInline, X.parse, q.lex;
|
|
1994
|
+
//#endregion
|
|
1995
|
+
//#region ../../packages/components/src/chat/PkStreamingMarkdown.vue?vue&type=script&setup=true&lang.ts
|
|
1996
|
+
var Mn = ["innerHTML"], Nn = /* @__PURE__ */ o({
|
|
1997
1997
|
__name: "PkStreamingMarkdown",
|
|
1998
1998
|
props: {
|
|
1999
|
-
markdown: {
|
|
2000
|
-
default: "",
|
|
2001
|
-
type: String
|
|
2002
|
-
},
|
|
1999
|
+
markdown: { default: "" },
|
|
2003
2000
|
loading: {
|
|
2004
2001
|
type: Boolean,
|
|
2005
2002
|
default: !1
|
|
2006
2003
|
},
|
|
2007
|
-
animation: {
|
|
2008
|
-
|
|
2009
|
-
type: [String, null]
|
|
2010
|
-
},
|
|
2011
|
-
animationDuration: {
|
|
2012
|
-
default: "0.3s",
|
|
2013
|
-
type: String
|
|
2014
|
-
},
|
|
2004
|
+
animation: { default: "fadeIn" },
|
|
2005
|
+
animationDuration: { default: "0.3s" },
|
|
2015
2006
|
isDark: {
|
|
2016
2007
|
type: Boolean,
|
|
2017
2008
|
default: !1
|
|
2018
2009
|
}
|
|
2019
2010
|
},
|
|
2020
|
-
setup(
|
|
2021
|
-
let
|
|
2022
|
-
function
|
|
2023
|
-
return
|
|
2011
|
+
setup(o) {
|
|
2012
|
+
let m = o, { t: ee } = p({ useScope: "global" }), h = null;
|
|
2013
|
+
function ne() {
|
|
2014
|
+
return h ||= import("beautiful-mermaid"), h;
|
|
2024
2015
|
}
|
|
2025
|
-
let
|
|
2026
|
-
function
|
|
2027
|
-
return
|
|
2016
|
+
let re = null;
|
|
2017
|
+
function ie() {
|
|
2018
|
+
return re ||= import("katex").then((e) => e.default), re;
|
|
2028
2019
|
}
|
|
2029
|
-
let
|
|
2030
|
-
function
|
|
2020
|
+
let ae = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n$]))\1(?=[\s?!.,:\uFF1F\uFF01\u3002\uFF0C\uFF1A]|$)/, oe = /^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;
|
|
2021
|
+
function se(e) {
|
|
2031
2022
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2032
2023
|
}
|
|
2033
|
-
function
|
|
2034
|
-
return `<span class="katex-pending" data-katex="${
|
|
2024
|
+
function g(e, t) {
|
|
2025
|
+
return `<span class="katex-pending" data-katex="${se(e)}" data-display="${t}"></span>`;
|
|
2035
2026
|
}
|
|
2036
2027
|
$.use({ extensions: [{
|
|
2037
2028
|
name: "inlineKatex",
|
|
@@ -2041,7 +2032,7 @@ var jn = ["innerHTML"], Mn = /*#__PURE__*/ f(/* @__PURE__ */ r({
|
|
|
2041
2032
|
if (t !== -1 && (t === 0 || e.charAt(t - 1) === " ")) return t;
|
|
2042
2033
|
},
|
|
2043
2034
|
tokenizer(e) {
|
|
2044
|
-
let t = e.match(
|
|
2035
|
+
let t = e.match(ae);
|
|
2045
2036
|
if (t) return {
|
|
2046
2037
|
type: "inlineKatex",
|
|
2047
2038
|
raw: t[0],
|
|
@@ -2050,13 +2041,13 @@ var jn = ["innerHTML"], Mn = /*#__PURE__*/ f(/* @__PURE__ */ r({
|
|
|
2050
2041
|
};
|
|
2051
2042
|
},
|
|
2052
2043
|
renderer(e) {
|
|
2053
|
-
return
|
|
2044
|
+
return g(e.text, e.displayMode);
|
|
2054
2045
|
}
|
|
2055
2046
|
}, {
|
|
2056
2047
|
name: "blockKatex",
|
|
2057
2048
|
level: "block",
|
|
2058
2049
|
tokenizer(e) {
|
|
2059
|
-
let t = e.match(
|
|
2050
|
+
let t = e.match(oe);
|
|
2060
2051
|
if (t) return {
|
|
2061
2052
|
type: "blockKatex",
|
|
2062
2053
|
raw: t[0],
|
|
@@ -2065,7 +2056,7 @@ var jn = ["innerHTML"], Mn = /*#__PURE__*/ f(/* @__PURE__ */ r({
|
|
|
2065
2056
|
};
|
|
2066
2057
|
},
|
|
2067
2058
|
renderer(e) {
|
|
2068
|
-
return
|
|
2059
|
+
return g(e.text, e.displayMode) + "\n";
|
|
2069
2060
|
}
|
|
2070
2061
|
}] }), $.use({ extensions: [{
|
|
2071
2062
|
name: "thinking",
|
|
@@ -2086,19 +2077,19 @@ var jn = ["innerHTML"], Mn = /*#__PURE__*/ f(/* @__PURE__ */ r({
|
|
|
2086
2077
|
return `<div class="thinking-block">${this.parser.parse(e.tokens ?? [])}</div>`;
|
|
2087
2078
|
}
|
|
2088
2079
|
}] });
|
|
2089
|
-
let
|
|
2090
|
-
|
|
2091
|
-
let
|
|
2092
|
-
return `<a href="${e}"${t ? ` title="${t}"` : ""}${
|
|
2093
|
-
},
|
|
2080
|
+
let _ = new $.Renderer();
|
|
2081
|
+
_.link = function({ href: e, title: t, tokens: r }) {
|
|
2082
|
+
let i = this.parser.parseInline(r);
|
|
2083
|
+
return `<a href="${e}"${t ? ` title="${t}"` : ""}${n(e ?? "") ? "" : " target=\"_blank\" rel=\"noopener noreferrer\""}>${i}</a>`;
|
|
2084
|
+
}, _.table = function(e) {
|
|
2094
2085
|
return `<div class="table-wrapper">${$.Renderer.prototype.table.call(this, e)}</div>`;
|
|
2095
2086
|
};
|
|
2096
|
-
let
|
|
2097
|
-
|
|
2098
|
-
function
|
|
2087
|
+
let ce = /^(sequenceDiagram|graph|classDiagram|stateDiagram|erDiagram|flowchart|xychart-beta)/;
|
|
2088
|
+
_.code = ({ text: e }) => ce.test(e) ? `<pre class="mermaid">${e}</pre>` : `<pre><code>${e}</code></pre>`;
|
|
2089
|
+
function v(e) {
|
|
2099
2090
|
return e.replace(/\\\[([\s\S]*?)\\\]/g, (e, t) => `$$${t}$$`).replace(/\\\(([\s\S]*?)\\\)/g, (e, t) => `$${t}$`).replace(/^(\d+)\.(?!\s)/gm, "$1\\.");
|
|
2100
2091
|
}
|
|
2101
|
-
function
|
|
2092
|
+
function le(e) {
|
|
2102
2093
|
let t = /* @__PURE__ */ new Set(), n = /^(`{3,})[^\n]*\n([\s\S]*?)\n\1/gm, r;
|
|
2103
2094
|
for (; (r = n.exec(e)) !== null;) for (let e = r.index; e < r.index + r[0].length; e++) t.add(e);
|
|
2104
2095
|
return e.replace(/[{[]([\s\S]*?)[}\]]/g, (e, n, r) => {
|
|
@@ -2110,129 +2101,140 @@ var jn = ["innerHTML"], Mn = /*#__PURE__*/ f(/* @__PURE__ */ r({
|
|
|
2110
2101
|
}
|
|
2111
2102
|
}).replace(/\n{3,}/g, "\n\n");
|
|
2112
2103
|
}
|
|
2113
|
-
let
|
|
2104
|
+
let ue = [
|
|
2114
2105
|
te,
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
],
|
|
2119
|
-
let e =
|
|
2106
|
+
le,
|
|
2107
|
+
bt,
|
|
2108
|
+
v
|
|
2109
|
+
], y = d("container"), { resolveText: de } = r(), fe = de(() => m.markdown), b = i(() => {
|
|
2110
|
+
let e = ue.reduce((e, t) => t(e), fe.value);
|
|
2120
2111
|
return $.parse(e, {
|
|
2121
2112
|
async: !1,
|
|
2122
2113
|
breaks: !0,
|
|
2123
|
-
renderer:
|
|
2114
|
+
renderer: _
|
|
2124
2115
|
});
|
|
2125
2116
|
});
|
|
2126
|
-
async function
|
|
2127
|
-
if (
|
|
2128
|
-
await
|
|
2129
|
-
let e =
|
|
2117
|
+
async function pe() {
|
|
2118
|
+
if (m.loading) return;
|
|
2119
|
+
await s();
|
|
2120
|
+
let e = y.value?.querySelectorAll("pre.mermaid:not([data-rendered])");
|
|
2130
2121
|
if (!e?.length) return;
|
|
2131
|
-
let { renderMermaidSVG:
|
|
2132
|
-
for (let
|
|
2133
|
-
if (!
|
|
2134
|
-
let e =
|
|
2122
|
+
let { renderMermaidSVG: t, THEMES: n } = await ne(), r = m.isDark ? n["github-dark"] : n["github-light"];
|
|
2123
|
+
for (let n of Array.from(e)) {
|
|
2124
|
+
if (!n.isConnected) continue;
|
|
2125
|
+
let e = n.textContent?.trim();
|
|
2135
2126
|
if (e) try {
|
|
2136
|
-
let
|
|
2137
|
-
|
|
2127
|
+
let i = t(e, r);
|
|
2128
|
+
n.isConnected && (n.dataset.code = e, n.innerHTML = i, n.setAttribute("data-rendered", "true"));
|
|
2138
2129
|
} catch {}
|
|
2139
2130
|
}
|
|
2140
2131
|
}
|
|
2141
|
-
async function
|
|
2142
|
-
await
|
|
2143
|
-
let e =
|
|
2132
|
+
async function me() {
|
|
2133
|
+
await s();
|
|
2134
|
+
let e = y.value?.querySelectorAll("pre:not(.mermaid) > code:not([data-highlighted])");
|
|
2144
2135
|
if (!e?.length) return;
|
|
2145
|
-
let
|
|
2146
|
-
for (let
|
|
2147
|
-
}
|
|
2148
|
-
async function
|
|
2149
|
-
await
|
|
2150
|
-
let
|
|
2151
|
-
if (!
|
|
2152
|
-
let
|
|
2153
|
-
|
|
2154
|
-
for (let
|
|
2155
|
-
if (!
|
|
2156
|
-
let
|
|
2157
|
-
if (!
|
|
2158
|
-
let
|
|
2136
|
+
let t = (await import("highlight.js/lib/common")).default;
|
|
2137
|
+
for (let n of e) t.highlightElement(n), n.setAttribute("data-highlighted", "true");
|
|
2138
|
+
}
|
|
2139
|
+
async function he() {
|
|
2140
|
+
await s();
|
|
2141
|
+
let n = y.value?.querySelectorAll(".katex-pending");
|
|
2142
|
+
if (!n?.length) return;
|
|
2143
|
+
let r = await ie();
|
|
2144
|
+
e("https://cdn.jsdelivr.net/npm/katex@0.16/dist/katex.min.css", t(y.value));
|
|
2145
|
+
for (let e of Array.from(n)) {
|
|
2146
|
+
if (!e.isConnected) continue;
|
|
2147
|
+
let t = e.dataset.katex;
|
|
2148
|
+
if (!t) continue;
|
|
2149
|
+
let n = e.dataset.display === "true";
|
|
2159
2150
|
try {
|
|
2160
|
-
|
|
2151
|
+
e.innerHTML = r.renderToString(t, {
|
|
2161
2152
|
throwOnError: !1,
|
|
2162
|
-
displayMode:
|
|
2163
|
-
}),
|
|
2153
|
+
displayMode: n
|
|
2154
|
+
}), e.classList.remove("katex-pending");
|
|
2164
2155
|
} catch {}
|
|
2165
2156
|
}
|
|
2166
2157
|
}
|
|
2167
|
-
async function
|
|
2168
|
-
await
|
|
2169
|
-
let e =
|
|
2158
|
+
async function ge() {
|
|
2159
|
+
await s();
|
|
2160
|
+
let e = y.value?.querySelectorAll("pre.mermaid[data-rendered]");
|
|
2170
2161
|
if (!e?.length) return;
|
|
2171
|
-
let { renderMermaidSVG:
|
|
2172
|
-
for (let
|
|
2173
|
-
if (!
|
|
2174
|
-
let e =
|
|
2162
|
+
let { renderMermaidSVG: t, THEMES: n } = await ne(), r = m.isDark ? n["github-dark"] : n["github-light"];
|
|
2163
|
+
for (let n of Array.from(e)) {
|
|
2164
|
+
if (!n.isConnected) continue;
|
|
2165
|
+
let e = n.dataset.code;
|
|
2175
2166
|
if (e) try {
|
|
2176
|
-
|
|
2167
|
+
n.innerHTML = t(e, r);
|
|
2177
2168
|
} catch {}
|
|
2178
2169
|
}
|
|
2179
2170
|
}
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2171
|
+
function _e(e) {
|
|
2172
|
+
let t = e.target;
|
|
2173
|
+
if (!(t instanceof HTMLImageElement) || t.dataset.broken) return;
|
|
2174
|
+
t.dataset.broken = "true";
|
|
2175
|
+
let n = document.createElement("span");
|
|
2176
|
+
n.className = "markdown-broken-image", n.textContent = t.alt || ee("label.imageLoadError"), n.title = t.src, t.replaceWith(n);
|
|
2177
|
+
}
|
|
2178
|
+
l(() => {
|
|
2179
|
+
y.value?.addEventListener("error", _e, !0);
|
|
2180
|
+
}), c(() => {
|
|
2181
|
+
y.value?.removeEventListener("error", _e, !0);
|
|
2182
|
+
}), f([b, () => m.loading], pe, { immediate: !0 }), f(() => m.isDark, ge), f(b, me, { immediate: !0 }), f(b, he, { immediate: !0 });
|
|
2183
|
+
let x = 0;
|
|
2184
|
+
function S(e, t) {
|
|
2183
2185
|
let n = document.createElement("span");
|
|
2184
|
-
return n.style.cssText = `animation:ft-${
|
|
2186
|
+
return n.style.cssText = `animation:ft-${m.animation} ${m.animationDuration} ease-out ${t}ms both;display:inline-block`, n.textContent = e, n.addEventListener("animationend", () => {
|
|
2185
2187
|
let t = n.parentNode;
|
|
2186
2188
|
t && (t.replaceChild(document.createTextNode(e), n), t.normalize());
|
|
2187
2189
|
}, { once: !0 }), n;
|
|
2188
2190
|
}
|
|
2189
|
-
function
|
|
2191
|
+
function C(e, t, n, r) {
|
|
2190
2192
|
let i = r, a = e.split(/(\s+)/);
|
|
2191
2193
|
for (let e of a) if (e) {
|
|
2192
2194
|
if (/^\s+$/.test(e)) {
|
|
2193
2195
|
t.insertBefore(document.createTextNode(e), n);
|
|
2194
2196
|
continue;
|
|
2195
2197
|
}
|
|
2196
|
-
t.insertBefore(
|
|
2198
|
+
t.insertBefore(S(e, i * 30), n), i++;
|
|
2197
2199
|
}
|
|
2198
2200
|
return i;
|
|
2199
2201
|
}
|
|
2200
|
-
function
|
|
2202
|
+
function ve(e) {
|
|
2201
2203
|
let t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode(e) {
|
|
2202
|
-
return e.parentElement?.closest("pre, code, .katex-pending") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
2204
|
+
return e.parentElement?.closest("pre, code, .katex-pending, .markdown-broken-image") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
2203
2205
|
} }), n = [];
|
|
2204
2206
|
for (; t.nextNode();) n.push(t.currentNode);
|
|
2205
2207
|
return n;
|
|
2206
2208
|
}
|
|
2207
|
-
function
|
|
2208
|
-
if (!
|
|
2209
|
-
let e =
|
|
2209
|
+
function ye() {
|
|
2210
|
+
if (!y.value || !m.loading || !m.animation) return;
|
|
2211
|
+
let e = ve(y.value), t = 0, n = 0;
|
|
2210
2212
|
for (let r of e) {
|
|
2211
2213
|
let e = r.textContent || "", i = t, a = t + e.length;
|
|
2212
|
-
if (t = a, a <=
|
|
2214
|
+
if (t = a, a <= x) continue;
|
|
2213
2215
|
let o = r.parentNode;
|
|
2214
2216
|
if (!o) continue;
|
|
2215
|
-
if (i >=
|
|
2217
|
+
if (i >= x) {
|
|
2216
2218
|
let t = r.nextSibling;
|
|
2217
|
-
o.removeChild(r), n =
|
|
2219
|
+
o.removeChild(r), n = C(e, o, t, n);
|
|
2218
2220
|
continue;
|
|
2219
2221
|
}
|
|
2220
|
-
let s =
|
|
2221
|
-
o.removeChild(c), n =
|
|
2222
|
+
let s = x - i, c = r.splitText(s), l = c.textContent || "", u = c.nextSibling;
|
|
2223
|
+
o.removeChild(c), n = C(l, o, u, n);
|
|
2222
2224
|
}
|
|
2223
|
-
|
|
2225
|
+
x = t;
|
|
2224
2226
|
}
|
|
2225
|
-
return
|
|
2226
|
-
await
|
|
2227
|
-
}, { immediate: !0 }),
|
|
2228
|
-
(!e || t && e.length < t.length) && (
|
|
2229
|
-
}), (e, t) => (
|
|
2227
|
+
return f(b, async () => {
|
|
2228
|
+
await s(), ye();
|
|
2229
|
+
}, { immediate: !0 }), f(() => m.markdown, (e, t) => {
|
|
2230
|
+
(!e || t && e.length < t.length) && (x = 0);
|
|
2231
|
+
}), (e, t) => (u(), a("div", {
|
|
2230
2232
|
ref: "container",
|
|
2231
|
-
innerHTML:
|
|
2232
|
-
}, null, 8,
|
|
2233
|
+
innerHTML: b.value
|
|
2234
|
+
}, null, 8, Mn));
|
|
2233
2235
|
}
|
|
2234
|
-
})
|
|
2236
|
+
});
|
|
2235
2237
|
//#endregion
|
|
2236
|
-
export {
|
|
2238
|
+
export { Nn as t };
|
|
2237
2239
|
|
|
2238
|
-
//# sourceMappingURL=PkStreamingMarkdown-
|
|
2240
|
+
//# sourceMappingURL=PkStreamingMarkdown-B3OallmC.js.map
|