@algorisys/tinyfly 0.90.0 → 0.91.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/lib/addons/adapters.js +179 -205
- package/lib/addons/camera-C7bZOWMB.js +33 -0
- package/lib/addons/characters.js +983 -969
- package/lib/browser/tinyfly.iife.js +4 -4
- package/lib/browser/tinyfly.js +1942 -1925
- package/lib/browser/tinyfly.umd.js +4 -4
- package/lib/cli/tools.js +16 -0
- package/lib/embed/tinyfly-embed.iife.js +4 -4
- package/lib/embed/tinyfly-embed.js +216 -203
- package/lib/engine/tinyfly-engine.js +287 -278
- package/lib/engine/tinyfly-engine.umd.cjs +2 -2
- package/lib/player/tinyfly-player.es.js +183 -170
- package/lib/player/tinyfly-player.iife.js +2 -2
- package/lib/player/tinyfly-player.umd.js +2 -2
- package/lib/types/characters/acting/script.d.ts +12 -1
- package/lib/types/characters/index.d.ts +1 -0
- package/lib/types/engine/core/timeline.d.ts +3 -0
- package/lib/types/engine/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -20,6 +20,11 @@ function yt(e) {
|
|
|
20
20
|
function pe(e) {
|
|
21
21
|
return e.property === "motionPath" && "motionPathConfig" in e;
|
|
22
22
|
}
|
|
23
|
+
function me(e, t) {
|
|
24
|
+
if (!(t > 0)) return e;
|
|
25
|
+
const n = 1e3 / t;
|
|
26
|
+
return Math.floor(e / n + 1e-9) * n;
|
|
27
|
+
}
|
|
23
28
|
function Qt(e, t, n = "start") {
|
|
24
29
|
if (t <= 1) return 0;
|
|
25
30
|
if (typeof n == "number") {
|
|
@@ -37,7 +42,7 @@ function Qt(e, t, n = "start") {
|
|
|
37
42
|
return e;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
|
-
function
|
|
45
|
+
function ge(e, t = "start") {
|
|
41
46
|
if (e <= 1) return 0;
|
|
42
47
|
let n = 0;
|
|
43
48
|
for (let i = 0; i < e; i++)
|
|
@@ -48,16 +53,16 @@ function Gt(e, t, n) {
|
|
|
48
53
|
if (n.offsets) return n.offsets[e] ?? 0;
|
|
49
54
|
const i = n.from ?? "start", s = Qt(e, t, i);
|
|
50
55
|
if (n.amount !== void 0) {
|
|
51
|
-
const r =
|
|
56
|
+
const r = ge(t, i);
|
|
52
57
|
return r === 0 ? 0 : n.amount * s / r;
|
|
53
58
|
}
|
|
54
59
|
return n.each !== void 0 ? n.each * s : 0;
|
|
55
60
|
}
|
|
56
|
-
function
|
|
61
|
+
function ye(e, t) {
|
|
57
62
|
return Array.from({ length: e }, (n, i) => Gt(i, e, t));
|
|
58
63
|
}
|
|
59
64
|
function wt(e, t) {
|
|
60
|
-
return e <= 1 ? 0 : Math.max(...
|
|
65
|
+
return e <= 1 ? 0 : Math.max(...ye(e, t));
|
|
61
66
|
}
|
|
62
67
|
const Z = 1, Zt = 6e4, et = Zt / Z, B = {
|
|
63
68
|
stiffness: 180,
|
|
@@ -67,7 +72,7 @@ const Z = 1, Zt = 6e4, et = Zt / Z, B = {
|
|
|
67
72
|
restDelta: 0.01,
|
|
68
73
|
restSpeed: 0.1
|
|
69
74
|
};
|
|
70
|
-
class
|
|
75
|
+
class be {
|
|
71
76
|
from;
|
|
72
77
|
to;
|
|
73
78
|
stiffness;
|
|
@@ -139,15 +144,15 @@ class ye {
|
|
|
139
144
|
this.samples.length > et && (this.settledStep = et);
|
|
140
145
|
}
|
|
141
146
|
}
|
|
142
|
-
const Tt = 4,
|
|
147
|
+
const Tt = 4, ve = 2e-3, ke = 1e-4, xe = 6e4;
|
|
143
148
|
function Mt(e) {
|
|
144
149
|
const t = e.friction ?? Tt;
|
|
145
150
|
return t > 0 ? t : Tt;
|
|
146
151
|
}
|
|
147
|
-
function
|
|
152
|
+
function we(e) {
|
|
148
153
|
return e.from + e.velocity / Mt(e);
|
|
149
154
|
}
|
|
150
|
-
function
|
|
155
|
+
function Me(e, t) {
|
|
151
156
|
if (t === void 0) return e;
|
|
152
157
|
if (typeof t == "number")
|
|
153
158
|
return t > 0 ? Math.round(e / t) * t : e;
|
|
@@ -158,16 +163,16 @@ function we(e, t) {
|
|
|
158
163
|
return n;
|
|
159
164
|
}
|
|
160
165
|
function Kt(e) {
|
|
161
|
-
let t = we(
|
|
166
|
+
let t = Me(we(e), e.end);
|
|
162
167
|
return e.min !== void 0 && (t = Math.max(e.min, t)), e.max !== void 0 && (t = Math.min(e.max, t)), t;
|
|
163
168
|
}
|
|
164
169
|
function Jt(e) {
|
|
165
170
|
const t = Math.abs(Kt(e) - e.from);
|
|
166
171
|
if (t === 0) return 0;
|
|
167
|
-
const n = e.restDelta ?? Math.max(
|
|
172
|
+
const n = e.restDelta ?? Math.max(ke, t * ve);
|
|
168
173
|
if (n >= t) return 0;
|
|
169
174
|
const i = Math.log(t / n) / Mt(e);
|
|
170
|
-
return Math.min(
|
|
175
|
+
return Math.min(xe, i * 1e3);
|
|
171
176
|
}
|
|
172
177
|
function _t(e, t) {
|
|
173
178
|
if (t <= 0) return e.from;
|
|
@@ -176,19 +181,19 @@ function _t(e, t) {
|
|
|
176
181
|
const i = Mt(e);
|
|
177
182
|
return e.from + (n - e.from) * (1 - Math.exp(-i * t / 1e3));
|
|
178
183
|
}
|
|
179
|
-
const bt = (e) => e,
|
|
184
|
+
const bt = (e) => e, Se = (e) => e * e, Te = (e) => 1 - (1 - e) * (1 - e), _e = (e) => e < 0.5 ? 2 * e * e : 1 - Math.pow(-2 * e + 2, 2) / 2, te = (e) => e * e * e, ee = (e) => 1 - Math.pow(1 - e, 3), ne = (e) => e < 0.5 ? 4 * e * e * e : 1 - Math.pow(-2 * e + 2, 3) / 2, Ae = te, Ee = ee, Pe = ne, Ce = {
|
|
180
185
|
linear: bt,
|
|
181
|
-
"ease-in":
|
|
182
|
-
"ease-out":
|
|
183
|
-
"ease-in-out":
|
|
184
|
-
"ease-in-quad":
|
|
185
|
-
"ease-out-quad":
|
|
186
|
-
"ease-in-out-quad":
|
|
186
|
+
"ease-in": Ae,
|
|
187
|
+
"ease-out": Ee,
|
|
188
|
+
"ease-in-out": Pe,
|
|
189
|
+
"ease-in-quad": Se,
|
|
190
|
+
"ease-out-quad": Te,
|
|
191
|
+
"ease-in-out-quad": _e,
|
|
187
192
|
"ease-in-cubic": te,
|
|
188
193
|
"ease-out-cubic": ee,
|
|
189
194
|
"ease-in-out-cubic": ne
|
|
190
195
|
};
|
|
191
|
-
function
|
|
196
|
+
function Ie(e) {
|
|
192
197
|
const [t, n, i, s] = e, r = 3 * t, a = 3 * (i - t) - r, o = 1 - r - a, c = 3 * n, l = 3 * (s - n) - c, u = 1 - c - l, h = (d) => ((o * d + a) * d + r) * d, f = (d) => ((u * d + l) * d + c) * d, m = (d) => (3 * o * d + 2 * a) * d + r, p = (d) => {
|
|
193
198
|
let g = d;
|
|
194
199
|
for (let k = 0; k < 8; k++) {
|
|
@@ -221,11 +226,11 @@ function lt(e, t = "out") {
|
|
|
221
226
|
const n = (i) => 1 - e(1 - i);
|
|
222
227
|
return t === "in" ? n : (i) => i < 0.5 ? n(i * 2) / 2 : e(i * 2 - 1) / 2 + 0.5;
|
|
223
228
|
}
|
|
224
|
-
function
|
|
229
|
+
function Re(e = 1, t = 0.3) {
|
|
225
230
|
const n = Math.max(1, e), i = t / (2 * Math.PI) * Math.asin(1 / n);
|
|
226
231
|
return (s) => s <= 0 ? 0 : s >= 1 ? 1 : n * Math.pow(2, -10 * s) * Math.sin((s - i) * (2 * Math.PI) / t) + 1;
|
|
227
232
|
}
|
|
228
|
-
const
|
|
233
|
+
const $e = (e) => {
|
|
229
234
|
if (e <= 0) return 0;
|
|
230
235
|
if (e >= 1) return 1;
|
|
231
236
|
if (e < 1 / 2.75) return 7.5625 * e * e;
|
|
@@ -240,7 +245,7 @@ const Re = (e) => {
|
|
|
240
245
|
const i = e - 2.625 / 2.75;
|
|
241
246
|
return 7.5625 * i * i + 0.984375;
|
|
242
247
|
};
|
|
243
|
-
function
|
|
248
|
+
function De(e = 1.70158) {
|
|
244
249
|
return (t) => {
|
|
245
250
|
if (t <= 0) return 0;
|
|
246
251
|
if (t >= 1) return 1;
|
|
@@ -248,7 +253,7 @@ function $e(e = 1.70158) {
|
|
|
248
253
|
return n * n * ((e + 1) * n + e) + 1;
|
|
249
254
|
};
|
|
250
255
|
}
|
|
251
|
-
function
|
|
256
|
+
function Le(e, t = "end") {
|
|
252
257
|
const n = Math.max(1, Math.floor(e));
|
|
253
258
|
return (i) => {
|
|
254
259
|
if (i >= 1) return 1;
|
|
@@ -266,22 +271,22 @@ function De(e, t = "end") {
|
|
|
266
271
|
}
|
|
267
272
|
};
|
|
268
273
|
}
|
|
269
|
-
function
|
|
274
|
+
function Oe(e) {
|
|
270
275
|
switch (e.type) {
|
|
271
276
|
case "steps":
|
|
272
|
-
return
|
|
277
|
+
return Le(e.count, e.position);
|
|
273
278
|
case "elastic":
|
|
274
|
-
return lt(
|
|
279
|
+
return lt(Re(e.amplitude, e.period), e.mode);
|
|
275
280
|
case "bounce":
|
|
276
|
-
return lt(
|
|
281
|
+
return lt($e, e.mode);
|
|
277
282
|
case "back":
|
|
278
|
-
return lt(
|
|
283
|
+
return lt(De(e.overshoot), e.mode);
|
|
279
284
|
}
|
|
280
285
|
}
|
|
281
|
-
function
|
|
282
|
-
return e === void 0 ? bt : ue(e) ?
|
|
286
|
+
function Ne(e) {
|
|
287
|
+
return e === void 0 ? bt : ue(e) ? Ie(e.points) : de(e) ? Oe(e) : Ce[e] ?? bt;
|
|
283
288
|
}
|
|
284
|
-
const At = 32,
|
|
289
|
+
const At = 32, Fe = 256, H = /* @__PURE__ */ new Map(), Xe = /[MmLlHhVvCcSsQqTtAaZz]/, Ye = /^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/, Ve = {
|
|
285
290
|
M: 2,
|
|
286
291
|
L: 2,
|
|
287
292
|
H: 1,
|
|
@@ -293,7 +298,7 @@ const At = 32, Ne = 256, H = /* @__PURE__ */ new Map(), Fe = /[MmLlHhVvCcSsQqTtA
|
|
|
293
298
|
A: 7,
|
|
294
299
|
Z: 0
|
|
295
300
|
};
|
|
296
|
-
function
|
|
301
|
+
function qe(e) {
|
|
297
302
|
const t = [];
|
|
298
303
|
let n = 0, i = null;
|
|
299
304
|
const s = () => {
|
|
@@ -301,7 +306,7 @@ function Ve(e) {
|
|
|
301
306
|
};
|
|
302
307
|
for (; n < e.length && (s(), !(n >= e.length)); ) {
|
|
303
308
|
const r = e[n];
|
|
304
|
-
if (
|
|
309
|
+
if (Xe.test(r)) {
|
|
305
310
|
i = { type: r, args: [] }, t.push(i), n++;
|
|
306
311
|
continue;
|
|
307
312
|
}
|
|
@@ -312,13 +317,13 @@ function Ve(e) {
|
|
|
312
317
|
i.args.push(r === "1" ? 1 : 0), n++;
|
|
313
318
|
continue;
|
|
314
319
|
}
|
|
315
|
-
const c =
|
|
320
|
+
const c = Ye.exec(e.slice(n));
|
|
316
321
|
if (!c) break;
|
|
317
322
|
i.args.push(parseFloat(c[0])), n += c[0].length;
|
|
318
323
|
}
|
|
319
324
|
return t;
|
|
320
325
|
}
|
|
321
|
-
function
|
|
326
|
+
function We(e, t, n, i, s, r, a, o, c) {
|
|
322
327
|
if (e === o && t === c) return [];
|
|
323
328
|
let l = Math.abs(n), u = Math.abs(i);
|
|
324
329
|
if (l === 0 || u === 0) return [[e, t, o, c, o, c]];
|
|
@@ -393,8 +398,8 @@ function rt(e) {
|
|
|
393
398
|
const u = /* @__PURE__ */ new Set(), h = (d) => {
|
|
394
399
|
l < 0 && (l = 0), d.subpath = l, n.push(d);
|
|
395
400
|
};
|
|
396
|
-
for (const { type: d, args: g } of
|
|
397
|
-
const b = d.toUpperCase(), v = d !== b, k =
|
|
401
|
+
for (const { type: d, args: g } of qe(e)) {
|
|
402
|
+
const b = d.toUpperCase(), v = d !== b, k = Ve[b];
|
|
398
403
|
if (b === "Z") {
|
|
399
404
|
(i !== r || s !== a) && h(z(i, s, r, a)), l >= 0 && u.add(l), i = r, s = a, o = c = null;
|
|
400
405
|
continue;
|
|
@@ -445,7 +450,7 @@ function rt(e) {
|
|
|
445
450
|
case "A": {
|
|
446
451
|
const T = y[5] + S, R = y[6] + x;
|
|
447
452
|
let _ = i, C = s;
|
|
448
|
-
for (const L of
|
|
453
|
+
for (const L of We(i, s, y[0], y[1], y[2], y[3], y[4], T, R))
|
|
449
454
|
h(nt(_, C, L)), _ = L[4], C = L[5];
|
|
450
455
|
i = T, s = R;
|
|
451
456
|
break;
|
|
@@ -463,9 +468,9 @@ function rt(e) {
|
|
|
463
468
|
m.push({ start: d, end: b, length: v, closed: y }), d = b;
|
|
464
469
|
}
|
|
465
470
|
const p = { segments: n, totalLength: f, subpaths: m };
|
|
466
|
-
return H.size >=
|
|
471
|
+
return H.size >= Fe && H.delete(H.keys().next().value), H.set(e, p), p;
|
|
467
472
|
}
|
|
468
|
-
function
|
|
473
|
+
function Be(e, t) {
|
|
469
474
|
const n = e.lengths;
|
|
470
475
|
if (t <= 0) return 0;
|
|
471
476
|
if (t >= e.length) return 1;
|
|
@@ -477,7 +482,7 @@ function We(e, t) {
|
|
|
477
482
|
const r = n[s] - n[i], a = r > 0 ? (t - n[i]) / r : 0;
|
|
478
483
|
return (i + a) / (n.length - 1);
|
|
479
484
|
}
|
|
480
|
-
function
|
|
485
|
+
function Ue(e, t) {
|
|
481
486
|
if (e.type === "L") {
|
|
482
487
|
const h = e.length > 0 ? Math.max(0, Math.min(1, t / e.length)) : 0;
|
|
483
488
|
return {
|
|
@@ -486,7 +491,7 @@ function Be(e, t) {
|
|
|
486
491
|
angle: Math.atan2(e.endY - e.startY, e.endX - e.startX) * 180 / Math.PI
|
|
487
492
|
};
|
|
488
493
|
}
|
|
489
|
-
const [n, i, s, r, a, o] = e.points, c =
|
|
494
|
+
const [n, i, s, r, a, o] = e.points, c = Be(e, t);
|
|
490
495
|
let l = Et(e.startX, n, s, a, c), u = Et(e.startY, i, r, o, c);
|
|
491
496
|
if (Math.hypot(l, u) < 1e-9) {
|
|
492
497
|
const h = c < 0.5 ? Math.min(1, c + 1e-3) : Math.max(0, c - 1e-3), f = X(e.startX, n, s, a, h), m = X(e.startY, i, r, o, h), p = X(e.startX, n, s, a, c), d = X(e.startY, i, r, o, c);
|
|
@@ -504,16 +509,16 @@ function ie(e, t, n = 0, i = e.length) {
|
|
|
504
509
|
for (let r = n; r < i; r++) {
|
|
505
510
|
const a = e[r];
|
|
506
511
|
if (s + a.length >= t || r === i - 1)
|
|
507
|
-
return
|
|
512
|
+
return Ue(a, t - s);
|
|
508
513
|
s += a.length;
|
|
509
514
|
}
|
|
510
515
|
return { x: 0, y: 0, angle: 0 };
|
|
511
516
|
}
|
|
512
|
-
function
|
|
517
|
+
function je(e, t) {
|
|
513
518
|
const { segments: n, totalLength: i } = rt(e);
|
|
514
519
|
return ie(n, Math.max(0, Math.min(1, t)) * i);
|
|
515
520
|
}
|
|
516
|
-
const
|
|
521
|
+
const He = 24, ze = 320, Qe = 2.5, Q = 72, Ge = 0.2, Ze = 128, it = /* @__PURE__ */ new Map();
|
|
517
522
|
let ht = 0, V;
|
|
518
523
|
const Pt = (e) => Math.round(e * 100) / 100;
|
|
519
524
|
function Ct(e, t) {
|
|
@@ -548,7 +553,7 @@ function $t(e) {
|
|
|
548
553
|
t += i, n += s;
|
|
549
554
|
return t /= e.length, n /= e.length, e.map(([i, s]) => [i - t, s - n]);
|
|
550
555
|
}
|
|
551
|
-
function
|
|
556
|
+
function Ke(e, t, n) {
|
|
552
557
|
const i = e.closed && t.closed;
|
|
553
558
|
if (n !== void 0)
|
|
554
559
|
return { offset: i ? Math.abs(n) % Q / Q : 0, reversed: n < 0 };
|
|
@@ -567,28 +572,28 @@ function Ze(e, t, n) {
|
|
|
567
572
|
}
|
|
568
573
|
return o;
|
|
569
574
|
}
|
|
570
|
-
function
|
|
575
|
+
function Je(e, t, n) {
|
|
571
576
|
return n ? ((t.reversed ? t.offset - e : e + t.offset) % 1 + 1) % 1 : t.reversed ? 1 - e : e;
|
|
572
577
|
}
|
|
573
|
-
function
|
|
578
|
+
function tn(e, t, n) {
|
|
574
579
|
return n ? ((t.reversed ? t.offset - e : e - t.offset) % 1 + 1) % 1 : t.reversed ? 1 - e : e;
|
|
575
580
|
}
|
|
576
|
-
function
|
|
577
|
-
const i = e.closed && t.closed, s =
|
|
578
|
-
|
|
579
|
-
Math.min(
|
|
581
|
+
function en(e, t, n) {
|
|
582
|
+
const i = e.closed && t.closed, s = Ke(e, t, n.shapeIndex), r = Math.max(
|
|
583
|
+
He,
|
|
584
|
+
Math.min(ze, Math.ceil(Math.max(e.length, t.length) / Qe))
|
|
580
585
|
), a = /* @__PURE__ */ new Set(), o = (h) => a.add(Math.round(h * 1e7) / 1e7);
|
|
581
586
|
for (let h = 0; h <= r; h++) o(h / r);
|
|
582
587
|
for (const h of It(e)) o(h);
|
|
583
|
-
for (const h of It(t)) o(
|
|
588
|
+
for (const h of It(t)) o(tn(h, s, i));
|
|
584
589
|
let c = [...a].sort((h, f) => h - f);
|
|
585
590
|
i && (c = c.filter((h) => h < 1));
|
|
586
591
|
const l = [], u = [];
|
|
587
592
|
for (const h of c)
|
|
588
|
-
l.push(...vt(e, h)), u.push(...vt(t,
|
|
589
|
-
return
|
|
593
|
+
l.push(...vt(e, h)), u.push(...vt(t, Je(h, s, i)));
|
|
594
|
+
return nn({ from: l, to: u, closed: i });
|
|
590
595
|
}
|
|
591
|
-
function
|
|
596
|
+
function nn(e) {
|
|
592
597
|
const t = e.from.length / 2;
|
|
593
598
|
if (t <= 3) return e;
|
|
594
599
|
const n = new Uint8Array(t);
|
|
@@ -596,7 +601,7 @@ function en(e) {
|
|
|
596
601
|
const i = [[0, t - 1]];
|
|
597
602
|
for (; i.length > 0; ) {
|
|
598
603
|
const [a, o] = i.pop();
|
|
599
|
-
let c = -1, l =
|
|
604
|
+
let c = -1, l = Ge;
|
|
600
605
|
for (let u = a + 1; u < o; u++) {
|
|
601
606
|
const h = Math.max(Dt(e.from, a, o, u), Dt(e.to, a, o, u));
|
|
602
607
|
h > l && (l = h, c = u);
|
|
@@ -612,28 +617,28 @@ function Dt(e, t, n, i) {
|
|
|
612
617
|
const s = e[t * 2], r = e[t * 2 + 1], a = e[n * 2] - s, o = e[n * 2 + 1] - r, c = e[i * 2] - s, l = e[i * 2 + 1] - r, u = a * a + o * o, h = u === 0 ? 0 : Math.max(0, Math.min(1, (c * a + l * o) / u));
|
|
613
618
|
return Math.hypot(c - h * a, l - h * o);
|
|
614
619
|
}
|
|
615
|
-
function
|
|
620
|
+
function sn(e, t, n) {
|
|
616
621
|
const i = n.shapeIndex;
|
|
617
622
|
if (V && V.from === e && V.to === t && V.shapeIndex === i) return V.plan;
|
|
618
623
|
const r = it.get(String(i ?? "auto"))?.get(e)?.get(t);
|
|
619
624
|
if (r)
|
|
620
625
|
return V = { from: e, to: t, shapeIndex: i, plan: r }, r;
|
|
621
626
|
const a = rt(e).subpaths.filter((m) => m.length > 0).length === rt(t).subpaths.filter((m) => m.length > 0).length, o = Ct(e, !a), c = Ct(t, !a), l = {
|
|
622
|
-
pairs: o.map((m, p) =>
|
|
627
|
+
pairs: o.map((m, p) => en(m, c[p], n))
|
|
623
628
|
};
|
|
624
|
-
ht >=
|
|
629
|
+
ht >= Ze && (it.clear(), ht = 0);
|
|
625
630
|
const u = String(i ?? "auto"), h = it.get(u) ?? /* @__PURE__ */ new Map();
|
|
626
631
|
it.set(u, h);
|
|
627
632
|
const f = h.get(e) ?? /* @__PURE__ */ new Map();
|
|
628
633
|
return h.set(e, f), f.set(t, l), ht++, V = { from: e, to: t, shapeIndex: i, plan: l }, l;
|
|
629
634
|
}
|
|
630
|
-
function
|
|
635
|
+
function rn(e, t, n, i = {}) {
|
|
631
636
|
if (!e) return t;
|
|
632
637
|
if (!t) return e;
|
|
633
638
|
const s = Math.max(0, Math.min(1, n));
|
|
634
639
|
if (s === 0) return e;
|
|
635
640
|
if (s === 1) return t;
|
|
636
|
-
const r =
|
|
641
|
+
const r = sn(e, t, i);
|
|
637
642
|
if (r.pairs.length === 0) return s < 0.5 ? e : t;
|
|
638
643
|
let a = "";
|
|
639
644
|
for (const o of r.pairs) {
|
|
@@ -645,27 +650,27 @@ function sn(e, t, n, i = {}) {
|
|
|
645
650
|
}
|
|
646
651
|
return a;
|
|
647
652
|
}
|
|
648
|
-
function
|
|
653
|
+
function an(e) {
|
|
649
654
|
return /^\s*[Mm]\s*[-+]?(?:\d|\.\d)/.test(e);
|
|
650
655
|
}
|
|
651
|
-
const
|
|
652
|
-
function
|
|
656
|
+
const on = 0.9995;
|
|
657
|
+
function cn() {
|
|
653
658
|
return [0, 0, 0, 1];
|
|
654
659
|
}
|
|
655
|
-
function
|
|
660
|
+
function ln(e, t) {
|
|
656
661
|
return e[0] * t[0] + e[1] * t[1] + e[2] * t[2] + e[3] * t[3];
|
|
657
662
|
}
|
|
658
|
-
function
|
|
663
|
+
function hn(e) {
|
|
659
664
|
return Math.hypot(e[0], e[1], e[2], e[3]);
|
|
660
665
|
}
|
|
661
666
|
function K(e) {
|
|
662
|
-
const t =
|
|
663
|
-
return t === 0 ?
|
|
667
|
+
const t = hn(e);
|
|
668
|
+
return t === 0 ? cn() : [e[0] / t, e[1] / t, e[2] / t, e[3] / t];
|
|
664
669
|
}
|
|
665
|
-
function
|
|
670
|
+
function un(e, t, n) {
|
|
666
671
|
const i = K(e);
|
|
667
|
-
let s = K(t), r =
|
|
668
|
-
if (r < 0 && (s = [-s[0], -s[1], -s[2], -s[3]], r = -r), r >
|
|
672
|
+
let s = K(t), r = ln(i, s);
|
|
673
|
+
if (r < 0 && (s = [-s[0], -s[1], -s[2], -s[3]], r = -r), r > on)
|
|
669
674
|
return K([
|
|
670
675
|
i[0] + (s[0] - i[0]) * n,
|
|
671
676
|
i[1] + (s[1] - i[1]) * n,
|
|
@@ -691,23 +696,23 @@ function Lt(e) {
|
|
|
691
696
|
];
|
|
692
697
|
return ut.size < se && ut.set(e, i), i;
|
|
693
698
|
}
|
|
694
|
-
const Ot = (e) => e.charCodeAt(0) === 35, Nt = (e) => e.startsWith("rgb"), Ft = (e) => e.startsWith("rgba"),
|
|
695
|
-
function
|
|
699
|
+
const Ot = (e) => e.charCodeAt(0) === 35, Nt = (e) => e.startsWith("rgb"), Ft = (e) => e.startsWith("rgba"), dn = /rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*([\d.]+))?\s*\)/, ft = (e) => Math.round(e).toString(16).padStart(2, "0");
|
|
700
|
+
function fn(e, t, n) {
|
|
696
701
|
return `#${ft(e)}${ft(t)}${ft(n)}`;
|
|
697
702
|
}
|
|
698
703
|
function Xt(e) {
|
|
699
704
|
const t = dt.get(e);
|
|
700
705
|
if (t) return t;
|
|
701
|
-
const n = e.match(
|
|
706
|
+
const n = e.match(dn);
|
|
702
707
|
if (!n)
|
|
703
708
|
throw new Error(`Invalid rgb color: ${e}`);
|
|
704
709
|
const i = parseInt(n[1], 10), s = parseInt(n[2], 10), r = parseInt(n[3], 10), a = n[4] !== void 0 ? [i, s, r, parseFloat(n[4])] : [i, s, r];
|
|
705
710
|
return dt.size < se && dt.set(e, a), a;
|
|
706
711
|
}
|
|
707
|
-
const
|
|
712
|
+
const pn = (e, t, n) => {
|
|
708
713
|
if (Ot(e) && Ot(t)) {
|
|
709
714
|
const [i, s, r] = Lt(e), [a, o, c] = Lt(t), l = F(i, a, n), u = F(s, o, n), h = F(r, c, n);
|
|
710
|
-
return
|
|
715
|
+
return fn(l, u, h);
|
|
711
716
|
}
|
|
712
717
|
if ((Nt(e) || Ft(e)) && (Nt(t) || Ft(t))) {
|
|
713
718
|
const i = Xt(e), s = Xt(t), r = Math.round(F(i[0], s[0], n)), a = Math.round(F(i[1], s[1], n)), o = Math.round(F(i[2], s[2], n));
|
|
@@ -718,16 +723,16 @@ const fn = (e, t, n) => {
|
|
|
718
723
|
return `rgb(${r}, ${a}, ${o})`;
|
|
719
724
|
}
|
|
720
725
|
return n < 1 ? e : t;
|
|
721
|
-
},
|
|
726
|
+
}, mn = (e, t, n) => {
|
|
722
727
|
const i = Math.min(e.length, t.length), s = [];
|
|
723
728
|
for (let r = 0; r < i; r++)
|
|
724
729
|
s.push(F(e[r], t[r], n));
|
|
725
730
|
return s;
|
|
726
|
-
},
|
|
727
|
-
function
|
|
728
|
-
return t === "slerp" ?
|
|
731
|
+
}, gn = (e, t, n) => un(e, t, n), Yt = (e, t, n) => n < 1 ? e : t, yn = (e, t, n) => rn(e, t, n);
|
|
732
|
+
function bn(e, t) {
|
|
733
|
+
return t === "slerp" ? gn : typeof e == "number" ? F : Array.isArray(e) ? mn : typeof e == "string" ? e.startsWith("#") || e.startsWith("rgb") ? pn : an(e) ? yn : Yt : Yt;
|
|
729
734
|
}
|
|
730
|
-
function
|
|
735
|
+
function vn(e) {
|
|
731
736
|
const t = [...e.keyframes].sort((n, i) => n.time - i.time);
|
|
732
737
|
return {
|
|
733
738
|
...e,
|
|
@@ -801,8 +806,8 @@ class pt {
|
|
|
801
806
|
return;
|
|
802
807
|
if (i.time === t)
|
|
803
808
|
return i.value;
|
|
804
|
-
const r = s.time - i.time, a = (t - i.time) / r, c =
|
|
805
|
-
return
|
|
809
|
+
const r = s.time - i.time, a = (t - i.time) / r, c = Ne(s.easing)(a);
|
|
810
|
+
return bn(i.value, this.track.interpolation)(i.value, s.value, c);
|
|
806
811
|
}
|
|
807
812
|
/**
|
|
808
813
|
* Find the keyframes surrounding a given time.
|
|
@@ -815,12 +820,12 @@ class pt {
|
|
|
815
820
|
return { from: null, to: null };
|
|
816
821
|
}
|
|
817
822
|
}
|
|
818
|
-
class
|
|
823
|
+
class kn {
|
|
819
824
|
track;
|
|
820
825
|
targets;
|
|
821
826
|
sampler;
|
|
822
827
|
constructor(t) {
|
|
823
|
-
this.track = t, this.targets = q(t), this.sampler = new
|
|
828
|
+
this.track = t, this.targets = q(t), this.sampler = new be(t.spring);
|
|
824
829
|
}
|
|
825
830
|
getValueAtTime(t) {
|
|
826
831
|
return this.sampler.valueAt(t - U(0, this.targets.length, this.track.delay, this.track.stagger));
|
|
@@ -842,7 +847,7 @@ class vn {
|
|
|
842
847
|
return this.track;
|
|
843
848
|
}
|
|
844
849
|
}
|
|
845
|
-
class
|
|
850
|
+
class xn {
|
|
846
851
|
track;
|
|
847
852
|
targets;
|
|
848
853
|
duration;
|
|
@@ -869,8 +874,8 @@ class kn {
|
|
|
869
874
|
return this.track;
|
|
870
875
|
}
|
|
871
876
|
}
|
|
872
|
-
function
|
|
873
|
-
const n = { ...
|
|
877
|
+
function wn(e, t) {
|
|
878
|
+
const n = { ...je(e.pathData, t) };
|
|
874
879
|
if (e.matrix) {
|
|
875
880
|
const [i, s, r, a, o, c] = e.matrix, { x: l, y: u } = n;
|
|
876
881
|
n.x = i * l + r * u + o, n.y = s * l + a * u + c;
|
|
@@ -884,16 +889,16 @@ const mt = {
|
|
|
884
889
|
lowerCase: "abcdefghijklmnopqrstuvwxyz",
|
|
885
890
|
upperAndLowerCase: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
886
891
|
numbers: "0123456789"
|
|
887
|
-
},
|
|
888
|
-
function
|
|
892
|
+
}, Mn = 20;
|
|
893
|
+
function Sn(e) {
|
|
889
894
|
const t = mt[e ?? "upperCase"] ?? e ?? mt.upperCase, n = Array.from(t);
|
|
890
895
|
return n.length > 0 ? n : Array.from(mt.upperCase);
|
|
891
896
|
}
|
|
892
|
-
function
|
|
897
|
+
function Tn(e, t, n) {
|
|
893
898
|
let i = (e | 0) ^ Math.imul(t + 1, 2654435761) ^ Math.imul(n + 1, 2246822507);
|
|
894
899
|
return i = Math.imul(i ^ i >>> 16, 2146121005), i = Math.imul(i ^ i >>> 15, 2221713035), (i ^ i >>> 16) >>> 0;
|
|
895
900
|
}
|
|
896
|
-
function
|
|
901
|
+
function _n(e, t, n = 0) {
|
|
897
902
|
const i = e.from ?? "", s = e.to, r = Math.max(0, Math.min(1, t));
|
|
898
903
|
if (r <= 0) return i;
|
|
899
904
|
if (r >= 1) return s;
|
|
@@ -902,16 +907,16 @@ function Tn(e, t, n = 0) {
|
|
|
902
907
|
const v = Math.round(r * Math.max(a.length, o.length));
|
|
903
908
|
return c ? a.slice(0, Math.max(0, a.length - v)).join("") + o.slice(Math.max(0, o.length - v)).join("") : o.slice(0, v).join("") + a.slice(v).join("");
|
|
904
909
|
}
|
|
905
|
-
const l = Math.max(0, Math.min(0.999, e.revealDelay ?? 0)), u = Math.max(0, (r - l) / (1 - l)), h = Math.floor(u * o.length), f = e.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * r), m =
|
|
910
|
+
const l = Math.max(0, Math.min(0.999, e.revealDelay ?? 0)), u = Math.max(0, (r - l) / (1 - l)), h = Math.floor(u * o.length), f = e.tweenLength === !1 ? o.length : Math.round(a.length + (o.length - a.length) * r), m = Sn(e.chars), p = e.refreshRate ?? Mn, d = p > 0 ? Math.floor(n * p / 1e3) : 0, g = e.seed ?? 1;
|
|
906
911
|
let b = "";
|
|
907
912
|
for (let v = 0; v < f; v++) {
|
|
908
913
|
const k = c ? v >= f - h : v < h, M = c ? o[o.length - (f - v)] : o[v];
|
|
909
914
|
k && M !== void 0 || M === " " || M === `
|
|
910
|
-
` ? b += M : b += m[
|
|
915
|
+
` ? b += M : b += m[Tn(g, v, d) % m.length];
|
|
911
916
|
}
|
|
912
917
|
return b;
|
|
913
918
|
}
|
|
914
|
-
class
|
|
919
|
+
class An {
|
|
915
920
|
id;
|
|
916
921
|
name;
|
|
917
922
|
_captions;
|
|
@@ -980,6 +985,14 @@ class _n {
|
|
|
980
985
|
set speed(t) {
|
|
981
986
|
this._config.speed = t;
|
|
982
987
|
}
|
|
988
|
+
/** Drawings per second (0: every frame); see `TimelineConfig.drawingRate`. */
|
|
989
|
+
get drawingRate() {
|
|
990
|
+
return this._config.drawingRate ?? 0;
|
|
991
|
+
}
|
|
992
|
+
set drawingRate(t) {
|
|
993
|
+
const n = { ...this._config };
|
|
994
|
+
t > 0 ? n.drawingRate = t : delete n.drawingRate, this._config = n;
|
|
995
|
+
}
|
|
983
996
|
/**
|
|
984
997
|
* Start or resume playback.
|
|
985
998
|
* If at the end and direction is forward, reset to beginning.
|
|
@@ -1058,7 +1071,7 @@ class _n {
|
|
|
1058
1071
|
*/
|
|
1059
1072
|
getStateAtTime(t) {
|
|
1060
1073
|
const n = /* @__PURE__ */ new Map();
|
|
1061
|
-
if (this._hasSharedWrites())
|
|
1074
|
+
if (t = me(t, this._config.drawingRate ?? 0), this._hasSharedWrites())
|
|
1062
1075
|
this._resolveShared(t, n);
|
|
1063
1076
|
else
|
|
1064
1077
|
for (const [i, s] of this._trackPlayers) {
|
|
@@ -1110,12 +1123,12 @@ class _n {
|
|
|
1110
1123
|
o || (o = /* @__PURE__ */ new Map(), t.set(i, o));
|
|
1111
1124
|
const c = this._textTracks.get(n);
|
|
1112
1125
|
if (c && typeof r == "number") {
|
|
1113
|
-
o.set("text",
|
|
1126
|
+
o.set("text", _n(c.textConfig, r, Math.max(0, a)));
|
|
1114
1127
|
return;
|
|
1115
1128
|
}
|
|
1116
1129
|
const l = this._motionPathTracks.get(n);
|
|
1117
1130
|
if (l && typeof r == "number") {
|
|
1118
|
-
const u =
|
|
1131
|
+
const u = wn(l.motionPathConfig, r);
|
|
1119
1132
|
o.set("motionPathX", u.x), o.set("motionPathY", u.y), l.motionPathConfig.autoRotate && o.set("motionPathRotate", u.angle);
|
|
1120
1133
|
} else
|
|
1121
1134
|
o.set(s, r);
|
|
@@ -1143,11 +1156,11 @@ class _n {
|
|
|
1143
1156
|
*/
|
|
1144
1157
|
addTrack(t) {
|
|
1145
1158
|
if (this._tracks.push(t), this._sharedWrites = null, gt(t)) {
|
|
1146
|
-
this._trackPlayers.set(t.id, new
|
|
1159
|
+
this._trackPlayers.set(t.id, new xn(t));
|
|
1147
1160
|
return;
|
|
1148
1161
|
}
|
|
1149
1162
|
if (yt(t)) {
|
|
1150
|
-
this._trackPlayers.set(t.id, new
|
|
1163
|
+
this._trackPlayers.set(t.id, new kn(t)), this._springTracks.set(t.id, t);
|
|
1151
1164
|
return;
|
|
1152
1165
|
}
|
|
1153
1166
|
if (zt(t))
|
|
@@ -1325,8 +1338,8 @@ class _n {
|
|
|
1325
1338
|
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);
|
|
1326
1339
|
}
|
|
1327
1340
|
}
|
|
1328
|
-
const
|
|
1329
|
-
function
|
|
1341
|
+
const En = 100;
|
|
1342
|
+
function Pn(e, t, n, i) {
|
|
1330
1343
|
const s = [], r = [], { duration: a, alternate: o } = i, c = (m, p, d, g) => {
|
|
1331
1344
|
r.push([m, p]);
|
|
1332
1345
|
const b = [];
|
|
@@ -1336,14 +1349,14 @@ function En(e, t, n, i) {
|
|
|
1336
1349
|
for (const v of b) s.push({ kind: "event", index: v, direction: d });
|
|
1337
1350
|
};
|
|
1338
1351
|
let l = t.time, u = t.direction, h = t.fresh === !0;
|
|
1339
|
-
const f = Math.min(
|
|
1352
|
+
const f = Math.min(En, Math.max(0, n.iteration - t.iteration));
|
|
1340
1353
|
for (let m = 0; m < f; m++) {
|
|
1341
1354
|
const p = u === "forward" ? a : 0;
|
|
1342
1355
|
c(l, p, u, h), s.push({ kind: "repeat" }), o ? (u = u === "forward" ? "reverse" : "forward", l = p, h = !1) : (l = u === "forward" ? 0 : a, h = !0);
|
|
1343
1356
|
}
|
|
1344
1357
|
return f > 0 && i.holding && !o ? { crossings: s, passes: r } : (c(l, n.time, u, h), { crossings: s, passes: r });
|
|
1345
1358
|
}
|
|
1346
|
-
function
|
|
1359
|
+
function Cn(e) {
|
|
1347
1360
|
return { ...e, ...Array.isArray(e.end) && { end: [...e.end] } };
|
|
1348
1361
|
}
|
|
1349
1362
|
function G(e) {
|
|
@@ -1355,7 +1368,7 @@ function G(e) {
|
|
|
1355
1368
|
...e.stagger !== void 0 && { stagger: { ...e.stagger } }
|
|
1356
1369
|
};
|
|
1357
1370
|
}
|
|
1358
|
-
function
|
|
1371
|
+
function In(e) {
|
|
1359
1372
|
if (gt(e)) {
|
|
1360
1373
|
const t = e;
|
|
1361
1374
|
return {
|
|
@@ -1363,7 +1376,7 @@ function Cn(e) {
|
|
|
1363
1376
|
target: t.target,
|
|
1364
1377
|
property: t.property,
|
|
1365
1378
|
kind: "inertia",
|
|
1366
|
-
inertia:
|
|
1379
|
+
inertia: Cn(t.inertia),
|
|
1367
1380
|
...G(t)
|
|
1368
1381
|
};
|
|
1369
1382
|
}
|
|
@@ -1400,7 +1413,7 @@ function Cn(e) {
|
|
|
1400
1413
|
...G(t)
|
|
1401
1414
|
};
|
|
1402
1415
|
}
|
|
1403
|
-
return
|
|
1416
|
+
return vn({
|
|
1404
1417
|
id: e.id,
|
|
1405
1418
|
target: e.target,
|
|
1406
1419
|
property: e.property,
|
|
@@ -1415,15 +1428,15 @@ function at(e) {
|
|
|
1415
1428
|
throw new Error(
|
|
1416
1429
|
`tinyfly: this animation uses format version ${t}, but this tinyfly reads up to version ${st}. Update tinyfly to play it.`
|
|
1417
1430
|
);
|
|
1418
|
-
return new
|
|
1431
|
+
return new An({
|
|
1419
1432
|
id: e.id,
|
|
1420
1433
|
name: e.name,
|
|
1421
1434
|
config: e.config,
|
|
1422
|
-
tracks: e.tracks.map(
|
|
1435
|
+
tracks: e.tracks.map(In),
|
|
1423
1436
|
captions: e.captions
|
|
1424
1437
|
});
|
|
1425
1438
|
}
|
|
1426
|
-
function
|
|
1439
|
+
function Rn(e) {
|
|
1427
1440
|
const [t, n, i, s] = e;
|
|
1428
1441
|
return [
|
|
1429
1442
|
1 - 2 * (n * n + i * i),
|
|
@@ -1444,10 +1457,10 @@ function In(e) {
|
|
|
1444
1457
|
1
|
|
1445
1458
|
];
|
|
1446
1459
|
}
|
|
1447
|
-
function
|
|
1448
|
-
return !Array.isArray(e) || e.length !== 4 ? null : `matrix3d(${
|
|
1460
|
+
function $n(e) {
|
|
1461
|
+
return !Array.isArray(e) || e.length !== 4 ? null : `matrix3d(${Rn(K(e)).map((n) => Math.round(n * 1e6) / 1e6 + 0).join(", ")})`;
|
|
1449
1462
|
}
|
|
1450
|
-
const
|
|
1463
|
+
const Dn = /* @__PURE__ */ new Set([
|
|
1451
1464
|
"blur",
|
|
1452
1465
|
"brightness",
|
|
1453
1466
|
"glow",
|
|
@@ -1456,16 +1469,16 @@ const $n = /* @__PURE__ */ new Set([
|
|
|
1456
1469
|
"shadowY",
|
|
1457
1470
|
"shadowBlur",
|
|
1458
1471
|
"shadowColor"
|
|
1459
|
-
]),
|
|
1460
|
-
function
|
|
1472
|
+
]), Ln = "#ffffff", On = "rgba(0, 0, 0, 0.5)";
|
|
1473
|
+
function Nn(e) {
|
|
1461
1474
|
const t = [];
|
|
1462
|
-
if (e.blur !== void 0 && t.push(`blur(${Math.max(0, e.blur)}px)`), e.brightness !== void 0 && t.push(`brightness(${Math.max(0, e.brightness)})`), e.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, e.glow)}px ${e.glowColor ??
|
|
1475
|
+
if (e.blur !== void 0 && t.push(`blur(${Math.max(0, e.blur)}px)`), e.brightness !== void 0 && t.push(`brightness(${Math.max(0, e.brightness)})`), e.glow !== void 0 && t.push(`drop-shadow(0 0 ${Math.max(0, e.glow)}px ${e.glowColor ?? Ln})`), e.shadowX !== void 0 || e.shadowY !== void 0 || e.shadowBlur !== void 0) {
|
|
1463
1476
|
const n = e.shadowX ?? 0, i = e.shadowY ?? 0, s = Math.max(0, e.shadowBlur ?? 0);
|
|
1464
|
-
t.push(`drop-shadow(${n}px ${i}px ${s}px ${e.shadowColor ??
|
|
1477
|
+
t.push(`drop-shadow(${n}px ${i}px ${s}px ${e.shadowColor ?? On})`);
|
|
1465
1478
|
}
|
|
1466
1479
|
return t.length > 0 ? t.join(" ") : null;
|
|
1467
1480
|
}
|
|
1468
|
-
function
|
|
1481
|
+
function Fn(e, t) {
|
|
1469
1482
|
const n = e.childNodes.length === 1 ? e.firstChild : null;
|
|
1470
1483
|
if (n && n.nodeType === 3) {
|
|
1471
1484
|
const i = n;
|
|
@@ -1474,7 +1487,7 @@ function Nn(e, t) {
|
|
|
1474
1487
|
}
|
|
1475
1488
|
e.textContent !== t && (e.textContent = t);
|
|
1476
1489
|
}
|
|
1477
|
-
function
|
|
1490
|
+
function Xn(e) {
|
|
1478
1491
|
if (!("ownerSVGElement" in e)) return;
|
|
1479
1492
|
const t = e.style;
|
|
1480
1493
|
!t || t.transformBox || (t.transformBox = "fill-box", t.transformOrigin || (t.transformOrigin = "50% 50%"));
|
|
@@ -1505,7 +1518,7 @@ const Vt = /* @__PURE__ */ new Set([
|
|
|
1505
1518
|
"gap",
|
|
1506
1519
|
"rowGap",
|
|
1507
1520
|
"columnGap"
|
|
1508
|
-
]),
|
|
1521
|
+
]), Yn = /* @__PURE__ */ new Set([
|
|
1509
1522
|
"x",
|
|
1510
1523
|
"y",
|
|
1511
1524
|
"z",
|
|
@@ -1525,7 +1538,7 @@ const Vt = /* @__PURE__ */ new Set([
|
|
|
1525
1538
|
"motionPathX",
|
|
1526
1539
|
"motionPathY",
|
|
1527
1540
|
"motionPathRotate"
|
|
1528
|
-
]),
|
|
1541
|
+
]), Vn = [
|
|
1529
1542
|
"x",
|
|
1530
1543
|
"motionPathX",
|
|
1531
1544
|
"y",
|
|
@@ -1543,7 +1556,7 @@ const Vt = /* @__PURE__ */ new Set([
|
|
|
1543
1556
|
"scaleZ",
|
|
1544
1557
|
"skewX",
|
|
1545
1558
|
"skewY"
|
|
1546
|
-
],
|
|
1559
|
+
], qn = /* @__PURE__ */ new Set(["childPerspective", "perspectiveOriginX", "perspectiveOriginY"]), Wn = /* @__PURE__ */ new Set(["originX", "originY"]), Bn = /* @__PURE__ */ new Set(["clipTop", "clipRight", "clipBottom", "clipLeft"]), Un = /* @__PURE__ */ new Set(["drawOn"]), jn = {
|
|
1547
1560
|
fill: "backgroundColor",
|
|
1548
1561
|
stroke: "borderColor",
|
|
1549
1562
|
strokeWidth: "borderWidth",
|
|
@@ -1558,7 +1571,7 @@ const Vt = /* @__PURE__ */ new Set([
|
|
|
1558
1571
|
strokeDashoffset: "strokeDashoffset",
|
|
1559
1572
|
fillOpacity: "fillOpacity",
|
|
1560
1573
|
strokeOpacity: "strokeOpacity"
|
|
1561
|
-
},
|
|
1574
|
+
}, Hn = "http://www.w3.org/2000/svg";
|
|
1562
1575
|
class kt {
|
|
1563
1576
|
targets = /* @__PURE__ */ new Map();
|
|
1564
1577
|
/**
|
|
@@ -1601,20 +1614,20 @@ class kt {
|
|
|
1601
1614
|
let i = null, s = null, r = null, a = null, o = null;
|
|
1602
1615
|
const c = n.has("motionPathX"), l = n.has("motionPathY"), u = n.has("motionPathRotate");
|
|
1603
1616
|
for (const [p, d] of n)
|
|
1604
|
-
if (!(p === "x" && c) && !(p === "y" && l) && !((p === "rotate" || p === "rotateZ") && u) && !
|
|
1605
|
-
if (
|
|
1617
|
+
if (!(p === "x" && c) && !(p === "y" && l) && !((p === "rotate" || p === "rotateZ") && u) && !Un.has(p)) {
|
|
1618
|
+
if (Yn.has(p))
|
|
1606
1619
|
(i ??= {})[p] = d;
|
|
1607
|
-
else if (Vn.has(p))
|
|
1608
|
-
typeof d == "number" && ((s ??= {})[p] = d);
|
|
1609
1620
|
else if (qn.has(p))
|
|
1610
|
-
typeof d == "number" && ((
|
|
1621
|
+
typeof d == "number" && ((s ??= {})[p] = d);
|
|
1611
1622
|
else if (Wn.has(p))
|
|
1623
|
+
typeof d == "number" && ((r ??= {})[p] = d);
|
|
1624
|
+
else if (Bn.has(p))
|
|
1612
1625
|
typeof d == "number" && ((a ??= {})[p] = d);
|
|
1613
|
-
else if (
|
|
1626
|
+
else if (Dn.has(p))
|
|
1614
1627
|
(o ??= {})[p] = d;
|
|
1615
1628
|
else if (p !== "perspective") {
|
|
1616
1629
|
if (p !== "shine") if (p === "text" && typeof d == "string")
|
|
1617
|
-
|
|
1630
|
+
Fn(t, d);
|
|
1618
1631
|
else if (p === "d" && typeof d == "string") {
|
|
1619
1632
|
const g = t;
|
|
1620
1633
|
(g.tagName?.toLowerCase() === "path" ? g : g.querySelector?.("path"))?.setAttribute?.("d", d);
|
|
@@ -1626,13 +1639,13 @@ class kt {
|
|
|
1626
1639
|
typeof h == "number" && this.applyShine(t, h);
|
|
1627
1640
|
const f = [], m = n.get("perspective");
|
|
1628
1641
|
if (typeof m == "number" && m > 0 && f.push(`perspective(${m}px)`), i)
|
|
1629
|
-
for (const p of
|
|
1642
|
+
for (const p of Vn) {
|
|
1630
1643
|
const d = i[p];
|
|
1631
1644
|
if (d === void 0) continue;
|
|
1632
1645
|
const g = this.buildTransformPart(p, d);
|
|
1633
1646
|
g && f.push(g);
|
|
1634
1647
|
}
|
|
1635
|
-
if (f.length > 0 && (t.style.transform = f.join(" "),
|
|
1648
|
+
if (f.length > 0 && (t.style.transform = f.join(" "), Xn(t)), s && (s.childPerspective !== void 0 && (t.style.perspective = `${s.childPerspective}px`), (s.perspectiveOriginX !== void 0 || s.perspectiveOriginY !== void 0) && (t.style.perspectiveOrigin = `${s.perspectiveOriginX ?? 50}% ${s.perspectiveOriginY ?? 50}%`)), r) {
|
|
1636
1649
|
const p = r.originX ?? 50, d = r.originY ?? 50;
|
|
1637
1650
|
t.style.transformOrigin = `${p}% ${d}%`;
|
|
1638
1651
|
}
|
|
@@ -1641,7 +1654,7 @@ class kt {
|
|
|
1641
1654
|
t.style.clipPath = `inset(${p}% ${d}% ${g}% ${b}%)`;
|
|
1642
1655
|
}
|
|
1643
1656
|
if (o) {
|
|
1644
|
-
const p =
|
|
1657
|
+
const p = Nn(o);
|
|
1645
1658
|
p && (t.style.filter = p);
|
|
1646
1659
|
}
|
|
1647
1660
|
}
|
|
@@ -1649,7 +1662,7 @@ class kt {
|
|
|
1649
1662
|
* Build a transform function string for a property.
|
|
1650
1663
|
*/
|
|
1651
1664
|
buildTransformPart(t, n) {
|
|
1652
|
-
if (t === "quaternion") return
|
|
1665
|
+
if (t === "quaternion") return $n(n);
|
|
1653
1666
|
if (typeof n != "number") return null;
|
|
1654
1667
|
switch (t) {
|
|
1655
1668
|
case "x":
|
|
@@ -1702,11 +1715,11 @@ class kt {
|
|
|
1702
1715
|
*/
|
|
1703
1716
|
applyStyleProperty(t, n, i) {
|
|
1704
1717
|
let s;
|
|
1705
|
-
if (t.namespaceURI ===
|
|
1718
|
+
if (t.namespaceURI === Hn && n in qt) {
|
|
1706
1719
|
const o = Array.isArray(i) ? i.join(", ") : String(i);
|
|
1707
1720
|
t.style[qt[n]] = o;
|
|
1708
1721
|
return;
|
|
1709
|
-
} else n === "fill" && t.dataset?.elementType === "text" ? s = "color" : s =
|
|
1722
|
+
} else n === "fill" && t.dataset?.elementType === "text" ? s = "color" : s = jn[n] ?? n;
|
|
1710
1723
|
let a;
|
|
1711
1724
|
typeof i == "number" ? Vt.has(n) || Vt.has(s) ? a = `${i}px` : a = String(i) : Array.isArray(i) ? a = i.join(", ") : a = i, t.style[s] = a;
|
|
1712
1725
|
}
|
|
@@ -1750,7 +1763,7 @@ class Wt {
|
|
|
1750
1763
|
});
|
|
1751
1764
|
}
|
|
1752
1765
|
}
|
|
1753
|
-
function
|
|
1766
|
+
function zn(e, t, n, i, s) {
|
|
1754
1767
|
const r = n - s;
|
|
1755
1768
|
if (r < 0) {
|
|
1756
1769
|
t.paused || t.pause(), t.currentTime = 0;
|
|
@@ -1996,7 +2009,7 @@ class St {
|
|
|
1996
2009
|
/** Sync all discovered media targets to a timeline time. */
|
|
1997
2010
|
syncAllMedia(t, n) {
|
|
1998
2011
|
for (const i of this.mediaTargets)
|
|
1999
|
-
|
|
2012
|
+
zn(i.sync, i.el, t, n, i.startTime);
|
|
2000
2013
|
}
|
|
2001
2014
|
/**
|
|
2002
2015
|
* Load animation from inline JSON string.
|
|
@@ -2159,7 +2172,7 @@ class St {
|
|
|
2159
2172
|
this.playhead = i;
|
|
2160
2173
|
const s = this.markers;
|
|
2161
2174
|
if (s.length === 0) return;
|
|
2162
|
-
const { crossings: r } =
|
|
2175
|
+
const { crossings: r } = Pn(
|
|
2163
2176
|
s.map((a) => a.time),
|
|
2164
2177
|
t,
|
|
2165
2178
|
i,
|
|
@@ -2187,14 +2200,14 @@ class St {
|
|
|
2187
2200
|
}
|
|
2188
2201
|
}
|
|
2189
2202
|
}
|
|
2190
|
-
async function
|
|
2203
|
+
async function ki(e, t, n = {}) {
|
|
2191
2204
|
const i = new St(e, { ...n, autoplay: !0 });
|
|
2192
2205
|
return await i.load(t), i;
|
|
2193
2206
|
}
|
|
2194
|
-
function
|
|
2207
|
+
function xi(e, t = {}) {
|
|
2195
2208
|
return new St(e, t);
|
|
2196
2209
|
}
|
|
2197
|
-
const
|
|
2210
|
+
const Qn = {
|
|
2198
2211
|
play: "Play",
|
|
2199
2212
|
pause: "Pause",
|
|
2200
2213
|
prev: "Previous step",
|
|
@@ -2209,7 +2222,7 @@ const zn = {
|
|
|
2209
2222
|
scenario: "Scenario",
|
|
2210
2223
|
fullscreen: "Full screen",
|
|
2211
2224
|
exitFullscreen: "Exit full screen"
|
|
2212
|
-
}, Bt = "tinyfly-controls-style",
|
|
2225
|
+
}, Bt = "tinyfly-controls-style", Gn = `
|
|
2213
2226
|
.tf-ctl { --tf-ctl-fg: #1d1d1f; --tf-ctl-bg: #f4f2ee; --tf-ctl-accent: #c2410c; --tf-ctl-radius: 8px;
|
|
2214
2227
|
font: 14px/1.4 var(--tf-ctl-font, system-ui, sans-serif); color: var(--tf-ctl-fg); margin-top: 8px; }
|
|
2215
2228
|
.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); }
|
|
@@ -2258,16 +2271,16 @@ const zn = {
|
|
|
2258
2271
|
.tf-fullscreen > :not(svg):not(canvas) { grid-column: 2; }
|
|
2259
2272
|
}
|
|
2260
2273
|
`;
|
|
2261
|
-
let
|
|
2262
|
-
function
|
|
2274
|
+
let Zn = 0;
|
|
2275
|
+
function Kn(e) {
|
|
2263
2276
|
if (e.getElementById(Bt)) return;
|
|
2264
2277
|
const t = e.createElement("style");
|
|
2265
|
-
t.id = Bt, t.textContent =
|
|
2278
|
+
t.id = Bt, t.textContent = Gn, e.head.appendChild(t);
|
|
2266
2279
|
}
|
|
2267
|
-
function
|
|
2280
|
+
function Jn(e, t, n = {}) {
|
|
2268
2281
|
const i = t.ownerDocument;
|
|
2269
|
-
|
|
2270
|
-
const s = { ...
|
|
2282
|
+
Kn(i);
|
|
2283
|
+
const s = { ...Qn, ...n.labels }, r = n.speeds ?? [0.5, 1, 2], a = () => e.markers.length > 0, o = () => e.markers.some((w) => w.label !== void 0 || e.caption(w.id) !== void 0), c = i.createElement("div");
|
|
2271
2284
|
c.className = "tf-ctl";
|
|
2272
2285
|
const l = i.createElement("div");
|
|
2273
2286
|
l.className = "tf-ctl-bar", l.setAttribute("role", "group");
|
|
@@ -2291,7 +2304,7 @@ function Kn(e, t, n = {}) {
|
|
|
2291
2304
|
E.value = String(w), E.textContent = `${w}×`, w === 1 && (E.selected = !0), v.appendChild(E);
|
|
2292
2305
|
}
|
|
2293
2306
|
v.addEventListener("change", () => e.setSpeed(Number(v.value))), l.append(h, f, m, p, g, b), r.length > 0 && l.append(v), c.append(l);
|
|
2294
|
-
const k = n.fullscreen ?
|
|
2307
|
+
const k = n.fullscreen ? ii(t, i, s) : void 0;
|
|
2295
2308
|
k && l.append(k.button);
|
|
2296
2309
|
const M = i.createElement("p");
|
|
2297
2310
|
M.className = "tf-ctl-caption", M.setAttribute("aria-live", "polite"), n.captions !== !1 && c.append(M);
|
|
@@ -2299,7 +2312,7 @@ function Kn(e, t, n = {}) {
|
|
|
2299
2312
|
y.className = "tf-ctl-question", y.hidden = !0;
|
|
2300
2313
|
const S = i.createElement("span"), x = u(s.reveal, s.reveal, () => e.play(), "tf-ctl-primary");
|
|
2301
2314
|
y.append(S, x), c.append(y);
|
|
2302
|
-
const P =
|
|
2315
|
+
const P = ti(e, i, s.scenario, n.scenarioControl ?? "buttons");
|
|
2303
2316
|
P && c.append(P.element);
|
|
2304
2317
|
const Y = n.mount;
|
|
2305
2318
|
Y ? Y.appendChild(c) : t.insertAdjacentElement("afterend", c);
|
|
@@ -2363,7 +2376,7 @@ function Kn(e, t, n = {}) {
|
|
|
2363
2376
|
}
|
|
2364
2377
|
};
|
|
2365
2378
|
}
|
|
2366
|
-
function
|
|
2379
|
+
function ti(e, t, n, i) {
|
|
2367
2380
|
const s = e.scenarios;
|
|
2368
2381
|
if (s.length < 2) return;
|
|
2369
2382
|
if (i === "slider") {
|
|
@@ -2388,7 +2401,7 @@ function Jn(e, t, n, i) {
|
|
|
2388
2401
|
r.className = "tf-ctl-choices";
|
|
2389
2402
|
const a = t.createElement("legend");
|
|
2390
2403
|
a.textContent = n, r.append(a);
|
|
2391
|
-
const o = `tf-ctl-scenario-${++
|
|
2404
|
+
const o = `tf-ctl-scenario-${++Zn}`, c = s.map((u) => {
|
|
2392
2405
|
const h = t.createElement("label");
|
|
2393
2406
|
h.className = "tf-ctl-choice";
|
|
2394
2407
|
const f = t.createElement("input");
|
|
@@ -2405,14 +2418,14 @@ function Jn(e, t, n, i) {
|
|
|
2405
2418
|
}
|
|
2406
2419
|
} };
|
|
2407
2420
|
}
|
|
2408
|
-
const
|
|
2409
|
-
function
|
|
2421
|
+
const ei = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg>', ni = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5"/></svg>';
|
|
2422
|
+
function ii(e, t, n) {
|
|
2410
2423
|
const i = t, s = e, r = t.createElement("button");
|
|
2411
2424
|
r.type = "button", r.className = "tf-ctl-btn tf-ctl-fullscreen";
|
|
2412
2425
|
let a, o = "";
|
|
2413
2426
|
const c = () => {
|
|
2414
2427
|
const d = a !== void 0;
|
|
2415
|
-
r.innerHTML = d ?
|
|
2428
|
+
r.innerHTML = d ? ni : ei;
|
|
2416
2429
|
const g = d ? n.exitFullscreen : n.fullscreen;
|
|
2417
2430
|
r.setAttribute("aria-label", g), r.title = g, r.setAttribute("aria-pressed", String(d)), e.classList.toggle("tf-fullscreen", d), e.classList.toggle("tf-fullscreen-overlay", a === "overlay");
|
|
2418
2431
|
}, l = () => i.fullscreenElement ?? i.webkitFullscreenElement ?? null, u = () => {
|
|
@@ -2458,20 +2471,20 @@ function ni(e, t, n) {
|
|
|
2458
2471
|
}
|
|
2459
2472
|
};
|
|
2460
2473
|
}
|
|
2461
|
-
const Ut = "tinyfly-choices-style",
|
|
2474
|
+
const Ut = "tinyfly-choices-style", si = `
|
|
2462
2475
|
[data-tinyfly-choose] { cursor: pointer; }
|
|
2463
2476
|
[data-tinyfly-choose]:focus-visible { outline: 2px solid var(--tf-ctl-accent, #c2410c); outline-offset: 2px; }
|
|
2464
2477
|
`;
|
|
2465
|
-
function
|
|
2478
|
+
function ri(e) {
|
|
2466
2479
|
if (e.getElementById(Ut)) return;
|
|
2467
2480
|
const t = e.createElement("style");
|
|
2468
|
-
t.id = Ut, t.textContent =
|
|
2481
|
+
t.id = Ut, t.textContent = si, e.head.appendChild(t);
|
|
2469
2482
|
}
|
|
2470
|
-
function
|
|
2483
|
+
function ai(e, t) {
|
|
2471
2484
|
const n = Array.from(t.querySelectorAll("[data-tinyfly-choose]"));
|
|
2472
2485
|
if (n.length === 0) return () => {
|
|
2473
2486
|
};
|
|
2474
|
-
|
|
2487
|
+
ri(t.ownerDocument);
|
|
2475
2488
|
const i = [], s = [];
|
|
2476
2489
|
for (const o of n) {
|
|
2477
2490
|
const c = o.getAttribute("data-tinyfly-choose") ?? "", l = [], u = (p, d) => {
|
|
@@ -2499,7 +2512,7 @@ function ri(e, t) {
|
|
|
2499
2512
|
};
|
|
2500
2513
|
}
|
|
2501
2514
|
const ot = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakMap();
|
|
2502
|
-
let
|
|
2515
|
+
let oi = 0;
|
|
2503
2516
|
function J(e, t, n) {
|
|
2504
2517
|
if (e)
|
|
2505
2518
|
try {
|
|
@@ -2509,10 +2522,10 @@ function J(e, t, n) {
|
|
|
2509
2522
|
return;
|
|
2510
2523
|
}
|
|
2511
2524
|
}
|
|
2512
|
-
async function
|
|
2525
|
+
async function ci(e, t = {}) {
|
|
2513
2526
|
const n = ot.get(e);
|
|
2514
2527
|
if (n) return n;
|
|
2515
|
-
const i = Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")), s = i[0], r = e.getAttribute("data-src"), a =
|
|
2528
|
+
const i = Array.from(e.querySelectorAll("script[data-tinyfly-timeline]")), s = i[0], r = e.getAttribute("data-src"), a = hi(e.getAttribute("data-markers")), o = i.length > 1 || s?.hasAttribute("data-scenario") ? li(i, a, e) : void 0;
|
|
2516
2529
|
if (o && o.length === 0) return;
|
|
2517
2530
|
let c = s && !o ? J(s.textContent, "timeline", e) : void 0;
|
|
2518
2531
|
if (!c && r && a) {
|
|
@@ -2529,16 +2542,16 @@ async function oi(e, t = {}) {
|
|
|
2529
2542
|
...l && { captions: l },
|
|
2530
2543
|
...J(e.getAttribute("data-options"), "data-options", e)
|
|
2531
2544
|
};
|
|
2532
|
-
|
|
2545
|
+
di(e);
|
|
2533
2546
|
const h = new St(e, u), f = { element: e, player: h };
|
|
2534
2547
|
if (ot.set(e, f), e.setAttribute("data-tinyfly-mounted", ""), o) {
|
|
2535
2548
|
const m = e.getAttribute("data-scenario") ?? void 0;
|
|
2536
|
-
await h.loadScenarios(o, { initial: o.some((p) => p.id === m) ? m : void 0 }), xt.set(e,
|
|
2549
|
+
await h.loadScenarios(o, { initial: o.some((p) => p.id === m) ? m : void 0 }), xt.set(e, ai(h, e));
|
|
2537
2550
|
} else
|
|
2538
2551
|
await h.load(c ?? r);
|
|
2539
2552
|
if (e.getAttribute("data-controls") !== "false") {
|
|
2540
2553
|
const m = J(e.getAttribute("data-labels"), "data-labels", e), p = e.querySelector("figcaption"), d = e.getAttribute("data-scenario-legend"), g = e.getAttribute("data-scenario-control");
|
|
2541
|
-
f.controls =
|
|
2554
|
+
f.controls = Jn(h, e, {
|
|
2542
2555
|
...t.controls,
|
|
2543
2556
|
...e.getAttribute("data-fullscreen") === "true" ? { fullscreen: !0 } : {},
|
|
2544
2557
|
...g === "slider" || g === "buttons" ? { scenarioControl: g } : {},
|
|
@@ -2549,7 +2562,7 @@ async function oi(e, t = {}) {
|
|
|
2549
2562
|
}
|
|
2550
2563
|
return f;
|
|
2551
2564
|
}
|
|
2552
|
-
function
|
|
2565
|
+
function li(e, t, n) {
|
|
2553
2566
|
const i = [];
|
|
2554
2567
|
return e.forEach((s, r) => {
|
|
2555
2568
|
const a = J(s.textContent, "timeline", n);
|
|
@@ -2566,29 +2579,29 @@ function ci(e, t, n) {
|
|
|
2566
2579
|
function re(e, t) {
|
|
2567
2580
|
return e.config.markers?.length ? e : { ...e, config: { ...e.config, markers: t.map((n, i) => ({ id: `step-${i + 1}`, time: n })) } };
|
|
2568
2581
|
}
|
|
2569
|
-
function
|
|
2582
|
+
function hi(e) {
|
|
2570
2583
|
if (!e) return;
|
|
2571
2584
|
const t = e.split(/[\s,]+/).filter(Boolean).map(Number).filter((n) => Number.isFinite(n) && n >= 0).sort((n, i) => n - i);
|
|
2572
2585
|
return t.length > 0 ? t : void 0;
|
|
2573
2586
|
}
|
|
2574
|
-
async function
|
|
2587
|
+
async function ui(e = document, t = {}) {
|
|
2575
2588
|
const n = Array.from(e.querySelectorAll("[data-tinyfly-embed]"));
|
|
2576
|
-
return (await Promise.all(n.map((s) =>
|
|
2589
|
+
return (await Promise.all(n.map((s) => ci(s, t)))).filter((s) => s !== void 0);
|
|
2577
2590
|
}
|
|
2578
|
-
function
|
|
2591
|
+
function wi(e) {
|
|
2579
2592
|
const t = ot.get(e);
|
|
2580
2593
|
t && (xt.get(e)?.(), xt.delete(e), t.controls?.destroy(), t.player.destroy(), ot.delete(e), e.removeAttribute("data-tinyfly-mounted"));
|
|
2581
2594
|
}
|
|
2582
|
-
function
|
|
2595
|
+
function di(e) {
|
|
2583
2596
|
const t = e.querySelector("svg");
|
|
2584
2597
|
if (!t || t.hasAttribute("role") || t.hasAttribute("aria-hidden")) return;
|
|
2585
2598
|
const n = e.getAttribute("data-alt"), i = e.querySelector("figcaption");
|
|
2586
|
-
t.setAttribute("role", "img"), n ? t.setAttribute("aria-label", n) : i && (i.id ||= `tinyfly-caption-${++
|
|
2599
|
+
t.setAttribute("role", "img"), n ? t.setAttribute("aria-label", n) : i && (i.id ||= `tinyfly-caption-${++oi}`, t.setAttribute("aria-labelledby", i.id));
|
|
2587
2600
|
}
|
|
2588
|
-
function
|
|
2601
|
+
function fi() {
|
|
2589
2602
|
if (!(typeof document < "u" ? document.currentScript : null)?.hasAttribute("data-tinyfly-auto")) return;
|
|
2590
2603
|
const t = () => {
|
|
2591
|
-
|
|
2604
|
+
ui();
|
|
2592
2605
|
};
|
|
2593
2606
|
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", t, { once: !0 }) : t();
|
|
2594
2607
|
}
|
|
@@ -2597,7 +2610,7 @@ function ae(e) {
|
|
|
2597
2610
|
for (const n of e.matchAll(/data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/g)) t.add(n[2] ?? n[3]);
|
|
2598
2611
|
return [...t];
|
|
2599
2612
|
}
|
|
2600
|
-
function
|
|
2613
|
+
function pi(e, t = {}) {
|
|
2601
2614
|
const n = [], i = (l) => n.push({ level: "error", message: l }), s = (l) => n.push({ level: "warning", message: l });
|
|
2602
2615
|
if ((e.formatVersion ?? 1) > st)
|
|
2603
2616
|
return i(`format version ${e.formatVersion} is newer than this tinyfly reads (${st})`), n;
|
|
@@ -2633,12 +2646,12 @@ function fi(e, t = {}) {
|
|
|
2633
2646
|
}
|
|
2634
2647
|
return n;
|
|
2635
2648
|
}
|
|
2636
|
-
function
|
|
2649
|
+
function mi(e) {
|
|
2637
2650
|
const t = /* @__PURE__ */ new Set();
|
|
2638
2651
|
for (const n of e.matchAll(/data-tinyfly-choose\s*=\s*("([^"]*)"|'([^']*)')/g)) t.add(n[2] ?? n[3]);
|
|
2639
2652
|
return [...t];
|
|
2640
2653
|
}
|
|
2641
|
-
function
|
|
2654
|
+
function Mi(e, t = {}) {
|
|
2642
2655
|
const n = [];
|
|
2643
2656
|
e.length === 1 && n.push({ level: "warning", message: "only one scenario, so the reader has nothing to choose" });
|
|
2644
2657
|
const i = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
@@ -2648,26 +2661,26 @@ function wi(e, t = {}) {
|
|
|
2648
2661
|
continue;
|
|
2649
2662
|
}
|
|
2650
2663
|
i.add(r.id);
|
|
2651
|
-
for (const a of
|
|
2664
|
+
for (const a of pi(r.timeline, t))
|
|
2652
2665
|
/is never animated$/.test(a.message) || n.push({ level: a.level, message: `scenario "${r.id}": ${a.message}` });
|
|
2653
2666
|
for (const a of r.timeline.tracks) for (const o of [a.target, ...a.targets ?? []]) s.add(o);
|
|
2654
2667
|
}
|
|
2655
2668
|
if (t.markup !== void 0) {
|
|
2656
|
-
for (const r of
|
|
2669
|
+
for (const r of mi(t.markup))
|
|
2657
2670
|
i.has(r) || n.push({ level: "error", message: `data-tinyfly-choose="${r}" names no scenario` });
|
|
2658
2671
|
for (const r of ae(t.markup))
|
|
2659
2672
|
s.has(r) || n.push({ level: "warning", message: `data-tinyfly="${r}" is never animated in any scenario` });
|
|
2660
2673
|
}
|
|
2661
2674
|
return n;
|
|
2662
2675
|
}
|
|
2663
|
-
function
|
|
2664
|
-
const i = at(t), s = t.config?.markers ?? [], r = n === "start" ? 0 : n === "end" ? i.duration : typeof n == "number" ? n : s.find((f) => f.id === n)?.time ?? i.duration, a = i.getStateAtTime(Math.max(0, Math.min(i.duration, r))), o = new kt(), c = /* @__PURE__ */ new Map(), l =
|
|
2676
|
+
function Si(e, t, n = "end") {
|
|
2677
|
+
const i = at(t), s = t.config?.markers ?? [], r = n === "start" ? 0 : n === "end" ? i.duration : typeof n == "number" ? n : s.find((f) => f.id === n)?.time ?? i.duration, a = i.getStateAtTime(Math.max(0, Math.min(i.duration, r))), o = new kt(), c = /* @__PURE__ */ new Map(), l = yi(e);
|
|
2665
2678
|
for (const f of e.matchAll(jt)) {
|
|
2666
2679
|
const m = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(f[2] ?? "");
|
|
2667
2680
|
if (!m) continue;
|
|
2668
2681
|
const p = m[2] ?? m[3];
|
|
2669
2682
|
if (c.has(p)) continue;
|
|
2670
|
-
const d =
|
|
2683
|
+
const d = gi(l(f.index ?? 0));
|
|
2671
2684
|
c.set(p, d), o.registerTarget(p, d);
|
|
2672
2685
|
}
|
|
2673
2686
|
o.applyState(a);
|
|
@@ -2676,7 +2689,7 @@ function Mi(e, t, n = "end") {
|
|
|
2676
2689
|
const [m, p, d = "", g] = f, b = f.index ?? 0, v = /data-tinyfly\s*=\s*("([^"]*)"|'([^']*)')/.exec(d), k = v ? c.get(v[2] ?? v[3]) : void 0;
|
|
2677
2690
|
if (!k || Object.keys(k.style).length === 0 && k.text === void 0) continue;
|
|
2678
2691
|
u += e.slice(h, b);
|
|
2679
|
-
const M = Object.entries(k.style).map(([x, P]) => `${
|
|
2692
|
+
const M = Object.entries(k.style).map(([x, P]) => `${bi(x)}: ${P}`).join("; "), y = /\sstyle\s*=\s*("([^"]*)"|'([^']*)')/.exec(d);
|
|
2680
2693
|
let S = d;
|
|
2681
2694
|
if (M)
|
|
2682
2695
|
if (y) {
|
|
@@ -2686,13 +2699,13 @@ function Mi(e, t, n = "end") {
|
|
|
2686
2699
|
S = `${d} style="${Ht(M)}"`;
|
|
2687
2700
|
if (u += `<${p}${S}${g ? " /" : ""}>`, h = b + m.length, k.text !== void 0 && !g) {
|
|
2688
2701
|
const x = e.indexOf(`</${p}`, h), P = x === -1 ? "" : e.slice(h, x);
|
|
2689
|
-
x !== -1 && !P.includes("<") && (u +=
|
|
2702
|
+
x !== -1 && !P.includes("<") && (u += vi(k.text), h = x);
|
|
2690
2703
|
}
|
|
2691
2704
|
}
|
|
2692
2705
|
return u + e.slice(h);
|
|
2693
2706
|
}
|
|
2694
2707
|
const jt = /<([a-zA-Z][\w:-]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*(\/?)>/g;
|
|
2695
|
-
function
|
|
2708
|
+
function gi(e) {
|
|
2696
2709
|
const t = {
|
|
2697
2710
|
style: {},
|
|
2698
2711
|
dataset: {},
|
|
@@ -2707,7 +2720,7 @@ function mi(e) {
|
|
|
2707
2720
|
};
|
|
2708
2721
|
return e && (t.ownerSVGElement = null), t;
|
|
2709
2722
|
}
|
|
2710
|
-
function
|
|
2723
|
+
function yi(e) {
|
|
2711
2724
|
const t = [], n = /<svg[\s>]/gi;
|
|
2712
2725
|
let i;
|
|
2713
2726
|
for (; i = n.exec(e); ) {
|
|
@@ -2716,29 +2729,29 @@ function gi(e) {
|
|
|
2716
2729
|
}
|
|
2717
2730
|
return (s) => t.some(([r, a]) => s > r && s < a);
|
|
2718
2731
|
}
|
|
2719
|
-
function
|
|
2732
|
+
function bi(e) {
|
|
2720
2733
|
const t = e.replace(/[A-Z]/g, (n) => `-${n.toLowerCase()}`);
|
|
2721
2734
|
return /^(webkit|moz|ms)-/.test(t) ? `-${t}` : t;
|
|
2722
2735
|
}
|
|
2723
2736
|
function Ht(e) {
|
|
2724
2737
|
return e.replace(/&/g, "&").replace(/"/g, """);
|
|
2725
2738
|
}
|
|
2726
|
-
function
|
|
2739
|
+
function vi(e) {
|
|
2727
2740
|
return e.replace(/&/g, "&").replace(/</g, "<");
|
|
2728
2741
|
}
|
|
2729
|
-
|
|
2742
|
+
fi();
|
|
2730
2743
|
export {
|
|
2731
|
-
|
|
2744
|
+
Qn as DEFAULT_LABELS,
|
|
2732
2745
|
St as TinyflyPlayer,
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2746
|
+
ai as bindChoiceHotspots,
|
|
2747
|
+
xi as create,
|
|
2748
|
+
Jn as createControls,
|
|
2749
|
+
ci as mount,
|
|
2750
|
+
ui as mountAll,
|
|
2751
|
+
ki as play,
|
|
2752
|
+
Si as renderFrame,
|
|
2740
2753
|
ae as targetNamesIn,
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2754
|
+
wi as unmount,
|
|
2755
|
+
pi as validateEmbed,
|
|
2756
|
+
Mi as validateScenarios
|
|
2744
2757
|
};
|