@mkbabb/keyframes.js 5.1.0 → 5.3.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 +98 -8
- package/dist/easing-registry-BAgudUsG.js +2 -0
- package/dist/{easing-registry-DHV2-5gA.js → easing-registry-BlbS88NR.js} +2 -2
- package/dist/engine/index.d.ts +570 -323
- package/dist/engine/index.js +3710 -17
- package/dist/keyframes.d.ts +1043 -454
- package/dist/keyframes.js +277 -107
- package/dist/{sequence-C_DCiOIQ.js → sequence-CES7o7hs.js} +258 -182
- package/package.json +104 -100
- package/dist/animation-BGyzfzBq.js +0 -947
- package/dist/compile-CcSUwM8R.js +0 -276
- package/dist/delegation-DWwr4IXr.js +0 -263
- package/dist/draw-svg-GURj9nin.js +0 -45
- package/dist/easing-registry-y1p9McFy.js +0 -2
- package/dist/engine-DEVgCTUy.js +0 -156
- package/dist/engine-DrBtsKaf.js +0 -4
- package/dist/format-C-Gi9r7L.js +0 -123
- package/dist/grammar-BLucehC4.js +0 -23
- package/dist/group-vJcsHKN9.js +0 -360
- package/dist/ingest-S5hUe20K.js +0 -166
- package/dist/morph-svg-BToeumw5.js +0 -89
- package/dist/motion-path-pQVbamWT.js +0 -35
- package/dist/parse-flatten-DRMHFytp.js +0 -2
- package/dist/parse-flatten-ZZUSEQEL.js +0 -63
- package/dist/presets-BG2Fczzq.js +0 -275
- package/dist/scheduler-CUtVnuoU.js +0 -14
- package/dist/scroll-CxpYFO4u.js +0 -180
- package/dist/validate-DDeGnvSt.js +0 -39
package/dist/engine/index.js
CHANGED
|
@@ -1,17 +1,3710 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { S as e, c as t, d as n, f as r, h as i, i as a, m as o, n as s, o as c, r as l, s as u, t as d, u as f, v as p, w as m, y as h } from "../sequence-CES7o7hs.js";
|
|
2
|
+
import { t as g } from "../easing-registry-BlbS88NR.js";
|
|
3
|
+
import { clamp as _, lerp as v, lerpArray as ee, scale as y } from "@mkbabb/value.js/math";
|
|
4
|
+
import { COLOR_SPACE_RANGES as b, color2 as te, deltaEOK as ne, normalizeColorUnit as re, sampleColorRamp as ie } from "@mkbabb/value.js/color";
|
|
5
|
+
import { CSSCubicBezier as x, easeInOutCubic as ae, steppedEase as oe, timingFunctions as se } from "@mkbabb/value.js/easing";
|
|
6
|
+
import { COMPUTED_UNITS as ce, FunctionValue as S, ValueArray as C, ValueUnit as w, flattenObject as le, functionIdentityValue as ue, isColorUnit as de, unflattenObject as fe, unflattenObjectToString as T } from "@mkbabb/value.js/units";
|
|
7
|
+
import { camelCaseToHyphen as E, isObject as pe, lerpValue as me, memoize as he, normalizeValueUnits as ge, prepareInterpVar as _e, seekPreviousValue as ve, sleep as ye } from "@mkbabb/value.js";
|
|
8
|
+
import { coerceToSyntax as be, extractAnimationOptions as xe, extractFunctions as Se, extractKeyframes as Ce, extractProperties as we, extractTimelineOptions as Te, formatCSS as D, parseAnimationRange as Ee, parseAnimationTimeline as De, parseCSSStylesheet as O, parseCSSSubValue as Oe, parseCSSTime as ke, parseCSSValue as Ae, parseCSSValueUnit as je, reverseAnimationShorthand as Me, reverseCSSTime as k, serializeStylesheetItem as Ne, serializeTimelineOptions as Pe } from "@mkbabb/value.js/parsing";
|
|
9
|
+
import { PathGeometry as Fe } from "@mkbabb/value.js/transform";
|
|
10
|
+
//#region \0rolldown/runtime.js
|
|
11
|
+
var Ie = Object.defineProperty, Le = (e, t) => {
|
|
12
|
+
let n = {};
|
|
13
|
+
for (var r in e) Ie(n, r, {
|
|
14
|
+
get: e[r],
|
|
15
|
+
enumerable: !0
|
|
16
|
+
});
|
|
17
|
+
return t || Ie(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
18
|
+
}, Re = [
|
|
19
|
+
"normal",
|
|
20
|
+
"reverse",
|
|
21
|
+
"alternate",
|
|
22
|
+
"alternate-reverse"
|
|
23
|
+
], ze = [
|
|
24
|
+
"none",
|
|
25
|
+
"forwards",
|
|
26
|
+
"backwards",
|
|
27
|
+
"both"
|
|
28
|
+
], Be = Object.keys(b), Ve = [
|
|
29
|
+
"shorter",
|
|
30
|
+
"longer",
|
|
31
|
+
"increasing",
|
|
32
|
+
"decreasing"
|
|
33
|
+
], A = () => {}, j = {
|
|
34
|
+
duration: 1e3,
|
|
35
|
+
delay: 0,
|
|
36
|
+
iterationCount: 1,
|
|
37
|
+
direction: "normal",
|
|
38
|
+
fillMode: "forwards",
|
|
39
|
+
timingFunction: { fn: ae },
|
|
40
|
+
useWAAPI: !0,
|
|
41
|
+
respectReducedMotion: !1,
|
|
42
|
+
colorSpace: "oklab"
|
|
43
|
+
}, He = {
|
|
44
|
+
zIndex: 0,
|
|
45
|
+
weight: 1,
|
|
46
|
+
blendMode: "replace",
|
|
47
|
+
enabled: !0
|
|
48
|
+
}, Ue = (e) => e.fnName, M = (e, t) => {
|
|
49
|
+
if (e instanceof w) {
|
|
50
|
+
let n = e.clone();
|
|
51
|
+
return t !== void 0 && (n.fnName = t), [n];
|
|
52
|
+
}
|
|
53
|
+
if (e instanceof S) return e.values.flatMap((t) => M(t, e.name));
|
|
54
|
+
if (e instanceof C) return e.flatMap((e) => M(e, t));
|
|
55
|
+
throw TypeError(`Expected ValueUnit/FunctionValue/ValueArray, got ${typeof e}`);
|
|
56
|
+
}, We = (e) => {
|
|
57
|
+
let t = e.split(".").pop(), n = e.split(".").shift();
|
|
58
|
+
if (!t || !n) throw Error(`Invalid flattened key: ${e}`);
|
|
59
|
+
return {
|
|
60
|
+
mainKey: n,
|
|
61
|
+
childKey: t
|
|
62
|
+
};
|
|
63
|
+
}, N = (e, t, n) => (e.setProperty(t), n !== t && e.setSubProperty(n), e), Ge = he((e, t) => M(Oe(t, { subProperty: e })), {
|
|
64
|
+
maxCacheSize: 2048,
|
|
65
|
+
keyFn: (e, t) => `${e}:${t}`
|
|
66
|
+
});
|
|
67
|
+
function Ke(e) {
|
|
68
|
+
let t = le(e), n = (e, t) => {
|
|
69
|
+
let { childKey: r, mainKey: i } = We(e);
|
|
70
|
+
return t instanceof w ? N(new C(...M(t)), i, r) : t instanceof S ? N(new C(...t.values.flatMap((r) => M(n(e, r), t.name))), i, r) : t instanceof C ? N(new C(...t.flatMap((t) => M(n(e, t)))), i, r) : N(new C(...Ge(r, String(t)).map((e) => e.clone())), i, r);
|
|
71
|
+
};
|
|
72
|
+
return Object.entries(t).reduce((e, [t, r]) => (e[t] = n(t, r), e), {});
|
|
73
|
+
}
|
|
74
|
+
var qe = (e, t, n, r, i = "oklab", a) => {
|
|
75
|
+
let o = r[t], s = r[n];
|
|
76
|
+
if (!o || !s) throw Error(`Invalid interpolation frame bounds (${t} -> ${n}).`);
|
|
77
|
+
let c = o[e], l = s[e];
|
|
78
|
+
if (!c || !l) throw Error(`Missing variable "${e}" in interpolation bounds.`);
|
|
79
|
+
let u = Math.max(c.length, l.length), d = (t, n) => {
|
|
80
|
+
let r = t.map((t) => {
|
|
81
|
+
if (!(t instanceof w)) throw TypeError(`Interpolation for "${e}" requires ValueUnit leaves.`);
|
|
82
|
+
return t;
|
|
83
|
+
});
|
|
84
|
+
for (; r.length < u;) {
|
|
85
|
+
let e = n[r.length], t = e instanceof w ? Ue(e) : void 0, i = t ? ue(t) : void 0;
|
|
86
|
+
r.push(i ?? new w(0));
|
|
87
|
+
}
|
|
88
|
+
return r;
|
|
89
|
+
}, f = d(c, l), p = d(l, c);
|
|
90
|
+
return f.map((t, n) => {
|
|
91
|
+
let r = p[n];
|
|
92
|
+
if (!r) throw Error(`Missing right-hand interpolation value at index ${n}.`);
|
|
93
|
+
if (!(t instanceof w) || !(r instanceof w)) throw TypeError(`Interpolation for "${e}" requires ValueUnit leaves.`);
|
|
94
|
+
let o = { colorSpace: i };
|
|
95
|
+
return a !== void 0 && (o.hueMethod = a), _e(ge(t, r, o));
|
|
96
|
+
});
|
|
97
|
+
}, Je = {}, Ye = [], Xe = {};
|
|
98
|
+
function Ze(e, t, n = !0) {
|
|
99
|
+
e = n ? e : le(e);
|
|
100
|
+
for (let e in Xe) delete Xe[e];
|
|
101
|
+
for (let t in e) {
|
|
102
|
+
let n = e[t];
|
|
103
|
+
n !== void 0 && (Xe[t] = n);
|
|
104
|
+
}
|
|
105
|
+
let r = T(Xe, Je), i = 0;
|
|
106
|
+
for (let e in r) Ye[i++] = e;
|
|
107
|
+
Ye.length = i, t.forEach((e) => {
|
|
108
|
+
for (let t = 0; t < i; t++) {
|
|
109
|
+
let n = Ye[t];
|
|
110
|
+
e.style.setProperty(n, r[n]);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/animation/internal/scroll-phases.ts
|
|
116
|
+
var P = {
|
|
117
|
+
entry: {
|
|
118
|
+
start: 0,
|
|
119
|
+
end: .25
|
|
120
|
+
},
|
|
121
|
+
cover: {
|
|
122
|
+
start: .25,
|
|
123
|
+
end: .75
|
|
124
|
+
},
|
|
125
|
+
contain: {
|
|
126
|
+
start: .375,
|
|
127
|
+
end: .625
|
|
128
|
+
},
|
|
129
|
+
exit: {
|
|
130
|
+
start: .75,
|
|
131
|
+
end: 1
|
|
132
|
+
}
|
|
133
|
+
}, Qe = 1e6, $e = /^(?:from|to)$/i, et = /^(?:\d+(?:\.\d+)?|\.\d+)(?:[eE][+-]?\d+)?%$/, tt = /^(?:entry|exit|cover|contain)(?:\s+\d+(?:\.\d+)?%)?$/i, nt = "named-selector", rt = /^(entry|exit|cover|contain)(?:\s+(\d+(?:\.\d+)?)%)?$/i, it = (t) => {
|
|
134
|
+
let n = rt.exec(t.trim());
|
|
135
|
+
if (n === null) throw new e("start", t, "not a conforming scroll-range named selector (entry/exit/cover/contain, optionally with a range fraction like 'entry 50%')", "NAMED_SELECTOR_NO_TIMELINE");
|
|
136
|
+
let r = P[n[1].toLowerCase()], i = n[2];
|
|
137
|
+
if (i === void 0) return r.start;
|
|
138
|
+
let a = Number.parseFloat(i) / 100;
|
|
139
|
+
return r.start + a * (r.end - r.start);
|
|
140
|
+
}, at = "a keyframe selector must be a percentage 0%–100% (e.g. \"0%\", \"50%\"), the keyword 'from'/'to', or a scroll-range named selector (entry/exit/cover/contain, optionally with a range fraction like 'entry 0%')";
|
|
141
|
+
function ot(t) {
|
|
142
|
+
let n = t.trim();
|
|
143
|
+
if (n === "") throw new e("start", t, `${at} — got an empty/blank string`, "EMPTY_PARSE");
|
|
144
|
+
if (tt.test(n)) return new w(n, void 0, [nt]);
|
|
145
|
+
if (!$e.test(n) && !(et.test(n) && parseFloat(n) <= 100)) throw new e("start", t, `${at} — got ${JSON.stringify(t)}`);
|
|
146
|
+
return je(n);
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
//#region src/animation/compile/numeric-plan.ts
|
|
150
|
+
var st = (e) => typeof e.start.value == "number" && typeof e.stop.value == "number" && e.computed !== !0 && e.value.unit !== "color" && e._colorPlan == null, ct = (e) => {
|
|
151
|
+
let t = [], n = [];
|
|
152
|
+
for (let r of e) st(r) ? t.push(r) : n.push(r);
|
|
153
|
+
let r = t.length, i = new Float64Array(r), a = new Float64Array(r);
|
|
154
|
+
for (let e = 0; e < r; e++) i[e] = t[e].start.value, a[e] = t[e].stop.value;
|
|
155
|
+
return {
|
|
156
|
+
numeric: t,
|
|
157
|
+
from: i,
|
|
158
|
+
to: a,
|
|
159
|
+
out: new Float64Array(r),
|
|
160
|
+
boxed: n
|
|
161
|
+
};
|
|
162
|
+
}, lt = (t, n) => {
|
|
163
|
+
if (typeof n == "function") return { fn: n };
|
|
164
|
+
if (typeof n == "object") {
|
|
165
|
+
if (typeof n.fn == "function") return n;
|
|
166
|
+
throw new e(t, n, "an Easing must carry a callable `fn`");
|
|
167
|
+
}
|
|
168
|
+
let r = g(n);
|
|
169
|
+
if (!r) throw new e(t, n, "unknown timing function — pass a callable TimingFunction, a typed Easing, a registry name, or a cubic-bezier() literal", "UNKNOWN_TIMING_FN");
|
|
170
|
+
let i = h(n);
|
|
171
|
+
return i ? {
|
|
172
|
+
fn: r,
|
|
173
|
+
css: i
|
|
174
|
+
} : { fn: r };
|
|
175
|
+
};
|
|
176
|
+
//#endregion
|
|
177
|
+
//#region src/animation/compile/frame-compiler.ts
|
|
178
|
+
function ut(e, t, n) {
|
|
179
|
+
let [r, i] = [e.start, t.start];
|
|
180
|
+
return {
|
|
181
|
+
start: r.value * n / 100,
|
|
182
|
+
stop: i.value * n / 100
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
var dt = class {
|
|
186
|
+
_options;
|
|
187
|
+
templateFrames = [];
|
|
188
|
+
parsedVars = [];
|
|
189
|
+
frames = [];
|
|
190
|
+
frameId = 0;
|
|
191
|
+
constructor(e) {
|
|
192
|
+
this._options = e;
|
|
193
|
+
}
|
|
194
|
+
get options() {
|
|
195
|
+
return this._options;
|
|
196
|
+
}
|
|
197
|
+
addFrame(e, t, n, r, i) {
|
|
198
|
+
typeof e == "number" ? e = String(e) + "%" : typeof e == "string" ? e = e : e instanceof w && (e = String(e));
|
|
199
|
+
let a = ot(e), o = {
|
|
200
|
+
id: this.frameId,
|
|
201
|
+
start: a,
|
|
202
|
+
vars: t,
|
|
203
|
+
transform: n,
|
|
204
|
+
timingFunction: r == null ? this.options.timingFunction : lt("timingFunction", r),
|
|
205
|
+
composition: i
|
|
206
|
+
};
|
|
207
|
+
this.templateFrames.push(o), this.frameId += 1;
|
|
208
|
+
}
|
|
209
|
+
createFrame(e, t) {
|
|
210
|
+
let n = this.templateFrames[e], r = this.templateFrames[t], i = {
|
|
211
|
+
start: e,
|
|
212
|
+
stop: t
|
|
213
|
+
}, a = ut(n, r, this.options.duration), o = n.transform;
|
|
214
|
+
if (o == null) {
|
|
215
|
+
let t = ve(e, this.templateFrames, (e) => e.transform != null);
|
|
216
|
+
o = (t === void 0 ? void 0 : this.templateFrames[t].transform) ?? A;
|
|
217
|
+
}
|
|
218
|
+
let s = n.timingFunction;
|
|
219
|
+
if (s == null) {
|
|
220
|
+
let t = ve(e, this.templateFrames, (e) => e.timingFunction != null);
|
|
221
|
+
s = (t === void 0 ? void 0 : this.templateFrames[t].timingFunction) ?? this.options.timingFunction;
|
|
222
|
+
}
|
|
223
|
+
let c = e * Qe + t, l = r.composition;
|
|
224
|
+
return {
|
|
225
|
+
id: c,
|
|
226
|
+
ixs: i,
|
|
227
|
+
start: n.start,
|
|
228
|
+
time: a,
|
|
229
|
+
interpVars: {},
|
|
230
|
+
allInterpVars: [],
|
|
231
|
+
transform: o,
|
|
232
|
+
timingFunction: s,
|
|
233
|
+
...l == null ? {} : { composition: l }
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
buildVarIndex() {
|
|
237
|
+
let e = /* @__PURE__ */ new Map();
|
|
238
|
+
for (let t = 0; t < this.parsedVars.length; t++) for (let n of Object.keys(this.parsedVars[t])) {
|
|
239
|
+
let r = e.get(n);
|
|
240
|
+
r || (r = [], e.set(n, r)), r.push(t);
|
|
241
|
+
}
|
|
242
|
+
return e;
|
|
243
|
+
}
|
|
244
|
+
reconcileVars(e, t) {
|
|
245
|
+
let n = this.parsedVars[e];
|
|
246
|
+
if (n) for (let r of Object.keys(n)) {
|
|
247
|
+
let n = t.get(r);
|
|
248
|
+
if (!n) continue;
|
|
249
|
+
let i = -1;
|
|
250
|
+
for (let t of n) if (t > e) {
|
|
251
|
+
i = t;
|
|
252
|
+
break;
|
|
253
|
+
}
|
|
254
|
+
if (i === -1) continue;
|
|
255
|
+
let [a, o] = [e, i], s = this.frames.findIndex((e) => e.ixs.start === a && e.ixs.stop === o), c = s === -1 ? this.createFrame(a, o) : this.frames[s];
|
|
256
|
+
c.interpVars[r] = qe(r, a, o, this.parsedVars, this.options.colorSpace, this.options.hueMethod), s === -1 && this.frames.push(c);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
parse(e) {
|
|
260
|
+
this.frames = [], this.templateFrames.sort((e, t) => e.start.value - t.start.value), this.parsedVars = this.templateFrames.map((t) => {
|
|
261
|
+
let n = Ke(t.vars);
|
|
262
|
+
return Object.values(n).forEach((t) => {
|
|
263
|
+
t.setTargets(e);
|
|
264
|
+
}), n;
|
|
265
|
+
});
|
|
266
|
+
for (let e = 0; e < this.templateFrames.length - 1; e++) this.frames.push(this.createFrame(e, e + 1));
|
|
267
|
+
let t = this.buildVarIndex();
|
|
268
|
+
this.frames.forEach((e, n) => this.reconcileVars(n, t)), this.frames.sort((e, t) => e.time.start === t.time.start ? e.time.stop - t.time.stop : e.time.start - t.time.start), this.frames = this.frames.filter((e) => e.interpVars != null && Object.keys(e.interpVars).length > 0), this.frames.forEach((e) => this.finalizeFrameVars(e));
|
|
269
|
+
}
|
|
270
|
+
finalizeFrameVars(e) {
|
|
271
|
+
e.flatVars = Object.entries(e.interpVars).reduce((e, [t, n]) => (e[t] = n.map((e) => e.value), e), {}), e.vars = fe(e.flatVars), e._plainProj = void 0, e.allInterpVars = Object.values(e.interpVars).flat(), e._numericPlan = ct(e.allInterpVars);
|
|
272
|
+
}
|
|
273
|
+
renormalizeColors() {
|
|
274
|
+
for (let e of this.frames) {
|
|
275
|
+
for (let t of Object.keys(e.interpVars)) e.interpVars[t] = qe(t, e.ixs.start, e.ixs.stop, this.parsedVars, this.options.colorSpace, this.options.hueMethod);
|
|
276
|
+
this.finalizeFrameVars(e);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}, ft = new Set([
|
|
280
|
+
...ce,
|
|
281
|
+
"%",
|
|
282
|
+
"vh",
|
|
283
|
+
"vw",
|
|
284
|
+
"vmin",
|
|
285
|
+
"vmax",
|
|
286
|
+
"vi",
|
|
287
|
+
"vb",
|
|
288
|
+
"svh",
|
|
289
|
+
"svw",
|
|
290
|
+
"svmin",
|
|
291
|
+
"svmax",
|
|
292
|
+
"svi",
|
|
293
|
+
"svb",
|
|
294
|
+
"lvh",
|
|
295
|
+
"lvw",
|
|
296
|
+
"lvmin",
|
|
297
|
+
"lvmax",
|
|
298
|
+
"lvi",
|
|
299
|
+
"lvb",
|
|
300
|
+
"dvh",
|
|
301
|
+
"dvw",
|
|
302
|
+
"dvmin",
|
|
303
|
+
"dvmax",
|
|
304
|
+
"dvi",
|
|
305
|
+
"dvb",
|
|
306
|
+
"cqw",
|
|
307
|
+
"cqh",
|
|
308
|
+
"cqi",
|
|
309
|
+
"cqb",
|
|
310
|
+
"cqmin",
|
|
311
|
+
"cqmax"
|
|
312
|
+
]), pt = (e) => typeof e == "string" && ft.has(e), mt = new Set(["offset-distance"]), ht = (e) => mt.has(e) || mt.has(e.split(".").pop() ?? e), gt = () => typeof globalThis.webkitConvertPointFromNodeToPage == "function";
|
|
313
|
+
function F(e) {
|
|
314
|
+
if (!e.targets || e.targets.length === 0) return {
|
|
315
|
+
eligible: !1,
|
|
316
|
+
reason: "no DOM targets"
|
|
317
|
+
};
|
|
318
|
+
if (typeof e.targets[0]?.animate != "function") return {
|
|
319
|
+
eligible: !1,
|
|
320
|
+
reason: "target does not implement Element.animate()"
|
|
321
|
+
};
|
|
322
|
+
for (let t of e.frames) if (!e.usesDefaultRenderer(t.transform)) return {
|
|
323
|
+
eligible: !1,
|
|
324
|
+
reason: "custom transform function (not the default DOM renderer)"
|
|
325
|
+
};
|
|
326
|
+
let t = e.frames[0]?.timingFunction;
|
|
327
|
+
if (t && e.frames.length > 1) {
|
|
328
|
+
for (let n = 1; n < e.frames.length; n++) if (e.frames[n].timingFunction.fn !== t.fn) return {
|
|
329
|
+
eligible: !1,
|
|
330
|
+
reason: "non-uniform per-frame timing function (WAAPI supports one easing per animation)"
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
if (t && t.css === void 0) return {
|
|
334
|
+
eligible: !1,
|
|
335
|
+
reason: "easing has no faithful CSS twin (would run bare linear on the compositor)"
|
|
336
|
+
};
|
|
337
|
+
if (t?.css?.startsWith("linear(") && gt()) return {
|
|
338
|
+
eligible: !1,
|
|
339
|
+
reason: "WebKit refuses HW-accel for linear() easing — the spring twin stays on the rAF path (CE-1.0)"
|
|
340
|
+
};
|
|
341
|
+
for (let t of e.frames) for (let [e, n] of Object.entries(t.interpVars)) {
|
|
342
|
+
let t = ht(e);
|
|
343
|
+
for (let e of n) {
|
|
344
|
+
let n = pt(e.start?.unit) && !(t && e.start?.unit === "%"), r = pt(e.stop?.unit) && !(t && e.stop?.unit === "%");
|
|
345
|
+
if (n || r) return {
|
|
346
|
+
eligible: !1,
|
|
347
|
+
reason: `layout-dependent unit (${String(e.start?.unit ?? e.stop?.unit)}) would freeze to px under WAAPI`
|
|
348
|
+
};
|
|
349
|
+
if (e.start?.unit === "color" || e.stop?.unit === "color") return {
|
|
350
|
+
eligible: !1,
|
|
351
|
+
reason: "color interpolation requires perceptual lerp"
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return { eligible: !0 };
|
|
356
|
+
}
|
|
357
|
+
var _t = .005, I = (e, t) => {
|
|
358
|
+
let n = /* @__PURE__ */ new Map(), r = e.interpFrames(t, !1);
|
|
359
|
+
for (let e in r) {
|
|
360
|
+
let t = r[e];
|
|
361
|
+
if (t !== void 0) for (let r = 0; r < t.length; r++) {
|
|
362
|
+
let i = t[r]?.value;
|
|
363
|
+
typeof i == "number" && Number.isFinite(i) && n.set(t.length > 1 ? `${e}.${r}` : e, i);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return n;
|
|
367
|
+
}, vt = 64, yt = (e, t, n) => {
|
|
368
|
+
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = n - t;
|
|
369
|
+
for (let n = 0; n <= vt; n++) {
|
|
370
|
+
let o = I(e, t + a * n / vt);
|
|
371
|
+
for (let [e, t] of o) {
|
|
372
|
+
let n = r.get(e), a = i.get(e);
|
|
373
|
+
(n === void 0 || t < n) && r.set(e, t), (a === void 0 || t > a) && i.set(e, t);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
let o = /* @__PURE__ */ new Map();
|
|
377
|
+
for (let [e, t] of r) o.set(e, (i.get(e) ?? t) - t);
|
|
378
|
+
return o;
|
|
379
|
+
}, bt = (e, t, n, r, i, a) => {
|
|
380
|
+
let o = r - t, s = 0;
|
|
381
|
+
for (let r of [.25, .75]) {
|
|
382
|
+
let c = I(e, t + o * r);
|
|
383
|
+
for (let [e, t] of c) {
|
|
384
|
+
let o = n.get(e), c = i.get(e);
|
|
385
|
+
if (o === void 0 || c === void 0) continue;
|
|
386
|
+
let l = a.get(e);
|
|
387
|
+
if (l === void 0 || l === 0) continue;
|
|
388
|
+
let u = o + (c - o) * r, d = Math.abs(t - u) / l;
|
|
389
|
+
d > s && (s = d);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
return s;
|
|
393
|
+
};
|
|
394
|
+
function xt(e, t, n) {
|
|
395
|
+
let r = /* @__PURE__ */ new Set();
|
|
396
|
+
if (n <= 0) return r;
|
|
397
|
+
for (let n = 1; n < t.length; n++) {
|
|
398
|
+
let i = t[n - 1], a = t[n];
|
|
399
|
+
if (a - i <= 0) continue;
|
|
400
|
+
let o = yt(e, i, a), s = I(e, i), c = I(e, a), l = (t, n, r, i) => ({
|
|
401
|
+
a: t,
|
|
402
|
+
sampleA: n,
|
|
403
|
+
b: r,
|
|
404
|
+
sampleB: i,
|
|
405
|
+
error: bt(e, t, n, r, i, o)
|
|
406
|
+
}), u = [l(i, s, a, c)], d = 16;
|
|
407
|
+
for (; d > 0;) {
|
|
408
|
+
let t = -1, n = _t;
|
|
409
|
+
for (let e = 0; e < u.length; e++) u[e].error > n && (n = u[e].error, t = e);
|
|
410
|
+
if (t === -1) break;
|
|
411
|
+
let i = u[t], a = (i.a + i.b) / 2;
|
|
412
|
+
if (a <= i.a || a >= i.b) {
|
|
413
|
+
u.splice(t, 1);
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
let o = I(e, a);
|
|
417
|
+
r.add(a), d--, u.splice(t, 1, l(i.a, i.sampleA, a, o), l(a, o, i.b, i.sampleB));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
return r;
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/animation/waapi/emission.ts
|
|
424
|
+
function St(e) {
|
|
425
|
+
let t = e.options.duration, n = [], r = /* @__PURE__ */ new Set();
|
|
426
|
+
for (let t of e.frames) r.add(t.time.start), r.add(t.time.stop);
|
|
427
|
+
let a = [...r].sort((e, t) => e - t), o = new Set(a);
|
|
428
|
+
for (let n of xt(e, a, t)) o.add(n);
|
|
429
|
+
for (let r of [...o].sort((e, t) => e - t)) {
|
|
430
|
+
let a = e.interpFrames(r, !1);
|
|
431
|
+
if (Object.keys(a).length === 0) continue;
|
|
432
|
+
let o = T(a);
|
|
433
|
+
n.push({
|
|
434
|
+
offset: i(r / t, 0, 1),
|
|
435
|
+
...o
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
return n;
|
|
439
|
+
}
|
|
440
|
+
//#endregion
|
|
441
|
+
//#region src/animation/waapi/waapi-options.ts
|
|
442
|
+
var Ct = {
|
|
443
|
+
normal: "normal",
|
|
444
|
+
reverse: "reverse",
|
|
445
|
+
alternate: "alternate",
|
|
446
|
+
"alternate-reverse": "alternate-reverse"
|
|
447
|
+
}, wt = {
|
|
448
|
+
none: "none",
|
|
449
|
+
forwards: "forwards",
|
|
450
|
+
backwards: "backwards",
|
|
451
|
+
both: "both"
|
|
452
|
+
}, Tt = {
|
|
453
|
+
replace: "replace",
|
|
454
|
+
add: "add",
|
|
455
|
+
accumulate: "accumulate"
|
|
456
|
+
}, Et = (e) => {
|
|
457
|
+
for (let t of e.frames) {
|
|
458
|
+
let e = t.composition;
|
|
459
|
+
if (e != null && e !== "replace") return Tt[e] ?? "replace";
|
|
460
|
+
}
|
|
461
|
+
return "replace";
|
|
462
|
+
};
|
|
463
|
+
function Dt(e) {
|
|
464
|
+
let t = e.options, n = Ct[t.direction], r = wt[t.fillMode];
|
|
465
|
+
if (n == null) throw TypeError(`Unrecognised animation direction "${t.direction}".`);
|
|
466
|
+
if (r == null) throw TypeError(`Unrecognised animation fill mode "${t.fillMode}".`);
|
|
467
|
+
let i = e.frames[0]?.timingFunction ?? e.options.timingFunction, a = e.frames.length > 1 ? "linear" : i.css ?? "linear", o = Et(e), s = {
|
|
468
|
+
duration: t.duration,
|
|
469
|
+
delay: t.delay,
|
|
470
|
+
iterations: t.iterationCount === Infinity ? Infinity : t.iterationCount,
|
|
471
|
+
direction: n,
|
|
472
|
+
fill: r,
|
|
473
|
+
easing: a
|
|
474
|
+
};
|
|
475
|
+
return o !== "replace" && (s.composite = o), s;
|
|
476
|
+
}
|
|
477
|
+
//#endregion
|
|
478
|
+
//#region src/animation/waapi/delegation.ts
|
|
479
|
+
async function Ot(e) {
|
|
480
|
+
let t = St(e), n = Dt(e), r = e.targets.map((e) => e.animate(t, n));
|
|
481
|
+
e._playback._waAnimations = r;
|
|
482
|
+
let i = () => {
|
|
483
|
+
if (e.paused) for (let e of r) e.pause();
|
|
484
|
+
else for (let e of r) e.playState === "paused" && e.play();
|
|
485
|
+
return !e.done;
|
|
486
|
+
};
|
|
487
|
+
e.playback.loop((t) => {
|
|
488
|
+
if (e.done) return !1;
|
|
489
|
+
let n = e.advanceTo(t);
|
|
490
|
+
return n && typeof n.then == "function" ? n.then(i) : i();
|
|
491
|
+
});
|
|
492
|
+
try {
|
|
493
|
+
await Promise.all(r.map((e) => e.finished));
|
|
494
|
+
for (let t of r) try {
|
|
495
|
+
e.restPosition === "final" && typeof t.commitStyles == "function" && t.commitStyles(), t.cancel();
|
|
496
|
+
} catch {}
|
|
497
|
+
} catch {} finally {
|
|
498
|
+
e.playback.stop(), e._playback._waAnimations = [];
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
function kt(e, t, n) {
|
|
502
|
+
let r = n?.eligibility ?? F(e);
|
|
503
|
+
if (!r.eligible) return {
|
|
504
|
+
attached: !1,
|
|
505
|
+
reason: r.reason
|
|
506
|
+
};
|
|
507
|
+
let i = n?.timeline ?? u(t);
|
|
508
|
+
if (i == null) return {
|
|
509
|
+
attached: !1,
|
|
510
|
+
reason: "native scroll/view timeline unavailable (feature absent)"
|
|
511
|
+
};
|
|
512
|
+
let a = St(e), o = {
|
|
513
|
+
...Dt(e),
|
|
514
|
+
timeline: i
|
|
515
|
+
}, s = e.targets.map((e) => e.animate(a, o));
|
|
516
|
+
return e._playback._waAnimations = s, {
|
|
517
|
+
attached: !0,
|
|
518
|
+
animations: s
|
|
519
|
+
};
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
522
|
+
//#region src/animation/engine/play-lifecycle.ts
|
|
523
|
+
function At(e, t) {
|
|
524
|
+
if (!(typeof AnimationEvent > "u")) for (let n of e.targets) typeof n?.dispatchEvent == "function" && n.dispatchEvent(new AnimationEvent(t, {
|
|
525
|
+
animationName: e.name ?? "",
|
|
526
|
+
elapsedTime: e._playback.t / 1e3
|
|
527
|
+
}));
|
|
528
|
+
}
|
|
529
|
+
function jt(e, t) {
|
|
530
|
+
return e === "reverse" || e === "alternate-reverse" && t % 2 == 0 || e === "alternate" && t % 2 == 1;
|
|
531
|
+
}
|
|
532
|
+
function Mt(e) {
|
|
533
|
+
if (e._playback.startTime !== void 0) {
|
|
534
|
+
let t = e._playback.t, n = e.options.duration - 2 * t;
|
|
535
|
+
e._playback.startTime -= n;
|
|
536
|
+
}
|
|
537
|
+
e._playback.reversed = !e._playback.reversed;
|
|
538
|
+
}
|
|
539
|
+
function Nt(e) {
|
|
540
|
+
if (e._playback.reversed = !1, jt(e.options.direction, e._playback.iteration) && Mt(e), (e.options.fillMode === "backwards" || e.options.fillMode === "both") && e.fillBackwards(), e.options.delay > 0) return e._playback.paused = !0, ye(e.options.delay).then(() => {
|
|
541
|
+
e._playback.paused = !1, e._playback.started = !0;
|
|
542
|
+
});
|
|
543
|
+
e._playback.started = !0;
|
|
544
|
+
}
|
|
545
|
+
function Pt(e) {
|
|
546
|
+
e.paintRest(), e._playback.startTime = void 0, e._playback.iteration >= e.options.iterationCount - 1 ? (e._playback.done = !0, e._playback.iteration = 0, e.dispatchAnimationEvent("animationend")) : (e._playback.iteration += 1, e.dispatchAnimationEvent("animationiteration"));
|
|
547
|
+
}
|
|
548
|
+
function Ft(e, t) {
|
|
549
|
+
if (e._playback.startTime === void 0) {
|
|
550
|
+
let n = Nt(e), r = () => (e._playback.startTime = t + e.options.delay, e.dispatchAnimationEvent("animationstart"), It(e, t));
|
|
551
|
+
return n ? n.then(r) : r();
|
|
552
|
+
}
|
|
553
|
+
return It(e, t);
|
|
554
|
+
}
|
|
555
|
+
function It(e, t) {
|
|
556
|
+
if (e._playback.paused && e._playback.pausedTime === 0) return e._playback.pausedTime = t, e._playback.t;
|
|
557
|
+
if (e._playback.pausedTime > 0 && !e._playback.paused) {
|
|
558
|
+
let n = t - e._playback.pausedTime;
|
|
559
|
+
e._playback.startTime += n, e._playback.pausedTime = 0;
|
|
560
|
+
}
|
|
561
|
+
return e._playback.t = t - e._playback.startTime, e._playback.t >= e.options.duration && (Pt(e), e._playback.t = e.options.duration), e._playback.t;
|
|
562
|
+
}
|
|
563
|
+
function Lt(e, t) {
|
|
564
|
+
if (o(e.options.respectReducedMotion, () => !0, () => !1)) return Wt(e), !1;
|
|
565
|
+
let n = e.advanceTo(t);
|
|
566
|
+
return typeof n == "number" ? Rt(e, n) : n.then((t) => Rt(e, t));
|
|
567
|
+
}
|
|
568
|
+
function Rt(e, t) {
|
|
569
|
+
return e._playback.paused ? !1 : e._playback.done ? (L(e), zt(e), !1) : (e.interpFrames(t, !0, e._playback._interpOut), !0);
|
|
570
|
+
}
|
|
571
|
+
function zt(e) {
|
|
572
|
+
let t = e._playback.resolvePromise;
|
|
573
|
+
e._playback.resolvePromise = null, t?.();
|
|
574
|
+
}
|
|
575
|
+
function Bt(e) {
|
|
576
|
+
return new Promise((t) => {
|
|
577
|
+
e._playback.resolvePromise = t, e.playback.loop(e._playback._boundFrame);
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
async function Vt(e) {
|
|
581
|
+
await Ot(e), L(e);
|
|
582
|
+
}
|
|
583
|
+
function Ht(e) {
|
|
584
|
+
let t = e._playback._waAnimations;
|
|
585
|
+
if (t.length !== 0) {
|
|
586
|
+
for (let e of t) try {
|
|
587
|
+
e.cancel();
|
|
588
|
+
} catch {}
|
|
589
|
+
e._playback._waAnimations = [];
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
async function Ut(e) {
|
|
593
|
+
e._playback.started = !0, e.dispatchAnimationEvent("animationstart"), e.fillForwards(), e._playback.iteration = 0, e._playback.done = !0, e.dispatchAnimationEvent("animationend"), L(e);
|
|
594
|
+
}
|
|
595
|
+
function Wt(e) {
|
|
596
|
+
Ht(e), e.fillForwards(), e._playback.iteration = 0, e._playback.done = !0, e.dispatchAnimationEvent("animationend"), L(e), zt(e);
|
|
597
|
+
}
|
|
598
|
+
async function Gt(e) {
|
|
599
|
+
if (e.managed) throw Error("Animation.play() called on a managed animation — the AnimationGroup owns the rAF loop. Call group.play() instead.");
|
|
600
|
+
return e.assertNoUnresolvedNamedSelector(), s(e._playback, () => o(e.options.respectReducedMotion, () => (e.waapiIneligibleReason = void 0, Ut(e)), () => {
|
|
601
|
+
if (e.options.useWAAPI) {
|
|
602
|
+
let t = F(e);
|
|
603
|
+
return t.eligible ? (e.waapiIneligibleReason = void 0, Vt(e)) : (e.waapiIneligibleReason = t.reason, Bt(e));
|
|
604
|
+
}
|
|
605
|
+
return e.waapiIneligibleReason = void 0, Bt(e);
|
|
606
|
+
}));
|
|
607
|
+
}
|
|
608
|
+
function Kt(e) {
|
|
609
|
+
e._playback.started && (e._playback.paused = !0);
|
|
610
|
+
}
|
|
611
|
+
function qt(e) {
|
|
612
|
+
if (e._playback.started && e._playback.paused) if (e._playback.paused = !1, e._playback._waAnimations.length > 0) for (let t of e._playback._waAnimations) t.play();
|
|
613
|
+
else e.playback.running || e.playback.loop(e._playback._boundFrame);
|
|
614
|
+
}
|
|
615
|
+
function Jt(e) {
|
|
616
|
+
a(e._playback, () => Kt(e), () => qt(e));
|
|
617
|
+
}
|
|
618
|
+
function Yt(e) {
|
|
619
|
+
Ht(e), e.playback.stop(), L(e), zt(e);
|
|
620
|
+
}
|
|
621
|
+
function Xt(e) {
|
|
622
|
+
return l(e._playback);
|
|
623
|
+
}
|
|
624
|
+
function Zt(e) {
|
|
625
|
+
return e._playback.reversed ? e.options.duration - e._playback.t : e._playback.t;
|
|
626
|
+
}
|
|
627
|
+
function L(e) {
|
|
628
|
+
e._playback.done = !1, e._playback.started = !1, e._playback.paused = !1, e._playback.reversed = !1, e._playback.iteration = 0, e._playback.startTime = void 0, e._playback.pausedTime = 0, e._playback.t = 0;
|
|
629
|
+
}
|
|
630
|
+
function Qt(e) {
|
|
631
|
+
Ht(e), e._playback.started && e.frames.length > 0 && e.fillBackwards(), L(e);
|
|
632
|
+
}
|
|
633
|
+
//#endregion
|
|
634
|
+
//#region src/animation/engine/playback-state.ts
|
|
635
|
+
var $t = class {
|
|
636
|
+
resolvePromise = null;
|
|
637
|
+
_playingPromise = null;
|
|
638
|
+
_waAnimations = [];
|
|
639
|
+
_boundFrame;
|
|
640
|
+
_interpOut = {};
|
|
641
|
+
startTime = void 0;
|
|
642
|
+
pausedTime = 0;
|
|
643
|
+
t = 0;
|
|
644
|
+
iteration = 0;
|
|
645
|
+
started = !1;
|
|
646
|
+
done = !1;
|
|
647
|
+
reversed = !1;
|
|
648
|
+
paused = !1;
|
|
649
|
+
constructor(e) {
|
|
650
|
+
this._boundFrame = e;
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region src/animation/engine/composition.ts
|
|
655
|
+
function en(e) {
|
|
656
|
+
for (let t of e) if (t.composition != null && t.composition !== "replace") return !0;
|
|
657
|
+
return !1;
|
|
658
|
+
}
|
|
659
|
+
function tn(e, t, n) {
|
|
660
|
+
e.clear(), t.clear(), n?.clear();
|
|
661
|
+
}
|
|
662
|
+
function nn(e, t) {
|
|
663
|
+
let n = e.composition;
|
|
664
|
+
if (n == null || n === "replace") return;
|
|
665
|
+
let r = e.flatVars;
|
|
666
|
+
for (let i in r) {
|
|
667
|
+
let a = r[i];
|
|
668
|
+
if (!Array.isArray(a) || a.length === 0) continue;
|
|
669
|
+
if (!a.every((e) => e instanceof w && typeof e.value == "number")) {
|
|
670
|
+
on(i, n, t);
|
|
671
|
+
continue;
|
|
672
|
+
}
|
|
673
|
+
let o = t.compositionBase.get(i);
|
|
674
|
+
o === void 0 && (o = rn(t.target, i, a.length, t.compositionPose), t.compositionBase.set(i, o));
|
|
675
|
+
let s = n === "accumulate" ? t.iteration : 0;
|
|
676
|
+
for (let n = 0; n < a.length; n++) {
|
|
677
|
+
let r = a[n], c = o[n] ?? 0;
|
|
678
|
+
s > 0 ? r.value = c + s * (an(e, i, n, t.compositionBase) - c) + r.value : r.value = c + r.value;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
function rn(e, t, n, r) {
|
|
683
|
+
let i = Array(n).fill(0);
|
|
684
|
+
if (e == null || e.style == null) return i;
|
|
685
|
+
let a = t.split(".").pop() ?? t, o = r?.get(a);
|
|
686
|
+
if (o !== void 0) return o.slice(0, n);
|
|
687
|
+
let s = e.style.getPropertyValue(a) || e.style[a] || "";
|
|
688
|
+
if (!s) return i;
|
|
689
|
+
let c = s.match(/-?\d*\.?\d+(?:e[+-]?\d+)?/gi);
|
|
690
|
+
if (c == null) return i;
|
|
691
|
+
for (let e = 0; e < n && e < c.length; e++) {
|
|
692
|
+
let t = Number.parseFloat(c[e]);
|
|
693
|
+
Number.isFinite(t) && (i[e] = t);
|
|
694
|
+
}
|
|
695
|
+
return r?.set(a, i.slice()), i;
|
|
696
|
+
}
|
|
697
|
+
function an(e, t, n, r) {
|
|
698
|
+
let i = e.interpVars[t]?.[n]?.stop;
|
|
699
|
+
return i instanceof w && typeof i.value == "number" ? i.value : r.get(t)?.[n] ?? 0;
|
|
700
|
+
}
|
|
701
|
+
function on(e, t, n) {
|
|
702
|
+
n.compositionFallbackSeen.has(e) || (n.compositionFallbackSeen.add(e), n.diagnostics.push({
|
|
703
|
+
code: "COMPOSITION_FALLBACK",
|
|
704
|
+
message: `animation-composition: ${t} on a non-numeric leaf "${e}" has no faithful numeric add — composited as \`replace\` (the lerped value), never a wrong sum`,
|
|
705
|
+
property: e
|
|
706
|
+
}));
|
|
707
|
+
}
|
|
708
|
+
//#endregion
|
|
709
|
+
//#region src/animation/compile/plain-vars.ts
|
|
710
|
+
var sn = (e) => e instanceof w && typeof e.value == "number" && (e.unit == null || e.unit === "") && !de(e), cn = (e) => e.length === 1 ? String(e[0]) : e.map((e) => String(e)).join(" "), ln = (e, t) => {
|
|
711
|
+
if (t.indexOf(".") === -1) return {
|
|
712
|
+
obj: e,
|
|
713
|
+
key: t
|
|
714
|
+
};
|
|
715
|
+
let n = t.split("."), r = e;
|
|
716
|
+
for (let e = 0; e < n.length - 1; e++) {
|
|
717
|
+
let t = n[e], i = r[t];
|
|
718
|
+
(typeof i != "object" || !i) && (i = {}, r[t] = i), r = i;
|
|
719
|
+
}
|
|
720
|
+
return {
|
|
721
|
+
obj: r,
|
|
722
|
+
key: n[n.length - 1]
|
|
723
|
+
};
|
|
724
|
+
}, un = (e) => {
|
|
725
|
+
let t = {}, n = [];
|
|
726
|
+
for (let r in e) {
|
|
727
|
+
let i = e[r];
|
|
728
|
+
if (i === void 0) continue;
|
|
729
|
+
let { obj: a, key: o } = ln(t, r), s = i.length === 1 && sn(i[0]);
|
|
730
|
+
a[o] = s ? i[0].value : cn(i), n.push({
|
|
731
|
+
obj: a,
|
|
732
|
+
key: o,
|
|
733
|
+
units: i,
|
|
734
|
+
numeric: s
|
|
735
|
+
});
|
|
736
|
+
}
|
|
737
|
+
return {
|
|
738
|
+
root: t,
|
|
739
|
+
writers: n
|
|
740
|
+
};
|
|
741
|
+
}, dn = (e) => {
|
|
742
|
+
let { writers: t } = e;
|
|
743
|
+
for (let e = 0; e < t.length; e++) {
|
|
744
|
+
let n = t[e];
|
|
745
|
+
n.obj[n.key] = n.numeric ? n.units[0].value : cn(n.units);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/animation/engine/interpolate.ts
|
|
750
|
+
function fn(e) {
|
|
751
|
+
return e.options.fillMode === "forwards" || e.options.fillMode === "both" ? "final" : "initial";
|
|
752
|
+
}
|
|
753
|
+
function pn(e) {
|
|
754
|
+
fn(e) === "final" ? R(e, e.options.duration, !0) : R(e, 0, !0);
|
|
755
|
+
}
|
|
756
|
+
function mn(t) {
|
|
757
|
+
let n = t.compiler.templateFrames.find((e) => e.start.superType?.includes(nt));
|
|
758
|
+
if (n != null) {
|
|
759
|
+
let t = String(n.start.value);
|
|
760
|
+
throw new e("start", t, `named scroll-range selector ("${t}") requires a ScrollTimeline or ManualTimeline — call bindTimeline(timeline) before play() to resolve the named phase to a numeric position`, "NAMED_SELECTOR_NO_TIMELINE");
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
function hn(e, t, n = !1) {
|
|
764
|
+
mn(e);
|
|
765
|
+
let r = e._playback.reversed;
|
|
766
|
+
e._playback.reversed = !1;
|
|
767
|
+
let i = R(e, _(t, 0, 1) * e.options.duration, n);
|
|
768
|
+
return e._playback.reversed = r, i;
|
|
769
|
+
}
|
|
770
|
+
function R(e, t, n = !1, r) {
|
|
771
|
+
t = e._playback.reversed ? e.options.duration - t : t;
|
|
772
|
+
let i = e.frames, a = i.length, o = p(i, t, (e) => e.time.start, (e) => e.time.stop);
|
|
773
|
+
if (o === -1) return r === void 0 ? {} : (gn(e, r), r);
|
|
774
|
+
let s = o, c = o;
|
|
775
|
+
for (let e = o - 1; e >= 0; e--) {
|
|
776
|
+
let n = i[e];
|
|
777
|
+
if (t < n.time.start || t > n.time.stop) break;
|
|
778
|
+
s = e;
|
|
779
|
+
}
|
|
780
|
+
for (let e = o + 1; e < a; e++) {
|
|
781
|
+
let n = i[e];
|
|
782
|
+
if (t < n.time.start || t > n.time.stop) break;
|
|
783
|
+
c = e;
|
|
784
|
+
}
|
|
785
|
+
for (let r = s; r <= c; r++) _n(e, i[r], t, n);
|
|
786
|
+
if (s === c) {
|
|
787
|
+
let t = i[o].flatVars;
|
|
788
|
+
return r === void 0 ? t : (gn(e, r), Object.assign(r, t), r);
|
|
789
|
+
}
|
|
790
|
+
let l = r ?? {};
|
|
791
|
+
r !== void 0 && gn(e, r);
|
|
792
|
+
for (let e = s; e <= c; e++) Object.assign(l, i[e].flatVars);
|
|
793
|
+
return l;
|
|
794
|
+
}
|
|
795
|
+
function gn(e, t) {
|
|
796
|
+
let n = e._stableKeys;
|
|
797
|
+
for (let e = 0; e < n.length; e++) t[n[e]] = void 0;
|
|
798
|
+
}
|
|
799
|
+
function _n(e, t, n, r) {
|
|
800
|
+
let { start: i, stop: a } = t.time, o = i === a ? 1 : y(n, i, a, 0, 1), s = t.timingFunction.fn(o), c = t._numericPlan;
|
|
801
|
+
if (c !== void 0 && c.numeric.length > 0) {
|
|
802
|
+
let { numeric: e, from: t, to: n, out: r } = c;
|
|
803
|
+
ee(t, n, s, r);
|
|
804
|
+
for (let t = 0; t < e.length; t++) e[t].value.value = r[t];
|
|
805
|
+
for (let e of c.boxed) me(s, e);
|
|
806
|
+
} else for (let e of t.allInterpVars) me(s, e);
|
|
807
|
+
if (r && e._hasComposition && t.composition != null && vn(e, t), r) if (e.unflatten) {
|
|
808
|
+
let e = t._plainProj;
|
|
809
|
+
e === void 0 ? (e = un(t.flatVars), t._plainProj = e, t.plainVars = e.root) : dn(e), t.transform(t.plainVars, n);
|
|
810
|
+
} else t.transform(t.flatVars, n);
|
|
811
|
+
}
|
|
812
|
+
function vn(e, t) {
|
|
813
|
+
nn(t, {
|
|
814
|
+
iteration: e._playback.iteration,
|
|
815
|
+
target: e.targets[0],
|
|
816
|
+
compositionBase: e._compositionBase,
|
|
817
|
+
compositionPose: e._compositionPose,
|
|
818
|
+
compositionFallbackSeen: e._compositionFallbackSeen,
|
|
819
|
+
diagnostics: e.diagnostics
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region src/animation/engine/options.ts
|
|
824
|
+
var yn = (e) => {
|
|
825
|
+
try {
|
|
826
|
+
let t = ke(e);
|
|
827
|
+
return Number.isFinite(t) ? t : void 0;
|
|
828
|
+
} catch {
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
831
|
+
};
|
|
832
|
+
function bn(e) {
|
|
833
|
+
return e == null ? j.timingFunction : lt("timingFunction", e);
|
|
834
|
+
}
|
|
835
|
+
function xn(e) {
|
|
836
|
+
return e == null ? j.iterationCount : e === "infinite" || e === "∞" || e === "Infinity" || e === Infinity ? Infinity : m("iterationCount", e, (e) => {
|
|
837
|
+
let t = typeof e == "string" ? Number.parseFloat(e.trim()) : e;
|
|
838
|
+
return typeof t == "number" && !Number.isNaN(t) && t >= 0 ? t : void 0;
|
|
839
|
+
}, "expected a non-negative count, \"infinite\", or Infinity");
|
|
840
|
+
}
|
|
841
|
+
function Sn(e) {
|
|
842
|
+
if (e != null) return m("duration", e, (e) => {
|
|
843
|
+
let t = typeof e == "string" ? yn(e) : e;
|
|
844
|
+
return typeof t == "number" && isFinite(t) && t > 0 ? t : void 0;
|
|
845
|
+
}, "expected a positive duration in milliseconds or a CSS time string");
|
|
846
|
+
}
|
|
847
|
+
function Cn(e) {
|
|
848
|
+
return e == null ? j.delay : m("delay", e, (e) => {
|
|
849
|
+
let t = typeof e == "string" ? yn(e) : e;
|
|
850
|
+
return typeof t == "number" && isFinite(t) ? t : void 0;
|
|
851
|
+
}, "expected a delay in milliseconds or a CSS time string");
|
|
852
|
+
}
|
|
853
|
+
function wn(t) {
|
|
854
|
+
if (t == null) return j.direction;
|
|
855
|
+
if (!Re.includes(t)) throw new e("direction", t, `expected one of: ${Re.join(", ")}`);
|
|
856
|
+
return t;
|
|
857
|
+
}
|
|
858
|
+
function Tn(t) {
|
|
859
|
+
if (t == null) return j.fillMode;
|
|
860
|
+
if (!ze.includes(t)) throw new e("fillMode", t, `expected one of: ${ze.join(", ")}`);
|
|
861
|
+
return t;
|
|
862
|
+
}
|
|
863
|
+
function En(t, n) {
|
|
864
|
+
if (n == null) return j[t];
|
|
865
|
+
if (typeof n != "boolean") throw new e(t, n, "expected a boolean");
|
|
866
|
+
return n;
|
|
867
|
+
}
|
|
868
|
+
function Dn(t) {
|
|
869
|
+
if (t == null) return j.colorSpace;
|
|
870
|
+
if (!Be.includes(t)) throw new e("colorSpace", t, `expected one of: ${Be.join(", ")}`);
|
|
871
|
+
return t;
|
|
872
|
+
}
|
|
873
|
+
function On(t) {
|
|
874
|
+
if (t != null) {
|
|
875
|
+
if (!Ve.includes(t)) throw new e("hueMethod", t, `expected one of: ${Ve.join(", ")}`);
|
|
876
|
+
return t;
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
//#endregion
|
|
880
|
+
//#region src/animation/engine/option-setters.ts
|
|
881
|
+
function kn(e, t) {
|
|
882
|
+
e.options.timingFunction = bn(t);
|
|
883
|
+
}
|
|
884
|
+
function An(e, t) {
|
|
885
|
+
e.options.iterationCount = xn(t);
|
|
886
|
+
}
|
|
887
|
+
function jn(e, t) {
|
|
888
|
+
let n = Sn(t);
|
|
889
|
+
if (n === void 0) return;
|
|
890
|
+
let r = n / e.options.duration;
|
|
891
|
+
for (let t = 0; t < e.frames.length; t++) {
|
|
892
|
+
let n = e.frames[t];
|
|
893
|
+
n.time.start *= r, n.time.stop *= r;
|
|
894
|
+
}
|
|
895
|
+
e.options.duration = n;
|
|
896
|
+
}
|
|
897
|
+
function Mn(e, t) {
|
|
898
|
+
e.options.delay = Cn(t);
|
|
899
|
+
}
|
|
900
|
+
function Nn(e, t) {
|
|
901
|
+
e.options.direction = wn(t), e._playback.reversed = jt(e.options.direction, e._playback.iteration);
|
|
902
|
+
}
|
|
903
|
+
function Pn(e, t) {
|
|
904
|
+
e.options.fillMode = Tn(t);
|
|
905
|
+
}
|
|
906
|
+
function Fn(e, t) {
|
|
907
|
+
e.options.useWAAPI = En("useWAAPI", t);
|
|
908
|
+
}
|
|
909
|
+
function In(e, t) {
|
|
910
|
+
e.options.respectReducedMotion = En("respectReducedMotion", t);
|
|
911
|
+
}
|
|
912
|
+
function Ln(e, t) {
|
|
913
|
+
e.options.colorSpace = Dn(t), e.frames.length > 0 && e.compiler.renormalizeColors();
|
|
914
|
+
}
|
|
915
|
+
function Rn(e, t) {
|
|
916
|
+
let n = On(t);
|
|
917
|
+
n !== void 0 && (e.options.hueMethod = n, e.frames.length > 0 && e.compiler.renormalizeColors());
|
|
918
|
+
}
|
|
919
|
+
function zn(e, t) {
|
|
920
|
+
t !== void 0 && (e.options.composite = t);
|
|
921
|
+
}
|
|
922
|
+
function Bn(e, t) {
|
|
923
|
+
kn(e, t.timingFunction), jn(e, t.duration), An(e, t.iterationCount), Mn(e, t.delay), Nn(e, t.direction), Pn(e, t.fillMode), Fn(e, t.useWAAPI), In(e, t.respectReducedMotion), Ln(e, t.colorSpace), Rn(e, t.hueMethod), zn(e, t.composite);
|
|
924
|
+
}
|
|
925
|
+
//#endregion
|
|
926
|
+
//#region src/animation/engine/compile-bridge.ts
|
|
927
|
+
function Vn(e) {
|
|
928
|
+
e.compiler.parse(e.targets), Un(e), Hn(e);
|
|
929
|
+
}
|
|
930
|
+
function Hn(e) {
|
|
931
|
+
e._hasComposition = en(e.frames), tn(e._compositionBase, e._compositionFallbackSeen, e._compositionPose);
|
|
932
|
+
}
|
|
933
|
+
function Un(e) {
|
|
934
|
+
let t = /* @__PURE__ */ new Set();
|
|
935
|
+
for (let n of e.frames) for (let e in n.flatVars) t.add(e);
|
|
936
|
+
e._stableKeys = [...t];
|
|
937
|
+
}
|
|
938
|
+
function Wn(e, t) {
|
|
939
|
+
e._setCompiler(t.compiler), e.options = e.compiler.options, e.unflatten = t.unflatten, Un(e), Hn(e);
|
|
940
|
+
}
|
|
941
|
+
//#endregion
|
|
942
|
+
//#region src/animation/resolve/env.ts
|
|
943
|
+
var Gn = () => {
|
|
944
|
+
let e = typeof globalThis < "u" && typeof globalThis.CSS?.supports == "function", t = typeof globalThis < "u" && typeof globalThis.matchMedia == "function";
|
|
945
|
+
return {
|
|
946
|
+
supports: e ? (e) => globalThis.CSS.supports(e) : () => !1,
|
|
947
|
+
matchMedia: t ? (e) => globalThis.matchMedia(e) : () => ({ matches: !1 })
|
|
948
|
+
};
|
|
949
|
+
}, Kn = (e, t, n) => {
|
|
950
|
+
let r = {
|
|
951
|
+
functions: e,
|
|
952
|
+
env: {
|
|
953
|
+
...Gn(),
|
|
954
|
+
...t
|
|
955
|
+
},
|
|
956
|
+
seen: /* @__PURE__ */ new Set(),
|
|
957
|
+
depth: 0
|
|
958
|
+
};
|
|
959
|
+
return n !== void 0 && (r.diagnostics = n), r;
|
|
960
|
+
}, z = Symbol("kf.resolve.drop"), qn = (e, t, n) => {
|
|
961
|
+
if (t.syntax === void 0) return e;
|
|
962
|
+
let r = be(String(e), t.syntax);
|
|
963
|
+
if (r !== null) return r;
|
|
964
|
+
if (t.default === void 0) return z;
|
|
965
|
+
try {
|
|
966
|
+
return Ae(t.default);
|
|
967
|
+
} catch (e) {
|
|
968
|
+
return n?.push({
|
|
969
|
+
code: "CUSTOM_FN_ARG_DROP",
|
|
970
|
+
property: t.name,
|
|
971
|
+
message: `--fn() arg coercion: default for ${t.name} failed to parse (${String(e)})`
|
|
972
|
+
}), z;
|
|
973
|
+
}
|
|
974
|
+
}, Jn = (e, t) => !(e instanceof w) || e.unit !== "var" ? !1 : String(e.value).split(",", 1)[0]?.trim() === t, Yn = (e, t) => {
|
|
975
|
+
if (e instanceof w) {
|
|
976
|
+
if (e.unit === "var") {
|
|
977
|
+
for (let [n, r] of t) if (Jn(e, n)) return r.clone();
|
|
978
|
+
}
|
|
979
|
+
return e;
|
|
980
|
+
}
|
|
981
|
+
let n = e.values.map((e) => Yn(e, t));
|
|
982
|
+
return new S(e.name, n);
|
|
983
|
+
}, Xn = (e, t, n) => {
|
|
984
|
+
if (t.seen.has(e.name)) return z;
|
|
985
|
+
let r = t.functions.get(e.name);
|
|
986
|
+
if (r === void 0 || r.result === void 0) return z;
|
|
987
|
+
let i = r.parameters ?? [], a = e.values;
|
|
988
|
+
if (a.length > i.length) return z;
|
|
989
|
+
let o = /* @__PURE__ */ new Map();
|
|
990
|
+
for (let e = 0; e < i.length; e++) {
|
|
991
|
+
let n = i[e], r = a[e], s;
|
|
992
|
+
if (r === void 0) {
|
|
993
|
+
if (n.default === void 0) return z;
|
|
994
|
+
try {
|
|
995
|
+
s = Ae(n.default);
|
|
996
|
+
} catch (e) {
|
|
997
|
+
return t.diagnostics?.push({
|
|
998
|
+
code: "CUSTOM_FN_ARG_DROP",
|
|
999
|
+
property: n.name,
|
|
1000
|
+
message: `--fn() missing-positional default for ${n.name} failed to parse (${String(e)})`
|
|
1001
|
+
}), z;
|
|
1002
|
+
}
|
|
1003
|
+
} else s = qn(r, n, t.diagnostics);
|
|
1004
|
+
if (s === z) return z;
|
|
1005
|
+
o.set(n.name, s);
|
|
1006
|
+
}
|
|
1007
|
+
let s = r.result.clone().map((e) => Yn(e, o));
|
|
1008
|
+
t.seen.add(e.name);
|
|
1009
|
+
let c = [];
|
|
1010
|
+
for (let e of s) {
|
|
1011
|
+
let r = n(e, {
|
|
1012
|
+
...t,
|
|
1013
|
+
depth: t.depth + 1
|
|
1014
|
+
});
|
|
1015
|
+
r !== z && c.push(r);
|
|
1016
|
+
}
|
|
1017
|
+
return t.seen.delete(e.name), c.length === 0 ? z : c[0];
|
|
1018
|
+
}, Zn = (e) => {
|
|
1019
|
+
let t = e.indexOf("(");
|
|
1020
|
+
if (t <= 0 || !e.trimEnd().endsWith(")")) return;
|
|
1021
|
+
let n = e.slice(0, t).trim().toLowerCase(), r = e.slice(t + 1, e.lastIndexOf(")")).trim();
|
|
1022
|
+
if (!(!n || !r)) return {
|
|
1023
|
+
name: n,
|
|
1024
|
+
query: r
|
|
1025
|
+
};
|
|
1026
|
+
}, Qn = (e, t) => {
|
|
1027
|
+
let n = String(e instanceof w ? e.value : e).trim();
|
|
1028
|
+
if (n === "else" || n === "") return !0;
|
|
1029
|
+
let r = Zn(n);
|
|
1030
|
+
if (!r) return !1;
|
|
1031
|
+
let { name: i, query: a } = r;
|
|
1032
|
+
return i === "supports" ? t.env.supports?.(a) ?? !1 : i === "media" ? t.env.matchMedia?.(a)?.matches ?? !1 : i === "style" ? t.env.customProps === void 0 ? void 0 : $n(a, t.env.customProps) : !1;
|
|
1033
|
+
}, $n = (e, t) => {
|
|
1034
|
+
let n = e.indexOf(":");
|
|
1035
|
+
if (n === -1) {
|
|
1036
|
+
let n = e.trim();
|
|
1037
|
+
return n === "" ? !1 : t(n) !== void 0;
|
|
1038
|
+
}
|
|
1039
|
+
let r = e.slice(0, n).trim(), i = e.slice(n + 1).trim();
|
|
1040
|
+
if (r === "") return !1;
|
|
1041
|
+
let a = t(r);
|
|
1042
|
+
if (a === void 0) return !1;
|
|
1043
|
+
let o = (e) => e.trim().replace(/\s+/g, " ");
|
|
1044
|
+
return o(a) === o(i);
|
|
1045
|
+
}, er = (e) => e instanceof w && String(e.value).trim() === "", tr = (e) => {
|
|
1046
|
+
if (e === z) return e;
|
|
1047
|
+
if (e instanceof w && e.unit === "string") try {
|
|
1048
|
+
return Ae(String(e.value));
|
|
1049
|
+
} catch {
|
|
1050
|
+
return e;
|
|
1051
|
+
}
|
|
1052
|
+
return e;
|
|
1053
|
+
}, nr = (e, t, n) => {
|
|
1054
|
+
let r = e.values, i = r[0], a = r[1], o = r[2];
|
|
1055
|
+
if (i === void 0 || a === void 0) return z;
|
|
1056
|
+
let s = Qn(i, t);
|
|
1057
|
+
return s === void 0 ? e : s ? tr(n(a, t)) : o !== void 0 && !er(o) ? tr(n(o, t)) : z;
|
|
1058
|
+
}, rr = (e) => {
|
|
1059
|
+
if (e.name !== "if") return !1;
|
|
1060
|
+
let t = e.values[0];
|
|
1061
|
+
return t === void 0 ? !1 : Zn(String(t instanceof w ? t.value : t).trim())?.name === "style";
|
|
1062
|
+
}, ir = 32, B = (e, t) => {
|
|
1063
|
+
if (t.depth > ir) return z;
|
|
1064
|
+
if (e instanceof w || !(e instanceof S)) return e;
|
|
1065
|
+
if (e.name === "if") return nr(e, {
|
|
1066
|
+
...t,
|
|
1067
|
+
depth: t.depth + 1
|
|
1068
|
+
}, B);
|
|
1069
|
+
if (e.name === "sibling-index") {
|
|
1070
|
+
let n = t.env.siblingIndex;
|
|
1071
|
+
return n === void 0 ? e : new w(n(), "");
|
|
1072
|
+
}
|
|
1073
|
+
if (e.name === "sibling-count") {
|
|
1074
|
+
let n = t.env.siblingCount;
|
|
1075
|
+
return n === void 0 ? e : new w(n(), "");
|
|
1076
|
+
}
|
|
1077
|
+
if (e.name.startsWith("--") && t.functions.has(e.name)) return Xn(e, t, B);
|
|
1078
|
+
let n = [], r = !1;
|
|
1079
|
+
for (let i of e.values) {
|
|
1080
|
+
let e = B(i, {
|
|
1081
|
+
...t,
|
|
1082
|
+
depth: t.depth + 1
|
|
1083
|
+
});
|
|
1084
|
+
if (e === z) {
|
|
1085
|
+
r = !0;
|
|
1086
|
+
continue;
|
|
1087
|
+
}
|
|
1088
|
+
e !== i && (r = !0), n.push(e);
|
|
1089
|
+
}
|
|
1090
|
+
return r ? new S(e.name, n) : e;
|
|
1091
|
+
}, ar = (e, t) => {
|
|
1092
|
+
let n = [], r = !1;
|
|
1093
|
+
for (let i of e) {
|
|
1094
|
+
let e = B(i, t);
|
|
1095
|
+
if (e === z) {
|
|
1096
|
+
r = !0;
|
|
1097
|
+
continue;
|
|
1098
|
+
}
|
|
1099
|
+
e !== i && (r = !0), n.push(e);
|
|
1100
|
+
}
|
|
1101
|
+
return n.length === 0 ? z : r ? new C(...n) : e;
|
|
1102
|
+
}, or = (e) => e instanceof S ? e.name === "if" || e.name === "spring" || e.name === "sibling-index" || e.name === "sibling-count" || e.name.startsWith("--") ? !0 : e.values.some((e) => or(e)) : e instanceof C ? e.some((e) => or(e)) : !1, V = (e) => e instanceof S ? e.name === "sibling-index" || e.name === "sibling-count" || rr(e) ? !0 : e.values.some((e) => V(e)) : e instanceof C ? e.some((e) => V(e)) : !1;
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region src/animation/resolve/element-resolve.ts
|
|
1105
|
+
function sr(e) {
|
|
1106
|
+
let t = e.compiler.templateFrames, n = !1;
|
|
1107
|
+
for (let e of t) {
|
|
1108
|
+
let t = e.vars;
|
|
1109
|
+
for (let e in t) if (V(t[e])) {
|
|
1110
|
+
n = !0;
|
|
1111
|
+
break;
|
|
1112
|
+
}
|
|
1113
|
+
if (n) break;
|
|
1114
|
+
}
|
|
1115
|
+
if (!n) return !1;
|
|
1116
|
+
let r = lr(e);
|
|
1117
|
+
if (r === void 0) return !1;
|
|
1118
|
+
let i = Kn(/* @__PURE__ */ new Map(), r), a = !1;
|
|
1119
|
+
for (let e of t) {
|
|
1120
|
+
let t = e.vars;
|
|
1121
|
+
for (let e in t) {
|
|
1122
|
+
let n = t[e];
|
|
1123
|
+
if (!(n instanceof C) || !V(n)) continue;
|
|
1124
|
+
let r = ar(n, i);
|
|
1125
|
+
if (r === z) {
|
|
1126
|
+
delete t[e], a = !0;
|
|
1127
|
+
continue;
|
|
1128
|
+
}
|
|
1129
|
+
r !== n && (t[e] = r, a = !0);
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
return a ? (e.parse(), !0) : !1;
|
|
1133
|
+
}
|
|
1134
|
+
function cr(e) {
|
|
1135
|
+
if (!sr(e)) for (let t of e.frames) for (let n of Object.values(t.interpVars)) for (let { start: t, stop: r, value: i } of n) t.setTargets(e.targets), r.setTargets(e.targets), i.setTargets(e.targets);
|
|
1136
|
+
}
|
|
1137
|
+
function lr(e) {
|
|
1138
|
+
let t = e.targets[0];
|
|
1139
|
+
if (t == null) return;
|
|
1140
|
+
let n = { customProps: (e) => {
|
|
1141
|
+
let n = "";
|
|
1142
|
+
return t instanceof Element && typeof getComputedStyle == "function" && (n = getComputedStyle(t).getPropertyValue(e).trim()), n === "" && (n = t.style.getPropertyValue(e).trim()), n === "" ? void 0 : n;
|
|
1143
|
+
} }, r = t.parentElement;
|
|
1144
|
+
return r != null && (n.siblingIndex = () => Array.prototype.indexOf.call(r.children, t) + 1, n.siblingCount = () => r.children.length), n;
|
|
1145
|
+
}
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region src/animation/internal/animation-id.ts
|
|
1148
|
+
var H = (e) => typeof e == "string" ? e : e.name ?? String(e.id), ur = 0, dr = class {
|
|
1149
|
+
id = ur++;
|
|
1150
|
+
name;
|
|
1151
|
+
superKey;
|
|
1152
|
+
targets;
|
|
1153
|
+
options;
|
|
1154
|
+
_compiler;
|
|
1155
|
+
get compiler() {
|
|
1156
|
+
return this._compiler;
|
|
1157
|
+
}
|
|
1158
|
+
playback = new r();
|
|
1159
|
+
_playback;
|
|
1160
|
+
get startTime() {
|
|
1161
|
+
return this._playback.startTime;
|
|
1162
|
+
}
|
|
1163
|
+
set startTime(e) {
|
|
1164
|
+
this._playback.startTime = e;
|
|
1165
|
+
}
|
|
1166
|
+
get pausedTime() {
|
|
1167
|
+
return this._playback.pausedTime;
|
|
1168
|
+
}
|
|
1169
|
+
set pausedTime(e) {
|
|
1170
|
+
this._playback.pausedTime = e;
|
|
1171
|
+
}
|
|
1172
|
+
get t() {
|
|
1173
|
+
return this._playback.t;
|
|
1174
|
+
}
|
|
1175
|
+
set t(e) {
|
|
1176
|
+
this._playback.t = e;
|
|
1177
|
+
}
|
|
1178
|
+
get iteration() {
|
|
1179
|
+
return this._playback.iteration;
|
|
1180
|
+
}
|
|
1181
|
+
set iteration(e) {
|
|
1182
|
+
this._playback.iteration = e;
|
|
1183
|
+
}
|
|
1184
|
+
get started() {
|
|
1185
|
+
return this._playback.started;
|
|
1186
|
+
}
|
|
1187
|
+
set started(e) {
|
|
1188
|
+
this._playback.started = e;
|
|
1189
|
+
}
|
|
1190
|
+
get done() {
|
|
1191
|
+
return this._playback.done;
|
|
1192
|
+
}
|
|
1193
|
+
set done(e) {
|
|
1194
|
+
this._playback.done = e;
|
|
1195
|
+
}
|
|
1196
|
+
get reversed() {
|
|
1197
|
+
return this._playback.reversed;
|
|
1198
|
+
}
|
|
1199
|
+
set reversed(e) {
|
|
1200
|
+
this._playback.reversed = e;
|
|
1201
|
+
}
|
|
1202
|
+
get paused() {
|
|
1203
|
+
return this._playback.paused;
|
|
1204
|
+
}
|
|
1205
|
+
set paused(e) {
|
|
1206
|
+
this._playback.paused = e;
|
|
1207
|
+
}
|
|
1208
|
+
diagnostics = [];
|
|
1209
|
+
_compositionBase = /* @__PURE__ */ new Map();
|
|
1210
|
+
_compositionPose = /* @__PURE__ */ new Map();
|
|
1211
|
+
_compositionFallbackSeen = /* @__PURE__ */ new Set();
|
|
1212
|
+
_hasComposition = !1;
|
|
1213
|
+
managed = !1;
|
|
1214
|
+
waapiIneligibleReason = void 0;
|
|
1215
|
+
unflatten = !0;
|
|
1216
|
+
_stableKeys = [];
|
|
1217
|
+
_ctorOptions = {};
|
|
1218
|
+
get flatKeys() {
|
|
1219
|
+
return this._stableKeys;
|
|
1220
|
+
}
|
|
1221
|
+
_defaultTransform = (e) => Ze(e, this.targets);
|
|
1222
|
+
usesDefaultRenderer(e) {
|
|
1223
|
+
return e === this._defaultTransform;
|
|
1224
|
+
}
|
|
1225
|
+
dispatchAnimationEvent(e) {
|
|
1226
|
+
At(this, e);
|
|
1227
|
+
}
|
|
1228
|
+
constructor(e, t, n, r) {
|
|
1229
|
+
this.options = {}, this._compiler = new dt(this.options), this._playback = new $t(this._frame.bind(this)), this._ctorOptions = e ?? {}, this.setOptions({
|
|
1230
|
+
...j,
|
|
1231
|
+
...this._ctorOptions
|
|
1232
|
+
}), this.targets = t == null ? [] : Array.isArray(t) ? t : [t], this.name = n, this.superKey = r;
|
|
1233
|
+
}
|
|
1234
|
+
get templateFrames() {
|
|
1235
|
+
return this.compiler.templateFrames;
|
|
1236
|
+
}
|
|
1237
|
+
set templateFrames(e) {
|
|
1238
|
+
this.compiler.templateFrames = e;
|
|
1239
|
+
}
|
|
1240
|
+
get parsedVars() {
|
|
1241
|
+
return this.compiler.parsedVars;
|
|
1242
|
+
}
|
|
1243
|
+
get frames() {
|
|
1244
|
+
return this.compiler.frames;
|
|
1245
|
+
}
|
|
1246
|
+
get frameId() {
|
|
1247
|
+
return this.compiler.frameId;
|
|
1248
|
+
}
|
|
1249
|
+
addFrame(e, t, n, r, i) {
|
|
1250
|
+
return this.compiler.addFrame(e, t, n, r, i), this;
|
|
1251
|
+
}
|
|
1252
|
+
parse() {
|
|
1253
|
+
return Vn(this), this;
|
|
1254
|
+
}
|
|
1255
|
+
adoptCompiled(e) {
|
|
1256
|
+
return Wn(this, e), this;
|
|
1257
|
+
}
|
|
1258
|
+
_setCompiler(e) {
|
|
1259
|
+
this._compiler = e;
|
|
1260
|
+
}
|
|
1261
|
+
setTimingFunction(e) {
|
|
1262
|
+
return kn(this, e), this;
|
|
1263
|
+
}
|
|
1264
|
+
setIterationCount(e) {
|
|
1265
|
+
return An(this, e), this;
|
|
1266
|
+
}
|
|
1267
|
+
setDuration(e) {
|
|
1268
|
+
return jn(this, e), this;
|
|
1269
|
+
}
|
|
1270
|
+
setDelay(e) {
|
|
1271
|
+
return Mn(this, e), this;
|
|
1272
|
+
}
|
|
1273
|
+
setDirection(e) {
|
|
1274
|
+
return Nn(this, e), this;
|
|
1275
|
+
}
|
|
1276
|
+
setFillMode(e) {
|
|
1277
|
+
return Pn(this, e), this;
|
|
1278
|
+
}
|
|
1279
|
+
setUseWAAPI(e) {
|
|
1280
|
+
return Fn(this, e), this;
|
|
1281
|
+
}
|
|
1282
|
+
setRespectReducedMotion(e) {
|
|
1283
|
+
return In(this, e), this;
|
|
1284
|
+
}
|
|
1285
|
+
setColorSpace(e) {
|
|
1286
|
+
return Ln(this, e), this;
|
|
1287
|
+
}
|
|
1288
|
+
setHueMethod(e) {
|
|
1289
|
+
return Rn(this, e), this;
|
|
1290
|
+
}
|
|
1291
|
+
setComposite(e) {
|
|
1292
|
+
return zn(this, e), this;
|
|
1293
|
+
}
|
|
1294
|
+
setOptions(e) {
|
|
1295
|
+
return Bn(this, e), this;
|
|
1296
|
+
}
|
|
1297
|
+
reverse() {
|
|
1298
|
+
return Mt(this), this;
|
|
1299
|
+
}
|
|
1300
|
+
fillForwards() {
|
|
1301
|
+
this.interpFrames(this.options.duration, !0);
|
|
1302
|
+
}
|
|
1303
|
+
fillBackwards() {
|
|
1304
|
+
this.interpFrames(0, !0);
|
|
1305
|
+
}
|
|
1306
|
+
get restPosition() {
|
|
1307
|
+
return fn(this);
|
|
1308
|
+
}
|
|
1309
|
+
paintRest() {
|
|
1310
|
+
pn(this);
|
|
1311
|
+
}
|
|
1312
|
+
assertNoUnresolvedNamedSelector() {
|
|
1313
|
+
mn(this);
|
|
1314
|
+
}
|
|
1315
|
+
at(e, t = !1) {
|
|
1316
|
+
return hn(this, e, t);
|
|
1317
|
+
}
|
|
1318
|
+
interpFrames(e, t = !1, n) {
|
|
1319
|
+
return R(this, e, t, n);
|
|
1320
|
+
}
|
|
1321
|
+
onStart() {
|
|
1322
|
+
return Nt(this);
|
|
1323
|
+
}
|
|
1324
|
+
onEnd() {
|
|
1325
|
+
Pt(this);
|
|
1326
|
+
}
|
|
1327
|
+
advanceTo(e) {
|
|
1328
|
+
return Ft(this, e);
|
|
1329
|
+
}
|
|
1330
|
+
_frame(e) {
|
|
1331
|
+
return Lt(this, e);
|
|
1332
|
+
}
|
|
1333
|
+
get finished() {
|
|
1334
|
+
return this._playback._playingPromise ?? Promise.resolve();
|
|
1335
|
+
}
|
|
1336
|
+
async play() {
|
|
1337
|
+
return Gt(this);
|
|
1338
|
+
}
|
|
1339
|
+
pause() {
|
|
1340
|
+
return Kt(this), this;
|
|
1341
|
+
}
|
|
1342
|
+
resume() {
|
|
1343
|
+
return qt(this), this;
|
|
1344
|
+
}
|
|
1345
|
+
toggle() {
|
|
1346
|
+
return Jt(this);
|
|
1347
|
+
}
|
|
1348
|
+
stop() {
|
|
1349
|
+
Yt(this);
|
|
1350
|
+
}
|
|
1351
|
+
playing() {
|
|
1352
|
+
return Xt(this);
|
|
1353
|
+
}
|
|
1354
|
+
get effectiveT() {
|
|
1355
|
+
return Zt(this);
|
|
1356
|
+
}
|
|
1357
|
+
settle() {
|
|
1358
|
+
return L(this), this;
|
|
1359
|
+
}
|
|
1360
|
+
reset() {
|
|
1361
|
+
return Qt(this), this;
|
|
1362
|
+
}
|
|
1363
|
+
setTargets(...e) {
|
|
1364
|
+
return this.targets = e, cr(this), this;
|
|
1365
|
+
}
|
|
1366
|
+
}, fr = (e, t) => {
|
|
1367
|
+
let n = {};
|
|
1368
|
+
for (let r of e.declarations) {
|
|
1369
|
+
let e = r.value;
|
|
1370
|
+
if (e instanceof C && or(e)) {
|
|
1371
|
+
let n = ar(e, t);
|
|
1372
|
+
if (n === z) continue;
|
|
1373
|
+
e = n;
|
|
1374
|
+
}
|
|
1375
|
+
n[r.name] = e;
|
|
1376
|
+
}
|
|
1377
|
+
return n;
|
|
1378
|
+
}, pr = (e) => {
|
|
1379
|
+
let t = [];
|
|
1380
|
+
for (let n of e.selectors) n.kind === "percent" ? t.push(`${n.value}%`) : t.push(n.name);
|
|
1381
|
+
return t;
|
|
1382
|
+
}, mr = (e) => {
|
|
1383
|
+
let t = Ce(e);
|
|
1384
|
+
for (let e of t.values()) if (e.length > 0) return e;
|
|
1385
|
+
return [];
|
|
1386
|
+
}, hr = (e, t) => {
|
|
1387
|
+
let n = [], r = (e, t) => {
|
|
1388
|
+
n.push({
|
|
1389
|
+
code: e,
|
|
1390
|
+
message: t.message ?? e,
|
|
1391
|
+
...t
|
|
1392
|
+
});
|
|
1393
|
+
}, i = typeof e == "string" ? O(e) : e, a = mr(i);
|
|
1394
|
+
typeof e == "string" && a.length === 0 && e.trim() && (i = O(`@keyframes anonymous {\n${e.trim()}\n}`), a = mr(i)), typeof e == "string" && a.length === 0 && e.trim() && r("EMPTY_PARSE", {
|
|
1395
|
+
message: "the input is non-empty but parsed to zero @keyframes rules (no animatable stops) — the resulting animation has no frames",
|
|
1396
|
+
input: e
|
|
1397
|
+
});
|
|
1398
|
+
let o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = Se(i), u = Kn(l, t, n);
|
|
1399
|
+
for (let e of a) {
|
|
1400
|
+
let t = fr(e, u);
|
|
1401
|
+
for (let n of pr(e)) {
|
|
1402
|
+
let r = o.get(n);
|
|
1403
|
+
o.set(n, {
|
|
1404
|
+
...r ?? {},
|
|
1405
|
+
...t
|
|
1406
|
+
}), e.timingFunction != null && s.set(n, e.timingFunction);
|
|
1407
|
+
let i = e.composition;
|
|
1408
|
+
i != null && c.set(n, i);
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
return {
|
|
1412
|
+
keyframes: o,
|
|
1413
|
+
timingFunctions: s,
|
|
1414
|
+
composition: c,
|
|
1415
|
+
properties: we(i),
|
|
1416
|
+
functions: l,
|
|
1417
|
+
options: xe(i),
|
|
1418
|
+
diagnostics: n,
|
|
1419
|
+
stylesheet: i
|
|
1420
|
+
};
|
|
1421
|
+
};
|
|
1422
|
+
//#endregion
|
|
1423
|
+
//#region src/animation/engine/css/metadata.ts
|
|
1424
|
+
function gr(e) {
|
|
1425
|
+
let t = {};
|
|
1426
|
+
return e.duration != null && (t.duration = e.duration), e.timingFunction != null && (t.timingFunction = e.timingFunction), e.iterationCount !== void 0 && (t.iterationCount = e.iterationCount === null ? Infinity : e.iterationCount), e.direction != null && (t.direction = e.direction), e.delay != null && (t.delay = e.delay), e.fillMode != null && (t.fillMode = e.fillMode), e.composition != null && (t.composite = e.composition), t;
|
|
1427
|
+
}
|
|
1428
|
+
function _r(e) {
|
|
1429
|
+
let t = Te(e);
|
|
1430
|
+
return Object.keys(t).length > 0 ? t : void 0;
|
|
1431
|
+
}
|
|
1432
|
+
function vr(e, t) {
|
|
1433
|
+
if (!(typeof CSS > "u" || typeof CSS.registerProperty != "function")) for (let [n, r] of e) {
|
|
1434
|
+
if (r.syntax == null) continue;
|
|
1435
|
+
let e = {
|
|
1436
|
+
name: n,
|
|
1437
|
+
syntax: r.syntax,
|
|
1438
|
+
inherits: r.inherits ?? !1
|
|
1439
|
+
};
|
|
1440
|
+
r.initialValue != null && (e.initialValue = r.initialValue.toString());
|
|
1441
|
+
try {
|
|
1442
|
+
CSS.registerProperty(e);
|
|
1443
|
+
} catch (e) {
|
|
1444
|
+
if (e instanceof DOMException && e.name === "InvalidModificationError") continue;
|
|
1445
|
+
t.push({
|
|
1446
|
+
code: "PROPERTY_REGISTER_REJECTED",
|
|
1447
|
+
property: n,
|
|
1448
|
+
message: `CSS.registerProperty refused @property ${n}: ${String(e)}`
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
//#endregion
|
|
1454
|
+
//#region src/animation/engine/css/css-animation.ts
|
|
1455
|
+
var yr = (e) => typeof e != "object" || !e ? !1 : typeof e.clone == "function", U = class extends dr {
|
|
1456
|
+
_boundTimeline;
|
|
1457
|
+
constructor(e, ...t) {
|
|
1458
|
+
super(e, t), this.unflatten = !1;
|
|
1459
|
+
}
|
|
1460
|
+
bindTimeline(e) {
|
|
1461
|
+
this._boundTimeline = e;
|
|
1462
|
+
let t = !1;
|
|
1463
|
+
for (let e of this.compiler.templateFrames) e.start.superType?.includes("named-selector") && (e.start = new w(it(String(e.start.value)) * 100, "%"), t = !0);
|
|
1464
|
+
return t && this.compiler.frames.length > 0 && this.parse(), this;
|
|
1465
|
+
}
|
|
1466
|
+
resolveTransform(e) {
|
|
1467
|
+
return this.unflatten = e != null, e ?? this._defaultTransform;
|
|
1468
|
+
}
|
|
1469
|
+
fromVars(e, t) {
|
|
1470
|
+
t = this.resolveTransform(t);
|
|
1471
|
+
for (let n = 0; n < e.length; n++) {
|
|
1472
|
+
let r = e[n], i = Math.round(n / (e.length - 1) * 100);
|
|
1473
|
+
this.addFrame(i, r, t);
|
|
1474
|
+
}
|
|
1475
|
+
return this.parse(), this;
|
|
1476
|
+
}
|
|
1477
|
+
fromKeyframes(e, t) {
|
|
1478
|
+
t = this.resolveTransform(t), pe(e) && (e = new Map(Object.entries(e)));
|
|
1479
|
+
let n = e instanceof Map ? e.entries() : Object.entries(e);
|
|
1480
|
+
for (let [e, r] of n) this.addFrame(e, r, t);
|
|
1481
|
+
return this.parse(), this;
|
|
1482
|
+
}
|
|
1483
|
+
propertyRegistry = /* @__PURE__ */ new Map();
|
|
1484
|
+
scrollOptions;
|
|
1485
|
+
fromString(e, t) {
|
|
1486
|
+
t = this.resolveTransform(t);
|
|
1487
|
+
let n = hr(e);
|
|
1488
|
+
this.propertyRegistry = n.properties;
|
|
1489
|
+
let r = _r(n.stylesheet);
|
|
1490
|
+
r === void 0 ? delete this.scrollOptions : this.scrollOptions = r, this.diagnostics = [...n.diagnostics];
|
|
1491
|
+
let i = gr(n.options);
|
|
1492
|
+
Object.keys(i).length > 0 && this.setOptions({
|
|
1493
|
+
...i,
|
|
1494
|
+
...this._ctorOptions
|
|
1495
|
+
});
|
|
1496
|
+
for (let [e, r] of n.keyframes.entries()) {
|
|
1497
|
+
let i = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, yr(t) ? t.clone() : t])), a = n.timingFunctions.get(e), o = a ? g(a) : void 0, s;
|
|
1498
|
+
if (o) {
|
|
1499
|
+
let e = a ? h(a) : void 0;
|
|
1500
|
+
s = e ? {
|
|
1501
|
+
fn: o,
|
|
1502
|
+
css: e
|
|
1503
|
+
} : { fn: o };
|
|
1504
|
+
}
|
|
1505
|
+
let c = n.composition.get(e);
|
|
1506
|
+
this.addFrame(e, i, t, s, c);
|
|
1507
|
+
}
|
|
1508
|
+
return this.parse(), vr(this.propertyRegistry, this.diagnostics), this;
|
|
1509
|
+
}
|
|
1510
|
+
}, br = (e) => typeof e == "string" ? e : H(e), xr = (e, t, n) => {
|
|
1511
|
+
let r = br(t), i = e[r];
|
|
1512
|
+
if (!i) throw Error(`AnimationGroup.${n}: no animation registered for key "${r}". Known keys: ${Object.keys(e).join(", ") || "(none)"}.`);
|
|
1513
|
+
return i;
|
|
1514
|
+
}, Sr = (e) => {
|
|
1515
|
+
let t = /* @__PURE__ */ new Set();
|
|
1516
|
+
for (let n of e) {
|
|
1517
|
+
if (!n.layer.enabled) continue;
|
|
1518
|
+
let e = n.layer.properties;
|
|
1519
|
+
for (let r of n.animation.flatKeys) e && !e.has(r) || t.add(r);
|
|
1520
|
+
}
|
|
1521
|
+
return [...t];
|
|
1522
|
+
}, Cr = (e) => {
|
|
1523
|
+
let t = !0;
|
|
1524
|
+
for (let n of e) n.animation.interpFrames(n.animation.t, !0), t &&= n.animation.done;
|
|
1525
|
+
return t;
|
|
1526
|
+
}, wr = (e) => {
|
|
1527
|
+
for (let t of e) {
|
|
1528
|
+
let e = t.animation;
|
|
1529
|
+
e.started = !0, e.t = e.options.duration, e.interpFrames(e.t, !0);
|
|
1530
|
+
}
|
|
1531
|
+
}, Tr = (e, t) => {
|
|
1532
|
+
for (let n of e) n.animation.paused = t;
|
|
1533
|
+
}, Er = null, Dr = () => typeof MessageChannel == "function" ? () => new Promise((e) => {
|
|
1534
|
+
let t = new MessageChannel();
|
|
1535
|
+
t.port1.onmessage = () => {
|
|
1536
|
+
t.port1.close(), e();
|
|
1537
|
+
}, t.port2.postMessage(void 0);
|
|
1538
|
+
}) : () => new Promise((e) => setTimeout(e, 0));
|
|
1539
|
+
function Or() {
|
|
1540
|
+
let e = globalThis.scheduler;
|
|
1541
|
+
return e && typeof e.yield == "function" ? e.yield() : (Er ??= Dr(), Er());
|
|
1542
|
+
}
|
|
1543
|
+
//#endregion
|
|
1544
|
+
//#region src/animation/group/yield-batch.ts
|
|
1545
|
+
var kr = (e, t) => {
|
|
1546
|
+
let n;
|
|
1547
|
+
for (let r of e) {
|
|
1548
|
+
let e = r.animation;
|
|
1549
|
+
if (e.paused && e.pausedTime !== 0) continue;
|
|
1550
|
+
let i = e.advanceTo(t);
|
|
1551
|
+
typeof i != "number" && (n ??= []).push(i);
|
|
1552
|
+
}
|
|
1553
|
+
return n && Promise.all(n).then(() => void 0);
|
|
1554
|
+
}, Ar = async (e, t, n) => {
|
|
1555
|
+
for (let r = 0; r < e.length; r += n) await kr(e.slice(r, r + n), t), r + n < e.length && await Or();
|
|
1556
|
+
}, jr = (e, t, n) => {
|
|
1557
|
+
let r = new f({
|
|
1558
|
+
...n,
|
|
1559
|
+
initial: e
|
|
1560
|
+
});
|
|
1561
|
+
return r.target = t, r;
|
|
1562
|
+
}, Mr = (e, t) => {
|
|
1563
|
+
let n = !1;
|
|
1564
|
+
for (let r of e) {
|
|
1565
|
+
let e = r.layer.weightSpring;
|
|
1566
|
+
e !== void 0 && (t > 0 && e.tickDt(t), e.settled ? (r.layer.weight = e.value, delete r.layer.weightSpring) : n = !0);
|
|
1567
|
+
}
|
|
1568
|
+
return n;
|
|
1569
|
+
}, W = (e) => e.op === void 0 ? e.blendMode === "weighted" ? "replace" : e.blendMode : e.op, G = (e) => e.blendMode === "weighted" || e.op === "replace" && e.weight !== 1, Nr = (e) => {
|
|
1570
|
+
let t = e.weightSpring?.value ?? e.weight;
|
|
1571
|
+
return e.weightSpring ? t : Number.isFinite(t) ? Math.min(1, Math.max(0, t)) : 0;
|
|
1572
|
+
}, Pr = (e) => Number.isFinite(e) ? Math.min(1, Math.max(0, e)) : 0, K = (e) => e instanceof w && typeof e.value == "number", Fr = (e, t) => K(e) && K(t) && e.unit === t.unit, Ir = (e, t) => {
|
|
1573
|
+
let { carriers: n, incomingSlots: r } = t, i = n.length;
|
|
1574
|
+
if (i !== 0) {
|
|
1575
|
+
for (let t = 0; t < i; t++) e[t] = n[t].value;
|
|
1576
|
+
if (t.weighted) {
|
|
1577
|
+
let n = Nr(t.layer);
|
|
1578
|
+
for (let t = 0; t < i; t++) {
|
|
1579
|
+
let i = r[t], a = i.values[i.key][i.index];
|
|
1580
|
+
e[t] = v(e[t], a.value, n);
|
|
1581
|
+
}
|
|
1582
|
+
} else for (let t = 0; t < i; t++) {
|
|
1583
|
+
let n = r[t], i = n.values[n.key][n.index];
|
|
1584
|
+
e[t] = e[t] + i.value;
|
|
1585
|
+
}
|
|
1586
|
+
for (let t = 0; t < i; t++) n[t].value = e[t];
|
|
1587
|
+
}
|
|
1588
|
+
}, Lr = (e, t, n) => {
|
|
1589
|
+
let r = [], i = {}, a = 0;
|
|
1590
|
+
for (let t of e) {
|
|
1591
|
+
let { layer: e, values: o } = t;
|
|
1592
|
+
if (!e.enabled) continue;
|
|
1593
|
+
let s = e.properties, c = W(e), l = G(e);
|
|
1594
|
+
if (c === "replace" && !l) {
|
|
1595
|
+
for (let e in o) {
|
|
1596
|
+
if (s && !s.has(e)) continue;
|
|
1597
|
+
let t = o[e];
|
|
1598
|
+
t !== void 0 && (i[e] = n?.[e] ?? t);
|
|
1599
|
+
}
|
|
1600
|
+
continue;
|
|
1601
|
+
}
|
|
1602
|
+
let u = [], d = [], f = /* @__PURE__ */ new Set();
|
|
1603
|
+
for (let e in o) {
|
|
1604
|
+
if (s && !s.has(e)) continue;
|
|
1605
|
+
let t = o[e];
|
|
1606
|
+
if (t === void 0) continue;
|
|
1607
|
+
let n = i[e];
|
|
1608
|
+
if (Array.isArray(n) && Array.isArray(t)) {
|
|
1609
|
+
let r = Math.min(n.length, t.length), i = !0;
|
|
1610
|
+
for (let e = 0; e < r; e++) if (!Fr(n[e], t[e])) {
|
|
1611
|
+
i = !1;
|
|
1612
|
+
break;
|
|
1613
|
+
}
|
|
1614
|
+
if (i) for (let t = 0; t < r; t++) u.push(n[t]), d.push({
|
|
1615
|
+
values: o,
|
|
1616
|
+
key: e,
|
|
1617
|
+
index: t
|
|
1618
|
+
});
|
|
1619
|
+
else f.add(e);
|
|
1620
|
+
} else f.add(e), i[e] = t;
|
|
1621
|
+
}
|
|
1622
|
+
u.length > a && (a = u.length), r.push({
|
|
1623
|
+
layer: e,
|
|
1624
|
+
weighted: l,
|
|
1625
|
+
carriers: u,
|
|
1626
|
+
incomingSlots: d,
|
|
1627
|
+
boxedKeys: f
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
let o = t;
|
|
1631
|
+
return a > 0 && (o === null || o.length < a) && (o = new Float64Array(a)), {
|
|
1632
|
+
plans: r,
|
|
1633
|
+
compositeBuf: o
|
|
1634
|
+
};
|
|
1635
|
+
};
|
|
1636
|
+
//#endregion
|
|
1637
|
+
//#region src/animation/group/compositor.ts
|
|
1638
|
+
function Rr(e, t) {
|
|
1639
|
+
let n = e._grouped;
|
|
1640
|
+
e._groupedKeysDirty && (e._groupedKeys = Sr(e.getEntries()), e._compositeState.configure(e._groupedKeys), e._groupedKeysDirty = !1, e._soaPlans = null, e._plainProj = null), e._groupedKeys, e._compositeState.clear();
|
|
1641
|
+
let r = e.getEntries(), i = e._soaPlans !== null, a = 0, o = !0;
|
|
1642
|
+
for (let t of r) {
|
|
1643
|
+
let { animation: r, layer: s, values: c } = t;
|
|
1644
|
+
if (o &&= r.done, !s.enabled) continue;
|
|
1645
|
+
r.interpFrames(r.t, !1, c);
|
|
1646
|
+
let l = s.properties, u = W(s), d = G(s);
|
|
1647
|
+
if (u === "replace" && !d) {
|
|
1648
|
+
for (let t in c) {
|
|
1649
|
+
if (l && !l.has(t)) continue;
|
|
1650
|
+
let n = c[t];
|
|
1651
|
+
n !== void 0 && e._compositeState.copy(t, n);
|
|
1652
|
+
}
|
|
1653
|
+
continue;
|
|
1654
|
+
}
|
|
1655
|
+
if (i) {
|
|
1656
|
+
let t = e._soaPlans[a++];
|
|
1657
|
+
Ir(e._compositeBuf, t), t.boxedKeys.size > 0 && zr(s, c, n, l, t.boxedKeys, e._compositeState);
|
|
1658
|
+
} else zr(s, c, n, l, void 0, e._compositeState);
|
|
1659
|
+
}
|
|
1660
|
+
if (!i) {
|
|
1661
|
+
let { plans: t, compositeBuf: i } = Lr(r, e._compositeBuf, n);
|
|
1662
|
+
e._soaPlans = t, e._compositeBuf = i;
|
|
1663
|
+
}
|
|
1664
|
+
if (e.done = o, e._compositeState.pruneInactive(), e.transform === A) for (let t of e.getEntries()) {
|
|
1665
|
+
let n = t.animation.frames[0];
|
|
1666
|
+
if (n != null && n.transform != null) {
|
|
1667
|
+
e.transform = n.transform, e.unflatten = t.animation.unflatten;
|
|
1668
|
+
break;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
if (e.unflatten) {
|
|
1672
|
+
let r = e._plainProj;
|
|
1673
|
+
r === null ? (r = un(n), e._plainProj = r) : dn(r), e.transform(r.root, t);
|
|
1674
|
+
} else e.transform(n, t);
|
|
1675
|
+
return n;
|
|
1676
|
+
}
|
|
1677
|
+
function zr(e, t, n, r, i, a) {
|
|
1678
|
+
let o = W(e);
|
|
1679
|
+
if (o === "add" || o === "accumulate") {
|
|
1680
|
+
for (let e in t) {
|
|
1681
|
+
if (i && !i.has(e) || r && !r.has(e)) continue;
|
|
1682
|
+
let o = t[e];
|
|
1683
|
+
if (o === void 0) continue;
|
|
1684
|
+
let s = n[e];
|
|
1685
|
+
if (Array.isArray(s) && Array.isArray(o)) {
|
|
1686
|
+
let t = Math.min(s.length, o.length), r = !1;
|
|
1687
|
+
for (let e = 0; e < t; e++) if (K(s[e]) && K(o[e]) && s[e].unit !== o[e].unit) {
|
|
1688
|
+
r = !0;
|
|
1689
|
+
break;
|
|
1690
|
+
}
|
|
1691
|
+
if (r) {
|
|
1692
|
+
a ? a.copy(e, o) : n[e] = o;
|
|
1693
|
+
continue;
|
|
1694
|
+
}
|
|
1695
|
+
for (let e = 0; e < t; e++) Fr(s[e], o[e]) ? s[e].value += o[e].value : s[e] = o[e];
|
|
1696
|
+
} else a ? a.copy(e, o) : n[e] = o;
|
|
1697
|
+
}
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
let s = Nr(e);
|
|
1701
|
+
for (let e in t) {
|
|
1702
|
+
if (i && !i.has(e) || r && !r.has(e)) continue;
|
|
1703
|
+
let o = t[e];
|
|
1704
|
+
if (o === void 0) continue;
|
|
1705
|
+
let c = n[e];
|
|
1706
|
+
if (Array.isArray(c) && Array.isArray(o)) {
|
|
1707
|
+
let t = Math.min(c.length, o.length), r = !1;
|
|
1708
|
+
for (let e = 0; e < t; e++) if (K(c[e]) && K(o[e]) && c[e].unit !== o[e].unit) {
|
|
1709
|
+
r = !0;
|
|
1710
|
+
break;
|
|
1711
|
+
}
|
|
1712
|
+
if (r) {
|
|
1713
|
+
a ? a.copy(e, o) : n[e] = o;
|
|
1714
|
+
continue;
|
|
1715
|
+
}
|
|
1716
|
+
for (let e = 0; e < t; e++) Fr(c[e], o[e]) ? c[e].value = v(c[e].value, o[e].value, s) : c[e] = o[e];
|
|
1717
|
+
} else if (a) {
|
|
1718
|
+
let t = a.copy(e, o);
|
|
1719
|
+
if (Array.isArray(t) && t.every(K)) for (let e of t) e.value = v(0, e.value, s);
|
|
1720
|
+
} else n[e] = o;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
//#endregion
|
|
1724
|
+
//#region src/animation/group/layer-api.ts
|
|
1725
|
+
function Br(e, t, n) {
|
|
1726
|
+
let r = xr(e.animations, t, "setLayerConfig");
|
|
1727
|
+
Object.assign(r.layer, n), e.invalidateEntries();
|
|
1728
|
+
}
|
|
1729
|
+
function Vr(e, t) {
|
|
1730
|
+
return e.animations[br(t)]?.layer;
|
|
1731
|
+
}
|
|
1732
|
+
function Hr(e, t, n) {
|
|
1733
|
+
let r = xr(e.animations, t, "transitionLayer").layer, i = Pr(n.weight);
|
|
1734
|
+
r.blendMode = "weighted";
|
|
1735
|
+
let a = r.weightSpring;
|
|
1736
|
+
a instanceof f ? a.target = i : r.weightSpring = jr(Pr(r.weight), i, n.spring), e._hasLayerSprings = !0, e.invalidateEntries();
|
|
1737
|
+
}
|
|
1738
|
+
function Ur(e, t, n, r) {
|
|
1739
|
+
let i = r?.spring;
|
|
1740
|
+
Hr(e, t, {
|
|
1741
|
+
weight: 0,
|
|
1742
|
+
...i ? { spring: i } : {}
|
|
1743
|
+
}), Hr(e, n, {
|
|
1744
|
+
weight: 1,
|
|
1745
|
+
...i ? { spring: i } : {}
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
//#endregion
|
|
1749
|
+
//#region src/animation/group/waapi.ts
|
|
1750
|
+
function Wr(e) {
|
|
1751
|
+
let t = e.getEntries();
|
|
1752
|
+
if (!e.singleTarget || t.length === 0) return {
|
|
1753
|
+
eligible: !1,
|
|
1754
|
+
reason: "group requires one shared target"
|
|
1755
|
+
};
|
|
1756
|
+
let n = t[0]?.animation.targets[0];
|
|
1757
|
+
if (!n || typeof n.animate != "function") return {
|
|
1758
|
+
eligible: !1,
|
|
1759
|
+
reason: "group target does not implement Element.animate()"
|
|
1760
|
+
};
|
|
1761
|
+
for (let e of t) {
|
|
1762
|
+
if (!e.layer.enabled) return {
|
|
1763
|
+
eligible: !1,
|
|
1764
|
+
reason: "disabled layer stays on rAF"
|
|
1765
|
+
};
|
|
1766
|
+
if (e.layer.properties) return {
|
|
1767
|
+
eligible: !1,
|
|
1768
|
+
reason: "property-masked layer stays on rAF"
|
|
1769
|
+
};
|
|
1770
|
+
if (G(e.layer) || e.layer.weightSpring) return {
|
|
1771
|
+
eligible: !1,
|
|
1772
|
+
reason: "weighted layer has no native composite equivalent"
|
|
1773
|
+
};
|
|
1774
|
+
if (e.animation.targets[0] !== n) return {
|
|
1775
|
+
eligible: !1,
|
|
1776
|
+
reason: "group target identity mismatch"
|
|
1777
|
+
};
|
|
1778
|
+
if (!e.animation.options.useWAAPI) return {
|
|
1779
|
+
eligible: !1,
|
|
1780
|
+
reason: "child useWAAPI is disabled"
|
|
1781
|
+
};
|
|
1782
|
+
let t = F(e.animation);
|
|
1783
|
+
if (!t.eligible) return {
|
|
1784
|
+
eligible: !1,
|
|
1785
|
+
reason: t.reason
|
|
1786
|
+
};
|
|
1787
|
+
}
|
|
1788
|
+
return {
|
|
1789
|
+
eligible: !0,
|
|
1790
|
+
target: n,
|
|
1791
|
+
entries: t
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
function Gr(e) {
|
|
1795
|
+
let t = Wr(e);
|
|
1796
|
+
if (!t.eligible) return null;
|
|
1797
|
+
let n = [];
|
|
1798
|
+
try {
|
|
1799
|
+
for (let e of t.entries) {
|
|
1800
|
+
let r = W(e.layer);
|
|
1801
|
+
n.push(t.target.animate(St(e.animation), {
|
|
1802
|
+
...Dt(e.animation),
|
|
1803
|
+
composite: r
|
|
1804
|
+
}));
|
|
1805
|
+
}
|
|
1806
|
+
return n;
|
|
1807
|
+
} catch {
|
|
1808
|
+
for (let e of n) try {
|
|
1809
|
+
e.cancel?.();
|
|
1810
|
+
} catch {}
|
|
1811
|
+
return null;
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
//#endregion
|
|
1815
|
+
//#region src/animation/group/lifecycle.ts
|
|
1816
|
+
function Kr(e) {
|
|
1817
|
+
for (let t of e._waAnimations) try {
|
|
1818
|
+
t.cancel?.();
|
|
1819
|
+
} catch {}
|
|
1820
|
+
e._waAnimations.length = 0, e._waapiDelegated = !1;
|
|
1821
|
+
}
|
|
1822
|
+
function qr(e) {
|
|
1823
|
+
for (let t of e._waAnimations) try {
|
|
1824
|
+
t.pause?.();
|
|
1825
|
+
} catch {}
|
|
1826
|
+
}
|
|
1827
|
+
function Jr(e) {
|
|
1828
|
+
for (let t of e._waAnimations) try {
|
|
1829
|
+
t.play?.();
|
|
1830
|
+
} catch {}
|
|
1831
|
+
}
|
|
1832
|
+
function Yr(e) {
|
|
1833
|
+
let t = e.resolvePromise;
|
|
1834
|
+
e.resolvePromise = null, t?.();
|
|
1835
|
+
}
|
|
1836
|
+
async function Xr(e) {
|
|
1837
|
+
return s(e, () => o(e.respectReducedMotion, () => Zr(e), () => {
|
|
1838
|
+
let t = Gr(e);
|
|
1839
|
+
return t && (e._waAnimations.push(...t), e._waapiDelegated = !0), new Promise((t) => {
|
|
1840
|
+
e.resolvePromise = t, e.playback.loop(e._boundFrame);
|
|
1841
|
+
});
|
|
1842
|
+
}));
|
|
1843
|
+
}
|
|
1844
|
+
function Zr(e) {
|
|
1845
|
+
e.started = !0;
|
|
1846
|
+
let t = e.lastTickTime;
|
|
1847
|
+
return wr(e.getEntries()), e.singleTarget && Rr(e, t), e.settle(), Promise.resolve();
|
|
1848
|
+
}
|
|
1849
|
+
function Qr(e) {
|
|
1850
|
+
if (!e.started || e.paused) return;
|
|
1851
|
+
e.paused = !0;
|
|
1852
|
+
let t = e.lastTickTime;
|
|
1853
|
+
for (let n of e.getEntries()) {
|
|
1854
|
+
let e = n.animation;
|
|
1855
|
+
e.pause(), e.pausedTime === 0 && (e.pausedTime = t);
|
|
1856
|
+
}
|
|
1857
|
+
e.playback.stop(), e._waapiDelegated && qr(e), e.render();
|
|
1858
|
+
}
|
|
1859
|
+
function $r(e) {
|
|
1860
|
+
!e.started || !e.paused || (e.paused = !1, Tr(e.getEntries(), !1), e._waapiDelegated && Jr(e), e.playback.loop(e._boundFrame));
|
|
1861
|
+
}
|
|
1862
|
+
function ei(e) {
|
|
1863
|
+
a(e, () => Qr(e), () => $r(e));
|
|
1864
|
+
}
|
|
1865
|
+
function ti(e) {
|
|
1866
|
+
e._waapiDelegated && Kr(e);
|
|
1867
|
+
for (let t of e.getEntries()) t.animation.managed = !1, t.animation.settle();
|
|
1868
|
+
e.started = !1, e.done = !1, e.paused = !1, e.lastTickTime = 0;
|
|
1869
|
+
}
|
|
1870
|
+
function ni(e) {
|
|
1871
|
+
for (let t of e.getEntries()) {
|
|
1872
|
+
let e = t.animation;
|
|
1873
|
+
e.started && e.frames.length > 0 && e.interpFrames(0, !0);
|
|
1874
|
+
}
|
|
1875
|
+
e.settle();
|
|
1876
|
+
}
|
|
1877
|
+
function ri(e) {
|
|
1878
|
+
e.playback.stop(), e.reset(), Yr(e);
|
|
1879
|
+
}
|
|
1880
|
+
function ii(e) {
|
|
1881
|
+
return l(e);
|
|
1882
|
+
}
|
|
1883
|
+
//#endregion
|
|
1884
|
+
//#region src/animation/group/composite-state.ts
|
|
1885
|
+
var ai = class {
|
|
1886
|
+
values = {};
|
|
1887
|
+
keys = [];
|
|
1888
|
+
epochs = Object.create(null);
|
|
1889
|
+
epoch = 0;
|
|
1890
|
+
configure(e) {
|
|
1891
|
+
let t = new Set(e);
|
|
1892
|
+
for (let e of this.keys) t.has(e) || delete this.values[e];
|
|
1893
|
+
this.keys = e;
|
|
1894
|
+
}
|
|
1895
|
+
clear() {
|
|
1896
|
+
this.epoch++;
|
|
1897
|
+
}
|
|
1898
|
+
copy(e, t) {
|
|
1899
|
+
if (this.epochs[e] = this.epoch, !Array.isArray(t)) return this.values[e] = t, t;
|
|
1900
|
+
let n = this.values[e];
|
|
1901
|
+
if (!Array.isArray(n) || n.length !== t.length) return n = t.map((e) => e && typeof e.clone == "function" ? e.clone() : e), this.values[e] = n, n;
|
|
1902
|
+
for (let e = 0; e < t.length; e++) {
|
|
1903
|
+
let r = t[e], i = n[e];
|
|
1904
|
+
r && i && "value" in r && "value" in i ? "unit" in r && "unit" in i && r.unit !== i.unit ? n[e] = r && typeof r.clone == "function" ? r.clone() : r : i.value = r.value : n[e] = r;
|
|
1905
|
+
}
|
|
1906
|
+
return n;
|
|
1907
|
+
}
|
|
1908
|
+
pruneInactive() {
|
|
1909
|
+
for (let e of this.keys) this.epochs[e] !== this.epoch && (this.values[e] = void 0);
|
|
1910
|
+
}
|
|
1911
|
+
}, oi = class e {
|
|
1912
|
+
animations = {};
|
|
1913
|
+
transform = A;
|
|
1914
|
+
superKey;
|
|
1915
|
+
paused = !1;
|
|
1916
|
+
started = !1;
|
|
1917
|
+
done = !1;
|
|
1918
|
+
respectReducedMotion = !1;
|
|
1919
|
+
static YIELD_BATCH = 32;
|
|
1920
|
+
static of(t, ...n) {
|
|
1921
|
+
return new e(t, ...n);
|
|
1922
|
+
}
|
|
1923
|
+
singleTarget = !0;
|
|
1924
|
+
unflatten = !1;
|
|
1925
|
+
lastTickTime = 0;
|
|
1926
|
+
playback = new r();
|
|
1927
|
+
_waAnimations = [];
|
|
1928
|
+
_waapiDelegated = !1;
|
|
1929
|
+
resolvePromise = null;
|
|
1930
|
+
_playingPromise = null;
|
|
1931
|
+
_boundFrame;
|
|
1932
|
+
_entries = [];
|
|
1933
|
+
_entriesDirty = !0;
|
|
1934
|
+
_compositeState = new ai();
|
|
1935
|
+
_grouped = this._compositeState.values;
|
|
1936
|
+
_groupedKeys = [];
|
|
1937
|
+
_groupedKeysDirty = !0;
|
|
1938
|
+
_soaPlans = null;
|
|
1939
|
+
_plainProj = null;
|
|
1940
|
+
_compositeBuf = null;
|
|
1941
|
+
_hasLayerSprings = !1;
|
|
1942
|
+
constructor(...e) {
|
|
1943
|
+
this._boundFrame = this._frame.bind(this);
|
|
1944
|
+
let t = [];
|
|
1945
|
+
for (let n of e) {
|
|
1946
|
+
let e, r;
|
|
1947
|
+
n instanceof dr ? e = n : (e = n.animation, r = n.layer), this.transform === A && e.frames[0] != null && (this.transform = e.frames[0].transform, this.unflatten = e.unflatten);
|
|
1948
|
+
let i = H(e);
|
|
1949
|
+
this.animations[i] = {
|
|
1950
|
+
values: {},
|
|
1951
|
+
animation: e,
|
|
1952
|
+
layer: {
|
|
1953
|
+
...He,
|
|
1954
|
+
...r
|
|
1955
|
+
}
|
|
1956
|
+
}, e.managed = !0, t.push(e);
|
|
1957
|
+
}
|
|
1958
|
+
this.singleTarget = t.every((e) => e.targets[0] === t[0]?.targets[0]), this.invalidateEntries();
|
|
1959
|
+
}
|
|
1960
|
+
getEntries() {
|
|
1961
|
+
return this._entriesDirty &&= (this._entries = Object.values(this.animations), this._entries.sort((e, t) => e.layer.zIndex - t.layer.zIndex), !1), this._entries;
|
|
1962
|
+
}
|
|
1963
|
+
invalidateEntries() {
|
|
1964
|
+
this._entriesDirty = !0, this._groupedKeysDirty = !0;
|
|
1965
|
+
}
|
|
1966
|
+
setSuperKey(e) {
|
|
1967
|
+
this.superKey = e;
|
|
1968
|
+
for (let t of this.getEntries()) t.animation.superKey = e;
|
|
1969
|
+
return this;
|
|
1970
|
+
}
|
|
1971
|
+
setTargets(...e) {
|
|
1972
|
+
let t = this.getEntries();
|
|
1973
|
+
for (let n of t) n.animation.setTargets(...e);
|
|
1974
|
+
return this.singleTarget = t.every((e) => e.animation.targets[0] === t[0]?.animation.targets[0]), this;
|
|
1975
|
+
}
|
|
1976
|
+
transformFramesGrouped(e) {
|
|
1977
|
+
return Rr(this, e);
|
|
1978
|
+
}
|
|
1979
|
+
render(e = this.lastTickTime) {
|
|
1980
|
+
this.singleTarget ? (!this._waapiDelegated || this.done) && this.transformFramesGrouped(e) : Cr(this.getEntries());
|
|
1981
|
+
}
|
|
1982
|
+
setChildTime(e, t) {
|
|
1983
|
+
let n = xr(this.animations, e, "setChildTime").animation;
|
|
1984
|
+
return n.t = t, n.startTime !== void 0 && (n.pausedTime = n.startTime + t), this;
|
|
1985
|
+
}
|
|
1986
|
+
advanceTo(t) {
|
|
1987
|
+
let n = this.lastTickTime === 0 ? 0 : t - this.lastTickTime;
|
|
1988
|
+
this._hasLayerSprings && this.advanceLayerSprings(n), this.lastTickTime = t, this.started = !0;
|
|
1989
|
+
let r = this.getEntries(), i = e.YIELD_BATCH, a = r.length <= i ? kr(r, t) : Ar(r, t, i);
|
|
1990
|
+
return a ? a.then(() => this) : this;
|
|
1991
|
+
}
|
|
1992
|
+
_frame(e) {
|
|
1993
|
+
let t = this.advanceTo(e);
|
|
1994
|
+
return typeof t.then == "function" ? t.then(() => this._renderFrame(e)) : this._renderFrame(e);
|
|
1995
|
+
}
|
|
1996
|
+
_renderFrame(e) {
|
|
1997
|
+
return this.paused ? !1 : (this.singleTarget ? (this.done = this.getEntries().every((e) => e.animation.done), (!this._waapiDelegated || this.done) && this.transformFramesGrouped(e)) : this.done = Cr(this.getEntries()), this.done ? (this.settle(), Yr(this), !1) : !0);
|
|
1998
|
+
}
|
|
1999
|
+
get finished() {
|
|
2000
|
+
return this._playingPromise ?? Promise.resolve();
|
|
2001
|
+
}
|
|
2002
|
+
async play() {
|
|
2003
|
+
return Xr(this);
|
|
2004
|
+
}
|
|
2005
|
+
pause() {
|
|
2006
|
+
return Qr(this), this;
|
|
2007
|
+
}
|
|
2008
|
+
resume() {
|
|
2009
|
+
return $r(this), this;
|
|
2010
|
+
}
|
|
2011
|
+
toggle() {
|
|
2012
|
+
return ei(this);
|
|
2013
|
+
}
|
|
2014
|
+
settle() {
|
|
2015
|
+
return ti(this), this;
|
|
2016
|
+
}
|
|
2017
|
+
reset() {
|
|
2018
|
+
return ni(this), this;
|
|
2019
|
+
}
|
|
2020
|
+
stop() {
|
|
2021
|
+
return ri(this), this;
|
|
2022
|
+
}
|
|
2023
|
+
playing() {
|
|
2024
|
+
return ii(this);
|
|
2025
|
+
}
|
|
2026
|
+
setLayerConfig(e, t) {
|
|
2027
|
+
return Br(this, e, t), this;
|
|
2028
|
+
}
|
|
2029
|
+
setLayerEnabled(e, t) {
|
|
2030
|
+
return this.setLayerConfig(e, { enabled: t });
|
|
2031
|
+
}
|
|
2032
|
+
getLayerConfig(e) {
|
|
2033
|
+
return Vr(this, e);
|
|
2034
|
+
}
|
|
2035
|
+
transitionLayer(e, t) {
|
|
2036
|
+
return Hr(this, e, t), this;
|
|
2037
|
+
}
|
|
2038
|
+
crossfade(e, t, n) {
|
|
2039
|
+
return Ur(this, e, t, n), this;
|
|
2040
|
+
}
|
|
2041
|
+
advanceLayerSprings(e) {
|
|
2042
|
+
this._hasLayerSprings = Mr(this.getEntries(), e);
|
|
2043
|
+
}
|
|
2044
|
+
}, si = class {
|
|
2045
|
+
animation;
|
|
2046
|
+
constructor(e) {
|
|
2047
|
+
this.animation = e;
|
|
2048
|
+
}
|
|
2049
|
+
play() {
|
|
2050
|
+
return this.animation.play();
|
|
2051
|
+
}
|
|
2052
|
+
pause() {
|
|
2053
|
+
return this.animation.pause(), this;
|
|
2054
|
+
}
|
|
2055
|
+
stop() {
|
|
2056
|
+
return this.animation.stop(), this;
|
|
2057
|
+
}
|
|
2058
|
+
get finished() {
|
|
2059
|
+
return this.animation.finished;
|
|
2060
|
+
}
|
|
2061
|
+
}, ci = (e) => typeof e == "number" ? `${e}%` : e;
|
|
2062
|
+
function li(e, t) {
|
|
2063
|
+
let { path: n, from: r = "0%", to: i = "100%", rotate: a, autoPlay: o = !0, ...s } = t;
|
|
2064
|
+
if (typeof n != "string" || n.length === 0) throw Error("fromMotionPath(): `path` is required — pass an offset-path value (a path()/ray()/url(#id) string).");
|
|
2065
|
+
let c = Array.isArray(e) ? e : [e];
|
|
2066
|
+
for (let e of c) e.style.offsetPath = n, a !== void 0 && (e.style.offsetRotate = a);
|
|
2067
|
+
let l = {
|
|
2068
|
+
"0%": { "offset-distance": ci(r) },
|
|
2069
|
+
"100%": { "offset-distance": ci(i) }
|
|
2070
|
+
}, u = new U(s).fromKeyframes(l);
|
|
2071
|
+
return u.setTargets(...c), o && u.play(), u;
|
|
2072
|
+
}
|
|
2073
|
+
var ui = class extends si {
|
|
2074
|
+
constructor(e, t) {
|
|
2075
|
+
super(li(e, t));
|
|
2076
|
+
}
|
|
2077
|
+
}, di = (e) => {
|
|
2078
|
+
if (typeof e == "number") {
|
|
2079
|
+
if (!Number.isFinite(e) || e < 0 || e > 1) throw Error(`fromDrawSVG(): a numeric draw position is a 0..1 fraction, got ${JSON.stringify(e)} — pass a fraction in [0, 1] or a percent string ("0%".."100%").`);
|
|
2080
|
+
return e;
|
|
2081
|
+
}
|
|
2082
|
+
if (!/^\s*\d*\.?\d+\s*%\s*$/.test(e)) throw Error(`fromDrawSVG(): invalid draw position ${JSON.stringify(e)} — pass a percent string ("0%".."100%") or a 0..1 number.`);
|
|
2083
|
+
return parseFloat(e) / 100;
|
|
2084
|
+
};
|
|
2085
|
+
function fi(e, t = {}) {
|
|
2086
|
+
let { from: n = "0%", to: r = "100%", autoPlay: i = !0, ...a } = t;
|
|
2087
|
+
if (e == null || typeof e.getTotalLength != "function") throw Error("fromDrawSVG(): `target` must be an SVG geometry element exposing getTotalLength() (a <path>/<line>/<circle>/<rect>/<polygon>/…).");
|
|
2088
|
+
let o = di(n), s = di(r), c = e.getTotalLength();
|
|
2089
|
+
e.style.strokeDasharray = `${c}`;
|
|
2090
|
+
let l = {
|
|
2091
|
+
"0%": { "stroke-dashoffset": c * (1 - o) },
|
|
2092
|
+
"100%": { "stroke-dashoffset": c * (1 - s) }
|
|
2093
|
+
}, u = new U(a).fromKeyframes(l);
|
|
2094
|
+
return u.setTargets(e), i && u.play(), u;
|
|
2095
|
+
}
|
|
2096
|
+
var pi = class extends si {
|
|
2097
|
+
constructor(e, t = {}) {
|
|
2098
|
+
super(fi(e, t));
|
|
2099
|
+
}
|
|
2100
|
+
}, mi = (e) => `--morph-${e}-x`, hi = (e) => `--morph-${e}-y`, gi = (e) => `--morph-${e}-angle`, _i = (e, t, n) => {
|
|
2101
|
+
let r = Array(t + 1);
|
|
2102
|
+
for (let i = 0; i <= t; i++) if (n) {
|
|
2103
|
+
let n = e.sampleAtLength(e.totalLength * (i / t));
|
|
2104
|
+
r[i] = {
|
|
2105
|
+
x: n.x,
|
|
2106
|
+
y: n.y,
|
|
2107
|
+
angle: n.angle
|
|
2108
|
+
};
|
|
2109
|
+
} else r[i] = e.getPointAtT(i / t);
|
|
2110
|
+
return r;
|
|
2111
|
+
}, vi = (e) => Number.isInteger(e) ? `${e}` : e.toFixed(3), yi = (e) => {
|
|
2112
|
+
if (e.length === 0) return "";
|
|
2113
|
+
let t = `M ${vi(e[0].x)} ${vi(e[0].y)}`;
|
|
2114
|
+
for (let n = 1; n < e.length; n++) t += ` L ${vi(e[n].x)} ${vi(e[n].y)}`;
|
|
2115
|
+
return t;
|
|
2116
|
+
}, bi = (e, t) => {
|
|
2117
|
+
let n = Array(t + 1);
|
|
2118
|
+
for (let e = 0; e <= t; e++) n[e] = {
|
|
2119
|
+
x: 0,
|
|
2120
|
+
y: 0
|
|
2121
|
+
};
|
|
2122
|
+
return (r) => {
|
|
2123
|
+
let i = r;
|
|
2124
|
+
for (let e = 0; e <= t; e++) {
|
|
2125
|
+
let t = n[e], r = i[mi(e)], a = i[hi(e)];
|
|
2126
|
+
if (typeof r != "number" || typeof a != "number") throw Error(`morph render: point ${e} lost its coordinate leaf (engine invariant violated — xKey/yKey seeded at construction)`);
|
|
2127
|
+
t.x = r, t.y = a;
|
|
2128
|
+
}
|
|
2129
|
+
let a = yi(n);
|
|
2130
|
+
e.style.setProperty("--morph-d", a), e.style.setProperty("d", `path("${a}")`);
|
|
2131
|
+
};
|
|
2132
|
+
};
|
|
2133
|
+
//#endregion
|
|
2134
|
+
//#region src/animation/svg/morph-svg.ts
|
|
2135
|
+
function xi(t, n, r = {}) {
|
|
2136
|
+
let { samples: i = 64, target: a, orient: o = !1, autoPlay: s = !0, ...c } = r;
|
|
2137
|
+
if (typeof t != "string" || t.length === 0) throw new e("from", t, "fromMorphSVG(): `from` must be a non-empty SVG path `d` string.");
|
|
2138
|
+
if (typeof n != "string" || n.length === 0) throw new e("to", n, "fromMorphSVG(): `to` must be a non-empty SVG path `d` string.");
|
|
2139
|
+
if (!Number.isInteger(i) || i < 2) throw new e("samples", i, "fromMorphSVG(): `samples` must be an integer >= 2 (a 1-sample morph is just the two endpoints, with no body to interpolate).");
|
|
2140
|
+
let l = new Fe(t), u = new Fe(n);
|
|
2141
|
+
if (l.totalLength === 0) throw new e("from", t, "fromMorphSVG(): the `from` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
|
|
2142
|
+
if (u.totalLength === 0) throw new e("to", n, "fromMorphSVG(): the `to` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
|
|
2143
|
+
let d = _i(l, i, o), f = _i(u, i, o), p = {}, m = {};
|
|
2144
|
+
for (let e = 0; e <= i; e++) p[mi(e)] = d[e].x, p[hi(e)] = d[e].y, m[mi(e)] = f[e].x, m[hi(e)] = f[e].y, o && (p[gi(e)] = d[e].angle ?? 0, m[gi(e)] = f[e].angle ?? 0);
|
|
2145
|
+
let h = {
|
|
2146
|
+
"0%": p,
|
|
2147
|
+
"100%": m
|
|
2148
|
+
}, g = a == null ? void 0 : bi(a, i), _ = a;
|
|
2149
|
+
a != null && typeof _.setAttribute == "function" && _.setAttribute("d", t);
|
|
2150
|
+
let v = new U(c).fromKeyframes(h, g);
|
|
2151
|
+
return s && v.play(), v;
|
|
2152
|
+
}
|
|
2153
|
+
var Si = class extends si {
|
|
2154
|
+
samples;
|
|
2155
|
+
constructor(e, t, n = {}) {
|
|
2156
|
+
super(xi(e, t, n)), this.samples = n.samples ?? 64;
|
|
2157
|
+
}
|
|
2158
|
+
sampleD(e) {
|
|
2159
|
+
let t = (e < 0 ? 0 : e > 1 ? 1 : e) * this.animation.options.duration, n = this.animation.interpFrames(t, !1), r = Array(this.samples + 1);
|
|
2160
|
+
for (let e = 0; e <= this.samples; e++) {
|
|
2161
|
+
let t = n[mi(e)]?.[0]?.value, i = n[hi(e)]?.[0]?.value;
|
|
2162
|
+
r[e] = {
|
|
2163
|
+
x: t ?? 0,
|
|
2164
|
+
y: i ?? 0
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
return yi(r);
|
|
2168
|
+
}
|
|
2169
|
+
}, Ci = "\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n", wi = "\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n", Ti = "\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.05);\n }\n", Ei = "\n8%,\n41% {\n transform: translateX(-10px);\n}\n25%,\n58% {\n transform: translateX(10px);\n}\n75% {\n transform: translateX(-5px);\n}\n92% {\n transform: translateX(5px);\n}\n0%,\n100% {\n transform: translateX(0);\n}\n", Di = "\n 0%, 20%, 50%, 80%, 100% {\n transform: translateY(0);\n }\n 40% {\n transform: translateY(-30px);\n }\n 60% {\n transform: translateY(-15px);\n }\n", Oi = "\n 0% {\n transform: perspective(400px) rotateY(0);\n animation-timing-function: ease-out;\n }\n 40% {\n transform: perspective(400px) translateZ(150px) rotateY(170deg);\n animation-timing-function: ease-out;\n }\n 50% {\n transform: perspective(400px) translateZ(150px) rotateY(190deg) scale(1);\n animation-timing-function: ease-in;\n }\n 80% {\n transform: perspective(400px) rotateY(360deg) scale(.95);\n animation-timing-function: ease-in;\n }\n 100% {\n transform: perspective(400px) scale(1);\n animation-timing-function: ease-in;\n }\n", ki = "\n 0% {\n transform-origin: center;\n transform: rotate3d(0, 0, 1, -200deg);\n opacity: 0;\n }\n 100% {\n transform-origin: center;\n transform: none;\n opacity: 1;\n }\n", Ai = "\n 0% {\n transform: translateY(1000px);\n opacity: 0;\n }\n 100% {\n transform: translateY(0);\n opacity: 1;\n }\n", ji = "\n 0% {\n transform: scale(1);\n }\n 14% {\n transform: scale(1.3);\n }\n 28% {\n transform: scale(1);\n }\n 42% {\n transform: scale(1.3);\n }\n 70% {\n transform: scale(1);\n }\n", Mi = "\n 0%, 100% {\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);\n }\n 50% {\n box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);\n }\n", Ni = "\n 0% {\n width: 0;\n }\n 100% {\n width: 100%;\n }\n", Pi = "\n 0% {\n color: red;\n }\n 15% {\n color: orange;\n }\n 30% {\n color: yellow;\n }\n 45% {\n color: green;\n }\n 60% {\n color: blue;\n }\n 75% {\n color: indigo;\n }\n 90% {\n color: violet;\n }\n 100% {\n color: red;\n }\n", Fi = "@keyframes keyframeDelete {\n 0% {\n transform: translateX(0%) rotate(0deg);\n opacity: 1;\n }\n 25% {\n transform: translateX(0%) rotate(5deg);\n opacity: 1;\n }\n 50% {\n transform: translateX(25%) rotate(10deg);\n opacity: 0.5;\n }\n 75% {\n transform: translateX(0%) rotate(0deg);\n opacity: 0.25;\n }\n 100% {\n transform: translateX(-100%);\n opacity: 0;\n }\n}", Ii = "@keyframes keyframeDelete {\n 0% {\n transform: translateX(0%) rotate(0deg);\n opacity: 1;\n }\n 25% {\n transform: translateX(0%) rotate(-5deg);\n opacity: 1;\n }\n 50% {\n transform: translateX(-25%) rotate(-10deg);\n opacity: 0.5;\n }\n 100% {\n transform: translateX(100%);\n opacity: 0;\n }\n}", Li = "\n0% {\n filter: blur(10px);\n opacity: 0;\n}\n100% {\n filter: blur(0px);\n opacity: 1;\n}\n", Ri = "\n0% {\n filter: blur(0px);\n opacity: 1;\n}\n100% {\n filter: blur(10px);\n opacity: 0;\n}\n", zi = "\n0% {\n filter: blur(0px);\n}\n50% {\n filter: blur(10px);\n}\n100% {\n filter: blur(0px);\n}\n", Bi = "\n0% {\n width: 0%;\n background-color: #ff9999;\n}\n25% {\n width: 25%;\n background-color: #ffcc99;\n}\n50% {\n width: 50%;\n background-color: #ffff99;\n}\n75% {\n width: 75%;\n background-color: #99ff99;\n}\n100% {\n width: 100%;\n background-color: #99ccff;\n}\n", Vi = "\n0% {\n background-position: -200% 0;\n}\n100% {\n background-position: 200% 0;\n}\n", Hi = "\n0%, 100% {\n filter: blur(0px);\n opacity: 1;\n}\n50% {\n filter: blur(4px);\n opacity: 0.5;\n}\n", Ui = "\n0% {\n background-position: 0% 50%;\n}\n50% {\n background-position: 100% 50%;\n}\n100% {\n background-position: 0% 50%;\n}\n", Wi = "\n0% {\n transform: rotate(0deg) scale(1);\n}\n25% {\n transform: rotate(90deg) scale(1.1);\n}\n50% {\n transform: rotate(180deg) scale(1);\n}\n75% {\n transform: rotate(270deg) scale(0.9);\n}\n100% {\n transform: rotate(360deg) scale(1);\n}\n", Gi = "\n0%, 100% {\n border-right-color: transparent;\n}\n50% {\n border-right-color: black;\n}\n", Ki = "\n0% {\n max-height: 0;\n opacity: 0;\n}\n100% {\n max-height: 1000px;\n opacity: 1;\n}\n", qi = "\n0%, 100% {\n transform: translateY(0);\n}\n25% {\n transform: translateY(-10px);\n}\n50% {\n transform: translateY(0);\n}\n75% {\n transform: translateY(-5px);\n}\n", Ji = "\n0% {\n transform: rotate(0deg);\n border-radius: 50%;\n}\n25% {\n transform: rotate(90deg);\n border-radius: 40% 60% 60% 40% / 40% 40% 60% 60%;\n}\n50% {\n transform: rotate(180deg);\n border-radius: 50%;\n}\n75% {\n transform: rotate(270deg);\n border-radius: 60% 40% 40% 60% / 60% 60% 40% 40%;\n}\n100% {\n transform: rotate(360deg);\n border-radius: 50%;\n}\n", Yi = "\n0% {\n background-position: 50% 0%;\n}\n100% {\n background-position: 50% 100%;\n}\n", Xi = "\n0% {\n transform: translateX(-100%);\n opacity: 0;\n}\n100% {\n transform: translateX(0);\n opacity: 1;\n}\n", Zi = "\n0% {\n transform: translateX(0);\n opacity: 1;\n}\n100% {\n transform: translateX(-100%);\n opacity: 0;\n}\n", Qi = "\n0% {\n transform: translateX(100%);\n opacity: 0;\n}\n100% {\n transform: translateX(0);\n opacity: 1;\n}\n", $i = "\n0% {\n transform: translateX(0%);\n opacity: 1;\n\n}\n100% {\n transform: translateX(100%);\n opacity: 0;\n}\n", ea = "\n0% {\n transform: translateY(0px);\n}\n50% {\n transform: translateY(5px);\n}\n100% {\n transform: translateY(0px);\n}\n", ta = "@keyframes keyframeShift {\n0% {\n transform: translateY(0%);\n opacity: 1;\n}\n\n50% {\n transform: translateY(-50%);\n opacity: 0.75;\n}\n\n100% {\n transform: translateY(-100%);\n opacity: 1;\n}\n}", na = "@keyframes keyframeShift {\n0% {\n transform: translateY(0%);\n opacity: 1;\n}\n\n50% {\n transform: translateY(50%);\n opacity: 0.75;\n}\n\n100% {\n transform: translateY(100%);\n opacity: 1;\n}\n}", q = (e) => /^\s*@keyframes\s+[^\s{]+\s*\{([\s\S]*)\}\s*$/.exec(e)?.[1] ?? e, ra = {
|
|
2170
|
+
response: .35,
|
|
2171
|
+
dampingFraction: .78
|
|
2172
|
+
}, ia = {
|
|
2173
|
+
response: .5,
|
|
2174
|
+
dampingFraction: .5
|
|
2175
|
+
}, aa = {
|
|
2176
|
+
response: .7,
|
|
2177
|
+
dampingFraction: .95
|
|
2178
|
+
}, oa = {
|
|
2179
|
+
springScaleInKeyframes: "\n 0% {\n transform: scale(0.6);\n opacity: 0;\n }\n 100% {\n transform: scale(1);\n opacity: 1;\n }\n",
|
|
2180
|
+
springSlideInKeyframes: "\n 0% {\n transform: translateY(40px);\n opacity: 0;\n }\n 100% {\n transform: translateY(0);\n opacity: 1;\n }\n",
|
|
2181
|
+
springPopKeyframes: "\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.15);\n }\n",
|
|
2182
|
+
springWobbleKeyframes: "\n 0%, 100% {\n transform: rotate(0deg);\n }\n 50% {\n transform: rotate(8deg);\n }\n"
|
|
2183
|
+
}, sa = {
|
|
2184
|
+
fadeIn: {
|
|
2185
|
+
css: q(Ci),
|
|
2186
|
+
options: {
|
|
2187
|
+
duration: 700,
|
|
2188
|
+
timingFunction: "ease-in-out"
|
|
2189
|
+
},
|
|
2190
|
+
group: "enter"
|
|
2191
|
+
},
|
|
2192
|
+
fadeOut: {
|
|
2193
|
+
css: q(wi),
|
|
2194
|
+
options: {
|
|
2195
|
+
duration: 700,
|
|
2196
|
+
timingFunction: "ease-in-out"
|
|
2197
|
+
},
|
|
2198
|
+
group: "exit"
|
|
2199
|
+
},
|
|
2200
|
+
pulse: {
|
|
2201
|
+
css: q(Ti),
|
|
2202
|
+
options: {
|
|
2203
|
+
duration: 1e3,
|
|
2204
|
+
timingFunction: "ease-in-out",
|
|
2205
|
+
iterationCount: Infinity
|
|
2206
|
+
},
|
|
2207
|
+
group: "attention"
|
|
2208
|
+
},
|
|
2209
|
+
shake: {
|
|
2210
|
+
css: q(Ei),
|
|
2211
|
+
options: {
|
|
2212
|
+
duration: 820,
|
|
2213
|
+
timingFunction: "ease-in-out"
|
|
2214
|
+
},
|
|
2215
|
+
group: "attention"
|
|
2216
|
+
},
|
|
2217
|
+
bounce: {
|
|
2218
|
+
css: q(Di),
|
|
2219
|
+
options: {
|
|
2220
|
+
duration: 1e3,
|
|
2221
|
+
timingFunction: x(.28, .84, .42, 1)
|
|
2222
|
+
},
|
|
2223
|
+
group: "attention"
|
|
2224
|
+
},
|
|
2225
|
+
flipPreset: {
|
|
2226
|
+
css: q(Oi),
|
|
2227
|
+
options: {
|
|
2228
|
+
duration: 1e3,
|
|
2229
|
+
timingFunction: "ease-in-out"
|
|
2230
|
+
},
|
|
2231
|
+
group: "attention",
|
|
2232
|
+
taxonomyName: "flip"
|
|
2233
|
+
},
|
|
2234
|
+
rotateIn: {
|
|
2235
|
+
css: q(ki),
|
|
2236
|
+
options: {
|
|
2237
|
+
duration: 1e3,
|
|
2238
|
+
timingFunction: x(.25, .46, .45, .94)
|
|
2239
|
+
},
|
|
2240
|
+
group: "enter"
|
|
2241
|
+
},
|
|
2242
|
+
slideIn: {
|
|
2243
|
+
css: q(Ai),
|
|
2244
|
+
options: {
|
|
2245
|
+
duration: 1e3,
|
|
2246
|
+
timingFunction: x(.25, .46, .45, .94)
|
|
2247
|
+
},
|
|
2248
|
+
group: "enter"
|
|
2249
|
+
},
|
|
2250
|
+
heartbeat: {
|
|
2251
|
+
css: q(ji),
|
|
2252
|
+
options: {
|
|
2253
|
+
duration: 1500,
|
|
2254
|
+
timingFunction: "ease-in-out",
|
|
2255
|
+
iterationCount: Infinity
|
|
2256
|
+
},
|
|
2257
|
+
group: "loop"
|
|
2258
|
+
},
|
|
2259
|
+
glow: {
|
|
2260
|
+
css: q(Mi),
|
|
2261
|
+
options: {
|
|
2262
|
+
duration: 2e3,
|
|
2263
|
+
timingFunction: "ease-in-out",
|
|
2264
|
+
iterationCount: Infinity
|
|
2265
|
+
},
|
|
2266
|
+
group: "loop"
|
|
2267
|
+
},
|
|
2268
|
+
typewriter: {
|
|
2269
|
+
css: q(Ni),
|
|
2270
|
+
options: {
|
|
2271
|
+
duration: 3e3,
|
|
2272
|
+
timingFunction: oe(40, "jump-end"),
|
|
2273
|
+
fillMode: "forwards"
|
|
2274
|
+
}
|
|
2275
|
+
},
|
|
2276
|
+
rainbowText: {
|
|
2277
|
+
css: q(Pi),
|
|
2278
|
+
options: {
|
|
2279
|
+
duration: 5e3,
|
|
2280
|
+
timingFunction: "linear",
|
|
2281
|
+
iterationCount: Infinity
|
|
2282
|
+
},
|
|
2283
|
+
group: "loop"
|
|
2284
|
+
},
|
|
2285
|
+
warpLeft: {
|
|
2286
|
+
css: q(Fi),
|
|
2287
|
+
options: {
|
|
2288
|
+
duration: 700,
|
|
2289
|
+
timingFunction: "bounce-in-ease"
|
|
2290
|
+
},
|
|
2291
|
+
group: "exit"
|
|
2292
|
+
},
|
|
2293
|
+
warpRight: {
|
|
2294
|
+
css: q(Ii),
|
|
2295
|
+
options: {
|
|
2296
|
+
duration: 700,
|
|
2297
|
+
timingFunction: "bounce-in-ease"
|
|
2298
|
+
},
|
|
2299
|
+
group: "exit"
|
|
2300
|
+
},
|
|
2301
|
+
blurIn: {
|
|
2302
|
+
css: q(Li),
|
|
2303
|
+
options: {
|
|
2304
|
+
duration: 2e3,
|
|
2305
|
+
timingFunction: "ease-in-out"
|
|
2306
|
+
},
|
|
2307
|
+
group: "enter"
|
|
2308
|
+
},
|
|
2309
|
+
blurOut: {
|
|
2310
|
+
css: q(Ri),
|
|
2311
|
+
options: {
|
|
2312
|
+
duration: 2e3,
|
|
2313
|
+
timingFunction: "ease-in-out"
|
|
2314
|
+
},
|
|
2315
|
+
group: "exit"
|
|
2316
|
+
},
|
|
2317
|
+
blurInOut: {
|
|
2318
|
+
css: q(zi),
|
|
2319
|
+
options: {
|
|
2320
|
+
duration: 2e3,
|
|
2321
|
+
timingFunction: "ease-in-out"
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
progressBar: {
|
|
2325
|
+
css: q(Bi),
|
|
2326
|
+
options: {
|
|
2327
|
+
duration: 3e3,
|
|
2328
|
+
timingFunction: "linear",
|
|
2329
|
+
fillMode: "forwards"
|
|
2330
|
+
}
|
|
2331
|
+
},
|
|
2332
|
+
skeletonLoading: {
|
|
2333
|
+
css: q(Vi),
|
|
2334
|
+
options: {
|
|
2335
|
+
duration: 1500,
|
|
2336
|
+
timingFunction: "linear",
|
|
2337
|
+
iterationCount: Infinity
|
|
2338
|
+
},
|
|
2339
|
+
group: "loop"
|
|
2340
|
+
},
|
|
2341
|
+
textFocusBlur: {
|
|
2342
|
+
css: q(Hi),
|
|
2343
|
+
options: {
|
|
2344
|
+
duration: 2e3,
|
|
2345
|
+
timingFunction: "ease-in-out"
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
gradientBackground: {
|
|
2349
|
+
css: q(Ui),
|
|
2350
|
+
options: {
|
|
2351
|
+
duration: 5e3,
|
|
2352
|
+
timingFunction: "ease-in-out",
|
|
2353
|
+
iterationCount: Infinity
|
|
2354
|
+
},
|
|
2355
|
+
group: "loop"
|
|
2356
|
+
},
|
|
2357
|
+
rotateScale: {
|
|
2358
|
+
css: q(Wi),
|
|
2359
|
+
options: {
|
|
2360
|
+
duration: 2500,
|
|
2361
|
+
timingFunction: x(.68, -.55, .265, 1.55)
|
|
2362
|
+
}
|
|
2363
|
+
},
|
|
2364
|
+
typingCursor: {
|
|
2365
|
+
css: q(Gi),
|
|
2366
|
+
options: {
|
|
2367
|
+
duration: 800,
|
|
2368
|
+
timingFunction: oe(2, "jump-start"),
|
|
2369
|
+
iterationCount: Infinity
|
|
2370
|
+
},
|
|
2371
|
+
group: "loop"
|
|
2372
|
+
},
|
|
2373
|
+
accordionExpand: {
|
|
2374
|
+
css: q(Ki),
|
|
2375
|
+
options: {
|
|
2376
|
+
duration: 500,
|
|
2377
|
+
timingFunction: x(.25, .46, .45, .94),
|
|
2378
|
+
fillMode: "forwards"
|
|
2379
|
+
}
|
|
2380
|
+
},
|
|
2381
|
+
notificationBounce: {
|
|
2382
|
+
css: q(qi),
|
|
2383
|
+
options: {
|
|
2384
|
+
duration: 1e3,
|
|
2385
|
+
timingFunction: x(.28, .84, .42, 1)
|
|
2386
|
+
},
|
|
2387
|
+
group: "attention"
|
|
2388
|
+
},
|
|
2389
|
+
spinner: {
|
|
2390
|
+
css: q(Ji),
|
|
2391
|
+
options: {
|
|
2392
|
+
duration: 2e3,
|
|
2393
|
+
timingFunction: "linear",
|
|
2394
|
+
iterationCount: Infinity
|
|
2395
|
+
},
|
|
2396
|
+
group: "loop"
|
|
2397
|
+
},
|
|
2398
|
+
parallaxScroll: {
|
|
2399
|
+
css: q(Yi),
|
|
2400
|
+
options: {
|
|
2401
|
+
duration: 1e4,
|
|
2402
|
+
timingFunction: "linear",
|
|
2403
|
+
iterationCount: Infinity
|
|
2404
|
+
},
|
|
2405
|
+
group: "loop"
|
|
2406
|
+
},
|
|
2407
|
+
slideInLeft: {
|
|
2408
|
+
css: q(Xi),
|
|
2409
|
+
options: {
|
|
2410
|
+
duration: 1e3,
|
|
2411
|
+
timingFunction: x(.25, .46, .45, .94)
|
|
2412
|
+
},
|
|
2413
|
+
group: "enter"
|
|
2414
|
+
},
|
|
2415
|
+
slideOutLeft: {
|
|
2416
|
+
css: q(Zi),
|
|
2417
|
+
options: {
|
|
2418
|
+
duration: 1e3,
|
|
2419
|
+
timingFunction: x(.25, .46, .45, .94)
|
|
2420
|
+
},
|
|
2421
|
+
group: "exit"
|
|
2422
|
+
},
|
|
2423
|
+
slideInRight: {
|
|
2424
|
+
css: q(Qi),
|
|
2425
|
+
options: {
|
|
2426
|
+
duration: 1e3,
|
|
2427
|
+
timingFunction: x(.25, .46, .45, .94)
|
|
2428
|
+
},
|
|
2429
|
+
group: "enter"
|
|
2430
|
+
},
|
|
2431
|
+
slideOutRight: {
|
|
2432
|
+
css: q($i),
|
|
2433
|
+
options: {
|
|
2434
|
+
duration: 1e3,
|
|
2435
|
+
timingFunction: x(.25, .46, .45, .94)
|
|
2436
|
+
},
|
|
2437
|
+
group: "exit"
|
|
2438
|
+
},
|
|
2439
|
+
hover: {
|
|
2440
|
+
css: q(ea),
|
|
2441
|
+
options: {
|
|
2442
|
+
duration: 3e3,
|
|
2443
|
+
timingFunction: "ease-in-out",
|
|
2444
|
+
iterationCount: Infinity,
|
|
2445
|
+
fillMode: "none",
|
|
2446
|
+
direction: "alternate"
|
|
2447
|
+
},
|
|
2448
|
+
group: "loop"
|
|
2449
|
+
},
|
|
2450
|
+
jumpUp: {
|
|
2451
|
+
css: q(ta),
|
|
2452
|
+
options: {
|
|
2453
|
+
duration: 700,
|
|
2454
|
+
timingFunction: "bounce-in-ease"
|
|
2455
|
+
},
|
|
2456
|
+
group: "enter"
|
|
2457
|
+
},
|
|
2458
|
+
jumpDown: {
|
|
2459
|
+
css: q(na),
|
|
2460
|
+
options: {
|
|
2461
|
+
duration: 700,
|
|
2462
|
+
timingFunction: "bounce-in-ease"
|
|
2463
|
+
},
|
|
2464
|
+
group: "exit"
|
|
2465
|
+
},
|
|
2466
|
+
springScaleIn: {
|
|
2467
|
+
css: oa.springScaleInKeyframes,
|
|
2468
|
+
options: {
|
|
2469
|
+
duration: 600,
|
|
2470
|
+
timingFunction: t(ia)
|
|
2471
|
+
},
|
|
2472
|
+
group: "enter"
|
|
2473
|
+
},
|
|
2474
|
+
springSlideIn: {
|
|
2475
|
+
css: oa.springSlideInKeyframes,
|
|
2476
|
+
options: {
|
|
2477
|
+
duration: 600,
|
|
2478
|
+
timingFunction: t(ra)
|
|
2479
|
+
},
|
|
2480
|
+
group: "enter"
|
|
2481
|
+
},
|
|
2482
|
+
springPop: {
|
|
2483
|
+
css: oa.springPopKeyframes,
|
|
2484
|
+
options: {
|
|
2485
|
+
duration: 700,
|
|
2486
|
+
timingFunction: t(ia)
|
|
2487
|
+
},
|
|
2488
|
+
group: "attention"
|
|
2489
|
+
},
|
|
2490
|
+
springWobble: {
|
|
2491
|
+
css: oa.springWobbleKeyframes,
|
|
2492
|
+
options: {
|
|
2493
|
+
duration: 800,
|
|
2494
|
+
timingFunction: t(aa)
|
|
2495
|
+
},
|
|
2496
|
+
group: "attention"
|
|
2497
|
+
}
|
|
2498
|
+
}, ca = (e) => (t) => new U({
|
|
2499
|
+
...e.options,
|
|
2500
|
+
...t ?? {}
|
|
2501
|
+
}).fromString(e.css), la = Object.fromEntries(Object.entries(sa).map(([e, t]) => [e, ca(t)])), { fadeIn: ua, fadeOut: da, pulse: fa, shake: pa, bounce: ma, flipPreset: ha, rotateIn: ga, slideIn: _a, heartbeat: va, glow: ya, typewriter: ba, rainbowText: xa, warpLeft: Sa, warpRight: Ca, blurIn: wa, blurOut: Ta, blurInOut: Ea, progressBar: Da, skeletonLoading: Oa, textFocusBlur: ka, gradientBackground: Aa, rotateScale: ja, typingCursor: Ma, accordionExpand: Na, notificationBounce: Pa, spinner: Fa, parallaxScroll: Ia, slideInLeft: La, slideOutLeft: Ra, slideInRight: za, slideOutRight: Ba, hover: Va, jumpUp: Ha, jumpDown: Ua, springScaleIn: Wa, springSlideIn: Ga, springPop: Ka, springWobble: qa } = la, J = (e) => Object.fromEntries(Object.entries(sa).filter(([, t]) => t.group === e).map(([e, t]) => [t.taxonomyName ?? e, la[e]])), Ja = J("enter"), Ya = J("exit"), Xa = J("attention"), Za = J("loop"), Qa = {
|
|
2502
|
+
enter: Ja,
|
|
2503
|
+
exit: Ya,
|
|
2504
|
+
attention: Xa,
|
|
2505
|
+
loop: Za
|
|
2506
|
+
}, $a = /* @__PURE__ */ Le({
|
|
2507
|
+
accordionExpand: () => Na,
|
|
2508
|
+
attentionPresets: () => Xa,
|
|
2509
|
+
blurIn: () => wa,
|
|
2510
|
+
blurInOut: () => Ea,
|
|
2511
|
+
blurOut: () => Ta,
|
|
2512
|
+
bounce: () => ma,
|
|
2513
|
+
enterPresets: () => Ja,
|
|
2514
|
+
exitPresets: () => Ya,
|
|
2515
|
+
fadeIn: () => ua,
|
|
2516
|
+
fadeOut: () => da,
|
|
2517
|
+
flipPreset: () => ha,
|
|
2518
|
+
glow: () => ya,
|
|
2519
|
+
gradientBackground: () => Aa,
|
|
2520
|
+
heartbeat: () => va,
|
|
2521
|
+
hover: () => Va,
|
|
2522
|
+
jumpDown: () => Ua,
|
|
2523
|
+
jumpUp: () => Ha,
|
|
2524
|
+
loopPresets: () => Za,
|
|
2525
|
+
notificationBounce: () => Pa,
|
|
2526
|
+
parallaxScroll: () => Ia,
|
|
2527
|
+
presetTaxonomy: () => Qa,
|
|
2528
|
+
progressBar: () => Da,
|
|
2529
|
+
pulse: () => fa,
|
|
2530
|
+
rainbowText: () => xa,
|
|
2531
|
+
rotateIn: () => ga,
|
|
2532
|
+
rotateScale: () => ja,
|
|
2533
|
+
shake: () => pa,
|
|
2534
|
+
skeletonLoading: () => Oa,
|
|
2535
|
+
slideIn: () => _a,
|
|
2536
|
+
slideInLeft: () => La,
|
|
2537
|
+
slideInRight: () => za,
|
|
2538
|
+
slideOutLeft: () => Ra,
|
|
2539
|
+
slideOutRight: () => Ba,
|
|
2540
|
+
spinner: () => Fa,
|
|
2541
|
+
springPop: () => Ka,
|
|
2542
|
+
springScaleIn: () => Wa,
|
|
2543
|
+
springSlideIn: () => Ga,
|
|
2544
|
+
springWobble: () => qa,
|
|
2545
|
+
textFocusBlur: () => ka,
|
|
2546
|
+
typewriter: () => ba,
|
|
2547
|
+
typingCursor: () => Ma,
|
|
2548
|
+
warpLeft: () => Sa,
|
|
2549
|
+
warpRight: () => Ca
|
|
2550
|
+
}), eo = (e, t, n, r = {}) => {
|
|
2551
|
+
e.push({
|
|
2552
|
+
code: t,
|
|
2553
|
+
message: n,
|
|
2554
|
+
...r
|
|
2555
|
+
});
|
|
2556
|
+
}, to = (e) => {
|
|
2557
|
+
if (typeof CSSKeyframesRule < "u" && e instanceof CSSKeyframesRule) return !0;
|
|
2558
|
+
let t = e;
|
|
2559
|
+
return t.type === 7 && typeof t.name == "string" && typeof t.cssText == "string";
|
|
2560
|
+
}, no = 32, ro = (e) => e.cssRules !== void 0 && !to(e), io = (e, t, n, r = 0) => {
|
|
2561
|
+
let i = [];
|
|
2562
|
+
for (let t = 0; t < e.length; t++) {
|
|
2563
|
+
let n = e[t];
|
|
2564
|
+
if (n == null) continue;
|
|
2565
|
+
let r = n;
|
|
2566
|
+
r.type === 1 && typeof r.cssText == "string" && i.push(r.cssText);
|
|
2567
|
+
}
|
|
2568
|
+
for (let r = 0; r < e.length; r++) {
|
|
2569
|
+
let a = e[r];
|
|
2570
|
+
if (a == null || !to(a)) continue;
|
|
2571
|
+
let o = a.name;
|
|
2572
|
+
if (n.animationName != null && o !== n.animationName) continue;
|
|
2573
|
+
let s = RegExp(`\\banimation(?:-name)?\\s*:[^;}]*\\b${o}\\b`), c = i.find((e) => s.test(e)), l = [], u = ao(a.cssText, c, n.options, l);
|
|
2574
|
+
u != null && t.set(o, {
|
|
2575
|
+
name: o,
|
|
2576
|
+
animation: u,
|
|
2577
|
+
diagnostics: l
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
if (r < no) for (let i = 0; i < e.length; i++) {
|
|
2581
|
+
let a = e[i];
|
|
2582
|
+
a == null || !ro(a) || io(a.cssRules, t, n, r + 1);
|
|
2583
|
+
}
|
|
2584
|
+
}, ao = (e, t, n, r) => {
|
|
2585
|
+
try {
|
|
2586
|
+
let i = new U(n ?? {}), a = t ? `${t}\n${e}` : e;
|
|
2587
|
+
i.fromString(a);
|
|
2588
|
+
for (let e of i.diagnostics) r.push(e);
|
|
2589
|
+
return i;
|
|
2590
|
+
} catch (t) {
|
|
2591
|
+
eo(r, "PARSE_ERROR", `@keyframes rule could not be reconstructed: ${t instanceof Error ? t.message : String(t)} — the source CSS could not be parsed faithfully (refused, not approximated)`, { input: e });
|
|
2592
|
+
return;
|
|
2593
|
+
}
|
|
2594
|
+
}, oo = (e, t = {}) => {
|
|
2595
|
+
let n = /* @__PURE__ */ new Map(), r = [], i;
|
|
2596
|
+
if (e == null) {
|
|
2597
|
+
if (typeof document > "u") return eo(r, "CORS_SKIP", "no document in scope — resolveLiveKeyframes() needs a Document, a ShadowRoot, a CSSStyleSheet[], or a CSSStyleSheet (SSR has no live CSSOM)"), {
|
|
2598
|
+
animations: n,
|
|
2599
|
+
diagnostics: r
|
|
2600
|
+
};
|
|
2601
|
+
i = Array.from(document.styleSheets);
|
|
2602
|
+
} else i = Array.isArray(e) ? e : typeof Document < "u" && e instanceof Document ? Array.from(e.styleSheets) : typeof ShadowRoot < "u" && e instanceof ShadowRoot ? [...e.styleSheets == null ? [] : Array.from(e.styleSheets), ...e.adoptedStyleSheets ?? []] : [e];
|
|
2603
|
+
for (let e of i) {
|
|
2604
|
+
let i = null;
|
|
2605
|
+
try {
|
|
2606
|
+
i = e.cssRules;
|
|
2607
|
+
} catch (t) {
|
|
2608
|
+
let n = e.href ?? "(inline)";
|
|
2609
|
+
eo(r, "CORS_SKIP", `cross-origin stylesheet skipped: ${n} — its cssRules threw ${t instanceof Error ? t.name : "an error"} (no Access-Control-Allow-Origin + crossorigin). The sheet is REPORTED, not silently dropped.`, { input: n });
|
|
2610
|
+
continue;
|
|
2611
|
+
}
|
|
2612
|
+
i != null && io(i, n, t);
|
|
2613
|
+
}
|
|
2614
|
+
return {
|
|
2615
|
+
animations: n,
|
|
2616
|
+
diagnostics: r
|
|
2617
|
+
};
|
|
2618
|
+
}, so = (e, t = {}) => oo(e, t), co = (e, t = {}) => {
|
|
2619
|
+
let n = /* @__PURE__ */ new Map(), r = [], i = e ?? (typeof document < "u" ? document : void 0);
|
|
2620
|
+
if (i == null || typeof i.getAnimations != "function") return eo(r, "CORS_SKIP", "no getAnimations() in scope — fromLiveAnimations() needs a Document or Element with the Web Animations API (SSR has none)"), {
|
|
2621
|
+
animations: n,
|
|
2622
|
+
diagnostics: r
|
|
2623
|
+
};
|
|
2624
|
+
let a = /* @__PURE__ */ new Set();
|
|
2625
|
+
for (let e of i.getAnimations()) {
|
|
2626
|
+
let t = e.animationName;
|
|
2627
|
+
typeof t == "string" && t.length > 0 && a.add(t);
|
|
2628
|
+
}
|
|
2629
|
+
let o = (i instanceof Document ? i : i.ownerDocument ?? (typeof document < "u" ? document : void 0)) ?? void 0;
|
|
2630
|
+
for (let e of a) {
|
|
2631
|
+
let i = oo(o, {
|
|
2632
|
+
...t,
|
|
2633
|
+
animationName: e
|
|
2634
|
+
});
|
|
2635
|
+
for (let [e, t] of i.animations) n.set(e, t);
|
|
2636
|
+
for (let e of i.diagnostics) r.push(e);
|
|
2637
|
+
}
|
|
2638
|
+
return {
|
|
2639
|
+
animations: n,
|
|
2640
|
+
diagnostics: r
|
|
2641
|
+
};
|
|
2642
|
+
}, lo = (e) => {
|
|
2643
|
+
if (typeof e != "object" || !e) return !1;
|
|
2644
|
+
let t = e;
|
|
2645
|
+
return typeof t.value == "number" && typeof t.unit == "string";
|
|
2646
|
+
}, uo = async (e, t) => {
|
|
2647
|
+
let n = [], { animationName: r, commit: i = !0 } = t;
|
|
2648
|
+
if (typeof e.getAnimations != "function") return n.push({
|
|
2649
|
+
code: "WAAPI_INELIGIBLE",
|
|
2650
|
+
message: "the element has no getAnimations() — adoptRunning() needs the Web Animations API to read the running animation's playhead"
|
|
2651
|
+
}), {
|
|
2652
|
+
animation: null,
|
|
2653
|
+
currentTime: 0,
|
|
2654
|
+
diagnostics: n
|
|
2655
|
+
};
|
|
2656
|
+
let a = e.getAnimations().find((e) => e.animationName === r);
|
|
2657
|
+
if (a == null) return n.push({
|
|
2658
|
+
code: "ADOPT_REFUSE",
|
|
2659
|
+
message: `no running CSS animation named "${r}" on the element — adoptRunning() refuses (the takeover names exactly one running animation; nothing was silently adopted)`
|
|
2660
|
+
}), {
|
|
2661
|
+
animation: null,
|
|
2662
|
+
currentTime: 0,
|
|
2663
|
+
diagnostics: n
|
|
2664
|
+
};
|
|
2665
|
+
let o = a.currentTime, s = null, c = 0;
|
|
2666
|
+
if (typeof o == "number" && Number.isFinite(o)) c = o;
|
|
2667
|
+
else if (lo(o)) if (o.unit === "percent" && Number.isFinite(o.value)) s = o.value / 100;
|
|
2668
|
+
else return n.push({
|
|
2669
|
+
code: "ADOPT_REFUSE",
|
|
2670
|
+
message: `the running animation "${r}" reports a currentTime in an unsupported unit "${String(o.unit)}" — adoptRunning() refuses (only a numeric ms playhead or a scroll-driven "percent" CSSUnitValue can seed the takeover faithfully)`
|
|
2671
|
+
}), {
|
|
2672
|
+
animation: null,
|
|
2673
|
+
currentTime: 0,
|
|
2674
|
+
diagnostics: n
|
|
2675
|
+
};
|
|
2676
|
+
let l = oo(e.ownerDocument ?? (typeof document < "u" ? document : void 0) ?? void 0, {
|
|
2677
|
+
...t,
|
|
2678
|
+
animationName: r
|
|
2679
|
+
});
|
|
2680
|
+
for (let e of l.diagnostics) n.push(e);
|
|
2681
|
+
let u = l.animations.get(r);
|
|
2682
|
+
if (u == null) return n.push({
|
|
2683
|
+
code: "ADOPT_REFUSE",
|
|
2684
|
+
message: `the @keyframes rule for "${r}" could not be found or reconstructed from the CSSOM — adoptRunning() refuses rather than reconstruct from the lossy computed keyframe list`
|
|
2685
|
+
}), {
|
|
2686
|
+
animation: null,
|
|
2687
|
+
currentTime: c,
|
|
2688
|
+
diagnostics: n
|
|
2689
|
+
};
|
|
2690
|
+
let d = u.animation;
|
|
2691
|
+
for (let e of u.diagnostics) n.push(e);
|
|
2692
|
+
d.setTargets(e);
|
|
2693
|
+
let f = s == null ? c : s * d.options.duration;
|
|
2694
|
+
i && d.interpFrames(f, !0);
|
|
2695
|
+
try {
|
|
2696
|
+
a.cancel();
|
|
2697
|
+
} catch {}
|
|
2698
|
+
return fo(d, f), {
|
|
2699
|
+
animation: d,
|
|
2700
|
+
currentTime: f,
|
|
2701
|
+
diagnostics: n
|
|
2702
|
+
};
|
|
2703
|
+
}, fo = (e, t) => {
|
|
2704
|
+
e.setUseWAAPI(!1), e.setDelay(0), e.onStart(), e.started = !0, e.startTime = (typeof performance < "u" && performance.now ? performance.now() : Date.now()) - t, e.t = t, e.play();
|
|
2705
|
+
}, po = {
|
|
2706
|
+
entry: P.entry,
|
|
2707
|
+
cover: P.cover,
|
|
2708
|
+
contain: P.contain,
|
|
2709
|
+
exit: P.exit,
|
|
2710
|
+
normal: {
|
|
2711
|
+
start: 0,
|
|
2712
|
+
end: 1
|
|
2713
|
+
},
|
|
2714
|
+
"entry-crossing": {
|
|
2715
|
+
start: 0,
|
|
2716
|
+
end: .25
|
|
2717
|
+
},
|
|
2718
|
+
"exit-crossing": {
|
|
2719
|
+
start: .75,
|
|
2720
|
+
end: 1
|
|
2721
|
+
}
|
|
2722
|
+
};
|
|
2723
|
+
function mo(e) {
|
|
2724
|
+
if (e == null) return null;
|
|
2725
|
+
let t = e.trim();
|
|
2726
|
+
if (t.endsWith("%")) {
|
|
2727
|
+
let e = Number.parseFloat(t.slice(0, -1));
|
|
2728
|
+
return Number.isFinite(e) ? e / 100 : null;
|
|
2729
|
+
}
|
|
2730
|
+
return null;
|
|
2731
|
+
}
|
|
2732
|
+
function ho(e, t) {
|
|
2733
|
+
if (e == null) return t;
|
|
2734
|
+
let n = mo(e.offset);
|
|
2735
|
+
if (n != null) {
|
|
2736
|
+
if (e.phase != null && e.phase !== "normal") {
|
|
2737
|
+
let t = po[e.phase];
|
|
2738
|
+
return t.start + n * (t.end - t.start);
|
|
2739
|
+
}
|
|
2740
|
+
return n;
|
|
2741
|
+
}
|
|
2742
|
+
return e.phase == null ? t : po[e.phase].start;
|
|
2743
|
+
}
|
|
2744
|
+
function go(e) {
|
|
2745
|
+
if (e == null) return {
|
|
2746
|
+
start: 0,
|
|
2747
|
+
end: 1
|
|
2748
|
+
};
|
|
2749
|
+
let t = ho(e.start, 0), n = ho(e.end, 1);
|
|
2750
|
+
return n > t ? {
|
|
2751
|
+
start: t,
|
|
2752
|
+
end: n
|
|
2753
|
+
} : {
|
|
2754
|
+
start: 0,
|
|
2755
|
+
end: 1
|
|
2756
|
+
};
|
|
2757
|
+
}
|
|
2758
|
+
//#endregion
|
|
2759
|
+
//#region src/animation/scroll/scene.ts
|
|
2760
|
+
var _o = class {
|
|
2761
|
+
resolvedRange;
|
|
2762
|
+
snapPoints;
|
|
2763
|
+
snapSpring;
|
|
2764
|
+
scrubSeconds;
|
|
2765
|
+
smoother;
|
|
2766
|
+
rawScroll = 0;
|
|
2767
|
+
localProgress = 0;
|
|
2768
|
+
wasInside = !1;
|
|
2769
|
+
subscribers = new Map([["enter", /* @__PURE__ */ new Set()], ["leave", /* @__PURE__ */ new Set()]]);
|
|
2770
|
+
constructor(e = {}) {
|
|
2771
|
+
if (this.resolvedRange = go(e.range), this.scrubSeconds = e.scrub ?? 0, this.snapPoints = e.snap != null && e.snap.length > 0 ? e.snap : void 0, this.scrubSeconds > 0) {
|
|
2772
|
+
let t = i(1 / (this.scrubSeconds * 60 + 1), .01, 1);
|
|
2773
|
+
this.smoother = new n({
|
|
2774
|
+
damping: t,
|
|
2775
|
+
clamp: !0,
|
|
2776
|
+
...e.smoothing
|
|
2777
|
+
});
|
|
2778
|
+
}
|
|
2779
|
+
this.snapPoints != null && (this.snapSpring = new f({ ...e.snapSpring }));
|
|
2780
|
+
}
|
|
2781
|
+
get range() {
|
|
2782
|
+
return this.resolvedRange;
|
|
2783
|
+
}
|
|
2784
|
+
scrollProgress(e) {
|
|
2785
|
+
this.rawScroll = i(e, 0, 1);
|
|
2786
|
+
let { start: t, end: n } = this.resolvedRange, r = n - t, a = r > 0 ? i((this.rawScroll - t) / r, 0, 1) : 0, o = this.rawScroll >= t && this.rawScroll <= n;
|
|
2787
|
+
return o && !this.wasInside && this.fire("enter", a), !o && this.wasInside && this.fire("leave", a), this.wasInside = o, this.smoother ? (this.smoother.setTarget(a), this.localProgress = this.smoother.current) : this.localProgress = a, this.localProgress;
|
|
2788
|
+
}
|
|
2789
|
+
tick(e) {
|
|
2790
|
+
return this.smoother && (this.smoother.tickDt(e), this.localProgress = this.smoother.current), this.localProgress;
|
|
2791
|
+
}
|
|
2792
|
+
get progress() {
|
|
2793
|
+
return this.localProgress;
|
|
2794
|
+
}
|
|
2795
|
+
get settled() {
|
|
2796
|
+
return this.smoother == null || this.smoother.settled;
|
|
2797
|
+
}
|
|
2798
|
+
snapTo(e = 0) {
|
|
2799
|
+
if (this.snapPoints == null || this.snapSpring == null) return null;
|
|
2800
|
+
let t = i(c({
|
|
2801
|
+
initial: this.localProgress,
|
|
2802
|
+
velocity: e
|
|
2803
|
+
}), 0, 1), n = this.snapPoints[0], r = Math.abs(t - n);
|
|
2804
|
+
for (let e of this.snapPoints) {
|
|
2805
|
+
let i = Math.abs(t - e);
|
|
2806
|
+
i < r && (r = i, n = e);
|
|
2807
|
+
}
|
|
2808
|
+
return this.snapSpring.reset(this.localProgress, e), this.snapSpring.target = n, n;
|
|
2809
|
+
}
|
|
2810
|
+
tickSnap(e) {
|
|
2811
|
+
return this.snapSpring && !this.snapSpring.settled && (this.snapSpring.tickDt(e), this.localProgress = this.snapSpring.value), this.localProgress;
|
|
2812
|
+
}
|
|
2813
|
+
on(e, t) {
|
|
2814
|
+
let n = this.subscribers.get(e);
|
|
2815
|
+
return n.add(t), () => n.delete(t);
|
|
2816
|
+
}
|
|
2817
|
+
fire(e, t) {
|
|
2818
|
+
for (let n of this.subscribers.get(e)) n(t);
|
|
2819
|
+
}
|
|
2820
|
+
};
|
|
2821
|
+
function vo(e = {}) {
|
|
2822
|
+
return new _o(e);
|
|
2823
|
+
}
|
|
2824
|
+
//#endregion
|
|
2825
|
+
//#region src/animation/scroll/dispatch.ts
|
|
2826
|
+
function yo(e) {
|
|
2827
|
+
let { animation: t, nativeSpec: n, scrub: r, snap: i, velocity: a } = e;
|
|
2828
|
+
if (r) return {
|
|
2829
|
+
backend: "js",
|
|
2830
|
+
reason: "scrub smoothing requested (native scroll has no SmoothProgress smoother)"
|
|
2831
|
+
};
|
|
2832
|
+
if (i) return {
|
|
2833
|
+
backend: "js",
|
|
2834
|
+
reason: "physics snap requested (native scroll has no decay/spring settle)"
|
|
2835
|
+
};
|
|
2836
|
+
if (a) return {
|
|
2837
|
+
backend: "js",
|
|
2838
|
+
reason: "scroll velocity / non-DOM driving requested (JS-only capability)"
|
|
2839
|
+
};
|
|
2840
|
+
if (t == null || n == null) return {
|
|
2841
|
+
backend: "js",
|
|
2842
|
+
reason: "non-DOM target or no native timeline spec (the universal JS driver)"
|
|
2843
|
+
};
|
|
2844
|
+
let o = F(t);
|
|
2845
|
+
if (!o.eligible) return {
|
|
2846
|
+
backend: "js",
|
|
2847
|
+
reason: o.reason
|
|
2848
|
+
};
|
|
2849
|
+
let s = u(n);
|
|
2850
|
+
if (s == null) return {
|
|
2851
|
+
backend: "js",
|
|
2852
|
+
reason: "native scroll/view timeline unavailable (feature absent)"
|
|
2853
|
+
};
|
|
2854
|
+
let c = kt(t, n, {
|
|
2855
|
+
eligibility: o,
|
|
2856
|
+
timeline: s
|
|
2857
|
+
});
|
|
2858
|
+
return c.attached ? {
|
|
2859
|
+
backend: "native",
|
|
2860
|
+
attachment: c
|
|
2861
|
+
} : {
|
|
2862
|
+
backend: "js",
|
|
2863
|
+
reason: c.reason
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
function bo(e) {
|
|
2867
|
+
let t = ["position: sticky;"];
|
|
2868
|
+
return e?.bottom == null ? t.push(`top: ${e?.top ?? 0}px;`) : t.push(`bottom: ${e.bottom}px;`), t.join(" ");
|
|
2869
|
+
}
|
|
2870
|
+
//#endregion
|
|
2871
|
+
//#region src/animation/scroll/trigger.ts
|
|
2872
|
+
function xo() {
|
|
2873
|
+
let e = globalThis.CSS;
|
|
2874
|
+
if (e == null || typeof e.supports != "function") return !1;
|
|
2875
|
+
try {
|
|
2876
|
+
return e.supports("animation-trigger-behavior", "once") || e.supports("animation-trigger", "once");
|
|
2877
|
+
} catch {
|
|
2878
|
+
return !1;
|
|
2879
|
+
}
|
|
2880
|
+
}
|
|
2881
|
+
var So = class {
|
|
2882
|
+
type;
|
|
2883
|
+
triggerRange;
|
|
2884
|
+
_state = "idle";
|
|
2885
|
+
_direction = "forward";
|
|
2886
|
+
_playhead = 0;
|
|
2887
|
+
_cycles = 0;
|
|
2888
|
+
wasInside = !1;
|
|
2889
|
+
everEntered = !1;
|
|
2890
|
+
constructor(e = {}) {
|
|
2891
|
+
this.type = e.type ?? "once", this.triggerRange = go(e.range);
|
|
2892
|
+
}
|
|
2893
|
+
get state() {
|
|
2894
|
+
return this._state;
|
|
2895
|
+
}
|
|
2896
|
+
get direction() {
|
|
2897
|
+
return this._direction;
|
|
2898
|
+
}
|
|
2899
|
+
get playhead() {
|
|
2900
|
+
return this._playhead;
|
|
2901
|
+
}
|
|
2902
|
+
get cycles() {
|
|
2903
|
+
return this._cycles;
|
|
2904
|
+
}
|
|
2905
|
+
get range() {
|
|
2906
|
+
return this.triggerRange;
|
|
2907
|
+
}
|
|
2908
|
+
get usesNative() {
|
|
2909
|
+
return xo();
|
|
2910
|
+
}
|
|
2911
|
+
triggerProgress(e) {
|
|
2912
|
+
let t = i(e, 0, 1), { start: n, end: r } = this.triggerRange, a = r - n, o = a > 0 ? i((t - n) / a, 0, 1) : 0, s = t >= n && t <= r, c = s && !this.wasInside, l = !s && this.wasInside, u = l && t > r;
|
|
2913
|
+
switch (this.type) {
|
|
2914
|
+
case "repeat":
|
|
2915
|
+
this.stepRepeat(s, c, l, o);
|
|
2916
|
+
break;
|
|
2917
|
+
case "alternate":
|
|
2918
|
+
this.stepAlternate(s, c, l, o);
|
|
2919
|
+
break;
|
|
2920
|
+
case "state":
|
|
2921
|
+
this.stepState(s, o);
|
|
2922
|
+
break;
|
|
2923
|
+
default:
|
|
2924
|
+
this.stepOnce(c, u, o);
|
|
2925
|
+
break;
|
|
2926
|
+
}
|
|
2927
|
+
return this.wasInside = s, this._state;
|
|
2928
|
+
}
|
|
2929
|
+
reset() {
|
|
2930
|
+
this._state = "idle", this._direction = "forward", this._playhead = 0, this._cycles = 0, this.wasInside = !1, this.everEntered = !1;
|
|
2931
|
+
}
|
|
2932
|
+
stepOnce(e, t, n) {
|
|
2933
|
+
this._state !== "done" && (e && this._state === "idle" && (this._state = "active", this._direction = "forward", this._cycles = 1), this._state === "active" && (this._playhead = n, t && (this._state = "done", this._playhead = 1)));
|
|
2934
|
+
}
|
|
2935
|
+
stepRepeat(e, t, n, r) {
|
|
2936
|
+
t ? (this._state = "active", this._direction = "forward", this._cycles += 1, this._playhead = r) : n ? (this._state = "idle", this._playhead = 0) : e && (this._playhead = r);
|
|
2937
|
+
}
|
|
2938
|
+
stepAlternate(e, t, n, r) {
|
|
2939
|
+
t ? (this._direction = this._cycles % 2 == 0 ? "forward" : "backward", this._state = "active", this._cycles += 1, this._playhead = this.directedPlayhead(r)) : n ? this._state = "done" : e && (this._playhead = this.directedPlayhead(r));
|
|
2940
|
+
}
|
|
2941
|
+
stepState(e, t) {
|
|
2942
|
+
e ? (this._state = "active", this._direction = "forward", this._playhead = t, this.everEntered = !0) : this._state = this.everEntered ? "done" : "idle";
|
|
2943
|
+
}
|
|
2944
|
+
directedPlayhead(e) {
|
|
2945
|
+
return this._direction === "forward" ? e : 1 - e;
|
|
2946
|
+
}
|
|
2947
|
+
};
|
|
2948
|
+
function Co(e = {}) {
|
|
2949
|
+
return new So("trigger" in e && e.trigger != null ? e.trigger : e);
|
|
2950
|
+
}
|
|
2951
|
+
//#endregion
|
|
2952
|
+
//#region src/animation/scroll/drive.ts
|
|
2953
|
+
function wo(e) {
|
|
2954
|
+
return typeof e == "object" && !!e && "targets" in e && "play" in e;
|
|
2955
|
+
}
|
|
2956
|
+
function To(e) {
|
|
2957
|
+
return typeof Element < "u" && e instanceof Element;
|
|
2958
|
+
}
|
|
2959
|
+
function Eo(e, t, n) {
|
|
2960
|
+
if (n.nativeSpec != null) return n.nativeSpec;
|
|
2961
|
+
let r = e.timeline;
|
|
2962
|
+
if (r?.kind === "scroll") return {
|
|
2963
|
+
kind: "scroll",
|
|
2964
|
+
...n.source === void 0 ? {} : { source: n.source },
|
|
2965
|
+
...n.axis ?? r.axis ? { axis: n.axis ?? r.axis } : {}
|
|
2966
|
+
};
|
|
2967
|
+
if (r?.kind === "view") {
|
|
2968
|
+
let e = n.subject ?? (To(t) ? t : wo(t) && To(t.targets[0]) ? t.targets[0] : void 0);
|
|
2969
|
+
return e == null ? void 0 : {
|
|
2970
|
+
kind: "view",
|
|
2971
|
+
subject: e,
|
|
2972
|
+
...n.axis ?? r.axis ? { axis: n.axis ?? r.axis } : {},
|
|
2973
|
+
...n.inset != null || r.inset != null ? { inset: n.inset ?? `${r.inset.start}${r.inset.end ? ` ${r.inset.end}` : ""}` } : {}
|
|
2974
|
+
};
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
function Do(e, t, n = {}) {
|
|
2978
|
+
let r = wo(t) ? t : n.animation, { nativeSpec: i, animation: a, velocity: o, source: s, subject: c, axis: l, inset: u, ...d } = n, f = vo({
|
|
2979
|
+
...d,
|
|
2980
|
+
range: e.range
|
|
2981
|
+
}), p = e.trigger == null ? void 0 : Co(e), m = yo({
|
|
2982
|
+
animation: r,
|
|
2983
|
+
nativeSpec: Eo(e, t, n),
|
|
2984
|
+
scrub: n.scrub != null && n.scrub > 0,
|
|
2985
|
+
snap: n.snap != null && n.snap.length > 0,
|
|
2986
|
+
velocity: n.velocity
|
|
2987
|
+
});
|
|
2988
|
+
return {
|
|
2989
|
+
scene: f,
|
|
2990
|
+
...p == null ? {} : { trigger: p },
|
|
2991
|
+
backend: m.backend,
|
|
2992
|
+
...m.backend === "js" ? { reason: m.reason } : {}
|
|
2993
|
+
};
|
|
2994
|
+
}
|
|
2995
|
+
//#endregion
|
|
2996
|
+
//#region src/animation/scroll/grammar.ts
|
|
2997
|
+
function Oo(e) {
|
|
2998
|
+
return De(e);
|
|
2999
|
+
}
|
|
3000
|
+
function ko(e) {
|
|
3001
|
+
return Ee(e);
|
|
3002
|
+
}
|
|
3003
|
+
function Ao(e) {
|
|
3004
|
+
return Te(typeof e == "string" ? O(e) : e);
|
|
3005
|
+
}
|
|
3006
|
+
function jo(e) {
|
|
3007
|
+
return Pe(e);
|
|
3008
|
+
}
|
|
3009
|
+
function Mo(e) {
|
|
3010
|
+
let t = Ao(e);
|
|
3011
|
+
return {
|
|
3012
|
+
options: t,
|
|
3013
|
+
declarations: jo(t)
|
|
3014
|
+
};
|
|
3015
|
+
}
|
|
3016
|
+
//#endregion
|
|
3017
|
+
//#region src/animation/compile/emit/backward-walk.ts
|
|
3018
|
+
function No(e) {
|
|
3019
|
+
let t = [];
|
|
3020
|
+
for (let n of Object.keys(e.animations)) {
|
|
3021
|
+
let r = e.animations[n], i = W(r.layer), a = G(r.layer) && r.layer.weightSpring != null, o = G(r.layer) && r.layer.weightSpring == null, s = i === "add" || i === "accumulate" ? i : o ? "accumulate" : "replace";
|
|
3022
|
+
t.push({
|
|
3023
|
+
animation: r.animation,
|
|
3024
|
+
name: Y(H(r.animation)),
|
|
3025
|
+
composition: s,
|
|
3026
|
+
weighted: a,
|
|
3027
|
+
...o ? { staticWeight: r.layer.weight } : {},
|
|
3028
|
+
delay: 0
|
|
3029
|
+
});
|
|
3030
|
+
}
|
|
3031
|
+
return t;
|
|
3032
|
+
}
|
|
3033
|
+
function Po(e) {
|
|
3034
|
+
return e.entries.map((e) => ({
|
|
3035
|
+
animation: e.animation,
|
|
3036
|
+
name: Y(H(e.animation)),
|
|
3037
|
+
composition: "replace",
|
|
3038
|
+
weighted: !1,
|
|
3039
|
+
delay: e.at
|
|
3040
|
+
}));
|
|
3041
|
+
}
|
|
3042
|
+
function Fo(e) {
|
|
3043
|
+
return e.map((e, t) => {
|
|
3044
|
+
let n = "animation" in e ? e.animation : e;
|
|
3045
|
+
return {
|
|
3046
|
+
animation: n,
|
|
3047
|
+
name: Y(H(n) || `anim-${t}`),
|
|
3048
|
+
composition: "replace",
|
|
3049
|
+
weighted: !1,
|
|
3050
|
+
delay: 0
|
|
3051
|
+
};
|
|
3052
|
+
});
|
|
3053
|
+
}
|
|
3054
|
+
function Y(e) {
|
|
3055
|
+
let t = e.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
3056
|
+
return /^[a-zA-Z_]/.test(t) ? t : `a${t}`;
|
|
3057
|
+
}
|
|
3058
|
+
//#endregion
|
|
3059
|
+
//#region src/animation/compile/emit/easing-serialize.ts
|
|
3060
|
+
var Io = /^(linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end)$/, Lo = (e) => Math.round(e * 1e5) / 1e5;
|
|
3061
|
+
function Ro(e, t = 32) {
|
|
3062
|
+
let n = [];
|
|
3063
|
+
for (let r = 0; r <= t; r++) {
|
|
3064
|
+
let i = r / t;
|
|
3065
|
+
n.push(`${Lo(e(i))} ${Lo(i * 100)}%`);
|
|
3066
|
+
}
|
|
3067
|
+
return `linear(${n.join(", ")})`;
|
|
3068
|
+
}
|
|
3069
|
+
function X(t) {
|
|
3070
|
+
if (t.css !== void 0) return t.css;
|
|
3071
|
+
let n = Object.entries(se).find(([e, n]) => n === t.fn)?.[0];
|
|
3072
|
+
if (n === void 0) throw new e("timingFunction", t.fn, "a custom TimingFunction has no CSS animation-timing-function representation — attach a faithful Easing.css twin, or use a registry name / cubic-bezier() / linear() literal");
|
|
3073
|
+
let r = E(n);
|
|
3074
|
+
return Io.test(r) ? r : Ro(t.fn);
|
|
3075
|
+
}
|
|
3076
|
+
//#endregion
|
|
3077
|
+
//#region src/animation/compile/emit/format-options.ts
|
|
3078
|
+
function zo(e, t = "animation") {
|
|
3079
|
+
let n = "";
|
|
3080
|
+
n += ` animation-name: ${t};\n`;
|
|
3081
|
+
let r = k(e.duration);
|
|
3082
|
+
n += ` animation-duration: ${r};\n`, n += ` animation-timing-function: ${X(e.timingFunction)};\n`, n += ` animation-iteration-count: ${isFinite(e.iterationCount) ? e.iterationCount : "infinite"};\n`, n += ` animation-direction: ${e.direction};\n`, n += ` animation-fill-mode: ${e.fillMode};\n`, e.delay > 0 && (n += ` animation-delay: ${k(e.delay)};\n`);
|
|
3083
|
+
let i = e.composite == null ? void 0 : Vo(e.composite);
|
|
3084
|
+
return i != null && (n += ` ${i}\n`), n = `.${t} {\n${n}}\n`, n;
|
|
3085
|
+
}
|
|
3086
|
+
function Bo(e, t) {
|
|
3087
|
+
let n = {
|
|
3088
|
+
name: t,
|
|
3089
|
+
duration: e.duration,
|
|
3090
|
+
timingFunction: X(e.timingFunction),
|
|
3091
|
+
iterationCount: isFinite(e.iterationCount) ? e.iterationCount : Infinity,
|
|
3092
|
+
direction: e.direction,
|
|
3093
|
+
fillMode: e.fillMode
|
|
3094
|
+
};
|
|
3095
|
+
return e.delay > 0 && (n.delay = e.delay), Me(n);
|
|
3096
|
+
}
|
|
3097
|
+
function Vo(e) {
|
|
3098
|
+
return e === "replace" ? void 0 : `animation-composition: ${e};`;
|
|
3099
|
+
}
|
|
3100
|
+
function Ho(e) {
|
|
3101
|
+
let t = e.propertyRegistry;
|
|
3102
|
+
if (t == null || t.size === 0) return "";
|
|
3103
|
+
let n = [];
|
|
3104
|
+
for (let [e, r] of t) n.push(Ne({
|
|
3105
|
+
kind: "property",
|
|
3106
|
+
name: e,
|
|
3107
|
+
descriptor: r
|
|
3108
|
+
}));
|
|
3109
|
+
return n.join("\n");
|
|
3110
|
+
}
|
|
3111
|
+
//#endregion
|
|
3112
|
+
//#region src/animation/compile/emit/format.ts
|
|
3113
|
+
var Uo = 80, Wo = "@keyframes animation {\n", Go = "\n}";
|
|
3114
|
+
function Ko(e, t, n) {
|
|
3115
|
+
let r = e.parsedVars[t] ?? {}, i = e.templateFrames[t], a = Object.entries(T(r)).map(([e, t]) => ` ${E(e)}: ${t};`), o = i.timingFunction ? X(i.timingFunction) : n;
|
|
3116
|
+
o !== n && a.push(` animation-timing-function: ${o};`);
|
|
3117
|
+
let s = i.composition;
|
|
3118
|
+
return s != null && s !== "replace" && a.push(` animation-composition: ${s};`), `{\n${a.join("\n").trim()}\n}`;
|
|
3119
|
+
}
|
|
3120
|
+
var qo = async (e) => {
|
|
3121
|
+
let t = X(e.options.timingFunction), n = e.templateFrames.map(async (n, r) => {
|
|
3122
|
+
let i = Ko(e, r, t);
|
|
3123
|
+
return i = `${n.start}\n${i}\n`, i = Wo + i + Go, i = await D(i, Uo), i.replace(Wo, "").replace(Go, "");
|
|
3124
|
+
});
|
|
3125
|
+
return Promise.all(n);
|
|
3126
|
+
};
|
|
3127
|
+
function Jo(e) {
|
|
3128
|
+
let t = e.replace(/^[^{]*{/, "").replace(/^ /gm, "").replace(/}\s*$/, "");
|
|
3129
|
+
return t = t.trim(), t = t.replace(/^ /, ""), t;
|
|
3130
|
+
}
|
|
3131
|
+
function Yo(e, t, n) {
|
|
3132
|
+
return Ko(e, t, n);
|
|
3133
|
+
}
|
|
3134
|
+
function Xo(e, t, n) {
|
|
3135
|
+
let r = X(e.options.timingFunction), i = /* @__PURE__ */ new Map();
|
|
3136
|
+
e.templateFrames.forEach((t, a) => {
|
|
3137
|
+
let o = n?.get(a) ?? Ko(e, a, r), s = i.get(o);
|
|
3138
|
+
s ? s.push(t.start) : i.set(o, [t.start]);
|
|
3139
|
+
});
|
|
3140
|
+
let a = "";
|
|
3141
|
+
for (let [e, t] of i) a += `${t.join(", ")} ${e}\n`;
|
|
3142
|
+
return `@keyframes ${t} {\n${a}}`;
|
|
3143
|
+
}
|
|
3144
|
+
function Zo(e, t, n) {
|
|
3145
|
+
let r = X(e.options.timingFunction), i = /* @__PURE__ */ new Map();
|
|
3146
|
+
for (let t = 0; t < e.templateFrames.length; t++) {
|
|
3147
|
+
let a = e.templateFrames[t], o = e.parsedVars[t] ?? {}, s = {};
|
|
3148
|
+
for (let [e, t] of Object.entries(o)) {
|
|
3149
|
+
let r = t.clone();
|
|
3150
|
+
for (let t of r) if (typeof t.value == "number") t.value *= n;
|
|
3151
|
+
else if (t.unit === "color" || typeof t.value == "string") return {
|
|
3152
|
+
refused: !0,
|
|
3153
|
+
key: e
|
|
3154
|
+
};
|
|
3155
|
+
s[e] = r;
|
|
3156
|
+
}
|
|
3157
|
+
let c = Object.entries(T(s)).map(([e, t]) => ` ${E(e)}: ${t};`), l = a.timingFunction ? X(a.timingFunction) : r;
|
|
3158
|
+
l !== r && c.push(` animation-timing-function: ${l};`);
|
|
3159
|
+
let u = a.composition;
|
|
3160
|
+
u != null && u !== "replace" && c.push(` animation-composition: ${u};`);
|
|
3161
|
+
let d = `{\n${c.join("\n").trim()}\n}`, f = i.get(d);
|
|
3162
|
+
f ? f.push(a.start) : i.set(d, [a.start]);
|
|
3163
|
+
}
|
|
3164
|
+
let a = "";
|
|
3165
|
+
for (let [e, t] of i) a += `${t.join(", ")} ${e}\n`;
|
|
3166
|
+
return { block: `@keyframes ${t} {\n${a}}` };
|
|
3167
|
+
}
|
|
3168
|
+
async function Qo(e, t = "animation", n = void 0) {
|
|
3169
|
+
let r = e.options, i = /* @__PURE__ */ new Map(), a = X(r.timingFunction);
|
|
3170
|
+
e.templateFrames.forEach((t, n) => {
|
|
3171
|
+
let r = t.start, o = Ko(e, n, a);
|
|
3172
|
+
i.has(o) ? i.get(o).push(r) : i.set(o, [r]);
|
|
3173
|
+
});
|
|
3174
|
+
let o = "";
|
|
3175
|
+
for (let [e, t] of i) o += `${t.join(", ")} ${e}`;
|
|
3176
|
+
let s = zo(r, t), c = Ho(e);
|
|
3177
|
+
return (await D(`${c ? `${c}\n\n` : ""}${s}\n@keyframes ${t} {\n${o}}`, n)).replace(/\(\s*\{/g, "{").replace(/\}\s*\)/g, "}");
|
|
3178
|
+
}
|
|
3179
|
+
//#endregion
|
|
3180
|
+
//#region src/animation/compile/emit/densify.ts
|
|
3181
|
+
var $o = (e) => {
|
|
3182
|
+
let t = /([\d.]+)\s*%/.exec(String(e));
|
|
3183
|
+
return t ? parseFloat(t[1]) : 0;
|
|
3184
|
+
};
|
|
3185
|
+
function es(e, t, n, r) {
|
|
3186
|
+
let i = e.parsedVars[t] ?? {}, a = Object.fromEntries(Object.entries(i).filter(([e]) => !r.has(e))), o = Object.entries(T(a)).map(([e, t]) => `${E(e)}: ${t};`), s = e.templateFrames[t], c = s.timingFunction ? X(s.timingFunction) : n;
|
|
3187
|
+
c !== n && o.push(`animation-timing-function: ${c};`);
|
|
3188
|
+
let l = s.composition;
|
|
3189
|
+
return l != null && l !== "replace" && o.push(`animation-composition: ${l};`), o;
|
|
3190
|
+
}
|
|
3191
|
+
function ts(e, t, n) {
|
|
3192
|
+
let r = X(e.options.timingFunction), i = new Set(n.keys), a = /* @__PURE__ */ new Map(), o = [], s = (e) => {
|
|
3193
|
+
let t = a.get(e);
|
|
3194
|
+
return t || (t = [], a.set(e, t), o.push(e)), t;
|
|
3195
|
+
};
|
|
3196
|
+
for (let [e, t] of n.byPct) s(e).push(...t);
|
|
3197
|
+
e.templateFrames.forEach((t, n) => {
|
|
3198
|
+
let a = es(e, n, r, i);
|
|
3199
|
+
a.length > 0 && s($o(t.start)).push(...a);
|
|
3200
|
+
}), o.sort((e, t) => e - t);
|
|
3201
|
+
let c = "";
|
|
3202
|
+
for (let e of o) c += `${e}% {\n ${a.get(e).join("\n ")}\n}\n`;
|
|
3203
|
+
return `@keyframes ${t} {\n${c}}`;
|
|
3204
|
+
}
|
|
3205
|
+
//#endregion
|
|
3206
|
+
//#region src/animation/compile/emit/backward-color.ts
|
|
3207
|
+
var ns = b.oklab.a.number.min, rs = b.oklab.a.number.max, is = b.oklab.b.number.min, as = b.oklab.b.number.max, Z = (e) => Math.round(e * 1e4) / 1e4, os = (e) => typeof e == "object" && !!e && e.unit === "color", ss = (e) => re(e).value, Q = (e) => {
|
|
3208
|
+
let t = te(e, "oklab");
|
|
3209
|
+
return [
|
|
3210
|
+
t.l,
|
|
3211
|
+
y(t.a, 0, 1, ns, rs),
|
|
3212
|
+
y(t.b, 0, 1, is, as)
|
|
3213
|
+
];
|
|
3214
|
+
}, cs = (e) => {
|
|
3215
|
+
let [t, n, r] = Q(e);
|
|
3216
|
+
return `oklab(${Z(t)} ${Z(n)} ${Z(r)})`;
|
|
3217
|
+
}, ls = (e) => cs(ss(e)), us = (e, t) => {
|
|
3218
|
+
let [n, r, i] = Q(e), [a, o, s] = Q(t);
|
|
3219
|
+
return ne(n, r, i, a, o, s);
|
|
3220
|
+
}, ds = (e, t, n) => te({
|
|
3221
|
+
colorSpace: "oklab",
|
|
3222
|
+
l: e,
|
|
3223
|
+
a: y(t, ns, rs, 0, 1),
|
|
3224
|
+
b: y(n, is, as, 0, 1),
|
|
3225
|
+
alpha: 1
|
|
3226
|
+
}, "oklab"), fs = (e, t) => {
|
|
3227
|
+
let [n, r, i] = Q(e), [a, o, s] = Q(t);
|
|
3228
|
+
return ds((n + a) / 2, (r + o) / 2, (i + s) / 2);
|
|
3229
|
+
}, ps = (e) => {
|
|
3230
|
+
let t = /([\d.]+)\s*%/.exec(e.toString());
|
|
3231
|
+
return t ? parseFloat(t[1]) : 0;
|
|
3232
|
+
}, $ = (e, t, n) => {
|
|
3233
|
+
let r = (e.parsedVars[t] ?? {})[n];
|
|
3234
|
+
if (Array.isArray(r)) return r.find((e) => os(e));
|
|
3235
|
+
};
|
|
3236
|
+
function ms(e, t, n, r, i) {
|
|
3237
|
+
let a = t.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), o = [], s = 0;
|
|
3238
|
+
for (let a = 0; a + 1 < e.templateFrames.length; a++) {
|
|
3239
|
+
let c = $(e, a, t), l = $(e, a + 1, t);
|
|
3240
|
+
if (!c || !l) continue;
|
|
3241
|
+
let u = ps(e.templateFrames[a].start), d = ps(e.templateFrames[a + 1].start);
|
|
3242
|
+
if (c.toString() === l.toString()) {
|
|
3243
|
+
o.push({
|
|
3244
|
+
pct: u,
|
|
3245
|
+
css: c.toString()
|
|
3246
|
+
});
|
|
3247
|
+
continue;
|
|
3248
|
+
}
|
|
3249
|
+
let f = ss(c), p = ss(l), m = ie(f, p, n, {
|
|
3250
|
+
space: r,
|
|
3251
|
+
...i
|
|
3252
|
+
});
|
|
3253
|
+
for (let e = 0; e < m.length; e++) {
|
|
3254
|
+
let t = e / (m.length - 1), n = u + (d - u) * t;
|
|
3255
|
+
o.push({
|
|
3256
|
+
pct: Z(n),
|
|
3257
|
+
css: cs(m[e])
|
|
3258
|
+
});
|
|
3259
|
+
}
|
|
3260
|
+
let h = ie(f, p, 1024, {
|
|
3261
|
+
space: r,
|
|
3262
|
+
...i
|
|
3263
|
+
});
|
|
3264
|
+
for (let e = 0; e + 1 < m.length; e++) {
|
|
3265
|
+
let t = (e + .5) / (m.length - 1), n = h[Math.round(t * 1023)], r = fs(m[e], m[e + 1]);
|
|
3266
|
+
s = Math.max(s, us(r, n));
|
|
3267
|
+
}
|
|
3268
|
+
}
|
|
3269
|
+
let c = e.templateFrames.length - 1, l = $(e, c, t);
|
|
3270
|
+
if (l) {
|
|
3271
|
+
let t = ps(e.templateFrames[c].start);
|
|
3272
|
+
o[o.length - 1]?.pct !== t && o.push({
|
|
3273
|
+
pct: t,
|
|
3274
|
+
css: l.toString()
|
|
3275
|
+
});
|
|
3276
|
+
}
|
|
3277
|
+
return {
|
|
3278
|
+
cssProp: a,
|
|
3279
|
+
stops: o,
|
|
3280
|
+
worstDelta: s
|
|
3281
|
+
};
|
|
3282
|
+
}
|
|
3283
|
+
function hs(e, t, n) {
|
|
3284
|
+
let r = [], i = /* @__PURE__ */ new Set();
|
|
3285
|
+
for (let t = 0; t + 1 < e.templateFrames.length; t++) {
|
|
3286
|
+
let n = e.parsedVars[t] ?? {};
|
|
3287
|
+
for (let [a, o] of Object.entries(n)) {
|
|
3288
|
+
if (i.has(a) || !Array.isArray(o) || !o.some((e) => os(e))) continue;
|
|
3289
|
+
let n = $(e, t, a), s = $(e, t + 1, a);
|
|
3290
|
+
n && s && n.toString() !== s.toString() && (r.push(a), i.add(a));
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
if (r.length === 0) return null;
|
|
3294
|
+
let a = Math.max(3, t), o = e.options.colorSpace === "oklch" ? "oklch" : "oklab", s = e.options.hueMethod ? { hueMethod: e.options.hueMethod } : {}, c = 0, l = /* @__PURE__ */ new Map();
|
|
3295
|
+
for (let t of r) {
|
|
3296
|
+
let n = ms(e, t, a, o, s);
|
|
3297
|
+
c = Math.max(c, n.worstDelta);
|
|
3298
|
+
for (let { pct: e, css: t } of n.stops) {
|
|
3299
|
+
let r = l.get(e);
|
|
3300
|
+
r || (r = [], l.set(e, r)), r.push(`${n.cssProp}: ${t};`);
|
|
3301
|
+
}
|
|
3302
|
+
}
|
|
3303
|
+
return c > n ? {
|
|
3304
|
+
refused: !0,
|
|
3305
|
+
delta: c
|
|
3306
|
+
} : {
|
|
3307
|
+
byPct: l,
|
|
3308
|
+
keys: r
|
|
3309
|
+
};
|
|
3310
|
+
}
|
|
3311
|
+
//#endregion
|
|
3312
|
+
//#region src/animation/compile/emit/refusal-probes.ts
|
|
3313
|
+
function gs(e) {
|
|
3314
|
+
let { animation: t, name: n } = e;
|
|
3315
|
+
if (e.weighted) return {
|
|
3316
|
+
name: n,
|
|
3317
|
+
reason: "weighted-blend",
|
|
3318
|
+
message: "weighted layer blend has no animation-composition equivalent (CSS composites replace/add/accumulate only); the weighted axis is kf's unique blend tier — the JS playback is the only faithful path"
|
|
3319
|
+
};
|
|
3320
|
+
for (let e of t.frames) if (!t.usesDefaultRenderer(e.transform)) return {
|
|
3321
|
+
name: n,
|
|
3322
|
+
reason: "custom-renderer",
|
|
3323
|
+
message: "custom renderer (a transform closure, not the default DOM-style renderer) cannot be expressed as CSS — the JS playback is the only faithful path"
|
|
3324
|
+
};
|
|
3325
|
+
for (let e = 0; e < t.templateFrames.length; e++) {
|
|
3326
|
+
let r = t.parsedVars[e] ?? {};
|
|
3327
|
+
for (let [e, t] of Object.entries(r)) if (!Array.isArray(t) || t.length === 0) return {
|
|
3328
|
+
name: n,
|
|
3329
|
+
reason: "computed-unit-drift",
|
|
3330
|
+
message: `computed-unit drift on "${e}" — the declared value cannot be re-emitted as a faithful authored string; the JS playback is the only faithful path`
|
|
3331
|
+
};
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
function _s(e, t, n) {
|
|
3335
|
+
let { animation: r, name: i } = e, a = gs(e);
|
|
3336
|
+
if (a) return n.push(a), null;
|
|
3337
|
+
let o = hs(r, t.densifyStops ?? 16, t.deltaEEpsilon ?? .04);
|
|
3338
|
+
if (o && "refused" in o) return n.push({
|
|
3339
|
+
name: i,
|
|
3340
|
+
reason: "perceptual-oklab",
|
|
3341
|
+
message: `perceptual oklab color track exceeds the densify ΔE-ε threshold (ΔE ${Z(o.delta)} > ${t.deltaEEpsilon ?? .04}) — a faithful pure-CSS twin is not available; the JS playback is the only faithful path`
|
|
3342
|
+
}), null;
|
|
3343
|
+
let s;
|
|
3344
|
+
if (e.staticWeight != null) {
|
|
3345
|
+
let t = Zo(r, i, e.staticWeight);
|
|
3346
|
+
if ("refused" in t) return n.push({
|
|
3347
|
+
name: i,
|
|
3348
|
+
reason: "weighted-blend",
|
|
3349
|
+
message: `static-weight pre-multiply cannot scale the non-numeric leaf "${t.key}" (a color/string has no scalar weight) — the weighted blend is kf's unique tier; the JS playback is the only faithful path`
|
|
3350
|
+
}), null;
|
|
3351
|
+
s = t.block;
|
|
3352
|
+
}
|
|
3353
|
+
let c = s ?? (o && "byPct" in o ? ts(r, i, o) : Xo(r, i)), l;
|
|
3354
|
+
try {
|
|
3355
|
+
l = Bo(r.options, i);
|
|
3356
|
+
} catch {
|
|
3357
|
+
return n.push({
|
|
3358
|
+
name: i,
|
|
3359
|
+
reason: "custom-renderer",
|
|
3360
|
+
message: "easing has no faithful CSS timing-function twin (a custom closure cannot be CSS) — attach an Easing.css twin or use a registry name / cubic-bezier() / linear(); the JS playback is the only faithful path"
|
|
3361
|
+
}), null;
|
|
3362
|
+
}
|
|
3363
|
+
let u = Vo(e.composition), d = u ? `\n ${u}` : "", f = e.delay > 0 ? `\n animation-delay: ${k(e.delay)};` : "", p = vs(r);
|
|
3364
|
+
return `${c}\n\n${`${t.selectorFor ? t.selectorFor(i) : `.${i}`} {\n animation: ${l};${d}${f}${p}\n}`}`;
|
|
3365
|
+
}
|
|
3366
|
+
function vs(e) {
|
|
3367
|
+
let t = e.scrollOptions;
|
|
3368
|
+
if (t == null) return "";
|
|
3369
|
+
let n = jo(t), r = "";
|
|
3370
|
+
for (let [e, t] of Object.entries(n)) t != null && (r += `\n ${e}: ${t};`);
|
|
3371
|
+
return r;
|
|
3372
|
+
}
|
|
3373
|
+
async function ys(e, t = {}) {
|
|
3374
|
+
let n = e instanceof oi ? No(e) : e instanceof d ? Po(e) : Fo(e), r = /* @__PURE__ */ new Map();
|
|
3375
|
+
for (let e of n) {
|
|
3376
|
+
let t = r.get(e.name) ?? 0;
|
|
3377
|
+
r.set(e.name, t + 1), t > 0 && (e.name = `${e.name}-${t + 1}`);
|
|
3378
|
+
}
|
|
3379
|
+
t.staggerDelays && n.forEach((e, n) => {
|
|
3380
|
+
let r = t.staggerDelays[n];
|
|
3381
|
+
typeof r == "number" && r > 0 && (e.delay += r);
|
|
3382
|
+
});
|
|
3383
|
+
let i = [], a = [];
|
|
3384
|
+
for (let e of n) {
|
|
3385
|
+
let n = _s(e, t, i);
|
|
3386
|
+
n && a.push(n);
|
|
3387
|
+
}
|
|
3388
|
+
let o = i.length === 0;
|
|
3389
|
+
if (a.length === 0) return {
|
|
3390
|
+
css: "",
|
|
3391
|
+
eligible: o,
|
|
3392
|
+
refusals: i
|
|
3393
|
+
};
|
|
3394
|
+
let s = a.join("\n\n"), c;
|
|
3395
|
+
try {
|
|
3396
|
+
c = await D(s, t.printWidth);
|
|
3397
|
+
} catch {
|
|
3398
|
+
c = s;
|
|
3399
|
+
}
|
|
3400
|
+
return {
|
|
3401
|
+
css: c,
|
|
3402
|
+
eligible: o,
|
|
3403
|
+
refusals: i
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
//#endregion
|
|
3407
|
+
//#region src/animation/compile/emit/view-transition.ts
|
|
3408
|
+
var bs = new Set([
|
|
3409
|
+
"transform",
|
|
3410
|
+
"opacity",
|
|
3411
|
+
"filter",
|
|
3412
|
+
"backdrop-filter",
|
|
3413
|
+
"mix-blend-mode",
|
|
3414
|
+
"clip-path"
|
|
3415
|
+
]), xs = /\b-?\d*\.?\d+cq(w|h|i|b|min|max)\b/i;
|
|
3416
|
+
function Ss(e) {
|
|
3417
|
+
let t = X(e.options.timingFunction), n = [];
|
|
3418
|
+
for (let r = 0; r < e.templateFrames.length; r++) {
|
|
3419
|
+
let i = Yo(e, r, t);
|
|
3420
|
+
for (let e of i.matchAll(/([\w-]+)\s*:\s*([^;]+);/g)) n.push({
|
|
3421
|
+
prop: e[1].trim(),
|
|
3422
|
+
value: e[2].trim()
|
|
3423
|
+
});
|
|
3424
|
+
}
|
|
3425
|
+
return n;
|
|
3426
|
+
}
|
|
3427
|
+
var Cs = (e) => e.split(".")[0].replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3428
|
+
function ws(e, t, n, r, i, a) {
|
|
3429
|
+
let o = [], s = `${t}-${e}`;
|
|
3430
|
+
if (r.scrollOptions != null) return o.push({
|
|
3431
|
+
name: s,
|
|
3432
|
+
reason: "vt-scroll-grammar",
|
|
3433
|
+
message: `scroll grammar on the ${e} role has no defined behavior on a time-driven ::view-transition pseudo (animation-timeline is undefined there) — the JS ScrollScene driver is the only faithful path`
|
|
3434
|
+
}), {
|
|
3435
|
+
chunk: null,
|
|
3436
|
+
refusals: o
|
|
3437
|
+
};
|
|
3438
|
+
for (let { prop: t, value: n } of Ss(r)) {
|
|
3439
|
+
if (xs.test(n) || /\bvar\(/.test(n)) return o.push({
|
|
3440
|
+
name: s,
|
|
3441
|
+
reason: "vt-element-scoped-computed",
|
|
3442
|
+
message: `"${t}" is element-scoped (${xs.test(n) ? "a container-query unit" : "a var()"}) — the ::view-transition pseudo tree hangs off the ROOT, so an element-scoped custom property / container context does not reach it`
|
|
3443
|
+
}), {
|
|
3444
|
+
chunk: null,
|
|
3445
|
+
refusals: o
|
|
3446
|
+
};
|
|
3447
|
+
if (!bs.has(Cs(t))) return o.push({
|
|
3448
|
+
name: s,
|
|
3449
|
+
reason: "vt-snapshot-inapplicable",
|
|
3450
|
+
message: `"${t}" does not apply to a replaced-content ::view-transition-${e} snapshot (only transform/opacity/filter/mix-blend-mode animate there) — refused per property, never silently dropped`
|
|
3451
|
+
}), {
|
|
3452
|
+
chunk: null,
|
|
3453
|
+
refusals: o
|
|
3454
|
+
};
|
|
3455
|
+
}
|
|
3456
|
+
let c = `${i}::view-transition-${e}(${n})`, l = {
|
|
3457
|
+
animation: r,
|
|
3458
|
+
name: s,
|
|
3459
|
+
composition: "replace",
|
|
3460
|
+
weighted: !1,
|
|
3461
|
+
delay: 0
|
|
3462
|
+
}, u = [], d = _s(l, {
|
|
3463
|
+
...a.densifyStops == null ? {} : { densifyStops: a.densifyStops },
|
|
3464
|
+
...a.deltaEEpsilon == null ? {} : { deltaEEpsilon: a.deltaEEpsilon },
|
|
3465
|
+
selectorFor: () => c
|
|
3466
|
+
}, u);
|
|
3467
|
+
for (let e of u) o.push(e);
|
|
3468
|
+
return {
|
|
3469
|
+
chunk: d,
|
|
3470
|
+
refusals: o
|
|
3471
|
+
};
|
|
3472
|
+
}
|
|
3473
|
+
function Ts(e) {
|
|
3474
|
+
let t = e.group;
|
|
3475
|
+
if (t != null) return "options" in t && "templateFrames" in t ? {
|
|
3476
|
+
duration: t.options.duration,
|
|
3477
|
+
easing: X(t.options.timingFunction)
|
|
3478
|
+
} : {
|
|
3479
|
+
duration: t.duration,
|
|
3480
|
+
easing: X(t.timingFunction)
|
|
3481
|
+
};
|
|
3482
|
+
let n = e.new ?? e.old;
|
|
3483
|
+
return n == null ? null : {
|
|
3484
|
+
duration: n.options.duration,
|
|
3485
|
+
easing: X(n.options.timingFunction)
|
|
3486
|
+
};
|
|
3487
|
+
}
|
|
3488
|
+
async function Es(e, t = {}) {
|
|
3489
|
+
let n = [], r = [], i = [], a = t.types, o = a && a.length > 0 ? `:root:active-view-transition-type(${a.join(", ")})` : "", s = t.emitGroup ?? !0, c = /* @__PURE__ */ new Map();
|
|
3490
|
+
for (let t of Object.keys(e)) {
|
|
3491
|
+
let e = Y(t), n = c.get(e);
|
|
3492
|
+
n ? n.push(t) : c.set(e, [t]);
|
|
3493
|
+
}
|
|
3494
|
+
let l = /* @__PURE__ */ new Set();
|
|
3495
|
+
for (let [e, t] of c) if (t.length > 1) for (let r of t) l.add(r), n.push({
|
|
3496
|
+
name: r,
|
|
3497
|
+
reason: "vt-name-collision",
|
|
3498
|
+
message: `"${r}" collapses to the CSS ident "${e}" already used by ${t.filter((e) => e !== r).map((e) => `"${e}"`).join(", ")} — the ≤1-element-per-view-transition-name platform rule is violated; a REFUSAL, not a silent rename (rename the colliding key)`
|
|
3499
|
+
});
|
|
3500
|
+
for (let [a, c] of Object.entries(e)) {
|
|
3501
|
+
if (l.has(a)) continue;
|
|
3502
|
+
let e = Y(a), u = c.class ? `.${Y(c.class)}` : e;
|
|
3503
|
+
i.push(e);
|
|
3504
|
+
for (let i of ["old", "new"]) {
|
|
3505
|
+
let a = c[i];
|
|
3506
|
+
if (a == null) continue;
|
|
3507
|
+
let { chunk: s, refusals: l } = ws(i, e, u, a, o, t);
|
|
3508
|
+
for (let e of l) n.push(e);
|
|
3509
|
+
s && r.push(s);
|
|
3510
|
+
}
|
|
3511
|
+
if (s && (c.old != null || c.new != null || c.group != null)) {
|
|
3512
|
+
let e = Ts(c);
|
|
3513
|
+
e != null && r.push(`${o}::view-transition-group(${u}) {\n animation-duration: ${k(e.duration)};\n animation-timing-function: ${e.easing};\n}`);
|
|
3514
|
+
}
|
|
3515
|
+
}
|
|
3516
|
+
t.crossDocument && r.unshift("@view-transition {\n navigation: auto;\n}"), (t.reducedMotion ?? !0) && r.push("@media (prefers-reduced-motion: reduce) {\n ::view-transition-group(*),\n ::view-transition-old(*),\n ::view-transition-new(*) {\n animation: none !important;\n }\n}");
|
|
3517
|
+
let u = n.length === 0;
|
|
3518
|
+
if (r.length === 0) return {
|
|
3519
|
+
css: "",
|
|
3520
|
+
eligible: u,
|
|
3521
|
+
refusals: n,
|
|
3522
|
+
names: i
|
|
3523
|
+
};
|
|
3524
|
+
let d = r.join("\n\n"), f;
|
|
3525
|
+
try {
|
|
3526
|
+
f = await D(d, t.printWidth);
|
|
3527
|
+
} catch {
|
|
3528
|
+
f = d;
|
|
3529
|
+
}
|
|
3530
|
+
return {
|
|
3531
|
+
css: f,
|
|
3532
|
+
eligible: u,
|
|
3533
|
+
refusals: n,
|
|
3534
|
+
names: i
|
|
3535
|
+
};
|
|
3536
|
+
}
|
|
3537
|
+
//#endregion
|
|
3538
|
+
//#region src/animation/compile/emit/entry.ts
|
|
3539
|
+
function Ds(e, t) {
|
|
3540
|
+
let n = e.parsedVars[t] ?? {}, r = /* @__PURE__ */ new Map();
|
|
3541
|
+
for (let [e, t] of Object.entries(n)) if (Array.isArray(t)) {
|
|
3542
|
+
let n = t.find(os);
|
|
3543
|
+
n && r.set(E(e.split(".")[0]), n);
|
|
3544
|
+
}
|
|
3545
|
+
let i = [];
|
|
3546
|
+
for (let [e, t] of Object.entries(T(n))) {
|
|
3547
|
+
let n = E(e), a = r.get(n);
|
|
3548
|
+
i.push({
|
|
3549
|
+
prop: n,
|
|
3550
|
+
value: a ? ls(a) : String(t)
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
return i;
|
|
3554
|
+
}
|
|
3555
|
+
function Os(e) {
|
|
3556
|
+
let t = e.templateFrames.length;
|
|
3557
|
+
return e.options.direction === "reverse" ? [t - 1, 0] : [0, t - 1];
|
|
3558
|
+
}
|
|
3559
|
+
function ks(e) {
|
|
3560
|
+
for (let t = 0; t < e.templateFrames.length; t++) {
|
|
3561
|
+
let n = e.parsedVars[t] ?? {};
|
|
3562
|
+
for (let e of Object.values(n)) if (Array.isArray(e) && e.some(os)) return !0;
|
|
3563
|
+
}
|
|
3564
|
+
return !1;
|
|
3565
|
+
}
|
|
3566
|
+
function As(e) {
|
|
3567
|
+
for (let t = 0; t < e.templateFrames.length; t++) {
|
|
3568
|
+
let n = e.parsedVars[t] ?? {};
|
|
3569
|
+
for (let [e, t] of Object.entries(n)) if (!Array.isArray(t) || t.length === 0) return e;
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
function js(e) {
|
|
3573
|
+
let t = e.options;
|
|
3574
|
+
if (e.templateFrames.length > 2) return {
|
|
3575
|
+
reason: "entry-multi-keyframe",
|
|
3576
|
+
detail: `${e.templateFrames.length} declared stops — a transition is a two-endpoint grammar; intermediate stops have no CSS twin`
|
|
3577
|
+
};
|
|
3578
|
+
if (t.iterationCount !== 1 || t.direction === "alternate" || t.direction === "alternate-reverse") return {
|
|
3579
|
+
reason: "entry-iteration",
|
|
3580
|
+
detail: `iterationCount=${t.iterationCount}, direction=${t.direction} — transitions run once, forward (reverse is an endpoint swap, not a refusal)`
|
|
3581
|
+
};
|
|
3582
|
+
let n = t.composite, r = e.templateFrames.some((e) => e.composition != null && e.composition !== "replace");
|
|
3583
|
+
if (n != null && n !== "replace" || r) return {
|
|
3584
|
+
reason: "entry-composition",
|
|
3585
|
+
detail: "add/accumulate composition has no transition twin (transitions always replace) — never silently flattened"
|
|
3586
|
+
};
|
|
3587
|
+
if (e.scrollOptions != null) return {
|
|
3588
|
+
reason: "entry-scroll-grammar",
|
|
3589
|
+
detail: "scroll grammar has no transition twin — the JS ScrollScene driver is the only faithful path"
|
|
3590
|
+
};
|
|
3591
|
+
if ((t.colorSpace === "oklch" || t.hueMethod != null) && ks(e)) return {
|
|
3592
|
+
reason: "entry-color-space",
|
|
3593
|
+
detail: `colorSpace=${t.colorSpace}${t.hueMethod ? `, hueMethod=${t.hueMethod}` : ""} — transitions expose no interpolation-space control; native Oklab is the default feature (only non-default spaces refuse)`
|
|
3594
|
+
};
|
|
3595
|
+
let i = As(e);
|
|
3596
|
+
if (i != null) return {
|
|
3597
|
+
reason: "computed-unit-drift",
|
|
3598
|
+
detail: `"${i}" has an empty declared value — it cannot be re-emitted as a faithful transition endpoint`
|
|
3599
|
+
};
|
|
3600
|
+
for (let t of e.frames) if (!e.usesDefaultRenderer(t.transform)) return {
|
|
3601
|
+
reason: "custom-renderer",
|
|
3602
|
+
detail: "a custom transform closure cannot be a CSS transition endpoint"
|
|
3603
|
+
};
|
|
3604
|
+
try {
|
|
3605
|
+
X(t.timingFunction);
|
|
3606
|
+
} catch {
|
|
3607
|
+
return {
|
|
3608
|
+
reason: "entry-easing-twin",
|
|
3609
|
+
detail: "the easing has no faithful CSS timing-function twin (attach an Easing.css twin or use a registry name / cubic-bezier() / linear())"
|
|
3610
|
+
};
|
|
3611
|
+
}
|
|
3612
|
+
}
|
|
3613
|
+
var Ms = {
|
|
3614
|
+
"custom-renderer": "custom renderer — the JS playback is the only faithful path",
|
|
3615
|
+
"weighted-blend": "weighted layer blend has no transition twin",
|
|
3616
|
+
"computed-unit-drift": "computed-unit drift — the endpoint cannot be re-emitted faithfully",
|
|
3617
|
+
"entry-multi-keyframe": "more than two declared stops — a transition is a two-endpoint grammar",
|
|
3618
|
+
"entry-iteration": "iteration/alternate-direction — transitions run once, forward",
|
|
3619
|
+
"entry-composition": "add/accumulate composition has no transition twin",
|
|
3620
|
+
"entry-scroll-grammar": "scroll grammar has no transition twin",
|
|
3621
|
+
"entry-color-space": "a non-default color space (oklch/hueMethod) — transitions expose no space control",
|
|
3622
|
+
"entry-easing-twin": "the easing has no faithful CSS timing-function twin"
|
|
3623
|
+
};
|
|
3624
|
+
function Ns(e, t) {
|
|
3625
|
+
let n = /* @__PURE__ */ new Set();
|
|
3626
|
+
for (let t of e) n.add(t.prop);
|
|
3627
|
+
for (let e of t) n.add(e.prop);
|
|
3628
|
+
return [...n];
|
|
3629
|
+
}
|
|
3630
|
+
function Ps(e, t, n, r) {
|
|
3631
|
+
let i = e.filter((e) => e !== "display" && e !== "overlay").map((e) => `${e} ${t} ${n}`);
|
|
3632
|
+
return i.push(`display ${t} allow-discrete`), r && i.push(`overlay ${t} allow-discrete`), i.join(", ");
|
|
3633
|
+
}
|
|
3634
|
+
var Fs = (e, t) => [...e.map((e) => ` ${e.prop}: ${e.value};`), ...t].join("\n");
|
|
3635
|
+
async function Is(e, t = {}) {
|
|
3636
|
+
let n = t.openSelector ?? ".open", r = t.display ?? "block", i = t.overlay ?? !0, a = [], o = [];
|
|
3637
|
+
for (let [t, s] of Object.entries(e)) {
|
|
3638
|
+
let e = s.enter;
|
|
3639
|
+
if (e == null) continue;
|
|
3640
|
+
let c = s.exit ? [e, s.exit] : [e], l = !1;
|
|
3641
|
+
for (let e of c) {
|
|
3642
|
+
let n = js(e);
|
|
3643
|
+
if (n) {
|
|
3644
|
+
a.push({
|
|
3645
|
+
name: t,
|
|
3646
|
+
reason: n.reason,
|
|
3647
|
+
message: `${Ms[n.reason]} — ${n.detail}`
|
|
3648
|
+
}), l = !0;
|
|
3649
|
+
break;
|
|
3650
|
+
}
|
|
3651
|
+
}
|
|
3652
|
+
if (l) continue;
|
|
3653
|
+
let [u, d] = Os(e), f = Ds(e, u), p = Ds(e, d), m = Ns(f, p), h = k(e.options.duration), g = X(e.options.timingFunction), _, v, ee, y;
|
|
3654
|
+
if (s.exit) {
|
|
3655
|
+
let [, e] = Os(s.exit), t = Os(s.exit)[0];
|
|
3656
|
+
_ = Ds(s.exit, e), v = Ns(Ds(s.exit, t), _), ee = k(s.exit.options.duration), y = X(s.exit.options.timingFunction);
|
|
3657
|
+
} else _ = f, v = m, ee = h, y = g;
|
|
3658
|
+
let b = `${t}${n}`, te = `${t} {\n${Fs(_, [" display: none;", ` transition: ${Ps(v, ee, y, i)};`])}\n}`, ne = `${b} {\n${Fs(p, [` display: ${r};`, ` transition: ${Ps(m, h, g, i)};`])}\n}`, re = `@starting-style {\n ${b} {\n${Fs(f, []).split("\n").map((e) => ` ${e}`).join("\n")}\n }\n}`;
|
|
3659
|
+
o.push(`${te}\n\n${ne}\n\n${re}`);
|
|
3660
|
+
}
|
|
3661
|
+
let s = a.length === 0;
|
|
3662
|
+
if (o.length === 0) return {
|
|
3663
|
+
css: "",
|
|
3664
|
+
eligible: s,
|
|
3665
|
+
refusals: a
|
|
3666
|
+
};
|
|
3667
|
+
let c = o.join("\n\n"), l;
|
|
3668
|
+
try {
|
|
3669
|
+
l = await D(c, t.printWidth);
|
|
3670
|
+
} catch {
|
|
3671
|
+
l = c;
|
|
3672
|
+
}
|
|
3673
|
+
return {
|
|
3674
|
+
css: l,
|
|
3675
|
+
eligible: s,
|
|
3676
|
+
refusals: a
|
|
3677
|
+
};
|
|
3678
|
+
}
|
|
3679
|
+
//#endregion
|
|
3680
|
+
//#region src/animation/validate.ts
|
|
3681
|
+
var Ls = (e) => new U().fromString(e);
|
|
3682
|
+
async function Rs(e, t = {}) {
|
|
3683
|
+
let n = Ls(e), r = [...n.diagnostics], i = r.some((e) => e.code === "EMPTY_PARSE"), a = e.trim().length > 0 && !i, o = await ys([n], t.compile ?? {}), s = F(n);
|
|
3684
|
+
return {
|
|
3685
|
+
parseable: a,
|
|
3686
|
+
eligible: o.eligible,
|
|
3687
|
+
refusals: o.refusals,
|
|
3688
|
+
diagnostics: r,
|
|
3689
|
+
waapi: s
|
|
3690
|
+
};
|
|
3691
|
+
}
|
|
3692
|
+
var zs = (e) => {
|
|
3693
|
+
try {
|
|
3694
|
+
return [...Ce(O(e)).keys()];
|
|
3695
|
+
} catch {
|
|
3696
|
+
return [];
|
|
3697
|
+
}
|
|
3698
|
+
};
|
|
3699
|
+
async function Bs(e, t = {}) {
|
|
3700
|
+
let n = await Rs(e, t), r = zs(e), i = r.length > 0 ? r.join(", ") : "(no @keyframes block)", a = [];
|
|
3701
|
+
a.push(`@keyframes ${i}:`), a.push(` parseable: ${n.parseable ? "yes" : "no"}`), a.push(` compile-eligible: ${n.eligible ? "yes" : "no"}`);
|
|
3702
|
+
for (let e of n.refusals) a.push(` – ${e.reason}: ${e.message}`);
|
|
3703
|
+
if (a.push(` waapi-eligible: ${n.waapi.eligible ? "yes" : "no"}`), n.waapi.eligible || a.push(` – ${n.waapi.reason}`), n.diagnostics.length > 0) {
|
|
3704
|
+
a.push(" diagnostics:");
|
|
3705
|
+
for (let e of n.diagnostics) a.push(` – ${e.code}: ${e.message}`);
|
|
3706
|
+
}
|
|
3707
|
+
return a.join("\n");
|
|
3708
|
+
}
|
|
3709
|
+
//#endregion
|
|
3710
|
+
export { oi as AnimationGroup, U as CSSKeyframesAnimation, Qo as CSSKeyframesToString, qo as CSSKeyframesToStrings, Re as DIRECTIONS, pi as DrawSVG, ze as FILL_MODES, dr as KeyframesAnimation, Si as MorphSVG, ui as MotionPath, _o as ScrollScene, So as TriggerScene, uo as adoptRunning, ys as compileToCSS, Is as compileToEntry, Es as compileToViewTransition, vo as createScrollScene, Co as createTriggerScene, He as defaultLayerConfig, j as defaultOptions, yo as dispatchScrollBackend, Do as driveScrollCSS, Bs as explain, Jo as formatCSSKeyframeString, fi as fromDrawSVG, co as fromLiveAnimations, xi as fromMorphSVG, li as fromMotionPath, so as fromStyleSheets, H as getAnimationId, g as getTimingFunction, Ao as parseScrollCSS, ko as parseScrollRange, Oo as parseScrollTimeline, bo as pinCSS, $a as presets, hr as resolveKeyframes, oo as resolveLiveKeyframes, go as resolveRange, Mo as roundTripScrollCSS, jo as serializeScrollOptions, xo as supportsNativeTrigger, Ze as transformTargetsStyle, Rs as validate, Or as yieldToMain };
|