markdown-flow-ui 0.1.129 → 0.2.0

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