@algorisys/tinyfly 0.100.0 → 0.102.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.
- package/README.md +6 -6
- package/bin/tinyfly.mjs +16 -6
- package/docs/character-appearance.md +26 -0
- package/docs/editor-guide.md +1 -1
- package/docs/examples.md +1 -1
- package/docs/getting-started.md +1 -1
- package/docs/gsap-compat.md +1 -1
- package/docs/llm-guide.md +22 -4
- package/docs/maps.md +2 -2
- package/docs/scene-3d.md +140 -9
- package/docs/teaching.md +1 -1
- package/docs/video-rendering.md +198 -1
- package/lib/addons/adapters.js +431 -332
- package/lib/addons/characters.js +3889 -3773
- package/lib/addons/load-scene-oWNsYYC1.js +372 -0
- package/lib/addons/scene-3d-webgl.js +31 -31
- package/lib/addons/scene-3d.js +669 -314
- package/lib/addons/shading-0lPgnXmD.js +96 -0
- package/lib/browser/tinyfly-scene-3d-webgl.iife.js +2 -2
- package/lib/browser/tinyfly-scene-3d.iife.js +2 -2
- package/lib/browser/tinyfly.iife.js +15 -15
- package/lib/browser/tinyfly.js +6232 -5723
- package/lib/browser/tinyfly.umd.js +15 -15
- package/lib/engine/tinyfly-engine.js +1563 -1170
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/headless/headless.js +189 -6
- package/lib/types/adapters/canvas/framing.d.ts +27 -0
- package/lib/types/adapters/canvas/impossible.d.ts +15 -0
- package/lib/types/adapters/canvas/index.d.ts +4 -0
- package/lib/types/adapters/canvas/nested-zoom.d.ts +40 -0
- package/lib/types/adapters/canvas/zoom-blur.d.ts +49 -0
- package/lib/types/characters/character-script-3d.d.ts +21 -1
- package/lib/types/characters/character.d.ts +23 -3
- package/lib/types/characters/head/face.d.ts +19 -2
- package/lib/types/characters/index.d.ts +2 -1
- package/lib/types/characters/staging-3d.d.ts +56 -0
- package/lib/types/engine/authoring/beat-loop.d.ts +46 -0
- package/lib/types/engine/authoring/curve.d.ts +26 -0
- package/lib/types/engine/authoring/framing.d.ts +48 -0
- package/lib/types/engine/authoring/index.d.ts +4 -0
- package/lib/types/engine/authoring/periodic.d.ts +89 -0
- package/lib/types/engine/path/goo.d.ts +103 -0
- package/lib/types/engine/path/impossible.d.ts +92 -0
- package/lib/types/engine/path/index.d.ts +6 -0
- package/lib/types/engine/path/similarity.d.ts +48 -0
- package/lib/types/headless/audio-mix.d.ts +40 -0
- package/lib/types/headless/ffmpeg-args.d.ts +2 -0
- package/lib/types/headless/frame-renderer.d.ts +7 -1
- package/lib/types/headless/index.d.ts +2 -0
- package/lib/types/headless/loop-audio.d.ts +21 -0
- package/lib/types/headless/node-audio.d.ts +39 -0
- package/lib/types/headless/node-video.d.ts +2 -0
- package/lib/types/headless/video-scene.d.ts +21 -0
- package/lib/types/scene-3d/camera.d.ts +11 -2
- package/lib/types/scene-3d/geometry/mesh.d.ts +2 -0
- package/lib/types/scene-3d/geometry/primitives.d.ts +7 -0
- package/lib/types/scene-3d/impossible-3d.d.ts +29 -0
- package/lib/types/scene-3d/index.d.ts +7 -3
- package/lib/types/scene-3d/lighting.d.ts +58 -0
- package/lib/types/scene-3d/resolve-scene.d.ts +18 -2
- package/lib/types/scene-3d/scene-3d-adapter.d.ts +4 -0
- package/lib/types/scene-3d/scene-types.d.ts +43 -6
- package/lib/types/scene-3d/shading.d.ts +2 -0
- package/lib/types/scene-3d/shots.d.ts +162 -0
- package/lib/types/scene-3d/software-renderer.d.ts +40 -0
- package/llms-full.txt +395 -23
- package/llms.txt +29 -29
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +11 -1
- package/lib/addons/load-scene-CQvcFWGJ.js +0 -331
- package/lib/addons/shading-o5T_v9DT.js +0 -89
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Qe(t) {
|
|
2
2
|
return typeof t == "object" && t !== null && t.type === "cubic-bezier";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function St(t) {
|
|
5
5
|
return typeof t == "object" && t !== null && t.type !== "cubic-bezier";
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
function
|
|
7
|
+
const Vt = 2;
|
|
8
|
+
function ue(t) {
|
|
9
9
|
return t.some((e) => e.interpolation !== void 0) ? 2 : 1;
|
|
10
10
|
}
|
|
11
|
-
function
|
|
11
|
+
function Et(t) {
|
|
12
12
|
return t.property === "text" && "textConfig" in t;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function U(t) {
|
|
15
15
|
return t.kind === "inertia" && "inertia" in t;
|
|
16
16
|
}
|
|
17
17
|
function V(t) {
|
|
18
18
|
return t.kind === "spring" && "spring" in t;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function he(t) {
|
|
21
21
|
return t.property === "motionPath" && "motionPathConfig" in t;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Gr(t) {
|
|
24
24
|
return typeof t == "object" && t !== null && "x" in t && "y" in t && "angle" in t;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function Ge(t) {
|
|
27
27
|
return "keyframes" in t;
|
|
28
28
|
}
|
|
29
|
-
class
|
|
29
|
+
class Kr {
|
|
30
30
|
_currentTime = 0;
|
|
31
31
|
_isRunning = !1;
|
|
32
32
|
onTick = null;
|
|
@@ -52,7 +52,7 @@ class Cs {
|
|
|
52
52
|
this._currentTime = e;
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
class
|
|
55
|
+
class Zr {
|
|
56
56
|
_currentTime = 0;
|
|
57
57
|
_isRunning = !1;
|
|
58
58
|
_lastFrameTime = null;
|
|
@@ -92,23 +92,23 @@ class Ds {
|
|
|
92
92
|
_onFrame(e) {
|
|
93
93
|
if (this._isRunning) {
|
|
94
94
|
if (this._lastFrameTime !== null) {
|
|
95
|
-
const
|
|
96
|
-
this._currentTime +=
|
|
95
|
+
const r = (e - this._lastFrameTime) * this._speed;
|
|
96
|
+
this._currentTime += r, this.onTick?.(r, this._currentTime);
|
|
97
97
|
}
|
|
98
98
|
this._lastFrameTime = e, this._scheduleFrame();
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function Ke(t, e) {
|
|
103
103
|
if (!(e > 0)) return t;
|
|
104
104
|
const n = 1e3 / e;
|
|
105
105
|
return Math.floor(t / n + 1e-9) * n;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function le(t, e, n = "start") {
|
|
108
108
|
if (e <= 1) return 0;
|
|
109
109
|
if (typeof n == "number") {
|
|
110
|
-
const
|
|
111
|
-
return Math.abs(t -
|
|
110
|
+
const r = Math.max(0, Math.min(e - 1, n));
|
|
111
|
+
return Math.abs(t - r);
|
|
112
112
|
}
|
|
113
113
|
switch (n) {
|
|
114
114
|
case "end":
|
|
@@ -121,36 +121,36 @@ function oe(t, e, n = "start") {
|
|
|
121
121
|
return t;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function Ze(t, e = "start") {
|
|
125
125
|
if (t <= 1) return 0;
|
|
126
126
|
let n = 0;
|
|
127
|
-
for (let
|
|
128
|
-
n = Math.max(n,
|
|
127
|
+
for (let r = 0; r < t; r++)
|
|
128
|
+
n = Math.max(n, le(r, t, e));
|
|
129
129
|
return n;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function fe(t, e, n) {
|
|
132
132
|
if (n.offsets) return n.offsets[t] ?? 0;
|
|
133
|
-
const
|
|
133
|
+
const r = n.from ?? "start", s = le(t, e, r);
|
|
134
134
|
if (n.amount !== void 0) {
|
|
135
|
-
const o =
|
|
136
|
-
return o === 0 ? 0 : n.amount *
|
|
135
|
+
const o = Ze(e, r);
|
|
136
|
+
return o === 0 ? 0 : n.amount * s / o;
|
|
137
137
|
}
|
|
138
|
-
return n.each !== void 0 ? n.each *
|
|
138
|
+
return n.each !== void 0 ? n.each * s : 0;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
return Array.from({ length: t }, (n,
|
|
140
|
+
function Je(t, e) {
|
|
141
|
+
return Array.from({ length: t }, (n, r) => fe(r, t, e));
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
return t <= 1 ? 0 : Math.max(...
|
|
143
|
+
function Dt(t, e) {
|
|
144
|
+
return t <= 1 ? 0 : Math.max(...Je(t, e));
|
|
145
145
|
}
|
|
146
|
-
const
|
|
146
|
+
const et = 1, de = 6e4, ot = de / et, L = {
|
|
147
147
|
stiffness: 180,
|
|
148
148
|
damping: 12,
|
|
149
149
|
mass: 1,
|
|
150
150
|
velocity: 0,
|
|
151
151
|
restDelta: 0.01,
|
|
152
152
|
restSpeed: 0.1
|
|
153
|
-
},
|
|
153
|
+
}, Jr = {
|
|
154
154
|
gentle: { stiffness: 120, damping: 18, mass: 1 },
|
|
155
155
|
default: { stiffness: 180, damping: 12, mass: 1 },
|
|
156
156
|
snappy: { stiffness: 280, damping: 20, mass: 1 },
|
|
@@ -158,7 +158,7 @@ const tt = 1, ie = 6e4, rt = ie / tt, L = {
|
|
|
158
158
|
wobbly: { stiffness: 180, damping: 5, mass: 1 },
|
|
159
159
|
stiff: { stiffness: 400, damping: 30, mass: 1 }
|
|
160
160
|
};
|
|
161
|
-
class
|
|
161
|
+
class lt {
|
|
162
162
|
from;
|
|
163
163
|
to;
|
|
164
164
|
stiffness;
|
|
@@ -201,155 +201,155 @@ class ut {
|
|
|
201
201
|
*/
|
|
202
202
|
valueAt(e) {
|
|
203
203
|
if (e <= 0) return this.from;
|
|
204
|
-
const n = Math.floor(e /
|
|
204
|
+
const n = Math.floor(e / et);
|
|
205
205
|
if (this.simulateTo(n + 1), this.settledStep !== null && n >= this.settledStep)
|
|
206
206
|
return this.to;
|
|
207
|
-
const
|
|
208
|
-
return
|
|
207
|
+
const r = this.samples[Math.min(n, this.samples.length - 1)], s = this.samples[Math.min(n + 1, this.samples.length - 1)], o = e / et - n;
|
|
208
|
+
return r + (s - r) * o;
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* How long the spring takes to settle, in milliseconds — the natural duration
|
|
212
212
|
* of a spring track. Runs the simulation to completion once.
|
|
213
213
|
*/
|
|
214
214
|
settleTime() {
|
|
215
|
-
return this.simulateTo(
|
|
215
|
+
return this.simulateTo(ot + 1), this.settledStep !== null ? this.settledStep * et : de;
|
|
216
216
|
}
|
|
217
217
|
/** Advance the cached simulation until it holds at least `steps` samples. */
|
|
218
218
|
simulateTo(e) {
|
|
219
219
|
if (this.settledStep !== null) return;
|
|
220
|
-
const n = Math.min(e,
|
|
220
|
+
const n = Math.min(e, ot + 1), r = et / 1e3;
|
|
221
221
|
for (; this.samples.length < n; ) {
|
|
222
|
-
const
|
|
223
|
-
this.velocity += c *
|
|
224
|
-
const
|
|
225
|
-
if (this.samples.push(
|
|
222
|
+
const s = this.samples[this.samples.length - 1], o = s - this.to, a = -this.stiffness * o, i = -this.damping * this.velocity, c = (a + i) / this.mass;
|
|
223
|
+
this.velocity += c * r;
|
|
224
|
+
const h = s + this.velocity * r;
|
|
225
|
+
if (this.samples.push(h), this.isAtRest(h)) {
|
|
226
226
|
this.settledStep = this.samples.length - 1;
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
this.samples.length >
|
|
230
|
+
this.samples.length > ot && (this.settledStep = ot);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
function
|
|
234
|
-
return new
|
|
233
|
+
function ts(t, e) {
|
|
234
|
+
return new lt(t).valueAt(e);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
237
|
-
return new
|
|
236
|
+
function es(t) {
|
|
237
|
+
return new lt(t).settleTime();
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
const e = t.stiffness ?? L.stiffness, n = t.damping ?? L.damping,
|
|
241
|
-
return n < 2 * Math.sqrt(e *
|
|
239
|
+
function ns(t) {
|
|
240
|
+
const e = t.stiffness ?? L.stiffness, n = t.damping ?? L.damping, r = t.mass ?? L.mass;
|
|
241
|
+
return n < 2 * Math.sqrt(e * r);
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function rs(t) {
|
|
244
244
|
const e = t.stiffness ?? L.stiffness, n = t.mass ?? L.mass;
|
|
245
245
|
return 2 * Math.sqrt(e * n);
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
function
|
|
249
|
-
const e = t.friction ??
|
|
250
|
-
return e > 0 ? e :
|
|
247
|
+
const Bt = 4, tn = 2e-3, en = 1e-4, nn = 6e4;
|
|
248
|
+
function ft(t) {
|
|
249
|
+
const e = t.friction ?? Bt;
|
|
250
|
+
return e > 0 ? e : Bt;
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
return t.from + t.velocity /
|
|
252
|
+
function rn(t) {
|
|
253
|
+
return t.from + t.velocity / ft(t);
|
|
254
254
|
}
|
|
255
|
-
function
|
|
255
|
+
function sn(t, e) {
|
|
256
256
|
if (e === void 0) return t;
|
|
257
257
|
if (typeof e == "number")
|
|
258
258
|
return e > 0 ? Math.round(t / e) * e : t;
|
|
259
259
|
if (e.length === 0) return t;
|
|
260
260
|
let n = e[0];
|
|
261
|
-
for (const
|
|
262
|
-
Math.abs(
|
|
261
|
+
for (const r of e)
|
|
262
|
+
Math.abs(r - t) < Math.abs(n - t) && (n = r);
|
|
263
263
|
return n;
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
let e =
|
|
265
|
+
function dt(t) {
|
|
266
|
+
let e = sn(rn(t), t.end);
|
|
267
267
|
return t.min !== void 0 && (e = Math.max(t.min, e)), t.max !== void 0 && (e = Math.min(t.max, e)), e;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
270
|
-
const e = Math.abs(
|
|
269
|
+
function mt(t) {
|
|
270
|
+
const e = Math.abs(dt(t) - t.from);
|
|
271
271
|
if (e === 0) return 0;
|
|
272
|
-
const n = t.restDelta ?? Math.max(
|
|
272
|
+
const n = t.restDelta ?? Math.max(en, e * tn);
|
|
273
273
|
if (n >= e) return 0;
|
|
274
|
-
const
|
|
275
|
-
return Math.min(
|
|
274
|
+
const r = Math.log(e / n) / ft(t);
|
|
275
|
+
return Math.min(nn, r * 1e3);
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function vt(t, e) {
|
|
278
278
|
if (e <= 0) return t.from;
|
|
279
|
-
const n =
|
|
280
|
-
if (e >=
|
|
281
|
-
const
|
|
282
|
-
return t.from + (n - t.from) * (1 - Math.exp(-
|
|
283
|
-
}
|
|
284
|
-
function
|
|
285
|
-
const n =
|
|
286
|
-
return e >=
|
|
287
|
-
}
|
|
288
|
-
const
|
|
289
|
-
linear:
|
|
290
|
-
"ease-in":
|
|
291
|
-
"ease-out":
|
|
292
|
-
"ease-in-out":
|
|
293
|
-
"ease-in-quad":
|
|
294
|
-
"ease-out-quad":
|
|
295
|
-
"ease-in-out-quad":
|
|
296
|
-
"ease-in-cubic":
|
|
297
|
-
"ease-out-cubic":
|
|
298
|
-
"ease-in-out-cubic":
|
|
279
|
+
const n = dt(t);
|
|
280
|
+
if (e >= mt(t)) return n;
|
|
281
|
+
const r = ft(t);
|
|
282
|
+
return t.from + (n - t.from) * (1 - Math.exp(-r * e / 1e3));
|
|
283
|
+
}
|
|
284
|
+
function ss(t, e) {
|
|
285
|
+
const n = ft(t), r = dt(t);
|
|
286
|
+
return e >= mt(t) ? 0 : (r - t.from) * n * Math.exp(-n * Math.max(0, e) / 1e3);
|
|
287
|
+
}
|
|
288
|
+
const Pt = (t) => t, on = (t) => t * t, an = (t) => 1 - (1 - t) * (1 - t), cn = (t) => t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2, me = (t) => t * t * t, ge = (t) => 1 - Math.pow(1 - t, 3), pe = (t) => t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2, un = me, hn = ge, ln = pe, fn = {
|
|
289
|
+
linear: Pt,
|
|
290
|
+
"ease-in": un,
|
|
291
|
+
"ease-out": hn,
|
|
292
|
+
"ease-in-out": ln,
|
|
293
|
+
"ease-in-quad": on,
|
|
294
|
+
"ease-out-quad": an,
|
|
295
|
+
"ease-in-out-quad": cn,
|
|
296
|
+
"ease-in-cubic": me,
|
|
297
|
+
"ease-out-cubic": ge,
|
|
298
|
+
"ease-in-out-cubic": pe
|
|
299
299
|
};
|
|
300
|
-
function
|
|
301
|
-
const [e, n,
|
|
302
|
-
let
|
|
303
|
-
for (let
|
|
304
|
-
const w = u(
|
|
300
|
+
function dn(t) {
|
|
301
|
+
const [e, n, r, s] = t, o = 3 * e, a = 3 * (r - e) - o, i = 1 - o - a, c = 3 * n, h = 3 * (s - n) - c, l = 1 - c - h, u = (m) => ((i * m + a) * m + o) * m, d = (m) => ((l * m + h) * m + c) * m, f = (m) => (3 * i * m + 2 * a) * m + o, g = (m) => {
|
|
302
|
+
let M = m;
|
|
303
|
+
for (let _ = 0; _ < 8; _++) {
|
|
304
|
+
const w = u(M) - m;
|
|
305
305
|
if (Math.abs(w) < 1e-7)
|
|
306
|
-
return
|
|
307
|
-
const
|
|
308
|
-
if (Math.abs(
|
|
306
|
+
return M;
|
|
307
|
+
const x = f(M);
|
|
308
|
+
if (Math.abs(x) < 1e-7)
|
|
309
309
|
break;
|
|
310
|
-
|
|
310
|
+
M -= w / x;
|
|
311
311
|
}
|
|
312
|
-
let
|
|
313
|
-
for (
|
|
314
|
-
const
|
|
315
|
-
if (Math.abs(
|
|
316
|
-
return
|
|
317
|
-
|
|
312
|
+
let y = 0, p = 1;
|
|
313
|
+
for (M = m; y < p; ) {
|
|
314
|
+
const _ = u(M);
|
|
315
|
+
if (Math.abs(_ - m) < 1e-7)
|
|
316
|
+
return M;
|
|
317
|
+
m > _ ? y = M : p = M, M = (y + p) / 2;
|
|
318
318
|
}
|
|
319
|
-
return
|
|
319
|
+
return M;
|
|
320
320
|
};
|
|
321
|
-
return (
|
|
322
|
-
if (
|
|
323
|
-
if (
|
|
324
|
-
const
|
|
325
|
-
return
|
|
321
|
+
return (m) => {
|
|
322
|
+
if (m <= 0) return 0;
|
|
323
|
+
if (m >= 1) return 1;
|
|
324
|
+
const M = g(m);
|
|
325
|
+
return d(M);
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
|
-
function
|
|
328
|
+
function _t(t, e = "out") {
|
|
329
329
|
if (e === "out") return t;
|
|
330
|
-
const n = (
|
|
331
|
-
return e === "in" ? n : (
|
|
330
|
+
const n = (r) => 1 - t(1 - r);
|
|
331
|
+
return e === "in" ? n : (r) => r < 0.5 ? n(r * 2) / 2 : t(r * 2 - 1) / 2 + 0.5;
|
|
332
332
|
}
|
|
333
|
-
function
|
|
334
|
-
const n = Math.max(1, t),
|
|
335
|
-
return (
|
|
333
|
+
function mn(t = 1, e = 0.3) {
|
|
334
|
+
const n = Math.max(1, t), r = e / (2 * Math.PI) * Math.asin(1 / n);
|
|
335
|
+
return (s) => s <= 0 ? 0 : s >= 1 ? 1 : n * Math.pow(2, -10 * s) * Math.sin((s - r) * (2 * Math.PI) / e) + 1;
|
|
336
336
|
}
|
|
337
|
-
const
|
|
337
|
+
const gn = (t) => {
|
|
338
338
|
if (t <= 0) return 0;
|
|
339
339
|
if (t >= 1) return 1;
|
|
340
340
|
if (t < 1 / 2.75) return 7.5625 * t * t;
|
|
341
341
|
if (t < 2 / 2.75) {
|
|
342
|
-
const
|
|
343
|
-
return 7.5625 *
|
|
342
|
+
const s = t - 0.5454545454545454;
|
|
343
|
+
return 7.5625 * s * s + 0.75;
|
|
344
344
|
}
|
|
345
345
|
if (t < 2.5 / 2.75) {
|
|
346
|
-
const
|
|
347
|
-
return 7.5625 *
|
|
346
|
+
const s = t - 0.8181818181818182;
|
|
347
|
+
return 7.5625 * s * s + 0.9375;
|
|
348
348
|
}
|
|
349
|
-
const
|
|
350
|
-
return 7.5625 *
|
|
349
|
+
const r = t - 2.625 / 2.75;
|
|
350
|
+
return 7.5625 * r * r + 0.984375;
|
|
351
351
|
};
|
|
352
|
-
function
|
|
352
|
+
function pn(t = 1.70158) {
|
|
353
353
|
return (e) => {
|
|
354
354
|
if (e <= 0) return 0;
|
|
355
355
|
if (e >= 1) return 1;
|
|
@@ -357,40 +357,40 @@ function sn(t = 1.70158) {
|
|
|
357
357
|
return n * n * ((t + 1) * n + t) + 1;
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
|
-
function
|
|
360
|
+
function yn(t, e = "end") {
|
|
361
361
|
const n = Math.max(1, Math.floor(t));
|
|
362
|
-
return (
|
|
363
|
-
if (
|
|
364
|
-
if (
|
|
365
|
-
const
|
|
362
|
+
return (r) => {
|
|
363
|
+
if (r >= 1) return 1;
|
|
364
|
+
if (r <= 0) return e === "start" || e === "both" ? e === "start" ? 1 / n : 1 / (n + 1) : 0;
|
|
365
|
+
const s = Math.floor(r * n);
|
|
366
366
|
switch (e) {
|
|
367
367
|
case "start":
|
|
368
|
-
return Math.min(1, (
|
|
368
|
+
return Math.min(1, (s + 1) / n);
|
|
369
369
|
case "both":
|
|
370
|
-
return (
|
|
370
|
+
return (s + 1) / (n + 1);
|
|
371
371
|
case "none":
|
|
372
|
-
return n === 1 ? 0 : Math.min(1,
|
|
372
|
+
return n === 1 ? 0 : Math.min(1, s / (n - 1));
|
|
373
373
|
default:
|
|
374
|
-
return
|
|
374
|
+
return s / n;
|
|
375
375
|
}
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
|
-
function
|
|
378
|
+
function Mn(t) {
|
|
379
379
|
switch (t.type) {
|
|
380
380
|
case "steps":
|
|
381
|
-
return
|
|
381
|
+
return yn(t.count, t.position);
|
|
382
382
|
case "elastic":
|
|
383
|
-
return
|
|
383
|
+
return _t(mn(t.amplitude, t.period), t.mode);
|
|
384
384
|
case "bounce":
|
|
385
|
-
return
|
|
385
|
+
return _t(gn, t.mode);
|
|
386
386
|
case "back":
|
|
387
|
-
return
|
|
387
|
+
return _t(pn(t.overshoot), t.mode);
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
function
|
|
391
|
-
return t === void 0 ?
|
|
390
|
+
function Lt(t) {
|
|
391
|
+
return t === void 0 ? Pt : Qe(t) ? dn(t.points) : St(t) ? Mn(t) : fn[t] ?? Pt;
|
|
392
392
|
}
|
|
393
|
-
const
|
|
393
|
+
const Ht = 32, xn = 256, q = /* @__PURE__ */ new Map(), _n = /[MmLlHhVvCcSsQqTtAaZz]/, bn = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Tn = {
|
|
394
394
|
M: 2,
|
|
395
395
|
L: 2,
|
|
396
396
|
H: 1,
|
|
@@ -402,191 +402,191 @@ const zt = 32, an = 256, W = /* @__PURE__ */ new Map(), cn = /[MmLlHhVvCcSsQqTtA
|
|
|
402
402
|
A: 7,
|
|
403
403
|
Z: 0
|
|
404
404
|
};
|
|
405
|
-
function
|
|
405
|
+
function wn(t) {
|
|
406
406
|
const e = [];
|
|
407
|
-
let n = 0,
|
|
408
|
-
const
|
|
407
|
+
let n = 0, r = null;
|
|
408
|
+
const s = () => {
|
|
409
409
|
for (; n < t.length && /[\s,]/.test(t[n]); ) n++;
|
|
410
410
|
};
|
|
411
|
-
for (; n < t.length && (
|
|
411
|
+
for (; n < t.length && (s(), !(n >= t.length)); ) {
|
|
412
412
|
const o = t[n];
|
|
413
|
-
if (
|
|
414
|
-
|
|
413
|
+
if (_n.test(o)) {
|
|
414
|
+
r = { type: o, args: [] }, e.push(r), n++;
|
|
415
415
|
continue;
|
|
416
416
|
}
|
|
417
|
-
if (!
|
|
418
|
-
const a =
|
|
417
|
+
if (!r) break;
|
|
418
|
+
const a = r.type === "A" || r.type === "a", i = r.args.length % 7;
|
|
419
419
|
if (a && (i === 3 || i === 4)) {
|
|
420
420
|
if (o !== "0" && o !== "1") break;
|
|
421
|
-
|
|
421
|
+
r.args.push(o === "1" ? 1 : 0), n++;
|
|
422
422
|
continue;
|
|
423
423
|
}
|
|
424
|
-
const c =
|
|
424
|
+
const c = bn.exec(t.slice(n));
|
|
425
425
|
if (!c) break;
|
|
426
|
-
|
|
426
|
+
r.args.push(parseFloat(c[0])), n += c[0].length;
|
|
427
427
|
}
|
|
428
428
|
return e;
|
|
429
429
|
}
|
|
430
|
-
function
|
|
430
|
+
function kn(t, e, n, r, s, o, a, i, c) {
|
|
431
431
|
if (t === i && e === c) return [];
|
|
432
|
-
let
|
|
433
|
-
if (
|
|
434
|
-
const u =
|
|
435
|
-
if (
|
|
436
|
-
const R = Math.sqrt(
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
const
|
|
440
|
-
const
|
|
441
|
-
return R *
|
|
442
|
-
},
|
|
443
|
-
let $ =
|
|
432
|
+
let h = Math.abs(n), l = Math.abs(r);
|
|
433
|
+
if (h === 0 || l === 0) return [[t, e, i, c, i, c]];
|
|
434
|
+
const u = s * Math.PI / 180, d = Math.cos(u), f = Math.sin(u), g = (t - i) / 2, m = (e - c) / 2, M = d * g + f * m, y = -f * g + d * m, p = M * M / (h * h) + y * y / (l * l);
|
|
435
|
+
if (p > 1) {
|
|
436
|
+
const R = Math.sqrt(p);
|
|
437
|
+
h *= R, l *= R;
|
|
438
|
+
}
|
|
439
|
+
const _ = o === a ? -1 : 1, w = h * h * l * l - h * h * y * y - l * l * M * M, x = h * h * y * y + l * l * M * M, S = _ * Math.sqrt(Math.max(0, w / x)), k = S * h * y / l, P = -S * l * M / h, b = d * k - f * P + (t + i) / 2, T = f * k + d * P + (e + c) / 2, A = (R, E, D, B) => {
|
|
440
|
+
const xt = R * D + E * B, st = Math.sqrt((R * R + E * E) * (D * D + B * B)), Z = Math.acos(Math.max(-1, Math.min(1, xt / st)));
|
|
441
|
+
return R * B - E * D < 0 ? -Z : Z;
|
|
442
|
+
}, v = A(1, 0, (M - k) / h, (y - P) / l);
|
|
443
|
+
let $ = A((M - k) / h, (y - P) / l, (-M - k) / h, (-y - P) / l);
|
|
444
444
|
!a && $ > 0 && ($ -= 2 * Math.PI), a && $ < 0 && ($ += 2 * Math.PI);
|
|
445
|
-
const
|
|
446
|
-
const
|
|
447
|
-
return [
|
|
448
|
-
},
|
|
449
|
-
const
|
|
450
|
-
return [
|
|
451
|
-
},
|
|
452
|
-
for (let R = 0; R <
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
}
|
|
456
|
-
return
|
|
457
|
-
}
|
|
458
|
-
function Y(t, e, n,
|
|
459
|
-
const o = 1 -
|
|
460
|
-
return o * o * o * t + 3 * o * o *
|
|
461
|
-
}
|
|
462
|
-
function
|
|
463
|
-
const o = 1 -
|
|
464
|
-
return 3 * o * o * (e - t) + 6 * o *
|
|
465
|
-
}
|
|
466
|
-
function
|
|
445
|
+
const I = Math.max(1, Math.ceil(Math.abs($) / (Math.PI / 2))), Mt = $ / I, rt = 4 / 3 * Math.tan(Mt / 4), zt = (R) => {
|
|
446
|
+
const E = h * Math.cos(R), D = l * Math.sin(R);
|
|
447
|
+
return [d * E - f * D + b, f * E + d * D + T];
|
|
448
|
+
}, jt = (R) => {
|
|
449
|
+
const E = -h * Math.sin(R), D = l * Math.cos(R);
|
|
450
|
+
return [d * E - f * D, f * E + d * D];
|
|
451
|
+
}, Ut = [];
|
|
452
|
+
for (let R = 0; R < I; R++) {
|
|
453
|
+
const E = v + R * Mt, D = E + Mt, [B, xt] = zt(E), [st, Z] = R === I - 1 ? [i, c] : zt(D), [Be, He] = jt(E), [qe, We] = jt(D);
|
|
454
|
+
Ut.push([B + rt * Be, xt + rt * He, st - rt * qe, Z - rt * We, st, Z]);
|
|
455
|
+
}
|
|
456
|
+
return Ut;
|
|
457
|
+
}
|
|
458
|
+
function Y(t, e, n, r, s) {
|
|
459
|
+
const o = 1 - s;
|
|
460
|
+
return o * o * o * t + 3 * o * o * s * e + 3 * o * s * s * n + s * s * s * r;
|
|
461
|
+
}
|
|
462
|
+
function qt(t, e, n, r, s) {
|
|
463
|
+
const o = 1 - s;
|
|
464
|
+
return 3 * o * o * (e - t) + 6 * o * s * (n - e) + 3 * s * s * (r - n);
|
|
465
|
+
}
|
|
466
|
+
function J(t, e, n, r) {
|
|
467
467
|
return {
|
|
468
468
|
subpath: 0,
|
|
469
469
|
type: "L",
|
|
470
|
-
points: [n,
|
|
470
|
+
points: [n, r],
|
|
471
471
|
startX: t,
|
|
472
472
|
startY: e,
|
|
473
473
|
endX: n,
|
|
474
|
-
endY:
|
|
475
|
-
length: Math.hypot(n - t,
|
|
474
|
+
endY: r,
|
|
475
|
+
length: Math.hypot(n - t, r - e)
|
|
476
476
|
};
|
|
477
477
|
}
|
|
478
|
-
function
|
|
479
|
-
const [
|
|
480
|
-
let
|
|
481
|
-
for (let
|
|
482
|
-
const
|
|
483
|
-
|
|
478
|
+
function at(t, e, n) {
|
|
479
|
+
const [r, s, o, a, i, c] = n, h = [0];
|
|
480
|
+
let l = t, u = e, d = 0;
|
|
481
|
+
for (let f = 1; f <= Ht; f++) {
|
|
482
|
+
const g = f / Ht, m = Y(t, r, o, i, g), M = Y(e, s, a, c, g);
|
|
483
|
+
d += Math.hypot(m - l, M - u), h.push(d), l = m, u = M;
|
|
484
484
|
}
|
|
485
485
|
return {
|
|
486
486
|
subpath: 0,
|
|
487
487
|
type: "C",
|
|
488
|
-
points: [
|
|
488
|
+
points: [r, s, o, a, i, c],
|
|
489
489
|
startX: t,
|
|
490
490
|
startY: e,
|
|
491
491
|
endX: i,
|
|
492
492
|
endY: c,
|
|
493
|
-
length:
|
|
494
|
-
lengths:
|
|
493
|
+
length: d,
|
|
494
|
+
lengths: h
|
|
495
495
|
};
|
|
496
496
|
}
|
|
497
|
-
function
|
|
498
|
-
const e =
|
|
497
|
+
function Q(t) {
|
|
498
|
+
const e = q.get(t);
|
|
499
499
|
if (e) return e;
|
|
500
500
|
const n = [];
|
|
501
|
-
let
|
|
502
|
-
const
|
|
503
|
-
|
|
501
|
+
let r = 0, s = 0, o = 0, a = 0, i = null, c = null, h = -1;
|
|
502
|
+
const l = /* @__PURE__ */ new Set(), u = (m) => {
|
|
503
|
+
h < 0 && (h = 0), m.subpath = h, n.push(m);
|
|
504
504
|
};
|
|
505
|
-
for (const { type:
|
|
506
|
-
const
|
|
507
|
-
if (
|
|
508
|
-
(
|
|
505
|
+
for (const { type: m, args: M } of wn(t)) {
|
|
506
|
+
const y = m.toUpperCase(), p = m !== y, _ = Tn[y];
|
|
507
|
+
if (y === "Z") {
|
|
508
|
+
(r !== o || s !== a) && u(J(r, s, o, a)), h >= 0 && l.add(h), r = o, s = a, i = c = null;
|
|
509
509
|
continue;
|
|
510
510
|
}
|
|
511
|
-
for (let w = 0; w +
|
|
512
|
-
const
|
|
513
|
-
let
|
|
514
|
-
switch (
|
|
511
|
+
for (let w = 0; w + _ <= M.length; w += _) {
|
|
512
|
+
const x = M.slice(w, w + _), S = p ? r : 0, k = p ? s : 0;
|
|
513
|
+
let P = null, b = null;
|
|
514
|
+
switch (y) {
|
|
515
515
|
case "M":
|
|
516
|
-
w === 0 ? (
|
|
516
|
+
w === 0 ? (r = x[0] + S, s = x[1] + k, o = r, a = s, (h < 0 || n[n.length - 1]?.subpath === h) && h++) : (u(J(r, s, x[0] + S, x[1] + k)), r = x[0] + S, s = x[1] + k);
|
|
517
517
|
break;
|
|
518
518
|
case "L":
|
|
519
|
-
u(
|
|
519
|
+
u(J(r, s, x[0] + S, x[1] + k)), r = x[0] + S, s = x[1] + k;
|
|
520
520
|
break;
|
|
521
521
|
case "H":
|
|
522
|
-
u(
|
|
522
|
+
u(J(r, s, x[0] + S, s)), r = x[0] + S;
|
|
523
523
|
break;
|
|
524
524
|
case "V":
|
|
525
|
-
u(
|
|
525
|
+
u(J(r, s, r, x[0] + k)), s = x[0] + k;
|
|
526
526
|
break;
|
|
527
527
|
case "C": {
|
|
528
|
-
const T = [
|
|
529
|
-
u(
|
|
528
|
+
const T = [x[0] + S, x[1] + k, x[2] + S, x[3] + k, x[4] + S, x[5] + k];
|
|
529
|
+
u(at(r, s, T)), P = [T[2], T[3]], r = T[4], s = T[5];
|
|
530
530
|
break;
|
|
531
531
|
}
|
|
532
532
|
case "S": {
|
|
533
|
-
const [T,
|
|
534
|
-
u(
|
|
533
|
+
const [T, A] = i ? [2 * r - i[0], 2 * s - i[1]] : [r, s], v = [T, A, x[0] + S, x[1] + k, x[2] + S, x[3] + k];
|
|
534
|
+
u(at(r, s, v)), P = [v[2], v[3]], r = v[4], s = v[5];
|
|
535
535
|
break;
|
|
536
536
|
}
|
|
537
537
|
case "Q":
|
|
538
538
|
case "T": {
|
|
539
|
-
let T =
|
|
540
|
-
|
|
541
|
-
const
|
|
539
|
+
let T = r, A = s;
|
|
540
|
+
y === "Q" ? (T = x[0] + S, A = x[1] + k) : c && (T = 2 * r - c[0], A = 2 * s - c[1]);
|
|
541
|
+
const v = y === "Q" ? x[2] + S : x[0] + S, $ = y === "Q" ? x[3] + k : x[1] + k;
|
|
542
542
|
u(
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
$ + 2 / 3 * (
|
|
548
|
-
|
|
543
|
+
at(r, s, [
|
|
544
|
+
r + 2 / 3 * (T - r),
|
|
545
|
+
s + 2 / 3 * (A - s),
|
|
546
|
+
v + 2 / 3 * (T - v),
|
|
547
|
+
$ + 2 / 3 * (A - $),
|
|
548
|
+
v,
|
|
549
549
|
$
|
|
550
550
|
])
|
|
551
|
-
),
|
|
551
|
+
), b = [T, A], r = v, s = $;
|
|
552
552
|
break;
|
|
553
553
|
}
|
|
554
554
|
case "A": {
|
|
555
|
-
const T =
|
|
556
|
-
let
|
|
557
|
-
for (const
|
|
558
|
-
u(
|
|
559
|
-
|
|
555
|
+
const T = x[5] + S, A = x[6] + k;
|
|
556
|
+
let v = r, $ = s;
|
|
557
|
+
for (const I of kn(r, s, x[0], x[1], x[2], x[3], x[4], T, A))
|
|
558
|
+
u(at(v, $, I)), v = I[4], $ = I[5];
|
|
559
|
+
r = T, s = A;
|
|
560
560
|
break;
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
i =
|
|
563
|
+
i = P, c = b;
|
|
564
564
|
}
|
|
565
565
|
}
|
|
566
|
-
const
|
|
567
|
-
for (let
|
|
568
|
-
const
|
|
569
|
-
let
|
|
570
|
-
for (;
|
|
571
|
-
const
|
|
572
|
-
|
|
566
|
+
const d = n.reduce((m, M) => m + M.length, 0), f = [];
|
|
567
|
+
for (let m = 0; m < n.length; ) {
|
|
568
|
+
const M = n[m].subpath;
|
|
569
|
+
let y = m, p = 0;
|
|
570
|
+
for (; y < n.length && n[y].subpath === M; ) p += n[y++].length;
|
|
571
|
+
const _ = n[m], w = n[y - 1], x = l.has(M) || Math.abs(w.endX - _.startX) < 1e-9 && Math.abs(w.endY - _.startY) < 1e-9;
|
|
572
|
+
f.push({ start: m, end: y, length: p, closed: x }), m = y;
|
|
573
573
|
}
|
|
574
|
-
const
|
|
575
|
-
return
|
|
574
|
+
const g = { segments: n, totalLength: d, subpaths: f };
|
|
575
|
+
return q.size >= xn && q.delete(q.keys().next().value), q.set(t, g), g;
|
|
576
576
|
}
|
|
577
|
-
function
|
|
577
|
+
function An(t, e) {
|
|
578
578
|
const n = t.lengths;
|
|
579
579
|
if (e <= 0) return 0;
|
|
580
580
|
if (e >= t.length) return 1;
|
|
581
|
-
let
|
|
582
|
-
for (;
|
|
583
|
-
const i =
|
|
584
|
-
n[i] < e ?
|
|
581
|
+
let r = 0, s = n.length - 1;
|
|
582
|
+
for (; r < s - 1; ) {
|
|
583
|
+
const i = r + s >> 1;
|
|
584
|
+
n[i] < e ? r = i : s = i;
|
|
585
585
|
}
|
|
586
|
-
const o = n[
|
|
587
|
-
return (
|
|
586
|
+
const o = n[s] - n[r], a = o > 0 ? (e - n[r]) / o : 0;
|
|
587
|
+
return (r + a) / (n.length - 1);
|
|
588
588
|
}
|
|
589
|
-
function
|
|
589
|
+
function Sn(t, e) {
|
|
590
590
|
if (t.type === "L") {
|
|
591
591
|
const u = t.length > 0 ? Math.max(0, Math.min(1, e / t.length)) : 0;
|
|
592
592
|
return {
|
|
@@ -595,396 +595,396 @@ function pn(t, e) {
|
|
|
595
595
|
angle: Math.atan2(t.endY - t.startY, t.endX - t.startX) * 180 / Math.PI
|
|
596
596
|
};
|
|
597
597
|
}
|
|
598
|
-
const [n,
|
|
599
|
-
let
|
|
600
|
-
if (Math.hypot(
|
|
601
|
-
const u = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3),
|
|
602
|
-
|
|
598
|
+
const [n, r, s, o, a, i] = t.points, c = An(t, e);
|
|
599
|
+
let h = qt(t.startX, n, s, a, c), l = qt(t.startY, r, o, i, c);
|
|
600
|
+
if (Math.hypot(h, l) < 1e-9) {
|
|
601
|
+
const u = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), d = Y(t.startX, n, s, a, u), f = Y(t.startY, r, o, i, u), g = Y(t.startX, n, s, a, c), m = Y(t.startY, r, o, i, c);
|
|
602
|
+
h = c < 0.5 ? d - g : g - d, l = c < 0.5 ? f - m : m - f;
|
|
603
603
|
}
|
|
604
604
|
return {
|
|
605
|
-
x: Y(t.startX, n,
|
|
606
|
-
y: Y(t.startY,
|
|
607
|
-
angle: Math.atan2(
|
|
605
|
+
x: Y(t.startX, n, s, a, c),
|
|
606
|
+
y: Y(t.startY, r, o, i, c),
|
|
607
|
+
angle: Math.atan2(l, h) * 180 / Math.PI
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
if (
|
|
612
|
-
let
|
|
613
|
-
for (let o = n; o <
|
|
610
|
+
function ye(t, e, n = 0, r = t.length) {
|
|
611
|
+
if (r <= n) return { x: 0, y: 0, angle: 0 };
|
|
612
|
+
let s = 0;
|
|
613
|
+
for (let o = n; o < r; o++) {
|
|
614
614
|
const a = t[o];
|
|
615
|
-
if (
|
|
616
|
-
return
|
|
617
|
-
|
|
615
|
+
if (s + a.length >= e || o === r - 1)
|
|
616
|
+
return Sn(a, e - s);
|
|
617
|
+
s += a.length;
|
|
618
618
|
}
|
|
619
619
|
return { x: 0, y: 0, angle: 0 };
|
|
620
620
|
}
|
|
621
|
-
function
|
|
622
|
-
const { segments: n, totalLength:
|
|
623
|
-
return
|
|
621
|
+
function vn(t, e) {
|
|
622
|
+
const { segments: n, totalLength: r } = Q(t);
|
|
623
|
+
return ye(n, Math.max(0, Math.min(1, e)) * r);
|
|
624
624
|
}
|
|
625
|
-
function
|
|
626
|
-
|
|
625
|
+
function os() {
|
|
626
|
+
q.clear();
|
|
627
627
|
}
|
|
628
|
-
function
|
|
629
|
-
return
|
|
628
|
+
function as(t) {
|
|
629
|
+
return Q(t).totalLength;
|
|
630
630
|
}
|
|
631
|
-
const
|
|
632
|
-
let
|
|
633
|
-
const
|
|
634
|
-
function
|
|
635
|
-
const { segments: n, subpaths:
|
|
631
|
+
const Pn = 24, In = 320, $n = 2.5, tt = 72, is = 64, Rn = 0.2, Cn = 128, nt = /* @__PURE__ */ new Map();
|
|
632
|
+
let it = 0, X;
|
|
633
|
+
const Wt = (t) => Math.round(t * 100) / 100;
|
|
634
|
+
function Qt(t, e) {
|
|
635
|
+
const { segments: n, subpaths: r, totalLength: s } = Q(t);
|
|
636
636
|
if (n.length === 0) return [];
|
|
637
637
|
if (e) {
|
|
638
|
-
const o =
|
|
639
|
-
return [{ segments: n, start: 0, end: n.length, length:
|
|
638
|
+
const o = r.every((a) => a.closed);
|
|
639
|
+
return [{ segments: n, start: 0, end: n.length, length: s, closed: o }];
|
|
640
640
|
}
|
|
641
|
-
return
|
|
641
|
+
return r.filter((o) => o.length > 0).map((o) => ({ segments: n, start: o.start, end: o.end, length: o.length, closed: o.closed }));
|
|
642
642
|
}
|
|
643
|
-
function
|
|
644
|
-
const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)),
|
|
645
|
-
return [
|
|
643
|
+
function It(t, e) {
|
|
644
|
+
const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)), r = ye(t.segments, n * t.length, t.start, t.end);
|
|
645
|
+
return [r.x, r.y];
|
|
646
646
|
}
|
|
647
|
-
function
|
|
647
|
+
function Gt(t) {
|
|
648
648
|
const e = [];
|
|
649
649
|
let n = 0;
|
|
650
|
-
for (let
|
|
651
|
-
n += t.segments[
|
|
650
|
+
for (let r = t.start; r < t.end; r++)
|
|
651
|
+
n += t.segments[r].length, t.length > 0 && e.push(n / t.length);
|
|
652
652
|
return e;
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function Kt(t, e) {
|
|
655
655
|
const n = [];
|
|
656
|
-
for (let
|
|
657
|
-
n.push(
|
|
656
|
+
for (let r = 0; r < e; r++)
|
|
657
|
+
n.push(It(t, t.closed ? r / e : r / (e - 1)));
|
|
658
658
|
return n;
|
|
659
659
|
}
|
|
660
|
-
function
|
|
660
|
+
function Zt(t) {
|
|
661
661
|
let e = 0, n = 0;
|
|
662
|
-
for (const [
|
|
663
|
-
e +=
|
|
664
|
-
return e /= t.length, n /= t.length, t.map(([
|
|
662
|
+
for (const [r, s] of t)
|
|
663
|
+
e += r, n += s;
|
|
664
|
+
return e /= t.length, n /= t.length, t.map(([r, s]) => [r - e, s - n]);
|
|
665
665
|
}
|
|
666
|
-
function
|
|
667
|
-
const
|
|
666
|
+
function En(t, e, n) {
|
|
667
|
+
const r = t.closed && e.closed;
|
|
668
668
|
if (n !== void 0)
|
|
669
|
-
return { offset:
|
|
670
|
-
const
|
|
669
|
+
return { offset: r ? Math.abs(n) % tt / tt : 0, reversed: n < 0 };
|
|
670
|
+
const s = Zt(Kt(t, tt)), o = Zt(Kt(e, tt)), a = tt;
|
|
671
671
|
let i = { offset: 0, reversed: !1 }, c = 1 / 0;
|
|
672
|
-
for (const
|
|
673
|
-
const
|
|
674
|
-
for (let u = 0; u <
|
|
675
|
-
let
|
|
676
|
-
for (let
|
|
677
|
-
const
|
|
678
|
-
|
|
672
|
+
for (const h of [!1, !0]) {
|
|
673
|
+
const l = r ? a : 1;
|
|
674
|
+
for (let u = 0; u < l; u++) {
|
|
675
|
+
let d = 0;
|
|
676
|
+
for (let f = 0; f < a && d < c; f++) {
|
|
677
|
+
const g = r ? h ? (u - f + a) % a : (f + u) % a : h ? a - 1 - f : f, m = s[f][0] - o[g][0], M = s[f][1] - o[g][1];
|
|
678
|
+
d += m * m + M * M;
|
|
679
679
|
}
|
|
680
|
-
|
|
680
|
+
d < c && (c = d, i = { offset: r ? u / a : 0, reversed: h });
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
683
|
return i;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function Dn(t, e, n) {
|
|
686
686
|
return n ? ((e.reversed ? e.offset - t : t + e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
688
|
+
function Ln(t, e, n) {
|
|
689
689
|
return n ? ((e.reversed ? e.offset - t : t - e.offset) % 1 + 1) % 1 : e.reversed ? 1 - t : t;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
Math.min(
|
|
691
|
+
function Fn(t, e, n) {
|
|
692
|
+
const r = t.closed && e.closed, s = En(t, e, n.shapeIndex), o = Math.max(
|
|
693
|
+
Pn,
|
|
694
|
+
Math.min(In, Math.ceil(Math.max(t.length, e.length) / $n))
|
|
695
695
|
), a = /* @__PURE__ */ new Set(), i = (u) => a.add(Math.round(u * 1e7) / 1e7);
|
|
696
696
|
for (let u = 0; u <= o; u++) i(u / o);
|
|
697
|
-
for (const u of
|
|
698
|
-
for (const u of
|
|
699
|
-
let c = [...a].sort((u,
|
|
700
|
-
|
|
701
|
-
const
|
|
697
|
+
for (const u of Gt(t)) i(u);
|
|
698
|
+
for (const u of Gt(e)) i(Ln(u, s, r));
|
|
699
|
+
let c = [...a].sort((u, d) => u - d);
|
|
700
|
+
r && (c = c.filter((u) => u < 1));
|
|
701
|
+
const h = [], l = [];
|
|
702
702
|
for (const u of c)
|
|
703
|
-
|
|
704
|
-
return
|
|
703
|
+
h.push(...It(t, u)), l.push(...It(e, Dn(u, s, r)));
|
|
704
|
+
return On({ from: h, to: l, closed: r });
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function On(t) {
|
|
707
707
|
const e = t.from.length / 2;
|
|
708
708
|
if (e <= 3) return t;
|
|
709
709
|
const n = new Uint8Array(e);
|
|
710
710
|
n[0] = 1, n[e - 1] = 1;
|
|
711
|
-
const
|
|
712
|
-
for (;
|
|
713
|
-
const [a, i] =
|
|
714
|
-
let c = -1,
|
|
715
|
-
for (let
|
|
716
|
-
const u = Math.max(
|
|
717
|
-
u >
|
|
711
|
+
const r = [[0, e - 1]];
|
|
712
|
+
for (; r.length > 0; ) {
|
|
713
|
+
const [a, i] = r.pop();
|
|
714
|
+
let c = -1, h = Rn;
|
|
715
|
+
for (let l = a + 1; l < i; l++) {
|
|
716
|
+
const u = Math.max(Jt(t.from, a, i, l), Jt(t.to, a, i, l));
|
|
717
|
+
u > h && (h = u, c = l);
|
|
718
718
|
}
|
|
719
|
-
c !== -1 && (n[c] = 1,
|
|
719
|
+
c !== -1 && (n[c] = 1, r.push([a, c], [c, i]));
|
|
720
720
|
}
|
|
721
|
-
const
|
|
721
|
+
const s = [], o = [];
|
|
722
722
|
for (let a = 0; a < e; a++)
|
|
723
|
-
n[a] && (
|
|
724
|
-
return { from:
|
|
723
|
+
n[a] && (s.push(t.from[a * 2], t.from[a * 2 + 1]), o.push(t.to[a * 2], t.to[a * 2 + 1]));
|
|
724
|
+
return { from: s, to: o, closed: t.closed };
|
|
725
725
|
}
|
|
726
|
-
function
|
|
727
|
-
const
|
|
728
|
-
return Math.hypot(c - u * a,
|
|
726
|
+
function Jt(t, e, n, r) {
|
|
727
|
+
const s = t[e * 2], o = t[e * 2 + 1], a = t[n * 2] - s, i = t[n * 2 + 1] - o, c = t[r * 2] - s, h = t[r * 2 + 1] - o, l = a * a + i * i, u = l === 0 ? 0 : Math.max(0, Math.min(1, (c * a + h * i) / l));
|
|
728
|
+
return Math.hypot(c - u * a, h - u * i);
|
|
729
729
|
}
|
|
730
|
-
function
|
|
731
|
-
const
|
|
732
|
-
if (X && X.from === t && X.to === e && X.shapeIndex ===
|
|
733
|
-
const o =
|
|
730
|
+
function Nn(t, e, n) {
|
|
731
|
+
const r = n.shapeIndex;
|
|
732
|
+
if (X && X.from === t && X.to === e && X.shapeIndex === r) return X.plan;
|
|
733
|
+
const o = nt.get(String(r ?? "auto"))?.get(t)?.get(e);
|
|
734
734
|
if (o)
|
|
735
|
-
return X = { from: t, to: e, shapeIndex:
|
|
736
|
-
const a =
|
|
737
|
-
pairs: i.map((
|
|
735
|
+
return X = { from: t, to: e, shapeIndex: r, plan: o }, o;
|
|
736
|
+
const a = Q(t).subpaths.filter((f) => f.length > 0).length === Q(e).subpaths.filter((f) => f.length > 0).length, i = Qt(t, !a), c = Qt(e, !a), h = {
|
|
737
|
+
pairs: i.map((f, g) => Fn(f, c[g], n))
|
|
738
738
|
};
|
|
739
|
-
|
|
740
|
-
const
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
return u.set(t,
|
|
739
|
+
it >= Cn && (nt.clear(), it = 0);
|
|
740
|
+
const l = String(r ?? "auto"), u = nt.get(l) ?? /* @__PURE__ */ new Map();
|
|
741
|
+
nt.set(l, u);
|
|
742
|
+
const d = u.get(t) ?? /* @__PURE__ */ new Map();
|
|
743
|
+
return u.set(t, d), d.set(e, h), it++, X = { from: t, to: e, shapeIndex: r, plan: h }, h;
|
|
744
744
|
}
|
|
745
|
-
function
|
|
745
|
+
function Xn(t, e, n, r = {}) {
|
|
746
746
|
if (!t) return e;
|
|
747
747
|
if (!e) return t;
|
|
748
|
-
const
|
|
749
|
-
if (
|
|
750
|
-
if (
|
|
751
|
-
const o =
|
|
752
|
-
if (o.pairs.length === 0) return
|
|
748
|
+
const s = Math.max(0, Math.min(1, n));
|
|
749
|
+
if (s === 0) return t;
|
|
750
|
+
if (s === 1) return e;
|
|
751
|
+
const o = Nn(t, e, r);
|
|
752
|
+
if (o.pairs.length === 0) return s < 0.5 ? t : e;
|
|
753
753
|
let a = "";
|
|
754
754
|
for (const i of o.pairs) {
|
|
755
755
|
for (let c = 0; c < i.from.length; c += 2) {
|
|
756
|
-
const
|
|
757
|
-
a += `${c === 0 ? a ? " M" : "M" : " L"}${
|
|
756
|
+
const h = Wt(i.from[c] + (i.to[c] - i.from[c]) * s), l = Wt(i.from[c + 1] + (i.to[c + 1] - i.from[c + 1]) * s);
|
|
757
|
+
a += `${c === 0 ? a ? " M" : "M" : " L"}${h} ${l}`;
|
|
758
758
|
}
|
|
759
759
|
i.closed && (a += " Z");
|
|
760
760
|
}
|
|
761
761
|
return a;
|
|
762
762
|
}
|
|
763
|
-
function
|
|
764
|
-
|
|
763
|
+
function cs() {
|
|
764
|
+
nt.clear(), it = 0, X = void 0;
|
|
765
765
|
}
|
|
766
|
-
function
|
|
766
|
+
function Yn(t) {
|
|
767
767
|
return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(t);
|
|
768
768
|
}
|
|
769
|
-
const
|
|
770
|
-
function
|
|
769
|
+
const W = Math.PI / 180, zn = 0.9995;
|
|
770
|
+
function Ft() {
|
|
771
771
|
return [0, 0, 0, 1];
|
|
772
772
|
}
|
|
773
|
-
function
|
|
773
|
+
function ct(t, e) {
|
|
774
774
|
const n = Math.hypot(t[0], t[1], t[2]);
|
|
775
|
-
if (n === 0) return
|
|
776
|
-
const
|
|
777
|
-
return [t[0] *
|
|
775
|
+
if (n === 0) return Ft();
|
|
776
|
+
const r = e * W / 2, s = Math.sin(r) / n;
|
|
777
|
+
return [t[0] * s, t[1] * s, t[2] * s, Math.cos(r)];
|
|
778
778
|
}
|
|
779
|
-
function
|
|
780
|
-
return
|
|
779
|
+
function jn(t, e, n) {
|
|
780
|
+
return $t($t(ct([0, 1, 0], e), ct([1, 0, 0], t)), ct([0, 0, 1], n));
|
|
781
781
|
}
|
|
782
|
-
function
|
|
783
|
-
const [e, n,
|
|
784
|
-
return Math.abs(c) < 0.9999999 ? [
|
|
782
|
+
function Un(t) {
|
|
783
|
+
const [e, n, r, s] = z(t), o = 2 * (e * r + n * s), a = 2 * (e * n + r * s), i = 1 - 2 * (e * e + r * r), c = 2 * (n * r - e * s), h = 1 - 2 * (n * n + r * r), l = 2 * (e * r - n * s), u = 1 - 2 * (e * e + n * n), d = Math.asin(Math.max(-1, Math.min(1, -c)));
|
|
784
|
+
return Math.abs(c) < 0.9999999 ? [d / W, Math.atan2(o, u) / W, Math.atan2(a, i) / W] : [d / W, Math.atan2(-l, h) / W, 0];
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
const [n,
|
|
786
|
+
function $t(t, e) {
|
|
787
|
+
const [n, r, s, o] = t, [a, i, c, h] = e;
|
|
788
788
|
return [
|
|
789
|
-
o * a + n *
|
|
790
|
-
o * i - n * c +
|
|
791
|
-
o * c + n * i -
|
|
792
|
-
o *
|
|
789
|
+
o * a + n * h + r * c - s * i,
|
|
790
|
+
o * i - n * c + r * h + s * a,
|
|
791
|
+
o * c + n * i - r * a + s * h,
|
|
792
|
+
o * h - n * a - r * i - s * c
|
|
793
793
|
];
|
|
794
794
|
}
|
|
795
|
-
function
|
|
795
|
+
function Me(t, e) {
|
|
796
796
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2] + t[3] * e[3];
|
|
797
797
|
}
|
|
798
|
-
function
|
|
798
|
+
function xe(t) {
|
|
799
799
|
return Math.hypot(t[0], t[1], t[2], t[3]);
|
|
800
800
|
}
|
|
801
801
|
function z(t) {
|
|
802
|
-
const e =
|
|
803
|
-
return e === 0 ?
|
|
802
|
+
const e = xe(t);
|
|
803
|
+
return e === 0 ? Ft() : [t[0] / e, t[1] / e, t[2] / e, t[3] / e];
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function Vn(t) {
|
|
806
806
|
return [-t[0], -t[1], -t[2], t[3]];
|
|
807
807
|
}
|
|
808
|
-
function
|
|
809
|
-
const
|
|
810
|
-
let
|
|
811
|
-
if (o < 0 && (
|
|
808
|
+
function _e(t, e, n) {
|
|
809
|
+
const r = z(t);
|
|
810
|
+
let s = z(e), o = Me(r, s);
|
|
811
|
+
if (o < 0 && (s = [-s[0], -s[1], -s[2], -s[3]], o = -o), o > zn)
|
|
812
812
|
return z([
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
813
|
+
r[0] + (s[0] - r[0]) * n,
|
|
814
|
+
r[1] + (s[1] - r[1]) * n,
|
|
815
|
+
r[2] + (s[2] - r[2]) * n,
|
|
816
|
+
r[3] + (s[3] - r[3]) * n
|
|
817
817
|
]);
|
|
818
|
-
const a = Math.acos(o), i = Math.sin(a), c = Math.sin((1 - n) * a) / i,
|
|
818
|
+
const a = Math.acos(o), i = Math.sin(a), c = Math.sin((1 - n) * a) / i, h = Math.sin(n * a) / i;
|
|
819
819
|
return z([
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
820
|
+
r[0] * c + s[0] * h,
|
|
821
|
+
r[1] * c + s[1] * h,
|
|
822
|
+
r[2] * c + s[2] * h,
|
|
823
|
+
r[3] * c + s[3] * h
|
|
824
824
|
]);
|
|
825
825
|
}
|
|
826
|
-
function
|
|
827
|
-
const [n,
|
|
828
|
-
return [e[0] + o * a + (
|
|
826
|
+
function Bn(t, e) {
|
|
827
|
+
const [n, r, s, o] = z(t), a = 2 * (r * e[2] - s * e[1]), i = 2 * (s * e[0] - n * e[2]), c = 2 * (n * e[1] - r * e[0]);
|
|
828
|
+
return [e[0] + o * a + (r * c - s * i), e[1] + o * i + (s * a - n * c), e[2] + o * c + (n * i - r * a)];
|
|
829
829
|
}
|
|
830
|
-
const
|
|
830
|
+
const us = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
831
831
|
__proto__: null,
|
|
832
|
-
conjugate:
|
|
833
|
-
dot:
|
|
834
|
-
fromAxisAngle:
|
|
835
|
-
fromEuler:
|
|
836
|
-
identity:
|
|
837
|
-
length:
|
|
838
|
-
multiply:
|
|
832
|
+
conjugate: Vn,
|
|
833
|
+
dot: Me,
|
|
834
|
+
fromAxisAngle: ct,
|
|
835
|
+
fromEuler: jn,
|
|
836
|
+
identity: Ft,
|
|
837
|
+
length: xe,
|
|
838
|
+
multiply: $t,
|
|
839
839
|
normalize: z,
|
|
840
|
-
rotateVec3:
|
|
841
|
-
slerp:
|
|
842
|
-
toEuler:
|
|
843
|
-
}, Symbol.toStringTag, { value: "Module" })), N = (t, e, n) => t + (e - t) * n,
|
|
844
|
-
function
|
|
845
|
-
const e =
|
|
840
|
+
rotateVec3: Bn,
|
|
841
|
+
slerp: _e,
|
|
842
|
+
toEuler: Un
|
|
843
|
+
}, Symbol.toStringTag, { value: "Module" })), N = (t, e, n) => t + (e - t) * n, be = 512, bt = /* @__PURE__ */ new Map(), Tt = /* @__PURE__ */ new Map();
|
|
844
|
+
function te(t) {
|
|
845
|
+
const e = bt.get(t);
|
|
846
846
|
if (e) return e;
|
|
847
|
-
const n = t.replace("#", ""),
|
|
847
|
+
const n = t.replace("#", ""), r = [
|
|
848
848
|
parseInt(n.slice(0, 2), 16),
|
|
849
849
|
parseInt(n.slice(2, 4), 16),
|
|
850
850
|
parseInt(n.slice(4, 6), 16)
|
|
851
851
|
];
|
|
852
|
-
return
|
|
852
|
+
return bt.size < be && bt.set(t, r), r;
|
|
853
853
|
}
|
|
854
|
-
const
|
|
855
|
-
function
|
|
856
|
-
return `#${
|
|
854
|
+
const ee = (t) => t.charCodeAt(0) === 35, ne = (t) => t.startsWith("rgb"), re = (t) => t.startsWith("rgba"), Hn = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, wt = (t) => Math.round(t).toString(16).padStart(2, "0");
|
|
855
|
+
function qn(t, e, n) {
|
|
856
|
+
return `#${wt(t)}${wt(e)}${wt(n)}`;
|
|
857
857
|
}
|
|
858
|
-
function
|
|
859
|
-
const e =
|
|
858
|
+
function se(t) {
|
|
859
|
+
const e = Tt.get(t);
|
|
860
860
|
if (e) return e;
|
|
861
|
-
const n = t.match(
|
|
861
|
+
const n = t.match(Hn);
|
|
862
862
|
if (!n)
|
|
863
863
|
throw new Error(`Invalid rgb color: ${t}`);
|
|
864
|
-
const
|
|
865
|
-
return
|
|
866
|
-
}
|
|
867
|
-
const
|
|
868
|
-
if (
|
|
869
|
-
const [
|
|
870
|
-
return
|
|
871
|
-
}
|
|
872
|
-
if ((
|
|
873
|
-
const
|
|
874
|
-
if (
|
|
875
|
-
const c =
|
|
876
|
-
return `rgba(${o}, ${a}, ${i}, ${
|
|
864
|
+
const r = parseInt(n[1], 10), s = parseInt(n[2], 10), o = parseInt(n[3], 10), a = n[4] !== void 0 ? [r, s, o, parseFloat(n[4])] : [r, s, o];
|
|
865
|
+
return Tt.size < be && Tt.set(t, a), a;
|
|
866
|
+
}
|
|
867
|
+
const Wn = (t, e, n) => {
|
|
868
|
+
if (ee(t) && ee(e)) {
|
|
869
|
+
const [r, s, o] = te(t), [a, i, c] = te(e), h = N(r, a, n), l = N(s, i, n), u = N(o, c, n);
|
|
870
|
+
return qn(h, l, u);
|
|
871
|
+
}
|
|
872
|
+
if ((ne(t) || re(t)) && (ne(e) || re(e))) {
|
|
873
|
+
const r = se(t), s = se(e), o = Math.round(N(r[0], s[0], n)), a = Math.round(N(r[1], s[1], n)), i = Math.round(N(r[2], s[2], n));
|
|
874
|
+
if (r.length === 4 || s.length === 4) {
|
|
875
|
+
const c = r[3] ?? 1, h = s[3] ?? 1, l = N(c, h, n);
|
|
876
|
+
return `rgba(${o}, ${a}, ${i}, ${l})`;
|
|
877
877
|
}
|
|
878
878
|
return `rgb(${o}, ${a}, ${i})`;
|
|
879
879
|
}
|
|
880
880
|
return n < 1 ? t : e;
|
|
881
|
-
},
|
|
882
|
-
const
|
|
883
|
-
for (let o = 0; o <
|
|
884
|
-
|
|
885
|
-
return
|
|
886
|
-
},
|
|
887
|
-
function
|
|
888
|
-
return e === "slerp" ?
|
|
881
|
+
}, Qn = (t, e, n) => {
|
|
882
|
+
const r = Math.min(t.length, e.length), s = [];
|
|
883
|
+
for (let o = 0; o < r; o++)
|
|
884
|
+
s.push(N(t[o], e[o], n));
|
|
885
|
+
return s;
|
|
886
|
+
}, Gn = (t, e, n) => _e(t, e, n), oe = (t, e, n) => n < 1 ? t : e, Kn = (t, e, n) => Xn(t, e, n);
|
|
887
|
+
function Te(t, e) {
|
|
888
|
+
return e === "slerp" ? Gn : typeof t == "number" ? N : Array.isArray(t) ? Qn : typeof t == "string" ? t.startsWith("#") || t.startsWith("rgb") ? Wn : Yn(t) ? Kn : oe : oe;
|
|
889
889
|
}
|
|
890
|
-
const
|
|
891
|
-
function
|
|
890
|
+
const we = 1e3 / 60;
|
|
891
|
+
function ke(t, e = {}) {
|
|
892
892
|
if (!V(t))
|
|
893
893
|
throw new Error(`bakeSpringTrack: track "${t.id}" is not a spring track`);
|
|
894
|
-
const n = new
|
|
895
|
-
return
|
|
894
|
+
const n = new lt(t.spring);
|
|
895
|
+
return Se(t, (r) => n.valueAt(r), n.settleTime(), t.spring.from, t.spring.to, e);
|
|
896
896
|
}
|
|
897
|
-
function
|
|
898
|
-
if (!
|
|
897
|
+
function Ae(t, e = {}) {
|
|
898
|
+
if (!U(t))
|
|
899
899
|
throw new Error(`bakeInertiaTrack: track "${t.id}" is not an inertia track`);
|
|
900
900
|
const n = t.inertia;
|
|
901
|
-
return
|
|
901
|
+
return Se(
|
|
902
902
|
t,
|
|
903
|
-
(
|
|
904
|
-
|
|
903
|
+
(r) => vt(n, r),
|
|
904
|
+
mt(n),
|
|
905
905
|
n.from,
|
|
906
|
-
|
|
906
|
+
dt(n),
|
|
907
907
|
e
|
|
908
908
|
);
|
|
909
909
|
}
|
|
910
|
-
function
|
|
911
|
-
const a = o.intervalMs ??
|
|
910
|
+
function Se(t, e, n, r, s, o) {
|
|
911
|
+
const a = o.intervalMs ?? we, i = o.tolerance ?? 0.01, c = t.delay ?? 0, h = [];
|
|
912
912
|
for (let u = 0; u <= n; u += a)
|
|
913
|
-
|
|
914
|
-
const
|
|
915
|
-
return !
|
|
913
|
+
h.push({ time: u + c, value: e(u), easing: "linear" });
|
|
914
|
+
const l = h[h.length - 1];
|
|
915
|
+
return !l || l.time < n + c ? h.push({ time: n + c, value: s, easing: "linear" }) : l.value = s, c > 0 && h.unshift({ time: 0, value: r, easing: "linear" }), {
|
|
916
916
|
id: t.id,
|
|
917
917
|
target: t.target,
|
|
918
918
|
property: t.property,
|
|
919
|
-
keyframes: i > 0 ?
|
|
919
|
+
keyframes: i > 0 ? tr(h, i) : h,
|
|
920
920
|
...t.targets && { targets: [...t.targets] },
|
|
921
921
|
...t.stagger && { stagger: { ...t.stagger } }
|
|
922
922
|
};
|
|
923
923
|
}
|
|
924
|
-
function
|
|
925
|
-
const
|
|
924
|
+
function Zn(t, e, n, r = {}) {
|
|
925
|
+
const s = r.intervalMs ?? we, o = typeof n == "function" ? n : Lt(n), a = Te(t.value, r.interpolation), i = e.time - t.time;
|
|
926
926
|
if (i <= 0) return [e];
|
|
927
927
|
const c = [];
|
|
928
|
-
for (let
|
|
929
|
-
const u =
|
|
928
|
+
for (let l = s; l < i; l += s) {
|
|
929
|
+
const u = l / i;
|
|
930
930
|
c.push({
|
|
931
|
-
time: t.time +
|
|
931
|
+
time: t.time + l,
|
|
932
932
|
value: a(t.value, e.value, o(u)),
|
|
933
933
|
easing: "linear"
|
|
934
934
|
});
|
|
935
935
|
}
|
|
936
|
-
const
|
|
937
|
-
return c.push({ ...e, ...
|
|
936
|
+
const h = o(1);
|
|
937
|
+
return c.push({ ...e, ...h !== 1 && { value: a(t.value, e.value, h) }, easing: "linear" }), c;
|
|
938
938
|
}
|
|
939
|
-
function
|
|
940
|
-
return V(t) ?
|
|
939
|
+
function hs(t, e) {
|
|
940
|
+
return V(t) ? ke(t, e) : U(t) ? Ae(t, e) : t;
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function Jn(t, e = {}) {
|
|
943
943
|
const n = t.keyframes;
|
|
944
|
-
if (!n.some((o) =>
|
|
945
|
-
const
|
|
944
|
+
if (!n.some((o) => St(o.easing))) return t;
|
|
945
|
+
const r = n.length > 0 ? [n[0]] : [], s = { ...e, interpolation: t.interpolation ?? e.interpolation };
|
|
946
946
|
for (let o = 1; o < n.length; o++) {
|
|
947
947
|
const a = n[o];
|
|
948
|
-
|
|
948
|
+
St(a.easing) ? r.push(...Zn(n[o - 1], a, a.easing, s)) : r.push(a);
|
|
949
949
|
}
|
|
950
|
-
return { ...t, keyframes:
|
|
950
|
+
return { ...t, keyframes: r };
|
|
951
951
|
}
|
|
952
|
-
function
|
|
953
|
-
return t.filter(
|
|
954
|
-
t.filter(V).map((n) =>
|
|
955
|
-
t.filter(
|
|
952
|
+
function ls(t, e) {
|
|
953
|
+
return t.filter(Ge).map((n) => Jn(n, e)).concat(
|
|
954
|
+
t.filter(V).map((n) => ke(n, e)),
|
|
955
|
+
t.filter(U).map((n) => Ae(n, e))
|
|
956
956
|
);
|
|
957
957
|
}
|
|
958
|
-
function
|
|
958
|
+
function tr(t, e) {
|
|
959
959
|
if (t.length <= 2) return t;
|
|
960
960
|
const n = [t[0]];
|
|
961
|
-
for (let
|
|
962
|
-
const
|
|
961
|
+
for (let r = 1; r < t.length - 1; r++) {
|
|
962
|
+
const s = n[n.length - 1], o = t[r], a = t[r + 1], i = a.time - s.time;
|
|
963
963
|
if (i <= 0) continue;
|
|
964
|
-
const c = (o.time -
|
|
965
|
-
Math.abs(o.value -
|
|
964
|
+
const c = (o.time - s.time) / i, h = s.value + (a.value - s.value) * c;
|
|
965
|
+
Math.abs(o.value - h) > e && n.push(o);
|
|
966
966
|
}
|
|
967
967
|
return n.push(t[t.length - 1]), n;
|
|
968
968
|
}
|
|
969
|
-
function
|
|
970
|
-
const e = [...t.keyframes].sort((n,
|
|
969
|
+
function er(t) {
|
|
970
|
+
const e = [...t.keyframes].sort((n, r) => n.time - r.time);
|
|
971
971
|
return {
|
|
972
972
|
...t,
|
|
973
973
|
keyframes: e
|
|
974
974
|
};
|
|
975
975
|
}
|
|
976
|
-
function
|
|
976
|
+
function j(t) {
|
|
977
977
|
return t.targets && t.targets.length > 0 ? t.targets : [t.target];
|
|
978
978
|
}
|
|
979
|
-
function
|
|
980
|
-
const
|
|
981
|
-
return !
|
|
979
|
+
function G(t, e, n, r) {
|
|
980
|
+
const s = n ?? 0;
|
|
981
|
+
return !r || e <= 1 ? s : s + fe(t, e, r);
|
|
982
982
|
}
|
|
983
|
-
class
|
|
983
|
+
class ut {
|
|
984
984
|
track;
|
|
985
985
|
targets;
|
|
986
986
|
constructor(e) {
|
|
987
|
-
this.track = e, this.targets =
|
|
987
|
+
this.track = e, this.targets = j(e);
|
|
988
988
|
}
|
|
989
989
|
/**
|
|
990
990
|
* Get the interpolated value at a specific time.
|
|
@@ -993,7 +993,7 @@ class _t {
|
|
|
993
993
|
* that need every target should use `getTargetValues`.
|
|
994
994
|
*/
|
|
995
995
|
getValueAtTime(e) {
|
|
996
|
-
return this.valueForOffset(e -
|
|
996
|
+
return this.valueForOffset(e - G(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
997
997
|
}
|
|
998
998
|
/**
|
|
999
999
|
* Every target's value at a specific time, in target order.
|
|
@@ -1002,12 +1002,12 @@ class _t {
|
|
|
1002
1002
|
* each sampled at its own offset time.
|
|
1003
1003
|
*/
|
|
1004
1004
|
getTargetValues(e) {
|
|
1005
|
-
const n = this.targets.length,
|
|
1006
|
-
for (let
|
|
1007
|
-
const o =
|
|
1008
|
-
a !== void 0 &&
|
|
1005
|
+
const n = this.targets.length, r = [];
|
|
1006
|
+
for (let s = 0; s < n; s++) {
|
|
1007
|
+
const o = G(s, n, this.track.delay, this.track.stagger), a = this.valueForOffset(e - o);
|
|
1008
|
+
a !== void 0 && r.push({ target: this.targets[s], value: a, start: o + this.track.keyframes[0].time });
|
|
1009
1009
|
}
|
|
1010
|
-
return
|
|
1010
|
+
return r;
|
|
1011
1011
|
}
|
|
1012
1012
|
/**
|
|
1013
1013
|
* Get the duration of this track — the last keyframe, plus any delay, the
|
|
@@ -1017,8 +1017,8 @@ class _t {
|
|
|
1017
1017
|
const { keyframes: e } = this.track;
|
|
1018
1018
|
if (e.length === 0)
|
|
1019
1019
|
return 0;
|
|
1020
|
-
const n = e[e.length - 1].time,
|
|
1021
|
-
return n + (this.track.delay ?? 0) +
|
|
1020
|
+
const n = e[e.length - 1].time, r = this.track.stagger ? Dt(this.targets.length, this.track.stagger) : 0;
|
|
1021
|
+
return n + (this.track.delay ?? 0) + r + (this.track.endDelay ?? 0);
|
|
1022
1022
|
}
|
|
1023
1023
|
/**
|
|
1024
1024
|
* Get the track metadata.
|
|
@@ -1035,126 +1035,126 @@ class _t {
|
|
|
1035
1035
|
return n[0].value;
|
|
1036
1036
|
if (e >= n[n.length - 1].time)
|
|
1037
1037
|
return n[n.length - 1].value;
|
|
1038
|
-
const { from:
|
|
1039
|
-
if (!
|
|
1038
|
+
const { from: r, to: s } = this.findSurroundingKeyframes(e);
|
|
1039
|
+
if (!r || !s)
|
|
1040
1040
|
return;
|
|
1041
|
-
if (
|
|
1042
|
-
return
|
|
1043
|
-
const o =
|
|
1044
|
-
return
|
|
1041
|
+
if (r.time === e)
|
|
1042
|
+
return r.value;
|
|
1043
|
+
const o = s.time - r.time, a = (e - r.time) / o, c = Lt(s.easing)(a);
|
|
1044
|
+
return Te(r.value, this.track.interpolation)(r.value, s.value, c);
|
|
1045
1045
|
}
|
|
1046
1046
|
/**
|
|
1047
1047
|
* Find the keyframes surrounding a given time.
|
|
1048
1048
|
*/
|
|
1049
1049
|
findSurroundingKeyframes(e) {
|
|
1050
1050
|
const { keyframes: n } = this.track;
|
|
1051
|
-
for (let
|
|
1052
|
-
if (e >= n[
|
|
1053
|
-
return { from: n[
|
|
1051
|
+
for (let r = 0; r < n.length - 1; r++)
|
|
1052
|
+
if (e >= n[r].time && e <= n[r + 1].time)
|
|
1053
|
+
return { from: n[r], to: n[r + 1] };
|
|
1054
1054
|
return { from: null, to: null };
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
|
-
class
|
|
1057
|
+
class nr {
|
|
1058
1058
|
track;
|
|
1059
1059
|
targets;
|
|
1060
1060
|
sampler;
|
|
1061
1061
|
constructor(e) {
|
|
1062
|
-
this.track = e, this.targets =
|
|
1062
|
+
this.track = e, this.targets = j(e), this.sampler = new lt(e.spring);
|
|
1063
1063
|
}
|
|
1064
1064
|
getValueAtTime(e) {
|
|
1065
|
-
return this.sampler.valueAt(e -
|
|
1065
|
+
return this.sampler.valueAt(e - G(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
1066
1066
|
}
|
|
1067
1067
|
getTargetValues(e) {
|
|
1068
|
-
const n = this.targets.length,
|
|
1069
|
-
for (let
|
|
1070
|
-
const o =
|
|
1071
|
-
|
|
1068
|
+
const n = this.targets.length, r = [];
|
|
1069
|
+
for (let s = 0; s < n; s++) {
|
|
1070
|
+
const o = G(s, n, this.track.delay, this.track.stagger);
|
|
1071
|
+
r.push({ target: this.targets[s], value: this.sampler.valueAt(e - o), start: o });
|
|
1072
1072
|
}
|
|
1073
|
-
return
|
|
1073
|
+
return r;
|
|
1074
1074
|
}
|
|
1075
1075
|
/** Settle time plus delay and the widest stagger offset. */
|
|
1076
1076
|
getDuration() {
|
|
1077
|
-
const e = this.track.stagger ?
|
|
1077
|
+
const e = this.track.stagger ? Dt(this.targets.length, this.track.stagger) : 0;
|
|
1078
1078
|
return this.sampler.settleTime() + (this.track.delay ?? 0) + e;
|
|
1079
1079
|
}
|
|
1080
1080
|
getTrack() {
|
|
1081
1081
|
return this.track;
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
|
-
class
|
|
1084
|
+
class rr {
|
|
1085
1085
|
track;
|
|
1086
1086
|
targets;
|
|
1087
1087
|
duration;
|
|
1088
1088
|
constructor(e) {
|
|
1089
|
-
this.track = e, this.targets =
|
|
1089
|
+
this.track = e, this.targets = j(e), this.duration = mt(e.inertia);
|
|
1090
1090
|
}
|
|
1091
1091
|
getValueAtTime(e) {
|
|
1092
|
-
return
|
|
1092
|
+
return vt(this.track.inertia, e - G(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
1093
1093
|
}
|
|
1094
1094
|
getTargetValues(e) {
|
|
1095
|
-
const n = this.targets.length,
|
|
1096
|
-
for (let
|
|
1097
|
-
const o =
|
|
1098
|
-
|
|
1095
|
+
const n = this.targets.length, r = [];
|
|
1096
|
+
for (let s = 0; s < n; s++) {
|
|
1097
|
+
const o = G(s, n, this.track.delay, this.track.stagger);
|
|
1098
|
+
r.push({ target: this.targets[s], value: vt(this.track.inertia, e - o), start: o });
|
|
1099
1099
|
}
|
|
1100
|
-
return
|
|
1100
|
+
return r;
|
|
1101
1101
|
}
|
|
1102
1102
|
/** Settle time plus delay and the widest stagger offset. */
|
|
1103
1103
|
getDuration() {
|
|
1104
|
-
const e = this.track.stagger ?
|
|
1104
|
+
const e = this.track.stagger ? Dt(this.targets.length, this.track.stagger) : 0;
|
|
1105
1105
|
return this.duration + (this.track.delay ?? 0) + e;
|
|
1106
1106
|
}
|
|
1107
1107
|
getTrack() {
|
|
1108
1108
|
return this.track;
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
function
|
|
1112
|
-
const n = { ...
|
|
1111
|
+
function ve(t, e) {
|
|
1112
|
+
const n = { ...vn(t.pathData, e) };
|
|
1113
1113
|
if (t.matrix) {
|
|
1114
|
-
const [
|
|
1115
|
-
n.x =
|
|
1116
|
-
const u = n.angle * Math.PI / 180,
|
|
1117
|
-
n.angle = Math.atan2(
|
|
1114
|
+
const [r, s, o, a, i, c] = t.matrix, { x: h, y: l } = n;
|
|
1115
|
+
n.x = r * h + o * l + i, n.y = s * h + a * l + c;
|
|
1116
|
+
const u = n.angle * Math.PI / 180, d = Math.cos(u), f = Math.sin(u);
|
|
1117
|
+
n.angle = Math.atan2(s * d + a * f, r * d + o * f) * 180 / Math.PI;
|
|
1118
1118
|
}
|
|
1119
1119
|
return t.autoRotate && t.rotateOffset && (n.angle += t.rotateOffset), n;
|
|
1120
1120
|
}
|
|
1121
|
-
function
|
|
1122
|
-
const
|
|
1123
|
-
return
|
|
1121
|
+
function fs(t, e, n, r) {
|
|
1122
|
+
const s = e + (n - e) * r;
|
|
1123
|
+
return ve(t, s);
|
|
1124
1124
|
}
|
|
1125
|
-
const
|
|
1125
|
+
const kt = {
|
|
1126
1126
|
upperCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
1127
1127
|
lowerCase: "abcdefghijklmnopqrstuvwxyz",
|
|
1128
1128
|
upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
1129
1129
|
numbers: "0123456789"
|
|
1130
|
-
},
|
|
1131
|
-
function
|
|
1132
|
-
const e =
|
|
1133
|
-
return n.length > 0 ? n : Array.from(
|
|
1134
|
-
}
|
|
1135
|
-
function
|
|
1136
|
-
let
|
|
1137
|
-
return
|
|
1138
|
-
}
|
|
1139
|
-
function
|
|
1140
|
-
const
|
|
1141
|
-
if (o <= 0) return
|
|
1142
|
-
if (o >= 1) return
|
|
1143
|
-
const a = Array.from(
|
|
1130
|
+
}, sr = 20;
|
|
1131
|
+
function or(t) {
|
|
1132
|
+
const e = kt[t ?? "upperCase"] ?? t ?? kt.upperCase, n = Array.from(e);
|
|
1133
|
+
return n.length > 0 ? n : Array.from(kt.upperCase);
|
|
1134
|
+
}
|
|
1135
|
+
function ar(t, e, n) {
|
|
1136
|
+
let r = (t | 0) ^ Math.imul(e + 1, 2654435761) ^ Math.imul(n + 1, 2246822507);
|
|
1137
|
+
return r = Math.imul(r ^ r >>> 16, 2146121005), r = Math.imul(r ^ r >>> 15, 2221713035), (r ^ r >>> 16) >>> 0;
|
|
1138
|
+
}
|
|
1139
|
+
function ir(t, e, n = 0) {
|
|
1140
|
+
const r = t.from ?? "", s = t.to, o = Math.max(0, Math.min(1, e));
|
|
1141
|
+
if (o <= 0) return r;
|
|
1142
|
+
if (o >= 1) return s;
|
|
1143
|
+
const a = Array.from(r), i = Array.from(s), c = t.rightToLeft ?? !1;
|
|
1144
1144
|
if (t.mode === "type") {
|
|
1145
|
-
const
|
|
1146
|
-
return c ? a.slice(0, Math.max(0, a.length -
|
|
1145
|
+
const p = Math.round(o * Math.max(a.length, i.length));
|
|
1146
|
+
return c ? a.slice(0, Math.max(0, a.length - p)).join("") + i.slice(Math.max(0, i.length - p)).join("") : i.slice(0, p).join("") + a.slice(p).join("");
|
|
1147
1147
|
}
|
|
1148
|
-
const
|
|
1149
|
-
let
|
|
1150
|
-
for (let
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1153
|
-
` ?
|
|
1148
|
+
const h = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), l = Math.max(0, (o - h) / (1 - h)), u = Math.floor(l * i.length), d = t.tweenLength === !1 ? i.length : Math.round(a.length + (i.length - a.length) * o), f = or(t.chars), g = t.refreshRate ?? sr, m = g > 0 ? Math.floor(n * g / 1e3) : 0, M = t.seed ?? 1;
|
|
1149
|
+
let y = "";
|
|
1150
|
+
for (let p = 0; p < d; p++) {
|
|
1151
|
+
const _ = c ? p >= d - u : p < u, w = c ? i[i.length - (d - p)] : i[p];
|
|
1152
|
+
_ && w !== void 0 || w === " " || w === `
|
|
1153
|
+
` ? y += w : y += f[ar(M, p, m) % f.length];
|
|
1154
1154
|
}
|
|
1155
|
-
return
|
|
1155
|
+
return y;
|
|
1156
1156
|
}
|
|
1157
|
-
class
|
|
1157
|
+
class Pe {
|
|
1158
1158
|
id;
|
|
1159
1159
|
name;
|
|
1160
1160
|
_captions;
|
|
@@ -1275,31 +1275,31 @@ class ke {
|
|
|
1275
1275
|
const n = this.duration;
|
|
1276
1276
|
if (n <= 0)
|
|
1277
1277
|
return;
|
|
1278
|
-
let
|
|
1278
|
+
let s = e * this.speed;
|
|
1279
1279
|
if (this._repeatDelayRemaining > 0) {
|
|
1280
|
-
const i = Math.min(this._repeatDelayRemaining,
|
|
1281
|
-
if (this._repeatDelayRemaining -= i,
|
|
1280
|
+
const i = Math.min(this._repeatDelayRemaining, s);
|
|
1281
|
+
if (this._repeatDelayRemaining -= i, s -= i, this._repeatDelayRemaining > 0) {
|
|
1282
1282
|
this.onUpdate?.(this.getStateAtTime(this._currentTime));
|
|
1283
1283
|
return;
|
|
1284
1284
|
}
|
|
1285
1285
|
this._wrapAfterDelay && (this._wrapAfterDelay = !1, this._currentTime = 0);
|
|
1286
1286
|
}
|
|
1287
1287
|
const o = 1e3;
|
|
1288
|
-
for (let i = 0; i < o &&
|
|
1288
|
+
for (let i = 0; i < o && s > 0 && this._playbackState === "playing"; i++)
|
|
1289
1289
|
if (this._direction === "forward") {
|
|
1290
1290
|
const c = n - this._currentTime;
|
|
1291
|
-
if (
|
|
1292
|
-
if (
|
|
1291
|
+
if (s >= c) {
|
|
1292
|
+
if (s -= c, this._currentTime = n, !this._handleEndReached())
|
|
1293
1293
|
break;
|
|
1294
1294
|
} else
|
|
1295
|
-
this._currentTime +=
|
|
1295
|
+
this._currentTime += s, s = 0;
|
|
1296
1296
|
} else {
|
|
1297
1297
|
const c = this._currentTime;
|
|
1298
|
-
if (
|
|
1299
|
-
if (
|
|
1298
|
+
if (s >= c) {
|
|
1299
|
+
if (s -= c, this._currentTime = 0, !this._handleStartReached())
|
|
1300
1300
|
break;
|
|
1301
1301
|
} else
|
|
1302
|
-
this._currentTime -=
|
|
1302
|
+
this._currentTime -= s, s = 0;
|
|
1303
1303
|
}
|
|
1304
1304
|
const a = this.getStateAtTime(this._currentTime);
|
|
1305
1305
|
this.onUpdate?.(a);
|
|
@@ -1309,13 +1309,13 @@ class ke {
|
|
|
1309
1309
|
*/
|
|
1310
1310
|
getStateAtTime(e) {
|
|
1311
1311
|
const n = /* @__PURE__ */ new Map();
|
|
1312
|
-
if (e =
|
|
1312
|
+
if (e = Ke(e, this._config.drawingRate ?? 0), this._hasSharedWrites())
|
|
1313
1313
|
this._resolveShared(e, n);
|
|
1314
1314
|
else
|
|
1315
|
-
for (const [
|
|
1316
|
-
const o =
|
|
1317
|
-
for (const { target: a, value: i, start: c } of
|
|
1318
|
-
this._write(n,
|
|
1315
|
+
for (const [r, s] of this._trackPlayers) {
|
|
1316
|
+
const o = s.getTrack().property;
|
|
1317
|
+
for (const { target: a, value: i, start: c } of s.getTargetValues(e))
|
|
1318
|
+
this._write(n, r, a, o, i, e - c);
|
|
1319
1319
|
}
|
|
1320
1320
|
return {
|
|
1321
1321
|
values: n,
|
|
@@ -1339,37 +1339,37 @@ class ke {
|
|
|
1339
1339
|
* turn. `findConflicts()` reports overlaps by the same rule.
|
|
1340
1340
|
*/
|
|
1341
1341
|
_resolveShared(e, n) {
|
|
1342
|
-
const
|
|
1343
|
-
for (const [
|
|
1342
|
+
const r = /* @__PURE__ */ new Map();
|
|
1343
|
+
for (const [s, o] of this._trackPlayers) {
|
|
1344
1344
|
const a = o.getTrack().property;
|
|
1345
|
-
for (const { target: i, value: c, start:
|
|
1346
|
-
const
|
|
1347
|
-
(!
|
|
1345
|
+
for (const { target: i, value: c, start: h } of o.getTargetValues(e)) {
|
|
1346
|
+
const l = `${i}\0${a}`, u = h <= e, d = r.get(l);
|
|
1347
|
+
(!d || (u !== d.started ? u : u ? h >= d.start : h <= d.start)) && r.set(l, { trackId: s, target: i, property: a, value: c, start: h, started: u });
|
|
1348
1348
|
}
|
|
1349
1349
|
}
|
|
1350
|
-
for (const { trackId:
|
|
1351
|
-
this._write(n,
|
|
1350
|
+
for (const { trackId: s, target: o, property: a, value: i, start: c } of r.values())
|
|
1351
|
+
this._write(n, s, o, a, i, e - c);
|
|
1352
1352
|
}
|
|
1353
1353
|
/**
|
|
1354
1354
|
* Write one track's value for a target, expanding the progress of motion paths
|
|
1355
1355
|
* (into x/y/rotation) and text tracks (into the string). `elapsed` is the time
|
|
1356
1356
|
* since this target's animation on the track started.
|
|
1357
1357
|
*/
|
|
1358
|
-
_write(e, n,
|
|
1358
|
+
_write(e, n, r, s, o, a) {
|
|
1359
1359
|
if (o === void 0) return;
|
|
1360
|
-
let i = e.get(
|
|
1361
|
-
i || (i = /* @__PURE__ */ new Map(), e.set(
|
|
1360
|
+
let i = e.get(r);
|
|
1361
|
+
i || (i = /* @__PURE__ */ new Map(), e.set(r, i));
|
|
1362
1362
|
const c = this._textTracks.get(n);
|
|
1363
1363
|
if (c && typeof o == "number") {
|
|
1364
|
-
i.set("text",
|
|
1364
|
+
i.set("text", ir(c.textConfig, o, Math.max(0, a)));
|
|
1365
1365
|
return;
|
|
1366
1366
|
}
|
|
1367
|
-
const
|
|
1368
|
-
if (
|
|
1369
|
-
const
|
|
1370
|
-
i.set("motionPathX",
|
|
1367
|
+
const h = this._motionPathTracks.get(n);
|
|
1368
|
+
if (h && typeof o == "number") {
|
|
1369
|
+
const l = ve(h.motionPathConfig, o);
|
|
1370
|
+
i.set("motionPathX", l.x), i.set("motionPathY", l.y), h.motionPathConfig.autoRotate && i.set("motionPathRotate", l.angle);
|
|
1371
1371
|
} else
|
|
1372
|
-
i.set(
|
|
1372
|
+
i.set(s, o);
|
|
1373
1373
|
}
|
|
1374
1374
|
/** Cached: does any target+property have more than one track? */
|
|
1375
1375
|
_sharedWrites = null;
|
|
@@ -1378,13 +1378,13 @@ class ke {
|
|
|
1378
1378
|
const e = /* @__PURE__ */ new Set();
|
|
1379
1379
|
this._sharedWrites = !1;
|
|
1380
1380
|
t: for (const n of this._tracks)
|
|
1381
|
-
for (const
|
|
1382
|
-
const
|
|
1383
|
-
if (e.has(
|
|
1381
|
+
for (const r of j(n)) {
|
|
1382
|
+
const s = `${r}\0${n.property}`;
|
|
1383
|
+
if (e.has(s)) {
|
|
1384
1384
|
this._sharedWrites = !0;
|
|
1385
1385
|
break t;
|
|
1386
1386
|
}
|
|
1387
|
-
e.add(
|
|
1387
|
+
e.add(s);
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
1390
|
return this._sharedWrites;
|
|
@@ -1393,17 +1393,17 @@ class ke {
|
|
|
1393
1393
|
* Add a track to the timeline.
|
|
1394
1394
|
*/
|
|
1395
1395
|
addTrack(e) {
|
|
1396
|
-
if (this._tracks.push(e), this._sharedWrites = null,
|
|
1397
|
-
this._trackPlayers.set(e.id, new
|
|
1396
|
+
if (this._tracks.push(e), this._sharedWrites = null, U(e)) {
|
|
1397
|
+
this._trackPlayers.set(e.id, new rr(e));
|
|
1398
1398
|
return;
|
|
1399
1399
|
}
|
|
1400
1400
|
if (V(e)) {
|
|
1401
|
-
this._trackPlayers.set(e.id, new
|
|
1401
|
+
this._trackPlayers.set(e.id, new nr(e)), this._springTracks.set(e.id, e);
|
|
1402
1402
|
return;
|
|
1403
1403
|
}
|
|
1404
|
-
if (
|
|
1405
|
-
this._trackPlayers.set(e.id, new
|
|
1406
|
-
else if (
|
|
1404
|
+
if (Et(e))
|
|
1405
|
+
this._trackPlayers.set(e.id, new ut(e)), this._textTracks.set(e.id, e);
|
|
1406
|
+
else if (he(e)) {
|
|
1407
1407
|
const n = {
|
|
1408
1408
|
id: e.id,
|
|
1409
1409
|
target: e.target,
|
|
@@ -1414,9 +1414,9 @@ class ke {
|
|
|
1414
1414
|
targets: e.targets,
|
|
1415
1415
|
stagger: e.stagger
|
|
1416
1416
|
};
|
|
1417
|
-
this._trackPlayers.set(e.id, new
|
|
1417
|
+
this._trackPlayers.set(e.id, new ut(n)), this._motionPathTracks.set(e.id, e);
|
|
1418
1418
|
} else
|
|
1419
|
-
this._trackPlayers.set(e.id, new
|
|
1419
|
+
this._trackPlayers.set(e.id, new ut(e));
|
|
1420
1420
|
}
|
|
1421
1421
|
/**
|
|
1422
1422
|
* Replace a track with a new version, keeping its place in the track order
|
|
@@ -1424,13 +1424,13 @@ class ke {
|
|
|
1424
1424
|
* different id. Does nothing if no track has `trackId`.
|
|
1425
1425
|
*/
|
|
1426
1426
|
replaceTrack(e, n) {
|
|
1427
|
-
const
|
|
1428
|
-
if (
|
|
1429
|
-
const
|
|
1427
|
+
const r = this._tracks.findIndex((o) => o.id === e);
|
|
1428
|
+
if (r < 0) return;
|
|
1429
|
+
const s = this._tracks.slice(r + 1);
|
|
1430
1430
|
this.removeTrack(e);
|
|
1431
|
-
for (const o of
|
|
1431
|
+
for (const o of s) this.removeTrack(o.id);
|
|
1432
1432
|
this.addTrack(n);
|
|
1433
|
-
for (const o of
|
|
1433
|
+
for (const o of s) this.addTrack(o);
|
|
1434
1434
|
}
|
|
1435
1435
|
/**
|
|
1436
1436
|
* Remove a track by its ID.
|
|
@@ -1455,9 +1455,9 @@ class ke {
|
|
|
1455
1455
|
* tweens on an element.
|
|
1456
1456
|
*/
|
|
1457
1457
|
removeTracks(e = {}) {
|
|
1458
|
-
const n = this.getTracks(e).map((
|
|
1459
|
-
for (const
|
|
1460
|
-
this.removeTrack(
|
|
1458
|
+
const n = this.getTracks(e).map((r) => r.id);
|
|
1459
|
+
for (const r of n)
|
|
1460
|
+
this.removeTrack(r);
|
|
1461
1461
|
return n;
|
|
1462
1462
|
}
|
|
1463
1463
|
/**
|
|
@@ -1466,12 +1466,12 @@ class ke {
|
|
|
1466
1466
|
getTrackSpan(e) {
|
|
1467
1467
|
const n = this._trackPlayers.get(e);
|
|
1468
1468
|
if (!n) return;
|
|
1469
|
-
const
|
|
1470
|
-
if (V(
|
|
1471
|
-
return { from:
|
|
1472
|
-
const o =
|
|
1469
|
+
const r = n.getTrack(), s = r.delay ?? 0;
|
|
1470
|
+
if (V(r) || U(r))
|
|
1471
|
+
return { from: s, to: n.getDuration() };
|
|
1472
|
+
const o = r.keyframes;
|
|
1473
1473
|
if (!(!o || o.length === 0))
|
|
1474
|
-
return { from: o[0].time +
|
|
1474
|
+
return { from: o[0].time + s, to: n.getDuration() };
|
|
1475
1475
|
}
|
|
1476
1476
|
/**
|
|
1477
1477
|
* Overlapping writes to the same target+property.
|
|
@@ -1484,32 +1484,32 @@ class ke {
|
|
|
1484
1484
|
findConflicts() {
|
|
1485
1485
|
const e = [];
|
|
1486
1486
|
for (let n = 0; n < this._tracks.length; n++) {
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1487
|
+
const r = this._tracks[n], s = this.getTrackSpan(r.id);
|
|
1488
|
+
if (s)
|
|
1489
1489
|
for (let o = 0; o < n; o++) {
|
|
1490
1490
|
const a = this._tracks[o];
|
|
1491
|
-
if (a.property !==
|
|
1492
|
-
const i =
|
|
1491
|
+
if (a.property !== r.property) continue;
|
|
1492
|
+
const i = j(a).filter((u) => j(r).includes(u));
|
|
1493
1493
|
if (i.length === 0) continue;
|
|
1494
1494
|
const c = this.getTrackSpan(a.id);
|
|
1495
|
-
if (!c || !(c.from <=
|
|
1496
|
-
const
|
|
1495
|
+
if (!c || !(c.from <= s.to && s.from <= c.to)) continue;
|
|
1496
|
+
const l = s.from >= c.from;
|
|
1497
1497
|
for (const u of i)
|
|
1498
1498
|
e.push({
|
|
1499
1499
|
target: u,
|
|
1500
|
-
property:
|
|
1501
|
-
losingTrackId:
|
|
1502
|
-
winningTrackId:
|
|
1500
|
+
property: r.property,
|
|
1501
|
+
losingTrackId: l ? a.id : r.id,
|
|
1502
|
+
winningTrackId: l ? r.id : a.id
|
|
1503
1503
|
});
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
1506
|
return e;
|
|
1507
1507
|
}
|
|
1508
1508
|
_matches(e, n) {
|
|
1509
|
-
if (n.id !== void 0 && e.id !== n.id || n.property !== void 0 && e.property !== n.property || n.target !== void 0 && !
|
|
1509
|
+
if (n.id !== void 0 && e.id !== n.id || n.property !== void 0 && e.property !== n.property || n.target !== void 0 && !j(e).includes(n.target)) return !1;
|
|
1510
1510
|
if (n.timeRange) {
|
|
1511
|
-
const
|
|
1512
|
-
if (!
|
|
1511
|
+
const r = this.getTrackSpan(e.id);
|
|
1512
|
+
if (!r || r.to < n.timeRange.from || r.from > n.timeRange.to) return !1;
|
|
1513
1513
|
}
|
|
1514
1514
|
return !0;
|
|
1515
1515
|
}
|
|
@@ -1518,7 +1518,7 @@ class ke {
|
|
|
1518
1518
|
*/
|
|
1519
1519
|
toDefinition() {
|
|
1520
1520
|
return {
|
|
1521
|
-
formatVersion:
|
|
1521
|
+
formatVersion: ue(this._tracks),
|
|
1522
1522
|
id: this.id,
|
|
1523
1523
|
name: this.name,
|
|
1524
1524
|
config: { ...this._config },
|
|
@@ -1536,8 +1536,8 @@ class ke {
|
|
|
1536
1536
|
}
|
|
1537
1537
|
/** Replace the markers (kept in time order); an empty list removes them. */
|
|
1538
1538
|
setMarkers(e) {
|
|
1539
|
-
const n = e && e.length > 0 ? [...e].sort((
|
|
1540
|
-
n ?
|
|
1539
|
+
const n = e && e.length > 0 ? [...e].sort((s, o) => s.time - o.time).map((s) => ({ ...s })) : void 0, r = { ...this._config };
|
|
1540
|
+
n ? r.markers = n : delete r.markers, this._config = r;
|
|
1541
1541
|
}
|
|
1542
1542
|
/** Caption text per language, per marker id */
|
|
1543
1543
|
get captions() {
|
|
@@ -1546,7 +1546,7 @@ class ke {
|
|
|
1546
1546
|
/** Replace the captions; languages with no captions are dropped. */
|
|
1547
1547
|
setCaptions(e) {
|
|
1548
1548
|
const n = {};
|
|
1549
|
-
for (const [
|
|
1549
|
+
for (const [r, s] of Object.entries(e ?? {})) n[r] = { ...s };
|
|
1550
1550
|
this._captions = Object.keys(n).length > 0 ? n : void 0;
|
|
1551
1551
|
}
|
|
1552
1552
|
/** Start the between-iterations pause, if the timeline configures one. */
|
|
@@ -1576,73 +1576,73 @@ class ke {
|
|
|
1576
1576
|
return this._config.alternate && (e === -1 || this._loopIteration < e) ? (this._loopIteration++, this._armRepeatDelay(), this._direction = "forward", this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
1579
|
-
const
|
|
1580
|
-
function
|
|
1581
|
-
const
|
|
1582
|
-
o.push([
|
|
1583
|
-
const
|
|
1584
|
-
t.forEach((
|
|
1585
|
-
(
|
|
1586
|
-
}),
|
|
1587
|
-
for (const
|
|
1579
|
+
const cr = 100;
|
|
1580
|
+
function ds(t, e, n, r) {
|
|
1581
|
+
const s = [], o = [], { duration: a, alternate: i } = r, c = (f, g, m, M) => {
|
|
1582
|
+
o.push([f, g]);
|
|
1583
|
+
const y = [];
|
|
1584
|
+
t.forEach((p, _) => {
|
|
1585
|
+
(m === "forward" ? (M ? p >= f : p > f) && p <= g : (M ? p <= f : p < f) && p >= g) && y.push(_);
|
|
1586
|
+
}), y.sort((p, _) => (m === "forward" ? t[p] - t[_] : t[_] - t[p]) || p - _);
|
|
1587
|
+
for (const p of y) s.push({ kind: "event", index: p, direction: m });
|
|
1588
1588
|
};
|
|
1589
|
-
let
|
|
1590
|
-
const
|
|
1591
|
-
for (let
|
|
1592
|
-
const
|
|
1593
|
-
c(
|
|
1589
|
+
let h = e.time, l = e.direction, u = e.fresh === !0;
|
|
1590
|
+
const d = Math.min(cr, Math.max(0, n.iteration - e.iteration));
|
|
1591
|
+
for (let f = 0; f < d; f++) {
|
|
1592
|
+
const g = l === "forward" ? a : 0;
|
|
1593
|
+
c(h, g, l, u), s.push({ kind: "repeat" }), i ? (l = l === "forward" ? "reverse" : "forward", h = g, u = !1) : (h = l === "forward" ? 0 : a, u = !0);
|
|
1594
1594
|
}
|
|
1595
|
-
return
|
|
1595
|
+
return d > 0 && r.holding && !i ? { crossings: s, passes: o } : (c(h, n.time, l, u), { crossings: s, passes: o });
|
|
1596
1596
|
}
|
|
1597
|
-
function
|
|
1598
|
-
return
|
|
1597
|
+
function ur(t) {
|
|
1598
|
+
return U(t) ? {
|
|
1599
1599
|
id: t.id,
|
|
1600
1600
|
target: t.target,
|
|
1601
1601
|
property: t.property,
|
|
1602
1602
|
kind: "inertia",
|
|
1603
|
-
inertia:
|
|
1604
|
-
...
|
|
1603
|
+
inertia: Ie(t.inertia),
|
|
1604
|
+
...O(t)
|
|
1605
1605
|
} : V(t) ? {
|
|
1606
1606
|
id: t.id,
|
|
1607
1607
|
target: t.target,
|
|
1608
1608
|
property: t.property,
|
|
1609
1609
|
kind: "spring",
|
|
1610
1610
|
spring: { ...t.spring },
|
|
1611
|
-
...
|
|
1612
|
-
} :
|
|
1611
|
+
...O(t)
|
|
1612
|
+
} : Et(t) ? {
|
|
1613
1613
|
id: t.id,
|
|
1614
1614
|
target: t.target,
|
|
1615
1615
|
property: "text",
|
|
1616
1616
|
textConfig: { ...t.textConfig },
|
|
1617
|
-
keyframes: t.keyframes.map(
|
|
1618
|
-
...
|
|
1619
|
-
} :
|
|
1617
|
+
keyframes: t.keyframes.map(At),
|
|
1618
|
+
...O(t)
|
|
1619
|
+
} : he(t) ? {
|
|
1620
1620
|
id: t.id,
|
|
1621
1621
|
target: t.target,
|
|
1622
1622
|
property: "motionPath",
|
|
1623
1623
|
motionPathConfig: { ...t.motionPathConfig },
|
|
1624
|
-
keyframes: t.keyframes.map(
|
|
1625
|
-
...
|
|
1624
|
+
keyframes: t.keyframes.map(At),
|
|
1625
|
+
...O(t)
|
|
1626
1626
|
} : {
|
|
1627
1627
|
id: t.id,
|
|
1628
1628
|
target: t.target,
|
|
1629
1629
|
property: t.property,
|
|
1630
|
-
keyframes: t.keyframes.map(
|
|
1630
|
+
keyframes: t.keyframes.map(At),
|
|
1631
1631
|
...t.interpolation !== void 0 && { interpolation: t.interpolation },
|
|
1632
|
-
...
|
|
1632
|
+
...O(t)
|
|
1633
1633
|
};
|
|
1634
1634
|
}
|
|
1635
|
-
function
|
|
1635
|
+
function Ie(t) {
|
|
1636
1636
|
return { ...t, ...Array.isArray(t.end) && { end: [...t.end] } };
|
|
1637
1637
|
}
|
|
1638
|
-
function
|
|
1638
|
+
function At(t) {
|
|
1639
1639
|
return {
|
|
1640
1640
|
time: t.time,
|
|
1641
1641
|
value: t.value,
|
|
1642
1642
|
...t.easing && { easing: t.easing }
|
|
1643
1643
|
};
|
|
1644
1644
|
}
|
|
1645
|
-
function
|
|
1645
|
+
function O(t) {
|
|
1646
1646
|
const e = t.endDelay;
|
|
1647
1647
|
return {
|
|
1648
1648
|
...t.delay !== void 0 && { delay: t.delay },
|
|
@@ -1651,16 +1651,16 @@ function F(t) {
|
|
|
1651
1651
|
...t.stagger !== void 0 && { stagger: { ...t.stagger } }
|
|
1652
1652
|
};
|
|
1653
1653
|
}
|
|
1654
|
-
function
|
|
1655
|
-
if (
|
|
1654
|
+
function hr(t) {
|
|
1655
|
+
if (U(t)) {
|
|
1656
1656
|
const e = t;
|
|
1657
1657
|
return {
|
|
1658
1658
|
id: e.id,
|
|
1659
1659
|
target: e.target,
|
|
1660
1660
|
property: e.property,
|
|
1661
1661
|
kind: "inertia",
|
|
1662
|
-
inertia:
|
|
1663
|
-
...
|
|
1662
|
+
inertia: Ie(e.inertia),
|
|
1663
|
+
...O(e)
|
|
1664
1664
|
};
|
|
1665
1665
|
}
|
|
1666
1666
|
if (V(t)) {
|
|
@@ -1671,44 +1671,44 @@ function qn(t) {
|
|
|
1671
1671
|
property: e.property,
|
|
1672
1672
|
kind: "spring",
|
|
1673
1673
|
spring: { ...e.spring },
|
|
1674
|
-
...
|
|
1674
|
+
...O(e)
|
|
1675
1675
|
};
|
|
1676
1676
|
}
|
|
1677
|
-
if (
|
|
1677
|
+
if (Et(t)) {
|
|
1678
1678
|
const e = t;
|
|
1679
1679
|
return {
|
|
1680
1680
|
id: e.id,
|
|
1681
1681
|
target: e.target,
|
|
1682
1682
|
property: "text",
|
|
1683
1683
|
textConfig: { ...e.textConfig },
|
|
1684
|
-
keyframes: [...e.keyframes].sort((n,
|
|
1685
|
-
...
|
|
1684
|
+
keyframes: [...e.keyframes].sort((n, r) => n.time - r.time),
|
|
1685
|
+
...O(e)
|
|
1686
1686
|
};
|
|
1687
1687
|
}
|
|
1688
1688
|
if (t.property === "motionPath" && "motionPathConfig" in t) {
|
|
1689
|
-
const e = t, n = [...e.keyframes].sort((
|
|
1689
|
+
const e = t, n = [...e.keyframes].sort((r, s) => r.time - s.time);
|
|
1690
1690
|
return {
|
|
1691
1691
|
id: e.id,
|
|
1692
1692
|
target: e.target,
|
|
1693
1693
|
property: "motionPath",
|
|
1694
1694
|
motionPathConfig: { ...e.motionPathConfig },
|
|
1695
1695
|
keyframes: n,
|
|
1696
|
-
...
|
|
1696
|
+
...O(e)
|
|
1697
1697
|
};
|
|
1698
1698
|
}
|
|
1699
|
-
return
|
|
1699
|
+
return er({
|
|
1700
1700
|
id: t.id,
|
|
1701
1701
|
target: t.target,
|
|
1702
1702
|
property: t.property,
|
|
1703
1703
|
keyframes: t.keyframes,
|
|
1704
1704
|
...t.interpolation !== void 0 && { interpolation: t.interpolation },
|
|
1705
|
-
...
|
|
1705
|
+
...O(t)
|
|
1706
1706
|
});
|
|
1707
1707
|
}
|
|
1708
|
-
function
|
|
1708
|
+
function lr(t) {
|
|
1709
1709
|
const e = t._config.markers;
|
|
1710
1710
|
return {
|
|
1711
|
-
formatVersion:
|
|
1711
|
+
formatVersion: ue(t.tracks),
|
|
1712
1712
|
id: t.id,
|
|
1713
1713
|
name: t.name,
|
|
1714
1714
|
config: {
|
|
@@ -1720,38 +1720,38 @@ function Jn(t) {
|
|
|
1720
1720
|
...t._config.drawingRate ? { drawingRate: t._config.drawingRate } : {},
|
|
1721
1721
|
...e && { markers: e.map((n) => ({ ...n })) }
|
|
1722
1722
|
},
|
|
1723
|
-
tracks: t.tracks.map(
|
|
1723
|
+
tracks: t.tracks.map(ur),
|
|
1724
1724
|
...t.captions && { captions: JSON.parse(JSON.stringify(t.captions)) }
|
|
1725
1725
|
};
|
|
1726
1726
|
}
|
|
1727
|
-
function
|
|
1727
|
+
function fr(t) {
|
|
1728
1728
|
const e = t.formatVersion ?? 1;
|
|
1729
|
-
if (e >
|
|
1729
|
+
if (e > Vt)
|
|
1730
1730
|
throw new Error(
|
|
1731
|
-
`tinyfly: this animation uses format version ${e}, but this tinyfly reads up to version ${
|
|
1731
|
+
`tinyfly: this animation uses format version ${e}, but this tinyfly reads up to version ${Vt}. Update tinyfly to play it.`
|
|
1732
1732
|
);
|
|
1733
|
-
return new
|
|
1733
|
+
return new Pe({
|
|
1734
1734
|
id: t.id,
|
|
1735
1735
|
name: t.name,
|
|
1736
1736
|
config: t.config,
|
|
1737
|
-
tracks: t.tracks.map(
|
|
1737
|
+
tracks: t.tracks.map(hr),
|
|
1738
1738
|
captions: t.captions
|
|
1739
1739
|
});
|
|
1740
1740
|
}
|
|
1741
|
-
function
|
|
1742
|
-
return JSON.stringify(
|
|
1741
|
+
function ms(t) {
|
|
1742
|
+
return JSON.stringify(lr(t));
|
|
1743
1743
|
}
|
|
1744
|
-
function
|
|
1744
|
+
function gs(t) {
|
|
1745
1745
|
const e = JSON.parse(t);
|
|
1746
|
-
return
|
|
1746
|
+
return fr(e);
|
|
1747
1747
|
}
|
|
1748
|
-
function
|
|
1748
|
+
function dr(t) {
|
|
1749
1749
|
let e = 2166136261;
|
|
1750
1750
|
for (let n = 0; n < t.length; n++)
|
|
1751
1751
|
e ^= t.charCodeAt(n), e = Math.imul(e, 16777619);
|
|
1752
1752
|
return e >>> 0;
|
|
1753
1753
|
}
|
|
1754
|
-
function
|
|
1754
|
+
function $e(t) {
|
|
1755
1755
|
let e = t >>> 0 || 2654435769;
|
|
1756
1756
|
return {
|
|
1757
1757
|
seed: t >>> 0,
|
|
@@ -1760,27 +1760,27 @@ function Se(t) {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
};
|
|
1762
1762
|
}
|
|
1763
|
-
function
|
|
1763
|
+
function Re(t, e, n) {
|
|
1764
1764
|
return e + t.next() * (n - e);
|
|
1765
1765
|
}
|
|
1766
|
-
function
|
|
1767
|
-
if (
|
|
1768
|
-
const
|
|
1769
|
-
return e + o *
|
|
1766
|
+
function mr(t, e, n, r) {
|
|
1767
|
+
if (r <= 0) return Re(t, e, n);
|
|
1768
|
+
const s = Math.floor((n - e) / r), o = Math.round(t.next() * s);
|
|
1769
|
+
return e + o * r;
|
|
1770
1770
|
}
|
|
1771
|
-
function
|
|
1771
|
+
function ps(t, e) {
|
|
1772
1772
|
if (e.length !== 0)
|
|
1773
1773
|
return e[Math.floor(t.next() * e.length)];
|
|
1774
1774
|
}
|
|
1775
|
-
const
|
|
1776
|
-
function
|
|
1777
|
-
return typeof t != "string" ? !1 :
|
|
1775
|
+
const Ce = /^([+\-*/])=\s*(-?[\d.]+)$/, Ee = /^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;
|
|
1776
|
+
function ys(t) {
|
|
1777
|
+
return typeof t != "string" ? !1 : Ce.test(t.trim()) || Ee.test(t.trim());
|
|
1778
1778
|
}
|
|
1779
|
-
function
|
|
1779
|
+
function De(t, e = {}) {
|
|
1780
1780
|
if (typeof t != "string") return t;
|
|
1781
|
-
const n = t.trim(),
|
|
1782
|
-
if (
|
|
1783
|
-
const [, o, a] =
|
|
1781
|
+
const n = t.trim(), r = Ce.exec(n);
|
|
1782
|
+
if (r) {
|
|
1783
|
+
const [, o, a] = r, i = e.base ?? 0, c = Number.parseFloat(a);
|
|
1784
1784
|
switch (o) {
|
|
1785
1785
|
case "+":
|
|
1786
1786
|
return i + c;
|
|
@@ -1792,493 +1792,847 @@ function $e(t, e = {}) {
|
|
|
1792
1792
|
return c === 0 ? i : i / c;
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
|
-
const
|
|
1796
|
-
if (
|
|
1795
|
+
const s = Ee.exec(n);
|
|
1796
|
+
if (s) {
|
|
1797
1797
|
if (!e.random)
|
|
1798
1798
|
throw new Error(
|
|
1799
1799
|
`resolveValue: "${n}" needs a random source — pass one via context.random`
|
|
1800
1800
|
);
|
|
1801
|
-
const o = Number.parseFloat(
|
|
1802
|
-
return i !== void 0 ?
|
|
1801
|
+
const o = Number.parseFloat(s[1]), a = Number.parseFloat(s[2]), i = s[3] !== void 0 ? Number.parseFloat(s[3]) : void 0;
|
|
1802
|
+
return i !== void 0 ? mr(e.random, o, a, i) : Re(e.random, o, a);
|
|
1803
1803
|
}
|
|
1804
1804
|
return t;
|
|
1805
1805
|
}
|
|
1806
|
-
function
|
|
1807
|
-
const
|
|
1808
|
-
let
|
|
1806
|
+
function gr(t, e = 0, n) {
|
|
1807
|
+
const r = [];
|
|
1808
|
+
let s = e;
|
|
1809
1809
|
for (const o of t) {
|
|
1810
|
-
const a =
|
|
1811
|
-
|
|
1810
|
+
const a = De(o, { base: s, random: n });
|
|
1811
|
+
r.push(a), typeof a == "number" && (s = a);
|
|
1812
1812
|
}
|
|
1813
|
-
return
|
|
1813
|
+
return r;
|
|
1814
1814
|
}
|
|
1815
|
-
class
|
|
1815
|
+
class Ms {
|
|
1816
1816
|
random;
|
|
1817
1817
|
constructor(e) {
|
|
1818
|
-
this.random =
|
|
1818
|
+
this.random = $e(e);
|
|
1819
1819
|
}
|
|
1820
1820
|
/** The seed, to be stored alongside the timeline so this can be reproduced. */
|
|
1821
1821
|
get seed() {
|
|
1822
1822
|
return this.random.seed;
|
|
1823
1823
|
}
|
|
1824
1824
|
resolve(e, n = 0) {
|
|
1825
|
-
return
|
|
1825
|
+
return De(e, { base: n, random: this.random });
|
|
1826
1826
|
}
|
|
1827
1827
|
resolveSequence(e, n = 0) {
|
|
1828
|
-
return
|
|
1828
|
+
return gr(e, n, this.random);
|
|
1829
1829
|
}
|
|
1830
1830
|
}
|
|
1831
|
-
const
|
|
1832
|
-
function
|
|
1831
|
+
const pr = 600;
|
|
1832
|
+
function xs(t) {
|
|
1833
1833
|
if (Array.isArray(t)) {
|
|
1834
|
-
const [f,
|
|
1835
|
-
return { fn:
|
|
1834
|
+
const [d, f, g, m] = t;
|
|
1835
|
+
return { fn: ae(d, f, g, m), bezier: [d, f, g, m] };
|
|
1836
1836
|
}
|
|
1837
|
-
const { segments: e } =
|
|
1837
|
+
const { segments: e } = Q(t);
|
|
1838
1838
|
if (e.length === 0) throw new Error(`customEase: no curve in "${t}"`);
|
|
1839
|
-
const n = e[0].startX,
|
|
1839
|
+
const n = e[0].startX, r = e[0].startY, s = e[e.length - 1], o = s.endX - n, a = s.endY - r;
|
|
1840
1840
|
if (o === 0 || a === 0) throw new Error(`customEase: "${t}" must move along both axes`);
|
|
1841
|
-
const i = (
|
|
1842
|
-
if (e.length === 1 &&
|
|
1843
|
-
const [f,
|
|
1844
|
-
return { fn:
|
|
1845
|
-
}
|
|
1846
|
-
const
|
|
1847
|
-
for (const
|
|
1848
|
-
for (let
|
|
1849
|
-
const [
|
|
1850
|
-
|
|
1841
|
+
const i = (d) => (d - n) / o, c = (d) => (d - r) / a;
|
|
1842
|
+
if (e.length === 1 && s.type === "C") {
|
|
1843
|
+
const [d, f, g, m] = s.points, M = [i(d), c(f), i(g), c(m)];
|
|
1844
|
+
return { fn: ae(...M), bezier: M };
|
|
1845
|
+
}
|
|
1846
|
+
const h = [], l = [], u = Math.max(8, Math.ceil(pr / e.length));
|
|
1847
|
+
for (const d of e)
|
|
1848
|
+
for (let f = h.length === 0 ? 0 : 1; f <= u; f++) {
|
|
1849
|
+
const [g, m] = yr(d, f / u);
|
|
1850
|
+
h.push(i(g)), l.push(c(m));
|
|
1851
1851
|
}
|
|
1852
|
-
return { fn:
|
|
1852
|
+
return { fn: Mr(h, l) };
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1855
|
-
const n = 0.1 + Math.max(0, Math.min(1, t.strength ?? 0.7)) * 0.7,
|
|
1856
|
-
for (let o = n; o > 2e-3; o *= n)
|
|
1857
|
-
const
|
|
1854
|
+
function _s(t = {}) {
|
|
1855
|
+
const n = 0.1 + Math.max(0, Math.min(1, t.strength ?? 0.7)) * 0.7, r = [1];
|
|
1856
|
+
for (let o = n; o > 2e-3; o *= n) r.push(2 * Math.sqrt(o));
|
|
1857
|
+
const s = r.reduce((o, a) => o + a, 0);
|
|
1858
1858
|
return (o) => {
|
|
1859
1859
|
if (o <= 0) return 0;
|
|
1860
1860
|
if (o >= 1) return 1;
|
|
1861
|
-
let a = o *
|
|
1862
|
-
for (let i = 0; i <
|
|
1863
|
-
if (a <=
|
|
1864
|
-
if (i === 0) return (a /
|
|
1865
|
-
const c =
|
|
1866
|
-
return 1 - (
|
|
1861
|
+
let a = o * s;
|
|
1862
|
+
for (let i = 0; i < r.length; i++) {
|
|
1863
|
+
if (a <= r[i]) {
|
|
1864
|
+
if (i === 0) return (a / r[0]) ** 2;
|
|
1865
|
+
const c = r[i] / 2, h = c * c, l = a - c;
|
|
1866
|
+
return 1 - (h - l * l);
|
|
1867
1867
|
}
|
|
1868
|
-
a -=
|
|
1868
|
+
a -= r[i];
|
|
1869
1869
|
}
|
|
1870
1870
|
return 1;
|
|
1871
1871
|
};
|
|
1872
1872
|
}
|
|
1873
|
-
function
|
|
1874
|
-
const e = Math.max(1, t.wiggles ?? 10), n = t.type ?? "easeOut",
|
|
1875
|
-
return (
|
|
1873
|
+
function bs(t = {}) {
|
|
1874
|
+
const e = Math.max(1, t.wiggles ?? 10), n = t.type ?? "easeOut", r = (s) => n === "uniform" ? 1 : n === "easeInOut" ? Math.sin(Math.PI * s) : (1 - s) ** 2;
|
|
1875
|
+
return (s) => s <= 0 || s >= 1 ? 0 : Math.sin(s * e * Math.PI * 2) * r(s);
|
|
1876
1876
|
}
|
|
1877
|
-
function
|
|
1877
|
+
function yr(t, e) {
|
|
1878
1878
|
if (t.type === "L") {
|
|
1879
|
-
const [
|
|
1880
|
-
return [t.startX + (
|
|
1879
|
+
const [h, l] = t.points;
|
|
1880
|
+
return [t.startX + (h - t.startX) * e, t.startY + (l - t.startY) * e];
|
|
1881
1881
|
}
|
|
1882
|
-
const [n,
|
|
1882
|
+
const [n, r, s, o, a, i] = t.points, c = 1 - e;
|
|
1883
1883
|
return [
|
|
1884
|
-
c * c * c * t.startX + 3 * c * c * e * n + 3 * c * e * e *
|
|
1885
|
-
c * c * c * t.startY + 3 * c * c * e *
|
|
1884
|
+
c * c * c * t.startX + 3 * c * c * e * n + 3 * c * e * e * s + e * e * e * a,
|
|
1885
|
+
c * c * c * t.startY + 3 * c * c * e * r + 3 * c * e * e * o + e * e * e * i
|
|
1886
1886
|
];
|
|
1887
1887
|
}
|
|
1888
|
-
function
|
|
1888
|
+
function Mr(t, e) {
|
|
1889
1889
|
return (n) => {
|
|
1890
1890
|
if (n <= t[0]) return e[0];
|
|
1891
1891
|
if (n >= t[t.length - 1]) return e[e.length - 1];
|
|
1892
|
-
let
|
|
1893
|
-
for (;
|
|
1894
|
-
const a =
|
|
1895
|
-
t[a] <= n ?
|
|
1892
|
+
let r = 0, s = t.length - 1;
|
|
1893
|
+
for (; s - r > 1; ) {
|
|
1894
|
+
const a = r + s >> 1;
|
|
1895
|
+
t[a] <= n ? r = a : s = a;
|
|
1896
1896
|
}
|
|
1897
|
-
const o = t[
|
|
1898
|
-
return o === 0 ? e[
|
|
1897
|
+
const o = t[s] - t[r];
|
|
1898
|
+
return o === 0 ? e[s] : e[r] + (n - t[r]) / o * (e[s] - e[r]);
|
|
1899
1899
|
};
|
|
1900
1900
|
}
|
|
1901
|
-
function
|
|
1902
|
-
const
|
|
1901
|
+
function ae(t, e, n, r) {
|
|
1902
|
+
const s = (a, i, c) => 3 * (1 - a) * (1 - a) * a * i + 3 * (1 - a) * a * a * c + a * a * a, o = (a, i, c) => 3 * (1 - a) * (1 - a) * i + 6 * (1 - a) * a * (c - i) + 3 * a * a * (1 - c);
|
|
1903
1903
|
return (a) => {
|
|
1904
1904
|
if (a <= 0) return 0;
|
|
1905
1905
|
if (a >= 1) return 1;
|
|
1906
1906
|
let i = a;
|
|
1907
|
-
for (let
|
|
1908
|
-
const u =
|
|
1909
|
-
if (Math.abs(u) < 1e-6) return
|
|
1910
|
-
if (Math.abs(
|
|
1911
|
-
i -= u /
|
|
1907
|
+
for (let l = 0; l < 8; l++) {
|
|
1908
|
+
const u = s(i, t, n) - a, d = o(i, t, n);
|
|
1909
|
+
if (Math.abs(u) < 1e-6) return s(i, e, r);
|
|
1910
|
+
if (Math.abs(d) < 1e-6) break;
|
|
1911
|
+
i -= u / d;
|
|
1912
1912
|
}
|
|
1913
|
-
let c = 0,
|
|
1913
|
+
let c = 0, h = 1;
|
|
1914
1914
|
i = a;
|
|
1915
|
-
for (let
|
|
1916
|
-
|
|
1917
|
-
return
|
|
1915
|
+
for (let l = 0; l < 40; l++)
|
|
1916
|
+
s(i, t, n) < a ? c = i : h = i, i = (c + h) / 2;
|
|
1917
|
+
return s(i, e, r);
|
|
1918
1918
|
};
|
|
1919
1919
|
}
|
|
1920
|
-
const
|
|
1921
|
-
function
|
|
1922
|
-
const n = e.lead ??
|
|
1920
|
+
const xr = 350, _r = 300, br = 550;
|
|
1921
|
+
function Ts(t, e = {}) {
|
|
1922
|
+
const n = e.lead ?? xr, r = e.gap ?? _r, s = e.tail ?? br, o = [];
|
|
1923
1923
|
let a = 0;
|
|
1924
1924
|
return t.forEach((i, c) => {
|
|
1925
|
-
const
|
|
1926
|
-
let
|
|
1927
|
-
i.lines.forEach((
|
|
1928
|
-
if (!(
|
|
1929
|
-
throw new Error(`narration: scene ${c} line ${
|
|
1930
|
-
|
|
1931
|
-
id:
|
|
1925
|
+
const h = [];
|
|
1926
|
+
let l = a + n;
|
|
1927
|
+
i.lines.forEach((d, f) => {
|
|
1928
|
+
if (!(d.duration >= 0))
|
|
1929
|
+
throw new Error(`narration: scene ${c} line ${f} has an invalid duration (${d.duration})`);
|
|
1930
|
+
f > 0 && (l += r), h.push({
|
|
1931
|
+
id: d.id ?? `s${c}-l${f}`,
|
|
1932
1932
|
scene: c,
|
|
1933
|
-
line:
|
|
1934
|
-
start:
|
|
1935
|
-
end:
|
|
1936
|
-
text:
|
|
1937
|
-
}),
|
|
1933
|
+
line: f,
|
|
1934
|
+
start: l,
|
|
1935
|
+
end: l + d.duration,
|
|
1936
|
+
text: d.text
|
|
1937
|
+
}), l += d.duration;
|
|
1938
1938
|
});
|
|
1939
|
-
const u =
|
|
1940
|
-
o.push({ id: i.id ?? `s${c}`, start: a, duration: u - a, cues:
|
|
1939
|
+
const u = l + s + (i.tail ?? 0);
|
|
1940
|
+
o.push({ id: i.id ?? `s${c}`, start: a, duration: u - a, cues: h }), a = u;
|
|
1941
1941
|
}), { duration: a, scenes: o, cues: o.flatMap((i) => i.cues) };
|
|
1942
1942
|
}
|
|
1943
|
-
function
|
|
1943
|
+
function ws(t) {
|
|
1944
1944
|
return t.cues.map((e) => ({ id: e.id, time: e.start, label: e.text }));
|
|
1945
1945
|
}
|
|
1946
|
-
function
|
|
1946
|
+
function ks(t, e) {
|
|
1947
1947
|
let n = t.scenes[0];
|
|
1948
|
-
for (const
|
|
1949
|
-
if (e >=
|
|
1948
|
+
for (const r of t.scenes)
|
|
1949
|
+
if (e >= r.start) n = r;
|
|
1950
1950
|
else break;
|
|
1951
1951
|
return n;
|
|
1952
1952
|
}
|
|
1953
|
-
const
|
|
1954
|
-
function
|
|
1955
|
-
return t.offset + e *
|
|
1953
|
+
const gt = (t) => 6e4 / t.bpm;
|
|
1954
|
+
function Ot(t, e) {
|
|
1955
|
+
return t.offset + e * gt(t);
|
|
1956
1956
|
}
|
|
1957
|
-
function
|
|
1958
|
-
return (e - t.offset) /
|
|
1957
|
+
function pt(t, e) {
|
|
1958
|
+
return (e - t.offset) / gt(t);
|
|
1959
1959
|
}
|
|
1960
|
-
function
|
|
1961
|
-
return
|
|
1960
|
+
function As(t, e) {
|
|
1961
|
+
return Ot(t, Math.round(pt(t, e)));
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1964
|
-
return
|
|
1963
|
+
function Ss(t, e) {
|
|
1964
|
+
return Ot(t, Math.ceil(pt(t, e) - 1e-9));
|
|
1965
1965
|
}
|
|
1966
|
-
function
|
|
1967
|
-
const
|
|
1968
|
-
if (!(t.bpm > 0) || n < e) return
|
|
1969
|
-
for (let o = Math.ceil(
|
|
1970
|
-
const a =
|
|
1966
|
+
function vs(t, e, n) {
|
|
1967
|
+
const r = Math.max(1, Math.round(t.beatsPerBar ?? 4)), s = [];
|
|
1968
|
+
if (!(t.bpm > 0) || n < e) return s;
|
|
1969
|
+
for (let o = Math.ceil(pt(t, e) - 1e-9); ; o++) {
|
|
1970
|
+
const a = Ot(t, o);
|
|
1971
1971
|
if (a > n + 1e-9) break;
|
|
1972
|
-
|
|
1972
|
+
s.push({ time: a, bar: (o % r + r) % r === 0, n: o });
|
|
1973
1973
|
}
|
|
1974
|
-
return
|
|
1974
|
+
return s;
|
|
1975
1975
|
}
|
|
1976
|
-
const
|
|
1977
|
-
function
|
|
1978
|
-
const
|
|
1976
|
+
const H = 100;
|
|
1977
|
+
function Ps(t, e, n = {}) {
|
|
1978
|
+
const r = n.minBpm ?? 70, s = n.maxBpm ?? 180, o = Math.max(1, Math.round(e / H)), a = Math.min(t.length, Math.round((n.maxSeconds ?? 60) * e)), i = Math.floor(a / o);
|
|
1979
1979
|
if (i < 4) return { bpm: 120, offset: 0, confidence: 0 };
|
|
1980
1980
|
const c = new Float64Array(i);
|
|
1981
|
-
for (let
|
|
1981
|
+
for (let b = 0; b < i; b++) {
|
|
1982
1982
|
let T = 0;
|
|
1983
|
-
for (let
|
|
1984
|
-
c[
|
|
1985
|
-
}
|
|
1986
|
-
const
|
|
1987
|
-
for (let
|
|
1988
|
-
const
|
|
1989
|
-
for (let
|
|
1990
|
-
const u = Math.max(1, Math.floor(60 *
|
|
1983
|
+
for (let A = b * o; A < (b + 1) * o; A++) T += t[A] * t[A];
|
|
1984
|
+
c[b] = Math.log(1e-6 + T / o);
|
|
1985
|
+
}
|
|
1986
|
+
const h = new Float64Array(i);
|
|
1987
|
+
for (let b = 1; b < i; b++) h[b] = Math.max(0, c[b] - c[b - 1]);
|
|
1988
|
+
const l = h.reduce((b, T) => b + T, 0) / i;
|
|
1989
|
+
for (let b = 0; b < i; b++) h[b] = Math.max(0, h[b] - l);
|
|
1990
|
+
const u = Math.max(1, Math.floor(60 * H / s)), d = Math.min(i - 1, Math.ceil(60 * H / r)), f = (b) => {
|
|
1991
1991
|
let T = 0;
|
|
1992
|
-
for (let
|
|
1993
|
-
return T / (i -
|
|
1992
|
+
for (let A = b; A < i; A++) T += h[A] * h[A - b];
|
|
1993
|
+
return T / (i - b);
|
|
1994
1994
|
};
|
|
1995
|
-
let
|
|
1996
|
-
for (let
|
|
1997
|
-
|
|
1998
|
-
let
|
|
1999
|
-
for (let
|
|
2000
|
-
const T = 60 *
|
|
2001
|
-
|
|
2002
|
-
}
|
|
2003
|
-
const
|
|
2004
|
-
const T = Math.floor(
|
|
2005
|
-
return T < 0 || T + 1 >= i ? 0 :
|
|
2006
|
-
},
|
|
2007
|
-
let
|
|
2008
|
-
for (let
|
|
2009
|
-
return
|
|
1995
|
+
let g = 0;
|
|
1996
|
+
for (let b = 0; b < i; b++) g += h[b] * h[b];
|
|
1997
|
+
g /= i;
|
|
1998
|
+
let m = u, M = -1 / 0;
|
|
1999
|
+
for (let b = u; b <= d; b++) {
|
|
2000
|
+
const T = 60 * H / b, A = Math.exp(-0.5 * (Math.log2(T / 120) / 0.9) ** 2), v = f(b) * A;
|
|
2001
|
+
v > M && (M = v, m = b);
|
|
2002
|
+
}
|
|
2003
|
+
const y = (b) => {
|
|
2004
|
+
const T = Math.floor(b);
|
|
2005
|
+
return T < 0 || T + 1 >= i ? 0 : h[T] + (h[T + 1] - h[T]) * (b - T);
|
|
2006
|
+
}, p = (b, T) => {
|
|
2007
|
+
let A = 0;
|
|
2008
|
+
for (let v = T; v < i; v += b) A += y(v);
|
|
2009
|
+
return A;
|
|
2010
2010
|
};
|
|
2011
|
-
let
|
|
2012
|
-
for (let
|
|
2013
|
-
if (
|
|
2014
|
-
const T = Math.max(1, Math.round(
|
|
2015
|
-
for (let
|
|
2016
|
-
const
|
|
2017
|
-
$ >
|
|
2011
|
+
let _ = m, w = 0, x = -1 / 0;
|
|
2012
|
+
for (let b = m - 0.6; b <= m + 0.6 + 1e-9; b += 0.02) {
|
|
2013
|
+
if (b < 1) continue;
|
|
2014
|
+
const T = Math.max(1, Math.round(b * 4));
|
|
2015
|
+
for (let A = 0; A < T; A++) {
|
|
2016
|
+
const v = A / T * b, $ = p(b, v);
|
|
2017
|
+
$ > x && (x = $, w = v, _ = b);
|
|
2018
2018
|
}
|
|
2019
2019
|
}
|
|
2020
|
-
const
|
|
2021
|
-
return { bpm: Math.round(
|
|
2020
|
+
const S = 60 * H / _, k = g > 0 ? Math.max(0, Math.min(1, f(m) / g)) : 0, P = (w + 0.5) * 1e3 / H;
|
|
2021
|
+
return { bpm: Math.round(S * 100) / 100, offset: Math.round(P % (6e4 / S)), confidence: k };
|
|
2022
2022
|
}
|
|
2023
|
-
const
|
|
2024
|
-
function
|
|
2025
|
-
const n = e.target ?? "Camera",
|
|
2026
|
-
const
|
|
2027
|
-
for (;
|
|
2028
|
-
|
|
2023
|
+
const Tr = 600, wr = 250, ie = 1;
|
|
2024
|
+
function Is(t, e) {
|
|
2025
|
+
const n = e.target ?? "Camera", r = { x: e.stage.width / 2, y: e.stage.height / 2 }, s = {}, o = (u, d, f, g) => {
|
|
2026
|
+
const m = s[u] ??= [];
|
|
2027
|
+
for (; m.length > 0 && m[m.length - 1].time >= d; ) m.pop();
|
|
2028
|
+
m.push({ time: d, value: f, ...g ? { easing: g } : {} });
|
|
2029
2029
|
}, a = (u) => {
|
|
2030
|
-
const
|
|
2030
|
+
const d = u.rotate * Math.PI / 180, f = (u.focusX - r.x) * u.scale, g = (u.focusY - r.y) * u.scale;
|
|
2031
2031
|
return {
|
|
2032
|
-
x: -(
|
|
2033
|
-
y: -(
|
|
2032
|
+
x: -(f * Math.cos(d) - g * Math.sin(d)),
|
|
2033
|
+
y: -(f * Math.sin(d) + g * Math.cos(d)),
|
|
2034
2034
|
scale: u.scale,
|
|
2035
2035
|
rotate: u.rotate
|
|
2036
2036
|
};
|
|
2037
|
-
}, i = (u,
|
|
2038
|
-
const
|
|
2039
|
-
for (const
|
|
2037
|
+
}, i = (u, d, f) => {
|
|
2038
|
+
const g = a(d);
|
|
2039
|
+
for (const m of ["x", "y", "scale", "rotate"]) o(m, u, g[m], f);
|
|
2040
2040
|
};
|
|
2041
|
-
let c = { focusX:
|
|
2042
|
-
const
|
|
2043
|
-
|
|
2044
|
-
for (const u of
|
|
2041
|
+
let c = { focusX: r.x, focusY: r.y, scale: 1, rotate: 0 };
|
|
2042
|
+
const h = [...t].sort((u, d) => u.at - d.at), l = h.filter((u) => !("shake" in u));
|
|
2043
|
+
l.length > 0 && i(0, c);
|
|
2044
|
+
for (const u of l)
|
|
2045
2045
|
if ("frame" in u) {
|
|
2046
|
-
const
|
|
2046
|
+
const d = Math.max(ie, u.duration ?? Tr);
|
|
2047
2047
|
i(u.at, c), c = {
|
|
2048
|
-
focusX: u.frame.focus?.x ??
|
|
2049
|
-
focusY: u.frame.focus?.y ??
|
|
2048
|
+
focusX: u.frame.focus?.x ?? r.x,
|
|
2049
|
+
focusY: u.frame.focus?.y ?? r.y,
|
|
2050
2050
|
scale: u.frame.scale ?? 1,
|
|
2051
2051
|
rotate: u.frame.rotate ?? 0
|
|
2052
|
-
}, i(u.at +
|
|
2052
|
+
}, i(u.at + d, c, u.easing ?? (d > ie ? "ease-in-out" : void 0));
|
|
2053
2053
|
} else {
|
|
2054
|
-
const { follow:
|
|
2054
|
+
const { follow: d } = u, f = d.lag ?? wr, g = new Pe({ id: "follow", tracks: [{ id: "x", target: "s", property: "x", keyframes: d.x }] }), m = (p) => g.getStateAtTime(p).values.get("s")?.get("x") ?? c.focusX, M = [u.at, ...d.x.map((p) => p.time).filter((p) => p > u.at && p < u.until), u.until];
|
|
2055
2055
|
i(u.at, c);
|
|
2056
|
-
const
|
|
2057
|
-
focusX: p
|
|
2058
|
-
focusY:
|
|
2059
|
-
scale:
|
|
2056
|
+
const y = (p) => ({
|
|
2057
|
+
focusX: m(p) + (d.lead ?? 0),
|
|
2058
|
+
focusY: d.y ?? c.focusY,
|
|
2059
|
+
scale: d.scale ?? c.scale,
|
|
2060
2060
|
rotate: c.rotate
|
|
2061
2061
|
});
|
|
2062
|
-
for (const
|
|
2063
|
-
const
|
|
2064
|
-
i(
|
|
2062
|
+
for (const p of M) {
|
|
2063
|
+
const _ = d.x.find((w) => w.time === p)?.easing;
|
|
2064
|
+
i(p + f, y(p), p === u.at ? "ease-in-out" : _);
|
|
2065
2065
|
}
|
|
2066
|
-
c =
|
|
2066
|
+
c = y(u.until);
|
|
2067
2067
|
}
|
|
2068
|
-
for (const u of
|
|
2069
|
-
const
|
|
2070
|
-
for (const
|
|
2071
|
-
for (let
|
|
2072
|
-
const
|
|
2073
|
-
o("shakeX",
|
|
2068
|
+
for (const u of h.filter((d) => "shake" in d)) {
|
|
2069
|
+
const d = u.shake.strength ?? 12, f = u.shake.roll ?? 1.5, g = 1e3 / (u.shake.frequency ?? 24), m = $e(u.shake.seed ?? Math.round(u.at) + 1), M = () => m.next() * 2 - 1;
|
|
2070
|
+
for (const y of ["shakeX", "shakeY", "shakeRotate"]) o(y, u.at, 0);
|
|
2071
|
+
for (let y = u.at + g; y < u.at + u.duration; y += g) {
|
|
2072
|
+
const p = 1 - (y - u.at) / u.duration;
|
|
2073
|
+
o("shakeX", y, M() * d * p), o("shakeY", y, M() * d * p), o("shakeRotate", y, M() * f * p);
|
|
2074
2074
|
}
|
|
2075
|
-
for (const
|
|
2075
|
+
for (const y of ["shakeX", "shakeY", "shakeRotate"]) o(y, u.at + u.duration, 0, "ease-out");
|
|
2076
2076
|
}
|
|
2077
|
-
return Object.entries(
|
|
2077
|
+
return Object.entries(s).map(([u, d]) => ({ id: `${n}-${u}`, target: n, property: u, keyframes: d }));
|
|
2078
2078
|
}
|
|
2079
|
-
function
|
|
2080
|
-
const n = t.toLowerCase(),
|
|
2081
|
-
let
|
|
2079
|
+
function kr(t, e) {
|
|
2080
|
+
const n = t.toLowerCase(), r = e.toLowerCase();
|
|
2081
|
+
let s = Array.from({ length: r.length + 1 }, (o, a) => a);
|
|
2082
2082
|
for (let o = 1; o <= n.length; o++) {
|
|
2083
2083
|
const a = [o];
|
|
2084
|
-
for (let i = 1; i <=
|
|
2085
|
-
a[i] = Math.min(
|
|
2086
|
-
|
|
2084
|
+
for (let i = 1; i <= r.length; i++)
|
|
2085
|
+
a[i] = Math.min(s[i] + 1, a[i - 1] + 1, s[i - 1] + (n[o - 1] === r[i - 1] ? 0 : 1));
|
|
2086
|
+
s = a;
|
|
2087
2087
|
}
|
|
2088
|
-
return r
|
|
2088
|
+
return s[r.length];
|
|
2089
2089
|
}
|
|
2090
|
-
function
|
|
2091
|
-
const n = t.toLowerCase(),
|
|
2092
|
-
if (
|
|
2093
|
-
let
|
|
2090
|
+
function Ar(t, e) {
|
|
2091
|
+
const n = t.toLowerCase(), r = e.find((a) => a.toLowerCase().includes(n) || n.includes(a.toLowerCase()));
|
|
2092
|
+
if (r && Math.min(t.length, r.length) >= 3) return r;
|
|
2093
|
+
let s, o = 1 / 0;
|
|
2094
2094
|
for (const a of e) {
|
|
2095
|
-
const i =
|
|
2096
|
-
i < o && (o = i,
|
|
2095
|
+
const i = kr(t, a);
|
|
2096
|
+
i < o && (o = i, s = a);
|
|
2097
2097
|
}
|
|
2098
|
-
return
|
|
2098
|
+
return s !== void 0 && o <= Math.max(2, Math.floor(t.length / 3)) ? s : void 0;
|
|
2099
2099
|
}
|
|
2100
|
-
function
|
|
2101
|
-
const
|
|
2102
|
-
return `Unknown ${t} ${JSON.stringify(e)}${
|
|
2100
|
+
function $s(t, e, n, r) {
|
|
2101
|
+
const s = typeof e == "string" ? r ?? Ar(e, n) : void 0;
|
|
2102
|
+
return `Unknown ${t} ${JSON.stringify(e)}${s ? `: did you mean "${s}"?` : "."} Known: ${n.join(", ")}`;
|
|
2103
2103
|
}
|
|
2104
|
-
function
|
|
2105
|
-
const n = e.step ?? 33,
|
|
2104
|
+
function Rs(t, e) {
|
|
2105
|
+
const n = e.step ?? 33, r = e.stiffness ?? 120, s = e.damping ?? 9, o = e.mass ?? 1;
|
|
2106
2106
|
let a = t(e.start), i = 0;
|
|
2107
2107
|
const c = [{ time: e.start, value: a }];
|
|
2108
|
-
let
|
|
2109
|
-
for (let
|
|
2110
|
-
const
|
|
2111
|
-
i +=
|
|
2108
|
+
let h = e.start + n;
|
|
2109
|
+
for (let l = e.start + 1; l <= e.end; l++) {
|
|
2110
|
+
const d = r * (t(l) - a) - s * i;
|
|
2111
|
+
i += d / o * 1e-3, a += i * 1e-3, (l >= h || l === e.end) && (c.push({ time: l, value: a }), h += n);
|
|
2112
2112
|
}
|
|
2113
2113
|
return c;
|
|
2114
2114
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2115
|
+
function K(t, e, n = 1) {
|
|
2116
|
+
if (!(e > 0)) return 0;
|
|
2117
|
+
const r = t * n / e;
|
|
2118
|
+
return r - Math.floor(r);
|
|
2119
|
+
}
|
|
2120
|
+
function Le(t) {
|
|
2121
|
+
const e = t - Math.floor(t);
|
|
2122
|
+
return 1 - Math.abs(e * 2 - 1);
|
|
2123
|
+
}
|
|
2124
|
+
function Cs(t, e) {
|
|
2125
|
+
const n = Math.max(1, Math.round(e.cycles ?? 1)), r = e.amplitude ?? 1, s = K(t, e.period, n) + (e.phase ?? 0), o = s - Math.floor(s);
|
|
2126
|
+
switch (e.shape ?? "sine") {
|
|
2127
|
+
case "triangle":
|
|
2128
|
+
return r * (Le(o + 0.25) * 2 - 1);
|
|
2129
|
+
case "square":
|
|
2130
|
+
return o < 0.5 ? r : -r;
|
|
2131
|
+
default:
|
|
2132
|
+
return r * Math.sin(o * Math.PI * 2);
|
|
2133
|
+
}
|
|
2134
|
+
}
|
|
2135
|
+
function Es(t, e) {
|
|
2136
|
+
const n = Math.max(1, Math.round(e.cycles ?? 1)), r = typeof e.easing == "function" ? e.easing : Lt(e.easing ?? "ease-in-out"), s = K(t, e.period, n) + (e.phase ?? 0);
|
|
2137
|
+
return r(Le(s));
|
|
2138
|
+
}
|
|
2139
|
+
function Ds(t, e) {
|
|
2140
|
+
const n = Fe(e.seed), r = Math.max(1, Math.round(e.cycles ?? 1)), s = (K(t, e.period, 1) + (e.phase ?? 0)) * Math.PI * 2, o = r / Math.PI;
|
|
2141
|
+
return Oe([Math.cos(s) * o + 7.31, Math.sin(s) * o + 3.17], n, e.octaves ?? 1);
|
|
2142
|
+
}
|
|
2143
|
+
function Ls(t, e, n) {
|
|
2144
|
+
const r = Fe(n.seed), s = Math.max(1, Math.round(n.cycles ?? 1)), o = Math.max(1, Math.round(n.cyclesAlong ?? 1)), a = K(t, n.period, 1) * Math.PI * 2, i = K(e, n.periodAlong, 1) * Math.PI * 2, c = s / Math.PI, h = o / Math.PI;
|
|
2145
|
+
return Oe([Math.cos(a) * c + 5.13, Math.sin(a) * c + 9.47, Math.cos(i) * h + 2.71, Math.sin(i) * h + 6.29], r, n.octaves ?? 1);
|
|
2146
|
+
}
|
|
2147
|
+
const Fe = (t) => typeof t == "string" ? dr(t) : (t ?? 0) >>> 0;
|
|
2148
|
+
function Oe(t, e, n) {
|
|
2149
|
+
const r = Math.max(1, Math.min(6, Math.round(n)));
|
|
2150
|
+
let s = 0, o = 1, a = 0;
|
|
2151
|
+
for (let i = 0; i < r; i++) {
|
|
2152
|
+
const c = 2 ** i;
|
|
2153
|
+
s += o * Sr(t.map((h) => h * c), e + i * 1013), a += o, o *= 0.5;
|
|
2154
|
+
}
|
|
2155
|
+
return s / a;
|
|
2156
|
+
}
|
|
2157
|
+
function Sr(t, e) {
|
|
2158
|
+
const n = t.length, r = t.map(Math.floor), o = t.map((i, c) => i - r[c]).map((i) => i * i * (3 - 2 * i));
|
|
2159
|
+
let a = 0;
|
|
2160
|
+
for (let i = 0; i < 1 << n; i++) {
|
|
2161
|
+
let c = 1;
|
|
2162
|
+
const h = [];
|
|
2163
|
+
for (let l = 0; l < n; l++) {
|
|
2164
|
+
const u = i >> l & 1;
|
|
2165
|
+
c *= u ? o[l] : 1 - o[l], h.push(r[l] + u);
|
|
2166
|
+
}
|
|
2167
|
+
c !== 0 && (a += c * vr(h, e));
|
|
2168
|
+
}
|
|
2169
|
+
return a;
|
|
2170
|
+
}
|
|
2171
|
+
function vr(t, e) {
|
|
2172
|
+
let n = (e ^ 2654435769) >>> 0;
|
|
2173
|
+
for (const r of t)
|
|
2174
|
+
n = Math.imul(n ^ (r | 0), 2246822507) >>> 0, n = (n ^ n >>> 13) >>> 0, n = Math.imul(n, 3266489909) >>> 0, n = (n ^ n >>> 16) >>> 0;
|
|
2175
|
+
return n / 4294967296 * 2 - 1;
|
|
2176
|
+
}
|
|
2177
|
+
function Fs(t, e = {}) {
|
|
2178
|
+
if (t.length === 0) throw new Error("curve: needs at least one key");
|
|
2179
|
+
const r = { id: "curve", target: "curve", property: "value", keyframes: t.map((o) => ({ time: o.at, value: o.value, easing: o.easing })).sort((o, a) => o.time - a.time), interpolation: e.interpolation }, s = new ut(r);
|
|
2180
|
+
return (o) => s.getValueAtTime(o);
|
|
2181
|
+
}
|
|
2182
|
+
function Os(t, e) {
|
|
2183
|
+
return e * gt({ bpm: t.bpm });
|
|
2184
|
+
}
|
|
2185
|
+
function Ns(t, e) {
|
|
2186
|
+
const n = Math.max(1, Math.round(t / gt(e)));
|
|
2187
|
+
return { beats: n, grid: { ...e, bpm: n * 6e4 / t } };
|
|
2188
|
+
}
|
|
2189
|
+
function Xs(t, e, n = {}) {
|
|
2190
|
+
const r = Math.max(1e-6, n.attack ?? 0.05), s = Math.max(1e-6, n.decay ?? 0.4), o = pt(e, t), a = o - Math.floor(o), i = a < r ? a / r : Math.max(0, 1 - (a - r) / s), c = n.barAccent ?? 0;
|
|
2191
|
+
if (c <= 0) return i;
|
|
2192
|
+
const h = Math.max(1, Math.round(e.beatsPerBar ?? 4)), u = (Math.floor(o) % h + h) % h === 0;
|
|
2193
|
+
return i * (u ? 1 + c : 1) / (1 + c);
|
|
2194
|
+
}
|
|
2195
|
+
function Ys(t, e, n = {}) {
|
|
2196
|
+
const r = n.fps ?? 30, s = Math.max(1, Math.round(e / r)), o = Math.max(1, Math.ceil(t.length / s)), a = new Float32Array(o), i = Math.min(0.99, Math.max(0, n.smoothing ?? 0.5));
|
|
2197
|
+
let c = 0, h = 0;
|
|
2198
|
+
for (let l = 0; l < o; l++) {
|
|
2199
|
+
let u = 0;
|
|
2200
|
+
const d = l * s, f = Math.min(t.length, d + s);
|
|
2201
|
+
for (let m = d; m < f; m++) u += t[m] * t[m];
|
|
2202
|
+
const g = f > d ? Math.sqrt(u / (f - d)) : 0;
|
|
2203
|
+
c = g > c ? g : c * i + g * (1 - i), a[l] = c, h = Math.max(h, c);
|
|
2204
|
+
}
|
|
2205
|
+
if (n.normalize !== !1 && h > 0) for (let l = 0; l < o; l++) a[l] /= h;
|
|
2206
|
+
return a;
|
|
2207
|
+
}
|
|
2208
|
+
function zs(t, e, n = 30, r) {
|
|
2209
|
+
if (t.length === 0) return 0;
|
|
2210
|
+
const o = (r ? K(e, r) * r : e) * n / 1e3, a = Math.floor(o), i = t[Math.min(t.length - 1, Math.max(0, a))], c = t[Math.min(t.length - 1, Math.max(0, a + 1))];
|
|
2211
|
+
return i + (c - i) * (o - a);
|
|
2212
|
+
}
|
|
2213
|
+
const Pr = {
|
|
2214
|
+
"16:9": 16 / 9,
|
|
2215
|
+
"2.39:1": 2.39,
|
|
2216
|
+
"4:3": 4 / 3,
|
|
2217
|
+
"1:1": 1,
|
|
2218
|
+
"9:16": 9 / 16,
|
|
2219
|
+
"4:5": 4 / 5
|
|
2220
|
+
}, Ne = (t) => typeof t == "number" ? t : Pr[t];
|
|
2221
|
+
function js(t, e) {
|
|
2222
|
+
const n = Ne(e), r = t.width / t.height;
|
|
2223
|
+
if (n >= r) {
|
|
2224
|
+
const o = t.width / n;
|
|
2225
|
+
return { x: 0, y: (t.height - o) / 2, width: t.width, height: o };
|
|
2226
|
+
}
|
|
2227
|
+
const s = t.height * n;
|
|
2228
|
+
return { x: (t.width - s) / 2, y: 0, width: s, height: t.height };
|
|
2229
|
+
}
|
|
2230
|
+
function Us(t, e) {
|
|
2231
|
+
const n = Ne(t), r = (s) => Math.max(2, Math.round(s / 2) * 2);
|
|
2232
|
+
return "width" in e ? { width: r(e.width), height: r(e.width / n) } : { width: r(e.height * n), height: r(e.height) };
|
|
2233
|
+
}
|
|
2234
|
+
function Vs(t, e = {}) {
|
|
2235
|
+
const n = (r) => ({
|
|
2236
|
+
x: t.x + t.width * (1 - r) / 2,
|
|
2237
|
+
y: t.y + t.height * (1 - r) / 2,
|
|
2238
|
+
width: t.width * r,
|
|
2239
|
+
height: t.height * r
|
|
2240
|
+
});
|
|
2241
|
+
return { action: n(e.action ?? 0.9), title: n(e.title ?? 0.8) };
|
|
2242
|
+
}
|
|
2243
|
+
const F = (t) => Math.round(t * 1e3) / 1e3;
|
|
2244
|
+
function Bs(t, e = {}) {
|
|
2117
2245
|
if (t.length === 0) return "";
|
|
2118
|
-
const n = e.curviness ?? 1,
|
|
2119
|
-
let o = `M${
|
|
2120
|
-
if (
|
|
2121
|
-
const a = (c) =>
|
|
2246
|
+
const n = e.curviness ?? 1, r = e.closed ?? !1, s = t.length;
|
|
2247
|
+
let o = `M${F(t[0].x)} ${F(t[0].y)}`;
|
|
2248
|
+
if (s === 1) return o;
|
|
2249
|
+
const a = (c) => r ? t[(c % s + s) % s] : t[Math.max(0, Math.min(s - 1, c))], i = r ? s : s - 1;
|
|
2122
2250
|
for (let c = 0; c < i; c++) {
|
|
2123
|
-
const
|
|
2251
|
+
const h = a(c - 1), l = a(c), u = a(c + 1), d = a(c + 2);
|
|
2124
2252
|
if (n === 0) {
|
|
2125
|
-
o += ` L${
|
|
2253
|
+
o += ` L${F(u.x)} ${F(u.y)}`;
|
|
2126
2254
|
continue;
|
|
2127
2255
|
}
|
|
2128
|
-
const
|
|
2129
|
-
o += ` C${
|
|
2256
|
+
const f = n / 6, g = l.x + (u.x - h.x) * f, m = l.y + (u.y - h.y) * f, M = u.x - (d.x - l.x) * f, y = u.y - (d.y - l.y) * f;
|
|
2257
|
+
o += ` C${F(g)} ${F(m)} ${F(M)} ${F(y)} ${F(u.x)} ${F(u.y)}`;
|
|
2130
2258
|
}
|
|
2131
|
-
return
|
|
2259
|
+
return r ? `${o} Z` : o;
|
|
2132
2260
|
}
|
|
2133
|
-
const
|
|
2261
|
+
const C = (t, e = 0) => {
|
|
2134
2262
|
const n = parseFloat(t ?? "");
|
|
2135
2263
|
return Number.isFinite(n) ? n : e;
|
|
2136
2264
|
};
|
|
2137
|
-
function
|
|
2265
|
+
function Ir(t) {
|
|
2138
2266
|
const e = (t ?? "").trim().split(/[\s,]+/).filter(Boolean).map(Number), n = [];
|
|
2139
|
-
for (let
|
|
2267
|
+
for (let r = 0; r + 1 < e.length; r += 2) n.push({ x: e[r], y: e[r + 1] });
|
|
2140
2268
|
return n;
|
|
2141
2269
|
}
|
|
2142
|
-
function
|
|
2270
|
+
function Hs(t) {
|
|
2143
2271
|
const e = t.attributes;
|
|
2144
2272
|
switch (t.tag.toLowerCase()) {
|
|
2145
2273
|
case "path":
|
|
2146
2274
|
return e.d ?? null;
|
|
2147
2275
|
case "circle":
|
|
2148
2276
|
case "ellipse": {
|
|
2149
|
-
const n =
|
|
2150
|
-
return `M${n +
|
|
2277
|
+
const n = C(e.cx), r = C(e.cy), s = t.tag.toLowerCase() === "circle" ? C(e.r) : C(e.rx), o = t.tag.toLowerCase() === "circle" ? C(e.r) : C(e.ry);
|
|
2278
|
+
return `M${n + s} ${r} A${s} ${o} 0 1 1 ${n - s} ${r} A${s} ${o} 0 1 1 ${n + s} ${r} Z`;
|
|
2151
2279
|
}
|
|
2152
2280
|
case "rect": {
|
|
2153
|
-
const n =
|
|
2154
|
-
let a = e.rx != null ?
|
|
2155
|
-
return a = Math.min(a,
|
|
2281
|
+
const n = C(e.x), r = C(e.y), s = C(e.width), o = C(e.height);
|
|
2282
|
+
let a = e.rx != null ? C(e.rx) : e.ry != null ? C(e.ry) : 0, i = e.ry != null ? C(e.ry) : a;
|
|
2283
|
+
return a = Math.min(a, s / 2), i = Math.min(i, o / 2), a === 0 || i === 0 ? `M${n} ${r} H${n + s} V${r + o} H${n} Z` : `M${n + a} ${r} H${n + s - a} A${a} ${i} 0 0 1 ${n + s} ${r + i} V${r + o - i} A${a} ${i} 0 0 1 ${n + s - a} ${r + o} H${n + a} A${a} ${i} 0 0 1 ${n} ${r + o - i} V${r + i} A${a} ${i} 0 0 1 ${n + a} ${r} Z`;
|
|
2156
2284
|
}
|
|
2157
2285
|
case "line":
|
|
2158
|
-
return `M${
|
|
2286
|
+
return `M${C(e.x1)} ${C(e.y1)} L${C(e.x2)} ${C(e.y2)}`;
|
|
2159
2287
|
case "polyline":
|
|
2160
2288
|
case "polygon": {
|
|
2161
|
-
const n =
|
|
2289
|
+
const n = Ir(e.points);
|
|
2162
2290
|
if (n.length === 0) return null;
|
|
2163
|
-
const
|
|
2164
|
-
return t.tag.toLowerCase() === "polygon" ? `${
|
|
2291
|
+
const r = n.map((s, o) => `${o === 0 ? "M" : "L"}${s.x} ${s.y}`).join(" ");
|
|
2292
|
+
return t.tag.toLowerCase() === "polygon" ? `${r} Z` : r;
|
|
2165
2293
|
}
|
|
2166
2294
|
default:
|
|
2167
2295
|
return null;
|
|
2168
2296
|
}
|
|
2169
2297
|
}
|
|
2170
|
-
function
|
|
2171
|
-
const
|
|
2298
|
+
function qs(t, e, n) {
|
|
2299
|
+
const r = Math.max(2, Math.round(n.samples ?? 32)), s = Math.max(0, n.length), o = n.since !== void 0 ? Math.max(e - s, n.since) : e - s;
|
|
2172
2300
|
if (o >= e) return [];
|
|
2173
2301
|
const a = n.period, i = [];
|
|
2174
|
-
for (let c = 0; c <
|
|
2175
|
-
const
|
|
2176
|
-
i.push({ at: t(
|
|
2302
|
+
for (let c = 0; c < r; c++) {
|
|
2303
|
+
const h = o + (e - o) * c / (r - 1), l = a && a > 0 && c < r - 1 ? (h % a + a) % a : h;
|
|
2304
|
+
i.push({ at: t(l), time: h, age: s > 0 ? (e - h) / s : 0 });
|
|
2177
2305
|
}
|
|
2178
2306
|
return i;
|
|
2179
2307
|
}
|
|
2180
|
-
const
|
|
2181
|
-
function
|
|
2182
|
-
const e = [], n = [],
|
|
2183
|
-
for (let i = o + a; i >= 0 && i <
|
|
2184
|
-
const c = (t[i].x - t[o].x) * a,
|
|
2185
|
-
if (
|
|
2308
|
+
const $r = 2.5;
|
|
2309
|
+
function Ws(t) {
|
|
2310
|
+
const e = [], n = [], r = t.length, s = (o, a) => {
|
|
2311
|
+
for (let i = o + a; i >= 0 && i < r; i += a) {
|
|
2312
|
+
const c = (t[i].x - t[o].x) * a, h = (t[i].y - t[o].y) * a, l = Math.hypot(c, h);
|
|
2313
|
+
if (l > 1e-9) return [c / l, h / l];
|
|
2186
2314
|
}
|
|
2187
2315
|
return null;
|
|
2188
2316
|
};
|
|
2189
|
-
for (let o = 0; o <
|
|
2190
|
-
const a = t[o], i =
|
|
2191
|
-
let u =
|
|
2192
|
-
const
|
|
2193
|
-
|
|
2194
|
-
const
|
|
2195
|
-
e.push({ x: a.x -
|
|
2317
|
+
for (let o = 0; o < r; o++) {
|
|
2318
|
+
const a = t[o], i = s(o, -1), c = s(o, 1), h = i ?? c ?? [1, 0], l = c ?? i ?? [1, 0];
|
|
2319
|
+
let u = h[0] + l[0], d = h[1] + l[1];
|
|
2320
|
+
const f = Math.hypot(u, d);
|
|
2321
|
+
f < 1e-9 ? (u = h[0], d = h[1]) : (u /= f, d /= f);
|
|
2322
|
+
const g = u * h[0] + d * h[1], m = Math.min($r, 1 / Math.max(g, 1e-6)), M = a.width / 2 * m;
|
|
2323
|
+
e.push({ x: a.x - d * M, y: a.y + u * M }), n.push({ x: a.x + d * M, y: a.y - u * M });
|
|
2196
2324
|
}
|
|
2197
2325
|
return { left: e, right: n };
|
|
2198
2326
|
}
|
|
2199
|
-
function
|
|
2327
|
+
function Qs(t) {
|
|
2200
2328
|
const e = t.length;
|
|
2201
2329
|
if (e < 2) return null;
|
|
2202
2330
|
const n = t[e - 1];
|
|
2203
|
-
for (let
|
|
2204
|
-
const
|
|
2331
|
+
for (let r = e - 2; r >= 0; r--) {
|
|
2332
|
+
const s = n.x - t[r].x, o = n.y - t[r].y, a = Math.hypot(s, o);
|
|
2205
2333
|
if (a > 1e-9)
|
|
2206
|
-
return { x: n.x, y: n.y, radius: n.width / 2, start: Math.atan2(
|
|
2334
|
+
return { x: n.x, y: n.y, radius: n.width / 2, start: Math.atan2(s / a, -o / a) };
|
|
2207
2335
|
}
|
|
2208
2336
|
return null;
|
|
2209
2337
|
}
|
|
2210
|
-
|
|
2338
|
+
const Gs = { scale: 1, turn: 0, x: 0, y: 0 };
|
|
2339
|
+
function Ks(t = {}) {
|
|
2340
|
+
return { scale: t.scale ?? 1, turn: t.turn ?? 0, x: t.x ?? 0, y: t.y ?? 0 };
|
|
2341
|
+
}
|
|
2342
|
+
function Rr(t, e, n) {
|
|
2343
|
+
const { ax: r, ay: s } = yt(t, e);
|
|
2344
|
+
return { scale: t, turn: e, x: n.x - (r * n.x - s * n.y), y: n.y - (s * n.x + r * n.y) };
|
|
2345
|
+
}
|
|
2346
|
+
function Xe(t, e) {
|
|
2347
|
+
const { ax: n, ay: r } = yt(t.scale, t.turn);
|
|
2348
|
+
return { x: n * e.x - r * e.y + t.x, y: r * e.x + n * e.y + t.y };
|
|
2349
|
+
}
|
|
2350
|
+
function Zs(t, e) {
|
|
2351
|
+
const n = Xe(e, { x: t.x, y: t.y });
|
|
2352
|
+
return { scale: t.scale * e.scale, turn: t.turn + e.turn, x: n.x, y: n.y };
|
|
2353
|
+
}
|
|
2354
|
+
function Js(t) {
|
|
2355
|
+
if (t.scale === 0) throw new Error("invertSimilarity: a scale of 0 cannot be undone");
|
|
2356
|
+
const e = { scale: 1 / t.scale, turn: -t.turn, x: 0, y: 0 }, n = Xe(e, { x: t.x, y: t.y });
|
|
2357
|
+
return { ...e, x: -n.x, y: -n.y };
|
|
2358
|
+
}
|
|
2359
|
+
function Cr(t) {
|
|
2360
|
+
const { ax: e, ay: n } = yt(t.scale, t.turn), r = 1 - e, s = -n, o = r * r + s * s;
|
|
2361
|
+
return o < 1e-18 ? null : { x: (t.x * r + t.y * s) / o, y: (t.y * r - t.x * s) / o };
|
|
2362
|
+
}
|
|
2363
|
+
function to(t, e) {
|
|
2364
|
+
if (t.scale <= 0) throw new Error("powSimilarity: the scale must be positive");
|
|
2365
|
+
const n = Math.pow(t.scale, e), r = t.turn * e, s = Cr(t);
|
|
2366
|
+
return s ? Rr(n, r, s) : { scale: n, turn: r, x: t.x * e, y: t.y * e };
|
|
2367
|
+
}
|
|
2368
|
+
function eo(t) {
|
|
2369
|
+
const { ax: e, ay: n } = yt(t.scale, t.turn);
|
|
2370
|
+
return [e, n, -n, e, t.x, t.y];
|
|
2371
|
+
}
|
|
2372
|
+
const yt = (t, e) => {
|
|
2373
|
+
const n = e * Math.PI / 180;
|
|
2374
|
+
return { ax: t * Math.cos(n), ay: t * Math.sin(n) };
|
|
2375
|
+
};
|
|
2376
|
+
function Nt([t, e, n], r = {}) {
|
|
2377
|
+
const s = r.scale ?? 1, o = r.centre ?? { x: 0, y: 0 }, a = Math.sqrt(3) / 2;
|
|
2378
|
+
return { x: o.x + (t - e) * a * s, y: o.y + ((t + e) * 0.5 - n) * s };
|
|
2379
|
+
}
|
|
2380
|
+
const Ye = ([t, e, n]) => t + e + n;
|
|
2381
|
+
function ze(t, e = {}) {
|
|
2382
|
+
const [n, r, s] = t.min, [o, a, i] = t.max, c = (d) => Nt(d, e), h = [(n + o) / 2, (r + a) / 2, (s + i) / 2], l = Ye(h), u = [
|
|
2383
|
+
{ side: "top", depth: l, tag: t.tag, points: [c([n, r, i]), c([o, r, i]), c([o, a, i]), c([n, a, i])] },
|
|
2384
|
+
{ side: "left", depth: l, tag: t.tag, points: [c([n, a, s]), c([o, a, s]), c([o, a, i]), c([n, a, i])] },
|
|
2385
|
+
{ side: "right", depth: l, tag: t.tag, points: [c([o, r, s]), c([o, a, s]), c([o, a, i]), c([o, r, i])] }
|
|
2386
|
+
];
|
|
2387
|
+
return t.hide ? u.filter((d) => !t.hide.includes(d.side)) : u;
|
|
2388
|
+
}
|
|
2389
|
+
function je(t, e = {}) {
|
|
2390
|
+
return t.map((n) => ({ box: n, depth: Ye([(n.min[0] + n.max[0]) / 2, (n.min[1] + n.max[1]) / 2, (n.min[2] + n.max[2]) / 2]) })).sort((n, r) => n.depth - r.depth).flatMap(({ box: n }) => ze(n, e));
|
|
2391
|
+
}
|
|
2392
|
+
function no(t = {}) {
|
|
2393
|
+
const e = t.size ?? 10, r = (t.thickness ?? 2) / 2, s = [
|
|
2394
|
+
{ tag: 0, min: [-r, -r, -r], max: [e - r, r, r] },
|
|
2395
|
+
{ tag: 1, min: [e - r, -r, -r], max: [e + r, e - r, r] },
|
|
2396
|
+
{ tag: 2, min: [e - r, e - r, -r], max: [e + r, e + r, e] }
|
|
2397
|
+
], o = t.centre ?? { x: 0, y: 0 }, a = Nt([2 * e / 3, e / 3, e / 3], { scale: t.scale }), i = { centre: { x: o.x - a.x, y: o.y - a.y }, scale: t.scale };
|
|
2398
|
+
return { boxes: s, faces: [...je(s, i), ...ze({ ...s[0], hide: ["right"] }, i)] };
|
|
2399
|
+
}
|
|
2400
|
+
function ro(t = {}) {
|
|
2401
|
+
const e = Math.max(2, Math.round(t.steps ?? 8)), n = t.tread ?? 1.5, r = t.rise ?? 0.25, s = t.width ?? 3, o = t.base ?? 1.5, a = Math.max(1, Math.round(e * (n - 2 * r) / (n + 2 * r))), i = 2 * (e + a), c = n * (e - a) / i, h = [
|
|
2402
|
+
{ dir: [1, 0, 0], across: [0, 1, 0], count: e },
|
|
2403
|
+
{ dir: [0, 1, 0], across: [-1, 0, 0], count: e },
|
|
2404
|
+
{ dir: [-1, 0, 0], across: [0, -1, 0], count: a },
|
|
2405
|
+
{ dir: [0, -1, 0], across: [1, 0, 0], count: a }
|
|
2406
|
+
], l = [];
|
|
2407
|
+
let u = [0, 0, 0], d = 0;
|
|
2408
|
+
for (const y of h) {
|
|
2409
|
+
for (let p = 0; p < y.count; p++) {
|
|
2410
|
+
const _ = d * c, w = [u[0] + y.dir[0] * p * n, u[1] + y.dir[1] * p * n, 0], x = [w[0] + y.dir[0] * n + y.across[0] * s, w[1] + y.dir[1] * n + y.across[1] * s, 0];
|
|
2411
|
+
l.push({
|
|
2412
|
+
tag: d,
|
|
2413
|
+
min: [Math.min(w[0], x[0]), Math.min(w[1], x[1]), 0],
|
|
2414
|
+
max: [Math.max(w[0], x[0]), Math.max(w[1], x[1]), _ + o]
|
|
2415
|
+
}), d++;
|
|
2416
|
+
}
|
|
2417
|
+
u = [u[0] + y.dir[0] * y.count * n, u[1] + y.dir[1] * y.count * n, 0];
|
|
2418
|
+
}
|
|
2419
|
+
const f = i * c, g = t.centre ?? { x: 0, y: 0 }, m = Nt([e * n / 2, e * n / 2, f / 2 + o], { scale: t.scale }), M = { centre: { x: g.x - m.x, y: g.y - m.y }, scale: t.scale };
|
|
2420
|
+
return { boxes: l, faces: je(l, M), rise: c };
|
|
2421
|
+
}
|
|
2422
|
+
function Er(t, e, n) {
|
|
2423
|
+
let r = 0;
|
|
2424
|
+
for (const s of t) {
|
|
2425
|
+
const o = (e - s.x) ** 2 + (n - s.y) ** 2;
|
|
2426
|
+
r += o > 1e-9 ? s.r * s.r / o : 1e9;
|
|
2427
|
+
}
|
|
2428
|
+
return r;
|
|
2429
|
+
}
|
|
2430
|
+
function so(t, e = {}) {
|
|
2431
|
+
if (t.length === 0) return [];
|
|
2432
|
+
const n = e.threshold ?? 1, r = Math.max(0.5, e.cell ?? 4), s = Math.sqrt(1 / n) * 1.6, o = e.bounds ?? {
|
|
2433
|
+
x: Math.min(...t.map((f) => f.x - f.r * s)),
|
|
2434
|
+
y: Math.min(...t.map((f) => f.y - f.r * s)),
|
|
2435
|
+
width: Math.max(...t.map((f) => f.x + f.r * s)) - Math.min(...t.map((f) => f.x - f.r * s)),
|
|
2436
|
+
height: Math.max(...t.map((f) => f.y + f.r * s)) - Math.min(...t.map((f) => f.y - f.r * s))
|
|
2437
|
+
}, a = Math.max(2, Math.ceil(o.width / r) + 1), i = Math.max(2, Math.ceil(o.height / r) + 1), c = new Float64Array(a * i);
|
|
2438
|
+
for (let f = 0; f < i; f++) for (let g = 0; g < a; g++) c[f * a + g] = Er(t, o.x + g * r, o.y + f * r) - n;
|
|
2439
|
+
const h = (f, g) => c[g * a + f], l = (f, g, m, M, y, p) => {
|
|
2440
|
+
const _ = m === p ? 0.5 : m / (m - p);
|
|
2441
|
+
return { x: f + (M - f) * _, y: g + (y - g) * _ };
|
|
2442
|
+
}, u = [];
|
|
2443
|
+
for (let f = 0; f + 1 < i; f++)
|
|
2444
|
+
for (let g = 0; g + 1 < a; g++) {
|
|
2445
|
+
const m = o.x + g * r, M = o.y + f * r, y = m + r, p = M + r, _ = [h(g, f), h(g + 1, f), h(g + 1, f + 1), h(g, f + 1)], w = (_[0] > 0 ? 1 : 0) | (_[1] > 0 ? 2 : 0) | (_[2] > 0 ? 4 : 0) | (_[3] > 0 ? 8 : 0);
|
|
2446
|
+
if (w === 0 || w === 15) continue;
|
|
2447
|
+
const x = () => l(m, M, _[0], y, M, _[1]), S = () => l(y, M, _[1], y, p, _[2]), k = () => l(m, p, _[3], y, p, _[2]), P = () => l(m, M, _[0], m, p, _[3]), b = (_[0] + _[1] + _[2] + _[3]) / 4 > 0;
|
|
2448
|
+
switch (w) {
|
|
2449
|
+
case 1:
|
|
2450
|
+
case 14:
|
|
2451
|
+
u.push([P(), x()]);
|
|
2452
|
+
break;
|
|
2453
|
+
case 2:
|
|
2454
|
+
case 13:
|
|
2455
|
+
u.push([x(), S()]);
|
|
2456
|
+
break;
|
|
2457
|
+
case 3:
|
|
2458
|
+
case 12:
|
|
2459
|
+
u.push([P(), S()]);
|
|
2460
|
+
break;
|
|
2461
|
+
case 4:
|
|
2462
|
+
case 11:
|
|
2463
|
+
u.push([S(), k()]);
|
|
2464
|
+
break;
|
|
2465
|
+
case 6:
|
|
2466
|
+
case 9:
|
|
2467
|
+
u.push([x(), k()]);
|
|
2468
|
+
break;
|
|
2469
|
+
case 7:
|
|
2470
|
+
case 8:
|
|
2471
|
+
u.push([P(), k()]);
|
|
2472
|
+
break;
|
|
2473
|
+
case 5:
|
|
2474
|
+
b ? u.push([P(), k()], [x(), S()]) : u.push([P(), x()], [S(), k()]);
|
|
2475
|
+
break;
|
|
2476
|
+
case 10:
|
|
2477
|
+
b ? u.push([P(), x()], [S(), k()]) : u.push([P(), k()], [x(), S()]);
|
|
2478
|
+
break;
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
const d = Dr(u);
|
|
2482
|
+
return e.smooth === !1 ? d : d.map((f) => ce(ce(f)));
|
|
2483
|
+
}
|
|
2484
|
+
function Dr(t) {
|
|
2485
|
+
const e = (o) => `${Math.round(o.x * 1e3)},${Math.round(o.y * 1e3)}`, n = /* @__PURE__ */ new Map();
|
|
2486
|
+
t.forEach(([o, a], i) => {
|
|
2487
|
+
for (const c of [o, a]) {
|
|
2488
|
+
const h = e(c);
|
|
2489
|
+
n.has(h) || n.set(h, []), n.get(h).push(i);
|
|
2490
|
+
}
|
|
2491
|
+
});
|
|
2492
|
+
const r = new Array(t.length).fill(!1), s = [];
|
|
2493
|
+
for (let o = 0; o < t.length; o++) {
|
|
2494
|
+
if (r[o]) continue;
|
|
2495
|
+
r[o] = !0;
|
|
2496
|
+
const a = [t[o][0], t[o][1]];
|
|
2497
|
+
let i = t[o][1];
|
|
2498
|
+
for (; ; ) {
|
|
2499
|
+
const c = (n.get(e(i)) ?? []).find((u) => !r[u]);
|
|
2500
|
+
if (c === void 0) break;
|
|
2501
|
+
r[c] = !0;
|
|
2502
|
+
const [h, l] = t[c];
|
|
2503
|
+
if (i = e(h) === e(i) ? l : h, e(i) === e(a[0])) break;
|
|
2504
|
+
a.push(i);
|
|
2505
|
+
}
|
|
2506
|
+
a.length >= 3 && s.push(a);
|
|
2507
|
+
}
|
|
2508
|
+
return s;
|
|
2509
|
+
}
|
|
2510
|
+
function ce(t) {
|
|
2511
|
+
const e = [];
|
|
2512
|
+
for (let n = 0; n < t.length; n++) {
|
|
2513
|
+
const r = t[n], s = t[(n + 1) % t.length];
|
|
2514
|
+
e.push({ x: r.x * 0.75 + s.x * 0.25, y: r.y * 0.75 + s.y * 0.25 }, { x: r.x * 0.25 + s.x * 0.75, y: r.y * 0.25 + s.y * 0.75 });
|
|
2515
|
+
}
|
|
2516
|
+
return e;
|
|
2517
|
+
}
|
|
2518
|
+
function oo(t) {
|
|
2519
|
+
const e = Math.min(1, Math.max(0, t.progress));
|
|
2520
|
+
if (e <= 0) return [];
|
|
2521
|
+
const n = t.width / 2, r = n * (0.55 + 0.75 * e), s = Math.max(t.length * e, r * 1.2), o = t.x, a = t.y + s - r, i = Math.max(0.1, n * (0.35 - 0.3 * e)), c = a - Math.sqrt(Math.max(0, r * r - i * i)), h = Math.max(0, c - t.y), l = 8, u = [], d = [];
|
|
2522
|
+
for (let p = 0; p <= l; p++) {
|
|
2523
|
+
const _ = p / l, w = i + (n - i) * Math.pow(1 - _, 1.6 + 1.4 * e);
|
|
2524
|
+
u.push({ x: o - w, y: t.y + h * _ }), d.push({ x: o + w, y: t.y + h * _ });
|
|
2525
|
+
}
|
|
2526
|
+
const f = Math.max(8, Math.round(t.segments ?? 12)), g = Math.acos(Math.min(1, i / r)), m = -g, M = Math.PI + g, y = [];
|
|
2527
|
+
for (let p = 1; p < f; p++) {
|
|
2528
|
+
const _ = m + (M - m) * p / f;
|
|
2529
|
+
y.push({ x: o + Math.cos(_) * r, y: a + Math.sin(_) * r });
|
|
2530
|
+
}
|
|
2531
|
+
return [...d, ...y, ...u.reverse()];
|
|
2532
|
+
}
|
|
2533
|
+
function ao(t) {
|
|
2534
|
+
const e = Math.min(1, Math.max(0, t.grow ?? 1)), n = e >= 1 ? 1 : 1 - Math.pow(1 - e, 3) + 0.08 * Math.sin(e * Math.PI) * e, r = t.r * Math.max(0, n);
|
|
2535
|
+
if (r <= 0) return [];
|
|
2536
|
+
const s = Math.max(12, Math.round(t.segments ?? 48)), o = t.wobble ?? 0.05, a = t.time ?? 0, i = t.period ? a / t.period : a / 2500, c = (i - Math.floor(i)) * Math.PI * 2, h = t.seed ?? 0, l = [];
|
|
2537
|
+
for (let u = 0; u < s; u++) {
|
|
2538
|
+
const d = u / s * Math.PI * 2, f = 1 + o * (Math.sin(2 * d + c + h) * 0.6 + Math.sin(3 * d - 2 * c + h * 1.7) * 0.4);
|
|
2539
|
+
l.push({ x: t.x + Math.cos(d) * r * f, y: t.y + Math.sin(d) * r * f });
|
|
2540
|
+
}
|
|
2541
|
+
return l;
|
|
2542
|
+
}
|
|
2543
|
+
function io(t) {
|
|
2544
|
+
const e = t.progress;
|
|
2545
|
+
if (e <= 0 || e >= 1) return [];
|
|
2546
|
+
const n = Math.max(3, Math.round(t.pieces ?? 8)), r = [], s = t.r * (1 + 1.2 * e), o = Math.PI * 2 / n * 0.6 * (1 - e);
|
|
2547
|
+
for (let a = 0; a < n; a++) {
|
|
2548
|
+
const i = a / n * Math.PI * 2 + 0.3, c = [];
|
|
2549
|
+
for (let h = 0; h <= 4; h++) {
|
|
2550
|
+
const l = i - o / 2 + o * h / 4;
|
|
2551
|
+
c.push({ x: t.x + Math.cos(l) * s, y: t.y + Math.sin(l) * s });
|
|
2552
|
+
}
|
|
2553
|
+
r.push(c);
|
|
2554
|
+
}
|
|
2555
|
+
return r;
|
|
2556
|
+
}
|
|
2557
|
+
function co(t, e = {}) {
|
|
2558
|
+
const n = Math.max(0.05, 1 + t);
|
|
2559
|
+
return { sx: e.keep === "volume" ? 1 / Math.sqrt(n) : 1 / n, sy: n };
|
|
2560
|
+
}
|
|
2561
|
+
function uo(t, e, n = { x: 0, y: 0 }) {
|
|
2562
|
+
return t.map((r) => ({ x: n.x + (r.x - n.x) * e.sx, y: n.y + (r.y - n.y) * e.sy }));
|
|
2563
|
+
}
|
|
2564
|
+
function Lr(t, e) {
|
|
2211
2565
|
return [t[0] + e[0], t[1] + e[1], t[2] + e[2]];
|
|
2212
2566
|
}
|
|
2213
|
-
function
|
|
2567
|
+
function Xt(t, e) {
|
|
2214
2568
|
return [t[0] - e[0], t[1] - e[1], t[2] - e[2]];
|
|
2215
2569
|
}
|
|
2216
|
-
function
|
|
2570
|
+
function Ue(t, e) {
|
|
2217
2571
|
return [t[0] * e, t[1] * e, t[2] * e];
|
|
2218
2572
|
}
|
|
2219
|
-
function
|
|
2573
|
+
function ht(t, e) {
|
|
2220
2574
|
return t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
|
|
2221
2575
|
}
|
|
2222
|
-
function
|
|
2576
|
+
function Rt(t, e) {
|
|
2223
2577
|
return [t[1] * e[2] - t[2] * e[1], t[2] * e[0] - t[0] * e[2], t[0] * e[1] - t[1] * e[0]];
|
|
2224
2578
|
}
|
|
2225
|
-
function
|
|
2579
|
+
function Yt(t) {
|
|
2226
2580
|
return Math.hypot(t[0], t[1], t[2]);
|
|
2227
2581
|
}
|
|
2228
|
-
function
|
|
2229
|
-
return
|
|
2582
|
+
function Fr(t, e) {
|
|
2583
|
+
return Yt(Xt(t, e));
|
|
2230
2584
|
}
|
|
2231
|
-
function
|
|
2232
|
-
const e =
|
|
2233
|
-
return e === 0 ? [0, 0, 0] :
|
|
2585
|
+
function Ct(t) {
|
|
2586
|
+
const e = Yt(t);
|
|
2587
|
+
return e === 0 ? [0, 0, 0] : Ue(t, 1 / e);
|
|
2234
2588
|
}
|
|
2235
|
-
function
|
|
2589
|
+
function Or(t, e, n) {
|
|
2236
2590
|
return [t[0] + (e[0] - t[0]) * n, t[1] + (e[1] - t[1]) * n, t[2] + (e[2] - t[2]) * n];
|
|
2237
2591
|
}
|
|
2238
|
-
const
|
|
2592
|
+
const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2239
2593
|
__proto__: null,
|
|
2240
|
-
add:
|
|
2241
|
-
cross:
|
|
2242
|
-
distance:
|
|
2243
|
-
dot:
|
|
2244
|
-
length:
|
|
2245
|
-
lerp:
|
|
2246
|
-
normalize:
|
|
2247
|
-
scale:
|
|
2248
|
-
subtract:
|
|
2249
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2250
|
-
function
|
|
2594
|
+
add: Lr,
|
|
2595
|
+
cross: Rt,
|
|
2596
|
+
distance: Fr,
|
|
2597
|
+
dot: ht,
|
|
2598
|
+
length: Yt,
|
|
2599
|
+
lerp: Or,
|
|
2600
|
+
normalize: Ct,
|
|
2601
|
+
scale: Ue,
|
|
2602
|
+
subtract: Xt
|
|
2603
|
+
}, Symbol.toStringTag, { value: "Module" })), Nr = Math.PI / 180;
|
|
2604
|
+
function Xr() {
|
|
2251
2605
|
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
2252
2606
|
}
|
|
2253
|
-
function
|
|
2607
|
+
function Yr(t, e) {
|
|
2254
2608
|
const n = new Array(16);
|
|
2255
|
-
for (let
|
|
2256
|
-
for (let
|
|
2609
|
+
for (let r = 0; r < 4; r++)
|
|
2610
|
+
for (let s = 0; s < 4; s++) {
|
|
2257
2611
|
let o = 0;
|
|
2258
|
-
for (let a = 0; a < 4; a++) o += t[a * 4 +
|
|
2259
|
-
n[
|
|
2612
|
+
for (let a = 0; a < 4; a++) o += t[a * 4 + s] * e[r * 4 + a];
|
|
2613
|
+
n[r * 4 + s] = o;
|
|
2260
2614
|
}
|
|
2261
2615
|
return n;
|
|
2262
2616
|
}
|
|
2263
|
-
function
|
|
2617
|
+
function zr(t) {
|
|
2264
2618
|
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, t[0], t[1], t[2], 1];
|
|
2265
2619
|
}
|
|
2266
|
-
function
|
|
2620
|
+
function jr(t) {
|
|
2267
2621
|
return [t[0], 0, 0, 0, 0, t[1], 0, 0, 0, 0, t[2], 0, 0, 0, 0, 1];
|
|
2268
2622
|
}
|
|
2269
|
-
function
|
|
2270
|
-
const [e, n,
|
|
2623
|
+
function Ve(t) {
|
|
2624
|
+
const [e, n, r, s] = t;
|
|
2271
2625
|
return [
|
|
2272
|
-
1 - 2 * (n * n +
|
|
2273
|
-
2 * (e * n +
|
|
2274
|
-
2 * (e *
|
|
2626
|
+
1 - 2 * (n * n + r * r),
|
|
2627
|
+
2 * (e * n + r * s),
|
|
2628
|
+
2 * (e * r - n * s),
|
|
2275
2629
|
0,
|
|
2276
|
-
2 * (e * n -
|
|
2277
|
-
1 - 2 * (e * e +
|
|
2278
|
-
2 * (n *
|
|
2630
|
+
2 * (e * n - r * s),
|
|
2631
|
+
1 - 2 * (e * e + r * r),
|
|
2632
|
+
2 * (n * r + e * s),
|
|
2279
2633
|
0,
|
|
2280
|
-
2 * (e *
|
|
2281
|
-
2 * (n *
|
|
2634
|
+
2 * (e * r + n * s),
|
|
2635
|
+
2 * (n * r - e * s),
|
|
2282
2636
|
1 - 2 * (e * e + n * n),
|
|
2283
2637
|
0,
|
|
2284
2638
|
0,
|
|
@@ -2287,214 +2641,253 @@ function De(t) {
|
|
|
2287
2641
|
1
|
|
2288
2642
|
];
|
|
2289
2643
|
}
|
|
2290
|
-
function
|
|
2291
|
-
const
|
|
2292
|
-
for (let
|
|
2293
|
-
s
|
|
2294
|
-
return
|
|
2644
|
+
function Ur(t, e, n) {
|
|
2645
|
+
const r = Ve(e);
|
|
2646
|
+
for (let s = 0; s < 3; s++)
|
|
2647
|
+
r[s] *= n[0], r[4 + s] *= n[1], r[8 + s] *= n[2];
|
|
2648
|
+
return r[12] = t[0], r[13] = t[1], r[14] = t[2], r;
|
|
2295
2649
|
}
|
|
2296
|
-
function
|
|
2650
|
+
function Vr(t) {
|
|
2297
2651
|
const e = new Array(16);
|
|
2298
|
-
for (let n = 0; n < 4; n++) for (let
|
|
2652
|
+
for (let n = 0; n < 4; n++) for (let r = 0; r < 4; r++) e[r * 4 + n] = t[n * 4 + r];
|
|
2299
2653
|
return e;
|
|
2300
2654
|
}
|
|
2301
|
-
function
|
|
2302
|
-
const [e, n,
|
|
2655
|
+
function Br(t) {
|
|
2656
|
+
const [e, n, r, s, o, a, i, c, h, l, u, d, f, g, m, M] = t, y = e * a - n * o, p = e * i - r * o, _ = e * c - s * o, w = n * i - r * a, x = n * c - s * a, S = r * c - s * i, k = h * g - l * f, P = h * m - u * f, b = h * M - d * f, T = l * m - u * g, A = l * M - d * g, v = u * M - d * m, $ = y * v - p * A + _ * T + w * b - x * P + S * k;
|
|
2303
2657
|
if (Math.abs($) < 1e-12) return null;
|
|
2304
|
-
const
|
|
2658
|
+
const I = 1 / $;
|
|
2305
2659
|
return [
|
|
2306
|
-
(a *
|
|
2307
|
-
(
|
|
2308
|
-
(
|
|
2309
|
-
(u *
|
|
2310
|
-
(i *
|
|
2311
|
-
(e *
|
|
2312
|
-
(
|
|
2313
|
-
(
|
|
2314
|
-
(o *
|
|
2315
|
-
(n *
|
|
2316
|
-
(
|
|
2317
|
-
(
|
|
2318
|
-
(a *
|
|
2319
|
-
(e * T - n *
|
|
2320
|
-
(
|
|
2321
|
-
(
|
|
2660
|
+
(a * v - i * A + c * T) * I,
|
|
2661
|
+
(r * A - n * v - s * T) * I,
|
|
2662
|
+
(g * S - m * x + M * w) * I,
|
|
2663
|
+
(u * x - l * S - d * w) * I,
|
|
2664
|
+
(i * b - o * v - c * P) * I,
|
|
2665
|
+
(e * v - r * b + s * P) * I,
|
|
2666
|
+
(m * _ - f * S - M * p) * I,
|
|
2667
|
+
(h * S - u * _ + d * p) * I,
|
|
2668
|
+
(o * A - a * b + c * k) * I,
|
|
2669
|
+
(n * b - e * A - s * k) * I,
|
|
2670
|
+
(f * x - g * _ + M * y) * I,
|
|
2671
|
+
(l * _ - h * x - d * y) * I,
|
|
2672
|
+
(a * P - o * T - i * k) * I,
|
|
2673
|
+
(e * T - n * P + r * k) * I,
|
|
2674
|
+
(g * p - f * w - m * y) * I,
|
|
2675
|
+
(h * w - l * p + u * y) * I
|
|
2322
2676
|
];
|
|
2323
2677
|
}
|
|
2324
|
-
function
|
|
2325
|
-
const
|
|
2326
|
-
return [
|
|
2678
|
+
function Hr(t, e, n, r) {
|
|
2679
|
+
const s = 1 / Math.tan(t * Nr / 2), o = 1 / (n - r);
|
|
2680
|
+
return [s / e, 0, 0, 0, 0, s, 0, 0, 0, 0, (r + n) * o, -1, 0, 0, 2 * r * n * o, 0];
|
|
2327
2681
|
}
|
|
2328
|
-
function
|
|
2329
|
-
const a = 1 / (e - t), i = 1 / (
|
|
2330
|
-
return [2 * a, 0, 0, 0, 0, 2 * i, 0, 0, 0, 0, -2 * c, 0, -(e + t) * a, -(
|
|
2682
|
+
function qr(t, e, n, r, s, o) {
|
|
2683
|
+
const a = 1 / (e - t), i = 1 / (r - n), c = 1 / (o - s);
|
|
2684
|
+
return [2 * a, 0, 0, 0, 0, 2 * i, 0, 0, 0, 0, -2 * c, 0, -(e + t) * a, -(r + n) * i, -(o + s) * c, 1];
|
|
2331
2685
|
}
|
|
2332
|
-
function
|
|
2333
|
-
const
|
|
2686
|
+
function Wr(t, e, n = [0, 1, 0]) {
|
|
2687
|
+
const r = Ct(Xt(t, e)), s = Ct(Rt(n, r)), o = Rt(r, s);
|
|
2334
2688
|
return [
|
|
2335
|
-
r[0],
|
|
2336
|
-
o[0],
|
|
2337
2689
|
s[0],
|
|
2690
|
+
o[0],
|
|
2691
|
+
r[0],
|
|
2338
2692
|
0,
|
|
2339
|
-
r[1],
|
|
2340
|
-
o[1],
|
|
2341
2693
|
s[1],
|
|
2694
|
+
o[1],
|
|
2695
|
+
r[1],
|
|
2342
2696
|
0,
|
|
2343
|
-
r[2],
|
|
2344
|
-
o[2],
|
|
2345
2697
|
s[2],
|
|
2698
|
+
o[2],
|
|
2699
|
+
r[2],
|
|
2346
2700
|
0,
|
|
2347
|
-
-
|
|
2348
|
-
-
|
|
2349
|
-
-
|
|
2701
|
+
-ht(s, t),
|
|
2702
|
+
-ht(o, t),
|
|
2703
|
+
-ht(r, t),
|
|
2350
2704
|
1
|
|
2351
2705
|
];
|
|
2352
2706
|
}
|
|
2353
|
-
function
|
|
2354
|
-
const n = t[0] * e[0] + t[4] * e[1] + t[8] * e[2] + t[12],
|
|
2355
|
-
return o === 1 || o === 0 ? [n,
|
|
2707
|
+
function Qr(t, e) {
|
|
2708
|
+
const n = t[0] * e[0] + t[4] * e[1] + t[8] * e[2] + t[12], r = t[1] * e[0] + t[5] * e[1] + t[9] * e[2] + t[13], s = t[2] * e[0] + t[6] * e[1] + t[10] * e[2] + t[14], o = t[3] * e[0] + t[7] * e[1] + t[11] * e[2] + t[15];
|
|
2709
|
+
return o === 1 || o === 0 ? [n, r, s] : [n / o, r / o, s / o];
|
|
2356
2710
|
}
|
|
2357
|
-
const
|
|
2711
|
+
const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2358
2712
|
__proto__: null,
|
|
2359
|
-
compose:
|
|
2360
|
-
fromQuat:
|
|
2361
|
-
identity:
|
|
2362
|
-
invert:
|
|
2363
|
-
lookAt:
|
|
2364
|
-
multiply:
|
|
2365
|
-
orthographic:
|
|
2366
|
-
perspective:
|
|
2367
|
-
scaling:
|
|
2368
|
-
transformPoint:
|
|
2369
|
-
translation:
|
|
2370
|
-
transpose:
|
|
2713
|
+
compose: Ur,
|
|
2714
|
+
fromQuat: Ve,
|
|
2715
|
+
identity: Xr,
|
|
2716
|
+
invert: Br,
|
|
2717
|
+
lookAt: Wr,
|
|
2718
|
+
multiply: Yr,
|
|
2719
|
+
orthographic: qr,
|
|
2720
|
+
perspective: Hr,
|
|
2721
|
+
scaling: jr,
|
|
2722
|
+
transformPoint: Qr,
|
|
2723
|
+
translation: zr,
|
|
2724
|
+
transpose: Vr
|
|
2371
2725
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2372
2726
|
export {
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2727
|
+
Zr as Clock,
|
|
2728
|
+
we as DEFAULT_BAKE_INTERVAL_MS,
|
|
2729
|
+
Bt as DEFAULT_INERTIA_FRICTION,
|
|
2376
2730
|
L as DEFAULT_SPRING,
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
Xs as
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2731
|
+
Vt as FORMAT_VERSION,
|
|
2732
|
+
Pr as FRAME_ASPECTS,
|
|
2733
|
+
Gs as IDENTITY_SIMILARITY,
|
|
2734
|
+
nn as INERTIA_MAX_DURATION_MS,
|
|
2735
|
+
rr as InertiaTrackPlayer,
|
|
2736
|
+
is as MORPH_SAMPLES,
|
|
2737
|
+
Kr as ManualClock,
|
|
2738
|
+
de as SPRING_MAX_DURATION_MS,
|
|
2739
|
+
Jr as SPRING_PRESETS,
|
|
2740
|
+
et as SPRING_STEP_MS,
|
|
2741
|
+
lt as SpringSampler,
|
|
2742
|
+
nr as SpringTrackPlayer,
|
|
2743
|
+
Pe as Timeline,
|
|
2744
|
+
ut as TrackPlayer,
|
|
2745
|
+
Ms as ValueResolver,
|
|
2746
|
+
Xe as applySimilarity,
|
|
2747
|
+
Ne as aspectOf,
|
|
2748
|
+
Ys as audioEnvelope,
|
|
2749
|
+
pn as backOut,
|
|
2750
|
+
Zn as bakeEasing,
|
|
2751
|
+
Ae as bakeInertiaTrack,
|
|
2752
|
+
ke as bakeSpringTrack,
|
|
2753
|
+
pt as beatAtTime,
|
|
2754
|
+
gt as beatLength,
|
|
2755
|
+
Os as beatPeriod,
|
|
2756
|
+
Xs as beatPulse,
|
|
2757
|
+
Ot as beatTime,
|
|
2758
|
+
vs as beatsBetween,
|
|
2759
|
+
gn as bounceOut,
|
|
2760
|
+
ao as bubblePath,
|
|
2761
|
+
io as bubblePop,
|
|
2762
|
+
Is as cameraTracks,
|
|
2763
|
+
or as charactersFor,
|
|
2764
|
+
cs as clearMorphCache,
|
|
2765
|
+
os as clearPathCache,
|
|
2766
|
+
Ar as closestName,
|
|
2767
|
+
Zs as composeSimilarity,
|
|
2768
|
+
dn as createCubicBezier,
|
|
2769
|
+
$e as createRandom,
|
|
2770
|
+
er as createTrack,
|
|
2771
|
+
rs as criticalDamping,
|
|
2772
|
+
Fs as curve,
|
|
2773
|
+
_s as customBounce,
|
|
2774
|
+
xs as customEase,
|
|
2775
|
+
bs as customWiggle,
|
|
2776
|
+
fr as deserializeTimeline,
|
|
2777
|
+
hr as deserializeTrack,
|
|
2778
|
+
Ps as detectTempo,
|
|
2779
|
+
oo as dripPath,
|
|
2780
|
+
un as easeIn,
|
|
2781
|
+
me as easeInCubic,
|
|
2782
|
+
ln as easeInOut,
|
|
2783
|
+
pe as easeInOutCubic,
|
|
2784
|
+
cn as easeInOutQuad,
|
|
2785
|
+
on as easeInQuad,
|
|
2786
|
+
hn as easeOut,
|
|
2787
|
+
ge as easeOutCubic,
|
|
2788
|
+
an as easeOutQuad,
|
|
2789
|
+
kr as editDistance,
|
|
2790
|
+
mn as elasticOut,
|
|
2791
|
+
zs as envelopeAt,
|
|
2792
|
+
Jn as expandParametricEasings,
|
|
2793
|
+
ue as formatVersionFor,
|
|
2794
|
+
js as frameRect,
|
|
2795
|
+
Us as frameSize,
|
|
2796
|
+
gs as fromJSON,
|
|
2797
|
+
Lt as getEasingFunction,
|
|
2798
|
+
Te as getInterpolator,
|
|
2799
|
+
ve as getMotionPathPoint,
|
|
2800
|
+
as as getPathLength,
|
|
2801
|
+
vn as getPointAtProgress,
|
|
2802
|
+
Ge as hasKeyframes,
|
|
2803
|
+
dr as hashSeed,
|
|
2804
|
+
Ke as heldTime,
|
|
2805
|
+
mt as inertiaDuration,
|
|
2806
|
+
dt as inertiaRest,
|
|
2807
|
+
vt as inertiaValueAt,
|
|
2808
|
+
ss as inertiaVelocityAt,
|
|
2809
|
+
Qn as interpolateArray,
|
|
2810
|
+
Wn as interpolateColor,
|
|
2811
|
+
fs as interpolateMotionPath,
|
|
2443
2812
|
N as interpolateNumber,
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2813
|
+
Kn as interpolatePathString,
|
|
2814
|
+
Gn as interpolateQuaternion,
|
|
2815
|
+
oe as interpolateString,
|
|
2816
|
+
Js as invertSimilarity,
|
|
2817
|
+
Qe as isCubicBezierEasing,
|
|
2818
|
+
U as isInertiaTrack,
|
|
2819
|
+
Gr as isMotionPathPoint,
|
|
2820
|
+
he as isMotionPathTrack,
|
|
2821
|
+
St as isParametricEasing,
|
|
2822
|
+
Yn as isPathData,
|
|
2453
2823
|
V as isSpringTrack,
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
Qs as
|
|
2494
|
-
Vs as
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2824
|
+
Et as isTextTrack,
|
|
2825
|
+
ns as isUnderdamped,
|
|
2826
|
+
ys as isUnresolved,
|
|
2827
|
+
Ye as isoDepth,
|
|
2828
|
+
ze as isometricBoxFaces,
|
|
2829
|
+
je as isometricFaces,
|
|
2830
|
+
Pt as linear,
|
|
2831
|
+
Ns as loopBeats,
|
|
2832
|
+
Es as loopEase,
|
|
2833
|
+
Ds as loopNoise,
|
|
2834
|
+
lo as mat4,
|
|
2835
|
+
Ze as maxStaggerDistance,
|
|
2836
|
+
so as metaballContours,
|
|
2837
|
+
Er as metaballField,
|
|
2838
|
+
Xn as morphPath,
|
|
2839
|
+
ws as narrationMarkers,
|
|
2840
|
+
ks as narrationSceneAt,
|
|
2841
|
+
rn as naturalRest,
|
|
2842
|
+
As as nearestBeat,
|
|
2843
|
+
Ss as nextBeat,
|
|
2844
|
+
Mn as parametricEasing,
|
|
2845
|
+
Q as parsePath,
|
|
2846
|
+
ro as penroseStairs,
|
|
2847
|
+
no as penroseTriangle,
|
|
2848
|
+
K as phaseOf,
|
|
2849
|
+
Le as pingPong,
|
|
2850
|
+
Ts as planNarration,
|
|
2851
|
+
ds as playheadCrossings,
|
|
2852
|
+
ye as pointAtDistance,
|
|
2853
|
+
Bs as pointsToPath,
|
|
2854
|
+
to as powSimilarity,
|
|
2855
|
+
Nt as projectIsometric,
|
|
2856
|
+
us as quat,
|
|
2857
|
+
Re as randomBetween,
|
|
2858
|
+
ps as randomChoice,
|
|
2859
|
+
mr as randomSnapped,
|
|
2860
|
+
gr as resolveSequence,
|
|
2861
|
+
De as resolveValue,
|
|
2862
|
+
Ws as ribbon,
|
|
2863
|
+
Qs as ribbonHeadCap,
|
|
2864
|
+
Vs as safeAreas,
|
|
2865
|
+
uo as scalePoints,
|
|
2866
|
+
lr as serializeTimeline,
|
|
2867
|
+
ur as serializeTrack,
|
|
2868
|
+
Hs as shapeToPathData,
|
|
2869
|
+
Ks as similarity,
|
|
2870
|
+
Rr as similarityAbout,
|
|
2871
|
+
Cr as similarityFixedPoint,
|
|
2872
|
+
eo as similarityMatrix,
|
|
2873
|
+
tr as simplifyKeyframes,
|
|
2874
|
+
es as springDuration,
|
|
2875
|
+
Rs as springFollow,
|
|
2876
|
+
ts as springValueAt,
|
|
2877
|
+
co as squashStretch,
|
|
2878
|
+
le as staggerDistance,
|
|
2879
|
+
fe as staggerOffset,
|
|
2880
|
+
Je as staggerOffsets,
|
|
2881
|
+
Dt as staggerSpan,
|
|
2882
|
+
yn as stepsEasing,
|
|
2883
|
+
ir as textAt,
|
|
2884
|
+
ms as toJSON,
|
|
2885
|
+
hs as toKeyframedTrack,
|
|
2886
|
+
ls as toKeyframedTracks,
|
|
2887
|
+
Ls as torusNoise,
|
|
2888
|
+
j as trackTargets,
|
|
2889
|
+
qs as trailSamples,
|
|
2890
|
+
$s as unknownName,
|
|
2891
|
+
ho as vec3,
|
|
2892
|
+
Cs as wobble
|
|
2500
2893
|
};
|