markdown-flow-ui 0.1.100-beta.4 → 0.1.100-beta.40

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 (101) hide show
  1. 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
  2. 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
  3. 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
  4. 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
  5. 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
  6. 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
  7. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.cjs.js +1 -1
  8. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/rc-textarea@1.10.2_react-dom@19.0.1_react@19.0.1__react@19.0.1/node_modules/rc-textarea/es/index.es.js +1 -1
  9. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.cjs.js +1 -1
  10. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-custom-variable.es.js +1 -1
  11. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.cjs.js +1 -1
  12. package/dist/Documents/ai-shifu/markdown-flow-ui/node_modules/.pnpm/remark-flow@0.1.6/node_modules/remark-flow/dist/remark-interaction.es.js +1 -1
  13. package/dist/_virtual/index.cjs3.js +1 -1
  14. package/dist/_virtual/index.cjs4.js +1 -1
  15. package/dist/_virtual/index.es3.js +4 -5
  16. package/dist/_virtual/index.es3.js.map +1 -1
  17. package/dist/_virtual/index.es4.js +5 -4
  18. package/dist/_virtual/index.es4.js.map +1 -1
  19. package/dist/assets/markdown-flow-ui.css +1 -1
  20. package/dist/components/ContentRender/ContentRender.cjs.js +2 -2
  21. package/dist/components/ContentRender/ContentRender.cjs.js.map +1 -1
  22. package/dist/components/ContentRender/ContentRender.d.ts +13 -10
  23. package/dist/components/ContentRender/ContentRender.es.js +184 -160
  24. package/dist/components/ContentRender/ContentRender.es.js.map +1 -1
  25. package/dist/components/ContentRender/IframeSandbox.cjs.js +5 -4
  26. package/dist/components/ContentRender/IframeSandbox.cjs.js.map +1 -1
  27. package/dist/components/ContentRender/IframeSandbox.d.ts +1 -0
  28. package/dist/components/ContentRender/IframeSandbox.es.js +307 -210
  29. package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
  30. package/dist/components/ContentRender/SandboxApp.cjs.js +3 -3
  31. package/dist/components/ContentRender/SandboxApp.cjs.js.map +1 -1
  32. package/dist/components/ContentRender/SandboxApp.d.ts +4 -0
  33. package/dist/components/ContentRender/SandboxApp.es.js +87 -80
  34. package/dist/components/ContentRender/SandboxApp.es.js.map +1 -1
  35. package/dist/components/ContentRender/index.cjs.js +1 -1
  36. package/dist/components/ContentRender/index.es.js +5 -6
  37. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js +1 -1
  38. package/dist/components/ContentRender/plugins/CustomVariable.cjs.js.map +1 -1
  39. package/dist/components/ContentRender/plugins/CustomVariable.es.js +68 -64
  40. package/dist/components/ContentRender/plugins/CustomVariable.es.js.map +1 -1
  41. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js +1 -1
  42. package/dist/components/MarkdownFlow/MarkdownFlow.cjs.js.map +1 -1
  43. package/dist/components/MarkdownFlow/MarkdownFlow.d.ts +3 -0
  44. package/dist/components/MarkdownFlow/MarkdownFlow.es.js +21 -18
  45. package/dist/components/MarkdownFlow/MarkdownFlow.es.js.map +1 -1
  46. package/dist/components/Slide/Player.cjs.js +1 -1
  47. package/dist/components/Slide/Player.cjs.js.map +1 -1
  48. package/dist/components/Slide/Player.d.ts +3 -2
  49. package/dist/components/Slide/Player.es.js +228 -170
  50. package/dist/components/Slide/Player.es.js.map +1 -1
  51. package/dist/components/Slide/Slide.cjs.js +1 -1
  52. package/dist/components/Slide/Slide.cjs.js.map +1 -1
  53. package/dist/components/Slide/Slide.d.ts +10 -0
  54. package/dist/components/Slide/Slide.es.js +422 -270
  55. package/dist/components/Slide/Slide.es.js.map +1 -1
  56. package/dist/components/Slide/Slide.stories.d.ts +27 -1
  57. package/dist/components/Slide/index.d.ts +3 -3
  58. package/dist/components/Slide/types.d.ts +5 -6
  59. package/dist/components/Slide/useSlide.cjs.js +1 -1
  60. package/dist/components/Slide/useSlide.cjs.js.map +1 -1
  61. package/dist/components/Slide/useSlide.d.ts +4 -1
  62. package/dist/components/Slide/useSlide.es.js +125 -83
  63. package/dist/components/Slide/useSlide.es.js.map +1 -1
  64. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js +2 -0
  65. package/dist/components/Slide/useWakePlayerFromIframe.cjs.js.map +1 -0
  66. package/dist/components/Slide/useWakePlayerFromIframe.d.ts +7 -0
  67. package/dist/components/Slide/useWakePlayerFromIframe.es.js +89 -0
  68. package/dist/components/Slide/useWakePlayerFromIframe.es.js.map +1 -0
  69. package/dist/components/Slide/utils/playerCustomActions.cjs.js +2 -0
  70. package/dist/components/Slide/utils/playerCustomActions.cjs.js.map +1 -0
  71. package/dist/components/Slide/utils/playerCustomActions.d.ts +3 -0
  72. package/dist/components/Slide/utils/playerCustomActions.es.js +7 -0
  73. package/dist/components/Slide/utils/playerCustomActions.es.js.map +1 -0
  74. package/dist/components/index.d.ts +4 -2
  75. package/dist/components/ui/inputGroup/textarea.cjs.js +1 -1
  76. package/dist/components/ui/inputGroup/textarea.es.js +1 -1
  77. package/dist/index.cjs.js +1 -1
  78. package/dist/index.es.js +24 -22
  79. package/dist/lib/interaction-defaults.cjs.js +2 -0
  80. package/dist/lib/interaction-defaults.cjs.js.map +1 -0
  81. package/dist/lib/interaction-defaults.es.js +106 -0
  82. package/dist/lib/interaction-defaults.es.js.map +1 -0
  83. package/dist/lib/sandboxInteraction.cjs.js +2 -0
  84. package/dist/lib/sandboxInteraction.cjs.js.map +1 -0
  85. package/dist/lib/sandboxInteraction.d.ts +8 -0
  86. package/dist/lib/sandboxInteraction.es.js +12 -0
  87. package/dist/lib/sandboxInteraction.es.js.map +1 -0
  88. package/dist/markdown-flow-ui-lib.css +1 -1
  89. package/dist/renderer.cjs.js +1 -1
  90. package/dist/renderer.d.ts +5 -3
  91. package/dist/renderer.es.js +18 -16
  92. package/package.json +17 -2
  93. package/dist/components/Slide/interaction-defaults.cjs.js +0 -2
  94. package/dist/components/Slide/interaction-defaults.cjs.js.map +0 -1
  95. package/dist/components/Slide/interaction-defaults.es.js +0 -85
  96. package/dist/components/Slide/interaction-defaults.es.js.map +0 -1
  97. package/dist/lib/browserUserActivation.cjs.js +0 -2
  98. package/dist/lib/browserUserActivation.cjs.js.map +0 -1
  99. package/dist/lib/browserUserActivation.es.js +0 -13
  100. package/dist/lib/browserUserActivation.es.js.map +0 -1
  101. /package/dist/{components/Slide → lib}/interaction-defaults.d.ts +0 -0
@@ -1,33 +1,42 @@
1
1
  import { j as n } from "../../_virtual/jsx-runtime.es.js";
2
- import { memo as Le, useRef as f, useMemo as C, useState as m, useCallback as s, useEffect as h } from "react";
3
- import { hasBrowserUserActivation as Me } from "../../lib/browserUserActivation.es.js";
4
- import { cn as F } from "../../lib/utils.es.js";
5
- import Ve from "../ContentRender/ContentRender.es.js";
6
- import he from "../ContentRender/IframeSandbox.es.js";
2
+ import { memo as lt, useRef as _, useMemo as c, useState as P, useCallback as i, useEffect as m } from "react";
3
+ import { isSandboxInteractionMessage as st } from "../../lib/sandboxInteraction.es.js";
4
+ import { cn as Q } from "../../lib/utils.es.js";
5
+ import it from "../ContentRender/ContentRender.es.js";
6
+ import Ne from "../ContentRender/IframeSandbox.es.js";
7
7
  import "../ui/inputGroup/input-group.es.js";
8
- import { getInteractionDefaultValues as $e, getInteractionDefaultSelectedValues as Ke } from "./interaction-defaults.es.js";
9
- import Ue from "./Player.es.js";
10
- import ze from "./useSlide.es.js";
8
+ import { getInteractionDefaultValues as ut, getInteractionDefaultSelectedValues as at } from "../../lib/interaction-defaults.es.js";
9
+ import ct from "./Player.es.js";
10
+ import dt from "./useSlide.es.js";
11
+ import ft from "./useWakePlayerFromIframe.es.js";
12
+ import { getPlayerCustomActionCount as mt } from "./utils/playerCustomActions.es.js";
11
13
  /* empty css */
12
- const Ge = 1e3, pe = Le(
14
+ import pt 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";
15
+ const ht = 1e3, Be = lt(
13
16
  ({
14
- content: z,
15
- title: G,
16
- defaultButtonText: p,
17
- defaultInputText: Y,
18
- defaultSelectedValues: J,
19
- onSend: T,
17
+ content: R,
18
+ title: j,
19
+ defaultButtonText: h,
20
+ defaultInputText: z,
21
+ defaultSelectedValues: I,
22
+ confirmButtonText: se,
23
+ copyButtonText: ie,
24
+ copiedButtonText: N,
25
+ onSend: D,
20
26
  readonly: B = !1
21
27
  }) => /* @__PURE__ */ n.jsxs("div", { className: "slide-player__interaction-card", children: [
22
- /* @__PURE__ */ n.jsx("div", { className: "slide-player__interaction-header", children: /* @__PURE__ */ n.jsx("p", { className: "slide-player__interaction-title", children: G }) }),
28
+ /* @__PURE__ */ n.jsx("div", { className: "slide-player__interaction-header", children: /* @__PURE__ */ n.jsx("p", { className: "slide-player__interaction-title", children: j }) }),
23
29
  /* @__PURE__ */ n.jsx("div", { className: "slide-player__interaction-body", children: /* @__PURE__ */ n.jsx(
24
- Ve,
30
+ it,
25
31
  {
26
- content: z,
27
- defaultButtonText: p,
28
- defaultInputText: Y,
29
- defaultSelectedValues: J,
30
- onSend: T,
32
+ content: R,
33
+ defaultButtonText: h,
34
+ defaultInputText: z,
35
+ defaultSelectedValues: I,
36
+ confirmButtonText: se,
37
+ copyButtonText: ie,
38
+ copiedButtonText: N,
39
+ onSend: D,
31
40
  readonly: B,
32
41
  enableTypewriter: !1,
33
42
  sandboxMode: "content"
@@ -36,164 +45,273 @@ const Ge = 1e3, pe = Le(
36
45
  /* @__PURE__ */ n.jsx("div", { className: "slide-player__interaction-arrow" })
37
46
  ] })
38
47
  );
39
- pe.displayName = "InteractionOverlayCard";
40
- const lt = ({
41
- elementList: z = [],
42
- showPlayer: G = !0,
43
- playerAlwaysVisible: p = !1,
44
- playerClassName: Y,
45
- interactionTitle: J,
46
- playerAutoHideDelay: T = 3e3,
47
- onSend: B,
48
- onPlayerVisibilityChange: Q,
49
- onStepChange: te,
50
- className: xe,
51
- onPointerDown: ne,
52
- ...ve
48
+ Be.displayName = "InteractionOverlayCard";
49
+ const gt = (R, j) => R.length === j.length && R.every((h, z) => {
50
+ const I = j[z];
51
+ return h.sequence_number === I?.sequence_number && h.type === I?.type && h.content === I?.content;
52
+ }), Bt = ({
53
+ elementList: R = [],
54
+ showPlayer: j = !0,
55
+ playerAlwaysVisible: h = !1,
56
+ playerClassName: z,
57
+ playerCustomActions: I,
58
+ bufferingText: se = "Buffering...",
59
+ interactionTitle: ie,
60
+ interactionTexts: N,
61
+ playerAutoHideDelay: D = 3e3,
62
+ interactionDefaultValueOptions: B,
63
+ onSend: fe,
64
+ onPlayerVisibilityChange: ue,
65
+ onStepChange: me,
66
+ className: Fe,
67
+ onPointerDown: pe,
68
+ ...Ke
53
69
  }) => {
54
- const re = f(null), W = f(null), oe = f(null), E = f(null), N = f(null), A = f(null), se = f([]), O = f(!1), {
55
- currentElementList: o,
56
- slideElementList: j,
57
- currentIndex: x,
58
- audioList: le,
59
- currentAudioSequenceIndexes: w,
60
- currentInteractionElement: I,
61
- canGoPrev: ye,
62
- canGoNext: v,
63
- handlePrev: ie,
64
- handleNext: d
65
- } = ze(z), ae = C(() => {
66
- if (!(x < 0))
67
- return j[x];
68
- }, [x, j]), ce = j.filter(
69
- (e) => e.is_show !== !1
70
- ).length === 1, a = G && (ce || le.length > 0 || !!I), [X, k] = m(!0), [q, ge] = m(!1), [we, Ie] = m(!1), [be] = m(() => Me()), _e = be || we, [Se, D] = m(-1), [H, L] = m(-1), [t, Z] = m(), [R, M] = m(!1), y = a && (p || X), g = s(() => {
71
- E.current !== null && (window.clearTimeout(E.current), E.current = null);
72
- }, []), c = s(() => {
73
- A.current !== null && (window.clearTimeout(A.current), A.current = null);
74
- }, []), b = s(() => {
75
- N.current !== null && (window.clearTimeout(N.current), N.current = null);
76
- }, []), _ = s(() => {
77
- b(), c(), D(-1), L(-1), Z(void 0), M(!1);
78
- }, [b, c]), V = s(() => {
79
- const e = w[0];
80
- return typeof e != "number" ? !1 : (L(0), D(e), !0);
81
- }, [w]), $ = s(() => {
82
- c(), M(!1), !V() && v && d();
70
+ const ae = _(null), ce = _(null), he = _(null), V = _(null), W = _(null), G = _(null), ge = _([]), X = _(!1), F = _(null), {
71
+ currentElementList: b,
72
+ stepElementLists: xe,
73
+ slideElementList: K,
74
+ currentIndex: d,
75
+ audioList: y,
76
+ currentAudioSequenceIndexes: ye,
77
+ currentStepHasSpeakableElement: A,
78
+ currentInteractionElement: u,
79
+ canGoPrev: ke,
80
+ canGoNext: E,
81
+ handlePrev: Se,
82
+ handleNext: T
83
+ } = dt(R), ve = c(() => {
84
+ if (!(d < 0))
85
+ return K[d];
86
+ }, [d, K]), qe = K.filter(
87
+ (e) => e.is_renderable !== !1
88
+ ).length === 1, S = j && (K.length > 0 || y.length > 0 || !!u), g = c(
89
+ () => ye.map((e) => y[e]?.audioKey).filter((e) => !!e),
90
+ [y, ye]
91
+ ), [Ie, Z] = P(!0), [ee, Y] = P(!1), [v, k] = P(null), [Le, p] = P(!1), [q, be] = P(!1), [l, te] = P(), [ne, J] = P(!1), L = S && (h || Ie), we = c(
92
+ () => mt(I),
93
+ [I]
94
+ ), Me = c(
95
+ () => ({
96
+ "--slide-player-custom-action-count": String(we)
97
+ }),
98
+ [we]
99
+ ), { mountedStepStates: Oe, currentMountedStateIndex: He } = c(() => {
100
+ const e = [], t = /* @__PURE__ */ new Map();
101
+ return xe.forEach((s, a) => {
102
+ const r = e.findIndex(
103
+ (o) => gt(
104
+ o.elementList,
105
+ s
106
+ )
107
+ );
108
+ if (r >= 0) {
109
+ e[r]?.sourceStepIndexes.push(a), t.set(a, r);
110
+ return;
111
+ }
112
+ e.push({
113
+ elementList: s,
114
+ sourceStepIndexes: [a]
115
+ }), t.set(a, e.length - 1);
116
+ }), {
117
+ mountedStepStates: e,
118
+ currentMountedStateIndex: d >= 0 ? t.get(d) ?? -1 : -1
119
+ };
120
+ }, [d, xe]), _e = c(() => String(d), [d]), de = c(() => v ? y.findIndex(
121
+ (e) => (e.audioKey ?? "") === v
122
+ ) : -1, [y, v]), re = c(
123
+ () => g[0] ?? "none",
124
+ [g]
125
+ ), Ae = c(() => u ? `${u.sequence_number ?? "none"}:${String(
126
+ u.content ?? ""
127
+ )}` : "none", [u]), $e = c(
128
+ () => [_e, Ae].join("|"),
129
+ [Ae, _e]
130
+ ), M = !!c(() => !re || re === "none" ? "" : y.find(
131
+ (t) => t.audioKey === re
132
+ )?.audioUrl?.trim() ?? "", [y, re]), C = i(() => {
133
+ V.current !== null && (window.clearTimeout(V.current), V.current = null);
134
+ }, []), w = i(() => {
135
+ G.current !== null && (window.clearTimeout(G.current), G.current = null);
136
+ }, []), O = i(() => {
137
+ W.current !== null && (window.clearTimeout(W.current), W.current = null);
138
+ }, []), H = i(() => {
139
+ O(), w(), k(null), p(!1), be(!1), te(void 0), J(!1);
140
+ }, [O, w]), $ = i(() => {
141
+ const e = g[0];
142
+ return e ? (k(e), !0) : !1;
143
+ }, [g]), oe = i(() => {
144
+ w(), J(!1), !$() && E && T();
83
145
  }, [
84
- v,
85
- c,
86
- d,
87
- V
88
- ]), S = s(
89
- (e = q) => {
90
- a && (k(!0), g(), !(p || !e || T <= 0) && (E.current = window.setTimeout(() => {
91
- k(!1), E.current = null;
92
- }, T)));
146
+ E,
147
+ w,
148
+ T,
149
+ $
150
+ ]), f = i(
151
+ (e = ee) => {
152
+ S && (Z(!0), C(), !(h || !e || D <= 0) && (V.current = window.setTimeout(() => {
153
+ Z(!1), V.current = null;
154
+ }, D)));
93
155
  },
94
156
  [
95
- g,
96
- q,
97
- p,
98
- T,
99
- a
157
+ C,
158
+ ee,
159
+ h,
160
+ D,
161
+ S
100
162
  ]
101
- );
102
- h(() => () => {
103
- b(), g(), c();
163
+ ), Ue = !!(u?.readonly || u?.user_input?.trim()), U = !!u && !Ue;
164
+ m(() => () => {
165
+ O(), C(), w();
104
166
  }, [
105
- b,
106
- c,
107
- g
108
- ]), h(() => (Q?.(y), () => {
109
- Q?.(!1);
110
- }), [Q, y]), h(() => {
111
- te?.(ae, x);
112
- }, [x, ae, te]), h(() => {
113
- if (!a) {
114
- g(), k(!1);
167
+ O,
168
+ w,
169
+ C
170
+ ]), m(() => (ue?.(L), () => {
171
+ ue?.(!1);
172
+ }), [ue, L]), m(() => {
173
+ me?.(ve, d);
174
+ }, [d, ve, me]), m(() => {
175
+ if (!S) {
176
+ C(), Z(!1);
115
177
  return;
116
178
  }
117
- if (p) {
118
- g(), k(!0);
179
+ if (h) {
180
+ C(), Z(!0);
119
181
  return;
120
182
  }
121
- q || S(!0);
183
+ ee || f(!0);
122
184
  }, [
123
- g,
124
- q,
125
- p,
126
- a,
127
- S
128
- ]), h(() => {
129
- if (_(), !(o.length === 0 && !I)) {
130
- if (I) {
131
- Z(I), M(!0);
185
+ C,
186
+ ee,
187
+ h,
188
+ S,
189
+ f
190
+ ]), m(() => {
191
+ if (typeof window > "u")
192
+ return;
193
+ const e = (t) => {
194
+ t.origin === window.location.origin && st(t.data) && S && (Y(!0), f(!0));
195
+ };
196
+ return window.addEventListener("message", e), () => {
197
+ window.removeEventListener("message", e);
198
+ };
199
+ }, [S, f]), ft({
200
+ sectionRef: ae,
201
+ enabled: S,
202
+ onWake: () => {
203
+ Y(!0), f(!0);
204
+ }
205
+ }), m(() => {
206
+ const e = F.current === d && !!u;
207
+ if (H(), !(b.length === 0 && !u)) {
208
+ if (U || e) {
209
+ te(u), J(!0), F.current = null;
132
210
  return;
133
211
  }
134
- if (!V() && v)
135
- return N.current = window.setTimeout(() => {
136
- N.current = null, d();
137
- }, Ge), () => {
138
- b();
139
- };
212
+ if (u && (te(u), J(!1), F.current = null), !$()) {
213
+ if (A) {
214
+ p(!0);
215
+ return;
216
+ }
217
+ if (E)
218
+ return W.current = window.setTimeout(() => {
219
+ W.current = null, T();
220
+ }, ht), () => {
221
+ O();
222
+ };
223
+ }
140
224
  }
225
+ }, [
226
+ E,
227
+ O,
228
+ b.length,
229
+ u,
230
+ $e,
231
+ A,
232
+ T,
233
+ U,
234
+ H,
235
+ $
236
+ ]), m(() => {
237
+ if (!A || U) {
238
+ p(!1);
239
+ return;
240
+ }
241
+ if (q) {
242
+ p(!1);
243
+ return;
244
+ }
245
+ g.length === 0 && p(!0);
246
+ }, [
247
+ g.length,
248
+ A,
249
+ q,
250
+ U
251
+ ]), m(() => {
252
+ v || g.length === 0 || !A || U || q || $();
141
253
  }, [
142
254
  v,
143
- b,
144
- o,
145
- I,
146
- d,
147
- _,
148
- V
149
- ]);
150
- const ue = C(() => t ? $e(
151
- typeof t.content == "string" ? t.content : void 0,
152
- t.user_input
153
- ) : {}, [t]), Pe = C(() => {
154
- if (t)
155
- return Ke(
156
- typeof t.content == "string" ? t.content : void 0,
157
- t.user_input
255
+ g,
256
+ A,
257
+ q,
258
+ U,
259
+ $
260
+ ]), m(() => {
261
+ !v || de >= 0 || k(null);
262
+ }, [de, v]), m(() => {
263
+ M && p(!1);
264
+ }, [M]);
265
+ const Te = c(() => l ? ut(
266
+ typeof l.content == "string" ? l.content : void 0,
267
+ l.user_input,
268
+ B
269
+ ) : {}, [l, B]), ze = c(() => {
270
+ if (l)
271
+ return at(
272
+ typeof l.content == "string" ? l.content : void 0,
273
+ l.user_input,
274
+ B
158
275
  );
159
- }, [t]), ee = !!t?.user_input?.trim(), Te = !!t?.readonly || ee, Ee = s(
276
+ }, [l, B]), Ee = !!l?.user_input?.trim(), Ce = !!l?.readonly || Ee, Pe = Ce || Ee, De = i(
160
277
  (e) => {
161
- const i = [
278
+ const s = [
162
279
  ...e.selectedValues ?? [],
163
280
  e.inputText?.trim() ?? "",
164
281
  e.buttonText?.trim() ?? ""
165
282
  ].filter(Boolean).join(", ");
166
- Z((r) => !r || !i ? r : {
167
- ...r,
168
- user_input: i
169
- }), B?.(e, t), $();
283
+ te((a) => !a || !s ? a : {
284
+ ...a,
285
+ user_input: s
286
+ }), fe?.(e, l), oe();
170
287
  },
171
- [t, $, B]
288
+ [l, oe, fe]
172
289
  );
173
- h(() => {
174
- if (c(), !(!R || !ee))
175
- return A.current = window.setTimeout(() => {
176
- A.current = null, $();
290
+ m(() => {
291
+ if (w(), !(!ne || !Pe))
292
+ return G.current = window.setTimeout(() => {
293
+ G.current = null, oe();
177
294
  }, 2e3), () => {
178
- c();
295
+ w();
179
296
  };
180
297
  }, [
181
- c,
182
- $,
183
- ee,
184
- R
298
+ w,
299
+ oe,
300
+ ne,
301
+ Pe
185
302
  ]);
186
- const Ne = (e) => e ? e.type === "slot" ? /* @__PURE__ */ n.jsx(n.Fragment, { children: e.content }) : e.type === "html" ? /* @__PURE__ */ n.jsx(
187
- he,
303
+ const Ve = (e, t = {}) => e ? e.type === "slot" ? /* @__PURE__ */ n.jsx(n.Fragment, { children: e.content }) : e.type === "html" ? /* @__PURE__ */ n.jsx(
304
+ Ne,
188
305
  {
189
306
  className: "content-render-iframe",
190
307
  hideFullScreen: !0,
191
308
  mode: "blackboard",
309
+ replaceRootScreenHeightWithFull: t.replaceRootScreenHeightWithFull,
192
310
  type: "sandbox",
193
311
  content: e.content
194
312
  }
195
313
  ) : /* @__PURE__ */ n.jsx(
196
- he,
314
+ Ne,
197
315
  {
198
316
  className: "content-render-iframe",
199
317
  hideFullScreen: !0,
@@ -201,34 +319,36 @@ const lt = ({
201
319
  type: "markdown",
202
320
  content: e.content
203
321
  }
204
- ) : null, Ae = (e = []) => {
322
+ ) : null, We = (e = [], t = !1) => {
205
323
  if (e.length === 0)
206
324
  return null;
207
- const u = e.filter(
208
- (r) => r.is_show !== !1
209
- ).length, i = e.reduce(
210
- (r, P, l) => P.is_show !== !1 ? l : r,
325
+ const s = e.filter(
326
+ (r) => r.is_renderable !== !1
327
+ ).length, a = e.reduce(
328
+ (r, o, x) => o.is_renderable !== !1 ? x : r,
211
329
  -1
212
330
  );
213
- return /* @__PURE__ */ n.jsx("div", { className: "slide-stage__content flex w-full flex-col gap-4", children: e.map((r, P) => {
214
- const l = r.type === "html" && r.is_show === !1;
331
+ return /* @__PURE__ */ n.jsx("div", { className: "slide-stage__content flex w-full flex-col gap-4", children: e.map((r, o) => {
332
+ const x = r.type === "html" && r.is_renderable === !1;
215
333
  return /* @__PURE__ */ n.jsx(
216
334
  "div",
217
335
  {
218
- ref: P === i ? oe : null,
219
- "aria-hidden": l || void 0,
220
- className: F(
336
+ ref: t && o === a ? he : null,
337
+ "aria-hidden": x || void 0,
338
+ className: Q(
221
339
  "w-full shrink-0",
222
- u === 1 && r.is_show !== !1 && "slide-element--single",
223
- l ? "pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0" : r.is_show === !1 && "hidden"
340
+ s === 1 && r.is_renderable !== !1 && "slide-element--single",
341
+ x ? "pointer-events-none fixed left-[-200vw] top-0 -z-10 h-[100dvh] w-[100vw] overflow-hidden opacity-0" : r.is_renderable === !1 && "hidden"
224
342
  ),
225
- children: Ne(r)
343
+ children: Ve(r, {
344
+ replaceRootScreenHeightWithFull: s === 1 && r.type === "html" && r.is_renderable !== !1
345
+ })
226
346
  },
227
- r.serial_number ?? `${r.type}-${P}`
347
+ r.sequence_number ?? `${r.type}-${o}`
228
348
  );
229
349
  }) });
230
- }, je = () => {
231
- const e = re.current;
350
+ }, Ge = () => {
351
+ const e = ae.current;
232
352
  if (e) {
233
353
  if (document.fullscreenElement) {
234
354
  document.exitFullscreen().catch(() => {
@@ -238,168 +358,200 @@ const lt = ({
238
358
  e.requestFullscreen?.().catch(() => {
239
359
  });
240
360
  }
241
- }, de = s(() => {
242
- const e = W.current;
361
+ }, Re = i(() => {
362
+ const e = ce.current;
243
363
  e && e.scrollTo({
244
364
  top: e.scrollHeight,
245
365
  behavior: "smooth"
246
366
  });
247
- }, []), Re = s(() => {
248
- O.current = !0, _(), ie();
249
- }, [ie, _]), Ce = s(() => {
250
- O.current = !0, _(), d();
251
- }, [d, _]), Fe = s(
367
+ }, []), Ye = i(() => {
368
+ X.current = !0, F.current = null, Y(!0), p(!1), f(!0), H(), Se();
369
+ }, [Se, H, f]), Je = i(() => {
370
+ X.current = !0, F.current = null, Y(!0), p(!1), f(!0), H(), T();
371
+ }, [T, H, f]), Qe = i(
372
+ (e) => {
373
+ if (M) {
374
+ p(!1);
375
+ return;
376
+ }
377
+ if (!A || q) {
378
+ p(!1);
379
+ return;
380
+ }
381
+ p(e);
382
+ },
383
+ [
384
+ A,
385
+ q,
386
+ M
387
+ ]
388
+ ), Xe = i(
252
389
  (e) => {
253
- if (H < 0 || w[H] !== e)
390
+ const t = y[e]?.audioKey;
391
+ if (!t || !v || t !== v)
254
392
  return;
255
- const u = H + 1, i = w[u];
256
- if (typeof i == "number") {
257
- L(u), D(i);
393
+ const s = g.findIndex(
394
+ (o) => o === t
395
+ );
396
+ if (s < 0) {
397
+ k(null);
398
+ return;
399
+ }
400
+ const a = s + 1, r = g[a];
401
+ if (r) {
402
+ k(r);
258
403
  return;
259
404
  }
260
- D(-1), L(-1), v && d();
405
+ if (k(null), be(!0), p(!1), E) {
406
+ const o = d + 1, x = K[o];
407
+ M && x?.type === "interaction" && (F.current = o), T();
408
+ }
261
409
  },
262
410
  [
411
+ y,
412
+ E,
413
+ d,
263
414
  v,
264
- w,
265
- H,
266
- d
415
+ g,
416
+ T,
417
+ M,
418
+ K
267
419
  ]
268
- ), Be = s(() => {
269
- t && M((e) => !e);
270
- }, [t]), fe = s(
420
+ ), Ze = i(() => {
421
+ l && J((e) => !e);
422
+ }, [l]), je = i(
271
423
  (e) => {
272
- e.stopPropagation(), y && S(!0);
424
+ e.stopPropagation(), L && f(!0);
273
425
  },
274
- [X, S]
275
- ), me = s(
426
+ [Ie, f]
427
+ ), et = i(
276
428
  (e) => {
277
- ne?.(e), ge(!0), S(!0);
429
+ pe?.(e), Y(!0), f(!0);
278
430
  },
279
- [ne, S]
280
- ), Oe = !!t && R, K = C(
281
- () => o.map(
282
- (e, u) => `${e.serial_number ?? `${e.type}-${u}`}:${e.operation ?? ""}`
431
+ [pe, f]
432
+ ), tt = !!l && ne, le = c(
433
+ () => b.map(
434
+ (e, t) => `${e.sequence_number ?? `${e.type}-${t}`}:${String(e.is_new ?? "")}`
283
435
  ),
284
- [o]
285
- ), ke = C(() => {
286
- const e = j.slice(x + 1).find((i) => i.type === "html");
287
- return !e || o.some(
288
- (i) => i.serial_number === e.serial_number
289
- ) ? o : [...o, { ...e, is_show: !1 }];
290
- }, [o, x, j]);
291
- return h(() => {
292
- const e = se.current, r = (e.length > 0 && e.length < K.length && e.every((l, U) => l === K[U]) ? o.slice(e.length) : []).some(
293
- (l) => l.operation === "append"
436
+ [b]
437
+ );
438
+ return m(() => {
439
+ const e = ge.current, a = (e.length > 0 && e.length < le.length && e.every((o, x) => o === le[x]) ? b.slice(e.length) : []).some(
440
+ (o) => o.is_new === !1
294
441
  );
295
- if (se.current = K, !r)
442
+ if (ge.current = le, !a)
296
443
  return;
297
- const P = window.requestAnimationFrame(() => {
298
- const l = W.current, U = oe.current;
299
- if (!l || !U)
444
+ const r = window.requestAnimationFrame(() => {
445
+ const o = ce.current, x = he.current;
446
+ if (!o || !x)
300
447
  return;
301
- const qe = l.getBoundingClientRect(), De = U.getBoundingClientRect(), He = l.scrollTop + (De.top - qe.top);
302
- l.scrollTo({
303
- top: Math.max(He, 0),
448
+ const nt = o.getBoundingClientRect(), rt = x.getBoundingClientRect(), ot = o.scrollTop + (rt.top - nt.top);
449
+ o.scrollTo({
450
+ top: Math.max(ot, 0),
304
451
  behavior: "smooth"
305
452
  });
306
453
  });
307
454
  return () => {
308
- window.cancelAnimationFrame(P);
455
+ window.cancelAnimationFrame(r);
309
456
  };
310
- }, [o, K]), h(() => {
311
- if (!O.current || (O.current = !1, o.length === 0))
457
+ }, [b, le]), m(() => {
458
+ if (!X.current || (X.current = !1, b.length === 0))
312
459
  return;
313
460
  const e = window.requestAnimationFrame(() => {
314
- de();
461
+ Re();
315
462
  });
316
463
  return () => {
317
464
  window.cancelAnimationFrame(e);
318
465
  };
319
- }, [o, de]), console.log(
320
- "currentElement",
321
- o.at(-1),
322
- o,
323
- a,
324
- X,
325
- w,
326
- I,
327
- t,
328
- R
329
- ), /* @__PURE__ */ n.jsxs(
466
+ }, [b, Re]), /* @__PURE__ */ n.jsxs(
330
467
  "section",
331
468
  {
332
- ref: re,
333
- className: F("relative h-full w-full", xe),
334
- onPointerDown: me,
335
- ...ve,
469
+ ref: ae,
470
+ className: Q("relative h-full w-full", Fe),
471
+ onPointerDown: et,
472
+ ...Ke,
336
473
  children: [
337
- /* @__PURE__ */ n.jsxs(
474
+ /* @__PURE__ */ n.jsx(
338
475
  "div",
339
476
  {
340
- className: F(
477
+ className: Q(
341
478
  "h-full min-h-0 w-full",
342
- ce ? "slide-content--single" : "grid gap-4"
479
+ qe ? "slide-content--single" : "grid gap-4"
343
480
  ),
344
- children: [
345
- a && !y ? /* @__PURE__ */ n.jsx(
346
- "button",
347
- {
348
- "aria-label": "Show player controls",
349
- className: "slide-player-hit-area",
350
- onPointerDown: me,
351
- type: "button"
352
- }
353
- ) : null,
354
- o.length > 0 ? /* @__PURE__ */ n.jsx("div", { className: "slide-stage", children: /* @__PURE__ */ n.jsx("div", { ref: W, className: "slide-stage__layer w-full", children: Ae(ke) }) }) : null
355
- ]
481
+ children: b.length > 0 ? /* @__PURE__ */ n.jsx("div", { className: "slide-stage", children: /* @__PURE__ */ n.jsx("div", { ref: ce, className: "slide-stage__layer w-full", children: Oe.map(
482
+ (e, t) => {
483
+ const s = t === He;
484
+ return /* @__PURE__ */ n.jsx(
485
+ "div",
486
+ {
487
+ "aria-hidden": !s || void 0,
488
+ className: "w-full h-full",
489
+ style: { display: s ? void 0 : "none" },
490
+ children: We(
491
+ e.elementList,
492
+ s
493
+ )
494
+ },
495
+ e.sourceStepIndexes[0] ?? t
496
+ );
497
+ }
498
+ ) }) }) : null
356
499
  }
357
500
  ),
358
- Oe ? /* @__PURE__ */ n.jsx(
501
+ Le ? /* @__PURE__ */ n.jsxs("div", { className: "pointer-events-none absolute left-1/2 top-1/2 z-[3] flex size-28 -translate-x-1/2 -translate-y-1/2 flex-col items-center justify-center gap-2 rounded-2xl bg-foreground/65 px-3 py-4 text-center text-xs leading-4 font-medium text-background shadow-lg backdrop-blur-sm", children: [
502
+ /* @__PURE__ */ n.jsx(pt, { className: "size-5 animate-spin text-background" }),
503
+ /* @__PURE__ */ n.jsx("span", { children: se })
504
+ ] }) : null,
505
+ tt ? /* @__PURE__ */ n.jsx(
359
506
  "div",
360
507
  {
361
- className: F(
508
+ className: Q(
362
509
  "slide-interaction-overlay",
363
- y && a ? "slide-interaction-overlay--with-player" : "slide-interaction-overlay--standalone"
510
+ L && S ? "slide-interaction-overlay--with-player" : "slide-interaction-overlay--standalone"
364
511
  ),
365
- onClick: fe,
366
- onPointerDown: fe,
512
+ onClick: je,
513
+ onPointerDown: je,
514
+ style: Me,
367
515
  children: /* @__PURE__ */ n.jsx(
368
- pe,
516
+ Be,
369
517
  {
370
- content: String(t?.content ?? ""),
371
- defaultButtonText: ue.buttonText ?? "",
372
- defaultInputText: ue.inputText ?? "",
373
- defaultSelectedValues: Pe,
374
- onSend: Ee,
375
- readonly: Te,
376
- title: J ?? "Submit the content below to continue."
518
+ content: String(l?.content ?? ""),
519
+ defaultButtonText: Te.buttonText ?? "",
520
+ defaultInputText: Te.inputText ?? "",
521
+ defaultSelectedValues: ze,
522
+ confirmButtonText: N?.confirmButtonText,
523
+ copyButtonText: N?.copyButtonText,
524
+ copiedButtonText: N?.copiedButtonText,
525
+ onSend: De,
526
+ readonly: Ce,
527
+ title: N?.title ?? ie ?? "Submit the content below to continue."
377
528
  }
378
529
  )
379
530
  }
380
531
  ) : null,
381
- a ? /* @__PURE__ */ n.jsx(
382
- Ue,
532
+ S ? /* @__PURE__ */ n.jsx(
533
+ ct,
383
534
  {
384
- audioList: le,
385
- className: F(
535
+ audioList: y,
536
+ className: Q(
386
537
  "absolute left-1/2 bottom-6 z-[2] -translate-x-1/2",
387
- Y,
388
- !y && "pointer-events-none opacity-0"
538
+ z,
539
+ !L && "pointer-events-none opacity-0"
389
540
  ),
390
- currentAudioIndex: Se,
391
- defaultPlaying: _e,
392
- hasInteraction: !!t,
393
- isInteractionOpen: R,
394
- nextDisabled: !v,
395
- onEnded: Fe,
396
- onFullscreen: je,
397
- onInteractionToggle: Be,
398
- onPlayRequest: () => Ie(!0),
399
- onNext: Ce,
400
- onPrev: Re,
401
- prevDisabled: !ye,
402
- showControls: y
541
+ currentAudioIndex: de,
542
+ defaultPlaying: !0,
543
+ hasInteraction: !!l,
544
+ isInteractionOpen: ne,
545
+ onLoadingChange: Qe,
546
+ nextDisabled: !E,
547
+ onEnded: Xe,
548
+ onFullscreen: Ge,
549
+ onInteractionToggle: Ze,
550
+ onNext: Je,
551
+ onPrev: Ye,
552
+ prevDisabled: !ke,
553
+ showControls: L,
554
+ customActions: I
403
555
  }
404
556
  ) : null
405
557
  ]
@@ -407,6 +559,6 @@ const lt = ({
407
559
  );
408
560
  };
409
561
  export {
410
- lt as default
562
+ Bt as default
411
563
  };
412
564
  //# sourceMappingURL=Slide.es.js.map