svg-scroll-draw 2.9.0 → 2.10.1

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 (75) hide show
  1. package/README.md +17 -10
  2. package/dist/angular/index.cjs +3 -3
  3. package/dist/angular/index.d.mts +42 -0
  4. package/dist/angular/index.d.ts +42 -0
  5. package/dist/angular/index.mjs +3 -3
  6. package/dist/astro/index.cjs +3 -3
  7. package/dist/astro/index.d.mts +20 -5
  8. package/dist/astro/index.d.ts +20 -5
  9. package/dist/astro/index.mjs +3 -3
  10. package/dist/cdn/svg-scroll-draw.dev.global.js +1903 -0
  11. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  12. package/dist/cinematic/index.cjs +2 -2
  13. package/dist/cinematic/index.mjs +2 -2
  14. package/dist/cli/init.js +104 -101
  15. package/dist/devtools/index.cjs +1 -1
  16. package/dist/devtools/index.mjs +1 -1
  17. package/dist/group/index.cjs +3 -3
  18. package/dist/group/index.d.mts +42 -0
  19. package/dist/group/index.d.ts +42 -0
  20. package/dist/group/index.mjs +3 -3
  21. package/dist/horizontal/index.cjs +1 -1
  22. package/dist/horizontal/index.d.mts +48 -1
  23. package/dist/horizontal/index.d.ts +48 -1
  24. package/dist/horizontal/index.mjs +1 -1
  25. package/dist/index.cjs +4 -4
  26. package/dist/index.d.mts +42 -0
  27. package/dist/index.d.ts +42 -0
  28. package/dist/index.mjs +4 -4
  29. package/dist/nuxt/index.cjs +3 -3
  30. package/dist/nuxt/index.d.mts +27 -0
  31. package/dist/nuxt/index.d.ts +27 -0
  32. package/dist/nuxt/index.mjs +3 -3
  33. package/dist/pin/index.cjs +1 -1
  34. package/dist/pin/index.mjs +1 -1
  35. package/dist/progress/index.cjs +1 -1
  36. package/dist/progress/index.d.mts +15 -0
  37. package/dist/progress/index.d.ts +15 -0
  38. package/dist/progress/index.mjs +1 -1
  39. package/dist/react/index.cjs +3 -3
  40. package/dist/react/index.d.mts +27 -0
  41. package/dist/react/index.d.ts +27 -0
  42. package/dist/react/index.mjs +3 -3
  43. package/dist/reveal/index.cjs +1 -1
  44. package/dist/reveal/index.mjs +1 -1
  45. package/dist/snap/index.cjs +1 -1
  46. package/dist/snap/index.d.mts +8 -0
  47. package/dist/snap/index.d.ts +8 -0
  48. package/dist/snap/index.mjs +1 -1
  49. package/dist/solid/index.cjs +3 -3
  50. package/dist/solid/index.d.mts +42 -0
  51. package/dist/solid/index.d.ts +42 -0
  52. package/dist/solid/index.mjs +3 -3
  53. package/dist/svelte/index.cjs +3 -3
  54. package/dist/svelte/index.d.mts +42 -0
  55. package/dist/svelte/index.d.ts +42 -0
  56. package/dist/svelte/index.mjs +3 -3
  57. package/dist/text/index.cjs +1 -1
  58. package/dist/text/index.d.mts +15 -0
  59. package/dist/text/index.d.ts +15 -0
  60. package/dist/text/index.mjs +1 -1
  61. package/dist/timeline/index.cjs +9 -9
  62. package/dist/timeline/index.d.mts +31 -0
  63. package/dist/timeline/index.d.ts +31 -0
  64. package/dist/timeline/index.mjs +9 -9
  65. package/dist/video/index.cjs +1 -1
  66. package/dist/video/index.d.mts +15 -0
  67. package/dist/video/index.d.ts +15 -0
  68. package/dist/video/index.mjs +1 -1
  69. package/dist/vue/index.cjs +3 -3
  70. package/dist/vue/index.d.mts +27 -0
  71. package/dist/vue/index.d.ts +27 -0
  72. package/dist/vue/index.mjs +3 -3
  73. package/dist/web-component/index.cjs +3 -3
  74. package/dist/web-component/index.mjs +3 -3
  75. package/package.json +40 -6
@@ -1,3 +1,3 @@
1
- 'use strict';function ot({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),u=Math.sqrt(t),i=0,p=[];for(let g=0;g<r;g++){let M=Math.pow(u,g);p.push(M),i+=M;}let m=[0],c=0;for(let g=0;g<r;g++)c+=p[g]/i,m.push(c);return g=>{if(g<=0)return 0;if(g>=1)return 1;for(let M=0;M<r;M++)if(g<=m[M+1]){let F=(g-m[M])/(m[M+1]-m[M]);if(M===0)return F*(2-F);let S=1-Math.pow(t,M);return S+(1-S)*(2*F-1)*(2*F-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 i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-u)*(2*Math.PI)/t)+1}var pe={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:ot(),elastic:st()};function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function tt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function rt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function We(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function St(e,n,r){return Math.min(r,Math.max(n,e))}function Z(e,n,r,t){return r===n?0:St((e-n)/(r-n)*t,0,1)}function ve(e,n,r,t,u){let i=tt(e.top,e.height,n,t.element)-rt(t.viewport,r),p=tt(e.top,e.height,n,u.element)-rt(u.viewport,r);return {tStart:i,tEnd:p}}function nt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Oe(e,n,r){let t=nt(e),u=nt(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 Xe={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};function it(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var at={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Et=0;function xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Tt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?it("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&it("Element has a fill \u2014 it may obscure the stroke animation.",e);}function At(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function u(){let i=r==="x"?window.scrollX:window.scrollY,p=e-i,m=n-i,c=r==="x";t.innerHTML=`
2
- <div style="position:absolute;${c?`left:${p}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${p}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:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",u,{passive:true}),u(),t}function Je(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let p=parseFloat(i),m=t[u++]??p;return String(+(p+(m-p)*r).toFixed(4))})}function _e(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,u=r?{...Xe[r],...t}:t,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:p="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:g="linear",trigger:M={},stagger:F=0,direction:S="forward",once:J=false,debug:Ee=false,axis:H="y",scrollContainer:ee,autoReverse:te=false,delay:re=0,strokeColor:x,strokeWidth:R,fillOpacity:D,waypoints:h,velocityScale:C=false,threshold:W=0,rootMargin:ne="0px",repeat:z=0,repeatDelay:ce=0,morphTo:T,clip:U,autoplay:K=false,duration:oe=1e3,native:_=true,onProgress:d,onStart:A,onComplete:b,onEnter:$,onLeave:ge,onEnterBack:Ae,onLeaveBack:Le}=u,ye=U===true?"left":typeof U=="string"?U:false,he=typeof g=="function"?g:pe[g]??pe.linear,Me=de(M.start??"top bottom"),Fe=de(M.end??"bottom top"),G=typeof ee=="string"?document.querySelector(ee):ee??null,ue=Array.isArray(x)?x[0]:null,V=Array.isArray(x)?x[1]:typeof x=="string"?x:null,B=Array.isArray(R)?R[0]:null,s=Array.isArray(R)?R[1]:typeof R=="number"?R:null,f=Array.isArray(D)?D[0]:null,L=Array.isArray(D)?D[1]:typeof D=="number"?D:null;function j(o){let a=o*100;switch(ye){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 E=ye?[]:Array.from(e.querySelectorAll(p)),I=[],P=[],Q=0,se=0,Y=false,me=false,X=0,He=false,be=-1,Re=-1,ie=false,Ce=0,Se=0,xe,Ge=null,Te=new Set,qe=-1,Ke=performance.now(),Pe=NaN;function Ne(){return G?H==="x"?G.scrollLeft:G.scrollTop:H==="x"?window.scrollX:window.scrollY}function Qe(){return G?H==="x"?G.clientWidth:G.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function et(){let o=e.getBoundingClientRect(),a,w,q;if(G){let le=G.getBoundingClientRect();a=H==="x"?o.left-le.left+G.scrollLeft:o.top-le.top+G.scrollTop,w=H==="x"?o.width:o.height,q=Ne();}else a=H==="x"?o.left:o.top,w=H==="x"?o.width:o.height,q=Ne();let ae=ve({top:a,height:w},q,Qe(),Me,Fe);Q=ae.tStart,se=ae.tEnd,Ee&&process.env.NODE_ENV!=="production"&&(Ge?.remove(),Ge=At(Q,se,H));}function ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),ye){let w=a==="reverse"?1-o:o;e.style.clipPath=j(w);return}E.forEach((w,q)=>{w.style.strokeDashoffset=a==="reverse"?`${I[q]*o}`:`${I[q]*(1-o)}`,c&&(w.style.opacity=a==="reverse"?`${1-o}`:`${o}`),ue&&V?w.style.stroke=Oe(ue,V,o):V&&(w.style.stroke=V),B!==null&&s!==null?w.style.strokeWidth=`${B+(s-B)*o}`:s!==null&&(w.style.strokeWidth=`${s}`),f!==null&&L!==null?w.style.fillOpacity=`${f+(L-f)*o}`:L!==null&&(w.style.fillOpacity=`${L}`),T&&w.tagName.toLowerCase()==="path"&&P[q]&&w.setAttribute("d",Je(P[q],T,o));});}function ze(){if(e.style.setProperty("--scroll-draw-progress","0"),ye){e.style.clipPath=j(0);return}E.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${I[a]}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),B!==null&&(o.style.strokeWidth=`${B}`),f!==null&&(o.style.fillOpacity=`${f}`),T&&o.tagName.toLowerCase()==="path"&&P[a]&&o.setAttribute("d",P[a]);});}if(E.forEach(o=>{Tt(o);let a=We(o);I.push(a),o.tagName.toLowerCase()==="path"?P.push(o.getAttribute("d")??""):P.push(""),i?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),V&&(o.style.stroke=V),s!==null&&(o.style.strokeWidth=`${s}`),L!==null&&(o.style.fillOpacity=`${L}`),T&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",T)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),B!==null&&(o.style.strokeWidth=`${B}`),f!==null&&(o.style.fillOpacity=`${f}`));}),ye){if(i)return e.style.clipPath=j(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=j(0);}else if(i)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(_===false||!xt()||!E.length||typeof g!="string"||!(g in at)||ye||H!=="y"||G||m!==1||F!==0||J||te||C!==false||T||h||z||re>0||d||A||b||$||ge||Ae||Le||x!=null||R!=null||D!=null||(M.start??"top bottom").trim()!=="top bottom"||(M.end??"bottom top").trim()!=="bottom top")}function wt(){let o=`svg-scroll-draw-${++Et}`,a=S==="reverse"?"0":"var(--ssd-len)",w=S==="reverse"?"var(--ssd-len)":"0",q=`stroke-dashoffset:${a};`,ae=`stroke-dashoffset:${w};`;c&&(q+=`opacity:${S==="reverse"?1:0};`,ae+=`opacity:${S==="reverse"?0:1};`);let le=document.createElement("style");le.setAttribute("data-svg-scroll-draw",""),le.textContent=`@keyframes ${o}{from{${q}}to{${ae}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${at[g]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(le);function fe(l,v){l.style.setProperty("--ssd-len",String(I[v])),l.style.strokeDasharray=`${I[v]}`,l.style.strokeDashoffset="",l.style.opacity="",l.style.animationPlayState="",l.classList.add(o);}E.forEach(fe);let y=false,k=-1;function O(){if(k>=0)return k;let l=e.getBoundingClientRect(),{tStart:v,tEnd:N}=ve({top:l.top,height:l.height},Ne(),Qe(),Me,Fe);return he(Z(Ne(),v,N,m))}return {destroy(){E.forEach(l=>{l.classList.remove(o),l.style.removeProperty("--ssd-len"),l.style.animationPlayState="";}),le.remove();},replay(){y=false,k=-1,E.forEach(fe);},pause(){y=true,E.forEach(l=>{l.style.animationPlayState="paused";});},resume(){y&&(y=false,E.forEach(l=>{l.style.animationPlayState="running";}));},seek(l){let v=Math.min(1,Math.max(0,l));k=v,y=true,E.forEach((N,$e)=>{N.classList.remove(o),N.style.strokeDashoffset=S==="reverse"?`${I[$e]*v}`:`${I[$e]*(1-v)}`,c&&(N.style.opacity=S==="reverse"?`${1-v}`:`${v}`);});},getProgress(){return O()}}}if(bt())return wt();function vt(){let o=Math.max(1,oe),a=0,w=0;function q(O){let l=true;if(ye){let v=Math.min(1,Math.max(0,O/o)),N=he(v);Ce=N,e.style.setProperty("--scroll-draw-progress",String(N)),e.style.clipPath=j(S==="reverse"?1-N:N),d?.(N),v<1&&(l=false);}else E.forEach((v,N)=>{let $e=N*F*o,ke=Math.min(1,Math.max(0,(O-$e)/o)),we=he(ke);v.style.strokeDashoffset=S==="reverse"?`${I[N]*we}`:`${I[N]*(1-we)}`,c&&(v.style.opacity=S==="reverse"?`${1-we}`:`${we}`),ue&&V?v.style.stroke=Oe(ue,V,we):V&&(v.style.stroke=V),B!==null&&s!==null?v.style.strokeWidth=`${B+(s-B)*we}`:s!==null&&(v.style.strokeWidth=`${s}`),f!==null&&L!==null?v.style.fillOpacity=`${f+(L-f)*we}`:L!==null&&(v.style.fillOpacity=`${L}`),T&&v.tagName.toLowerCase()==="path"&&P[N]&&v.setAttribute("d",Je(P[N],T,we)),N===0&&(d?.(we),e.style.setProperty("--scroll-draw-progress",String(we))),ke<1&&(l=false);});if(h){let v=Math.min(1,Math.max(0,O/o)),N=he(v);for(let $e in h){let ke=parseFloat($e);N>=ke&&!Te.has(ke)&&(Te.add(ke),h[$e]?.());}}return l}function ae(O){if(ie)return;let l=O-a;me||(me=true,A?.());let v=q(l);if(v&&!Y){Y=true,q(o*(1+Math.max(0,E.length-1)*F)),b?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{a=performance.now(),me=false,Y=false,Te.clear(),ze(),X=requestAnimationFrame(ae);},ce));return}v||(X=requestAnimationFrame(ae));}function le(){cancelAnimationFrame(X),clearTimeout(xe),a=performance.now(),w=0,ie=false,me=false,Y=false,Se=0,Te.clear(),ze(),X=requestAnimationFrame(ae);}let fe=new IntersectionObserver(O=>{O.forEach(l=>{l.isIntersecting&&!(J&&Y)?le():!l.isIntersecting&&!J&&!Y&&(cancelAnimationFrame(X),clearTimeout(xe),a=null);});},{root:G??null,threshold:W,rootMargin:ne}),y;function k(){clearTimeout(y),y=setTimeout(()=>{E.forEach((O,l)=>{I[l]=We(O),O.style.strokeDasharray=`${I[l]}`;});},150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),re>0?setTimeout(()=>fe.observe(e),re):fe.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(xe),fe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(y);},replay(){Se=0,le();},pause(){ie||(ie=true,w=performance.now()-a,cancelAnimationFrame(X));},resume(){ie&&(ie=false,a=performance.now()-w,X=requestAnimationFrame(ae));},seek(O){let l=Math.min(1,Math.max(0,O));Ce=l,ie=true,w=l*o,a=performance.now()-w,cancelAnimationFrame(X),q(w);},getProgress(){return Ce}}}if(K)return vt();et();function Ve(){if(!He||ie)return;let o=performance.now(),a=Ne(),w=m;if(C!==false){let y=o-Ke,k=y>0?Math.abs(a-(qe<0?a:qe))/y:0;w=m*Math.max(.2,1+k*(typeof C=="number"?C:1)*.04);}qe=a,Ke=o;let q=te?Re===-1||a>=Re?"forward":"reverse":S;Re=a;let ae=se-Q,le=true,fe=ae===0?0:(a-Q)/ae;if(isNaN(Pe)||(Pe<=0&&fe>0?$?.():Pe>0&&fe<=0&&Le?.(),Pe<1&&fe>=1?ge?.():Pe>=1&&fe<1&&Ae?.()),Pe=fe,ye){let y=he(Z(a,Q,se,w));J&&!te&&(be=Math.max(be,y),y=be),Ce=y,e.style.setProperty("--scroll-draw-progress",String(y));let k=q==="reverse"?1-y:y;e.style.clipPath=j(k),d?.(y),!me&&Z(a,Q,se,w)>0&&(me=true,A?.()),y>=1&&!Y?(Y=true,b?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{be=-1,me=false,Y=false,e.style.clipPath=j(0);},ce))):y<1&&!J&&(Y=false),X=requestAnimationFrame(Ve);return}if(E.forEach((y,k)=>{let O=k*F*ae,l=he(Z(a,Q+O,se+O,w));J&&!te&&(be=Math.max(be,l),l=be),Ce=l,y.style.strokeDashoffset=q==="reverse"?`${I[k]*l}`:`${I[k]*(1-l)}`,c&&(y.style.opacity=q==="reverse"?`${1-l}`:`${l}`),ue&&V?y.style.stroke=Oe(ue,V,l):V&&(y.style.stroke=V),B!==null&&s!==null?y.style.strokeWidth=`${B+(s-B)*l}`:s!==null&&(y.style.strokeWidth=`${s}`),f!==null&&L!==null?y.style.fillOpacity=`${f+(L-f)*l}`:L!==null&&(y.style.fillOpacity=`${L}`),T&&y.tagName.toLowerCase()==="path"&&P[k]&&y.setAttribute("d",Je(P[k],T,l)),k===0&&(d?.(l),e.style.setProperty("--scroll-draw-progress",String(l))),l<1&&(le=false);}),h){let y=he(Z(a,Q,se,w));for(let k in h){let O=parseFloat(k);y>=O&&!Te.has(O)&&(Te.add(O),h[k]?.());}}!me&&Z(a,Q,se,w)>0&&(me=true,A?.()),le&&!Y?(Y=true,b?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{be=-1,me=false,Y=false,Te.clear(),ze();},ce))):!le&&!J&&(Y=false),X=requestAnimationFrame(Ve);}let je=new IntersectionObserver(o=>{o.forEach(a=>{He=a.isIntersecting,He&&!ie?X=requestAnimationFrame(Ve):cancelAnimationFrame(X);});},{root:G??null,threshold:W,rootMargin:ne}),Ye;function Be(){clearTimeout(Ye),Ye=setTimeout(()=>{E.forEach((o,a)=>{I[a]=We(o),o.style.strokeDasharray=`${I[a]}`;}),et();},150);}return window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be),re>0?setTimeout(()=>je.observe(e),re):je.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(xe),je.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ye),Ge?.remove();},replay(){be=-1,Re=-1,qe=-1,me=false,Y=false,Se=0,ie=false,Te.clear(),clearTimeout(xe),ze();},pause(){ie=true,cancelAnimationFrame(X);},resume(){ie&&(ie=false,He&&(X=requestAnimationFrame(Ve)));},seek(o){let a=Math.min(1,Math.max(0,o));Ce=a,be=a,ie=true,cancelAnimationFrame(X),ht(a,S);},getProgress(){return Ce}}}var lt=new Map;function De(e,n){lt.set(e,n);}function Ie(e){lt.delete(e);}function Mt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let u=[],i=[],p=t[2].trim();if(p)for(let m of p.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"");}n.push({fn:t[1],nums:u,units:i});}return n}function Ct(e,n,r){let t=ct(e),u=ct(n);return t.length===0||t.length!==u.length?r<1?e:n:t.map((i,p)=>{let m=u[p];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((c,g)=>`${c}${i.units[g]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,g)=>`${c}${m.units[g]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,g)=>`${c+(m.nums[g]-c)*r}${i.units[g]}`).join(", ")})`}).join(" ")}function ut(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),u=String(n);if(Mt(t))return Oe(t,u,r);if(t.includes("("))return Ct(t,u,r);let i=t.match(/^([-+]?[\d.]+)(.*)$/),p=u.match(/^([-+]?[\d.]+)(.*)$/);if(i&&p){let m=parseFloat(i[1]),c=parseFloat(p[1]);return `${m+(c-m)*r}${i[2]||p[2]}`}return r<1?t:u}function $t(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var mt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Lt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Pt=0;function kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function pt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:u={},easing:i="ease-out",speed:p=1,once:m=false,axis:c="y",scrollContainer:g,native:M=true,velocityScale:F=false,onProgress:S,onComplete:J,onEnter:Ee,onLeave:H,onEnterBack:ee,onLeaveBack:te}=n,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof i=="function"?i:pe[i]??pe["ease-out"],R=de(u.start??"top bottom"),D=de(u.end??"bottom top"),h=typeof g=="string"?document.querySelector(g):g??null,C=Object.entries(t).map(([s,f])=>({prop:$t(s),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function W(){let s=window.getComputedStyle(e);for(let f of C)f.from===""&&(f.from=s.getPropertyValue(f.prop).trim()||"0");}function ne(){for(let s of C)e.style.setProperty(s.prop,String(s.to));}if(re)return ne(),J?.(),r;W();function z(){if(!M||!kt()||typeof i!="string"||!(i in mt)||c!=="y"||h||m||p!==1||S||J||Ee||H||ee||te||F!==false||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let s of C)if(!Lt.has(s.prop))return false;return true}function ce(){let s=`ssd-a-${++Pt}`,f=C.map(P=>`${P.prop}:${P.from}`).join(";"),L=C.map(P=>`${P.prop}:${P.to}`).join(";"),j=document.createElement("style");j.setAttribute("data-ssd-animate",""),j.textContent=`@keyframes ${s}{from{${f}}to{${L}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${mt[i]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(j),e.classList.add(s);let E=()=>c==="x"?window.scrollX:window.scrollY,I=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(s),j.remove();},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(P){let Q=Math.min(1,Math.max(0,P));e.classList.remove(s);for(let se of C)e.style.setProperty(se.prop,ut(se.from,se.to,Q));},getProgress(){let P=e.getBoundingClientRect(),Q=E(),se=I(),{tStart:Y,tEnd:me}=ve({top:P.top,height:P.height},Q,se,R,D);return x(Z(Q,Y,me,p))}}}if(z())return ce();let T=0,U=0,K=0,oe=false,_=false,d=-1,A=0,b=false,$=NaN,ge=-1,Ae=0,Le=()=>h?c==="x"?h.scrollLeft:h.scrollTop:c==="x"?window.scrollX:window.scrollY,ye=()=>h?c==="x"?h.clientWidth:h.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function he(){let s=e.getBoundingClientRect(),f,L;if(h){let E=h.getBoundingClientRect();f=c==="x"?s.left-E.left+h.scrollLeft:s.top-E.top+h.scrollTop,L=c==="x"?s.width:s.height;}else f=c==="x"?s.left:s.top,L=c==="x"?s.width:s.height;let j=ve({top:f,height:L},Le(),ye(),R,D);T=j.tStart,U=j.tEnd;}function Me(s){e.style.setProperty("--scroll-draw-progress",String(s));for(let f of C)e.style.setProperty(f.prop,ut(f.from,f.to,s));S?.(s);}function Fe(s){if(isNaN($)){$=s;return}$<=0&&s>0?Ee?.():$>0&&s<=0&&te?.(),$<1&&s>=1?H?.():$>=1&&s<1&&ee?.(),$=s;}function G(){if(!oe||_)return;let s=performance.now(),f=Le(),L=p;if(F!==false){let I=s-Ae,P=I>0?Math.abs(f-(ge<0?f:ge))/I:0;L=p*Math.max(.2,1+P*(typeof F=="number"?F:1)*.04);}ge=f,Ae=s;let j=U===T?0:(f-T)/(U-T);Fe(j);let E=x(Z(f,T,U,L));m&&(d=Math.max(d,E),E=d),A=E,Me(E),E>=1&&!b?(b=true,J?.()):E<1&&!m&&(b=false),K=requestAnimationFrame(G);}he();{let s=x(Z(Le(),T,U,p));m&&s>0&&(d=s),A=s,Me(s);}let ue=new IntersectionObserver(s=>{s.forEach(f=>{oe=f.isIntersecting,oe&&!_?K=requestAnimationFrame(G):cancelAnimationFrame(K);});},{root:h??null}),V;function B(){clearTimeout(V),V=setTimeout(he,150);}return window.addEventListener("resize",B),window.addEventListener("orientationchange",B),ue.observe(e),De(e,{type:"animate",getProgress:()=>A,getTrigger:()=>({tStart:T,tEnd:U})}),{destroy(){cancelAnimationFrame(K),ue.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("orientationchange",B),clearTimeout(V),Ie(e);},replay(){d=-1,b=false,A=0,_=false,Me(0);},pause(){_=true,cancelAnimationFrame(K);},resume(){_&&(_=false,oe&&(K=requestAnimationFrame(G)));},seek(s){let f=Math.min(1,Math.max(0,s));A=f,d=f,_=true,cancelAnimationFrame(K),Me(f);},getProgress(){return A}}}var Ue={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ze(e,n){if(typeof window>"u")return Ue;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Ue;let t=r,{from:u=0,to:i,format:p,easing:m="ease-out",trigger:c={},once:g=true,decimals:M,onComplete:F}=n,S=M!==void 0?d=>d.toFixed(M):p??(d=>String(Math.round(d))),J=typeof m=="function"?m:pe[m]??pe["ease-out"],Ee=de(c.start??"top 80%"),H=de(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(i),F?.(),Ue;t.textContent=S(u);let te=0,re=0,x=0,R=false,D=false,h=-1,C=0,W=false,ne=()=>window.scrollY,z=()=>window.innerHeight;function ce(){let d=t.getBoundingClientRect(),A=ve({top:d.top,height:d.height},ne(),z(),Ee,H);te=A.tStart,re=A.tEnd;}function T(d){t.textContent=S(u+(i-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function U(){if(!R||D)return;let d=J(Z(ne(),te,re,1));g&&(h=Math.max(h,d),d=h),C=d,T(d),d>=1&&!W?(W=true,F?.()):d<1&&!g&&(W=false),x=requestAnimationFrame(U);}ce();{let d=J(Z(ne(),te,re,1));g&&d>0&&(h=d),C=d,T(d);}let K=new IntersectionObserver(d=>{d.forEach(A=>{R=A.isIntersecting,R&&!D?x=requestAnimationFrame(U):cancelAnimationFrame(x);});}),oe;function _(){clearTimeout(oe),oe=setTimeout(ce,150);}return window.addEventListener("resize",_),window.addEventListener("orientationchange",_),K.observe(t),De(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:te,tEnd:re})}),{destroy(){cancelAnimationFrame(x),K.disconnect(),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),clearTimeout(oe),Ie(t);},replay(){h=-1,W=false,C=0,D=false,T(0);},pause(){D=true,cancelAnimationFrame(x);},resume(){D&&(D=false,R&&(x=requestAnimationFrame(U)));},seek(d){let A=Math.min(1,Math.max(0,d));C=A,h=A,D=true,cancelAnimationFrame(x),T(A);},getProgress(){return C}}}function gt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function Ot(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function ft(e){let n=gt(e),r=new Map;for(let i of n){let p=i.offsetTop;r.has(p)||r.set(p,[]),r.get(p).push(i);}let t=[],u=Array.from(r.keys()).sort((i,p)=>i-p);for(let i of u){let p=r.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block";for(let c of p)m.appendChild(c);t.push(m);}e.textContent="";for(let i of t)e.appendChild(i),e.appendChild(document.createTextNode(" "));return t}function Dt(e,n,r,t){if(r<=1||t===0)return e;let u=(r-1)*t,i=n*t,p=i+(1-u);return p<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(p-i)))}function It(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yt(e,n={}){if(typeof window>"u")return dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),dt;let t=r,{split:u="words",stagger:i=.04,easing:p="ease-out",from:m={opacity:0,y:24},trigger:c={},once:g=true,onComplete:M}=n,F=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof p=="function"?p:pe[p]??pe["ease-out"],J=de(c.start??"top 85%"),Ee=de(c.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=Ot(t):u==="lines"?ee=ft(t):ee=gt(t);let te=ee.length;function re(b,$){m?.opacity!==void 0&&(b.style.opacity=String(m.opacity+(1-m.opacity)*$));let ge=It($,m);ge&&(b.style.transform=ge);}function x(b){t.style.setProperty("--scroll-draw-progress",String(b)),ee.forEach(($,ge)=>{let Ae=S(Dt(b,ge,te,i));re($,Ae);});}if(F)return x(1),M?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let R=0,D=0,h=0,C=false,W=false,ne=-1,z=0,ce=false,T=()=>window.scrollY,U=()=>window.innerHeight;function K(){let b=t.getBoundingClientRect(),$=ve({top:b.top,height:b.height},T(),U(),J,Ee);R=$.tStart,D=$.tEnd;}function oe(){if(!C||W)return;let b=Z(T(),R,D,1);g&&(ne=Math.max(ne,b),b=ne),z=b,x(b),b>=1&&!ce?(ce=true,M?.()):b<1&&!g&&(ce=false),h=requestAnimationFrame(oe);}K();let _=new IntersectionObserver(b=>{b.forEach($=>{C=$.isIntersecting,C&&!W?h=requestAnimationFrame(oe):cancelAnimationFrame(h);});}),d;function A(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let b=z;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),ee=ft(t),x(b);}K();},150);}return window.addEventListener("resize",A),window.addEventListener("orientationchange",A),_.observe(t),De(t,{type:"text",getProgress:()=>z,getTrigger:()=>({tStart:R,tEnd:D})}),{destroy(){cancelAnimationFrame(h),_.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ie(t);},replay(){ne=-1,ce=false,z=0,W=false,x(0);},pause(){W=true,cancelAnimationFrame(h);},resume(){W&&(W=false,C&&(h=requestAnimationFrame(oe)));},seek(b){let $=Math.min(1,Math.max(0,b));z=$,ne=$,W=true,cancelAnimationFrame(h),x($);},getProgress(){return z}}}function Nt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?_e(t,n):(console.warn("[svg-scroll-draw] Container not found:",e),r)}function Ft(e=document){return Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return _e(n,r)})}function Ht(e=document){return Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return pt(n,r)})}function Rt(e=document){return Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(process.env.NODE_ENV!=="production"&&console.warn('[svg-scroll-draw] initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Ze(n,r)})}function qt(e=document){return Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return yt(n,r)})}function br(e=document){return {draw:Ft(e),animate:Ht(e),counter:Rt(e),text:qt(e)}}exports.initAll=br;exports.initScrollAnimate=Ht;exports.initScrollCounter=Rt;exports.initScrollDraw=Ft;exports.initScrollText=qt;exports.scrollDraw=Nt;
1
+ 'use strict';function Ht({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 S=Math.pow(l,d);c.push(S),s+=S;}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 S=0;S<r;S++)if(d<=u[S+1]){let _=(d-u[S])/(u[S+1]-u[S]);if(S===0)return _*(2-_);let x=1-Math.pow(t,S);return x+(1-x)*(2*_-1)*(2*_-1)}return 1}}function _t({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 ue={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ht(),elastic:_t()};function Se(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 yt(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 ht(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 zt(e,n,r){return Math.min(r,Math.max(n,e))}function Z(e,n,r,t){return r===n?0:zt((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 Le(e,n,r,t,l){let s=yt(e.top,e.height,n,t.element)-ht(t.viewport,r),c=yt(e.top,e.height,n,l.element)-ht(l.viewport,r);return {tStart:s,tEnd:c}}function bt(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 qe(e,n,r){let t=bt(e),l=bt(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 wt={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 K(e,...n){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var qt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Vt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function Wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Bt(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 Ke(e){switch(e){case "linear":return "linear";case "ease-in":return qt;case "ease-out":return Vt;case "ease-in-out":return Wt()?Bt(ue["ease-in-out"]):null;default:return null}}var vt=Symbol.for("svg-scroll-draw.registry");function Et(){let e=globalThis;return e[vt]||(e[vt]=new Map)}function Oe(e,n){Et().set(e,n);}function Ie(e){Et().delete(e);}var Gt=0;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Ut(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?K("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Yt(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 xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Tt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Xt(e,n,r){if(!Ze)return;let t=(e.match(Tt)??[]).join("").toUpperCase(),l=(n.match(Tt)??[]).join("").toUpperCase(),s=(e.match(xt)??[]).length,c=(n.match(xt)??[]).length;if(t!==l){K(`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&&K(`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 it(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 et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...wt[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:S={},stagger:_=0,direction:x="forward",once:ne=false,debug:ke=false,axis:j="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:T,strokeWidth:W,fillOpacity:L,waypoints:A,velocityScale:F=false,threshold:B=0,rootMargin:P="0px",repeat:M=0,repeatDelay:me=0,morphTo:D,clip:de,autoplay:ve=false,duration:ge=1e3,native:Ee=true,onProgress:g,onStart:v,onComplete:y,onEnter:$,onLeave:ye,onEnterBack:he,onLeaveBack:Ce}=l,te=de===true?"left":typeof de=="string"?de:false,be=typeof d=="function"?d:ue[d]??ue.linear,Ae=Se(S.start??"top bottom"),He=Se(S.end??"bottom top"),fe=typeof oe=="string"?document.querySelector(oe):oe??null,pe=Array.isArray(T)?T[0]:null,Y=Array.isArray(T)?T[1]:typeof T=="string"?T:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Me(o){let a=o*100;switch(te){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 k=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,O=false,R=false,N=0,xe=false,ae=-1,U=-1,q=false,le=0,Pe=0,Re,tt=null;function lt(){tt?.destroy(),tt=null;}let Fe=new Set,ct=NaN,Ne=true,Ge=-1,ut=performance.now(),_e=NaN;function rt(){return fe?j==="x"?fe.scrollLeft:fe.scrollTop:j==="x"?window.scrollX:window.scrollY}function mt(){return fe?j==="x"?fe.clientWidth:fe.clientHeight:j==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Qe(e,fe,j);return Le(o,o.scroll,mt(),Ae,He)}function pt(){(({tStart:f,tEnd:ie}=ft())),ke&&Ze&&(lt(),tt=Yt(f,ie,j));}function nt(o,a=ft){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function kt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Me(b);return}k.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&Y?b.style.stroke=qe(pe,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",it(i[J],D,o));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Me(0);return}k.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=x==="reverse"?"0":`${E[a]}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(k.forEach(o=>{Ut(o);let a=ze(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Xt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?"0":`${a}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof d=="string"?Ke(d):null;function Rt(){return !(Ee===false||!jt()||!k.length||!dt||te||j!=="y"||fe||u!==1||_!==0||ne||se||F!==false||D||A||M||ee>0||g||v||y||$||ye||he||Ce||T!=null||W!=null||L!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Ft(){let o=++Gt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=x==="reverse"?"0":"var(--ssd-len)",$e=x==="reverse"?"var(--ssd-len)":"0",Te=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(Te+=`opacity:${x==="reverse"?1:0};`,w+=`opacity:${x==="reverse"?0:1};`);let C=document.createElement("style");C.setAttribute("data-svg-scroll-draw",""),C.textContent=`@keyframes ${a}{from{${Te}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(C),e.classList.add(b);function Q(p,V){p.style.setProperty("--ssd-len",String(E[V])),p.style.strokeDasharray=`${E[V]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}k.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:V,tEnd:we}=Le({top:p.top,height:p.height},rt(),mt(),Ae,He);return be(Z(rt(),V,we,u))}return {destroy(){e.classList.remove(b),k.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),C.remove();},replay(){h=false,I=-1,k.forEach(Q);},pause(){h=true,k.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,k.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let V=Math.min(1,Math.max(0,p));I=V,h=true,k.forEach((we,ce)=>{we.classList.remove(a),we.style.strokeDashoffset=x==="reverse"?`${E[ce]*V}`:`${E[ce]*(1-V)}`,m&&(we.style.opacity=x==="reverse"?`${1-V}`:`${V}`);});},getProgress(){return H()},refresh(){k.forEach((p,V)=>{E[V]=ze(p),p.style.setProperty("--ssd-len",String(E[V])),p.style.strokeDasharray=`${E[V]}`;});}}}if(Rt())return nt(Ft());function Nt(){let o=Math.max(1,ge),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=be(H);le=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Me(x==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else k.forEach((H,p)=>{let V=p*_*o,we=Math.min(1,Math.max(0,(h-V)/o)),ce=be(we);H.style.strokeDashoffset=x==="reverse"?`${E[p]*ce}`:`${E[p]*(1-ce)}`,m&&(H.style.opacity=x==="reverse"?`${1-ce}`:`${ce}`),pe&&Y?H.style.stroke=qe(pe,Y,ce):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ce}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ce}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",it(i[p],D,ce)),p===0&&(le=ce,g?.(ce),e.style.setProperty("--scroll-draw-progress",String(ce))),we<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=be(H);for(let V in A){let we=parseFloat(V);p>=we&&!Fe.has(we)&&(Fe.add(we),A[V]?.());}}return I}function $e(h){if(q)return;let I=h-a;R||(R=true,v?.());let H=De(I);if(H&&!O){O=true,De(o*(1+Math.max(0,k.length-1)*_)),y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{a=performance.now(),R=false,O=false,Fe.clear(),je(),N=requestAnimationFrame($e);},me));return}H||(N=requestAnimationFrame($e));}function Te(){cancelAnimationFrame(N),clearTimeout(Re),a=performance.now(),b=0,q=false,R=false,O=false,Pe=0,J=true,le=0,Fe.clear(),je(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&O)?Te():!I.isIntersecting&&!ne&&!O&&(cancelAnimationFrame(N),clearTimeout(Re),J=false);});},{root:fe??null,threshold:B,rootMargin:P}),C;function Q(){clearTimeout(C),C=setTimeout(()=>{k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Re),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(C);},replay(){Pe=0,Te();},pause(){q||!J||(q=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){q&&(q=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));le=I,q=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return le},refresh(){clearTimeout(C),k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(ve)return nt(Nt());pt();function Ue(){if(!xe||q)return;let o=performance.now(),a=rt();if(!Ne&&F===false&&a===ct){N=requestAnimationFrame(Ue);return}Ne=false,ct=a;let b=u;if(F!==false){let w=o-ut,C=w>0?Math.abs(a-(Ge<0?a:Ge))/w:0;b=u*Math.max(.2,1+C*(typeof F=="number"?F:1)*.04);}Ge=a,ut=o;let J=se?U===-1||a>=U?"forward":"reverse":x;U=a;let De=ie-f,$e=true,Te=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Te>0?$?.():_e>0&&Te<=0&&Ce?.(),_e<1&&Te>=1?ye?.():_e>=1&&Te<1&&he?.()),_e=Te,te){let w=be(Z(a,f,ie,b));ne&&!se&&(ae=Math.max(ae,w),w=ae),le=w,e.style.setProperty("--scroll-draw-progress",String(w));let C=J==="reverse"?1-w:w;e.style.clipPath=Me(C),g?.(w),!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),w>=1&&!O?(O=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{ae=-1,R=false,O=false,e.style.clipPath=Me(0);},me))):w<1&&!ne&&(O=false),N=requestAnimationFrame(Ue);return}if(k.forEach((w,C)=>{let Q=C*_*De,h=be(Z(a,f+Q,ie+Q,b));ne&&!se&&(ae=Math.max(ae,h),h=ae),le=h,w.style.strokeDashoffset=J==="reverse"?`${E[C]*h}`:`${E[C]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),pe&&Y?w.style.stroke=qe(pe,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[C]&&w.setAttribute("d",it(i[C],D,h)),C===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=be(Z(a,f,ie,b));for(let C in A){let Q=parseFloat(C);w>=Q&&!Fe.has(Q)&&(Fe.add(Q),A[C]?.());}}!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),$e&&!O?(O=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{ae=-1,R=false,O=false,Fe.clear(),je(),Ne=true;},me))):!$e&&!ne&&(O=false),N=requestAnimationFrame(Ue);}let ot=false;function Ye(){ot||(ot=true,N=requestAnimationFrame(function(){Ue();}));}function Xe(){ot=false,cancelAnimationFrame(N);}let st=new IntersectionObserver(o=>{o.forEach(a=>{xe=a.isIntersecting,xe&&!q?(Ne=true,Ye()):Xe();});},{root:fe??null,threshold:B,rootMargin:P});function gt(){k.forEach((o,a)=>{E[a]=ze(o),o.style.strokeDasharray=`${E[a]}`;}),pt(),Ne=true;}let Je;function Ve(){clearTimeout(Je),Je=setTimeout(gt,150);}window.addEventListener("resize",Ve),window.addEventListener("orientationchange",Ve);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>Ve()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),ee>0?setTimeout(()=>st.observe(e),ee):st.observe(e),nt({destroy(){cancelAnimationFrame(N),clearTimeout(Re),Xe(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",Ve),window.removeEventListener("orientationchange",Ve),clearTimeout(Je),lt();},replay(){ae=-1,U=-1,Ge=-1,R=false,O=false,Pe=0,q=false,le=0,Fe.clear(),clearTimeout(Re),je(),Ne=true,xe&&Ye();},pause(){q=true,Xe();},resume(){q&&(q=false,Ne=true,xe&&Ye());},seek(o){let a=Math.min(1,Math.max(0,o));le=a,ae=a,q=true,Xe(),kt(a,x),Ne=true;},getProgress(){return le},refresh(){clearTimeout(Je),gt(),xe&&!q&&Ye();}},()=>({tStart:f,tEnd:ie}))}function Jt(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 Qt(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(Jt(t))return qe(t,l,r);if(t.includes("("))return Qt(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 Zt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),er=0,$t="--scroll-draw-progress";function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Lt(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:S=true,velocityScale:_=false,respectReducedMotion:x=true,triggerElement:ne,onProgress:ke,onComplete:j,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:T}=n,W=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:ue[s]??ue["ease-out"],A=Se(l.start??"top bottom"),F=Se(l.end??"bottom top"),B=ne??e,P=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:Zt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function me(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let de=new Map;for(let i of [...M.map(f=>f.prop),$t])de.set(i,e.style.getPropertyValue(i));function ve(){for(let[i,f]of de)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),j?.(),{...r,destroy:ve,getProgress:()=>1};me();let ge=typeof s=="string"?Ke(s):null;function Ee(){if(!S||!tr()||!ge||m!=="y"||P||B!==e||u||c!==1||ke||j||oe||se||ee||T||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!Kt.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++er}`,f=M.map(U=>`${U.prop}:${U.from}`).join(";"),ie=M.map(U=>`${U.prop}:${U.to}`).join(";"),O=document.createElement("style");O.setAttribute("data-ssd-animate",""),O.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(i);let R=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,xe=()=>{let U=e.getBoundingClientRect();return Le({top:U.top,height:U.height},R(),N(),A,F)};Oe(e,{type:"animate",getProgress:()=>ae.getProgress(),getTrigger:xe});let ae={destroy(){e.classList.remove(i),O.remove(),e.style.animationPlayState="",ve(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(U){let q=Math.min(1,Math.max(0,U));e.classList.remove(i);for(let le of M)e.style.setProperty(le.prop,Mt(le.from,le.to,q));},getProgress(){let{tStart:U,tEnd:q}=xe();return L(Z(R(),U,q,c))}};return ae}if(Ee())return g();let v=0,y=0,$=0,ye=false,he=false,Ce=-1,te=0,be=false,Ae=NaN,He=-1,fe=0,pe=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Qe(B,P,m),f=Le(i,i.scroll,Y(),A,F);v=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty($t,String(i));for(let f of M)e.style.setProperty(f.prop,Mt(f.from,f.to,i));ke?.(i);}function re(i){if(isNaN(Ae)){Ae=i;return}Ae<=0&&i>0?oe?.():Ae>0&&i<=0&&T?.(),Ae<1&&i>=1?se?.():Ae>=1&&i<1&&ee?.(),Ae=i;}function G(){if(!ye||he)return;let i=performance.now(),f=pe(),ie=c;if(_!==false){let N=i-fe,xe=N>0?Math.abs(f-(He<0?f:He))/N:0;ie=c*Math.max(.2,1+xe*(typeof _=="number"?_:1)*.04);}He=f,fe=i;let O=y===v?0:(f-v)/(y-v);re(O);let R=L(Z(f,v,y,ie));u&&(Ce=Math.max(Ce,R),R=Ce),te=R,z(R),R>=1&&!be?(be=true,j?.()):R<1&&!u&&(be=false),$=requestAnimationFrame(G);}X(),y===v&&K("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=L(Z(pe(),v,y,c));u&&i>0&&(Ce=i),te=i,z(i);}let Me=new IntersectionObserver(i=>{i.forEach(f=>{ye=f.isIntersecting,ye&&!he?$=requestAnimationFrame(G):cancelAnimationFrame($);});},{root:P??null}),k;function E(){clearTimeout(k),k=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Me.observe(e),Oe(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:v,tEnd:y})}),{destroy(){cancelAnimationFrame($),Me.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(k),ve(),Ie(e);},replay(){Ce=-1,be=false,te=0,he=false,z(0);},pause(){he=true,cancelAnimationFrame($);},resume(){he&&(he=false,ye&&($=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Ce=f,he=true,cancelAnimationFrame($),z(f);},getProgress(){return te}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ct(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:_}=n,x=S!==void 0?g=>g.toFixed(S):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:ue[u]??ue["ease-out"],ke=Se(m.start??"top 80%"),j=Se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=x(s),_?.(),at;let se=0,ee=0,T=0,W=false,L=false,A=-1,F=0,B=false,P=()=>window.scrollY,M=()=>window.innerHeight;function me(){let g=t.getBoundingClientRect(),v=Le({top:g.top,height:g.height},P(),M(),ke,j);se=v.tStart,ee=v.tEnd;}function D(g){t.textContent=x(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function de(){if(!W||L)return;let g=ne(Z(P(),se,ee,1));d&&(A=Math.max(A,g),g=A),F=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),T=requestAnimationFrame(de);}me();{let g=ne(Z(P(),se,ee,1));d&&g>0&&(A=g),F=g,D(g);}let ve=new IntersectionObserver(g=>{g.forEach(v=>{W=v.isIntersecting,W&&!L?T=requestAnimationFrame(de):cancelAnimationFrame(T);});}),ge;function Ee(){clearTimeout(ge),ge=setTimeout(me,150);}return window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee),ve.observe(t),Oe(t,{type:"counter",getProgress:()=>F,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(T),ve.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),clearTimeout(ge),Ie(t);},replay(){A=-1,B=false,F=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(T);},resume(){L&&(L=false,W&&(T=requestAnimationFrame(de)));},seek(g){let v=Math.min(1,Math.max(0,g));F=v,A=v,L=true,cancelAnimationFrame(T),D(v);},getProgress(){return F}}}function Ot(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 rr(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 Pt(e){let n=Ot(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 S=m.nextElementSibling;u.appendChild(m),d<c.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function nr(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 or(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n={}){if(typeof window>"u")return Dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),Dt;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:S}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof c=="function"?c:ue[c]??ue["ease-out"],ne=Se(m.start??"top 85%"),ke=Se(m.end??"top 40%"),j=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=rr(t):l==="lines"?oe=Pt(t):oe=Ot(t);let se=oe.length;function ee(y,$){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*$));let ye=or($,u);ye&&(y.style.transform=ye);}function T(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach(($,ye)=>{let he=x(nr(y,ye,se,s));ee($,he);});}if(_)return T(1),S?.(),{destroy(){t.innerHTML=j,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};T(0);let W=0,L=0,A=0,F=false,B=false,P=-1,M=0,me=false,D=()=>window.scrollY,de=()=>window.innerHeight;function ve(){let y=t.getBoundingClientRect(),$=Le({top:y.top,height:y.height},D(),de(),ne,ke);W=$.tStart,L=$.tEnd;}function ge(){if(!F||B)return;let y=Z(D(),W,L,1);d&&(P=Math.max(P,y),y=P),M=y,T(y),y>=1&&!me?(me=true,S?.()):y<1&&!d&&(me=false),A=requestAnimationFrame(ge);}ve();let Ee=new IntersectionObserver(y=>{y.forEach($=>{F=$.isIntersecting,F&&!B?A=requestAnimationFrame(ge):cancelAnimationFrame(A);});}),g;function v(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=j,t.setAttribute("aria-label",t.textContent??""),oe=Pt(t),T(y);}ve();},150);}return window.addEventListener("resize",v),window.addEventListener("orientationchange",v),Ee.observe(t),Oe(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:L})}),{destroy(){cancelAnimationFrame(A),Ee.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),clearTimeout(g),t.innerHTML=j,t.removeAttribute("aria-label"),Ie(t);},replay(){P=-1,me=false,M=0,B=false,T(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,F&&(A=requestAnimationFrame(ge)));},seek(y){let $=Math.min(1,Math.max(0,y));M=$,P=$,B=true,cancelAnimationFrame(A),T($);},getProgress(){return M}}}function sr(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?et(t,n):(K("Container not found:",e),r)}function Be(){return typeof document>"u"?null:document}function ir(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return et(n,r)}):[]}function ar(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return Lt(n,r)}):[]}function lr(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Ct(n,r)}):[]}function cr(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return It(n,r)}):[]}function Wr(e=Be()){return {draw:ir(e),animate:ar(e),counter:lr(e),text:cr(e)}}exports.initAll=Wr;exports.initScrollAnimate=ar;exports.initScrollCounter=lr;exports.initScrollDraw=ir;exports.initScrollText=cr;exports.scrollDraw=sr;
@@ -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
  declare function scrollDraw(target: string | Element, options?: ScrollDrawOptions): ScrollDrawInstance;
@@ -144,7 +159,7 @@ declare function scrollDraw(target: string | Element, options?: ScrollDrawOption
144
159
  * initScrollDraw();
145
160
  * </script>
146
161
  */
147
- declare function initScrollDraw(root?: Element | Document): ScrollDrawInstance[];
162
+ declare function initScrollDraw(root?: Element | Document | null): ScrollDrawInstance[];
148
163
  /**
149
164
  * Auto-initialises all [data-scroll-animate] elements on the page.
150
165
  * Options (including `props`) are read from the data-scroll-animate-options JSON attribute.
@@ -162,7 +177,7 @@ declare function initScrollDraw(root?: Element | Document): ScrollDrawInstance[]
162
177
  * initScrollAnimate();
163
178
  * </script>
164
179
  */
165
- declare function initScrollAnimate(root?: Element | Document): ScrollDrawInstance[];
180
+ declare function initScrollAnimate(root?: Element | Document | null): ScrollDrawInstance[];
166
181
  /**
167
182
  * Auto-initialises all [data-scroll-counter] elements on the page.
168
183
  * Options are read from the data-scroll-counter-options JSON attribute.
@@ -179,7 +194,7 @@ declare function initScrollAnimate(root?: Element | Document): ScrollDrawInstanc
179
194
  * initScrollCounter();
180
195
  * </script>
181
196
  */
182
- declare function initScrollCounter(root?: Element | Document): ScrollDrawInstance[];
197
+ declare function initScrollCounter(root?: Element | Document | null): ScrollDrawInstance[];
183
198
  /**
184
199
  * Auto-initialises all [data-scroll-text] elements on the page.
185
200
  * Options are read from the data-scroll-text-options JSON attribute.
@@ -197,7 +212,7 @@ declare function initScrollCounter(root?: Element | Document): ScrollDrawInstanc
197
212
  * initScrollText();
198
213
  * </script>
199
214
  */
200
- declare function initScrollText(root?: Element | Document): ScrollDrawInstance[];
215
+ declare function initScrollText(root?: Element | Document | null): ScrollDrawInstance[];
201
216
  /**
202
217
  * Convenience — runs all four init functions in one call.
203
218
  * Pass a root element to scope to a specific subtree.
@@ -208,7 +223,7 @@ declare function initScrollText(root?: Element | Document): ScrollDrawInstance[]
208
223
  * initAll(); // Initialises scrollDraw, scrollAnimate, scrollCounter, scrollText
209
224
  * </script>
210
225
  */
211
- declare function initAll(root?: Element | Document): {
226
+ declare function initAll(root?: Element | Document | null): {
212
227
  draw: ScrollDrawInstance[];
213
228
  animate: ScrollDrawInstance[];
214
229
  counter: ScrollDrawInstance[];
@@ -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
  declare function scrollDraw(target: string | Element, options?: ScrollDrawOptions): ScrollDrawInstance;
@@ -144,7 +159,7 @@ declare function scrollDraw(target: string | Element, options?: ScrollDrawOption
144
159
  * initScrollDraw();
145
160
  * </script>
146
161
  */
147
- declare function initScrollDraw(root?: Element | Document): ScrollDrawInstance[];
162
+ declare function initScrollDraw(root?: Element | Document | null): ScrollDrawInstance[];
148
163
  /**
149
164
  * Auto-initialises all [data-scroll-animate] elements on the page.
150
165
  * Options (including `props`) are read from the data-scroll-animate-options JSON attribute.
@@ -162,7 +177,7 @@ declare function initScrollDraw(root?: Element | Document): ScrollDrawInstance[]
162
177
  * initScrollAnimate();
163
178
  * </script>
164
179
  */
165
- declare function initScrollAnimate(root?: Element | Document): ScrollDrawInstance[];
180
+ declare function initScrollAnimate(root?: Element | Document | null): ScrollDrawInstance[];
166
181
  /**
167
182
  * Auto-initialises all [data-scroll-counter] elements on the page.
168
183
  * Options are read from the data-scroll-counter-options JSON attribute.
@@ -179,7 +194,7 @@ declare function initScrollAnimate(root?: Element | Document): ScrollDrawInstanc
179
194
  * initScrollCounter();
180
195
  * </script>
181
196
  */
182
- declare function initScrollCounter(root?: Element | Document): ScrollDrawInstance[];
197
+ declare function initScrollCounter(root?: Element | Document | null): ScrollDrawInstance[];
183
198
  /**
184
199
  * Auto-initialises all [data-scroll-text] elements on the page.
185
200
  * Options are read from the data-scroll-text-options JSON attribute.
@@ -197,7 +212,7 @@ declare function initScrollCounter(root?: Element | Document): ScrollDrawInstanc
197
212
  * initScrollText();
198
213
  * </script>
199
214
  */
200
- declare function initScrollText(root?: Element | Document): ScrollDrawInstance[];
215
+ declare function initScrollText(root?: Element | Document | null): ScrollDrawInstance[];
201
216
  /**
202
217
  * Convenience — runs all four init functions in one call.
203
218
  * Pass a root element to scope to a specific subtree.
@@ -208,7 +223,7 @@ declare function initScrollText(root?: Element | Document): ScrollDrawInstance[]
208
223
  * initAll(); // Initialises scrollDraw, scrollAnimate, scrollCounter, scrollText
209
224
  * </script>
210
225
  */
211
- declare function initAll(root?: Element | Document): {
226
+ declare function initAll(root?: Element | Document | null): {
212
227
  draw: ScrollDrawInstance[];
213
228
  animate: ScrollDrawInstance[];
214
229
  counter: ScrollDrawInstance[];
@@ -1,3 +1,3 @@
1
- function ot({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),i=0,p=[];for(let g=0;g<r;g++){let M=Math.pow(u,g);p.push(M),i+=M;}let m=[0],c=0;for(let g=0;g<r;g++)c+=p[g]/i,m.push(c);return g=>{if(g<=0)return 0;if(g>=1)return 1;for(let M=0;M<r;M++)if(g<=m[M+1]){let F=(g-m[M])/(m[M+1]-m[M]);if(M===0)return F*(2-F);let S=1-Math.pow(t,M);return S+(1-S)*(2*F-1)*(2*F-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 i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-u)*(2*Math.PI)/t)+1}var pe={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:ot(),elastic:st()};function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function tt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function rt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function We(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function St(e,n,r){return Math.min(r,Math.max(n,e))}function Z(e,n,r,t){return r===n?0:St((e-n)/(r-n)*t,0,1)}function ve(e,n,r,t,u){let i=tt(e.top,e.height,n,t.element)-rt(t.viewport,r),p=tt(e.top,e.height,n,u.element)-rt(u.viewport,r);return {tStart:i,tEnd:p}}function nt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Oe(e,n,r){let t=nt(e),u=nt(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 Xe={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};function it(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var at={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Et=0;function xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Tt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?it("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&it("Element has a fill \u2014 it may obscure the stroke animation.",e);}function At(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function u(){let i=r==="x"?window.scrollX:window.scrollY,p=e-i,m=n-i,c=r==="x";t.innerHTML=`
2
- <div style="position:absolute;${c?`left:${p}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${p}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:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",u,{passive:true}),u(),t}function Je(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let p=parseFloat(i),m=t[u++]??p;return String(+(p+(m-p)*r).toFixed(4))})}function _e(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,u=r?{...Xe[r],...t}:t,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:p="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:g="linear",trigger:M={},stagger:F=0,direction:S="forward",once:J=false,debug:Ee=false,axis:H="y",scrollContainer:ee,autoReverse:te=false,delay:re=0,strokeColor:x,strokeWidth:R,fillOpacity:D,waypoints:h,velocityScale:C=false,threshold:W=0,rootMargin:ne="0px",repeat:z=0,repeatDelay:ce=0,morphTo:T,clip:U,autoplay:K=false,duration:oe=1e3,native:_=true,onProgress:d,onStart:A,onComplete:b,onEnter:$,onLeave:ge,onEnterBack:Ae,onLeaveBack:Le}=u,ye=U===true?"left":typeof U=="string"?U:false,he=typeof g=="function"?g:pe[g]??pe.linear,Me=de(M.start??"top bottom"),Fe=de(M.end??"bottom top"),G=typeof ee=="string"?document.querySelector(ee):ee??null,ue=Array.isArray(x)?x[0]:null,V=Array.isArray(x)?x[1]:typeof x=="string"?x:null,B=Array.isArray(R)?R[0]:null,s=Array.isArray(R)?R[1]:typeof R=="number"?R:null,f=Array.isArray(D)?D[0]:null,L=Array.isArray(D)?D[1]:typeof D=="number"?D:null;function j(o){let a=o*100;switch(ye){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 E=ye?[]:Array.from(e.querySelectorAll(p)),I=[],P=[],Q=0,se=0,Y=false,me=false,X=0,He=false,be=-1,Re=-1,ie=false,Ce=0,Se=0,xe,Ge=null,Te=new Set,qe=-1,Ke=performance.now(),Pe=NaN;function Ne(){return G?H==="x"?G.scrollLeft:G.scrollTop:H==="x"?window.scrollX:window.scrollY}function Qe(){return G?H==="x"?G.clientWidth:G.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function et(){let o=e.getBoundingClientRect(),a,w,q;if(G){let le=G.getBoundingClientRect();a=H==="x"?o.left-le.left+G.scrollLeft:o.top-le.top+G.scrollTop,w=H==="x"?o.width:o.height,q=Ne();}else a=H==="x"?o.left:o.top,w=H==="x"?o.width:o.height,q=Ne();let ae=ve({top:a,height:w},q,Qe(),Me,Fe);Q=ae.tStart,se=ae.tEnd,Ee&&process.env.NODE_ENV!=="production"&&(Ge?.remove(),Ge=At(Q,se,H));}function ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),ye){let w=a==="reverse"?1-o:o;e.style.clipPath=j(w);return}E.forEach((w,q)=>{w.style.strokeDashoffset=a==="reverse"?`${I[q]*o}`:`${I[q]*(1-o)}`,c&&(w.style.opacity=a==="reverse"?`${1-o}`:`${o}`),ue&&V?w.style.stroke=Oe(ue,V,o):V&&(w.style.stroke=V),B!==null&&s!==null?w.style.strokeWidth=`${B+(s-B)*o}`:s!==null&&(w.style.strokeWidth=`${s}`),f!==null&&L!==null?w.style.fillOpacity=`${f+(L-f)*o}`:L!==null&&(w.style.fillOpacity=`${L}`),T&&w.tagName.toLowerCase()==="path"&&P[q]&&w.setAttribute("d",Je(P[q],T,o));});}function ze(){if(e.style.setProperty("--scroll-draw-progress","0"),ye){e.style.clipPath=j(0);return}E.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${I[a]}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),B!==null&&(o.style.strokeWidth=`${B}`),f!==null&&(o.style.fillOpacity=`${f}`),T&&o.tagName.toLowerCase()==="path"&&P[a]&&o.setAttribute("d",P[a]);});}if(E.forEach(o=>{Tt(o);let a=We(o);I.push(a),o.tagName.toLowerCase()==="path"?P.push(o.getAttribute("d")??""):P.push(""),i?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),V&&(o.style.stroke=V),s!==null&&(o.style.strokeWidth=`${s}`),L!==null&&(o.style.fillOpacity=`${L}`),T&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",T)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),B!==null&&(o.style.strokeWidth=`${B}`),f!==null&&(o.style.fillOpacity=`${f}`));}),ye){if(i)return e.style.clipPath=j(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=j(0);}else if(i)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function bt(){return !(_===false||!xt()||!E.length||typeof g!="string"||!(g in at)||ye||H!=="y"||G||m!==1||F!==0||J||te||C!==false||T||h||z||re>0||d||A||b||$||ge||Ae||Le||x!=null||R!=null||D!=null||(M.start??"top bottom").trim()!=="top bottom"||(M.end??"bottom top").trim()!=="bottom top")}function wt(){let o=`svg-scroll-draw-${++Et}`,a=S==="reverse"?"0":"var(--ssd-len)",w=S==="reverse"?"var(--ssd-len)":"0",q=`stroke-dashoffset:${a};`,ae=`stroke-dashoffset:${w};`;c&&(q+=`opacity:${S==="reverse"?1:0};`,ae+=`opacity:${S==="reverse"?0:1};`);let le=document.createElement("style");le.setAttribute("data-svg-scroll-draw",""),le.textContent=`@keyframes ${o}{from{${q}}to{${ae}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${at[g]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(le);function fe(l,v){l.style.setProperty("--ssd-len",String(I[v])),l.style.strokeDasharray=`${I[v]}`,l.style.strokeDashoffset="",l.style.opacity="",l.style.animationPlayState="",l.classList.add(o);}E.forEach(fe);let y=false,k=-1;function O(){if(k>=0)return k;let l=e.getBoundingClientRect(),{tStart:v,tEnd:N}=ve({top:l.top,height:l.height},Ne(),Qe(),Me,Fe);return he(Z(Ne(),v,N,m))}return {destroy(){E.forEach(l=>{l.classList.remove(o),l.style.removeProperty("--ssd-len"),l.style.animationPlayState="";}),le.remove();},replay(){y=false,k=-1,E.forEach(fe);},pause(){y=true,E.forEach(l=>{l.style.animationPlayState="paused";});},resume(){y&&(y=false,E.forEach(l=>{l.style.animationPlayState="running";}));},seek(l){let v=Math.min(1,Math.max(0,l));k=v,y=true,E.forEach((N,$e)=>{N.classList.remove(o),N.style.strokeDashoffset=S==="reverse"?`${I[$e]*v}`:`${I[$e]*(1-v)}`,c&&(N.style.opacity=S==="reverse"?`${1-v}`:`${v}`);});},getProgress(){return O()}}}if(bt())return wt();function vt(){let o=Math.max(1,oe),a=0,w=0;function q(O){let l=true;if(ye){let v=Math.min(1,Math.max(0,O/o)),N=he(v);Ce=N,e.style.setProperty("--scroll-draw-progress",String(N)),e.style.clipPath=j(S==="reverse"?1-N:N),d?.(N),v<1&&(l=false);}else E.forEach((v,N)=>{let $e=N*F*o,ke=Math.min(1,Math.max(0,(O-$e)/o)),we=he(ke);v.style.strokeDashoffset=S==="reverse"?`${I[N]*we}`:`${I[N]*(1-we)}`,c&&(v.style.opacity=S==="reverse"?`${1-we}`:`${we}`),ue&&V?v.style.stroke=Oe(ue,V,we):V&&(v.style.stroke=V),B!==null&&s!==null?v.style.strokeWidth=`${B+(s-B)*we}`:s!==null&&(v.style.strokeWidth=`${s}`),f!==null&&L!==null?v.style.fillOpacity=`${f+(L-f)*we}`:L!==null&&(v.style.fillOpacity=`${L}`),T&&v.tagName.toLowerCase()==="path"&&P[N]&&v.setAttribute("d",Je(P[N],T,we)),N===0&&(d?.(we),e.style.setProperty("--scroll-draw-progress",String(we))),ke<1&&(l=false);});if(h){let v=Math.min(1,Math.max(0,O/o)),N=he(v);for(let $e in h){let ke=parseFloat($e);N>=ke&&!Te.has(ke)&&(Te.add(ke),h[$e]?.());}}return l}function ae(O){if(ie)return;let l=O-a;me||(me=true,A?.());let v=q(l);if(v&&!Y){Y=true,q(o*(1+Math.max(0,E.length-1)*F)),b?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{a=performance.now(),me=false,Y=false,Te.clear(),ze(),X=requestAnimationFrame(ae);},ce));return}v||(X=requestAnimationFrame(ae));}function le(){cancelAnimationFrame(X),clearTimeout(xe),a=performance.now(),w=0,ie=false,me=false,Y=false,Se=0,Te.clear(),ze(),X=requestAnimationFrame(ae);}let fe=new IntersectionObserver(O=>{O.forEach(l=>{l.isIntersecting&&!(J&&Y)?le():!l.isIntersecting&&!J&&!Y&&(cancelAnimationFrame(X),clearTimeout(xe),a=null);});},{root:G??null,threshold:W,rootMargin:ne}),y;function k(){clearTimeout(y),y=setTimeout(()=>{E.forEach((O,l)=>{I[l]=We(O),O.style.strokeDasharray=`${I[l]}`;});},150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),re>0?setTimeout(()=>fe.observe(e),re):fe.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(xe),fe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(y);},replay(){Se=0,le();},pause(){ie||(ie=true,w=performance.now()-a,cancelAnimationFrame(X));},resume(){ie&&(ie=false,a=performance.now()-w,X=requestAnimationFrame(ae));},seek(O){let l=Math.min(1,Math.max(0,O));Ce=l,ie=true,w=l*o,a=performance.now()-w,cancelAnimationFrame(X),q(w);},getProgress(){return Ce}}}if(K)return vt();et();function Ve(){if(!He||ie)return;let o=performance.now(),a=Ne(),w=m;if(C!==false){let y=o-Ke,k=y>0?Math.abs(a-(qe<0?a:qe))/y:0;w=m*Math.max(.2,1+k*(typeof C=="number"?C:1)*.04);}qe=a,Ke=o;let q=te?Re===-1||a>=Re?"forward":"reverse":S;Re=a;let ae=se-Q,le=true,fe=ae===0?0:(a-Q)/ae;if(isNaN(Pe)||(Pe<=0&&fe>0?$?.():Pe>0&&fe<=0&&Le?.(),Pe<1&&fe>=1?ge?.():Pe>=1&&fe<1&&Ae?.()),Pe=fe,ye){let y=he(Z(a,Q,se,w));J&&!te&&(be=Math.max(be,y),y=be),Ce=y,e.style.setProperty("--scroll-draw-progress",String(y));let k=q==="reverse"?1-y:y;e.style.clipPath=j(k),d?.(y),!me&&Z(a,Q,se,w)>0&&(me=true,A?.()),y>=1&&!Y?(Y=true,b?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{be=-1,me=false,Y=false,e.style.clipPath=j(0);},ce))):y<1&&!J&&(Y=false),X=requestAnimationFrame(Ve);return}if(E.forEach((y,k)=>{let O=k*F*ae,l=he(Z(a,Q+O,se+O,w));J&&!te&&(be=Math.max(be,l),l=be),Ce=l,y.style.strokeDashoffset=q==="reverse"?`${I[k]*l}`:`${I[k]*(1-l)}`,c&&(y.style.opacity=q==="reverse"?`${1-l}`:`${l}`),ue&&V?y.style.stroke=Oe(ue,V,l):V&&(y.style.stroke=V),B!==null&&s!==null?y.style.strokeWidth=`${B+(s-B)*l}`:s!==null&&(y.style.strokeWidth=`${s}`),f!==null&&L!==null?y.style.fillOpacity=`${f+(L-f)*l}`:L!==null&&(y.style.fillOpacity=`${L}`),T&&y.tagName.toLowerCase()==="path"&&P[k]&&y.setAttribute("d",Je(P[k],T,l)),k===0&&(d?.(l),e.style.setProperty("--scroll-draw-progress",String(l))),l<1&&(le=false);}),h){let y=he(Z(a,Q,se,w));for(let k in h){let O=parseFloat(k);y>=O&&!Te.has(O)&&(Te.add(O),h[k]?.());}}!me&&Z(a,Q,se,w)>0&&(me=true,A?.()),le&&!Y?(Y=true,b?.(),Se<(z==="infinite"?1/0:z??0)&&(Se++,xe=setTimeout(()=>{be=-1,me=false,Y=false,Te.clear(),ze();},ce))):!le&&!J&&(Y=false),X=requestAnimationFrame(Ve);}let je=new IntersectionObserver(o=>{o.forEach(a=>{He=a.isIntersecting,He&&!ie?X=requestAnimationFrame(Ve):cancelAnimationFrame(X);});},{root:G??null,threshold:W,rootMargin:ne}),Ye;function Be(){clearTimeout(Ye),Ye=setTimeout(()=>{E.forEach((o,a)=>{I[a]=We(o),o.style.strokeDasharray=`${I[a]}`;}),et();},150);}return window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be),re>0?setTimeout(()=>je.observe(e),re):je.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(xe),je.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ye),Ge?.remove();},replay(){be=-1,Re=-1,qe=-1,me=false,Y=false,Se=0,ie=false,Te.clear(),clearTimeout(xe),ze();},pause(){ie=true,cancelAnimationFrame(X);},resume(){ie&&(ie=false,He&&(X=requestAnimationFrame(Ve)));},seek(o){let a=Math.min(1,Math.max(0,o));Ce=a,be=a,ie=true,cancelAnimationFrame(X),ht(a,S);},getProgress(){return Ce}}}var lt=new Map;function De(e,n){lt.set(e,n);}function Ie(e){lt.delete(e);}function Mt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let u=[],i=[],p=t[2].trim();if(p)for(let m of p.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"");}n.push({fn:t[1],nums:u,units:i});}return n}function Ct(e,n,r){let t=ct(e),u=ct(n);return t.length===0||t.length!==u.length?r<1?e:n:t.map((i,p)=>{let m=u[p];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((c,g)=>`${c}${i.units[g]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,g)=>`${c}${m.units[g]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,g)=>`${c+(m.nums[g]-c)*r}${i.units[g]}`).join(", ")})`}).join(" ")}function ut(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),u=String(n);if(Mt(t))return Oe(t,u,r);if(t.includes("("))return Ct(t,u,r);let i=t.match(/^([-+]?[\d.]+)(.*)$/),p=u.match(/^([-+]?[\d.]+)(.*)$/);if(i&&p){let m=parseFloat(i[1]),c=parseFloat(p[1]);return `${m+(c-m)*r}${i[2]||p[2]}`}return r<1?t:u}function $t(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var mt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Lt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Pt=0;function kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function pt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:u={},easing:i="ease-out",speed:p=1,once:m=false,axis:c="y",scrollContainer:g,native:M=true,velocityScale:F=false,onProgress:S,onComplete:J,onEnter:Ee,onLeave:H,onEnterBack:ee,onLeaveBack:te}=n,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof i=="function"?i:pe[i]??pe["ease-out"],R=de(u.start??"top bottom"),D=de(u.end??"bottom top"),h=typeof g=="string"?document.querySelector(g):g??null,C=Object.entries(t).map(([s,f])=>({prop:$t(s),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function W(){let s=window.getComputedStyle(e);for(let f of C)f.from===""&&(f.from=s.getPropertyValue(f.prop).trim()||"0");}function ne(){for(let s of C)e.style.setProperty(s.prop,String(s.to));}if(re)return ne(),J?.(),r;W();function z(){if(!M||!kt()||typeof i!="string"||!(i in mt)||c!=="y"||h||m||p!==1||S||J||Ee||H||ee||te||F!==false||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let s of C)if(!Lt.has(s.prop))return false;return true}function ce(){let s=`ssd-a-${++Pt}`,f=C.map(P=>`${P.prop}:${P.from}`).join(";"),L=C.map(P=>`${P.prop}:${P.to}`).join(";"),j=document.createElement("style");j.setAttribute("data-ssd-animate",""),j.textContent=`@keyframes ${s}{from{${f}}to{${L}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${mt[i]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(j),e.classList.add(s);let E=()=>c==="x"?window.scrollX:window.scrollY,I=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(s),j.remove();},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(P){let Q=Math.min(1,Math.max(0,P));e.classList.remove(s);for(let se of C)e.style.setProperty(se.prop,ut(se.from,se.to,Q));},getProgress(){let P=e.getBoundingClientRect(),Q=E(),se=I(),{tStart:Y,tEnd:me}=ve({top:P.top,height:P.height},Q,se,R,D);return x(Z(Q,Y,me,p))}}}if(z())return ce();let T=0,U=0,K=0,oe=false,_=false,d=-1,A=0,b=false,$=NaN,ge=-1,Ae=0,Le=()=>h?c==="x"?h.scrollLeft:h.scrollTop:c==="x"?window.scrollX:window.scrollY,ye=()=>h?c==="x"?h.clientWidth:h.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function he(){let s=e.getBoundingClientRect(),f,L;if(h){let E=h.getBoundingClientRect();f=c==="x"?s.left-E.left+h.scrollLeft:s.top-E.top+h.scrollTop,L=c==="x"?s.width:s.height;}else f=c==="x"?s.left:s.top,L=c==="x"?s.width:s.height;let j=ve({top:f,height:L},Le(),ye(),R,D);T=j.tStart,U=j.tEnd;}function Me(s){e.style.setProperty("--scroll-draw-progress",String(s));for(let f of C)e.style.setProperty(f.prop,ut(f.from,f.to,s));S?.(s);}function Fe(s){if(isNaN($)){$=s;return}$<=0&&s>0?Ee?.():$>0&&s<=0&&te?.(),$<1&&s>=1?H?.():$>=1&&s<1&&ee?.(),$=s;}function G(){if(!oe||_)return;let s=performance.now(),f=Le(),L=p;if(F!==false){let I=s-Ae,P=I>0?Math.abs(f-(ge<0?f:ge))/I:0;L=p*Math.max(.2,1+P*(typeof F=="number"?F:1)*.04);}ge=f,Ae=s;let j=U===T?0:(f-T)/(U-T);Fe(j);let E=x(Z(f,T,U,L));m&&(d=Math.max(d,E),E=d),A=E,Me(E),E>=1&&!b?(b=true,J?.()):E<1&&!m&&(b=false),K=requestAnimationFrame(G);}he();{let s=x(Z(Le(),T,U,p));m&&s>0&&(d=s),A=s,Me(s);}let ue=new IntersectionObserver(s=>{s.forEach(f=>{oe=f.isIntersecting,oe&&!_?K=requestAnimationFrame(G):cancelAnimationFrame(K);});},{root:h??null}),V;function B(){clearTimeout(V),V=setTimeout(he,150);}return window.addEventListener("resize",B),window.addEventListener("orientationchange",B),ue.observe(e),De(e,{type:"animate",getProgress:()=>A,getTrigger:()=>({tStart:T,tEnd:U})}),{destroy(){cancelAnimationFrame(K),ue.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("orientationchange",B),clearTimeout(V),Ie(e);},replay(){d=-1,b=false,A=0,_=false,Me(0);},pause(){_=true,cancelAnimationFrame(K);},resume(){_&&(_=false,oe&&(K=requestAnimationFrame(G)));},seek(s){let f=Math.min(1,Math.max(0,s));A=f,d=f,_=true,cancelAnimationFrame(K),Me(f);},getProgress(){return A}}}var Ue={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ze(e,n){if(typeof window>"u")return Ue;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Ue;let t=r,{from:u=0,to:i,format:p,easing:m="ease-out",trigger:c={},once:g=true,decimals:M,onComplete:F}=n,S=M!==void 0?d=>d.toFixed(M):p??(d=>String(Math.round(d))),J=typeof m=="function"?m:pe[m]??pe["ease-out"],Ee=de(c.start??"top 80%"),H=de(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(i),F?.(),Ue;t.textContent=S(u);let te=0,re=0,x=0,R=false,D=false,h=-1,C=0,W=false,ne=()=>window.scrollY,z=()=>window.innerHeight;function ce(){let d=t.getBoundingClientRect(),A=ve({top:d.top,height:d.height},ne(),z(),Ee,H);te=A.tStart,re=A.tEnd;}function T(d){t.textContent=S(u+(i-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function U(){if(!R||D)return;let d=J(Z(ne(),te,re,1));g&&(h=Math.max(h,d),d=h),C=d,T(d),d>=1&&!W?(W=true,F?.()):d<1&&!g&&(W=false),x=requestAnimationFrame(U);}ce();{let d=J(Z(ne(),te,re,1));g&&d>0&&(h=d),C=d,T(d);}let K=new IntersectionObserver(d=>{d.forEach(A=>{R=A.isIntersecting,R&&!D?x=requestAnimationFrame(U):cancelAnimationFrame(x);});}),oe;function _(){clearTimeout(oe),oe=setTimeout(ce,150);}return window.addEventListener("resize",_),window.addEventListener("orientationchange",_),K.observe(t),De(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:te,tEnd:re})}),{destroy(){cancelAnimationFrame(x),K.disconnect(),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),clearTimeout(oe),Ie(t);},replay(){h=-1,W=false,C=0,D=false,T(0);},pause(){D=true,cancelAnimationFrame(x);},resume(){D&&(D=false,R&&(x=requestAnimationFrame(U)));},seek(d){let A=Math.min(1,Math.max(0,d));C=A,h=A,D=true,cancelAnimationFrame(x),T(A);},getProgress(){return C}}}function gt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function Ot(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function ft(e){let n=gt(e),r=new Map;for(let i of n){let p=i.offsetTop;r.has(p)||r.set(p,[]),r.get(p).push(i);}let t=[],u=Array.from(r.keys()).sort((i,p)=>i-p);for(let i of u){let p=r.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block";for(let c of p)m.appendChild(c);t.push(m);}e.textContent="";for(let i of t)e.appendChild(i),e.appendChild(document.createTextNode(" "));return t}function Dt(e,n,r,t){if(r<=1||t===0)return e;let u=(r-1)*t,i=n*t,p=i+(1-u);return p<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(p-i)))}function It(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yt(e,n={}){if(typeof window>"u")return dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),dt;let t=r,{split:u="words",stagger:i=.04,easing:p="ease-out",from:m={opacity:0,y:24},trigger:c={},once:g=true,onComplete:M}=n,F=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof p=="function"?p:pe[p]??pe["ease-out"],J=de(c.start??"top 85%"),Ee=de(c.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=Ot(t):u==="lines"?ee=ft(t):ee=gt(t);let te=ee.length;function re(b,$){m?.opacity!==void 0&&(b.style.opacity=String(m.opacity+(1-m.opacity)*$));let ge=It($,m);ge&&(b.style.transform=ge);}function x(b){t.style.setProperty("--scroll-draw-progress",String(b)),ee.forEach(($,ge)=>{let Ae=S(Dt(b,ge,te,i));re($,Ae);});}if(F)return x(1),M?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let R=0,D=0,h=0,C=false,W=false,ne=-1,z=0,ce=false,T=()=>window.scrollY,U=()=>window.innerHeight;function K(){let b=t.getBoundingClientRect(),$=ve({top:b.top,height:b.height},T(),U(),J,Ee);R=$.tStart,D=$.tEnd;}function oe(){if(!C||W)return;let b=Z(T(),R,D,1);g&&(ne=Math.max(ne,b),b=ne),z=b,x(b),b>=1&&!ce?(ce=true,M?.()):b<1&&!g&&(ce=false),h=requestAnimationFrame(oe);}K();let _=new IntersectionObserver(b=>{b.forEach($=>{C=$.isIntersecting,C&&!W?h=requestAnimationFrame(oe):cancelAnimationFrame(h);});}),d;function A(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let b=z;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),ee=ft(t),x(b);}K();},150);}return window.addEventListener("resize",A),window.addEventListener("orientationchange",A),_.observe(t),De(t,{type:"text",getProgress:()=>z,getTrigger:()=>({tStart:R,tEnd:D})}),{destroy(){cancelAnimationFrame(h),_.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ie(t);},replay(){ne=-1,ce=false,z=0,W=false,x(0);},pause(){W=true,cancelAnimationFrame(h);},resume(){W&&(W=false,C&&(h=requestAnimationFrame(oe)));},seek(b){let $=Math.min(1,Math.max(0,b));z=$,ne=$,W=true,cancelAnimationFrame(h),x($);},getProgress(){return z}}}function Nt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?_e(t,n):(console.warn("[svg-scroll-draw] Container not found:",e),r)}function Ft(e=document){return Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return _e(n,r)})}function Ht(e=document){return Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return pt(n,r)})}function Rt(e=document){return Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(process.env.NODE_ENV!=="production"&&console.warn('[svg-scroll-draw] initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Ze(n,r)})}function qt(e=document){return Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return yt(n,r)})}function br(e=document){return {draw:Ft(e),animate:Ht(e),counter:Rt(e),text:qt(e)}}export{br as initAll,Ht as initScrollAnimate,Rt as initScrollCounter,Ft as initScrollDraw,qt as initScrollText,Nt as scrollDraw};
1
+ function Ht({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 S=Math.pow(l,d);c.push(S),s+=S;}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 S=0;S<r;S++)if(d<=u[S+1]){let _=(d-u[S])/(u[S+1]-u[S]);if(S===0)return _*(2-_);let x=1-Math.pow(t,S);return x+(1-x)*(2*_-1)*(2*_-1)}return 1}}function _t({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 ue={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ht(),elastic:_t()};function Se(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 yt(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 ht(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 zt(e,n,r){return Math.min(r,Math.max(n,e))}function Z(e,n,r,t){return r===n?0:zt((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 Le(e,n,r,t,l){let s=yt(e.top,e.height,n,t.element)-ht(t.viewport,r),c=yt(e.top,e.height,n,l.element)-ht(l.viewport,r);return {tStart:s,tEnd:c}}function bt(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 qe(e,n,r){let t=bt(e),l=bt(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 wt={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 K(e,...n){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var qt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Vt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function Wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Bt(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 Ke(e){switch(e){case "linear":return "linear";case "ease-in":return qt;case "ease-out":return Vt;case "ease-in-out":return Wt()?Bt(ue["ease-in-out"]):null;default:return null}}var vt=Symbol.for("svg-scroll-draw.registry");function Et(){let e=globalThis;return e[vt]||(e[vt]=new Map)}function Oe(e,n){Et().set(e,n);}function Ie(e){Et().delete(e);}var Gt=0;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Ut(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?K("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Yt(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 xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Tt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Xt(e,n,r){if(!Ze)return;let t=(e.match(Tt)??[]).join("").toUpperCase(),l=(n.match(Tt)??[]).join("").toUpperCase(),s=(e.match(xt)??[]).length,c=(n.match(xt)??[]).length;if(t!==l){K(`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&&K(`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 it(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 et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...wt[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:S={},stagger:_=0,direction:x="forward",once:ne=false,debug:ke=false,axis:j="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:T,strokeWidth:W,fillOpacity:L,waypoints:A,velocityScale:F=false,threshold:B=0,rootMargin:P="0px",repeat:M=0,repeatDelay:me=0,morphTo:D,clip:de,autoplay:ve=false,duration:ge=1e3,native:Ee=true,onProgress:g,onStart:v,onComplete:y,onEnter:$,onLeave:ye,onEnterBack:he,onLeaveBack:Ce}=l,te=de===true?"left":typeof de=="string"?de:false,be=typeof d=="function"?d:ue[d]??ue.linear,Ae=Se(S.start??"top bottom"),He=Se(S.end??"bottom top"),fe=typeof oe=="string"?document.querySelector(oe):oe??null,pe=Array.isArray(T)?T[0]:null,Y=Array.isArray(T)?T[1]:typeof T=="string"?T:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Me(o){let a=o*100;switch(te){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 k=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,O=false,R=false,N=0,xe=false,ae=-1,U=-1,q=false,le=0,Pe=0,Re,tt=null;function lt(){tt?.destroy(),tt=null;}let Fe=new Set,ct=NaN,Ne=true,Ge=-1,ut=performance.now(),_e=NaN;function rt(){return fe?j==="x"?fe.scrollLeft:fe.scrollTop:j==="x"?window.scrollX:window.scrollY}function mt(){return fe?j==="x"?fe.clientWidth:fe.clientHeight:j==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Qe(e,fe,j);return Le(o,o.scroll,mt(),Ae,He)}function pt(){(({tStart:f,tEnd:ie}=ft())),ke&&Ze&&(lt(),tt=Yt(f,ie,j));}function nt(o,a=ft){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function kt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Me(b);return}k.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&Y?b.style.stroke=qe(pe,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",it(i[J],D,o));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Me(0);return}k.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=x==="reverse"?"0":`${E[a]}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(k.forEach(o=>{Ut(o);let a=ze(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Xt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=x==="reverse"?"0":`${a}`,m?o.style.opacity=x==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof d=="string"?Ke(d):null;function Rt(){return !(Ee===false||!jt()||!k.length||!dt||te||j!=="y"||fe||u!==1||_!==0||ne||se||F!==false||D||A||M||ee>0||g||v||y||$||ye||he||Ce||T!=null||W!=null||L!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Ft(){let o=++Gt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=x==="reverse"?"0":"var(--ssd-len)",$e=x==="reverse"?"var(--ssd-len)":"0",Te=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(Te+=`opacity:${x==="reverse"?1:0};`,w+=`opacity:${x==="reverse"?0:1};`);let C=document.createElement("style");C.setAttribute("data-svg-scroll-draw",""),C.textContent=`@keyframes ${a}{from{${Te}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(C),e.classList.add(b);function Q(p,V){p.style.setProperty("--ssd-len",String(E[V])),p.style.strokeDasharray=`${E[V]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}k.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:V,tEnd:we}=Le({top:p.top,height:p.height},rt(),mt(),Ae,He);return be(Z(rt(),V,we,u))}return {destroy(){e.classList.remove(b),k.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),C.remove();},replay(){h=false,I=-1,k.forEach(Q);},pause(){h=true,k.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,k.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let V=Math.min(1,Math.max(0,p));I=V,h=true,k.forEach((we,ce)=>{we.classList.remove(a),we.style.strokeDashoffset=x==="reverse"?`${E[ce]*V}`:`${E[ce]*(1-V)}`,m&&(we.style.opacity=x==="reverse"?`${1-V}`:`${V}`);});},getProgress(){return H()},refresh(){k.forEach((p,V)=>{E[V]=ze(p),p.style.setProperty("--ssd-len",String(E[V])),p.style.strokeDasharray=`${E[V]}`;});}}}if(Rt())return nt(Ft());function Nt(){let o=Math.max(1,ge),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=be(H);le=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Me(x==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else k.forEach((H,p)=>{let V=p*_*o,we=Math.min(1,Math.max(0,(h-V)/o)),ce=be(we);H.style.strokeDashoffset=x==="reverse"?`${E[p]*ce}`:`${E[p]*(1-ce)}`,m&&(H.style.opacity=x==="reverse"?`${1-ce}`:`${ce}`),pe&&Y?H.style.stroke=qe(pe,Y,ce):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ce}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ce}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",it(i[p],D,ce)),p===0&&(le=ce,g?.(ce),e.style.setProperty("--scroll-draw-progress",String(ce))),we<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=be(H);for(let V in A){let we=parseFloat(V);p>=we&&!Fe.has(we)&&(Fe.add(we),A[V]?.());}}return I}function $e(h){if(q)return;let I=h-a;R||(R=true,v?.());let H=De(I);if(H&&!O){O=true,De(o*(1+Math.max(0,k.length-1)*_)),y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{a=performance.now(),R=false,O=false,Fe.clear(),je(),N=requestAnimationFrame($e);},me));return}H||(N=requestAnimationFrame($e));}function Te(){cancelAnimationFrame(N),clearTimeout(Re),a=performance.now(),b=0,q=false,R=false,O=false,Pe=0,J=true,le=0,Fe.clear(),je(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&O)?Te():!I.isIntersecting&&!ne&&!O&&(cancelAnimationFrame(N),clearTimeout(Re),J=false);});},{root:fe??null,threshold:B,rootMargin:P}),C;function Q(){clearTimeout(C),C=setTimeout(()=>{k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Re),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(C);},replay(){Pe=0,Te();},pause(){q||!J||(q=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){q&&(q=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));le=I,q=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return le},refresh(){clearTimeout(C),k.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(ve)return nt(Nt());pt();function Ue(){if(!xe||q)return;let o=performance.now(),a=rt();if(!Ne&&F===false&&a===ct){N=requestAnimationFrame(Ue);return}Ne=false,ct=a;let b=u;if(F!==false){let w=o-ut,C=w>0?Math.abs(a-(Ge<0?a:Ge))/w:0;b=u*Math.max(.2,1+C*(typeof F=="number"?F:1)*.04);}Ge=a,ut=o;let J=se?U===-1||a>=U?"forward":"reverse":x;U=a;let De=ie-f,$e=true,Te=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Te>0?$?.():_e>0&&Te<=0&&Ce?.(),_e<1&&Te>=1?ye?.():_e>=1&&Te<1&&he?.()),_e=Te,te){let w=be(Z(a,f,ie,b));ne&&!se&&(ae=Math.max(ae,w),w=ae),le=w,e.style.setProperty("--scroll-draw-progress",String(w));let C=J==="reverse"?1-w:w;e.style.clipPath=Me(C),g?.(w),!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),w>=1&&!O?(O=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{ae=-1,R=false,O=false,e.style.clipPath=Me(0);},me))):w<1&&!ne&&(O=false),N=requestAnimationFrame(Ue);return}if(k.forEach((w,C)=>{let Q=C*_*De,h=be(Z(a,f+Q,ie+Q,b));ne&&!se&&(ae=Math.max(ae,h),h=ae),le=h,w.style.strokeDashoffset=J==="reverse"?`${E[C]*h}`:`${E[C]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),pe&&Y?w.style.stroke=qe(pe,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[C]&&w.setAttribute("d",it(i[C],D,h)),C===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=be(Z(a,f,ie,b));for(let C in A){let Q=parseFloat(C);w>=Q&&!Fe.has(Q)&&(Fe.add(Q),A[C]?.());}}!R&&Z(a,f,ie,b)>0&&(R=true,v?.()),$e&&!O?(O=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{ae=-1,R=false,O=false,Fe.clear(),je(),Ne=true;},me))):!$e&&!ne&&(O=false),N=requestAnimationFrame(Ue);}let ot=false;function Ye(){ot||(ot=true,N=requestAnimationFrame(function(){Ue();}));}function Xe(){ot=false,cancelAnimationFrame(N);}let st=new IntersectionObserver(o=>{o.forEach(a=>{xe=a.isIntersecting,xe&&!q?(Ne=true,Ye()):Xe();});},{root:fe??null,threshold:B,rootMargin:P});function gt(){k.forEach((o,a)=>{E[a]=ze(o),o.style.strokeDasharray=`${E[a]}`;}),pt(),Ne=true;}let Je;function Ve(){clearTimeout(Je),Je=setTimeout(gt,150);}window.addEventListener("resize",Ve),window.addEventListener("orientationchange",Ve);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>Ve()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),ee>0?setTimeout(()=>st.observe(e),ee):st.observe(e),nt({destroy(){cancelAnimationFrame(N),clearTimeout(Re),Xe(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",Ve),window.removeEventListener("orientationchange",Ve),clearTimeout(Je),lt();},replay(){ae=-1,U=-1,Ge=-1,R=false,O=false,Pe=0,q=false,le=0,Fe.clear(),clearTimeout(Re),je(),Ne=true,xe&&Ye();},pause(){q=true,Xe();},resume(){q&&(q=false,Ne=true,xe&&Ye());},seek(o){let a=Math.min(1,Math.max(0,o));le=a,ae=a,q=true,Xe(),kt(a,x),Ne=true;},getProgress(){return le},refresh(){clearTimeout(Je),gt(),xe&&!q&&Ye();}},()=>({tStart:f,tEnd:ie}))}function Jt(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 Qt(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(Jt(t))return qe(t,l,r);if(t.includes("("))return Qt(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 Zt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),er=0,$t="--scroll-draw-progress";function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Lt(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:S=true,velocityScale:_=false,respectReducedMotion:x=true,triggerElement:ne,onProgress:ke,onComplete:j,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:T}=n,W=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:ue[s]??ue["ease-out"],A=Se(l.start??"top bottom"),F=Se(l.end??"bottom top"),B=ne??e,P=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:Zt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function me(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let de=new Map;for(let i of [...M.map(f=>f.prop),$t])de.set(i,e.style.getPropertyValue(i));function ve(){for(let[i,f]of de)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),j?.(),{...r,destroy:ve,getProgress:()=>1};me();let ge=typeof s=="string"?Ke(s):null;function Ee(){if(!S||!tr()||!ge||m!=="y"||P||B!==e||u||c!==1||ke||j||oe||se||ee||T||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!Kt.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++er}`,f=M.map(U=>`${U.prop}:${U.from}`).join(";"),ie=M.map(U=>`${U.prop}:${U.to}`).join(";"),O=document.createElement("style");O.setAttribute("data-ssd-animate",""),O.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(i);let R=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,xe=()=>{let U=e.getBoundingClientRect();return Le({top:U.top,height:U.height},R(),N(),A,F)};Oe(e,{type:"animate",getProgress:()=>ae.getProgress(),getTrigger:xe});let ae={destroy(){e.classList.remove(i),O.remove(),e.style.animationPlayState="",ve(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(U){let q=Math.min(1,Math.max(0,U));e.classList.remove(i);for(let le of M)e.style.setProperty(le.prop,Mt(le.from,le.to,q));},getProgress(){let{tStart:U,tEnd:q}=xe();return L(Z(R(),U,q,c))}};return ae}if(Ee())return g();let v=0,y=0,$=0,ye=false,he=false,Ce=-1,te=0,be=false,Ae=NaN,He=-1,fe=0,pe=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Qe(B,P,m),f=Le(i,i.scroll,Y(),A,F);v=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty($t,String(i));for(let f of M)e.style.setProperty(f.prop,Mt(f.from,f.to,i));ke?.(i);}function re(i){if(isNaN(Ae)){Ae=i;return}Ae<=0&&i>0?oe?.():Ae>0&&i<=0&&T?.(),Ae<1&&i>=1?se?.():Ae>=1&&i<1&&ee?.(),Ae=i;}function G(){if(!ye||he)return;let i=performance.now(),f=pe(),ie=c;if(_!==false){let N=i-fe,xe=N>0?Math.abs(f-(He<0?f:He))/N:0;ie=c*Math.max(.2,1+xe*(typeof _=="number"?_:1)*.04);}He=f,fe=i;let O=y===v?0:(f-v)/(y-v);re(O);let R=L(Z(f,v,y,ie));u&&(Ce=Math.max(Ce,R),R=Ce),te=R,z(R),R>=1&&!be?(be=true,j?.()):R<1&&!u&&(be=false),$=requestAnimationFrame(G);}X(),y===v&&K("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=L(Z(pe(),v,y,c));u&&i>0&&(Ce=i),te=i,z(i);}let Me=new IntersectionObserver(i=>{i.forEach(f=>{ye=f.isIntersecting,ye&&!he?$=requestAnimationFrame(G):cancelAnimationFrame($);});},{root:P??null}),k;function E(){clearTimeout(k),k=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Me.observe(e),Oe(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:v,tEnd:y})}),{destroy(){cancelAnimationFrame($),Me.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(k),ve(),Ie(e);},replay(){Ce=-1,be=false,te=0,he=false,z(0);},pause(){he=true,cancelAnimationFrame($);},resume(){he&&(he=false,ye&&($=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Ce=f,he=true,cancelAnimationFrame($),z(f);},getProgress(){return te}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ct(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:_}=n,x=S!==void 0?g=>g.toFixed(S):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:ue[u]??ue["ease-out"],ke=Se(m.start??"top 80%"),j=Se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=x(s),_?.(),at;let se=0,ee=0,T=0,W=false,L=false,A=-1,F=0,B=false,P=()=>window.scrollY,M=()=>window.innerHeight;function me(){let g=t.getBoundingClientRect(),v=Le({top:g.top,height:g.height},P(),M(),ke,j);se=v.tStart,ee=v.tEnd;}function D(g){t.textContent=x(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function de(){if(!W||L)return;let g=ne(Z(P(),se,ee,1));d&&(A=Math.max(A,g),g=A),F=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),T=requestAnimationFrame(de);}me();{let g=ne(Z(P(),se,ee,1));d&&g>0&&(A=g),F=g,D(g);}let ve=new IntersectionObserver(g=>{g.forEach(v=>{W=v.isIntersecting,W&&!L?T=requestAnimationFrame(de):cancelAnimationFrame(T);});}),ge;function Ee(){clearTimeout(ge),ge=setTimeout(me,150);}return window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee),ve.observe(t),Oe(t,{type:"counter",getProgress:()=>F,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(T),ve.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),clearTimeout(ge),Ie(t);},replay(){A=-1,B=false,F=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(T);},resume(){L&&(L=false,W&&(T=requestAnimationFrame(de)));},seek(g){let v=Math.min(1,Math.max(0,g));F=v,A=v,L=true,cancelAnimationFrame(T),D(v);},getProgress(){return F}}}function Ot(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 rr(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 Pt(e){let n=Ot(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 S=m.nextElementSibling;u.appendChild(m),d<c.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function nr(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 or(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n={}){if(typeof window>"u")return Dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),Dt;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:S}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof c=="function"?c:ue[c]??ue["ease-out"],ne=Se(m.start??"top 85%"),ke=Se(m.end??"top 40%"),j=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=rr(t):l==="lines"?oe=Pt(t):oe=Ot(t);let se=oe.length;function ee(y,$){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*$));let ye=or($,u);ye&&(y.style.transform=ye);}function T(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach(($,ye)=>{let he=x(nr(y,ye,se,s));ee($,he);});}if(_)return T(1),S?.(),{destroy(){t.innerHTML=j,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};T(0);let W=0,L=0,A=0,F=false,B=false,P=-1,M=0,me=false,D=()=>window.scrollY,de=()=>window.innerHeight;function ve(){let y=t.getBoundingClientRect(),$=Le({top:y.top,height:y.height},D(),de(),ne,ke);W=$.tStart,L=$.tEnd;}function ge(){if(!F||B)return;let y=Z(D(),W,L,1);d&&(P=Math.max(P,y),y=P),M=y,T(y),y>=1&&!me?(me=true,S?.()):y<1&&!d&&(me=false),A=requestAnimationFrame(ge);}ve();let Ee=new IntersectionObserver(y=>{y.forEach($=>{F=$.isIntersecting,F&&!B?A=requestAnimationFrame(ge):cancelAnimationFrame(A);});}),g;function v(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=j,t.setAttribute("aria-label",t.textContent??""),oe=Pt(t),T(y);}ve();},150);}return window.addEventListener("resize",v),window.addEventListener("orientationchange",v),Ee.observe(t),Oe(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:L})}),{destroy(){cancelAnimationFrame(A),Ee.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),clearTimeout(g),t.innerHTML=j,t.removeAttribute("aria-label"),Ie(t);},replay(){P=-1,me=false,M=0,B=false,T(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,F&&(A=requestAnimationFrame(ge)));},seek(y){let $=Math.min(1,Math.max(0,y));M=$,P=$,B=true,cancelAnimationFrame(A),T($);},getProgress(){return M}}}function sr(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?et(t,n):(K("Container not found:",e),r)}function Be(){return typeof document>"u"?null:document}function ir(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return et(n,r)}):[]}function ar(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return Lt(n,r)}):[]}function lr(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),Ct(n,r)}):[]}function cr(e=Be()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return It(n,r)}):[]}function Wr(e=Be()){return {draw:ir(e),animate:ar(e),counter:lr(e),text:cr(e)}}export{Wr as initAll,ar as initScrollAnimate,lr as initScrollCounter,ir as initScrollDraw,cr as initScrollText,sr as scrollDraw};