markdown-flow-ui 0.2.30 → 0.2.32

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