svg-scroll-draw 2.6.0 → 2.7.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 (54) hide show
  1. package/dist/angular/index.cjs +3 -3
  2. package/dist/angular/index.d.mts +16 -0
  3. package/dist/angular/index.d.ts +16 -0
  4. package/dist/angular/index.mjs +3 -3
  5. package/dist/astro/index.cjs +3 -3
  6. package/dist/astro/index.d.mts +8 -0
  7. package/dist/astro/index.d.ts +8 -0
  8. package/dist/astro/index.mjs +3 -3
  9. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  10. package/dist/devtools/index.cjs +1 -1
  11. package/dist/devtools/index.mjs +1 -1
  12. package/dist/group/index.cjs +3 -3
  13. package/dist/group/index.d.mts +16 -0
  14. package/dist/group/index.d.ts +16 -0
  15. package/dist/group/index.mjs +3 -3
  16. package/dist/index.cjs +4 -4
  17. package/dist/index.d.mts +16 -0
  18. package/dist/index.d.ts +16 -0
  19. package/dist/index.mjs +4 -4
  20. package/dist/lenis/index.cjs +1 -0
  21. package/dist/lenis/index.d.mts +51 -0
  22. package/dist/lenis/index.d.ts +51 -0
  23. package/dist/lenis/index.mjs +1 -0
  24. package/dist/nuxt/index.cjs +3 -3
  25. package/dist/nuxt/index.d.mts +16 -0
  26. package/dist/nuxt/index.d.ts +16 -0
  27. package/dist/nuxt/index.mjs +3 -3
  28. package/dist/pin/index.cjs +1 -0
  29. package/dist/pin/index.d.mts +29 -0
  30. package/dist/pin/index.d.ts +29 -0
  31. package/dist/pin/index.mjs +1 -0
  32. package/dist/react/index.cjs +3 -3
  33. package/dist/react/index.d.mts +16 -0
  34. package/dist/react/index.d.ts +16 -0
  35. package/dist/react/index.mjs +3 -3
  36. package/dist/snap/index.cjs +1 -0
  37. package/dist/snap/index.d.mts +30 -0
  38. package/dist/snap/index.d.ts +30 -0
  39. package/dist/snap/index.mjs +1 -0
  40. package/dist/solid/index.cjs +3 -3
  41. package/dist/solid/index.d.mts +16 -0
  42. package/dist/solid/index.d.ts +16 -0
  43. package/dist/solid/index.mjs +3 -3
  44. package/dist/svelte/index.cjs +3 -3
  45. package/dist/svelte/index.d.mts +16 -0
  46. package/dist/svelte/index.d.ts +16 -0
  47. package/dist/svelte/index.mjs +3 -3
  48. package/dist/vue/index.cjs +2 -2
  49. package/dist/vue/index.d.mts +16 -0
  50. package/dist/vue/index.d.ts +16 -0
  51. package/dist/vue/index.mjs +2 -2
  52. package/dist/web-component/index.cjs +3 -3
  53. package/dist/web-component/index.mjs +3 -3
  54. package/package.json +16 -1
@@ -1,3 +1,3 @@
1
- 'use strict';function Et({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),u=Math.sqrt(t),o=0,m=[];for(let d=0;d<n;d++){let I=Math.pow(u,d);m.push(I),o+=I;}let l=[0],c=0;for(let d=0;d<n;d++)c+=m[d]/o,l.push(c);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let I=0;I<n;I++)if(d<=l[I+1]){let B=(d-l[I])/(l[I+1]-l[I]);if(I===0)return B*(2-B);let E=1-Math.pow(t,I);return E+(1-E)*(2*B-1)*(2*B-1)}return 1}}function St({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),u=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-u)*(2*Math.PI)/t)+1}var ae={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:Et(),elastic:St()};function le(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Ye(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function je(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Re(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function xt(e,r,n){return Math.min(n,Math.max(r,e))}function J(e,r,n,t){return n===r?0:xt((e-r)/(n-r)*t,0,1)}function fe(e,r,n,t,u){let o=Ye(e.top,e.height,r,t.element)-je(t.viewport,n),m=Ye(e.top,e.height,r,u.element)-je(u.viewport,n);return {tStart:o,tEnd:m}}function Ue(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Ce(e,r,n){let t=Ue(e),u=Ue(r);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*n)},${Math.round(t[1]+(u[1]-t[1])*n)},${Math.round(t[2]+(u[2]-t[2])*n)})`}var Ze={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 Je(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var Ke={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Tt=0;function At(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Mt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?Je("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&Je("Element has a fill \u2014 it may obscure the stroke animation.",e);}function $t(e,r,n){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 u(){let o=n==="x"?window.scrollX:window.scrollY,m=e-o,l=r-o,c=n==="x";t.innerHTML=`
2
- <div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}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;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}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",u,{passive:true}),u(),t}function We(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let m=parseFloat(o),l=t[u++]??m;return String(+(m+(l-m)*n).toFixed(4))})}function Qe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,u=n?{...Ze[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:d="linear",trigger:I={},stagger:B=0,direction:E="forward",once:re=false,debug:de=false,axis:q="y",scrollContainer:K,autoReverse:T=false,delay:N=0,strokeColor:A,strokeWidth:$,fillOpacity:P,waypoints:b,velocityScale:L=false,threshold:O=0,rootMargin:D="0px",repeat:M=0,repeatDelay:z=0,morphTo:C,clip:_,autoplay:Q=false,duration:j=1e3,native:oe=true,onProgress:f,onStart:k,onComplete:h}=u,p=_===true?"left":typeof _=="string"?_:false,F=typeof d=="function"?d:ae[d]??ae.linear,ge=le(I.start??"top bottom"),a=le(I.end??"bottom top"),g=typeof K=="string"?document.querySelector(K):K??null,ne=Array.isArray(A)?A[0]:null,V=Array.isArray(A)?A[1]:typeof A=="string"?A:null,U=Array.isArray($)?$[0]:null,se=Array.isArray($)?$[1]:typeof $=="number"?$:null,H=Array.isArray(P)?P[0]:null,G=Array.isArray(P)?P[1]:typeof P=="number"?P:null;function me(s){let i=s*100;switch(p){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let ee=p?[]:Array.from(e.querySelectorAll(m)),X=[],ye=[],Ee=0,Se=0,ie=false,he=false,te=0,Ie=false,be=-1,Oe=-1,ce=false,$e=0,ve=0,xe,ze=null,Te=new Set,Fe=-1,Be=performance.now();function ke(){return g?q==="x"?g.scrollLeft:g.scrollTop:q==="x"?window.scrollX:window.scrollY}function Ge(){return g?q==="x"?g.clientWidth:g.clientHeight:q==="x"?window.innerWidth:window.innerHeight}function Xe(){let s=e.getBoundingClientRect(),i,v,Y;if(g){let ue=g.getBoundingClientRect();i=q==="x"?s.left-ue.left+g.scrollLeft:s.top-ue.top+g.scrollTop,v=q==="x"?s.width:s.height,Y=ke();}else i=q==="x"?s.left:s.top,v=q==="x"?s.width:s.height,Y=ke();let pe=fe({top:i,height:v},Y,Ge(),ge,a);Ee=pe.tStart,Se=pe.tEnd,de&&process.env.NODE_ENV!=="production"&&(ze?.remove(),ze=$t(Ee,Se,q));}function yt(s,i){if(e.style.setProperty("--scroll-draw-progress",String(s)),p){let v=i==="reverse"?1-s:s;e.style.clipPath=me(v);return}ee.forEach((v,Y)=>{v.style.strokeDashoffset=i==="reverse"?`${X[Y]*s}`:`${X[Y]*(1-s)}`,c&&(v.style.opacity=i==="reverse"?`${1-s}`:`${s}`),ne&&V?v.style.stroke=Ce(ne,V,s):V&&(v.style.stroke=V),U!==null&&se!==null?v.style.strokeWidth=`${U+(se-U)*s}`:se!==null&&(v.style.strokeWidth=`${se}`),H!==null&&G!==null?v.style.fillOpacity=`${H+(G-H)*s}`:G!==null&&(v.style.fillOpacity=`${G}`),C&&v.tagName.toLowerCase()==="path"&&ye[Y]&&v.setAttribute("d",We(ye[Y],C,s));});}function De(){if(e.style.setProperty("--scroll-draw-progress","0"),p){e.style.clipPath=me(0);return}ee.forEach((s,i)=>{s.style.strokeDasharray=`${X[i]}`,s.style.strokeDashoffset=E==="reverse"?"0":`${X[i]}`,c?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",ne&&(s.style.stroke=ne),U!==null&&(s.style.strokeWidth=`${U}`),H!==null&&(s.style.fillOpacity=`${H}`),C&&s.tagName.toLowerCase()==="path"&&ye[i]&&s.setAttribute("d",ye[i]);});}if(ee.forEach(s=>{Mt(s);let i=Re(s);X.push(i),s.tagName.toLowerCase()==="path"?ye.push(s.getAttribute("d")??""):ye.push(""),o?(s.style.strokeDasharray=`${i}`,s.style.strokeDashoffset=E==="reverse"?`${i}`:"0",c&&(s.style.opacity="1"),V&&(s.style.stroke=V),se!==null&&(s.style.strokeWidth=`${se}`),G!==null&&(s.style.fillOpacity=`${G}`),C&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",C)):(s.style.strokeDasharray=`${i}`,s.style.strokeDashoffset=E==="reverse"?"0":`${i}`,c?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",ne&&(s.style.stroke=ne),U!==null&&(s.style.strokeWidth=`${U}`),H!==null&&(s.style.fillOpacity=`${H}`));}),p){if(o)return e.style.clipPath=me(1),h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=me(0);}else if(o)return h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(oe===false||!At()||!ee.length||typeof d!="string"||!(d in Ke)||p||q!=="y"||g||l!==1||B!==0||re||T||L!==false||C||b||M||N>0||f||k||h||A!=null||$!=null||P!=null||(I.start??"top bottom").trim()!=="top bottom"||(I.end??"bottom top").trim()!=="bottom top")}function wt(){let s=`svg-scroll-draw-${++Tt}`,i=E==="reverse"?"0":"var(--ssd-len)",v=E==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${i};`,pe=`stroke-dashoffset:${v};`;c&&(Y+=`opacity:${E==="reverse"?1:0};`,pe+=`opacity:${E==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${s}{from{${Y}}to{${pe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ke[d]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function w(y,x){y.style.setProperty("--ssd-len",String(X[x])),y.style.strokeDasharray=`${X[x]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(s);}ee.forEach(w);let R=false,Z=-1;function S(){if(Z>=0)return Z;let y=e.getBoundingClientRect(),{tStart:x,tEnd:W}=fe({top:y.top,height:y.height},ke(),Ge(),ge,a);return F(J(ke(),x,W,l))}return {destroy(){ee.forEach(y=>{y.classList.remove(s),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),ue.remove();},replay(){R=false,Z=-1,ee.forEach(w);},pause(){R=true,ee.forEach(y=>{y.style.animationPlayState="paused";});},resume(){R&&(R=false,ee.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let x=Math.min(1,Math.max(0,y));Z=x,R=true,ee.forEach((W,Pe)=>{W.classList.remove(s),W.style.strokeDashoffset=E==="reverse"?`${X[Pe]*x}`:`${X[Pe]*(1-x)}`,c&&(W.style.opacity=E==="reverse"?`${1-x}`:`${x}`);});},getProgress(){return S()}}}if(bt())return wt();function vt(){let s=Math.max(1,j),i=0,v=0;function Y(S){let y=true;if(p){let x=Math.min(1,Math.max(0,S/s)),W=F(x);$e=W,e.style.setProperty("--scroll-draw-progress",String(W)),e.style.clipPath=me(E==="reverse"?1-W:W),f?.(W),x<1&&(y=false);}else ee.forEach((x,W)=>{let Pe=W*B*s,Le=Math.min(1,Math.max(0,(S-Pe)/s)),we=F(Le);x.style.strokeDashoffset=E==="reverse"?`${X[W]*we}`:`${X[W]*(1-we)}`,c&&(x.style.opacity=E==="reverse"?`${1-we}`:`${we}`),ne&&V?x.style.stroke=Ce(ne,V,we):V&&(x.style.stroke=V),U!==null&&se!==null?x.style.strokeWidth=`${U+(se-U)*we}`:se!==null&&(x.style.strokeWidth=`${se}`),H!==null&&G!==null?x.style.fillOpacity=`${H+(G-H)*we}`:G!==null&&(x.style.fillOpacity=`${G}`),C&&x.tagName.toLowerCase()==="path"&&ye[W]&&x.setAttribute("d",We(ye[W],C,we)),W===0&&(f?.(we),e.style.setProperty("--scroll-draw-progress",String(we))),Le<1&&(y=false);});if(b){let x=Math.min(1,Math.max(0,S/s)),W=F(x);for(let Pe in b){let Le=parseFloat(Pe);W>=Le&&!Te.has(Le)&&(Te.add(Le),b[Pe]?.());}}return y}function pe(S){if(ce)return;let y=S-i;he||(he=true,k?.());let x=Y(y);if(x&&!ie){ie=true,Y(s*(1+Math.max(0,ee.length-1)*B)),h?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{i=performance.now(),he=false,ie=false,Te.clear(),De(),te=requestAnimationFrame(pe);},z));return}x||(te=requestAnimationFrame(pe));}function ue(){cancelAnimationFrame(te),clearTimeout(xe),i=performance.now(),v=0,ce=false,he=false,ie=false,ve=0,Te.clear(),De(),te=requestAnimationFrame(pe);}let w=new IntersectionObserver(S=>{S.forEach(y=>{y.isIntersecting&&!(re&&ie)?ue():!y.isIntersecting&&!re&&!ie&&(cancelAnimationFrame(te),clearTimeout(xe),i=null);});},{root:g??null,threshold:O,rootMargin:D}),R;function Z(){clearTimeout(R),R=setTimeout(()=>{ee.forEach((S,y)=>{X[y]=Re(S),S.style.strokeDasharray=`${X[y]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),N>0?setTimeout(()=>w.observe(e),N):w.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(xe),w.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(R);},replay(){ve=0,ue();},pause(){ce||(ce=true,v=performance.now()-i,cancelAnimationFrame(te));},resume(){ce&&(ce=false,i=performance.now()-v,te=requestAnimationFrame(pe));},seek(S){let y=Math.min(1,Math.max(0,S));$e=y,ce=true,v=y*s,i=performance.now()-v,cancelAnimationFrame(te),Y(v);},getProgress(){return $e}}}if(Q)return vt();Xe();function Ne(){if(!Ie||ce)return;let s=performance.now(),i=ke(),v=l;if(L!==false){let w=s-Be,R=w>0?Math.abs(i-(Fe<0?i:Fe))/w:0;v=l*Math.max(.2,1+R*(typeof L=="number"?L:1)*.04);}Fe=i,Be=s;let Y=T?Oe===-1||i>=Oe?"forward":"reverse":E;Oe=i;let pe=Se-Ee,ue=true;if(p){let w=F(J(i,Ee,Se,v));re&&!T&&(be=Math.max(be,w),w=be),$e=w,e.style.setProperty("--scroll-draw-progress",String(w));let R=Y==="reverse"?1-w:w;e.style.clipPath=me(R),f?.(w),!he&&J(i,Ee,Se,v)>0&&(he=true,k?.()),w>=1&&!ie?(ie=true,h?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{be=-1,he=false,ie=false,e.style.clipPath=me(0);},z))):w<1&&!re&&(ie=false),te=requestAnimationFrame(Ne);return}if(ee.forEach((w,R)=>{let Z=R*B*pe,S=F(J(i,Ee+Z,Se+Z,v));re&&!T&&(be=Math.max(be,S),S=be),$e=S,w.style.strokeDashoffset=Y==="reverse"?`${X[R]*S}`:`${X[R]*(1-S)}`,c&&(w.style.opacity=Y==="reverse"?`${1-S}`:`${S}`),ne&&V?w.style.stroke=Ce(ne,V,S):V&&(w.style.stroke=V),U!==null&&se!==null?w.style.strokeWidth=`${U+(se-U)*S}`:se!==null&&(w.style.strokeWidth=`${se}`),H!==null&&G!==null?w.style.fillOpacity=`${H+(G-H)*S}`:G!==null&&(w.style.fillOpacity=`${G}`),C&&w.tagName.toLowerCase()==="path"&&ye[R]&&w.setAttribute("d",We(ye[R],C,S)),R===0&&(f?.(S),e.style.setProperty("--scroll-draw-progress",String(S))),S<1&&(ue=false);}),b){let w=F(J(i,Ee,Se,v));for(let R in b){let Z=parseFloat(R);w>=Z&&!Te.has(Z)&&(Te.add(Z),b[R]?.());}}!he&&J(i,Ee,Se,v)>0&&(he=true,k?.()),ue&&!ie?(ie=true,h?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{be=-1,he=false,ie=false,Te.clear(),De();},z))):!ue&&!re&&(ie=false),te=requestAnimationFrame(Ne);}let Ve=new IntersectionObserver(s=>{s.forEach(i=>{Ie=i.isIntersecting,Ie&&!ce?te=requestAnimationFrame(Ne):cancelAnimationFrame(te);});},{root:g??null,threshold:O,rootMargin:D}),qe;function He(){clearTimeout(qe),qe=setTimeout(()=>{ee.forEach((s,i)=>{X[i]=Re(s),s.style.strokeDasharray=`${X[i]}`;}),Xe();},150);}return window.addEventListener("resize",He),window.addEventListener("orientationchange",He),N>0?setTimeout(()=>Ve.observe(e),N):Ve.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(xe),Ve.disconnect(),window.removeEventListener("resize",He),window.removeEventListener("orientationchange",He),clearTimeout(qe),ze?.remove();},replay(){be=-1,Oe=-1,Fe=-1,he=false,ie=false,ve=0,ce=false,Te.clear(),clearTimeout(xe),De();},pause(){ce=true,cancelAnimationFrame(te);},resume(){ce&&(ce=false,Ie&&(te=requestAnimationFrame(Ne)));},seek(s){let i=Math.min(1,Math.max(0,s));$e=i,be=i,ce=true,cancelAnimationFrame(te),yt(i,E);},getProgress(){return $e}}}var et=new Map;function Ae(e,r){et.set(e,r);}function Me(e){et.delete(e);}function Pt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function tt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let u=[],o=[],m=t[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}r.push({fn:t[1],nums:u,units:o});}return r}function Lt(e,r,n){let t=tt(e),u=tt(r);return t.length===0||t.length!==u.length?n<1?e:r:t.map((o,m)=>{let l=u[m];return o.fn!==l.fn||o.nums.length!==l.nums.length?n<1?`${o.fn}(${o.nums.map((c,d)=>`${c}${o.units[d]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,d)=>`${c}${l.units[d]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,d)=>`${c+(l.nums[d]-c)*n}${o.units[d]}`).join(", ")})`}).join(" ")}function rt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),u=String(r);if(Pt(t))return Ce(t,u,n);if(t.includes("("))return Lt(t,u,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),m=u.match(/^([-+]?[\d.]+)(.*)$/);if(o&&m){let l=parseFloat(o[1]),c=parseFloat(m[1]);return `${l+(c-l)*n}${o[2]||m[2]}`}return n<1?t:u}function Ct(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var nt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),It=0;function Ot(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function st(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:u={},easing:o="ease-out",speed:m=1,once:l=false,axis:c="y",scrollContainer:d,native:I=true,onProgress:B,onComplete:E}=r,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,de=typeof o=="function"?o:ae[o]??ae["ease-out"],q=le(u.start??"top bottom"),K=le(u.end??"bottom top"),T=typeof d=="string"?document.querySelector(d):d??null,N=Object.entries(t).map(([a,g])=>({prop:Ct(a),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function A(){let a=window.getComputedStyle(e);for(let g of N)g.from===""&&(g.from=a.getPropertyValue(g.prop).trim()||"0");}function $(){for(let a of N)e.style.setProperty(a.prop,String(a.to));}if(re)return $(),E?.(),n;A();function P(){if(!I||!Ot()||typeof o!="string"||!(o in nt)||c!=="y"||T||l||m!==1||B||E||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let a of N)if(!kt.has(a.prop))return false;return true}function b(){let a=`ssd-a-${++It}`,g=N.map(H=>`${H.prop}:${H.from}`).join(";"),ne=N.map(H=>`${H.prop}:${H.to}`).join(";"),V=document.createElement("style");V.setAttribute("data-ssd-animate",""),V.textContent=`@keyframes ${a}{from{${g}}to{${ne}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${nt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(V),e.classList.add(a);let U=()=>c==="x"?window.scrollX:window.scrollY,se=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),V.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(H){let G=Math.min(1,Math.max(0,H));e.classList.remove(a);for(let me of N)e.style.setProperty(me.prop,rt(me.from,me.to,G));},getProgress(){let H=e.getBoundingClientRect(),G=U(),me=se(),{tStart:ee,tEnd:X}=fe({top:H.top,height:H.height},G,me,q,K);return de(J(G,ee,X,m))}}}if(P())return b();let L=0,O=0,D=0,M=false,z=false,C=-1,_=0,Q=false,j=()=>T?c==="x"?T.scrollLeft:T.scrollTop:c==="x"?window.scrollX:window.scrollY,oe=()=>T?c==="x"?T.clientWidth:T.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function f(){let a=e.getBoundingClientRect(),g,ne;if(T){let U=T.getBoundingClientRect();g=c==="x"?a.left-U.left+T.scrollLeft:a.top-U.top+T.scrollTop,ne=c==="x"?a.width:a.height;}else g=c==="x"?a.left:a.top,ne=c==="x"?a.width:a.height;let V=fe({top:g,height:ne},j(),oe(),q,K);L=V.tStart,O=V.tEnd;}function k(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let g of N)e.style.setProperty(g.prop,rt(g.from,g.to,a));B?.(a);}function h(){if(!M||z)return;let a=de(J(j(),L,O,m));l&&(C=Math.max(C,a),a=C),_=a,k(a),a>=1&&!Q?(Q=true,E?.()):a<1&&!l&&(Q=false),D=requestAnimationFrame(h);}f();{let a=de(J(j(),L,O,m));l&&a>0&&(C=a),_=a,k(a);}let p=new IntersectionObserver(a=>{a.forEach(g=>{M=g.isIntersecting,M&&!z?D=requestAnimationFrame(h):cancelAnimationFrame(D);});},{root:T??null}),F;function ge(){clearTimeout(F),F=setTimeout(f,150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),p.observe(e),Ae(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:L,tEnd:O})}),{destroy(){cancelAnimationFrame(D),p.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(F),Me(e);},replay(){C=-1,Q=false,_=0,z=false,k(0);},pause(){z=true,cancelAnimationFrame(D);},resume(){z&&(z=false,M&&(D=requestAnimationFrame(h)));},seek(a){let g=Math.min(1,Math.max(0,a));_=g,C=g,z=true,cancelAnimationFrame(D),k(g);},getProgress(){return _}}}var _e={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ot(e,r){if(typeof window>"u")return _e;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),_e;let t=n,{from:u=0,to:o,format:m,easing:l="ease-out",trigger:c={},once:d=true,decimals:I,onComplete:B}=r,E=I!==void 0?f=>f.toFixed(I):m??(f=>String(Math.round(f))),re=typeof l=="function"?l:ae[l]??ae["ease-out"],de=le(c.start??"top 80%"),q=le(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(o),B?.(),_e;t.textContent=E(u);let T=0,N=0,A=0,$=false,P=false,b=-1,L=0,O=false,D=()=>window.scrollY,M=()=>window.innerHeight;function z(){let f=t.getBoundingClientRect(),k=fe({top:f.top,height:f.height},D(),M(),de,q);T=k.tStart,N=k.tEnd;}function C(f){t.textContent=E(u+(o-u)*f),t.style.setProperty("--scroll-draw-progress",String(f));}function _(){if(!$||P)return;let f=re(J(D(),T,N,1));d&&(b=Math.max(b,f),f=b),L=f,C(f),f>=1&&!O?(O=true,B?.()):f<1&&!d&&(O=false),A=requestAnimationFrame(_);}z();{let f=re(J(D(),T,N,1));d&&f>0&&(b=f),L=f,C(f);}let Q=new IntersectionObserver(f=>{f.forEach(k=>{$=k.isIntersecting,$&&!P?A=requestAnimationFrame(_):cancelAnimationFrame(A);});}),j;function oe(){clearTimeout(j),j=setTimeout(z,150);}return window.addEventListener("resize",oe),window.addEventListener("orientationchange",oe),Q.observe(t),Ae(t,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:T,tEnd:N})}),{destroy(){cancelAnimationFrame(A),Q.disconnect(),window.removeEventListener("resize",oe),window.removeEventListener("orientationchange",oe),clearTimeout(j),Me(t);},replay(){b=-1,O=false,L=0,P=false,C(0);},pause(){P=true,cancelAnimationFrame(A);},resume(){P&&(P=false,$&&(A=requestAnimationFrame(_)));},seek(f){let k=Math.min(1,Math.max(0,f));L=k,b=k,P=true,cancelAnimationFrame(A),C(k);},getProgress(){return L}}}var it={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function at(e,r={}){if(typeof window>"u")return it;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),it;let t=n,{trigger:u={},easing:o="linear",once:m=false,axis:l="y",preload:c="auto",onReady:d,onComplete:I,onProgress:B}=r,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:ae[o]??ae.linear,de=le(u.start??"top top"),q=le(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let K=r.from??0,T=r.to,N=0,A=0,$=0,P=false,b=false,L=-1,O=0,D=false,M=false,z=()=>l==="x"?window.scrollX:window.scrollY,C=()=>l==="x"?window.innerWidth:window.innerHeight;function _(){let p=t.getBoundingClientRect(),F=l==="x"?p.left:p.top,ge=l==="x"?p.width:p.height,a=fe({top:F,height:ge},z(),C(),de,q);N=a.tStart,A=a.tEnd;}function Q(p){if(!M)return;let F=T??t.duration??0;t.currentTime=K+(F-K)*p,t.style.setProperty("--scroll-draw-progress",String(p)),B?.(p);}function j(){if(!P||b||!M)return;let p=re(J(z(),N,A,1));m&&(L=Math.max(L,p),p=L),O=p,Q(p),p>=1&&!D?(D=true,I?.()):p<1&&!m&&(D=false),$=requestAnimationFrame(j);}function oe(){if(M=true,T===void 0&&(T=t.duration),E){Q(1),d?.();return}_(),d?.(),P&&!b&&($=requestAnimationFrame(j));}t.readyState>=1?oe():t.addEventListener("loadedmetadata",oe,{once:true}),M||_();let f=new IntersectionObserver(p=>{p.forEach(F=>{P=F.isIntersecting,P&&!b&&M?$=requestAnimationFrame(j):cancelAnimationFrame($);});}),k;function h(){clearTimeout(k),k=setTimeout(_,150);}return window.addEventListener("resize",h),window.addEventListener("orientationchange",h),f.observe(t),Ae(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:N,tEnd:A})}),{destroy(){cancelAnimationFrame($),f.disconnect(),t.removeEventListener("loadedmetadata",oe),window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),clearTimeout(k),Me(t);},replay(){L=-1,D=false,O=0,b=false,Q(0);},pause(){b=true,cancelAnimationFrame($);},resume(){b&&(b=false,P&&M&&($=requestAnimationFrame(j)));},seek(p){let F=Math.min(1,Math.max(0,p));O=F,L=F,b=true,cancelAnimationFrame($),Q(F);},getProgress(){return O}}}function ut(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function Ft(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function lt(e){let r=ut(e),n=new Map;for(let o of r){let m=o.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(o);}let t=[],u=Array.from(n.keys()).sort((o,m)=>o-m);for(let o of u){let m=n.get(o),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of m)l.appendChild(c);t.push(l);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function Dt(e,r,n,t){if(n<=1||t===0)return e;let u=(n-1)*t,o=r*t,m=o+(1-u);return m<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(m-o)))}function Nt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,r={}){if(typeof window>"u")return ct;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),ct;let t=n,{split:u="words",stagger:o=.04,easing:m="ease-out",from:l={opacity:0,y:24},trigger:c={},once:d=true,onComplete:I}=r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof m=="function"?m:ae[m]??ae["ease-out"],re=le(c.start??"top 85%"),de=le(c.end??"top 40%"),q=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let K;u==="chars"?K=Ft(t):u==="lines"?K=lt(t):K=ut(t);let T=K.length;function N(h,p){l?.opacity!==void 0&&(h.style.opacity=String(l.opacity+(1-l.opacity)*p));let F=Nt(p,l);F&&(h.style.transform=F);}function A(h){t.style.setProperty("--scroll-draw-progress",String(h)),K.forEach((p,F)=>{let ge=E(Dt(h,F,T,o));N(p,ge);});}if(B)return A(1),I?.(),{destroy(){t.innerHTML=q,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,P=0,b=0,L=false,O=false,D=-1,M=0,z=false,C=()=>window.scrollY,_=()=>window.innerHeight;function Q(){let h=t.getBoundingClientRect(),p=fe({top:h.top,height:h.height},C(),_(),re,de);$=p.tStart,P=p.tEnd;}function j(){if(!L||O)return;let h=J(C(),$,P,1);d&&(D=Math.max(D,h),h=D),M=h,A(h),h>=1&&!z?(z=true,I?.()):h<1&&!d&&(z=false),b=requestAnimationFrame(j);}Q();let oe=new IntersectionObserver(h=>{h.forEach(p=>{L=p.isIntersecting,L&&!O?b=requestAnimationFrame(j):cancelAnimationFrame(b);});}),f;function k(){clearTimeout(f),f=setTimeout(()=>{if(u==="lines"){let h=M;t.innerHTML=q,t.setAttribute("aria-label",t.textContent??""),K=lt(t),A(h);}Q();},150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),oe.observe(t),Ae(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:$,tEnd:P})}),{destroy(){cancelAnimationFrame(b),oe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(f),t.innerHTML=q,t.removeAttribute("aria-label"),Me(t);},replay(){D=-1,z=false,M=0,O=false,A(0);},pause(){O=true,cancelAnimationFrame(b);},resume(){O&&(O=false,L&&(b=requestAnimationFrame(j)));},seek(h){let p=Math.min(1,Math.max(0,h));M=p,D=p,O=true,cancelAnimationFrame(b),A(p);},getProgress(){return M}}}var pt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=Qe(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},ft=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=st(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},dt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ot(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},gt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=at(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},ht=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=mt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};exports.ScrollAnimateRef=ft;exports.ScrollCounterRef=dt;exports.ScrollDrawRef=pt;exports.ScrollTextRef=ht;exports.ScrollVideoRef=gt;
1
+ 'use strict';function Mt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),u=Math.sqrt(t),o=0,f=[];for(let y=0;y<n;y++){let $=Math.pow(u,y);f.push($),o+=$;}let l=[0],c=0;for(let y=0;y<n;y++)c+=f[y]/o,l.push(c);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let $=0;$<n;$++)if(y<=l[$+1]){let B=(y-l[$])/(l[$+1]-l[$]);if($===0)return B*(2-B);let S=1-Math.pow(t,$);return S+(1-S)*(2*B-1)*(2*B-1)}return 1}}function Pt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),u=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-u)*(2*Math.PI)/t)+1}var ie={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:Mt(),elastic:Pt()};function ae(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Ke(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Qe(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function $t(e,r,n){return Math.min(n,Math.max(r,e))}function K(e,r,n,t){return n===r?0:$t((e-r)/(n-r)*t,0,1)}function pe(e,r,n,t,u){let o=Ke(e.top,e.height,r,t.element)-Qe(t.viewport,n),f=Ke(e.top,e.height,r,u.element)-Qe(u.viewport,n);return {tStart:o,tEnd:f}}function et(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Fe(e,r,n){let t=et(e),u=et(r);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*n)},${Math.round(t[1]+(u[1]-t[1])*n)},${Math.round(t[2]+(u[2]-t[2])*n)})`}var tt={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 rt(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var nt={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 kt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?rt("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&rt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function It(e,r,n){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 u(){let o=n==="x"?window.scrollX:window.scrollY,f=e-o,l=r-o,c=n==="x";t.innerHTML=`
2
+ <div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${f}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;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}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",u,{passive:true}),u(),t}function Ye(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let f=parseFloat(o),l=t[u++]??f;return String(+(f+(l-f)*n).toFixed(4))})}function st(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,u=n?{...tt[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:y="linear",trigger:$={},stagger:B=0,direction:S="forward",once:Q=false,debug:ye=false,axis:R="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:G="0px",repeat:L=0,repeatDelay:N=0,morphTo:M,clip:z,autoplay:re=false,duration:D=1e3,native:W=true,onProgress:d,onStart:P,onComplete:g,onEnter:h,onLeave:X,onEnterBack:Se,onLeaveBack:be}=u,we=z===true?"left":typeof z=="string"?z:false,de=typeof y=="function"?y:ie[y]??ie.linear,Ne=ae($.start??"top bottom"),ke=ae($.end??"bottom top"),U=typeof ee=="string"?document.querySelector(ee):ee??null,i=Array.isArray(x)?x[0]:null,p=Array.isArray(x)?x[1]:typeof x=="string"?x:null,Y=Array.isArray(A)?A[0]:null,H=Array.isArray(A)?A[1]:typeof A=="number"?A:null,Z=Array.isArray(w)?w[0]:null,se=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(s){let a=s*100;switch(we){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=we?[]:Array.from(e.querySelectorAll(f)),I=[],me=[],ge=0,Te=0,oe=false,he=false,ne=0,He=false,ve=-1,Re=-1,le=false,Le=0,xe=0,Ae,Be=null,Me=new Set,ze=-1,Ue=performance.now(),Ie=NaN;function De(){return U?R==="x"?U.scrollLeft:U.scrollTop:R==="x"?window.scrollX:window.scrollY}function Ze(){return U?R==="x"?U.clientWidth:U.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Je(){let s=e.getBoundingClientRect(),a,E,j;if(U){let ue=U.getBoundingClientRect();a=R==="x"?s.left-ue.left+U.scrollLeft:s.top-ue.top+U.scrollTop,E=R==="x"?s.width:s.height,j=De();}else a=R==="x"?s.left:s.top,E=R==="x"?s.width:s.height,j=De();let ce=pe({top:a,height:E},j,Ze(),Ne,ke);ge=ce.tStart,Te=ce.tEnd,ye&&process.env.NODE_ENV!=="production"&&(Be?.remove(),Be=It(ge,Te,R));}function St(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),we){let E=a==="reverse"?1-s:s;e.style.clipPath=J(E);return}_.forEach((E,j)=>{E.style.strokeDashoffset=a==="reverse"?`${I[j]*s}`:`${I[j]*(1-s)}`,c&&(E.style.opacity=a==="reverse"?`${1-s}`:`${s}`),i&&p?E.style.stroke=Fe(i,p,s):p&&(E.style.stroke=p),Y!==null&&H!==null?E.style.strokeWidth=`${Y+(H-Y)*s}`:H!==null&&(E.style.strokeWidth=`${H}`),Z!==null&&se!==null?E.style.fillOpacity=`${Z+(se-Z)*s}`:se!==null&&(E.style.fillOpacity=`${se}`),M&&E.tagName.toLowerCase()==="path"&&me[j]&&E.setAttribute("d",Ye(me[j],M,s));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}_.forEach((s,a)=>{s.style.strokeDasharray=`${I[a]}`,s.style.strokeDashoffset=S==="reverse"?"0":`${I[a]}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`),M&&s.tagName.toLowerCase()==="path"&&me[a]&&s.setAttribute("d",me[a]);});}if(_.forEach(s=>{kt(s);let a=_e(s);I.push(a),s.tagName.toLowerCase()==="path"?me.push(s.getAttribute("d")??""):me.push(""),o?(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(s.style.opacity="1"),p&&(s.style.stroke=p),H!==null&&(s.style.strokeWidth=`${H}`),se!==null&&(s.style.fillOpacity=`${se}`),M&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",M)):(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`));}),we){if(o)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(W===false||!Ct()||!_.length||typeof y!="string"||!(y in nt)||we||R!=="y"||U||l!==1||B!==0||Q||te||C!==false||M||b||L||q>0||d||P||g||h||X||Se||be||x!=null||A!=null||w!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function Tt(){let s=`svg-scroll-draw-${++Lt}`,a=S==="reverse"?"0":"var(--ssd-len)",E=S==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${a};`,ce=`stroke-dashoffset:${E};`;c&&(j+=`opacity:${S==="reverse"?1:0};`,ce+=`opacity:${S==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${s}{from{${j}}to{${ce}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${nt[y]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function fe(m,T){m.style.setProperty("--ssd-len",String(I[T])),m.style.strokeDasharray=`${I[T]}`,m.style.strokeDashoffset="",m.style.opacity="",m.style.animationPlayState="",m.classList.add(s);}_.forEach(fe);let v=false,O=-1;function F(){if(O>=0)return O;let m=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:m.top,height:m.height},De(),Ze(),Ne,ke);return de(K(De(),T,V,l))}return {destroy(){_.forEach(m=>{m.classList.remove(s),m.style.removeProperty("--ssd-len"),m.style.animationPlayState="";}),ue.remove();},replay(){v=false,O=-1,_.forEach(fe);},pause(){v=true,_.forEach(m=>{m.style.animationPlayState="paused";});},resume(){v&&(v=false,_.forEach(m=>{m.style.animationPlayState="running";}));},seek(m){let T=Math.min(1,Math.max(0,m));O=T,v=true,_.forEach((V,Ce)=>{V.classList.remove(s),V.style.strokeDashoffset=S==="reverse"?`${I[Ce]*T}`:`${I[Ce]*(1-T)}`,c&&(V.style.opacity=S==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return F()}}}if(xt())return Tt();function At(){let s=Math.max(1,D),a=0,E=0;function j(F){let m=true;if(we){let T=Math.min(1,Math.max(0,F/s)),V=de(T);Le=V,e.style.setProperty("--scroll-draw-progress",String(V)),e.style.clipPath=J(S==="reverse"?1-V:V),d?.(V),T<1&&(m=false);}else _.forEach((T,V)=>{let Ce=V*B*s,Oe=Math.min(1,Math.max(0,(F-Ce)/s)),Ee=de(Oe);T.style.strokeDashoffset=S==="reverse"?`${I[V]*Ee}`:`${I[V]*(1-Ee)}`,c&&(T.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),i&&p?T.style.stroke=Fe(i,p,Ee):p&&(T.style.stroke=p),Y!==null&&H!==null?T.style.strokeWidth=`${Y+(H-Y)*Ee}`:H!==null&&(T.style.strokeWidth=`${H}`),Z!==null&&se!==null?T.style.fillOpacity=`${Z+(se-Z)*Ee}`:se!==null&&(T.style.fillOpacity=`${se}`),M&&T.tagName.toLowerCase()==="path"&&me[V]&&T.setAttribute("d",Ye(me[V],M,Ee)),V===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Oe<1&&(m=false);});if(b){let T=Math.min(1,Math.max(0,F/s)),V=de(T);for(let Ce in b){let Oe=parseFloat(Ce);V>=Oe&&!Me.has(Oe)&&(Me.add(Oe),b[Ce]?.());}}return m}function ce(F){if(le)return;let m=F-a;he||(he=true,P?.());let T=j(m);if(T&&!oe){oe=true,j(s*(1+Math.max(0,_.length-1)*B)),g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{a=performance.now(),he=false,oe=false,Me.clear(),Ve(),ne=requestAnimationFrame(ce);},N));return}T||(ne=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(ne),clearTimeout(Ae),a=performance.now(),E=0,le=false,he=false,oe=false,xe=0,Me.clear(),Ve(),ne=requestAnimationFrame(ce);}let fe=new IntersectionObserver(F=>{F.forEach(m=>{m.isIntersecting&&!(Q&&oe)?ue():!m.isIntersecting&&!Q&&!oe&&(cancelAnimationFrame(ne),clearTimeout(Ae),a=null);});},{root:U??null,threshold:k,rootMargin:G}),v;function O(){clearTimeout(v),v=setTimeout(()=>{_.forEach((F,m)=>{I[m]=_e(F),F.style.strokeDasharray=`${I[m]}`;});},150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),q>0?setTimeout(()=>fe.observe(e),q):fe.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),fe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(v);},replay(){xe=0,ue();},pause(){le||(le=true,E=performance.now()-a,cancelAnimationFrame(ne));},resume(){le&&(le=false,a=performance.now()-E,ne=requestAnimationFrame(ce));},seek(F){let m=Math.min(1,Math.max(0,F));Le=m,le=true,E=m*s,a=performance.now()-E,cancelAnimationFrame(ne),j(E);},getProgress(){return Le}}}if(re)return At();Je();function qe(){if(!He||le)return;let s=performance.now(),a=De(),E=l;if(C!==false){let v=s-Ue,O=v>0?Math.abs(a-(ze<0?a:ze))/v:0;E=l*Math.max(.2,1+O*(typeof C=="number"?C:1)*.04);}ze=a,Ue=s;let j=te?Re===-1||a>=Re?"forward":"reverse":S;Re=a;let ce=Te-ge,ue=true,fe=ce===0?0:(a-ge)/ce;if(isNaN(Ie)||(Ie<=0&&fe>0?h?.():Ie>0&&fe<=0&&be?.(),Ie<1&&fe>=1?X?.():Ie>=1&&fe<1&&Se?.()),Ie=fe,we){let v=de(K(a,ge,Te,E));Q&&!te&&(ve=Math.max(ve,v),v=ve),Le=v,e.style.setProperty("--scroll-draw-progress",String(v));let O=j==="reverse"?1-v:v;e.style.clipPath=J(O),d?.(v),!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),v>=1&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,e.style.clipPath=J(0);},N))):v<1&&!Q&&(oe=false),ne=requestAnimationFrame(qe);return}if(_.forEach((v,O)=>{let F=O*B*ce,m=de(K(a,ge+F,Te+F,E));Q&&!te&&(ve=Math.max(ve,m),m=ve),Le=m,v.style.strokeDashoffset=j==="reverse"?`${I[O]*m}`:`${I[O]*(1-m)}`,c&&(v.style.opacity=j==="reverse"?`${1-m}`:`${m}`),i&&p?v.style.stroke=Fe(i,p,m):p&&(v.style.stroke=p),Y!==null&&H!==null?v.style.strokeWidth=`${Y+(H-Y)*m}`:H!==null&&(v.style.strokeWidth=`${H}`),Z!==null&&se!==null?v.style.fillOpacity=`${Z+(se-Z)*m}`:se!==null&&(v.style.fillOpacity=`${se}`),M&&v.tagName.toLowerCase()==="path"&&me[O]&&v.setAttribute("d",Ye(me[O],M,m)),O===0&&(d?.(m),e.style.setProperty("--scroll-draw-progress",String(m))),m<1&&(ue=false);}),b){let v=de(K(a,ge,Te,E));for(let O in b){let F=parseFloat(O);v>=F&&!Me.has(F)&&(Me.add(F),b[O]?.());}}!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),ue&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,Me.clear(),Ve();},N))):!ue&&!Q&&(oe=false),ne=requestAnimationFrame(qe);}let Ge=new IntersectionObserver(s=>{s.forEach(a=>{He=a.isIntersecting,He&&!le?ne=requestAnimationFrame(qe):cancelAnimationFrame(ne);});},{root:U??null,threshold:k,rootMargin:G}),Xe;function We(){clearTimeout(Xe),Xe=setTimeout(()=>{_.forEach((s,a)=>{I[a]=_e(s),s.style.strokeDasharray=`${I[a]}`;}),Je();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),q>0?setTimeout(()=>Ge.observe(e),q):Ge.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),Ge.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Xe),Be?.remove();},replay(){ve=-1,Re=-1,ze=-1,he=false,oe=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),Ve();},pause(){le=true,cancelAnimationFrame(ne);},resume(){le&&(le=false,He&&(ne=requestAnimationFrame(qe)));},seek(s){let a=Math.min(1,Math.max(0,s));Le=a,ve=a,le=true,cancelAnimationFrame(ne),St(a,S);},getProgress(){return Le}}}var ot=new Map;function Pe(e,r){ot.set(e,r);}function $e(e){ot.delete(e);}function Ot(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function it(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let u=[],o=[],f=t[2].trim();if(f)for(let l of f.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}r.push({fn:t[1],nums:u,units:o});}return r}function Ft(e,r,n){let t=it(e),u=it(r);return t.length===0||t.length!==u.length?n<1?e:r:t.map((o,f)=>{let l=u[f];return o.fn!==l.fn||o.nums.length!==l.nums.length?n<1?`${o.fn}(${o.nums.map((c,y)=>`${c}${o.units[y]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,y)=>`${c}${l.units[y]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,y)=>`${c+(l.nums[y]-c)*n}${o.units[y]}`).join(", ")})`}).join(" ")}function at(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),u=String(r);if(Ot(t))return Fe(t,u,n);if(t.includes("("))return Ft(t,u,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),f=u.match(/^([-+]?[\d.]+)(.*)$/);if(o&&f){let l=parseFloat(o[1]),c=parseFloat(f[1]);return `${l+(c-l)*n}${o[2]||f[2]}`}return n<1?t:u}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var lt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ht=0;function Rt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ct(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:u={},easing:o="ease-out",speed:f=1,once:l=false,axis:c="y",scrollContainer:y,native:$=true,onProgress:B,onComplete:S,onEnter:Q,onLeave:ye,onEnterBack:R,onLeaveBack:ee}=r,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof o=="function"?o:ie[o]??ie["ease-out"],x=ae(u.start??"top bottom"),A=ae(u.end??"bottom top"),w=typeof y=="string"?document.querySelector(y):y??null,b=Object.entries(t).map(([i,p])=>({prop:Nt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function C(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function k(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return k(),S?.(),n;C();function G(){if(!$||!Rt()||typeof o!="string"||!(o in lt)||c!=="y"||w||l||f!==1||B||S||Q||ye||R||ee||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!Dt.has(i.prop))return false;return true}function L(){let i=`ssd-a-${++Ht}`,p=b.map(J=>`${J.prop}:${J.from}`).join(";"),Y=b.map(J=>`${J.prop}:${J.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${p}}to{${Y}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${lt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let Z=()=>c==="x"?window.scrollX:window.scrollY,se=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),H.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let _=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let I of b)e.style.setProperty(I.prop,at(I.from,I.to,_));},getProgress(){let J=e.getBoundingClientRect(),_=Z(),I=se(),{tStart:me,tEnd:ge}=pe({top:J.top,height:J.height},_,I,x,A);return q(K(_,me,ge,f))}}}if(G())return L();let N=0,M=0,z=0,re=false,D=false,W=-1,d=0,P=false,g=NaN,h=()=>w?c==="x"?w.scrollLeft:w.scrollTop:c==="x"?window.scrollX:window.scrollY,X=()=>w?c==="x"?w.clientWidth:w.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function Se(){let i=e.getBoundingClientRect(),p,Y;if(w){let Z=w.getBoundingClientRect();p=c==="x"?i.left-Z.left+w.scrollLeft:i.top-Z.top+w.scrollTop,Y=c==="x"?i.width:i.height;}else p=c==="x"?i.left:i.top,Y=c==="x"?i.width:i.height;let H=pe({top:p,height:Y},h(),X(),x,A);N=H.tStart,M=H.tEnd;}function be(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let p of b)e.style.setProperty(p.prop,at(p.from,p.to,i));B?.(i);}function we(i){if(isNaN(g)){g=i;return}g<=0&&i>0?Q?.():g>0&&i<=0&&ee?.(),g<1&&i>=1?ye?.():g>=1&&i<1&&R?.(),g=i;}function de(){if(!re||D)return;let i=M===N?0:(h()-N)/(M-N);we(i);let p=q(K(h(),N,M,f));l&&(W=Math.max(W,p),p=W),d=p,be(p),p>=1&&!P?(P=true,S?.()):p<1&&!l&&(P=false),z=requestAnimationFrame(de);}Se();{let i=q(K(h(),N,M,f));l&&i>0&&(W=i),d=i,be(i);}let Ne=new IntersectionObserver(i=>{i.forEach(p=>{re=p.isIntersecting,re&&!D?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),ke;function U(){clearTimeout(ke),ke=setTimeout(Se,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),Ne.observe(e),Pe(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:N,tEnd:M})}),{destroy(){cancelAnimationFrame(z),Ne.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(ke),$e(e);},replay(){W=-1,P=false,d=0,D=false,be(0);},pause(){D=true,cancelAnimationFrame(z);},resume(){D&&(D=false,re&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,W=p,D=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,r){if(typeof window>"u")return je;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),je;let t=n,{from:u=0,to:o,format:f,easing:l="ease-out",trigger:c={},once:y=true,decimals:$,onComplete:B}=r,S=$!==void 0?d=>d.toFixed($):f??(d=>String(Math.round(d))),Q=typeof l=="function"?l:ie[l]??ie["ease-out"],ye=ae(c.start??"top 80%"),R=ae(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(o),B?.(),je;t.textContent=S(u);let te=0,q=0,x=0,A=false,w=false,b=-1,C=0,k=false,G=()=>window.scrollY,L=()=>window.innerHeight;function N(){let d=t.getBoundingClientRect(),P=pe({top:d.top,height:d.height},G(),L(),ye,R);te=P.tStart,q=P.tEnd;}function M(d){t.textContent=S(u+(o-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));y&&(b=Math.max(b,d),d=b),C=d,M(d),d>=1&&!k?(k=true,B?.()):d<1&&!y&&(k=false),x=requestAnimationFrame(z);}N();{let d=Q(K(G(),te,q,1));y&&d>0&&(b=d),C=d,M(d);}let re=new IntersectionObserver(d=>{d.forEach(P=>{A=P.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),D;function W(){clearTimeout(D),D=setTimeout(N,150);}return window.addEventListener("resize",W),window.addEventListener("orientationchange",W),re.observe(t),Pe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),re.disconnect(),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),clearTimeout(D),$e(t);},replay(){b=-1,k=false,C=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let P=Math.min(1,Math.max(0,d));C=P,b=P,w=true,cancelAnimationFrame(x),M(P);},getProgress(){return C}}}var mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,r={}){if(typeof window>"u")return mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),mt;let t=n,{trigger:u={},easing:o="linear",once:f=false,axis:l="y",preload:c="auto",onReady:y,onComplete:$,onProgress:B}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof o=="function"?o:ie[o]??ie.linear,ye=ae(u.start??"top top"),R=ae(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=r.from??0,te=r.to,q=0,x=0,A=0,w=false,b=false,C=-1,k=0,G=false,L=false,N=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function z(){let h=t.getBoundingClientRect(),X=l==="x"?h.left:h.top,Se=l==="x"?h.width:h.height,be=pe({top:X,height:Se},N(),M(),ye,R);q=be.tStart,x=be.tEnd;}function re(h){if(!L)return;let X=te??t.duration??0;t.currentTime=ee+(X-ee)*h,t.style.setProperty("--scroll-draw-progress",String(h)),B?.(h);}function D(){if(!w||b||!L)return;let h=Q(K(N(),q,x,1));f&&(C=Math.max(C,h),h=C),k=h,re(h),h>=1&&!G?(G=true,$?.()):h<1&&!f&&(G=false),A=requestAnimationFrame(D);}function W(){if(L=true,te===void 0&&(te=t.duration),S){re(1),y?.();return}z(),y?.(),w&&!b&&(A=requestAnimationFrame(D));}t.readyState>=1?W():t.addEventListener("loadedmetadata",W,{once:true}),L||z();let d=new IntersectionObserver(h=>{h.forEach(X=>{w=X.isIntersecting,w&&!b&&L?A=requestAnimationFrame(D):cancelAnimationFrame(A);});}),P;function g(){clearTimeout(P),P=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",W),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(P),$e(t);},replay(){C=-1,G=false,k=0,b=false,re(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&L&&(A=requestAnimationFrame(D)));},seek(h){let X=Math.min(1,Math.max(0,h));k=X,C=X,b=true,cancelAnimationFrame(A),re(X);},getProgress(){return k}}}function gt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function zt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function pt(e){let r=gt(e),n=new Map;for(let o of r){let f=o.offsetTop;n.has(f)||n.set(f,[]),n.get(f).push(o);}let t=[],u=Array.from(n.keys()).sort((o,f)=>o-f);for(let o of u){let f=n.get(o),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of f)l.appendChild(c);t.push(l);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function Vt(e,r,n,t){if(n<=1||t===0)return e;let u=(n-1)*t,o=r*t,f=o+(1-u);return f<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(f-o)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ht(e,r={}){if(typeof window>"u")return dt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),dt;let t=n,{split:u="words",stagger:o=.04,easing:f="ease-out",from:l={opacity:0,y:24},trigger:c={},once:y=true,onComplete:$}=r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof f=="function"?f:ie[f]??ie["ease-out"],Q=ae(c.start??"top 85%"),ye=ae(c.end??"top 40%"),R=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=zt(t):u==="lines"?ee=pt(t):ee=gt(t);let te=ee.length;function q(g,h){l?.opacity!==void 0&&(g.style.opacity=String(l.opacity+(1-l.opacity)*h));let X=qt(h,l);X&&(g.style.transform=X);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((h,X)=>{let Se=S(Vt(g,X,te,o));q(h,Se);});}if(B)return x(1),$?.(),{destroy(){t.innerHTML=R,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let A=0,w=0,b=0,C=false,k=false,G=-1,L=0,N=false,M=()=>window.scrollY,z=()=>window.innerHeight;function re(){let g=t.getBoundingClientRect(),h=pe({top:g.top,height:g.height},M(),z(),Q,ye);A=h.tStart,w=h.tEnd;}function D(){if(!C||k)return;let g=K(M(),A,w,1);y&&(G=Math.max(G,g),g=G),L=g,x(g),g>=1&&!N?(N=true,$?.()):g<1&&!y&&(N=false),b=requestAnimationFrame(D);}re();let W=new IntersectionObserver(g=>{g.forEach(h=>{C=h.isIntersecting,C&&!k?b=requestAnimationFrame(D):cancelAnimationFrame(b);});}),d;function P(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let g=L;t.innerHTML=R,t.setAttribute("aria-label",t.textContent??""),ee=pt(t),x(g);}re();},150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),W.observe(t),Pe(t,{type:"text",getProgress:()=>L,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),W.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(d),t.innerHTML=R,t.removeAttribute("aria-label"),$e(t);},replay(){G=-1,N=false,L=0,k=false,x(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(D)));},seek(g){let h=Math.min(1,Math.max(0,g));L=h,G=h,k=true,cancelAnimationFrame(b),x(h);},getProgress(){return L}}}var yt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=st(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},bt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ct(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},wt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ut(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},vt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ft(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Et=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ht(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};exports.ScrollAnimateRef=bt;exports.ScrollCounterRef=wt;exports.ScrollDrawRef=yt;exports.ScrollTextRef=Et;exports.ScrollVideoRef=vt;
@@ -71,6 +71,14 @@ interface ScrollDrawOptions {
71
71
  onProgress?: (alpha: number) => void;
72
72
  onStart?: () => void;
73
73
  onComplete?: () => void;
74
+ /** Fires when scroll position enters the trigger zone (scrolling forward). */
75
+ onEnter?: () => void;
76
+ /** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
77
+ onLeave?: () => void;
78
+ /** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
79
+ onEnterBack?: () => void;
80
+ /** Fires when scroll position exits the trigger zone at the start (scrolling back). */
81
+ onLeaveBack?: () => void;
74
82
  /**
75
83
  * Trigger the animation when the element enters the viewport instead of
76
84
  * tying it to scroll position. The draw runs over `duration` milliseconds,
@@ -130,6 +138,14 @@ interface ScrollAnimateOptions {
130
138
  native?: boolean;
131
139
  onProgress?: (alpha: number) => void;
132
140
  onComplete?: () => void;
141
+ /** Fires when scroll enters the trigger zone (scrolling forward). */
142
+ onEnter?: () => void;
143
+ /** Fires when scroll exits the trigger zone at the end (scrolling forward). */
144
+ onLeave?: () => void;
145
+ /** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
146
+ onEnterBack?: () => void;
147
+ /** Fires when scroll exits the trigger zone at the start (scrolling back). */
148
+ onLeaveBack?: () => void;
133
149
  }
134
150
 
135
151
  interface ScrollCounterOptions {
@@ -71,6 +71,14 @@ interface ScrollDrawOptions {
71
71
  onProgress?: (alpha: number) => void;
72
72
  onStart?: () => void;
73
73
  onComplete?: () => void;
74
+ /** Fires when scroll position enters the trigger zone (scrolling forward). */
75
+ onEnter?: () => void;
76
+ /** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
77
+ onLeave?: () => void;
78
+ /** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
79
+ onEnterBack?: () => void;
80
+ /** Fires when scroll position exits the trigger zone at the start (scrolling back). */
81
+ onLeaveBack?: () => void;
74
82
  /**
75
83
  * Trigger the animation when the element enters the viewport instead of
76
84
  * tying it to scroll position. The draw runs over `duration` milliseconds,
@@ -130,6 +138,14 @@ interface ScrollAnimateOptions {
130
138
  native?: boolean;
131
139
  onProgress?: (alpha: number) => void;
132
140
  onComplete?: () => void;
141
+ /** Fires when scroll enters the trigger zone (scrolling forward). */
142
+ onEnter?: () => void;
143
+ /** Fires when scroll exits the trigger zone at the end (scrolling forward). */
144
+ onLeave?: () => void;
145
+ /** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
146
+ onEnterBack?: () => void;
147
+ /** Fires when scroll exits the trigger zone at the start (scrolling back). */
148
+ onLeaveBack?: () => void;
133
149
  }
134
150
 
135
151
  interface ScrollCounterOptions {
@@ -1,3 +1,3 @@
1
- function Et({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),u=Math.sqrt(t),o=0,m=[];for(let d=0;d<n;d++){let I=Math.pow(u,d);m.push(I),o+=I;}let l=[0],c=0;for(let d=0;d<n;d++)c+=m[d]/o,l.push(c);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let I=0;I<n;I++)if(d<=l[I+1]){let B=(d-l[I])/(l[I+1]-l[I]);if(I===0)return B*(2-B);let E=1-Math.pow(t,I);return E+(1-E)*(2*B-1)*(2*B-1)}return 1}}function St({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),u=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-u)*(2*Math.PI)/t)+1}var ae={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:Et(),elastic:St()};function le(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Ye(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function je(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Re(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function xt(e,r,n){return Math.min(n,Math.max(r,e))}function J(e,r,n,t){return n===r?0:xt((e-r)/(n-r)*t,0,1)}function fe(e,r,n,t,u){let o=Ye(e.top,e.height,r,t.element)-je(t.viewport,n),m=Ye(e.top,e.height,r,u.element)-je(u.viewport,n);return {tStart:o,tEnd:m}}function Ue(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Ce(e,r,n){let t=Ue(e),u=Ue(r);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*n)},${Math.round(t[1]+(u[1]-t[1])*n)},${Math.round(t[2]+(u[2]-t[2])*n)})`}var Ze={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 Je(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var Ke={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Tt=0;function At(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Mt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?Je("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&Je("Element has a fill \u2014 it may obscure the stroke animation.",e);}function $t(e,r,n){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 u(){let o=n==="x"?window.scrollX:window.scrollY,m=e-o,l=r-o,c=n==="x";t.innerHTML=`
2
- <div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}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;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}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",u,{passive:true}),u(),t}function We(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let m=parseFloat(o),l=t[u++]??m;return String(+(m+(l-m)*n).toFixed(4))})}function Qe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,u=n?{...Ze[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:d="linear",trigger:I={},stagger:B=0,direction:E="forward",once:re=false,debug:de=false,axis:q="y",scrollContainer:K,autoReverse:T=false,delay:N=0,strokeColor:A,strokeWidth:$,fillOpacity:P,waypoints:b,velocityScale:L=false,threshold:O=0,rootMargin:D="0px",repeat:M=0,repeatDelay:z=0,morphTo:C,clip:_,autoplay:Q=false,duration:j=1e3,native:oe=true,onProgress:f,onStart:k,onComplete:h}=u,p=_===true?"left":typeof _=="string"?_:false,F=typeof d=="function"?d:ae[d]??ae.linear,ge=le(I.start??"top bottom"),a=le(I.end??"bottom top"),g=typeof K=="string"?document.querySelector(K):K??null,ne=Array.isArray(A)?A[0]:null,V=Array.isArray(A)?A[1]:typeof A=="string"?A:null,U=Array.isArray($)?$[0]:null,se=Array.isArray($)?$[1]:typeof $=="number"?$:null,H=Array.isArray(P)?P[0]:null,G=Array.isArray(P)?P[1]:typeof P=="number"?P:null;function me(s){let i=s*100;switch(p){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let ee=p?[]:Array.from(e.querySelectorAll(m)),X=[],ye=[],Ee=0,Se=0,ie=false,he=false,te=0,Ie=false,be=-1,Oe=-1,ce=false,$e=0,ve=0,xe,ze=null,Te=new Set,Fe=-1,Be=performance.now();function ke(){return g?q==="x"?g.scrollLeft:g.scrollTop:q==="x"?window.scrollX:window.scrollY}function Ge(){return g?q==="x"?g.clientWidth:g.clientHeight:q==="x"?window.innerWidth:window.innerHeight}function Xe(){let s=e.getBoundingClientRect(),i,v,Y;if(g){let ue=g.getBoundingClientRect();i=q==="x"?s.left-ue.left+g.scrollLeft:s.top-ue.top+g.scrollTop,v=q==="x"?s.width:s.height,Y=ke();}else i=q==="x"?s.left:s.top,v=q==="x"?s.width:s.height,Y=ke();let pe=fe({top:i,height:v},Y,Ge(),ge,a);Ee=pe.tStart,Se=pe.tEnd,de&&process.env.NODE_ENV!=="production"&&(ze?.remove(),ze=$t(Ee,Se,q));}function yt(s,i){if(e.style.setProperty("--scroll-draw-progress",String(s)),p){let v=i==="reverse"?1-s:s;e.style.clipPath=me(v);return}ee.forEach((v,Y)=>{v.style.strokeDashoffset=i==="reverse"?`${X[Y]*s}`:`${X[Y]*(1-s)}`,c&&(v.style.opacity=i==="reverse"?`${1-s}`:`${s}`),ne&&V?v.style.stroke=Ce(ne,V,s):V&&(v.style.stroke=V),U!==null&&se!==null?v.style.strokeWidth=`${U+(se-U)*s}`:se!==null&&(v.style.strokeWidth=`${se}`),H!==null&&G!==null?v.style.fillOpacity=`${H+(G-H)*s}`:G!==null&&(v.style.fillOpacity=`${G}`),C&&v.tagName.toLowerCase()==="path"&&ye[Y]&&v.setAttribute("d",We(ye[Y],C,s));});}function De(){if(e.style.setProperty("--scroll-draw-progress","0"),p){e.style.clipPath=me(0);return}ee.forEach((s,i)=>{s.style.strokeDasharray=`${X[i]}`,s.style.strokeDashoffset=E==="reverse"?"0":`${X[i]}`,c?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",ne&&(s.style.stroke=ne),U!==null&&(s.style.strokeWidth=`${U}`),H!==null&&(s.style.fillOpacity=`${H}`),C&&s.tagName.toLowerCase()==="path"&&ye[i]&&s.setAttribute("d",ye[i]);});}if(ee.forEach(s=>{Mt(s);let i=Re(s);X.push(i),s.tagName.toLowerCase()==="path"?ye.push(s.getAttribute("d")??""):ye.push(""),o?(s.style.strokeDasharray=`${i}`,s.style.strokeDashoffset=E==="reverse"?`${i}`:"0",c&&(s.style.opacity="1"),V&&(s.style.stroke=V),se!==null&&(s.style.strokeWidth=`${se}`),G!==null&&(s.style.fillOpacity=`${G}`),C&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",C)):(s.style.strokeDasharray=`${i}`,s.style.strokeDashoffset=E==="reverse"?"0":`${i}`,c?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",ne&&(s.style.stroke=ne),U!==null&&(s.style.strokeWidth=`${U}`),H!==null&&(s.style.fillOpacity=`${H}`));}),p){if(o)return e.style.clipPath=me(1),h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=me(0);}else if(o)return h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(oe===false||!At()||!ee.length||typeof d!="string"||!(d in Ke)||p||q!=="y"||g||l!==1||B!==0||re||T||L!==false||C||b||M||N>0||f||k||h||A!=null||$!=null||P!=null||(I.start??"top bottom").trim()!=="top bottom"||(I.end??"bottom top").trim()!=="bottom top")}function wt(){let s=`svg-scroll-draw-${++Tt}`,i=E==="reverse"?"0":"var(--ssd-len)",v=E==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${i};`,pe=`stroke-dashoffset:${v};`;c&&(Y+=`opacity:${E==="reverse"?1:0};`,pe+=`opacity:${E==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${s}{from{${Y}}to{${pe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ke[d]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function w(y,x){y.style.setProperty("--ssd-len",String(X[x])),y.style.strokeDasharray=`${X[x]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(s);}ee.forEach(w);let R=false,Z=-1;function S(){if(Z>=0)return Z;let y=e.getBoundingClientRect(),{tStart:x,tEnd:W}=fe({top:y.top,height:y.height},ke(),Ge(),ge,a);return F(J(ke(),x,W,l))}return {destroy(){ee.forEach(y=>{y.classList.remove(s),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),ue.remove();},replay(){R=false,Z=-1,ee.forEach(w);},pause(){R=true,ee.forEach(y=>{y.style.animationPlayState="paused";});},resume(){R&&(R=false,ee.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let x=Math.min(1,Math.max(0,y));Z=x,R=true,ee.forEach((W,Pe)=>{W.classList.remove(s),W.style.strokeDashoffset=E==="reverse"?`${X[Pe]*x}`:`${X[Pe]*(1-x)}`,c&&(W.style.opacity=E==="reverse"?`${1-x}`:`${x}`);});},getProgress(){return S()}}}if(bt())return wt();function vt(){let s=Math.max(1,j),i=0,v=0;function Y(S){let y=true;if(p){let x=Math.min(1,Math.max(0,S/s)),W=F(x);$e=W,e.style.setProperty("--scroll-draw-progress",String(W)),e.style.clipPath=me(E==="reverse"?1-W:W),f?.(W),x<1&&(y=false);}else ee.forEach((x,W)=>{let Pe=W*B*s,Le=Math.min(1,Math.max(0,(S-Pe)/s)),we=F(Le);x.style.strokeDashoffset=E==="reverse"?`${X[W]*we}`:`${X[W]*(1-we)}`,c&&(x.style.opacity=E==="reverse"?`${1-we}`:`${we}`),ne&&V?x.style.stroke=Ce(ne,V,we):V&&(x.style.stroke=V),U!==null&&se!==null?x.style.strokeWidth=`${U+(se-U)*we}`:se!==null&&(x.style.strokeWidth=`${se}`),H!==null&&G!==null?x.style.fillOpacity=`${H+(G-H)*we}`:G!==null&&(x.style.fillOpacity=`${G}`),C&&x.tagName.toLowerCase()==="path"&&ye[W]&&x.setAttribute("d",We(ye[W],C,we)),W===0&&(f?.(we),e.style.setProperty("--scroll-draw-progress",String(we))),Le<1&&(y=false);});if(b){let x=Math.min(1,Math.max(0,S/s)),W=F(x);for(let Pe in b){let Le=parseFloat(Pe);W>=Le&&!Te.has(Le)&&(Te.add(Le),b[Pe]?.());}}return y}function pe(S){if(ce)return;let y=S-i;he||(he=true,k?.());let x=Y(y);if(x&&!ie){ie=true,Y(s*(1+Math.max(0,ee.length-1)*B)),h?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{i=performance.now(),he=false,ie=false,Te.clear(),De(),te=requestAnimationFrame(pe);},z));return}x||(te=requestAnimationFrame(pe));}function ue(){cancelAnimationFrame(te),clearTimeout(xe),i=performance.now(),v=0,ce=false,he=false,ie=false,ve=0,Te.clear(),De(),te=requestAnimationFrame(pe);}let w=new IntersectionObserver(S=>{S.forEach(y=>{y.isIntersecting&&!(re&&ie)?ue():!y.isIntersecting&&!re&&!ie&&(cancelAnimationFrame(te),clearTimeout(xe),i=null);});},{root:g??null,threshold:O,rootMargin:D}),R;function Z(){clearTimeout(R),R=setTimeout(()=>{ee.forEach((S,y)=>{X[y]=Re(S),S.style.strokeDasharray=`${X[y]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),N>0?setTimeout(()=>w.observe(e),N):w.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(xe),w.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(R);},replay(){ve=0,ue();},pause(){ce||(ce=true,v=performance.now()-i,cancelAnimationFrame(te));},resume(){ce&&(ce=false,i=performance.now()-v,te=requestAnimationFrame(pe));},seek(S){let y=Math.min(1,Math.max(0,S));$e=y,ce=true,v=y*s,i=performance.now()-v,cancelAnimationFrame(te),Y(v);},getProgress(){return $e}}}if(Q)return vt();Xe();function Ne(){if(!Ie||ce)return;let s=performance.now(),i=ke(),v=l;if(L!==false){let w=s-Be,R=w>0?Math.abs(i-(Fe<0?i:Fe))/w:0;v=l*Math.max(.2,1+R*(typeof L=="number"?L:1)*.04);}Fe=i,Be=s;let Y=T?Oe===-1||i>=Oe?"forward":"reverse":E;Oe=i;let pe=Se-Ee,ue=true;if(p){let w=F(J(i,Ee,Se,v));re&&!T&&(be=Math.max(be,w),w=be),$e=w,e.style.setProperty("--scroll-draw-progress",String(w));let R=Y==="reverse"?1-w:w;e.style.clipPath=me(R),f?.(w),!he&&J(i,Ee,Se,v)>0&&(he=true,k?.()),w>=1&&!ie?(ie=true,h?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{be=-1,he=false,ie=false,e.style.clipPath=me(0);},z))):w<1&&!re&&(ie=false),te=requestAnimationFrame(Ne);return}if(ee.forEach((w,R)=>{let Z=R*B*pe,S=F(J(i,Ee+Z,Se+Z,v));re&&!T&&(be=Math.max(be,S),S=be),$e=S,w.style.strokeDashoffset=Y==="reverse"?`${X[R]*S}`:`${X[R]*(1-S)}`,c&&(w.style.opacity=Y==="reverse"?`${1-S}`:`${S}`),ne&&V?w.style.stroke=Ce(ne,V,S):V&&(w.style.stroke=V),U!==null&&se!==null?w.style.strokeWidth=`${U+(se-U)*S}`:se!==null&&(w.style.strokeWidth=`${se}`),H!==null&&G!==null?w.style.fillOpacity=`${H+(G-H)*S}`:G!==null&&(w.style.fillOpacity=`${G}`),C&&w.tagName.toLowerCase()==="path"&&ye[R]&&w.setAttribute("d",We(ye[R],C,S)),R===0&&(f?.(S),e.style.setProperty("--scroll-draw-progress",String(S))),S<1&&(ue=false);}),b){let w=F(J(i,Ee,Se,v));for(let R in b){let Z=parseFloat(R);w>=Z&&!Te.has(Z)&&(Te.add(Z),b[R]?.());}}!he&&J(i,Ee,Se,v)>0&&(he=true,k?.()),ue&&!ie?(ie=true,h?.(),ve<(M==="infinite"?1/0:M??0)&&(ve++,xe=setTimeout(()=>{be=-1,he=false,ie=false,Te.clear(),De();},z))):!ue&&!re&&(ie=false),te=requestAnimationFrame(Ne);}let Ve=new IntersectionObserver(s=>{s.forEach(i=>{Ie=i.isIntersecting,Ie&&!ce?te=requestAnimationFrame(Ne):cancelAnimationFrame(te);});},{root:g??null,threshold:O,rootMargin:D}),qe;function He(){clearTimeout(qe),qe=setTimeout(()=>{ee.forEach((s,i)=>{X[i]=Re(s),s.style.strokeDasharray=`${X[i]}`;}),Xe();},150);}return window.addEventListener("resize",He),window.addEventListener("orientationchange",He),N>0?setTimeout(()=>Ve.observe(e),N):Ve.observe(e),{destroy(){cancelAnimationFrame(te),clearTimeout(xe),Ve.disconnect(),window.removeEventListener("resize",He),window.removeEventListener("orientationchange",He),clearTimeout(qe),ze?.remove();},replay(){be=-1,Oe=-1,Fe=-1,he=false,ie=false,ve=0,ce=false,Te.clear(),clearTimeout(xe),De();},pause(){ce=true,cancelAnimationFrame(te);},resume(){ce&&(ce=false,Ie&&(te=requestAnimationFrame(Ne)));},seek(s){let i=Math.min(1,Math.max(0,s));$e=i,be=i,ce=true,cancelAnimationFrame(te),yt(i,E);},getProgress(){return $e}}}var et=new Map;function Ae(e,r){et.set(e,r);}function Me(e){et.delete(e);}function Pt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function tt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let u=[],o=[],m=t[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}r.push({fn:t[1],nums:u,units:o});}return r}function Lt(e,r,n){let t=tt(e),u=tt(r);return t.length===0||t.length!==u.length?n<1?e:r:t.map((o,m)=>{let l=u[m];return o.fn!==l.fn||o.nums.length!==l.nums.length?n<1?`${o.fn}(${o.nums.map((c,d)=>`${c}${o.units[d]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,d)=>`${c}${l.units[d]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,d)=>`${c+(l.nums[d]-c)*n}${o.units[d]}`).join(", ")})`}).join(" ")}function rt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),u=String(r);if(Pt(t))return Ce(t,u,n);if(t.includes("("))return Lt(t,u,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),m=u.match(/^([-+]?[\d.]+)(.*)$/);if(o&&m){let l=parseFloat(o[1]),c=parseFloat(m[1]);return `${l+(c-l)*n}${o[2]||m[2]}`}return n<1?t:u}function Ct(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var nt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),It=0;function Ot(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function st(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:u={},easing:o="ease-out",speed:m=1,once:l=false,axis:c="y",scrollContainer:d,native:I=true,onProgress:B,onComplete:E}=r,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,de=typeof o=="function"?o:ae[o]??ae["ease-out"],q=le(u.start??"top bottom"),K=le(u.end??"bottom top"),T=typeof d=="string"?document.querySelector(d):d??null,N=Object.entries(t).map(([a,g])=>({prop:Ct(a),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function A(){let a=window.getComputedStyle(e);for(let g of N)g.from===""&&(g.from=a.getPropertyValue(g.prop).trim()||"0");}function $(){for(let a of N)e.style.setProperty(a.prop,String(a.to));}if(re)return $(),E?.(),n;A();function P(){if(!I||!Ot()||typeof o!="string"||!(o in nt)||c!=="y"||T||l||m!==1||B||E||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let a of N)if(!kt.has(a.prop))return false;return true}function b(){let a=`ssd-a-${++It}`,g=N.map(H=>`${H.prop}:${H.from}`).join(";"),ne=N.map(H=>`${H.prop}:${H.to}`).join(";"),V=document.createElement("style");V.setAttribute("data-ssd-animate",""),V.textContent=`@keyframes ${a}{from{${g}}to{${ne}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${nt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(V),e.classList.add(a);let U=()=>c==="x"?window.scrollX:window.scrollY,se=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),V.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(H){let G=Math.min(1,Math.max(0,H));e.classList.remove(a);for(let me of N)e.style.setProperty(me.prop,rt(me.from,me.to,G));},getProgress(){let H=e.getBoundingClientRect(),G=U(),me=se(),{tStart:ee,tEnd:X}=fe({top:H.top,height:H.height},G,me,q,K);return de(J(G,ee,X,m))}}}if(P())return b();let L=0,O=0,D=0,M=false,z=false,C=-1,_=0,Q=false,j=()=>T?c==="x"?T.scrollLeft:T.scrollTop:c==="x"?window.scrollX:window.scrollY,oe=()=>T?c==="x"?T.clientWidth:T.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function f(){let a=e.getBoundingClientRect(),g,ne;if(T){let U=T.getBoundingClientRect();g=c==="x"?a.left-U.left+T.scrollLeft:a.top-U.top+T.scrollTop,ne=c==="x"?a.width:a.height;}else g=c==="x"?a.left:a.top,ne=c==="x"?a.width:a.height;let V=fe({top:g,height:ne},j(),oe(),q,K);L=V.tStart,O=V.tEnd;}function k(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let g of N)e.style.setProperty(g.prop,rt(g.from,g.to,a));B?.(a);}function h(){if(!M||z)return;let a=de(J(j(),L,O,m));l&&(C=Math.max(C,a),a=C),_=a,k(a),a>=1&&!Q?(Q=true,E?.()):a<1&&!l&&(Q=false),D=requestAnimationFrame(h);}f();{let a=de(J(j(),L,O,m));l&&a>0&&(C=a),_=a,k(a);}let p=new IntersectionObserver(a=>{a.forEach(g=>{M=g.isIntersecting,M&&!z?D=requestAnimationFrame(h):cancelAnimationFrame(D);});},{root:T??null}),F;function ge(){clearTimeout(F),F=setTimeout(f,150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),p.observe(e),Ae(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:L,tEnd:O})}),{destroy(){cancelAnimationFrame(D),p.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(F),Me(e);},replay(){C=-1,Q=false,_=0,z=false,k(0);},pause(){z=true,cancelAnimationFrame(D);},resume(){z&&(z=false,M&&(D=requestAnimationFrame(h)));},seek(a){let g=Math.min(1,Math.max(0,a));_=g,C=g,z=true,cancelAnimationFrame(D),k(g);},getProgress(){return _}}}var _e={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ot(e,r){if(typeof window>"u")return _e;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),_e;let t=n,{from:u=0,to:o,format:m,easing:l="ease-out",trigger:c={},once:d=true,decimals:I,onComplete:B}=r,E=I!==void 0?f=>f.toFixed(I):m??(f=>String(Math.round(f))),re=typeof l=="function"?l:ae[l]??ae["ease-out"],de=le(c.start??"top 80%"),q=le(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(o),B?.(),_e;t.textContent=E(u);let T=0,N=0,A=0,$=false,P=false,b=-1,L=0,O=false,D=()=>window.scrollY,M=()=>window.innerHeight;function z(){let f=t.getBoundingClientRect(),k=fe({top:f.top,height:f.height},D(),M(),de,q);T=k.tStart,N=k.tEnd;}function C(f){t.textContent=E(u+(o-u)*f),t.style.setProperty("--scroll-draw-progress",String(f));}function _(){if(!$||P)return;let f=re(J(D(),T,N,1));d&&(b=Math.max(b,f),f=b),L=f,C(f),f>=1&&!O?(O=true,B?.()):f<1&&!d&&(O=false),A=requestAnimationFrame(_);}z();{let f=re(J(D(),T,N,1));d&&f>0&&(b=f),L=f,C(f);}let Q=new IntersectionObserver(f=>{f.forEach(k=>{$=k.isIntersecting,$&&!P?A=requestAnimationFrame(_):cancelAnimationFrame(A);});}),j;function oe(){clearTimeout(j),j=setTimeout(z,150);}return window.addEventListener("resize",oe),window.addEventListener("orientationchange",oe),Q.observe(t),Ae(t,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:T,tEnd:N})}),{destroy(){cancelAnimationFrame(A),Q.disconnect(),window.removeEventListener("resize",oe),window.removeEventListener("orientationchange",oe),clearTimeout(j),Me(t);},replay(){b=-1,O=false,L=0,P=false,C(0);},pause(){P=true,cancelAnimationFrame(A);},resume(){P&&(P=false,$&&(A=requestAnimationFrame(_)));},seek(f){let k=Math.min(1,Math.max(0,f));L=k,b=k,P=true,cancelAnimationFrame(A),C(k);},getProgress(){return L}}}var it={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function at(e,r={}){if(typeof window>"u")return it;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),it;let t=n,{trigger:u={},easing:o="linear",once:m=false,axis:l="y",preload:c="auto",onReady:d,onComplete:I,onProgress:B}=r,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:ae[o]??ae.linear,de=le(u.start??"top top"),q=le(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let K=r.from??0,T=r.to,N=0,A=0,$=0,P=false,b=false,L=-1,O=0,D=false,M=false,z=()=>l==="x"?window.scrollX:window.scrollY,C=()=>l==="x"?window.innerWidth:window.innerHeight;function _(){let p=t.getBoundingClientRect(),F=l==="x"?p.left:p.top,ge=l==="x"?p.width:p.height,a=fe({top:F,height:ge},z(),C(),de,q);N=a.tStart,A=a.tEnd;}function Q(p){if(!M)return;let F=T??t.duration??0;t.currentTime=K+(F-K)*p,t.style.setProperty("--scroll-draw-progress",String(p)),B?.(p);}function j(){if(!P||b||!M)return;let p=re(J(z(),N,A,1));m&&(L=Math.max(L,p),p=L),O=p,Q(p),p>=1&&!D?(D=true,I?.()):p<1&&!m&&(D=false),$=requestAnimationFrame(j);}function oe(){if(M=true,T===void 0&&(T=t.duration),E){Q(1),d?.();return}_(),d?.(),P&&!b&&($=requestAnimationFrame(j));}t.readyState>=1?oe():t.addEventListener("loadedmetadata",oe,{once:true}),M||_();let f=new IntersectionObserver(p=>{p.forEach(F=>{P=F.isIntersecting,P&&!b&&M?$=requestAnimationFrame(j):cancelAnimationFrame($);});}),k;function h(){clearTimeout(k),k=setTimeout(_,150);}return window.addEventListener("resize",h),window.addEventListener("orientationchange",h),f.observe(t),Ae(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:N,tEnd:A})}),{destroy(){cancelAnimationFrame($),f.disconnect(),t.removeEventListener("loadedmetadata",oe),window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),clearTimeout(k),Me(t);},replay(){L=-1,D=false,O=0,b=false,Q(0);},pause(){b=true,cancelAnimationFrame($);},resume(){b&&(b=false,P&&M&&($=requestAnimationFrame(j)));},seek(p){let F=Math.min(1,Math.max(0,p));O=F,L=F,b=true,cancelAnimationFrame($),Q(F);},getProgress(){return O}}}function ut(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function Ft(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function lt(e){let r=ut(e),n=new Map;for(let o of r){let m=o.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(o);}let t=[],u=Array.from(n.keys()).sort((o,m)=>o-m);for(let o of u){let m=n.get(o),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of m)l.appendChild(c);t.push(l);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function Dt(e,r,n,t){if(n<=1||t===0)return e;let u=(n-1)*t,o=r*t,m=o+(1-u);return m<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(m-o)))}function Nt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,r={}){if(typeof window>"u")return ct;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),ct;let t=n,{split:u="words",stagger:o=.04,easing:m="ease-out",from:l={opacity:0,y:24},trigger:c={},once:d=true,onComplete:I}=r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof m=="function"?m:ae[m]??ae["ease-out"],re=le(c.start??"top 85%"),de=le(c.end??"top 40%"),q=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let K;u==="chars"?K=Ft(t):u==="lines"?K=lt(t):K=ut(t);let T=K.length;function N(h,p){l?.opacity!==void 0&&(h.style.opacity=String(l.opacity+(1-l.opacity)*p));let F=Nt(p,l);F&&(h.style.transform=F);}function A(h){t.style.setProperty("--scroll-draw-progress",String(h)),K.forEach((p,F)=>{let ge=E(Dt(h,F,T,o));N(p,ge);});}if(B)return A(1),I?.(),{destroy(){t.innerHTML=q,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,P=0,b=0,L=false,O=false,D=-1,M=0,z=false,C=()=>window.scrollY,_=()=>window.innerHeight;function Q(){let h=t.getBoundingClientRect(),p=fe({top:h.top,height:h.height},C(),_(),re,de);$=p.tStart,P=p.tEnd;}function j(){if(!L||O)return;let h=J(C(),$,P,1);d&&(D=Math.max(D,h),h=D),M=h,A(h),h>=1&&!z?(z=true,I?.()):h<1&&!d&&(z=false),b=requestAnimationFrame(j);}Q();let oe=new IntersectionObserver(h=>{h.forEach(p=>{L=p.isIntersecting,L&&!O?b=requestAnimationFrame(j):cancelAnimationFrame(b);});}),f;function k(){clearTimeout(f),f=setTimeout(()=>{if(u==="lines"){let h=M;t.innerHTML=q,t.setAttribute("aria-label",t.textContent??""),K=lt(t),A(h);}Q();},150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),oe.observe(t),Ae(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:$,tEnd:P})}),{destroy(){cancelAnimationFrame(b),oe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(f),t.innerHTML=q,t.removeAttribute("aria-label"),Me(t);},replay(){D=-1,z=false,M=0,O=false,A(0);},pause(){O=true,cancelAnimationFrame(b);},resume(){O&&(O=false,L&&(b=requestAnimationFrame(j)));},seek(h){let p=Math.min(1,Math.max(0,h));M=p,D=p,O=true,cancelAnimationFrame(b),A(p);},getProgress(){return M}}}var pt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=Qe(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},ft=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=st(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},dt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ot(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},gt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=at(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},ht=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=mt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};export{ft as ScrollAnimateRef,dt as ScrollCounterRef,pt as ScrollDrawRef,ht as ScrollTextRef,gt as ScrollVideoRef};
1
+ function Mt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),u=Math.sqrt(t),o=0,f=[];for(let y=0;y<n;y++){let $=Math.pow(u,y);f.push($),o+=$;}let l=[0],c=0;for(let y=0;y<n;y++)c+=f[y]/o,l.push(c);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let $=0;$<n;$++)if(y<=l[$+1]){let B=(y-l[$])/(l[$+1]-l[$]);if($===0)return B*(2-B);let S=1-Math.pow(t,$);return S+(1-S)*(2*B-1)*(2*B-1)}return 1}}function Pt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),u=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-u)*(2*Math.PI)/t)+1}var ie={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:Mt(),elastic:Pt()};function ae(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Ke(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Qe(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function $t(e,r,n){return Math.min(n,Math.max(r,e))}function K(e,r,n,t){return n===r?0:$t((e-r)/(n-r)*t,0,1)}function pe(e,r,n,t,u){let o=Ke(e.top,e.height,r,t.element)-Qe(t.viewport,n),f=Ke(e.top,e.height,r,u.element)-Qe(u.viewport,n);return {tStart:o,tEnd:f}}function et(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Fe(e,r,n){let t=et(e),u=et(r);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*n)},${Math.round(t[1]+(u[1]-t[1])*n)},${Math.round(t[2]+(u[2]-t[2])*n)})`}var tt={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 rt(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var nt={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 kt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?rt("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&rt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function It(e,r,n){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 u(){let o=n==="x"?window.scrollX:window.scrollY,f=e-o,l=r-o,c=n==="x";t.innerHTML=`
2
+ <div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${f}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;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}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",u,{passive:true}),u(),t}function Ye(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let f=parseFloat(o),l=t[u++]??f;return String(+(f+(l-f)*n).toFixed(4))})}function st(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,u=n?{...tt[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:y="linear",trigger:$={},stagger:B=0,direction:S="forward",once:Q=false,debug:ye=false,axis:R="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:G="0px",repeat:L=0,repeatDelay:N=0,morphTo:M,clip:z,autoplay:re=false,duration:D=1e3,native:W=true,onProgress:d,onStart:P,onComplete:g,onEnter:h,onLeave:X,onEnterBack:Se,onLeaveBack:be}=u,we=z===true?"left":typeof z=="string"?z:false,de=typeof y=="function"?y:ie[y]??ie.linear,Ne=ae($.start??"top bottom"),ke=ae($.end??"bottom top"),U=typeof ee=="string"?document.querySelector(ee):ee??null,i=Array.isArray(x)?x[0]:null,p=Array.isArray(x)?x[1]:typeof x=="string"?x:null,Y=Array.isArray(A)?A[0]:null,H=Array.isArray(A)?A[1]:typeof A=="number"?A:null,Z=Array.isArray(w)?w[0]:null,se=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(s){let a=s*100;switch(we){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=we?[]:Array.from(e.querySelectorAll(f)),I=[],me=[],ge=0,Te=0,oe=false,he=false,ne=0,He=false,ve=-1,Re=-1,le=false,Le=0,xe=0,Ae,Be=null,Me=new Set,ze=-1,Ue=performance.now(),Ie=NaN;function De(){return U?R==="x"?U.scrollLeft:U.scrollTop:R==="x"?window.scrollX:window.scrollY}function Ze(){return U?R==="x"?U.clientWidth:U.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Je(){let s=e.getBoundingClientRect(),a,E,j;if(U){let ue=U.getBoundingClientRect();a=R==="x"?s.left-ue.left+U.scrollLeft:s.top-ue.top+U.scrollTop,E=R==="x"?s.width:s.height,j=De();}else a=R==="x"?s.left:s.top,E=R==="x"?s.width:s.height,j=De();let ce=pe({top:a,height:E},j,Ze(),Ne,ke);ge=ce.tStart,Te=ce.tEnd,ye&&process.env.NODE_ENV!=="production"&&(Be?.remove(),Be=It(ge,Te,R));}function St(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),we){let E=a==="reverse"?1-s:s;e.style.clipPath=J(E);return}_.forEach((E,j)=>{E.style.strokeDashoffset=a==="reverse"?`${I[j]*s}`:`${I[j]*(1-s)}`,c&&(E.style.opacity=a==="reverse"?`${1-s}`:`${s}`),i&&p?E.style.stroke=Fe(i,p,s):p&&(E.style.stroke=p),Y!==null&&H!==null?E.style.strokeWidth=`${Y+(H-Y)*s}`:H!==null&&(E.style.strokeWidth=`${H}`),Z!==null&&se!==null?E.style.fillOpacity=`${Z+(se-Z)*s}`:se!==null&&(E.style.fillOpacity=`${se}`),M&&E.tagName.toLowerCase()==="path"&&me[j]&&E.setAttribute("d",Ye(me[j],M,s));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}_.forEach((s,a)=>{s.style.strokeDasharray=`${I[a]}`,s.style.strokeDashoffset=S==="reverse"?"0":`${I[a]}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`),M&&s.tagName.toLowerCase()==="path"&&me[a]&&s.setAttribute("d",me[a]);});}if(_.forEach(s=>{kt(s);let a=_e(s);I.push(a),s.tagName.toLowerCase()==="path"?me.push(s.getAttribute("d")??""):me.push(""),o?(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(s.style.opacity="1"),p&&(s.style.stroke=p),H!==null&&(s.style.strokeWidth=`${H}`),se!==null&&(s.style.fillOpacity=`${se}`),M&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",M)):(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`));}),we){if(o)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(W===false||!Ct()||!_.length||typeof y!="string"||!(y in nt)||we||R!=="y"||U||l!==1||B!==0||Q||te||C!==false||M||b||L||q>0||d||P||g||h||X||Se||be||x!=null||A!=null||w!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function Tt(){let s=`svg-scroll-draw-${++Lt}`,a=S==="reverse"?"0":"var(--ssd-len)",E=S==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${a};`,ce=`stroke-dashoffset:${E};`;c&&(j+=`opacity:${S==="reverse"?1:0};`,ce+=`opacity:${S==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${s}{from{${j}}to{${ce}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${nt[y]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function fe(m,T){m.style.setProperty("--ssd-len",String(I[T])),m.style.strokeDasharray=`${I[T]}`,m.style.strokeDashoffset="",m.style.opacity="",m.style.animationPlayState="",m.classList.add(s);}_.forEach(fe);let v=false,O=-1;function F(){if(O>=0)return O;let m=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:m.top,height:m.height},De(),Ze(),Ne,ke);return de(K(De(),T,V,l))}return {destroy(){_.forEach(m=>{m.classList.remove(s),m.style.removeProperty("--ssd-len"),m.style.animationPlayState="";}),ue.remove();},replay(){v=false,O=-1,_.forEach(fe);},pause(){v=true,_.forEach(m=>{m.style.animationPlayState="paused";});},resume(){v&&(v=false,_.forEach(m=>{m.style.animationPlayState="running";}));},seek(m){let T=Math.min(1,Math.max(0,m));O=T,v=true,_.forEach((V,Ce)=>{V.classList.remove(s),V.style.strokeDashoffset=S==="reverse"?`${I[Ce]*T}`:`${I[Ce]*(1-T)}`,c&&(V.style.opacity=S==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return F()}}}if(xt())return Tt();function At(){let s=Math.max(1,D),a=0,E=0;function j(F){let m=true;if(we){let T=Math.min(1,Math.max(0,F/s)),V=de(T);Le=V,e.style.setProperty("--scroll-draw-progress",String(V)),e.style.clipPath=J(S==="reverse"?1-V:V),d?.(V),T<1&&(m=false);}else _.forEach((T,V)=>{let Ce=V*B*s,Oe=Math.min(1,Math.max(0,(F-Ce)/s)),Ee=de(Oe);T.style.strokeDashoffset=S==="reverse"?`${I[V]*Ee}`:`${I[V]*(1-Ee)}`,c&&(T.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),i&&p?T.style.stroke=Fe(i,p,Ee):p&&(T.style.stroke=p),Y!==null&&H!==null?T.style.strokeWidth=`${Y+(H-Y)*Ee}`:H!==null&&(T.style.strokeWidth=`${H}`),Z!==null&&se!==null?T.style.fillOpacity=`${Z+(se-Z)*Ee}`:se!==null&&(T.style.fillOpacity=`${se}`),M&&T.tagName.toLowerCase()==="path"&&me[V]&&T.setAttribute("d",Ye(me[V],M,Ee)),V===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Oe<1&&(m=false);});if(b){let T=Math.min(1,Math.max(0,F/s)),V=de(T);for(let Ce in b){let Oe=parseFloat(Ce);V>=Oe&&!Me.has(Oe)&&(Me.add(Oe),b[Ce]?.());}}return m}function ce(F){if(le)return;let m=F-a;he||(he=true,P?.());let T=j(m);if(T&&!oe){oe=true,j(s*(1+Math.max(0,_.length-1)*B)),g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{a=performance.now(),he=false,oe=false,Me.clear(),Ve(),ne=requestAnimationFrame(ce);},N));return}T||(ne=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(ne),clearTimeout(Ae),a=performance.now(),E=0,le=false,he=false,oe=false,xe=0,Me.clear(),Ve(),ne=requestAnimationFrame(ce);}let fe=new IntersectionObserver(F=>{F.forEach(m=>{m.isIntersecting&&!(Q&&oe)?ue():!m.isIntersecting&&!Q&&!oe&&(cancelAnimationFrame(ne),clearTimeout(Ae),a=null);});},{root:U??null,threshold:k,rootMargin:G}),v;function O(){clearTimeout(v),v=setTimeout(()=>{_.forEach((F,m)=>{I[m]=_e(F),F.style.strokeDasharray=`${I[m]}`;});},150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),q>0?setTimeout(()=>fe.observe(e),q):fe.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),fe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(v);},replay(){xe=0,ue();},pause(){le||(le=true,E=performance.now()-a,cancelAnimationFrame(ne));},resume(){le&&(le=false,a=performance.now()-E,ne=requestAnimationFrame(ce));},seek(F){let m=Math.min(1,Math.max(0,F));Le=m,le=true,E=m*s,a=performance.now()-E,cancelAnimationFrame(ne),j(E);},getProgress(){return Le}}}if(re)return At();Je();function qe(){if(!He||le)return;let s=performance.now(),a=De(),E=l;if(C!==false){let v=s-Ue,O=v>0?Math.abs(a-(ze<0?a:ze))/v:0;E=l*Math.max(.2,1+O*(typeof C=="number"?C:1)*.04);}ze=a,Ue=s;let j=te?Re===-1||a>=Re?"forward":"reverse":S;Re=a;let ce=Te-ge,ue=true,fe=ce===0?0:(a-ge)/ce;if(isNaN(Ie)||(Ie<=0&&fe>0?h?.():Ie>0&&fe<=0&&be?.(),Ie<1&&fe>=1?X?.():Ie>=1&&fe<1&&Se?.()),Ie=fe,we){let v=de(K(a,ge,Te,E));Q&&!te&&(ve=Math.max(ve,v),v=ve),Le=v,e.style.setProperty("--scroll-draw-progress",String(v));let O=j==="reverse"?1-v:v;e.style.clipPath=J(O),d?.(v),!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),v>=1&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,e.style.clipPath=J(0);},N))):v<1&&!Q&&(oe=false),ne=requestAnimationFrame(qe);return}if(_.forEach((v,O)=>{let F=O*B*ce,m=de(K(a,ge+F,Te+F,E));Q&&!te&&(ve=Math.max(ve,m),m=ve),Le=m,v.style.strokeDashoffset=j==="reverse"?`${I[O]*m}`:`${I[O]*(1-m)}`,c&&(v.style.opacity=j==="reverse"?`${1-m}`:`${m}`),i&&p?v.style.stroke=Fe(i,p,m):p&&(v.style.stroke=p),Y!==null&&H!==null?v.style.strokeWidth=`${Y+(H-Y)*m}`:H!==null&&(v.style.strokeWidth=`${H}`),Z!==null&&se!==null?v.style.fillOpacity=`${Z+(se-Z)*m}`:se!==null&&(v.style.fillOpacity=`${se}`),M&&v.tagName.toLowerCase()==="path"&&me[O]&&v.setAttribute("d",Ye(me[O],M,m)),O===0&&(d?.(m),e.style.setProperty("--scroll-draw-progress",String(m))),m<1&&(ue=false);}),b){let v=de(K(a,ge,Te,E));for(let O in b){let F=parseFloat(O);v>=F&&!Me.has(F)&&(Me.add(F),b[O]?.());}}!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),ue&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,Me.clear(),Ve();},N))):!ue&&!Q&&(oe=false),ne=requestAnimationFrame(qe);}let Ge=new IntersectionObserver(s=>{s.forEach(a=>{He=a.isIntersecting,He&&!le?ne=requestAnimationFrame(qe):cancelAnimationFrame(ne);});},{root:U??null,threshold:k,rootMargin:G}),Xe;function We(){clearTimeout(Xe),Xe=setTimeout(()=>{_.forEach((s,a)=>{I[a]=_e(s),s.style.strokeDasharray=`${I[a]}`;}),Je();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),q>0?setTimeout(()=>Ge.observe(e),q):Ge.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),Ge.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Xe),Be?.remove();},replay(){ve=-1,Re=-1,ze=-1,he=false,oe=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),Ve();},pause(){le=true,cancelAnimationFrame(ne);},resume(){le&&(le=false,He&&(ne=requestAnimationFrame(qe)));},seek(s){let a=Math.min(1,Math.max(0,s));Le=a,ve=a,le=true,cancelAnimationFrame(ne),St(a,S);},getProgress(){return Le}}}var ot=new Map;function Pe(e,r){ot.set(e,r);}function $e(e){ot.delete(e);}function Ot(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function it(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let u=[],o=[],f=t[2].trim();if(f)for(let l of f.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}r.push({fn:t[1],nums:u,units:o});}return r}function Ft(e,r,n){let t=it(e),u=it(r);return t.length===0||t.length!==u.length?n<1?e:r:t.map((o,f)=>{let l=u[f];return o.fn!==l.fn||o.nums.length!==l.nums.length?n<1?`${o.fn}(${o.nums.map((c,y)=>`${c}${o.units[y]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,y)=>`${c}${l.units[y]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,y)=>`${c+(l.nums[y]-c)*n}${o.units[y]}`).join(", ")})`}).join(" ")}function at(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),u=String(r);if(Ot(t))return Fe(t,u,n);if(t.includes("("))return Ft(t,u,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),f=u.match(/^([-+]?[\d.]+)(.*)$/);if(o&&f){let l=parseFloat(o[1]),c=parseFloat(f[1]);return `${l+(c-l)*n}${o[2]||f[2]}`}return n<1?t:u}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var lt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ht=0;function Rt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ct(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:u={},easing:o="ease-out",speed:f=1,once:l=false,axis:c="y",scrollContainer:y,native:$=true,onProgress:B,onComplete:S,onEnter:Q,onLeave:ye,onEnterBack:R,onLeaveBack:ee}=r,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof o=="function"?o:ie[o]??ie["ease-out"],x=ae(u.start??"top bottom"),A=ae(u.end??"bottom top"),w=typeof y=="string"?document.querySelector(y):y??null,b=Object.entries(t).map(([i,p])=>({prop:Nt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function C(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function k(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return k(),S?.(),n;C();function G(){if(!$||!Rt()||typeof o!="string"||!(o in lt)||c!=="y"||w||l||f!==1||B||S||Q||ye||R||ee||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!Dt.has(i.prop))return false;return true}function L(){let i=`ssd-a-${++Ht}`,p=b.map(J=>`${J.prop}:${J.from}`).join(";"),Y=b.map(J=>`${J.prop}:${J.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${p}}to{${Y}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${lt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let Z=()=>c==="x"?window.scrollX:window.scrollY,se=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),H.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let _=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let I of b)e.style.setProperty(I.prop,at(I.from,I.to,_));},getProgress(){let J=e.getBoundingClientRect(),_=Z(),I=se(),{tStart:me,tEnd:ge}=pe({top:J.top,height:J.height},_,I,x,A);return q(K(_,me,ge,f))}}}if(G())return L();let N=0,M=0,z=0,re=false,D=false,W=-1,d=0,P=false,g=NaN,h=()=>w?c==="x"?w.scrollLeft:w.scrollTop:c==="x"?window.scrollX:window.scrollY,X=()=>w?c==="x"?w.clientWidth:w.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function Se(){let i=e.getBoundingClientRect(),p,Y;if(w){let Z=w.getBoundingClientRect();p=c==="x"?i.left-Z.left+w.scrollLeft:i.top-Z.top+w.scrollTop,Y=c==="x"?i.width:i.height;}else p=c==="x"?i.left:i.top,Y=c==="x"?i.width:i.height;let H=pe({top:p,height:Y},h(),X(),x,A);N=H.tStart,M=H.tEnd;}function be(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let p of b)e.style.setProperty(p.prop,at(p.from,p.to,i));B?.(i);}function we(i){if(isNaN(g)){g=i;return}g<=0&&i>0?Q?.():g>0&&i<=0&&ee?.(),g<1&&i>=1?ye?.():g>=1&&i<1&&R?.(),g=i;}function de(){if(!re||D)return;let i=M===N?0:(h()-N)/(M-N);we(i);let p=q(K(h(),N,M,f));l&&(W=Math.max(W,p),p=W),d=p,be(p),p>=1&&!P?(P=true,S?.()):p<1&&!l&&(P=false),z=requestAnimationFrame(de);}Se();{let i=q(K(h(),N,M,f));l&&i>0&&(W=i),d=i,be(i);}let Ne=new IntersectionObserver(i=>{i.forEach(p=>{re=p.isIntersecting,re&&!D?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),ke;function U(){clearTimeout(ke),ke=setTimeout(Se,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),Ne.observe(e),Pe(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:N,tEnd:M})}),{destroy(){cancelAnimationFrame(z),Ne.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(ke),$e(e);},replay(){W=-1,P=false,d=0,D=false,be(0);},pause(){D=true,cancelAnimationFrame(z);},resume(){D&&(D=false,re&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,W=p,D=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,r){if(typeof window>"u")return je;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),je;let t=n,{from:u=0,to:o,format:f,easing:l="ease-out",trigger:c={},once:y=true,decimals:$,onComplete:B}=r,S=$!==void 0?d=>d.toFixed($):f??(d=>String(Math.round(d))),Q=typeof l=="function"?l:ie[l]??ie["ease-out"],ye=ae(c.start??"top 80%"),R=ae(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(o),B?.(),je;t.textContent=S(u);let te=0,q=0,x=0,A=false,w=false,b=-1,C=0,k=false,G=()=>window.scrollY,L=()=>window.innerHeight;function N(){let d=t.getBoundingClientRect(),P=pe({top:d.top,height:d.height},G(),L(),ye,R);te=P.tStart,q=P.tEnd;}function M(d){t.textContent=S(u+(o-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));y&&(b=Math.max(b,d),d=b),C=d,M(d),d>=1&&!k?(k=true,B?.()):d<1&&!y&&(k=false),x=requestAnimationFrame(z);}N();{let d=Q(K(G(),te,q,1));y&&d>0&&(b=d),C=d,M(d);}let re=new IntersectionObserver(d=>{d.forEach(P=>{A=P.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),D;function W(){clearTimeout(D),D=setTimeout(N,150);}return window.addEventListener("resize",W),window.addEventListener("orientationchange",W),re.observe(t),Pe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),re.disconnect(),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),clearTimeout(D),$e(t);},replay(){b=-1,k=false,C=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let P=Math.min(1,Math.max(0,d));C=P,b=P,w=true,cancelAnimationFrame(x),M(P);},getProgress(){return C}}}var mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,r={}){if(typeof window>"u")return mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),mt;let t=n,{trigger:u={},easing:o="linear",once:f=false,axis:l="y",preload:c="auto",onReady:y,onComplete:$,onProgress:B}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof o=="function"?o:ie[o]??ie.linear,ye=ae(u.start??"top top"),R=ae(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=r.from??0,te=r.to,q=0,x=0,A=0,w=false,b=false,C=-1,k=0,G=false,L=false,N=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function z(){let h=t.getBoundingClientRect(),X=l==="x"?h.left:h.top,Se=l==="x"?h.width:h.height,be=pe({top:X,height:Se},N(),M(),ye,R);q=be.tStart,x=be.tEnd;}function re(h){if(!L)return;let X=te??t.duration??0;t.currentTime=ee+(X-ee)*h,t.style.setProperty("--scroll-draw-progress",String(h)),B?.(h);}function D(){if(!w||b||!L)return;let h=Q(K(N(),q,x,1));f&&(C=Math.max(C,h),h=C),k=h,re(h),h>=1&&!G?(G=true,$?.()):h<1&&!f&&(G=false),A=requestAnimationFrame(D);}function W(){if(L=true,te===void 0&&(te=t.duration),S){re(1),y?.();return}z(),y?.(),w&&!b&&(A=requestAnimationFrame(D));}t.readyState>=1?W():t.addEventListener("loadedmetadata",W,{once:true}),L||z();let d=new IntersectionObserver(h=>{h.forEach(X=>{w=X.isIntersecting,w&&!b&&L?A=requestAnimationFrame(D):cancelAnimationFrame(A);});}),P;function g(){clearTimeout(P),P=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",W),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(P),$e(t);},replay(){C=-1,G=false,k=0,b=false,re(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&L&&(A=requestAnimationFrame(D)));},seek(h){let X=Math.min(1,Math.max(0,h));k=X,C=X,b=true,cancelAnimationFrame(A),re(X);},getProgress(){return k}}}function gt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function zt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function pt(e){let r=gt(e),n=new Map;for(let o of r){let f=o.offsetTop;n.has(f)||n.set(f,[]),n.get(f).push(o);}let t=[],u=Array.from(n.keys()).sort((o,f)=>o-f);for(let o of u){let f=n.get(o),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of f)l.appendChild(c);t.push(l);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function Vt(e,r,n,t){if(n<=1||t===0)return e;let u=(n-1)*t,o=r*t,f=o+(1-u);return f<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(f-o)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ht(e,r={}){if(typeof window>"u")return dt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),dt;let t=n,{split:u="words",stagger:o=.04,easing:f="ease-out",from:l={opacity:0,y:24},trigger:c={},once:y=true,onComplete:$}=r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof f=="function"?f:ie[f]??ie["ease-out"],Q=ae(c.start??"top 85%"),ye=ae(c.end??"top 40%"),R=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=zt(t):u==="lines"?ee=pt(t):ee=gt(t);let te=ee.length;function q(g,h){l?.opacity!==void 0&&(g.style.opacity=String(l.opacity+(1-l.opacity)*h));let X=qt(h,l);X&&(g.style.transform=X);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((h,X)=>{let Se=S(Vt(g,X,te,o));q(h,Se);});}if(B)return x(1),$?.(),{destroy(){t.innerHTML=R,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let A=0,w=0,b=0,C=false,k=false,G=-1,L=0,N=false,M=()=>window.scrollY,z=()=>window.innerHeight;function re(){let g=t.getBoundingClientRect(),h=pe({top:g.top,height:g.height},M(),z(),Q,ye);A=h.tStart,w=h.tEnd;}function D(){if(!C||k)return;let g=K(M(),A,w,1);y&&(G=Math.max(G,g),g=G),L=g,x(g),g>=1&&!N?(N=true,$?.()):g<1&&!y&&(N=false),b=requestAnimationFrame(D);}re();let W=new IntersectionObserver(g=>{g.forEach(h=>{C=h.isIntersecting,C&&!k?b=requestAnimationFrame(D):cancelAnimationFrame(b);});}),d;function P(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let g=L;t.innerHTML=R,t.setAttribute("aria-label",t.textContent??""),ee=pt(t),x(g);}re();},150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),W.observe(t),Pe(t,{type:"text",getProgress:()=>L,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),W.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(d),t.innerHTML=R,t.removeAttribute("aria-label"),$e(t);},replay(){G=-1,N=false,L=0,k=false,x(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(D)));},seek(g){let h=Math.min(1,Math.max(0,g));L=h,G=h,k=true,cancelAnimationFrame(b),x(h);},getProgress(){return L}}}var yt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=st(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},bt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ct(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},wt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ut(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},vt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ft(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Et=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ht(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};export{bt as ScrollAnimateRef,wt as ScrollCounterRef,yt as ScrollDrawRef,Et as ScrollTextRef,vt as ScrollVideoRef};
@@ -1,3 +1,3 @@
1
- 'use strict';function Qe({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),c=Math.sqrt(t),s=0,m=[];for(let d=0;d<r;d++){let T=Math.pow(c,d);m.push(T),s+=T;}let u=[0],l=0;for(let d=0;d<r;d++)l+=m[d]/s,u.push(l);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let T=0;T<r;T++)if(d<=u[T+1]){let Y=(d-u[T])/(u[T+1]-u[T]);if(T===0)return Y*(2-Y);let b=1-Math.pow(t,T);return b+(1-b)*(2*Y-1)*(2*Y-1)}return 1}}function et({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),c=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-c)*(2*Math.PI)/t)+1}var le={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:Qe(),elastic:et()};function me(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 Ue(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 Ze(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 Re(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 yt(e,n,r){return Math.min(r,Math.max(n,e))}function ee(e,n,r,t){return r===n?0:yt((e-n)/(r-n)*t,0,1)}function he(e,n,r,t,c){let s=Ue(e.top,e.height,n,t.element)-Ze(t.viewport,r),m=Ue(e.top,e.height,n,c.element)-Ze(c.viewport,r);return {tStart:s,tEnd:m}}function Ke(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 Ce(e,n,r){let t=Ke(e),c=Ke(n);return !t||!c?e:`rgb(${Math.round(t[0]+(c[0]-t[0])*r)},${Math.round(t[1]+(c[1]-t[1])*r)},${Math.round(t[2]+(c[2]-t[2])*r)})`}var _e={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 tt(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var rt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},ht=0;function wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function bt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?tt("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&tt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function St(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 c(){let s=r==="x"?window.scrollX:window.scrollY,m=e-s,u=n-s,l=r==="x";t.innerHTML=`
2
- <div style="position:absolute;${l?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}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",c,{passive:true}),c(),t}function Be(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),c=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),u=t[c++]??m;return String(+(m+(u-m)*r).toFixed(4))})}function qe(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,c=r?{..._e[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:u=1,fade:l=false,easing:d="linear",trigger:T={},stagger:Y=0,direction:b="forward",once:re=false,debug:we=false,axis:q="y",scrollContainer:ne,autoReverse:A=false,delay:N=0,strokeColor:M,strokeWidth:B,fillOpacity:O,waypoints:$,velocityScale:D=false,threshold:H=0,rootMargin:R="0px",repeat:I=0,repeatDelay:z=0,morphTo:E,clip:U,autoplay:ce=false,duration:ie=1e3,native:pe=true,onProgress:f,onStart:P,onComplete:h}=c,x=U===true?"left":typeof U=="string"?U:false,Z=typeof d=="function"?d:le[d]??le.linear,be=me(T.start??"top bottom"),a=me(T.end??"bottom top"),p=typeof ne=="string"?document.querySelector(ne):ne??null,K=Array.isArray(M)?M[0]:null,k=Array.isArray(M)?M[1]:typeof M=="string"?M:null,G=Array.isArray(B)?B[0]:null,Q=Array.isArray(B)?B[1]:typeof B=="number"?B:null,C=Array.isArray(O)?O[0]:null,V=Array.isArray(O)?O[1]:typeof O=="number"?O:null;function ae(o){let i=o*100;switch(x){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let X=x?[]:Array.from(e.querySelectorAll(m)),W=[],de=[],ve=0,Ee=0,te=false,fe=false,J=0,Oe=false,ge=-1,De=-1,oe=false,Ae=0,Se=0,xe,ze=null,Te=new Set,Ie=-1,Ye=performance.now();function ke(){return p?q==="x"?p.scrollLeft:p.scrollTop:q==="x"?window.scrollX:window.scrollY}function Xe(){return p?q==="x"?p.clientWidth:p.clientHeight:q==="x"?window.innerWidth:window.innerHeight}function Je(){let o=e.getBoundingClientRect(),i,w,_;if(p){let se=p.getBoundingClientRect();i=q==="x"?o.left-se.left+p.scrollLeft:o.top-se.top+p.scrollTop,w=q==="x"?o.width:o.height,_=ke();}else i=q==="x"?o.left:o.top,w=q==="x"?o.width:o.height,_=ke();let ue=he({top:i,height:w},_,Xe(),be,a);ve=ue.tStart,Ee=ue.tEnd,we&&process.env.NODE_ENV!=="production"&&(ze?.remove(),ze=St(ve,Ee,q));}function pt(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),x){let w=i==="reverse"?1-o:o;e.style.clipPath=ae(w);return}X.forEach((w,_)=>{w.style.strokeDashoffset=i==="reverse"?`${W[_]*o}`:`${W[_]*(1-o)}`,l&&(w.style.opacity=i==="reverse"?`${1-o}`:`${o}`),K&&k?w.style.stroke=Ce(K,k,o):k&&(w.style.stroke=k),G!==null&&Q!==null?w.style.strokeWidth=`${G+(Q-G)*o}`:Q!==null&&(w.style.strokeWidth=`${Q}`),C!==null&&V!==null?w.style.fillOpacity=`${C+(V-C)*o}`:V!==null&&(w.style.fillOpacity=`${V}`),E&&w.tagName.toLowerCase()==="path"&&de[_]&&w.setAttribute("d",Be(de[_],E,o));});}function Fe(){if(e.style.setProperty("--scroll-draw-progress","0"),x){e.style.clipPath=ae(0);return}X.forEach((o,i)=>{o.style.strokeDasharray=`${W[i]}`,o.style.strokeDashoffset=b==="reverse"?"0":`${W[i]}`,l?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",K&&(o.style.stroke=K),G!==null&&(o.style.strokeWidth=`${G}`),C!==null&&(o.style.fillOpacity=`${C}`),E&&o.tagName.toLowerCase()==="path"&&de[i]&&o.setAttribute("d",de[i]);});}if(X.forEach(o=>{bt(o);let i=Re(o);W.push(i),o.tagName.toLowerCase()==="path"?de.push(o.getAttribute("d")??""):de.push(""),s?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=b==="reverse"?`${i}`:"0",l&&(o.style.opacity="1"),k&&(o.style.stroke=k),Q!==null&&(o.style.strokeWidth=`${Q}`),V!==null&&(o.style.fillOpacity=`${V}`),E&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",E)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=b==="reverse"?"0":`${i}`,l?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",K&&(o.style.stroke=K),G!==null&&(o.style.strokeWidth=`${G}`),C!==null&&(o.style.fillOpacity=`${C}`));}),x){if(s)return e.style.clipPath=ae(1),h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ae(0);}else if(s)return h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function ft(){return !(pe===false||!wt()||!X.length||typeof d!="string"||!(d in rt)||x||q!=="y"||p||u!==1||Y!==0||re||A||D!==false||E||$||I||N>0||f||P||h||M!=null||B!=null||O!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function dt(){let o=`svg-scroll-draw-${++ht}`,i=b==="reverse"?"0":"var(--ssd-len)",w=b==="reverse"?"var(--ssd-len)":"0",_=`stroke-dashoffset:${i};`,ue=`stroke-dashoffset:${w};`;l&&(_+=`opacity:${b==="reverse"?1:0};`,ue+=`opacity:${b==="reverse"?0:1};`);let se=document.createElement("style");se.setAttribute("data-svg-scroll-draw",""),se.textContent=`@keyframes ${o}{from{${_}}to{${ue}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${rt[d]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(se);function y(g,v){g.style.setProperty("--ssd-len",String(W[v])),g.style.strokeDasharray=`${W[v]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(o);}X.forEach(y);let L=false,j=-1;function S(){if(j>=0)return j;let g=e.getBoundingClientRect(),{tStart:v,tEnd:F}=he({top:g.top,height:g.height},ke(),Xe(),be,a);return Z(ee(ke(),v,F,u))}return {destroy(){X.forEach(g=>{g.classList.remove(o),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),se.remove();},replay(){L=false,j=-1,X.forEach(y);},pause(){L=true,X.forEach(g=>{g.style.animationPlayState="paused";});},resume(){L&&(L=false,X.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let v=Math.min(1,Math.max(0,g));j=v,L=true,X.forEach((F,Me)=>{F.classList.remove(o),F.style.strokeDashoffset=b==="reverse"?`${W[Me]*v}`:`${W[Me]*(1-v)}`,l&&(F.style.opacity=b==="reverse"?`${1-v}`:`${v}`);});},getProgress(){return S()}}}if(ft())return dt();function gt(){let o=Math.max(1,ie),i=0,w=0;function _(S){let g=true;if(x){let v=Math.min(1,Math.max(0,S/o)),F=Z(v);Ae=F,e.style.setProperty("--scroll-draw-progress",String(F)),e.style.clipPath=ae(b==="reverse"?1-F:F),f?.(F),v<1&&(g=false);}else X.forEach((v,F)=>{let Me=F*Y*o,$e=Math.min(1,Math.max(0,(S-Me)/o)),ye=Z($e);v.style.strokeDashoffset=b==="reverse"?`${W[F]*ye}`:`${W[F]*(1-ye)}`,l&&(v.style.opacity=b==="reverse"?`${1-ye}`:`${ye}`),K&&k?v.style.stroke=Ce(K,k,ye):k&&(v.style.stroke=k),G!==null&&Q!==null?v.style.strokeWidth=`${G+(Q-G)*ye}`:Q!==null&&(v.style.strokeWidth=`${Q}`),C!==null&&V!==null?v.style.fillOpacity=`${C+(V-C)*ye}`:V!==null&&(v.style.fillOpacity=`${V}`),E&&v.tagName.toLowerCase()==="path"&&de[F]&&v.setAttribute("d",Be(de[F],E,ye)),F===0&&(f?.(ye),e.style.setProperty("--scroll-draw-progress",String(ye))),$e<1&&(g=false);});if($){let v=Math.min(1,Math.max(0,S/o)),F=Z(v);for(let Me in $){let $e=parseFloat(Me);F>=$e&&!Te.has($e)&&(Te.add($e),$[Me]?.());}}return g}function ue(S){if(oe)return;let g=S-i;fe||(fe=true,P?.());let v=_(g);if(v&&!te){te=true,_(o*(1+Math.max(0,X.length-1)*Y)),h?.(),Se<(I==="infinite"?1/0:I??0)&&(Se++,xe=setTimeout(()=>{i=performance.now(),fe=false,te=false,Te.clear(),Fe(),J=requestAnimationFrame(ue);},z));return}v||(J=requestAnimationFrame(ue));}function se(){cancelAnimationFrame(J),clearTimeout(xe),i=performance.now(),w=0,oe=false,fe=false,te=false,Se=0,Te.clear(),Fe(),J=requestAnimationFrame(ue);}let y=new IntersectionObserver(S=>{S.forEach(g=>{g.isIntersecting&&!(re&&te)?se():!g.isIntersecting&&!re&&!te&&(cancelAnimationFrame(J),clearTimeout(xe),i=null);});},{root:p??null,threshold:H,rootMargin:R}),L;function j(){clearTimeout(L),L=setTimeout(()=>{X.forEach((S,g)=>{W[g]=Re(S),S.style.strokeDasharray=`${W[g]}`;});},150);}return window.addEventListener("resize",j),window.addEventListener("orientationchange",j),N>0?setTimeout(()=>y.observe(e),N):y.observe(e),{destroy(){cancelAnimationFrame(J),clearTimeout(xe),y.disconnect(),window.removeEventListener("resize",j),window.removeEventListener("orientationchange",j),clearTimeout(L);},replay(){Se=0,se();},pause(){oe||(oe=true,w=performance.now()-i,cancelAnimationFrame(J));},resume(){oe&&(oe=false,i=performance.now()-w,J=requestAnimationFrame(ue));},seek(S){let g=Math.min(1,Math.max(0,S));Ae=g,oe=true,w=g*o,i=performance.now()-w,cancelAnimationFrame(J),_(w);},getProgress(){return Ae}}}if(ce)return gt();Je();function Ne(){if(!Oe||oe)return;let o=performance.now(),i=ke(),w=u;if(D!==false){let y=o-Ye,L=y>0?Math.abs(i-(Ie<0?i:Ie))/y:0;w=u*Math.max(.2,1+L*(typeof D=="number"?D:1)*.04);}Ie=i,Ye=o;let _=A?De===-1||i>=De?"forward":"reverse":b;De=i;let ue=Ee-ve,se=true;if(x){let y=Z(ee(i,ve,Ee,w));re&&!A&&(ge=Math.max(ge,y),y=ge),Ae=y,e.style.setProperty("--scroll-draw-progress",String(y));let L=_==="reverse"?1-y:y;e.style.clipPath=ae(L),f?.(y),!fe&&ee(i,ve,Ee,w)>0&&(fe=true,P?.()),y>=1&&!te?(te=true,h?.(),Se<(I==="infinite"?1/0:I??0)&&(Se++,xe=setTimeout(()=>{ge=-1,fe=false,te=false,e.style.clipPath=ae(0);},z))):y<1&&!re&&(te=false),J=requestAnimationFrame(Ne);return}if(X.forEach((y,L)=>{let j=L*Y*ue,S=Z(ee(i,ve+j,Ee+j,w));re&&!A&&(ge=Math.max(ge,S),S=ge),Ae=S,y.style.strokeDashoffset=_==="reverse"?`${W[L]*S}`:`${W[L]*(1-S)}`,l&&(y.style.opacity=_==="reverse"?`${1-S}`:`${S}`),K&&k?y.style.stroke=Ce(K,k,S):k&&(y.style.stroke=k),G!==null&&Q!==null?y.style.strokeWidth=`${G+(Q-G)*S}`:Q!==null&&(y.style.strokeWidth=`${Q}`),C!==null&&V!==null?y.style.fillOpacity=`${C+(V-C)*S}`:V!==null&&(y.style.fillOpacity=`${V}`),E&&y.tagName.toLowerCase()==="path"&&de[L]&&y.setAttribute("d",Be(de[L],E,S)),L===0&&(f?.(S),e.style.setProperty("--scroll-draw-progress",String(S))),S<1&&(se=false);}),$){let y=Z(ee(i,ve,Ee,w));for(let L in $){let j=parseFloat(L);y>=j&&!Te.has(j)&&(Te.add(j),$[L]?.());}}!fe&&ee(i,ve,Ee,w)>0&&(fe=true,P?.()),se&&!te?(te=true,h?.(),Se<(I==="infinite"?1/0:I??0)&&(Se++,xe=setTimeout(()=>{ge=-1,fe=false,te=false,Te.clear(),Fe();},z))):!se&&!re&&(te=false),J=requestAnimationFrame(Ne);}let Ve=new IntersectionObserver(o=>{o.forEach(i=>{Oe=i.isIntersecting,Oe&&!oe?J=requestAnimationFrame(Ne):cancelAnimationFrame(J);});},{root:p??null,threshold:H,rootMargin:R}),We;function He(){clearTimeout(We),We=setTimeout(()=>{X.forEach((o,i)=>{W[i]=Re(o),o.style.strokeDasharray=`${W[i]}`;}),Je();},150);}return window.addEventListener("resize",He),window.addEventListener("orientationchange",He),N>0?setTimeout(()=>Ve.observe(e),N):Ve.observe(e),{destroy(){cancelAnimationFrame(J),clearTimeout(xe),Ve.disconnect(),window.removeEventListener("resize",He),window.removeEventListener("orientationchange",He),clearTimeout(We),ze?.remove();},replay(){ge=-1,De=-1,Ie=-1,fe=false,te=false,Se=0,oe=false,Te.clear(),clearTimeout(xe),Fe();},pause(){oe=true,cancelAnimationFrame(J);},resume(){oe&&(oe=false,Oe&&(J=requestAnimationFrame(Ne)));},seek(o){let i=Math.min(1,Math.max(0,o));Ae=i,ge=i,oe=true,cancelAnimationFrame(J),pt(i,b);},getProgress(){return Ae}}}var nt=new Map;function Pe(e,n){nt.set(e,n);}function Le(e){nt.delete(e);}function vt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ot(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let c=[],s=[],m=t[2].trim();if(m)for(let u of m.split(/[\s,]+/)){let l=u.match(/^([-+]?[\d.eE]+)(.*)$/);c.push(l?parseFloat(l[1]):0),s.push(l?l[2]:"");}n.push({fn:t[1],nums:c,units:s});}return n}function Et(e,n,r){let t=ot(e),c=ot(n);return t.length===0||t.length!==c.length?r<1?e:n:t.map((s,m)=>{let u=c[m];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((l,d)=>`${l}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((l,d)=>`${l}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((l,d)=>`${l+(u.nums[d]-l)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function st(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),c=String(n);if(vt(t))return Ce(t,c,r);if(t.includes("("))return Et(t,c,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=c.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let u=parseFloat(s[1]),l=parseFloat(m[1]);return `${u+(l-u)*r}${s[2]||m[2]}`}return r<1?t:c}function xt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var it={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Tt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),At=0;function Mt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function at(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:c={},easing:s="ease-out",speed:m=1,once:u=false,axis:l="y",scrollContainer:d,native:T=true,onProgress:Y,onComplete:b}=n,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,we=typeof s=="function"?s:le[s]??le["ease-out"],q=me(c.start??"top bottom"),ne=me(c.end??"bottom top"),A=typeof d=="string"?document.querySelector(d):d??null,N=Object.entries(t).map(([a,p])=>({prop:xt(a),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function M(){let a=window.getComputedStyle(e);for(let p of N)p.from===""&&(p.from=a.getPropertyValue(p.prop).trim()||"0");}function B(){for(let a of N)e.style.setProperty(a.prop,String(a.to));}if(re)return B(),b?.(),r;M();function O(){if(!T||!Mt()||typeof s!="string"||!(s in it)||l!=="y"||A||u||m!==1||Y||b||(c.start??"top bottom").trim()!=="top bottom"||(c.end??"bottom top").trim()!=="bottom top")return false;for(let a of N)if(!Tt.has(a.prop))return false;return true}function $(){let a=`ssd-a-${++At}`,p=N.map(C=>`${C.prop}:${C.from}`).join(";"),K=N.map(C=>`${C.prop}:${C.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${a}{from{${p}}to{${K}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${it[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(a);let G=()=>l==="x"?window.scrollX:window.scrollY,Q=()=>l==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),k.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(C){let V=Math.min(1,Math.max(0,C));e.classList.remove(a);for(let ae of N)e.style.setProperty(ae.prop,st(ae.from,ae.to,V));},getProgress(){let C=e.getBoundingClientRect(),V=G(),ae=Q(),{tStart:X,tEnd:W}=he({top:C.top,height:C.height},V,ae,q,ne);return we(ee(V,X,W,m))}}}if(O())return $();let D=0,H=0,R=0,I=false,z=false,E=-1,U=0,ce=false,ie=()=>A?l==="x"?A.scrollLeft:A.scrollTop:l==="x"?window.scrollX:window.scrollY,pe=()=>A?l==="x"?A.clientWidth:A.clientHeight:l==="x"?window.innerWidth:window.innerHeight;function f(){let a=e.getBoundingClientRect(),p,K;if(A){let G=A.getBoundingClientRect();p=l==="x"?a.left-G.left+A.scrollLeft:a.top-G.top+A.scrollTop,K=l==="x"?a.width:a.height;}else p=l==="x"?a.left:a.top,K=l==="x"?a.width:a.height;let k=he({top:p,height:K},ie(),pe(),q,ne);D=k.tStart,H=k.tEnd;}function P(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let p of N)e.style.setProperty(p.prop,st(p.from,p.to,a));Y?.(a);}function h(){if(!I||z)return;let a=we(ee(ie(),D,H,m));u&&(E=Math.max(E,a),a=E),U=a,P(a),a>=1&&!ce?(ce=true,b?.()):a<1&&!u&&(ce=false),R=requestAnimationFrame(h);}f();{let a=we(ee(ie(),D,H,m));u&&a>0&&(E=a),U=a,P(a);}let x=new IntersectionObserver(a=>{a.forEach(p=>{I=p.isIntersecting,I&&!z?R=requestAnimationFrame(h):cancelAnimationFrame(R);});},{root:A??null}),Z;function be(){clearTimeout(Z),Z=setTimeout(f,150);}return window.addEventListener("resize",be),window.addEventListener("orientationchange",be),x.observe(e),Pe(e,{type:"animate",getProgress:()=>U,getTrigger:()=>({tStart:D,tEnd:H})}),{destroy(){cancelAnimationFrame(R),x.disconnect(),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),clearTimeout(Z),Le(e);},replay(){E=-1,ce=false,U=0,z=false,P(0);},pause(){z=true,cancelAnimationFrame(R);},resume(){z&&(z=false,I&&(R=requestAnimationFrame(h)));},seek(a){let p=Math.min(1,Math.max(0,a));U=p,E=p,z=true,cancelAnimationFrame(R),P(p);},getProgress(){return U}}}var Ge={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function je(e,n){if(typeof window>"u")return Ge;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),Ge;let t=r,{from:c=0,to:s,format:m,easing:u="ease-out",trigger:l={},once:d=true,decimals:T,onComplete:Y}=n,b=T!==void 0?f=>f.toFixed(T):m??(f=>String(Math.round(f))),re=typeof u=="function"?u:le[u]??le["ease-out"],we=me(l.start??"top 80%"),q=me(l.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=b(s),Y?.(),Ge;t.textContent=b(c);let A=0,N=0,M=0,B=false,O=false,$=-1,D=0,H=false,R=()=>window.scrollY,I=()=>window.innerHeight;function z(){let f=t.getBoundingClientRect(),P=he({top:f.top,height:f.height},R(),I(),we,q);A=P.tStart,N=P.tEnd;}function E(f){t.textContent=b(c+(s-c)*f),t.style.setProperty("--scroll-draw-progress",String(f));}function U(){if(!B||O)return;let f=re(ee(R(),A,N,1));d&&($=Math.max($,f),f=$),D=f,E(f),f>=1&&!H?(H=true,Y?.()):f<1&&!d&&(H=false),M=requestAnimationFrame(U);}z();{let f=re(ee(R(),A,N,1));d&&f>0&&($=f),D=f,E(f);}let ce=new IntersectionObserver(f=>{f.forEach(P=>{B=P.isIntersecting,B&&!O?M=requestAnimationFrame(U):cancelAnimationFrame(M);});}),ie;function pe(){clearTimeout(ie),ie=setTimeout(z,150);}return window.addEventListener("resize",pe),window.addEventListener("orientationchange",pe),ce.observe(t),Pe(t,{type:"counter",getProgress:()=>D,getTrigger:()=>({tStart:A,tEnd:N})}),{destroy(){cancelAnimationFrame(M),ce.disconnect(),window.removeEventListener("resize",pe),window.removeEventListener("orientationchange",pe),clearTimeout(ie),Le(t);},replay(){$=-1,H=false,D=0,O=false,E(0);},pause(){O=true,cancelAnimationFrame(M);},resume(){O&&(O=false,B&&(M=requestAnimationFrame(U)));},seek(f){let P=Math.min(1,Math.max(0,f));D=P,$=P,O=true,cancelAnimationFrame(M),E(P);},getProgress(){return D}}}function ut(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 $t(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 lt(e){let n=ut(e),r=new Map;for(let s of n){let m=s.offsetTop;r.has(m)||r.set(m,[]),r.get(m).push(s);}let t=[],c=Array.from(r.keys()).sort((s,m)=>s-m);for(let s of c){let m=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block";for(let l of m)u.appendChild(l);t.push(u);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Ct(e,n,r,t){if(r<=1||t===0)return e;let c=(r-1)*t,s=n*t,m=s+(1-c);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function Pt(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 ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return ct;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),ct;let t=r,{split:c="words",stagger:s=.04,easing:m="ease-out",from:u={opacity:0,y:24},trigger:l={},once:d=true,onComplete:T}=n,Y=window.matchMedia("(prefers-reduced-motion: reduce)").matches,b=typeof m=="function"?m:le[m]??le["ease-out"],re=me(l.start??"top 85%"),we=me(l.end??"top 40%"),q=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ne;c==="chars"?ne=$t(t):c==="lines"?ne=lt(t):ne=ut(t);let A=ne.length;function N(h,x){u?.opacity!==void 0&&(h.style.opacity=String(u.opacity+(1-u.opacity)*x));let Z=Pt(x,u);Z&&(h.style.transform=Z);}function M(h){t.style.setProperty("--scroll-draw-progress",String(h)),ne.forEach((x,Z)=>{let be=b(Ct(h,Z,A,s));N(x,be);});}if(Y)return M(1),T?.(),{destroy(){t.innerHTML=q,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let B=0,O=0,$=0,D=false,H=false,R=-1,I=0,z=false,E=()=>window.scrollY,U=()=>window.innerHeight;function ce(){let h=t.getBoundingClientRect(),x=he({top:h.top,height:h.height},E(),U(),re,we);B=x.tStart,O=x.tEnd;}function ie(){if(!D||H)return;let h=ee(E(),B,O,1);d&&(R=Math.max(R,h),h=R),I=h,M(h),h>=1&&!z?(z=true,T?.()):h<1&&!d&&(z=false),$=requestAnimationFrame(ie);}ce();let pe=new IntersectionObserver(h=>{h.forEach(x=>{D=x.isIntersecting,D&&!H?$=requestAnimationFrame(ie):cancelAnimationFrame($);});}),f;function P(){clearTimeout(f),f=setTimeout(()=>{if(c==="lines"){let h=I;t.innerHTML=q,t.setAttribute("aria-label",t.textContent??""),ne=lt(t),M(h);}ce();},150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),pe.observe(t),Pe(t,{type:"text",getProgress:()=>I,getTrigger:()=>({tStart:B,tEnd:O})}),{destroy(){cancelAnimationFrame($),pe.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(f),t.innerHTML=q,t.removeAttribute("aria-label"),Le(t);},replay(){R=-1,z=false,I=0,H=false,M(0);},pause(){H=true,cancelAnimationFrame($);},resume(){H&&(H=false,D&&($=requestAnimationFrame(ie)));},seek(h){let x=Math.min(1,Math.max(0,h));I=x,R=x,H=true,cancelAnimationFrame($),M(x);},getProgress(){return I}}}function Lt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?qe(t,n):(console.warn("[svg-scroll-draw] Container not found:",e),r)}function kt(e=document){return Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return qe(n,r)})}function Ot(e=document){return Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return at(n,r)})}function Dt(e=document){return Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(process.env.NODE_ENV!=="production"&&console.warn('[svg-scroll-draw] initScrollCounter: element missing "to" in options JSON:',n),r.to=0),je(n,r)})}function It(e=document){return Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return mt(n,r)})}function fr(e=document){return {draw:kt(e),animate:Ot(e),counter:Dt(e),text:It(e)}}exports.initAll=fr;exports.initScrollAnimate=Ot;exports.initScrollCounter=Dt;exports.initScrollDraw=kt;exports.initScrollText=It;exports.scrollDraw=Lt;
1
+ 'use strict';function ot({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),m=Math.sqrt(t),s=0,f=[];for(let g=0;g<r;g++){let A=Math.pow(m,g);f.push(A),s+=A;}let p=[0],c=0;for(let g=0;g<r;g++)c+=f[g]/s,p.push(c);return g=>{if(g<=0)return 0;if(g>=1)return 1;for(let A=0;A<r;A++)if(g<=p[A+1]){let _=(g-p[A])/(p[A+1]-p[A]);if(A===0)return _*(2-_);let v=1-Math.pow(t,A);return v+(1-v)*(2*_-1)*(2*_-1)}return 1}}function st({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),m=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-m)*(2*Math.PI)/t)+1}var ae={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:ot(),elastic:st()};function me(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 We(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 vt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:vt((e-n)/(r-n)*t,0,1)}function be(e,n,r,t,m){let s=tt(e.top,e.height,n,t.element)-rt(t.viewport,r),f=tt(e.top,e.height,n,m.element)-rt(m.viewport,r);return {tStart:s,tEnd:f}}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),m=nt(n);return !t||!m?e:`rgb(${Math.round(t[0]+(m[0]-t[0])*r)},${Math.round(t[1]+(m[1]-t[1])*r)},${Math.round(t[2]+(m[2]-t[2])*r)})`}var Xe={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 it(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var at={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Et=0;function xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Tt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?it("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&it("Element has a fill \u2014 it may obscure the stroke animation.",e);}function At(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 m(){let s=r==="x"?window.scrollX:window.scrollY,f=e-s,p=n-s,c=r==="x";t.innerHTML=`
2
+ <div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${f}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;${c?`left:${p}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${p}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",m,{passive:true}),m(),t}function Je(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),m=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let f=parseFloat(s),p=t[m++]??f;return String(+(f+(p-f)*r).toFixed(4))})}function _e(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,m=r?{...Xe[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:p=1,fade:c=false,easing:g="linear",trigger:A={},stagger:_=0,direction:v="forward",once:Q=false,debug:ve=false,axis:I="y",scrollContainer:te,autoReverse:ie=false,delay:J=0,strokeColor:x,strokeWidth:N,fillOpacity:b,waypoints:S,velocityScale:q=false,threshold:G=0,rootMargin:re="0px",repeat:z=0,repeatDelay:F=0,morphTo:T,clip:j,autoplay:le=false,duration:Y=1e3,native:U=true,onProgress:d,onStart:M,onComplete:y,onEnter:k,onLeave:we,onEnterBack:Ae,onLeaveBack:Me}=m,ge=j===true?"left":typeof j=="string"?j:false,pe=typeof g=="function"?g:ae[g]??ae.linear,Ne=me(A.start??"top bottom"),Le=me(A.end??"bottom top"),V=typeof te=="string"?document.querySelector(te):te??null,i=Array.isArray(x)?x[0]:null,u=Array.isArray(x)?x[1]:typeof x=="string"?x:null,H=Array.isArray(N)?N[0]:null,P=Array.isArray(N)?N[1]:typeof N=="number"?N:null,B=Array.isArray(b)?b[0]:null,Z=Array.isArray(b)?b[1]:typeof b=="number"?b:null;function W(o){let a=o*100;switch(ge){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let D=ge?[]:Array.from(e.querySelectorAll(f)),C=[],ce=[],fe=0,Ee=0,ee=false,de=false,X=0,He=false,ye=-1,Re=-1,ne=false,Ce=0,Se=0,xe,Ge=null,Te=new Set,qe=-1,Ke=performance.now(),Pe=NaN;function Fe(){return V?I==="x"?V.scrollLeft:V.scrollTop:I==="x"?window.scrollX:window.scrollY}function Qe(){return V?I==="x"?V.clientWidth:V.clientHeight:I==="x"?window.innerWidth:window.innerHeight}function et(){let o=e.getBoundingClientRect(),a,w,R;if(V){let se=V.getBoundingClientRect();a=I==="x"?o.left-se.left+V.scrollLeft:o.top-se.top+V.scrollTop,w=I==="x"?o.width:o.height,R=Fe();}else a=I==="x"?o.left:o.top,w=I==="x"?o.width:o.height,R=Fe();let oe=be({top:a,height:w},R,Qe(),Ne,Le);fe=oe.tStart,Ee=oe.tEnd,ve&&process.env.NODE_ENV!=="production"&&(Ge?.remove(),Ge=At(fe,Ee,I));}function ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),ge){let w=a==="reverse"?1-o:o;e.style.clipPath=W(w);return}D.forEach((w,R)=>{w.style.strokeDashoffset=a==="reverse"?`${C[R]*o}`:`${C[R]*(1-o)}`,c&&(w.style.opacity=a==="reverse"?`${1-o}`:`${o}`),i&&u?w.style.stroke=Oe(i,u,o):u&&(w.style.stroke=u),H!==null&&P!==null?w.style.strokeWidth=`${H+(P-H)*o}`:P!==null&&(w.style.strokeWidth=`${P}`),B!==null&&Z!==null?w.style.fillOpacity=`${B+(Z-B)*o}`:Z!==null&&(w.style.fillOpacity=`${Z}`),T&&w.tagName.toLowerCase()==="path"&&ce[R]&&w.setAttribute("d",Je(ce[R],T,o));});}function ze(){if(e.style.setProperty("--scroll-draw-progress","0"),ge){e.style.clipPath=W(0);return}D.forEach((o,a)=>{o.style.strokeDasharray=`${C[a]}`,o.style.strokeDashoffset=v==="reverse"?"0":`${C[a]}`,c?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),H!==null&&(o.style.strokeWidth=`${H}`),B!==null&&(o.style.fillOpacity=`${B}`),T&&o.tagName.toLowerCase()==="path"&&ce[a]&&o.setAttribute("d",ce[a]);});}if(D.forEach(o=>{Tt(o);let a=We(o);C.push(a),o.tagName.toLowerCase()==="path"?ce.push(o.getAttribute("d")??""):ce.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=v==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),u&&(o.style.stroke=u),P!==null&&(o.style.strokeWidth=`${P}`),Z!==null&&(o.style.fillOpacity=`${Z}`),T&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",T)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=v==="reverse"?"0":`${a}`,c?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),H!==null&&(o.style.strokeWidth=`${H}`),B!==null&&(o.style.fillOpacity=`${B}`));}),ge){if(s)return e.style.clipPath=W(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=W(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(U===false||!xt()||!D.length||typeof g!="string"||!(g in at)||ge||I!=="y"||V||p!==1||_!==0||Q||ie||q!==false||T||S||z||J>0||d||M||y||k||we||Ae||Me||x!=null||N!=null||b!=null||(A.start??"top bottom").trim()!=="top bottom"||(A.end??"bottom top").trim()!=="bottom top")}function wt(){let o=`svg-scroll-draw-${++Et}`,a=v==="reverse"?"0":"var(--ssd-len)",w=v==="reverse"?"var(--ssd-len)":"0",R=`stroke-dashoffset:${a};`,oe=`stroke-dashoffset:${w};`;c&&(R+=`opacity:${v==="reverse"?1:0};`,oe+=`opacity:${v==="reverse"?0:1};`);let se=document.createElement("style");se.setAttribute("data-svg-scroll-draw",""),se.textContent=`@keyframes ${o}{from{${R}}to{${oe}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${at[g]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(se);function ue(l,E){l.style.setProperty("--ssd-len",String(C[E])),l.style.strokeDasharray=`${C[E]}`,l.style.strokeDashoffset="",l.style.opacity="",l.style.animationPlayState="",l.classList.add(o);}D.forEach(ue);let h=false,$=-1;function L(){if($>=0)return $;let l=e.getBoundingClientRect(),{tStart:E,tEnd:O}=be({top:l.top,height:l.height},Fe(),Qe(),Ne,Le);return pe(K(Fe(),E,O,p))}return {destroy(){D.forEach(l=>{l.classList.remove(o),l.style.removeProperty("--ssd-len"),l.style.animationPlayState="";}),se.remove();},replay(){h=false,$=-1,D.forEach(ue);},pause(){h=true,D.forEach(l=>{l.style.animationPlayState="paused";});},resume(){h&&(h=false,D.forEach(l=>{l.style.animationPlayState="running";}));},seek(l){let E=Math.min(1,Math.max(0,l));$=E,h=true,D.forEach((O,$e)=>{O.classList.remove(o),O.style.strokeDashoffset=v==="reverse"?`${C[$e]*E}`:`${C[$e]*(1-E)}`,c&&(O.style.opacity=v==="reverse"?`${1-E}`:`${E}`);});},getProgress(){return L()}}}if(bt())return wt();function St(){let o=Math.max(1,Y),a=0,w=0;function R(L){let l=true;if(ge){let E=Math.min(1,Math.max(0,L/o)),O=pe(E);Ce=O,e.style.setProperty("--scroll-draw-progress",String(O)),e.style.clipPath=W(v==="reverse"?1-O:O),d?.(O),E<1&&(l=false);}else D.forEach((E,O)=>{let $e=O*_*o,ke=Math.min(1,Math.max(0,(L-$e)/o)),he=pe(ke);E.style.strokeDashoffset=v==="reverse"?`${C[O]*he}`:`${C[O]*(1-he)}`,c&&(E.style.opacity=v==="reverse"?`${1-he}`:`${he}`),i&&u?E.style.stroke=Oe(i,u,he):u&&(E.style.stroke=u),H!==null&&P!==null?E.style.strokeWidth=`${H+(P-H)*he}`:P!==null&&(E.style.strokeWidth=`${P}`),B!==null&&Z!==null?E.style.fillOpacity=`${B+(Z-B)*he}`:Z!==null&&(E.style.fillOpacity=`${Z}`),T&&E.tagName.toLowerCase()==="path"&&ce[O]&&E.setAttribute("d",Je(ce[O],T,he)),O===0&&(d?.(he),e.style.setProperty("--scroll-draw-progress",String(he))),ke<1&&(l=false);});if(S){let E=Math.min(1,Math.max(0,L/o)),O=pe(E);for(let $e in S){let ke=parseFloat($e);O>=ke&&!Te.has(ke)&&(Te.add(ke),S[$e]?.());}}return l}function oe(L){if(ne)return;let l=L-a;de||(de=true,M?.());let E=R(l);if(E&&!ee){ee=true,R(o*(1+Math.max(0,D.length-1)*_)),y?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{a=performance.now(),de=false,ee=false,Te.clear(),ze(),X=requestAnimationFrame(oe);},F));return}E||(X=requestAnimationFrame(oe));}function se(){cancelAnimationFrame(X),clearTimeout(xe),a=performance.now(),w=0,ne=false,de=false,ee=false,Se=0,Te.clear(),ze(),X=requestAnimationFrame(oe);}let ue=new IntersectionObserver(L=>{L.forEach(l=>{l.isIntersecting&&!(Q&&ee)?se():!l.isIntersecting&&!Q&&!ee&&(cancelAnimationFrame(X),clearTimeout(xe),a=null);});},{root:V??null,threshold:G,rootMargin:re}),h;function $(){clearTimeout(h),h=setTimeout(()=>{D.forEach((L,l)=>{C[l]=We(L),L.style.strokeDasharray=`${C[l]}`;});},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),J>0?setTimeout(()=>ue.observe(e),J):ue.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(xe),ue.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(h);},replay(){Se=0,se();},pause(){ne||(ne=true,w=performance.now()-a,cancelAnimationFrame(X));},resume(){ne&&(ne=false,a=performance.now()-w,X=requestAnimationFrame(oe));},seek(L){let l=Math.min(1,Math.max(0,L));Ce=l,ne=true,w=l*o,a=performance.now()-w,cancelAnimationFrame(X),R(w);},getProgress(){return Ce}}}if(le)return St();et();function Ve(){if(!He||ne)return;let o=performance.now(),a=Fe(),w=p;if(q!==false){let h=o-Ke,$=h>0?Math.abs(a-(qe<0?a:qe))/h:0;w=p*Math.max(.2,1+$*(typeof q=="number"?q:1)*.04);}qe=a,Ke=o;let R=ie?Re===-1||a>=Re?"forward":"reverse":v;Re=a;let oe=Ee-fe,se=true,ue=oe===0?0:(a-fe)/oe;if(isNaN(Pe)||(Pe<=0&&ue>0?k?.():Pe>0&&ue<=0&&Me?.(),Pe<1&&ue>=1?we?.():Pe>=1&&ue<1&&Ae?.()),Pe=ue,ge){let h=pe(K(a,fe,Ee,w));Q&&!ie&&(ye=Math.max(ye,h),h=ye),Ce=h,e.style.setProperty("--scroll-draw-progress",String(h));let $=R==="reverse"?1-h:h;e.style.clipPath=W($),d?.(h),!de&&K(a,fe,Ee,w)>0&&(de=true,M?.()),h>=1&&!ee?(ee=true,y?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{ye=-1,de=false,ee=false,e.style.clipPath=W(0);},F))):h<1&&!Q&&(ee=false),X=requestAnimationFrame(Ve);return}if(D.forEach((h,$)=>{let L=$*_*oe,l=pe(K(a,fe+L,Ee+L,w));Q&&!ie&&(ye=Math.max(ye,l),l=ye),Ce=l,h.style.strokeDashoffset=R==="reverse"?`${C[$]*l}`:`${C[$]*(1-l)}`,c&&(h.style.opacity=R==="reverse"?`${1-l}`:`${l}`),i&&u?h.style.stroke=Oe(i,u,l):u&&(h.style.stroke=u),H!==null&&P!==null?h.style.strokeWidth=`${H+(P-H)*l}`:P!==null&&(h.style.strokeWidth=`${P}`),B!==null&&Z!==null?h.style.fillOpacity=`${B+(Z-B)*l}`:Z!==null&&(h.style.fillOpacity=`${Z}`),T&&h.tagName.toLowerCase()==="path"&&ce[$]&&h.setAttribute("d",Je(ce[$],T,l)),$===0&&(d?.(l),e.style.setProperty("--scroll-draw-progress",String(l))),l<1&&(se=false);}),S){let h=pe(K(a,fe,Ee,w));for(let $ in S){let L=parseFloat($);h>=L&&!Te.has(L)&&(Te.add(L),S[$]?.());}}!de&&K(a,fe,Ee,w)>0&&(de=true,M?.()),se&&!ee?(ee=true,y?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{ye=-1,de=false,ee=false,Te.clear(),ze();},F))):!se&&!Q&&(ee=false),X=requestAnimationFrame(Ve);}let je=new IntersectionObserver(o=>{o.forEach(a=>{He=a.isIntersecting,He&&!ne?X=requestAnimationFrame(Ve):cancelAnimationFrame(X);});},{root:V??null,threshold:G,rootMargin:re}),Ye;function Be(){clearTimeout(Ye),Ye=setTimeout(()=>{D.forEach((o,a)=>{C[a]=We(o),o.style.strokeDasharray=`${C[a]}`;}),et();},150);}return window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be),J>0?setTimeout(()=>je.observe(e),J):je.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(xe),je.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ye),Ge?.remove();},replay(){ye=-1,Re=-1,qe=-1,de=false,ee=false,Se=0,ne=false,Te.clear(),clearTimeout(xe),ze();},pause(){ne=true,cancelAnimationFrame(X);},resume(){ne&&(ne=false,He&&(X=requestAnimationFrame(Ve)));},seek(o){let a=Math.min(1,Math.max(0,o));Ce=a,ye=a,ne=true,cancelAnimationFrame(X),ht(a,v);},getProgress(){return Ce}}}var lt=new Map;function De(e,n){lt.set(e,n);}function Ie(e){lt.delete(e);}function Mt(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 m=[],s=[],f=t[2].trim();if(f)for(let p of f.split(/[\s,]+/)){let c=p.match(/^([-+]?[\d.eE]+)(.*)$/);m.push(c?parseFloat(c[1]):0),s.push(c?c[2]:"");}n.push({fn:t[1],nums:m,units:s});}return n}function Ct(e,n,r){let t=ct(e),m=ct(n);return t.length===0||t.length!==m.length?r<1?e:n:t.map((s,f)=>{let p=m[f];return s.fn!==p.fn||s.nums.length!==p.nums.length?r<1?`${s.fn}(${s.nums.map((c,g)=>`${c}${s.units[g]}`).join(", ")})`:`${p.fn}(${p.nums.map((c,g)=>`${c}${p.units[g]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,g)=>`${c+(p.nums[g]-c)*r}${s.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),m=String(n);if(Mt(t))return Oe(t,m,r);if(t.includes("("))return Ct(t,m,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),f=m.match(/^([-+]?[\d.]+)(.*)$/);if(s&&f){let p=parseFloat(s[1]),c=parseFloat(f[1]);return `${p+(c-p)*r}${s[2]||f[2]}`}return r<1?t:m}function $t(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"},Lt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Pt=0;function kt(){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:m={},easing:s="ease-out",speed:f=1,once:p=false,axis:c="y",scrollContainer:g,native:A=true,onProgress:_,onComplete:v,onEnter:Q,onLeave:ve,onEnterBack:I,onLeaveBack:te}=n,ie=window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=typeof s=="function"?s:ae[s]??ae["ease-out"],x=me(m.start??"top bottom"),N=me(m.end??"bottom top"),b=typeof g=="string"?document.querySelector(g):g??null,S=Object.entries(t).map(([i,u])=>({prop:$t(i),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function q(){let i=window.getComputedStyle(e);for(let u of S)u.from===""&&(u.from=i.getPropertyValue(u.prop).trim()||"0");}function G(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}if(ie)return G(),v?.(),r;q();function re(){if(!A||!kt()||typeof s!="string"||!(s in mt)||c!=="y"||b||p||f!==1||_||v||Q||ve||I||te||(m.start??"top bottom").trim()!=="top bottom"||(m.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!Lt.has(i.prop))return false;return true}function z(){let i=`ssd-a-${++Pt}`,u=S.map(W=>`${W.prop}:${W.from}`).join(";"),H=S.map(W=>`${W.prop}:${W.to}`).join(";"),P=document.createElement("style");P.setAttribute("data-ssd-animate",""),P.textContent=`@keyframes ${i}{from{${u}}to{${H}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${mt[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(P),e.classList.add(i);let B=()=>c==="x"?window.scrollX:window.scrollY,Z=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),P.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(W){let D=Math.min(1,Math.max(0,W));e.classList.remove(i);for(let C of S)e.style.setProperty(C.prop,ut(C.from,C.to,D));},getProgress(){let W=e.getBoundingClientRect(),D=B(),C=Z(),{tStart:ce,tEnd:fe}=be({top:W.top,height:W.height},D,C,x,N);return J(K(D,ce,fe,f))}}}if(re())return z();let F=0,T=0,j=0,le=false,Y=false,U=-1,d=0,M=false,y=NaN,k=()=>b?c==="x"?b.scrollLeft:b.scrollTop:c==="x"?window.scrollX:window.scrollY,we=()=>b?c==="x"?b.clientWidth:b.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function Ae(){let i=e.getBoundingClientRect(),u,H;if(b){let B=b.getBoundingClientRect();u=c==="x"?i.left-B.left+b.scrollLeft:i.top-B.top+b.scrollTop,H=c==="x"?i.width:i.height;}else u=c==="x"?i.left:i.top,H=c==="x"?i.width:i.height;let P=be({top:u,height:H},k(),we(),x,N);F=P.tStart,T=P.tEnd;}function Me(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let u of S)e.style.setProperty(u.prop,ut(u.from,u.to,i));_?.(i);}function ge(i){if(isNaN(y)){y=i;return}y<=0&&i>0?Q?.():y>0&&i<=0&&te?.(),y<1&&i>=1?ve?.():y>=1&&i<1&&I?.(),y=i;}function pe(){if(!le||Y)return;let i=T===F?0:(k()-F)/(T-F);ge(i);let u=J(K(k(),F,T,f));p&&(U=Math.max(U,u),u=U),d=u,Me(u),u>=1&&!M?(M=true,v?.()):u<1&&!p&&(M=false),j=requestAnimationFrame(pe);}Ae();{let i=J(K(k(),F,T,f));p&&i>0&&(U=i),d=i,Me(i);}let Ne=new IntersectionObserver(i=>{i.forEach(u=>{le=u.isIntersecting,le&&!Y?j=requestAnimationFrame(pe):cancelAnimationFrame(j);});},{root:b??null}),Le;function V(){clearTimeout(Le),Le=setTimeout(Ae,150);}return window.addEventListener("resize",V),window.addEventListener("orientationchange",V),Ne.observe(e),De(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:F,tEnd:T})}),{destroy(){cancelAnimationFrame(j),Ne.disconnect(),window.removeEventListener("resize",V),window.removeEventListener("orientationchange",V),clearTimeout(Le),Ie(e);},replay(){U=-1,M=false,d=0,Y=false,Me(0);},pause(){Y=true,cancelAnimationFrame(j);},resume(){Y&&(Y=false,le&&(j=requestAnimationFrame(pe)));},seek(i){let u=Math.min(1,Math.max(0,i));d=u,U=u,Y=true,cancelAnimationFrame(j),Me(u);},getProgress(){return d}}}var Ue={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ze(e,n){if(typeof window>"u")return Ue;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),Ue;let t=r,{from:m=0,to:s,format:f,easing:p="ease-out",trigger:c={},once:g=true,decimals:A,onComplete:_}=n,v=A!==void 0?d=>d.toFixed(A):f??(d=>String(Math.round(d))),Q=typeof p=="function"?p:ae[p]??ae["ease-out"],ve=me(c.start??"top 80%"),I=me(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=v(s),_?.(),Ue;t.textContent=v(m);let ie=0,J=0,x=0,N=false,b=false,S=-1,q=0,G=false,re=()=>window.scrollY,z=()=>window.innerHeight;function F(){let d=t.getBoundingClientRect(),M=be({top:d.top,height:d.height},re(),z(),ve,I);ie=M.tStart,J=M.tEnd;}function T(d){t.textContent=v(m+(s-m)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function j(){if(!N||b)return;let d=Q(K(re(),ie,J,1));g&&(S=Math.max(S,d),d=S),q=d,T(d),d>=1&&!G?(G=true,_?.()):d<1&&!g&&(G=false),x=requestAnimationFrame(j);}F();{let d=Q(K(re(),ie,J,1));g&&d>0&&(S=d),q=d,T(d);}let le=new IntersectionObserver(d=>{d.forEach(M=>{N=M.isIntersecting,N&&!b?x=requestAnimationFrame(j):cancelAnimationFrame(x);});}),Y;function U(){clearTimeout(Y),Y=setTimeout(F,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),le.observe(t),De(t,{type:"counter",getProgress:()=>q,getTrigger:()=>({tStart:ie,tEnd:J})}),{destroy(){cancelAnimationFrame(x),le.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(Y),Ie(t);},replay(){S=-1,G=false,q=0,b=false,T(0);},pause(){b=true,cancelAnimationFrame(x);},resume(){b&&(b=false,N&&(x=requestAnimationFrame(j)));},seek(d){let M=Math.min(1,Math.max(0,d));q=M,S=M,b=true,cancelAnimationFrame(x),T(M);},getProgress(){return q}}}function gt(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 Ot(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 ft(e){let n=gt(e),r=new Map;for(let s of n){let f=s.offsetTop;r.has(f)||r.set(f,[]),r.get(f).push(s);}let t=[],m=Array.from(r.keys()).sort((s,f)=>s-f);for(let s of m){let f=r.get(s),p=document.createElement("span");p.setAttribute("aria-hidden","true"),p.style.display="inline-block";for(let c of f)p.appendChild(c);t.push(p);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Dt(e,n,r,t){if(r<=1||t===0)return e;let m=(r-1)*t,s=n*t,f=s+(1-m);return f<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(f-s)))}function It(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 dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yt(e,n={}){if(typeof window>"u")return dt;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),dt;let t=r,{split:m="words",stagger:s=.04,easing:f="ease-out",from:p={opacity:0,y:24},trigger:c={},once:g=true,onComplete:A}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,v=typeof f=="function"?f:ae[f]??ae["ease-out"],Q=me(c.start??"top 85%"),ve=me(c.end??"top 40%"),I=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let te;m==="chars"?te=Ot(t):m==="lines"?te=ft(t):te=gt(t);let ie=te.length;function J(y,k){p?.opacity!==void 0&&(y.style.opacity=String(p.opacity+(1-p.opacity)*k));let we=It(k,p);we&&(y.style.transform=we);}function x(y){t.style.setProperty("--scroll-draw-progress",String(y)),te.forEach((k,we)=>{let Ae=v(Dt(y,we,ie,s));J(k,Ae);});}if(_)return x(1),A?.(),{destroy(){t.innerHTML=I,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let N=0,b=0,S=0,q=false,G=false,re=-1,z=0,F=false,T=()=>window.scrollY,j=()=>window.innerHeight;function le(){let y=t.getBoundingClientRect(),k=be({top:y.top,height:y.height},T(),j(),Q,ve);N=k.tStart,b=k.tEnd;}function Y(){if(!q||G)return;let y=K(T(),N,b,1);g&&(re=Math.max(re,y),y=re),z=y,x(y),y>=1&&!F?(F=true,A?.()):y<1&&!g&&(F=false),S=requestAnimationFrame(Y);}le();let U=new IntersectionObserver(y=>{y.forEach(k=>{q=k.isIntersecting,q&&!G?S=requestAnimationFrame(Y):cancelAnimationFrame(S);});}),d;function M(){clearTimeout(d),d=setTimeout(()=>{if(m==="lines"){let y=z;t.innerHTML=I,t.setAttribute("aria-label",t.textContent??""),te=ft(t),x(y);}le();},150);}return window.addEventListener("resize",M),window.addEventListener("orientationchange",M),U.observe(t),De(t,{type:"text",getProgress:()=>z,getTrigger:()=>({tStart:N,tEnd:b})}),{destroy(){cancelAnimationFrame(S),U.disconnect(),window.removeEventListener("resize",M),window.removeEventListener("orientationchange",M),clearTimeout(d),t.innerHTML=I,t.removeAttribute("aria-label"),Ie(t);},replay(){re=-1,F=false,z=0,G=false,x(0);},pause(){G=true,cancelAnimationFrame(S);},resume(){G&&(G=false,q&&(S=requestAnimationFrame(Y)));},seek(y){let k=Math.min(1,Math.max(0,y));z=k,re=k,G=true,cancelAnimationFrame(S),x(k);},getProgress(){return z}}}function Nt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?_e(t,n):(console.warn("[svg-scroll-draw] Container not found:",e),r)}function Ft(e=document){return Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return _e(n,r)})}function Ht(e=document){return Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return pt(n,r)})}function Rt(e=document){return Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(process.env.NODE_ENV!=="production"&&console.warn('[svg-scroll-draw] initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Ze(n,r)})}function qt(e=document){return Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return yt(n,r)})}function br(e=document){return {draw:Ft(e),animate:Ht(e),counter:Rt(e),text:qt(e)}}exports.initAll=br;exports.initScrollAnimate=Ht;exports.initScrollCounter=Rt;exports.initScrollDraw=Ft;exports.initScrollText=qt;exports.scrollDraw=Nt;
@@ -71,6 +71,14 @@ interface ScrollDrawOptions {
71
71
  onProgress?: (alpha: number) => void;
72
72
  onStart?: () => void;
73
73
  onComplete?: () => void;
74
+ /** Fires when scroll position enters the trigger zone (scrolling forward). */
75
+ onEnter?: () => void;
76
+ /** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
77
+ onLeave?: () => void;
78
+ /** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
79
+ onEnterBack?: () => void;
80
+ /** Fires when scroll position exits the trigger zone at the start (scrolling back). */
81
+ onLeaveBack?: () => void;
74
82
  /**
75
83
  * Trigger the animation when the element enters the viewport instead of
76
84
  * tying it to scroll position. The draw runs over `duration` milliseconds,