@wix/motion 2.1.5 → 2.1.7

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/es/motion.js CHANGED
@@ -1,102 +1,108 @@
1
- class I {
1
+ class O {
2
2
  animations;
3
3
  options;
4
4
  ready;
5
5
  isCSS;
6
6
  longestAnimation;
7
- constructor(e, n) {
8
- this.animations = e, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = e[0] instanceof CSSAnimation, this.longestAnimation = this._getAnimationWithLongestEndTime();
7
+ constructor(t, n) {
8
+ this.animations = t, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = t[0] instanceof CSSAnimation, this.longestAnimation = this._getAnimationWithLongestEndTime();
9
9
  }
10
10
  _getAnimationWithLongestEndTime() {
11
- return this.animations.reduce((e, n) => {
12
- const i = e.effect?.getComputedTiming().endTime ?? 0, r = n.effect?.getComputedTiming().endTime ?? 0;
13
- return i > r ? e : n;
11
+ return this.animations.reduce((t, n) => {
12
+ const i = t.effect?.getComputedTiming().endTime ?? 0, s = n.effect?.getComputedTiming().endTime ?? 0;
13
+ return i > s ? t : n;
14
14
  }, this.animations[0]);
15
15
  }
16
16
  getProgress() {
17
17
  return this.longestAnimation?.effect?.getComputedTiming().progress || 0;
18
18
  }
19
- async play(e) {
19
+ async play(t) {
20
20
  await this.ready;
21
21
  for (const n of this.animations)
22
22
  n.play();
23
- await Promise.all(this.animations.map((n) => n.ready)), e && e();
23
+ await Promise.all(this.animations.map((n) => n.ready)), t && t();
24
24
  }
25
25
  pause() {
26
- for (const e of this.animations)
27
- e.pause();
26
+ for (const t of this.animations)
27
+ t.pause();
28
28
  }
29
- async reverse(e) {
29
+ async reverse(t) {
30
30
  await this.ready;
31
31
  for (const n of this.animations)
32
32
  n.reverse();
33
- await Promise.all(this.animations.map((n) => n.ready)), e && e();
33
+ await Promise.all(this.animations.map((n) => n.ready)), t && t();
34
34
  }
35
- progress(e) {
35
+ progress(t) {
36
36
  for (const n of this.animations) {
37
- const { delay: i, duration: r, iterations: s } = n.effect.getTiming(), u = (Number.isFinite(r) ? r : 0) * (Number.isFinite(s) ? s : 1);
38
- n.currentTime = ((i || 0) + u) * e;
37
+ const { delay: i, duration: s, iterations: r } = n.effect.getTiming(), c = (Number.isFinite(s) ? s : 0) * (Number.isFinite(r) ? r : 1);
38
+ n.currentTime = ((i || 0) + c) * t;
39
39
  }
40
40
  }
41
41
  cancel() {
42
- for (const e of this.animations)
43
- e.cancel();
42
+ for (const t of this.animations)
43
+ t.cancel();
44
44
  }
45
- setPlaybackRate(e) {
45
+ setPlaybackRate(t) {
46
46
  for (const n of this.animations)
47
- n.playbackRate = e;
47
+ n.playbackRate = t;
48
48
  }
49
- async onFinish(e) {
49
+ async onFinish(t) {
50
50
  try {
51
51
  await Promise.all(this.animations.map((i) => i.finished));
52
52
  const n = this.animations[0];
53
53
  if (n && !this.isCSS) {
54
54
  const i = n.effect?.target;
55
55
  if (i) {
56
- const r = new Event("animationend");
56
+ const s = this.options?.effectId || n.id, r = new CustomEvent("animationend", { detail: { effectId: s } });
57
57
  i.dispatchEvent(r);
58
58
  }
59
59
  }
60
- e();
60
+ t();
61
61
  } catch (n) {
62
62
  console.warn("animation was interrupted - aborting onFinish callback - ", n);
63
63
  }
64
64
  }
65
- async onAbort(e) {
65
+ async onAbort(t) {
66
66
  try {
67
67
  await Promise.all(this.animations.map((n) => n.finished));
68
68
  } catch (n) {
69
69
  if (n.name === "AbortError") {
70
70
  const i = this.animations[0];
71
71
  if (i && !this.isCSS) {
72
- const r = i.effect?.target;
73
- if (r) {
74
- const s = new Event("animationcancel");
75
- r.dispatchEvent(s);
72
+ const s = i.effect?.target;
73
+ if (s) {
74
+ const r = new Event("animationcancel");
75
+ s.dispatchEvent(r);
76
76
  }
77
77
  }
78
- e();
78
+ t();
79
79
  }
80
80
  }
81
81
  }
82
82
  get finished() {
83
- return Promise.all(this.animations.map((e) => e.finished));
83
+ return Promise.all(this.animations.map((t) => t.finished));
84
84
  }
85
85
  get playState() {
86
- return this.animations[0]?.playState;
86
+ return this.animations.some((t) => t.playState === "running") ? "running" : this.animations[0]?.playState;
87
+ }
88
+ hasAnimationName(t) {
89
+ return this.animations.some((n) => n.animationName === t);
90
+ }
91
+ hasAnimationId(t) {
92
+ return this.animations.some((n) => n.id === t);
87
93
  }
88
94
  getTimingOptions() {
89
- return this.animations.map((e) => {
90
- const n = e.effect?.getTiming(), i = n?.delay ?? 0, r = Number(n?.duration) || 0, s = n?.iterations ?? 1;
95
+ return this.animations.map((t) => {
96
+ const n = t.effect?.getTiming(), i = n?.delay ?? 0, s = Number(n?.duration) || 0, r = n?.iterations ?? 1;
91
97
  return {
92
98
  delay: i,
93
- duration: r,
94
- iterations: s
99
+ duration: s,
100
+ iterations: r
95
101
  };
96
102
  });
97
103
  }
98
104
  }
99
- const G = (t) => t, V = (t) => 1 - Math.cos(t * Math.PI / 2), B = (t) => Math.sin(t * Math.PI / 2), K = (t) => -(Math.cos(Math.PI * t) - 1) / 2, X = (t) => t ** 2, J = (t) => 1 - (1 - t) ** 2, U = (t) => t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2, Y = (t) => t ** 3, Q = (t) => 1 - (1 - t) ** 3, Z = (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2, tt = (t) => t ** 4, et = (t) => 1 - (1 - t) ** 4, nt = (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2, it = (t) => t ** 5, st = (t) => 1 - (1 - t) ** 5, rt = (t) => t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2, ot = (t) => t === 0 ? 0 : 2 ** (10 * t - 10), at = (t) => t === 1 ? 1 : 1 - 2 ** (-10 * t), ct = (t) => t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2, ut = (t) => 1 - Math.sqrt(1 - t ** 2), ft = (t) => Math.sqrt(1 - (t - 1) ** 2), mt = (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2, lt = (t) => 2.70158 * t ** 3 - 1.70158 * t ** 2, ht = (t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2, dt = (t, e = 1.70158 * 1.525) => t < 0.5 ? (2 * t) ** 2 * ((e + 1) * 2 * t - e) / 2 : ((2 * t - 2) ** 2 * ((e + 1) * (t * 2 - 2) + e) + 2) / 2, C = {
105
+ const G = (e) => e, V = (e) => 1 - Math.cos(e * Math.PI / 2), B = (e) => Math.sin(e * Math.PI / 2), K = (e) => -(Math.cos(Math.PI * e) - 1) / 2, X = (e) => e ** 2, J = (e) => 1 - (1 - e) ** 2, U = (e) => e < 0.5 ? 2 * e ** 2 : 1 - (-2 * e + 2) ** 2 / 2, Y = (e) => e ** 3, Q = (e) => 1 - (1 - e) ** 3, Z = (e) => e < 0.5 ? 4 * e ** 3 : 1 - (-2 * e + 2) ** 3 / 2, tt = (e) => e ** 4, et = (e) => 1 - (1 - e) ** 4, nt = (e) => e < 0.5 ? 8 * e ** 4 : 1 - (-2 * e + 2) ** 4 / 2, it = (e) => e ** 5, st = (e) => 1 - (1 - e) ** 5, rt = (e) => e < 0.5 ? 16 * e ** 5 : 1 - (-2 * e + 2) ** 5 / 2, ot = (e) => e === 0 ? 0 : 2 ** (10 * e - 10), at = (e) => e === 1 ? 1 : 1 - 2 ** (-10 * e), ct = (e) => e === 0 ? 0 : e === 1 ? 1 : e < 0.5 ? 2 ** (20 * e - 10) / 2 : (2 - 2 ** (-20 * e + 10)) / 2, ut = (e) => 1 - Math.sqrt(1 - e ** 2), ft = (e) => Math.sqrt(1 - (e - 1) ** 2), mt = (e) => e < 0.5 ? (1 - Math.sqrt(1 - 4 * e ** 2)) / 2 : (Math.sqrt(-(2 * e - 3) * (2 * e - 1)) + 1) / 2, lt = (e) => 2.70158 * e ** 3 - 1.70158 * e ** 2, ht = (e) => 1 + 2.70158 * (e - 1) ** 3 + 1.70158 * (e - 1) ** 2, dt = (e, t = 1.70158 * 1.525) => e < 0.5 ? (2 * e) ** 2 * ((t + 1) * 2 * e - t) / 2 : ((2 * e - 2) ** 2 * ((t + 1) * (e * 2 - 2) + t) + 2) / 2, C = {
100
106
  linear: G,
101
107
  sineIn: V,
102
108
  sineOut: B,
@@ -153,14 +159,14 @@ const G = (t) => t, V = (t) => 1 - Math.cos(t * Math.PI / 2), B = (t) => Math.si
153
159
  backOut: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
154
160
  backInOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
155
161
  };
156
- function pt(t) {
157
- return t === "percentage" ? "%" : t || "px";
162
+ function pt(e) {
163
+ return e === "percentage" ? "%" : e || "px";
158
164
  }
159
- function gt(t) {
160
- return t ? z[t] || t : z.linear;
165
+ function gt(e) {
166
+ return e ? z[e] || e : z.linear;
161
167
  }
162
- function yt(t, e, n, i) {
163
- const r = 3 * t, s = 3 * (n - t) - r, u = 1 - r - s, a = 3 * e, m = 3 * (i - e) - a, l = 1 - a - m, o = (h) => ((u * h + s) * h + r) * h, c = (h) => ((l * h + m) * h + a) * h, f = (h) => (3 * u * h + 2 * s) * h + r;
168
+ function yt(e, t, n, i) {
169
+ const s = 3 * e, r = 3 * (n - e) - s, c = 1 - s - r, a = 3 * t, m = 3 * (i - t) - a, l = 1 - a - m, o = (h) => ((c * h + r) * h + s) * h, u = (h) => ((l * h + m) * h + a) * h, f = (h) => (3 * c * h + 2 * r) * h + s;
164
170
  function p(h) {
165
171
  let d = h;
166
172
  for (let y = 0; y < 8; y++) {
@@ -178,83 +184,83 @@ function yt(t, e, n, i) {
178
184
  }
179
185
  return d;
180
186
  }
181
- return (h) => h <= 0 ? 0 : h >= 1 ? 1 : c(p(h));
187
+ return (h) => h <= 0 ? 0 : h >= 1 ? 1 : u(p(h));
182
188
  }
183
- function bt(t) {
184
- const e = t.match(
189
+ function bt(e) {
190
+ const t = e.match(
185
191
  /^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
186
192
  );
187
- if (!e) return;
188
- const n = parseFloat(e[1]), i = parseFloat(e[2]), r = parseFloat(e[3]), s = parseFloat(e[4]);
189
- if (![n, i, r, s].some(isNaN))
190
- return yt(n, i, r, s);
193
+ if (!t) return;
194
+ const n = parseFloat(t[1]), i = parseFloat(t[2]), s = parseFloat(t[3]), r = parseFloat(t[4]);
195
+ if (![n, i, s, r].some(isNaN))
196
+ return yt(n, i, s, r);
191
197
  }
192
- function vt(t) {
193
- const e = t.match(/^linear\((.+)\)$/);
194
- if (!e) return;
195
- const n = e[1].split(",").map((u) => u.trim()).filter(Boolean);
198
+ function vt(e) {
199
+ const t = e.match(/^linear\((.+)\)$/);
200
+ if (!t) return;
201
+ const n = t[1].split(",").map((c) => c.trim()).filter(Boolean);
196
202
  if (n.length === 0) return;
197
203
  const i = [];
198
- for (const u of n) {
199
- const a = u.split(/\s+/), m = parseFloat(a[0]);
204
+ for (const c of n) {
205
+ const a = c.split(/\s+/), m = parseFloat(a[0]);
200
206
  if (isNaN(m)) return;
201
207
  const l = [];
202
208
  for (let o = 1; o < a.length; o++)
203
209
  if (a[o].endsWith("%")) {
204
- const c = parseFloat(a[o]) / 100;
205
- if (isNaN(c)) return;
206
- l.push(c);
210
+ const u = parseFloat(a[o]) / 100;
211
+ if (isNaN(u)) return;
212
+ l.push(u);
207
213
  }
208
214
  l.length === 0 ? i.push({ output: m, pos: null }) : l.length === 1 ? i.push({ output: m, pos: l[0] }) : (i.push({ output: m, pos: l[0] }), i.push({ output: m, pos: l[1] }));
209
215
  }
210
216
  if (i.length === 0) return;
211
217
  i[0].pos === null && (i[0].pos = 0), i[i.length - 1].pos === null && (i[i.length - 1].pos = 1);
212
- let r = 0;
213
- for (; r < i.length; )
214
- if (i[r].pos === null) {
215
- const u = r - 1;
216
- let a = r;
218
+ let s = 0;
219
+ for (; s < i.length; )
220
+ if (i[s].pos === null) {
221
+ const c = s - 1;
222
+ let a = s;
217
223
  for (; a < i.length && i[a].pos === null; ) a++;
218
- const m = i[u].pos, l = i[a].pos, o = a - u;
219
- for (let c = u + 1; c < a; c++)
220
- i[c].pos = m + (l - m) * (c - u) / o;
221
- r = a + 1;
224
+ const m = i[c].pos, l = i[a].pos, o = a - c;
225
+ for (let u = c + 1; u < a; u++)
226
+ i[u].pos = m + (l - m) * (u - c) / o;
227
+ s = a + 1;
222
228
  } else
223
- r++;
224
- for (let u = 1; u < i.length; u++)
225
- i[u].pos < i[u - 1].pos && (i[u].pos = i[u - 1].pos);
226
- const s = i;
227
- return (u) => {
228
- if (u <= s[0].pos) return s[0].output;
229
- const a = s[s.length - 1];
230
- if (u >= a.pos) return a.output;
231
- let m = 0, l = s.length - 1;
229
+ s++;
230
+ for (let c = 1; c < i.length; c++)
231
+ i[c].pos < i[c - 1].pos && (i[c].pos = i[c - 1].pos);
232
+ const r = i;
233
+ return (c) => {
234
+ if (c <= r[0].pos) return r[0].output;
235
+ const a = r[r.length - 1];
236
+ if (c >= a.pos) return a.output;
237
+ let m = 0, l = r.length - 1;
232
238
  for (; m < l - 1; ) {
233
239
  const f = m + l >>> 1;
234
- s[f].pos <= u ? m = f : l = f;
240
+ r[f].pos <= c ? m = f : l = f;
235
241
  }
236
- const o = s[m], c = s[l];
237
- return c.pos === o.pos ? c.output : o.output + (c.output - o.output) * (u - o.pos) / (c.pos - o.pos);
242
+ const o = r[m], u = r[l];
243
+ return u.pos === o.pos ? u.output : o.output + (u.output - o.output) * (c - o.pos) / (u.pos - o.pos);
238
244
  };
239
245
  }
240
- function D(t) {
241
- if (!t) return;
242
- const e = C[t];
243
- return e || (bt(t) ?? vt(t) ?? C.linear);
246
+ function D(e) {
247
+ if (!e) return;
248
+ const t = C[e];
249
+ return t || (bt(e) ?? vt(e) ?? C.linear);
244
250
  }
245
- class Et extends I {
251
+ class Et extends O {
246
252
  animationGroups;
247
253
  delay;
248
254
  offset;
249
255
  offsetEasing;
250
256
  timingOptions;
251
- constructor(e, n = {}) {
252
- const i = e.flatMap((r) => [...r.animations]);
253
- super(i), this.animationGroups = e, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : D(n.offsetEasing) ?? G, this.timingOptions = this.animationGroups.map((r) => r.getTimingOptions().map(({ delay: s, duration: u, iterations: a }) => ({
254
- delay: s,
255
- duration: Number.isFinite(u) ? u : 0,
257
+ constructor(t, n = {}) {
258
+ const i = t.flatMap((s) => [...s.animations]);
259
+ super(i), this.animationGroups = t, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : D(n.offsetEasing) ?? G, this.timingOptions = this.animationGroups.map((s) => s.getTimingOptions().map(({ delay: r, duration: c, iterations: a }) => ({
260
+ delay: r,
261
+ duration: Number.isFinite(c) ? c : 0,
256
262
  iterations: Number.isFinite(a) ? a : 1
257
- }))), this.applyOffsets(), this.ready = Promise.all(e.map((r) => r.ready)).then(() => {
263
+ }))), this.applyOffsets(), this.ready = Promise.all(t.map((s) => s.ready)).then(() => {
258
264
  });
259
265
  }
260
266
  /**
@@ -263,35 +269,35 @@ class Et extends I {
263
269
  * where i is the group index and last is the index of the final group.
264
270
  */
265
271
  calculateOffsets() {
266
- const e = this.animationGroups.length;
267
- if (e <= 1) return [0];
268
- const n = e - 1;
272
+ const t = this.animationGroups.length;
273
+ if (t <= 1) return [0];
274
+ const n = t - 1;
269
275
  return Array.from(
270
- { length: e },
271
- (i, r) => this.offsetEasing(r / n) * n * this.offset | 0
276
+ { length: t },
277
+ (i, s) => this.offsetEasing(s / n) * n * this.offset | 0
272
278
  );
273
279
  }
274
280
  applyOffsets() {
275
281
  if (this.animationGroups.length === 0 || this.animations.length === 0) return;
276
- const e = this.calculateOffsets(), n = this.getSequenceActiveDuration(e);
277
- this.animationGroups.forEach((i, r) => {
278
- i.animations.forEach((s, u) => {
279
- const a = s.effect;
282
+ const t = this.calculateOffsets(), n = this.getSequenceActiveDuration(t);
283
+ this.animationGroups.forEach((i, s) => {
284
+ i.animations.forEach((r, c) => {
285
+ const a = r.effect;
280
286
  if (!a) return;
281
- const { delay: m, duration: l, iterations: o } = this.timingOptions[r][u], c = m + e[r], f = n - (c + l * o);
282
- a.updateTiming({ delay: c + this.delay, endDelay: f });
287
+ const { delay: m, duration: l, iterations: o } = this.timingOptions[s][c], u = m + t[s], f = n - (u + l * o);
288
+ a.updateTiming({ delay: u + this.delay, endDelay: f });
283
289
  });
284
290
  });
285
291
  }
286
- getSequenceActiveDuration(e) {
292
+ getSequenceActiveDuration(t) {
287
293
  const n = [];
288
294
  for (let i = 0; i < this.timingOptions.length; i++) {
289
- const r = this.timingOptions[i].reduce((s, u) => {
290
- if (!u) return s;
291
- const { delay: a, duration: m, iterations: l } = u;
292
- return Math.max(s, a + m * l);
295
+ const s = this.timingOptions[i].reduce((r, c) => {
296
+ if (!c) return r;
297
+ const { delay: a, duration: m, iterations: l } = c;
298
+ return Math.max(r, a + m * l);
293
299
  }, 0);
294
- n.push(e[i] + r);
300
+ n.push(t[i] + s);
295
301
  }
296
302
  return Math.max(...n);
297
303
  }
@@ -300,14 +306,14 @@ class Et extends I {
300
306
  * stagger offsets for all groups. Each entry specifies the target index
301
307
  * in the animationGroups array where the group should be inserted.
302
308
  */
303
- addGroups(e) {
304
- if (e.length === 0) return;
305
- const n = [...e].sort((i, r) => r.index - i.index);
306
- for (const { index: i, group: r } of n) {
307
- const s = Math.min(i, this.animationGroups.length);
308
- this.animationGroups.splice(s, 0, r), this.timingOptions.splice(s, 0, r.getTimingOptions());
309
- const u = [...r.animations], a = this.animationGroups.slice(0, s).reduce((m, l) => m + l.animations.length, 0);
310
- this.animations.splice(a, 0, ...u);
309
+ addGroups(t) {
310
+ if (t.length === 0) return;
311
+ const n = [...t].sort((i, s) => s.index - i.index);
312
+ for (const { index: i, group: s } of n) {
313
+ const r = Math.min(i, this.animationGroups.length);
314
+ this.animationGroups.splice(r, 0, s), this.timingOptions.splice(r, 0, s.getTimingOptions());
315
+ const c = [...s.animations], a = this.animationGroups.slice(0, r).reduce((m, l) => m + l.animations.length, 0);
316
+ this.animations.splice(a, 0, ...c);
311
317
  }
312
318
  this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((i) => i.ready)).then(() => {
313
319
  });
@@ -317,19 +323,19 @@ class Et extends I {
317
323
  * stagger offsets for remaining groups. Cancelled animations in removed
318
324
  * groups are returned.
319
325
  */
320
- removeGroups(e) {
321
- const n = [], i = [], r = [];
322
- for (let s = 0; s < this.animationGroups.length; s++)
323
- e(this.animationGroups[s]) ? n.push(this.animationGroups[s]) : (i.push(this.animationGroups[s]), r.push(this.timingOptions[s]));
326
+ removeGroups(t) {
327
+ const n = [], i = [], s = [];
328
+ for (let r = 0; r < this.animationGroups.length; r++)
329
+ t(this.animationGroups[r]) ? n.push(this.animationGroups[r]) : (i.push(this.animationGroups[r]), s.push(this.timingOptions[r]));
324
330
  if (n.length === 0) return n;
325
- for (const s of n)
326
- s.cancel();
327
- return this.animationGroups = i, this.timingOptions = r, this.animations = i.flatMap((s) => [...s.animations]), this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((s) => s.ready)).then(() => {
331
+ for (const r of n)
332
+ r.cancel();
333
+ return this.animationGroups = i, this.timingOptions = s, this.animations = i.flatMap((r) => [...r.animations]), this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((r) => r.ready)).then(() => {
328
334
  }), n;
329
335
  }
330
- async onFinish(e) {
336
+ async onFinish(t) {
331
337
  try {
332
- await Promise.all(this.animationGroups.map((n) => n.finished)), e();
338
+ await Promise.all(this.animationGroups.map((n) => n.finished)), t();
333
339
  } catch (n) {
334
340
  console.warn("animation was interrupted - aborting onFinish callback - ", n);
335
341
  }
@@ -341,25 +347,25 @@ class _t {
341
347
  progress;
342
348
  _tickCbId;
343
349
  _finishHandler;
344
- constructor(e, n, i, r) {
345
- const s = new KeyframeEffect(n, [], {
350
+ constructor(t, n, i, s) {
351
+ const r = new KeyframeEffect(n, [], {
346
352
  ...i,
347
353
  composite: "add"
348
- }), { timeline: u } = r;
349
- this._animation = new Animation(s, u), this._tickCbId = null, this.progress = null, this.customEffect = (a) => e(s.target, a), this._finishHandler = (a) => {
354
+ }), { timeline: c } = s;
355
+ this._animation = new Animation(r, c), this._tickCbId = null, this.progress = null, this.customEffect = (a) => t(r.target, a), this._finishHandler = (a) => {
350
356
  this.effect.target?.getAnimations().find((m) => m === this._animation) || this.cancel();
351
357
  }, this.addEventListener("finish", this._finishHandler), this.addEventListener("remove", this._finishHandler);
352
358
  }
353
359
  // private tick method for customEffect loop implementation
354
360
  _tick() {
355
361
  try {
356
- const e = this.effect?.getComputedTiming().progress ?? null;
357
- e !== this.progress && (this.customEffect?.(e), this.progress = e), this._tickCbId = requestAnimationFrame(() => {
362
+ const t = this.effect?.getComputedTiming().progress ?? null;
363
+ t !== this.progress && (this.customEffect?.(t), this.progress = t), this._tickCbId = requestAnimationFrame(() => {
358
364
  this._tick();
359
365
  });
360
- } catch (e) {
366
+ } catch (t) {
361
367
  this._tickCbId = null, console.error(
362
- `failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error ? e.message : e}`
368
+ `failed to run customEffect! effectId: ${this.id}, error: ${t instanceof Error ? t.message : t}`
363
369
  );
364
370
  }
365
371
  }
@@ -367,39 +373,39 @@ class _t {
367
373
  get currentTime() {
368
374
  return this._animation.currentTime;
369
375
  }
370
- set currentTime(e) {
371
- this._animation.currentTime = e;
376
+ set currentTime(t) {
377
+ this._animation.currentTime = t;
372
378
  }
373
379
  get startTime() {
374
380
  return this._animation.startTime;
375
381
  }
376
- set startTime(e) {
377
- this._animation.startTime = e;
382
+ set startTime(t) {
383
+ this._animation.startTime = t;
378
384
  }
379
385
  get playbackRate() {
380
386
  return this._animation.playbackRate;
381
387
  }
382
- set playbackRate(e) {
383
- this._animation.playbackRate = e;
388
+ set playbackRate(t) {
389
+ this._animation.playbackRate = t;
384
390
  }
385
391
  // Animation basic properties
386
392
  get id() {
387
393
  return this._animation.id;
388
394
  }
389
- set id(e) {
390
- this._animation.id = e;
395
+ set id(t) {
396
+ this._animation.id = t;
391
397
  }
392
398
  get effect() {
393
399
  return this._animation.effect;
394
400
  }
395
- set effect(e) {
396
- this._animation.effect = e;
401
+ set effect(t) {
402
+ this._animation.effect = t;
397
403
  }
398
404
  get timeline() {
399
405
  return this._animation.timeline;
400
406
  }
401
- set timeline(e) {
402
- this._animation.timeline = e;
407
+ set timeline(t) {
408
+ this._animation.timeline = t;
403
409
  }
404
410
  // Animation readonly state properties
405
411
  get finished() {
@@ -421,20 +427,20 @@ class _t {
421
427
  get oncancel() {
422
428
  return this._animation.oncancel;
423
429
  }
424
- set oncancel(e) {
425
- this._animation.oncancel = e;
430
+ set oncancel(t) {
431
+ this._animation.oncancel = t;
426
432
  }
427
433
  get onfinish() {
428
434
  return this._animation.onfinish;
429
435
  }
430
- set onfinish(e) {
431
- this._animation.onfinish = e;
436
+ set onfinish(t) {
437
+ this._animation.onfinish = t;
432
438
  }
433
439
  get onremove() {
434
440
  return this._animation.onremove;
435
441
  }
436
- set onremove(e) {
437
- this._animation.onremove = e;
442
+ set onremove(t) {
443
+ this._animation.onremove = t;
438
444
  }
439
445
  // CustomAnimation overridden methods
440
446
  play() {
@@ -461,37 +467,37 @@ class _t {
461
467
  reverse() {
462
468
  this._animation.reverse();
463
469
  }
464
- updatePlaybackRate(e) {
465
- this._animation.updatePlaybackRate(e);
470
+ updatePlaybackRate(t) {
471
+ this._animation.updatePlaybackRate(t);
466
472
  }
467
473
  // Animation events API
468
- addEventListener(e, n, i) {
469
- this._animation.addEventListener(e, n, i);
474
+ addEventListener(t, n, i) {
475
+ this._animation.addEventListener(t, n, i);
470
476
  }
471
- removeEventListener(e, n, i) {
472
- this._animation.removeEventListener(e, n, i);
477
+ removeEventListener(t, n, i) {
478
+ this._animation.removeEventListener(t, n, i);
473
479
  }
474
- dispatchEvent(e) {
475
- return this._animation.dispatchEvent(e);
480
+ dispatchEvent(t) {
481
+ return this._animation.dispatchEvent(t);
476
482
  }
477
483
  }
478
- function wt(t) {
479
- return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
484
+ function wt(e) {
485
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
480
486
  }
481
487
  var A = { exports: {} }, F = A.exports, x;
482
- function Ot() {
483
- return x || (x = 1, (function(t) {
484
- (function(e) {
488
+ function It() {
489
+ return x || (x = 1, (function(e) {
490
+ (function(t) {
485
491
  var n = function() {
486
- }, i = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.msRequestAnimationFrame || function(o) {
492
+ }, i = t.requestAnimationFrame || t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || t.msRequestAnimationFrame || function(o) {
487
493
  return setTimeout(o, 16);
488
494
  };
489
- function r() {
495
+ function s() {
490
496
  var o = this;
491
- o.reads = [], o.writes = [], o.raf = i.bind(e);
497
+ o.reads = [], o.writes = [], o.raf = i.bind(t);
492
498
  }
493
- r.prototype = {
494
- constructor: r,
499
+ s.prototype = {
500
+ constructor: s,
495
501
  /**
496
502
  * We run this inside a try catch
497
503
  * so that if any jobs error, we
@@ -501,7 +507,7 @@ function Ot() {
501
507
  * @param {Array} tasks
502
508
  */
503
509
  runTasks: function(o) {
504
- for (var c; c = o.shift(); ) c();
510
+ for (var u; u = o.shift(); ) u();
505
511
  },
506
512
  /**
507
513
  * Adds a job to the read batch and
@@ -511,9 +517,9 @@ function Ot() {
511
517
  * @param {Object} ctx the context to be bound to `fn` (optional).
512
518
  * @public
513
519
  */
514
- measure: function(o, c) {
515
- var f = c ? o.bind(c) : o;
516
- return this.reads.push(f), s(this), f;
520
+ measure: function(o, u) {
521
+ var f = u ? o.bind(u) : o;
522
+ return this.reads.push(f), r(this), f;
517
523
  },
518
524
  /**
519
525
  * Adds a job to the
@@ -524,9 +530,9 @@ function Ot() {
524
530
  * @param {Object} ctx the context to be bound to `fn` (optional).
525
531
  * @public
526
532
  */
527
- mutate: function(o, c) {
528
- var f = c ? o.bind(c) : o;
529
- return this.writes.push(f), s(this), f;
533
+ mutate: function(o, u) {
534
+ var f = u ? o.bind(u) : o;
535
+ return this.writes.push(f), r(this), f;
530
536
  },
531
537
  /**
532
538
  * Clears a scheduled 'read' or 'write' task.
@@ -574,164 +580,164 @@ function Ot() {
574
580
  */
575
581
  extend: function(o) {
576
582
  if (typeof o != "object") throw new Error("expected object");
577
- var c = Object.create(this);
578
- return m(c, o), c.fastdom = this, c.initialize && c.initialize(), c;
583
+ var u = Object.create(this);
584
+ return m(u, o), u.fastdom = this, u.initialize && u.initialize(), u;
579
585
  },
580
586
  // override this with a function
581
587
  // to prevent Errors in console
582
588
  // when tasks throw
583
589
  catch: null
584
590
  };
585
- function s(o) {
586
- o.scheduled || (o.scheduled = !0, o.raf(u.bind(null, o)));
591
+ function r(o) {
592
+ o.scheduled || (o.scheduled = !0, o.raf(c.bind(null, o)));
587
593
  }
588
- function u(o) {
589
- var c = o.writes, f = o.reads, p;
594
+ function c(o) {
595
+ var u = o.writes, f = o.reads, p;
590
596
  try {
591
- n("flushing reads", f.length), o.runTasks(f), n("flushing writes", c.length), o.runTasks(c);
597
+ n("flushing reads", f.length), o.runTasks(f), n("flushing writes", u.length), o.runTasks(u);
592
598
  } catch (h) {
593
599
  p = h;
594
600
  }
595
- if (o.scheduled = !1, (f.length || c.length) && s(o), p)
601
+ if (o.scheduled = !1, (f.length || u.length) && r(o), p)
596
602
  if (n("task errored", p.message), o.catch) o.catch(p);
597
603
  else throw p;
598
604
  }
599
- function a(o, c) {
600
- var f = o.indexOf(c);
605
+ function a(o, u) {
606
+ var f = o.indexOf(u);
601
607
  return !!~f && !!o.splice(f, 1);
602
608
  }
603
- function m(o, c) {
604
- for (var f in c)
605
- c.hasOwnProperty(f) && (o[f] = c[f]);
609
+ function m(o, u) {
610
+ for (var f in u)
611
+ u.hasOwnProperty(f) && (o[f] = u[f]);
606
612
  }
607
- var l = e.fastdom = e.fastdom || new r();
608
- t.exports = l;
613
+ var l = t.fastdom = t.fastdom || new s();
614
+ e.exports = l;
609
615
  })(typeof window < "u" ? window : typeof F < "u" ? F : globalThis);
610
616
  })(A)), A.exports;
611
617
  }
612
- var It = Ot();
613
- const E = /* @__PURE__ */ wt(It), $ = {};
614
- function Nt(t) {
615
- Object.assign($, t);
618
+ var Ot = It();
619
+ const E = /* @__PURE__ */ wt(Ot), $ = {};
620
+ function Nt(e) {
621
+ Object.assign($, e);
616
622
  }
617
- function At(t) {
618
- return t in $ ? $[t] : (console.warn(
619
- `${t} not found in registry. Please make sure to import and register the preset.`
623
+ function At(e) {
624
+ return e in $ ? $[e] : (console.warn(
625
+ `${e} not found in registry. Please make sure to import and register the preset.`
620
626
  ), null);
621
627
  }
622
- function w(t, e) {
623
- return t ? (e || document).getElementById(t) : null;
628
+ function w(e, t) {
629
+ return e ? (t || document).getElementById(e) : null;
624
630
  }
625
- function Tt(t, e) {
626
- return t?.matches(`[data-motion-part~="${e}"]`) ? t : t?.querySelector(`[data-motion-part~="${e}"]`);
631
+ function Tt(e, t) {
632
+ return e?.matches(`[data-motion-part~="${t}"]`) ? e : e?.querySelector(`[data-motion-part~="${t}"]`);
627
633
  }
628
- function kt(t) {
629
- const e = t.alternate ? "alternate" : "";
630
- return t.reversed ? `${e ? `${e}-` : ""}reverse` : e || "normal";
634
+ function kt(e) {
635
+ const t = e.alternate ? "alternate" : "";
636
+ return e.reversed ? `${t ? `${t}-` : ""}reverse` : t || "normal";
631
637
  }
632
- function k(t) {
633
- return `${t.value}${pt(t.unit)}`;
638
+ function k(e) {
639
+ return `${e.value}${pt(e.unit)}`;
634
640
  }
635
- function M(t, e, n) {
636
- return `${t.name || "cover"} ${n && t.offset.unit !== "percentage" ? `calc(100% + ${k(t.offset)}${e ? ` + ${e}` : ""})` : e ? `calc(${k(t.offset)} + ${e})` : k(t.offset)}`;
641
+ function M(e, t, n) {
642
+ return `${e.name || "cover"} ${n && e.offset.unit !== "percentage" ? `calc(100% + ${k(e.offset)}${t ? ` + ${t}` : ""})` : t ? `calc(${k(e.offset)} + ${t})` : k(e.offset)}`;
637
643
  }
638
- function R(t) {
644
+ function R(e) {
639
645
  return {
640
- start: M(t.startOffset, t.startOffsetAdd),
641
- end: M(t.endOffset, t.endOffsetAdd, !0)
646
+ start: M(e.startOffset, e.startOffsetAdd),
647
+ end: M(e.endOffset, e.endOffsetAdd, !0)
642
648
  };
643
649
  }
644
- function L(t) {
645
- return (e) => E.measure(() => e(t));
650
+ function L(e) {
651
+ return (t) => E.measure(() => t(e));
646
652
  }
647
- function j(t) {
648
- return (e) => E.mutate(() => e(t));
653
+ function j(e) {
654
+ return (t) => E.mutate(() => t(e));
649
655
  }
650
- function O(t) {
651
- if (t.namedEffect) {
652
- const e = t.namedEffect.type;
653
- return typeof e == "string" ? At(e) : null;
654
- } else if (t.keyframeEffect) {
655
- const e = (i) => {
656
- const { name: r, keyframes: s } = i.keyframeEffect;
657
- return [{ ...i, name: r, keyframes: s }];
656
+ function I(e) {
657
+ if (e.namedEffect) {
658
+ const t = e.namedEffect.type;
659
+ return typeof t == "string" ? At(t) : null;
660
+ } else if (e.keyframeEffect) {
661
+ const t = (i) => {
662
+ const { name: s, keyframes: r } = i.keyframeEffect;
663
+ return [{ ...i, name: s, keyframes: r }];
658
664
  };
659
- return { web: e, style: e, getNames: (i) => {
660
- const { effectId: r } = i, { name: s } = i.keyframeEffect, u = s || r;
661
- return u ? [u] : [];
665
+ return { web: t, style: t, getNames: (i) => {
666
+ const { effectId: s } = i, { name: r } = i.keyframeEffect, c = r || s;
667
+ return c ? [c] : [];
662
668
  } };
663
- } else if (t.customEffect)
664
- return (e) => [{ ...e, keyframes: [] }];
669
+ } else if (e.customEffect)
670
+ return (t) => [{ ...t, keyframes: [] }];
665
671
  return null;
666
672
  }
667
- function H(t, e, n) {
668
- return t.map((i, r) => {
669
- const s = {
670
- fill: i.fill,
671
- easing: gt(i.easing),
672
- iterations: i.iterations === 0 ? 1 / 0 : i.iterations || 1,
673
- composite: i.composite,
674
- direction: kt(i)
673
+ function H(e, t, n, i) {
674
+ return e.map((s, r) => {
675
+ const c = {
676
+ fill: s.fill,
677
+ easing: gt(s.easing),
678
+ iterations: s.iterations === 0 ? 1 / 0 : s.iterations || 1,
679
+ composite: s.composite,
680
+ direction: kt(s)
675
681
  };
676
- return S(e) ? (s.duration = i.duration, s.delay = i.delay || 0) : window.ViewTimeline && e?.trigger === "view-progress" ? s.duration = "auto" : (s.duration = 99.99, s.delay = 0.01), {
677
- effect: i,
678
- options: s,
682
+ return S(t) ? (c.duration = s.duration, c.delay = s.delay || 0) : t?.trigger === "view-progress" && (i || window.ViewTimeline) ? c.duration = "auto" : (c.duration = 99.99, c.delay = 0.01), {
683
+ effect: s,
684
+ options: c,
679
685
  id: n && `${n}-${r + 1}`,
680
- part: i.part
686
+ part: s.part
681
687
  };
682
688
  });
683
689
  }
684
- function S(t) {
685
- return !t || t.trigger !== "pointer-move" && t.trigger !== "view-progress";
690
+ function S(e) {
691
+ return !e || e.trigger !== "pointer-move" && e.trigger !== "view-progress";
686
692
  }
687
- function N(t, e, n, i, r) {
688
- if (t) {
689
- if (S(i) && (e.duration = e.duration || 1, r?.reducedMotion))
690
- if (e.iterations === 1 || e.iterations == null)
691
- e = { ...e, duration: 1 };
693
+ function N(e, t, n, i, s) {
694
+ if (e) {
695
+ if (S(i) && (t.duration = t.duration || 1, s?.reducedMotion))
696
+ if (t.iterations === 1 || t.iterations == null)
697
+ t = { ...t, duration: 1 };
692
698
  else
693
699
  return [];
694
- let s;
695
- return n instanceof HTMLElement && (s = { measure: L(n), mutate: j(n) }), t.web ? t.web(e, s, r) : t(e, s, r);
700
+ let r;
701
+ return n instanceof HTMLElement && (r = { measure: L(n), mutate: j(n) }), e.web ? e.web(t, r, s) : e(t, r, s);
696
702
  }
697
703
  return [];
698
704
  }
699
- function W(t, e, n, i, r) {
700
- const s = t instanceof HTMLElement ? t : w(t, r);
701
- if (n?.trigger === "pointer-move" && !e.keyframeEffect) {
702
- let f = e;
703
- e.customEffect && (f = {
704
- ...e,
705
+ function W(e, t, n, i, s) {
706
+ const r = e instanceof HTMLElement ? e : w(e, s);
707
+ if (n?.trigger === "pointer-move" && !t.keyframeEffect) {
708
+ let f = t;
709
+ t.customEffect && (f = {
710
+ ...t,
705
711
  namedEffect: { id: "", type: "CustomMouse" }
706
712
  });
707
- const p = O(
713
+ const p = I(
708
714
  f
709
715
  ), h = N(
710
716
  p,
711
- e,
712
- s,
717
+ t,
718
+ r,
713
719
  n,
714
720
  i
715
721
  );
716
- return typeof h != "function" ? null : h(s);
722
+ return typeof h != "function" ? null : h(r);
717
723
  }
718
- const u = O(e), a = N(
719
- u,
720
- e,
721
- s,
724
+ const c = I(t), a = N(
725
+ c,
726
+ t,
727
+ r,
722
728
  n,
723
729
  i
724
730
  );
725
731
  if (!a || a.length === 0)
726
732
  return null;
727
- const m = H(a, n, e.effectId);
733
+ const m = H(a, n, t.effectId);
728
734
  let l;
729
735
  const o = n?.trigger === "view-progress";
730
736
  o && window.ViewTimeline && (l = new ViewTimeline({
731
737
  subject: n.element || w(n.componentId)
732
738
  }));
733
- const c = m.map(({ effect: f, options: p, id: h, part: d }) => {
734
- const v = d ? Tt(s, d) : s, g = new KeyframeEffect(v || null, [], p);
739
+ const u = m.map(({ effect: f, options: p, id: h, part: d }) => {
740
+ const v = d ? Tt(r, d) : r, g = new KeyframeEffect(v || null, [], p);
735
741
  E.mutate(() => {
736
742
  "timing" in f && g.updateTiming(f.timing), g.setKeyframes(f.keyframes);
737
743
  });
@@ -748,7 +754,7 @@ function W(t, e, n, i, r) {
748
754
  b.rangeStart = _, b.rangeEnd = T, b.play();
749
755
  });
750
756
  else {
751
- const { startOffset: _, endOffset: T } = e;
757
+ const { startOffset: _, endOffset: T } = t;
752
758
  E.mutate(() => {
753
759
  const q = f.startOffset || _, P = f.endOffset || T;
754
760
  Object.assign(b, {
@@ -767,83 +773,83 @@ function W(t, e, n, i, r) {
767
773
  }
768
774
  return h && (b.id = h), b;
769
775
  });
770
- return new I(c, {
771
- ...e,
776
+ return new O(u, {
777
+ ...t,
772
778
  trigger: { ...n || {} },
773
779
  // make sure the group is ready after all animation targets are measured and mutated
774
780
  measured: new Promise((f) => E.mutate(f))
775
781
  });
776
782
  }
777
- function $t(t, e) {
778
- return t ? `#${t}${e ? `[data-motion-part~="${e}"]` : ""}` : "";
783
+ function $t(e, t) {
784
+ return e ? `#${e}${t ? `[data-motion-part~="${t}"]` : ""}` : "";
779
785
  }
780
- function St(t, e) {
781
- const { duration: n, delay: i, iterations: r = 1, fill: s, easing: u = "linear", direction: a } = t.options, m = t.effect.name, l = n === "auto";
782
- return `${m} ${l ? "auto" : `${n}ms`}${l ? " " : ` ${i || 1}ms `}${u}${s && s !== "none" ? ` ${s}` : ""} ${!r || r === 1 / 0 ? "infinite" : r}${a === "normal" ? "" : ` ${a}`} ${e ? "" : "paused"}`;
786
+ function St(e, t) {
787
+ const { duration: n, delay: i, iterations: s = 1, fill: r, easing: c = "linear", direction: a } = e.options, m = e.effect.name, l = n === "auto";
788
+ return `${m} ${l ? "auto" : `${n}ms`}${l ? " " : ` ${i || 1}ms `}${c}${r && r !== "none" ? ` ${r}` : ""} ${!s || s === 1 / 0 ? "infinite" : s}${a === "normal" ? "" : ` ${a}`} ${t ? "" : "paused"}`;
783
789
  }
784
- function qt(t, e, n) {
785
- return t?.style ? (S(n) && (e.duration = e.duration || 1), t.style(e)) : [];
790
+ function qt(e, t, n) {
791
+ return e?.style ? (S(n) && (t.duration = t.duration || 1), e.style(t)) : [];
786
792
  }
787
- function Gt(t, e, n) {
788
- const i = O(e), r = qt(i, e), s = H(r, n, e.effectId), u = n?.trigger === "view-progress";
789
- return s.map((a, m) => {
790
- const { start: l, end: o } = u ? R(a.effect) : {};
793
+ function Gt(e, t, n) {
794
+ const i = I(t), s = qt(i, t), r = H(s, n, t.effectId, !0), c = n?.trigger === "view-progress";
795
+ return r.map((a, m) => {
796
+ const { start: l, end: o } = c ? R(a.effect) : {};
791
797
  return {
792
- target: $t(t, a.part),
793
- animation: St(a, u),
798
+ target: $t(e, a.part),
799
+ animation: St(a, c),
794
800
  composition: a.options.composite,
795
801
  custom: a.effect.custom,
796
802
  name: a.effect.name,
797
803
  keyframes: a.effect.keyframes,
798
804
  id: a.id && `${a.id}-${m + 1}`,
799
- animationTimeline: u ? `--${n?.id}` : "",
805
+ animationTimeline: c ? `--${n?.id}` : "",
800
806
  animationRange: l || o ? `${l} ${o}` : ""
801
807
  };
802
808
  });
803
809
  }
804
- function Pt(t, e, n) {
805
- const i = O(e), r = t instanceof HTMLElement ? t : w(t);
806
- if (i && i.prepare && r) {
807
- const s = { measure: L(r), mutate: j(r) };
808
- i.prepare(e, s);
810
+ function Pt(e, t, n) {
811
+ const i = I(t), s = e instanceof HTMLElement ? e : w(e);
812
+ if (i && i.prepare && s) {
813
+ const r = { measure: L(s), mutate: j(s) };
814
+ i.prepare(t, r);
809
815
  }
810
816
  n && E.mutate(n);
811
817
  }
812
- function Ct(t, e) {
813
- const n = O(e);
818
+ function Ct(e, t) {
819
+ const n = I(t);
814
820
  if (!n)
815
821
  return null;
816
822
  if (!n.style)
817
- return e.effectId && t ? zt(t, e.effectId) : null;
818
- const i = n.getNames(e), s = (typeof t == "string" ? w(t) : t)?.getAnimations(), u = s?.map((m) => m.animationName) || [], a = [];
823
+ return t.effectId && e ? zt(e, t.effectId) : null;
824
+ const i = n.getNames(t), r = (typeof e == "string" ? w(e) : e)?.getAnimations(), c = r?.map((m) => m.animationName) || [], a = [];
819
825
  return i.forEach((m) => {
820
- u.includes(m) && a.push(
821
- s?.find((l) => l.animationName === m)
826
+ c.includes(m) && a.push(
827
+ r?.find((l) => l.animationName === m)
822
828
  );
823
- }), a?.length ? new I(a) : null;
829
+ }), a?.length ? new O(a) : null;
824
830
  }
825
- function zt(t, e) {
826
- const i = (typeof t == "string" ? w(t) : t)?.getAnimations().filter((r) => {
827
- const s = r.id || r.animationName;
828
- return s ? s.startsWith(e) : !0;
831
+ function zt(e, t) {
832
+ const i = (typeof e == "string" ? w(e) : e)?.getAnimations().filter((s) => {
833
+ const r = s.id || s.animationName;
834
+ return r ? r.startsWith(t) : !0;
829
835
  });
830
- return i?.length ? new I(i) : null;
836
+ return i?.length ? new O(i) : null;
831
837
  }
832
- function Dt(t, e, n, i = {}) {
833
- const { disabled: r, allowActiveEvent: s, ...u } = i, a = W(t, e, n, u);
838
+ function Dt(e, t, n, i = {}) {
839
+ const { disabled: s, allowActiveEvent: r, ...c } = i, a = W(e, t, n, c);
834
840
  if (!a)
835
841
  return null;
836
842
  let m = {};
837
843
  if (n.trigger === "view-progress" && !window.ViewTimeline) {
838
844
  const l = n.element || w(n.componentId), { ready: o } = a;
839
- return a.animations.map((c) => ({
845
+ return a.animations.map((u) => ({
840
846
  /* we use getters for start and end in order to access the animation's start and end
841
847
  only when initializing the scrub scene rather than immediately */
842
848
  get start() {
843
- return c.start;
849
+ return u.start;
844
850
  },
845
851
  get end() {
846
- return c.end;
852
+ return u.end;
847
853
  },
848
854
  viewSource: l,
849
855
  ready: o,
@@ -851,16 +857,16 @@ function Dt(t, e, n, i = {}) {
851
857
  return a.getProgress();
852
858
  },
853
859
  effect(f, p) {
854
- const { activeDuration: h } = c.effect.getComputedTiming(), { delay: d } = c.effect.getTiming();
855
- c.currentTime = ((d || 0) + (h || 0)) * p;
860
+ const { activeDuration: h } = u.effect.getComputedTiming(), { delay: d } = u.effect.getTiming();
861
+ u.currentTime = ((d || 0) + (h || 0)) * p;
856
862
  },
857
- disabled: r,
863
+ disabled: s,
858
864
  destroy() {
859
- c.cancel();
865
+ u.cancel();
860
866
  }
861
867
  }));
862
868
  } else if (n.trigger === "pointer-move") {
863
- const l = e, { centeredToTarget: o, transitionDuration: c, transitionEasing: f } = l, p = n.axis;
869
+ const l = t, { centeredToTarget: o, transitionDuration: u, transitionEasing: f } = l, p = n.axis;
864
870
  if (l.keyframeEffect) {
865
871
  const h = a;
866
872
  return h.animations?.length === 0 ? null : {
@@ -875,7 +881,7 @@ function Dt(t, e, n, i = {}) {
875
881
  const y = p === "x" ? g.x : g.y;
876
882
  this._currentProgress = y, h.progress(y);
877
883
  },
878
- disabled: r ?? !1,
884
+ disabled: s ?? !1,
879
885
  destroy() {
880
886
  h.cancel();
881
887
  }
@@ -883,58 +889,58 @@ function Dt(t, e, n, i = {}) {
883
889
  }
884
890
  m = {
885
891
  centeredToTarget: o,
886
- allowActiveEvent: s
887
- }, e.customEffect && c && (m.transitionDuration = c, m.transitionEasing = D(f)), m.target = a.target;
892
+ allowActiveEvent: r
893
+ }, t.customEffect && u && (m.transitionDuration = u, m.transitionEasing = D(f)), m.target = a.target;
888
894
  }
889
895
  return {
890
896
  ...m,
891
897
  getProgress() {
892
898
  return a.getProgress();
893
899
  },
894
- effect(l, o, c, f) {
900
+ effect(l, o, u, f) {
895
901
  a.progress(
896
- c ? {
902
+ u ? {
897
903
  // @ts-expect-error spread error on p
898
904
  ...o,
899
- v: c,
905
+ v: u,
900
906
  active: f
901
907
  } : o
902
908
  );
903
909
  },
904
- disabled: r,
910
+ disabled: s,
905
911
  destroy() {
906
912
  a.cancel();
907
913
  }
908
914
  };
909
915
  }
910
- function Ft(t, e, n, i = !1) {
911
- const r = Ct(t, e);
912
- return r ? (r.ready = new Promise((s) => {
913
- Pt(t, e, s);
914
- }), r) : W(t, e, n, { reducedMotion: i });
916
+ function Ft(e, t, n, i = !1) {
917
+ const s = Ct(e, t);
918
+ return s ? (s.ready = new Promise((r) => {
919
+ Pt(e, t, r);
920
+ }), s) : W(e, t, n, { reducedMotion: i });
915
921
  }
916
- function xt(t) {
917
- return t === null ? [null] : typeof t == "string" ? Array.from(document.querySelectorAll(t)) : Array.isArray(t) ? t : [t];
922
+ function xt(e) {
923
+ return e === null ? [null] : typeof e == "string" ? Array.from(document.querySelectorAll(e)) : Array.isArray(e) ? e : [e];
918
924
  }
919
- function Mt(t, e) {
925
+ function Mt(e, t) {
920
926
  const n = [];
921
- for (const { target: i, options: r } of t) {
922
- const s = xt(i);
923
- for (const u of s) {
927
+ for (const { target: i, options: s } of e) {
928
+ const r = xt(i);
929
+ for (const c of r) {
924
930
  const a = Ft(
925
- u,
926
- r,
931
+ c,
932
+ s,
927
933
  void 0,
928
- e?.reducedMotion
934
+ t?.reducedMotion
929
935
  );
930
- a instanceof I && n.push(a);
936
+ a instanceof O && n.push(a);
931
937
  }
932
938
  }
933
939
  return n;
934
940
  }
935
- function Rt(t, e, n) {
936
- const i = Mt(e, n);
937
- return new Et(i, t);
941
+ function Rt(e, t, n) {
942
+ const i = Mt(t, n);
943
+ return new Et(i, e);
938
944
  }
939
945
  export {
940
946
  lt as backIn,