@mkbabb/keyframes.js 1.2.0 → 1.2.1

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,113 +1,123 @@
1
- import { CSSFunction as J, ValueUnit as f, CSSValueUnit as A, identifier as j, hyphenToCamelCase as mt, ValueArray as V, number as dt, camelCaseToHyphen as gt, memoize as w, tryParse as F, FunctionValue as x, easeInOutCubic as tt, lerp as E, requestAnimationFrame as v, cancelAnimationFrame as et, parseCSSValueUnit as st, unpackMatrixValues as yt, normalizeColorUnits as wt, COMPUTED_UNITS as U, convertToDPI as Vt, convertToMs as nt, convertToDegrees as St, convertToPixels as Tt, RESOLUTION_UNITS as bt, TIME_UNITS as vt, ANGLE_UNITS as Ft, LENGTH_UNITS as Pt, timingFunctions as it, flattenObject as rt, unflattenObjectToString as ot, clamp as C, scale as at, seekPreviousValue as R, unflattenObject as Et, sleep as It, isObject as Ot } from "@mkbabb/value.js";
2
- import { CSSCubicBezier as Ke, bezierPresets as Ye, bounceInEase as Re, bounceInEaseHalf as We, bounceInOutEase as Le, bounceOutEase as Be, bounceOutEaseHalf as De, easeInBounce as He, easeInCirc as Xe, easeInCubic as ze, easeInExpo as Ge, easeInOutCirc as Ze, easeInOutCubic as qe, easeInOutExpo as Qe, easeInOutQuad as Je, easeInOutSine as ts, easeInQuad as es, easeInSine as ss, easeOutCirc as ns, easeOutCubic as is, easeOutExpo as rs, easeOutQuad as os, easeOutSine as as, jumpTerms as us, linear as ls, smoothStep3 as cs, stepEnd as hs, stepStart as fs, steppedEase as ps, timingFunctions as ms } from "@mkbabb/value.js";
3
- import { string as g, all as $, regex as ut, any as I, whitespace as Ct } from "@mkbabb/parse-that";
4
- const Mt = (e) => e.replace(/\/\*[\s\S]*?\*\//g, ""), At = (e) => e.replace(/\s*!important/gi, ""), _ = (e) => At(Mt(e));
1
+ import { CSSFunction as tt, ValueUnit as f, CSSValueUnit as A, identifier as j, hyphenToCamelCase as yt, ValueArray as T, number as wt, camelCaseToHyphen as Vt, memoize as V, tryParse as F, FunctionValue as U, easeInOutCubic as et, lerp as I, requestAnimationFrame as w, cancelAnimationFrame as k, parseCSSValueUnit as st, unpackMatrixValues as Tt, normalizeColorUnits as bt, COMPUTED_UNITS as $, convertToDPI as St, convertToMs as it, convertToDegrees as vt, convertToPixels as Ft, RESOLUTION_UNITS as It, TIME_UNITS as Pt, ANGLE_UNITS as Et, LENGTH_UNITS as Ct, timingFunctions as rt, flattenObject as nt, unflattenObjectToString as ot, clamp as E, scale as at, seekPreviousValue as B, unflattenObject as Ot, sleep as _t, isObject as kt } from "@mkbabb/value.js";
2
+ import { CSSCubicBezier as Ye, bezierPresets as Be, bounceInEase as Re, bounceInEaseHalf as We, bounceInOutEase as Le, bounceOutEase as Xe, bounceOutEaseHalf as He, cancelAnimationFrame as Ge, clamp as qe, cubicBezier as Ze, cubicBezierToSVG as Qe, cubicBezierToString as Je, deCasteljau as ts, easeInBounce as es, easeInCirc as ss, easeInCubic as is, easeInExpo as rs, easeInOutCirc as ns, easeInOutCubic as os, easeInOutExpo as as, easeInOutQuad as us, easeInOutSine as ls, easeInQuad as cs, easeInSine as hs, easeOutCirc as fs, easeOutCubic as ps, easeOutExpo as ms, easeOutQuad as ds, easeOutSine as gs, interpBezier as ys, jumpTerms as ws, lerp as Vs, linear as Ts, logerp as bs, requestAnimationFrame as Ss, scale as vs, sleep as Fs, smoothStep3 as Is, stepEnd as Ps, stepStart as Es, steppedEase as Cs, timingFunctions as Os } from "@mkbabb/value.js";
3
+ import { string as g, all as D, regex as ut, any as C, whitespace as Mt } from "@mkbabb/parse-that";
4
+ function lt(s, t, e, i) {
5
+ let r = 0, o = s.length - 1;
6
+ for (; r <= o; ) {
7
+ const n = r + o >> 1, u = s[n];
8
+ if (t < e(u)) o = n - 1;
9
+ else if (t > i(u)) r = n + 1;
10
+ else return n;
11
+ }
12
+ return -1;
13
+ }
14
+ const At = (s) => s.replace(/\/\*[\s\S]*?\*\//g, ""), xt = (s) => s.replace(/\s*!important/gi, ""), N = (s) => xt(At(s));
5
15
  g("(");
6
16
  g(")");
7
- const kt = g(";"), jt = g(":"), N = g("{"), K = g("}"), xt = g(","), Ut = g("."), m = Ct, $t = (e) => {
17
+ const jt = g(";"), Ut = g(":"), K = g("{"), z = g("}"), $t = g(","), Dt = g("."), d = Mt, Nt = (s) => {
8
18
  const t = [];
9
- for (const s of e.flat(1 / 0)) {
10
- if (s instanceof f || s instanceof x) {
11
- t.push(s);
19
+ for (const e of s.flat(1 / 0)) {
20
+ if (e instanceof f || e instanceof U) {
21
+ t.push(e);
12
22
  continue;
13
23
  }
14
24
  throw new TypeError(
15
- `Expected parsed CSS value node, got ${typeof s}.`
25
+ `Expected parsed CSS value node, got ${typeof e}.`
16
26
  );
17
27
  }
18
28
  return t;
19
- }, _t = J.Function, Nt = $(N, ut(/[^{}]+/), K).map(
20
- (e) => {
21
- const t = e.join(`
22
- `), s = JSON.parse(t);
23
- return new f(s, "json");
29
+ }, Kt = tt.Function, zt = D(K, ut(/[^{}]+/), z).map(
30
+ (s) => {
31
+ const t = s.join(`
32
+ `), e = JSON.parse(t);
33
+ return new f(e, "json");
24
34
  }
25
- ), Y = I(
35
+ ), Y = C(
26
36
  A.Value,
27
- _t,
28
- Nt,
29
- ut(/[^\(\)\{\}\s,;]+/).map((e) => new f(e))
30
- ).trim(m), Kt = Y.sepBy(m), Yt = $(
31
- j.skip(jt).trim(m).map((e) => mt(e)),
32
- Kt.skip(kt.opt()).trim(m)
33
- ).map((e) => {
34
- const [t, s] = e, n = new V(...$t(s));
35
- return n.setProperty(t), {
36
- [t]: n
37
+ Kt,
38
+ zt,
39
+ ut(/[^\(\)\{\}\s,;]+/).map((s) => new f(s))
40
+ ).trim(d), Yt = Y.sepBy(d), Bt = D(
41
+ j.skip(Ut).trim(d).map((s) => yt(s)),
42
+ Yt.skip(jt.opt()).trim(d)
43
+ ).map((s) => {
44
+ const [t, e] = s, i = new T(...Nt(e));
45
+ return i.setProperty(t), {
46
+ [t]: i
37
47
  };
38
- }), Rt = I(
39
- A.TimePercentage.trim(m).map((e) => e.toString()),
40
- dt.map((e) => `${e}%`)
41
- ), Wt = Rt.sepBy(xt).trim(m), lt = Yt.many().trim(m).wrap(N, K).map((e) => Object.assign({}, ...e)), Lt = g("@keyframes").trim(m).next(j), W = $(Wt, lt).map(
42
- ([e, t]) => e.reduce((s, n) => (s.set(n, t), s), /* @__PURE__ */ new Map())
43
- ), ct = I(
44
- Lt.next(W.many(1).trim(m).wrap(N, K).trim(m)),
45
- W.many(1).trim(m)
46
- ).map((e) => e.reduce(
47
- (t, s) => {
48
- for (const [n, i] of s)
49
- t.has(n) ? t.set(n, { ...t.get(n), ...i }) : t.set(n, i);
48
+ }), Rt = C(
49
+ A.TimePercentage.trim(d).map((s) => s.toString()),
50
+ wt.map((s) => `${s}%`)
51
+ ), Wt = Rt.sepBy($t).trim(d), ct = Bt.many().trim(d).wrap(K, z).map((s) => Object.assign({}, ...s)), Lt = g("@keyframes").trim(d).next(j), R = D(Wt, ct).map(
52
+ ([s, t]) => s.reduce((e, i) => (e.set(i, t), e), /* @__PURE__ */ new Map())
53
+ ), ht = C(
54
+ Lt.next(R.many(1).trim(d).wrap(K, z).trim(d)),
55
+ R.many(1).trim(d)
56
+ ).map((s) => s.reduce(
57
+ (t, e) => {
58
+ for (const [i, r] of e)
59
+ t.has(i) ? t.set(i, { ...t.get(i), ...r }) : t.set(i, r);
50
60
  return t;
51
61
  },
52
62
  /* @__PURE__ */ new Map()
53
- )), Bt = Ut.trim(m).next(j).trim(m), Dt = lt.map((e) => {
63
+ )), Xt = Dt.trim(d).next(j).trim(d), Ht = ct.map((s) => {
54
64
  const t = {};
55
- for (const [s, n] of Object.entries(e))
56
- if (s.includes("animation")) {
57
- const i = s.replace(/^animation/i, "").replace(/^\w/, (r) => r.toLowerCase()), o = gt(n.toString());
58
- t[i] = o, delete e[s];
65
+ for (const [e, i] of Object.entries(s))
66
+ if (e.includes("animation")) {
67
+ const r = e.replace(/^animation/i, "").replace(/^\w/, (n) => n.toLowerCase()), o = Vt(i.toString());
68
+ t[r] = o, delete s[e];
59
69
  }
60
70
  return {
61
71
  options: t,
62
- values: e
72
+ values: s
63
73
  };
64
- }), Ht = Bt.next(Dt), Xt = I(
65
- Ht.map((e) => e),
66
- ct.map((e) => ({
67
- keyframes: e
74
+ }), Gt = Xt.next(Ht), qt = C(
75
+ Gt.map((s) => s),
76
+ ht.map((s) => ({
77
+ keyframes: s
68
78
  }))
69
- ), zt = Xt.sepBy(m).map((e) => Object.assign({}, ...e)), L = {
79
+ ), Zt = qt.sepBy(d).map((s) => Object.assign({}, ...s)), W = {
70
80
  Value: Y,
71
- FunctionArgs: J.FunctionArgs
72
- }, Gt = w(
73
- (e) => F(Y, _(e))
74
- ), Zt = w(
75
- (e) => F(ct, _(e))
81
+ FunctionArgs: tt.FunctionArgs
82
+ }, Qt = V(
83
+ (s) => F(Y, N(s))
84
+ ), Jt = V(
85
+ (s) => F(ht, N(s))
76
86
  );
77
- w((e) => {
87
+ V((s) => {
78
88
  const t = F(
79
- zt,
80
- _(e)
81
- ), s = {
89
+ Zt,
90
+ N(s)
91
+ ), e = {
82
92
  keyframes: t.keyframes
83
93
  };
84
- return t.options != null && (s.options = t.options), t.values != null && (s.values = t.values), s;
94
+ return t.options != null && (e.options = t.options), t.values != null && (e.values = t.values), e;
85
95
  });
86
- w(
87
- (e) => F(A.Percentage, String(e)).valueOf()
96
+ V(
97
+ (s) => F(A.Percentage, String(s)).valueOf()
88
98
  );
89
- const B = w((e) => F(
99
+ const L = V((s) => F(
90
100
  A.Time.map((t) => t.unit === "ms" ? t.value : t.unit === "s" ? t.value * 1e3 : t.value),
91
- e
101
+ s
92
102
  ));
93
- w((e) => e >= 5e3 ? `${e / 1e3}s` : `${e}ms`);
94
- w((e) => e === 1 / 0 ? "infinite" : String(e));
95
- const qt = {
103
+ V((s) => s >= 5e3 ? `${s / 1e3}s` : `${s}ms`);
104
+ V((s) => s === 1 / 0 ? "infinite" : String(s));
105
+ const te = {
96
106
  duration: 1e3,
97
107
  delay: 0,
98
108
  iterationCount: 1,
99
109
  direction: "normal",
100
110
  fillMode: "forwards",
101
- timingFunction: tt,
111
+ timingFunction: et,
102
112
  useWAAPI: !0,
103
113
  colorSpace: "oklab"
104
- }, Qt = {
114
+ }, ee = {
105
115
  zIndex: 0,
106
116
  weight: 1,
107
117
  blendMode: "replace",
108
118
  enabled: !0
109
- }, O = (e) => typeof e != "object" || e == null ? !1 : "value" in e && typeof e.value == "number";
110
- class Jt {
119
+ }, _ = (s) => typeof s != "object" || s == null ? !1 : "value" in s && typeof s.value == "number";
120
+ class se {
111
121
  animations = {};
112
122
  transform;
113
123
  superKey;
@@ -118,160 +128,239 @@ class Jt {
118
128
  lastTickTime = 0;
119
129
  handleId = void 0;
120
130
  resolvePromise = null;
131
+ /**
132
+ * Pre-bound draw callback — allocated once in constructor to avoid
133
+ * creating a new closure on every requestAnimationFrame reschedule.
134
+ */
135
+ _boundDraw;
136
+ /**
137
+ * Cached entries array, sorted by layer zIndex. Rebuilt on demand
138
+ * via dirty flag to avoid Object.values() allocation on every frame.
139
+ */
140
+ _entries = [];
141
+ _entriesDirty = !0;
121
142
  constructor(...t) {
122
- const s = [];
123
- for (const n of t) {
124
- let i, o;
125
- n instanceof pt ? i = n : (i = n.animation, o = n.layer), this.transform ??= i.frames[0].transform;
126
- const r = k(i);
127
- this.animations[r] = {
143
+ this._boundDraw = this.draw.bind(this);
144
+ const e = [];
145
+ for (const i of t) {
146
+ let r, o;
147
+ i instanceof gt ? r = i : (r = i.animation, o = i.layer), this.transform ??= r.frames[0].transform;
148
+ const n = x(r);
149
+ this.animations[n] = {
128
150
  values: {},
129
- animation: i,
130
- layer: { ...Qt, ...o }
131
- }, i.managed = !0, s.push(i);
151
+ animation: r,
152
+ layer: { ...ee, ...o }
153
+ }, r.managed = !0, e.push(r);
132
154
  }
133
- this.singleTarget = s.every(
134
- (n) => n.targets[0] === s[0]?.targets[0]
135
- );
155
+ this.singleTarget = e.every(
156
+ (i) => i.targets[0] === e[0]?.targets[0]
157
+ ), this.invalidateEntries();
158
+ }
159
+ // ── Entry cache ──────────────────────────────────────────────────
160
+ /**
161
+ * Returns the animation entries sorted by layer zIndex.
162
+ * Uses dirty-flag caching — only rebuilds when the animations object
163
+ * or layer configs are mutated. All hot-path iteration (tick, draw,
164
+ * transformFramesGrouped) uses this instead of Object.values().
165
+ */
166
+ getEntries() {
167
+ return this._entriesDirty && (this._entries = Object.values(this.animations), this._entries.sort((t, e) => t.layer.zIndex - e.layer.zIndex), this._entriesDirty = !1), this._entries;
136
168
  }
169
+ /** Mark entries cache stale. Called at all mutation boundaries. */
170
+ invalidateEntries() {
171
+ this._entriesDirty = !0;
172
+ }
173
+ // ── Setup ────────────────────────────────────────────────────────
137
174
  setSuperKey(t) {
138
- return this.superKey = t, Object.values(this.animations).forEach((s) => {
139
- s.animation.superKey = t;
140
- }), this;
175
+ this.superKey = t;
176
+ for (const e of this.getEntries())
177
+ e.animation.superKey = t;
178
+ return this;
141
179
  }
142
180
  setTargets(...t) {
143
- Object.values(this.animations).forEach((n) => {
144
- n.animation.setTargets(...t);
145
- });
146
- const s = Object.values(this.animations).map(
147
- (n) => n.animation
148
- );
149
- return this.singleTarget = s.every(
150
- (n) => n.targets[0] === s[0]?.targets[0]
181
+ const e = this.getEntries();
182
+ for (const i of e)
183
+ i.animation.setTargets(...t);
184
+ return this.singleTarget = e.every(
185
+ (i) => i.animation.targets[0] === e[0]?.animation.targets[0]
151
186
  ), this;
152
187
  }
188
+ // ── Lifecycle hooks ──────────────────────────────────────────────
153
189
  onStart() {
154
190
  return this.started = !0, this;
155
191
  }
156
192
  onEnd() {
157
193
  return this;
158
194
  }
195
+ // ── Frame rendering ──────────────────────────────────────────────
196
+ /**
197
+ * Composite all animation values into a single grouped transform.
198
+ * Called per-frame for single-target groups. Applies layer blending
199
+ * (replace / add / weighted) in zIndex order, then calls the group
200
+ * transform function with the merged values.
201
+ */
159
202
  transformFramesGrouped(t) {
160
- const s = {}, n = Object.values(this.animations);
161
- n.sort((o, r) => o.layer.zIndex - r.layer.zIndex);
162
- let i = !0;
163
- for (const o of n) {
164
- const { animation: r, values: a, layer: u } = o;
165
- if (i = i && r.done, !u.enabled) continue;
166
- if (!(r.done || r.paused)) {
167
- const l = r.interpFrames(r.t, !1);
168
- Object.assign(a, l);
203
+ const e = {}, i = this.getEntries();
204
+ let r = !0;
205
+ for (const o of i) {
206
+ const { animation: n, values: u, layer: a } = o;
207
+ if (r = r && n.done, !a.enabled) continue;
208
+ if (!(n.done || n.paused)) {
209
+ const l = n.interpFrames(n.t, !1);
210
+ Object.assign(u, l);
169
211
  }
170
- const c = u.properties ? Object.fromEntries(
171
- Object.entries(a).filter(
172
- ([l]) => u.properties.has(l)
212
+ const c = a.properties ? Object.fromEntries(
213
+ Object.entries(u).filter(
214
+ ([l]) => a.properties.has(l)
173
215
  )
174
- ) : a;
175
- switch (u.blendMode) {
216
+ ) : u;
217
+ switch (a.blendMode) {
176
218
  case "replace":
177
- Object.assign(s, c);
219
+ Object.assign(e, c);
178
220
  break;
179
221
  case "add":
180
222
  for (const [l, h] of Object.entries(c))
181
- if (l in s) {
182
- const d = s[l], p = h;
183
- O(d) && O(p) ? d.value = d.value + p.value : s[l] = h;
223
+ if (l in e) {
224
+ const m = e[l], p = h;
225
+ _(m) && _(p) ? m.value = m.value + p.value : e[l] = h;
184
226
  } else
185
- s[l] = h;
227
+ e[l] = h;
186
228
  break;
187
229
  case "weighted":
188
230
  for (const [l, h] of Object.entries(c))
189
- if (l in s && u.weight < 1) {
190
- const d = s[l], p = h;
191
- O(d) && O(p) ? d.value = E(
192
- u.weight,
193
- d.value,
231
+ if (l in e && a.weight < 1) {
232
+ const m = e[l], p = h;
233
+ _(m) && _(p) ? m.value = I(
234
+ a.weight,
235
+ m.value,
194
236
  p.value
195
- ) : s[l] = h;
237
+ ) : e[l] = h;
196
238
  } else
197
- s[l] = h;
239
+ e[l] = h;
198
240
  break;
199
241
  }
200
242
  }
201
- return this.done = i, this.transform(s, t), s;
243
+ return this.done = r, this.transform(e, t), e;
202
244
  }
245
+ /**
246
+ * Render the current animation state as a static frame.
247
+ * Called on pause to ensure the visual matches the exact pause moment.
248
+ * Handles both single-target (grouped blending) and multi-target
249
+ * (per-child interpFrames) paths.
250
+ */
251
+ renderPauseFrame() {
252
+ const t = this.getEntries(), e = this.lastTickTime || performance.now();
253
+ for (const i of t) {
254
+ const r = i.animation.interpFrames(i.animation.t, !1);
255
+ this.singleTarget && Object.assign(i.values, r);
256
+ }
257
+ if (this.singleTarget)
258
+ this.transformFramesGrouped(e);
259
+ else
260
+ for (const i of t)
261
+ i.animation.interpFrames(i.animation.t, !0);
262
+ }
263
+ // ── Playback loop ────────────────────────────────────────────────
264
+ /**
265
+ * Advance all child animations to timestamp `t`.
266
+ * Awaits all child tick() promises so deferred state updates
267
+ * (startTime, this.t) resolve before interpFrames reads them.
268
+ */
203
269
  async tick(t) {
204
- return this.lastTickTime = t, this.started || this.onStart(), await Promise.all(
205
- Object.values(this.animations).map(async (s) => {
206
- (!s.animation.paused || s.animation.pausedTime === 0) && await s.animation.tick(t);
207
- })
208
- ), this.done && this.onEnd(), this;
270
+ this.lastTickTime = t, this.started || this.onStart();
271
+ const e = [];
272
+ for (const i of this.getEntries()) {
273
+ const r = i.animation;
274
+ (!r.paused || r.pausedTime === 0) && e.push(r.tick(t));
275
+ }
276
+ return await Promise.all(e), this.done && this.onEnd(), this;
209
277
  }
278
+ /**
279
+ * Main animation frame callback. Ticks all children, then renders
280
+ * (single-target: grouped blending; multi-target: per-child).
281
+ * Reschedules itself via rAF until done.
282
+ */
210
283
  async draw(t) {
211
- await this.tick(t), !this.paused && (this.singleTarget ? this.transformFramesGrouped(t) : this.done = Object.values(this.animations).map(({ animation: s }) => (s.interpFrames(s.t, !0), s)).every((s) => s.done), this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = v(this.draw.bind(this)));
284
+ if (await this.tick(t), !this.paused) {
285
+ if (this.singleTarget)
286
+ this.transformFramesGrouped(t);
287
+ else {
288
+ let e = !0;
289
+ for (const i of this.getEntries())
290
+ i.animation.interpFrames(i.animation.t, !0), e = e && i.animation.done;
291
+ this.done = e;
292
+ }
293
+ this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = w(this._boundDraw);
294
+ }
212
295
  }
296
+ /**
297
+ * Start the animation group. Returns a promise that resolves
298
+ * when all child animations complete (or on explicit stop/reset).
299
+ */
213
300
  async play() {
214
301
  return new Promise((t) => {
215
- this.resolvePromise = t, this.handleId = v(this.draw.bind(this));
302
+ this.resolvePromise = t, this.handleId = w(this._boundDraw);
216
303
  });
217
304
  }
305
+ /**
306
+ * Toggle pause state. Calling pause() when playing pauses; calling
307
+ * pause() when paused resumes. (Toggle semantics preserved for
308
+ * backward compatibility with demo's toggleAnimationGroup.)
309
+ *
310
+ * On pause: explicitly cancels the rAF loop and renders a final
311
+ * frame snapshot so the visual matches the exact pause moment.
312
+ * On resume: re-registers the rAF loop.
313
+ */
218
314
  pause() {
219
- const t = this.paused;
220
- if (this.started) {
221
- this.paused = !this.paused;
222
- const s = this.lastTickTime || performance.now();
223
- if (Object.values(this.animations).forEach((n) => {
224
- const i = n.animation;
225
- this.paused ? (i.pause(!1), i.pausedTime === 0 && (i.pausedTime = s)) : i.paused = !1;
226
- }), this.paused && this.singleTarget) {
227
- for (const n of Object.values(this.animations)) {
228
- const i = n.animation, o = i.interpFrames(i.t, !1);
229
- Object.assign(n.values, o);
230
- }
231
- this.transformFramesGrouped(s);
232
- }
315
+ if (!this.started) return this;
316
+ this.paused = !this.paused;
317
+ const t = this.lastTickTime || performance.now();
318
+ for (const e of this.getEntries()) {
319
+ const i = e.animation;
320
+ this.paused ? (i.pause(!1), i.pausedTime === 0 && (i.pausedTime = t)) : i.paused = !1;
233
321
  }
234
- return t && (this.handleId = v(this.draw.bind(this))), this;
322
+ return this.paused ? (k(this.handleId), this.handleId = void 0, this.renderPauseFrame()) : this.handleId = w(this._boundDraw), this;
235
323
  }
236
324
  reset() {
237
- return Object.values(this.animations).forEach((t) => {
238
- const s = t.animation;
239
- s.started && s.frames.length > 0 && s.interpFrames(0, !0), s.managed = !1, s.reset();
240
- }), this.started = !1, this.done = !1, this.paused = !1, this.lastTickTime = 0, this;
325
+ for (const t of this.getEntries()) {
326
+ const e = t.animation;
327
+ e.started && e.frames.length > 0 && e.interpFrames(0, !0), e.managed = !1, e.reset();
328
+ }
329
+ return this.started = !1, this.done = !1, this.paused = !1, this.lastTickTime = 0, this;
241
330
  }
242
331
  stop() {
243
- return et(this.handleId), this.reset(), this;
332
+ return k(this.handleId), this.handleId = void 0, this.reset(), this;
244
333
  }
245
334
  playing() {
246
335
  return !(!this.started || this.paused);
247
336
  }
248
337
  forcePause() {
249
- this.paused = !0, Object.values(this.animations).forEach((t) => {
338
+ this.paused = !0;
339
+ for (const t of this.getEntries())
250
340
  t.animation.paused = !0;
251
- });
252
341
  }
253
342
  forcePlay() {
254
- this.paused = !1, Object.values(this.animations).forEach((t) => {
343
+ this.paused = !1;
344
+ for (const t of this.getEntries())
255
345
  t.animation.paused = !1;
256
- });
257
346
  }
258
- // --- Layer management API ---
347
+ // ── Layer management API ─────────────────────────────────────────
259
348
  /** Set layer config for an animation by name or reference. Chainable. */
260
- setLayerConfig(t, s) {
261
- const n = typeof t == "string" ? t : k(t), i = this.animations[n];
262
- return i && Object.assign(i.layer, s), this;
349
+ setLayerConfig(t, e) {
350
+ const i = typeof t == "string" ? t : x(t), r = this.animations[i];
351
+ return r && (Object.assign(r.layer, e), this.invalidateEntries()), this;
263
352
  }
264
353
  /** Convenience toggle for enabling/disabling a layer. Chainable. */
265
- setLayerEnabled(t, s) {
266
- return this.setLayerConfig(t, { enabled: s });
354
+ setLayerEnabled(t, e) {
355
+ return this.setLayerConfig(t, { enabled: e });
267
356
  }
268
357
  /** Read the layer config for an animation. */
269
358
  getLayerConfig(t) {
270
- const s = typeof t == "string" ? t : k(t);
271
- return this.animations[s]?.layer;
359
+ const e = typeof t == "string" ? t : x(t);
360
+ return this.animations[e]?.layer;
272
361
  }
273
362
  }
274
- const te = /* @__PURE__ */ new Set([
363
+ const ie = /* @__PURE__ */ new Set([
275
364
  "scaleX",
276
365
  "scaleY",
277
366
  "scaleZ",
@@ -288,47 +377,47 @@ const te = /* @__PURE__ */ new Set([
288
377
  "perspectiveY",
289
378
  "perspectiveZ",
290
379
  "perspectiveW"
291
- ]), ee = (e) => typeof e == "string" && Pt.includes(e), se = (e) => typeof e == "string" && Ft.includes(e), ne = (e) => typeof e == "string" && vt.includes(e), ie = (e) => typeof e == "string" && bt.includes(e), D = (e) => typeof e == "string" && U.includes(e), re = (e) => te.has(
292
- e
293
- ), oe = (e, t) => {
294
- if (typeof e != "number" || !Number.isFinite(e))
380
+ ]), re = (s) => typeof s == "string" && Ct.includes(s), ne = (s) => typeof s == "string" && Et.includes(s), oe = (s) => typeof s == "string" && Pt.includes(s), ae = (s) => typeof s == "string" && It.includes(s), X = (s) => typeof s == "string" && $.includes(s), ue = (s) => ie.has(
381
+ s
382
+ ), le = (s, t) => {
383
+ if (typeof s != "number" || !Number.isFinite(s))
295
384
  throw new TypeError(
296
- `Expected numeric ${t}, got ${String(e)}.`
385
+ `Expected numeric ${t}, got ${String(s)}.`
297
386
  );
298
- return e;
299
- }, H = (e) => {
300
- if (e.unit !== "color")
387
+ return s;
388
+ }, H = (s) => {
389
+ if (s.unit !== "color")
301
390
  throw new TypeError("Expected a color ValueUnit.");
302
- return e;
303
- }, ae = (e) => e, X = /* @__PURE__ */ new WeakMap();
304
- let ue = 0;
305
- const le = (e) => {
306
- let t = X.get(e);
307
- return t === void 0 && (t = ue++, X.set(e, t)), t;
308
- }, z = w(
309
- (e, t) => (() => {
391
+ return s;
392
+ }, ce = (s) => s, G = /* @__PURE__ */ new WeakMap();
393
+ let he = 0;
394
+ const fe = (s) => {
395
+ let t = G.get(s);
396
+ return t === void 0 && (t = he++, G.set(s, t)), t;
397
+ }, q = V(
398
+ (s, t) => (() => {
310
399
  if (!t)
311
- return e;
312
- if (e.unit === "var") {
313
- const i = getComputedStyle(t).getPropertyValue(
314
- e.value
400
+ return s;
401
+ if (s.unit === "var") {
402
+ const r = getComputedStyle(t).getPropertyValue(
403
+ s.value
315
404
  );
316
- return st(i);
405
+ return st(r);
317
406
  }
318
- if (e.unit === "calc" && e.property && e.subProperty && e.value && t) {
319
- const i = ae(t.style), o = i[e.property] ?? "", r = e.subProperty ? `${e.subProperty}(${e.toString()})` : e.toString();
320
- i[e.property] = r;
321
- const a = getComputedStyle(t).getPropertyValue(
322
- e.property
407
+ if (s.unit === "calc" && s.property && s.subProperty && s.value && t) {
408
+ const r = ce(t.style), o = r[s.property] ?? "", n = s.subProperty ? `${s.subProperty}(${s.toString()})` : s.toString();
409
+ r[s.property] = n;
410
+ const u = getComputedStyle(t).getPropertyValue(
411
+ s.property
323
412
  );
324
- i[e.property] = o;
325
- const u = Gt(a);
326
- if (u instanceof f)
327
- return u;
328
- if (u.name.startsWith("matrix")) {
329
- const c = yt(u);
330
- if (re(e.subProperty)) {
331
- const l = c[e.subProperty];
413
+ r[s.property] = o;
414
+ const a = Qt(u);
415
+ if (a instanceof f)
416
+ return a;
417
+ if (a.name.startsWith("matrix")) {
418
+ const c = Tt(a);
419
+ if (ue(s.subProperty)) {
420
+ const l = c[s.subProperty];
332
421
  if (l != null)
333
422
  return new f(l, "px", [
334
423
  "length",
@@ -337,79 +426,79 @@ const le = (e) => {
337
426
  }
338
427
  }
339
428
  }
340
- return e;
341
- })().coalesce(e),
429
+ return s;
430
+ })().coalesce(s),
342
431
  {
343
- keyFn: (e, t) => `${e.toString()}-${t ? le(t) : "null"}`,
432
+ keyFn: (s, t) => `${s.toString()}-${t ? fe(t) : "null"}`,
344
433
  // Don't cache when the element is disconnected (e.g. inside a Teleport
345
434
  // defer DocumentFragment). Layout-dependent units like cqw/vh resolve
346
435
  // to 0 without a live DOM context.
347
- shouldCache: (e, t, s) => !s || s.isConnected
348
- }
349
- ), ce = (e, t, s = !1) => {
350
- if (e?.superType?.[0] !== t?.superType?.[0])
351
- return s ? [e, t] : [e.clone(), t.clone()];
352
- const n = (r) => {
353
- const a = r?.superType?.[0], u = oe(r.value, "ValueUnit");
354
- switch (a) {
436
+ shouldCache: (s, t, e) => !e || e.isConnected
437
+ }
438
+ ), pe = (s, t, e = !1) => {
439
+ if (s?.superType?.[0] !== t?.superType?.[0])
440
+ return e ? [s, t] : [s.clone(), t.clone()];
441
+ const i = (n) => {
442
+ const u = n?.superType?.[0], a = le(n.value, "ValueUnit");
443
+ switch (u) {
355
444
  case "length":
356
- if (!ee(r.unit))
445
+ if (!re(n.unit))
357
446
  throw new TypeError(
358
- `Unsupported length unit: ${String(r.unit)}`
447
+ `Unsupported length unit: ${String(n.unit)}`
359
448
  );
360
449
  return {
361
- value: Tt(
362
- u,
363
- r.unit,
364
- r.targets?.[0]
450
+ value: Ft(
451
+ a,
452
+ n.unit,
453
+ n.targets?.[0]
365
454
  ),
366
455
  unit: "px"
367
456
  };
368
457
  case "angle":
369
- if (!se(r.unit))
458
+ if (!ne(n.unit))
370
459
  throw new TypeError(
371
- `Unsupported angle unit: ${String(r.unit)}`
460
+ `Unsupported angle unit: ${String(n.unit)}`
372
461
  );
373
462
  return {
374
- value: St(u, r.unit),
463
+ value: vt(a, n.unit),
375
464
  unit: "deg"
376
465
  };
377
466
  case "time":
378
- if (!ne(r.unit))
467
+ if (!oe(n.unit))
379
468
  throw new TypeError(
380
- `Unsupported time unit: ${String(r.unit)}`
469
+ `Unsupported time unit: ${String(n.unit)}`
381
470
  );
382
471
  return {
383
- value: nt(u, r.unit),
472
+ value: it(a, n.unit),
384
473
  unit: "ms"
385
474
  };
386
475
  case "resolution":
387
- if (!ie(r.unit))
476
+ if (!ae(n.unit))
388
477
  throw new TypeError(
389
- `Unsupported resolution unit: ${String(r.unit)}`
478
+ `Unsupported resolution unit: ${String(n.unit)}`
390
479
  );
391
480
  return {
392
- value: Vt(u, r.unit),
481
+ value: St(a, n.unit),
393
482
  unit: "dpi"
394
483
  };
395
484
  default:
396
485
  return {
397
- value: u,
398
- unit: typeof r.unit == "string" ? r.unit : ""
486
+ value: a,
487
+ unit: typeof n.unit == "string" ? n.unit : ""
399
488
  };
400
489
  }
401
- }, [i, o] = [
402
- n(e),
403
- n(t)
490
+ }, [r, o] = [
491
+ i(s),
492
+ i(t)
404
493
  ];
405
- return s ? (e.value = i.value, e.unit = i.unit, t.value = o.value, t.unit = o.unit, [e, t]) : [
494
+ return e ? (s.value = r.value, s.unit = r.unit, t.value = o.value, t.unit = o.unit, [s, t]) : [
406
495
  new f(
407
- i.value,
408
- i.unit,
409
- e.superType,
410
- e.subProperty,
411
- e.property,
412
- e.targets
496
+ r.value,
497
+ r.unit,
498
+ s.superType,
499
+ s.subProperty,
500
+ s.property,
501
+ s.targets
413
502
  ),
414
503
  new f(
415
504
  o.value,
@@ -421,268 +510,321 @@ const le = (e) => {
421
510
  )
422
511
  ];
423
512
  };
424
- function he(e, t, s = "oklab", n) {
425
- e = e.coalesce(t), t = t.coalesce(e);
426
- const i = {
427
- start: e,
513
+ function me(s, t, e = "oklab", i) {
514
+ s = s.coalesce(t), t = t.coalesce(s);
515
+ const r = {
516
+ start: s,
428
517
  stop: t,
429
- value: e.clone(),
518
+ value: s.clone(),
430
519
  computed: !1
431
520
  };
432
- if (e.unit === "color" && t.unit === "color") {
433
- const [o, r] = wt(
434
- H(e),
521
+ if (s.unit === "color" && t.unit === "color") {
522
+ const [o, n] = bt(
523
+ H(s),
435
524
  H(t),
436
- s,
525
+ e,
437
526
  !1,
438
527
  !0,
439
528
  !1,
440
- n
529
+ i
441
530
  );
442
- i.start = o, i.stop = r, i.value = o.clone();
531
+ r.start = o, r.stop = n, r.value = o.clone();
443
532
  }
444
- if (e.unit !== t.unit) {
445
- const [o, r] = ce(
446
- e,
533
+ if (s.unit !== t.unit) {
534
+ const [o, n] = pe(
535
+ s,
447
536
  t,
448
537
  !0
449
538
  );
450
- i.start = o, i.stop = r, i.value = o.clone();
539
+ r.start = o, r.stop = n, r.value = o.clone();
451
540
  }
452
- return i.computed = D(e.unit) || D(t.unit), i;
541
+ return r.computed = X(s.unit) || X(t.unit), r;
453
542
  }
454
- const b = (e) => {
455
- if (e instanceof f)
456
- return [e.clone()];
457
- if (e instanceof x)
458
- return e.values.flatMap((t) => b(t));
459
- if (e instanceof V)
460
- return e.flatMap((t) => b(t));
543
+ const v = (s) => {
544
+ if (s instanceof f)
545
+ return [s.clone()];
546
+ if (s instanceof U)
547
+ return s.values.flatMap((t) => v(t));
548
+ if (s instanceof T)
549
+ return s.flatMap((t) => v(t));
461
550
  throw new TypeError(
462
- `Expected ValueUnit/FunctionValue/ValueArray, got ${typeof e}`
551
+ `Expected ValueUnit/FunctionValue/ValueArray, got ${typeof s}`
463
552
  );
464
- }, fe = (e) => {
465
- const t = e.split(".").pop(), s = e.split(".").shift();
466
- if (!t || !s)
467
- throw new Error(`Invalid flattened key: ${e}`);
468
- return { mainKey: s, childKey: t };
469
- }, P = (e, t, s) => (e.setProperty(t), s !== t && e.setSubProperty(s), e), M = (e) => {
470
- if (typeof e == "string") {
471
- const t = it[e];
553
+ }, de = (s) => {
554
+ const t = s.split(".").pop(), e = s.split(".").shift();
555
+ if (!t || !e)
556
+ throw new Error(`Invalid flattened key: ${s}`);
557
+ return { mainKey: e, childKey: t };
558
+ }, P = (s, t, e) => (s.setProperty(t), e !== t && s.setSubProperty(e), s), M = (s) => {
559
+ if (typeof s == "string") {
560
+ const t = rt[s];
472
561
  return typeof t == "function" && t.length <= 1 ? t : void 0;
473
- } else if (e == null)
562
+ } else if (s == null)
474
563
  return;
475
- return e;
564
+ return s;
476
565
  };
477
- function pe(e, { start: t, stop: s, value: n }) {
478
- const i = t.targets?.[0] ?? s.targets?.[0];
479
- if (!i)
566
+ function ft(s, { start: t, stop: e, value: i }) {
567
+ const r = t.targets?.[0] ?? e.targets?.[0];
568
+ if (!r)
480
569
  throw new Error(
481
570
  "Cannot interpolate computed values without a target element."
482
571
  );
483
- const o = z(t, i), r = z(s, i), a = U.includes(o.unit) ? r.unit : o.unit, u = E(e, o.value, r.value);
484
- return n.value = u, n.unit = a, n;
572
+ const o = q(t, r), n = q(e, r), u = $.includes(o.unit) ? n.unit : o.unit, a = I(s, o.value, n.value);
573
+ return i.value = a, i.unit = u, i;
485
574
  }
486
- function me(e, { start: t, stop: s, value: n }) {
487
- return t.value.keys().forEach((i) => {
488
- const o = t.value[i], r = s.value[i], a = o instanceof f ? o.value : o, u = r instanceof f ? r.value : r, c = E(e, a, u), l = n.value[i];
489
- l instanceof f ? l.value = c : n.value[i] = c;
490
- }), n;
575
+ function pt(s, { start: t, stop: e, value: i }) {
576
+ return t.value.keys().forEach((r) => {
577
+ const o = t.value[r], n = e.value[r], u = o instanceof f ? o.value : o, a = n instanceof f ? n.value : n, c = I(s, u, a), l = i.value[r];
578
+ l instanceof f ? l.value = c : i.value[r] = c;
579
+ }), i;
491
580
  }
492
- function de(e, t) {
493
- const { start: s, stop: n, computed: i } = t;
494
- return typeof s.value == "number" && typeof n.value == "number" ? t.value.value = E(e, s.value, n.value) : s.unit === "color" ? me(e, t) : i && pe(e, t), t;
581
+ function ge(s, { start: t, stop: e, value: i }) {
582
+ return i.value = I(s, t.value, e.value), i;
495
583
  }
496
- const G = /* @__PURE__ */ new Map();
497
- function ge(e) {
498
- const t = rt(e), s = (i, o) => {
499
- const { childKey: r, mainKey: a } = fe(i);
584
+ function ye(s, t) {
585
+ const e = t._lerp;
586
+ if (e)
587
+ return e(s, t), t;
588
+ const { start: i, stop: r, computed: o } = t;
589
+ return typeof i.value == "number" && typeof r.value == "number" ? t.value.value = I(s, i.value, r.value) : i.unit === "color" ? pt(s, t) : o && ft(s, t), t;
590
+ }
591
+ const Z = /* @__PURE__ */ new Map();
592
+ function we(s) {
593
+ const t = nt(s), e = (r, o) => {
594
+ const { childKey: n, mainKey: u } = de(r);
500
595
  if (o instanceof f)
501
596
  return P(
502
- new V(...b(o)),
503
- a,
504
- r
597
+ new T(...v(o)),
598
+ u,
599
+ n
505
600
  );
506
- if (o instanceof x) {
601
+ if (o instanceof U) {
507
602
  const p = o.values.flatMap(
508
- (y) => b(s(i, y))
603
+ (y) => v(e(r, y))
509
604
  );
510
605
  return P(
511
- new V(...p),
512
- a,
513
- r
606
+ new T(...p),
607
+ u,
608
+ n
514
609
  );
515
- } else if (o instanceof V) {
610
+ } else if (o instanceof T) {
516
611
  const p = o.flatMap(
517
- (y) => b(s(i, y))
612
+ (y) => v(e(r, y))
518
613
  );
519
614
  return P(
520
- new V(...p),
521
- a,
522
- r
615
+ new T(...p),
616
+ u,
617
+ n
523
618
  );
524
619
  }
525
- const u = String(o), c = `${r}:${u}`, l = G.get(c);
620
+ const a = String(o), c = `${n}:${a}`, l = Z.get(c);
526
621
  if (l)
527
- return P(l.clone(), a, r);
622
+ return P(l.clone(), u, n);
528
623
  const h = F(
529
- I(
530
- L.FunctionArgs.map((p) => (p.setSubProperty(r), p)),
531
- L.Value
624
+ C(
625
+ W.FunctionArgs.map((p) => (p.setSubProperty(n), p)),
626
+ W.Value
532
627
  ),
533
- u
534
- ), d = P(
535
- new V(...b(h)),
536
- a,
537
- r
628
+ a
629
+ ), m = P(
630
+ new T(...v(h)),
631
+ u,
632
+ n
538
633
  );
539
- return G.set(c, d.clone()), d;
634
+ return Z.set(c, m.clone()), m;
540
635
  };
541
636
  return Object.entries(t).reduce(
542
- (i, [o, r]) => (i[o] = s(o, r), i),
637
+ (r, [o, n]) => (r[o] = e(o, n), r),
543
638
  {}
544
639
  );
545
640
  }
546
- const ye = (e, t, s, n, i = "oklab", o) => {
547
- const r = n[t], a = n[s];
548
- if (!r || !a)
641
+ const Ve = (s, t, e, i, r = "oklab", o) => {
642
+ const n = i[t], u = i[e];
643
+ if (!n || !u)
549
644
  throw new Error(
550
- `Invalid interpolation frame bounds (${t} -> ${s}).`
645
+ `Invalid interpolation frame bounds (${t} -> ${e}).`
551
646
  );
552
- const u = r[e], c = a[e];
553
- if (!u || !c)
554
- throw new Error(`Missing variable "${e}" in interpolation bounds.`);
555
- const l = Math.max(u.length, c.length), h = (y) => {
556
- const S = y.map((T) => {
557
- if (!(T instanceof f))
647
+ const a = n[s], c = u[s];
648
+ if (!a || !c)
649
+ throw new Error(`Missing variable "${s}" in interpolation bounds.`);
650
+ const l = Math.max(a.length, c.length), h = (y) => {
651
+ const b = y.map((S) => {
652
+ if (!(S instanceof f))
558
653
  throw new TypeError(
559
- `Interpolation for "${e}" requires ValueUnit leaves.`
654
+ `Interpolation for "${s}" requires ValueUnit leaves.`
560
655
  );
561
- return T;
656
+ return S;
562
657
  });
563
- for (; S.length < l; )
564
- S.push(new f(0));
565
- return S;
566
- }, d = h(u), p = h(c);
567
- return d.map((y, S) => {
568
- const T = p[S];
569
- if (!T)
658
+ for (; b.length < l; )
659
+ b.push(new f(0));
660
+ return b;
661
+ }, m = h(a), p = h(c);
662
+ return m.map((y, b) => {
663
+ const S = p[b];
664
+ if (!S)
570
665
  throw new Error(
571
- `Missing right-hand interpolation value at index ${S}.`
666
+ `Missing right-hand interpolation value at index ${b}.`
572
667
  );
573
- if (!(y instanceof f) || !(T instanceof f))
668
+ if (!(y instanceof f) || !(S instanceof f))
574
669
  throw new TypeError(
575
- `Interpolation for "${e}" requires ValueUnit leaves.`
670
+ `Interpolation for "${s}" requires ValueUnit leaves.`
576
671
  );
577
- return he(y, T, i, o);
672
+ const O = me(y, S, r, o);
673
+ return O._lerp = O.computed ? ft : O.start.unit === "color" ? pt : ge, O;
578
674
  });
579
675
  };
580
- function we(e, t, s) {
581
- const [n, i] = [e.start, t.start];
676
+ function Te(s, t, e) {
677
+ const [i, r] = [s.start, t.start];
582
678
  return {
583
- start: n.value * s / 100,
584
- stop: i.value * s / 100
679
+ start: i.value * e / 100,
680
+ stop: r.value * e / 100
585
681
  };
586
682
  }
587
- function ht(e, t, s = !0) {
588
- e = s ? e : rt(e);
589
- const n = ot(e);
590
- t.forEach((i) => {
591
- Object.entries(n).forEach(([o, r]) => {
592
- i.style.setProperty(o, r);
683
+ function mt(s, t, e = !0) {
684
+ s = e ? s : nt(s);
685
+ const i = ot(s);
686
+ t.forEach((r) => {
687
+ Object.entries(i).forEach(([o, n]) => {
688
+ r.style.setProperty(o, n);
593
689
  });
594
690
  });
595
691
  }
596
- const Ve = (e) => e;
692
+ const be = (s) => s;
597
693
  class Se {
598
694
  keyframes;
599
695
  segments;
600
696
  positions;
601
697
  timingFn;
602
698
  result;
603
- constructor(t, s) {
699
+ _duration;
700
+ // Playback state
701
+ _rafId = null;
702
+ _resolve = null;
703
+ _startTime = void 0;
704
+ constructor(t, e) {
604
705
  if (t.length < 2)
605
706
  throw new Error(
606
707
  "NumericAnimation requires at least 2 keyframes."
607
708
  );
608
- if (this.keyframes = t.map((n) => ({ ...n })), this.timingFn = (s?.timingFunction ? M(s.timingFunction) : void 0) ?? Ve, s?.positions) {
609
- if (s.positions.length !== t.length)
709
+ if (this.keyframes = t.map((i) => ({ ...i })), this._duration = e?.duration ?? 0, this.timingFn = (e?.timingFunction ? M(e.timingFunction) : void 0) ?? be, e?.positions) {
710
+ if (e.positions.length !== t.length)
610
711
  throw new Error(
611
712
  "positions length must match keyframes length."
612
713
  );
613
- this.positions = s.positions;
714
+ this.positions = e.positions;
614
715
  } else
615
716
  this.positions = t.map(
616
- (n, i) => i / (t.length - 1) * 100
717
+ (i, r) => r / (t.length - 1) * 100
617
718
  );
618
719
  this.result = { ...t[0] }, this.segments = this.buildSegments();
619
720
  }
620
721
  buildSegments() {
621
722
  const t = [];
622
- for (let s = 0; s < this.keyframes.length - 1; s++)
623
- t.push(this.buildSegment(s));
723
+ for (let e = 0; e < this.keyframes.length - 1; e++)
724
+ t.push(this.buildSegment(e));
624
725
  return t;
625
726
  }
626
727
  buildSegment(t) {
627
- const s = this.keyframes[t], n = this.keyframes[t + 1], i = Object.keys(s);
728
+ const e = this.keyframes[t], i = this.keyframes[t + 1], r = Object.keys(e);
628
729
  return {
629
730
  startPos: this.positions[t],
630
731
  stopPos: this.positions[t + 1],
631
- keys: i,
632
- startVals: i.map((o) => s[o]),
633
- stopVals: i.map((o) => n[o]),
732
+ keys: r,
733
+ startVals: r.map((o) => e[o]),
734
+ stopVals: r.map((o) => i[o]),
634
735
  timingFunction: this.timingFn
635
736
  };
636
737
  }
637
- /** Map [0, 1] progress to interpolated values. Zero allocation. */
738
+ /**
739
+ * Map [0, 1] progress to interpolated values. Zero allocation —
740
+ * returns the same pre-allocated result object on every call.
741
+ *
742
+ * Uses O(log N) binary search over segments. Falls back to the
743
+ * last segment if progress is past the final stop position.
744
+ */
638
745
  at(t) {
639
- const s = C(t, 0, 1) * 100;
640
- let n = this.segments[0];
641
- for (let r = 0; r < this.segments.length; r++) {
642
- const a = this.segments[r];
643
- if (s >= a.startPos && s <= a.stopPos) {
644
- n = a;
645
- break;
646
- }
647
- r === this.segments.length - 1 && (n = a);
648
- }
649
- const i = at(
650
- C(s, n.startPos, n.stopPos),
651
- n.startPos,
652
- n.stopPos,
746
+ const e = E(t, 0, 1) * 100;
747
+ let i = lt(
748
+ this.segments,
749
+ e,
750
+ (u) => u.startPos,
751
+ (u) => u.stopPos
752
+ );
753
+ i === -1 && (i = this.segments.length - 1);
754
+ const r = this.segments[i], o = at(
755
+ E(e, r.startPos, r.stopPos),
756
+ r.startPos,
757
+ r.stopPos,
653
758
  0,
654
759
  1
655
- ), o = n.timingFunction(i);
656
- for (let r = 0; r < n.keys.length; r++)
657
- this.result[n.keys[r]] = E(
658
- o,
659
- n.startVals[r],
660
- n.stopVals[r]
760
+ ), n = r.timingFunction(o);
761
+ for (let u = 0; u < r.keys.length; u++)
762
+ this.result[r.keys[u]] = I(
763
+ n,
764
+ r.startVals[u],
765
+ r.stopVals[u]
661
766
  );
662
767
  return this.result;
663
768
  }
664
769
  /** Update a keyframe's values in-place, recomputing adjacent segments. */
665
- updateKeyframe(t, s) {
770
+ updateKeyframe(t, e) {
666
771
  if (t < 0 || t >= this.keyframes.length)
667
772
  throw new RangeError(
668
773
  `Keyframe index ${t} out of range [0, ${this.keyframes.length - 1}].`
669
774
  );
670
- return Object.assign(this.keyframes[t], s), t > 0 && (this.segments[t - 1] = this.buildSegment(t - 1)), t < this.keyframes.length - 1 && (this.segments[t] = this.buildSegment(t)), this;
775
+ return Object.assign(this.keyframes[t], e), t > 0 && (this.segments[t - 1] = this.buildSegment(t - 1)), t < this.keyframes.length - 1 && (this.segments[t] = this.buildSegment(t)), this;
776
+ }
777
+ // ── Playback ─────────────────────────────────────────────────────
778
+ /**
779
+ * Play the animation over its duration using requestAnimationFrame.
780
+ *
781
+ * Calls `onFrame` each frame with the interpolated values (the same
782
+ * zero-allocation object returned by `.at()`). Returns a Promise that
783
+ * resolves when the animation completes or is stopped.
784
+ *
785
+ * @param onFrame — optional per-frame callback receiving interpolated values
786
+ * @param duration — override the duration set in constructor options (ms)
787
+ */
788
+ play(t, e) {
789
+ const i = e ?? this._duration;
790
+ if (i <= 0)
791
+ throw new Error(
792
+ "NumericAnimation.play() requires a duration > 0. Pass it in the constructor options or as a parameter to play()."
793
+ );
794
+ return this.stop(), new Promise((r) => {
795
+ this._resolve = r, this._startTime = void 0;
796
+ const o = (n) => {
797
+ this._startTime === void 0 && (this._startTime = n);
798
+ const u = E((n - this._startTime) / i, 0, 1), a = this.at(u);
799
+ t?.(a), u < 1 ? this._rafId = w(o) : this._cleanup();
800
+ };
801
+ this._rafId = w(o);
802
+ });
803
+ }
804
+ /** Cancel a running `.play()` animation. The play promise resolves immediately. */
805
+ stop() {
806
+ this._rafId !== null && k(this._rafId), this._cleanup();
807
+ }
808
+ _cleanup() {
809
+ this._rafId = null, this._startTime = void 0;
810
+ const t = this._resolve;
811
+ this._resolve = null, t?.();
671
812
  }
672
813
  }
673
- const Te = {
814
+ const ve = {
674
815
  damping: 0.1,
675
816
  snapThreshold: 1e-3,
817
+ targetEpsilon: 0,
676
818
  initial: 0,
677
819
  clamp: !0
678
820
  };
679
- class be {
821
+ class Fe {
680
822
  options;
681
823
  targetValue;
682
824
  currentValue;
683
825
  isSettled;
684
826
  constructor(t) {
685
- this.options = { ...Te, ...t }, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.isSettled = !0;
827
+ this.options = { ...ve, ...t }, this.targetValue = this.options.initial, this.currentValue = this.options.initial, this.isSettled = !0;
686
828
  }
687
829
  get target() {
688
830
  return this.targetValue;
@@ -694,7 +836,9 @@ class be {
694
836
  return this.isSettled;
695
837
  }
696
838
  setTarget(t) {
697
- this.options.clamp && (t = Math.max(0, Math.min(1, t))), t !== this.targetValue && (this.targetValue = t, this.isSettled = !1);
839
+ this.options.clamp && (t = Math.max(0, Math.min(1, t)));
840
+ const e = Math.abs(t - this.targetValue);
841
+ e > 0 && e >= this.options.targetEpsilon && (this.targetValue = t, this.isSettled = !1);
698
842
  }
699
843
  /** Advance one step using fixed damping. Returns current value. */
700
844
  tick() {
@@ -706,8 +850,8 @@ class be {
706
850
  /** Frame-rate independent tick. dt is in milliseconds. */
707
851
  tickDt(t) {
708
852
  if (this.isSettled) return this.currentValue;
709
- const s = 1 - Math.exp(-this.options.damping * t / 16.667);
710
- return this.currentValue += (this.targetValue - this.currentValue) * s, Math.abs(this.targetValue - this.currentValue) < this.options.snapThreshold && (this.currentValue = this.targetValue, this.isSettled = !0), this.options.clamp && (this.currentValue = Math.max(
853
+ const e = 1 - Math.exp(-this.options.damping * t / 16.667);
854
+ return this.currentValue += (this.targetValue - this.currentValue) * e, Math.abs(this.targetValue - this.currentValue) < this.options.snapThreshold && (this.currentValue = this.targetValue, this.isSettled = !0), this.options.clamp && (this.currentValue = Math.max(
711
855
  0,
712
856
  Math.min(1, this.currentValue)
713
857
  )), this.currentValue;
@@ -718,33 +862,34 @@ class be {
718
862
  }
719
863
  /** Reset to a specific value (default 0). */
720
864
  reset(t) {
721
- const s = t ?? 0;
722
- this.targetValue = s, this.currentValue = s, this.isSettled = !0;
865
+ const e = t ?? 0;
866
+ this.targetValue = e, this.currentValue = e, this.isSettled = !0;
723
867
  }
724
868
  }
725
- const Z = (e) => {
726
- if (e instanceof HTMLElement) {
727
- const t = e.getBoundingClientRect();
869
+ const Q = (s) => {
870
+ if (s instanceof HTMLElement) {
871
+ const t = s.getBoundingClientRect();
728
872
  return { x: t.x, y: t.y, width: t.width, height: t.height };
729
873
  }
730
- return e;
874
+ return s;
731
875
  };
732
- class je {
876
+ class Ue {
733
877
  animation;
734
878
  transformOrigin;
735
879
  timingFunction;
736
- constructor(t, s, n) {
737
- this.transformOrigin = n?.transformOrigin ?? "top left", this.timingFunction = n?.timingFunction, this.measure(t, s);
880
+ duration;
881
+ constructor(t, e, i) {
882
+ this.transformOrigin = i?.transformOrigin ?? "top left", this.timingFunction = i?.timingFunction, this.duration = i?.duration ?? 0, this.measure(t, e);
738
883
  }
739
884
  /** Re-measure source and destination, rebuilding the internal animation. */
740
- measure(t, s) {
741
- const n = Z(t), i = Z(s), o = i.x - n.x, r = i.y - n.y, a = n.width === 0 ? 1 : i.width / n.width, u = n.height === 0 ? 1 : i.height / n.height;
885
+ measure(t, e) {
886
+ const i = Q(t), r = Q(e), o = r.x - i.x, n = r.y - i.y, u = i.width === 0 ? 1 : r.width / i.width, a = i.height === 0 ? 1 : r.height / i.height;
742
887
  return this.animation = new Se(
743
888
  [
744
889
  { translateX: 0, translateY: 0, scaleX: 1, scaleY: 1 },
745
- { translateX: o, translateY: r, scaleX: a, scaleY: u }
890
+ { translateX: o, translateY: n, scaleX: u, scaleY: a }
746
891
  ],
747
- { timingFunction: this.timingFunction }
892
+ { timingFunction: this.timingFunction, duration: this.duration }
748
893
  ), this;
749
894
  }
750
895
  /** Get raw transform values at the given progress [0, 1]. */
@@ -753,38 +898,74 @@ class je {
753
898
  }
754
899
  /** Get a CSS transform string at the given progress [0, 1]. */
755
900
  toCSSTransform(t) {
756
- const { translateX: s, translateY: n, scaleX: i, scaleY: o } = this.animation.at(t);
757
- return `translate(${s}px, ${n}px) scale(${i}, ${o})`;
901
+ const { translateX: e, translateY: i, scaleX: r, scaleY: o } = this.animation.at(t);
902
+ return `translate(${e}px, ${i}px) scale(${r}, ${o})`;
758
903
  }
759
904
  /** Apply the morph transform to an element at the given progress [0, 1]. */
760
- apply(t, s) {
761
- t.style.transform = this.toCSSTransform(s), t.style.transformOrigin = this.transformOrigin;
905
+ apply(t, e) {
906
+ t.style.transform = this.toCSSTransform(e), t.style.transformOrigin = this.transformOrigin;
907
+ }
908
+ /**
909
+ * Animate an element from source to destination over the configured duration.
910
+ *
911
+ * @param element — the element to apply transforms to
912
+ * @param duration — override the duration set in constructor options (ms)
913
+ */
914
+ play(t, e) {
915
+ return this.animation.play((i) => {
916
+ const { translateX: r, translateY: o, scaleX: n, scaleY: u } = i;
917
+ t.style.transform = `translate(${r}px, ${o}px) scale(${n}, ${u})`, t.style.transformOrigin = this.transformOrigin;
918
+ }, e ?? this.duration);
919
+ }
920
+ /** Cancel a running `.play()` animation. */
921
+ stop() {
922
+ this.animation.stop();
762
923
  }
763
924
  }
764
- const ve = (e) => {
765
- if (e == null) return null;
766
- if (typeof e == "function") return e;
767
- const t = it[e];
925
+ const Ie = (s) => {
926
+ if (s == null) return null;
927
+ if (typeof s == "function") return s;
928
+ const t = rt[s];
768
929
  return typeof t == "function" && t.length <= 1 ? t : null;
769
- }, q = (e) => Math.max(0, Math.min(1, e));
770
- class ft {
930
+ }, Pe = (s) => Math.max(0, Math.min(1, s));
931
+ class dt {
771
932
  smoother;
772
933
  easingFn;
773
934
  currentProgress = 0;
935
+ boundaryEpsilon;
774
936
  constructor(t) {
775
- this.easingFn = ve(t?.easing), t?.smoothing === !1 ? this.smoother = null : this.smoother = new be(
937
+ this.easingFn = Ie(t?.easing), this.boundaryEpsilon = t?.boundaryEpsilon ?? 5e-3, t?.smoothing === !1 ? this.smoother = null : this.smoother = new Fe(
776
938
  t?.smoothing
777
939
  );
778
940
  }
779
- /** Advance one frame. Applies easing -> boundary snap -> smoothing. */
941
+ /**
942
+ * Shared progress pipeline: sample → clamp → easing → boundary snap.
943
+ * Returns the processed raw value. Does NOT advance the smoother —
944
+ * the caller (tick or tickDt) drives the smoother with the appropriate
945
+ * time-step method.
946
+ */
947
+ applyPipeline() {
948
+ let t = Pe(this.sample());
949
+ this.easingFn && (t = this.easingFn(t));
950
+ const e = this.boundaryEpsilon;
951
+ return t <= e ? t = 0 : t >= 1 - e && (t = 1), t;
952
+ }
953
+ /**
954
+ * Finalize progress after the smoother has been advanced (or bypassed).
955
+ * Snaps the smoother at boundaries [0, 1] for instant convergence.
956
+ */
957
+ finalizeProgress(t) {
958
+ return this.smoother && (this.smoother.setTarget(t), (t <= 0 || t >= 1) && this.smoother.snap()), this.currentProgress = this.smoother ? this.smoother.current : t, this.currentProgress;
959
+ }
960
+ /** Advance one frame. Applies easing → boundary snap → smoothing. */
780
961
  tick() {
781
- let t = q(this.sample());
782
- return this.easingFn && (t = this.easingFn(t)), this.smoother ? (this.smoother.setTarget(t), t <= 0 || t >= 1 ? this.smoother.snap() : this.smoother.tick(), this.currentProgress = this.smoother.current) : this.currentProgress = t, this.currentProgress;
962
+ const t = this.applyPipeline();
963
+ return this.smoother && t > 0 && t < 1 ? (this.smoother.setTarget(t), this.smoother.tick(), this.currentProgress = this.smoother.current) : this.finalizeProgress(t), this.currentProgress;
783
964
  }
784
- /** Frame-rate independent variant. dt in ms. */
965
+ /** Frame-rate independent variant. `dt` in milliseconds. */
785
966
  tickDt(t) {
786
- let s = q(this.sample());
787
- return this.easingFn && (s = this.easingFn(s)), this.smoother ? (this.smoother.setTarget(s), s <= 0 || s >= 1 ? this.smoother.snap() : this.smoother.tickDt(t), this.currentProgress = this.smoother.current) : this.currentProgress = s, this.currentProgress;
967
+ const e = this.applyPipeline();
968
+ return this.smoother && e > 0 && e < 1 ? (this.smoother.setTarget(e), this.smoother.tickDt(t), this.currentProgress = this.smoother.current) : this.finalizeProgress(e), this.currentProgress;
788
969
  }
789
970
  get progress() {
790
971
  return this.currentProgress;
@@ -799,11 +980,11 @@ class ft {
799
980
  }
800
981
  /** Reset progress to a specific value (default 0). */
801
982
  reset(t) {
802
- const s = t ?? 0;
803
- this.smoother && this.smoother.reset(s), this.currentProgress = s;
983
+ const e = t ?? 0;
984
+ this.smoother && this.smoother.reset(e), this.currentProgress = e;
804
985
  }
805
986
  }
806
- class xe extends ft {
987
+ class $e extends dt {
807
988
  threshold;
808
989
  getScrollY;
809
990
  getViewportHeight;
@@ -815,7 +996,7 @@ class xe extends ft {
815
996
  return t <= 0 ? 0 : this.getScrollY() / t;
816
997
  }
817
998
  }
818
- class Ue extends ft {
999
+ class De extends dt {
819
1000
  value = 0;
820
1001
  constructor(t) {
821
1002
  super({ smoothing: !1, ...t });
@@ -828,59 +1009,59 @@ class Ue extends ft {
828
1009
  return this.value;
829
1010
  }
830
1011
  }
831
- const Fe = (e) => typeof e.transform == "function", Q = (e) => typeof e == "string" && U.includes(e);
832
- function Pe(e) {
833
- if (!e.targets || e.targets.length === 0)
1012
+ const Ee = (s) => typeof s.transform == "function", J = (s) => typeof s == "string" && $.includes(s);
1013
+ function Ce(s) {
1014
+ if (!s.targets || s.targets.length === 0)
834
1015
  return !1;
835
- const t = Fe(e) ? e.transform : void 0;
836
- for (const s of e.frames) {
837
- const n = s.transform;
838
- if (n !== ht && n !== t)
1016
+ const t = Ee(s) ? s.transform : void 0;
1017
+ for (const e of s.frames) {
1018
+ const i = e.transform;
1019
+ if (i !== mt && i !== t)
839
1020
  return !1;
840
1021
  }
841
- if (e.frames.length > 1) {
842
- const s = e.frames[0].timingFunction;
843
- for (let n = 1; n < e.frames.length; n++)
844
- if (e.frames[n].timingFunction !== s)
1022
+ if (s.frames.length > 1) {
1023
+ const e = s.frames[0].timingFunction;
1024
+ for (let i = 1; i < s.frames.length; i++)
1025
+ if (s.frames[i].timingFunction !== e)
845
1026
  return !1;
846
1027
  }
847
- for (const s of e.frames)
848
- for (const n of Object.values(s.interpVars))
849
- for (const i of n) {
850
- const o = i.start?.unit, r = i.stop?.unit;
851
- if (Q(o) || Q(r))
1028
+ for (const e of s.frames)
1029
+ for (const i of Object.values(e.interpVars))
1030
+ for (const r of i) {
1031
+ const o = r.start?.unit, n = r.stop?.unit;
1032
+ if (J(o) || J(n))
852
1033
  return !1;
853
1034
  }
854
- for (const s of e.frames)
855
- for (const n of Object.values(s.interpVars))
856
- for (const i of n)
857
- if (i.start?.unit === "color" || i.stop?.unit === "color")
1035
+ for (const e of s.frames)
1036
+ for (const i of Object.values(e.interpVars))
1037
+ for (const r of i)
1038
+ if (r.start?.unit === "color" || r.stop?.unit === "color")
858
1039
  return !1;
859
1040
  return !0;
860
1041
  }
861
- function Ee(e) {
862
- const t = e.options.duration, s = [], n = /* @__PURE__ */ new Set();
863
- for (const o of e.frames)
864
- n.add(o.time.start), n.add(o.time.stop);
865
- const i = [...n].sort((o, r) => o - r);
866
- for (const o of i) {
867
- const r = e.interpFrames(o, !1);
868
- if (Object.keys(r).length === 0) continue;
869
- const a = ot(r), u = {
1042
+ function Oe(s) {
1043
+ const t = s.options.duration, e = [], i = /* @__PURE__ */ new Set();
1044
+ for (const o of s.frames)
1045
+ i.add(o.time.start), i.add(o.time.stop);
1046
+ const r = [...i].sort((o, n) => o - n);
1047
+ for (const o of r) {
1048
+ const n = s.interpFrames(o, !1);
1049
+ if (Object.keys(n).length === 0) continue;
1050
+ const u = ot(n), a = {
870
1051
  offset: Math.max(0, Math.min(1, o / t)),
871
- ...a
1052
+ ...u
872
1053
  };
873
- s.push(u);
1054
+ e.push(a);
874
1055
  }
875
- return s;
1056
+ return e;
876
1057
  }
877
- function Ie(e) {
878
- const t = e.options, s = {
1058
+ function _e(s) {
1059
+ const t = s.options, e = {
879
1060
  normal: "normal",
880
1061
  reverse: "reverse",
881
1062
  alternate: "alternate",
882
1063
  "alternate-reverse": "alternate-reverse"
883
- }, n = {
1064
+ }, i = {
884
1065
  none: "none",
885
1066
  forwards: "forwards",
886
1067
  backwards: "backwards",
@@ -891,25 +1072,25 @@ function Ie(e) {
891
1072
  delay: t.delay,
892
1073
  iterations: t.iterationCount === 1 / 0 ? 1 / 0 : t.iterationCount,
893
1074
  // TODO(HIGH): Remove enum fallbacks; throw when direction/fill values are outside supported WAAPI maps.
894
- direction: s[t.direction] ?? "normal",
895
- fill: n[t.fillMode] ?? "forwards",
1075
+ direction: e[t.direction] ?? "normal",
1076
+ fill: i[t.fillMode] ?? "forwards",
896
1077
  // WAAPI easing is set per-animation — we use the frame's timing function name
897
1078
  // For custom functions we fall back to linear (the JS interpolation handles easing)
898
1079
  easing: "linear"
899
1080
  };
900
1081
  }
901
- async function Oe(e) {
902
- const t = Ee(e), s = Ie(e), n = [];
903
- for (const i of e.targets) {
904
- const o = i.animate(t, s);
905
- n.push(o);
1082
+ async function ke(s) {
1083
+ const t = Oe(s), e = _e(s), i = [];
1084
+ for (const r of s.targets) {
1085
+ const o = r.animate(t, e);
1086
+ i.push(o);
906
1087
  }
907
- return await Promise.all(n.map((i) => i.finished)), n;
1088
+ return await Promise.all(i.map((r) => r.finished)), i;
908
1089
  }
909
- const Ce = (e) => typeof e != "object" || e == null ? !1 : typeof e.clone == "function", k = (e) => typeof e == "string" ? e : e.name ?? String(e.id);
910
- let Me = 0;
911
- class pt {
912
- id = Me++;
1090
+ const Me = (s) => typeof s != "object" || s == null ? !1 : typeof s.clone == "function", x = (s) => typeof s == "string" ? s : s.name ?? String(s.id);
1091
+ let Ae = 0;
1092
+ class gt {
1093
+ id = Ae++;
913
1094
  name;
914
1095
  superKey;
915
1096
  targets;
@@ -933,126 +1114,160 @@ class pt {
933
1114
  unflatten = !0;
934
1115
  resolvePromise = null;
935
1116
  _playingPromise = null;
1117
+ /**
1118
+ * Pre-bound draw callback — allocated once to avoid creating a new
1119
+ * closure on every requestAnimationFrame reschedule.
1120
+ */
1121
+ _boundDraw = this.draw.bind(this);
936
1122
  dispatchAnimationEvent(t) {
937
1123
  if (!(typeof AnimationEvent > "u"))
938
- for (const s of this.targets)
939
- typeof s?.dispatchEvent == "function" && s.dispatchEvent(
1124
+ for (const e of this.targets)
1125
+ typeof e?.dispatchEvent == "function" && e.dispatchEvent(
940
1126
  new AnimationEvent(t, {
941
1127
  animationName: this.name ?? "",
942
1128
  elapsedTime: this.t / 1e3
943
1129
  })
944
1130
  );
945
1131
  }
946
- constructor(t, s, n, i) {
947
- this.options = {}, this.setOptions({ ...qt, ...t ?? {} }), this.targets = s == null ? [] : Array.isArray(s) ? s : [s], this.name = n, this.superKey = i;
1132
+ constructor(t, e, i, r) {
1133
+ this.options = {}, this.setOptions({ ...te, ...t ?? {} }), this.targets = e == null ? [] : Array.isArray(e) ? e : [e], this.name = i, this.superKey = r;
948
1134
  }
949
1135
  convertFrameStart(t) {
950
1136
  if (t.start.unit === "s" || t.start.unit === "ms" || !t.start.unit) {
951
- const s = t.start.unit === "s" ? "s" : "ms", n = nt(t.start.value, s);
952
- t.start.value = n / this.options.duration * 100, t.start.unit = "%";
1137
+ const e = t.start.unit === "s" ? "s" : "ms", i = it(t.start.value, e);
1138
+ t.start.value = i / this.options.duration * 100, t.start.unit = "%";
953
1139
  }
954
- return t.start.value = C(t.start.value, 0, 100), t;
1140
+ return t.start.value = E(t.start.value, 0, 100), t;
955
1141
  }
956
- addFrame(t, s, n, i) {
1142
+ addFrame(t, e, i, r) {
957
1143
  typeof t == "number" ? t = String(t) + "%" : typeof t == "string" ? t = t : t instanceof f && (t = String(t));
958
1144
  const o = st(t);
959
- let r = {
1145
+ let n = {
960
1146
  id: this.frameId,
961
1147
  start: o,
962
- vars: s,
963
- transform: n,
964
- timingFunction: M(i) ?? this.options.timingFunction
1148
+ vars: e,
1149
+ transform: i,
1150
+ timingFunction: M(r) ?? this.options.timingFunction
965
1151
  };
966
1152
  return this.convertFrameStart(
967
- r
1153
+ n
968
1154
  ), this.templateFrames.push(
969
- r
1155
+ n
970
1156
  ), this.frameId += 1, this;
971
1157
  }
972
- createFrame(t, s) {
973
- const n = this.templateFrames[t], i = this.templateFrames[s], o = {
1158
+ createFrame(t, e) {
1159
+ const i = this.templateFrames[t], r = this.templateFrames[e], o = {
974
1160
  start: t,
975
- stop: s
976
- }, r = we(n, i, this.options.duration);
977
- let a = n.transform;
978
- if (a == null) {
979
- const l = R(
1161
+ stop: e
1162
+ }, n = Te(i, r, this.options.duration);
1163
+ let u = i.transform;
1164
+ if (u == null) {
1165
+ const l = B(
980
1166
  t,
981
1167
  this.frames,
982
1168
  (h) => h.transform != null
983
1169
  );
984
- a = this.frames[l].transform;
1170
+ u = this.frames[l].transform;
985
1171
  }
986
- let u = n.timingFunction;
987
- if (u == null) {
988
- const l = R(
1172
+ let a = i.timingFunction;
1173
+ if (a == null) {
1174
+ const l = B(
989
1175
  t,
990
1176
  this.frames,
991
1177
  (h) => h.timingFunction != null
992
1178
  );
993
- u = this.frames[l].timingFunction;
1179
+ a = this.frames[l].timingFunction;
994
1180
  }
995
1181
  return {
996
1182
  id: this.frameId++,
997
1183
  ixs: o,
998
- start: n.start,
999
- time: r,
1184
+ start: i.start,
1185
+ time: n,
1000
1186
  vars: void 0,
1001
1187
  flatVars: void 0,
1002
1188
  interpVars: {},
1003
- transform: a,
1004
- timingFunction: u
1189
+ allInterpVars: [],
1190
+ transform: u,
1191
+ timingFunction: a
1005
1192
  };
1006
1193
  }
1007
- reconcileVars(t) {
1008
- const s = this.parsedVars[t];
1009
- s && Object.keys(s).forEach((n) => {
1010
- const i = this.parsedVars.findIndex(
1011
- (c, l) => l > t && c[n] != null
1012
- );
1013
- if (i === -1)
1014
- return;
1015
- const [o, r] = [t, i], a = this.frames.findIndex(
1016
- (c) => c.ixs.start === o && c.ixs.stop === r
1017
- ), u = a !== -1 ? this.frames[a] : this.createFrame(o, r);
1018
- u.interpVars[n] = ye(
1019
- n,
1020
- o,
1021
- r,
1022
- this.parsedVars,
1023
- this.options.colorSpace,
1024
- this.options.hueMethod
1025
- ), a === -1 && this.frames.push(u);
1026
- });
1194
+ /**
1195
+ * Build an index mapping each variable name to the frame indices where
1196
+ * it appears. Used by reconcileVars() for O(1) "next occurrence" lookups
1197
+ * instead of O(N) findIndex scans per variable.
1198
+ */
1199
+ buildVarIndex() {
1200
+ const t = /* @__PURE__ */ new Map();
1201
+ for (let e = 0; e < this.parsedVars.length; e++)
1202
+ for (const i of Object.keys(this.parsedVars[e])) {
1203
+ let r = t.get(i);
1204
+ r || (r = [], t.set(i, r)), r.push(e);
1205
+ }
1206
+ return t;
1207
+ }
1208
+ /**
1209
+ * Reconcile interpolation variables across non-adjacent keyframes.
1210
+ * For each variable at frame `ix`, find the next frame that also
1211
+ * defines that variable and create an interpolation segment between them.
1212
+ *
1213
+ * Uses a pre-built variable index (from buildVarIndex) to avoid
1214
+ * O(frames²) findIndex scans.
1215
+ */
1216
+ reconcileVars(t, e) {
1217
+ const i = this.parsedVars[t];
1218
+ if (i)
1219
+ for (const r of Object.keys(i)) {
1220
+ const o = e.get(r);
1221
+ if (!o) continue;
1222
+ let n = -1;
1223
+ for (const h of o)
1224
+ if (h > t) {
1225
+ n = h;
1226
+ break;
1227
+ }
1228
+ if (n === -1) continue;
1229
+ const [u, a] = [t, n], c = this.frames.findIndex(
1230
+ (h) => h.ixs.start === u && h.ixs.stop === a
1231
+ ), l = c !== -1 ? this.frames[c] : this.createFrame(u, a);
1232
+ l.interpVars[r] = Ve(
1233
+ r,
1234
+ u,
1235
+ a,
1236
+ this.parsedVars,
1237
+ this.options.colorSpace,
1238
+ this.options.hueMethod
1239
+ ), c === -1 && this.frames.push(l);
1240
+ }
1027
1241
  }
1028
1242
  parse() {
1029
- this.frames = [], this.templateFrames.sort((t, s) => t.start.value - s.start.value), this.parsedVars = this.templateFrames.map((t) => {
1030
- const s = ge(
1031
- t.vars
1243
+ this.frames = [], this.templateFrames.sort((e, i) => e.start.value - i.start.value), this.parsedVars = this.templateFrames.map((e) => {
1244
+ const i = we(
1245
+ e.vars
1032
1246
  );
1033
- return Object.values(s).forEach((n) => {
1034
- n.setTargets(this.targets);
1035
- }), s;
1247
+ return Object.values(i).forEach((r) => {
1248
+ r.setTargets(this.targets);
1249
+ }), i;
1036
1250
  });
1037
- for (let t = 0; t < this.templateFrames.length - 1; t++)
1038
- this.frames.push(this.createFrame(t, t + 1));
1039
- return this.frames.forEach((t, s) => this.reconcileVars(s)), this.frames.sort((t, s) => t.time.start === s.time.start ? t.time.stop - s.time.stop : t.time.start - s.time.start), this.frames = this.frames.filter(
1040
- (t) => t.interpVars != null && Object.keys(t.interpVars).length > 0
1041
- ), this.frames.forEach((t) => {
1042
- const s = Object.entries(t.interpVars).reduce((n, [i, o]) => (n[i] = o.map((r) => r.value), n), {});
1043
- t.flatVars = s, t.vars = Et(t.flatVars);
1251
+ for (let e = 0; e < this.templateFrames.length - 1; e++)
1252
+ this.frames.push(this.createFrame(e, e + 1));
1253
+ const t = this.buildVarIndex();
1254
+ return this.frames.forEach((e, i) => this.reconcileVars(i, t)), this.frames.sort((e, i) => e.time.start === i.time.start ? e.time.stop - i.time.stop : e.time.start - i.time.start), this.frames = this.frames.filter(
1255
+ (e) => e.interpVars != null && Object.keys(e.interpVars).length > 0
1256
+ ), this.frames.forEach((e) => {
1257
+ const i = Object.entries(e.interpVars).reduce((r, [o, n]) => (r[o] = n.map((u) => u.value), r), {});
1258
+ e.flatVars = i, e.vars = Ot(e.flatVars), e.allInterpVars = Object.values(e.interpVars).flat();
1044
1259
  }), this;
1045
1260
  }
1046
1261
  setTimingFunction(t) {
1047
- return this.options.timingFunction = M(t) ?? tt, this;
1262
+ return this.options.timingFunction = M(t) ?? et, this;
1048
1263
  }
1049
1264
  setIterationCount(t) {
1050
1265
  if (!t || t === "infinite" || t === "∞" || t === "Infinity")
1051
1266
  this.options.iterationCount = 1 / 0;
1052
1267
  else if (typeof t == "string") {
1053
- const s = parseFloat(t.trim());
1054
- if (isNaN(s) || s < 0) return this;
1055
- this.options.iterationCount = s;
1268
+ const e = parseFloat(t.trim());
1269
+ if (isNaN(e) || e < 0) return this;
1270
+ this.options.iterationCount = e;
1056
1271
  } else {
1057
1272
  if (isNaN(t) || t < 0) return this;
1058
1273
  this.options.iterationCount = t;
@@ -1060,18 +1275,18 @@ class pt {
1060
1275
  return this;
1061
1276
  }
1062
1277
  setDuration(t) {
1063
- typeof t == "string" && (t = B(t));
1064
- const s = t ?? this.options.duration;
1065
- if (!isFinite(s) || s <= 0) return this;
1066
- const n = this.options.duration, i = s / n;
1278
+ typeof t == "string" && (t = L(t));
1279
+ const e = t ?? this.options.duration;
1280
+ if (!isFinite(e) || e <= 0) return this;
1281
+ const i = this.options.duration, r = e / i;
1067
1282
  for (let o = 0; o < this.frames.length; o++) {
1068
- const r = this.frames[o];
1069
- r.time.start *= i, r.time.stop *= i;
1283
+ const n = this.frames[o];
1284
+ n.time.start *= r, n.time.stop *= r;
1070
1285
  }
1071
- return this.options.duration = s, this;
1286
+ return this.options.duration = e, this;
1072
1287
  }
1073
1288
  setDelay(t) {
1074
- return typeof t == "string" && (t = B(t)), this.options.delay = t ?? 0, this;
1289
+ return typeof t == "string" && (t = L(t)), this.options.delay = t ?? 0, this;
1075
1290
  }
1076
1291
  setDirection(t) {
1077
1292
  return this.options.direction = t ?? "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;
@@ -1093,8 +1308,8 @@ class pt {
1093
1308
  }
1094
1309
  reverse() {
1095
1310
  if (this.startTime !== void 0) {
1096
- const t = this.t, s = this.options.duration - 2 * t;
1097
- this.startTime -= s;
1311
+ const t = this.t, e = this.options.duration - 2 * t;
1312
+ this.startTime -= e;
1098
1313
  }
1099
1314
  return this.reversed = !this.reversed, this;
1100
1315
  }
@@ -1108,32 +1323,56 @@ class pt {
1108
1323
  * Stateless progress query. Maps [0,1] from first keyframe to last,
1109
1324
  * regardless of playback direction. `apply=true` invokes transform callbacks.
1110
1325
  */
1111
- at(t, s = !1) {
1112
- const n = this.reversed;
1326
+ at(t, e = !1) {
1327
+ const i = this.reversed;
1113
1328
  this.reversed = !1;
1114
- const i = C(t, 0, 1) * this.options.duration, o = this.interpFrames(i, s);
1115
- return this.reversed = n, o;
1329
+ const r = E(t, 0, 1) * this.options.duration, o = this.interpFrames(r, e);
1330
+ return this.reversed = i, o;
1116
1331
  }
1117
- interpFrames(t, s = !1) {
1332
+ /**
1333
+ * Interpolate all active frames at time `t`. This is the hot path —
1334
+ * called once per rAF frame during playback.
1335
+ *
1336
+ * Uses binary search (O(log N)) to find the first matching frame,
1337
+ * then scans neighbors to collect all overlapping frames at `t`
1338
+ * (multiple properties may share the same time range).
1339
+ *
1340
+ * @param t - Current animation time in milliseconds
1341
+ * @param transformFrames - If true, applies each frame's transform function to targets
1342
+ * @returns Merged flat vars from all active frames
1343
+ */
1344
+ interpFrames(t, e = !1) {
1118
1345
  t = this.reversed ? this.options.duration - t : t;
1119
- const n = {};
1120
- for (let i = 0; i < this.frames.length; i++) {
1121
- const o = this.frames[i], { start: r, stop: a } = o.time;
1122
- if (t < r || t > a)
1123
- continue;
1124
- const u = at(t, r, a, 0, 1), c = o.timingFunction(u);
1125
- for (const l of Object.values(o.interpVars))
1126
- for (const h of l)
1127
- de(c, h);
1128
- s && o.transform(
1129
- this.unflatten ? o.vars : o.flatVars,
1346
+ const i = {}, r = this.frames, o = r.length, n = lt(
1347
+ r,
1348
+ t,
1349
+ (a) => a.time.start,
1350
+ (a) => a.time.stop
1351
+ );
1352
+ if (n === -1) return i;
1353
+ const u = (a) => {
1354
+ const { start: c, stop: l } = a.time, h = at(t, c, l, 0, 1), m = a.timingFunction(h);
1355
+ for (const p of a.allInterpVars)
1356
+ ye(m, p);
1357
+ e && a.transform(
1358
+ this.unflatten ? a.vars : a.flatVars,
1130
1359
  t
1131
- ), Object.assign(n, o.flatVars);
1360
+ ), Object.assign(i, a.flatVars);
1361
+ };
1362
+ for (let a = n; a >= 0; a--) {
1363
+ const c = r[a];
1364
+ if (t < c.time.start || t > c.time.stop) break;
1365
+ u(c);
1366
+ }
1367
+ for (let a = n + 1; a < o; a++) {
1368
+ const c = r[a];
1369
+ if (t < c.time.start || t > c.time.stop) break;
1370
+ u(c);
1132
1371
  }
1133
- return n;
1372
+ return i;
1134
1373
  }
1135
1374
  async onStart() {
1136
- 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 It(this.options.delay), this.paused = !1), this.started = !0;
1375
+ 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 _t(this.options.delay), this.paused = !1), this.started = !0;
1137
1376
  }
1138
1377
  async onEnd() {
1139
1378
  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"));
@@ -1142,24 +1381,24 @@ class pt {
1142
1381
  if (this.startTime === void 0 && (await this.onStart(), this.startTime = t + this.options.delay, this.dispatchAnimationEvent("animationstart")), this.paused && this.pausedTime === 0)
1143
1382
  return this.pausedTime = t, this.t;
1144
1383
  if (this.pausedTime > 0 && !this.paused) {
1145
- const s = t - this.pausedTime;
1146
- this.startTime += s, this.pausedTime = 0;
1384
+ const e = t - this.pausedTime;
1385
+ this.startTime += e, this.pausedTime = 0;
1147
1386
  }
1148
1387
  return this.t = t - this.startTime, this.t >= this.options.duration && (await this.onEnd(), this.t = this.options.duration), this.t;
1149
1388
  }
1150
1389
  async draw(t) {
1151
- this.managed || (t = await this.tick(t), !this.paused && (this.interpFrames(t, !0), this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = v(this.draw.bind(this))));
1390
+ this.managed || (t = await this.tick(t), !this.paused && (this.interpFrames(t, !0), this.done ? (this.reset(), this.resolvePromise && this.resolvePromise()) : this.handleId = w(this._boundDraw)));
1152
1391
  }
1153
1392
  /** Internal rAF-based play loop. */
1154
1393
  _playRAF() {
1155
1394
  return new Promise((t) => {
1156
- this.resolvePromise = t, this.handleId = v(this.draw.bind(this));
1395
+ this.resolvePromise = t, this.handleId = w(this._boundDraw);
1157
1396
  });
1158
1397
  }
1159
1398
  /** Play via the Web Animations API for compositor-thread execution. */
1160
1399
  async _playWAAPI() {
1161
1400
  try {
1162
- await Oe(this), this.reset();
1401
+ await ke(this), this.reset();
1163
1402
  } catch {
1164
1403
  return this._playRAF();
1165
1404
  }
@@ -1169,7 +1408,7 @@ class pt {
1169
1408
  return;
1170
1409
  if (this._playingPromise) return this._playingPromise;
1171
1410
  let t;
1172
- return this.options.useWAAPI && this.targets.length > 0 && typeof this.targets[0]?.animate == "function" && Pe(this) ? t = this._playWAAPI() : t = this._playRAF(), this._playingPromise = t, t.finally(() => {
1411
+ return this.options.useWAAPI && this.targets.length > 0 && typeof this.targets[0]?.animate == "function" && Ce(this) ? t = this._playWAAPI() : t = this._playRAF(), this._playingPromise = t, t.finally(() => {
1173
1412
  this._playingPromise = null;
1174
1413
  }), t;
1175
1414
  }
@@ -1177,10 +1416,10 @@ class pt {
1177
1416
  return this.paused && t ? this.resume() : (this.started && (this.paused = !0), this);
1178
1417
  }
1179
1418
  resume() {
1180
- return this.started && this.paused && (this.paused = !1, this.handleId = v(this.draw.bind(this))), this;
1419
+ return this.started && this.paused && (this.paused = !1, this.handleId = w(this._boundDraw)), this;
1181
1420
  }
1182
1421
  stop() {
1183
- et(this.handleId), this.reset();
1422
+ k(this.handleId), this.reset();
1184
1423
  }
1185
1424
  playing() {
1186
1425
  return !(!this.started || this.paused);
@@ -1193,96 +1432,108 @@ class pt {
1193
1432
  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;
1194
1433
  }
1195
1434
  setTargets(...t) {
1196
- return this.targets = t, this.frames.forEach((s) => {
1197
- Object.values(s.interpVars).forEach((n) => {
1198
- n.forEach(({ start: i, stop: o, value: r }) => {
1199
- i.setTargets(this.targets), o.setTargets(this.targets), r.setTargets(this.targets);
1435
+ return this.targets = t, this.frames.forEach((e) => {
1436
+ Object.values(e.interpVars).forEach((i) => {
1437
+ i.forEach(({ start: r, stop: o, value: n }) => {
1438
+ r.setTargets(this.targets), o.setTargets(this.targets), n.setTargets(this.targets);
1200
1439
  });
1201
1440
  });
1202
1441
  }), this;
1203
1442
  }
1204
1443
  group(...t) {
1205
- return new Jt(this, ...t);
1444
+ return new se(this, ...t);
1206
1445
  }
1207
1446
  }
1208
- class $e extends pt {
1209
- constructor(t, ...s) {
1210
- super(t, s), this.unflatten = !1;
1211
- }
1212
- fromVars(t, s) {
1213
- this.unflatten = s != null, s ??= this.transform.bind(this);
1214
- for (let n = 0; n < t.length; n++) {
1215
- const i = t[n], o = Math.round(n / (t.length - 1) * 100);
1216
- this.addFrame(o, i, s);
1447
+ class Ne extends gt {
1448
+ constructor(t, ...e) {
1449
+ super(t, e), this.unflatten = !1;
1450
+ }
1451
+ fromVars(t, e) {
1452
+ this.unflatten = e != null, e ??= this.transform.bind(this);
1453
+ for (let i = 0; i < t.length; i++) {
1454
+ const r = t[i], o = Math.round(i / (t.length - 1) * 100);
1455
+ this.addFrame(o, r, e);
1217
1456
  }
1218
1457
  return this.parse(), this;
1219
1458
  }
1220
- fromKeyframes(t, s) {
1221
- this.unflatten = s != null, s ??= this.transform.bind(this), Ot(t) && (t = new Map(Object.entries(t)));
1222
- const n = t instanceof Map ? t.entries() : Object.entries(t);
1223
- for (const [i, o] of n)
1224
- this.addFrame(i, o, s);
1459
+ fromKeyframes(t, e) {
1460
+ this.unflatten = e != null, e ??= this.transform.bind(this), kt(t) && (t = new Map(Object.entries(t)));
1461
+ const i = t instanceof Map ? t.entries() : Object.entries(t);
1462
+ for (const [r, o] of i)
1463
+ this.addFrame(r, o, e);
1225
1464
  return this.parse(), this;
1226
1465
  }
1227
- fromString(t, s) {
1228
- this.unflatten = s != null, s ??= this.transform.bind(this);
1229
- const n = Zt(t);
1230
- for (const [i, o] of n.entries()) {
1231
- const r = Object.fromEntries(
1466
+ fromString(t, e) {
1467
+ this.unflatten = e != null, e ??= this.transform.bind(this);
1468
+ const i = Jt(t);
1469
+ for (const [r, o] of i.entries()) {
1470
+ const n = Object.fromEntries(
1232
1471
  Object.entries(o).map(([c, l]) => [
1233
1472
  c,
1234
- Ce(l) ? l.clone() : l
1473
+ Me(l) ? l.clone() : l
1235
1474
  ])
1236
- ), a = r.animationTimingFunction ?? r.timingFunction;
1237
- delete r.animationTimingFunction, delete r.timingFunction;
1238
- const u = a ? M(a.toString()) : void 0;
1239
- this.addFrame(i, r, s, u);
1475
+ ), u = n.animationTimingFunction ?? n.timingFunction;
1476
+ delete n.animationTimingFunction, delete n.timingFunction;
1477
+ const a = u ? M(u.toString()) : void 0;
1478
+ this.addFrame(r, n, e, a);
1240
1479
  }
1241
1480
  return this.parse(), this;
1242
1481
  }
1243
1482
  transform(t) {
1244
- ht(t, this.targets);
1483
+ mt(t, this.targets);
1245
1484
  }
1246
1485
  }
1247
1486
  export {
1248
- pt as Animation,
1249
- Jt as AnimationGroup,
1250
- Ke as CSSCubicBezier,
1251
- $e as CSSKeyframesAnimation,
1252
- je as ElementMorph,
1253
- Ue as ManualTimeline,
1487
+ gt as Animation,
1488
+ se as AnimationGroup,
1489
+ Ye as CSSCubicBezier,
1490
+ Ne as CSSKeyframesAnimation,
1491
+ Ue as ElementMorph,
1492
+ De as ManualTimeline,
1254
1493
  Se as NumericAnimation,
1255
- xe as ScrollTimeline,
1256
- be as SmoothProgress,
1257
- ft as Timeline,
1258
- Ye as bezierPresets,
1494
+ $e as ScrollTimeline,
1495
+ Fe as SmoothProgress,
1496
+ dt as Timeline,
1497
+ Be as bezierPresets,
1259
1498
  Re as bounceInEase,
1260
1499
  We as bounceInEaseHalf,
1261
1500
  Le as bounceInOutEase,
1262
- Be as bounceOutEase,
1263
- De as bounceOutEaseHalf,
1264
- He as easeInBounce,
1265
- Xe as easeInCirc,
1266
- ze as easeInCubic,
1267
- Ge as easeInExpo,
1268
- Ze as easeInOutCirc,
1269
- qe as easeInOutCubic,
1270
- Qe as easeInOutExpo,
1271
- Je as easeInOutQuad,
1272
- ts as easeInOutSine,
1273
- es as easeInQuad,
1274
- ss as easeInSine,
1275
- ns as easeOutCirc,
1276
- is as easeOutCubic,
1277
- rs as easeOutExpo,
1278
- os as easeOutQuad,
1279
- as as easeOutSine,
1280
- k as getAnimationId,
1281
- us as jumpTerms,
1282
- ls as linear,
1283
- cs as smoothStep3,
1284
- hs as stepEnd,
1285
- fs as stepStart,
1286
- ps as steppedEase,
1287
- ms as timingFunctions
1501
+ Xe as bounceOutEase,
1502
+ He as bounceOutEaseHalf,
1503
+ Ge as cancelAnimationFrame,
1504
+ qe as clamp,
1505
+ Ze as cubicBezier,
1506
+ Qe as cubicBezierToSVG,
1507
+ Je as cubicBezierToString,
1508
+ ts as deCasteljau,
1509
+ es as easeInBounce,
1510
+ ss as easeInCirc,
1511
+ is as easeInCubic,
1512
+ rs as easeInExpo,
1513
+ ns as easeInOutCirc,
1514
+ os as easeInOutCubic,
1515
+ as as easeInOutExpo,
1516
+ us as easeInOutQuad,
1517
+ ls as easeInOutSine,
1518
+ cs as easeInQuad,
1519
+ hs as easeInSine,
1520
+ fs as easeOutCirc,
1521
+ ps as easeOutCubic,
1522
+ ms as easeOutExpo,
1523
+ ds as easeOutQuad,
1524
+ gs as easeOutSine,
1525
+ x as getAnimationId,
1526
+ ys as interpBezier,
1527
+ ws as jumpTerms,
1528
+ Vs as lerp,
1529
+ Ts as linear,
1530
+ bs as logerp,
1531
+ Ss as requestAnimationFrame,
1532
+ vs as scale,
1533
+ Fs as sleep,
1534
+ Is as smoothStep3,
1535
+ Ps as stepEnd,
1536
+ Es as stepStart,
1537
+ Cs as steppedEase,
1538
+ Os as timingFunctions
1288
1539
  };