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