svg-scroll-draw 2.2.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +7 -7
  2. package/dist/angular/index.cjs +3 -3
  3. package/dist/angular/index.d.mts +194 -9
  4. package/dist/angular/index.d.ts +194 -9
  5. package/dist/angular/index.mjs +3 -3
  6. package/dist/astro/index.cjs +3 -3
  7. package/dist/astro/index.d.mts +78 -1
  8. package/dist/astro/index.d.ts +78 -1
  9. package/dist/astro/index.mjs +3 -3
  10. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  11. package/dist/devtools/index.cjs +1 -1
  12. package/dist/devtools/index.d.mts +12 -0
  13. package/dist/devtools/index.d.ts +12 -0
  14. package/dist/devtools/index.mjs +1 -1
  15. package/dist/group/index.cjs +3 -3
  16. package/dist/group/index.d.mts +88 -1
  17. package/dist/group/index.d.ts +88 -1
  18. package/dist/group/index.mjs +3 -3
  19. package/dist/index.cjs +4 -4
  20. package/dist/index.d.mts +16 -0
  21. package/dist/index.d.ts +16 -0
  22. package/dist/index.mjs +4 -4
  23. package/dist/lenis/index.cjs +1 -0
  24. package/dist/lenis/index.d.mts +51 -0
  25. package/dist/lenis/index.d.ts +51 -0
  26. package/dist/lenis/index.mjs +1 -0
  27. package/dist/nuxt/index.cjs +3 -3
  28. package/dist/nuxt/index.d.mts +286 -5
  29. package/dist/nuxt/index.d.ts +286 -5
  30. package/dist/nuxt/index.mjs +3 -3
  31. package/dist/pin/index.cjs +1 -0
  32. package/dist/pin/index.d.mts +29 -0
  33. package/dist/pin/index.d.ts +29 -0
  34. package/dist/pin/index.mjs +1 -0
  35. package/dist/react/index.cjs +3 -3
  36. package/dist/react/index.d.mts +16 -0
  37. package/dist/react/index.d.ts +16 -0
  38. package/dist/react/index.mjs +3 -3
  39. package/dist/snap/index.cjs +1 -0
  40. package/dist/snap/index.d.mts +30 -0
  41. package/dist/snap/index.d.ts +30 -0
  42. package/dist/snap/index.mjs +1 -0
  43. package/dist/solid/index.cjs +3 -3
  44. package/dist/solid/index.d.mts +171 -1
  45. package/dist/solid/index.d.ts +171 -1
  46. package/dist/solid/index.mjs +3 -3
  47. package/dist/svelte/index.cjs +3 -3
  48. package/dist/svelte/index.d.mts +183 -10
  49. package/dist/svelte/index.d.ts +183 -10
  50. package/dist/svelte/index.mjs +3 -3
  51. package/dist/vue/index.cjs +3 -3
  52. package/dist/vue/index.d.mts +278 -1
  53. package/dist/vue/index.d.ts +278 -1
  54. package/dist/vue/index.mjs +3 -3
  55. package/dist/web-component/index.cjs +3 -3
  56. package/dist/web-component/index.mjs +3 -3
  57. package/package.json +16 -1
@@ -1,3 +1,3 @@
1
- "use strict";var SvgScrollDraw=(()=>{var Xe=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var xt=Object.getOwnPropertyNames;var At=Object.prototype.hasOwnProperty;var Tt=(e,r)=>{for(var t in r)Xe(e,t,{get:r[t],enumerable:!0})},$t=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of xt(r))!At.call(e,i)&&i!==t&&Xe(e,i,{get:()=>r[i],enumerable:!(n=St(r,i))||n.enumerable});return e};var Mt=e=>$t(Xe({},"__esModule",{value:!0}),e);var _t={};Tt(_t,{Cinematic:()=>_e,PRESETS:()=>Re,createBounce:()=>Ye,createElastic:()=>Ue,createSpring:()=>it,scrollAnimate:()=>dt,scrollCounter:()=>yt,scrollDraw:()=>Wt,scrollParallax:()=>gt});function it({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Ye({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),i=Math.sqrt(n),s=0,d=[];for(let f=0;f<t;f++){let T=Math.pow(i,f);d.push(T),s+=T}let m=[0],l=0;for(let f=0;f<t;f++)l+=d[f]/s,m.push(l);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let T=0;T<t;T++)if(f<=m[T+1]){let F=(f-m[T])/(m[T+1]-m[T]);if(T===0)return F*(2-F);let E=1-Math.pow(n,T);return E+(1-E)*(2*F-1)*(2*F-1)}return 1}}function Ue({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),i=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-i)*(2*Math.PI)/n)+1}var te={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:Ye(),elastic:Ue()};function he(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return{element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return{element:t,viewport:n}}function nt(e,r,t,n){switch(n){case"top":return e+t;case"center":return e+t+r/2;case"bottom":return e+t+r;default:return e+t}}function ot(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 Ne(e){let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(t+n)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function Pt(e,r,t){return Math.min(t,Math.max(r,e))}function re(e,r,t,n){return t===r?0:Pt((e-r)/(t-r)*n,0,1)}function xe(e,r,t,n,i){let s=nt(e.top,e.height,r,n.element)-ot(n.viewport,t),d=nt(e.top,e.height,r,i.element)-ot(i.viewport,t);return{tStart:s,tEnd:d}}function st(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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function Pe(e,r,t){let n=st(e),i=st(r);return!n||!i?e:`rgb(${Math.round(n[0]+(i[0]-n[0])*t)},${Math.round(n[1]+(i[1]-n[1])*t)},${Math.round(n[2]+(i[2]-n[2])*t)})`}var Re={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};function at(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r)}var lt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},kt=0;function Ct(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Lt(e){let r=e.getAttribute("stroke"),t=e.getAttribute("fill");!r||r==="none"?at("Element has no stroke \u2014 path will not be visible.",e):t&&t!=="none"&&t!=="transparent"&&at("Element has a fill \u2014 it may obscure the stroke animation.",e)}function It(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function i(){let s=t==="x"?window.scrollX:window.scrollY,d=e-s,m=r-s,l=t==="x";n.innerHTML=`
2
- <div style="position:absolute;${l?`left:${d}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${d}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${l?`left:${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(n),window.addEventListener("scroll",i,{passive:!0}),i(),n}function Ze(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let d=parseFloat(s),m=n[i++]??d;return String(+(d+(m-d)*t).toFixed(4))})}function He(e,r={}){if(typeof window>"u")return{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:t,...n}=r,i=t?{...Re[t],...n}:n,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:m=1,fade:l=!1,easing:f="linear",trigger:T={},stagger:F=0,direction:E="forward",once:X=!1,debug:ce=!1,axis:A="y",scrollContainer:$,autoReverse:u=!1,delay:h=0,strokeColor:b,strokeWidth:N,fillOpacity:z,waypoints:_,velocityScale:B=!1,threshold:oe=0,rootMargin:U="0px",repeat:Z=0,repeatDelay:J=0,morphTo:k,clip:K,autoplay:de=!1,duration:ge=1e3,native:be=!0,onProgress:g,onStart:R,onComplete:ue}=i,ie=K===!0?"left":typeof K=="string"?K:!1,ae=typeof f=="function"?f:te[f]??te.linear,Ae=he(T.start??"top bottom"),c=he(T.end??"bottom top"),p=typeof $=="string"?document.querySelector($):$??null,G=Array.isArray(b)?b[0]:null,C=Array.isArray(b)?b[1]:typeof b=="string"?b:null,H=Array.isArray(N)?N[0]:null,j=Array.isArray(N)?N[1]:typeof N=="number"?N:null,M=Array.isArray(z)?z[0]:null,I=Array.isArray(z)?z[1]:typeof z=="number"?z:null;function ne(o){let a=o*100;switch(ie){case"right":return`inset(0 0 0 ${100-a}%)`;case"top":return`inset(0 0 ${100-a}% 0)`;case"bottom":return`inset(${100-a}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-a}% 0 0)`}}let V=ie?[]:Array.from(e.querySelectorAll(d)),D=[],me=[],we=0,ve=0,Y=!1,le=!1,W=0,Ce=!1,fe=-1,Le=-1,Q=!1,Te=0,ye=0,Ee,Be=null,Se=new Set,Ie=-1,et=performance.now();function ke(){return p?A==="x"?p.scrollLeft:p.scrollTop:A==="x"?window.scrollX:window.scrollY}function tt(){return p?A==="x"?p.clientWidth:p.clientHeight:A==="x"?window.innerWidth:window.innerHeight}function rt(){let o=e.getBoundingClientRect(),a,v,O;if(p){let ee=p.getBoundingClientRect();a=A==="x"?o.left-ee.left+p.scrollLeft:o.top-ee.top+p.scrollTop,v=A==="x"?o.width:o.height,O=ke()}else a=A==="x"?o.left:o.top,v=A==="x"?o.width:o.height,O=ke();let se=xe({top:a,height:v},O,tt(),Ae,c);we=se.tStart,ve=se.tEnd,ce&&process.env.NODE_ENV!=="production"&&(Be?.remove(),Be=It(we,ve,A))}function bt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),ie){let v=a==="reverse"?1-o:o;e.style.clipPath=ne(v);return}V.forEach((v,O)=>{v.style.strokeDashoffset=a==="reverse"?`${D[O]*o}`:`${D[O]*(1-o)}`,l&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),G&&C?v.style.stroke=Pe(G,C,o):C&&(v.style.stroke=C),H!==null&&j!==null?v.style.strokeWidth=`${H+(j-H)*o}`:j!==null&&(v.style.strokeWidth=`${j}`),M!==null&&I!==null?v.style.fillOpacity=`${M+(I-M)*o}`:I!==null&&(v.style.fillOpacity=`${I}`),k&&v.tagName.toLowerCase()==="path"&&me[O]&&v.setAttribute("d",Ze(me[O],k,o))})}function De(){if(e.style.setProperty("--scroll-draw-progress","0"),ie){e.style.clipPath=ne(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${D[a]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${D[a]}`,l?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",G&&(o.style.stroke=G),H!==null&&(o.style.strokeWidth=`${H}`),M!==null&&(o.style.fillOpacity=`${M}`),k&&o.tagName.toLowerCase()==="path"&&me[a]&&o.setAttribute("d",me[a])})}if(V.forEach(o=>{Lt(o);let a=Ne(o);D.push(a),o.tagName.toLowerCase()==="path"?me.push(o.getAttribute("d")??""):me.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?`${a}`:"0",l&&(o.style.opacity="1"),C&&(o.style.stroke=C),j!==null&&(o.style.strokeWidth=`${j}`),I!==null&&(o.style.fillOpacity=`${I}`),k&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",k)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=E==="reverse"?"0":`${a}`,l?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",G&&(o.style.stroke=G),H!==null&&(o.style.strokeWidth=`${H}`),M!==null&&(o.style.fillOpacity=`${M}`))}),ie){if(s)return e.style.clipPath=ne(1),ue?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ne(0)}else if(s)return ue?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function wt(){return!(be===!1||!Ct()||!V.length||typeof f!="string"||!(f in lt)||ie||A!=="y"||p||m!==1||F!==0||X||u||B!==!1||k||_||Z||h>0||g||R||ue||b!=null||N!=null||z!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function vt(){let o=`svg-scroll-draw-${++kt}`,a=E==="reverse"?"0":"var(--ssd-len)",v=E==="reverse"?"var(--ssd-len)":"0",O=`stroke-dashoffset:${a};`,se=`stroke-dashoffset:${v};`;l&&(O+=`opacity:${E==="reverse"?1:0};`,se+=`opacity:${E==="reverse"?0:1};`);let ee=document.createElement("style");ee.setAttribute("data-svg-scroll-draw",""),ee.textContent=`@keyframes ${o}{from{${O}}to{${se}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${lt[f]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ee);function w(y,x){y.style.setProperty("--ssd-len",String(D[x])),y.style.strokeDasharray=`${D[x]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(o)}V.forEach(w);let P=!1,q=-1;function S(){if(q>=0)return q;let y=e.getBoundingClientRect(),{tStart:x,tEnd:L}=xe({top:y.top,height:y.height},ke(),tt(),Ae,c);return ae(re(ke(),x,L,m))}return{destroy(){V.forEach(y=>{y.classList.remove(o),y.style.removeProperty("--ssd-len"),y.style.animationPlayState=""}),ee.remove()},replay(){P=!1,q=-1,V.forEach(w)},pause(){P=!0,V.forEach(y=>{y.style.animationPlayState="paused"})},resume(){P&&(P=!1,V.forEach(y=>{y.style.animationPlayState="running"}))},seek(y){let x=Math.min(1,Math.max(0,y));q=x,P=!0,V.forEach((L,$e)=>{L.classList.remove(o),L.style.strokeDashoffset=E==="reverse"?`${D[$e]*x}`:`${D[$e]*(1-x)}`,l&&(L.style.opacity=E==="reverse"?`${1-x}`:`${x}`)})},getProgress(){return S()}}}if(wt())return vt();function Et(){let o=Math.max(1,ge),a=0,v=0;function O(S){let y=!0;if(ie){let x=Math.min(1,Math.max(0,S/o)),L=ae(x);Te=L,e.style.setProperty("--scroll-draw-progress",String(L)),e.style.clipPath=ne(E==="reverse"?1-L:L),g?.(L),x<1&&(y=!1)}else V.forEach((x,L)=>{let $e=L*F*o,Me=Math.min(1,Math.max(0,(S-$e)/o)),pe=ae(Me);x.style.strokeDashoffset=E==="reverse"?`${D[L]*pe}`:`${D[L]*(1-pe)}`,l&&(x.style.opacity=E==="reverse"?`${1-pe}`:`${pe}`),G&&C?x.style.stroke=Pe(G,C,pe):C&&(x.style.stroke=C),H!==null&&j!==null?x.style.strokeWidth=`${H+(j-H)*pe}`:j!==null&&(x.style.strokeWidth=`${j}`),M!==null&&I!==null?x.style.fillOpacity=`${M+(I-M)*pe}`:I!==null&&(x.style.fillOpacity=`${I}`),k&&x.tagName.toLowerCase()==="path"&&me[L]&&x.setAttribute("d",Ze(me[L],k,pe)),L===0&&(g?.(pe),e.style.setProperty("--scroll-draw-progress",String(pe))),Me<1&&(y=!1)});if(_){let x=Math.min(1,Math.max(0,S/o)),L=ae(x);for(let $e in _){let Me=parseFloat($e);L>=Me&&!Se.has(Me)&&(Se.add(Me),_[$e]?.())}}return y}function se(S){if(Q)return;let y=S-a;le||(le=!0,R?.());let x=O(y);if(x&&!Y){Y=!0,O(o*(1+Math.max(0,V.length-1)*F)),ue?.(),ye<(Z==="infinite"?1/0:Z??0)&&(ye++,Ee=setTimeout(()=>{a=performance.now(),le=!1,Y=!1,Se.clear(),De(),W=requestAnimationFrame(se)},J));return}x||(W=requestAnimationFrame(se))}function ee(){cancelAnimationFrame(W),clearTimeout(Ee),a=performance.now(),v=0,Q=!1,le=!1,Y=!1,ye=0,Se.clear(),De(),W=requestAnimationFrame(se)}let w=new IntersectionObserver(S=>{S.forEach(y=>{y.isIntersecting&&!(X&&Y)?ee():!y.isIntersecting&&!X&&!Y&&(cancelAnimationFrame(W),clearTimeout(Ee),a=null)})},{root:p??null,threshold:oe,rootMargin:U}),P;function q(){clearTimeout(P),P=setTimeout(()=>{V.forEach((S,y)=>{D[y]=Ne(S),S.style.strokeDasharray=`${D[y]}`})},150)}return window.addEventListener("resize",q),window.addEventListener("orientationchange",q),h>0?setTimeout(()=>w.observe(e),h):w.observe(e),{destroy(){cancelAnimationFrame(W),clearTimeout(Ee),w.disconnect(),window.removeEventListener("resize",q),window.removeEventListener("orientationchange",q),clearTimeout(P)},replay(){ye=0,ee()},pause(){Q||(Q=!0,v=performance.now()-a,cancelAnimationFrame(W))},resume(){Q&&(Q=!1,a=performance.now()-v,W=requestAnimationFrame(se))},seek(S){let y=Math.min(1,Math.max(0,S));Te=y,Q=!0,v=y*o,a=performance.now()-v,cancelAnimationFrame(W),O(v)},getProgress(){return Te}}}if(de)return Et();rt();function Oe(){if(!Ce||Q)return;let o=performance.now(),a=ke(),v=m;if(B!==!1){let w=o-et,P=w>0?Math.abs(a-(Ie<0?a:Ie))/w:0;v=m*Math.max(.2,1+P*(typeof B=="number"?B:1)*.04)}Ie=a,et=o;let O=u?Le===-1||a>=Le?"forward":"reverse":E;Le=a;let se=ve-we,ee=!0;if(ie){let w=ae(re(a,we,ve,v));X&&!u&&(fe=Math.max(fe,w),w=fe),Te=w,e.style.setProperty("--scroll-draw-progress",String(w));let P=O==="reverse"?1-w:w;e.style.clipPath=ne(P),g?.(w),!le&&re(a,we,ve,v)>0&&(le=!0,R?.()),w>=1&&!Y?(Y=!0,ue?.(),ye<(Z==="infinite"?1/0:Z??0)&&(ye++,Ee=setTimeout(()=>{fe=-1,le=!1,Y=!1,e.style.clipPath=ne(0)},J))):w<1&&!X&&(Y=!1),W=requestAnimationFrame(Oe);return}if(V.forEach((w,P)=>{let q=P*F*se,S=ae(re(a,we+q,ve+q,v));X&&!u&&(fe=Math.max(fe,S),S=fe),Te=S,w.style.strokeDashoffset=O==="reverse"?`${D[P]*S}`:`${D[P]*(1-S)}`,l&&(w.style.opacity=O==="reverse"?`${1-S}`:`${S}`),G&&C?w.style.stroke=Pe(G,C,S):C&&(w.style.stroke=C),H!==null&&j!==null?w.style.strokeWidth=`${H+(j-H)*S}`:j!==null&&(w.style.strokeWidth=`${j}`),M!==null&&I!==null?w.style.fillOpacity=`${M+(I-M)*S}`:I!==null&&(w.style.fillOpacity=`${I}`),k&&w.tagName.toLowerCase()==="path"&&me[P]&&w.setAttribute("d",Ze(me[P],k,S)),P===0&&(g?.(S),e.style.setProperty("--scroll-draw-progress",String(S))),S<1&&(ee=!1)}),_){let w=ae(re(a,we,ve,v));for(let P in _){let q=parseFloat(P);w>=q&&!Se.has(q)&&(Se.add(q),_[P]?.())}}!le&&re(a,we,ve,v)>0&&(le=!0,R?.()),ee&&!Y?(Y=!0,ue?.(),ye<(Z==="infinite"?1/0:Z??0)&&(ye++,Ee=setTimeout(()=>{fe=-1,le=!1,Y=!1,Se.clear(),De()},J))):!ee&&!X&&(Y=!1),W=requestAnimationFrame(Oe)}let Ge=new IntersectionObserver(o=>{o.forEach(a=>{Ce=a.isIntersecting,Ce&&!Q?W=requestAnimationFrame(Oe):cancelAnimationFrame(W)})},{root:p??null,threshold:oe,rootMargin:U}),je;function Fe(){clearTimeout(je),je=setTimeout(()=>{V.forEach((o,a)=>{D[a]=Ne(o),o.style.strokeDasharray=`${D[a]}`}),rt()},150)}return window.addEventListener("resize",Fe),window.addEventListener("orientationchange",Fe),h>0?setTimeout(()=>Ge.observe(e),h):Ge.observe(e),{destroy(){cancelAnimationFrame(W),clearTimeout(Ee),Ge.disconnect(),window.removeEventListener("resize",Fe),window.removeEventListener("orientationchange",Fe),clearTimeout(je),Be?.remove()},replay(){fe=-1,Le=-1,Ie=-1,le=!1,Y=!1,ye=0,Q=!1,Se.clear(),clearTimeout(Ee),De()},pause(){Q=!0,cancelAnimationFrame(W)},resume(){Q&&(Q=!1,Ce&&(W=requestAnimationFrame(Oe)))},seek(o){let a=Math.min(1,Math.max(0,o));Te=a,fe=a,Q=!0,cancelAnimationFrame(W),bt(a,E)},getProgress(){return Te}}}var ct=new Map;function qe(e,r){ct.set(e,r)}function ze(e){ct.delete(e)}function Dt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ut(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let i=[],s=[],d=n[2].trim();if(d)for(let m of d.split(/[\s,]+/)){let l=m.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(l?parseFloat(l[1]):0),s.push(l?l[2]:"")}r.push({fn:n[1],nums:i,units:s})}return r}function Ot(e,r,t){let n=ut(e),i=ut(r);return n.length===0||n.length!==i.length?t<1?e:r:n.map((s,d)=>{let m=i[d];return s.fn!==m.fn||s.nums.length!==m.nums.length?t<1?`${s.fn}(${s.nums.map((l,f)=>`${l}${s.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((l,f)=>`${l}${m.units[f]}`).join(", ")})`:`${s.fn}(${s.nums.map((l,f)=>`${l+(m.nums[f]-l)*t}${s.units[f]}`).join(", ")})`}).join(" ")}function mt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),i=String(r);if(Dt(n))return Pe(n,i,t);if(n.includes("("))return Ot(n,i,t);let s=n.match(/^([-+]?[\d.]+)(.*)$/),d=i.match(/^([-+]?[\d.]+)(.*)$/);if(s&&d){let m=parseFloat(s[1]),l=parseFloat(d[1]);return`${m+(l-m)*t}${s[2]||d[2]}`}return t<1?n:i}function Ft(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ft={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Nt=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 pt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:n,trigger:i={},easing:s="ease-out",speed:d=1,once:m=!1,axis:l="y",scrollContainer:f,native:T=!0,onProgress:F,onComplete:E}=r,X=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ce=typeof s=="function"?s:te[s]??te["ease-out"],A=he(i.start??"top bottom"),$=he(i.end??"bottom top"),u=typeof f=="string"?document.querySelector(f):f??null,h=Object.entries(n).map(([c,p])=>({prop:Ft(c),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function b(){let c=window.getComputedStyle(e);for(let p of h)p.from===""&&(p.from=c.getPropertyValue(p.prop).trim()||"0")}function N(){for(let c of h)e.style.setProperty(c.prop,String(c.to))}if(X)return N(),E?.(),t;b();function z(){if(!T||!Ht()||typeof s!="string"||!(s in ft)||l!=="y"||u||m||d!==1||F||E||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return!1;for(let c of h)if(!Nt.has(c.prop))return!1;return!0}function _(){let c=`ssd-a-${++Rt}`,p=h.map(M=>`${M.prop}:${M.from}`).join(";"),G=h.map(M=>`${M.prop}:${M.to}`).join(";"),C=document.createElement("style");C.setAttribute("data-ssd-animate",""),C.textContent=`@keyframes ${c}{from{${p}}to{${G}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${ft[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(C),e.classList.add(c);let H=()=>l==="x"?window.scrollX:window.scrollY,j=()=>l==="x"?window.innerWidth:window.innerHeight;return{destroy(){e.classList.remove(c),C.remove()},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(M){let I=Math.min(1,Math.max(0,M));e.classList.remove(c);for(let ne of h)e.style.setProperty(ne.prop,mt(ne.from,ne.to,I))},getProgress(){let M=e.getBoundingClientRect(),I=H(),ne=j(),{tStart:V,tEnd:D}=xe({top:M.top,height:M.height},I,ne,A,$);return ce(re(I,V,D,d))}}}if(z())return _();let B=0,oe=0,U=0,Z=!1,J=!1,k=-1,K=0,de=!1,ge=()=>u?l==="x"?u.scrollLeft:u.scrollTop:l==="x"?window.scrollX:window.scrollY,be=()=>u?l==="x"?u.clientWidth:u.clientHeight:l==="x"?window.innerWidth:window.innerHeight;function g(){let c=e.getBoundingClientRect(),p,G;if(u){let H=u.getBoundingClientRect();p=l==="x"?c.left-H.left+u.scrollLeft:c.top-H.top+u.scrollTop,G=l==="x"?c.width:c.height}else p=l==="x"?c.left:c.top,G=l==="x"?c.width:c.height;let C=xe({top:p,height:G},ge(),be(),A,$);B=C.tStart,oe=C.tEnd}function R(c){e.style.setProperty("--scroll-draw-progress",String(c));for(let p of h)e.style.setProperty(p.prop,mt(p.from,p.to,c));F?.(c)}function ue(){if(!Z||J)return;let c=ce(re(ge(),B,oe,d));m&&(k=Math.max(k,c),c=k),K=c,R(c),c>=1&&!de?(de=!0,E?.()):c<1&&!m&&(de=!1),U=requestAnimationFrame(ue)}g();{let c=ce(re(ge(),B,oe,d));m&&c>0&&(k=c),K=c,R(c)}let ie=new IntersectionObserver(c=>{c.forEach(p=>{Z=p.isIntersecting,Z&&!J?U=requestAnimationFrame(ue):cancelAnimationFrame(U)})},{root:u??null}),ae;function Ae(){clearTimeout(ae),ae=setTimeout(g,150)}return window.addEventListener("resize",Ae),window.addEventListener("orientationchange",Ae),ie.observe(e),qe(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:B,tEnd:oe})}),{destroy(){cancelAnimationFrame(U),ie.disconnect(),window.removeEventListener("resize",Ae),window.removeEventListener("orientationchange",Ae),clearTimeout(ae),ze(e)},replay(){k=-1,de=!1,K=0,J=!1,R(0)},pause(){J=!0,cancelAnimationFrame(U)},resume(){J&&(J=!1,Z&&(U=requestAnimationFrame(ue)))},seek(c){let p=Math.min(1,Math.max(0,c));K=p,k=p,J=!0,cancelAnimationFrame(U),R(p)},getProgress(){return K}}}var Ve={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,r){if(typeof window>"u")return Ve;let t=typeof e=="string"?document.querySelector(e):e;return t?pt(t,r):(process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollAnimate: element not found:",e),Ve)}function gt(e,r={}){if(typeof window>"u")return Ve;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollParallax: element not found:",e),Ve;let{speed:n=.3,axis:i="y",easing:s="linear",trigger:d,onProgress:m}=r,l=t.getBoundingClientRect(),f=i==="x"?l.width:l.height,T=n*f;return pt(t,{props:i==="x"?{transform:["translateX(0px)",`translateX(${-T}px)`]}:{transform:["translateY(0px)",`translateY(${-T}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:s,native:!1,onProgress:m})}var Je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yt(e,r){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Je;let n=t,{from:i=0,to:s,format:d,easing:m="ease-out",trigger:l={},once:f=!0,decimals:T,onComplete:F}=r,E=T!==void 0?g=>g.toFixed(T):d??(g=>String(Math.round(g))),X=typeof m=="function"?m:te[m]??te["ease-out"],ce=he(l.start??"top 80%"),A=he(l.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=E(s),F?.(),Je;n.textContent=E(i);let u=0,h=0,b=0,N=!1,z=!1,_=-1,B=0,oe=!1,U=()=>window.scrollY,Z=()=>window.innerHeight;function J(){let g=n.getBoundingClientRect(),R=xe({top:g.top,height:g.height},U(),Z(),ce,A);u=R.tStart,h=R.tEnd}function k(g){n.textContent=E(i+(s-i)*g),n.style.setProperty("--scroll-draw-progress",String(g))}function K(){if(!N||z)return;let g=X(re(U(),u,h,1));f&&(_=Math.max(_,g),g=_),B=g,k(g),g>=1&&!oe?(oe=!0,F?.()):g<1&&!f&&(oe=!1),b=requestAnimationFrame(K)}J();{let g=X(re(U(),u,h,1));f&&g>0&&(_=g),B=g,k(g)}let de=new IntersectionObserver(g=>{g.forEach(R=>{N=R.isIntersecting,N&&!z?b=requestAnimationFrame(K):cancelAnimationFrame(b)})}),ge;function be(){clearTimeout(ge),ge=setTimeout(J,150)}return window.addEventListener("resize",be),window.addEventListener("orientationchange",be),de.observe(n),qe(n,{type:"counter",getProgress:()=>B,getTrigger:()=>({tStart:u,tEnd:h})}),{destroy(){cancelAnimationFrame(b),de.disconnect(),window.removeEventListener("resize",be),window.removeEventListener("orientationchange",be),clearTimeout(ge),ze(n)},replay(){_=-1,oe=!1,B=0,z=!1,k(0)},pause(){z=!0,cancelAnimationFrame(b)},resume(){z&&(z=!1,N&&(b=requestAnimationFrame(K)))},seek(g){let R=Math.min(1,Math.max(0,g));B=R,_=R,z=!0,cancelAnimationFrame(b),k(R)},getProgress(){return B}}}var ht="http://www.w3.org/2000/svg",qt="cinematic-photo",Ke=e=>e<0?0:e>1?1:e;function We(e){let r=parseFloat(e);return Number.isFinite(r)?Ke(r/100):0}function zt(e){return te[e]??te.linear}var Vt={destroy:()=>{},getProgress:()=>0},_e=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,!this.mount&&process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] Cinematic: wrapper not found:",r.wrapper)}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return Vt;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let i=[];for(let A of r.scenes){if(A.background){let u=document.createElement("img");u.id=qt,u.src=A.background,u.alt="",u.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(u)}let $=A.animations.filter(u=>u.type==="draw");if($.length){let u=document.createElementNS(ht,"svg");u.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),u.setAttribute("preserveAspectRatio","xMidYMid meet"),u.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(u);for(let h of $){let b=document.createElementNS(ht,"path");b.id=h.target.replace(/^#/,""),b.setAttribute("d",h.d),b.setAttribute("fill","none"),b.setAttribute("stroke",h.stroke),b.setAttribute("stroke-width",String(h.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let N=h.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(N),b.style.strokeDashoffset=String(N),u.appendChild(b),i.push({kind:"draw",el:b,start:We(h.start),end:We(h.end),ease:zt(h.easing),length:N})}}for(let u of A.animations){if(u.type!=="fade")continue;let h=n.querySelector(u.target)??document.querySelector(u.target);h&&(h.style.opacity=String(u.from),i.push({kind:"fade",el:h,start:We(u.start),end:We(u.end),ease:te["ease-in-out"]??te.linear,from:u.from,to:u.to}))}}let s=0,d=()=>{let A=t.offsetHeight-window.innerHeight;return A<=0?t.getBoundingClientRect().top<=0?1:0:Ke(-t.getBoundingClientRect().top/A)},m=A=>{for(let $ of i){let u=$.end-$.start,h=u<=0?A>=$.end?1:0:Ke((A-$.start)/u),b=$.ease(h);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let l=0,f=!1,T=!1,F=()=>{s=d(),m(s),f&&(l=requestAnimationFrame(F))},E=()=>{f||(f=!0,l=requestAnimationFrame(F))},X=()=>{f=!1,cancelAnimationFrame(l)},ce=new IntersectionObserver(A=>{for(let $ of A)T=$.isIntersecting,T?E():X()},{threshold:0});return ce.observe(n),s=d(),m(s),{destroy(){X(),ce.disconnect()},getProgress:()=>s}}};function Wt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?He(n,r):(console.warn("[svg-scroll-draw] Container not found:",e),t)}var Qe=class extends HTMLElement{constructor(){super(...arguments);this.instance=null}connectedCallback(){let t={},n=this.getAttribute("speed"),i=this.getAttribute("easing"),s=this.getAttribute("stagger"),d=this.getAttribute("direction"),m=this.getAttribute("selector");n&&(t.speed=parseFloat(n)),i&&(t.easing=i),s&&(t.stagger=parseFloat(s)),d&&(t.direction=d),m&&(t.selector=m),this.hasAttribute("fade")&&(t.fade=this.getAttribute("fade")!=="false"),this.instance=He(this,t)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}};typeof customElements<"u"&&!customElements.get("scroll-draw")&&customElements.define("scroll-draw",Qe);return Mt(_t);})();
1
+ "use strict";var SvgScrollDraw=(()=>{var Ke=Object.defineProperty;var Mt=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var Pt=Object.prototype.hasOwnProperty;var Ct=(e,r)=>{for(var t in r)Ke(e,t,{get:r[t],enumerable:!0})},Lt=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of kt(r))!Pt.call(e,a)&&a!==t&&Ke(e,a,{get:()=>r[a],enumerable:!(n=Mt(r,a))||n.enumerable});return e};var It=e=>Lt(Ke({},"__esModule",{value:!0}),e);var Yt={};Ct(Yt,{Cinematic:()=>Ye,PRESETS:()=>Be,createBounce:()=>Qe,createElastic:()=>et,createSpring:()=>mt,scrollAnimate:()=>wt,scrollCounter:()=>Et,scrollDraw:()=>Xt,scrollParallax:()=>vt});function mt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Qe({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),a=Math.sqrt(n),i=0,g=[];for(let p=0;p<t;p++){let T=Math.pow(a,p);g.push(T),i+=T}let f=[0],c=0;for(let p=0;p<t;p++)c+=g[p]/i,f.push(c);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<t;T++)if(p<=f[T+1]){let H=(p-f[T])/(f[T+1]-f[T]);if(T===0)return H*(2-H);let v=1-Math.pow(n,T);return v+(1-v)*(2*H-1)*(2*H-1)}return 1}}function et({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),a=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var Q={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Qe(),elastic:et()};function he(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return{element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return{element:t,viewport:n}}function lt(e,r,t,n){switch(n){case"top":return e+t;case"center":return e+t+r/2;case"bottom":return e+t+r;default:return e+t}}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 Ve(e){let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(t+n)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function Dt(e,r,t){return Math.min(t,Math.max(r,e))}function ee(e,r,t,n){return t===r?0:Dt((e-r)/(t-r)*n,0,1)}function Se(e,r,t,n,a){let i=lt(e.top,e.height,r,n.element)-ct(n.viewport,t),g=lt(e.top,e.height,r,a.element)-ct(a.viewport,t);return{tStart:i,tEnd:g}}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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function Ce(e,r,t){let n=ut(e),a=ut(r);return!n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*t)},${Math.round(n[1]+(a[1]-n[1])*t)},${Math.round(n[2]+(a[2]-n[2])*t)})`}var Be={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};function ft(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"},Ot=0;function Ft(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Nt(e){let r=e.getAttribute("stroke"),t=e.getAttribute("fill");!r||r==="none"?ft("Element has no stroke \u2014 path will not be visible.",e):t&&t!=="none"&&t!=="transparent"&&ft("Element has a fill \u2014 it may obscure the stroke animation.",e)}function Rt(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.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 a(){let i=t==="x"?window.scrollX:window.scrollY,g=e-i,f=r-i,c=t==="x";n.innerHTML=`
2
+ <div style="position:absolute;${c?`left:${g}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${g}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:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}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(n),window.addEventListener("scroll",a,{passive:!0}),a(),n}function tt(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let g=parseFloat(i),f=n[a++]??g;return String(+(g+(f-g)*t).toFixed(4))})}function We(e,r={}){if(typeof window>"u")return{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:t,...n}=r,a=t?{...Be[t],...n}:n,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:g="path, polyline, line, polygon, rect, circle",speed:f=1,fade:c=!1,easing:p="linear",trigger:T={},stagger:H=0,direction:v="forward",once:_=!1,debug:pe=!1,axis:x="y",scrollContainer:$,autoReverse:y=!1,delay:E=0,strokeColor:b,strokeWidth:F,fillOpacity:A,waypoints:C,velocityScale:te=!1,threshold:de=0,rootMargin:be="0px",repeat:ie=0,repeatDelay:Y=0,morphTo:L,clip:j,autoplay:ge=!1,duration:re=1e3,native:ne=!0,onProgress:d,onStart:q,onComplete:U,onEnter:xe,onLeave:Oe,onEnterBack:Le,onLeaveBack:Ae}=a,ue=j===!0?"left":typeof j=="string"?j:!1,ae=typeof p=="function"?p:Q[p]??Q.linear,Ie=he(T.start??"top bottom"),Me=he(T.end??"bottom top"),z=typeof $=="string"?document.querySelector($):$??null,s=Array.isArray(b)?b[0]:null,m=Array.isArray(b)?b[1]:typeof b=="string"?b:null,N=Array.isArray(F)?F[0]:null,I=Array.isArray(F)?F[1]:typeof F=="number"?F:null,V=Array.isArray(A)?A[0]:null,G=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function B(o){let l=o*100;switch(ue){case"right":return`inset(0 0 0 ${100-l}%)`;case"top":return`inset(0 0 ${100-l}% 0)`;case"bottom":return`inset(${100-l}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-l}% 0 0)`}}let O=ue?[]:Array.from(e.querySelectorAll(g)),M=[],oe=[],le=0,we=0,X=!1,ce=!1,W=0,Fe=!1,me=-1,Ne=-1,Z=!1,Te=0,ye=0,ve,Ue=null,Ee=new Set,Re=-1,st=performance.now(),ke=NaN;function De(){return z?x==="x"?z.scrollLeft:z.scrollTop:x==="x"?window.scrollX:window.scrollY}function it(){return z?x==="x"?z.clientWidth:z.clientHeight:x==="x"?window.innerWidth:window.innerHeight}function at(){let o=e.getBoundingClientRect(),l,w,R;if(z){let K=z.getBoundingClientRect();l=x==="x"?o.left-K.left+z.scrollLeft:o.top-K.top+z.scrollTop,w=x==="x"?o.width:o.height,R=De()}else l=x==="x"?o.left:o.top,w=x==="x"?o.width:o.height,R=De();let J=Se({top:l,height:w},R,it(),Ie,Me);le=J.tStart,we=J.tEnd,pe&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=Rt(le,we,x))}function xt(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),ue){let w=l==="reverse"?1-o:o;e.style.clipPath=B(w);return}O.forEach((w,R)=>{w.style.strokeDashoffset=l==="reverse"?`${M[R]*o}`:`${M[R]*(1-o)}`,c&&(w.style.opacity=l==="reverse"?`${1-o}`:`${o}`),s&&m?w.style.stroke=Ce(s,m,o):m&&(w.style.stroke=m),N!==null&&I!==null?w.style.strokeWidth=`${N+(I-N)*o}`:I!==null&&(w.style.strokeWidth=`${I}`),V!==null&&G!==null?w.style.fillOpacity=`${V+(G-V)*o}`:G!==null&&(w.style.fillOpacity=`${G}`),L&&w.tagName.toLowerCase()==="path"&&oe[R]&&w.setAttribute("d",tt(oe[R],L,o))})}function He(){if(e.style.setProperty("--scroll-draw-progress","0"),ue){e.style.clipPath=B(0);return}O.forEach((o,l)=>{o.style.strokeDasharray=`${M[l]}`,o.style.strokeDashoffset=v==="reverse"?"0":`${M[l]}`,c?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",s&&(o.style.stroke=s),N!==null&&(o.style.strokeWidth=`${N}`),V!==null&&(o.style.fillOpacity=`${V}`),L&&o.tagName.toLowerCase()==="path"&&oe[l]&&o.setAttribute("d",oe[l])})}if(O.forEach(o=>{Nt(o);let l=Ve(o);M.push(l),o.tagName.toLowerCase()==="path"?oe.push(o.getAttribute("d")??""):oe.push(""),i?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=v==="reverse"?`${l}`:"0",c&&(o.style.opacity="1"),m&&(o.style.stroke=m),I!==null&&(o.style.strokeWidth=`${I}`),G!==null&&(o.style.fillOpacity=`${G}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=v==="reverse"?"0":`${l}`,c?o.style.opacity=v==="reverse"?"1":"0":o.style.opacity="",s&&(o.style.stroke=s),N!==null&&(o.style.strokeWidth=`${N}`),V!==null&&(o.style.fillOpacity=`${V}`))}),ue){if(i)return e.style.clipPath=B(1),U?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=B(0)}else if(i)return U?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function At(){return!(ne===!1||!Ft()||!O.length||typeof p!="string"||!(p in pt)||ue||x!=="y"||z||f!==1||H!==0||_||y||te!==!1||L||C||ie||E>0||d||q||U||xe||Oe||Le||Ae||b!=null||F!=null||A!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Tt(){let o=`svg-scroll-draw-${++Ot}`,l=v==="reverse"?"0":"var(--ssd-len)",w=v==="reverse"?"var(--ssd-len)":"0",R=`stroke-dashoffset:${l};`,J=`stroke-dashoffset:${w};`;c&&(R+=`opacity:${v==="reverse"?1:0};`,J+=`opacity:${v==="reverse"?0:1};`);let K=document.createElement("style");K.setAttribute("data-svg-scroll-draw",""),K.textContent=`@keyframes ${o}{from{${R}}to{${J}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${pt[p]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(K);function se(u,S){u.style.setProperty("--ssd-len",String(M[S])),u.style.strokeDasharray=`${M[S]}`,u.style.strokeDashoffset="",u.style.opacity="",u.style.animationPlayState="",u.classList.add(o)}O.forEach(se);let h=!1,k=-1;function P(){if(k>=0)return k;let u=e.getBoundingClientRect(),{tStart:S,tEnd:D}=Se({top:u.top,height:u.height},De(),it(),Ie,Me);return ae(ee(De(),S,D,f))}return{destroy(){O.forEach(u=>{u.classList.remove(o),u.style.removeProperty("--ssd-len"),u.style.animationPlayState=""}),K.remove()},replay(){h=!1,k=-1,O.forEach(se)},pause(){h=!0,O.forEach(u=>{u.style.animationPlayState="paused"})},resume(){h&&(h=!1,O.forEach(u=>{u.style.animationPlayState="running"}))},seek(u){let S=Math.min(1,Math.max(0,u));k=S,h=!0,O.forEach((D,$e)=>{D.classList.remove(o),D.style.strokeDashoffset=v==="reverse"?`${M[$e]*S}`:`${M[$e]*(1-S)}`,c&&(D.style.opacity=v==="reverse"?`${1-S}`:`${S}`)})},getProgress(){return P()}}}if(At())return Tt();function $t(){let o=Math.max(1,re),l=0,w=0;function R(P){let u=!0;if(ue){let S=Math.min(1,Math.max(0,P/o)),D=ae(S);Te=D,e.style.setProperty("--scroll-draw-progress",String(D)),e.style.clipPath=B(v==="reverse"?1-D:D),d?.(D),S<1&&(u=!1)}else O.forEach((S,D)=>{let $e=D*H*o,Pe=Math.min(1,Math.max(0,(P-$e)/o)),fe=ae(Pe);S.style.strokeDashoffset=v==="reverse"?`${M[D]*fe}`:`${M[D]*(1-fe)}`,c&&(S.style.opacity=v==="reverse"?`${1-fe}`:`${fe}`),s&&m?S.style.stroke=Ce(s,m,fe):m&&(S.style.stroke=m),N!==null&&I!==null?S.style.strokeWidth=`${N+(I-N)*fe}`:I!==null&&(S.style.strokeWidth=`${I}`),V!==null&&G!==null?S.style.fillOpacity=`${V+(G-V)*fe}`:G!==null&&(S.style.fillOpacity=`${G}`),L&&S.tagName.toLowerCase()==="path"&&oe[D]&&S.setAttribute("d",tt(oe[D],L,fe)),D===0&&(d?.(fe),e.style.setProperty("--scroll-draw-progress",String(fe))),Pe<1&&(u=!1)});if(C){let S=Math.min(1,Math.max(0,P/o)),D=ae(S);for(let $e in C){let Pe=parseFloat($e);D>=Pe&&!Ee.has(Pe)&&(Ee.add(Pe),C[$e]?.())}}return u}function J(P){if(Z)return;let u=P-l;ce||(ce=!0,q?.());let S=R(u);if(S&&!X){X=!0,R(o*(1+Math.max(0,O.length-1)*H)),U?.(),ye<(ie==="infinite"?1/0:ie??0)&&(ye++,ve=setTimeout(()=>{l=performance.now(),ce=!1,X=!1,Ee.clear(),He(),W=requestAnimationFrame(J)},Y));return}S||(W=requestAnimationFrame(J))}function K(){cancelAnimationFrame(W),clearTimeout(ve),l=performance.now(),w=0,Z=!1,ce=!1,X=!1,ye=0,Ee.clear(),He(),W=requestAnimationFrame(J)}let se=new IntersectionObserver(P=>{P.forEach(u=>{u.isIntersecting&&!(_&&X)?K():!u.isIntersecting&&!_&&!X&&(cancelAnimationFrame(W),clearTimeout(ve),l=null)})},{root:z??null,threshold:de,rootMargin:be}),h;function k(){clearTimeout(h),h=setTimeout(()=>{O.forEach((P,u)=>{M[u]=Ve(P),P.style.strokeDasharray=`${M[u]}`})},150)}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),E>0?setTimeout(()=>se.observe(e),E):se.observe(e),{destroy(){cancelAnimationFrame(W),clearTimeout(ve),se.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(h)},replay(){ye=0,K()},pause(){Z||(Z=!0,w=performance.now()-l,cancelAnimationFrame(W))},resume(){Z&&(Z=!1,l=performance.now()-w,W=requestAnimationFrame(J))},seek(P){let u=Math.min(1,Math.max(0,P));Te=u,Z=!0,w=u*o,l=performance.now()-w,cancelAnimationFrame(W),R(w)},getProgress(){return Te}}}if(ge)return $t();at();function qe(){if(!Fe||Z)return;let o=performance.now(),l=De(),w=f;if(te!==!1){let h=o-st,k=h>0?Math.abs(l-(Re<0?l:Re))/h:0;w=f*Math.max(.2,1+k*(typeof te=="number"?te:1)*.04)}Re=l,st=o;let R=y?Ne===-1||l>=Ne?"forward":"reverse":v;Ne=l;let J=we-le,K=!0,se=J===0?0:(l-le)/J;if(isNaN(ke)||(ke<=0&&se>0?xe?.():ke>0&&se<=0&&Ae?.(),ke<1&&se>=1?Oe?.():ke>=1&&se<1&&Le?.()),ke=se,ue){let h=ae(ee(l,le,we,w));_&&!y&&(me=Math.max(me,h),h=me),Te=h,e.style.setProperty("--scroll-draw-progress",String(h));let k=R==="reverse"?1-h:h;e.style.clipPath=B(k),d?.(h),!ce&&ee(l,le,we,w)>0&&(ce=!0,q?.()),h>=1&&!X?(X=!0,U?.(),ye<(ie==="infinite"?1/0:ie??0)&&(ye++,ve=setTimeout(()=>{me=-1,ce=!1,X=!1,e.style.clipPath=B(0)},Y))):h<1&&!_&&(X=!1),W=requestAnimationFrame(qe);return}if(O.forEach((h,k)=>{let P=k*H*J,u=ae(ee(l,le+P,we+P,w));_&&!y&&(me=Math.max(me,u),u=me),Te=u,h.style.strokeDashoffset=R==="reverse"?`${M[k]*u}`:`${M[k]*(1-u)}`,c&&(h.style.opacity=R==="reverse"?`${1-u}`:`${u}`),s&&m?h.style.stroke=Ce(s,m,u):m&&(h.style.stroke=m),N!==null&&I!==null?h.style.strokeWidth=`${N+(I-N)*u}`:I!==null&&(h.style.strokeWidth=`${I}`),V!==null&&G!==null?h.style.fillOpacity=`${V+(G-V)*u}`:G!==null&&(h.style.fillOpacity=`${G}`),L&&h.tagName.toLowerCase()==="path"&&oe[k]&&h.setAttribute("d",tt(oe[k],L,u)),k===0&&(d?.(u),e.style.setProperty("--scroll-draw-progress",String(u))),u<1&&(K=!1)}),C){let h=ae(ee(l,le,we,w));for(let k in C){let P=parseFloat(k);h>=P&&!Ee.has(P)&&(Ee.add(P),C[k]?.())}}!ce&&ee(l,le,we,w)>0&&(ce=!0,q?.()),K&&!X?(X=!0,U?.(),ye<(ie==="infinite"?1/0:ie??0)&&(ye++,ve=setTimeout(()=>{me=-1,ce=!1,X=!1,Ee.clear(),He()},Y))):!K&&!_&&(X=!1),W=requestAnimationFrame(qe)}let Ze=new IntersectionObserver(o=>{o.forEach(l=>{Fe=l.isIntersecting,Fe&&!Z?W=requestAnimationFrame(qe):cancelAnimationFrame(W)})},{root:z??null,threshold:de,rootMargin:be}),Je;function ze(){clearTimeout(Je),Je=setTimeout(()=>{O.forEach((o,l)=>{M[l]=Ve(o),o.style.strokeDasharray=`${M[l]}`}),at()},150)}return window.addEventListener("resize",ze),window.addEventListener("orientationchange",ze),E>0?setTimeout(()=>Ze.observe(e),E):Ze.observe(e),{destroy(){cancelAnimationFrame(W),clearTimeout(ve),Ze.disconnect(),window.removeEventListener("resize",ze),window.removeEventListener("orientationchange",ze),clearTimeout(Je),Ue?.remove()},replay(){me=-1,Ne=-1,Re=-1,ce=!1,X=!1,ye=0,Z=!1,Ee.clear(),clearTimeout(ve),He()},pause(){Z=!0,cancelAnimationFrame(W)},resume(){Z&&(Z=!1,Fe&&(W=requestAnimationFrame(qe)))},seek(o){let l=Math.min(1,Math.max(0,o));Te=l,me=l,Z=!0,cancelAnimationFrame(W),xt(l,v)},getProgress(){return Te}}}var dt=new Map;function _e(e,r){dt.set(e,r)}function Ge(e){dt.delete(e)}function Ht(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function gt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let a=[],i=[],g=n[2].trim();if(g)for(let f of g.split(/[\s,]+/)){let c=f.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"")}r.push({fn:n[1],nums:a,units:i})}return r}function qt(e,r,t){let n=gt(e),a=gt(r);return n.length===0||n.length!==a.length?t<1?e:r:n.map((i,g)=>{let f=a[g];return i.fn!==f.fn||i.nums.length!==f.nums.length?t<1?`${i.fn}(${i.nums.map((c,p)=>`${c}${i.units[p]}`).join(", ")})`:`${f.fn}(${f.nums.map((c,p)=>`${c}${f.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,p)=>`${c+(f.nums[p]-c)*t}${i.units[p]}`).join(", ")})`}).join(" ")}function yt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),a=String(r);if(Ht(n))return Ce(n,a,t);if(n.includes("("))return qt(n,a,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),g=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&g){let f=parseFloat(i[1]),c=parseFloat(g[1]);return`${f+(c-f)*t}${i[2]||g[2]}`}return t<1?n:a}function zt(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"},Vt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Bt=0;function Wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function bt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:n,trigger:a={},easing:i="ease-out",speed:g=1,once:f=!1,axis:c="y",scrollContainer:p,native:T=!0,onProgress:H,onComplete:v,onEnter:_,onLeave:pe,onEnterBack:x,onLeaveBack:$}=r,y=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof i=="function"?i:Q[i]??Q["ease-out"],b=he(a.start??"top bottom"),F=he(a.end??"bottom top"),A=typeof p=="string"?document.querySelector(p):p??null,C=Object.entries(n).map(([s,m])=>({prop:zt(s),from:Array.isArray(m)?m[0]:"",to:Array.isArray(m)?m[1]:m}));function te(){let s=window.getComputedStyle(e);for(let m of C)m.from===""&&(m.from=s.getPropertyValue(m.prop).trim()||"0")}function de(){for(let s of C)e.style.setProperty(s.prop,String(s.to))}if(y)return de(),v?.(),t;te();function be(){if(!T||!Wt()||typeof i!="string"||!(i in ht)||c!=="y"||A||f||g!==1||H||v||_||pe||x||$||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return!1;for(let s of C)if(!Vt.has(s.prop))return!1;return!0}function ie(){let s=`ssd-a-${++Bt}`,m=C.map(B=>`${B.prop}:${B.from}`).join(";"),N=C.map(B=>`${B.prop}:${B.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${s}{from{${m}}to{${N}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${ht[i]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(s);let V=()=>c==="x"?window.scrollX:window.scrollY,G=()=>c==="x"?window.innerWidth:window.innerHeight;return{destroy(){e.classList.remove(s),I.remove()},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(B){let O=Math.min(1,Math.max(0,B));e.classList.remove(s);for(let M of C)e.style.setProperty(M.prop,yt(M.from,M.to,O))},getProgress(){let B=e.getBoundingClientRect(),O=V(),M=G(),{tStart:oe,tEnd:le}=Se({top:B.top,height:B.height},O,M,b,F);return E(ee(O,oe,le,g))}}}if(be())return ie();let Y=0,L=0,j=0,ge=!1,re=!1,ne=-1,d=0,q=!1,U=NaN,xe=()=>A?c==="x"?A.scrollLeft:A.scrollTop:c==="x"?window.scrollX:window.scrollY,Oe=()=>A?c==="x"?A.clientWidth:A.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function Le(){let s=e.getBoundingClientRect(),m,N;if(A){let V=A.getBoundingClientRect();m=c==="x"?s.left-V.left+A.scrollLeft:s.top-V.top+A.scrollTop,N=c==="x"?s.width:s.height}else m=c==="x"?s.left:s.top,N=c==="x"?s.width:s.height;let I=Se({top:m,height:N},xe(),Oe(),b,F);Y=I.tStart,L=I.tEnd}function Ae(s){e.style.setProperty("--scroll-draw-progress",String(s));for(let m of C)e.style.setProperty(m.prop,yt(m.from,m.to,s));H?.(s)}function ue(s){if(isNaN(U)){U=s;return}U<=0&&s>0?_?.():U>0&&s<=0&&$?.(),U<1&&s>=1?pe?.():U>=1&&s<1&&x?.(),U=s}function ae(){if(!ge||re)return;let s=L===Y?0:(xe()-Y)/(L-Y);ue(s);let m=E(ee(xe(),Y,L,g));f&&(ne=Math.max(ne,m),m=ne),d=m,Ae(m),m>=1&&!q?(q=!0,v?.()):m<1&&!f&&(q=!1),j=requestAnimationFrame(ae)}Le();{let s=E(ee(xe(),Y,L,g));f&&s>0&&(ne=s),d=s,Ae(s)}let Ie=new IntersectionObserver(s=>{s.forEach(m=>{ge=m.isIntersecting,ge&&!re?j=requestAnimationFrame(ae):cancelAnimationFrame(j)})},{root:A??null}),Me;function z(){clearTimeout(Me),Me=setTimeout(Le,150)}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),Ie.observe(e),_e(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:Y,tEnd:L})}),{destroy(){cancelAnimationFrame(j),Ie.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(Me),Ge(e)},replay(){ne=-1,q=!1,d=0,re=!1,Ae(0)},pause(){re=!0,cancelAnimationFrame(j)},resume(){re&&(re=!1,ge&&(j=requestAnimationFrame(ae)))},seek(s){let m=Math.min(1,Math.max(0,s));d=m,ne=m,re=!0,cancelAnimationFrame(j),Ae(m)},getProgress(){return d}}}var je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function wt(e,r){if(typeof window>"u")return je;let t=typeof e=="string"?document.querySelector(e):e;return t?bt(t,r):(process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollAnimate: element not found:",e),je)}function vt(e,r={}){if(typeof window>"u")return je;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollParallax: element not found:",e),je;let{speed:n=.3,axis:a="y",easing:i="linear",trigger:g,onProgress:f}=r,c=t.getBoundingClientRect(),p=a==="x"?c.width:c.height,T=n*p;return bt(t,{props:a==="x"?{transform:["translateX(0px)",`translateX(${-T}px)`]}:{transform:["translateY(0px)",`translateY(${-T}px)`]},trigger:g??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:f})}var rt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,r){if(typeof window>"u")return rt;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),rt;let n=t,{from:a=0,to:i,format:g,easing:f="ease-out",trigger:c={},once:p=!0,decimals:T,onComplete:H}=r,v=T!==void 0?d=>d.toFixed(T):g??(d=>String(Math.round(d))),_=typeof f=="function"?f:Q[f]??Q["ease-out"],pe=he(c.start??"top 80%"),x=he(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=v(i),H?.(),rt;n.textContent=v(a);let y=0,E=0,b=0,F=!1,A=!1,C=-1,te=0,de=!1,be=()=>window.scrollY,ie=()=>window.innerHeight;function Y(){let d=n.getBoundingClientRect(),q=Se({top:d.top,height:d.height},be(),ie(),pe,x);y=q.tStart,E=q.tEnd}function L(d){n.textContent=v(a+(i-a)*d),n.style.setProperty("--scroll-draw-progress",String(d))}function j(){if(!F||A)return;let d=_(ee(be(),y,E,1));p&&(C=Math.max(C,d),d=C),te=d,L(d),d>=1&&!de?(de=!0,H?.()):d<1&&!p&&(de=!1),b=requestAnimationFrame(j)}Y();{let d=_(ee(be(),y,E,1));p&&d>0&&(C=d),te=d,L(d)}let ge=new IntersectionObserver(d=>{d.forEach(q=>{F=q.isIntersecting,F&&!A?b=requestAnimationFrame(j):cancelAnimationFrame(b)})}),re;function ne(){clearTimeout(re),re=setTimeout(Y,150)}return window.addEventListener("resize",ne),window.addEventListener("orientationchange",ne),ge.observe(n),_e(n,{type:"counter",getProgress:()=>te,getTrigger:()=>({tStart:y,tEnd:E})}),{destroy(){cancelAnimationFrame(b),ge.disconnect(),window.removeEventListener("resize",ne),window.removeEventListener("orientationchange",ne),clearTimeout(re),Ge(n)},replay(){C=-1,de=!1,te=0,A=!1,L(0)},pause(){A=!0,cancelAnimationFrame(b)},resume(){A&&(A=!1,F&&(b=requestAnimationFrame(j)))},seek(d){let q=Math.min(1,Math.max(0,d));te=q,C=q,A=!0,cancelAnimationFrame(b),L(q)},getProgress(){return te}}}var St="http://www.w3.org/2000/svg",_t="cinematic-photo",nt=e=>e<0?0:e>1?1:e;function Xe(e){let r=parseFloat(e);return Number.isFinite(r)?nt(r/100):0}function Gt(e){return Q[e]??Q.linear}var jt={destroy:()=>{},getProgress:()=>0},Ye=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,!this.mount&&process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] Cinematic: wrapper not found:",r.wrapper)}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return jt;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let a=[];for(let x of r.scenes){if(x.background){let y=document.createElement("img");y.id=_t,y.src=x.background,y.alt="",y.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(y)}let $=x.animations.filter(y=>y.type==="draw");if($.length){let y=document.createElementNS(St,"svg");y.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),y.setAttribute("preserveAspectRatio","xMidYMid meet"),y.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(y);for(let E of $){let b=document.createElementNS(St,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let F=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(F),b.style.strokeDashoffset=String(F),y.appendChild(b),a.push({kind:"draw",el:b,start:Xe(E.start),end:Xe(E.end),ease:Gt(E.easing),length:F})}}for(let y of x.animations){if(y.type!=="fade")continue;let E=n.querySelector(y.target)??document.querySelector(y.target);E&&(E.style.opacity=String(y.from),a.push({kind:"fade",el:E,start:Xe(y.start),end:Xe(y.end),ease:Q["ease-in-out"]??Q.linear,from:y.from,to:y.to}))}}let i=0,g=()=>{let x=t.offsetHeight-window.innerHeight;return x<=0?t.getBoundingClientRect().top<=0?1:0:nt(-t.getBoundingClientRect().top/x)},f=x=>{for(let $ of a){let y=$.end-$.start,E=y<=0?x>=$.end?1:0:nt((x-$.start)/y),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return f(1),{destroy:()=>{},getProgress:()=>1};let c=0,p=!1,T=!1,H=()=>{i=g(),f(i),p&&(c=requestAnimationFrame(H))},v=()=>{p||(p=!0,c=requestAnimationFrame(H))},_=()=>{p=!1,cancelAnimationFrame(c)},pe=new IntersectionObserver(x=>{for(let $ of x)T=$.isIntersecting,T?v():_()},{threshold:0});return pe.observe(n),i=g(),f(i),{destroy(){_(),pe.disconnect()},getProgress:()=>i}}};function Xt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?We(n,r):(console.warn("[svg-scroll-draw] Container not found:",e),t)}var ot=class extends HTMLElement{constructor(){super(...arguments);this.instance=null}connectedCallback(){let t={},n=this.getAttribute("speed"),a=this.getAttribute("easing"),i=this.getAttribute("stagger"),g=this.getAttribute("direction"),f=this.getAttribute("selector");n&&(t.speed=parseFloat(n)),a&&(t.easing=a),i&&(t.stagger=parseFloat(i)),g&&(t.direction=g),f&&(t.selector=f),this.hasAttribute("fade")&&(t.fade=this.getAttribute("fade")!=="false"),this.instance=We(this,t)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}};typeof customElements<"u"&&!customElements.get("scroll-draw")&&customElements.define("scroll-draw",ot);return It(Yt);})();
@@ -1 +1 @@
1
- 'use strict';var C=new Map;function x(){return C}var v={draw:"#60a5fa",animate:"#4ade80",counter:"#fbbf24",video:"#c084fc",text:"#fb923c"},n=null,o=null,b=0,p=false,m=null;function L(){o?.remove(),o=document.createElement("div"),o.setAttribute("data-ssd-devtools-overlay",""),o.style.cssText="position:fixed;pointer-events:none;z-index:99998;inset:0;overflow:hidden;",document.body.appendChild(o);}function $(){if(!o)return;o.innerHTML="";let e=window.scrollY,l=window.innerHeight;for(let[,t]of x()){let{tStart:i,tEnd:r}=t.getTrigger(),d=v[t.type]??"#60a5fa",f=i-e,s=r-e;if(s<-100||f>l+100)continue;let c=(u,y)=>{let a=document.createElement("div");a.style.cssText=`position:absolute;left:0;right:0;top:${u}px;height:2px;background:${d};opacity:0.85;`;let g=document.createElement("span");return g.textContent=y,g.style.cssText=`position:absolute;right:8px;top:-18px;font:bold 9px/1 monospace;color:#fff;background:${d};padding:2px 5px;border-radius:3px;white-space:nowrap;`,a.appendChild(g),a};o.appendChild(c(f,`\u25B6 ${t.type}:start`)),o.appendChild(c(s,`\u25A0 ${t.type}:end`));}}function M(){n?.remove(),n=document.createElement("div"),n.setAttribute("data-ssd-devtools-panel",""),n.style.cssText="position:fixed;bottom:12px;right:12px;z-index:99999;background:rgba(10,10,10,0.92);color:#e8e8e3;border-radius:10px;border:1px solid #333;font:12px/1.5 monospace;padding:10px 14px;min-width:220px;max-width:280px;pointer-events:none;backdrop-filter:blur(4px);";let e=document.createElement("div");e.style.cssText="font-weight:bold;font-size:11px;letter-spacing:0.1em;text-transform:uppercase;color:#888;margin-bottom:8px;",e.textContent="\u26A1 svg-scroll-draw devtools",n.appendChild(e),document.body.appendChild(n);}function k(){if(!n)return;for(;n.children.length>1;)n.removeChild(n.lastChild);let e=x();if(e.size===0){let t=document.createElement("div");t.style.cssText="color:#555;font-size:11px;",t.textContent="No active instances.",n.appendChild(t);return}for(let[t,i]of e){let r=i.getProgress(),d=v[i.type]??"#60a5fa",f=t.id?`#${t.id}`:t.className?`.${t.className.split(" ")[0]}`:i.type,s=document.createElement("div");s.style.cssText="margin-bottom:6px;";let c=document.createElement("div");c.style.cssText=`font-size:10px;color:${d};margin-bottom:2px;`,c.textContent=`${i.type} ${f}`;let u=document.createElement("div");u.style.cssText="height:6px;background:#222;border-radius:3px;overflow:hidden;";let y=document.createElement("div");y.style.cssText=`height:100%;width:${Math.round(r*100)}%;background:${d};border-radius:3px;transition:width 0.1s;`,u.appendChild(y),s.appendChild(c),s.appendChild(u);let a=document.createElement("div");a.style.cssText="font-size:9px;color:#555;text-align:right;margin-top:1px;",a.textContent=`${Math.round(r*100)}%`,s.appendChild(a),n.appendChild(s);}}function h(){$(),k(),b=requestAnimationFrame(h);}function E(){process.env.NODE_ENV!=="production"&&(p||(p=true,L(),M(),b=requestAnimationFrame(h),m=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()==="s"&&(e.preventDefault(),w());},window.addEventListener("keydown",m)));}function T(){p&&(p=false,cancelAnimationFrame(b),n?.remove(),n=null,o?.remove(),o=null,m&&(window.removeEventListener("keydown",m),m=null));}function w(){p?T():E();}function H(e){if(!p)return;let l=typeof e=="string"?document.querySelector(e):e;if(!l)return;let t=x().get(l);if(!t)return;let i=v[t.type]??"#60a5fa",r=l,d=r.style.outline;r.style.outline=`2px solid ${i}`,r.style.outlineOffset="2px",setTimeout(()=>{r.style.outline=d,r.style.outlineOffset="";},2e3);}var _={enable:E,disable:T,toggle:w,highlight:H};exports.devtools=_;
1
+ 'use strict';var C=new Map;function x(){return C}var v={draw:"#60a5fa",animate:"#4ade80",counter:"#fbbf24",video:"#c084fc",text:"#fb923c",pin:"#f43f5e",snap:"#22d3ee"},n=null,o=null,b=0,p=false,m=null;function L(){o?.remove(),o=document.createElement("div"),o.setAttribute("data-ssd-devtools-overlay",""),o.style.cssText="position:fixed;pointer-events:none;z-index:99998;inset:0;overflow:hidden;",document.body.appendChild(o);}function $(){if(!o)return;o.innerHTML="";let e=window.scrollY,l=window.innerHeight;for(let[,t]of x()){let{tStart:i,tEnd:r}=t.getTrigger(),d=v[t.type]??"#60a5fa",f=i-e,s=r-e;if(s<-100||f>l+100)continue;let c=(u,y)=>{let a=document.createElement("div");a.style.cssText=`position:absolute;left:0;right:0;top:${u}px;height:2px;background:${d};opacity:0.85;`;let g=document.createElement("span");return g.textContent=y,g.style.cssText=`position:absolute;right:8px;top:-18px;font:bold 9px/1 monospace;color:#fff;background:${d};padding:2px 5px;border-radius:3px;white-space:nowrap;`,a.appendChild(g),a};o.appendChild(c(f,`\u25B6 ${t.type}:start`)),o.appendChild(c(s,`\u25A0 ${t.type}:end`));}}function M(){n?.remove(),n=document.createElement("div"),n.setAttribute("data-ssd-devtools-panel",""),n.style.cssText="position:fixed;bottom:12px;right:12px;z-index:99999;background:rgba(10,10,10,0.92);color:#e8e8e3;border-radius:10px;border:1px solid #333;font:12px/1.5 monospace;padding:10px 14px;min-width:220px;max-width:280px;pointer-events:none;backdrop-filter:blur(4px);";let e=document.createElement("div");e.style.cssText="font-weight:bold;font-size:11px;letter-spacing:0.1em;text-transform:uppercase;color:#888;margin-bottom:8px;",e.textContent="\u26A1 svg-scroll-draw devtools",n.appendChild(e),document.body.appendChild(n);}function k(){if(!n)return;for(;n.children.length>1;)n.removeChild(n.lastChild);let e=x();if(e.size===0){let t=document.createElement("div");t.style.cssText="color:#555;font-size:11px;",t.textContent="No active instances.",n.appendChild(t);return}for(let[t,i]of e){let r=i.getProgress(),d=v[i.type]??"#60a5fa",f=t.id?`#${t.id}`:t.className?`.${t.className.split(" ")[0]}`:i.type,s=document.createElement("div");s.style.cssText="margin-bottom:6px;";let c=document.createElement("div");c.style.cssText=`font-size:10px;color:${d};margin-bottom:2px;`,c.textContent=`${i.type} ${f}`;let u=document.createElement("div");u.style.cssText="height:6px;background:#222;border-radius:3px;overflow:hidden;";let y=document.createElement("div");y.style.cssText=`height:100%;width:${Math.round(r*100)}%;background:${d};border-radius:3px;transition:width 0.1s;`,u.appendChild(y),s.appendChild(c),s.appendChild(u);let a=document.createElement("div");a.style.cssText="font-size:9px;color:#555;text-align:right;margin-top:1px;",a.textContent=`${Math.round(r*100)}%`,s.appendChild(a),n.appendChild(s);}}function h(){$(),k(),b=requestAnimationFrame(h);}function E(){process.env.NODE_ENV!=="production"&&(p||(p=true,L(),M(),b=requestAnimationFrame(h),m=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()==="s"&&(e.preventDefault(),w());},window.addEventListener("keydown",m)));}function T(){p&&(p=false,cancelAnimationFrame(b),n?.remove(),n=null,o?.remove(),o=null,m&&(window.removeEventListener("keydown",m),m=null));}function w(){p?T():E();}function H(e){if(!p)return;let l=typeof e=="string"?document.querySelector(e):e;if(!l)return;let t=x().get(l);if(!t)return;let i=v[t.type]??"#60a5fa",r=l,d=r.style.outline;r.style.outline=`2px solid ${i}`,r.style.outlineOffset="2px",setTimeout(()=>{r.style.outline=d,r.style.outlineOffset="";},2e3);}var _={enable:E,disable:T,toggle:w,highlight:H};exports.devtools=_;
@@ -0,0 +1,12 @@
1
+ declare function enable(): void;
2
+ declare function disable(): void;
3
+ declare function toggle(): void;
4
+ declare function highlight(target: string | Element): void;
5
+ declare const devtools: {
6
+ enable: typeof enable;
7
+ disable: typeof disable;
8
+ toggle: typeof toggle;
9
+ highlight: typeof highlight;
10
+ };
11
+
12
+ export { devtools };
@@ -0,0 +1,12 @@
1
+ declare function enable(): void;
2
+ declare function disable(): void;
3
+ declare function toggle(): void;
4
+ declare function highlight(target: string | Element): void;
5
+ declare const devtools: {
6
+ enable: typeof enable;
7
+ disable: typeof disable;
8
+ toggle: typeof toggle;
9
+ highlight: typeof highlight;
10
+ };
11
+
12
+ export { devtools };
@@ -1 +1 @@
1
- var C=new Map;function x(){return C}var v={draw:"#60a5fa",animate:"#4ade80",counter:"#fbbf24",video:"#c084fc",text:"#fb923c"},n=null,o=null,b=0,p=false,m=null;function L(){o?.remove(),o=document.createElement("div"),o.setAttribute("data-ssd-devtools-overlay",""),o.style.cssText="position:fixed;pointer-events:none;z-index:99998;inset:0;overflow:hidden;",document.body.appendChild(o);}function $(){if(!o)return;o.innerHTML="";let e=window.scrollY,l=window.innerHeight;for(let[,t]of x()){let{tStart:i,tEnd:r}=t.getTrigger(),d=v[t.type]??"#60a5fa",f=i-e,s=r-e;if(s<-100||f>l+100)continue;let c=(u,y)=>{let a=document.createElement("div");a.style.cssText=`position:absolute;left:0;right:0;top:${u}px;height:2px;background:${d};opacity:0.85;`;let g=document.createElement("span");return g.textContent=y,g.style.cssText=`position:absolute;right:8px;top:-18px;font:bold 9px/1 monospace;color:#fff;background:${d};padding:2px 5px;border-radius:3px;white-space:nowrap;`,a.appendChild(g),a};o.appendChild(c(f,`\u25B6 ${t.type}:start`)),o.appendChild(c(s,`\u25A0 ${t.type}:end`));}}function M(){n?.remove(),n=document.createElement("div"),n.setAttribute("data-ssd-devtools-panel",""),n.style.cssText="position:fixed;bottom:12px;right:12px;z-index:99999;background:rgba(10,10,10,0.92);color:#e8e8e3;border-radius:10px;border:1px solid #333;font:12px/1.5 monospace;padding:10px 14px;min-width:220px;max-width:280px;pointer-events:none;backdrop-filter:blur(4px);";let e=document.createElement("div");e.style.cssText="font-weight:bold;font-size:11px;letter-spacing:0.1em;text-transform:uppercase;color:#888;margin-bottom:8px;",e.textContent="\u26A1 svg-scroll-draw devtools",n.appendChild(e),document.body.appendChild(n);}function k(){if(!n)return;for(;n.children.length>1;)n.removeChild(n.lastChild);let e=x();if(e.size===0){let t=document.createElement("div");t.style.cssText="color:#555;font-size:11px;",t.textContent="No active instances.",n.appendChild(t);return}for(let[t,i]of e){let r=i.getProgress(),d=v[i.type]??"#60a5fa",f=t.id?`#${t.id}`:t.className?`.${t.className.split(" ")[0]}`:i.type,s=document.createElement("div");s.style.cssText="margin-bottom:6px;";let c=document.createElement("div");c.style.cssText=`font-size:10px;color:${d};margin-bottom:2px;`,c.textContent=`${i.type} ${f}`;let u=document.createElement("div");u.style.cssText="height:6px;background:#222;border-radius:3px;overflow:hidden;";let y=document.createElement("div");y.style.cssText=`height:100%;width:${Math.round(r*100)}%;background:${d};border-radius:3px;transition:width 0.1s;`,u.appendChild(y),s.appendChild(c),s.appendChild(u);let a=document.createElement("div");a.style.cssText="font-size:9px;color:#555;text-align:right;margin-top:1px;",a.textContent=`${Math.round(r*100)}%`,s.appendChild(a),n.appendChild(s);}}function h(){$(),k(),b=requestAnimationFrame(h);}function E(){process.env.NODE_ENV!=="production"&&(p||(p=true,L(),M(),b=requestAnimationFrame(h),m=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()==="s"&&(e.preventDefault(),w());},window.addEventListener("keydown",m)));}function T(){p&&(p=false,cancelAnimationFrame(b),n?.remove(),n=null,o?.remove(),o=null,m&&(window.removeEventListener("keydown",m),m=null));}function w(){p?T():E();}function H(e){if(!p)return;let l=typeof e=="string"?document.querySelector(e):e;if(!l)return;let t=x().get(l);if(!t)return;let i=v[t.type]??"#60a5fa",r=l,d=r.style.outline;r.style.outline=`2px solid ${i}`,r.style.outlineOffset="2px",setTimeout(()=>{r.style.outline=d,r.style.outlineOffset="";},2e3);}var _={enable:E,disable:T,toggle:w,highlight:H};export{_ as devtools};
1
+ var C=new Map;function x(){return C}var v={draw:"#60a5fa",animate:"#4ade80",counter:"#fbbf24",video:"#c084fc",text:"#fb923c",pin:"#f43f5e",snap:"#22d3ee"},n=null,o=null,b=0,p=false,m=null;function L(){o?.remove(),o=document.createElement("div"),o.setAttribute("data-ssd-devtools-overlay",""),o.style.cssText="position:fixed;pointer-events:none;z-index:99998;inset:0;overflow:hidden;",document.body.appendChild(o);}function $(){if(!o)return;o.innerHTML="";let e=window.scrollY,l=window.innerHeight;for(let[,t]of x()){let{tStart:i,tEnd:r}=t.getTrigger(),d=v[t.type]??"#60a5fa",f=i-e,s=r-e;if(s<-100||f>l+100)continue;let c=(u,y)=>{let a=document.createElement("div");a.style.cssText=`position:absolute;left:0;right:0;top:${u}px;height:2px;background:${d};opacity:0.85;`;let g=document.createElement("span");return g.textContent=y,g.style.cssText=`position:absolute;right:8px;top:-18px;font:bold 9px/1 monospace;color:#fff;background:${d};padding:2px 5px;border-radius:3px;white-space:nowrap;`,a.appendChild(g),a};o.appendChild(c(f,`\u25B6 ${t.type}:start`)),o.appendChild(c(s,`\u25A0 ${t.type}:end`));}}function M(){n?.remove(),n=document.createElement("div"),n.setAttribute("data-ssd-devtools-panel",""),n.style.cssText="position:fixed;bottom:12px;right:12px;z-index:99999;background:rgba(10,10,10,0.92);color:#e8e8e3;border-radius:10px;border:1px solid #333;font:12px/1.5 monospace;padding:10px 14px;min-width:220px;max-width:280px;pointer-events:none;backdrop-filter:blur(4px);";let e=document.createElement("div");e.style.cssText="font-weight:bold;font-size:11px;letter-spacing:0.1em;text-transform:uppercase;color:#888;margin-bottom:8px;",e.textContent="\u26A1 svg-scroll-draw devtools",n.appendChild(e),document.body.appendChild(n);}function k(){if(!n)return;for(;n.children.length>1;)n.removeChild(n.lastChild);let e=x();if(e.size===0){let t=document.createElement("div");t.style.cssText="color:#555;font-size:11px;",t.textContent="No active instances.",n.appendChild(t);return}for(let[t,i]of e){let r=i.getProgress(),d=v[i.type]??"#60a5fa",f=t.id?`#${t.id}`:t.className?`.${t.className.split(" ")[0]}`:i.type,s=document.createElement("div");s.style.cssText="margin-bottom:6px;";let c=document.createElement("div");c.style.cssText=`font-size:10px;color:${d};margin-bottom:2px;`,c.textContent=`${i.type} ${f}`;let u=document.createElement("div");u.style.cssText="height:6px;background:#222;border-radius:3px;overflow:hidden;";let y=document.createElement("div");y.style.cssText=`height:100%;width:${Math.round(r*100)}%;background:${d};border-radius:3px;transition:width 0.1s;`,u.appendChild(y),s.appendChild(c),s.appendChild(u);let a=document.createElement("div");a.style.cssText="font-size:9px;color:#555;text-align:right;margin-top:1px;",a.textContent=`${Math.round(r*100)}%`,s.appendChild(a),n.appendChild(s);}}function h(){$(),k(),b=requestAnimationFrame(h);}function E(){process.env.NODE_ENV!=="production"&&(p||(p=true,L(),M(),b=requestAnimationFrame(h),m=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()==="s"&&(e.preventDefault(),w());},window.addEventListener("keydown",m)));}function T(){p&&(p=false,cancelAnimationFrame(b),n?.remove(),n=null,o?.remove(),o=null,m&&(window.removeEventListener("keydown",m),m=null));}function w(){p?T():E();}function H(e){if(!p)return;let l=typeof e=="string"?document.querySelector(e):e;if(!l)return;let t=x().get(l);if(!t)return;let i=v[t.type]??"#60a5fa",r=l,d=r.style.outline;r.style.outline=`2px solid ${i}`,r.style.outlineOffset="2px",setTimeout(()=>{r.style.outline=d,r.style.outlineOffset="";},2e3);}var _={enable:E,disable:T,toggle:w,highlight:H};export{_ as devtools};
@@ -1,3 +1,3 @@
1
- 'use strict';function rt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),s=Math.max(.01,Math.min(.99,r)),m=Math.sqrt(s),u=0,S=[];for(let y=0;y<n;y++){let $=Math.pow(m,y);S.push($),u+=$;}let w=[0],p=0;for(let y=0;y<n;y++)p+=S[y]/u,w.push(p);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let $=0;$<n;$++)if(y<=w[$+1]){let V=(y-w[$])/(w[$+1]-w[$]);if($===0)return V*(2-V);let h=1-Math.pow(s,$);return h+(1-h)*(2*V-1)*(2*V-1)}return 1}}function nt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),s=Math.max(.1,r),m=n<=1?s/4:s/(2*Math.PI)*Math.asin(1/n);return u=>u<=0?0:u>=1?1:n*Math.pow(2,-10*u)*Math.sin((u-m)*(2*Math.PI)/s)+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:rt(),elastic:nt()};function De(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",s="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:s}}function ze(e,r,n,s){switch(s){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Ge(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Ee(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function st(e,r,n){return Math.min(n,Math.max(r,e))}function ae(e,r,n,s){return n===r?0:st((e-r)/(n-r)*s,0,1)}function Le(e,r,n,s,m){let u=ze(e.top,e.height,r,s.element)-Ge(s.viewport,n),S=ze(e.top,e.height,r,m.element)-Ge(m.viewport,n);return {tStart:u,tEnd:S}}function Ve(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 s=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return s?[parseInt(s[1]),parseInt(s[2]),parseInt(s[3])]:null}function xe(e,r,n){let s=Ve(e),m=Ve(r);return !s||!m?e:`rgb(${Math.round(s[0]+(m[0]-s[0])*n)},${Math.round(s[1]+(m[1]-s[1])*n)},${Math.round(s[2]+(m[2]-s[2])*n)})`}var Be={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 _e(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var Xe={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},ot=0;function at(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function it(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?_e("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&_e("Element has a fill \u2014 it may obscure the stroke animation.",e);}function lt(e,r,n){let s=document.createElement("div");s.setAttribute("data-svg-scroll-draw-debug",""),s.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function m(){let u=n==="x"?window.scrollX:window.scrollY,S=e-u,w=r-u,p=n==="x";s.innerHTML=`
2
- <div style="position:absolute;${p?`left:${S}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${S}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;${p?`left:${w}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${w}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(s),window.addEventListener("scroll",m,{passive:true}),m(),s}function Ie(e,r,n){let s=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),m=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,u=>{let S=parseFloat(u),w=s[m++]??S;return String(+(S+(w-S)*n).toFixed(4))})}function Oe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...s}=r,m=n?{...Be[n],...s}:s,u=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:S="path, polyline, line, polygon, rect, circle",speed:w=1,fade:p=false,easing:y="linear",trigger:$={},stagger:V=0,direction:h="forward",once:K=false,debug:je=false,axis:N="y",scrollContainer:$e,autoReverse:me=false,delay:ue=0,strokeColor:Q,strokeWidth:Y,fillOpacity:Z,waypoints:ee,velocityScale:pe=false,threshold:Fe=0,rootMargin:Ce="0px",repeat:te=0,repeatDelay:Se=0,morphTo:W,clip:ke,autoplay:Je=false,duration:Ke=1e3,native:Qe=true,onProgress:ce,onStart:de,onComplete:ie}=m,_=ke===true?"left":typeof ke=="string"?ke:false,re=typeof y=="function"?y:Pe[y]??Pe.linear,Re=De($.start??"top bottom"),Ne=De($.end??"bottom top"),I=typeof $e=="string"?document.querySelector($e):$e??null,q=Array.isArray(Q)?Q[0]:null,A=Array.isArray(Q)?Q[1]:typeof Q=="string"?Q:null,O=Array.isArray(Y)?Y[0]:null,T=Array.isArray(Y)?Y[1]:typeof Y=="number"?Y:null,F=Array.isArray(Z)?Z[0]:null,P=Array.isArray(Z)?Z[1]:typeof Z=="number"?Z:null;function ne(t){let o=t*100;switch(_){case "right":return `inset(0 0 0 ${100-o}%)`;case "top":return `inset(0 0 ${100-o}% 0)`;case "bottom":return `inset(${100-o}% 0 0 0)`;case "center":return `circle(${t*150}% at 50% 50%)`;default:return `inset(0 ${100-o}% 0 0)`}}let k=_?[]:Array.from(e.querySelectorAll(S)),E=[],H=[],X=0,U=0,M=false,R=false,x=0,ye=false,z=-1,ge=-1,D=false,se=0,B=0,j,Me=null,J=new Set,he=-1,We=performance.now();function fe(){return I?N==="x"?I.scrollLeft:I.scrollTop:N==="x"?window.scrollX:window.scrollY}function qe(){return I?N==="x"?I.clientWidth:I.clientHeight:N==="x"?window.innerWidth:window.innerHeight}function He(){let t=e.getBoundingClientRect(),o,l,b;if(I){let L=I.getBoundingClientRect();o=N==="x"?t.left-L.left+I.scrollLeft:t.top-L.top+I.scrollTop,l=N==="x"?t.width:t.height,b=fe();}else o=N==="x"?t.left:t.top,l=N==="x"?t.width:t.height,b=fe();let C=Le({top:o,height:l},b,qe(),Re,Ne);X=C.tStart,U=C.tEnd,je&&process.env.NODE_ENV!=="production"&&(Me?.remove(),Me=lt(X,U,N));}function Ye(t,o){if(e.style.setProperty("--scroll-draw-progress",String(t)),_){let l=o==="reverse"?1-t:t;e.style.clipPath=ne(l);return}k.forEach((l,b)=>{l.style.strokeDashoffset=o==="reverse"?`${E[b]*t}`:`${E[b]*(1-t)}`,p&&(l.style.opacity=o==="reverse"?`${1-t}`:`${t}`),q&&A?l.style.stroke=xe(q,A,t):A&&(l.style.stroke=A),O!==null&&T!==null?l.style.strokeWidth=`${O+(T-O)*t}`:T!==null&&(l.style.strokeWidth=`${T}`),F!==null&&P!==null?l.style.fillOpacity=`${F+(P-F)*t}`:P!==null&&(l.style.fillOpacity=`${P}`),W&&l.tagName.toLowerCase()==="path"&&H[b]&&l.setAttribute("d",Ie(H[b],W,t));});}function be(){if(e.style.setProperty("--scroll-draw-progress","0"),_){e.style.clipPath=ne(0);return}k.forEach((t,o)=>{t.style.strokeDasharray=`${E[o]}`,t.style.strokeDashoffset=h==="reverse"?"0":`${E[o]}`,p?t.style.opacity=h==="reverse"?"1":"0":t.style.opacity="",q&&(t.style.stroke=q),O!==null&&(t.style.strokeWidth=`${O}`),F!==null&&(t.style.fillOpacity=`${F}`),W&&t.tagName.toLowerCase()==="path"&&H[o]&&t.setAttribute("d",H[o]);});}if(k.forEach(t=>{it(t);let o=Ee(t);E.push(o),t.tagName.toLowerCase()==="path"?H.push(t.getAttribute("d")??""):H.push(""),u?(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=h==="reverse"?`${o}`:"0",p&&(t.style.opacity="1"),A&&(t.style.stroke=A),T!==null&&(t.style.strokeWidth=`${T}`),P!==null&&(t.style.fillOpacity=`${P}`),W&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",W)):(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=h==="reverse"?"0":`${o}`,p?t.style.opacity=h==="reverse"?"1":"0":t.style.opacity="",q&&(t.style.stroke=q),O!==null&&(t.style.strokeWidth=`${O}`),F!==null&&(t.style.fillOpacity=`${F}`));}),_){if(u)return e.style.clipPath=ne(1),ie?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ne(0);}else if(u)return ie?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function Ze(){return !(Qe===false||!at()||!k.length||typeof y!="string"||!(y in Xe)||_||N!=="y"||I||w!==1||V!==0||K||me||pe!==false||W||ee||te||ue>0||ce||de||ie||Q!=null||Y!=null||Z!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function et(){let t=`svg-scroll-draw-${++ot}`,o=h==="reverse"?"0":"var(--ssd-len)",l=h==="reverse"?"var(--ssd-len)":"0",b=`stroke-dashoffset:${o};`,C=`stroke-dashoffset:${l};`;p&&(b+=`opacity:${h==="reverse"?1:0};`,C+=`opacity:${h==="reverse"?0:1};`);let L=document.createElement("style");L.setAttribute("data-svg-scroll-draw",""),L.textContent=`@keyframes ${t}{from{${b}}to{${C}}}.${t}{animation-name:${t};animation-duration:auto;animation-timing-function:${Xe[y]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(L);function i(a,f){a.style.setProperty("--ssd-len",String(E[f])),a.style.strokeDasharray=`${E[f]}`,a.style.strokeDashoffset="",a.style.opacity="",a.style.animationPlayState="",a.classList.add(t);}k.forEach(i);let d=false,v=-1;function c(){if(v>=0)return v;let a=e.getBoundingClientRect(),{tStart:f,tEnd:g}=Le({top:a.top,height:a.height},fe(),qe(),Re,Ne);return re(ae(fe(),f,g,w))}return {destroy(){k.forEach(a=>{a.classList.remove(t),a.style.removeProperty("--ssd-len"),a.style.animationPlayState="";}),L.remove();},replay(){d=false,v=-1,k.forEach(i);},pause(){d=true,k.forEach(a=>{a.style.animationPlayState="paused";});},resume(){d&&(d=false,k.forEach(a=>{a.style.animationPlayState="running";}));},seek(a){let f=Math.min(1,Math.max(0,a));v=f,d=true,k.forEach((g,oe)=>{g.classList.remove(t),g.style.strokeDashoffset=h==="reverse"?`${E[oe]*f}`:`${E[oe]*(1-f)}`,p&&(g.style.opacity=h==="reverse"?`${1-f}`:`${f}`);});},getProgress(){return c()}}}if(Ze())return et();function tt(){let t=Math.max(1,Ke),o=0,l=0;function b(c){let a=true;if(_){let f=Math.min(1,Math.max(0,c/t)),g=re(f);se=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=ne(h==="reverse"?1-g:g),ce?.(g),f<1&&(a=false);}else k.forEach((f,g)=>{let oe=g*V*t,le=Math.min(1,Math.max(0,(c-oe)/t)),G=re(le);f.style.strokeDashoffset=h==="reverse"?`${E[g]*G}`:`${E[g]*(1-G)}`,p&&(f.style.opacity=h==="reverse"?`${1-G}`:`${G}`),q&&A?f.style.stroke=xe(q,A,G):A&&(f.style.stroke=A),O!==null&&T!==null?f.style.strokeWidth=`${O+(T-O)*G}`:T!==null&&(f.style.strokeWidth=`${T}`),F!==null&&P!==null?f.style.fillOpacity=`${F+(P-F)*G}`:P!==null&&(f.style.fillOpacity=`${P}`),W&&f.tagName.toLowerCase()==="path"&&H[g]&&f.setAttribute("d",Ie(H[g],W,G)),g===0&&(ce?.(G),e.style.setProperty("--scroll-draw-progress",String(G))),le<1&&(a=false);});if(ee){let f=Math.min(1,Math.max(0,c/t)),g=re(f);for(let oe in ee){let le=parseFloat(oe);g>=le&&!J.has(le)&&(J.add(le),ee[oe]?.());}}return a}function C(c){if(D)return;let a=c-o;R||(R=true,de?.());let f=b(a);if(f&&!M){M=true,b(t*(1+Math.max(0,k.length-1)*V)),ie?.(),B<(te==="infinite"?1/0:te??0)&&(B++,j=setTimeout(()=>{o=performance.now(),R=false,M=false,J.clear(),be(),x=requestAnimationFrame(C);},Se));return}f||(x=requestAnimationFrame(C));}function L(){cancelAnimationFrame(x),clearTimeout(j),o=performance.now(),l=0,D=false,R=false,M=false,B=0,J.clear(),be(),x=requestAnimationFrame(C);}let i=new IntersectionObserver(c=>{c.forEach(a=>{a.isIntersecting&&!(K&&M)?L():!a.isIntersecting&&!K&&!M&&(cancelAnimationFrame(x),clearTimeout(j),o=null);});},{root:I??null,threshold:Fe,rootMargin:Ce}),d;function v(){clearTimeout(d),d=setTimeout(()=>{k.forEach((c,a)=>{E[a]=Ee(c),c.style.strokeDasharray=`${E[a]}`;});},150);}return window.addEventListener("resize",v),window.addEventListener("orientationchange",v),ue>0?setTimeout(()=>i.observe(e),ue):i.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(j),i.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),clearTimeout(d);},replay(){B=0,L();},pause(){D||(D=true,l=performance.now()-o,cancelAnimationFrame(x));},resume(){D&&(D=false,o=performance.now()-l,x=requestAnimationFrame(C));},seek(c){let a=Math.min(1,Math.max(0,c));se=a,D=true,l=a*t,o=performance.now()-l,cancelAnimationFrame(x),b(l);},getProgress(){return se}}}if(Je)return tt();He();function we(){if(!ye||D)return;let t=performance.now(),o=fe(),l=w;if(pe!==false){let i=t-We,d=i>0?Math.abs(o-(he<0?o:he))/i:0;l=w*Math.max(.2,1+d*(typeof pe=="number"?pe:1)*.04);}he=o,We=t;let b=me?ge===-1||o>=ge?"forward":"reverse":h;ge=o;let C=U-X,L=true;if(_){let i=re(ae(o,X,U,l));K&&!me&&(z=Math.max(z,i),i=z),se=i,e.style.setProperty("--scroll-draw-progress",String(i));let d=b==="reverse"?1-i:i;e.style.clipPath=ne(d),ce?.(i),!R&&ae(o,X,U,l)>0&&(R=true,de?.()),i>=1&&!M?(M=true,ie?.(),B<(te==="infinite"?1/0:te??0)&&(B++,j=setTimeout(()=>{z=-1,R=false,M=false,e.style.clipPath=ne(0);},Se))):i<1&&!K&&(M=false),x=requestAnimationFrame(we);return}if(k.forEach((i,d)=>{let v=d*V*C,c=re(ae(o,X+v,U+v,l));K&&!me&&(z=Math.max(z,c),c=z),se=c,i.style.strokeDashoffset=b==="reverse"?`${E[d]*c}`:`${E[d]*(1-c)}`,p&&(i.style.opacity=b==="reverse"?`${1-c}`:`${c}`),q&&A?i.style.stroke=xe(q,A,c):A&&(i.style.stroke=A),O!==null&&T!==null?i.style.strokeWidth=`${O+(T-O)*c}`:T!==null&&(i.style.strokeWidth=`${T}`),F!==null&&P!==null?i.style.fillOpacity=`${F+(P-F)*c}`:P!==null&&(i.style.fillOpacity=`${P}`),W&&i.tagName.toLowerCase()==="path"&&H[d]&&i.setAttribute("d",Ie(H[d],W,c)),d===0&&(ce?.(c),e.style.setProperty("--scroll-draw-progress",String(c))),c<1&&(L=false);}),ee){let i=re(ae(o,X,U,l));for(let d in ee){let v=parseFloat(d);i>=v&&!J.has(v)&&(J.add(v),ee[d]?.());}}!R&&ae(o,X,U,l)>0&&(R=true,de?.()),L&&!M?(M=true,ie?.(),B<(te==="infinite"?1/0:te??0)&&(B++,j=setTimeout(()=>{z=-1,R=false,M=false,J.clear(),be();},Se))):!L&&!K&&(M=false),x=requestAnimationFrame(we);}let Ae=new IntersectionObserver(t=>{t.forEach(o=>{ye=o.isIntersecting,ye&&!D?x=requestAnimationFrame(we):cancelAnimationFrame(x);});},{root:I??null,threshold:Fe,rootMargin:Ce}),Te;function ve(){clearTimeout(Te),Te=setTimeout(()=>{k.forEach((t,o)=>{E[o]=Ee(t),t.style.strokeDasharray=`${E[o]}`;}),He();},150);}return window.addEventListener("resize",ve),window.addEventListener("orientationchange",ve),ue>0?setTimeout(()=>Ae.observe(e),ue):Ae.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(j),Ae.disconnect(),window.removeEventListener("resize",ve),window.removeEventListener("orientationchange",ve),clearTimeout(Te),Me?.remove();},replay(){z=-1,ge=-1,he=-1,R=false,M=false,B=0,D=false,J.clear(),clearTimeout(j),be();},pause(){D=true,cancelAnimationFrame(x);},resume(){D&&(D=false,ye&&(x=requestAnimationFrame(we)));},seek(t){let o=Math.min(1,Math.max(0,t));se=o,z=o,D=true,cancelAnimationFrame(x),Ye(o,h);},getProgress(){return se}}}function Ue(e){return e.map(r=>typeof r=="string"?document.querySelector(r):r).filter(r=>r!==null)}function yt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let n=Ue(e).map(s=>Oe(s,r));return {destroy(){n.forEach(s=>s.destroy());},replay(){n.forEach(s=>s.replay());},pause(){n.forEach(s=>s.pause());},resume(){n.forEach(s=>s.resume());},seek(s){n.forEach(m=>m.seek(s));},getProgress(){return n[0]?.getProgress()??0}}}function gt(e,r={}){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let s=Ue(e);if(s.length===0)return n;let m=0,u=[];function S(p){return Oe(s[p],{...r,once:true,onComplete(){r.onComplete?.(),m=p+1,u[m]?.resume();}})}function w(){s.forEach((p,y)=>{u[y]=S(y);});for(let p=1;p<u.length;p++)u[p].pause();}return w(),{destroy(){u.forEach(p=>p.destroy()),u.length=0;},replay(){u.forEach(p=>p.destroy()),u.length=0,m=0,w();},pause(){u[m]?.pause();},resume(){u[m]?.resume();},seek(p){u[m]?.seek(p);},getProgress(){return u[m]?.getProgress()??0}}}exports.scrollDrawGroup=yt;exports.scrollDrawSequence=gt;
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)),o=Math.sqrt(t),f=0,d=[];for(let g=0;g<r;g++){let x=Math.pow(o,g);d.push(x),f+=x;}let i=[0],u=0;for(let g=0;g<r;g++)u+=d[g]/f,i.push(u);return g=>{if(g<=0)return 0;if(g>=1)return 1;for(let x=0;x<r;x++)if(g<=i[x+1]){let B=(g-i[x])/(i[x+1]-i[x]);if(x===0)return B*(2-B);let b=1-Math.pow(t,x);return b+(1-b)*(2*B-1)*(2*B-1)}return 1}}function bt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),o=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return f=>f<=0?0:f>=1?1:r*Math.pow(2,-10*f)*Math.sin((f-o)*(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:ht(),elastic:bt()};function Te(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 Qe(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 et(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ve(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function wt(e,n,r){return Math.min(r,Math.max(n,e))}function J(e,n,r,t){return r===n?0:wt((e-n)/(r-n)*t,0,1)}function Pe(e,n,r,t,o){let f=Qe(e.top,e.height,n,t.element)-et(t.viewport,r),d=Qe(e.top,e.height,n,o.element)-et(o.viewport,r);return {tStart:f,tEnd:d}}function tt(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 Me(e,n,r){let t=tt(e),o=tt(n);return !t||!o?e:`rgb(${Math.round(t[0]+(o[0]-t[0])*r)},${Math.round(t[1]+(o[1]-t[1])*r)},${Math.round(t[2]+(o[2]-t[2])*r)})`}var rt={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 nt(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var st={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Et=0;function vt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function St(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?nt("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&nt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function xt(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 o(){let f=r==="x"?window.scrollX:window.scrollY,d=e-f,i=n-f,u=r==="x";t.innerHTML=`
2
+ <div style="position:absolute;${u?`left:${d}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${d}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:${i}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${i}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",o,{passive:true}),o(),t}function Ye(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,f=>{let d=parseFloat(f),i=t[o++]??d;return String(+(d+(i-d)*r).toFixed(4))})}function Ue(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,o=r?{...rt[r],...t}:t,f=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:i=1,fade:u=false,easing:g="linear",trigger:x={},stagger:B=0,direction:b="forward",once:K=false,debug:Ce=false,axis:q="y",scrollContainer:be,autoReverse:we=false,delay:se=0,strokeColor:Q,strokeWidth:ee,fillOpacity:A,waypoints:N,velocityScale:Ee=false,threshold:Oe=0,rootMargin:Ne="0px",repeat:oe=0,repeatDelay:j=0,morphTo:I,clip:X,autoplay:ve=false,duration:ie=1e3,native:ue=true,onProgress:V,onStart:ae,onComplete:R,onEnter:pe,onLeave:Fe,onEnterBack:ke,onLeaveBack:de}=o,te=X===true?"left":typeof X=="string"?X:false,Y=typeof g=="function"?g:Ae[g]??Ae.linear,Le=Te(x.start??"top bottom"),Se=Te(x.end??"bottom top"),k=typeof be=="string"?document.querySelector(be):be??null,a=Array.isArray(Q)?Q[0]:null,m=Array.isArray(Q)?Q[1]:typeof Q=="string"?Q:null,P=Array.isArray(ee)?ee[0]:null,S=Array.isArray(ee)?ee[1]:typeof ee=="number"?ee:null,L=Array.isArray(A)?A[0]:null,O=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function D(s){let l=s*100;switch(te){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let T=te?[]:Array.from(e.querySelectorAll(d)),w=[],_=[],U=0,ce=0,F=false,Z=false,C=0,Re=false,re=-1,He=-1,H=false,ge=0,le=0,fe,Ge=null,me=new Set,ze=-1,Ze=performance.now(),xe=NaN;function De(){return k?q==="x"?k.scrollLeft:k.scrollTop:q==="x"?window.scrollX:window.scrollY}function Je(){return k?q==="x"?k.clientWidth:k.clientHeight:q==="x"?window.innerWidth:window.innerHeight}function Ke(){let s=e.getBoundingClientRect(),l,y,M;if(k){let W=k.getBoundingClientRect();l=q==="x"?s.left-W.left+k.scrollLeft:s.top-W.top+k.scrollTop,y=q==="x"?s.width:s.height,M=De();}else l=q==="x"?s.left:s.top,y=q==="x"?s.width:s.height,M=De();let z=Pe({top:l,height:y},M,Je(),Le,Se);U=z.tStart,ce=z.tEnd,Ce&&process.env.NODE_ENV!=="production"&&(Ge?.remove(),Ge=xt(U,ce,q));}function pt(s,l){if(e.style.setProperty("--scroll-draw-progress",String(s)),te){let y=l==="reverse"?1-s:s;e.style.clipPath=D(y);return}T.forEach((y,M)=>{y.style.strokeDashoffset=l==="reverse"?`${w[M]*s}`:`${w[M]*(1-s)}`,u&&(y.style.opacity=l==="reverse"?`${1-s}`:`${s}`),a&&m?y.style.stroke=Me(a,m,s):m&&(y.style.stroke=m),P!==null&&S!==null?y.style.strokeWidth=`${P+(S-P)*s}`:S!==null&&(y.style.strokeWidth=`${S}`),L!==null&&O!==null?y.style.fillOpacity=`${L+(O-L)*s}`:O!==null&&(y.style.fillOpacity=`${O}`),I&&y.tagName.toLowerCase()==="path"&&_[M]&&y.setAttribute("d",Ye(_[M],I,s));});}function We(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=D(0);return}T.forEach((s,l)=>{s.style.strokeDasharray=`${w[l]}`,s.style.strokeDashoffset=b==="reverse"?"0":`${w[l]}`,u?s.style.opacity=b==="reverse"?"1":"0":s.style.opacity="",a&&(s.style.stroke=a),P!==null&&(s.style.strokeWidth=`${P}`),L!==null&&(s.style.fillOpacity=`${L}`),I&&s.tagName.toLowerCase()==="path"&&_[l]&&s.setAttribute("d",_[l]);});}if(T.forEach(s=>{St(s);let l=Ve(s);w.push(l),s.tagName.toLowerCase()==="path"?_.push(s.getAttribute("d")??""):_.push(""),f?(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=b==="reverse"?`${l}`:"0",u&&(s.style.opacity="1"),m&&(s.style.stroke=m),S!==null&&(s.style.strokeWidth=`${S}`),O!==null&&(s.style.fillOpacity=`${O}`),I&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",I)):(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=b==="reverse"?"0":`${l}`,u?s.style.opacity=b==="reverse"?"1":"0":s.style.opacity="",a&&(s.style.stroke=a),P!==null&&(s.style.strokeWidth=`${P}`),L!==null&&(s.style.fillOpacity=`${L}`));}),te){if(f)return e.style.clipPath=D(1),R?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=D(0);}else if(f)return R?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function dt(){return !(ue===false||!vt()||!T.length||typeof g!="string"||!(g in st)||te||q!=="y"||k||i!==1||B!==0||K||we||Ee!==false||I||N||oe||se>0||V||ae||R||pe||Fe||ke||de||Q!=null||ee!=null||A!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function gt(){let s=`svg-scroll-draw-${++Et}`,l=b==="reverse"?"0":"var(--ssd-len)",y=b==="reverse"?"var(--ssd-len)":"0",M=`stroke-dashoffset:${l};`,z=`stroke-dashoffset:${y};`;u&&(M+=`opacity:${b==="reverse"?1:0};`,z+=`opacity:${b==="reverse"?0:1};`);let W=document.createElement("style");W.setAttribute("data-svg-scroll-draw",""),W.textContent=`@keyframes ${s}{from{${M}}to{${z}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${st[g]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(W);function G(c,h){c.style.setProperty("--ssd-len",String(w[h])),c.style.strokeDasharray=`${w[h]}`,c.style.strokeDashoffset="",c.style.opacity="",c.style.animationPlayState="",c.classList.add(s);}T.forEach(G);let p=false,E=-1;function v(){if(E>=0)return E;let c=e.getBoundingClientRect(),{tStart:h,tEnd:$}=Pe({top:c.top,height:c.height},De(),Je(),Le,Se);return Y(J(De(),h,$,i))}return {destroy(){T.forEach(c=>{c.classList.remove(s),c.style.removeProperty("--ssd-len"),c.style.animationPlayState="";}),W.remove();},replay(){p=false,E=-1,T.forEach(G);},pause(){p=true,T.forEach(c=>{c.style.animationPlayState="paused";});},resume(){p&&(p=false,T.forEach(c=>{c.style.animationPlayState="running";}));},seek(c){let h=Math.min(1,Math.max(0,c));E=h,p=true,T.forEach(($,ye)=>{$.classList.remove(s),$.style.strokeDashoffset=b==="reverse"?`${w[ye]*h}`:`${w[ye]*(1-h)}`,u&&($.style.opacity=b==="reverse"?`${1-h}`:`${h}`);});},getProgress(){return v()}}}if(dt())return gt();function yt(){let s=Math.max(1,ie),l=0,y=0;function M(v){let c=true;if(te){let h=Math.min(1,Math.max(0,v/s)),$=Y(h);ge=$,e.style.setProperty("--scroll-draw-progress",String($)),e.style.clipPath=D(b==="reverse"?1-$:$),V?.($),h<1&&(c=false);}else T.forEach((h,$)=>{let ye=$*B*s,$e=Math.min(1,Math.max(0,(v-ye)/s)),ne=Y($e);h.style.strokeDashoffset=b==="reverse"?`${w[$]*ne}`:`${w[$]*(1-ne)}`,u&&(h.style.opacity=b==="reverse"?`${1-ne}`:`${ne}`),a&&m?h.style.stroke=Me(a,m,ne):m&&(h.style.stroke=m),P!==null&&S!==null?h.style.strokeWidth=`${P+(S-P)*ne}`:S!==null&&(h.style.strokeWidth=`${S}`),L!==null&&O!==null?h.style.fillOpacity=`${L+(O-L)*ne}`:O!==null&&(h.style.fillOpacity=`${O}`),I&&h.tagName.toLowerCase()==="path"&&_[$]&&h.setAttribute("d",Ye(_[$],I,ne)),$===0&&(V?.(ne),e.style.setProperty("--scroll-draw-progress",String(ne))),$e<1&&(c=false);});if(N){let h=Math.min(1,Math.max(0,v/s)),$=Y(h);for(let ye in N){let $e=parseFloat(ye);$>=$e&&!me.has($e)&&(me.add($e),N[ye]?.());}}return c}function z(v){if(H)return;let c=v-l;Z||(Z=true,ae?.());let h=M(c);if(h&&!F){F=true,M(s*(1+Math.max(0,T.length-1)*B)),R?.(),le<(oe==="infinite"?1/0:oe??0)&&(le++,fe=setTimeout(()=>{l=performance.now(),Z=false,F=false,me.clear(),We(),C=requestAnimationFrame(z);},j));return}h||(C=requestAnimationFrame(z));}function W(){cancelAnimationFrame(C),clearTimeout(fe),l=performance.now(),y=0,H=false,Z=false,F=false,le=0,me.clear(),We(),C=requestAnimationFrame(z);}let G=new IntersectionObserver(v=>{v.forEach(c=>{c.isIntersecting&&!(K&&F)?W():!c.isIntersecting&&!K&&!F&&(cancelAnimationFrame(C),clearTimeout(fe),l=null);});},{root:k??null,threshold:Oe,rootMargin:Ne}),p;function E(){clearTimeout(p),p=setTimeout(()=>{T.forEach((v,c)=>{w[c]=Ve(v),v.style.strokeDasharray=`${w[c]}`;});},150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),se>0?setTimeout(()=>G.observe(e),se):G.observe(e),{destroy(){cancelAnimationFrame(C),clearTimeout(fe),G.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(p);},replay(){le=0,W();},pause(){H||(H=true,y=performance.now()-l,cancelAnimationFrame(C));},resume(){H&&(H=false,l=performance.now()-y,C=requestAnimationFrame(z));},seek(v){let c=Math.min(1,Math.max(0,v));ge=c,H=true,y=c*s,l=performance.now()-y,cancelAnimationFrame(C),M(y);},getProgress(){return ge}}}if(ve)return yt();Ke();function qe(){if(!Re||H)return;let s=performance.now(),l=De(),y=i;if(Ee!==false){let p=s-Ze,E=p>0?Math.abs(l-(ze<0?l:ze))/p:0;y=i*Math.max(.2,1+E*(typeof Ee=="number"?Ee:1)*.04);}ze=l,Ze=s;let M=we?He===-1||l>=He?"forward":"reverse":b;He=l;let z=ce-U,W=true,G=z===0?0:(l-U)/z;if(isNaN(xe)||(xe<=0&&G>0?pe?.():xe>0&&G<=0&&de?.(),xe<1&&G>=1?Fe?.():xe>=1&&G<1&&ke?.()),xe=G,te){let p=Y(J(l,U,ce,y));K&&!we&&(re=Math.max(re,p),p=re),ge=p,e.style.setProperty("--scroll-draw-progress",String(p));let E=M==="reverse"?1-p:p;e.style.clipPath=D(E),V?.(p),!Z&&J(l,U,ce,y)>0&&(Z=true,ae?.()),p>=1&&!F?(F=true,R?.(),le<(oe==="infinite"?1/0:oe??0)&&(le++,fe=setTimeout(()=>{re=-1,Z=false,F=false,e.style.clipPath=D(0);},j))):p<1&&!K&&(F=false),C=requestAnimationFrame(qe);return}if(T.forEach((p,E)=>{let v=E*B*z,c=Y(J(l,U+v,ce+v,y));K&&!we&&(re=Math.max(re,c),c=re),ge=c,p.style.strokeDashoffset=M==="reverse"?`${w[E]*c}`:`${w[E]*(1-c)}`,u&&(p.style.opacity=M==="reverse"?`${1-c}`:`${c}`),a&&m?p.style.stroke=Me(a,m,c):m&&(p.style.stroke=m),P!==null&&S!==null?p.style.strokeWidth=`${P+(S-P)*c}`:S!==null&&(p.style.strokeWidth=`${S}`),L!==null&&O!==null?p.style.fillOpacity=`${L+(O-L)*c}`:O!==null&&(p.style.fillOpacity=`${O}`),I&&p.tagName.toLowerCase()==="path"&&_[E]&&p.setAttribute("d",Ye(_[E],I,c)),E===0&&(V?.(c),e.style.setProperty("--scroll-draw-progress",String(c))),c<1&&(W=false);}),N){let p=Y(J(l,U,ce,y));for(let E in N){let v=parseFloat(E);p>=v&&!me.has(v)&&(me.add(v),N[E]?.());}}!Z&&J(l,U,ce,y)>0&&(Z=true,ae?.()),W&&!F?(F=true,R?.(),le<(oe==="infinite"?1/0:oe??0)&&(le++,fe=setTimeout(()=>{re=-1,Z=false,F=false,me.clear(),We();},j))):!W&&!K&&(F=false),C=requestAnimationFrame(qe);}let je=new IntersectionObserver(s=>{s.forEach(l=>{Re=l.isIntersecting,Re&&!H?C=requestAnimationFrame(qe):cancelAnimationFrame(C);});},{root:k??null,threshold:Oe,rootMargin:Ne}),Xe;function Be(){clearTimeout(Xe),Xe=setTimeout(()=>{T.forEach((s,l)=>{w[l]=Ve(s),s.style.strokeDasharray=`${w[l]}`;}),Ke();},150);}return window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be),se>0?setTimeout(()=>je.observe(e),se):je.observe(e),{destroy(){cancelAnimationFrame(C),clearTimeout(fe),je.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Xe),Ge?.remove();},replay(){re=-1,He=-1,ze=-1,Z=false,F=false,le=0,H=false,me.clear(),clearTimeout(fe),We();},pause(){H=true,cancelAnimationFrame(C);},resume(){H&&(H=false,Re&&(C=requestAnimationFrame(qe)));},seek(s){let l=Math.min(1,Math.max(0,s));ge=l,re=l,H=true,cancelAnimationFrame(C),pt(l,b);},getProgress(){return ge}}}var ot=new Map;function it(e,n){ot.set(e,n);}function at(e){ot.delete(e);}function $t(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function lt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],f=[],d=t[2].trim();if(d)for(let i of d.split(/[\s,]+/)){let u=i.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),f.push(u?u[2]:"");}n.push({fn:t[1],nums:o,units:f});}return n}function At(e,n,r){let t=lt(e),o=lt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((f,d)=>{let i=o[d];return f.fn!==i.fn||f.nums.length!==i.nums.length?r<1?`${f.fn}(${f.nums.map((u,g)=>`${u}${f.units[g]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,g)=>`${u}${i.units[g]}`).join(", ")})`:`${f.fn}(${f.nums.map((u,g)=>`${u+(i.nums[g]-u)*r}${f.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),o=String(n);if($t(t))return Me(t,o,r);if(t.includes("("))return At(t,o,r);let f=t.match(/^([-+]?[\d.]+)(.*)$/),d=o.match(/^([-+]?[\d.]+)(.*)$/);if(f&&d){let i=parseFloat(f[1]),u=parseFloat(d[1]);return `${i+(u-i)*r}${f[2]||d[2]}`}return r<1?t:o}function Tt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ct={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Pt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Mt=0;function kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function _e(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:o={},easing:f="ease-out",speed:d=1,once:i=false,axis:u="y",scrollContainer:g,native:x=true,onProgress:B,onComplete:b,onEnter:K,onLeave:Ce,onEnterBack:q,onLeaveBack:be}=n,we=window.matchMedia("(prefers-reduced-motion: reduce)").matches,se=typeof f=="function"?f:Ae[f]??Ae["ease-out"],Q=Te(o.start??"top bottom"),ee=Te(o.end??"bottom top"),A=typeof g=="string"?document.querySelector(g):g??null,N=Object.entries(t).map(([a,m])=>({prop:Tt(a),from:Array.isArray(m)?m[0]:"",to:Array.isArray(m)?m[1]:m}));function Ee(){let a=window.getComputedStyle(e);for(let m of N)m.from===""&&(m.from=a.getPropertyValue(m.prop).trim()||"0");}function Oe(){for(let a of N)e.style.setProperty(a.prop,String(a.to));}if(we)return Oe(),b?.(),r;Ee();function Ne(){if(!x||!kt()||typeof f!="string"||!(f in ct)||u!=="y"||A||i||d!==1||B||b||K||Ce||q||be||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let a of N)if(!Pt.has(a.prop))return false;return true}function oe(){let a=`ssd-a-${++Mt}`,m=N.map(D=>`${D.prop}:${D.from}`).join(";"),P=N.map(D=>`${D.prop}:${D.to}`).join(";"),S=document.createElement("style");S.setAttribute("data-ssd-animate",""),S.textContent=`@keyframes ${a}{from{${m}}to{${P}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ct[f]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(S),e.classList.add(a);let L=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),S.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(D){let T=Math.min(1,Math.max(0,D));e.classList.remove(a);for(let w of N)e.style.setProperty(w.prop,ut(w.from,w.to,T));},getProgress(){let D=e.getBoundingClientRect(),T=L(),w=O(),{tStart:_,tEnd:U}=Pe({top:D.top,height:D.height},T,w,Q,ee);return se(J(T,_,U,d))}}}if(Ne())return oe();let j=0,I=0,X=0,ve=false,ie=false,ue=-1,V=0,ae=false,R=NaN,pe=()=>A?u==="x"?A.scrollLeft:A.scrollTop:u==="x"?window.scrollX:window.scrollY,Fe=()=>A?u==="x"?A.clientWidth:A.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ke(){let a=e.getBoundingClientRect(),m,P;if(A){let L=A.getBoundingClientRect();m=u==="x"?a.left-L.left+A.scrollLeft:a.top-L.top+A.scrollTop,P=u==="x"?a.width:a.height;}else m=u==="x"?a.left:a.top,P=u==="x"?a.width:a.height;let S=Pe({top:m,height:P},pe(),Fe(),Q,ee);j=S.tStart,I=S.tEnd;}function de(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let m of N)e.style.setProperty(m.prop,ut(m.from,m.to,a));B?.(a);}function te(a){if(isNaN(R)){R=a;return}R<=0&&a>0?K?.():R>0&&a<=0&&be?.(),R<1&&a>=1?Ce?.():R>=1&&a<1&&q?.(),R=a;}function Y(){if(!ve||ie)return;let a=I===j?0:(pe()-j)/(I-j);te(a);let m=se(J(pe(),j,I,d));i&&(ue=Math.max(ue,m),m=ue),V=m,de(m),m>=1&&!ae?(ae=true,b?.()):m<1&&!i&&(ae=false),X=requestAnimationFrame(Y);}ke();{let a=se(J(pe(),j,I,d));i&&a>0&&(ue=a),V=a,de(a);}let Le=new IntersectionObserver(a=>{a.forEach(m=>{ve=m.isIntersecting,ve&&!ie?X=requestAnimationFrame(Y):cancelAnimationFrame(X);});},{root:A??null}),Se;function k(){clearTimeout(Se),Se=setTimeout(ke,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),Le.observe(e),it(e,{type:"animate",getProgress:()=>V,getTrigger:()=>({tStart:j,tEnd:I})}),{destroy(){cancelAnimationFrame(X),Le.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(Se),at(e);},replay(){ue=-1,ae=false,V=0,ie=false,de(0);},pause(){ie=true,cancelAnimationFrame(X);},resume(){ie&&(ie=false,ve&&(X=requestAnimationFrame(Y)));},seek(a){let m=Math.min(1,Math.max(0,a));V=m,ue=m,ie=true,cancelAnimationFrame(X),de(m);},getProgress(){return V}}}var ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollParallax: element not found:",e),ft;let{speed:t=.3,axis:o="y",easing:f="linear",trigger:d,onProgress:i}=n,u=r.getBoundingClientRect(),g=o==="x"?u.width:u.height,x=t*g;return _e(r,{props:o==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:f,native:false,onProgress:i})}function Ie(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var he={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function qt(e,n={}){if(typeof window>"u")return he;let r=Ie(e).map(t=>Ue(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0}}}function Bt(e,n={}){if(typeof window>"u")return he;let r=Ie(e);if(r.length===0)return he;let t=0,o=[];function f(i){return Ue(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=i+1,o[t]?.resume();}})}function d(){r.forEach((i,u)=>{o[u]=f(u);});for(let i=1;i<o.length;i++)o[i].pause();}return d(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,d();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0}}}function Vt(e,n){if(typeof window>"u")return he;let r=Ie(e).map(t=>_e(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0}}}function _t(e,n){if(typeof window>"u")return he;let r=Ie(e);if(r.length===0)return he;let t=0,o=[];function f(i){return _e(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=i+1,o[t]?.resume();}})}function d(){r.forEach((i,u)=>{o[u]=f(u);});for(let i=1;i<o.length;i++)o[i].pause();}return d(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,d();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0}}}function Gt(e,n={}){if(typeof window>"u")return he;let r=Ie(e).map(t=>mt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0}}}exports.scrollAnimateGroup=Vt;exports.scrollAnimateSequence=_t;exports.scrollDrawGroup=qt;exports.scrollDrawSequence=Bt;exports.scrollParallaxGroup=Gt;
@@ -71,6 +71,14 @@ interface ScrollDrawOptions {
71
71
  onProgress?: (alpha: number) => void;
72
72
  onStart?: () => void;
73
73
  onComplete?: () => void;
74
+ /** Fires when scroll position enters the trigger zone (scrolling forward). */
75
+ onEnter?: () => void;
76
+ /** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
77
+ onLeave?: () => void;
78
+ /** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
79
+ onEnterBack?: () => void;
80
+ /** Fires when scroll position exits the trigger zone at the start (scrolling back). */
81
+ onLeaveBack?: () => void;
74
82
  /**
75
83
  * Trigger the animation when the element enters the viewport instead of
76
84
  * tying it to scroll position. The draw runs over `duration` milliseconds,
@@ -119,6 +127,34 @@ interface ScrollDrawInstance {
119
127
  getProgress: () => number;
120
128
  }
121
129
 
130
+ interface ScrollAnimateOptions {
131
+ props: Record<string, string | number | [string | number, string | number]>;
132
+ trigger?: TriggerConfig;
133
+ easing?: EasingName | ((t: number) => number);
134
+ speed?: number;
135
+ once?: boolean;
136
+ axis?: 'x' | 'y';
137
+ scrollContainer?: string | Element;
138
+ native?: boolean;
139
+ onProgress?: (alpha: number) => void;
140
+ onComplete?: () => void;
141
+ /** Fires when scroll enters the trigger zone (scrolling forward). */
142
+ onEnter?: () => void;
143
+ /** Fires when scroll exits the trigger zone at the end (scrolling forward). */
144
+ onLeave?: () => void;
145
+ /** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
146
+ onEnterBack?: () => void;
147
+ /** Fires when scroll exits the trigger zone at the start (scrolling back). */
148
+ onLeaveBack?: () => void;
149
+ }
150
+ interface ScrollParallaxOptions {
151
+ speed?: number;
152
+ axis?: 'x' | 'y';
153
+ easing?: EasingName | ((t: number) => number);
154
+ trigger?: TriggerConfig;
155
+ onProgress?: (alpha: number) => void;
156
+ }
157
+
122
158
  /**
123
159
  * Animate multiple SVG containers simultaneously with the same options.
124
160
  * Each container tracks its own scroll position independently.
@@ -152,5 +188,56 @@ declare function scrollDrawGroup(targets: Array<string | Element>, options?: Scr
152
188
  * });
153
189
  */
154
190
  declare function scrollDrawSequence(targets: Array<string | Element>, options?: ScrollDrawOptions): ScrollDrawInstance;
191
+ /**
192
+ * Animate multiple HTML/SVG elements simultaneously with scrollAnimate options.
193
+ * Each element tracks its own scroll position independently. Perfect for
194
+ * staggered card reveals, feature grids, or any multi-element entrance.
195
+ *
196
+ * @example
197
+ * import { scrollAnimateGroup } from 'svg-scroll-draw/group';
198
+ *
199
+ * const group = scrollAnimateGroup(
200
+ * [card1El, card2El, card3El],
201
+ * {
202
+ * props: { opacity: [0, 1], transform: ['translateY(40px)', 'translateY(0)'] },
203
+ * easing: 'ease-out',
204
+ * once: true,
205
+ * }
206
+ * );
207
+ *
208
+ * group.replay();
209
+ * group.destroy();
210
+ */
211
+ declare function scrollAnimateGroup(targets: Array<string | Element>, options: ScrollAnimateOptions): ScrollDrawInstance;
212
+ /**
213
+ * Fan-out scrollAnimate in sequence — each element starts animating only after
214
+ * the previous one has reached 100%. Useful for step-by-step reveals.
215
+ *
216
+ * @example
217
+ * import { scrollAnimateSequence } from 'svg-scroll-draw/group';
218
+ *
219
+ * scrollAnimateSequence(
220
+ * [step1El, step2El, step3El],
221
+ * {
222
+ * props: { opacity: [0, 1], transform: ['translateY(32px)', 'translateY(0)'] },
223
+ * easing: 'ease-out',
224
+ * }
225
+ * );
226
+ */
227
+ declare function scrollAnimateSequence(targets: Array<string | Element>, options: ScrollAnimateOptions): ScrollDrawInstance;
228
+ /**
229
+ * Apply a parallax effect to multiple elements simultaneously.
230
+ * Each element moves at `speed × elementHeight` pixels independently.
231
+ *
232
+ * @example
233
+ * import { scrollParallaxGroup } from 'svg-scroll-draw/group';
234
+ *
235
+ * // Three background layers at the same speed
236
+ * scrollParallaxGroup(['#layer-far', '#layer-mid', '#layer-near'], { speed: 0.4 });
237
+ *
238
+ * // Opposite direction (floats upward as you scroll down)
239
+ * scrollParallaxGroup(['#badge', '#tag'], { speed: -0.2 });
240
+ */
241
+ declare function scrollParallaxGroup(targets: Array<string | Element>, options?: ScrollParallaxOptions): ScrollDrawInstance;
155
242
 
156
- export { type ScrollDrawOptions, scrollDrawGroup, scrollDrawSequence };
243
+ export { type ScrollAnimateOptions, type ScrollDrawOptions, type ScrollParallaxOptions, scrollAnimateGroup, scrollAnimateSequence, scrollDrawGroup, scrollDrawSequence, scrollParallaxGroup };
@@ -71,6 +71,14 @@ interface ScrollDrawOptions {
71
71
  onProgress?: (alpha: number) => void;
72
72
  onStart?: () => void;
73
73
  onComplete?: () => void;
74
+ /** Fires when scroll position enters the trigger zone (scrolling forward). */
75
+ onEnter?: () => void;
76
+ /** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
77
+ onLeave?: () => void;
78
+ /** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
79
+ onEnterBack?: () => void;
80
+ /** Fires when scroll position exits the trigger zone at the start (scrolling back). */
81
+ onLeaveBack?: () => void;
74
82
  /**
75
83
  * Trigger the animation when the element enters the viewport instead of
76
84
  * tying it to scroll position. The draw runs over `duration` milliseconds,
@@ -119,6 +127,34 @@ interface ScrollDrawInstance {
119
127
  getProgress: () => number;
120
128
  }
121
129
 
130
+ interface ScrollAnimateOptions {
131
+ props: Record<string, string | number | [string | number, string | number]>;
132
+ trigger?: TriggerConfig;
133
+ easing?: EasingName | ((t: number) => number);
134
+ speed?: number;
135
+ once?: boolean;
136
+ axis?: 'x' | 'y';
137
+ scrollContainer?: string | Element;
138
+ native?: boolean;
139
+ onProgress?: (alpha: number) => void;
140
+ onComplete?: () => void;
141
+ /** Fires when scroll enters the trigger zone (scrolling forward). */
142
+ onEnter?: () => void;
143
+ /** Fires when scroll exits the trigger zone at the end (scrolling forward). */
144
+ onLeave?: () => void;
145
+ /** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
146
+ onEnterBack?: () => void;
147
+ /** Fires when scroll exits the trigger zone at the start (scrolling back). */
148
+ onLeaveBack?: () => void;
149
+ }
150
+ interface ScrollParallaxOptions {
151
+ speed?: number;
152
+ axis?: 'x' | 'y';
153
+ easing?: EasingName | ((t: number) => number);
154
+ trigger?: TriggerConfig;
155
+ onProgress?: (alpha: number) => void;
156
+ }
157
+
122
158
  /**
123
159
  * Animate multiple SVG containers simultaneously with the same options.
124
160
  * Each container tracks its own scroll position independently.
@@ -152,5 +188,56 @@ declare function scrollDrawGroup(targets: Array<string | Element>, options?: Scr
152
188
  * });
153
189
  */
154
190
  declare function scrollDrawSequence(targets: Array<string | Element>, options?: ScrollDrawOptions): ScrollDrawInstance;
191
+ /**
192
+ * Animate multiple HTML/SVG elements simultaneously with scrollAnimate options.
193
+ * Each element tracks its own scroll position independently. Perfect for
194
+ * staggered card reveals, feature grids, or any multi-element entrance.
195
+ *
196
+ * @example
197
+ * import { scrollAnimateGroup } from 'svg-scroll-draw/group';
198
+ *
199
+ * const group = scrollAnimateGroup(
200
+ * [card1El, card2El, card3El],
201
+ * {
202
+ * props: { opacity: [0, 1], transform: ['translateY(40px)', 'translateY(0)'] },
203
+ * easing: 'ease-out',
204
+ * once: true,
205
+ * }
206
+ * );
207
+ *
208
+ * group.replay();
209
+ * group.destroy();
210
+ */
211
+ declare function scrollAnimateGroup(targets: Array<string | Element>, options: ScrollAnimateOptions): ScrollDrawInstance;
212
+ /**
213
+ * Fan-out scrollAnimate in sequence — each element starts animating only after
214
+ * the previous one has reached 100%. Useful for step-by-step reveals.
215
+ *
216
+ * @example
217
+ * import { scrollAnimateSequence } from 'svg-scroll-draw/group';
218
+ *
219
+ * scrollAnimateSequence(
220
+ * [step1El, step2El, step3El],
221
+ * {
222
+ * props: { opacity: [0, 1], transform: ['translateY(32px)', 'translateY(0)'] },
223
+ * easing: 'ease-out',
224
+ * }
225
+ * );
226
+ */
227
+ declare function scrollAnimateSequence(targets: Array<string | Element>, options: ScrollAnimateOptions): ScrollDrawInstance;
228
+ /**
229
+ * Apply a parallax effect to multiple elements simultaneously.
230
+ * Each element moves at `speed × elementHeight` pixels independently.
231
+ *
232
+ * @example
233
+ * import { scrollParallaxGroup } from 'svg-scroll-draw/group';
234
+ *
235
+ * // Three background layers at the same speed
236
+ * scrollParallaxGroup(['#layer-far', '#layer-mid', '#layer-near'], { speed: 0.4 });
237
+ *
238
+ * // Opposite direction (floats upward as you scroll down)
239
+ * scrollParallaxGroup(['#badge', '#tag'], { speed: -0.2 });
240
+ */
241
+ declare function scrollParallaxGroup(targets: Array<string | Element>, options?: ScrollParallaxOptions): ScrollDrawInstance;
155
242
 
156
- export { type ScrollDrawOptions, scrollDrawGroup, scrollDrawSequence };
243
+ export { type ScrollAnimateOptions, type ScrollDrawOptions, type ScrollParallaxOptions, scrollAnimateGroup, scrollAnimateSequence, scrollDrawGroup, scrollDrawSequence, scrollParallaxGroup };