svg-scroll-draw 2.20.0 → 2.21.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.
- package/README.md +4 -4
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +6 -3
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-426RAN5I.mjs +1 -0
- package/dist/{chunk-LQBXJRFY.mjs → chunk-ENACACPZ.mjs} +2 -2
- package/dist/{chunk-VVFGB4RT.mjs → chunk-MENZ5DS4.mjs} +1 -1
- package/dist/{chunk-6SSA5V7J.mjs → chunk-SMRTRZSD.mjs} +1 -1
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +2 -2
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-I45LCJUP.mjs +0 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
| `scrollParallax` | `svg-scroll-draw` | Move any element at a different rate than scroll. Speed multiplier, reverse direction. |
|
|
29
29
|
| `scrollDraw` | `svg-scroll-draw` | The original — scroll-driven SVG path drawing via `stroke-dashoffset`. |
|
|
30
30
|
| `scrollVideo` | `svg-scroll-draw/video` | Tie `<video>.currentTime` to scroll. The Apple/Stripe product-page pattern. |
|
|
31
|
-
| `scrollText` | `svg-scroll-draw/text` | Split text into chars/words/lines and stagger-animate each on scroll. 3.
|
|
31
|
+
| `scrollText` | `svg-scroll-draw/text` | Split text into chars/words/lines and stagger-animate each on scroll. 3.2 KB, nothing else to load. |
|
|
32
32
|
| `devtools` | `svg-scroll-draw/devtools` | Visual overlay showing every active animation's triggers and progress. Dev-only. |
|
|
33
33
|
| `AOS` | `svg-scroll-draw/aos` | Drop-in replacement for AOS: same `AOS.init()`, same `data-aos` markup, no `aos.css`. |
|
|
34
34
|
| `ScrollReveal` | `svg-scroll-draw/scrollreveal` | Drop-in replacement for ScrollReveal.js 4, MIT instead of GPL-3.0. |
|
|
@@ -630,10 +630,10 @@ devtools.highlight('#my-element'); // outline for 2 seconds
|
|
|
630
630
|
| Entry | Gzipped |
|
|
631
631
|
|---|---|
|
|
632
632
|
| `svg-scroll-draw` (main, every core API) | 11.4 KB |
|
|
633
|
-
| `svg-scroll-draw/react` (includes the engine) | 12.
|
|
634
|
-
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.
|
|
633
|
+
| `svg-scroll-draw/react` (includes the engine) | 12.9 KB |
|
|
634
|
+
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.4 KB |
|
|
635
635
|
| `svg-scroll-draw/reveal` | 5.5 KB |
|
|
636
|
-
| `svg-scroll-draw/text` | 3.
|
|
636
|
+
| `svg-scroll-draw/text` | 3.2 KB |
|
|
637
637
|
| `svg-scroll-draw/video` | 2.7 KB |
|
|
638
638
|
| `svg-scroll-draw/scrollreveal` | 4.5 KB |
|
|
639
639
|
| `svg-scroll-draw/vivus` | 4.0 KB |
|
package/dist/angular/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",s,{passive:true}),s(),{el:t,destroy(){window.removeEventListener("scroll",s),t.remove();}}}var Ht=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Nt=/[MmLlHhVvCcSsQqTtAaZz]/g;function vr(e,n,r){if(!Xe)return;let t=(e.match(Nt)??[]).join("").toUpperCase(),s=(n.match(Nt)??[]).join("").toUpperCase(),i=(e.match(Ht)??[]).length,l=(n.match(Ht)??[]).length;if(t!==s){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==l&&we(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function ft(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),u=t[s++]??l;return String(+(l+(u-l)*r).toFixed(4))})}function Rt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,s=r?{...Pt[r],...t}:t,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:T={},stagger:H=0,direction:A="forward",once:re=false,debug:Ce=false,axis:G="y",scrollContainer:ue,autoReverse:ne=false,delay:Y=0,strokeColor:N,strokeWidth:C,fillOpacity:O,waypoints:w,velocityScale:k=false,threshold:x=0,rootMargin:M="0px",repeat:E=0,repeatDelay:oe=0,morphTo:L,clip:se,autoplay:ve=false,duration:ge=1e3,native:ye=true,onProgress:R,onStart:P,onComplete:f,onEnter:p,onLeave:I,onEnterBack:q,onLeaveBack:Me}=s,v=se===true?"left":typeof se=="string"?se:false,z=typeof d=="function"?d:ce[d]??ce.linear,me=be(T.start??"top bottom"),He=be(T.end??"bottom top"),Ee=typeof ue=="string"?document.querySelector(ue):ue??null,Ae=Array.isArray(N)?N[0]:null,fe=Array.isArray(N)?N[1]:typeof N=="string"?N:null,X=Array.isArray(C)?C[0]:null,ie=Array.isArray(C)?C[1]:typeof C=="number"?C:null,ae=Array.isArray(O)?O[0]:null,K=Array.isArray(O)?O[1]:typeof O=="number"?O:null;function Ne(o){let a=o*100;switch(v){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=v?[]:Array.from(e.querySelectorAll(l)),F=[],pe=[],J=0,Se=0,c=H,h=0,_=false,B=false,$=0,ee=false,he=-1,Re=[],le=-1,j=false,Te=0,ze=0,Ve,lt=null;function gt(){lt?.destroy(),lt=null;}let _e=new Set,yt=NaN,We=true,Ze=-1,ht=performance.now(),Be=NaN;function Je(){return Ee?G==="x"?Ee.scrollLeft:Ee.scrollTop:G==="x"?window.scrollX:window.scrollY}function bt(){return Ee?G==="x"?Ee.clientWidth:Ee.clientHeight:G==="x"?window.innerWidth:window.innerHeight}function wt(){let o=ot(e,Ee,G);return Pe(o,o.scroll,bt(),me,He)}function nr(){let o=Se-J,a=V.length-1,y=Ee??document.documentElement,Q=G==="x"?"Width":"Height";if(c=H,H>0&&a>0&&o>0){let Le=y[`scroll${Q}`]-y[`client${Q}`]-1-J-o/u;Le>=0&&(c=Math.min(H,Le/(a*o)));}h=Se+a*c*o;}function vt(){(({tStart:J,tEnd:Se}=wt())),nr(),Ce&&Xe&&(gt(),lt=wr(J,Se,G));}function ct(o,a=wt){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let y=o.destroy;return o.destroy=()=>{y.call(o),Ie(e);},o}function or(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),v){let y=a==="reverse"?1-o:o;e.style.clipPath=Ne(y);return}V.forEach((y,Q)=>{y.style.strokeDashoffset=a==="reverse"?`${F[Q]*o}`:`${F[Q]*(1-o)}`,m&&(y.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ae&&fe?y.style.stroke=Ue(Ae,fe,o):fe&&(y.style.stroke=fe),X!==null&&ie!==null?y.style.strokeWidth=`${X+(ie-X)*o}`:ie!==null&&(y.style.strokeWidth=`${ie}`),ae!==null&&K!==null?y.style.fillOpacity=`${ae+(K-ae)*o}`:K!==null&&(y.style.fillOpacity=`${K}`),L&&y.tagName.toLowerCase()==="path"&&pe[Q]&&y.setAttribute("d",ft(pe[Q],L,o));});}function et(){if(e.style.setProperty("--scroll-draw-progress","0"),v){e.style.clipPath=Ne(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${F[a]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${F[a]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Ae&&(o.style.stroke=Ae),X!==null&&(o.style.strokeWidth=`${X}`),ae!==null&&(o.style.fillOpacity=`${ae}`),L&&o.tagName.toLowerCase()==="path"&&pe[a]&&o.setAttribute("d",pe[a]);});}if(V.forEach(o=>{br(o);let a=je(o);F.push(a);let y=o.tagName.toLowerCase()==="path";y?pe.push(o.getAttribute("d")??""):pe.push(""),L&&(y?vr(pe[pe.length-1],L,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),i?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),fe&&(o.style.stroke=fe),ie!==null&&(o.style.strokeWidth=`${ie}`),K!==null&&(o.style.fillOpacity=`${K}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?"0":`${a}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Ae&&(o.style.stroke=Ae),X!==null&&(o.style.strokeWidth=`${X}`),ae!==null&&(o.style.fillOpacity=`${ae}`));}),v){if(i)return e.style.clipPath=Ne(1),f?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ne(0);}else if(i)return f?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Et=typeof d=="string"?st(d):null;function sr(){return !(ye===false||!hr()||!V.length||!Et||v||G!=="y"||Ee||u!==1||H!==0||re||ne||k!==false||L||w||E||Y>0||R||P||f||p||I||q||Me||N!=null||C!=null||O!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function ir(){let o=++yr,a=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,Q=`--svg-scroll-draw-${o}`,Le=A==="reverse"?"0":"var(--ssd-len)",Fe=A==="reverse"?"var(--ssd-len)":"0",ke=`stroke-dashoffset:${Le};`,S=`stroke-dashoffset:${Fe};`;m&&(ke+=`opacity:${A==="reverse"?1:0};`,S+=`opacity:${A==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${ke}}to{${S}}}.${y}{view-timeline-name:${Q};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Et};animation-fill-mode:both;animation-timeline:${Q};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(y);function de(g,Z){g.style.setProperty("--ssd-len",String(F[Z])),g.style.strokeDasharray=`${F[Z]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(a);}V.forEach(de);let b=false,W=-1;function U(){if(W>=0)return W;let g=e.getBoundingClientRect(),{tStart:Z,tEnd:$e}=Pe({top:g.top,height:g.height},Je(),bt(),me,He);return z(te(Je(),Z,$e,u))}return {destroy(){e.classList.remove(y),V.forEach(g=>{g.classList.remove(a),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),D.remove();},replay(){b=false,W=-1,V.forEach(de);},pause(){b=true,V.forEach(g=>{g.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let Z=Math.min(1,Math.max(0,g));W=Z,b=true,V.forEach(($e,xe)=>{$e.classList.remove(a),$e.style.strokeDashoffset=A==="reverse"?`${F[xe]*Z}`:`${F[xe]*(1-Z)}`,m&&($e.style.opacity=A==="reverse"?`${1-Z}`:`${Z}`);});},getProgress(){return U()},refresh(){V.forEach((g,Z)=>{F[Z]=je(g),g.style.setProperty("--ssd-len",String(F[Z])),g.style.strokeDasharray=`${F[Z]}`;});}}}if(sr())return ct(ir());function ar(){let o=Math.max(1,ge),a=0,y=0,Q=false;function Le(b){let W=true;if(v){let U=Math.min(1,Math.max(0,b/o)),g=z(U);Te=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=Ne(A==="reverse"?1-g:g),R?.(g),U<1&&(W=false);}else V.forEach((U,g)=>{let Z=g*H*o,$e=Math.min(1,Math.max(0,(b-Z)/o)),xe=z($e);U.style.strokeDashoffset=A==="reverse"?`${F[g]*xe}`:`${F[g]*(1-xe)}`,m&&(U.style.opacity=A==="reverse"?`${1-xe}`:`${xe}`),Ae&&fe?U.style.stroke=Ue(Ae,fe,xe):fe&&(U.style.stroke=fe),X!==null&&ie!==null?U.style.strokeWidth=`${X+(ie-X)*xe}`:ie!==null&&(U.style.strokeWidth=`${ie}`),ae!==null&&K!==null?U.style.fillOpacity=`${ae+(K-ae)*xe}`:K!==null&&(U.style.fillOpacity=`${K}`),L&&U.tagName.toLowerCase()==="path"&&pe[g]&&U.setAttribute("d",ft(pe[g],L,xe)),g===0&&(Te=xe,R?.(xe),e.style.setProperty("--scroll-draw-progress",String(xe))),$e<1&&(W=false);});if(w){let U=Math.min(1,Math.max(0,b/o)),g=z(U);for(let Z in w){let $e=parseFloat(Z);g>=$e&&!_e.has($e)&&(_e.add($e),w[Z]?.());}}return W}function Fe(b){if(j)return;let W=b-a;B||(B=true,P?.());let U=Le(W);if(U&&!_){_=true,Le(o*(1+Math.max(0,V.length-1)*H)),f?.(),ze<(E==="infinite"?1/0:E??0)&&(ze++,Ve=setTimeout(()=>{a=performance.now(),B=false,_=false,_e.clear(),et(),$=requestAnimationFrame(Fe);},oe));return}U||($=requestAnimationFrame(Fe));}function ke(){cancelAnimationFrame($),clearTimeout(Ve),a=performance.now(),y=0,j=false,B=false,_=false,ze=0,Q=true,Te=0,_e.clear(),et(),$=requestAnimationFrame(Fe);}let S=new IntersectionObserver(b=>{b.forEach(W=>{W.isIntersecting&&!(re&&_)?ke():!W.isIntersecting&&!re&&!_&&(cancelAnimationFrame($),clearTimeout(Ve),Q=false);});},{root:Ee??null,threshold:x,rootMargin:M}),D;function de(){clearTimeout(D),D=setTimeout(()=>{V.forEach((b,W)=>{F[W]=je(b),b.style.strokeDasharray=`${F[W]}`;});},150);}return window.addEventListener("resize",de),window.addEventListener("orientationchange",de),Y>0?setTimeout(()=>S.observe(e),Y):S.observe(e),{destroy(){cancelAnimationFrame($),clearTimeout(Ve),S.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),clearTimeout(D);},replay(){ze=0,ke();},pause(){j||!Q||(j=true,y=performance.now()-a,cancelAnimationFrame($));},resume(){j&&(j=false,Q=true,a=performance.now()-y,$=requestAnimationFrame(Fe));},seek(b){let W=Math.min(1,Math.max(0,b));Te=W,j=true,y=W*o,a=performance.now()-y,cancelAnimationFrame($),Le(y);},getProgress(){return Te},refresh(){clearTimeout(D),V.forEach((b,W)=>{F[W]=je(b),b.style.strokeDasharray=`${F[W]}`;});}}}if(ve)return ct(ar());vt();function St(){if(j||!Ge)return;let o=performance.now(),a=Je();if(!We&&k===false&&a===yt){ut(a);return}We=false,yt=a;let y=u;if(k!==false){let S=o-ht,D=S>0?Math.abs(a-(Ze<0?a:Ze))/S:0;y=u*Math.max(.2,1+D*(typeof k=="number"?k:1)*.04);}Ze=a,ht=o;let Q=ne?le===-1||a>=le?"forward":"reverse":A;le=a;let Le=Se-J,Fe=true,ke=Le===0?0:(a-J)/Le;if(isNaN(Be)||(Be<=0&&ke>0?p?.():Be>0&&ke<=0&&Me?.(),Be<1&&ke>=1?I?.():Be>=1&&ke<1&&q?.()),Be=ke,v){let S=z(te(a,J,Se,y));re&&!ne&&(he=Math.max(he,S),S=he),Te=S,e.style.setProperty("--scroll-draw-progress",String(S));let D=Q==="reverse"?1-S:S;e.style.clipPath=Ne(D),R?.(S),!B&&te(a,J,Se,y)>0&&(B=true,P?.()),S>=1&&!_?(_=true,f?.(),ze<(E==="infinite"?1/0:E??0)&&(ze++,Ve=setTimeout(()=>{he=-1,B=false,_=false,e.style.clipPath=Ne(0);},oe))):S<1&&!re&&(_=false),ut(a);return}if(V.forEach((S,D)=>{let de=D*c*Le,b=z(te(a,J+de,Se+de,y));re&&!ne&&(b=Re[D]=Math.max(Re[D]??he,b)),S.style.strokeDashoffset=Q==="reverse"?`${F[D]*b}`:`${F[D]*(1-b)}`,m&&(S.style.opacity=Q==="reverse"?`${1-b}`:`${b}`),Ae&&fe?S.style.stroke=Ue(Ae,fe,b):fe&&(S.style.stroke=fe),X!==null&&ie!==null?S.style.strokeWidth=`${X+(ie-X)*b}`:ie!==null&&(S.style.strokeWidth=`${ie}`),ae!==null&&K!==null?S.style.fillOpacity=`${ae+(K-ae)*b}`:K!==null&&(S.style.fillOpacity=`${K}`),L&&S.tagName.toLowerCase()==="path"&&pe[D]&&S.setAttribute("d",ft(pe[D],L,b)),D===0&&(Te=b,R?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Fe=false);}),w){let S=z(te(a,J,Se,y));for(let D in w){let de=parseFloat(D);S>=de&&!_e.has(de)&&(_e.add(de),w[D]?.());}}!B&&te(a,J,Se,y)>0&&(B=true,P?.()),Fe&&!_?(_=true,f?.(),ze<(E==="infinite"?1/0:E??0)&&(ze++,Ve=setTimeout(()=>{he=-1,Re=[],B=false,_=false,_e.clear(),et(),We=true;},oe))):!Fe&&!re&&(_=false),ut(a);}function Tt(o){return o>=Se&&o<h}function ut(o){ee||Tt(o)?$=requestAnimationFrame(St):Ge=false;}let Ge=false;function tt(){Ge||(Ge=true,$=requestAnimationFrame(function(){St();}));}function rt(){Ge=false,cancelAnimationFrame($);}let mt=new IntersectionObserver(o=>{o.forEach(a=>{ee=a.isIntersecting,ee&&!j?(We=true,tt()):Ge&&!j&&Tt(Je())||rt();});},{root:Ee??null,threshold:x,rootMargin:M});function xt(){V.forEach((o,a)=>{F[a]=je(o),o.style.strokeDasharray=`${F[a]}`;}),vt(),We=true;}let nt;function Ye(){clearTimeout(nt),nt=setTimeout(xt,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let lr=De([e],Ye);return Y>0?setTimeout(()=>mt.observe(e),Y):mt.observe(e),ct({destroy(){cancelAnimationFrame($),clearTimeout(Ve),rt(),mt.disconnect(),lr(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(nt),gt();},replay(){he=-1,Re=[],le=-1,Ze=-1,B=false,_=false,ze=0,j=false,Te=0,_e.clear(),clearTimeout(Ve),et(),We=true,ee&&tt();},pause(){j=true,rt();},resume(){j&&(j=false,We=true,ee&&tt());},seek(o){let a=Math.min(1,Math.max(0,o));Te=a,he=a,Re=[],j=true,rt(),or(a,A),We=true;},getProgress(){return Te},refresh(){clearTimeout(nt),xt(),ee&&!j&&tt();}},()=>({tStart:J,tEnd:Se}))}var zt=new WeakMap,Er=0;function pt(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=zt.get(r);return t===void 0&&zt.set(r,t=++Er),`el#${t}`}return r})}function Vt(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...s)=>n()[t]?.(...s));return r}function Sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function _t(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let s=[],i=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}n.push({fn:t[1],nums:s,units:i});}return n}function Tr(e,n,r){let t=_t(e),s=_t(n);return t.length===0||t.length!==s.length?r<1?e:n:t.map((i,l)=>{let u=s[l];return i.fn!==u.fn||i.nums.length!==u.nums.length?r<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${i.units[d]}`).join(", ")})`}).join(" ")}function Wt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),s=String(n);if(Sr(t))return Ue(t,s,r);if(t.includes("("))return Tr(t,s,r);let i=t.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let u=parseFloat(i[1]),m=parseFloat(l[1]);return `${u+(m-u)*r}${i[2]||l[2]}`}return r<1?t:s}function xr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ar=0,qt="--scroll-draw-progress";function Lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Bt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:s={},easing:i="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:d,native:T=true,velocityScale:H=false,respectReducedMotion:A=true,triggerElement:re,onProgress:Ce,onComplete:G,onEnter:ue,onLeave:ne,onEnterBack:Y,onLeaveBack:N}=n,C=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,O=typeof i=="function"?i:ce[i]??ce["ease-out"],w=be(s.start??"top bottom"),k=be(s.end??"bottom top"),x=re??e,M=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([c,h])=>({prop:xr(c),from:Array.isArray(h)?h[0]:"",to:Array.isArray(h)?h[1]:h}));function oe(){let c=window.getComputedStyle(e);for(let h of E)h.from===""&&(h.from=c.getPropertyValue(h.prop).trim()||"0");}function L(){for(let c of E)e.style.setProperty(c.prop,String(c.to));}let se=new Map;for(let c of [...E.map(h=>h.prop),qt])se.set(c,e.style.getPropertyValue(c));function ve(){for(let[c,h]of se)h?e.style.setProperty(c,h):e.style.removeProperty(c);}if(C)return L(),G?.(),{...r,destroy:ve,getProgress:()=>1};oe();let ge=typeof i=="string"?st(i):null;function ye(){if(!T||!Lr()||!ge||m!=="y"||M||x!==e||u||l!==1||Ce||G||ue||ne||Y||N||H!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let c of E)if(!Mr.has(c.prop))return false;return true}function R(){let c=`ssd-a-${++Ar}`,h=E.map(le=>`${le.prop}:${le.from}`).join(";"),_=E.map(le=>`${le.prop}:${le.to}`).join(";"),B=document.createElement("style");B.setAttribute("data-ssd-animate",""),B.textContent=`@keyframes ${c}{from{${h}}to{${_}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(B),e.classList.add(c);let $=()=>m==="x"?window.scrollX:window.scrollY,ee=()=>m==="x"?window.innerWidth:window.innerHeight,he=()=>{let le=e.getBoundingClientRect();return Pe({top:le.top,height:le.height},$(),ee(),w,k)};Oe(e,{type:"animate",getProgress:()=>Re.getProgress(),getTrigger:he});let Re={refresh(){},destroy(){e.classList.remove(c),B.remove(),e.style.animationPlayState="",ve(),Ie(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(le){let j=Math.min(1,Math.max(0,le));e.classList.remove(c);for(let Te of E)e.style.setProperty(Te.prop,Wt(Te.from,Te.to,j));},getProgress(){let{tStart:le,tEnd:j}=he();return O(te($(),le,j,l))}};return Re}if(ye())return R();let P=0,f=0,p=0,I=false,q=false,Me=-1,v=0,z=false,me=NaN,He=-1,Ee=0,Ae=()=>M?m==="x"?M.scrollLeft:M.scrollTop:m==="x"?window.scrollX:window.scrollY,fe=()=>M?m==="x"?M.clientWidth:M.clientHeight:m==="x"?window.innerWidth:window.innerHeight,X=x===e?E:[],ie=false;function ae(){let c=e.style,h=X.map(ee=>c.getPropertyValue(ee.prop)),_=c.transition;X.length&&(c.transition="none"),X.forEach(ee=>c.setProperty(ee.prop,se.get(ee.prop)??""));let B=ot(x,M,m);X.forEach((ee,he)=>c.setProperty(ee.prop,h[he])),X.length&&(e.offsetWidth,c.transition=_);let $=Pe(B,B.scroll,fe(),w,k);ie&&Math.abs($.tStart-P)<1&&Math.abs($.tEnd-f)<1||(ie=true,P=$.tStart,f=$.tEnd);}function K(c){e.style.setProperty(qt,String(c));for(let h of E)e.style.setProperty(h.prop,Wt(h.from,h.to,c));Ce?.(c);}function Ne(c){if(isNaN(me)){me=c;return}me<=0&&c>0?ue?.():me>0&&c<=0&&N?.(),me<1&&c>=1?ne?.():me>=1&&c<1&&Y?.(),me=c;}function V(){if(!I||q)return;let c=performance.now(),h=Ae(),_=l;if(H!==false){let ee=c-Ee,he=ee>0?Math.abs(h-(He<0?h:He))/ee:0;_=l*Math.max(.2,1+he*(typeof H=="number"?H:1)*.04);}He=h,Ee=c;let B=f===P?0:(h-P)/(f-P);Ne(B);let $=O(te(h,P,f,_));u&&(Me=Math.max(Me,$),$=Me),v=$,K($),$>=1&&!z?(z=true,G?.()):$<1&&!u&&(z=false),p=requestAnimationFrame(V);}ae(),f===P&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let c=O(te(Ae(),P,f,l));u&&c>0&&(Me=c),v=c,K(c);}let F=new IntersectionObserver(c=>{c.forEach(h=>{I=h.isIntersecting,I&&!q?p=requestAnimationFrame(V):cancelAnimationFrame(p);});},{root:M??null}),pe;function J(){clearTimeout(pe),pe=setTimeout(ae,150);}window.addEventListener("resize",J),window.addEventListener("orientationchange",J);let Se=De([x],J);return F.observe(e),Oe(e,{type:"animate",getProgress:()=>v,getTrigger:()=>({tStart:P,tEnd:f})}),{destroy(){cancelAnimationFrame(p),F.disconnect(),window.removeEventListener("resize",J),window.removeEventListener("orientationchange",J),Se(),clearTimeout(pe),ve(),Ie(e);},replay(){Me=-1,z=false,v=0,q=false,K(0);},pause(){q=true,cancelAnimationFrame(p);},resume(){q&&(q=false,I&&(p=requestAnimationFrame(V)));},seek(c){let h=Math.min(1,Math.max(0,c));v=h,Me=h,q=true,cancelAnimationFrame(p),K(h);},getProgress(){return v},refresh(){ae();}}}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Gt(e,n){if(typeof window>"u")return dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),dt;let t=r,{from:s=0,to:i,format:l,easing:u="ease-out",trigger:m={},once:d=true,decimals:T,onComplete:H}=n,A=T!==void 0?f=>f.toFixed(T):l??(f=>String(Math.round(f))),re=typeof u=="function"?u:ce[u]??ce["ease-out"],Ce=be(m.start??"top 80%"),G=be(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(i),H?.(),dt;let ne=0,Y=0,N=false,C=0,O=false,w=false,k=-1,x=0,M=false,E=()=>window.scrollY,oe=()=>window.innerHeight;function L(){let f=t.getBoundingClientRect(),p=Pe({top:f.top,height:f.height},E(),oe(),Ce,G);N&&Math.abs(p.tStart-ne)<1&&Math.abs(p.tEnd-Y)<1||(N=true,ne=p.tStart,Y=p.tEnd);}function se(f){t.textContent=A(s+(i-s)*f),t.style.setProperty("--scroll-draw-progress",String(f));}function ve(){if(!O||w)return;let f=re(te(E(),ne,Y,1));d&&(k=Math.max(k,f),f=k),x=f,se(f),f>=1&&!M?(M=true,H?.()):f<1&&!d&&(M=false),C=requestAnimationFrame(ve);}L();{let f=re(te(E(),ne,Y,1));d&&f>0&&(k=f),x=f,se(f);}let ge=new IntersectionObserver(f=>{f.forEach(p=>{O=p.isIntersecting,O&&!w?C=requestAnimationFrame(ve):cancelAnimationFrame(C);});}),ye;function R(){clearTimeout(ye),ye=setTimeout(L,150);}window.addEventListener("resize",R),window.addEventListener("orientationchange",R);let P=De([t],R);return ge.observe(t),Oe(t,{type:"counter",getProgress:()=>x,getTrigger:()=>({tStart:ne,tEnd:Y})}),{destroy(){cancelAnimationFrame(C),ge.disconnect(),window.removeEventListener("resize",R),window.removeEventListener("orientationchange",R),P(),clearTimeout(ye),Ie(t);},replay(){k=-1,M=false,x=0,w=false,se(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,O&&(C=requestAnimationFrame(ve)));},seek(f){let p=Math.min(1,Math.max(0,f));x=p,k=p,w=true,cancelAnimationFrame(C),se(p);},getProgress(){return x}}}var jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ut(e,n={}){if(typeof window>"u")return jt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),jt;let t=r,{trigger:s={},easing:i="linear",once:l=false,axis:u="y",preload:m="auto",triggerElement:d,onReady:T,onComplete:H,onProgress:A}=n,re=d??t,Ce=window.matchMedia("(prefers-reduced-motion: reduce)").matches,G=typeof i=="function"?i:ce[i]??ce.linear,ue=be(s.start??"top top"),ne=be(s.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Y=n.from??0,N=n.to,C=0,O=0,w=0,k=false,x=false,M=-1,E=0,oe=false,L=false,se=()=>u==="x"?window.scrollX:window.scrollY,ve=()=>u==="x"?window.innerWidth:window.innerHeight;function ge(){let v=re.getBoundingClientRect(),z=u==="x"?v.left:v.top,me=u==="x"?v.width:v.height,He=Pe({top:z,height:me},se(),ve(),ue,ne);C=He.tStart,O=He.tEnd,L&&O===C&&we("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let ye=NaN;function R(v){if(!L)return;let z=N??t.duration??0,me=Y+(z-Y)*v;me!==ye&&(ye=me,t.currentTime=me),t.style.setProperty("--scroll-draw-progress",String(v)),A?.(v);}function P(){if(!k||x||!L||Ce)return;let v=G(te(se(),C,O,1));l&&(M=Math.max(M,v),v=M),E=v,R(v),v>=1&&!oe?(oe=true,H?.()):v<1&&!l&&(oe=false),w=requestAnimationFrame(P);}function f(){if(L=true,N===void 0&&(N=t.duration),Ce){R(1),T?.();return}ge(),T?.(),k&&!x&&(w=requestAnimationFrame(P));}t.readyState>=1?f():t.addEventListener("loadedmetadata",f,{once:true}),L||ge();let p=new IntersectionObserver(v=>{v.forEach(z=>{k=z.isIntersecting,k&&!x&&L?w=requestAnimationFrame(P):cancelAnimationFrame(w);});}),I;function q(){clearTimeout(I),I=setTimeout(ge,150);}window.addEventListener("resize",q),window.addEventListener("orientationchange",q);let Me=De([re],q);return p.observe(t),Oe(t,{type:"video",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:O})}),{destroy(){cancelAnimationFrame(w),p.disconnect(),t.removeEventListener("loadedmetadata",f),window.removeEventListener("resize",q),window.removeEventListener("orientationchange",q),Me(),clearTimeout(I),Ie(t);},replay(){M=-1,oe=false,E=0,x=false,ye=NaN,R(0);},pause(){x=true,cancelAnimationFrame(w);},resume(){x&&(x=false,k&&L&&(w=requestAnimationFrame(P)));},seek(v){let z=Math.min(1,Math.max(0,v));E=z,M=z,x=true,cancelAnimationFrame(w),ye=NaN,R(z);},getProgress(){return E}}}function Kt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function $r(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Yt(e){let n=Kt(e),r=new Map;for(let i of n){let l=i.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(i);}let t=[],s=Array.from(r.keys()).sort((i,l)=>i-l);for(let i of s){let l=r.get(i),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((m,d)=>{let T=m.nextElementSibling;u.appendChild(m),d<l.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((i,l)=>{e.appendChild(i),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function Pr(e,n,r,t){if(r<=1||t===0)return e;let s=(r-1)*t,i=n*t,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function Cr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Xt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Qt(e,n={}){if(typeof window>"u")return Xt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Xt;let t=r,{split:s="words",stagger:i=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:T}=n,H=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof l=="function"?l:ce[l]??ce["ease-out"],re=be(m.start??"top 85%"),Ce=be(m.end??"top 40%"),G=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ue;s==="chars"?ue=$r(t):s==="lines"?ue=Yt(t):ue=Kt(t);let ne=ue.length;function Y(p,I){u?.opacity!==void 0&&(p.style.opacity=String(u.opacity+(1-u.opacity)*I));let q=Cr(I,u);q&&(p.style.transform=q);}function N(p){t.style.setProperty("--scroll-draw-progress",String(p)),ue.forEach((I,q)=>{let Me=A(Pr(p,q,ne,i));Y(I,Me);});}if(H)return N(1),T?.(),{destroy(){t.innerHTML=G,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};N(0);let C=0,O=0,w=0,k=false,x=false,M=-1,E=0,oe=false,L=()=>window.scrollY,se=()=>window.innerHeight;function ve(){let p=t.getBoundingClientRect(),I=Pe({top:p.top,height:p.height},L(),se(),re,Ce);C=I.tStart,O=I.tEnd;}function ge(){if(!k||x)return;let p=te(L(),C,O,1);d&&(M=Math.max(M,p),p=M),E=p,N(p),p>=1&&!oe?(oe=true,T?.()):p<1&&!d&&(oe=false),w=requestAnimationFrame(ge);}ve();let ye=new IntersectionObserver(p=>{p.forEach(I=>{k=I.isIntersecting,k&&!x?w=requestAnimationFrame(ge):cancelAnimationFrame(w);});}),R;function P(){clearTimeout(R),R=setTimeout(()=>{if(s==="lines"){let p=E;t.innerHTML=G,t.setAttribute("aria-label",t.textContent??""),ue=Yt(t),N(p);}ve();},150);}window.addEventListener("resize",P),window.addEventListener("orientationchange",P);let f=De([t],P);return ye.observe(t),Oe(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:O})}),{destroy(){cancelAnimationFrame(w),ye.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),f(),clearTimeout(R),t.innerHTML=G,t.removeAttribute("aria-label"),Ie(t);},replay(){M=-1,oe=false,E=0,x=false,N(0);},pause(){x=true,cancelAnimationFrame(w);},resume(){x&&(x=false,k&&(w=requestAnimationFrame(ge)));},seek(p){let I=Math.min(1,Math.max(0,p));E=I,M=I,x=true,cancelAnimationFrame(w),N(I);},getProgress(){return E}}}var qe=class{constructor(n){this.create=n;this.instance=null;this.el=null;this.key="";}init(n,r){return this.destroy(),this.el=n,this.latest=r,this.key=pt(r),this.instance=this.create(n,Vt(r,()=>this.latest)),this}update(n){return this.el?pt(n)!==this.key?this.init(this.el,n):(this.latest=n,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(n){return this.instance?.seek(n),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},Zt=class extends qe{constructor(){super(Rt);}init(n,r={}){return super.init(n,r)}},Jt=class extends qe{constructor(){super(Bt);}},er=class extends qe{constructor(){super(Gt);}},tr=class extends qe{constructor(){super(Ut);}init(n,r={}){return super.init(n,r)}},rr=class extends qe{constructor(){super(Qt);}init(n,r={}){return super.init(n,r)}};exports.EngineRef=qe;exports.ScrollAnimateRef=Jt;exports.ScrollCounterRef=er;exports.ScrollDrawRef=Zt;exports.ScrollTextRef=rr;exports.ScrollVideoRef=tr;
|
|
1
|
+
'use strict';function mr({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),s=Math.sqrt(t),i=0,l=[];for(let p=0;p<r;p++){let S=Math.pow(s,p);l.push(S),i+=S;}let u=[0],f=0;for(let p=0;p<r;p++)f+=l[p]/i,u.push(f);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let S=0;S<r;S++)if(p<=u[S+1]){let N=(p-u[S])/(u[S+1]-u[S]);if(S===0)return N*(2-N);let P=1-Math.pow(t,S);return P+(1-P)*(2*N-1)*(2*N-1)}return 1}}function fr({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),s=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/t)+1}var le={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:mr(),elastic:fr()};function Lt(e,n,r){return Math.min(r,Math.max(n,e))}function he(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 At(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 $t(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 ne(e,n,r,t){return r===n?0:Lt((e-n)/(r-n)*t,0,1)}function Pe(e,n,r,t,s){let i=At(e.top,e.height,n,t.element)-$t(t.viewport,r),l=At(e.top,e.height,n,s.element)-$t(s.viewport,r);return {tStart:i,tEnd:l}}function ot(e,n,r){let t=e.getBoundingClientRect(),s=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:s,scroll:0}:{top:r==="x"?t.left:t.top,height:s,scroll:r==="x"?window.scrollX:window.scrollY}}function je(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 Pt(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 Ue(e,n,r){let t=Pt(e),s=Pt(n);return !t||!s?e:`rgb(${Math.round(t[0]+(s[0]-t[0])*r)},${Math.round(t[1]+(s[1]-t[1])*r)},${Math.round(t[2]+(s[2]-t[2])*r)})`}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 Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function be(e,...n){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var pr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",dr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",kt=33;function gr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function yr(e){let n=[];for(let r=0;r<kt;r++){let t=r/(kt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function st(e){switch(e){case "linear":return "linear";case "ease-in":return pr;case "ease-out":return dr;case "ease-in-out":return gr()?yr(le["ease-in-out"]):null;default:return null}}var Ot=Symbol.for("svg-scroll-draw.registry");function It(){let e=globalThis;return e[Ot]||(e[Ot]=new Map)}function Oe(e,n){It().set(e,n);}function Ie(e){It().delete(e);}var Qe,it=new Set,at=new WeakMap,Ze=new Map,Ft=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function hr(e){let n=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let t=r;t;t=t.previousElementSibling)n.add(t);return n}function De(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let r=()=>n();Qe??(Qe=new ResizeObserver(s=>{let i=false;for(let{target:l}of s)at.get(l)!==Ft(l)&&(i=true),at.set(l,"");i&&it.forEach(l=>l());})),it.add(r);let t=hr(e);return [document.body,document.documentElement].forEach(s=>s&&t.add(s)),t.forEach(s=>{at.has(s)||at.set(s,Ft(s)),Ze.set(s,(Ze.get(s)??0)+1),Qe.observe(s);}),()=>{it.delete(r)&&(t.forEach(s=>{let i=(Ze.get(s)??1)-1;if(i)return void Ze.set(s,i);Ze.delete(s),Qe?.unobserve(s);}),it.size||(Qe?.disconnect(),Qe=void 0));}}var br=0;function wr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Dt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Ht=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function vr(e){if(!Ke)return;let n=Dt(e,"stroke");if(!n||n==="none"){be("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Ht.has(r)&&!Ht.has(Dt(e,"fill"))&&be("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Er(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 s(){let i=r==="x"?window.scrollX:window.scrollY,l=e-i,u=n-i,f=r==="x";t.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${f?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}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;${f?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",s,{passive:true}),s(),{el:t,destroy(){window.removeEventListener("scroll",s),t.remove();}}}var Nt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Rt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Sr(e,n,r){if(!Ke)return;let t=(e.match(Rt)??[]).join("").toUpperCase(),s=(n.match(Rt)??[]).join("").toUpperCase(),i=(e.match(Nt)??[]).length,l=(n.match(Nt)??[]).length;if(t!==s){be(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==l&&be(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function dt(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),u=t[s++]??l;return String(+(l+(u-l)*r).toFixed(4))})}function zt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,s=r?{...Ct[r],...t}:t,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:f=false,easing:p="linear",trigger:S={},stagger:N=0,direction:P="forward",once:oe=false,debug:Ce=false,axis:G="y",scrollContainer:Le,autoReverse:R=false,delay:Y=0,strokeColor:X,strokeWidth:A,fillOpacity:I,waypoints:T,velocityScale:$=false,threshold:C=0,rootMargin:x="0px",repeat:w=0,repeatDelay:K=0,morphTo:M,clip:te,autoplay:xe=false,duration:we=1e3,native:ce=true,onProgress:q,onStart:F,onComplete:m,onEnter:O,onLeave:v,onEnterBack:L,onLeaveBack:ue}=s,y=te===true?"left":typeof te=="string"?te:false,z=typeof p=="function"?p:le[p]??le.linear,me=he(S.start??"top bottom"),He=he(S.end??"bottom top"),ve=typeof Le=="string"?document.querySelector(Le):Le??null,Me=Array.isArray(X)?X[0]:null,fe=Array.isArray(X)?X[1]:typeof X=="string"?X:null,Q=Array.isArray(A)?A[0]:null,se=Array.isArray(A)?A[1]:typeof A=="number"?A:null,ie=Array.isArray(I)?I[0]:null,Z=Array.isArray(I)?I[1]:typeof I=="number"?I:null;function Ne(o){let a=o*100;switch(y){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=y?[]:Array.from(e.querySelectorAll(l)),D=[],pe=[],re=0,Ee=0,c=N,h=0,_=false,B=false,k=0,de=false,ye=-1,Re=[],ae=-1,j=false,Se=0,ze=0,Ve,lt=null;function ht(){lt?.destroy(),lt=null;}let _e=new Set,bt=NaN,We=true,Je=-1,wt=performance.now(),Be=NaN;function Ye(){return ve?G==="x"?ve.scrollLeft:ve.scrollTop:G==="x"?window.scrollX:window.scrollY}function vt(){return ve?G==="x"?ve.clientWidth:ve.clientHeight:G==="x"?window.innerWidth:window.innerHeight}function Et(){let o=ot(e,ve,G);return Pe(o,o.scroll,vt(),me,He)}function sr(){let o=Ee-re,a=V.length-1,g=ve??document.documentElement,J=G==="x"?"Width":"Height";if(c=N,N>0&&a>0&&o>0){let Ae=g[`scroll${J}`]-g[`client${J}`]-1-re-o/u;Ae>=0&&(c=Math.min(N,Ae/(a*o)));}h=Ee+a*c*o;}function St(){(({tStart:re,tEnd:Ee}=Et())),sr(),Ce&&Ke&&(ht(),lt=Er(re,Ee,G));}function ct(o,a=Et){Oe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let g=o.destroy;return o.destroy=()=>{g.call(o),Ie(e);},o}function ir(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),y){let g=a==="reverse"?1-o:o;e.style.clipPath=Ne(g);return}V.forEach((g,J)=>{g.style.strokeDashoffset=a==="reverse"?`${D[J]*o}`:`${D[J]*(1-o)}`,f&&(g.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Me&&fe?g.style.stroke=Ue(Me,fe,o):fe&&(g.style.stroke=fe),Q!==null&&se!==null?g.style.strokeWidth=`${Q+(se-Q)*o}`:se!==null&&(g.style.strokeWidth=`${se}`),ie!==null&&Z!==null?g.style.fillOpacity=`${ie+(Z-ie)*o}`:Z!==null&&(g.style.fillOpacity=`${Z}`),M&&g.tagName.toLowerCase()==="path"&&pe[J]&&g.setAttribute("d",dt(pe[J],M,o));});}function et(){if(e.style.setProperty("--scroll-draw-progress","0"),y){e.style.clipPath=Ne(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${D[a]}`,o.style.strokeDashoffset=P==="reverse"?"0":`${D[a]}`,f?o.style.opacity=P==="reverse"?"1":"0":o.style.opacity="",Me&&(o.style.stroke=Me),Q!==null&&(o.style.strokeWidth=`${Q}`),ie!==null&&(o.style.fillOpacity=`${ie}`),M&&o.tagName.toLowerCase()==="path"&&pe[a]&&o.setAttribute("d",pe[a]);});}if(V.forEach(o=>{vr(o);let a=je(o);D.push(a);let g=o.tagName.toLowerCase()==="path";g?pe.push(o.getAttribute("d")??""):pe.push(""),M&&(g?Sr(pe[pe.length-1],M,o):be(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),i?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=P==="reverse"?`${a}`:"0",f&&(o.style.opacity="1"),fe&&(o.style.stroke=fe),se!==null&&(o.style.strokeWidth=`${se}`),Z!==null&&(o.style.fillOpacity=`${Z}`),M&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",M)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=P==="reverse"?"0":`${a}`,f?o.style.opacity=P==="reverse"?"1":"0":o.style.opacity="",Me&&(o.style.stroke=Me),Q!==null&&(o.style.strokeWidth=`${Q}`),ie!==null&&(o.style.fillOpacity=`${ie}`));}),y){if(i)return e.style.clipPath=Ne(1),m?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ne(0);}else if(i)return m?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Tt=typeof p=="string"?st(p):null;function ar(){return !(ce===false||!wr()||!V.length||!Tt||y||G!=="y"||ve||u!==1||N!==0||oe||R||$!==false||M||T||w||Y>0||q||F||m||O||v||L||ue||X!=null||A!=null||I!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function lr(){let o=++br,a=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,Ae=P==="reverse"?"0":"var(--ssd-len)",Fe=P==="reverse"?"var(--ssd-len)":"0",ke=`stroke-dashoffset:${Ae};`,E=`stroke-dashoffset:${Fe};`;f&&(ke+=`opacity:${P==="reverse"?1:0};`,E+=`opacity:${P==="reverse"?0:1};`);let H=document.createElement("style");H.setAttribute("data-svg-scroll-draw",""),H.textContent=`@keyframes ${a}{from{${ke}}to{${E}}}.${g}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Tt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(g);function ge(d,ee){d.style.setProperty("--ssd-len",String(D[ee])),d.style.strokeDasharray=`${D[ee]}`,d.style.strokeDashoffset="",d.style.opacity="",d.style.animationPlayState="",d.classList.add(a);}V.forEach(ge);let b=false,W=-1;function U(){if(W>=0)return W;let d=e.getBoundingClientRect(),{tStart:ee,tEnd:$e}=Pe({top:d.top,height:d.height},Ye(),vt(),me,He);return z(ne(Ye(),ee,$e,u))}return {destroy(){e.classList.remove(g),V.forEach(d=>{d.classList.remove(a),d.style.removeProperty("--ssd-len"),d.style.animationPlayState="";}),H.remove();},replay(){b=false,W=-1,V.forEach(ge);},pause(){b=true,V.forEach(d=>{d.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(d=>{d.style.animationPlayState="running";}));},seek(d){let ee=Math.min(1,Math.max(0,d));W=ee,b=true,V.forEach(($e,Te)=>{$e.classList.remove(a),$e.style.strokeDashoffset=P==="reverse"?`${D[Te]*ee}`:`${D[Te]*(1-ee)}`,f&&($e.style.opacity=P==="reverse"?`${1-ee}`:`${ee}`);});},getProgress(){return U()},refresh(){V.forEach((d,ee)=>{D[ee]=je(d),d.style.setProperty("--ssd-len",String(D[ee])),d.style.strokeDasharray=`${D[ee]}`;});}}}if(ar())return ct(lr());function cr(){let o=Math.max(1,we),a=0,g=0,J=false;function Ae(b){let W=true;if(y){let U=Math.min(1,Math.max(0,b/o)),d=z(U);Se=d,e.style.setProperty("--scroll-draw-progress",String(d)),e.style.clipPath=Ne(P==="reverse"?1-d:d),q?.(d),U<1&&(W=false);}else V.forEach((U,d)=>{let ee=d*N*o,$e=Math.min(1,Math.max(0,(b-ee)/o)),Te=z($e);U.style.strokeDashoffset=P==="reverse"?`${D[d]*Te}`:`${D[d]*(1-Te)}`,f&&(U.style.opacity=P==="reverse"?`${1-Te}`:`${Te}`),Me&&fe?U.style.stroke=Ue(Me,fe,Te):fe&&(U.style.stroke=fe),Q!==null&&se!==null?U.style.strokeWidth=`${Q+(se-Q)*Te}`:se!==null&&(U.style.strokeWidth=`${se}`),ie!==null&&Z!==null?U.style.fillOpacity=`${ie+(Z-ie)*Te}`:Z!==null&&(U.style.fillOpacity=`${Z}`),M&&U.tagName.toLowerCase()==="path"&&pe[d]&&U.setAttribute("d",dt(pe[d],M,Te)),d===0&&(Se=Te,q?.(Te),e.style.setProperty("--scroll-draw-progress",String(Te))),$e<1&&(W=false);});if(T){let U=Math.min(1,Math.max(0,b/o)),d=z(U);for(let ee in T){let $e=parseFloat(ee);d>=$e&&!_e.has($e)&&(_e.add($e),T[ee]?.());}}return W}function Fe(b){if(j)return;let W=b-a;B||(B=true,F?.());let U=Ae(W);if(U&&!_){_=true,Ae(o*(1+Math.max(0,V.length-1)*N)),m?.(),ze<(w==="infinite"?1/0:w??0)&&(ze++,Ve=setTimeout(()=>{a=performance.now(),B=false,_=false,_e.clear(),et(),k=requestAnimationFrame(Fe);},K));return}U||(k=requestAnimationFrame(Fe));}function ke(){cancelAnimationFrame(k),clearTimeout(Ve),a=performance.now(),g=0,j=false,B=false,_=false,ze=0,J=true,Se=0,_e.clear(),et(),k=requestAnimationFrame(Fe);}let E=new IntersectionObserver(b=>{b.forEach(W=>{W.isIntersecting&&!(oe&&_)?ke():!W.isIntersecting&&!oe&&!_&&(cancelAnimationFrame(k),clearTimeout(Ve),J=false);});},{root:ve??null,threshold:C,rootMargin:x}),H;function ge(){clearTimeout(H),H=setTimeout(()=>{V.forEach((b,W)=>{D[W]=je(b),b.style.strokeDasharray=`${D[W]}`;});},150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),Y>0?setTimeout(()=>E.observe(e),Y):E.observe(e),{destroy(){cancelAnimationFrame(k),clearTimeout(Ve),E.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(H);},replay(){ze=0,ke();},pause(){j||!J||(j=true,g=performance.now()-a,cancelAnimationFrame(k));},resume(){j&&(j=false,J=true,a=performance.now()-g,k=requestAnimationFrame(Fe));},seek(b){let W=Math.min(1,Math.max(0,b));Se=W,j=true,g=W*o,a=performance.now()-g,cancelAnimationFrame(k),Ae(g);},getProgress(){return Se},refresh(){clearTimeout(H),V.forEach((b,W)=>{D[W]=je(b),b.style.strokeDasharray=`${D[W]}`;});}}}if(xe)return ct(cr());St();function xt(){if(j||!Ge)return;let o=performance.now(),a=Ye();if(!We&&$===false&&a===bt){mt(a);return}We=false,bt=a;let g=u;if($!==false){let E=o-wt,H=E>0?Math.abs(a-(Je<0?a:Je))/E:0;g=u*Math.max(.2,1+H*(typeof $=="number"?$:1)*.04);}Je=a,wt=o;let J=R?ae===-1||a>=ae?"forward":"reverse":P;ae=a;let Ae=Ee-re,Fe=true,ke=Ae===0?0:(a-re)/Ae;if(isNaN(Be)||(Be<=0&&ke>0?O?.():Be>0&&ke<=0&&ue?.(),Be<1&&ke>=1?v?.():Be>=1&&ke<1&&L?.()),Be=ke,y){let E=z(ne(a,re,Ee,g));oe&&!R&&(ye=Math.max(ye,E),E=ye),Se=E,e.style.setProperty("--scroll-draw-progress",String(E));let H=J==="reverse"?1-E:E;e.style.clipPath=Ne(H),q?.(E),!B&&ne(a,re,Ee,g)>0&&(B=true,F?.()),E>=1&&!_?(_=true,m?.(),ze<(w==="infinite"?1/0:w??0)&&(ze++,Ve=setTimeout(()=>{ye=-1,B=false,_=false,e.style.clipPath=Ne(0);},K))):E<1&&!oe&&(_=false),mt(a);return}if(V.forEach((E,H)=>{let ge=H*c*Ae,b=z(ne(a,re+ge,Ee+ge,g));oe&&!R&&(b=Re[H]=Math.max(Re[H]??ye,b)),E.style.strokeDashoffset=J==="reverse"?`${D[H]*b}`:`${D[H]*(1-b)}`,f&&(E.style.opacity=J==="reverse"?`${1-b}`:`${b}`),Me&&fe?E.style.stroke=Ue(Me,fe,b):fe&&(E.style.stroke=fe),Q!==null&&se!==null?E.style.strokeWidth=`${Q+(se-Q)*b}`:se!==null&&(E.style.strokeWidth=`${se}`),ie!==null&&Z!==null?E.style.fillOpacity=`${ie+(Z-ie)*b}`:Z!==null&&(E.style.fillOpacity=`${Z}`),M&&E.tagName.toLowerCase()==="path"&&pe[H]&&E.setAttribute("d",dt(pe[H],M,b)),H===0&&(Se=b,q?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Fe=false);}),T){let E=z(ne(a,re,Ee,g));for(let H in T){let ge=parseFloat(H);E>=ge&&!_e.has(ge)&&(_e.add(ge),T[H]?.());}}!B&&ne(a,re,Ee,g)>0&&(B=true,F?.()),Fe&&!_?(_=true,m?.(),ze<(w==="infinite"?1/0:w??0)&&(ze++,Ve=setTimeout(()=>{ye=-1,Re=[],B=false,_=false,_e.clear(),et(),We=true;},K))):!Fe&&!oe&&(_=false),mt(a);}function ut(o){return o>=Ee&&o<h}function mt(o){de||ut(o)?k=requestAnimationFrame(xt):Ge=false;}function ft(){return de||ut(Ye())}let Ge=false;function tt(){Ge||(Ge=true,k=requestAnimationFrame(function(){xt();}));}function rt(){Ge=false,cancelAnimationFrame(k);}let pt=new IntersectionObserver(o=>{o.forEach(a=>{de=a.isIntersecting,de&&!j?(We=true,tt()):Ge&&!j&&ut(Ye())||rt();});},{root:ve??null,threshold:C,rootMargin:x});function Mt(){V.forEach((o,a)=>{D[a]=je(o),o.style.strokeDasharray=`${D[a]}`;}),St(),We=true;}let nt;function Xe(){clearTimeout(nt),nt=setTimeout(Mt,150);}window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe);let ur=De([e],Xe);return Y>0?setTimeout(()=>pt.observe(e),Y):pt.observe(e),ct({destroy(){cancelAnimationFrame(k),clearTimeout(Ve),rt(),pt.disconnect(),ur(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(nt),ht();},replay(){ye=-1,Re=[],ae=-1,Je=-1,B=false,_=false,ze=0,j=false,Se=0,_e.clear(),clearTimeout(Ve),et(),We=true,ft()&&tt();},pause(){j=true,rt();},resume(){j&&(j=false,We=true,ft()&&tt());},seek(o){let a=Math.min(1,Math.max(0,o));Se=a,ye=a,Re=[],j=true,rt(),ir(a,P),We=true;},getProgress(){return Se},refresh(){clearTimeout(nt),Mt(),ft()&&!j&&tt();}},()=>({tStart:re,tEnd:Ee}))}var Vt=new WeakMap,Tr=0;function gt(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Vt.get(r);return t===void 0&&Vt.set(r,t=++Tr),`el#${t}`}return r})}function _t(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...s)=>n()[t]?.(...s));return r}function xr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Wt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let s=[],i=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let f=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}n.push({fn:t[1],nums:s,units:i});}return n}function Mr(e,n,r){let t=Wt(e),s=Wt(n);return t.length===0||t.length!==s.length?r<1?e:n:t.map((i,l)=>{let u=s[l];return i.fn!==u.fn||i.nums.length!==u.nums.length?r<1?`${i.fn}(${i.nums.map((f,p)=>`${f}${i.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((f,p)=>`${f}${u.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,p)=>`${f+(u.nums[p]-f)*r}${i.units[p]}`).join(", ")})`}).join(" ")}function qt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),s=String(n);if(xr(t))return Ue(t,s,r);if(t.includes("("))return Mr(t,s,r);let i=t.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let u=parseFloat(i[1]),f=parseFloat(l[1]);return `${u+(f-u)*r}${i[2]||l[2]}`}return r<1?t:s}function Lr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Ar=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),$r=0,Bt="--scroll-draw-progress";function Pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Gt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:s={},easing:i="ease-out",speed:l=1,once:u=false,axis:f="y",scrollContainer:p,native:S=true,velocityScale:N=false,respectReducedMotion:P=true,triggerElement:oe,onProgress:Ce,onComplete:G,onEnter:Le,onLeave:R,onEnterBack:Y,onLeaveBack:X}=n,A=P&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,I=typeof i=="function"?i:le[i]??le["ease-out"],T=he(s.start??"top bottom"),$=he(s.end??"bottom top"),C=oe??e,x=typeof p=="string"?document.querySelector(p):p??null,w=Object.entries(t).map(([c,h])=>({prop:Lr(c),from:Array.isArray(h)?h[0]:"",to:Array.isArray(h)?h[1]:h}));function K(){let c=window.getComputedStyle(e);for(let h of w)h.from===""&&(h.from=c.getPropertyValue(h.prop).trim()||"0");}function M(){for(let c of w)e.style.setProperty(c.prop,String(c.to));}let te=new Map;for(let c of [...w.map(h=>h.prop),Bt])te.set(c,e.style.getPropertyValue(c));function xe(){for(let[c,h]of te)h?e.style.setProperty(c,h):e.style.removeProperty(c);}if(A)return M(),G?.(),{...r,destroy:xe,getProgress:()=>1};K();let we=typeof i=="string"?st(i):null;function ce(){if(!S||!Pr()||!we||f!=="y"||x||C!==e||u||l!==1||Ce||G||Le||R||Y||X||N!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let c of w)if(!Ar.has(c.prop))return false;return true}function q(){let c=`ssd-a-${++$r}`,h=w.map(ae=>`${ae.prop}:${ae.from}`).join(";"),_=w.map(ae=>`${ae.prop}:${ae.to}`).join(";"),B=document.createElement("style");B.setAttribute("data-ssd-animate",""),B.textContent=`@keyframes ${c}{from{${h}}to{${_}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${we};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(B),e.classList.add(c);let k=()=>f==="x"?window.scrollX:window.scrollY,de=()=>f==="x"?window.innerWidth:window.innerHeight,ye=()=>{let ae=e.getBoundingClientRect();return Pe({top:ae.top,height:ae.height},k(),de(),T,$)};Oe(e,{type:"animate",getProgress:()=>Re.getProgress(),getTrigger:ye});let Re={refresh(){},destroy(){e.classList.remove(c),B.remove(),e.style.animationPlayState="",xe(),Ie(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(ae){let j=Math.min(1,Math.max(0,ae));e.classList.remove(c);for(let Se of w)e.style.setProperty(Se.prop,qt(Se.from,Se.to,j));},getProgress(){let{tStart:ae,tEnd:j}=ye();return I(ne(k(),ae,j,l))}};return Re}if(ce())return q();let F=0,m=0,O=0,v=false,L=false,ue=-1,y=0,z=false,me=NaN,He=-1,ve=0,Me=()=>x?f==="x"?x.scrollLeft:x.scrollTop:f==="x"?window.scrollX:window.scrollY,fe=()=>x?f==="x"?x.clientWidth:x.clientHeight:f==="x"?window.innerWidth:window.innerHeight,Q=C===e?w:[],se=false;function ie(){let c=e.style,h=Q.map(de=>c.getPropertyValue(de.prop)),_=c.transition;Q.length&&(c.transition="none"),Q.forEach(de=>c.setProperty(de.prop,te.get(de.prop)??""));let B=ot(C,x,f);Q.forEach((de,ye)=>c.setProperty(de.prop,h[ye])),Q.length&&(e.offsetWidth,c.transition=_);let k=Pe(B,B.scroll,fe(),T,$);se&&Math.abs(k.tStart-F)<1&&Math.abs(k.tEnd-m)<1||(se=true,F=k.tStart,m=k.tEnd);}function Z(c){e.style.setProperty(Bt,String(c));for(let h of w)e.style.setProperty(h.prop,qt(h.from,h.to,c));Ce?.(c);}function Ne(c){if(isNaN(me)){me=c;return}me<=0&&c>0?Le?.():me>0&&c<=0&&X?.(),me<1&&c>=1?R?.():me>=1&&c<1&&Y?.(),me=c;}function V(){if(!v||L)return;let c=performance.now(),h=Me(),_=l;if(N!==false){let de=c-ve,ye=de>0?Math.abs(h-(He<0?h:He))/de:0;_=l*Math.max(.2,1+ye*(typeof N=="number"?N:1)*.04);}He=h,ve=c;let B=m===F?0:(h-F)/(m-F);Ne(B);let k=I(ne(h,F,m,_));u&&(ue=Math.max(ue,k),k=ue),y=k,Z(k),k>=1&&!z?(z=true,G?.()):k<1&&!u&&(z=false),O=requestAnimationFrame(V);}ie(),m===F&&be("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let c=I(ne(Me(),F,m,l));u&&c>0&&(ue=c),y=c,Z(c);}let D=new IntersectionObserver(c=>{c.forEach(h=>{v=h.isIntersecting,v&&!L?O=requestAnimationFrame(V):cancelAnimationFrame(O);});},{root:x??null}),pe;function re(){clearTimeout(pe),pe=setTimeout(ie,150);}window.addEventListener("resize",re),window.addEventListener("orientationchange",re);let Ee=De([C],re);return D.observe(e),Oe(e,{type:"animate",getProgress:()=>y,getTrigger:()=>({tStart:F,tEnd:m})}),{destroy(){cancelAnimationFrame(O),D.disconnect(),window.removeEventListener("resize",re),window.removeEventListener("orientationchange",re),Ee(),clearTimeout(pe),xe(),Ie(e);},replay(){ue=-1,z=false,y=0,L=false,Z(0);},pause(){L=true,cancelAnimationFrame(O);},resume(){L&&(L=false,v&&(O=requestAnimationFrame(V)));},seek(c){let h=Math.min(1,Math.max(0,c));y=h,ue=h,L=true,cancelAnimationFrame(O),Z(h);},getProgress(){return y},refresh(){ie();}}}var yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function jt(e,n){if(typeof window>"u")return yt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return be("scrollCounter: element not found:",e),yt;let t=r,{from:s=0,to:i,format:l,easing:u="ease-out",trigger:f={},once:p=true,decimals:S,onComplete:N}=n,P=S!==void 0?m=>m.toFixed(S):l??(m=>String(Math.round(m))),oe=typeof u=="function"?u:le[u]??le["ease-out"],Ce=he(f.start??"top 80%"),G=he(f.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=P(i),N?.(),yt;let R=0,Y=0,X=false,A=0,I=false,T=false,$=-1,C=0,x=false,w=()=>window.scrollY,K=()=>window.innerHeight;function M(){let m=t.getBoundingClientRect(),O=Pe({top:m.top,height:m.height},w(),K(),Ce,G);X&&Math.abs(O.tStart-R)<1&&Math.abs(O.tEnd-Y)<1||(X=true,R=O.tStart,Y=O.tEnd);}function te(m){t.textContent=P(s+(i-s)*m),t.style.setProperty("--scroll-draw-progress",String(m));}function xe(){if(!I||T)return;let m=oe(ne(w(),R,Y,1));p&&($=Math.max($,m),m=$),C=m,te(m),m>=1&&!x?(x=true,N?.()):m<1&&!p&&(x=false),A=requestAnimationFrame(xe);}M();{let m=oe(ne(w(),R,Y,1));p&&m>0&&($=m),C=m,te(m);}let we=new IntersectionObserver(m=>{m.forEach(O=>{I=O.isIntersecting,I&&!T?A=requestAnimationFrame(xe):cancelAnimationFrame(A);});}),ce;function q(){clearTimeout(ce),ce=setTimeout(M,150);}window.addEventListener("resize",q),window.addEventListener("orientationchange",q);let F=De([t],q);return we.observe(t),Oe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:R,tEnd:Y})}),{destroy(){cancelAnimationFrame(A),we.disconnect(),window.removeEventListener("resize",q),window.removeEventListener("orientationchange",q),F(),clearTimeout(ce),Ie(t);},replay(){$=-1,x=false,C=0,T=false,te(0);},pause(){T=true,cancelAnimationFrame(A);},resume(){T&&(T=false,I&&(A=requestAnimationFrame(xe)));},seek(m){let O=Math.min(1,Math.max(0,m));C=O,$=O,T=true,cancelAnimationFrame(A),te(O);},getProgress(){return C}}}var Ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Yt(e,n={}){if(typeof window>"u")return Ut;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return be("scrollVideo: <video> element not found:",e),Ut;let t=r,{trigger:s={},easing:i="linear",once:l=false,axis:u="y",preload:f="auto",triggerElement:p,onReady:S,onComplete:N,onProgress:P}=n,oe=p??t,Ce=window.matchMedia("(prefers-reduced-motion: reduce)").matches,G=typeof i=="function"?i:le[i]??le.linear,Le=he(s.start??"top top"),R=he(s.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=f);let Y=n.from??0,X=n.to,A=0,I=0,T=0,$=false,C=false,x=-1,w=0,K=false,M=false,te=()=>u==="x"?window.scrollX:window.scrollY,xe=()=>u==="x"?window.innerWidth:window.innerHeight;function we(){let y=oe.getBoundingClientRect(),z=u==="x"?y.left:y.top,me=u==="x"?y.width:y.height,He=Pe({top:z,height:me},te(),xe(),Le,R);A=He.tStart,I=He.tEnd,M&&I===A&&be("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let ce=NaN;function q(y){if(!M)return;let z=X??t.duration??0,me=Y+(z-Y)*y;me!==ce&&(ce=me,t.currentTime=me),t.style.setProperty("--scroll-draw-progress",String(y)),P?.(y);}function F(){if(!$||C||!M||Ce)return;let y=G(ne(te(),A,I,1));l&&(x=Math.max(x,y),y=x),w=y,q(y),y>=1&&!K?(K=true,N?.()):y<1&&!l&&(K=false),T=requestAnimationFrame(F);}function m(){if(M=true,X===void 0&&(X=t.duration),Ce){q(1),S?.();return}we(),S?.(),$&&!C&&(T=requestAnimationFrame(F));}t.readyState>=1?m():t.addEventListener("loadedmetadata",m,{once:true}),M||we();let O=new IntersectionObserver(y=>{y.forEach(z=>{$=z.isIntersecting,$&&!C&&M?T=requestAnimationFrame(F):cancelAnimationFrame(T);});}),v;function L(){clearTimeout(v),v=setTimeout(we,150);}window.addEventListener("resize",L),window.addEventListener("orientationchange",L);let ue=De([oe],L);return O.observe(t),Oe(t,{type:"video",getProgress:()=>w,getTrigger:()=>({tStart:A,tEnd:I})}),{destroy(){cancelAnimationFrame(T),O.disconnect(),t.removeEventListener("loadedmetadata",m),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),ue(),clearTimeout(v),Ie(t);},replay(){x=-1,K=false,w=0,C=false,ce=NaN,q(0);},pause(){C=true,cancelAnimationFrame(T);},resume(){C&&(C=false,$&&M&&(T=requestAnimationFrame(F)));},seek(y){let z=Math.min(1,Math.max(0,y));w=z,x=z,C=true,cancelAnimationFrame(T),ce=NaN,q(z);},getProgress(){return w}}}function Xt(e,n){let r=document.createElement("span");r.textContent=n,r.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(r);}function Zt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function Cr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Kt(e){let n=Zt(e),r=new Map;for(let i of n){let l=i.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(i);}let t=[],s=Array.from(r.keys()).sort((i,l)=>i-l);for(let i of s){let l=r.get(i),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((f,p)=>{let S=f.nextElementSibling;u.appendChild(f),p<l.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((i,l)=>{e.appendChild(i),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function kr(e,n,r,t){if(r<=1||t===0)return e;let s=(r-1)*t,i=n*t,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function Or(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Qt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Jt(e,n={}){if(typeof window>"u")return Qt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return be("scrollText: element not found:",e),Qt;let t=r,{split:s="words",stagger:i=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:f={},once:p=true,onComplete:S}=n,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,P=typeof l=="function"?l:le[l]??le["ease-out"],oe=he(f.start??"top 85%"),Ce=he(f.end??"top 40%"),G=t.innerHTML,Le=t.textContent??"",R;s==="chars"?R=Cr(t):s==="lines"?R=Kt(t):R=Zt(t),Xt(t,Le);let Y=R.length;function X(v,L){u?.opacity!==void 0&&(v.style.opacity=String(u.opacity+(1-u.opacity)*L));let ue=Or(L,u);ue&&(v.style.transform=ue);}function A(v){t.style.setProperty("--scroll-draw-progress",String(v)),R.forEach((L,ue)=>{let y=P(kr(v,ue,Y,i));X(L,y);});}if(N)return A(1),S?.(),{destroy(){t.innerHTML=G;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let I=0,T=0,$=0,C=false,x=false,w=-1,K=0,M=false,te=()=>window.scrollY,xe=()=>window.innerHeight;function we(){let v=t.getBoundingClientRect(),L=Pe({top:v.top,height:v.height},te(),xe(),oe,Ce);I=L.tStart,T=L.tEnd;}function ce(){if(!C||x)return;let v=ne(te(),I,T,1);p&&(w=Math.max(w,v),v=w),K=v,A(v),v>=1&&!M?(M=true,S?.()):v<1&&!p&&(M=false),$=requestAnimationFrame(ce);}we();let q=new IntersectionObserver(v=>{v.forEach(L=>{C=L.isIntersecting,C&&!x?$=requestAnimationFrame(ce):cancelAnimationFrame($);});}),F;function m(){clearTimeout(F),F=setTimeout(()=>{if(s==="lines"){let v=K;t.innerHTML=G,R=Kt(t),Xt(t,Le),A(v);}we();},150);}window.addEventListener("resize",m),window.addEventListener("orientationchange",m);let O=De([t],m);return q.observe(t),Oe(t,{type:"text",getProgress:()=>K,getTrigger:()=>({tStart:I,tEnd:T})}),{destroy(){cancelAnimationFrame($),q.disconnect(),window.removeEventListener("resize",m),window.removeEventListener("orientationchange",m),O(),clearTimeout(F),t.innerHTML=G,Ie(t);},replay(){w=-1,M=false,K=0,x=false,A(0);},pause(){x=true,cancelAnimationFrame($);},resume(){x&&(x=false,C&&($=requestAnimationFrame(ce)));},seek(v){let L=Math.min(1,Math.max(0,v));K=L,w=L,x=true,cancelAnimationFrame($),A(L);},getProgress(){return K}}}var qe=class{constructor(n){this.create=n;this.instance=null;this.el=null;this.key="";}init(n,r){return this.destroy(),this.el=n,this.latest=r,this.key=gt(r),this.instance=this.create(n,_t(r,()=>this.latest)),this}update(n){return this.el?gt(n)!==this.key?this.init(this.el,n):(this.latest=n,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(n){return this.instance?.seek(n),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},er=class extends qe{constructor(){super(zt);}init(n,r={}){return super.init(n,r)}},tr=class extends qe{constructor(){super(Gt);}},rr=class extends qe{constructor(){super(jt);}},nr=class extends qe{constructor(){super(Yt);}init(n,r={}){return super.init(n,r)}},or=class extends qe{constructor(){super(Jt);}init(n,r={}){return super.init(n,r)}};exports.EngineRef=qe;exports.ScrollAnimateRef=tr;exports.ScrollCounterRef=rr;exports.ScrollDrawRef=er;exports.ScrollTextRef=or;exports.ScrollVideoRef=nr;
|
package/dist/angular/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-7SBTYJGH.mjs';import {a as a$4}from'../chunk-
|
|
1
|
+
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-7SBTYJGH.mjs';import {a as a$4}from'../chunk-426RAN5I.mjs';import {a as a$2}from'../chunk-KHQ7OGQK.mjs';import {a as a$1}from'../chunk-BFX2CSQ3.mjs';import {b as b$1}from'../chunk-ENACACPZ.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';var r=class{constructor(t){this.create=t;this.instance=null;this.el=null;this.key="";}init(t,e){return this.destroy(),this.el=t,this.latest=e,this.key=a(e),this.instance=this.create(t,b(e,()=>this.latest)),this}update(t){return this.el?a(t)!==this.key?this.init(this.el,t):(this.latest=t,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},u=class extends r{constructor(){super(b$1);}init(t,e={}){return super.init(t,e)}},h=class extends r{constructor(){super(a$1);}},m=class extends r{constructor(){super(a$2);}},O=class extends r{constructor(){super(a$3);}init(t,e={}){return super.init(t,e)}},d=class extends r{constructor(){super(a$4);}init(t,e={}){return super.init(t,e)}};export{r as EngineRef,h as ScrollAnimateRef,m as ScrollCounterRef,u as ScrollDrawRef,d as ScrollTextRef,O as ScrollVideoRef};
|
package/dist/astro/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function sr({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(t),i=0,l=[];for(let p=0;p<n;p++){let w=Math.pow(s,p);l.push(w),i+=w;}let m=[0],c=0;for(let p=0;p<n;p++)c+=l[p]/i,m.push(c);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let w=0;w<n;w++)if(p<=m[w+1]){let D=(p-m[w])/(m[w+1]-m[w]);if(w===0)return D*(2-D);let T=1-Math.pow(t,w);return T+(1-T)*(2*D-1)*(2*D-1)}return 1}}function ir({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),s=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return i=>i<=0?0:i>=1?1:n*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/t)+1}var be={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:sr(),elastic:ir()};function Ct(e,r,n){return Math.min(n,Math.max(r,e))}function Te(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Pt(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Dt(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 ae(e,r,n,t){return n===r?0:Ct((e-r)/(n-r)*t,0,1)}function De(e,r,n,t,s){let i=Pt(e.top,e.height,r,t.element)-Dt(t.viewport,n),l=Pt(e.top,e.height,r,s.element)-Dt(s.viewport,n);return {tStart:i,tEnd:l}}function ot(e,r,n){let t=e.getBoundingClientRect(),s=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:s,scroll:0}:{top:n==="x"?t.left:t.top,height:s,scroll:n==="x"?window.scrollX:window.scrollY}}function Ge(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function kt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function je(e,r,n){let t=kt(e),s=kt(r);return !t||!s?e:`rgb(${Math.round(t[0]+(s[0]-t[0])*n)},${Math.round(t[1]+(s[1]-t[1])*n)},${Math.round(t[2]+(s[2]-t[2])*n)})`}var It={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Xe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ee(e,...r){Xe&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var ar="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",lr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Ot=33;function cr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function ur(e){let r=[];for(let n=0;n<Ot;n++){let t=n/(Ot-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function st(e){switch(e){case "linear":return "linear";case "ease-in":return ar;case "ease-out":return lr;case "ease-in-out":return cr()?ur(be["ease-in-out"]):null;default:return null}}var Rt=Symbol.for("svg-scroll-draw.registry");function Ft(){let e=globalThis;return e[Rt]||(e[Rt]=new Map)}function Re(e,r){Ft().set(e,r);}function Fe(e){Ft().delete(e);}var Je,it=new Set,at=new WeakMap,Qe=new Map,Ht=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function mr(e){let r=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let t=n;t;t=t.previousElementSibling)r.add(t);return r}function Ve(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>r();Je??(Je=new ResizeObserver(s=>{let i=false;for(let{target:l}of s)at.get(l)!==Ht(l)&&(i=true),at.set(l,"");i&&it.forEach(l=>l());})),it.add(n);let t=mr(e);return [document.body,document.documentElement].forEach(s=>s&&t.add(s)),t.forEach(s=>{at.has(s)||at.set(s,Ht(s)),Qe.set(s,(Qe.get(s)??0)+1),Je.observe(s);}),()=>{it.delete(n)&&(t.forEach(s=>{let i=(Qe.get(s)??1)-1;if(i)return void Qe.set(s,i);Qe.delete(s),Je?.unobserve(s);}),it.size||(Je?.disconnect(),Je=void 0));}}var fr=0;function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Nt(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 dr(e){if(!Xe)return;let r=Nt(e,"stroke");if(!r||r==="none"){ee("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!_t.has(n)&&!_t.has(Nt(e,"fill"))&&ee("Element has a fill \u2014 it may obscure the stroke animation.",e);}function gr(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=n==="x"?window.scrollX:window.scrollY,l=e-i,m=r-i,c=n==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",s,{passive:true}),s(),{el:t,destroy(){window.removeEventListener("scroll",s),t.remove();}}}var _t=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,zt=/[MmLlHhVvCcSsQqTtAaZz]/g;function dr(e,r,n){if(!Ye)return;let t=(e.match(zt)??[]).join("").toUpperCase(),s=(r.match(zt)??[]).join("").toUpperCase(),i=(e.match(_t)??[]).length,l=(r.match(_t)??[]).length;if(t!==s){ee(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}i!==l&&ee(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function gt(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),m=t[s++]??l;return String(+(l+(m-l)*n).toFixed(4))})}function lt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,s=n?{...kt[n],...t}:t,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:f="linear",trigger:v={},stagger:$=0,direction:T="forward",once:ue=false,debug:He=false,axis:U="y",scrollContainer:me,autoReverse:ie=false,delay:te=0,strokeColor:H,strokeWidth:O,fillOpacity:N,waypoints:x,velocityScale:_=false,threshold:C=0,rootMargin:L="0px",repeat:E=0,repeatDelay:we=0,morphTo:z,clip:fe,autoplay:ve=false,duration:Me=1e3,native:$e=true,onProgress:J,onStart:P,onComplete:p,onEnter:d,onLeave:R,onEnterBack:ae,onLeaveBack:Ae}=s,le=fe===true?"left":typeof fe=="string"?fe:false,Ee=typeof f=="function"?f:he[f]??he.linear,Ce=xe(v.start??"top bottom"),We=xe(v.end??"bottom top"),pe=typeof me=="string"?document.querySelector(me):me??null,be=Array.isArray(H)?H[0]:null,re=Array.isArray(H)?H[1]:typeof H=="string"?H:null,q=Array.isArray(O)?O[0]:null,Q=Array.isArray(O)?O[1]:typeof O=="number"?O:null,Z=Array.isArray(N)?N[0]:null,B=Array.isArray(N)?N[1]:typeof N=="number"?N:null;function ke(o){let a=o*100;switch(le){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 D=le?[]:Array.from(e.querySelectorAll(l)),M=[],ne=[],Y=0,de=0,u=$,h=0,k=false,F=false,S=0,X=false,ce=-1,Ie=[],K=-1,V=false,ge=0,Oe=0,Ne,mt=null;function bt(){mt?.destroy(),mt=null;}let _e=new Set,wt=NaN,ze=true,Ze=-1,vt=performance.now(),qe=NaN;function Ke(){return pe?U==="x"?pe.scrollLeft:pe.scrollTop:U==="x"?window.scrollX:window.scrollY}function Et(){return pe?U==="x"?pe.clientWidth:pe.clientHeight:U==="x"?window.innerWidth:window.innerHeight}function St(){let o=ot(e,pe,U);return De(o,o.scroll,Et(),Ce,We)}function Qt(){let o=de-Y,a=D.length-1,y=pe??document.documentElement,G=U==="x"?"Width":"Height";if(u=$,$>0&&a>0&&o>0){let Se=y[`scroll${G}`]-y[`client${G}`]-1-Y-o/m;Se>=0&&(u=Math.min($,Se/(a*o)));}h=de+a*u*o;}function Tt(){(({tStart:Y,tEnd:de}=St())),Qt(),He&&Ye&&(bt(),mt=pr(Y,de,U));}function ft(o,a=St){Re(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let y=o.destroy;return o.destroy=()=>{y.call(o),Fe(e);},o}function Zt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),le){let y=a==="reverse"?1-o:o;e.style.clipPath=ke(y);return}D.forEach((y,G)=>{y.style.strokeDashoffset=a==="reverse"?`${M[G]*o}`:`${M[G]*(1-o)}`,c&&(y.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&re?y.style.stroke=je(be,re,o):re&&(y.style.stroke=re),q!==null&&Q!==null?y.style.strokeWidth=`${q+(Q-q)*o}`:Q!==null&&(y.style.strokeWidth=`${Q}`),Z!==null&&B!==null?y.style.fillOpacity=`${Z+(B-Z)*o}`:B!==null&&(y.style.fillOpacity=`${B}`),z&&y.tagName.toLowerCase()==="path"&&ne[G]&&y.setAttribute("d",gt(ne[G],z,o));});}function et(){if(e.style.setProperty("--scroll-draw-progress","0"),le){e.style.clipPath=ke(0);return}D.forEach((o,a)=>{o.style.strokeDasharray=`${M[a]}`,o.style.strokeDashoffset=T==="reverse"?"0":`${M[a]}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),q!==null&&(o.style.strokeWidth=`${q}`),Z!==null&&(o.style.fillOpacity=`${Z}`),z&&o.tagName.toLowerCase()==="path"&&ne[a]&&o.setAttribute("d",ne[a]);});}if(D.forEach(o=>{fr(o);let a=Ge(o);M.push(a);let y=o.tagName.toLowerCase()==="path";y?ne.push(o.getAttribute("d")??""):ne.push(""),z&&(y?dr(ne[ne.length-1],z,o):ee(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),i?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),re&&(o.style.stroke=re),Q!==null&&(o.style.strokeWidth=`${Q}`),B!==null&&(o.style.fillOpacity=`${B}`),z&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",z)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?"0":`${a}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),q!==null&&(o.style.strokeWidth=`${q}`),Z!==null&&(o.style.fillOpacity=`${Z}`));}),le){if(i)return e.style.clipPath=ke(1),p?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(i)return p?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let xt=typeof f=="string"?st(f):null;function Kt(){return !($e===false||!mr()||!D.length||!xt||le||U!=="y"||pe||m!==1||$!==0||ue||ie||_!==false||z||x||E||te>0||J||P||p||d||R||ae||Ae||H!=null||O!=null||N!=null||(v.start??"top bottom").trim()!=="top bottom"||(v.end??"bottom top").trim()!=="bottom top")}function er(){let o=++ur,a=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,G=`--svg-scroll-draw-${o}`,Se=T==="reverse"?"0":"var(--ssd-len)",Pe=T==="reverse"?"var(--ssd-len)":"0",Le=`stroke-dashoffset:${Se};`,w=`stroke-dashoffset:${Pe};`;c&&(Le+=`opacity:${T==="reverse"?1:0};`,w+=`opacity:${T==="reverse"?0:1};`);let A=document.createElement("style");A.setAttribute("data-svg-scroll-draw",""),A.textContent=`@keyframes ${a}{from{${Le}}to{${w}}}.${y}{view-timeline-name:${G};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${xt};animation-fill-mode:both;animation-timeline:${G};animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(y);function oe(g,j){g.style.setProperty("--ssd-len",String(M[j])),g.style.strokeDasharray=`${M[j]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(a);}D.forEach(oe);let b=false,I=-1;function W(){if(I>=0)return I;let g=e.getBoundingClientRect(),{tStart:j,tEnd:Te}=De({top:g.top,height:g.height},Ke(),Et(),Ce,We);return Ee(se(Ke(),j,Te,m))}return {destroy(){e.classList.remove(y),D.forEach(g=>{g.classList.remove(a),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),A.remove();},replay(){b=false,I=-1,D.forEach(oe);},pause(){b=true,D.forEach(g=>{g.style.animationPlayState="paused";});},resume(){b&&(b=false,D.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let j=Math.min(1,Math.max(0,g));I=j,b=true,D.forEach((Te,ye)=>{Te.classList.remove(a),Te.style.strokeDashoffset=T==="reverse"?`${M[ye]*j}`:`${M[ye]*(1-j)}`,c&&(Te.style.opacity=T==="reverse"?`${1-j}`:`${j}`);});},getProgress(){return W()},refresh(){D.forEach((g,j)=>{M[j]=Ge(g),g.style.setProperty("--ssd-len",String(M[j])),g.style.strokeDasharray=`${M[j]}`;});}}}if(Kt())return ft(er());function tr(){let o=Math.max(1,Me),a=0,y=0,G=false;function Se(b){let I=true;if(le){let W=Math.min(1,Math.max(0,b/o)),g=Ee(W);ge=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=ke(T==="reverse"?1-g:g),J?.(g),W<1&&(I=false);}else D.forEach((W,g)=>{let j=g*$*o,Te=Math.min(1,Math.max(0,(b-j)/o)),ye=Ee(Te);W.style.strokeDashoffset=T==="reverse"?`${M[g]*ye}`:`${M[g]*(1-ye)}`,c&&(W.style.opacity=T==="reverse"?`${1-ye}`:`${ye}`),be&&re?W.style.stroke=je(be,re,ye):re&&(W.style.stroke=re),q!==null&&Q!==null?W.style.strokeWidth=`${q+(Q-q)*ye}`:Q!==null&&(W.style.strokeWidth=`${Q}`),Z!==null&&B!==null?W.style.fillOpacity=`${Z+(B-Z)*ye}`:B!==null&&(W.style.fillOpacity=`${B}`),z&&W.tagName.toLowerCase()==="path"&&ne[g]&&W.setAttribute("d",gt(ne[g],z,ye)),g===0&&(ge=ye,J?.(ye),e.style.setProperty("--scroll-draw-progress",String(ye))),Te<1&&(I=false);});if(x){let W=Math.min(1,Math.max(0,b/o)),g=Ee(W);for(let j in x){let Te=parseFloat(j);g>=Te&&!_e.has(Te)&&(_e.add(Te),x[j]?.());}}return I}function Pe(b){if(V)return;let I=b-a;F||(F=true,P?.());let W=Se(I);if(W&&!k){k=true,Se(o*(1+Math.max(0,D.length-1)*$)),p?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Ne=setTimeout(()=>{a=performance.now(),F=false,k=false,_e.clear(),et(),S=requestAnimationFrame(Pe);},we));return}W||(S=requestAnimationFrame(Pe));}function Le(){cancelAnimationFrame(S),clearTimeout(Ne),a=performance.now(),y=0,V=false,F=false,k=false,Oe=0,G=true,ge=0,_e.clear(),et(),S=requestAnimationFrame(Pe);}let w=new IntersectionObserver(b=>{b.forEach(I=>{I.isIntersecting&&!(ue&&k)?Le():!I.isIntersecting&&!ue&&!k&&(cancelAnimationFrame(S),clearTimeout(Ne),G=false);});},{root:pe??null,threshold:C,rootMargin:L}),A;function oe(){clearTimeout(A),A=setTimeout(()=>{D.forEach((b,I)=>{M[I]=Ge(b),b.style.strokeDasharray=`${M[I]}`;});},150);}return window.addEventListener("resize",oe),window.addEventListener("orientationchange",oe),te>0?setTimeout(()=>w.observe(e),te):w.observe(e),{destroy(){cancelAnimationFrame(S),clearTimeout(Ne),w.disconnect(),window.removeEventListener("resize",oe),window.removeEventListener("orientationchange",oe),clearTimeout(A);},replay(){Oe=0,Le();},pause(){V||!G||(V=true,y=performance.now()-a,cancelAnimationFrame(S));},resume(){V&&(V=false,G=true,a=performance.now()-y,S=requestAnimationFrame(Pe));},seek(b){let I=Math.min(1,Math.max(0,b));ge=I,V=true,y=I*o,a=performance.now()-y,cancelAnimationFrame(S),Se(y);},getProgress(){return ge},refresh(){clearTimeout(A),D.forEach((b,I)=>{M[I]=Ge(b),b.style.strokeDasharray=`${M[I]}`;});}}}if(ve)return ft(tr());Tt();function Mt(){if(V||!Be)return;let o=performance.now(),a=Ke();if(!ze&&_===false&&a===wt){pt(a);return}ze=false,wt=a;let y=m;if(_!==false){let w=o-vt,A=w>0?Math.abs(a-(Ze<0?a:Ze))/w:0;y=m*Math.max(.2,1+A*(typeof _=="number"?_:1)*.04);}Ze=a,vt=o;let G=ie?K===-1||a>=K?"forward":"reverse":T;K=a;let Se=de-Y,Pe=true,Le=Se===0?0:(a-Y)/Se;if(isNaN(qe)||(qe<=0&&Le>0?d?.():qe>0&&Le<=0&&Ae?.(),qe<1&&Le>=1?R?.():qe>=1&&Le<1&&ae?.()),qe=Le,le){let w=Ee(se(a,Y,de,y));ue&&!ie&&(ce=Math.max(ce,w),w=ce),ge=w,e.style.setProperty("--scroll-draw-progress",String(w));let A=G==="reverse"?1-w:w;e.style.clipPath=ke(A),J?.(w),!F&&se(a,Y,de,y)>0&&(F=true,P?.()),w>=1&&!k?(k=true,p?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Ne=setTimeout(()=>{ce=-1,F=false,k=false,e.style.clipPath=ke(0);},we))):w<1&&!ue&&(k=false),pt(a);return}if(D.forEach((w,A)=>{let oe=A*u*Se,b=Ee(se(a,Y+oe,de+oe,y));ue&&!ie&&(b=Ie[A]=Math.max(Ie[A]??ce,b)),w.style.strokeDashoffset=G==="reverse"?`${M[A]*b}`:`${M[A]*(1-b)}`,c&&(w.style.opacity=G==="reverse"?`${1-b}`:`${b}`),be&&re?w.style.stroke=je(be,re,b):re&&(w.style.stroke=re),q!==null&&Q!==null?w.style.strokeWidth=`${q+(Q-q)*b}`:Q!==null&&(w.style.strokeWidth=`${Q}`),Z!==null&&B!==null?w.style.fillOpacity=`${Z+(B-Z)*b}`:B!==null&&(w.style.fillOpacity=`${B}`),z&&w.tagName.toLowerCase()==="path"&&ne[A]&&w.setAttribute("d",gt(ne[A],z,b)),A===0&&(ge=b,J?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),x){let w=Ee(se(a,Y,de,y));for(let A in x){let oe=parseFloat(A);w>=oe&&!_e.has(oe)&&(_e.add(oe),x[A]?.());}}!F&&se(a,Y,de,y)>0&&(F=true,P?.()),Pe&&!k?(k=true,p?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Ne=setTimeout(()=>{ce=-1,Ie=[],F=false,k=false,_e.clear(),et(),ze=true;},we))):!Pe&&!ue&&(k=false),pt(a);}function At(o){return o>=de&&o<h}function pt(o){X||At(o)?S=requestAnimationFrame(Mt):Be=false;}let Be=false;function tt(){Be||(Be=true,S=requestAnimationFrame(function(){Mt();}));}function rt(){Be=false,cancelAnimationFrame(S);}let dt=new IntersectionObserver(o=>{o.forEach(a=>{X=a.isIntersecting,X&&!V?(ze=true,tt()):Be&&!V&&At(Ke())||rt();});},{root:pe??null,threshold:C,rootMargin:L});function Lt(){D.forEach((o,a)=>{M[a]=Ge(o),o.style.strokeDasharray=`${M[a]}`;}),Tt(),ze=true;}let nt;function Ue(){clearTimeout(nt),nt=setTimeout(Lt,150);}window.addEventListener("resize",Ue),window.addEventListener("orientationchange",Ue);let rr=Ve([e],Ue);return te>0?setTimeout(()=>dt.observe(e),te):dt.observe(e),ft({destroy(){cancelAnimationFrame(S),clearTimeout(Ne),rt(),dt.disconnect(),rr(),window.removeEventListener("resize",Ue),window.removeEventListener("orientationchange",Ue),clearTimeout(nt),bt();},replay(){ce=-1,Ie=[],K=-1,Ze=-1,F=false,k=false,Oe=0,V=false,ge=0,_e.clear(),clearTimeout(Ne),et(),ze=true,X&&tt();},pause(){V=true,rt();},resume(){V&&(V=false,ze=true,X&&tt());},seek(o){let a=Math.min(1,Math.max(0,o));ge=a,ce=a,Ie=[],V=true,rt(),Zt(a,T),ze=true;},getProgress(){return ge},refresh(){clearTimeout(nt),Lt(),X&&!V&&tt();}},()=>({tStart:Y,tEnd:de}))}function gr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Vt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let s=[],i=[],l=t[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"");}r.push({fn:t[1],nums:s,units:i});}return r}function yr(e,r,n){let t=Vt(e),s=Vt(r);return t.length===0||t.length!==s.length?n<1?e:r:t.map((i,l)=>{let m=s[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?n<1?`${i.fn}(${i.nums.map((c,f)=>`${c}${i.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,f)=>`${c}${m.units[f]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,f)=>`${c+(m.nums[f]-c)*n}${i.units[f]}`).join(", ")})`}).join(" ")}function Wt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),s=String(r);if(gr(t))return je(t,s,n);if(t.includes("("))return yr(t,s,n);let i=t.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),c=parseFloat(l[1]);return `${m+(c-m)*n}${i[2]||l[2]}`}return n<1?t:s}function hr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var br=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),wr=0,qt="--scroll-draw-progress";function vr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Bt(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:s={},easing:i="ease-out",speed:l=1,once:m=false,axis:c="y",scrollContainer:f,native:v=true,velocityScale:$=false,respectReducedMotion:T=true,triggerElement:ue,onProgress:He,onComplete:U,onEnter:me,onLeave:ie,onEnterBack:te,onLeaveBack:H}=r,O=T&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,N=typeof i=="function"?i:he[i]??he["ease-out"],x=xe(s.start??"top bottom"),_=xe(s.end??"bottom top"),C=ue??e,L=typeof f=="string"?document.querySelector(f):f??null,E=Object.entries(t).map(([u,h])=>({prop:hr(u),from:Array.isArray(h)?h[0]:"",to:Array.isArray(h)?h[1]:h}));function we(){let u=window.getComputedStyle(e);for(let h of E)h.from===""&&(h.from=u.getPropertyValue(h.prop).trim()||"0");}function z(){for(let u of E)e.style.setProperty(u.prop,String(u.to));}let fe=new Map;for(let u of [...E.map(h=>h.prop),qt])fe.set(u,e.style.getPropertyValue(u));function ve(){for(let[u,h]of fe)h?e.style.setProperty(u,h):e.style.removeProperty(u);}if(O)return z(),U?.(),{...n,destroy:ve,getProgress:()=>1};we();let Me=typeof i=="string"?st(i):null;function $e(){if(!v||!vr()||!Me||c!=="y"||L||C!==e||m||l!==1||He||U||me||ie||te||H||$!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let u of E)if(!br.has(u.prop))return false;return true}function J(){let u=`ssd-a-${++wr}`,h=E.map(K=>`${K.prop}:${K.from}`).join(";"),k=E.map(K=>`${K.prop}:${K.to}`).join(";"),F=document.createElement("style");F.setAttribute("data-ssd-animate",""),F.textContent=`@keyframes ${u}{from{${h}}to{${k}}}.${u}{animation-name:${u};animation-duration:auto;animation-timing-function:${Me};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(u);let S=()=>c==="x"?window.scrollX:window.scrollY,X=()=>c==="x"?window.innerWidth:window.innerHeight,ce=()=>{let K=e.getBoundingClientRect();return De({top:K.top,height:K.height},S(),X(),x,_)};Re(e,{type:"animate",getProgress:()=>Ie.getProgress(),getTrigger:ce});let Ie={refresh(){},destroy(){e.classList.remove(u),F.remove(),e.style.animationPlayState="",ve(),Fe(e);},replay(){e.classList.remove(u),e.offsetWidth,e.classList.add(u);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(K){let V=Math.min(1,Math.max(0,K));e.classList.remove(u);for(let ge of E)e.style.setProperty(ge.prop,Wt(ge.from,ge.to,V));},getProgress(){let{tStart:K,tEnd:V}=ce();return N(se(S(),K,V,l))}};return Ie}if($e())return J();let P=0,p=0,d=0,R=false,ae=false,Ae=-1,le=0,Ee=false,Ce=NaN,We=-1,pe=0,be=()=>L?c==="x"?L.scrollLeft:L.scrollTop:c==="x"?window.scrollX:window.scrollY,re=()=>L?c==="x"?L.clientWidth:L.clientHeight:c==="x"?window.innerWidth:window.innerHeight,q=C===e?E:[],Q=false;function Z(){let u=e.style,h=q.map(X=>u.getPropertyValue(X.prop)),k=u.transition;q.length&&(u.transition="none"),q.forEach(X=>u.setProperty(X.prop,fe.get(X.prop)??""));let F=ot(C,L,c);q.forEach((X,ce)=>u.setProperty(X.prop,h[ce])),q.length&&(e.offsetWidth,u.transition=k);let S=De(F,F.scroll,re(),x,_);Q&&Math.abs(S.tStart-P)<1&&Math.abs(S.tEnd-p)<1||(Q=true,P=S.tStart,p=S.tEnd);}function B(u){e.style.setProperty(qt,String(u));for(let h of E)e.style.setProperty(h.prop,Wt(h.from,h.to,u));He?.(u);}function ke(u){if(isNaN(Ce)){Ce=u;return}Ce<=0&&u>0?me?.():Ce>0&&u<=0&&H?.(),Ce<1&&u>=1?ie?.():Ce>=1&&u<1&&te?.(),Ce=u;}function D(){if(!R||ae)return;let u=performance.now(),h=be(),k=l;if($!==false){let X=u-pe,ce=X>0?Math.abs(h-(We<0?h:We))/X:0;k=l*Math.max(.2,1+ce*(typeof $=="number"?$:1)*.04);}We=h,pe=u;let F=p===P?0:(h-P)/(p-P);ke(F);let S=N(se(h,P,p,k));m&&(Ae=Math.max(Ae,S),S=Ae),le=S,B(S),S>=1&&!Ee?(Ee=true,U?.()):S<1&&!m&&(Ee=false),d=requestAnimationFrame(D);}Z(),p===P&&ee("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let u=N(se(be(),P,p,l));m&&u>0&&(Ae=u),le=u,B(u);}let M=new IntersectionObserver(u=>{u.forEach(h=>{R=h.isIntersecting,R&&!ae?d=requestAnimationFrame(D):cancelAnimationFrame(d);});},{root:L??null}),ne;function Y(){clearTimeout(ne),ne=setTimeout(Z,150);}window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y);let de=Ve([C],Y);return M.observe(e),Re(e,{type:"animate",getProgress:()=>le,getTrigger:()=>({tStart:P,tEnd:p})}),{destroy(){cancelAnimationFrame(d),M.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),de(),clearTimeout(ne),ve(),Fe(e);},replay(){Ae=-1,Ee=false,le=0,ae=false,B(0);},pause(){ae=true,cancelAnimationFrame(d);},resume(){ae&&(ae=false,R&&(d=requestAnimationFrame(D)));},seek(u){let h=Math.min(1,Math.max(0,u));le=h,Ae=h,ae=true,cancelAnimationFrame(d),B(h);},getProgress(){return le},refresh(){Z();}}}var yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Gt(e,r){if(typeof window>"u")return yt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ee("scrollCounter: element not found:",e),yt;let t=n,{from:s=0,to:i,format:l,easing:m="ease-out",trigger:c={},once:f=true,decimals:v,onComplete:$}=r,T=v!==void 0?p=>p.toFixed(v):l??(p=>String(Math.round(p))),ue=typeof m=="function"?m:he[m]??he["ease-out"],He=xe(c.start??"top 80%"),U=xe(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=T(i),$?.(),yt;let ie=0,te=0,H=false,O=0,N=false,x=false,_=-1,C=0,L=false,E=()=>window.scrollY,we=()=>window.innerHeight;function z(){let p=t.getBoundingClientRect(),d=De({top:p.top,height:p.height},E(),we(),He,U);H&&Math.abs(d.tStart-ie)<1&&Math.abs(d.tEnd-te)<1||(H=true,ie=d.tStart,te=d.tEnd);}function fe(p){t.textContent=T(s+(i-s)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function ve(){if(!N||x)return;let p=ue(se(E(),ie,te,1));f&&(_=Math.max(_,p),p=_),C=p,fe(p),p>=1&&!L?(L=true,$?.()):p<1&&!f&&(L=false),O=requestAnimationFrame(ve);}z();{let p=ue(se(E(),ie,te,1));f&&p>0&&(_=p),C=p,fe(p);}let Me=new IntersectionObserver(p=>{p.forEach(d=>{N=d.isIntersecting,N&&!x?O=requestAnimationFrame(ve):cancelAnimationFrame(O);});}),$e;function J(){clearTimeout($e),$e=setTimeout(z,150);}window.addEventListener("resize",J),window.addEventListener("orientationchange",J);let P=Ve([t],J);return Me.observe(t),Re(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:ie,tEnd:te})}),{destroy(){cancelAnimationFrame(O),Me.disconnect(),window.removeEventListener("resize",J),window.removeEventListener("orientationchange",J),P(),clearTimeout($e),Fe(t);},replay(){_=-1,L=false,C=0,x=false,fe(0);},pause(){x=true,cancelAnimationFrame(O);},resume(){x&&(x=false,N&&(O=requestAnimationFrame(ve)));},seek(p){let d=Math.min(1,Math.max(0,p));C=d,_=d,x=true,cancelAnimationFrame(O),fe(d);},getProgress(){return C}}}function Yt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function Er(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function jt(e){let r=Yt(e),n=new Map;for(let i of r){let l=i.offsetTop;n.has(l)||n.set(l,[]),n.get(l).push(i);}let t=[],s=Array.from(n.keys()).sort((i,l)=>i-l);for(let i of s){let l=n.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",l.forEach((c,f)=>{let v=c.nextElementSibling;m.appendChild(c),f<l.length-1&&v&&v.style.whiteSpace==="pre"&&m.appendChild(v);}),t.push(m);}return e.textContent="",t.forEach((i,l)=>{e.appendChild(i),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function Sr(e,r,n,t){if(n<=1||t===0)return e;let s=(n-1)*t,i=r*t,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function Tr(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var Ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Xt(e,r={}){if(typeof window>"u")return Ut;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ee("scrollText: element not found:",e),Ut;let t=n,{split:s="words",stagger:i=.04,easing:l="ease-out",from:m={opacity:0,y:24},trigger:c={},once:f=true,onComplete:v}=r,$=window.matchMedia("(prefers-reduced-motion: reduce)").matches,T=typeof l=="function"?l:he[l]??he["ease-out"],ue=xe(c.start??"top 85%"),He=xe(c.end??"top 40%"),U=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let me;s==="chars"?me=Er(t):s==="lines"?me=jt(t):me=Yt(t);let ie=me.length;function te(d,R){m?.opacity!==void 0&&(d.style.opacity=String(m.opacity+(1-m.opacity)*R));let ae=Tr(R,m);ae&&(d.style.transform=ae);}function H(d){t.style.setProperty("--scroll-draw-progress",String(d)),me.forEach((R,ae)=>{let Ae=T(Sr(d,ae,ie,i));te(R,Ae);});}if($)return H(1),v?.(),{destroy(){t.innerHTML=U,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};H(0);let O=0,N=0,x=0,_=false,C=false,L=-1,E=0,we=false,z=()=>window.scrollY,fe=()=>window.innerHeight;function ve(){let d=t.getBoundingClientRect(),R=De({top:d.top,height:d.height},z(),fe(),ue,He);O=R.tStart,N=R.tEnd;}function Me(){if(!_||C)return;let d=se(z(),O,N,1);f&&(L=Math.max(L,d),d=L),E=d,H(d),d>=1&&!we?(we=true,v?.()):d<1&&!f&&(we=false),x=requestAnimationFrame(Me);}ve();let $e=new IntersectionObserver(d=>{d.forEach(R=>{_=R.isIntersecting,_&&!C?x=requestAnimationFrame(Me):cancelAnimationFrame(x);});}),J;function P(){clearTimeout(J),J=setTimeout(()=>{if(s==="lines"){let d=E;t.innerHTML=U,t.setAttribute("aria-label",t.textContent??""),me=jt(t),H(d);}ve();},150);}window.addEventListener("resize",P),window.addEventListener("orientationchange",P);let p=Ve([t],P);return $e.observe(t),Re(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:O,tEnd:N})}),{destroy(){cancelAnimationFrame(x),$e.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),p(),clearTimeout(J),t.innerHTML=U,t.removeAttribute("aria-label"),Fe(t);},replay(){L=-1,we=false,E=0,C=false,H(0);},pause(){C=true,cancelAnimationFrame(x);},resume(){C&&(C=false,_&&(x=requestAnimationFrame(Me)));},seek(d){let R=Math.min(1,Math.max(0,d));E=R,L=R,C=true,cancelAnimationFrame(x),H(R);},getProgress(){return E}}}function xr(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let t=typeof e=="string"?document.querySelector(e):e;return t?lt(t,r):(ee("Container not found:",e),n)}function Qe(){return typeof document>"u"?null:document}var ht=new WeakMap,Jt;function ct(e,r,n,t){let s=ht.get(e)??new Map;ht.set(e,s);let i=()=>{let c=n(),f=s.get(r);f&&f.key===c||(f?.inst.destroy(),s.set(r,{inst:t(c),key:c,build:i,users:f?.users??0}));};i(),s.get(r).users++;let l=true;typeof MutationObserver<"u"&&(Jt??(Jt=new MutationObserver(c=>c.forEach(f=>ht.get(f.target)?.forEach(v=>v.build())))),Jt.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(c=>`data-scroll-${c}-options`).concat("data-scroll-drawoptions")}));let m=()=>s.get(r)?.inst;return {destroy:()=>{let c=s.get(r);!l||!c||(l=false,!(--c.users>0)&&(c.inst.destroy(),s.delete(r)));},replay:()=>m()?.replay(),pause:()=>m()?.pause(),resume:()=>m()?.resume(),seek:c=>m()?.seek(c),getProgress:()=>m()?.getProgress()??0,refresh:()=>m()?.refresh?.()}}function ut(e,r){try{return e?JSON.parse(e):r}catch{return r}}function Mr(e=Qe()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(r=>ct(r,"draw",()=>r.dataset.scrollDrawOptions??r.dataset.scrollDrawoptions??"",n=>lt(r,ut(n,{})))):[]}function Ar(e=Qe()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(r=>ct(r,"animate",()=>r.dataset.scrollAnimateOptions??"",n=>Bt(r,ut(n,{props:{}})))):[]}function Lr(e=Qe()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(r=>ct(r,"counter",()=>r.dataset.scrollCounterOptions??"",n=>{let t=ut(n,{});return !t.to&&t.to!==0&&(ee('initScrollCounter: element missing "to" in options JSON:',r),t.to=0),typeof t.format!="function"&&t.format!==void 0&&(ee('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',r),delete t.format),Gt(r,t)})):[]}function $r(e=Qe()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(r=>ct(r,"text",()=>r.dataset.scrollTextOptions??"",n=>Xt(r,ut(n,{})))):[]}function Cn(e=Qe()){return {draw:Mr(e),animate:Ar(e),counter:Lr(e),text:$r(e)}}exports.initAll=Cn;exports.initScrollAnimate=Ar;exports.initScrollCounter=Lr;exports.initScrollDraw=Mr;exports.initScrollText=$r;exports.scrollDraw=xr;
|
|
3
|
+
<div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",s,{passive:true}),s(),{el:t,destroy(){window.removeEventListener("scroll",s),t.remove();}}}var zt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Vt=/[MmLlHhVvCcSsQqTtAaZz]/g;function yr(e,r,n){if(!Xe)return;let t=(e.match(Vt)??[]).join("").toUpperCase(),s=(r.match(Vt)??[]).join("").toUpperCase(),i=(e.match(zt)??[]).length,l=(r.match(zt)??[]).length;if(t!==s){ee(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}i!==l&&ee(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function ht(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),m=t[s++]??l;return String(+(l+(m-l)*n).toFixed(4))})}function lt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,s=n?{...It[n],...t}:t,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:p="linear",trigger:w={},stagger:D=0,direction:T="forward",once:me=false,debug:He=false,axis:Y="y",scrollContainer:Le,autoReverse:N=false,delay:te=0,strokeColor:le,strokeWidth:L,fillOpacity:_,waypoints:k,velocityScale:C=false,threshold:q=0,rootMargin:x="0px",repeat:S=0,repeatDelay:fe=0,morphTo:I,clip:ce,autoplay:xe=false,duration:$e=1e3,native:Me=true,onProgress:re,onStart:z,onComplete:f,onEnter:P,onLeave:v,onEnterBack:$,onLeaveBack:pe}=s,J=ce===true?"left":typeof ce=="string"?ce:false,ve=typeof p=="function"?p:be[p]??be.linear,Ce=Te(w.start??"top bottom"),We=Te(w.end??"bottom top"),de=typeof Le=="string"?document.querySelector(Le):Le??null,we=Array.isArray(le)?le[0]:null,ne=Array.isArray(le)?le[1]:typeof le=="string"?le:null,B=Array.isArray(L)?L[0]:null,Q=Array.isArray(L)?L[1]:typeof L=="number"?L:null,Z=Array.isArray(_)?_[0]:null,G=Array.isArray(_)?_[1]:typeof _=="number"?_:null;function ke(o){let a=o*100;switch(J){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 O=J?[]:Array.from(e.querySelectorAll(l)),M=[],oe=[],X=0,ge=0,u=D,y=0,R=false,H=false,E=0,se=false,ue=-1,Ie=[],K=-1,V=false,ye=0,Oe=0,Ne,mt=null;function vt(){mt?.destroy(),mt=null;}let _e=new Set,Et=NaN,ze=true,Ke=-1,St=performance.now(),qe=NaN;function Ue(){return de?Y==="x"?de.scrollLeft:de.scrollTop:Y==="x"?window.scrollX:window.scrollY}function Tt(){return de?Y==="x"?de.clientWidth:de.clientHeight:Y==="x"?window.innerWidth:window.innerHeight}function xt(){let o=ot(e,de,Y);return De(o,o.scroll,Tt(),Ce,We)}function Kt(){let o=ge-X,a=O.length-1,g=de??document.documentElement,j=Y==="x"?"Width":"Height";if(u=D,D>0&&a>0&&o>0){let Ee=g[`scroll${j}`]-g[`client${j}`]-1-X-o/m;Ee>=0&&(u=Math.min(D,Ee/(a*o)));}y=ge+a*u*o;}function Mt(){(({tStart:X,tEnd:ge}=xt())),Kt(),He&&Xe&&(vt(),mt=gr(X,ge,Y));}function ft(o,a=xt){Re(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let g=o.destroy;return o.destroy=()=>{g.call(o),Fe(e);},o}function er(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),J){let g=a==="reverse"?1-o:o;e.style.clipPath=ke(g);return}O.forEach((g,j)=>{g.style.strokeDashoffset=a==="reverse"?`${M[j]*o}`:`${M[j]*(1-o)}`,c&&(g.style.opacity=a==="reverse"?`${1-o}`:`${o}`),we&&ne?g.style.stroke=je(we,ne,o):ne&&(g.style.stroke=ne),B!==null&&Q!==null?g.style.strokeWidth=`${B+(Q-B)*o}`:Q!==null&&(g.style.strokeWidth=`${Q}`),Z!==null&&G!==null?g.style.fillOpacity=`${Z+(G-Z)*o}`:G!==null&&(g.style.fillOpacity=`${G}`),I&&g.tagName.toLowerCase()==="path"&&oe[j]&&g.setAttribute("d",ht(oe[j],I,o));});}function et(){if(e.style.setProperty("--scroll-draw-progress","0"),J){e.style.clipPath=ke(0);return}O.forEach((o,a)=>{o.style.strokeDasharray=`${M[a]}`,o.style.strokeDashoffset=T==="reverse"?"0":`${M[a]}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),B!==null&&(o.style.strokeWidth=`${B}`),Z!==null&&(o.style.fillOpacity=`${Z}`),I&&o.tagName.toLowerCase()==="path"&&oe[a]&&o.setAttribute("d",oe[a]);});}if(O.forEach(o=>{dr(o);let a=Ge(o);M.push(a);let g=o.tagName.toLowerCase()==="path";g?oe.push(o.getAttribute("d")??""):oe.push(""),I&&(g?yr(oe[oe.length-1],I,o):ee(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),i?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?`${a}`:"0",c&&(o.style.opacity="1"),ne&&(o.style.stroke=ne),Q!==null&&(o.style.strokeWidth=`${Q}`),G!==null&&(o.style.fillOpacity=`${G}`),I&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",I)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?"0":`${a}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),B!==null&&(o.style.strokeWidth=`${B}`),Z!==null&&(o.style.fillOpacity=`${Z}`));}),J){if(i)return e.style.clipPath=ke(1),f?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(i)return f?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let At=typeof p=="string"?st(p):null;function tr(){return !(Me===false||!pr()||!O.length||!At||J||Y!=="y"||de||m!==1||D!==0||me||N||C!==false||I||k||S||te>0||re||z||f||P||v||$||pe||le!=null||L!=null||_!=null||(w.start??"top bottom").trim()!=="top bottom"||(w.end??"bottom top").trim()!=="bottom top")}function rr(){let o=++fr,a=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,j=`--svg-scroll-draw-${o}`,Ee=T==="reverse"?"0":"var(--ssd-len)",Pe=T==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Ee};`,b=`stroke-dashoffset:${Pe};`;c&&(Ae+=`opacity:${T==="reverse"?1:0};`,b+=`opacity:${T==="reverse"?0:1};`);let A=document.createElement("style");A.setAttribute("data-svg-scroll-draw",""),A.textContent=`@keyframes ${a}{from{${Ae}}to{${b}}}.${g}{view-timeline-name:${j};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${j};animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(g);function ie(d,U){d.style.setProperty("--ssd-len",String(M[U])),d.style.strokeDasharray=`${M[U]}`,d.style.strokeDashoffset="",d.style.opacity="",d.style.animationPlayState="",d.classList.add(a);}O.forEach(ie);let h=false,F=-1;function W(){if(F>=0)return F;let d=e.getBoundingClientRect(),{tStart:U,tEnd:Se}=De({top:d.top,height:d.height},Ue(),Tt(),Ce,We);return ve(ae(Ue(),U,Se,m))}return {destroy(){e.classList.remove(g),O.forEach(d=>{d.classList.remove(a),d.style.removeProperty("--ssd-len"),d.style.animationPlayState="";}),A.remove();},replay(){h=false,F=-1,O.forEach(ie);},pause(){h=true,O.forEach(d=>{d.style.animationPlayState="paused";});},resume(){h&&(h=false,O.forEach(d=>{d.style.animationPlayState="running";}));},seek(d){let U=Math.min(1,Math.max(0,d));F=U,h=true,O.forEach((Se,he)=>{Se.classList.remove(a),Se.style.strokeDashoffset=T==="reverse"?`${M[he]*U}`:`${M[he]*(1-U)}`,c&&(Se.style.opacity=T==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){O.forEach((d,U)=>{M[U]=Ge(d),d.style.setProperty("--ssd-len",String(M[U])),d.style.strokeDasharray=`${M[U]}`;});}}}if(tr())return ft(rr());function nr(){let o=Math.max(1,$e),a=0,g=0,j=false;function Ee(h){let F=true;if(J){let W=Math.min(1,Math.max(0,h/o)),d=ve(W);ye=d,e.style.setProperty("--scroll-draw-progress",String(d)),e.style.clipPath=ke(T==="reverse"?1-d:d),re?.(d),W<1&&(F=false);}else O.forEach((W,d)=>{let U=d*D*o,Se=Math.min(1,Math.max(0,(h-U)/o)),he=ve(Se);W.style.strokeDashoffset=T==="reverse"?`${M[d]*he}`:`${M[d]*(1-he)}`,c&&(W.style.opacity=T==="reverse"?`${1-he}`:`${he}`),we&&ne?W.style.stroke=je(we,ne,he):ne&&(W.style.stroke=ne),B!==null&&Q!==null?W.style.strokeWidth=`${B+(Q-B)*he}`:Q!==null&&(W.style.strokeWidth=`${Q}`),Z!==null&&G!==null?W.style.fillOpacity=`${Z+(G-Z)*he}`:G!==null&&(W.style.fillOpacity=`${G}`),I&&W.tagName.toLowerCase()==="path"&&oe[d]&&W.setAttribute("d",ht(oe[d],I,he)),d===0&&(ye=he,re?.(he),e.style.setProperty("--scroll-draw-progress",String(he))),Se<1&&(F=false);});if(k){let W=Math.min(1,Math.max(0,h/o)),d=ve(W);for(let U in k){let Se=parseFloat(U);d>=Se&&!_e.has(Se)&&(_e.add(Se),k[U]?.());}}return F}function Pe(h){if(V)return;let F=h-a;H||(H=true,z?.());let W=Ee(F);if(W&&!R){R=true,Ee(o*(1+Math.max(0,O.length-1)*D)),f?.(),Oe<(S==="infinite"?1/0:S??0)&&(Oe++,Ne=setTimeout(()=>{a=performance.now(),H=false,R=false,_e.clear(),et(),E=requestAnimationFrame(Pe);},fe));return}W||(E=requestAnimationFrame(Pe));}function Ae(){cancelAnimationFrame(E),clearTimeout(Ne),a=performance.now(),g=0,V=false,H=false,R=false,Oe=0,j=true,ye=0,_e.clear(),et(),E=requestAnimationFrame(Pe);}let b=new IntersectionObserver(h=>{h.forEach(F=>{F.isIntersecting&&!(me&&R)?Ae():!F.isIntersecting&&!me&&!R&&(cancelAnimationFrame(E),clearTimeout(Ne),j=false);});},{root:de??null,threshold:q,rootMargin:x}),A;function ie(){clearTimeout(A),A=setTimeout(()=>{O.forEach((h,F)=>{M[F]=Ge(h),h.style.strokeDasharray=`${M[F]}`;});},150);}return window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie),te>0?setTimeout(()=>b.observe(e),te):b.observe(e),{destroy(){cancelAnimationFrame(E),clearTimeout(Ne),b.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),clearTimeout(A);},replay(){Oe=0,Ae();},pause(){V||!j||(V=true,g=performance.now()-a,cancelAnimationFrame(E));},resume(){V&&(V=false,j=true,a=performance.now()-g,E=requestAnimationFrame(Pe));},seek(h){let F=Math.min(1,Math.max(0,h));ye=F,V=true,g=F*o,a=performance.now()-g,cancelAnimationFrame(E),Ee(g);},getProgress(){return ye},refresh(){clearTimeout(A),O.forEach((h,F)=>{M[F]=Ge(h),h.style.strokeDasharray=`${M[F]}`;});}}}if(xe)return ft(nr());Mt();function Lt(){if(V||!Be)return;let o=performance.now(),a=Ue();if(!ze&&C===false&&a===Et){dt(a);return}ze=false,Et=a;let g=m;if(C!==false){let b=o-St,A=b>0?Math.abs(a-(Ke<0?a:Ke))/b:0;g=m*Math.max(.2,1+A*(typeof C=="number"?C:1)*.04);}Ke=a,St=o;let j=N?K===-1||a>=K?"forward":"reverse":T;K=a;let Ee=ge-X,Pe=true,Ae=Ee===0?0:(a-X)/Ee;if(isNaN(qe)||(qe<=0&&Ae>0?P?.():qe>0&&Ae<=0&&pe?.(),qe<1&&Ae>=1?v?.():qe>=1&&Ae<1&&$?.()),qe=Ae,J){let b=ve(ae(a,X,ge,g));me&&!N&&(ue=Math.max(ue,b),b=ue),ye=b,e.style.setProperty("--scroll-draw-progress",String(b));let A=j==="reverse"?1-b:b;e.style.clipPath=ke(A),re?.(b),!H&&ae(a,X,ge,g)>0&&(H=true,z?.()),b>=1&&!R?(R=true,f?.(),Oe<(S==="infinite"?1/0:S??0)&&(Oe++,Ne=setTimeout(()=>{ue=-1,H=false,R=false,e.style.clipPath=ke(0);},fe))):b<1&&!me&&(R=false),dt(a);return}if(O.forEach((b,A)=>{let ie=A*u*Ee,h=ve(ae(a,X+ie,ge+ie,g));me&&!N&&(h=Ie[A]=Math.max(Ie[A]??ue,h)),b.style.strokeDashoffset=j==="reverse"?`${M[A]*h}`:`${M[A]*(1-h)}`,c&&(b.style.opacity=j==="reverse"?`${1-h}`:`${h}`),we&&ne?b.style.stroke=je(we,ne,h):ne&&(b.style.stroke=ne),B!==null&&Q!==null?b.style.strokeWidth=`${B+(Q-B)*h}`:Q!==null&&(b.style.strokeWidth=`${Q}`),Z!==null&&G!==null?b.style.fillOpacity=`${Z+(G-Z)*h}`:G!==null&&(b.style.fillOpacity=`${G}`),I&&b.tagName.toLowerCase()==="path"&&oe[A]&&b.setAttribute("d",ht(oe[A],I,h)),A===0&&(ye=h,re?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Pe=false);}),k){let b=ve(ae(a,X,ge,g));for(let A in k){let ie=parseFloat(A);b>=ie&&!_e.has(ie)&&(_e.add(ie),k[A]?.());}}!H&&ae(a,X,ge,g)>0&&(H=true,z?.()),Pe&&!R?(R=true,f?.(),Oe<(S==="infinite"?1/0:S??0)&&(Oe++,Ne=setTimeout(()=>{ue=-1,Ie=[],H=false,R=false,_e.clear(),et(),ze=true;},fe))):!Pe&&!me&&(R=false),dt(a);}function pt(o){return o>=ge&&o<y}function dt(o){se||pt(o)?E=requestAnimationFrame(Lt):Be=false;}function gt(){return se||pt(Ue())}let Be=false;function tt(){Be||(Be=true,E=requestAnimationFrame(function(){Lt();}));}function rt(){Be=false,cancelAnimationFrame(E);}let yt=new IntersectionObserver(o=>{o.forEach(a=>{se=a.isIntersecting,se&&!V?(ze=true,tt()):Be&&!V&&pt(Ue())||rt();});},{root:de??null,threshold:q,rootMargin:x});function $t(){O.forEach((o,a)=>{M[a]=Ge(o),o.style.strokeDasharray=`${M[a]}`;}),Mt(),ze=true;}let nt;function Ye(){clearTimeout(nt),nt=setTimeout($t,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let or=Ve([e],Ye);return te>0?setTimeout(()=>yt.observe(e),te):yt.observe(e),ft({destroy(){cancelAnimationFrame(E),clearTimeout(Ne),rt(),yt.disconnect(),or(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(nt),vt();},replay(){ue=-1,Ie=[],K=-1,Ke=-1,H=false,R=false,Oe=0,V=false,ye=0,_e.clear(),clearTimeout(Ne),et(),ze=true,gt()&&tt();},pause(){V=true,rt();},resume(){V&&(V=false,ze=true,gt()&&tt());},seek(o){let a=Math.min(1,Math.max(0,o));ye=a,ue=a,Ie=[],V=true,rt(),er(a,T),ze=true;},getProgress(){return ye},refresh(){clearTimeout(nt),$t(),gt()&&!V&&tt();}},()=>({tStart:X,tEnd:ge}))}function hr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Wt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let s=[],i=[],l=t[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"");}r.push({fn:t[1],nums:s,units:i});}return r}function br(e,r,n){let t=Wt(e),s=Wt(r);return t.length===0||t.length!==s.length?n<1?e:r:t.map((i,l)=>{let m=s[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?n<1?`${i.fn}(${i.nums.map((c,p)=>`${c}${i.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,p)=>`${c}${m.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,p)=>`${c+(m.nums[p]-c)*n}${i.units[p]}`).join(", ")})`}).join(" ")}function qt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),s=String(r);if(hr(t))return je(t,s,n);if(t.includes("("))return br(t,s,n);let i=t.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),c=parseFloat(l[1]);return `${m+(c-m)*n}${i[2]||l[2]}`}return n<1?t:s}function wr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var vr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Er=0,Bt="--scroll-draw-progress";function Sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Gt(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:s={},easing:i="ease-out",speed:l=1,once:m=false,axis:c="y",scrollContainer:p,native:w=true,velocityScale:D=false,respectReducedMotion:T=true,triggerElement:me,onProgress:He,onComplete:Y,onEnter:Le,onLeave:N,onEnterBack:te,onLeaveBack:le}=r,L=T&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,_=typeof i=="function"?i:be[i]??be["ease-out"],k=Te(s.start??"top bottom"),C=Te(s.end??"bottom top"),q=me??e,x=typeof p=="string"?document.querySelector(p):p??null,S=Object.entries(t).map(([u,y])=>({prop:wr(u),from:Array.isArray(y)?y[0]:"",to:Array.isArray(y)?y[1]:y}));function fe(){let u=window.getComputedStyle(e);for(let y of S)y.from===""&&(y.from=u.getPropertyValue(y.prop).trim()||"0");}function I(){for(let u of S)e.style.setProperty(u.prop,String(u.to));}let ce=new Map;for(let u of [...S.map(y=>y.prop),Bt])ce.set(u,e.style.getPropertyValue(u));function xe(){for(let[u,y]of ce)y?e.style.setProperty(u,y):e.style.removeProperty(u);}if(L)return I(),Y?.(),{...n,destroy:xe,getProgress:()=>1};fe();let $e=typeof i=="string"?st(i):null;function Me(){if(!w||!Sr()||!$e||c!=="y"||x||q!==e||m||l!==1||He||Y||Le||N||te||le||D!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let u of S)if(!vr.has(u.prop))return false;return true}function re(){let u=`ssd-a-${++Er}`,y=S.map(K=>`${K.prop}:${K.from}`).join(";"),R=S.map(K=>`${K.prop}:${K.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${u}{from{${y}}to{${R}}}.${u}{animation-name:${u};animation-duration:auto;animation-timing-function:${$e};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(u);let E=()=>c==="x"?window.scrollX:window.scrollY,se=()=>c==="x"?window.innerWidth:window.innerHeight,ue=()=>{let K=e.getBoundingClientRect();return De({top:K.top,height:K.height},E(),se(),k,C)};Re(e,{type:"animate",getProgress:()=>Ie.getProgress(),getTrigger:ue});let Ie={refresh(){},destroy(){e.classList.remove(u),H.remove(),e.style.animationPlayState="",xe(),Fe(e);},replay(){e.classList.remove(u),e.offsetWidth,e.classList.add(u);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(K){let V=Math.min(1,Math.max(0,K));e.classList.remove(u);for(let ye of S)e.style.setProperty(ye.prop,qt(ye.from,ye.to,V));},getProgress(){let{tStart:K,tEnd:V}=ue();return _(ae(E(),K,V,l))}};return Ie}if(Me())return re();let z=0,f=0,P=0,v=false,$=false,pe=-1,J=0,ve=false,Ce=NaN,We=-1,de=0,we=()=>x?c==="x"?x.scrollLeft:x.scrollTop:c==="x"?window.scrollX:window.scrollY,ne=()=>x?c==="x"?x.clientWidth:x.clientHeight:c==="x"?window.innerWidth:window.innerHeight,B=q===e?S:[],Q=false;function Z(){let u=e.style,y=B.map(se=>u.getPropertyValue(se.prop)),R=u.transition;B.length&&(u.transition="none"),B.forEach(se=>u.setProperty(se.prop,ce.get(se.prop)??""));let H=ot(q,x,c);B.forEach((se,ue)=>u.setProperty(se.prop,y[ue])),B.length&&(e.offsetWidth,u.transition=R);let E=De(H,H.scroll,ne(),k,C);Q&&Math.abs(E.tStart-z)<1&&Math.abs(E.tEnd-f)<1||(Q=true,z=E.tStart,f=E.tEnd);}function G(u){e.style.setProperty(Bt,String(u));for(let y of S)e.style.setProperty(y.prop,qt(y.from,y.to,u));He?.(u);}function ke(u){if(isNaN(Ce)){Ce=u;return}Ce<=0&&u>0?Le?.():Ce>0&&u<=0&&le?.(),Ce<1&&u>=1?N?.():Ce>=1&&u<1&&te?.(),Ce=u;}function O(){if(!v||$)return;let u=performance.now(),y=we(),R=l;if(D!==false){let se=u-de,ue=se>0?Math.abs(y-(We<0?y:We))/se:0;R=l*Math.max(.2,1+ue*(typeof D=="number"?D:1)*.04);}We=y,de=u;let H=f===z?0:(y-z)/(f-z);ke(H);let E=_(ae(y,z,f,R));m&&(pe=Math.max(pe,E),E=pe),J=E,G(E),E>=1&&!ve?(ve=true,Y?.()):E<1&&!m&&(ve=false),P=requestAnimationFrame(O);}Z(),f===z&&ee("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let u=_(ae(we(),z,f,l));m&&u>0&&(pe=u),J=u,G(u);}let M=new IntersectionObserver(u=>{u.forEach(y=>{v=y.isIntersecting,v&&!$?P=requestAnimationFrame(O):cancelAnimationFrame(P);});},{root:x??null}),oe;function X(){clearTimeout(oe),oe=setTimeout(Z,150);}window.addEventListener("resize",X),window.addEventListener("orientationchange",X);let ge=Ve([q],X);return M.observe(e),Re(e,{type:"animate",getProgress:()=>J,getTrigger:()=>({tStart:z,tEnd:f})}),{destroy(){cancelAnimationFrame(P),M.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),ge(),clearTimeout(oe),xe(),Fe(e);},replay(){pe=-1,ve=false,J=0,$=false,G(0);},pause(){$=true,cancelAnimationFrame(P);},resume(){$&&($=false,v&&(P=requestAnimationFrame(O)));},seek(u){let y=Math.min(1,Math.max(0,u));J=y,pe=y,$=true,cancelAnimationFrame(P),G(y);},getProgress(){return J},refresh(){Z();}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function jt(e,r){if(typeof window>"u")return bt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ee("scrollCounter: element not found:",e),bt;let t=n,{from:s=0,to:i,format:l,easing:m="ease-out",trigger:c={},once:p=true,decimals:w,onComplete:D}=r,T=w!==void 0?f=>f.toFixed(w):l??(f=>String(Math.round(f))),me=typeof m=="function"?m:be[m]??be["ease-out"],He=Te(c.start??"top 80%"),Y=Te(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=T(i),D?.(),bt;let N=0,te=0,le=false,L=0,_=false,k=false,C=-1,q=0,x=false,S=()=>window.scrollY,fe=()=>window.innerHeight;function I(){let f=t.getBoundingClientRect(),P=De({top:f.top,height:f.height},S(),fe(),He,Y);le&&Math.abs(P.tStart-N)<1&&Math.abs(P.tEnd-te)<1||(le=true,N=P.tStart,te=P.tEnd);}function ce(f){t.textContent=T(s+(i-s)*f),t.style.setProperty("--scroll-draw-progress",String(f));}function xe(){if(!_||k)return;let f=me(ae(S(),N,te,1));p&&(C=Math.max(C,f),f=C),q=f,ce(f),f>=1&&!x?(x=true,D?.()):f<1&&!p&&(x=false),L=requestAnimationFrame(xe);}I();{let f=me(ae(S(),N,te,1));p&&f>0&&(C=f),q=f,ce(f);}let $e=new IntersectionObserver(f=>{f.forEach(P=>{_=P.isIntersecting,_&&!k?L=requestAnimationFrame(xe):cancelAnimationFrame(L);});}),Me;function re(){clearTimeout(Me),Me=setTimeout(I,150);}window.addEventListener("resize",re),window.addEventListener("orientationchange",re);let z=Ve([t],re);return $e.observe(t),Re(t,{type:"counter",getProgress:()=>q,getTrigger:()=>({tStart:N,tEnd:te})}),{destroy(){cancelAnimationFrame(L),$e.disconnect(),window.removeEventListener("resize",re),window.removeEventListener("orientationchange",re),z(),clearTimeout(Me),Fe(t);},replay(){C=-1,x=false,q=0,k=false,ce(0);},pause(){k=true,cancelAnimationFrame(L);},resume(){k&&(k=false,_&&(L=requestAnimationFrame(xe)));},seek(f){let P=Math.min(1,Math.max(0,f));q=P,C=P,k=true,cancelAnimationFrame(L),ce(P);},getProgress(){return q}}}function Ut(e,r){let n=document.createElement("span");n.textContent=r,n.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(n);}function Jt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function Tr(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function Yt(e){let r=Jt(e),n=new Map;for(let i of r){let l=i.offsetTop;n.has(l)||n.set(l,[]),n.get(l).push(i);}let t=[],s=Array.from(n.keys()).sort((i,l)=>i-l);for(let i of s){let l=n.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",l.forEach((c,p)=>{let w=c.nextElementSibling;m.appendChild(c),p<l.length-1&&w&&w.style.whiteSpace==="pre"&&m.appendChild(w);}),t.push(m);}return e.textContent="",t.forEach((i,l)=>{e.appendChild(i),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function xr(e,r,n,t){if(n<=1||t===0)return e;let s=(n-1)*t,i=r*t,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function Mr(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var Xt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Qt(e,r={}){if(typeof window>"u")return Xt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ee("scrollText: element not found:",e),Xt;let t=n,{split:s="words",stagger:i=.04,easing:l="ease-out",from:m={opacity:0,y:24},trigger:c={},once:p=true,onComplete:w}=r,D=window.matchMedia("(prefers-reduced-motion: reduce)").matches,T=typeof l=="function"?l:be[l]??be["ease-out"],me=Te(c.start??"top 85%"),He=Te(c.end??"top 40%"),Y=t.innerHTML,Le=t.textContent??"",N;s==="chars"?N=Tr(t):s==="lines"?N=Yt(t):N=Jt(t),Ut(t,Le);let te=N.length;function le(v,$){m?.opacity!==void 0&&(v.style.opacity=String(m.opacity+(1-m.opacity)*$));let pe=Mr($,m);pe&&(v.style.transform=pe);}function L(v){t.style.setProperty("--scroll-draw-progress",String(v)),N.forEach(($,pe)=>{let J=T(xr(v,pe,te,i));le($,J);});}if(D)return L(1),w?.(),{destroy(){t.innerHTML=Y;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};L(0);let _=0,k=0,C=0,q=false,x=false,S=-1,fe=0,I=false,ce=()=>window.scrollY,xe=()=>window.innerHeight;function $e(){let v=t.getBoundingClientRect(),$=De({top:v.top,height:v.height},ce(),xe(),me,He);_=$.tStart,k=$.tEnd;}function Me(){if(!q||x)return;let v=ae(ce(),_,k,1);p&&(S=Math.max(S,v),v=S),fe=v,L(v),v>=1&&!I?(I=true,w?.()):v<1&&!p&&(I=false),C=requestAnimationFrame(Me);}$e();let re=new IntersectionObserver(v=>{v.forEach($=>{q=$.isIntersecting,q&&!x?C=requestAnimationFrame(Me):cancelAnimationFrame(C);});}),z;function f(){clearTimeout(z),z=setTimeout(()=>{if(s==="lines"){let v=fe;t.innerHTML=Y,N=Yt(t),Ut(t,Le),L(v);}$e();},150);}window.addEventListener("resize",f),window.addEventListener("orientationchange",f);let P=Ve([t],f);return re.observe(t),Re(t,{type:"text",getProgress:()=>fe,getTrigger:()=>({tStart:_,tEnd:k})}),{destroy(){cancelAnimationFrame(C),re.disconnect(),window.removeEventListener("resize",f),window.removeEventListener("orientationchange",f),P(),clearTimeout(z),t.innerHTML=Y,Fe(t);},replay(){S=-1,I=false,fe=0,x=false,L(0);},pause(){x=true,cancelAnimationFrame(C);},resume(){x&&(x=false,q&&(C=requestAnimationFrame(Me)));},seek(v){let $=Math.min(1,Math.max(0,v));fe=$,S=$,x=true,cancelAnimationFrame(C),L($);},getProgress(){return fe}}}function Ar(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let t=typeof e=="string"?document.querySelector(e):e;return t?lt(t,r):(ee("Container not found:",e),n)}function Ze(){return typeof document>"u"?null:document}var wt=new WeakMap,Zt;function ct(e,r,n,t){let s=wt.get(e)??new Map;wt.set(e,s);let i=()=>{let c=n(),p=s.get(r);p&&p.key===c||(p?.inst.destroy(),s.set(r,{inst:t(c),key:c,build:i,users:p?.users??0}));};i(),s.get(r).users++;let l=true;typeof MutationObserver<"u"&&(Zt??(Zt=new MutationObserver(c=>c.forEach(p=>wt.get(p.target)?.forEach(w=>w.build())))),Zt.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(c=>`data-scroll-${c}-options`).concat("data-scroll-drawoptions")}));let m=()=>s.get(r)?.inst;return {destroy:()=>{let c=s.get(r);!l||!c||(l=false,!(--c.users>0)&&(c.inst.destroy(),s.delete(r)));},replay:()=>m()?.replay(),pause:()=>m()?.pause(),resume:()=>m()?.resume(),seek:c=>m()?.seek(c),getProgress:()=>m()?.getProgress()??0,refresh:()=>m()?.refresh?.()}}function ut(e,r){try{return e?JSON.parse(e):r}catch{return r}}function Lr(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(r=>ct(r,"draw",()=>r.dataset.scrollDrawOptions??r.dataset.scrollDrawoptions??"",n=>lt(r,ut(n,{})))):[]}function $r(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(r=>ct(r,"animate",()=>r.dataset.scrollAnimateOptions??"",n=>Gt(r,ut(n,{props:{}})))):[]}function Cr(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(r=>ct(r,"counter",()=>r.dataset.scrollCounterOptions??"",n=>{let t=ut(n,{});return !t.to&&t.to!==0&&(ee('initScrollCounter: element missing "to" in options JSON:',r),t.to=0),typeof t.format!="function"&&t.format!==void 0&&(ee('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',r),delete t.format),jt(r,t)})):[]}function Pr(e=Ze()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(r=>ct(r,"text",()=>r.dataset.scrollTextOptions??"",n=>Qt(r,ut(n,{})))):[]}function Dn(e=Ze()){return {draw:Lr(e),animate:$r(e),counter:Cr(e),text:Pr(e)}}exports.initAll=Dn;exports.initScrollAnimate=$r;exports.initScrollCounter=Cr;exports.initScrollDraw=Lr;exports.initScrollText=Pr;exports.scrollDraw=Ar;
|
package/dist/astro/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollDraw}from'../chunk-
|
|
1
|
+
export{a as scrollDraw}from'../chunk-SMRTRZSD.mjs';import {a as a$2}from'../chunk-426RAN5I.mjs';import {a as a$1}from'../chunk-KHQ7OGQK.mjs';import {a}from'../chunk-BFX2CSQ3.mjs';import {b}from'../chunk-ENACACPZ.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 {b as b$1}from'../chunk-LFSU6LR3.mjs';function i(){return typeof document>"u"?null:document}var p=new WeakMap,g;function c(r,t,n,o){let l=p.get(r)??new Map;p.set(r,l);let f=()=>{let e=n(),s=l.get(t);s&&s.key===e||(s?.inst.destroy(),l.set(t,{inst:o(e),key:e,build:f,users:s?.users??0}));};f(),l.get(t).users++;let S=true;typeof MutationObserver<"u"&&(g??(g=new MutationObserver(e=>e.forEach(s=>p.get(s.target)?.forEach(O=>O.build())))),g.observe(r,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(e=>`data-scroll-${e}-options`).concat("data-scroll-drawoptions")}));let a=()=>l.get(t)?.inst;return {destroy:()=>{let e=l.get(t);!S||!e||(S=false,!(--e.users>0)&&(e.inst.destroy(),l.delete(t)));},replay:()=>a()?.replay(),pause:()=>a()?.pause(),resume:()=>a()?.resume(),seek:e=>a()?.seek(e),getProgress:()=>a()?.getProgress()??0,refresh:()=>a()?.refresh?.()}}function u(r,t){try{return r?JSON.parse(r):t}catch{return t}}function E(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-draw]")).map(t=>c(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",n=>b(t,u(n,{})))):[]}function A(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-animate]")).map(t=>c(t,"animate",()=>t.dataset.scrollAnimateOptions??"",n=>a(t,u(n,{props:{}})))):[]}function I(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-counter]")).map(t=>c(t,"counter",()=>t.dataset.scrollCounterOptions??"",n=>{let o=u(n,{});return !o.to&&o.to!==0&&(b$1('initScrollCounter: element missing "to" in options JSON:',t),o.to=0),typeof o.format!="function"&&o.format!==void 0&&(b$1('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete o.format),a$1(t,o)})):[]}function M(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-text]")).map(t=>c(t,"text",()=>t.dataset.scrollTextOptions??"",n=>a$2(t,u(n,{})))):[]}function H(r=i()){return {draw:E(r),animate:A(r),counter:I(r),text:M(r)}}export{H as initAll,A as initScrollAnimate,I as initScrollCounter,E as initScrollDraw,M as initScrollText};
|
|
@@ -1119,6 +1119,9 @@ var SvgScrollDraw = (() => {
|
|
|
1119
1119
|
if (isVisible || inStaggerTail(scroll)) rafId = requestAnimationFrame(update);
|
|
1120
1120
|
else looping = false;
|
|
1121
1121
|
}
|
|
1122
|
+
function live() {
|
|
1123
|
+
return isVisible || inStaggerTail(scrollPos());
|
|
1124
|
+
}
|
|
1122
1125
|
let looping = false;
|
|
1123
1126
|
function startLoop() {
|
|
1124
1127
|
if (looping) return;
|
|
@@ -1189,7 +1192,7 @@ var SvgScrollDraw = (() => {
|
|
|
1189
1192
|
clearTimeout(repeatTimer);
|
|
1190
1193
|
resetPaths();
|
|
1191
1194
|
dirty = true;
|
|
1192
|
-
if (
|
|
1195
|
+
if (live()) startLoop();
|
|
1193
1196
|
},
|
|
1194
1197
|
pause() {
|
|
1195
1198
|
paused = true;
|
|
@@ -1199,7 +1202,7 @@ var SvgScrollDraw = (() => {
|
|
|
1199
1202
|
if (!paused) return;
|
|
1200
1203
|
paused = false;
|
|
1201
1204
|
dirty = true;
|
|
1202
|
-
if (
|
|
1205
|
+
if (live()) startLoop();
|
|
1203
1206
|
},
|
|
1204
1207
|
seek(progress) {
|
|
1205
1208
|
const p = Math.min(1, Math.max(0, progress));
|
|
@@ -1224,7 +1227,7 @@ var SvgScrollDraw = (() => {
|
|
|
1224
1227
|
refresh() {
|
|
1225
1228
|
clearTimeout(resizeTimer);
|
|
1226
1229
|
remeasure();
|
|
1227
|
-
if (
|
|
1230
|
+
if (live() && !paused) startLoop();
|
|
1228
1231
|
}
|
|
1229
1232
|
}, () => ({ tStart, tEnd }));
|
|
1230
1233
|
}
|