@rendiv/core 0.1.0 → 0.1.1
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.
- package/LICENSE +191 -0
- package/dist/components/offthread-video.d.ts +22 -0
- package/dist/components/offthread-video.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +470 -373
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import G, { createContext as
|
|
2
|
-
import { jsx as
|
|
3
|
-
const
|
|
1
|
+
import G, { createContext as O, useContext as p, useEffect as M, forwardRef as le, useId as ae, useMemo as H, Children as J, useRef as R, useCallback as $, useState as ee } from "react";
|
|
2
|
+
import { jsx as I, Fragment as se } from "react/jsx-runtime";
|
|
3
|
+
const F = O({
|
|
4
4
|
frame: 0,
|
|
5
5
|
playing: !1,
|
|
6
6
|
playingRef: { current: !1 }
|
|
7
|
-
}),
|
|
7
|
+
}), x = O({
|
|
8
8
|
id: null,
|
|
9
9
|
from: 0,
|
|
10
10
|
durationInFrames: 1 / 0,
|
|
@@ -12,13 +12,13 @@ const x = P({
|
|
|
12
12
|
accumulatedOffset: 0,
|
|
13
13
|
localOffset: 0
|
|
14
14
|
});
|
|
15
|
-
function
|
|
16
|
-
const e = p(
|
|
15
|
+
function Re() {
|
|
16
|
+
const e = p(F), n = p(x);
|
|
17
17
|
return e.frame - n.accumulatedOffset;
|
|
18
18
|
}
|
|
19
|
-
const
|
|
20
|
-
function
|
|
21
|
-
const e = p(
|
|
19
|
+
const D = O(null);
|
|
20
|
+
function Fe() {
|
|
21
|
+
const e = p(D);
|
|
22
22
|
if (!e)
|
|
23
23
|
throw new Error(
|
|
24
24
|
"useCompositionConfig() must be called inside a <Composition>, <Player>, or during rendering."
|
|
@@ -26,17 +26,17 @@ function _e() {
|
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
28
|
const X = () => {
|
|
29
|
-
},
|
|
29
|
+
}, ne = O({
|
|
30
30
|
compositions: [],
|
|
31
31
|
registerComposition: X,
|
|
32
32
|
unregisterComposition: X,
|
|
33
33
|
currentCompositionId: null,
|
|
34
34
|
setCurrentCompositionId: X,
|
|
35
35
|
inputProps: {}
|
|
36
|
-
}),
|
|
37
|
-
function
|
|
38
|
-
const { registerComposition: n, unregisterComposition: t } = p(
|
|
39
|
-
return
|
|
36
|
+
}), j = O(null);
|
|
37
|
+
function xe(e) {
|
|
38
|
+
const { registerComposition: n, unregisterComposition: t } = p(ne), o = p(j);
|
|
39
|
+
return M(() => (n({
|
|
40
40
|
id: e.id,
|
|
41
41
|
component: e.component,
|
|
42
42
|
durationInFrames: e.durationInFrames,
|
|
@@ -49,7 +49,7 @@ function Fe(e) {
|
|
|
49
49
|
type: "composition"
|
|
50
50
|
}), () => t(e.id)), [e.id]), null;
|
|
51
51
|
}
|
|
52
|
-
const
|
|
52
|
+
const ue = {
|
|
53
53
|
position: "absolute",
|
|
54
54
|
top: 0,
|
|
55
55
|
left: 0,
|
|
@@ -59,18 +59,18 @@ const le = {
|
|
|
59
59
|
height: "100%",
|
|
60
60
|
display: "flex",
|
|
61
61
|
flexDirection: "column"
|
|
62
|
-
},
|
|
63
|
-
({ style: e, ...n }, t) => /* @__PURE__ */
|
|
62
|
+
}, W = le(
|
|
63
|
+
({ style: e, ...n }, t) => /* @__PURE__ */ I(
|
|
64
64
|
"div",
|
|
65
65
|
{
|
|
66
66
|
ref: t,
|
|
67
|
-
style: { ...
|
|
67
|
+
style: { ...ue, ...e },
|
|
68
68
|
...n
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
);
|
|
72
|
-
|
|
73
|
-
const
|
|
72
|
+
W.displayName = "Fill";
|
|
73
|
+
const te = ({
|
|
74
74
|
from: e = 0,
|
|
75
75
|
durationInFrames: n = 1 / 0,
|
|
76
76
|
name: t,
|
|
@@ -78,35 +78,35 @@ const ne = ({
|
|
|
78
78
|
style: r,
|
|
79
79
|
children: i
|
|
80
80
|
}) => {
|
|
81
|
-
const
|
|
82
|
-
|
|
81
|
+
const c = p(x), l = p(F), u = ae(), a = c.accumulatedOffset + e, m = l.frame;
|
|
82
|
+
M(() => {
|
|
83
83
|
if (typeof window > "u") return;
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
return
|
|
88
|
-
|
|
84
|
+
const w = window;
|
|
85
|
+
w.__RENDIV_TIMELINE_ENTRIES__ || (w.__RENDIV_TIMELINE_ENTRIES__ = /* @__PURE__ */ new Map());
|
|
86
|
+
const f = w.__RENDIV_TIMELINE_ENTRIES__, s = c.id, d = { id: u, name: t ?? "Sequence", from: a, durationInFrames: n, parentId: s };
|
|
87
|
+
return f.set(u, d), document.dispatchEvent(new CustomEvent("rendiv:timeline-sync")), () => {
|
|
88
|
+
f.delete(u), document.dispatchEvent(new CustomEvent("rendiv:timeline-sync"));
|
|
89
89
|
};
|
|
90
|
-
}, [
|
|
91
|
-
const
|
|
90
|
+
}, [u, t, a, n]);
|
|
91
|
+
const h = H(
|
|
92
92
|
() => ({
|
|
93
|
-
id:
|
|
94
|
-
from:
|
|
93
|
+
id: u,
|
|
94
|
+
from: a,
|
|
95
95
|
durationInFrames: n,
|
|
96
|
-
parentOffset:
|
|
97
|
-
accumulatedOffset:
|
|
96
|
+
parentOffset: c.accumulatedOffset,
|
|
97
|
+
accumulatedOffset: a,
|
|
98
98
|
localOffset: e
|
|
99
99
|
}),
|
|
100
|
-
[
|
|
100
|
+
[u, a, n, c.accumulatedOffset, e]
|
|
101
101
|
);
|
|
102
|
-
if (
|
|
103
|
-
const b = /* @__PURE__ */
|
|
104
|
-
return o === "none" ? b : /* @__PURE__ */
|
|
102
|
+
if (m < a || m >= a + n) return null;
|
|
103
|
+
const b = /* @__PURE__ */ I(x.Provider, { value: h, children: i });
|
|
104
|
+
return o === "none" ? b : /* @__PURE__ */ I(W, { style: r, children: b });
|
|
105
105
|
};
|
|
106
|
-
|
|
107
|
-
function
|
|
108
|
-
const { registerComposition: n, unregisterComposition: t } = p(
|
|
109
|
-
return
|
|
106
|
+
te.displayName = "Sequence";
|
|
107
|
+
function $e(e) {
|
|
108
|
+
const { registerComposition: n, unregisterComposition: t } = p(ne), o = p(j);
|
|
109
|
+
return M(() => (n({
|
|
110
110
|
id: e.id,
|
|
111
111
|
component: e.component,
|
|
112
112
|
durationInFrames: 1,
|
|
@@ -118,99 +118,99 @@ function xe(e) {
|
|
|
118
118
|
type: "still"
|
|
119
119
|
}), () => t(e.id)), [e.id]), null;
|
|
120
120
|
}
|
|
121
|
-
const
|
|
122
|
-
const t = p(
|
|
123
|
-
return /* @__PURE__ */
|
|
121
|
+
const fe = ({ name: e, children: n }) => {
|
|
122
|
+
const t = p(j), o = t ? `${t}/${e}` : e;
|
|
123
|
+
return /* @__PURE__ */ I(j.Provider, { value: o, children: n });
|
|
124
124
|
};
|
|
125
|
-
|
|
126
|
-
function
|
|
125
|
+
fe.displayName = "Folder";
|
|
126
|
+
function Y(e) {
|
|
127
127
|
throw new Error(
|
|
128
128
|
"<Series.Sequence> can only be used as a direct child of <Series>."
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
function
|
|
131
|
+
Y.displayName = "Series.Sequence";
|
|
132
|
+
function re({ children: e }) {
|
|
133
133
|
const n = J.toArray(e);
|
|
134
134
|
let t = 0;
|
|
135
135
|
const o = [];
|
|
136
136
|
for (const r of n) {
|
|
137
137
|
if (!G.isValidElement(r)) continue;
|
|
138
|
-
if (r.type !==
|
|
138
|
+
if (r.type !== Y)
|
|
139
139
|
throw new Error(
|
|
140
140
|
"Only <Series.Sequence> elements are allowed as children of <Series>."
|
|
141
141
|
);
|
|
142
142
|
const {
|
|
143
143
|
durationInFrames: i,
|
|
144
|
-
offset:
|
|
145
|
-
name:
|
|
146
|
-
layout:
|
|
147
|
-
style:
|
|
148
|
-
children:
|
|
149
|
-
} = r.props,
|
|
150
|
-
let b =
|
|
144
|
+
offset: c = 0,
|
|
145
|
+
name: l,
|
|
146
|
+
layout: u,
|
|
147
|
+
style: a,
|
|
148
|
+
children: m
|
|
149
|
+
} = r.props, h = t + c;
|
|
150
|
+
let b = l;
|
|
151
151
|
if (!b) {
|
|
152
|
-
const
|
|
153
|
-
if (
|
|
154
|
-
const
|
|
155
|
-
if (G.isValidElement(
|
|
156
|
-
const
|
|
157
|
-
b =
|
|
152
|
+
const w = J.toArray(m);
|
|
153
|
+
if (w.length > 0) {
|
|
154
|
+
const f = w[0];
|
|
155
|
+
if (G.isValidElement(f) && typeof f.type != "string") {
|
|
156
|
+
const s = f.type;
|
|
157
|
+
b = s.displayName || s.name;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
o.push(
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
|
|
162
|
+
/* @__PURE__ */ I(
|
|
163
|
+
te,
|
|
164
164
|
{
|
|
165
|
-
from:
|
|
165
|
+
from: h,
|
|
166
166
|
durationInFrames: i,
|
|
167
167
|
name: b,
|
|
168
|
-
layout:
|
|
169
|
-
style:
|
|
170
|
-
children:
|
|
168
|
+
layout: u,
|
|
169
|
+
style: a,
|
|
170
|
+
children: m
|
|
171
171
|
},
|
|
172
172
|
r.key ?? o.length
|
|
173
173
|
)
|
|
174
|
-
), t =
|
|
174
|
+
), t = h + i;
|
|
175
175
|
}
|
|
176
|
-
return /* @__PURE__ */
|
|
176
|
+
return /* @__PURE__ */ I(se, { children: o });
|
|
177
177
|
}
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
Sequence:
|
|
178
|
+
re.displayName = "Series";
|
|
179
|
+
const Pe = Object.assign(re, {
|
|
180
|
+
Sequence: Y
|
|
181
181
|
});
|
|
182
|
-
function
|
|
182
|
+
function de({
|
|
183
183
|
durationInFrames: e,
|
|
184
184
|
times: n = 1 / 0,
|
|
185
185
|
layout: t = "absolute-fill",
|
|
186
186
|
style: o,
|
|
187
187
|
children: r
|
|
188
188
|
}) {
|
|
189
|
-
const i = p(
|
|
190
|
-
if (
|
|
191
|
-
const
|
|
189
|
+
const i = p(F), c = p(x), l = i.frame - c.accumulatedOffset;
|
|
190
|
+
if (l < 0 || n !== 1 / 0 && l >= e * n) return null;
|
|
191
|
+
const u = l % e, a = H(
|
|
192
192
|
() => ({
|
|
193
|
-
frame:
|
|
193
|
+
frame: u + c.accumulatedOffset,
|
|
194
194
|
playing: i.playing,
|
|
195
195
|
playingRef: i.playingRef
|
|
196
196
|
}),
|
|
197
|
-
[
|
|
198
|
-
),
|
|
197
|
+
[u, c.accumulatedOffset, i.playing, i.playingRef]
|
|
198
|
+
), m = H(
|
|
199
199
|
() => ({
|
|
200
200
|
id: null,
|
|
201
|
-
from:
|
|
201
|
+
from: c.accumulatedOffset,
|
|
202
202
|
durationInFrames: e,
|
|
203
|
-
parentOffset:
|
|
204
|
-
accumulatedOffset:
|
|
203
|
+
parentOffset: c.accumulatedOffset,
|
|
204
|
+
accumulatedOffset: c.accumulatedOffset,
|
|
205
205
|
localOffset: 0
|
|
206
206
|
}),
|
|
207
|
-
[
|
|
208
|
-
),
|
|
209
|
-
return t === "none" ?
|
|
207
|
+
[c.accumulatedOffset, e]
|
|
208
|
+
), h = /* @__PURE__ */ I(F.Provider, { value: a, children: /* @__PURE__ */ I(x.Provider, { value: m, children: r }) });
|
|
209
|
+
return t === "none" ? h : /* @__PURE__ */ I(W, { style: o, children: h });
|
|
210
210
|
}
|
|
211
|
-
|
|
212
|
-
function
|
|
213
|
-
const t = p(
|
|
211
|
+
de.displayName = "Loop";
|
|
212
|
+
function me({ frame: e, children: n }) {
|
|
213
|
+
const t = p(F), o = H(
|
|
214
214
|
() => ({
|
|
215
215
|
frame: e,
|
|
216
216
|
playing: t.playing,
|
|
@@ -218,149 +218,149 @@ function de({ frame: e, children: n }) {
|
|
|
218
218
|
}),
|
|
219
219
|
[e, t.playing, t.playingRef]
|
|
220
220
|
);
|
|
221
|
-
return /* @__PURE__ */
|
|
221
|
+
return /* @__PURE__ */ I(F.Provider, { value: o, children: n });
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
let
|
|
225
|
-
const
|
|
226
|
-
function
|
|
227
|
-
const t = ++
|
|
223
|
+
me.displayName = "Freeze";
|
|
224
|
+
let he = 0;
|
|
225
|
+
const L = /* @__PURE__ */ new Map();
|
|
226
|
+
function k(e, n) {
|
|
227
|
+
const t = ++he, o = e ?? `Handle ${t}`, { timeoutInMilliseconds: r } = n ?? {};
|
|
228
228
|
let i = null;
|
|
229
229
|
return r !== void 0 && r > 0 && (i = setTimeout(() => {
|
|
230
|
-
if (
|
|
231
|
-
throw
|
|
230
|
+
if (L.has(t))
|
|
231
|
+
throw L.delete(t), new Error(
|
|
232
232
|
`holdRender() timed out after ${r}ms (label: "${o}"). You can increase the timeout by passing a larger timeoutInMilliseconds to holdRender().`
|
|
233
233
|
);
|
|
234
|
-
}, r)),
|
|
234
|
+
}, r)), L.set(t, { label: o, timeoutId: i }), t;
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
const n =
|
|
236
|
+
function S(e) {
|
|
237
|
+
const n = L.get(e);
|
|
238
238
|
if (!n)
|
|
239
239
|
throw new Error(
|
|
240
240
|
`releaseRender() was called with handle ${e}, but no corresponding holdRender() exists.`
|
|
241
241
|
);
|
|
242
|
-
n.timeoutId !== null && clearTimeout(n.timeoutId),
|
|
242
|
+
n.timeoutId !== null && clearTimeout(n.timeoutId), L.delete(e);
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function Le(e) {
|
|
245
245
|
throw new Error(`Render cancelled: ${e}`);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
return
|
|
247
|
+
function Oe() {
|
|
248
|
+
return L.size;
|
|
249
249
|
}
|
|
250
|
-
function
|
|
251
|
-
return Array.from(
|
|
250
|
+
function Te() {
|
|
251
|
+
return Array.from(L.values()).map((e) => e.label);
|
|
252
252
|
}
|
|
253
|
-
function
|
|
253
|
+
function ge({
|
|
254
254
|
holdRenderTimeout: e = 3e4,
|
|
255
255
|
onLoad: n,
|
|
256
256
|
onError: t,
|
|
257
257
|
...o
|
|
258
258
|
}) {
|
|
259
|
-
const r =
|
|
260
|
-
|
|
261
|
-
const
|
|
259
|
+
const r = R(null);
|
|
260
|
+
M(() => {
|
|
261
|
+
const l = k(
|
|
262
262
|
`Loading <Img> with src="${o.src}"`,
|
|
263
263
|
{ timeoutInMilliseconds: e }
|
|
264
264
|
);
|
|
265
|
-
return r.current =
|
|
266
|
-
r.current !== null && (
|
|
265
|
+
return r.current = l, () => {
|
|
266
|
+
r.current !== null && (S(r.current), r.current = null);
|
|
267
267
|
};
|
|
268
268
|
}, [o.src, e]);
|
|
269
|
-
const i =
|
|
270
|
-
(
|
|
271
|
-
r.current !== null && (
|
|
269
|
+
const i = $(
|
|
270
|
+
(l) => {
|
|
271
|
+
r.current !== null && (S(r.current), r.current = null), n == null || n(l);
|
|
272
272
|
},
|
|
273
273
|
[n]
|
|
274
|
-
),
|
|
275
|
-
(
|
|
276
|
-
r.current !== null && (
|
|
274
|
+
), c = $(
|
|
275
|
+
(l) => {
|
|
276
|
+
r.current !== null && (S(r.current), r.current = null), t == null || t(l);
|
|
277
277
|
},
|
|
278
278
|
[t]
|
|
279
279
|
);
|
|
280
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ I(
|
|
281
281
|
"img",
|
|
282
282
|
{
|
|
283
283
|
...o,
|
|
284
284
|
onLoad: i,
|
|
285
|
-
onError:
|
|
285
|
+
onError: c
|
|
286
286
|
}
|
|
287
287
|
);
|
|
288
288
|
}
|
|
289
|
-
|
|
290
|
-
const
|
|
289
|
+
ge.displayName = "Img";
|
|
290
|
+
const z = O({
|
|
291
291
|
environment: "studio"
|
|
292
292
|
});
|
|
293
|
-
function
|
|
293
|
+
function oe({
|
|
294
294
|
src: e,
|
|
295
295
|
startFrom: n = 0,
|
|
296
296
|
endAt: t,
|
|
297
297
|
volume: o = 1,
|
|
298
298
|
playbackRate: r = 1,
|
|
299
299
|
muted: i = !1,
|
|
300
|
-
style:
|
|
301
|
-
className:
|
|
302
|
-
holdRenderTimeout:
|
|
303
|
-
...
|
|
300
|
+
style: c,
|
|
301
|
+
className: l,
|
|
302
|
+
holdRenderTimeout: u = 3e4,
|
|
303
|
+
...a
|
|
304
304
|
}) {
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
const
|
|
305
|
+
const m = R(null), h = p(F), b = p(x), w = p(D), { environment: f } = p(z), s = R(null), d = R(null), y = f === "rendering", v = (w == null ? void 0 : w.fps) ?? 30, _ = h.frame - b.accumulatedOffset, C = _ + n, E = C / v;
|
|
306
|
+
M(() => {
|
|
307
|
+
const g = k(
|
|
308
308
|
`Loading <Video> metadata for src="${e}"`,
|
|
309
|
-
{ timeoutInMilliseconds:
|
|
309
|
+
{ timeoutInMilliseconds: u }
|
|
310
310
|
);
|
|
311
|
-
return
|
|
312
|
-
|
|
311
|
+
return s.current = g, () => {
|
|
312
|
+
s.current !== null && (S(s.current), s.current = null);
|
|
313
313
|
};
|
|
314
|
-
}, [e,
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
}, []),
|
|
318
|
-
|
|
314
|
+
}, [e, u]);
|
|
315
|
+
const P = $(() => {
|
|
316
|
+
s.current !== null && (S(s.current), s.current = null);
|
|
317
|
+
}, []), T = $(() => {
|
|
318
|
+
s.current !== null && (S(s.current), s.current = null);
|
|
319
319
|
}, []);
|
|
320
|
-
return
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
}, [o, i]),
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
}, [r]),
|
|
327
|
-
const
|
|
328
|
-
if (
|
|
329
|
-
if (t !== void 0 &&
|
|
330
|
-
|
|
320
|
+
return M(() => {
|
|
321
|
+
const g = m.current;
|
|
322
|
+
g && (g.volume = o, g.muted = i);
|
|
323
|
+
}, [o, i]), M(() => {
|
|
324
|
+
const g = m.current;
|
|
325
|
+
g && (g.playbackRate = r);
|
|
326
|
+
}, [r]), M(() => {
|
|
327
|
+
const g = m.current;
|
|
328
|
+
if (g) {
|
|
329
|
+
if (t !== void 0 && C >= t) {
|
|
330
|
+
g.pause();
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
|
-
if (
|
|
334
|
-
if (
|
|
335
|
-
|
|
336
|
-
const
|
|
337
|
-
`Seeking <Video> to ${
|
|
338
|
-
{ timeoutInMilliseconds:
|
|
339
|
-
),
|
|
340
|
-
|
|
333
|
+
if (y) {
|
|
334
|
+
if (g.pause(), d.current !== E) {
|
|
335
|
+
d.current = E;
|
|
336
|
+
const N = k(
|
|
337
|
+
`Seeking <Video> to ${E.toFixed(3)}s`,
|
|
338
|
+
{ timeoutInMilliseconds: u }
|
|
339
|
+
), V = () => {
|
|
340
|
+
S(N), g.removeEventListener("seeked", V);
|
|
341
341
|
};
|
|
342
|
-
|
|
342
|
+
g.addEventListener("seeked", V), g.currentTime = E;
|
|
343
343
|
}
|
|
344
344
|
} else
|
|
345
|
-
Math.abs(
|
|
346
|
-
}) : !
|
|
345
|
+
Math.abs(g.currentTime - E) > 0.1 && (g.currentTime = E), h.playing && g.paused ? g.play().catch(() => {
|
|
346
|
+
}) : !h.playing && !g.paused && g.pause();
|
|
347
347
|
}
|
|
348
|
-
}, [
|
|
348
|
+
}, [_, y, E, h.playing, t, C, u]), /* @__PURE__ */ I(
|
|
349
349
|
"video",
|
|
350
350
|
{
|
|
351
|
-
ref:
|
|
351
|
+
ref: m,
|
|
352
352
|
src: e,
|
|
353
353
|
preload: "auto",
|
|
354
354
|
playsInline: !0,
|
|
355
|
-
style:
|
|
356
|
-
className:
|
|
357
|
-
onLoadedMetadata:
|
|
358
|
-
onError:
|
|
359
|
-
...
|
|
355
|
+
style: c,
|
|
356
|
+
className: l,
|
|
357
|
+
onLoadedMetadata: P,
|
|
358
|
+
onError: T,
|
|
359
|
+
...a
|
|
360
360
|
}
|
|
361
361
|
);
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
oe.displayName = "Video";
|
|
364
364
|
function pe({
|
|
365
365
|
src: e,
|
|
366
366
|
startFrom: n = 0,
|
|
@@ -369,21 +369,21 @@ function pe({
|
|
|
369
369
|
playbackRate: r = 1,
|
|
370
370
|
muted: i = !1
|
|
371
371
|
}) {
|
|
372
|
-
const
|
|
373
|
-
return
|
|
374
|
-
if (
|
|
375
|
-
const
|
|
376
|
-
if (!
|
|
377
|
-
if (
|
|
378
|
-
|
|
372
|
+
const c = R(null), l = p(F), u = p(x), a = p(D), { environment: m } = p(z), h = m === "rendering", b = (a == null ? void 0 : a.fps) ?? 30, w = l.frame - u.accumulatedOffset, f = w + n, s = f / b;
|
|
373
|
+
return M(() => {
|
|
374
|
+
if (h) return;
|
|
375
|
+
const d = c.current;
|
|
376
|
+
if (!d) return;
|
|
377
|
+
if (d.volume = o, d.muted = i, d.playbackRate = r, t !== void 0 && f >= t) {
|
|
378
|
+
d.pause();
|
|
379
379
|
return;
|
|
380
380
|
}
|
|
381
|
-
Math.abs(
|
|
382
|
-
}) : !
|
|
383
|
-
}, [
|
|
381
|
+
Math.abs(d.currentTime - s) > 0.1 && (d.currentTime = s), l.playing && d.paused ? d.play().catch(() => {
|
|
382
|
+
}) : !l.playing && !d.paused && d.pause();
|
|
383
|
+
}, [w, h, s, l.playing, o, i, r, t, f]), h ? null : /* @__PURE__ */ I(
|
|
384
384
|
"audio",
|
|
385
385
|
{
|
|
386
|
-
ref:
|
|
386
|
+
ref: c,
|
|
387
387
|
src: e,
|
|
388
388
|
preload: "auto"
|
|
389
389
|
}
|
|
@@ -398,68 +398,68 @@ function ye({
|
|
|
398
398
|
className: r,
|
|
399
399
|
holdRenderTimeout: i = 3e4
|
|
400
400
|
}) {
|
|
401
|
-
const
|
|
402
|
-
return
|
|
403
|
-
const
|
|
401
|
+
const c = R(null), l = p(F), u = p(x), a = p(D), m = R([]), h = R(null), [b, w] = ee(!1), f = (a == null ? void 0 : a.fps) ?? 30, s = l.frame - u.accumulatedOffset;
|
|
402
|
+
return M(() => {
|
|
403
|
+
const d = k(
|
|
404
404
|
`Loading <AnimatedImage> frames from "${e}"`,
|
|
405
405
|
{ timeoutInMilliseconds: i }
|
|
406
406
|
);
|
|
407
|
-
|
|
408
|
-
let
|
|
407
|
+
h.current = d;
|
|
408
|
+
let y = !1;
|
|
409
409
|
async function v() {
|
|
410
410
|
try {
|
|
411
|
-
const
|
|
411
|
+
const C = await (await fetch(e)).blob();
|
|
412
412
|
if (typeof ImageDecoder < "u") {
|
|
413
|
-
const
|
|
414
|
-
data: await
|
|
415
|
-
type:
|
|
413
|
+
const E = new ImageDecoder({
|
|
414
|
+
data: await C.arrayBuffer(),
|
|
415
|
+
type: C.type
|
|
416
416
|
});
|
|
417
|
-
await
|
|
418
|
-
const
|
|
419
|
-
if (!
|
|
420
|
-
const
|
|
421
|
-
for (let
|
|
422
|
-
const
|
|
423
|
-
|
|
417
|
+
await E.tracks.ready;
|
|
418
|
+
const P = E.tracks.selectedTrack;
|
|
419
|
+
if (!P) throw new Error("No image track found");
|
|
420
|
+
const T = P.frameCount, g = [];
|
|
421
|
+
for (let N = 0; N < T; N++) {
|
|
422
|
+
const V = await E.decode({ frameIndex: N }), ie = await createImageBitmap(V.image), ce = (V.image.duration ?? 1e5) / 1e3;
|
|
423
|
+
g.push({ image: ie, duration: ce }), V.image.close();
|
|
424
424
|
}
|
|
425
|
-
|
|
425
|
+
E.close(), y || (m.current = g, w(!0));
|
|
426
426
|
} else {
|
|
427
|
-
const
|
|
428
|
-
|
|
427
|
+
const E = await createImageBitmap(C);
|
|
428
|
+
y || (m.current = [{ image: E, duration: 1 / 0 }], w(!0));
|
|
429
429
|
}
|
|
430
|
-
} catch (
|
|
431
|
-
console.error("AnimatedImage: failed to decode frames",
|
|
430
|
+
} catch (_) {
|
|
431
|
+
console.error("AnimatedImage: failed to decode frames", _);
|
|
432
432
|
} finally {
|
|
433
|
-
|
|
433
|
+
h.current !== null && (S(h.current), h.current = null);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
return v(), () => {
|
|
437
|
-
|
|
437
|
+
y = !0, h.current !== null && (S(h.current), h.current = null);
|
|
438
438
|
};
|
|
439
|
-
}, [e, i]),
|
|
440
|
-
if (!b ||
|
|
441
|
-
const
|
|
442
|
-
if (!
|
|
443
|
-
const
|
|
444
|
-
if (!
|
|
445
|
-
const v =
|
|
446
|
-
let
|
|
447
|
-
for (const
|
|
448
|
-
|
|
449
|
-
if (
|
|
450
|
-
const
|
|
451
|
-
let
|
|
452
|
-
for (let
|
|
453
|
-
if (
|
|
454
|
-
|
|
439
|
+
}, [e, i]), M(() => {
|
|
440
|
+
if (!b || m.current.length === 0) return;
|
|
441
|
+
const d = c.current;
|
|
442
|
+
if (!d) return;
|
|
443
|
+
const y = d.getContext("2d");
|
|
444
|
+
if (!y) return;
|
|
445
|
+
const v = m.current, _ = s / f * 1e3;
|
|
446
|
+
let C = 0;
|
|
447
|
+
for (const N of v)
|
|
448
|
+
C += N.duration;
|
|
449
|
+
if (C <= 0) return;
|
|
450
|
+
const E = (_ % C + C) % C;
|
|
451
|
+
let P = 0, T = 0;
|
|
452
|
+
for (let N = 0; N < v.length; N++)
|
|
453
|
+
if (P += v[N].duration, E < P) {
|
|
454
|
+
T = N;
|
|
455
455
|
break;
|
|
456
456
|
}
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
}, [
|
|
457
|
+
const g = v[T];
|
|
458
|
+
g && (d.width = n ?? g.image.width, d.height = t ?? g.image.height, y.clearRect(0, 0, d.width, d.height), y.drawImage(g.image, 0, 0, d.width, d.height));
|
|
459
|
+
}, [s, f, b, n, t]), /* @__PURE__ */ I(
|
|
460
460
|
"canvas",
|
|
461
461
|
{
|
|
462
|
-
ref:
|
|
462
|
+
ref: c,
|
|
463
463
|
width: n,
|
|
464
464
|
height: t,
|
|
465
465
|
style: o,
|
|
@@ -474,63 +474,159 @@ function we({
|
|
|
474
474
|
onError: t,
|
|
475
475
|
...o
|
|
476
476
|
}) {
|
|
477
|
-
const r =
|
|
478
|
-
|
|
479
|
-
const
|
|
477
|
+
const r = R(null);
|
|
478
|
+
M(() => {
|
|
479
|
+
const l = k(
|
|
480
480
|
`Loading <IFrame> with src="${o.src}"`,
|
|
481
481
|
{ timeoutInMilliseconds: e }
|
|
482
482
|
);
|
|
483
|
-
return r.current =
|
|
484
|
-
r.current !== null && (
|
|
483
|
+
return r.current = l, () => {
|
|
484
|
+
r.current !== null && (S(r.current), r.current = null);
|
|
485
485
|
};
|
|
486
486
|
}, [o.src, e]);
|
|
487
|
-
const i =
|
|
488
|
-
(
|
|
489
|
-
r.current !== null && (
|
|
487
|
+
const i = $(
|
|
488
|
+
(l) => {
|
|
489
|
+
r.current !== null && (S(r.current), r.current = null), n == null || n(l);
|
|
490
490
|
},
|
|
491
491
|
[n]
|
|
492
|
-
),
|
|
493
|
-
(
|
|
494
|
-
r.current !== null && (
|
|
492
|
+
), c = $(
|
|
493
|
+
(l) => {
|
|
494
|
+
r.current !== null && (S(r.current), r.current = null), t == null || t(l);
|
|
495
495
|
},
|
|
496
496
|
[t]
|
|
497
497
|
);
|
|
498
|
-
return /* @__PURE__ */
|
|
498
|
+
return /* @__PURE__ */ I(
|
|
499
499
|
"iframe",
|
|
500
500
|
{
|
|
501
501
|
...o,
|
|
502
502
|
onLoad: i,
|
|
503
|
-
onError:
|
|
503
|
+
onError: c
|
|
504
504
|
}
|
|
505
505
|
);
|
|
506
506
|
}
|
|
507
507
|
we.displayName = "IFrame";
|
|
508
|
-
function be(
|
|
508
|
+
function be({
|
|
509
|
+
src: e,
|
|
510
|
+
startFrom: n = 0,
|
|
511
|
+
endAt: t,
|
|
512
|
+
volume: o = 1,
|
|
513
|
+
playbackRate: r = 1,
|
|
514
|
+
muted: i = !1,
|
|
515
|
+
style: c,
|
|
516
|
+
className: l,
|
|
517
|
+
holdRenderTimeout: u = 3e4
|
|
518
|
+
}) {
|
|
519
|
+
const a = p(F), m = p(x), h = p(D), { environment: b } = p(z), w = b === "rendering", f = (h == null ? void 0 : h.fps) ?? 30, d = a.frame - m.accumulatedOffset + n, y = d / f;
|
|
520
|
+
return w ? /* @__PURE__ */ I(
|
|
521
|
+
ve,
|
|
522
|
+
{
|
|
523
|
+
src: e,
|
|
524
|
+
currentTime: y,
|
|
525
|
+
videoFrame: d,
|
|
526
|
+
endAt: t,
|
|
527
|
+
style: c,
|
|
528
|
+
className: l,
|
|
529
|
+
holdRenderTimeout: u
|
|
530
|
+
}
|
|
531
|
+
) : /* @__PURE__ */ I(
|
|
532
|
+
oe,
|
|
533
|
+
{
|
|
534
|
+
src: e,
|
|
535
|
+
startFrom: n,
|
|
536
|
+
endAt: t,
|
|
537
|
+
volume: o,
|
|
538
|
+
playbackRate: r,
|
|
539
|
+
muted: i,
|
|
540
|
+
style: c,
|
|
541
|
+
className: l,
|
|
542
|
+
holdRenderTimeout: u
|
|
543
|
+
}
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
be.displayName = "OffthreadVideo";
|
|
547
|
+
function ve({
|
|
548
|
+
src: e,
|
|
549
|
+
currentTime: n,
|
|
550
|
+
videoFrame: t,
|
|
551
|
+
endAt: o,
|
|
552
|
+
style: r,
|
|
553
|
+
className: i,
|
|
554
|
+
holdRenderTimeout: c
|
|
555
|
+
}) {
|
|
556
|
+
const [l, u] = ee(null), a = R(null), m = R(null);
|
|
557
|
+
if (o !== void 0 && t >= o)
|
|
558
|
+
return null;
|
|
559
|
+
M(() => {
|
|
560
|
+
const w = k(
|
|
561
|
+
`Extracting <OffthreadVideo> frame at ${n.toFixed(3)}s from "${e}"`,
|
|
562
|
+
{ timeoutInMilliseconds: c }
|
|
563
|
+
);
|
|
564
|
+
a.current = w;
|
|
565
|
+
const f = new URLSearchParams({
|
|
566
|
+
src: e,
|
|
567
|
+
time: String(n)
|
|
568
|
+
}), s = `${window.location.origin}/__offthread_video__?${f.toString()}`;
|
|
569
|
+
let d = !1;
|
|
570
|
+
return fetch(s).then((y) => {
|
|
571
|
+
if (!y.ok)
|
|
572
|
+
throw new Error(`OffthreadVideo: Failed to extract frame (HTTP ${y.status})`);
|
|
573
|
+
return y.blob();
|
|
574
|
+
}).then((y) => {
|
|
575
|
+
if (d) return;
|
|
576
|
+
m.current && URL.revokeObjectURL(m.current);
|
|
577
|
+
const v = URL.createObjectURL(y);
|
|
578
|
+
m.current = v, u(v);
|
|
579
|
+
}).catch((y) => {
|
|
580
|
+
console.error("OffthreadVideo frame extraction error:", y), a.current !== null && (S(a.current), a.current = null);
|
|
581
|
+
}), () => {
|
|
582
|
+
d = !0, a.current !== null && (S(a.current), a.current = null);
|
|
583
|
+
};
|
|
584
|
+
}, [n, e, c]), M(() => () => {
|
|
585
|
+
m.current && (URL.revokeObjectURL(m.current), m.current = null);
|
|
586
|
+
}, []);
|
|
587
|
+
const h = $(() => {
|
|
588
|
+
a.current !== null && (S(a.current), a.current = null);
|
|
589
|
+
}, []), b = $(() => {
|
|
590
|
+
a.current !== null && (S(a.current), a.current = null);
|
|
591
|
+
}, []);
|
|
592
|
+
return l ? /* @__PURE__ */ I(
|
|
593
|
+
"img",
|
|
594
|
+
{
|
|
595
|
+
src: l,
|
|
596
|
+
style: r,
|
|
597
|
+
className: i,
|
|
598
|
+
onLoad: h,
|
|
599
|
+
onError: b,
|
|
600
|
+
alt: ""
|
|
601
|
+
}
|
|
602
|
+
) : null;
|
|
603
|
+
}
|
|
604
|
+
function Ie(e, n) {
|
|
509
605
|
for (let t = 1; t < n.length; t++)
|
|
510
606
|
if (e <= n[t]) return t - 1;
|
|
511
607
|
return n.length - 2;
|
|
512
608
|
}
|
|
513
|
-
function
|
|
514
|
-
let
|
|
515
|
-
return n === t ?
|
|
609
|
+
function A(e, n, t, o, r, i) {
|
|
610
|
+
let c;
|
|
611
|
+
return n === t ? c = 0 : c = (e - n) / (t - n), i && (c = i(c)), o + c * (r - o);
|
|
516
612
|
}
|
|
517
|
-
function
|
|
613
|
+
function U(e, n, t, o) {
|
|
518
614
|
if (n.length !== t.length)
|
|
519
615
|
throw new Error(
|
|
520
616
|
`inputRange (${n.length}) and outputRange (${t.length}) must have the same length.`
|
|
521
617
|
);
|
|
522
618
|
if (n.length < 2)
|
|
523
619
|
throw new Error("inputRange and outputRange must have at least 2 elements.");
|
|
524
|
-
for (let
|
|
525
|
-
if (n[
|
|
620
|
+
for (let u = 1; u < n.length; u++)
|
|
621
|
+
if (n[u] < n[u - 1])
|
|
526
622
|
throw new Error("inputRange must be monotonically non-decreasing.");
|
|
527
623
|
const {
|
|
528
624
|
easing: r,
|
|
529
625
|
extrapolateLeft: i = "extend",
|
|
530
|
-
extrapolateRight:
|
|
626
|
+
extrapolateRight: c = "extend"
|
|
531
627
|
} = o ?? {};
|
|
532
628
|
if (e < n[0])
|
|
533
|
-
return i === "clamp" ? t[0] : i === "identity" ? e :
|
|
629
|
+
return i === "clamp" ? t[0] : i === "identity" ? e : A(
|
|
534
630
|
e,
|
|
535
631
|
n[0],
|
|
536
632
|
n[1],
|
|
@@ -539,123 +635,123 @@ function O(e, n, t, o) {
|
|
|
539
635
|
r
|
|
540
636
|
);
|
|
541
637
|
if (e > n[n.length - 1]) {
|
|
542
|
-
if (
|
|
638
|
+
if (c === "clamp")
|
|
543
639
|
return t[t.length - 1];
|
|
544
|
-
if (
|
|
640
|
+
if (c === "identity")
|
|
545
641
|
return e;
|
|
546
|
-
const
|
|
547
|
-
return
|
|
642
|
+
const u = n.length - 1;
|
|
643
|
+
return A(
|
|
548
644
|
e,
|
|
549
|
-
n[
|
|
550
|
-
n[
|
|
551
|
-
t[
|
|
552
|
-
t[
|
|
645
|
+
n[u - 1],
|
|
646
|
+
n[u],
|
|
647
|
+
t[u - 1],
|
|
648
|
+
t[u],
|
|
553
649
|
r
|
|
554
650
|
);
|
|
555
651
|
}
|
|
556
|
-
const
|
|
557
|
-
return
|
|
652
|
+
const l = Ie(e, n);
|
|
653
|
+
return A(
|
|
558
654
|
e,
|
|
559
|
-
n[
|
|
560
|
-
n[
|
|
561
|
-
t[
|
|
562
|
-
t[
|
|
655
|
+
n[l],
|
|
656
|
+
n[l + 1],
|
|
657
|
+
t[l],
|
|
658
|
+
t[l + 1],
|
|
563
659
|
r
|
|
564
660
|
);
|
|
565
661
|
}
|
|
566
|
-
function
|
|
567
|
-
const
|
|
568
|
-
return { position: e +
|
|
662
|
+
function Ce(e, n, t, o, r, i, c) {
|
|
663
|
+
const l = -o * (e - t), u = -r * n, a = (l + u) / i, m = n + a * c;
|
|
664
|
+
return { position: e + m * c, velocity: m };
|
|
569
665
|
}
|
|
570
|
-
function
|
|
666
|
+
function Ee(e) {
|
|
571
667
|
const {
|
|
572
668
|
frame: n,
|
|
573
669
|
fps: t,
|
|
574
670
|
config: o = {},
|
|
575
671
|
from: r = 0,
|
|
576
672
|
to: i = 1,
|
|
577
|
-
durationInFrames:
|
|
578
|
-
durationRestThreshold:
|
|
673
|
+
durationInFrames: c,
|
|
674
|
+
durationRestThreshold: l = 5e-3
|
|
579
675
|
} = e, {
|
|
580
|
-
damping:
|
|
581
|
-
mass:
|
|
582
|
-
stiffness:
|
|
583
|
-
clampOvershoot:
|
|
676
|
+
damping: u = 10,
|
|
677
|
+
mass: a = 1,
|
|
678
|
+
stiffness: m = 100,
|
|
679
|
+
clampOvershoot: h = !1
|
|
584
680
|
} = o;
|
|
585
681
|
if (n < 0) return r;
|
|
586
|
-
if (
|
|
682
|
+
if (c !== void 0 && n >= c)
|
|
587
683
|
return i;
|
|
588
|
-
const b = 1 / t,
|
|
589
|
-
let
|
|
590
|
-
for (let
|
|
591
|
-
for (let v = 0; v <
|
|
592
|
-
const
|
|
593
|
-
|
|
684
|
+
const b = 1 / t, w = 4, f = b / w;
|
|
685
|
+
let s = r, d = 0;
|
|
686
|
+
for (let y = 0; y < n; y++) {
|
|
687
|
+
for (let v = 0; v < w; v++) {
|
|
688
|
+
const _ = Ce(s, d, i, m, u, a, f);
|
|
689
|
+
s = _.position, d = _.velocity;
|
|
594
690
|
}
|
|
595
|
-
if (
|
|
691
|
+
if (h && (r < i ? s = Math.min(s, i) : s = Math.max(s, i), s === i && (d = 0)), Math.abs(s - i) < l && Math.abs(d) < l)
|
|
596
692
|
return i;
|
|
597
693
|
}
|
|
598
|
-
return
|
|
694
|
+
return s;
|
|
599
695
|
}
|
|
600
|
-
function
|
|
696
|
+
function Ve(e) {
|
|
601
697
|
const {
|
|
602
698
|
fps: n,
|
|
603
699
|
config: t,
|
|
604
700
|
from: o = 0,
|
|
605
701
|
to: r = 1,
|
|
606
702
|
threshold: i = 5e-3
|
|
607
|
-
} = e,
|
|
608
|
-
for (let
|
|
609
|
-
const
|
|
610
|
-
frame:
|
|
703
|
+
} = e, c = n * 60;
|
|
704
|
+
for (let l = 0; l < c; l++) {
|
|
705
|
+
const u = Ee({
|
|
706
|
+
frame: l,
|
|
611
707
|
fps: n,
|
|
612
708
|
config: t,
|
|
613
709
|
from: o,
|
|
614
710
|
to: r,
|
|
615
711
|
durationRestThreshold: i
|
|
616
712
|
});
|
|
617
|
-
if (Math.abs(
|
|
618
|
-
return
|
|
713
|
+
if (Math.abs(u - r) < i)
|
|
714
|
+
return l;
|
|
619
715
|
}
|
|
620
|
-
return
|
|
716
|
+
return c;
|
|
621
717
|
}
|
|
622
|
-
function
|
|
623
|
-
const r = 3 * e, i = 3 * (t - e) - r,
|
|
624
|
-
function
|
|
625
|
-
return ((
|
|
718
|
+
function q(e, n, t, o) {
|
|
719
|
+
const r = 3 * e, i = 3 * (t - e) - r, c = 1 - r - i, l = 3 * n, u = 3 * (o - n) - l, a = 1 - l - u;
|
|
720
|
+
function m(f) {
|
|
721
|
+
return ((c * f + i) * f + r) * f;
|
|
626
722
|
}
|
|
627
|
-
function
|
|
628
|
-
return ((
|
|
723
|
+
function h(f) {
|
|
724
|
+
return ((a * f + u) * f + l) * f;
|
|
629
725
|
}
|
|
630
|
-
function b(
|
|
631
|
-
return (3 *
|
|
726
|
+
function b(f) {
|
|
727
|
+
return (3 * c * f + 2 * i) * f + r;
|
|
632
728
|
}
|
|
633
|
-
function
|
|
634
|
-
let
|
|
729
|
+
function w(f) {
|
|
730
|
+
let s = f;
|
|
635
731
|
for (let v = 0; v < 8; v++) {
|
|
636
|
-
const
|
|
637
|
-
if (Math.abs(
|
|
638
|
-
const
|
|
639
|
-
if (Math.abs(
|
|
640
|
-
|
|
732
|
+
const _ = m(s) - f;
|
|
733
|
+
if (Math.abs(_) < 1e-7) return s;
|
|
734
|
+
const C = b(s);
|
|
735
|
+
if (Math.abs(C) < 1e-7) break;
|
|
736
|
+
s -= _ / C;
|
|
641
737
|
}
|
|
642
|
-
let
|
|
643
|
-
for (
|
|
644
|
-
const v =
|
|
645
|
-
if (Math.abs(v -
|
|
646
|
-
|
|
738
|
+
let d = 0, y = 1;
|
|
739
|
+
for (s = f; d < y; ) {
|
|
740
|
+
const v = m(s);
|
|
741
|
+
if (Math.abs(v - f) < 1e-7) return s;
|
|
742
|
+
f > v ? d = s : y = s, s = (d + y) / 2;
|
|
647
743
|
}
|
|
648
|
-
return
|
|
744
|
+
return s;
|
|
649
745
|
}
|
|
650
|
-
return (
|
|
746
|
+
return (f) => f <= 0 ? 0 : f >= 1 ? 1 : h(w(f));
|
|
651
747
|
}
|
|
652
748
|
const ke = {
|
|
653
749
|
linear: ((e) => e),
|
|
654
|
-
ease:
|
|
655
|
-
easeIn:
|
|
656
|
-
easeOut:
|
|
657
|
-
easeInOut:
|
|
658
|
-
bezier:
|
|
750
|
+
ease: q(0.25, 0.1, 0.25, 1),
|
|
751
|
+
easeIn: q(0.42, 0, 1, 1),
|
|
752
|
+
easeOut: q(0, 0, 0.58, 1),
|
|
753
|
+
easeInOut: q(0.42, 0, 0.58, 1),
|
|
754
|
+
bezier: q,
|
|
659
755
|
bounce: ((e) => e < 1 / 2.75 ? 7.5625 * e * e : e < 2 / 2.75 ? 7.5625 * (e -= 1.5 / 2.75) * e + 0.75 : e < 2.5 / 2.75 ? 7.5625 * (e -= 2.25 / 2.75) * e + 0.9375 : 7.5625 * (e -= 2.625 / 2.75) * e + 0.984375),
|
|
660
756
|
elastic: (e = 1) => {
|
|
661
757
|
const n = 0.3 / Math.max(e, 1e-3);
|
|
@@ -705,7 +801,7 @@ const Z = {
|
|
|
705
801
|
grey: "#808080",
|
|
706
802
|
transparent: "rgba(0,0,0,0)"
|
|
707
803
|
};
|
|
708
|
-
function
|
|
804
|
+
function Se(e) {
|
|
709
805
|
const n = e.trim().toLowerCase();
|
|
710
806
|
if (Z[n]) {
|
|
711
807
|
const t = Z[n];
|
|
@@ -717,65 +813,65 @@ function Ce(e) {
|
|
|
717
813
|
return Q(n);
|
|
718
814
|
throw new Error(`Unsupported color format: ${e}`);
|
|
719
815
|
}
|
|
720
|
-
function
|
|
816
|
+
function Me(e) {
|
|
721
817
|
const [n, t, o, r] = e;
|
|
722
818
|
return r === 1 ? `rgb(${Math.round(n)}, ${Math.round(t)}, ${Math.round(o)})` : `rgba(${Math.round(n)}, ${Math.round(t)}, ${Math.round(o)}, ${Number(r.toFixed(3))})`;
|
|
723
819
|
}
|
|
724
|
-
function
|
|
820
|
+
function qe(e, n, t, o) {
|
|
725
821
|
if (n.length !== t.length)
|
|
726
822
|
throw new Error("inputRange and outputRange must have the same length.");
|
|
727
|
-
const r = t.map(
|
|
823
|
+
const r = t.map(Se), i = U(
|
|
728
824
|
e,
|
|
729
825
|
n,
|
|
730
|
-
r.map((
|
|
826
|
+
r.map((a) => a[0]),
|
|
731
827
|
o
|
|
732
|
-
),
|
|
828
|
+
), c = U(
|
|
733
829
|
e,
|
|
734
830
|
n,
|
|
735
|
-
r.map((
|
|
831
|
+
r.map((a) => a[1]),
|
|
736
832
|
o
|
|
737
|
-
),
|
|
833
|
+
), l = U(
|
|
738
834
|
e,
|
|
739
835
|
n,
|
|
740
|
-
r.map((
|
|
836
|
+
r.map((a) => a[2]),
|
|
741
837
|
o
|
|
742
|
-
),
|
|
838
|
+
), u = U(
|
|
743
839
|
e,
|
|
744
840
|
n,
|
|
745
|
-
r.map((
|
|
841
|
+
r.map((a) => a[3]),
|
|
746
842
|
o
|
|
747
843
|
);
|
|
748
|
-
return
|
|
844
|
+
return Me([
|
|
749
845
|
Math.max(0, Math.min(255, i)),
|
|
750
|
-
Math.max(0, Math.min(255,
|
|
751
|
-
Math.max(0, Math.min(255,
|
|
752
|
-
Math.max(0, Math.min(1,
|
|
846
|
+
Math.max(0, Math.min(255, c)),
|
|
847
|
+
Math.max(0, Math.min(255, l)),
|
|
848
|
+
Math.max(0, Math.min(1, u))
|
|
753
849
|
]);
|
|
754
850
|
}
|
|
755
|
-
let
|
|
756
|
-
function
|
|
757
|
-
if (
|
|
851
|
+
let B = null;
|
|
852
|
+
function De(e) {
|
|
853
|
+
if (B !== null)
|
|
758
854
|
throw new Error("setRootComponent() can only be called once.");
|
|
759
|
-
|
|
855
|
+
B = e;
|
|
760
856
|
}
|
|
761
|
-
function
|
|
762
|
-
return
|
|
857
|
+
function Ue() {
|
|
858
|
+
return B;
|
|
763
859
|
}
|
|
764
|
-
function
|
|
860
|
+
function He(e) {
|
|
765
861
|
return `/${e.startsWith("/") ? e.slice(1) : e}`;
|
|
766
862
|
}
|
|
767
|
-
function
|
|
863
|
+
function je() {
|
|
768
864
|
return typeof window < "u" && window.__RENDIV_INPUT_PROPS__ ? window.__RENDIV_INPUT_PROPS__ : {};
|
|
769
865
|
}
|
|
770
|
-
function
|
|
771
|
-
const { environment: e } = p(
|
|
866
|
+
function ze() {
|
|
867
|
+
const { environment: e } = p(z);
|
|
772
868
|
return {
|
|
773
869
|
isStudio: e === "studio",
|
|
774
870
|
isRendering: e === "rendering",
|
|
775
871
|
isPlayer: e === "player"
|
|
776
872
|
};
|
|
777
873
|
}
|
|
778
|
-
function
|
|
874
|
+
function Xe() {
|
|
779
875
|
if (typeof window < "u") {
|
|
780
876
|
const e = window.__RENDIV_ENVIRONMENT__;
|
|
781
877
|
return {
|
|
@@ -786,44 +882,45 @@ function ze() {
|
|
|
786
882
|
}
|
|
787
883
|
return { isStudio: !1, isRendering: !1, isPlayer: !1 };
|
|
788
884
|
}
|
|
789
|
-
const
|
|
885
|
+
const Ae = O(null);
|
|
790
886
|
export {
|
|
791
887
|
ye as AnimatedImage,
|
|
792
888
|
pe as Audio,
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
889
|
+
xe as Composition,
|
|
890
|
+
D as CompositionContext,
|
|
891
|
+
ne as CompositionManagerContext,
|
|
796
892
|
ke as Easing,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
893
|
+
W as Fill,
|
|
894
|
+
fe as Folder,
|
|
895
|
+
j as FolderContext,
|
|
896
|
+
me as Freeze,
|
|
801
897
|
we as IFrame,
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
898
|
+
ge as Img,
|
|
899
|
+
de as Loop,
|
|
900
|
+
be as OffthreadVideo,
|
|
901
|
+
z as RendivEnvironmentContext,
|
|
902
|
+
te as Sequence,
|
|
903
|
+
x as SequenceContext,
|
|
904
|
+
Pe as Series,
|
|
905
|
+
$e as Still,
|
|
906
|
+
F as TimelineContext,
|
|
907
|
+
Ae as TimelineRegistryContext,
|
|
908
|
+
oe as Video,
|
|
909
|
+
Le as abortRender,
|
|
910
|
+
qe as blendColors,
|
|
911
|
+
je as getInputProps,
|
|
912
|
+
Oe as getPendingHoldCount,
|
|
913
|
+
Te as getPendingHoldLabels,
|
|
914
|
+
Xe as getRendivEnvironment,
|
|
915
|
+
Ue as getRootComponent,
|
|
916
|
+
Ve as getSpringDuration,
|
|
917
|
+
k as holdRender,
|
|
918
|
+
U as interpolate,
|
|
919
|
+
S as releaseRender,
|
|
920
|
+
De as setRootComponent,
|
|
921
|
+
Ee as spring,
|
|
922
|
+
He as staticFile,
|
|
923
|
+
Fe as useCompositionConfig,
|
|
924
|
+
Re as useFrame,
|
|
925
|
+
ze as useRendivEnvironment
|
|
829
926
|
};
|