svg-scroll-draw 2.19.0 → 2.20.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 (74) hide show
  1. package/README.md +6 -6
  2. package/dist/angular/index.cjs +2 -2
  3. package/dist/angular/index.d.mts +3 -3
  4. package/dist/angular/index.d.ts +3 -3
  5. package/dist/angular/index.mjs +1 -1
  6. package/dist/astro/index.cjs +2 -2
  7. package/dist/astro/index.d.mts +3 -3
  8. package/dist/astro/index.d.ts +3 -3
  9. package/dist/astro/index.mjs +1 -1
  10. package/dist/cdn/svg-scroll-draw.dev.global.js +28 -6
  11. package/dist/cdn/svg-scroll-draw.global.js +2 -2
  12. package/dist/{chunk-JPK2NJWO.mjs → chunk-6SSA5V7J.mjs} +1 -1
  13. package/dist/chunk-LQBXJRFY.mjs +3 -0
  14. package/dist/{chunk-PKHX3HSS.mjs → chunk-VVFGB4RT.mjs} +1 -1
  15. package/dist/{engine-C9LKls__.d.ts → engine-DQyBzZDl.d.ts} +1 -1
  16. package/dist/{engine-CvzRSkuk.d.mts → engine-P8u6OK4m.d.mts} +1 -1
  17. package/dist/group/index.cjs +3 -3
  18. package/dist/group/index.d.mts +3 -3
  19. package/dist/group/index.d.ts +3 -3
  20. package/dist/group/index.mjs +1 -1
  21. package/dist/horizontal/index.d.mts +1 -1
  22. package/dist/horizontal/index.d.ts +1 -1
  23. package/dist/{index-Zxa5HIes.d.mts → index-CMqK0GCT.d.mts} +2 -2
  24. package/dist/{index-BlIjovDN.d.mts → index-CdaBYn3A.d.mts} +1 -1
  25. package/dist/{index-DZjvLJcU.d.ts → index-D3o4vT3e.d.ts} +1 -1
  26. package/dist/{index-G3VfLIN8.d.ts → index-DPqPEnO-.d.ts} +2 -2
  27. package/dist/index.cjs +4 -4
  28. package/dist/index.d.mts +6 -6
  29. package/dist/index.d.ts +6 -6
  30. package/dist/index.mjs +1 -1
  31. package/dist/nuxt/index.cjs +2 -2
  32. package/dist/nuxt/index.d.mts +3 -3
  33. package/dist/nuxt/index.d.ts +3 -3
  34. package/dist/nuxt/index.mjs +1 -1
  35. package/dist/pin/index.cjs +1 -1
  36. package/dist/pin/index.d.mts +8 -2
  37. package/dist/pin/index.d.ts +8 -2
  38. package/dist/pin/index.mjs +1 -1
  39. package/dist/progress/index.d.mts +1 -1
  40. package/dist/progress/index.d.ts +1 -1
  41. package/dist/react/index.cjs +2 -2
  42. package/dist/react/index.d.mts +7 -8
  43. package/dist/react/index.d.ts +7 -8
  44. package/dist/react/index.mjs +1 -1
  45. package/dist/reveal/index.d.mts +1 -1
  46. package/dist/reveal/index.d.ts +1 -1
  47. package/dist/{scroll-draw-B4CadBz0.d.mts → scroll-draw-Dej-GIRP.d.mts} +1 -1
  48. package/dist/{scroll-draw-Cs6Z5ype.d.ts → scroll-draw-DsBMkwrX.d.ts} +1 -1
  49. package/dist/snap/index.d.mts +1 -1
  50. package/dist/snap/index.d.ts +1 -1
  51. package/dist/solid/index.cjs +3 -3
  52. package/dist/solid/index.d.mts +3 -3
  53. package/dist/solid/index.d.ts +3 -3
  54. package/dist/solid/index.mjs +1 -1
  55. package/dist/svelte/index.cjs +2 -2
  56. package/dist/svelte/index.d.mts +3 -3
  57. package/dist/svelte/index.d.ts +3 -3
  58. package/dist/svelte/index.mjs +1 -1
  59. package/dist/text/index.d.mts +1 -1
  60. package/dist/text/index.d.ts +1 -1
  61. package/dist/timeline/index.d.mts +1 -1
  62. package/dist/timeline/index.d.ts +1 -1
  63. package/dist/{types-B0YM4nQP.d.mts → types-MswK0erX.d.mts} +6 -0
  64. package/dist/{types-B0YM4nQP.d.ts → types-MswK0erX.d.ts} +6 -0
  65. package/dist/video/index.d.mts +1 -1
  66. package/dist/video/index.d.ts +1 -1
  67. package/dist/vue/index.cjs +2 -2
  68. package/dist/vue/index.d.mts +3 -3
  69. package/dist/vue/index.d.ts +3 -3
  70. package/dist/vue/index.mjs +1 -1
  71. package/dist/web-component/index.cjs +3 -3
  72. package/dist/web-component/index.mjs +1 -1
  73. package/package.json +3 -3
  74. package/dist/chunk-WHFRS7IP.mjs +0 -3
@@ -1,3 +1,3 @@
1
- 'use strict';function _t({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),s=Math.max(.01,Math.min(.99,r)),i=Math.sqrt(s),l=0,m=[];for(let y=0;y<n;y++){let b=Math.pow(i,y);m.push(b),l+=b;}let E=[0],S=0;for(let y=0;y<n;y++)S+=m[y]/l,E.push(S);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let b=0;b<n;b++)if(y<=E[b+1]){let F=(y-E[b])/(E[b+1]-E[b]);if(b===0)return F*(2-F);let w=1-Math.pow(s,b);return w+(1-w)*(2*F-1)*(2*F-1)}return 1}}function Ft({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),s=Math.max(.1,r),i=n<=1?s/4:s/(2*Math.PI)*Math.asin(1/n);return l=>l<=0?0:l>=1?1:n*Math.pow(2,-10*l)*Math.sin((l-i)*(2*Math.PI)/s)+1}var ve={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:_t(),elastic:Ft()};function ut(e,r,n){return Math.min(n,Math.max(r,e))}function qe(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 ct(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 ft(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 ue(e,r,n,s){return n===r?0:ut((e-r)/(n-r)*s,0,1)}function Be(e,r,n,s,i){let l=ct(e.top,e.height,r,s.element)-ft(s.viewport,n),m=ct(e.top,e.height,r,i.element)-ft(i.viewport,n);return {tStart:l,tEnd:m}}function mt(e,r,n){let s=e.getBoundingClientRect(),i=n==="x"?s.width:s.height;return r?{top:n==="x"?s.left-r.getBoundingClientRect().left+r.scrollLeft:s.top-r.getBoundingClientRect().top+r.scrollTop,height:i,scroll:0}:{top:n==="x"?s.left:s.top,height:i,scroll:n==="x"?window.scrollX:window.scrollY}}function pe(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 pt(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 Oe(e,r,n){let s=pt(e),i=pt(r);return !s||!i?e:`rgb(${Math.round(s[0]+(i[0]-s[0])*n)},${Math.round(s[1]+(i[1]-s[1])*n)},${Math.round(s[2]+(i[2]-s[2])*n)})`}var dt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ee=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function de(e,...r){Ee&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Vt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",zt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",gt=33;function Ht(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Wt(e){let r=[];for(let n=0;n<gt;n++){let s=n/(gt-1);r.push(String(Math.round(e(s)*1e5)/1e5));}return `linear(${r.join(",")})`}function yt(e){switch(e){case "linear":return "linear";case "ease-in":return Vt;case "ease-out":return zt;case "ease-in-out":return Ht()?Wt(ve["ease-in-out"]):null;default:return null}}var ht=Symbol.for("svg-scroll-draw.registry");function bt(){let e=globalThis;return e[ht]||(e[ht]=new Map)}function wt(e,r){bt().set(e,r);}function vt(e){bt().delete(e);}var Se,Re=new Set,Ie=new WeakMap,xe=new Map,Et=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function Gt(e){let r=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let s=n;s;s=s.previousElementSibling)r.add(s);return r}function St(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>r();Se??(Se=new ResizeObserver(i=>{let l=false;for(let{target:m}of i)Ie.get(m)!==Et(m)&&(l=true),Ie.set(m,"");l&&Re.forEach(m=>m());})),Re.add(n);let s=Gt(e);return [document.body,document.documentElement].forEach(i=>i&&s.add(i)),s.forEach(i=>{Ie.has(i)||Ie.set(i,Et(i)),xe.set(i,(xe.get(i)??0)+1),Se.observe(i);}),()=>{Re.delete(n)&&(s.forEach(i=>{let l=(xe.get(i)??1)-1;if(l)return void xe.set(i,l);xe.delete(i),Se?.unobserve(i);}),Re.size||(Se?.disconnect(),Se=void 0));}}var qt=0;function Bt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function xt(e,r){let n="";try{n=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return n||(e.getAttribute(r)??"").trim()}var $t=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ut(e){if(!Ee)return;let r=xt(e,"stroke");if(!r||r==="none"){de("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!$t.has(n)&&!$t.has(xt(e,"fill"))&&de("Element has a fill \u2014 it may obscure the stroke animation.",e);}function jt(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 i(){let l=n==="x"?window.scrollX:window.scrollY,m=e-l,E=r-l,S=n==="x";s.innerHTML=`
2
- <div style="position:absolute;${S?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${S?`left:${E}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${E}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",i,{passive:true}),i(),{el:s,destroy(){window.removeEventListener("scroll",i),s.remove();}}}var Tt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,At=/[MmLlHhVvCcSsQqTtAaZz]/g;function Qt(e,r,n){if(!Ee)return;let s=(e.match(At)??[]).join("").toUpperCase(),i=(r.match(At)??[]).join("").toUpperCase(),l=(e.match(Tt)??[]).length,m=(r.match(Tt)??[]).length;if(s!==i){de(`morphTo: command sequence differs (${s||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}l!==m&&de(`morphTo: coordinate count differs (${l} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function Ue(e,r,n){let s=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,l=>{let m=parseFloat(l),E=s[i++]??m;return String(+(m+(E-m)*n).toFixed(4))})}function Mt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...s}=r,i=n?{...dt[n],...s}:s,l=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:E=1,fade:S=false,easing:y="linear",trigger:b={},stagger:F=0,direction:w="forward",once:ee=false,debug:kt=false,axis:te="y",scrollContainer:Ne,autoReverse:$e=false,delay:ge=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ye=false,threshold:je=0,rootMargin:Qe="0px",repeat:ie=0,repeatDelay:_e=0,morphTo:I,clip:Fe,autoplay:Lt=false,duration:Pt=1e3,native:Dt=true,onProgress:he,onStart:Te,onComplete:ce,onEnter:Xe,onLeave:Ye,onEnterBack:Je,onLeaveBack:Ke}=i,X=Fe===true?"left":typeof Fe=="string"?Fe:false,ae=typeof y=="function"?y:ve[y]??ve.linear,Ze=qe(b.start??"top bottom"),et=qe(b.end??"bottom top"),H=typeof Ne=="string"?document.querySelector(Ne):Ne??null,W=Array.isArray(re)?re[0]:null,L=Array.isArray(re)?re[1]:typeof re=="string"?re:null,O=Array.isArray(ne)?ne[0]:null,P=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,R=Array.isArray(se)?se[0]:null,D=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function le(t){let o=t*100;switch(X){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 x=X?[]:Array.from(e.querySelectorAll(m)),d=[],N=[],G=0,U=0,A=false,V=false,M=0,fe=false,Y=-1,be=[],Ae=-1,k=false,q=0,j=0,J,Ve=null;function tt(){Ve?.destroy(),Ve=null;}let K=new Set,rt=NaN,Z=true,Me=-1,nt=performance.now(),me=NaN;function ze(){return H?te==="x"?H.scrollLeft:H.scrollTop:te==="x"?window.scrollX:window.scrollY}function st(){return H?te==="x"?H.clientWidth:H.clientHeight:te==="x"?window.innerWidth:window.innerHeight}function ot(){let t=mt(e,H,te);return Be(t,t.scroll,st(),Ze,et)}function it(){(({tStart:G,tEnd:U}=ot())),kt&&Ee&&(tt(),Ve=jt(G,U,te));}function He(t,o=ot){wt(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:o});let c=t.destroy;return t.destroy=()=>{c.call(t),vt(e);},t}function Ct(t,o){if(e.style.setProperty("--scroll-draw-progress",String(t)),X){let c=o==="reverse"?1-t:t;e.style.clipPath=le(c);return}x.forEach((c,$)=>{c.style.strokeDashoffset=o==="reverse"?`${d[$]*t}`:`${d[$]*(1-t)}`,S&&(c.style.opacity=o==="reverse"?`${1-t}`:`${t}`),W&&L?c.style.stroke=Oe(W,L,t):L&&(c.style.stroke=L),O!==null&&P!==null?c.style.strokeWidth=`${O+(P-O)*t}`:P!==null&&(c.style.strokeWidth=`${P}`),R!==null&&D!==null?c.style.fillOpacity=`${R+(D-R)*t}`:D!==null&&(c.style.fillOpacity=`${D}`),I&&c.tagName.toLowerCase()==="path"&&N[$]&&c.setAttribute("d",Ue(N[$],I,t));});}function ke(){if(e.style.setProperty("--scroll-draw-progress","0"),X){e.style.clipPath=le(0);return}x.forEach((t,o)=>{t.style.strokeDasharray=`${d[o]}`,t.style.strokeDashoffset=w==="reverse"?"0":`${d[o]}`,S?t.style.opacity=w==="reverse"?"1":"0":t.style.opacity="",W&&(t.style.stroke=W),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`),I&&t.tagName.toLowerCase()==="path"&&N[o]&&t.setAttribute("d",N[o]);});}if(x.forEach(t=>{Ut(t);let o=pe(t);d.push(o);let c=t.tagName.toLowerCase()==="path";c?N.push(t.getAttribute("d")??""):N.push(""),I&&(c?Qt(N[N.length-1],I,t):de(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),l?(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=w==="reverse"?`${o}`:"0",S&&(t.style.opacity="1"),L&&(t.style.stroke=L),P!==null&&(t.style.strokeWidth=`${P}`),D!==null&&(t.style.fillOpacity=`${D}`),I&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",I)):(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=w==="reverse"?"0":`${o}`,S?t.style.opacity=w==="reverse"?"1":"0":t.style.opacity="",W&&(t.style.stroke=W),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`));}),X){if(l)return e.style.clipPath=le(1),ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(l)return ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let at=typeof y=="string"?yt(y):null;function Ot(){return !(Dt===false||!Bt()||!x.length||!at||X||te!=="y"||H||E!==1||F!==0||ee||$e||ye!==false||I||oe||ie||ge>0||he||Te||ce||Xe||Ye||Je||Ke||re!=null||ne!=null||se!=null||(b.start??"top bottom").trim()!=="top bottom"||(b.end??"bottom top").trim()!=="bottom top")}function Rt(){let t=++qt,o=`svg-scroll-draw-${t}`,c=`svg-scroll-draw-host-${t}`,$=`--svg-scroll-draw-${t}`,Q=w==="reverse"?"0":"var(--ssd-len)",B=w==="reverse"?"var(--ssd-len)":"0",z=`stroke-dashoffset:${Q};`,f=`stroke-dashoffset:${B};`;S&&(z+=`opacity:${w==="reverse"?1:0};`,f+=`opacity:${w==="reverse"?0:1};`);let p=document.createElement("style");p.setAttribute("data-svg-scroll-draw",""),p.textContent=`@keyframes ${o}{from{${z}}to{${f}}}.${c}{view-timeline-name:${$};view-timeline-axis:block;}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${at};animation-fill-mode:both;animation-timeline:${$};animation-range:cover 0% cover 100%;}`,document.head.appendChild(p),e.classList.add(c);function T(a,v){a.style.setProperty("--ssd-len",String(d[v])),a.style.strokeDasharray=`${d[v]}`,a.style.strokeDashoffset="",a.style.opacity="",a.style.animationPlayState="",a.classList.add(o);}x.forEach(T);let u=false,g=-1;function h(){if(g>=0)return g;let a=e.getBoundingClientRect(),{tStart:v,tEnd:_}=Be({top:a.top,height:a.height},ze(),st(),Ze,et);return ae(ue(ze(),v,_,E))}return {destroy(){e.classList.remove(c),x.forEach(a=>{a.classList.remove(o),a.style.removeProperty("--ssd-len"),a.style.animationPlayState="";}),p.remove();},replay(){u=false,g=-1,x.forEach(T);},pause(){u=true,x.forEach(a=>{a.style.animationPlayState="paused";});},resume(){u&&(u=false,x.forEach(a=>{a.style.animationPlayState="running";}));},seek(a){let v=Math.min(1,Math.max(0,a));g=v,u=true,x.forEach((_,C)=>{_.classList.remove(o),_.style.strokeDashoffset=w==="reverse"?`${d[C]*v}`:`${d[C]*(1-v)}`,S&&(_.style.opacity=w==="reverse"?`${1-v}`:`${v}`);});},getProgress(){return h()},refresh(){x.forEach((a,v)=>{d[v]=pe(a),a.style.setProperty("--ssd-len",String(d[v])),a.style.strokeDasharray=`${d[v]}`;});}}}if(Ot())return He(Rt());function It(){let t=Math.max(1,Pt),o=0,c=0,$=false;function Q(u){let g=true;if(X){let h=Math.min(1,Math.max(0,u/t)),a=ae(h);q=a,e.style.setProperty("--scroll-draw-progress",String(a)),e.style.clipPath=le(w==="reverse"?1-a:a),he?.(a),h<1&&(g=false);}else x.forEach((h,a)=>{let v=a*F*t,_=Math.min(1,Math.max(0,(u-v)/t)),C=ae(_);h.style.strokeDashoffset=w==="reverse"?`${d[a]*C}`:`${d[a]*(1-C)}`,S&&(h.style.opacity=w==="reverse"?`${1-C}`:`${C}`),W&&L?h.style.stroke=Oe(W,L,C):L&&(h.style.stroke=L),O!==null&&P!==null?h.style.strokeWidth=`${O+(P-O)*C}`:P!==null&&(h.style.strokeWidth=`${P}`),R!==null&&D!==null?h.style.fillOpacity=`${R+(D-R)*C}`:D!==null&&(h.style.fillOpacity=`${D}`),I&&h.tagName.toLowerCase()==="path"&&N[a]&&h.setAttribute("d",Ue(N[a],I,C)),a===0&&(q=C,he?.(C),e.style.setProperty("--scroll-draw-progress",String(C))),_<1&&(g=false);});if(oe){let h=Math.min(1,Math.max(0,u/t)),a=ae(h);for(let v in oe){let _=parseFloat(v);a>=_&&!K.has(_)&&(K.add(_),oe[v]?.());}}return g}function B(u){if(k)return;let g=u-o;V||(V=true,Te?.());let h=Q(g);if(h&&!A){A=true,Q(t*(1+Math.max(0,x.length-1)*F)),ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,J=setTimeout(()=>{o=performance.now(),V=false,A=false,K.clear(),ke(),M=requestAnimationFrame(B);},_e));return}h||(M=requestAnimationFrame(B));}function z(){cancelAnimationFrame(M),clearTimeout(J),o=performance.now(),c=0,k=false,V=false,A=false,j=0,$=true,q=0,K.clear(),ke(),M=requestAnimationFrame(B);}let f=new IntersectionObserver(u=>{u.forEach(g=>{g.isIntersecting&&!(ee&&A)?z():!g.isIntersecting&&!ee&&!A&&(cancelAnimationFrame(M),clearTimeout(J),$=false);});},{root:H??null,threshold:je,rootMargin:Qe}),p;function T(){clearTimeout(p),p=setTimeout(()=>{x.forEach((u,g)=>{d[g]=pe(u),u.style.strokeDasharray=`${d[g]}`;});},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ge>0?setTimeout(()=>f.observe(e),ge):f.observe(e),{destroy(){cancelAnimationFrame(M),clearTimeout(J),f.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(p);},replay(){j=0,z();},pause(){k||!$||(k=true,c=performance.now()-o,cancelAnimationFrame(M));},resume(){k&&(k=false,$=true,o=performance.now()-c,M=requestAnimationFrame(B));},seek(u){let g=Math.min(1,Math.max(0,u));q=g,k=true,c=g*t,o=performance.now()-c,cancelAnimationFrame(M),Q(c);},getProgress(){return q},refresh(){clearTimeout(p),x.forEach((u,g)=>{d[g]=pe(u),u.style.strokeDasharray=`${d[g]}`;});}}}if(Lt)return He(It());it();function Le(){if(!fe||k)return;let t=performance.now(),o=ze();if(!Z&&ye===false&&o===rt){M=requestAnimationFrame(Le);return}Z=false,rt=o;let c=E;if(ye!==false){let f=t-nt,p=f>0?Math.abs(o-(Me<0?o:Me))/f:0;c=E*Math.max(.2,1+p*(typeof ye=="number"?ye:1)*.04);}Me=o,nt=t;let $=$e?Ae===-1||o>=Ae?"forward":"reverse":w;Ae=o;let Q=U-G,B=true,z=Q===0?0:(o-G)/Q;if(isNaN(me)||(me<=0&&z>0?Xe?.():me>0&&z<=0&&Ke?.(),me<1&&z>=1?Ye?.():me>=1&&z<1&&Je?.()),me=z,X){let f=ae(ue(o,G,U,c));ee&&!$e&&(Y=Math.max(Y,f),f=Y),q=f,e.style.setProperty("--scroll-draw-progress",String(f));let p=$==="reverse"?1-f:f;e.style.clipPath=le(p),he?.(f),!V&&ue(o,G,U,c)>0&&(V=true,Te?.()),f>=1&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,J=setTimeout(()=>{Y=-1,V=false,A=false,e.style.clipPath=le(0);},_e))):f<1&&!ee&&(A=false),M=requestAnimationFrame(Le);return}if(x.forEach((f,p)=>{let T=p*F*Q,u=ae(ue(o,G+T,U+T,c));ee&&!$e&&(u=be[p]=Math.max(be[p]??Y,u)),f.style.strokeDashoffset=$==="reverse"?`${d[p]*u}`:`${d[p]*(1-u)}`,S&&(f.style.opacity=$==="reverse"?`${1-u}`:`${u}`),W&&L?f.style.stroke=Oe(W,L,u):L&&(f.style.stroke=L),O!==null&&P!==null?f.style.strokeWidth=`${O+(P-O)*u}`:P!==null&&(f.style.strokeWidth=`${P}`),R!==null&&D!==null?f.style.fillOpacity=`${R+(D-R)*u}`:D!==null&&(f.style.fillOpacity=`${D}`),I&&f.tagName.toLowerCase()==="path"&&N[p]&&f.setAttribute("d",Ue(N[p],I,u)),p===0&&(q=u,he?.(u),e.style.setProperty("--scroll-draw-progress",String(u))),u<1&&(B=false);}),oe){let f=ae(ue(o,G,U,c));for(let p in oe){let T=parseFloat(p);f>=T&&!K.has(T)&&(K.add(T),oe[p]?.());}}!V&&ue(o,G,U,c)>0&&(V=true,Te?.()),B&&!A?(A=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,J=setTimeout(()=>{Y=-1,be=[],V=false,A=false,K.clear(),ke(),Z=true;},_e))):!B&&!ee&&(A=false),M=requestAnimationFrame(Le);}let We=false;function Pe(){We||(We=true,M=requestAnimationFrame(function(){Le();}));}function De(){We=false,cancelAnimationFrame(M);}let Ge=new IntersectionObserver(t=>{t.forEach(o=>{fe=o.isIntersecting,fe&&!k?(Z=true,Pe()):De();});},{root:H??null,threshold:je,rootMargin:Qe});function lt(){x.forEach((t,o)=>{d[o]=pe(t),t.style.strokeDasharray=`${d[o]}`;}),it(),Z=true;}let Ce;function we(){clearTimeout(Ce),Ce=setTimeout(lt,150);}window.addEventListener("resize",we),window.addEventListener("orientationchange",we);let Nt=St([e],we);return ge>0?setTimeout(()=>Ge.observe(e),ge):Ge.observe(e),He({destroy(){cancelAnimationFrame(M),clearTimeout(J),De(),Ge.disconnect(),Nt(),window.removeEventListener("resize",we),window.removeEventListener("orientationchange",we),clearTimeout(Ce),tt();},replay(){Y=-1,be=[],Ae=-1,Me=-1,V=false,A=false,j=0,k=false,q=0,K.clear(),clearTimeout(J),ke(),Z=true,fe&&Pe();},pause(){k=true,De();},resume(){k&&(k=false,Z=true,fe&&Pe());},seek(t){let o=Math.min(1,Math.max(0,t));q=o,Y=o,be=[],k=true,De(),Ct(o,w),Z=true;},getProgress(){return q},refresh(){clearTimeout(Ce),lt(),fe&&!k&&Pe();}},()=>({tStart:G,tEnd:U}))}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class r extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key="";}connectedCallback(){this.build();}attributeChangedCallback(){this.instance&&this.build();}build(){let i=JSON.stringify(e.map(F=>this.getAttribute(F)));if(this.instance&&i===this.key)return;this.instance?.destroy(),this.key=i;let l={},m=this.getAttribute("speed"),E=this.getAttribute("easing"),S=this.getAttribute("stagger"),y=this.getAttribute("direction"),b=this.getAttribute("selector");m&&(l.speed=parseFloat(m)),E&&(l.easing=E),S&&(l.stagger=parseFloat(S)),y&&(l.direction=y),b&&(l.selector=b),this.hasAttribute("fade")&&(l.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(l.once=this.getAttribute("once")!=="false"),this.instance=Mt(this,l);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}r.observedAttributes=e,customElements.define("scroll-draw",r);}
1
+ 'use strict';function Wt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),o=Math.max(.01,Math.min(.99,r)),i=Math.sqrt(o),u=0,m=[];for(let y=0;y<n;y++){let w=Math.pow(i,y);m.push(w),u+=w;}let b=[0],$=0;for(let y=0;y<n;y++)$+=m[y]/u,b.push($);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let w=0;w<n;w++)if(y<=b[w+1]){let k=(y-b[w])/(b[w+1]-b[w]);if(w===0)return k*(2-k);let v=1-Math.pow(o,w);return v+(1-v)*(2*k-1)*(2*k-1)}return 1}}function Gt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),o=Math.max(.1,r),i=n<=1?o/4:o/(2*Math.PI)*Math.asin(1/n);return u=>u<=0?0:u>=1?1:n*Math.pow(2,-10*u)*Math.sin((u-i)*(2*Math.PI)/o)+1}var Ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Wt(),elastic:Gt()};function pt(e,r,n){return Math.min(n,Math.max(r,e))}function Be(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",o="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:o}}function dt(e,r,n,o){switch(o){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function gt(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 ue(e,r,n,o){return n===r?0:pt((e-r)/(n-r)*o,0,1)}function Ue(e,r,n,o,i){let u=dt(e.top,e.height,r,o.element)-gt(o.viewport,n),m=dt(e.top,e.height,r,i.element)-gt(i.viewport,n);return {tStart:u,tEnd:m}}function yt(e,r,n){let o=e.getBoundingClientRect(),i=n==="x"?o.width:o.height;return r?{top:n==="x"?o.left-r.getBoundingClientRect().left+r.scrollLeft:o.top-r.getBoundingClientRect().top+r.scrollTop,height:i,scroll:0}:{top:n==="x"?o.left:o.top,height:i,scroll:n==="x"?window.scrollX:window.scrollY}}function de(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),o=parseFloat(e.getAttribute("height")??"0");return 2*(n+o)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function ht(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 o=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return o?[parseInt(o[1]),parseInt(o[2]),parseInt(o[3])]:null}function Ie(e,r,n){let o=ht(e),i=ht(r);return !o||!i?e:`rgb(${Math.round(o[0]+(i[0]-o[0])*n)},${Math.round(o[1]+(i[1]-o[1])*n)},${Math.round(o[2]+(i[2]-o[2])*n)})`}var bt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Se=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ge(e,...r){Se&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var qt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Bt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",wt=33;function Ut(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function jt(e){let r=[];for(let n=0;n<wt;n++){let o=n/(wt-1);r.push(String(Math.round(e(o)*1e5)/1e5));}return `linear(${r.join(",")})`}function vt(e){switch(e){case "linear":return "linear";case "ease-in":return qt;case "ease-out":return Bt;case "ease-in-out":return Ut()?jt(Ee["ease-in-out"]):null;default:return null}}var Et=Symbol.for("svg-scroll-draw.registry");function St(){let e=globalThis;return e[Et]||(e[Et]=new Map)}function xt(e,r){St().set(e,r);}function $t(e){St().delete(e);}var xe,Ne=new Set,_e=new WeakMap,$e=new Map,Tt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function Qt(e){let r=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let o=n;o;o=o.previousElementSibling)r.add(o);return r}function At(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>r();xe??(xe=new ResizeObserver(i=>{let u=false;for(let{target:m}of i)_e.get(m)!==Tt(m)&&(u=true),_e.set(m,"");u&&Ne.forEach(m=>m());})),Ne.add(n);let o=Qt(e);return [document.body,document.documentElement].forEach(i=>i&&o.add(i)),o.forEach(i=>{_e.has(i)||_e.set(i,Tt(i)),$e.set(i,($e.get(i)??0)+1),xe.observe(i);}),()=>{Ne.delete(n)&&(o.forEach(i=>{let u=($e.get(i)??1)-1;if(u)return void $e.set(i,u);$e.delete(i),xe?.unobserve(i);}),Ne.size||(xe?.disconnect(),xe=void 0));}}var Xt=0;function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Mt(e,r){let n="";try{n=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return n||(e.getAttribute(r)??"").trim()}var kt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Jt(e){if(!Se)return;let r=Mt(e,"stroke");if(!r||r==="none"){ge("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!kt.has(n)&&!kt.has(Mt(e,"fill"))&&ge("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Kt(e,r,n){let o=document.createElement("div");o.setAttribute("data-svg-scroll-draw-debug",""),o.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 u=n==="x"?window.scrollX:window.scrollY,m=e-u,b=r-u,$=n==="x";o.innerHTML=`
2
+ <div style="position:absolute;${$?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
+ <div style="position:absolute;${$?`left:${b}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${b}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(o),window.addEventListener("scroll",i,{passive:true}),i(),{el:o,destroy(){window.removeEventListener("scroll",i),o.remove();}}}var Lt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Zt(e,r,n){if(!Se)return;let o=(e.match(Pt)??[]).join("").toUpperCase(),i=(r.match(Pt)??[]).join("").toUpperCase(),u=(e.match(Lt)??[]).length,m=(r.match(Lt)??[]).length;if(o!==i){ge(`morphTo: command sequence differs (${o||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}u!==m&&ge(`morphTo: coordinate count differs (${u} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function je(e,r,n){let o=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,u=>{let m=parseFloat(u),b=o[i++]??m;return String(+(m+(b-m)*n).toFixed(4))})}function Dt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...o}=r,i=n?{...bt[n],...o}:o,u=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:b=1,fade:$=false,easing:y="linear",trigger:w={},stagger:k=0,direction:v="forward",once:te=false,debug:Ct=false,axis:X="y",scrollContainer:Fe,autoReverse:Te=false,delay:ye=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:he=false,threshold:Qe=0,rootMargin:Xe="0px",repeat:ie=0,repeatDelay:Ve=0,morphTo:N,clip:ze,autoplay:Ot=false,duration:Rt=1e3,native:It=true,onProgress:be,onStart:Ae,onComplete:ce,onEnter:Ye,onLeave:Je,onEnterBack:Ke,onLeaveBack:Ze}=i,Y=ze===true?"left":typeof ze=="string"?ze:false,ae=typeof y=="function"?y:Ee[y]??Ee.linear,et=Be(w.start??"top bottom"),tt=Be(w.end??"bottom top"),W=typeof Fe=="string"?document.querySelector(Fe):Fe??null,B=Array.isArray(re)?re[0]:null,L=Array.isArray(re)?re[1]:typeof re=="string"?re:null,O=Array.isArray(ne)?ne[0]:null,P=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,R=Array.isArray(se)?se[0]:null,D=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function le(t){let s=t*100;switch(Y){case "right":return `inset(0 0 0 ${100-s}%)`;case "top":return `inset(0 0 ${100-s}% 0)`;case "bottom":return `inset(${100-s}% 0 0 0)`;case "center":return `circle(${t*150}% at 50% 50%)`;default:return `inset(0 ${100-s}% 0 0)`}}let x=Y?[]:Array.from(e.querySelectorAll(m)),d=[],_=[],F=0,V=0,Me=k,rt=0,M=false,G=false,I=0,fe=false,J=-1,we=[],ke=-1,T=false,U=0,Q=0,K,He=null;function nt(){He?.destroy(),He=null;}let Z=new Set,st=NaN,ee=true,Le=-1,ot=performance.now(),me=NaN;function Pe(){return W?X==="x"?W.scrollLeft:W.scrollTop:X==="x"?window.scrollX:window.scrollY}function it(){return W?X==="x"?W.clientWidth:W.clientHeight:X==="x"?window.innerWidth:window.innerHeight}function at(){let t=yt(e,W,X);return Ue(t,t.scroll,it(),et,tt)}function Nt(){let t=V-F,s=x.length-1,l=W??document.documentElement,E=X==="x"?"Width":"Height";if(Me=k,k>0&&s>0&&t>0){let z=l[`scroll${E}`]-l[`client${E}`]-1-F-t/b;z>=0&&(Me=Math.min(k,z/(s*t)));}rt=V+s*Me*t;}function lt(){(({tStart:F,tEnd:V}=at())),Nt(),Ct&&Se&&(nt(),He=Kt(F,V,X));}function We(t,s=at){xt(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:s});let l=t.destroy;return t.destroy=()=>{l.call(t),$t(e);},t}function _t(t,s){if(e.style.setProperty("--scroll-draw-progress",String(t)),Y){let l=s==="reverse"?1-t:t;e.style.clipPath=le(l);return}x.forEach((l,E)=>{l.style.strokeDashoffset=s==="reverse"?`${d[E]*t}`:`${d[E]*(1-t)}`,$&&(l.style.opacity=s==="reverse"?`${1-t}`:`${t}`),B&&L?l.style.stroke=Ie(B,L,t):L&&(l.style.stroke=L),O!==null&&P!==null?l.style.strokeWidth=`${O+(P-O)*t}`:P!==null&&(l.style.strokeWidth=`${P}`),R!==null&&D!==null?l.style.fillOpacity=`${R+(D-R)*t}`:D!==null&&(l.style.fillOpacity=`${D}`),N&&l.tagName.toLowerCase()==="path"&&_[E]&&l.setAttribute("d",je(_[E],N,t));});}function De(){if(e.style.setProperty("--scroll-draw-progress","0"),Y){e.style.clipPath=le(0);return}x.forEach((t,s)=>{t.style.strokeDasharray=`${d[s]}`,t.style.strokeDashoffset=v==="reverse"?"0":`${d[s]}`,$?t.style.opacity=v==="reverse"?"1":"0":t.style.opacity="",B&&(t.style.stroke=B),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`),N&&t.tagName.toLowerCase()==="path"&&_[s]&&t.setAttribute("d",_[s]);});}if(x.forEach(t=>{Jt(t);let s=de(t);d.push(s);let l=t.tagName.toLowerCase()==="path";l?_.push(t.getAttribute("d")??""):_.push(""),N&&(l?Zt(_[_.length-1],N,t):ge(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),u?(t.style.strokeDasharray=`${s}`,t.style.strokeDashoffset=v==="reverse"?`${s}`:"0",$&&(t.style.opacity="1"),L&&(t.style.stroke=L),P!==null&&(t.style.strokeWidth=`${P}`),D!==null&&(t.style.fillOpacity=`${D}`),N&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",N)):(t.style.strokeDasharray=`${s}`,t.style.strokeDashoffset=v==="reverse"?"0":`${s}`,$?t.style.opacity=v==="reverse"?"1":"0":t.style.opacity="",B&&(t.style.stroke=B),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`));}),Y){if(u)return e.style.clipPath=le(1),ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(u)return ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ut=typeof y=="string"?vt(y):null;function Ft(){return !(It===false||!Yt()||!x.length||!ut||Y||X!=="y"||W||b!==1||k!==0||te||Te||he!==false||N||oe||ie||ye>0||be||Ae||ce||Ye||Je||Ke||Ze||re!=null||ne!=null||se!=null||(w.start??"top bottom").trim()!=="top bottom"||(w.end??"bottom top").trim()!=="bottom top")}function Vt(){let t=++Xt,s=`svg-scroll-draw-${t}`,l=`svg-scroll-draw-host-${t}`,E=`--svg-scroll-draw-${t}`,z=v==="reverse"?"0":"var(--ssd-len)",j=v==="reverse"?"var(--ssd-len)":"0",q=`stroke-dashoffset:${z};`,f=`stroke-dashoffset:${j};`;$&&(q+=`opacity:${v==="reverse"?1:0};`,f+=`opacity:${v==="reverse"?0:1};`);let p=document.createElement("style");p.setAttribute("data-svg-scroll-draw",""),p.textContent=`@keyframes ${s}{from{${q}}to{${f}}}.${l}{view-timeline-name:${E};view-timeline-axis:block;}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${ut};animation-fill-mode:both;animation-timeline:${E};animation-range:cover 0% cover 100%;}`,document.head.appendChild(p),e.classList.add(l);function A(a,S){a.style.setProperty("--ssd-len",String(d[S])),a.style.strokeDasharray=`${d[S]}`,a.style.strokeDashoffset="",a.style.opacity="",a.style.animationPlayState="",a.classList.add(s);}x.forEach(A);let c=false,g=-1;function h(){if(g>=0)return g;let a=e.getBoundingClientRect(),{tStart:S,tEnd:H}=Ue({top:a.top,height:a.height},Pe(),it(),et,tt);return ae(ue(Pe(),S,H,b))}return {destroy(){e.classList.remove(l),x.forEach(a=>{a.classList.remove(s),a.style.removeProperty("--ssd-len"),a.style.animationPlayState="";}),p.remove();},replay(){c=false,g=-1,x.forEach(A);},pause(){c=true,x.forEach(a=>{a.style.animationPlayState="paused";});},resume(){c&&(c=false,x.forEach(a=>{a.style.animationPlayState="running";}));},seek(a){let S=Math.min(1,Math.max(0,a));g=S,c=true,x.forEach((H,C)=>{H.classList.remove(s),H.style.strokeDashoffset=v==="reverse"?`${d[C]*S}`:`${d[C]*(1-S)}`,$&&(H.style.opacity=v==="reverse"?`${1-S}`:`${S}`);});},getProgress(){return h()},refresh(){x.forEach((a,S)=>{d[S]=de(a),a.style.setProperty("--ssd-len",String(d[S])),a.style.strokeDasharray=`${d[S]}`;});}}}if(Ft())return We(Vt());function zt(){let t=Math.max(1,Rt),s=0,l=0,E=false;function z(c){let g=true;if(Y){let h=Math.min(1,Math.max(0,c/t)),a=ae(h);U=a,e.style.setProperty("--scroll-draw-progress",String(a)),e.style.clipPath=le(v==="reverse"?1-a:a),be?.(a),h<1&&(g=false);}else x.forEach((h,a)=>{let S=a*k*t,H=Math.min(1,Math.max(0,(c-S)/t)),C=ae(H);h.style.strokeDashoffset=v==="reverse"?`${d[a]*C}`:`${d[a]*(1-C)}`,$&&(h.style.opacity=v==="reverse"?`${1-C}`:`${C}`),B&&L?h.style.stroke=Ie(B,L,C):L&&(h.style.stroke=L),O!==null&&P!==null?h.style.strokeWidth=`${O+(P-O)*C}`:P!==null&&(h.style.strokeWidth=`${P}`),R!==null&&D!==null?h.style.fillOpacity=`${R+(D-R)*C}`:D!==null&&(h.style.fillOpacity=`${D}`),N&&h.tagName.toLowerCase()==="path"&&_[a]&&h.setAttribute("d",je(_[a],N,C)),a===0&&(U=C,be?.(C),e.style.setProperty("--scroll-draw-progress",String(C))),H<1&&(g=false);});if(oe){let h=Math.min(1,Math.max(0,c/t)),a=ae(h);for(let S in oe){let H=parseFloat(S);a>=H&&!Z.has(H)&&(Z.add(H),oe[S]?.());}}return g}function j(c){if(T)return;let g=c-s;G||(G=true,Ae?.());let h=z(g);if(h&&!M){M=true,z(t*(1+Math.max(0,x.length-1)*k)),ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{s=performance.now(),G=false,M=false,Z.clear(),De(),I=requestAnimationFrame(j);},Ve));return}h||(I=requestAnimationFrame(j));}function q(){cancelAnimationFrame(I),clearTimeout(K),s=performance.now(),l=0,T=false,G=false,M=false,Q=0,E=true,U=0,Z.clear(),De(),I=requestAnimationFrame(j);}let f=new IntersectionObserver(c=>{c.forEach(g=>{g.isIntersecting&&!(te&&M)?q():!g.isIntersecting&&!te&&!M&&(cancelAnimationFrame(I),clearTimeout(K),E=false);});},{root:W??null,threshold:Qe,rootMargin:Xe}),p;function A(){clearTimeout(p),p=setTimeout(()=>{x.forEach((c,g)=>{d[g]=de(c),c.style.strokeDasharray=`${d[g]}`;});},150);}return window.addEventListener("resize",A),window.addEventListener("orientationchange",A),ye>0?setTimeout(()=>f.observe(e),ye):f.observe(e),{destroy(){cancelAnimationFrame(I),clearTimeout(K),f.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),clearTimeout(p);},replay(){Q=0,q();},pause(){T||!E||(T=true,l=performance.now()-s,cancelAnimationFrame(I));},resume(){T&&(T=false,E=true,s=performance.now()-l,I=requestAnimationFrame(j));},seek(c){let g=Math.min(1,Math.max(0,c));U=g,T=true,l=g*t,s=performance.now()-l,cancelAnimationFrame(I),z(l);},getProgress(){return U},refresh(){clearTimeout(p),x.forEach((c,g)=>{d[g]=de(c),c.style.strokeDasharray=`${d[g]}`;});}}}if(Ot)return We(zt());lt();function ct(){if(T||!pe)return;let t=performance.now(),s=Pe();if(!ee&&he===false&&s===st){Ge(s);return}ee=false,st=s;let l=b;if(he!==false){let f=t-ot,p=f>0?Math.abs(s-(Le<0?s:Le))/f:0;l=b*Math.max(.2,1+p*(typeof he=="number"?he:1)*.04);}Le=s,ot=t;let E=Te?ke===-1||s>=ke?"forward":"reverse":v;ke=s;let z=V-F,j=true,q=z===0?0:(s-F)/z;if(isNaN(me)||(me<=0&&q>0?Ye?.():me>0&&q<=0&&Ze?.(),me<1&&q>=1?Je?.():me>=1&&q<1&&Ke?.()),me=q,Y){let f=ae(ue(s,F,V,l));te&&!Te&&(J=Math.max(J,f),f=J),U=f,e.style.setProperty("--scroll-draw-progress",String(f));let p=E==="reverse"?1-f:f;e.style.clipPath=le(p),be?.(f),!G&&ue(s,F,V,l)>0&&(G=true,Ae?.()),f>=1&&!M?(M=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{J=-1,G=false,M=false,e.style.clipPath=le(0);},Ve))):f<1&&!te&&(M=false),Ge(s);return}if(x.forEach((f,p)=>{let A=p*Me*z,c=ae(ue(s,F+A,V+A,l));te&&!Te&&(c=we[p]=Math.max(we[p]??J,c)),f.style.strokeDashoffset=E==="reverse"?`${d[p]*c}`:`${d[p]*(1-c)}`,$&&(f.style.opacity=E==="reverse"?`${1-c}`:`${c}`),B&&L?f.style.stroke=Ie(B,L,c):L&&(f.style.stroke=L),O!==null&&P!==null?f.style.strokeWidth=`${O+(P-O)*c}`:P!==null&&(f.style.strokeWidth=`${P}`),R!==null&&D!==null?f.style.fillOpacity=`${R+(D-R)*c}`:D!==null&&(f.style.fillOpacity=`${D}`),N&&f.tagName.toLowerCase()==="path"&&_[p]&&f.setAttribute("d",je(_[p],N,c)),p===0&&(U=c,be?.(c),e.style.setProperty("--scroll-draw-progress",String(c))),c<1&&(j=false);}),oe){let f=ae(ue(s,F,V,l));for(let p in oe){let A=parseFloat(p);f>=A&&!Z.has(A)&&(Z.add(A),oe[p]?.());}}!G&&ue(s,F,V,l)>0&&(G=true,Ae?.()),j&&!M?(M=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{J=-1,we=[],G=false,M=false,Z.clear(),De(),ee=true;},Ve))):!j&&!te&&(M=false),Ge(s);}function ft(t){return t>=V&&t<rt}function Ge(t){fe||ft(t)?I=requestAnimationFrame(ct):pe=false;}let pe=false;function Ce(){pe||(pe=true,I=requestAnimationFrame(function(){ct();}));}function Oe(){pe=false,cancelAnimationFrame(I);}let qe=new IntersectionObserver(t=>{t.forEach(s=>{fe=s.isIntersecting,fe&&!T?(ee=true,Ce()):pe&&!T&&ft(Pe())||Oe();});},{root:W??null,threshold:Qe,rootMargin:Xe});function mt(){x.forEach((t,s)=>{d[s]=de(t),t.style.strokeDasharray=`${d[s]}`;}),lt(),ee=true;}let Re;function ve(){clearTimeout(Re),Re=setTimeout(mt,150);}window.addEventListener("resize",ve),window.addEventListener("orientationchange",ve);let Ht=At([e],ve);return ye>0?setTimeout(()=>qe.observe(e),ye):qe.observe(e),We({destroy(){cancelAnimationFrame(I),clearTimeout(K),Oe(),qe.disconnect(),Ht(),window.removeEventListener("resize",ve),window.removeEventListener("orientationchange",ve),clearTimeout(Re),nt();},replay(){J=-1,we=[],ke=-1,Le=-1,G=false,M=false,Q=0,T=false,U=0,Z.clear(),clearTimeout(K),De(),ee=true,fe&&Ce();},pause(){T=true,Oe();},resume(){T&&(T=false,ee=true,fe&&Ce());},seek(t){let s=Math.min(1,Math.max(0,t));U=s,J=s,we=[],T=true,Oe(),_t(s,v),ee=true;},getProgress(){return U},refresh(){clearTimeout(Re),mt(),fe&&!T&&Ce();}},()=>({tStart:F,tEnd:V}))}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class r extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key="";}connectedCallback(){this.build();}attributeChangedCallback(){this.instance&&this.build();}build(){let i=JSON.stringify(e.map(k=>this.getAttribute(k)));if(this.instance&&i===this.key)return;this.instance?.destroy(),this.key=i;let u={},m=this.getAttribute("speed"),b=this.getAttribute("easing"),$=this.getAttribute("stagger"),y=this.getAttribute("direction"),w=this.getAttribute("selector");m&&(u.speed=parseFloat(m)),b&&(u.easing=b),$&&(u.stagger=parseFloat($)),y&&(u.direction=y),w&&(u.selector=w),this.hasAttribute("fade")&&(u.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(u.once=this.getAttribute("once")!=="false"),this.instance=Dt(this,u);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}r.observedAttributes=e,customElements.define("scroll-draw",r);}
@@ -1 +1 @@
1
- import {b}from'../chunk-WHFRS7IP.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class s extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key="";}connectedCallback(){this.build();}attributeChangedCallback(){this.instance&&this.build();}build(){let i=JSON.stringify(e.map(d=>this.getAttribute(d)));if(this.instance&&i===this.key)return;this.instance?.destroy(),this.key=i;let t={},n=this.getAttribute("speed"),r=this.getAttribute("easing"),a=this.getAttribute("stagger"),c=this.getAttribute("direction"),o=this.getAttribute("selector");n&&(t.speed=parseFloat(n)),r&&(t.easing=r),a&&(t.stagger=parseFloat(a)),c&&(t.direction=c),o&&(t.selector=o),this.hasAttribute("fade")&&(t.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(t.once=this.getAttribute("once")!=="false"),this.instance=b(this,t);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}s.observedAttributes=e,customElements.define("scroll-draw",s);}
1
+ import {b}from'../chunk-LQBXJRFY.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class s extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key="";}connectedCallback(){this.build();}attributeChangedCallback(){this.instance&&this.build();}build(){let i=JSON.stringify(e.map(d=>this.getAttribute(d)));if(this.instance&&i===this.key)return;this.instance?.destroy(),this.key=i;let t={},n=this.getAttribute("speed"),r=this.getAttribute("easing"),a=this.getAttribute("stagger"),c=this.getAttribute("direction"),o=this.getAttribute("selector");n&&(t.speed=parseFloat(n)),r&&(t.easing=r),a&&(t.stagger=parseFloat(a)),c&&(t.direction=c),o&&(t.selector=o),this.hasAttribute("fade")&&(t.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(t.once=this.getAttribute("once")!=="false"),this.instance=b(this,t);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}s.observedAttributes=e,customElements.define("scroll-draw",s);}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svg-scroll-draw",
3
- "version": "2.19.0",
3
+ "version": "2.20.0",
4
4
  "description": "Scroll-driven animation for the web — draw SVG paths, reveal elements, pin sections, scrub video. Zero dependencies, native CSS fast path, works with React, Vue, Svelte, Solid, Angular, Astro and vanilla JS",
5
5
  "keywords": [
6
6
  "svg",
@@ -469,10 +469,10 @@
469
469
  "test:e2e:ui": "playwright test --config e2e/playwright.config.ts --ui"
470
470
  },
471
471
  "devDependencies": {
472
- "@playwright/test": "^1.62.1",
472
+ "@playwright/test": "^1.65.0",
473
473
  "@types/react": "^18.0.0",
474
474
  "@vitest/coverage-v8": "^2.0.0",
475
- "esbuild": "^0.27.7",
475
+ "esbuild": "^0.28.2",
476
476
  "jsdom": "^25.0.0",
477
477
  "scrollreveal": "^4.0.9",
478
478
  "solid-js": "^1.9.13",
@@ -1,3 +0,0 @@
1
- import {b as b$1,a as a$5}from'./chunk-OJFWQ6CU.mjs';import {a as a$2}from'./chunk-YWKPTYSG.mjs';import {a as a$1}from'./chunk-YZV4Z3EQ.mjs';import {a,d as d$1,c,b as b$3}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$4,b as b$2}from'./chunk-BCV4RAIX.mjs';import {b,a as a$3}from'./chunk-LFSU6LR3.mjs';var ct={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var kt=0;function St(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function ut(r,b){let p="";try{p=getComputedStyle(r).getPropertyValue(b).trim();}catch{}return p||(r.getAttribute(b)??"").trim()}var mt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function At(r){if(!a$3)return;let b$1=ut(r,"stroke");if(!b$1||b$1==="none"){b("Element has no stroke \u2014 path will not be visible.",r);return}let p=(r.getAttribute("fill")??"").trim();p&&!mt.has(p)&&!mt.has(ut(r,"fill"))&&b("Element has a fill \u2014 it may obscure the stroke animation.",r);}function xt(r,b,p){let $=document.createElement("div");$.setAttribute("data-svg-scroll-draw-debug",""),$.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 H(){let D=p==="x"?window.scrollX:window.scrollY,C=r-D,V=b-D,O=p==="x";$.innerHTML=`
2
- <div style="position:absolute;${O?`left:${C}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${C}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${O?`left:${V}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${V}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($),window.addEventListener("scroll",H,{passive:true}),H(),{el:$,destroy(){window.removeEventListener("scroll",H),$.remove();}}}var pt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Pt(r,b$1,p){if(!a$3)return;let $=(r.match(dt)??[]).join("").toUpperCase(),H=(b$1.match(dt)??[]).join("").toUpperCase(),D=(r.match(pt)??[]).length,C=(b$1.match(pt)??[]).length;if($!==H){b(`morphTo: command sequence differs (${$||"\u2205"} \u2192 ${H||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,p);return}D!==C&&b(`morphTo: coordinate count differs (${D} \u2192 ${C}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,p);}function Ve(r,b,p){let $=(b.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),H=0;return r.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,D=>{let C=parseFloat(D),V=$[H++]??C;return String(+(C+(V-C)*p).toFixed(4))})}function Wt(r,b$4={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:p,...$}=b$4,H=p?{...ct[p],...$}:$,D=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:C="path, polyline, line, polygon, rect, circle",speed:V=1,fade:O=false,easing:me="linear",trigger:ve={},stagger:we=0,direction:d$2="forward",once:Z=false,debug:yt=false,axis:J="y",scrollContainer:De,autoReverse:be=false,delay:pe=0,strokeColor:K,strokeWidth:ee,fillOpacity:te,waypoints:re,velocityScale:de=false,threshold:Ge=0,rootMargin:Be="0px",repeat:se=0,repeatDelay:Ce=0,morphTo:P,clip:Oe,autoplay:ht=false,duration:gt=1e3,native:vt=true,onProgress:ye,onStart:$e,onComplete:ae,onEnter:_e,onLeave:Ue,onEnterBack:je,onLeaveBack:Xe}=H,U=Oe===true?"left":typeof Oe=="string"?Oe:false,oe=typeof me=="function"?me:d[me]??d.linear,Ye=a(ve.start??"top bottom"),Qe=a(ve.end??"bottom top"),R=typeof De=="string"?document.querySelector(De):De??null,I=Array.isArray(K)?K[0]:null,E=Array.isArray(K)?K[1]:typeof K=="string"?K:null,A=Array.isArray(ee)?ee[0]:null,T=Array.isArray(ee)?ee[1]:typeof ee=="number"?ee:null,x=Array.isArray(te)?te[0]:null,k=Array.isArray(te)?te[1]:typeof te=="number"?te:null;function ne(e){let t=e*100;switch(U){case "right":return `inset(0 0 0 ${100-t}%)`;case "top":return `inset(0 0 ${100-t}% 0)`;case "bottom":return `inset(${100-t}% 0 0 0)`;case "center":return `circle(${e*150}% at 50% 50%)`;default:return `inset(0 ${100-t}% 0 0)`}}let m=U?[]:Array.from(r.querySelectorAll(C)),l=[],L=[],z=0,G=0,g=false,F=false,v=0,le=false,j=-1,he=[],Ee=-1,w=false,W=0,B=0,X,Fe=null;function Ze(){Fe?.destroy(),Fe=null;}let Y=new Set,Je=NaN,Q=true,Te=-1,Ke=performance.now(),fe=NaN;function Ne(){return R?J==="x"?R.scrollLeft:R.scrollTop:J==="x"?window.scrollX:window.scrollY}function et(){return R?J==="x"?R.clientWidth:R.clientHeight:J==="x"?window.innerWidth:window.innerHeight}function tt(){let e=a$2(r,R,J);return c(e,e.scroll,et(),Ye,Qe)}function rt(){(({tStart:z,tEnd:G}=tt())),yt&&a$3&&(Ze(),Fe=xt(z,G,J));}function He(e,t=tt){a$4(r,{type:"draw",getProgress:()=>e.getProgress(),getTrigger:t});let n=e.destroy;return e.destroy=()=>{n.call(e),b$2(r);},e}function wt(e,t){if(r.style.setProperty("--scroll-draw-progress",String(e)),U){let n=t==="reverse"?1-e:e;r.style.clipPath=ne(n);return}m.forEach((n,y)=>{n.style.strokeDashoffset=t==="reverse"?`${l[y]*e}`:`${l[y]*(1-e)}`,O&&(n.style.opacity=t==="reverse"?`${1-e}`:`${e}`),I&&E?n.style.stroke=a$5(I,E,e):E&&(n.style.stroke=E),A!==null&&T!==null?n.style.strokeWidth=`${A+(T-A)*e}`:T!==null&&(n.style.strokeWidth=`${T}`),x!==null&&k!==null?n.style.fillOpacity=`${x+(k-x)*e}`:k!==null&&(n.style.fillOpacity=`${k}`),P&&n.tagName.toLowerCase()==="path"&&L[y]&&n.setAttribute("d",Ve(L[y],P,e));});}function ke(){if(r.style.setProperty("--scroll-draw-progress","0"),U){r.style.clipPath=ne(0);return}m.forEach((e,t)=>{e.style.strokeDasharray=`${l[t]}`,e.style.strokeDashoffset=d$2==="reverse"?"0":`${l[t]}`,O?e.style.opacity=d$2==="reverse"?"1":"0":e.style.opacity="",I&&(e.style.stroke=I),A!==null&&(e.style.strokeWidth=`${A}`),x!==null&&(e.style.fillOpacity=`${x}`),P&&e.tagName.toLowerCase()==="path"&&L[t]&&e.setAttribute("d",L[t]);});}if(m.forEach(e=>{At(e);let t=a$1(e);l.push(t);let n=e.tagName.toLowerCase()==="path";n?L.push(e.getAttribute("d")??""):L.push(""),P&&(n?Pt(L[L.length-1],P,e):b(`morphTo only applies to <path> elements \u2014 ignored on <${e.tagName}>.`,e)),D?(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=d$2==="reverse"?`${t}`:"0",O&&(e.style.opacity="1"),E&&(e.style.stroke=E),T!==null&&(e.style.strokeWidth=`${T}`),k!==null&&(e.style.fillOpacity=`${k}`),P&&e.tagName.toLowerCase()==="path"&&e.setAttribute("d",P)):(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=d$2==="reverse"?"0":`${t}`,O?e.style.opacity=d$2==="reverse"?"1":"0":e.style.opacity="",I&&(e.style.stroke=I),A!==null&&(e.style.strokeWidth=`${A}`),x!==null&&(e.style.fillOpacity=`${x}`));}),U){if(D)return r.style.clipPath=ne(1),ae?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};r.style.clipPath=ne(0);}else if(D)return ae?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let st=typeof me=="string"?b$1(me):null;function bt(){return !(vt===false||!St()||!m.length||!st||U||J!=="y"||R||V!==1||we!==0||Z||be||de!==false||P||re||se||pe>0||ye||$e||ae||_e||Ue||je||Xe||K!=null||ee!=null||te!=null||(ve.start??"top bottom").trim()!=="top bottom"||(ve.end??"bottom top").trim()!=="bottom top")}function $t(){let e=++kt,t=`svg-scroll-draw-${e}`,n=`svg-scroll-draw-host-${e}`,y=`--svg-scroll-draw-${e}`,_=d$2==="reverse"?"0":"var(--ssd-len)",q=d$2==="reverse"?"var(--ssd-len)":"0",N=`stroke-dashoffset:${_};`,i=`stroke-dashoffset:${q};`;O&&(N+=`opacity:${d$2==="reverse"?1:0};`,i+=`opacity:${d$2==="reverse"?0:1};`);let a=document.createElement("style");a.setAttribute("data-svg-scroll-draw",""),a.textContent=`@keyframes ${t}{from{${N}}to{${i}}}.${n}{view-timeline-name:${y};view-timeline-axis:block;}.${t}{animation-name:${t};animation-duration:auto;animation-timing-function:${st};animation-fill-mode:both;animation-timeline:${y};animation-range:cover 0% cover 100%;}`,document.head.appendChild(a),r.classList.add(n);function h(s,u){s.style.setProperty("--ssd-len",String(l[u])),s.style.strokeDasharray=`${l[u]}`,s.style.strokeDashoffset="",s.style.opacity="",s.style.animationPlayState="",s.classList.add(t);}m.forEach(h);let o=false,f=-1;function c$1(){if(f>=0)return f;let s=r.getBoundingClientRect(),{tStart:u,tEnd:M}=c({top:s.top,height:s.height},Ne(),et(),Ye,Qe);return oe(b$3(Ne(),u,M,V))}return {destroy(){r.classList.remove(n),m.forEach(s=>{s.classList.remove(t),s.style.removeProperty("--ssd-len"),s.style.animationPlayState="";}),a.remove();},replay(){o=false,f=-1,m.forEach(h);},pause(){o=true,m.forEach(s=>{s.style.animationPlayState="paused";});},resume(){o&&(o=false,m.forEach(s=>{s.style.animationPlayState="running";}));},seek(s){let u=Math.min(1,Math.max(0,s));f=u,o=true,m.forEach((M,S)=>{M.classList.remove(t),M.style.strokeDashoffset=d$2==="reverse"?`${l[S]*u}`:`${l[S]*(1-u)}`,O&&(M.style.opacity=d$2==="reverse"?`${1-u}`:`${u}`);});},getProgress(){return c$1()},refresh(){m.forEach((s,u)=>{l[u]=a$1(s),s.style.setProperty("--ssd-len",String(l[u])),s.style.strokeDasharray=`${l[u]}`;});}}}if(bt())return He($t());function Et(){let e=Math.max(1,gt),t=0,n=0,y=false;function _(o){let f=true;if(U){let c=Math.min(1,Math.max(0,o/e)),s=oe(c);W=s,r.style.setProperty("--scroll-draw-progress",String(s)),r.style.clipPath=ne(d$2==="reverse"?1-s:s),ye?.(s),c<1&&(f=false);}else m.forEach((c,s)=>{let u=s*we*e,M=Math.min(1,Math.max(0,(o-u)/e)),S=oe(M);c.style.strokeDashoffset=d$2==="reverse"?`${l[s]*S}`:`${l[s]*(1-S)}`,O&&(c.style.opacity=d$2==="reverse"?`${1-S}`:`${S}`),I&&E?c.style.stroke=a$5(I,E,S):E&&(c.style.stroke=E),A!==null&&T!==null?c.style.strokeWidth=`${A+(T-A)*S}`:T!==null&&(c.style.strokeWidth=`${T}`),x!==null&&k!==null?c.style.fillOpacity=`${x+(k-x)*S}`:k!==null&&(c.style.fillOpacity=`${k}`),P&&c.tagName.toLowerCase()==="path"&&L[s]&&c.setAttribute("d",Ve(L[s],P,S)),s===0&&(W=S,ye?.(S),r.style.setProperty("--scroll-draw-progress",String(S))),M<1&&(f=false);});if(re){let c=Math.min(1,Math.max(0,o/e)),s=oe(c);for(let u in re){let M=parseFloat(u);s>=M&&!Y.has(M)&&(Y.add(M),re[u]?.());}}return f}function q(o){if(w)return;let f=o-t;F||(F=true,$e?.());let c=_(f);if(c&&!g){g=true,_(e*(1+Math.max(0,m.length-1)*we)),ae?.(),B<(se==="infinite"?1/0:se??0)&&(B++,X=setTimeout(()=>{t=performance.now(),F=false,g=false,Y.clear(),ke(),v=requestAnimationFrame(q);},Ce));return}c||(v=requestAnimationFrame(q));}function N(){cancelAnimationFrame(v),clearTimeout(X),t=performance.now(),n=0,w=false,F=false,g=false,B=0,y=true,W=0,Y.clear(),ke(),v=requestAnimationFrame(q);}let i=new IntersectionObserver(o=>{o.forEach(f=>{f.isIntersecting&&!(Z&&g)?N():!f.isIntersecting&&!Z&&!g&&(cancelAnimationFrame(v),clearTimeout(X),y=false);});},{root:R??null,threshold:Ge,rootMargin:Be}),a;function h(){clearTimeout(a),a=setTimeout(()=>{m.forEach((o,f)=>{l[f]=a$1(o),o.style.strokeDasharray=`${l[f]}`;});},150);}return window.addEventListener("resize",h),window.addEventListener("orientationchange",h),pe>0?setTimeout(()=>i.observe(r),pe):i.observe(r),{destroy(){cancelAnimationFrame(v),clearTimeout(X),i.disconnect(),window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),clearTimeout(a);},replay(){B=0,N();},pause(){w||!y||(w=true,n=performance.now()-t,cancelAnimationFrame(v));},resume(){w&&(w=false,y=true,t=performance.now()-n,v=requestAnimationFrame(q));},seek(o){let f=Math.min(1,Math.max(0,o));W=f,w=true,n=f*e,t=performance.now()-n,cancelAnimationFrame(v),_(n);},getProgress(){return W},refresh(){clearTimeout(a),m.forEach((o,f)=>{l[f]=a$1(o),o.style.strokeDasharray=`${l[f]}`;});}}}if(ht)return He(Et());rt();function Se(){if(!le||w)return;let e=performance.now(),t=Ne();if(!Q&&de===false&&t===Je){v=requestAnimationFrame(Se);return}Q=false,Je=t;let n=V;if(de!==false){let i=e-Ke,a=i>0?Math.abs(t-(Te<0?t:Te))/i:0;n=V*Math.max(.2,1+a*(typeof de=="number"?de:1)*.04);}Te=t,Ke=e;let y=be?Ee===-1||t>=Ee?"forward":"reverse":d$2;Ee=t;let _=G-z,q=true,N=_===0?0:(t-z)/_;if(isNaN(fe)||(fe<=0&&N>0?_e?.():fe>0&&N<=0&&Xe?.(),fe<1&&N>=1?Ue?.():fe>=1&&N<1&&je?.()),fe=N,U){let i=oe(b$3(t,z,G,n));Z&&!be&&(j=Math.max(j,i),i=j),W=i,r.style.setProperty("--scroll-draw-progress",String(i));let a=y==="reverse"?1-i:i;r.style.clipPath=ne(a),ye?.(i),!F&&b$3(t,z,G,n)>0&&(F=true,$e?.()),i>=1&&!g?(g=true,ae?.(),B<(se==="infinite"?1/0:se??0)&&(B++,X=setTimeout(()=>{j=-1,F=false,g=false,r.style.clipPath=ne(0);},Ce))):i<1&&!Z&&(g=false),v=requestAnimationFrame(Se);return}if(m.forEach((i,a)=>{let h=a*we*_,o=oe(b$3(t,z+h,G+h,n));Z&&!be&&(o=he[a]=Math.max(he[a]??j,o)),i.style.strokeDashoffset=y==="reverse"?`${l[a]*o}`:`${l[a]*(1-o)}`,O&&(i.style.opacity=y==="reverse"?`${1-o}`:`${o}`),I&&E?i.style.stroke=a$5(I,E,o):E&&(i.style.stroke=E),A!==null&&T!==null?i.style.strokeWidth=`${A+(T-A)*o}`:T!==null&&(i.style.strokeWidth=`${T}`),x!==null&&k!==null?i.style.fillOpacity=`${x+(k-x)*o}`:k!==null&&(i.style.fillOpacity=`${k}`),P&&i.tagName.toLowerCase()==="path"&&L[a]&&i.setAttribute("d",Ve(L[a],P,o)),a===0&&(W=o,ye?.(o),r.style.setProperty("--scroll-draw-progress",String(o))),o<1&&(q=false);}),re){let i=oe(b$3(t,z,G,n));for(let a in re){let h=parseFloat(a);i>=h&&!Y.has(h)&&(Y.add(h),re[a]?.());}}!F&&b$3(t,z,G,n)>0&&(F=true,$e?.()),q&&!g?(g=true,ae?.(),B<(se==="infinite"?1/0:se??0)&&(B++,X=setTimeout(()=>{j=-1,he=[],F=false,g=false,Y.clear(),ke(),Q=true;},Ce))):!q&&!Z&&(g=false),v=requestAnimationFrame(Se);}let Re=false;function Ae(){Re||(Re=true,v=requestAnimationFrame(function(){Se();}));}function xe(){Re=false,cancelAnimationFrame(v);}let Ie=new IntersectionObserver(e=>{e.forEach(t=>{le=t.isIntersecting,le&&!w?(Q=true,Ae()):xe();});},{root:R??null,threshold:Ge,rootMargin:Be});function ot(){m.forEach((e,t)=>{l[t]=a$1(e),e.style.strokeDasharray=`${l[t]}`;}),rt(),Q=true;}let Pe;function ge(){clearTimeout(Pe),Pe=setTimeout(ot,150);}window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge);let Tt=d$1([r],ge);return pe>0?setTimeout(()=>Ie.observe(r),pe):Ie.observe(r),He({destroy(){cancelAnimationFrame(v),clearTimeout(X),xe(),Ie.disconnect(),Tt(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(Pe),Ze();},replay(){j=-1,he=[],Ee=-1,Te=-1,F=false,g=false,B=0,w=false,W=0,Y.clear(),clearTimeout(X),ke(),Q=true,le&&Ae();},pause(){w=true,xe();},resume(){w&&(w=false,Q=true,le&&Ae());},seek(e){let t=Math.min(1,Math.max(0,e));W=t,j=t,he=[],w=true,xe(),wt(t,d$2),Q=true;},getProgress(){return W},refresh(){clearTimeout(Pe),ot(),le&&!w&&Ae();}},()=>({tStart:z,tEnd:G}))}export{ct as a,Wt as b};