@wix/interact 2.5.5 → 2.5.7

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