@wix/interact 2.2.2 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/react.js +1 -1
  3. package/dist/cjs/web.js +1 -1
  4. package/dist/es/index.js +1 -1
  5. package/dist/es/react.js +2 -2
  6. package/dist/es/web.js +2 -2
  7. package/dist/index-B9B40HvU.js +21 -0
  8. package/dist/index-B9B40HvU.js.map +1 -0
  9. package/dist/index-CBaynReP.mjs +3262 -0
  10. package/dist/index-CBaynReP.mjs.map +1 -0
  11. package/dist/tsconfig.build.tsbuildinfo +1 -1
  12. package/dist/types/core/css.d.ts +17 -2
  13. package/dist/types/core/css.d.ts.map +1 -1
  14. package/dist/types/core/cssUtils.d.ts +8 -0
  15. package/dist/types/core/cssUtils.d.ts.map +1 -0
  16. package/dist/types/core/resolvers.d.ts +4 -0
  17. package/dist/types/core/resolvers.d.ts.map +1 -0
  18. package/dist/types/core/utilities.d.ts +6 -0
  19. package/dist/types/core/utilities.d.ts.map +1 -1
  20. package/dist/types/handlers/viewProgress.d.ts.map +1 -1
  21. package/dist/types/types/config.d.ts +23 -2
  22. package/dist/types/types/config.d.ts.map +1 -1
  23. package/dist/types/types/css.d.ts +26 -0
  24. package/dist/types/types/css.d.ts.map +1 -0
  25. package/dist/types/types/effects.d.ts +12 -0
  26. package/dist/types/types/effects.d.ts.map +1 -1
  27. package/dist/types/types/external.d.ts +3 -3
  28. package/dist/types/types/external.d.ts.map +1 -1
  29. package/dist/types/types/index.d.ts +1 -0
  30. package/dist/types/types/index.d.ts.map +1 -1
  31. package/dist/types/types/internal.d.ts +1 -1
  32. package/dist/types/types/internal.d.ts.map +1 -1
  33. package/dist/types/utils.d.ts +11 -2
  34. package/dist/types/utils.d.ts.map +1 -1
  35. package/docs/README.md +1 -1
  36. package/docs/api/README.md +4 -4
  37. package/docs/api/functions.md +157 -42
  38. package/docs/examples/entrance-animations.md +7 -5
  39. package/docs/guides/getting-started.md +1 -1
  40. package/docs/integration/react.md +8 -8
  41. package/package.json +4 -3
  42. package/rules/full-lean.md +24 -15
  43. package/rules/integration.md +23 -17
  44. package/rules/viewenter.md +4 -2
  45. package/rules/viewprogress.md +52 -0
  46. package/dist/index-A2Q0e94t.js +0 -18
  47. package/dist/index-A2Q0e94t.js.map +0 -1
  48. package/dist/index-HeFaJMEX.mjs +0 -2839
  49. package/dist/index-HeFaJMEX.mjs.map +0 -1
@@ -0,0 +1,3262 @@
1
+ function gt(t) {
2
+ return [...t.matchAll(/\[([-\w]+)]/g)].map(([e, n]) => n);
3
+ }
4
+ function $(t, e) {
5
+ const n = gt(e);
6
+ let s = 0;
7
+ return n.length ? t.replace(/\[]/g, () => {
8
+ const i = n[s++];
9
+ return i !== void 0 ? `[${i}]` : "[]";
10
+ }) : t;
11
+ }
12
+ function vt(t, e) {
13
+ return t.trigger === "viewEnter" && e.triggerType === "once" && G(t) === G(e);
14
+ }
15
+ function G(t) {
16
+ const { key: e, listContainer: n, listItemSelector: s, selector: i } = t;
17
+ return `${e}\0${n || ""}\0${s || ""}\0${i || ""}`;
18
+ }
19
+ function He(t) {
20
+ let e = 0, n = 0;
21
+ for (let s = 0; s < t.length; s++) {
22
+ const i = t.charCodeAt(s);
23
+ e = (e << 5) - e + i | 0, n = n << 3 ^ n >>> 2 ^ i | 0;
24
+ }
25
+ return ((e >>> 0) * 1048576 + (n >>> 0) % 1048576).toString(36);
26
+ }
27
+ class V {
28
+ animations;
29
+ options;
30
+ ready;
31
+ isCSS;
32
+ longestAnimation;
33
+ constructor(e, n) {
34
+ this.animations = e, this.options = n, this.ready = n?.measured || Promise.resolve(), this.isCSS = e[0] instanceof CSSAnimation, this.longestAnimation = this._getAnimationWithLongestEndTime();
35
+ }
36
+ _getAnimationWithLongestEndTime() {
37
+ return this.animations.reduce((e, n) => {
38
+ const s = e.effect?.getComputedTiming().endTime ?? 0, i = n.effect?.getComputedTiming().endTime ?? 0;
39
+ return s > i ? e : n;
40
+ }, this.animations[0]);
41
+ }
42
+ getProgress() {
43
+ return this.longestAnimation?.effect?.getComputedTiming().progress || 0;
44
+ }
45
+ async play(e) {
46
+ await this.ready;
47
+ for (const n of this.animations)
48
+ n.play();
49
+ await Promise.all(this.animations.map((n) => n.ready)), e && e();
50
+ }
51
+ pause() {
52
+ for (const e of this.animations)
53
+ e.pause();
54
+ }
55
+ async reverse(e) {
56
+ await this.ready;
57
+ for (const n of this.animations)
58
+ n.reverse();
59
+ await Promise.all(this.animations.map((n) => n.ready)), e && e();
60
+ }
61
+ progress(e) {
62
+ for (const n of this.animations) {
63
+ const { delay: s, duration: i, iterations: r } = n.effect.getTiming(), o = (Number.isFinite(i) ? i : 0) * (Number.isFinite(r) ? r : 1);
64
+ n.currentTime = ((s || 0) + o) * e;
65
+ }
66
+ }
67
+ cancel() {
68
+ for (const e of this.animations)
69
+ e.cancel();
70
+ }
71
+ setPlaybackRate(e) {
72
+ for (const n of this.animations)
73
+ n.playbackRate = e;
74
+ }
75
+ async onFinish(e) {
76
+ try {
77
+ await Promise.all(this.animations.map((s) => s.finished));
78
+ const n = this.animations[0];
79
+ if (n && !this.isCSS) {
80
+ const s = n.effect?.target;
81
+ if (s) {
82
+ const i = new Event("animationend");
83
+ s.dispatchEvent(i);
84
+ }
85
+ }
86
+ e();
87
+ } catch (n) {
88
+ console.warn("animation was interrupted - aborting onFinish callback - ", n);
89
+ }
90
+ }
91
+ async onAbort(e) {
92
+ try {
93
+ await Promise.all(this.animations.map((n) => n.finished));
94
+ } catch (n) {
95
+ if (n.name === "AbortError") {
96
+ const s = this.animations[0];
97
+ if (s && !this.isCSS) {
98
+ const i = s.effect?.target;
99
+ if (i) {
100
+ const r = new Event("animationcancel");
101
+ i.dispatchEvent(r);
102
+ }
103
+ }
104
+ e();
105
+ }
106
+ }
107
+ }
108
+ get finished() {
109
+ return Promise.all(this.animations.map((e) => e.finished));
110
+ }
111
+ get playState() {
112
+ return this.animations[0]?.playState;
113
+ }
114
+ getTimingOptions() {
115
+ return this.animations.map((e) => {
116
+ const n = e.effect?.getTiming(), s = n?.delay ?? 0, i = Number(n?.duration) || 0, r = n?.iterations ?? 1;
117
+ return {
118
+ delay: s,
119
+ duration: i,
120
+ iterations: r
121
+ };
122
+ });
123
+ }
124
+ }
125
+ const je = (t) => t, yt = (t) => 1 - Math.cos(t * Math.PI / 2), Et = (t) => Math.sin(t * Math.PI / 2), wt = (t) => -(Math.cos(Math.PI * t) - 1) / 2, bt = (t) => t ** 2, St = (t) => 1 - (1 - t) ** 2, Tt = (t) => t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2, It = (t) => t ** 3, Ot = (t) => 1 - (1 - t) ** 3, Ct = (t) => t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2, kt = (t) => t ** 4, At = (t) => 1 - (1 - t) ** 4, $t = (t) => t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2, _t = (t) => t ** 5, qt = (t) => 1 - (1 - t) ** 5, Mt = (t) => t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2, xt = (t) => t === 0 ? 0 : 2 ** (10 * t - 10), Pt = (t) => t === 1 ? 1 : 1 - 2 ** (-10 * t), Lt = (t) => t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2, Rt = (t) => 1 - Math.sqrt(1 - t ** 2), Ft = (t) => Math.sqrt(1 - (t - 1) ** 2), Nt = (t) => t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2, zt = (t) => 2.70158 * t ** 3 - 1.70158 * t ** 2, Ht = (t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2, jt = (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, Te = {
126
+ linear: je,
127
+ sineIn: yt,
128
+ sineOut: Et,
129
+ sineInOut: wt,
130
+ quadIn: bt,
131
+ quadOut: St,
132
+ quadInOut: Tt,
133
+ cubicIn: It,
134
+ cubicOut: Ot,
135
+ cubicInOut: Ct,
136
+ quartIn: kt,
137
+ quartOut: At,
138
+ quartInOut: $t,
139
+ quintIn: _t,
140
+ quintOut: qt,
141
+ quintInOut: Mt,
142
+ expoIn: xt,
143
+ expoOut: Pt,
144
+ expoInOut: Lt,
145
+ circIn: Rt,
146
+ circOut: Ft,
147
+ circInOut: Nt,
148
+ backIn: zt,
149
+ backOut: Ht,
150
+ backInOut: jt
151
+ }, Ie = {
152
+ linear: "linear",
153
+ ease: "ease",
154
+ easeIn: "ease-in",
155
+ easeOut: "ease-out",
156
+ easeInOut: "ease-in-out",
157
+ sineIn: "cubic-bezier(0.47, 0, 0.745, 0.715)",
158
+ sineOut: "cubic-bezier(0.39, 0.575, 0.565, 1)",
159
+ sineInOut: "cubic-bezier(0.445, 0.05, 0.55, 0.95)",
160
+ quadIn: "cubic-bezier(0.55, 0.085, 0.68, 0.53)",
161
+ quadOut: "cubic-bezier(0.25, 0.46, 0.45, 0.94)",
162
+ quadInOut: "cubic-bezier(0.455, 0.03, 0.515, 0.955)",
163
+ cubicIn: "cubic-bezier(0.55, 0.055, 0.675, 0.19)",
164
+ cubicOut: "cubic-bezier(0.215, 0.61, 0.355, 1)",
165
+ cubicInOut: "cubic-bezier(0.645, 0.045, 0.355, 1)",
166
+ quartIn: "cubic-bezier(0.895, 0.03, 0.685, 0.22)",
167
+ quartOut: "cubic-bezier(0.165, 0.84, 0.44, 1)",
168
+ quartInOut: "cubic-bezier(0.77, 0, 0.175, 1)",
169
+ quintIn: "cubic-bezier(0.755, 0.05, 0.855, 0.06)",
170
+ quintOut: "cubic-bezier(0.23, 1, 0.32, 1)",
171
+ quintInOut: "cubic-bezier(0.86, 0, 0.07, 1)",
172
+ expoIn: "cubic-bezier(0.95, 0.05, 0.795, 0.035)",
173
+ expoOut: "cubic-bezier(0.19, 1, 0.22, 1)",
174
+ expoInOut: "cubic-bezier(1, 0, 0, 1)",
175
+ circIn: "cubic-bezier(0.6, 0.04, 0.98, 0.335)",
176
+ circOut: "cubic-bezier(0.075, 0.82, 0.165, 1)",
177
+ circInOut: "cubic-bezier(0.785, 0.135, 0.15, 0.86)",
178
+ backIn: "cubic-bezier(0.6, -0.28, 0.735, 0.045)",
179
+ backOut: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
180
+ backInOut: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
181
+ };
182
+ function Dt(t) {
183
+ return t === "percentage" ? "%" : t || "px";
184
+ }
185
+ function J(t) {
186
+ return t ? Ie[t] || t : Ie.linear;
187
+ }
188
+ function Gt(t, e, n, s) {
189
+ const i = 3 * t, r = 3 * (n - t) - i, o = 1 - i - r, c = 3 * e, a = 3 * (s - e) - c, l = 1 - c - a, f = (p) => ((o * p + r) * p + i) * p, u = (p) => ((l * p + a) * p + c) * p, d = (p) => (3 * o * p + 2 * r) * p + i;
190
+ function g(p) {
191
+ let m = p;
192
+ for (let y = 0; y < 8; y++) {
193
+ const E = f(m) - p;
194
+ if (Math.abs(E) < 1e-7) return m;
195
+ const w = d(m);
196
+ if (Math.abs(w) < 1e-6) break;
197
+ m -= E / w;
198
+ }
199
+ let h = 0, v = 1;
200
+ for (m = (h + v) / 2; v - h > 1e-7; ) {
201
+ const y = f(m);
202
+ if (Math.abs(y - p) < 1e-7) return m;
203
+ p > y ? h = m : v = m, m = (h + v) / 2;
204
+ }
205
+ return m;
206
+ }
207
+ return (p) => p <= 0 ? 0 : p >= 1 ? 1 : u(g(p));
208
+ }
209
+ function Wt(t) {
210
+ const e = t.match(
211
+ /^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/
212
+ );
213
+ if (!e) return;
214
+ const n = parseFloat(e[1]), s = parseFloat(e[2]), i = parseFloat(e[3]), r = parseFloat(e[4]);
215
+ if (![n, s, i, r].some(isNaN))
216
+ return Gt(n, s, i, r);
217
+ }
218
+ function Vt(t) {
219
+ const e = t.match(/^linear\((.+)\)$/);
220
+ if (!e) return;
221
+ const n = e[1].split(",").map((o) => o.trim()).filter(Boolean);
222
+ if (n.length === 0) return;
223
+ const s = [];
224
+ for (const o of n) {
225
+ const c = o.split(/\s+/), a = parseFloat(c[0]);
226
+ if (isNaN(a)) return;
227
+ const l = [];
228
+ for (let f = 1; f < c.length; f++)
229
+ if (c[f].endsWith("%")) {
230
+ const u = parseFloat(c[f]) / 100;
231
+ if (isNaN(u)) return;
232
+ l.push(u);
233
+ }
234
+ l.length === 0 ? s.push({ output: a, pos: null }) : l.length === 1 ? s.push({ output: a, pos: l[0] }) : (s.push({ output: a, pos: l[0] }), s.push({ output: a, pos: l[1] }));
235
+ }
236
+ if (s.length === 0) return;
237
+ s[0].pos === null && (s[0].pos = 0), s[s.length - 1].pos === null && (s[s.length - 1].pos = 1);
238
+ let i = 0;
239
+ for (; i < s.length; )
240
+ if (s[i].pos === null) {
241
+ const o = i - 1;
242
+ let c = i;
243
+ for (; c < s.length && s[c].pos === null; ) c++;
244
+ const a = s[o].pos, l = s[c].pos, f = c - o;
245
+ for (let u = o + 1; u < c; u++)
246
+ s[u].pos = a + (l - a) * (u - o) / f;
247
+ i = c + 1;
248
+ } else
249
+ i++;
250
+ for (let o = 1; o < s.length; o++)
251
+ s[o].pos < s[o - 1].pos && (s[o].pos = s[o - 1].pos);
252
+ const r = s;
253
+ return (o) => {
254
+ if (o <= r[0].pos) return r[0].output;
255
+ const c = r[r.length - 1];
256
+ if (o >= c.pos) return c.output;
257
+ let a = 0, l = r.length - 1;
258
+ for (; a < l - 1; ) {
259
+ const d = a + l >>> 1;
260
+ r[d].pos <= o ? a = d : l = d;
261
+ }
262
+ const f = r[a], u = r[l];
263
+ return u.pos === f.pos ? u.output : f.output + (u.output - f.output) * (o - f.pos) / (u.pos - f.pos);
264
+ };
265
+ }
266
+ function be(t) {
267
+ if (!t) return;
268
+ const e = Te[t];
269
+ return e || (Wt(t) ?? Vt(t) ?? Te.linear);
270
+ }
271
+ class Yt extends V {
272
+ animationGroups;
273
+ delay;
274
+ offset;
275
+ offsetEasing;
276
+ timingOptions;
277
+ constructor(e, n = {}) {
278
+ const s = e.flatMap((i) => [...i.animations]);
279
+ super(s), this.animationGroups = e, this.delay = n.delay ?? 0, this.offset = n.offset ?? 0, this.offsetEasing = typeof n.offsetEasing == "function" ? n.offsetEasing : be(n.offsetEasing) ?? je, this.timingOptions = this.animationGroups.map((i) => i.getTimingOptions().map(({ delay: r, duration: o, iterations: c }) => ({
280
+ delay: r,
281
+ duration: Number.isFinite(o) ? o : 0,
282
+ iterations: Number.isFinite(c) ? c : 1
283
+ }))), this.applyOffsets(), this.ready = Promise.all(e.map((i) => i.ready)).then(() => {
284
+ });
285
+ }
286
+ /**
287
+ * Calculates stagger delay offsets for each animation group using the formula:
288
+ * easing(i / last) * last * offset
289
+ * where i is the group index and last is the index of the final group.
290
+ */
291
+ calculateOffsets() {
292
+ const e = this.animationGroups.length;
293
+ if (e <= 1) return [0];
294
+ const n = e - 1;
295
+ return Array.from(
296
+ { length: e },
297
+ (s, i) => this.offsetEasing(i / n) * n * this.offset | 0
298
+ );
299
+ }
300
+ applyOffsets() {
301
+ if (this.animationGroups.length === 0 || this.animations.length === 0) return;
302
+ const e = this.calculateOffsets(), n = this.getSequenceActiveDuration(e);
303
+ this.animationGroups.forEach((s, i) => {
304
+ s.animations.forEach((r, o) => {
305
+ const c = r.effect;
306
+ if (!c) return;
307
+ const { delay: a, duration: l, iterations: f } = this.timingOptions[i][o], u = a + e[i], d = n - (u + l * f);
308
+ c.updateTiming({ delay: u + this.delay, endDelay: d });
309
+ });
310
+ });
311
+ }
312
+ getSequenceActiveDuration(e) {
313
+ const n = [];
314
+ for (let s = 0; s < this.timingOptions.length; s++) {
315
+ const i = this.timingOptions[s].reduce((r, o) => {
316
+ if (!o) return r;
317
+ const { delay: c, duration: a, iterations: l } = o;
318
+ return Math.max(r, c + a * l);
319
+ }, 0);
320
+ n.push(e[s] + i);
321
+ }
322
+ return Math.max(...n);
323
+ }
324
+ /**
325
+ * Inserts new AnimationGroups at specified indices, then recalculates
326
+ * stagger offsets for all groups. Each entry specifies the target index
327
+ * in the animationGroups array where the group should be inserted.
328
+ */
329
+ addGroups(e) {
330
+ if (e.length === 0) return;
331
+ const n = [...e].sort((s, i) => i.index - s.index);
332
+ for (const { index: s, group: i } of n) {
333
+ const r = Math.min(s, this.animationGroups.length);
334
+ this.animationGroups.splice(r, 0, i), this.timingOptions.splice(r, 0, i.getTimingOptions());
335
+ const o = [...i.animations], c = this.animationGroups.slice(0, r).reduce((a, l) => a + l.animations.length, 0);
336
+ this.animations.splice(c, 0, ...o);
337
+ }
338
+ this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((s) => s.ready)).then(() => {
339
+ });
340
+ }
341
+ /**
342
+ * Removes AnimationGroups that match the predicate, then recalculates
343
+ * stagger offsets for remaining groups. Cancelled animations in removed
344
+ * groups are returned.
345
+ */
346
+ removeGroups(e) {
347
+ const n = [], s = [], i = [];
348
+ for (let r = 0; r < this.animationGroups.length; r++)
349
+ e(this.animationGroups[r]) ? n.push(this.animationGroups[r]) : (s.push(this.animationGroups[r]), i.push(this.timingOptions[r]));
350
+ if (n.length === 0) return n;
351
+ for (const r of n)
352
+ r.cancel();
353
+ return this.animationGroups = s, this.timingOptions = i, this.animations = s.flatMap((r) => [...r.animations]), this.applyOffsets(), this.ready = Promise.all(this.animationGroups.map((r) => r.ready)).then(() => {
354
+ }), n;
355
+ }
356
+ async onFinish(e) {
357
+ try {
358
+ await Promise.all(this.animationGroups.map((n) => n.finished)), e();
359
+ } catch (n) {
360
+ console.warn("animation was interrupted - aborting onFinish callback - ", n);
361
+ }
362
+ }
363
+ }
364
+ class Kt {
365
+ _animation;
366
+ customEffect;
367
+ progress;
368
+ _tickCbId;
369
+ _finishHandler;
370
+ constructor(e, n, s, i) {
371
+ const r = new KeyframeEffect(n, [], {
372
+ ...s,
373
+ composite: "add"
374
+ }), { timeline: o } = i;
375
+ this._animation = new Animation(r, o), this._tickCbId = null, this.progress = null, this.customEffect = (c) => e(r.target, c), this._finishHandler = (c) => {
376
+ this.effect.target?.getAnimations().find((a) => a === this._animation) || this.cancel();
377
+ }, this.addEventListener("finish", this._finishHandler), this.addEventListener("remove", this._finishHandler);
378
+ }
379
+ // private tick method for customEffect loop implementation
380
+ _tick() {
381
+ try {
382
+ const e = this.effect?.getComputedTiming().progress ?? null;
383
+ e !== this.progress && (this.customEffect?.(e), this.progress = e), this._tickCbId = requestAnimationFrame(() => {
384
+ this._tick();
385
+ });
386
+ } catch (e) {
387
+ this._tickCbId = null, console.error(
388
+ `failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error ? e.message : e}`
389
+ );
390
+ }
391
+ }
392
+ // Animation timing properties
393
+ get currentTime() {
394
+ return this._animation.currentTime;
395
+ }
396
+ set currentTime(e) {
397
+ this._animation.currentTime = e;
398
+ }
399
+ get startTime() {
400
+ return this._animation.startTime;
401
+ }
402
+ set startTime(e) {
403
+ this._animation.startTime = e;
404
+ }
405
+ get playbackRate() {
406
+ return this._animation.playbackRate;
407
+ }
408
+ set playbackRate(e) {
409
+ this._animation.playbackRate = e;
410
+ }
411
+ // Animation basic properties
412
+ get id() {
413
+ return this._animation.id;
414
+ }
415
+ set id(e) {
416
+ this._animation.id = e;
417
+ }
418
+ get effect() {
419
+ return this._animation.effect;
420
+ }
421
+ set effect(e) {
422
+ this._animation.effect = e;
423
+ }
424
+ get timeline() {
425
+ return this._animation.timeline;
426
+ }
427
+ set timeline(e) {
428
+ this._animation.timeline = e;
429
+ }
430
+ // Animation readonly state properties
431
+ get finished() {
432
+ return this._animation.finished;
433
+ }
434
+ get pending() {
435
+ return this._animation.pending;
436
+ }
437
+ get playState() {
438
+ return this._animation.playState;
439
+ }
440
+ get ready() {
441
+ return this._animation.ready;
442
+ }
443
+ get replaceState() {
444
+ return this._animation.replaceState;
445
+ }
446
+ // Animation event handlers
447
+ get oncancel() {
448
+ return this._animation.oncancel;
449
+ }
450
+ set oncancel(e) {
451
+ this._animation.oncancel = e;
452
+ }
453
+ get onfinish() {
454
+ return this._animation.onfinish;
455
+ }
456
+ set onfinish(e) {
457
+ this._animation.onfinish = e;
458
+ }
459
+ get onremove() {
460
+ return this._animation.onremove;
461
+ }
462
+ set onremove(e) {
463
+ this._animation.onremove = e;
464
+ }
465
+ // CustomAnimation overridden methods
466
+ play() {
467
+ this._animation.play(), cancelAnimationFrame(this._tickCbId), this._tickCbId = requestAnimationFrame(() => this._tick());
468
+ }
469
+ pause() {
470
+ this._animation.pause(), cancelAnimationFrame(this._tickCbId), this._tickCbId = null;
471
+ }
472
+ cancel() {
473
+ this.removeEventListener("finish", this._finishHandler), this.removeEventListener("remove", this._finishHandler), this._animation.cancel(), this.customEffect(null), cancelAnimationFrame(this._tickCbId), this._tickCbId = null;
474
+ }
475
+ commitStyles() {
476
+ console.warn(
477
+ "CustomEffect animations do not support commitStyles method as they have no style to commit"
478
+ );
479
+ }
480
+ // Animation methods without override
481
+ finish() {
482
+ this._animation.finish();
483
+ }
484
+ persist() {
485
+ this._animation.persist();
486
+ }
487
+ reverse() {
488
+ this._animation.reverse();
489
+ }
490
+ updatePlaybackRate(e) {
491
+ this._animation.updatePlaybackRate(e);
492
+ }
493
+ // Animation events API
494
+ addEventListener(e, n, s) {
495
+ this._animation.addEventListener(e, n, s);
496
+ }
497
+ removeEventListener(e, n, s) {
498
+ this._animation.removeEventListener(e, n, s);
499
+ }
500
+ dispatchEvent(e) {
501
+ return this._animation.dispatchEvent(e);
502
+ }
503
+ }
504
+ function Bt(t) {
505
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
506
+ }
507
+ var ee = { exports: {} }, Oe = ee.exports, Ce;
508
+ function Qt() {
509
+ return Ce || (Ce = 1, (function(t) {
510
+ (function(e) {
511
+ var n = function() {
512
+ }, s = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.msRequestAnimationFrame || function(f) {
513
+ return setTimeout(f, 16);
514
+ };
515
+ function i() {
516
+ var f = this;
517
+ f.reads = [], f.writes = [], f.raf = s.bind(e);
518
+ }
519
+ i.prototype = {
520
+ constructor: i,
521
+ /**
522
+ * We run this inside a try catch
523
+ * so that if any jobs error, we
524
+ * are able to recover and continue
525
+ * to flush the batch until it's empty.
526
+ *
527
+ * @param {Array} tasks
528
+ */
529
+ runTasks: function(f) {
530
+ for (var u; u = f.shift(); ) u();
531
+ },
532
+ /**
533
+ * Adds a job to the read batch and
534
+ * schedules a new frame if need be.
535
+ *
536
+ * @param {Function} fn
537
+ * @param {Object} ctx the context to be bound to `fn` (optional).
538
+ * @public
539
+ */
540
+ measure: function(f, u) {
541
+ var d = u ? f.bind(u) : f;
542
+ return this.reads.push(d), r(this), d;
543
+ },
544
+ /**
545
+ * Adds a job to the
546
+ * write batch and schedules
547
+ * a new frame if need be.
548
+ *
549
+ * @param {Function} fn
550
+ * @param {Object} ctx the context to be bound to `fn` (optional).
551
+ * @public
552
+ */
553
+ mutate: function(f, u) {
554
+ var d = u ? f.bind(u) : f;
555
+ return this.writes.push(d), r(this), d;
556
+ },
557
+ /**
558
+ * Clears a scheduled 'read' or 'write' task.
559
+ *
560
+ * @param {Object} task
561
+ * @return {Boolean} success
562
+ * @public
563
+ */
564
+ clear: function(f) {
565
+ return c(this.reads, f) || c(this.writes, f);
566
+ },
567
+ /**
568
+ * Extend this FastDom with some
569
+ * custom functionality.
570
+ *
571
+ * Because fastdom must *always* be a
572
+ * singleton, we're actually extending
573
+ * the fastdom instance. This means tasks
574
+ * scheduled by an extension still enter
575
+ * fastdom's global task queue.
576
+ *
577
+ * The 'super' instance can be accessed
578
+ * from `this.fastdom`.
579
+ *
580
+ * @example
581
+ *
582
+ * var myFastdom = fastdom.extend({
583
+ * initialize: function() {
584
+ * // runs on creation
585
+ * },
586
+ *
587
+ * // override a method
588
+ * measure: function(fn) {
589
+ * // do extra stuff ...
590
+ *
591
+ * // then call the original
592
+ * return this.fastdom.measure(fn);
593
+ * },
594
+ *
595
+ * ...
596
+ * });
597
+ *
598
+ * @param {Object} props properties to mixin
599
+ * @return {FastDom}
600
+ */
601
+ extend: function(f) {
602
+ if (typeof f != "object") throw new Error("expected object");
603
+ var u = Object.create(this);
604
+ return a(u, f), u.fastdom = this, u.initialize && u.initialize(), u;
605
+ },
606
+ // override this with a function
607
+ // to prevent Errors in console
608
+ // when tasks throw
609
+ catch: null
610
+ };
611
+ function r(f) {
612
+ f.scheduled || (f.scheduled = !0, f.raf(o.bind(null, f)));
613
+ }
614
+ function o(f) {
615
+ var u = f.writes, d = f.reads, g;
616
+ try {
617
+ n("flushing reads", d.length), f.runTasks(d), n("flushing writes", u.length), f.runTasks(u);
618
+ } catch (p) {
619
+ g = p;
620
+ }
621
+ if (f.scheduled = !1, (d.length || u.length) && r(f), g)
622
+ if (n("task errored", g.message), f.catch) f.catch(g);
623
+ else throw g;
624
+ }
625
+ function c(f, u) {
626
+ var d = f.indexOf(u);
627
+ return !!~d && !!f.splice(d, 1);
628
+ }
629
+ function a(f, u) {
630
+ for (var d in u)
631
+ u.hasOwnProperty(d) && (f[d] = u[d]);
632
+ }
633
+ var l = e.fastdom = e.fastdom || new i();
634
+ t.exports = l;
635
+ })(typeof window < "u" ? window : typeof Oe < "u" ? Oe : globalThis);
636
+ })(ee)), ee.exports;
637
+ }
638
+ var Ut = Qt();
639
+ const O = /* @__PURE__ */ Bt(Ut), de = {};
640
+ function Xt(t) {
641
+ Object.assign(de, t);
642
+ }
643
+ function Zt(t) {
644
+ return t in de ? de[t] : (console.warn(
645
+ `${t} not found in registry. Please make sure to import and register the preset.`
646
+ ), null);
647
+ }
648
+ function N(t, e) {
649
+ return t ? (e || document).getElementById(t) : null;
650
+ }
651
+ function Jt(t, e) {
652
+ return t?.matches(`[data-motion-part~="${e}"]`) ? t : t?.querySelector(`[data-motion-part~="${e}"]`);
653
+ }
654
+ function en(t) {
655
+ const e = t.alternate ? "alternate" : "";
656
+ return t.reversed ? `${e ? `${e}-` : ""}reverse` : e || "normal";
657
+ }
658
+ function ae(t) {
659
+ return `${t.value}${Dt(t.unit)}`;
660
+ }
661
+ function ke(t, e, n) {
662
+ return `${t.name || "cover"} ${n && t.offset.unit !== "percentage" ? `calc(100% + ${ae(t.offset)}${e ? ` + ${e}` : ""})` : e ? `calc(${ae(t.offset)} + ${e})` : ae(t.offset)}`;
663
+ }
664
+ function De(t) {
665
+ return {
666
+ start: ke(t.startOffset, t.startOffsetAdd),
667
+ end: ke(t.endOffset, t.endOffsetAdd, !0)
668
+ };
669
+ }
670
+ function Ge(t) {
671
+ return (e) => O.measure(() => e(t));
672
+ }
673
+ function We(t) {
674
+ return (e) => O.mutate(() => e(t));
675
+ }
676
+ function W(t) {
677
+ if (t.namedEffect) {
678
+ const e = t.namedEffect.type;
679
+ return typeof e == "string" ? Zt(e) : null;
680
+ } else if (t.keyframeEffect) {
681
+ const e = (s) => {
682
+ const { name: i, keyframes: r } = s.keyframeEffect;
683
+ return [{ ...s, name: i, keyframes: r }];
684
+ };
685
+ return { web: e, style: e, getNames: (s) => {
686
+ const { effectId: i } = s, { name: r } = s.keyframeEffect, o = r || i;
687
+ return o ? [o] : [];
688
+ } };
689
+ } else if (t.customEffect)
690
+ return (e) => [{ ...e, keyframes: [] }];
691
+ return null;
692
+ }
693
+ function Ve(t, e, n, s) {
694
+ return t.map((i, r) => {
695
+ const o = {
696
+ fill: i.fill,
697
+ easing: J(i.easing),
698
+ iterations: i.iterations === 0 ? 1 / 0 : i.iterations || 1,
699
+ composite: i.composite,
700
+ direction: en(i)
701
+ };
702
+ return Se(e) ? (o.duration = i.duration, o.delay = i.delay || 0) : e?.trigger === "view-progress" && (s || window.ViewTimeline) ? o.duration = "auto" : (o.duration = 99.99, o.delay = 0.01), {
703
+ effect: i,
704
+ options: o,
705
+ id: n && `${n}-${r + 1}`,
706
+ part: i.part
707
+ };
708
+ });
709
+ }
710
+ function Se(t) {
711
+ return !t || t.trigger !== "pointer-move" && t.trigger !== "view-progress";
712
+ }
713
+ function Ae(t, e, n, s, i) {
714
+ if (t) {
715
+ if (Se(s) && (e.duration = e.duration || 1, i?.reducedMotion))
716
+ if (e.iterations === 1 || e.iterations == null)
717
+ e = { ...e, duration: 1 };
718
+ else
719
+ return [];
720
+ let r;
721
+ return n instanceof HTMLElement && (r = { measure: Ge(n), mutate: We(n) }), t.web ? t.web(e, r, i) : t(e, r, i);
722
+ }
723
+ return [];
724
+ }
725
+ function Ye(t, e, n, s, i) {
726
+ const r = t instanceof HTMLElement ? t : N(t, i);
727
+ if (n?.trigger === "pointer-move" && !e.keyframeEffect) {
728
+ let d = e;
729
+ e.customEffect && (d = {
730
+ ...e,
731
+ namedEffect: { id: "", type: "CustomMouse" }
732
+ });
733
+ const g = W(
734
+ d
735
+ ), p = Ae(
736
+ g,
737
+ e,
738
+ r,
739
+ n,
740
+ s
741
+ );
742
+ return typeof p != "function" ? null : p(r);
743
+ }
744
+ const o = W(e), c = Ae(
745
+ o,
746
+ e,
747
+ r,
748
+ n,
749
+ s
750
+ );
751
+ if (!c || c.length === 0)
752
+ return null;
753
+ const a = Ve(c, n, e.effectId);
754
+ let l;
755
+ const f = n?.trigger === "view-progress";
756
+ f && window.ViewTimeline && (l = new ViewTimeline({
757
+ subject: n.element || N(n.componentId)
758
+ }));
759
+ const u = a.map(({ effect: d, options: g, id: p, part: m }) => {
760
+ const h = m ? Jt(r, m) : r, v = new KeyframeEffect(h || null, [], g);
761
+ O.mutate(() => {
762
+ "timing" in d && v.updateTiming(d.timing), v.setKeyframes(d.keyframes);
763
+ });
764
+ const y = f && l ? { timeline: l } : {}, E = typeof d.customEffect == "function" ? new Kt(
765
+ d.customEffect,
766
+ h || null,
767
+ g,
768
+ y
769
+ ) : new Animation(v, y.timeline);
770
+ if (f)
771
+ if (l)
772
+ O.mutate(() => {
773
+ const { start: w, end: S } = De(d);
774
+ E.rangeStart = w, E.rangeEnd = S, E.play();
775
+ });
776
+ else {
777
+ const { startOffset: w, endOffset: S } = e;
778
+ O.mutate(() => {
779
+ const T = d.startOffset || w, I = d.endOffset || S;
780
+ Object.assign(E, {
781
+ start: {
782
+ name: T.name,
783
+ offset: T.offset?.value,
784
+ add: d.startOffsetAdd
785
+ },
786
+ end: {
787
+ name: I.name,
788
+ offset: I.offset?.value,
789
+ add: d.endOffsetAdd
790
+ }
791
+ });
792
+ });
793
+ }
794
+ return p && (E.id = p), E;
795
+ });
796
+ return new V(u, {
797
+ ...e,
798
+ trigger: { ...n || {} },
799
+ // make sure the group is ready after all animation targets are measured and mutated
800
+ measured: new Promise((d) => O.mutate(d))
801
+ });
802
+ }
803
+ function tn(t, e) {
804
+ return t ? `#${t}${e ? `[data-motion-part~="${e}"]` : ""}` : "";
805
+ }
806
+ function nn(t, e) {
807
+ const { duration: n, delay: s, iterations: i = 1, fill: r, easing: o = "linear", direction: c } = t.options, a = t.effect.name, l = n === "auto";
808
+ return `${a} ${l ? "auto" : `${n}ms`}${l ? " " : ` ${s || 1}ms `}${o}${r && r !== "none" ? ` ${r}` : ""} ${!i || i === 1 / 0 ? "infinite" : i}${c === "normal" ? "" : ` ${c}`} ${e ? "" : "paused"}`;
809
+ }
810
+ function sn(t, e, n) {
811
+ return t?.style ? (Se(n) && (e.duration = e.duration || 1), t.style(e)) : [];
812
+ }
813
+ function rn(t, e, n) {
814
+ const s = W(e), i = sn(s, e), r = Ve(i, n, e.effectId, !0), o = n?.trigger === "view-progress";
815
+ return r.map((c, a) => {
816
+ const { start: l, end: f } = o ? De(c.effect) : {};
817
+ return {
818
+ target: tn(t, c.part),
819
+ animation: nn(c, o),
820
+ composition: c.options.composite,
821
+ custom: c.effect.custom,
822
+ name: c.effect.name,
823
+ keyframes: c.effect.keyframes,
824
+ id: c.id && `${c.id}-${a + 1}`,
825
+ animationTimeline: o ? `--${n?.id}` : "",
826
+ animationRange: l || f ? `${l} ${f}` : ""
827
+ };
828
+ });
829
+ }
830
+ function on(t, e, n) {
831
+ const s = W(e), i = t instanceof HTMLElement ? t : N(t);
832
+ if (s && s.prepare && i) {
833
+ const r = { measure: Ge(i), mutate: We(i) };
834
+ s.prepare(e, r);
835
+ }
836
+ n && O.mutate(n);
837
+ }
838
+ function cn(t, e) {
839
+ const n = W(e);
840
+ if (!n)
841
+ return null;
842
+ if (!n.style)
843
+ return e.effectId && t ? an(t, e.effectId) : null;
844
+ const s = n.getNames(e), r = (typeof t == "string" ? N(t) : t)?.getAnimations(), o = r?.map((a) => a.animationName) || [], c = [];
845
+ return s.forEach((a) => {
846
+ o.includes(a) && c.push(
847
+ r?.find((l) => l.animationName === a)
848
+ );
849
+ }), c?.length ? new V(c) : null;
850
+ }
851
+ function an(t, e) {
852
+ const s = (typeof t == "string" ? N(t) : t)?.getAnimations().filter((i) => {
853
+ const r = i.id || i.animationName;
854
+ return r ? r.startsWith(e) : !0;
855
+ });
856
+ return s?.length ? new V(s) : null;
857
+ }
858
+ function Ke(t, e, n, s = {}) {
859
+ const { disabled: i, allowActiveEvent: r, ...o } = s, c = Ye(t, e, n, o);
860
+ if (!c)
861
+ return null;
862
+ let a = {};
863
+ if (n.trigger === "view-progress" && !window.ViewTimeline) {
864
+ const l = n.element || N(n.componentId), { ready: f } = c;
865
+ return c.animations.map((u) => ({
866
+ /* we use getters for start and end in order to access the animation's start and end
867
+ only when initializing the scrub scene rather than immediately */
868
+ get start() {
869
+ return u.start;
870
+ },
871
+ get end() {
872
+ return u.end;
873
+ },
874
+ viewSource: l,
875
+ ready: f,
876
+ getProgress() {
877
+ return c.getProgress();
878
+ },
879
+ effect(d, g) {
880
+ const { activeDuration: p } = u.effect.getComputedTiming(), { delay: m } = u.effect.getTiming();
881
+ u.currentTime = ((m || 0) + (p || 0)) * g;
882
+ },
883
+ disabled: i,
884
+ destroy() {
885
+ u.cancel();
886
+ }
887
+ }));
888
+ } else if (n.trigger === "pointer-move") {
889
+ const l = e, { centeredToTarget: f, transitionDuration: u, transitionEasing: d } = l, g = n.axis;
890
+ if (l.keyframeEffect) {
891
+ const p = c;
892
+ return p.animations?.length === 0 ? null : {
893
+ target: void 0,
894
+ centeredToTarget: f,
895
+ ready: p.ready,
896
+ _currentProgress: 0,
897
+ getProgress() {
898
+ return this._currentProgress;
899
+ },
900
+ effect(h, v) {
901
+ const y = g === "x" ? v.x : v.y;
902
+ this._currentProgress = y, p.progress(y);
903
+ },
904
+ disabled: i ?? !1,
905
+ destroy() {
906
+ p.cancel();
907
+ }
908
+ };
909
+ }
910
+ a = {
911
+ centeredToTarget: f,
912
+ allowActiveEvent: r
913
+ }, e.customEffect && u && (a.transitionDuration = u, a.transitionEasing = be(d)), a.target = c.target;
914
+ }
915
+ return {
916
+ ...a,
917
+ getProgress() {
918
+ return c.getProgress();
919
+ },
920
+ effect(l, f, u, d) {
921
+ c.progress(
922
+ u ? {
923
+ // @ts-expect-error spread error on p
924
+ ...f,
925
+ v: u,
926
+ active: d
927
+ } : f
928
+ );
929
+ },
930
+ disabled: i,
931
+ destroy() {
932
+ c.cancel();
933
+ }
934
+ };
935
+ }
936
+ function Y(t, e, n, s = !1) {
937
+ const i = cn(t, e);
938
+ return i ? (i.ready = new Promise((r) => {
939
+ on(t, e, r);
940
+ }), i) : Ye(t, e, n, { reducedMotion: s });
941
+ }
942
+ function fn(t) {
943
+ return t === null ? [null] : typeof t == "string" ? Array.from(document.querySelectorAll(t)) : Array.isArray(t) ? t : [t];
944
+ }
945
+ function Be(t, e) {
946
+ const n = [];
947
+ for (const { target: s, options: i } of t) {
948
+ const r = fn(s);
949
+ for (const o of r) {
950
+ const c = Y(
951
+ o,
952
+ i,
953
+ void 0,
954
+ e?.reducedMotion
955
+ );
956
+ c instanceof V && n.push(c);
957
+ }
958
+ }
959
+ return n;
960
+ }
961
+ function ln(t, e, n) {
962
+ const s = Be(e, n);
963
+ return new Yt(s, t);
964
+ }
965
+ function un(t, e = 2) {
966
+ return parseFloat(t.toFixed(e));
967
+ }
968
+ function dn(t) {
969
+ return /\[]/g.test(t);
970
+ }
971
+ function hn(t) {
972
+ return `--${t.join("-")}`;
973
+ }
974
+ function mn(t) {
975
+ return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
976
+ }
977
+ function pn(t, e, n, s) {
978
+ const i = t.length - 1;
979
+ t.forEach((r, o) => {
980
+ if (r) {
981
+ const c = o ? s(o / i) * i * n | 0 : 0;
982
+ r.delay = e + c + (r.delay || 0);
983
+ }
984
+ });
985
+ }
986
+ function te(t, e) {
987
+ return e.includes("&") ? e.replace(/&/g, t) : `${t}${e}`;
988
+ }
989
+ function A() {
990
+ return "wi-12343210".replace(
991
+ /\d/g,
992
+ (t) => String.fromCharCode(
993
+ (+t ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> +t / 4) + 97
994
+ )
995
+ // 97 for "a"
996
+ );
997
+ }
998
+ function Qe(t) {
999
+ let { transition: e, transitionProperties: n } = t, s = [];
1000
+ if (e?.styleProperties) {
1001
+ const { duration: i, easing: r, delay: o } = e;
1002
+ i && (e.styleProperties.some(
1003
+ (a) => a.name.startsWith("--")
1004
+ ) ? s = [
1005
+ `all ${i}ms ${J(r || "ease")}${o ? ` ${o}ms` : ""}`,
1006
+ "visibility 0s"
1007
+ ] : s = e.styleProperties.map(
1008
+ (a) => `${a.name} ${i}ms ${J(
1009
+ r || "ease"
1010
+ )}${o ? ` ${o}ms` : ""}`
1011
+ ));
1012
+ } else
1013
+ s = n?.filter((i) => i.duration).map(
1014
+ (i) => `${i.name} ${i.duration}ms ${J(i.easing) || "ease"}${i.delay ? ` ${i.delay}ms` : ""}`
1015
+ ) || [];
1016
+ return s;
1017
+ }
1018
+ function gn({
1019
+ key: t,
1020
+ effectId: e,
1021
+ transition: n,
1022
+ transitionProperties: s,
1023
+ childSelector: i = "> :first-child",
1024
+ selectorCondition: r
1025
+ }) {
1026
+ const o = Qe({
1027
+ transition: n,
1028
+ transitionProperties: s
1029
+ }), c = (n?.styleProperties || s)?.map(
1030
+ (p) => `${p.name}: ${p.value};`
1031
+ ) || [], a = t.replace(/"/g, "'"), l = `:is(:state(${e}), :--${e}) ${i}`, f = `[data-interact-effect~="${e}"] ${i}`, u = r ? te(l, r) : l, d = r ? te(f, r) : f, g = [
1032
+ `${u},
1033
+ ${d} {
1034
+ ${c.join(`
1035
+ `)}
1036
+ }`
1037
+ ];
1038
+ if (o.length) {
1039
+ const p = `[data-interact-key="${a}"] ${i}`, m = r ? te(p, r) : p;
1040
+ g.push(`@media (prefers-reduced-motion: no-preference) { ${m} {
1041
+ transition: ${o.join(", ")};
1042
+ } }`);
1043
+ }
1044
+ return g;
1045
+ }
1046
+ function ce(t, e, n) {
1047
+ const s = (t || []).filter((i) => e[i]?.type === n && e[i].predicate).map((i) => e[i].predicate).join(") and (");
1048
+ return s && `(${s})`;
1049
+ }
1050
+ function _(t, e) {
1051
+ const n = ce(t, e, "media");
1052
+ return n && window.matchMedia(n);
1053
+ }
1054
+ function P(t, e) {
1055
+ return (t || []).filter((n) => e[n]?.type === "selector" && e[n].predicate).map((n) => `:is(${e[n].predicate})`).join("");
1056
+ }
1057
+ const B = {
1058
+ rangeStart: { name: "cover", offset: { value: 0, unit: "percentage" } },
1059
+ rangeEnd: { name: "cover", offset: { value: 100, unit: "percentage" } }
1060
+ };
1061
+ function vn(t, e) {
1062
+ const n = t?.name ?? B.rangeStart.name, s = e?.name ?? t?.name ?? B.rangeEnd.name, i = {
1063
+ name: n,
1064
+ offset: t?.offset || B.rangeStart.offset
1065
+ }, r = {
1066
+ name: s,
1067
+ offset: e?.offset || B.rangeEnd.offset
1068
+ };
1069
+ return { startOffset: i, endOffset: r };
1070
+ }
1071
+ function L(t) {
1072
+ if ("keyframeEffect" in t && !t.keyframeEffect.name && "effectId" in t && (t.keyframeEffect.name = t.effectId), "duration" in t)
1073
+ return {
1074
+ id: "",
1075
+ ...t
1076
+ };
1077
+ const { rangeStart: e, rangeEnd: n, ...s } = t, { startOffset: i, endOffset: r } = vn(e, n);
1078
+ return {
1079
+ id: "",
1080
+ startOffset: i,
1081
+ endOffset: r,
1082
+ ...s
1083
+ };
1084
+ }
1085
+ function k(t, e, n) {
1086
+ let s = t.get(e);
1087
+ s || (s = /* @__PURE__ */ new Set(), t.set(e, s)), s.add(n);
1088
+ }
1089
+ function K(t, e) {
1090
+ t.get(e)?.forEach((s) => {
1091
+ const { source: i, target: r, cleanup: o } = s;
1092
+ o();
1093
+ const c = i === e ? r : i;
1094
+ t.get(c)?.delete(s);
1095
+ }), t.delete(e);
1096
+ }
1097
+ const yn = {
1098
+ root: null,
1099
+ rootMargin: "0px 0px -10% 0px",
1100
+ threshold: [0]
1101
+ }, En = {
1102
+ root: null,
1103
+ rootMargin: "0px",
1104
+ threshold: [0]
1105
+ }, wn = 0.2;
1106
+ function bn(t) {
1107
+ const e = t.trim().split(/\s+/), n = e[0], s = e.length > 1 ? e[1] : e[0], i = (r) => r.startsWith("-") ? r.slice(1) : parseFloat(r) ? `-${r}` : r;
1108
+ return `${i(n)} 0px ${i(s)}`;
1109
+ }
1110
+ const D = {}, q = /* @__PURE__ */ new WeakMap(), re = /* @__PURE__ */ new WeakSet(), z = /* @__PURE__ */ new WeakMap();
1111
+ let Ue = {}, H = null;
1112
+ function Sn(t) {
1113
+ Ue = t;
1114
+ }
1115
+ function Xe(t, e, n) {
1116
+ q.get(t)?.forEach(({ source: i, handler: r }) => {
1117
+ i === t && r(e, n);
1118
+ });
1119
+ }
1120
+ function $e() {
1121
+ return H || (H = new IntersectionObserver((t) => {
1122
+ t.forEach((e) => {
1123
+ const n = e.target;
1124
+ e.isIntersecting || Xe(n, !1, !0);
1125
+ });
1126
+ }, En), H);
1127
+ }
1128
+ function Ze(t, e = !1) {
1129
+ const n = JSON.stringify({ ...t, isSafeMode: e });
1130
+ if (D[n])
1131
+ return D[n];
1132
+ const s = t.threshold ?? wn, i = e ? yn : {
1133
+ root: null,
1134
+ rootMargin: t.inset ? bn(t.inset) : "0px",
1135
+ threshold: s
1136
+ }, r = new IntersectionObserver((o) => {
1137
+ o.forEach((c) => {
1138
+ const a = c.target, l = !re.has(a);
1139
+ if (l && (re.add(a), t.useSafeViewEnter && !c.isIntersecting)) {
1140
+ O.measure(() => {
1141
+ const f = c.boundingClientRect.height, u = c.rootBounds?.height;
1142
+ if (!u)
1143
+ return;
1144
+ const d = Array.isArray(t.threshold) ? Math.min(...t.threshold) : t.threshold;
1145
+ d && f * d > u && O.mutate(() => {
1146
+ r.unobserve(a);
1147
+ const p = Ze(t, !0);
1148
+ z.set(a, p), p.observe(a);
1149
+ });
1150
+ });
1151
+ return;
1152
+ }
1153
+ (c.isIntersecting || !l) && Xe(a, c.isIntersecting);
1154
+ });
1155
+ }, i);
1156
+ return D[n] = r, r;
1157
+ }
1158
+ function Tn(t, e, n, s = {}, { reducedMotion: i, selectorCondition: r, animation: o } = {}) {
1159
+ const c = { ...Ue, ...s }, a = n.triggerType || "once", l = o || Y(
1160
+ e,
1161
+ L(n),
1162
+ void 0,
1163
+ i
1164
+ );
1165
+ if (!l)
1166
+ return;
1167
+ const f = Ze(c);
1168
+ a !== "once" && l.persist?.();
1169
+ let u = !0, d = !1, g;
1170
+ g = { source: t, target: e, handler: (h, v) => {
1171
+ if (!(r && !e.matches(r)))
1172
+ if (a === "once") {
1173
+ if (h && !d) {
1174
+ d = !0, q.get(t)?.delete(g), q.get(e)?.delete(g);
1175
+ const y = q.get(t);
1176
+ (!y || y.size === 0) && ((z.get(t) || f).unobserve(t), re.delete(t)), l.play(() => {
1177
+ const E = () => {
1178
+ e.dataset.interactEnter = "start";
1179
+ };
1180
+ if (l.isCSS) {
1181
+ O.mutate(() => {
1182
+ requestAnimationFrame(E);
1183
+ });
1184
+ const w = () => {
1185
+ O.mutate(() => {
1186
+ e.dataset.interactEnter = "done";
1187
+ });
1188
+ };
1189
+ l.onFinish(w), l.onAbort(w);
1190
+ } else
1191
+ O.mutate(E);
1192
+ });
1193
+ }
1194
+ } else a === "alternate" ? u && h ? (u = !1, l.play()) : u || l.reverse() : a === "repeat" ? h ? (l.progress(0), l.play()) : v && (l.pause(), l.progress(0)) : a === "state" && (h ? l.play() : v && l.pause());
1195
+ }, cleanup: () => {
1196
+ (z.get(t) || f).unobserve(t), (a === "repeat" || a === "state") && $e().unobserve(t), l.cancel(), re.delete(t), z.delete(t);
1197
+ } }, k(q, t, g), k(q, e, g), z.set(t, f), f.observe(t), (a === "repeat" || a === "state") && $e().observe(t);
1198
+ }
1199
+ function In(t) {
1200
+ K(q, t);
1201
+ }
1202
+ function On() {
1203
+ H = null, Object.keys(D).forEach((t) => delete D[t]);
1204
+ }
1205
+ const _e = {
1206
+ add: Tn,
1207
+ remove: In,
1208
+ setOptions: Sn,
1209
+ reset: On
1210
+ };
1211
+ function Je(t, e) {
1212
+ return Object.assign(Object.create(e), t);
1213
+ }
1214
+ function Cn(t, e, n, s) {
1215
+ let i = t * (1 - n) + e * n;
1216
+ if (s) {
1217
+ const r = i - t;
1218
+ Math.abs(r) < s && (i = t + s * Math.sign(r));
1219
+ const o = e - i;
1220
+ if (Math.abs(o) < s)
1221
+ return e;
1222
+ }
1223
+ return i;
1224
+ }
1225
+ function kn(t) {
1226
+ let e = !1;
1227
+ return function() {
1228
+ e || (e = !0, window.requestAnimationFrame(() => {
1229
+ e = !1, t();
1230
+ }));
1231
+ };
1232
+ }
1233
+ function qe(t, e) {
1234
+ let n = 0;
1235
+ return function() {
1236
+ n && window.clearTimeout(n), n = window.setTimeout(() => {
1237
+ n = 0, t();
1238
+ }, e);
1239
+ };
1240
+ }
1241
+ function An(t, e) {
1242
+ const n = t.match(/^calc\s*\(\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\+\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\)\s*$/);
1243
+ return oe(n[1], e) + oe(n[6], e);
1244
+ }
1245
+ function oe(t, e) {
1246
+ return t ? /^-?\d+px$/.test(t) ? parseInt(t) : /^-?\d+[lsd]?vh$/.test(t) ? parseInt(t) * e.viewportHeight / 100 : /^-?\d+[lsd]?vw$/.test(t) ? parseInt(t) * e.viewportWidth / 100 : /^calc\s*\(\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\+\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\)\s*$/.test(t) ? An(t, e) : parseInt(t) || 0 : 0;
1247
+ }
1248
+ function R(t, e, n) {
1249
+ const { name: s, offset: i = 0 } = t, { start: r, end: o } = n, c = o - r, a = i / 100;
1250
+ let l, f;
1251
+ return s === "entry" ? (l = r - e, f = Math.min(e, c)) : s === "entry-crossing" ? (l = r - e, f = c) : s === "contain" ? (l = Math.min(o - e, r), f = Math.abs(e - c)) : s === "exit" ? (l = Math.max(r, o - e), f = Math.min(e, c)) : s === "exit-crossing" ? (l = r, f = c) : s === "cover" && (l = r - e, f = c + e), l + a * f | 0;
1252
+ }
1253
+ function fe(t, e, n, s, i) {
1254
+ let r = 0;
1255
+ const o = { start: e, end: n };
1256
+ return t.forEach((c, a) => {
1257
+ r += c.offset;
1258
+ const l = c.sticky;
1259
+ if (l) {
1260
+ if ("end" in l && t[a - 1]?.element) {
1261
+ const d = ((i ? c.element.offsetWidth : c.element.offsetHeight) || 0) + l.end - s, g = r + d - c.offset, p = g < o.start, m = !p && g <= n;
1262
+ let h = 0;
1263
+ (p || m) && (h = c.offset, o.end += h), p && (o.start += h);
1264
+ }
1265
+ if ("start" in l) {
1266
+ const f = r - l.start, u = f < o.start, d = !u && f <= o.end;
1267
+ let g = 0;
1268
+ const p = t[a - 1]?.element;
1269
+ if (p) {
1270
+ if (u || d) {
1271
+ const m = (i ? p.offsetWidth : p.offsetHeight) || 0, h = c.offset, v = (i ? c.element.offsetWidth : c.element.offsetHeight) || 0;
1272
+ g = m - (h + v), r += g, o.end += g;
1273
+ }
1274
+ u && (o.start += g);
1275
+ }
1276
+ }
1277
+ }
1278
+ }), o;
1279
+ }
1280
+ function $n(t, e, n, s, i, r) {
1281
+ const { start: o, end: c, duration: a } = t;
1282
+ let l = o, f = c, u = t.startRange, d = t.endRange, g;
1283
+ if (typeof a == "string") {
1284
+ u = { name: a, offset: 0 }, d = { name: a, offset: 100 }, l = R(u, n, e), f = R(d, n, e), g = f - l;
1285
+ const p = fe(r, l, f, n, s);
1286
+ l = p.start, f = p.end;
1287
+ } else {
1288
+ if (u || o?.name) {
1289
+ u = u || o;
1290
+ const p = oe(u.add, i), m = R({ ...u, offset: 0 }, n, e), h = R({ ...u, offset: 100 }, n, e), v = fe(r, m, h, n, s);
1291
+ l = v.start + u.offset / 100 * (v.end - v.start) + p;
1292
+ }
1293
+ if (d || c?.name) {
1294
+ d = d || c;
1295
+ const p = oe(d.add, i), m = R({ ...d, offset: 0 }, n, e), h = R({ ...d, offset: 100 }, n, e), v = fe(r, m, h, n, s);
1296
+ f = v.start + d.offset / 100 * (v.end - v.start) + p;
1297
+ } else typeof a == "number" && (f = l + a);
1298
+ }
1299
+ return !g && !a && (g = f - l), { ...t, start: l, end: f, startRange: u, endRange: d, duration: g || a };
1300
+ }
1301
+ function _n(t) {
1302
+ return t.position === "sticky";
1303
+ }
1304
+ function qn(t, e, n) {
1305
+ return t.position === "fixed" && (!e || e === window.document.body || e === n);
1306
+ }
1307
+ function Mn(t, e) {
1308
+ return parseInt(e ? t.left : t.top);
1309
+ }
1310
+ function xn(t, e) {
1311
+ return parseInt(e ? t.right : t.bottom);
1312
+ }
1313
+ function Pn(t, e, n) {
1314
+ n && (t.style.position = "static");
1315
+ const s = (e ? t.offsetLeft : t.offsetTop) || 0;
1316
+ return n && (t.style.position = null), s;
1317
+ }
1318
+ function Ln(t, e) {
1319
+ let n;
1320
+ const s = Mn(t, e), i = xn(t, e), r = !isNaN(s), o = !isNaN(i);
1321
+ return (r || o) && (n = {}, r && (n.start = s), o && (n.end = i)), n;
1322
+ }
1323
+ function Q(t, e, n, s, i) {
1324
+ const r = t[0].viewSource, o = [];
1325
+ let c = (s ? r.offsetWidth : r.offsetHeight) || 0, a = 0, l = r;
1326
+ for (; l; ) {
1327
+ const u = window.getComputedStyle(l), d = _n(u), g = d ? Ln(u, s) : void 0, p = Pn(l, s, d);
1328
+ if ((!g || !("end" in g)) && (a += p), o.push({ element: l, offset: p, sticky: g }), l = l.offsetParent, qn(u, l, e))
1329
+ break;
1330
+ if (l === e) {
1331
+ o.push({ element: l, offset: 0 });
1332
+ break;
1333
+ }
1334
+ }
1335
+ return o.reverse(), t.map((u) => ({
1336
+ ...$n(
1337
+ u,
1338
+ { start: a, end: a + c },
1339
+ n,
1340
+ s,
1341
+ i,
1342
+ o
1343
+ )
1344
+ }));
1345
+ }
1346
+ const Me = 100, Rn = {
1347
+ horizontal: !1,
1348
+ observeViewportEntry: !0,
1349
+ viewportRootMargin: "7% 7%",
1350
+ observeViewportResize: !1,
1351
+ observeSourcesResize: !1,
1352
+ observeContentResize: !1
1353
+ };
1354
+ function Fn(t, e, n, s) {
1355
+ let i = 0;
1356
+ return t >= e && t <= n ? i = s ? (t - e) / s : 1 : t > n && (i = 1), i;
1357
+ }
1358
+ function xe(t, e) {
1359
+ return t === window ? e ? window.document.documentElement.clientWidth : window.document.documentElement.clientHeight : e ? t.clientWidth : t.clientHeight;
1360
+ }
1361
+ function Nn() {
1362
+ return {
1363
+ viewportWidth: window.document.documentElement.clientWidth,
1364
+ viewportHeight: window.document.documentElement.clientHeight
1365
+ };
1366
+ }
1367
+ function zn(t) {
1368
+ const e = Je(t, Rn), n = e.root, s = e.horizontal, i = /* @__PURE__ */ new WeakMap();
1369
+ let r = xe(n, s), o, c, a, l, f;
1370
+ const u = [], d = Nn();
1371
+ if (e.scenes = Object.values(
1372
+ // TODO(ameerf): find a polyfill and use groupBy instead of following reduce
1373
+ t.scenes.reduce(
1374
+ (m, h, v) => {
1375
+ const y = h.groupId ? `group-${h.groupId}` : String(v);
1376
+ return m[y] ? m[y].push(h) : m[y] = [h], m;
1377
+ },
1378
+ {}
1379
+ )
1380
+ ).flatMap((m) => (m.every((h) => h.viewSource && (typeof h.duration == "string" || h.start?.name)) ? (m = Q(m, n, r, s, d), (e.observeSourcesResize || e.observeContentResize) && u.push(m)) : m.forEach((h) => {
1381
+ h.end == null && (h.end = h.start + h.duration), h.duration == null && (h.duration = h.end - h.start);
1382
+ }), m)), e.scenes.forEach((m, h) => {
1383
+ m.index = h;
1384
+ }), u.length) {
1385
+ const m = /* @__PURE__ */ new Map();
1386
+ window.ResizeObserver && (a = new window.ResizeObserver(function(h) {
1387
+ h.forEach((v) => {
1388
+ const y = m.get(v.target), E = Q(y, n, r, s, d);
1389
+ E.forEach((w, S) => {
1390
+ e.scenes[w.index] = E[S];
1391
+ }), u.splice(u.indexOf(y), 1, E);
1392
+ });
1393
+ }), u.forEach((h) => {
1394
+ a.observe(h[0].viewSource, { box: "border-box" }), m.set(h[0].viewSource, h);
1395
+ }), e.observeContentResize && e.contentRoot && new window.ResizeObserver(qe(() => {
1396
+ const v = u.map((y) => {
1397
+ const E = Q(y, n, r, s, d);
1398
+ return E.forEach((w, S) => {
1399
+ e.scenes[w.index] = E[S];
1400
+ }), E;
1401
+ });
1402
+ u.length = 0, u.push(...v), u.forEach((y) => {
1403
+ m.set(y[0].viewSource, y);
1404
+ });
1405
+ }, Me)).observe(e.contentRoot, { box: "border-box" })), e.observeViewportResize && (l = qe(function() {
1406
+ r = xe(n, s);
1407
+ const h = u.map((v) => {
1408
+ const y = Q(v, n, r, s, d);
1409
+ return y.forEach((E, w) => {
1410
+ e.scenes[E.index] = y[w];
1411
+ }), y;
1412
+ });
1413
+ u.length = 0, u.push(...h), u.forEach((v) => {
1414
+ m.set(v[0].viewSource, v);
1415
+ });
1416
+ }, Me), n === window ? window.addEventListener("resize", l) : window.ResizeObserver && (f = new window.ResizeObserver(l), f.observe(n, { box: "border-box" })));
1417
+ }
1418
+ e.observeViewportEntry && window.IntersectionObserver && (c = new window.IntersectionObserver(function(m) {
1419
+ m.forEach((h) => {
1420
+ (i.get(h.target) || []).forEach((v) => {
1421
+ v.disabled = !h.isIntersecting;
1422
+ });
1423
+ });
1424
+ }, {
1425
+ root: n === window ? window.document : n,
1426
+ rootMargin: e.viewportRootMargin,
1427
+ threshold: 0
1428
+ }), e.scenes.forEach((m) => {
1429
+ if (m.viewSource) {
1430
+ let h = i.get(m.viewSource);
1431
+ h || (h = [], i.set(m.viewSource, h), c.observe(m.viewSource)), h.push(m);
1432
+ }
1433
+ }));
1434
+ function g({ p: m, vp: h }) {
1435
+ m = +m.toFixed(1);
1436
+ const v = +h.toFixed(4);
1437
+ if (m !== o) {
1438
+ for (let y of e.scenes)
1439
+ if (!y.disabled) {
1440
+ const { start: E, end: w, duration: S } = y, T = Fn(m, E, w, S);
1441
+ y.effect(y, T, v);
1442
+ }
1443
+ o = m;
1444
+ }
1445
+ }
1446
+ function p() {
1447
+ e.scenes.forEach((m) => m.destroy?.()), c && (c.disconnect(), c = null), a && (a.disconnect(), a = null), l && (f ? (f.disconnect(), f = null) : window.removeEventListener("resize", l));
1448
+ }
1449
+ return {
1450
+ tick: g,
1451
+ destroy: p
1452
+ };
1453
+ }
1454
+ const Hn = {
1455
+ transitionActive: !1,
1456
+ transitionFriction: 0.9,
1457
+ transitionEpsilon: 1,
1458
+ velocityActive: !1,
1459
+ velocityMax: 1
1460
+ };
1461
+ class jn {
1462
+ constructor(e = {}) {
1463
+ this.config = Je(e, Hn), this.progress = {
1464
+ p: 0,
1465
+ prevP: 0,
1466
+ vp: 0
1467
+ }, this.currentProgress = {
1468
+ p: 0,
1469
+ prevP: 0,
1470
+ vp: 0
1471
+ }, this._lerpFrameId = 0, this.effect = null;
1472
+ const n = !this.config.root || this.config.root === window.document.body;
1473
+ this.config.root = n ? window : this.config.root, this.config.contentRoot = this.config.contentRoot || (n ? window.document.body : this.config.root.firstElementChild), this.config.resetProgress = this.config.resetProgress || this.resetProgress.bind(this), this._measure = this.config.measure || (() => {
1474
+ const s = this.config.root;
1475
+ this.progress.p = this.config.horizontal ? s.scrollX || s.scrollLeft || 0 : s.scrollY || s.scrollTop || 0;
1476
+ }), this._trigger = kn(() => {
1477
+ this._measure?.(), this.tick(!0);
1478
+ });
1479
+ }
1480
+ /**
1481
+ * Setup event and effect, and reset progress and frame.
1482
+ */
1483
+ start() {
1484
+ this.setupEffect(), this.setupEvent(), this.resetProgress(), this.tick();
1485
+ }
1486
+ /**
1487
+ * Removes event listener.
1488
+ */
1489
+ pause() {
1490
+ this.removeEvent();
1491
+ }
1492
+ /**
1493
+ * Reset progress in the DOM and inner state to given x and y.
1494
+ *
1495
+ * @param {Object} [scrollPosition]
1496
+ * @param {number} [scrollPosition.x]
1497
+ * @param {number} [scrollPosition.y]
1498
+ */
1499
+ resetProgress(e = {}) {
1500
+ const n = this.config.root, s = e.x || e.x === 0 ? e.x : n.scrollX || n.scrollLeft || 0, i = e.y || e.y === 0 ? e.y : n.scrollY || n.scrollTop || 0, r = this.config.horizontal ? s : i;
1501
+ this.progress.p = r, this.progress.prevP = r, this.progress.vp = 0, this.config.transitionActive && (this.currentProgress.p = r, this.currentProgress.prevP = r, this.currentProgress.vp = 0), e && this.config.root.scrollTo(s, i);
1502
+ }
1503
+ /**
1504
+ * Handle animation frame work.
1505
+ *
1506
+ * @param {boolean} [clearLerpFrame] whether to cancel an existing lerp frame
1507
+ */
1508
+ tick(e) {
1509
+ const n = this.config.transitionActive;
1510
+ n && this.lerp();
1511
+ const s = n ? this.currentProgress : this.progress;
1512
+ if (this.config.velocityActive) {
1513
+ const i = s.p - s.prevP, r = i < 0 ? -1 : 1;
1514
+ s.vp = Math.min(this.config.velocityMax, Math.abs(i)) / this.config.velocityMax * r;
1515
+ }
1516
+ this.effect.tick(s), n && s.p !== this.progress.p && (e && this._lerpFrameId && window.cancelAnimationFrame(this._lerpFrameId), this._lerpFrameId = window.requestAnimationFrame(() => this.tick())), s.prevP = s.p;
1517
+ }
1518
+ /**
1519
+ * Calculate current progress.
1520
+ */
1521
+ lerp() {
1522
+ this.currentProgress.p = Cn(this.currentProgress.p, this.progress.p, +(1 - this.config.transitionFriction).toFixed(3), this.config.transitionEpsilon);
1523
+ }
1524
+ /**
1525
+ * Stop the event and effect, and remove all DOM side-effects.
1526
+ */
1527
+ destroy() {
1528
+ this.pause(), this.removeEffect();
1529
+ }
1530
+ /**
1531
+ * Register to scroll for triggering update.
1532
+ */
1533
+ setupEvent() {
1534
+ this.removeEvent(), this.config.root.addEventListener("scroll", this._trigger);
1535
+ }
1536
+ /**
1537
+ * Remove scroll handler.
1538
+ */
1539
+ removeEvent() {
1540
+ this.config.root.removeEventListener("scroll", this._trigger);
1541
+ }
1542
+ /**
1543
+ * Reset registered effect.
1544
+ */
1545
+ setupEffect() {
1546
+ this.removeEffect(), this.effect = zn(this.config);
1547
+ }
1548
+ /**
1549
+ * Remove registered effect.
1550
+ */
1551
+ removeEffect() {
1552
+ this.effect && this.effect.destroy(), this.effect = null;
1553
+ }
1554
+ }
1555
+ const he = /* @__PURE__ */ new WeakMap();
1556
+ let et = () => ({});
1557
+ function Dn(t) {
1558
+ et = t;
1559
+ }
1560
+ function Gn(t, e, n, s, { reducedMotion: i }) {
1561
+ if (i)
1562
+ return;
1563
+ const r = {
1564
+ trigger: "view-progress",
1565
+ element: t
1566
+ }, o = L(n);
1567
+ let c;
1568
+ if ("ViewTimeline" in window) {
1569
+ const l = Y(
1570
+ e,
1571
+ o,
1572
+ r
1573
+ );
1574
+ l && !l.isCSS && (l.play(), c = () => {
1575
+ l.ready.then(() => {
1576
+ l.cancel();
1577
+ });
1578
+ });
1579
+ } else {
1580
+ const l = Ke(e, o, r);
1581
+ if (l) {
1582
+ const f = Array.isArray(l) ? l : [l], u = new jn({
1583
+ viewSource: t,
1584
+ scenes: f,
1585
+ observeViewportEntry: !1,
1586
+ observeViewportResize: !1,
1587
+ observeSourcesResize: !0,
1588
+ root: document.body,
1589
+ ...et()
1590
+ });
1591
+ c = () => {
1592
+ u.destroy();
1593
+ }, Promise.all(f.map((d) => d.ready || Promise.resolve())).then(
1594
+ () => {
1595
+ u.start();
1596
+ }
1597
+ );
1598
+ }
1599
+ }
1600
+ if (!c) return;
1601
+ const a = { source: t, target: e, cleanup: c };
1602
+ k(he, t, a), k(he, e, a);
1603
+ }
1604
+ function Wn(t) {
1605
+ K(he, t);
1606
+ }
1607
+ const Vn = {
1608
+ add: Gn,
1609
+ remove: Wn,
1610
+ registerOptionsGetter: Dn
1611
+ };
1612
+ function Pe(t, e, n) {
1613
+ return Math.min(Math.max(t, n), e);
1614
+ }
1615
+ function Le(t) {
1616
+ let e = !1;
1617
+ return function() {
1618
+ if (!e)
1619
+ return e = !0, window.requestAnimationFrame(() => {
1620
+ e = !1, t();
1621
+ });
1622
+ };
1623
+ }
1624
+ function Yn(t) {
1625
+ let e = t, n = 0, s = 0;
1626
+ if (e.offsetParent)
1627
+ do
1628
+ n += e.offsetLeft, s += e.offsetTop, e = e.offsetParent;
1629
+ while (e);
1630
+ return {
1631
+ left: n,
1632
+ top: s,
1633
+ width: t.offsetWidth,
1634
+ height: t.offsetHeight
1635
+ };
1636
+ }
1637
+ function Kn() {
1638
+ const t = window.devicePixelRatio;
1639
+ let e = !1;
1640
+ if (t === 1)
1641
+ return !1;
1642
+ document.body.addEventListener("pointerdown", (s) => {
1643
+ e = s.offsetX !== 10;
1644
+ }, { once: !0 });
1645
+ const n = new PointerEvent("pointerdown", {
1646
+ clientX: 10
1647
+ });
1648
+ return document.body.dispatchEvent(n), e;
1649
+ }
1650
+ function Bn() {
1651
+ return new Promise((t) => {
1652
+ const e = window.scrollY;
1653
+ let n = !1, s;
1654
+ function i() {
1655
+ document.body.addEventListener("pointerdown", (c) => {
1656
+ s === void 0 ? s = c.offsetY : n = c.offsetY === s;
1657
+ }, { once: !0 });
1658
+ const o = new PointerEvent("pointerdown", {
1659
+ clientY: 500
1660
+ });
1661
+ document.body.dispatchEvent(o);
1662
+ }
1663
+ function r() {
1664
+ window.scrollY !== e && (window.removeEventListener("scroll", r), i(), t(n));
1665
+ }
1666
+ i(), window.addEventListener("scroll", r), window.scrollY > 0 && window.scrollBy(0, -1);
1667
+ });
1668
+ }
1669
+ function Qn(t) {
1670
+ Bn().then((e) => {
1671
+ t.fixRequired = e, e && (window.addEventListener("scroll", t.scrollHandler), t.scrollHandler());
1672
+ });
1673
+ }
1674
+ let U = 0;
1675
+ const ne = /* @__PURE__ */ new Set();
1676
+ function Un() {
1677
+ const t = (n) => {
1678
+ for (let s of n.changedTouches)
1679
+ ne.add(s.identifier);
1680
+ }, e = (n) => {
1681
+ for (let s of n.changedTouches)
1682
+ ne.delete(s.identifier);
1683
+ };
1684
+ return document.addEventListener("touchstart", t, { passive: !0 }), document.addEventListener("touchend", e, { passive: !0 }), function() {
1685
+ ne.clear(), document.removeEventListener("touchstart", t), document.removeEventListener("touchend", e);
1686
+ };
1687
+ }
1688
+ function Xn(t, e) {
1689
+ if ("onscrollend" in window)
1690
+ return t.addEventListener("scrollend", e), function() {
1691
+ t.removeEventListener("scrollend", e);
1692
+ };
1693
+ let n = 0, s;
1694
+ U || (s = Un()), U += 1;
1695
+ function i(r) {
1696
+ clearTimeout(n), n = setTimeout(() => {
1697
+ ne.size ? setTimeout(i, 100) : (e(r), n = 0);
1698
+ }, 100);
1699
+ }
1700
+ return t.addEventListener("scroll", i), function() {
1701
+ t.removeEventListener("scroll", i), U -= 1, U || s();
1702
+ };
1703
+ }
1704
+ function Zn(t, e, n) {
1705
+ return {
1706
+ x(s) {
1707
+ const i = t.left - n.x + t.width / 2, r = i >= e.width / 2, o = (r ? i : e.width - i) * 2, c = r ? 0 : i - o / 2;
1708
+ return (s - c) / o;
1709
+ },
1710
+ y(s) {
1711
+ const i = t.top - n.y + t.height / 2, r = i >= e.height / 2, o = (r ? i : e.height - i) * 2, c = r ? 0 : i - o / 2;
1712
+ return (s - c) / o;
1713
+ }
1714
+ };
1715
+ }
1716
+ function Jn(t, e) {
1717
+ this.x = window.scrollX, this.y = window.scrollY, requestAnimationFrame(() => t && t(e));
1718
+ }
1719
+ function es(t) {
1720
+ t.rect.width = window.document.documentElement.clientWidth, t.rect.height = window.document.documentElement.clientHeight;
1721
+ }
1722
+ function ts(t) {
1723
+ const e = new ResizeObserver((n) => {
1724
+ n.forEach((s) => {
1725
+ t.rect.width = s.borderBoxSize[0].inlineSize, t.rect.height = s.borderBoxSize[0].blockSize;
1726
+ });
1727
+ });
1728
+ return e.observe(t.root, { box: "border-box" }), e;
1729
+ }
1730
+ function ns(t) {
1731
+ let e = !1, n = { x: t.rect.width / 2, y: t.rect.height / 2, vx: 0, vy: 0 }, s, i, r, o, c;
1732
+ const a = { x: 0, y: 0 };
1733
+ t.scenes.forEach((f) => {
1734
+ f.target && f.centeredToTarget && (f.transform = Zn(Yn(f.target), t.rect, a), e = !0), t.root ? i = ts(t) : (r = es.bind(null, t), window.addEventListener("resize", r));
1735
+ }), s = function(f) {
1736
+ for (let u of t.scenes)
1737
+ if (!u.disabled) {
1738
+ const d = u.transform?.x(f.x) || f.x / t.rect.width, g = u.transform?.y(f.y) || f.y / t.rect.height, p = +Pe(0, 1, d).toPrecision(4), m = +Pe(0, 1, g).toPrecision(4), h = { x: f.vx, y: f.vy };
1739
+ t.allowActiveEvent && (f.active = d <= 1 && g <= 1 && d >= 0 && g >= 0), u.effect(u, { x: p, y: m }, h, f.active);
1740
+ }
1741
+ Object.assign(n, f);
1742
+ }, e && (o = Jn.bind(a, s, n), c = Xn(document, o));
1743
+ function l() {
1744
+ t.scenes.forEach((f) => f.destroy?.()), c?.(), i ? (i.disconnect(), i = null) : (window.removeEventListener("resize", r), r = null), s = null, n = null;
1745
+ }
1746
+ return {
1747
+ tick: s,
1748
+ destroy: l
1749
+ };
1750
+ }
1751
+ const ss = 1e3 / 60 * 3;
1752
+ let X;
1753
+ function is() {
1754
+ F.x = window.scrollX, F.y = window.scrollY;
1755
+ }
1756
+ const F = { x: 0, y: 0, scrollHandler: is, fixRequired: void 0 };
1757
+ class rs {
1758
+ constructor(e = {}) {
1759
+ this.config = { ...e }, this.effect = null, this._nextTick = null, this._nextTransitionTick = null, this._startTime = 0;
1760
+ let n;
1761
+ this.config.transitionDuration ? n = this.config.noThrottle ? () => this.transition() : Le(() => this.transition()) : n = this.config.noThrottle ? () => (this.tick(), null) : Le(() => {
1762
+ this.tick();
1763
+ }), this.config.rect = this.config.root ? {
1764
+ width: this.config.root.offsetWidth,
1765
+ height: this.config.root.offsetHeight
1766
+ } : {
1767
+ width: window.document.documentElement.clientWidth,
1768
+ height: window.document.documentElement.clientHeight
1769
+ }, this.progress = {
1770
+ x: this.config.rect.width / 2,
1771
+ y: this.config.rect.height / 2,
1772
+ vx: 0,
1773
+ vy: 0
1774
+ }, this.previousProgress = { ...this.progress }, this.currentProgress = null;
1775
+ const s = (i) => {
1776
+ const r = this.config.root ? i.offsetX : i.x, o = this.config.root ? i.offsetY : i.y;
1777
+ this.progress.vx = r - this.progress.x, this.progress.vy = o - this.progress.y, this.progress.x = r, this.progress.y = o, this._nextTick = n();
1778
+ };
1779
+ if (this._pointerLeave = () => {
1780
+ this.progress.active = !1, this.progress.vx = 0, this.progress.vy = 0, this._nextTick = n();
1781
+ }, this._pointerEnter = () => {
1782
+ this.progress.active = !0, this._nextTick = n();
1783
+ }, this.config.root) {
1784
+ X = typeof X == "boolean" ? X : Kn();
1785
+ const i = X ? window.devicePixelRatio : 1;
1786
+ typeof F.fixRequired > "u" && Qn(F), this._measure = (r) => {
1787
+ if (r.target !== this.config.root) {
1788
+ const o = new PointerEvent("pointermove", {
1789
+ bubbles: !0,
1790
+ cancelable: !0,
1791
+ clientX: r.x * i + F.x,
1792
+ clientY: r.y * i + F.y
1793
+ });
1794
+ r.stopPropagation(), this.config.root.dispatchEvent(o);
1795
+ } else
1796
+ s(r);
1797
+ };
1798
+ } else
1799
+ this._measure = s;
1800
+ }
1801
+ /**
1802
+ * Setup event and effect, and reset progress and frame.
1803
+ */
1804
+ start() {
1805
+ this.setupEffect(), this.setupEvent();
1806
+ }
1807
+ /**
1808
+ * Removes event listener.
1809
+ */
1810
+ pause() {
1811
+ this.removeEvent();
1812
+ }
1813
+ /**
1814
+ * Handle animation frame work.
1815
+ */
1816
+ tick() {
1817
+ this.effect.tick(this.progress);
1818
+ }
1819
+ /**
1820
+ * Starts a transition from the previous progress to the current progress.
1821
+ *
1822
+ * @returns {number} the requestAnimationFrame id for the transition tick.
1823
+ */
1824
+ transition() {
1825
+ const e = this.config.transitionDuration, n = this.config.transitionEasing || ((o) => o), s = performance.now();
1826
+ let i = !1;
1827
+ const r = (o) => {
1828
+ const c = (o - this._startTime) / e, a = n(Math.min(1, c));
1829
+ i && (this.progress.vx = 0, this.progress.vy = 0, i = !1), this.currentProgress = Object.entries(this.progress).reduce((l, [f, u]) => (f === "active" ? l[f] = u : l[f] = this.previousProgress[f] + (u - this.previousProgress[f]) * a, l), this.currentProgress || {}), c < 1 && (this._nextTransitionTick = requestAnimationFrame(r), i = o - this._startTime > ss), this.effect.tick(this.currentProgress);
1830
+ };
1831
+ return this._startTime ? (this._nextTransitionTick && cancelAnimationFrame(this._nextTransitionTick), Object.assign(this.previousProgress, this.currentProgress), this._startTime = s, r(s)) : this._startTime = s, this._nextTransitionTick;
1832
+ }
1833
+ /**
1834
+ * Stop the event and effect, and remove all DOM side effects.
1835
+ */
1836
+ destroy() {
1837
+ this.pause(), this.removeEffect(), this._nextTick && cancelAnimationFrame(this._nextTick), this._nextTransitionTick && cancelAnimationFrame(this._nextTransitionTick);
1838
+ }
1839
+ /**
1840
+ * Register to pointermove for triggering update.
1841
+ */
1842
+ setupEvent() {
1843
+ this.removeEvent();
1844
+ const e = this.config.root || window;
1845
+ e.addEventListener("pointermove", this._measure, { passive: !0 }), this.config.eventSource && this.config.eventSource.addEventListener("pointermove", this._measure, { passive: !0 }), this.config.allowActiveEvent && (e.addEventListener("pointerleave", this._pointerLeave, { passive: !0 }), e.addEventListener("pointerenter", this._pointerEnter, { passive: !0 }), this.config.eventSource && (this.config.eventSource.addEventListener("pointerleave", this._pointerLeave, { passive: !0 }), this.config.eventSource.addEventListener("pointerenter", this._pointerEnter, { passive: !0 })));
1846
+ }
1847
+ /**
1848
+ * Remove pointermove handler.
1849
+ */
1850
+ removeEvent() {
1851
+ const e = this.config.root || window;
1852
+ e.removeEventListener("pointermove", this._measure), this.config.eventSource && this.config.eventSource.removeEventListener("pointermove", this._measure), this.config.allowActiveEvent && (e.removeEventListener("pointerleave", this._pointerLeave), e.removeEventListener("pointerenter", this._pointerEnter), this.config.eventSource && (this.config.eventSource.removeEventListener("pointerleave", this._pointerLeave), this.config.eventSource.removeEventListener("pointerenter", this._pointerEnter)));
1853
+ }
1854
+ /**
1855
+ * Reset registered effect.
1856
+ */
1857
+ setupEffect() {
1858
+ this.removeEffect(), this.effect = ns(this.config);
1859
+ }
1860
+ /**
1861
+ * Remove registered effect.
1862
+ */
1863
+ removeEffect() {
1864
+ this.effect && this.effect.destroy(), this.effect = null;
1865
+ }
1866
+ }
1867
+ const me = /* @__PURE__ */ new WeakMap();
1868
+ let tt = () => ({});
1869
+ function os(t) {
1870
+ tt = t;
1871
+ }
1872
+ function cs(t, e, n, s = {}, { reducedMotion: i }) {
1873
+ if (i)
1874
+ return;
1875
+ const r = {
1876
+ trigger: "pointer-move",
1877
+ element: t,
1878
+ axis: s.axis ?? "y"
1879
+ }, o = Ke(e, L(n), r);
1880
+ if (o) {
1881
+ const c = Array.isArray(o) ? o : [o], a = new rs({
1882
+ root: s.hitArea === "self" ? t : void 0,
1883
+ scenes: c,
1884
+ ...tt()
1885
+ }), f = { source: t, target: e, cleanup: () => {
1886
+ a.destroy();
1887
+ } };
1888
+ k(me, t, f), k(me, e, f), Promise.all(
1889
+ c.map((u) => u.ready || Promise.resolve())
1890
+ ).then(() => {
1891
+ a.start();
1892
+ });
1893
+ }
1894
+ }
1895
+ function as(t) {
1896
+ K(me, t);
1897
+ }
1898
+ const fs = {
1899
+ add: cs,
1900
+ remove: as,
1901
+ registerOptionsGetter: os
1902
+ }, pe = /* @__PURE__ */ new WeakMap();
1903
+ function ls(t, e, n, s, { reducedMotion: i, selectorCondition: r, animation: o }) {
1904
+ const c = o || Y(
1905
+ e,
1906
+ L(n),
1907
+ void 0,
1908
+ i
1909
+ );
1910
+ if (!c)
1911
+ return;
1912
+ const a = () => {
1913
+ r && !e.matches(r) || c.play();
1914
+ }, f = { source: t, target: e, cleanup: () => {
1915
+ c.cancel(), t.removeEventListener("animationend", a);
1916
+ } };
1917
+ k(pe, t, f), k(pe, e, f), t.addEventListener("animationend", a);
1918
+ }
1919
+ function us(t) {
1920
+ K(pe, t);
1921
+ }
1922
+ const ds = {
1923
+ add: ls,
1924
+ remove: us
1925
+ };
1926
+ function hs(t, e, n = !1, s, i, r) {
1927
+ const o = r || Y(
1928
+ t,
1929
+ L(e),
1930
+ void 0,
1931
+ n
1932
+ );
1933
+ if (!o)
1934
+ return null;
1935
+ let c = !0;
1936
+ const a = e.triggerType || "alternate";
1937
+ return (l) => {
1938
+ if (s && !t.matches(s)) return;
1939
+ const f = !i, u = i?.enter?.includes(l.type), d = i?.leave?.includes(l.type);
1940
+ if (u || f) {
1941
+ if (a === "alternate" || a === "state")
1942
+ c ? (c = !1, o.play()) : a === "alternate" ? o.reverse() : a === "state" && (o.playState === "running" ? o.pause() : o.playState !== "finished" && o.play());
1943
+ else {
1944
+ if (o.progress(0), delete t.dataset.interactEnter, o.isCSS) {
1945
+ const g = () => {
1946
+ O.mutate(() => {
1947
+ t.dataset.interactEnter = "done";
1948
+ });
1949
+ };
1950
+ o.onFinish(g), o.onAbort(g);
1951
+ }
1952
+ o.play();
1953
+ }
1954
+ return;
1955
+ }
1956
+ d && (a === "alternate" ? o.reverse() : a === "repeat" ? (o.cancel(), O.mutate(() => {
1957
+ delete t.dataset.interactEnter;
1958
+ })) : a === "state" && o.playState === "running" && o.pause());
1959
+ };
1960
+ }
1961
+ function ms(t, e, {
1962
+ effectId: n,
1963
+ listContainer: s,
1964
+ listItemSelector: i,
1965
+ stateAction: r
1966
+ }, o, c) {
1967
+ const a = !!s, l = r ?? "toggle", f = l === "toggle";
1968
+ return (u) => {
1969
+ if (o && !t.matches(o)) return;
1970
+ const d = a ? t.closest(
1971
+ `${s} > ${i || ""}:has(:scope)`
1972
+ ) : void 0, g = !c, p = c?.enter?.includes(u.type), m = c?.leave?.includes(u.type);
1973
+ g ? e.toggleEffect(n, l, d) : (p && e.toggleEffect(n, f ? "add" : l, d), m && f && e.toggleEffect(n, "remove", d));
1974
+ };
1975
+ }
1976
+ const ge = /* @__PURE__ */ new WeakMap();
1977
+ function Re(t, e) {
1978
+ return (n) => {
1979
+ const s = n;
1980
+ t.contains(s.relatedTarget) || e(s);
1981
+ };
1982
+ }
1983
+ function ps(t) {
1984
+ return (e) => {
1985
+ const n = e;
1986
+ n.pointerType && t(n);
1987
+ };
1988
+ }
1989
+ function gs(t) {
1990
+ return (e) => {
1991
+ const n = e;
1992
+ n.code === "Space" ? (n.preventDefault(), t(n)) : n.code === "Enter" && t(n);
1993
+ };
1994
+ }
1995
+ const vs = {
1996
+ focusin: (t, e) => Re(t, e),
1997
+ focusout: (t, e) => Re(t, e),
1998
+ click: (t, e) => ps(e),
1999
+ keydown: (t, e) => gs(e)
2000
+ };
2001
+ function ys(t, e, n) {
2002
+ const s = vs[t];
2003
+ return s ? s(e, n) : (i) => n(i);
2004
+ }
2005
+ function Es(t) {
2006
+ return typeof t == "object" && !Array.isArray(t) && ("enter" in t || "leave" in t);
2007
+ }
2008
+ function ws(t) {
2009
+ if (typeof t == "string")
2010
+ return { toggle: [t] };
2011
+ if (Array.isArray(t))
2012
+ return { toggle: [...t] };
2013
+ if (Es(t)) {
2014
+ const e = t.enter ? [...t.enter] : [], n = t.leave ? [...t.leave] : [];
2015
+ return { enter: e, leave: n };
2016
+ }
2017
+ return {};
2018
+ }
2019
+ function bs(t) {
2020
+ return !!(t.enter?.length || t.leave?.length);
2021
+ }
2022
+ function Ss(t) {
2023
+ return bs(t) ? { enter: t.enter ?? [], leave: t.leave ?? [] } : void 0;
2024
+ }
2025
+ function Ts(t, e, n, s, {
2026
+ reducedMotion: i,
2027
+ targetController: r,
2028
+ selectorCondition: o,
2029
+ animation: c
2030
+ }) {
2031
+ const a = ws(s.eventConfig), l = n.transition || n.transitionProperties, f = Ss(a);
2032
+ let u, d = !1;
2033
+ if (l ? u = ms(
2034
+ e,
2035
+ r,
2036
+ n,
2037
+ o,
2038
+ f
2039
+ ) : (u = hs(
2040
+ e,
2041
+ n,
2042
+ i,
2043
+ o,
2044
+ f,
2045
+ c
2046
+ ), d = n.triggerType === "once"), !u)
2047
+ return;
2048
+ const g = u, p = new AbortController();
2049
+ function m(y, E, w) {
2050
+ const S = ys(E, t, g);
2051
+ y.addEventListener(E, S, { ...w, signal: p.signal });
2052
+ }
2053
+ const v = { source: t, target: e, cleanup: () => {
2054
+ p.abort();
2055
+ } };
2056
+ if (k(ge, t, v), k(ge, e, v), f) {
2057
+ const y = a.enter, E = a.leave;
2058
+ y.forEach((T) => {
2059
+ T === "focusin" && (t.tabIndex = 0), m(t, T, { passive: !0, once: d });
2060
+ });
2061
+ const w = !n.stateAction || n.stateAction === "toggle";
2062
+ (l ? w : n.triggerType !== "once") && E.forEach((T) => {
2063
+ if (T === "focusout") {
2064
+ m(t, T, { once: d });
2065
+ return;
2066
+ }
2067
+ m(t, T, { passive: !0 });
2068
+ });
2069
+ } else
2070
+ (a.toggle ?? []).forEach((E) => {
2071
+ m(t, E, { once: d, passive: E !== "keydown" });
2072
+ });
2073
+ }
2074
+ function Is(t) {
2075
+ K(ge, t);
2076
+ }
2077
+ const j = {
2078
+ add: Ts,
2079
+ remove: Is
2080
+ }, ve = {
2081
+ click: ["click"],
2082
+ activate: ["click", "keydown"],
2083
+ hover: { enter: ["mouseenter"], leave: ["mouseleave"] },
2084
+ interest: {
2085
+ enter: ["mouseenter", "focusin"],
2086
+ leave: ["mouseleave", "focusout"]
2087
+ }
2088
+ }, Fe = {
2089
+ click: ve.activate,
2090
+ hover: ve.interest
2091
+ };
2092
+ function Z(t) {
2093
+ const e = ve[t];
2094
+ return (n, s, i, r, o) => {
2095
+ const c = o?.allowA11yTriggers && t in Fe ? Fe[t] : e;
2096
+ j.add(n, s, i, { eventConfig: c }, o ?? {});
2097
+ };
2098
+ }
2099
+ const M = {
2100
+ viewEnter: _e,
2101
+ hover: {
2102
+ add: Z("hover"),
2103
+ remove: j.remove
2104
+ },
2105
+ click: {
2106
+ add: Z("click"),
2107
+ remove: j.remove
2108
+ },
2109
+ pageVisible: _e,
2110
+ animationEnd: ds,
2111
+ viewProgress: Vn,
2112
+ pointerMove: fs,
2113
+ activate: {
2114
+ add: Z("activate"),
2115
+ remove: j.remove
2116
+ },
2117
+ interest: {
2118
+ add: Z("interest"),
2119
+ remove: j.remove
2120
+ }
2121
+ };
2122
+ function Os(t) {
2123
+ return t.replace(/\[([-\w]+)]/g, "[]");
2124
+ }
2125
+ class b {
2126
+ static defineInteractElement;
2127
+ dataCache;
2128
+ addedInteractions;
2129
+ mediaQueryListeners;
2130
+ listInteractionsCache;
2131
+ controllers;
2132
+ static forceReducedMotion = !1;
2133
+ static allowA11yTriggers = !0;
2134
+ static instances = [];
2135
+ static controllerCache = /* @__PURE__ */ new Map();
2136
+ static sequenceCache = /* @__PURE__ */ new Map();
2137
+ static elementSequenceMap = /* @__PURE__ */ new WeakMap();
2138
+ constructor() {
2139
+ this.dataCache = { effects: {}, sequences: {}, conditions: {}, interactions: {} }, this.addedInteractions = {}, this.mediaQueryListeners = /* @__PURE__ */ new Map(), this.listInteractionsCache = {}, this.controllers = /* @__PURE__ */ new Set();
2140
+ }
2141
+ init(e, n) {
2142
+ if (typeof window > "u" || !window.customElements)
2143
+ return;
2144
+ const s = n?.useCustomElement ?? !!b.defineInteractElement;
2145
+ this.dataCache = ks(e, s);
2146
+ const i = b.defineInteractElement?.();
2147
+ s && i === !1 ? document.querySelectorAll("interact-element").forEach((r) => {
2148
+ r.connect();
2149
+ }) : b.controllerCache.forEach(
2150
+ (r, o) => r.connect(o)
2151
+ );
2152
+ }
2153
+ destroy() {
2154
+ for (const e of this.controllers)
2155
+ e.disconnect();
2156
+ for (const [, e] of this.mediaQueryListeners.entries())
2157
+ e.mql.removeEventListener("change", e.handler);
2158
+ this.mediaQueryListeners.clear(), this.addedInteractions = {}, this.listInteractionsCache = {}, this.controllers.clear(), this.dataCache = { effects: {}, sequences: {}, conditions: {}, interactions: {} }, b.instances.splice(b.instances.indexOf(this), 1);
2159
+ }
2160
+ setController(e, n) {
2161
+ this.controllers.add(n), b.setController(e, n);
2162
+ }
2163
+ deleteController(e, n = !1) {
2164
+ const s = b.controllerCache.get(e);
2165
+ this.clearInteractionStateForKey(e), this.clearMediaQueryListenersForKey(e), s && n && (this.controllers.delete(s), b.deleteController(e));
2166
+ }
2167
+ has(e) {
2168
+ return !!this.get(e);
2169
+ }
2170
+ get(e) {
2171
+ const n = Os(e);
2172
+ return this.dataCache.interactions[n];
2173
+ }
2174
+ clearMediaQueryListenersForKey(e) {
2175
+ for (const [n, s] of this.mediaQueryListeners.entries())
2176
+ s.key === e && (s.mql.removeEventListener("change", s.handler), this.mediaQueryListeners.delete(n));
2177
+ }
2178
+ clearInteractionStateForKey(e) {
2179
+ (this.get(e)?.interactionIds || []).forEach((i) => {
2180
+ const r = $(i, e);
2181
+ delete this.addedInteractions[r];
2182
+ });
2183
+ const s = `${e}::seq::`;
2184
+ for (const i of b.sequenceCache.keys())
2185
+ i.startsWith(s) && (b.sequenceCache.delete(i), delete this.addedInteractions[i]);
2186
+ }
2187
+ setupMediaQueryListener(e, n, s, i) {
2188
+ this.mediaQueryListeners.has(e) || (n.addEventListener("change", i), this.mediaQueryListeners.set(e, {
2189
+ mql: n,
2190
+ handler: i,
2191
+ key: s
2192
+ }));
2193
+ }
2194
+ static create(e, n) {
2195
+ const s = new b();
2196
+ return b.instances.push(s), s.init(e, n), s;
2197
+ }
2198
+ static destroy() {
2199
+ b.controllerCache.forEach((e) => {
2200
+ e.disconnect();
2201
+ }), b.instances.length = 0, b.controllerCache.clear(), b.sequenceCache.clear(), b.elementSequenceMap = /* @__PURE__ */ new WeakMap();
2202
+ }
2203
+ static setup(e) {
2204
+ e.scrollOptionsGetter && M.viewProgress.registerOptionsGetter?.(
2205
+ e.scrollOptionsGetter
2206
+ ), e.pointerOptionsGetter && M.pointerMove.registerOptionsGetter?.(
2207
+ e.pointerOptionsGetter
2208
+ ), e.viewEnter && M.viewEnter.setOptions(
2209
+ e.viewEnter
2210
+ ), e.allowA11yTriggers !== void 0 && (b.allowA11yTriggers = e.allowA11yTriggers);
2211
+ }
2212
+ static getInstance(e) {
2213
+ const n = b.instances.find((s) => s.has(e));
2214
+ return n || console.warn(`Interact: Instance for key "${e}" not found`), n;
2215
+ }
2216
+ static getController(e) {
2217
+ const n = e ? b.controllerCache.get(e) : void 0;
2218
+ return n || console.warn(`Interact: Controller for key "${e}" not found`), n;
2219
+ }
2220
+ static setController(e, n) {
2221
+ b.controllerCache.set(e, n);
2222
+ }
2223
+ static deleteController(e) {
2224
+ b.controllerCache.delete(e);
2225
+ }
2226
+ static registerEffects = Xt;
2227
+ static getSequence(e, n, s, i) {
2228
+ const r = b.sequenceCache.get(e);
2229
+ if (r) return r;
2230
+ const o = ln(n, s, i);
2231
+ return b.sequenceCache.set(e, o), b._registerSequenceElements(s, o), o;
2232
+ }
2233
+ static addToSequence(e, n, s, i) {
2234
+ const r = b.sequenceCache.get(e);
2235
+ if (!r) return !1;
2236
+ const c = Be(n, i).map((a, l) => ({
2237
+ index: s[l] ?? r.animationGroups.length,
2238
+ group: a
2239
+ }));
2240
+ return r.addGroups(c), b._registerSequenceElements(n, r), !0;
2241
+ }
2242
+ static _registerSequenceElements(e, n) {
2243
+ for (const { target: s } of e) {
2244
+ const i = Array.isArray(s) ? s : s instanceof HTMLElement ? [s] : [];
2245
+ for (const r of i) {
2246
+ let o = b.elementSequenceMap.get(r);
2247
+ o || (o = /* @__PURE__ */ new Set(), b.elementSequenceMap.set(r, o)), o.add(n);
2248
+ }
2249
+ }
2250
+ }
2251
+ static removeFromSequences(e) {
2252
+ for (const n of e) {
2253
+ const s = b.elementSequenceMap.get(n);
2254
+ if (s) {
2255
+ for (const i of s)
2256
+ i.removeGroups(
2257
+ (r) => r.animations.some((o) => o.effect?.target === n)
2258
+ );
2259
+ b.elementSequenceMap.delete(n);
2260
+ }
2261
+ }
2262
+ }
2263
+ }
2264
+ let Cs = 0;
2265
+ function x(t, {
2266
+ asCombinator: e = !1,
2267
+ addItemFilter: n = !1,
2268
+ useFirstChild: s = !1
2269
+ } = {}) {
2270
+ if (t.listContainer) {
2271
+ const i = `${n && t.listItemSelector ? ` > ${t.listItemSelector}` : ""}`;
2272
+ return t.selector ? `${t.listContainer}${i} ${t.selector}` : `${t.listContainer}${i || " > *"}`;
2273
+ } else if (t.selector)
2274
+ return t.selector;
2275
+ return s ? e ? "> :first-child" : ":scope > :first-child" : "";
2276
+ }
2277
+ function Ne(t) {
2278
+ return "sequenceId" in t && !("effects" in t);
2279
+ }
2280
+ function le(t, e) {
2281
+ return t[e] || (t[e] = {
2282
+ triggers: [],
2283
+ effects: {},
2284
+ sequences: {},
2285
+ interactionIds: /* @__PURE__ */ new Set(),
2286
+ selectors: /* @__PURE__ */ new Set()
2287
+ }), t[e];
2288
+ }
2289
+ function ks(t, e = !1) {
2290
+ const { effects: n = {}, sequences: s = {}, conditions: i = {} } = t, r = {};
2291
+ return t.interactions?.forEach((o) => {
2292
+ const c = o.key, a = ++Cs, { effects: l, sequences: f, ...u } = o;
2293
+ if (!c) {
2294
+ console.error(`Interaction ${a} is missing a key for source element.`);
2295
+ return;
2296
+ }
2297
+ le(r, c);
2298
+ const d = l ? Array.from(l) : [];
2299
+ d.reverse();
2300
+ const g = f?.map((h) => {
2301
+ if (Ne(h)) {
2302
+ const y = s[h.sequenceId];
2303
+ return y ? { ...y, ...h } : (console.warn(`Interact: Sequence "${h.sequenceId}" not found in config`), h);
2304
+ }
2305
+ const v = h;
2306
+ return v.sequenceId || (v.sequenceId = A()), v;
2307
+ }), p = {
2308
+ ...u,
2309
+ effects: d.length > 0 ? d : void 0,
2310
+ sequences: g
2311
+ };
2312
+ r[c].triggers.push(p), r[c].selectors.add(
2313
+ x(p, { useFirstChild: e })
2314
+ );
2315
+ const m = p.listContainer;
2316
+ d.forEach((h) => {
2317
+ let v = h.key;
2318
+ if (!v && h.effectId) {
2319
+ const S = n[h.effectId];
2320
+ S && (v = S.key);
2321
+ }
2322
+ h.effectId || (h.effectId = A()), v = v || c, h.key = v;
2323
+ const y = h.effectId;
2324
+ if (m && h.listContainer && (v !== c || h.listContainer !== m))
2325
+ return;
2326
+ const E = `${c}::${v}::${y}::${a}`;
2327
+ if (h.interactionId = E, r[c].interactionIds.add(E), v === c)
2328
+ return;
2329
+ const w = le(r, v);
2330
+ w.effects[E] || (w.effects[E] = [], w.interactionIds.add(E)), w.effects[E].push({ ...u, effect: h }), w.selectors.add(x(h, { useFirstChild: e }));
2331
+ }), g?.forEach((h) => {
2332
+ if (!h || Ne(h)) return;
2333
+ const v = h, y = v.sequenceId || A(), E = v.effects;
2334
+ for (const w of E) {
2335
+ w.effectId || (w.effectId = A());
2336
+ let S = w.key;
2337
+ if (!S && w.effectId) {
2338
+ const I = n[w.effectId];
2339
+ I && (S = I.key);
2340
+ }
2341
+ S = S || c;
2342
+ const T = x(w, { useFirstChild: e });
2343
+ if (T && r[c].selectors.add(T), S !== c) {
2344
+ const I = le(r, S), C = `${S}::seq::${y}::${a}`;
2345
+ I.sequences[C] || (I.sequences[C] = [], I.interactionIds.add(C)), I.sequences[C].push({
2346
+ ...u,
2347
+ sequence: v
2348
+ }), I.selectors.add(T);
2349
+ }
2350
+ }
2351
+ });
2352
+ }), {
2353
+ effects: n,
2354
+ sequences: s,
2355
+ conditions: i,
2356
+ interactions: r
2357
+ };
2358
+ }
2359
+ function ye(t, e, n) {
2360
+ if (t.listContainer) {
2361
+ const s = e.querySelector(t.listContainer);
2362
+ return s ? t.selector ? Array.from(s.querySelectorAll(t.selector)) : Array.from(s.children) : (console.warn(`Interact: No container found for list container "${t.listContainer}"`), []);
2363
+ }
2364
+ if (t.selector) {
2365
+ const s = e.querySelectorAll(t.selector);
2366
+ if (s.length > 0)
2367
+ return Array.from(s);
2368
+ console.warn(`Interact: No elements found for selector "${t.selector}"`);
2369
+ }
2370
+ return n ? e.firstElementChild : e;
2371
+ }
2372
+ function Ee(t, e) {
2373
+ return e.map((n) => t.selector ? n.querySelector(t.selector) : n).filter(Boolean);
2374
+ }
2375
+ function nt(t, e, n, s, i, r, o, c) {
2376
+ return [
2377
+ o ? Ee(t, o) : ye(t, n, s),
2378
+ c ? Ee(e, c) : ye(e, i, r)
2379
+ ];
2380
+ }
2381
+ function st(t, e, n, s, i, r, o) {
2382
+ const c = Array.isArray(s), a = Array.isArray(i);
2383
+ c ? s.forEach((l, f) => {
2384
+ const u = a ? i[f] : i;
2385
+ u && ze(
2386
+ t,
2387
+ l,
2388
+ e.trigger,
2389
+ u,
2390
+ n,
2391
+ e.params,
2392
+ r,
2393
+ o
2394
+ );
2395
+ }) : (a ? i : [i]).forEach((f) => {
2396
+ ze(
2397
+ t,
2398
+ s,
2399
+ e.trigger,
2400
+ f,
2401
+ n,
2402
+ e.params,
2403
+ r,
2404
+ o
2405
+ );
2406
+ });
2407
+ }
2408
+ function it(t, e, n, s, i) {
2409
+ const r = {}, o = [];
2410
+ (s.effects || []).forEach((c) => {
2411
+ const a = c.effectId, l = {
2412
+ ...n.dataCache.effects[a] || {},
2413
+ ...c,
2414
+ effectId: a
2415
+ }, f = l.key, u = $(c.interactionId, t);
2416
+ if (r[u] || n.addedInteractions[u] && !i)
2417
+ return;
2418
+ const d = _(l.conditions || [], n.dataCache.conditions);
2419
+ if (d && n.setupMediaQueryListener(u, d, t, () => {
2420
+ e.update();
2421
+ }), !d || d.matches) {
2422
+ r[u] = !0;
2423
+ const g = f && $(f, t);
2424
+ let p;
2425
+ if (g) {
2426
+ if (p = b.getController(g), !p)
2427
+ return;
2428
+ l.listContainer && p.watchChildList(l.listContainer);
2429
+ } else
2430
+ p = e;
2431
+ const [m, h] = nt(
2432
+ s,
2433
+ l,
2434
+ e.element,
2435
+ e.useFirstChild,
2436
+ p.element,
2437
+ p.useFirstChild,
2438
+ i
2439
+ );
2440
+ if (!m || !h)
2441
+ return;
2442
+ n.addedInteractions[u] = !0;
2443
+ const v = g || s.key, y = P(
2444
+ l.conditions || [],
2445
+ n.dataCache.conditions
2446
+ );
2447
+ o.push([
2448
+ v,
2449
+ s,
2450
+ l,
2451
+ m,
2452
+ h,
2453
+ y,
2454
+ p.useFirstChild
2455
+ ]);
2456
+ }
2457
+ }), o.reverse().forEach((c) => {
2458
+ st(...c);
2459
+ }), $s(t, e, n, s, i);
2460
+ }
2461
+ function As(t) {
2462
+ return "sequenceId" in t && !("effects" in t);
2463
+ }
2464
+ function rt(t, e, n, s, i, r, o) {
2465
+ const c = _(t.conditions || [], i.dataCache.conditions);
2466
+ if (c && i.setupMediaQueryListener(e, c, r.updateKey, r.onUpdate), c && !c.matches) return null;
2467
+ const a = t.effects || [], l = [];
2468
+ let f = !1;
2469
+ for (const u of a) {
2470
+ const d = u.effectId, p = {
2471
+ ...d ? i.dataCache.effects[d] || {} : {},
2472
+ ...u
2473
+ }, m = _(p.conditions || [], i.dataCache.conditions);
2474
+ if (m) {
2475
+ const T = `${e}::${d || "eff"}`;
2476
+ i.setupMediaQueryListener(
2477
+ T,
2478
+ m,
2479
+ r.updateKey,
2480
+ r.onUpdate
2481
+ );
2482
+ }
2483
+ if (m && !m.matches) continue;
2484
+ const h = p.key, v = h && $(h, n);
2485
+ let y;
2486
+ if (v) {
2487
+ if (y = b.getController(v), !y) return null;
2488
+ } else
2489
+ y = s;
2490
+ const E = v || n;
2491
+ let w;
2492
+ if (o && E === o.controllerKey && p.listContainer === o.listContainer ? (w = Ee(p, o.elements), w.length > 0 && (f = !0)) : w = ye(
2493
+ p,
2494
+ y.element,
2495
+ y.useFirstChild
2496
+ ), !w || Array.isArray(w) && w.length === 0) return null;
2497
+ const S = L(p);
2498
+ l.push({ target: w, options: S });
2499
+ }
2500
+ return o && !f ? null : l.length > 0 ? l : null;
2501
+ }
2502
+ function ot(t, e, n) {
2503
+ const r = (t.useFirstChild ? t.element.firstElementChild : t.element)?.querySelector(e);
2504
+ if (!r) return n.map((c, a) => a);
2505
+ const o = Array.from(r.children);
2506
+ return n.map((c) => {
2507
+ const a = o.indexOf(c);
2508
+ return a >= 0 ? a : o.length;
2509
+ });
2510
+ }
2511
+ function $s(t, e, n, s, i) {
2512
+ s.sequences?.forEach((r) => {
2513
+ let o;
2514
+ if (As(r)) {
2515
+ const g = n.dataCache.sequences[r.sequenceId];
2516
+ if (!g) {
2517
+ console.warn(`Interact: Sequence "${r.sequenceId}" not found in cache`);
2518
+ return;
2519
+ }
2520
+ o = { ...g, ...r };
2521
+ } else
2522
+ o = r;
2523
+ const c = o.sequenceId || A(), a = $(`${t}::seq::${c}`, t);
2524
+ if (n.addedInteractions[a] && !i) return;
2525
+ const l = i && s.listContainer ? { controllerKey: t, listContainer: s.listContainer, elements: i } : void 0, f = rt(
2526
+ o,
2527
+ a,
2528
+ t,
2529
+ e,
2530
+ n,
2531
+ { updateKey: t, onUpdate: () => e.update() },
2532
+ l
2533
+ );
2534
+ if (!f) return;
2535
+ if (i && n.addedInteractions[a]) {
2536
+ const g = ot(
2537
+ e,
2538
+ s.listContainer,
2539
+ i
2540
+ );
2541
+ b.addToSequence(a, f, g, {
2542
+ reducedMotion: b.forceReducedMotion
2543
+ });
2544
+ return;
2545
+ }
2546
+ const u = b.getSequence(a, o, f, {
2547
+ reducedMotion: b.forceReducedMotion
2548
+ });
2549
+ n.addedInteractions[a] = !0;
2550
+ const d = P(
2551
+ s.conditions || [],
2552
+ n.dataCache.conditions
2553
+ );
2554
+ M[s.trigger]?.add(
2555
+ e.element,
2556
+ e.element,
2557
+ { triggerType: o.triggerType },
2558
+ s.params || {},
2559
+ {
2560
+ reducedMotion: b.forceReducedMotion,
2561
+ selectorCondition: d,
2562
+ animation: u,
2563
+ allowA11yTriggers: b.allowA11yTriggers
2564
+ }
2565
+ );
2566
+ });
2567
+ }
2568
+ function _s(t, e, n, s, i) {
2569
+ const r = n.get(t)?.sequences || {};
2570
+ Object.keys(r).forEach((c) => {
2571
+ r[c].some(({ sequence: l, ...f }) => {
2572
+ const u = _(
2573
+ f.conditions || [],
2574
+ n.dataCache.conditions
2575
+ );
2576
+ if (u && !u.matches)
2577
+ return !1;
2578
+ const d = f.key && $(f.key, t), g = b.getController(d);
2579
+ if (!g)
2580
+ return !0;
2581
+ const p = l.sequenceId || A(), m = $(`${d}::seq::${p}`, d);
2582
+ if (n.addedInteractions[m] && !i)
2583
+ return !0;
2584
+ const v = rt(
2585
+ l,
2586
+ m,
2587
+ d,
2588
+ g,
2589
+ n,
2590
+ { updateKey: t, onUpdate: () => e.update() },
2591
+ i && s ? { controllerKey: t, listContainer: s, elements: i } : void 0
2592
+ );
2593
+ if (!v) return !0;
2594
+ if (i && n.addedInteractions[m]) {
2595
+ const w = ot(e, s, i);
2596
+ return b.addToSequence(m, v, w, {
2597
+ reducedMotion: b.forceReducedMotion
2598
+ }), !0;
2599
+ }
2600
+ const y = b.getSequence(m, l, v, {
2601
+ reducedMotion: b.forceReducedMotion
2602
+ });
2603
+ n.addedInteractions[m] = !0;
2604
+ const E = P(
2605
+ f.conditions || [],
2606
+ n.dataCache.conditions
2607
+ );
2608
+ return M[f.trigger]?.add(
2609
+ g.element,
2610
+ g.element,
2611
+ { triggerType: l.triggerType },
2612
+ f.params || {},
2613
+ {
2614
+ reducedMotion: b.forceReducedMotion,
2615
+ selectorCondition: E,
2616
+ animation: y,
2617
+ allowA11yTriggers: b.allowA11yTriggers
2618
+ }
2619
+ ), !0;
2620
+ });
2621
+ });
2622
+ }
2623
+ function ct(t, e, n, s, i) {
2624
+ const r = n.get(t), o = r?.effects || {}, c = Object.keys(o), a = [];
2625
+ c.forEach((f) => {
2626
+ const u = $(f, t);
2627
+ if (n.addedInteractions[u] && !i)
2628
+ return;
2629
+ o[f].some(({ effect: g, ...p }) => {
2630
+ const m = _(
2631
+ p.conditions || [],
2632
+ n.dataCache.conditions
2633
+ );
2634
+ if (m && !m.matches)
2635
+ return !1;
2636
+ const h = g.effectId, v = {
2637
+ ...n.dataCache.effects[h] || {},
2638
+ ...g,
2639
+ effectId: h
2640
+ };
2641
+ if (s && v.listContainer !== s)
2642
+ return !1;
2643
+ const y = _(v.conditions || [], n.dataCache.conditions);
2644
+ if (y && n.setupMediaQueryListener(u, y, t, () => {
2645
+ e.update();
2646
+ }), !y || y.matches) {
2647
+ const E = p.key && $(p.key, t), w = b.getController(E);
2648
+ if (!w)
2649
+ return !0;
2650
+ v.listContainer && e.watchChildList(v.listContainer);
2651
+ const [S, T] = nt(
2652
+ p,
2653
+ v,
2654
+ w.element,
2655
+ w.useFirstChild,
2656
+ e.element,
2657
+ e.useFirstChild,
2658
+ void 0,
2659
+ i
2660
+ );
2661
+ if (!S || !T)
2662
+ return !0;
2663
+ n.addedInteractions[u] = !0;
2664
+ const I = P(
2665
+ v.conditions || [],
2666
+ n.dataCache.conditions
2667
+ );
2668
+ return a.push([
2669
+ t,
2670
+ p,
2671
+ v,
2672
+ S,
2673
+ T,
2674
+ I,
2675
+ e.useFirstChild
2676
+ ]), !0;
2677
+ }
2678
+ return !1;
2679
+ });
2680
+ }), a.reverse().forEach((f) => {
2681
+ st(...f);
2682
+ }), _s(t, e, n, s, i);
2683
+ const l = Object.keys(r?.sequences || {}).length > 0;
2684
+ return c.length > 0 || l;
2685
+ }
2686
+ function ze(t, e, n, s, i, r, o, c) {
2687
+ let a;
2688
+ if (i.transition || i.transitionProperties) {
2689
+ const l = {
2690
+ key: t,
2691
+ effectId: i.effectId,
2692
+ transition: i.transition,
2693
+ transitionProperties: i.transitionProperties,
2694
+ childSelector: x(i, {
2695
+ asCombinator: !0,
2696
+ addItemFilter: !0,
2697
+ useFirstChild: c
2698
+ }),
2699
+ selectorCondition: o
2700
+ };
2701
+ if (a = b.getController(t), !a)
2702
+ return;
2703
+ a.renderStyle(gn(l));
2704
+ }
2705
+ M[n]?.add(e, s, i, r, {
2706
+ reducedMotion: b.forceReducedMotion,
2707
+ targetController: a,
2708
+ selectorCondition: o,
2709
+ allowA11yTriggers: b.allowA11yTriggers
2710
+ });
2711
+ }
2712
+ function qs(t) {
2713
+ const e = t.key, n = b.getInstance(e);
2714
+ if (!n)
2715
+ return console.warn(`No instance found for key: ${e}`), b.setController(e, t), !1;
2716
+ const { triggers: s = [] } = n?.get(e) || {}, i = s.length > 0;
2717
+ n.setController(e, t), s.forEach((o, c) => {
2718
+ const a = _(o.conditions, n.dataCache.conditions);
2719
+ if (a) {
2720
+ const l = `${e}::trigger::${c}`;
2721
+ n.setupMediaQueryListener(l, a, e, () => {
2722
+ t.update();
2723
+ });
2724
+ }
2725
+ (!a || a.matches) && (o.listContainer && t.watchChildList(o.listContainer), it(e, t, n, o));
2726
+ });
2727
+ let r = !1;
2728
+ return n && (r = ct(e, t, n)), i || r;
2729
+ }
2730
+ function Ms(t, e, n) {
2731
+ const s = t.key, i = b.getInstance(s);
2732
+ if (i) {
2733
+ const { triggers: r = [] } = i?.get(s) || {};
2734
+ r.forEach((o, c) => {
2735
+ if (o.listContainer !== e)
2736
+ return;
2737
+ const a = _(o.conditions, i.dataCache.conditions);
2738
+ if (a) {
2739
+ const l = `${s}::listTrigger::${e}::${c}`;
2740
+ i.setupMediaQueryListener(l, a, s, () => {
2741
+ t.update();
2742
+ });
2743
+ }
2744
+ (!a || a.matches) && it(s, t, i, o, n);
2745
+ }), ct(s, t, i, e, n);
2746
+ }
2747
+ }
2748
+ function xs(t, e = !1) {
2749
+ const n = t.key, s = b.getInstance(n);
2750
+ if (!s)
2751
+ return;
2752
+ const i = [...s.get(n)?.selectors.values() || []].filter(Boolean).join(",");
2753
+ let r;
2754
+ i ? (r = [...t.element.querySelectorAll(i)], t.useFirstChild || r.push(t.element)) : r = [t.element], at(r), s.deleteController(n, e);
2755
+ }
2756
+ function at(t) {
2757
+ const e = Object.values(M);
2758
+ for (const n of t)
2759
+ for (const s of e)
2760
+ s.remove(n);
2761
+ b.removeFromSequences(t);
2762
+ }
2763
+ const ue = "interactEffect";
2764
+ class Ps {
2765
+ element;
2766
+ key;
2767
+ connected;
2768
+ sheet;
2769
+ useFirstChild;
2770
+ _observers;
2771
+ constructor(e, n, s) {
2772
+ this.element = e, this.key = n, this.connected = !1, this.sheet = null, this._observers = /* @__PURE__ */ new WeakMap(), this.useFirstChild = s?.useFirstChild ?? !1;
2773
+ }
2774
+ connect(e) {
2775
+ if (this.connected)
2776
+ return;
2777
+ const n = this.element.dataset.interactKey;
2778
+ if (e = e || this.key || n, !e) {
2779
+ console.warn("Interact: No key provided");
2780
+ return;
2781
+ }
2782
+ n !== e && (n && console.warn(
2783
+ `Interact: Key mismatch between element ${n} and parameter ${e}, updating element key`
2784
+ ), this.element.dataset.interactKey = e), this.key = e, this.connected = qs(this);
2785
+ }
2786
+ disconnect({ removeFromCache: e = !1 } = {}) {
2787
+ if ((this.key || this.element.dataset.interactKey) && xs(this, e), this.sheet) {
2788
+ const s = this.element?.getRootNode(), i = s.host ? s : document;
2789
+ i.adoptedStyleSheets.indexOf(this.sheet) !== -1 && (i.adoptedStyleSheets = i.adoptedStyleSheets.filter(
2790
+ (o) => o !== this.sheet
2791
+ ));
2792
+ }
2793
+ this._observers = /* @__PURE__ */ new WeakMap(), this.sheet = null, this.connected = !1;
2794
+ }
2795
+ update() {
2796
+ this.disconnect(), this.connect();
2797
+ }
2798
+ renderStyle(e) {
2799
+ const n = this.element?.getRootNode(), s = n.host ? n : document;
2800
+ if (!this.sheet)
2801
+ this.sheet = new CSSStyleSheet(), this.sheet.replaceSync(e.join(`
2802
+ `)), s.adoptedStyleSheets = [...s.adoptedStyleSheets || [], this.sheet];
2803
+ else {
2804
+ let i = this.sheet.cssRules.length;
2805
+ for (const r of e)
2806
+ try {
2807
+ this.sheet.insertRule(r, i), i++;
2808
+ } catch (o) {
2809
+ console.error(o);
2810
+ }
2811
+ }
2812
+ }
2813
+ toggleEffect(e, n, s, i) {
2814
+ if (s === null)
2815
+ return;
2816
+ if (!i && this.element.toggleEffect) {
2817
+ this.element.toggleEffect(e, n, s);
2818
+ return;
2819
+ }
2820
+ const r = new Set(
2821
+ this.element.dataset[ue]?.split(" ") || []
2822
+ );
2823
+ n === "toggle" ? r.has(e) ? r.delete(e) : r.add(e) : n === "add" ? r.add(e) : n === "remove" ? r.delete(e) : n === "clear" && r.clear(), (s || this.element).dataset[ue] = Array.from(r).join(" ");
2824
+ }
2825
+ getActiveEffects() {
2826
+ const n = (this.element.dataset[ue] || "").trim();
2827
+ return n ? n.split(/\s+/) : [];
2828
+ }
2829
+ watchChildList(e) {
2830
+ const n = this.element.querySelector(e);
2831
+ if (n) {
2832
+ let s = this._observers.get(n);
2833
+ s || (s = new MutationObserver(this._childListChangeHandler.bind(this, e)), this._observers.set(n, s), s.observe(n, { childList: !0 }));
2834
+ }
2835
+ }
2836
+ _childListChangeHandler(e, n) {
2837
+ const s = this.key || this.element.dataset.interactKey, i = [], r = [];
2838
+ n.forEach((o) => {
2839
+ o.removedNodes.forEach((c) => {
2840
+ c instanceof HTMLElement && i.push(c);
2841
+ }), o.addedNodes.forEach((c) => {
2842
+ c instanceof HTMLElement && r.push(c);
2843
+ });
2844
+ }), at(i), s && Ms(this, e, r);
2845
+ }
2846
+ }
2847
+ function Us(t, e) {
2848
+ new Ps(t, e).connect();
2849
+ }
2850
+ function Xs(t) {
2851
+ const e = b.getController(t);
2852
+ e && e.disconnect({ removeFromCache: !0 });
2853
+ }
2854
+ const ft = /* @__PURE__ */ new Map([
2855
+ ["viewEnter", "once"],
2856
+ ["pageVisible", "once"],
2857
+ ["animationEnd", "once"],
2858
+ ["hover", "alternate"],
2859
+ ["click", "alternate"],
2860
+ ["activate", "alternate"],
2861
+ ["interest", "alternate"]
2862
+ ]);
2863
+ function lt(t, e, n) {
2864
+ const { effects: s = {}, conditions: i = {} } = n, { key: r, trigger: o } = e, c = o === "pointerMove";
2865
+ t.effectId || (t.effectId = A());
2866
+ const { effectId: a } = t, l = { ...s[a] || {}, ...t };
2867
+ let { key: f, conditions: u, triggerType: d } = l;
2868
+ if (!f) {
2869
+ if (!r)
2870
+ return null;
2871
+ f = r;
2872
+ }
2873
+ if (dn(f))
2874
+ return null;
2875
+ u = [
2876
+ ...new Set((u || []).filter((w) => i[w]))
2877
+ ], d || (d = ft.get(o));
2878
+ const { namedEffect: g, customEffect: p, keyframeEffect: m, transition: h, transitionProperties: v, ...y } = {
2879
+ ...l,
2880
+ key: f,
2881
+ conditions: u,
2882
+ effectId: a,
2883
+ triggerType: d
2884
+ }, E = vt(e, y);
2885
+ if (g)
2886
+ return c || !g.type ? null : { namedEffect: g, initial: E, ...y };
2887
+ if (m) {
2888
+ if (!m.name) {
2889
+ const w = a && !(s[a] && "keyframeEffect" in t);
2890
+ m.name = w ? a : A();
2891
+ }
2892
+ return { keyframeEffect: m, initial: E, ...y };
2893
+ } else return p ? c ? null : { initial: E, ...y } : h ? { transition: h, initial: E, ...y } : v ? { transitionProperties: v, initial: E, ...y } : { initial: E, ...y };
2894
+ }
2895
+ function Ls(t, e, n) {
2896
+ const { sequences: s = {}, conditions: i = {} } = n;
2897
+ t.sequenceId || (t.sequenceId = A());
2898
+ const { sequenceId: r } = t, o = { ...s[r] || {}, ...t };
2899
+ let {
2900
+ effects: c,
2901
+ conditions: a,
2902
+ triggerType: l,
2903
+ delay: f = 0,
2904
+ offset: u = 0,
2905
+ offsetEasing: d = "linear"
2906
+ } = o;
2907
+ l || (l = ft.get(e.trigger)), a = [
2908
+ ...new Set((a || []).filter((m) => i[m]))
2909
+ ];
2910
+ const g = c.map((m) => (m.conditions ? m.conditions.push(...a) : m.conditions = [...a], lt({ ...m, triggerType: l }, e, n)));
2911
+ typeof d != "function" && (d = be(d) || ((m) => m)), pn(g, f, u, d);
2912
+ const p = g.filter((m) => m !== null);
2913
+ return p.length ? {
2914
+ sequenceId: r,
2915
+ triggerType: l,
2916
+ conditions: a,
2917
+ delay: f,
2918
+ offset: u,
2919
+ offsetEasing: d,
2920
+ effects: p
2921
+ } : null;
2922
+ }
2923
+ function Rs(t) {
2924
+ return t === "cssFloat" ? "float" : t === "easing" ? "animation-timing-function" : t === "cssOffset" ? "offset" : t === "composite" ? "animation-composition" : t.replace(/([A-Z])/g, "-$1").toLowerCase();
2925
+ }
2926
+ function Fs(t) {
2927
+ if (!t.length)
2928
+ return [];
2929
+ const e = t.map((i) => ({ ...i }));
2930
+ e[0].offset === void 0 && (e[0].offset = 0), (e[e.length - 1].offset === void 0 || e.length === 1) && (e[e.length - 1].offset = 1);
2931
+ let n = 0, s = e[0].offset;
2932
+ for (let i = 1; i < e.length; i++)
2933
+ if (e[i].offset !== void 0) {
2934
+ const r = e[i].offset;
2935
+ if (r < s)
2936
+ return console.error("Offsets must be monotonically non-decreasing"), [];
2937
+ if (r > 1)
2938
+ return console.error("Offsets must be in the range [0,1]"), [];
2939
+ const o = i - n;
2940
+ for (let c = n + 1; c < i; c++) {
2941
+ const a = (c - n) / o;
2942
+ e[c].offset = s + (r - s) * a;
2943
+ }
2944
+ n = i, s = r;
2945
+ }
2946
+ return e;
2947
+ }
2948
+ function Ns(t, e) {
2949
+ const n = Object.entries(t).filter(([s, i]) => s !== "offset" && i !== void 0 && i !== null).map(([s, i]) => `${Rs(s)}: ${i};`).join(`
2950
+ `);
2951
+ return `${e}% {
2952
+ ${n}
2953
+ }`;
2954
+ }
2955
+ function zs(t, e) {
2956
+ const n = Fs(e);
2957
+ if (!n.length)
2958
+ return "";
2959
+ let s = n.map((i) => {
2960
+ const r = i.offset, o = un(r * 100);
2961
+ return Ns(i, o);
2962
+ }).join(`
2963
+ `);
2964
+ return `@keyframes ${t} {
2965
+ ${s}
2966
+ }`;
2967
+ }
2968
+ function Hs(t) {
2969
+ const { key: e, childSelector: n, declarations: s, media: i, states: r, selectorCondition: o, addInitialSelector: c } = t;
2970
+ if (!s.length)
2971
+ return "";
2972
+ let a = `[data-interact-key="${e}"]${c ? ":is(:not([data-interact-enter]))" : ""}`;
2973
+ if (r && r.length) {
2974
+ const u = r.map((d) => `:state(${d}), :--${d}, [data-interact-effect~="${d}"]`).join(", ");
2975
+ a = `${a}:is(${u})`;
2976
+ }
2977
+ n && (a = `${a} ${n}`), o && (a = te(a, o));
2978
+ const l = s.map(({ name: u, value: d }) => `${u}: ${d};`).join(`
2979
+ `), f = `${a} {
2980
+ ${l}
2981
+ }`;
2982
+ return i ? `@media ${i} {
2983
+ ${f}
2984
+ }` : f;
2985
+ }
2986
+ function ut(t, e, n, s) {
2987
+ const { key: i, childSelector: r, properties: o } = t, c = Object.entries(o).filter(
2988
+ (l) => l[1] && l[1].varNames.length
2989
+ ).map(([l, { fallback: f, varNames: u }]) => ({
2990
+ name: l,
2991
+ value: u.map((d) => `var(${d}, ${f})`).join(", ")
2992
+ })), a = { key: i, childSelector: r, declarations: c };
2993
+ return e && a.declarations.forEach((l) => {
2994
+ l.name = e[l.name];
2995
+ }), n && (a.media = ce(n, s || {}, "media"), a.selectorCondition = P(n, s || {})), a;
2996
+ }
2997
+ const js = [
2998
+ { name: "visibility", value: "hidden" },
2999
+ { name: "transform", value: "none" },
3000
+ { name: "translate", value: "none" },
3001
+ { name: "scale", value: "none" },
3002
+ { name: "rotate", value: "none" }
3003
+ ], se = [
3004
+ "animation",
3005
+ "animation-composition",
3006
+ "animation-timeline",
3007
+ "animation-range"
3008
+ ], we = ["transition", ...se], Ds = {
3009
+ animation: "animation",
3010
+ "animation-composition": "composition",
3011
+ "animation-timeline": "animationTimeline",
3012
+ "animation-range": "animationRange"
3013
+ }, ie = {
3014
+ animation: "none",
3015
+ "animation-composition": "replace",
3016
+ transition: "_",
3017
+ "animation-timeline": "auto",
3018
+ "animation-range": "normal"
3019
+ };
3020
+ function dt(t, e, n) {
3021
+ const s = t.get(e);
3022
+ s ? n.forEach((i) => s.add(i)) : t.set(e, new Set(n));
3023
+ }
3024
+ function ht(t, e, n, s) {
3025
+ const { key: i, childSelector: r } = n, o = s ? we.filter((a) => s.has(a)) : we;
3026
+ t.has(e) || t.set(e, { key: i, childSelector: r, properties: {} });
3027
+ const { properties: c } = t.get(e);
3028
+ for (const a of o)
3029
+ c[a] || (c[a] = { fallback: ie[a], varNames: [] }), c[a].varNames.push(n[a]);
3030
+ }
3031
+ function mt(t, e) {
3032
+ return we.reduce(
3033
+ (n, s) => (n[s] = hn([s, ...t, e]), n),
3034
+ {}
3035
+ );
3036
+ }
3037
+ function Gs(t, e, n, s, i) {
3038
+ return s.has(t) || s.set(t, {
3039
+ key: e,
3040
+ childSelector: i,
3041
+ ...mt([n], He(t))
3042
+ }), s.get(t);
3043
+ }
3044
+ function Ws(t, e, n) {
3045
+ return mt([e, n], He(t));
3046
+ }
3047
+ function Vs(t, e, n, s = !0) {
3048
+ const { key: i, conditions: r } = t, o = ce(r, e, "media"), c = P(r, e), a = x(t, {
3049
+ asCombinator: !0,
3050
+ useFirstChild: s,
3051
+ addItemFilter: !0
3052
+ });
3053
+ return {
3054
+ key: i,
3055
+ media: o,
3056
+ selectorCondition: c,
3057
+ childSelector: a,
3058
+ // invalidating earlier cascaded custom properties affected from earlier transitionEffects
3059
+ // to implement same-interaction-cascade
3060
+ declarations: [
3061
+ {
3062
+ name: "view-timeline",
3063
+ value: `--${n}`
3064
+ }
3065
+ ]
3066
+ };
3067
+ }
3068
+ function Ys(t, e, n, s, i) {
3069
+ const {
3070
+ key: r,
3071
+ effectId: o,
3072
+ conditions: c,
3073
+ namedEffect: a,
3074
+ keyframeEffect: l,
3075
+ transition: f,
3076
+ transitionProperties: u,
3077
+ initial: d
3078
+ } = t, g = ce(c, e, "media"), p = P(c, e), m = [
3079
+ {
3080
+ key: r,
3081
+ media: g,
3082
+ selectorCondition: p,
3083
+ childSelector: i,
3084
+ declarations: []
3085
+ }
3086
+ ];
3087
+ let h = [];
3088
+ const { declarations: v } = m[0];
3089
+ let y = [];
3090
+ if (a || l) {
3091
+ y = [...se];
3092
+ const E = L(t), w = rn(null, E, s).filter(
3093
+ (T) => T.name
3094
+ );
3095
+ h = w.map((T) => ({
3096
+ name: T.name,
3097
+ keyframes: T.keyframes
3098
+ })), v.push(
3099
+ ...w.flatMap(
3100
+ ({ custom: T }) => Object.entries(T || {}).filter(([I, C]) => C !== void 0).map(([I, C]) => ({ name: I, value: C }))
3101
+ )
3102
+ );
3103
+ const S = se.map((T) => ({
3104
+ name: n[T],
3105
+ value: w.map((I) => {
3106
+ const C = Ds[T];
3107
+ return I[C];
3108
+ }).join(", ") || ie[T]
3109
+ }));
3110
+ d ? m.push({
3111
+ key: r,
3112
+ media: g,
3113
+ selectorCondition: p,
3114
+ childSelector: i,
3115
+ declarations: S.concat(js),
3116
+ addInitialSelector: !0
3117
+ }) : v.push(...S);
3118
+ } else if (f || u) {
3119
+ y = ["transition"];
3120
+ const E = f?.styleProperties || u || [], w = Qe(t);
3121
+ v.push({
3122
+ name: n.transition,
3123
+ value: w.join(", ") || ie.transition
3124
+ }), m.push({
3125
+ key: r,
3126
+ media: g,
3127
+ selectorCondition: p,
3128
+ childSelector: i,
3129
+ states: [o],
3130
+ declarations: E
3131
+ });
3132
+ } else
3133
+ v.push(
3134
+ ...se.map((E) => ({
3135
+ name: n[E],
3136
+ value: ie[E]
3137
+ }))
3138
+ );
3139
+ return { rules: m.filter((E) => E.declarations.length), keyframes: h, usedProperties: y };
3140
+ }
3141
+ function pt(t, e, n, s, i, r, o = !0, c, a) {
3142
+ const { key: l } = n, f = a ?? G(n), u = x(n, {
3143
+ asCombinator: !0,
3144
+ useFirstChild: o,
3145
+ addItemFilter: !0
3146
+ }), g = { ...Gs(
3147
+ f,
3148
+ l,
3149
+ e,
3150
+ s,
3151
+ u
3152
+ ) };
3153
+ c && Object.assign(g, c);
3154
+ const { rules: p, keyframes: m, usedProperties: h } = Ys(
3155
+ n,
3156
+ t,
3157
+ g,
3158
+ r,
3159
+ u
3160
+ );
3161
+ return m.forEach(({ name: v, keyframes: y }) => i.set(v, y)), { rules: p, usedProperties: h };
3162
+ }
3163
+ function Ks(t, e, n, s, i, r, o = !0, c) {
3164
+ const a = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), f = [];
3165
+ for (const d of n.effects) {
3166
+ const g = G(d), { key: p } = d, m = x(d, {
3167
+ asCombinator: !0,
3168
+ useFirstChild: o,
3169
+ addItemFilter: !0
3170
+ }), h = l.get(g) || 0;
3171
+ l.set(g, h + 1);
3172
+ const v = Ws(g, e, h), { rules: y, usedProperties: E } = pt(
3173
+ t,
3174
+ e,
3175
+ d,
3176
+ s,
3177
+ i,
3178
+ r,
3179
+ o,
3180
+ v,
3181
+ g
3182
+ );
3183
+ f.push(...y);
3184
+ const w = new Set(E);
3185
+ ht(
3186
+ a,
3187
+ g,
3188
+ { key: p, childSelector: m, ...v },
3189
+ w
3190
+ ), c && dt(c, g, E);
3191
+ }
3192
+ const { conditions: u } = n;
3193
+ return a.forEach((d, g) => {
3194
+ const p = s.get(g);
3195
+ f.push(ut(d, p, u, t));
3196
+ }), f;
3197
+ }
3198
+ function Bs(t, e, n, s, i, r = !0) {
3199
+ const { effects: o = [], sequences: c = [] } = e, a = t.conditions || {}, l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), u = o.map((h) => lt(h, e, t)).filter((h) => h !== null), d = [], { trigger: g } = e, p = {
3200
+ trigger: mn(g),
3201
+ id: ["trigger", n].join("-")
3202
+ };
3203
+ g === "viewProgress" && d.push(Vs(e, a, p.id, r));
3204
+ for (const h of u) {
3205
+ const v = G(h), { rules: y, usedProperties: E } = pt(
3206
+ a,
3207
+ n,
3208
+ h,
3209
+ l,
3210
+ i,
3211
+ p,
3212
+ r
3213
+ );
3214
+ d.push(...y), dt(f, v, E);
3215
+ }
3216
+ const m = c.map((h) => Ls(h, e, t)).filter((h) => h !== null);
3217
+ return d.push(
3218
+ ...m.flatMap(
3219
+ (h) => Ks(
3220
+ a,
3221
+ n,
3222
+ h,
3223
+ l,
3224
+ i,
3225
+ p,
3226
+ r,
3227
+ f
3228
+ )
3229
+ )
3230
+ ), l.forEach((h, v) => {
3231
+ ht(
3232
+ s,
3233
+ v,
3234
+ h,
3235
+ f.get(v)
3236
+ );
3237
+ }), d;
3238
+ }
3239
+ function Qs(t, e = !0) {
3240
+ const n = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), i = t.interactions.flatMap(
3241
+ (r, o) => Bs(t, r, o, n, s, e)
3242
+ );
3243
+ return n.forEach((r) => {
3244
+ i.push(ut(r));
3245
+ }), { keyframes: s, cssRules: i };
3246
+ }
3247
+ function Zs(t, e = !0) {
3248
+ const { cssRules: n, keyframes: s } = Qs(t, e);
3249
+ return [
3250
+ ...[...s.entries()].map(([r, o]) => zs(r, o)),
3251
+ ...n.map(Hs)
3252
+ ].join(`
3253
+ `);
3254
+ }
3255
+ export {
3256
+ Ps as I,
3257
+ b as a,
3258
+ Us as b,
3259
+ Zs as g,
3260
+ Xs as r
3261
+ };
3262
+ //# sourceMappingURL=index-CBaynReP.mjs.map