markdown-flow-ui 0.1.99-beta.3 → 0.1.100-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) 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/lucide-react@0.525.0_react@19.0.1/node_modules/lucide-react/dist/esm/icons/ellipsis-vertical.cjs.js +7 -0
  7. package/dist/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/ellipsis-vertical.cjs.js.map +1 -0
  8. package/dist/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/ellipsis-vertical.es.js +17 -0
  9. package/dist/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/ellipsis-vertical.es.js.map +1 -0
  10. package/dist/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/file-pen-line.cjs.js +7 -0
  11. package/dist/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/file-pen-line.cjs.js.map +1 -0
  12. package/dist/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/file-pen-line.es.js +29 -0
  13. package/dist/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/file-pen-line.es.js.map +1 -0
  14. package/dist/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/maximize.cjs.js +7 -0
  15. package/dist/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/maximize.cjs.js.map +1 -0
  16. package/dist/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/maximize.es.js +18 -0
  17. package/dist/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/maximize.es.js.map +1 -0
  18. package/dist/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/rotate-ccw.cjs.js +7 -0
  19. package/dist/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/rotate-ccw.cjs.js.map +1 -0
  20. package/dist/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/rotate-ccw.es.js +16 -0
  21. package/dist/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/rotate-ccw.es.js.map +1 -0
  22. package/dist/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/rotate-cw.cjs.js +7 -0
  23. package/dist/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/rotate-cw.cjs.js.map +1 -0
  24. package/dist/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/rotate-cw.es.js +16 -0
  25. package/dist/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/rotate-cw.es.js.map +1 -0
  26. package/dist/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/volume-2.cjs.js +7 -0
  27. package/dist/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/volume-2.cjs.js.map +1 -0
  28. package/dist/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/volume-2.es.js +23 -0
  29. package/dist/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/volume-2.es.js.map +1 -0
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/index.cjs.js +1 -1
  39. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/index.es.js +1 -1
  40. 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
  41. 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.map +1 -1
  42. 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
  43. package/dist/_virtual/index.cjs.js +1 -1
  44. package/dist/_virtual/index.cjs2.js +1 -1
  45. package/dist/_virtual/index.cjs3.js +1 -1
  46. package/dist/_virtual/index.cjs7.js +1 -1
  47. package/dist/_virtual/index.cjs9.js +1 -1
  48. package/dist/_virtual/index.es.js +1 -0
  49. package/dist/_virtual/index.es2.js +2 -5
  50. package/dist/_virtual/index.es2.js.map +1 -1
  51. package/dist/_virtual/index.es3.js +5 -2
  52. package/dist/_virtual/index.es3.js.map +1 -1
  53. package/dist/_virtual/index.es7.js +2 -2
  54. package/dist/_virtual/index.es9.js +2 -2
  55. package/dist/assets/markdown-flow-ui.css +1 -1
  56. package/dist/components/ContentRender/IframeSandbox.cjs.js +4 -4
  57. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  58. package/dist/components/ContentRender/IframeSandbox.es.js +223 -190
  59. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  60. package/dist/components/ContentRender/SandboxApp.cjs.js +2 -2
  61. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  62. package/dist/components/ContentRender/SandboxApp.es.js +21 -21
  63. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  64. package/dist/components/ContentRender/index.cjs.js +1 -1
  65. package/dist/components/ContentRender/index.es.js +6 -5
  66. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  67. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  68. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +2 -2
  69. package/dist/components/Slide/Player.cjs.js +2 -0
  70. package/dist/components/Slide/Player.cjs.js.map +1 -0
  71. package/dist/components/Slide/Player.d.ts +19 -0
  72. package/dist/components/Slide/Player.es.js +327 -0
  73. package/dist/components/Slide/Player.es.js.map +1 -0
  74. package/dist/components/Slide/Slide.cjs.js +2 -0
  75. package/dist/components/Slide/Slide.cjs.js.map +1 -0
  76. package/dist/components/Slide/Slide.d.ts +12 -0
  77. package/dist/components/Slide/Slide.es.js +394 -0
  78. package/dist/components/Slide/Slide.es.js.map +1 -0
  79. package/dist/components/Slide/Slide.stories.d.ts +47 -0
  80. package/dist/components/Slide/diff-utils.cjs.js +5 -0
  81. package/dist/components/Slide/diff-utils.cjs.js.map +1 -0
  82. package/dist/components/Slide/diff-utils.d.ts +18 -0
  83. package/dist/components/Slide/diff-utils.es.js +113 -0
  84. package/dist/components/Slide/diff-utils.es.js.map +1 -0
  85. package/dist/components/Slide/index.d.ts +12 -0
  86. package/dist/components/Slide/interaction-defaults.cjs.js +2 -0
  87. package/dist/components/Slide/interaction-defaults.cjs.js.map +1 -0
  88. package/dist/components/Slide/interaction-defaults.d.ts +23 -0
  89. package/dist/components/Slide/interaction-defaults.es.js +85 -0
  90. package/dist/components/Slide/interaction-defaults.es.js.map +1 -0
  91. package/dist/components/Slide/types.d.ts +24 -0
  92. package/dist/components/Slide/useSlide.cjs.js +2 -0
  93. package/dist/components/Slide/useSlide.cjs.js.map +1 -0
  94. package/dist/components/Slide/useSlide.d.ts +21 -0
  95. package/dist/components/Slide/useSlide.es.js +102 -0
  96. package/dist/components/Slide/useSlide.es.js.map +1 -0
  97. package/dist/components/index.d.ts +5 -0
  98. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  99. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  100. package/dist/index.cjs.js +1 -1
  101. package/dist/index.es.js +21 -9
  102. package/dist/index.es.js.map +1 -1
  103. package/dist/lib/browserUserActivation.cjs.js +2 -0
  104. package/dist/lib/browserUserActivation.cjs.js.map +1 -0
  105. package/dist/lib/browserUserActivation.d.ts +5 -0
  106. package/dist/lib/browserUserActivation.es.js +13 -0
  107. package/dist/lib/browserUserActivation.es.js.map +1 -0
  108. package/dist/markdown-flow-ui-lib.css +1 -1
  109. package/dist/renderer.cjs.js +1 -1
  110. package/dist/renderer.d.ts +3 -2
  111. package/dist/renderer.es.js +20 -8
  112. package/dist/renderer.es.js.map +1 -1
  113. package/package.json +1 -1
@@ -1,99 +1,119 @@
1
- import { j as H } from "../../_virtual/jsx-runtime.es.js";
2
- import J, { useRef as m, useState as k, useEffect as x } from "react";
3
- import { createRoot as at } from "react-dom/client";
4
- import ut from "./SandboxApp.es.js";
5
- import { splitContentSegments as ht } from "./utils/split-content.es.js";
6
- import dt from "./ContentRender.es.js";
7
- const mt = () => import("./blackboard-vendor.es.js").then((s) => s.injectBlackboardLibraries), ft = /<img\b[^>]*>/i, pt = 180, gt = "markdown-flow-ui:sandbox", bt = "interaction", wt = 240, tt = (s) => s.split(/\s+/).filter(Boolean).map((r) => r.split(":").pop() || r), K = (s) => {
8
- const r = s.trim().toLowerCase();
9
- if (!r) return null;
10
- const f = r.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
11
- return f ? `${f[1]}${f[2].toLowerCase()}` : null;
12
- }, Q = (s) => {
1
+ import { j as u } from "../../_virtual/jsx-runtime.es.js";
2
+ import se, { useRef as d, useState as A, useCallback as ve, useEffect as C } from "react";
3
+ import { createRoot as xe } from "react-dom/client";
4
+ import Ee from "./SandboxApp.es.js";
5
+ import { splitContentSegments as ye } from "./utils/split-content.es.js";
6
+ import Ce from "./ContentRender.es.js";
7
+ import Re 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";
8
+ let G = null;
9
+ const ce = () => (G || (G = import("./blackboard-vendor.es.js").then(
10
+ (s) => s.injectBlackboardLibraries
11
+ )), G);
12
+ typeof window < "u" && ce();
13
+ const He = /<img\b[^>]*>/i, Se = 180, Te = "markdown-flow-ui:sandbox", Ae = "interaction", Me = 240, ae = (s) => s.split(/\s+/).filter(Boolean).map((n) => n.split(":").pop() || n), ie = (s) => {
14
+ const n = s.trim().toLowerCase();
15
+ if (!n) return null;
16
+ const m = n.match(/^([0-9.]+)(vh|dvh|svh|lvh)$/i);
17
+ return m ? `${m[1]}${m[2].toLowerCase()}` : null;
18
+ }, le = (s) => {
13
19
  if (!s.trim()) return null;
14
- const r = tt(s);
15
- if (r.includes("h-screen") || r.includes("h-dvh"))
20
+ const n = ae(s);
21
+ if (n.includes("h-screen") || n.includes("h-dvh"))
16
22
  return "100dvh";
17
- if (r.includes("h-svh"))
23
+ if (n.includes("h-svh"))
18
24
  return "100svh";
19
- if (r.includes("h-lvh"))
25
+ if (n.includes("h-lvh"))
20
26
  return "100lvh";
21
- const f = r.find(
22
- (R) => /^h-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(R)
27
+ const m = n.find(
28
+ (M) => /^h-\[[0-9.]+(vh|dvh|svh|lvh)\]$/i.test(M)
23
29
  );
24
- if (!f) return null;
25
- const w = f.match(/^h-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i);
26
- return w ? `${w[1]}${w[2].toLowerCase()}` : null;
27
- }, Tt = ({
30
+ if (!m) return null;
31
+ const p = m.match(/^h-\[([0-9.]+)(vh|dvh|svh|lvh)\]$/i);
32
+ return p ? `${p[1]}${p[2].toLowerCase()}` : null;
33
+ }, Oe = ({
28
34
  content: s,
29
- type: r,
30
- className: f,
31
- loadingText: w,
32
- styleLoadingText: R,
33
- scriptLoadingText: $,
34
- fullScreenButtonText: N,
35
- hideFullScreen: L = !1,
36
- mode: d = "content"
35
+ type: n,
36
+ className: m,
37
+ loadingText: p,
38
+ styleLoadingText: M,
39
+ scriptLoadingText: U,
40
+ fullScreenButtonText: j,
41
+ hideFullScreen: W = !1,
42
+ mode: h = "content"
37
43
  }) => {
38
- const V = m(null), v = m(null), _ = m(null), P = m(null), I = m(() => {
39
- }), [, et] = k(480), [q, nt] = k(0), [rt, ot] = k(!1), G = d === "blackboard", O = m(""), n = J.useMemo(() => {
40
- const t = ht(s).filter((a) => a.type === "sandbox");
41
- return (d === "blackboard" ? t[t.length - 1]?.value || "" : t.map((a) => a.value).join(`
44
+ const X = d(null), E = d(null), _ = d(null), Y = d(null), D = d(() => {
45
+ }), [ue, de] = A(480), Z = d(0), [J, he] = A(0), [me, fe] = A(!1), [L, O] = A(
46
+ n !== "sandbox"
47
+ ), B = h === "blackboard", F = d(""), r = se.useMemo(() => {
48
+ const e = ye(s).filter((l) => l.type === "sandbox");
49
+ return (h === "blackboard" ? e[e.length - 1]?.value || "" : e.map((l) => l.value).join(`
42
50
  `)) || "";
43
- }, [s, d]), [T, U] = k(n), W = m(n), B = m(n), E = m(null), D = () => {
44
- E.current !== null && (window.clearTimeout(E.current), E.current = null);
51
+ }, [s, h]), [k, K] = A(r), Q = d(r), z = d(r), R = d(null), y = ve((t) => {
52
+ if (typeof window > "u")
53
+ return;
54
+ const e = Date.now();
55
+ e - Z.current < Me || (Z.current = e, window.postMessage(
56
+ {
57
+ source: Te,
58
+ type: Ae,
59
+ eventType: t
60
+ },
61
+ window.location.origin
62
+ ));
63
+ }, []), $ = () => {
64
+ R.current !== null && (window.clearTimeout(R.current), R.current = null);
45
65
  };
46
- x(
66
+ C(
47
67
  () => () => {
48
- D();
68
+ $();
49
69
  },
50
70
  []
51
- ), x(() => {
52
- const e = W.current;
53
- W.current = n;
54
- const t = !!e && n.length > e.length && n.startsWith(e), l = ft.test(n);
55
- if (!(t && l)) {
56
- D(), B.current = n, U(n);
71
+ ), C(() => {
72
+ const t = Q.current;
73
+ Q.current = r;
74
+ const e = !!t && r.length > t.length && r.startsWith(t), i = He.test(r);
75
+ if (!(e && i)) {
76
+ $(), z.current = r, K(r);
57
77
  return;
58
78
  }
59
- B.current = n, D(), E.current = window.setTimeout(() => {
60
- U(B.current), E.current = null;
61
- }, pt);
62
- }, [n]);
63
- const X = !!J.useMemo(() => {
64
- const e = T.trim();
65
- if (!e) return null;
66
- const t = e.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
79
+ z.current = r, $(), R.current = window.setTimeout(() => {
80
+ K(z.current), R.current = null;
81
+ }, Se);
82
+ }, [r]);
83
+ const ee = se.useMemo(() => {
84
+ const t = k.trim();
67
85
  if (!t) return null;
68
- const l = t[2] || "", a = l.match(/\bheight\s*=\s*["']([^"']+)["']/i);
69
- if (a) {
70
- const u = K(a[1]);
71
- if (u) return u;
86
+ const e = t.match(/^<([a-zA-Z][\w:-]*)(\s[^>]*?)?>/);
87
+ if (!e) return null;
88
+ const i = e[2] || "", l = i.match(/\bheight\s*=\s*["']([^"']+)["']/i);
89
+ if (l) {
90
+ const f = ie(l[1]);
91
+ if (f) return f;
72
92
  }
73
- const C = l.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
93
+ const S = i.match(/\bstyle\s*=\s*["']([^"']+)["']/i)?.[1]?.match(
74
94
  /\bheight\s*:\s*([^;]+)/i
75
95
  )?.[1];
76
- if (C) {
77
- const u = K(C);
78
- if (u) return u;
96
+ if (S) {
97
+ const f = ie(S);
98
+ if (f) return f;
79
99
  }
80
- const y = l.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1];
81
- return y ? Q(y) : null;
82
- }, [T]);
83
- x(() => {
84
- if (d !== "blackboard") {
85
- O.current = n;
100
+ const g = i.match(/\bclass\s*=\s*["']([^"']+)["']/i)?.[1];
101
+ return g ? le(g) : null;
102
+ }, [k]), te = !!ee, ne = n === "sandbox", H = B && n === "sandbox" ? ee ?? `${ue}px` : void 0;
103
+ C(() => {
104
+ if (h !== "blackboard") {
105
+ F.current = r;
86
106
  return;
87
107
  }
88
- const e = O.current;
89
- !(e && n.startsWith(e)) && e && nt((l) => l + 1), O.current = n;
90
- }, [n, d]), x(() => {
91
- const e = v.current;
92
- if (!e) return;
93
- const t = e.contentDocument;
108
+ const t = F.current;
109
+ !(t && r.startsWith(t)) && t && he((i) => i + 1), F.current = r;
110
+ }, [r, h]), C(() => {
111
+ const t = E.current;
94
112
  if (!t) return;
95
- t.open(), t.write(`<!DOCTYPE html>
96
- <html${d === "blackboard" ? ' style="height: 100%;"' : ""}>
113
+ const e = t.contentDocument;
114
+ if (!e) return;
115
+ e.open(), e.write(`<!DOCTYPE html>
116
+ <html${h === "blackboard" ? ' style="height: 100%;"' : ""}>
97
117
  <head>
98
118
  <meta charset="utf-8" />
99
119
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -106,169 +126,182 @@ const mt = () => import("./blackboard-vendor.es.js").then((s) => s.injectBlackbo
106
126
  <body>
107
127
  <div id="root"></div>
108
128
  </body>
109
- </html>`), t.close(), P.current = t;
110
- let l = 0;
111
- const a = (i) => {
112
- if (typeof window > "u")
113
- return;
114
- const c = Date.now();
115
- c - l < wt || (l = c, window.postMessage(
116
- {
117
- source: gt,
118
- type: bt,
119
- eventType: i
120
- },
121
- window.location.origin
122
- ));
123
- }, j = G && r === "sandbox", C = () => a("pointerdown"), y = () => a("touchstart");
124
- j && (t.addEventListener("pointerdown", C, !0), t.addEventListener("touchstart", y, !0));
125
- const u = t.getElementById("root");
126
- if (!u) return;
127
- const Y = at(u);
128
- _.current = Y;
129
- let A = !1;
130
- const Z = (i, c) => {
131
- const o = i.trim().toLowerCase();
129
+ </html>`), e.close(), Y.current = e;
130
+ const i = B && n === "sandbox", l = () => y("pointerdown"), V = () => y("mousedown"), S = () => y("touchstart");
131
+ i && (e.addEventListener("pointerdown", l, !0), e.addEventListener("mousedown", V, !0), e.addEventListener("touchstart", S, !0));
132
+ const g = e.getElementById("root");
133
+ if (!g) return;
134
+ const f = xe(g);
135
+ _.current = f;
136
+ let T = !1;
137
+ const oe = (c, b) => {
138
+ const o = c.trim().toLowerCase();
132
139
  if (!o) return null;
133
- const h = Number.parseFloat(o);
134
- return Number.isNaN(h) ? null : /(dvh|svh|lvh|vh)$/i.test(o) ? h / 100 * c : o.endsWith("px") || /^[0-9.]+$/.test(o) ? h : null;
135
- }, lt = (i, c) => {
136
- if (!i.trim()) return null;
137
- const o = Q(i);
140
+ const a = Number.parseFloat(o);
141
+ return Number.isNaN(a) ? null : /(dvh|svh|lvh|vh)$/i.test(o) ? a / 100 * b : o.endsWith("px") || /^[0-9.]+$/.test(o) ? a : null;
142
+ }, ge = (c, b) => {
143
+ if (!c.trim()) return null;
144
+ const o = le(c);
138
145
  if (o)
139
- return Z(o, c);
140
- const p = tt(i).find(
141
- (S) => /^h-\[[0-9.]+px\]$/i.test(S)
146
+ return oe(o, b);
147
+ const w = ae(c).find(
148
+ (I) => /^h-\[[0-9.]+px\]$/i.test(I)
142
149
  );
143
- if (!p) return null;
144
- const g = p.match(/^h-\[([0-9.]+)px\]$/i);
145
- if (!g) return null;
146
- const b = Number.parseFloat(g[1]);
147
- return Number.isNaN(b) ? null : b;
148
- }, ct = () => {
149
- if (!v.current || !t.body) return null;
150
- const c = t.body.querySelector(
150
+ if (!w) return null;
151
+ const v = w.match(/^h-\[([0-9.]+)px\]$/i);
152
+ if (!v) return null;
153
+ const x = Number.parseFloat(v[1]);
154
+ return Number.isNaN(x) ? null : x;
155
+ }, we = () => {
156
+ if (!E.current || !e.body) return null;
157
+ const b = e.body.querySelector(
151
158
  ".sandbox-wrapper"
152
159
  )?.firstElementChild;
153
- if (!c) return null;
154
- const o = Array.from(c.children);
160
+ if (!b) return null;
161
+ const o = Array.from(b.children);
155
162
  if (o.length !== 1) return null;
156
- const h = o[0], p = h.style.height || h.getAttribute("height"), g = v.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, b = p ? Z(p, g) : null;
157
- if (b !== null)
158
- return Math.ceil(b);
159
- const S = lt(
160
- h.getAttribute("class") || "",
161
- g
163
+ const a = o[0], w = a.style.height || a.getAttribute("height"), v = E.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, x = w ? oe(w, v) : null;
164
+ if (x !== null)
165
+ return Math.ceil(x);
166
+ const I = ge(
167
+ a.getAttribute("class") || "",
168
+ v
162
169
  );
163
- return S !== null ? Math.ceil(S) : null;
164
- }, z = () => {
165
- if (!v.current || !t.body) return;
166
- const i = t.body.getBoundingClientRect(), c = t.documentElement?.getBoundingClientRect(), o = i.height, h = c?.height || 0, p = Math.max(o, h), g = ct(), b = Math.max(
170
+ return I !== null ? Math.ceil(I) : null;
171
+ }, P = () => {
172
+ if (!E.current || !e.body) return;
173
+ const c = e.body.getBoundingClientRect(), b = e.documentElement?.getBoundingClientRect(), o = c.height, a = b?.height || 0, w = Math.max(o, a), v = we(), x = Math.max(
167
174
  200,
168
- g ?? Math.ceil(p)
175
+ v ?? Math.ceil(w)
169
176
  );
170
- et(b);
171
- }, M = () => {
177
+ de(x);
178
+ }, N = () => {
172
179
  requestAnimationFrame(() => {
173
- A || z();
180
+ T || P();
174
181
  });
175
182
  };
176
- I.current = M, z(), M(), mt().then((i) => {
177
- A || (i(t), M());
183
+ D.current = N, P(), N(), ne ? ce().then((c) => {
184
+ T || (c(e), requestAnimationFrame(() => {
185
+ T || (O(!0), N());
186
+ }));
178
187
  }).catch(() => {
179
- A || M();
180
- });
181
- const F = new ResizeObserver(() => z());
182
- return F.observe(t.body), u && F.observe(u), () => {
183
- A = !0, F.disconnect(), j && (t.removeEventListener("pointerdown", C, !0), t.removeEventListener("touchstart", y, !0)), setTimeout(() => {
184
- Y.unmount(), _.current = null, P.current = null, I.current = () => {
188
+ T || (O(!0), N());
189
+ }) : O(!0);
190
+ const q = new ResizeObserver(() => P());
191
+ return q.observe(e.body), g && q.observe(g), () => {
192
+ T = !0, q.disconnect(), i && (e.removeEventListener("pointerdown", l, !0), e.removeEventListener("mousedown", V, !0), e.removeEventListener("touchstart", S, !0)), setTimeout(() => {
193
+ f.unmount(), _.current = null, Y.current = null, D.current = () => {
185
194
  };
186
195
  }, 0);
187
196
  };
188
- }, []), x(() => {
189
- const e = () => {
190
- ot(!!document.fullscreenElement);
197
+ }, []), C(() => {
198
+ const t = () => {
199
+ fe(!!document.fullscreenElement);
191
200
  };
192
- return document.addEventListener("fullscreenchange", e), () => document.removeEventListener("fullscreenchange", e);
201
+ return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
193
202
  }, []);
194
- const st = () => {
195
- const e = V.current || v.current;
196
- if (e) {
203
+ const be = () => {
204
+ const t = X.current || E.current;
205
+ if (t) {
197
206
  if (document.fullscreenElement) {
198
207
  document.exitFullscreen().catch(() => {
199
208
  });
200
209
  return;
201
210
  }
202
- e.requestFullscreen && e.requestFullscreen().catch(() => {
211
+ t.requestFullscreen && t.requestFullscreen().catch(() => {
203
212
  });
204
213
  }
205
214
  };
206
- x(() => {
207
- const e = _.current;
208
- e && (e.render(
209
- /* @__PURE__ */ H.jsx(
210
- ut,
215
+ C(() => {
216
+ const t = _.current;
217
+ !t || !L || (t.render(
218
+ /* @__PURE__ */ u.jsx(
219
+ Ee,
211
220
  {
212
- html: T,
213
- loadingText: w,
214
- styleLoadingText: R,
215
- scriptLoadingText: $,
216
- fullScreenButtonText: N,
217
- hideFullScreen: L,
218
- resetToken: q,
219
- hasRootVhHeight: X,
220
- mode: d
221
+ html: k,
222
+ loadingText: p,
223
+ styleLoadingText: M,
224
+ scriptLoadingText: U,
225
+ fullScreenButtonText: j,
226
+ hideFullScreen: W,
227
+ resetToken: J,
228
+ hasRootVhHeight: te,
229
+ mode: h
221
230
  }
222
231
  )
223
- ), requestAnimationFrame(() => I.current?.()));
232
+ ), requestAnimationFrame(() => D.current?.()));
224
233
  }, [
225
- T,
226
- w,
227
- R,
228
- $,
229
- N,
230
- q,
231
- d
234
+ k,
235
+ p,
236
+ M,
237
+ U,
238
+ j,
239
+ J,
240
+ h,
241
+ L
232
242
  ]);
233
- const it = [
243
+ const pe = [
234
244
  "w-full relative content-render-iframe-sandbox",
235
- G ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
236
- ].filter(Boolean).join(" ");
237
- return /* @__PURE__ */ H.jsxs(
245
+ B ? "h-full overflow-auto flex flex-col" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
246
+ ].filter(Boolean).join(" "), re = ne && !L;
247
+ return /* @__PURE__ */ u.jsxs(
238
248
  "div",
239
249
  {
240
- ref: V,
241
- "data-root-vh": X ? "true" : "false",
242
- className: it,
250
+ ref: X,
251
+ "data-root-vh": te ? "true" : "false",
252
+ className: pe,
253
+ style: H ? {
254
+ height: H,
255
+ minHeight: H
256
+ } : void 0,
243
257
  children: [
244
- !L && /* @__PURE__ */ H.jsx(
258
+ !W && /* @__PURE__ */ u.jsx(
245
259
  "button",
246
260
  {
247
261
  type: "button",
248
- onClick: st,
262
+ onClick: be,
249
263
  className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
250
- children: rt ? "退出全屏" : N || "全屏浏览"
264
+ children: me ? "退出全屏" : j || "全屏浏览"
251
265
  }
252
266
  ),
253
- d === "blackboard" && r === "markdown" ? /* @__PURE__ */ H.jsx(dt, { content: s }) : /* @__PURE__ */ H.jsx(
254
- "iframe",
267
+ h === "blackboard" && n === "markdown" ? /* @__PURE__ */ u.jsx(
268
+ "div",
255
269
  {
256
- ref: v,
257
- sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
258
- allow: "fullscreen",
259
- allowFullScreen: !0,
260
- className: [f, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
261
- style: {
262
- height: "100%",
263
- margin: "auto"
264
- }
270
+ onMouseDown: () => y("mousedown"),
271
+ onPointerDown: () => y("pointerdown"),
272
+ onTouchStart: () => y("touchstart"),
273
+ children: /* @__PURE__ */ u.jsx(Ce, { content: s })
265
274
  }
266
- )
275
+ ) : /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
276
+ /* @__PURE__ */ u.jsx(
277
+ "iframe",
278
+ {
279
+ ref: E,
280
+ sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
281
+ allow: "fullscreen",
282
+ allowFullScreen: !0,
283
+ className: [m, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
284
+ style: {
285
+ height: H ?? "100%",
286
+ minHeight: H,
287
+ margin: "auto",
288
+ visibility: re ? "hidden" : "visible"
289
+ }
290
+ }
291
+ ),
292
+ re ? /* @__PURE__ */ u.jsx("div", { className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center", children: /* @__PURE__ */ u.jsx(
293
+ Re,
294
+ {
295
+ "aria-label": p || "Preparing sandbox styles",
296
+ className: "text-primary h-7 w-7 animate-spin"
297
+ }
298
+ ) }) : null
299
+ ] })
267
300
  ]
268
301
  }
269
302
  );
270
303
  };
271
304
  export {
272
- Tt as default
305
+ Oe as default
273
306
  };
274
307
  //# sourceMappingURL=IframeSandbox.es.js.map