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