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