markdown-flow-ui 0.3.5 → 0.3.6

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