markdown-flow-ui 0.1.100-beta.13 → 0.1.100-beta.14

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 (79) hide show
  1. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  2. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js.map +1 -1
  3. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  4. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
  5. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
  6. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.cjs.js +1 -1
  7. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
  8. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js.map +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
  12. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js.map +1 -1
  13. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
  14. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
  15. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js.map +1 -1
  16. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
  17. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
  18. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js.map +1 -1
  19. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
  20. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
  21. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js.map +1 -1
  22. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
  23. 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.cjs.js +1 -1
  24. 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.es.js +1 -1
  25. 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.cjs.js +1 -1
  26. 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.es.js +1 -1
  27. 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.cjs.js +1 -1
  28. 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.es.js +1 -1
  29. 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.cjs.js +1 -1
  30. 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.es.js +1 -1
  31. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js +1 -1
  32. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.cjs.js.map +1 -1
  33. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-util@5.44.4_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-util/es/ref.es.js +1 -1
  34. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.cjs.js +1 -1
  35. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/index.es.js +1 -1
  36. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
  37. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
  38. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
  39. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
  40. package/dist/_virtual/index.cjs10.js +1 -1
  41. package/dist/_virtual/index.cjs11.js +1 -1
  42. package/dist/_virtual/index.cjs12.js +1 -1
  43. package/dist/_virtual/index.cjs4.js +1 -1
  44. package/dist/_virtual/index.cjs5.js +1 -1
  45. package/dist/_virtual/index.cjs6.js +1 -1
  46. package/dist/_virtual/index.cjs7.js +1 -1
  47. package/dist/_virtual/index.cjs8.js +1 -1
  48. package/dist/_virtual/index.cjs9.js +1 -1
  49. package/dist/_virtual/index.es10.js +3 -2
  50. package/dist/_virtual/index.es10.js.map +1 -1
  51. package/dist/_virtual/index.es11.js +2 -3
  52. package/dist/_virtual/index.es11.js.map +1 -1
  53. package/dist/_virtual/index.es12.js +2 -2
  54. package/dist/_virtual/index.es4.js +4 -4
  55. package/dist/_virtual/index.es5.js +4 -4
  56. package/dist/_virtual/index.es6.js +5 -5
  57. package/dist/_virtual/index.es7.js +2 -2
  58. package/dist/_virtual/index.es8.js +2 -3
  59. package/dist/_virtual/index.es8.js.map +1 -1
  60. package/dist/_virtual/index.es9.js +3 -2
  61. package/dist/_virtual/index.es9.js.map +1 -1
  62. package/dist/assets/markdown-flow-ui.css +1 -1
  63. package/dist/components/ContentRender/IframeSandbox.cjs.js +4 -4
  64. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  65. package/dist/components/ContentRender/IframeSandbox.d.ts +1 -0
  66. package/dist/components/ContentRender/IframeSandbox.es.js +237 -199
  67. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  68. package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
  69. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  70. package/dist/components/ContentRender/SandboxApp.d.ts +1 -0
  71. package/dist/components/ContentRender/SandboxApp.es.js +70 -66
  72. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  73. package/dist/components/Slide/Slide.cjs.js +1 -1
  74. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  75. package/dist/components/Slide/Slide.es.js +158 -155
  76. package/dist/components/Slide/Slide.es.js.map +1 -1
  77. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  78. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  79. package/package.json +1 -1
@@ -1,120 +1,157 @@
1
- import { j as u } from "../../_virtual/jsx-runtime.es.js";
2
- import se, { useRef as d, useState as A, useCallback as we, useEffect as C } from "react";
3
- import { createRoot as xe } from "react-dom/client";
4
- import Ee from "./SandboxApp.es.js";
1
+ import { j as d } from "../../_virtual/jsx-runtime.es.js";
2
+ import D, { useRef as h, useState as k, useCallback as Re, useEffect as S } from "react";
3
+ import { createRoot as Ee } from "react-dom/client";
4
+ import He from "./SandboxApp.es.js";
5
5
  import { splitContentSegments as ye } from "./utils/split-content.es.js";
6
- import Ce from "./ContentRender.es.js";
7
- import { SANDBOX_INTERACTION_MESSAGE_TYPE as Re, SANDBOX_INTERACTION_MESSAGE_SOURCE as He } from "../../lib/sandboxInteraction.es.js";
8
- import Se from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
9
- let G = null;
10
- const ce = () => (G || (G = import("./blackboard-vendor.es.js").then(
11
- (s) => s.injectBlackboardLibraries
12
- )), G);
13
- typeof window < "u" && ce();
14
- const Te = /<img\b[^>]*>/i, Ae = 180, Me = 240, ae = (s) => s.split(/\s+/).filter(Boolean).map((n) => n.split(":").pop() || n), ie = (s) => {
15
- const n = s.trim().toLowerCase();
16
- if (!n) return null;
17
- const m = n.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
18
- return m ? `${m[1]}${m[2].toLowerCase()}` : null;
19
- }, le = (s) => {
20
- if (!s.trim()) return null;
21
- const n = ae(s);
22
- if (n.includes("h-screen") || n.includes("h-dvh"))
6
+ import Se from "./ContentRender.es.js";
7
+ import { SANDBOX_INTERACTION_MESSAGE_TYPE as Te, SANDBOX_INTERACTION_MESSAGE_SOURCE as Me } from "../../lib/sandboxInteraction.es.js";
8
+ import Ae from "../../Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/loader-circle.es.js";
9
+ let Y = null;
10
+ const he = () => (Y || (Y = import("./blackboard-vendor.es.js").then(
11
+ (r) => r.injectBlackboardLibraries
12
+ )), Y);
13
+ typeof window < "u" && he();
14
+ const Ne = /<img\b[^>]*>/i, ke = 180, je = 240, W = (r) => r.split(/\s+/).filter(Boolean).map((t) => t.split(":").pop() || t), ue = (r) => {
15
+ const t = r.trim().toLowerCase();
16
+ if (!t) return null;
17
+ const o = t.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
18
+ return o ? `${o[1]}${o[2].toLowerCase()}` : null;
19
+ }, de = (r) => {
20
+ if (!r.trim()) return null;
21
+ const t = W(r);
22
+ if (t.includes("h-screen") || t.includes("h-dvh"))
23
23
  return "100dvh";
24
- if (n.includes("h-svh"))
24
+ if (t.includes("h-svh"))
25
25
  return "100svh";
26
- if (n.includes("h-lvh"))
26
+ if (t.includes("h-lvh"))
27
27
  return "100lvh";
28
- const m = n.find(
29
- (M) => /^h-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(M)
28
+ const o = t.find(
29
+ (w) => /^h-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(w)
30
30
  );
31
- if (!m) return null;
32
- const p = m.match(/^h-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i);
33
- return p ? `${p[1]}${p[2].toLowerCase()}` : null;
34
- }, Be = ({
35
- content: s,
36
- type: n,
37
- className: m,
38
- loadingText: p,
39
- styleLoadingText: M,
40
- scriptLoadingText: U,
41
- fullScreenButtonText: j,
42
- hideFullScreen: W = !1,
43
- mode: h = "content"
31
+ if (!o) return null;
32
+ const m = o.match(/^h-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i);
33
+ return m ? `${m[1]}${m[2].toLowerCase()}` : null;
34
+ }, Ie = (r) => {
35
+ const t = r.trim();
36
+ if (!t) return null;
37
+ const o = t.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
38
+ return o ? o[2]?.match(/\bclass\s*=\s*["']([^"']*)["']/i)?.[1] ?? null : null;
39
+ }, _e = (r) => {
40
+ const t = Ie(r);
41
+ return t ? W(t).includes("h-screen") : !1;
42
+ }, $e = (r) => r.split(/\s+/).filter(Boolean).map((t) => {
43
+ const o = t.split(":");
44
+ return o[o.length - 1] !== "h-screen" ? t : (o[o.length - 1] = "h-full", o.join(":"));
45
+ }).join(" "), ze = (r, t) => !t || !r.trim() ? r : r.replace(
46
+ /^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
47
+ (o, m, w = "") => {
48
+ const f = w.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
49
+ if (!f)
50
+ return o;
51
+ const E = $e(f[2]);
52
+ return E === f[2] ? o : `${m}${w.replace(
53
+ f[0],
54
+ `class=${f[1]}${E}${f[1]}`
55
+ )}>`;
56
+ }
57
+ ), Ge = ({
58
+ content: r,
59
+ type: t,
60
+ className: o,
61
+ loadingText: m,
62
+ styleLoadingText: w,
63
+ scriptLoadingText: f,
64
+ fullScreenButtonText: E,
65
+ hideFullScreen: J = !1,
66
+ mode: b = "content",
67
+ replaceRootScreenHeightWithFull: j = !1
44
68
  }) => {
45
- const X = d(null), E = d(null), _ = d(null), Y = d(null), D = d(() => {
46
- }), [ue, de] = A(480), Z = d(0), [J, he] = A(0), [me, fe] = A(!1), [L, O] = A(
47
- n !== "sandbox"
48
- ), B = h === "blackboard", F = d(""), r = se.useMemo(() => {
49
- const e = ye(s).filter((l) => l.type === "sandbox");
50
- return (h === "blackboard" ? e[e.length - 1]?.value || "" : e.map((l) => l.value).join(`
69
+ const K = h(null), H = h(null), B = h(null), Q = h(null), L = h(() => {
70
+ }), [me, fe] = k(480), ee = h(0), [te, be] = k(0), [pe, ge] = k(!1), [O, F] = k(
71
+ t !== "sandbox"
72
+ ), V = b === "blackboard", P = h(""), I = D.useMemo(() => {
73
+ const e = ye(r).filter((c) => c.type === "sandbox");
74
+ return (b === "blackboard" ? e[e.length - 1]?.value || "" : e.map((c) => c.value).join(`
51
75
  `)) || "";
52
- }, [s, h]), [N, K] = A(r), Q = d(r), z = d(r), R = d(null), y = we((t) => {
76
+ }, [r, b]), s = D.useMemo(
77
+ () => ze(
78
+ I,
79
+ j
80
+ ),
81
+ [I, j]
82
+ ), ne = D.useMemo(
83
+ () => j && _e(I),
84
+ [I, j]
85
+ ), [_, re] = k(
86
+ s
87
+ ), oe = h(s), q = h(s), T = h(null), y = Re((n) => {
53
88
  if (typeof window > "u")
54
89
  return;
55
90
  const e = Date.now();
56
- e - Z.current < Me || (Z.current = e, window.postMessage(
91
+ e - ee.current < je || (ee.current = e, window.postMessage(
57
92
  {
58
- source: He,
59
- type: Re,
60
- eventType: t
93
+ source: Me,
94
+ type: Te,
95
+ eventType: n
61
96
  },
62
97
  window.location.origin
63
98
  ));
64
- }, []), $ = () => {
65
- R.current !== null && (window.clearTimeout(R.current), R.current = null);
99
+ }, []), G = () => {
100
+ T.current !== null && (window.clearTimeout(T.current), T.current = null);
66
101
  };
67
- C(
102
+ S(
68
103
  () => () => {
69
- $();
104
+ G();
70
105
  },
71
106
  []
72
- ), C(() => {
73
- const t = Q.current;
74
- Q.current = r;
75
- const e = !!t && r.length > t.length && r.startsWith(t), i = Te.test(r);
76
- if (!(e && i)) {
77
- $(), z.current = r, K(r);
107
+ ), S(() => {
108
+ const n = oe.current;
109
+ oe.current = s;
110
+ const e = !!n && s.length > n.length && s.startsWith(n), l = Ne.test(
111
+ s
112
+ );
113
+ if (!(e && l)) {
114
+ G(), q.current = s, re(s);
78
115
  return;
79
116
  }
80
- z.current = r, $(), R.current = window.setTimeout(() => {
81
- K(z.current), R.current = null;
82
- }, Ae);
83
- }, [r]);
84
- const ee = se.useMemo(() => {
85
- const t = N.trim();
86
- if (!t) return null;
87
- const e = t.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
117
+ q.current = s, G(), T.current = window.setTimeout(() => {
118
+ re(q.current), T.current = null;
119
+ }, ke);
120
+ }, [s]);
121
+ const se = D.useMemo(() => {
122
+ const n = _.trim();
123
+ if (!n) return null;
124
+ const e = n.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
88
125
  if (!e) return null;
89
- const i = e[2] || "", l = i.match(/\bheight\s*=\s*["']([^"']+)["']/i);
90
- if (l) {
91
- const f = ie(l[1]);
92
- if (f) return f;
126
+ const l = e[2] || "", c = l.match(/\bheight\s*=\s*["']([^"']+)["']/i);
127
+ if (c) {
128
+ const p = ue(c[1]);
129
+ if (p) return p;
93
130
  }
94
- const S = i.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
131
+ const A = l.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
95
132
  /\bheight\s*:\s*([^;]+)/i
96
133
  )?.[1];
97
- if (S) {
98
- const f = ie(S);
99
- if (f) return f;
134
+ if (A) {
135
+ const p = ue(A);
136
+ if (p) return p;
100
137
  }
101
- const g = i.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1];
102
- return g ? le(g) : null;
103
- }, [N]), te = !!ee, ne = n === "sandbox", H = B && n === "sandbox" ? ee ?? `${ue}px` : void 0;
104
- C(() => {
105
- if (h !== "blackboard") {
106
- F.current = r;
138
+ const v = l.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1];
139
+ return v ? de(v) : null;
140
+ }, [_]), ie = !!se, le = t === "sandbox", M = V && t === "sandbox" ? ne ? "100%" : se ?? `${me}px` : void 0;
141
+ S(() => {
142
+ if (b !== "blackboard") {
143
+ P.current = s;
107
144
  return;
108
145
  }
109
- const t = F.current;
110
- !(t && r.startsWith(t)) && t && he((i) => i + 1), F.current = r;
111
- }, [r, h]), C(() => {
112
- const t = E.current;
113
- if (!t) return;
114
- const e = t.contentDocument;
146
+ const n = P.current;
147
+ !(n && s.startsWith(n)) && n && be((l) => l + 1), P.current = s;
148
+ }, [b, s]), S(() => {
149
+ const n = H.current;
150
+ if (!n) return;
151
+ const e = n.contentDocument;
115
152
  if (!e) return;
116
153
  e.open(), e.write(`<!DOCTYPE html>
117
- <html${h === "blackboard" ? ' style="height: 100%;"' : ""}>
154
+ <html${b === "blackboard" ? ' style="height: 100%;"' : ""}>
118
155
  <head>
119
156
  <meta charset="utf-8" />
120
157
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -127,173 +164,174 @@ const Te = /<img\b[^>]*>/i, Ae = 180, Me = 240, ae = (s) => s.split(/\s+/).filte
127
164
  <body>
128
165
  <div id="root"></div>
129
166
  </body>
130
- </html>`), e.close(), Y.current = e;
131
- const i = B && n === "sandbox", l = () => y("pointerdown"), V = () => y("mousedown"), S = () => y("touchstart");
132
- i && (e.addEventListener("pointerdown", l, !0), e.addEventListener("mousedown", V, !0), e.addEventListener("touchstart", S, !0));
133
- const g = e.getElementById("root");
134
- if (!g) return;
135
- const f = xe(g);
136
- _.current = f;
137
- let T = !1;
138
- const oe = (c, b) => {
139
- const o = c.trim().toLowerCase();
140
- if (!o) return null;
141
- const a = Number.parseFloat(o);
142
- return Number.isNaN(a) ? null : /(dvh|svh|lvh|vh)$/i.test(o) ? a / 100 * b : o.endsWith("px") || /^[0-9.]+$/.test(o) ? a : null;
143
- }, ge = (c, b) => {
144
- if (!c.trim()) return null;
145
- const o = le(c);
146
- if (o)
147
- return oe(o, b);
148
- const v = ae(c).find(
149
- (I) => /^h-\[[0-9.]+px\]$/i.test(I)
167
+ </html>`), e.close(), Q.current = e;
168
+ const l = V && t === "sandbox", c = () => y("pointerdown"), U = () => y("mousedown"), A = () => y("touchstart");
169
+ l && (e.addEventListener("pointerdown", c, !0), e.addEventListener("mousedown", U, !0), e.addEventListener("touchstart", A, !0));
170
+ const v = e.getElementById("root");
171
+ if (!v) return;
172
+ const p = Ee(v);
173
+ B.current = p;
174
+ let N = !1;
175
+ const ae = (a, g) => {
176
+ const i = a.trim().toLowerCase();
177
+ if (!i) return null;
178
+ const u = Number.parseFloat(i);
179
+ return Number.isNaN(u) ? null : /(dvh|svh|lvh|vh)$/i.test(i) ? u / 100 * g : i.endsWith("px") || /^[0-9.]+$/.test(i) ? u : null;
180
+ }, xe = (a, g) => {
181
+ if (!a.trim()) return null;
182
+ const i = de(a);
183
+ if (i)
184
+ return ae(i, g);
185
+ const x = W(a).find(
186
+ (z) => /^h-\[[0-9.]+px\]$/i.test(z)
150
187
  );
151
- if (!v) return null;
152
- const w = v.match(/^h-\[([0-9.]+)px\]$/i);
153
- if (!w) return null;
154
- const x = Number.parseFloat(w[1]);
155
- return Number.isNaN(x) ? null : x;
156
- }, ve = () => {
157
- if (!E.current || !e.body) return null;
158
- const b = e.body.querySelector(
188
+ if (!x) return null;
189
+ const C = x.match(/^h-\[([0-9.]+)px\]$/i);
190
+ if (!C) return null;
191
+ const R = Number.parseFloat(C[1]);
192
+ return Number.isNaN(R) ? null : R;
193
+ }, Ce = () => {
194
+ if (!H.current || !e.body) return null;
195
+ const g = e.body.querySelector(
159
196
  ".sandbox-wrapper"
160
197
  )?.firstElementChild;
161
- if (!b) return null;
162
- const o = Array.from(b.children);
163
- if (o.length !== 1) return null;
164
- const a = o[0], v = a.style.height || a.getAttribute("height"), w = E.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, x = v ? oe(v, w) : null;
165
- if (x !== null)
166
- return Math.ceil(x);
167
- const I = ge(
168
- a.getAttribute("class") || "",
169
- w
198
+ if (!g) return null;
199
+ const i = Array.from(g.children);
200
+ if (i.length !== 1) return null;
201
+ const u = i[0], x = u.style.height || u.getAttribute("height"), C = H.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, R = x ? ae(x, C) : null;
202
+ if (R !== null)
203
+ return Math.ceil(R);
204
+ const z = xe(
205
+ u.getAttribute("class") || "",
206
+ C
170
207
  );
171
- return I !== null ? Math.ceil(I) : null;
172
- }, P = () => {
173
- if (!E.current || !e.body) return;
174
- const c = e.body.getBoundingClientRect(), b = e.documentElement?.getBoundingClientRect(), o = c.height, a = b?.height || 0, v = Math.max(o, a), w = ve(), x = Math.max(
208
+ return z !== null ? Math.ceil(z) : null;
209
+ }, X = () => {
210
+ if (!H.current || !e.body) return;
211
+ const a = e.body.getBoundingClientRect(), g = e.documentElement?.getBoundingClientRect(), i = a.height, u = g?.height || 0, x = Math.max(i, u), C = Ce(), R = Math.max(
175
212
  200,
176
- w ?? Math.ceil(v)
213
+ C ?? Math.ceil(x)
177
214
  );
178
- de(x);
179
- }, k = () => {
215
+ fe(R);
216
+ }, $ = () => {
180
217
  requestAnimationFrame(() => {
181
- T || P();
218
+ N || X();
182
219
  });
183
220
  };
184
- D.current = k, P(), k(), ne ? ce().then((c) => {
185
- T || (c(e), requestAnimationFrame(() => {
186
- T || (O(!0), k());
221
+ L.current = $, X(), $(), le ? he().then((a) => {
222
+ N || (a(e), requestAnimationFrame(() => {
223
+ N || (F(!0), $());
187
224
  }));
188
225
  }).catch(() => {
189
- T || (O(!0), k());
190
- }) : O(!0);
191
- const q = new ResizeObserver(() => P());
192
- return q.observe(e.body), g && q.observe(g), () => {
193
- T = !0, q.disconnect(), i && (e.removeEventListener("pointerdown", l, !0), e.removeEventListener("mousedown", V, !0), e.removeEventListener("touchstart", S, !0)), setTimeout(() => {
194
- f.unmount(), _.current = null, Y.current = null, D.current = () => {
226
+ N || (F(!0), $());
227
+ }) : F(!0);
228
+ const Z = new ResizeObserver(() => X());
229
+ return Z.observe(e.body), v && Z.observe(v), () => {
230
+ N = !0, Z.disconnect(), l && (e.removeEventListener("pointerdown", c, !0), e.removeEventListener("mousedown", U, !0), e.removeEventListener("touchstart", A, !0)), setTimeout(() => {
231
+ p.unmount(), B.current = null, Q.current = null, L.current = () => {
195
232
  };
196
233
  }, 0);
197
234
  };
198
- }, []), C(() => {
199
- const t = () => {
200
- fe(!!document.fullscreenElement);
235
+ }, []), S(() => {
236
+ const n = () => {
237
+ ge(!!document.fullscreenElement);
201
238
  };
202
- return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
239
+ return document.addEventListener("fullscreenchange", n), () => document.removeEventListener("fullscreenchange", n);
203
240
  }, []);
204
- const be = () => {
205
- const t = X.current || E.current;
206
- if (t) {
241
+ const we = () => {
242
+ const n = K.current || H.current;
243
+ if (n) {
207
244
  if (document.fullscreenElement) {
208
245
  document.exitFullscreen().catch(() => {
209
246
  });
210
247
  return;
211
248
  }
212
- t.requestFullscreen && t.requestFullscreen().catch(() => {
249
+ n.requestFullscreen && n.requestFullscreen().catch(() => {
213
250
  });
214
251
  }
215
252
  };
216
- C(() => {
217
- const t = _.current;
218
- !t || !L || (t.render(
219
- /* @__PURE__ */ u.jsx(
220
- Ee,
253
+ S(() => {
254
+ const n = B.current;
255
+ !n || !O || (n.render(
256
+ /* @__PURE__ */ d.jsx(
257
+ He,
221
258
  {
222
- html: N,
223
- loadingText: p,
224
- styleLoadingText: M,
225
- scriptLoadingText: U,
226
- fullScreenButtonText: j,
227
- hideFullScreen: W,
228
- resetToken: J,
229
- hasRootVhHeight: te,
230
- mode: h
259
+ html: _,
260
+ loadingText: m,
261
+ styleLoadingText: w,
262
+ scriptLoadingText: f,
263
+ fullScreenButtonText: E,
264
+ hideFullScreen: J,
265
+ resetToken: te,
266
+ hasRootVhHeight: ie,
267
+ mode: b,
268
+ stretchRootHeight: ne
231
269
  }
232
270
  )
233
- ), requestAnimationFrame(() => D.current?.()));
271
+ ), requestAnimationFrame(() => L.current?.()));
234
272
  }, [
235
- N,
236
- p,
237
- M,
238
- U,
239
- j,
240
- J,
241
- h,
242
- L
273
+ _,
274
+ m,
275
+ w,
276
+ f,
277
+ E,
278
+ te,
279
+ b,
280
+ O
243
281
  ]);
244
- const pe = [
282
+ const ve = [
245
283
  "w-full relative content-render-iframe-sandbox",
246
- B ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
247
- ].filter(Boolean).join(" "), re = ne && !L;
248
- return /* @__PURE__ */ u.jsxs(
284
+ V ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
285
+ ].filter(Boolean).join(" "), ce = le && !O;
286
+ return /* @__PURE__ */ d.jsxs(
249
287
  "div",
250
288
  {
251
- ref: X,
252
- "data-root-vh": te ? "true" : "false",
253
- className: pe,
254
- style: H ? {
255
- height: H,
256
- minHeight: H
289
+ ref: K,
290
+ "data-root-vh": ie ? "true" : "false",
291
+ className: ve,
292
+ style: M ? {
293
+ height: M,
294
+ minHeight: M
257
295
  } : void 0,
258
296
  children: [
259
- !W && /* @__PURE__ */ u.jsx(
297
+ !J && /* @__PURE__ */ d.jsx(
260
298
  "button",
261
299
  {
262
300
  type: "button",
263
- onClick: be,
301
+ onClick: we,
264
302
  className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
265
- children: me ? "退出全屏" : j || "全屏浏览"
303
+ children: pe ? "退出全屏" : E || "全屏浏览"
266
304
  }
267
305
  ),
268
- h === "blackboard" && n === "markdown" ? /* @__PURE__ */ u.jsx(
306
+ b === "blackboard" && t === "markdown" ? /* @__PURE__ */ d.jsx(
269
307
  "div",
270
308
  {
271
309
  onMouseDown: () => y("mousedown"),
272
310
  onPointerDown: () => y("pointerdown"),
273
311
  onTouchStart: () => y("touchstart"),
274
- children: /* @__PURE__ */ u.jsx(Ce, { content: s })
312
+ children: /* @__PURE__ */ d.jsx(Se, { content: r })
275
313
  }
276
- ) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
277
- /* @__PURE__ */ u.jsx(
314
+ ) : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
315
+ /* @__PURE__ */ d.jsx(
278
316
  "iframe",
279
317
  {
280
- ref: E,
318
+ ref: H,
281
319
  sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
282
320
  allow: "fullscreen",
283
321
  allowFullScreen: !0,
284
- className: [m, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
322
+ className: [o, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
285
323
  style: {
286
- height: H ?? "100%",
287
- minHeight: H,
324
+ height: M ?? "100%",
325
+ minHeight: M,
288
326
  margin: "auto",
289
- visibility: re ? "hidden" : "visible"
327
+ visibility: ce ? "hidden" : "visible"
290
328
  }
291
329
  }
292
330
  ),
293
- re ? /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center", children: /* @__PURE__ */ u.jsx(
294
- Se,
331
+ ce ? /* @__PURE__ */ d.jsx("div", { className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center", children: /* @__PURE__ */ d.jsx(
332
+ Ae,
295
333
  {
296
- "aria-label": p || "Preparing sandbox styles",
334
+ "aria-label": m || "Preparing sandbox styles",
297
335
  className: "text-primary h-7 w-7 animate-spin"
298
336
  }
299
337
  ) }) : null
@@ -303,6 +341,6 @@ const Te = /<img\b[^>]*>/i, Ae = 180, Me = 240, ae = (s) => s.split(/\s+/).filte
303
341
  );
304
342
  };
305
343
  export {
306
- Be as default
344
+ Ge as default
307
345
  };
308
346
  //# sourceMappingURL=IframeSandbox.es.js.map