@wix/interact 2.5.2 → 2.5.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.
@@ -21,14 +21,21 @@ This document contains rules for generating interactions that respond to element
21
21
 
22
22
  **Problem:** Elements with entrance animations (e.g. `FadeIn`) start in their final visible state (e.g. `opacity: 1`). Before the animation framework initializes and applies the starting keyframe (e.g. `opacity: 0`), the element is briefly visible at full opacity — a flash of un-animated content.
23
23
 
24
- **Solution:** Call `generate(config, useFirstChild)` server-side or at build time and inject the resulting CSS into the document `<head>` (or at the beginning of `<body>`) so it loads before the page content is painted. Among all the CSS it produces, `generate()` includes initial rules that hide entrance-animated elements from the moment the page renders, before JavaScript runs. The rules use `:not([data-interact-enter])` so elements become visible once the animation starts.
24
+ **Solution:** Call `generate(config, useFirstChild)` at build/generation time and embed the resulting CSS before first paint. Among all the CSS it produces, `generate()` includes initial rules that hide entrance-animated elements from the moment the page renders, before JS runs. The rules use `:not([data-interact-enter])` so elements become visible once the animation starts.
25
25
 
26
- ### Generate CSS and inject into `<head>` (preferred), or beginning of `<body>`
26
+ ### Generate CSS at build time and embed in HTML
27
27
 
28
- Call `generate(config)` server-side or at build time. Inject the resulting CSS into the document `<head>` (or in `<body>` before your content) so it loads before the page content is painted:
28
+ Prefer running this for the complete config in a **build/generation script**
29
+ (Node, SSG, agent scratch) and embedding the resulting CSS in the HTML output.
30
+ If some entrances depend on runtime-only data, split them into a separate config
31
+ and generate/inject that CSS in the browser before its `Interact.create()` call.
32
+ If splitting is impractical, generate the complete CSS at runtime as a fallback:
29
33
 
30
34
  ```typescript
31
35
  import { generate } from '@wix/interact';
36
+ import { FadeIn } from '@wix/motion-presets';
37
+
38
+ Interact.registerEffects({ FadeIn });
32
39
 
33
40
  const config: InteractConfig = {
34
41
  interactions: [
@@ -46,26 +53,51 @@ const config: InteractConfig = {
46
53
  ],
47
54
  };
48
55
 
49
- const css = generate(config, useFirstChild);
56
+ const css = generate(config, useFirstChild); // true for web; false for react/vanilla
50
57
  ```
51
58
 
52
- **Append to `<head>` or beginning of `<body>`:**
59
+ **Embed the CSS** using one of:
53
60
 
54
61
  ```html
55
- <style>
56
- ${css}
57
- </style>
62
+ <!-- Option 1: inline in <head> (preferred) -->
63
+ <head>
64
+ <style>
65
+ …generated css…
66
+ </style>
67
+ </head>
68
+
69
+ <!-- Option 2: linked stylesheet in <head> -->
70
+ <head>
71
+ <link rel="stylesheet" href="interact.css" />
72
+ </head>
73
+
74
+ <!-- Option 3: render-blocking at start of <body> (prevents FOUC) -->
75
+ <body>
76
+ <style blocking="render">
77
+ …generated css…
78
+ </style>
79
+ <!-- or -->
80
+ <link rel="stylesheet" href="interact.css" blocking="render" />
81
+ …
82
+ </body>
58
83
  ```
59
84
 
60
85
  ### Rules
61
86
 
62
- - `generate()` should be called server-side or at build time. Can also be called on the client if the page content is initially hidden (e.g. behind a loader/splash screen).
87
+ - For static/pre-rendered sites, prefer generating all possible CSS at
88
+ build/generation time. Split runtime-dependent interactions into a separate
89
+ config where practical, or fall back to generating the full config at runtime.
90
+ - Inject runtime-generated CSS before the corresponding `Interact.create()` call
91
+ and before revealing initially hidden content to minimize FOUC.
63
92
  - FOUC initial rules apply only to `viewEnter` + `triggerType: 'once'` (or no `triggerType`, which defaults to `'once'`) where source and target are the same element.
64
93
  - For `viewEnter` with `triggerType: 'repeat'`/`'alternate'`/`'state'`, manually apply the starting keyframe as inline styles on the target element and use `fill: 'both'`.
65
94
  - `generate(config)` processes all interactions in the config, not just `viewEnter`.
66
95
 
67
96
  ## Rule 1: keyframeEffect / namedEffect (TimeEffect)
68
97
 
98
+ For static sites, include this interaction in the config passed to `generate()` at
99
+ build time (see [FOUC section](#preventing-flash-of-unstyled-content-fouc)).
100
+
69
101
  Use `keyframeEffect` or `namedEffect` when the viewEnter should play an animation (CSS or WAAPI). Set `triggerType` on each effect to control playback behavior. Use `params` only for observer configuration (`threshold`, `inset`).
70
102
 
71
103
  **Multiple effects:** The `effects` array can contain multiple effects — all share the same viewEnter trigger and fire together when the element enters the viewport. Each effect can have its own `triggerType`. Use this to animate different targets from a single viewport entry event.
@@ -19,6 +19,9 @@ These rules help generate scroll-driven interactions using `@wix/interact`. View
19
19
 
20
20
  **Use Case**: Scroll-driven CSS-based effects.
21
21
 
22
+ For static sites, pre-render CSS via `generate()` at build time — see
23
+ [Pre-rendering Scroll-driven CSS with generate()](#pre-rendering-scroll-driven-css-with-generate).
24
+
22
25
  **Multiple effects:** The `effects` array can contain multiple effects — all are driven by the same scroll progress. Use this to animate different targets or properties in sync with the same scroll position.
23
26
 
24
27
  ### Template
@@ -148,10 +151,26 @@ These rules help generate scroll-driven interactions using `@wix/interact`. View
148
151
 
149
152
  ## Pre-rendering Scroll-driven CSS with generate()
150
153
 
151
- Call `generate(config)` server-side or at build time to produce native scroll-driven CSS for `viewProgress` interactions. The generated output includes `view-timeline` declarations, `animation-timeline`/`animation-range` custom properties, and `@keyframes` — everything the browser needs to run scroll-driven animations without any JavaScript.
154
+ **Static site policy:** For static or pre-rendered HTML, prefer calling
155
+ `generate()` for the complete config at build/generation time and embedding the
156
+ CSS in the shipped HTML. If some interactions depend on runtime-only data, split
157
+ them into a separate config: pre-generate the static config and generate/inject
158
+ the runtime config in the browser before its `Interact.create()` call. If
159
+ splitting is impractical, generating the complete CSS at runtime is an acceptable
160
+ fallback. Call `registerEffects()` before each `generate()` when using
161
+ `namedEffect` scroll presets.
162
+
163
+ Call `generate(config, useFirstChild)` at build/generation time to produce native
164
+ scroll-driven CSS for `viewProgress` interactions. The generated output includes
165
+ `view-timeline` declarations, `animation-timeline`/`animation-range` custom
166
+ properties, and `@keyframes` — everything the browser needs to run scroll-driven
167
+ animations without any JS.
152
168
 
153
169
  ```typescript
154
170
  import { generate } from '@wix/interact';
171
+ import { ParallaxScroll } from '@wix/motion-presets';
172
+
173
+ Interact.registerEffects({ ParallaxScroll });
155
174
 
156
175
  const config = {
157
176
  interactions: [
@@ -174,15 +193,33 @@ const config = {
174
193
  effects: {},
175
194
  };
176
195
 
177
- const css = generate(config, false);
196
+ const css = generate(config, false); // false for react/vanilla; true for web
178
197
  ```
179
198
 
180
- Inject the resulting CSS into `<head>` so scroll-driven animations are ready before JS loads:
199
+ **Embed the CSS** using one of:
181
200
 
182
201
  ```html
183
- <style>
184
- ${css}
185
- </style>
202
+ <!-- Option 1: inline in <head> (preferred) -->
203
+ <head>
204
+ <style>
205
+ …generated css…
206
+ </style>
207
+ </head>
208
+
209
+ <!-- Option 2: linked stylesheet in <head> -->
210
+ <head>
211
+ <link rel="stylesheet" href="interact.css" />
212
+ </head>
213
+
214
+ <!-- Option 3: render-blocking at start of <body> -->
215
+ <body>
216
+ <style blocking="render">
217
+ …generated css…
218
+ </style>
219
+ <!-- or -->
220
+ <link rel="stylesheet" href="interact.css" blocking="render" />
221
+ …
222
+ </body>
186
223
  ```
187
224
 
188
225
  **Benefits:**
@@ -1,21 +0,0 @@
1
- "use strict";function vt(t){return[...t.matchAll(/\[([-\w]+)]/g)].map(([e,n])=>n)}function $(t,e){const n=vt(e);let s=0;return n.length?t.replace(/\[]/g,()=>{const i=n[s++];return i!==void 0?`[${i}]`:"[]"}):t}function yt(t,e){return t.trigger==="viewEnter"&&e.triggerType==="once"&&G(t)===G(e)}function G(t){const{key:e,listContainer:n,listItemSelector:s,selector:i}=t;return`${e}\0${n||""}\0${s||""}\0${i||""}`}function ze(t){let e=0,n=0;for(let s=0;s<t.length;s++){const i=t.charCodeAt(s);e=(e<<5)-e+i|0,n=n<<3^n>>>2^i|0}return((e>>>0)*1048576+(n>>>0)%1048576).toString(36)}class V{animations;options;ready;isCSS;longestAnimation;constructor(e,n){this.animations=e,this.options=n,this.ready=n?.measured||Promise.resolve(),this.isCSS=e[0]instanceof CSSAnimation,this.longestAnimation=this._getAnimationWithLongestEndTime()}_getAnimationWithLongestEndTime(){return this.animations.reduce((e,n)=>{const s=e.effect?.getComputedTiming().endTime??0,i=n.effect?.getComputedTiming().endTime??0;return s>i?e:n},this.animations[0])}getProgress(){return this.longestAnimation?.effect?.getComputedTiming().progress||0}async play(e){await this.ready;for(const n of this.animations)n.play();await Promise.all(this.animations.map(n=>n.ready)),e&&e()}pause(){for(const e of this.animations)e.pause()}async reverse(e){await this.ready;for(const n of this.animations)n.reverse();await Promise.all(this.animations.map(n=>n.ready)),e&&e()}progress(e){for(const n of this.animations){const{delay:s,duration:i,iterations:r}=n.effect.getTiming(),o=(Number.isFinite(i)?i:0)*(Number.isFinite(r)?r:1);n.currentTime=((s||0)+o)*e}}cancel(){for(const e of this.animations)e.cancel()}setPlaybackRate(e){for(const n of this.animations)n.playbackRate=e}async onFinish(e){try{await Promise.all(this.animations.map(s=>s.finished));const n=this.animations[0];if(n&&!this.isCSS){const s=n.effect?.target;if(s){const i=this.options?.effectId||n.id,r=new CustomEvent("animationend",{detail:{effectId:i}});s.dispatchEvent(r)}}e()}catch(n){console.warn("animation was interrupted - aborting onFinish callback - ",n)}}async onAbort(e){try{await Promise.all(this.animations.map(n=>n.finished))}catch(n){if(n.name==="AbortError"){const s=this.animations[0];if(s&&!this.isCSS){const i=s.effect?.target;if(i){const r=new Event("animationcancel");i.dispatchEvent(r)}}e()}}}get finished(){return Promise.all(this.animations.map(e=>e.finished))}get playState(){return this.animations.some(e=>e.playState==="running")?"running":this.animations[0]?.playState}hasAnimationName(e){return this.animations.some(n=>n.animationName===e)}hasAnimationId(e){return this.animations.some(n=>n.id===e)}getTimingOptions(){return this.animations.map(e=>{const n=e.effect?.getTiming(),s=n?.delay??0,i=Number(n?.duration)||0,r=n?.iterations??1;return{delay:s,duration:i,iterations:r}})}}const He=t=>t,Et=t=>1-Math.cos(t*Math.PI/2),wt=t=>Math.sin(t*Math.PI/2),bt=t=>-(Math.cos(Math.PI*t)-1)/2,St=t=>t**2,Tt=t=>1-(1-t)**2,It=t=>t<.5?2*t**2:1-(-2*t+2)**2/2,Ot=t=>t**3,At=t=>1-(1-t)**3,Ct=t=>t<.5?4*t**3:1-(-2*t+2)**3/2,kt=t=>t**4,$t=t=>1-(1-t)**4,_t=t=>t<.5?8*t**4:1-(-2*t+2)**4/2,qt=t=>t**5,Mt=t=>1-(1-t)**5,Pt=t=>t<.5?16*t**5:1-(-2*t+2)**5/2,xt=t=>t===0?0:2**(10*t-10),Lt=t=>t===1?1:1-2**(-10*t),Rt=t=>t===0?0:t===1?1:t<.5?2**(20*t-10)/2:(2-2**(-20*t+10))/2,Ft=t=>1-Math.sqrt(1-t**2),Nt=t=>Math.sqrt(1-(t-1)**2),zt=t=>t<.5?(1-Math.sqrt(1-4*t**2))/2:(Math.sqrt(-(2*t-3)*(2*t-1))+1)/2,Ht=t=>2.70158*t**3-1.70158*t**2,jt=t=>1+2.70158*(t-1)**3+1.70158*(t-1)**2,Dt=(t,e=1.70158*1.525)=>t<.5?(2*t)**2*((e+1)*2*t-e)/2:((2*t-2)**2*((e+1)*(t*2-2)+e)+2)/2,Te={linear:He,sineIn:Et,sineOut:wt,sineInOut:bt,quadIn:St,quadOut:Tt,quadInOut:It,cubicIn:Ot,cubicOut:At,cubicInOut:Ct,quartIn:kt,quartOut:$t,quartInOut:_t,quintIn:qt,quintOut:Mt,quintInOut:Pt,expoIn:xt,expoOut:Lt,expoInOut:Rt,circIn:Ft,circOut:Nt,circInOut:zt,backIn:Ht,backOut:jt,backInOut:Dt},Ie={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",sineIn:"cubic-bezier(0.47, 0, 0.745, 0.715)",sineOut:"cubic-bezier(0.39, 0.575, 0.565, 1)",sineInOut:"cubic-bezier(0.445, 0.05, 0.55, 0.95)",quadIn:"cubic-bezier(0.55, 0.085, 0.68, 0.53)",quadOut:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",quadInOut:"cubic-bezier(0.455, 0.03, 0.515, 0.955)",cubicIn:"cubic-bezier(0.55, 0.055, 0.675, 0.19)",cubicOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",cubicInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",quartIn:"cubic-bezier(0.895, 0.03, 0.685, 0.22)",quartOut:"cubic-bezier(0.165, 0.84, 0.44, 1)",quartInOut:"cubic-bezier(0.77, 0, 0.175, 1)",quintIn:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",quintOut:"cubic-bezier(0.23, 1, 0.32, 1)",quintInOut:"cubic-bezier(0.86, 0, 0.07, 1)",expoIn:"cubic-bezier(0.95, 0.05, 0.795, 0.035)",expoOut:"cubic-bezier(0.19, 1, 0.22, 1)",expoInOut:"cubic-bezier(1, 0, 0, 1)",circIn:"cubic-bezier(0.6, 0.04, 0.98, 0.335)",circOut:"cubic-bezier(0.075, 0.82, 0.165, 1)",circInOut:"cubic-bezier(0.785, 0.135, 0.15, 0.86)",backIn:"cubic-bezier(0.6, -0.28, 0.735, 0.045)",backOut:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",backInOut:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"};function Gt(t){return t==="percentage"?"%":t||"px"}function J(t){return t?Ie[t]||t:Ie.linear}function Wt(t,e,n,s){const i=3*t,r=3*(n-t)-i,o=1-i-r,a=3*e,c=3*(s-e)-a,l=1-a-c,f=p=>((o*p+r)*p+i)*p,u=p=>((l*p+c)*p+a)*p,d=p=>(3*o*p+2*r)*p+i;function g(p){let m=p;for(let y=0;y<8;y++){const E=f(m)-p;if(Math.abs(E)<1e-7)return m;const w=d(m);if(Math.abs(w)<1e-6)break;m-=E/w}let h=0,v=1;for(m=(h+v)/2;v-h>1e-7;){const y=f(m);if(Math.abs(y-p)<1e-7)return m;p>y?h=m:v=m,m=(h+v)/2}return m}return p=>p<=0?0:p>=1?1:u(g(p))}function Vt(t){const e=t.match(/^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/);if(!e)return;const n=parseFloat(e[1]),s=parseFloat(e[2]),i=parseFloat(e[3]),r=parseFloat(e[4]);if(![n,s,i,r].some(isNaN))return Wt(n,s,i,r)}function Yt(t){const e=t.match(/^linear\((.+)\)$/);if(!e)return;const n=e[1].split(",").map(o=>o.trim()).filter(Boolean);if(n.length===0)return;const s=[];for(const o of n){const a=o.split(/\s+/),c=parseFloat(a[0]);if(isNaN(c))return;const l=[];for(let f=1;f<a.length;f++)if(a[f].endsWith("%")){const u=parseFloat(a[f])/100;if(isNaN(u))return;l.push(u)}l.length===0?s.push({output:c,pos:null}):l.length===1?s.push({output:c,pos:l[0]}):(s.push({output:c,pos:l[0]}),s.push({output:c,pos:l[1]}))}if(s.length===0)return;s[0].pos===null&&(s[0].pos=0),s[s.length-1].pos===null&&(s[s.length-1].pos=1);let i=0;for(;i<s.length;)if(s[i].pos===null){const o=i-1;let a=i;for(;a<s.length&&s[a].pos===null;)a++;const c=s[o].pos,l=s[a].pos,f=a-o;for(let u=o+1;u<a;u++)s[u].pos=c+(l-c)*(u-o)/f;i=a+1}else i++;for(let o=1;o<s.length;o++)s[o].pos<s[o-1].pos&&(s[o].pos=s[o-1].pos);const r=s;return o=>{if(o<=r[0].pos)return r[0].output;const a=r[r.length-1];if(o>=a.pos)return a.output;let c=0,l=r.length-1;for(;c<l-1;){const d=c+l>>>1;r[d].pos<=o?c=d:l=d}const f=r[c],u=r[l];return u.pos===f.pos?u.output:f.output+(u.output-f.output)*(o-f.pos)/(u.pos-f.pos)}}function be(t){if(!t)return;const e=Te[t];return e||(Vt(t)??Yt(t)??Te.linear)}class Bt extends V{animationGroups;delay;offset;offsetEasing;timingOptions;constructor(e,n={}){const s=e.flatMap(i=>[...i.animations]);super(s),this.animationGroups=e,this.delay=n.delay??0,this.offset=n.offset??0,this.offsetEasing=typeof n.offsetEasing=="function"?n.offsetEasing:be(n.offsetEasing)??He,this.timingOptions=this.animationGroups.map(i=>i.getTimingOptions().map(({delay:r,duration:o,iterations:a})=>({delay:r,duration:Number.isFinite(o)?o:0,iterations:Number.isFinite(a)?a:1}))),this.applyOffsets(),this.ready=Promise.all(e.map(i=>i.ready)).then(()=>{})}calculateOffsets(){const e=this.animationGroups.length;if(e<=1)return[0];const n=e-1;return Array.from({length:e},(s,i)=>this.offsetEasing(i/n)*n*this.offset|0)}applyOffsets(){if(this.animationGroups.length===0||this.animations.length===0)return;const e=this.calculateOffsets(),n=this.getSequenceActiveDuration(e);this.animationGroups.forEach((s,i)=>{s.animations.forEach((r,o)=>{const a=r.effect;if(!a)return;const{delay:c,duration:l,iterations:f}=this.timingOptions[i][o],u=c+e[i],d=n-(u+l*f);a.updateTiming({delay:u+this.delay,endDelay:d})})})}getSequenceActiveDuration(e){const n=[];for(let s=0;s<this.timingOptions.length;s++){const i=this.timingOptions[s].reduce((r,o)=>{if(!o)return r;const{delay:a,duration:c,iterations:l}=o;return Math.max(r,a+c*l)},0);n.push(e[s]+i)}return Math.max(...n)}addGroups(e){if(e.length===0)return;const n=[...e].sort((s,i)=>i.index-s.index);for(const{index:s,group:i}of n){const r=Math.min(s,this.animationGroups.length);this.animationGroups.splice(r,0,i),this.timingOptions.splice(r,0,i.getTimingOptions());const o=[...i.animations],a=this.animationGroups.slice(0,r).reduce((c,l)=>c+l.animations.length,0);this.animations.splice(a,0,...o)}this.applyOffsets(),this.ready=Promise.all(this.animationGroups.map(s=>s.ready)).then(()=>{})}removeGroups(e){const n=[],s=[],i=[];for(let r=0;r<this.animationGroups.length;r++)e(this.animationGroups[r])?n.push(this.animationGroups[r]):(s.push(this.animationGroups[r]),i.push(this.timingOptions[r]));if(n.length===0)return n;for(const r of n)r.cancel();return this.animationGroups=s,this.timingOptions=i,this.animations=s.flatMap(r=>[...r.animations]),this.applyOffsets(),this.ready=Promise.all(this.animationGroups.map(r=>r.ready)).then(()=>{}),n}async onFinish(e){try{await Promise.all(this.animationGroups.map(n=>n.finished)),e()}catch(n){console.warn("animation was interrupted - aborting onFinish callback - ",n)}}}class Kt{_animation;customEffect;progress;_tickCbId;_finishHandler;constructor(e,n,s,i){const r=new KeyframeEffect(n,[],{...s,composite:"add"}),{timeline:o}=i;this._animation=new Animation(r,o),this._tickCbId=null,this.progress=null,this.customEffect=a=>e(r.target,a),this._finishHandler=a=>{this.effect.target?.getAnimations().find(c=>c===this._animation)||this.cancel()},this.addEventListener("finish",this._finishHandler),this.addEventListener("remove",this._finishHandler)}_tick(){try{const e=this.effect?.getComputedTiming().progress??null;e!==this.progress&&(this.customEffect?.(e),this.progress=e),this._tickCbId=requestAnimationFrame(()=>{this._tick()})}catch(e){this._tickCbId=null,console.error(`failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error?e.message:e}`)}}get currentTime(){return this._animation.currentTime}set currentTime(e){this._animation.currentTime=e}get startTime(){return this._animation.startTime}set startTime(e){this._animation.startTime=e}get playbackRate(){return this._animation.playbackRate}set playbackRate(e){this._animation.playbackRate=e}get id(){return this._animation.id}set id(e){this._animation.id=e}get effect(){return this._animation.effect}set effect(e){this._animation.effect=e}get timeline(){return this._animation.timeline}set timeline(e){this._animation.timeline=e}get finished(){return this._animation.finished}get pending(){return this._animation.pending}get playState(){return this._animation.playState}get ready(){return this._animation.ready}get replaceState(){return this._animation.replaceState}get oncancel(){return this._animation.oncancel}set oncancel(e){this._animation.oncancel=e}get onfinish(){return this._animation.onfinish}set onfinish(e){this._animation.onfinish=e}get onremove(){return this._animation.onremove}set onremove(e){this._animation.onremove=e}play(){this._animation.play(),cancelAnimationFrame(this._tickCbId),this._tickCbId=requestAnimationFrame(()=>this._tick())}pause(){this._animation.pause(),cancelAnimationFrame(this._tickCbId),this._tickCbId=null}cancel(){this.removeEventListener("finish",this._finishHandler),this.removeEventListener("remove",this._finishHandler),this._animation.cancel(),this.customEffect(null),cancelAnimationFrame(this._tickCbId),this._tickCbId=null}commitStyles(){console.warn("CustomEffect animations do not support commitStyles method as they have no style to commit")}finish(){this._animation.finish()}persist(){this._animation.persist()}reverse(){this._animation.reverse()}updatePlaybackRate(e){this._animation.updatePlaybackRate(e)}addEventListener(e,n,s){this._animation.addEventListener(e,n,s)}removeEventListener(e,n,s){this._animation.removeEventListener(e,n,s)}dispatchEvent(e){return this._animation.dispatchEvent(e)}}function Qt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ee={exports:{}},Oe=ee.exports,Ae;function Ut(){return Ae||(Ae=1,(function(t){(function(e){var n=function(){},s=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.msRequestAnimationFrame||function(f){return setTimeout(f,16)};function i(){var f=this;f.reads=[],f.writes=[],f.raf=s.bind(e)}i.prototype={constructor:i,runTasks:function(f){for(var u;u=f.shift();)u()},measure:function(f,u){var d=u?f.bind(u):f;return this.reads.push(d),r(this),d},mutate:function(f,u){var d=u?f.bind(u):f;return this.writes.push(d),r(this),d},clear:function(f){return a(this.reads,f)||a(this.writes,f)},extend:function(f){if(typeof f!="object")throw new Error("expected object");var u=Object.create(this);return c(u,f),u.fastdom=this,u.initialize&&u.initialize(),u},catch:null};function r(f){f.scheduled||(f.scheduled=!0,f.raf(o.bind(null,f)))}function o(f){var u=f.writes,d=f.reads,g;try{n("flushing reads",d.length),f.runTasks(d),n("flushing writes",u.length),f.runTasks(u)}catch(p){g=p}if(f.scheduled=!1,(d.length||u.length)&&r(f),g)if(n("task errored",g.message),f.catch)f.catch(g);else throw g}function a(f,u){var d=f.indexOf(u);return!!~d&&!!f.splice(d,1)}function c(f,u){for(var d in u)u.hasOwnProperty(d)&&(f[d]=u[d])}var l=e.fastdom=e.fastdom||new i;t.exports=l})(typeof window<"u"?window:typeof Oe<"u"?Oe:globalThis)})(ee)),ee.exports}var Xt=Ut();const O=Qt(Xt),de={};function Zt(t){Object.assign(de,t)}function Jt(t){return t in de?de[t]:(console.warn(`${t} not found in registry. Please make sure to import and register the preset.`),null)}function N(t,e){return t?(e||document).getElementById(t):null}function en(t,e){return t?.matches(`[data-motion-part~="${e}"]`)?t:t?.querySelector(`[data-motion-part~="${e}"]`)}function tn(t){const e=t.alternate?"alternate":"";return t.reversed?`${e?`${e}-`:""}reverse`:e||"normal"}function ce(t){return`${t.value}${Gt(t.unit)}`}function Ce(t,e,n){return`${t.name||"cover"} ${n&&t.offset.unit!=="percentage"?`calc(100% + ${ce(t.offset)}${e?` + ${e}`:""})`:e?`calc(${ce(t.offset)} + ${e})`:ce(t.offset)}`}function je(t){return{start:Ce(t.startOffset,t.startOffsetAdd),end:Ce(t.endOffset,t.endOffsetAdd,!0)}}function De(t){return e=>O.measure(()=>e(t))}function Ge(t){return e=>O.mutate(()=>e(t))}function W(t){if(t.namedEffect){const e=t.namedEffect.type;return typeof e=="string"?Jt(e):null}else if(t.keyframeEffect){const e=s=>{const{name:i,keyframes:r}=s.keyframeEffect;return[{...s,name:i,keyframes:r}]};return{web:e,style:e,getNames:s=>{const{effectId:i}=s,{name:r}=s.keyframeEffect,o=r||i;return o?[o]:[]}}}else if(t.customEffect)return e=>[{...e,keyframes:[]}];return null}function We(t,e,n,s){return t.map((i,r)=>{const o={fill:i.fill,easing:J(i.easing),iterations:i.iterations===0?1/0:i.iterations||1,composite:i.composite,direction:tn(i)};return Se(e)?(o.duration=i.duration,o.delay=i.delay||0):e?.trigger==="view-progress"&&(s||window.ViewTimeline)?o.duration="auto":(o.duration=99.99,o.delay=.01),{effect:i,options:o,id:n&&`${n}-${r+1}`,part:i.part}})}function Se(t){return!t||t.trigger!=="pointer-move"&&t.trigger!=="view-progress"}function ke(t,e,n,s,i){if(t){if(Se(s)&&(e.duration=e.duration||1,i?.reducedMotion))if(e.iterations===1||e.iterations==null)e={...e,duration:1};else return[];let r;return n instanceof HTMLElement&&(r={measure:De(n),mutate:Ge(n)}),t.web?t.web(e,r,i):t(e,r,i)}return[]}function Ve(t,e,n,s,i){const r=t instanceof HTMLElement?t:N(t,i);if(n?.trigger==="pointer-move"&&!e.keyframeEffect){let d=e;e.customEffect&&(d={...e,namedEffect:{id:"",type:"CustomMouse"}});const g=W(d),p=ke(g,e,r,n,s);return typeof p!="function"?null:p(r)}const o=W(e),a=ke(o,e,r,n,s);if(!a||a.length===0)return null;const c=We(a,n,e.effectId);let l;const f=n?.trigger==="view-progress";f&&window.ViewTimeline&&(l=new ViewTimeline({subject:n.element||N(n.componentId)}));const u=c.map(({effect:d,options:g,id:p,part:m})=>{const h=m?en(r,m):r,v=new KeyframeEffect(h||null,[],g);O.mutate(()=>{"timing"in d&&v.updateTiming(d.timing),v.setKeyframes(d.keyframes)});const y=f&&l?{timeline:l}:{},E=typeof d.customEffect=="function"?new Kt(d.customEffect,h||null,g,y):new Animation(v,y.timeline);if(f)if(l)O.mutate(()=>{const{start:w,end:S}=je(d);E.rangeStart=w,E.rangeEnd=S,E.play()});else{const{startOffset:w,endOffset:S}=e;O.mutate(()=>{const T=d.startOffset||w,I=d.endOffset||S;Object.assign(E,{start:{name:T.name,offset:T.offset?.value,add:d.startOffsetAdd},end:{name:I.name,offset:I.offset?.value,add:d.endOffsetAdd}})})}return p&&(E.id=p),E});return new V(u,{...e,trigger:{...n||{}},measured:new Promise(d=>O.mutate(d))})}function nn(t,e){return t?`#${t}${e?`[data-motion-part~="${e}"]`:""}`:""}function sn(t,e){const{duration:n,delay:s,iterations:i=1,fill:r,easing:o="linear",direction:a}=t.options,c=t.effect.name,l=n==="auto";return`${c} ${l?"auto":`${n}ms`}${l?" ":` ${s||1}ms `}${o}${r&&r!=="none"?` ${r}`:""} ${!i||i===1/0?"infinite":i}${a==="normal"?"":` ${a}`} ${e?"":"paused"}`}function rn(t,e,n){return t?.style?(Se(n)&&(e.duration=e.duration||1),t.style(e)):[]}function on(t,e,n){const s=W(e),i=rn(s,e),r=We(i,n,e.effectId,!0),o=n?.trigger==="view-progress";return r.map((a,c)=>{const{start:l,end:f}=o?je(a.effect):{};return{target:nn(t,a.part),animation:sn(a,o),composition:a.options.composite,custom:a.effect.custom,name:a.effect.name,keyframes:a.effect.keyframes,id:a.id&&`${a.id}-${c+1}`,animationTimeline:o?`--${n?.id}`:"",animationRange:l||f?`${l} ${f}`:""}})}function an(t,e,n){const s=W(e),i=t instanceof HTMLElement?t:N(t);if(s&&s.prepare&&i){const r={measure:De(i),mutate:Ge(i)};s.prepare(e,r)}n&&O.mutate(n)}function Ye(t,e){const n=W(e);if(!n)return null;if(!n.style)return e.effectId&&t?cn(t,e.effectId):null;const s=n.getNames(e),r=(typeof t=="string"?N(t):t)?.getAnimations(),o=r?.map(c=>c.animationName)||[],a=[];return s.forEach(c=>{o.includes(c)&&a.push(r?.find(l=>l.animationName===c))}),a?.length?new V(a):null}function cn(t,e){const s=(typeof t=="string"?N(t):t)?.getAnimations().filter(i=>{const r=i.id||i.animationName;return r?r.startsWith(e):!0});return s?.length?new V(s):null}function Be(t,e,n,s={}){const{disabled:i,allowActiveEvent:r,...o}=s,a=Ve(t,e,n,o);if(!a)return null;let c={};if(n.trigger==="view-progress"&&!window.ViewTimeline){const l=n.element||N(n.componentId),{ready:f}=a;return a.animations.map(u=>({get start(){return u.start},get end(){return u.end},viewSource:l,ready:f,getProgress(){return a.getProgress()},effect(d,g){const{activeDuration:p}=u.effect.getComputedTiming(),{delay:m}=u.effect.getTiming();u.currentTime=((m||0)+(p||0))*g},disabled:i,destroy(){u.cancel()}}))}else if(n.trigger==="pointer-move"){const l=e,{centeredToTarget:f,transitionDuration:u,transitionEasing:d}=l,g=n.axis;if(l.keyframeEffect){const p=a;return p.animations?.length===0?null:{target:void 0,centeredToTarget:f,ready:p.ready,_currentProgress:0,getProgress(){return this._currentProgress},effect(h,v){const y=g==="x"?v.x:v.y;this._currentProgress=y,p.progress(y)},disabled:i??!1,destroy(){p.cancel()}}}c={centeredToTarget:f,allowActiveEvent:r},e.customEffect&&u&&(c.transitionDuration=u,c.transitionEasing=be(d)),c.target=a.target}return{...c,getProgress(){return a.getProgress()},effect(l,f,u,d){a.progress(u?{...f,v:u,active:d}:f)},disabled:i,destroy(){a.cancel()}}}function Y(t,e,n,s=!1){const i=Ye(t,e);return i?(i.ready=new Promise(r=>{an(t,e,r)}),i):Ve(t,e,n,{reducedMotion:s})}function fn(t){return t===null?[null]:typeof t=="string"?Array.from(document.querySelectorAll(t)):Array.isArray(t)?t:[t]}function Ke(t,e){const n=[];for(const{target:s,options:i}of t){const r=fn(s);for(const o of r){const a=Y(o,i,void 0,e?.reducedMotion);a instanceof V&&n.push(a)}}return n}function ln(t,e,n){const s=Ke(e,n);return new Bt(s,t)}function un(t,e=2){return parseFloat(t.toFixed(e))}function dn(t){return/\[]/g.test(t)}function hn(t){return`--${t.join("-")}`}function mn(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function pn(t,e,n,s){const i=t.length-1;t.forEach((r,o)=>{if(r){const a=o?s(o/i)*i*n|0:0;r.delay=e+a+(r.delay||0)}})}function te(t,e){return e.includes("&")?e.replace(/&/g,t):`${t}${e}`}function k(){return"wi-12343210".replace(/\d/g,t=>String.fromCharCode((+t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+t/4)+97))}function Qe(t){let{transition:e,transitionProperties:n}=t,s=[];if(e?.styleProperties){const{duration:i,easing:r,delay:o}=e;i&&(e.styleProperties.some(c=>c.name.startsWith("--"))?s=[`all ${i}ms ${J(r||"ease")}${o?` ${o}ms`:""}`,"visibility 0s"]:s=e.styleProperties.map(c=>`${c.name} ${i}ms ${J(r||"ease")}${o?` ${o}ms`:""}`))}else s=n?.filter(i=>i.duration).map(i=>`${i.name} ${i.duration}ms ${J(i.easing)||"ease"}${i.delay?` ${i.delay}ms`:""}`)||[];return s}function gn({key:t,effectId:e,transition:n,transitionProperties:s,childSelector:i="> :first-child",selectorCondition:r}){const o=Qe({transition:n,transitionProperties:s}),a=(n?.styleProperties||s)?.map(p=>`${p.name}: ${p.value};`)||[],c=t.replace(/"/g,"'"),l=`:is(:state(${e}), :--${e}) ${i}`,f=`[data-interact-effect~="${e}"] ${i}`,u=r?te(l,r):l,d=r?te(f,r):f,g=[`${u},
2
- ${d} {
3
- ${a.join(`
4
- `)}
5
- }`];if(o.length){const p=`[data-interact-key="${c}"] ${i}`,m=r?te(p,r):p;g.push(`@media (prefers-reduced-motion: no-preference) { ${m} {
6
- transition: ${o.join(", ")};
7
- } }`)}return g}function ae(t,e,n){const s=(t||[]).filter(i=>e[i]?.type===n&&e[i].predicate).map(i=>e[i].predicate).join(") and (");return s&&`(${s})`}function _(t,e){const n=ae(t,e,"media");return n&&window.matchMedia(n)}function L(t,e){return(t||[]).filter(n=>e[n]?.type==="selector"&&e[n].predicate).map(n=>`:is(${e[n].predicate})`).join("")}const K={rangeStart:{name:"cover",offset:{value:0,unit:"percentage"}},rangeEnd:{name:"cover",offset:{value:100,unit:"percentage"}}};function vn(t,e){const n=t?.name??K.rangeStart.name,s=e?.name??t?.name??K.rangeEnd.name,i={name:n,offset:t?.offset||K.rangeStart.offset},r={name:s,offset:e?.offset||K.rangeEnd.offset};return{startOffset:i,endOffset:r}}function q(t){if("keyframeEffect"in t&&!t.keyframeEffect.name&&"effectId"in t&&(t.keyframeEffect.name=t.effectId),"duration"in t)return{id:"",...t};const{rangeStart:e,rangeEnd:n,...s}=t,{startOffset:i,endOffset:r}=vn(e,n);return{id:"",startOffset:i,endOffset:r,...s}}function C(t,e,n){let s=t.get(e);s||(s=new Set,t.set(e,s)),s.add(n)}function B(t,e){t.get(e)?.forEach(s=>{const{source:i,target:r,cleanup:o}=s;o();const a=i===e?r:i;t.get(a)?.delete(s)}),t.delete(e)}const yn={root:null,rootMargin:"0px 0px -10% 0px",threshold:[0]},En={root:null,rootMargin:"0px",threshold:[0]},wn=.2;function bn(t){const e=t.trim().split(/\s+/),n=e[0],s=e.length>1?e[1]:e[0],i=r=>r.startsWith("-")?r.slice(1):parseFloat(r)?`-${r}`:r;return`${i(n)} 0px ${i(s)}`}const D={},M=new WeakMap,re=new WeakSet,z=new WeakMap;let Ue={},H=null;function Sn(t){Ue=t}function Xe(t,e,n){M.get(t)?.forEach(({source:i,handler:r})=>{i===t&&r(e,n)})}function $e(){return H||(H=new IntersectionObserver(t=>{t.forEach(e=>{const n=e.target;e.isIntersecting||Xe(n,!1,!0)})},En),H)}function Ze(t,e=!1){const n=JSON.stringify({...t,isSafeMode:e});if(D[n])return D[n];const s=t.threshold??wn,i=e?yn:{root:null,rootMargin:t.inset?bn(t.inset):"0px",threshold:s},r=new IntersectionObserver(o=>{o.forEach(a=>{const c=a.target,l=!re.has(c);if(l&&(re.add(c),t.useSafeViewEnter&&!a.isIntersecting)){O.measure(()=>{const f=a.boundingClientRect.height,u=a.rootBounds?.height;if(!u)return;const d=Array.isArray(t.threshold)?Math.min(...t.threshold):t.threshold;d&&f*d>u&&O.mutate(()=>{r.unobserve(c);const p=Ze(t,!0);z.set(c,p),p.observe(c)})});return}(a.isIntersecting||!l)&&Xe(c,a.isIntersecting)})},i);return D[n]=r,r}function Tn(t,e,n,s={},{reducedMotion:i,selectorCondition:r,animation:o}={}){const a={...Ue,...s},c=n.triggerType||"once",l=o||Y(e,q(n),void 0,i);if(!l)return;const f=Ze(a);c!=="once"&&l.persist?.();let u=!0,d=!1,g;g={source:t,target:e,handler:(h,v)=>{if(!(r&&!e.matches(r)))if(c==="once"){if(h&&!d){d=!0,M.get(t)?.delete(g),M.get(e)?.delete(g);const y=M.get(t);(!y||y.size===0)&&((z.get(t)||f).unobserve(t),re.delete(t)),l.play(()=>{const E=()=>{e.dataset.interactEnter="start"};if(l.isCSS){O.mutate(()=>{requestAnimationFrame(E)});const w=()=>{O.mutate(()=>{e.dataset.interactEnter="done"})};l.onFinish(w),l.onAbort(w)}else O.mutate(E)})}}else c==="alternate"?u&&h?(u=!1,l.play()):u||l.reverse():c==="repeat"?h?(l.progress(0),l.play()):v&&(l.pause(),l.progress(0)):c==="state"&&(h?l.play():v&&l.pause())},cleanup:()=>{(z.get(t)||f).unobserve(t),(c==="repeat"||c==="state")&&$e().unobserve(t),l.cancel(),re.delete(t),z.delete(t)}},C(M,t,g),C(M,e,g),z.set(t,f),f.observe(t),(c==="repeat"||c==="state")&&$e().observe(t)}function In(t){B(M,t)}function On(){H=null,Object.keys(D).forEach(t=>delete D[t])}const An={add:Tn,remove:In,setOptions:Sn,reset:On};function Je(t,e){return Object.assign(Object.create(e),t)}function Cn(t,e,n,s){let i=t*(1-n)+e*n;if(s){const r=i-t;Math.abs(r)<s&&(i=t+s*Math.sign(r));const o=e-i;if(Math.abs(o)<s)return e}return i}function kn(t){let e=!1;return function(){e||(e=!0,window.requestAnimationFrame(()=>{e=!1,t()}))}}function _e(t,e){let n=0;return function(){n&&window.clearTimeout(n),n=window.setTimeout(()=>{n=0,t()},e)}}function $n(t,e){const n=t.match(/^calc\s*\(\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\+\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\)\s*$/);return oe(n[1],e)+oe(n[6],e)}function oe(t,e){return t?/^-?\d+px$/.test(t)?parseInt(t):/^-?\d+[lsd]?vh$/.test(t)?parseInt(t)*e.viewportHeight/100:/^-?\d+[lsd]?vw$/.test(t)?parseInt(t)*e.viewportWidth/100:/^calc\s*\(\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\+\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\)\s*$/.test(t)?$n(t,e):parseInt(t)||0:0}function R(t,e,n){const{name:s,offset:i=0}=t,{start:r,end:o}=n,a=o-r,c=i/100;let l,f;return s==="entry"?(l=r-e,f=Math.min(e,a)):s==="entry-crossing"?(l=r-e,f=a):s==="contain"?(l=Math.min(o-e,r),f=Math.abs(e-a)):s==="exit"?(l=Math.max(r,o-e),f=Math.min(e,a)):s==="exit-crossing"?(l=r,f=a):s==="cover"&&(l=r-e,f=a+e),l+c*f|0}function fe(t,e,n,s,i){let r=0;const o={start:e,end:n};return t.forEach((a,c)=>{r+=a.offset;const l=a.sticky;if(l){if("end"in l&&t[c-1]?.element){const d=((i?a.element.offsetWidth:a.element.offsetHeight)||0)+l.end-s,g=r+d-a.offset,p=g<o.start,m=!p&&g<=n;let h=0;(p||m)&&(h=a.offset,o.end+=h),p&&(o.start+=h)}if("start"in l){const f=r-l.start,u=f<o.start,d=!u&&f<=o.end;let g=0;const p=t[c-1]?.element;if(p){if(u||d){const m=(i?p.offsetWidth:p.offsetHeight)||0,h=a.offset,v=(i?a.element.offsetWidth:a.element.offsetHeight)||0;g=m-(h+v),r+=g,o.end+=g}u&&(o.start+=g)}}}}),o}function _n(t,e,n,s,i,r){const{start:o,end:a,duration:c}=t;let l=o,f=a,u=t.startRange,d=t.endRange,g;if(typeof c=="string"){u={name:c,offset:0},d={name:c,offset:100},l=R(u,n,e),f=R(d,n,e),g=f-l;const p=fe(r,l,f,n,s);l=p.start,f=p.end}else{if(u||o?.name){u=u||o;const p=oe(u.add,i),m=R({...u,offset:0},n,e),h=R({...u,offset:100},n,e),v=fe(r,m,h,n,s);l=v.start+u.offset/100*(v.end-v.start)+p}if(d||a?.name){d=d||a;const p=oe(d.add,i),m=R({...d,offset:0},n,e),h=R({...d,offset:100},n,e),v=fe(r,m,h,n,s);f=v.start+d.offset/100*(v.end-v.start)+p}else typeof c=="number"&&(f=l+c)}return!g&&!c&&(g=f-l),{...t,start:l,end:f,startRange:u,endRange:d,duration:g||c}}function qn(t){return t.position==="sticky"}function Mn(t,e,n){return t.position==="fixed"&&(!e||e===window.document.body||e===n)}function Pn(t,e){return parseInt(e?t.left:t.top)}function xn(t,e){return parseInt(e?t.right:t.bottom)}function Ln(t,e,n){n&&(t.style.position="static");const s=(e?t.offsetLeft:t.offsetTop)||0;return n&&(t.style.position=null),s}function Rn(t,e){let n;const s=Pn(t,e),i=xn(t,e),r=!isNaN(s),o=!isNaN(i);return(r||o)&&(n={},r&&(n.start=s),o&&(n.end=i)),n}function Q(t,e,n,s,i){const r=t[0].viewSource,o=[];let a=(s?r.offsetWidth:r.offsetHeight)||0,c=0,l=r;for(;l;){const u=window.getComputedStyle(l),d=qn(u),g=d?Rn(u,s):void 0,p=Ln(l,s,d);if((!g||!("end"in g))&&(c+=p),o.push({element:l,offset:p,sticky:g}),l=l.offsetParent,Mn(u,l,e))break;if(l===e){o.push({element:l,offset:0});break}}return o.reverse(),t.map(u=>({..._n(u,{start:c,end:c+a},n,s,i,o)}))}const qe=100,Fn={horizontal:!1,observeViewportEntry:!0,viewportRootMargin:"7% 7%",observeViewportResize:!1,observeSourcesResize:!1,observeContentResize:!1};function Nn(t,e,n,s){let i=0;return t>=e&&t<=n?i=s?(t-e)/s:1:t>n&&(i=1),i}function Me(t,e){return t===window?e?window.document.documentElement.clientWidth:window.document.documentElement.clientHeight:e?t.clientWidth:t.clientHeight}function zn(){return{viewportWidth:window.document.documentElement.clientWidth,viewportHeight:window.document.documentElement.clientHeight}}function Hn(t){const e=Je(t,Fn),n=e.root,s=e.horizontal,i=new WeakMap;let r=Me(n,s),o,a,c,l,f;const u=[],d=zn();if(e.scenes=Object.values(t.scenes.reduce((m,h,v)=>{const y=h.groupId?`group-${h.groupId}`:String(v);return m[y]?m[y].push(h):m[y]=[h],m},{})).flatMap(m=>(m.every(h=>h.viewSource&&(typeof h.duration=="string"||h.start?.name))?(m=Q(m,n,r,s,d),(e.observeSourcesResize||e.observeContentResize)&&u.push(m)):m.forEach(h=>{h.end==null&&(h.end=h.start+h.duration),h.duration==null&&(h.duration=h.end-h.start)}),m)),e.scenes.forEach((m,h)=>{m.index=h}),u.length){const m=new Map;window.ResizeObserver&&(c=new window.ResizeObserver(function(h){h.forEach(v=>{const y=m.get(v.target),E=Q(y,n,r,s,d);E.forEach((w,S)=>{e.scenes[w.index]=E[S]}),u.splice(u.indexOf(y),1,E)})}),u.forEach(h=>{c.observe(h[0].viewSource,{box:"border-box"}),m.set(h[0].viewSource,h)}),e.observeContentResize&&e.contentRoot&&new window.ResizeObserver(_e(()=>{const v=u.map(y=>{const E=Q(y,n,r,s,d);return E.forEach((w,S)=>{e.scenes[w.index]=E[S]}),E});u.length=0,u.push(...v),u.forEach(y=>{m.set(y[0].viewSource,y)})},qe)).observe(e.contentRoot,{box:"border-box"})),e.observeViewportResize&&(l=_e(function(){r=Me(n,s);const h=u.map(v=>{const y=Q(v,n,r,s,d);return y.forEach((E,w)=>{e.scenes[E.index]=y[w]}),y});u.length=0,u.push(...h),u.forEach(v=>{m.set(v[0].viewSource,v)})},qe),n===window?window.addEventListener("resize",l):window.ResizeObserver&&(f=new window.ResizeObserver(l),f.observe(n,{box:"border-box"})))}e.observeViewportEntry&&window.IntersectionObserver&&(a=new window.IntersectionObserver(function(m){m.forEach(h=>{(i.get(h.target)||[]).forEach(v=>{v.disabled=!h.isIntersecting})})},{root:n===window?window.document:n,rootMargin:e.viewportRootMargin,threshold:0}),e.scenes.forEach(m=>{if(m.viewSource){let h=i.get(m.viewSource);h||(h=[],i.set(m.viewSource,h),a.observe(m.viewSource)),h.push(m)}}));function g({p:m,vp:h}){m=+m.toFixed(1);const v=+h.toFixed(4);if(m!==o){for(let y of e.scenes)if(!y.disabled){const{start:E,end:w,duration:S}=y,T=Nn(m,E,w,S);y.effect(y,T,v)}o=m}}function p(){e.scenes.forEach(m=>m.destroy?.()),a&&(a.disconnect(),a=null),c&&(c.disconnect(),c=null),l&&(f?(f.disconnect(),f=null):window.removeEventListener("resize",l))}return{tick:g,destroy:p}}const jn={transitionActive:!1,transitionFriction:.9,transitionEpsilon:1,velocityActive:!1,velocityMax:1};class Dn{constructor(e={}){this.config=Je(e,jn),this.progress={p:0,prevP:0,vp:0},this.currentProgress={p:0,prevP:0,vp:0},this._lerpFrameId=0,this.effect=null;const n=!this.config.root||this.config.root===window.document.body;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||(()=>{const s=this.config.root;this.progress.p=this.config.horizontal?s.scrollX||s.scrollLeft||0:s.scrollY||s.scrollTop||0}),this._trigger=kn(()=>{this._measure?.(),this.tick(!0)})}start(){this.setupEffect(),this.setupEvent(),this.resetProgress(),this.tick()}pause(){this.removeEvent()}resetProgress(e={}){const n=this.config.root,s=e.x||e.x===0?e.x:n.scrollX||n.scrollLeft||0,i=e.y||e.y===0?e.y:n.scrollY||n.scrollTop||0,r=this.config.horizontal?s:i;this.progress.p=r,this.progress.prevP=r,this.progress.vp=0,this.config.transitionActive&&(this.currentProgress.p=r,this.currentProgress.prevP=r,this.currentProgress.vp=0),e&&this.config.root.scrollTo(s,i)}tick(e){const n=this.config.transitionActive;n&&this.lerp();const s=n?this.currentProgress:this.progress;if(this.config.velocityActive){const i=s.p-s.prevP,r=i<0?-1:1;s.vp=Math.min(this.config.velocityMax,Math.abs(i))/this.config.velocityMax*r}this.effect.tick(s),n&&s.p!==this.progress.p&&(e&&this._lerpFrameId&&window.cancelAnimationFrame(this._lerpFrameId),this._lerpFrameId=window.requestAnimationFrame(()=>this.tick())),s.prevP=s.p}lerp(){this.currentProgress.p=Cn(this.currentProgress.p,this.progress.p,+(1-this.config.transitionFriction).toFixed(3),this.config.transitionEpsilon)}destroy(){this.pause(),this.removeEffect()}setupEvent(){this.removeEvent(),this.config.root.addEventListener("scroll",this._trigger)}removeEvent(){this.config.root.removeEventListener("scroll",this._trigger)}setupEffect(){this.removeEffect(),this.effect=Hn(this.config)}removeEffect(){this.effect&&this.effect.destroy(),this.effect=null}}const he=new WeakMap;let et=()=>({});function Gn(t){et=t}function Wn(t,e,n,s,{reducedMotion:i}){if(i)return;const r={trigger:"view-progress",element:t},o=q(n);let a;if("ViewTimeline"in window){const l=Y(e,o,r);l&&!l.isCSS&&(l.play(),a=()=>{l.ready.then(()=>{l.cancel()})})}else{const l=Be(e,o,r);if(l){const f=Array.isArray(l)?l:[l],u=new Dn({viewSource:t,scenes:f,observeViewportEntry:!1,observeViewportResize:!1,observeSourcesResize:!0,root:document.body,...et()});a=()=>{u.destroy()},Promise.all(f.map(d=>d.ready||Promise.resolve())).then(()=>{u.start()})}}if(!a)return;const c={source:t,target:e,cleanup:a};C(he,t,c),C(he,e,c)}function Vn(t){B(he,t)}const Yn={add:Wn,remove:Vn,registerOptionsGetter:Gn};function Pe(t,e,n){return Math.min(Math.max(t,n),e)}function xe(t){let e=!1;return function(){if(!e)return e=!0,window.requestAnimationFrame(()=>{e=!1,t()})}}function Bn(t){let e=t,n=0,s=0;if(e.offsetParent)do n+=e.offsetLeft,s+=e.offsetTop,e=e.offsetParent;while(e);return{left:n,top:s,width:t.offsetWidth,height:t.offsetHeight}}function Kn(){const t=window.devicePixelRatio;let e=!1;if(t===1)return!1;document.body.addEventListener("pointerdown",s=>{e=s.offsetX!==10},{once:!0});const n=new PointerEvent("pointerdown",{clientX:10});return document.body.dispatchEvent(n),e}function Qn(){return new Promise(t=>{const e=window.scrollY;let n=!1,s;function i(){document.body.addEventListener("pointerdown",a=>{s===void 0?s=a.offsetY:n=a.offsetY===s},{once:!0});const o=new PointerEvent("pointerdown",{clientY:500});document.body.dispatchEvent(o)}function r(){window.scrollY!==e&&(window.removeEventListener("scroll",r),i(),t(n))}i(),window.addEventListener("scroll",r),window.scrollY>0&&window.scrollBy(0,-1)})}function Un(t){Qn().then(e=>{t.fixRequired=e,e&&(window.addEventListener("scroll",t.scrollHandler),t.scrollHandler())})}let U=0;const ne=new Set;function Xn(){const t=n=>{for(let s of n.changedTouches)ne.add(s.identifier)},e=n=>{for(let s of n.changedTouches)ne.delete(s.identifier)};return document.addEventListener("touchstart",t,{passive:!0}),document.addEventListener("touchend",e,{passive:!0}),function(){ne.clear(),document.removeEventListener("touchstart",t),document.removeEventListener("touchend",e)}}function Zn(t,e){if("onscrollend"in window)return t.addEventListener("scrollend",e),function(){t.removeEventListener("scrollend",e)};let n=0,s;U||(s=Xn()),U+=1;function i(r){clearTimeout(n),n=setTimeout(()=>{ne.size?setTimeout(i,100):(e(r),n=0)},100)}return t.addEventListener("scroll",i),function(){t.removeEventListener("scroll",i),U-=1,U||s()}}function Jn(t,e,n){return{x(s){const i=t.left-n.x+t.width/2,r=i>=e.width/2,o=(r?i:e.width-i)*2,a=r?0:i-o/2;return(s-a)/o},y(s){const i=t.top-n.y+t.height/2,r=i>=e.height/2,o=(r?i:e.height-i)*2,a=r?0:i-o/2;return(s-a)/o}}}function es(t,e){this.x=window.scrollX,this.y=window.scrollY,requestAnimationFrame(()=>t&&t(e))}function ts(t){t.rect.width=window.document.documentElement.clientWidth,t.rect.height=window.document.documentElement.clientHeight}function ns(t){const e=new ResizeObserver(n=>{n.forEach(s=>{t.rect.width=s.borderBoxSize[0].inlineSize,t.rect.height=s.borderBoxSize[0].blockSize})});return e.observe(t.root,{box:"border-box"}),e}function ss(t){let e=!1,n={x:t.rect.width/2,y:t.rect.height/2,vx:0,vy:0},s,i,r,o,a;const c={x:0,y:0};t.scenes.forEach(f=>{f.target&&f.centeredToTarget&&(f.transform=Jn(Bn(f.target),t.rect,c),e=!0),t.root?i=ns(t):(r=ts.bind(null,t),window.addEventListener("resize",r))}),s=function(f){for(let u of t.scenes)if(!u.disabled){const d=u.transform?.x(f.x)||f.x/t.rect.width,g=u.transform?.y(f.y)||f.y/t.rect.height,p=+Pe(0,1,d).toPrecision(4),m=+Pe(0,1,g).toPrecision(4),h={x:f.vx,y:f.vy};t.allowActiveEvent&&(f.active=d<=1&&g<=1&&d>=0&&g>=0),u.effect(u,{x:p,y:m},h,f.active)}Object.assign(n,f)},e&&(o=es.bind(c,s,n),a=Zn(document,o));function l(){t.scenes.forEach(f=>f.destroy?.()),a?.(),i?(i.disconnect(),i=null):(window.removeEventListener("resize",r),r=null),s=null,n=null}return{tick:s,destroy:l}}const is=1e3/60*3;let X;function rs(){F.x=window.scrollX,F.y=window.scrollY}const F={x:0,y:0,scrollHandler:rs,fixRequired:void 0};class os{constructor(e={}){this.config={...e},this.effect=null,this._nextTick=null,this._nextTransitionTick=null,this._startTime=0;let n;this.config.transitionDuration?n=this.config.noThrottle?()=>this.transition():xe(()=>this.transition()):n=this.config.noThrottle?()=>(this.tick(),null):xe(()=>{this.tick()}),this.config.rect=this.config.root?{width:this.config.root.offsetWidth,height:this.config.root.offsetHeight}:{width:window.document.documentElement.clientWidth,height:window.document.documentElement.clientHeight},this.progress={x:this.config.rect.width/2,y:this.config.rect.height/2,vx:0,vy:0},this.previousProgress={...this.progress},this.currentProgress=null;const s=i=>{const r=this.config.root?i.offsetX:i.x,o=this.config.root?i.offsetY:i.y;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()};if(this._pointerLeave=()=>{this.progress.active=!1,this.progress.vx=0,this.progress.vy=0,this._nextTick=n()},this._pointerEnter=()=>{this.progress.active=!0,this._nextTick=n()},this.config.root){X=typeof X=="boolean"?X:Kn();const i=X?window.devicePixelRatio:1;typeof F.fixRequired>"u"&&Un(F),this._measure=r=>{if(r.target!==this.config.root){const o=new PointerEvent("pointermove",{bubbles:!0,cancelable:!0,clientX:r.x*i+F.x,clientY:r.y*i+F.y});r.stopPropagation(),this.config.root.dispatchEvent(o)}else s(r)}}else this._measure=s}start(){this.setupEffect(),this.setupEvent()}pause(){this.removeEvent()}tick(){this.effect.tick(this.progress)}transition(){const e=this.config.transitionDuration,n=this.config.transitionEasing||(o=>o),s=performance.now();let i=!1;const r=o=>{const a=(o-this._startTime)/e,c=n(Math.min(1,a));i&&(this.progress.vx=0,this.progress.vy=0,i=!1),this.currentProgress=Object.entries(this.progress).reduce((l,[f,u])=>(f==="active"?l[f]=u:l[f]=this.previousProgress[f]+(u-this.previousProgress[f])*c,l),this.currentProgress||{}),a<1&&(this._nextTransitionTick=requestAnimationFrame(r),i=o-this._startTime>is),this.effect.tick(this.currentProgress)};return this._startTime?(this._nextTransitionTick&&cancelAnimationFrame(this._nextTransitionTick),Object.assign(this.previousProgress,this.currentProgress),this._startTime=s,r(s)):this._startTime=s,this._nextTransitionTick}destroy(){this.pause(),this.removeEffect(),this._nextTick&&cancelAnimationFrame(this._nextTick),this._nextTransitionTick&&cancelAnimationFrame(this._nextTransitionTick)}setupEvent(){this.removeEvent();const e=this.config.root||window;e.addEventListener("pointermove",this._measure,{passive:!0}),this.config.eventSource&&this.config.eventSource.addEventListener("pointermove",this._measure,{passive:!0}),this.config.allowActiveEvent&&(e.addEventListener("pointerleave",this._pointerLeave,{passive:!0}),e.addEventListener("pointerenter",this._pointerEnter,{passive:!0}),this.config.eventSource&&(this.config.eventSource.addEventListener("pointerleave",this._pointerLeave,{passive:!0}),this.config.eventSource.addEventListener("pointerenter",this._pointerEnter,{passive:!0})))}removeEvent(){const e=this.config.root||window;e.removeEventListener("pointermove",this._measure),this.config.eventSource&&this.config.eventSource.removeEventListener("pointermove",this._measure),this.config.allowActiveEvent&&(e.removeEventListener("pointerleave",this._pointerLeave),e.removeEventListener("pointerenter",this._pointerEnter),this.config.eventSource&&(this.config.eventSource.removeEventListener("pointerleave",this._pointerLeave),this.config.eventSource.removeEventListener("pointerenter",this._pointerEnter)))}setupEffect(){this.removeEffect(),this.effect=ss(this.config)}removeEffect(){this.effect&&this.effect.destroy(),this.effect=null}}const me=new WeakMap;let tt=()=>({});function as(t){tt=t}function cs(t,e,n,s={},{reducedMotion:i}){if(i)return;const r={trigger:"pointer-move",element:t,axis:s.axis??"y"},o=Be(e,q(n),r);if(o){const a=Array.isArray(o)?o:[o],c=new os({root:s.hitArea==="self"?t:void 0,scenes:a,...tt()}),f={source:t,target:e,cleanup:()=>{c.destroy()}};C(me,t,f),C(me,e,f),Promise.all(a.map(u=>u.ready||Promise.resolve())).then(()=>{c.start()})}}function fs(t){B(me,t)}const ls={add:cs,remove:fs,registerOptionsGetter:as},pe=new WeakMap;function us(t,e,n,s,{reducedMotion:i,selectorCondition:r,animation:o,sourceAnimationOptions:a}){const c=o||Y(e,q(n),void 0,i);if(!c)return;const{effectId:l}=s,f=g=>{if(r&&!e.matches(r))return;const p=g.animationName,m=g.detail?.effectId,h=a?Ye(t,a):null;if(h){if(h.playState==="running"||p&&!h.hasAnimationName(p))return;if(m&&m!==l&&!h.hasAnimationId(m))return}c.play()},d={source:t,target:e,cleanup:()=>{c.cancel(),t.removeEventListener("animationend",f)}};C(pe,t,d),C(pe,e,d),t.addEventListener("animationend",f)}function ds(t){B(pe,t)}const hs={add:us,remove:ds};function ms(t,e,n=!1,s,i,r){const o=r||Y(t,q(e),void 0,n);if(!o)return null;let a=!0;const c=e.triggerType||"alternate";return l=>{if(s&&!t.matches(s))return;const f=!i,u=i?.enter?.includes(l.type),d=i?.leave?.includes(l.type);if(u||f){if(c==="alternate"||c==="state")a?(a=!1,o.play()):c==="alternate"?o.reverse():c==="state"&&(o.playState==="running"?o.pause():o.playState!=="finished"&&o.play());else{if(o.progress(0),delete t.dataset.interactEnter,o.isCSS){const g=()=>{O.mutate(()=>{t.dataset.interactEnter="done"})};o.onFinish(g),o.onAbort(g)}o.play()}return}d&&(c==="alternate"?o.reverse():c==="repeat"?(o.cancel(),O.mutate(()=>{delete t.dataset.interactEnter})):c==="state"&&o.playState==="running"&&o.pause())}}function ps(t,e,{effectId:n,listContainer:s,listItemSelector:i,stateAction:r},o,a){const c=!!s,l=r??"toggle",f=l==="toggle";return u=>{if(o&&!t.matches(o))return;const d=c?t.closest(`${s} > ${i||""}:has(:scope)`):void 0,g=!a,p=a?.enter?.includes(u.type),m=a?.leave?.includes(u.type);g?e.toggleEffect(n,l,d):(p&&e.toggleEffect(n,f?"add":l,d),m&&f&&e.toggleEffect(n,"remove",d))}}const ge=new WeakMap;function Le(t,e){return n=>{const s=n;t.contains(s.relatedTarget)||e(s)}}function gs(t){return e=>{const n=e;n.pointerType&&t(n)}}function vs(t){return e=>{const n=e;n.code==="Space"?(n.preventDefault(),t(n)):n.code==="Enter"&&t(n)}}const ys={focusin:(t,e)=>Le(t,e),focusout:(t,e)=>Le(t,e),click:(t,e)=>gs(e),keydown:(t,e)=>vs(e)};function Es(t,e,n){const s=ys[t];return s?s(e,n):i=>n(i)}function ws(t){return typeof t=="object"&&!Array.isArray(t)&&("enter"in t||"leave"in t)}function bs(t){if(typeof t=="string")return{toggle:[t]};if(Array.isArray(t))return{toggle:[...t]};if(ws(t)){const e=t.enter?[...t.enter]:[],n=t.leave?[...t.leave]:[];return{enter:e,leave:n}}return{}}function Ss(t){return!!(t.enter?.length||t.leave?.length)}function Ts(t){return Ss(t)?{enter:t.enter??[],leave:t.leave??[]}:void 0}function Is(t,e,n,s,{reducedMotion:i,targetController:r,selectorCondition:o,animation:a}){const c=bs(s.eventConfig),l=n.transition||n.transitionProperties,f=Ts(c);let u,d=!1;if(l?u=ps(e,r,n,o,f):(u=ms(e,n,i,o,f,a),d=n.triggerType==="once"),!u)return;const g=u,p=new AbortController;function m(y,E,w){const S=Es(E,t,g);y.addEventListener(E,S,{...w,signal:p.signal})}const v={source:t,target:e,cleanup:()=>{p.abort()}};if(C(ge,t,v),C(ge,e,v),f){const y=c.enter,E=c.leave;y.forEach(T=>{T==="focusin"&&(t.tabIndex=0),m(t,T,{passive:!0,once:d})});const w=!n.stateAction||n.stateAction==="toggle";(l?w:n.triggerType!=="once")&&E.forEach(T=>{if(T==="focusout"){m(t,T,{once:d});return}m(t,T,{passive:!0})})}else(c.toggle??[]).forEach(E=>{m(t,E,{once:d,passive:E!=="keydown"})})}function Os(t){B(ge,t)}const j={add:Is,remove:Os},ve={click:["click"],activate:["click","keydown"],hover:{enter:["mouseenter"],leave:["mouseleave"]},interest:{enter:["mouseenter","focusin"],leave:["mouseleave","focusout"]}},Re={click:ve.activate,hover:ve.interest};function Z(t){const e=ve[t];return(n,s,i,r,o)=>{const a=o?.allowA11yTriggers&&t in Re?Re[t]:e;j.add(n,s,i,{eventConfig:a},o??{})}}const P={viewEnter:An,hover:{add:Z("hover"),remove:j.remove},click:{add:Z("click"),remove:j.remove},animationEnd:hs,viewProgress:Yn,pointerMove:ls,activate:{add:Z("activate"),remove:j.remove},interest:{add:Z("interest"),remove:j.remove}};function As(t){return t.replace(/\[([-\w]+)]/g,"[]")}class b{static defineInteractElement;dataCache;addedInteractions;mediaQueryListeners;listInteractionsCache;controllers;static forceReducedMotion=!1;static allowA11yTriggers=!0;static instances=[];static controllerCache=new Map;static sequenceCache=new Map;static elementSequenceMap=new WeakMap;constructor(){this.dataCache={effects:{},sequences:{},conditions:{},interactions:{}},this.addedInteractions={},this.mediaQueryListeners=new Map,this.listInteractionsCache={},this.controllers=new Set}init(e,n){if(typeof window>"u"||!window.customElements)return;const s=n?.useCustomElement??!!b.defineInteractElement;this.dataCache=ks(e,s);const i=b.defineInteractElement?.();s&&i===!1?document.querySelectorAll("interact-element").forEach(r=>{r.connect()}):b.controllerCache.forEach((r,o)=>r.connect(o))}destroy(){for(const e of this.controllers)e.disconnect();for(const[,e]of this.mediaQueryListeners.entries())e.mql.removeEventListener("change",e.handler);this.mediaQueryListeners.clear(),this.addedInteractions={},this.listInteractionsCache={},this.controllers.clear(),this.dataCache={effects:{},sequences:{},conditions:{},interactions:{}},b.instances.splice(b.instances.indexOf(this),1)}setController(e,n){this.controllers.add(n),b.setController(e,n)}deleteController(e,n=!1){const s=b.controllerCache.get(e);this.clearInteractionStateForKey(e),this.clearMediaQueryListenersForKey(e),s&&n&&(this.controllers.delete(s),b.deleteController(e))}has(e){return!!this.get(e)}get(e){const n=As(e);return this.dataCache.interactions[n]}clearMediaQueryListenersForKey(e){for(const[n,s]of this.mediaQueryListeners.entries())s.key===e&&(s.mql.removeEventListener("change",s.handler),this.mediaQueryListeners.delete(n))}clearInteractionStateForKey(e){(this.get(e)?.interactionIds||[]).forEach(i=>{const r=$(i,e);delete this.addedInteractions[r]});const s=`${e}::seq::`;for(const i of b.sequenceCache.keys())i.startsWith(s)&&(b.sequenceCache.delete(i),delete this.addedInteractions[i])}setupMediaQueryListener(e,n,s,i){this.mediaQueryListeners.has(e)||(n.addEventListener("change",i),this.mediaQueryListeners.set(e,{mql:n,handler:i,key:s}))}static create(e,n){const s=new b;return b.instances.push(s),s.init(e,n),s}static destroy(){b.controllerCache.forEach(e=>{e.disconnect()}),b.instances.length=0,b.controllerCache.clear(),b.sequenceCache.clear(),b.elementSequenceMap=new WeakMap}static setup(e){e.scrollOptionsGetter&&P.viewProgress.registerOptionsGetter?.(e.scrollOptionsGetter),e.pointerOptionsGetter&&P.pointerMove.registerOptionsGetter?.(e.pointerOptionsGetter),e.viewEnter&&P.viewEnter.setOptions(e.viewEnter),e.allowA11yTriggers!==void 0&&(b.allowA11yTriggers=e.allowA11yTriggers)}static getInstance(e){const n=b.instances.find(s=>s.has(e));return n||console.warn(`Interact: Instance for key "${e}" not found`),n}static getController(e){const n=e?b.controllerCache.get(e):void 0;return n||console.warn(`Interact: Controller for key "${e}" not found`),n}static setController(e,n){b.controllerCache.set(e,n)}static deleteController(e){b.controllerCache.delete(e)}static registerEffects=Zt;static getSequence(e,n,s,i){const r=b.sequenceCache.get(e);if(r)return r;const o=ln(n,s,i);return b.sequenceCache.set(e,o),b._registerSequenceElements(s,o),o}static addToSequence(e,n,s,i){const r=b.sequenceCache.get(e);if(!r)return!1;const a=Ke(n,i).map((c,l)=>({index:s[l]??r.animationGroups.length,group:c}));return r.addGroups(a),b._registerSequenceElements(n,r),!0}static _registerSequenceElements(e,n){for(const{target:s}of e){const i=Array.isArray(s)?s:s instanceof HTMLElement?[s]:[];for(const r of i){let o=b.elementSequenceMap.get(r);o||(o=new Set,b.elementSequenceMap.set(r,o)),o.add(n)}}}static removeFromSequences(e){for(const n of e){const s=b.elementSequenceMap.get(n);if(s){for(const i of s)i.removeGroups(r=>r.animations.some(o=>o.effect?.target===n));b.elementSequenceMap.delete(n)}}}}let Cs=0;function x(t,{asCombinator:e=!1,addItemFilter:n=!1,useFirstChild:s=!1}={}){if(t.listContainer){const i=`${n&&t.listItemSelector?` > ${t.listItemSelector}`:""}`;return t.selector?`${t.listContainer}${i} ${t.selector}`:`${t.listContainer}${i||" > *"}`}else if(t.selector)return t.selector;return s?e?"> :first-child":":scope > :first-child":""}function Fe(t){return"sequenceId"in t&&!("effects"in t)}function le(t,e){return t[e]||(t[e]={triggers:[],effects:{},sequences:{},interactionIds:new Set,selectors:new Set}),t[e]}function ks(t,e=!1){const{effects:n={},sequences:s={},conditions:i={}}=t,r={};return t.interactions?.forEach(o=>{const a=o.key,c=++Cs,{effects:l,sequences:f,...u}=o;if(!a){console.error(`Interaction ${c} is missing a key for source element.`);return}le(r,a);const d=l?Array.from(l):[];d.reverse();const g=f?.map(h=>{if(Fe(h)){const y=s[h.sequenceId];return y?{...y,...h}:(console.warn(`Interact: Sequence "${h.sequenceId}" not found in config`),h)}const v=h;return v.sequenceId||(v.sequenceId=k()),v}),p={...u,effects:d.length>0?d:void 0,sequences:g};r[a].triggers.push(p),r[a].selectors.add(x(p,{useFirstChild:e}));const m=p.listContainer;d.forEach(h=>{let v=h.key;if(!v&&h.effectId){const S=n[h.effectId];S&&(v=S.key)}h.effectId||(h.effectId=k()),v=v||a,h.key=v;const y=h.effectId;if(m&&h.listContainer&&(v!==a||h.listContainer!==m))return;const E=`${a}::${v}::${y}::${c}`;if(h.interactionId=E,r[a].interactionIds.add(E),v===a)return;const w=le(r,v);w.effects[E]||(w.effects[E]=[],w.interactionIds.add(E)),w.effects[E].push({...u,effect:h}),w.selectors.add(x(h,{useFirstChild:e}))}),g?.forEach(h=>{if(!h||Fe(h))return;const v=h,y=v.sequenceId||k(),E=v.effects;for(const w of E){w.effectId||(w.effectId=k());let S=w.key;if(!S&&w.effectId){const I=n[w.effectId];I&&(S=I.key)}S=S||a;const T=x(w,{useFirstChild:e});if(T&&r[a].selectors.add(T),S!==a){const I=le(r,S),A=`${S}::seq::${y}::${c}`;I.sequences[A]||(I.sequences[A]=[],I.interactionIds.add(A)),I.sequences[A].push({...u,sequence:v}),I.selectors.add(T)}}})}),{effects:n,sequences:s,conditions:i,interactions:r}}function ye(t,e,n){if(t.listContainer){const s=e.querySelector(t.listContainer);return s?t.selector?Array.from(s.querySelectorAll(t.selector)):Array.from(s.children):(console.warn(`Interact: No container found for list container "${t.listContainer}"`),[])}if(t.selector){const s=e.querySelectorAll(t.selector);if(s.length>0)return Array.from(s);console.warn(`Interact: No elements found for selector "${t.selector}"`)}return n?e.firstElementChild:e}function Ee(t,e){return e.map(n=>t.selector?n.querySelector(t.selector):n).filter(Boolean)}function nt(t,e,n,s,i,r,o,a){return[o?Ee(t,o):ye(t,n,s),a?Ee(e,a):ye(e,i,r)]}function st(t,e,n,s,i,r,o,a){const c=Array.isArray(s),l=Array.isArray(i);c?s.forEach((f,u)=>{const d=l?i[u]:i;d&&Ne(t,f,e.trigger,d,n,e.params,r,o,a)}):(l?i:[i]).forEach(u=>{Ne(t,s,e.trigger,u,n,e.params,r,o,a)})}function it(t,e,n,s,i){const r={},o=[];(s.effects||[]).forEach(a=>{const c=a.effectId,l={...n.dataCache.effects[c]||{},...a,effectId:c},f=l.key,u=$(a.interactionId,t);if(r[u]||n.addedInteractions[u]&&!i)return;const d=_(l.conditions||[],n.dataCache.conditions);if(d&&n.setupMediaQueryListener(u,d,t,()=>{e.update()}),!d||d.matches){r[u]=!0;const g=f&&$(f,t);let p;if(g){if(p=b.getController(g),!p)return;l.listContainer&&p.watchChildList(l.listContainer)}else p=e;const[m,h]=nt(s,l,e.element,e.useFirstChild,p.element,p.useFirstChild,i);if(!m||!h)return;n.addedInteractions[u]=!0;const v=g||s.key,y=L(l.conditions||[],n.dataCache.conditions);o.push([v,s,l,m,h,y,p.useFirstChild,t])}}),o.reverse().forEach(a=>{st(...a)}),_s(t,e,n,s,i)}function $s(t){return"sequenceId"in t&&!("effects"in t)}function rt(t,e,n,s,i,r,o){const a=_(t.conditions||[],i.dataCache.conditions);if(a&&i.setupMediaQueryListener(e,a,r.updateKey,r.onUpdate),a&&!a.matches)return null;const c=t.effects||[],l=[];let f=!1;for(const u of c){const d=u.effectId,p={...d?i.dataCache.effects[d]||{}:{},...u},m=_(p.conditions||[],i.dataCache.conditions);if(m){const T=`${e}::${d||"eff"}`;i.setupMediaQueryListener(T,m,r.updateKey,r.onUpdate)}if(m&&!m.matches)continue;const h=p.key,v=h&&$(h,n);let y;if(v){if(y=b.getController(v),!y)return null}else y=s;const E=v||n;let w;if(o&&E===o.controllerKey&&p.listContainer===o.listContainer?(w=Ee(p,o.elements),w.length>0&&(f=!0)):w=ye(p,y.element,y.useFirstChild),!w||Array.isArray(w)&&w.length===0)return null;const S=q(p);l.push({target:w,options:S})}return o&&!f?null:l.length>0?l:null}function ot(t,e,n){const r=(t.useFirstChild?t.element.firstElementChild:t.element)?.querySelector(e);if(!r)return n.map((a,c)=>c);const o=Array.from(r.children);return n.map(a=>{const c=o.indexOf(a);return c>=0?c:o.length})}function _s(t,e,n,s,i){s.sequences?.forEach(r=>{let o;if($s(r)){const g=n.dataCache.sequences[r.sequenceId];if(!g){console.warn(`Interact: Sequence "${r.sequenceId}" not found in cache`);return}o={...g,...r}}else o=r;const a=o.sequenceId||k(),c=$(`${t}::seq::${a}`,t);if(n.addedInteractions[c]&&!i)return;const l=i&&s.listContainer?{controllerKey:t,listContainer:s.listContainer,elements:i}:void 0,f=rt(o,c,t,e,n,{updateKey:t,onUpdate:()=>e.update()},l);if(!f)return;if(i&&n.addedInteractions[c]){const g=ot(e,s.listContainer,i);b.addToSequence(c,f,g,{reducedMotion:b.forceReducedMotion});return}const u=b.getSequence(c,o,f,{reducedMotion:b.forceReducedMotion});n.addedInteractions[c]=!0;const d=L(s.conditions||[],n.dataCache.conditions);P[s.trigger]?.add(e.element,e.element,{triggerType:o.triggerType},s.params||{},{reducedMotion:b.forceReducedMotion,selectorCondition:d,animation:u,allowA11yTriggers:b.allowA11yTriggers})})}function qs(t,e,n,s,i){const r=n.get(t)?.sequences||{};Object.keys(r).forEach(a=>{r[a].some(({sequence:l,...f})=>{const u=_(f.conditions||[],n.dataCache.conditions);if(u&&!u.matches)return!1;const d=f.key&&$(f.key,t),g=b.getController(d);if(!g)return!0;const p=l.sequenceId||k(),m=$(`${d}::seq::${p}`,d);if(n.addedInteractions[m]&&!i)return!0;const v=rt(l,m,d,g,n,{updateKey:t,onUpdate:()=>e.update()},i&&s?{controllerKey:t,listContainer:s,elements:i}:void 0);if(!v)return!0;if(i&&n.addedInteractions[m]){const w=ot(e,s,i);return b.addToSequence(m,v,w,{reducedMotion:b.forceReducedMotion}),!0}const y=b.getSequence(m,l,v,{reducedMotion:b.forceReducedMotion});n.addedInteractions[m]=!0;const E=L(f.conditions||[],n.dataCache.conditions);return P[f.trigger]?.add(g.element,g.element,{triggerType:l.triggerType},f.params||{},{reducedMotion:b.forceReducedMotion,selectorCondition:E,animation:y,allowA11yTriggers:b.allowA11yTriggers}),!0})})}function at(t,e,n,s,i){const r=n.get(t),o=r?.effects||{},a=Object.keys(o),c=[];a.forEach(f=>{const u=$(f,t);if(n.addedInteractions[u]&&!i)return;o[f].some(({effect:g,...p})=>{const m=_(p.conditions||[],n.dataCache.conditions);if(m&&!m.matches)return!1;const h=g.effectId,v={...n.dataCache.effects[h]||{},...g,effectId:h};if(s&&v.listContainer!==s)return!1;const y=_(v.conditions||[],n.dataCache.conditions);if(y&&n.setupMediaQueryListener(u,y,t,()=>{e.update()}),!y||y.matches){const E=p.key&&$(p.key,t),w=b.getController(E);if(!w)return!0;v.listContainer&&e.watchChildList(v.listContainer);const[S,T]=nt(p,v,w.element,w.useFirstChild,e.element,e.useFirstChild,void 0,i);if(!S||!T)return!0;n.addedInteractions[u]=!0;const I=L(v.conditions||[],n.dataCache.conditions);return c.push([t,p,v,S,T,I,e.useFirstChild,E||void 0]),!0}return!1})}),c.reverse().forEach(f=>{st(...f)}),qs(t,e,n,s,i);const l=Object.keys(r?.sequences||{}).length>0;return a.length>0||l}function Ne(t,e,n,s,i,r,o,a,c){let l;if(i.transition||i.transitionProperties){const u={key:t,effectId:i.effectId,transition:i.transition,transitionProperties:i.transitionProperties,childSelector:x(i,{asCombinator:!0,addItemFilter:!0,useFirstChild:a}),selectorCondition:o};if(l=b.getController(t),!l)return;l.renderStyle(gn(u))}let f;if(n==="animationEnd"){const u=r.effectId,g=(c?b.getInstance(c):void 0)?.dataCache.effects[u];g&&(f=q(g))}P[n]?.add(e,s,i,r,{reducedMotion:b.forceReducedMotion,targetController:l,selectorCondition:o,allowA11yTriggers:b.allowA11yTriggers,sourceAnimationOptions:f})}function Ms(t){const e=t.key,n=b.getInstance(e);if(!n)return console.warn(`No instance found for key: ${e}`),b.setController(e,t),!1;const{triggers:s=[]}=n?.get(e)||{},i=s.length>0;n.setController(e,t),s.forEach((o,a)=>{const c=_(o.conditions,n.dataCache.conditions);if(c){const l=`${e}::trigger::${a}`;n.setupMediaQueryListener(l,c,e,()=>{t.update()})}(!c||c.matches)&&(o.listContainer&&t.watchChildList(o.listContainer),it(e,t,n,o))});let r=!1;return n&&(r=at(e,t,n)),i||r}function Ps(t,e,n){const s=t.key,i=b.getInstance(s);if(i){const{triggers:r=[]}=i?.get(s)||{};r.forEach((o,a)=>{if(o.listContainer!==e)return;const c=_(o.conditions,i.dataCache.conditions);if(c){const l=`${s}::listTrigger::${e}::${a}`;i.setupMediaQueryListener(l,c,s,()=>{t.update()})}(!c||c.matches)&&it(s,t,i,o,n)}),at(s,t,i,e,n)}}function xs(t,e=!1){const n=t.key,s=b.getInstance(n);if(!s)return;const i=[...s.get(n)?.selectors.values()||[]].filter(Boolean).join(",");let r;i?(r=[...t.element.querySelectorAll(i)],t.useFirstChild||r.push(t.element)):r=[t.element],ct(r),s.deleteController(n,e)}function ct(t){const e=Object.values(P);for(const n of t)for(const s of e)s.remove(n);b.removeFromSequences(t)}const ue="interactEffect";class ft{element;key;connected;sheet;useFirstChild;_observers;constructor(e,n,s){this.element=e,this.key=n,this.connected=!1,this.sheet=null,this._observers=new WeakMap,this.useFirstChild=s?.useFirstChild??!1}connect(e){if(this.connected)return;const n=this.element.dataset.interactKey;if(e=e||this.key||n,!e){console.warn("Interact: No key provided");return}n!==e&&(n&&console.warn(`Interact: Key mismatch between element ${n} and parameter ${e}, updating element key`),this.element.dataset.interactKey=e),this.key=e,this.connected=Ms(this)}disconnect({removeFromCache:e=!1}={}){if((this.key||this.element.dataset.interactKey)&&xs(this,e),this.sheet){const s=this.element?.getRootNode(),i=s.host?s:document;i.adoptedStyleSheets.indexOf(this.sheet)!==-1&&(i.adoptedStyleSheets=i.adoptedStyleSheets.filter(o=>o!==this.sheet))}this._observers=new WeakMap,this.sheet=null,this.connected=!1}update(){this.disconnect(),this.connect()}renderStyle(e){const n=this.element?.getRootNode(),s=n.host?n:document;if(!this.sheet)this.sheet=new CSSStyleSheet,this.sheet.replaceSync(e.join(`
8
- `)),s.adoptedStyleSheets=[...s.adoptedStyleSheets||[],this.sheet];else{let i=this.sheet.cssRules.length;for(const r of e)try{this.sheet.insertRule(r,i),i++}catch(o){console.error(o)}}}toggleEffect(e,n,s,i){if(s===null)return;if(!i&&this.element.toggleEffect){this.element.toggleEffect(e,n,s);return}const r=new Set(this.element.dataset[ue]?.split(" ")||[]);n==="toggle"?r.has(e)?r.delete(e):r.add(e):n==="add"?r.add(e):n==="remove"?r.delete(e):n==="clear"&&r.clear(),(s||this.element).dataset[ue]=Array.from(r).join(" ")}getActiveEffects(){const n=(this.element.dataset[ue]||"").trim();return n?n.split(/\s+/):[]}watchChildList(e){const n=this.element.querySelector(e);if(n){let s=this._observers.get(n);s||(s=new MutationObserver(this._childListChangeHandler.bind(this,e)),this._observers.set(n,s),s.observe(n,{childList:!0}))}}_childListChangeHandler(e,n){const s=this.key||this.element.dataset.interactKey,i=[],r=[];n.forEach(o=>{o.removedNodes.forEach(a=>{a instanceof HTMLElement&&i.push(a)}),o.addedNodes.forEach(a=>{a instanceof HTMLElement&&r.push(a)})}),ct(i),s&&Ps(this,e,r)}}function Ls(t,e){new ft(t,e).connect()}function Rs(t){const e=b.getController(t);e&&e.disconnect({removeFromCache:!0})}const lt=new Map([["viewEnter","once"],["animationEnd","once"],["hover","alternate"],["click","alternate"],["activate","alternate"],["interest","alternate"]]);function ut(t,e,n){const{effects:s={},conditions:i={}}=n,{key:r,trigger:o}=e,a=o==="pointerMove";t.effectId||(t.effectId=k());const{effectId:c}=t,l={...s[c]||{},...t};let{key:f,conditions:u,triggerType:d}=l;if(!f){if(!r)return null;f=r}if(dn(f))return null;u=[...new Set((u||[]).filter(w=>i[w]))],d||(d=lt.get(o));const{namedEffect:g,customEffect:p,keyframeEffect:m,transition:h,transitionProperties:v,...y}={...l,key:f,conditions:u,effectId:c,triggerType:d},E=yt(e,y);if(g)return a||!g.type?null:{namedEffect:g,initial:E,...y};if(m){if(!m.name){const w=c&&!(s[c]&&"keyframeEffect"in t);m.name=w?c:k()}return{keyframeEffect:m,initial:E,...y}}else return p?a?null:{initial:E,...y}:h?{transition:h,initial:E,...y}:v?{transitionProperties:v,initial:E,...y}:{initial:E,...y}}function Fs(t,e,n){const{sequences:s={},conditions:i={}}=n;t.sequenceId||(t.sequenceId=k());const{sequenceId:r}=t,o={...s[r]||{},...t};let{effects:a,conditions:c,triggerType:l,delay:f=0,offset:u=0,offsetEasing:d="linear"}=o;l||(l=lt.get(e.trigger)),c=[...new Set((c||[]).filter(m=>i[m]))];const g=a.map(m=>(m.conditions?m.conditions.push(...c):m.conditions=[...c],ut({...m,triggerType:l},e,n)));typeof d!="function"&&(d=be(d)||(m=>m)),pn(g,f,u,d);const p=g.filter(m=>m!==null);return p.length?{sequenceId:r,triggerType:l,conditions:c,delay:f,offset:u,offsetEasing:d,effects:p}:null}function Ns(t){return t==="cssFloat"?"float":t==="easing"?"animation-timing-function":t==="cssOffset"?"offset":t==="composite"?"animation-composition":t.replace(/([A-Z])/g,"-$1").toLowerCase()}function zs(t){if(!t.length)return[];const e=t.map(i=>({...i}));e[0].offset===void 0&&(e[0].offset=0),e.length===1?t[0].offset===void 0&&(e[0].offset=1):e[e.length-1].offset===void 0&&(e[e.length-1].offset=1);let n=0,s=e[0].offset;for(let i=1;i<e.length;i++)if(e[i].offset!==void 0){const r=e[i].offset;if(r<s)return console.error("Offsets must be monotonically non-decreasing"),[];if(r>1)return console.error("Offsets must be in the range [0,1]"),[];const o=i-n;for(let a=n+1;a<i;a++){const c=(a-n)/o;e[a].offset=s+(r-s)*c}n=i,s=r}return e}function Hs(t,e){const n=Object.entries(t).filter(([s,i])=>s!=="offset"&&i!==void 0&&i!==null).map(([s,i])=>`${Ns(s)}: ${i};`).join(`
9
- `);return`${e}% {
10
- ${n}
11
- }`}function js(t,e){const n=zs(e);if(!n.length)return"";let s=n.map(i=>{const r=i.offset,o=un(r*100);return Hs(i,o)}).join(`
12
- `);return`@keyframes ${t} {
13
- ${s}
14
- }`}function Ds(t){const{key:e,childSelector:n,declarations:s,media:i,states:r,selectorCondition:o,dataInteractEnterSelector:a}=t;if(!s.length)return"";let c=`[data-interact-key="${e}"]`;if(r&&r.length){const u=r.map(d=>`:state(${d}), :--${d}, [data-interact-effect~="${d}"]`).join(", ");c=`${c}:is(${u})`}n&&(c=`${c} ${n}`),a&&(c=`${c}${a}`),o&&(c=te(c,o));const l=s.map(({name:u,value:d})=>`${u}: ${d};`).join(`
15
- `),f=`${c} {
16
- ${l}
17
- }`;return i?`@media ${i} {
18
- ${f}
19
- }`:f}function dt(t,e,n,s){const{key:i,childSelector:r,properties:o}=t,a=Object.entries(o).filter(l=>l[1]&&l[1].varNames.length).map(([l,{fallback:f,varNames:u}])=>({name:l,value:u.map(d=>`var(${d}, ${f})`).join(", ")})),c={key:i,childSelector:r,declarations:a};return e&&c.declarations.forEach(l=>{l.name=e[l.name]}),n&&(c.media=ae(n,s||{},"media"),c.selectorCondition=L(n,s||{})),c}const Gs=[{name:"visibility",value:"hidden"},{name:"transform",value:"none"},{name:"translate",value:"none"},{name:"scale",value:"none"},{name:"rotate",value:"none"}],se=["animation","animation-composition","animation-timeline","animation-range"],we=["transition",...se],Ws={animation:"animation","animation-composition":"composition","animation-timeline":"animationTimeline","animation-range":"animationRange"},ie={animation:"none","animation-composition":"replace",transition:"_","animation-timeline":"auto","animation-range":"normal"};function ht(t,e,n){const s=t.get(e);s?n.forEach(i=>s.add(i)):t.set(e,new Set(n))}function mt(t,e,n,s){const{key:i,childSelector:r}=n,o=s?we.filter(c=>s.has(c)):we;t.has(e)||t.set(e,{key:i,childSelector:r,properties:{}});const{properties:a}=t.get(e);for(const c of o)a[c]||(a[c]={fallback:ie[c],varNames:[]}),a[c].varNames.push(n[c])}function pt(t,e){return we.reduce((n,s)=>(n[s]=hn([s,...t,e]),n),{})}function Vs(t,e,n,s,i){return s.has(t)||s.set(t,{key:e,childSelector:i,...pt([n],ze(t))}),s.get(t)}function Ys(t,e,n){return pt([e,n],ze(t))}function Bs(t,e,n,s=!0){const{key:i,conditions:r}=t,o=ae(r,e,"media"),a=L(r,e),c=x(t,{asCombinator:!0,useFirstChild:s,addItemFilter:!0});return{key:i,media:o,selectorCondition:a,childSelector:c,declarations:[{name:"view-timeline",value:`--${n}`}]}}function Ks(t,e,n,s,i){const{key:r,effectId:o,conditions:a,namedEffect:c,keyframeEffect:l,transition:f,transitionProperties:u,initial:d}=t,g=ae(a,e,"media"),p=L(a,e),m=[{key:r,media:g,selectorCondition:p,childSelector:i,declarations:[]}];let h=[];const{declarations:v}=m[0];let y=[];if(c||l){y=[...se];const E=q(t),w=on(null,E,s).filter(T=>T.name);h=w.map(T=>({name:T.name,keyframes:T.keyframes})),v.push(...w.flatMap(({custom:T})=>Object.entries(T||{}).filter(([I,A])=>A!==void 0).map(([I,A])=>({name:I,value:A}))));const S=se.map(T=>({name:n[T],value:w.map(I=>{const A=Ws[T];return I[A]}).join(", ")||ie[T]}));d?(m.push({key:r,media:g,selectorCondition:p,childSelector:i,declarations:Gs,dataInteractEnterSelector:":not([data-interact-enter])"}),m.push({key:r,media:g,selectorCondition:p,childSelector:i,declarations:S,dataInteractEnterSelector:':not([data-interact-enter="done"])'})):v.push(...S)}else if(f||u){y=["transition"];const E=f?.styleProperties||u||[],w=Qe(t);v.push({name:n.transition,value:w.join(", ")||ie.transition}),m.push({key:r,media:g,selectorCondition:p,childSelector:i,states:[o],declarations:E})}else v.push(...se.map(E=>({name:n[E],value:ie[E]})));return{rules:m.filter(E=>E.declarations.length),keyframes:h,usedProperties:y}}function gt(t,e,n,s,i,r,o=!0,a,c){const{key:l}=n,f=c??G(n),u=x(n,{asCombinator:!0,useFirstChild:o,addItemFilter:!0}),g={...Vs(f,l,e,s,u)};a&&Object.assign(g,a);const{rules:p,keyframes:m,usedProperties:h}=Ks(n,t,g,r,u);return m.forEach(({name:v,keyframes:y})=>i.set(v,y)),{rules:p,usedProperties:h}}function Qs(t,e,n,s,i,r,o=!0,a){const c=new Map,l=new Map,f=[];for(const d of n.effects){const g=G(d),{key:p}=d,m=x(d,{asCombinator:!0,useFirstChild:o,addItemFilter:!0}),h=l.get(g)||0;l.set(g,h+1);const v=Ys(g,e,h),{rules:y,usedProperties:E}=gt(t,e,d,s,i,r,o,v,g);f.push(...y);const w=new Set(E);mt(c,g,{key:p,childSelector:m,...v},w),a&&ht(a,g,E)}const{conditions:u}=n;return c.forEach((d,g)=>{const p=s.get(g);f.push(dt(d,p,u,t))}),f}function Us(t,e,n,s,i,r=!0){const{effects:o=[],sequences:a=[]}=e,c=t.conditions||{},l=new Map,f=new Map,u=o.map(h=>ut(h,e,t)).filter(h=>h!==null),d=[],{trigger:g}=e,p={trigger:mn(g),id:["trigger",n].join("-")};g==="viewProgress"&&d.push(Bs(e,c,p.id,r));for(const h of u){const v=G(h),{rules:y,usedProperties:E}=gt(c,n,h,l,i,p,r);d.push(...y),ht(f,v,E)}const m=a.map(h=>Fs(h,e,t)).filter(h=>h!==null);return d.push(...m.flatMap(h=>Qs(c,n,h,l,i,p,r,f))),l.forEach((h,v)=>{mt(s,v,h,f.get(v))}),d}function Xs(t,e=!0){const n=new Map,s=new Map,i=t.interactions.flatMap((r,o)=>Us(t,r,o,n,s,e));return n.forEach(r=>{i.push(dt(r))}),{keyframes:s,cssRules:i}}function Zs(t,e=!0){const{cssRules:n,keyframes:s}=Xs(t,e);return[...[...s.entries()].map(([r,o])=>js(r,o)),...n.map(Ds)].join(`
20
- `)}exports.I=ft;exports.a=b;exports.b=Ls;exports.g=Zs;exports.r=Rs;
21
- //# sourceMappingURL=index-D84f3ylM.js.map