markdown-flow-ui 0.1.113 → 0.1.114-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 (61) hide show
  1. package/dist/_virtual/index.cjs10.js +1 -1
  2. package/dist/_virtual/index.cjs4.js +1 -1
  3. package/dist/_virtual/index.cjs6.js +1 -1
  4. package/dist/_virtual/index.cjs7.js +1 -1
  5. package/dist/_virtual/index.cjs8.js +1 -1
  6. package/dist/_virtual/index.cjs9.js +1 -1
  7. package/dist/_virtual/index.es10.js +2 -2
  8. package/dist/_virtual/index.es4.js +5 -5
  9. package/dist/_virtual/index.es6.js +2 -5
  10. package/dist/_virtual/index.es6.js.map +1 -1
  11. package/dist/_virtual/index.es7.js +5 -2
  12. package/dist/_virtual/index.es7.js.map +1 -1
  13. package/dist/_virtual/index.es8.js +3 -2
  14. package/dist/_virtual/index.es8.js.map +1 -1
  15. package/dist/_virtual/index.es9.js +2 -3
  16. package/dist/_virtual/index.es9.js.map +1 -1
  17. package/dist/assets/markdown-flow-ui.css +1 -1
  18. package/dist/components/ContentRender/ContentRender.stories.d.ts +1 -0
  19. package/dist/components/ContentRender/IframeSandbox.cjs.js +2 -2
  20. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  21. package/dist/components/ContentRender/IframeSandbox.es.js +183 -180
  22. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  23. package/dist/components/ContentRender/utils/iframe-stream.cjs.js +2 -0
  24. package/dist/components/ContentRender/utils/iframe-stream.cjs.js.map +1 -0
  25. package/dist/components/ContentRender/utils/iframe-stream.d.ts +9 -0
  26. package/dist/components/ContentRender/utils/iframe-stream.es.js +21 -0
  27. package/dist/components/ContentRender/utils/iframe-stream.es.js.map +1 -0
  28. package/dist/components/ContentRender/utils/iframe-stream.test.d.ts +1 -0
  29. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  30. package/dist/components/Slide/Slide.es.js.map +1 -1
  31. package/dist/components/Slide/utils/listenModeElementList.d.ts +1 -0
  32. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  33. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  34. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js +1 -1
  35. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.cjs.js.map +1 -1
  36. package/dist/markdown-flow-ui/node_modules/.pnpm/@braintree_sanitize-url@7.1.1/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
  37. package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.cjs.js +1 -1
  38. package/dist/markdown-flow-ui/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js +1 -1
  39. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.cjs.js +1 -1
  40. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-YG6GDRKO.es.js +1 -1
  41. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.cjs.js +1 -1
  42. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-S3R3BYOJ.es.js +1 -1
  43. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.cjs.js +1 -1
  44. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/chunk-TZMSLE5B.es.js +1 -1
  45. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.cjs.js +1 -1
  46. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-LVOFAZNH.es.js +1 -1
  47. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.cjs.js +1 -1
  48. package/dist/markdown-flow-ui/node_modules/.pnpm/mermaid@11.12.1/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-WL72ISMW.es.js +1 -1
  49. package/dist/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
  50. package/dist/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
  51. package/dist/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
  52. package/dist/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
  53. package/dist/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
  54. package/dist/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
  55. package/dist/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
  56. package/dist/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
  57. package/dist/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.cjs.js +1 -1
  58. package/dist/markdown-flow-ui/node_modules/.pnpm/style-to-object@1.0.11/node_modules/style-to-object/cjs/index.es.js +1 -1
  59. package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.cjs.js +1 -1
  60. package/dist/markdown-flow-ui/node_modules/.pnpm/unified@11.0.5/node_modules/unified/lib/index.es.js +1 -1
  61. package/package.json +1 -1
@@ -1,128 +1,131 @@
1
- import { j as C } from "../../_virtual/jsx-runtime.es.js";
2
- import j, { useRef as i, useState as M, useCallback as We, useEffect as H, useMemo as De } from "react";
3
- import { createRoot as Pe } from "react-dom/client";
4
- import $e from "./SandboxApp.es.js";
5
- import ze from "./ContentRender.es.js";
6
- import { inspectViewportHeightFromHtmlRootString as ye, EMPTY_ROOT_HEIGHT_META as qe, parseExplicitHeight as Ce, inspectViewportHeightFromNodeChain as Ge, resolveExplicitHeightFromNodeChain as Le } from "./utils/iframe-viewport-height.es.js";
7
- import { SANDBOX_INTERACTION_MESSAGE_TYPE as Ue, SANDBOX_INTERACTION_MESSAGE_SOURCE as Ye } from "../../lib/sandboxInteraction.es.js";
8
- import { injectScalingSystem as Xe } from "./utils/iframe-scaling.es.js";
9
- let oe = null;
10
- const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
1
+ import { j as E } from "../../_virtual/jsx-runtime.es.js";
2
+ import j, { useRef as i, useState as M, useCallback as $e, useEffect as H, useMemo as ze } from "react";
3
+ import { createRoot as qe } from "react-dom/client";
4
+ import Le from "./SandboxApp.es.js";
5
+ import Ge from "./ContentRender.es.js";
6
+ import { inspectViewportHeightFromHtmlRootString as Te, EMPTY_ROOT_HEIGHT_META as Ue, parseExplicitHeight as Ae, inspectViewportHeightFromNodeChain as Ye, resolveExplicitHeightFromNodeChain as Xe } from "./utils/iframe-viewport-height.es.js";
7
+ import { SANDBOX_INTERACTION_MESSAGE_TYPE as Ze, SANDBOX_INTERACTION_MESSAGE_SOURCE as Je } from "../../lib/sandboxInteraction.es.js";
8
+ import { injectScalingSystem as Ke } from "./utils/iframe-scaling.es.js";
9
+ import { shouldDeferAppendOnlyHtmlRender as Qe, resolveIframeRenderHtmlContent as et } from "./utils/iframe-stream.es.js";
10
+ let ie = null;
11
+ const tt = () => (ie || (ie = import("./blackboard-vendor.es.js").then(
11
12
  (c) => c.injectBlackboardLibraries
12
- )), oe), Je = /<img\b[^>]*>/i, Ke = 180, Qe = 240, et = (c) => c.split(/\s+/).filter(Boolean).map((o) => {
13
- const s = o.split(":");
14
- return s[s.length - 1] !== "h-screen" && s[s.length - 1] !== "min-h-screen" ? o : (s[s.length - 1] = "h-full", s.join(":"));
15
- }).join(" "), tt = (c, o) => !o || !c.trim() ? c : c.replace(
13
+ )), ie), nt = 180, rt = 240, ot = (c) => c.split(/\s+/).filter(Boolean).map((o) => {
14
+ const l = o.split(":");
15
+ return l[l.length - 1] !== "h-screen" && l[l.length - 1] !== "min-h-screen" ? o : (l[l.length - 1] = "h-full", l.join(":"));
16
+ }).join(" "), it = (c, o) => !o || !c.trim() ? c : c.replace(
16
17
  /^(\s*<[a-zA-Z][\w:-]*)(\s[^>]*?)?>/,
17
- (s, B, T = "") => {
18
- const d = T.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
19
- if (!d)
20
- return s;
21
- const W = et(d[2]);
22
- return W === d[2] ? s : `${B}${T.replace(
23
- d[0],
24
- `class=${d[1]}${W}${d[1]}`
18
+ (l, B, T = "") => {
19
+ const h = T.match(/\bclass\s*=\s*(["'])([^"']*)\1/i);
20
+ if (!h)
21
+ return l;
22
+ const W = ot(h[2]);
23
+ return W === h[2] ? l : `${B}${T.replace(
24
+ h[0],
25
+ `class=${h[1]}${W}${h[1]}`
25
26
  )}>`;
26
27
  }
27
- ), ut = ({
28
+ ), gt = ({
28
29
  content: c,
29
30
  type: o,
30
- className: s,
31
+ className: l,
31
32
  styleLoadingText: B,
32
33
  scriptLoadingText: T,
33
- fullScreenButtonText: d,
34
+ fullScreenButtonText: h,
34
35
  hideFullScreen: W = !1,
35
- mode: l = "content",
36
- replaceRootScreenHeightWithFull: Me = !1,
37
- enableScaling: Te = !1,
38
- disableLoadingOverlay: ie = !1
36
+ mode: s = "content",
37
+ replaceRootScreenHeightWithFull: ke = !1,
38
+ enableScaling: _e = !1,
39
+ disableLoadingOverlay: le = !1
39
40
  }) => {
40
- const D = i(null), m = i(null), U = i(null), A = i(() => {
41
- }), [Ae, _e] = M(480), [se, ke] = M(0), [Y, ce] = M(0), X = i(!1), Z = i(!1), le = i(0), [ae, Fe] = M(0), [J, Ie] = M(!1), Ne = o === "sandbox", f = l === "blackboard", w = Te && f && o === "sandbox", _ = f && o === "sandbox", R = _ && Me, K = i(""), P = j.useMemo(
41
+ const D = i(null), d = i(null), G = i(null), A = i(() => {
42
+ }), [Fe, Ie] = M(480), [ce, Ne] = M(0), [U, se] = M(0), Y = i(!1), X = i(!1), ae = i(0), [ue, Oe] = M(0), [Z, Ve] = M(!1), je = o === "sandbox", m = s === "blackboard", w = _e && m && o === "sandbox", k = m && o === "sandbox", y = k && ke, J = i(""), P = j.useMemo(
42
43
  () => o === "sandbox" ? c : "",
43
44
  [c, o]
44
45
  ), n = j.useMemo(
45
- () => tt(
46
+ () => it(
46
47
  P,
47
- R
48
+ y
48
49
  ),
49
- [P, R]
50
- ), ue = j.useMemo(
51
- () => R ? ye(P) : qe,
52
- [P, R]
50
+ [P, y]
53
51
  ), he = j.useMemo(
54
- () => R && ue.hasFullViewportHeight,
52
+ () => y ? Te(P) : Ue,
53
+ [P, y]
54
+ ), de = j.useMemo(
55
+ () => y && he.hasFullViewportHeight,
55
56
  [
56
- ue.hasFullViewportHeight,
57
- R
57
+ he.hasFullViewportHeight,
58
+ y
58
59
  ]
59
- ), [$, de] = M(
60
+ ), [K, me] = M(
60
61
  n
61
- ), me = i(n), Q = i(n), k = i(null), F = i(null), fe = i(null), ge = We((t) => {
62
+ ), fe = i(n), Q = i(n), _ = i(null), F = i(null), ge = i(null), be = fe.current, pe = Qe({
63
+ previousHtml: be,
64
+ nextHtml: n
65
+ }), $ = et({
66
+ previousHtml: be,
67
+ nextHtml: n,
68
+ committedHtml: K
69
+ }), He = $e((t) => {
62
70
  if (typeof window > "u")
63
71
  return;
64
72
  const e = Date.now();
65
- e - le.current < Qe || (le.current = e, window.postMessage(
73
+ e - ae.current < rt || (ae.current = e, window.postMessage(
66
74
  {
67
- source: Ye,
68
- type: Ue,
75
+ source: Je,
76
+ type: Ze,
69
77
  eventType: t
70
78
  },
71
79
  window.location.origin
72
80
  ));
73
81
  }, []), ee = () => {
74
- k.current !== null && (window.clearTimeout(k.current), k.current = null);
75
- }, Oe = () => {
82
+ _.current !== null && (window.clearTimeout(_.current), _.current = null);
83
+ }, Be = () => {
76
84
  F.current !== null && (window.cancelAnimationFrame(F.current), F.current = null);
77
85
  };
78
86
  H(
79
87
  () => () => {
80
- ee(), Oe();
88
+ ee(), Be();
81
89
  },
82
90
  []
83
91
  ), H(() => {
84
- const t = me.current;
85
- me.current = n;
86
- const e = !!t && n.length > t.length && n.startsWith(t), a = Je.test(
87
- n
88
- );
89
- if (!(e && a)) {
90
- ee(), Q.current = n, de(n);
92
+ if (fe.current = n, !pe) {
93
+ ee(), Q.current = n, K !== n && me(n);
91
94
  return;
92
95
  }
93
- Q.current = n, ee(), k.current = window.setTimeout(() => {
94
- de(Q.current), k.current = null;
95
- }, Ke);
96
- }, [n]);
97
- const z = j.useMemo(() => _ ? ye($).viewportHeightCss : null, [$, _]);
96
+ Q.current = n, ee(), _.current = window.setTimeout(() => {
97
+ me(Q.current), _.current = null;
98
+ }, nt);
99
+ }, [n, K, pe]);
100
+ const z = j.useMemo(() => k ? Te($).viewportHeightCss : null, [$, k]);
98
101
  H(() => {
99
- fe.current = z;
102
+ ge.current = z;
100
103
  }, [z]);
101
- const be = !!z, I = f && o === "sandbox" ? w || he ? "100%" : z ?? `${Ae}px` : void 0;
104
+ const we = !!z, I = m && o === "sandbox" ? w || de ? "100%" : z ?? `${Fe}px` : void 0;
102
105
  H(() => {
103
- if (l !== "blackboard") {
104
- K.current = n;
106
+ if (s !== "blackboard") {
107
+ J.current = n;
105
108
  return;
106
109
  }
107
- const t = K.current;
108
- !(t && n.startsWith(t)) && t && Fe((a) => a + 1), K.current = n;
109
- }, [l, n]), H(() => {
110
- const t = m.current;
110
+ const t = J.current;
111
+ !(t && n.startsWith(t)) && t && Oe((f) => f + 1), J.current = n;
112
+ }, [s, n]), H(() => {
113
+ const t = d.current;
111
114
  if (!t) return;
112
115
  const e = t.contentDocument;
113
116
  if (!e) return;
114
117
  e.open(), e.write(`<!DOCTYPE html>
115
- <html${l === "blackboard" ? ' style="height: 100%;"' : ""}>
118
+ <html${s === "blackboard" ? ' style="height: 100%;"' : ""}>
116
119
  <head>
117
120
  <meta charset="utf-8" />
118
121
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
119
122
  <style>
120
123
  :root { color-scheme: light; }
121
124
  html, body, #root { width: 100%; }
122
- ${l === "blackboard" ? "html, body, #root { height: 100%; }" : ""}
123
- html, body { margin: 0; padding: 0; overflow: ${w ? "hidden auto" : l === "blackboard" ? "auto" : "hidden"}; }
125
+ ${s === "blackboard" ? "html, body, #root { height: 100%; }" : ""}
126
+ html, body { margin: 0; padding: 0; overflow: ${w ? "hidden auto" : s === "blackboard" ? "auto" : "hidden"}; }
124
127
  *, *::before, *::after { box-sizing: border-box; }
125
- ${l !== "blackboard" ? `
128
+ ${s !== "blackboard" ? `
126
129
  .h-screen { height: auto !important; }
127
130
  .min-h-screen { min-height: auto !important; }
128
131
  .h-dvh, .h-svh, .h-lvh { height: auto !important; }
@@ -134,168 +137,168 @@ const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
134
137
  <div id="root"></div>
135
138
  </body>
136
139
  </html>`), e.close(), e.documentElement.setAttribute("data-theme", "light"), e.documentElement.style.colorScheme = "light", e.body?.style.setProperty("color-scheme", "light");
137
- const a = f && o === "sandbox", q = () => ge("click");
138
- a && e.addEventListener("click", q, !0);
140
+ const f = m && o === "sandbox", te = () => He("click");
141
+ f && e.addEventListener("click", te, !0);
139
142
  const N = e.getElementById("root");
140
143
  if (!N) return;
141
- const He = Pe(N);
142
- U.current = He;
144
+ const ve = qe(N);
145
+ G.current = ve;
143
146
  let O = !1;
144
- const we = (r) => ({
147
+ const Re = (r) => ({
145
148
  heightAttrValue: r.getAttribute("height"),
146
149
  styleAttrValue: r.getAttribute("style"),
147
150
  classAttrValue: r.getAttribute("class")
148
- }), xe = (r) => {
151
+ }), ye = (r) => {
149
152
  const x = Array.from(r.children);
150
153
  return x.length === 1 ? x[0] : null;
151
- }, Be = () => {
152
- if (!_ || !m.current || !e.body) return null;
153
- const r = m.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, x = fe.current, G = x ? Ce(
154
+ }, Pe = () => {
155
+ if (!k || !d.current || !e.body) return null;
156
+ const r = d.current.ownerDocument?.documentElement?.clientHeight || window.innerHeight, x = ge.current, q = x ? Ae(
154
157
  x,
155
158
  r
156
159
  ) : null;
157
- if (G !== null)
158
- return Math.ceil(G);
159
- const h = e.body.querySelector(
160
+ if (q !== null)
161
+ return Math.ceil(q);
162
+ const u = e.body.querySelector(
160
163
  ".sandbox-wrapper"
161
164
  )?.firstElementChild;
162
- if (!h) return null;
163
- const g = Array.from(h.children), v = g.length === 1 ? g[0] : null, u = Ge(
165
+ if (!u) return null;
166
+ const g = Array.from(u.children), v = g.length === 1 ? g[0] : null, a = Ye(
164
167
  v,
165
168
  {
166
- getNode: we,
167
- getSingleChild: xe
169
+ getNode: Re,
170
+ getSingleChild: ye
168
171
  }
169
172
  ).viewportHeightCss;
170
- if (u) {
171
- const b = Ce(
172
- u,
173
+ if (a) {
174
+ const b = Ae(
175
+ a,
173
176
  r
174
177
  );
175
178
  if (b !== null)
176
179
  return Math.ceil(b);
177
180
  }
178
- const V = Le(
181
+ const V = Xe(
179
182
  v,
180
183
  r,
181
184
  {
182
- getNode: we,
183
- getSingleChild: xe
185
+ getNode: Re,
186
+ getSingleChild: ye
184
187
  }
185
188
  );
186
189
  return V !== null ? Math.ceil(V) : null;
187
- }, te = () => {
188
- if (!m.current || !e.body) return;
189
- if (!f) {
190
- if (X.current) {
191
- Z.current = !0;
190
+ }, ne = () => {
191
+ if (!d.current || !e.body) return;
192
+ if (!m) {
193
+ if (Y.current) {
194
+ X.current = !0;
192
195
  return;
193
196
  }
194
- X.current = !0;
195
- const h = m.current, g = D.current?.clientWidth || 0, v = h.style.height;
197
+ Y.current = !0;
198
+ const u = d.current, g = D.current?.clientWidth || 0, v = u.style.height;
196
199
  if (g > 0) {
197
- const re = Math.round(g * 9 / 16);
198
- h.style.height = re + "px", e.body.offsetHeight;
199
- let u = e.body.scrollHeight;
200
+ const oe = Math.round(g * 9 / 16);
201
+ u.style.height = oe + "px", e.body.offsetHeight;
202
+ let a = e.body.scrollHeight;
200
203
  const V = e.defaultView;
201
204
  if (V) {
202
205
  const b = (p) => {
203
- let y = 0;
204
- const Re = (E) => {
205
- if (E !== p && E.scrollHeight > E.clientHeight + 1) {
206
- const L = V.getComputedStyle(E).overflowY;
206
+ let S = 0;
207
+ const Ee = (R) => {
208
+ if (R !== p && R.scrollHeight > R.clientHeight + 1) {
209
+ const L = V.getComputedStyle(R).overflowY;
207
210
  if (L === "auto" || L === "scroll") {
208
- const Se = E.getBoundingClientRect();
209
- Se.top >= 0 && (y = Math.max(
210
- y,
211
- Math.ceil(Se.top + E.scrollHeight)
211
+ const Me = R.getBoundingClientRect();
212
+ Me.top >= 0 && (S = Math.max(
213
+ S,
214
+ Math.ceil(Me.top + R.scrollHeight)
212
215
  ));
213
216
  }
214
217
  }
215
- for (const L of E.children) Re(L);
218
+ for (const L of R.children) Ee(L);
216
219
  };
217
- return Re(p), y;
220
+ return Ee(p), S;
218
221
  };
219
- u = Math.max(u, b(e.body));
220
- for (let p = 0; p < 8 && u > re; p++) {
221
- h.style.height = u + "px", e.body.offsetHeight;
222
- const y = Math.max(
222
+ a = Math.max(a, b(e.body));
223
+ for (let p = 0; p < 8 && a > oe; p++) {
224
+ u.style.height = a + "px", e.body.offsetHeight;
225
+ const S = Math.max(
223
226
  e.body.scrollHeight,
224
227
  b(e.body)
225
228
  );
226
- if (y <= u + 1) break;
227
- u = y;
229
+ if (S <= a + 1) break;
230
+ a = S;
228
231
  }
229
232
  }
230
- h.style.height = v, ke((b) => {
231
- const p = Math.max(200, Math.ceil(u));
233
+ u.style.height = v, Ne((b) => {
234
+ const p = Math.max(200, Math.ceil(a));
232
235
  return b === p ? b : p;
233
236
  });
234
237
  }
235
238
  setTimeout(() => {
236
- X.current = !1, Z.current && (Z.current = !1, S());
239
+ Y.current = !1, X.current && (X.current = !1, C());
237
240
  }, 50);
238
241
  return;
239
242
  }
240
243
  if (w) return;
241
- const r = e.body.scrollHeight, x = e.documentElement?.scrollHeight || 0, G = N?.scrollHeight || 0, Ee = Math.max(r, x, G);
242
- if (_) {
243
- const h = Be(), g = Math.max(
244
+ const r = e.body.scrollHeight, x = e.documentElement?.scrollHeight || 0, q = N?.scrollHeight || 0, Se = Math.max(r, x, q);
245
+ if (k) {
246
+ const u = Pe(), g = Math.max(
244
247
  200,
245
- h ?? Math.ceil(Ee)
248
+ u ?? Math.ceil(Se)
246
249
  );
247
- _e(
250
+ Ie(
248
251
  (v) => v === g ? v : g
249
252
  );
250
253
  }
251
- }, S = () => {
254
+ }, C = () => {
252
255
  requestAnimationFrame(() => {
253
- O || te();
256
+ O || ne();
254
257
  });
255
258
  };
256
- A.current = S, te(), S(), Ne && Ze().then((r) => {
257
- O || (r(e), w && Xe(e), requestAnimationFrame(() => {
258
- O || S();
259
+ A.current = C, ne(), C(), je && tt().then((r) => {
260
+ O || (r(e), w && Ke(e), requestAnimationFrame(() => {
261
+ O || C();
259
262
  }));
260
263
  }).catch(() => {
261
- O || S();
264
+ O || C();
262
265
  });
263
- const ne = new ResizeObserver(() => te());
264
- ne.observe(e.body), N && ne.observe(N);
265
- const ve = new MutationObserver(() => {
266
- S();
266
+ const re = new ResizeObserver(() => ne());
267
+ re.observe(e.body), N && re.observe(N);
268
+ const Ce = new MutationObserver(() => {
269
+ C();
267
270
  });
268
- return ve.observe(e.body, {
271
+ return Ce.observe(e.body, {
269
272
  childList: !0,
270
273
  subtree: !0,
271
274
  attributes: !0,
272
275
  attributeFilter: ["style", "class"]
273
276
  }), () => {
274
- O = !0, ne.disconnect(), ve.disconnect(), w && t.contentWindow?.__mdf_cleanupScaling?.(), a && e.removeEventListener("click", q, !0), setTimeout(() => {
275
- He.unmount(), U.current = null, A.current = () => {
277
+ O = !0, re.disconnect(), Ce.disconnect(), w && t.contentWindow?.__mdf_cleanupScaling?.(), f && e.removeEventListener("click", te, !0), setTimeout(() => {
278
+ ve.unmount(), G.current = null, A.current = () => {
276
279
  };
277
280
  }, 0);
278
281
  };
279
282
  }, []), H(() => {
280
283
  const t = () => {
281
- Ie(!!document.fullscreenElement);
284
+ Ve(!!document.fullscreenElement);
282
285
  };
283
286
  return document.addEventListener("fullscreenchange", t), () => document.removeEventListener("fullscreenchange", t);
284
287
  }, []), H(() => {
285
288
  const t = D.current;
286
289
  if (!t) return;
287
- const e = new ResizeObserver((a) => {
288
- ce(a[0]?.contentRect.width ?? t.clientWidth);
290
+ const e = new ResizeObserver((f) => {
291
+ se(f[0]?.contentRect.width ?? t.clientWidth);
289
292
  });
290
- return e.observe(t), ce(t.clientWidth), () => e.disconnect();
293
+ return e.observe(t), se(t.clientWidth), () => e.disconnect();
291
294
  }, []);
292
- const pe = De(() => {
293
- if (f || Y === 0 || J)
295
+ const xe = ze(() => {
296
+ if (m || U === 0 || Z)
294
297
  return;
295
- const t = Math.round(Y * 9 / 16);
296
- return { height: Math.max(t, se) };
297
- }, [f, Y, se, J]), Ve = () => {
298
- const t = D.current || m.current;
298
+ const t = Math.round(U * 9 / 16);
299
+ return { height: Math.max(t, ce) };
300
+ }, [m, U, ce, Z]), We = () => {
301
+ const t = D.current || d.current;
299
302
  if (t) {
300
303
  if (document.fullscreenElement) {
301
304
  document.exitFullscreen().catch(() => {
@@ -307,75 +310,75 @@ const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
307
310
  }
308
311
  };
309
312
  H(() => {
310
- const t = U.current;
313
+ const t = G.current;
311
314
  if (!t) return;
312
315
  t.render(
313
- /* @__PURE__ */ C.jsx(
314
- $e,
316
+ /* @__PURE__ */ E.jsx(
317
+ Le,
315
318
  {
316
319
  html: $,
317
320
  styleLoadingText: B,
318
321
  scriptLoadingText: T,
319
- disableLoadingOverlay: ie,
320
- resetToken: ae,
321
- hasRootVhHeight: be,
322
- mode: l,
323
- stretchRootHeight: he,
322
+ disableLoadingOverlay: le,
323
+ resetToken: ue,
324
+ hasRootVhHeight: we,
325
+ mode: s,
326
+ stretchRootHeight: de,
324
327
  enableScaling: w
325
328
  }
326
329
  )
327
330
  ), F.current = window.requestAnimationFrame(() => {
328
- A.current?.(), w && m.current?.contentWindow?.__mdf_triggerFitContent?.(), F.current = null;
331
+ A.current?.(), w && d.current?.contentWindow?.__mdf_triggerFitContent?.(), F.current = null;
329
332
  });
330
- const e = setTimeout(() => A.current?.(), 100), a = setTimeout(() => A.current?.(), 500);
333
+ const e = setTimeout(() => A.current?.(), 100), f = setTimeout(() => A.current?.(), 500);
331
334
  return () => {
332
- clearTimeout(e), clearTimeout(a);
335
+ clearTimeout(e), clearTimeout(f);
333
336
  };
334
337
  }, [
335
338
  $,
336
339
  B,
337
340
  T,
338
- ae,
339
- l
341
+ ue,
342
+ s
340
343
  ]);
341
- const je = [
344
+ const De = [
342
345
  "w-full relative content-render-iframe-sandbox",
343
- f ? "h-full overflow-auto flex flex-col" : pe ? "overflow-hidden flex items-center justify-center" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
346
+ m ? "h-full overflow-auto flex flex-col" : xe ? "overflow-hidden flex items-center justify-center" : "aspect-[16/9] overflow-hidden flex items-center justify-center"
344
347
  ].filter(Boolean).join(" ");
345
- return /* @__PURE__ */ C.jsxs(
348
+ return /* @__PURE__ */ E.jsxs(
346
349
  "div",
347
350
  {
348
351
  ref: D,
349
- "data-root-vh": be ? "true" : "false",
350
- className: je,
352
+ "data-root-vh": we ? "true" : "false",
353
+ className: De,
351
354
  style: I ? {
352
355
  height: I,
353
356
  minHeight: I
354
- } : pe,
357
+ } : xe,
355
358
  children: [
356
- !W && /* @__PURE__ */ C.jsx(
359
+ !W && /* @__PURE__ */ E.jsx(
357
360
  "button",
358
361
  {
359
362
  type: "button",
360
- onClick: Ve,
363
+ onClick: We,
361
364
  className: "absolute top-2 right-2 z-50 p-1.5 bg-black/75 text-white rounded-md cursor-pointer",
362
- children: J ? "退出全屏" : d || "全屏浏览"
365
+ children: Z ? "退出全屏" : h || "全屏浏览"
363
366
  }
364
367
  ),
365
- l === "blackboard" && o === "markdown" ? /* @__PURE__ */ C.jsx("div", { onClick: () => ge("click"), children: /* @__PURE__ */ C.jsx(
366
- ze,
368
+ s === "blackboard" && o === "markdown" ? /* @__PURE__ */ E.jsx("div", { onClick: () => He("click"), children: /* @__PURE__ */ E.jsx(
369
+ Ge,
367
370
  {
368
371
  content: c,
369
- disableSandboxLoadingOverlay: ie
372
+ disableSandboxLoadingOverlay: le
370
373
  }
371
- ) }) : /* @__PURE__ */ C.jsx(
374
+ ) }) : /* @__PURE__ */ E.jsx(
372
375
  "iframe",
373
376
  {
374
- ref: m,
377
+ ref: d,
375
378
  sandbox: "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",
376
379
  allow: "fullscreen",
377
380
  allowFullScreen: !0,
378
- className: [s, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
381
+ className: [l, "w-full h-full mx-auto my-auto block"].filter(Boolean).join(" "),
379
382
  style: {
380
383
  height: I ?? "100%",
381
384
  minHeight: I,
@@ -388,6 +391,6 @@ const Ze = () => (oe || (oe = import("./blackboard-vendor.es.js").then(
388
391
  );
389
392
  };
390
393
  export {
391
- ut as default
394
+ gt as default
392
395
  };
393
396
  //# sourceMappingURL=IframeSandbox.es.js.map