svg-scroll-draw 2.7.0 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/angular/index.cjs +3 -3
  2. package/dist/angular/index.d.mts +48 -0
  3. package/dist/angular/index.d.ts +48 -0
  4. package/dist/angular/index.mjs +3 -3
  5. package/dist/astro/index.cjs +3 -3
  6. package/dist/astro/index.d.mts +20 -5
  7. package/dist/astro/index.d.ts +20 -5
  8. package/dist/astro/index.mjs +3 -3
  9. package/dist/cdn/svg-scroll-draw.dev.global.js +1878 -0
  10. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  11. package/dist/cinematic/index.cjs +2 -2
  12. package/dist/cinematic/index.mjs +2 -2
  13. package/dist/cli/init.js +104 -101
  14. package/dist/devtools/index.cjs +1 -1
  15. package/dist/devtools/index.mjs +1 -1
  16. package/dist/group/index.cjs +3 -3
  17. package/dist/group/index.d.mts +48 -0
  18. package/dist/group/index.d.ts +48 -0
  19. package/dist/group/index.mjs +3 -3
  20. package/dist/horizontal/index.cjs +1 -0
  21. package/dist/horizontal/index.d.mts +108 -0
  22. package/dist/horizontal/index.d.ts +108 -0
  23. package/dist/horizontal/index.mjs +1 -0
  24. package/dist/index.cjs +4 -4
  25. package/dist/index.d.mts +48 -0
  26. package/dist/index.d.ts +48 -0
  27. package/dist/index.mjs +4 -4
  28. package/dist/nuxt/index.cjs +3 -3
  29. package/dist/nuxt/index.d.mts +33 -0
  30. package/dist/nuxt/index.d.ts +33 -0
  31. package/dist/nuxt/index.mjs +3 -3
  32. package/dist/pin/index.cjs +1 -1
  33. package/dist/pin/index.mjs +1 -1
  34. package/dist/progress/index.cjs +1 -0
  35. package/dist/progress/index.d.mts +74 -0
  36. package/dist/progress/index.d.ts +74 -0
  37. package/dist/progress/index.mjs +1 -0
  38. package/dist/react/index.cjs +3 -3
  39. package/dist/react/index.d.mts +33 -0
  40. package/dist/react/index.d.ts +33 -0
  41. package/dist/react/index.mjs +3 -3
  42. package/dist/reveal/index.cjs +1 -0
  43. package/dist/reveal/index.d.mts +80 -0
  44. package/dist/reveal/index.d.ts +80 -0
  45. package/dist/reveal/index.mjs +1 -0
  46. package/dist/snap/index.cjs +1 -1
  47. package/dist/snap/index.d.mts +8 -0
  48. package/dist/snap/index.d.ts +8 -0
  49. package/dist/snap/index.mjs +1 -1
  50. package/dist/solid/index.cjs +3 -3
  51. package/dist/solid/index.d.mts +48 -0
  52. package/dist/solid/index.d.ts +48 -0
  53. package/dist/solid/index.mjs +3 -3
  54. package/dist/svelte/index.cjs +3 -3
  55. package/dist/svelte/index.d.mts +48 -0
  56. package/dist/svelte/index.d.ts +48 -0
  57. package/dist/svelte/index.mjs +3 -3
  58. package/dist/text/index.cjs +1 -1
  59. package/dist/text/index.d.mts +15 -0
  60. package/dist/text/index.d.ts +15 -0
  61. package/dist/text/index.mjs +1 -1
  62. package/dist/timeline/index.cjs +8 -8
  63. package/dist/timeline/index.d.mts +31 -0
  64. package/dist/timeline/index.d.ts +31 -0
  65. package/dist/timeline/index.mjs +8 -8
  66. package/dist/video/index.cjs +1 -1
  67. package/dist/video/index.d.mts +15 -0
  68. package/dist/video/index.d.ts +15 -0
  69. package/dist/video/index.mjs +1 -1
  70. package/dist/vue/index.cjs +3 -3
  71. package/dist/vue/index.d.mts +33 -0
  72. package/dist/vue/index.d.ts +33 -0
  73. package/dist/vue/index.mjs +3 -3
  74. package/dist/web-component/index.cjs +3 -3
  75. package/dist/web-component/index.mjs +3 -3
  76. package/package.json +37 -5
@@ -1,3 +1,3 @@
1
- 'use strict';function Et({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),u=Math.sqrt(t),s=0,f=[];for(let h=0;h<r;h++){let $=Math.pow(u,h);f.push($),s+=$;}let l=[0],c=0;for(let h=0;h<r;h++)c+=f[h]/s,l.push(c);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let $=0;$<r;$++)if(h<=l[$+1]){let B=(h-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 St({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),u=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-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:Et(),elastic:St()};function ae(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 nt(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 ot(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 _e(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 xt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:xt((e-n)/(r-n)*t,0,1)}function pe(e,n,r,t,u){let s=nt(e.top,e.height,n,t.element)-ot(t.viewport,r),f=nt(e.top,e.height,n,u.element)-ot(u.viewport,r);return {tStart:s,tEnd:f}}function st(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 De(e,n,r){let t=st(e),u=st(n);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*r)},${Math.round(t[1]+(u[1]-t[1])*r)},${Math.round(t[2]+(u[2]-t[2])*r)})`}var it={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 at(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var lt={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 n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?at("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&at("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Lt(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 u(){let s=r==="x"?window.scrollX:window.scrollY,f=e-s,l=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:${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 Ke(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let f=parseFloat(s),l=t[u++]??f;return String(+(f+(l-f)*r).toFixed(4))})}function Be(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,u=r?{...it[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:h="linear",trigger:$={},stagger:B=0,direction:S="forward",once:Q=false,debug:he=false,axis:R="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:P=false,threshold:I=0,rootMargin:G="0px",repeat:C=0,repeatDelay:F=0,morphTo:M,clip:z,autoplay:re=false,duration:N=1e3,native:W=true,onProgress:d,onStart:L,onComplete:g,onEnter:y,onLeave:X,onEnterBack:Se,onLeaveBack:be}=u,we=z===true?"left":typeof z=="string"?z:false,de=typeof h=="function"?h:ie[h]??ie.linear,Fe=ae($.start??"top bottom"),Ie=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,oe=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(o){let a=o*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(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=we?[]:Array.from(e.querySelectorAll(f)),O=[],me=[],ge=0,Te=0,se=false,ye=false,ne=0,He=false,ve=-1,Re=-1,le=false,Ce=0,xe=0,Ae,Ue=null,Me=new Set,ze=-1,et=performance.now(),Oe=NaN;function Ne(){return U?R==="x"?U.scrollLeft:U.scrollTop:R==="x"?window.scrollX:window.scrollY}function tt(){return U?R==="x"?U.clientWidth:U.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function rt(){let o=e.getBoundingClientRect(),a,E,j;if(U){let ue=U.getBoundingClientRect();a=R==="x"?o.left-ue.left+U.scrollLeft:o.top-ue.top+U.scrollTop,E=R==="x"?o.width:o.height,j=Ne();}else a=R==="x"?o.left:o.top,E=R==="x"?o.width:o.height,j=Ne();let ce=pe({top:a,height:E},j,tt(),Fe,Ie);ge=ce.tStart,Te=ce.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=Lt(ge,Te,R));}function ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),we){let E=a==="reverse"?1-o:o;e.style.clipPath=J(E);return}_.forEach((E,j)=>{E.style.strokeDashoffset=a==="reverse"?`${O[j]*o}`:`${O[j]*(1-o)}`,c&&(E.style.opacity=a==="reverse"?`${1-o}`:`${o}`),i&&p?E.style.stroke=De(i,p,o):p&&(E.style.stroke=p),Y!==null&&H!==null?E.style.strokeWidth=`${Y+(H-Y)*o}`:H!==null&&(E.style.strokeWidth=`${H}`),Z!==null&&oe!==null?E.style.fillOpacity=`${Z+(oe-Z)*o}`:oe!==null&&(E.style.fillOpacity=`${oe}`),M&&E.tagName.toLowerCase()==="path"&&me[j]&&E.setAttribute("d",Ke(me[j],M,o));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}_.forEach((o,a)=>{o.style.strokeDasharray=`${O[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${O[a]}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),Y!==null&&(o.style.strokeWidth=`${Y}`),Z!==null&&(o.style.fillOpacity=`${Z}`),M&&o.tagName.toLowerCase()==="path"&&me[a]&&o.setAttribute("d",me[a]);});}if(_.forEach(o=>{Mt(o);let a=_e(o);O.push(a),o.tagName.toLowerCase()==="path"?me.push(o.getAttribute("d")??""):me.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),p&&(o.style.stroke=p),H!==null&&(o.style.strokeWidth=`${H}`),oe!==null&&(o.style.fillOpacity=`${oe}`),M&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",M)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),Y!==null&&(o.style.strokeWidth=`${Y}`),Z!==null&&(o.style.fillOpacity=`${Z}`));}),we){if(s)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(W===false||!At()||!_.length||typeof h!="string"||!(h in lt)||we||R!=="y"||U||l!==1||B!==0||Q||te||P!==false||M||b||C||q>0||d||L||g||y||X||Se||be||x!=null||A!=null||w!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function wt(){let o=`svg-scroll-draw-${++Tt}`,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 ${o}{from{${j}}to{${ce}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${lt[h]};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(O[T])),m.style.strokeDasharray=`${O[T]}`,m.style.strokeDashoffset="",m.style.opacity="",m.style.animationPlayState="",m.classList.add(o);}_.forEach(fe);let v=false,k=-1;function D(){if(k>=0)return k;let m=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:m.top,height:m.height},Ne(),tt(),Fe,Ie);return de(K(Ne(),T,V,l))}return {destroy(){_.forEach(m=>{m.classList.remove(o),m.style.removeProperty("--ssd-len"),m.style.animationPlayState="";}),ue.remove();},replay(){v=false,k=-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));k=T,v=true,_.forEach((V,Pe)=>{V.classList.remove(o),V.style.strokeDashoffset=S==="reverse"?`${O[Pe]*T}`:`${O[Pe]*(1-T)}`,c&&(V.style.opacity=S==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return D()}}}if(bt())return wt();function vt(){let o=Math.max(1,N),a=0,E=0;function j(D){let m=true;if(we){let T=Math.min(1,Math.max(0,D/o)),V=de(T);Ce=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 Pe=V*B*o,ke=Math.min(1,Math.max(0,(D-Pe)/o)),Ee=de(ke);T.style.strokeDashoffset=S==="reverse"?`${O[V]*Ee}`:`${O[V]*(1-Ee)}`,c&&(T.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),i&&p?T.style.stroke=De(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&&oe!==null?T.style.fillOpacity=`${Z+(oe-Z)*Ee}`:oe!==null&&(T.style.fillOpacity=`${oe}`),M&&T.tagName.toLowerCase()==="path"&&me[V]&&T.setAttribute("d",Ke(me[V],M,Ee)),V===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),ke<1&&(m=false);});if(b){let T=Math.min(1,Math.max(0,D/o)),V=de(T);for(let Pe in b){let ke=parseFloat(Pe);V>=ke&&!Me.has(ke)&&(Me.add(ke),b[Pe]?.());}}return m}function ce(D){if(le)return;let m=D-a;ye||(ye=true,L?.());let T=j(m);if(T&&!se){se=true,j(o*(1+Math.max(0,_.length-1)*B)),g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{a=performance.now(),ye=false,se=false,Me.clear(),Ve(),ne=requestAnimationFrame(ce);},F));return}T||(ne=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(ne),clearTimeout(Ae),a=performance.now(),E=0,le=false,ye=false,se=false,xe=0,Me.clear(),Ve(),ne=requestAnimationFrame(ce);}let fe=new IntersectionObserver(D=>{D.forEach(m=>{m.isIntersecting&&!(Q&&se)?ue():!m.isIntersecting&&!Q&&!se&&(cancelAnimationFrame(ne),clearTimeout(Ae),a=null);});},{root:U??null,threshold:I,rootMargin:G}),v;function k(){clearTimeout(v),v=setTimeout(()=>{_.forEach((D,m)=>{O[m]=_e(D),D.style.strokeDasharray=`${O[m]}`;});},150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),q>0?setTimeout(()=>fe.observe(e),q):fe.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),fe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),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(D){let m=Math.min(1,Math.max(0,D));Ce=m,le=true,E=m*o,a=performance.now()-E,cancelAnimationFrame(ne),j(E);},getProgress(){return Ce}}}if(re)return vt();rt();function qe(){if(!He||le)return;let o=performance.now(),a=Ne(),E=l;if(P!==false){let v=o-et,k=v>0?Math.abs(a-(ze<0?a:ze))/v:0;E=l*Math.max(.2,1+k*(typeof P=="number"?P:1)*.04);}ze=a,et=o;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(Oe)||(Oe<=0&&fe>0?y?.():Oe>0&&fe<=0&&be?.(),Oe<1&&fe>=1?X?.():Oe>=1&&fe<1&&Se?.()),Oe=fe,we){let v=de(K(a,ge,Te,E));Q&&!te&&(ve=Math.max(ve,v),v=ve),Ce=v,e.style.setProperty("--scroll-draw-progress",String(v));let k=j==="reverse"?1-v:v;e.style.clipPath=J(k),d?.(v),!ye&&K(a,ge,Te,E)>0&&(ye=true,L?.()),v>=1&&!se?(se=true,g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,ye=false,se=false,e.style.clipPath=J(0);},F))):v<1&&!Q&&(se=false),ne=requestAnimationFrame(qe);return}if(_.forEach((v,k)=>{let D=k*B*ce,m=de(K(a,ge+D,Te+D,E));Q&&!te&&(ve=Math.max(ve,m),m=ve),Ce=m,v.style.strokeDashoffset=j==="reverse"?`${O[k]*m}`:`${O[k]*(1-m)}`,c&&(v.style.opacity=j==="reverse"?`${1-m}`:`${m}`),i&&p?v.style.stroke=De(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&&oe!==null?v.style.fillOpacity=`${Z+(oe-Z)*m}`:oe!==null&&(v.style.fillOpacity=`${oe}`),M&&v.tagName.toLowerCase()==="path"&&me[k]&&v.setAttribute("d",Ke(me[k],M,m)),k===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 k in b){let D=parseFloat(k);v>=D&&!Me.has(D)&&(Me.add(D),b[k]?.());}}!ye&&K(a,ge,Te,E)>0&&(ye=true,L?.()),ue&&!se?(se=true,g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,ye=false,se=false,Me.clear(),Ve();},F))):!ue&&!Q&&(se=false),ne=requestAnimationFrame(qe);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{He=a.isIntersecting,He&&!le?ne=requestAnimationFrame(qe):cancelAnimationFrame(ne);});},{root:U??null,threshold:I,rootMargin:G}),Je;function We(){clearTimeout(Je),Je=setTimeout(()=>{_.forEach((o,a)=>{O[a]=_e(o),o.style.strokeDasharray=`${O[a]}`;}),rt();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),q>0?setTimeout(()=>Ze.observe(e),q):Ze.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),Ze.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,Re=-1,ze=-1,ye=false,se=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),Ve();},pause(){le=true,cancelAnimationFrame(ne);},resume(){le&&(le=false,He&&(ne=requestAnimationFrame(qe)));},seek(o){let a=Math.min(1,Math.max(0,o));Ce=a,ve=a,le=true,cancelAnimationFrame(ne),ht(a,S);},getProgress(){return Ce}}}var ct=new Map;function Le(e,n){ct.set(e,n);}function $e(e){ct.delete(e);}function $t(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ut(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let u=[],s=[],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),s.push(c?c[2]:"");}n.push({fn:t[1],nums:u,units:s});}return n}function Ct(e,n,r){let t=ut(e),u=ut(n);return t.length===0||t.length!==u.length?r<1?e:n:t.map((s,f)=>{let l=u[f];return s.fn!==l.fn||s.nums.length!==l.nums.length?r<1?`${s.fn}(${s.nums.map((c,h)=>`${c}${s.units[h]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,h)=>`${c}${l.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,h)=>`${c+(l.nums[h]-c)*r}${s.units[h]}`).join(", ")})`}).join(" ")}function mt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),u=String(n);if($t(t))return De(t,u,r);if(t.includes("("))return Ct(t,u,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),f=u.match(/^([-+]?[\d.]+)(.*)$/);if(s&&f){let l=parseFloat(s[1]),c=parseFloat(f[1]);return `${l+(c-l)*r}${s[2]||f[2]}`}return r<1?t:u}function Pt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ft={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},It=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ot=0;function kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ge(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:u={},easing:s="ease-out",speed:f=1,once:l=false,axis:c="y",scrollContainer:h,native:$=true,onProgress:B,onComplete:S,onEnter:Q,onLeave:he,onEnterBack:R,onLeaveBack:ee}=n,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof s=="function"?s:ie[s]??ie["ease-out"],x=ae(u.start??"top bottom"),A=ae(u.end??"bottom top"),w=typeof h=="string"?document.querySelector(h):h??null,b=Object.entries(t).map(([i,p])=>({prop:Pt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function P(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function I(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return I(),S?.(),r;P();function G(){if(!$||!kt()||typeof s!="string"||!(s in ft)||c!=="y"||w||l||f!==1||B||S||Q||he||R||ee||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!It.has(i.prop))return false;return true}function C(){let i=`ssd-a-${++Ot}`,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:${ft[s]};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,oe=()=>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 O of b)e.style.setProperty(O.prop,mt(O.from,O.to,_));},getProgress(){let J=e.getBoundingClientRect(),_=Z(),O=oe(),{tStart:me,tEnd:ge}=pe({top:J.top,height:J.height},_,O,x,A);return q(K(_,me,ge,f))}}}if(G())return C();let F=0,M=0,z=0,re=false,N=false,W=-1,d=0,L=false,g=NaN,y=()=>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},y(),X(),x,A);F=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,mt(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?he?.():g>=1&&i<1&&R?.(),g=i;}function de(){if(!re||N)return;let i=M===F?0:(y()-F)/(M-F);we(i);let p=q(K(y(),F,M,f));l&&(W=Math.max(W,p),p=W),d=p,be(p),p>=1&&!L?(L=true,S?.()):p<1&&!l&&(L=false),z=requestAnimationFrame(de);}Se();{let i=q(K(y(),F,M,f));l&&i>0&&(W=i),d=i,be(i);}let Fe=new IntersectionObserver(i=>{i.forEach(p=>{re=p.isIntersecting,re&&!N?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),Ie;function U(){clearTimeout(Ie),Ie=setTimeout(Se,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),Fe.observe(e),Le(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:F,tEnd:M})}),{destroy(){cancelAnimationFrame(z),Fe.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(Ie),$e(e);},replay(){W=-1,L=false,d=0,N=false,be(0);},pause(){N=true,cancelAnimationFrame(z);},resume(){N&&(N=false,re&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,W=p,N=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var Qe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Xe(e,n){if(typeof window>"u")return Qe;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),Qe;let t=r,{from:u=0,to:s,format:f,easing:l="ease-out",trigger:c={},once:h=true,decimals:$,onComplete:B}=n,S=$!==void 0?d=>d.toFixed($):f??(d=>String(Math.round(d))),Q=typeof l=="function"?l:ie[l]??ie["ease-out"],he=ae(c.start??"top 80%"),R=ae(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(s),B?.(),Qe;t.textContent=S(u);let te=0,q=0,x=0,A=false,w=false,b=-1,P=0,I=false,G=()=>window.scrollY,C=()=>window.innerHeight;function F(){let d=t.getBoundingClientRect(),L=pe({top:d.top,height:d.height},G(),C(),he,R);te=L.tStart,q=L.tEnd;}function M(d){t.textContent=S(u+(s-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));h&&(b=Math.max(b,d),d=b),P=d,M(d),d>=1&&!I?(I=true,B?.()):d<1&&!h&&(I=false),x=requestAnimationFrame(z);}F();{let d=Q(K(G(),te,q,1));h&&d>0&&(b=d),P=d,M(d);}let re=new IntersectionObserver(d=>{d.forEach(L=>{A=L.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),N;function W(){clearTimeout(N),N=setTimeout(F,150);}return window.addEventListener("resize",W),window.addEventListener("orientationchange",W),re.observe(t),Le(t,{type:"counter",getProgress:()=>P,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),re.disconnect(),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),clearTimeout(N),$e(t);},replay(){b=-1,I=false,P=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let L=Math.min(1,Math.max(0,d));P=L,b=L,w=true,cancelAnimationFrame(x),M(L);},getProgress(){return P}}}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ye(e,n={}){if(typeof window>"u")return pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),pt;let t=r,{trigger:u={},easing:s="linear",once:f=false,axis:l="y",preload:c="auto",onReady:h,onComplete:$,onProgress:B}=n,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof s=="function"?s:ie[s]??ie.linear,he=ae(u.start??"top top"),R=ae(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=n.from??0,te=n.to,q=0,x=0,A=0,w=false,b=false,P=-1,I=0,G=false,C=false,F=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function z(){let y=t.getBoundingClientRect(),X=l==="x"?y.left:y.top,Se=l==="x"?y.width:y.height,be=pe({top:X,height:Se},F(),M(),he,R);q=be.tStart,x=be.tEnd;}function re(y){if(!C)return;let X=te??t.duration??0;t.currentTime=ee+(X-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),B?.(y);}function N(){if(!w||b||!C)return;let y=Q(K(F(),q,x,1));f&&(P=Math.max(P,y),y=P),I=y,re(y),y>=1&&!G?(G=true,$?.()):y<1&&!f&&(G=false),A=requestAnimationFrame(N);}function W(){if(C=true,te===void 0&&(te=t.duration),S){re(1),h?.();return}z(),h?.(),w&&!b&&(A=requestAnimationFrame(N));}t.readyState>=1?W():t.addEventListener("loadedmetadata",W,{once:true}),C||z();let d=new IntersectionObserver(y=>{y.forEach(X=>{w=X.isIntersecting,w&&!b&&C?A=requestAnimationFrame(N):cancelAnimationFrame(A);});}),L;function g(){clearTimeout(L),L=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Le(t,{type:"video",getProgress:()=>I,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",W),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(L),$e(t);},replay(){P=-1,G=false,I=0,b=false,re(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&C&&(A=requestAnimationFrame(N)));},seek(y){let X=Math.min(1,Math.max(0,y));I=X,P=X,b=true,cancelAnimationFrame(A),re(X);},getProgress(){return I}}}function yt(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 Dt(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 dt(e){let n=yt(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=[],u=Array.from(r.keys()).sort((s,f)=>s-f);for(let s of u){let f=r.get(s),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 s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Ft(e,n,r,t){if(r<=1||t===0)return e;let u=(r-1)*t,s=n*t,f=s+(1-u);return f<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(f-s)))}function Nt(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 gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function je(e,n={}){if(typeof window>"u")return gt;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),gt;let t=r,{split:u="words",stagger:s=.04,easing:f="ease-out",from:l={opacity:0,y:24},trigger:c={},once:h=true,onComplete:$}=n,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof f=="function"?f:ie[f]??ie["ease-out"],Q=ae(c.start??"top 85%"),he=ae(c.end??"top 40%"),R=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=Dt(t):u==="lines"?ee=dt(t):ee=yt(t);let te=ee.length;function q(g,y){l?.opacity!==void 0&&(g.style.opacity=String(l.opacity+(1-l.opacity)*y));let X=Nt(y,l);X&&(g.style.transform=X);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((y,X)=>{let Se=S(Ft(g,X,te,s));q(y,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,P=false,I=false,G=-1,C=0,F=false,M=()=>window.scrollY,z=()=>window.innerHeight;function re(){let g=t.getBoundingClientRect(),y=pe({top:g.top,height:g.height},M(),z(),Q,he);A=y.tStart,w=y.tEnd;}function N(){if(!P||I)return;let g=K(M(),A,w,1);h&&(G=Math.max(G,g),g=G),C=g,x(g),g>=1&&!F?(F=true,$?.()):g<1&&!h&&(F=false),b=requestAnimationFrame(N);}re();let W=new IntersectionObserver(g=>{g.forEach(y=>{P=y.isIntersecting,P&&!I?b=requestAnimationFrame(N):cancelAnimationFrame(b);});}),d;function L(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let g=C;t.innerHTML=R,t.setAttribute("aria-label",t.textContent??""),ee=dt(t),x(g);}re();},150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),W.observe(t),Le(t,{type:"text",getProgress:()=>C,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),W.disconnect(),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),clearTimeout(d),t.innerHTML=R,t.removeAttribute("aria-label"),$e(t);},replay(){G=-1,F=false,C=0,I=false,x(0);},pause(){I=true,cancelAnimationFrame(b);},resume(){I&&(I=false,P&&(b=requestAnimationFrame(N)));},seek(g){let y=Math.min(1,Math.max(0,g));C=y,G=y,I=true,cancelAnimationFrame(b),x(y);},getProgress(){return C}}}function ir(e,n={}){let r=Be(e,n);return {update(t){r.destroy(),r=Be(e,t);},destroy(){r.destroy();}}}function ar(e={}){let n=null;function r(t){return n=Be(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function lr(e,n){let r=Ge(e,n);return {update(t){r.destroy(),r=Ge(e,t);},destroy(){r.destroy();}}}function cr(e){let n=null;function r(t){return n=Ge(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function ur(e,n){let r=Xe(e,n);return {update(t){r.destroy(),r=Xe(e,t);},destroy(){r.destroy();}}}function mr(e){let n=null;function r(t){return n=Xe(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function fr(e,n={}){let r=Ye(e,n);return {update(t){r.destroy(),r=Ye(e,t);},destroy(){r.destroy();}}}function pr(e={}){let n=null;function r(t){return n=Ye(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function dr(e,n={}){let r=je(e,n);return {update(t){r.destroy(),r=je(e,t);},destroy(){r.destroy();}}}function gr(e={}){let n=null;function r(t){return n=je(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}exports.createScrollAnimate=cr;exports.createScrollCounter=mr;exports.createScrollDraw=ar;exports.createScrollText=gr;exports.createScrollVideo=pr;exports.scrollAnimate=lr;exports.scrollCounterAction=ur;exports.scrollDraw=ir;exports.scrollTextAction=dr;exports.scrollVideoAction=fr;
1
+ 'use strict';function Rt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<r;d++){let x=Math.pow(l,d);c.push(x),s+=x;}let u=[0],m=0;for(let d=0;d<r;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<r;x++)if(d<=u[x+1]){let N=(d-u[x])/(u[x+1]-u[x]);if(x===0)return N*(2-N);let L=1-Math.pow(t,x);return L+(1-L)*(2*N-1)*(2*N-1)}return 1}}function Ht({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=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-l)*(2*Math.PI)/t)+1}var ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Rt(),elastic:Ht()};function pe(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 ht(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 bt(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 ze(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 Nt(e,n,r){return Math.min(r,Math.max(n,e))}function Q(e,n,r,t){return r===n?0:Nt((e-n)/(r-n)*t,0,1)}function Qe(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function xe(e,n,r,t,l){let s=ht(e.top,e.height,n,t.element)-bt(t.viewport,r),c=ht(e.top,e.height,n,l.element)-bt(l.viewport,r);return {tStart:s,tEnd:c}}function wt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function _e(e,n,r){let t=wt(e),l=wt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var vt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...n){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Vt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",zt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function _t(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function qt(e){let n=[];for(let r=0;r<St;r++){let t=r/(St-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return Vt;case "ease-out":return zt;case "ease-in-out":return _t()?qt(ee["ease-in-out"]):null;default:return null}}var Wt=0;function Bt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Gt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?ye("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function jt(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 l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
2
+ <div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
+ <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Et=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Tt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ut(e,n,r){if(!Ze)return;let t=(e.match(Tt)??[]).join("").toUpperCase(),l=(n.match(Tt)??[]).join("").toUpperCase(),s=(e.match(Et)??[]).length,c=(n.match(Et)??[]).length;if(t!==l){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&ye(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function lt(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function Ke(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...vt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Me=false,axis:W="y",scrollContainer:Z,autoReverse:X=false,delay:B=0,strokeColor:A,strokeWidth:$,fillOpacity:M,waypoints:w,velocityScale:I=false,threshold:O=0,rootMargin:C="0px",repeat:E=0,repeatDelay:re=0,morphTo:k,clip:ne,autoplay:oe=false,duration:J=1e3,native:ue=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:F,onEnterBack:de,onLeaveBack:ve}=l,me=ne===true?"left":typeof ne=="string"?ne:false,Se=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),Ne=pe(x.end??"bottom top"),he=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(A)?A[0]:null,se=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null,fe=Array.isArray(M)?M[0]:null,Y=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function $e(o){let a=o*100;switch(me){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 V=me?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,we=0,R=false,z=false,_=0,j=false,ae=-1,Ce=-1,K=false,Ee=0,Ie=0,ke,ot=null;function ut(){ot?.destroy(),ot=null;}let De=new Set,mt=NaN,Fe=true,Be=-1,ft=performance.now(),Ve=NaN;function st(){return he?W==="x"?he.scrollLeft:he.scrollTop:W==="x"?window.scrollX:window.scrollY}function pt(){return he?W==="x"?he.clientWidth:he.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function dt(){let o=Qe(e,he,W),a=xe(o,o.scroll,pt(),Le,Ne);f=a.tStart,we=a.tEnd,Me&&Ze&&(ut(),ot=jt(f,we,W));}function Ot(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),me){let v=a==="reverse"?1-o:o;e.style.clipPath=$e(v);return}V.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${P[le]*o}`:`${P[le]*(1-o)}`,m&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&se?v.style.stroke=_e(be,se,o):se&&(v.style.stroke=se),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*o}`:Y!==null&&(v.style.fillOpacity=`${Y}`),k&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",lt(i[le],k,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=$e(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${P[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`),k&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{Gt(o);let a=ze(o);P.push(a);let v=o.tagName.toLowerCase()==="path";v?i.push(o.getAttribute("d")??""):i.push(""),k&&(v?Ut(i[i.length-1],k,o):ye(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),Y!==null&&(o.style.fillOpacity=`${Y}`),k&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",k)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`));}),me){if(s)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof d=="string"?Je(d):null;function kt(){return !(ue===false||!Bt()||!V.length||!gt||me||W!=="y"||he||u!==1||N!==0||te||X||I!==false||k||w||E||B>0||y||T||g||p||F||de||ve||A!=null||$!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Dt(){let o=++Wt,a=`svg-scroll-draw-${o}`,v=`svg-scroll-draw-host-${o}`,le=`--svg-scroll-draw-${o}`,Oe=L==="reverse"?"0":"var(--ssd-len)",Pe=L==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Oe};`,S=`stroke-dashoffset:${Pe};`;m&&(Ae+=`opacity:${L==="reverse"?1:0};`,S+=`opacity:${L==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Ae}}to{${S}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(v);function ce(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(ce);let b=false,H=-1;function q(){if(H>=0)return H;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},st(),pt(),Le,Ne);return Se(Q(st(),U,Te,u))}return {destroy(){e.classList.remove(v),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){b=false,H=-1,V.forEach(ce);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));H=U,b=true,V.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${P[ge]*U}`:`${P[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=ze(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(kt())return Dt();function Ft(){let o=Math.max(1,J),a=0,v=0,le=false;function Oe(b){let H=true;if(me){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);Ee=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=$e(L==="reverse"?1-h:h),y?.(h),q<1&&(H=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),ge=Se(Te);q.style.strokeDashoffset=L==="reverse"?`${P[h]*ge}`:`${P[h]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&se?q.style.stroke=_e(be,se,ge):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),k&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",lt(i[h],k,ge)),h===0&&(Ee=ge,y?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(H=false);});if(w){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);for(let U in w){let Te=parseFloat(U);h>=Te&&!De.has(Te)&&(De.add(Te),w[U]?.());}}return H}function Pe(b){if(K)return;let H=b-a;z||(z=true,T?.());let q=Oe(H);if(q&&!R){R=true,Oe(o*(1+Math.max(0,V.length-1)*N)),g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,ke=setTimeout(()=>{a=performance.now(),z=false,R=false,De.clear(),Ge(),_=requestAnimationFrame(Pe);},re));return}q||(_=requestAnimationFrame(Pe));}function Ae(){cancelAnimationFrame(_),clearTimeout(ke),a=performance.now(),v=0,K=false,z=false,R=false,Ie=0,le=true,Ee=0,De.clear(),Ge(),_=requestAnimationFrame(Pe);}let S=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&R)?Ae():!H.isIntersecting&&!te&&!R&&(cancelAnimationFrame(_),clearTimeout(ke),le=false);});},{root:he??null,threshold:O,rootMargin:C}),D;function ce(){clearTimeout(D),D=setTimeout(()=>{V.forEach((b,H)=>{P[H]=ze(b),b.style.strokeDasharray=`${P[H]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),B>0?setTimeout(()=>S.observe(e),B):S.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(ke),S.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(D);},replay(){Ie=0,Ae();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(_));},resume(){K&&(K=false,le=true,a=performance.now()-v,_=requestAnimationFrame(Pe));},seek(b){let H=Math.min(1,Math.max(0,b));Ee=H,K=true,v=H*o,a=performance.now()-v,cancelAnimationFrame(_),Oe(v);},getProgress(){return Ee},refresh(){clearTimeout(D),V.forEach((b,H)=>{P[H]=ze(b),b.style.strokeDasharray=`${P[H]}`;});}}}if(oe)return Ft();dt();function je(){if(!j||K)return;let o=performance.now(),a=st();if(!Fe&&I===false&&a===mt){_=requestAnimationFrame(je);return}Fe=false,mt=a;let v=u;if(I!==false){let S=o-ft,D=S>0?Math.abs(a-(Be<0?a:Be))/S:0;v=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}Be=a,ft=o;let le=X?Ce===-1||a>=Ce?"forward":"reverse":L;Ce=a;let Oe=we-f,Pe=true,Ae=Oe===0?0:(a-f)/Oe;if(isNaN(Ve)||(Ve<=0&&Ae>0?p?.():Ve>0&&Ae<=0&&ve?.(),Ve<1&&Ae>=1?F?.():Ve>=1&&Ae<1&&de?.()),Ve=Ae,me){let S=Se(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,S),S=ae),Ee=S,e.style.setProperty("--scroll-draw-progress",String(S));let D=le==="reverse"?1-S:S;e.style.clipPath=$e(D),y?.(S),!z&&Q(a,f,we,v)>0&&(z=true,T?.()),S>=1&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,ke=setTimeout(()=>{ae=-1,z=false,R=false,e.style.clipPath=$e(0);},re))):S<1&&!te&&(R=false),_=requestAnimationFrame(je);return}if(V.forEach((S,D)=>{let ce=D*N*Oe,b=Se(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Ee=b,S.style.strokeDashoffset=le==="reverse"?`${P[D]*b}`:`${P[D]*(1-b)}`,m&&(S.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&se?S.style.stroke=_e(be,se,b):se&&(S.style.stroke=se),ie!==null&&G!==null?S.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(S.style.strokeWidth=`${G}`),fe!==null&&Y!==null?S.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(S.style.fillOpacity=`${Y}`),k&&S.tagName.toLowerCase()==="path"&&i[D]&&S.setAttribute("d",lt(i[D],k,b)),D===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),w){let S=Se(Q(a,f,we,v));for(let D in w){let ce=parseFloat(D);S>=ce&&!De.has(ce)&&(De.add(ce),w[D]?.());}}!z&&Q(a,f,we,v)>0&&(z=true,T?.()),Pe&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,ke=setTimeout(()=>{ae=-1,z=false,R=false,De.clear(),Ge(),Fe=true;},re))):!Pe&&!te&&(R=false),_=requestAnimationFrame(je);}let it=false;function Ue(){it||(it=true,_=requestAnimationFrame(function(){je();}));}function Xe(){it=false,cancelAnimationFrame(_);}let at=new IntersectionObserver(o=>{o.forEach(a=>{j=a.isIntersecting,j&&!K?(Fe=true,Ue()):Xe();});},{root:he??null,threshold:O,rootMargin:C});function yt(){V.forEach((o,a)=>{P[a]=ze(o),o.style.strokeDasharray=`${P[a]}`;}),dt(),Fe=true;}let Ye;function qe(){clearTimeout(Ye),Ye=setTimeout(yt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),B>0?setTimeout(()=>at.observe(e),B):at.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(ke),Xe(),at.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Ye),ut();},replay(){ae=-1,Ce=-1,Be=-1,z=false,R=false,Ie=0,K=false,Ee=0,De.clear(),clearTimeout(ke),Ge(),Fe=true,j&&Ue();},pause(){K=true,Xe();},resume(){K&&(K=false,Fe=true,j&&Ue());},seek(o){let a=Math.min(1,Math.max(0,o));Ee=a,ae=a,K=true,Xe(),Ot(a,L),Fe=true;},getProgress(){return Ee},refresh(){clearTimeout(Ye),yt(),j&&!K&&Ue();}}}var xt=new Map;function Re(e,n){xt.set(e,n);}function He(e){xt.delete(e);}function Xt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function At(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function Yt(e,n,r){let t=At(e),l=At(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Mt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Xt(t))return _e(t,l,r);if(t.includes("("))return Yt(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function Qt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Zt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Jt=0,Lt="--scroll-draw-progress";function Kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Me,onComplete:W,onEnter:Z,onLeave:X,onEnterBack:B,onLeaveBack:A}=n,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:ee[s]??ee["ease-out"],w=pe(l.start??"top bottom"),I=pe(l.end??"bottom top"),O=te??e,C=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([i,f])=>({prop:Qt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function re(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function k(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let ne=new Map;for(let i of [...E.map(f=>f.prop),Lt])ne.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of ne)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return k(),W?.(),{...r,destroy:oe,getProgress:()=>1};re();let J=typeof s=="string"?Je(s):null;function ue(){if(!x||!Kt()||!J||m!=="y"||C||O!==e||u||c!==1||Me||W||Z||X||B||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!Zt.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++Jt}`,f=E.map(j=>`${j.prop}:${j.from}`).join(";"),we=E.map(j=>`${j.prop}:${j.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",oe();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let Ce of E)e.style.setProperty(Ce.prop,Mt(Ce.from,Ce.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=z(),Ce=_(),{tStart:K,tEnd:Ee}=xe({top:j.top,height:j.height},ae,Ce,w,I);return M(Q(ae,K,Ee,c))}}}if(ue())return y();let T=0,g=0,p=0,F=false,de=false,ve=-1,me=0,Se=false,Le=NaN,Ne=-1,he=0,be=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=Qe(O,C,m),f=xe(i,i.scroll,se(),w,I);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Lt,String(i));for(let f of E)e.style.setProperty(f.prop,Mt(f.from,f.to,i));Me?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&A?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&B?.(),Le=i;}function Y(){if(!F||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let _=i-he,j=_>0?Math.abs(f-(Ne<0?f:Ne))/_:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}Ne=f,he=i;let R=g===T?0:(f-T)/(g-T);fe(R);let z=M(Q(f,T,g,we));u&&(ve=Math.max(ve,z),z=ve),me=z,G(z),z>=1&&!Se?(Se=true,W?.()):z<1&&!u&&(Se=false),p=requestAnimationFrame(Y);}ie(),g===T&&ye("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=M(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let $e=new IntersectionObserver(i=>{i.forEach(f=>{F=f.isIntersecting,F&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:C??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),$e.observe(e),Re(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),$e.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),He(e);},replay(){ve=-1,Se=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,F&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tt(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollCounter: element not found:",e),ct;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=n,L=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Me=pe(m.start??"top 80%"),W=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),N?.(),ct;let X=0,B=0,A=0,$=false,M=false,w=-1,I=0,O=false,C=()=>window.scrollY,E=()=>window.innerHeight;function re(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},C(),E(),Me,W);X=T.tStart,B=T.tEnd;}function k(y){t.textContent=L(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function ne(){if(!$||M)return;let y=te(Q(C(),X,B,1));d&&(w=Math.max(w,y),y=w),I=y,k(y),y>=1&&!O?(O=true,N?.()):y<1&&!d&&(O=false),A=requestAnimationFrame(ne);}re();{let y=te(Q(C(),X,B,1));d&&y>0&&(w=y),I=y,k(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{$=T.isIntersecting,$&&!M?A=requestAnimationFrame(ne):cancelAnimationFrame(A);});}),J;function ue(){clearTimeout(J),J=setTimeout(re,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),oe.observe(t),Re(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:B})}),{destroy(){cancelAnimationFrame(A),oe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),He(t);},replay(){w=-1,O=false,I=0,M=false,k(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,$&&(A=requestAnimationFrame(ne)));},seek(y){let T=Math.min(1,Math.max(0,y));I=T,w=T,M=true,cancelAnimationFrame(A),k(T);},getProgress(){return I}}}var $t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,n={}){if(typeof window>"u")return $t;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),$t;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=n,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,Me=pe(l.start??"top top"),W=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=n.from??0,X=n.to,B=0,A=0,$=0,M=false,w=false,I=-1,O=0,C=false,E=false,re=()=>u==="x"?window.scrollX:window.scrollY,k=()=>u==="x"?window.innerWidth:window.innerHeight;function ne(){let p=t.getBoundingClientRect(),F=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:F,height:de},re(),k(),Me,W);B=ve.tStart,A=ve.tEnd;}function oe(p){if(!E)return;let F=X??t.duration??0;t.currentTime=Z+(F-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!M||w||!E)return;let p=te(Q(re(),B,A,1));c&&(I=Math.max(I,p),p=I),O=p,oe(p),p>=1&&!C?(C=true,x?.()):p<1&&!c&&(C=false),$=requestAnimationFrame(J);}function ue(){if(E=true,X===void 0&&(X=t.duration),L){oe(1),d?.();return}ne(),d?.(),M&&!w&&($=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),E||ne();let y=new IntersectionObserver(p=>{p.forEach(F=>{M=F.isIntersecting,M&&!w&&E?$=requestAnimationFrame(J):cancelAnimationFrame($);});}),T;function g(){clearTimeout(T),T=setTimeout(ne,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Re(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:B,tEnd:A})}),{destroy(){cancelAnimationFrame($),y.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),He(t);},replay(){I=-1,C=false,O=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,M&&E&&($=requestAnimationFrame(J)));},seek(p){let F=Math.min(1,Math.max(0,p));O=F,I=F,w=true,cancelAnimationFrame($),oe(F);},getProgress(){return O}}}function It(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function er(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 Ct(e){let n=It(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function tr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function rr(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 Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,n={}){if(typeof window>"u")return Pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollText: element not found:",e),Pt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=n,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Me=pe(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=er(t):l==="lines"?Z=Ct(t):Z=It(t);let X=Z.length;function B(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let F=rr(p,u);F&&(g.style.transform=F);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,F)=>{let de=L(tr(g,F,X,s));B(p,de);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,M=0,w=0,I=false,O=false,C=-1,E=0,re=false,k=()=>window.scrollY,ne=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},k(),ne(),te,Me);$=p.tStart,M=p.tEnd;}function J(){if(!I||O)return;let g=Q(k(),$,M,1);d&&(C=Math.max(C,g),g=C),E=g,A(g),g>=1&&!re?(re=true,x?.()):g<1&&!d&&(re=false),w=requestAnimationFrame(J);}oe();let ue=new IntersectionObserver(g=>{g.forEach(p=>{I=p.isIntersecting,I&&!O?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),Z=Ct(t),A(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Re(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:$,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=W,t.removeAttribute("aria-label"),He(t);},replay(){C=-1,re=false,E=0,O=false,A(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,I&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));E=p,C=p,O=true,cancelAnimationFrame(w),A(p);},getProgress(){return E}}}function Rr(e,n={}){let r=Ke(e,n);return {update(t){r.destroy(),r=Ke(e,t);},destroy(){r.destroy();}}}function Hr(e={}){let n=null;function r(t){return n=Ke(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function Nr(e,n){let r=et(e,n);return {update(t){r.destroy(),r=et(e,t);},destroy(){r.destroy();}}}function Vr(e){let n=null;function r(t){return n=et(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function zr(e,n){let r=tt(e,n);return {update(t){r.destroy(),r=tt(e,t);},destroy(){r.destroy();}}}function _r(e){let n=null;function r(t){return n=tt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function qr(e,n={}){let r=rt(e,n);return {update(t){r.destroy(),r=rt(e,t);},destroy(){r.destroy();}}}function Wr(e={}){let n=null;function r(t){return n=rt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function Br(e,n={}){let r=nt(e,n);return {update(t){r.destroy(),r=nt(e,t);},destroy(){r.destroy();}}}function Gr(e={}){let n=null;function r(t){return n=nt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}exports.createScrollAnimate=Vr;exports.createScrollCounter=_r;exports.createScrollDraw=Hr;exports.createScrollText=Gr;exports.createScrollVideo=Wr;exports.scrollAnimate=Nr;exports.scrollCounterAction=zr;exports.scrollDraw=Rr;exports.scrollTextAction=Br;exports.scrollVideoAction=qr;
@@ -125,6 +125,21 @@ interface ScrollDrawInstance {
125
125
  seek: (progress: number) => void;
126
126
  /** Returns current draw progress (0–1). */
127
127
  getProgress: () => number;
128
+ /**
129
+ * Re-measure after a layout change: path lengths, and the scroll trigger window.
130
+ *
131
+ * The engine already re-measures on `resize`, on `orientationchange`, and via a
132
+ * `ResizeObserver` on the document element — but none of those fire for a layout
133
+ * change that leaves the document height alone, such as a tab switching, a
134
+ * sibling collapsing, or a font swapping inside a fixed-height box. Call this
135
+ * after one of those.
136
+ *
137
+ * Optional on this shared type because several instances here are fan-outs over
138
+ * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
139
+ * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
140
+ * use `instance.refresh?.()` if you hold an instance of unknown origin.
141
+ */
142
+ refresh?: () => void;
128
143
  }
129
144
 
130
145
  interface ScrollAnimateOptions {
@@ -136,6 +151,39 @@ interface ScrollAnimateOptions {
136
151
  axis?: 'x' | 'y';
137
152
  scrollContainer?: string | Element;
138
153
  native?: boolean;
154
+ /**
155
+ * Scale animation speed by scroll velocity — faster scrolling = faster animation.
156
+ * Pass `true` for default sensitivity (1) or a number to control it.
157
+ * Higher values = more dramatic speed-up. Default sensitivity: 1.
158
+ */
159
+ velocityScale?: boolean | number;
160
+ /**
161
+ * Honour `prefers-reduced-motion: reduce` by applying the final state and not
162
+ * animating. Default: `true`.
163
+ *
164
+ * Set to `false` only when the movement is *scroll-linked scrubbing* rather
165
+ * than autonomous motion — it advances solely as the user scrolls, 1:1 with
166
+ * their input, so it is direct manipulation rather than something that plays at
167
+ * them. `scrollHorizontal` sets this, because jumping to the final state there
168
+ * would leave every panel but the last unreachable inside the sticky
169
+ * `overflow: hidden` container.
170
+ */
171
+ respectReducedMotion?: boolean;
172
+ /**
173
+ * Element whose geometry defines the trigger window, when that is not the
174
+ * element being animated. Defaults to the animated element.
175
+ *
176
+ * Needed whenever the animated element cannot supply the scroll length itself —
177
+ * the case that matters is a `position: sticky` stage, where the pinned element
178
+ * is exactly one viewport tall and all of the scroll room belongs to its
179
+ * container. Resolving `top top` → `bottom bottom` against the pinned element
180
+ * there yields tStart === tEnd, a zero-length window, and no movement at all.
181
+ *
182
+ * Setting this disables the native CSS fast path: `animation-timeline: view()`
183
+ * always measures the element the animation is attached to, so it cannot express
184
+ * a separate subject.
185
+ */
186
+ triggerElement?: Element;
139
187
  onProgress?: (alpha: number) => void;
140
188
  onComplete?: () => void;
141
189
  /** Fires when scroll enters the trigger zone (scrolling forward). */
@@ -125,6 +125,21 @@ interface ScrollDrawInstance {
125
125
  seek: (progress: number) => void;
126
126
  /** Returns current draw progress (0–1). */
127
127
  getProgress: () => number;
128
+ /**
129
+ * Re-measure after a layout change: path lengths, and the scroll trigger window.
130
+ *
131
+ * The engine already re-measures on `resize`, on `orientationchange`, and via a
132
+ * `ResizeObserver` on the document element — but none of those fire for a layout
133
+ * change that leaves the document height alone, such as a tab switching, a
134
+ * sibling collapsing, or a font swapping inside a fixed-height box. Call this
135
+ * after one of those.
136
+ *
137
+ * Optional on this shared type because several instances here are fan-outs over
138
+ * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
139
+ * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
140
+ * use `instance.refresh?.()` if you hold an instance of unknown origin.
141
+ */
142
+ refresh?: () => void;
128
143
  }
129
144
 
130
145
  interface ScrollAnimateOptions {
@@ -136,6 +151,39 @@ interface ScrollAnimateOptions {
136
151
  axis?: 'x' | 'y';
137
152
  scrollContainer?: string | Element;
138
153
  native?: boolean;
154
+ /**
155
+ * Scale animation speed by scroll velocity — faster scrolling = faster animation.
156
+ * Pass `true` for default sensitivity (1) or a number to control it.
157
+ * Higher values = more dramatic speed-up. Default sensitivity: 1.
158
+ */
159
+ velocityScale?: boolean | number;
160
+ /**
161
+ * Honour `prefers-reduced-motion: reduce` by applying the final state and not
162
+ * animating. Default: `true`.
163
+ *
164
+ * Set to `false` only when the movement is *scroll-linked scrubbing* rather
165
+ * than autonomous motion — it advances solely as the user scrolls, 1:1 with
166
+ * their input, so it is direct manipulation rather than something that plays at
167
+ * them. `scrollHorizontal` sets this, because jumping to the final state there
168
+ * would leave every panel but the last unreachable inside the sticky
169
+ * `overflow: hidden` container.
170
+ */
171
+ respectReducedMotion?: boolean;
172
+ /**
173
+ * Element whose geometry defines the trigger window, when that is not the
174
+ * element being animated. Defaults to the animated element.
175
+ *
176
+ * Needed whenever the animated element cannot supply the scroll length itself —
177
+ * the case that matters is a `position: sticky` stage, where the pinned element
178
+ * is exactly one viewport tall and all of the scroll room belongs to its
179
+ * container. Resolving `top top` → `bottom bottom` against the pinned element
180
+ * there yields tStart === tEnd, a zero-length window, and no movement at all.
181
+ *
182
+ * Setting this disables the native CSS fast path: `animation-timeline: view()`
183
+ * always measures the element the animation is attached to, so it cannot express
184
+ * a separate subject.
185
+ */
186
+ triggerElement?: Element;
139
187
  onProgress?: (alpha: number) => void;
140
188
  onComplete?: () => void;
141
189
  /** Fires when scroll enters the trigger zone (scrolling forward). */
@@ -1,3 +1,3 @@
1
- function Et({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),u=Math.sqrt(t),s=0,f=[];for(let h=0;h<r;h++){let $=Math.pow(u,h);f.push($),s+=$;}let l=[0],c=0;for(let h=0;h<r;h++)c+=f[h]/s,l.push(c);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let $=0;$<r;$++)if(h<=l[$+1]){let B=(h-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 St({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),u=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-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:Et(),elastic:St()};function ae(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 nt(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 ot(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 _e(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 xt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:xt((e-n)/(r-n)*t,0,1)}function pe(e,n,r,t,u){let s=nt(e.top,e.height,n,t.element)-ot(t.viewport,r),f=nt(e.top,e.height,n,u.element)-ot(u.viewport,r);return {tStart:s,tEnd:f}}function st(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 De(e,n,r){let t=st(e),u=st(n);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*r)},${Math.round(t[1]+(u[1]-t[1])*r)},${Math.round(t[2]+(u[2]-t[2])*r)})`}var it={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 at(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var lt={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 n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?at("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&at("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Lt(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 u(){let s=r==="x"?window.scrollX:window.scrollY,f=e-s,l=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:${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 Ke(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let f=parseFloat(s),l=t[u++]??f;return String(+(f+(l-f)*r).toFixed(4))})}function Be(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,u=r?{...it[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:h="linear",trigger:$={},stagger:B=0,direction:S="forward",once:Q=false,debug:he=false,axis:R="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:P=false,threshold:I=0,rootMargin:G="0px",repeat:C=0,repeatDelay:F=0,morphTo:M,clip:z,autoplay:re=false,duration:N=1e3,native:W=true,onProgress:d,onStart:L,onComplete:g,onEnter:y,onLeave:X,onEnterBack:Se,onLeaveBack:be}=u,we=z===true?"left":typeof z=="string"?z:false,de=typeof h=="function"?h:ie[h]??ie.linear,Fe=ae($.start??"top bottom"),Ie=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,oe=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(o){let a=o*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(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=we?[]:Array.from(e.querySelectorAll(f)),O=[],me=[],ge=0,Te=0,se=false,ye=false,ne=0,He=false,ve=-1,Re=-1,le=false,Ce=0,xe=0,Ae,Ue=null,Me=new Set,ze=-1,et=performance.now(),Oe=NaN;function Ne(){return U?R==="x"?U.scrollLeft:U.scrollTop:R==="x"?window.scrollX:window.scrollY}function tt(){return U?R==="x"?U.clientWidth:U.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function rt(){let o=e.getBoundingClientRect(),a,E,j;if(U){let ue=U.getBoundingClientRect();a=R==="x"?o.left-ue.left+U.scrollLeft:o.top-ue.top+U.scrollTop,E=R==="x"?o.width:o.height,j=Ne();}else a=R==="x"?o.left:o.top,E=R==="x"?o.width:o.height,j=Ne();let ce=pe({top:a,height:E},j,tt(),Fe,Ie);ge=ce.tStart,Te=ce.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=Lt(ge,Te,R));}function ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),we){let E=a==="reverse"?1-o:o;e.style.clipPath=J(E);return}_.forEach((E,j)=>{E.style.strokeDashoffset=a==="reverse"?`${O[j]*o}`:`${O[j]*(1-o)}`,c&&(E.style.opacity=a==="reverse"?`${1-o}`:`${o}`),i&&p?E.style.stroke=De(i,p,o):p&&(E.style.stroke=p),Y!==null&&H!==null?E.style.strokeWidth=`${Y+(H-Y)*o}`:H!==null&&(E.style.strokeWidth=`${H}`),Z!==null&&oe!==null?E.style.fillOpacity=`${Z+(oe-Z)*o}`:oe!==null&&(E.style.fillOpacity=`${oe}`),M&&E.tagName.toLowerCase()==="path"&&me[j]&&E.setAttribute("d",Ke(me[j],M,o));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}_.forEach((o,a)=>{o.style.strokeDasharray=`${O[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${O[a]}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),Y!==null&&(o.style.strokeWidth=`${Y}`),Z!==null&&(o.style.fillOpacity=`${Z}`),M&&o.tagName.toLowerCase()==="path"&&me[a]&&o.setAttribute("d",me[a]);});}if(_.forEach(o=>{Mt(o);let a=_e(o);O.push(a),o.tagName.toLowerCase()==="path"?me.push(o.getAttribute("d")??""):me.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),p&&(o.style.stroke=p),H!==null&&(o.style.strokeWidth=`${H}`),oe!==null&&(o.style.fillOpacity=`${oe}`),M&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",M)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),Y!==null&&(o.style.strokeWidth=`${Y}`),Z!==null&&(o.style.fillOpacity=`${Z}`));}),we){if(s)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(W===false||!At()||!_.length||typeof h!="string"||!(h in lt)||we||R!=="y"||U||l!==1||B!==0||Q||te||P!==false||M||b||C||q>0||d||L||g||y||X||Se||be||x!=null||A!=null||w!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function wt(){let o=`svg-scroll-draw-${++Tt}`,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 ${o}{from{${j}}to{${ce}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${lt[h]};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(O[T])),m.style.strokeDasharray=`${O[T]}`,m.style.strokeDashoffset="",m.style.opacity="",m.style.animationPlayState="",m.classList.add(o);}_.forEach(fe);let v=false,k=-1;function D(){if(k>=0)return k;let m=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:m.top,height:m.height},Ne(),tt(),Fe,Ie);return de(K(Ne(),T,V,l))}return {destroy(){_.forEach(m=>{m.classList.remove(o),m.style.removeProperty("--ssd-len"),m.style.animationPlayState="";}),ue.remove();},replay(){v=false,k=-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));k=T,v=true,_.forEach((V,Pe)=>{V.classList.remove(o),V.style.strokeDashoffset=S==="reverse"?`${O[Pe]*T}`:`${O[Pe]*(1-T)}`,c&&(V.style.opacity=S==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return D()}}}if(bt())return wt();function vt(){let o=Math.max(1,N),a=0,E=0;function j(D){let m=true;if(we){let T=Math.min(1,Math.max(0,D/o)),V=de(T);Ce=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 Pe=V*B*o,ke=Math.min(1,Math.max(0,(D-Pe)/o)),Ee=de(ke);T.style.strokeDashoffset=S==="reverse"?`${O[V]*Ee}`:`${O[V]*(1-Ee)}`,c&&(T.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),i&&p?T.style.stroke=De(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&&oe!==null?T.style.fillOpacity=`${Z+(oe-Z)*Ee}`:oe!==null&&(T.style.fillOpacity=`${oe}`),M&&T.tagName.toLowerCase()==="path"&&me[V]&&T.setAttribute("d",Ke(me[V],M,Ee)),V===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),ke<1&&(m=false);});if(b){let T=Math.min(1,Math.max(0,D/o)),V=de(T);for(let Pe in b){let ke=parseFloat(Pe);V>=ke&&!Me.has(ke)&&(Me.add(ke),b[Pe]?.());}}return m}function ce(D){if(le)return;let m=D-a;ye||(ye=true,L?.());let T=j(m);if(T&&!se){se=true,j(o*(1+Math.max(0,_.length-1)*B)),g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{a=performance.now(),ye=false,se=false,Me.clear(),Ve(),ne=requestAnimationFrame(ce);},F));return}T||(ne=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(ne),clearTimeout(Ae),a=performance.now(),E=0,le=false,ye=false,se=false,xe=0,Me.clear(),Ve(),ne=requestAnimationFrame(ce);}let fe=new IntersectionObserver(D=>{D.forEach(m=>{m.isIntersecting&&!(Q&&se)?ue():!m.isIntersecting&&!Q&&!se&&(cancelAnimationFrame(ne),clearTimeout(Ae),a=null);});},{root:U??null,threshold:I,rootMargin:G}),v;function k(){clearTimeout(v),v=setTimeout(()=>{_.forEach((D,m)=>{O[m]=_e(D),D.style.strokeDasharray=`${O[m]}`;});},150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),q>0?setTimeout(()=>fe.observe(e),q):fe.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),fe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),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(D){let m=Math.min(1,Math.max(0,D));Ce=m,le=true,E=m*o,a=performance.now()-E,cancelAnimationFrame(ne),j(E);},getProgress(){return Ce}}}if(re)return vt();rt();function qe(){if(!He||le)return;let o=performance.now(),a=Ne(),E=l;if(P!==false){let v=o-et,k=v>0?Math.abs(a-(ze<0?a:ze))/v:0;E=l*Math.max(.2,1+k*(typeof P=="number"?P:1)*.04);}ze=a,et=o;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(Oe)||(Oe<=0&&fe>0?y?.():Oe>0&&fe<=0&&be?.(),Oe<1&&fe>=1?X?.():Oe>=1&&fe<1&&Se?.()),Oe=fe,we){let v=de(K(a,ge,Te,E));Q&&!te&&(ve=Math.max(ve,v),v=ve),Ce=v,e.style.setProperty("--scroll-draw-progress",String(v));let k=j==="reverse"?1-v:v;e.style.clipPath=J(k),d?.(v),!ye&&K(a,ge,Te,E)>0&&(ye=true,L?.()),v>=1&&!se?(se=true,g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,ye=false,se=false,e.style.clipPath=J(0);},F))):v<1&&!Q&&(se=false),ne=requestAnimationFrame(qe);return}if(_.forEach((v,k)=>{let D=k*B*ce,m=de(K(a,ge+D,Te+D,E));Q&&!te&&(ve=Math.max(ve,m),m=ve),Ce=m,v.style.strokeDashoffset=j==="reverse"?`${O[k]*m}`:`${O[k]*(1-m)}`,c&&(v.style.opacity=j==="reverse"?`${1-m}`:`${m}`),i&&p?v.style.stroke=De(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&&oe!==null?v.style.fillOpacity=`${Z+(oe-Z)*m}`:oe!==null&&(v.style.fillOpacity=`${oe}`),M&&v.tagName.toLowerCase()==="path"&&me[k]&&v.setAttribute("d",Ke(me[k],M,m)),k===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 k in b){let D=parseFloat(k);v>=D&&!Me.has(D)&&(Me.add(D),b[k]?.());}}!ye&&K(a,ge,Te,E)>0&&(ye=true,L?.()),ue&&!se?(se=true,g?.(),xe<(C==="infinite"?1/0:C??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,ye=false,se=false,Me.clear(),Ve();},F))):!ue&&!Q&&(se=false),ne=requestAnimationFrame(qe);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{He=a.isIntersecting,He&&!le?ne=requestAnimationFrame(qe):cancelAnimationFrame(ne);});},{root:U??null,threshold:I,rootMargin:G}),Je;function We(){clearTimeout(Je),Je=setTimeout(()=>{_.forEach((o,a)=>{O[a]=_e(o),o.style.strokeDasharray=`${O[a]}`;}),rt();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),q>0?setTimeout(()=>Ze.observe(e),q):Ze.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),Ze.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,Re=-1,ze=-1,ye=false,se=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),Ve();},pause(){le=true,cancelAnimationFrame(ne);},resume(){le&&(le=false,He&&(ne=requestAnimationFrame(qe)));},seek(o){let a=Math.min(1,Math.max(0,o));Ce=a,ve=a,le=true,cancelAnimationFrame(ne),ht(a,S);},getProgress(){return Ce}}}var ct=new Map;function Le(e,n){ct.set(e,n);}function $e(e){ct.delete(e);}function $t(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ut(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let u=[],s=[],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),s.push(c?c[2]:"");}n.push({fn:t[1],nums:u,units:s});}return n}function Ct(e,n,r){let t=ut(e),u=ut(n);return t.length===0||t.length!==u.length?r<1?e:n:t.map((s,f)=>{let l=u[f];return s.fn!==l.fn||s.nums.length!==l.nums.length?r<1?`${s.fn}(${s.nums.map((c,h)=>`${c}${s.units[h]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,h)=>`${c}${l.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,h)=>`${c+(l.nums[h]-c)*r}${s.units[h]}`).join(", ")})`}).join(" ")}function mt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),u=String(n);if($t(t))return De(t,u,r);if(t.includes("("))return Ct(t,u,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),f=u.match(/^([-+]?[\d.]+)(.*)$/);if(s&&f){let l=parseFloat(s[1]),c=parseFloat(f[1]);return `${l+(c-l)*r}${s[2]||f[2]}`}return r<1?t:u}function Pt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ft={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},It=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ot=0;function kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ge(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:u={},easing:s="ease-out",speed:f=1,once:l=false,axis:c="y",scrollContainer:h,native:$=true,onProgress:B,onComplete:S,onEnter:Q,onLeave:he,onEnterBack:R,onLeaveBack:ee}=n,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof s=="function"?s:ie[s]??ie["ease-out"],x=ae(u.start??"top bottom"),A=ae(u.end??"bottom top"),w=typeof h=="string"?document.querySelector(h):h??null,b=Object.entries(t).map(([i,p])=>({prop:Pt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function P(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function I(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return I(),S?.(),r;P();function G(){if(!$||!kt()||typeof s!="string"||!(s in ft)||c!=="y"||w||l||f!==1||B||S||Q||he||R||ee||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!It.has(i.prop))return false;return true}function C(){let i=`ssd-a-${++Ot}`,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:${ft[s]};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,oe=()=>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 O of b)e.style.setProperty(O.prop,mt(O.from,O.to,_));},getProgress(){let J=e.getBoundingClientRect(),_=Z(),O=oe(),{tStart:me,tEnd:ge}=pe({top:J.top,height:J.height},_,O,x,A);return q(K(_,me,ge,f))}}}if(G())return C();let F=0,M=0,z=0,re=false,N=false,W=-1,d=0,L=false,g=NaN,y=()=>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},y(),X(),x,A);F=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,mt(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?he?.():g>=1&&i<1&&R?.(),g=i;}function de(){if(!re||N)return;let i=M===F?0:(y()-F)/(M-F);we(i);let p=q(K(y(),F,M,f));l&&(W=Math.max(W,p),p=W),d=p,be(p),p>=1&&!L?(L=true,S?.()):p<1&&!l&&(L=false),z=requestAnimationFrame(de);}Se();{let i=q(K(y(),F,M,f));l&&i>0&&(W=i),d=i,be(i);}let Fe=new IntersectionObserver(i=>{i.forEach(p=>{re=p.isIntersecting,re&&!N?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),Ie;function U(){clearTimeout(Ie),Ie=setTimeout(Se,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),Fe.observe(e),Le(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:F,tEnd:M})}),{destroy(){cancelAnimationFrame(z),Fe.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(Ie),$e(e);},replay(){W=-1,L=false,d=0,N=false,be(0);},pause(){N=true,cancelAnimationFrame(z);},resume(){N&&(N=false,re&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,W=p,N=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var Qe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Xe(e,n){if(typeof window>"u")return Qe;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),Qe;let t=r,{from:u=0,to:s,format:f,easing:l="ease-out",trigger:c={},once:h=true,decimals:$,onComplete:B}=n,S=$!==void 0?d=>d.toFixed($):f??(d=>String(Math.round(d))),Q=typeof l=="function"?l:ie[l]??ie["ease-out"],he=ae(c.start??"top 80%"),R=ae(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(s),B?.(),Qe;t.textContent=S(u);let te=0,q=0,x=0,A=false,w=false,b=-1,P=0,I=false,G=()=>window.scrollY,C=()=>window.innerHeight;function F(){let d=t.getBoundingClientRect(),L=pe({top:d.top,height:d.height},G(),C(),he,R);te=L.tStart,q=L.tEnd;}function M(d){t.textContent=S(u+(s-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));h&&(b=Math.max(b,d),d=b),P=d,M(d),d>=1&&!I?(I=true,B?.()):d<1&&!h&&(I=false),x=requestAnimationFrame(z);}F();{let d=Q(K(G(),te,q,1));h&&d>0&&(b=d),P=d,M(d);}let re=new IntersectionObserver(d=>{d.forEach(L=>{A=L.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),N;function W(){clearTimeout(N),N=setTimeout(F,150);}return window.addEventListener("resize",W),window.addEventListener("orientationchange",W),re.observe(t),Le(t,{type:"counter",getProgress:()=>P,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),re.disconnect(),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),clearTimeout(N),$e(t);},replay(){b=-1,I=false,P=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let L=Math.min(1,Math.max(0,d));P=L,b=L,w=true,cancelAnimationFrame(x),M(L);},getProgress(){return P}}}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ye(e,n={}){if(typeof window>"u")return pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),pt;let t=r,{trigger:u={},easing:s="linear",once:f=false,axis:l="y",preload:c="auto",onReady:h,onComplete:$,onProgress:B}=n,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof s=="function"?s:ie[s]??ie.linear,he=ae(u.start??"top top"),R=ae(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=n.from??0,te=n.to,q=0,x=0,A=0,w=false,b=false,P=-1,I=0,G=false,C=false,F=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function z(){let y=t.getBoundingClientRect(),X=l==="x"?y.left:y.top,Se=l==="x"?y.width:y.height,be=pe({top:X,height:Se},F(),M(),he,R);q=be.tStart,x=be.tEnd;}function re(y){if(!C)return;let X=te??t.duration??0;t.currentTime=ee+(X-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),B?.(y);}function N(){if(!w||b||!C)return;let y=Q(K(F(),q,x,1));f&&(P=Math.max(P,y),y=P),I=y,re(y),y>=1&&!G?(G=true,$?.()):y<1&&!f&&(G=false),A=requestAnimationFrame(N);}function W(){if(C=true,te===void 0&&(te=t.duration),S){re(1),h?.();return}z(),h?.(),w&&!b&&(A=requestAnimationFrame(N));}t.readyState>=1?W():t.addEventListener("loadedmetadata",W,{once:true}),C||z();let d=new IntersectionObserver(y=>{y.forEach(X=>{w=X.isIntersecting,w&&!b&&C?A=requestAnimationFrame(N):cancelAnimationFrame(A);});}),L;function g(){clearTimeout(L),L=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Le(t,{type:"video",getProgress:()=>I,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",W),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(L),$e(t);},replay(){P=-1,G=false,I=0,b=false,re(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&C&&(A=requestAnimationFrame(N)));},seek(y){let X=Math.min(1,Math.max(0,y));I=X,P=X,b=true,cancelAnimationFrame(A),re(X);},getProgress(){return I}}}function yt(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 Dt(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 dt(e){let n=yt(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=[],u=Array.from(r.keys()).sort((s,f)=>s-f);for(let s of u){let f=r.get(s),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 s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Ft(e,n,r,t){if(r<=1||t===0)return e;let u=(r-1)*t,s=n*t,f=s+(1-u);return f<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(f-s)))}function Nt(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 gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function je(e,n={}){if(typeof window>"u")return gt;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),gt;let t=r,{split:u="words",stagger:s=.04,easing:f="ease-out",from:l={opacity:0,y:24},trigger:c={},once:h=true,onComplete:$}=n,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof f=="function"?f:ie[f]??ie["ease-out"],Q=ae(c.start??"top 85%"),he=ae(c.end??"top 40%"),R=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=Dt(t):u==="lines"?ee=dt(t):ee=yt(t);let te=ee.length;function q(g,y){l?.opacity!==void 0&&(g.style.opacity=String(l.opacity+(1-l.opacity)*y));let X=Nt(y,l);X&&(g.style.transform=X);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((y,X)=>{let Se=S(Ft(g,X,te,s));q(y,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,P=false,I=false,G=-1,C=0,F=false,M=()=>window.scrollY,z=()=>window.innerHeight;function re(){let g=t.getBoundingClientRect(),y=pe({top:g.top,height:g.height},M(),z(),Q,he);A=y.tStart,w=y.tEnd;}function N(){if(!P||I)return;let g=K(M(),A,w,1);h&&(G=Math.max(G,g),g=G),C=g,x(g),g>=1&&!F?(F=true,$?.()):g<1&&!h&&(F=false),b=requestAnimationFrame(N);}re();let W=new IntersectionObserver(g=>{g.forEach(y=>{P=y.isIntersecting,P&&!I?b=requestAnimationFrame(N):cancelAnimationFrame(b);});}),d;function L(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let g=C;t.innerHTML=R,t.setAttribute("aria-label",t.textContent??""),ee=dt(t),x(g);}re();},150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),W.observe(t),Le(t,{type:"text",getProgress:()=>C,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),W.disconnect(),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),clearTimeout(d),t.innerHTML=R,t.removeAttribute("aria-label"),$e(t);},replay(){G=-1,F=false,C=0,I=false,x(0);},pause(){I=true,cancelAnimationFrame(b);},resume(){I&&(I=false,P&&(b=requestAnimationFrame(N)));},seek(g){let y=Math.min(1,Math.max(0,g));C=y,G=y,I=true,cancelAnimationFrame(b),x(y);},getProgress(){return C}}}function ir(e,n={}){let r=Be(e,n);return {update(t){r.destroy(),r=Be(e,t);},destroy(){r.destroy();}}}function ar(e={}){let n=null;function r(t){return n=Be(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function lr(e,n){let r=Ge(e,n);return {update(t){r.destroy(),r=Ge(e,t);},destroy(){r.destroy();}}}function cr(e){let n=null;function r(t){return n=Ge(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function ur(e,n){let r=Xe(e,n);return {update(t){r.destroy(),r=Xe(e,t);},destroy(){r.destroy();}}}function mr(e){let n=null;function r(t){return n=Xe(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function fr(e,n={}){let r=Ye(e,n);return {update(t){r.destroy(),r=Ye(e,t);},destroy(){r.destroy();}}}function pr(e={}){let n=null;function r(t){return n=Ye(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function dr(e,n={}){let r=je(e,n);return {update(t){r.destroy(),r=je(e,t);},destroy(){r.destroy();}}}function gr(e={}){let n=null;function r(t){return n=je(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}export{cr as createScrollAnimate,mr as createScrollCounter,ar as createScrollDraw,gr as createScrollText,pr as createScrollVideo,lr as scrollAnimate,ur as scrollCounterAction,ir as scrollDraw,dr as scrollTextAction,fr as scrollVideoAction};
1
+ function Rt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<r;d++){let x=Math.pow(l,d);c.push(x),s+=x;}let u=[0],m=0;for(let d=0;d<r;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<r;x++)if(d<=u[x+1]){let N=(d-u[x])/(u[x+1]-u[x]);if(x===0)return N*(2-N);let L=1-Math.pow(t,x);return L+(1-L)*(2*N-1)*(2*N-1)}return 1}}function Ht({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=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-l)*(2*Math.PI)/t)+1}var ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Rt(),elastic:Ht()};function pe(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 ht(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 bt(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 ze(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 Nt(e,n,r){return Math.min(r,Math.max(n,e))}function Q(e,n,r,t){return r===n?0:Nt((e-n)/(r-n)*t,0,1)}function Qe(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function xe(e,n,r,t,l){let s=ht(e.top,e.height,n,t.element)-bt(t.viewport,r),c=ht(e.top,e.height,n,l.element)-bt(l.viewport,r);return {tStart:s,tEnd:c}}function wt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function _e(e,n,r){let t=wt(e),l=wt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var vt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...n){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Vt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",zt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function _t(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function qt(e){let n=[];for(let r=0;r<St;r++){let t=r/(St-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return Vt;case "ease-out":return zt;case "ease-in-out":return _t()?qt(ee["ease-in-out"]):null;default:return null}}var Wt=0;function Bt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Gt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?ye("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function jt(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 l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
2
+ <div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
+ <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Et=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Tt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ut(e,n,r){if(!Ze)return;let t=(e.match(Tt)??[]).join("").toUpperCase(),l=(n.match(Tt)??[]).join("").toUpperCase(),s=(e.match(Et)??[]).length,c=(n.match(Et)??[]).length;if(t!==l){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&ye(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function lt(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function Ke(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...vt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Me=false,axis:W="y",scrollContainer:Z,autoReverse:X=false,delay:B=0,strokeColor:A,strokeWidth:$,fillOpacity:M,waypoints:w,velocityScale:I=false,threshold:O=0,rootMargin:C="0px",repeat:E=0,repeatDelay:re=0,morphTo:k,clip:ne,autoplay:oe=false,duration:J=1e3,native:ue=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:F,onEnterBack:de,onLeaveBack:ve}=l,me=ne===true?"left":typeof ne=="string"?ne:false,Se=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),Ne=pe(x.end??"bottom top"),he=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(A)?A[0]:null,se=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null,fe=Array.isArray(M)?M[0]:null,Y=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function $e(o){let a=o*100;switch(me){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 V=me?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,we=0,R=false,z=false,_=0,j=false,ae=-1,Ce=-1,K=false,Ee=0,Ie=0,ke,ot=null;function ut(){ot?.destroy(),ot=null;}let De=new Set,mt=NaN,Fe=true,Be=-1,ft=performance.now(),Ve=NaN;function st(){return he?W==="x"?he.scrollLeft:he.scrollTop:W==="x"?window.scrollX:window.scrollY}function pt(){return he?W==="x"?he.clientWidth:he.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function dt(){let o=Qe(e,he,W),a=xe(o,o.scroll,pt(),Le,Ne);f=a.tStart,we=a.tEnd,Me&&Ze&&(ut(),ot=jt(f,we,W));}function Ot(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),me){let v=a==="reverse"?1-o:o;e.style.clipPath=$e(v);return}V.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${P[le]*o}`:`${P[le]*(1-o)}`,m&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&se?v.style.stroke=_e(be,se,o):se&&(v.style.stroke=se),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*o}`:Y!==null&&(v.style.fillOpacity=`${Y}`),k&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",lt(i[le],k,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=$e(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${P[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`),k&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{Gt(o);let a=ze(o);P.push(a);let v=o.tagName.toLowerCase()==="path";v?i.push(o.getAttribute("d")??""):i.push(""),k&&(v?Ut(i[i.length-1],k,o):ye(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),Y!==null&&(o.style.fillOpacity=`${Y}`),k&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",k)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`));}),me){if(s)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof d=="string"?Je(d):null;function kt(){return !(ue===false||!Bt()||!V.length||!gt||me||W!=="y"||he||u!==1||N!==0||te||X||I!==false||k||w||E||B>0||y||T||g||p||F||de||ve||A!=null||$!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Dt(){let o=++Wt,a=`svg-scroll-draw-${o}`,v=`svg-scroll-draw-host-${o}`,le=`--svg-scroll-draw-${o}`,Oe=L==="reverse"?"0":"var(--ssd-len)",Pe=L==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Oe};`,S=`stroke-dashoffset:${Pe};`;m&&(Ae+=`opacity:${L==="reverse"?1:0};`,S+=`opacity:${L==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Ae}}to{${S}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(v);function ce(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(ce);let b=false,H=-1;function q(){if(H>=0)return H;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},st(),pt(),Le,Ne);return Se(Q(st(),U,Te,u))}return {destroy(){e.classList.remove(v),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){b=false,H=-1,V.forEach(ce);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));H=U,b=true,V.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${P[ge]*U}`:`${P[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=ze(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(kt())return Dt();function Ft(){let o=Math.max(1,J),a=0,v=0,le=false;function Oe(b){let H=true;if(me){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);Ee=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=$e(L==="reverse"?1-h:h),y?.(h),q<1&&(H=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),ge=Se(Te);q.style.strokeDashoffset=L==="reverse"?`${P[h]*ge}`:`${P[h]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&se?q.style.stroke=_e(be,se,ge):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),k&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",lt(i[h],k,ge)),h===0&&(Ee=ge,y?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(H=false);});if(w){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);for(let U in w){let Te=parseFloat(U);h>=Te&&!De.has(Te)&&(De.add(Te),w[U]?.());}}return H}function Pe(b){if(K)return;let H=b-a;z||(z=true,T?.());let q=Oe(H);if(q&&!R){R=true,Oe(o*(1+Math.max(0,V.length-1)*N)),g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,ke=setTimeout(()=>{a=performance.now(),z=false,R=false,De.clear(),Ge(),_=requestAnimationFrame(Pe);},re));return}q||(_=requestAnimationFrame(Pe));}function Ae(){cancelAnimationFrame(_),clearTimeout(ke),a=performance.now(),v=0,K=false,z=false,R=false,Ie=0,le=true,Ee=0,De.clear(),Ge(),_=requestAnimationFrame(Pe);}let S=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&R)?Ae():!H.isIntersecting&&!te&&!R&&(cancelAnimationFrame(_),clearTimeout(ke),le=false);});},{root:he??null,threshold:O,rootMargin:C}),D;function ce(){clearTimeout(D),D=setTimeout(()=>{V.forEach((b,H)=>{P[H]=ze(b),b.style.strokeDasharray=`${P[H]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),B>0?setTimeout(()=>S.observe(e),B):S.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(ke),S.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(D);},replay(){Ie=0,Ae();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(_));},resume(){K&&(K=false,le=true,a=performance.now()-v,_=requestAnimationFrame(Pe));},seek(b){let H=Math.min(1,Math.max(0,b));Ee=H,K=true,v=H*o,a=performance.now()-v,cancelAnimationFrame(_),Oe(v);},getProgress(){return Ee},refresh(){clearTimeout(D),V.forEach((b,H)=>{P[H]=ze(b),b.style.strokeDasharray=`${P[H]}`;});}}}if(oe)return Ft();dt();function je(){if(!j||K)return;let o=performance.now(),a=st();if(!Fe&&I===false&&a===mt){_=requestAnimationFrame(je);return}Fe=false,mt=a;let v=u;if(I!==false){let S=o-ft,D=S>0?Math.abs(a-(Be<0?a:Be))/S:0;v=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}Be=a,ft=o;let le=X?Ce===-1||a>=Ce?"forward":"reverse":L;Ce=a;let Oe=we-f,Pe=true,Ae=Oe===0?0:(a-f)/Oe;if(isNaN(Ve)||(Ve<=0&&Ae>0?p?.():Ve>0&&Ae<=0&&ve?.(),Ve<1&&Ae>=1?F?.():Ve>=1&&Ae<1&&de?.()),Ve=Ae,me){let S=Se(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,S),S=ae),Ee=S,e.style.setProperty("--scroll-draw-progress",String(S));let D=le==="reverse"?1-S:S;e.style.clipPath=$e(D),y?.(S),!z&&Q(a,f,we,v)>0&&(z=true,T?.()),S>=1&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,ke=setTimeout(()=>{ae=-1,z=false,R=false,e.style.clipPath=$e(0);},re))):S<1&&!te&&(R=false),_=requestAnimationFrame(je);return}if(V.forEach((S,D)=>{let ce=D*N*Oe,b=Se(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Ee=b,S.style.strokeDashoffset=le==="reverse"?`${P[D]*b}`:`${P[D]*(1-b)}`,m&&(S.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&se?S.style.stroke=_e(be,se,b):se&&(S.style.stroke=se),ie!==null&&G!==null?S.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(S.style.strokeWidth=`${G}`),fe!==null&&Y!==null?S.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(S.style.fillOpacity=`${Y}`),k&&S.tagName.toLowerCase()==="path"&&i[D]&&S.setAttribute("d",lt(i[D],k,b)),D===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),w){let S=Se(Q(a,f,we,v));for(let D in w){let ce=parseFloat(D);S>=ce&&!De.has(ce)&&(De.add(ce),w[D]?.());}}!z&&Q(a,f,we,v)>0&&(z=true,T?.()),Pe&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,ke=setTimeout(()=>{ae=-1,z=false,R=false,De.clear(),Ge(),Fe=true;},re))):!Pe&&!te&&(R=false),_=requestAnimationFrame(je);}let it=false;function Ue(){it||(it=true,_=requestAnimationFrame(function(){je();}));}function Xe(){it=false,cancelAnimationFrame(_);}let at=new IntersectionObserver(o=>{o.forEach(a=>{j=a.isIntersecting,j&&!K?(Fe=true,Ue()):Xe();});},{root:he??null,threshold:O,rootMargin:C});function yt(){V.forEach((o,a)=>{P[a]=ze(o),o.style.strokeDasharray=`${P[a]}`;}),dt(),Fe=true;}let Ye;function qe(){clearTimeout(Ye),Ye=setTimeout(yt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),B>0?setTimeout(()=>at.observe(e),B):at.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(ke),Xe(),at.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Ye),ut();},replay(){ae=-1,Ce=-1,Be=-1,z=false,R=false,Ie=0,K=false,Ee=0,De.clear(),clearTimeout(ke),Ge(),Fe=true,j&&Ue();},pause(){K=true,Xe();},resume(){K&&(K=false,Fe=true,j&&Ue());},seek(o){let a=Math.min(1,Math.max(0,o));Ee=a,ae=a,K=true,Xe(),Ot(a,L),Fe=true;},getProgress(){return Ee},refresh(){clearTimeout(Ye),yt(),j&&!K&&Ue();}}}var xt=new Map;function Re(e,n){xt.set(e,n);}function He(e){xt.delete(e);}function Xt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function At(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function Yt(e,n,r){let t=At(e),l=At(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Mt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Xt(t))return _e(t,l,r);if(t.includes("("))return Yt(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function Qt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Zt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Jt=0,Lt="--scroll-draw-progress";function Kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Me,onComplete:W,onEnter:Z,onLeave:X,onEnterBack:B,onLeaveBack:A}=n,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:ee[s]??ee["ease-out"],w=pe(l.start??"top bottom"),I=pe(l.end??"bottom top"),O=te??e,C=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([i,f])=>({prop:Qt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function re(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function k(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let ne=new Map;for(let i of [...E.map(f=>f.prop),Lt])ne.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of ne)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return k(),W?.(),{...r,destroy:oe,getProgress:()=>1};re();let J=typeof s=="string"?Je(s):null;function ue(){if(!x||!Kt()||!J||m!=="y"||C||O!==e||u||c!==1||Me||W||Z||X||B||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!Zt.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++Jt}`,f=E.map(j=>`${j.prop}:${j.from}`).join(";"),we=E.map(j=>`${j.prop}:${j.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",oe();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let Ce of E)e.style.setProperty(Ce.prop,Mt(Ce.from,Ce.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=z(),Ce=_(),{tStart:K,tEnd:Ee}=xe({top:j.top,height:j.height},ae,Ce,w,I);return M(Q(ae,K,Ee,c))}}}if(ue())return y();let T=0,g=0,p=0,F=false,de=false,ve=-1,me=0,Se=false,Le=NaN,Ne=-1,he=0,be=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=Qe(O,C,m),f=xe(i,i.scroll,se(),w,I);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Lt,String(i));for(let f of E)e.style.setProperty(f.prop,Mt(f.from,f.to,i));Me?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&A?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&B?.(),Le=i;}function Y(){if(!F||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let _=i-he,j=_>0?Math.abs(f-(Ne<0?f:Ne))/_:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}Ne=f,he=i;let R=g===T?0:(f-T)/(g-T);fe(R);let z=M(Q(f,T,g,we));u&&(ve=Math.max(ve,z),z=ve),me=z,G(z),z>=1&&!Se?(Se=true,W?.()):z<1&&!u&&(Se=false),p=requestAnimationFrame(Y);}ie(),g===T&&ye("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=M(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let $e=new IntersectionObserver(i=>{i.forEach(f=>{F=f.isIntersecting,F&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:C??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),$e.observe(e),Re(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),$e.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),He(e);},replay(){ve=-1,Se=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,F&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tt(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollCounter: element not found:",e),ct;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=n,L=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Me=pe(m.start??"top 80%"),W=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),N?.(),ct;let X=0,B=0,A=0,$=false,M=false,w=-1,I=0,O=false,C=()=>window.scrollY,E=()=>window.innerHeight;function re(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},C(),E(),Me,W);X=T.tStart,B=T.tEnd;}function k(y){t.textContent=L(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function ne(){if(!$||M)return;let y=te(Q(C(),X,B,1));d&&(w=Math.max(w,y),y=w),I=y,k(y),y>=1&&!O?(O=true,N?.()):y<1&&!d&&(O=false),A=requestAnimationFrame(ne);}re();{let y=te(Q(C(),X,B,1));d&&y>0&&(w=y),I=y,k(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{$=T.isIntersecting,$&&!M?A=requestAnimationFrame(ne):cancelAnimationFrame(A);});}),J;function ue(){clearTimeout(J),J=setTimeout(re,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),oe.observe(t),Re(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:B})}),{destroy(){cancelAnimationFrame(A),oe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),He(t);},replay(){w=-1,O=false,I=0,M=false,k(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,$&&(A=requestAnimationFrame(ne)));},seek(y){let T=Math.min(1,Math.max(0,y));I=T,w=T,M=true,cancelAnimationFrame(A),k(T);},getProgress(){return I}}}var $t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,n={}){if(typeof window>"u")return $t;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),$t;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=n,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,Me=pe(l.start??"top top"),W=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=n.from??0,X=n.to,B=0,A=0,$=0,M=false,w=false,I=-1,O=0,C=false,E=false,re=()=>u==="x"?window.scrollX:window.scrollY,k=()=>u==="x"?window.innerWidth:window.innerHeight;function ne(){let p=t.getBoundingClientRect(),F=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:F,height:de},re(),k(),Me,W);B=ve.tStart,A=ve.tEnd;}function oe(p){if(!E)return;let F=X??t.duration??0;t.currentTime=Z+(F-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!M||w||!E)return;let p=te(Q(re(),B,A,1));c&&(I=Math.max(I,p),p=I),O=p,oe(p),p>=1&&!C?(C=true,x?.()):p<1&&!c&&(C=false),$=requestAnimationFrame(J);}function ue(){if(E=true,X===void 0&&(X=t.duration),L){oe(1),d?.();return}ne(),d?.(),M&&!w&&($=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),E||ne();let y=new IntersectionObserver(p=>{p.forEach(F=>{M=F.isIntersecting,M&&!w&&E?$=requestAnimationFrame(J):cancelAnimationFrame($);});}),T;function g(){clearTimeout(T),T=setTimeout(ne,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Re(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:B,tEnd:A})}),{destroy(){cancelAnimationFrame($),y.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),He(t);},replay(){I=-1,C=false,O=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,M&&E&&($=requestAnimationFrame(J)));},seek(p){let F=Math.min(1,Math.max(0,p));O=F,I=F,w=true,cancelAnimationFrame($),oe(F);},getProgress(){return O}}}function It(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function er(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 Ct(e){let n=It(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function tr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function rr(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 Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,n={}){if(typeof window>"u")return Pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollText: element not found:",e),Pt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=n,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Me=pe(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=er(t):l==="lines"?Z=Ct(t):Z=It(t);let X=Z.length;function B(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let F=rr(p,u);F&&(g.style.transform=F);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,F)=>{let de=L(tr(g,F,X,s));B(p,de);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,M=0,w=0,I=false,O=false,C=-1,E=0,re=false,k=()=>window.scrollY,ne=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},k(),ne(),te,Me);$=p.tStart,M=p.tEnd;}function J(){if(!I||O)return;let g=Q(k(),$,M,1);d&&(C=Math.max(C,g),g=C),E=g,A(g),g>=1&&!re?(re=true,x?.()):g<1&&!d&&(re=false),w=requestAnimationFrame(J);}oe();let ue=new IntersectionObserver(g=>{g.forEach(p=>{I=p.isIntersecting,I&&!O?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),Z=Ct(t),A(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Re(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:$,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=W,t.removeAttribute("aria-label"),He(t);},replay(){C=-1,re=false,E=0,O=false,A(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,I&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));E=p,C=p,O=true,cancelAnimationFrame(w),A(p);},getProgress(){return E}}}function Rr(e,n={}){let r=Ke(e,n);return {update(t){r.destroy(),r=Ke(e,t);},destroy(){r.destroy();}}}function Hr(e={}){let n=null;function r(t){return n=Ke(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function Nr(e,n){let r=et(e,n);return {update(t){r.destroy(),r=et(e,t);},destroy(){r.destroy();}}}function Vr(e){let n=null;function r(t){return n=et(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function zr(e,n){let r=tt(e,n);return {update(t){r.destroy(),r=tt(e,t);},destroy(){r.destroy();}}}function _r(e){let n=null;function r(t){return n=tt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function qr(e,n={}){let r=rt(e,n);return {update(t){r.destroy(),r=rt(e,t);},destroy(){r.destroy();}}}function Wr(e={}){let n=null;function r(t){return n=rt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function Br(e,n={}){let r=nt(e,n);return {update(t){r.destroy(),r=nt(e,t);},destroy(){r.destroy();}}}function Gr(e={}){let n=null;function r(t){return n=nt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}export{Vr as createScrollAnimate,_r as createScrollCounter,Hr as createScrollDraw,Gr as createScrollText,Wr as createScrollVideo,Nr as scrollAnimate,zr as scrollCounterAction,Rr as scrollDraw,Br as scrollTextAction,qr as scrollVideoAction};
@@ -1 +1 @@
1
- 'use strict';function Q({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),c=Math.sqrt(t),o=0,i=[];for(let u=0;u<n;u++){let l=Math.pow(c,u);i.push(l),o+=l;}let a=[0],m=0;for(let u=0;u<n;u++)m+=i[u]/o,a.push(m);return u=>{if(u<=0)return 0;if(u>=1)return 1;for(let l=0;l<n;l++)if(u<=a[l+1]){let b=(u-a[l])/(a[l+1]-a[l]);if(l===0)return b*(2-b);let w=1-Math.pow(t,l);return w+(1-w)*(2*b-1)*(2*b-1)}return 1}}function Y({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),c=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-c)*(2*Math.PI)/t)+1}var P={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Q(),elastic:Y()};function $(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 N(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 O(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 Z(e,r,n){return Math.min(n,Math.max(r,e))}function _(e,r,n,t){return n===r?0:Z((e-r)/(n-r)*t,0,1)}function q(e,r,n,t,c){let o=N(e.top,e.height,r,t.element)-O(t.viewport,n),i=N(e.top,e.height,r,c.element)-O(c.viewport,n);return {tStart:o,tEnd:i}}var z=new Map;function D(e,r){z.set(e,r);}function G(e){z.delete(e);}function V(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 ee(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 k(e){let r=V(e),n=new Map;for(let o of r){let i=o.offsetTop;n.has(i)||n.set(i,[]),n.get(i).push(o);}let t=[],c=Array.from(n.keys()).sort((o,i)=>o-i);for(let o of c){let i=n.get(o),a=document.createElement("span");a.setAttribute("aria-hidden","true"),a.style.display="inline-block";for(let m of i)a.appendChild(m);t.push(a);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function te(e,r,n,t){if(n<=1||t===0)return e;let c=(n-1)*t,o=r*t,i=o+(1-c);return i<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(i-o)))}function ne(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 B={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ae(e,r={}){if(typeof window>"u")return B;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),B;let t=n,{split:c="words",stagger:o=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:m={},once:u=true,onComplete:l}=r,b=window.matchMedia("(prefers-reduced-motion: reduce)").matches,w=typeof i=="function"?i:P[i]??P["ease-out"],W=$(m.start??"top 85%"),j=$(m.end??"top 40%"),v=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let g;c==="chars"?g=ee(t):c==="lines"?g=k(t):g=V(t);let U=g.length;function X(s,p){a?.opacity!==void 0&&(s.style.opacity=String(a.opacity+(1-a.opacity)*p));let S=ne(p,a);S&&(s.style.transform=S);}function h(s){t.style.setProperty("--scroll-draw-progress",String(s)),g.forEach((p,S)=>{let K=w(te(s,S,U,o));X(p,K);});}if(b)return h(1),l?.(),{destroy(){t.innerHTML=v,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};h(0);let I=0,A=0,d=0,M=false,f=false,x=-1,y=0,E=false,F=()=>window.scrollY,J=()=>window.innerHeight;function H(){let s=t.getBoundingClientRect(),p=q({top:s.top,height:s.height},F(),J(),W,j);I=p.tStart,A=p.tEnd;}function C(){if(!M||f)return;let s=_(F(),I,A,1);u&&(x=Math.max(x,s),s=x),y=s,h(s),s>=1&&!E?(E=true,l?.()):s<1&&!u&&(E=false),d=requestAnimationFrame(C);}H();let R=new IntersectionObserver(s=>{s.forEach(p=>{M=p.isIntersecting,M&&!f?d=requestAnimationFrame(C):cancelAnimationFrame(d);});}),L;function T(){clearTimeout(L),L=setTimeout(()=>{if(c==="lines"){let s=y;t.innerHTML=v,t.setAttribute("aria-label",t.textContent??""),g=k(t),h(s);}H();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),R.observe(t),D(t,{type:"text",getProgress:()=>y,getTrigger:()=>({tStart:I,tEnd:A})}),{destroy(){cancelAnimationFrame(d),R.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(L),t.innerHTML=v,t.removeAttribute("aria-label"),G(t);},replay(){x=-1,E=false,y=0,f=false,h(0);},pause(){f=true,cancelAnimationFrame(d);},resume(){f&&(f=false,M&&(d=requestAnimationFrame(C)));},seek(s){let p=Math.min(1,Math.max(0,s));y=p,x=p,f=true,cancelAnimationFrame(d),h(p);},getProgress(){return y}}}exports.scrollText=ae;
1
+ 'use strict';function Q({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),o=0,s=[];for(let u=0;u<n;u++){let a=Math.pow(l,u);s.push(a),o+=a;}let c=[0],m=0;for(let u=0;u<n;u++)m+=s[u]/o,c.push(m);return u=>{if(u<=0)return 0;if(u>=1)return 1;for(let a=0;a<n;a++)if(u<=c[a+1]){let g=(u-c[a])/(c[a+1]-c[a]);if(a===0)return g*(2-g);let w=1-Math.pow(t,a);return w+(1-w)*(2*g-1)*(2*g-1)}return 1}}function Z({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=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-l)*(2*Math.PI)/t)+1}var I={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Q(),elastic:Z()};function R(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 F(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 H(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 ee(e,r,n){return Math.min(n,Math.max(r,e))}function V(e,r,n,t){return n===r?0:ee((e-r)/(n-r)*t,0,1)}function O(e,r,n,t,l){let o=F(e.top,e.height,r,t.element)-H(t.viewport,n),s=F(e.top,e.height,r,l.element)-H(l.viewport,n);return {tStart:o,tEnd:s}}var N=new Map;function G(e,r){N.set(e,r);}function z(e){N.delete(e);}var te=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function B(e,...r){te&&console.warn(`[svg-scroll-draw] ${e}`,...r);}function k(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 ne(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 q(e){let r=k(e),n=new Map;for(let o of r){let s=o.offsetTop;n.has(s)||n.set(s,[]),n.get(s).push(o);}let t=[],l=Array.from(n.keys()).sort((o,s)=>o-s);for(let o of l){let s=n.get(o),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block",s.forEach((m,u)=>{let a=m.nextElementSibling;c.appendChild(m),u<s.length-1&&a&&a.style.whiteSpace==="pre"&&c.appendChild(a);}),t.push(c);}return e.textContent="",t.forEach((o,s)=>{e.appendChild(o),s<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function re(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,o=r*t,s=o+(1-l);return s<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(s-o)))}function oe(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 W={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pe(e,r={}){if(typeof window>"u")return W;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return B("scrollText: element not found:",e),W;let t=n,{split:l="words",stagger:o=.04,easing:s="ease-out",from:c={opacity:0,y:24},trigger:m={},once:u=true,onComplete:a}=r,g=window.matchMedia("(prefers-reduced-motion: reduce)").matches,w=typeof s=="function"?s:I[s]??I["ease-out"],X=R(m.start??"top 85%"),j=R(m.end??"top 40%"),C=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let b;l==="chars"?b=ne(t):l==="lines"?b=q(t):b=k(t);let U=b.length;function Y(i,p){c?.opacity!==void 0&&(i.style.opacity=String(c.opacity+(1-c.opacity)*p));let S=oe(p,c);S&&(i.style.transform=S);}function h(i){t.style.setProperty("--scroll-draw-progress",String(i)),b.forEach((p,S)=>{let K=w(re(i,S,U,o));Y(p,K);});}if(g)return h(1),a?.(),{destroy(){t.innerHTML=C,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};h(0);let L=0,v=0,d=0,M=false,f=false,x=-1,y=0,E=false,P=()=>window.scrollY,J=()=>window.innerHeight;function $(){let i=t.getBoundingClientRect(),p=O({top:i.top,height:i.height},P(),J(),X,j);L=p.tStart,v=p.tEnd;}function _(){if(!M||f)return;let i=V(P(),L,v,1);u&&(x=Math.max(x,i),i=x),y=i,h(i),i>=1&&!E?(E=true,a?.()):i<1&&!u&&(E=false),d=requestAnimationFrame(_);}$();let D=new IntersectionObserver(i=>{i.forEach(p=>{M=p.isIntersecting,M&&!f?d=requestAnimationFrame(_):cancelAnimationFrame(d);});}),A;function T(){clearTimeout(A),A=setTimeout(()=>{if(l==="lines"){let i=y;t.innerHTML=C,t.setAttribute("aria-label",t.textContent??""),b=q(t),h(i);}$();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),D.observe(t),G(t,{type:"text",getProgress:()=>y,getTrigger:()=>({tStart:L,tEnd:v})}),{destroy(){cancelAnimationFrame(d),D.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(A),t.innerHTML=C,t.removeAttribute("aria-label"),z(t);},replay(){x=-1,E=false,y=0,f=false,h(0);},pause(){f=true,cancelAnimationFrame(d);},resume(){f&&(f=false,M&&(d=requestAnimationFrame(_)));},seek(i){let p=Math.min(1,Math.max(0,i));y=p,x=p,f=true,cancelAnimationFrame(d),h(p);},getProgress(){return y}}}exports.scrollText=pe;
@@ -15,6 +15,21 @@ interface ScrollDrawInstance {
15
15
  seek: (progress: number) => void;
16
16
  /** Returns current draw progress (0–1). */
17
17
  getProgress: () => number;
18
+ /**
19
+ * Re-measure after a layout change: path lengths, and the scroll trigger window.
20
+ *
21
+ * The engine already re-measures on `resize`, on `orientationchange`, and via a
22
+ * `ResizeObserver` on the document element — but none of those fire for a layout
23
+ * change that leaves the document height alone, such as a tab switching, a
24
+ * sibling collapsing, or a font swapping inside a fixed-height box. Call this
25
+ * after one of those.
26
+ *
27
+ * Optional on this shared type because several instances here are fan-outs over
28
+ * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
29
+ * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
30
+ * use `instance.refresh?.()` if you hold an instance of unknown origin.
31
+ */
32
+ refresh?: () => void;
18
33
  }
19
34
 
20
35
  interface ScrollTextOptions {
@@ -15,6 +15,21 @@ interface ScrollDrawInstance {
15
15
  seek: (progress: number) => void;
16
16
  /** Returns current draw progress (0–1). */
17
17
  getProgress: () => number;
18
+ /**
19
+ * Re-measure after a layout change: path lengths, and the scroll trigger window.
20
+ *
21
+ * The engine already re-measures on `resize`, on `orientationchange`, and via a
22
+ * `ResizeObserver` on the document element — but none of those fire for a layout
23
+ * change that leaves the document height alone, such as a tab switching, a
24
+ * sibling collapsing, or a font swapping inside a fixed-height box. Call this
25
+ * after one of those.
26
+ *
27
+ * Optional on this shared type because several instances here are fan-outs over
28
+ * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
29
+ * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
30
+ * use `instance.refresh?.()` if you hold an instance of unknown origin.
31
+ */
32
+ refresh?: () => void;
18
33
  }
19
34
 
20
35
  interface ScrollTextOptions {