@algorisys/tinyfly 0.67.1 → 0.69.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 +17 -16
- package/bin/tinyfly.mjs +20 -6
- package/lib/addons/gsap-compat.js +202 -198
- package/lib/browser/tinyfly.iife.js +18 -3
- package/lib/browser/tinyfly.js +1153 -954
- package/lib/browser/tinyfly.umd.js +18 -3
- package/lib/cli/tools.js +34 -1
- package/lib/embed/tinyfly-embed.iife.js +18 -3
- package/lib/embed/tinyfly-embed.js +972 -749
- package/lib/player/tinyfly-player.es.js +200 -128
- package/lib/player/tinyfly-player.iife.js +2 -2
- package/lib/player/tinyfly-player.umd.js +2 -2
- package/lib/types/browser/index.d.ts +1 -0
- package/lib/types/compat/gsap/live.d.ts +1 -1
- package/lib/types/compat/gsap/stage.d.ts +8 -0
- package/lib/types/embed/choices.d.ts +3 -0
- package/lib/types/embed/controls.d.ts +10 -2
- package/lib/types/embed/index.d.ts +3 -2
- package/lib/types/embed/mount.d.ts +7 -0
- package/lib/types/embed/tools.d.ts +10 -0
- package/lib/types/player/index.d.ts +1 -1
- package/lib/types/player/player.d.ts +50 -0
- package/package.json +1 -1
package/lib/browser/tinyfly.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Zi(i) {
|
|
2
2
|
return typeof i == "object" && i !== null && i.type === "cubic-bezier";
|
|
3
3
|
}
|
|
4
4
|
function Et(i) {
|
|
5
5
|
return typeof i == "object" && i !== null && i.type !== "cubic-bezier";
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
function
|
|
7
|
+
const Ct = 1;
|
|
8
|
+
function de(i) {
|
|
9
9
|
return i.property === "text" && "textConfig" in i;
|
|
10
10
|
}
|
|
11
11
|
function Z(i) {
|
|
@@ -14,16 +14,16 @@ function Z(i) {
|
|
|
14
14
|
function Q(i) {
|
|
15
15
|
return i.kind === "spring" && "spring" in i;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function li(i) {
|
|
18
18
|
return i.property === "motionPath" && "motionPathConfig" in i;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function yo(i) {
|
|
21
21
|
return typeof i == "object" && i !== null && "x" in i && "y" in i && "angle" in i;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Qi(i) {
|
|
24
24
|
return "keyframes" in i;
|
|
25
25
|
}
|
|
26
|
-
class
|
|
26
|
+
class bo {
|
|
27
27
|
_currentTime = 0;
|
|
28
28
|
_isRunning = !1;
|
|
29
29
|
onTick = null;
|
|
@@ -49,7 +49,7 @@ class co {
|
|
|
49
49
|
this._currentTime = t;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
class
|
|
52
|
+
class vo {
|
|
53
53
|
_currentTime = 0;
|
|
54
54
|
_isRunning = !1;
|
|
55
55
|
_lastFrameTime = null;
|
|
@@ -96,7 +96,7 @@ class lo {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function hi(i, t, e = "start") {
|
|
100
100
|
if (t <= 1) return 0;
|
|
101
101
|
if (typeof e == "number") {
|
|
102
102
|
const s = Math.max(0, Math.min(t - 1, e));
|
|
@@ -113,36 +113,36 @@ function ci(i, t, e = "start") {
|
|
|
113
113
|
return i;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function ui(i, t = "start") {
|
|
117
117
|
if (i <= 1) return 0;
|
|
118
118
|
let e = 0;
|
|
119
119
|
for (let s = 0; s < i; s++)
|
|
120
|
-
e = Math.max(e,
|
|
120
|
+
e = Math.max(e, hi(s, i, t));
|
|
121
121
|
return e;
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function pe(i, t, e) {
|
|
124
124
|
if (e.offsets) return e.offsets[i] ?? 0;
|
|
125
|
-
const s = e.from ?? "start", n =
|
|
125
|
+
const s = e.from ?? "start", n = hi(i, t, s);
|
|
126
126
|
if (e.amount !== void 0) {
|
|
127
|
-
const r =
|
|
127
|
+
const r = ui(t, s);
|
|
128
128
|
return r === 0 ? 0 : e.amount * n / r;
|
|
129
129
|
}
|
|
130
130
|
return e.each !== void 0 ? e.each * n : 0;
|
|
131
131
|
}
|
|
132
132
|
function ie(i, t) {
|
|
133
|
-
return Array.from({ length: i }, (e, s) =>
|
|
133
|
+
return Array.from({ length: i }, (e, s) => pe(s, i, t));
|
|
134
134
|
}
|
|
135
135
|
function Dt(i, t) {
|
|
136
136
|
return i <= 1 ? 0 : Math.max(...ie(i, t));
|
|
137
137
|
}
|
|
138
|
-
const dt = 1,
|
|
138
|
+
const dt = 1, fi = 6e4, xt = fi / dt, q = {
|
|
139
139
|
stiffness: 180,
|
|
140
140
|
damping: 12,
|
|
141
141
|
mass: 1,
|
|
142
142
|
velocity: 0,
|
|
143
143
|
restDelta: 0.01,
|
|
144
144
|
restSpeed: 0.1
|
|
145
|
-
},
|
|
145
|
+
}, Xt = {
|
|
146
146
|
gentle: { stiffness: 120, damping: 18, mass: 1 },
|
|
147
147
|
default: { stiffness: 180, damping: 12, mass: 1 },
|
|
148
148
|
snappy: { stiffness: 280, damping: 20, mass: 1 },
|
|
@@ -175,7 +175,7 @@ class Ot {
|
|
|
175
175
|
/** Once at rest we stop simulating; every later time returns `to`. */
|
|
176
176
|
settledStep = null;
|
|
177
177
|
constructor(t) {
|
|
178
|
-
this.from = t.from, this.to = t.to, this.stiffness = t.stiffness ??
|
|
178
|
+
this.from = t.from, this.to = t.to, this.stiffness = t.stiffness ?? q.stiffness, this.damping = t.damping ?? q.damping, this.mass = t.mass ?? q.mass, this.restDelta = t.restDelta ?? q.restDelta, this.restSpeed = t.restSpeed ?? q.restSpeed, this.distance = Math.abs(this.to - this.from) || 1, this.samples = [this.from], this.velocity = t.velocity ?? q.velocity, this.isAtRest(this.from) && (this.settledStep = 0);
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Whether a position/velocity pair counts as settled.
|
|
@@ -204,12 +204,12 @@ class Ot {
|
|
|
204
204
|
* of a spring track. Runs the simulation to completion once.
|
|
205
205
|
*/
|
|
206
206
|
settleTime() {
|
|
207
|
-
return this.simulateTo(
|
|
207
|
+
return this.simulateTo(xt + 1), this.settledStep !== null ? this.settledStep * dt : fi;
|
|
208
208
|
}
|
|
209
209
|
/** Advance the cached simulation until it holds at least `steps` samples. */
|
|
210
210
|
simulateTo(t) {
|
|
211
211
|
if (this.settledStep !== null) return;
|
|
212
|
-
const e = Math.min(t,
|
|
212
|
+
const e = Math.min(t, xt + 1), s = dt / 1e3;
|
|
213
213
|
for (; this.samples.length < e; ) {
|
|
214
214
|
const n = this.samples[this.samples.length - 1], r = n - this.to, o = -this.stiffness * r, a = -this.damping * this.velocity, c = (o + a) / this.mass;
|
|
215
215
|
this.velocity += c * s;
|
|
@@ -219,32 +219,32 @@ class Ot {
|
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
this.samples.length >
|
|
222
|
+
this.samples.length > xt && (this.settledStep = xt);
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function wo(i, t) {
|
|
226
226
|
return new Ot(i).valueAt(t);
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Ji(i) {
|
|
229
229
|
return new Ot(i).settleTime();
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
const t = i.stiffness ??
|
|
231
|
+
function To(i) {
|
|
232
|
+
const t = i.stiffness ?? q.stiffness, e = i.damping ?? q.damping, s = i.mass ?? q.mass;
|
|
233
233
|
return e < 2 * Math.sqrt(t * s);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
const t = i.stiffness ??
|
|
235
|
+
function xo(i) {
|
|
236
|
+
const t = i.stiffness ?? q.stiffness, e = i.mass ?? q.mass;
|
|
237
237
|
return 2 * Math.sqrt(t * e);
|
|
238
238
|
}
|
|
239
|
-
const
|
|
239
|
+
const Te = 4, ts = 2e-3, es = 1e-4, is = 6e4;
|
|
240
240
|
function Bt(i) {
|
|
241
|
-
const t = i.friction ??
|
|
242
|
-
return t > 0 ? t :
|
|
241
|
+
const t = i.friction ?? Te;
|
|
242
|
+
return t > 0 ? t : Te;
|
|
243
243
|
}
|
|
244
|
-
function
|
|
244
|
+
function _t(i) {
|
|
245
245
|
return i.from + i.velocity / Bt(i);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function ss(i, t) {
|
|
248
248
|
if (t === void 0) return i;
|
|
249
249
|
if (typeof t == "number")
|
|
250
250
|
return t > 0 ? Math.round(i / t) * t : i;
|
|
@@ -254,42 +254,42 @@ function ts(i, t) {
|
|
|
254
254
|
Math.abs(s - i) < Math.abs(e - i) && (e = s);
|
|
255
255
|
return e;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
258
|
-
let t =
|
|
257
|
+
function bt(i) {
|
|
258
|
+
let t = ss(_t(i), i.end);
|
|
259
259
|
return i.min !== void 0 && (t = Math.max(i.min, t)), i.max !== void 0 && (t = Math.min(i.max, t)), t;
|
|
260
260
|
}
|
|
261
|
-
function
|
|
262
|
-
const t = Math.abs(
|
|
261
|
+
function vt(i) {
|
|
262
|
+
const t = Math.abs(bt(i) - i.from);
|
|
263
263
|
if (t === 0) return 0;
|
|
264
|
-
const e = i.restDelta ?? Math.max(
|
|
264
|
+
const e = i.restDelta ?? Math.max(es, t * ts);
|
|
265
265
|
if (e >= t) return 0;
|
|
266
266
|
const s = Math.log(t / e) / Bt(i);
|
|
267
|
-
return Math.min(
|
|
267
|
+
return Math.min(is, s * 1e3);
|
|
268
268
|
}
|
|
269
269
|
function se(i, t) {
|
|
270
270
|
if (t <= 0) return i.from;
|
|
271
|
-
const e =
|
|
272
|
-
if (t >=
|
|
271
|
+
const e = bt(i);
|
|
272
|
+
if (t >= vt(i)) return e;
|
|
273
273
|
const s = Bt(i);
|
|
274
274
|
return i.from + (e - i.from) * (1 - Math.exp(-s * t / 1e3));
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const e = Bt(i), s =
|
|
278
|
-
return t >=
|
|
276
|
+
function ko(i, t) {
|
|
277
|
+
const e = Bt(i), s = bt(i);
|
|
278
|
+
return t >= vt(i) ? 0 : (s - i.from) * e * Math.exp(-e * Math.max(0, t) / 1e3);
|
|
279
279
|
}
|
|
280
|
-
const ne = (i) => i,
|
|
280
|
+
const ne = (i) => i, ns = (i) => i * i, rs = (i) => 1 - (1 - i) * (1 - i), os = (i) => i < 0.5 ? 2 * i * i : 1 - Math.pow(-2 * i + 2, 2) / 2, di = (i) => i * i * i, pi = (i) => 1 - Math.pow(1 - i, 3), Nt = (i) => i < 0.5 ? 4 * i * i * i : 1 - Math.pow(-2 * i + 2, 3) / 2, as = di, cs = pi, ls = Nt, hs = {
|
|
281
281
|
linear: ne,
|
|
282
|
-
"ease-in":
|
|
283
|
-
"ease-out":
|
|
284
|
-
"ease-in-out":
|
|
285
|
-
"ease-in-quad":
|
|
286
|
-
"ease-out-quad":
|
|
287
|
-
"ease-in-out-quad":
|
|
288
|
-
"ease-in-cubic":
|
|
289
|
-
"ease-out-cubic":
|
|
282
|
+
"ease-in": as,
|
|
283
|
+
"ease-out": cs,
|
|
284
|
+
"ease-in-out": ls,
|
|
285
|
+
"ease-in-quad": ns,
|
|
286
|
+
"ease-out-quad": rs,
|
|
287
|
+
"ease-in-out-quad": os,
|
|
288
|
+
"ease-in-cubic": di,
|
|
289
|
+
"ease-out-cubic": pi,
|
|
290
290
|
"ease-in-out-cubic": Nt
|
|
291
291
|
};
|
|
292
|
-
function
|
|
292
|
+
function us(i) {
|
|
293
293
|
const [t, e, s, n] = i, r = 3 * t, o = 3 * (s - t) - r, a = 1 - r - o, c = 3 * e, l = 3 * (n - e) - c, h = 1 - c - l, f = (p) => ((a * p + o) * p + r) * p, u = (p) => ((h * p + l) * p + c) * p, d = (p) => (3 * a * p + 2 * o) * p + r, m = (p) => {
|
|
294
294
|
let g = p;
|
|
295
295
|
for (let v = 0; v < 8; v++) {
|
|
@@ -322,11 +322,11 @@ function Vt(i, t = "out") {
|
|
|
322
322
|
const e = (s) => 1 - i(1 - s);
|
|
323
323
|
return t === "in" ? e : (s) => s < 0.5 ? e(s * 2) / 2 : i(s * 2 - 1) / 2 + 0.5;
|
|
324
324
|
}
|
|
325
|
-
function
|
|
325
|
+
function fs(i = 1, t = 0.3) {
|
|
326
326
|
const e = Math.max(1, i), s = t / (2 * Math.PI) * Math.asin(1 / e);
|
|
327
327
|
return (n) => n <= 0 ? 0 : n >= 1 ? 1 : e * Math.pow(2, -10 * n) * Math.sin((n - s) * (2 * Math.PI) / t) + 1;
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const ds = (i) => {
|
|
330
330
|
if (i <= 0) return 0;
|
|
331
331
|
if (i >= 1) return 1;
|
|
332
332
|
if (i < 1 / 2.75) return 7.5625 * i * i;
|
|
@@ -341,7 +341,7 @@ const hs = (i) => {
|
|
|
341
341
|
const s = i - 2.625 / 2.75;
|
|
342
342
|
return 7.5625 * s * s + 0.984375;
|
|
343
343
|
};
|
|
344
|
-
function
|
|
344
|
+
function ps(i = 1.70158) {
|
|
345
345
|
return (t) => {
|
|
346
346
|
if (t <= 0) return 0;
|
|
347
347
|
if (t >= 1) return 1;
|
|
@@ -349,7 +349,7 @@ function us(i = 1.70158) {
|
|
|
349
349
|
return e * e * ((i + 1) * e + i) + 1;
|
|
350
350
|
};
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function ms(i, t = "end") {
|
|
353
353
|
const e = Math.max(1, Math.floor(i));
|
|
354
354
|
return (s) => {
|
|
355
355
|
if (s >= 1) return 1;
|
|
@@ -367,22 +367,22 @@ function fs(i, t = "end") {
|
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function gs(i) {
|
|
371
371
|
switch (i.type) {
|
|
372
372
|
case "steps":
|
|
373
|
-
return
|
|
373
|
+
return ms(i.count, i.position);
|
|
374
374
|
case "elastic":
|
|
375
|
-
return Vt(
|
|
375
|
+
return Vt(fs(i.amplitude, i.period), i.mode);
|
|
376
376
|
case "bounce":
|
|
377
|
-
return Vt(
|
|
377
|
+
return Vt(ds, i.mode);
|
|
378
378
|
case "back":
|
|
379
|
-
return Vt(
|
|
379
|
+
return Vt(ps(i.overshoot), i.mode);
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
function
|
|
383
|
-
return i === void 0 ? ne :
|
|
382
|
+
function j(i) {
|
|
383
|
+
return i === void 0 ? ne : Zi(i) ? us(i.points) : Et(i) ? gs(i) : hs[i] ?? ne;
|
|
384
384
|
}
|
|
385
|
-
const
|
|
385
|
+
const xe = 32, ys = 256, tt = /* @__PURE__ */ new Map(), bs = /[MmLlHhVvCcSsQqTtAaZz]/, vs = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, ws = {
|
|
386
386
|
M: 2,
|
|
387
387
|
L: 2,
|
|
388
388
|
H: 1,
|
|
@@ -394,7 +394,7 @@ const Te = 32, ps = 256, tt = /* @__PURE__ */ new Map(), ms = /[MmLlHhVvCcSsQqTt
|
|
|
394
394
|
A: 7,
|
|
395
395
|
Z: 0
|
|
396
396
|
};
|
|
397
|
-
function
|
|
397
|
+
function Ts(i) {
|
|
398
398
|
const t = [];
|
|
399
399
|
let e = 0, s = null;
|
|
400
400
|
const n = () => {
|
|
@@ -402,7 +402,7 @@ function bs(i) {
|
|
|
402
402
|
};
|
|
403
403
|
for (; e < i.length && (n(), !(e >= i.length)); ) {
|
|
404
404
|
const r = i[e];
|
|
405
|
-
if (
|
|
405
|
+
if (bs.test(r)) {
|
|
406
406
|
s = { type: r, args: [] }, t.push(s), e++;
|
|
407
407
|
continue;
|
|
408
408
|
}
|
|
@@ -413,37 +413,37 @@ function bs(i) {
|
|
|
413
413
|
s.args.push(r === "1" ? 1 : 0), e++;
|
|
414
414
|
continue;
|
|
415
415
|
}
|
|
416
|
-
const c =
|
|
416
|
+
const c = vs.exec(i.slice(e));
|
|
417
417
|
if (!c) break;
|
|
418
418
|
s.args.push(parseFloat(c[0])), e += c[0].length;
|
|
419
419
|
}
|
|
420
420
|
return t;
|
|
421
421
|
}
|
|
422
|
-
function
|
|
422
|
+
function xs(i, t, e, s, n, r, o, a, c) {
|
|
423
423
|
if (i === a && t === c) return [];
|
|
424
424
|
let l = Math.abs(e), h = Math.abs(s);
|
|
425
425
|
if (l === 0 || h === 0) return [[i, t, a, c, a, c]];
|
|
426
426
|
const f = n * Math.PI / 180, u = Math.cos(f), d = Math.sin(f), m = (i - a) / 2, p = (t - c) / 2, g = u * m + d * p, y = -d * m + u * p, b = g * g / (l * l) + y * y / (h * h);
|
|
427
427
|
if (b > 1) {
|
|
428
|
-
const
|
|
429
|
-
l *=
|
|
430
|
-
}
|
|
431
|
-
const v = r === o ? -1 : 1, T = l * l * h * h - l * l * y * y - h * h * g * g, w = l * l * y * y + h * h * g * g, x = v * Math.sqrt(Math.max(0, T / w)),
|
|
432
|
-
const
|
|
433
|
-
return
|
|
434
|
-
}, E =
|
|
435
|
-
let
|
|
436
|
-
!o &&
|
|
437
|
-
const
|
|
438
|
-
const
|
|
439
|
-
return [u *
|
|
440
|
-
},
|
|
441
|
-
const
|
|
442
|
-
return [u *
|
|
428
|
+
const R = Math.sqrt(b);
|
|
429
|
+
l *= R, h *= R;
|
|
430
|
+
}
|
|
431
|
+
const v = r === o ? -1 : 1, T = l * l * h * h - l * l * y * y - h * h * g * g, w = l * l * y * y + h * h * g * g, x = v * Math.sqrt(Math.max(0, T / w)), M = x * l * y / h, C = -x * h * g / l, D = u * M - d * C + (i + a) / 2, A = d * M + u * C + (t + c) / 2, k = (R, O, B, J) => {
|
|
432
|
+
const Yt = R * B + O * J, Tt = Math.sqrt((R * R + O * O) * (B * B + J * J)), at = Math.acos(Math.max(-1, Math.min(1, Yt / Tt)));
|
|
433
|
+
return R * J - O * B < 0 ? -at : at;
|
|
434
|
+
}, E = k(1, 0, (g - M) / l, (y - C) / h);
|
|
435
|
+
let P = k((g - M) / l, (y - C) / h, (-g - M) / l, (-y - C) / h);
|
|
436
|
+
!o && P > 0 && (P -= 2 * Math.PI), o && P < 0 && (P += 2 * Math.PI);
|
|
437
|
+
const S = Math.max(1, Math.ceil(Math.abs(P) / (Math.PI / 2))), _ = P / S, $ = 4 / 3 * Math.tan(_ / 4), I = (R) => {
|
|
438
|
+
const O = l * Math.cos(R), B = h * Math.sin(R);
|
|
439
|
+
return [u * O - d * B + D, d * O + u * B + A];
|
|
440
|
+
}, F = (R) => {
|
|
441
|
+
const O = -l * Math.sin(R), B = h * Math.cos(R);
|
|
442
|
+
return [u * O - d * B, d * O + u * B];
|
|
443
443
|
}, H = [];
|
|
444
|
-
for (let
|
|
445
|
-
const
|
|
446
|
-
H.push([J + $ *
|
|
444
|
+
for (let R = 0; R < S; R++) {
|
|
445
|
+
const O = E + R * _, B = O + _, [J, Yt] = I(O), [Tt, at] = R === S - 1 ? [a, c] : I(B), [zi, Hi] = F(O), [Gi, Ki] = F(B);
|
|
446
|
+
H.push([J + $ * zi, Yt + $ * Hi, Tt - $ * Gi, at - $ * Ki, Tt, at]);
|
|
447
447
|
}
|
|
448
448
|
return H;
|
|
449
449
|
}
|
|
@@ -451,7 +451,7 @@ function z(i, t, e, s, n) {
|
|
|
451
451
|
const r = 1 - n;
|
|
452
452
|
return r * r * r * i + 3 * r * r * n * t + 3 * r * n * n * e + n * n * n * s;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function ke(i, t, e, s, n) {
|
|
455
455
|
const r = 1 - n;
|
|
456
456
|
return 3 * r * r * (t - i) + 6 * r * n * (e - t) + 3 * n * n * (s - e);
|
|
457
457
|
}
|
|
@@ -467,11 +467,11 @@ function ct(i, t, e, s) {
|
|
|
467
467
|
length: Math.hypot(e - i, s - t)
|
|
468
468
|
};
|
|
469
469
|
}
|
|
470
|
-
function
|
|
470
|
+
function kt(i, t, e) {
|
|
471
471
|
const [s, n, r, o, a, c] = e, l = [0];
|
|
472
472
|
let h = i, f = t, u = 0;
|
|
473
|
-
for (let d = 1; d <=
|
|
474
|
-
const m = d /
|
|
473
|
+
for (let d = 1; d <= xe; d++) {
|
|
474
|
+
const m = d / xe, p = z(i, s, r, a, m), g = z(t, n, o, c, m);
|
|
475
475
|
u += Math.hypot(p - h, g - f), l.push(u), h = p, f = g;
|
|
476
476
|
}
|
|
477
477
|
return {
|
|
@@ -494,65 +494,65 @@ function nt(i) {
|
|
|
494
494
|
const h = /* @__PURE__ */ new Set(), f = (p) => {
|
|
495
495
|
l < 0 && (l = 0), p.subpath = l, e.push(p);
|
|
496
496
|
};
|
|
497
|
-
for (const { type: p, args: g } of
|
|
498
|
-
const y = p.toUpperCase(), b = p !== y, v =
|
|
497
|
+
for (const { type: p, args: g } of Ts(i)) {
|
|
498
|
+
const y = p.toUpperCase(), b = p !== y, v = ws[y];
|
|
499
499
|
if (y === "Z") {
|
|
500
500
|
(s !== r || n !== o) && f(ct(s, n, r, o)), l >= 0 && h.add(l), s = r, n = o, a = c = null;
|
|
501
501
|
continue;
|
|
502
502
|
}
|
|
503
503
|
for (let T = 0; T + v <= g.length; T += v) {
|
|
504
|
-
const w = g.slice(T, T + v), x = b ? s : 0,
|
|
505
|
-
let
|
|
504
|
+
const w = g.slice(T, T + v), x = b ? s : 0, M = b ? n : 0;
|
|
505
|
+
let C = null, D = null;
|
|
506
506
|
switch (y) {
|
|
507
507
|
case "M":
|
|
508
|
-
T === 0 ? (s = w[0] + x, n = w[1] +
|
|
508
|
+
T === 0 ? (s = w[0] + x, n = w[1] + M, r = s, o = n, (l < 0 || e[e.length - 1]?.subpath === l) && l++) : (f(ct(s, n, w[0] + x, w[1] + M)), s = w[0] + x, n = w[1] + M);
|
|
509
509
|
break;
|
|
510
510
|
case "L":
|
|
511
|
-
f(ct(s, n, w[0] + x, w[1] +
|
|
511
|
+
f(ct(s, n, w[0] + x, w[1] + M)), s = w[0] + x, n = w[1] + M;
|
|
512
512
|
break;
|
|
513
513
|
case "H":
|
|
514
514
|
f(ct(s, n, w[0] + x, n)), s = w[0] + x;
|
|
515
515
|
break;
|
|
516
516
|
case "V":
|
|
517
|
-
f(ct(s, n, s, w[0] +
|
|
517
|
+
f(ct(s, n, s, w[0] + M)), n = w[0] + M;
|
|
518
518
|
break;
|
|
519
519
|
case "C": {
|
|
520
|
-
const A = [w[0] + x, w[1] +
|
|
521
|
-
f(
|
|
520
|
+
const A = [w[0] + x, w[1] + M, w[2] + x, w[3] + M, w[4] + x, w[5] + M];
|
|
521
|
+
f(kt(s, n, A)), C = [A[2], A[3]], s = A[4], n = A[5];
|
|
522
522
|
break;
|
|
523
523
|
}
|
|
524
524
|
case "S": {
|
|
525
|
-
const [A,
|
|
526
|
-
f(
|
|
525
|
+
const [A, k] = a ? [2 * s - a[0], 2 * n - a[1]] : [s, n], E = [A, k, w[0] + x, w[1] + M, w[2] + x, w[3] + M];
|
|
526
|
+
f(kt(s, n, E)), C = [E[2], E[3]], s = E[4], n = E[5];
|
|
527
527
|
break;
|
|
528
528
|
}
|
|
529
529
|
case "Q":
|
|
530
530
|
case "T": {
|
|
531
|
-
let A = s,
|
|
532
|
-
y === "Q" ? (A = w[0] + x,
|
|
533
|
-
const E = y === "Q" ? w[2] + x : w[0] + x,
|
|
531
|
+
let A = s, k = n;
|
|
532
|
+
y === "Q" ? (A = w[0] + x, k = w[1] + M) : c && (A = 2 * s - c[0], k = 2 * n - c[1]);
|
|
533
|
+
const E = y === "Q" ? w[2] + x : w[0] + x, P = y === "Q" ? w[3] + M : w[1] + M;
|
|
534
534
|
f(
|
|
535
|
-
|
|
535
|
+
kt(s, n, [
|
|
536
536
|
s + 2 / 3 * (A - s),
|
|
537
|
-
n + 2 / 3 * (
|
|
537
|
+
n + 2 / 3 * (k - n),
|
|
538
538
|
E + 2 / 3 * (A - E),
|
|
539
|
-
|
|
539
|
+
P + 2 / 3 * (k - P),
|
|
540
540
|
E,
|
|
541
|
-
|
|
541
|
+
P
|
|
542
542
|
])
|
|
543
|
-
),
|
|
543
|
+
), D = [A, k], s = E, n = P;
|
|
544
544
|
break;
|
|
545
545
|
}
|
|
546
546
|
case "A": {
|
|
547
|
-
const A = w[5] + x,
|
|
548
|
-
let E = s,
|
|
549
|
-
for (const
|
|
550
|
-
f(
|
|
551
|
-
s = A, n =
|
|
547
|
+
const A = w[5] + x, k = w[6] + M;
|
|
548
|
+
let E = s, P = n;
|
|
549
|
+
for (const S of xs(s, n, w[0], w[1], w[2], w[3], w[4], A, k))
|
|
550
|
+
f(kt(E, P, S)), E = S[4], P = S[5];
|
|
551
|
+
s = A, n = k;
|
|
552
552
|
break;
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
a =
|
|
555
|
+
a = C, c = D;
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
558
|
const u = e.reduce((p, g) => p + g.length, 0), d = [];
|
|
@@ -564,9 +564,9 @@ function nt(i) {
|
|
|
564
564
|
d.push({ start: p, end: y, length: b, closed: w }), p = y;
|
|
565
565
|
}
|
|
566
566
|
const m = { segments: e, totalLength: u, subpaths: d };
|
|
567
|
-
return tt.size >=
|
|
567
|
+
return tt.size >= ys && tt.delete(tt.keys().next().value), tt.set(i, m), m;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function ks(i, t) {
|
|
570
570
|
const e = i.lengths;
|
|
571
571
|
if (t <= 0) return 0;
|
|
572
572
|
if (t >= i.length) return 1;
|
|
@@ -578,7 +578,7 @@ function ws(i, t) {
|
|
|
578
578
|
const r = e[n] - e[s], o = r > 0 ? (t - e[s]) / r : 0;
|
|
579
579
|
return (s + o) / (e.length - 1);
|
|
580
580
|
}
|
|
581
|
-
function
|
|
581
|
+
function Ss(i, t) {
|
|
582
582
|
if (i.type === "L") {
|
|
583
583
|
const f = i.length > 0 ? Math.max(0, Math.min(1, t / i.length)) : 0;
|
|
584
584
|
return {
|
|
@@ -587,8 +587,8 @@ function Ts(i, t) {
|
|
|
587
587
|
angle: Math.atan2(i.endY - i.startY, i.endX - i.startX) * 180 / Math.PI
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
|
-
const [e, s, n, r, o, a] = i.points, c =
|
|
591
|
-
let l =
|
|
590
|
+
const [e, s, n, r, o, a] = i.points, c = ks(i, t);
|
|
591
|
+
let l = ke(i.startX, e, n, o, c), h = ke(i.startY, s, r, a, c);
|
|
592
592
|
if (Math.hypot(l, h) < 1e-9) {
|
|
593
593
|
const f = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), u = z(i.startX, e, n, o, f), d = z(i.startY, s, r, a, f), m = z(i.startX, e, n, o, c), p = z(i.startY, s, r, a, c);
|
|
594
594
|
l = c < 0.5 ? u - m : m - u, h = c < 0.5 ? d - p : p - d;
|
|
@@ -599,31 +599,31 @@ function Ts(i, t) {
|
|
|
599
599
|
angle: Math.atan2(h, l) * 180 / Math.PI
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
|
-
function
|
|
602
|
+
function mi(i, t, e = 0, s = i.length) {
|
|
603
603
|
if (s <= e) return { x: 0, y: 0, angle: 0 };
|
|
604
604
|
let n = 0;
|
|
605
605
|
for (let r = e; r < s; r++) {
|
|
606
606
|
const o = i[r];
|
|
607
607
|
if (n + o.length >= t || r === s - 1)
|
|
608
|
-
return
|
|
608
|
+
return Ss(o, t - n);
|
|
609
609
|
n += o.length;
|
|
610
610
|
}
|
|
611
611
|
return { x: 0, y: 0, angle: 0 };
|
|
612
612
|
}
|
|
613
|
-
function
|
|
613
|
+
function Ms(i, t) {
|
|
614
614
|
const { segments: e, totalLength: s } = nt(i);
|
|
615
|
-
return
|
|
615
|
+
return mi(e, Math.max(0, Math.min(1, t)) * s);
|
|
616
616
|
}
|
|
617
|
-
function
|
|
617
|
+
function So() {
|
|
618
618
|
tt.clear();
|
|
619
619
|
}
|
|
620
|
-
function
|
|
620
|
+
function Mo(i) {
|
|
621
621
|
return nt(i).totalLength;
|
|
622
622
|
}
|
|
623
|
-
const
|
|
623
|
+
const As = 24, Ps = 320, Es = 2.5, lt = 72, Ao = 64, Cs = 0.2, _s = 128, pt = /* @__PURE__ */ new Map();
|
|
624
624
|
let At = 0, U;
|
|
625
|
-
const
|
|
626
|
-
function
|
|
625
|
+
const Se = (i) => Math.round(i * 100) / 100;
|
|
626
|
+
function Me(i, t) {
|
|
627
627
|
const { segments: e, subpaths: s, totalLength: n } = nt(i);
|
|
628
628
|
if (e.length === 0) return [];
|
|
629
629
|
if (t) {
|
|
@@ -633,33 +633,33 @@ function Se(i, t) {
|
|
|
633
633
|
return s.filter((r) => r.length > 0).map((r) => ({ segments: e, start: r.start, end: r.end, length: r.length, closed: r.closed }));
|
|
634
634
|
}
|
|
635
635
|
function re(i, t) {
|
|
636
|
-
const e = i.closed ? (t % 1 + 1) % 1 : Math.max(0, Math.min(1, t)), s =
|
|
636
|
+
const e = i.closed ? (t % 1 + 1) % 1 : Math.max(0, Math.min(1, t)), s = mi(i.segments, e * i.length, i.start, i.end);
|
|
637
637
|
return [s.x, s.y];
|
|
638
638
|
}
|
|
639
|
-
function
|
|
639
|
+
function Ae(i) {
|
|
640
640
|
const t = [];
|
|
641
641
|
let e = 0;
|
|
642
642
|
for (let s = i.start; s < i.end; s++)
|
|
643
643
|
e += i.segments[s].length, i.length > 0 && t.push(e / i.length);
|
|
644
644
|
return t;
|
|
645
645
|
}
|
|
646
|
-
function
|
|
646
|
+
function Pe(i, t) {
|
|
647
647
|
const e = [];
|
|
648
648
|
for (let s = 0; s < t; s++)
|
|
649
649
|
e.push(re(i, i.closed ? s / t : s / (t - 1)));
|
|
650
650
|
return e;
|
|
651
651
|
}
|
|
652
|
-
function
|
|
652
|
+
function Ee(i) {
|
|
653
653
|
let t = 0, e = 0;
|
|
654
654
|
for (const [s, n] of i)
|
|
655
655
|
t += s, e += n;
|
|
656
656
|
return t /= i.length, e /= i.length, i.map(([s, n]) => [s - t, n - e]);
|
|
657
657
|
}
|
|
658
|
-
function
|
|
658
|
+
function Rs(i, t, e) {
|
|
659
659
|
const s = i.closed && t.closed;
|
|
660
660
|
if (e !== void 0)
|
|
661
661
|
return { offset: s ? Math.abs(e) % lt / lt : 0, reversed: e < 0 };
|
|
662
|
-
const n = Pe(
|
|
662
|
+
const n = Ee(Pe(i, lt)), r = Ee(Pe(t, lt)), o = lt;
|
|
663
663
|
let a = { offset: 0, reversed: !1 }, c = 1 / 0;
|
|
664
664
|
for (const l of [!1, !0]) {
|
|
665
665
|
const h = s ? o : 1;
|
|
@@ -674,28 +674,28 @@ function Es(i, t, e) {
|
|
|
674
674
|
}
|
|
675
675
|
return a;
|
|
676
676
|
}
|
|
677
|
-
function
|
|
677
|
+
function Is(i, t, e) {
|
|
678
678
|
return e ? ((t.reversed ? t.offset - i : i + t.offset) % 1 + 1) % 1 : t.reversed ? 1 - i : i;
|
|
679
679
|
}
|
|
680
|
-
function
|
|
680
|
+
function $s(i, t, e) {
|
|
681
681
|
return e ? ((t.reversed ? t.offset - i : i - t.offset) % 1 + 1) % 1 : t.reversed ? 1 - i : i;
|
|
682
682
|
}
|
|
683
|
-
function
|
|
684
|
-
const s = i.closed && t.closed, n =
|
|
685
|
-
|
|
686
|
-
Math.min(
|
|
683
|
+
function Ls(i, t, e) {
|
|
684
|
+
const s = i.closed && t.closed, n = Rs(i, t, e.shapeIndex), r = Math.max(
|
|
685
|
+
As,
|
|
686
|
+
Math.min(Ps, Math.ceil(Math.max(i.length, t.length) / Es))
|
|
687
687
|
), o = /* @__PURE__ */ new Set(), a = (f) => o.add(Math.round(f * 1e7) / 1e7);
|
|
688
688
|
for (let f = 0; f <= r; f++) a(f / r);
|
|
689
|
-
for (const f of
|
|
690
|
-
for (const f of
|
|
689
|
+
for (const f of Ae(i)) a(f);
|
|
690
|
+
for (const f of Ae(t)) a($s(f, n, s));
|
|
691
691
|
let c = [...o].sort((f, u) => f - u);
|
|
692
692
|
s && (c = c.filter((f) => f < 1));
|
|
693
693
|
const l = [], h = [];
|
|
694
694
|
for (const f of c)
|
|
695
|
-
l.push(...re(i, f)), h.push(...re(t,
|
|
696
|
-
return
|
|
695
|
+
l.push(...re(i, f)), h.push(...re(t, Is(f, n, s)));
|
|
696
|
+
return Fs({ from: l, to: h, closed: s });
|
|
697
697
|
}
|
|
698
|
-
function
|
|
698
|
+
function Fs(i) {
|
|
699
699
|
const t = i.from.length / 2;
|
|
700
700
|
if (t <= 3) return i;
|
|
701
701
|
const e = new Uint8Array(t);
|
|
@@ -703,9 +703,9 @@ function Is(i) {
|
|
|
703
703
|
const s = [[0, t - 1]];
|
|
704
704
|
for (; s.length > 0; ) {
|
|
705
705
|
const [o, a] = s.pop();
|
|
706
|
-
let c = -1, l =
|
|
706
|
+
let c = -1, l = Cs;
|
|
707
707
|
for (let h = o + 1; h < a; h++) {
|
|
708
|
-
const f = Math.max(
|
|
708
|
+
const f = Math.max(Ce(i.from, o, a, h), Ce(i.to, o, a, h));
|
|
709
709
|
f > l && (l = f, c = h);
|
|
710
710
|
}
|
|
711
711
|
c !== -1 && (e[c] = 1, s.push([o, c], [c, a]));
|
|
@@ -715,50 +715,50 @@ function Is(i) {
|
|
|
715
715
|
e[o] && (n.push(i.from[o * 2], i.from[o * 2 + 1]), r.push(i.to[o * 2], i.to[o * 2 + 1]));
|
|
716
716
|
return { from: n, to: r, closed: i.closed };
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Ce(i, t, e, s) {
|
|
719
719
|
const n = i[t * 2], r = i[t * 2 + 1], o = i[e * 2] - n, a = i[e * 2 + 1] - r, c = i[s * 2] - n, l = i[s * 2 + 1] - r, h = o * o + a * a, f = h === 0 ? 0 : Math.max(0, Math.min(1, (c * o + l * a) / h));
|
|
720
720
|
return Math.hypot(c - f * o, l - f * a);
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function Ds(i, t, e) {
|
|
723
723
|
const s = e.shapeIndex;
|
|
724
724
|
if (U && U.from === i && U.to === t && U.shapeIndex === s) return U.plan;
|
|
725
725
|
const r = pt.get(String(s ?? "auto"))?.get(i)?.get(t);
|
|
726
726
|
if (r)
|
|
727
727
|
return U = { from: i, to: t, shapeIndex: s, plan: r }, r;
|
|
728
|
-
const o = nt(i).subpaths.filter((d) => d.length > 0).length === nt(t).subpaths.filter((d) => d.length > 0).length, a =
|
|
729
|
-
pairs: a.map((d, m) =>
|
|
728
|
+
const o = nt(i).subpaths.filter((d) => d.length > 0).length === nt(t).subpaths.filter((d) => d.length > 0).length, a = Me(i, !o), c = Me(t, !o), l = {
|
|
729
|
+
pairs: a.map((d, m) => Ls(d, c[m], e))
|
|
730
730
|
};
|
|
731
|
-
At >=
|
|
731
|
+
At >= _s && (pt.clear(), At = 0);
|
|
732
732
|
const h = String(s ?? "auto"), f = pt.get(h) ?? /* @__PURE__ */ new Map();
|
|
733
733
|
pt.set(h, f);
|
|
734
734
|
const u = f.get(i) ?? /* @__PURE__ */ new Map();
|
|
735
735
|
return f.set(i, u), u.set(t, l), At++, U = { from: i, to: t, shapeIndex: s, plan: l }, l;
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function Os(i, t, e, s = {}) {
|
|
738
738
|
if (!i) return t;
|
|
739
739
|
if (!t) return i;
|
|
740
740
|
const n = Math.max(0, Math.min(1, e));
|
|
741
741
|
if (n === 0) return i;
|
|
742
742
|
if (n === 1) return t;
|
|
743
|
-
const r =
|
|
743
|
+
const r = Ds(i, t, s);
|
|
744
744
|
if (r.pairs.length === 0) return n < 0.5 ? i : t;
|
|
745
745
|
let o = "";
|
|
746
746
|
for (const a of r.pairs) {
|
|
747
747
|
for (let c = 0; c < a.from.length; c += 2) {
|
|
748
|
-
const l =
|
|
748
|
+
const l = Se(a.from[c] + (a.to[c] - a.from[c]) * n), h = Se(a.from[c + 1] + (a.to[c + 1] - a.from[c + 1]) * n);
|
|
749
749
|
o += `${c === 0 ? o ? " M" : "M" : " L"}${l} ${h}`;
|
|
750
750
|
}
|
|
751
751
|
a.closed && (o += " Z");
|
|
752
752
|
}
|
|
753
753
|
return o;
|
|
754
754
|
}
|
|
755
|
-
function
|
|
755
|
+
function Po() {
|
|
756
756
|
pt.clear(), At = 0, U = void 0;
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function wt(i) {
|
|
759
759
|
return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(i);
|
|
760
760
|
}
|
|
761
|
-
const
|
|
761
|
+
const V = (i, t, e) => i + (t - i) * e, gi = 512, Wt = /* @__PURE__ */ new Map(), jt = /* @__PURE__ */ new Map();
|
|
762
762
|
function _e(i) {
|
|
763
763
|
const t = Wt.get(i);
|
|
764
764
|
if (t) return t;
|
|
@@ -767,66 +767,66 @@ function _e(i) {
|
|
|
767
767
|
parseInt(e.slice(2, 4), 16),
|
|
768
768
|
parseInt(e.slice(4, 6), 16)
|
|
769
769
|
];
|
|
770
|
-
return Wt.size <
|
|
770
|
+
return Wt.size < gi && Wt.set(i, s), s;
|
|
771
771
|
}
|
|
772
|
-
const
|
|
773
|
-
function
|
|
772
|
+
const Re = (i) => i.charCodeAt(0) === 35, Ie = (i) => i.startsWith("rgb"), $e = (i) => i.startsWith("rgba"), Bs = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, Ut = (i) => Math.round(i).toString(16).padStart(2, "0");
|
|
773
|
+
function Ns(i, t, e) {
|
|
774
774
|
return `#${Ut(i)}${Ut(t)}${Ut(e)}`;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function Le(i) {
|
|
777
777
|
const t = jt.get(i);
|
|
778
778
|
if (t) return t;
|
|
779
|
-
const e = i.match(
|
|
779
|
+
const e = i.match(Bs);
|
|
780
780
|
if (!e)
|
|
781
781
|
throw new Error(`Invalid rgb color: ${i}`);
|
|
782
782
|
const s = parseInt(e[1], 10), n = parseInt(e[2], 10), r = parseInt(e[3], 10), o = e[4] !== void 0 ? [s, n, r, parseFloat(e[4])] : [s, n, r];
|
|
783
|
-
return jt.size <
|
|
783
|
+
return jt.size < gi && jt.set(i, o), o;
|
|
784
784
|
}
|
|
785
|
-
const
|
|
786
|
-
if (
|
|
787
|
-
const [s, n, r] = _e(i), [o, a, c] = _e(t), l =
|
|
788
|
-
return
|
|
785
|
+
const qs = (i, t, e) => {
|
|
786
|
+
if (Re(i) && Re(t)) {
|
|
787
|
+
const [s, n, r] = _e(i), [o, a, c] = _e(t), l = V(s, o, e), h = V(n, a, e), f = V(r, c, e);
|
|
788
|
+
return Ns(l, h, f);
|
|
789
789
|
}
|
|
790
|
-
if ((
|
|
791
|
-
const s =
|
|
790
|
+
if ((Ie(i) || $e(i)) && (Ie(t) || $e(t))) {
|
|
791
|
+
const s = Le(i), n = Le(t), r = Math.round(V(s[0], n[0], e)), o = Math.round(V(s[1], n[1], e)), a = Math.round(V(s[2], n[2], e));
|
|
792
792
|
if (s.length === 4 || n.length === 4) {
|
|
793
|
-
const c = s[3] ?? 1, l = n[3] ?? 1, h =
|
|
793
|
+
const c = s[3] ?? 1, l = n[3] ?? 1, h = V(c, l, e);
|
|
794
794
|
return `rgba(${r}, ${o}, ${a}, ${h})`;
|
|
795
795
|
}
|
|
796
796
|
return `rgb(${r}, ${o}, ${a})`;
|
|
797
797
|
}
|
|
798
798
|
return e < 1 ? i : t;
|
|
799
|
-
},
|
|
799
|
+
}, Ys = (i, t, e) => {
|
|
800
800
|
const s = Math.min(i.length, t.length), n = [];
|
|
801
801
|
for (let r = 0; r < s; r++)
|
|
802
|
-
n.push(
|
|
802
|
+
n.push(V(i[r], t[r], e));
|
|
803
803
|
return n;
|
|
804
|
-
}, Fe = (i, t, e) => e < 1 ? i : t,
|
|
804
|
+
}, Fe = (i, t, e) => e < 1 ? i : t, Xs = (i, t, e) => Os(i, t, e);
|
|
805
805
|
function Rt(i) {
|
|
806
|
-
return typeof i == "number" ?
|
|
806
|
+
return typeof i == "number" ? V : Array.isArray(i) ? Ys : typeof i == "string" ? i.startsWith("#") || i.startsWith("rgb") ? qs : wt(i) ? Xs : Fe : Fe;
|
|
807
807
|
}
|
|
808
|
-
const
|
|
809
|
-
function
|
|
808
|
+
const yi = 1e3 / 60;
|
|
809
|
+
function bi(i, t = {}) {
|
|
810
810
|
if (!Q(i))
|
|
811
811
|
throw new Error(`bakeSpringTrack: track "${i.id}" is not a spring track`);
|
|
812
812
|
const e = new Ot(i.spring);
|
|
813
|
-
return
|
|
813
|
+
return wi(i, (s) => e.valueAt(s), e.settleTime(), i.spring.from, i.spring.to, t);
|
|
814
814
|
}
|
|
815
|
-
function
|
|
815
|
+
function vi(i, t = {}) {
|
|
816
816
|
if (!Z(i))
|
|
817
817
|
throw new Error(`bakeInertiaTrack: track "${i.id}" is not an inertia track`);
|
|
818
818
|
const e = i.inertia;
|
|
819
|
-
return
|
|
819
|
+
return wi(
|
|
820
820
|
i,
|
|
821
821
|
(s) => se(e, s),
|
|
822
|
-
|
|
822
|
+
vt(e),
|
|
823
823
|
e.from,
|
|
824
|
-
|
|
824
|
+
bt(e),
|
|
825
825
|
t
|
|
826
826
|
);
|
|
827
827
|
}
|
|
828
|
-
function
|
|
829
|
-
const o = r.intervalMs ??
|
|
828
|
+
function wi(i, t, e, s, n, r) {
|
|
829
|
+
const o = r.intervalMs ?? yi, a = r.tolerance ?? 0.01, c = i.delay ?? 0, l = [];
|
|
830
830
|
for (let f = 0; f <= e; f += o)
|
|
831
831
|
l.push({ time: f + c, value: t(f), easing: "linear" });
|
|
832
832
|
const h = l[l.length - 1];
|
|
@@ -834,13 +834,13 @@ function bi(i, t, e, s, n, r) {
|
|
|
834
834
|
id: i.id,
|
|
835
835
|
target: i.target,
|
|
836
836
|
property: i.property,
|
|
837
|
-
keyframes: a > 0 ?
|
|
837
|
+
keyframes: a > 0 ? Ws(l, a) : l,
|
|
838
838
|
...i.targets && { targets: [...i.targets] },
|
|
839
839
|
...i.stagger && { stagger: { ...i.stagger } }
|
|
840
840
|
};
|
|
841
841
|
}
|
|
842
|
-
function
|
|
843
|
-
const n = s.intervalMs ??
|
|
842
|
+
function Ti(i, t, e, s = {}) {
|
|
843
|
+
const n = s.intervalMs ?? yi, r = typeof e == "function" ? e : j(e), o = Rt(i.value), a = t.time - i.time;
|
|
844
844
|
if (a <= 0) return [t];
|
|
845
845
|
const c = [];
|
|
846
846
|
for (let h = n; h < a; h += n) {
|
|
@@ -854,26 +854,26 @@ function vi(i, t, e, s = {}) {
|
|
|
854
854
|
const l = r(1);
|
|
855
855
|
return c.push({ ...t, ...l !== 1 && { value: o(i.value, t.value, l) }, easing: "linear" }), c;
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
return Q(i) ?
|
|
857
|
+
function Eo(i, t) {
|
|
858
|
+
return Q(i) ? bi(i, t) : Z(i) ? vi(i, t) : i;
|
|
859
859
|
}
|
|
860
|
-
function
|
|
860
|
+
function Vs(i, t = {}) {
|
|
861
861
|
const e = i.keyframes;
|
|
862
862
|
if (!e.some((n) => Et(n.easing))) return i;
|
|
863
863
|
const s = e.length > 0 ? [e[0]] : [];
|
|
864
864
|
for (let n = 1; n < e.length; n++) {
|
|
865
865
|
const r = e[n];
|
|
866
|
-
Et(r.easing) ? s.push(...
|
|
866
|
+
Et(r.easing) ? s.push(...Ti(e[n - 1], r, r.easing, t)) : s.push(r);
|
|
867
867
|
}
|
|
868
868
|
return { ...i, keyframes: s };
|
|
869
869
|
}
|
|
870
|
-
function
|
|
871
|
-
return i.filter(
|
|
872
|
-
i.filter(Q).map((e) =>
|
|
873
|
-
i.filter(Z).map((e) =>
|
|
870
|
+
function Co(i, t) {
|
|
871
|
+
return i.filter(Qi).map((e) => Vs(e, t)).concat(
|
|
872
|
+
i.filter(Q).map((e) => bi(e, t)),
|
|
873
|
+
i.filter(Z).map((e) => vi(e, t))
|
|
874
874
|
);
|
|
875
875
|
}
|
|
876
|
-
function
|
|
876
|
+
function Ws(i, t) {
|
|
877
877
|
if (i.length <= 2) return i;
|
|
878
878
|
const e = [i[0]];
|
|
879
879
|
for (let s = 1; s < i.length - 1; s++) {
|
|
@@ -896,7 +896,7 @@ function G(i) {
|
|
|
896
896
|
}
|
|
897
897
|
function rt(i, t, e, s) {
|
|
898
898
|
const n = e ?? 0;
|
|
899
|
-
return !s || t <= 1 ? n : n +
|
|
899
|
+
return !s || t <= 1 ? n : n + pe(i, t, s);
|
|
900
900
|
}
|
|
901
901
|
class zt {
|
|
902
902
|
track;
|
|
@@ -958,7 +958,7 @@ class zt {
|
|
|
958
958
|
return;
|
|
959
959
|
if (s.time === t)
|
|
960
960
|
return s.value;
|
|
961
|
-
const r = n.time - s.time, o = (t - s.time) / r, c =
|
|
961
|
+
const r = n.time - s.time, o = (t - s.time) / r, c = j(n.easing)(o);
|
|
962
962
|
return Rt(s.value)(s.value, n.value, c);
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
@@ -972,7 +972,7 @@ class zt {
|
|
|
972
972
|
return { from: null, to: null };
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
class
|
|
975
|
+
class js {
|
|
976
976
|
track;
|
|
977
977
|
targets;
|
|
978
978
|
sampler;
|
|
@@ -999,12 +999,12 @@ class Ys {
|
|
|
999
999
|
return this.track;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
class
|
|
1002
|
+
class Us {
|
|
1003
1003
|
track;
|
|
1004
1004
|
targets;
|
|
1005
1005
|
duration;
|
|
1006
1006
|
constructor(t) {
|
|
1007
|
-
this.track = t, this.targets = G(t), this.duration =
|
|
1007
|
+
this.track = t, this.targets = G(t), this.duration = vt(t.inertia);
|
|
1008
1008
|
}
|
|
1009
1009
|
getValueAtTime(t) {
|
|
1010
1010
|
return se(this.track.inertia, t - rt(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
@@ -1026,8 +1026,8 @@ class Vs {
|
|
|
1026
1026
|
return this.track;
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
|
-
function
|
|
1030
|
-
const e = { ...
|
|
1029
|
+
function xi(i, t) {
|
|
1030
|
+
const e = { ...Ms(i.pathData, t) };
|
|
1031
1031
|
if (i.matrix) {
|
|
1032
1032
|
const [s, n, r, o, a, c] = i.matrix, { x: l, y: h } = e;
|
|
1033
1033
|
e.x = s * l + r * h + a, e.y = n * l + o * h + c;
|
|
@@ -1036,25 +1036,25 @@ function wi(i, t) {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
return i.autoRotate && i.rotateOffset && (e.angle += i.rotateOffset), e;
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function _o(i, t, e, s) {
|
|
1040
1040
|
const n = t + (e - t) * s;
|
|
1041
|
-
return
|
|
1041
|
+
return xi(i, n);
|
|
1042
1042
|
}
|
|
1043
1043
|
const Ht = {
|
|
1044
1044
|
upperCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
|
1045
1045
|
lowerCase: "abcdefghijklmnopqrstuvwxyz",
|
|
1046
1046
|
upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
1047
1047
|
numbers: "0123456789"
|
|
1048
|
-
},
|
|
1049
|
-
function
|
|
1048
|
+
}, zs = 20;
|
|
1049
|
+
function Hs(i) {
|
|
1050
1050
|
const t = Ht[i ?? "upperCase"] ?? i ?? Ht.upperCase, e = Array.from(t);
|
|
1051
1051
|
return e.length > 0 ? e : Array.from(Ht.upperCase);
|
|
1052
1052
|
}
|
|
1053
|
-
function
|
|
1053
|
+
function Gs(i, t, e) {
|
|
1054
1054
|
let s = (i | 0) ^ Math.imul(t + 1, 2654435761) ^ Math.imul(e + 1, 2246822507);
|
|
1055
1055
|
return s = Math.imul(s ^ s >>> 16, 2146121005), s = Math.imul(s ^ s >>> 15, 2221713035), (s ^ s >>> 16) >>> 0;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function Ks(i, t, e = 0) {
|
|
1058
1058
|
const s = i.from ?? "", n = i.to, r = Math.max(0, Math.min(1, t));
|
|
1059
1059
|
if (r <= 0) return s;
|
|
1060
1060
|
if (r >= 1) return n;
|
|
@@ -1063,16 +1063,16 @@ function zs(i, t, e = 0) {
|
|
|
1063
1063
|
const b = Math.round(r * Math.max(o.length, a.length));
|
|
1064
1064
|
return c ? o.slice(0, Math.max(0, o.length - b)).join("") + a.slice(Math.max(0, a.length - b)).join("") : a.slice(0, b).join("") + o.slice(b).join("");
|
|
1065
1065
|
}
|
|
1066
|
-
const l = Math.max(0, Math.min(0.999, i.revealDelay ?? 0)), h = Math.max(0, (r - l) / (1 - l)), f = Math.floor(h * a.length), u = i.tweenLength === !1 ? a.length : Math.round(o.length + (a.length - o.length) * r), d =
|
|
1066
|
+
const l = Math.max(0, Math.min(0.999, i.revealDelay ?? 0)), h = Math.max(0, (r - l) / (1 - l)), f = Math.floor(h * a.length), u = i.tweenLength === !1 ? a.length : Math.round(o.length + (a.length - o.length) * r), d = Hs(i.chars), m = i.refreshRate ?? zs, p = m > 0 ? Math.floor(e * m / 1e3) : 0, g = i.seed ?? 1;
|
|
1067
1067
|
let y = "";
|
|
1068
1068
|
for (let b = 0; b < u; b++) {
|
|
1069
1069
|
const v = c ? b >= u - f : b < f, T = c ? a[a.length - (u - b)] : a[b];
|
|
1070
1070
|
v && T !== void 0 || T === " " || T === `
|
|
1071
|
-
` ? y += T : y += d[
|
|
1071
|
+
` ? y += T : y += d[Gs(g, b, p) % d.length];
|
|
1072
1072
|
}
|
|
1073
1073
|
return y;
|
|
1074
1074
|
}
|
|
1075
|
-
class
|
|
1075
|
+
class ki {
|
|
1076
1076
|
id;
|
|
1077
1077
|
name;
|
|
1078
1078
|
_captions;
|
|
@@ -1271,12 +1271,12 @@ class Ti {
|
|
|
1271
1271
|
a || (a = /* @__PURE__ */ new Map(), t.set(s, a));
|
|
1272
1272
|
const c = this._textTracks.get(e);
|
|
1273
1273
|
if (c && typeof r == "number") {
|
|
1274
|
-
a.set("text",
|
|
1274
|
+
a.set("text", Ks(c.textConfig, r, Math.max(0, o)));
|
|
1275
1275
|
return;
|
|
1276
1276
|
}
|
|
1277
1277
|
const l = this._motionPathTracks.get(e);
|
|
1278
1278
|
if (l && typeof r == "number") {
|
|
1279
|
-
const h =
|
|
1279
|
+
const h = xi(l.motionPathConfig, r);
|
|
1280
1280
|
a.set("motionPathX", h.x), a.set("motionPathY", h.y), l.motionPathConfig.autoRotate && a.set("motionPathRotate", h.angle);
|
|
1281
1281
|
} else
|
|
1282
1282
|
a.set(n, r);
|
|
@@ -1304,16 +1304,16 @@ class Ti {
|
|
|
1304
1304
|
*/
|
|
1305
1305
|
addTrack(t) {
|
|
1306
1306
|
if (this._tracks.push(t), this._sharedWrites = null, Z(t)) {
|
|
1307
|
-
this._trackPlayers.set(t.id, new
|
|
1307
|
+
this._trackPlayers.set(t.id, new Us(t));
|
|
1308
1308
|
return;
|
|
1309
1309
|
}
|
|
1310
1310
|
if (Q(t)) {
|
|
1311
|
-
this._trackPlayers.set(t.id, new
|
|
1311
|
+
this._trackPlayers.set(t.id, new js(t)), this._springTracks.set(t.id, t);
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
|
-
if (
|
|
1314
|
+
if (de(t))
|
|
1315
1315
|
this._trackPlayers.set(t.id, new zt(t)), this._textTracks.set(t.id, t);
|
|
1316
|
-
else if (
|
|
1316
|
+
else if (li(t)) {
|
|
1317
1317
|
const e = {
|
|
1318
1318
|
id: t.id,
|
|
1319
1319
|
target: t.target,
|
|
@@ -1428,7 +1428,7 @@ class Ti {
|
|
|
1428
1428
|
*/
|
|
1429
1429
|
toDefinition() {
|
|
1430
1430
|
return {
|
|
1431
|
-
formatVersion:
|
|
1431
|
+
formatVersion: Ct,
|
|
1432
1432
|
id: this.id,
|
|
1433
1433
|
name: this.name,
|
|
1434
1434
|
config: { ...this._config },
|
|
@@ -1486,8 +1486,8 @@ class Ti {
|
|
|
1486
1486
|
return this._config.alternate && (t === -1 || this._loopIteration < t) ? (this._loopIteration++, this._armRepeatDelay(), this._direction = "forward", this._repeatDelayRemaining === 0) : (this._playbackState = "idle", this.onComplete?.(), !1);
|
|
1487
1487
|
}
|
|
1488
1488
|
}
|
|
1489
|
-
const
|
|
1490
|
-
function
|
|
1489
|
+
const Zs = 100;
|
|
1490
|
+
function Si(i, t, e, s) {
|
|
1491
1491
|
const n = [], r = [], { duration: o, alternate: a } = s, c = (d, m, p, g) => {
|
|
1492
1492
|
r.push([d, m]);
|
|
1493
1493
|
const y = [];
|
|
@@ -1497,20 +1497,20 @@ function xi(i, t, e, s) {
|
|
|
1497
1497
|
for (const b of y) n.push({ kind: "event", index: b, direction: p });
|
|
1498
1498
|
};
|
|
1499
1499
|
let l = t.time, h = t.direction, f = t.fresh === !0;
|
|
1500
|
-
const u = Math.min(
|
|
1500
|
+
const u = Math.min(Zs, Math.max(0, e.iteration - t.iteration));
|
|
1501
1501
|
for (let d = 0; d < u; d++) {
|
|
1502
1502
|
const m = h === "forward" ? o : 0;
|
|
1503
1503
|
c(l, m, h, f), n.push({ kind: "repeat" }), a ? (h = h === "forward" ? "reverse" : "forward", l = m, f = !1) : (l = h === "forward" ? 0 : o, f = !0);
|
|
1504
1504
|
}
|
|
1505
1505
|
return u > 0 && s.holding && !a ? { crossings: n, passes: r } : (c(l, e.time, h, f), { crossings: n, passes: r });
|
|
1506
1506
|
}
|
|
1507
|
-
function
|
|
1507
|
+
function Qs(i) {
|
|
1508
1508
|
return Z(i) ? {
|
|
1509
1509
|
id: i.id,
|
|
1510
1510
|
target: i.target,
|
|
1511
1511
|
property: i.property,
|
|
1512
1512
|
kind: "inertia",
|
|
1513
|
-
inertia:
|
|
1513
|
+
inertia: Mi(i.inertia),
|
|
1514
1514
|
...X(i)
|
|
1515
1515
|
} : Q(i) ? {
|
|
1516
1516
|
id: i.id,
|
|
@@ -1519,14 +1519,14 @@ function Gs(i) {
|
|
|
1519
1519
|
kind: "spring",
|
|
1520
1520
|
spring: { ...i.spring },
|
|
1521
1521
|
...X(i)
|
|
1522
|
-
} :
|
|
1522
|
+
} : de(i) ? {
|
|
1523
1523
|
id: i.id,
|
|
1524
1524
|
target: i.target,
|
|
1525
1525
|
property: "text",
|
|
1526
1526
|
textConfig: { ...i.textConfig },
|
|
1527
1527
|
keyframes: i.keyframes.map(Gt),
|
|
1528
1528
|
...X(i)
|
|
1529
|
-
} :
|
|
1529
|
+
} : li(i) ? {
|
|
1530
1530
|
id: i.id,
|
|
1531
1531
|
target: i.target,
|
|
1532
1532
|
property: "motionPath",
|
|
@@ -1541,7 +1541,7 @@ function Gs(i) {
|
|
|
1541
1541
|
...X(i)
|
|
1542
1542
|
};
|
|
1543
1543
|
}
|
|
1544
|
-
function
|
|
1544
|
+
function Mi(i) {
|
|
1545
1545
|
return { ...i, ...Array.isArray(i.end) && { end: [...i.end] } };
|
|
1546
1546
|
}
|
|
1547
1547
|
function Gt(i) {
|
|
@@ -1560,7 +1560,7 @@ function X(i) {
|
|
|
1560
1560
|
...i.stagger !== void 0 && { stagger: { ...i.stagger } }
|
|
1561
1561
|
};
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function Js(i) {
|
|
1564
1564
|
if (Z(i)) {
|
|
1565
1565
|
const t = i;
|
|
1566
1566
|
return {
|
|
@@ -1568,7 +1568,7 @@ function Ks(i) {
|
|
|
1568
1568
|
target: t.target,
|
|
1569
1569
|
property: t.property,
|
|
1570
1570
|
kind: "inertia",
|
|
1571
|
-
inertia:
|
|
1571
|
+
inertia: Mi(t.inertia),
|
|
1572
1572
|
...X(t)
|
|
1573
1573
|
};
|
|
1574
1574
|
}
|
|
@@ -1583,7 +1583,7 @@ function Ks(i) {
|
|
|
1583
1583
|
...X(t)
|
|
1584
1584
|
};
|
|
1585
1585
|
}
|
|
1586
|
-
if (
|
|
1586
|
+
if (de(i)) {
|
|
1587
1587
|
const t = i;
|
|
1588
1588
|
return {
|
|
1589
1589
|
id: t.id,
|
|
@@ -1613,10 +1613,10 @@ function Ks(i) {
|
|
|
1613
1613
|
...X(i)
|
|
1614
1614
|
});
|
|
1615
1615
|
}
|
|
1616
|
-
function
|
|
1616
|
+
function tn(i) {
|
|
1617
1617
|
const t = i._config.markers;
|
|
1618
1618
|
return {
|
|
1619
|
-
formatVersion:
|
|
1619
|
+
formatVersion: Ct,
|
|
1620
1620
|
id: i.id,
|
|
1621
1621
|
name: i.name,
|
|
1622
1622
|
config: {
|
|
@@ -1627,38 +1627,38 @@ function Zs(i) {
|
|
|
1627
1627
|
repeatDelay: i._config.repeatDelay,
|
|
1628
1628
|
...t && { markers: t.map((e) => ({ ...e })) }
|
|
1629
1629
|
},
|
|
1630
|
-
tracks: i.tracks.map(
|
|
1630
|
+
tracks: i.tracks.map(Qs),
|
|
1631
1631
|
...i.captions && { captions: JSON.parse(JSON.stringify(i.captions)) }
|
|
1632
1632
|
};
|
|
1633
1633
|
}
|
|
1634
|
-
function
|
|
1634
|
+
function gt(i) {
|
|
1635
1635
|
const t = i.formatVersion ?? 1;
|
|
1636
|
-
if (t >
|
|
1636
|
+
if (t > Ct)
|
|
1637
1637
|
throw new Error(
|
|
1638
|
-
`tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${
|
|
1638
|
+
`tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${Ct}. Update tinyfly to play it.`
|
|
1639
1639
|
);
|
|
1640
|
-
return new
|
|
1640
|
+
return new ki({
|
|
1641
1641
|
id: i.id,
|
|
1642
1642
|
name: i.name,
|
|
1643
1643
|
config: i.config,
|
|
1644
|
-
tracks: i.tracks.map(
|
|
1644
|
+
tracks: i.tracks.map(Js),
|
|
1645
1645
|
captions: i.captions
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
|
-
function
|
|
1649
|
-
return JSON.stringify(
|
|
1648
|
+
function Ro(i) {
|
|
1649
|
+
return JSON.stringify(tn(i));
|
|
1650
1650
|
}
|
|
1651
|
-
function
|
|
1651
|
+
function Io(i) {
|
|
1652
1652
|
const t = JSON.parse(i);
|
|
1653
|
-
return
|
|
1653
|
+
return gt(t);
|
|
1654
1654
|
}
|
|
1655
|
-
function
|
|
1655
|
+
function $o(i) {
|
|
1656
1656
|
let t = 2166136261;
|
|
1657
1657
|
for (let e = 0; e < i.length; e++)
|
|
1658
1658
|
t ^= i.charCodeAt(e), t = Math.imul(t, 16777619);
|
|
1659
1659
|
return t >>> 0;
|
|
1660
1660
|
}
|
|
1661
|
-
function
|
|
1661
|
+
function en(i) {
|
|
1662
1662
|
let t = i >>> 0 || 2654435769;
|
|
1663
1663
|
return {
|
|
1664
1664
|
seed: i >>> 0,
|
|
@@ -1667,25 +1667,25 @@ function Qs(i) {
|
|
|
1667
1667
|
}
|
|
1668
1668
|
};
|
|
1669
1669
|
}
|
|
1670
|
-
function
|
|
1670
|
+
function Ai(i, t, e) {
|
|
1671
1671
|
return t + i.next() * (e - t);
|
|
1672
1672
|
}
|
|
1673
|
-
function
|
|
1674
|
-
if (s <= 0) return
|
|
1673
|
+
function sn(i, t, e, s) {
|
|
1674
|
+
if (s <= 0) return Ai(i, t, e);
|
|
1675
1675
|
const n = Math.floor((e - t) / s), r = Math.round(i.next() * n);
|
|
1676
1676
|
return t + r * s;
|
|
1677
1677
|
}
|
|
1678
|
-
function
|
|
1678
|
+
function Lo(i, t) {
|
|
1679
1679
|
if (t.length !== 0)
|
|
1680
1680
|
return t[Math.floor(i.next() * t.length)];
|
|
1681
1681
|
}
|
|
1682
|
-
const
|
|
1683
|
-
function
|
|
1684
|
-
return typeof i != "string" ? !1 :
|
|
1682
|
+
const Pi = /^([+\-*/])=\s*(-?[\d.]+)$/, Ei = /^random\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*(?:,\s*(-?[\d.]+)\s*)?\)$/i;
|
|
1683
|
+
function Fo(i) {
|
|
1684
|
+
return typeof i != "string" ? !1 : Pi.test(i.trim()) || Ei.test(i.trim());
|
|
1685
1685
|
}
|
|
1686
|
-
function
|
|
1686
|
+
function Ci(i, t = {}) {
|
|
1687
1687
|
if (typeof i != "string") return i;
|
|
1688
|
-
const e = i.trim(), s =
|
|
1688
|
+
const e = i.trim(), s = Pi.exec(e);
|
|
1689
1689
|
if (s) {
|
|
1690
1690
|
const [, r, o] = s, a = t.base ?? 0, c = Number.parseFloat(o);
|
|
1691
1691
|
switch (r) {
|
|
@@ -1699,47 +1699,47 @@ function Pi(i, t = {}) {
|
|
|
1699
1699
|
return c === 0 ? a : a / c;
|
|
1700
1700
|
}
|
|
1701
1701
|
}
|
|
1702
|
-
const n =
|
|
1702
|
+
const n = Ei.exec(e);
|
|
1703
1703
|
if (n) {
|
|
1704
1704
|
if (!t.random)
|
|
1705
1705
|
throw new Error(
|
|
1706
1706
|
`resolveValue: "${e}" needs a random source — pass one via context.random`
|
|
1707
1707
|
);
|
|
1708
1708
|
const r = Number.parseFloat(n[1]), o = Number.parseFloat(n[2]), a = n[3] !== void 0 ? Number.parseFloat(n[3]) : void 0;
|
|
1709
|
-
return a !== void 0 ?
|
|
1709
|
+
return a !== void 0 ? sn(t.random, r, o, a) : Ai(t.random, r, o);
|
|
1710
1710
|
}
|
|
1711
1711
|
return i;
|
|
1712
1712
|
}
|
|
1713
|
-
function
|
|
1713
|
+
function nn(i, t = 0, e) {
|
|
1714
1714
|
const s = [];
|
|
1715
1715
|
let n = t;
|
|
1716
1716
|
for (const r of i) {
|
|
1717
|
-
const o =
|
|
1717
|
+
const o = Ci(r, { base: n, random: e });
|
|
1718
1718
|
s.push(o), typeof o == "number" && (n = o);
|
|
1719
1719
|
}
|
|
1720
1720
|
return s;
|
|
1721
1721
|
}
|
|
1722
|
-
class
|
|
1722
|
+
class Do {
|
|
1723
1723
|
random;
|
|
1724
1724
|
constructor(t) {
|
|
1725
|
-
this.random =
|
|
1725
|
+
this.random = en(t);
|
|
1726
1726
|
}
|
|
1727
1727
|
/** The seed, to be stored alongside the timeline so this can be reproduced. */
|
|
1728
1728
|
get seed() {
|
|
1729
1729
|
return this.random.seed;
|
|
1730
1730
|
}
|
|
1731
1731
|
resolve(t, e = 0) {
|
|
1732
|
-
return
|
|
1732
|
+
return Ci(t, { base: e, random: this.random });
|
|
1733
1733
|
}
|
|
1734
1734
|
resolveSequence(t, e = 0) {
|
|
1735
|
-
return
|
|
1735
|
+
return nn(t, e, this.random);
|
|
1736
1736
|
}
|
|
1737
1737
|
}
|
|
1738
|
-
const
|
|
1739
|
-
function
|
|
1738
|
+
const rn = 600;
|
|
1739
|
+
function on(i) {
|
|
1740
1740
|
if (Array.isArray(i)) {
|
|
1741
1741
|
const [u, d, m, p] = i;
|
|
1742
|
-
return { fn:
|
|
1742
|
+
return { fn: De(u, d, m, p), bezier: [u, d, m, p] };
|
|
1743
1743
|
}
|
|
1744
1744
|
const { segments: t } = nt(i);
|
|
1745
1745
|
if (t.length === 0) throw new Error(`customEase: no curve in "${i}"`);
|
|
@@ -1748,17 +1748,17 @@ function sn(i) {
|
|
|
1748
1748
|
const a = (u) => (u - e) / r, c = (u) => (u - s) / o;
|
|
1749
1749
|
if (t.length === 1 && n.type === "C") {
|
|
1750
1750
|
const [u, d, m, p] = n.points, g = [a(u), c(d), a(m), c(p)];
|
|
1751
|
-
return { fn:
|
|
1751
|
+
return { fn: De(...g), bezier: g };
|
|
1752
1752
|
}
|
|
1753
|
-
const l = [], h = [], f = Math.max(8, Math.ceil(
|
|
1753
|
+
const l = [], h = [], f = Math.max(8, Math.ceil(rn / t.length));
|
|
1754
1754
|
for (const u of t)
|
|
1755
1755
|
for (let d = l.length === 0 ? 0 : 1; d <= f; d++) {
|
|
1756
|
-
const [m, p] =
|
|
1756
|
+
const [m, p] = ln(u, d / f);
|
|
1757
1757
|
l.push(a(m)), h.push(c(p));
|
|
1758
1758
|
}
|
|
1759
|
-
return { fn:
|
|
1759
|
+
return { fn: hn(l, h) };
|
|
1760
1760
|
}
|
|
1761
|
-
function
|
|
1761
|
+
function an(i = {}) {
|
|
1762
1762
|
const e = 0.1 + Math.max(0, Math.min(1, i.strength ?? 0.7)) * 0.7, s = [1];
|
|
1763
1763
|
for (let r = e; r > 2e-3; r *= e) s.push(2 * Math.sqrt(r));
|
|
1764
1764
|
const n = s.reduce((r, o) => r + o, 0);
|
|
@@ -1777,11 +1777,11 @@ function nn(i = {}) {
|
|
|
1777
1777
|
return 1;
|
|
1778
1778
|
};
|
|
1779
1779
|
}
|
|
1780
|
-
function
|
|
1780
|
+
function cn(i = {}) {
|
|
1781
1781
|
const t = Math.max(1, i.wiggles ?? 10), e = i.type ?? "easeOut", s = (n) => e === "uniform" ? 1 : e === "easeInOut" ? Math.sin(Math.PI * n) : (1 - n) ** 2;
|
|
1782
1782
|
return (n) => n <= 0 || n >= 1 ? 0 : Math.sin(n * t * Math.PI * 2) * s(n);
|
|
1783
1783
|
}
|
|
1784
|
-
function
|
|
1784
|
+
function ln(i, t) {
|
|
1785
1785
|
if (i.type === "L") {
|
|
1786
1786
|
const [l, h] = i.points;
|
|
1787
1787
|
return [i.startX + (l - i.startX) * t, i.startY + (h - i.startY) * t];
|
|
@@ -1792,7 +1792,7 @@ function on(i, t) {
|
|
|
1792
1792
|
c * c * c * i.startY + 3 * c * c * t * s + 3 * c * t * t * r + t * t * t * a
|
|
1793
1793
|
];
|
|
1794
1794
|
}
|
|
1795
|
-
function
|
|
1795
|
+
function hn(i, t) {
|
|
1796
1796
|
return (e) => {
|
|
1797
1797
|
if (e <= i[0]) return t[0];
|
|
1798
1798
|
if (e >= i[i.length - 1]) return t[t.length - 1];
|
|
@@ -1805,7 +1805,7 @@ function an(i, t) {
|
|
|
1805
1805
|
return r === 0 ? t[n] : t[s] + (e - i[s]) / r * (t[n] - t[s]);
|
|
1806
1806
|
};
|
|
1807
1807
|
}
|
|
1808
|
-
function
|
|
1808
|
+
function De(i, t, e, s) {
|
|
1809
1809
|
const n = (o, a, c) => 3 * (1 - o) * (1 - o) * o * a + 3 * (1 - o) * o * o * c + o * o * o, r = (o, a, c) => 3 * (1 - o) * (1 - o) * a + 6 * (1 - o) * o * (c - a) + 3 * o * o * (1 - c);
|
|
1810
1810
|
return (o) => {
|
|
1811
1811
|
if (o <= 0) return 0;
|
|
@@ -1824,53 +1824,53 @@ function Le(i, t, e, s) {
|
|
|
1824
1824
|
return n(a, t, s);
|
|
1825
1825
|
};
|
|
1826
1826
|
}
|
|
1827
|
-
const
|
|
1828
|
-
function
|
|
1827
|
+
const Y = (i) => Math.round(i * 1e3) / 1e3;
|
|
1828
|
+
function un(i, t = {}) {
|
|
1829
1829
|
if (i.length === 0) return "";
|
|
1830
1830
|
const e = t.curviness ?? 1, s = t.closed ?? !1, n = i.length;
|
|
1831
|
-
let r = `M${
|
|
1831
|
+
let r = `M${Y(i[0].x)} ${Y(i[0].y)}`;
|
|
1832
1832
|
if (n === 1) return r;
|
|
1833
1833
|
const o = (c) => s ? i[(c % n + n) % n] : i[Math.max(0, Math.min(n - 1, c))], a = s ? n : n - 1;
|
|
1834
1834
|
for (let c = 0; c < a; c++) {
|
|
1835
1835
|
const l = o(c - 1), h = o(c), f = o(c + 1), u = o(c + 2);
|
|
1836
1836
|
if (e === 0) {
|
|
1837
|
-
r += ` L${
|
|
1837
|
+
r += ` L${Y(f.x)} ${Y(f.y)}`;
|
|
1838
1838
|
continue;
|
|
1839
1839
|
}
|
|
1840
1840
|
const d = e / 6, m = h.x + (f.x - l.x) * d, p = h.y + (f.y - l.y) * d, g = f.x - (u.x - h.x) * d, y = f.y - (u.y - h.y) * d;
|
|
1841
|
-
r += ` C${
|
|
1841
|
+
r += ` C${Y(m)} ${Y(p)} ${Y(g)} ${Y(y)} ${Y(f.x)} ${Y(f.y)}`;
|
|
1842
1842
|
}
|
|
1843
1843
|
return s ? `${r} Z` : r;
|
|
1844
1844
|
}
|
|
1845
|
-
const
|
|
1845
|
+
const L = (i, t = 0) => {
|
|
1846
1846
|
const e = parseFloat(i ?? "");
|
|
1847
1847
|
return Number.isFinite(e) ? e : t;
|
|
1848
1848
|
};
|
|
1849
|
-
function
|
|
1849
|
+
function fn(i) {
|
|
1850
1850
|
const t = (i ?? "").trim().split(/[\s,]+/).filter(Boolean).map(Number), e = [];
|
|
1851
1851
|
for (let s = 0; s + 1 < t.length; s += 2) e.push({ x: t[s], y: t[s + 1] });
|
|
1852
1852
|
return e;
|
|
1853
1853
|
}
|
|
1854
|
-
function
|
|
1854
|
+
function me(i) {
|
|
1855
1855
|
const t = i.attributes;
|
|
1856
1856
|
switch (i.tag.toLowerCase()) {
|
|
1857
1857
|
case "path":
|
|
1858
1858
|
return t.d ?? null;
|
|
1859
1859
|
case "circle":
|
|
1860
1860
|
case "ellipse": {
|
|
1861
|
-
const e =
|
|
1861
|
+
const e = L(t.cx), s = L(t.cy), n = i.tag.toLowerCase() === "circle" ? L(t.r) : L(t.rx), r = i.tag.toLowerCase() === "circle" ? L(t.r) : L(t.ry);
|
|
1862
1862
|
return `M${e + n} ${s} A${n} ${r} 0 1 1 ${e - n} ${s} A${n} ${r} 0 1 1 ${e + n} ${s} Z`;
|
|
1863
1863
|
}
|
|
1864
1864
|
case "rect": {
|
|
1865
|
-
const e =
|
|
1866
|
-
let o = t.rx != null ?
|
|
1865
|
+
const e = L(t.x), s = L(t.y), n = L(t.width), r = L(t.height);
|
|
1866
|
+
let o = t.rx != null ? L(t.rx) : t.ry != null ? L(t.ry) : 0, a = t.ry != null ? L(t.ry) : o;
|
|
1867
1867
|
return o = Math.min(o, n / 2), a = Math.min(a, r / 2), o === 0 || a === 0 ? `M${e} ${s} H${e + n} V${s + r} H${e} Z` : `M${e + o} ${s} H${e + n - o} A${o} ${a} 0 0 1 ${e + n} ${s + a} V${s + r - a} A${o} ${a} 0 0 1 ${e + n - o} ${s + r} H${e + o} A${o} ${a} 0 0 1 ${e} ${s + r - a} V${s + a} A${o} ${a} 0 0 1 ${e + o} ${s} Z`;
|
|
1868
1868
|
}
|
|
1869
1869
|
case "line":
|
|
1870
|
-
return `M${
|
|
1870
|
+
return `M${L(t.x1)} ${L(t.y1)} L${L(t.x2)} ${L(t.y2)}`;
|
|
1871
1871
|
case "polyline":
|
|
1872
1872
|
case "polygon": {
|
|
1873
|
-
const e =
|
|
1873
|
+
const e = fn(t.points);
|
|
1874
1874
|
if (e.length === 0) return null;
|
|
1875
1875
|
const s = e.map((n, r) => `${r === 0 ? "M" : "L"}${n.x} ${n.y}`).join(" ");
|
|
1876
1876
|
return i.tag.toLowerCase() === "polygon" ? `${s} Z` : s;
|
|
@@ -1879,7 +1879,7 @@ function pe(i) {
|
|
|
1879
1879
|
return null;
|
|
1880
1880
|
}
|
|
1881
1881
|
}
|
|
1882
|
-
const
|
|
1882
|
+
const St = {
|
|
1883
1883
|
"power1.in": [0.55, 0.085, 0.68, 0.53],
|
|
1884
1884
|
"power1.out": [0.25, 0.46, 0.45, 0.94],
|
|
1885
1885
|
"power1.inout": [0.455, 0.03, 0.515, 0.955],
|
|
@@ -1904,7 +1904,7 @@ const kt = {
|
|
|
1904
1904
|
"back.in": [0.6, -0.28, 0.735, 0.045],
|
|
1905
1905
|
"back.out": [0.175, 0.885, 0.32, 1.275],
|
|
1906
1906
|
"back.inout": [0.68, -0.55, 0.265, 1.55]
|
|
1907
|
-
},
|
|
1907
|
+
}, Oe = {
|
|
1908
1908
|
none: "linear",
|
|
1909
1909
|
linear: "linear",
|
|
1910
1910
|
"linear.none": "linear",
|
|
@@ -1916,35 +1916,35 @@ const kt = {
|
|
|
1916
1916
|
"power2.out": "ease-out-cubic",
|
|
1917
1917
|
"power2.inout": "ease-in-out-cubic"
|
|
1918
1918
|
};
|
|
1919
|
-
function
|
|
1919
|
+
function dn(i) {
|
|
1920
1920
|
let t = i.trim().toLowerCase();
|
|
1921
1921
|
t = t.replace(/\.ease(in|out|inout)$/, ".$1");
|
|
1922
1922
|
const e = /^([a-z]+\d?)(\(.*\))?$/.exec(t);
|
|
1923
1923
|
return e && e[1] !== "steps" && t !== "none" && t !== "linear" && (t = `${e[1]}.out${e[2] ?? ""}`), t;
|
|
1924
1924
|
}
|
|
1925
|
-
|
|
1926
|
-
|
|
1925
|
+
j({ type: "bounce", mode: "in" });
|
|
1926
|
+
j({ type: "bounce", mode: "in-out" });
|
|
1927
1927
|
function It(i) {
|
|
1928
|
-
const t =
|
|
1928
|
+
const t = _i.get(i.trim().toLowerCase());
|
|
1929
1929
|
if (t) return t;
|
|
1930
|
-
const e =
|
|
1930
|
+
const e = dn(i), s = /^steps\(\s*(\d+)\s*\)$/.exec(e);
|
|
1931
1931
|
if (s) {
|
|
1932
1932
|
const o = { type: "steps", count: Math.max(1, Number.parseInt(s[1], 10)) + 1, position: "none" };
|
|
1933
|
-
return { easing: o, fn:
|
|
1933
|
+
return { easing: o, fn: j(o) };
|
|
1934
1934
|
}
|
|
1935
1935
|
const n = /^(elastic|bounce|back)\.(in|out|inout)(?:\(([^)]*)\))?$/.exec(e);
|
|
1936
1936
|
if (n) {
|
|
1937
1937
|
const [, r, o, a] = n, c = (a ?? "").split(",").map((f) => Number.parseFloat(f)).filter((f) => Number.isFinite(f)), l = o === "inout" ? "in-out" : o;
|
|
1938
|
-
if (r === "back" && c.length === 0 && e in
|
|
1939
|
-
return { easing: { type: "cubic-bezier", points:
|
|
1938
|
+
if (r === "back" && c.length === 0 && e in St)
|
|
1939
|
+
return { easing: { type: "cubic-bezier", points: St[e] } };
|
|
1940
1940
|
const h = r === "elastic" ? { type: "elastic", mode: l, ...c[0] !== void 0 && { amplitude: c[0] }, ...c[1] !== void 0 && { period: c[1] } } : r === "bounce" ? { type: "bounce", mode: l } : { type: "back", mode: l, ...c[0] !== void 0 && { overshoot: c[0] } };
|
|
1941
|
-
return { easing: h, fn:
|
|
1941
|
+
return { easing: h, fn: j(h) };
|
|
1942
1942
|
}
|
|
1943
|
-
return e in
|
|
1943
|
+
return e in Oe ? { easing: Oe[e] } : e in St ? { easing: { type: "cubic-bezier", points: St[e] } } : { easing: "ease-out" };
|
|
1944
1944
|
}
|
|
1945
|
-
const
|
|
1946
|
-
function
|
|
1947
|
-
return
|
|
1945
|
+
const _i = /* @__PURE__ */ new Map();
|
|
1946
|
+
function ge(i, t) {
|
|
1947
|
+
return _i.set(
|
|
1948
1948
|
i.trim().toLowerCase(),
|
|
1949
1949
|
t.bezier ? { easing: { type: "cubic-bezier", points: t.bezier }, fn: t.fn } : { fn: t.fn, requiresBaking: "custom" }
|
|
1950
1950
|
), i;
|
|
@@ -1957,16 +1957,16 @@ function ae(i) {
|
|
|
1957
1957
|
return e = Math.imul(e ^ e >>> 15, e | 1), e ^= e + Math.imul(e ^ e >>> 7, e | 61), ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
1958
1958
|
};
|
|
1959
1959
|
}
|
|
1960
|
-
const
|
|
1961
|
-
function
|
|
1962
|
-
return typeof i == "string" &&
|
|
1960
|
+
const Ri = /^\s*random\(\s*(\[.*\]|[^)]*)\s*\)\s*$/;
|
|
1961
|
+
function Ii(i) {
|
|
1962
|
+
return typeof i == "string" && Ri.test(i);
|
|
1963
1963
|
}
|
|
1964
|
-
function
|
|
1964
|
+
function pn(i = 1) {
|
|
1965
1965
|
let t = ae(i);
|
|
1966
1966
|
const e = (c, l) => ((...h) => h.length >= c ? l(...h) : (f) => l(...h, f)), s = (c, l, h) => Math.min(Math.max(h, Math.min(c, l)), Math.max(c, l)), n = (c, l, h, f, u) => l === c ? h : h + (u - c) / (l - c) * (f - h), r = (c, l) => {
|
|
1967
1967
|
if (typeof c == "number") return c === 0 ? l : Math.round(l / c) * c;
|
|
1968
|
-
if (Array.isArray(c)) return
|
|
1969
|
-
if ("values" in c) return
|
|
1968
|
+
if (Array.isArray(c)) return Be(c, l, 1 / 0);
|
|
1969
|
+
if ("values" in c) return Be(c.values, l, c.radius ?? 1 / 0);
|
|
1970
1970
|
const h = Math.round(l / c.increment) * c.increment;
|
|
1971
1971
|
return Math.abs(h - l) <= (c.radius ?? 1 / 0) ? h : l;
|
|
1972
1972
|
}, o = (c, l, h) => {
|
|
@@ -2017,17 +2017,17 @@ function un(i = 1) {
|
|
|
2017
2017
|
return c;
|
|
2018
2018
|
},
|
|
2019
2019
|
distribute: ({ base: c = 0, amount: l, each: h, from: f = "start", ease: u }) => (d, m, p) => {
|
|
2020
|
-
const g = p.length, b =
|
|
2020
|
+
const g = p.length, b = pe(d, g, { ...l !== void 0 ? { amount: l } : { each: h ?? 1 }, from: f }), v = l !== void 0 ? l : (h ?? 1) * ui(g, f), T = u && v > 0 ? u(b / v) * v : b;
|
|
2021
2021
|
return c + T;
|
|
2022
2022
|
},
|
|
2023
2023
|
pipe: (...c) => (l) => c.reduce((h, f) => f(h), l),
|
|
2024
|
-
splitColor: (c) =>
|
|
2024
|
+
splitColor: (c) => mn(c),
|
|
2025
2025
|
getUnit: (c) => typeof c == "number" ? "" : /^-?[\d.]+(?:e[-+]?\d+)?([a-z%]*)$/i.exec(c.trim())?.[1] ?? "",
|
|
2026
2026
|
seed: (c) => {
|
|
2027
2027
|
t = ae(c);
|
|
2028
2028
|
},
|
|
2029
2029
|
resolveRandomString: (c) => {
|
|
2030
|
-
const l =
|
|
2030
|
+
const l = Ri.exec(c)?.[1] ?? "";
|
|
2031
2031
|
if (l.startsWith("[")) {
|
|
2032
2032
|
const m = l.slice(1, -1).split(",").map((p) => p.trim()).filter(Boolean).map((p) => Number.isFinite(Number(p)) ? Number(p) : p.replace(/^['"]|['"]$/g, ""));
|
|
2033
2033
|
return m[Math.floor(t() * m.length)];
|
|
@@ -2037,7 +2037,7 @@ function un(i = 1) {
|
|
|
2037
2037
|
}
|
|
2038
2038
|
};
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2040
|
+
function Be(i, t, e) {
|
|
2041
2041
|
let s = t, n = 1 / 0;
|
|
2042
2042
|
for (const r of i) {
|
|
2043
2043
|
const o = Math.abs(r - t);
|
|
@@ -2045,7 +2045,7 @@ function Oe(i, t, e) {
|
|
|
2045
2045
|
}
|
|
2046
2046
|
return n <= e ? s : t;
|
|
2047
2047
|
}
|
|
2048
|
-
function
|
|
2048
|
+
function mn(i) {
|
|
2049
2049
|
const t = i.trim(), e = /^#([0-9a-f]{3,8})$/i.exec(t)?.[1];
|
|
2050
2050
|
if (e) {
|
|
2051
2051
|
const r = (e.length <= 4 ? [...e].map((o) => o + o).join("") : e).match(/../g).map((o) => Number.parseInt(o, 16));
|
|
@@ -2054,19 +2054,19 @@ function fn(i) {
|
|
|
2054
2054
|
const s = (/rgba?\(([^)]+)\)/i.exec(t)?.[1] ?? "0,0,0").split(/[\s,/]+/).filter(Boolean).map((n) => Number.parseFloat(n));
|
|
2055
2055
|
return s.length >= 4 ? [s[0], s[1], s[2], s[3]] : [s[0] ?? 0, s[1] ?? 0, s[2] ?? 0];
|
|
2056
2056
|
}
|
|
2057
|
-
const
|
|
2057
|
+
const gn = /^([+-])=\s*(-?[\d.]+)$/, yn = /^([<>])\s*(?:([+-])?=?\s*(-?[\d.]+))?$/;
|
|
2058
2058
|
function ht(i, t) {
|
|
2059
2059
|
const e = t.scale ?? 1, s = (l) => Number.parseFloat(l) * e;
|
|
2060
2060
|
if (i === void 0) return t.cursor;
|
|
2061
2061
|
if (typeof i == "number") return i * e;
|
|
2062
2062
|
const n = i.trim();
|
|
2063
2063
|
if (n === "") return t.cursor;
|
|
2064
|
-
const r =
|
|
2064
|
+
const r = gn.exec(n);
|
|
2065
2065
|
if (r) {
|
|
2066
2066
|
const l = s(r[2]);
|
|
2067
2067
|
return t.cursor + (r[1] === "-" ? -l : l);
|
|
2068
2068
|
}
|
|
2069
|
-
const o =
|
|
2069
|
+
const o = yn.exec(n);
|
|
2070
2070
|
if (o) {
|
|
2071
2071
|
const l = o[1] === "<" ? t.previousStart : t.previousEnd;
|
|
2072
2072
|
if (o[3] === void 0) return l;
|
|
@@ -2084,12 +2084,12 @@ function ht(i, t) {
|
|
|
2084
2084
|
const c = t.labels.get(n);
|
|
2085
2085
|
return c !== void 0 ? c : /^-?[\d.]+$/.test(n) ? s(n) : t.cursor;
|
|
2086
2086
|
}
|
|
2087
|
-
function
|
|
2087
|
+
function bn(i) {
|
|
2088
2088
|
if (typeof i != "object" || i === null) return !1;
|
|
2089
2089
|
const t = i;
|
|
2090
2090
|
return t.grid !== void 0 || t.from === "random" || Array.isArray(t.from) || t.ease !== void 0 || t.axis !== void 0;
|
|
2091
2091
|
}
|
|
2092
|
-
function
|
|
2092
|
+
function vn(i, t, e = {}) {
|
|
2093
2093
|
if (i === 0) return [];
|
|
2094
2094
|
const s = t.grid === "auto" ? Math.max(1, Math.min(i, e.columnsFromLayout?.() ?? i)) : Array.isArray(t.grid) ? Math.max(1, t.grid[1]) : i, n = Array.isArray(t.grid) ? Math.max(1, t.grid[0]) : Math.ceil(i / s), r = (m) => ({ x: m % s, y: Math.floor(m / s) }), o = t.from ?? "start", a = Array.isArray(o) ? { x: o[0] * (s - 1), y: o[1] * (n - 1) } : typeof o == "number" ? r(Math.max(0, Math.min(i - 1, o))) : o === "end" ? r(i - 1) : o === "center" || o === "edges" ? { x: (s - 1) / 2, y: (n - 1) / 2 } : { x: 0, y: 0 }, c = (m) => {
|
|
2095
2095
|
const { x: p, y: g } = r(m), y = Math.abs(p - a.x), b = Math.abs(g - a.y);
|
|
@@ -2101,13 +2101,13 @@ function gn(i, t, e = {}) {
|
|
|
2101
2101
|
const m = e.random ?? Math.random;
|
|
2102
2102
|
l = l.map(() => m() * h);
|
|
2103
2103
|
}
|
|
2104
|
-
const f = t.amount !== void 0 ? t.amount : (t.each ?? 0) * h, u = t.ease ? It(t.ease) : void 0, d = u ? u.fn ??
|
|
2104
|
+
const f = t.amount !== void 0 ? t.amount : (t.each ?? 0) * h, u = t.ease ? It(t.ease) : void 0, d = u ? u.fn ?? j(u.easing) : void 0;
|
|
2105
2105
|
return l.map((m) => {
|
|
2106
2106
|
const p = h === 0 ? 0 : m / h;
|
|
2107
2107
|
return (d ? d(p) : p) * f;
|
|
2108
2108
|
});
|
|
2109
2109
|
}
|
|
2110
|
-
const
|
|
2110
|
+
const ye = /* @__PURE__ */ new Set([
|
|
2111
2111
|
"duration",
|
|
2112
2112
|
"delay",
|
|
2113
2113
|
"ease",
|
|
@@ -2134,7 +2134,7 @@ const ge = /* @__PURE__ */ new Set([
|
|
|
2134
2134
|
function Pt(i) {
|
|
2135
2135
|
const t = {}, e = {};
|
|
2136
2136
|
for (const [s, n] of Object.entries(i))
|
|
2137
|
-
|
|
2137
|
+
ye.has(s) ? t[s] = n : e[s] = n;
|
|
2138
2138
|
return { config: t, properties: e };
|
|
2139
2139
|
}
|
|
2140
2140
|
function $t(i, t) {
|
|
@@ -2142,13 +2142,13 @@ function $t(i, t) {
|
|
|
2142
2142
|
}
|
|
2143
2143
|
function ce(i, t) {
|
|
2144
2144
|
if (i !== void 0)
|
|
2145
|
-
return typeof i == "number" ? { each: i * 1e3 } :
|
|
2145
|
+
return typeof i == "number" ? { each: i * 1e3 } : bn(i) ? { offsets: vn(t?.count ?? 0, i, t ?? {}).map((s) => s * 1e3) } : {
|
|
2146
2146
|
...i.each !== void 0 && { each: i.each * 1e3 },
|
|
2147
2147
|
...i.amount !== void 0 && { amount: i.amount * 1e3 },
|
|
2148
2148
|
...i.from !== void 0 && { from: i.from }
|
|
2149
2149
|
};
|
|
2150
2150
|
}
|
|
2151
|
-
const
|
|
2151
|
+
const wn = {
|
|
2152
2152
|
opacity: 1,
|
|
2153
2153
|
x: 0,
|
|
2154
2154
|
y: 0,
|
|
@@ -2174,17 +2174,17 @@ const yn = {
|
|
|
2174
2174
|
clipBottom: 0,
|
|
2175
2175
|
clipLeft: 0
|
|
2176
2176
|
};
|
|
2177
|
-
function
|
|
2178
|
-
return
|
|
2177
|
+
function $i(i) {
|
|
2178
|
+
return wn[i];
|
|
2179
2179
|
}
|
|
2180
|
-
function
|
|
2180
|
+
function Tn(i) {
|
|
2181
2181
|
const t = typeof i == "string" || Array.isArray(i) ? { path: i } : i;
|
|
2182
2182
|
if (!t || typeof t.path != "string" && !Array.isArray(t.path))
|
|
2183
2183
|
throw new Error("gsap-compat: motionPath needs a path — SVG path data or an array of { x, y } points.");
|
|
2184
2184
|
let e;
|
|
2185
2185
|
if (Array.isArray(t.path))
|
|
2186
|
-
e =
|
|
2187
|
-
else if (
|
|
2186
|
+
e = un(t.path, { curviness: t.curviness });
|
|
2187
|
+
else if (wt(t.path))
|
|
2188
2188
|
e = t.path;
|
|
2189
2189
|
else
|
|
2190
2190
|
throw new Error(
|
|
@@ -2193,61 +2193,61 @@ function bn(i) {
|
|
|
2193
2193
|
const s = { pathData: e };
|
|
2194
2194
|
return t.autoRotate !== void 0 && t.autoRotate !== !1 && (s.autoRotate = !0, typeof t.autoRotate == "number" && (s.rotateOffset = t.autoRotate)), t.matrix && (s.matrix = t.matrix), { config: s, start: t.start ?? 0, end: t.end ?? 1 };
|
|
2195
2195
|
}
|
|
2196
|
-
function
|
|
2196
|
+
function xn(i) {
|
|
2197
2197
|
const t = typeof i == "string" || Array.isArray(i) ? { path: i } : { ...i };
|
|
2198
2198
|
return { ...t, start: t.end ?? 1, end: t.start ?? 0 };
|
|
2199
2199
|
}
|
|
2200
|
-
function
|
|
2200
|
+
function Li(i) {
|
|
2201
2201
|
return typeof i == "object" && i !== null && "shape" in i ? i.shape : i;
|
|
2202
2202
|
}
|
|
2203
|
-
function
|
|
2203
|
+
function kn(i) {
|
|
2204
2204
|
if (i.morphSVG === void 0) return i;
|
|
2205
|
-
const { morphSVG: t, ...e } = i, s =
|
|
2206
|
-
if (typeof s != "string" || !
|
|
2205
|
+
const { morphSVG: t, ...e } = i, s = Li(t);
|
|
2206
|
+
if (typeof s != "string" || !wt(s))
|
|
2207
2207
|
throw new Error(
|
|
2208
2208
|
`gsap-compat: morphSVG "${String(s)}" is not path data. Selectors and elements are resolved by live.to(); timeline() and tf need the path data itself.`
|
|
2209
2209
|
);
|
|
2210
2210
|
return { ...e, d: s };
|
|
2211
2211
|
}
|
|
2212
|
-
function
|
|
2212
|
+
function Sn(i, t) {
|
|
2213
2213
|
if (i === !0) return [0, t];
|
|
2214
2214
|
if (i === !1) return [0, 0];
|
|
2215
|
-
if (typeof i == "number") return [0,
|
|
2215
|
+
if (typeof i == "number") return [0, Ne(i, t)];
|
|
2216
2216
|
const e = i.trim().split(/[\s,]+/).filter(Boolean), s = (o) => {
|
|
2217
2217
|
const a = Number.parseFloat(o);
|
|
2218
2218
|
if (Number.isNaN(a)) throw new Error(`gsap-compat: drawSVG "${i}" is not a length or percentage`);
|
|
2219
|
-
return
|
|
2219
|
+
return Ne(o.endsWith("%") ? t * a / 100 : a, t);
|
|
2220
2220
|
};
|
|
2221
2221
|
if (e.length === 0) return [0, t];
|
|
2222
2222
|
if (e.length === 1) return [0, s(e[0])];
|
|
2223
2223
|
const n = s(e[0]), r = s(e[1]);
|
|
2224
2224
|
return n <= r ? [n, r] : [r, n];
|
|
2225
2225
|
}
|
|
2226
|
-
function
|
|
2227
|
-
const [e, s] =
|
|
2226
|
+
function Mn(i, t) {
|
|
2227
|
+
const [e, s] = Sn(i, t);
|
|
2228
2228
|
return { strokeDasharray: [s - e, t], strokeDashoffset: -e };
|
|
2229
2229
|
}
|
|
2230
|
-
function
|
|
2230
|
+
function An(i, t) {
|
|
2231
2231
|
if (i.drawSVG === void 0) return i;
|
|
2232
2232
|
const { drawSVG: e, ...s } = i;
|
|
2233
|
-
return { ...s, ...
|
|
2233
|
+
return { ...s, ...Mn(e, t) };
|
|
2234
2234
|
}
|
|
2235
|
-
function
|
|
2235
|
+
function Pn(i) {
|
|
2236
2236
|
if (i.drawSVG !== void 0)
|
|
2237
2237
|
throw new Error(
|
|
2238
2238
|
"gsap-compat: drawSVG needs the stroke length from the page. Use live.to(), or animate strokeDasharray / strokeDashoffset directly (see drawSvgProperties)."
|
|
2239
2239
|
);
|
|
2240
2240
|
return i;
|
|
2241
2241
|
}
|
|
2242
|
-
function
|
|
2242
|
+
function Ne(i, t) {
|
|
2243
2243
|
return Math.max(0, Math.min(t, i));
|
|
2244
2244
|
}
|
|
2245
|
-
function
|
|
2245
|
+
function En(i) {
|
|
2246
2246
|
let t = 2166136261;
|
|
2247
2247
|
for (let e = 0; e < i.length; e++) t = Math.imul(t ^ i.charCodeAt(e), 16777619);
|
|
2248
2248
|
return t >>> 0;
|
|
2249
2249
|
}
|
|
2250
|
-
function
|
|
2250
|
+
function Cn(i, t, e) {
|
|
2251
2251
|
if (i.scrambleText !== void 0) {
|
|
2252
2252
|
const s = i.scrambleText, n = typeof s == "string" ? { text: s } : s;
|
|
2253
2253
|
if (typeof n?.text != "string")
|
|
@@ -2261,7 +2261,7 @@ function An(i, t, e) {
|
|
|
2261
2261
|
...r !== void 0 && { revealDelay: Math.min(r, 0.999) },
|
|
2262
2262
|
...n.tweenLength !== void 0 && { tweenLength: n.tweenLength },
|
|
2263
2263
|
...n.rightToLeft !== void 0 && { rightToLeft: n.rightToLeft },
|
|
2264
|
-
seed: n.seed ??
|
|
2264
|
+
seed: n.seed ?? En(`${t}|${n.text}`)
|
|
2265
2265
|
};
|
|
2266
2266
|
}
|
|
2267
2267
|
if (i.text !== void 0) {
|
|
@@ -2275,37 +2275,37 @@ function An(i, t, e) {
|
|
|
2275
2275
|
};
|
|
2276
2276
|
}
|
|
2277
2277
|
}
|
|
2278
|
-
function
|
|
2278
|
+
function be(i) {
|
|
2279
2279
|
return Math.max(0.1, i / 25);
|
|
2280
2280
|
}
|
|
2281
|
-
function
|
|
2281
|
+
function _n(i, t) {
|
|
2282
2282
|
const e = typeof t == "number" ? { velocity: t } : t;
|
|
2283
2283
|
if (typeof e?.velocity != "number" || !Number.isFinite(e.velocity))
|
|
2284
2284
|
throw new Error("gsap-compat: inertia needs a velocity for each property — a number, or { velocity }.");
|
|
2285
|
-
const s = e.friction ?? (e.resistance !== void 0 ?
|
|
2285
|
+
const s = e.friction ?? (e.resistance !== void 0 ? be(e.resistance) : void 0), n = {
|
|
2286
2286
|
from: i,
|
|
2287
2287
|
velocity: e.velocity,
|
|
2288
2288
|
...s !== void 0 && { friction: s },
|
|
2289
2289
|
...e.min !== void 0 && { min: e.min },
|
|
2290
2290
|
...e.max !== void 0 && { max: e.max }
|
|
2291
2291
|
};
|
|
2292
|
-
return typeof e.end == "function" ? n.end = [e.end(
|
|
2292
|
+
return typeof e.end == "function" ? n.end = [e.end(_t(n))] : e.end !== void 0 && (n.end = Array.isArray(e.end) ? [...e.end] : e.end), n;
|
|
2293
2293
|
}
|
|
2294
|
-
function
|
|
2294
|
+
function Rn(i) {
|
|
2295
2295
|
const t = i === !0 ? {} : typeof i == "string" ? { preset: i } : i;
|
|
2296
|
-
if (t.preset !== void 0 && !(t.preset in
|
|
2296
|
+
if (t.preset !== void 0 && !(t.preset in Xt))
|
|
2297
2297
|
throw new Error(
|
|
2298
|
-
`gsap-compat: unknown spring preset "${t.preset}" — use one of ${Object.keys(
|
|
2298
|
+
`gsap-compat: unknown spring preset "${t.preset}" — use one of ${Object.keys(Xt).join(", ")}`
|
|
2299
2299
|
);
|
|
2300
2300
|
return {
|
|
2301
|
-
...t.preset ?
|
|
2301
|
+
...t.preset ? Xt[t.preset] : {},
|
|
2302
2302
|
...t.stiffness !== void 0 && { stiffness: t.stiffness },
|
|
2303
2303
|
...t.damping !== void 0 && { damping: t.damping },
|
|
2304
2304
|
...t.mass !== void 0 && { mass: t.mass },
|
|
2305
2305
|
...t.restDelta !== void 0 && { restDelta: t.restDelta }
|
|
2306
2306
|
};
|
|
2307
2307
|
}
|
|
2308
|
-
function
|
|
2308
|
+
function In(i, t) {
|
|
2309
2309
|
if (i === !0 || typeof i == "string") return;
|
|
2310
2310
|
const e = i.velocity;
|
|
2311
2311
|
return typeof e == "number" ? e : e?.[t];
|
|
@@ -2323,7 +2323,7 @@ class st {
|
|
|
2323
2323
|
/** Last authored value per "target|property", for the resolution chain. */
|
|
2324
2324
|
lastValues = /* @__PURE__ */ new Map();
|
|
2325
2325
|
constructor(t = {}) {
|
|
2326
|
-
this.options = t, this.timeline = new
|
|
2326
|
+
this.options = t, this.timeline = new ki({
|
|
2327
2327
|
// A timestamped default would make the same script compile to different
|
|
2328
2328
|
// JSON on every run, which breaks the determinism contract. Callers that
|
|
2329
2329
|
// need distinct ids pass one.
|
|
@@ -2347,7 +2347,7 @@ class st {
|
|
|
2347
2347
|
const { config: n, properties: r } = Pt(ut(e)), { motionPath: o, text: a, scrambleText: c, ...l } = r, h = this.targetsOf(t)[0], f = { ...n };
|
|
2348
2348
|
for (const m of Object.keys(l))
|
|
2349
2349
|
f[m] = this.resolveStart(h, m);
|
|
2350
|
-
o !== void 0 && (f.motionPath =
|
|
2350
|
+
o !== void 0 && (f.motionPath = xn(o));
|
|
2351
2351
|
const u = {}, d = String(this.resolveStart(h, "text"));
|
|
2352
2352
|
return a !== void 0 && (u.text = Kt(a), f.text = typeof a == "object" ? { ...a, value: d } : d), c !== void 0 && (u.text = Kt(c), f.scrambleText = typeof c == "object" ? { ...c, text: d } : d), this.build(t, { ...l, ...u }, f, s);
|
|
2353
2353
|
}
|
|
@@ -2480,50 +2480,50 @@ class st {
|
|
|
2480
2480
|
random: this.options.random ?? this.fallbackRandom
|
|
2481
2481
|
}), y = this.easingFor(r.ease), b = [], v = r.spring;
|
|
2482
2482
|
let T = 0, w = !1;
|
|
2483
|
-
for (const [
|
|
2484
|
-
const
|
|
2485
|
-
let
|
|
2486
|
-
if (typeof
|
|
2487
|
-
`no usable start value for "${
|
|
2488
|
-
),
|
|
2489
|
-
const
|
|
2490
|
-
...
|
|
2491
|
-
from:
|
|
2492
|
-
to:
|
|
2493
|
-
velocity:
|
|
2494
|
-
},
|
|
2495
|
-
id:
|
|
2483
|
+
for (const [k, E] of Object.entries(f)) {
|
|
2484
|
+
const P = E;
|
|
2485
|
+
let S = e?.[k] !== void 0 ? e[k] : this.resolveStart(u[0], k);
|
|
2486
|
+
if (typeof S != typeof P && (this.warn(
|
|
2487
|
+
`no usable start value for "${k}" on "${u[0]}" — it will snap to ${String(P)}. Use fromTo() to animate it.`
|
|
2488
|
+
), S = P), v !== void 0 && (typeof S != "number" || typeof P != "number") && this.warn(`spring works on numbers, so "${k}" on "${u[0]}" eases instead`), v !== void 0 && typeof S == "number" && typeof P == "number") {
|
|
2489
|
+
const I = {
|
|
2490
|
+
...Rn(v),
|
|
2491
|
+
from: S,
|
|
2492
|
+
to: P,
|
|
2493
|
+
velocity: In(v, k) ?? this.options.startVelocity?.(u[0], k) ?? 0
|
|
2494
|
+
}, F = this.nextTrackId(`${u[0]}-${k}-spring`), H = {
|
|
2495
|
+
id: F,
|
|
2496
2496
|
target: u[0],
|
|
2497
2497
|
...u.length > 1 && { targets: u },
|
|
2498
2498
|
...g && u.length > 1 && { stagger: g },
|
|
2499
|
-
property:
|
|
2499
|
+
property: k,
|
|
2500
2500
|
kind: "spring",
|
|
2501
|
-
spring:
|
|
2501
|
+
spring: I,
|
|
2502
2502
|
delay: d + m
|
|
2503
2503
|
};
|
|
2504
|
-
this.timeline.addTrack(H), b.push(
|
|
2505
|
-
for (const
|
|
2504
|
+
this.timeline.addTrack(H), b.push(F), T = Math.max(T, Ji(I));
|
|
2505
|
+
for (const R of u) this.lastValues.set(`${R}|${k}`, P);
|
|
2506
2506
|
continue;
|
|
2507
2507
|
}
|
|
2508
2508
|
w = !0;
|
|
2509
|
-
const
|
|
2509
|
+
const _ = this.keyframesFor(S, P, p, y, r.ease), $ = this.nextTrackId(`${u[0]}-${k}`);
|
|
2510
2510
|
this.timeline.addTrack(
|
|
2511
2511
|
oe({
|
|
2512
2512
|
id: $,
|
|
2513
2513
|
target: u[0],
|
|
2514
2514
|
...u.length > 1 && { targets: u },
|
|
2515
2515
|
...g && u.length > 1 && { stagger: g },
|
|
2516
|
-
property:
|
|
2516
|
+
property: k,
|
|
2517
2517
|
delay: d + m,
|
|
2518
|
-
keyframes:
|
|
2518
|
+
keyframes: _
|
|
2519
2519
|
})
|
|
2520
2520
|
), b.push($);
|
|
2521
|
-
for (const
|
|
2521
|
+
for (const I of u) this.lastValues.set(`${I}|${k}`, P);
|
|
2522
2522
|
}
|
|
2523
|
-
const x =
|
|
2523
|
+
const x = Cn({ text: c, scrambleText: l }, u[0], p);
|
|
2524
2524
|
if (x) {
|
|
2525
|
-
const
|
|
2526
|
-
id:
|
|
2525
|
+
const k = e?.text ?? e?.scrambleText, E = k !== void 0 ? Kt(k) : this.resolveStart(u[0], "text"), P = this.nextTrackId(`${u[0]}-text`), S = {
|
|
2526
|
+
id: P,
|
|
2527
2527
|
target: u[0],
|
|
2528
2528
|
...u.length > 1 && { targets: u },
|
|
2529
2529
|
...g && u.length > 1 && { stagger: g },
|
|
@@ -2532,49 +2532,49 @@ class st {
|
|
|
2532
2532
|
delay: d + m,
|
|
2533
2533
|
keyframes: this.keyframesFor(0, 1, p, y, r.ease)
|
|
2534
2534
|
};
|
|
2535
|
-
this.timeline.addTrack(
|
|
2536
|
-
for (const
|
|
2535
|
+
this.timeline.addTrack(S), b.push(P);
|
|
2536
|
+
for (const _ of u) this.lastValues.set(`${_}|text`, x.to);
|
|
2537
2537
|
}
|
|
2538
2538
|
if (a !== void 0) {
|
|
2539
|
-
const { config:
|
|
2540
|
-
id:
|
|
2539
|
+
const { config: k, start: E, end: P } = Tn(a), S = this.nextTrackId(`${u[0]}-motionPath`), _ = {
|
|
2540
|
+
id: S,
|
|
2541
2541
|
target: u[0],
|
|
2542
2542
|
...u.length > 1 && { targets: u },
|
|
2543
2543
|
...g && u.length > 1 && { stagger: g },
|
|
2544
2544
|
property: "motionPath",
|
|
2545
|
-
motionPathConfig:
|
|
2545
|
+
motionPathConfig: k,
|
|
2546
2546
|
delay: d + m,
|
|
2547
|
-
keyframes: this.keyframesFor(E,
|
|
2547
|
+
keyframes: this.keyframesFor(E, P, p, y, r.ease)
|
|
2548
2548
|
};
|
|
2549
|
-
this.timeline.addTrack(
|
|
2549
|
+
this.timeline.addTrack(_), b.push(S);
|
|
2550
2550
|
}
|
|
2551
2551
|
if (h !== void 0)
|
|
2552
|
-
for (const [
|
|
2553
|
-
const
|
|
2554
|
-
if (typeof
|
|
2555
|
-
this.warn(`inertia on "${
|
|
2552
|
+
for (const [k, E] of Object.entries(h)) {
|
|
2553
|
+
const P = this.resolveStart(u[0], k);
|
|
2554
|
+
if (typeof P != "number") {
|
|
2555
|
+
this.warn(`inertia on "${k}" needs a numeric start value; skipped`);
|
|
2556
2556
|
continue;
|
|
2557
2557
|
}
|
|
2558
|
-
const
|
|
2559
|
-
id:
|
|
2558
|
+
const S = _n(P, E), _ = this.nextTrackId(`${u[0]}-${k}-inertia`), $ = {
|
|
2559
|
+
id: _,
|
|
2560
2560
|
target: u[0],
|
|
2561
2561
|
...u.length > 1 && { targets: u },
|
|
2562
2562
|
...g && u.length > 1 && { stagger: g },
|
|
2563
|
-
property:
|
|
2563
|
+
property: k,
|
|
2564
2564
|
kind: "inertia",
|
|
2565
|
-
inertia:
|
|
2565
|
+
inertia: S,
|
|
2566
2566
|
delay: d + m
|
|
2567
2567
|
};
|
|
2568
|
-
this.timeline.addTrack($), b.push(
|
|
2569
|
-
for (const
|
|
2568
|
+
this.timeline.addTrack($), b.push(_), T = Math.max(T, vt(S));
|
|
2569
|
+
for (const I of u) this.lastValues.set(`${I}|${k}`, bt(S));
|
|
2570
2570
|
}
|
|
2571
|
-
const
|
|
2571
|
+
const D = ((h !== void 0 || v !== void 0) && !w && !x && a === void 0 ? T : Math.max(p, T)) + (g && u.length > 1 ? Dt(u.length, g) : 0), A = d + m + D;
|
|
2572
2572
|
return this.previousStart = d + m, this.previousEnd = A, this.cursor = Math.max(this.cursor, A), {
|
|
2573
2573
|
trackIds: b,
|
|
2574
2574
|
start: d + m,
|
|
2575
2575
|
end: A,
|
|
2576
2576
|
kill: () => {
|
|
2577
|
-
for (const
|
|
2577
|
+
for (const k of b) this.timeline.removeTrack(k);
|
|
2578
2578
|
}
|
|
2579
2579
|
};
|
|
2580
2580
|
}
|
|
@@ -2587,8 +2587,8 @@ class st {
|
|
|
2587
2587
|
return [{ time: 0, value: e }];
|
|
2588
2588
|
const a = typeof r == "string" ? It(r) : void 0;
|
|
2589
2589
|
if (a?.requiresBaking === "custom" || this.options.bakeEases && Et(n)) {
|
|
2590
|
-
const l = a?.fn ??
|
|
2591
|
-
return [o, ...
|
|
2590
|
+
const l = a?.fn ?? j(n);
|
|
2591
|
+
return [o, ...Ti(o, { time: s, value: e }, l, { intervalMs: this.options.bakeIntervalMs })];
|
|
2592
2592
|
}
|
|
2593
2593
|
return [o, { time: s, value: e, ...n && { easing: n } }];
|
|
2594
2594
|
}
|
|
@@ -2605,7 +2605,7 @@ class st {
|
|
|
2605
2605
|
throw new Error(
|
|
2606
2606
|
`gsap-compat: no starting shape for "${t}". Use fromTo({ d: … }, { morphSVG: … }), or live.to(), which reads the element's current shape.`
|
|
2607
2607
|
);
|
|
2608
|
-
const o =
|
|
2608
|
+
const o = $i(e);
|
|
2609
2609
|
return o !== void 0 ? (this.warn(
|
|
2610
2610
|
`no start value for "${e}" on "${t}" — using the static default ${o}. GSAP would read the live DOM here; tinyfly cannot, so pass an explicit fromTo() or a defaults map.`
|
|
2611
2611
|
), o) : (this.warn(`no start value or default for "${e}" on "${t}" — using 0`), 0);
|
|
@@ -2648,13 +2648,13 @@ function Kt(i) {
|
|
|
2648
2648
|
}
|
|
2649
2649
|
return String(i ?? "");
|
|
2650
2650
|
}
|
|
2651
|
-
function
|
|
2651
|
+
function $n(i) {
|
|
2652
2652
|
return new st(i);
|
|
2653
2653
|
}
|
|
2654
2654
|
function ut(i) {
|
|
2655
|
-
return
|
|
2655
|
+
return Pn(kn(i));
|
|
2656
2656
|
}
|
|
2657
|
-
const
|
|
2657
|
+
const Ln = /* @__PURE__ */ new Set([
|
|
2658
2658
|
"blur",
|
|
2659
2659
|
"brightness",
|
|
2660
2660
|
"glow",
|
|
@@ -2663,16 +2663,16 @@ const Rn = /* @__PURE__ */ new Set([
|
|
|
2663
2663
|
"shadowY",
|
|
2664
2664
|
"shadowBlur",
|
|
2665
2665
|
"shadowColor"
|
|
2666
|
-
]),
|
|
2667
|
-
function
|
|
2666
|
+
]), Fn = "#ffffff", Dn = "rgba(0, 0, 0, 0.5)";
|
|
2667
|
+
function On(i) {
|
|
2668
2668
|
const t = [];
|
|
2669
|
-
if (i.blur !== void 0 && t.push(`blur(${Math.max(0, i.blur)}px)`), i.brightness !== void 0 && t.push(`brightness(${Math.max(0, i.brightness)})`), i.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, i.glow)}px ${i.glowColor ??
|
|
2669
|
+
if (i.blur !== void 0 && t.push(`blur(${Math.max(0, i.blur)}px)`), i.brightness !== void 0 && t.push(`brightness(${Math.max(0, i.brightness)})`), i.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, i.glow)}px ${i.glowColor ?? Fn})`), i.shadowX !== void 0 || i.shadowY !== void 0 || i.shadowBlur !== void 0) {
|
|
2670
2670
|
const e = i.shadowX ?? 0, s = i.shadowY ?? 0, n = Math.max(0, i.shadowBlur ?? 0);
|
|
2671
|
-
t.push(`drop-shadow(${e}px ${s}px ${n}px ${i.shadowColor ??
|
|
2671
|
+
t.push(`drop-shadow(${e}px ${s}px ${n}px ${i.shadowColor ?? Dn})`);
|
|
2672
2672
|
}
|
|
2673
2673
|
return t.length > 0 ? t.join(" ") : null;
|
|
2674
2674
|
}
|
|
2675
|
-
function
|
|
2675
|
+
function Bn(i, t) {
|
|
2676
2676
|
const e = i.childNodes.length === 1 ? i.firstChild : null;
|
|
2677
2677
|
if (e && e.nodeType === 3) {
|
|
2678
2678
|
const s = e;
|
|
@@ -2681,12 +2681,12 @@ function Ln(i, t) {
|
|
|
2681
2681
|
}
|
|
2682
2682
|
i.textContent !== t && (i.textContent = t);
|
|
2683
2683
|
}
|
|
2684
|
-
function
|
|
2684
|
+
function Nn(i) {
|
|
2685
2685
|
if (!("ownerSVGElement" in i)) return;
|
|
2686
2686
|
const t = i.style;
|
|
2687
2687
|
!t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
|
|
2688
2688
|
}
|
|
2689
|
-
const
|
|
2689
|
+
const qe = /* @__PURE__ */ new Set([
|
|
2690
2690
|
"width",
|
|
2691
2691
|
"height",
|
|
2692
2692
|
"top",
|
|
@@ -2712,7 +2712,7 @@ const Ne = /* @__PURE__ */ new Set([
|
|
|
2712
2712
|
"gap",
|
|
2713
2713
|
"rowGap",
|
|
2714
2714
|
"columnGap"
|
|
2715
|
-
]),
|
|
2715
|
+
]), qn = /* @__PURE__ */ new Set([
|
|
2716
2716
|
"x",
|
|
2717
2717
|
"y",
|
|
2718
2718
|
"z",
|
|
@@ -2730,14 +2730,14 @@ const Ne = /* @__PURE__ */ new Set([
|
|
|
2730
2730
|
"motionPathX",
|
|
2731
2731
|
"motionPathY",
|
|
2732
2732
|
"motionPathRotate"
|
|
2733
|
-
]),
|
|
2733
|
+
]), Yn = /* @__PURE__ */ new Set(["originX", "originY"]), Xn = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Vn = {
|
|
2734
2734
|
fill: "backgroundColor",
|
|
2735
2735
|
stroke: "borderColor",
|
|
2736
2736
|
strokeWidth: "borderWidth",
|
|
2737
2737
|
color: "color",
|
|
2738
2738
|
backgroundColor: "backgroundColor",
|
|
2739
2739
|
borderColor: "borderColor"
|
|
2740
|
-
},
|
|
2740
|
+
}, Ye = {
|
|
2741
2741
|
fill: "fill",
|
|
2742
2742
|
stroke: "stroke",
|
|
2743
2743
|
strokeWidth: "strokeWidth",
|
|
@@ -2745,7 +2745,7 @@ const Ne = /* @__PURE__ */ new Set([
|
|
|
2745
2745
|
strokeDashoffset: "strokeDashoffset",
|
|
2746
2746
|
fillOpacity: "fillOpacity",
|
|
2747
2747
|
strokeOpacity: "strokeOpacity"
|
|
2748
|
-
},
|
|
2748
|
+
}, Wn = "http://www.w3.org/2000/svg";
|
|
2749
2749
|
class K {
|
|
2750
2750
|
targets = /* @__PURE__ */ new Map();
|
|
2751
2751
|
/**
|
|
@@ -2790,18 +2790,18 @@ class K {
|
|
|
2790
2790
|
const a = e.has("motionPathX"), c = e.has("motionPathY"), l = e.has("motionPathRotate");
|
|
2791
2791
|
for (const [u, d] of e)
|
|
2792
2792
|
if (!(u === "x" && a) && !(u === "y" && c) && !((u === "rotate" || u === "rotateZ") && l)) {
|
|
2793
|
-
if (
|
|
2793
|
+
if (qn.has(u)) {
|
|
2794
2794
|
const m = this.buildTransformPart(u, d);
|
|
2795
2795
|
m && s.push(m);
|
|
2796
|
-
} else if (
|
|
2796
|
+
} else if (Yn.has(u))
|
|
2797
2797
|
typeof d == "number" && ((n ??= {})[u] = d);
|
|
2798
|
-
else if (
|
|
2798
|
+
else if (Xn.has(u))
|
|
2799
2799
|
typeof d == "number" && ((r ??= {})[u] = d);
|
|
2800
|
-
else if (
|
|
2800
|
+
else if (Ln.has(u))
|
|
2801
2801
|
(o ??= {})[u] = d;
|
|
2802
2802
|
else if (u !== "perspective") {
|
|
2803
2803
|
if (u !== "shine") if (u === "text" && typeof d == "string")
|
|
2804
|
-
|
|
2804
|
+
Bn(t, d);
|
|
2805
2805
|
else if (u === "d" && typeof d == "string") {
|
|
2806
2806
|
const m = t;
|
|
2807
2807
|
(m.tagName?.toLowerCase() === "path" ? m : m.querySelector?.("path"))?.setAttribute?.("d", d);
|
|
@@ -2812,7 +2812,7 @@ class K {
|
|
|
2812
2812
|
const h = e.get("shine");
|
|
2813
2813
|
typeof h == "number" && this.applyShine(t, h);
|
|
2814
2814
|
const f = e.get("perspective");
|
|
2815
|
-
if (typeof f == "number" && s.unshift(`perspective(${f}px)`), s.length > 0 && (t.style.transform = s.join(" "),
|
|
2815
|
+
if (typeof f == "number" && s.unshift(`perspective(${f}px)`), s.length > 0 && (t.style.transform = s.join(" "), Nn(t)), n) {
|
|
2816
2816
|
const u = n.originX ?? 50, d = n.originY ?? 50;
|
|
2817
2817
|
t.style.transformOrigin = `${u}% ${d}%`;
|
|
2818
2818
|
}
|
|
@@ -2821,7 +2821,7 @@ class K {
|
|
|
2821
2821
|
t.style.clipPath = `inset(${u}% ${d}% ${m}% ${p}%)`;
|
|
2822
2822
|
}
|
|
2823
2823
|
if (o) {
|
|
2824
|
-
const u =
|
|
2824
|
+
const u = On(o);
|
|
2825
2825
|
u && (t.style.filter = u);
|
|
2826
2826
|
}
|
|
2827
2827
|
}
|
|
@@ -2881,23 +2881,25 @@ class K {
|
|
|
2881
2881
|
*/
|
|
2882
2882
|
applyStyleProperty(t, e, s) {
|
|
2883
2883
|
let n;
|
|
2884
|
-
if (t.namespaceURI ===
|
|
2884
|
+
if (t.namespaceURI === Wn && e in Ye) {
|
|
2885
2885
|
const a = Array.isArray(s) ? s.join(", ") : String(s);
|
|
2886
|
-
t.style[
|
|
2886
|
+
t.style[Ye[e]] = a;
|
|
2887
2887
|
return;
|
|
2888
|
-
} else e === "fill" && t.dataset?.elementType === "text" ? n = "color" : n =
|
|
2888
|
+
} else e === "fill" && t.dataset?.elementType === "text" ? n = "color" : n = Vn[e] ?? e;
|
|
2889
2889
|
let o;
|
|
2890
|
-
typeof s == "number" ?
|
|
2890
|
+
typeof s == "number" ? qe.has(e) || qe.has(n) ? o = `${s}px` : o = String(s) : Array.isArray(s) ? o = s.join(", ") : o = s, t.style[n] = o;
|
|
2891
2891
|
}
|
|
2892
2892
|
}
|
|
2893
|
-
const
|
|
2893
|
+
const jn = {
|
|
2894
2894
|
request: (i) => requestAnimationFrame(i),
|
|
2895
2895
|
cancel: (i) => cancelAnimationFrame(i)
|
|
2896
2896
|
};
|
|
2897
|
-
class
|
|
2897
|
+
class Un {
|
|
2898
2898
|
adapter = new K();
|
|
2899
2899
|
scheduler;
|
|
2900
2900
|
rootOption;
|
|
2901
|
+
/** Where live timelines on this stage report warnings, unless they have their own `onWarning` */
|
|
2902
|
+
onWarning;
|
|
2901
2903
|
/** Element → engine target name. The engine only ever sees names. */
|
|
2902
2904
|
names = /* @__PURE__ */ new WeakMap();
|
|
2903
2905
|
elements = /* @__PURE__ */ new Map();
|
|
@@ -2917,7 +2919,7 @@ class Vn {
|
|
|
2917
2919
|
*/
|
|
2918
2920
|
liveTimelines = /* @__PURE__ */ new Set();
|
|
2919
2921
|
/** GSAP-style utilities, with this stage's seeded random sequence (`live.utils`). */
|
|
2920
|
-
utils =
|
|
2922
|
+
utils = pn();
|
|
2921
2923
|
/** Playing timelines, in activation order. */
|
|
2922
2924
|
active = /* @__PURE__ */ new Map();
|
|
2923
2925
|
/** Last applied value per target name and property. */
|
|
@@ -2928,7 +2930,7 @@ class Vn {
|
|
|
2928
2930
|
lastTimestamp = null;
|
|
2929
2931
|
destroyed = !1;
|
|
2930
2932
|
constructor(t = {}) {
|
|
2931
|
-
this.scheduler = t.scheduler ??
|
|
2933
|
+
this.scheduler = t.scheduler ?? jn, this.rootOption = t.root, this.onWarning = t.onWarning;
|
|
2932
2934
|
}
|
|
2933
2935
|
// --- targets ------------------------------------------------------------
|
|
2934
2936
|
/**
|
|
@@ -3125,7 +3127,7 @@ class Vn {
|
|
|
3125
3127
|
if (typeof t == "string")
|
|
3126
3128
|
return Array.from(this.selectorRoot.querySelectorAll(t));
|
|
3127
3129
|
if (Zt(t)) return [t];
|
|
3128
|
-
if (!
|
|
3130
|
+
if (!zn(t)) return [t];
|
|
3129
3131
|
const e = [];
|
|
3130
3132
|
for (const s of Array.from(t))
|
|
3131
3133
|
e.push(...this.targetsOf(s));
|
|
@@ -3157,12 +3159,12 @@ class Vn {
|
|
|
3157
3159
|
function Zt(i) {
|
|
3158
3160
|
return typeof i == "object" && i !== null && i.nodeType === 1;
|
|
3159
3161
|
}
|
|
3160
|
-
function
|
|
3162
|
+
function zn(i) {
|
|
3161
3163
|
if (Array.isArray(i)) return !0;
|
|
3162
3164
|
const t = i;
|
|
3163
3165
|
return typeof t.length == "number" && typeof t.item == "function";
|
|
3164
3166
|
}
|
|
3165
|
-
function
|
|
3167
|
+
function Lt(i) {
|
|
3166
3168
|
const t = i.style;
|
|
3167
3169
|
if (!t) return i.getBoundingClientRect();
|
|
3168
3170
|
const e = t.transform;
|
|
@@ -3171,28 +3173,28 @@ function Ft(i) {
|
|
|
3171
3173
|
return t.transform = e, s;
|
|
3172
3174
|
}
|
|
3173
3175
|
const Xe = (i) => typeof i == "object" && i !== null && i.nodeType === 1;
|
|
3174
|
-
function
|
|
3176
|
+
function Hn(i) {
|
|
3175
3177
|
const t = {};
|
|
3176
3178
|
for (const e of Array.from(i.attributes)) t[e.name] = e.value;
|
|
3177
3179
|
return t;
|
|
3178
3180
|
}
|
|
3179
|
-
function
|
|
3181
|
+
function Gn(i) {
|
|
3180
3182
|
const t = i.getScreenCTM?.();
|
|
3181
3183
|
if (t) return [t.a, t.b, t.c, t.d, t.e, t.f];
|
|
3182
3184
|
const e = i.getBoundingClientRect();
|
|
3183
3185
|
return [1, 0, 0, 1, e.left, e.top];
|
|
3184
3186
|
}
|
|
3185
|
-
function
|
|
3187
|
+
function Kn(i, t) {
|
|
3186
3188
|
const e = typeof i == "string" || Array.isArray(i) || Xe(i) ? { path: i } : i, { align: s, alignOrigin: n, path: r, ...o } = e, a = (x) => {
|
|
3187
|
-
const
|
|
3188
|
-
return
|
|
3189
|
+
const M = Xe(x) ? x : t.query(x);
|
|
3190
|
+
return M || t.warn(`gsap-compat: motionPath could not find "${String(x)}"`), M;
|
|
3189
3191
|
};
|
|
3190
3192
|
let c = null, l = "";
|
|
3191
|
-
if (Array.isArray(r) || typeof r == "string" &&
|
|
3193
|
+
if (Array.isArray(r) || typeof r == "string" && wt(r))
|
|
3192
3194
|
l = r;
|
|
3193
3195
|
else {
|
|
3194
3196
|
c = a(r);
|
|
3195
|
-
const x = c &&
|
|
3197
|
+
const x = c && me({ tag: c.localName, attributes: Hn(c) });
|
|
3196
3198
|
c && !x && t.warn(`gsap-compat: motionPath element <${c.localName}> has no path geometry`), l = x ?? "";
|
|
3197
3199
|
}
|
|
3198
3200
|
const h = { ...o, path: l };
|
|
@@ -3202,47 +3204,47 @@ function zn(i, t) {
|
|
|
3202
3204
|
return s === !0 && t.warn("gsap-compat: motionPath align: true needs the path to be an element"), h;
|
|
3203
3205
|
const u = t.targets[0];
|
|
3204
3206
|
if (!u) return h;
|
|
3205
|
-
const [d, m, p, g, y, b] =
|
|
3207
|
+
const [d, m, p, g, y, b] = Gn(f), v = Lt(u), [T, w] = n ?? [0.5, 0.5];
|
|
3206
3208
|
for (const x of t.targets.slice(1)) {
|
|
3207
|
-
const
|
|
3208
|
-
if (Math.abs(
|
|
3209
|
+
const M = Lt(x);
|
|
3210
|
+
if (Math.abs(M.left - v.left) > 0.5 || Math.abs(M.top - v.top) > 0.5) {
|
|
3209
3211
|
t.warn("gsap-compat: motionPath align measures the first target; the others are laid out elsewhere");
|
|
3210
3212
|
break;
|
|
3211
3213
|
}
|
|
3212
3214
|
}
|
|
3213
3215
|
return h.matrix = [d, m, p, g, y - v.left - T * v.width, b - v.top - w * v.height], h;
|
|
3214
3216
|
}
|
|
3215
|
-
const
|
|
3216
|
-
function
|
|
3217
|
+
const Fi = (i) => typeof i == "object" && i !== null && i.nodeType === 1;
|
|
3218
|
+
function Di(i) {
|
|
3217
3219
|
const t = {};
|
|
3218
3220
|
for (const e of Array.from(i.attributes)) t[e.name] = e.value;
|
|
3219
3221
|
return t;
|
|
3220
3222
|
}
|
|
3221
|
-
function
|
|
3223
|
+
function Oi(i) {
|
|
3222
3224
|
if (!i) return null;
|
|
3223
|
-
const t =
|
|
3225
|
+
const t = me({ tag: i.localName, attributes: Di(i) });
|
|
3224
3226
|
return t || (i.querySelector("path")?.getAttribute("d") ?? null);
|
|
3225
3227
|
}
|
|
3226
|
-
function
|
|
3227
|
-
const s =
|
|
3228
|
-
if (typeof s == "string" &&
|
|
3229
|
-
const n =
|
|
3228
|
+
function Zn(i, t, e) {
|
|
3229
|
+
const s = Li(i);
|
|
3230
|
+
if (typeof s == "string" && wt(s)) return s;
|
|
3231
|
+
const n = Fi(s) ? s : typeof s == "string" ? t(s) : null, r = Oi(n);
|
|
3230
3232
|
return r || (e(`gsap-compat: morphSVG could not find a shape for "${String(s)}"`), "");
|
|
3231
3233
|
}
|
|
3232
|
-
const
|
|
3233
|
-
function
|
|
3234
|
-
return (typeof i == "string" ? Array.from(t.querySelectorAll(i)) :
|
|
3234
|
+
const Qn = /* @__PURE__ */ new Set(["cx", "cy", "r", "rx", "ry", "x", "y", "width", "height", "x1", "y1", "x2", "y2", "points"]);
|
|
3235
|
+
function Jn(i, t = document) {
|
|
3236
|
+
return (typeof i == "string" ? Array.from(t.querySelectorAll(i)) : Fi(i) ? [i] : Array.from(i)).map((s) => {
|
|
3235
3237
|
if (s.localName === "path") return s;
|
|
3236
|
-
const n =
|
|
3238
|
+
const n = me({ tag: s.localName, attributes: Di(s) });
|
|
3237
3239
|
if (!n || !s.parentNode) return s;
|
|
3238
3240
|
const r = s.ownerDocument.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
3239
3241
|
for (const o of Array.from(s.attributes))
|
|
3240
|
-
|
|
3242
|
+
Qn.has(o.name) || r.setAttribute(o.name, o.value);
|
|
3241
3243
|
return r.setAttribute("d", n), s.parentNode.replaceChild(r, s), r;
|
|
3242
3244
|
});
|
|
3243
3245
|
}
|
|
3244
|
-
const
|
|
3245
|
-
class
|
|
3246
|
+
const Ve = 0.3;
|
|
3247
|
+
class tr {
|
|
3246
3248
|
options;
|
|
3247
3249
|
target;
|
|
3248
3250
|
running = !1;
|
|
@@ -3276,7 +3278,7 @@ class Zn {
|
|
|
3276
3278
|
}
|
|
3277
3279
|
// --- gesture lifecycle --------------------------------------------------
|
|
3278
3280
|
begin(t, e, s) {
|
|
3279
|
-
this.dragging = !0, this.passedTolerance = !1, this.startX = t, this.startY = e, this.lastX = t, this.lastY = e, this.velocityX = 0, this.velocityY = 0, this.lastTime =
|
|
3281
|
+
this.dragging = !0, this.passedTolerance = !1, this.startX = t, this.startY = e, this.lastX = t, this.lastY = e, this.velocityX = 0, this.velocityY = 0, this.lastTime = We(), this.options.onPress?.(this.stateFrom(0, 0, s));
|
|
3280
3282
|
}
|
|
3281
3283
|
move(t, e, s) {
|
|
3282
3284
|
if (!this.dragging) return;
|
|
@@ -3293,10 +3295,10 @@ class Zn {
|
|
|
3293
3295
|
this.dragging && (this.dragging = !1, this.options.onRelease?.(this.stateFrom(0, 0, t)));
|
|
3294
3296
|
}
|
|
3295
3297
|
updateVelocity(t, e) {
|
|
3296
|
-
const s =
|
|
3298
|
+
const s = We(), n = Math.max(1, s - this.lastTime);
|
|
3297
3299
|
this.lastTime = s;
|
|
3298
3300
|
const r = t / n * 1e3, o = e / n * 1e3;
|
|
3299
|
-
this.velocityX += (r - this.velocityX) *
|
|
3301
|
+
this.velocityX += (r - this.velocityX) * Ve, this.velocityY += (o - this.velocityY) * Ve;
|
|
3300
3302
|
}
|
|
3301
3303
|
stateFrom(t, e, s) {
|
|
3302
3304
|
return {
|
|
@@ -3348,10 +3350,10 @@ class Zn {
|
|
|
3348
3350
|
});
|
|
3349
3351
|
};
|
|
3350
3352
|
}
|
|
3351
|
-
function
|
|
3353
|
+
function We() {
|
|
3352
3354
|
return typeof performance < "u" ? performance.now() : Date.now();
|
|
3353
3355
|
}
|
|
3354
|
-
function
|
|
3356
|
+
function er(i, t, e) {
|
|
3355
3357
|
let s = { delta: 0, line: null }, n = e;
|
|
3356
3358
|
for (const r of i)
|
|
3357
3359
|
for (const o of t) {
|
|
@@ -3360,10 +3362,10 @@ function Qn(i, t, e) {
|
|
|
3360
3362
|
}
|
|
3361
3363
|
return s;
|
|
3362
3364
|
}
|
|
3363
|
-
function
|
|
3365
|
+
function ir(i, t) {
|
|
3364
3366
|
return t <= 0 ? [] : i.map((e) => Math.round(e / t) * t);
|
|
3365
3367
|
}
|
|
3366
|
-
class
|
|
3368
|
+
class Bi {
|
|
3367
3369
|
options;
|
|
3368
3370
|
observer;
|
|
3369
3371
|
x;
|
|
@@ -3375,7 +3377,7 @@ class Di {
|
|
|
3375
3377
|
snappedX = null;
|
|
3376
3378
|
snappedY = null;
|
|
3377
3379
|
constructor(t) {
|
|
3378
|
-
this.options = t, this.x = t.initialX ?? 0, this.y = t.initialY ?? 0, this.observer = new
|
|
3380
|
+
this.options = t, this.x = t.initialX ?? 0, this.y = t.initialY ?? 0, this.observer = new tr({
|
|
3379
3381
|
target: t.target,
|
|
3380
3382
|
onPress: (e) => {
|
|
3381
3383
|
const s = t.getPosition?.();
|
|
@@ -3428,7 +3430,7 @@ class Di {
|
|
|
3428
3430
|
if (e <= 0) return;
|
|
3429
3431
|
const s = this.options.scrubDistance ?? 500;
|
|
3430
3432
|
if (s === 0) return;
|
|
3431
|
-
const n = (this.options.axis ?? "both") === "y" ? this.y : this.x, r =
|
|
3433
|
+
const n = (this.options.axis ?? "both") === "y" ? this.y : this.x, r = sr(n / s);
|
|
3432
3434
|
t.pause(), t.seek(r * e);
|
|
3433
3435
|
}
|
|
3434
3436
|
/**
|
|
@@ -3441,9 +3443,9 @@ class Di {
|
|
|
3441
3443
|
applyConstraints(t, e) {
|
|
3442
3444
|
let s = t;
|
|
3443
3445
|
const n = [
|
|
3444
|
-
...
|
|
3446
|
+
...ir([s], this.options.snap ?? 0),
|
|
3445
3447
|
...(e === "x" ? this.options.snapLinesX : this.options.snapLinesY) ?? []
|
|
3446
|
-
], r =
|
|
3448
|
+
], r = er([s], n, this.snapThreshold());
|
|
3447
3449
|
s += r.delta, e === "x" ? this.snappedX = r.line : this.snappedY = r.line;
|
|
3448
3450
|
const o = this.options.bounds;
|
|
3449
3451
|
if (o) {
|
|
@@ -3453,16 +3455,16 @@ class Di {
|
|
|
3453
3455
|
return s;
|
|
3454
3456
|
}
|
|
3455
3457
|
}
|
|
3456
|
-
function
|
|
3458
|
+
function sr(i) {
|
|
3457
3459
|
return i < 0 ? 0 : i > 1 ? 1 : i;
|
|
3458
3460
|
}
|
|
3459
|
-
function
|
|
3460
|
-
const t = new
|
|
3461
|
+
function Oo(i) {
|
|
3462
|
+
const t = new Bi(i);
|
|
3461
3463
|
return t.start(), t;
|
|
3462
3464
|
}
|
|
3463
|
-
const
|
|
3464
|
-
function
|
|
3465
|
-
const e =
|
|
3465
|
+
const nr = { x: "x", y: "y", "x,y": "both" }, le = (i) => typeof i == "object" && i !== null && i.nodeType === 1;
|
|
3466
|
+
function je(i, t) {
|
|
3467
|
+
const e = Lt(i), s = t.getBoundingClientRect();
|
|
3466
3468
|
return {
|
|
3467
3469
|
minX: s.left - e.left,
|
|
3468
3470
|
maxX: s.right - e.right,
|
|
@@ -3470,35 +3472,35 @@ function We(i, t) {
|
|
|
3470
3472
|
maxY: s.bottom - e.bottom
|
|
3471
3473
|
};
|
|
3472
3474
|
}
|
|
3473
|
-
function
|
|
3475
|
+
function Ue(i) {
|
|
3474
3476
|
return Array.isArray(i) ? [...i] : i;
|
|
3475
3477
|
}
|
|
3476
|
-
function
|
|
3478
|
+
function rr(i, t, e, s = {}) {
|
|
3477
3479
|
const [n] = t.resolveTargets(e), r = n ? t.elementFor(n) : void 0;
|
|
3478
3480
|
if (!n || !r)
|
|
3479
3481
|
throw new Error(`gsap-compat: live.draggable could not find ${String(e)}`);
|
|
3480
|
-
if (s.type === "rotation") return
|
|
3481
|
-
const o =
|
|
3482
|
+
if (s.type === "rotation") return or(i, t, n, r, s);
|
|
3483
|
+
const o = nr[s.type ?? "x,y"], a = () => {
|
|
3482
3484
|
const p = t.appliedValue(n, "x"), g = t.appliedValue(n, "y");
|
|
3483
3485
|
return { x: typeof p == "number" ? p : 0, y: typeof g == "number" ? g : 0 };
|
|
3484
|
-
}, c = typeof s.bounds == "string" ? t.query(s.bounds) : le(s.bounds) ? s.bounds : null, h = { bounds: (!c && s.bounds && !le(s.bounds) ? s.bounds : void 0) ?? (c ?
|
|
3486
|
+
}, c = typeof s.bounds == "string" ? t.query(s.bounds) : le(s.bounds) ? s.bounds : null, h = { bounds: (!c && s.bounds && !le(s.bounds) ? s.bounds : void 0) ?? (c ? je(r, c) : void 0) };
|
|
3485
3487
|
let f = null;
|
|
3486
3488
|
const u = () => {
|
|
3487
3489
|
f?.kill(), f = null;
|
|
3488
3490
|
}, d = (p) => {
|
|
3489
|
-
const g = s.inertia === !0 ? {} : s.inertia, y = g.friction ?? (g.resistance !== void 0 ?
|
|
3491
|
+
const g = s.inertia === !0 ? {} : s.inertia, y = g.friction ?? (g.resistance !== void 0 ? be(g.resistance) : 4), b = a(), v = h.bounds ?? {};
|
|
3490
3492
|
let T, w;
|
|
3491
3493
|
const x = g.end;
|
|
3492
3494
|
if (Array.isArray(x)) {
|
|
3493
|
-
const
|
|
3495
|
+
const C = _t({ from: b.x, velocity: o === "y" ? 0 : p.x, friction: y }), D = _t({ from: b.y, velocity: o === "x" ? 0 : p.y, friction: y });
|
|
3494
3496
|
let A = x[0];
|
|
3495
|
-
for (const
|
|
3496
|
-
Math.hypot(
|
|
3497
|
+
for (const k of x)
|
|
3498
|
+
Math.hypot(k.x - C, k.y - D) < Math.hypot(A.x - C, A.y - D) && (A = k);
|
|
3497
3499
|
A && (T = [A.x], w = [A.y]);
|
|
3498
|
-
} else typeof x == "number" ? (T = x, w = x) : x && (T =
|
|
3499
|
-
const
|
|
3500
|
-
o !== "y" && (
|
|
3501
|
-
}, m = new
|
|
3500
|
+
} else typeof x == "number" ? (T = x, w = x) : x && (T = Ue(x.x), w = Ue(x.y));
|
|
3501
|
+
const M = {};
|
|
3502
|
+
o !== "y" && (M.x = { velocity: p.x, friction: y, min: v.minX, max: v.maxX, end: T }), o !== "x" && (M.y = { velocity: p.y, friction: y, min: v.minY, max: v.maxY, end: w }), f = i.to(r, { inertia: M, onComplete: () => s.onThrowComplete?.() });
|
|
3503
|
+
}, m = new Bi({
|
|
3502
3504
|
target: r,
|
|
3503
3505
|
axis: o,
|
|
3504
3506
|
snap: s.snap,
|
|
@@ -3507,7 +3509,7 @@ function ir(i, t, e, s = {}) {
|
|
|
3507
3509
|
},
|
|
3508
3510
|
getPosition: a,
|
|
3509
3511
|
onPress: () => {
|
|
3510
|
-
u(), c && (h.bounds =
|
|
3512
|
+
u(), c && (h.bounds = je(r, c)), s.onPress?.();
|
|
3511
3513
|
},
|
|
3512
3514
|
onDrag: (p) => {
|
|
3513
3515
|
t.apply(n, o === "x" ? { x: p.x } : o === "y" ? { y: p.y } : { x: p.x, y: p.y }), s.onDrag?.(p);
|
|
@@ -3531,7 +3533,7 @@ function ir(i, t, e, s = {}) {
|
|
|
3531
3533
|
}
|
|
3532
3534
|
};
|
|
3533
3535
|
}
|
|
3534
|
-
function
|
|
3536
|
+
function or(i, t, e, s, n) {
|
|
3535
3537
|
const r = typeof n.bounds == "object" && n.bounds !== null && !le(n.bounds) ? n.bounds : {}, o = () => {
|
|
3536
3538
|
const v = t.appliedValue(e, "rotate");
|
|
3537
3539
|
return typeof v == "number" ? v : 0;
|
|
@@ -3549,24 +3551,24 @@ function sr(i, t, e, s, n) {
|
|
|
3549
3551
|
w > 180 && (w -= 360), w < -180 && (w += 360), u = T, d += w;
|
|
3550
3552
|
let x = a(d);
|
|
3551
3553
|
n.snap && (x = a(Math.round(x / n.snap) * n.snap)), t.apply(e, { rotate: x });
|
|
3552
|
-
const
|
|
3553
|
-
for (m.push({ time:
|
|
3554
|
-
const
|
|
3555
|
-
n.onDrag?.(
|
|
3554
|
+
const M = performance.now();
|
|
3555
|
+
for (m.push({ time: M, rotation: x }); m.length > 2 && M - m[0].time > 100; ) m.shift();
|
|
3556
|
+
const C = { x: 0, y: 0 };
|
|
3557
|
+
n.onDrag?.(C);
|
|
3556
3558
|
}, b = (v) => {
|
|
3557
3559
|
if (!l || v.pointerId !== h) return;
|
|
3558
3560
|
l = !1;
|
|
3559
|
-
const T = m[0], w = m[m.length - 1], x = T && w ? (w.time - T.time) / 1e3 : 0,
|
|
3560
|
-
if (n.onRelease?.({ x:
|
|
3561
|
-
const
|
|
3561
|
+
const T = m[0], w = m[m.length - 1], x = T && w ? (w.time - T.time) / 1e3 : 0, M = x > 0 ? (w.rotation - T.rotation) / x : 0;
|
|
3562
|
+
if (n.onRelease?.({ x: M, y: 0 }), !n.inertia) return;
|
|
3563
|
+
const C = n.inertia === !0 ? {} : n.inertia, D = C.friction ?? (C.resistance !== void 0 ? be(C.resistance) : 4), A = typeof C.end == "number" || Array.isArray(C.end) ? C.end : void 0;
|
|
3562
3564
|
c = i.to(s, {
|
|
3563
3565
|
inertia: {
|
|
3564
3566
|
rotate: {
|
|
3565
|
-
velocity:
|
|
3566
|
-
friction:
|
|
3567
|
+
velocity: M,
|
|
3568
|
+
friction: D,
|
|
3567
3569
|
min: r.minRotation,
|
|
3568
3570
|
max: r.maxRotation,
|
|
3569
|
-
end: Array.isArray(A) ? A.filter((
|
|
3571
|
+
end: Array.isArray(A) ? A.filter((k) => typeof k == "number") : A
|
|
3570
3572
|
}
|
|
3571
3573
|
},
|
|
3572
3574
|
onComplete: () => n.onThrowComplete?.()
|
|
@@ -3583,28 +3585,28 @@ function sr(i, t, e, s, n) {
|
|
|
3583
3585
|
}
|
|
3584
3586
|
};
|
|
3585
3587
|
}
|
|
3586
|
-
const
|
|
3587
|
-
function
|
|
3588
|
+
const ar = { opacity: 0, scale: 0.6 };
|
|
3589
|
+
function cr(i) {
|
|
3588
3590
|
const t = i.getBoundingClientRect();
|
|
3589
3591
|
return t.width === 0 && t.height === 0 ? null : { cx: t.left + t.width / 2, cy: t.top + t.height / 2, width: t.width, height: t.height };
|
|
3590
3592
|
}
|
|
3591
|
-
function
|
|
3592
|
-
const t =
|
|
3593
|
+
function ze(i) {
|
|
3594
|
+
const t = Lt(i);
|
|
3593
3595
|
return t.width === 0 && t.height === 0 ? null : { cx: t.left + t.width / 2, cy: t.top + t.height / 2, width: t.width, height: t.height };
|
|
3594
3596
|
}
|
|
3595
3597
|
function he(i, t) {
|
|
3596
3598
|
const s = i.resolveTargets(t).map((o) => i.elementFor(o)).filter((o) => !!o), n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
3597
3599
|
for (const o of s) {
|
|
3598
|
-
const a =
|
|
3600
|
+
const a = cr(o);
|
|
3599
3601
|
n.set(o, a);
|
|
3600
|
-
const c =
|
|
3602
|
+
const c = Ni(o);
|
|
3601
3603
|
a && c !== void 0 && !r.has(c) && r.set(c, { element: o, box: a });
|
|
3602
3604
|
}
|
|
3603
3605
|
return { elements: s, boxes: n, ids: r };
|
|
3604
3606
|
}
|
|
3605
3607
|
const Qt = /* @__PURE__ */ new WeakMap();
|
|
3606
3608
|
function ue(i, t, e, s = {}) {
|
|
3607
|
-
const n = s.duration ?? 0.6, r = s.ease ?? "power2.inOut", o = s.stagger ?? 0, a = s.scale !== !1, c = s.enter === void 0 ?
|
|
3609
|
+
const n = s.duration ?? 0.6, r = s.ease ?? "power2.inOut", o = s.stagger ?? 0, a = s.scale !== !1, c = s.enter === void 0 ? ar : s.enter, l = new Set(e.elements);
|
|
3608
3610
|
if (s.targets !== void 0)
|
|
3609
3611
|
for (const d of i.resolveTargets(s.targets)) {
|
|
3610
3612
|
const m = i.elementFor(d);
|
|
@@ -3615,48 +3617,48 @@ function ue(i, t, e, s = {}) {
|
|
|
3615
3617
|
), f = t({ onComplete: s.onComplete });
|
|
3616
3618
|
let u = 0;
|
|
3617
3619
|
for (const d of h) {
|
|
3618
|
-
const m =
|
|
3620
|
+
const m = ze(d);
|
|
3619
3621
|
if (!m) continue;
|
|
3620
3622
|
let p = e.boxes.get(d) ?? null, g;
|
|
3621
|
-
const y =
|
|
3623
|
+
const y = Ni(d), b = !p && y !== void 0 ? e.ids.get(y) : void 0;
|
|
3622
3624
|
b && b.element !== d && (p = b.box, g = b.element);
|
|
3623
3625
|
const [v] = i.resolveTargets(d);
|
|
3624
3626
|
Qt.get(d)?.timeline.removeTracks({ target: v });
|
|
3625
3627
|
const T = u * o;
|
|
3626
3628
|
if (!p) {
|
|
3627
3629
|
if (c === !1) continue;
|
|
3628
|
-
f.fromTo(d, { x: 0, y: 0, scaleX: 1, scaleY: 1, ...c }, { ...
|
|
3630
|
+
f.fromTo(d, { x: 0, y: 0, scaleX: 1, scaleY: 1, ...c }, { ...qi(c), x: 0, y: 0, scaleX: 1, scaleY: 1, duration: n, ease: r, delay: T }, 0), Qt.set(d, f), u++;
|
|
3629
3631
|
continue;
|
|
3630
3632
|
}
|
|
3631
|
-
const w = p.cx - m.cx, x = p.cy - m.cy,
|
|
3632
|
-
if (!(Math.abs(w) > 0.5 || Math.abs(x) > 0.5 || Math.abs(
|
|
3633
|
-
const
|
|
3634
|
-
const
|
|
3635
|
-
return typeof
|
|
3633
|
+
const w = p.cx - m.cx, x = p.cy - m.cy, M = a ? p.width / m.width : 1, C = a ? p.height / m.height : 1;
|
|
3634
|
+
if (!(Math.abs(w) > 0.5 || Math.abs(x) > 0.5 || Math.abs(M - 1) > 1e-3 || Math.abs(C - 1) > 1e-3)) {
|
|
3635
|
+
const k = (E, P) => {
|
|
3636
|
+
const S = i.appliedValue(v, E);
|
|
3637
|
+
return typeof S == "number" && Math.abs(S - P) > 1e-6;
|
|
3636
3638
|
};
|
|
3637
|
-
(
|
|
3639
|
+
(k("x", 0) || k("y", 0) || k("scaleX", 1) || k("scaleY", 1)) && f.set(d, { x: 0, y: 0, scaleX: 1, scaleY: 1 }, 0);
|
|
3638
3640
|
continue;
|
|
3639
3641
|
}
|
|
3640
3642
|
const A = s.fade === !0 && g !== void 0;
|
|
3641
3643
|
f.fromTo(
|
|
3642
3644
|
d,
|
|
3643
|
-
{ x: w, y: x, scaleX:
|
|
3645
|
+
{ x: w, y: x, scaleX: M, scaleY: C, ...A && { opacity: 0 } },
|
|
3644
3646
|
{ x: 0, y: 0, scaleX: 1, scaleY: 1, ...A && { opacity: 1 }, duration: n, ease: r, delay: T },
|
|
3645
3647
|
0
|
|
3646
|
-
), A && g &&
|
|
3648
|
+
), A && g && ze(g) && f.fromTo(g, { opacity: 1 }, { opacity: 0, duration: n, ease: r, delay: T }, 0), Qt.set(d, f), u++;
|
|
3647
3649
|
}
|
|
3648
3650
|
return f;
|
|
3649
3651
|
}
|
|
3650
|
-
function
|
|
3652
|
+
function Ni(i) {
|
|
3651
3653
|
return i.dataset?.flipId;
|
|
3652
3654
|
}
|
|
3653
|
-
function
|
|
3655
|
+
function qi(i) {
|
|
3654
3656
|
const t = {};
|
|
3655
3657
|
for (const e of Object.keys(i))
|
|
3656
3658
|
t[e] = e === "opacity" || e.startsWith("scale") ? 1 : 0;
|
|
3657
3659
|
return t;
|
|
3658
3660
|
}
|
|
3659
|
-
function
|
|
3661
|
+
function lr(i, t = {}) {
|
|
3660
3662
|
const e = new Set((t.type ?? "chars,words,lines").split(",").map((p) => p.trim())), s = {
|
|
3661
3663
|
chars: t.charsClass ?? "char",
|
|
3662
3664
|
words: t.wordsClass ?? "word",
|
|
@@ -3675,7 +3677,7 @@ function or(i, t = {}) {
|
|
|
3675
3677
|
}, u = () => {
|
|
3676
3678
|
const p = { chars: [], words: [], lines: [], masks: [] };
|
|
3677
3679
|
for (const { element: g } of r) {
|
|
3678
|
-
const y = (g.textContent ?? "").replace(/\s+/g, " ").trim(), b =
|
|
3680
|
+
const y = (g.textContent ?? "").replace(/\s+/g, " ").trim(), b = hr(g, s.words), v = e.has("chars") ? b.flatMap((x) => ur(x, s.chars)) : [], T = e.has("lines") ? dr(g, b, s.lines) : [];
|
|
3679
3681
|
if (n) {
|
|
3680
3682
|
!g.hasAttribute("aria-label") && y && g.setAttribute("aria-label", y);
|
|
3681
3683
|
for (const x of b) x.setAttribute("aria-hidden", "true");
|
|
@@ -3684,7 +3686,7 @@ function or(i, t = {}) {
|
|
|
3684
3686
|
else for (const x of b) x.removeAttribute("class");
|
|
3685
3687
|
p.chars.push(...v), p.lines.push(...T);
|
|
3686
3688
|
const w = t.mask === "lines" ? T : t.mask === "words" ? b : t.mask === "chars" ? v : [];
|
|
3687
|
-
for (const x of w) p.masks.push(
|
|
3689
|
+
for (const x of w) p.masks.push(pr(x, `${s[t.mask]}-mask`));
|
|
3688
3690
|
}
|
|
3689
3691
|
o = p;
|
|
3690
3692
|
}, d = {
|
|
@@ -3724,8 +3726,8 @@ function or(i, t = {}) {
|
|
|
3724
3726
|
c = new ResizeObserver((v) => {
|
|
3725
3727
|
let T = !1;
|
|
3726
3728
|
for (const w of v) {
|
|
3727
|
-
const x = Math.round(w.contentRect.width),
|
|
3728
|
-
p.set(w.target, x),
|
|
3729
|
+
const x = Math.round(w.contentRect.width), M = p.get(w.target);
|
|
3730
|
+
p.set(w.target, x), M !== void 0 && M !== x && (T = !0);
|
|
3729
3731
|
}
|
|
3730
3732
|
T && y();
|
|
3731
3733
|
});
|
|
@@ -3736,7 +3738,7 @@ function or(i, t = {}) {
|
|
|
3736
3738
|
}
|
|
3737
3739
|
return d;
|
|
3738
3740
|
}
|
|
3739
|
-
function
|
|
3741
|
+
function hr(i, t) {
|
|
3740
3742
|
const e = i.ownerDocument, s = [], n = e.createTreeWalker(
|
|
3741
3743
|
i,
|
|
3742
3744
|
4
|
|
@@ -3759,18 +3761,18 @@ function ar(i, t) {
|
|
|
3759
3761
|
}
|
|
3760
3762
|
return s;
|
|
3761
3763
|
}
|
|
3762
|
-
function
|
|
3763
|
-
const e = i.ownerDocument, s =
|
|
3764
|
+
function ur(i, t) {
|
|
3765
|
+
const e = i.ownerDocument, s = fr(i.textContent ?? "").map((n) => {
|
|
3764
3766
|
const r = e.createElement("span");
|
|
3765
3767
|
return r.className = t, r.style.display = "inline-block", r.textContent = n, r;
|
|
3766
3768
|
});
|
|
3767
3769
|
return i.replaceChildren(...s), s;
|
|
3768
3770
|
}
|
|
3769
|
-
function
|
|
3771
|
+
function fr(i) {
|
|
3770
3772
|
const t = Intl.Segmenter;
|
|
3771
3773
|
return t ? Array.from(new t(void 0, { granularity: "grapheme" }).segment(i), (e) => e.segment) : Array.from(i);
|
|
3772
3774
|
}
|
|
3773
|
-
function
|
|
3775
|
+
function dr(i, t, e) {
|
|
3774
3776
|
const s = i.ownerDocument, n = new Map(t.map((m) => [m, m.getBoundingClientRect()])), r = [], o = (m) => {
|
|
3775
3777
|
for (const p of Array.from(m.childNodes))
|
|
3776
3778
|
p.nodeType === 3 || n.has(p) || p.tagName === "BR" ? r.push(p) : o(p);
|
|
@@ -3802,11 +3804,11 @@ function hr(i, t, e) {
|
|
|
3802
3804
|
}
|
|
3803
3805
|
return i.replaceChildren(...a), a;
|
|
3804
3806
|
}
|
|
3805
|
-
function
|
|
3807
|
+
function pr(i, t) {
|
|
3806
3808
|
const e = i.ownerDocument.createElement("span");
|
|
3807
3809
|
return e.className = t, e.style.display = i.style.display === "block" ? "block" : "inline-block", e.style.overflow = "clip", e.style.paddingBottom = "0.12em", e.style.marginBottom = "-0.12em", i.replaceWith(e), e.appendChild(i), e;
|
|
3808
3810
|
}
|
|
3809
|
-
const
|
|
3811
|
+
const He = {
|
|
3810
3812
|
top: 0,
|
|
3811
3813
|
left: 0,
|
|
3812
3814
|
start: 0,
|
|
@@ -3817,15 +3819,15 @@ const ze = {
|
|
|
3817
3819
|
right: 1,
|
|
3818
3820
|
end: 1
|
|
3819
3821
|
};
|
|
3820
|
-
function
|
|
3822
|
+
function Ge(i) {
|
|
3821
3823
|
const t = i.trim().toLowerCase();
|
|
3822
|
-
if (t in
|
|
3824
|
+
if (t in He) return He[t];
|
|
3823
3825
|
if (t.endsWith("%")) {
|
|
3824
3826
|
const e = Number.parseFloat(t.slice(0, -1));
|
|
3825
3827
|
return Number.isNaN(e) ? void 0 : e / 100;
|
|
3826
3828
|
}
|
|
3827
3829
|
}
|
|
3828
|
-
function
|
|
3830
|
+
function Yi(i) {
|
|
3829
3831
|
if (typeof i == "number")
|
|
3830
3832
|
return { elementFraction: 0, viewportFraction: 0, offsetPx: 0, absolutePx: i };
|
|
3831
3833
|
let t = 0;
|
|
@@ -3837,31 +3839,31 @@ function Ni(i) {
|
|
|
3837
3839
|
offsetPx: 0,
|
|
3838
3840
|
absolutePx: Number.parseFloat(s[0]) + t
|
|
3839
3841
|
};
|
|
3840
|
-
const n = s[0] !== void 0 ?
|
|
3842
|
+
const n = s[0] !== void 0 ? Ge(s[0]) : void 0, r = s[1] !== void 0 ? Ge(s[1]) : void 0;
|
|
3841
3843
|
return {
|
|
3842
3844
|
elementFraction: n ?? 0,
|
|
3843
3845
|
viewportFraction: r ?? 0,
|
|
3844
3846
|
offsetPx: t
|
|
3845
3847
|
};
|
|
3846
3848
|
}
|
|
3847
|
-
function
|
|
3848
|
-
const s =
|
|
3849
|
+
function yt(i, t, e) {
|
|
3850
|
+
const s = Yi(e), n = s.absolutePx !== void 0 ? i.top + s.absolutePx : i.top + i.height * s.elementFraction, r = t * s.viewportFraction;
|
|
3849
3851
|
return n - r + s.offsetPx;
|
|
3850
3852
|
}
|
|
3851
|
-
function
|
|
3852
|
-
const n =
|
|
3853
|
-
return o <= 0 ? n <= 0 ? 1 : 0 :
|
|
3853
|
+
function Bo(i, t, e, s) {
|
|
3854
|
+
const n = yt(i, t, e), o = yt(i, t, s) - n;
|
|
3855
|
+
return o <= 0 ? n <= 0 ? 1 : 0 : Xi(-n / o);
|
|
3854
3856
|
}
|
|
3855
|
-
function
|
|
3857
|
+
function Xi(i) {
|
|
3856
3858
|
return i < 0 ? 0 : i > 1 ? 1 : i === 0 ? 0 : i;
|
|
3857
3859
|
}
|
|
3858
|
-
function
|
|
3860
|
+
function mr(i, t, e, s) {
|
|
3859
3861
|
if (e <= 0) return t;
|
|
3860
3862
|
const n = 1 - Math.exp(-(s / 1e3) / e);
|
|
3861
3863
|
return i + (t - i) * n;
|
|
3862
3864
|
}
|
|
3863
|
-
function
|
|
3864
|
-
const r = (h) =>
|
|
3865
|
+
function Ke(i, t, e, s, n) {
|
|
3866
|
+
const r = (h) => yt({ top: i + n(h), bottom: i + n(h) + t, height: t }, e, s), o = r(0), a = r(1);
|
|
3865
3867
|
if (Math.sign(o) === Math.sign(a) || o === 0 || a === 0)
|
|
3866
3868
|
return o === 0 ? 0 : a === 0 ? 1 : Math.abs(o) < Math.abs(a) ? 0 : 1;
|
|
3867
3869
|
let c = 0, l = 1;
|
|
@@ -3871,7 +3873,7 @@ function Ge(i, t, e, s, n) {
|
|
|
3871
3873
|
}
|
|
3872
3874
|
return (c + l) / 2;
|
|
3873
3875
|
}
|
|
3874
|
-
class
|
|
3876
|
+
class gr {
|
|
3875
3877
|
timeline;
|
|
3876
3878
|
trigger;
|
|
3877
3879
|
behaviour;
|
|
@@ -3918,11 +3920,11 @@ class dr {
|
|
|
3918
3920
|
this.options.onLeave?.(), this.behaviour === "reset" && this.timeline.stop();
|
|
3919
3921
|
}
|
|
3920
3922
|
}
|
|
3921
|
-
function
|
|
3922
|
-
const t = new
|
|
3923
|
+
function No(i) {
|
|
3924
|
+
const t = new gr(i);
|
|
3923
3925
|
return t.start(), t;
|
|
3924
3926
|
}
|
|
3925
|
-
class
|
|
3927
|
+
class yr {
|
|
3926
3928
|
element;
|
|
3927
3929
|
spacer;
|
|
3928
3930
|
saved;
|
|
@@ -3951,28 +3953,28 @@ class pr {
|
|
|
3951
3953
|
this.element.style.position = this.saved.position, this.element.style.top = this.saved.top, this.element.style.left = this.saved.left, this.spacer.parentNode && this.spacer.replaceWith(this.element);
|
|
3952
3954
|
}
|
|
3953
3955
|
}
|
|
3954
|
-
const
|
|
3955
|
-
function
|
|
3956
|
+
const br = 0.15;
|
|
3957
|
+
function vr(i) {
|
|
3956
3958
|
return typeof i == "object" && !Array.isArray(i) ? i : { snapTo: i };
|
|
3957
3959
|
}
|
|
3958
|
-
function
|
|
3959
|
-
const s =
|
|
3960
|
-
if (typeof e == "function") return
|
|
3960
|
+
function wr(i, t, e) {
|
|
3961
|
+
const s = Mt(i + t * br);
|
|
3962
|
+
if (typeof e == "function") return Mt(e(s));
|
|
3961
3963
|
if (typeof e == "number")
|
|
3962
|
-
return e <= 0 ? i :
|
|
3964
|
+
return e <= 0 ? i : Mt(Math.round(s / e) * e);
|
|
3963
3965
|
if (e.length === 0) return i;
|
|
3964
3966
|
let n = e[0];
|
|
3965
3967
|
for (const r of e)
|
|
3966
3968
|
Math.abs(r - s) < Math.abs(n - s) && (n = r);
|
|
3967
|
-
return
|
|
3969
|
+
return Mt(n);
|
|
3968
3970
|
}
|
|
3969
|
-
function
|
|
3971
|
+
function Tr(i, t, e) {
|
|
3970
3972
|
const s = i.duration ?? { min: 0.2, max: 0.8 };
|
|
3971
3973
|
if (typeof s == "number") return s;
|
|
3972
3974
|
const n = Math.min(1, Math.abs(t) / Math.max(1, e));
|
|
3973
3975
|
return s.min + (s.max - s.min) * n;
|
|
3974
3976
|
}
|
|
3975
|
-
class
|
|
3977
|
+
class xr {
|
|
3976
3978
|
rafId = null;
|
|
3977
3979
|
cancelEvents = ["wheel", "touchstart", "pointerdown", "keydown"];
|
|
3978
3980
|
onInterrupt = () => this.cancel();
|
|
@@ -4005,10 +4007,10 @@ class vr {
|
|
|
4005
4007
|
for (const t of this.cancelEvents) this.eventTarget?.removeEventListener(t, this.onInterrupt);
|
|
4006
4008
|
}
|
|
4007
4009
|
}
|
|
4008
|
-
function
|
|
4010
|
+
function Mt(i) {
|
|
4009
4011
|
return Math.max(0, Math.min(1, i));
|
|
4010
4012
|
}
|
|
4011
|
-
class
|
|
4013
|
+
class kr {
|
|
4012
4014
|
options;
|
|
4013
4015
|
scroller;
|
|
4014
4016
|
nodes = [];
|
|
@@ -4049,22 +4051,22 @@ class wr {
|
|
|
4049
4051
|
for (const t of this.nodes.splice(0)) t.remove();
|
|
4050
4052
|
}
|
|
4051
4053
|
}
|
|
4052
|
-
const
|
|
4054
|
+
const Sr = 120, et = [], ot = /* @__PURE__ */ new Set();
|
|
4053
4055
|
let Jt = !1;
|
|
4054
|
-
const
|
|
4056
|
+
const Mr = () => {
|
|
4055
4057
|
Jt || ot.size === 0 || (Jt = !0, queueMicrotask(() => {
|
|
4056
4058
|
Jt = !1;
|
|
4057
4059
|
for (const i of ot) i.afterRefresh();
|
|
4058
4060
|
}));
|
|
4059
|
-
},
|
|
4061
|
+
}, Vi = () => {
|
|
4060
4062
|
for (const i of ot) i.beforeRefresh();
|
|
4061
4063
|
for (const i of et) i.refresh();
|
|
4062
4064
|
for (const i of ot) i.afterRefresh();
|
|
4063
4065
|
};
|
|
4064
4066
|
let it = { width: 0, height: 0 };
|
|
4065
|
-
const
|
|
4067
|
+
const Ze = () => {
|
|
4066
4068
|
const i = window.innerWidth, t = window.innerHeight, e = i === it.width && t !== it.height, s = Math.abs(t - it.height) < it.height * 0.25, n = typeof navigator < "u" && (navigator.maxTouchPoints ?? 0) > 0;
|
|
4067
|
-
e && s && n || (it = { width: i, height: t },
|
|
4069
|
+
e && s && n || (it = { width: i, height: t }, Vi());
|
|
4068
4070
|
};
|
|
4069
4071
|
class qt {
|
|
4070
4072
|
timeline;
|
|
@@ -4096,16 +4098,16 @@ class qt {
|
|
|
4096
4098
|
markers = null;
|
|
4097
4099
|
markerGeometry = null;
|
|
4098
4100
|
constructor(t) {
|
|
4099
|
-
this.timeline = t.timeline, this.options = t, this.snapper = new
|
|
4101
|
+
this.timeline = t.timeline, this.options = t, this.snapper = new xr((e) => this.scrollTo(e), typeof window < "u" ? window : null);
|
|
4100
4102
|
}
|
|
4101
4103
|
start() {
|
|
4102
4104
|
if (this.running) return;
|
|
4103
4105
|
this.running = !0, this.timeline?.pause();
|
|
4104
4106
|
const t = this.options.pin === !0 ? this.options.trigger : this.options.pin || null;
|
|
4105
|
-
t && !this.options.container && (this.pin = new
|
|
4107
|
+
t && !this.options.container && (this.pin = new yr(t, { axis: this.options.horizontal ? "x" : "y", spacing: this.options.pinSpacing !== !1 })), this.options.markers && !this.options.horizontal && typeof document < "u" && (this.markers = new kr(document, this.options.scroller ?? null, this.options.markers)), this.scrollTarget()?.addEventListener("scroll", this.onScroll, { passive: !0 }), et.length === 0 && typeof window < "u" && (it = { width: window.innerWidth, height: window.innerHeight }, window.addEventListener("resize", Ze, { passive: !0 })), et.push(this), this.refresh();
|
|
4106
4108
|
}
|
|
4107
4109
|
stop() {
|
|
4108
|
-
this.running && (this.running = !1, this.scrollTarget()?.removeEventListener("scroll", this.onScroll), et.splice(et.indexOf(this), 1), et.length === 0 && typeof window < "u" && window.removeEventListener("resize",
|
|
4110
|
+
this.running && (this.running = !1, this.scrollTarget()?.removeEventListener("scroll", this.onScroll), et.splice(et.indexOf(this), 1), et.length === 0 && typeof window < "u" && window.removeEventListener("resize", Ze), this.stopSmoothing(), this.idleTimer !== null && clearTimeout(this.idleTimer), this.idleTimer = null, this.snapTimer !== null && clearTimeout(this.snapTimer), this.snapTimer = null, this.snapper.cancel());
|
|
4109
4111
|
}
|
|
4110
4112
|
/** Stop, and remove any pin spacer. */
|
|
4111
4113
|
destroy() {
|
|
@@ -4123,7 +4125,7 @@ class qt {
|
|
|
4123
4125
|
* layout change a resize would not catch (images or fonts loading).
|
|
4124
4126
|
*/
|
|
4125
4127
|
static refreshAll() {
|
|
4126
|
-
|
|
4128
|
+
Vi();
|
|
4127
4129
|
}
|
|
4128
4130
|
/** Be told around every re-measure; returns a function that stops it. */
|
|
4129
4131
|
static onRefresh(t) {
|
|
@@ -4153,13 +4155,13 @@ class qt {
|
|
|
4153
4155
|
this.measureInContainer(this.options.container);
|
|
4154
4156
|
else if (e) {
|
|
4155
4157
|
const s = this.viewportHeight();
|
|
4156
|
-
if (this.startPx = t +
|
|
4158
|
+
if (this.startPx = t + yt(e, s, ft(this.options.start) ?? "top bottom"), this.endPx = this.resolveEnd(e, s, t), this.pin) {
|
|
4157
4159
|
const n = this.relativeRect(this.pin.element.getBoundingClientRect());
|
|
4158
4160
|
this.pin.apply(n.top - (this.startPx - t), this.endPx - this.startPx);
|
|
4159
4161
|
}
|
|
4160
4162
|
this.markerGeometry = this.markers ? this.markersFor(s) : null;
|
|
4161
4163
|
}
|
|
4162
|
-
this.markers && this.markerGeometry && this.markers.place(this.markerGeometry, t), this.lastScroll = null, this.updateFrom(t, !this.measured), this.measured = !0,
|
|
4164
|
+
this.markers && this.markerGeometry && this.markers.place(this.markerGeometry, t), this.lastScroll = null, this.updateFrom(t, !this.measured), this.measured = !0, Mr();
|
|
4163
4165
|
}
|
|
4164
4166
|
/** Same as `refresh()`. */
|
|
4165
4167
|
sample() {
|
|
@@ -4177,7 +4179,7 @@ class qt {
|
|
|
4177
4179
|
updateFrom(t, e) {
|
|
4178
4180
|
this.trackVelocity(t), this.markers && this.markerGeometry && this.markers.follow(this.markerGeometry, t);
|
|
4179
4181
|
const s = this.endPx - this.startPx, n = this.zone;
|
|
4180
|
-
this.targetProgress = s > 0 ?
|
|
4182
|
+
this.targetProgress = s > 0 ? Xi((t - this.startPx) / s) : t >= this.startPx ? 1 : 0, this.zone = s > 0 ? t <= this.startPx ? "before" : t >= this.endPx ? "after" : "active" : t >= this.startPx ? "after" : "before", this.fireBoundaryCallbacks(n, this.zone), e || this.smoothing() <= 0 ? (this.displayProgress = this.targetProgress, this.applyProgress()) : (this.emitUpdate(), this.startSmoothing());
|
|
4181
4183
|
}
|
|
4182
4184
|
/** Seconds of smoothing, or 0 for exact tracking. */
|
|
4183
4185
|
smoothing() {
|
|
@@ -4190,7 +4192,7 @@ class qt {
|
|
|
4190
4192
|
const o = Number.parseFloat(r[1]);
|
|
4191
4193
|
return this.startPx + (r[2] === "%" ? e * o / 100 : o);
|
|
4192
4194
|
}
|
|
4193
|
-
return s +
|
|
4195
|
+
return s + yt(t, e, n);
|
|
4194
4196
|
}
|
|
4195
4197
|
applyProgress() {
|
|
4196
4198
|
const t = this.timeline?.duration ?? 0;
|
|
@@ -4205,7 +4207,7 @@ class qt {
|
|
|
4205
4207
|
const e = typeof performance < "u" ? performance.now() : Date.now();
|
|
4206
4208
|
this.lastScroll !== null && e > this.lastScrollTime && t !== this.lastScroll && (this.velocityPxPerSecond = (t - this.lastScroll) / (e - this.lastScrollTime) * 1e3), (this.lastScroll === null || t !== this.lastScroll) && (this.lastScroll = t, this.lastScrollTime = e), !(this.velocityPxPerSecond === 0 || typeof setTimeout > "u") && (this.idleTimer !== null && clearTimeout(this.idleTimer), this.idleTimer = setTimeout(() => {
|
|
4207
4209
|
this.idleTimer = null, this.releaseVelocity = this.velocityPxPerSecond, this.velocityPxPerSecond = 0, this.emitUpdate(), this.scheduleSnap();
|
|
4208
|
-
},
|
|
4210
|
+
}, Sr));
|
|
4209
4211
|
}
|
|
4210
4212
|
/**
|
|
4211
4213
|
* Emit enter/leave callbacks as the scroll position moves between zones. A jump
|
|
@@ -4221,12 +4223,12 @@ class qt {
|
|
|
4221
4223
|
scheduleSnap() {
|
|
4222
4224
|
const t = this.options.snap;
|
|
4223
4225
|
if (t === void 0 || this.snapper.active) return;
|
|
4224
|
-
const e =
|
|
4226
|
+
const e = vr(t), s = () => {
|
|
4225
4227
|
this.snapTimer = null;
|
|
4226
4228
|
const n = this.endPx - this.startPx, r = this.scrollPosition();
|
|
4227
4229
|
if (!this.running || n <= 0 || r <= this.startPx || r >= this.endPx) return;
|
|
4228
|
-
const o = (r - this.startPx) / n, a = this.startPx +
|
|
4229
|
-
Math.abs(a - r) < 1 || this.snapper.animate(r, a,
|
|
4230
|
+
const o = (r - this.startPx) / n, a = this.startPx + wr(o, this.releaseVelocity / n, e.snapTo) * n;
|
|
4231
|
+
Math.abs(a - r) < 1 || this.snapper.animate(r, a, Tr(e, a - r, this.viewportHeight()), e.ease);
|
|
4230
4232
|
};
|
|
4231
4233
|
e.delay ? this.snapTimer = setTimeout(s, e.delay * 1e3) : s();
|
|
4232
4234
|
}
|
|
@@ -4242,10 +4244,10 @@ class qt {
|
|
|
4242
4244
|
measureInContainer(t) {
|
|
4243
4245
|
const e = this.options.trigger;
|
|
4244
4246
|
if (typeof e?.getBoundingClientRect != "function") return;
|
|
4245
|
-
const s = e.getBoundingClientRect(), n = this.options.scroller?.getBoundingClientRect?.().left ?? 0, r = this.options.scroller ? this.options.scroller.clientWidth : typeof window < "u" ? window.innerWidth : 0, o = s.left - n - t.shiftAt(t.progress()), { start: a, end: c } = t.range(), l = (d) => a + d * (c - a), h =
|
|
4247
|
+
const s = e.getBoundingClientRect(), n = this.options.scroller?.getBoundingClientRect?.().left ?? 0, r = this.options.scroller ? this.options.scroller.clientWidth : typeof window < "u" ? window.innerWidth : 0, o = s.left - n - t.shiftAt(t.progress()), { start: a, end: c } = t.range(), l = (d) => a + d * (c - a), h = Ke(o, s.width, r, ft(this.options.start) ?? "left right", t.shiftAt);
|
|
4246
4248
|
this.startPx = l(h);
|
|
4247
4249
|
const f = ft(this.options.end) ?? "right left", u = typeof f == "string" ? f.trim().match(/^\+=\s*(-?[\d.]+)\s*(px)?$/) : null;
|
|
4248
|
-
this.endPx = u ? this.startPx + Number.parseFloat(u[1]) : l(
|
|
4250
|
+
this.endPx = u ? this.startPx + Number.parseFloat(u[1]) : l(Ke(o, s.width, r, f, t.shiftAt)), this.markerGeometry = null;
|
|
4249
4251
|
}
|
|
4250
4252
|
/** Where the markers go: the element points on the page, and the viewport lines they meet. */
|
|
4251
4253
|
markersFor(t) {
|
|
@@ -4253,7 +4255,7 @@ class qt {
|
|
|
4253
4255
|
const a = ft(r) ?? o;
|
|
4254
4256
|
if (typeof a == "number") return 0;
|
|
4255
4257
|
if (/^\s*\+=/.test(a)) return;
|
|
4256
|
-
const c =
|
|
4258
|
+
const c = Yi(a);
|
|
4257
4259
|
return t * c.viewportFraction - c.offsetPx;
|
|
4258
4260
|
}, s = e(this.options.start, "top bottom") ?? 0, n = e(this.options.end, "bottom top") ?? s;
|
|
4259
4261
|
return {
|
|
@@ -4268,7 +4270,7 @@ class qt {
|
|
|
4268
4270
|
const t = (e) => {
|
|
4269
4271
|
if (this.rafId = null, !this.running) return;
|
|
4270
4272
|
const s = this.lastFrameTime === null ? 16.67 : e - this.lastFrameTime;
|
|
4271
|
-
this.lastFrameTime = e, this.displayProgress =
|
|
4273
|
+
this.lastFrameTime = e, this.displayProgress = mr(this.displayProgress, this.targetProgress, this.smoothing(), s);
|
|
4272
4274
|
const n = Math.abs(this.targetProgress - this.displayProgress) < 1e-4;
|
|
4273
4275
|
n && (this.displayProgress = this.targetProgress), this.applyProgress(), n ? this.lastFrameTime = null : this.rafId = requestAnimationFrame(t);
|
|
4274
4276
|
};
|
|
@@ -4309,12 +4311,12 @@ class qt {
|
|
|
4309
4311
|
function ft(i) {
|
|
4310
4312
|
return typeof i == "function" ? i() : i;
|
|
4311
4313
|
}
|
|
4312
|
-
function
|
|
4314
|
+
function qo(i) {
|
|
4313
4315
|
const t = new qt(i);
|
|
4314
4316
|
return t.start(), t;
|
|
4315
4317
|
}
|
|
4316
|
-
const te = /* @__PURE__ */ new Set(),
|
|
4317
|
-
class
|
|
4318
|
+
const te = /* @__PURE__ */ new Set(), Ar = 16, Qe = 0.5, Pr = 2;
|
|
4319
|
+
class Je {
|
|
4318
4320
|
options;
|
|
4319
4321
|
frames;
|
|
4320
4322
|
running = !1;
|
|
@@ -4416,13 +4418,13 @@ class Qe {
|
|
|
4416
4418
|
// --- input ----------------------------------------------------------------
|
|
4417
4419
|
wheel(t) {
|
|
4418
4420
|
if (this.pausedState || this.reduced || (this.options.smooth ?? 0.8) <= 0 || t.ctrlKey || Math.abs(t.deltaX) > Math.abs(t.deltaY) || this.nestedScrollerTakes(t)) return;
|
|
4419
|
-
const e = t.deltaMode === 1 ?
|
|
4421
|
+
const e = t.deltaMode === 1 ? Ar : t.deltaMode === 2 ? this.viewportHeight() : 1, s = t.deltaY * e * (this.options.wheelMultiplier ?? 1), n = this.clamp(this.target + s);
|
|
4420
4422
|
n === this.target && n === this.current || (t.preventDefault(), this.journey = null, this.target = n, this.requestFrame());
|
|
4421
4423
|
}
|
|
4422
4424
|
/** A scroll that this smoother did not write: follow it. */
|
|
4423
4425
|
nativeScroll() {
|
|
4424
4426
|
const t = this.position();
|
|
4425
|
-
this.written !== null && Math.abs(t - this.written) <=
|
|
4427
|
+
this.written !== null && Math.abs(t - this.written) <= Pr || (this.written = null, this.journey = null, this.cancelFrame(), this.current = this.target = t, this.requestFrame());
|
|
4426
4428
|
}
|
|
4427
4429
|
nestedScrollerTakes(t) {
|
|
4428
4430
|
const e = this.options.scroller ?? document.documentElement;
|
|
@@ -4453,7 +4455,7 @@ class Qe {
|
|
|
4453
4455
|
this.current = r.from + (r.to - r.from) * r.ease(o), o >= 1 && (this.journey = null);
|
|
4454
4456
|
} else if (this.current !== this.target) {
|
|
4455
4457
|
const r = (this.options.smooth ?? 0.8) * 1e3 / 3;
|
|
4456
|
-
this.current += (this.target - this.current) * (1 - Math.exp(-e / r)), Math.abs(this.target - this.current) <
|
|
4458
|
+
this.current += (this.target - this.current) * (1 - Math.exp(-e / r)), Math.abs(this.target - this.current) < Qe && (this.current = this.target);
|
|
4457
4459
|
}
|
|
4458
4460
|
this.current !== s && this.write(this.current), this.velocityPxPerSecond = e > 0 ? (this.current - s) * 1e3 / e : 0;
|
|
4459
4461
|
const n = this.applyEffects(e);
|
|
@@ -4467,9 +4469,9 @@ class Qe {
|
|
|
4467
4469
|
let r = 0;
|
|
4468
4470
|
if (n.speed !== void 0 && (r += (s - n.centre) * (1 - n.speed)), n.lag !== void 0) {
|
|
4469
4471
|
const o = n.lag * 1e3 / 3;
|
|
4470
|
-
n.lagged = t === 0 ? s : n.lagged + (s - n.lagged) * (1 - Math.exp(-t / o)), Math.abs(s - n.lagged) <
|
|
4472
|
+
n.lagged = t === 0 ? s : n.lagged + (s - n.lagged) * (1 - Math.exp(-t / o)), Math.abs(s - n.lagged) < Qe ? n.lagged = s : e = !0, r += s - n.lagged;
|
|
4471
4473
|
}
|
|
4472
|
-
ee(n.element, r === 0 ? n.saved : `0 ${
|
|
4474
|
+
ee(n.element, r === 0 ? n.saved : `0 ${Er(r)}px`), n.shift = r;
|
|
4473
4475
|
}
|
|
4474
4476
|
return e;
|
|
4475
4477
|
}
|
|
@@ -4506,10 +4508,10 @@ class Qe {
|
|
|
4506
4508
|
function ee(i, t) {
|
|
4507
4509
|
t ? i.style.setProperty("translate", t) : i.style.removeProperty("translate");
|
|
4508
4510
|
}
|
|
4509
|
-
function
|
|
4511
|
+
function Er(i) {
|
|
4510
4512
|
return Math.round(i * 100) / 100;
|
|
4511
4513
|
}
|
|
4512
|
-
function
|
|
4514
|
+
function Cr(i, t) {
|
|
4513
4515
|
switch (t) {
|
|
4514
4516
|
// Play forward from wherever it is; reverse() flips a reversed timeline and plays.
|
|
4515
4517
|
// Neither restarts an animation that is already at that end.
|
|
@@ -4538,7 +4540,7 @@ function Ar(i, t) {
|
|
|
4538
4540
|
break;
|
|
4539
4541
|
}
|
|
4540
4542
|
}
|
|
4541
|
-
function
|
|
4543
|
+
function ve(i, t, e, s, n = () => {
|
|
4542
4544
|
}) {
|
|
4543
4545
|
const r = (d) => typeof d == "string" ? i.query(d) ?? void 0 : d, o = r(t.trigger) ?? s;
|
|
4544
4546
|
if (!o) {
|
|
@@ -4548,8 +4550,8 @@ function be(i, t, e, s, n = () => {
|
|
|
4548
4550
|
const a = t.scrub === void 0 || t.scrub === !1 ? !1 : t.scrub, c = (t.toggleActions ?? "play none none none").trim().split(/\s+/);
|
|
4549
4551
|
let l = 0, h;
|
|
4550
4552
|
const f = (d, m) => () => {
|
|
4551
|
-
m?.(), e && !a &&
|
|
4552
|
-
}, u = t.containerAnimation ?
|
|
4553
|
+
m?.(), e && !a && Cr(e, c[d] ?? "none"), t.once && d === 0 && queueMicrotask(() => h.destroy());
|
|
4554
|
+
}, u = t.containerAnimation ? Ir(i, t.containerAnimation, o, n) : void 0;
|
|
4553
4555
|
return h = new qt({
|
|
4554
4556
|
trigger: o,
|
|
4555
4557
|
start: t.start,
|
|
@@ -4560,7 +4562,7 @@ function be(i, t, e, s, n = () => {
|
|
|
4560
4562
|
horizontal: t.horizontal,
|
|
4561
4563
|
pinSpacing: t.pinSpacing,
|
|
4562
4564
|
onRefresh: t.invalidateOnRefresh && e?.invalidate ? () => e.invalidate() : void 0,
|
|
4563
|
-
snap: t.snap === void 0 ? void 0 :
|
|
4565
|
+
snap: t.snap === void 0 ? void 0 : _r(t.snap, e),
|
|
4564
4566
|
markers: t.markers,
|
|
4565
4567
|
container: u,
|
|
4566
4568
|
onUpdate: (d, m) => {
|
|
@@ -4576,21 +4578,21 @@ function be(i, t, e, s, n = () => {
|
|
|
4576
4578
|
onLeaveBack: f(3, t.onLeaveBack)
|
|
4577
4579
|
}), e && a === !1 && e.progress(0), h.start(), i.own(h);
|
|
4578
4580
|
}
|
|
4579
|
-
function
|
|
4580
|
-
const e = (n) => n === "labels" ? (r) =>
|
|
4581
|
+
function _r(i, t) {
|
|
4582
|
+
const e = (n) => n === "labels" ? (r) => Rr(r, t?.labelProgresses?.() ?? []) : n;
|
|
4581
4583
|
if (typeof i != "object" || Array.isArray(i)) return e(i);
|
|
4582
4584
|
const s = i.ease ? It(i.ease) : void 0;
|
|
4583
4585
|
return {
|
|
4584
4586
|
snapTo: e(i.snapTo),
|
|
4585
4587
|
duration: i.duration,
|
|
4586
4588
|
delay: i.delay,
|
|
4587
|
-
ease: s ? s.fn ??
|
|
4589
|
+
ease: s ? s.fn ?? j(s.easing) : void 0
|
|
4588
4590
|
};
|
|
4589
4591
|
}
|
|
4590
|
-
function
|
|
4592
|
+
function Rr(i, t) {
|
|
4591
4593
|
return t.reduce((e, s) => Math.abs(s - i) < Math.abs(e - i) ? s : e, t[0] ?? i);
|
|
4592
4594
|
}
|
|
4593
|
-
function
|
|
4595
|
+
function Ir(i, t, e, s) {
|
|
4594
4596
|
const n = () => t.timeline.getTracks({ property: "x" }).map((r) => r.target).filter((r) => {
|
|
4595
4597
|
const o = i.elementFor(r);
|
|
4596
4598
|
return !!o && o !== e && o.contains(e);
|
|
@@ -4612,7 +4614,7 @@ function _r(i, t, e, s) {
|
|
|
4612
4614
|
}
|
|
4613
4615
|
};
|
|
4614
4616
|
}
|
|
4615
|
-
class
|
|
4617
|
+
class Wi {
|
|
4616
4618
|
/** For contexts made by matchMedia: which named queries match */
|
|
4617
4619
|
conditions = {};
|
|
4618
4620
|
scope;
|
|
@@ -4655,7 +4657,7 @@ class Yi {
|
|
|
4655
4657
|
this.revert();
|
|
4656
4658
|
}
|
|
4657
4659
|
}
|
|
4658
|
-
class
|
|
4660
|
+
class $r {
|
|
4659
4661
|
host;
|
|
4660
4662
|
scope;
|
|
4661
4663
|
entries = [];
|
|
@@ -4695,11 +4697,11 @@ class Cr {
|
|
|
4695
4697
|
for (const [o, a] of t.queries) e[o] = a.matches;
|
|
4696
4698
|
const s = Object.values(e).some(Boolean), n = s ? JSON.stringify(e) : void 0;
|
|
4697
4699
|
if (n === t.key || (t.context?.revert(), t.context = void 0, t.key = n, !s)) return;
|
|
4698
|
-
const r = new
|
|
4700
|
+
const r = new Wi(this.host, this.scope);
|
|
4699
4701
|
r.conditions = e, r.add(() => t.setup(r)), t.context = r;
|
|
4700
4702
|
}
|
|
4701
4703
|
}
|
|
4702
|
-
class
|
|
4704
|
+
class Lr {
|
|
4703
4705
|
frames;
|
|
4704
4706
|
canvas;
|
|
4705
4707
|
context;
|
|
@@ -4773,23 +4775,23 @@ class Rr {
|
|
|
4773
4775
|
e.onload = () => s(!0), e.onerror = () => s(!1), e.src = this.options.url(t);
|
|
4774
4776
|
}
|
|
4775
4777
|
}
|
|
4776
|
-
const
|
|
4777
|
-
async function
|
|
4778
|
+
const Fr = { opacity: 0, y: -16 }, Dr = { opacity: 0, y: 16 };
|
|
4779
|
+
async function Or(i, t, e, s) {
|
|
4778
4780
|
const n = t.collector?.scope ?? t.root, r = n.ownerDocument ?? n, o = () => s.shared ? [...n.querySelectorAll(s.shared)] : [];
|
|
4779
4781
|
if (s.native && typeof r.startViewTransition == "function")
|
|
4780
|
-
return
|
|
4782
|
+
return Br(r, s, o);
|
|
4781
4783
|
const a = s.duration ?? 0.35, c = s.ease ?? "power2.inOut", l = (g) => new Promise((y) => {
|
|
4782
4784
|
g(y) || y();
|
|
4783
|
-
}), h = o(), f = h.length ? he(t, h) : void 0, u = s.from !== void 0 ?
|
|
4785
|
+
}), h = o(), f = h.length ? he(t, h) : void 0, u = s.from !== void 0 ? ti(t, s.from, s.shared) : [];
|
|
4784
4786
|
if (u.length && s.leave !== !1) {
|
|
4785
|
-
const g = s.leave ??
|
|
4787
|
+
const g = s.leave ?? Fr;
|
|
4786
4788
|
await l((y) => i.to(u, { ...g, duration: a, ease: c, onComplete: y }));
|
|
4787
4789
|
}
|
|
4788
4790
|
await s.update();
|
|
4789
|
-
const d = [], m = typeof s.to == "function" ? s.to() : s.to, p = m !== void 0 ?
|
|
4791
|
+
const d = [], m = typeof s.to == "function" ? s.to() : s.to, p = m !== void 0 ? ti(t, m, s.shared) : [];
|
|
4790
4792
|
if (p.length && s.enter !== !1) {
|
|
4791
|
-
const g = s.enter ??
|
|
4792
|
-
d.push(l((y) => i.fromTo(p, g, { ...
|
|
4793
|
+
const g = s.enter ?? Dr;
|
|
4794
|
+
d.push(l((y) => i.fromTo(p, g, { ...qi(g), duration: a, ease: c, onComplete: y })));
|
|
4793
4795
|
}
|
|
4794
4796
|
if (f) {
|
|
4795
4797
|
const g = o().filter((y) => !h.includes(y));
|
|
@@ -4807,11 +4809,11 @@ async function Fr(i, t, e, s) {
|
|
|
4807
4809
|
}
|
|
4808
4810
|
await Promise.all(d);
|
|
4809
4811
|
}
|
|
4810
|
-
function
|
|
4812
|
+
function ti(i, t, e) {
|
|
4811
4813
|
const s = i.resolveTargets(t).map((n) => i.elementFor(n)).filter((n) => !!n);
|
|
4812
4814
|
return e ? s.flatMap((n) => !n.querySelector(e) && !n.matches(e) ? [n] : [...n.children].filter((r) => !r.matches(e) && !r.querySelector(e))) : s;
|
|
4813
4815
|
}
|
|
4814
|
-
async function
|
|
4816
|
+
async function Br(i, t, e) {
|
|
4815
4817
|
const s = (a, c) => {
|
|
4816
4818
|
const l = a.dataset?.flipId;
|
|
4817
4819
|
l && a.style.setProperty("view-transition-name", c ? `tf-${l.replace(/[^\w-]/g, "-")}` : "");
|
|
@@ -4822,16 +4824,16 @@ async function Lr(i, t, e) {
|
|
|
4822
4824
|
n.forEach((a) => s(a, !1)), await t.update(), r = e(), r.forEach((a) => s(a, !0));
|
|
4823
4825
|
}).finished, r.forEach((a) => s(a, !1));
|
|
4824
4826
|
}
|
|
4825
|
-
const
|
|
4827
|
+
const Nr = {
|
|
4826
4828
|
/** Register a curve from SVG path data or bezier points. Returns the name. */
|
|
4827
|
-
create: (i, t) =>
|
|
4828
|
-
},
|
|
4829
|
+
create: (i, t) => ge(i, on(t))
|
|
4830
|
+
}, qr = {
|
|
4829
4831
|
/** Register a bouncing ease that lands and settles on the end value. Returns the name. */
|
|
4830
|
-
create: (i, t) =>
|
|
4831
|
-
},
|
|
4832
|
+
create: (i, t) => ge(i, { fn: an(t) })
|
|
4833
|
+
}, Yr = {
|
|
4832
4834
|
/** Register a wiggle that swings around the start value and returns to it. Returns the name. */
|
|
4833
|
-
create: (i, t) =>
|
|
4834
|
-
},
|
|
4835
|
+
create: (i, t) => ge(i, { fn: cn(t) })
|
|
4836
|
+
}, Xr = /* @__PURE__ */ new Set([
|
|
4835
4837
|
"keyframes",
|
|
4836
4838
|
"duration",
|
|
4837
4839
|
"delay",
|
|
@@ -4850,20 +4852,20 @@ const Dr = {
|
|
|
4850
4852
|
"onRepeat",
|
|
4851
4853
|
"onReverseComplete",
|
|
4852
4854
|
"scrollTrigger"
|
|
4853
|
-
]),
|
|
4854
|
-
function
|
|
4855
|
+
]), ei = 0.5, Vr = "power1.inOut";
|
|
4856
|
+
function Wr(i) {
|
|
4855
4857
|
return i.keyframes !== void 0 && i.keyframes !== null;
|
|
4856
4858
|
}
|
|
4857
|
-
function
|
|
4859
|
+
function jr(i) {
|
|
4858
4860
|
const t = i.keyframes, e = {};
|
|
4859
|
-
for (const [l, h] of Object.entries(i))
|
|
4861
|
+
for (const [l, h] of Object.entries(i)) Xr.has(l) || (e[l] = h);
|
|
4860
4862
|
if (Array.isArray(t))
|
|
4861
4863
|
return t.map((l) => ({
|
|
4862
4864
|
...e,
|
|
4863
4865
|
...l,
|
|
4864
|
-
duration: l.duration ?? i.duration ??
|
|
4866
|
+
duration: l.duration ?? i.duration ?? ei
|
|
4865
4867
|
}));
|
|
4866
|
-
const s = Object.entries(t), n = i.duration ??
|
|
4868
|
+
const s = Object.entries(t), n = i.duration ?? ei, r = t.easeEach ?? i.easeEach ?? Vr;
|
|
4867
4869
|
if (s.length > 0 && s.every(([l]) => /^\s*-?\d+(\.\d+)?\s*%\s*$/.test(l) || l === "easeEach")) {
|
|
4868
4870
|
const l = s.filter(([u]) => u !== "easeEach").map(([u, d]) => ({ at: Number.parseFloat(u) / 100, step: d })).sort((u, d) => u.at - d.at), h = [];
|
|
4869
4871
|
let f = 0;
|
|
@@ -4882,7 +4884,7 @@ function Yr(i) {
|
|
|
4882
4884
|
}
|
|
4883
4885
|
return c;
|
|
4884
4886
|
}
|
|
4885
|
-
function
|
|
4887
|
+
function ii(i, t, e, s = {}) {
|
|
4886
4888
|
const n = t.collector?.scope ?? t.root, r = typeof s.scroller == "string" ? n.querySelector(s.scroller) : s.scroller ?? null, o = {
|
|
4887
4889
|
x: r ? r.scrollLeft : window.scrollX,
|
|
4888
4890
|
y: r ? r.scrollTop : window.scrollY
|
|
@@ -4895,8 +4897,8 @@ function ei(i, t, e, s = {}) {
|
|
|
4895
4897
|
if (v === "max") return a[b];
|
|
4896
4898
|
const T = typeof v == "string" ? n.querySelector(v) : v;
|
|
4897
4899
|
if (!T) return o[b];
|
|
4898
|
-
const w = T.getBoundingClientRect(), x = r?.getBoundingClientRect(),
|
|
4899
|
-
return b === "x" ? w.left - (x?.left ?? 0) + o.x -
|
|
4900
|
+
const w = T.getBoundingClientRect(), x = r?.getBoundingClientRect(), M = (b === "x" ? s.offsetX : s.offsetY) ?? s.offset ?? 0;
|
|
4901
|
+
return b === "x" ? w.left - (x?.left ?? 0) + o.x - M : w.top - (x?.top ?? 0) + o.y - M;
|
|
4900
4902
|
}, l = typeof e == "object" && e !== null && !("nodeType" in e) ? { x: c("x", e.x), y: c("y", e.y) } : { x: o.x, y: c("y", e) }, h = { x: Math.max(0, Math.min(a.x, l.x)), y: Math.max(0, Math.min(a.y, l.y)) }, f = { ...o }, u = () => {
|
|
4901
4903
|
r ? (r.scrollLeft = f.x, r.scrollTop = f.y) : window.scrollTo({ left: f.x, top: f.y, behavior: "instant" });
|
|
4902
4904
|
}, d = ["wheel", "touchstart", "keydown"], m = r ?? window, p = () => {
|
|
@@ -4919,7 +4921,7 @@ function ei(i, t, e, s = {}) {
|
|
|
4919
4921
|
if (s.autoKill !== !1) for (const b of d) m.addEventListener(b, p, { passive: !0 });
|
|
4920
4922
|
return y;
|
|
4921
4923
|
}
|
|
4922
|
-
function
|
|
4924
|
+
function Ur(i, t, e) {
|
|
4923
4925
|
const s = i.collector?.scope ?? i.root, n = typeof t == "string" ? [...s.querySelectorAll(t)] : "nodeType" in t ? [t] : Array.from(t), { interval: r = 0.1, batchMax: o, onEnter: a, onLeave: c, onEnterBack: l, onLeaveBack: h, ...f } = e, u = { onEnter: a, onLeave: c, onEnterBack: l, onLeaveBack: h }, d = { onEnter: [], onLeave: [], onEnterBack: [], onLeaveBack: [] }, m = {}, p = (y) => {
|
|
4924
4926
|
m[y] !== void 0 && clearTimeout(m[y]), m[y] = void 0;
|
|
4925
4927
|
const b = d[y].splice(0);
|
|
@@ -4931,7 +4933,7 @@ function Vr(i, t, e) {
|
|
|
4931
4933
|
}
|
|
4932
4934
|
};
|
|
4933
4935
|
return n.map(
|
|
4934
|
-
(y) =>
|
|
4936
|
+
(y) => ve(i, {
|
|
4935
4937
|
...f,
|
|
4936
4938
|
trigger: y,
|
|
4937
4939
|
onEnter: () => g("onEnter", y),
|
|
@@ -4941,7 +4943,7 @@ function Vr(i, t, e) {
|
|
|
4941
4943
|
})
|
|
4942
4944
|
).filter((y) => y !== void 0);
|
|
4943
4945
|
}
|
|
4944
|
-
class
|
|
4946
|
+
class W {
|
|
4945
4947
|
/** The compiled compat timeline. */
|
|
4946
4948
|
compat;
|
|
4947
4949
|
stage;
|
|
@@ -4967,29 +4969,31 @@ class V {
|
|
|
4967
4969
|
/** Set by `reverse()`: arriving at the start is a reverse completion */
|
|
4968
4970
|
backwards = !1;
|
|
4969
4971
|
constructor(t, e = {}) {
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
const o = t.
|
|
4976
|
-
if (o
|
|
4977
|
-
|
|
4978
|
-
if (
|
|
4979
|
-
if (
|
|
4980
|
-
|
|
4981
|
-
|
|
4972
|
+
this.stage = t;
|
|
4973
|
+
const s = { ...e, onWarning: e.onWarning ?? t.onWarning };
|
|
4974
|
+
if (this.options = s, this.compat = new st({
|
|
4975
|
+
...s,
|
|
4976
|
+
startValue: (n, r) => {
|
|
4977
|
+
const o = t.objectFor(n);
|
|
4978
|
+
if (o) return Kr(o[r]);
|
|
4979
|
+
const a = t.appliedValue(n, r);
|
|
4980
|
+
if (a !== void 0) return a;
|
|
4981
|
+
if (r === "d") return Oi(t.elementFor(n)) ?? void 0;
|
|
4982
|
+
if (r === "text") return t.elementFor(n)?.textContent ?? void 0;
|
|
4983
|
+
if (r === "strokeDasharray" || r === "strokeDashoffset") {
|
|
4984
|
+
const c = ri(t.elementFor(n));
|
|
4985
|
+
if (c !== void 0) return r === "strokeDasharray" ? [c, c] : 0;
|
|
4982
4986
|
}
|
|
4983
4987
|
},
|
|
4984
|
-
startVelocity: (
|
|
4985
|
-
layoutColumns: (
|
|
4988
|
+
startVelocity: (n, r) => t.velocityOf(n, r),
|
|
4989
|
+
layoutColumns: (n) => ni(n.map((r) => t.elementFor(r))),
|
|
4986
4990
|
random: () => t.utils.random(0, 1)
|
|
4987
4991
|
}), this.compat.timeline.onComplete = () => {
|
|
4988
4992
|
this.finishedThisFrame = !0;
|
|
4989
|
-
}, t.collector?.track(this), t.liveTimelines.add(this), this.autoplayPending = !
|
|
4990
|
-
const
|
|
4993
|
+
}, t.collector?.track(this), t.liveTimelines.add(this), this.autoplayPending = !s.paused && !s.scrollTrigger, s.scrollTrigger) {
|
|
4994
|
+
const n = s.scrollTrigger;
|
|
4991
4995
|
queueMicrotask(() => {
|
|
4992
|
-
this.killed || (this.scrollDriver =
|
|
4996
|
+
this.killed || (this.scrollDriver = ve(t, n, this, this.firstElement, (r) => s.onWarning?.(r)));
|
|
4993
4997
|
});
|
|
4994
4998
|
}
|
|
4995
4999
|
this.autoplayPending && queueMicrotask(() => {
|
|
@@ -5006,7 +5010,7 @@ class V {
|
|
|
5006
5010
|
}
|
|
5007
5011
|
// --- building -----------------------------------------------------------
|
|
5008
5012
|
to(t, e, s) {
|
|
5009
|
-
return
|
|
5013
|
+
return Wr(e) ? this.record(() => this.keyframed(t, e, s)) : this.record(() => this.tween(t, [e], s, ([n], r, o) => this.compat.to(r, n, o)));
|
|
5010
5014
|
}
|
|
5011
5015
|
from(t, e, s) {
|
|
5012
5016
|
return this.record(() => this.tween(t, [e], s, ([n], r, o) => this.compat.from(r, n, o)));
|
|
@@ -5068,7 +5072,7 @@ class V {
|
|
|
5068
5072
|
/** Jump to `from`, then animate the playhead to `to` (seconds or labels). */
|
|
5069
5073
|
tweenFromTo(t, e, s = {}) {
|
|
5070
5074
|
this.pause(), this.seek(t);
|
|
5071
|
-
const n = this.timeline.currentTime, r = Math.max(0, Math.min(this.timeline.duration, this.compat.timeOf(e))), o = { time: n }, a = s.duration ?? Math.abs(r - n) / 1e3 / (this.timeScale() || 1), c = new
|
|
5075
|
+
const n = this.timeline.currentTime, r = Math.max(0, Math.min(this.timeline.duration, this.compat.timeOf(e))), o = { time: n }, a = s.duration ?? Math.abs(r - n) / 1e3 / (this.timeScale() || 1), c = new W(this.stage, { onStart: s.onStart, onComplete: s.onComplete });
|
|
5072
5076
|
return c.to(o, {
|
|
5073
5077
|
time: r,
|
|
5074
5078
|
duration: a,
|
|
@@ -5210,7 +5214,7 @@ class V {
|
|
|
5210
5214
|
/** Fire events and repeats between two playheads. Returns true if a pause stopped it. */
|
|
5211
5215
|
runCrossings(t, e, s) {
|
|
5212
5216
|
if (this.events.length === 0 && this.ranges.length === 0 && !this.options.onRepeat && !this.options.repeatRefresh) return !1;
|
|
5213
|
-
const n = this.events, { crossings: r, passes: o } =
|
|
5217
|
+
const n = this.events, { crossings: r, passes: o } = Si(
|
|
5214
5218
|
n.map((a) => a.time),
|
|
5215
5219
|
t,
|
|
5216
5220
|
e,
|
|
@@ -5263,14 +5267,14 @@ class V {
|
|
|
5263
5267
|
keyframed(t, e, s) {
|
|
5264
5268
|
const n = this.resolve(t);
|
|
5265
5269
|
if (!n) return;
|
|
5266
|
-
const r =
|
|
5270
|
+
const r = jr(e);
|
|
5267
5271
|
if (r.length === 0) return;
|
|
5268
5272
|
const o = n.length > 1 ? ce(e.stagger, this.staggerContext(n)) : void 0, a = n.map((g) => this.targetFor(g)).filter((g) => g !== void 0), c = o ? a.map((g) => [g]) : [a], l = o ? ie(n.length, o).map((g) => g / 1e3) : [0], h = this.compat.timeOf(s) / 1e3 + $t(e.delay, 0) / 1e3;
|
|
5269
5273
|
let f = 1 / 0, u = -1 / 0;
|
|
5270
5274
|
if (c.forEach((g, y) => {
|
|
5271
5275
|
r.forEach((b, v) => {
|
|
5272
5276
|
const T = v === 0 ? h + l[y] : ">";
|
|
5273
|
-
this.tween(g, [b], T, ([w], x,
|
|
5277
|
+
this.tween(g, [b], T, ([w], x, M) => this.compat.to(x, w, M)), f = Math.min(f, this.compat.lastStart), u = Math.max(u, this.compat.lastEnd);
|
|
5274
5278
|
});
|
|
5275
5279
|
}), f === 1 / 0) return;
|
|
5276
5280
|
const { onStart: d, onUpdate: m, onComplete: p } = e;
|
|
@@ -5279,20 +5283,20 @@ class V {
|
|
|
5279
5283
|
staggerContext(t) {
|
|
5280
5284
|
return {
|
|
5281
5285
|
count: t.length,
|
|
5282
|
-
columnsFromLayout: () =>
|
|
5286
|
+
columnsFromLayout: () => ni(t.map((e) => this.stage.elementFor(e))),
|
|
5283
5287
|
random: () => this.stage.utils.random(0, 1)
|
|
5284
5288
|
};
|
|
5285
5289
|
}
|
|
5286
5290
|
buildTween(t, e, s, n) {
|
|
5287
5291
|
const r = t.map((u) => this.targetFor(u));
|
|
5288
|
-
if (!(t.length > 1 && (e.some(
|
|
5292
|
+
if (!(t.length > 1 && (e.some(Gr) || t.some((u) => this.stage.objectFor(u) !== void 0)))) {
|
|
5289
5293
|
const u = this.targetFor(t[0]);
|
|
5290
|
-
n(e.map((d) => this.prepare(
|
|
5294
|
+
n(e.map((d) => this.prepare(si(d, 0, u, this.stage.utils, r), t)), t, s);
|
|
5291
5295
|
return;
|
|
5292
5296
|
}
|
|
5293
5297
|
const a = e.length - 1, { stagger: c, ...l } = e[a], h = ce(c, this.staggerContext(t)), f = h ? ie(t.length, h).map((u) => u / 1e3) : t.map(() => 0);
|
|
5294
5298
|
t.forEach((u, d) => {
|
|
5295
|
-
const m = d === 0 ? $t(l.delay, 0) / 1e3 + f[0] : 0, p = d === 0 ? 0 : f[d] - f[d - 1], g = d === 0 ? s : `<${p < 0 ? "-" : "+"}${Math.abs(p).toFixed(6)}`, b = e.map((v, T) => T === a ? { ...l, delay: m } : v).map((v) => this.prepare(
|
|
5299
|
+
const m = d === 0 ? $t(l.delay, 0) / 1e3 + f[0] : 0, p = d === 0 ? 0 : f[d] - f[d - 1], g = d === 0 ? s : `<${p < 0 ? "-" : "+"}${Math.abs(p).toFixed(6)}`, b = e.map((v, T) => T === a ? { ...l, delay: m } : v).map((v) => this.prepare(si(v, d, this.targetFor(u), this.stage.utils, r), [u]));
|
|
5296
5300
|
n(b, [u], g);
|
|
5297
5301
|
});
|
|
5298
5302
|
}
|
|
@@ -5308,7 +5312,7 @@ class V {
|
|
|
5308
5312
|
const s = (o) => this.options.onWarning?.(o), n = (o) => this.stage.query(o);
|
|
5309
5313
|
let r = t;
|
|
5310
5314
|
if (t.motionPath !== void 0) {
|
|
5311
|
-
const o =
|
|
5315
|
+
const o = Kn(t.motionPath, {
|
|
5312
5316
|
query: n,
|
|
5313
5317
|
targets: e.map((a) => this.stage.elementFor(a)).filter((a) => !!a),
|
|
5314
5318
|
warn: s
|
|
@@ -5316,33 +5320,33 @@ class V {
|
|
|
5316
5320
|
r = { ...r, motionPath: o };
|
|
5317
5321
|
}
|
|
5318
5322
|
if (t.morphSVG !== void 0) {
|
|
5319
|
-
const o =
|
|
5323
|
+
const o = Zn(t.morphSVG, n, s), { morphSVG: a, ...c } = r;
|
|
5320
5324
|
r = o ? { ...r, morphSVG: o } : c;
|
|
5321
5325
|
}
|
|
5322
5326
|
if (t.drawSVG !== void 0) {
|
|
5323
|
-
const o =
|
|
5327
|
+
const o = ri(this.stage.elementFor(e[0]));
|
|
5324
5328
|
if (o === void 0) {
|
|
5325
5329
|
s("gsap-compat: drawSVG needs an SVG shape with a stroke (path, line, circle…)");
|
|
5326
5330
|
const { drawSVG: a, ...c } = r;
|
|
5327
5331
|
r = c;
|
|
5328
5332
|
} else
|
|
5329
|
-
r =
|
|
5333
|
+
r = An(r, o);
|
|
5330
5334
|
}
|
|
5331
5335
|
return r;
|
|
5332
5336
|
}
|
|
5333
5337
|
resolve(t) {
|
|
5334
5338
|
const e = this.stage.resolveTargets(t);
|
|
5335
5339
|
if (e.length === 0) {
|
|
5336
|
-
this.options.onWarning?.(`gsap-compat: no elements found for target ${
|
|
5340
|
+
this.options.onWarning?.(`gsap-compat: no elements found for target ${Zr(t)}`);
|
|
5337
5341
|
return;
|
|
5338
5342
|
}
|
|
5339
5343
|
return this.firstElement ??= e.map((s) => this.stage.elementFor(s)).find((s) => s !== void 0), e;
|
|
5340
5344
|
}
|
|
5341
5345
|
}
|
|
5342
|
-
function
|
|
5346
|
+
function zr(i = new Un()) {
|
|
5343
5347
|
const t = (r) => {
|
|
5344
5348
|
const { config: o } = Pt(r);
|
|
5345
|
-
return new
|
|
5349
|
+
return new W(i, {
|
|
5346
5350
|
repeat: o.repeat,
|
|
5347
5351
|
yoyo: o.yoyo,
|
|
5348
5352
|
repeatDelay: o.repeatDelay,
|
|
@@ -5366,34 +5370,34 @@ function Wr(i = new Vn()) {
|
|
|
5366
5370
|
const [a] = i.resolveTargets(r);
|
|
5367
5371
|
if (a === void 0) return;
|
|
5368
5372
|
const c = i.objectFor(a);
|
|
5369
|
-
return c ? c[o] : i.appliedValue(a, o) ??
|
|
5373
|
+
return c ? c[o] : i.appliedValue(a, o) ?? $i(o);
|
|
5370
5374
|
},
|
|
5371
|
-
scrollTrigger: (r) => s(
|
|
5372
|
-
scrollBatch: (r, o) =>
|
|
5373
|
-
scrollTo: (r, o) =>
|
|
5375
|
+
scrollTrigger: (r) => s(ve(i, r)),
|
|
5376
|
+
scrollBatch: (r, o) => Ur(i, r, o).map((a) => s(a)),
|
|
5377
|
+
scrollTo: (r, o) => ii(n, i, r, o),
|
|
5374
5378
|
refreshScroll: () => {
|
|
5375
|
-
qt.refreshAll(),
|
|
5379
|
+
qt.refreshAll(), Je.refreshAll();
|
|
5376
5380
|
},
|
|
5377
5381
|
smoothScroll: (r = {}) => {
|
|
5378
5382
|
const o = typeof r.scroller == "string" ? (i.collector?.scope ?? i.root).querySelector(r.scroller) : r.scroller;
|
|
5379
|
-
return s(new
|
|
5383
|
+
return s(new Je({ ...r, scroller: o }).start());
|
|
5380
5384
|
},
|
|
5381
5385
|
context: (r, o) => {
|
|
5382
|
-
const a = new
|
|
5386
|
+
const a = new Wi(i, o);
|
|
5383
5387
|
return r && a.add(() => r(a)), a;
|
|
5384
5388
|
},
|
|
5385
|
-
matchMedia: (r) => new
|
|
5386
|
-
customEase:
|
|
5387
|
-
customBounce:
|
|
5388
|
-
customWiggle:
|
|
5389
|
-
pageTransition: (r) =>
|
|
5389
|
+
matchMedia: (r) => new $r(i, r),
|
|
5390
|
+
customEase: Nr.create,
|
|
5391
|
+
customBounce: qr.create,
|
|
5392
|
+
customWiggle: Yr.create,
|
|
5393
|
+
pageTransition: (r) => Or(n, i, (o) => new W(i, o), r),
|
|
5390
5394
|
imageSequence: (r, o) => {
|
|
5391
5395
|
const a = typeof r == "string" ? (i.collector?.scope ?? i.root).querySelector(r) : r;
|
|
5392
5396
|
if (!(a instanceof HTMLCanvasElement)) throw new Error(`gsap-compat: imageSequence needs a <canvas>, got ${String(r)}`);
|
|
5393
|
-
return s(new
|
|
5397
|
+
return s(new Lr(a, o));
|
|
5394
5398
|
},
|
|
5395
5399
|
quickTo: (r, o, a = {}) => {
|
|
5396
|
-
const c = new
|
|
5400
|
+
const c = new W(i, { paused: !0 }), [l] = i.resolveTargets(r);
|
|
5397
5401
|
return Object.assign((f) => {
|
|
5398
5402
|
if (!l) return;
|
|
5399
5403
|
const u = a.spring !== void 0 ? i.velocityOf(l, o) ?? 0 : 0;
|
|
@@ -5401,16 +5405,16 @@ function Wr(i = new Vn()) {
|
|
|
5401
5405
|
[o]: f,
|
|
5402
5406
|
duration: a.duration ?? 0.4,
|
|
5403
5407
|
ease: a.ease ?? "power3.out",
|
|
5404
|
-
...a.spring !== void 0 && { spring:
|
|
5408
|
+
...a.spring !== void 0 && { spring: Hr(a.spring, o, u) }
|
|
5405
5409
|
}), c.timeline.stop(), c.timeline.play(), i.activate(c.timeline);
|
|
5406
5410
|
}, { tween: c, kill: () => c.kill() });
|
|
5407
5411
|
},
|
|
5408
|
-
timeline: (r) => new
|
|
5412
|
+
timeline: (r) => new W(i, r),
|
|
5409
5413
|
// A single tween's callbacks are its timeline's, so they are not placed again as events.
|
|
5410
5414
|
to: (r, o) => {
|
|
5411
5415
|
if (o.scrollTo !== void 0) {
|
|
5412
5416
|
const { scrollTo: a, ...c } = o, l = typeof a == "object" && a !== null && !("nodeType" in a) ? a : {}, h = typeof r != "string" && r !== window && r.nodeType === 1;
|
|
5413
|
-
return
|
|
5417
|
+
return ii(n, i, a, {
|
|
5414
5418
|
...c,
|
|
5415
5419
|
offsetX: l.offsetX,
|
|
5416
5420
|
offsetY: l.offsetY,
|
|
@@ -5422,44 +5426,44 @@ function Wr(i = new Vn()) {
|
|
|
5422
5426
|
from: (r, o) => t(o).from(r, e(o)),
|
|
5423
5427
|
fromTo: (r, o, a) => t(a).fromTo(r, o, e(a)),
|
|
5424
5428
|
set: (r, o) => t(o).set(r, e(o)),
|
|
5425
|
-
delayedCall: (r, o, a) => new
|
|
5429
|
+
delayedCall: (r, o, a) => new W(i).call(o, a, r),
|
|
5426
5430
|
killTweensOf: (r, o) => {
|
|
5427
5431
|
const a = i.resolveTargets(r), c = typeof o == "string" ? o.split(",").map((l) => l.trim()).filter(Boolean) : o;
|
|
5428
5432
|
for (const l of [...i.liveTimelines]) l.killTweensOf(a, c);
|
|
5429
5433
|
},
|
|
5430
|
-
convertToPath: (r) =>
|
|
5434
|
+
convertToPath: (r) => Jn(r, i.root),
|
|
5431
5435
|
splitText: (r, o) => {
|
|
5432
5436
|
const a = i.collector?.scope ?? i.root, c = typeof r == "string" ? Array.from(a.querySelectorAll(r)) : "nodeType" in r ? [r] : Array.from(r);
|
|
5433
|
-
return s(
|
|
5437
|
+
return s(lr(c, o));
|
|
5434
5438
|
},
|
|
5435
|
-
draggable: (r, o) => s(
|
|
5439
|
+
draggable: (r, o) => s(rr(n, i, r, o)),
|
|
5436
5440
|
getFlipState: (r) => he(i, r),
|
|
5437
|
-
flipFrom: (r, o) => ue(i, (a) => new
|
|
5441
|
+
flipFrom: (r, o) => ue(i, (a) => new W(i, a), r, o),
|
|
5438
5442
|
flip: (r, o, a) => {
|
|
5439
5443
|
const c = he(i, r);
|
|
5440
|
-
return o(), ue(i, (l) => new
|
|
5444
|
+
return o(), ue(i, (l) => new W(i, l), c, { targets: r, ...a });
|
|
5441
5445
|
}
|
|
5442
5446
|
};
|
|
5443
5447
|
return n;
|
|
5444
5448
|
}
|
|
5445
|
-
const
|
|
5446
|
-
function
|
|
5449
|
+
const N = /* @__PURE__ */ zr();
|
|
5450
|
+
function Hr(i, t, e) {
|
|
5447
5451
|
return i === !0 ? { velocity: { [t]: e } } : typeof i == "string" ? { preset: i, velocity: { [t]: e } } : { ...i, velocity: { [t]: e } };
|
|
5448
5452
|
}
|
|
5449
|
-
function
|
|
5450
|
-
return i.morphSVG !== void 0 || i.drawSVG !== void 0 || i.text !== void 0 || i.scrambleText !== void 0 ||
|
|
5453
|
+
function Gr(i) {
|
|
5454
|
+
return i.morphSVG !== void 0 || i.drawSVG !== void 0 || i.text !== void 0 || i.scrambleText !== void 0 || ji(i);
|
|
5451
5455
|
}
|
|
5452
|
-
function
|
|
5453
|
-
return Object.entries(i).some(([t, e]) => (typeof e == "function" ||
|
|
5456
|
+
function ji(i) {
|
|
5457
|
+
return Object.entries(i).some(([t, e]) => (typeof e == "function" || Ii(e)) && !ye.has(t));
|
|
5454
5458
|
}
|
|
5455
|
-
function
|
|
5456
|
-
if (!
|
|
5459
|
+
function si(i, t, e, s, n) {
|
|
5460
|
+
if (!ji(i)) return i;
|
|
5457
5461
|
const r = {};
|
|
5458
5462
|
for (const [o, a] of Object.entries(i))
|
|
5459
|
-
|
|
5463
|
+
ye.has(o) ? r[o] = a : typeof a == "function" ? r[o] = a(t, e, n) : Ii(a) ? r[o] = s.resolveRandomString(a) : r[o] = a;
|
|
5460
5464
|
return r;
|
|
5461
5465
|
}
|
|
5462
|
-
function
|
|
5466
|
+
function ni(i) {
|
|
5463
5467
|
const t = i.map((s) => s?.getBoundingClientRect().top);
|
|
5464
5468
|
if (t[0] === void 0) return i.length;
|
|
5465
5469
|
let e = 0;
|
|
@@ -5469,18 +5473,18 @@ function si(i) {
|
|
|
5469
5473
|
}
|
|
5470
5474
|
return Math.max(1, e);
|
|
5471
5475
|
}
|
|
5472
|
-
function
|
|
5476
|
+
function ri(i) {
|
|
5473
5477
|
const t = i;
|
|
5474
5478
|
if (typeof t?.getTotalLength == "function")
|
|
5475
5479
|
return t.getTotalLength();
|
|
5476
5480
|
}
|
|
5477
|
-
function
|
|
5481
|
+
function Kr(i) {
|
|
5478
5482
|
if (typeof i == "number" || typeof i == "string" || Array.isArray(i) && i.every((t) => typeof t == "number")) return i;
|
|
5479
5483
|
}
|
|
5480
|
-
function
|
|
5484
|
+
function Zr(i) {
|
|
5481
5485
|
return typeof i == "string" ? `"${i}"` : String(i);
|
|
5482
5486
|
}
|
|
5483
|
-
class
|
|
5487
|
+
class oi {
|
|
5484
5488
|
media;
|
|
5485
5489
|
offset;
|
|
5486
5490
|
driftTolerance;
|
|
@@ -5519,7 +5523,7 @@ class ri {
|
|
|
5519
5523
|
});
|
|
5520
5524
|
}
|
|
5521
5525
|
}
|
|
5522
|
-
function
|
|
5526
|
+
function Qr(i, t, e, s, n) {
|
|
5523
5527
|
const r = e - n;
|
|
5524
5528
|
if (r < 0) {
|
|
5525
5529
|
t.paused || t.pause(), t.currentTime = 0;
|
|
@@ -5527,7 +5531,7 @@ function Gr(i, t, e, s, n) {
|
|
|
5527
5531
|
}
|
|
5528
5532
|
i.update(r, s);
|
|
5529
5533
|
}
|
|
5530
|
-
class
|
|
5534
|
+
class we {
|
|
5531
5535
|
container;
|
|
5532
5536
|
timeline = null;
|
|
5533
5537
|
adapter;
|
|
@@ -5539,6 +5543,9 @@ class ve {
|
|
|
5539
5543
|
mediaSync;
|
|
5540
5544
|
mediaTargets = [];
|
|
5541
5545
|
symbolInstances = [];
|
|
5546
|
+
scenarioList = [];
|
|
5547
|
+
scenarioId;
|
|
5548
|
+
authored = /* @__PURE__ */ new Map();
|
|
5542
5549
|
markerList = [];
|
|
5543
5550
|
listeners = /* @__PURE__ */ new Set();
|
|
5544
5551
|
/** Where the playhead was when marker crossings were last worked out */
|
|
@@ -5569,6 +5576,9 @@ class ve {
|
|
|
5569
5576
|
* Load animation from a URL or JSON object.
|
|
5570
5577
|
*/
|
|
5571
5578
|
async load(t) {
|
|
5579
|
+
this.scenarioList = [], this.scenarioId = void 0, await this.loadSource(t);
|
|
5580
|
+
}
|
|
5581
|
+
async loadSource(t) {
|
|
5572
5582
|
let e;
|
|
5573
5583
|
if (typeof t == "string") {
|
|
5574
5584
|
const s = await fetch(t);
|
|
@@ -5577,7 +5587,73 @@ class ve {
|
|
|
5577
5587
|
e = await s.json();
|
|
5578
5588
|
} else
|
|
5579
5589
|
e = t;
|
|
5580
|
-
this.
|
|
5590
|
+
this.useDefinition(e), this.showInitialFrame(), this.watchReducedMotion(), this.watchVisibility(), this.options.autoplay && !this.reducedMotion && (this.options.playWhenVisible && !this.onScreen ? this.autoplayWhenSeen = !0 : this.play());
|
|
5591
|
+
}
|
|
5592
|
+
/**
|
|
5593
|
+
* Make a definition the current timeline: targets, symbols and media bound, no
|
|
5594
|
+
* frame drawn and nothing played. The definition itself is not modified, so a
|
|
5595
|
+
* scenario's timeline can be used again.
|
|
5596
|
+
*/
|
|
5597
|
+
useDefinition(t) {
|
|
5598
|
+
const e = { ...t.config };
|
|
5599
|
+
this.options.speed !== void 0 && (e.speed = this.options.speed), this.options.loop !== void 0 && (e.loop = this.options.loop), this.options.alternate !== void 0 && (e.alternate = this.options.alternate), this.timeline = gt({ ...t, config: e }), this.markerList = this.timeline.markers, this.lastMarkerId = null, this.options.onComplete && (this.timeline.onComplete = this.options.onComplete), this.options.onUpdate && (this.timeline.onUpdate = this.options.onUpdate), this.autoRegisterTargets(), this.setupSymbolInstances(), this.scanMedia();
|
|
5600
|
+
}
|
|
5601
|
+
// --- scenarios: the reader chooses which timeline plays --------------------
|
|
5602
|
+
/**
|
|
5603
|
+
* Load several timelines for the same markup, and show one. The reader switches
|
|
5604
|
+
* with `setScenario`; the embed's controls and `data-tinyfly-choose` hotspots
|
|
5605
|
+
* call it.
|
|
5606
|
+
*/
|
|
5607
|
+
async loadScenarios(t, e = {}) {
|
|
5608
|
+
if (t.length === 0) throw new Error("tinyfly: loadScenarios needs at least one scenario");
|
|
5609
|
+
const s = /* @__PURE__ */ new Set();
|
|
5610
|
+
for (const r of t) {
|
|
5611
|
+
if (s.has(r.id)) throw new Error(`tinyfly: scenario id "${r.id}" is used more than once`);
|
|
5612
|
+
s.add(r.id);
|
|
5613
|
+
}
|
|
5614
|
+
const n = e.initial === void 0 ? t[0] : t.find((r) => r.id === e.initial);
|
|
5615
|
+
if (!n) throw new Error(`tinyfly: there is no scenario "${e.initial}"`);
|
|
5616
|
+
this.scenarioList = [...t], this.scenarioId = n.id, await this.loadSource(n.timeline);
|
|
5617
|
+
}
|
|
5618
|
+
/** The scenarios to choose from (empty for a single timeline). */
|
|
5619
|
+
get scenarios() {
|
|
5620
|
+
return this.scenarioList.map((t) => ({ id: t.id, label: t.label ?? t.id }));
|
|
5621
|
+
}
|
|
5622
|
+
/** The id of the scenario showing, if scenarios were loaded. */
|
|
5623
|
+
get scenario() {
|
|
5624
|
+
return this.scenarioId;
|
|
5625
|
+
}
|
|
5626
|
+
/**
|
|
5627
|
+
* Switch to another scenario. Whatever the previous one drew is undone first.
|
|
5628
|
+
* The reader stays at the same step when the new scenario has a marker with the
|
|
5629
|
+
* same id, stays at the end if they were at the end, and otherwise starts from
|
|
5630
|
+
* the beginning. Playback continues if it was playing. Under reduced motion the
|
|
5631
|
+
* new scenario's final frame shows. Returns false for an unknown id.
|
|
5632
|
+
*/
|
|
5633
|
+
setScenario(t) {
|
|
5634
|
+
const e = this.scenarioList.find((a) => a.id === t);
|
|
5635
|
+
if (!e || !this.timeline) return !1;
|
|
5636
|
+
if (t === this.scenarioId) return !0;
|
|
5637
|
+
const s = this.isPlaying, n = this.currentTime >= this.duration - 0.5, r = this.currentMarker?.id;
|
|
5638
|
+
this.stopAnimationLoop(), this.stepping = !1, this.pausedByVisibility = !1, this.restoreAuthored(), this.scenarioId = t, this.useDefinition(e.timeline), this.lastMarkerId = null;
|
|
5639
|
+
let o = 0;
|
|
5640
|
+
return this.reducedMotion || n ? o = this.duration : r !== void 0 && (o = this.markers.find((a) => a.id === r)?.time ?? 0), this.seek(o), s && !this.reducedMotion ? (this.stepping = this.options.stepMode === !0, this.startPlaying()) : this.notify(), !0;
|
|
5641
|
+
}
|
|
5642
|
+
/** Remember how an element was authored, the first time it becomes a target. */
|
|
5643
|
+
rememberAuthored(t) {
|
|
5644
|
+
if (this.authored.has(t)) return;
|
|
5645
|
+
const e = { style: t.getAttribute("style") };
|
|
5646
|
+
t.children.length === 0 && (e.text = t.textContent ?? "");
|
|
5647
|
+
const s = t.tagName.toLowerCase() === "path" ? t : t.querySelector("path");
|
|
5648
|
+
s && (e.path = { element: s, d: s.getAttribute("d") }), this.authored.set(t, e);
|
|
5649
|
+
}
|
|
5650
|
+
/** Put every target back the way it was authored. */
|
|
5651
|
+
restoreAuthored() {
|
|
5652
|
+
for (const [t, e] of this.authored) {
|
|
5653
|
+
e.style === null ? t.removeAttribute("style") : t.setAttribute("style", e.style), e.text !== void 0 && t.textContent !== e.text && (t.textContent = e.text), e.path && (e.path.d === null ? e.path.element.removeAttribute("d") : e.path.element.setAttribute("d", e.path.d));
|
|
5654
|
+
const s = t.dataset;
|
|
5655
|
+
s && delete s.shineBase;
|
|
5656
|
+
}
|
|
5581
5657
|
}
|
|
5582
5658
|
// --- teaching: frames, markers, reduced motion, visibility -----------------
|
|
5583
5659
|
/**
|
|
@@ -5659,7 +5735,7 @@ class ve {
|
|
|
5659
5735
|
watchVisibility() {
|
|
5660
5736
|
if (!(!this.options.playWhenVisible || typeof window > "u")) {
|
|
5661
5737
|
if (typeof IntersectionObserver == "function") {
|
|
5662
|
-
this.visibilityObserver?.disconnect(), this.
|
|
5738
|
+
this.visibilityObserver?.disconnect(), this.visibilityObserver = new IntersectionObserver((e) => {
|
|
5663
5739
|
for (const s of e) this.onScreen = s.isIntersecting;
|
|
5664
5740
|
this.updateVisibility();
|
|
5665
5741
|
}), this.visibilityObserver.observe(this.container);
|
|
@@ -5687,13 +5763,13 @@ class ve {
|
|
|
5687
5763
|
scanMedia() {
|
|
5688
5764
|
this.mediaTargets = [], this.container.querySelectorAll("[data-tinyfly-media]").forEach((e) => {
|
|
5689
5765
|
const s = e, n = Number(s.getAttribute("data-tinyfly-start") ?? "0") || 0, r = s.getAttribute("data-volume");
|
|
5690
|
-
r !== null && (s.volume = Math.max(0, Math.min(1, Number(r) || 0))), this.mediaTargets.push({ el: s, startTime: n, sync: new
|
|
5766
|
+
r !== null && (s.volume = Math.max(0, Math.min(1, Number(r) || 0))), this.mediaTargets.push({ el: s, startTime: n, sync: new oi(s) });
|
|
5691
5767
|
});
|
|
5692
5768
|
}
|
|
5693
5769
|
/** Sync all discovered media targets to a timeline time. */
|
|
5694
5770
|
syncAllMedia(t, e) {
|
|
5695
5771
|
for (const s of this.mediaTargets)
|
|
5696
|
-
|
|
5772
|
+
Qr(s.sync, s.el, t, e, s.startTime);
|
|
5697
5773
|
}
|
|
5698
5774
|
/**
|
|
5699
5775
|
* Load animation from inline JSON string.
|
|
@@ -5708,9 +5784,9 @@ class ve {
|
|
|
5708
5784
|
registerTarget(t, e) {
|
|
5709
5785
|
if (typeof e == "string") {
|
|
5710
5786
|
const s = this.container.querySelector(e);
|
|
5711
|
-
s && (this.targets[t] = s, this.adapter.registerTarget(t, s));
|
|
5787
|
+
s && (this.rememberAuthored(s), this.targets[t] = s, this.adapter.registerTarget(t, s));
|
|
5712
5788
|
} else
|
|
5713
|
-
this.targets[t] = e, this.adapter.registerTarget(t, e);
|
|
5789
|
+
this.rememberAuthored(e), this.targets[t] = e, this.adapter.registerTarget(t, e);
|
|
5714
5790
|
}
|
|
5715
5791
|
/**
|
|
5716
5792
|
* Auto-register targets using data-tinyfly attribute.
|
|
@@ -5747,7 +5823,7 @@ class ve {
|
|
|
5747
5823
|
s.querySelectorAll("[data-tinyfly]").forEach((a) => {
|
|
5748
5824
|
const c = a.getAttribute("data-tinyfly");
|
|
5749
5825
|
c && o.registerTarget(c, a);
|
|
5750
|
-
}), this.symbolInstances.push({ adapter: o, timeline:
|
|
5826
|
+
}), this.symbolInstances.push({ adapter: o, timeline: gt(r.timeline) });
|
|
5751
5827
|
});
|
|
5752
5828
|
}
|
|
5753
5829
|
/**
|
|
@@ -5757,7 +5833,7 @@ class ve {
|
|
|
5757
5833
|
* plays. Pass `{ offset }` to start the media at a timeline offset.
|
|
5758
5834
|
*/
|
|
5759
5835
|
attachMedia(t, e) {
|
|
5760
|
-
this.mediaSync = new
|
|
5836
|
+
this.mediaSync = new oi(t, e), this.timeline && (this.mediaSync.setRate(this.timeline.speed), this.mediaSync.update(this.timeline.currentTime, this.isPlaying));
|
|
5761
5837
|
}
|
|
5762
5838
|
/** Detach and pause the currently synced media, if any. */
|
|
5763
5839
|
detachMedia() {
|
|
@@ -5831,7 +5907,7 @@ class ve {
|
|
|
5831
5907
|
t.el.paused || t.el.pause();
|
|
5832
5908
|
this.mediaTargets = [], this.adapter.clearTargets();
|
|
5833
5909
|
for (const t of this.symbolInstances) t.adapter.clearTargets();
|
|
5834
|
-
this.symbolInstances = [], this.timeline = null;
|
|
5910
|
+
this.symbolInstances = [], this.authored.clear(), this.timeline = null;
|
|
5835
5911
|
}
|
|
5836
5912
|
startAnimationLoop() {
|
|
5837
5913
|
if (this.animationFrameId !== void 0) return;
|
|
@@ -5856,7 +5932,7 @@ class ve {
|
|
|
5856
5932
|
this.playhead = s;
|
|
5857
5933
|
const n = this.markers;
|
|
5858
5934
|
if (n.length === 0) return;
|
|
5859
|
-
const { crossings: r } =
|
|
5935
|
+
const { crossings: r } = Si(
|
|
5860
5936
|
n.map((o) => o.time),
|
|
5861
5937
|
t,
|
|
5862
5938
|
s,
|
|
@@ -5884,14 +5960,14 @@ class ve {
|
|
|
5884
5960
|
}
|
|
5885
5961
|
}
|
|
5886
5962
|
}
|
|
5887
|
-
async function
|
|
5888
|
-
const s = new
|
|
5963
|
+
async function Yo(i, t, e = {}) {
|
|
5964
|
+
const s = new we(i, { ...e, autoplay: !0 });
|
|
5889
5965
|
return await s.load(t), s;
|
|
5890
5966
|
}
|
|
5891
|
-
function
|
|
5892
|
-
return new
|
|
5967
|
+
function Xo(i, t = {}) {
|
|
5968
|
+
return new we(i, t);
|
|
5893
5969
|
}
|
|
5894
|
-
const
|
|
5970
|
+
const Jr = {
|
|
5895
5971
|
play: "Play",
|
|
5896
5972
|
pause: "Pause",
|
|
5897
5973
|
prev: "Previous step",
|
|
@@ -5902,8 +5978,9 @@ const Kr = {
|
|
|
5902
5978
|
reveal: "Reveal",
|
|
5903
5979
|
step: "Step",
|
|
5904
5980
|
of: "of",
|
|
5905
|
-
stepFormat: "{index} / {total}"
|
|
5906
|
-
|
|
5981
|
+
stepFormat: "{index} / {total}",
|
|
5982
|
+
scenario: "Scenario"
|
|
5983
|
+
}, ai = "tinyfly-controls-style", to = `
|
|
5907
5984
|
.tf-ctl { --tf-ctl-fg: #1d1d1f; --tf-ctl-bg: #f4f2ee; --tf-ctl-accent: #c2410c; --tf-ctl-radius: 8px;
|
|
5908
5985
|
font: 14px/1.4 var(--tf-ctl-font, system-ui, sans-serif); color: var(--tf-ctl-fg); margin-top: 8px; }
|
|
5909
5986
|
.tf-ctl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; border-radius: var(--tf-ctl-radius); background: var(--tf-ctl-bg); }
|
|
@@ -5922,22 +5999,35 @@ const Kr = {
|
|
|
5922
5999
|
/* The hidden attribute only hides through the browser's default stylesheet; any rule
|
|
5923
6000
|
above that sets display would override it, so enforce it for everything here. */
|
|
5924
6001
|
.tf-ctl [hidden] { display: none !important; }
|
|
6002
|
+
.tf-ctl-choices { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0; padding: 0; border: 0; }
|
|
6003
|
+
.tf-ctl-choices legend { float: left; margin-right: 4px; padding: 0; font-weight: 600; }
|
|
6004
|
+
.tf-ctl-choice { position: relative; display: inline-flex; }
|
|
6005
|
+
.tf-ctl-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
|
|
6006
|
+
.tf-ctl-choice span { display: inline-block; padding: 6px 12px; border-radius: var(--tf-ctl-radius); background: var(--tf-ctl-bg); cursor: pointer; }
|
|
6007
|
+
.tf-ctl-choice input:checked + span { background: var(--tf-ctl-accent); color: #fff; }
|
|
6008
|
+
.tf-ctl-choice input:focus-visible + span { outline: 2px solid var(--tf-ctl-accent); outline-offset: 2px; }
|
|
6009
|
+
.tf-ctl-choice-slider { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 0; }
|
|
6010
|
+
.tf-ctl-choice-slider span { font-weight: 600; }
|
|
6011
|
+
.tf-ctl-choice-slider input { flex: 1 1 140px; accent-color: var(--tf-ctl-accent); }
|
|
6012
|
+
.tf-ctl-choice-slider input:focus-visible { outline: 2px solid var(--tf-ctl-accent); outline-offset: 2px; }
|
|
6013
|
+
.tf-ctl-choice-slider output { font-variant-numeric: tabular-nums; min-width: 4em; }
|
|
5925
6014
|
`;
|
|
5926
|
-
|
|
5927
|
-
|
|
6015
|
+
let eo = 0;
|
|
6016
|
+
function io(i) {
|
|
6017
|
+
if (i.getElementById(ai)) return;
|
|
5928
6018
|
const t = i.createElement("style");
|
|
5929
|
-
t.id =
|
|
6019
|
+
t.id = ai, t.textContent = to, i.head.appendChild(t);
|
|
5930
6020
|
}
|
|
5931
|
-
function
|
|
6021
|
+
function so(i, t, e = {}) {
|
|
5932
6022
|
const s = t.ownerDocument;
|
|
5933
|
-
|
|
5934
|
-
const n = { ...
|
|
6023
|
+
io(s);
|
|
6024
|
+
const n = { ...Jr, ...e.labels }, r = e.speeds ?? [0.5, 1, 2], o = () => i.markers.length > 0, a = () => i.markers.some((S) => S.label !== void 0 || i.caption(S.id) !== void 0), c = s.createElement("div");
|
|
5935
6025
|
c.className = "tf-ctl";
|
|
5936
6026
|
const l = s.createElement("div");
|
|
5937
6027
|
l.className = "tf-ctl-bar", l.setAttribute("role", "group");
|
|
5938
|
-
const h = (
|
|
5939
|
-
const
|
|
5940
|
-
return
|
|
6028
|
+
const h = (S, _, $, I = "") => {
|
|
6029
|
+
const F = s.createElement("button");
|
|
6030
|
+
return F.type = "button", F.className = `tf-ctl-btn ${I}`.trim(), F.setAttribute("aria-label", S), F.title = S, F.textContent = _, F.addEventListener("click", $), F;
|
|
5941
6031
|
}, f = h(n.restart, "⟲", () => {
|
|
5942
6032
|
i.pause(), i.seek(0);
|
|
5943
6033
|
}), u = h(n.prev, "◀", () => i.prev()), d = h(n.play, "▶", () => i.isPlaying ? i.pause() : p(), "tf-ctl-primary"), m = h(n.next, "▶|", () => i.next()), p = () => {
|
|
@@ -5950,9 +6040,9 @@ function Jr(i, t, e = {}) {
|
|
|
5950
6040
|
y.className = "tf-ctl-step";
|
|
5951
6041
|
const b = s.createElement("select");
|
|
5952
6042
|
b.className = "tf-ctl-speed", b.setAttribute("aria-label", n.speed);
|
|
5953
|
-
for (const
|
|
5954
|
-
const
|
|
5955
|
-
|
|
6043
|
+
for (const S of r) {
|
|
6044
|
+
const _ = s.createElement("option");
|
|
6045
|
+
_.value = String(S), _.textContent = `${S}×`, S === 1 && (_.selected = !0), b.appendChild(_);
|
|
5956
6046
|
}
|
|
5957
6047
|
b.addEventListener("change", () => i.setSpeed(Number(b.value))), l.append(f, u, d, m, g, y), r.length > 0 && l.append(b), c.append(l);
|
|
5958
6048
|
const v = s.createElement("p");
|
|
@@ -5961,58 +6051,143 @@ function Jr(i, t, e = {}) {
|
|
|
5961
6051
|
T.className = "tf-ctl-question", T.hidden = !0;
|
|
5962
6052
|
const w = s.createElement("span"), x = h(n.reveal, n.reveal, () => i.play(), "tf-ctl-primary");
|
|
5963
6053
|
T.append(w, x), c.append(T);
|
|
5964
|
-
const
|
|
5965
|
-
|
|
5966
|
-
const
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
const
|
|
5970
|
-
|
|
5971
|
-
const
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
const
|
|
5976
|
-
|
|
5977
|
-
const H =
|
|
5978
|
-
|
|
6054
|
+
const M = no(i, s, n.scenario, e.scenarioControl ?? "buttons");
|
|
6055
|
+
M && c.append(M.element);
|
|
6056
|
+
const C = e.mount;
|
|
6057
|
+
C ? C.appendChild(c) : t.insertAdjacentElement("afterend", c);
|
|
6058
|
+
const D = () => {
|
|
6059
|
+
const S = i.isPlaying;
|
|
6060
|
+
d.textContent = S ? "❚❚" : "▶", d.setAttribute("aria-label", S ? n.pause : n.play), d.title = S ? n.pause : n.play;
|
|
6061
|
+
const _ = i.duration;
|
|
6062
|
+
s.activeElement !== g && (g.value = String(_ > 0 ? Math.round(i.currentTime / _ * 1e3) : 0));
|
|
6063
|
+
const $ = i.markers;
|
|
6064
|
+
if (u.hidden = m.hidden = y.hidden = $.length === 0, $.length > 0) {
|
|
6065
|
+
const I = i.currentMarker, F = I ? $.indexOf(I) + 1 : 0;
|
|
6066
|
+
y.textContent = n.stepFormat.replace("{index}", String(F)).replace("{total}", String($.length)), y.setAttribute("aria-label", `${n.step} ${F} ${n.of} ${$.length}`), u.disabled = i.currentTime <= 0.5, m.disabled = i.currentTime >= _ - 0.5;
|
|
6067
|
+
const H = i.caption() ?? "";
|
|
6068
|
+
v.textContent !== H && (v.textContent = H), v.hidden = !a();
|
|
6069
|
+
const R = !S && I?.question !== void 0 && Math.abs(i.currentTime - I.time) < 1;
|
|
6070
|
+
T.hidden = !R, R && w.textContent !== I.question && (w.textContent = I.question);
|
|
5979
6071
|
} else
|
|
5980
6072
|
T.hidden = !0, v.hidden = !0;
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
|
|
5988
|
-
|
|
5989
|
-
|
|
6073
|
+
M?.update();
|
|
6074
|
+
}, A = i.subscribe(D);
|
|
6075
|
+
D();
|
|
6076
|
+
const k = e.keyboardScope ?? t;
|
|
6077
|
+
!k.hasAttribute("tabindex") && k.tabIndex < 0 && (k.tabIndex = 0);
|
|
6078
|
+
const E = /* @__PURE__ */ new WeakSet(), P = (S) => {
|
|
6079
|
+
if (E.has(S) || (E.add(S), S.defaultPrevented || S.altKey || S.ctrlKey || S.metaKey)) return;
|
|
6080
|
+
const _ = S.target;
|
|
6081
|
+
if (!(_.tagName === "INPUT" || _.tagName === "SELECT") && !(S.key === " " && _.tagName === "BUTTON"))
|
|
6082
|
+
switch (S.key) {
|
|
5990
6083
|
case " ":
|
|
5991
|
-
|
|
6084
|
+
S.preventDefault(), i.isPlaying ? i.pause() : p();
|
|
5992
6085
|
break;
|
|
5993
6086
|
case "ArrowRight":
|
|
5994
6087
|
if (!o()) return;
|
|
5995
|
-
|
|
6088
|
+
S.preventDefault(), i.next();
|
|
5996
6089
|
break;
|
|
5997
6090
|
case "ArrowLeft":
|
|
5998
6091
|
if (!o()) return;
|
|
5999
|
-
|
|
6092
|
+
S.preventDefault(), i.prev();
|
|
6000
6093
|
break;
|
|
6001
6094
|
case "Home":
|
|
6002
|
-
|
|
6095
|
+
S.preventDefault(), i.pause(), i.seek(0);
|
|
6003
6096
|
break;
|
|
6004
6097
|
}
|
|
6005
6098
|
};
|
|
6006
|
-
return
|
|
6099
|
+
return k.addEventListener("keydown", P), c.addEventListener("keydown", P), {
|
|
6007
6100
|
element: c,
|
|
6008
6101
|
destroy() {
|
|
6009
|
-
|
|
6102
|
+
A(), k.removeEventListener("keydown", P), c.removeEventListener("keydown", P), c.remove();
|
|
6010
6103
|
}
|
|
6011
6104
|
};
|
|
6012
6105
|
}
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6106
|
+
function no(i, t, e, s) {
|
|
6107
|
+
const n = i.scenarios;
|
|
6108
|
+
if (n.length < 2) return;
|
|
6109
|
+
if (s === "slider") {
|
|
6110
|
+
const h = t.createElement("div");
|
|
6111
|
+
h.className = "tf-ctl-choice-slider";
|
|
6112
|
+
const f = t.createElement("span");
|
|
6113
|
+
f.textContent = e, f.setAttribute("aria-hidden", "true");
|
|
6114
|
+
const u = t.createElement("input");
|
|
6115
|
+
u.type = "range", u.min = "0", u.max = String(n.length - 1), u.step = "1", u.setAttribute("aria-label", e);
|
|
6116
|
+
const d = t.createElement("output");
|
|
6117
|
+
return d.setAttribute("aria-hidden", "true"), u.addEventListener("input", () => {
|
|
6118
|
+
const p = n[Number(u.value)];
|
|
6119
|
+
p && i.setScenario(p.id);
|
|
6120
|
+
}), h.append(f, u, d), { element: h, update: () => {
|
|
6121
|
+
const p = Math.max(0, n.findIndex((y) => y.id === i.scenario));
|
|
6122
|
+
t.activeElement !== u && (u.value = String(p));
|
|
6123
|
+
const g = n[p].label;
|
|
6124
|
+
d.textContent !== g && (d.textContent = g), u.setAttribute("aria-valuetext", g);
|
|
6125
|
+
} };
|
|
6126
|
+
}
|
|
6127
|
+
const r = t.createElement("fieldset");
|
|
6128
|
+
r.className = "tf-ctl-choices";
|
|
6129
|
+
const o = t.createElement("legend");
|
|
6130
|
+
o.textContent = e, r.append(o);
|
|
6131
|
+
const a = `tf-ctl-scenario-${++eo}`, c = n.map((h) => {
|
|
6132
|
+
const f = t.createElement("label");
|
|
6133
|
+
f.className = "tf-ctl-choice";
|
|
6134
|
+
const u = t.createElement("input");
|
|
6135
|
+
u.type = "radio", u.name = a, u.value = h.id, u.addEventListener("change", () => {
|
|
6136
|
+
u.checked && i.setScenario(h.id);
|
|
6137
|
+
});
|
|
6138
|
+
const d = t.createElement("span");
|
|
6139
|
+
return d.textContent = h.label, f.append(u, d), r.append(f), u;
|
|
6140
|
+
});
|
|
6141
|
+
return { element: r, update: () => {
|
|
6142
|
+
for (const h of c) {
|
|
6143
|
+
const f = h.value === i.scenario;
|
|
6144
|
+
h.checked !== f && (h.checked = f);
|
|
6145
|
+
}
|
|
6146
|
+
} };
|
|
6147
|
+
}
|
|
6148
|
+
const ci = "tinyfly-choices-style", ro = `
|
|
6149
|
+
[data-tinyfly-choose] { cursor: pointer; }
|
|
6150
|
+
[data-tinyfly-choose]:focus-visible { outline: 2px solid var(--tf-ctl-accent, #c2410c); outline-offset: 2px; }
|
|
6151
|
+
`;
|
|
6152
|
+
function oo(i) {
|
|
6153
|
+
if (i.getElementById(ci)) return;
|
|
6154
|
+
const t = i.createElement("style");
|
|
6155
|
+
t.id = ci, t.textContent = ro, i.head.appendChild(t);
|
|
6156
|
+
}
|
|
6157
|
+
function ao(i, t) {
|
|
6158
|
+
const e = Array.from(t.querySelectorAll("[data-tinyfly-choose]"));
|
|
6159
|
+
if (e.length === 0) return () => {
|
|
6160
|
+
};
|
|
6161
|
+
oo(t.ownerDocument);
|
|
6162
|
+
const s = [], n = [];
|
|
6163
|
+
for (const a of e) {
|
|
6164
|
+
const c = a.getAttribute("data-tinyfly-choose") ?? "", l = [], h = (m, p) => {
|
|
6165
|
+
a.hasAttribute(m) || (a.setAttribute(m, p), l.push(m));
|
|
6166
|
+
};
|
|
6167
|
+
h("role", "button"), h("tabindex", "0");
|
|
6168
|
+
const f = i.scenarios.find((m) => m.id === c)?.label;
|
|
6169
|
+
f !== void 0 && h("aria-label", f), a.setAttribute("aria-pressed", "false"), l.push("aria-pressed"), s.push({ element: a, attributes: l });
|
|
6170
|
+
const u = () => i.setScenario(c), d = (m) => {
|
|
6171
|
+
const p = m.key;
|
|
6172
|
+
p !== "Enter" && p !== " " || (m.preventDefault(), u());
|
|
6173
|
+
};
|
|
6174
|
+
a.addEventListener("click", u), a.addEventListener("keydown", d), n.push(() => {
|
|
6175
|
+
a.removeEventListener("click", u), a.removeEventListener("keydown", d);
|
|
6176
|
+
});
|
|
6177
|
+
}
|
|
6178
|
+
const r = () => {
|
|
6179
|
+
for (const { element: a } of s)
|
|
6180
|
+
a.setAttribute("aria-pressed", String(a.getAttribute("data-tinyfly-choose") === i.scenario));
|
|
6181
|
+
}, o = i.subscribe(r);
|
|
6182
|
+
return r(), () => {
|
|
6183
|
+
o();
|
|
6184
|
+
for (const a of n) a();
|
|
6185
|
+
for (const { element: a, attributes: c } of s) for (const l of c) a.removeAttribute(l);
|
|
6186
|
+
};
|
|
6187
|
+
}
|
|
6188
|
+
const Ft = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakMap();
|
|
6189
|
+
let co = 0;
|
|
6190
|
+
function mt(i, t, e) {
|
|
6016
6191
|
if (i)
|
|
6017
6192
|
try {
|
|
6018
6193
|
return JSON.parse(i);
|
|
@@ -6021,66 +6196,89 @@ function Mt(i, t, e) {
|
|
|
6021
6196
|
return;
|
|
6022
6197
|
}
|
|
6023
6198
|
}
|
|
6024
|
-
async function
|
|
6025
|
-
const e =
|
|
6199
|
+
async function lo(i, t = {}) {
|
|
6200
|
+
const e = Ft.get(i);
|
|
6026
6201
|
if (e) return e;
|
|
6027
|
-
const s = i.
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
if (!
|
|
6031
|
-
const
|
|
6032
|
-
|
|
6033
|
-
}
|
|
6034
|
-
if (
|
|
6202
|
+
const s = Array.from(i.querySelectorAll("script[data-tinyfly-timeline]")), n = s[0], r = i.getAttribute("data-src"), o = uo(i.getAttribute("data-markers")), a = s.length > 1 || n?.hasAttribute("data-scenario") ? ho(s, o, i) : void 0;
|
|
6203
|
+
if (a && a.length === 0) return;
|
|
6204
|
+
let c = n && !a ? mt(n.textContent, "timeline", i) : void 0;
|
|
6205
|
+
if (!c && r && o) {
|
|
6206
|
+
const d = await fetch(r);
|
|
6207
|
+
d.ok && (c = await d.json());
|
|
6208
|
+
}
|
|
6209
|
+
if (c && o && (c = Ui(c, o)), !c && !r && !a) {
|
|
6035
6210
|
console.warn('tinyfly: embed has no timeline (a <script type="application/json" data-tinyfly-timeline> or data-src)', i);
|
|
6036
6211
|
return;
|
|
6037
6212
|
}
|
|
6038
|
-
const
|
|
6213
|
+
const l = mt(i.querySelector("script[data-tinyfly-captions]")?.textContent, "captions", i), h = {
|
|
6039
6214
|
playWhenVisible: !0,
|
|
6040
6215
|
...t.player,
|
|
6041
|
-
...
|
|
6042
|
-
...
|
|
6216
|
+
...l && { captions: l },
|
|
6217
|
+
...mt(i.getAttribute("data-options"), "data-options", i)
|
|
6043
6218
|
};
|
|
6044
|
-
|
|
6045
|
-
const
|
|
6046
|
-
if (
|
|
6047
|
-
const
|
|
6048
|
-
|
|
6219
|
+
po(i);
|
|
6220
|
+
const f = new we(i, h), u = { element: i, player: f };
|
|
6221
|
+
if (Ft.set(i, u), i.setAttribute("data-tinyfly-mounted", ""), a) {
|
|
6222
|
+
const d = i.getAttribute("data-scenario") ?? void 0;
|
|
6223
|
+
await f.loadScenarios(a, { initial: a.some((m) => m.id === d) ? d : void 0 }), fe.set(i, ao(f, i));
|
|
6224
|
+
} else
|
|
6225
|
+
await f.load(c ?? r);
|
|
6226
|
+
if (i.getAttribute("data-controls") !== "false") {
|
|
6227
|
+
const d = mt(i.getAttribute("data-labels"), "data-labels", i), m = i.querySelector("figcaption"), p = i.getAttribute("data-scenario-legend"), g = i.getAttribute("data-scenario-control");
|
|
6228
|
+
u.controls = so(f, i, {
|
|
6049
6229
|
...t.controls,
|
|
6050
|
-
|
|
6230
|
+
...g === "slider" || g === "buttons" ? { scenarioControl: g } : {},
|
|
6231
|
+
labels: { ...t.controls?.labels, ...d, ...p ? { scenario: p } : {} },
|
|
6051
6232
|
// Inside the figure, before its figcaption, so the caption stays last.
|
|
6052
6233
|
mount: void 0
|
|
6053
|
-
}),
|
|
6234
|
+
}), m ? i.insertBefore(u.controls.element, m) : i.appendChild(u.controls.element);
|
|
6054
6235
|
}
|
|
6055
|
-
return
|
|
6236
|
+
return u;
|
|
6056
6237
|
}
|
|
6057
|
-
function
|
|
6238
|
+
function ho(i, t, e) {
|
|
6239
|
+
const s = [];
|
|
6240
|
+
return i.forEach((n, r) => {
|
|
6241
|
+
const o = mt(n.textContent, "timeline", e);
|
|
6242
|
+
if (!o) return;
|
|
6243
|
+
const a = n.getAttribute("data-scenario") || `scenario-${r + 1}`;
|
|
6244
|
+
if (s.some((l) => l.id === a)) {
|
|
6245
|
+
console.warn(`tinyfly: scenario id "${a}" is used more than once; the later one is skipped`, e);
|
|
6246
|
+
return;
|
|
6247
|
+
}
|
|
6248
|
+
const c = n.getAttribute("data-scenario-label") ?? void 0;
|
|
6249
|
+
s.push({ id: a, label: c, timeline: t ? Ui(o, t) : o });
|
|
6250
|
+
}), s;
|
|
6251
|
+
}
|
|
6252
|
+
function Ui(i, t) {
|
|
6253
|
+
return i.config.markers?.length ? i : { ...i, config: { ...i.config, markers: t.map((e, s) => ({ id: `step-${s + 1}`, time: e })) } };
|
|
6254
|
+
}
|
|
6255
|
+
function uo(i) {
|
|
6058
6256
|
if (!i) return;
|
|
6059
6257
|
const t = i.split(/[\s,]+/).filter(Boolean).map(Number).filter((e) => Number.isFinite(e) && e >= 0).sort((e, s) => e - s);
|
|
6060
6258
|
return t.length > 0 ? t : void 0;
|
|
6061
6259
|
}
|
|
6062
|
-
async function
|
|
6260
|
+
async function fo(i = document, t = {}) {
|
|
6063
6261
|
const e = Array.from(i.querySelectorAll("[data-tinyfly-embed]"));
|
|
6064
|
-
return (await Promise.all(e.map((n) =>
|
|
6262
|
+
return (await Promise.all(e.map((n) => lo(n, t)))).filter((n) => n !== void 0);
|
|
6065
6263
|
}
|
|
6066
|
-
function
|
|
6067
|
-
const t =
|
|
6068
|
-
t && (t.controls?.destroy(), t.player.destroy(),
|
|
6264
|
+
function Vo(i) {
|
|
6265
|
+
const t = Ft.get(i);
|
|
6266
|
+
t && (fe.get(i)?.(), fe.delete(i), t.controls?.destroy(), t.player.destroy(), Ft.delete(i), i.removeAttribute("data-tinyfly-mounted"));
|
|
6069
6267
|
}
|
|
6070
|
-
function
|
|
6268
|
+
function po(i) {
|
|
6071
6269
|
const t = i.querySelector("svg");
|
|
6072
6270
|
if (!t || t.hasAttribute("role") || t.hasAttribute("aria-hidden")) return;
|
|
6073
6271
|
const e = i.getAttribute("data-alt"), s = i.querySelector("figcaption");
|
|
6074
|
-
t.setAttribute("role", "img"), e ? t.setAttribute("aria-label", e) : s && (s.id ||= `tinyfly-caption-${++
|
|
6272
|
+
t.setAttribute("role", "img"), e ? t.setAttribute("aria-label", e) : s && (s.id ||= `tinyfly-caption-${++co}`, t.setAttribute("aria-labelledby", s.id));
|
|
6075
6273
|
}
|
|
6076
|
-
function
|
|
6274
|
+
function mo() {
|
|
6077
6275
|
if (!(typeof document < "u" ? document.currentScript : null)?.hasAttribute("data-tinyfly-auto")) return;
|
|
6078
6276
|
const t = () => {
|
|
6079
|
-
|
|
6277
|
+
fo();
|
|
6080
6278
|
};
|
|
6081
6279
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t, { once: !0 }) : t();
|
|
6082
6280
|
}
|
|
6083
|
-
class
|
|
6281
|
+
class go {
|
|
6084
6282
|
container;
|
|
6085
6283
|
containerA;
|
|
6086
6284
|
containerB;
|
|
@@ -6234,7 +6432,7 @@ class oo {
|
|
|
6234
6432
|
n.querySelectorAll("[data-tinyfly]").forEach((c) => {
|
|
6235
6433
|
const l = c.getAttribute("data-tinyfly");
|
|
6236
6434
|
l && a.registerTarget(l, c);
|
|
6237
|
-
}), s.push({ adapter: a, timeline:
|
|
6435
|
+
}), s.push({ adapter: a, timeline: gt(o) });
|
|
6238
6436
|
}), s.length ? this.nestedByAdapter.set(e, s) : this.nestedByAdapter.delete(e);
|
|
6239
6437
|
}
|
|
6240
6438
|
/** Apply the nested symbol states for a slot at a given scene time. */
|
|
@@ -6250,7 +6448,7 @@ class oo {
|
|
|
6250
6448
|
t.innerHTML = "";
|
|
6251
6449
|
}
|
|
6252
6450
|
createTimeline(t) {
|
|
6253
|
-
return t.timeline ?
|
|
6451
|
+
return t.timeline ? gt(t.timeline) : null;
|
|
6254
6452
|
}
|
|
6255
6453
|
onSceneComplete() {
|
|
6256
6454
|
if (this._isDestroyed || !this.sequence) return;
|
|
@@ -6349,12 +6547,12 @@ class oo {
|
|
|
6349
6547
|
this.animationFrameId !== void 0 && (cancelAnimationFrame(this.animationFrameId), this.animationFrameId = void 0);
|
|
6350
6548
|
}
|
|
6351
6549
|
}
|
|
6352
|
-
async function
|
|
6353
|
-
const s = new
|
|
6550
|
+
async function Wo(i, t, e = {}) {
|
|
6551
|
+
const s = new go(i, { ...e, autoplay: !0 });
|
|
6354
6552
|
return await s.load(t), s;
|
|
6355
6553
|
}
|
|
6356
|
-
const
|
|
6357
|
-
function
|
|
6554
|
+
const jo = { type: "none", duration: 0 };
|
|
6555
|
+
function Uo(i) {
|
|
6358
6556
|
const { timeline: t } = i, e = new K();
|
|
6359
6557
|
for (const [l, h] of Object.entries(i.targets)) {
|
|
6360
6558
|
const f = typeof h == "string" ? document.querySelector(h) : h;
|
|
@@ -6395,8 +6593,8 @@ function Oo(i) {
|
|
|
6395
6593
|
}
|
|
6396
6594
|
};
|
|
6397
6595
|
}
|
|
6398
|
-
const
|
|
6399
|
-
timeline:
|
|
6596
|
+
const zo = {
|
|
6597
|
+
timeline: $n,
|
|
6400
6598
|
to(i, t, e) {
|
|
6401
6599
|
const s = new st(e);
|
|
6402
6600
|
return s.to(i, t), s;
|
|
@@ -6413,169 +6611,170 @@ const Bo = {
|
|
|
6413
6611
|
const s = new st(e);
|
|
6414
6612
|
return s.set(i, t), s;
|
|
6415
6613
|
}
|
|
6416
|
-
},
|
|
6417
|
-
|
|
6614
|
+
}, Ho = N.to, Go = N.from, Ko = N.fromTo, Zo = N.set, Qo = N.timeline, Jo = N.ticker, ta = N.splitText, ea = N.context, ia = N.matchMedia, sa = N.quickTo, na = N.imageSequence, ra = N.pageTransition;
|
|
6615
|
+
mo();
|
|
6418
6616
|
export {
|
|
6419
|
-
|
|
6617
|
+
vo as Clock,
|
|
6420
6618
|
st as CompatTimeline,
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
|
|
6431
|
-
|
|
6432
|
-
|
|
6433
|
-
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
|
|
6619
|
+
qr as CustomBounce,
|
|
6620
|
+
Nr as CustomEase,
|
|
6621
|
+
Yr as CustomWiggle,
|
|
6622
|
+
yi as DEFAULT_BAKE_INTERVAL_MS,
|
|
6623
|
+
Te as DEFAULT_INERTIA_FRICTION,
|
|
6624
|
+
Jr as DEFAULT_LABELS,
|
|
6625
|
+
q as DEFAULT_SPRING,
|
|
6626
|
+
jo as DEFAULT_TRANSITION,
|
|
6627
|
+
Bi as Draggable,
|
|
6628
|
+
Ct as FORMAT_VERSION,
|
|
6629
|
+
is as INERTIA_MAX_DURATION_MS,
|
|
6630
|
+
Us as InertiaTrackPlayer,
|
|
6631
|
+
W as LiveTimeline,
|
|
6632
|
+
Ao as MORPH_SAMPLES,
|
|
6633
|
+
bo as ManualClock,
|
|
6634
|
+
oi as MediaSync,
|
|
6635
|
+
tr as Observer,
|
|
6636
|
+
fi as SPRING_MAX_DURATION_MS,
|
|
6637
|
+
Xt as SPRING_PRESETS,
|
|
6440
6638
|
dt as SPRING_STEP_MS,
|
|
6441
|
-
|
|
6639
|
+
xr as ScrollAnimator,
|
|
6442
6640
|
qt as ScrollDriver,
|
|
6443
|
-
|
|
6444
|
-
|
|
6445
|
-
|
|
6641
|
+
kr as ScrollMarkers,
|
|
6642
|
+
yr as ScrollPin,
|
|
6643
|
+
Je as SmoothScroll,
|
|
6446
6644
|
Ot as SpringSampler,
|
|
6447
|
-
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6645
|
+
js as SpringTrackPlayer,
|
|
6646
|
+
Un as Stage,
|
|
6647
|
+
ki as Timeline,
|
|
6648
|
+
we as TinyflyPlayer,
|
|
6649
|
+
go as TinyflySequencer,
|
|
6452
6650
|
zt as TrackPlayer,
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
|
|
6458
|
-
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6651
|
+
Do as ValueResolver,
|
|
6652
|
+
gr as VisibilityDriver,
|
|
6653
|
+
ps as backOut,
|
|
6654
|
+
Ti as bakeEasing,
|
|
6655
|
+
vi as bakeInertiaTrack,
|
|
6656
|
+
bi as bakeSpringTrack,
|
|
6657
|
+
ao as bindChoiceHotspots,
|
|
6658
|
+
ds as bounceOut,
|
|
6659
|
+
Hs as charactersFor,
|
|
6660
|
+
Xi as clamp01,
|
|
6661
|
+
Po as clearMorphCache,
|
|
6662
|
+
So as clearPathCache,
|
|
6663
|
+
Ke as containerProgressAt,
|
|
6664
|
+
ea as context,
|
|
6665
|
+
Xo as create,
|
|
6666
|
+
so as createControls,
|
|
6667
|
+
us as createCubicBezier,
|
|
6668
|
+
zr as createLive,
|
|
6669
|
+
en as createRandom,
|
|
6471
6670
|
oe as createTrack,
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6671
|
+
xo as criticalDamping,
|
|
6672
|
+
an as customBounce,
|
|
6673
|
+
on as customEase,
|
|
6674
|
+
cn as customWiggle,
|
|
6675
|
+
gt as deserializeTimeline,
|
|
6676
|
+
Js as deserializeTrack,
|
|
6677
|
+
Oo as draggable,
|
|
6678
|
+
as as easeIn,
|
|
6679
|
+
di as easeInCubic,
|
|
6680
|
+
ls as easeInOut,
|
|
6482
6681
|
Nt as easeInOutCubic,
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6682
|
+
os as easeInOutQuad,
|
|
6683
|
+
ns as easeInQuad,
|
|
6684
|
+
cs as easeOut,
|
|
6685
|
+
pi as easeOutCubic,
|
|
6686
|
+
rs as easeOutQuad,
|
|
6687
|
+
fs as elasticOut,
|
|
6688
|
+
Vs as expandParametricEasings,
|
|
6689
|
+
Go as from,
|
|
6690
|
+
Io as fromJSON,
|
|
6691
|
+
Ko as fromTo,
|
|
6692
|
+
j as getEasingFunction,
|
|
6494
6693
|
Rt as getInterpolator,
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6694
|
+
xi as getMotionPathPoint,
|
|
6695
|
+
Mo as getPathLength,
|
|
6696
|
+
Ms as getPointAtProgress,
|
|
6697
|
+
ir as gridLinesFor,
|
|
6698
|
+
Qi as hasKeyframes,
|
|
6699
|
+
$o as hashSeed,
|
|
6700
|
+
na as imageSequence,
|
|
6701
|
+
vt as inertiaDuration,
|
|
6702
|
+
bt as inertiaRest,
|
|
6504
6703
|
se as inertiaValueAt,
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
|
|
6704
|
+
ko as inertiaVelocityAt,
|
|
6705
|
+
Ys as interpolateArray,
|
|
6706
|
+
qs as interpolateColor,
|
|
6707
|
+
_o as interpolateMotionPath,
|
|
6708
|
+
V as interpolateNumber,
|
|
6709
|
+
Xs as interpolatePathString,
|
|
6511
6710
|
Fe as interpolateString,
|
|
6512
|
-
|
|
6711
|
+
Zi as isCubicBezierEasing,
|
|
6513
6712
|
Z as isInertiaTrack,
|
|
6514
|
-
|
|
6515
|
-
|
|
6713
|
+
yo as isMotionPathPoint,
|
|
6714
|
+
li as isMotionPathTrack,
|
|
6516
6715
|
Et as isParametricEasing,
|
|
6517
|
-
|
|
6716
|
+
wt as isPathData,
|
|
6518
6717
|
Q as isSpringTrack,
|
|
6519
|
-
|
|
6520
|
-
|
|
6521
|
-
|
|
6718
|
+
de as isTextTrack,
|
|
6719
|
+
To as isUnderdamped,
|
|
6720
|
+
Fo as isUnresolved,
|
|
6522
6721
|
ne as linear,
|
|
6523
|
-
|
|
6722
|
+
N as live,
|
|
6524
6723
|
It as mapEase,
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6724
|
+
ia as matchMedia,
|
|
6725
|
+
ui as maxStaggerDistance,
|
|
6726
|
+
Os as morphPath,
|
|
6727
|
+
lo as mount,
|
|
6728
|
+
fo as mountAll,
|
|
6729
|
+
_t as naturalRest,
|
|
6730
|
+
ra as pageTransition,
|
|
6731
|
+
gs as parametricEasing,
|
|
6732
|
+
Ge as parseEdge,
|
|
6534
6733
|
nt as parsePath,
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
6553
|
-
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
|
|
6561
|
-
|
|
6562
|
-
|
|
6563
|
-
|
|
6564
|
-
|
|
6565
|
-
|
|
6734
|
+
Yi as parseTrigger,
|
|
6735
|
+
Yo as play,
|
|
6736
|
+
Wo as playSequence,
|
|
6737
|
+
No as playWhenVisible,
|
|
6738
|
+
Si as playheadCrossings,
|
|
6739
|
+
mi as pointAtDistance,
|
|
6740
|
+
un as pointsToPath,
|
|
6741
|
+
Uo as quickPlay,
|
|
6742
|
+
sa as quickTo,
|
|
6743
|
+
Ai as randomBetween,
|
|
6744
|
+
Lo as randomChoice,
|
|
6745
|
+
sn as randomSnapped,
|
|
6746
|
+
nn as resolveSequence,
|
|
6747
|
+
Ci as resolveValue,
|
|
6748
|
+
Bo as scrollProgress,
|
|
6749
|
+
qo as scrubOnScroll,
|
|
6750
|
+
tn as serializeTimeline,
|
|
6751
|
+
Qs as serializeTrack,
|
|
6752
|
+
Zo as set,
|
|
6753
|
+
me as shapeToPathData,
|
|
6754
|
+
Ws as simplifyKeyframes,
|
|
6755
|
+
mr as smoothToward,
|
|
6756
|
+
er as snapAxis,
|
|
6757
|
+
vr as snapConfig,
|
|
6758
|
+
Tr as snapDuration,
|
|
6759
|
+
wr as snapProgress,
|
|
6760
|
+
ta as splitText,
|
|
6761
|
+
Ji as springDuration,
|
|
6762
|
+
wo as springValueAt,
|
|
6763
|
+
hi as staggerDistance,
|
|
6764
|
+
pe as staggerOffset,
|
|
6566
6765
|
ie as staggerOffsets,
|
|
6567
6766
|
Dt as staggerSpan,
|
|
6568
|
-
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6767
|
+
ms as stepsEasing,
|
|
6768
|
+
Qr as syncMediaElement,
|
|
6769
|
+
Ks as textAt,
|
|
6770
|
+
zo as tf,
|
|
6771
|
+
Jo as ticker,
|
|
6772
|
+
Qo as timeline,
|
|
6773
|
+
Ho as to,
|
|
6774
|
+
Ro as toJSON,
|
|
6775
|
+
Eo as toKeyframedTrack,
|
|
6776
|
+
Co as toKeyframedTracks,
|
|
6578
6777
|
G as trackTargets,
|
|
6579
|
-
|
|
6580
|
-
|
|
6778
|
+
yt as triggerDistance,
|
|
6779
|
+
Vo as unmount
|
|
6581
6780
|
};
|