markdown-flow-ui 0.1.120 → 0.1.121

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 (82) hide show
  1. package/dist/_virtual/index.cjs11.js +1 -1
  2. package/dist/_virtual/index.cjs12.js +1 -1
  3. package/dist/_virtual/index.cjs4.js +1 -1
  4. package/dist/_virtual/index.cjs5.js +1 -1
  5. package/dist/_virtual/index.cjs6.js +1 -1
  6. package/dist/_virtual/index.cjs8.js +1 -1
  7. package/dist/_virtual/index.cjs9.js +1 -1
  8. package/dist/_virtual/index.es10.js +2 -2
  9. package/dist/_virtual/index.es11.js +3 -3
  10. package/dist/_virtual/index.es12.js +2 -2
  11. package/dist/_virtual/index.es4.js +4 -4
  12. package/dist/_virtual/index.es5.js +4 -4
  13. package/dist/_virtual/index.es6.js +5 -5
  14. package/dist/_virtual/index.es8.js +3 -2
  15. package/dist/_virtual/index.es8.js.map +1 -1
  16. package/dist/_virtual/index.es9.js +2 -3
  17. package/dist/_virtual/index.es9.js.map +1 -1
  18. package/dist/assets/markdown-flow-ui.css +1 -1
  19. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  20. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  21. package/dist/components/ContentRender/ContentRender.d.ts +10 -1
  22. package/dist/components/ContentRender/ContentRender.es.js +221 -175
  23. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  24. package/dist/components/ContentRender/ContentRender.stories.d.ts +1 -3
  25. package/dist/components/ContentRender/index.d.ts +1 -2
  26. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  27. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  28. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +0 -3
  29. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +21 -29
  30. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  31. package/dist/components/Slide/Slide.cjs.js +1 -1
  32. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  33. package/dist/components/Slide/Slide.es.js +50 -51
  34. package/dist/components/Slide/Slide.es.js.map +1 -1
  35. package/dist/components/Slide/utils/runStreamFixture.d.ts +2 -0
  36. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  37. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  38. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  39. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js.map +1 -1
  40. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  41. package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
  42. package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
  43. package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
  44. package/dist/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  45. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
  46. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js.map +1 -1
  47. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
  48. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
  49. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js.map +1 -1
  50. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
  51. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
  52. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js.map +1 -1
  53. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
  54. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
  55. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js.map +1 -1
  56. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
  57. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
  58. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js.map +1 -1
  59. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
  60. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.cjs.js +1 -1
  61. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.es.js +1 -1
  62. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.cjs.js +1 -1
  63. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/ResizableTextArea.es.js +1 -1
  64. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.cjs.js +1 -1
  65. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/TextArea.es.js +1 -1
  66. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
  67. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.es.js +1 -1
  68. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js +1 -1
  69. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js.map +1 -1
  70. package/dist/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.es.js +1 -1
  71. package/dist/markdown-flow-ui/node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.cjs.js +1 -1
  72. package/dist/markdown-flow-ui/node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.es.js +1 -1
  73. package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
  74. package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
  75. package/dist/markdown-flow-ui-lib.css +1 -1
  76. package/package.json +2 -3
  77. package/dist/components/ContentRender/useTypewriter.d.ts +0 -19
  78. package/dist/components/ContentRender/useTypewriterStateMachine.cjs.js +0 -2
  79. package/dist/components/ContentRender/useTypewriterStateMachine.cjs.js.map +0 -1
  80. package/dist/components/ContentRender/useTypewriterStateMachine.d.ts +0 -19
  81. package/dist/components/ContentRender/useTypewriterStateMachine.es.js +0 -180
  82. package/dist/components/ContentRender/useTypewriterStateMachine.es.js.map +0 -1
@@ -1,89 +1,88 @@
1
1
  import { j as t } from "../../_virtual/jsx-runtime.es.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
- import X, { useMemo as h, useRef as E, useEffect as F } from "react";
5
- import se from "../../_virtual/index.es.js";
6
- import { sanitizeInvalidTagName as oe } from "./utils/sanitize-invalid-tag-name.es.js";
7
- import { stripSvgTextLineBreaks as ae } from "./utils/strip-svg-text-line-breaks.es.js";
4
+ import Z, { useState as pe, useRef as V, useEffect as S, useMemo as g } from "react";
5
+ import he from "../../_virtual/index.es.js";
6
+ import { sanitizeInvalidTagName as fe } from "./utils/sanitize-invalid-tag-name.es.js";
7
+ import { stripSvgTextLineBreaks as xe } from "./utils/strip-svg-text-line-breaks.es.js";
8
8
  /* empty css */
9
9
  /* empty css */
10
- import ie from "./CodeBlock.es.js";
11
- import le from "./plugins/CustomVariable.es.js";
12
- import W from "./plugins/MermaidChart.es.js";
13
- import ce from "./useTypewriterStateMachine.es.js";
14
- import { preserveCustomVariableProperties as me, restoreCustomVariableProperties as de } from "./utils/custom-variable-props.es.js";
15
- import { subsetLanguages as ue, highlightLanguages as pe } from "./utils/highlight-languages.es.js";
16
- import { parseMarkdownSegments as J, mermaidBlockIsComplete as he } from "./utils/mermaid-parse.es.js";
17
- import { normalizeInlineHtml as Q } from "./utils/normalize-inline-html.es.js";
18
- import fe from "./IframeSandbox.es.js";
19
- import { splitContentSegments as xe } from "./utils/split-content.es.js";
20
- import { getInteractionDefaultValues as ve } from "../../lib/interaction-defaults.es.js";
21
- import { Markdown as ge } from "../../markdown-flow-ui/node_modules/.pnpm/react-markdown@10.1.0_@types_react@19.2.2_react@19.0.1/node_modules/react-markdown/lib/index.es.js";
22
- import be from "../../markdown-flow-ui/node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.es.js";
23
- import ye from "../../markdown-flow-ui/node_modules/.pnpm/rehype-highlight@7.0.2/node_modules/rehype-highlight/lib/index.es.js";
24
- import Ne from "../../markdown-flow-ui/node_modules/.pnpm/rehype-katex@7.0.1/node_modules/rehype-katex/lib/index.es.js";
25
- import je from "../../markdown-flow-ui/node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.es.js";
26
- import ke from "../../markdown-flow-ui/node_modules/.pnpm/remark-math@6.0.0/node_modules/remark-math/lib/index.es.js";
27
- import we from "../../markdown-flow-ui/node_modules/.pnpm/remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.es.js";
28
- const Se = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, Y = ({ svg: r }) => {
29
- const o = E(null);
30
- return F(() => {
10
+ import ge from "./CodeBlock.es.js";
11
+ import ye from "./plugins/CustomVariable.es.js";
12
+ import q from "./plugins/MermaidChart.es.js";
13
+ import { preserveCustomVariableProperties as ve, restoreCustomVariableProperties as be } from "./utils/custom-variable-props.es.js";
14
+ import { subsetLanguages as we, highlightLanguages as ke } from "./utils/highlight-languages.es.js";
15
+ import { parseMarkdownSegments as ee, mermaidBlockIsComplete as je } from "./utils/mermaid-parse.es.js";
16
+ import { normalizeInlineHtml as te } from "./utils/normalize-inline-html.es.js";
17
+ import Ne from "./IframeSandbox.es.js";
18
+ import { splitContentSegments as Te } from "./utils/split-content.es.js";
19
+ import { getInteractionDefaultValues as Ce } from "../../lib/interaction-defaults.es.js";
20
+ import { Markdown as Se } from "../../markdown-flow-ui/node_modules/.pnpm/react-markdown@10.1.0_@types_react@19.2.2_react@19.0.1/node_modules/react-markdown/lib/index.es.js";
21
+ import Re from "../../markdown-flow-ui/node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.es.js";
22
+ import Be from "../../markdown-flow-ui/node_modules/.pnpm/rehype-highlight@7.0.2/node_modules/rehype-highlight/lib/index.es.js";
23
+ import Le from "../../markdown-flow-ui/node_modules/.pnpm/rehype-katex@7.0.1/node_modules/rehype-katex/lib/index.es.js";
24
+ import Ae from "../../markdown-flow-ui/node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.es.js";
25
+ import $e from "../../markdown-flow-ui/node_modules/.pnpm/remark-math@6.0.0/node_modules/remark-math/lib/index.es.js";
26
+ import ze from "../../markdown-flow-ui/node_modules/.pnpm/remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.es.js";
27
+ const Me = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)\b/i, re = ({ svg: r }) => {
28
+ const o = V(null);
29
+ return S(() => {
31
30
  const a = o.current;
32
31
  if (!a) return;
33
- const i = a.shadowRoot ?? a.attachShadow({ mode: "open" }), y = "content-render-svg-style";
34
- let l = i.getElementById(y);
35
- l || (l = document.createElement("style"), l.id = y, l.textContent = `
32
+ const i = a.shadowRoot ?? a.attachShadow({ mode: "open" }), R = "content-render-svg-style";
33
+ let f = i.getElementById(R);
34
+ f || (f = document.createElement("style"), f.id = R, f.textContent = `
36
35
  svg { height: auto; display: inline-block; }
37
36
  svg.content-render-svg-el--responsive { width: 100%; max-width: 100%; }
38
37
  svg.content-render-svg-el--fixed { max-width: none; }
39
- `, i.appendChild(l)), Array.from(i.childNodes).filter(
40
- (n) => n !== l
41
- ).forEach((n) => i.removeChild(n));
42
- const T = document.createElement("template"), z = ae(r);
43
- T.innerHTML = z, i.append(T.content.cloneNode(!0));
44
- let N = !1, C = !1;
45
- i.querySelectorAll("svg").forEach((n) => {
46
- const L = n.getAttribute("viewBox");
47
- if (!L) return;
48
- const k = L.trim().split(/[\s,]+/).map((c) => Number(c));
49
- if (k.length !== 4 || k.some(Number.isNaN)) return;
50
- const [, , f, p] = k, x = n.getAttribute("width"), v = n.getAttribute("height"), B = (c) => {
38
+ `, i.appendChild(f)), Array.from(i.childNodes).filter(
39
+ (s) => s !== f
40
+ ).forEach((s) => i.removeChild(s));
41
+ const N = document.createElement("template"), y = xe(r);
42
+ N.innerHTML = y, i.append(N.content.cloneNode(!0));
43
+ let T = !1, B = !1;
44
+ i.querySelectorAll("svg").forEach((s) => {
45
+ const A = s.getAttribute("viewBox");
46
+ if (!A) return;
47
+ const C = A.trim().split(/[\s,]+/).map((c) => Number(c));
48
+ if (C.length !== 4 || C.some(Number.isNaN)) return;
49
+ const [, , b, v] = C, w = s.getAttribute("width"), k = s.getAttribute("height"), $ = (c) => {
51
50
  if (!c) return !1;
52
- const m = c.trim().toLowerCase();
53
- return m === "auto" || m.endsWith("%");
54
- }, A = (c) => {
51
+ const u = c.trim().toLowerCase();
52
+ return u === "auto" || u.endsWith("%");
53
+ }, z = (c) => {
55
54
  if (!c) return null;
56
- const m = c.trim().toLowerCase();
57
- if (m === "auto" || m.endsWith("%"))
55
+ const u = c.trim().toLowerCase();
56
+ if (u === "auto" || u.endsWith("%"))
58
57
  return null;
59
- const S = Number.parseFloat(m);
60
- return Number.isNaN(S) ? null : S;
61
- }, M = B(x), I = B(v), w = !x || x === "0", g = !v || v === "0", V = A(x), H = A(v);
62
- if (M || I || w && g || V === f && H === p) {
63
- N = !0, n.classList.add("content-render-svg-el--responsive"), n.classList.remove("content-render-svg-el--fixed"), n.style.width = "100%", n.style.height = "auto", !n.style.aspectRatio && p > 0 && (n.style.aspectRatio = `${f} / ${p}`);
58
+ const p = Number.parseFloat(u);
59
+ return Number.isNaN(p) ? null : p;
60
+ }, D = $(w), P = $(k), M = !w || w === "0", I = !k || k === "0", K = z(w), l = z(k);
61
+ if (D || P || M && I || K === b && l === v) {
62
+ T = !0, s.classList.add("content-render-svg-el--responsive"), s.classList.remove("content-render-svg-el--fixed"), s.style.width = "100%", s.style.height = "auto", !s.style.aspectRatio && v > 0 && (s.style.aspectRatio = `${b} / ${v}`);
64
63
  return;
65
64
  }
66
- C = !0, n.classList.add("content-render-svg-el--fixed"), n.classList.remove("content-render-svg-el--responsive"), w && f > 0 && n.setAttribute("width", `${f}`), g && p > 0 && n.setAttribute("height", `${p}`);
65
+ B = !0, s.classList.add("content-render-svg-el--fixed"), s.classList.remove("content-render-svg-el--responsive"), M && b > 0 && s.setAttribute("width", `${b}`), I && v > 0 && s.setAttribute("height", `${v}`);
67
66
  });
68
- const j = N && !C;
69
- a.classList.toggle("content-render-svg--responsive", j), a.classList.toggle("content-render-svg--fixed", !j);
67
+ const L = T && !B;
68
+ a.classList.toggle("content-render-svg--responsive", L), a.classList.toggle("content-render-svg--fixed", !L);
70
69
  }, [r]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref: o }) });
71
- }, Re = [je, ke, se, we], Te = [
72
- me,
70
+ }, Ie = [Ae, $e, he, ze], Ve = [
71
+ ve,
72
+ Re,
73
+ fe,
73
74
  be,
74
- oe,
75
- de,
76
- [ye, { languages: pe, subset: ue }],
77
- Ne
78
- ], Z = ({ content: r, components: o }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-renderer", children: /* @__PURE__ */ t.jsx(
79
- ge,
75
+ [Be, { languages: ke, subset: we }],
76
+ Le
77
+ ], ne = ({ content: r, components: o }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-renderer", children: /* @__PURE__ */ t.jsx(
78
+ Se,
80
79
  {
81
- remarkPlugins: Re,
82
- rehypePlugins: Te,
80
+ remarkPlugins: Ie,
81
+ rehypePlugins: Ve,
83
82
  components: o,
84
83
  children: r
85
84
  }
86
- ) }), Ce = (r) => {
85
+ ) }), He = (r) => {
87
86
  if (r.length <= 1) return r;
88
87
  const o = [];
89
88
  return r.forEach((a) => {
@@ -101,46 +100,105 @@ const Se = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
101
100
  }
102
101
  o.push({ type: "markdown", value: a.value });
103
102
  }), o;
104
- }, rt = ({
103
+ }, De = (r, o) => {
104
+ const a = Math.max(1, o), i = Array.from(r);
105
+ return {
106
+ chunk: i.slice(0, a).join(""),
107
+ rest: i.slice(a).join("")
108
+ };
109
+ }, dt = ({
105
110
  content: r,
106
- customRenderBar: o,
107
- onSend: a,
108
- typingSpeed: i = 30,
109
- enableTypewriter: y = !1,
110
- userInput: l,
111
- interactionDefaultValueOptions: $,
112
- defaultButtonText: T,
113
- defaultInputText: z,
114
- defaultSelectedValues: N,
115
- readonly: C = !1,
116
- onTypeFinished: j,
117
- confirmButtonText: n,
118
- copyButtonText: L,
119
- copiedButtonText: k,
120
- sandboxLoadingText: f,
121
- sandboxStyleLoadingText: p,
122
- sandboxScriptLoadingText: x,
123
- disableSandboxLoadingOverlay: v = !1,
124
- sandboxFullscreenButtonText: B,
125
- sandboxMode: A = "content",
111
+ contentType: o,
112
+ customRenderBar: a,
113
+ onSend: i,
114
+ typingSpeed: R = 40,
115
+ enableTypewriter: f = !1,
116
+ onTypeFinished: H,
117
+ onTypewriterStateChange: N,
118
+ userInput: y,
119
+ interactionDefaultValueOptions: T,
120
+ defaultButtonText: B,
121
+ defaultInputText: L,
122
+ defaultSelectedValues: s,
123
+ readonly: A = !1,
124
+ confirmButtonText: C,
125
+ copyButtonText: b,
126
+ copiedButtonText: v,
127
+ sandboxLoadingText: w,
128
+ sandboxStyleLoadingText: k,
129
+ sandboxScriptLoadingText: $,
130
+ disableSandboxLoadingOverlay: z = !1,
131
+ sandboxFullscreenButtonText: D,
132
+ sandboxMode: P = "content",
126
133
  onClickCustomButtonAfterContent: M,
127
134
  beforeSend: I
128
135
  // tooltipMinLength,
129
136
  }) => {
130
- const w = h(
131
- () => Q(r),
132
- [r]
133
- ), g = h(
134
- () => ve(
135
- r,
136
- l,
137
- $
137
+ const l = !!f && (!o || o === "text"), W = 2, _ = Math.max(0, R), [c, u] = pe(
138
+ () => l ? "" : r
139
+ ), p = V(""), O = V(l), F = V(!1);
140
+ S(() => {
141
+ const e = O.current;
142
+ if (O.current = l, F.current = !1, !l) {
143
+ p.current = "", u(r);
144
+ return;
145
+ }
146
+ u((n) => {
147
+ const m = !e, x = r.startsWith(n);
148
+ if (!m && !x)
149
+ return p.current = "", r;
150
+ const d = m || !x ? "" : n;
151
+ return p.current = r.slice(d.length), d;
152
+ });
153
+ }, [r, l]), S(() => {
154
+ l && (F.current || p.current || c !== r || (F.current = !0, H?.()));
155
+ }, [r, c, l, H]), S(() => {
156
+ if (!l || !p.current)
157
+ return;
158
+ const e = window.setTimeout(() => {
159
+ u((n) => {
160
+ const { chunk: m, rest: x } = De(
161
+ p.current,
162
+ W
163
+ );
164
+ return m ? (p.current = x, `${n}${m}`) : n;
165
+ });
166
+ }, _);
167
+ return () => window.clearTimeout(e);
168
+ }, [
169
+ r,
170
+ c,
171
+ l,
172
+ W,
173
+ _
174
+ ]);
175
+ const X = g(
176
+ () => ({
177
+ isTypewriterEnabled: l,
178
+ isTyping: l && c !== r,
179
+ isComplete: c === r,
180
+ renderedLength: c.length,
181
+ totalLength: r.length
182
+ }),
183
+ [r, c, l]
184
+ );
185
+ S(() => {
186
+ N?.(X);
187
+ }, [N, X]);
188
+ const h = l ? c : r, E = g(
189
+ () => te(h),
190
+ [h]
191
+ ), G = g(
192
+ () => Ce(
193
+ h,
194
+ y,
195
+ T
138
196
  ),
139
- [r, $, l]
140
- ), V = T?.trim() || g.buttonText, H = z?.trim() || g.inputText, G = h(
141
- () => l ? l.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
142
- [l]
143
- ), U = N?.length ? N : g.selectedValues || G, c = {
197
+ [T, h, y]
198
+ ), se = B?.trim() || G.buttonText, oe = L?.trim() || G.inputText, ae = g(
199
+ () => y ? y.split(",").map((e) => e.trim()).filter(Boolean) : void 0,
200
+ [y]
201
+ ), ie = s?.length ? s : G.selectedValues || ae, J = {
144
202
  "custom-button-after-content": ({
145
203
  children: e
146
204
  }) => /* @__PURE__ */ t.jsx(
@@ -152,33 +210,33 @@ const Se = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
152
210
  }
153
211
  ),
154
212
  "custom-variable": (e) => /* @__PURE__ */ t.jsx(
155
- le,
213
+ ye,
156
214
  {
157
215
  ...e,
158
- readonly: C,
159
- defaultButtonText: V,
160
- defaultInputText: H,
161
- defaultSelectedValues: U,
162
- onSend: a,
216
+ readonly: A,
217
+ defaultButtonText: se,
218
+ defaultInputText: oe,
219
+ defaultSelectedValues: ie,
220
+ onSend: i,
163
221
  beforeSend: I,
164
- confirmButtonText: n
222
+ confirmButtonText: C
165
223
  }
166
224
  ),
167
225
  code: (e) => {
168
- const { className: s, children: d, ..._ } = e;
169
- if (/language-(\w+)/.exec(s || "")?.[1] === "mermaid") {
170
- const b = d?.toString().replace(/\n$/, "") || "", ne = he(r, b);
171
- return /* @__PURE__ */ t.jsx(W, { chart: b, frozen: ne });
226
+ const { className: n, children: m, ...x } = e;
227
+ if (/language-(\w+)/.exec(n || "")?.[1] === "mermaid") {
228
+ const j = m?.toString().replace(/\n$/, "") || "", ue = je(h, j);
229
+ return /* @__PURE__ */ t.jsx(q, { chart: j, frozen: ue });
172
230
  }
173
- return /* @__PURE__ */ t.jsx("code", { className: s, ..._, children: d });
231
+ return /* @__PURE__ */ t.jsx("code", { className: n, ...x, children: m });
174
232
  },
175
233
  table: ({ ...e }) => /* @__PURE__ */ t.jsx("div", { className: "content-render-table-container", children: /* @__PURE__ */ t.jsx("table", { className: "content-render-table", ...e }) }),
176
234
  th: ({ ...e }) => /* @__PURE__ */ t.jsx("th", { className: "content-render-th", ...e }),
177
235
  td: ({ ...e }) => /* @__PURE__ */ t.jsx("td", { className: "content-render-td", ...e }),
178
236
  tr: ({ ...e }) => /* @__PURE__ */ t.jsx("tr", { className: "content-render-tr", ...e }),
179
- li: ({ node: e, ...s }) => {
180
- const d = e?.properties?.className;
181
- return typeof d == "string" && d.includes("task-list-item") || Array.isArray(d) && d.includes("task-list-item") ? /* @__PURE__ */ t.jsx("li", { className: "content-render-task-list-item", ...s }) : /* @__PURE__ */ t.jsx("li", { ...s });
237
+ li: ({ node: e, ...n }) => {
238
+ const m = e?.properties?.className;
239
+ return typeof m == "string" && m.includes("task-list-item") || Array.isArray(m) && m.includes("task-list-item") ? /* @__PURE__ */ t.jsx("li", { className: "content-render-task-list-item", ...n }) : /* @__PURE__ */ t.jsx("li", { ...n });
182
240
  },
183
241
  ol: ({ ...e }) => /* @__PURE__ */ t.jsx("ol", { className: "content-render-ol", ...e }),
184
242
  ul: ({ ...e }) => /* @__PURE__ */ t.jsx("ul", { className: "content-render-ul", ...e }),
@@ -191,104 +249,92 @@ const Se = /<(script|style|link|iframe|html|head|body|meta|title|base|template|d
191
249
  ...e
192
250
  }
193
251
  ) : /* @__PURE__ */ t.jsx("input", { ...e }),
194
- a: ({ children: e, ...s }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...s, children: e }),
252
+ a: ({ children: e, ...n }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...n, children: e }),
195
253
  pre: (e) => /* @__PURE__ */ t.jsx(
196
- ie,
254
+ ge,
197
255
  {
198
256
  ...e,
199
- copyButtonText: L,
200
- copiedButtonText: k
257
+ copyButtonText: b,
258
+ copiedButtonText: v
201
259
  }
202
260
  )
203
- }, { displayContent: m, isComplete: S } = ce({
204
- // processMarkdownText will let code block printf("You win!\n") become printf("You win!<br/>");
205
- // content: processMarkdownText(content),
206
- content: w,
207
- typingSpeed: i,
208
- disabled: !y
209
- }), q = y ? m : w, K = h(
210
- () => Se.test(r),
211
- [r]
212
- ), D = h(
213
- () => K ? xe(r, !0) : [],
214
- [r, K]
215
- ), R = D.some(
261
+ }, Q = g(
262
+ () => Me.test(h),
263
+ [h]
264
+ ), U = g(
265
+ () => Q ? Te(h, !0) : [],
266
+ [h, Q]
267
+ ), ce = U.some(
216
268
  (e) => e.type === "sandbox"
217
- ), ee = h(
218
- () => Ce(D),
219
- [D]
220
- ), te = h(
221
- () => J(q),
222
- [q]
223
- ), P = E(!1);
224
- F(() => {
225
- R || S && !P.current && (P.current = !0, j?.());
226
- }, [R, S, j]), F(() => {
227
- R || (P.current = !1);
228
- }, [R, r]);
229
- const re = (e, s) => {
230
- const d = Q(e);
231
- return J(d).map((u, O) => {
232
- const b = `${s}-${u.type}-${O}`;
233
- return u.type === "text" ? /* @__PURE__ */ t.jsx(
234
- Z,
269
+ ), le = g(
270
+ () => He(U),
271
+ [U]
272
+ ), me = g(
273
+ () => ee(E),
274
+ [E]
275
+ ), de = (e, n) => {
276
+ const m = te(e);
277
+ return ee(m).map((d, Y) => {
278
+ const j = `${n}-${d.type}-${Y}`;
279
+ return d.type === "text" ? /* @__PURE__ */ t.jsx(
280
+ ne,
235
281
  {
236
- components: c,
237
- content: u.value
282
+ components: J,
283
+ content: d.value
238
284
  },
239
- b
240
- ) : u.type === "mermaid" ? /* @__PURE__ */ t.jsx(W, { chart: u.value, frozen: !u.complete }, b) : u.type === "svg" ? /* @__PURE__ */ t.jsx(Y, { svg: u.value }, b) : null;
285
+ j
286
+ ) : d.type === "mermaid" ? /* @__PURE__ */ t.jsx(q, { chart: d.value, frozen: !d.complete }, j) : d.type === "svg" ? /* @__PURE__ */ t.jsx(re, { svg: d.value }, j) : null;
241
287
  });
242
288
  };
243
- return R ? /* @__PURE__ */ t.jsx("div", { className: "content-render markdown-body", children: ee.map(
244
- (e, s) => e.type === "sandbox" ? /* @__PURE__ */ t.jsx(
245
- fe,
289
+ return ce ? /* @__PURE__ */ t.jsx("div", { className: "content-render markdown-body", children: le.map(
290
+ (e, n) => e.type === "sandbox" ? /* @__PURE__ */ t.jsx(
291
+ Ne,
246
292
  {
247
293
  hideFullScreen: !0,
248
294
  type: "sandbox",
249
295
  content: e.value,
250
296
  className: "content-render-iframe",
251
- loadingText: f,
252
- styleLoadingText: p,
253
- scriptLoadingText: x,
254
- disableLoadingOverlay: v,
255
- fullScreenButtonText: B,
256
- mode: A
297
+ loadingText: w,
298
+ styleLoadingText: k,
299
+ scriptLoadingText: $,
300
+ disableLoadingOverlay: z,
301
+ fullScreenButtonText: D,
302
+ mode: P
257
303
  },
258
- `sandbox-${s}`
259
- ) : /* @__PURE__ */ t.jsx(X.Fragment, { children: re(e.value, `md-${s}`) }, `md-${s}`)
304
+ `sandbox-${n}`
305
+ ) : /* @__PURE__ */ t.jsx(Z.Fragment, { children: de(e.value, `md-${n}`) }, `md-${n}`)
260
306
  ) }) : /* @__PURE__ */ t.jsxs("div", { className: "content-render markdown-body", children: [
261
- te.map((e, s) => {
307
+ me.map((e, n) => {
262
308
  if (e.type === "text")
263
309
  return /* @__PURE__ */ t.jsx(
264
- Z,
310
+ ne,
265
311
  {
266
- components: c,
312
+ components: J,
267
313
  content: e.value
268
314
  },
269
- s
315
+ n
270
316
  );
271
317
  if (e.type === "mermaid")
272
318
  return /* @__PURE__ */ t.jsx(
273
- W,
319
+ q,
274
320
  {
275
321
  chart: e.value,
276
322
  frozen: !e.complete
277
323
  },
278
- s
324
+ n
279
325
  );
280
326
  if (e.type === "svg")
281
- return /* @__PURE__ */ t.jsx(Y, { svg: e.value }, s);
327
+ return /* @__PURE__ */ t.jsx(re, { svg: e.value }, n);
282
328
  }),
283
- o && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: X.createElement(o, {
329
+ a && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: Z.createElement(a, {
284
330
  content: r,
285
- displayContent: m,
286
- onSend: a
331
+ displayContent: E,
332
+ onSend: i
287
333
  }) })
288
334
  ] });
289
335
  };
290
336
  export {
291
- Z as MarkdownRenderer,
292
- rt as default
337
+ ne as MarkdownRenderer,
338
+ dt as default
293
339
  };
294
340
  //# sourceMappingURL=ContentRender.es.js.map