@algorisys/tinyfly 0.101.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 +5 -5
- package/bin/tinyfly.mjs +9 -3
- 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 +8 -2
- package/docs/maps.md +2 -2
- package/docs/scene-3d.md +117 -5
- package/docs/teaching.md +1 -1
- package/docs/video-rendering.md +44 -1
- package/lib/addons/adapters.js +168 -123
- package/lib/addons/characters.js +4663 -4566
- package/lib/addons/scene-3d-webgl.js +30 -30
- package/lib/addons/scene-3d.js +650 -341
- 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 +13 -13
- package/lib/browser/tinyfly.js +4105 -3973
- package/lib/browser/tinyfly.umd.js +13 -13
- package/lib/engine/tinyfly-engine.js +1207 -1172
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/headless/headless.js +150 -6
- package/lib/types/adapters/canvas/framing.d.ts +27 -0
- package/lib/types/adapters/canvas/index.d.ts +1 -0
- package/lib/types/characters/character-script-3d.d.ts +21 -1
- package/lib/types/characters/index.d.ts +2 -1
- package/lib/types/characters/staging-3d.d.ts +56 -0
- package/lib/types/engine/authoring/framing.d.ts +48 -0
- package/lib/types/engine/authoring/index.d.ts +1 -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 +1 -0
- package/lib/types/headless/node-audio.d.ts +19 -0
- package/lib/types/headless/node-video.d.ts +2 -0
- package/lib/types/headless/video-scene.d.ts +12 -0
- package/lib/types/scene-3d/index.d.ts +3 -0
- package/lib/types/scene-3d/lighting.d.ts +58 -0
- package/lib/types/scene-3d/resolve-scene.d.ts +5 -1
- package/lib/types/scene-3d/scene-3d-adapter.d.ts +2 -0
- package/lib/types/scene-3d/scene-types.d.ts +14 -2
- 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 +177 -16
- package/llms.txt +29 -29
- package/package.json +1 -1
- package/skills/tinyfly/SKILL.md +4 -1
|
@@ -1,14 +1,14 @@
|
|
|
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
7
|
const Vt = 2;
|
|
8
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
14
|
function U(t) {
|
|
@@ -20,13 +20,13 @@ function V(t) {
|
|
|
20
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 Qs {
|
|
|
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,14 +92,14 @@ class Gs {
|
|
|
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;
|
|
@@ -107,8 +107,8 @@ function Ge(t, e) {
|
|
|
107
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 le(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, le(
|
|
127
|
+
for (let r = 0; r < t; r++)
|
|
128
|
+
n = Math.max(n, le(r, t, e));
|
|
129
129
|
return n;
|
|
130
130
|
}
|
|
131
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
|
|
136
|
-
return
|
|
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 et = 1, de = 6e4,
|
|
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 },
|
|
@@ -204,52 +204,52 @@ class lt {
|
|
|
204
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 h =
|
|
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
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
|
|
233
|
+
function ts(t, e) {
|
|
234
234
|
return new lt(t).valueAt(e);
|
|
235
235
|
}
|
|
236
|
-
function
|
|
236
|
+
function es(t) {
|
|
237
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 Bt = 4,
|
|
247
|
+
const Bt = 4, tn = 2e-3, en = 1e-4, nn = 6e4;
|
|
248
248
|
function ft(t) {
|
|
249
249
|
const e = t.friction ?? Bt;
|
|
250
250
|
return e > 0 ? e : Bt;
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function rn(t) {
|
|
253
253
|
return t.from + t.velocity / ft(t);
|
|
254
254
|
}
|
|
255
255
|
function sn(t, e) {
|
|
@@ -258,96 +258,96 @@ function sn(t, e) {
|
|
|
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
265
|
function dt(t) {
|
|
266
|
-
let e = sn(
|
|
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
269
|
function mt(t) {
|
|
270
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
279
|
const n = dt(t);
|
|
280
280
|
if (e >= mt(t)) return n;
|
|
281
|
-
const
|
|
282
|
-
return t.from + (n - t.from) * (1 - Math.exp(-
|
|
281
|
+
const r = ft(t);
|
|
282
|
+
return t.from + (n - t.from) * (1 - Math.exp(-r * e / 1e3));
|
|
283
283
|
}
|
|
284
|
-
function
|
|
285
|
-
const n = ft(t),
|
|
286
|
-
return e >= mt(t) ? 0 : (
|
|
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
287
|
}
|
|
288
|
-
const Pt = (t) => t,
|
|
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
289
|
linear: Pt,
|
|
290
|
-
"ease-in":
|
|
291
|
-
"ease-out":
|
|
292
|
-
"ease-in-out":
|
|
293
|
-
"ease-in-quad":
|
|
290
|
+
"ease-in": un,
|
|
291
|
+
"ease-out": hn,
|
|
292
|
+
"ease-in-out": ln,
|
|
293
|
+
"ease-in-quad": on,
|
|
294
294
|
"ease-out-quad": an,
|
|
295
|
-
"ease-in-out-quad":
|
|
295
|
+
"ease-in-out-quad": cn,
|
|
296
296
|
"ease-in-cubic": me,
|
|
297
|
-
"ease-out-cubic":
|
|
298
|
-
"ease-in-out-cubic":
|
|
297
|
+
"ease-out-cubic": ge,
|
|
298
|
+
"ease-in-out-cubic": pe
|
|
299
299
|
};
|
|
300
|
-
function
|
|
301
|
-
const [e, n,
|
|
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
302
|
let M = m;
|
|
303
303
|
for (let _ = 0; _ < 8; _++) {
|
|
304
|
-
const
|
|
305
|
-
if (Math.abs(
|
|
304
|
+
const w = u(M) - m;
|
|
305
|
+
if (Math.abs(w) < 1e-7)
|
|
306
306
|
return M;
|
|
307
307
|
const x = f(M);
|
|
308
308
|
if (Math.abs(x) < 1e-7)
|
|
309
309
|
break;
|
|
310
|
-
M -=
|
|
310
|
+
M -= w / x;
|
|
311
311
|
}
|
|
312
|
-
let y = 0,
|
|
313
|
-
for (M = m; y <
|
|
312
|
+
let y = 0, p = 1;
|
|
313
|
+
for (M = m; y < p; ) {
|
|
314
314
|
const _ = u(M);
|
|
315
315
|
if (Math.abs(_ - m) < 1e-7)
|
|
316
316
|
return M;
|
|
317
|
-
m > _ ? y = M :
|
|
317
|
+
m > _ ? y = M : p = M, M = (y + p) / 2;
|
|
318
318
|
}
|
|
319
319
|
return M;
|
|
320
320
|
};
|
|
321
321
|
return (m) => {
|
|
322
322
|
if (m <= 0) return 0;
|
|
323
323
|
if (m >= 1) return 1;
|
|
324
|
-
const M =
|
|
324
|
+
const M = g(m);
|
|
325
325
|
return d(M);
|
|
326
326
|
};
|
|
327
327
|
}
|
|
328
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
352
|
function pn(t = 1.70158) {
|
|
353
353
|
return (e) => {
|
|
@@ -357,40 +357,40 @@ function pn(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 _t(
|
|
383
|
+
return _t(mn(t.amplitude, t.period), t.mode);
|
|
384
384
|
case "bounce":
|
|
385
|
-
return _t(
|
|
385
|
+
return _t(gn, t.mode);
|
|
386
386
|
case "back":
|
|
387
387
|
return _t(pn(t.overshoot), t.mode);
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
function Lt(t) {
|
|
391
|
-
return t === void 0 ? Pt :
|
|
391
|
+
return t === void 0 ? Pt : Qe(t) ? dn(t.points) : St(t) ? Mn(t) : fn[t] ?? Pt;
|
|
392
392
|
}
|
|
393
|
-
const Ht = 32,
|
|
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,90 +402,90 @@ const Ht = 32, Mn = 256, q = /* @__PURE__ */ new Map(), xn = /[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 && (
|
|
412
|
-
const
|
|
413
|
-
if (
|
|
414
|
-
|
|
411
|
+
for (; n < t.length && (s(), !(n >= t.length)); ) {
|
|
412
|
+
const o = t[n];
|
|
413
|
+
if (_n.test(o)) {
|
|
414
|
+
r = { type: o, args: [] }, e.push(r), n++;
|
|
415
415
|
continue;
|
|
416
416
|
}
|
|
417
|
-
if (!
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
if (
|
|
421
|
-
|
|
417
|
+
if (!r) break;
|
|
418
|
+
const a = r.type === "A" || r.type === "a", i = r.args.length % 7;
|
|
419
|
+
if (a && (i === 3 || i === 4)) {
|
|
420
|
+
if (o !== "0" && o !== "1") break;
|
|
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 kn(t, e, n, s,
|
|
430
|
+
function kn(t, e, n, r, s, o, a, i, c) {
|
|
431
431
|
if (t === i && e === c) return [];
|
|
432
|
-
let h = Math.abs(n), l = Math.abs(
|
|
432
|
+
let h = Math.abs(n), l = Math.abs(r);
|
|
433
433
|
if (h === 0 || l === 0) return [[t, e, i, c, i, c]];
|
|
434
|
-
const u =
|
|
435
|
-
if (
|
|
436
|
-
const R = Math.sqrt(
|
|
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
437
|
h *= R, l *= R;
|
|
438
438
|
}
|
|
439
|
-
const _ =
|
|
440
|
-
const xt = R *
|
|
441
|
-
return R * B -
|
|
442
|
-
},
|
|
443
|
-
let $ =
|
|
444
|
-
!
|
|
445
|
-
const I = Math.max(1, Math.ceil(Math.abs($) / (Math.PI / 2))), Mt = $ / I,
|
|
446
|
-
const
|
|
447
|
-
return [d *
|
|
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
|
+
!a && $ > 0 && ($ -= 2 * Math.PI), a && $ < 0 && ($ += 2 * Math.PI);
|
|
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
448
|
}, jt = (R) => {
|
|
449
|
-
const
|
|
450
|
-
return [d *
|
|
449
|
+
const E = -h * Math.sin(R), D = l * Math.cos(R);
|
|
450
|
+
return [d * E - f * D, f * E + d * D];
|
|
451
451
|
}, Ut = [];
|
|
452
452
|
for (let R = 0; R < I; R++) {
|
|
453
|
-
const
|
|
454
|
-
Ut.push([B +
|
|
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
455
|
}
|
|
456
456
|
return Ut;
|
|
457
457
|
}
|
|
458
|
-
function Y(t, e, n,
|
|
459
|
-
const
|
|
460
|
-
return
|
|
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
461
|
}
|
|
462
|
-
function qt(t, e, n,
|
|
463
|
-
const
|
|
464
|
-
return 3 *
|
|
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
465
|
}
|
|
466
|
-
function J(t, e, n,
|
|
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 [s,
|
|
478
|
+
function at(t, e, n) {
|
|
479
|
+
const [r, s, o, a, i, c] = n, h = [0];
|
|
480
480
|
let l = t, u = e, d = 0;
|
|
481
481
|
for (let f = 1; f <= Ht; f++) {
|
|
482
|
-
const
|
|
482
|
+
const g = f / Ht, m = Y(t, r, o, i, g), M = Y(e, s, a, c, g);
|
|
483
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: [s,
|
|
488
|
+
points: [r, s, o, a, i, c],
|
|
489
489
|
startX: t,
|
|
490
490
|
startY: e,
|
|
491
491
|
endX: i,
|
|
@@ -498,65 +498,65 @@ function Q(t) {
|
|
|
498
498
|
const e = q.get(t);
|
|
499
499
|
if (e) return e;
|
|
500
500
|
const n = [];
|
|
501
|
-
let
|
|
501
|
+
let r = 0, s = 0, o = 0, a = 0, i = null, c = null, h = -1;
|
|
502
502
|
const l = /* @__PURE__ */ new Set(), u = (m) => {
|
|
503
503
|
h < 0 && (h = 0), m.subpath = h, n.push(m);
|
|
504
504
|
};
|
|
505
|
-
for (const { type: m, args: M } of
|
|
506
|
-
const y = m.toUpperCase(),
|
|
505
|
+
for (const { type: m, args: M } of wn(t)) {
|
|
506
|
+
const y = m.toUpperCase(), p = m !== y, _ = Tn[y];
|
|
507
507
|
if (y === "Z") {
|
|
508
|
-
(
|
|
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
|
|
512
|
-
const x = M.slice(
|
|
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
513
|
let P = null, b = null;
|
|
514
514
|
switch (y) {
|
|
515
515
|
case "M":
|
|
516
|
-
|
|
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(J(
|
|
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(J(
|
|
522
|
+
u(J(r, s, x[0] + S, s)), r = x[0] + S;
|
|
523
523
|
break;
|
|
524
524
|
case "V":
|
|
525
|
-
u(J(s, r,
|
|
525
|
+
u(J(r, s, r, x[0] + k)), s = x[0] + k;
|
|
526
526
|
break;
|
|
527
527
|
case "C": {
|
|
528
|
-
const T = [x[0] +
|
|
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
|
-
y === "Q" ? (T = x[0] +
|
|
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
|
-
), b = [T,
|
|
551
|
+
), b = [T, A], r = v, s = $;
|
|
552
552
|
break;
|
|
553
553
|
}
|
|
554
554
|
case "A": {
|
|
555
|
-
const T = x[5] +
|
|
556
|
-
let
|
|
557
|
-
for (const I of kn(
|
|
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
|
}
|
|
@@ -566,27 +566,27 @@ function Q(t) {
|
|
|
566
566
|
const d = n.reduce((m, M) => m + M.length, 0), f = [];
|
|
567
567
|
for (let m = 0; m < n.length; ) {
|
|
568
568
|
const M = n[m].subpath;
|
|
569
|
-
let y = m,
|
|
570
|
-
for (; y < n.length && n[y].subpath === M; )
|
|
571
|
-
const _ = n[m],
|
|
572
|
-
f.push({ start: m, end: y, length:
|
|
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 q.size >=
|
|
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
|
|
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,89 +595,89 @@ function vn(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, s,
|
|
599
|
-
let h = qt(t.startX, n,
|
|
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
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,
|
|
602
|
-
h = c < 0.5 ? d -
|
|
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,
|
|
605
|
+
x: Y(t.startX, n, s, a, c),
|
|
606
|
+
y: Y(t.startY, r, o, i, c),
|
|
607
607
|
angle: Math.atan2(l, h) * 180 / Math.PI
|
|
608
608
|
};
|
|
609
609
|
}
|
|
610
|
-
function ye(t, e, n = 0,
|
|
611
|
-
if (
|
|
612
|
-
let
|
|
613
|
-
for (let
|
|
614
|
-
const
|
|
615
|
-
if (
|
|
616
|
-
return
|
|
617
|
-
|
|
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
|
+
const a = t[o];
|
|
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 ye(n, Math.max(0, Math.min(1, e)) *
|
|
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
|
|
625
|
+
function os() {
|
|
626
626
|
q.clear();
|
|
627
627
|
}
|
|
628
|
-
function
|
|
628
|
+
function as(t) {
|
|
629
629
|
return Q(t).totalLength;
|
|
630
630
|
}
|
|
631
|
-
const
|
|
631
|
+
const Pn = 24, In = 320, $n = 2.5, tt = 72, is = 64, Rn = 0.2, Cn = 128, nt = /* @__PURE__ */ new Map();
|
|
632
632
|
let it = 0, X;
|
|
633
633
|
const Wt = (t) => Math.round(t * 100) / 100;
|
|
634
634
|
function Qt(t, e) {
|
|
635
|
-
const { segments: n, subpaths:
|
|
635
|
+
const { segments: n, subpaths: r, totalLength: s } = Q(t);
|
|
636
636
|
if (n.length === 0) return [];
|
|
637
637
|
if (e) {
|
|
638
|
-
const
|
|
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
643
|
function It(t, e) {
|
|
644
|
-
const n = t.closed ? (e % 1 + 1) % 1 : Math.max(0, Math.min(1, e)),
|
|
645
|
-
return [
|
|
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
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
654
|
function Kt(t, e) {
|
|
655
655
|
const n = [];
|
|
656
|
-
for (let
|
|
657
|
-
n.push(It(t, t.closed ?
|
|
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
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
672
|
for (const h of [!1, !0]) {
|
|
673
|
-
const l =
|
|
673
|
+
const l = r ? a : 1;
|
|
674
674
|
for (let u = 0; u < l; u++) {
|
|
675
675
|
let d = 0;
|
|
676
|
-
for (let f = 0; f <
|
|
677
|
-
const
|
|
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
678
|
d += m * m + M * M;
|
|
679
679
|
}
|
|
680
|
-
d < c && (c = d, i = { offset:
|
|
680
|
+
d < c && (c = d, i = { offset: r ? u / a : 0, reversed: h });
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
683
|
return i;
|
|
@@ -685,111 +685,111 @@ function Cn(t, e, n) {
|
|
|
685
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(
|
|
695
|
-
),
|
|
696
|
-
for (let u = 0; u <=
|
|
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
|
+
), a = /* @__PURE__ */ new Set(), i = (u) => a.add(Math.round(u * 1e7) / 1e7);
|
|
696
|
+
for (let u = 0; u <= o; u++) i(u / o);
|
|
697
697
|
for (const u of Gt(t)) i(u);
|
|
698
|
-
for (const u of Gt(e)) i(
|
|
699
|
-
let c = [...
|
|
700
|
-
|
|
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
701
|
const h = [], l = [];
|
|
702
702
|
for (const u of c)
|
|
703
|
-
h.push(...It(t, u)), l.push(...It(e, Dn(u,
|
|
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 [
|
|
714
|
-
let c = -1, h =
|
|
715
|
-
for (let l =
|
|
716
|
-
const u = Math.max(Jt(t.from,
|
|
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
717
|
u > h && (h = u, c = l);
|
|
718
718
|
}
|
|
719
|
-
c !== -1 && (n[c] = 1,
|
|
720
|
-
}
|
|
721
|
-
const
|
|
722
|
-
for (let
|
|
723
|
-
n[
|
|
724
|
-
return { from:
|
|
725
|
-
}
|
|
726
|
-
function Jt(t, e, n,
|
|
727
|
-
const
|
|
728
|
-
return Math.hypot(c - u *
|
|
729
|
-
}
|
|
730
|
-
function
|
|
731
|
-
const
|
|
732
|
-
if (X && X.from === t && X.to === e && X.shapeIndex ===
|
|
733
|
-
const
|
|
734
|
-
if (
|
|
735
|
-
return X = { from: t, to: e, shapeIndex:
|
|
736
|
-
const
|
|
737
|
-
pairs: i.map((f,
|
|
719
|
+
c !== -1 && (n[c] = 1, r.push([a, c], [c, i]));
|
|
720
|
+
}
|
|
721
|
+
const s = [], o = [];
|
|
722
|
+
for (let a = 0; a < e; a++)
|
|
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
|
+
}
|
|
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
|
+
}
|
|
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
|
+
if (o)
|
|
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
|
-
it >=
|
|
740
|
-
const l = String(
|
|
739
|
+
it >= Cn && (nt.clear(), it = 0);
|
|
740
|
+
const l = String(r ?? "auto"), u = nt.get(l) ?? /* @__PURE__ */ new Map();
|
|
741
741
|
nt.set(l, u);
|
|
742
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:
|
|
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
|
|
752
|
-
if (
|
|
753
|
-
let
|
|
754
|
-
for (const i of
|
|
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
|
+
let a = "";
|
|
754
|
+
for (const i of o.pairs) {
|
|
755
755
|
for (let c = 0; c < i.from.length; c += 2) {
|
|
756
|
-
const h = Wt(i.from[c] + (i.to[c] - i.from[c]) *
|
|
757
|
-
|
|
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
|
-
i.closed && (
|
|
759
|
+
i.closed && (a += " Z");
|
|
760
760
|
}
|
|
761
|
-
return
|
|
761
|
+
return a;
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function cs() {
|
|
764
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 W = Math.PI / 180,
|
|
769
|
+
const W = Math.PI / 180, zn = 0.9995;
|
|
770
770
|
function Ft() {
|
|
771
771
|
return [0, 0, 0, 1];
|
|
772
772
|
}
|
|
773
773
|
function ct(t, e) {
|
|
774
774
|
const n = Math.hypot(t[0], t[1], t[2]);
|
|
775
775
|
if (n === 0) return Ft();
|
|
776
|
-
const
|
|
777
|
-
return [t[0] *
|
|
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
|
|
779
|
+
function jn(t, e, n) {
|
|
780
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 ? [d / W, Math.atan2(
|
|
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
786
|
function $t(t, e) {
|
|
787
|
-
const [n,
|
|
787
|
+
const [n, r, s, o] = t, [a, i, c, h] = e;
|
|
788
788
|
return [
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
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
795
|
function Me(t, e) {
|
|
@@ -802,172 +802,172 @@ function z(t) {
|
|
|
802
802
|
const e = xe(t);
|
|
803
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
808
|
function _e(t, e, n) {
|
|
809
|
-
const
|
|
810
|
-
let
|
|
811
|
-
if (
|
|
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
|
|
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] +
|
|
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:
|
|
832
|
+
conjugate: Vn,
|
|
833
833
|
dot: Me,
|
|
834
834
|
fromAxisAngle: ct,
|
|
835
|
-
fromEuler:
|
|
835
|
+
fromEuler: jn,
|
|
836
836
|
identity: Ft,
|
|
837
837
|
length: xe,
|
|
838
838
|
multiply: $t,
|
|
839
839
|
normalize: z,
|
|
840
|
-
rotateVec3:
|
|
840
|
+
rotateVec3: Bn,
|
|
841
841
|
slerp: _e,
|
|
842
|
-
toEuler:
|
|
842
|
+
toEuler: Un
|
|
843
843
|
}, Symbol.toStringTag, { value: "Module" })), N = (t, e, n) => t + (e - t) * n, be = 512, bt = /* @__PURE__ */ new Map(), Tt = /* @__PURE__ */ new Map();
|
|
844
844
|
function te(t) {
|
|
845
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 bt.size < be && bt.set(t,
|
|
852
|
+
return bt.size < be && bt.set(t, r), r;
|
|
853
853
|
}
|
|
854
|
-
const ee = (t) => t.charCodeAt(0) === 35, ne = (t) => t.startsWith("rgb"),
|
|
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
|
|
858
|
+
function se(t) {
|
|
859
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 Tt.size < be && Tt.set(t,
|
|
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
866
|
}
|
|
867
|
-
const
|
|
867
|
+
const Wn = (t, e, n) => {
|
|
868
868
|
if (ee(t) && ee(e)) {
|
|
869
|
-
const [
|
|
870
|
-
return
|
|
871
|
-
}
|
|
872
|
-
if ((ne(t) ||
|
|
873
|
-
const
|
|
874
|
-
if (
|
|
875
|
-
const c =
|
|
876
|
-
return `rgba(${
|
|
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
|
-
return `rgb(${
|
|
878
|
+
return `rgb(${o}, ${a}, ${i})`;
|
|
879
879
|
}
|
|
880
880
|
return n < 1 ? t : e;
|
|
881
|
-
},
|
|
882
|
-
const
|
|
883
|
-
for (let
|
|
884
|
-
|
|
885
|
-
return
|
|
886
|
-
},
|
|
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
887
|
function Te(t, e) {
|
|
888
|
-
return e === "slerp" ?
|
|
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
894
|
const n = new lt(t.spring);
|
|
895
|
-
return
|
|
895
|
+
return Se(t, (r) => n.valueAt(r), n.settleTime(), t.spring.from, t.spring.to, e);
|
|
896
896
|
}
|
|
897
|
-
function
|
|
897
|
+
function Ae(t, e = {}) {
|
|
898
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
|
-
(
|
|
903
|
+
(r) => vt(n, r),
|
|
904
904
|
mt(n),
|
|
905
905
|
n.from,
|
|
906
906
|
dt(n),
|
|
907
907
|
e
|
|
908
908
|
);
|
|
909
909
|
}
|
|
910
|
-
function
|
|
911
|
-
const
|
|
912
|
-
for (let u = 0; u <= n; u +=
|
|
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
|
+
for (let u = 0; u <= n; u += a)
|
|
913
913
|
h.push({ time: u + c, value: e(u), easing: "linear" });
|
|
914
914
|
const l = h[h.length - 1];
|
|
915
|
-
return !l || l.time < n + c ? h.push({ time: n + c, value:
|
|
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 l =
|
|
928
|
+
for (let l = s; l < i; l += s) {
|
|
929
929
|
const u = l / i;
|
|
930
930
|
c.push({
|
|
931
931
|
time: t.time + l,
|
|
932
|
-
value:
|
|
932
|
+
value: a(t.value, e.value, o(u)),
|
|
933
933
|
easing: "linear"
|
|
934
934
|
});
|
|
935
935
|
}
|
|
936
|
-
const h =
|
|
937
|
-
return c.push({ ...e, ...h !== 1 && { value:
|
|
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((
|
|
945
|
-
const
|
|
946
|
-
for (let
|
|
947
|
-
const
|
|
948
|
-
|
|
949
|
-
}
|
|
950
|
-
return { ...t, keyframes:
|
|
951
|
-
}
|
|
952
|
-
function
|
|
953
|
-
return t.filter(
|
|
954
|
-
t.filter(V).map((n) =>
|
|
955
|
-
t.filter(U).map((n) =>
|
|
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
|
+
for (let o = 1; o < n.length; o++) {
|
|
947
|
+
const a = n[o];
|
|
948
|
+
St(a.easing) ? r.push(...Zn(n[o - 1], a, a.easing, s)) : r.push(a);
|
|
949
|
+
}
|
|
950
|
+
return { ...t, keyframes: r };
|
|
951
|
+
}
|
|
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 = (
|
|
965
|
-
Math.abs(
|
|
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
|
|
@@ -976,9 +976,9 @@ function ts(t) {
|
|
|
976
976
|
function j(t) {
|
|
977
977
|
return t.targets && t.targets.length > 0 ? t.targets : [t.target];
|
|
978
978
|
}
|
|
979
|
-
function G(t, e, n,
|
|
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
983
|
class ut {
|
|
984
984
|
track;
|
|
@@ -1002,12 +1002,12 @@ class ut {
|
|
|
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
|
|
1008
|
-
|
|
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 ut {
|
|
|
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,26 +1035,26 @@ class ut {
|
|
|
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
|
|
1044
|
-
return Te(
|
|
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;
|
|
@@ -1065,23 +1065,23 @@ class es {
|
|
|
1065
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
|
|
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;
|
|
@@ -1089,68 +1089,68 @@ class ns {
|
|
|
1089
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
|
|
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 [s,
|
|
1115
|
-
n.x =
|
|
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
1116
|
const u = n.angle * Math.PI / 180, d = Math.cos(u), f = Math.sin(u);
|
|
1117
|
-
n.angle = Math.atan2(
|
|
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 (
|
|
1142
|
-
if (
|
|
1143
|
-
const
|
|
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 ?
|
|
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 h = Math.max(0, Math.min(0.999, t.revealDelay ?? 0)), l = Math.max(0, (
|
|
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
1149
|
let y = "";
|
|
1150
|
-
for (let
|
|
1151
|
-
const _ = c ?
|
|
1152
|
-
_ &&
|
|
1153
|
-
` ? 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
1155
|
return y;
|
|
1156
1156
|
}
|
|
@@ -1275,47 +1275,47 @@ class Pe {
|
|
|
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
|
-
const
|
|
1288
|
-
for (let i = 0; i <
|
|
1287
|
+
const o = 1e3;
|
|
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
|
-
const
|
|
1305
|
-
this.onUpdate?.(
|
|
1304
|
+
const a = this.getStateAtTime(this._currentTime);
|
|
1305
|
+
this.onUpdate?.(a);
|
|
1306
1306
|
}
|
|
1307
1307
|
/**
|
|
1308
1308
|
* Get the animation state at a specific time.
|
|
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
|
|
1317
|
-
for (const { target:
|
|
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 Pe {
|
|
|
1339
1339
|
* turn. `findConflicts()` reports overlaps by the same rule.
|
|
1340
1340
|
*/
|
|
1341
1341
|
_resolveShared(e, n) {
|
|
1342
|
-
const
|
|
1343
|
-
for (const [
|
|
1344
|
-
const
|
|
1345
|
-
for (const { target: i, value: c, start: h } of
|
|
1346
|
-
const l = `${i}\0${
|
|
1347
|
-
(!d || (u !== d.started ? u : u ? h >= d.start : h <= d.start)) &&
|
|
1342
|
+
const r = /* @__PURE__ */ new Map();
|
|
1343
|
+
for (const [s, o] of this._trackPlayers) {
|
|
1344
|
+
const a = o.getTrack().property;
|
|
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, s,
|
|
1359
|
-
if (
|
|
1360
|
-
let i = e.get(
|
|
1361
|
-
i || (i = /* @__PURE__ */ new Map(), e.set(
|
|
1358
|
+
_write(e, n, r, s, o, a) {
|
|
1359
|
+
if (o === void 0) return;
|
|
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
|
-
if (c && typeof
|
|
1364
|
-
i.set("text",
|
|
1363
|
+
if (c && typeof o == "number") {
|
|
1364
|
+
i.set("text", ir(c.textConfig, o, Math.max(0, a)));
|
|
1365
1365
|
return;
|
|
1366
1366
|
}
|
|
1367
1367
|
const h = this._motionPathTracks.get(n);
|
|
1368
|
-
if (h && typeof
|
|
1369
|
-
const l =
|
|
1368
|
+
if (h && typeof o == "number") {
|
|
1369
|
+
const l = ve(h.motionPathConfig, o);
|
|
1370
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 Pe {
|
|
|
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;
|
|
@@ -1394,14 +1394,14 @@ class Pe {
|
|
|
1394
1394
|
*/
|
|
1395
1395
|
addTrack(e) {
|
|
1396
1396
|
if (this._tracks.push(e), this._sharedWrites = null, U(e)) {
|
|
1397
|
-
this._trackPlayers.set(e.id, new
|
|
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 (
|
|
1404
|
+
if (Et(e))
|
|
1405
1405
|
this._trackPlayers.set(e.id, new ut(e)), this._textTracks.set(e.id, e);
|
|
1406
1406
|
else if (he(e)) {
|
|
1407
1407
|
const n = {
|
|
@@ -1424,13 +1424,13 @@ class Pe {
|
|
|
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
|
|
1431
|
+
for (const o of s) this.removeTrack(o.id);
|
|
1432
1432
|
this.addTrack(n);
|
|
1433
|
-
for (const
|
|
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 Pe {
|
|
|
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 Pe {
|
|
|
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
|
|
1473
|
-
if (!(!
|
|
1474
|
-
return { from:
|
|
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
|
+
if (!(!o || o.length === 0))
|
|
1474
|
+
return { from: o[0].time + s, to: n.getDuration() };
|
|
1475
1475
|
}
|
|
1476
1476
|
/**
|
|
1477
1477
|
* Overlapping writes to the same target+property.
|
|
@@ -1484,22 +1484,22 @@ class Pe {
|
|
|
1484
1484
|
findConflicts() {
|
|
1485
1485
|
const e = [];
|
|
1486
1486
|
for (let n = 0; n < this._tracks.length; n++) {
|
|
1487
|
-
const
|
|
1488
|
-
if (
|
|
1489
|
-
for (let
|
|
1490
|
-
const
|
|
1491
|
-
if (
|
|
1492
|
-
const i = j(
|
|
1487
|
+
const r = this._tracks[n], s = this.getTrackSpan(r.id);
|
|
1488
|
+
if (s)
|
|
1489
|
+
for (let o = 0; o < n; o++) {
|
|
1490
|
+
const a = this._tracks[o];
|
|
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
|
-
const c = this.getTrackSpan(
|
|
1495
|
-
if (!c || !(c.from <=
|
|
1496
|
-
const l =
|
|
1494
|
+
const c = this.getTrackSpan(a.id);
|
|
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: l ?
|
|
1502
|
-
winningTrackId: l ?
|
|
1500
|
+
property: r.property,
|
|
1501
|
+
losingTrackId: l ? a.id : r.id,
|
|
1502
|
+
winningTrackId: l ? r.id : a.id
|
|
1503
1503
|
});
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
@@ -1508,8 +1508,8 @@ class Pe {
|
|
|
1508
1508
|
_matches(e, n) {
|
|
1509
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
|
}
|
|
@@ -1536,8 +1536,8 @@ class Pe {
|
|
|
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 Pe {
|
|
|
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,25 +1576,25 @@ class Pe {
|
|
|
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
|
-
|
|
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
1583
|
const y = [];
|
|
1584
|
-
t.forEach((
|
|
1585
|
-
(m === "forward" ? (M ?
|
|
1586
|
-
}), y.sort((
|
|
1587
|
-
for (const
|
|
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
1589
|
let h = e.time, l = e.direction, u = e.fresh === !0;
|
|
1590
|
-
const d = Math.min(
|
|
1590
|
+
const d = Math.min(cr, Math.max(0, n.iteration - e.iteration));
|
|
1591
1591
|
for (let f = 0; f < d; f++) {
|
|
1592
|
-
const
|
|
1593
|
-
c(h,
|
|
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 d > 0 &&
|
|
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
|
|
1597
|
+
function ur(t) {
|
|
1598
1598
|
return U(t) ? {
|
|
1599
1599
|
id: t.id,
|
|
1600
1600
|
target: t.target,
|
|
@@ -1609,25 +1609,25 @@ function cs(t) {
|
|
|
1609
1609
|
kind: "spring",
|
|
1610
1610
|
spring: { ...t.spring },
|
|
1611
1611
|
...O(t)
|
|
1612
|
-
} :
|
|
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(
|
|
1617
|
+
keyframes: t.keyframes.map(At),
|
|
1618
1618
|
...O(t)
|
|
1619
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(
|
|
1624
|
+
keyframes: t.keyframes.map(At),
|
|
1625
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
|
};
|
|
@@ -1635,7 +1635,7 @@ function cs(t) {
|
|
|
1635
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,
|
|
@@ -1651,7 +1651,7 @@ function O(t) {
|
|
|
1651
1651
|
...t.stagger !== void 0 && { stagger: { ...t.stagger } }
|
|
1652
1652
|
};
|
|
1653
1653
|
}
|
|
1654
|
-
function
|
|
1654
|
+
function hr(t) {
|
|
1655
1655
|
if (U(t)) {
|
|
1656
1656
|
const e = t;
|
|
1657
1657
|
return {
|
|
@@ -1674,19 +1674,19 @@ function us(t) {
|
|
|
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,
|
|
1684
|
+
keyframes: [...e.keyframes].sort((n, r) => n.time - r.time),
|
|
1685
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,
|
|
@@ -1696,7 +1696,7 @@ function us(t) {
|
|
|
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,
|
|
@@ -1705,7 +1705,7 @@ function us(t) {
|
|
|
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
1711
|
formatVersion: ue(t.tracks),
|
|
@@ -1720,11 +1720,11 @@ function hs(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
1729
|
if (e > Vt)
|
|
1730
1730
|
throw new Error(
|
|
@@ -1734,18 +1734,18 @@ function ls(t) {
|
|
|
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);
|
|
@@ -1763,25 +1763,25 @@ function $e(t) {
|
|
|
1763
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 +
|
|
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 Ce = /^([+\-*/])=\s*(-?[\d.]+)$/,
|
|
1776
|
-
function
|
|
1777
|
-
return typeof t != "string" ? !1 : Ce.test(t.trim()) ||
|
|
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 [,
|
|
1784
|
-
switch (
|
|
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
|
+
switch (o) {
|
|
1785
1785
|
case "+":
|
|
1786
1786
|
return i + c;
|
|
1787
1787
|
case "-":
|
|
@@ -1792,27 +1792,27 @@ function Ee(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
|
|
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
|
|
1809
|
-
for (const
|
|
1810
|
-
const
|
|
1811
|
-
|
|
1806
|
+
function gr(t, e = 0, n) {
|
|
1807
|
+
const r = [];
|
|
1808
|
+
let s = e;
|
|
1809
|
+
for (const o of t) {
|
|
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
1818
|
this.random = $e(e);
|
|
@@ -1822,112 +1822,112 @@ class gr {
|
|
|
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 [d, 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
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,
|
|
1840
|
-
if (
|
|
1841
|
-
const i = (d) => (d - n) /
|
|
1842
|
-
if (e.length === 1 &&
|
|
1843
|
-
const [d, f,
|
|
1844
|
-
return { fn:
|
|
1845
|
-
}
|
|
1846
|
-
const h = [], l = [], u = Math.max(8, Math.ceil(
|
|
1839
|
+
const n = e[0].startX, r = e[0].startY, s = e[e.length - 1], o = s.endX - n, a = s.endY - r;
|
|
1840
|
+
if (o === 0 || a === 0) throw new Error(`customEase: "${t}" must move along both axes`);
|
|
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
1847
|
for (const d of e)
|
|
1848
1848
|
for (let f = h.length === 0 ? 0 : 1; f <= u; f++) {
|
|
1849
|
-
const [
|
|
1850
|
-
h.push(i(
|
|
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
|
|
1857
|
-
const
|
|
1858
|
-
return (
|
|
1859
|
-
if (
|
|
1860
|
-
if (
|
|
1861
|
-
let
|
|
1862
|
-
for (let i = 0; i <
|
|
1863
|
-
if (
|
|
1864
|
-
if (i === 0) return (
|
|
1865
|
-
const c =
|
|
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
|
+
return (o) => {
|
|
1859
|
+
if (o <= 0) return 0;
|
|
1860
|
+
if (o >= 1) 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
1866
|
return 1 - (h - l * l);
|
|
1867
1867
|
}
|
|
1868
|
-
|
|
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
1879
|
const [h, l] = t.points;
|
|
1880
1880
|
return [t.startX + (h - t.startX) * e, t.startY + (l - t.startY) * e];
|
|
1881
1881
|
}
|
|
1882
|
-
const [n, s,
|
|
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
|
|
1895
|
-
t[
|
|
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
|
|
1898
|
-
return
|
|
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
|
|
1903
|
-
return (
|
|
1904
|
-
if (
|
|
1905
|
-
if (
|
|
1906
|
-
let i =
|
|
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
|
+
return (a) => {
|
|
1904
|
+
if (a <= 0) return 0;
|
|
1905
|
+
if (a >= 1) return 1;
|
|
1906
|
+
let i = a;
|
|
1907
1907
|
for (let l = 0; l < 8; l++) {
|
|
1908
|
-
const u =
|
|
1909
|
-
if (Math.abs(u) < 1e-6) return
|
|
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
1910
|
if (Math.abs(d) < 1e-6) break;
|
|
1911
1911
|
i -= u / d;
|
|
1912
1912
|
}
|
|
1913
1913
|
let c = 0, h = 1;
|
|
1914
|
-
i =
|
|
1914
|
+
i = a;
|
|
1915
1915
|
for (let l = 0; l < 40; l++)
|
|
1916
|
-
|
|
1917
|
-
return
|
|
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 ??
|
|
1923
|
-
let
|
|
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
|
+
let a = 0;
|
|
1924
1924
|
return t.forEach((i, c) => {
|
|
1925
1925
|
const h = [];
|
|
1926
|
-
let l =
|
|
1926
|
+
let l = a + n;
|
|
1927
1927
|
i.lines.forEach((d, f) => {
|
|
1928
1928
|
if (!(d.duration >= 0))
|
|
1929
1929
|
throw new Error(`narration: scene ${c} line ${f} has an invalid duration (${d.duration})`);
|
|
1930
|
-
f > 0 && (l +=
|
|
1930
|
+
f > 0 && (l += r), h.push({
|
|
1931
1931
|
id: d.id ?? `s${c}-l${f}`,
|
|
1932
1932
|
scene: c,
|
|
1933
1933
|
line: f,
|
|
@@ -1936,406 +1936,436 @@ function _r(t, e = {}) {
|
|
|
1936
1936
|
text: d.text
|
|
1937
1937
|
}), l += d.duration;
|
|
1938
1938
|
});
|
|
1939
|
-
const u = l +
|
|
1940
|
-
|
|
1941
|
-
}), { duration:
|
|
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
|
+
}), { 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
|
|
1953
|
+
const gt = (t) => 6e4 / t.bpm;
|
|
1954
1954
|
function Ot(t, e) {
|
|
1955
|
-
return t.offset + 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 Ot(t, Math.round(
|
|
1960
|
+
function As(t, e) {
|
|
1961
|
+
return Ot(t, Math.round(pt(t, e)));
|
|
1962
1962
|
}
|
|
1963
|
-
function
|
|
1964
|
-
return Ot(t, Math.ceil(
|
|
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
|
|
1970
|
-
const
|
|
1971
|
-
if (
|
|
1972
|
-
|
|
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
|
+
if (a > n + 1e-9) break;
|
|
1972
|
+
s.push({ time: a, bar: (o % r + r) % r === 0, n: o });
|
|
1973
1973
|
}
|
|
1974
|
-
return
|
|
1974
|
+
return s;
|
|
1975
1975
|
}
|
|
1976
1976
|
const H = 100;
|
|
1977
|
-
function
|
|
1978
|
-
const
|
|
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
1981
|
for (let b = 0; b < i; b++) {
|
|
1982
1982
|
let T = 0;
|
|
1983
|
-
for (let
|
|
1984
|
-
c[b] = Math.log(1e-6 + T /
|
|
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
1985
|
}
|
|
1986
1986
|
const h = new Float64Array(i);
|
|
1987
1987
|
for (let b = 1; b < i; b++) h[b] = Math.max(0, c[b] - c[b - 1]);
|
|
1988
1988
|
const l = h.reduce((b, T) => b + T, 0) / i;
|
|
1989
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 /
|
|
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
|
|
1992
|
+
for (let A = b; A < i; A++) T += h[A] * h[A - b];
|
|
1993
1993
|
return T / (i - b);
|
|
1994
1994
|
};
|
|
1995
|
-
let
|
|
1996
|
-
for (let b = 0; b < i; b++)
|
|
1997
|
-
|
|
1995
|
+
let g = 0;
|
|
1996
|
+
for (let b = 0; b < i; b++) g += h[b] * h[b];
|
|
1997
|
+
g /= i;
|
|
1998
1998
|
let m = u, M = -1 / 0;
|
|
1999
1999
|
for (let b = u; b <= d; b++) {
|
|
2000
|
-
const T = 60 * H / b,
|
|
2001
|
-
|
|
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
2002
|
}
|
|
2003
2003
|
const y = (b) => {
|
|
2004
2004
|
const T = Math.floor(b);
|
|
2005
2005
|
return T < 0 || T + 1 >= i ? 0 : h[T] + (h[T + 1] - h[T]) * (b - T);
|
|
2006
|
-
},
|
|
2007
|
-
let
|
|
2008
|
-
for (let
|
|
2009
|
-
return
|
|
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 _ = m,
|
|
2011
|
+
let _ = m, w = 0, x = -1 / 0;
|
|
2012
2012
|
for (let b = m - 0.6; b <= m + 0.6 + 1e-9; b += 0.02) {
|
|
2013
2013
|
if (b < 1) continue;
|
|
2014
2014
|
const T = Math.max(1, Math.round(b * 4));
|
|
2015
|
-
for (let
|
|
2016
|
-
const
|
|
2017
|
-
$ > x && (x = $,
|
|
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 m =
|
|
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
2027
|
for (; m.length > 0 && m[m.length - 1].time >= d; ) m.pop();
|
|
2028
|
-
m.push({ time: d, value: f, ...
|
|
2029
|
-
},
|
|
2030
|
-
const d = u.rotate * Math.PI / 180, f = (u.focusX -
|
|
2028
|
+
m.push({ time: d, value: f, ...g ? { easing: g } : {} });
|
|
2029
|
+
}, a = (u) => {
|
|
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: -(f * Math.cos(d) -
|
|
2033
|
-
y: -(f * Math.sin(d) +
|
|
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
2037
|
}, i = (u, d, f) => {
|
|
2038
|
-
const
|
|
2039
|
-
for (const m of ["x", "y", "scale", "rotate"])
|
|
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:
|
|
2041
|
+
let c = { focusX: r.x, focusY: r.y, scale: 1, rotate: 0 };
|
|
2042
2042
|
const h = [...t].sort((u, d) => u.at - d.at), l = h.filter((u) => !("shake" in u));
|
|
2043
2043
|
l.length > 0 && i(0, c);
|
|
2044
2044
|
for (const u of l)
|
|
2045
2045
|
if ("frame" in u) {
|
|
2046
|
-
const d = Math.max(ie, u.duration ??
|
|
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
2052
|
}, i(u.at + d, c, u.easing ?? (d > ie ? "ease-in-out" : void 0));
|
|
2053
2053
|
} else {
|
|
2054
|
-
const { follow: d } = u, f = d.lag ??
|
|
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 y = (
|
|
2057
|
-
focusX: m(
|
|
2056
|
+
const y = (p) => ({
|
|
2057
|
+
focusX: m(p) + (d.lead ?? 0),
|
|
2058
2058
|
focusY: d.y ?? c.focusY,
|
|
2059
2059
|
scale: d.scale ?? c.scale,
|
|
2060
2060
|
rotate: c.rotate
|
|
2061
2061
|
});
|
|
2062
|
-
for (const
|
|
2063
|
-
const _ = d.x.find((
|
|
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
2066
|
c = y(u.until);
|
|
2067
2067
|
}
|
|
2068
2068
|
for (const u of h.filter((d) => "shake" in d)) {
|
|
2069
|
-
const d = u.shake.strength ?? 12, f = u.shake.roll ?? 1.5,
|
|
2070
|
-
for (const y of ["shakeX", "shakeY", "shakeRotate"])
|
|
2071
|
-
for (let y = u.at +
|
|
2072
|
-
const
|
|
2073
|
-
|
|
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 y of ["shakeX", "shakeY", "shakeRotate"])
|
|
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
|
|
2082
|
-
for (let
|
|
2083
|
-
const
|
|
2084
|
-
for (let i = 1; i <=
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
}
|
|
2088
|
-
return r
|
|
2089
|
-
}
|
|
2090
|
-
function
|
|
2091
|
-
const n = t.toLowerCase(),
|
|
2092
|
-
if (
|
|
2093
|
-
let
|
|
2094
|
-
for (const
|
|
2095
|
-
const i =
|
|
2096
|
-
i <
|
|
2097
|
-
}
|
|
2098
|
-
return
|
|
2099
|
-
}
|
|
2100
|
-
function
|
|
2101
|
-
const
|
|
2102
|
-
return `Unknown ${t} ${JSON.stringify(e)}${
|
|
2103
|
-
}
|
|
2104
|
-
function
|
|
2105
|
-
const n = e.step ?? 33,
|
|
2106
|
-
let
|
|
2107
|
-
const c = [{ time: e.start, value:
|
|
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
|
+
for (let o = 1; o <= n.length; o++) {
|
|
2083
|
+
const a = [o];
|
|
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
|
+
}
|
|
2088
|
+
return s[r.length];
|
|
2089
|
+
}
|
|
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
|
+
for (const a of e) {
|
|
2095
|
+
const i = kr(t, a);
|
|
2096
|
+
i < o && (o = i, s = a);
|
|
2097
|
+
}
|
|
2098
|
+
return s !== void 0 && o <= Math.max(2, Math.floor(t.length / 3)) ? s : void 0;
|
|
2099
|
+
}
|
|
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
|
+
}
|
|
2104
|
+
function Rs(t, e) {
|
|
2105
|
+
const n = e.step ?? 33, r = e.stiffness ?? 120, s = e.damping ?? 9, o = e.mass ?? 1;
|
|
2106
|
+
let a = t(e.start), i = 0;
|
|
2107
|
+
const c = [{ time: e.start, value: a }];
|
|
2108
2108
|
let h = e.start + n;
|
|
2109
2109
|
for (let l = e.start + 1; l <= e.end; l++) {
|
|
2110
|
-
const d =
|
|
2111
|
-
i += d /
|
|
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
2115
|
function K(t, e, n = 1) {
|
|
2116
2116
|
if (!(e > 0)) return 0;
|
|
2117
|
-
const
|
|
2118
|
-
return
|
|
2117
|
+
const r = t * n / e;
|
|
2118
|
+
return r - Math.floor(r);
|
|
2119
2119
|
}
|
|
2120
2120
|
function Le(t) {
|
|
2121
2121
|
const e = t - Math.floor(t);
|
|
2122
2122
|
return 1 - Math.abs(e * 2 - 1);
|
|
2123
2123
|
}
|
|
2124
|
-
function
|
|
2125
|
-
const n = Math.max(1, Math.round(e.cycles ?? 1)),
|
|
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
2126
|
switch (e.shape ?? "sine") {
|
|
2127
2127
|
case "triangle":
|
|
2128
|
-
return
|
|
2128
|
+
return r * (Le(o + 0.25) * 2 - 1);
|
|
2129
2129
|
case "square":
|
|
2130
|
-
return
|
|
2130
|
+
return o < 0.5 ? r : -r;
|
|
2131
2131
|
default:
|
|
2132
|
-
return
|
|
2132
|
+
return r * Math.sin(o * Math.PI * 2);
|
|
2133
2133
|
}
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2136
|
-
const n = Math.max(1, Math.round(e.cycles ?? 1)),
|
|
2137
|
-
return
|
|
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
2138
|
}
|
|
2139
|
-
function
|
|
2140
|
-
const n = Fe(e.seed),
|
|
2141
|
-
return Oe([Math.cos(
|
|
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
2142
|
}
|
|
2143
|
-
function
|
|
2144
|
-
const
|
|
2145
|
-
return Oe([Math.cos(
|
|
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
2146
|
}
|
|
2147
|
-
const Fe = (t) => typeof t == "string" ?
|
|
2147
|
+
const Fe = (t) => typeof t == "string" ? dr(t) : (t ?? 0) >>> 0;
|
|
2148
2148
|
function Oe(t, e, n) {
|
|
2149
|
-
const
|
|
2150
|
-
let
|
|
2151
|
-
for (let i = 0; i <
|
|
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
2152
|
const c = 2 ** i;
|
|
2153
|
-
|
|
2153
|
+
s += o * Sr(t.map((h) => h * c), e + i * 1013), a += o, o *= 0.5;
|
|
2154
2154
|
}
|
|
2155
|
-
return
|
|
2155
|
+
return s / a;
|
|
2156
2156
|
}
|
|
2157
|
-
function
|
|
2158
|
-
const n = t.length,
|
|
2159
|
-
let
|
|
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
2160
|
for (let i = 0; i < 1 << n; i++) {
|
|
2161
2161
|
let c = 1;
|
|
2162
2162
|
const h = [];
|
|
2163
2163
|
for (let l = 0; l < n; l++) {
|
|
2164
2164
|
const u = i >> l & 1;
|
|
2165
|
-
c *= u ?
|
|
2165
|
+
c *= u ? o[l] : 1 - o[l], h.push(r[l] + u);
|
|
2166
2166
|
}
|
|
2167
|
-
c !== 0 && (
|
|
2167
|
+
c !== 0 && (a += c * vr(h, e));
|
|
2168
2168
|
}
|
|
2169
|
-
return
|
|
2169
|
+
return a;
|
|
2170
2170
|
}
|
|
2171
|
-
function
|
|
2171
|
+
function vr(t, e) {
|
|
2172
2172
|
let n = (e ^ 2654435769) >>> 0;
|
|
2173
|
-
for (const
|
|
2174
|
-
n = Math.imul(n ^ (
|
|
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
2175
|
return n / 4294967296 * 2 - 1;
|
|
2176
2176
|
}
|
|
2177
|
-
function
|
|
2177
|
+
function Fs(t, e = {}) {
|
|
2178
2178
|
if (t.length === 0) throw new Error("curve: needs at least one key");
|
|
2179
|
-
const
|
|
2180
|
-
return (
|
|
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
2181
|
}
|
|
2182
|
-
function
|
|
2183
|
-
return e *
|
|
2182
|
+
function Os(t, e) {
|
|
2183
|
+
return e * gt({ bpm: t.bpm });
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2186
|
-
const n = Math.max(1, Math.round(t /
|
|
2185
|
+
function Ns(t, e) {
|
|
2186
|
+
const n = Math.max(1, Math.round(t / gt(e)));
|
|
2187
2187
|
return { beats: n, grid: { ...e, bpm: n * 6e4 / t } };
|
|
2188
2188
|
}
|
|
2189
|
-
function
|
|
2190
|
-
const
|
|
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
2191
|
if (c <= 0) return i;
|
|
2192
|
-
const h = Math.max(1, Math.round(e.beatsPerBar ?? 4)), u = (Math.floor(
|
|
2192
|
+
const h = Math.max(1, Math.round(e.beatsPerBar ?? 4)), u = (Math.floor(o) % h + h) % h === 0;
|
|
2193
2193
|
return i * (u ? 1 + c : 1) / (1 + c);
|
|
2194
2194
|
}
|
|
2195
|
-
function
|
|
2196
|
-
const
|
|
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
2197
|
let c = 0, h = 0;
|
|
2198
|
-
for (let l = 0; l <
|
|
2198
|
+
for (let l = 0; l < o; l++) {
|
|
2199
2199
|
let u = 0;
|
|
2200
|
-
const d = l *
|
|
2200
|
+
const d = l * s, f = Math.min(t.length, d + s);
|
|
2201
2201
|
for (let m = d; m < f; m++) u += t[m] * t[m];
|
|
2202
|
-
const
|
|
2203
|
-
c =
|
|
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
2204
|
}
|
|
2205
|
-
if (n.normalize !== !1 && h > 0) for (let l = 0; l <
|
|
2206
|
-
return
|
|
2205
|
+
if (n.normalize !== !1 && h > 0) for (let l = 0; l < o; l++) a[l] /= h;
|
|
2206
|
+
return a;
|
|
2207
2207
|
}
|
|
2208
|
-
function
|
|
2208
|
+
function zs(t, e, n = 30, r) {
|
|
2209
2209
|
if (t.length === 0) return 0;
|
|
2210
|
-
const
|
|
2211
|
-
return i + (c - i) * (
|
|
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) };
|
|
2212
2242
|
}
|
|
2213
2243
|
const F = (t) => Math.round(t * 1e3) / 1e3;
|
|
2214
|
-
function
|
|
2244
|
+
function Bs(t, e = {}) {
|
|
2215
2245
|
if (t.length === 0) return "";
|
|
2216
|
-
const n = e.curviness ?? 1,
|
|
2217
|
-
let
|
|
2218
|
-
if (
|
|
2219
|
-
const
|
|
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;
|
|
2220
2250
|
for (let c = 0; c < i; c++) {
|
|
2221
|
-
const h =
|
|
2251
|
+
const h = a(c - 1), l = a(c), u = a(c + 1), d = a(c + 2);
|
|
2222
2252
|
if (n === 0) {
|
|
2223
|
-
|
|
2253
|
+
o += ` L${F(u.x)} ${F(u.y)}`;
|
|
2224
2254
|
continue;
|
|
2225
2255
|
}
|
|
2226
|
-
const f = n / 6,
|
|
2227
|
-
|
|
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)}`;
|
|
2228
2258
|
}
|
|
2229
|
-
return
|
|
2259
|
+
return r ? `${o} Z` : o;
|
|
2230
2260
|
}
|
|
2231
2261
|
const C = (t, e = 0) => {
|
|
2232
2262
|
const n = parseFloat(t ?? "");
|
|
2233
2263
|
return Number.isFinite(n) ? n : e;
|
|
2234
2264
|
};
|
|
2235
|
-
function
|
|
2265
|
+
function Ir(t) {
|
|
2236
2266
|
const e = (t ?? "").trim().split(/[\s,]+/).filter(Boolean).map(Number), n = [];
|
|
2237
|
-
for (let
|
|
2267
|
+
for (let r = 0; r + 1 < e.length; r += 2) n.push({ x: e[r], y: e[r + 1] });
|
|
2238
2268
|
return n;
|
|
2239
2269
|
}
|
|
2240
|
-
function
|
|
2270
|
+
function Hs(t) {
|
|
2241
2271
|
const e = t.attributes;
|
|
2242
2272
|
switch (t.tag.toLowerCase()) {
|
|
2243
2273
|
case "path":
|
|
2244
2274
|
return e.d ?? null;
|
|
2245
2275
|
case "circle":
|
|
2246
2276
|
case "ellipse": {
|
|
2247
|
-
const n = C(e.cx),
|
|
2248
|
-
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`;
|
|
2249
2279
|
}
|
|
2250
2280
|
case "rect": {
|
|
2251
|
-
const n = C(e.x),
|
|
2252
|
-
let
|
|
2253
|
-
return
|
|
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`;
|
|
2254
2284
|
}
|
|
2255
2285
|
case "line":
|
|
2256
2286
|
return `M${C(e.x1)} ${C(e.y1)} L${C(e.x2)} ${C(e.y2)}`;
|
|
2257
2287
|
case "polyline":
|
|
2258
2288
|
case "polygon": {
|
|
2259
|
-
const n =
|
|
2289
|
+
const n = Ir(e.points);
|
|
2260
2290
|
if (n.length === 0) return null;
|
|
2261
|
-
const
|
|
2262
|
-
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;
|
|
2263
2293
|
}
|
|
2264
2294
|
default:
|
|
2265
2295
|
return null;
|
|
2266
2296
|
}
|
|
2267
2297
|
}
|
|
2268
|
-
function
|
|
2269
|
-
const
|
|
2270
|
-
if (
|
|
2271
|
-
const
|
|
2272
|
-
for (let c = 0; c <
|
|
2273
|
-
const h =
|
|
2274
|
-
i.push({ at: t(l), time: h, age:
|
|
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;
|
|
2300
|
+
if (o >= e) return [];
|
|
2301
|
+
const a = n.period, i = [];
|
|
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 });
|
|
2275
2305
|
}
|
|
2276
2306
|
return i;
|
|
2277
2307
|
}
|
|
2278
|
-
const
|
|
2279
|
-
function
|
|
2280
|
-
const e = [], n = [],
|
|
2281
|
-
for (let i =
|
|
2282
|
-
const c = (t[i].x - t[
|
|
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);
|
|
2283
2313
|
if (l > 1e-9) return [c / l, h / l];
|
|
2284
2314
|
}
|
|
2285
2315
|
return null;
|
|
2286
2316
|
};
|
|
2287
|
-
for (let
|
|
2288
|
-
const
|
|
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];
|
|
2289
2319
|
let u = h[0] + l[0], d = h[1] + l[1];
|
|
2290
2320
|
const f = Math.hypot(u, d);
|
|
2291
2321
|
f < 1e-9 ? (u = h[0], d = h[1]) : (u /= f, d /= f);
|
|
2292
|
-
const
|
|
2293
|
-
e.push({ x:
|
|
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 });
|
|
2294
2324
|
}
|
|
2295
2325
|
return { left: e, right: n };
|
|
2296
2326
|
}
|
|
2297
|
-
function
|
|
2327
|
+
function Qs(t) {
|
|
2298
2328
|
const e = t.length;
|
|
2299
2329
|
if (e < 2) return null;
|
|
2300
2330
|
const n = t[e - 1];
|
|
2301
|
-
for (let
|
|
2302
|
-
const
|
|
2303
|
-
if (
|
|
2304
|
-
return { x: n.x, y: n.y, radius: n.width / 2, start: Math.atan2(
|
|
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);
|
|
2333
|
+
if (a > 1e-9)
|
|
2334
|
+
return { x: n.x, y: n.y, radius: n.width / 2, start: Math.atan2(s / a, -o / a) };
|
|
2305
2335
|
}
|
|
2306
2336
|
return null;
|
|
2307
2337
|
}
|
|
2308
|
-
const
|
|
2309
|
-
function
|
|
2338
|
+
const Gs = { scale: 1, turn: 0, x: 0, y: 0 };
|
|
2339
|
+
function Ks(t = {}) {
|
|
2310
2340
|
return { scale: t.scale ?? 1, turn: t.turn ?? 0, x: t.x ?? 0, y: t.y ?? 0 };
|
|
2311
2341
|
}
|
|
2312
|
-
function
|
|
2313
|
-
const { ax:
|
|
2314
|
-
return { scale: t, turn: e, x: n.x - (
|
|
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) };
|
|
2315
2345
|
}
|
|
2316
|
-
function
|
|
2317
|
-
const { ax: n, ay:
|
|
2318
|
-
return { x: n * e.x -
|
|
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 };
|
|
2319
2349
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const n =
|
|
2350
|
+
function Zs(t, e) {
|
|
2351
|
+
const n = Xe(e, { x: t.x, y: t.y });
|
|
2322
2352
|
return { scale: t.scale * e.scale, turn: t.turn + e.turn, x: n.x, y: n.y };
|
|
2323
2353
|
}
|
|
2324
|
-
function
|
|
2354
|
+
function Js(t) {
|
|
2325
2355
|
if (t.scale === 0) throw new Error("invertSimilarity: a scale of 0 cannot be undone");
|
|
2326
|
-
const e = { scale: 1 / t.scale, turn: -t.turn, x: 0, y: 0 }, n =
|
|
2356
|
+
const e = { scale: 1 / t.scale, turn: -t.turn, x: 0, y: 0 }, n = Xe(e, { x: t.x, y: t.y });
|
|
2327
2357
|
return { ...e, x: -n.x, y: -n.y };
|
|
2328
2358
|
}
|
|
2329
|
-
function
|
|
2330
|
-
const { ax: e, ay: n } = yt(t.scale, t.turn),
|
|
2331
|
-
return
|
|
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 };
|
|
2332
2362
|
}
|
|
2333
|
-
function
|
|
2363
|
+
function to(t, e) {
|
|
2334
2364
|
if (t.scale <= 0) throw new Error("powSimilarity: the scale must be positive");
|
|
2335
|
-
const n = Math.pow(t.scale, e),
|
|
2336
|
-
return
|
|
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 };
|
|
2337
2367
|
}
|
|
2338
|
-
function
|
|
2368
|
+
function eo(t) {
|
|
2339
2369
|
const { ax: e, ay: n } = yt(t.scale, t.turn);
|
|
2340
2370
|
return [e, n, -n, e, t.x, t.y];
|
|
2341
2371
|
}
|
|
@@ -2343,201 +2373,201 @@ const yt = (t, e) => {
|
|
|
2343
2373
|
const n = e * Math.PI / 180;
|
|
2344
2374
|
return { ax: t * Math.cos(n), ay: t * Math.sin(n) };
|
|
2345
2375
|
};
|
|
2346
|
-
function Nt([t, e, n],
|
|
2347
|
-
const
|
|
2348
|
-
return { x:
|
|
2349
|
-
}
|
|
2350
|
-
const
|
|
2351
|
-
function
|
|
2352
|
-
const [n,
|
|
2353
|
-
{ side: "top", depth: l, tag: t.tag, points: [c([n,
|
|
2354
|
-
{ side: "left", depth: l, tag: t.tag, points: [c([n,
|
|
2355
|
-
{ side: "right", depth: l, tag: t.tag, points: [c([
|
|
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])] }
|
|
2356
2386
|
];
|
|
2357
2387
|
return t.hide ? u.filter((d) => !t.hide.includes(d.side)) : u;
|
|
2358
2388
|
}
|
|
2359
|
-
function
|
|
2360
|
-
return t.map((n) => ({ box: n, depth:
|
|
2361
|
-
}
|
|
2362
|
-
function
|
|
2363
|
-
const e = t.size ?? 10,
|
|
2364
|
-
{ tag: 0, min: [-
|
|
2365
|
-
{ tag: 1, min: [e -
|
|
2366
|
-
{ tag: 2, min: [e -
|
|
2367
|
-
],
|
|
2368
|
-
return { boxes:
|
|
2369
|
-
}
|
|
2370
|
-
function
|
|
2371
|
-
const e = Math.max(2, Math.round(t.steps ?? 8)), n = t.tread ?? 1.5,
|
|
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 = [
|
|
2372
2402
|
{ dir: [1, 0, 0], across: [0, 1, 0], count: e },
|
|
2373
2403
|
{ dir: [0, 1, 0], across: [-1, 0, 0], count: e },
|
|
2374
|
-
{ dir: [-1, 0, 0], across: [0, -1, 0], count:
|
|
2375
|
-
{ dir: [0, -1, 0], across: [1, 0, 0], count:
|
|
2404
|
+
{ dir: [-1, 0, 0], across: [0, -1, 0], count: a },
|
|
2405
|
+
{ dir: [0, -1, 0], across: [1, 0, 0], count: a }
|
|
2376
2406
|
], l = [];
|
|
2377
2407
|
let u = [0, 0, 0], d = 0;
|
|
2378
2408
|
for (const y of h) {
|
|
2379
|
-
for (let
|
|
2380
|
-
const _ = d * c,
|
|
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];
|
|
2381
2411
|
l.push({
|
|
2382
2412
|
tag: d,
|
|
2383
|
-
min: [Math.min(
|
|
2384
|
-
max: [Math.max(
|
|
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]
|
|
2385
2415
|
}), d++;
|
|
2386
2416
|
}
|
|
2387
2417
|
u = [u[0] + y.dir[0] * y.count * n, u[1] + y.dir[1] * y.count * n, 0];
|
|
2388
2418
|
}
|
|
2389
|
-
const f = i * c,
|
|
2390
|
-
return { boxes: l, faces:
|
|
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 };
|
|
2391
2421
|
}
|
|
2392
|
-
function
|
|
2393
|
-
let
|
|
2394
|
-
for (const
|
|
2395
|
-
const
|
|
2396
|
-
|
|
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;
|
|
2397
2427
|
}
|
|
2398
|
-
return
|
|
2428
|
+
return r;
|
|
2399
2429
|
}
|
|
2400
|
-
function
|
|
2430
|
+
function so(t, e = {}) {
|
|
2401
2431
|
if (t.length === 0) return [];
|
|
2402
|
-
const n = e.threshold ?? 1,
|
|
2403
|
-
x: Math.min(...t.map((f) => f.x - f.r *
|
|
2404
|
-
y: Math.min(...t.map((f) => f.y - f.r *
|
|
2405
|
-
width: Math.max(...t.map((f) => f.x + f.r *
|
|
2406
|
-
height: Math.max(...t.map((f) => f.y + f.r *
|
|
2407
|
-
},
|
|
2408
|
-
for (let f = 0; f < i; f++) for (let
|
|
2409
|
-
const h = (f,
|
|
2410
|
-
const _ = m ===
|
|
2411
|
-
return { x: f + (M - f) * _, y:
|
|
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) * _ };
|
|
2412
2442
|
}, u = [];
|
|
2413
2443
|
for (let f = 0; f + 1 < i; f++)
|
|
2414
|
-
for (let
|
|
2415
|
-
const m =
|
|
2416
|
-
if (
|
|
2417
|
-
const x = () => l(m, M, _[0], y, M, _[1]),
|
|
2418
|
-
switch (
|
|
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) {
|
|
2419
2449
|
case 1:
|
|
2420
2450
|
case 14:
|
|
2421
2451
|
u.push([P(), x()]);
|
|
2422
2452
|
break;
|
|
2423
2453
|
case 2:
|
|
2424
2454
|
case 13:
|
|
2425
|
-
u.push([x(),
|
|
2455
|
+
u.push([x(), S()]);
|
|
2426
2456
|
break;
|
|
2427
2457
|
case 3:
|
|
2428
2458
|
case 12:
|
|
2429
|
-
u.push([P(),
|
|
2459
|
+
u.push([P(), S()]);
|
|
2430
2460
|
break;
|
|
2431
2461
|
case 4:
|
|
2432
2462
|
case 11:
|
|
2433
|
-
u.push([
|
|
2463
|
+
u.push([S(), k()]);
|
|
2434
2464
|
break;
|
|
2435
2465
|
case 6:
|
|
2436
2466
|
case 9:
|
|
2437
|
-
u.push([x(),
|
|
2467
|
+
u.push([x(), k()]);
|
|
2438
2468
|
break;
|
|
2439
2469
|
case 7:
|
|
2440
2470
|
case 8:
|
|
2441
|
-
u.push([P(),
|
|
2471
|
+
u.push([P(), k()]);
|
|
2442
2472
|
break;
|
|
2443
2473
|
case 5:
|
|
2444
|
-
b ? u.push([P(),
|
|
2474
|
+
b ? u.push([P(), k()], [x(), S()]) : u.push([P(), x()], [S(), k()]);
|
|
2445
2475
|
break;
|
|
2446
2476
|
case 10:
|
|
2447
|
-
b ? u.push([P(), x()], [
|
|
2477
|
+
b ? u.push([P(), x()], [S(), k()]) : u.push([P(), k()], [x(), S()]);
|
|
2448
2478
|
break;
|
|
2449
2479
|
}
|
|
2450
2480
|
}
|
|
2451
|
-
const d =
|
|
2481
|
+
const d = Dr(u);
|
|
2452
2482
|
return e.smooth === !1 ? d : d.map((f) => ce(ce(f)));
|
|
2453
2483
|
}
|
|
2454
|
-
function
|
|
2455
|
-
const e = (
|
|
2456
|
-
t.forEach(([
|
|
2457
|
-
for (const c of [
|
|
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]) {
|
|
2458
2488
|
const h = e(c);
|
|
2459
2489
|
n.has(h) || n.set(h, []), n.get(h).push(i);
|
|
2460
2490
|
}
|
|
2461
2491
|
});
|
|
2462
|
-
const
|
|
2463
|
-
for (let
|
|
2464
|
-
if (
|
|
2465
|
-
|
|
2466
|
-
const
|
|
2467
|
-
let i = t[
|
|
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];
|
|
2468
2498
|
for (; ; ) {
|
|
2469
|
-
const c = (n.get(e(i)) ?? []).find((u) => !
|
|
2499
|
+
const c = (n.get(e(i)) ?? []).find((u) => !r[u]);
|
|
2470
2500
|
if (c === void 0) break;
|
|
2471
|
-
|
|
2501
|
+
r[c] = !0;
|
|
2472
2502
|
const [h, l] = t[c];
|
|
2473
|
-
if (i = e(h) === e(i) ? l : h, e(i) === e(
|
|
2474
|
-
|
|
2503
|
+
if (i = e(h) === e(i) ? l : h, e(i) === e(a[0])) break;
|
|
2504
|
+
a.push(i);
|
|
2475
2505
|
}
|
|
2476
|
-
|
|
2506
|
+
a.length >= 3 && s.push(a);
|
|
2477
2507
|
}
|
|
2478
|
-
return
|
|
2508
|
+
return s;
|
|
2479
2509
|
}
|
|
2480
2510
|
function ce(t) {
|
|
2481
2511
|
const e = [];
|
|
2482
2512
|
for (let n = 0; n < t.length; n++) {
|
|
2483
|
-
const
|
|
2484
|
-
e.push({ x:
|
|
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 });
|
|
2485
2515
|
}
|
|
2486
2516
|
return e;
|
|
2487
2517
|
}
|
|
2488
|
-
function
|
|
2518
|
+
function oo(t) {
|
|
2489
2519
|
const e = Math.min(1, Math.max(0, t.progress));
|
|
2490
2520
|
if (e <= 0) return [];
|
|
2491
|
-
const n = t.width / 2,
|
|
2492
|
-
for (let
|
|
2493
|
-
const _ =
|
|
2494
|
-
u.push({ x:
|
|
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 * _ });
|
|
2495
2525
|
}
|
|
2496
|
-
const f = Math.max(8, Math.round(t.segments ?? 12)),
|
|
2497
|
-
for (let
|
|
2498
|
-
const _ = m + (M - m) *
|
|
2499
|
-
y.push({ x:
|
|
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 });
|
|
2500
2530
|
}
|
|
2501
2531
|
return [...d, ...y, ...u.reverse()];
|
|
2502
2532
|
}
|
|
2503
|
-
function
|
|
2504
|
-
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,
|
|
2505
|
-
if (
|
|
2506
|
-
const
|
|
2507
|
-
for (let u = 0; u <
|
|
2508
|
-
const d = u /
|
|
2509
|
-
l.push({ x: t.x + Math.cos(d) *
|
|
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 });
|
|
2510
2540
|
}
|
|
2511
2541
|
return l;
|
|
2512
2542
|
}
|
|
2513
|
-
function
|
|
2543
|
+
function io(t) {
|
|
2514
2544
|
const e = t.progress;
|
|
2515
2545
|
if (e <= 0 || e >= 1) return [];
|
|
2516
|
-
const n = Math.max(3, Math.round(t.pieces ?? 8)),
|
|
2517
|
-
for (let
|
|
2518
|
-
const i =
|
|
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 = [];
|
|
2519
2549
|
for (let h = 0; h <= 4; h++) {
|
|
2520
|
-
const l = i -
|
|
2521
|
-
c.push({ x: t.x + Math.cos(l) *
|
|
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 });
|
|
2522
2552
|
}
|
|
2523
|
-
|
|
2553
|
+
r.push(c);
|
|
2524
2554
|
}
|
|
2525
|
-
return
|
|
2555
|
+
return r;
|
|
2526
2556
|
}
|
|
2527
|
-
function
|
|
2557
|
+
function co(t, e = {}) {
|
|
2528
2558
|
const n = Math.max(0.05, 1 + t);
|
|
2529
2559
|
return { sx: e.keep === "volume" ? 1 / Math.sqrt(n) : 1 / n, sy: n };
|
|
2530
2560
|
}
|
|
2531
|
-
function
|
|
2532
|
-
return t.map((
|
|
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 }));
|
|
2533
2563
|
}
|
|
2534
|
-
function
|
|
2564
|
+
function Lr(t, e) {
|
|
2535
2565
|
return [t[0] + e[0], t[1] + e[1], t[2] + e[2]];
|
|
2536
2566
|
}
|
|
2537
2567
|
function Xt(t, e) {
|
|
2538
2568
|
return [t[0] - e[0], t[1] - e[1], t[2] - e[2]];
|
|
2539
2569
|
}
|
|
2540
|
-
function
|
|
2570
|
+
function Ue(t, e) {
|
|
2541
2571
|
return [t[0] * e, t[1] * e, t[2] * e];
|
|
2542
2572
|
}
|
|
2543
2573
|
function ht(t, e) {
|
|
@@ -2549,60 +2579,60 @@ function Rt(t, e) {
|
|
|
2549
2579
|
function Yt(t) {
|
|
2550
2580
|
return Math.hypot(t[0], t[1], t[2]);
|
|
2551
2581
|
}
|
|
2552
|
-
function
|
|
2582
|
+
function Fr(t, e) {
|
|
2553
2583
|
return Yt(Xt(t, e));
|
|
2554
2584
|
}
|
|
2555
2585
|
function Ct(t) {
|
|
2556
2586
|
const e = Yt(t);
|
|
2557
|
-
return e === 0 ? [0, 0, 0] :
|
|
2587
|
+
return e === 0 ? [0, 0, 0] : Ue(t, 1 / e);
|
|
2558
2588
|
}
|
|
2559
|
-
function
|
|
2589
|
+
function Or(t, e, n) {
|
|
2560
2590
|
return [t[0] + (e[0] - t[0]) * n, t[1] + (e[1] - t[1]) * n, t[2] + (e[2] - t[2]) * n];
|
|
2561
2591
|
}
|
|
2562
|
-
const
|
|
2592
|
+
const ho = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2563
2593
|
__proto__: null,
|
|
2564
|
-
add:
|
|
2594
|
+
add: Lr,
|
|
2565
2595
|
cross: Rt,
|
|
2566
|
-
distance:
|
|
2596
|
+
distance: Fr,
|
|
2567
2597
|
dot: ht,
|
|
2568
2598
|
length: Yt,
|
|
2569
|
-
lerp:
|
|
2599
|
+
lerp: Or,
|
|
2570
2600
|
normalize: Ct,
|
|
2571
|
-
scale:
|
|
2601
|
+
scale: Ue,
|
|
2572
2602
|
subtract: Xt
|
|
2573
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
2574
|
-
function
|
|
2603
|
+
}, Symbol.toStringTag, { value: "Module" })), Nr = Math.PI / 180;
|
|
2604
|
+
function Xr() {
|
|
2575
2605
|
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
|
|
2576
2606
|
}
|
|
2577
|
-
function
|
|
2607
|
+
function Yr(t, e) {
|
|
2578
2608
|
const n = new Array(16);
|
|
2579
|
-
for (let
|
|
2580
|
-
for (let
|
|
2581
|
-
let
|
|
2582
|
-
for (let
|
|
2583
|
-
n[
|
|
2609
|
+
for (let r = 0; r < 4; r++)
|
|
2610
|
+
for (let s = 0; s < 4; s++) {
|
|
2611
|
+
let o = 0;
|
|
2612
|
+
for (let a = 0; a < 4; a++) o += t[a * 4 + s] * e[r * 4 + a];
|
|
2613
|
+
n[r * 4 + s] = o;
|
|
2584
2614
|
}
|
|
2585
2615
|
return n;
|
|
2586
2616
|
}
|
|
2587
|
-
function
|
|
2617
|
+
function zr(t) {
|
|
2588
2618
|
return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, t[0], t[1], t[2], 1];
|
|
2589
2619
|
}
|
|
2590
|
-
function
|
|
2620
|
+
function jr(t) {
|
|
2591
2621
|
return [t[0], 0, 0, 0, 0, t[1], 0, 0, 0, 0, t[2], 0, 0, 0, 0, 1];
|
|
2592
2622
|
}
|
|
2593
|
-
function
|
|
2594
|
-
const [e, n,
|
|
2623
|
+
function Ve(t) {
|
|
2624
|
+
const [e, n, r, s] = t;
|
|
2595
2625
|
return [
|
|
2596
|
-
1 - 2 * (n * n +
|
|
2597
|
-
2 * (e * n +
|
|
2598
|
-
2 * (e *
|
|
2626
|
+
1 - 2 * (n * n + r * r),
|
|
2627
|
+
2 * (e * n + r * s),
|
|
2628
|
+
2 * (e * r - n * s),
|
|
2599
2629
|
0,
|
|
2600
|
-
2 * (e * n -
|
|
2601
|
-
1 - 2 * (e * e +
|
|
2602
|
-
2 * (n *
|
|
2630
|
+
2 * (e * n - r * s),
|
|
2631
|
+
1 - 2 * (e * e + r * r),
|
|
2632
|
+
2 * (n * r + e * s),
|
|
2603
2633
|
0,
|
|
2604
|
-
2 * (e *
|
|
2605
|
-
2 * (n *
|
|
2634
|
+
2 * (e * r + n * s),
|
|
2635
|
+
2 * (n * r - e * s),
|
|
2606
2636
|
1 - 2 * (e * e + n * n),
|
|
2607
2637
|
0,
|
|
2608
2638
|
0,
|
|
@@ -2611,248 +2641,253 @@ function Ue(t) {
|
|
|
2611
2641
|
1
|
|
2612
2642
|
];
|
|
2613
2643
|
}
|
|
2614
|
-
function
|
|
2615
|
-
const
|
|
2616
|
-
for (let
|
|
2617
|
-
s
|
|
2618
|
-
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;
|
|
2619
2649
|
}
|
|
2620
|
-
function
|
|
2650
|
+
function Vr(t) {
|
|
2621
2651
|
const e = new Array(16);
|
|
2622
|
-
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];
|
|
2623
2653
|
return e;
|
|
2624
2654
|
}
|
|
2625
|
-
function
|
|
2626
|
-
const [e, n, s,
|
|
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;
|
|
2627
2657
|
if (Math.abs($) < 1e-12) return null;
|
|
2628
2658
|
const I = 1 / $;
|
|
2629
2659
|
return [
|
|
2630
|
-
(
|
|
2631
|
-
(
|
|
2632
|
-
(
|
|
2633
|
-
(u * x - l *
|
|
2634
|
-
(i * b -
|
|
2635
|
-
(e *
|
|
2636
|
-
(m * _ - f *
|
|
2637
|
-
(h *
|
|
2638
|
-
(
|
|
2639
|
-
(n * b - e *
|
|
2640
|
-
(f * x -
|
|
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,
|
|
2641
2671
|
(l * _ - h * x - d * y) * I,
|
|
2642
|
-
(
|
|
2643
|
-
(e * T - n * P +
|
|
2644
|
-
(
|
|
2645
|
-
(h *
|
|
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
|
|
2646
2676
|
];
|
|
2647
2677
|
}
|
|
2648
|
-
function
|
|
2649
|
-
const
|
|
2650
|
-
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];
|
|
2651
2681
|
}
|
|
2652
|
-
function
|
|
2653
|
-
const
|
|
2654
|
-
return [2 *
|
|
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];
|
|
2655
2685
|
}
|
|
2656
|
-
function
|
|
2657
|
-
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);
|
|
2658
2688
|
return [
|
|
2659
|
-
r[0],
|
|
2660
|
-
a[0],
|
|
2661
2689
|
s[0],
|
|
2690
|
+
o[0],
|
|
2691
|
+
r[0],
|
|
2662
2692
|
0,
|
|
2663
|
-
r[1],
|
|
2664
|
-
a[1],
|
|
2665
2693
|
s[1],
|
|
2694
|
+
o[1],
|
|
2695
|
+
r[1],
|
|
2666
2696
|
0,
|
|
2667
|
-
r[2],
|
|
2668
|
-
a[2],
|
|
2669
2697
|
s[2],
|
|
2698
|
+
o[2],
|
|
2699
|
+
r[2],
|
|
2670
2700
|
0,
|
|
2671
|
-
-ht(r, t),
|
|
2672
|
-
-ht(a, t),
|
|
2673
2701
|
-ht(s, t),
|
|
2702
|
+
-ht(o, t),
|
|
2703
|
+
-ht(r, t),
|
|
2674
2704
|
1
|
|
2675
2705
|
];
|
|
2676
2706
|
}
|
|
2677
|
-
function
|
|
2678
|
-
const n = t[0] * e[0] + t[4] * e[1] + t[8] * e[2] + t[12],
|
|
2679
|
-
return
|
|
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];
|
|
2680
2710
|
}
|
|
2681
|
-
const
|
|
2711
|
+
const lo = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2682
2712
|
__proto__: null,
|
|
2683
|
-
compose:
|
|
2684
|
-
fromQuat:
|
|
2685
|
-
identity:
|
|
2686
|
-
invert:
|
|
2687
|
-
lookAt:
|
|
2688
|
-
multiply:
|
|
2689
|
-
orthographic:
|
|
2690
|
-
perspective:
|
|
2691
|
-
scaling:
|
|
2692
|
-
transformPoint:
|
|
2693
|
-
translation:
|
|
2694
|
-
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
|
|
2695
2725
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2696
2726
|
export {
|
|
2697
|
-
|
|
2698
|
-
|
|
2727
|
+
Zr as Clock,
|
|
2728
|
+
we as DEFAULT_BAKE_INTERVAL_MS,
|
|
2699
2729
|
Bt as DEFAULT_INERTIA_FRICTION,
|
|
2700
2730
|
L as DEFAULT_SPRING,
|
|
2701
2731
|
Vt as FORMAT_VERSION,
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
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,
|
|
2707
2738
|
de as SPRING_MAX_DURATION_MS,
|
|
2708
|
-
|
|
2739
|
+
Jr as SPRING_PRESETS,
|
|
2709
2740
|
et as SPRING_STEP_MS,
|
|
2710
2741
|
lt as SpringSampler,
|
|
2711
|
-
|
|
2742
|
+
nr as SpringTrackPlayer,
|
|
2712
2743
|
Pe as Timeline,
|
|
2713
2744
|
ut as TrackPlayer,
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2745
|
+
Ms as ValueResolver,
|
|
2746
|
+
Xe as applySimilarity,
|
|
2747
|
+
Ne as aspectOf,
|
|
2748
|
+
Ys as audioEnvelope,
|
|
2717
2749
|
pn as backOut,
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
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,
|
|
2725
2757
|
Ot as beatTime,
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
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,
|
|
2737
2769
|
$e as createRandom,
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
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,
|
|
2749
2781
|
me as easeInCubic,
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2782
|
+
ln as easeInOut,
|
|
2783
|
+
pe as easeInOutCubic,
|
|
2784
|
+
cn as easeInOutQuad,
|
|
2785
|
+
on as easeInQuad,
|
|
2786
|
+
hn as easeOut,
|
|
2787
|
+
ge as easeOutCubic,
|
|
2756
2788
|
an as easeOutQuad,
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2789
|
+
kr as editDistance,
|
|
2790
|
+
mn as elasticOut,
|
|
2791
|
+
zs as envelopeAt,
|
|
2792
|
+
Jn as expandParametricEasings,
|
|
2761
2793
|
ue as formatVersionFor,
|
|
2762
|
-
|
|
2794
|
+
js as frameRect,
|
|
2795
|
+
Us as frameSize,
|
|
2796
|
+
gs as fromJSON,
|
|
2763
2797
|
Lt as getEasingFunction,
|
|
2764
2798
|
Te as getInterpolator,
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2799
|
+
ve as getMotionPathPoint,
|
|
2800
|
+
as as getPathLength,
|
|
2801
|
+
vn as getPointAtProgress,
|
|
2802
|
+
Ge as hasKeyframes,
|
|
2803
|
+
dr as hashSeed,
|
|
2804
|
+
Ke as heldTime,
|
|
2771
2805
|
mt as inertiaDuration,
|
|
2772
2806
|
dt as inertiaRest,
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2807
|
+
vt as inertiaValueAt,
|
|
2808
|
+
ss as inertiaVelocityAt,
|
|
2809
|
+
Qn as interpolateArray,
|
|
2810
|
+
Wn as interpolateColor,
|
|
2811
|
+
fs as interpolateMotionPath,
|
|
2778
2812
|
N as interpolateNumber,
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2813
|
+
Kn as interpolatePathString,
|
|
2814
|
+
Gn as interpolateQuaternion,
|
|
2815
|
+
oe as interpolateString,
|
|
2816
|
+
Js as invertSimilarity,
|
|
2817
|
+
Qe as isCubicBezierEasing,
|
|
2784
2818
|
U as isInertiaTrack,
|
|
2785
|
-
|
|
2819
|
+
Gr as isMotionPathPoint,
|
|
2786
2820
|
he as isMotionPathTrack,
|
|
2787
|
-
|
|
2788
|
-
|
|
2821
|
+
St as isParametricEasing,
|
|
2822
|
+
Yn as isPathData,
|
|
2789
2823
|
V as isSpringTrack,
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2824
|
+
Et as isTextTrack,
|
|
2825
|
+
ns as isUnderdamped,
|
|
2826
|
+
ys as isUnresolved,
|
|
2827
|
+
Ye as isoDepth,
|
|
2828
|
+
ze as isometricBoxFaces,
|
|
2829
|
+
je as isometricFaces,
|
|
2796
2830
|
Pt as linear,
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
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,
|
|
2811
2845
|
Q as parsePath,
|
|
2812
|
-
|
|
2813
|
-
|
|
2846
|
+
ro as penroseStairs,
|
|
2847
|
+
no as penroseTriangle,
|
|
2814
2848
|
K as phaseOf,
|
|
2815
2849
|
Le as pingPong,
|
|
2816
|
-
|
|
2817
|
-
|
|
2850
|
+
Ts as planNarration,
|
|
2851
|
+
ds as playheadCrossings,
|
|
2818
2852
|
ye as pointAtDistance,
|
|
2819
|
-
|
|
2820
|
-
|
|
2853
|
+
Bs as pointsToPath,
|
|
2854
|
+
to as powSimilarity,
|
|
2821
2855
|
Nt as projectIsometric,
|
|
2822
|
-
|
|
2856
|
+
us as quat,
|
|
2823
2857
|
Re as randomBetween,
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
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,
|
|
2843
2878
|
le as staggerDistance,
|
|
2844
2879
|
fe as staggerOffset,
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
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,
|
|
2853
2888
|
j as trackTargets,
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2889
|
+
qs as trailSamples,
|
|
2890
|
+
$s as unknownName,
|
|
2891
|
+
ho as vec3,
|
|
2892
|
+
Cs as wobble
|
|
2858
2893
|
};
|