@8wave/ai-elements 0.111.0-beta.7 → 0.111.0-beta.8
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-ClL4nr95.js → PkLazyImg-Dbj2dDXA.js} +2 -2
- package/dist/_chunks/{PkLazyImg-ClL4nr95.js.map → PkLazyImg-Dbj2dDXA.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-DgBS4Ebc.js → PkStreamingMarkdown-CNI8aV8t.js} +617 -418
- package/dist/_chunks/PkStreamingMarkdown-CNI8aV8t.js.map +1 -0
- package/dist/_chunks/{PkToolRequestGeolocation-pVys3x9M.js → PkToolRequestGeolocation-Bzy4IYSp.js} +2 -2
- package/dist/_chunks/{PkToolRequestGeolocation-pVys3x9M.js.map → PkToolRequestGeolocation-Bzy4IYSp.js.map} +1 -1
- package/dist/_chunks/{PkToolRequestOAuthConnection-BGChb_eC.js → PkToolRequestOAuthConnection-CWEKoD71.js} +2 -2
- package/dist/_chunks/{PkToolRequestOAuthConnection-BGChb_eC.js.map → PkToolRequestOAuthConnection-CWEKoD71.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-CkTBIdQd.js → PkToolShowArtifact-CGbHDEie.js} +4 -4
- package/dist/_chunks/{PkToolShowArtifact-CkTBIdQd.js.map → PkToolShowArtifact-CGbHDEie.js.map} +1 -1
- package/dist/_chunks/{PkToolShowCalendarEvent-C41JgOUA.js → PkToolShowCalendarEvent-DIFX_rUz.js} +3 -3
- package/dist/_chunks/{PkToolShowCalendarEvent-C41JgOUA.js.map → PkToolShowCalendarEvent-DIFX_rUz.js.map} +1 -1
- package/dist/_chunks/{PkToolShowComparison-DbbUD9pg.js → PkToolShowComparison-B38hHWq2.js} +3 -3
- package/dist/_chunks/{PkToolShowComparison-DbbUD9pg.js.map → PkToolShowComparison-B38hHWq2.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-Du7jX7K5.js → PkToolShowContactForm-DUw_bZiJ.js} +4 -4
- package/dist/_chunks/{PkToolShowContactForm-Du7jX7K5.js.map → PkToolShowContactForm-DUw_bZiJ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-BdmG9gm8.js → PkToolShowDiagram-Dx1Ba0PG.js} +3 -3
- package/dist/_chunks/{PkToolShowDiagram-BdmG9gm8.js.map → PkToolShowDiagram-Dx1Ba0PG.js.map} +1 -1
- package/dist/_chunks/{PkToolShowEmail-Dn3JHYIR.js → PkToolShowEmail-DnFFgzom.js} +3 -3
- package/dist/_chunks/{PkToolShowEmail-Dn3JHYIR.js.map → PkToolShowEmail-DnFFgzom.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-Du2nk7pq.js → PkToolShowForm-CKQQltJ6.js} +5 -6
- package/dist/_chunks/{PkToolShowForm-Du2nk7pq.js.map → PkToolShowForm-CKQQltJ6.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-C1lzlO0y.js → PkToolShowImageGallery-D99N_Plf.js} +2 -2
- package/dist/_chunks/{PkToolShowImageGallery-C1lzlO0y.js.map → PkToolShowImageGallery-D99N_Plf.js.map} +1 -1
- package/dist/_chunks/{PkToolShowLocation-CKhPxKFA.js → PkToolShowLocation-AfnrtFVJ.js} +3 -3
- package/dist/_chunks/{PkToolShowLocation-CKhPxKFA.js.map → PkToolShowLocation-AfnrtFVJ.js.map} +1 -1
- package/dist/_chunks/{PkToolShowMessage-U9CCU7eG.js → PkToolShowMessage-DUo2c-im.js} +3 -3
- package/dist/_chunks/{PkToolShowMessage-U9CCU7eG.js.map → PkToolShowMessage-DUo2c-im.js.map} +1 -1
- package/dist/_chunks/{PkToolShowProductList-UeiRMLHu.js → PkToolShowProductList-BN6Qk1_y.js} +3 -3
- package/dist/_chunks/{PkToolShowProductList-UeiRMLHu.js.map → PkToolShowProductList-BN6Qk1_y.js.map} +1 -1
- package/dist/_chunks/{PkToolShowQrCode-CypLrfh5.js → PkToolShowQrCode-BLqeBecX.js} +3 -3
- package/dist/_chunks/{PkToolShowQrCode-CypLrfh5.js.map → PkToolShowQrCode-BLqeBecX.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-CsHLUF4L.js → PkToolShowSources-DpZb5FUP.js} +3 -3
- package/dist/_chunks/{PkToolShowSources-CsHLUF4L.js.map → PkToolShowSources-DpZb5FUP.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSuggestedReply-D7g_qymH.js → PkToolShowSuggestedReply-C10nNgBs.js} +2 -2
- package/dist/_chunks/{PkToolShowSuggestedReply-D7g_qymH.js.map → PkToolShowSuggestedReply-C10nNgBs.js.map} +1 -1
- package/dist/_chunks/{PkToolShowVideo-BgKxdBcC.js → PkToolShowVideo-S9b4QHUj.js} +2 -2
- package/dist/_chunks/{PkToolShowVideo-BgKxdBcC.js.map → PkToolShowVideo-S9b4QHUj.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWeather-LPd3tC77.js → PkToolShowWeather-CqhG430w.js} +2 -2
- package/dist/_chunks/{PkToolShowWeather-LPd3tC77.js.map → PkToolShowWeather-CqhG430w.js.map} +1 -1
- package/dist/_chunks/{PkToolShowWebPages-ep_erFF0.js → PkToolShowWebPages-txAZi_iG.js} +3 -3
- package/dist/_chunks/{PkToolShowWebPages-ep_erFF0.js.map → PkToolShowWebPages-txAZi_iG.js.map} +1 -1
- package/dist/_chunks/{VvCheckboxGroup.es-Bdu2gFLN.js → VvCheckboxGroup.es-CTrF3pue.js} +2 -2
- package/dist/_chunks/{VvCheckboxGroup.es-Bdu2gFLN.js.map → VvCheckboxGroup.es-CTrF3pue.js.map} +1 -1
- package/dist/_chunks/{VvCombobox.es-C0wpJIr_.js → VvCombobox.es-BWiXmQ_S.js} +10 -10
- package/dist/_chunks/{VvCombobox.es-C0wpJIr_.js.map → VvCombobox.es-BWiXmQ_S.js.map} +1 -1
- package/dist/_chunks/{VvInputText.es-Zgtw2YNw.js → VvInputText.es-Bo9I6g8H.js} +6 -6
- package/dist/_chunks/{VvInputText.es-Zgtw2YNw.js.map → VvInputText.es-Bo9I6g8H.js.map} +1 -1
- package/dist/_chunks/{VvRadioGroup.es-DZLL19SC.js → VvRadioGroup.es-9ooHCuik.js} +2 -2
- package/dist/_chunks/{VvRadioGroup.es-DZLL19SC.js.map → VvRadioGroup.es-9ooHCuik.js.map} +1 -1
- package/dist/_chunks/{VvSelect.es-ovnZRHG5.js → VvSelect.es-DG0VuWtP.js} +2 -2
- package/dist/_chunks/{VvSelect.es-ovnZRHG5.js.map → VvSelect.es-DG0VuWtP.js.map} +1 -1
- package/dist/_chunks/{VvTextarea.es-DbP5Lt2T.js → VvTextarea.es-Dg3pxdZy.js} +6 -6
- package/dist/_chunks/{VvTextarea.es-DbP5Lt2T.js.map → VvTextarea.es-Dg3pxdZy.js.map} +1 -1
- package/dist/_chunks/{dist-n5iFNYf-.js → dist-QdjZA6MJ.js} +143 -133
- package/dist/_chunks/{dist-n5iFNYf-.js.map → dist-QdjZA6MJ.js.map} +1 -1
- package/dist/_chunks/{index.es-dtdl3VFG.js → index.es-0YpCa4c5.js} +6 -6
- package/dist/_chunks/{index.es-dtdl3VFG.js.map → index.es-0YpCa4c5.js.map} +1 -1
- package/dist/_chunks/{index.es-BJnUA_36.js → index.es-CHkJ2TMJ.js} +10 -10
- package/dist/_chunks/{index.es-BJnUA_36.js.map → index.es-CHkJ2TMJ.js.map} +1 -1
- package/dist/ai-elements.es.js +1956 -1944
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.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/PkChatbotStepPayload.js +1 -1
- package/dist-vue/PkChatbotStepToolDetail.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-Di7R2CWN.js → PkChatbot-DE1bKmDi.js} +57 -57
- package/dist-vue/_chunks/{PkChatbot-Di7R2CWN.js.map → PkChatbot-DE1bKmDi.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-C_ITdvH7.js → PkChatbotEmptyState-BtzBYOHJ.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-C_ITdvH7.js.map → PkChatbotEmptyState-BtzBYOHJ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-pEl3D2O-.js → PkChatbotInput-MSpF6SB6.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-pEl3D2O-.js.map → PkChatbotInput-MSpF6SB6.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotMessages-B6ONEJnZ.js +776 -0
- package/dist-vue/_chunks/PkChatbotMessages-B6ONEJnZ.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotStepPayload-BH6piqOi.js → PkChatbotStepPayload-XW4gT9AZ.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-BH6piqOi.js.map → PkChatbotStepPayload-XW4gT9AZ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJ7xUvgi.js → PkChatbotStepToolDetail-C4-K6Glw.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJ7xUvgi.js.map → PkChatbotStepToolDetail-C4-K6Glw.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotSteps-CrqjWpv0.js +190 -0
- package/dist-vue/_chunks/PkChatbotSteps-CrqjWpv0.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotViewChat-DT-rAU_r.js → PkChatbotViewChat-BMQtx1Gi.js} +9 -9
- package/dist-vue/_chunks/{PkChatbotViewChat-DT-rAU_r.js.map → PkChatbotViewChat-BMQtx1Gi.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-DIaZEedG.js → PkStreamingMarkdown-D0IOaETI.js} +362 -359
- package/dist-vue/_chunks/PkStreamingMarkdown-D0IOaETI.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowArtifact-BCCUucVQ.js → PkToolShowArtifact-DHdJuzDi.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-BCCUucVQ.js.map → PkToolShowArtifact-DHdJuzDi.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-BXGxWSc2.js → PkToolShowContactForm-BB2X4UdQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-BXGxWSc2.js.map → PkToolShowContactForm-BB2X4UdQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-CZgrWvBr.js → PkToolShowDiagram-BH6ihikd.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-CZgrWvBr.js.map → PkToolShowDiagram-BH6ihikd.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowEmail-DpC517Vn.js → PkToolShowEmail-DF__nKpR.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowEmail-DpC517Vn.js.map → PkToolShowEmail-DF__nKpR.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-CIZpfAGK.js → PkToolShowForm-DUKIyj9V.js} +5 -5
- package/dist-vue/_chunks/{PkToolShowForm-CIZpfAGK.js.map → PkToolShowForm-DUKIyj9V.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowMessage-B7flxVCU.js → PkToolShowMessage-Ck6VP-gw.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowMessage-B7flxVCU.js.map → PkToolShowMessage-Ck6VP-gw.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-B6fRtIpx.js → PkToolShowProductList-zfM8cx-l.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-B6fRtIpx.js.map → PkToolShowProductList-zfM8cx-l.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-DDZokZow.js → PkToolShowSources-Dlaz2Y77.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowSources-DDZokZow.js.map → PkToolShowSources-Dlaz2Y77.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-DY48ee6V.js → PkToolShowWebPages-CosBYLrE.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-DY48ee6V.js.map → PkToolShowWebPages-CosBYLrE.js.map} +1 -1
- package/dist-vue/_chunks/{PkUrl-DSGxrEM7.js → PkUrl-B5CNTQj9.js} +2 -2
- package/dist-vue/_chunks/{PkUrl-DSGxrEM7.js.map → PkUrl-B5CNTQj9.js.map} +1 -1
- package/dist-vue/_chunks/{utils-Coqik0XI.js → utils-C1666_6C.js} +58 -43
- package/dist-vue/_chunks/utils-C1666_6C.js.map +1 -0
- package/dist-vue/composables.js +1 -1
- package/dist-vue/index.js +38 -38
- package/dist-vue/packages/components/src/chat/PkStreamingMarkdown.d.ts +6 -0
- package/dist-vue/packages/components/src/chat/PkStreamingMarkdownAutoscroll.d.ts +1 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +16 -0
- package/package.json +1 -1
- package/dist/_chunks/PkStreamingMarkdown-DgBS4Ebc.js.map +0 -1
- package/dist/_chunks/utils-YJ0ZOLDG.js +0 -185
- package/dist/_chunks/utils-YJ0ZOLDG.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-CGALOKwe.js +0 -771
- package/dist-vue/_chunks/PkChatbotMessages-CGALOKwe.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotSteps-BhFupvbz.js +0 -180
- package/dist-vue/_chunks/PkChatbotSteps-BhFupvbz.js.map +0 -1
- package/dist-vue/_chunks/PkStreamingMarkdown-DIaZEedG.js.map +0 -1
- package/dist-vue/_chunks/utils-Coqik0XI.js.map +0 -1
package/dist-vue/_chunks/{PkStreamingMarkdown-DIaZEedG.js → PkStreamingMarkdown-D0IOaETI.js}
RENAMED
|
@@ -1,37 +1,39 @@
|
|
|
1
1
|
import { n as e, t } from "./cdn-css-JUUNhyQ6.js";
|
|
2
2
|
import "./src-DT8FLE4_.js";
|
|
3
3
|
import { n } from "./url-validation-uLMZ5-AU.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { c as r } from "./utils-C1666_6C.js";
|
|
5
|
+
import { computed as i, createElementBlock as a, defineComponent as o, inject as s, nextTick as c, onBeforeUnmount as l, onMounted as u, openBlock as d, provide as f, reactive as p, toRef as m, toValue as h, useTemplateRef as ee, watch as g } from "vue";
|
|
6
|
+
import { useI18n as te } from "vue-i18n";
|
|
7
|
+
import { refThrottled as ne } from "@vueuse/core";
|
|
6
8
|
//#region ../../packages/utils/src/citations.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
return e && e.replace(
|
|
9
|
+
var re = /[ \t]*\uE200[^\uE201]*\uE201/g, ie = /[ \t]*(?:cite|filecite|videocite|audiocite|imagecite|screenshot)(?:turn\d+[a-z]+\d+)+/gi, ae = /[\uE200-\uE20F]/g;
|
|
10
|
+
function oe(e) {
|
|
11
|
+
return e && e.replace(re, "").replace(ie, "").replace(ae, "");
|
|
10
12
|
}
|
|
11
13
|
//#endregion
|
|
12
14
|
//#region ../../packages/composable/src/chatbot/useShortUrlResolver.ts
|
|
13
|
-
var
|
|
14
|
-
function oe(e) {
|
|
15
|
-
return ie.exec(e)?.[1];
|
|
16
|
-
}
|
|
15
|
+
var se = /\/api\/r\/([A-Za-z0-9_-]{1,20})(?:[?#]|$)/, ce = /https?:\/\/[^\s)"'<>]*\/api\/r\/([A-Za-z0-9_-]{1,20})/g;
|
|
17
16
|
function _(e) {
|
|
18
|
-
|
|
17
|
+
return se.exec(e)?.[1];
|
|
18
|
+
}
|
|
19
|
+
function v(e) {
|
|
20
|
+
let t = p(/* @__PURE__ */ new Map()), n = p(/* @__PURE__ */ new Set()), r = /* @__PURE__ */ new Set(), a = !1;
|
|
19
21
|
async function o() {
|
|
20
22
|
a = !1;
|
|
21
|
-
let
|
|
22
|
-
if (
|
|
23
|
-
let n = await e(
|
|
23
|
+
let i = [...r];
|
|
24
|
+
if (r.clear(), i.length !== 0) try {
|
|
25
|
+
let n = await e(i);
|
|
24
26
|
for (let [e, r] of Object.entries(n)) t.set(e, r);
|
|
25
27
|
} catch {} finally {
|
|
26
|
-
for (let e of
|
|
28
|
+
for (let e of i) n.add(e);
|
|
27
29
|
}
|
|
28
30
|
}
|
|
29
31
|
function s(e) {
|
|
30
|
-
t.has(e) ||
|
|
32
|
+
t.has(e) || r.has(e) || (r.add(e), a || (a = !0, queueMicrotask(o)));
|
|
31
33
|
}
|
|
32
34
|
function c(e) {
|
|
33
|
-
return
|
|
34
|
-
let r =
|
|
35
|
+
return i(() => {
|
|
36
|
+
let r = h(e), i = r ? _(r) : void 0;
|
|
35
37
|
if (!i) return {
|
|
36
38
|
url: r,
|
|
37
39
|
loading: !1
|
|
@@ -47,9 +49,9 @@ function _(e) {
|
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
function l(e) {
|
|
50
|
-
return
|
|
51
|
-
let n =
|
|
52
|
-
return n && n.replace(
|
|
52
|
+
return i(() => {
|
|
53
|
+
let n = h(e) ?? "";
|
|
54
|
+
return n && n.replace(ce, (e, n) => {
|
|
53
55
|
let r = t.get(n);
|
|
54
56
|
return r === void 0 ? (s(n), e) : r;
|
|
55
57
|
});
|
|
@@ -60,33 +62,33 @@ function _(e) {
|
|
|
60
62
|
resolveText: l
|
|
61
63
|
};
|
|
62
64
|
}
|
|
63
|
-
var
|
|
64
|
-
function
|
|
65
|
-
let t =
|
|
66
|
-
return
|
|
65
|
+
var y = Symbol("shortUrlResolver");
|
|
66
|
+
function le(e) {
|
|
67
|
+
let t = v(e);
|
|
68
|
+
return f(y, t), t;
|
|
67
69
|
}
|
|
68
|
-
var
|
|
69
|
-
resolve: (e) =>
|
|
70
|
-
url:
|
|
70
|
+
var ue = {
|
|
71
|
+
resolve: (e) => i(() => ({
|
|
72
|
+
url: h(e),
|
|
71
73
|
loading: !1
|
|
72
74
|
})),
|
|
73
|
-
resolveText: (e) =>
|
|
75
|
+
resolveText: (e) => i(() => h(e) ?? "")
|
|
74
76
|
};
|
|
75
|
-
function
|
|
76
|
-
return
|
|
77
|
+
function de() {
|
|
78
|
+
return s(y, ue);
|
|
77
79
|
}
|
|
78
80
|
//#endregion
|
|
79
81
|
//#region ../../node_modules/.pnpm/remend@1.3.1/node_modules/remend/dist/index.js
|
|
80
|
-
var
|
|
82
|
+
var fe = Object.defineProperty, pe = Object.defineProperties, me = Object.getOwnPropertyDescriptors, b = Object.getOwnPropertySymbols, he = Object.prototype.hasOwnProperty, ge = Object.prototype.propertyIsEnumerable, _e = (e, t, n) => t in e ? fe(e, t, {
|
|
81
83
|
enumerable: !0,
|
|
82
84
|
configurable: !0,
|
|
83
85
|
writable: !0,
|
|
84
86
|
value: n
|
|
85
|
-
}) : e[t] = n,
|
|
86
|
-
for (var n in t ||= {})
|
|
87
|
-
if (
|
|
87
|
+
}) : e[t] = n, ve = (e, t) => {
|
|
88
|
+
for (var n in t ||= {}) he.call(t, n) && _e(e, n, t[n]);
|
|
89
|
+
if (b) for (var n of b(t)) ge.call(t, n) && _e(e, n, t[n]);
|
|
88
90
|
return e;
|
|
89
|
-
}, x = (e, t) =>
|
|
91
|
+
}, x = (e, t) => pe(e, me(t)), ye = (e) => {
|
|
90
92
|
let t = new Uint8Array(e.length + 1), n = !1, r = !1, i = 0;
|
|
91
93
|
for (; i < e.length;) {
|
|
92
94
|
if (e[i] === "\\" && i + 1 < e.length && e[i + 1] === "`") {
|
|
@@ -104,26 +106,26 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
104
106
|
!r && e[i] === "`" && (n = !n), t[i + 1] = n || r ? 1 : 0, i += 1;
|
|
105
107
|
}
|
|
106
108
|
return t;
|
|
107
|
-
},
|
|
108
|
-
let n =
|
|
109
|
+
}, be = null, S = (e, t) => {
|
|
110
|
+
let n = be;
|
|
109
111
|
return (n === null || n.text !== e) && (n = {
|
|
110
112
|
text: e,
|
|
111
|
-
lookup:
|
|
112
|
-
},
|
|
113
|
-
},
|
|
113
|
+
lookup: ye(e)
|
|
114
|
+
}, be = n), n.lookup[Math.min(t, e.length)] === 1;
|
|
115
|
+
}, xe = (e, t) => {
|
|
114
116
|
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) === "```";
|
|
115
117
|
return n || r || i;
|
|
116
|
-
},
|
|
118
|
+
}, Se = (e) => {
|
|
117
119
|
let t = 0;
|
|
118
120
|
for (let n = 0; n < e.length; n += 1) {
|
|
119
121
|
if (e[n] === "\\" && n + 1 < e.length && e[n + 1] === "`") {
|
|
120
122
|
n += 1;
|
|
121
123
|
continue;
|
|
122
124
|
}
|
|
123
|
-
e[n] === "`" && !
|
|
125
|
+
e[n] === "`" && !xe(e, n) && (t += 1);
|
|
124
126
|
}
|
|
125
127
|
return t;
|
|
126
|
-
},
|
|
128
|
+
}, C = (e, t) => {
|
|
127
129
|
let n = !1, r = !1, i = -1;
|
|
128
130
|
for (let a = 0; a < e.length; a += 1) {
|
|
129
131
|
if (e[a] === "\\" && a + 1 < e.length && e[a + 1] === "`") {
|
|
@@ -142,21 +144,21 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
return !1;
|
|
145
|
-
},
|
|
147
|
+
}, Ce = /^(\s*(?:[-*+]|\d+[.)]) +)>(=?\s*[$]?\d)/gm, w = (e) => !e || typeof e != "string" || !e.includes(">") ? e : e.replace(Ce, (t, n, r, i) => S(e, i) ? t : `${n}\\>${r}`), we = /(\*\*)([^*]*\*?)$/, Te = /(__)([^_]*?)$/, Ee = /(\*\*\*)([^*]*?)$/, De = /(\*)([^*]*?)$/, Oe = /(_)([^_]*?)$/, ke = /(`)([^`]*?)$/, Ae = /(~~)([^~]*?)$/, T = /^[\s_~*`]*$/, je = /^[\s]*[-*+][\s]+$/, Me = /[\p{L}\p{N}_]/u, Ne = /^```[^`\n]*```?$/, Pe = /^\*{4,}$/, Fe = /(__)([^_]+)_$/, Ie = /(~~)([^~]+)~$/, Le = /~~/g, E = (e) => {
|
|
146
148
|
if (!e) return !1;
|
|
147
149
|
let t = e.charCodeAt(0);
|
|
148
|
-
return t >= 48 && t <= 57 || t >= 65 && t <= 90 || t >= 97 && t <= 122 || t === 95 ||
|
|
149
|
-
},
|
|
150
|
+
return t >= 48 && t <= 57 || t >= 65 && t <= 90 || t >= 97 && t <= 122 || t === 95 || Me.test(e);
|
|
151
|
+
}, Re = (e, t) => {
|
|
150
152
|
let n = 1;
|
|
151
153
|
for (let r = t - 1; r >= 0; --r) if (e[r] === "]") n += 1;
|
|
152
154
|
else if (e[r] === "[" && (--n, n === 0)) return r;
|
|
153
155
|
return -1;
|
|
154
|
-
},
|
|
156
|
+
}, ze = (e, t) => {
|
|
155
157
|
let n = 1;
|
|
156
158
|
for (let r = t + 1; r < e.length; r += 1) if (e[r] === "[") n += 1;
|
|
157
159
|
else if (e[r] === "]" && (--n, n === 0)) return r;
|
|
158
160
|
return -1;
|
|
159
|
-
},
|
|
161
|
+
}, Be = (e) => e === "inlineLatex" || e === "blockLatex", Ve = (e, t) => t === "[" && e === "none" ? "blockLatex" : t === "]" && e === "blockLatex" ? "none" : t === "(" && e === "none" ? "inlineLatex" : t === ")" && e === "inlineLatex" ? "none" : null, He = (e, t) => t ? e === "blockDollar" ? "none" : "blockDollar" : e === "blockDollar" ? e : e === "inlineDollar" ? "none" : "inlineDollar", D = (e, t) => {
|
|
160
162
|
let n = "none";
|
|
161
163
|
for (let r = 0; r < e.length && r < t; r += 1) {
|
|
162
164
|
if (e[r] === "\\" && e[r + 1] === "$") {
|
|
@@ -164,32 +166,32 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
164
166
|
continue;
|
|
165
167
|
}
|
|
166
168
|
if (e[r] === "\\") {
|
|
167
|
-
let t =
|
|
169
|
+
let t = Ve(n, e[r + 1]);
|
|
168
170
|
if (t !== null) {
|
|
169
171
|
n = t, r += 1;
|
|
170
172
|
continue;
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
|
-
if (e[r] === "$" && !
|
|
175
|
+
if (e[r] === "$" && !Be(n)) {
|
|
174
176
|
let t = e[r + 1] === "$";
|
|
175
|
-
n =
|
|
177
|
+
n = He(n, t), t && (r += 1);
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
180
|
return n !== "none";
|
|
179
|
-
},
|
|
181
|
+
}, Ue = (e, t) => {
|
|
180
182
|
for (let n = t; n < e.length; n += 1) {
|
|
181
183
|
if (e[n] === ")") return !0;
|
|
182
184
|
if (e[n] === "\n") return !1;
|
|
183
185
|
}
|
|
184
186
|
return !1;
|
|
185
|
-
},
|
|
187
|
+
}, We = (e, t) => {
|
|
186
188
|
for (let n = t - 1; n >= 0; --n) {
|
|
187
189
|
if (e[n] === ")") return !1;
|
|
188
|
-
if (e[n] === "(") return n > 0 && e[n - 1] === "]" &&
|
|
190
|
+
if (e[n] === "(") return n > 0 && e[n - 1] === "]" && Ue(e, t);
|
|
189
191
|
if (e[n] === "\n") return !1;
|
|
190
192
|
}
|
|
191
193
|
return !1;
|
|
192
|
-
},
|
|
194
|
+
}, Ge = (e, t) => {
|
|
193
195
|
for (let n = t - 1; n >= 0; --n) {
|
|
194
196
|
if (e[n] === ">") return !1;
|
|
195
197
|
if (e[n] === "<") {
|
|
@@ -199,7 +201,7 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
199
201
|
if (e[n] === "\n") return !1;
|
|
200
202
|
}
|
|
201
203
|
return !1;
|
|
202
|
-
},
|
|
204
|
+
}, O = (e, t, n) => {
|
|
203
205
|
let r = 0;
|
|
204
206
|
for (let n = t - 1; n >= 0; --n) if (e[n] === "\n") {
|
|
205
207
|
r = n + 1;
|
|
@@ -217,13 +219,13 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
217
219
|
break;
|
|
218
220
|
}
|
|
219
221
|
return o >= 3 && !s;
|
|
220
|
-
},
|
|
221
|
-
let i =
|
|
222
|
+
}, Ke = (e) => e.includes("$") || e.includes("\\(") || e.includes("\\["), qe = (e, t, n, r) => n === "\\" || Ke(e) && D(e, t) ? !0 : n !== "*" && r === "*" ? (t < e.length - 2 ? e[t + 2] : "") !== "*" : n === "*" || (!n || n === " " || n === " " || n === "\n") && (!r || r === " " || r === " " || r === "\n"), k = (e) => e === " " || e === " " || e === "\n", Je = (e, t) => !!(e && t && E(e) && E(t)), Ye = (e, t, n, r) => {
|
|
223
|
+
let i = Je(e, t), a = !!t && !k(t), o = !!e && !k(e);
|
|
222
224
|
return i && n % 2 == 0 && !r ? { count: !1 } : o && n % 2 == 1 || a ? {
|
|
223
225
|
count: !0,
|
|
224
226
|
inWordAsteriskChain: i
|
|
225
227
|
} : { count: !1 };
|
|
226
|
-
},
|
|
228
|
+
}, Xe = (e) => {
|
|
227
229
|
let t = 0, n = !1, r = !1, i = e.length;
|
|
228
230
|
for (let a = 0; a < i; a += 1) {
|
|
229
231
|
if (e[a] === "`" && a + 2 < i && e[a + 1] === "`" && e[a + 2] === "`") {
|
|
@@ -232,16 +234,16 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
232
234
|
}
|
|
233
235
|
if (n) continue;
|
|
234
236
|
if (e[a] !== "*") {
|
|
235
|
-
|
|
237
|
+
E(e[a]) || (r = !1);
|
|
236
238
|
continue;
|
|
237
239
|
}
|
|
238
240
|
let o = a > 0 ? e[a - 1] : "", s = a < i - 1 ? e[a + 1] : "";
|
|
239
|
-
if (
|
|
240
|
-
let c =
|
|
241
|
+
if (qe(e, a, o, s)) continue;
|
|
242
|
+
let c = Ye(o, s, t, r);
|
|
241
243
|
c.count && (t += 1, r = c.inWordAsteriskChain);
|
|
242
244
|
}
|
|
243
245
|
return t;
|
|
244
|
-
},
|
|
246
|
+
}, Ze = (e, t, n, r) => !!(n === "\\" || Ke(e) && D(e, t) || We(e, t) || Ge(e, t) || n === "_" || r === "_" || n && r && E(n) && E(r)), Qe = (e) => {
|
|
245
247
|
let t = 0, n = !1, r = e.length;
|
|
246
248
|
for (let i = 0; i < r; i += 1) {
|
|
247
249
|
if (e[i] === "`" && i + 2 < r && e[i + 1] === "`" && e[i + 2] === "`") {
|
|
@@ -250,10 +252,10 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
250
252
|
}
|
|
251
253
|
if (n || e[i] !== "_") continue;
|
|
252
254
|
let a = i > 0 ? e[i - 1] : "", o = i < r - 1 ? e[i + 1] : "";
|
|
253
|
-
|
|
255
|
+
Ze(e, i, a, o) || (t += 1);
|
|
254
256
|
}
|
|
255
257
|
return t;
|
|
256
|
-
},
|
|
258
|
+
}, $e = (e) => {
|
|
257
259
|
let t = 0, n = 0, r = !1;
|
|
258
260
|
for (let i = 0; i < e.length; i += 1) {
|
|
259
261
|
if (e[i] === "`" && i + 2 < e.length && e[i + 1] === "`" && e[i + 2] === "`") {
|
|
@@ -263,7 +265,7 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
263
265
|
r || (e[i] === "*" ? n += 1 : (n >= 3 && (t += Math.floor(n / 3)), n = 0));
|
|
264
266
|
}
|
|
265
267
|
return n >= 3 && (t += Math.floor(n / 3)), t;
|
|
266
|
-
},
|
|
268
|
+
}, et = (e) => {
|
|
267
269
|
let t = 0, n = !1;
|
|
268
270
|
for (let r = 0; r < e.length; r += 1) {
|
|
269
271
|
if (e[r] === "`" && r + 2 < e.length && e[r + 1] === "`" && e[r + 2] === "`") {
|
|
@@ -273,7 +275,7 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
273
275
|
n || e[r] === "*" && r + 1 < e.length && e[r + 1] === "*" && (t += 1, r += 1);
|
|
274
276
|
}
|
|
275
277
|
return t;
|
|
276
|
-
},
|
|
278
|
+
}, tt = (e) => {
|
|
277
279
|
let t = 0, n = !1;
|
|
278
280
|
for (let r = 0; r < e.length; r += 1) {
|
|
279
281
|
if (e[r] === "`" && r + 2 < e.length && e[r + 1] === "`" && e[r + 2] === "`") {
|
|
@@ -283,143 +285,143 @@ var ue = Object.defineProperty, de = Object.defineProperties, fe = Object.getOwn
|
|
|
283
285
|
n || e[r] === "_" && r + 1 < e.length && e[r + 1] === "_" && (t += 1, r += 1);
|
|
284
286
|
}
|
|
285
287
|
return t;
|
|
286
|
-
},
|
|
287
|
-
if (!t ||
|
|
288
|
+
}, nt = (e, t, n) => {
|
|
289
|
+
if (!t || T.test(t)) return !0;
|
|
288
290
|
let r = e.substring(0, n).lastIndexOf("\n"), i = r === -1 ? 0 : r + 1, a = e.substring(i, n);
|
|
289
|
-
return
|
|
290
|
-
},
|
|
291
|
-
let t = e.match(
|
|
291
|
+
return je.test(a) && t.includes("\n") ? !0 : O(e, n, "*");
|
|
292
|
+
}, rt = (e) => {
|
|
293
|
+
let t = e.match(we);
|
|
292
294
|
if (!t) return e;
|
|
293
295
|
let n = t[2], r = e.lastIndexOf(t[1]);
|
|
294
|
-
return
|
|
295
|
-
},
|
|
296
|
-
if (!t ||
|
|
296
|
+
return S(e, r) || C(e, r) || nt(e, n, r) ? e : et(e) % 2 == 1 ? n.endsWith("*") ? `${e}*` : `${e}**` : e;
|
|
297
|
+
}, it = (e, t, n) => {
|
|
298
|
+
if (!t || T.test(t)) return !0;
|
|
297
299
|
let r = e.substring(0, n).lastIndexOf("\n"), i = r === -1 ? 0 : r + 1, a = e.substring(i, n);
|
|
298
|
-
return
|
|
299
|
-
},
|
|
300
|
-
let t = e.match(
|
|
300
|
+
return je.test(a) && t.includes("\n") ? !0 : O(e, n, "_");
|
|
301
|
+
}, at = (e) => {
|
|
302
|
+
let t = e.match(Te);
|
|
301
303
|
if (!t) {
|
|
302
|
-
let t = e.match(
|
|
304
|
+
let t = e.match(Fe);
|
|
303
305
|
if (t) {
|
|
304
306
|
let n = e.lastIndexOf(t[1]);
|
|
305
|
-
if (!(
|
|
307
|
+
if (!(S(e, n) || C(e, n)) && tt(e) % 2 == 1) return `${e}_`;
|
|
306
308
|
}
|
|
307
309
|
return e;
|
|
308
310
|
}
|
|
309
311
|
let n = t[2], r = e.lastIndexOf(t[1]);
|
|
310
|
-
return
|
|
311
|
-
},
|
|
312
|
+
return S(e, r) || C(e, r) || it(e, n, r) ? e : tt(e) % 2 == 1 ? `${e}__` : e;
|
|
313
|
+
}, ot = (e) => {
|
|
312
314
|
let t = !1;
|
|
313
315
|
for (let n = 0; n < e.length; n += 1) {
|
|
314
316
|
if (e[n] === "`" && n + 2 < e.length && e[n + 1] === "`" && e[n + 2] === "`") {
|
|
315
317
|
t = !t, n += 2;
|
|
316
318
|
continue;
|
|
317
319
|
}
|
|
318
|
-
if (!t && e[n] === "*" && e[n - 1] !== "*" && e[n + 1] !== "*" && e[n - 1] !== "\\" && !
|
|
320
|
+
if (!t && e[n] === "*" && e[n - 1] !== "*" && e[n + 1] !== "*" && e[n - 1] !== "\\" && !D(e, n)) {
|
|
319
321
|
let t = n > 0 ? e[n - 1] : "", r = n < e.length - 1 ? e[n + 1] : "", i = !t || k(t), a = !r || k(r);
|
|
320
|
-
if (i && a || t && r &&
|
|
322
|
+
if (i && a || t && r && E(t) && E(r) || a) continue;
|
|
321
323
|
return n;
|
|
322
324
|
}
|
|
323
325
|
}
|
|
324
326
|
return -1;
|
|
325
|
-
},
|
|
326
|
-
if (!e.match(
|
|
327
|
-
let t =
|
|
328
|
-
if (t === -1 ||
|
|
327
|
+
}, st = (e) => {
|
|
328
|
+
if (!e.match(De)) return e;
|
|
329
|
+
let t = ot(e);
|
|
330
|
+
if (t === -1 || S(e, t) || C(e, t)) return e;
|
|
329
331
|
let n = e.substring(t + 1);
|
|
330
|
-
return !n ||
|
|
331
|
-
},
|
|
332
|
+
return !n || T.test(n) ? e : Xe(e) % 2 == 1 ? `${e}*` : e;
|
|
333
|
+
}, ct = (e) => {
|
|
332
334
|
let t = !1;
|
|
333
335
|
for (let n = 0; n < e.length; n += 1) {
|
|
334
336
|
if (e[n] === "`" && n + 2 < e.length && e[n + 1] === "`" && e[n + 2] === "`") {
|
|
335
337
|
t = !t, n += 2;
|
|
336
338
|
continue;
|
|
337
339
|
}
|
|
338
|
-
if (!t && e[n] === "_" && e[n - 1] !== "_" && e[n + 1] !== "_" && e[n - 1] !== "\\" && !
|
|
340
|
+
if (!t && e[n] === "_" && e[n - 1] !== "_" && e[n + 1] !== "_" && e[n - 1] !== "\\" && !D(e, n) && !We(e, n)) {
|
|
339
341
|
let t = n > 0 ? e[n - 1] : "", r = n < e.length - 1 ? e[n + 1] : "";
|
|
340
|
-
if (t && r &&
|
|
342
|
+
if (t && r && E(t) && E(r)) continue;
|
|
341
343
|
return n;
|
|
342
344
|
}
|
|
343
345
|
}
|
|
344
346
|
return -1;
|
|
345
|
-
},
|
|
347
|
+
}, lt = (e) => {
|
|
346
348
|
let t = e.length;
|
|
347
349
|
for (; t > 0 && e[t - 1] === "\n";) --t;
|
|
348
350
|
return t < e.length ? `${e.slice(0, t)}_${e.slice(t)}` : `${e}_`;
|
|
349
|
-
},
|
|
351
|
+
}, ut = (e) => {
|
|
350
352
|
if (!e.endsWith("**")) return null;
|
|
351
353
|
let t = e.slice(0, -2);
|
|
352
|
-
if (
|
|
353
|
-
let n = t.indexOf("**"), r =
|
|
354
|
+
if (et(t) % 2 != 1) return null;
|
|
355
|
+
let n = t.indexOf("**"), r = ct(t);
|
|
354
356
|
return n !== -1 && r !== -1 && n < r ? `${t}_**` : null;
|
|
355
|
-
},
|
|
356
|
-
if (!e.match(
|
|
357
|
-
let t =
|
|
357
|
+
}, dt = (e) => {
|
|
358
|
+
if (!e.match(Oe)) return e;
|
|
359
|
+
let t = ct(e);
|
|
358
360
|
if (t === -1) return e;
|
|
359
361
|
let n = e.substring(t + 1);
|
|
360
|
-
if (!n ||
|
|
361
|
-
if (
|
|
362
|
-
let t =
|
|
363
|
-
return t === null ?
|
|
362
|
+
if (!n || T.test(n) || S(e, t) || C(e, t)) return e;
|
|
363
|
+
if (Qe(e) % 2 == 1) {
|
|
364
|
+
let t = ut(e);
|
|
365
|
+
return t === null ? lt(e) : t;
|
|
364
366
|
}
|
|
365
367
|
return e;
|
|
366
|
-
},
|
|
367
|
-
let t =
|
|
368
|
+
}, ft = (e) => {
|
|
369
|
+
let t = et(e), n = Xe(e);
|
|
368
370
|
return t % 2 == 0 && n % 2 == 0;
|
|
369
|
-
},
|
|
370
|
-
if (
|
|
371
|
-
let t = e.match(
|
|
371
|
+
}, pt = (e, t, n) => !t || T.test(t) || S(e, n) || C(e, n) ? !0 : O(e, n, "*"), mt = (e) => {
|
|
372
|
+
if (Pe.test(e)) return e;
|
|
373
|
+
let t = e.match(Ee);
|
|
372
374
|
if (!t) return e;
|
|
373
375
|
let n = t[2];
|
|
374
|
-
return
|
|
375
|
-
},
|
|
376
|
-
let t = e.match(
|
|
377
|
-
return !t || t.index === void 0 ||
|
|
378
|
-
},
|
|
379
|
-
let t =
|
|
376
|
+
return pt(e, n, e.lastIndexOf(t[1])) ? e : $e(e) % 2 == 1 ? ft(e) ? e : `${e}***` : e;
|
|
377
|
+
}, ht = /<[a-zA-Z/][^>]*$/, gt = (e) => {
|
|
378
|
+
let t = e.match(ht);
|
|
379
|
+
return !t || t.index === void 0 || S(e, t.index) ? e : e.substring(0, t.index).trimEnd();
|
|
380
|
+
}, _t = (e) => !e.match(Ne) || e.includes("\n") ? null : e.endsWith("``") && !e.endsWith("```") ? `${e}\`` : e, vt = (e) => (e.match(/```/g) || []).length % 2 == 1, yt = (e) => {
|
|
381
|
+
let t = _t(e);
|
|
380
382
|
if (t !== null) return t;
|
|
381
|
-
let n = e.match(
|
|
382
|
-
if (n && !
|
|
383
|
+
let n = e.match(ke);
|
|
384
|
+
if (n && !vt(e)) {
|
|
383
385
|
let t = n[2];
|
|
384
|
-
if (!t ||
|
|
385
|
-
if (
|
|
386
|
+
if (!t || T.test(t)) return e;
|
|
387
|
+
if (Se(e) % 2 == 1) return `${e}\``;
|
|
386
388
|
}
|
|
387
389
|
return e;
|
|
388
|
-
},
|
|
390
|
+
}, bt = (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) === "```", xt = (e) => {
|
|
389
391
|
let t = 0, n = !1;
|
|
390
|
-
for (let r = 0; r < e.length - 1; r += 1) e[r] === "`" && !
|
|
392
|
+
for (let r = 0; r < e.length - 1; r += 1) e[r] === "`" && !bt(e, r) && (n = !n), !n && e[r] === "$" && e[r + 1] === "$" && (t += 1, r += 1);
|
|
391
393
|
return t;
|
|
392
|
-
},
|
|
394
|
+
}, St = (e) => {
|
|
393
395
|
let t = 0, n = !1;
|
|
394
396
|
for (let r = 0; r < e.length; r += 1) {
|
|
395
397
|
if (e[r] === "\\") {
|
|
396
398
|
r += 1;
|
|
397
399
|
continue;
|
|
398
400
|
}
|
|
399
|
-
if (e[r] === "`" && !
|
|
401
|
+
if (e[r] === "`" && !bt(e, r)) {
|
|
400
402
|
n = !n;
|
|
401
403
|
continue;
|
|
402
404
|
}
|
|
403
405
|
!n && e[r] === "$" && (r + 1 < e.length && e[r + 1] === "$" ? r += 1 : t += 1);
|
|
404
406
|
}
|
|
405
407
|
return t;
|
|
406
|
-
},
|
|
408
|
+
}, Ct = (e) => {
|
|
407
409
|
if (e.endsWith("$") && !e.endsWith("$$")) return `${e}$`;
|
|
408
410
|
let t = e.indexOf("$$");
|
|
409
411
|
return t !== -1 && e.indexOf("\n", t) !== -1 && !e.endsWith("\n") ? `${e}
|
|
410
412
|
$$` : `${e}$$`;
|
|
411
|
-
},
|
|
413
|
+
}, wt = (e) => xt(e) % 2 == 0 ? e : Ct(e), Tt = (e) => St(e) % 2 == 1 ? `${e}$` : e, Et = (e, t, n) => {
|
|
412
414
|
if (e.substring(t + 2).includes(")")) return null;
|
|
413
|
-
let r =
|
|
414
|
-
if (r === -1 ||
|
|
415
|
+
let r = Re(e, t);
|
|
416
|
+
if (r === -1 || S(e, r)) return null;
|
|
415
417
|
let i = r > 0 && e[r - 1] === "!", a = i ? r - 1 : r, o = e.substring(0, a);
|
|
416
418
|
if (i) return o;
|
|
417
419
|
let s = e.substring(r + 1, t);
|
|
418
420
|
return n === "text-only" ? `${o}${s}` : `${o}[${s}](streamdown:incomplete-link)`;
|
|
419
|
-
},
|
|
420
|
-
for (let n = 0; n < t; n++) if (e[n] === "[" && !
|
|
421
|
+
}, Dt = (e, t) => {
|
|
422
|
+
for (let n = 0; n < t; n++) if (e[n] === "[" && !S(e, n)) {
|
|
421
423
|
if (n > 0 && e[n - 1] === "!") continue;
|
|
422
|
-
let t =
|
|
424
|
+
let t = ze(e, n);
|
|
423
425
|
if (t === -1) return n;
|
|
424
426
|
if (t + 1 < e.length && e[t + 1] === "(") {
|
|
425
427
|
let r = e.indexOf(")", t + 2);
|
|
@@ -427,70 +429,70 @@ $$` : `${e}$$`;
|
|
|
427
429
|
}
|
|
428
430
|
}
|
|
429
431
|
return t;
|
|
430
|
-
},
|
|
432
|
+
}, Ot = (e, t, n) => {
|
|
431
433
|
let r = t > 0 && e[t - 1] === "!", i = r ? t - 1 : t;
|
|
432
434
|
if (!e.substring(t + 1).includes("]")) {
|
|
433
435
|
let a = e.substring(0, i);
|
|
434
436
|
if (r) return a;
|
|
435
437
|
if (n === "text-only") {
|
|
436
|
-
let n =
|
|
438
|
+
let n = Dt(e, t);
|
|
437
439
|
return e.substring(0, n) + e.substring(n + 1);
|
|
438
440
|
}
|
|
439
441
|
return `${e}](streamdown:incomplete-link)`;
|
|
440
442
|
}
|
|
441
|
-
if (
|
|
443
|
+
if (ze(e, t) === -1) {
|
|
442
444
|
let a = e.substring(0, i);
|
|
443
445
|
if (r) return a;
|
|
444
446
|
if (n === "text-only") {
|
|
445
|
-
let n =
|
|
447
|
+
let n = Dt(e, t);
|
|
446
448
|
return e.substring(0, n) + e.substring(n + 1);
|
|
447
449
|
}
|
|
448
450
|
return `${e}](streamdown:incomplete-link)`;
|
|
449
451
|
}
|
|
450
452
|
return null;
|
|
451
|
-
},
|
|
453
|
+
}, kt = (e, t = "protocol") => {
|
|
452
454
|
let n = e.lastIndexOf("](");
|
|
453
|
-
if (n !== -1 && !
|
|
454
|
-
let r =
|
|
455
|
+
if (n !== -1 && !S(e, n)) {
|
|
456
|
+
let r = Et(e, n, t);
|
|
455
457
|
if (r !== null) return r;
|
|
456
458
|
}
|
|
457
|
-
for (let n = e.length - 1; n >= 0; --n) if (e[n] === "[" && !
|
|
458
|
-
let r =
|
|
459
|
+
for (let n = e.length - 1; n >= 0; --n) if (e[n] === "[" && !S(e, n)) {
|
|
460
|
+
let r = Ot(e, n, t);
|
|
459
461
|
if (r !== null) return r;
|
|
460
462
|
}
|
|
461
463
|
return e;
|
|
462
|
-
},
|
|
464
|
+
}, At = /^-{1,2}$/, jt = /^[\s]*-{1,2}[\s]+$/, Mt = /^={1,2}$/, Nt = /^[\s]*={1,2}[\s]+$/, Pt = (e) => {
|
|
463
465
|
if (!e || typeof e != "string") return e;
|
|
464
466
|
let t = e.lastIndexOf("\n");
|
|
465
467
|
if (t === -1) return e;
|
|
466
468
|
let n = e.substring(t + 1), r = e.substring(0, t), i = n.trim();
|
|
467
|
-
if (
|
|
469
|
+
if (At.test(i) && !n.match(jt)) {
|
|
468
470
|
let t = r.split("\n").at(-1);
|
|
469
471
|
if (t && t.trim().length > 0) return `${e}\u200B`;
|
|
470
472
|
}
|
|
471
|
-
if (
|
|
473
|
+
if (Mt.test(i) && !n.match(Nt)) {
|
|
472
474
|
let t = r.split("\n").at(-1);
|
|
473
475
|
if (t && t.trim().length > 0) return `${e}\u200B`;
|
|
474
476
|
}
|
|
475
477
|
return e;
|
|
476
|
-
},
|
|
477
|
-
let t = e.match(
|
|
478
|
+
}, Ft = /([\p{L}\p{N}_])~(?!~)(?=[\p{L}\p{N}_])/gu, It = (e) => !e || typeof e != "string" || !e.includes("~") ? e : e.replace(Ft, (t, n, r) => S(e, r + n.length) ? t : `${n}\\~`), Lt = (e) => {
|
|
479
|
+
let t = e.match(Ae);
|
|
478
480
|
if (t) {
|
|
479
481
|
let n = t[2];
|
|
480
|
-
if (!n ||
|
|
482
|
+
if (!n || T.test(n)) return e;
|
|
481
483
|
let r = e.lastIndexOf(t[1]);
|
|
482
|
-
if (
|
|
483
|
-
if (e.match(
|
|
484
|
+
if (S(e, r) || C(e, r)) return e;
|
|
485
|
+
if (e.match(Le)?.length % 2 == 1) return `${e}~~`;
|
|
484
486
|
} else {
|
|
485
|
-
let t = e.match(
|
|
487
|
+
let t = e.match(Ie);
|
|
486
488
|
if (t) {
|
|
487
489
|
let n = e.lastIndexOf(t[0].slice(0, 2));
|
|
488
|
-
if (
|
|
489
|
-
if (e.match(
|
|
490
|
+
if (S(e, n) || C(e, n)) return e;
|
|
491
|
+
if (e.match(Le)?.length % 2 == 1) return `${e}~`;
|
|
490
492
|
}
|
|
491
493
|
}
|
|
492
494
|
return e;
|
|
493
|
-
},
|
|
495
|
+
}, Rt = (e) => e !== !1, zt = (e) => e === !0, A = {
|
|
494
496
|
SINGLE_TILDE: 0,
|
|
495
497
|
COMPARISON_OPERATORS: 5,
|
|
496
498
|
HTML_TAGS: 10,
|
|
@@ -506,11 +508,11 @@ $$` : `${e}$$`;
|
|
|
506
508
|
KATEX: 70,
|
|
507
509
|
INLINE_KATEX: 75,
|
|
508
510
|
DEFAULT: 100
|
|
509
|
-
},
|
|
511
|
+
}, Bt = [
|
|
510
512
|
{
|
|
511
513
|
handler: {
|
|
512
514
|
name: "singleTilde",
|
|
513
|
-
handle:
|
|
515
|
+
handle: It,
|
|
514
516
|
priority: A.SINGLE_TILDE
|
|
515
517
|
},
|
|
516
518
|
optionKey: "singleTilde"
|
|
@@ -518,7 +520,7 @@ $$` : `${e}$$`;
|
|
|
518
520
|
{
|
|
519
521
|
handler: {
|
|
520
522
|
name: "comparisonOperators",
|
|
521
|
-
handle:
|
|
523
|
+
handle: w,
|
|
522
524
|
priority: A.COMPARISON_OPERATORS
|
|
523
525
|
},
|
|
524
526
|
optionKey: "comparisonOperators"
|
|
@@ -526,7 +528,7 @@ $$` : `${e}$$`;
|
|
|
526
528
|
{
|
|
527
529
|
handler: {
|
|
528
530
|
name: "htmlTags",
|
|
529
|
-
handle:
|
|
531
|
+
handle: gt,
|
|
530
532
|
priority: A.HTML_TAGS
|
|
531
533
|
},
|
|
532
534
|
optionKey: "htmlTags"
|
|
@@ -534,7 +536,7 @@ $$` : `${e}$$`;
|
|
|
534
536
|
{
|
|
535
537
|
handler: {
|
|
536
538
|
name: "setextHeadings",
|
|
537
|
-
handle:
|
|
539
|
+
handle: Pt,
|
|
538
540
|
priority: A.SETEXT_HEADINGS
|
|
539
541
|
},
|
|
540
542
|
optionKey: "setextHeadings"
|
|
@@ -542,7 +544,7 @@ $$` : `${e}$$`;
|
|
|
542
544
|
{
|
|
543
545
|
handler: {
|
|
544
546
|
name: "links",
|
|
545
|
-
handle:
|
|
547
|
+
handle: kt,
|
|
546
548
|
priority: A.LINKS
|
|
547
549
|
},
|
|
548
550
|
optionKey: "links",
|
|
@@ -551,7 +553,7 @@ $$` : `${e}$$`;
|
|
|
551
553
|
{
|
|
552
554
|
handler: {
|
|
553
555
|
name: "boldItalic",
|
|
554
|
-
handle:
|
|
556
|
+
handle: mt,
|
|
555
557
|
priority: A.BOLD_ITALIC
|
|
556
558
|
},
|
|
557
559
|
optionKey: "boldItalic"
|
|
@@ -559,7 +561,7 @@ $$` : `${e}$$`;
|
|
|
559
561
|
{
|
|
560
562
|
handler: {
|
|
561
563
|
name: "bold",
|
|
562
|
-
handle:
|
|
564
|
+
handle: rt,
|
|
563
565
|
priority: A.BOLD
|
|
564
566
|
},
|
|
565
567
|
optionKey: "bold"
|
|
@@ -567,7 +569,7 @@ $$` : `${e}$$`;
|
|
|
567
569
|
{
|
|
568
570
|
handler: {
|
|
569
571
|
name: "italicDoubleUnderscore",
|
|
570
|
-
handle:
|
|
572
|
+
handle: at,
|
|
571
573
|
priority: A.ITALIC_DOUBLE_UNDERSCORE
|
|
572
574
|
},
|
|
573
575
|
optionKey: "italic"
|
|
@@ -575,7 +577,7 @@ $$` : `${e}$$`;
|
|
|
575
577
|
{
|
|
576
578
|
handler: {
|
|
577
579
|
name: "italicSingleAsterisk",
|
|
578
|
-
handle:
|
|
580
|
+
handle: st,
|
|
579
581
|
priority: A.ITALIC_SINGLE_ASTERISK
|
|
580
582
|
},
|
|
581
583
|
optionKey: "italic"
|
|
@@ -583,7 +585,7 @@ $$` : `${e}$$`;
|
|
|
583
585
|
{
|
|
584
586
|
handler: {
|
|
585
587
|
name: "italicSingleUnderscore",
|
|
586
|
-
handle:
|
|
588
|
+
handle: dt,
|
|
587
589
|
priority: A.ITALIC_SINGLE_UNDERSCORE
|
|
588
590
|
},
|
|
589
591
|
optionKey: "italic"
|
|
@@ -591,7 +593,7 @@ $$` : `${e}$$`;
|
|
|
591
593
|
{
|
|
592
594
|
handler: {
|
|
593
595
|
name: "inlineCode",
|
|
594
|
-
handle:
|
|
596
|
+
handle: yt,
|
|
595
597
|
priority: A.INLINE_CODE
|
|
596
598
|
},
|
|
597
599
|
optionKey: "inlineCode"
|
|
@@ -599,7 +601,7 @@ $$` : `${e}$$`;
|
|
|
599
601
|
{
|
|
600
602
|
handler: {
|
|
601
603
|
name: "strikethrough",
|
|
602
|
-
handle:
|
|
604
|
+
handle: Lt,
|
|
603
605
|
priority: A.STRIKETHROUGH
|
|
604
606
|
},
|
|
605
607
|
optionKey: "strikethrough"
|
|
@@ -607,7 +609,7 @@ $$` : `${e}$$`;
|
|
|
607
609
|
{
|
|
608
610
|
handler: {
|
|
609
611
|
name: "katex",
|
|
610
|
-
handle:
|
|
612
|
+
handle: wt,
|
|
611
613
|
priority: A.KATEX
|
|
612
614
|
},
|
|
613
615
|
optionKey: "katex"
|
|
@@ -615,24 +617,24 @@ $$` : `${e}$$`;
|
|
|
615
617
|
{
|
|
616
618
|
handler: {
|
|
617
619
|
name: "inlineKatex",
|
|
618
|
-
handle:
|
|
620
|
+
handle: Tt,
|
|
619
621
|
priority: A.INLINE_KATEX
|
|
620
622
|
},
|
|
621
623
|
optionKey: "inlineKatex"
|
|
622
624
|
}
|
|
623
|
-
],
|
|
625
|
+
], Vt = (e) => {
|
|
624
626
|
let t = e?.linkMode ?? "protocol";
|
|
625
|
-
return
|
|
626
|
-
handler: x(
|
|
627
|
+
return Bt.filter(({ handler: t, optionKey: n }) => t.name === "links" ? Rt(e?.links) || Rt(e?.images) : t.name === "inlineKatex" ? zt(e?.inlineKatex) : Rt(e?.[n])).map(({ handler: e, earlyReturn: n }) => e.name === "links" ? {
|
|
628
|
+
handler: x(ve({}, e), { handle: (e) => kt(e, t) }),
|
|
627
629
|
earlyReturn: t === "protocol" ? n : void 0
|
|
628
630
|
} : {
|
|
629
631
|
handler: e,
|
|
630
632
|
earlyReturn: n
|
|
631
633
|
});
|
|
632
|
-
},
|
|
634
|
+
}, Ht = (e, t) => {
|
|
633
635
|
if (!e || typeof e != "string") return e;
|
|
634
|
-
let n = e.endsWith(" ") && !e.endsWith(" ") ? e.slice(0, -1) : e, r =
|
|
635
|
-
handler: x(
|
|
636
|
+
let n = e.endsWith(" ") && !e.endsWith(" ") ? e.slice(0, -1) : e, r = Vt(t), i = (t?.handlers ?? []).map((e) => ({
|
|
637
|
+
handler: x(ve({}, e), { priority: e.priority ?? A.DEFAULT }),
|
|
636
638
|
earlyReturn: void 0
|
|
637
639
|
})), a = [...r, ...i].sort((e, t) => (e.handler.priority ?? 0) - (t.handler.priority ?? 0));
|
|
638
640
|
for (let { handler: e, earlyReturn: t } of a) if (n = e.handle(n), t != null && t(n)) return n;
|
|
@@ -640,7 +642,7 @@ $$` : `${e}$$`;
|
|
|
640
642
|
};
|
|
641
643
|
//#endregion
|
|
642
644
|
//#region ../../node_modules/.pnpm/marked@18.0.14/node_modules/marked/lib/marked.esm.js
|
|
643
|
-
function
|
|
645
|
+
function Ut() {
|
|
644
646
|
return {
|
|
645
647
|
async: !1,
|
|
646
648
|
breaks: !1,
|
|
@@ -654,8 +656,8 @@ function Bt() {
|
|
|
654
656
|
walkTokens: null
|
|
655
657
|
};
|
|
656
658
|
}
|
|
657
|
-
var j =
|
|
658
|
-
function
|
|
659
|
+
var j = Ut();
|
|
660
|
+
function Wt(e) {
|
|
659
661
|
j = e;
|
|
660
662
|
}
|
|
661
663
|
var M = { exec: () => null };
|
|
@@ -676,7 +678,7 @@ function P(e, t = "") {
|
|
|
676
678
|
};
|
|
677
679
|
return r;
|
|
678
680
|
}
|
|
679
|
-
var
|
|
681
|
+
var Gt = ((e = "") => {
|
|
680
682
|
try {
|
|
681
683
|
return !!RegExp("(?<=1)(?<!1)" + e);
|
|
682
684
|
} catch {
|
|
@@ -742,105 +744,105 @@ var Ht = ((e = "") => {
|
|
|
742
744
|
headingBeginRegex: N((e) => RegExp(`^ {0,${e}}#`)),
|
|
743
745
|
htmlBeginRegex: N((e) => RegExp(`^ {0,${e}}(?:</?(?:${L})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")),
|
|
744
746
|
blockquoteBeginRegex: N((e) => RegExp(`^ {0,${e}}>`))
|
|
745
|
-
},
|
|
746
|
-
blockquote: P(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",
|
|
747
|
-
code:
|
|
748
|
-
def:
|
|
749
|
-
fences:
|
|
750
|
-
heading:
|
|
747
|
+
}, Kt = /^(?:[ \t]*(?:\n|$))+/, qt = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Jt = /^ {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+|$)/, Yt = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Xt = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Zt = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Qt = P(Zt).replace(/bull/g, Xt).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(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), $t = P(Zt).replace(/bull/g, Xt).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(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), en = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, tn = /^[^\n]+/, nn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, rn = P(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", nn).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), an = P(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, Xt).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", on = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, sn = 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][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", on).replace("tag", L).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), cn = (e) => P(en).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(), ln = cn(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), un = cn(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), dn = {
|
|
748
|
+
blockquote: P(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", un).getRegex(),
|
|
749
|
+
code: qt,
|
|
750
|
+
def: rn,
|
|
751
|
+
fences: Jt,
|
|
752
|
+
heading: Yt,
|
|
751
753
|
hr: I,
|
|
752
|
-
html:
|
|
753
|
-
lheading:
|
|
754
|
-
list:
|
|
755
|
-
newline:
|
|
756
|
-
paragraph:
|
|
754
|
+
html: sn,
|
|
755
|
+
lheading: Qt,
|
|
756
|
+
list: an,
|
|
757
|
+
newline: Kt,
|
|
758
|
+
paragraph: ln,
|
|
757
759
|
table: M,
|
|
758
|
-
text:
|
|
759
|
-
},
|
|
760
|
-
...
|
|
761
|
-
lheading:
|
|
762
|
-
table:
|
|
763
|
-
paragraph: P(
|
|
764
|
-
},
|
|
765
|
-
...
|
|
766
|
-
html: P("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",
|
|
760
|
+
text: tn
|
|
761
|
+
}, fn = 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(), pn = {
|
|
762
|
+
...dn,
|
|
763
|
+
lheading: $t,
|
|
764
|
+
table: fn,
|
|
765
|
+
paragraph: P(en).replace("hr", I).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", fn).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()
|
|
766
|
+
}, mn = {
|
|
767
|
+
...dn,
|
|
768
|
+
html: P("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", on).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(),
|
|
767
769
|
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
|
768
770
|
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
|
769
771
|
fences: M,
|
|
770
772
|
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
|
771
|
-
paragraph: P(
|
|
772
|
-
},
|
|
773
|
+
paragraph: P(en).replace("hr", I).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Qt).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
|
774
|
+
}, hn = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, gn = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, _n = /^( {2,}|\\)\n(?!\s*$)[ \t]*/, vn = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, R = /[\p{P}\p{S}]/u, z = /[\s\p{P}\p{S}]/u, B = /[^\s\p{P}\p{S}]/u, yn = P(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, z).getRegex(), bn = /[\p{Pi}\p{Ps}"']/u, xn = /(?!~)[\p{P}\p{S}]/u, Sn = /(?!~)[\s\p{P}\p{S}]/u, Cn = /(?:[^\s\p{P}\p{S}]|~)/u, wn = P(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Gt ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), Tn = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, En = P(Tn, "u").replace(/punct/g, R).getRegex(), Dn = P(Tn, "u").replace(/punct/g, xn).getRegex(), On = P(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, bn).replace(/punct/g, R).getRegex(), kn = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", An = P(kn, "gu").replace(/notPunctSpace/g, B).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), jn = P(kn, "gu").replace(/notPunctSpace/g, Cn).replace(/punctSpace/g, Sn).replace(/punct/g, xn).getRegex(), Mn = P("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, B).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), Nn = P("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, B).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), Pn = P("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, B).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), Fn = P(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, R).getRegex(), In = P("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, B).replace(/punctSpace/g, z).replace(/punct/g, R).getRegex(), Ln = P(/\\(punct)/, "gu").replace(/punct/g, R).getRegex(), Rn = 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(), zn = P(on).replace("(?:-->|$)", "-->").getRegex(), Bn = P("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", zn).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Vn = /\[(?:\\[\s\S]|[^\[\]\\])*\]/, V = P(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", Vn).getRegex(), Hn = P(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", V).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Un = P(/^!?\[(label)\]\[(ref)\]/).replace("label", V).replace("ref", nn).getRegex(), Wn = P(/^!?\[(ref)\](?:\[\])?/).replace("ref", nn).getRegex(), Gn = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/, Kn = P(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", Vn).getRegex(), qn = P("reflink|nolink(?!\\()", "g").replace("reflink", P(/^!?\[(label)\]\[(ref)\]/).replace("label", Kn).replace("ref", Gn).getRegex()).replace("nolink", P(/^!?\[(ref)\](?:\[\])?/).replace("ref", Gn).getRegex()).getRegex(), Jn = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Yn = P(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), Xn = {
|
|
773
775
|
_backpedal: M,
|
|
774
|
-
anyPunctuation:
|
|
775
|
-
autolink:
|
|
776
|
-
blockSkip:
|
|
777
|
-
br:
|
|
778
|
-
code:
|
|
776
|
+
anyPunctuation: Ln,
|
|
777
|
+
autolink: Rn,
|
|
778
|
+
blockSkip: wn,
|
|
779
|
+
br: _n,
|
|
780
|
+
code: gn,
|
|
779
781
|
del: M,
|
|
780
782
|
delLDelim: M,
|
|
781
783
|
delRDelim: M,
|
|
782
|
-
emStrongLDelim:
|
|
783
|
-
emStrongRDelimAst:
|
|
784
|
-
emStrongRDelimUnd:
|
|
785
|
-
escape:
|
|
786
|
-
link:
|
|
787
|
-
nolink:
|
|
788
|
-
punctuation:
|
|
789
|
-
reflink:
|
|
790
|
-
reflinkSearch:
|
|
791
|
-
tag:
|
|
792
|
-
text:
|
|
784
|
+
emStrongLDelim: En,
|
|
785
|
+
emStrongRDelimAst: An,
|
|
786
|
+
emStrongRDelimUnd: Nn,
|
|
787
|
+
escape: hn,
|
|
788
|
+
link: Hn,
|
|
789
|
+
nolink: Wn,
|
|
790
|
+
punctuation: yn,
|
|
791
|
+
reflink: Un,
|
|
792
|
+
reflinkSearch: qn,
|
|
793
|
+
tag: Bn,
|
|
794
|
+
text: vn,
|
|
793
795
|
url: M
|
|
794
|
-
},
|
|
795
|
-
...
|
|
796
|
-
emStrongLDelim:
|
|
797
|
-
emStrongRDelimAst:
|
|
798
|
-
emStrongRDelimUnd:
|
|
796
|
+
}, Zn = {
|
|
797
|
+
...Xn,
|
|
798
|
+
emStrongLDelim: On,
|
|
799
|
+
emStrongRDelimAst: Mn,
|
|
800
|
+
emStrongRDelimUnd: Pn,
|
|
799
801
|
link: P(/^!?\[(label)\]\((.*?)\)/).replace("label", V).getRegex(),
|
|
800
802
|
reflink: P(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", V).getRegex()
|
|
801
|
-
},
|
|
802
|
-
...
|
|
803
|
-
emStrongRDelimAst:
|
|
804
|
-
emStrongLDelim:
|
|
805
|
-
delLDelim:
|
|
806
|
-
delRDelim:
|
|
807
|
-
url: P(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",
|
|
803
|
+
}, Qn = {
|
|
804
|
+
...Xn,
|
|
805
|
+
emStrongRDelimAst: jn,
|
|
806
|
+
emStrongLDelim: Dn,
|
|
807
|
+
delLDelim: Fn,
|
|
808
|
+
delRDelim: In,
|
|
809
|
+
url: P(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Yn).replace("protocol", Jn).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),
|
|
808
810
|
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
|
809
811
|
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
|
810
|
-
text: P(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol",
|
|
811
|
-
},
|
|
812
|
-
...
|
|
813
|
-
br: P(
|
|
814
|
-
text: P(
|
|
812
|
+
text: P(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", Jn).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex()
|
|
813
|
+
}, $n = {
|
|
814
|
+
...Qn,
|
|
815
|
+
br: P(_n).replace("{2,}", "*").getRegex(),
|
|
816
|
+
text: P(Qn.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
|
815
817
|
}, H = {
|
|
816
|
-
normal:
|
|
817
|
-
gfm:
|
|
818
|
-
pedantic:
|
|
818
|
+
normal: dn,
|
|
819
|
+
gfm: pn,
|
|
820
|
+
pedantic: mn
|
|
819
821
|
}, U = {
|
|
820
|
-
normal:
|
|
821
|
-
gfm:
|
|
822
|
-
breaks:
|
|
823
|
-
pedantic:
|
|
824
|
-
},
|
|
822
|
+
normal: Xn,
|
|
823
|
+
gfm: Qn,
|
|
824
|
+
breaks: $n,
|
|
825
|
+
pedantic: Zn
|
|
826
|
+
}, er = {
|
|
825
827
|
"&": "&",
|
|
826
828
|
"<": "<",
|
|
827
829
|
">": ">",
|
|
828
830
|
"\"": """,
|
|
829
831
|
"'": "'"
|
|
830
|
-
},
|
|
832
|
+
}, tr = (e) => er[e];
|
|
831
833
|
function W(e, t) {
|
|
832
834
|
if (t) {
|
|
833
|
-
if (F.escapeTest.test(e)) return e.replace(F.escapeReplace,
|
|
834
|
-
} else if (F.escapeTestNoEncode.test(e)) return e.replace(F.escapeReplaceNoEncode,
|
|
835
|
+
if (F.escapeTest.test(e)) return e.replace(F.escapeReplace, tr);
|
|
836
|
+
} else if (F.escapeTestNoEncode.test(e)) return e.replace(F.escapeReplaceNoEncode, tr);
|
|
835
837
|
return e;
|
|
836
838
|
}
|
|
837
|
-
function
|
|
839
|
+
function nr(e) {
|
|
838
840
|
return e.replace(F.numericCharacterReference, (e, t, n) => {
|
|
839
841
|
let r = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
840
842
|
return r === 0 || r > 1114111 || r >= 55296 && r <= 57343 ? "�" : String.fromCodePoint(r);
|
|
841
843
|
});
|
|
842
844
|
}
|
|
843
|
-
function
|
|
845
|
+
function rr(e) {
|
|
844
846
|
try {
|
|
845
847
|
e = encodeURI(e).replace(F.percentDecode, "%");
|
|
846
848
|
} catch {
|
|
@@ -848,7 +850,7 @@ function er(e) {
|
|
|
848
850
|
}
|
|
849
851
|
return e;
|
|
850
852
|
}
|
|
851
|
-
function
|
|
853
|
+
function ir(e, t) {
|
|
852
854
|
let n = e.replace(F.findPipe, (e, t, n) => {
|
|
853
855
|
let r = !1, i = t;
|
|
854
856
|
for (; --i >= 0 && n[i] === "\\";) r = !r;
|
|
@@ -873,7 +875,7 @@ function G(e, t, n) {
|
|
|
873
875
|
}
|
|
874
876
|
return e.slice(0, r - i);
|
|
875
877
|
}
|
|
876
|
-
function
|
|
878
|
+
function ar(e) {
|
|
877
879
|
let t = e.split("\n"), n = t.length - 1;
|
|
878
880
|
for (; n >= 0 && F.blankLine.test(t[n]);) n--;
|
|
879
881
|
return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
|
|
@@ -881,7 +883,7 @@ function nr(e) {
|
|
|
881
883
|
function K(e) {
|
|
882
884
|
return e.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
883
885
|
}
|
|
884
|
-
function
|
|
886
|
+
function or(e, t) {
|
|
885
887
|
if (e.indexOf(t[1]) === -1) return -1;
|
|
886
888
|
let n = 0;
|
|
887
889
|
for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
|
|
@@ -889,7 +891,7 @@ function rr(e, t) {
|
|
|
889
891
|
else if (e[r] === t[1] && (n--, n < 0)) return r;
|
|
890
892
|
return n > 0 ? -2 : -1;
|
|
891
893
|
}
|
|
892
|
-
function
|
|
894
|
+
function sr(e, t = 0) {
|
|
893
895
|
let n = t, r = "";
|
|
894
896
|
for (let t of e) if (t === " ") {
|
|
895
897
|
let e = 4 - n % 4;
|
|
@@ -897,7 +899,7 @@ function ir(e, t = 0) {
|
|
|
897
899
|
} else r += t, n++;
|
|
898
900
|
return r;
|
|
899
901
|
}
|
|
900
|
-
function
|
|
902
|
+
function cr(e, t, n, r, i) {
|
|
901
903
|
let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1"), c = e[0].charAt(0) === "!";
|
|
902
904
|
r.state.inLink = !0;
|
|
903
905
|
let l = r.state.linkEmitted, u = r.state.inRawBlock;
|
|
@@ -919,7 +921,7 @@ function ar(e, t, n, r, i) {
|
|
|
919
921
|
tokens: d
|
|
920
922
|
};
|
|
921
923
|
}
|
|
922
|
-
function
|
|
924
|
+
function lr(e, t, n) {
|
|
923
925
|
let r = e.match(n.other.indentCodeCompensation);
|
|
924
926
|
if (r === null) return t;
|
|
925
927
|
let i = r[1];
|
|
@@ -930,7 +932,7 @@ function or(e, t, n) {
|
|
|
930
932
|
return e.slice(Math.min(r.length, i.length));
|
|
931
933
|
}).join("\n");
|
|
932
934
|
}
|
|
933
|
-
function
|
|
935
|
+
function ur(e, t, n, r) {
|
|
934
936
|
if (!t.includes("<")) return !1;
|
|
935
937
|
for (let i = 0; i < t.length; i++) {
|
|
936
938
|
if (t[i] === "\\") {
|
|
@@ -970,7 +972,7 @@ var q = class {
|
|
|
970
972
|
code(e) {
|
|
971
973
|
let t = this.rules.block.code.exec(e);
|
|
972
974
|
if (t) {
|
|
973
|
-
let e = this.options.pedantic ? t[0] :
|
|
975
|
+
let e = this.options.pedantic ? t[0] : ar(t[0]);
|
|
974
976
|
return {
|
|
975
977
|
type: "code",
|
|
976
978
|
raw: e,
|
|
@@ -982,7 +984,7 @@ var q = class {
|
|
|
982
984
|
fences(e) {
|
|
983
985
|
let t = this.rules.block.fences.exec(e);
|
|
984
986
|
if (t) {
|
|
985
|
-
let e = t[0], n =
|
|
987
|
+
let e = t[0], n = lr(e, t[3] || "", this.rules);
|
|
986
988
|
return {
|
|
987
989
|
type: "code",
|
|
988
990
|
raw: e,
|
|
@@ -1072,7 +1074,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1072
1074
|
let n = !1, r = "", s = "";
|
|
1073
1075
|
if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
1074
1076
|
r = t[0], e = e.substring(r.length);
|
|
1075
|
-
let c = t[2].split("\n", 1)[0], l = t[1].length, u = this.options.pedantic ?
|
|
1077
|
+
let c = t[2].split("\n", 1)[0], l = t[1].length, u = this.options.pedantic ? sr(c, l) : c.replace(this.rules.other.leadingSpaceTab, (e) => sr(e, l)), d = e.split("\n", 1)[0], f = !u.trim(), p = 0;
|
|
1076
1078
|
if (this.options.pedantic ? (p = 2, s = u.trimStart()) : f ? p = l + 1 : (p = u.search(this.rules.other.nonSpaceChar), p = p > 4 ? 1 : p, s = u.slice(p), p += l), f && this.rules.other.blankLine.test(d) && (r += d + "\n", e = e.substring(d.length + 1), n = !0), !n) {
|
|
1077
1079
|
let t = this.rules.other.nextBulletRegex(p), n = this.rules.other.hrRegex(p), i = this.rules.other.fencesBeginRegex(p), a = this.rules.other.headingBeginRegex(p), o = this.rules.other.htmlBeginRegex(p), c = this.rules.other.blockquoteBeginRegex(p);
|
|
1078
1080
|
for (; e;) {
|
|
@@ -1137,7 +1139,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1137
1139
|
html(e) {
|
|
1138
1140
|
let t = this.rules.block.html.exec(e);
|
|
1139
1141
|
if (t) {
|
|
1140
|
-
let e =
|
|
1142
|
+
let e = ar(t[0]);
|
|
1141
1143
|
return {
|
|
1142
1144
|
type: "html",
|
|
1143
1145
|
block: !0,
|
|
@@ -1163,7 +1165,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1163
1165
|
table(e) {
|
|
1164
1166
|
let t = this.rules.block.table.exec(e);
|
|
1165
1167
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
1166
|
-
let n =
|
|
1168
|
+
let n = ir(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 = {
|
|
1167
1169
|
type: "table",
|
|
1168
1170
|
raw: G(t[0], "\n"),
|
|
1169
1171
|
header: [],
|
|
@@ -1178,7 +1180,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1178
1180
|
header: !0,
|
|
1179
1181
|
align: a.align[e]
|
|
1180
1182
|
});
|
|
1181
|
-
for (let e of i) a.rows.push(
|
|
1183
|
+
for (let e of i) a.rows.push(ir(e, a.header.length).map((e, t) => ({
|
|
1182
1184
|
text: e,
|
|
1183
1185
|
tokens: this.lexer.inline(e),
|
|
1184
1186
|
header: !1,
|
|
@@ -1244,14 +1246,14 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1244
1246
|
let t = this.rules.inline.link.exec(e);
|
|
1245
1247
|
if (t) {
|
|
1246
1248
|
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
1247
|
-
if (!this.options.pedantic &&
|
|
1249
|
+
if (!this.options.pedantic && ur(e, t[1], n, this.rules)) return;
|
|
1248
1250
|
let r = t[2].trim();
|
|
1249
1251
|
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(r)) {
|
|
1250
1252
|
if (!this.rules.other.endAngleBracket.test(r)) return;
|
|
1251
1253
|
let e = G(r.slice(0, -1), "\\");
|
|
1252
1254
|
if ((r.length - e.length) % 2 == 0) return;
|
|
1253
1255
|
} else {
|
|
1254
|
-
let e =
|
|
1256
|
+
let e = or(t[2], "()");
|
|
1255
1257
|
if (e === -2) return;
|
|
1256
1258
|
if (e > -1) {
|
|
1257
1259
|
let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
|
|
@@ -1263,7 +1265,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1263
1265
|
let e = this.rules.other.pedanticHrefTitle.exec(i);
|
|
1264
1266
|
e && (i = e[1], a = e[3]);
|
|
1265
1267
|
} else a = t[3] ? t[3].slice(1, -1) : "";
|
|
1266
|
-
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (i = this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? i.slice(1) : i.slice(1, -1)),
|
|
1268
|
+
return i = i.trim(), this.rules.other.startAngleBracket.test(i) && (i = this.options.pedantic && !this.rules.other.endAngleBracket.test(r) ? i.slice(1) : i.slice(1, -1)), cr(t, {
|
|
1267
1269
|
href: i && i.replace(this.rules.inline.anyPunctuation, "$1"),
|
|
1268
1270
|
title: a && a.replace(this.rules.inline.anyPunctuation, "$1")
|
|
1269
1271
|
}, t[0], this.lexer, this.rules);
|
|
@@ -1273,7 +1275,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1273
1275
|
let n;
|
|
1274
1276
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
1275
1277
|
let r = n[0].charAt(0) === "!" ? 2 : 1;
|
|
1276
|
-
if (!this.options.pedantic &&
|
|
1278
|
+
if (!this.options.pedantic && ur(e, n[1], r, this.rules)) return;
|
|
1277
1279
|
let i = t[K((n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "))];
|
|
1278
1280
|
if (!i) {
|
|
1279
1281
|
let e = n[0].charAt(0);
|
|
@@ -1283,7 +1285,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1283
1285
|
text: e
|
|
1284
1286
|
};
|
|
1285
1287
|
}
|
|
1286
|
-
return
|
|
1288
|
+
return cr(n, i, n[0], this.lexer, this.rules);
|
|
1287
1289
|
}
|
|
1288
1290
|
}
|
|
1289
1291
|
emStrong(e, t, n = "") {
|
|
@@ -1416,7 +1418,7 @@ ${d.join("\n")}`), r = r.substring(0, r.length - t.text.length) + s.text;
|
|
|
1416
1418
|
return {
|
|
1417
1419
|
type: "text",
|
|
1418
1420
|
raw: t[0],
|
|
1419
|
-
text: e ? t[0] :
|
|
1421
|
+
text: e ? t[0] : nr(t[0]),
|
|
1420
1422
|
escaped: e
|
|
1421
1423
|
};
|
|
1422
1424
|
}
|
|
@@ -1752,7 +1754,7 @@ ${e}</tr>
|
|
|
1752
1754
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
1753
1755
|
}
|
|
1754
1756
|
link({ href: e, title: t, text: n, tokens: r, autolink: i }) {
|
|
1755
|
-
let a = i ? W(n, !0) : this.parser.parseInline(r), o =
|
|
1757
|
+
let a = i ? W(n, !0) : this.parser.parseInline(r), o = rr(e);
|
|
1756
1758
|
if (o === null) return a;
|
|
1757
1759
|
e = W(o, i);
|
|
1758
1760
|
let s = "<a href=\"" + e + "\"";
|
|
@@ -1760,7 +1762,7 @@ ${e}</tr>
|
|
|
1760
1762
|
}
|
|
1761
1763
|
image({ href: e, title: t, text: n, tokens: r }) {
|
|
1762
1764
|
r && (n = this.parser.parseInline(r, this.parser.textRenderer));
|
|
1763
|
-
let i =
|
|
1765
|
+
let i = rr(e);
|
|
1764
1766
|
if (i === null) return W(n);
|
|
1765
1767
|
e = i;
|
|
1766
1768
|
let a = `<img src="${W(e)}" alt="${W(n)}"`;
|
|
@@ -1769,7 +1771,7 @@ ${e}</tr>
|
|
|
1769
1771
|
text(e) {
|
|
1770
1772
|
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : W(e.text);
|
|
1771
1773
|
}
|
|
1772
|
-
},
|
|
1774
|
+
}, dr = class {
|
|
1773
1775
|
strong({ text: e }) {
|
|
1774
1776
|
return e;
|
|
1775
1777
|
}
|
|
@@ -1805,7 +1807,7 @@ ${e}</tr>
|
|
|
1805
1807
|
renderer;
|
|
1806
1808
|
textRenderer;
|
|
1807
1809
|
constructor(e) {
|
|
1808
|
-
this.options = e || j, this.options.renderer = this.options.renderer || new Y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new
|
|
1810
|
+
this.options = e || j, this.options.renderer = this.options.renderer || new Y(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new dr();
|
|
1809
1811
|
}
|
|
1810
1812
|
static parse(t, n) {
|
|
1811
1813
|
return new e(n).parse(t);
|
|
@@ -1989,13 +1991,13 @@ ${e}</tr>
|
|
|
1989
1991
|
return e ? X.parse : X.parseInline;
|
|
1990
1992
|
}
|
|
1991
1993
|
}, Q = new class {
|
|
1992
|
-
defaults =
|
|
1994
|
+
defaults = Ut();
|
|
1993
1995
|
options = this.setOptions;
|
|
1994
1996
|
parse = this.parseMarkdown(!0);
|
|
1995
1997
|
parseInline = this.parseMarkdown(!1);
|
|
1996
1998
|
Parser = X;
|
|
1997
1999
|
Renderer = Y;
|
|
1998
|
-
TextRenderer =
|
|
2000
|
+
TextRenderer = dr;
|
|
1999
2001
|
Lexer = J;
|
|
2000
2002
|
Tokenizer = q;
|
|
2001
2003
|
Hooks = Z;
|
|
@@ -2168,17 +2170,17 @@ function $(e, t) {
|
|
|
2168
2170
|
return Q.parse(e, t);
|
|
2169
2171
|
}
|
|
2170
2172
|
$.options = $.setOptions = function(e) {
|
|
2171
|
-
return Q.setOptions(e), $.defaults = Q.defaults,
|
|
2172
|
-
}, $.getDefaults =
|
|
2173
|
-
function
|
|
2174
|
-
return Q.use(...e), $.defaults = Q.defaults,
|
|
2173
|
+
return Q.setOptions(e), $.defaults = Q.defaults, Wt($.defaults), $;
|
|
2174
|
+
}, $.getDefaults = Ut, $.defaults = j;
|
|
2175
|
+
function fr(...e) {
|
|
2176
|
+
return Q.use(...e), $.defaults = Q.defaults, Wt($.defaults), $;
|
|
2175
2177
|
}
|
|
2176
|
-
$.use =
|
|
2178
|
+
$.use = fr, $.walkTokens = function(e, t) {
|
|
2177
2179
|
return Q.walkTokens(e, t);
|
|
2178
|
-
}, $.parseInline = Q.parseInline, $.Parser = X, $.parser = X.parse, $.Renderer = Y, $.TextRenderer =
|
|
2180
|
+
}, $.parseInline = Q.parseInline, $.Parser = X, $.parser = X.parse, $.Renderer = Y, $.TextRenderer = dr, $.Lexer = J, $.lexer = J.lex, $.Tokenizer = q, $.Hooks = Z, $.parse = $, $.options, $.setOptions, $.walkTokens, $.parseInline, X.parse, J.lex;
|
|
2179
2181
|
//#endregion
|
|
2180
2182
|
//#region ../../packages/components/src/chat/PkStreamingMarkdown.vue?vue&type=script&setup=true&lang.ts
|
|
2181
|
-
var
|
|
2183
|
+
var pr = ["innerHTML"], mr = 100, hr = /* @__PURE__ */ o({
|
|
2182
2184
|
__name: "PkStreamingMarkdown",
|
|
2183
2185
|
props: {
|
|
2184
2186
|
markdown: { default: "" },
|
|
@@ -2191,23 +2193,24 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2191
2193
|
isDark: {
|
|
2192
2194
|
type: Boolean,
|
|
2193
2195
|
default: !1
|
|
2194
|
-
}
|
|
2196
|
+
},
|
|
2197
|
+
tailLength: { default: void 0 }
|
|
2195
2198
|
},
|
|
2196
|
-
setup(
|
|
2197
|
-
let
|
|
2198
|
-
function
|
|
2199
|
-
return
|
|
2199
|
+
setup(o) {
|
|
2200
|
+
let s = o, { t: f } = te({ useScope: "global" }), p = null;
|
|
2201
|
+
function h() {
|
|
2202
|
+
return p ||= import("beautiful-mermaid"), p;
|
|
2200
2203
|
}
|
|
2201
|
-
let
|
|
2202
|
-
function
|
|
2203
|
-
return
|
|
2204
|
+
let re = null;
|
|
2205
|
+
function ie() {
|
|
2206
|
+
return re ||= import("katex").then((e) => e.default), re;
|
|
2204
2207
|
}
|
|
2205
|
-
let
|
|
2206
|
-
function
|
|
2208
|
+
let ae = /^(\${1,2})(?!\$)((?:\\.|[^\\\n])*?(?:\\.|[^\\\n$]))\1(?=[\s?!.,:\uFF1F\uFF01\u3002\uFF0C\uFF1A]|$)/, se = /^(\${1,2})\n((?:\\[^]|[^\\])+?)\n\1(?:\n|$)/;
|
|
2209
|
+
function ce(e) {
|
|
2207
2210
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
2208
2211
|
}
|
|
2209
|
-
function
|
|
2210
|
-
return `<span class="katex-pending" data-katex="${
|
|
2212
|
+
function _(e, t) {
|
|
2213
|
+
return `<span class="katex-pending" data-katex="${ce(e)}" data-display="${t}"></span>`;
|
|
2211
2214
|
}
|
|
2212
2215
|
$.use({ extensions: [{
|
|
2213
2216
|
name: "inlineKatex",
|
|
@@ -2217,7 +2220,7 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2217
2220
|
if (t !== -1 && (t === 0 || e.charAt(t - 1) === " ")) return t;
|
|
2218
2221
|
},
|
|
2219
2222
|
tokenizer(e) {
|
|
2220
|
-
let t = e.match(
|
|
2223
|
+
let t = e.match(ae);
|
|
2221
2224
|
if (t) return {
|
|
2222
2225
|
type: "inlineKatex",
|
|
2223
2226
|
raw: t[0],
|
|
@@ -2226,13 +2229,13 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2226
2229
|
};
|
|
2227
2230
|
},
|
|
2228
2231
|
renderer(e) {
|
|
2229
|
-
return
|
|
2232
|
+
return _(e.text, e.displayMode);
|
|
2230
2233
|
}
|
|
2231
2234
|
}, {
|
|
2232
2235
|
name: "blockKatex",
|
|
2233
2236
|
level: "block",
|
|
2234
2237
|
tokenizer(e) {
|
|
2235
|
-
let t = e.match(
|
|
2238
|
+
let t = e.match(se);
|
|
2236
2239
|
if (t) return {
|
|
2237
2240
|
type: "blockKatex",
|
|
2238
2241
|
raw: t[0],
|
|
@@ -2241,7 +2244,7 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2241
2244
|
};
|
|
2242
2245
|
},
|
|
2243
2246
|
renderer(e) {
|
|
2244
|
-
return
|
|
2247
|
+
return _(e.text, e.displayMode) + "\n";
|
|
2245
2248
|
}
|
|
2246
2249
|
}] }), $.use({ extensions: [{
|
|
2247
2250
|
name: "thinking",
|
|
@@ -2262,22 +2265,22 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2262
2265
|
return `<div class="thinking-block">${this.parser.parse(e.tokens ?? [])}</div>`;
|
|
2263
2266
|
}
|
|
2264
2267
|
}] });
|
|
2265
|
-
let
|
|
2266
|
-
|
|
2268
|
+
let v = new $.Renderer(), y = (e) => e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">"), le = /^(?:javascript|data|vbscript|file):/i;
|
|
2269
|
+
v.link = function({ href: e, title: t, tokens: r }) {
|
|
2267
2270
|
let i = this.parser.parseInline(r), a = (e ?? "").trim().replace(/[\x00-\x1f]/g, "");
|
|
2268
|
-
if (!a ||
|
|
2269
|
-
let o = t ? ` title="${
|
|
2270
|
-
return `<a href="${
|
|
2271
|
-
},
|
|
2271
|
+
if (!a || le.test(a)) return i;
|
|
2272
|
+
let o = t ? ` title="${y(t)}"` : "", s = n(a) ? "" : " target=\"_blank\" rel=\"noopener noreferrer\"";
|
|
2273
|
+
return `<a href="${y(a)}"${o}${s}>${i}</a>`;
|
|
2274
|
+
}, v.table = function(e) {
|
|
2272
2275
|
return `<div class="table-wrapper">${$.Renderer.prototype.table.call(this, e)}</div>`;
|
|
2273
2276
|
};
|
|
2274
|
-
let
|
|
2275
|
-
|
|
2276
|
-
function
|
|
2277
|
+
let ue = /^(sequenceDiagram|graph|classDiagram|stateDiagram|erDiagram|flowchart|xychart-beta)/;
|
|
2278
|
+
v.code = ({ text: e }) => ue.test(e) ? `<pre class="mermaid">${e}</pre>` : `<pre><code>${e}</code></pre>`;
|
|
2279
|
+
function fe(e) {
|
|
2277
2280
|
return e.replace(/\\\[([\s\S]*?)\\\]/g, (e, t) => `$$${t}$$`).replace(/\\\(([\s\S]*?)\\\)/g, (e, t) => `$${t}$`).replace(/^(\d+)\.(?!\s)/gm, "$1\\.");
|
|
2278
2281
|
}
|
|
2279
|
-
function
|
|
2280
|
-
let t = /* @__PURE__ */ new Set(), n = /^(`{3,})[^\n]*\n([\s\S]*?)\n\1/gm, r;
|
|
2282
|
+
function pe(e) {
|
|
2283
|
+
let t = /* @__PURE__ */ new Set(), n = /^(`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n\1/gm, r;
|
|
2281
2284
|
for (; (r = n.exec(e)) !== null;) for (let e = r.index; e < r.index + r[0].length; e++) t.add(e);
|
|
2282
2285
|
return e.replace(/[{[]([\s\S]*?)[}\]]/g, (e, n, r) => {
|
|
2283
2286
|
if (t.has(r)) return e;
|
|
@@ -2288,25 +2291,25 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2288
2291
|
}
|
|
2289
2292
|
}).replace(/\n{3,}/g, "\n\n");
|
|
2290
2293
|
}
|
|
2291
|
-
let
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
],
|
|
2297
|
-
let e =
|
|
2294
|
+
let me = [
|
|
2295
|
+
oe,
|
|
2296
|
+
pe,
|
|
2297
|
+
Ht,
|
|
2298
|
+
fe
|
|
2299
|
+
], b = ee("container"), he = ne(m(s, "markdown"), mr), ge = i(() => s.tailLength ? r(he.value, s.tailLength) : he.value), { resolveText: _e } = de(), ve = _e(ge), x = i(() => {
|
|
2300
|
+
let e = me.reduce((e, t) => t(e), ve.value);
|
|
2298
2301
|
return $.parse(e, {
|
|
2299
2302
|
async: !1,
|
|
2300
2303
|
breaks: !0,
|
|
2301
|
-
renderer:
|
|
2304
|
+
renderer: v
|
|
2302
2305
|
});
|
|
2303
2306
|
});
|
|
2304
|
-
async function
|
|
2305
|
-
if (
|
|
2306
|
-
await
|
|
2307
|
-
let e =
|
|
2307
|
+
async function ye() {
|
|
2308
|
+
if (s.loading) return;
|
|
2309
|
+
await c();
|
|
2310
|
+
let e = b.value?.querySelectorAll("pre.mermaid:not([data-rendered])");
|
|
2308
2311
|
if (!e?.length) return;
|
|
2309
|
-
let { renderMermaidSVG: t, THEMES: n } = await
|
|
2312
|
+
let { renderMermaidSVG: t, THEMES: n } = await h(), r = s.isDark ? n["github-dark"] : n["github-light"];
|
|
2310
2313
|
for (let n of Array.from(e)) {
|
|
2311
2314
|
if (!n.isConnected) continue;
|
|
2312
2315
|
let e = n.textContent?.trim();
|
|
@@ -2316,19 +2319,19 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2316
2319
|
} catch {}
|
|
2317
2320
|
}
|
|
2318
2321
|
}
|
|
2319
|
-
async function
|
|
2320
|
-
await
|
|
2321
|
-
let e =
|
|
2322
|
+
async function be() {
|
|
2323
|
+
await c();
|
|
2324
|
+
let e = b.value?.querySelectorAll("pre:not(.mermaid) > code:not([data-highlighted])");
|
|
2322
2325
|
if (!e?.length) return;
|
|
2323
2326
|
let t = (await import("highlight.js/lib/common")).default;
|
|
2324
2327
|
for (let n of e) t.highlightElement(n), n.setAttribute("data-highlighted", "true");
|
|
2325
2328
|
}
|
|
2326
|
-
async function
|
|
2327
|
-
await
|
|
2328
|
-
let n =
|
|
2329
|
+
async function S() {
|
|
2330
|
+
await c();
|
|
2331
|
+
let n = b.value?.querySelectorAll(".katex-pending");
|
|
2329
2332
|
if (!n?.length) return;
|
|
2330
|
-
let r = await
|
|
2331
|
-
e("https://cdn.jsdelivr.net/npm/katex@0.18/dist/katex.min.css", t(
|
|
2333
|
+
let r = await ie();
|
|
2334
|
+
e("https://cdn.jsdelivr.net/npm/katex@0.18/dist/katex.min.css", t(b.value));
|
|
2332
2335
|
for (let e of Array.from(n)) {
|
|
2333
2336
|
if (!e.isConnected) continue;
|
|
2334
2337
|
let t = e.dataset.katex;
|
|
@@ -2342,11 +2345,11 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2342
2345
|
} catch {}
|
|
2343
2346
|
}
|
|
2344
2347
|
}
|
|
2345
|
-
async function
|
|
2346
|
-
await
|
|
2347
|
-
let e =
|
|
2348
|
+
async function xe() {
|
|
2349
|
+
await c();
|
|
2350
|
+
let e = b.value?.querySelectorAll("pre.mermaid[data-rendered]");
|
|
2348
2351
|
if (!e?.length) return;
|
|
2349
|
-
let { renderMermaidSVG: t, THEMES: n } = await
|
|
2352
|
+
let { renderMermaidSVG: t, THEMES: n } = await h(), r = s.isDark ? n["github-dark"] : n["github-light"];
|
|
2350
2353
|
for (let n of Array.from(e)) {
|
|
2351
2354
|
if (!n.isConnected) continue;
|
|
2352
2355
|
let e = n.dataset.code;
|
|
@@ -2355,73 +2358,73 @@ var ur = ["innerHTML"], dr = /* @__PURE__ */ a({
|
|
|
2355
2358
|
} catch {}
|
|
2356
2359
|
}
|
|
2357
2360
|
}
|
|
2358
|
-
function
|
|
2361
|
+
function Se(e) {
|
|
2359
2362
|
let t = e.target;
|
|
2360
2363
|
if (!(t instanceof HTMLImageElement) || t.dataset.broken) return;
|
|
2361
2364
|
t.dataset.broken = "true";
|
|
2362
2365
|
let n = document.createElement("span");
|
|
2363
|
-
n.className = "markdown-broken-image", n.textContent = t.alt ||
|
|
2364
|
-
}
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
}),
|
|
2368
|
-
|
|
2369
|
-
}),
|
|
2370
|
-
let
|
|
2371
|
-
function
|
|
2366
|
+
n.className = "markdown-broken-image", n.textContent = t.alt || f("label.imageLoadError"), n.title = t.src, t.replaceWith(n);
|
|
2367
|
+
}
|
|
2368
|
+
u(() => {
|
|
2369
|
+
b.value?.addEventListener("error", Se, !0);
|
|
2370
|
+
}), l(() => {
|
|
2371
|
+
b.value?.removeEventListener("error", Se, !0);
|
|
2372
|
+
}), g([x, () => s.loading], ye, { immediate: !0 }), g(() => s.isDark, xe), g(x, be, { immediate: !0 }), g(x, S, { immediate: !0 });
|
|
2373
|
+
let C = 0;
|
|
2374
|
+
function Ce(e, t) {
|
|
2372
2375
|
let n = document.createElement("span");
|
|
2373
|
-
return n.style.cssText = `animation:ft-${
|
|
2376
|
+
return n.style.cssText = `animation:ft-${s.animation} ${s.animationDuration} ease-out ${t}ms both;display:inline-block`, n.textContent = e, n.addEventListener("animationend", () => {
|
|
2374
2377
|
let t = n.parentNode;
|
|
2375
2378
|
t && (t.replaceChild(document.createTextNode(e), n), t.normalize());
|
|
2376
2379
|
}, { once: !0 }), n;
|
|
2377
2380
|
}
|
|
2378
|
-
function
|
|
2381
|
+
function w(e, t, n, r) {
|
|
2379
2382
|
let i = r, a = e.split(/(\s+)/);
|
|
2380
2383
|
for (let e of a) if (e) {
|
|
2381
2384
|
if (/^\s+$/.test(e)) {
|
|
2382
2385
|
t.insertBefore(document.createTextNode(e), n);
|
|
2383
2386
|
continue;
|
|
2384
2387
|
}
|
|
2385
|
-
t.insertBefore(
|
|
2388
|
+
t.insertBefore(Ce(e, i * 30), n), i++;
|
|
2386
2389
|
}
|
|
2387
2390
|
return i;
|
|
2388
2391
|
}
|
|
2389
|
-
function
|
|
2392
|
+
function we(e) {
|
|
2390
2393
|
let t = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode(e) {
|
|
2391
2394
|
return e.parentElement?.closest("pre, code, .katex-pending, .markdown-broken-image") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
|
|
2392
2395
|
} }), n = [];
|
|
2393
2396
|
for (; t.nextNode();) n.push(t.currentNode);
|
|
2394
2397
|
return n;
|
|
2395
2398
|
}
|
|
2396
|
-
function
|
|
2397
|
-
if (!
|
|
2398
|
-
let e =
|
|
2399
|
+
function Te() {
|
|
2400
|
+
if (!b.value || !s.loading || !s.animation) return;
|
|
2401
|
+
let e = we(b.value), t = 0, n = 0;
|
|
2399
2402
|
for (let r of e) {
|
|
2400
2403
|
let e = r.textContent || "", i = t, a = t + e.length;
|
|
2401
|
-
if (t = a, a <=
|
|
2404
|
+
if (t = a, a <= C) continue;
|
|
2402
2405
|
let o = r.parentNode;
|
|
2403
2406
|
if (!o) continue;
|
|
2404
|
-
if (i >=
|
|
2407
|
+
if (i >= C) {
|
|
2405
2408
|
let t = r.nextSibling;
|
|
2406
|
-
o.removeChild(r), n =
|
|
2409
|
+
o.removeChild(r), n = w(e, o, t, n);
|
|
2407
2410
|
continue;
|
|
2408
2411
|
}
|
|
2409
|
-
let s =
|
|
2410
|
-
o.removeChild(c), n =
|
|
2412
|
+
let s = C - i, c = r.splitText(s), l = c.textContent || "", u = c.nextSibling;
|
|
2413
|
+
o.removeChild(c), n = w(l, o, u, n);
|
|
2411
2414
|
}
|
|
2412
|
-
|
|
2415
|
+
C = t;
|
|
2413
2416
|
}
|
|
2414
|
-
return
|
|
2415
|
-
await
|
|
2416
|
-
}, { immediate: !0 }),
|
|
2417
|
-
(!e || t && e.length < t.length) && (
|
|
2418
|
-
}), (e, t) => (
|
|
2417
|
+
return g(x, async () => {
|
|
2418
|
+
await c(), Te();
|
|
2419
|
+
}, { immediate: !0 }), g(() => s.markdown, (e, t) => {
|
|
2420
|
+
(!e || t && e.length < t.length) && (C = 0);
|
|
2421
|
+
}), (e, t) => (d(), a("div", {
|
|
2419
2422
|
ref: "container",
|
|
2420
|
-
innerHTML:
|
|
2421
|
-
}, null, 8,
|
|
2423
|
+
innerHTML: x.value
|
|
2424
|
+
}, null, 8, pr));
|
|
2422
2425
|
}
|
|
2423
2426
|
});
|
|
2424
2427
|
//#endregion
|
|
2425
|
-
export {
|
|
2428
|
+
export { le as n, de as r, hr as t };
|
|
2426
2429
|
|
|
2427
|
-
//# sourceMappingURL=PkStreamingMarkdown-
|
|
2430
|
+
//# sourceMappingURL=PkStreamingMarkdown-D0IOaETI.js.map
|