@mkbabb/keyframes.js 2.1.1 → 2.2.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/dist/keyframes.js CHANGED
@@ -1,342 +1,36 @@
1
- import { COMPUTED_UNITS as e, CSSCubicBezier as t, CSSFunction as n, CSSValues as r, FunctionValue as i, ValueArray as a, ValueUnit as o, cancelAnimationFrame as s, clamp as c, convertToMs as l, easeInOutCubic as u, extractAnimationOptions as d, extractKeyframes as f, extractProperties as p, flattenObject as m, isObject as ee, lerp as h, lerpValue as te, normalizeValueUnits as g, parseCSSStylesheet as _, parseCSSTime as v, parseCSSValueUnit as ne, prepareInterpVar as re, requestAnimationFrame as y, scale as b, seekPreviousValue as x, sleep as ie, timingFunctions as S, tryParse as ae, unflattenObject as oe, unflattenObjectToString as C } from "@mkbabb/value.js";
2
- import { any as se } from "@mkbabb/parse-that";
3
- //#region src/animation/internal/binarySearch.ts
4
- function w(e, t, n, r) {
5
- let i = 0, a = e.length - 1;
6
- for (; i <= a;) {
7
- let o = i + a >> 1, s = e[o];
8
- if (t < n(s)) a = o - 1;
9
- else if (t > r(s)) i = o + 1;
10
- else return o;
11
- }
12
- return -1;
13
- }
14
- //#endregion
15
- //#region src/animation/adapter.ts
16
- var ce = (e) => {
17
- let t = {};
18
- for (let n of e.declarations) t[n.name] = n.value;
19
- return t;
20
- }, T = (e) => {
21
- let t = [];
22
- for (let n of e.selectors) n.kind === "percent" ? t.push(`${n.value}%`) : t.push(n.name);
23
- return t;
24
- }, E = (e) => {
25
- let t = f(e);
26
- for (let e of t.values()) if (e.length > 0) return e;
27
- return [];
28
- }, D = (e) => {
29
- let t = e.trim();
30
- return /@keyframes\b/i.test(t) || t.length === 0 ? e : `@keyframes anonymous {\n${t}\n}`;
31
- }, O = (e) => {
32
- let t = typeof e == "string" ? _(D(e)) : e, n = E(t), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
33
- for (let e of n) {
34
- let t = ce(e);
35
- for (let n of T(e)) {
36
- let a = r.get(n);
37
- r.set(n, {
38
- ...a ?? {},
39
- ...t
40
- }), e.timingFunction != null && i.set(n, e.timingFunction);
41
- }
42
- }
43
- return {
44
- keyframes: r,
45
- timingFunctions: i,
46
- properties: p(t),
47
- options: d(t)
48
- };
49
- }, le = [
50
- "normal",
51
- "reverse",
52
- "alternate",
53
- "alternate-reverse"
54
- ], ue = [
55
- "none",
56
- "forwards",
57
- "backwards",
58
- "both"
59
- ], k = {
60
- duration: 1e3,
61
- delay: 0,
62
- iterationCount: 1,
63
- direction: "normal",
64
- fillMode: "forwards",
65
- timingFunction: u,
66
- useWAAPI: !0,
67
- colorSpace: "oklab"
68
- }, A = {
69
- zIndex: 0,
70
- weight: 1,
71
- blendMode: "replace",
72
- enabled: !0
73
- }, j = (e) => typeof e != "object" || !e ? !1 : "value" in e && typeof e.value == "number", M = class {
74
- animations = {};
75
- transform;
76
- superKey;
77
- paused = !1;
78
- started = !1;
79
- done = !1;
80
- singleTarget = !0;
81
- lastTickTime = 0;
82
- handleId = void 0;
83
- resolvePromise = null;
84
- _boundDraw;
85
- _entries = [];
86
- _entriesDirty = !0;
87
- constructor(...e) {
88
- this._boundDraw = this.draw.bind(this);
89
- let t = [];
90
- for (let n of e) {
91
- let e, r;
92
- n instanceof $ ? e = n : (e = n.animation, r = n.layer), this.transform == null && e.frames[0] != null && (this.transform = e.frames[0].transform);
93
- let i = Q(e);
94
- this.animations[i] = {
95
- values: {},
96
- animation: e,
97
- layer: {
98
- ...A,
99
- ...r
100
- }
101
- }, e.managed = !0, t.push(e);
102
- }
103
- this.singleTarget = t.every((e) => e.targets[0] === t[0]?.targets[0]), this.invalidateEntries();
104
- }
105
- getEntries() {
106
- return this._entriesDirty &&= (this._entries = Object.values(this.animations), this._entries.sort((e, t) => e.layer.zIndex - t.layer.zIndex), !1), this._entries;
107
- }
108
- invalidateEntries() {
109
- this._entriesDirty = !0;
110
- }
111
- setSuperKey(e) {
112
- this.superKey = e;
113
- for (let t of this.getEntries()) t.animation.superKey = e;
114
- return this;
115
- }
116
- setTargets(...e) {
117
- let t = this.getEntries();
118
- for (let n of t) n.animation.setTargets(...e);
119
- return this.singleTarget = t.every((e) => e.animation.targets[0] === t[0]?.animation.targets[0]), this;
120
- }
121
- onStart() {
122
- return this.started = !0, this;
123
- }
124
- onEnd() {
125
- return this;
126
- }
127
- transformFramesGrouped(e) {
128
- let t = {}, n = this.getEntries(), r = !0;
129
- for (let e of n) {
130
- let { animation: n, layer: i, values: a } = e;
131
- if (r &&= n.done, !i.enabled) continue;
132
- n.interpFrames(n.t, !1, a);
133
- let o = i.properties ? Object.fromEntries(Object.entries(a).filter(([e]) => i.properties.has(e))) : a;
134
- switch (i.blendMode) {
135
- case "replace":
136
- Object.assign(t, o);
137
- break;
138
- case "add":
139
- for (let [e, n] of Object.entries(o)) if (e in t) {
140
- let r = t[e], i = n;
141
- j(r) && j(i) ? r.value += i.value : t[e] = n;
142
- } else t[e] = n;
143
- break;
144
- case "weighted":
145
- for (let [e, n] of Object.entries(o)) if (e in t) {
146
- let r = t[e], a = n;
147
- j(r) && j(a) ? r.value = h(r.value, a.value, i.weight) : t[e] = n;
148
- } else t[e] = n;
149
- break;
150
- }
151
- }
152
- return this.done = r, this.transform(t, e), t;
153
- }
154
- render() {
155
- let e = this.lastTickTime || performance.now();
156
- if (this.singleTarget) this.transformFramesGrouped(e);
157
- else for (let e of this.getEntries()) e.animation.interpFrames(e.animation.t, !0);
158
- }
159
- setChildTime(e, t) {
160
- let n = typeof e == "string" ? e : Q(e), r = this.animations[n];
161
- if (!r) throw Error(`AnimationGroup.setChildTime: no animation registered for key "${n}". Known keys: ${Object.keys(this.animations).join(", ") || "(none)"}.`);
162
- let i = r.animation;
163
- return i.t = t, i.startTime !== void 0 && (i.pausedTime = i.startTime + t), this;
164
- }
165
- async tick(e) {
166
- this.lastTickTime = e, this.started || this.onStart();
167
- let t = [];
168
- for (let n of this.getEntries()) {
169
- let r = n.animation;
170
- (!r.paused || r.pausedTime === 0) && t.push(r.tick(e));
171
- }
172
- return await Promise.all(t), this.done && this.onEnd(), this;
173
- }
174
- async draw(e) {
175
- if (await this.tick(e), !this.paused) {
176
- if (this.singleTarget) this.transformFramesGrouped(e);
177
- else {
178
- let e = !0;
179
- for (let t of this.getEntries()) t.animation.interpFrames(t.animation.t, !0), e &&= t.animation.done;
180
- this.done = e;
181
- }
182
- this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = y(this._boundDraw);
183
- }
184
- }
185
- async play() {
186
- return new Promise((e) => {
187
- this.resolvePromise = e, this.handleId = y(this._boundDraw);
188
- });
189
- }
190
- pause() {
191
- if (!this.started) return this;
192
- this.paused = !this.paused;
193
- let e = this.lastTickTime || performance.now();
194
- for (let t of this.getEntries()) {
195
- let n = t.animation;
196
- this.paused ? (n.pause(!1), n.pausedTime === 0 && (n.pausedTime = e)) : n.paused = !1;
197
- }
198
- return this.paused ? (s(this.handleId), this.handleId = void 0, this.render()) : this.handleId = y(this._boundDraw), this;
199
- }
200
- reset() {
201
- for (let e of this.getEntries()) {
202
- let t = e.animation;
203
- t.started && t.frames.length > 0 && t.interpFrames(0, !0), t.managed = !1, t.reset();
204
- }
205
- return this.started = !1, this.done = !1, this.paused = !1, this.lastTickTime = 0, this;
206
- }
207
- stop() {
208
- return s(this.handleId), this.handleId = void 0, this.reset(), this;
209
- }
210
- playing() {
211
- return !(!this.started || this.paused);
212
- }
213
- forcePause() {
214
- this.paused = !0;
215
- for (let e of this.getEntries()) e.animation.paused = !0;
216
- }
217
- forcePlay() {
218
- this.paused = !1;
219
- for (let e of this.getEntries()) e.animation.paused = !1;
220
- }
221
- setLayerConfig(e, t) {
222
- let n = typeof e == "string" ? e : Q(e), r = this.animations[n];
223
- if (!r) throw Error(`AnimationGroup.setLayerConfig: no animation registered for key "${n}". Known keys: ${Object.keys(this.animations).join(", ") || "(none)"}.`);
224
- return Object.assign(r.layer, t), this.invalidateEntries(), this;
225
- }
226
- setLayerEnabled(e, t) {
227
- return this.setLayerConfig(e, { enabled: t });
228
- }
229
- getLayerConfig(e) {
230
- let t = typeof e == "string" ? e : Q(e);
231
- return this.animations[t]?.layer;
232
- }
233
- }, de = class {
1
+ import { a as e, i as t, n, o as r, r as i, t as a } from "./leaves-Bu89334e.js";
2
+ //#region src/animation/playback.ts
3
+ var o = class {
234
4
  _rafId = null;
235
5
  _startTime = void 0;
236
6
  _resolve = null;
237
- play(e, t) {
7
+ play(e, r) {
238
8
  if (e <= 0) throw Error("RAFPlayback.play() requires a duration > 0.");
239
- return this.stop(), new Promise((n) => {
240
- this._resolve = n, this._startTime = void 0;
241
- let r = (n) => {
242
- this._startTime === void 0 && (this._startTime = n);
243
- let i = c((n - this._startTime) / e, 0, 1);
244
- t(i), i < 1 ? this._rafId = y(r) : this._cleanup();
9
+ return this.stop(), new Promise((i) => {
10
+ this._resolve = i, this._startTime = void 0;
11
+ let a = (i) => {
12
+ this._startTime === void 0 && (this._startTime = i);
13
+ let o = n((i - this._startTime) / e, 0, 1);
14
+ r(o), o < 1 ? this._rafId = t(a) : this._cleanup();
245
15
  };
246
- this._rafId = y(r);
16
+ this._rafId = t(a);
247
17
  });
248
18
  }
249
19
  stop() {
250
- this._rafId !== null && s(this._rafId), this._cleanup();
20
+ this._rafId !== null && a(this._rafId), this._cleanup();
251
21
  }
252
22
  _cleanup() {
253
23
  this._rafId = null, this._startTime = void 0;
254
24
  let e = this._resolve;
255
25
  this._resolve = null, e?.();
256
26
  }
257
- }, N = (e) => {
258
- if (e instanceof o) return [e.clone()];
259
- if (e instanceof i) return e.values.flatMap((e) => N(e));
260
- if (e instanceof a) return e.flatMap((e) => N(e));
261
- throw TypeError(`Expected ValueUnit/FunctionValue/ValueArray, got ${typeof e}`);
262
- }, P = (e) => {
263
- let t = e.split(".").pop(), n = e.split(".").shift();
264
- if (!t || !n) throw Error(`Invalid flattened key: ${e}`);
265
- return {
266
- mainKey: n,
267
- childKey: t
268
- };
269
- }, F = (e, t, n) => (e.setProperty(t), n !== t && e.setSubProperty(n), e), I = /^\s*cubic-bezier\s*\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)\s*$/i, L = (e) => {
270
- if (e == null) return;
271
- if (typeof e != "string") return e;
272
- let n = e.match(I);
273
- if (n) {
274
- let e = n.slice(1, 5).map((e) => Number.parseFloat(e ?? ""));
275
- if (e.length === 4 && e.every((e) => Number.isFinite(e))) {
276
- let [n, r, i, a] = e;
277
- return t(n, r, i, a);
278
- }
279
- }
280
- let r = S[e];
281
- if (typeof r == "function" && r.length <= 1) return r;
282
- }, R = /* @__PURE__ */ new Map();
283
- function z(e) {
284
- let t = m(e), s = (e, t) => {
285
- let { childKey: c, mainKey: l } = P(e);
286
- if (t instanceof o) return F(new a(...N(t)), l, c);
287
- if (t instanceof i) return F(new a(...t.values.flatMap((t) => N(s(e, t)))), l, c);
288
- if (t instanceof a) return F(new a(...t.flatMap((t) => N(s(e, t)))), l, c);
289
- let u = String(t), d = `${c}:${u}`, f = R.get(d);
290
- if (f) return F(f.clone(), l, c);
291
- let p = F(new a(...N(ae(se(n.FunctionArgs.map((e) => (e.setSubProperty(c), e)), r.Value), u))), l, c);
292
- return R.set(d, p.clone()), p;
293
- };
294
- return Object.entries(t).reduce((e, [t, n]) => (e[t] = s(t, n), e), {});
295
- }
296
- var B = (e, t, n, r, i = "oklab", a) => {
297
- let s = r[t], c = r[n];
298
- if (!s || !c) throw Error(`Invalid interpolation frame bounds (${t} -> ${n}).`);
299
- let l = s[e], u = c[e];
300
- if (!l || !u) throw Error(`Missing variable "${e}" in interpolation bounds.`);
301
- let d = Math.max(l.length, u.length), f = (t) => {
302
- let n = t.map((t) => {
303
- if (!(t instanceof o)) throw TypeError(`Interpolation for "${e}" requires ValueUnit leaves.`);
304
- return t;
305
- });
306
- for (; n.length < d;) n.push(new o(0));
307
- return n;
308
- }, p = f(l), m = f(u);
309
- return p.map((t, n) => {
310
- let r = m[n];
311
- if (!r) throw Error(`Missing right-hand interpolation value at index ${n}.`);
312
- if (!(t instanceof o) || !(r instanceof o)) throw TypeError(`Interpolation for "${e}" requires ValueUnit leaves.`);
313
- let s = { colorSpace: i };
314
- return a !== void 0 && (s.hueMethod = a), re(g(t, r, s));
315
- });
316
27
  };
317
- function V(e, t, n) {
318
- let [r, i] = [e.start, t.start];
319
- return {
320
- start: r.value * n / 100,
321
- stop: i.value * n / 100
322
- };
323
- }
324
- function H(e, t, n = !0) {
325
- e = n ? e : m(e);
326
- let r = C(e);
327
- t.forEach((e) => {
328
- Object.entries(r).forEach(([t, n]) => {
329
- e.style.setProperty(t, n);
330
- });
331
- });
332
- }
333
- H[Symbol.for("keyframes.defaultRenderer")] = !0;
334
28
  //#endregion
335
29
  //#region src/animation/numeric.ts
336
- function fe() {
30
+ function s() {
337
31
  return typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
338
32
  }
339
- var pe = (e) => e, U = class {
33
+ var c = (e) => e, l = class {
340
34
  keyframes;
341
35
  segments;
342
36
  positions;
@@ -344,10 +38,14 @@ var pe = (e) => e, U = class {
344
38
  result;
345
39
  _duration;
346
40
  _respectReducedMotion;
347
- _playback = new de();
41
+ _pendingEasingName = null;
42
+ _easingReady = null;
43
+ _playback = new o();
348
44
  constructor(e, t) {
349
45
  if (e.length < 2) throw Error("NumericAnimation requires at least 2 keyframes.");
350
- if (this.keyframes = e.map((e) => ({ ...e })), this._duration = t?.duration ?? 0, this._respectReducedMotion = t?.respectReducedMotion ?? !1, this.timingFn = (t?.timingFunction ? L(t.timingFunction) : void 0) ?? pe, t?.positions) {
46
+ this.keyframes = e.map((e) => ({ ...e })), this._duration = t?.duration ?? 0, this._respectReducedMotion = t?.respectReducedMotion ?? !1;
47
+ let n = t?.timingFunction;
48
+ if (typeof n == "function" ? this.timingFn = n : typeof n == "string" ? (this.timingFn = c, this._pendingEasingName = n) : this.timingFn = c, t?.positions) {
351
49
  if (t.positions.length !== e.length) throw Error("positions length must match keyframes length.");
352
50
  this.positions = t.positions;
353
51
  } else this.positions = e.map((t, n) => n / (e.length - 1) * 100);
@@ -369,24 +67,35 @@ var pe = (e) => e, U = class {
369
67
  timingFunction: this.timingFn
370
68
  };
371
69
  }
372
- at(e) {
373
- let t = c(e, 0, 1) * 100, n = w(this.segments, t, (e) => e.startPos, (e) => e.stopPos);
374
- n === -1 && (n = this.segments.length - 1);
375
- let r = this.segments[n], i = b(c(t, r.startPos, r.stopPos), r.startPos, r.stopPos, 0, 1), a = r.timingFunction(i);
376
- for (let e = 0; e < r.keys.length; e++) this.result[r.keys[e]] = h(r.startVals[e], r.stopVals[e], a);
70
+ ready() {
71
+ if (this._pendingEasingName === null) return Promise.resolve();
72
+ if (this._easingReady) return this._easingReady;
73
+ let e = this._pendingEasingName;
74
+ return this._easingReady = import("./engine-DuAFoqZF.js").then((t) => {
75
+ let n = t.getTimingFunction(e);
76
+ n && (this.timingFn = n, this.segments = this.buildSegments()), this._pendingEasingName = null;
77
+ }), this._easingReady;
78
+ }
79
+ at(t) {
80
+ let a = n(t, 0, 1) * 100, o = r(this.segments, a, (e) => e.startPos, (e) => e.stopPos);
81
+ o === -1 && (o = this.segments.length - 1);
82
+ let s = this.segments[o], c = e(n(a, s.startPos, s.stopPos), s.startPos, s.stopPos, 0, 1), l = s.timingFunction(c);
83
+ for (let e = 0; e < s.keys.length; e++) this.result[s.keys[e]] = i(s.startVals[e], s.stopVals[e], l);
377
84
  return this.result;
378
85
  }
379
86
  updateKeyframe(e, t) {
380
87
  if (e < 0 || e >= this.keyframes.length) throw RangeError(`Keyframe index ${e} out of range [0, ${this.keyframes.length - 1}].`);
381
88
  return Object.assign(this.keyframes[e], t), e > 0 && (this.segments[e - 1] = this.buildSegment(e - 1)), e < this.keyframes.length - 1 && (this.segments[e] = this.buildSegment(e)), this;
382
89
  }
383
- play(e, t) {
90
+ async play(e, t) {
91
+ await this.ready();
384
92
  let n = t ?? this._duration;
385
- if (this._respectReducedMotion && fe()) {
93
+ if (this._respectReducedMotion && s()) {
386
94
  let t = this.at(1);
387
- return e?.(t), Promise.resolve();
95
+ e?.(t);
96
+ return;
388
97
  }
389
- return this._playback.play(n, (t) => {
98
+ await this._playback.play(n, (t) => {
390
99
  let n = this.at(t);
391
100
  e?.(n);
392
101
  });
@@ -394,7 +103,7 @@ var pe = (e) => e, U = class {
394
103
  stop() {
395
104
  this._playback.stop();
396
105
  }
397
- }, me = {
106
+ }, u = {
398
107
  damping: .1,
399
108
  snapThreshold: .001,
400
109
  targetEpsilon: 0,
@@ -402,10 +111,10 @@ var pe = (e) => e, U = class {
402
111
  clamp: !0,
403
112
  respectReducedMotion: !1
404
113
  };
405
- function W() {
114
+ function d() {
406
115
  return typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
407
116
  }
408
- var G = class {
117
+ var f = class {
409
118
  options;
410
119
  targetValue;
411
120
  currentValue;
@@ -415,7 +124,7 @@ var G = class {
415
124
  _onFrame = void 0;
416
125
  constructor(e) {
417
126
  this.options = {
418
- ...me,
127
+ ...u,
419
128
  ...e
420
129
  }, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.isSettled = !0;
421
130
  }
@@ -432,7 +141,7 @@ var G = class {
432
141
  this.options.clamp && (e = Math.max(0, Math.min(1, e)));
433
142
  let t = Math.abs(e - this.targetValue);
434
143
  if (t > 0 && t >= this.options.targetEpsilon) {
435
- if (this.targetValue = e, this.options.respectReducedMotion && W()) {
144
+ if (this.targetValue = e, this.options.respectReducedMotion && d()) {
436
145
  this.currentValue = e, this.isSettled = !0, this._onFrame?.(e);
437
146
  return;
438
147
  }
@@ -455,7 +164,7 @@ var G = class {
455
164
  this.targetValue = t, this.currentValue = t, this.isSettled = !0, this._stopLoop();
456
165
  }
457
166
  play(e) {
458
- if (this._onFrame = e, this.options.respectReducedMotion && W()) {
167
+ if (this._onFrame = e, this.options.respectReducedMotion && d()) {
459
168
  this.currentValue = this.targetValue, this.isSettled = !0, e?.(this.currentValue);
460
169
  return;
461
170
  }
@@ -471,22 +180,22 @@ var G = class {
471
180
  _startLoop() {
472
181
  if (this._rafId !== null) return;
473
182
  this._lastFrameT = 0;
474
- let e = (t) => {
475
- let n = this._lastFrameT ? t - this._lastFrameT : 16.667;
476
- this._lastFrameT = t;
477
- let r = this.tickDt(n);
478
- if (this._onFrame?.(r), this.isSettled) {
183
+ let e = (n) => {
184
+ let r = this._lastFrameT ? n - this._lastFrameT : 16.667;
185
+ this._lastFrameT = n;
186
+ let i = this.tickDt(r);
187
+ if (this._onFrame?.(i), this.isSettled) {
479
188
  this._stopLoop();
480
189
  return;
481
190
  }
482
- this._rafId = y(e);
191
+ this._rafId = t(e);
483
192
  };
484
- this._rafId = y(e);
193
+ this._rafId = t(e);
485
194
  }
486
195
  _stopLoop() {
487
- this._rafId !== null && (s(this._rafId), this._rafId = null), this._lastFrameT = 0;
196
+ this._rafId !== null && (a(this._rafId), this._rafId = null), this._lastFrameT = 0;
488
197
  }
489
- }, he = {
198
+ }, p = {
490
199
  response: .5,
491
200
  dampingFraction: .86,
492
201
  initial: 0,
@@ -495,10 +204,10 @@ var G = class {
495
204
  velocitySettleThreshold: .001,
496
205
  respectReducedMotion: !1
497
206
  };
498
- function K() {
207
+ function m() {
499
208
  return typeof window > "u" || typeof window.matchMedia != "function" ? !1 : window.matchMedia("(prefers-reduced-motion: reduce)").matches;
500
209
  }
501
- var q = class {
210
+ var h = class {
502
211
  options;
503
212
  targetValue;
504
213
  currentValue;
@@ -517,7 +226,7 @@ var q = class {
517
226
  _onFrame = void 0;
518
227
  constructor(e) {
519
228
  this.options = {
520
- ...he,
229
+ ...p,
521
230
  ...e
522
231
  }, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.currentVelocity = this.options.initialVelocity, this.isSettled = this.options.initialVelocity === 0, this.elapsed = 0, this.originValue = this.currentValue, this.originVelocity = this.currentVelocity, this.omega = 2 * Math.PI / this.options.response, this.zeta = this.options.dampingFraction, this.omegaD = this.zeta < 1 ? this.omega * Math.sqrt(1 - this.zeta * this.zeta) : 0;
523
232
  }
@@ -537,7 +246,7 @@ var q = class {
537
246
  e === this.targetValue && !this.options.initialVelocity || this.reseatTarget(e);
538
247
  }
539
248
  reseatTarget(e) {
540
- if (this.targetValue = e, this.options.respectReducedMotion && K()) {
249
+ if (this.targetValue = e, this.options.respectReducedMotion && m()) {
541
250
  this.currentValue = e, this.currentVelocity = 0, this.isSettled = !0, this.originValue = e, this.originVelocity = 0, this.elapsed = 0, this.emit(), this._stopLoop();
542
251
  return;
543
252
  }
@@ -587,7 +296,7 @@ var q = class {
587
296
  }
588
297
  play(e) {
589
298
  if (!this.disposed) {
590
- if (this._onFrame = e, this.options.respectReducedMotion && K()) {
299
+ if (this._onFrame = e, this.options.respectReducedMotion && m()) {
591
300
  this.currentValue = this.targetValue, this.currentVelocity = 0, this.isSettled = !0, e?.(this.currentValue, this.currentVelocity);
592
301
  return;
593
302
  }
@@ -604,24 +313,24 @@ var q = class {
604
313
  _startLoop() {
605
314
  if (this._rafId !== null) return;
606
315
  this._lastFrameT = 0;
607
- let e = (t) => {
608
- let n = this._lastFrameT ? t - this._lastFrameT : 16.667;
609
- if (this._lastFrameT = t, this.tick(n / 1e3), this._onFrame?.(this.currentValue, this.currentVelocity), this.isSettled) {
316
+ let e = (n) => {
317
+ let r = this._lastFrameT ? n - this._lastFrameT : 16.667;
318
+ if (this._lastFrameT = n, this.tick(r / 1e3), this._onFrame?.(this.currentValue, this.currentVelocity), this.isSettled) {
610
319
  this._stopLoop();
611
320
  return;
612
321
  }
613
- this._rafId = y(e);
322
+ this._rafId = t(e);
614
323
  };
615
- this._rafId = y(e);
324
+ this._rafId = t(e);
616
325
  }
617
326
  _stopLoop() {
618
- this._rafId !== null && (s(this._rafId), this._rafId = null), this._lastFrameT = 0;
327
+ this._rafId !== null && (a(this._rafId), this._rafId = null), this._lastFrameT = 0;
619
328
  }
620
329
  };
621
330
  //#endregion
622
331
  //#region src/animation/springLinearStops.ts
623
- function ge(e) {
624
- let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = new q({
332
+ function g(e) {
333
+ let t = e.sampleCount ?? 24, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = new h({
625
334
  response: e.response,
626
335
  dampingFraction: e.dampingFraction,
627
336
  initial: 0,
@@ -639,8 +348,8 @@ function ge(e) {
639
348
  }
640
349
  //#endregion
641
350
  //#region src/animation/springTimingFunction.ts
642
- function _e(e) {
643
- let t = e.sampleCount ?? 64, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = new q({
351
+ function _(e) {
352
+ let t = e.sampleCount ?? 64, n = e.settleThreshold ?? .001, r = e.maxDuration ?? e.response * 4, i = new h({
644
353
  response: e.response,
645
354
  dampingFraction: e.dampingFraction,
646
355
  initial: 0,
@@ -661,7 +370,7 @@ function _e(e) {
661
370
  }
662
371
  //#endregion
663
372
  //#region src/animation/morph.ts
664
- var J = (e) => {
373
+ var v = (e) => {
665
374
  if (e instanceof HTMLElement) {
666
375
  let t = e.getBoundingClientRect();
667
376
  return {
@@ -672,7 +381,7 @@ var J = (e) => {
672
381
  };
673
382
  }
674
383
  return e;
675
- }, ve = class {
384
+ }, y = class {
676
385
  animation;
677
386
  transformOrigin;
678
387
  timingFunction;
@@ -681,8 +390,8 @@ var J = (e) => {
681
390
  this.transformOrigin = n?.transformOrigin ?? "top left", this.timingFunction = n?.timingFunction, this.duration = n?.duration ?? 0, this.measure(e, t);
682
391
  }
683
392
  measure(e, t) {
684
- let n = J(e), r = J(t), i = r.x - n.x, a = r.y - n.y, o = n.width === 0 ? 1 : r.width / n.width, s = n.height === 0 ? 1 : r.height / n.height;
685
- return this.animation = new U([{
393
+ let n = v(e), r = v(t), i = r.x - n.x, a = r.y - n.y, o = n.width === 0 ? 1 : r.width / n.width, s = n.height === 0 ? 1 : r.height / n.height;
394
+ return this.animation = new l([{
686
395
  translateX: 0,
687
396
  translateY: 0,
688
397
  scaleX: 1,
@@ -697,6 +406,9 @@ var J = (e) => {
697
406
  duration: this.duration
698
407
  }), this;
699
408
  }
409
+ ready() {
410
+ return this.animation.ready();
411
+ }
700
412
  at(e) {
701
413
  return this.animation.at(e);
702
414
  }
@@ -716,21 +428,28 @@ var J = (e) => {
716
428
  stop() {
717
429
  this.animation.stop();
718
430
  }
719
- }, ye = (e) => {
720
- if (e == null) return null;
721
- if (typeof e == "function") return e;
722
- let t = S[e];
723
- return typeof t == "function" && t.length <= 1 ? t : null;
724
- }, be = (e) => Math.max(0, Math.min(1, e)), Y = class {
431
+ }, b = (e) => Math.max(0, Math.min(1, e)), x = class {
725
432
  smoother;
726
433
  easingFn;
727
434
  currentProgress = 0;
728
435
  boundaryEpsilon;
436
+ _easingReady = null;
729
437
  constructor(e) {
730
- this.easingFn = ye(e?.easing), this.boundaryEpsilon = e?.boundaryEpsilon ?? .005, e?.smoothing === !1 ? this.smoother = null : this.smoother = new G(e?.smoothing);
438
+ this.boundaryEpsilon = e?.boundaryEpsilon ?? .005;
439
+ let t = e?.easing;
440
+ typeof t == "function" ? this.easingFn = t : typeof t == "string" ? (this.easingFn = null, this.resolveEasingName(t)) : this.easingFn = null, e?.smoothing === !1 ? this.smoother = null : this.smoother = new f(e?.smoothing);
441
+ }
442
+ resolveEasingName(e) {
443
+ return this._easingReady ||= import("./engine-DuAFoqZF.js").then((t) => {
444
+ let n = t.getTimingFunction(e);
445
+ n && (this.easingFn = n);
446
+ }), this._easingReady;
447
+ }
448
+ ready() {
449
+ return this._easingReady ?? Promise.resolve();
731
450
  }
732
451
  applyPipeline() {
733
- let e = be(this.sample());
452
+ let e = b(this.sample());
734
453
  this.easingFn && (e = this.easingFn(e));
735
454
  let t = this.boundaryEpsilon;
736
455
  return e <= t ? e = 0 : e >= 1 - t && (e = 1), e;
@@ -761,7 +480,7 @@ var J = (e) => {
761
480
  let t = e ?? 0;
762
481
  this.smoother && this.smoother.reset(t), this.currentProgress = t;
763
482
  }
764
- }, xe = class extends Y {
483
+ }, S = class extends x {
765
484
  threshold;
766
485
  getScrollY;
767
486
  getViewportHeight;
@@ -772,7 +491,7 @@ var J = (e) => {
772
491
  let e = this.getViewportHeight() * this.threshold;
773
492
  return e <= 0 ? 0 : this.getScrollY() / e;
774
493
  }
775
- }, Se = class extends Y {
494
+ }, C = class extends x {
776
495
  value = 0;
777
496
  constructor(e) {
778
497
  super({
@@ -786,402 +505,6 @@ var J = (e) => {
786
505
  sample() {
787
506
  return this.value;
788
507
  }
789
- }, X = (t) => typeof t == "string" && e.includes(t), Z = Symbol.for("keyframes.defaultRenderer"), Ce = (e) => typeof e == "function" && e[Z] === !0;
790
- function we(e) {
791
- if (!e.targets || e.targets.length === 0) return {
792
- eligible: !1,
793
- reason: "no DOM targets"
794
- };
795
- if (typeof e.targets[0]?.animate != "function") return {
796
- eligible: !1,
797
- reason: "target does not implement Element.animate()"
798
- };
799
- for (let t of e.frames) if (!Ce(t.transform)) return {
800
- eligible: !1,
801
- reason: "custom transform function (not the default DOM renderer)"
802
- };
803
- if (e.frames.length > 1) {
804
- let t = e.frames[0].timingFunction;
805
- for (let n = 1; n < e.frames.length; n++) if (e.frames[n].timingFunction !== t) return {
806
- eligible: !1,
807
- reason: "non-uniform per-frame timing function (WAAPI supports one easing per animation)"
808
- };
809
- }
810
- for (let t of e.frames) for (let e of Object.values(t.interpVars)) for (let t of e) {
811
- if (X(t.start?.unit) || X(t.stop?.unit)) return {
812
- eligible: !1,
813
- reason: `computed unit (${String(t.start?.unit ?? t.stop?.unit)}) requires DOM resolution`
814
- };
815
- if (t.start?.unit === "color" || t.stop?.unit === "color") return {
816
- eligible: !1,
817
- reason: "color interpolation requires perceptual lerp"
818
- };
819
- }
820
- return { eligible: !0 };
821
- }
822
- function Te(e) {
823
- let t = e.options.duration, n = [], r = /* @__PURE__ */ new Set();
824
- for (let t of e.frames) r.add(t.time.start), r.add(t.time.stop);
825
- let i = [...r].sort((e, t) => e - t);
826
- for (let r of i) {
827
- let i = e.interpFrames(r, !1);
828
- if (Object.keys(i).length === 0) continue;
829
- let a = C(i);
830
- n.push({
831
- offset: Math.max(0, Math.min(1, r / t)),
832
- ...a
833
- });
834
- }
835
- return n;
836
- }
837
- var Ee = {
838
- normal: "normal",
839
- reverse: "reverse",
840
- alternate: "alternate",
841
- "alternate-reverse": "alternate-reverse"
842
- }, De = {
843
- none: "none",
844
- forwards: "forwards",
845
- backwards: "backwards",
846
- both: "both"
847
- };
848
- function Oe(e) {
849
- let t = e.options, n = Ee[t.direction], r = De[t.fillMode];
850
- if (n == null) throw TypeError(`Unrecognised animation direction "${t.direction}".`);
851
- if (r == null) throw TypeError(`Unrecognised animation fill mode "${t.fillMode}".`);
852
- return {
853
- duration: t.duration,
854
- delay: t.delay,
855
- iterations: t.iterationCount === Infinity ? Infinity : t.iterationCount,
856
- direction: n,
857
- fill: r,
858
- easing: "linear"
859
- };
860
- }
861
- async function ke(e) {
862
- let t = Te(e), n = Oe(e), r = e.targets.map((e) => e.animate(t, n)), i = !1, a = (t) => {
863
- if (!(i || e.done)) {
864
- if (e.tick(t), e.paused) for (let e of r) e.pause();
865
- else for (let e of r) e.playState === "paused" && e.play();
866
- e.handleId = requestAnimationFrame(a);
867
- }
868
- };
869
- e.handleId = requestAnimationFrame(a);
870
- try {
871
- await Promise.all(r.map((e) => e.finished));
872
- } finally {
873
- i = !0;
874
- }
875
- }
876
- //#endregion
877
- //#region src/animation/index.ts
878
- var Ae = (e) => typeof e != "object" || !e ? !1 : typeof e.clone == "function", Q = (e) => typeof e == "string" ? e : e.name ?? String(e.id), je = 0, $ = class {
879
- id = je++;
880
- name;
881
- superKey;
882
- targets;
883
- options;
884
- templateFrames = [];
885
- parsedVars = [];
886
- frameId = 0;
887
- frames = [];
888
- handleId = void 0;
889
- startTime = void 0;
890
- pausedTime = 0;
891
- t = 0;
892
- iteration = 0;
893
- started = !1;
894
- done = !1;
895
- reversed = !1;
896
- paused = !1;
897
- managed = !1;
898
- waapiIneligibleReason = void 0;
899
- unflatten = !0;
900
- resolvePromise = null;
901
- _playingPromise = null;
902
- _boundDraw = this.draw.bind(this);
903
- dispatchAnimationEvent(e) {
904
- if (!(typeof AnimationEvent > "u")) for (let t of this.targets) typeof t?.dispatchEvent == "function" && t.dispatchEvent(new AnimationEvent(e, {
905
- animationName: this.name ?? "",
906
- elapsedTime: this.t / 1e3
907
- }));
908
- }
909
- constructor(e, t, n, r) {
910
- this.options = {}, this.setOptions({
911
- ...k,
912
- ...e ?? {}
913
- }), this.targets = t == null ? [] : Array.isArray(t) ? t : [t], this.name = n, this.superKey = r;
914
- }
915
- convertFrameStart(e) {
916
- if (e.start.unit === "s" || e.start.unit === "ms" || !e.start.unit) {
917
- let t = e.start.unit === "s" ? "s" : "ms", n = l(e.start.value, t);
918
- e.start.value = n / this.options.duration * 100, e.start.unit = "%";
919
- }
920
- return e.start.value = c(e.start.value, 0, 100), e;
921
- }
922
- addFrame(e, t, n, r) {
923
- typeof e == "number" ? e = String(e) + "%" : typeof e == "string" ? e = e : e instanceof o && (e = String(e));
924
- let i = ne(e), a = {
925
- id: this.frameId,
926
- start: i,
927
- vars: t,
928
- transform: n,
929
- timingFunction: L(r) ?? this.options.timingFunction
930
- };
931
- return this.convertFrameStart(a), this.templateFrames.push(a), this.frameId += 1, this;
932
- }
933
- createFrame(e, t) {
934
- let n = this.templateFrames[e], r = this.templateFrames[t], i = {
935
- start: e,
936
- stop: t
937
- }, a = V(n, r, this.options.duration), o = n.transform;
938
- if (o == null) {
939
- let t = x(e, this.frames, (e) => e.transform != null);
940
- o = this.frames[t].transform;
941
- }
942
- let s = n.timingFunction;
943
- if (s == null) {
944
- let t = x(e, this.frames, (e) => e.timingFunction != null);
945
- s = this.frames[t].timingFunction;
946
- }
947
- return {
948
- id: this.frameId++,
949
- ixs: i,
950
- start: n.start,
951
- time: a,
952
- vars: void 0,
953
- flatVars: void 0,
954
- interpVars: {},
955
- allInterpVars: [],
956
- transform: o,
957
- timingFunction: s
958
- };
959
- }
960
- buildVarIndex() {
961
- let e = /* @__PURE__ */ new Map();
962
- for (let t = 0; t < this.parsedVars.length; t++) for (let n of Object.keys(this.parsedVars[t])) {
963
- let r = e.get(n);
964
- r || (r = [], e.set(n, r)), r.push(t);
965
- }
966
- return e;
967
- }
968
- reconcileVars(e, t) {
969
- let n = this.parsedVars[e];
970
- if (n) for (let r of Object.keys(n)) {
971
- let n = t.get(r);
972
- if (!n) continue;
973
- let i = -1;
974
- for (let t of n) if (t > e) {
975
- i = t;
976
- break;
977
- }
978
- if (i === -1) continue;
979
- 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];
980
- c.interpVars[r] = B(r, a, o, this.parsedVars, this.options.colorSpace, this.options.hueMethod), s === -1 && this.frames.push(c);
981
- }
982
- }
983
- parse() {
984
- this.frames = [], this.templateFrames.sort((e, t) => e.start.value - t.start.value), this.parsedVars = this.templateFrames.map((e) => {
985
- let t = z(e.vars);
986
- return Object.values(t).forEach((e) => {
987
- e.setTargets(this.targets);
988
- }), t;
989
- });
990
- for (let e = 0; e < this.templateFrames.length - 1; e++) this.frames.push(this.createFrame(e, e + 1));
991
- let e = this.buildVarIndex();
992
- return this.frames.forEach((t, n) => this.reconcileVars(n, e)), 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) => {
993
- e.flatVars = Object.entries(e.interpVars).reduce((e, [t, n]) => (e[t] = n.map((e) => e.value), e), {}), e.vars = oe(e.flatVars), e.allInterpVars = Object.values(e.interpVars).flat();
994
- }), this;
995
- }
996
- setTimingFunction(e) {
997
- return this.options.timingFunction = L(e) ?? u, this;
998
- }
999
- setIterationCount(e) {
1000
- if (!e || e === "infinite" || e === "∞" || e === "Infinity") this.options.iterationCount = Infinity;
1001
- else if (typeof e == "string") {
1002
- let t = parseFloat(e.trim());
1003
- if (isNaN(t) || t < 0) return this;
1004
- this.options.iterationCount = t;
1005
- } else {
1006
- if (isNaN(e) || e < 0) return this;
1007
- this.options.iterationCount = e;
1008
- }
1009
- return this;
1010
- }
1011
- setDuration(e) {
1012
- typeof e == "string" && (e = v(e));
1013
- let t = e ?? this.options.duration;
1014
- if (!isFinite(t) || t <= 0) return this;
1015
- let n = t / this.options.duration;
1016
- for (let e = 0; e < this.frames.length; e++) {
1017
- let t = this.frames[e];
1018
- t.time.start *= n, t.time.stop *= n;
1019
- }
1020
- return this.options.duration = t, this;
1021
- }
1022
- setDelay(e) {
1023
- return typeof e == "string" && (e = v(e)), this.options.delay = e ?? 0, this;
1024
- }
1025
- setDirection(e) {
1026
- return this.options.direction = e ?? "normal", this.reversed = !1, (this.options.direction === "reverse" || this.options.direction === "alternate-reverse" && this.iteration % 2 == 0 || this.options.direction === "alternate" && this.iteration % 2 == 1) && (this.reversed = !0), this;
1027
- }
1028
- setFillMode(e) {
1029
- return this.options.fillMode = e ?? "forwards", this;
1030
- }
1031
- setUseWAAPI(e) {
1032
- return this.options.useWAAPI = e ?? !0, this;
1033
- }
1034
- setColorSpace(e) {
1035
- return this.options.colorSpace = e ?? "oklab", this;
1036
- }
1037
- setHueMethod(e) {
1038
- return e !== void 0 && (this.options.hueMethod = e), this;
1039
- }
1040
- setOptions(e) {
1041
- return this.setTimingFunction(e.timingFunction), this.setDuration(e.duration), this.setIterationCount(e.iterationCount), this.setDelay(e.delay), this.setDirection(e.direction), this.setFillMode(e.fillMode), this.setUseWAAPI(e.useWAAPI), this.setColorSpace(e.colorSpace), this.setHueMethod(e.hueMethod), this;
1042
- }
1043
- reverse() {
1044
- if (this.startTime !== void 0) {
1045
- let e = this.t, t = this.options.duration - 2 * e;
1046
- this.startTime -= t;
1047
- }
1048
- return this.reversed = !this.reversed, this;
1049
- }
1050
- fillForwards() {
1051
- this.interpFrames(this.options.duration, !0);
1052
- }
1053
- fillBackwards() {
1054
- this.interpFrames(0, !0);
1055
- }
1056
- at(e, t = !1) {
1057
- let n = this.reversed;
1058
- this.reversed = !1;
1059
- let r = c(e, 0, 1) * this.options.duration, i = this.interpFrames(r, t);
1060
- return this.reversed = n, i;
1061
- }
1062
- interpFrames(e, t = !1, n = {}) {
1063
- e = this.reversed ? this.options.duration - e : e;
1064
- let r = n;
1065
- for (let e in r) delete r[e];
1066
- let i = this.frames, a = i.length, o = w(i, e, (e) => e.time.start, (e) => e.time.stop);
1067
- if (o === -1) return r;
1068
- let s = (n) => {
1069
- let { start: i, stop: a } = n.time, o = b(e, i, a, 0, 1), s = n.timingFunction(o);
1070
- for (let e of n.allInterpVars) te(s, e);
1071
- t && n.transform(this.unflatten ? n.vars : n.flatVars, e), Object.assign(r, n.flatVars);
1072
- };
1073
- for (let t = o; t >= 0; t--) {
1074
- let n = i[t];
1075
- if (e < n.time.start || e > n.time.stop) break;
1076
- s(n);
1077
- }
1078
- for (let t = o + 1; t < a; t++) {
1079
- let n = i[t];
1080
- if (e < n.time.start || e > n.time.stop) break;
1081
- s(n);
1082
- }
1083
- return r;
1084
- }
1085
- async onStart() {
1086
- this.reversed = !1, (this.options.direction === "reverse" || this.options.direction === "alternate-reverse" && this.iteration % 2 == 0 || this.options.direction === "alternate" && this.iteration % 2 == 1) && this.reverse(), (this.options.fillMode === "backwards" || this.options.fillMode === "both") && this.fillBackwards(), this.options.delay > 0 && (this.paused = !0, await ie(this.options.delay), this.paused = !1), this.started = !0;
1087
- }
1088
- async onEnd() {
1089
- this.options.fillMode === "forwards" || this.options.fillMode === "both" ? this.fillForwards() : (this.options.fillMode === "none" || this.options.fillMode === "backwards") && this.fillBackwards(), this.startTime = void 0, this.iteration >= this.options.iterationCount - 1 ? (this.done = !0, this.iteration = 0, this.dispatchAnimationEvent("animationend")) : (this.iteration += 1, this.dispatchAnimationEvent("animationiteration"));
1090
- }
1091
- async tick(e) {
1092
- if (this.startTime === void 0 && (await this.onStart(), this.startTime = e + this.options.delay, this.dispatchAnimationEvent("animationstart")), this.paused && this.pausedTime === 0) return this.pausedTime = e, this.t;
1093
- if (this.pausedTime > 0 && !this.paused) {
1094
- let t = e - this.pausedTime;
1095
- this.startTime += t, this.pausedTime = 0;
1096
- }
1097
- return this.t = e - this.startTime, this.t >= this.options.duration && (await this.onEnd(), this.t = this.options.duration), this.t;
1098
- }
1099
- async draw(e) {
1100
- if (this.managed) throw Error("Animation.draw() called on a managed animation — the AnimationGroup owns the rAF loop. Call group.play()/pause()/stop() instead.");
1101
- e = await this.tick(e), !this.paused && (this.interpFrames(e, !0), this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = y(this._boundDraw));
1102
- }
1103
- _playRAF() {
1104
- return new Promise((e) => {
1105
- this.resolvePromise = e, this.handleId = y(this._boundDraw);
1106
- });
1107
- }
1108
- async _playWAAPI() {
1109
- await ke(this), this.reset();
1110
- }
1111
- async play() {
1112
- if (this.managed) throw Error("Animation.play() called on a managed animation — the AnimationGroup owns the rAF loop. Call group.play() instead.");
1113
- if (this._playingPromise) return this._playingPromise;
1114
- let e;
1115
- if (this.options.useWAAPI) {
1116
- let t = we(this);
1117
- t.eligible ? (this.waapiIneligibleReason = void 0, e = this._playWAAPI()) : (this.waapiIneligibleReason = t.reason, e = this._playRAF());
1118
- } else this.waapiIneligibleReason = void 0, e = this._playRAF();
1119
- return this._playingPromise = e, e.finally(() => {
1120
- this._playingPromise = null;
1121
- }), e;
1122
- }
1123
- pause(e = !0) {
1124
- return this.paused && e ? this.resume() : (this.started && (this.paused = !0), this);
1125
- }
1126
- resume() {
1127
- return this.started && this.paused && (this.paused = !1, this.handleId = y(this._boundDraw)), this;
1128
- }
1129
- stop() {
1130
- s(this.handleId), this.reset();
1131
- }
1132
- playing() {
1133
- return !(!this.started || this.paused);
1134
- }
1135
- get effectiveT() {
1136
- return this.reversed ? this.options.duration - this.t : this.t;
1137
- }
1138
- reset() {
1139
- return this.done = !1, this.started = !1, this.paused = !1, this.reversed = !1, this.iteration = 0, this.startTime = void 0, this.pausedTime = 0, this.t = 0, this;
1140
- }
1141
- setTargets(...e) {
1142
- return this.targets = e, this.frames.forEach((e) => {
1143
- Object.values(e.interpVars).forEach((e) => {
1144
- e.forEach(({ start: e, stop: t, value: n }) => {
1145
- e.setTargets(this.targets), t.setTargets(this.targets), n.setTargets(this.targets);
1146
- });
1147
- });
1148
- }), this;
1149
- }
1150
- group(...e) {
1151
- return new M(this, ...e);
1152
- }
1153
- }, Me = class extends $ {
1154
- constructor(e, ...t) {
1155
- super(e, t), this.unflatten = !1;
1156
- }
1157
- fromVars(e, t) {
1158
- this.unflatten = t != null, t ??= this.transform.bind(this);
1159
- for (let n = 0; n < e.length; n++) {
1160
- let r = e[n], i = Math.round(n / (e.length - 1) * 100);
1161
- this.addFrame(i, r, t);
1162
- }
1163
- return this.parse(), this;
1164
- }
1165
- fromKeyframes(e, t) {
1166
- this.unflatten = t != null, t ??= this.transform.bind(this), ee(e) && (e = new Map(Object.entries(e)));
1167
- let n = e instanceof Map ? e.entries() : Object.entries(e);
1168
- for (let [e, r] of n) this.addFrame(e, r, t);
1169
- return this.parse(), this;
1170
- }
1171
- propertyRegistry = /* @__PURE__ */ new Map();
1172
- fromString(e, t) {
1173
- this.unflatten = t != null, t ??= this.transform.bind(this);
1174
- let n = O(e);
1175
- this.propertyRegistry = n.properties;
1176
- for (let [e, r] of n.keyframes.entries()) {
1177
- let i = Object.fromEntries(Object.entries(r).map(([e, t]) => [e, Ae(t) ? t.clone() : t])), a = n.timingFunctions.get(e), o = a ? L(a) : void 0;
1178
- this.addFrame(e, i, t, o);
1179
- }
1180
- return this.parse(), this;
1181
- }
1182
- transform(e) {
1183
- H(e, this.targets);
1184
- }
1185
- };
508
+ }, w = () => import("./engine-DuAFoqZF.js");
1186
509
  //#endregion
1187
- export { $ as Animation, M as AnimationGroup, Me as CSSKeyframesAnimation, le as DIRECTIONS, ve as ElementMorph, ue as FILL_MODES, Se as ManualTimeline, U as NumericAnimation, xe as ScrollTimeline, G as SmoothProgress, q as SpringProgress, Y as Timeline, A as defaultLayerConfig, k as defaultOptions, Q as getAnimationId, L as getTimingFunction, O as resolveKeyframes, ge as springLinearStops, _e as springTimingFunction };
510
+ export { y as ElementMorph, C as ManualTimeline, l as NumericAnimation, o as RAFPlayback, S as ScrollTimeline, f as SmoothProgress, h as SpringProgress, x as Timeline, w as loadAnimationEngine, g as springLinearStops, _ as springTimingFunction };