svg-scroll-draw 2.7.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/angular/index.cjs +2 -2
  2. package/dist/angular/index.d.mts +6 -0
  3. package/dist/angular/index.d.ts +6 -0
  4. package/dist/angular/index.mjs +2 -2
  5. package/dist/astro/index.cjs +3 -3
  6. package/dist/astro/index.mjs +3 -3
  7. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  8. package/dist/group/index.cjs +3 -3
  9. package/dist/group/index.d.mts +6 -0
  10. package/dist/group/index.d.ts +6 -0
  11. package/dist/group/index.mjs +3 -3
  12. package/dist/horizontal/index.cjs +1 -0
  13. package/dist/horizontal/index.d.mts +61 -0
  14. package/dist/horizontal/index.d.ts +61 -0
  15. package/dist/horizontal/index.mjs +1 -0
  16. package/dist/index.cjs +2 -2
  17. package/dist/index.d.mts +6 -0
  18. package/dist/index.d.ts +6 -0
  19. package/dist/index.mjs +2 -2
  20. package/dist/nuxt/index.cjs +3 -3
  21. package/dist/nuxt/index.d.mts +6 -0
  22. package/dist/nuxt/index.d.ts +6 -0
  23. package/dist/nuxt/index.mjs +3 -3
  24. package/dist/pin/index.cjs +1 -1
  25. package/dist/pin/index.mjs +1 -1
  26. package/dist/progress/index.cjs +1 -0
  27. package/dist/progress/index.d.mts +59 -0
  28. package/dist/progress/index.d.ts +59 -0
  29. package/dist/progress/index.mjs +1 -0
  30. package/dist/react/index.cjs +3 -3
  31. package/dist/react/index.d.mts +6 -0
  32. package/dist/react/index.d.ts +6 -0
  33. package/dist/react/index.mjs +3 -3
  34. package/dist/reveal/index.cjs +1 -0
  35. package/dist/reveal/index.d.mts +80 -0
  36. package/dist/reveal/index.d.ts +80 -0
  37. package/dist/reveal/index.mjs +1 -0
  38. package/dist/solid/index.cjs +2 -2
  39. package/dist/solid/index.d.mts +6 -0
  40. package/dist/solid/index.d.ts +6 -0
  41. package/dist/solid/index.mjs +2 -2
  42. package/dist/svelte/index.cjs +2 -2
  43. package/dist/svelte/index.d.mts +6 -0
  44. package/dist/svelte/index.d.ts +6 -0
  45. package/dist/svelte/index.mjs +2 -2
  46. package/dist/vue/index.cjs +2 -2
  47. package/dist/vue/index.d.mts +6 -0
  48. package/dist/vue/index.d.ts +6 -0
  49. package/dist/vue/index.mjs +2 -2
  50. package/package.json +16 -1
@@ -1,3 +1,3 @@
1
- import {defineComponent,ref,onMounted,onUnmounted,h}from'vue';function Mt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),s=0,m=[];for(let h=0;h<n;h++){let L=Math.pow(l,h);m.push(L),s+=L;}let c=[0],u=0;for(let h=0;h<n;h++)u+=m[h]/s,c.push(u);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let L=0;L<n;L++)if(h<=c[L+1]){let _=(h-c[L])/(c[L+1]-c[L]);if(L===0)return _*(2-_);let E=1-Math.pow(t,L);return E+(1-E)*(2*_-1)*(2*_-1)}return 1}}function Ct({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var ie={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Mt(),elastic:Ct()};function ae(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function lt(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function ct(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Ye(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Lt(e,r,n){return Math.min(n,Math.max(r,e))}function K(e,r,n,t){return n===r?0:Lt((e-r)/(n-r)*t,0,1)}function pe(e,r,n,t,l){let s=lt(e.top,e.height,r,t.element)-ct(t.viewport,n),m=lt(e.top,e.height,r,l.element)-ct(l.viewport,n);return {tStart:s,tEnd:m}}function ut(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Re(e,r,n){let t=ut(e),l=ut(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}var ft={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 mt(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var pt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},$t=0;function Pt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ot(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?mt("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&mt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function kt(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=n==="x"?window.scrollX:window.scrollY,m=e-s,c=r-s,u=n==="x";t.innerHTML=`
1
+ import {defineComponent,ref,onMounted,onUnmounted,h}from'vue';function Mt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),s=0,m=[];for(let h=0;h<n;h++){let P=Math.pow(l,h);m.push(P),s+=P;}let c=[0],u=0;for(let h=0;h<n;h++)u+=m[h]/s,c.push(u);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let P=0;P<n;P++)if(h<=c[P+1]){let H=(h-c[P])/(c[P+1]-c[P]);if(P===0)return H*(2-H);let S=1-Math.pow(t,P);return S+(1-S)*(2*H-1)*(2*H-1)}return 1}}function Ct({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var ae={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Mt(),elastic:Ct()};function le(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function lt(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function ct(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Ye(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Lt(e,r,n){return Math.min(n,Math.max(r,e))}function Q(e,r,n,t){return n===r?0:Lt((e-r)/(n-r)*t,0,1)}function ye(e,r,n,t,l){let s=lt(e.top,e.height,r,t.element)-ct(t.viewport,n),m=lt(e.top,e.height,r,l.element)-ct(l.viewport,n);return {tStart:s,tEnd:m}}function ut(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Re(e,r,n){let t=ut(e),l=ut(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}var ft={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 mt(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var pt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},$t=0;function Pt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ot(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?mt("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&mt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function kt(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=n==="x"?window.scrollX:window.scrollY,m=e-s,c=r-s,u=n==="x";t.innerHTML=`
2
2
  <div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}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(),t}function Ke(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),c=t[l++]??m;return String(+(m+(c-m)*n).toFixed(4))})}function Qe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...ft[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:c=1,fade:u=false,easing:h="linear",trigger:L={},stagger:_=0,direction:E="forward",once:Q=false,debug:he=false,axis:H="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:P=false,threshold:O=0,rootMargin:G="0px",repeat:$=0,repeatDelay:N=0,morphTo:M,clip:z,autoplay:ne=false,duration:D=1e3,native:B=true,onProgress:d,onStart:C,onComplete:g,onEnter:y,onLeave:j,onEnterBack:Ae,onLeaveBack:be}=l,we=z===true?"left":typeof z=="string"?z:false,de=typeof h=="function"?h:ie[h]??ie.linear,He=ae(L.start??"top bottom"),Ie=ae(L.end??"bottom top"),U=typeof ee=="string"?document.querySelector(ee):ee??null,i=Array.isArray(x)?x[0]:null,p=Array.isArray(x)?x[1]:typeof x=="string"?x:null,X=Array.isArray(A)?A[0]:null,R=Array.isArray(A)?A[1]:typeof A=="number"?A:null,Z=Array.isArray(w)?w[0]:null,oe=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(o){let a=o*100;switch(we){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let W=we?[]:Array.from(e.querySelectorAll(m)),k=[],fe=[],ge=0,Ce=0,se=false,ye=false,re=0,Be=false,ve=-1,We=-1,le=false,ke=0,Me=0,Le,Ue=null,$e=new Set,_e=-1,st=performance.now(),Ne=NaN;function ze(){return U?H==="x"?U.scrollLeft:U.scrollTop:H==="x"?window.scrollX:window.scrollY}function it(){return U?H==="x"?U.clientWidth:U.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function at(){let o=e.getBoundingClientRect(),a,S,Y;if(U){let ue=U.getBoundingClientRect();a=H==="x"?o.left-ue.left+U.scrollLeft:o.top-ue.top+U.scrollTop,S=H==="x"?o.width:o.height,Y=ze();}else a=H==="x"?o.left:o.top,S=H==="x"?o.width:o.height,Y=ze();let ce=pe({top:a,height:S},Y,it(),He,Ie);ge=ce.tStart,Ce=ce.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=kt(ge,Ce,H));}function Et(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),we){let S=a==="reverse"?1-o:o;e.style.clipPath=J(S);return}W.forEach((S,Y)=>{S.style.strokeDashoffset=a==="reverse"?`${k[Y]*o}`:`${k[Y]*(1-o)}`,u&&(S.style.opacity=a==="reverse"?`${1-o}`:`${o}`),i&&p?S.style.stroke=Re(i,p,o):p&&(S.style.stroke=p),X!==null&&R!==null?S.style.strokeWidth=`${X+(R-X)*o}`:R!==null&&(S.style.strokeWidth=`${R}`),Z!==null&&oe!==null?S.style.fillOpacity=`${Z+(oe-Z)*o}`:oe!==null&&(S.style.fillOpacity=`${oe}`),M&&S.tagName.toLowerCase()==="path"&&fe[Y]&&S.setAttribute("d",Ke(fe[Y],M,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}W.forEach((o,a)=>{o.style.strokeDasharray=`${k[a]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${k[a]}`,u?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),X!==null&&(o.style.strokeWidth=`${X}`),Z!==null&&(o.style.fillOpacity=`${Z}`),M&&o.tagName.toLowerCase()==="path"&&fe[a]&&o.setAttribute("d",fe[a]);});}if(W.forEach(o=>{Ot(o);let a=Ye(o);k.push(a),o.tagName.toLowerCase()==="path"?fe.push(o.getAttribute("d")??""):fe.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?`${a}`:"0",u&&(o.style.opacity="1"),p&&(o.style.stroke=p),R!==null&&(o.style.strokeWidth=`${R}`),oe!==null&&(o.style.fillOpacity=`${oe}`),M&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",M)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?"0":`${a}`,u?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",i&&(o.style.stroke=i),X!==null&&(o.style.strokeWidth=`${X}`),Z!==null&&(o.style.fillOpacity=`${Z}`));}),we){if(s)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(B===false||!Pt()||!W.length||typeof h!="string"||!(h in pt)||we||H!=="y"||U||c!==1||_!==0||Q||te||P!==false||M||b||$||q>0||d||C||g||y||j||Ae||be||x!=null||A!=null||w!=null||(L.start??"top bottom").trim()!=="top bottom"||(L.end??"bottom top").trim()!=="bottom top")}function Tt(){let o=`svg-scroll-draw-${++$t}`,a=E==="reverse"?"0":"var(--ssd-len)",S=E==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${a};`,ce=`stroke-dashoffset:${S};`;u&&(Y+=`opacity:${E==="reverse"?1:0};`,ce+=`opacity:${E==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${o}{from{${Y}}to{${ce}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${pt[h]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function me(f,T){f.style.setProperty("--ssd-len",String(k[T])),f.style.strokeDasharray=`${k[T]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(o);}W.forEach(me);let v=false,F=-1;function I(){if(F>=0)return F;let f=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:f.top,height:f.height},ze(),it(),He,Ie);return de(K(ze(),T,V,c))}return {destroy(){W.forEach(f=>{f.classList.remove(o),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),ue.remove();},replay(){v=false,F=-1,W.forEach(me);},pause(){v=true,W.forEach(f=>{f.style.animationPlayState="paused";});},resume(){v&&(v=false,W.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let T=Math.min(1,Math.max(0,f));F=T,v=true,W.forEach((V,Fe)=>{V.classList.remove(o),V.style.strokeDashoffset=E==="reverse"?`${k[Fe]*T}`:`${k[Fe]*(1-T)}`,u&&(V.style.opacity=E==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return I()}}}if(xt())return Tt();function At(){let o=Math.max(1,D),a=0,S=0;function Y(I){let f=true;if(we){let T=Math.min(1,Math.max(0,I/o)),V=de(T);ke=V,e.style.setProperty("--scroll-draw-progress",String(V)),e.style.clipPath=J(E==="reverse"?1-V:V),d?.(V),T<1&&(f=false);}else W.forEach((T,V)=>{let Fe=V*_*o,De=Math.min(1,Math.max(0,(I-Fe)/o)),Se=de(De);T.style.strokeDashoffset=E==="reverse"?`${k[V]*Se}`:`${k[V]*(1-Se)}`,u&&(T.style.opacity=E==="reverse"?`${1-Se}`:`${Se}`),i&&p?T.style.stroke=Re(i,p,Se):p&&(T.style.stroke=p),X!==null&&R!==null?T.style.strokeWidth=`${X+(R-X)*Se}`:R!==null&&(T.style.strokeWidth=`${R}`),Z!==null&&oe!==null?T.style.fillOpacity=`${Z+(oe-Z)*Se}`:oe!==null&&(T.style.fillOpacity=`${oe}`),M&&T.tagName.toLowerCase()==="path"&&fe[V]&&T.setAttribute("d",Ke(fe[V],M,Se)),V===0&&(d?.(Se),e.style.setProperty("--scroll-draw-progress",String(Se))),De<1&&(f=false);});if(b){let T=Math.min(1,Math.max(0,I/o)),V=de(T);for(let Fe in b){let De=parseFloat(Fe);V>=De&&!$e.has(De)&&($e.add(De),b[Fe]?.());}}return f}function ce(I){if(le)return;let f=I-a;ye||(ye=true,C?.());let T=Y(f);if(T&&!se){se=true,Y(o*(1+Math.max(0,W.length-1)*_)),g?.(),Me<($==="infinite"?1/0:$??0)&&(Me++,Le=setTimeout(()=>{a=performance.now(),ye=false,se=false,$e.clear(),Ge(),re=requestAnimationFrame(ce);},N));return}T||(re=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(re),clearTimeout(Le),a=performance.now(),S=0,le=false,ye=false,se=false,Me=0,$e.clear(),Ge(),re=requestAnimationFrame(ce);}let me=new IntersectionObserver(I=>{I.forEach(f=>{f.isIntersecting&&!(Q&&se)?ue():!f.isIntersecting&&!Q&&!se&&(cancelAnimationFrame(re),clearTimeout(Le),a=null);});},{root:U??null,threshold:O,rootMargin:G}),v;function F(){clearTimeout(v),v=setTimeout(()=>{W.forEach((I,f)=>{k[f]=Ye(I),I.style.strokeDasharray=`${k[f]}`;});},150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),q>0?setTimeout(()=>me.observe(e),q):me.observe(e),{destroy(){cancelAnimationFrame(re),clearTimeout(Le),me.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(v);},replay(){Me=0,ue();},pause(){le||(le=true,S=performance.now()-a,cancelAnimationFrame(re));},resume(){le&&(le=false,a=performance.now()-S,re=requestAnimationFrame(ce));},seek(I){let f=Math.min(1,Math.max(0,I));ke=f,le=true,S=f*o,a=performance.now()-S,cancelAnimationFrame(re),Y(S);},getProgress(){return ke}}}if(ne)return At();at();function je(){if(!Be||le)return;let o=performance.now(),a=ze(),S=c;if(P!==false){let v=o-st,F=v>0?Math.abs(a-(_e<0?a:_e))/v:0;S=c*Math.max(.2,1+F*(typeof P=="number"?P:1)*.04);}_e=a,st=o;let Y=te?We===-1||a>=We?"forward":"reverse":E;We=a;let ce=Ce-ge,ue=true,me=ce===0?0:(a-ge)/ce;if(isNaN(Ne)||(Ne<=0&&me>0?y?.():Ne>0&&me<=0&&be?.(),Ne<1&&me>=1?j?.():Ne>=1&&me<1&&Ae?.()),Ne=me,we){let v=de(K(a,ge,Ce,S));Q&&!te&&(ve=Math.max(ve,v),v=ve),ke=v,e.style.setProperty("--scroll-draw-progress",String(v));let F=Y==="reverse"?1-v:v;e.style.clipPath=J(F),d?.(v),!ye&&K(a,ge,Ce,S)>0&&(ye=true,C?.()),v>=1&&!se?(se=true,g?.(),Me<($==="infinite"?1/0:$??0)&&(Me++,Le=setTimeout(()=>{ve=-1,ye=false,se=false,e.style.clipPath=J(0);},N))):v<1&&!Q&&(se=false),re=requestAnimationFrame(je);return}if(W.forEach((v,F)=>{let I=F*_*ce,f=de(K(a,ge+I,Ce+I,S));Q&&!te&&(ve=Math.max(ve,f),f=ve),ke=f,v.style.strokeDashoffset=Y==="reverse"?`${k[F]*f}`:`${k[F]*(1-f)}`,u&&(v.style.opacity=Y==="reverse"?`${1-f}`:`${f}`),i&&p?v.style.stroke=Re(i,p,f):p&&(v.style.stroke=p),X!==null&&R!==null?v.style.strokeWidth=`${X+(R-X)*f}`:R!==null&&(v.style.strokeWidth=`${R}`),Z!==null&&oe!==null?v.style.fillOpacity=`${Z+(oe-Z)*f}`:oe!==null&&(v.style.fillOpacity=`${oe}`),M&&v.tagName.toLowerCase()==="path"&&fe[F]&&v.setAttribute("d",Ke(fe[F],M,f)),F===0&&(d?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(ue=false);}),b){let v=de(K(a,ge,Ce,S));for(let F in b){let I=parseFloat(F);v>=I&&!$e.has(I)&&($e.add(I),b[F]?.());}}!ye&&K(a,ge,Ce,S)>0&&(ye=true,C?.()),ue&&!se?(se=true,g?.(),Me<($==="infinite"?1/0:$??0)&&(Me++,Le=setTimeout(()=>{ve=-1,ye=false,se=false,$e.clear(),Ge();},N))):!ue&&!Q&&(se=false),re=requestAnimationFrame(je);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{Be=a.isIntersecting,Be&&!le?re=requestAnimationFrame(je):cancelAnimationFrame(re);});},{root:U??null,threshold:O,rootMargin:G}),Je;function Xe(){clearTimeout(Je),Je=setTimeout(()=>{W.forEach((o,a)=>{k[a]=Ye(o),o.style.strokeDasharray=`${k[a]}`;}),at();},150);}return window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe),q>0?setTimeout(()=>Ze.observe(e),q):Ze.observe(e),{destroy(){cancelAnimationFrame(re),clearTimeout(Le),Ze.disconnect(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,We=-1,_e=-1,ye=false,se=false,Me=0,le=false,$e.clear(),clearTimeout(Le),Ge();},pause(){le=true,cancelAnimationFrame(re);},resume(){le&&(le=false,Be&&(re=requestAnimationFrame(je)));},seek(o){let a=Math.min(1,Math.max(0,o));ke=a,ve=a,le=true,cancelAnimationFrame(re),Et(a,E);},getProgress(){return ke}}}var dt=new Map;function Pe(e,r){dt.set(e,r);}function Oe(e){dt.delete(e);}function Ft(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function gt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],m=t[2].trim();if(m)for(let c of m.split(/[\s,]+/)){let u=c.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function It(e,r,n){let t=gt(e),l=gt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,m)=>{let c=l[m];return s.fn!==c.fn||s.nums.length!==c.nums.length?n<1?`${s.fn}(${s.nums.map((u,h)=>`${u}${s.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,h)=>`${u+(c.nums[h]-u)*n}${s.units[h]}`).join(", ")})`}).join(" ")}function yt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Ft(t))return Re(t,l,n);if(t.includes("("))return It(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let c=parseFloat(s[1]),u=parseFloat(m[1]);return `${c+(u-c)*n}${s[2]||m[2]}`}return n<1?t:l}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ht={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Rt=0;function Ht(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:m=1,once:c=false,axis:u="y",scrollContainer:h,native:L=true,onProgress:_,onComplete:E,onEnter:Q,onLeave:he,onEnterBack:H,onLeaveBack:ee}=r,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof s=="function"?s:ie[s]??ie["ease-out"],x=ae(l.start??"top bottom"),A=ae(l.end??"bottom top"),w=typeof h=="string"?document.querySelector(h):h??null,b=Object.entries(t).map(([i,p])=>({prop:Nt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function P(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function O(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return O(),E?.(),n;P();function G(){if(!L||!Ht()||typeof s!="string"||!(s in ht)||u!=="y"||w||c||m!==1||_||E||Q||he||H||ee||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!Dt.has(i.prop))return false;return true}function $(){let i=`ssd-a-${++Rt}`,p=b.map(J=>`${J.prop}:${J.from}`).join(";"),X=b.map(J=>`${J.prop}:${J.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${p}}to{${X}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ht[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let Z=()=>u==="x"?window.scrollX:window.scrollY,oe=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),R.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let W=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let k of b)e.style.setProperty(k.prop,yt(k.from,k.to,W));},getProgress(){let J=e.getBoundingClientRect(),W=Z(),k=oe(),{tStart:fe,tEnd:ge}=pe({top:J.top,height:J.height},W,k,x,A);return q(K(W,fe,ge,m))}}}if(G())return $();let N=0,M=0,z=0,ne=false,D=false,B=-1,d=0,C=false,g=NaN,y=()=>w?u==="x"?w.scrollLeft:w.scrollTop:u==="x"?window.scrollX:window.scrollY,j=()=>w?u==="x"?w.clientWidth:w.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function Ae(){let i=e.getBoundingClientRect(),p,X;if(w){let Z=w.getBoundingClientRect();p=u==="x"?i.left-Z.left+w.scrollLeft:i.top-Z.top+w.scrollTop,X=u==="x"?i.width:i.height;}else p=u==="x"?i.left:i.top,X=u==="x"?i.width:i.height;let R=pe({top:p,height:X},y(),j(),x,A);N=R.tStart,M=R.tEnd;}function be(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let p of b)e.style.setProperty(p.prop,yt(p.from,p.to,i));_?.(i);}function we(i){if(isNaN(g)){g=i;return}g<=0&&i>0?Q?.():g>0&&i<=0&&ee?.(),g<1&&i>=1?he?.():g>=1&&i<1&&H?.(),g=i;}function de(){if(!ne||D)return;let i=M===N?0:(y()-N)/(M-N);we(i);let p=q(K(y(),N,M,m));c&&(B=Math.max(B,p),p=B),d=p,be(p),p>=1&&!C?(C=true,E?.()):p<1&&!c&&(C=false),z=requestAnimationFrame(de);}Ae();{let i=q(K(y(),N,M,m));c&&i>0&&(B=i),d=i,be(i);}let He=new IntersectionObserver(i=>{i.forEach(p=>{ne=p.isIntersecting,ne&&!D?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),Ie;function U(){clearTimeout(Ie),Ie=setTimeout(Ae,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),He.observe(e),Pe(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:N,tEnd:M})}),{destroy(){cancelAnimationFrame(z),He.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(Ie),Oe(e);},replay(){B=-1,C=false,d=0,D=false,be(0);},pause(){D=true,cancelAnimationFrame(z);},resume(){D&&(D=false,ne&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,B=p,D=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,r){if(typeof window>"u")return tt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),tt;let t=n,{from:l=0,to:s,format:m,easing:c="ease-out",trigger:u={},once:h=true,decimals:L,onComplete:_}=r,E=L!==void 0?d=>d.toFixed(L):m??(d=>String(Math.round(d))),Q=typeof c=="function"?c:ie[c]??ie["ease-out"],he=ae(u.start??"top 80%"),H=ae(u.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(s),_?.(),tt;t.textContent=E(l);let te=0,q=0,x=0,A=false,w=false,b=-1,P=0,O=false,G=()=>window.scrollY,$=()=>window.innerHeight;function N(){let d=t.getBoundingClientRect(),C=pe({top:d.top,height:d.height},G(),$(),he,H);te=C.tStart,q=C.tEnd;}function M(d){t.textContent=E(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));h&&(b=Math.max(b,d),d=b),P=d,M(d),d>=1&&!O?(O=true,_?.()):d<1&&!h&&(O=false),x=requestAnimationFrame(z);}N();{let d=Q(K(G(),te,q,1));h&&d>0&&(b=d),P=d,M(d);}let ne=new IntersectionObserver(d=>{d.forEach(C=>{A=C.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),D;function B(){clearTimeout(D),D=setTimeout(N,150);}return window.addEventListener("resize",B),window.addEventListener("orientationchange",B),ne.observe(t),Pe(t,{type:"counter",getProgress:()=>P,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),ne.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("orientationchange",B),clearTimeout(D),Oe(t);},replay(){b=-1,O=false,P=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let C=Math.min(1,Math.max(0,d));P=C,b=C,w=true,cancelAnimationFrame(x),M(C);},getProgress(){return P}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,r={}){if(typeof window>"u")return bt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),bt;let t=n,{trigger:l={},easing:s="linear",once:m=false,axis:c="y",preload:u="auto",onReady:h,onComplete:L,onProgress:_}=r,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof s=="function"?s:ie[s]??ie.linear,he=ae(l.start??"top top"),H=ae(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=u);let ee=r.from??0,te=r.to,q=0,x=0,A=0,w=false,b=false,P=-1,O=0,G=false,$=false,N=()=>c==="x"?window.scrollX:window.scrollY,M=()=>c==="x"?window.innerWidth:window.innerHeight;function z(){let y=t.getBoundingClientRect(),j=c==="x"?y.left:y.top,Ae=c==="x"?y.width:y.height,be=pe({top:j,height:Ae},N(),M(),he,H);q=be.tStart,x=be.tEnd;}function ne(y){if(!$)return;let j=te??t.duration??0;t.currentTime=ee+(j-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),_?.(y);}function D(){if(!w||b||!$)return;let y=Q(K(N(),q,x,1));m&&(P=Math.max(P,y),y=P),O=y,ne(y),y>=1&&!G?(G=true,L?.()):y<1&&!m&&(G=false),A=requestAnimationFrame(D);}function B(){if($=true,te===void 0&&(te=t.duration),E){ne(1),h?.();return}z(),h?.(),w&&!b&&(A=requestAnimationFrame(D));}t.readyState>=1?B():t.addEventListener("loadedmetadata",B,{once:true}),$||z();let d=new IntersectionObserver(y=>{y.forEach(j=>{w=j.isIntersecting,w&&!b&&$?A=requestAnimationFrame(D):cancelAnimationFrame(A);});}),C;function g(){clearTimeout(C),C=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Pe(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",B),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(C),Oe(t);},replay(){P=-1,G=false,O=0,b=false,ne(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&$&&(A=requestAnimationFrame(D)));},seek(y){let j=Math.min(1,Math.max(0,y));O=j,P=j,b=true,cancelAnimationFrame(A),ne(j);},getProgress(){return O}}}function St(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function zt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function wt(e){let r=St(e),n=new Map;for(let s of r){let m=s.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(s);}let t=[],l=Array.from(n.keys()).sort((s,m)=>s-m);for(let s of l){let m=n.get(s),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block";for(let u of m)c.appendChild(u);t.push(c);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function Vt(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,m=s+(1-l);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ot(e,r={}){if(typeof window>"u")return vt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),vt;let t=n,{split:l="words",stagger:s=.04,easing:m="ease-out",from:c={opacity:0,y:24},trigger:u={},once:h=true,onComplete:L}=r,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof m=="function"?m:ie[m]??ie["ease-out"],Q=ae(u.start??"top 85%"),he=ae(u.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;l==="chars"?ee=zt(t):l==="lines"?ee=wt(t):ee=St(t);let te=ee.length;function q(g,y){c?.opacity!==void 0&&(g.style.opacity=String(c.opacity+(1-c.opacity)*y));let j=qt(y,c);j&&(g.style.transform=j);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((y,j)=>{let Ae=E(Vt(g,j,te,s));q(y,Ae);});}if(_)return x(1),L?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let A=0,w=0,b=0,P=false,O=false,G=-1,$=0,N=false,M=()=>window.scrollY,z=()=>window.innerHeight;function ne(){let g=t.getBoundingClientRect(),y=pe({top:g.top,height:g.height},M(),z(),Q,he);A=y.tStart,w=y.tEnd;}function D(){if(!P||O)return;let g=K(M(),A,w,1);h&&(G=Math.max(G,g),g=G),$=g,x(g),g>=1&&!N?(N=true,L?.()):g<1&&!h&&(N=false),b=requestAnimationFrame(D);}ne();let B=new IntersectionObserver(g=>{g.forEach(y=>{P=y.isIntersecting,P&&!O?b=requestAnimationFrame(D):cancelAnimationFrame(b);});}),d;function C(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=$;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),ee=wt(t),x(g);}ne();},150);}return window.addEventListener("resize",C),window.addEventListener("orientationchange",C),B.observe(t),Pe(t,{type:"text",getProgress:()=>$,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),B.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Oe(t);},replay(){G=-1,N=false,$=0,O=false,x(0);},pause(){O=true,cancelAnimationFrame(b);},resume(){O&&(O=false,P&&(b=requestAnimationFrame(D)));},seek(g){let y=Math.min(1,Math.max(0,g));$=y,G=y,O=true,cancelAnimationFrame(b),x(y);},getProgress(){return $}}}function pn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=Qe(r.value,e);onUnmounted(()=>n.destroy());}),r}var dn=defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=Qe(n.value,t);onUnmounted(()=>l.destroy());}),()=>h("div",{ref:n},r.default?.())}});function gn(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=et(r.value,e);onUnmounted(()=>n.destroy());}),r}var yn=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=et(n.value,e.options);onUnmounted(()=>t.destroy());}),()=>h("div",{ref:n},r.default?.())}});function hn(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=nt(r.value,e);onUnmounted(()=>n.destroy());}),r}var bn=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=nt(r.value,n);onUnmounted(()=>t.destroy());}),()=>h("span",{ref:r})}});function wn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=rt(r.value,e);onUnmounted(()=>n.destroy());}),r}var vn=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=rt(r.value,e.options??{});onUnmounted(()=>n.destroy());}),()=>h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Sn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=ot(r.value,e);onUnmounted(()=>n.destroy());}),r}var En=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=ot(n.value,e.options??{});onUnmounted(()=>t.destroy());}),()=>h(e.tag,{ref:n},r.default?.())}});export{yn as ScrollAnimate,bn as ScrollCounter,dn as ScrollDraw,En as ScrollText,vn as ScrollVideo,gn as useScrollAnimate,hn as useScrollCounter,pn as useScrollDraw,Sn as useScrollText,wn as useScrollVideo};
3
+ <div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}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(),t}function Ke(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),c=t[l++]??m;return String(+(m+(c-m)*n).toFixed(4))})}function Qe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...ft[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:c=1,fade:u=false,easing:h="linear",trigger:P={},stagger:H=0,direction:S="forward",once:Y=false,debug:he=false,axis:V="y",scrollContainer:ee,autoReverse:U=false,delay:Z=0,strokeColor:E,strokeWidth:M,fillOpacity:C,waypoints:g,velocityScale:x=false,threshold:k=0,rootMargin:G="0px",repeat:O=0,repeatDelay:se=0,morphTo:L,clip:W,autoplay:_=false,duration:j=1e3,native:z=true,onProgress:p,onStart:T,onComplete:b,onEnter:y,onLeave:q,onEnterBack:Ae,onLeaveBack:Me}=l,be=W===true?"left":typeof W=="string"?W:false,we=typeof h=="function"?h:ae[h]??ae.linear,ke=le(P.start??"top bottom"),qe=le(P.end??"bottom top"),te=typeof ee=="string"?document.querySelector(ee):ee??null,pe=Array.isArray(E)?E[0]:null,J=Array.isArray(E)?E[1]:typeof E=="string"?E:null,K=Array.isArray(M)?M[0]:null,i=Array.isArray(M)?M[1]:typeof M=="number"?M:null,d=Array.isArray(C)?C[0]:null,F=Array.isArray(C)?C[1]:typeof C=="number"?C:null;function ne(o){let a=o*100;switch(be){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 $=be?[]:Array.from(e.querySelectorAll(m)),R=[],I=[],ie=0,ce=0,re=false,de=false,oe=0,Be=false,ve=-1,We=-1,ue=false,Fe=0,Ce=0,Le,Ue=null,$e=new Set,_e=-1,st=performance.now(),Ne=NaN;function He(){return te?V==="x"?te.scrollLeft:te.scrollTop:V==="x"?window.scrollX:window.scrollY}function it(){return te?V==="x"?te.clientWidth:te.clientHeight:V==="x"?window.innerWidth:window.innerHeight}function at(){let o=e.getBoundingClientRect(),a,v,X;if(te){let me=te.getBoundingClientRect();a=V==="x"?o.left-me.left+te.scrollLeft:o.top-me.top+te.scrollTop,v=V==="x"?o.width:o.height,X=He();}else a=V==="x"?o.left:o.top,v=V==="x"?o.width:o.height,X=He();let fe=ye({top:a,height:v},X,it(),ke,qe);ie=fe.tStart,ce=fe.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=kt(ie,ce,V));}function Et(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),be){let v=a==="reverse"?1-o:o;e.style.clipPath=ne(v);return}$.forEach((v,X)=>{v.style.strokeDashoffset=a==="reverse"?`${R[X]*o}`:`${R[X]*(1-o)}`,u&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&J?v.style.stroke=Re(pe,J,o):J&&(v.style.stroke=J),K!==null&&i!==null?v.style.strokeWidth=`${K+(i-K)*o}`:i!==null&&(v.style.strokeWidth=`${i}`),d!==null&&F!==null?v.style.fillOpacity=`${d+(F-d)*o}`:F!==null&&(v.style.fillOpacity=`${F}`),L&&v.tagName.toLowerCase()==="path"&&I[X]&&v.setAttribute("d",Ke(I[X],L,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),be){e.style.clipPath=ne(0);return}$.forEach((o,a)=>{o.style.strokeDasharray=`${R[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${R[a]}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`),L&&o.tagName.toLowerCase()==="path"&&I[a]&&o.setAttribute("d",I[a]);});}if($.forEach(o=>{Ot(o);let a=Ye(o);R.push(a),o.tagName.toLowerCase()==="path"?I.push(o.getAttribute("d")??""):I.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",u&&(o.style.opacity="1"),J&&(o.style.stroke=J),i!==null&&(o.style.strokeWidth=`${i}`),F!==null&&(o.style.fillOpacity=`${F}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`));}),be){if(s)return e.style.clipPath=ne(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ne(0);}else if(s)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(z===false||!Pt()||!$.length||typeof h!="string"||!(h in pt)||be||V!=="y"||te||c!==1||H!==0||Y||U||x!==false||L||g||O||Z>0||p||T||b||y||q||Ae||Me||E!=null||M!=null||C!=null||(P.start??"top bottom").trim()!=="top bottom"||(P.end??"bottom top").trim()!=="bottom top")}function Tt(){let o=`svg-scroll-draw-${++$t}`,a=S==="reverse"?"0":"var(--ssd-len)",v=S==="reverse"?"var(--ssd-len)":"0",X=`stroke-dashoffset:${a};`,fe=`stroke-dashoffset:${v};`;u&&(X+=`opacity:${S==="reverse"?1:0};`,fe+=`opacity:${S==="reverse"?0:1};`);let me=document.createElement("style");me.setAttribute("data-svg-scroll-draw",""),me.textContent=`@keyframes ${o}{from{${X}}to{${fe}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${pt[h]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(me);function ge(f,A){f.style.setProperty("--ssd-len",String(R[A])),f.style.strokeDasharray=`${R[A]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(o);}$.forEach(ge);let w=false,N=-1;function D(){if(N>=0)return N;let f=e.getBoundingClientRect(),{tStart:A,tEnd:B}=ye({top:f.top,height:f.height},He(),it(),ke,qe);return we(Q(He(),A,B,c))}return {destroy(){$.forEach(f=>{f.classList.remove(o),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),me.remove();},replay(){w=false,N=-1,$.forEach(ge);},pause(){w=true,$.forEach(f=>{f.style.animationPlayState="paused";});},resume(){w&&(w=false,$.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let A=Math.min(1,Math.max(0,f));N=A,w=true,$.forEach((B,Ie)=>{B.classList.remove(o),B.style.strokeDashoffset=S==="reverse"?`${R[Ie]*A}`:`${R[Ie]*(1-A)}`,u&&(B.style.opacity=S==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return D()}}}if(xt())return Tt();function At(){let o=Math.max(1,j),a=0,v=0;function X(D){let f=true;if(be){let A=Math.min(1,Math.max(0,D/o)),B=we(A);Fe=B,e.style.setProperty("--scroll-draw-progress",String(B)),e.style.clipPath=ne(S==="reverse"?1-B:B),p?.(B),A<1&&(f=false);}else $.forEach((A,B)=>{let Ie=B*H*o,De=Math.min(1,Math.max(0,(D-Ie)/o)),Se=we(De);A.style.strokeDashoffset=S==="reverse"?`${R[B]*Se}`:`${R[B]*(1-Se)}`,u&&(A.style.opacity=S==="reverse"?`${1-Se}`:`${Se}`),pe&&J?A.style.stroke=Re(pe,J,Se):J&&(A.style.stroke=J),K!==null&&i!==null?A.style.strokeWidth=`${K+(i-K)*Se}`:i!==null&&(A.style.strokeWidth=`${i}`),d!==null&&F!==null?A.style.fillOpacity=`${d+(F-d)*Se}`:F!==null&&(A.style.fillOpacity=`${F}`),L&&A.tagName.toLowerCase()==="path"&&I[B]&&A.setAttribute("d",Ke(I[B],L,Se)),B===0&&(p?.(Se),e.style.setProperty("--scroll-draw-progress",String(Se))),De<1&&(f=false);});if(g){let A=Math.min(1,Math.max(0,D/o)),B=we(A);for(let Ie in g){let De=parseFloat(Ie);B>=De&&!$e.has(De)&&($e.add(De),g[Ie]?.());}}return f}function fe(D){if(ue)return;let f=D-a;de||(de=true,T?.());let A=X(f);if(A&&!re){re=true,X(o*(1+Math.max(0,$.length-1)*H)),b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{a=performance.now(),de=false,re=false,$e.clear(),Ge(),oe=requestAnimationFrame(fe);},se));return}A||(oe=requestAnimationFrame(fe));}function me(){cancelAnimationFrame(oe),clearTimeout(Le),a=performance.now(),v=0,ue=false,de=false,re=false,Ce=0,$e.clear(),Ge(),oe=requestAnimationFrame(fe);}let ge=new IntersectionObserver(D=>{D.forEach(f=>{f.isIntersecting&&!(Y&&re)?me():!f.isIntersecting&&!Y&&!re&&(cancelAnimationFrame(oe),clearTimeout(Le),a=null);});},{root:te??null,threshold:k,rootMargin:G}),w;function N(){clearTimeout(w),w=setTimeout(()=>{$.forEach((D,f)=>{R[f]=Ye(D),D.style.strokeDasharray=`${R[f]}`;});},150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),Z>0?setTimeout(()=>ge.observe(e),Z):ge.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),ge.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(w);},replay(){Ce=0,me();},pause(){ue||(ue=true,v=performance.now()-a,cancelAnimationFrame(oe));},resume(){ue&&(ue=false,a=performance.now()-v,oe=requestAnimationFrame(fe));},seek(D){let f=Math.min(1,Math.max(0,D));Fe=f,ue=true,v=f*o,a=performance.now()-v,cancelAnimationFrame(oe),X(v);},getProgress(){return Fe}}}if(_)return At();at();function je(){if(!Be||ue)return;let o=performance.now(),a=He(),v=c;if(x!==false){let w=o-st,N=w>0?Math.abs(a-(_e<0?a:_e))/w:0;v=c*Math.max(.2,1+N*(typeof x=="number"?x:1)*.04);}_e=a,st=o;let X=U?We===-1||a>=We?"forward":"reverse":S;We=a;let fe=ce-ie,me=true,ge=fe===0?0:(a-ie)/fe;if(isNaN(Ne)||(Ne<=0&&ge>0?y?.():Ne>0&&ge<=0&&Me?.(),Ne<1&&ge>=1?q?.():Ne>=1&&ge<1&&Ae?.()),Ne=ge,be){let w=we(Q(a,ie,ce,v));Y&&!U&&(ve=Math.max(ve,w),w=ve),Fe=w,e.style.setProperty("--scroll-draw-progress",String(w));let N=X==="reverse"?1-w:w;e.style.clipPath=ne(N),p?.(w),!de&&Q(a,ie,ce,v)>0&&(de=true,T?.()),w>=1&&!re?(re=true,b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{ve=-1,de=false,re=false,e.style.clipPath=ne(0);},se))):w<1&&!Y&&(re=false),oe=requestAnimationFrame(je);return}if($.forEach((w,N)=>{let D=N*H*fe,f=we(Q(a,ie+D,ce+D,v));Y&&!U&&(ve=Math.max(ve,f),f=ve),Fe=f,w.style.strokeDashoffset=X==="reverse"?`${R[N]*f}`:`${R[N]*(1-f)}`,u&&(w.style.opacity=X==="reverse"?`${1-f}`:`${f}`),pe&&J?w.style.stroke=Re(pe,J,f):J&&(w.style.stroke=J),K!==null&&i!==null?w.style.strokeWidth=`${K+(i-K)*f}`:i!==null&&(w.style.strokeWidth=`${i}`),d!==null&&F!==null?w.style.fillOpacity=`${d+(F-d)*f}`:F!==null&&(w.style.fillOpacity=`${F}`),L&&w.tagName.toLowerCase()==="path"&&I[N]&&w.setAttribute("d",Ke(I[N],L,f)),N===0&&(p?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(me=false);}),g){let w=we(Q(a,ie,ce,v));for(let N in g){let D=parseFloat(N);w>=D&&!$e.has(D)&&($e.add(D),g[N]?.());}}!de&&Q(a,ie,ce,v)>0&&(de=true,T?.()),me&&!re?(re=true,b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{ve=-1,de=false,re=false,$e.clear(),Ge();},se))):!me&&!Y&&(re=false),oe=requestAnimationFrame(je);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{Be=a.isIntersecting,Be&&!ue?oe=requestAnimationFrame(je):cancelAnimationFrame(oe);});},{root:te??null,threshold:k,rootMargin:G}),Je;function Xe(){clearTimeout(Je),Je=setTimeout(()=>{$.forEach((o,a)=>{R[a]=Ye(o),o.style.strokeDasharray=`${R[a]}`;}),at();},150);}return window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe),Z>0?setTimeout(()=>Ze.observe(e),Z):Ze.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),Ze.disconnect(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,We=-1,_e=-1,de=false,re=false,Ce=0,ue=false,$e.clear(),clearTimeout(Le),Ge();},pause(){ue=true,cancelAnimationFrame(oe);},resume(){ue&&(ue=false,Be&&(oe=requestAnimationFrame(je)));},seek(o){let a=Math.min(1,Math.max(0,o));Fe=a,ve=a,ue=true,cancelAnimationFrame(oe),Et(a,S);},getProgress(){return Fe}}}var dt=new Map;function Pe(e,r){dt.set(e,r);}function Oe(e){dt.delete(e);}function Ft(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function gt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],m=t[2].trim();if(m)for(let c of m.split(/[\s,]+/)){let u=c.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function It(e,r,n){let t=gt(e),l=gt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,m)=>{let c=l[m];return s.fn!==c.fn||s.nums.length!==c.nums.length?n<1?`${s.fn}(${s.nums.map((u,h)=>`${u}${s.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,h)=>`${u+(c.nums[h]-u)*n}${s.units[h]}`).join(", ")})`}).join(" ")}function yt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Ft(t))return Re(t,l,n);if(t.includes("("))return It(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let c=parseFloat(s[1]),u=parseFloat(m[1]);return `${c+(u-c)*n}${s[2]||m[2]}`}return n<1?t:l}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ht={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Rt=0;function Ht(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:m=1,once:c=false,axis:u="y",scrollContainer:h,native:P=true,velocityScale:H=false,onProgress:S,onComplete:Y,onEnter:he,onLeave:V,onEnterBack:ee,onLeaveBack:U}=r,Z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof s=="function"?s:ae[s]??ae["ease-out"],M=le(l.start??"top bottom"),C=le(l.end??"bottom top"),g=typeof h=="string"?document.querySelector(h):h??null,x=Object.entries(t).map(([i,d])=>({prop:Nt(i),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function k(){let i=window.getComputedStyle(e);for(let d of x)d.from===""&&(d.from=i.getPropertyValue(d.prop).trim()||"0");}function G(){for(let i of x)e.style.setProperty(i.prop,String(i.to));}if(Z)return G(),Y?.(),n;k();function O(){if(!P||!Ht()||typeof s!="string"||!(s in ht)||u!=="y"||g||c||m!==1||S||Y||he||V||ee||U||H!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of x)if(!Dt.has(i.prop))return false;return true}function se(){let i=`ssd-a-${++Rt}`,d=x.map(I=>`${I.prop}:${I.from}`).join(";"),F=x.map(I=>`${I.prop}:${I.to}`).join(";"),ne=document.createElement("style");ne.setAttribute("data-ssd-animate",""),ne.textContent=`@keyframes ${i}{from{${d}}to{${F}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ht[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ne),e.classList.add(i);let $=()=>u==="x"?window.scrollX:window.scrollY,R=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),ne.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let ie=Math.min(1,Math.max(0,I));e.classList.remove(i);for(let ce of x)e.style.setProperty(ce.prop,yt(ce.from,ce.to,ie));},getProgress(){let I=e.getBoundingClientRect(),ie=$(),ce=R(),{tStart:re,tEnd:de}=ye({top:I.top,height:I.height},ie,ce,M,C);return E(Q(ie,re,de,m))}}}if(O())return se();let L=0,W=0,_=0,j=false,z=false,p=-1,T=0,b=false,y=NaN,q=-1,Ae=0,Me=()=>g?u==="x"?g.scrollLeft:g.scrollTop:u==="x"?window.scrollX:window.scrollY,be=()=>g?u==="x"?g.clientWidth:g.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function we(){let i=e.getBoundingClientRect(),d,F;if(g){let $=g.getBoundingClientRect();d=u==="x"?i.left-$.left+g.scrollLeft:i.top-$.top+g.scrollTop,F=u==="x"?i.width:i.height;}else d=u==="x"?i.left:i.top,F=u==="x"?i.width:i.height;let ne=ye({top:d,height:F},Me(),be(),M,C);L=ne.tStart,W=ne.tEnd;}function ke(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let d of x)e.style.setProperty(d.prop,yt(d.from,d.to,i));S?.(i);}function qe(i){if(isNaN(y)){y=i;return}y<=0&&i>0?he?.():y>0&&i<=0&&U?.(),y<1&&i>=1?V?.():y>=1&&i<1&&ee?.(),y=i;}function te(){if(!j||z)return;let i=performance.now(),d=Me(),F=m;if(H!==false){let R=i-Ae,I=R>0?Math.abs(d-(q<0?d:q))/R:0;F=m*Math.max(.2,1+I*(typeof H=="number"?H:1)*.04);}q=d,Ae=i;let ne=W===L?0:(d-L)/(W-L);qe(ne);let $=E(Q(d,L,W,F));c&&(p=Math.max(p,$),$=p),T=$,ke($),$>=1&&!b?(b=true,Y?.()):$<1&&!c&&(b=false),_=requestAnimationFrame(te);}we();{let i=E(Q(Me(),L,W,m));c&&i>0&&(p=i),T=i,ke(i);}let pe=new IntersectionObserver(i=>{i.forEach(d=>{j=d.isIntersecting,j&&!z?_=requestAnimationFrame(te):cancelAnimationFrame(_);});},{root:g??null}),J;function K(){clearTimeout(J),J=setTimeout(we,150);}return window.addEventListener("resize",K),window.addEventListener("orientationchange",K),pe.observe(e),Pe(e,{type:"animate",getProgress:()=>T,getTrigger:()=>({tStart:L,tEnd:W})}),{destroy(){cancelAnimationFrame(_),pe.disconnect(),window.removeEventListener("resize",K),window.removeEventListener("orientationchange",K),clearTimeout(J),Oe(e);},replay(){p=-1,b=false,T=0,z=false,ke(0);},pause(){z=true,cancelAnimationFrame(_);},resume(){z&&(z=false,j&&(_=requestAnimationFrame(te)));},seek(i){let d=Math.min(1,Math.max(0,i));T=d,p=d,z=true,cancelAnimationFrame(_),ke(d);},getProgress(){return T}}}var tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,r){if(typeof window>"u")return tt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),tt;let t=n,{from:l=0,to:s,format:m,easing:c="ease-out",trigger:u={},once:h=true,decimals:P,onComplete:H}=r,S=P!==void 0?p=>p.toFixed(P):m??(p=>String(Math.round(p))),Y=typeof c=="function"?c:ae[c]??ae["ease-out"],he=le(u.start??"top 80%"),V=le(u.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(s),H?.(),tt;t.textContent=S(l);let U=0,Z=0,E=0,M=false,C=false,g=-1,x=0,k=false,G=()=>window.scrollY,O=()=>window.innerHeight;function se(){let p=t.getBoundingClientRect(),T=ye({top:p.top,height:p.height},G(),O(),he,V);U=T.tStart,Z=T.tEnd;}function L(p){t.textContent=S(l+(s-l)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function W(){if(!M||C)return;let p=Y(Q(G(),U,Z,1));h&&(g=Math.max(g,p),p=g),x=p,L(p),p>=1&&!k?(k=true,H?.()):p<1&&!h&&(k=false),E=requestAnimationFrame(W);}se();{let p=Y(Q(G(),U,Z,1));h&&p>0&&(g=p),x=p,L(p);}let _=new IntersectionObserver(p=>{p.forEach(T=>{M=T.isIntersecting,M&&!C?E=requestAnimationFrame(W):cancelAnimationFrame(E);});}),j;function z(){clearTimeout(j),j=setTimeout(se,150);}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),_.observe(t),Pe(t,{type:"counter",getProgress:()=>x,getTrigger:()=>({tStart:U,tEnd:Z})}),{destroy(){cancelAnimationFrame(E),_.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(j),Oe(t);},replay(){g=-1,k=false,x=0,C=false,L(0);},pause(){C=true,cancelAnimationFrame(E);},resume(){C&&(C=false,M&&(E=requestAnimationFrame(W)));},seek(p){let T=Math.min(1,Math.max(0,p));x=T,g=T,C=true,cancelAnimationFrame(E),L(T);},getProgress(){return x}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,r={}){if(typeof window>"u")return bt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),bt;let t=n,{trigger:l={},easing:s="linear",once:m=false,axis:c="y",preload:u="auto",onReady:h,onComplete:P,onProgress:H}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Y=typeof s=="function"?s:ae[s]??ae.linear,he=le(l.start??"top top"),V=le(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=u);let ee=r.from??0,U=r.to,Z=0,E=0,M=0,C=false,g=false,x=-1,k=0,G=false,O=false,se=()=>c==="x"?window.scrollX:window.scrollY,L=()=>c==="x"?window.innerWidth:window.innerHeight;function W(){let y=t.getBoundingClientRect(),q=c==="x"?y.left:y.top,Ae=c==="x"?y.width:y.height,Me=ye({top:q,height:Ae},se(),L(),he,V);Z=Me.tStart,E=Me.tEnd;}function _(y){if(!O)return;let q=U??t.duration??0;t.currentTime=ee+(q-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),H?.(y);}function j(){if(!C||g||!O)return;let y=Y(Q(se(),Z,E,1));m&&(x=Math.max(x,y),y=x),k=y,_(y),y>=1&&!G?(G=true,P?.()):y<1&&!m&&(G=false),M=requestAnimationFrame(j);}function z(){if(O=true,U===void 0&&(U=t.duration),S){_(1),h?.();return}W(),h?.(),C&&!g&&(M=requestAnimationFrame(j));}t.readyState>=1?z():t.addEventListener("loadedmetadata",z,{once:true}),O||W();let p=new IntersectionObserver(y=>{y.forEach(q=>{C=q.isIntersecting,C&&!g&&O?M=requestAnimationFrame(j):cancelAnimationFrame(M);});}),T;function b(){clearTimeout(T),T=setTimeout(W,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),p.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:Z,tEnd:E})}),{destroy(){cancelAnimationFrame(M),p.disconnect(),t.removeEventListener("loadedmetadata",z),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),Oe(t);},replay(){x=-1,G=false,k=0,g=false,_(0);},pause(){g=true,cancelAnimationFrame(M);},resume(){g&&(g=false,C&&O&&(M=requestAnimationFrame(j)));},seek(y){let q=Math.min(1,Math.max(0,y));k=q,x=q,g=true,cancelAnimationFrame(M),_(q);},getProgress(){return k}}}function St(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function Vt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function wt(e){let r=St(e),n=new Map;for(let s of r){let m=s.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(s);}let t=[],l=Array.from(n.keys()).sort((s,m)=>s-m);for(let s of l){let m=n.get(s),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block";for(let u of m)c.appendChild(u);t.push(c);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function zt(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,m=s+(1-l);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ot(e,r={}){if(typeof window>"u")return vt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),vt;let t=n,{split:l="words",stagger:s=.04,easing:m="ease-out",from:c={opacity:0,y:24},trigger:u={},once:h=true,onComplete:P}=r,H=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof m=="function"?m:ae[m]??ae["ease-out"],Y=le(u.start??"top 85%"),he=le(u.end??"top 40%"),V=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;l==="chars"?ee=Vt(t):l==="lines"?ee=wt(t):ee=St(t);let U=ee.length;function Z(b,y){c?.opacity!==void 0&&(b.style.opacity=String(c.opacity+(1-c.opacity)*y));let q=qt(y,c);q&&(b.style.transform=q);}function E(b){t.style.setProperty("--scroll-draw-progress",String(b)),ee.forEach((y,q)=>{let Ae=S(zt(b,q,U,s));Z(y,Ae);});}if(H)return E(1),P?.(),{destroy(){t.innerHTML=V,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};E(0);let M=0,C=0,g=0,x=false,k=false,G=-1,O=0,se=false,L=()=>window.scrollY,W=()=>window.innerHeight;function _(){let b=t.getBoundingClientRect(),y=ye({top:b.top,height:b.height},L(),W(),Y,he);M=y.tStart,C=y.tEnd;}function j(){if(!x||k)return;let b=Q(L(),M,C,1);h&&(G=Math.max(G,b),b=G),O=b,E(b),b>=1&&!se?(se=true,P?.()):b<1&&!h&&(se=false),g=requestAnimationFrame(j);}_();let z=new IntersectionObserver(b=>{b.forEach(y=>{x=y.isIntersecting,x&&!k?g=requestAnimationFrame(j):cancelAnimationFrame(g);});}),p;function T(){clearTimeout(p),p=setTimeout(()=>{if(l==="lines"){let b=O;t.innerHTML=V,t.setAttribute("aria-label",t.textContent??""),ee=wt(t),E(b);}_();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),z.observe(t),Pe(t,{type:"text",getProgress:()=>O,getTrigger:()=>({tStart:M,tEnd:C})}),{destroy(){cancelAnimationFrame(g),z.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(p),t.innerHTML=V,t.removeAttribute("aria-label"),Oe(t);},replay(){G=-1,se=false,O=0,k=false,E(0);},pause(){k=true,cancelAnimationFrame(g);},resume(){k&&(k=false,x&&(g=requestAnimationFrame(j)));},seek(b){let y=Math.min(1,Math.max(0,b));O=y,G=y,k=true,cancelAnimationFrame(g),E(y);},getProgress(){return O}}}function pn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=Qe(r.value,e);onUnmounted(()=>n.destroy());}),r}var dn=defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=Qe(n.value,t);onUnmounted(()=>l.destroy());}),()=>h("div",{ref:n},r.default?.())}});function gn(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=et(r.value,e);onUnmounted(()=>n.destroy());}),r}var yn=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=et(n.value,e.options);onUnmounted(()=>t.destroy());}),()=>h("div",{ref:n},r.default?.())}});function hn(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=nt(r.value,e);onUnmounted(()=>n.destroy());}),r}var bn=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=nt(r.value,n);onUnmounted(()=>t.destroy());}),()=>h("span",{ref:r})}});function wn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=rt(r.value,e);onUnmounted(()=>n.destroy());}),r}var vn=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=rt(r.value,e.options??{});onUnmounted(()=>n.destroy());}),()=>h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Sn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=ot(r.value,e);onUnmounted(()=>n.destroy());}),r}var En=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=ot(n.value,e.options??{});onUnmounted(()=>t.destroy());}),()=>h(e.tag,{ref:n},r.default?.())}});export{yn as ScrollAnimate,bn as ScrollCounter,dn as ScrollDraw,En as ScrollText,vn as ScrollVideo,gn as useScrollAnimate,hn as useScrollCounter,pn as useScrollDraw,Sn as useScrollText,wn as useScrollVideo};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svg-scroll-draw",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "description": "Scroll-driven SVG path drawing animation library — zero dependencies, ~4.4 KB gzipped, works with React, Vue, and vanilla JS",
5
5
  "keywords": [
6
6
  "svg",
@@ -156,6 +156,21 @@
156
156
  "types": "./dist/lenis/index.d.ts",
157
157
  "import": "./dist/lenis/index.mjs",
158
158
  "require": "./dist/lenis/index.cjs"
159
+ },
160
+ "./reveal": {
161
+ "types": "./dist/reveal/index.d.ts",
162
+ "import": "./dist/reveal/index.mjs",
163
+ "require": "./dist/reveal/index.cjs"
164
+ },
165
+ "./progress": {
166
+ "types": "./dist/progress/index.d.ts",
167
+ "import": "./dist/progress/index.mjs",
168
+ "require": "./dist/progress/index.cjs"
169
+ },
170
+ "./horizontal": {
171
+ "types": "./dist/horizontal/index.d.ts",
172
+ "import": "./dist/horizontal/index.mjs",
173
+ "require": "./dist/horizontal/index.cjs"
159
174
  }
160
175
  },
161
176
  "scripts": {