svg-scroll-draw 2.7.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/angular/index.cjs +3 -3
  2. package/dist/angular/index.d.mts +48 -0
  3. package/dist/angular/index.d.ts +48 -0
  4. package/dist/angular/index.mjs +3 -3
  5. package/dist/astro/index.cjs +3 -3
  6. package/dist/astro/index.d.mts +20 -5
  7. package/dist/astro/index.d.ts +20 -5
  8. package/dist/astro/index.mjs +3 -3
  9. package/dist/cdn/svg-scroll-draw.dev.global.js +1878 -0
  10. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  11. package/dist/cinematic/index.cjs +2 -2
  12. package/dist/cinematic/index.mjs +2 -2
  13. package/dist/cli/init.js +104 -101
  14. package/dist/devtools/index.cjs +1 -1
  15. package/dist/devtools/index.mjs +1 -1
  16. package/dist/group/index.cjs +3 -3
  17. package/dist/group/index.d.mts +48 -0
  18. package/dist/group/index.d.ts +48 -0
  19. package/dist/group/index.mjs +3 -3
  20. package/dist/horizontal/index.cjs +1 -0
  21. package/dist/horizontal/index.d.mts +108 -0
  22. package/dist/horizontal/index.d.ts +108 -0
  23. package/dist/horizontal/index.mjs +1 -0
  24. package/dist/index.cjs +4 -4
  25. package/dist/index.d.mts +48 -0
  26. package/dist/index.d.ts +48 -0
  27. package/dist/index.mjs +4 -4
  28. package/dist/nuxt/index.cjs +3 -3
  29. package/dist/nuxt/index.d.mts +33 -0
  30. package/dist/nuxt/index.d.ts +33 -0
  31. package/dist/nuxt/index.mjs +3 -3
  32. package/dist/pin/index.cjs +1 -1
  33. package/dist/pin/index.mjs +1 -1
  34. package/dist/progress/index.cjs +1 -0
  35. package/dist/progress/index.d.mts +74 -0
  36. package/dist/progress/index.d.ts +74 -0
  37. package/dist/progress/index.mjs +1 -0
  38. package/dist/react/index.cjs +3 -3
  39. package/dist/react/index.d.mts +33 -0
  40. package/dist/react/index.d.ts +33 -0
  41. package/dist/react/index.mjs +3 -3
  42. package/dist/reveal/index.cjs +1 -0
  43. package/dist/reveal/index.d.mts +80 -0
  44. package/dist/reveal/index.d.ts +80 -0
  45. package/dist/reveal/index.mjs +1 -0
  46. package/dist/snap/index.cjs +1 -1
  47. package/dist/snap/index.d.mts +8 -0
  48. package/dist/snap/index.d.ts +8 -0
  49. package/dist/snap/index.mjs +1 -1
  50. package/dist/solid/index.cjs +3 -3
  51. package/dist/solid/index.d.mts +48 -0
  52. package/dist/solid/index.d.ts +48 -0
  53. package/dist/solid/index.mjs +3 -3
  54. package/dist/svelte/index.cjs +3 -3
  55. package/dist/svelte/index.d.mts +48 -0
  56. package/dist/svelte/index.d.ts +48 -0
  57. package/dist/svelte/index.mjs +3 -3
  58. package/dist/text/index.cjs +1 -1
  59. package/dist/text/index.d.mts +15 -0
  60. package/dist/text/index.d.ts +15 -0
  61. package/dist/text/index.mjs +1 -1
  62. package/dist/timeline/index.cjs +8 -8
  63. package/dist/timeline/index.d.mts +31 -0
  64. package/dist/timeline/index.d.ts +31 -0
  65. package/dist/timeline/index.mjs +8 -8
  66. package/dist/video/index.cjs +1 -1
  67. package/dist/video/index.d.mts +15 -0
  68. package/dist/video/index.d.ts +15 -0
  69. package/dist/video/index.mjs +1 -1
  70. package/dist/vue/index.cjs +3 -3
  71. package/dist/vue/index.d.mts +33 -0
  72. package/dist/vue/index.d.ts +33 -0
  73. package/dist/vue/index.mjs +3 -3
  74. package/dist/web-component/index.cjs +3 -3
  75. package/dist/web-component/index.mjs +3 -3
  76. package/package.json +37 -5
@@ -1,3 +1,3 @@
1
- import _t,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function At({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,c=[];for(let g=0;g<r;g++){let P=Math.pow(i,g);c.push(P),o+=P;}let u=[0],l=0;for(let g=0;g<r;g++)l+=c[g]/o,u.push(l);return g=>{if(g<=0)return 0;if(g>=1)return 1;for(let P=0;P<r;P++)if(g<=u[P+1]){let N=(g-u[P])/(u[P+1]-u[P]);if(P===0)return N*(2-N);let E=1-Math.pow(t,P);return E+(1-E)*(2*N-1)*(2*N-1)}return 1}}function Mt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),i=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return o=>o<=0?0:o>=1?1:r*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/t)+1}var ne={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:At(),elastic:Mt()};function oe(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function tt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function rt(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 Ge(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Pt(e,n,r){return Math.min(r,Math.max(n,e))}function U(e,n,r,t){return r===n?0:Pt((e-n)/(r-n)*t,0,1)}function me(e,n,r,t,i){let o=tt(e.top,e.height,n,t.element)-rt(t.viewport,r),c=tt(e.top,e.height,n,i.element)-rt(i.viewport,r);return {tStart:o,tEnd:c}}function nt(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 r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Oe(e,n,r){let t=nt(e),i=nt(n);return !t||!i?e:`rgb(${Math.round(t[0]+(i[0]-t[0])*r)},${Math.round(t[1]+(i[1]-t[1])*r)},${Math.round(t[2]+(i[2]-t[2])*r)})`}var ot={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}};function st(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var it={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Lt=0;function Ct(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function $t(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?st("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&st("Element has a fill \u2014 it may obscure the stroke animation.",e);}function kt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.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 i(){let o=r==="x"?window.scrollX:window.scrollY,c=e-o,u=n-o,l=r==="x";t.innerHTML=`
2
- <div style="position:absolute;${l?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}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;${l?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}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(t),window.addEventListener("scroll",i,{passive:true}),i(),t}function Je(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let c=parseFloat(o),u=t[i++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...ot[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:l=false,easing:g="linear",trigger:P={},stagger:N=0,direction:E="forward",once:J=false,debug:fe=false,axis:F="y",scrollContainer:_,autoReverse:q=false,delay:D=0,strokeColor:T,strokeWidth:A,fillOpacity:h,waypoints:y,velocityScale:C=false,threshold:$=0,rootMargin:k="0px",repeat:S=0,repeatDelay:O=0,morphTo:M,clip:R,autoplay:G=false,duration:W=1e3,native:Y=true,onProgress:d,onStart:I,onComplete:b,onEnter:w,onLeave:Z,onEnterBack:Se,onLeaveBack:be}=i,we=R===true?"left":typeof R=="string"?R:false,ge=typeof g=="function"?g:ne[g]??ne.linear,Re=oe(P.start??"top bottom"),ke=oe(P.end??"bottom top"),ee=typeof _=="string"?document.querySelector(_):_??null,a=Array.isArray(T)?T[0]:null,p=Array.isArray(T)?T[1]:typeof T=="string"?T:null,K=Array.isArray(A)?A[0]:null,B=Array.isArray(A)?A[1]:typeof A=="number"?A:null,te=Array.isArray(h)?h[0]:null,ie=Array.isArray(h)?h[1]:typeof h=="number"?h:null;function re(s){let m=s*100;switch(we){case "right":return `inset(0 0 0 ${100-m}%)`;case "top":return `inset(0 0 ${100-m}% 0)`;case "bottom":return `inset(${100-m}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-m}% 0 0)`}}let j=we?[]:Array.from(e.querySelectorAll(c)),H=[],pe=[],ye=0,Te=0,ae=false,he=false,se=0,ze=false,ve=-1,Ve=-1,le=false,Ce=0,xe=0,Ae,Ye=null,Me=new Set,qe=-1,Ke=performance.now(),Ne=NaN;function Fe(){return ee?F==="x"?ee.scrollLeft:ee.scrollTop:F==="x"?window.scrollX:window.scrollY}function Qe(){return ee?F==="x"?ee.clientWidth:ee.clientHeight:F==="x"?window.innerWidth:window.innerHeight}function et(){let s=e.getBoundingClientRect(),m,x,Q;if(ee){let ue=ee.getBoundingClientRect();m=F==="x"?s.left-ue.left+ee.scrollLeft:s.top-ue.top+ee.scrollTop,x=F==="x"?s.width:s.height,Q=Fe();}else m=F==="x"?s.left:s.top,x=F==="x"?s.width:s.height,Q=Fe();let ce=me({top:m,height:x},Q,Qe(),Re,ke);ye=ce.tStart,Te=ce.tEnd,fe&&process.env.NODE_ENV!=="production"&&(Ye?.remove(),Ye=kt(ye,Te,F));}function Et(s,m){if(e.style.setProperty("--scroll-draw-progress",String(s)),we){let x=m==="reverse"?1-s:s;e.style.clipPath=re(x);return}j.forEach((x,Q)=>{x.style.strokeDashoffset=m==="reverse"?`${H[Q]*s}`:`${H[Q]*(1-s)}`,l&&(x.style.opacity=m==="reverse"?`${1-s}`:`${s}`),a&&p?x.style.stroke=Oe(a,p,s):p&&(x.style.stroke=p),K!==null&&B!==null?x.style.strokeWidth=`${K+(B-K)*s}`:B!==null&&(x.style.strokeWidth=`${B}`),te!==null&&ie!==null?x.style.fillOpacity=`${te+(ie-te)*s}`:ie!==null&&(x.style.fillOpacity=`${ie}`),M&&x.tagName.toLowerCase()==="path"&&pe[Q]&&x.setAttribute("d",Je(pe[Q],M,s));});}function We(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=re(0);return}j.forEach((s,m)=>{s.style.strokeDasharray=`${H[m]}`,s.style.strokeDashoffset=E==="reverse"?"0":`${H[m]}`,l?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",a&&(s.style.stroke=a),K!==null&&(s.style.strokeWidth=`${K}`),te!==null&&(s.style.fillOpacity=`${te}`),M&&s.tagName.toLowerCase()==="path"&&pe[m]&&s.setAttribute("d",pe[m]);});}if(j.forEach(s=>{$t(s);let m=Ge(s);H.push(m),s.tagName.toLowerCase()==="path"?pe.push(s.getAttribute("d")??""):pe.push(""),o?(s.style.strokeDasharray=`${m}`,s.style.strokeDashoffset=E==="reverse"?`${m}`:"0",l&&(s.style.opacity="1"),p&&(s.style.stroke=p),B!==null&&(s.style.strokeWidth=`${B}`),ie!==null&&(s.style.fillOpacity=`${ie}`),M&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",M)):(s.style.strokeDasharray=`${m}`,s.style.strokeDashoffset=E==="reverse"?"0":`${m}`,l?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",a&&(s.style.stroke=a),K!==null&&(s.style.strokeWidth=`${K}`),te!==null&&(s.style.fillOpacity=`${te}`));}),we){if(o)return e.style.clipPath=re(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=re(0);}else if(o)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function St(){return !(Y===false||!Ct()||!j.length||typeof g!="string"||!(g in it)||we||F!=="y"||ee||u!==1||N!==0||J||q||C!==false||M||y||S||D>0||d||I||b||w||Z||Se||be||T!=null||A!=null||h!=null||(P.start??"top bottom").trim()!=="top bottom"||(P.end??"bottom top").trim()!=="bottom top")}function xt(){let s=`svg-scroll-draw-${++Lt}`,m=E==="reverse"?"0":"var(--ssd-len)",x=E==="reverse"?"var(--ssd-len)":"0",Q=`stroke-dashoffset:${m};`,ce=`stroke-dashoffset:${x};`;l&&(Q+=`opacity:${E==="reverse"?1:0};`,ce+=`opacity:${E==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${s}{from{${Q}}to{${ce}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${it[g]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function de(f,L){f.style.setProperty("--ssd-len",String(H[L])),f.style.strokeDasharray=`${H[L]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(s);}j.forEach(de);let v=false,z=-1;function V(){if(z>=0)return z;let f=e.getBoundingClientRect(),{tStart:L,tEnd:X}=me({top:f.top,height:f.height},Fe(),Qe(),Re,ke);return ge(U(Fe(),L,X,u))}return {destroy(){j.forEach(f=>{f.classList.remove(s),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),ue.remove();},replay(){v=false,z=-1,j.forEach(de);},pause(){v=true,j.forEach(f=>{f.style.animationPlayState="paused";});},resume(){v&&(v=false,j.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let L=Math.min(1,Math.max(0,f));z=L,v=true,j.forEach((X,$e)=>{X.classList.remove(s),X.style.strokeDashoffset=E==="reverse"?`${H[$e]*L}`:`${H[$e]*(1-L)}`,l&&(X.style.opacity=E==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return V()}}}if(St())return xt();function Tt(){let s=Math.max(1,W),m=0,x=0;function Q(V){let f=true;if(we){let L=Math.min(1,Math.max(0,V/s)),X=ge(L);Ce=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=re(E==="reverse"?1-X:X),d?.(X),L<1&&(f=false);}else j.forEach((L,X)=>{let $e=X*N*s,Ie=Math.min(1,Math.max(0,(V-$e)/s)),Ee=ge(Ie);L.style.strokeDashoffset=E==="reverse"?`${H[X]*Ee}`:`${H[X]*(1-Ee)}`,l&&(L.style.opacity=E==="reverse"?`${1-Ee}`:`${Ee}`),a&&p?L.style.stroke=Oe(a,p,Ee):p&&(L.style.stroke=p),K!==null&&B!==null?L.style.strokeWidth=`${K+(B-K)*Ee}`:B!==null&&(L.style.strokeWidth=`${B}`),te!==null&&ie!==null?L.style.fillOpacity=`${te+(ie-te)*Ee}`:ie!==null&&(L.style.fillOpacity=`${ie}`),M&&L.tagName.toLowerCase()==="path"&&pe[X]&&L.setAttribute("d",Je(pe[X],M,Ee)),X===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Ie<1&&(f=false);});if(y){let L=Math.min(1,Math.max(0,V/s)),X=ge(L);for(let $e in y){let Ie=parseFloat($e);X>=Ie&&!Me.has(Ie)&&(Me.add(Ie),y[$e]?.());}}return f}function ce(V){if(le)return;let f=V-m;he||(he=true,I?.());let L=Q(f);if(L&&!ae){ae=true,Q(s*(1+Math.max(0,j.length-1)*N)),b?.(),xe<(S==="infinite"?1/0:S??0)&&(xe++,Ae=setTimeout(()=>{m=performance.now(),he=false,ae=false,Me.clear(),We(),se=requestAnimationFrame(ce);},O));return}L||(se=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(se),clearTimeout(Ae),m=performance.now(),x=0,le=false,he=false,ae=false,xe=0,Me.clear(),We(),se=requestAnimationFrame(ce);}let de=new IntersectionObserver(V=>{V.forEach(f=>{f.isIntersecting&&!(J&&ae)?ue():!f.isIntersecting&&!J&&!ae&&(cancelAnimationFrame(se),clearTimeout(Ae),m=null);});},{root:ee??null,threshold:$,rootMargin:k}),v;function z(){clearTimeout(v),v=setTimeout(()=>{j.forEach((V,f)=>{H[f]=Ge(V),V.style.strokeDasharray=`${H[f]}`;});},150);}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),D>0?setTimeout(()=>de.observe(e),D):de.observe(e),{destroy(){cancelAnimationFrame(se),clearTimeout(Ae),de.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(v);},replay(){xe=0,ue();},pause(){le||(le=true,x=performance.now()-m,cancelAnimationFrame(se));},resume(){le&&(le=false,m=performance.now()-x,se=requestAnimationFrame(ce));},seek(V){let f=Math.min(1,Math.max(0,V));Ce=f,le=true,x=f*s,m=performance.now()-x,cancelAnimationFrame(se),Q(x);},getProgress(){return Ce}}}if(G)return Tt();et();function Be(){if(!ze||le)return;let s=performance.now(),m=Fe(),x=u;if(C!==false){let v=s-Ke,z=v>0?Math.abs(m-(qe<0?m:qe))/v:0;x=u*Math.max(.2,1+z*(typeof C=="number"?C:1)*.04);}qe=m,Ke=s;let Q=q?Ve===-1||m>=Ve?"forward":"reverse":E;Ve=m;let ce=Te-ye,ue=true,de=ce===0?0:(m-ye)/ce;if(isNaN(Ne)||(Ne<=0&&de>0?w?.():Ne>0&&de<=0&&be?.(),Ne<1&&de>=1?Z?.():Ne>=1&&de<1&&Se?.()),Ne=de,we){let v=ge(U(m,ye,Te,x));J&&!q&&(ve=Math.max(ve,v),v=ve),Ce=v,e.style.setProperty("--scroll-draw-progress",String(v));let z=Q==="reverse"?1-v:v;e.style.clipPath=re(z),d?.(v),!he&&U(m,ye,Te,x)>0&&(he=true,I?.()),v>=1&&!ae?(ae=true,b?.(),xe<(S==="infinite"?1/0:S??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,ae=false,e.style.clipPath=re(0);},O))):v<1&&!J&&(ae=false),se=requestAnimationFrame(Be);return}if(j.forEach((v,z)=>{let V=z*N*ce,f=ge(U(m,ye+V,Te+V,x));J&&!q&&(ve=Math.max(ve,f),f=ve),Ce=f,v.style.strokeDashoffset=Q==="reverse"?`${H[z]*f}`:`${H[z]*(1-f)}`,l&&(v.style.opacity=Q==="reverse"?`${1-f}`:`${f}`),a&&p?v.style.stroke=Oe(a,p,f):p&&(v.style.stroke=p),K!==null&&B!==null?v.style.strokeWidth=`${K+(B-K)*f}`:B!==null&&(v.style.strokeWidth=`${B}`),te!==null&&ie!==null?v.style.fillOpacity=`${te+(ie-te)*f}`:ie!==null&&(v.style.fillOpacity=`${ie}`),M&&v.tagName.toLowerCase()==="path"&&pe[z]&&v.setAttribute("d",Je(pe[z],M,f)),z===0&&(d?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(ue=false);}),y){let v=ge(U(m,ye,Te,x));for(let z in y){let V=parseFloat(z);v>=V&&!Me.has(V)&&(Me.add(V),y[z]?.());}}!he&&U(m,ye,Te,x)>0&&(he=true,I?.()),ue&&!ae?(ae=true,b?.(),xe<(S==="infinite"?1/0:S??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,ae=false,Me.clear(),We();},O))):!ue&&!J&&(ae=false),se=requestAnimationFrame(Be);}let je=new IntersectionObserver(s=>{s.forEach(m=>{ze=m.isIntersecting,ze&&!le?se=requestAnimationFrame(Be):cancelAnimationFrame(se);});},{root:ee??null,threshold:$,rootMargin:k}),Ue;function _e(){clearTimeout(Ue),Ue=setTimeout(()=>{j.forEach((s,m)=>{H[m]=Ge(s),s.style.strokeDasharray=`${H[m]}`;}),et();},150);}return window.addEventListener("resize",_e),window.addEventListener("orientationchange",_e),D>0?setTimeout(()=>je.observe(e),D):je.observe(e),{destroy(){cancelAnimationFrame(se),clearTimeout(Ae),je.disconnect(),window.removeEventListener("resize",_e),window.removeEventListener("orientationchange",_e),clearTimeout(Ue),Ye?.remove();},replay(){ve=-1,Ve=-1,qe=-1,he=false,ae=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),We();},pause(){le=true,cancelAnimationFrame(se);},resume(){le&&(le=false,ze&&(se=requestAnimationFrame(Be)));},seek(s){let m=Math.min(1,Math.max(0,s));Ce=m,ve=m,le=true,cancelAnimationFrame(se),Et(m,E);},getProgress(){return Ce}}}var lt=new Map;function Pe(e,n){lt.set(e,n);}function Le(e){lt.delete(e);}function Nt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let l=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(l?parseFloat(l[1]):0),o.push(l?l[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function It(e,n,r){let t=ct(e),i=ct(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,c)=>{let u=i[c];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((l,g)=>`${l}${o.units[g]}`).join(", ")})`:`${u.fn}(${u.nums.map((l,g)=>`${l}${u.units[g]}`).join(", ")})`:`${o.fn}(${o.nums.map((l,g)=>`${l+(u.nums[g]-l)*r}${o.units[g]}`).join(", ")})`}).join(" ")}function ut(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(Nt(t))return Oe(t,i,r);if(t.includes("("))return It(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),c=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&c){let u=parseFloat(o[1]),l=parseFloat(c[1]);return `${u+(l-u)*r}${o[2]||c[2]}`}return r<1?t:i}function Ot(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var mt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Rt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ft=0;function Dt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ft(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:c=1,once:u=false,axis:l="y",scrollContainer:g,native:P=true,onProgress:N,onComplete:E,onEnter:J,onLeave:fe,onEnterBack:F,onLeaveBack:_}=n,q=window.matchMedia("(prefers-reduced-motion: reduce)").matches,D=typeof o=="function"?o:ne[o]??ne["ease-out"],T=oe(i.start??"top bottom"),A=oe(i.end??"bottom top"),h=typeof g=="string"?document.querySelector(g):g??null,y=Object.entries(t).map(([a,p])=>({prop:Ot(a),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function C(){let a=window.getComputedStyle(e);for(let p of y)p.from===""&&(p.from=a.getPropertyValue(p.prop).trim()||"0");}function $(){for(let a of y)e.style.setProperty(a.prop,String(a.to));}if(q)return $(),E?.(),r;C();function k(){if(!P||!Dt()||typeof o!="string"||!(o in mt)||l!=="y"||h||u||c!==1||N||E||J||fe||F||_||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let a of y)if(!Rt.has(a.prop))return false;return true}function S(){let a=`ssd-a-${++Ft}`,p=y.map(re=>`${re.prop}:${re.from}`).join(";"),K=y.map(re=>`${re.prop}:${re.to}`).join(";"),B=document.createElement("style");B.setAttribute("data-ssd-animate",""),B.textContent=`@keyframes ${a}{from{${p}}to{${K}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${mt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(B),e.classList.add(a);let te=()=>l==="x"?window.scrollX:window.scrollY,ie=()=>l==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),B.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(re){let j=Math.min(1,Math.max(0,re));e.classList.remove(a);for(let H of y)e.style.setProperty(H.prop,ut(H.from,H.to,j));},getProgress(){let re=e.getBoundingClientRect(),j=te(),H=ie(),{tStart:pe,tEnd:ye}=me({top:re.top,height:re.height},j,H,T,A);return D(U(j,pe,ye,c))}}}if(k())return S();let O=0,M=0,R=0,G=false,W=false,Y=-1,d=0,I=false,b=NaN,w=()=>h?l==="x"?h.scrollLeft:h.scrollTop:l==="x"?window.scrollX:window.scrollY,Z=()=>h?l==="x"?h.clientWidth:h.clientHeight:l==="x"?window.innerWidth:window.innerHeight;function Se(){let a=e.getBoundingClientRect(),p,K;if(h){let te=h.getBoundingClientRect();p=l==="x"?a.left-te.left+h.scrollLeft:a.top-te.top+h.scrollTop,K=l==="x"?a.width:a.height;}else p=l==="x"?a.left:a.top,K=l==="x"?a.width:a.height;let B=me({top:p,height:K},w(),Z(),T,A);O=B.tStart,M=B.tEnd;}function be(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let p of y)e.style.setProperty(p.prop,ut(p.from,p.to,a));N?.(a);}function we(a){if(isNaN(b)){b=a;return}b<=0&&a>0?J?.():b>0&&a<=0&&_?.(),b<1&&a>=1?fe?.():b>=1&&a<1&&F?.(),b=a;}function ge(){if(!G||W)return;let a=M===O?0:(w()-O)/(M-O);we(a);let p=D(U(w(),O,M,c));u&&(Y=Math.max(Y,p),p=Y),d=p,be(p),p>=1&&!I?(I=true,E?.()):p<1&&!u&&(I=false),R=requestAnimationFrame(ge);}Se();{let a=D(U(w(),O,M,c));u&&a>0&&(Y=a),d=a,be(a);}let Re=new IntersectionObserver(a=>{a.forEach(p=>{G=p.isIntersecting,G&&!W?R=requestAnimationFrame(ge):cancelAnimationFrame(R);});},{root:h??null}),ke;function ee(){clearTimeout(ke),ke=setTimeout(Se,150);}return window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee),Re.observe(e),Pe(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:O,tEnd:M})}),{destroy(){cancelAnimationFrame(R),Re.disconnect(),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),clearTimeout(ke),Le(e);},replay(){Y=-1,I=false,d=0,W=false,be(0);},pause(){W=true,cancelAnimationFrame(R);},resume(){W&&(W=false,G&&(R=requestAnimationFrame(ge)));},seek(a){let p=Math.min(1,Math.max(0,a));d=p,Y=p,W=true,cancelAnimationFrame(R),be(p);},getProgress(){return d}}}var Ze={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,n){if(typeof window>"u")return Ze;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Ze;let t=r,{from:i=0,to:o,format:c,easing:u="ease-out",trigger:l={},once:g=true,decimals:P,onComplete:N}=n,E=P!==void 0?d=>d.toFixed(P):c??(d=>String(Math.round(d))),J=typeof u=="function"?u:ne[u]??ne["ease-out"],fe=oe(l.start??"top 80%"),F=oe(l.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(o),N?.(),Ze;t.textContent=E(i);let q=0,D=0,T=0,A=false,h=false,y=-1,C=0,$=false,k=()=>window.scrollY,S=()=>window.innerHeight;function O(){let d=t.getBoundingClientRect(),I=me({top:d.top,height:d.height},k(),S(),fe,F);q=I.tStart,D=I.tEnd;}function M(d){t.textContent=E(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function R(){if(!A||h)return;let d=J(U(k(),q,D,1));g&&(y=Math.max(y,d),d=y),C=d,M(d),d>=1&&!$?($=true,N?.()):d<1&&!g&&($=false),T=requestAnimationFrame(R);}O();{let d=J(U(k(),q,D,1));g&&d>0&&(y=d),C=d,M(d);}let G=new IntersectionObserver(d=>{d.forEach(I=>{A=I.isIntersecting,A&&!h?T=requestAnimationFrame(R):cancelAnimationFrame(T);});}),W;function Y(){clearTimeout(W),W=setTimeout(O,150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),G.observe(t),Pe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:q,tEnd:D})}),{destroy(){cancelAnimationFrame(T),G.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(W),Le(t);},replay(){y=-1,$=false,C=0,h=false,M(0);},pause(){h=true,cancelAnimationFrame(T);},resume(){h&&(h=false,A&&(T=requestAnimationFrame(R)));},seek(d){let I=Math.min(1,Math.max(0,d));C=I,y=I,h=true,cancelAnimationFrame(T),M(I);},getProgress(){return C}}}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),dt;let t=r,{trigger:i={},easing:o="linear",once:c=false,axis:u="y",preload:l="auto",onReady:g,onComplete:P,onProgress:N}=n,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=typeof o=="function"?o:ne[o]??ne.linear,fe=oe(i.start??"top top"),F=oe(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=l);let _=n.from??0,q=n.to,D=0,T=0,A=0,h=false,y=false,C=-1,$=0,k=false,S=false,O=()=>u==="x"?window.scrollX:window.scrollY,M=()=>u==="x"?window.innerWidth:window.innerHeight;function R(){let w=t.getBoundingClientRect(),Z=u==="x"?w.left:w.top,Se=u==="x"?w.width:w.height,be=me({top:Z,height:Se},O(),M(),fe,F);D=be.tStart,T=be.tEnd;}function G(w){if(!S)return;let Z=q??t.duration??0;t.currentTime=_+(Z-_)*w,t.style.setProperty("--scroll-draw-progress",String(w)),N?.(w);}function W(){if(!h||y||!S)return;let w=J(U(O(),D,T,1));c&&(C=Math.max(C,w),w=C),$=w,G(w),w>=1&&!k?(k=true,P?.()):w<1&&!c&&(k=false),A=requestAnimationFrame(W);}function Y(){if(S=true,q===void 0&&(q=t.duration),E){G(1),g?.();return}R(),g?.(),h&&!y&&(A=requestAnimationFrame(W));}t.readyState>=1?Y():t.addEventListener("loadedmetadata",Y,{once:true}),S||R();let d=new IntersectionObserver(w=>{w.forEach(Z=>{h=Z.isIntersecting,h&&!y&&S?A=requestAnimationFrame(W):cancelAnimationFrame(A);});}),I;function b(){clearTimeout(I),I=setTimeout(R,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),d.observe(t),Pe(t,{type:"video",getProgress:()=>$,getTrigger:()=>({tStart:D,tEnd:T})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",Y),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(I),Le(t);},replay(){C=-1,k=false,$=0,y=false,G(0);},pause(){y=true,cancelAnimationFrame(A);},resume(){y&&(y=false,h&&S&&(A=requestAnimationFrame(W)));},seek(w){let Z=Math.min(1,Math.max(0,w));$=Z,C=Z,y=true,cancelAnimationFrame(A),G(Z);},getProgress(){return $}}}function bt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function Ht(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function yt(e){let n=bt(e),r=new Map;for(let o of n){let c=o.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(o);}let t=[],i=Array.from(r.keys()).sort((o,c)=>o-c);for(let o of i){let c=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block";for(let l of c)u.appendChild(l);t.push(u);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function zt(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,c=o+(1-i);return c<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(c-o)))}function Vt(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function wt(e,n={}){if(typeof window>"u")return ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),ht;let t=r,{split:i="words",stagger:o=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:l={},once:g=true,onComplete:P}=n,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof c=="function"?c:ne[c]??ne["ease-out"],J=oe(l.start??"top 85%"),fe=oe(l.end??"top 40%"),F=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let _;i==="chars"?_=Ht(t):i==="lines"?_=yt(t):_=bt(t);let q=_.length;function D(b,w){u?.opacity!==void 0&&(b.style.opacity=String(u.opacity+(1-u.opacity)*w));let Z=Vt(w,u);Z&&(b.style.transform=Z);}function T(b){t.style.setProperty("--scroll-draw-progress",String(b)),_.forEach((w,Z)=>{let Se=E(zt(b,Z,q,o));D(w,Se);});}if(N)return T(1),P?.(),{destroy(){t.innerHTML=F,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};T(0);let A=0,h=0,y=0,C=false,$=false,k=-1,S=0,O=false,M=()=>window.scrollY,R=()=>window.innerHeight;function G(){let b=t.getBoundingClientRect(),w=me({top:b.top,height:b.height},M(),R(),J,fe);A=w.tStart,h=w.tEnd;}function W(){if(!C||$)return;let b=U(M(),A,h,1);g&&(k=Math.max(k,b),b=k),S=b,T(b),b>=1&&!O?(O=true,P?.()):b<1&&!g&&(O=false),y=requestAnimationFrame(W);}G();let Y=new IntersectionObserver(b=>{b.forEach(w=>{C=w.isIntersecting,C&&!$?y=requestAnimationFrame(W):cancelAnimationFrame(y);});}),d;function I(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let b=S;t.innerHTML=F,t.setAttribute("aria-label",t.textContent??""),_=yt(t),T(b);}G();},150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),Y.observe(t),Pe(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:A,tEnd:h})}),{destroy(){cancelAnimationFrame(y),Y.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(d),t.innerHTML=F,t.removeAttribute("aria-label"),Le(t);},replay(){k=-1,O=false,S=0,$=false,T(0);},pause(){$=true,cancelAnimationFrame(y);},resume(){$&&($=false,C&&(y=requestAnimationFrame(W)));},seek(b){let w=Math.min(1,Math.max(0,b));S=w,k=w,$=true,cancelAnimationFrame(y),T(w);},getProgress(){return S}}}function Bt(e,n={}){let[r,t]=useState(0),i=useRef(n);i.current=n;let o=useRef(-1);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let c=typeof e=="string"?document.querySelector(e):e.current;if(!c)return;let u=c,{axis:l="y",scrollContainer:g,trigger:P={}}=i.current,N=typeof g=="string"?document.querySelector(g):g??null,E=oe(P.start??"top bottom"),J=oe(P.end??"bottom top"),fe=0,F=0,_=false,q=0;function D(){return N?l==="x"?N.scrollLeft:N.scrollTop:l==="x"?window.scrollX:window.scrollY}function T(){return N?l==="x"?N.clientWidth:N.clientHeight:l==="x"?window.innerWidth:window.innerHeight}function A(){let k=u.getBoundingClientRect(),S=D(),O=l==="x"?k.left:k.top,M=l==="x"?k.width:k.height,R=me({top:O,height:M},S,T(),E,J);fe=R.tStart,F=R.tEnd;}function h(){if(!_)return;let{speed:k=1,easing:S="linear",once:O=false}=i.current,M=typeof S=="function"?S:ne[S]??ne.linear,R=U(D(),fe,F,k),G=M(R);O&&(o.current=Math.max(o.current,G),G=o.current),t(G),q=requestAnimationFrame(h);}let y=new IntersectionObserver(k=>{k.forEach(S=>{_=S.isIntersecting,_?q=requestAnimationFrame(h):cancelAnimationFrame(q);});},{root:N??null,threshold:0});A(),y.observe(u);let C;function $(){clearTimeout(C),C=setTimeout(A,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),()=>{cancelAnimationFrame(q),clearTimeout(C),y.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$);}},[]),r}function br({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=at(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function wr({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=ft(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function vr({className:e,style:n,...r}){let t=useRef(null);return useEffect(()=>{if(!t.current)return;let i=pt(t.current,r);return ()=>i.destroy()},[]),jsx("span",{ref:t,className:e,style:n})}function Er({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let c=useRef(null);return useEffect(()=>{if(!c.current)return;let u=gt(c.current,o);return ()=>u.destroy()},[]),jsx("video",{ref:c,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function Sr({children:e,as:n="p",className:r,style:t,...i}){let o=useRef(null);return useEffect(()=>{if(!o.current)return;let c=wt(o.current,i);return ()=>c.destroy()},[]),_t.createElement(n,{ref:o,className:r,style:t},e)}export{wr as ScrollAnimate,vr as ScrollCounter,br as ScrollDraw,Sr as ScrollText,Er as ScrollVideo,Bt as useScrollDrawProgress};
1
+ import ur,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function Vt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),s=Math.sqrt(t),o=0,a=[];for(let f=0;f<r;f++){let E=Math.pow(s,f);a.push(E),o+=E;}let u=[0],m=0;for(let f=0;f<r;f++)m+=a[f]/o,u.push(m);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let E=0;E<r;E++)if(f<=u[E+1]){let R=(f-u[E])/(u[E+1]-u[E]);if(E===0)return R*(2-R);let L=1-Math.pow(t,E);return L+(1-L)*(2*R-1)*(2*R-1)}return 1}}function _t({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),s=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return o=>o<=0?0:o>=1?1:r*Math.pow(2,-10*o)*Math.sin((o-s)*(2*Math.PI)/t)+1}var Q={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:Vt(),elastic:_t()};function ne(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function gt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function yt(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 Ve(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function qt(e,n,r){return Math.min(r,Math.max(n,e))}function Z(e,n,r,t){return r===n?0:qt((e-n)/(r-n)*t,0,1)}function Je(e,n,r){let t=e.getBoundingClientRect(),s=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:s,scroll:0}:{top:r==="x"?t.left:t.top,height:s,scroll:r==="x"?window.scrollX:window.scrollY}}function ye(e,n,r,t,s){let o=gt(e.top,e.height,n,t.element)-yt(t.viewport,r),a=gt(e.top,e.height,n,s.element)-yt(s.viewport,r);return {tStart:o,tEnd:a}}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 r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function _e(e,n,r){let t=ht(e),s=ht(n);return !t||!s?e:`rgb(${Math.round(t[0]+(s[0]-t[0])*r)},${Math.round(t[1]+(s[1]-t[1])*r)},${Math.round(t[2]+(s[2]-t[2])*r)})`}var bt={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 Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function he(e,...n){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Wt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Bt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",wt=33;function Gt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ut(e){let n=[];for(let r=0;r<wt;r++){let t=r/(wt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Wt;case "ease-out":return Bt;case "ease-in-out":return Gt()?Ut(Q["ease-in-out"]):null;default:return null}}var jt=0;function Xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Yt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?he("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&he("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Qt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.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 o=r==="x"?window.scrollX:window.scrollY,a=e-o,u=n-o,m=r==="x";t.innerHTML=`
2
+ <div style="position:absolute;${m?`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;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}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(t),window.addEventListener("scroll",s,{passive:true}),s(),{el:t,destroy(){window.removeEventListener("scroll",s),t.remove();}}}var vt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,St=/[MmLlHhVvCcSsQqTtAaZz]/g;function Zt(e,n,r){if(!Ke)return;let t=(e.match(St)??[]).join("").toUpperCase(),s=(n.match(St)??[]).join("").toUpperCase(),o=(e.match(vt)??[]).length,a=(n.match(vt)??[]).length;if(t!==s){he(`morphTo: command sequence differs (${t||"\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.`,r);return}o!==a&&he(`morphTo: coordinate count differs (${o} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let a=parseFloat(o),u=t[s++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function Et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,s=r?{...bt[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:f="linear",trigger:E={},stagger:R=0,direction:L="forward",once:te=false,debug:be=false,axis:N="y",scrollContainer:q,autoReverse:F=false,delay:H=0,strokeColor:M,strokeWidth:C,fillOpacity:A,waypoints:w,velocityScale:$=false,threshold:k=0,rootMargin:v="0px",repeat:y=0,repeatDelay:G=0,morphTo:I,clip:W,autoplay:U=false,duration:oe=1e3,native:me=true,onProgress:h,onStart:P,onComplete:g,onEnter:d,onLeave:z,onEnterBack:de,onLeaveBack:Ee}=s,fe=W===true?"left":typeof W=="string"?W:false,Te=typeof f=="function"?f:Q[f]??Q.linear,Pe=ne(E.start??"top bottom"),He=ne(E.end??"bottom top"),we=typeof q=="string"?document.querySelector(q):q??null,ve=Array.isArray(M)?M[0]:null,ie=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ae=Array.isArray(C)?C[0]:null,J=Array.isArray(C)?C[1]:typeof C=="number"?C:null,pe=Array.isArray(A)?A[0]:null,re=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function Le(i){let c=i*100;switch(fe){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${i*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let B=fe?[]:Array.from(e.querySelectorAll(a)),O=[],l=[],p=0,Se=0,V=false,j=false,X=0,K=false,le=-1,Ce=-1,se=false,xe=0,Re=0,Ie,rt=null;function lt(){rt?.destroy(),rt=null;}let Oe=new Set,ct=NaN,Fe=true,Ue=-1,ut=performance.now(),ze=NaN;function nt(){return we?N==="x"?we.scrollLeft:we.scrollTop:N==="x"?window.scrollX:window.scrollY}function mt(){return we?N==="x"?we.clientWidth:we.clientHeight:N==="x"?window.innerWidth:window.innerHeight}function ft(){let i=Je(e,we,N),c=ye(i,i.scroll,mt(),Pe,He);p=c.tStart,Se=c.tEnd,be&&Ke&&(lt(),rt=Qt(p,Se,N));}function Dt(i,c){if(e.style.setProperty("--scroll-draw-progress",String(i)),fe){let T=c==="reverse"?1-i:i;e.style.clipPath=Le(T);return}B.forEach((T,ce)=>{T.style.strokeDashoffset=c==="reverse"?`${O[ce]*i}`:`${O[ce]*(1-i)}`,m&&(T.style.opacity=c==="reverse"?`${1-i}`:`${i}`),ve&&ie?T.style.stroke=_e(ve,ie,i):ie&&(T.style.stroke=ie),ae!==null&&J!==null?T.style.strokeWidth=`${ae+(J-ae)*i}`:J!==null&&(T.style.strokeWidth=`${J}`),pe!==null&&re!==null?T.style.fillOpacity=`${pe+(re-pe)*i}`:re!==null&&(T.style.fillOpacity=`${re}`),I&&T.tagName.toLowerCase()==="path"&&l[ce]&&T.setAttribute("d",it(l[ce],I,i));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),fe){e.style.clipPath=Le(0);return}B.forEach((i,c)=>{i.style.strokeDasharray=`${O[c]}`,i.style.strokeDashoffset=L==="reverse"?"0":`${O[c]}`,m?i.style.opacity=L==="reverse"?"1":"0":i.style.opacity="",ve&&(i.style.stroke=ve),ae!==null&&(i.style.strokeWidth=`${ae}`),pe!==null&&(i.style.fillOpacity=`${pe}`),I&&i.tagName.toLowerCase()==="path"&&l[c]&&i.setAttribute("d",l[c]);});}if(B.forEach(i=>{Yt(i);let c=Ve(i);O.push(c);let T=i.tagName.toLowerCase()==="path";T?l.push(i.getAttribute("d")??""):l.push(""),I&&(T?Zt(l[l.length-1],I,i):he(`morphTo only applies to <path> elements \u2014 ignored on <${i.tagName}>.`,i)),o?(i.style.strokeDasharray=`${c}`,i.style.strokeDashoffset=L==="reverse"?`${c}`:"0",m&&(i.style.opacity="1"),ie&&(i.style.stroke=ie),J!==null&&(i.style.strokeWidth=`${J}`),re!==null&&(i.style.fillOpacity=`${re}`),I&&i.tagName.toLowerCase()==="path"&&i.setAttribute("d",I)):(i.style.strokeDasharray=`${c}`,i.style.strokeDashoffset=L==="reverse"?"0":`${c}`,m?i.style.opacity=L==="reverse"?"1":"0":i.style.opacity="",ve&&(i.style.stroke=ve),ae!==null&&(i.style.strokeWidth=`${ae}`),pe!==null&&(i.style.fillOpacity=`${pe}`));}),fe){if(o)return e.style.clipPath=Le(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Le(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let pt=typeof f=="string"?et(f):null;function Nt(){return !(me===false||!Xt()||!B.length||!pt||fe||N!=="y"||we||u!==1||R!==0||te||F||$!==false||I||w||y||H>0||h||P||g||d||z||de||Ee||M!=null||C!=null||A!=null||(E.start??"top bottom").trim()!=="top bottom"||(E.end??"bottom top").trim()!=="bottom top")}function Ht(){let i=++jt,c=`svg-scroll-draw-${i}`,T=`svg-scroll-draw-host-${i}`,ce=`--svg-scroll-draw-${i}`,ke=L==="reverse"?"0":"var(--ssd-len)",$e=L==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${ke};`,x=`stroke-dashoffset:${$e};`;m&&(Me+=`opacity:${L==="reverse"?1:0};`,x+=`opacity:${L==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${Me}}to{${x}}}.${T}{view-timeline-name:${ce};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${pt};animation-fill-mode:both;animation-timeline:${ce};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(T);function ue(b,ee){b.style.setProperty("--ssd-len",String(O[ee])),b.style.strokeDasharray=`${O[ee]}`,b.style.strokeDashoffset="",b.style.opacity="",b.style.animationPlayState="",b.classList.add(c);}B.forEach(ue);let S=false,_=-1;function Y(){if(_>=0)return _;let b=e.getBoundingClientRect(),{tStart:ee,tEnd:Ae}=ye({top:b.top,height:b.height},nt(),mt(),Pe,He);return Te(Z(nt(),ee,Ae,u))}return {destroy(){e.classList.remove(T),B.forEach(b=>{b.classList.remove(c),b.style.removeProperty("--ssd-len"),b.style.animationPlayState="";}),D.remove();},replay(){S=false,_=-1,B.forEach(ue);},pause(){S=true,B.forEach(b=>{b.style.animationPlayState="paused";});},resume(){S&&(S=false,B.forEach(b=>{b.style.animationPlayState="running";}));},seek(b){let ee=Math.min(1,Math.max(0,b));_=ee,S=true,B.forEach((Ae,ge)=>{Ae.classList.remove(c),Ae.style.strokeDashoffset=L==="reverse"?`${O[ge]*ee}`:`${O[ge]*(1-ee)}`,m&&(Ae.style.opacity=L==="reverse"?`${1-ee}`:`${ee}`);});},getProgress(){return Y()},refresh(){B.forEach((b,ee)=>{O[ee]=Ve(b),b.style.setProperty("--ssd-len",String(O[ee])),b.style.strokeDasharray=`${O[ee]}`;});}}}if(Nt())return Ht();function zt(){let i=Math.max(1,oe),c=0,T=0,ce=false;function ke(S){let _=true;if(fe){let Y=Math.min(1,Math.max(0,S/i)),b=Te(Y);xe=b,e.style.setProperty("--scroll-draw-progress",String(b)),e.style.clipPath=Le(L==="reverse"?1-b:b),h?.(b),Y<1&&(_=false);}else B.forEach((Y,b)=>{let ee=b*R*i,Ae=Math.min(1,Math.max(0,(S-ee)/i)),ge=Te(Ae);Y.style.strokeDashoffset=L==="reverse"?`${O[b]*ge}`:`${O[b]*(1-ge)}`,m&&(Y.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),ve&&ie?Y.style.stroke=_e(ve,ie,ge):ie&&(Y.style.stroke=ie),ae!==null&&J!==null?Y.style.strokeWidth=`${ae+(J-ae)*ge}`:J!==null&&(Y.style.strokeWidth=`${J}`),pe!==null&&re!==null?Y.style.fillOpacity=`${pe+(re-pe)*ge}`:re!==null&&(Y.style.fillOpacity=`${re}`),I&&Y.tagName.toLowerCase()==="path"&&l[b]&&Y.setAttribute("d",it(l[b],I,ge)),b===0&&(xe=ge,h?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Ae<1&&(_=false);});if(w){let Y=Math.min(1,Math.max(0,S/i)),b=Te(Y);for(let ee in w){let Ae=parseFloat(ee);b>=Ae&&!Oe.has(Ae)&&(Oe.add(Ae),w[ee]?.());}}return _}function $e(S){if(se)return;let _=S-c;j||(j=true,P?.());let Y=ke(_);if(Y&&!V){V=true,ke(i*(1+Math.max(0,B.length-1)*R)),g?.(),Re<(y==="infinite"?1/0:y??0)&&(Re++,Ie=setTimeout(()=>{c=performance.now(),j=false,V=false,Oe.clear(),je(),X=requestAnimationFrame($e);},G));return}Y||(X=requestAnimationFrame($e));}function Me(){cancelAnimationFrame(X),clearTimeout(Ie),c=performance.now(),T=0,se=false,j=false,V=false,Re=0,ce=true,xe=0,Oe.clear(),je(),X=requestAnimationFrame($e);}let x=new IntersectionObserver(S=>{S.forEach(_=>{_.isIntersecting&&!(te&&V)?Me():!_.isIntersecting&&!te&&!V&&(cancelAnimationFrame(X),clearTimeout(Ie),ce=false);});},{root:we??null,threshold:k,rootMargin:v}),D;function ue(){clearTimeout(D),D=setTimeout(()=>{B.forEach((S,_)=>{O[_]=Ve(S),S.style.strokeDasharray=`${O[_]}`;});},150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),H>0?setTimeout(()=>x.observe(e),H):x.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(Ie),x.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(D);},replay(){Re=0,Me();},pause(){se||!ce||(se=true,T=performance.now()-c,cancelAnimationFrame(X));},resume(){se&&(se=false,ce=true,c=performance.now()-T,X=requestAnimationFrame($e));},seek(S){let _=Math.min(1,Math.max(0,S));xe=_,se=true,T=_*i,c=performance.now()-T,cancelAnimationFrame(X),ke(T);},getProgress(){return xe},refresh(){clearTimeout(D),B.forEach((S,_)=>{O[_]=Ve(S),S.style.strokeDasharray=`${O[_]}`;});}}}if(U)return zt();ft();function Xe(){if(!K||se)return;let i=performance.now(),c=nt();if(!Fe&&$===false&&c===ct){X=requestAnimationFrame(Xe);return}Fe=false,ct=c;let T=u;if($!==false){let x=i-ut,D=x>0?Math.abs(c-(Ue<0?c:Ue))/x:0;T=u*Math.max(.2,1+D*(typeof $=="number"?$:1)*.04);}Ue=c,ut=i;let ce=F?Ce===-1||c>=Ce?"forward":"reverse":L;Ce=c;let ke=Se-p,$e=true,Me=ke===0?0:(c-p)/ke;if(isNaN(ze)||(ze<=0&&Me>0?d?.():ze>0&&Me<=0&&Ee?.(),ze<1&&Me>=1?z?.():ze>=1&&Me<1&&de?.()),ze=Me,fe){let x=Te(Z(c,p,Se,T));te&&!F&&(le=Math.max(le,x),x=le),xe=x,e.style.setProperty("--scroll-draw-progress",String(x));let D=ce==="reverse"?1-x:x;e.style.clipPath=Le(D),h?.(x),!j&&Z(c,p,Se,T)>0&&(j=true,P?.()),x>=1&&!V?(V=true,g?.(),Re<(y==="infinite"?1/0:y??0)&&(Re++,Ie=setTimeout(()=>{le=-1,j=false,V=false,e.style.clipPath=Le(0);},G))):x<1&&!te&&(V=false),X=requestAnimationFrame(Xe);return}if(B.forEach((x,D)=>{let ue=D*R*ke,S=Te(Z(c,p+ue,Se+ue,T));te&&!F&&(le=Math.max(le,S),S=le),xe=S,x.style.strokeDashoffset=ce==="reverse"?`${O[D]*S}`:`${O[D]*(1-S)}`,m&&(x.style.opacity=ce==="reverse"?`${1-S}`:`${S}`),ve&&ie?x.style.stroke=_e(ve,ie,S):ie&&(x.style.stroke=ie),ae!==null&&J!==null?x.style.strokeWidth=`${ae+(J-ae)*S}`:J!==null&&(x.style.strokeWidth=`${J}`),pe!==null&&re!==null?x.style.fillOpacity=`${pe+(re-pe)*S}`:re!==null&&(x.style.fillOpacity=`${re}`),I&&x.tagName.toLowerCase()==="path"&&l[D]&&x.setAttribute("d",it(l[D],I,S)),D===0&&(h?.(S),e.style.setProperty("--scroll-draw-progress",String(S))),S<1&&($e=false);}),w){let x=Te(Z(c,p,Se,T));for(let D in w){let ue=parseFloat(D);x>=ue&&!Oe.has(ue)&&(Oe.add(ue),w[D]?.());}}!j&&Z(c,p,Se,T)>0&&(j=true,P?.()),$e&&!V?(V=true,g?.(),Re<(y==="infinite"?1/0:y??0)&&(Re++,Ie=setTimeout(()=>{le=-1,j=false,V=false,Oe.clear(),je(),Fe=true;},G))):!$e&&!te&&(V=false),X=requestAnimationFrame(Xe);}let ot=false;function Ye(){ot||(ot=true,X=requestAnimationFrame(function(){Xe();}));}function Qe(){ot=false,cancelAnimationFrame(X);}let st=new IntersectionObserver(i=>{i.forEach(c=>{K=c.isIntersecting,K&&!se?(Fe=true,Ye()):Qe();});},{root:we??null,threshold:k,rootMargin:v});function dt(){B.forEach((i,c)=>{O[c]=Ve(i),i.style.strokeDasharray=`${O[c]}`;}),ft(),Fe=true;}let Ze;function qe(){clearTimeout(Ze),Ze=setTimeout(dt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),H>0?setTimeout(()=>st.observe(e),H):st.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(Ie),Qe(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Ze),lt();},replay(){le=-1,Ce=-1,Ue=-1,j=false,V=false,Re=0,se=false,xe=0,Oe.clear(),clearTimeout(Ie),je(),Fe=true,K&&Ye();},pause(){se=true,Qe();},resume(){se&&(se=false,Fe=true,K&&Ye());},seek(i){let c=Math.min(1,Math.max(0,i));xe=c,le=c,se=true,Qe(),Dt(c,L),Fe=true;},getProgress(){return xe},refresh(){clearTimeout(Ze),dt(),K&&!se&&Ye();}}}var Tt=new Map;function De(e,n){Tt.set(e,n);}function Ne(e){Tt.delete(e);}function Jt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function xt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let s=[],o=[],a=t[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:s,units:o});}return n}function Kt(e,n,r){let t=xt(e),s=xt(n);return t.length===0||t.length!==s.length?r<1?e:n:t.map((o,a)=>{let u=s[a];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,f)=>`${m}${o.units[f]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,f)=>`${m}${u.units[f]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,f)=>`${m+(u.nums[f]-m)*r}${o.units[f]}`).join(", ")})`}).join(" ")}function At(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),s=String(n);if(Jt(t))return _e(t,s,r);if(t.includes("("))return Kt(t,s,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(o&&a){let u=parseFloat(o[1]),m=parseFloat(a[1]);return `${u+(m-u)*r}${o[2]||a[2]}`}return r<1?t:s}function er(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var tr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rr=0,Mt="--scroll-draw-progress";function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Pt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:s={},easing:o="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:f,native:E=true,velocityScale:R=false,respectReducedMotion:L=true,triggerElement:te,onProgress:be,onComplete:N,onEnter:q,onLeave:F,onEnterBack:H,onLeaveBack:M}=n,C=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof o=="function"?o:Q[o]??Q["ease-out"],w=ne(s.start??"top bottom"),$=ne(s.end??"bottom top"),k=te??e,v=typeof f=="string"?document.querySelector(f):f??null,y=Object.entries(t).map(([l,p])=>({prop:er(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function G(){let l=window.getComputedStyle(e);for(let p of y)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function I(){for(let l of y)e.style.setProperty(l.prop,String(l.to));}let W=new Map;for(let l of [...y.map(p=>p.prop),Mt])W.set(l,e.style.getPropertyValue(l));function U(){for(let[l,p]of W)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(C)return I(),N?.(),{...r,destroy:U,getProgress:()=>1};G();let oe=typeof o=="string"?et(o):null;function me(){if(!E||!nr()||!oe||m!=="y"||v||k!==e||u||a!==1||be||N||q||F||H||M||R!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let l of y)if(!tr.has(l.prop))return false;return true}function h(){let l=`ssd-a-${++rr}`,p=y.map(K=>`${K.prop}:${K.from}`).join(";"),Se=y.map(K=>`${K.prop}:${K.to}`).join(";"),V=document.createElement("style");V.setAttribute("data-ssd-animate",""),V.textContent=`@keyframes ${l}{from{${p}}to{${Se}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${oe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(V),e.classList.add(l);let j=()=>m==="x"?window.scrollX:window.scrollY,X=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(l),V.remove(),e.style.animationPlayState="",U();},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(K){let le=Math.min(1,Math.max(0,K));e.classList.remove(l);for(let Ce of y)e.style.setProperty(Ce.prop,At(Ce.from,Ce.to,le));},getProgress(){let K=e.getBoundingClientRect(),le=j(),Ce=X(),{tStart:se,tEnd:xe}=ye({top:K.top,height:K.height},le,Ce,w,$);return A(Z(le,se,xe,a))}}}if(me())return h();let P=0,g=0,d=0,z=false,de=false,Ee=-1,fe=0,Te=false,Pe=NaN,He=-1,we=0,ve=()=>v?m==="x"?v.scrollLeft:v.scrollTop:m==="x"?window.scrollX:window.scrollY,ie=()=>v?m==="x"?v.clientWidth:v.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ae(){let l=Je(k,v,m),p=ye(l,l.scroll,ie(),w,$);P=p.tStart,g=p.tEnd;}function J(l){e.style.setProperty(Mt,String(l));for(let p of y)e.style.setProperty(p.prop,At(p.from,p.to,l));be?.(l);}function pe(l){if(isNaN(Pe)){Pe=l;return}Pe<=0&&l>0?q?.():Pe>0&&l<=0&&M?.(),Pe<1&&l>=1?F?.():Pe>=1&&l<1&&H?.(),Pe=l;}function re(){if(!z||de)return;let l=performance.now(),p=ve(),Se=a;if(R!==false){let X=l-we,K=X>0?Math.abs(p-(He<0?p:He))/X:0;Se=a*Math.max(.2,1+K*(typeof R=="number"?R:1)*.04);}He=p,we=l;let V=g===P?0:(p-P)/(g-P);pe(V);let j=A(Z(p,P,g,Se));u&&(Ee=Math.max(Ee,j),j=Ee),fe=j,J(j),j>=1&&!Te?(Te=true,N?.()):j<1&&!u&&(Te=false),d=requestAnimationFrame(re);}ae(),g===P&&he("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);{let l=A(Z(ve(),P,g,a));u&&l>0&&(Ee=l),fe=l,J(l);}let Le=new IntersectionObserver(l=>{l.forEach(p=>{z=p.isIntersecting,z&&!de?d=requestAnimationFrame(re):cancelAnimationFrame(d);});},{root:v??null}),B;function O(){clearTimeout(B),B=setTimeout(ae,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),Le.observe(e),De(e,{type:"animate",getProgress:()=>fe,getTrigger:()=>({tStart:P,tEnd:g})}),{destroy(){cancelAnimationFrame(d),Le.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(B),U(),Ne(e);},replay(){Ee=-1,Te=false,fe=0,de=false,J(0);},pause(){de=true,cancelAnimationFrame(d);},resume(){de&&(de=false,z&&(d=requestAnimationFrame(re)));},seek(l){let p=Math.min(1,Math.max(0,l));fe=p,Ee=p,de=true,cancelAnimationFrame(d),J(p);},getProgress(){return fe}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lt(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollCounter: element not found:",e),at;let t=r,{from:s=0,to:o,format:a,easing:u="ease-out",trigger:m={},once:f=true,decimals:E,onComplete:R}=n,L=E!==void 0?h=>h.toFixed(E):a??(h=>String(Math.round(h))),te=typeof u=="function"?u:Q[u]??Q["ease-out"],be=ne(m.start??"top 80%"),N=ne(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(o),R?.(),at;let F=0,H=0,M=0,C=false,A=false,w=-1,$=0,k=false,v=()=>window.scrollY,y=()=>window.innerHeight;function G(){let h=t.getBoundingClientRect(),P=ye({top:h.top,height:h.height},v(),y(),be,N);F=P.tStart,H=P.tEnd;}function I(h){t.textContent=L(s+(o-s)*h),t.style.setProperty("--scroll-draw-progress",String(h));}function W(){if(!C||A)return;let h=te(Z(v(),F,H,1));f&&(w=Math.max(w,h),h=w),$=h,I(h),h>=1&&!k?(k=true,R?.()):h<1&&!f&&(k=false),M=requestAnimationFrame(W);}G();{let h=te(Z(v(),F,H,1));f&&h>0&&(w=h),$=h,I(h);}let U=new IntersectionObserver(h=>{h.forEach(P=>{C=P.isIntersecting,C&&!A?M=requestAnimationFrame(W):cancelAnimationFrame(M);});}),oe;function me(){clearTimeout(oe),oe=setTimeout(G,150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),U.observe(t),De(t,{type:"counter",getProgress:()=>$,getTrigger:()=>({tStart:F,tEnd:H})}),{destroy(){cancelAnimationFrame(M),U.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(oe),Ne(t);},replay(){w=-1,k=false,$=0,A=false,I(0);},pause(){A=true,cancelAnimationFrame(M);},resume(){A&&(A=false,C&&(M=requestAnimationFrame(W)));},seek(h){let P=Math.min(1,Math.max(0,h));$=P,w=P,A=true,cancelAnimationFrame(M),I(P);},getProgress(){return $}}}var Ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function $t(e,n={}){if(typeof window>"u")return Ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Ct;let t=r,{trigger:s={},easing:o="linear",once:a=false,axis:u="y",preload:m="auto",onReady:f,onComplete:E,onProgress:R}=n,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof o=="function"?o:Q[o]??Q.linear,be=ne(s.start??"top top"),N=ne(s.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let q=n.from??0,F=n.to,H=0,M=0,C=0,A=false,w=false,$=-1,k=0,v=false,y=false,G=()=>u==="x"?window.scrollX:window.scrollY,I=()=>u==="x"?window.innerWidth:window.innerHeight;function W(){let d=t.getBoundingClientRect(),z=u==="x"?d.left:d.top,de=u==="x"?d.width:d.height,Ee=ye({top:z,height:de},G(),I(),be,N);H=Ee.tStart,M=Ee.tEnd;}function U(d){if(!y)return;let z=F??t.duration??0;t.currentTime=q+(z-q)*d,t.style.setProperty("--scroll-draw-progress",String(d)),R?.(d);}function oe(){if(!A||w||!y)return;let d=te(Z(G(),H,M,1));a&&($=Math.max($,d),d=$),k=d,U(d),d>=1&&!v?(v=true,E?.()):d<1&&!a&&(v=false),C=requestAnimationFrame(oe);}function me(){if(y=true,F===void 0&&(F=t.duration),L){U(1),f?.();return}W(),f?.(),A&&!w&&(C=requestAnimationFrame(oe));}t.readyState>=1?me():t.addEventListener("loadedmetadata",me,{once:true}),y||W();let h=new IntersectionObserver(d=>{d.forEach(z=>{A=z.isIntersecting,A&&!w&&y?C=requestAnimationFrame(oe):cancelAnimationFrame(C);});}),P;function g(){clearTimeout(P),P=setTimeout(W,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),h.observe(t),De(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:H,tEnd:M})}),{destroy(){cancelAnimationFrame(C),h.disconnect(),t.removeEventListener("loadedmetadata",me),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(P),Ne(t);},replay(){$=-1,v=false,k=0,w=false,U(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,A&&y&&(C=requestAnimationFrame(oe)));},seek(d){let z=Math.min(1,Math.max(0,d));k=z,$=z,w=true,cancelAnimationFrame(C),U(z);},getProgress(){return k}}}function It(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function or(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Rt(e){let n=It(e),r=new Map;for(let o of n){let a=o.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(o);}let t=[],s=Array.from(r.keys()).sort((o,a)=>o-a);for(let o of s){let a=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",a.forEach((m,f)=>{let E=m.nextElementSibling;u.appendChild(m),f<a.length-1&&E&&E.style.whiteSpace==="pre"&&u.appendChild(E);}),t.push(u);}return e.textContent="",t.forEach((o,a)=>{e.appendChild(o),a<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function sr(e,n,r,t){if(r<=1||t===0)return e;let s=(r-1)*t,o=n*t,a=o+(1-s);return a<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(a-o)))}function ir(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var kt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ot(e,n={}){if(typeof window>"u")return kt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollText: element not found:",e),kt;let t=r,{split:s="words",stagger:o=.04,easing:a="ease-out",from:u={opacity:0,y:24},trigger:m={},once:f=true,onComplete:E}=n,R=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof a=="function"?a:Q[a]??Q["ease-out"],te=ne(m.start??"top 85%"),be=ne(m.end??"top 40%"),N=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let q;s==="chars"?q=or(t):s==="lines"?q=Rt(t):q=It(t);let F=q.length;function H(g,d){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*d));let z=ir(d,u);z&&(g.style.transform=z);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),q.forEach((d,z)=>{let de=L(sr(g,z,F,o));H(d,de);});}if(R)return M(1),E?.(),{destroy(){t.innerHTML=N,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let C=0,A=0,w=0,$=false,k=false,v=-1,y=0,G=false,I=()=>window.scrollY,W=()=>window.innerHeight;function U(){let g=t.getBoundingClientRect(),d=ye({top:g.top,height:g.height},I(),W(),te,be);C=d.tStart,A=d.tEnd;}function oe(){if(!$||k)return;let g=Z(I(),C,A,1);f&&(v=Math.max(v,g),g=v),y=g,M(g),g>=1&&!G?(G=true,E?.()):g<1&&!f&&(G=false),w=requestAnimationFrame(oe);}U();let me=new IntersectionObserver(g=>{g.forEach(d=>{$=d.isIntersecting,$&&!k?w=requestAnimationFrame(oe):cancelAnimationFrame(w);});}),h;function P(){clearTimeout(h),h=setTimeout(()=>{if(s==="lines"){let g=y;t.innerHTML=N,t.setAttribute("aria-label",t.textContent??""),q=Rt(t),M(g);}U();},150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),me.observe(t),De(t,{type:"text",getProgress:()=>y,getTrigger:()=>({tStart:C,tEnd:A})}),{destroy(){cancelAnimationFrame(w),me.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(h),t.innerHTML=N,t.removeAttribute("aria-label"),Ne(t);},replay(){v=-1,G=false,y=0,k=false,M(0);},pause(){k=true,cancelAnimationFrame(w);},resume(){k&&(k=false,$&&(w=requestAnimationFrame(oe)));},seek(g){let d=Math.min(1,Math.max(0,g));y=d,v=d,k=true,cancelAnimationFrame(w),M(d);},getProgress(){return y}}}function cr(e,n={}){let[r,t]=useState(0),s=useRef(n);s.current=n;let o=useRef(-1);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let u=a,{axis:m="y",scrollContainer:f,trigger:E={}}=s.current,R=typeof f=="string"?document.querySelector(f):f??null,L=ne(E.start??"top bottom"),te=ne(E.end??"bottom top"),be=0,N=0,q=false,F=0;function H(){return R?m==="x"?R.scrollLeft:R.scrollTop:m==="x"?window.scrollX:window.scrollY}function M(){return R?m==="x"?R.clientWidth:R.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function C(){let v=u.getBoundingClientRect(),y=H(),G=m==="x"?v.left:v.top,I=m==="x"?v.width:v.height,W=ye({top:G,height:I},y,M(),L,te);be=W.tStart,N=W.tEnd;}function A(){if(!q)return;let{speed:v=1,easing:y="linear",once:G=false}=s.current,I=typeof y=="function"?y:Q[y]??Q.linear,W=Z(H(),be,N,v),U=I(W);G&&(o.current=Math.max(o.current,U),U=o.current),t(U),F=requestAnimationFrame(A);}let w=new IntersectionObserver(v=>{v.forEach(y=>{q=y.isIntersecting,q?F=requestAnimationFrame(A):cancelAnimationFrame(F);});},{root:R??null,threshold:0});C(),w.observe(u);let $;function k(){clearTimeout($),$=setTimeout(C,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),()=>{cancelAnimationFrame(F),clearTimeout($),w.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k);}},[]),r}function Xr({children:e,className:n,style:r,...t}){let s=useRef(null);return useEffect(()=>{if(!s.current)return;let o=Et(s.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:s,className:n,style:r,children:e})}function Yr({children:e,className:n,style:r,...t}){let s=useRef(null);return useEffect(()=>{if(!s.current)return;let o=Pt(s.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:s,className:n,style:r,children:e})}function Qr({className:e,style:n,...r}){let t=useRef(null);return useEffect(()=>{if(!t.current)return;let s=Lt(t.current,r);return ()=>s.destroy()},[]),jsx("span",{ref:t,className:e,style:n})}function Zr({src:e,className:n,style:r,muted:t=true,playsInline:s=true,...o}){let a=useRef(null);return useEffect(()=>{if(!a.current)return;let u=$t(a.current,o);return ()=>u.destroy()},[]),jsx("video",{ref:a,src:e,className:n,style:r,muted:t,playsInline:s,preload:"auto"})}function Jr({children:e,as:n="p",className:r,style:t,...s}){let o=useRef(null);return useEffect(()=>{if(!o.current)return;let a=Ot(o.current,s);return ()=>a.destroy()},[]),ur.createElement(n,{ref:o,className:r,style:t},e)}export{Yr as ScrollAnimate,Qr as ScrollCounter,Xr as ScrollDraw,Jr as ScrollText,Zr as ScrollVideo,cr as useScrollDrawProgress};
@@ -0,0 +1 @@
1
+ 'use strict';function Ie({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(r),i=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(a,c);m.push(p),i+=p;}let l=[0],u=0;for(let c=0;c<t;c++)u+=m[c]/i,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),a=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-a)*(2*Math.PI)/r)+1}var _={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:Ie(),elastic:_e()};function U(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 ae(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 ue(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 Ce(e,n,t){return Math.min(t,Math.max(n,e))}function k(e,n,t,r){return t===n?0:Ce((e-n)/(t-n)*r,0,1)}function le(e,n,t){let r=e.getBoundingClientRect(),a=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left+n.scrollLeft:r.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:t==="x"?r.left:r.top,height:a,scroll:t==="x"?window.scrollX:window.scrollY}}function Q(e,n,t,r,a){let i=ae(e.top,e.height,n,r.element)-ue(r.viewport,t),m=ae(e.top,e.height,n,a.element)-ue(a.viewport,t);return {tStart:i,tEnd:m}}function ce(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 me(e,n,t){let r=ce(e),a=ce(n);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*t)},${Math.round(r[1]+(a[1]-r[1])*t)},${Math.round(r[2]+(a[2]-r[2])*t)})`}var Ne="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Fe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",pe=33;function Oe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ve(e){let n=[];for(let t=0;t<pe;t++){let r=t/(pe-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function fe(e){switch(e){case "linear":return "linear";case "ease-in":return Ne;case "ease-out":return Fe;case "ease-in-out":return Oe()?Ve(_["ease-in-out"]):null;default:return null}}var ge=new Map;function de(e,n){ge.set(e,n);}function be(e){ge.delete(e);}var De=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function B(e,...n){De&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function He(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function he(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let a=[],i=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}n.push({fn:r[1],nums:a,units:i});}return n}function Xe(e,n,t){let r=he(e),a=he(n);return r.length===0||r.length!==a.length?t<1?e:n:r.map((i,m)=>{let l=a[m];return i.fn!==l.fn||i.nums.length!==l.nums.length?t<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(l.nums[c]-u)*t}${i.units[c]}`).join(", ")})`}).join(" ")}function ye(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),a=String(n);if(He(r))return me(r,a,t);if(r.includes("("))return Xe(r,a,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&m){let l=parseFloat(i[1]),u=parseFloat(m[1]);return `${l+(u-l)*t}${i[2]||m[2]}`}return t<1?r:a}function ke(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ze=0,we="--scroll-draw-progress";function We(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ee(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:a={},easing:i="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:z,onProgress:C,onComplete:w,onEnter:P,onLeave:A,onEnterBack:N,onLeaveBack:Z}=n,ve=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof i=="function"?i:_[i]??_["ease-out"],J=U(a.start??"top bottom"),K=U(a.end??"bottom top"),ee=z??e,d=typeof c=="string"?document.querySelector(c):c??null,b=Object.entries(r).map(([o,s])=>({prop:ke(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function xe(){let o=window.getComputedStyle(e);for(let s of b)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Me(){for(let o of b)e.style.setProperty(o.prop,String(o.to));}let te=new Map;for(let o of [...b.map(s=>s.prop),we])te.set(o,e.style.getPropertyValue(o));function Y(){for(let[o,s]of te)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(ve)return Me(),w?.(),{...t,destroy:Y,getProgress:()=>1};xe();let ne=typeof i=="string"?fe(i):null;function Pe(){if(!p||!We()||!ne||u!=="y"||d||ee!==e||l||m!==1||C||w||P||A||N||Z||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of b)if(!Be.has(o.prop))return false;return true}function Te(){let o=`ssd-a-${++ze}`,s=b.map(f=>`${f.prop}:${f.from}`).join(";"),H=b.map(f=>`${f.prop}:${f.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${o}{from{${s}}to{${H}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ne};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(o);let y=()=>u==="x"?window.scrollX:window.scrollY,X=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),R.remove(),e.style.animationPlayState="",Y();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let $=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let I of b)e.style.setProperty(I.prop,ye(I.from,I.to,$));},getProgress(){let f=e.getBoundingClientRect(),$=y(),I=X(),{tStart:Ae,tEnd:$e}=Q({top:f.top,height:f.height},$,I,J,K);return W(k($,Ae,$e,m))}}}if(Pe())return Te();let h=0,E=0,S=0,F=false,v=false,T=-1,L=0,O=false,x=NaN,G=-1,re=0,oe=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Le=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function se(){let o=le(ee,d,u),s=Q(o,o.scroll,Le(),J,K);h=s.tStart,E=s.tEnd;}function V(o){e.style.setProperty(we,String(o));for(let s of b)e.style.setProperty(s.prop,ye(s.from,s.to,o));C?.(o);}function Re(o){if(isNaN(x)){x=o;return}x<=0&&o>0?P?.():x>0&&o<=0&&Z?.(),x<1&&o>=1?A?.():x>=1&&o<1&&N?.(),x=o;}function j(){if(!F||v)return;let o=performance.now(),s=oe(),H=m;if(g!==false){let X=o-re,f=X>0?Math.abs(s-(G<0?s:G))/X:0;H=m*Math.max(.2,1+f*(typeof g=="number"?g:1)*.04);}G=s,re=o;let R=E===h?0:(s-h)/(E-h);Re(R);let y=W(k(s,h,E,H));l&&(T=Math.max(T,y),y=T),L=y,V(y),y>=1&&!O?(O=true,w?.()):y<1&&!l&&(O=false),S=requestAnimationFrame(j);}se(),E===h&&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);{let o=W(k(oe(),h,E,m));l&&o>0&&(T=o),L=o,V(o);}let ie=new IntersectionObserver(o=>{o.forEach(s=>{F=s.isIntersecting,F&&!v?S=requestAnimationFrame(j):cancelAnimationFrame(S);});},{root:d??null}),q;function D(){clearTimeout(q),q=setTimeout(se,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),ie.observe(e),de(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(S),ie.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(q),Y(),be(e);},replay(){T=-1,O=false,L=0,v=false,V(0);},pause(){v=true,cancelAnimationFrame(S);},resume(){v&&(v=false,F&&(S=requestAnimationFrame(j)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,T=s,v=true,cancelAnimationFrame(S),V(s);},getProgress(){return L}}}var Ye={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function Ge(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function je(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var Se={destroy:()=>{}};function it(e,n={}){if(typeof window>"u")return Se;let t=je(e);if(!t.length)return B("scrollReveal: no elements found:",e),Se;let{preset:r="fadeUp",from:a,stagger:i=.08,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=n,g={...Ye[r],...a},M=Ge(g),z=Math.min(i*4,4),C=t.map((w,P)=>{let A=Math.max(50,88-P*z),N=Math.max(20,A-35);return Ee(w,{props:M,easing:m,once:l,native:false,trigger:u??{start:`top ${A}%`,end:`top ${N}%`},onEnter:P===0?c:void 0,onLeave:P===t.length-1?p:void 0})});return {destroy(){C.forEach(w=>w.destroy());}}}exports.scrollReveal=it;
@@ -0,0 +1,80 @@
1
+ type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
+ interface TriggerConfig {
3
+ start?: string;
4
+ end?: string;
5
+ }
6
+
7
+ interface ScrollRevealFrom {
8
+ /** Start opacity (0–1). Animates to 1. */
9
+ opacity?: number;
10
+ /** Start translateX in px. Animates to 0. */
11
+ x?: number;
12
+ /** Start translateY in px. Animates to 0. */
13
+ y?: number;
14
+ /** Start scale. Animates to 1. */
15
+ scale?: number;
16
+ /** Start rotate in degrees. Animates to 0. */
17
+ rotate?: number;
18
+ /** Start rotateX in degrees. Animates to 0. */
19
+ rotateX?: number;
20
+ /** Start rotateY in degrees. Animates to 0. */
21
+ rotateY?: number;
22
+ }
23
+ type ScrollRevealPreset = 'fadeUp' | 'fadeDown' | 'fadeLeft' | 'fadeRight' | 'scale' | 'flip' | 'flipX';
24
+ interface ScrollRevealOptions {
25
+ /**
26
+ * Named preset for the reveal animation. Default: `'fadeUp'`.
27
+ * Custom `from` overrides the preset when both are provided.
28
+ *
29
+ * Presets:
30
+ * - `fadeUp` — opacity 0→1, y +32→0 (default)
31
+ * - `fadeDown` — opacity 0→1, y -32→0
32
+ * - `fadeLeft` — opacity 0→1, x +32→0
33
+ * - `fadeRight` — opacity 0→1, x -32→0
34
+ * - `scale` — opacity 0→1, scale 0.88→1
35
+ * - `flip` — opacity 0→1, rotateX 20→0
36
+ * - `flipX` — opacity 0→1, rotateY 20→0
37
+ */
38
+ preset?: ScrollRevealPreset;
39
+ /** Custom start state. Keys: opacity, x, y, scale, rotate, rotateX, rotateY. */
40
+ from?: ScrollRevealFrom;
41
+ /**
42
+ * Delay between each element's animation start (seconds).
43
+ * Elements are staggered by offsetting their trigger window.
44
+ * Default: 0.08.
45
+ */
46
+ stagger?: number;
47
+ /** Animation easing. Default: `'ease-out'`. */
48
+ easing?: EasingName | ((t: number) => number);
49
+ /** Freeze at max progress — don't reverse on scroll back. Default: true. */
50
+ once?: boolean;
51
+ /** Override the default trigger window. */
52
+ trigger?: TriggerConfig;
53
+ /** Fires when the first element enters the trigger zone. */
54
+ onEnter?: () => void;
55
+ /** Fires when the last element leaves the trigger zone. */
56
+ onLeave?: () => void;
57
+ }
58
+ interface ScrollRevealInstance {
59
+ /** Remove all animations and restore original styles. */
60
+ destroy: () => void;
61
+ }
62
+ /**
63
+ * Reveal elements as they scroll into view.
64
+ *
65
+ * The zero-config replacement for AOS, ScrollReveal.js, and GSAP + ScrollTrigger
66
+ * for the most common scroll animation use case — in one function call.
67
+ *
68
+ * @example
69
+ * // Fade up (default)
70
+ * scrollReveal('.card');
71
+ *
72
+ * // Custom from state
73
+ * scrollReveal('.feature', { from: { opacity: 0, y: 40, scale: 0.95 } });
74
+ *
75
+ * // Named preset with stagger
76
+ * scrollReveal('.item', { preset: 'fadeLeft', stagger: 0.1 });
77
+ */
78
+ declare function scrollReveal(target: string | NodeList | Element[], options?: ScrollRevealOptions): ScrollRevealInstance;
79
+
80
+ export { type ScrollRevealFrom, type ScrollRevealInstance, type ScrollRevealOptions, type ScrollRevealPreset, scrollReveal };
@@ -0,0 +1,80 @@
1
+ type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
+ interface TriggerConfig {
3
+ start?: string;
4
+ end?: string;
5
+ }
6
+
7
+ interface ScrollRevealFrom {
8
+ /** Start opacity (0–1). Animates to 1. */
9
+ opacity?: number;
10
+ /** Start translateX in px. Animates to 0. */
11
+ x?: number;
12
+ /** Start translateY in px. Animates to 0. */
13
+ y?: number;
14
+ /** Start scale. Animates to 1. */
15
+ scale?: number;
16
+ /** Start rotate in degrees. Animates to 0. */
17
+ rotate?: number;
18
+ /** Start rotateX in degrees. Animates to 0. */
19
+ rotateX?: number;
20
+ /** Start rotateY in degrees. Animates to 0. */
21
+ rotateY?: number;
22
+ }
23
+ type ScrollRevealPreset = 'fadeUp' | 'fadeDown' | 'fadeLeft' | 'fadeRight' | 'scale' | 'flip' | 'flipX';
24
+ interface ScrollRevealOptions {
25
+ /**
26
+ * Named preset for the reveal animation. Default: `'fadeUp'`.
27
+ * Custom `from` overrides the preset when both are provided.
28
+ *
29
+ * Presets:
30
+ * - `fadeUp` — opacity 0→1, y +32→0 (default)
31
+ * - `fadeDown` — opacity 0→1, y -32→0
32
+ * - `fadeLeft` — opacity 0→1, x +32→0
33
+ * - `fadeRight` — opacity 0→1, x -32→0
34
+ * - `scale` — opacity 0→1, scale 0.88→1
35
+ * - `flip` — opacity 0→1, rotateX 20→0
36
+ * - `flipX` — opacity 0→1, rotateY 20→0
37
+ */
38
+ preset?: ScrollRevealPreset;
39
+ /** Custom start state. Keys: opacity, x, y, scale, rotate, rotateX, rotateY. */
40
+ from?: ScrollRevealFrom;
41
+ /**
42
+ * Delay between each element's animation start (seconds).
43
+ * Elements are staggered by offsetting their trigger window.
44
+ * Default: 0.08.
45
+ */
46
+ stagger?: number;
47
+ /** Animation easing. Default: `'ease-out'`. */
48
+ easing?: EasingName | ((t: number) => number);
49
+ /** Freeze at max progress — don't reverse on scroll back. Default: true. */
50
+ once?: boolean;
51
+ /** Override the default trigger window. */
52
+ trigger?: TriggerConfig;
53
+ /** Fires when the first element enters the trigger zone. */
54
+ onEnter?: () => void;
55
+ /** Fires when the last element leaves the trigger zone. */
56
+ onLeave?: () => void;
57
+ }
58
+ interface ScrollRevealInstance {
59
+ /** Remove all animations and restore original styles. */
60
+ destroy: () => void;
61
+ }
62
+ /**
63
+ * Reveal elements as they scroll into view.
64
+ *
65
+ * The zero-config replacement for AOS, ScrollReveal.js, and GSAP + ScrollTrigger
66
+ * for the most common scroll animation use case — in one function call.
67
+ *
68
+ * @example
69
+ * // Fade up (default)
70
+ * scrollReveal('.card');
71
+ *
72
+ * // Custom from state
73
+ * scrollReveal('.feature', { from: { opacity: 0, y: 40, scale: 0.95 } });
74
+ *
75
+ * // Named preset with stagger
76
+ * scrollReveal('.item', { preset: 'fadeLeft', stagger: 0.1 });
77
+ */
78
+ declare function scrollReveal(target: string | NodeList | Element[], options?: ScrollRevealOptions): ScrollRevealInstance;
79
+
80
+ export { type ScrollRevealFrom, type ScrollRevealInstance, type ScrollRevealOptions, type ScrollRevealPreset, scrollReveal };
@@ -0,0 +1 @@
1
+ function Ie({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(r),i=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(a,c);m.push(p),i+=p;}let l=[0],u=0;for(let c=0;c<t;c++)u+=m[c]/i,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),a=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-a)*(2*Math.PI)/r)+1}var _={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:Ie(),elastic:_e()};function U(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 ae(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 ue(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 Ce(e,n,t){return Math.min(t,Math.max(n,e))}function k(e,n,t,r){return t===n?0:Ce((e-n)/(t-n)*r,0,1)}function le(e,n,t){let r=e.getBoundingClientRect(),a=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left+n.scrollLeft:r.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:t==="x"?r.left:r.top,height:a,scroll:t==="x"?window.scrollX:window.scrollY}}function Q(e,n,t,r,a){let i=ae(e.top,e.height,n,r.element)-ue(r.viewport,t),m=ae(e.top,e.height,n,a.element)-ue(a.viewport,t);return {tStart:i,tEnd:m}}function ce(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 me(e,n,t){let r=ce(e),a=ce(n);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*t)},${Math.round(r[1]+(a[1]-r[1])*t)},${Math.round(r[2]+(a[2]-r[2])*t)})`}var Ne="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Fe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",pe=33;function Oe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ve(e){let n=[];for(let t=0;t<pe;t++){let r=t/(pe-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function fe(e){switch(e){case "linear":return "linear";case "ease-in":return Ne;case "ease-out":return Fe;case "ease-in-out":return Oe()?Ve(_["ease-in-out"]):null;default:return null}}var ge=new Map;function de(e,n){ge.set(e,n);}function be(e){ge.delete(e);}var De=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function B(e,...n){De&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function He(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function he(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let a=[],i=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}n.push({fn:r[1],nums:a,units:i});}return n}function Xe(e,n,t){let r=he(e),a=he(n);return r.length===0||r.length!==a.length?t<1?e:n:r.map((i,m)=>{let l=a[m];return i.fn!==l.fn||i.nums.length!==l.nums.length?t<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(l.nums[c]-u)*t}${i.units[c]}`).join(", ")})`}).join(" ")}function ye(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),a=String(n);if(He(r))return me(r,a,t);if(r.includes("("))return Xe(r,a,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&m){let l=parseFloat(i[1]),u=parseFloat(m[1]);return `${l+(u-l)*t}${i[2]||m[2]}`}return t<1?r:a}function ke(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ze=0,we="--scroll-draw-progress";function We(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ee(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:a={},easing:i="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:z,onProgress:C,onComplete:w,onEnter:P,onLeave:A,onEnterBack:N,onLeaveBack:Z}=n,ve=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof i=="function"?i:_[i]??_["ease-out"],J=U(a.start??"top bottom"),K=U(a.end??"bottom top"),ee=z??e,d=typeof c=="string"?document.querySelector(c):c??null,b=Object.entries(r).map(([o,s])=>({prop:ke(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function xe(){let o=window.getComputedStyle(e);for(let s of b)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Me(){for(let o of b)e.style.setProperty(o.prop,String(o.to));}let te=new Map;for(let o of [...b.map(s=>s.prop),we])te.set(o,e.style.getPropertyValue(o));function Y(){for(let[o,s]of te)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(ve)return Me(),w?.(),{...t,destroy:Y,getProgress:()=>1};xe();let ne=typeof i=="string"?fe(i):null;function Pe(){if(!p||!We()||!ne||u!=="y"||d||ee!==e||l||m!==1||C||w||P||A||N||Z||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of b)if(!Be.has(o.prop))return false;return true}function Te(){let o=`ssd-a-${++ze}`,s=b.map(f=>`${f.prop}:${f.from}`).join(";"),H=b.map(f=>`${f.prop}:${f.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${o}{from{${s}}to{${H}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ne};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(o);let y=()=>u==="x"?window.scrollX:window.scrollY,X=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),R.remove(),e.style.animationPlayState="",Y();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let $=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let I of b)e.style.setProperty(I.prop,ye(I.from,I.to,$));},getProgress(){let f=e.getBoundingClientRect(),$=y(),I=X(),{tStart:Ae,tEnd:$e}=Q({top:f.top,height:f.height},$,I,J,K);return W(k($,Ae,$e,m))}}}if(Pe())return Te();let h=0,E=0,S=0,F=false,v=false,T=-1,L=0,O=false,x=NaN,G=-1,re=0,oe=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Le=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function se(){let o=le(ee,d,u),s=Q(o,o.scroll,Le(),J,K);h=s.tStart,E=s.tEnd;}function V(o){e.style.setProperty(we,String(o));for(let s of b)e.style.setProperty(s.prop,ye(s.from,s.to,o));C?.(o);}function Re(o){if(isNaN(x)){x=o;return}x<=0&&o>0?P?.():x>0&&o<=0&&Z?.(),x<1&&o>=1?A?.():x>=1&&o<1&&N?.(),x=o;}function j(){if(!F||v)return;let o=performance.now(),s=oe(),H=m;if(g!==false){let X=o-re,f=X>0?Math.abs(s-(G<0?s:G))/X:0;H=m*Math.max(.2,1+f*(typeof g=="number"?g:1)*.04);}G=s,re=o;let R=E===h?0:(s-h)/(E-h);Re(R);let y=W(k(s,h,E,H));l&&(T=Math.max(T,y),y=T),L=y,V(y),y>=1&&!O?(O=true,w?.()):y<1&&!l&&(O=false),S=requestAnimationFrame(j);}se(),E===h&&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);{let o=W(k(oe(),h,E,m));l&&o>0&&(T=o),L=o,V(o);}let ie=new IntersectionObserver(o=>{o.forEach(s=>{F=s.isIntersecting,F&&!v?S=requestAnimationFrame(j):cancelAnimationFrame(S);});},{root:d??null}),q;function D(){clearTimeout(q),q=setTimeout(se,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),ie.observe(e),de(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(S),ie.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(q),Y(),be(e);},replay(){T=-1,O=false,L=0,v=false,V(0);},pause(){v=true,cancelAnimationFrame(S);},resume(){v&&(v=false,F&&(S=requestAnimationFrame(j)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,T=s,v=true,cancelAnimationFrame(S),V(s);},getProgress(){return L}}}var Ye={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function Ge(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function je(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var Se={destroy:()=>{}};function it(e,n={}){if(typeof window>"u")return Se;let t=je(e);if(!t.length)return B("scrollReveal: no elements found:",e),Se;let{preset:r="fadeUp",from:a,stagger:i=.08,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=n,g={...Ye[r],...a},M=Ge(g),z=Math.min(i*4,4),C=t.map((w,P)=>{let A=Math.max(50,88-P*z),N=Math.max(20,A-35);return Ee(w,{props:M,easing:m,once:l,native:false,trigger:u??{start:`top ${A}%`,end:`top ${N}%`},onEnter:P===0?c:void 0,onLeave:P===t.length-1?p:void 0})});return {destroy(){C.forEach(w=>w.destroy());}}}export{it as scrollReveal};
@@ -1 +1 @@
1
- 'use strict';function q({bounces:e=3,decay:m=.5}={}){let n=Math.max(1,Math.round(e)),l=Math.max(.01,Math.min(.99,m)),b=Math.sqrt(l),u=0,g=[];for(let s=0;s<n;s++){let t=Math.pow(b,s);g.push(t),u+=t;}let c=[0],h=0;for(let s=0;s<n;s++)h+=g[s]/u,c.push(h);return s=>{if(s<=0)return 0;if(s>=1)return 1;for(let t=0;t<n;t++)if(s<=c[t+1]){let r=(s-c[t])/(c[t+1]-c[t]);if(t===0)return r*(2-r);let o=1-Math.pow(l,t);return o+(1-o)*(2*r-1)*(2*r-1)}return 1}}function O({amplitude:e=1,period:m=.4}={}){let n=Math.max(1,e),l=Math.max(.1,m),b=n<=1?l/4:l/(2*Math.PI)*Math.asin(1/n);return u=>u<=0?0:u>=1?1:n*Math.pow(2,-10*u)*Math.sin((u-b)*(2*Math.PI)/l)+1}var v={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:q(),elastic:O()};function A(e,m,n){return Math.min(n,Math.max(m,e))}var $={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function G(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function B(e,m={}){if(typeof window>"u")return $;let n=G(e);if(!n.length)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollSnap: no sections found"),$;let{direction:l="vertical",duration:b=600,easing:u="ease-in-out",threshold:g=.3,scrollContainer:c,onSnap:h}=m,s=typeof u=="function"?u:v[u]??v["ease-in-out"],t=l==="horizontal",r=typeof c=="string"?document.querySelector(c):c??null,o=0,f=false,x=0;function L(){return r?t?r.scrollLeft:r.scrollTop:t?window.scrollX:window.scrollY}function P(a){r?t?r.scrollLeft=a:r.scrollTop=a:window.scrollTo(t?{left:a}:{top:a});}function N(){return n.map(a=>{let i=a.getBoundingClientRect();if(r){let p=r.getBoundingClientRect();return t?i.left-p.left+r.scrollLeft:i.top-p.top+r.scrollTop}return t?i.left+window.scrollX:i.top+window.scrollY})}function S(a){let i=A(a,0,n.length-1);f&&(cancelAnimationFrame(x),f=false),f=true;let p=N(),d=L(),w=p[i];if(Math.abs(d-w)<1){f=false,o=i,h?.(i);return}let I=performance.now();function E(y){let M=A((y-I)/b,0,1);P(d+(w-d)*s(M)),M<1?x=requestAnimationFrame(E):(f=false,o=i,h?.(i));}x=requestAnimationFrame(E);}let T;function F(){f||(clearTimeout(T),T=setTimeout(()=>{let a=L(),i=N();i.forEach((E,y)=>{});let w=t?n[o].offsetWidth:n[o].offsetHeight,I=a-i[o];I>w*g&&o<n.length-1?S(o+1):I<-(w*g)&&o>0?S(o-1):S(o);},100));}let C=r??window;return C.addEventListener("scroll",F,{passive:true}),{destroy(){cancelAnimationFrame(x),clearTimeout(T),C.removeEventListener("scroll",F);},snapTo:S,getCurrentIndex(){return o}}}exports.scrollSnap=B;
1
+ 'use strict';function q({bounces:e=3,decay:o=.5}={}){let t=Math.max(1,Math.round(e)),c=Math.max(.01,Math.min(.99,o)),m=Math.sqrt(c),a=0,M=[];for(let n=0;n<t;n++){let i=Math.pow(m,n);M.push(i),a+=i;}let d=[0],g=0;for(let n=0;n<t;n++)g+=M[n]/a,d.push(g);return n=>{if(n<=0)return 0;if(n>=1)return 1;for(let i=0;i<t;i++)if(n<=d[i+1]){let h=(n-d[i])/(d[i+1]-d[i]);if(i===0)return h*(2-h);let v=1-Math.pow(c,i);return v+(1-v)*(2*h-1)*(2*h-1)}return 1}}function B({amplitude:e=1,period:o=.4}={}){let t=Math.max(1,e),c=Math.max(.1,o),m=t<=1?c/4:c/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-m)*(2*Math.PI)/c)+1}var E={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:q(),elastic:B()};function I(e,o,t){return Math.min(t,Math.max(o,e))}var P=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function V(e,...o){P&&console.warn(`[svg-scroll-draw] ${e}`,...o);}function D(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function O(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let o=window.matchMedia("(prefers-reduced-motion: reduce)"),t=m=>e(!!m.matches);if(typeof o.addEventListener=="function")return o.addEventListener("change",t),()=>o.removeEventListener("change",t);let c=o;return c.addListener?.(t),()=>c.removeListener?.(t)}var Q={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function W(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function J(e,o={}){if(typeof window>"u")return Q;let t=W(e);if(!t.length)return V("scrollSnap: no sections found"),Q;let{direction:c="vertical",duration:m=600,easing:a="ease-in-out",threshold:M=.3,scrollContainer:d,onSnap:g,respectReducedMotion:n=true}=o,i=n&&D(),h=n?O(u=>{i=u;}):()=>{},v=typeof a=="function"?a:E[a]??E["ease-in-out"],f=c==="horizontal",l=typeof d=="string"?document.querySelector(d):d??null,s=0,p=false,L=0;function T(){return l?f?l.scrollLeft:l.scrollTop:f?window.scrollX:window.scrollY}function _(u){l?f?l.scrollLeft=u:l.scrollTop=u:window.scrollTo(f?{left:u}:{top:u});}function R(){return t.map(u=>{let r=u.getBoundingClientRect();if(l){let b=l.getBoundingClientRect();return f?r.left-b.left+l.scrollLeft:r.top-b.top+l.scrollTop}return f?r.left+window.scrollX:r.top+window.scrollY})}function S(u){let r=I(u,0,t.length-1);p&&(cancelAnimationFrame(L),p=false),p=true;let b=R(),w=T(),y=b[r];if(Math.abs(w-y)<1){p=false,s=r,g?.(r);return}if(i){_(y),p=false,s=r,g?.(r);return}let $=performance.now();function N(G){let F=I((G-$)/m,0,1);_(w+(y-w)*v(F)),F<1?L=requestAnimationFrame(N):(p=false,s=r,g?.(r));}L=requestAnimationFrame(N);}let x;function A(){p||(clearTimeout(x),x=setTimeout(()=>{let u=T(),r=R();if(Math.abs(u-r[s])<1)return;let b=f?t[s].offsetWidth:t[s].offsetHeight,w=u-r[s];w>b*M&&s<t.length-1?S(s+1):w<-(b*M)&&s>0?S(s-1):S(s);},100));}let C=l??window;return C.addEventListener("scroll",A,{passive:true}),{destroy(){cancelAnimationFrame(L),clearTimeout(x),C.removeEventListener("scroll",A),h();},snapTo:S,getCurrentIndex(){return s}}}exports.scrollSnap=J;
@@ -16,6 +16,14 @@ interface ScrollSnapOptions {
16
16
  scrollContainer?: string | Element;
17
17
  /** Fires after each snap with the target section index. */
18
18
  onSnap?: (index: number) => void;
19
+ /**
20
+ * Honour `prefers-reduced-motion: reduce` by jumping straight to the target
21
+ * section instead of animating the scroll. Default: `true`.
22
+ *
23
+ * Snapping still happens — only the animated scroll is dropped. Set to `false`
24
+ * only if you have a specific reason to override the user's stated preference.
25
+ */
26
+ respectReducedMotion?: boolean;
19
27
  }
20
28
  interface ScrollSnapInstance {
21
29
  /** Remove snap behaviour and all listeners. */
@@ -16,6 +16,14 @@ interface ScrollSnapOptions {
16
16
  scrollContainer?: string | Element;
17
17
  /** Fires after each snap with the target section index. */
18
18
  onSnap?: (index: number) => void;
19
+ /**
20
+ * Honour `prefers-reduced-motion: reduce` by jumping straight to the target
21
+ * section instead of animating the scroll. Default: `true`.
22
+ *
23
+ * Snapping still happens — only the animated scroll is dropped. Set to `false`
24
+ * only if you have a specific reason to override the user's stated preference.
25
+ */
26
+ respectReducedMotion?: boolean;
19
27
  }
20
28
  interface ScrollSnapInstance {
21
29
  /** Remove snap behaviour and all listeners. */
@@ -1 +1 @@
1
- function q({bounces:e=3,decay:m=.5}={}){let n=Math.max(1,Math.round(e)),l=Math.max(.01,Math.min(.99,m)),b=Math.sqrt(l),u=0,g=[];for(let s=0;s<n;s++){let t=Math.pow(b,s);g.push(t),u+=t;}let c=[0],h=0;for(let s=0;s<n;s++)h+=g[s]/u,c.push(h);return s=>{if(s<=0)return 0;if(s>=1)return 1;for(let t=0;t<n;t++)if(s<=c[t+1]){let r=(s-c[t])/(c[t+1]-c[t]);if(t===0)return r*(2-r);let o=1-Math.pow(l,t);return o+(1-o)*(2*r-1)*(2*r-1)}return 1}}function O({amplitude:e=1,period:m=.4}={}){let n=Math.max(1,e),l=Math.max(.1,m),b=n<=1?l/4:l/(2*Math.PI)*Math.asin(1/n);return u=>u<=0?0:u>=1?1:n*Math.pow(2,-10*u)*Math.sin((u-b)*(2*Math.PI)/l)+1}var v={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:q(),elastic:O()};function A(e,m,n){return Math.min(n,Math.max(m,e))}var $={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function G(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function B(e,m={}){if(typeof window>"u")return $;let n=G(e);if(!n.length)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollSnap: no sections found"),$;let{direction:l="vertical",duration:b=600,easing:u="ease-in-out",threshold:g=.3,scrollContainer:c,onSnap:h}=m,s=typeof u=="function"?u:v[u]??v["ease-in-out"],t=l==="horizontal",r=typeof c=="string"?document.querySelector(c):c??null,o=0,f=false,x=0;function L(){return r?t?r.scrollLeft:r.scrollTop:t?window.scrollX:window.scrollY}function P(a){r?t?r.scrollLeft=a:r.scrollTop=a:window.scrollTo(t?{left:a}:{top:a});}function N(){return n.map(a=>{let i=a.getBoundingClientRect();if(r){let p=r.getBoundingClientRect();return t?i.left-p.left+r.scrollLeft:i.top-p.top+r.scrollTop}return t?i.left+window.scrollX:i.top+window.scrollY})}function S(a){let i=A(a,0,n.length-1);f&&(cancelAnimationFrame(x),f=false),f=true;let p=N(),d=L(),w=p[i];if(Math.abs(d-w)<1){f=false,o=i,h?.(i);return}let I=performance.now();function E(y){let M=A((y-I)/b,0,1);P(d+(w-d)*s(M)),M<1?x=requestAnimationFrame(E):(f=false,o=i,h?.(i));}x=requestAnimationFrame(E);}let T;function F(){f||(clearTimeout(T),T=setTimeout(()=>{let a=L(),i=N();i.forEach((E,y)=>{});let w=t?n[o].offsetWidth:n[o].offsetHeight,I=a-i[o];I>w*g&&o<n.length-1?S(o+1):I<-(w*g)&&o>0?S(o-1):S(o);},100));}let C=r??window;return C.addEventListener("scroll",F,{passive:true}),{destroy(){cancelAnimationFrame(x),clearTimeout(T),C.removeEventListener("scroll",F);},snapTo:S,getCurrentIndex(){return o}}}export{B as scrollSnap};
1
+ function q({bounces:e=3,decay:o=.5}={}){let t=Math.max(1,Math.round(e)),c=Math.max(.01,Math.min(.99,o)),m=Math.sqrt(c),a=0,M=[];for(let n=0;n<t;n++){let i=Math.pow(m,n);M.push(i),a+=i;}let d=[0],g=0;for(let n=0;n<t;n++)g+=M[n]/a,d.push(g);return n=>{if(n<=0)return 0;if(n>=1)return 1;for(let i=0;i<t;i++)if(n<=d[i+1]){let h=(n-d[i])/(d[i+1]-d[i]);if(i===0)return h*(2-h);let v=1-Math.pow(c,i);return v+(1-v)*(2*h-1)*(2*h-1)}return 1}}function B({amplitude:e=1,period:o=.4}={}){let t=Math.max(1,e),c=Math.max(.1,o),m=t<=1?c/4:c/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-m)*(2*Math.PI)/c)+1}var E={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:q(),elastic:B()};function I(e,o,t){return Math.min(t,Math.max(o,e))}var P=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function V(e,...o){P&&console.warn(`[svg-scroll-draw] ${e}`,...o);}function D(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function O(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let o=window.matchMedia("(prefers-reduced-motion: reduce)"),t=m=>e(!!m.matches);if(typeof o.addEventListener=="function")return o.addEventListener("change",t),()=>o.removeEventListener("change",t);let c=o;return c.addListener?.(t),()=>c.removeListener?.(t)}var Q={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function W(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function J(e,o={}){if(typeof window>"u")return Q;let t=W(e);if(!t.length)return V("scrollSnap: no sections found"),Q;let{direction:c="vertical",duration:m=600,easing:a="ease-in-out",threshold:M=.3,scrollContainer:d,onSnap:g,respectReducedMotion:n=true}=o,i=n&&D(),h=n?O(u=>{i=u;}):()=>{},v=typeof a=="function"?a:E[a]??E["ease-in-out"],f=c==="horizontal",l=typeof d=="string"?document.querySelector(d):d??null,s=0,p=false,L=0;function T(){return l?f?l.scrollLeft:l.scrollTop:f?window.scrollX:window.scrollY}function _(u){l?f?l.scrollLeft=u:l.scrollTop=u:window.scrollTo(f?{left:u}:{top:u});}function R(){return t.map(u=>{let r=u.getBoundingClientRect();if(l){let b=l.getBoundingClientRect();return f?r.left-b.left+l.scrollLeft:r.top-b.top+l.scrollTop}return f?r.left+window.scrollX:r.top+window.scrollY})}function S(u){let r=I(u,0,t.length-1);p&&(cancelAnimationFrame(L),p=false),p=true;let b=R(),w=T(),y=b[r];if(Math.abs(w-y)<1){p=false,s=r,g?.(r);return}if(i){_(y),p=false,s=r,g?.(r);return}let $=performance.now();function N(G){let F=I((G-$)/m,0,1);_(w+(y-w)*v(F)),F<1?L=requestAnimationFrame(N):(p=false,s=r,g?.(r));}L=requestAnimationFrame(N);}let x;function A(){p||(clearTimeout(x),x=setTimeout(()=>{let u=T(),r=R();if(Math.abs(u-r[s])<1)return;let b=f?t[s].offsetWidth:t[s].offsetHeight,w=u-r[s];w>b*M&&s<t.length-1?S(s+1):w<-(b*M)&&s>0?S(s-1):S(s);},100));}let C=l??window;return C.addEventListener("scroll",A,{passive:true}),{destroy(){cancelAnimationFrame(L),clearTimeout(x),C.removeEventListener("scroll",A),h();},snapTo:S,getCurrentIndex(){return s}}}export{J as scrollSnap};