markdown-flow-ui 0.1.81-beta.16 → 0.1.81-beta.18

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 (43) hide show
  1. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.js +1 -1
  2. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.js +1 -1
  3. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.js +1 -1
  4. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.js +1 -1
  5. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.js +1 -1
  6. package/dist/Documents/ai-shifu/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.js +1 -1
  7. package/dist/Documents/ai-shifu/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.js +1 -1
  8. package/dist/Documents/ai-shifu/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.js +1 -1
  9. package/dist/Documents/ai-shifu/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.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/index.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.js +1 -1
  12. package/dist/_virtual/index2.js +2 -5
  13. package/dist/_virtual/index2.js.map +1 -1
  14. package/dist/_virtual/index3.js +5 -2
  15. package/dist/_virtual/index3.js.map +1 -1
  16. package/dist/_virtual/index7.js +3 -2
  17. package/dist/_virtual/index7.js.map +1 -1
  18. package/dist/_virtual/index9.js +2 -3
  19. package/dist/_virtual/index9.js.map +1 -1
  20. package/dist/components/ContentRender/ContentRender.d.ts +5 -0
  21. package/dist/components/ContentRender/ContentRender.js +139 -141
  22. package/dist/components/ContentRender/ContentRender.js.map +1 -1
  23. package/dist/components/ContentRender/ContentRender.stories.d.ts +1 -0
  24. package/dist/components/ContentRender/IframeSandbox.d.ts +5 -0
  25. package/dist/components/ContentRender/IframeSandbox.js +71 -32
  26. package/dist/components/ContentRender/IframeSandbox.js.map +1 -1
  27. package/dist/components/ContentRender/SandboxApp.d.ts +5 -0
  28. package/dist/components/ContentRender/SandboxApp.js +194 -16
  29. package/dist/components/ContentRender/SandboxApp.js.map +1 -1
  30. package/dist/components/ContentRender/index.d.ts +5 -0
  31. package/dist/components/ContentRender/index.js +2 -1
  32. package/dist/components/ContentRender/index.js.map +1 -1
  33. package/dist/components/ContentRender/utils/split-content.d.ts +8 -0
  34. package/dist/components/ContentRender/utils/split-content.js +18 -0
  35. package/dist/components/ContentRender/utils/split-content.js.map +1 -0
  36. package/dist/components/MarkdownFlow/MarkdownFlow.js +4 -3
  37. package/dist/components/MarkdownFlow/MarkdownFlow.js.map +1 -1
  38. package/dist/components/ui/inputGroup/textarea.js +1 -1
  39. package/dist/index.js +9 -8
  40. package/dist/index.js.map +1 -1
  41. package/dist/renderer.js +5 -4
  42. package/dist/renderer.js.map +1 -1
  43. package/package.json +1 -1
@@ -4,7 +4,7 @@ import { setAccDescription as Be, getAccDescription as Ie, getAccTitle as Me, se
4
4
  import { __name as g, log as fe } from "./chunk-AGHRB4JF.js";
5
5
  import "../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js";
6
6
  import "../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
7
- import { d as je } from "../../../../../../../../../../../_virtual/index9.js";
7
+ import { d as je } from "../../../../../../../../../../../_virtual/index7.js";
8
8
  import jt from "../../../../../../d3-selection@3.0.0/node_modules/d3-selection/src/select.js";
9
9
  var Ft = (function() {
10
10
  var e = /* @__PURE__ */ g(function(_t, x, m, v) {
@@ -1,6 +1,6 @@
1
1
  import { common_default as b, assignWithDepth_default as E, directiveRegex as $, sanitizeDirective as X, detectType as Y } from "./chunk-ABZYJK2D.js";
2
2
  import { __name as s, log as g } from "./chunk-AGHRB4JF.js";
3
- import { d as G } from "../../../../../../../../../../../_virtual/index9.js";
3
+ import { d as G } from "../../../../../../../../../../../_virtual/index7.js";
4
4
  import "../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js";
5
5
  import "../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
6
6
  import w from "../../../../../../lodash-es@4.17.21/node_modules/lodash-es/memoize.js";
@@ -1,6 +1,6 @@
1
1
  import { lineBreakRegex as o } from "./chunk-ABZYJK2D.js";
2
2
  import { __name as n } from "./chunk-AGHRB4JF.js";
3
- import { d as l } from "../../../../../../../../../../../_virtual/index9.js";
3
+ import { d as l } from "../../../../../../../../../../../_virtual/index7.js";
4
4
  var x = /* @__PURE__ */ n((s, t) => {
5
5
  const r = s.append("rect");
6
6
  if (r.attr("x", t.x), r.attr("y", t.y), r.attr("fill", t.fill), r.attr("stroke", t.stroke), r.attr("width", t.width), r.attr("height", t.height), t.name && r.attr("name", t.name), t.rx && r.attr("rx", t.rx), t.ry && r.attr("ry", t.ry), t.attrs !== void 0)
@@ -1,7 +1,7 @@
1
1
  import { utils_default as ie } from "./chunk-S3R3BYOJ.js";
2
2
  import { getAccDescription as se, setAccDescription as ne, getDiagramTitle as ae, setDiagramTitle as oe, getAccTitle as ce, setAccTitle as le, getConfig2 as K, configureSvgSize as ue, common_default as de, clear as fe } from "./chunk-ABZYJK2D.js";
3
3
  import { __name as c, log as mt } from "./chunk-AGHRB4JF.js";
4
- import { d as he } from "../../../../../../../../../../../_virtual/index9.js";
4
+ import { d as he } from "../../../../../../../../../../../_virtual/index7.js";
5
5
  import L from "../../../../../../../../../../../_virtual/dayjs.min.js";
6
6
  import me from "../../../../../../../../../../../_virtual/isoWeek.js";
7
7
  import ke from "../../../../../../../../../../../_virtual/customParseFormat.js";
@@ -6,7 +6,7 @@ import { setConfig2 as ke, getConfig2 as st, configureSvgSize as Pe, assignWithD
6
6
  import { __name as f, log as Q } from "./chunk-AGHRB4JF.js";
7
7
  import "../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js";
8
8
  import "../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
9
- import { d as ne } from "../../../../../../../../../../../_virtual/index9.js";
9
+ import { d as ne } from "../../../../../../../../../../../_virtual/index7.js";
10
10
  import Mt from "../../../../../../d3-selection@3.0.0/node_modules/d3-selection/src/select.js";
11
11
  var Ut = (function() {
12
12
  var e = /* @__PURE__ */ f(function(pt, v, A, L) {
@@ -2,7 +2,7 @@ import $ from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
2
2
  import oe from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/extends.js";
3
3
  import r from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/defineProperty.js";
4
4
  import te from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/typeof.js";
5
- import d from "../../../../../../../../../_virtual/index2.js";
5
+ import d from "../../../../../../../../../_virtual/index3.js";
6
6
  import l, { useRef as q, cloneElement as ie } from "react";
7
7
  import { hasPrefixSuffix as re, hasAddon as de } from "./utils/commonUtils.js";
8
8
  var xe = /* @__PURE__ */ l.forwardRef(function(e, z) {
@@ -4,7 +4,7 @@ import w from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
4
4
  import J from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/typeof.js";
5
5
  import s from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/slicedToArray.js";
6
6
  import K from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js";
7
- import Q from "../../../../../../../../../_virtual/index2.js";
7
+ import Q from "../../../../../../../../../_virtual/index3.js";
8
8
  import ee from "../../../../rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
9
9
  import M from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
10
10
  import te from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useMergedState.js";
@@ -4,7 +4,7 @@ import d from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/hel
4
4
  import Ae from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js";
5
5
  import x from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/slicedToArray.js";
6
6
  import Fe from "../../../../@babel_runtime@7.28.4/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js";
7
- import h from "../../../../../../../../../_virtual/index2.js";
7
+ import h from "../../../../../../../../../_virtual/index3.js";
8
8
  import Ne from "../../../../rc-input@1.8.0_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-input/es/BaseInput.js";
9
9
  import Te from "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useMergedState.js";
10
10
  import o, { useRef as Y, useImperativeHandle as $e, useEffect as Ie } from "react";
@@ -1,5 +1,5 @@
1
1
  import t from "./TextArea.js";
2
- import "../../../../../../../../../_virtual/index2.js";
2
+ import "../../../../../../../../../_virtual/index3.js";
3
3
  import "../../../../rc-resize-observer@1.4.3_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-resize-observer/es/index.js";
4
4
  import "../../../../rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/hooks/useLayoutEffect.js";
5
5
  import "react";
@@ -1,4 +1,4 @@
1
- import { __exports as e } from "../../../../../../../../../_virtual/index3.js";
1
+ import { __exports as e } from "../../../../../../../../../_virtual/index2.js";
2
2
  import { __require as _ } from "./remark-custom-variable.js";
3
3
  import { __require as m } from "./remark-flow.js";
4
4
  import { __require as f } from "./remark-interaction.js";
@@ -1,4 +1,4 @@
1
- import { __exports as r } from "../../../../../../../../../_virtual/index7.js";
1
+ import { __exports as r } from "../../../../../../../../../_virtual/index9.js";
2
2
  import { __require as p } from "../../../../inline-style-parser@0.2.4/node_modules/inline-style-parser/index.js";
3
3
  var f;
4
4
  function q() {
@@ -1,8 +1,5 @@
1
- import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
- import { __require as s } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js";
3
- var e = s();
4
- const t = /* @__PURE__ */ r(e);
1
+ var r = {};
5
2
  export {
6
- t as default
3
+ r as __exports
7
4
  };
8
5
  //# sourceMappingURL=index2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,5 +1,8 @@
1
- var r = {};
1
+ import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
2
+ import { __require as s } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js";
3
+ var e = s();
4
+ const t = /* @__PURE__ */ r(e);
2
5
  export {
3
- r as __exports
6
+ t as default
4
7
  };
5
8
  //# sourceMappingURL=index3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,5 +1,6 @@
1
- var r = {};
1
+ import { __require as r } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js";
2
+ var i = r();
2
3
  export {
3
- r as __exports
4
+ i as d
4
5
  };
5
6
  //# sourceMappingURL=index7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index7.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index7.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -1,6 +1,5 @@
1
- import { __require as r } from "../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.js";
2
- var i = r();
1
+ var r = {};
3
2
  export {
4
- i as d
3
+ r as __exports
5
4
  };
6
5
  //# sourceMappingURL=index9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index9.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index9.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -27,6 +27,11 @@ export interface ContentRenderProps {
27
27
  copyButtonText?: string;
28
28
  copiedButtonText?: string;
29
29
  dynamicInteractionFormat?: string;
30
+ sandboxLoadingText?: string;
31
+ sandboxStyleLoadingText?: string;
32
+ sandboxScriptLoadingText?: string;
33
+ sandboxFullscreenButtonText?: string;
34
+ sandboxMode?: "content" | "blackboard";
30
35
  beforeSend?: (param: OnSendContentParams) => boolean;
31
36
  }
32
37
  declare const ContentRender: React.FC<ContentRenderProps>;
@@ -1,140 +1,133 @@
1
1
  import { j as t } from "../../_virtual/jsx-runtime.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
- import T, { useMemo as C, useRef as $, useEffect as R } from "react";
5
- import V from "../../_virtual/index.js";
4
+ import W, { useMemo as v, useRef as H, useEffect as C } from "react";
5
+ import q from "../../_virtual/index.js";
6
6
  /* empty css */
7
7
  /* empty css */
8
- import _ from "./CodeBlock.js";
9
- import E from "./plugins/CustomVariable.js";
10
- import I from "./plugins/MermaidChart.js";
11
- import U from "./useTypewriterStateMachine.js";
12
- import { preserveCustomVariableProperties as W, restoreCustomVariableProperties as q } from "./utils/custom-variable-props.js";
13
- import { subsetLanguages as G, highlightLanguages as K } from "./utils/highlight-languages.js";
14
- import { parseMarkdownSegments as D, mermaidBlockIsComplete as F } from "./utils/mermaid-parse.js";
15
- import { normalizeInlineHtml as M } from "./utils/normalize-inline-html.js";
16
- import J from "./IframeSandbox.js";
17
- import { Markdown as O } from "../../Documents/ai-shifu/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.js";
18
- import Q from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.js";
19
- import X from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-highlight@7.0.2/node_modules/rehype-highlight/lib/index.js";
20
- import Y from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-katex@7.0.1/node_modules/rehype-katex/lib/index.js";
21
- import Z from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js";
22
- import ee from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-math@6.0.0/node_modules/remark-math/lib/index.js";
23
- import te from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.js";
24
- const H = (r) => {
25
- const c = /<(script|style|link|iframe|html|head|body|meta|title|base|template|div|section|article|main)[\s>]/i, a = r.search(c);
26
- if (a === -1)
27
- return [{ type: "markdown", value: r }];
28
- const i = /<\/[a-z][^>]*>\s*\n(?=[^\s<])/gi;
29
- let l = r.length, o;
30
- for (; o = i.exec(r); )
31
- if (!(o.index <= a)) {
32
- l = o.index + o[0].length - 1;
33
- break;
34
- }
35
- const d = [], u = r.slice(0, a), n = r.slice(a, l), m = r.slice(l);
36
- return u.trim() && d.push({ type: "markdown", value: u }), d.push({ type: "sandbox", value: n }), m.trim() && d.push(...H(m)), d;
37
- }, re = ({ svg: r }) => {
38
- const c = $(null);
39
- return R(() => {
40
- const a = c.current;
41
- if (!a) return;
42
- const i = a.shadowRoot ?? a.attachShadow({ mode: "open" }), l = "content-render-svg-style";
43
- let o = i.getElementById(l);
44
- o || (o = document.createElement("style"), o.id = l, o.textContent = `
8
+ import E from "./CodeBlock.js";
9
+ import G from "./plugins/CustomVariable.js";
10
+ import L from "./plugins/MermaidChart.js";
11
+ import K from "./useTypewriterStateMachine.js";
12
+ import { preserveCustomVariableProperties as D, restoreCustomVariableProperties as F } from "./utils/custom-variable-props.js";
13
+ import { subsetLanguages as J, highlightLanguages as O } from "./utils/highlight-languages.js";
14
+ import { parseMarkdownSegments as Q, mermaidBlockIsComplete as X } from "./utils/mermaid-parse.js";
15
+ import { normalizeInlineHtml as $ } from "./utils/normalize-inline-html.js";
16
+ import Y from "./IframeSandbox.js";
17
+ import { splitContentSegments as Z } from "./utils/split-content.js";
18
+ import { Markdown as ee } from "../../Documents/ai-shifu/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.js";
19
+ import te from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.js";
20
+ import re from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-highlight@7.0.2/node_modules/rehype-highlight/lib/index.js";
21
+ import ne from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rehype-katex@7.0.1/node_modules/rehype-katex/lib/index.js";
22
+ import oe from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js";
23
+ import se from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-math@6.0.0/node_modules/remark-math/lib/index.js";
24
+ import ae from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-breaks@4.0.0/node_modules/remark-breaks/lib/index.js";
25
+ const ie = ({ svg: o }) => {
26
+ const i = H(null);
27
+ return C(() => {
28
+ const m = i.current;
29
+ if (!m) return;
30
+ const s = m.shadowRoot ?? m.attachShadow({ mode: "open" }), f = "content-render-svg-style";
31
+ let a = s.getElementById(f);
32
+ a || (a = document.createElement("style"), a.id = f, a.textContent = `
45
33
  :host { display: block; width: 100%; max-width: 100%; text-align: center; }
46
34
  svg { max-width: 100%; height: auto; display: inline-block; }
47
- `, i.appendChild(o)), Array.from(i.childNodes).filter(
48
- (n) => n !== o
49
- ).forEach((n) => i.removeChild(n));
50
- const u = document.createElement("template");
51
- u.innerHTML = r, i.append(u.content.cloneNode(!0)), i.querySelectorAll("svg").forEach((n) => {
52
- const m = n.getAttribute("viewBox");
53
- if (!m) return;
54
- const f = m.trim().split(/[\s,]+/).map((v) => Number(v));
55
- if (f.length !== 4 || f.some(Number.isNaN)) return;
56
- const [, , x, p] = f, g = n.getAttribute("width"), j = n.getAttribute("height"), k = !!g && g !== "0", b = !!j && j !== "0";
57
- if (!k && !b) {
58
- n.style.width = "100%", n.style.height = "auto", !n.style.aspectRatio && p > 0 && (n.style.aspectRatio = `${x} / ${p}`);
35
+ `, s.appendChild(a)), Array.from(s.childNodes).filter(
36
+ (r) => r !== a
37
+ ).forEach((r) => s.removeChild(r));
38
+ const x = document.createElement("template");
39
+ x.innerHTML = o, s.append(x.content.cloneNode(!0)), s.querySelectorAll("svg").forEach((r) => {
40
+ const d = r.getAttribute("viewBox");
41
+ if (!d) return;
42
+ const u = d.trim().split(/[\s,]+/).map((N) => Number(N));
43
+ if (u.length !== 4 || u.some(Number.isNaN)) return;
44
+ const [, , h, l] = u, b = r.getAttribute("width"), g = r.getAttribute("height"), j = !!b && b !== "0", y = !!g && g !== "0";
45
+ if (!j && !y) {
46
+ r.style.width = "100%", r.style.height = "auto", !r.style.aspectRatio && l > 0 && (r.style.aspectRatio = `${h} / ${l}`);
59
47
  return;
60
48
  }
61
- !k && x > 0 && n.setAttribute("width", `${x}`), !b && p > 0 && n.setAttribute("height", `${p}`);
49
+ !j && h > 0 && r.setAttribute("width", `${h}`), !y && l > 0 && r.setAttribute("height", `${l}`);
62
50
  });
63
- }, [r]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref: c }) });
64
- }, ne = [Z, ee, V, te], se = [
65
- W,
66
- Q,
67
- q,
68
- [X, { languages: K, subset: G }],
69
- Y
70
- ], z = ({ content: r, components: c }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-body", children: /* @__PURE__ */ t.jsx(
71
- O,
51
+ }, [o]), /* @__PURE__ */ t.jsx("div", { className: "content-render-svg-scroll", children: /* @__PURE__ */ t.jsx("div", { className: "content-render-svg", ref: i }) });
52
+ }, ce = [oe, se, q, ae], me = [
53
+ D,
54
+ te,
55
+ F,
56
+ [re, { languages: O, subset: J }],
57
+ ne
58
+ ], z = ({ content: o, components: i }) => /* @__PURE__ */ t.jsx("div", { className: "markdown-body", children: /* @__PURE__ */ t.jsx(
59
+ ee,
72
60
  {
73
- remarkPlugins: ne,
74
- rehypePlugins: se,
75
- components: c,
76
- children: r
61
+ remarkPlugins: ce,
62
+ rehypePlugins: me,
63
+ components: i,
64
+ children: o
77
65
  }
78
- ) }), Ie = ({
79
- content: r,
80
- customRenderBar: c,
81
- onSend: a,
82
- typingSpeed: i = 30,
83
- enableTypewriter: l = !1,
84
- defaultButtonText: o,
85
- defaultInputText: d,
86
- defaultSelectedValues: u,
87
- readonly: n = !1,
88
- onTypeFinished: m,
89
- confirmButtonText: f,
90
- copyButtonText: x,
91
- copiedButtonText: p,
92
- onClickCustomButtonAfterContent: g,
93
- beforeSend: j
66
+ ) }), He = ({
67
+ content: o,
68
+ customRenderBar: i,
69
+ onSend: m,
70
+ typingSpeed: s = 30,
71
+ enableTypewriter: f = !1,
72
+ defaultButtonText: a,
73
+ defaultInputText: R,
74
+ defaultSelectedValues: x,
75
+ readonly: r = !1,
76
+ onTypeFinished: d,
77
+ confirmButtonText: u,
78
+ copyButtonText: h,
79
+ copiedButtonText: l,
80
+ sandboxLoadingText: b,
81
+ sandboxStyleLoadingText: g,
82
+ sandboxScriptLoadingText: j,
83
+ sandboxFullscreenButtonText: y,
84
+ sandboxMode: S = "content",
85
+ onClickCustomButtonAfterContent: N,
86
+ beforeSend: P
94
87
  // tooltipMinLength,
95
88
  }) => {
96
- const k = C(
97
- () => M(r),
98
- [r]
99
- ), b = {
89
+ const V = v(
90
+ () => $(o),
91
+ [o]
92
+ ), A = {
100
93
  "custom-button-after-content": ({
101
94
  children: e
102
95
  }) => /* @__PURE__ */ t.jsx(
103
96
  "button",
104
97
  {
105
98
  className: "content-render-custom-button-after-content",
106
- onClick: g,
99
+ onClick: N,
107
100
  children: /* @__PURE__ */ t.jsx("span", { className: "content-render-custom-button-after-content-inner", children: e })
108
101
  }
109
102
  ),
110
103
  "custom-variable": (e) => /* @__PURE__ */ t.jsx(
111
- E,
104
+ G,
112
105
  {
113
106
  ...e,
114
- readonly: n,
115
- defaultButtonText: o,
116
- defaultInputText: d,
117
- defaultSelectedValues: u,
118
- onSend: a,
119
- beforeSend: j,
120
- confirmButtonText: f
107
+ readonly: r,
108
+ defaultButtonText: a,
109
+ defaultInputText: R,
110
+ defaultSelectedValues: x,
111
+ onSend: m,
112
+ beforeSend: P,
113
+ confirmButtonText: u
121
114
  }
122
115
  ),
123
116
  code: (e) => {
124
- const { className: s, children: h, ...A } = e;
125
- if (/language-(\w+)/.exec(s || "")?.[1] === "mermaid") {
126
- const B = h?.toString().replace(/\n$/, "") || "", P = F(r, B);
127
- return /* @__PURE__ */ t.jsx(I, { chart: B, frozen: P });
117
+ const { className: n, children: c, ...T } = e;
118
+ if (/language-(\w+)/.exec(n || "")?.[1] === "mermaid") {
119
+ const M = c?.toString().replace(/\n$/, "") || "", U = X(o, M);
120
+ return /* @__PURE__ */ t.jsx(L, { chart: M, frozen: U });
128
121
  }
129
- return /* @__PURE__ */ t.jsx("code", { className: s, ...A, children: h });
122
+ return /* @__PURE__ */ t.jsx("code", { className: n, ...T, children: c });
130
123
  },
131
124
  table: ({ ...e }) => /* @__PURE__ */ t.jsx("div", { className: "content-render-table-container", children: /* @__PURE__ */ t.jsx("table", { className: "content-render-table", ...e }) }),
132
125
  th: ({ ...e }) => /* @__PURE__ */ t.jsx("th", { className: "content-render-th", ...e }),
133
126
  td: ({ ...e }) => /* @__PURE__ */ t.jsx("td", { className: "content-render-td", ...e }),
134
127
  tr: ({ ...e }) => /* @__PURE__ */ t.jsx("tr", { className: "content-render-tr", ...e }),
135
- li: ({ node: e, ...s }) => {
136
- const h = e?.properties?.className;
137
- return typeof h == "string" && h.includes("task-list-item") || Array.isArray(h) && h.includes("task-list-item") ? /* @__PURE__ */ t.jsx("li", { className: "content-render-task-list-item", ...s }) : /* @__PURE__ */ t.jsx("li", { ...s });
128
+ li: ({ node: e, ...n }) => {
129
+ const c = e?.properties?.className;
130
+ 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 });
138
131
  },
139
132
  ol: ({ ...e }) => /* @__PURE__ */ t.jsx("ol", { className: "content-render-ol", ...e }),
140
133
  ul: ({ ...e }) => /* @__PURE__ */ t.jsx("ul", { className: "content-render-ul", ...e }),
@@ -147,81 +140,86 @@ const H = (r) => {
147
140
  ...e
148
141
  }
149
142
  ) : /* @__PURE__ */ t.jsx("input", { ...e }),
150
- a: ({ children: e, ...s }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...s, children: e }),
143
+ a: ({ children: e, ...n }) => /* @__PURE__ */ t.jsx("a", { target: "_blank", rel: "noopener noreferrer", ...n, children: e }),
151
144
  pre: (e) => /* @__PURE__ */ t.jsx(
152
- _,
145
+ E,
153
146
  {
154
147
  ...e,
155
- copyButtonText: x,
156
- copiedButtonText: p
148
+ copyButtonText: h,
149
+ copiedButtonText: l
157
150
  }
158
151
  )
159
- }, { displayContent: N, isComplete: v } = U({
152
+ }, { displayContent: k, isComplete: B } = K({
160
153
  // processMarkdownText will let code block printf("You win!\n") become printf("You win!<br/>");
161
154
  // content: processMarkdownText(content),
162
- content: k,
163
- typingSpeed: i,
164
- disabled: !l
165
- }), S = C(
166
- () => H(r),
167
- [r]
168
- ), y = S.some(
155
+ content: V,
156
+ typingSpeed: s,
157
+ disabled: !f
158
+ }), I = v(
159
+ () => Z(o),
160
+ [o]
161
+ ), p = I.some(
169
162
  (e) => e.type === "sandbox"
170
- ), L = C(
171
- () => D(N),
172
- [N]
173
- ), w = $(!1);
174
- return R(() => {
175
- y || v && !w.current && (w.current = !0, m?.());
176
- }, [y, v, m]), R(() => {
177
- y || (w.current = !1);
178
- }, [y, r]), y ? /* @__PURE__ */ t.jsx("div", { className: "content-render", children: S.map(
179
- (e, s) => e.type === "sandbox" ? /* @__PURE__ */ t.jsx(
180
- J,
163
+ ), _ = v(
164
+ () => Q(k),
165
+ [k]
166
+ ), w = H(!1);
167
+ return C(() => {
168
+ p || B && !w.current && (w.current = !0, d?.());
169
+ }, [p, B, d]), C(() => {
170
+ p || (w.current = !1);
171
+ }, [p, o]), p ? /* @__PURE__ */ t.jsx("div", { className: "content-render", children: I.map(
172
+ (e, n) => e.type === "sandbox" ? /* @__PURE__ */ t.jsx(
173
+ Y,
181
174
  {
182
175
  content: e.value,
183
- className: "content-render-iframe"
176
+ className: "content-render-iframe",
177
+ loadingText: b,
178
+ styleLoadingText: g,
179
+ scriptLoadingText: j,
180
+ fullScreenButtonText: y,
181
+ mode: S
184
182
  },
185
- `sandbox-${s}`
183
+ `sandbox-${n}`
186
184
  ) : /* @__PURE__ */ t.jsx(
187
185
  z,
188
186
  {
189
- components: b,
190
- content: M(e.value)
187
+ components: A,
188
+ content: $(e.value)
191
189
  },
192
- `md-${s}`
190
+ `md-${n}`
193
191
  )
194
192
  ) }) : /* @__PURE__ */ t.jsxs("div", { className: "content-render", children: [
195
- L.map((e, s) => {
193
+ _.map((e, n) => {
196
194
  if (e.type === "text")
197
195
  return /* @__PURE__ */ t.jsx(
198
196
  z,
199
197
  {
200
- components: b,
198
+ components: A,
201
199
  content: e.value
202
200
  },
203
- s
201
+ n
204
202
  );
205
203
  if (e.type === "mermaid")
206
204
  return /* @__PURE__ */ t.jsx(
207
- I,
205
+ L,
208
206
  {
209
207
  chart: e.value,
210
208
  frozen: !e.complete
211
209
  },
212
- s
210
+ n
213
211
  );
214
212
  if (e.type === "svg")
215
- return /* @__PURE__ */ t.jsx(re, { svg: e.value }, s);
213
+ return /* @__PURE__ */ t.jsx(ie, { svg: e.value }, n);
216
214
  }),
217
- c && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: T.createElement(c, {
218
- content: r,
219
- displayContent: N,
220
- onSend: a
215
+ i && /* @__PURE__ */ t.jsx("div", { className: "content-render-custom-bar", children: W.createElement(i, {
216
+ content: o,
217
+ displayContent: k,
218
+ onSend: m
221
219
  }) })
222
220
  ] });
223
221
  };
224
222
  export {
225
- Ie as default
223
+ He as default
226
224
  };
227
225
  //# sourceMappingURL=ContentRender.js.map