markdown-flow-ui 0.2.19 → 0.2.20-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import Q, { useMemo as C, useState as be, useRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as r, jsxs as He } from "react/jsx-runtime";
|
|
2
|
+
import Q, { useMemo as C, useState as be, useRef as v, useEffect as P } from "react";
|
|
3
|
+
import qe from "../../_virtual/index.es.js";
|
|
4
4
|
import { sanitizeInvalidTagName as Pe } from "./utils/sanitize-invalid-tag-name.es.js";
|
|
5
5
|
import { stripSvgTextLineBreaks as Qe } from "./utils/strip-svg-text-line-breaks.es.js";
|
|
6
6
|
/* empty css */
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
|
-
import
|
|
11
|
-
import
|
|
10
|
+
import je, { CodeBlockContext as Ue } from "./CodeBlock.es.js";
|
|
11
|
+
import Ke from "./plugins/CustomVariable.es.js";
|
|
12
12
|
import ie from "./plugins/MermaidChart.es.js";
|
|
13
|
-
import { preserveCustomVariableProperties as
|
|
14
|
-
import { subsetLanguages as
|
|
15
|
-
import { parseMarkdownSegments as Be, mermaidBlockIsComplete as
|
|
13
|
+
import { preserveCustomVariableProperties as Oe, restoreCustomVariableProperties as Xe } from "./utils/custom-variable-props.es.js";
|
|
14
|
+
import { subsetLanguages as Ye, highlightLanguages as Ze } from "./utils/highlight-languages.es.js";
|
|
15
|
+
import { parseMarkdownSegments as Be, mermaidBlockIsComplete as Je } from "./utils/mermaid-parse.es.js";
|
|
16
16
|
import { normalizeInlineHtml as Se } from "./utils/normalize-inline-html.es.js";
|
|
17
|
-
import
|
|
18
|
-
import { getTrailingTypewriterGrapheme as ae, appendContentAwareTypewriterQueue as
|
|
19
|
-
import { splitContentSegments as
|
|
20
|
-
import { getInteractionDefaultValues as
|
|
21
|
-
import { getMarkdownFlowDirection as
|
|
22
|
-
import { getContentRenderLocaleTexts as
|
|
23
|
-
import { Markdown as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
const
|
|
31
|
-
const n =
|
|
17
|
+
import et from "./IframeSandbox.es.js";
|
|
18
|
+
import { getTrailingTypewriterGrapheme as ae, appendContentAwareTypewriterQueue as Re, consumeContentAwareTypewriterQueue as tt, CONTENT_AWARE_TYPEWRITER_TICK_BUDGET as rt, isContentAwareTypewriterQueueEmpty as nt } from "./utils/typewriter-pacing.es.js";
|
|
19
|
+
import { splitContentSegments as ot } from "./utils/split-content.es.js";
|
|
20
|
+
import { getInteractionDefaultValues as st } from "../../lib/interaction-defaults.es.js";
|
|
21
|
+
import { getMarkdownFlowDirection as at, getMarkdownFlowLanguage as it } from "../../lib/locale.es.js";
|
|
22
|
+
import { getContentRenderLocaleTexts as Le } from "./contentRenderI18n.es.js";
|
|
23
|
+
import { Markdown as ct } from "../../node_modules/react-markdown/lib/index.es.js";
|
|
24
|
+
import lt from "../../node_modules/rehype-raw/lib/index.es.js";
|
|
25
|
+
import ut from "../../node_modules/rehype-highlight/lib/index.es.js";
|
|
26
|
+
import dt from "../../node_modules/rehype-katex/lib/index.es.js";
|
|
27
|
+
import mt from "../../node_modules/remark-gfm/lib/index.es.js";
|
|
28
|
+
import pt from "../../node_modules/remark-math/lib/index.es.js";
|
|
29
|
+
import ht from "../../node_modules/remark-breaks/lib/index.es.js";
|
|
30
|
+
const ft = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, gt = 2, Ne = ({ svg: t }) => {
|
|
31
|
+
const n = v(null);
|
|
32
32
|
return P(() => {
|
|
33
33
|
const o = n.current;
|
|
34
34
|
if (!o) return;
|
|
35
|
-
const s = o.shadowRoot ?? o.attachShadow({ mode: "open" }),
|
|
36
|
-
let u = s.getElementById(
|
|
37
|
-
u || (u = document.createElement("style"), u.id =
|
|
35
|
+
const s = o.shadowRoot ?? o.attachShadow({ mode: "open" }), k = "content-render-svg-style";
|
|
36
|
+
let u = s.getElementById(k);
|
|
37
|
+
u || (u = document.createElement("style"), u.id = k, u.textContent = `
|
|
38
38
|
svg { height: auto; display: inline-block; }
|
|
39
39
|
svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
|
|
40
40
|
svg.content-render-svg-el--fixed { max-width: none; }
|
|
41
41
|
`, s.appendChild(u)), Array.from(s.childNodes).filter(
|
|
42
42
|
(a) => a !== u
|
|
43
43
|
).forEach((a) => s.removeChild(a));
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
let d = !1,
|
|
44
|
+
const G = document.createElement("template"), D = Qe(t);
|
|
45
|
+
G.innerHTML = D, s.append(G.content.cloneNode(!0));
|
|
46
|
+
let d = !1, F = !1;
|
|
47
47
|
s.querySelectorAll("svg").forEach((a) => {
|
|
48
|
-
const
|
|
49
|
-
if (!
|
|
50
|
-
const
|
|
51
|
-
if (
|
|
52
|
-
const [, ,
|
|
53
|
-
if (!
|
|
54
|
-
const c =
|
|
48
|
+
const z = a.getAttribute("viewBox");
|
|
49
|
+
if (!z) return;
|
|
50
|
+
const W = z.trim().split(/[\s,]+/).map((T) => Number(T));
|
|
51
|
+
if (W.length !== 4 || W.some(Number.isNaN)) return;
|
|
52
|
+
const [, , E, S] = W, L = a.getAttribute("width"), V = a.getAttribute("height"), j = (T) => {
|
|
53
|
+
if (!T) return !1;
|
|
54
|
+
const c = T.trim().toLowerCase();
|
|
55
55
|
return c === "auto" || c.endsWith("%");
|
|
56
|
-
},
|
|
57
|
-
if (!
|
|
58
|
-
const c =
|
|
56
|
+
}, U = (T) => {
|
|
57
|
+
if (!T) return null;
|
|
58
|
+
const c = T.trim().toLowerCase();
|
|
59
59
|
if (c === "auto" || c.endsWith("%"))
|
|
60
60
|
return null;
|
|
61
|
-
const
|
|
62
|
-
return Number.isNaN(
|
|
63
|
-
}, Y =
|
|
64
|
-
if (Y || Z ||
|
|
65
|
-
d = !0, a.classList.add("content-render-svg-el--responsive"), a.classList.remove("content-render-svg-el--fixed"), a.style.width = "100%", a.style.height = "auto", !a.style.aspectRatio &&
|
|
61
|
+
const M = Number.parseFloat(c);
|
|
62
|
+
return Number.isNaN(M) ? null : M;
|
|
63
|
+
}, Y = j(L), Z = j(V), K = !L || L === "0", O = !V || V === "0", J = U(L), ee = U(V);
|
|
64
|
+
if (Y || Z || K && O || J === E && ee === S) {
|
|
65
|
+
d = !0, a.classList.add("content-render-svg-el--responsive"), a.classList.remove("content-render-svg-el--fixed"), a.style.width = "100%", a.style.height = "auto", !a.style.aspectRatio && S > 0 && (a.style.aspectRatio = `${E} / ${S}`);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
F = !0, a.classList.add("content-render-svg-el--fixed"), a.classList.remove("content-render-svg-el--responsive"), K && E > 0 && a.setAttribute("width", `${E}`), O && S > 0 && a.setAttribute("height", `${S}`);
|
|
69
69
|
});
|
|
70
|
-
const
|
|
71
|
-
o.classList.toggle("content-render-svg--responsive",
|
|
70
|
+
const _ = d && !F;
|
|
71
|
+
o.classList.toggle("content-render-svg--responsive", _), o.classList.toggle("content-render-svg--fixed", !_);
|
|
72
72
|
}, [t]), /* @__PURE__ */ r("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ r("div", { className: "content-render-svg", ref: n }) });
|
|
73
73
|
}, ce = Q.createContext(
|
|
74
74
|
null
|
|
75
|
-
),
|
|
76
|
-
const n = Q.useContext(ce), o = Q.useContext(
|
|
75
|
+
), xt = (t) => {
|
|
76
|
+
const n = Q.useContext(ce), o = Q.useContext(Ue);
|
|
77
77
|
if (!n)
|
|
78
78
|
throw new Error("Markdown code renderer requires ContentRender context.");
|
|
79
|
-
const { className: s, children:
|
|
79
|
+
const { className: s, children: k, ...u } = t;
|
|
80
80
|
if (/language-(\w+)/.exec(s || "")?.[1] === "mermaid") {
|
|
81
|
-
const
|
|
81
|
+
const D = k?.toString().replace(/\n$/, "") || "", d = Je(
|
|
82
82
|
n.current.renderContent,
|
|
83
|
-
|
|
83
|
+
D
|
|
84
84
|
);
|
|
85
85
|
return /* @__PURE__ */ r(
|
|
86
86
|
ie,
|
|
87
87
|
{
|
|
88
|
-
chart:
|
|
88
|
+
chart: D,
|
|
89
89
|
frozen: d,
|
|
90
90
|
messages: n.current.mermaidMessages
|
|
91
91
|
}
|
|
@@ -97,40 +97,40 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
97
97
|
className: s,
|
|
98
98
|
...u,
|
|
99
99
|
dir: u.dir ?? (o ? void 0 : "ltr"),
|
|
100
|
-
children:
|
|
100
|
+
children: k
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
|
-
},
|
|
103
|
+
}, vt = [
|
|
104
|
+
mt,
|
|
104
105
|
pt,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
], yt = [
|
|
109
|
-
Ke,
|
|
110
|
-
ut,
|
|
111
|
-
Pe,
|
|
106
|
+
qe,
|
|
107
|
+
ht
|
|
108
|
+
], Tt = [
|
|
112
109
|
Oe,
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
110
|
+
lt,
|
|
111
|
+
Pe,
|
|
112
|
+
Xe,
|
|
113
|
+
[ut, { languages: Ze, subset: Ye }],
|
|
114
|
+
dt
|
|
115
|
+
], Ae = ({ content: t, components: n, locale: o }) => {
|
|
116
|
+
const s = Le(o);
|
|
117
117
|
return /* @__PURE__ */ r("div", { className: "markdown-renderer", children: /* @__PURE__ */ r(
|
|
118
|
-
|
|
118
|
+
ct,
|
|
119
119
|
{
|
|
120
|
-
remarkPlugins:
|
|
121
|
-
rehypePlugins:
|
|
120
|
+
remarkPlugins: vt,
|
|
121
|
+
rehypePlugins: Tt,
|
|
122
122
|
remarkRehypeOptions: {
|
|
123
123
|
footnoteLabel: s.footnoteLabel,
|
|
124
|
-
footnoteBackLabel: (
|
|
125
|
-
const
|
|
126
|
-
return s.footnoteBackLabel.replace("{reference}",
|
|
124
|
+
footnoteBackLabel: (k, u) => {
|
|
125
|
+
const A = String(k + 1) + (u > 1 ? `-${u}` : "");
|
|
126
|
+
return s.footnoteBackLabel.replace("{reference}", A);
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
components: n,
|
|
130
130
|
children: t
|
|
131
131
|
}
|
|
132
132
|
) });
|
|
133
|
-
},
|
|
133
|
+
}, yt = (t) => {
|
|
134
134
|
if (t.length <= 1) return t;
|
|
135
135
|
const n = [];
|
|
136
136
|
return t.forEach((o) => {
|
|
@@ -148,62 +148,62 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
148
148
|
}
|
|
149
149
|
n.push({ type: "markdown", value: o.value });
|
|
150
150
|
}), n;
|
|
151
|
-
},
|
|
151
|
+
}, Ct = (t, n) => {
|
|
152
152
|
const o = Math.max(1, n), s = Array.from(t);
|
|
153
153
|
return {
|
|
154
154
|
chunk: s.slice(0, o).join(""),
|
|
155
155
|
rest: s.slice(o).join("")
|
|
156
156
|
};
|
|
157
|
-
}, kt = (t, n) => t === n ? !0 : !t || !n || t.length !== n.length ? !1 : t.every((o, s) => o === n[s]),
|
|
158
|
-
const n =
|
|
157
|
+
}, kt = (t, n) => t === n ? !0 : !t || !n || t.length !== n.length ? !1 : t.every((o, s) => o === n[s]), wt = (t) => {
|
|
158
|
+
const n = v(t);
|
|
159
159
|
return kt(n.current, t) || (n.current = t), n.current;
|
|
160
|
-
},
|
|
160
|
+
}, tr = ({
|
|
161
161
|
content: t,
|
|
162
162
|
contentType: n,
|
|
163
163
|
locale: o,
|
|
164
164
|
lang: s,
|
|
165
|
-
dir:
|
|
165
|
+
dir: k,
|
|
166
166
|
customRenderBar: u,
|
|
167
|
-
onSend:
|
|
168
|
-
typingSpeed:
|
|
169
|
-
enableTypewriter:
|
|
167
|
+
onSend: A,
|
|
168
|
+
typingSpeed: G = 40,
|
|
169
|
+
enableTypewriter: D = !1,
|
|
170
170
|
typewriterPacing: d = "fixed",
|
|
171
|
-
onTypeFinished:
|
|
172
|
-
onTypewriterStateChange:
|
|
171
|
+
onTypeFinished: F,
|
|
172
|
+
onTypewriterStateChange: _,
|
|
173
173
|
userInput: a,
|
|
174
|
-
interactionDefaultValueOptions:
|
|
175
|
-
defaultButtonText:
|
|
176
|
-
defaultInputText:
|
|
177
|
-
defaultSelectedValues:
|
|
178
|
-
readonly:
|
|
179
|
-
confirmButtonText:
|
|
180
|
-
copyButtonText:
|
|
181
|
-
copiedButtonText:
|
|
174
|
+
interactionDefaultValueOptions: z,
|
|
175
|
+
defaultButtonText: W,
|
|
176
|
+
defaultInputText: E,
|
|
177
|
+
defaultSelectedValues: S,
|
|
178
|
+
readonly: L = !1,
|
|
179
|
+
confirmButtonText: V,
|
|
180
|
+
copyButtonText: j,
|
|
181
|
+
copiedButtonText: U,
|
|
182
182
|
sandboxLoadingText: Y,
|
|
183
183
|
sandboxStyleLoadingText: Z,
|
|
184
|
-
sandboxScriptLoadingText:
|
|
185
|
-
disableSandboxLoadingOverlay:
|
|
184
|
+
sandboxScriptLoadingText: K,
|
|
185
|
+
disableSandboxLoadingOverlay: O = !1,
|
|
186
186
|
sandboxFullscreenButtonText: J,
|
|
187
187
|
sandboxExitFullscreenButtonText: ee,
|
|
188
188
|
sandboxMode: le = "content",
|
|
189
189
|
onClickCustomButtonAfterContent: te,
|
|
190
|
-
beforeSend:
|
|
190
|
+
beforeSend: T
|
|
191
191
|
// tooltipMinLength,
|
|
192
192
|
}) => {
|
|
193
|
-
const c =
|
|
193
|
+
const c = Le(o), M = C(
|
|
194
194
|
() => ({
|
|
195
195
|
loading: c.mermaidLoadingText,
|
|
196
196
|
emptyChart: c.mermaidEmptyChartText,
|
|
197
197
|
error: c.mermaidErrorText
|
|
198
198
|
}),
|
|
199
199
|
[c]
|
|
200
|
-
),
|
|
200
|
+
), H = k ?? at(o), q = s ?? it(o), ue = V || c.confirmButtonText, de = j || c.copyButtonText, me = U || c.copiedButtonText, Me = J || c.sandboxFullscreenButtonText, $e = ee || c.sandboxExitFullscreenButtonText, m = !!D && (!n || n === "text"), pe = Math.max(0, G), De = d === "fixed" ? t : void 0, [w, he] = be(
|
|
201
201
|
() => m ? "" : t
|
|
202
|
-
),
|
|
202
|
+
), X = v(w), h = v(""), g = v({
|
|
203
203
|
tokens: [],
|
|
204
204
|
head: 0,
|
|
205
205
|
trailingGrapheme: ""
|
|
206
|
-
}),
|
|
206
|
+
}), R = v(0), fe = v(m), ge = v(d), xe = v(t), re = v(!1), [Ee, Ve] = be(0);
|
|
207
207
|
P(() => {
|
|
208
208
|
const e = fe.current, i = ge.current, p = xe.current, b = !!h.current;
|
|
209
209
|
fe.current = m, ge.current = d, xe.current = t, (t !== p || m !== e) && (re.current = !1);
|
|
@@ -212,60 +212,68 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
212
212
|
tokens: [],
|
|
213
213
|
head: 0,
|
|
214
214
|
trailingGrapheme: ""
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
|
|
215
|
+
}, R.current = 0;
|
|
216
|
+
}, $ = (I) => {
|
|
217
|
+
X.current = I, he(I);
|
|
218
218
|
};
|
|
219
219
|
if (!m) {
|
|
220
|
-
f(),
|
|
220
|
+
f(), $(t);
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
223
|
-
e || (f(),
|
|
224
|
-
const
|
|
225
|
-
if (!t.startsWith(
|
|
226
|
-
f(),
|
|
223
|
+
e || (f(), $(""));
|
|
224
|
+
const x = e ? X.current : "";
|
|
225
|
+
if (!t.startsWith(x)) {
|
|
226
|
+
f(), $(t), d === "content-aware" && (g.current = {
|
|
227
227
|
tokens: [],
|
|
228
228
|
head: 0,
|
|
229
229
|
trailingGrapheme: ae(t)
|
|
230
230
|
});
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
|
-
let
|
|
234
|
-
if (!
|
|
235
|
-
h.current = "",
|
|
233
|
+
let N = t.slice(x.length);
|
|
234
|
+
if (!N) {
|
|
235
|
+
h.current = "", R.current = 0, g.current = d === "content-aware" ? {
|
|
236
236
|
tokens: [],
|
|
237
237
|
head: 0,
|
|
238
|
-
trailingGrapheme: ae(
|
|
238
|
+
trailingGrapheme: ae(x)
|
|
239
239
|
} : { tokens: [], head: 0, trailingGrapheme: "" };
|
|
240
240
|
return;
|
|
241
241
|
}
|
|
242
242
|
if (d === "content-aware") {
|
|
243
|
-
const
|
|
244
|
-
|
|
243
|
+
const I = p.slice(
|
|
244
|
+
x.length
|
|
245
245
|
);
|
|
246
|
-
if (e && i === "content-aware" && t.startsWith(p) && h.current ===
|
|
247
|
-
const
|
|
246
|
+
if (e && i === "content-aware" && t.startsWith(p) && h.current === I) {
|
|
247
|
+
const B = Re(
|
|
248
248
|
g.current,
|
|
249
249
|
t.slice(p.length)
|
|
250
250
|
);
|
|
251
|
-
g.current =
|
|
252
|
-
|
|
253
|
-
),
|
|
254
|
-
} else
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
251
|
+
g.current = B.queue, B.immediateChunk && (N = N.slice(
|
|
252
|
+
B.immediateChunk.length
|
|
253
|
+
), $(`${x}${B.immediateChunk}`));
|
|
254
|
+
} else {
|
|
255
|
+
const B = Re(
|
|
256
|
+
{
|
|
257
|
+
tokens: [],
|
|
258
|
+
head: 0,
|
|
259
|
+
trailingGrapheme: ae(x)
|
|
260
|
+
},
|
|
261
|
+
N
|
|
262
|
+
);
|
|
263
|
+
g.current = B.queue, B.immediateChunk && (N = N.slice(
|
|
264
|
+
B.immediateChunk.length
|
|
265
|
+
), $(`${x}${B.immediateChunk}`)), R.current = 0;
|
|
266
|
+
}
|
|
259
267
|
} else
|
|
260
268
|
g.current = {
|
|
261
269
|
tokens: [],
|
|
262
270
|
head: 0,
|
|
263
271
|
trailingGrapheme: ""
|
|
264
|
-
},
|
|
265
|
-
h.current =
|
|
272
|
+
}, R.current = 0;
|
|
273
|
+
h.current = N, !b && N && Ve((I) => I + 1);
|
|
266
274
|
}, [t, m, d]), P(() => {
|
|
267
|
-
m && (re.current || h.current ||
|
|
268
|
-
}, [t,
|
|
275
|
+
m && (re.current || h.current || w !== t || (re.current = !0, F?.()));
|
|
276
|
+
}, [t, w, m, F]), P(() => {
|
|
269
277
|
if (!m || !h.current)
|
|
270
278
|
return;
|
|
271
279
|
const e = window.setTimeout(() => {
|
|
@@ -273,15 +281,15 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
273
281
|
return;
|
|
274
282
|
let i = "";
|
|
275
283
|
if (d === "content-aware") {
|
|
276
|
-
const b =
|
|
284
|
+
const b = tt(
|
|
277
285
|
g.current,
|
|
278
|
-
|
|
286
|
+
R.current + rt
|
|
279
287
|
);
|
|
280
|
-
i = b.chunk, g.current = b.queue,
|
|
288
|
+
i = b.chunk, g.current = b.queue, nt(b.queue) ? R.current = 0 : R.current = b.remainingBudget;
|
|
281
289
|
} else
|
|
282
|
-
i =
|
|
290
|
+
i = Ct(
|
|
283
291
|
h.current,
|
|
284
|
-
|
|
292
|
+
gt
|
|
285
293
|
).chunk;
|
|
286
294
|
if (!i)
|
|
287
295
|
return;
|
|
@@ -289,57 +297,57 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
289
297
|
tokens: [],
|
|
290
298
|
head: 0,
|
|
291
299
|
trailingGrapheme: g.current.trailingGrapheme
|
|
292
|
-
} : { tokens: [], head: 0, trailingGrapheme: "" },
|
|
293
|
-
const p = `${
|
|
294
|
-
|
|
300
|
+
} : { tokens: [], head: 0, trailingGrapheme: "" }, R.current = 0);
|
|
301
|
+
const p = `${X.current}${i}`;
|
|
302
|
+
X.current = p, he(p);
|
|
295
303
|
}, pe);
|
|
296
304
|
return () => window.clearTimeout(e);
|
|
297
305
|
}, [
|
|
298
|
-
|
|
299
|
-
|
|
306
|
+
w,
|
|
307
|
+
De,
|
|
300
308
|
m,
|
|
301
309
|
d,
|
|
302
310
|
pe,
|
|
303
|
-
|
|
311
|
+
Ee
|
|
304
312
|
]);
|
|
305
313
|
const ve = C(
|
|
306
314
|
() => ({
|
|
307
315
|
isTypewriterEnabled: m,
|
|
308
|
-
isTyping: m &&
|
|
309
|
-
isComplete:
|
|
310
|
-
renderedLength:
|
|
316
|
+
isTyping: m && w !== t,
|
|
317
|
+
isComplete: w === t,
|
|
318
|
+
renderedLength: w.length,
|
|
311
319
|
totalLength: t.length
|
|
312
320
|
}),
|
|
313
|
-
[t,
|
|
321
|
+
[t, w, m]
|
|
314
322
|
);
|
|
315
323
|
P(() => {
|
|
316
|
-
|
|
317
|
-
}, [
|
|
318
|
-
const
|
|
319
|
-
() => Se(
|
|
320
|
-
[
|
|
324
|
+
_?.(ve);
|
|
325
|
+
}, [_, ve]);
|
|
326
|
+
const y = m ? w : t, ne = C(
|
|
327
|
+
() => Se(y),
|
|
328
|
+
[y]
|
|
321
329
|
), oe = C(
|
|
322
|
-
() =>
|
|
323
|
-
|
|
330
|
+
() => st(
|
|
331
|
+
y,
|
|
324
332
|
a,
|
|
325
|
-
|
|
333
|
+
z
|
|
326
334
|
),
|
|
327
|
-
[
|
|
328
|
-
), Te =
|
|
335
|
+
[z, y, a]
|
|
336
|
+
), Te = W?.trim() || oe.buttonText, ye = E?.trim() || oe.inputText, Ie = C(
|
|
329
337
|
() => a ? a.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
|
|
330
338
|
[a]
|
|
331
|
-
),
|
|
332
|
-
|
|
333
|
-
), l =
|
|
334
|
-
direction:
|
|
335
|
-
language:
|
|
336
|
-
mermaidMessages:
|
|
337
|
-
beforeSend:
|
|
339
|
+
), Ge = S?.length ? S : oe.selectedValues || Ie, Ce = wt(
|
|
340
|
+
Ge
|
|
341
|
+
), l = v({
|
|
342
|
+
direction: H,
|
|
343
|
+
language: q,
|
|
344
|
+
mermaidMessages: M,
|
|
345
|
+
beforeSend: T,
|
|
338
346
|
locale: o,
|
|
339
347
|
onClickCustomButtonAfterContent: te,
|
|
340
|
-
onSend:
|
|
341
|
-
readonly:
|
|
342
|
-
renderContent:
|
|
348
|
+
onSend: A,
|
|
349
|
+
readonly: L,
|
|
350
|
+
renderContent: y,
|
|
343
351
|
resolvedConfirmButtonText: ue,
|
|
344
352
|
resolvedCopiedButtonText: me,
|
|
345
353
|
resolvedCopyButtonText: de,
|
|
@@ -348,15 +356,15 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
348
356
|
resolvedDefaultSelectedValues: Ce
|
|
349
357
|
});
|
|
350
358
|
l.current = {
|
|
351
|
-
direction:
|
|
352
|
-
language:
|
|
353
|
-
mermaidMessages:
|
|
354
|
-
beforeSend:
|
|
359
|
+
direction: H,
|
|
360
|
+
language: q,
|
|
361
|
+
mermaidMessages: M,
|
|
362
|
+
beforeSend: T,
|
|
355
363
|
locale: o,
|
|
356
364
|
onClickCustomButtonAfterContent: te,
|
|
357
|
-
onSend:
|
|
358
|
-
readonly:
|
|
359
|
-
renderContent:
|
|
365
|
+
onSend: A,
|
|
366
|
+
readonly: L,
|
|
367
|
+
renderContent: y,
|
|
360
368
|
resolvedConfirmButtonText: ue,
|
|
361
369
|
resolvedCopiedButtonText: me,
|
|
362
370
|
resolvedCopyButtonText: de,
|
|
@@ -364,7 +372,7 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
364
372
|
resolvedDefaultInputText: ye,
|
|
365
373
|
resolvedDefaultSelectedValues: Ce
|
|
366
374
|
};
|
|
367
|
-
const
|
|
375
|
+
const ke = C(
|
|
368
376
|
() => ({
|
|
369
377
|
"custom-button-after-content": ({
|
|
370
378
|
children: e
|
|
@@ -377,7 +385,7 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
377
385
|
}
|
|
378
386
|
),
|
|
379
387
|
"custom-variable": (e) => /* @__PURE__ */ r(
|
|
380
|
-
|
|
388
|
+
Ke,
|
|
381
389
|
{
|
|
382
390
|
...e,
|
|
383
391
|
readonly: l.current.readonly,
|
|
@@ -392,7 +400,7 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
392
400
|
confirmButtonText: l.current.resolvedConfirmButtonText
|
|
393
401
|
}
|
|
394
402
|
),
|
|
395
|
-
code:
|
|
403
|
+
code: xt,
|
|
396
404
|
table: ({ ...e }) => /* @__PURE__ */ r("div", { className: "content-render-table-container", children: /* @__PURE__ */ r("table", { className: "content-render-table", ...e }) }),
|
|
397
405
|
th: ({ ...e }) => /* @__PURE__ */ r("th", { className: "content-render-th", ...e }),
|
|
398
406
|
td: ({ ...e }) => /* @__PURE__ */ r("td", { className: "content-render-td", ...e }),
|
|
@@ -414,7 +422,7 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
414
422
|
) : /* @__PURE__ */ r("input", { ...e }),
|
|
415
423
|
a: ({ children: e, ...i }) => /* @__PURE__ */ r("a", { target: "_blank", rel: "noopener noreferrer", ...i, children: e }),
|
|
416
424
|
pre: (e) => /* @__PURE__ */ r(
|
|
417
|
-
|
|
425
|
+
je,
|
|
418
426
|
{
|
|
419
427
|
...e,
|
|
420
428
|
copyButtonText: l.current.resolvedCopyButtonText,
|
|
@@ -423,96 +431,96 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
423
431
|
)
|
|
424
432
|
}),
|
|
425
433
|
[]
|
|
426
|
-
),
|
|
427
|
-
() =>
|
|
428
|
-
[
|
|
434
|
+
), we = C(
|
|
435
|
+
() => ft.test(y),
|
|
436
|
+
[y]
|
|
429
437
|
), se = C(
|
|
430
|
-
() =>
|
|
431
|
-
[
|
|
432
|
-
),
|
|
438
|
+
() => we ? ot(y, !0) : [],
|
|
439
|
+
[y, we]
|
|
440
|
+
), Fe = se.some(
|
|
433
441
|
(e) => e.type === "sandbox"
|
|
434
|
-
), Fe = C(
|
|
435
|
-
() => Ct(se),
|
|
436
|
-
[se]
|
|
437
442
|
), _e = C(
|
|
443
|
+
() => yt(se),
|
|
444
|
+
[se]
|
|
445
|
+
), ze = C(
|
|
438
446
|
() => Be(ne),
|
|
439
447
|
[ne]
|
|
440
|
-
),
|
|
448
|
+
), We = (e, i) => {
|
|
441
449
|
const p = Se(e);
|
|
442
|
-
return Be(p).map((f,
|
|
443
|
-
const
|
|
450
|
+
return Be(p).map((f, $) => {
|
|
451
|
+
const x = `${i}-${f.type}-${$}`;
|
|
444
452
|
return f.type === "text" ? /* @__PURE__ */ r(
|
|
445
453
|
ce.Provider,
|
|
446
454
|
{
|
|
447
455
|
value: l,
|
|
448
456
|
children: /* @__PURE__ */ r(
|
|
449
|
-
|
|
457
|
+
Ae,
|
|
450
458
|
{
|
|
451
459
|
locale: o,
|
|
452
|
-
components:
|
|
460
|
+
components: ke,
|
|
453
461
|
content: f.value
|
|
454
462
|
}
|
|
455
463
|
)
|
|
456
464
|
},
|
|
457
|
-
|
|
465
|
+
x
|
|
458
466
|
) : f.type === "mermaid" ? /* @__PURE__ */ r(
|
|
459
467
|
ie,
|
|
460
468
|
{
|
|
461
469
|
chart: f.value,
|
|
462
470
|
frozen: !f.complete,
|
|
463
|
-
messages:
|
|
471
|
+
messages: M
|
|
464
472
|
},
|
|
465
|
-
|
|
466
|
-
) : f.type === "svg" ? /* @__PURE__ */ r(
|
|
473
|
+
x
|
|
474
|
+
) : f.type === "svg" ? /* @__PURE__ */ r(Ne, { svg: f.value }, x) : null;
|
|
467
475
|
});
|
|
468
476
|
};
|
|
469
|
-
return
|
|
477
|
+
return Fe ? /* @__PURE__ */ r(
|
|
470
478
|
"div",
|
|
471
479
|
{
|
|
472
480
|
className: "content-render markdown-body",
|
|
473
|
-
dir:
|
|
474
|
-
lang:
|
|
475
|
-
children:
|
|
481
|
+
dir: H,
|
|
482
|
+
lang: q,
|
|
483
|
+
children: _e.map(
|
|
476
484
|
(e, i) => e.type === "sandbox" ? /* @__PURE__ */ r(
|
|
477
|
-
|
|
485
|
+
et,
|
|
478
486
|
{
|
|
479
487
|
hideFullScreen: !0,
|
|
480
488
|
type: "sandbox",
|
|
481
489
|
content: e.value,
|
|
482
490
|
className: "content-render-iframe",
|
|
483
491
|
locale: o,
|
|
484
|
-
dir:
|
|
485
|
-
lang:
|
|
492
|
+
dir: H,
|
|
493
|
+
lang: q,
|
|
486
494
|
loadingText: Y,
|
|
487
495
|
styleLoadingText: Z,
|
|
488
|
-
scriptLoadingText:
|
|
489
|
-
disableLoadingOverlay:
|
|
490
|
-
fullScreenButtonText:
|
|
491
|
-
exitFullScreenButtonText:
|
|
496
|
+
scriptLoadingText: K,
|
|
497
|
+
disableLoadingOverlay: O,
|
|
498
|
+
fullScreenButtonText: Me,
|
|
499
|
+
exitFullScreenButtonText: $e,
|
|
492
500
|
mode: le
|
|
493
501
|
},
|
|
494
502
|
`sandbox-${i}`
|
|
495
|
-
) : /* @__PURE__ */ r(Q.Fragment, { children:
|
|
503
|
+
) : /* @__PURE__ */ r(Q.Fragment, { children: We(e.value, `md-${i}`) }, `md-${i}`)
|
|
496
504
|
)
|
|
497
505
|
}
|
|
498
|
-
) : /* @__PURE__ */
|
|
506
|
+
) : /* @__PURE__ */ He(
|
|
499
507
|
"div",
|
|
500
508
|
{
|
|
501
509
|
className: "content-render markdown-body",
|
|
502
|
-
dir:
|
|
503
|
-
lang:
|
|
510
|
+
dir: H,
|
|
511
|
+
lang: q,
|
|
504
512
|
children: [
|
|
505
|
-
|
|
513
|
+
ze.map((e, i) => {
|
|
506
514
|
if (e.type === "text")
|
|
507
515
|
return /* @__PURE__ */ r(
|
|
508
516
|
ce.Provider,
|
|
509
517
|
{
|
|
510
518
|
value: l,
|
|
511
519
|
children: /* @__PURE__ */ r(
|
|
512
|
-
|
|
520
|
+
Ae,
|
|
513
521
|
{
|
|
514
522
|
locale: o,
|
|
515
|
-
components:
|
|
523
|
+
components: ke,
|
|
516
524
|
content: e.value
|
|
517
525
|
}
|
|
518
526
|
)
|
|
@@ -525,24 +533,24 @@ const gt = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
|
|
|
525
533
|
{
|
|
526
534
|
chart: e.value,
|
|
527
535
|
frozen: !e.complete,
|
|
528
|
-
messages:
|
|
536
|
+
messages: M
|
|
529
537
|
},
|
|
530
538
|
i
|
|
531
539
|
);
|
|
532
540
|
if (e.type === "svg")
|
|
533
|
-
return /* @__PURE__ */ r(
|
|
541
|
+
return /* @__PURE__ */ r(Ne, { svg: e.value }, i);
|
|
534
542
|
}),
|
|
535
543
|
u && /* @__PURE__ */ r("div", { className: "content-render-custom-bar", children: Q.createElement(u, {
|
|
536
544
|
content: t,
|
|
537
545
|
displayContent: ne,
|
|
538
|
-
onSend:
|
|
546
|
+
onSend: A
|
|
539
547
|
}) })
|
|
540
548
|
]
|
|
541
549
|
}
|
|
542
550
|
);
|
|
543
551
|
};
|
|
544
552
|
export {
|
|
545
|
-
|
|
546
|
-
|
|
553
|
+
Ae as MarkdownRenderer,
|
|
554
|
+
tr as default
|
|
547
555
|
};
|
|
548
556
|
//# sourceMappingURL=ContentRender.es.js.map
|