svg-scroll-draw 2.23.3 → 2.23.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/README.md +10 -10
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +64 -59
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/chunk-6TWFLRUB.mjs +3 -0
- package/dist/{chunk-BLY6F6EC.mjs → chunk-DSFD227B.mjs} +1 -1
- package/dist/chunk-I73SOXBN.mjs +1 -0
- package/dist/chunk-NLPSVYFP.mjs +1 -0
- package/dist/chunk-OPXWNJBG.mjs +1 -0
- package/dist/chunk-QFSTKVA3.mjs +1 -0
- package/dist/chunk-XC5NR2MU.mjs +1 -0
- package/dist/{chunk-ETACBG7W.mjs → chunk-XTPAW6XR.mjs} +1 -1
- package/dist/{chunk-4I7MLTP5.mjs → chunk-ZNCZYV3Q.mjs} +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +10 -7
- package/dist/horizontal/index.d.ts +10 -7
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.mts +3 -1
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +9 -3
- package/dist/reveal/index.d.ts +9 -3
- package/dist/reveal/index.mjs +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +1 -1
- package/dist/timeline/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-23EALNDF.mjs +0 -3
- package/dist/chunk-4H2SGMAQ.mjs +0 -1
- package/dist/chunk-GMBIGV3M.mjs +0 -1
- package/dist/chunk-LGJQWZHH.mjs +0 -1
- package/dist/chunk-V4L3ELVC.mjs +0 -1
- package/dist/chunk-YZV4Z3EQ.mjs +0 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
| `scrollParallax` | `svg-scroll-draw` | Move any element at a different rate than scroll. Speed multiplier, reverse direction. |
|
|
33
33
|
| `scrollDraw` | `svg-scroll-draw` | The original — scroll-driven SVG path drawing via `stroke-dashoffset`. |
|
|
34
34
|
| `scrollVideo` | `svg-scroll-draw/video` | Tie `<video>.currentTime` to scroll. The Apple/Stripe product-page pattern. |
|
|
35
|
-
| `scrollText` | `svg-scroll-draw/text` | Split text into chars/words/lines and stagger-animate each on scroll. 3.
|
|
35
|
+
| `scrollText` | `svg-scroll-draw/text` | Split text into chars/words/lines and stagger-animate each on scroll. 3.5 KB, nothing else to load. |
|
|
36
36
|
| `devtools` | `svg-scroll-draw/devtools` | Visual overlay showing every active animation's triggers and progress. Dev-only. |
|
|
37
37
|
| `AOS` | `svg-scroll-draw/aos` | Drop-in replacement for AOS: same `AOS.init()`, same `data-aos` markup, no `aos.css`. |
|
|
38
38
|
| `ScrollReveal` | `svg-scroll-draw/scrollreveal` | Drop-in replacement for ScrollReveal.js 4, MIT instead of GPL-3.0. |
|
|
@@ -211,7 +211,7 @@ scrollVideo('#product-reveal', {
|
|
|
211
211
|
```tsx
|
|
212
212
|
import { ScrollVideo } from 'svg-scroll-draw/react';
|
|
213
213
|
|
|
214
|
-
<ScrollVideo src="/hero.mp4" trigger={{ start: 'top top', end: 'bottom top' }} />
|
|
214
|
+
<ScrollVideo src="/hero.mp4" poster="/hero.jpg" trigger={{ start: 'top top', end: 'bottom top' }} />
|
|
215
215
|
```
|
|
216
216
|
|
|
217
217
|
#### scrollVideo options
|
|
@@ -223,7 +223,7 @@ import { ScrollVideo } from 'svg-scroll-draw/react';
|
|
|
223
223
|
| `trigger` | `TriggerConfig` | `{ start: 'top top', end: 'bottom top' }` | — |
|
|
224
224
|
| `easing` | `string \| fn` | `"linear"` | — |
|
|
225
225
|
| `once` | `boolean` | `false` | — |
|
|
226
|
-
| `preload` | `"auto" \| "metadata"` | `"auto"` | Sets `preload` attribute if not already present |
|
|
226
|
+
| `preload` | `"auto" \| "metadata"` | `"auto"` | Sets `preload` attribute if not already present. The React `<ScrollVideo>` renders it from this option (2.23.4), and passes `poster` through to the `<video>` |
|
|
227
227
|
| `triggerElement` | `Element` | the video | Measure the trigger window from this element — the tall track behind a `position: sticky` stage, so a pinned film scrubs the length of the pin (2.18.0) |
|
|
228
228
|
| `onReady` | `() => void` | — | Fires when video metadata is loaded |
|
|
229
229
|
| `onProgress` | `(n: number) => void` | — | — |
|
|
@@ -233,7 +233,7 @@ import { ScrollVideo } from 'svg-scroll-draw/react';
|
|
|
233
233
|
|
|
234
234
|
## scrollText — text reveal on scroll
|
|
235
235
|
|
|
236
|
-
A
|
|
236
|
+
A 3.5 KB alternative to GSAP SplitText. SplitText is free and 3.6 KB, but it only splits — animating the pieces needs GSAP core (27.7 KB) on top.
|
|
237
237
|
|
|
238
238
|
```js
|
|
239
239
|
import { scrollText } from 'svg-scroll-draw/text';
|
|
@@ -437,7 +437,7 @@ Differences, on purpose:
|
|
|
437
437
|
On [ScrollReveal](https://scrollrevealjs.org)? It is GPL-3.0 (with a paid licence for commercial work)
|
|
438
438
|
and has not shipped since 4.0.9. `svg-scroll-draw/scrollreveal` is an independent, MIT-licensed
|
|
439
439
|
implementation of the same API, so the move is an import change — or one command: `npx svg-scroll-draw migrate`.
|
|
440
|
-
4.
|
|
440
|
+
4.7 KB gzipped, against 5.6 KB.
|
|
441
441
|
|
|
442
442
|
```diff
|
|
443
443
|
- import ScrollReveal from 'scrollreveal';
|
|
@@ -635,15 +635,15 @@ devtools.highlight('#my-element'); // outline for 2 seconds
|
|
|
635
635
|
| Entry | Gzipped |
|
|
636
636
|
|---|---|
|
|
637
637
|
| `svg-scroll-draw` (main, every core API) | 11.6 KB |
|
|
638
|
-
| `svg-scroll-draw/react` (includes the engine) | 13.
|
|
639
|
-
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.
|
|
640
|
-
| `svg-scroll-draw/reveal` | 5.
|
|
641
|
-
| `svg-scroll-draw/text` | 3.
|
|
638
|
+
| `svg-scroll-draw/react` (includes the engine) | 13.2 KB |
|
|
639
|
+
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.8 KB |
|
|
640
|
+
| `svg-scroll-draw/reveal` | 5.7 KB |
|
|
641
|
+
| `svg-scroll-draw/text` | 3.5 KB |
|
|
642
642
|
| `svg-scroll-draw/video` | 2.8 KB |
|
|
643
643
|
| `svg-scroll-draw/scrollreveal` | 4.7 KB |
|
|
644
644
|
| `svg-scroll-draw/vivus` | 4.2 KB |
|
|
645
645
|
| `svg-scroll-draw/aos` (styles included) | 3.2 KB |
|
|
646
|
-
| `svg-scroll-draw/snap` |
|
|
646
|
+
| `svg-scroll-draw/snap` | 2.0 KB |
|
|
647
647
|
| `svg-scroll-draw/devtools` | 1.8 KB (dev only) |
|
|
648
648
|
| `svg-scroll-draw/pin` | 1.6 KB |
|
|
649
649
|
<!-- size-table:end -->
|
package/dist/angular/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${f?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(r),window.addEventListener("scroll",s,{passive:true}),s(),{el:r,destroy(){window.removeEventListener("scroll",s),r.remove();}}}var _t=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Wt=/[MmLlHhVvCcSsQqTtAaZz]/g;function $n(e,n,t){if(!Xe)return;let r=(e.match(Wt)??[]).join("").toUpperCase(),s=(n.match(Wt)??[]).join("").toUpperCase(),i=(e.match(_t)??[]).length,l=(n.match(_t)??[]).length;if(r!==s){pe(`morphTo: command sequence differs (${r||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==l&&pe(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function kn(e,n,t){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),m=r[s++]??l;return String(+(l+(m-l)*t).toFixed(4))})}function qt(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:We(n,(t,r)=>On(e,t,r))}function On(e,n,t){let{preset:r,...s}=n,i=r?{...Ft[r],...s}:s,{selector:l="path, polyline, line, polygon, rect, circle",speed:m=1,fade:f=false,easing:d="linear",trigger:v={},stagger:I=0,direction:E="forward",once:Z=false,debug:re=false,axis:M="y",scrollContainer:oe,autoReverse:he=false,delay:P=0,strokeColor:C,strokeWidth:L,fillOpacity:A,waypoints:b,velocityScale:y=false,threshold:w=0,rootMargin:Y="0px",repeat:_=0,repeatDelay:X=0,morphTo:F,clip:D,autoplay:ce=false,duration:ye=1e3,native:te=true,onProgress:G,onStart:p,onComplete:u,onEnter:T,onLeave:ue,onEnterBack:me,onLeaveBack:Pe}=i,H=D===true?"left":typeof D=="string"?D:false,J=typeof d=="function"?d:ne[d]??ne.linear,$=fe(v.start||"top bottom"),k=fe(v.end||"bottom top"),W=typeof oe=="string"?document.querySelector(oe):oe??null,ve=Array.isArray(C)?C[0]:null,Ee=Array.isArray(C)?C[1]:typeof C=="string"?C:null,Ce=Array.isArray(L)?L[0]:null,$e=Array.isArray(L)?L[1]:typeof L=="number"?L:null,Se=Array.isArray(A)?A[0]:null,Ne=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function ke(o){let a=o*100;switch(H){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let q=H?[]:Array.from(e.querySelectorAll(l)),N=[],de=[],ge=0,c=0,g=I,Fe=0,O=false,z=false,x=0,V=false,xe=-1,Me=[],Je=-1,se=false,Oe=0,Re=0,ze,ut=null;function wt(){ut?.destroy(),ut=null;}let Ve=new Set,vt=NaN,_e=true,et=-1,Et=performance.now(),Be=NaN;function Qe(){return W?M==="x"?W.scrollLeft:W.scrollTop:M==="x"?window.scrollX:window.scrollY}function St(){return W?M==="x"?W.clientWidth:W.clientHeight:M==="x"?window.innerWidth:window.innerHeight}function Tt(){let o=ot(e,W,M);return Te(o,o.scroll,St(),$,k)}function fn(){let o=c-ge,a=q.length-1,h=W??document.documentElement,j=M==="x"?"Width":"Height";if(g=I,I>0&&a>0&&o>0){let be=h[`scroll${j}`]-h[`client${j}`]-1-ge-o/m;be>=0&&(g=Math.min(I,be/(a*o)));}Fe=c+a*g*o;}function xt(){(({tStart:ge,tEnd:c}=Tt())),fn(),re&&Xe&&(wt(),ut=Cn(ge,c,M));}function mt(o,a=Tt){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let h=o.destroy;return o.destroy=()=>{h.call(o),Ae(e);},o}function Mt(o,a){return Z&&!he?Math.max(xe,J(Me[o]=Math.max(Me[o]??0,a))):J(a)}function pn(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),H){let h=a==="reverse"?1-o:o;e.style.clipPath=ke(h);return}q.forEach((h,j)=>ft(h,j,o,a));}function ft(o,a,h,j){o.style.strokeDashoffset=j==="reverse"?`${N[a]*h}`:`${N[a]*(1-h)}`,f&&(o.style.opacity=j==="reverse"?`${1-h}`:`${h}`),ve&&Ee?o.style.stroke=st(ve,Ee,h):Ee&&(o.style.stroke=Ee),Ce!==null&&$e!==null?o.style.strokeWidth=`${Ce+($e-Ce)*h}`:$e!==null&&(o.style.strokeWidth=`${$e}`),Se!==null&&Ne!==null?o.style.fillOpacity=`${Se+(Ne-Se)*h}`:Ne!==null&&(o.style.fillOpacity=`${Ne}`),F&&o.tagName.toLowerCase()==="path"&&de[a]&&o.setAttribute("d",kn(de[a],F,h));}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),H){e.style.clipPath=ke(E==="reverse"?1:0);return}q.forEach((o,a)=>{o.style.strokeDasharray=`${N[a]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${N[a]}`,f?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Ce!==null&&(o.style.strokeWidth=`${Ce}`),Se!==null&&(o.style.fillOpacity=`${Se}`),F&&o.tagName.toLowerCase()==="path"&&de[a]&&o.setAttribute("d",de[a]);});}if(q.forEach(o=>{Pn(o);let a=je(o);N.push(a);let h=o.tagName.toLowerCase()==="path";h?de.push(o.getAttribute("d")??""):de.push(""),F&&(h?$n(de[de.length-1],F,o):pe(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?`${a}`:"0",f&&(o.style.opacity="1"),Ee&&(o.style.stroke=Ee),$e!==null&&(o.style.strokeWidth=`${$e}`),Ne!==null&&(o.style.fillOpacity=`${Ne}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?"0":`${a}`,f?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Ce!==null&&(o.style.strokeWidth=`${Ce}`),Se!==null&&(o.style.fillOpacity=`${Se}`));}),t)return H&&(e.style.clipPath=ke(1)),u?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};H&&(e.style.clipPath=ke(E==="reverse"?1:0));let Lt=typeof d=="string"?it(d):null;function dn(){return !(te===false||ce||re||!An()||!q.length||!Lt||H||M!=="y"||W||m!==1||I!==0||Z||he||y!==false||F||b||_||P>0||G||p||u||T||ue||me||Pe||C!=null||L!=null||A!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function gn(){let o=++Ln,a=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,j=`--svg-scroll-draw-${o}`,be=E==="reverse"?"0":"var(--ssd-len)",De=E==="reverse"?"var(--ssd-len)":"0",we=`stroke-dashoffset:${be};`,B=`stroke-dashoffset:${De};`;f&&(we+=`opacity:${E==="reverse"?1:0};`,B+=`opacity:${E==="reverse"?0:1};`);let Q=document.createElement("style");Q.setAttribute("data-svg-scroll-draw",""),Q.textContent=`@keyframes ${a}{from{${we}}to{${B}}}.${h}{view-timeline-name:${j};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Lt};animation-fill-mode:both;animation-timeline:${j};animation-range:cover 0% cover 100%;}`,document.head.appendChild(Q),e.classList.add(h);function ie(S,R){S.style.setProperty("--ssd-len",String(N[R])),S.style.strokeDasharray=`${N[R]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(a);}q.forEach(ie);let ae=false,U=-1;function K(){if(U>=0)return U;let S=e.getBoundingClientRect(),{tStart:R,tEnd:le}=Te({top:S.top,height:S.height},Qe(),St(),$,k);return J(ee(Qe(),R,le,m))}return {destroy(){e.classList.remove(h),q.forEach(S=>{S.classList.remove(a),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),Q.remove();},replay(){ae=false,U=-1,q.forEach(ie);},pause(){ae=true,q.forEach(S=>{S.style.animationPlayState="paused";});},resume(){ae&&(ae=false,q.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let R=Math.min(1,Math.max(0,S));U=R,ae=true,q.forEach((le,He)=>{le.classList.remove(a),le.style.strokeDashoffset=E==="reverse"?`${N[He]*R}`:`${N[He]*(1-R)}`,f&&(le.style.opacity=E==="reverse"?`${1-R}`:`${R}`);});},getProgress(){return K()},refresh(){q.forEach((S,R)=>{N[R]=je(S),S.style.setProperty("--ssd-len",String(N[R])),S.style.strokeDasharray=`${N[R]}`;});}}}if(dn())return mt(gn());function hn(){let o=Math.max(1,ye),a=H?o:o*(1+Math.max(0,q.length-1)*I),h=0,j=0,be=false;function De(U){let K=true,S=Math.min(1,Math.max(0,U/a));if(H){let R=Math.min(1,Math.max(0,U/o)),le=J(R);Oe=le,e.style.setProperty("--scroll-draw-progress",String(le)),e.style.clipPath=ke(E==="reverse"?1-le:le),G?.(le),R<1&&(K=false);}else {q.forEach((le,He)=>{let bn=He*I*o,Ct=Math.min(1,Math.max(0,(U-bn)/o));ft(le,He,J(Ct),E),Ct<1&&(K=false);});let R=J(S);Oe=R,G?.(R),e.style.setProperty("--scroll-draw-progress",String(R));}if(b){let R=J(S);for(let le in b){let He=parseFloat(le);R>=He&&!Ve.has(He)&&(Ve.add(He),b[le]?.());}}return K}function we(U){if(se)return;let K=U-h;z||(z=true,p?.());let S=De(K);if(S&&!O){O=true,De(a),u?.(),Re<(_==="infinite"?1/0:_??0)&&(Re++,ze=setTimeout(()=>{h=performance.now(),z=false,O=false,Ve.clear(),Ue(),x=requestAnimationFrame(we);},X));return}S||(x=requestAnimationFrame(we));}function B(){cancelAnimationFrame(x),clearTimeout(ze),h=performance.now(),j=0,se=false,z=false,O=false,Re=0,be=true,Oe=0,Ve.clear(),Ue(),x=requestAnimationFrame(we);}let Q=new IntersectionObserver(U=>{U.forEach(K=>{K.isIntersecting&&!(Z&&O)?B():!K.isIntersecting&&!Z&&!O&&(cancelAnimationFrame(x),clearTimeout(ze),be=false);});},{root:W??null,threshold:w,rootMargin:Y}),ie;function ae(){clearTimeout(ie),ie=setTimeout(()=>{q.forEach((U,K)=>{N[K]=je(U),U.style.strokeDasharray=`${N[K]}`;});},150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),P>0?setTimeout(()=>Q.observe(e),P):Q.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(ze),Q.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ie);},replay(){Re=0,B();},pause(){se||!be||(se=true,j=performance.now()-h,cancelAnimationFrame(x));},resume(){se&&(se=false,be=true,h=performance.now()-j,x=requestAnimationFrame(we));},seek(U){let K=Math.min(1,Math.max(0,U));Oe=K,se=true,j=K*a,h=performance.now()-j,cancelAnimationFrame(x),De(j);},getProgress(){return Oe},refresh(){clearTimeout(ie),q.forEach((U,K)=>{N[K]=je(U),U.style.strokeDasharray=`${N[K]}`;});}}}if(ce)return mt(hn());xt();function At(){if(se||!Ge)return;let o=performance.now(),a=Qe();if(!_e&&y===false&&a===vt){dt(a);return}_e=false,vt=a;let h=m;if(y!==false){let B=o-Et,Q=B>0?Math.abs(a-(et<0?a:et))/B:0;h=m*Math.max(.2,1+Q*(typeof y=="number"?y:1)*.04);}et=a,Et=o;let j=he?Je===-1||a>=Je?"forward":"reverse":E;Je=a;let be=c-ge,De=true,we=be===0?0:(a-ge)/be;if(isNaN(Be)||(Be<=0&&we>0?T?.():Be>0&&we<=0&&Pe?.(),Be<1&&we>=1?ue?.():Be>=1&&we<1&&me?.()),Be=we,H){let B=Mt(0,ee(a,ge,c,h));Oe=B,e.style.setProperty("--scroll-draw-progress",String(B));let Q=j==="reverse"?1-B:B;e.style.clipPath=ke(Q),G?.(B),!z&&ee(a,ge,c,h)>0&&(z=true,p?.()),B>=1&&!O?(O=true,u?.(),Re<(_==="infinite"?1/0:_??0)&&(Re++,ze=setTimeout(()=>{xe=-1,Me=[],z=false,O=false,Ue();},X))):B<1&&!Z&&(O=false),dt(a);return}if(q.forEach((B,Q)=>{let ie=Q*g*be,ae=Mt(Q,ee(a,ge+ie,c+ie,h));ft(B,Q,ae,j),Q===0&&(Oe=ae,G?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),ae<1&&(De=false);}),b){let B=J(ee(a,ge,c,h));for(let Q in b){let ie=parseFloat(Q);B>=ie&&!Ve.has(ie)&&(Ve.add(ie),b[Q]?.());}}!z&&ee(a,ge,c,h)>0&&(z=true,p?.()),De&&!O?(O=true,u?.(),Re<(_==="infinite"?1/0:_??0)&&(Re++,ze=setTimeout(()=>{xe=-1,Me=[],z=false,O=false,Ve.clear(),Ue(),_e=true;},X))):!De&&!Z&&(O=false),dt(a);}function pt(o){return o>=c&&o<Fe}function dt(o){V||pt(o)?x=requestAnimationFrame(At):Ge=false;}function gt(){return V||pt(Qe())}let Ge=false;function tt(){Ge||(Ge=true,x=requestAnimationFrame(function(){At();}));}function nt(){Ge=false,cancelAnimationFrame(x);}let ht=new IntersectionObserver(o=>{o.forEach(a=>{V=a.isIntersecting,V&&!se?(_e=true,tt()):Ge&&!se&&pt(Qe())||nt();});},{root:W??null,threshold:w,rootMargin:Y});function Pt(){q.forEach((o,a)=>{N[a]=je(o),o.style.strokeDasharray=`${N[a]}`;}),xt(),_e=true;}let rt;function Ye(){clearTimeout(rt),rt=setTimeout(Pt,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let yn=Ie([e],Ye);return P>0?setTimeout(()=>ht.observe(e),P):ht.observe(e),mt({destroy(){cancelAnimationFrame(x),clearTimeout(ze),nt(),ht.disconnect(),yn(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(rt),wt();},replay(){xe=-1,Me=[],Je=-1,et=-1,z=false,O=false,Re=0,se=false,Oe=0,Ve.clear(),clearTimeout(ze),Ue(),_e=true,gt()&&tt();},pause(){se=true,nt();},resume(){se&&(se=false,_e=true,gt()&&tt());},seek(o){let a=Math.min(1,Math.max(0,o));Oe=a,xe=a,Me=[],se=true,nt(),pn(a,E),_e=true;},getProgress(){return Oe},refresh(){clearTimeout(rt),Pt(),gt()&&!se&&tt();}},()=>({tStart:ge,tEnd:c}))}var Bt=new WeakMap,In=0;function yt(e){return JSON.stringify(e,(n,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let r=Bt.get(t);return r===void 0&&Bt.set(t,r=++In),`el#${r}`}return t})}function Gt(e,n){let t={...e};for(let r of Object.keys(t))typeof t[r]=="function"&&(t[r]=(...s)=>n()[r]?.(...s));return t}function Fn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function jt(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let s=[],i=[],l=r[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let f=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}n.push({fn:r[1],nums:s,units:i});}return n}function Rn(e,n,t){let r=jt(e),s=jt(n);return r.length===0||r.length!==s.length?t<1?e:n:r.map((i,l)=>{let m=s[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((f,d)=>`${f}${i.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((f,d)=>`${f}${m.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,d)=>`${f+(m.nums[d]-f)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function Qt(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),s=String(n);if(Fn(r))return st(r,s,t);if(r.includes("("))return Rn(r,s,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),f=parseFloat(l[1]);return `${m+(f-m)*t}${i[2]||l[2]}`}return t<1?r:s}function Dn(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Hn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Nn=0,Ut="--scroll-draw-progress";function zn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Xt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Kt(e,n){return typeof window>"u"?Xt:n.respectReducedMotion===false?Yt(e,n,false):We(n,(t,r)=>Yt(e,t,r))}function Yt(e,n,t){let{props:r,trigger:s={},easing:i="ease-out",speed:l=1,once:m=false,axis:f="y",scrollContainer:d,native:v=true,velocityScale:I=false,triggerElement:E,onProgress:Z,onComplete:re,onEnter:M,onLeave:oe,onEnterBack:he,onLeaveBack:P}=n,C=typeof i=="function"?i:ne[i]??ne["ease-out"],L=fe(s.start||"top bottom"),A=fe(s.end||"bottom top"),b=E??e,y=typeof d=="string"?document.querySelector(d):d??null,w=Object.entries(r).map(([c,g])=>({prop:Dn(c),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function Y(){let c=window.getComputedStyle(e);for(let g of w)g.from===""&&(g.from=c.getPropertyValue(g.prop).trim()||"0");}function _(){for(let c of w)e.style.setProperty(c.prop,String(c.to));}let X=new Map;for(let c of [...w.map(g=>g.prop),Ut])X.set(c,e.style.getPropertyValue(c));function F(){for(let[c,g]of X)g?e.style.setProperty(c,g):e.style.removeProperty(c);}if(t)return _(),re?.(),{...Xt,destroy:F,getProgress:()=>1};Y();let D=()=>y?f==="x"?y.scrollLeft:y.scrollTop:f==="x"?window.scrollX:window.scrollY,ce=()=>y?f==="x"?y.clientWidth:y.clientHeight:f==="x"?window.innerWidth:window.innerHeight,ye=typeof i=="string"?it(i):null;function te(){if(!v||!zn()||!ye||f!=="y"||y||b!==e||m||l!==1||Z||re||M||oe||he||P||I!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let c of w)if(!Hn.has(c.prop))return false;return true}function G(){let c=`ssd-a-${++Nn}`,g=w.map(V=>`${V.prop}:${V.from}`).join(";"),Fe=w.map(V=>`${V.prop}:${V.to}`).join(";"),O=document.createElement("style");O.setAttribute("data-ssd-animate",""),O.textContent=`@keyframes ${c}{from{${g}}to{${Fe}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${ye};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(c);let z=()=>{let V=e.getBoundingClientRect();return Te({top:V.top,height:V.height},D(),ce(),L,A)};Le(e,{type:"animate",getProgress:()=>x.getProgress(),getTrigger:z});let x={refresh(){},destroy(){e.classList.remove(c),O.remove(),e.style.animationPlayState="",F(),Ae(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(V){let xe=Math.min(1,Math.max(0,V));e.classList.remove(c);for(let Me of w)e.style.setProperty(Me.prop,Qt(Me.from,Me.to,xe));},getProgress(){let{tStart:V,tEnd:xe}=z();return C(ee(D(),V,xe,l))}};return x}if(te())return G();let p=0,u=0,T=0,ue=false,me=false,Pe=-1,H=0,J=0,$=false,k=NaN,W=-1,ve=0,Ee=b===e?w:[],Ce=false;function $e(){let c=e.style,g=Ee.map(x=>c.getPropertyValue(x.prop)),Fe=c.transition;Ee.length&&(c.transition="none"),Ee.forEach(x=>c.setProperty(x.prop,X.get(x.prop)??""));let O=ot(b,y,f);Ee.forEach((x,V)=>c.setProperty(x.prop,g[V])),Ee.length&&(e.offsetWidth,c.transition=Fe);let z=Te(O,O.scroll,ce(),L,A);Ce&&Math.abs(z.tStart-p)<1&&Math.abs(z.tEnd-u)<1||(Ce=true,p=z.tStart,u=z.tEnd);}function Se(c){e.style.setProperty(Ut,String(c));for(let g of w)e.style.setProperty(g.prop,Qt(g.from,g.to,c));Z?.(c);}function Ne(c){if(isNaN(k)){k=c;return}k<=0&&c>0?M?.():k>0&&c<=0&&P?.(),k<1&&c>=1?oe?.():k>=1&&c<1&&he?.(),k=c;}function ke(){if(!ue||me)return;let c=performance.now(),g=D(),Fe=l;if(I!==false){let V=c-ve,xe=V>0?Math.abs(g-(W<0?g:W))/V:0;Fe=l*Math.max(.2,1+xe*(typeof I=="number"?I:1)*.04);}W=g,ve=c;let O=u===p?0:(g-p)/(u-p);Ne(O);let z=ee(g,p,u,Fe),x=m?Math.max(Pe,C(H=Math.max(H,z))):C(z);J=x,Se(x),x>=1&&!$?($=true,re?.()):x<1&&!m&&($=false),T=requestAnimationFrame(ke);}$e(),u===p&&pe("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),H=ee(D(),p,u,l),J=C(H),Se(J);let q=new IntersectionObserver(c=>{c.forEach(g=>{ue=g.isIntersecting,ue&&!me?T=requestAnimationFrame(ke):cancelAnimationFrame(T);});},{root:y??null}),N;function de(){clearTimeout(N),N=setTimeout($e,150);}window.addEventListener("resize",de),window.addEventListener("orientationchange",de);let ge=Ie([b],de);return q.observe(e),Le(e,{type:"animate",getProgress:()=>J,getTrigger:()=>({tStart:p,tEnd:u})}),{destroy(){cancelAnimationFrame(T),q.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),ge(),clearTimeout(N),F(),Ae(e);},replay(){Pe=-1,H=0,$=false,J=0,me=false,Se(0);},pause(){me=true,cancelAnimationFrame(T);},resume(){me&&(me=false,ue&&(T=requestAnimationFrame(ke)));},seek(c){let g=Math.min(1,Math.max(0,c));J=g,Pe=g,H=0,me=true,cancelAnimationFrame(T),Se(g);},getProgress(){return J},refresh(){$e();}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Zt(e,n){if(typeof window>"u")return bt;let t=typeof e=="string"?document.querySelector(e):e;return t?We(n,(r,s)=>Vn(t,r,s)):(pe("scrollCounter: element not found:",e),bt)}function Vn(e,n,t){let{from:r=0,to:s,format:i,easing:l="ease-out",trigger:m={},once:f=true,decimals:d,onComplete:v}=n,I=d!==void 0?p=>p.toFixed(d):i??(p=>String(Math.round(p))),E=typeof l=="function"?l:ne[l]??ne["ease-out"],Z=fe(m.start||"top 80%"),re=fe(m.end||"top 20%");if(t)return e.textContent=I(s),v?.(),{...bt,getProgress:()=>1};let M=0,oe=0,he=false,P=0,C=false,L=false,A=-1,b=0,y=0,w=false,Y=()=>window.scrollY,_=()=>window.innerHeight;function X(){let p=e.getBoundingClientRect(),u=Te({top:p.top,height:p.height},Y(),_(),Z,re);he&&Math.abs(u.tStart-M)<1&&Math.abs(u.tEnd-oe)<1||(he=true,M=u.tStart,oe=u.tEnd);}function F(p){e.textContent=I(r+(s-r)*p),e.style.setProperty("--scroll-draw-progress",String(p));}function D(){if(!C||L)return;let p=ee(Y(),M,oe,1),u=f?Math.max(A,E(b=Math.max(b,p))):E(p);y=u,F(u),u>=1&&!w?(w=true,v?.()):u<1&&!f&&(w=false),P=requestAnimationFrame(D);}X();{b=ee(Y(),M,oe,1);let p=E(b);y=p,F(p);}let ce=new IntersectionObserver(p=>{p.forEach(u=>{C=u.isIntersecting,C&&!L?P=requestAnimationFrame(D):cancelAnimationFrame(P);});}),ye;function te(){clearTimeout(ye),ye=setTimeout(X,150);}window.addEventListener("resize",te),window.addEventListener("orientationchange",te);let G=Ie([e],te);return ce.observe(e),Le(e,{type:"counter",getProgress:()=>y,getTrigger:()=>({tStart:M,tEnd:oe})}),{destroy(){cancelAnimationFrame(P),ce.disconnect(),window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),G(),clearTimeout(ye),Ae(e);},replay(){A=-1,b=0,w=false,y=0,L=false,F(0);},pause(){L=true,cancelAnimationFrame(P);},resume(){L&&(L=false,C&&(P=requestAnimationFrame(D)));},seek(p){let u=Math.min(1,Math.max(0,p));y=u,A=u,b=0,L=true,cancelAnimationFrame(P),F(u);},getProgress(){return y}}}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function en(e,n={}){if(typeof window>"u")return Jt;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return pe("scrollVideo: <video> element not found:",e),Jt;let r=t,{trigger:s={},easing:i="linear",once:l=false,axis:m="y",preload:f="auto",triggerElement:d,onReady:v,onComplete:I,onProgress:E}=n,Z=d??r,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof i=="function"?i:ne[i]??ne.linear,oe=fe(s.start||"top top"),he=fe(s.end||"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=f);let P=n.from??0,C=n.to,L=0,A=0,b=0,y=false,w=false,Y=-1,_=0,X=0,F=false,D=false,ce=()=>m==="x"?window.scrollX:window.scrollY,ye=()=>m==="x"?window.innerWidth:window.innerHeight;function te(){let $=Z.getBoundingClientRect(),k=m==="x"?$.left:$.top,W=m==="x"?$.width:$.height,ve=Te({top:k,height:W},ce(),ye(),oe,he);L=ve.tStart,A=ve.tEnd,D&&A===L&&pe("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let G=NaN;function p($){if(!D)return;let k=C??r.duration??0,W=P+(k-P)*$;W!==G&&(G=W,r.currentTime=W),r.style.setProperty("--scroll-draw-progress",String($)),E?.($);}function u(){if(!y||w||!D||re)return;let $=ee(ce(),L,A,1),k=l?Math.max(Y,M(_=Math.max(_,$))):M($);X=k,p(k),k>=1&&!F?(F=true,I?.()):k<1&&!l&&(F=false),b=requestAnimationFrame(u);}function T(){if(D=true,C===void 0&&(C=r.duration),re){p(1),v?.();return}te(),v?.(),y&&!w&&(b=requestAnimationFrame(u));}r.readyState>=1?T():r.addEventListener("loadedmetadata",T,{once:true}),D||te();let ue=re?()=>{}:ct($=>{$&&(ue(),re=true,cancelAnimationFrame(b),p(1));}),me=new IntersectionObserver($=>{$.forEach(k=>{y=k.isIntersecting,y&&!w&&D?b=requestAnimationFrame(u):cancelAnimationFrame(b);});}),Pe;function H(){clearTimeout(Pe),Pe=setTimeout(te,150);}window.addEventListener("resize",H),window.addEventListener("orientationchange",H);let J=Ie([Z],H);return me.observe(r),Le(r,{type:"video",getProgress:()=>X,getTrigger:()=>({tStart:L,tEnd:A})}),{destroy(){cancelAnimationFrame(b),me.disconnect(),r.removeEventListener("loadedmetadata",T),window.removeEventListener("resize",H),window.removeEventListener("orientationchange",H),J(),ue(),clearTimeout(Pe),Ae(r);},replay(){Y=-1,_=0,F=false,X=0,w=false,G=NaN,p(0);},pause(){w=true,cancelAnimationFrame(b);},resume(){w&&(w=false,y&&D&&(b=requestAnimationFrame(u)));},seek($){let k=Math.min(1,Math.max(0,$));X=k,Y=k,_=0,w=true,cancelAnimationFrame(b),G=NaN,p(k);},getProgress(){return X}}}function tn(e,n){let t=document.createElement("span");t.textContent=n,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function on(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(r.textContent=t,r.style.whiteSpace="pre"):(r.textContent=t,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(t)?null:r}).filter(t=>t!==null)}function _n(e){let n=e.textContent??"";return e.textContent="",n.split("").map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=t,t===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),t===" "?null:r}).filter(t=>t!==null)}function nn(e){let n=on(e),t=new Map;for(let i of n){let l=i.offsetTop;t.has(l)||t.set(l,[]),t.get(l).push(i);}let r=[],s=Array.from(t.keys()).sort((i,l)=>i-l);for(let i of s){let l=t.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",l.forEach((f,d)=>{let v=f.nextElementSibling;m.appendChild(f),d<l.length-1&&v&&v.style.whiteSpace==="pre"&&m.appendChild(v);}),r.push(m);}return e.textContent="",r.forEach((i,l)=>{e.appendChild(i),l<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Wn(e,n,t,r){if(t<=1||r===0)return e;let s=(t-1)*r,i=n*r,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function qn(e,n){let t=[];if(n?.y!==void 0&&t.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&t.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&t.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let r=n.scale+(1-n.scale)*e;t.push(`scale(${r})`);}return t.join(" ")||""}var rn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function sn(e,n={}){if(typeof window>"u")return rn;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return pe("scrollText: element not found:",e),rn;let r=t;return We(n,(s,i)=>Bn(r,s,i))}function Bn(e,n,t){let{split:r="words",stagger:s=.04,easing:i="ease-out",from:l={opacity:0,y:24},trigger:m={},once:f=true,onComplete:d}=n,v=typeof i=="function"?i:ne[i]??ne["ease-out"],I=fe(m.start||"top 85%"),E=fe(m.end||"top 40%"),Z=e.innerHTML,re=e.textContent??"",M;r==="chars"?M=_n(e):r==="lines"?M=nn(e):M=on(e),tn(e,re);let oe=M.length;function he(u,T){l?.opacity!==void 0&&(u.style.opacity=String(l.opacity+(1-l.opacity)*T));let ue=qn(T,l);ue&&(u.style.transform=ue);}function P(u){e.style.setProperty("--scroll-draw-progress",String(u)),M.forEach((T,ue)=>{let me=v(Wn(u,ue,oe,s));he(T,me);});}if(t)return P(1),d?.(),{destroy(){e.innerHTML=Z;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P(0);let C=0,L=0,A=0,b=false,y=false,w=-1,Y=0,_=false,X=()=>window.scrollY,F=()=>window.innerHeight;function D(){let u=e.getBoundingClientRect(),T=Te({top:u.top,height:u.height},X(),F(),I,E);C=T.tStart,L=T.tEnd;}function ce(){if(!b||y)return;let u=ee(X(),C,L,1);f&&(w=Math.max(w,u),u=w),Y=u,P(u),u>=1&&!_?(_=true,d?.()):u<1&&!f&&(_=false),A=requestAnimationFrame(ce);}D();let ye=new IntersectionObserver(u=>{u.forEach(T=>{b=T.isIntersecting,b&&!y?A=requestAnimationFrame(ce):cancelAnimationFrame(A);});}),te;function G(){clearTimeout(te),te=setTimeout(()=>{if(r==="lines"){let u=Y;e.innerHTML=Z,M=nn(e),tn(e,re),P(u);}D();},150);}window.addEventListener("resize",G),window.addEventListener("orientationchange",G);let p=Ie([e],G);return ye.observe(e),Le(e,{type:"text",getProgress:()=>Y,getTrigger:()=>({tStart:C,tEnd:L})}),{destroy(){cancelAnimationFrame(A),ye.disconnect(),window.removeEventListener("resize",G),window.removeEventListener("orientationchange",G),p(),clearTimeout(te),e.innerHTML=Z,Ae(e);},replay(){w=-1,_=false,Y=0,y=false,P(0);},pause(){y=true,cancelAnimationFrame(A);},resume(){y&&(y=false,b&&(A=requestAnimationFrame(ce)));},seek(u){let T=Math.min(1,Math.max(0,u));Y=T,w=T,y=true,cancelAnimationFrame(A),P(T);},getProgress(){return Y}}}var qe=class{constructor(n){this.create=n;this.instance=null;this.el=null;this.key="";}init(n,t){return this.destroy(),this.el=n,this.latest=t,this.key=yt(t),this.instance=this.create(n,Gt(t,()=>this.latest)),this}update(n){return this.el?yt(n)!==this.key?this.init(this.el,n):(this.latest=n,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(n){return this.instance?.seek(n),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},an=class extends qe{constructor(){super(qt);}init(n,t={}){return super.init(n,t)}},ln=class extends qe{constructor(){super(Kt);}},cn=class extends qe{constructor(){super(Zt);}},un=class extends qe{constructor(){super(en);}init(n,t={}){return super.init(n,t)}},mn=class extends qe{constructor(){super(sn);}init(n,t={}){return super.init(n,t)}};exports.EngineRef=qe;exports.ScrollAnimateRef=ln;exports.ScrollCounterRef=cn;exports.ScrollDrawRef=an;exports.ScrollTextRef=mn;exports.ScrollVideoRef=un;
|
|
1
|
+
'use strict';function En({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),s=Math.sqrt(r),i=0,a=[];for(let h=0;h<t;h++){let E=Math.pow(s,h);a.push(E),i+=E;}let m=[0],p=0;for(let h=0;h<t;h++)p+=a[h]/i,m.push(p);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let E=0;E<t;E++)if(h<=m[E+1]){let H=(h-m[E])/(m[E+1]-m[E]);if(E===0)return H*(2-H);let S=1-Math.pow(r,E);return S+(1-S)*(2*H-1)*(2*H-1)}return 1}}function Sn({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),s=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/r)+1}var ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:En(),elastic:Sn()};function It(e,n,t){return Math.min(t,Math.max(n,e))}function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function Rt(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function Ft(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function U(e,n,t,r){return t===n?0:It((e-n)/(t-n)*r,0,1)}function Le(e,n,t,r,s){let i=Rt(e.top,e.height,n,r.element)-Ft(r.viewport,t),a=Rt(e.top,e.height,n,s.element)-Ft(s.viewport,t);return {tStart:i,tEnd:a}}function ot(e,n,t){let r=e.getBoundingClientRect(),s=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left-n.clientLeft+n.scrollLeft:r.top-n.getBoundingClientRect().top-n.clientTop+n.scrollTop,height:s,scroll:0}:{top:t==="x"?r.left:r.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function st(e){let n=parseFloat(e.getAttribute("pathLength")??"");if(n>0)return n;let t=e.tagName.toLowerCase();if(t==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(r+s)}if(t==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Ht(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function it(e,n,t){let r=Ht(e),s=Ht(n);return !r||!s?e:`rgb(${Math.round(r[0]+(s[0]-r[0])*t)},${Math.round(r[1]+(s[1]-r[1])*t)},${Math.round(r[2]+(s[2]-r[2])*t)})`}var Nt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ge(e,...n){je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Tn="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",xn="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Dt=33;function Mn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ln(e){let n=[];for(let t=0;t<Dt;t++){let r=t/(Dt-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function at(e){switch(e){case "linear":return "linear";case "ease-in":return Tn;case "ease-out":return xn;case "ease-in-out":return Mn()?Ln(ee["ease-in-out"]):null;default:return null}}var Vt=Symbol.for("svg-scroll-draw.registry");function zt(){let e=globalThis;return e[Vt]||(e[Vt]=new Map)}function Pe(e,n){zt().set(e,n);}function Ce(e){zt().delete(e);}var Ke,lt=new Set,ct=new WeakMap,Ze=new Map,_t=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function An(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function Oe(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();Ke??(Ke=new ResizeObserver(s=>{let i=false;for(let{target:a}of s)ct.get(a)!==_t(a)&&(i=true),ct.set(a,"");i&<.forEach(a=>a());})),lt.add(t);let r=An(e);return [document.body,document.documentElement].forEach(s=>s&&r.add(s)),r.forEach(s=>{ct.has(s)||ct.set(s,_t(s)),Ze.set(s,(Ze.get(s)??0)+1),Ke.observe(s);}),()=>{lt.delete(t)&&(r.forEach(s=>{let i=(Ze.get(s)??1)-1;if(i)return void Ze.set(s,i);Ze.delete(s),Ke?.unobserve(s);}),lt.size||(Ke?.disconnect(),Ke=void 0));}}function ut(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}function _e(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=ut(i=>{if(!i)return;r();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=n(a?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...a)=>t[i]?.(...a);return s.destroy=()=>{r(),t.destroy();},s}var Pn=0;function Cn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Wt(e,n){let t="";try{t=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return t||(e.getAttribute(n)??"").trim()}var qt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function $n(e){if(!je)return;let n=Wt(e,"stroke");if(!n||n==="none"){ge("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!qt.has(t)&&!qt.has(Wt(e,"fill"))&&ge("Element has a fill \u2014 it may obscure the stroke animation.",e);}function kn(e,n,t){let r=document.createElement("div");r.setAttribute("data-svg-scroll-draw-debug",""),r.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=t==="x"?window.scrollX:window.scrollY,a=e-i,m=n-i,p=t==="x";r.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${p?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${p?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(r),window.addEventListener("scroll",s,{passive:true}),s(),{el:r,destroy(){window.removeEventListener("scroll",s),r.remove();}}}var Bt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Gt=/[MmLlHhVvCcSsQqTtAaZz]/g;function On(e,n,t){if(!je)return;let r=(e.match(Gt)??[]).join("").toUpperCase(),s=(n.match(Gt)??[]).join("").toUpperCase(),i=(e.match(Bt)??[]).length,a=(n.match(Bt)??[]).length;if(r!==s){ge(`morphTo: command sequence differs (${r||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==a&&ge(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function In(e,n,t){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),m=r[s++]??a;return String(+(a+(m-a)*t).toFixed(4))})}function jt(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:_e(n,(t,r)=>Rn(e,t,r))}function Rn(e,n,t){let{preset:r,...s}=n,i=r?{...Nt[r],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:p=false,easing:h="linear",trigger:E={},stagger:H=0,direction:S="forward",once:Y=false,debug:te=false,axis:L="y",scrollContainer:ne,autoReverse:we=false,delay:C=0,strokeColor:I,strokeWidth:$,fillOpacity:A,waypoints:b,velocityScale:y=false,threshold:v=0,rootMargin:G="0px",repeat:_=0,repeatDelay:q=0,morphTo:D,clip:R,autoplay:re=false,duration:Te=1e3,native:ce=true,onProgress:N,onStart:k,onComplete:O,onEnter:u,onLeave:d,onEnterBack:X,onLeaveBack:xe}=i,V=R===true?"left":typeof R=="string"?R:false,K=typeof h=="function"?h:ee[h]??ee.linear,$e=de(E.start||"top bottom"),x=de(E.end||"bottom top"),T=typeof ne=="string"?document.querySelector(ne):ne??null,ue=Array.isArray(I)?I[0]:null,me=Array.isArray(I)?I[1]:typeof I=="string"?I:null,ke=Array.isArray($)?$[0]:null,Ie=Array.isArray($)?$[1]:typeof $=="number"?$:null,Me=Array.isArray(A)?A[0]:null,Ne=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function Re(o){let l=o*100;switch(V){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let F=V?[]:Array.from(e.querySelectorAll(a)),he=[],ve=[],oe=0,Z=0,We=H,Je=0,j=false,c=false,f=0,Ae=false,fe=-1,J=[],Q=-1,w=false,se=0,ye=0,De,ft=null;function St(){ft?.destroy(),ft=null;}let Ve=new Set,Tt=NaN,ze=true,et=-1,xt=performance.now(),Be=NaN;function Qe(){return T?L==="x"?T.scrollLeft:T.scrollTop:L==="x"?window.scrollX:window.scrollY}function Mt(){return T?L==="x"?T.clientWidth:T.clientHeight:L==="x"?window.innerWidth:window.innerHeight}function Lt(){let o=ot(e,T,L);return Le(o,o.scroll,Mt(),$e,x)}function dn(){let o=Z-oe,l=F.length-1,g=T??document.documentElement,P=L==="x"?"Width":"Height";if(We=H,H>0&&l>0&&o>0){let pe=g[`scroll${P}`]-g[`client${P}`]-1-oe-o/m;pe>=0&&(We=Math.min(H,pe/(l*o)));}Je=Z+l*We*o;}function At(){(({tStart:oe,tEnd:Z}=Lt())),dn(),te&&je&&(St(),ft=kn(oe,Z,L));}function pt(o,l=Lt){Pe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let g=o.destroy;return o.destroy=()=>{g.call(o),Ce(e);},o}function Pt(o,l){return Y&&!we?Math.max(fe,K(J[o]=Math.max(J[o]??0,l))):K(l)}function gn(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),V){let g=l==="reverse"?1-o:o;e.style.clipPath=Re(g);return}F.forEach((g,P)=>dt(g,P,o,l));}function dt(o,l,g,P){o.style.strokeDashoffset=P==="reverse"?`${he[l]*g}`:`${he[l]*(1-g)}`,p&&(o.style.opacity=P==="reverse"?`${1-g}`:`${g}`),ue&&me?o.style.stroke=it(ue,me,g):me&&(o.style.stroke=me),ke!==null&&Ie!==null?o.style.strokeWidth=`${ke+(Ie-ke)*g}`:Ie!==null&&(o.style.strokeWidth=`${Ie}`),Me!==null&&Ne!==null?o.style.fillOpacity=`${Me+(Ne-Me)*g}`:Ne!==null&&(o.style.fillOpacity=`${Ne}`),D&&o.tagName.toLowerCase()==="path"&&ve[l]&&o.setAttribute("d",In(ve[l],D,g));}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),V){e.style.clipPath=Re(S==="reverse"?1:0);return}F.forEach((o,l)=>{o.style.strokeDasharray=`${he[l]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${he[l]}`,p?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),ke!==null&&(o.style.strokeWidth=`${ke}`),Me!==null&&(o.style.fillOpacity=`${Me}`),D&&o.tagName.toLowerCase()==="path"&&ve[l]&&o.setAttribute("d",ve[l]);});}function Ye(o,l){let g=o.getAttribute("d"),P=st(o);if(D&&ve[l]){o.setAttribute("d",D);let pe=st(o);o.setAttribute("d",ve[l]),P=Math.max(st(o),pe),o.setAttribute("d",g);}he[l]=P,o.style.strokeDasharray=`${P}`;}if(F.forEach((o,l)=>{$n(o);let g=o.tagName.toLowerCase()==="path";g?ve.push(o.getAttribute("d")??""):ve.push(""),Ye(o,l);let P=he[l];D&&(g?On(ve[ve.length-1],D,o):ge(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=S==="reverse"?`${P}`:"0",p&&(o.style.opacity="1"),me&&(o.style.stroke=me),Ie!==null&&(o.style.strokeWidth=`${Ie}`),Ne!==null&&(o.style.fillOpacity=`${Ne}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDashoffset=S==="reverse"?"0":`${P}`,p?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),ke!==null&&(o.style.strokeWidth=`${ke}`),Me!==null&&(o.style.fillOpacity=`${Me}`));}),t)return V&&(e.style.clipPath=Re(1)),O?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};V&&(e.style.clipPath=Re(S==="reverse"?1:0));let Ct=typeof h=="string"?at(h):null;function hn(){return !(ce===false||re||te&&je||!Cn()||!F.length||!Ct||V||L!=="y"||T||m!==1||H!==0||Y||we||y!==false||D||b||_||C>0||N||k||O||u||d||X||xe||I!=null||$!=null||A!=null||(E.start||"top bottom").trim()!=="top bottom"||(E.end||"bottom top").trim()!=="bottom top")}function yn(){let o=++Pn,l=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,P=`--svg-scroll-draw-${o}`,pe=S==="reverse"?"0":"var(--ssd-len)",Fe=S==="reverse"?"var(--ssd-len)":"0",Ee=`stroke-dashoffset:${pe};`,W=`stroke-dashoffset:${Fe};`;p&&(Ee+=`opacity:${S==="reverse"?1:0};`,W+=`opacity:${S==="reverse"?0:1};`);let B=document.createElement("style");B.setAttribute("data-svg-scroll-draw",""),B.textContent=`@keyframes ${l}{from{${Ee}}to{${W}}}.${g}{view-timeline-name:${P};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${P};animation-range:cover 0% cover 100%;}`,document.head.appendChild(B),e.classList.add(g);function ie(M,z){M.style.setProperty("--ssd-len",String(he[z])),M.style.strokeDasharray=`${he[z]}`,M.style.strokeDashoffset="",M.style.opacity="",M.style.animationPlayState="",M.classList.add(l);}F.forEach(ie);let ae=false,be=-1;function Se(){if(be>=0)return be;let M=e.getBoundingClientRect(),{tStart:z,tEnd:le}=Le({top:M.top,height:M.height},Qe(),Mt(),$e,x);return K(U(Qe(),z,le,m))}return {destroy(){e.classList.remove(g),F.forEach(M=>{M.classList.remove(l),M.style.removeProperty("--ssd-len"),M.style.animationPlayState="";}),B.remove();},replay(){ae=false,be=-1,F.forEach(ie);},pause(){ae=true,F.forEach(M=>{M.style.animationPlayState="paused";});},resume(){ae&&(ae=false,F.forEach(M=>{M.style.animationPlayState="running";}));},seek(M){let z=Math.min(1,Math.max(0,M));be=z,ae=true,F.forEach((le,He)=>{le.classList.remove(l),le.style.strokeDashoffset=S==="reverse"?`${he[He]*z}`:`${he[He]*(1-z)}`,p&&(le.style.opacity=S==="reverse"?`${1-z}`:`${z}`);});},getProgress(){return Se()},refresh(){F.forEach((M,z)=>{Ye(M,z),M.style.setProperty("--ssd-len",String(he[z]));});}}}if(hn())return pt(yn());function bn(){let o=Math.max(1,Te),l=V?o:o*(1+Math.max(0,F.length-1)*H),g=0,P=0,pe=false;function Fe(be){let Se=true,M=Math.min(1,Math.max(0,be/l));if(V){let z=Math.min(1,Math.max(0,be/o)),le=K(z);se=le,e.style.setProperty("--scroll-draw-progress",String(le)),e.style.clipPath=Re(S==="reverse"?1-le:le),N?.(le),z<1&&(Se=false);}else {F.forEach((le,He)=>{let vn=He*H*o,Ot=Math.min(1,Math.max(0,(be-vn)/o));dt(le,He,K(Ot),S),Ot<1&&(Se=false);});let z=K(M);se=z,N?.(z),e.style.setProperty("--scroll-draw-progress",String(z));}if(b){let z=K(M);for(let le in b){let He=parseFloat(le);z>=He&&!Ve.has(He)&&(Ve.add(He),b[le]?.());}}return Se}function Ee(be){if(w)return;let Se=be-g;c||(c=true,k?.());let M=Fe(Se);if(M&&!j){j=true,Fe(l),O?.(),ye<(_==="infinite"?1/0:_??0)&&(ye++,De=setTimeout(()=>{g=performance.now(),c=false,j=false,Ve.clear(),Ue(),f=requestAnimationFrame(Ee);},q));return}M||(f=requestAnimationFrame(Ee));}function W(){cancelAnimationFrame(f),clearTimeout(De),g=performance.now(),P=0,w=false,c=false,j=false,ye=0,pe=true,se=0,Ve.clear(),Ue(),f=requestAnimationFrame(Ee);}let B=new IntersectionObserver(be=>{be.forEach(Se=>{Se.isIntersecting&&!(Y&&j)?W():!Se.isIntersecting&&!Y&&!j&&(cancelAnimationFrame(f),clearTimeout(De),pe=false);});},{root:T??null,threshold:v,rootMargin:G}),ie;function ae(){clearTimeout(ie),ie=setTimeout(()=>F.forEach(Ye),150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),C>0?setTimeout(()=>B.observe(e),C):B.observe(e),{destroy(){cancelAnimationFrame(f),clearTimeout(De),B.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ie);},replay(){ye=0,W();},pause(){w||!pe||(w=true,P=performance.now()-g,cancelAnimationFrame(f));},resume(){w&&(w=false,pe=true,g=performance.now()-P,f=requestAnimationFrame(Ee));},seek(be){let Se=Math.min(1,Math.max(0,be));se=Se,w=true,P=Se*l,g=performance.now()-P,cancelAnimationFrame(f),Fe(P);},getProgress(){return se},refresh(){clearTimeout(ie),F.forEach(Ye);}}}if(re)return pt(bn());At();function $t(){if(w||!Ge)return;let o=performance.now(),l=Qe();if(!ze&&y===false&&l===Tt){ht(l);return}ze=false,Tt=l;let g=m;if(y!==false){let W=o-xt,B=W>0?Math.abs(l-(et<0?l:et))/W:0;g=m*Math.max(.2,1+B*(typeof y=="number"?y:1)*.04);}et=l,xt=o;let P=we?Q===-1||l>=Q?"forward":"reverse":S;Q=l;let pe=Z-oe,Fe=true,Ee=pe===0?0:(l-oe)/pe;if(isNaN(Be)||(Be<=0&&Ee>0?u?.():Be>0&&Ee<=0&&xe?.(),Be<1&&Ee>=1?d?.():Be>=1&&Ee<1&&X?.()),Be=Ee,V){let W=Pt(0,U(l,oe,Z,g));se=W,e.style.setProperty("--scroll-draw-progress",String(W));let B=P==="reverse"?1-W:W;e.style.clipPath=Re(B),N?.(W),!c&&U(l,oe,Z,g)>0&&(c=true,k?.()),W>=1&&!j?(j=true,O?.(),ye<(_==="infinite"?1/0:_??0)&&(ye++,De=setTimeout(()=>{fe=-1,J=[],c=false,j=false,Ue();},q))):W<1&&!Y&&(j=false),ht(l);return}if(F.forEach((W,B)=>{let ie=B*We*pe,ae=Pt(B,U(l,oe+ie,Z+ie,g));dt(W,B,ae,P),B===0&&(se=ae,N?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),ae<1&&(Fe=false);}),b){let W=K(U(l,oe,Z,g));for(let B in b){let ie=parseFloat(B);W>=ie&&!Ve.has(ie)&&(Ve.add(ie),b[B]?.());}}!c&&U(l,oe,Z,g)>0&&(c=true,k?.()),Fe&&!j?(j=true,O?.(),ye<(_==="infinite"?1/0:_??0)&&(ye++,De=setTimeout(()=>{fe=-1,J=[],c=false,j=false,Ve.clear(),Ue(),ze=true;},q))):!Fe&&!Y&&(j=false),ht(l);}function gt(o){return o>=Z&&o<Je}function ht(o){Ae||gt(o)?f=requestAnimationFrame($t):Ge=false;}function yt(){return Ae||gt(Qe())}let Ge=false;function tt(){Ge||(Ge=true,f=requestAnimationFrame(function(){$t();}));}function nt(){Ge=false,cancelAnimationFrame(f);}let bt=new IntersectionObserver(o=>{o.forEach(l=>{Ae=l.isIntersecting,Ae&&!w?(ze=true,tt()):Ge&&!w&>(Qe())||nt();});},{root:T??null,threshold:v,rootMargin:G});function kt(){F.forEach(Ye),At(),ze=true;}let rt;function Xe(){clearTimeout(rt),rt=setTimeout(kt,150);}window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe);let wn=Oe([e],Xe);return C>0?setTimeout(()=>bt.observe(e),C):bt.observe(e),pt({destroy(){cancelAnimationFrame(f),clearTimeout(De),nt(),bt.disconnect(),wn(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(rt),St();},replay(){fe=-1,J=[],Q=-1,et=-1,c=false,j=false,ye=0,w=false,se=0,Ve.clear(),clearTimeout(De),Ue(),ze=true,yt()&&tt();},pause(){w=true,nt();},resume(){w&&(w=false,ze=true,yt()&&tt());},seek(o){let l=Math.min(1,Math.max(0,o));se=l,fe=l,J=[],w=true,nt(),gn(l,S),ze=true;},getProgress(){return se},refresh(){clearTimeout(rt),kt(),yt()&&!w&&tt();}},()=>({tStart:oe,tEnd:Z}))}var Qt=new WeakMap,Fn=0;function wt(e){return JSON.stringify(e,(n,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let r=Qt.get(t);return r===void 0&&Qt.set(t,r=++Fn),`el#${r}`}return t})}function Ut(e,n){let t={...e};for(let r of Object.keys(t))typeof t[r]=="function"&&(t[r]=(...s)=>n()[r]?.(...s));return t}function Hn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Yt(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let s=[],i=[],a=r[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let p=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(p?parseFloat(p[1]):0),i.push(p?p[2]:"");}n.push({fn:r[1],nums:s,units:i});}return n}function Nn(e,n,t){let r=Yt(e),s=Yt(n);return r.length===0||r.length!==s.length?t<1?e:n:r.map((i,a)=>{let m=s[a];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((p,h)=>`${p}${i.units[h]}`).join(", ")})`:`${m.fn}(${m.nums.map((p,h)=>`${p}${m.units[h]}`).join(", ")})`:`${i.fn}(${i.nums.map((p,h)=>`${p+(m.nums[h]-p)*t}${i.units[h]}`).join(", ")})`}).join(" ")}function Xt(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),s=String(n);if(Hn(r))return it(r,s,t);if(r.includes("("))return Nn(r,s,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let m=parseFloat(i[1]),p=parseFloat(a[1]);return `${m+(p-m)*t}${i[2]||a[2]}`}return t<1?r:s}function Dn(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Vn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),zn=0,Kt="--scroll-draw-progress";function _n(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function en(e,n){return typeof window>"u"?Jt:n.respectReducedMotion===false?Zt(e,n,false):_e(n,(t,r)=>Zt(e,t,r))}function Zt(e,n,t){let{props:r,trigger:s={},easing:i="ease-out",speed:a=1,once:m=false,axis:p="y",scrollContainer:h,native:E=true,velocityScale:H=false,triggerElement:S,onProgress:Y,onComplete:te,onEnter:L,onLeave:ne,onEnterBack:we,onLeaveBack:C}=n,I=typeof i=="function"?i:ee[i]??ee["ease-out"],$=de(s.start||"top bottom"),A=de(s.end||"bottom top"),b=S??e,y=typeof h=="string"?document.querySelector(h):h??null,v=Object.entries(r).map(([c,f])=>({prop:Dn(c),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function G(){let c=window.getComputedStyle(e);for(let f of v)f.from===""&&(f.from=c.getPropertyValue(f.prop).trim()||"0");}function _(){for(let c of v)e.style.setProperty(c.prop,String(c.to));}let q=new Map;for(let c of [...v.map(f=>f.prop),Kt])q.set(c,e.style.getPropertyValue(c));function D(){for(let[c,f]of q)f?e.style.setProperty(c,f):e.style.removeProperty(c);}if(t)return _(),te?.(),{...Jt,destroy:D,getProgress:()=>1};G();let R=()=>y?p==="x"?y.scrollLeft:y.scrollTop:p==="x"?window.scrollX:window.scrollY,re=()=>y?p==="x"?y.clientWidth:y.clientHeight:p==="x"?window.innerWidth:window.innerHeight,Te=typeof i=="string"?at(i):null;function ce(){if(!E||!_n()||!Te||p!=="y"||y||b!==e||m||a!==1||Y||te||L||ne||we||C||H!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let c of v)if(!Vn.has(c.prop))return false;return true}function N(){let c=`ssd-a-${++zn}`,f=v.map(w=>`${w.prop}:${w.from}`).join(";"),Ae=v.map(w=>`${w.prop}:${w.to}`).join(";"),fe=document.createElement("style");fe.setAttribute("data-ssd-animate",""),fe.textContent=`@keyframes ${c}{from{${f}}to{${Ae}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Te};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(fe),e.classList.add(c);let J=()=>{let w=e.getBoundingClientRect();return Le({top:w.top,height:w.height},R(),re(),$,A)};Pe(e,{type:"animate",getProgress:()=>Q.getProgress(),getTrigger:J});let Q={refresh(){},destroy(){e.classList.remove(c),fe.remove(),e.style.animationPlayState="",D(),Ce(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(w){let se=Math.min(1,Math.max(0,w));e.classList.remove(c);for(let ye of v)e.style.setProperty(ye.prop,Xt(ye.from,ye.to,se));},getProgress(){let{tStart:w,tEnd:se}=J();return I(U(R(),w,se,a))}};return Q}if(ce())return N();let k=0,O=0,u=0,d=NaN,X=false,xe=-1,V=0,K=0,$e=false,x=NaN,T=-1,ue=0,me=b===e?v:[],ke=false;function Ie(){let c=e.style,f=me.map(Q=>c.getPropertyValue(Q.prop)),Ae=c.transition;me.length&&(c.transition="none"),me.forEach(Q=>c.setProperty(Q.prop,q.get(Q.prop)??""));let fe=ot(b,y,p);me.forEach((Q,w)=>c.setProperty(Q.prop,f[w])),me.length&&(e.offsetWidth,c.transition=Ae);let J=Le(fe,fe.scroll,re(),$,A);ke&&Math.abs(J.tStart-k)<1&&Math.abs(J.tEnd-O)<1||(ke=true,k=J.tStart,O=J.tEnd);}function Me(c){e.style.setProperty(Kt,String(c));for(let f of v)e.style.setProperty(f.prop,Xt(f.from,f.to,c));Y?.(c);}function Ne(c){if(isNaN(x)){x=c;return}x<=0&&c>0?L?.():x>0&&c<=0&&C?.(),x<1&&c>=1?ne?.():x>=1&&c<1&&we?.(),x=c;}let Re=c=>U(c,k,O,Math.min(a,1));function F(){!u&&!X&&Re(R())!==d&&(u=requestAnimationFrame(he));}function he(){if(X)return;let c=performance.now(),f=R(),Ae=a;if(H!==false){let w=c-ue,se=w>0?Math.abs(f-(T<0?f:T))/w:0;Ae=a*Math.max(.2,1+se*(typeof H=="number"?H:1)*.04);}T=f,ue=c;let fe=O===k?0:(f-k)/(O-k);Ne(fe);let J=U(f,k,O,Ae),Q=m?Math.max(xe,I(V=Math.max(V,J))):I(J);K=Q,Me(Q),Q>=1&&!$e?($e=true,te?.()):Q<1&&!m&&($e=false),!X&&(d=Re(f),u=d>0&&d<1?requestAnimationFrame(he):0);}Ie(),O===k&&ge("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),V=U(R(),k,O,a),K=I(V),Me(K);function ve(){Ie(),F();}let oe;function Z(){clearTimeout(oe),oe=setTimeout(ve,150);}let We=y??window;We.addEventListener("scroll",F,{passive:true}),window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z);let Je=Oe([b],Z);F(),Pe(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:k,tEnd:O})});function j(){X=true,cancelAnimationFrame(u),u=0,d=NaN;}return {destroy(){j(),We.removeEventListener("scroll",F),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),Je(),clearTimeout(oe),D(),Ce(e);},replay(){xe=-1,V=0,$e=false,K=0,X=false,Me(0),d=0,F();},pause:j,resume(){X&&(X=false,F());},seek(c){let f=Math.min(1,Math.max(0,c));K=f,xe=f,V=0,j(),Me(f);},getProgress(){return K},refresh:ve}}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tn(e,n){if(typeof window>"u")return vt;let t=typeof e=="string"?document.querySelector(e):e;return t?_e(n,(r,s)=>Wn(t,r,s)):(ge("scrollCounter: element not found:",e),vt)}function Wn(e,n,t){let{from:r=0,to:s,format:i,easing:a="ease-out",trigger:m={},once:p=true,decimals:h,onComplete:E}=n,H=h!==void 0?u=>u.toFixed(h):i??(u=>String(Math.round(u))),S=typeof a=="function"?a:ee[a]??ee["ease-out"],Y=de(m.start||"top 80%"),te=de(m.end||"top 20%");if(t)return e.textContent=H(s),E?.(),{...vt,getProgress:()=>1};let L=0,ne=0,we=false,C=0,I=false,$=false,A=-1,b=0,y=0,v=false,G=()=>window.scrollY,_=()=>window.innerHeight;function q(){let u=e.getBoundingClientRect(),d=Le({top:u.top,height:u.height},G(),_(),Y,te);we&&Math.abs(d.tStart-L)<1&&Math.abs(d.tEnd-ne)<1||(we=true,L=d.tStart,ne=d.tEnd);}let D=e.style.getPropertyValue("--scroll-draw-progress");function R(u){e.textContent=H(r+(s-r)*u),e.style.setProperty("--scroll-draw-progress",String(u));}function re(){if(!I||$)return;let u=U(G(),L,ne,1),d=p?Math.max(A,S(b=Math.max(b,u))):S(u);y=d,R(d),d>=1&&!v?(v=true,E?.()):d<1&&!p&&(v=false),C=requestAnimationFrame(re);}q();{b=U(G(),L,ne,1);let u=S(b);y=u,R(u);}let Te=new IntersectionObserver(u=>{u.forEach(d=>{I=d.isIntersecting,I&&!$?C=requestAnimationFrame(re):cancelAnimationFrame(C);});}),ce;function N(){clearTimeout(ce),ce=setTimeout(q,150);}window.addEventListener("resize",N),window.addEventListener("orientationchange",N);let k=Oe([e],N);Te.observe(e),Pe(e,{type:"counter",getProgress:()=>y,getTrigger:()=>({tStart:L,tEnd:ne})});function O(){$&&($=false,I&&(C=requestAnimationFrame(re)));}return {destroy(){cancelAnimationFrame(C),Te.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),k(),clearTimeout(ce),e.style.setProperty("--scroll-draw-progress",D),Ce(e);},replay(){A=-1,b=0,v=false,y=0,R(0),O();},pause(){$=true,cancelAnimationFrame(C);},resume:O,seek(u){let d=Math.min(1,Math.max(0,u));y=d,A=d,b=0,$=true,cancelAnimationFrame(C),R(d);},getProgress(){return y}}}var nn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rn(e,n={}){if(typeof window>"u")return nn;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return ge("scrollVideo: <video> element not found:",e),nn;let r=t,{trigger:s={},easing:i="linear",once:a=false,axis:m="y",preload:p="auto",triggerElement:h,onReady:E,onComplete:H,onProgress:S}=n,Y=h??r,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof i=="function"?i:ee[i]??ee.linear,ne=de(s.start||"top top"),we=de(s.end||"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=p);let C=n.from??0,I=n.to,$=0,A=0,b=0,y=false,v=false,G=-1,_=0,q=0,D=false,R=false,re=()=>m==="x"?window.scrollX:window.scrollY,Te=()=>m==="x"?window.innerWidth:window.innerHeight;function ce(){let x=Y.getBoundingClientRect(),T=m==="x"?x.left:x.top,ue=m==="x"?x.width:x.height,me=Le({top:T,height:ue},re(),Te(),ne,we);$=me.tStart,A=me.tEnd,R&&A===$&&ge("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let N=NaN;function k(x){if(!R)return;let T=I??r.duration??0,ue=C+(T-C)*x;ue!==N&&(N=ue,r.currentTime=ue),r.style.setProperty("--scroll-draw-progress",String(x)),S?.(x);}function O(){if(!y||v||!R||te)return;let x=U(re(),$,A,1),T=a?Math.max(G,L(_=Math.max(_,x))):L(x);q=T,k(T),T>=1&&!D?(D=true,H?.()):T<1&&!a&&(D=false),b=requestAnimationFrame(O);}function u(){if(R=true,I===void 0&&(I=r.duration),te){k(1),E?.();return}ce(),E?.(),v?k(q):y&&(b=requestAnimationFrame(O));}r.readyState>=1?u():r.addEventListener("loadedmetadata",u,{once:true}),R||ce();let d=te?()=>{}:ut(x=>{x&&(d(),te=true,cancelAnimationFrame(b),k(1));}),X=new IntersectionObserver(x=>{x.forEach(T=>{y=T.isIntersecting,y&&!v&&R?b=requestAnimationFrame(O):cancelAnimationFrame(b);});}),xe;function V(){clearTimeout(xe),xe=setTimeout(ce,150);}window.addEventListener("resize",V),window.addEventListener("orientationchange",V);let K=Oe([Y],V);X.observe(r),Pe(r,{type:"video",getProgress:()=>q,getTrigger:()=>({tStart:$,tEnd:A})});function $e(){v&&(v=false,y&&R&&(b=requestAnimationFrame(O)));}return {destroy(){cancelAnimationFrame(b),X.disconnect(),r.removeEventListener("loadedmetadata",u),window.removeEventListener("resize",V),window.removeEventListener("orientationchange",V),K(),d(),clearTimeout(xe),Ce(r);},replay(){G=-1,_=0,D=false,q=0,N=NaN,k(0),$e();},pause(){v=true,cancelAnimationFrame(b);},resume:$e,seek(x){let T=Math.min(1,Math.max(0,x));q=T,G=T,_=0,v=true,cancelAnimationFrame(b),N=NaN,k(T);},getProgress(){return q}}}function on(e,n){let t=document.createElement("span");t.textContent=n,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function mt(e=""){let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent=e,n}function an(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=e.appendChild(mt(t)),s=/^\s+$/.test(t);return s?r.style.whiteSpace="pre":r.style.display="inline-block",s?null:r}).filter(t=>t!==null)}function qn(e){let n=e.textContent??"";e.textContent="";let t=[],r=null;for(let s of n){let i=mt(s),a=s===" ";a?i.style.whiteSpace="pre":(i.style.display="inline-block",t.push(i)),a||s>"\u0DFF"?r=null:r||(r=e.appendChild(mt()),r.style.cssText="display:inline-block;white-space:nowrap"),(r??e).appendChild(i);}return t}function sn(e){let n=an(e),t=new Map;for(let i of n){let a=i.offsetTop;t.has(a)||t.set(a,[]),t.get(a).push(i);}let r=[],s=Array.from(t.keys()).sort((i,a)=>i-a);for(let i of s){let a=t.get(i),m=mt();m.style.display="inline-block",a.forEach((p,h)=>{let E=p.nextElementSibling;m.appendChild(p),h<a.length-1&&E&&E.style.whiteSpace==="pre"&&m.appendChild(E);}),r.push(m);}return e.textContent="",r.forEach((i,a)=>{e.appendChild(i),a<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Bn(e,n,t,r){if(t<=1||r===0)return e;r=Math.min(r,1/t);let s=(t-1)*r,i=n*r,a=i+(1-s);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function Gn(e,n){let t=[];if(n?.y!==void 0&&t.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&t.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&t.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let r=n.scale+(1-n.scale)*e;t.push(`scale(${r})`);}return t.join(" ")}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ln(e,n={}){if(typeof window>"u")return Et;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return ge("scrollText: element not found:",e),Et;let r=t;return _e(n,(s,i)=>jn(r,s,i))}function jn(e,n,t){let{split:r="words",stagger:s=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:m={},once:p=true,onComplete:h}=n,E=typeof i=="function"?i:ee[i]??ee["ease-out"],H=de(m.start||"top 85%"),S=de(m.end||"top 40%"),Y=e.innerHTML,te=e.textContent??"",L;r==="chars"?L=qn(e):r==="lines"?L=sn(e):L=an(e),on(e,te);let ne=L.length;function we(u,d){a?.opacity!==void 0&&(u.style.opacity=String(a.opacity+(1-a.opacity)*d));let X=Gn(d,a);X&&(u.style.transform=X);}function C(u){e.style.setProperty("--scroll-draw-progress",String(u)),L.forEach((d,X)=>{let xe=E(Bn(u,X,ne,s));we(d,xe);});}if(t)return C(1),h?.(),{...Et,destroy:()=>{e.innerHTML=Y;},getProgress:()=>1};C(0);let I=0,$=0,A=0,b=false,y=false,v=-1,G=0,_=false,q=()=>window.scrollY,D=()=>window.innerHeight;function R(){let u=e.getBoundingClientRect(),d=Le({top:u.top,height:u.height},q(),D(),H,S);I=d.tStart,$=d.tEnd;}function re(){if(!b||y)return;let u=U(q(),I,$,1);p&&(v=Math.max(v,u),u=v),G=u,C(u),u>=1&&!_?(_=true,h?.()):u<1&&!p&&(_=false),A=requestAnimationFrame(re);}R();let Te=new IntersectionObserver(u=>{u.forEach(d=>{b=d.isIntersecting,b&&!y?A=requestAnimationFrame(re):cancelAnimationFrame(A);});}),ce;function N(){clearTimeout(ce),ce=setTimeout(()=>{if(r==="lines"){let u=G;e.innerHTML=Y,L=sn(e),on(e,te),C(u);}R();},150);}window.addEventListener("resize",N),window.addEventListener("orientationchange",N);let k=Oe([e],N);Te.observe(e),Pe(e,{type:"text",getProgress:()=>G,getTrigger:()=>({tStart:I,tEnd:$})});function O(){y&&(y=false,b&&(A=requestAnimationFrame(re)));}return {destroy(){cancelAnimationFrame(A),Te.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),k(),clearTimeout(ce),e.innerHTML=Y,Ce(e);},replay(){v=-1,_=false,G=0,C(0),O();},pause(){y=true,cancelAnimationFrame(A);},resume:O,seek(u){let d=Math.min(1,Math.max(0,u));G=d,v=d,y=true,cancelAnimationFrame(A),C(d);},getProgress(){return G}}}var qe=class{constructor(n){this.create=n;this.instance=null;this.el=null;this.key="";}init(n,t){return this.destroy(),this.el=n,this.latest=t,this.key=wt(t),this.instance=this.create(n,Ut(t,()=>this.latest)),this}update(n){return this.el?wt(n)!==this.key?this.init(this.el,n):(this.latest=n,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(n){return this.instance?.seek(n),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},cn=class extends qe{constructor(){super(jt);}init(n,t={}){return super.init(n,t)}},un=class extends qe{constructor(){super(en);}},mn=class extends qe{constructor(){super(tn);}},fn=class extends qe{constructor(){super(rn);}init(n,t={}){return super.init(n,t)}},pn=class extends qe{constructor(){super(ln);}init(n,t={}){return super.init(n,t)}};exports.EngineRef=qe;exports.ScrollAnimateRef=un;exports.ScrollCounterRef=mn;exports.ScrollDrawRef=cn;exports.ScrollTextRef=pn;exports.ScrollVideoRef=fn;
|
package/dist/angular/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-
|
|
1
|
+
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-QFSTKVA3.mjs';import {a as a$4}from'../chunk-NLPSVYFP.mjs';import {a as a$2}from'../chunk-I73SOXBN.mjs';import {a as a$1}from'../chunk-OPXWNJBG.mjs';import {b as b$1}from'../chunk-6TWFLRUB.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';var r=class{constructor(t){this.create=t;this.instance=null;this.el=null;this.key="";}init(t,e){return this.destroy(),this.el=t,this.latest=e,this.key=a(e),this.instance=this.create(t,b(e,()=>this.latest)),this}update(t){return this.el?a(t)!==this.key?this.init(this.el,t):(this.latest=t,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},u=class extends r{constructor(){super(b$1);}init(t,e={}){return super.init(t,e)}},h=class extends r{constructor(){super(a$1);}},m=class extends r{constructor(){super(a$2);}},O=class extends r{constructor(){super(a$3);}init(t,e={}){return super.init(t,e)}},d=class extends r{constructor(){super(a$4);}init(t,e={}){return super.init(t,e)}};export{r as EngineRef,h as ScrollAnimateRef,m as ScrollCounterRef,u as ScrollDrawRef,d as ScrollTextRef,O as ScrollVideoRef};
|
package/dist/astro/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${u?`left:${
|
|
3
|
-
<div style="position:absolute;${u?`left:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(r),window.addEventListener("scroll",s,{passive:true}),s(),{el:r,destroy(){window.removeEventListener("scroll",s),r.remove();}}}var Bt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Gt=/[MmLlHhVvCcSsQqTtAaZz]/g;function xn(e,t,n){if(!Ye)return;let r=(e.match(Gt)??[]).join("").toUpperCase(),s=(t.match(Gt)??[]).join("").toUpperCase(),i=(e.match(Bt)??[]).length,l=(t.match(Bt)??[]).length;if(r!==s){B(`morphTo: command sequence differs (${r||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}i!==l&&B(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function Mn(e,t,n){let r=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),f=r[s++]??l;return String(+(l+(f-l)*n).toFixed(4))})}function ct(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:ze(t,(n,r)=>Ln(e,n,r))}function Ln(e,t,n){let{preset:r,...s}=t,i=r?{...Ft[r],...s}:s,{selector:l="path, polyline, line, polygon, rect, circle",speed:f=1,fade:u=false,easing:p="linear",trigger:b={},stagger:P=0,direction:v="forward",once:Z=false,debug:he=false,axis:T="y",scrollContainer:re,autoReverse:be=false,delay:A=0,strokeColor:R,strokeWidth:$,fillOpacity:D,waypoints:x,velocityScale:h=false,threshold:C=0,rootMargin:K="0px",repeat:G=0,repeatDelay:ae=0,morphTo:V,clip:ee,autoplay:me=false,duration:we=1e3,native:le=true,onProgress:te,onStart:y,onComplete:m,onEnter:M,onLeave:fe,onEnterBack:pe,onLeaveBack:qe}=i,W=ee===true?"left":typeof ee=="string"?ee:false,Q=typeof p=="function"?p:ie[p]??ie.linear,Ve=ye(b.start||"top bottom"),Se=ye(b.end||"bottom top"),ne=typeof re=="string"?document.querySelector(re):re??null,Ce=Array.isArray(R)?R[0]:null,de=Array.isArray(R)?R[1]:typeof R=="string"?R:null,Te=Array.isArray($)?$[0]:null,xe=Array.isArray($)?$[1]:typeof $=="number"?$:null,ge=Array.isArray(D)?D[0]:null,Re=Array.isArray(D)?D[1]:typeof D=="number"?D:null;function Me(o){let a=o*100;switch(W){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let F=W?[]:Array.from(e.querySelectorAll(l)),I=[],oe=[],se=0,c=0,d=P,Pe=0,S=false,O=false,E=0,k=false,ve=-1,Ee=[],Ke=-1,j=false,Le=0,$e=0,Fe,ft=null;function Et(){ft?.destroy(),ft=null;}let He=new Set,St=NaN,Ne=true,et=-1,Tt=performance.now(),We=NaN;function Qe(){return ne?T==="x"?ne.scrollLeft:ne.scrollTop:T==="x"?window.scrollX:window.scrollY}function xt(){return ne?T==="x"?ne.clientWidth:ne.clientHeight:T==="x"?window.innerWidth:window.innerHeight}function Mt(){let o=ot(e,ne,T);return Ae(o,o.scroll,xt(),Ve,Se)}function sn(){let o=c-se,a=F.length-1,g=ne??document.documentElement,N=T==="x"?"Width":"Height";if(d=P,P>0&&a>0&&o>0){let ce=g[`scroll${N}`]-g[`client${N}`]-1-se-o/f;ce>=0&&(d=Math.min(P,ce/(a*o)));}Pe=c+a*d*o;}function Lt(){(({tStart:se,tEnd:c}=Mt())),sn(),he&&Ye&&(Et(),ft=Tn(se,c,T));}function pt(o,a=Mt){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let g=o.destroy;return o.destroy=()=>{g.call(o),ke(e);},o}function At(o,a){return Z&&!be?Math.max(ve,Q(Ee[o]=Math.max(Ee[o]??0,a))):Q(a)}function an(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),W){let g=a==="reverse"?1-o:o;e.style.clipPath=Me(g);return}F.forEach((g,N)=>dt(g,N,o,a));}function dt(o,a,g,N){o.style.strokeDashoffset=N==="reverse"?`${I[a]*g}`:`${I[a]*(1-g)}`,u&&(o.style.opacity=N==="reverse"?`${1-g}`:`${g}`),Ce&&de?o.style.stroke=st(Ce,de,g):de&&(o.style.stroke=de),Te!==null&&xe!==null?o.style.strokeWidth=`${Te+(xe-Te)*g}`:xe!==null&&(o.style.strokeWidth=`${xe}`),ge!==null&&Re!==null?o.style.fillOpacity=`${ge+(Re-ge)*g}`:Re!==null&&(o.style.fillOpacity=`${Re}`),V&&o.tagName.toLowerCase()==="path"&&oe[a]&&o.setAttribute("d",Mn(oe[a],V,g));}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),W){e.style.clipPath=Me(v==="reverse"?1:0);return}F.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=v==="reverse"?"0":`${I[a]}`,u?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",Ce&&(o.style.stroke=Ce),Te!==null&&(o.style.strokeWidth=`${Te}`),ge!==null&&(o.style.fillOpacity=`${ge}`),V&&o.tagName.toLowerCase()==="path"&&oe[a]&&o.setAttribute("d",oe[a]);});}if(F.forEach(o=>{Sn(o);let a=Ge(o);I.push(a);let g=o.tagName.toLowerCase()==="path";g?oe.push(o.getAttribute("d")??""):oe.push(""),V&&(g?xn(oe[oe.length-1],V,o):B(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),n?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=v==="reverse"?`${a}`:"0",u&&(o.style.opacity="1"),de&&(o.style.stroke=de),xe!==null&&(o.style.strokeWidth=`${xe}`),Re!==null&&(o.style.fillOpacity=`${Re}`),V&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",V)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=v==="reverse"?"0":`${a}`,u?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",Ce&&(o.style.stroke=Ce),Te!==null&&(o.style.strokeWidth=`${Te}`),ge!==null&&(o.style.fillOpacity=`${ge}`));}),n)return W&&(e.style.clipPath=Me(1)),m?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};W&&(e.style.clipPath=Me(v==="reverse"?1:0));let Ct=typeof p=="string"?it(p):null;function ln(){return !(le===false||me||he||!En()||!F.length||!Ct||W||T!=="y"||ne||f!==1||P!==0||Z||be||h!==false||V||x||G||A>0||te||y||m||M||fe||pe||qe||R!=null||$!=null||D!=null||(b.start||"top bottom").trim()!=="top bottom"||(b.end||"bottom top").trim()!=="bottom top")}function cn(){let o=++vn,a=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,N=`--svg-scroll-draw-${o}`,ce=v==="reverse"?"0":"var(--ssd-len)",De=v==="reverse"?"var(--ssd-len)":"0",ue=`stroke-dashoffset:${ce};`,H=`stroke-dashoffset:${De};`;u&&(ue+=`opacity:${v==="reverse"?1:0};`,H+=`opacity:${v==="reverse"?0:1};`);let _=document.createElement("style");_.setAttribute("data-svg-scroll-draw",""),_.textContent=`@keyframes ${a}{from{${ue}}to{${H}}}.${g}{view-timeline-name:${N};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${N};animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(g);function U(w,L){w.style.setProperty("--ssd-len",String(I[L])),w.style.strokeDasharray=`${I[L]}`,w.style.strokeDashoffset="",w.style.opacity="",w.style.animationPlayState="",w.classList.add(a);}F.forEach(U);let Y=false,z=-1;function q(){if(z>=0)return z;let w=e.getBoundingClientRect(),{tStart:L,tEnd:X}=Ae({top:w.top,height:w.height},Qe(),xt(),Ve,Se);return Q(J(Qe(),L,X,f))}return {destroy(){e.classList.remove(g),F.forEach(w=>{w.classList.remove(a),w.style.removeProperty("--ssd-len"),w.style.animationPlayState="";}),_.remove();},replay(){Y=false,z=-1,F.forEach(U);},pause(){Y=true,F.forEach(w=>{w.style.animationPlayState="paused";});},resume(){Y&&(Y=false,F.forEach(w=>{w.style.animationPlayState="running";}));},seek(w){let L=Math.min(1,Math.max(0,w));z=L,Y=true,F.forEach((X,Ie)=>{X.classList.remove(a),X.style.strokeDashoffset=v==="reverse"?`${I[Ie]*L}`:`${I[Ie]*(1-L)}`,u&&(X.style.opacity=v==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return q()},refresh(){F.forEach((w,L)=>{I[L]=Ge(w),w.style.setProperty("--ssd-len",String(I[L])),w.style.strokeDasharray=`${I[L]}`;});}}}if(ln())return pt(cn());function un(){let o=Math.max(1,we),a=W?o:o*(1+Math.max(0,F.length-1)*P),g=0,N=0,ce=false;function De(z){let q=true,w=Math.min(1,Math.max(0,z/a));if(W){let L=Math.min(1,Math.max(0,z/o)),X=Q(L);Le=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=Me(v==="reverse"?1-X:X),te?.(X),L<1&&(q=false);}else {F.forEach((X,Ie)=>{let fn=Ie*P*o,Dt=Math.min(1,Math.max(0,(z-fn)/o));dt(X,Ie,Q(Dt),v),Dt<1&&(q=false);});let L=Q(w);Le=L,te?.(L),e.style.setProperty("--scroll-draw-progress",String(L));}if(x){let L=Q(w);for(let X in x){let Ie=parseFloat(X);L>=Ie&&!He.has(Ie)&&(He.add(Ie),x[X]?.());}}return q}function ue(z){if(j)return;let q=z-g;O||(O=true,y?.());let w=De(q);if(w&&!S){S=true,De(a),m?.(),$e<(G==="infinite"?1/0:G??0)&&($e++,Fe=setTimeout(()=>{g=performance.now(),O=false,S=false,He.clear(),je(),E=requestAnimationFrame(ue);},ae));return}w||(E=requestAnimationFrame(ue));}function H(){cancelAnimationFrame(E),clearTimeout(Fe),g=performance.now(),N=0,j=false,O=false,S=false,$e=0,ce=true,Le=0,He.clear(),je(),E=requestAnimationFrame(ue);}let _=new IntersectionObserver(z=>{z.forEach(q=>{q.isIntersecting&&!(Z&&S)?H():!q.isIntersecting&&!Z&&!S&&(cancelAnimationFrame(E),clearTimeout(Fe),ce=false);});},{root:ne??null,threshold:C,rootMargin:K}),U;function Y(){clearTimeout(U),U=setTimeout(()=>{F.forEach((z,q)=>{I[q]=Ge(z),z.style.strokeDasharray=`${I[q]}`;});},150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),A>0?setTimeout(()=>_.observe(e),A):_.observe(e),{destroy(){cancelAnimationFrame(E),clearTimeout(Fe),_.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(U);},replay(){$e=0,H();},pause(){j||!ce||(j=true,N=performance.now()-g,cancelAnimationFrame(E));},resume(){j&&(j=false,ce=true,g=performance.now()-N,E=requestAnimationFrame(ue));},seek(z){let q=Math.min(1,Math.max(0,z));Le=q,j=true,N=q*a,g=performance.now()-N,cancelAnimationFrame(E),De(N);},getProgress(){return Le},refresh(){clearTimeout(U),F.forEach((z,q)=>{I[q]=Ge(z),z.style.strokeDasharray=`${I[q]}`;});}}}if(me)return pt(un());Lt();function Pt(){if(j||!Be)return;let o=performance.now(),a=Qe();if(!Ne&&h===false&&a===St){yt(a);return}Ne=false,St=a;let g=f;if(h!==false){let H=o-Tt,_=H>0?Math.abs(a-(et<0?a:et))/H:0;g=f*Math.max(.2,1+_*(typeof h=="number"?h:1)*.04);}et=a,Tt=o;let N=be?Ke===-1||a>=Ke?"forward":"reverse":v;Ke=a;let ce=c-se,De=true,ue=ce===0?0:(a-se)/ce;if(isNaN(We)||(We<=0&&ue>0?M?.():We>0&&ue<=0&&qe?.(),We<1&&ue>=1?fe?.():We>=1&&ue<1&&pe?.()),We=ue,W){let H=At(0,J(a,se,c,g));Le=H,e.style.setProperty("--scroll-draw-progress",String(H));let _=N==="reverse"?1-H:H;e.style.clipPath=Me(_),te?.(H),!O&&J(a,se,c,g)>0&&(O=true,y?.()),H>=1&&!S?(S=true,m?.(),$e<(G==="infinite"?1/0:G??0)&&($e++,Fe=setTimeout(()=>{ve=-1,Ee=[],O=false,S=false,je();},ae))):H<1&&!Z&&(S=false),yt(a);return}if(F.forEach((H,_)=>{let U=_*d*ce,Y=At(_,J(a,se+U,c+U,g));dt(H,_,Y,N),_===0&&(Le=Y,te?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(De=false);}),x){let H=Q(J(a,se,c,g));for(let _ in x){let U=parseFloat(_);H>=U&&!He.has(U)&&(He.add(U),x[_]?.());}}!O&&J(a,se,c,g)>0&&(O=true,y?.()),De&&!S?(S=true,m?.(),$e<(G==="infinite"?1/0:G??0)&&($e++,Fe=setTimeout(()=>{ve=-1,Ee=[],O=false,S=false,He.clear(),je(),Ne=true;},ae))):!De&&!Z&&(S=false),yt(a);}function gt(o){return o>=c&&o<Pe}function yt(o){k||gt(o)?E=requestAnimationFrame(Pt):Be=false;}function ht(){return k||gt(Qe())}let Be=false;function tt(){Be||(Be=true,E=requestAnimationFrame(function(){Pt();}));}function nt(){Be=false,cancelAnimationFrame(E);}let bt=new IntersectionObserver(o=>{o.forEach(a=>{k=a.isIntersecting,k&&!j?(Ne=true,tt()):Be&&!j&>(Qe())||nt();});},{root:ne??null,threshold:C,rootMargin:K});function $t(){F.forEach((o,a)=>{I[a]=Ge(o),o.style.strokeDasharray=`${I[a]}`;}),Lt(),Ne=true;}let rt;function Ue(){clearTimeout(rt),rt=setTimeout($t,150);}window.addEventListener("resize",Ue),window.addEventListener("orientationchange",Ue);let mn=_e([e],Ue);return A>0?setTimeout(()=>bt.observe(e),A):bt.observe(e),pt({destroy(){cancelAnimationFrame(E),clearTimeout(Fe),nt(),bt.disconnect(),mn(),window.removeEventListener("resize",Ue),window.removeEventListener("orientationchange",Ue),clearTimeout(rt),Et();},replay(){ve=-1,Ee=[],Ke=-1,et=-1,O=false,S=false,$e=0,j=false,Le=0,He.clear(),clearTimeout(Fe),je(),Ne=true,ht()&&tt();},pause(){j=true,nt();},resume(){j&&(j=false,Ne=true,ht()&&tt());},seek(o){let a=Math.min(1,Math.max(0,o));Le=a,ve=a,Ee=[],j=true,nt(),an(a,v),Ne=true;},getProgress(){return Le},refresh(){clearTimeout(rt),$t(),ht()&&!j&&tt();}},()=>({tStart:se,tEnd:c}))}function An(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Qt(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let s=[],i=[],l=r[2].trim();if(l)for(let f of l.split(/[\s,]+/)){let u=f.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:r[1],nums:s,units:i});}return t}function Cn(e,t,n){let r=Qt(e),s=Qt(t);return r.length===0||r.length!==s.length?n<1?e:t:r.map((i,l)=>{let f=s[l];return i.fn!==f.fn||i.nums.length!==f.nums.length?n<1?`${i.fn}(${i.nums.map((u,p)=>`${u}${i.units[p]}`).join(", ")})`:`${f.fn}(${f.nums.map((u,p)=>`${u}${f.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,p)=>`${u+(f.nums[p]-u)*n}${i.units[p]}`).join(", ")})`}).join(" ")}function jt(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),s=String(t);if(An(r))return st(r,s,n);if(r.includes("("))return Cn(r,s,n);let i=r.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let f=parseFloat(i[1]),u=parseFloat(l[1]);return `${f+(u-f)*n}${i[2]||l[2]}`}return n<1?r:s}function Pn(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var $n=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Dn=0,Ut="--scroll-draw-progress";function In(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Xt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Jt(e,t){return typeof window>"u"?Xt:t.respectReducedMotion===false?Yt(e,t,false):ze(t,(n,r)=>Yt(e,n,r))}function Yt(e,t,n){let{props:r,trigger:s={},easing:i="ease-out",speed:l=1,once:f=false,axis:u="y",scrollContainer:p,native:b=true,velocityScale:P=false,triggerElement:v,onProgress:Z,onComplete:he,onEnter:T,onLeave:re,onEnterBack:be,onLeaveBack:A}=t,R=typeof i=="function"?i:ie[i]??ie["ease-out"],$=ye(s.start||"top bottom"),D=ye(s.end||"bottom top"),x=v??e,h=typeof p=="string"?document.querySelector(p):p??null,C=Object.entries(r).map(([c,d])=>({prop:Pn(c),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function K(){let c=window.getComputedStyle(e);for(let d of C)d.from===""&&(d.from=c.getPropertyValue(d.prop).trim()||"0");}function G(){for(let c of C)e.style.setProperty(c.prop,String(c.to));}let ae=new Map;for(let c of [...C.map(d=>d.prop),Ut])ae.set(c,e.style.getPropertyValue(c));function V(){for(let[c,d]of ae)d?e.style.setProperty(c,d):e.style.removeProperty(c);}if(n)return G(),he?.(),{...Xt,destroy:V,getProgress:()=>1};K();let ee=()=>h?u==="x"?h.scrollLeft:h.scrollTop:u==="x"?window.scrollX:window.scrollY,me=()=>h?u==="x"?h.clientWidth:h.clientHeight:u==="x"?window.innerWidth:window.innerHeight,we=typeof i=="string"?it(i):null;function le(){if(!b||!In()||!we||u!=="y"||h||x!==e||f||l!==1||Z||he||T||re||be||A||P!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let c of C)if(!$n.has(c.prop))return false;return true}function te(){let c=`ssd-a-${++Dn}`,d=C.map(k=>`${k.prop}:${k.from}`).join(";"),Pe=C.map(k=>`${k.prop}:${k.to}`).join(";"),S=document.createElement("style");S.setAttribute("data-ssd-animate",""),S.textContent=`@keyframes ${c}{from{${d}}to{${Pe}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${we};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(S),e.classList.add(c);let O=()=>{let k=e.getBoundingClientRect();return Ae({top:k.top,height:k.height},ee(),me(),$,D)};Oe(e,{type:"animate",getProgress:()=>E.getProgress(),getTrigger:O});let E={refresh(){},destroy(){e.classList.remove(c),S.remove(),e.style.animationPlayState="",V(),ke(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let ve=Math.min(1,Math.max(0,k));e.classList.remove(c);for(let Ee of C)e.style.setProperty(Ee.prop,jt(Ee.from,Ee.to,ve));},getProgress(){let{tStart:k,tEnd:ve}=O();return R(J(ee(),k,ve,l))}};return E}if(le())return te();let y=0,m=0,M=0,fe=false,pe=false,qe=-1,W=0,Q=0,Ve=false,Se=NaN,ne=-1,Ce=0,de=x===e?C:[],Te=false;function xe(){let c=e.style,d=de.map(E=>c.getPropertyValue(E.prop)),Pe=c.transition;de.length&&(c.transition="none"),de.forEach(E=>c.setProperty(E.prop,ae.get(E.prop)??""));let S=ot(x,h,u);de.forEach((E,k)=>c.setProperty(E.prop,d[k])),de.length&&(e.offsetWidth,c.transition=Pe);let O=Ae(S,S.scroll,me(),$,D);Te&&Math.abs(O.tStart-y)<1&&Math.abs(O.tEnd-m)<1||(Te=true,y=O.tStart,m=O.tEnd);}function ge(c){e.style.setProperty(Ut,String(c));for(let d of C)e.style.setProperty(d.prop,jt(d.from,d.to,c));Z?.(c);}function Re(c){if(isNaN(Se)){Se=c;return}Se<=0&&c>0?T?.():Se>0&&c<=0&&A?.(),Se<1&&c>=1?re?.():Se>=1&&c<1&&be?.(),Se=c;}function Me(){if(!fe||pe)return;let c=performance.now(),d=ee(),Pe=l;if(P!==false){let k=c-Ce,ve=k>0?Math.abs(d-(ne<0?d:ne))/k:0;Pe=l*Math.max(.2,1+ve*(typeof P=="number"?P:1)*.04);}ne=d,Ce=c;let S=m===y?0:(d-y)/(m-y);Re(S);let O=J(d,y,m,Pe),E=f?Math.max(qe,R(W=Math.max(W,O))):R(O);Q=E,ge(E),E>=1&&!Ve?(Ve=true,he?.()):E<1&&!f&&(Ve=false),M=requestAnimationFrame(Me);}xe(),m===y&&B("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),W=J(ee(),y,m,l),Q=R(W),ge(Q);let F=new IntersectionObserver(c=>{c.forEach(d=>{fe=d.isIntersecting,fe&&!pe?M=requestAnimationFrame(Me):cancelAnimationFrame(M);});},{root:h??null}),I;function oe(){clearTimeout(I),I=setTimeout(xe,150);}window.addEventListener("resize",oe),window.addEventListener("orientationchange",oe);let se=_e([x],oe);return F.observe(e),Oe(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:y,tEnd:m})}),{destroy(){cancelAnimationFrame(M),F.disconnect(),window.removeEventListener("resize",oe),window.removeEventListener("orientationchange",oe),se(),clearTimeout(I),V(),ke(e);},replay(){qe=-1,W=0,Ve=false,Q=0,pe=false,ge(0);},pause(){pe=true,cancelAnimationFrame(M);},resume(){pe&&(pe=false,fe&&(M=requestAnimationFrame(Me)));},seek(c){let d=Math.min(1,Math.max(0,c));Q=d,qe=d,W=0,pe=true,cancelAnimationFrame(M),ge(d);},getProgress(){return Q},refresh(){xe();}}}var wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Zt(e,t){if(typeof window>"u")return wt;let n=typeof e=="string"?document.querySelector(e):e;return n?ze(t,(r,s)=>On(n,r,s)):(B("scrollCounter: element not found:",e),wt)}function On(e,t,n){let{from:r=0,to:s,format:i,easing:l="ease-out",trigger:f={},once:u=true,decimals:p,onComplete:b}=t,P=p!==void 0?y=>y.toFixed(p):i??(y=>String(Math.round(y))),v=typeof l=="function"?l:ie[l]??ie["ease-out"],Z=ye(f.start||"top 80%"),he=ye(f.end||"top 20%");if(n)return e.textContent=P(s),b?.(),{...wt,getProgress:()=>1};let T=0,re=0,be=false,A=0,R=false,$=false,D=-1,x=0,h=0,C=false,K=()=>window.scrollY,G=()=>window.innerHeight;function ae(){let y=e.getBoundingClientRect(),m=Ae({top:y.top,height:y.height},K(),G(),Z,he);be&&Math.abs(m.tStart-T)<1&&Math.abs(m.tEnd-re)<1||(be=true,T=m.tStart,re=m.tEnd);}function V(y){e.textContent=P(r+(s-r)*y),e.style.setProperty("--scroll-draw-progress",String(y));}function ee(){if(!R||$)return;let y=J(K(),T,re,1),m=u?Math.max(D,v(x=Math.max(x,y))):v(y);h=m,V(m),m>=1&&!C?(C=true,b?.()):m<1&&!u&&(C=false),A=requestAnimationFrame(ee);}ae();{x=J(K(),T,re,1);let y=v(x);h=y,V(y);}let me=new IntersectionObserver(y=>{y.forEach(m=>{R=m.isIntersecting,R&&!$?A=requestAnimationFrame(ee):cancelAnimationFrame(A);});}),we;function le(){clearTimeout(we),we=setTimeout(ae,150);}window.addEventListener("resize",le),window.addEventListener("orientationchange",le);let te=_e([e],le);return me.observe(e),Oe(e,{type:"counter",getProgress:()=>h,getTrigger:()=>({tStart:T,tEnd:re})}),{destroy(){cancelAnimationFrame(A),me.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),te(),clearTimeout(we),ke(e);},replay(){D=-1,x=0,C=false,h=0,$=false,V(0);},pause(){$=true,cancelAnimationFrame(A);},resume(){$&&($=false,R&&(A=requestAnimationFrame(ee)));},seek(y){let m=Math.min(1,Math.max(0,y));h=m,D=m,x=0,$=true,cancelAnimationFrame(A),V(m);},getProgress(){return h}}}function Kt(e,t){let n=document.createElement("span");n.textContent=t,n.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(n);}function nn(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(n=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(r.textContent=n,r.style.whiteSpace="pre"):(r.textContent=n,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(n)?null:r}).filter(n=>n!==null)}function kn(e){let t=e.textContent??"";return e.textContent="",t.split("").map(n=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=n,n===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),n===" "?null:r}).filter(n=>n!==null)}function en(e){let t=nn(e),n=new Map;for(let i of t){let l=i.offsetTop;n.has(l)||n.set(l,[]),n.get(l).push(i);}let r=[],s=Array.from(n.keys()).sort((i,l)=>i-l);for(let i of s){let l=n.get(i),f=document.createElement("span");f.setAttribute("aria-hidden","true"),f.style.display="inline-block",l.forEach((u,p)=>{let b=u.nextElementSibling;f.appendChild(u),p<l.length-1&&b&&b.style.whiteSpace==="pre"&&f.appendChild(b);}),r.push(f);}return e.textContent="",r.forEach((i,l)=>{e.appendChild(i),l<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Rn(e,t,n,r){if(n<=1||r===0)return e;let s=(n-1)*r,i=t*r,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function Fn(e,t){let n=[];if(t?.y!==void 0&&n.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&n.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&n.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let r=t.scale+(1-t.scale)*e;n.push(`scale(${r})`);}return n.join(" ")||""}var tn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rn(e,t={}){if(typeof window>"u")return tn;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return B("scrollText: element not found:",e),tn;let r=n;return ze(t,(s,i)=>Hn(r,s,i))}function Hn(e,t,n){let{split:r="words",stagger:s=.04,easing:i="ease-out",from:l={opacity:0,y:24},trigger:f={},once:u=true,onComplete:p}=t,b=typeof i=="function"?i:ie[i]??ie["ease-out"],P=ye(f.start||"top 85%"),v=ye(f.end||"top 40%"),Z=e.innerHTML,he=e.textContent??"",T;r==="chars"?T=kn(e):r==="lines"?T=en(e):T=nn(e),Kt(e,he);let re=T.length;function be(m,M){l?.opacity!==void 0&&(m.style.opacity=String(l.opacity+(1-l.opacity)*M));let fe=Fn(M,l);fe&&(m.style.transform=fe);}function A(m){e.style.setProperty("--scroll-draw-progress",String(m)),T.forEach((M,fe)=>{let pe=b(Rn(m,fe,re,s));be(M,pe);});}if(n)return A(1),p?.(),{destroy(){e.innerHTML=Z;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let R=0,$=0,D=0,x=false,h=false,C=-1,K=0,G=false,ae=()=>window.scrollY,V=()=>window.innerHeight;function ee(){let m=e.getBoundingClientRect(),M=Ae({top:m.top,height:m.height},ae(),V(),P,v);R=M.tStart,$=M.tEnd;}function me(){if(!x||h)return;let m=J(ae(),R,$,1);u&&(C=Math.max(C,m),m=C),K=m,A(m),m>=1&&!G?(G=true,p?.()):m<1&&!u&&(G=false),D=requestAnimationFrame(me);}ee();let we=new IntersectionObserver(m=>{m.forEach(M=>{x=M.isIntersecting,x&&!h?D=requestAnimationFrame(me):cancelAnimationFrame(D);});}),le;function te(){clearTimeout(le),le=setTimeout(()=>{if(r==="lines"){let m=K;e.innerHTML=Z,T=en(e),Kt(e,he),A(m);}ee();},150);}window.addEventListener("resize",te),window.addEventListener("orientationchange",te);let y=_e([e],te);return we.observe(e),Oe(e,{type:"text",getProgress:()=>K,getTrigger:()=>({tStart:R,tEnd:$})}),{destroy(){cancelAnimationFrame(D),we.disconnect(),window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),y(),clearTimeout(le),e.innerHTML=Z,ke(e);},replay(){C=-1,G=false,K=0,h=false,A(0);},pause(){h=true,cancelAnimationFrame(D);},resume(){h&&(h=false,x&&(D=requestAnimationFrame(me)));},seek(m){let M=Math.min(1,Math.max(0,m));K=M,C=M,h=true,cancelAnimationFrame(D),A(M);},getProgress(){return K}}}function Nn(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;return r?ct(r,t):(B("Container not found:",e),n)}function Ze(){return typeof document>"u"?null:document}var vt=new WeakMap,on;function ut(e,t,n,r){let s=vt.get(e)??new Map;vt.set(e,s);let i=()=>{let u=n(),p=s.get(t);p&&p.key===u||(p?.inst.destroy(),s.set(t,{inst:r(u),key:u,build:i,users:p?.users??0}));};i(),s.get(t).users++;let l=true;typeof MutationObserver<"u"&&(on??(on=new MutationObserver(u=>u.forEach(p=>vt.get(p.target)?.forEach(b=>b.build())))),on.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(u=>`data-scroll-${u}-options`).concat("data-scroll-drawoptions")}));let f=()=>s.get(t)?.inst;return {destroy:()=>{let u=s.get(t);!l||!u||(l=false,!(--u.users>0)&&(u.inst.destroy(),s.delete(t)));},replay:()=>f()?.replay(),pause:()=>f()?.pause(),resume:()=>f()?.resume(),seek:u=>f()?.seek(u),getProgress:()=>f()?.getProgress()??0,refresh:()=>f()?.refresh?.()}}function mt(e,t){try{return e?JSON.parse(e):t}catch{return t}}function _n(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(t=>ut(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",n=>ct(t,mt(n,{})))):[]}function zn(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(t=>ut(t,"animate",()=>t.dataset.scrollAnimateOptions??"",n=>Jt(t,mt(n,{props:{}})))):[]}function Vn(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(t=>ut(t,"counter",()=>t.dataset.scrollCounterOptions??"",n=>{let r=mt(n,{});return !r.to&&r.to!==0&&(B('initScrollCounter: element missing "to" in options JSON:',t),r.to=0),typeof r.format!="function"&&r.format!==void 0&&(B('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete r.format),Zt(t,r)})):[]}function qn(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(t=>ut(t,"text",()=>t.dataset.scrollTextOptions??"",n=>rn(t,mt(n,{})))):[]}function Yr(e=Ze()){return {draw:_n(e),animate:zn(e),counter:Vn(e),text:qn(e)}}exports.initAll=Yr;exports.initScrollAnimate=zn;exports.initScrollCounter=Vn;exports.initScrollDraw=_n;exports.initScrollText=qn;exports.scrollDraw=Nn;
|
|
1
|
+
'use strict';function gn({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),s=Math.sqrt(r),i=0,a=[];for(let d=0;d<n;d++){let b=Math.pow(s,d);a.push(b),i+=b;}let m=[0],u=0;for(let d=0;d<n;d++)u+=a[d]/i,m.push(u);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let b=0;b<n;b++)if(d<=m[b+1]){let P=(d-m[b])/(m[b+1]-m[b]);if(b===0)return P*(2-P);let v=1-Math.pow(r,b);return v+(1-v)*(2*P-1)*(2*P-1)}return 1}}function yn({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),s=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return i=>i<=0?0:i>=1?1:n*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/r)+1}var ue={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:gn(),elastic:yn()};function Rt(e,t,n){return Math.min(n,Math.max(t,e))}function be(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function Ht(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function Ft(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function G(e,t,n,r){return n===t?0:Rt((e-t)/(n-t)*r,0,1)}function Le(e,t,n,r,s){let i=Ht(e.top,e.height,t,r.element)-Ft(r.viewport,n),a=Ht(e.top,e.height,t,s.element)-Ft(s.viewport,n);return {tStart:i,tEnd:a}}function ot(e,t,n){let r=e.getBoundingClientRect(),s=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:r.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:s,scroll:0}:{top:n==="x"?r.left:r.top,height:s,scroll:n==="x"?window.scrollX:window.scrollY}}function st(e){let t=parseFloat(e.getAttribute("pathLength")??"");if(t>0)return t;let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(r+s)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Nt(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function it(e,t,n){let r=Nt(e),s=Nt(t);return !r||!s?e:`rgb(${Math.round(r[0]+(s[0]-r[0])*n)},${Math.round(r[1]+(s[1]-r[1])*n)},${Math.round(r[2]+(s[2]-r[2])*n)})`}var _t={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ge=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function Q(e,...t){Ge&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var hn="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",bn="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",zt=33;function wn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function vn(e){let t=[];for(let n=0;n<zt;n++){let r=n/(zt-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function at(e){switch(e){case "linear":return "linear";case "ease-in":return hn;case "ease-out":return bn;case "ease-in-out":return wn()?vn(ue["ease-in-out"]):null;default:return null}}var Vt=Symbol.for("svg-scroll-draw.registry");function Wt(){let e=globalThis;return e[Vt]||(e[Vt]=new Map)}function Ie(e,t){Wt().set(e,t);}function Oe(e){Wt().delete(e);}var Xe,lt=new Set,ct=new WeakMap,Je=new Map,qt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function En(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let r=n;r;r=r.previousElementSibling)t.add(r);return t}function _e(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();Xe??(Xe=new ResizeObserver(s=>{let i=false;for(let{target:a}of s)ct.get(a)!==qt(a)&&(i=true),ct.set(a,"");i&<.forEach(a=>a());})),lt.add(n);let r=En(e);return [document.body,document.documentElement].forEach(s=>s&&r.add(s)),r.forEach(s=>{ct.has(s)||ct.set(s,qt(s)),Je.set(s,(Je.get(s)??0)+1),Xe.observe(s);}),()=>{lt.delete(n)&&(r.forEach(s=>{let i=(Je.get(s)??1)-1;if(i)return void Je.set(s,i);Je.delete(s),Xe?.unobserve(s);}),lt.size||(Xe?.disconnect(),Xe=void 0));}}function Bt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=s=>e(!!s.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let r=t;return r.addListener?.(n),()=>r.removeListener?.(n)}function ze(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=Bt(i=>{if(!i)return;r();let a=(n.getProgress?.()??0)>=1;n.destroy(),n=t(a?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(n))s[i]=(...a)=>n[i]?.(...a);return s.destroy=()=>{r(),n.destroy();},s}var Sn=0;function Tn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Gt(e,t){let n="";try{n=getComputedStyle(e).getPropertyValue(t).trim();}catch{}return n||(e.getAttribute(t)??"").trim()}var Qt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function xn(e){if(!Ge)return;let t=Gt(e,"stroke");if(!t||t==="none"){Q("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!Qt.has(n)&&!Qt.has(Gt(e,"fill"))&&Q("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Mn(e,t,n){let r=document.createElement("div");r.setAttribute("data-svg-scroll-draw-debug",""),r.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=n==="x"?window.scrollX:window.scrollY,a=e-i,m=t-i,u=n==="x";r.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${u?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(r),window.addEventListener("scroll",s,{passive:true}),s(),{el:r,destroy(){window.removeEventListener("scroll",s),r.remove();}}}var jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ln(e,t,n){if(!Ge)return;let r=(e.match(Ut)??[]).join("").toUpperCase(),s=(t.match(Ut)??[]).join("").toUpperCase(),i=(e.match(jt)??[]).length,a=(t.match(jt)??[]).length;if(r!==s){Q(`morphTo: command sequence differs (${r||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}i!==a&&Q(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function An(e,t,n){let r=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),m=r[s++]??a;return String(+(a+(m-a)*n).toFixed(4))})}function ut(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:ze(t,(n,r)=>Cn(e,n,r))}function Cn(e,t,n){let{preset:r,...s}=t,i=r?{..._t[r],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=false,easing:d="linear",trigger:b={},stagger:P=0,direction:v="forward",once:ee=false,debug:we=false,axis:x="y",scrollContainer:ie,autoReverse:ve=false,delay:L=0,strokeColor:D,strokeWidth:I,fillOpacity:$,waypoints:M,velocityScale:w=false,threshold:A=0,rootMargin:te="0px",repeat:j=0,repeatDelay:me=0,morphTo:z,clip:W,autoplay:fe=false,duration:Te=1e3,native:Ee=true,onProgress:H,onStart:F,onComplete:O,onEnter:f,onLeave:y,onEnterBack:ne,onLeaveBack:ke}=i,q=W===true?"left":typeof W=="string"?W:false,U=typeof d=="function"?d:ue[d]??ue.linear,Ve=be(b.start||"top bottom"),xe=be(b.end||"bottom top"),re=typeof ie=="string"?document.querySelector(ie):ie??null,Ae=Array.isArray(D)?D[0]:null,ye=Array.isArray(D)?D[1]:typeof D=="string"?D:null,Me=Array.isArray(I)?I[0]:null,Ce=Array.isArray(I)?I[1]:typeof I=="number"?I:null,he=Array.isArray($)?$[0]:null,Re=Array.isArray($)?$[1]:typeof $=="number"?$:null;function Pe(o){let l=o*100;switch(q){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let T=q?[]:Array.from(e.querySelectorAll(a)),ae=[],pe=[],Y=0,V=0,We=P,Ke=0,N=false,c=false,p=0,Se=false,oe=-1,B=[],_=-1,h=false,X=0,le=0,He,dt=null;function xt(){dt?.destroy(),dt=null;}let Fe=new Set,Mt=NaN,Ne=true,et=-1,Lt=performance.now(),qe=NaN;function Qe(){return re?x==="x"?re.scrollLeft:re.scrollTop:x==="x"?window.scrollX:window.scrollY}function At(){return re?x==="x"?re.clientWidth:re.clientHeight:x==="x"?window.innerWidth:window.innerHeight}function Ct(){let o=ot(e,re,x);return Le(o,o.scroll,At(),Ve,xe)}function ln(){let o=V-Y,l=T.length-1,g=re??document.documentElement,S=x==="x"?"Width":"Height";if(We=P,P>0&&l>0&&o>0){let se=g[`scroll${S}`]-g[`client${S}`]-1-Y-o/m;se>=0&&(We=Math.min(P,se/(l*o)));}Ke=V+l*We*o;}function Pt(){(({tStart:Y,tEnd:V}=Ct())),ln(),we&&Ge&&(xt(),dt=Mn(Y,V,x));}function gt(o,l=Ct){Ie(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let g=o.destroy;return o.destroy=()=>{g.call(o),Oe(e);},o}function $t(o,l){return ee&&!ve?Math.max(oe,U(B[o]=Math.max(B[o]??0,l))):U(l)}function cn(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),q){let g=l==="reverse"?1-o:o;e.style.clipPath=Pe(g);return}T.forEach((g,S)=>yt(g,S,o,l));}function yt(o,l,g,S){o.style.strokeDashoffset=S==="reverse"?`${ae[l]*g}`:`${ae[l]*(1-g)}`,u&&(o.style.opacity=S==="reverse"?`${1-g}`:`${g}`),Ae&&ye?o.style.stroke=it(Ae,ye,g):ye&&(o.style.stroke=ye),Me!==null&&Ce!==null?o.style.strokeWidth=`${Me+(Ce-Me)*g}`:Ce!==null&&(o.style.strokeWidth=`${Ce}`),he!==null&&Re!==null?o.style.fillOpacity=`${he+(Re-he)*g}`:Re!==null&&(o.style.fillOpacity=`${Re}`),z&&o.tagName.toLowerCase()==="path"&&pe[l]&&o.setAttribute("d",An(pe[l],z,g));}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),q){e.style.clipPath=Pe(v==="reverse"?1:0);return}T.forEach((o,l)=>{o.style.strokeDasharray=`${ae[l]}`,o.style.strokeDashoffset=v==="reverse"?"0":`${ae[l]}`,u?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",Ae&&(o.style.stroke=Ae),Me!==null&&(o.style.strokeWidth=`${Me}`),he!==null&&(o.style.fillOpacity=`${he}`),z&&o.tagName.toLowerCase()==="path"&&pe[l]&&o.setAttribute("d",pe[l]);});}function Ue(o,l){let g=o.getAttribute("d"),S=st(o);if(z&&pe[l]){o.setAttribute("d",z);let se=st(o);o.setAttribute("d",pe[l]),S=Math.max(st(o),se),o.setAttribute("d",g);}ae[l]=S,o.style.strokeDasharray=`${S}`;}if(T.forEach((o,l)=>{xn(o);let g=o.tagName.toLowerCase()==="path";g?pe.push(o.getAttribute("d")??""):pe.push(""),Ue(o,l);let S=ae[l];z&&(g?Ln(pe[pe.length-1],z,o):Q(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),n?(o.style.strokeDashoffset=v==="reverse"?`${S}`:"0",u&&(o.style.opacity="1"),ye&&(o.style.stroke=ye),Ce!==null&&(o.style.strokeWidth=`${Ce}`),Re!==null&&(o.style.fillOpacity=`${Re}`),z&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",z)):(o.style.strokeDashoffset=v==="reverse"?"0":`${S}`,u?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",Ae&&(o.style.stroke=Ae),Me!==null&&(o.style.strokeWidth=`${Me}`),he!==null&&(o.style.fillOpacity=`${he}`));}),n)return q&&(e.style.clipPath=Pe(1)),O?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};q&&(e.style.clipPath=Pe(v==="reverse"?1:0));let Dt=typeof d=="string"?at(d):null;function un(){return !(Ee===false||fe||we&&Ge||!Tn()||!T.length||!Dt||q||x!=="y"||re||m!==1||P!==0||ee||ve||w!==false||z||M||j||L>0||H||F||O||f||y||ne||ke||D!=null||I!=null||$!=null||(b.start||"top bottom").trim()!=="top bottom"||(b.end||"bottom top").trim()!=="bottom top")}function mn(){let o=++Sn,l=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,S=`--svg-scroll-draw-${o}`,se=v==="reverse"?"0":"var(--ssd-len)",$e=v==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${se};`,k=`stroke-dashoffset:${$e};`;u&&(de+=`opacity:${v==="reverse"?1:0};`,k+=`opacity:${v==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.textContent=`@keyframes ${l}{from{${de}}to{${k}}}.${g}{view-timeline-name:${S};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Dt};animation-fill-mode:both;animation-timeline:${S};animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(g);function J(E,C){E.style.setProperty("--ssd-len",String(ae[C])),E.style.strokeDasharray=`${ae[C]}`,E.style.strokeDashoffset="",E.style.opacity="",E.style.animationPlayState="",E.classList.add(l);}T.forEach(J);let Z=false,ce=-1;function ge(){if(ce>=0)return ce;let E=e.getBoundingClientRect(),{tStart:C,tEnd:K}=Le({top:E.top,height:E.height},Qe(),At(),Ve,xe);return U(G(Qe(),C,K,m))}return {destroy(){e.classList.remove(g),T.forEach(E=>{E.classList.remove(l),E.style.removeProperty("--ssd-len"),E.style.animationPlayState="";}),R.remove();},replay(){Z=false,ce=-1,T.forEach(J);},pause(){Z=true,T.forEach(E=>{E.style.animationPlayState="paused";});},resume(){Z&&(Z=false,T.forEach(E=>{E.style.animationPlayState="running";}));},seek(E){let C=Math.min(1,Math.max(0,E));ce=C,Z=true,T.forEach((K,De)=>{K.classList.remove(l),K.style.strokeDashoffset=v==="reverse"?`${ae[De]*C}`:`${ae[De]*(1-C)}`,u&&(K.style.opacity=v==="reverse"?`${1-C}`:`${C}`);});},getProgress(){return ge()},refresh(){T.forEach((E,C)=>{Ue(E,C),E.style.setProperty("--ssd-len",String(ae[C]));});}}}if(un())return gt(mn());function fn(){let o=Math.max(1,Te),l=q?o:o*(1+Math.max(0,T.length-1)*P),g=0,S=0,se=false;function $e(ce){let ge=true,E=Math.min(1,Math.max(0,ce/l));if(q){let C=Math.min(1,Math.max(0,ce/o)),K=U(C);X=K,e.style.setProperty("--scroll-draw-progress",String(K)),e.style.clipPath=Pe(v==="reverse"?1-K:K),H?.(K),C<1&&(ge=false);}else {T.forEach((K,De)=>{let dn=De*P*o,kt=Math.min(1,Math.max(0,(ce-dn)/o));yt(K,De,U(kt),v),kt<1&&(ge=false);});let C=U(E);X=C,H?.(C),e.style.setProperty("--scroll-draw-progress",String(C));}if(M){let C=U(E);for(let K in M){let De=parseFloat(K);C>=De&&!Fe.has(De)&&(Fe.add(De),M[K]?.());}}return ge}function de(ce){if(h)return;let ge=ce-g;c||(c=true,F?.());let E=$e(ge);if(E&&!N){N=true,$e(l),O?.(),le<(j==="infinite"?1/0:j??0)&&(le++,He=setTimeout(()=>{g=performance.now(),c=false,N=false,Fe.clear(),je(),p=requestAnimationFrame(de);},me));return}E||(p=requestAnimationFrame(de));}function k(){cancelAnimationFrame(p),clearTimeout(He),g=performance.now(),S=0,h=false,c=false,N=false,le=0,se=true,X=0,Fe.clear(),je(),p=requestAnimationFrame(de);}let R=new IntersectionObserver(ce=>{ce.forEach(ge=>{ge.isIntersecting&&!(ee&&N)?k():!ge.isIntersecting&&!ee&&!N&&(cancelAnimationFrame(p),clearTimeout(He),se=false);});},{root:re??null,threshold:A,rootMargin:te}),J;function Z(){clearTimeout(J),J=setTimeout(()=>T.forEach(Ue),150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),L>0?setTimeout(()=>R.observe(e),L):R.observe(e),{destroy(){cancelAnimationFrame(p),clearTimeout(He),R.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(J);},replay(){le=0,k();},pause(){h||!se||(h=true,S=performance.now()-g,cancelAnimationFrame(p));},resume(){h&&(h=false,se=true,g=performance.now()-S,p=requestAnimationFrame(de));},seek(ce){let ge=Math.min(1,Math.max(0,ce));X=ge,h=true,S=ge*l,g=performance.now()-S,cancelAnimationFrame(p),$e(S);},getProgress(){return X},refresh(){clearTimeout(J),T.forEach(Ue);}}}if(fe)return gt(fn());Pt();function It(){if(h||!Be)return;let o=performance.now(),l=Qe();if(!Ne&&w===false&&l===Mt){bt(l);return}Ne=false,Mt=l;let g=m;if(w!==false){let k=o-Lt,R=k>0?Math.abs(l-(et<0?l:et))/k:0;g=m*Math.max(.2,1+R*(typeof w=="number"?w:1)*.04);}et=l,Lt=o;let S=ve?_===-1||l>=_?"forward":"reverse":v;_=l;let se=V-Y,$e=true,de=se===0?0:(l-Y)/se;if(isNaN(qe)||(qe<=0&&de>0?f?.():qe>0&&de<=0&&ke?.(),qe<1&&de>=1?y?.():qe>=1&&de<1&&ne?.()),qe=de,q){let k=$t(0,G(l,Y,V,g));X=k,e.style.setProperty("--scroll-draw-progress",String(k));let R=S==="reverse"?1-k:k;e.style.clipPath=Pe(R),H?.(k),!c&&G(l,Y,V,g)>0&&(c=true,F?.()),k>=1&&!N?(N=true,O?.(),le<(j==="infinite"?1/0:j??0)&&(le++,He=setTimeout(()=>{oe=-1,B=[],c=false,N=false,je();},me))):k<1&&!ee&&(N=false),bt(l);return}if(T.forEach((k,R)=>{let J=R*We*se,Z=$t(R,G(l,Y+J,V+J,g));yt(k,R,Z,S),R===0&&(X=Z,H?.(Z),e.style.setProperty("--scroll-draw-progress",String(Z))),Z<1&&($e=false);}),M){let k=U(G(l,Y,V,g));for(let R in M){let J=parseFloat(R);k>=J&&!Fe.has(J)&&(Fe.add(J),M[R]?.());}}!c&&G(l,Y,V,g)>0&&(c=true,F?.()),$e&&!N?(N=true,O?.(),le<(j==="infinite"?1/0:j??0)&&(le++,He=setTimeout(()=>{oe=-1,B=[],c=false,N=false,Fe.clear(),je(),Ne=true;},me))):!$e&&!ee&&(N=false),bt(l);}function ht(o){return o>=V&&o<Ke}function bt(o){Se||ht(o)?p=requestAnimationFrame(It):Be=false;}function wt(){return Se||ht(Qe())}let Be=false;function tt(){Be||(Be=true,p=requestAnimationFrame(function(){It();}));}function nt(){Be=false,cancelAnimationFrame(p);}let vt=new IntersectionObserver(o=>{o.forEach(l=>{Se=l.isIntersecting,Se&&!h?(Ne=true,tt()):Be&&!h&&ht(Qe())||nt();});},{root:re??null,threshold:A,rootMargin:te});function Ot(){T.forEach(Ue),Pt(),Ne=true;}let rt;function Ye(){clearTimeout(rt),rt=setTimeout(Ot,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let pn=_e([e],Ye);return L>0?setTimeout(()=>vt.observe(e),L):vt.observe(e),gt({destroy(){cancelAnimationFrame(p),clearTimeout(He),nt(),vt.disconnect(),pn(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(rt),xt();},replay(){oe=-1,B=[],_=-1,et=-1,c=false,N=false,le=0,h=false,X=0,Fe.clear(),clearTimeout(He),je(),Ne=true,wt()&&tt();},pause(){h=true,nt();},resume(){h&&(h=false,Ne=true,wt()&&tt());},seek(o){let l=Math.min(1,Math.max(0,o));X=l,oe=l,B=[],h=true,nt(),cn(l,v),Ne=true;},getProgress(){return X},refresh(){clearTimeout(rt),Ot(),wt()&&!h&&tt();}},()=>({tStart:Y,tEnd:V}))}function Pn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Yt(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let s=[],i=[],a=r[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:r[1],nums:s,units:i});}return t}function $n(e,t,n){let r=Yt(e),s=Yt(t);return r.length===0||r.length!==s.length?n<1?e:t:r.map((i,a)=>{let m=s[a];return i.fn!==m.fn||i.nums.length!==m.nums.length?n<1?`${i.fn}(${i.nums.map((u,d)=>`${u}${i.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,d)=>`${u}${m.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,d)=>`${u+(m.nums[d]-u)*n}${i.units[d]}`).join(", ")})`}).join(" ")}function Xt(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),s=String(t);if(Pn(r))return it(r,s,n);if(r.includes("("))return $n(r,s,n);let i=r.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let m=parseFloat(i[1]),u=parseFloat(a[1]);return `${m+(u-m)*n}${i[2]||a[2]}`}return n<1?r:s}function Dn(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var In=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),On=0,Jt="--scroll-draw-progress";function kn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Kt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function en(e,t){return typeof window>"u"?Kt:t.respectReducedMotion===false?Zt(e,t,false):ze(t,(n,r)=>Zt(e,n,r))}function Zt(e,t,n){let{props:r,trigger:s={},easing:i="ease-out",speed:a=1,once:m=false,axis:u="y",scrollContainer:d,native:b=true,velocityScale:P=false,triggerElement:v,onProgress:ee,onComplete:we,onEnter:x,onLeave:ie,onEnterBack:ve,onLeaveBack:L}=t,D=typeof i=="function"?i:ue[i]??ue["ease-out"],I=be(s.start||"top bottom"),$=be(s.end||"bottom top"),M=v??e,w=typeof d=="string"?document.querySelector(d):d??null,A=Object.entries(r).map(([c,p])=>({prop:Dn(c),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function te(){let c=window.getComputedStyle(e);for(let p of A)p.from===""&&(p.from=c.getPropertyValue(p.prop).trim()||"0");}function j(){for(let c of A)e.style.setProperty(c.prop,String(c.to));}let me=new Map;for(let c of [...A.map(p=>p.prop),Jt])me.set(c,e.style.getPropertyValue(c));function z(){for(let[c,p]of me)p?e.style.setProperty(c,p):e.style.removeProperty(c);}if(n)return j(),we?.(),{...Kt,destroy:z,getProgress:()=>1};te();let W=()=>w?u==="x"?w.scrollLeft:w.scrollTop:u==="x"?window.scrollX:window.scrollY,fe=()=>w?u==="x"?w.clientWidth:w.clientHeight:u==="x"?window.innerWidth:window.innerHeight,Te=typeof i=="string"?at(i):null;function Ee(){if(!b||!kn()||!Te||u!=="y"||w||M!==e||m||a!==1||ee||we||x||ie||ve||L||P!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let c of A)if(!In.has(c.prop))return false;return true}function H(){let c=`ssd-a-${++On}`,p=A.map(h=>`${h.prop}:${h.from}`).join(";"),Se=A.map(h=>`${h.prop}:${h.to}`).join(";"),oe=document.createElement("style");oe.setAttribute("data-ssd-animate",""),oe.textContent=`@keyframes ${c}{from{${p}}to{${Se}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Te};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(oe),e.classList.add(c);let B=()=>{let h=e.getBoundingClientRect();return Le({top:h.top,height:h.height},W(),fe(),I,$)};Ie(e,{type:"animate",getProgress:()=>_.getProgress(),getTrigger:B});let _={refresh(){},destroy(){e.classList.remove(c),oe.remove(),e.style.animationPlayState="",z(),Oe(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(h){let X=Math.min(1,Math.max(0,h));e.classList.remove(c);for(let le of A)e.style.setProperty(le.prop,Xt(le.from,le.to,X));},getProgress(){let{tStart:h,tEnd:X}=B();return D(G(W(),h,X,a))}};return _}if(Ee())return H();let F=0,O=0,f=0,y=NaN,ne=false,ke=-1,q=0,U=0,Ve=false,xe=NaN,re=-1,Ae=0,ye=M===e?A:[],Me=false;function Ce(){let c=e.style,p=ye.map(_=>c.getPropertyValue(_.prop)),Se=c.transition;ye.length&&(c.transition="none"),ye.forEach(_=>c.setProperty(_.prop,me.get(_.prop)??""));let oe=ot(M,w,u);ye.forEach((_,h)=>c.setProperty(_.prop,p[h])),ye.length&&(e.offsetWidth,c.transition=Se);let B=Le(oe,oe.scroll,fe(),I,$);Me&&Math.abs(B.tStart-F)<1&&Math.abs(B.tEnd-O)<1||(Me=true,F=B.tStart,O=B.tEnd);}function he(c){e.style.setProperty(Jt,String(c));for(let p of A)e.style.setProperty(p.prop,Xt(p.from,p.to,c));ee?.(c);}function Re(c){if(isNaN(xe)){xe=c;return}xe<=0&&c>0?x?.():xe>0&&c<=0&&L?.(),xe<1&&c>=1?ie?.():xe>=1&&c<1&&ve?.(),xe=c;}let Pe=c=>G(c,F,O,Math.min(a,1));function T(){!f&&!ne&&Pe(W())!==y&&(f=requestAnimationFrame(ae));}function ae(){if(ne)return;let c=performance.now(),p=W(),Se=a;if(P!==false){let h=c-Ae,X=h>0?Math.abs(p-(re<0?p:re))/h:0;Se=a*Math.max(.2,1+X*(typeof P=="number"?P:1)*.04);}re=p,Ae=c;let oe=O===F?0:(p-F)/(O-F);Re(oe);let B=G(p,F,O,Se),_=m?Math.max(ke,D(q=Math.max(q,B))):D(B);U=_,he(_),_>=1&&!Ve?(Ve=true,we?.()):_<1&&!m&&(Ve=false),!ne&&(y=Pe(p),f=y>0&&y<1?requestAnimationFrame(ae):0);}Ce(),O===F&&Q("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),q=G(W(),F,O,a),U=D(q),he(U);function pe(){Ce(),T();}let Y;function V(){clearTimeout(Y),Y=setTimeout(pe,150);}let We=w??window;We.addEventListener("scroll",T,{passive:true}),window.addEventListener("resize",V),window.addEventListener("orientationchange",V);let Ke=_e([M],V);T(),Ie(e,{type:"animate",getProgress:()=>U,getTrigger:()=>({tStart:F,tEnd:O})});function N(){ne=true,cancelAnimationFrame(f),f=0,y=NaN;}return {destroy(){N(),We.removeEventListener("scroll",T),window.removeEventListener("resize",V),window.removeEventListener("orientationchange",V),Ke(),clearTimeout(Y),z(),Oe(e);},replay(){ke=-1,q=0,Ve=false,U=0,ne=false,he(0),y=0,T();},pause:N,resume(){ne&&(ne=false,T());},seek(c){let p=Math.min(1,Math.max(0,c));U=p,ke=p,q=0,N(),he(p);},getProgress(){return U},refresh:pe}}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tn(e,t){if(typeof window>"u")return Et;let n=typeof e=="string"?document.querySelector(e):e;return n?ze(t,(r,s)=>Rn(n,r,s)):(Q("scrollCounter: element not found:",e),Et)}function Rn(e,t,n){let{from:r=0,to:s,format:i,easing:a="ease-out",trigger:m={},once:u=true,decimals:d,onComplete:b}=t,P=d!==void 0?f=>f.toFixed(d):i??(f=>String(Math.round(f))),v=typeof a=="function"?a:ue[a]??ue["ease-out"],ee=be(m.start||"top 80%"),we=be(m.end||"top 20%");if(n)return e.textContent=P(s),b?.(),{...Et,getProgress:()=>1};let x=0,ie=0,ve=false,L=0,D=false,I=false,$=-1,M=0,w=0,A=false,te=()=>window.scrollY,j=()=>window.innerHeight;function me(){let f=e.getBoundingClientRect(),y=Le({top:f.top,height:f.height},te(),j(),ee,we);ve&&Math.abs(y.tStart-x)<1&&Math.abs(y.tEnd-ie)<1||(ve=true,x=y.tStart,ie=y.tEnd);}let z=e.style.getPropertyValue("--scroll-draw-progress");function W(f){e.textContent=P(r+(s-r)*f),e.style.setProperty("--scroll-draw-progress",String(f));}function fe(){if(!D||I)return;let f=G(te(),x,ie,1),y=u?Math.max($,v(M=Math.max(M,f))):v(f);w=y,W(y),y>=1&&!A?(A=true,b?.()):y<1&&!u&&(A=false),L=requestAnimationFrame(fe);}me();{M=G(te(),x,ie,1);let f=v(M);w=f,W(f);}let Te=new IntersectionObserver(f=>{f.forEach(y=>{D=y.isIntersecting,D&&!I?L=requestAnimationFrame(fe):cancelAnimationFrame(L);});}),Ee;function H(){clearTimeout(Ee),Ee=setTimeout(me,150);}window.addEventListener("resize",H),window.addEventListener("orientationchange",H);let F=_e([e],H);Te.observe(e),Ie(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:x,tEnd:ie})});function O(){I&&(I=false,D&&(L=requestAnimationFrame(fe)));}return {destroy(){cancelAnimationFrame(L),Te.disconnect(),window.removeEventListener("resize",H),window.removeEventListener("orientationchange",H),F(),clearTimeout(Ee),e.style.setProperty("--scroll-draw-progress",z),Oe(e);},replay(){$=-1,M=0,A=false,w=0,W(0),O();},pause(){I=true,cancelAnimationFrame(L);},resume:O,seek(f){let y=Math.min(1,Math.max(0,f));w=y,$=y,M=0,I=true,cancelAnimationFrame(L),W(y);},getProgress(){return w}}}function nn(e,t){let n=document.createElement("span");n.textContent=t,n.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(n);}function mt(e=""){let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=e,t}function on(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(n=>{let r=e.appendChild(mt(n)),s=/^\s+$/.test(n);return s?r.style.whiteSpace="pre":r.style.display="inline-block",s?null:r}).filter(n=>n!==null)}function Hn(e){let t=e.textContent??"";e.textContent="";let n=[],r=null;for(let s of t){let i=mt(s),a=s===" ";a?i.style.whiteSpace="pre":(i.style.display="inline-block",n.push(i)),a||s>"\u0DFF"?r=null:r||(r=e.appendChild(mt()),r.style.cssText="display:inline-block;white-space:nowrap"),(r??e).appendChild(i);}return n}function rn(e){let t=on(e),n=new Map;for(let i of t){let a=i.offsetTop;n.has(a)||n.set(a,[]),n.get(a).push(i);}let r=[],s=Array.from(n.keys()).sort((i,a)=>i-a);for(let i of s){let a=n.get(i),m=mt();m.style.display="inline-block",a.forEach((u,d)=>{let b=u.nextElementSibling;m.appendChild(u),d<a.length-1&&b&&b.style.whiteSpace==="pre"&&m.appendChild(b);}),r.push(m);}return e.textContent="",r.forEach((i,a)=>{e.appendChild(i),a<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Fn(e,t,n,r){if(n<=1||r===0)return e;r=Math.min(r,1/n);let s=(n-1)*r,i=t*r,a=i+(1-s);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function Nn(e,t){let n=[];if(t?.y!==void 0&&n.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&n.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&n.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let r=t.scale+(1-t.scale)*e;n.push(`scale(${r})`);}return n.join(" ")}var St={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function sn(e,t={}){if(typeof window>"u")return St;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return Q("scrollText: element not found:",e),St;let r=n;return ze(t,(s,i)=>_n(r,s,i))}function _n(e,t,n){let{split:r="words",stagger:s=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:m={},once:u=true,onComplete:d}=t,b=typeof i=="function"?i:ue[i]??ue["ease-out"],P=be(m.start||"top 85%"),v=be(m.end||"top 40%"),ee=e.innerHTML,we=e.textContent??"",x;r==="chars"?x=Hn(e):r==="lines"?x=rn(e):x=on(e),nn(e,we);let ie=x.length;function ve(f,y){a?.opacity!==void 0&&(f.style.opacity=String(a.opacity+(1-a.opacity)*y));let ne=Nn(y,a);ne&&(f.style.transform=ne);}function L(f){e.style.setProperty("--scroll-draw-progress",String(f)),x.forEach((y,ne)=>{let ke=b(Fn(f,ne,ie,s));ve(y,ke);});}if(n)return L(1),d?.(),{...St,destroy:()=>{e.innerHTML=ee;},getProgress:()=>1};L(0);let D=0,I=0,$=0,M=false,w=false,A=-1,te=0,j=false,me=()=>window.scrollY,z=()=>window.innerHeight;function W(){let f=e.getBoundingClientRect(),y=Le({top:f.top,height:f.height},me(),z(),P,v);D=y.tStart,I=y.tEnd;}function fe(){if(!M||w)return;let f=G(me(),D,I,1);u&&(A=Math.max(A,f),f=A),te=f,L(f),f>=1&&!j?(j=true,d?.()):f<1&&!u&&(j=false),$=requestAnimationFrame(fe);}W();let Te=new IntersectionObserver(f=>{f.forEach(y=>{M=y.isIntersecting,M&&!w?$=requestAnimationFrame(fe):cancelAnimationFrame($);});}),Ee;function H(){clearTimeout(Ee),Ee=setTimeout(()=>{if(r==="lines"){let f=te;e.innerHTML=ee,x=rn(e),nn(e,we),L(f);}W();},150);}window.addEventListener("resize",H),window.addEventListener("orientationchange",H);let F=_e([e],H);Te.observe(e),Ie(e,{type:"text",getProgress:()=>te,getTrigger:()=>({tStart:D,tEnd:I})});function O(){w&&(w=false,M&&($=requestAnimationFrame(fe)));}return {destroy(){cancelAnimationFrame($),Te.disconnect(),window.removeEventListener("resize",H),window.removeEventListener("orientationchange",H),F(),clearTimeout(Ee),e.innerHTML=ee,Oe(e);},replay(){A=-1,j=false,te=0,L(0),O();},pause(){w=true,cancelAnimationFrame($);},resume:O,seek(f){let y=Math.min(1,Math.max(0,f));te=y,A=y,w=true,cancelAnimationFrame($),L(y);},getProgress(){return te}}}function zn(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;return r?ut(r,t):(Q("Container not found:",e),n)}function Ze(){return typeof document>"u"?null:document}var Tt=new WeakMap,an;function ft(e,t,n,r){let s=Tt.get(e)??new Map;Tt.set(e,s);let i=()=>{let u=n(),d=s.get(t);d&&d.key===u||(d?.inst.destroy(),s.set(t,{inst:r(u),key:u,build:i,users:d?.users??0}));};i(),s.get(t).users++;let a=true;typeof MutationObserver<"u"&&(an??(an=new MutationObserver(u=>u.forEach(d=>Tt.get(d.target)?.forEach(b=>b.build())))),an.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(u=>`data-scroll-${u}-options`).concat("data-scroll-drawoptions")}));let m=()=>s.get(t)?.inst;return {destroy:()=>{let u=s.get(t);!a||!u||(a=false,!(--u.users>0)&&(u.inst.destroy(),s.delete(t)));},replay:()=>m()?.replay(),pause:()=>m()?.pause(),resume:()=>m()?.resume(),seek:u=>m()?.seek(u),getProgress:()=>m()?.getProgress()??0,refresh:()=>m()?.refresh?.()}}function pt(e,t){try{return e?JSON.parse(e):t}catch{return t}}function Vn(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(t=>ft(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",n=>ut(t,pt(n,{})))):[]}function Wn(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(t=>ft(t,"animate",()=>t.dataset.scrollAnimateOptions??"",n=>en(t,pt(n,{props:{}})))):[]}function qn(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(t=>ft(t,"counter",()=>t.dataset.scrollCounterOptions??"",n=>{let r=pt(n,{});return !r.to&&r.to!==0&&(Q('initScrollCounter: element missing "to" in options JSON:',t),r.to=0),typeof r.format!="function"&&r.format!==void 0&&(Q('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete r.format),tn(t,r)})):[]}function Bn(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(t=>ft(t,"text",()=>t.dataset.scrollTextOptions??"",n=>sn(t,pt(n,{})))):[]}function Jr(e=Ze()){return {draw:Vn(e),animate:Wn(e),counter:qn(e),text:Bn(e)}}exports.initAll=Jr;exports.initScrollAnimate=Wn;exports.initScrollCounter=qn;exports.initScrollDraw=Vn;exports.initScrollText=Bn;exports.scrollDraw=zn;
|
package/dist/astro/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollDraw}from'../chunk-
|
|
1
|
+
export{a as scrollDraw}from'../chunk-DSFD227B.mjs';import {a as a$2}from'../chunk-NLPSVYFP.mjs';import {a as a$1}from'../chunk-I73SOXBN.mjs';import {a}from'../chunk-OPXWNJBG.mjs';import {b}from'../chunk-6TWFLRUB.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import {b as b$1}from'../chunk-LFSU6LR3.mjs';function i(){return typeof document>"u"?null:document}var p=new WeakMap,g;function c(r,t,n,o){let l=p.get(r)??new Map;p.set(r,l);let f=()=>{let e=n(),s=l.get(t);s&&s.key===e||(s?.inst.destroy(),l.set(t,{inst:o(e),key:e,build:f,users:s?.users??0}));};f(),l.get(t).users++;let S=true;typeof MutationObserver<"u"&&(g??(g=new MutationObserver(e=>e.forEach(s=>p.get(s.target)?.forEach(O=>O.build())))),g.observe(r,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(e=>`data-scroll-${e}-options`).concat("data-scroll-drawoptions")}));let a=()=>l.get(t)?.inst;return {destroy:()=>{let e=l.get(t);!S||!e||(S=false,!(--e.users>0)&&(e.inst.destroy(),l.delete(t)));},replay:()=>a()?.replay(),pause:()=>a()?.pause(),resume:()=>a()?.resume(),seek:e=>a()?.seek(e),getProgress:()=>a()?.getProgress()??0,refresh:()=>a()?.refresh?.()}}function u(r,t){try{return r?JSON.parse(r):t}catch{return t}}function E(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-draw]")).map(t=>c(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",n=>b(t,u(n,{})))):[]}function A(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-animate]")).map(t=>c(t,"animate",()=>t.dataset.scrollAnimateOptions??"",n=>a(t,u(n,{props:{}})))):[]}function I(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-counter]")).map(t=>c(t,"counter",()=>t.dataset.scrollCounterOptions??"",n=>{let o=u(n,{});return !o.to&&o.to!==0&&(b$1('initScrollCounter: element missing "to" in options JSON:',t),o.to=0),typeof o.format!="function"&&o.format!==void 0&&(b$1('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete o.format),a$1(t,o)})):[]}function M(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-text]")).map(t=>c(t,"text",()=>t.dataset.scrollTextOptions??"",n=>a$2(t,u(n,{})))):[]}function H(r=i()){return {draw:E(r),animate:A(r),counter:I(r),text:M(r)}}export{H as initAll,A as initScrollAnimate,I as initScrollCounter,E as initScrollDraw,M as initScrollText};
|