markdown-flow-ui 0.2.30 → 0.2.32
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/README.md +27 -4
- package/dist/_virtual/index.es3.js +5 -4
- package/dist/_virtual/index.es3.js.map +1 -1
- package/dist/_virtual/index.es4.js +4 -5
- package/dist/_virtual/index.es4.js.map +1 -1
- package/dist/_virtual/index.es5.js +5 -3
- package/dist/_virtual/index.es5.js.map +1 -1
- package/dist/_virtual/index.es6.js +3 -5
- package/dist/_virtual/index.es6.js.map +1 -1
- package/dist/_virtual/index.es7.js +4 -4
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/_virtual/index3.cjs +1 -1
- package/dist/_virtual/index4.cjs +1 -1
- package/dist/_virtual/index5.cjs +1 -1
- package/dist/_virtual/index6.cjs +1 -1
- package/dist/_virtual/index7.cjs +1 -1
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/components/ContentRender/ContentRender.cjs +2 -2
- package/dist/components/ContentRender/ContentRender.cjs.map +1 -1
- package/dist/components/ContentRender/ContentRender.d.ts +1 -1
- package/dist/components/ContentRender/ContentRender.es.js +623 -401
- package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
- package/dist/components/ContentRender/index.cjs +1 -1
- package/dist/components/ContentRender/index.es.js +1 -0
- package/dist/components/ContentRender/index.es.js.map +1 -1
- package/dist/components/ContentRender/utils/escape-typed-metadata.cjs +2 -0
- package/dist/components/ContentRender/utils/escape-typed-metadata.cjs.map +1 -0
- package/dist/components/ContentRender/utils/escape-typed-metadata.d.ts +9 -0
- package/dist/components/ContentRender/utils/escape-typed-metadata.es.js +47 -0
- package/dist/components/ContentRender/utils/escape-typed-metadata.es.js.map +1 -0
- package/dist/components/ContentRender/utils/escape-typed-metadata.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/html-block-end.cjs +1 -1
- package/dist/components/ContentRender/utils/html-block-end.cjs.map +1 -1
- package/dist/components/ContentRender/utils/html-block-end.d.ts +20 -6
- package/dist/components/ContentRender/utils/html-block-end.es.js +63 -56
- package/dist/components/ContentRender/utils/html-block-end.es.js.map +1 -1
- package/dist/components/ContentRender/utils/inline-code-ranges.cache.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/inline-code-ranges.cjs +10 -0
- package/dist/components/ContentRender/utils/inline-code-ranges.cjs.map +1 -0
- package/dist/components/ContentRender/utils/inline-code-ranges.d.ts +39 -0
- package/dist/components/ContentRender/utils/inline-code-ranges.es.js +336 -0
- package/dist/components/ContentRender/utils/inline-code-ranges.es.js.map +1 -0
- package/dist/components/ContentRender/utils/inline-code-ranges.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/markdown-plugins.cjs +2 -0
- package/dist/components/ContentRender/utils/markdown-plugins.cjs.map +1 -0
- package/dist/components/ContentRender/utils/markdown-plugins.d.ts +2 -0
- package/dist/components/ContentRender/utils/markdown-plugins.es.js +14 -0
- package/dist/components/ContentRender/utils/markdown-plugins.es.js.map +1 -0
- package/dist/components/ContentRender/utils/mermaid-parse.cjs +4 -3
- package/dist/components/ContentRender/utils/mermaid-parse.cjs.map +1 -1
- package/dist/components/ContentRender/utils/mermaid-parse.es.js +86 -67
- package/dist/components/ContentRender/utils/mermaid-parse.es.js.map +1 -1
- package/dist/components/ContentRender/utils/mermaid-parse.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/normalize-inline-html.cjs +4 -2
- package/dist/components/ContentRender/utils/normalize-inline-html.cjs.map +1 -1
- package/dist/components/ContentRender/utils/normalize-inline-html.d.ts +4 -1
- package/dist/components/ContentRender/utils/normalize-inline-html.es.js +15 -7
- package/dist/components/ContentRender/utils/normalize-inline-html.es.js.map +1 -1
- package/dist/components/ContentRender/utils/normalize-inline-html.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/resumed-prose-fence.cjs +5 -0
- package/dist/components/ContentRender/utils/resumed-prose-fence.cjs.map +1 -0
- package/dist/components/ContentRender/utils/resumed-prose-fence.d.ts +5 -0
- package/dist/components/ContentRender/utils/resumed-prose-fence.es.js +60 -0
- package/dist/components/ContentRender/utils/resumed-prose-fence.es.js.map +1 -0
- package/dist/components/ContentRender/utils/split-content.cjs +6 -3
- package/dist/components/ContentRender/utils/split-content.cjs.map +1 -1
- package/dist/components/ContentRender/utils/split-content.d.ts +7 -1
- package/dist/components/ContentRender/utils/split-content.es.js +460 -216
- package/dist/components/ContentRender/utils/split-content.es.js.map +1 -1
- package/dist/components/ContentRender/utils/split-content.image-alt.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/split-content.resumed-fences.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/video-markdown-run.cjs +14 -0
- package/dist/components/ContentRender/utils/video-markdown-run.cjs.map +1 -0
- package/dist/components/ContentRender/utils/video-markdown-run.d.ts +47 -0
- package/dist/components/ContentRender/utils/video-markdown-run.es.js +468 -0
- package/dist/components/ContentRender/utils/video-markdown-run.es.js.map +1 -0
- package/dist/components/ContentRender/utils/video-markdown-run.test.d.ts +1 -0
- package/dist/components/ContentRender/utils/wrapped-content.test.d.ts +1 -0
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.cjs.map +1 -1
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js +9 -8
- package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs +1 -1
- package/dist/components/Slide/Slide.cjs.map +1 -1
- package/dist/components/Slide/Slide.es.js +3 -2
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/ui/inputGroup/textarea.cjs +1 -1
- package/dist/components/ui/inputGroup/textarea.es.js +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/classnames/index.cjs +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAMF2YG6.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAMF2YG6.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-OMD6QJNC.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-OMD6QJNC.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U37J5Y7L.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-U37J5Y7L.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-WV7ZQ7D5.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-WV7ZQ7D5.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-4MX5Z3NR.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-4MX5Z3NR.es.js +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.cjs +1 -1
- package/dist/node_modules/rc-input/es/BaseInput.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/TextArea.es.js +1 -1
- package/dist/node_modules/rc-textarea/es/index.cjs +1 -1
- package/dist/node_modules/rc-textarea/es/index.es.js +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.cjs +1 -1
- package/dist/node_modules/remark-flow/dist/interaction-plugin-core.es.js +1 -1
- package/dist/node_modules/unified/lib/index.cjs +1 -1
- package/dist/node_modules/unified/lib/index.es.js +1 -1
- package/package.json +6 -1
|
@@ -1,438 +1,636 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { stripSvgTextLineBreaks as Ue } from "./utils/strip-svg-text-line-breaks.es.js";
|
|
1
|
+
import { jsx as r, jsxs as ze, Fragment as ut } from "react/jsx-runtime";
|
|
2
|
+
import Z, { useMemo as f, useState as Fe, useRef as b, useEffect as te } from "react";
|
|
3
|
+
import { sanitizeInvalidTagName as lt } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
4
|
+
import { stripSvgTextLineBreaks as dt } from "./utils/strip-svg-text-line-breaks.es.js";
|
|
6
5
|
/* empty css */
|
|
7
6
|
/* empty css */
|
|
8
7
|
/* empty css */
|
|
9
8
|
/* empty css */
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { preserveCustomVariableProperties as
|
|
14
|
-
import { subsetLanguages as
|
|
15
|
-
import { parseMarkdownSegments as
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
9
|
+
import mt, { CodeBlockContext as pt } from "./CodeBlock.es.js";
|
|
10
|
+
import ft from "./plugins/CustomVariable.es.js";
|
|
11
|
+
import Ce from "./plugins/MermaidChart.es.js";
|
|
12
|
+
import { preserveCustomVariableProperties as ht, restoreCustomVariableProperties as gt } from "./utils/custom-variable-props.es.js";
|
|
13
|
+
import { subsetLanguages as vt, highlightLanguages as xt } from "./utils/highlight-languages.es.js";
|
|
14
|
+
import { parseMarkdownSegments as Ge, mermaidBlockIsComplete as yt } from "./utils/mermaid-parse.es.js";
|
|
15
|
+
import { getMarkdownSourceAnalysis as wt, getInlineCodeRanges as Ct } from "./utils/inline-code-ranges.es.js";
|
|
16
|
+
import { remarkPlugins as Qe } from "./utils/markdown-plugins.es.js";
|
|
17
|
+
import { normalizeInlineHtml as ye } from "./utils/normalize-inline-html.es.js";
|
|
18
|
+
import { escapeTypedMarkdownMetadata as ke } from "./utils/escape-typed-metadata.es.js";
|
|
19
|
+
import kt from "./IframeSandbox.es.js";
|
|
20
|
+
import { getTrailingTypewriterGrapheme as we, appendContentAwareTypewriterQueue as _e, consumeContentAwareTypewriterQueue as Tt, CONTENT_AWARE_TYPEWRITER_TICK_BUDGET as bt, isContentAwareTypewriterQueueEmpty as St } from "./utils/typewriter-pacing.es.js";
|
|
21
|
+
import { normalizeWrappedSandboxContent as Rt, splitContentSegments as Bt } from "./utils/split-content.es.js";
|
|
22
|
+
import { getInteractionDefaultValues as Nt } from "../../lib/interaction-defaults.es.js";
|
|
23
|
+
import { getMarkdownFlowDirection as Lt, getMarkdownFlowLanguage as Mt } from "../../lib/locale.es.js";
|
|
24
|
+
import { getContentRenderLocaleTexts as be } from "./contentRenderI18n.es.js";
|
|
25
|
+
import { createVideoMarkdownRunPlan as At, cloneVideoMarkdownSourceTree as Vt, prepareVideoMarkdownRun as $t, projectVideoMarkdownRun as Et, getVideoMarkdownNodeState as It } from "./utils/video-markdown-run.es.js";
|
|
26
|
+
import { unified as je } from "../../node_modules/unified/lib/index.es.js";
|
|
27
|
+
import Pt from "../../node_modules/remark-rehype/lib/index.es.js";
|
|
28
|
+
import Dt from "../../node_modules/rehype-raw/lib/index.es.js";
|
|
29
|
+
import Wt from "../../node_modules/rehype-highlight/lib/index.es.js";
|
|
30
|
+
import zt from "../../node_modules/rehype-katex/lib/index.es.js";
|
|
31
|
+
import { Markdown as Oe } from "../../node_modules/react-markdown/lib/index.es.js";
|
|
32
|
+
const Ft = 2, Te = ({
|
|
33
|
+
svg: t,
|
|
34
|
+
inline: o = !1
|
|
35
|
+
}) => {
|
|
36
|
+
const s = b(null), a = o ? "span" : "div";
|
|
37
|
+
return te(() => {
|
|
38
|
+
const i = s.current;
|
|
39
|
+
if (!i) return;
|
|
40
|
+
const l = i.shadowRoot ?? i.attachShadow({ mode: "open" }), x = "content-render-svg-style";
|
|
41
|
+
let g = l.getElementById(x);
|
|
42
|
+
g || (g = document.createElement("style"), g.id = x, g.textContent = `
|
|
38
43
|
svg { height: auto; display: inline-block; }
|
|
39
44
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
40
45
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
41
|
-
`,
|
|
42
|
-
(
|
|
43
|
-
).forEach((
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
let
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const [, ,
|
|
53
|
-
if (!
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
},
|
|
57
|
-
if (!
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
46
|
+
`, l.appendChild(g)), Array.from(l.childNodes).filter(
|
|
47
|
+
(u) => u !== g
|
|
48
|
+
).forEach((u) => l.removeChild(u));
|
|
49
|
+
const y = document.createElement("template"), S = dt(t);
|
|
50
|
+
y.innerHTML = S, l.append(y.content.cloneNode(!0));
|
|
51
|
+
let R = !1, T = !1;
|
|
52
|
+
l.querySelectorAll("svg").forEach((u) => {
|
|
53
|
+
const P = u.getAttribute("viewBox");
|
|
54
|
+
if (!P) return;
|
|
55
|
+
const D = P.trim().split(/[\s,]+/).map((L) => Number(L));
|
|
56
|
+
if (D.length !== 4 || D.some(Number.isNaN)) return;
|
|
57
|
+
const [, , W, C] = D, U = u.getAttribute("width"), z = u.getAttribute("height"), K = (L) => {
|
|
58
|
+
if (!L) return !1;
|
|
59
|
+
const M = L.trim().toLowerCase();
|
|
60
|
+
return M === "auto" || M.endsWith("%");
|
|
61
|
+
}, ne = (L) => {
|
|
62
|
+
if (!L) return null;
|
|
63
|
+
const M = L.trim().toLowerCase();
|
|
64
|
+
if (M === "auto" || M.endsWith("%"))
|
|
60
65
|
return null;
|
|
61
|
-
const
|
|
62
|
-
return Number.isNaN(
|
|
63
|
-
},
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
+
const q = Number.parseFloat(M);
|
|
67
|
+
return Number.isNaN(q) ? null : q;
|
|
68
|
+
}, ue = K(U), le = K(z), re = !U || U === "0", oe = !z || z === "0", de = ne(U), se = ne(z);
|
|
69
|
+
if (ue || le || re && oe || de === W && se === C) {
|
|
70
|
+
R = !0, u.classList.add("content-render-svg-el--responsive"), u.classList.remove("content-render-svg-el--fixed"), u.style.width = "100%", u.style.height = "auto", !u.style.aspectRatio && C > 0 && (u.style.aspectRatio = `${W} / ${C}`);
|
|
66
71
|
return;
|
|
67
72
|
}
|
|
68
|
-
|
|
73
|
+
T = !0, u.classList.add("content-render-svg-el--fixed"), u.classList.remove("content-render-svg-el--responsive"), re && W > 0 && u.setAttribute("width", `${W}`), oe && C > 0 && u.setAttribute("height", `${C}`);
|
|
69
74
|
});
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
}, [t]), /* @__PURE__ */
|
|
73
|
-
|
|
75
|
+
const p = R && !T;
|
|
76
|
+
i.classList.toggle("content-render-svg--responsive", p), i.classList.toggle("content-render-svg--fixed", !p);
|
|
77
|
+
}, [t]), /* @__PURE__ */ r(a, { className: "content-render-svg-scroll", children: /* @__PURE__ */ r(
|
|
78
|
+
a,
|
|
79
|
+
{
|
|
80
|
+
className: "content-render-svg",
|
|
81
|
+
ref: (i) => {
|
|
82
|
+
s.current = i;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
) });
|
|
86
|
+
}, ie = Z.createContext(
|
|
74
87
|
null
|
|
75
|
-
),
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
88
|
+
), Ue = (t) => {
|
|
89
|
+
const { receivedTree: o, ...s } = t, a = Z.useContext(ie), i = Z.useContext(pt);
|
|
90
|
+
if (!a)
|
|
78
91
|
throw new Error("Markdown code renderer requires ContentRender context.");
|
|
79
|
-
const { className:
|
|
80
|
-
if (/language-(\w+)/.exec(
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
92
|
+
const { className: l, children: x, ...g } = s;
|
|
93
|
+
if (/language-(\w+)/.exec(l || "")?.[1] === "mermaid") {
|
|
94
|
+
const S = x?.toString().replace(/\n$/, "") || "", R = yt(
|
|
95
|
+
a.current.renderContent,
|
|
96
|
+
S
|
|
84
97
|
);
|
|
85
|
-
return /* @__PURE__ */
|
|
86
|
-
|
|
98
|
+
return /* @__PURE__ */ r(
|
|
99
|
+
Ce,
|
|
87
100
|
{
|
|
88
|
-
chart:
|
|
89
|
-
frozen:
|
|
90
|
-
messages:
|
|
101
|
+
chart: S,
|
|
102
|
+
frozen: o ? !R : R,
|
|
103
|
+
messages: a.current.mermaidMessages
|
|
91
104
|
}
|
|
92
105
|
);
|
|
93
106
|
}
|
|
94
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ r(
|
|
95
108
|
"code",
|
|
96
109
|
{
|
|
97
|
-
className:
|
|
98
|
-
...
|
|
99
|
-
dir:
|
|
100
|
-
children:
|
|
110
|
+
className: l,
|
|
111
|
+
...g,
|
|
112
|
+
dir: g.dir ?? (i ? void 0 : "ltr"),
|
|
113
|
+
children: x
|
|
101
114
|
}
|
|
102
115
|
);
|
|
103
|
-
},
|
|
116
|
+
}, Ke = [
|
|
104
117
|
ht,
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
Dt,
|
|
119
|
+
lt,
|
|
107
120
|
gt
|
|
108
|
-
],
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
lt,
|
|
121
|
+
], Ye = [
|
|
122
|
+
[Wt, { languages: xt, subset: vt }],
|
|
123
|
+
zt
|
|
124
|
+
], Gt = [
|
|
125
|
+
...Ke,
|
|
126
|
+
...Ye
|
|
127
|
+
], He = ({ content: t, components: o, locale: s }) => {
|
|
128
|
+
const a = be(s);
|
|
129
|
+
return /* @__PURE__ */ r("div", { className: "markdown-renderer", children: /* @__PURE__ */ r(
|
|
130
|
+
Oe,
|
|
119
131
|
{
|
|
120
|
-
remarkPlugins:
|
|
121
|
-
rehypePlugins:
|
|
132
|
+
remarkPlugins: Qe,
|
|
133
|
+
rehypePlugins: Gt,
|
|
122
134
|
remarkRehypeOptions: {
|
|
123
135
|
footnoteLabel: a.footnoteLabel,
|
|
124
|
-
footnoteBackLabel: (
|
|
125
|
-
const
|
|
126
|
-
return a.footnoteBackLabel.replace("{reference}",
|
|
136
|
+
footnoteBackLabel: (i, l) => {
|
|
137
|
+
const x = String(i + 1) + (l > 1 ? `-${l}` : "");
|
|
138
|
+
return a.footnoteBackLabel.replace("{reference}", x);
|
|
127
139
|
}
|
|
128
140
|
},
|
|
129
|
-
components:
|
|
141
|
+
components: o,
|
|
130
142
|
children: t
|
|
131
143
|
}
|
|
132
144
|
) });
|
|
133
|
-
},
|
|
145
|
+
}, _t = function() {
|
|
146
|
+
this.parser = () => ({ type: "root", children: [] });
|
|
147
|
+
}, jt = ({ plan: t, renderedSegments: o, components: s, locale: a }) => {
|
|
148
|
+
const i = f(() => {
|
|
149
|
+
const S = be(a), R = je().use(Qe).use(Pt, {
|
|
150
|
+
allowDangerousHtml: !0,
|
|
151
|
+
footnoteLabel: S.footnoteLabel,
|
|
152
|
+
footnoteBackLabel: (u, P) => S.footnoteBackLabel.replace(
|
|
153
|
+
"{reference}",
|
|
154
|
+
String(u + 1) + (P > 1 ? `-${P}` : "")
|
|
155
|
+
)
|
|
156
|
+
}).use(Ke), T = je().use(Ye), p = R.runSync(
|
|
157
|
+
Vt(t),
|
|
158
|
+
t.markdownSource
|
|
159
|
+
);
|
|
160
|
+
return $t(
|
|
161
|
+
t,
|
|
162
|
+
p,
|
|
163
|
+
(u) => T.runSync(u, t.fullSource)
|
|
164
|
+
);
|
|
165
|
+
}, [t, a]), l = f(
|
|
166
|
+
() => Et(i, o),
|
|
167
|
+
[i, o]
|
|
168
|
+
), x = b(s);
|
|
169
|
+
x.current = s;
|
|
170
|
+
const g = b(
|
|
171
|
+
/* @__PURE__ */ new Map()
|
|
172
|
+
), ee = f(() => {
|
|
173
|
+
const S = /* @__PURE__ */ new Set(), R = (p) => {
|
|
174
|
+
p.type === "element" && S.add(p.tagName), "children" in p && p.children.forEach(R);
|
|
175
|
+
};
|
|
176
|
+
R(i.tree);
|
|
177
|
+
const T = {};
|
|
178
|
+
for (const p of S) {
|
|
179
|
+
if (!g.current.has(p)) {
|
|
180
|
+
const u = ({
|
|
181
|
+
node: P,
|
|
182
|
+
children: D,
|
|
183
|
+
...W
|
|
184
|
+
}) => {
|
|
185
|
+
const C = It(P);
|
|
186
|
+
if (C?.svg)
|
|
187
|
+
return C.svgSource ? /* @__PURE__ */ r(Te, { svg: C.svgSource, inline: !0 }) : null;
|
|
188
|
+
if (C?.atomic)
|
|
189
|
+
return C.active ? /* @__PURE__ */ r(ut, { children: D }) : null;
|
|
190
|
+
if (C?.active === !1 && p !== "a") return null;
|
|
191
|
+
const z = x.current[p], K = C?.active === !1 ? { ...W, href: void 0, tabIndex: -1 } : W;
|
|
192
|
+
return z ? Z.createElement(
|
|
193
|
+
z,
|
|
194
|
+
{
|
|
195
|
+
...K,
|
|
196
|
+
node: P,
|
|
197
|
+
...z === Ue ? { receivedTree: !0 } : {}
|
|
198
|
+
},
|
|
199
|
+
D
|
|
200
|
+
) : Z.createElement(p, K, D);
|
|
201
|
+
};
|
|
202
|
+
u.displayName = `StableMarkdown(${p})`, g.current.set(p, u);
|
|
203
|
+
}
|
|
204
|
+
T[p] = g.current.get(p);
|
|
205
|
+
}
|
|
206
|
+
return T;
|
|
207
|
+
}, [i]), y = f(
|
|
208
|
+
() => [() => () => l],
|
|
209
|
+
[l]
|
|
210
|
+
);
|
|
211
|
+
return /* @__PURE__ */ r("div", { className: "markdown-renderer", children: /* @__PURE__ */ r(
|
|
212
|
+
Oe,
|
|
213
|
+
{
|
|
214
|
+
remarkPlugins: [_t],
|
|
215
|
+
rehypePlugins: y,
|
|
216
|
+
components: ee,
|
|
217
|
+
children: ""
|
|
218
|
+
}
|
|
219
|
+
) });
|
|
220
|
+
}, H = (t) => t.type === "markdown" && t.immediate === !0, Ht = (t) => {
|
|
134
221
|
if (t.length <= 1) return t;
|
|
135
|
-
const
|
|
136
|
-
return t.forEach((
|
|
137
|
-
if (
|
|
138
|
-
|
|
222
|
+
const o = [];
|
|
223
|
+
return t.forEach((s) => {
|
|
224
|
+
if (s.type === "sandbox" || H(s)) {
|
|
225
|
+
o.push(s);
|
|
139
226
|
return;
|
|
140
227
|
}
|
|
141
|
-
const a =
|
|
142
|
-
if (a && a.type !== "sandbox") {
|
|
143
|
-
|
|
228
|
+
const a = o[o.length - 1];
|
|
229
|
+
if (a && a.type !== "sandbox" && !H(a)) {
|
|
230
|
+
o[o.length - 1] = {
|
|
144
231
|
type: "markdown",
|
|
145
|
-
value: `${a.value}${
|
|
232
|
+
value: `${a.value}${s.value}`
|
|
146
233
|
};
|
|
147
234
|
return;
|
|
148
235
|
}
|
|
149
|
-
|
|
150
|
-
}),
|
|
151
|
-
},
|
|
152
|
-
|
|
236
|
+
o.push({ type: "markdown", value: s.value });
|
|
237
|
+
}), o;
|
|
238
|
+
}, qt = (t, o, s) => {
|
|
239
|
+
if (t.length >= o.length) return t;
|
|
240
|
+
const a = s.find(
|
|
241
|
+
({ start: x, end: g }) => x < t.length && t.length < g
|
|
242
|
+
);
|
|
243
|
+
if (!a) return t;
|
|
244
|
+
const i = /^`+/.exec(o.slice(a.start))?.[0];
|
|
245
|
+
if (!i || t.length < a.start + i.length)
|
|
246
|
+
return t;
|
|
247
|
+
const l = a.end - i.length;
|
|
248
|
+
return t.length > l ? t + i.slice(t.length - l) : t + (t.endsWith("`") ? " " : "") + i;
|
|
249
|
+
}, qe = (t, o, s, a, i = 0) => {
|
|
250
|
+
const l = qt(t, o, s);
|
|
251
|
+
return ke(t, a, i) + l.slice(t.length);
|
|
252
|
+
}, Qt = (t, o) => {
|
|
253
|
+
const s = Math.max(1, o), a = Array.from(t);
|
|
153
254
|
return {
|
|
154
|
-
chunk: a.slice(0,
|
|
155
|
-
rest: a.slice(
|
|
255
|
+
chunk: a.slice(0, s).join(""),
|
|
256
|
+
rest: a.slice(s).join("")
|
|
156
257
|
};
|
|
157
|
-
},
|
|
158
|
-
const
|
|
159
|
-
return
|
|
160
|
-
},
|
|
258
|
+
}, Ot = (t, o) => t === o ? !0 : !t || !o || t.length !== o.length ? !1 : t.every((s, a) => s === o[a]), Ut = (t) => {
|
|
259
|
+
const o = b(t);
|
|
260
|
+
return Ot(o.current, t) || (o.current = t), o.current;
|
|
261
|
+
}, Ln = ({
|
|
161
262
|
content: t,
|
|
162
|
-
contentType:
|
|
163
|
-
locale:
|
|
263
|
+
contentType: o,
|
|
264
|
+
locale: s,
|
|
164
265
|
lang: a,
|
|
165
|
-
dir:
|
|
166
|
-
customRenderBar:
|
|
167
|
-
onSend:
|
|
168
|
-
typingSpeed:
|
|
169
|
-
enableTypewriter:
|
|
170
|
-
typewriterPacing:
|
|
171
|
-
onTypeFinished:
|
|
172
|
-
onTypewriterStateChange:
|
|
173
|
-
userInput:
|
|
174
|
-
interactionDefaultValueOptions:
|
|
175
|
-
defaultButtonText:
|
|
176
|
-
defaultInputText:
|
|
177
|
-
defaultSelectedValues:
|
|
178
|
-
readonly:
|
|
179
|
-
confirmButtonText:
|
|
180
|
-
copyButtonText:
|
|
181
|
-
copiedButtonText:
|
|
182
|
-
sandboxLoadingText:
|
|
183
|
-
sandboxStyleLoadingText:
|
|
184
|
-
sandboxScriptLoadingText:
|
|
185
|
-
disableSandboxLoadingOverlay:
|
|
186
|
-
sandboxFullscreenButtonText:
|
|
187
|
-
sandboxExitFullscreenButtonText:
|
|
188
|
-
sandboxMode:
|
|
189
|
-
onClickCustomButtonAfterContent:
|
|
190
|
-
beforeSend:
|
|
266
|
+
dir: i,
|
|
267
|
+
customRenderBar: l,
|
|
268
|
+
onSend: x,
|
|
269
|
+
typingSpeed: g = 30,
|
|
270
|
+
enableTypewriter: ee = !1,
|
|
271
|
+
typewriterPacing: y = "fixed",
|
|
272
|
+
onTypeFinished: S,
|
|
273
|
+
onTypewriterStateChange: R,
|
|
274
|
+
userInput: T,
|
|
275
|
+
interactionDefaultValueOptions: p,
|
|
276
|
+
defaultButtonText: u,
|
|
277
|
+
defaultInputText: P,
|
|
278
|
+
defaultSelectedValues: D,
|
|
279
|
+
readonly: W = !1,
|
|
280
|
+
confirmButtonText: C,
|
|
281
|
+
copyButtonText: U,
|
|
282
|
+
copiedButtonText: z,
|
|
283
|
+
sandboxLoadingText: K,
|
|
284
|
+
sandboxStyleLoadingText: ne,
|
|
285
|
+
sandboxScriptLoadingText: ue,
|
|
286
|
+
disableSandboxLoadingOverlay: le = !1,
|
|
287
|
+
sandboxFullscreenButtonText: re,
|
|
288
|
+
sandboxExitFullscreenButtonText: oe,
|
|
289
|
+
sandboxMode: de = "content",
|
|
290
|
+
onClickCustomButtonAfterContent: se,
|
|
291
|
+
beforeSend: me
|
|
191
292
|
// tooltipMinLength,
|
|
192
293
|
}) => {
|
|
193
|
-
const
|
|
294
|
+
const F = be(s), L = f(
|
|
194
295
|
() => ({
|
|
195
|
-
loading:
|
|
196
|
-
emptyChart:
|
|
197
|
-
error:
|
|
296
|
+
loading: F.mermaidLoadingText,
|
|
297
|
+
emptyChart: F.mermaidEmptyChartText,
|
|
298
|
+
error: F.mermaidErrorText
|
|
198
299
|
}),
|
|
199
|
-
[
|
|
200
|
-
),
|
|
201
|
-
() =>
|
|
300
|
+
[F]
|
|
301
|
+
), M = i ?? Lt(s), q = a ?? Mt(s), Se = C || F.confirmButtonText, Re = U || F.copyButtonText, Be = z || F.copiedButtonText, Xe = re || F.sandboxFullscreenButtonText, Ze = oe || F.sandboxExitFullscreenButtonText, m = !!ee && (!o || o === "text"), B = f(
|
|
302
|
+
() => Rt(t),
|
|
202
303
|
[t]
|
|
203
|
-
),
|
|
204
|
-
(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
304
|
+
), A = f(
|
|
305
|
+
() => wt(B),
|
|
306
|
+
[B]
|
|
307
|
+
), w = f(() => {
|
|
308
|
+
const e = Ht(
|
|
309
|
+
Bt(B, !0, !0, A)
|
|
310
|
+
);
|
|
311
|
+
return B !== t && e.length && (e[0].type === "sandbox" || H(e[0])) ? [{ type: "text", value: "" }, ...e] : e;
|
|
312
|
+
}, [t, B, A]), Y = w.some(
|
|
313
|
+
(e) => e.type === "sandbox" || H(e)
|
|
314
|
+
), h = Y ? w.filter(
|
|
315
|
+
(e) => e.type !== "sandbox" && !H(e)
|
|
316
|
+
).map((e) => e.value).join("") : B, Ne = Math.max(0, g), Je = y === "fixed" ? h : void 0, [E, Le] = Fe(
|
|
317
|
+
() => m ? "" : h
|
|
318
|
+
), ae = b(E), V = b(""), I = b({
|
|
208
319
|
tokens: [],
|
|
209
320
|
head: 0,
|
|
210
321
|
trailingGrapheme: ""
|
|
211
|
-
}),
|
|
212
|
-
|
|
213
|
-
const e =
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
322
|
+
}), Q = b(0), Me = b(m), Ae = b(y), Ve = b(h), pe = b(t), fe = b(!1), [et, tt] = Fe(0);
|
|
323
|
+
te(() => {
|
|
324
|
+
const e = Me.current, n = Ae.current, c = Ve.current, d = !!V.current, k = pe.current !== t, xe = k && t.startsWith(pe.current);
|
|
325
|
+
pe.current = t, Me.current = m, Ae.current = y, Ve.current = h, (k || m !== e) && (fe.current = !1);
|
|
326
|
+
const X = () => {
|
|
327
|
+
V.current = "", I.current = {
|
|
217
328
|
tokens: [],
|
|
218
329
|
head: 0,
|
|
219
330
|
trailingGrapheme: ""
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
|
|
331
|
+
}, Q.current = 0;
|
|
332
|
+
}, J = (N) => {
|
|
333
|
+
ae.current = N, Le(N);
|
|
223
334
|
};
|
|
224
|
-
if (!
|
|
225
|
-
|
|
335
|
+
if (!m) {
|
|
336
|
+
X(), J(h);
|
|
226
337
|
return;
|
|
227
338
|
}
|
|
228
|
-
e || (
|
|
229
|
-
|
|
230
|
-
if (!
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
339
|
+
e || (X(), J(""));
|
|
340
|
+
let $ = e ? ae.current : "";
|
|
341
|
+
if (!h.startsWith($)) {
|
|
342
|
+
if (X(), !xe) {
|
|
343
|
+
J(h), y === "content-aware" && (I.current = {
|
|
344
|
+
tokens: [],
|
|
345
|
+
head: 0,
|
|
346
|
+
trailingGrapheme: we(h)
|
|
347
|
+
});
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
let N = 0;
|
|
351
|
+
for (; N < $.length && N < h.length && $[N] === h[N]; )
|
|
352
|
+
N += 1;
|
|
353
|
+
$ = $.slice(0, N), J($);
|
|
237
354
|
}
|
|
238
|
-
let
|
|
239
|
-
if (!
|
|
240
|
-
|
|
355
|
+
let O = h.slice($.length);
|
|
356
|
+
if (!O) {
|
|
357
|
+
V.current = "", Q.current = 0, I.current = y === "content-aware" ? {
|
|
241
358
|
tokens: [],
|
|
242
359
|
head: 0,
|
|
243
|
-
trailingGrapheme:
|
|
360
|
+
trailingGrapheme: we($)
|
|
244
361
|
} : { tokens: [], head: 0, trailingGrapheme: "" };
|
|
245
362
|
return;
|
|
246
363
|
}
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
364
|
+
if (y === "content-aware") {
|
|
365
|
+
const N = c.slice(
|
|
249
366
|
$.length
|
|
250
367
|
);
|
|
251
|
-
if (e &&
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
368
|
+
if (e && n === "content-aware" && h.startsWith(c) && V.current === N) {
|
|
369
|
+
const j = _e(
|
|
370
|
+
I.current,
|
|
371
|
+
h.slice(c.length)
|
|
255
372
|
);
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
),
|
|
373
|
+
I.current = j.queue, j.immediateChunk && (O = O.slice(
|
|
374
|
+
j.immediateChunk.length
|
|
375
|
+
), J(`${$}${j.immediateChunk}`));
|
|
259
376
|
} else {
|
|
260
|
-
const
|
|
377
|
+
const j = _e(
|
|
261
378
|
{
|
|
262
379
|
tokens: [],
|
|
263
380
|
head: 0,
|
|
264
|
-
trailingGrapheme:
|
|
381
|
+
trailingGrapheme: we($)
|
|
265
382
|
},
|
|
266
|
-
|
|
383
|
+
O
|
|
267
384
|
);
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
),
|
|
385
|
+
I.current = j.queue, j.immediateChunk && (O = O.slice(
|
|
386
|
+
j.immediateChunk.length
|
|
387
|
+
), J(`${$}${j.immediateChunk}`)), Q.current = 0;
|
|
271
388
|
}
|
|
272
389
|
} else
|
|
273
|
-
|
|
390
|
+
I.current = {
|
|
274
391
|
tokens: [],
|
|
275
392
|
head: 0,
|
|
276
393
|
trailingGrapheme: ""
|
|
277
|
-
},
|
|
278
|
-
|
|
279
|
-
}, [t,
|
|
280
|
-
|
|
394
|
+
}, Q.current = 0;
|
|
395
|
+
V.current = O, !d && O && tt((N) => N + 1);
|
|
396
|
+
}, [t, h, m, y]), te(() => {
|
|
397
|
+
m && (fe.current || V.current || E !== h || (fe.current = !0, S?.()));
|
|
281
398
|
}, [
|
|
282
399
|
t,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
]),
|
|
288
|
-
if (!
|
|
400
|
+
h,
|
|
401
|
+
E,
|
|
402
|
+
m,
|
|
403
|
+
S
|
|
404
|
+
]), te(() => {
|
|
405
|
+
if (!m || !V.current)
|
|
289
406
|
return;
|
|
290
407
|
const e = window.setTimeout(() => {
|
|
291
|
-
if (!
|
|
408
|
+
if (!V.current)
|
|
292
409
|
return;
|
|
293
|
-
let
|
|
294
|
-
if (
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
410
|
+
let n = "";
|
|
411
|
+
if (y === "content-aware") {
|
|
412
|
+
const d = Tt(
|
|
413
|
+
I.current,
|
|
414
|
+
Q.current + bt
|
|
298
415
|
);
|
|
299
|
-
|
|
416
|
+
n = d.chunk, I.current = d.queue, St(d.queue) ? Q.current = 0 : Q.current = d.remainingBudget;
|
|
300
417
|
} else
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
418
|
+
n = Qt(
|
|
419
|
+
V.current,
|
|
420
|
+
Ft
|
|
304
421
|
).chunk;
|
|
305
|
-
if (!
|
|
422
|
+
if (!n)
|
|
306
423
|
return;
|
|
307
|
-
|
|
424
|
+
V.current = V.current.slice(n.length), V.current || (I.current = y === "content-aware" ? {
|
|
308
425
|
tokens: [],
|
|
309
426
|
head: 0,
|
|
310
|
-
trailingGrapheme:
|
|
311
|
-
} : { tokens: [], head: 0, trailingGrapheme: "" },
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
},
|
|
427
|
+
trailingGrapheme: I.current.trailingGrapheme
|
|
428
|
+
} : { tokens: [], head: 0, trailingGrapheme: "" }, Q.current = 0);
|
|
429
|
+
const c = `${ae.current}${n}`;
|
|
430
|
+
ae.current = c, Le(c);
|
|
431
|
+
}, Ne);
|
|
315
432
|
return () => window.clearTimeout(e);
|
|
316
433
|
}, [
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
434
|
+
E,
|
|
435
|
+
Je,
|
|
436
|
+
m,
|
|
437
|
+
y,
|
|
438
|
+
Ne,
|
|
439
|
+
et
|
|
323
440
|
]);
|
|
324
|
-
const
|
|
441
|
+
const G = f(() => {
|
|
442
|
+
let e = 0;
|
|
443
|
+
return w.map((n) => {
|
|
444
|
+
if (!m) return n;
|
|
445
|
+
if (n.type === "sandbox" || H(n))
|
|
446
|
+
return E.length >= e ? n : { ...n, value: "" };
|
|
447
|
+
const c = E.slice(
|
|
448
|
+
e,
|
|
449
|
+
e + n.value.length
|
|
450
|
+
);
|
|
451
|
+
return e += n.value.length, { ...n, value: c };
|
|
452
|
+
});
|
|
453
|
+
}, [w, E, m]), $e = f(
|
|
325
454
|
() => ({
|
|
326
|
-
isTypewriterEnabled:
|
|
327
|
-
isTyping:
|
|
328
|
-
isComplete:
|
|
329
|
-
renderedLength: t.length -
|
|
455
|
+
isTypewriterEnabled: m,
|
|
456
|
+
isTyping: m && E !== h,
|
|
457
|
+
isComplete: E === h,
|
|
458
|
+
renderedLength: t.length - w.reduce(
|
|
459
|
+
(e, n, c) => e + n.value.length - G[c].value.length,
|
|
460
|
+
0
|
|
461
|
+
),
|
|
330
462
|
totalLength: t.length
|
|
331
463
|
}),
|
|
332
|
-
[
|
|
464
|
+
[
|
|
465
|
+
t,
|
|
466
|
+
h,
|
|
467
|
+
E,
|
|
468
|
+
m,
|
|
469
|
+
w,
|
|
470
|
+
G
|
|
471
|
+
]
|
|
333
472
|
);
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
}, [
|
|
337
|
-
const
|
|
473
|
+
te(() => {
|
|
474
|
+
R?.($e);
|
|
475
|
+
}, [R, $e]);
|
|
476
|
+
const he = f(() => {
|
|
338
477
|
let e = 0;
|
|
339
|
-
return
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
478
|
+
return w.map((n) => {
|
|
479
|
+
const c = e;
|
|
480
|
+
return e += n.value.length, c;
|
|
481
|
+
});
|
|
482
|
+
}, [w]), ce = f(
|
|
483
|
+
() => m ? w.map(
|
|
484
|
+
(e) => e.type === "sandbox" || H(e) ? [] : e.value === B ? A.inline : Ct(e.value)
|
|
485
|
+
) : [],
|
|
486
|
+
[m, w, B, A]
|
|
487
|
+
), nt = f(
|
|
488
|
+
() => Y ? G.map(
|
|
489
|
+
(e, n) => e.type === "sandbox" || H(e) ? e.value : m ? qe(
|
|
490
|
+
e.value,
|
|
491
|
+
w[n].value,
|
|
492
|
+
ce[n] ?? [],
|
|
493
|
+
A.metadata,
|
|
494
|
+
he[n]
|
|
495
|
+
) : ke(
|
|
496
|
+
e.value,
|
|
497
|
+
A.metadata,
|
|
498
|
+
he[n]
|
|
499
|
+
)
|
|
500
|
+
) : [],
|
|
501
|
+
[
|
|
502
|
+
Y,
|
|
503
|
+
m,
|
|
504
|
+
G,
|
|
505
|
+
ce,
|
|
506
|
+
w,
|
|
507
|
+
A.metadata,
|
|
508
|
+
he
|
|
509
|
+
]
|
|
510
|
+
), rt = f(() => {
|
|
511
|
+
const e = [];
|
|
512
|
+
w.forEach((n, c) => {
|
|
513
|
+
const d = e.at(-1);
|
|
514
|
+
n.type !== "sandbox" && d && !d.sandbox ? d.indices.push(c) : e.push({ indices: [c], sandbox: n.type === "sandbox" });
|
|
346
515
|
});
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
516
|
+
for (const n of e)
|
|
517
|
+
if (!n.sandbox && n.indices.some((c) => H(w[c]))) {
|
|
518
|
+
const c = n.indices.map((k) => w[k]), d = c.map((k) => k.value).join("");
|
|
519
|
+
n.plan = At(
|
|
520
|
+
c,
|
|
521
|
+
d === B ? A : void 0
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
return e;
|
|
525
|
+
}, [w, B, A]), _ = Y ? G.map((e) => e.value).join("") : m ? E : B, ot = f(
|
|
526
|
+
() => l ? ye(_) : "",
|
|
527
|
+
[l, _]
|
|
528
|
+
), Ee = f(
|
|
529
|
+
() => Y ? "" : ye(
|
|
530
|
+
m ? qe(
|
|
531
|
+
_,
|
|
532
|
+
B,
|
|
533
|
+
ce[0] ?? [],
|
|
534
|
+
A.metadata
|
|
535
|
+
) : ke(
|
|
536
|
+
_,
|
|
537
|
+
A.metadata
|
|
538
|
+
)
|
|
539
|
+
),
|
|
540
|
+
[
|
|
541
|
+
B,
|
|
542
|
+
Y,
|
|
543
|
+
m,
|
|
544
|
+
_,
|
|
545
|
+
ce,
|
|
546
|
+
A.metadata
|
|
547
|
+
]
|
|
548
|
+
), ge = f(
|
|
549
|
+
() => Nt(
|
|
550
|
+
_,
|
|
551
|
+
T,
|
|
552
|
+
p
|
|
355
553
|
),
|
|
356
|
-
[
|
|
357
|
-
),
|
|
358
|
-
() =>
|
|
359
|
-
[
|
|
360
|
-
),
|
|
361
|
-
|
|
362
|
-
),
|
|
363
|
-
direction:
|
|
364
|
-
language:
|
|
365
|
-
mermaidMessages:
|
|
366
|
-
beforeSend:
|
|
367
|
-
locale:
|
|
368
|
-
onClickCustomButtonAfterContent:
|
|
369
|
-
onSend:
|
|
370
|
-
readonly:
|
|
371
|
-
renderContent:
|
|
372
|
-
resolvedConfirmButtonText:
|
|
373
|
-
resolvedCopiedButtonText:
|
|
374
|
-
resolvedCopyButtonText:
|
|
375
|
-
resolvedDefaultButtonText:
|
|
376
|
-
resolvedDefaultInputText:
|
|
377
|
-
resolvedDefaultSelectedValues:
|
|
554
|
+
[p, _, T]
|
|
555
|
+
), Ie = u?.trim() || ge.buttonText, Pe = P?.trim() || ge.inputText, st = f(
|
|
556
|
+
() => T ? T.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
|
|
557
|
+
[T]
|
|
558
|
+
), at = D?.length ? D : ge.selectedValues || st, De = Ut(
|
|
559
|
+
at
|
|
560
|
+
), v = b({
|
|
561
|
+
direction: M,
|
|
562
|
+
language: q,
|
|
563
|
+
mermaidMessages: L,
|
|
564
|
+
beforeSend: me,
|
|
565
|
+
locale: s,
|
|
566
|
+
onClickCustomButtonAfterContent: se,
|
|
567
|
+
onSend: x,
|
|
568
|
+
readonly: W,
|
|
569
|
+
renderContent: _,
|
|
570
|
+
resolvedConfirmButtonText: Se,
|
|
571
|
+
resolvedCopiedButtonText: Be,
|
|
572
|
+
resolvedCopyButtonText: Re,
|
|
573
|
+
resolvedDefaultButtonText: Ie,
|
|
574
|
+
resolvedDefaultInputText: Pe,
|
|
575
|
+
resolvedDefaultSelectedValues: De
|
|
378
576
|
});
|
|
379
|
-
|
|
380
|
-
direction:
|
|
381
|
-
language:
|
|
382
|
-
mermaidMessages:
|
|
383
|
-
beforeSend:
|
|
384
|
-
locale:
|
|
385
|
-
onClickCustomButtonAfterContent:
|
|
386
|
-
onSend:
|
|
387
|
-
readonly:
|
|
388
|
-
renderContent:
|
|
389
|
-
resolvedConfirmButtonText:
|
|
390
|
-
resolvedCopiedButtonText:
|
|
391
|
-
resolvedCopyButtonText:
|
|
392
|
-
resolvedDefaultButtonText:
|
|
393
|
-
resolvedDefaultInputText:
|
|
394
|
-
resolvedDefaultSelectedValues:
|
|
577
|
+
v.current = {
|
|
578
|
+
direction: M,
|
|
579
|
+
language: q,
|
|
580
|
+
mermaidMessages: L,
|
|
581
|
+
beforeSend: me,
|
|
582
|
+
locale: s,
|
|
583
|
+
onClickCustomButtonAfterContent: se,
|
|
584
|
+
onSend: x,
|
|
585
|
+
readonly: W,
|
|
586
|
+
renderContent: _,
|
|
587
|
+
resolvedConfirmButtonText: Se,
|
|
588
|
+
resolvedCopiedButtonText: Be,
|
|
589
|
+
resolvedCopyButtonText: Re,
|
|
590
|
+
resolvedDefaultButtonText: Ie,
|
|
591
|
+
resolvedDefaultInputText: Pe,
|
|
592
|
+
resolvedDefaultSelectedValues: De
|
|
395
593
|
};
|
|
396
|
-
const
|
|
594
|
+
const ve = f(
|
|
397
595
|
() => ({
|
|
398
596
|
"custom-button-after-content": ({
|
|
399
597
|
children: e
|
|
400
|
-
}) => /* @__PURE__ */
|
|
598
|
+
}) => /* @__PURE__ */ r(
|
|
401
599
|
"button",
|
|
402
600
|
{
|
|
403
601
|
className: "content-render-custom-button-after-content",
|
|
404
|
-
onClick:
|
|
405
|
-
children: /* @__PURE__ */
|
|
602
|
+
onClick: v.current.onClickCustomButtonAfterContent,
|
|
603
|
+
children: /* @__PURE__ */ r("span", { className: "content-render-custom-button-after-content-inner", children: e })
|
|
406
604
|
}
|
|
407
605
|
),
|
|
408
|
-
"custom-variable": (e) => /* @__PURE__ */
|
|
409
|
-
|
|
606
|
+
"custom-variable": (e) => /* @__PURE__ */ r(
|
|
607
|
+
ft,
|
|
410
608
|
{
|
|
411
609
|
...e,
|
|
412
|
-
readonly:
|
|
413
|
-
defaultButtonText:
|
|
414
|
-
defaultInputText:
|
|
415
|
-
defaultSelectedValues:
|
|
416
|
-
onSend:
|
|
417
|
-
beforeSend:
|
|
418
|
-
locale:
|
|
419
|
-
dir:
|
|
420
|
-
lang:
|
|
421
|
-
confirmButtonText:
|
|
610
|
+
readonly: v.current.readonly,
|
|
611
|
+
defaultButtonText: v.current.resolvedDefaultButtonText,
|
|
612
|
+
defaultInputText: v.current.resolvedDefaultInputText,
|
|
613
|
+
defaultSelectedValues: v.current.resolvedDefaultSelectedValues,
|
|
614
|
+
onSend: v.current.onSend,
|
|
615
|
+
beforeSend: v.current.beforeSend,
|
|
616
|
+
locale: v.current.locale,
|
|
617
|
+
dir: v.current.direction,
|
|
618
|
+
lang: v.current.language,
|
|
619
|
+
confirmButtonText: v.current.resolvedConfirmButtonText
|
|
422
620
|
}
|
|
423
621
|
),
|
|
424
|
-
code:
|
|
425
|
-
table: ({ ...e }) => /* @__PURE__ */
|
|
426
|
-
th: ({ ...e }) => /* @__PURE__ */
|
|
427
|
-
td: ({ ...e }) => /* @__PURE__ */
|
|
428
|
-
tr: ({ ...e }) => /* @__PURE__ */
|
|
429
|
-
li: ({ node: e, ...
|
|
430
|
-
const
|
|
431
|
-
return typeof
|
|
622
|
+
code: Ue,
|
|
623
|
+
table: ({ ...e }) => /* @__PURE__ */ r("div", { className: "content-render-table-container", children: /* @__PURE__ */ r("table", { className: "content-render-table", ...e }) }),
|
|
624
|
+
th: ({ ...e }) => /* @__PURE__ */ r("th", { className: "content-render-th", ...e }),
|
|
625
|
+
td: ({ ...e }) => /* @__PURE__ */ r("td", { className: "content-render-td", ...e }),
|
|
626
|
+
tr: ({ ...e }) => /* @__PURE__ */ r("tr", { className: "content-render-tr", ...e }),
|
|
627
|
+
li: ({ node: e, ...n }) => {
|
|
628
|
+
const c = e?.properties?.className;
|
|
629
|
+
return typeof c == "string" && c.includes("task-list-item") || Array.isArray(c) && c.includes("task-list-item") ? /* @__PURE__ */ r("li", { className: "content-render-task-list-item", ...n }) : /* @__PURE__ */ r("li", { ...n });
|
|
432
630
|
},
|
|
433
|
-
ol: ({ ...e }) => /* @__PURE__ */
|
|
434
|
-
ul: ({ ...e }) => /* @__PURE__ */
|
|
435
|
-
input: ({ ...e }) => e.type === "checkbox" ? /* @__PURE__ */
|
|
631
|
+
ol: ({ ...e }) => /* @__PURE__ */ r("ol", { className: "content-render-ol", ...e }),
|
|
632
|
+
ul: ({ ...e }) => /* @__PURE__ */ r("ul", { className: "content-render-ul", ...e }),
|
|
633
|
+
input: ({ ...e }) => e.type === "checkbox" ? /* @__PURE__ */ r(
|
|
436
634
|
"input",
|
|
437
635
|
{
|
|
438
636
|
type: "checkbox",
|
|
@@ -440,127 +638,151 @@ const vt = 2, $e = ({ svg: t }) => {
|
|
|
440
638
|
disabled: !0,
|
|
441
639
|
...e
|
|
442
640
|
}
|
|
443
|
-
) : /* @__PURE__ */
|
|
444
|
-
a: ({ children: e, ...
|
|
445
|
-
pre: (e) => /* @__PURE__ */
|
|
446
|
-
|
|
641
|
+
) : /* @__PURE__ */ r("input", { ...e }),
|
|
642
|
+
a: ({ children: e, ...n }) => /* @__PURE__ */ r("a", { target: "_blank", rel: "noopener noreferrer", ...n, children: e }),
|
|
643
|
+
pre: (e) => /* @__PURE__ */ r(
|
|
644
|
+
mt,
|
|
447
645
|
{
|
|
448
646
|
...e,
|
|
449
|
-
copyButtonText:
|
|
450
|
-
copiedButtonText:
|
|
647
|
+
copyButtonText: v.current.resolvedCopyButtonText,
|
|
648
|
+
copiedButtonText: v.current.resolvedCopiedButtonText
|
|
451
649
|
}
|
|
452
650
|
)
|
|
453
651
|
}),
|
|
454
652
|
[]
|
|
455
|
-
),
|
|
456
|
-
() =>
|
|
457
|
-
[
|
|
458
|
-
),
|
|
459
|
-
const
|
|
460
|
-
return
|
|
461
|
-
const
|
|
462
|
-
return
|
|
463
|
-
|
|
653
|
+
), ct = f(
|
|
654
|
+
() => Ge(Ee),
|
|
655
|
+
[Ee]
|
|
656
|
+
), it = (e, n) => {
|
|
657
|
+
const c = ye(e);
|
|
658
|
+
return Ge(c).map((k, xe) => {
|
|
659
|
+
const X = `${n}-${k.type}-${xe}`;
|
|
660
|
+
return k.type === "text" ? /* @__PURE__ */ r(
|
|
661
|
+
ie.Provider,
|
|
464
662
|
{
|
|
465
|
-
value:
|
|
466
|
-
children: /* @__PURE__ */
|
|
467
|
-
|
|
663
|
+
value: v,
|
|
664
|
+
children: /* @__PURE__ */ r(
|
|
665
|
+
He,
|
|
468
666
|
{
|
|
469
|
-
locale:
|
|
470
|
-
components:
|
|
471
|
-
content:
|
|
667
|
+
locale: s,
|
|
668
|
+
components: ve,
|
|
669
|
+
content: k.value
|
|
472
670
|
}
|
|
473
671
|
)
|
|
474
672
|
},
|
|
475
|
-
|
|
476
|
-
) :
|
|
477
|
-
|
|
673
|
+
X
|
|
674
|
+
) : k.type === "mermaid" ? /* @__PURE__ */ r(
|
|
675
|
+
Ce,
|
|
478
676
|
{
|
|
479
|
-
chart:
|
|
480
|
-
frozen: !
|
|
481
|
-
messages:
|
|
677
|
+
chart: k.value,
|
|
678
|
+
frozen: !k.complete,
|
|
679
|
+
messages: L
|
|
482
680
|
},
|
|
483
|
-
|
|
484
|
-
) :
|
|
681
|
+
X
|
|
682
|
+
) : k.type === "svg" ? /* @__PURE__ */ r(Te, { svg: k.value }, X) : null;
|
|
485
683
|
});
|
|
486
|
-
}
|
|
487
|
-
|
|
684
|
+
}, We = l ? /* @__PURE__ */ r("div", { className: "content-render-custom-bar", children: Z.createElement(l, {
|
|
685
|
+
content: t,
|
|
686
|
+
displayContent: ot,
|
|
687
|
+
onSend: x
|
|
688
|
+
}) }) : null;
|
|
689
|
+
return Y ? /* @__PURE__ */ ze(
|
|
488
690
|
"div",
|
|
489
691
|
{
|
|
490
692
|
className: "content-render markdown-body",
|
|
491
|
-
dir:
|
|
492
|
-
lang:
|
|
493
|
-
children:
|
|
494
|
-
(e
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
693
|
+
dir: M,
|
|
694
|
+
lang: q,
|
|
695
|
+
children: [
|
|
696
|
+
rt.map((e) => {
|
|
697
|
+
const n = e.indices[0], c = G[n];
|
|
698
|
+
return e.sandbox ? c.value ? /* @__PURE__ */ r(
|
|
699
|
+
kt,
|
|
700
|
+
{
|
|
701
|
+
hideFullScreen: !0,
|
|
702
|
+
type: "sandbox",
|
|
703
|
+
content: c.value,
|
|
704
|
+
className: "content-render-iframe",
|
|
705
|
+
locale: s,
|
|
706
|
+
dir: M,
|
|
707
|
+
lang: q,
|
|
708
|
+
loadingText: K,
|
|
709
|
+
styleLoadingText: ne,
|
|
710
|
+
scriptLoadingText: ue,
|
|
711
|
+
disableLoadingOverlay: le,
|
|
712
|
+
fullScreenButtonText: Xe,
|
|
713
|
+
exitFullScreenButtonText: Ze,
|
|
714
|
+
mode: de
|
|
715
|
+
},
|
|
716
|
+
`sandbox-${n}`
|
|
717
|
+
) : null : e.plan ? /* @__PURE__ */ r(
|
|
718
|
+
ie.Provider,
|
|
719
|
+
{
|
|
720
|
+
value: v,
|
|
721
|
+
children: /* @__PURE__ */ r(
|
|
722
|
+
jt,
|
|
723
|
+
{
|
|
724
|
+
locale: s,
|
|
725
|
+
components: ve,
|
|
726
|
+
plan: e.plan,
|
|
727
|
+
renderedSegments: e.indices.map(
|
|
728
|
+
(d) => G[d]
|
|
729
|
+
)
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
},
|
|
733
|
+
`md-${n}`
|
|
734
|
+
) : e.indices.map((d) => /* @__PURE__ */ r(Z.Fragment, { children: G[d].type === "markdown" && G[d].pending ? null : it(
|
|
735
|
+
nt[d],
|
|
736
|
+
`md-${d}`
|
|
737
|
+
) }, `md-${d}`));
|
|
738
|
+
}),
|
|
739
|
+
We
|
|
740
|
+
]
|
|
515
741
|
}
|
|
516
|
-
) : /* @__PURE__ */
|
|
742
|
+
) : /* @__PURE__ */ ze(
|
|
517
743
|
"div",
|
|
518
744
|
{
|
|
519
745
|
className: "content-render markdown-body",
|
|
520
|
-
dir:
|
|
521
|
-
lang:
|
|
746
|
+
dir: M,
|
|
747
|
+
lang: q,
|
|
522
748
|
children: [
|
|
523
|
-
|
|
749
|
+
ct.map((e, n) => {
|
|
524
750
|
if (e.type === "text")
|
|
525
|
-
return /* @__PURE__ */
|
|
526
|
-
|
|
751
|
+
return /* @__PURE__ */ r(
|
|
752
|
+
ie.Provider,
|
|
527
753
|
{
|
|
528
|
-
value:
|
|
529
|
-
children: /* @__PURE__ */
|
|
530
|
-
|
|
754
|
+
value: v,
|
|
755
|
+
children: /* @__PURE__ */ r(
|
|
756
|
+
He,
|
|
531
757
|
{
|
|
532
|
-
locale:
|
|
533
|
-
components:
|
|
758
|
+
locale: s,
|
|
759
|
+
components: ve,
|
|
534
760
|
content: e.value
|
|
535
761
|
}
|
|
536
762
|
)
|
|
537
763
|
},
|
|
538
|
-
|
|
764
|
+
n
|
|
539
765
|
);
|
|
540
766
|
if (e.type === "mermaid")
|
|
541
|
-
return /* @__PURE__ */
|
|
542
|
-
|
|
767
|
+
return /* @__PURE__ */ r(
|
|
768
|
+
Ce,
|
|
543
769
|
{
|
|
544
770
|
chart: e.value,
|
|
545
771
|
frozen: !e.complete,
|
|
546
|
-
messages:
|
|
772
|
+
messages: L
|
|
547
773
|
},
|
|
548
|
-
|
|
774
|
+
n
|
|
549
775
|
);
|
|
550
776
|
if (e.type === "svg")
|
|
551
|
-
return /* @__PURE__ */
|
|
777
|
+
return /* @__PURE__ */ r(Te, { svg: e.value }, n);
|
|
552
778
|
}),
|
|
553
|
-
|
|
554
|
-
content: t,
|
|
555
|
-
displayContent: ie,
|
|
556
|
-
onSend: L
|
|
557
|
-
}) })
|
|
779
|
+
We
|
|
558
780
|
]
|
|
559
781
|
}
|
|
560
782
|
);
|
|
561
783
|
};
|
|
562
784
|
export {
|
|
563
|
-
|
|
564
|
-
|
|
785
|
+
He as MarkdownRenderer,
|
|
786
|
+
Ln as default
|
|
565
787
|
};
|
|
566
788
|
//# sourceMappingURL=ContentRender.es.js.map
|