svg-scroll-draw 2.17.0 → 2.18.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 +3 -2
- package/dist/angular/index.cjs +2 -2
- 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 +5 -2
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/{chunk-ZZCTLVGT.mjs → chunk-CTVQDBD3.mjs} +1 -1
- package/dist/{chunk-OWMO2S3V.mjs → chunk-DIMNQPW5.mjs} +1 -1
- package/dist/chunk-LINFV2GK.mjs +3 -0
- package/dist/chunk-TIRZOSQ4.mjs +1 -0
- 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 +2 -2
- 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 +2 -2
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +11 -0
- package/dist/video/index.d.ts +11 -0
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- 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-JC5BD4RB.mjs +0 -1
- package/dist/chunk-WDIHLRZZ.mjs +0 -3
package/README.md
CHANGED
|
@@ -219,6 +219,7 @@ import { ScrollVideo } from 'svg-scroll-draw/react';
|
|
|
219
219
|
| `easing` | `string \| fn` | `"linear"` | — |
|
|
220
220
|
| `once` | `boolean` | `false` | — |
|
|
221
221
|
| `preload` | `"auto" \| "metadata"` | `"auto"` | Sets `preload` attribute if not already present |
|
|
222
|
+
| `triggerElement` | `Element` | the video | Measure the trigger window from this element — the tall track behind a `position: sticky` stage, so a pinned film scrubs the length of the pin (2.18.0) |
|
|
222
223
|
| `onReady` | `() => void` | — | Fires when video metadata is loaded |
|
|
223
224
|
| `onProgress` | `(n: number) => void` | — | — |
|
|
224
225
|
| `onComplete` | `() => void` | — | — |
|
|
@@ -629,8 +630,8 @@ devtools.highlight('#my-element'); // outline for 2 seconds
|
|
|
629
630
|
| Entry | Gzipped |
|
|
630
631
|
|---|---|
|
|
631
632
|
| `svg-scroll-draw` (main, every core API) | 10.7 KB |
|
|
632
|
-
| `svg-scroll-draw/react` (includes the engine) | 12.
|
|
633
|
-
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 13.
|
|
633
|
+
| `svg-scroll-draw/react` (includes the engine) | 12.1 KB |
|
|
634
|
+
| `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 13.5 KB |
|
|
634
635
|
| `svg-scroll-draw/reveal` | 5.0 KB |
|
|
635
636
|
| `svg-scroll-draw/text` | 2.8 KB |
|
|
636
637
|
| `svg-scroll-draw/video` | 2.3 KB |
|
package/dist/angular/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function Zt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<r;d++){let S=Math.pow(l,d);c.push(S),s+=S;}let u=[0],m=0;for(let d=0;d<r;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let S=0;S<r;S++)if(d<=u[S+1]){let z=(d-u[S])/(u[S+1]-u[S]);if(S===0)return z*(2-z);let L=1-Math.pow(t,S);return L+(1-L)*(2*z-1)*(2*z-1)}return 1}}function Jt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var te={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Zt(),elastic:Jt()};function ht(e,n,r){return Math.min(r,Math.max(n,e))}function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function bt(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 wt(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 J(e,n,r,t){return r===n?0:ht((e-n)/(r-n)*t,0,1)}function xe(e,n,r,t,l){let s=bt(e.top,e.height,n,t.element)-wt(t.viewport,r),c=bt(e.top,e.height,n,l.element)-wt(l.viewport,r);return {tStart:s,tEnd:c}}function Je(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function qe(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 vt(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 We(e,n,r){let t=vt(e),l=vt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var Et={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 je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ge(e,...n){je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var er="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",tr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function rr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function nr(e){let n=[];for(let r=0;r<St;r++){let t=r/(St-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return er;case "ease-out":return tr;case "ease-in-out":return rr()?nr(te["ease-in-out"]):null;default:return null}}var Tt=Symbol.for("svg-scroll-draw.registry");function xt(){let e=globalThis;return e[Tt]||(e[Tt]=new Map)}function $e(e,n){xt().set(e,n);}function Pe(e){xt().delete(e);}var or=0;function sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Mt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var At=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function ir(e){if(!je)return;let n=Mt(e,"stroke");if(!n||n==="none"){ge("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!At.has(r)&&!At.has(Mt(e,"fill"))&&ge("Element has a fill \u2014 it may obscure the stroke animation.",e);}function ar(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var At=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Lt=/[MmLlHhVvCcSsQqTtAaZz]/g;function ar(e,n,r){if(!Ge)return;let t=(e.match(Lt)??[]).join("").toUpperCase(),l=(n.match(Lt)??[]).join("").toUpperCase(),s=(e.match(At)??[]).length,c=(n.match(At)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function st(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function $t(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...vt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:M="forward",once:ne=false,debug:Pe=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:A,strokeWidth:P,fillOpacity:L,waypoints:w,velocityScale:O=false,threshold:I=0,rootMargin:C="0px",repeat:E=0,repeatDelay:oe=0,morphTo:F,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:$,onLeave:S,onEnterBack:N,onLeaveBack:fe}=l,K=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,Ce=de(T.start??"top bottom"),Ve=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(A)?A[0]:null,le=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ce=Array.isArray(P)?P[0]:null,j=Array.isArray(P)?P[1]:typeof P=="number"?P:null,pe=Array.isArray(L)?L[0]:null,Q=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function ke(o){let a=o*100;switch(K){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=K?[]:Array.from(e.querySelectorAll(c)),k=[],i=[],f=0,ge=0,R=false,z=false,q=0,Me=false,ye=-1,te=-1,U=false,he=0,Ie=0,De,et=null;function lt(){et?.destroy(),et=null;}let Ne=new Set,ct=NaN,Re=true,je=-1,ut=performance.now(),_e=NaN;function tt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function mt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Ze(e,ve,B);return xe(o,o.scroll,mt(),Ce,Ve)}function pt(){(({tStart:f,tEnd:ge}=ft())),Pe&&Ge&&(lt(),et=ir(f,ge,B));}function rt(o,a=ft){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Ut(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let b=a==="reverse"?1-o:o;e.style.clipPath=ke(b);return}_.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${k[ue]*o}`:`${k[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=qe(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),F&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",st(i[ue],F,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=ke(0);return}_.forEach((o,a)=>{o.style.strokeDasharray=`${k[a]}`,o.style.strokeDashoffset=M==="reverse"?"0":`${k[a]}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),F&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(_.forEach(o=>{sr(o);let a=ze(o);k.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),F&&(b?ar(i[i.length-1],F,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=M==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Q!==null&&(o.style.fillOpacity=`${Q}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=M==="reverse"?"0":`${a}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),K){if(s)return e.style.clipPath=ke(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof p=="string"?Je(p):null;function Yt(){return !(ae===false||!or()||!_.length||!dt||K||B!=="y"||ve||u!==1||V!==0||ne||X||O!==false||F||w||E||G>0||d||x||g||$||S||N||fe||A!=null||P!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Xt(){let o=++nr,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Fe=M==="reverse"?"0":"var(--ssd-len)",Oe=M==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${Oe};`;m&&(Ae+=`opacity:${M==="reverse"?1:0};`,v+=`opacity:${M==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}_.forEach(me);let h=false,H=-1;function W(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Te}=xe({top:y.top,height:y.height},tt(),mt(),Ce,Ve);return Se(Z(tt(),Y,Te,u))}return {destroy(){e.classList.remove(b),_.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),D.remove();},replay(){h=false,H=-1,_.forEach(me);},pause(){h=true,_.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,_.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));H=Y,h=true,_.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=M==="reverse"?`${k[be]*Y}`:`${k[be]*(1-Y)}`,m&&(Te.style.opacity=M==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return W()},refresh(){_.forEach((y,Y)=>{k[Y]=ze(y),y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`;});}}}if(Yt())return rt(Xt());function Kt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Fe(h){let H=true;if(K){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=ke(M==="reverse"?1-y:y),d?.(y),W<1&&(H=false);}else _.forEach((W,y)=>{let Y=y*V*o,Te=Math.min(1,Math.max(0,(h-Y)/o)),be=Se(Te);W.style.strokeDashoffset=M==="reverse"?`${k[y]*be}`:`${k[y]*(1-be)}`,m&&(W.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=qe(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Q!==null?W.style.fillOpacity=`${pe+(Q-pe)*be}`:Q!==null&&(W.style.fillOpacity=`${Q}`),F&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",st(i[y],F,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(H=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);for(let Y in w){let Te=parseFloat(Y);y>=Te&&!Ne.has(Te)&&(Ne.add(Te),w[Y]?.());}}return H}function Oe(h){if(U)return;let H=h-a;z||(z=true,x?.());let W=Fe(H);if(W&&!R){R=true,Fe(o*(1+Math.max(0,_.length-1)*V)),g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,De=setTimeout(()=>{a=performance.now(),z=false,R=false,Ne.clear(),Ue(),q=requestAnimationFrame(Oe);},oe));return}W||(q=requestAnimationFrame(Oe));}function Ae(){cancelAnimationFrame(q),clearTimeout(De),a=performance.now(),b=0,U=false,z=false,R=false,Ie=0,ue=true,he=0,Ne.clear(),Ue(),q=requestAnimationFrame(Oe);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(ne&&R)?Ae():!H.isIntersecting&&!ne&&!R&&(cancelAnimationFrame(q),clearTimeout(De),ue=false);});},{root:ve??null,threshold:I,rootMargin:C}),D;function me(){clearTimeout(D),D=setTimeout(()=>{_.forEach((h,H)=>{k[H]=ze(h),h.style.strokeDasharray=`${k[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(De),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(D);},replay(){Ie=0,Ae();},pause(){U||!ue||(U=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(Oe));},seek(h){let H=Math.min(1,Math.max(0,h));he=H,U=true,b=H*o,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return he},refresh(){clearTimeout(D),_.forEach((h,H)=>{k[H]=ze(h),h.style.strokeDasharray=`${k[H]}`;});}}}if(ie)return rt(Kt());pt();function Ye(){if(!Me||U)return;let o=performance.now(),a=tt();if(!Re&&O===false&&a===ct){q=requestAnimationFrame(Ye);return}Re=false,ct=a;let b=u;if(O!==false){let v=o-ut,D=v>0?Math.abs(a-(je<0?a:je))/v:0;b=u*Math.max(.2,1+D*(typeof O=="number"?O:1)*.04);}je=a,ut=o;let ue=X?te===-1||a>=te?"forward":"reverse":M;te=a;let Fe=ge-f,Oe=true,Ae=Fe===0?0:(a-f)/Fe;if(isNaN(_e)||(_e<=0&&Ae>0?$?.():_e>0&&Ae<=0&&fe?.(),_e<1&&Ae>=1?S?.():_e>=1&&Ae<1&&N?.()),_e=Ae,K){let v=Se(Z(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let D=ue==="reverse"?1-v:v;e.style.clipPath=ke(D),d?.(v),!z&&Z(a,f,ge,b)>0&&(z=true,x?.()),v>=1&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,De=setTimeout(()=>{ye=-1,z=false,R=false,e.style.clipPath=ke(0);},oe))):v<1&&!ne&&(R=false),q=requestAnimationFrame(Ye);return}if(_.forEach((v,D)=>{let me=D*V*Fe,h=Se(Z(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${k[D]*h}`:`${k[D]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=qe(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),F&&v.tagName.toLowerCase()==="path"&&i[D]&&v.setAttribute("d",st(i[D],F,h)),D===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Oe=false);}),w){let v=Se(Z(a,f,ge,b));for(let D in w){let me=parseFloat(D);v>=me&&!Ne.has(me)&&(Ne.add(me),w[D]?.());}}!z&&Z(a,f,ge,b)>0&&(z=true,x?.()),Oe&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,De=setTimeout(()=>{ye=-1,z=false,R=false,Ne.clear(),Ue(),Re=true;},oe))):!Oe&&!ne&&(R=false),q=requestAnimationFrame(Ye);}let nt=false;function Xe(){nt||(nt=true,q=requestAnimationFrame(function(){Ye();}));}function Ke(){nt=false,cancelAnimationFrame(q);}let ot=new IntersectionObserver(o=>{o.forEach(a=>{Me=a.isIntersecting,Me&&!U?(Re=true,Xe()):Ke();});},{root:ve??null,threshold:I,rootMargin:C});function gt(){_.forEach((o,a)=>{k[a]=ze(o),o.style.strokeDasharray=`${k[a]}`;}),pt(),Re=true;}let Qe;function We(){clearTimeout(Qe),Qe=setTimeout(gt,150);}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Be;return typeof ResizeObserver<"u"&&(Be=new ResizeObserver(()=>We()),Be.observe(document.body),Be.observe(document.documentElement),Be.observe(e)),G>0?setTimeout(()=>ot.observe(e),G):ot.observe(e),rt({destroy(){cancelAnimationFrame(q),clearTimeout(De),Ke(),ot.disconnect(),Be?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Qe),lt();},replay(){ye=-1,te=-1,je=-1,z=false,R=false,Ie=0,U=false,he=0,Ne.clear(),clearTimeout(De),Ue(),Re=true,Me&&Xe();},pause(){U=true,Ke();},resume(){U&&(U=false,Re=true,Me&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,U=true,Ke(),Ut(a,M),Re=true;},getProgress(){return he},refresh(){clearTimeout(Qe),gt(),Me&&!U&&Xe();}},()=>({tStart:f,tEnd:ge}))}var Pt=new WeakMap,lr=0;function it(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Pt.get(r);return t===void 0&&Pt.set(r,t=++lr),`el#${t}`}return r})}function Ct(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...l)=>n()[t]?.(...l));return r}function cr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function kt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function ur(e,n,r){let t=kt(e),l=kt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function Ot(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(cr(t))return qe(t,l,r);if(t.includes("("))return ur(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function mr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var fr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),pr=0,It="--scroll-draw-progress";function dr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ft(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:M=true,triggerElement:ne,onProgress:Pe,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:A}=n,P=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),O=de(l.end??"bottom top"),I=ne??e,C=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:mr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function F(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),It])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(P)return F(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?Je(s):null;function ae(){if(!T||!dr()||!ee||m!=="y"||C||I!==e||u||c!==1||Pe||B||J||X||G||A||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!fr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++pr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},z(),q(),w,O)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let U=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of E)e.style.setProperty(he.prop,Ot(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Me();return L(Z(z(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,$=0,S=false,N=false,fe=-1,K=0,Se=false,Ce=NaN,Ve=-1,ve=0,Ee=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Ze(I,C,m),f=xe(i,i.scroll,le(),w,O);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(It,String(i));for(let f of E)e.style.setProperty(f.prop,Ot(f.from,f.to,i));Pe?.(i);}function pe(i){if(isNaN(Ce)){Ce=i;return}Ce<=0&&i>0?J?.():Ce>0&&i<=0&&A?.(),Ce<1&&i>=1?X?.():Ce>=1&&i<1&&G?.(),Ce=i;}function Q(){if(!S||N)return;let i=performance.now(),f=Ee(),ge=c;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(Ve<0?f:Ve))/q:0;ge=c*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}Ve=f,ve=i;let R=g===x?0:(f-x)/(g-x);pe(R);let z=L(Z(f,x,g,ge));u&&(fe=Math.max(fe,z),z=fe),K=z,j(z),z>=1&&!Se?(Se=true,B?.()):z<1&&!u&&(Se=false),$=requestAnimationFrame(Q);}ce(),g===x&&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 i=L(Z(Ee(),x,g,c));u&&i>0&&(fe=i),K=i,j(i);}let ke=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!N?$=requestAnimationFrame(Q):cancelAnimationFrame($);});},{root:C??null}),_;function k(){clearTimeout(_),_=setTimeout(ce,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),ke.observe(e),Le(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),ke.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(_),ie(),$e(e);},replay(){fe=-1,Se=false,K=0,N=false,j(0);},pause(){N=true,cancelAnimationFrame($);},resume(){N&&(N=false,S&&($=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));K=f,fe=f,N=true,cancelAnimationFrame($),j(f);},getProgress(){return K}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Dt(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,M=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Pe=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(s),V?.(),at;let X=0,G=0,A=0,P=false,L=false,w=-1,O=0,I=false,C=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},C(),E(),Pe,B);X=x.tStart,G=x.tEnd;}function F(d){t.textContent=M(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!P||L)return;let d=ne(Z(C(),X,G,1));p&&(w=Math.max(w,d),d=w),O=d,F(d),d>=1&&!I?(I=true,V?.()):d<1&&!p&&(I=false),A=requestAnimationFrame(se);}oe();{let d=ne(Z(C(),X,G,1));p&&d>0&&(w=d),O=d,F(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{P=x.isIntersecting,P&&!L?A=requestAnimationFrame(se):cancelAnimationFrame(A);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(A),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,I=false,O=0,L=false,F(0);},pause(){L=true,cancelAnimationFrame(A);},resume(){L&&(L=false,P&&(A=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));O=x,w=x,L=true,cancelAnimationFrame(A),F(x);},getProgress(){return O}}}var Nt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Rt(e,n={}){if(typeof window>"u")return Nt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Nt;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Pe=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,A=0,P=0,L=false,w=false,O=-1,I=0,C=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),N=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,K=xe({top:N,height:fe},oe(),F(),Pe,B);G=K.tStart,A=K.tEnd;}let ie=NaN;function ee(S){if(!E)return;let N=X??t.duration??0,fe=J+(N-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!L||w||!E||M)return;let S=ne(Z(oe(),G,A,1));c&&(O=Math.max(O,S),S=O),I=S,ee(S),S>=1&&!C?(C=true,T?.()):S<1&&!c&&(C=false),P=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),M){ee(1),p?.();return}se(),p?.(),L&&!w&&(P=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(N=>{L=N.isIntersecting,L&&!w&&E?P=requestAnimationFrame(ae):cancelAnimationFrame(P);});}),g;function $(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),x.observe(t),Le(t,{type:"video",getProgress:()=>I,getTrigger:()=>({tStart:G,tEnd:A})}),{destroy(){cancelAnimationFrame(P),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(g),$e(t);},replay(){O=-1,C=false,I=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(P);},resume(){w&&(w=false,L&&E&&(P=requestAnimationFrame(ae)));},seek(S){let N=Math.min(1,Math.max(0,S));I=N,O=N,w=true,cancelAnimationFrame(P),ie=NaN,ee(N);},getProgress(){return I}}}function _t(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 gr(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 Ht(e){let n=_t(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function yr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function hr(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 Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function zt(e,n={}){if(typeof window>"u")return Vt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Vt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Pe=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=gr(t):l==="lines"?J=Ht(t):J=_t(t);let X=J.length;function G(g,$){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*$));let S=hr($,u);S&&(g.style.transform=S);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach(($,S)=>{let N=M(yr(g,S,X,s));G($,N);});}if(V)return A(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let P=0,L=0,w=0,O=false,I=false,C=-1,E=0,oe=false,F=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=xe({top:g.top,height:g.height},F(),se(),ne,Pe);P=$.tStart,L=$.tEnd;}function ee(){if(!O||I)return;let g=Z(F(),P,L,1);p&&(C=Math.max(C,g),g=C),E=g,A(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach($=>{O=$.isIntersecting,O&&!I?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Ht(t),A(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:P,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){C=-1,oe=false,E=0,I=false,A(0);},pause(){I=true,cancelAnimationFrame(w);},resume(){I&&(I=false,O&&(w=requestAnimationFrame(ee)));},seek(g){let $=Math.min(1,Math.max(0,g));E=$,C=$,I=true,cancelAnimationFrame(w),A($);},getProgress(){return E}}}var He=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=it(r),this.instance=this.create(n,Ct(r,()=>this.latest)),this}update(n){return this.el?it(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}},qt=class extends He{constructor(){super($t);}init(n,r={}){return super.init(n,r)}},Wt=class extends He{constructor(){super(Ft);}},Bt=class extends He{constructor(){super(Dt);}},Gt=class extends He{constructor(){super(Rt);}init(n,r={}){return super.init(n,r)}},jt=class extends He{constructor(){super(zt);}init(n,r={}){return super.init(n,r)}};exports.EngineRef=He;exports.ScrollAnimateRef=Wt;exports.ScrollCounterRef=Bt;exports.ScrollDrawRef=qt;exports.ScrollTextRef=jt;exports.ScrollVideoRef=Gt;
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Lt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,$t=/[MmLlHhVvCcSsQqTtAaZz]/g;function lr(e,n,r){if(!je)return;let t=(e.match($t)??[]).join("").toUpperCase(),l=(n.match($t)??[]).join("").toUpperCase(),s=(e.match(Lt)??[]).length,c=(n.match(Lt)??[]).length;if(t!==l){ge(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&ge(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function Pt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...Et[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:S={},stagger:z=0,direction:L="forward",once:re=false,debug:Me=false,axis:B="y",scrollContainer:ne,autoReverse:oe=false,delay:Y=0,strokeColor:M,strokeWidth:N,fillOpacity:$,waypoints:w,velocityScale:I=false,threshold:C=0,rootMargin:P="0px",repeat:T=0,repeatDelay:X=0,morphTo:x,clip:fe,autoplay:be=false,duration:se=1e3,native:ie=true,onProgress:p,onStart:E,onComplete:g,onEnter:k,onLeave:ae,onEnterBack:ee,onLeaveBack:A}=l,F=fe===true?"left":typeof fe=="string"?fe:false,K=typeof d=="function"?d:te[d]??te.linear,we=de(S.start??"top bottom"),Ve=de(S.end??"bottom top"),ve=typeof ne=="string"?document.querySelector(ne):ne??null,Ee=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(N)?N[0]:null,G=Array.isArray(N)?N[1]:typeof N=="number"?N:null,pe=Array.isArray($)?$[0]:null,Q=Array.isArray($)?$[1]:typeof $=="number"?$:null;function Ce(o){let a=o*100;switch(F){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=F?[]:Array.from(e.querySelectorAll(c)),O=[],i=[],f=0,ye=0,R=false,_=false,q=0,Ae=false,Se=-1,Z=[],De=-1,j=false,ke=0,Ie=0,Ne,tt=null;function ct(){tt?.destroy(),tt=null;}let Re=new Set,ut=NaN,He=true,Ue=-1,mt=performance.now(),_e=NaN;function rt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function ft(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function pt(){let o=Je(e,ve,B);return xe(o,o.scroll,ft(),we,Ve)}function dt(){(({tStart:f,tEnd:ye}=pt())),Me&&je&&(ct(),tt=ar(f,ye,B));}function nt(o,a=pt){$e(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Pe(e);},o}function Yt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),F){let b=a==="reverse"?1-o:o;e.style.clipPath=Ce(b);return}V.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${O[ue]*o}`:`${O[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=We(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&G!==null?b.style.strokeWidth=`${ce+(G-ce)*o}`:G!==null&&(b.style.strokeWidth=`${G}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),x&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],x,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),F){e.style.clipPath=Ce(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${O[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${O[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),x&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{ir(o);let a=qe(o);O.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),x&&(b?lr(i[i.length-1],x,o):ge(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),G!==null&&(o.style.strokeWidth=`${G}`),Q!==null&&(o.style.fillOpacity=`${Q}`),x&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",x)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),F){if(s)return e.style.clipPath=Ce(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ce(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof d=="string"?et(d):null;function Xt(){return !(ie===false||!sr()||!V.length||!gt||F||B!=="y"||ve||u!==1||z!==0||re||oe||I!==false||x||w||T||Y>0||p||E||g||k||ae||ee||A||M!=null||N!=null||$!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Kt(){let o=++or,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Fe=L==="reverse"?"0":"var(--ssd-len)",Oe=L==="reverse"?"var(--ssd-len)":"0",Le=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${Oe};`;m&&(Le+=`opacity:${L==="reverse"?1:0};`,v+=`opacity:${L==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Le}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(O[U])),y.style.strokeDasharray=`${O[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}V.forEach(me);let h=false,H=-1;function W(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},rt(),ft(),we,Ve);return K(J(rt(),U,Te,u))}return {destroy(){e.classList.remove(b),V.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),D.remove();},replay(){h=false,H=-1,V.forEach(me);},pause(){h=true,V.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,V.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));H=U,h=true,V.forEach((Te,he)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${O[he]*U}`:`${O[he]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){V.forEach((y,U)=>{O[U]=qe(y),y.style.setProperty("--ssd-len",String(O[U])),y.style.strokeDasharray=`${O[U]}`;});}}}if(Xt())return nt(Kt());function Qt(){let o=Math.max(1,se),a=0,b=0,ue=false;function Fe(h){let H=true;if(F){let W=Math.min(1,Math.max(0,h/o)),y=K(W);ke=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Ce(L==="reverse"?1-y:y),p?.(y),W<1&&(H=false);}else V.forEach((W,y)=>{let U=y*z*o,Te=Math.min(1,Math.max(0,(h-U)/o)),he=K(Te);W.style.strokeDashoffset=L==="reverse"?`${O[y]*he}`:`${O[y]*(1-he)}`,m&&(W.style.opacity=L==="reverse"?`${1-he}`:`${he}`),Ee&&le?W.style.stroke=We(Ee,le,he):le&&(W.style.stroke=le),ce!==null&&G!==null?W.style.strokeWidth=`${ce+(G-ce)*he}`:G!==null&&(W.style.strokeWidth=`${G}`),pe!==null&&Q!==null?W.style.fillOpacity=`${pe+(Q-pe)*he}`:Q!==null&&(W.style.fillOpacity=`${Q}`),x&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],x,he)),y===0&&(ke=he,p?.(he),e.style.setProperty("--scroll-draw-progress",String(he))),Te<1&&(H=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=K(W);for(let U in w){let Te=parseFloat(U);y>=Te&&!Re.has(Te)&&(Re.add(Te),w[U]?.());}}return H}function Oe(h){if(j)return;let H=h-a;_||(_=true,E?.());let W=Fe(H);if(W&&!R){R=true,Fe(o*(1+Math.max(0,V.length-1)*z)),g?.(),Ie<(T==="infinite"?1/0:T??0)&&(Ie++,Ne=setTimeout(()=>{a=performance.now(),_=false,R=false,Re.clear(),Ye(),q=requestAnimationFrame(Oe);},X));return}W||(q=requestAnimationFrame(Oe));}function Le(){cancelAnimationFrame(q),clearTimeout(Ne),a=performance.now(),b=0,j=false,_=false,R=false,Ie=0,ue=true,ke=0,Re.clear(),Ye(),q=requestAnimationFrame(Oe);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(re&&R)?Le():!H.isIntersecting&&!re&&!R&&(cancelAnimationFrame(q),clearTimeout(Ne),ue=false);});},{root:ve??null,threshold:C,rootMargin:P}),D;function me(){clearTimeout(D),D=setTimeout(()=>{V.forEach((h,H)=>{O[H]=qe(h),h.style.strokeDasharray=`${O[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),Y>0?setTimeout(()=>v.observe(e),Y):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Ne),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(D);},replay(){Ie=0,Le();},pause(){j||!ue||(j=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){j&&(j=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(Oe));},seek(h){let H=Math.min(1,Math.max(0,h));ke=H,j=true,b=H*o,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return ke},refresh(){clearTimeout(D),V.forEach((h,H)=>{O[H]=qe(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(be)return nt(Qt());dt();function Xe(){if(!Ae||j)return;let o=performance.now(),a=rt();if(!He&&I===false&&a===ut){q=requestAnimationFrame(Xe);return}He=false,ut=a;let b=u;if(I!==false){let v=o-mt,D=v>0?Math.abs(a-(Ue<0?a:Ue))/v:0;b=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}Ue=a,mt=o;let ue=oe?De===-1||a>=De?"forward":"reverse":L;De=a;let Fe=ye-f,Oe=true,Le=Fe===0?0:(a-f)/Fe;if(isNaN(_e)||(_e<=0&&Le>0?k?.():_e>0&&Le<=0&&A?.(),_e<1&&Le>=1?ae?.():_e>=1&&Le<1&&ee?.()),_e=Le,F){let v=K(J(a,f,ye,b));re&&!oe&&(Se=Math.max(Se,v),v=Se),ke=v,e.style.setProperty("--scroll-draw-progress",String(v));let D=ue==="reverse"?1-v:v;e.style.clipPath=Ce(D),p?.(v),!_&&J(a,f,ye,b)>0&&(_=true,E?.()),v>=1&&!R?(R=true,g?.(),Ie<(T==="infinite"?1/0:T??0)&&(Ie++,Ne=setTimeout(()=>{Se=-1,_=false,R=false,e.style.clipPath=Ce(0);},X))):v<1&&!re&&(R=false),q=requestAnimationFrame(Xe);return}if(V.forEach((v,D)=>{let me=D*z*Fe,h=K(J(a,f+me,ye+me,b));re&&!oe&&(h=Z[D]=Math.max(Z[D]??Se,h)),ke=h,v.style.strokeDashoffset=ue==="reverse"?`${O[D]*h}`:`${O[D]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=We(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&G!==null?v.style.strokeWidth=`${ce+(G-ce)*h}`:G!==null&&(v.style.strokeWidth=`${G}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),x&&v.tagName.toLowerCase()==="path"&&i[D]&&v.setAttribute("d",it(i[D],x,h)),D===0&&(p?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Oe=false);}),w){let v=K(J(a,f,ye,b));for(let D in w){let me=parseFloat(D);v>=me&&!Re.has(me)&&(Re.add(me),w[D]?.());}}!_&&J(a,f,ye,b)>0&&(_=true,E?.()),Oe&&!R?(R=true,g?.(),Ie<(T==="infinite"?1/0:T??0)&&(Ie++,Ne=setTimeout(()=>{Se=-1,Z=[],_=false,R=false,Re.clear(),Ye(),He=true;},X))):!Oe&&!re&&(R=false),q=requestAnimationFrame(Xe);}let ot=false;function Ke(){ot||(ot=true,q=requestAnimationFrame(function(){Xe();}));}function Qe(){ot=false,cancelAnimationFrame(q);}let st=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!j?(He=true,Ke()):Qe();});},{root:ve??null,threshold:C,rootMargin:P});function yt(){V.forEach((o,a)=>{O[a]=qe(o),o.style.strokeDasharray=`${O[a]}`;}),dt(),He=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(yt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),Y>0?setTimeout(()=>st.observe(e),Y):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(Ne),Qe(),st.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),ct();},replay(){Se=-1,Z=[],De=-1,Ue=-1,_=false,R=false,Ie=0,j=false,ke=0,Re.clear(),clearTimeout(Ne),Ye(),He=true,Ae&&Ke();},pause(){j=true,Qe();},resume(){j&&(j=false,He=true,Ae&&Ke());},seek(o){let a=Math.min(1,Math.max(0,o));ke=a,Se=a,Z=[],j=true,Qe(),Yt(a,L),He=true;},getProgress(){return ke},refresh(){clearTimeout(Ze),yt(),Ae&&!j&&Ke();}},()=>({tStart:f,tEnd:ye}))}var Ct=new WeakMap,cr=0;function at(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Ct.get(r);return t===void 0&&Ct.set(r,t=++cr),`el#${t}`}return r})}function kt(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...l)=>n()[t]?.(...l));return r}function ur(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ot(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function mr(e,n,r){let t=Ot(e),l=Ot(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function It(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(ur(t))return We(t,l,r);if(t.includes("("))return mr(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function fr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var pr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),dr=0,Ft="--scroll-draw-progress";function gr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Dt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:S=true,velocityScale:z=false,respectReducedMotion:L=true,triggerElement:re,onProgress:Me,onComplete:B,onEnter:ne,onLeave:oe,onEnterBack:Y,onLeaveBack:M}=n,N=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=typeof s=="function"?s:te[s]??te["ease-out"],w=de(l.start??"top bottom"),I=de(l.end??"bottom top"),C=re??e,P=typeof d=="string"?document.querySelector(d):d??null,T=Object.entries(t).map(([i,f])=>({prop:fr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function X(){let i=window.getComputedStyle(e);for(let f of T)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function x(){for(let i of T)e.style.setProperty(i.prop,String(i.to));}let fe=new Map;for(let i of [...T.map(f=>f.prop),Ft])fe.set(i,e.style.getPropertyValue(i));function be(){for(let[i,f]of fe)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(N)return x(),B?.(),{...r,destroy:be,getProgress:()=>1};X();let se=typeof s=="string"?et(s):null;function ie(){if(!S||!gr()||!se||m!=="y"||P||C!==e||u||c!==1||Me||B||ne||oe||Y||M||z!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of T)if(!pr.has(i.prop))return false;return true}function p(){let i=`ssd-a-${++dr}`,f=T.map(Z=>`${Z.prop}:${Z.from}`).join(";"),ye=T.map(Z=>`${Z.prop}:${Z.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ye}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${se};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let Z=e.getBoundingClientRect();return xe({top:Z.top,height:Z.height},_(),q(),w,I)};$e(e,{type:"animate",getProgress:()=>Se.getProgress(),getTrigger:Ae});let Se={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",be(),Pe(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Z){let De=Math.min(1,Math.max(0,Z));e.classList.remove(i);for(let j of T)e.style.setProperty(j.prop,It(j.from,j.to,De));},getProgress(){let{tStart:Z,tEnd:De}=Ae();return $(J(_(),Z,De,c))}};return Se}if(ie())return p();let E=0,g=0,k=0,ae=false,ee=false,A=-1,F=0,K=false,we=NaN,Ve=-1,ve=0,Ee=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Je(C,P,m),f=xe(i,i.scroll,le(),w,I);E=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Ft,String(i));for(let f of T)e.style.setProperty(f.prop,It(f.from,f.to,i));Me?.(i);}function pe(i){if(isNaN(we)){we=i;return}we<=0&&i>0?ne?.():we>0&&i<=0&&M?.(),we<1&&i>=1?oe?.():we>=1&&i<1&&Y?.(),we=i;}function Q(){if(!ae||ee)return;let i=performance.now(),f=Ee(),ye=c;if(z!==false){let q=i-ve,Ae=q>0?Math.abs(f-(Ve<0?f:Ve))/q:0;ye=c*Math.max(.2,1+Ae*(typeof z=="number"?z:1)*.04);}Ve=f,ve=i;let R=g===E?0:(f-E)/(g-E);pe(R);let _=$(J(f,E,g,ye));u&&(A=Math.max(A,_),_=A),F=_,G(_),_>=1&&!K?(K=true,B?.()):_<1&&!u&&(K=false),k=requestAnimationFrame(Q);}ce(),g===E&&ge("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=$(J(Ee(),E,g,c));u&&i>0&&(A=i),F=i,G(i);}let Ce=new IntersectionObserver(i=>{i.forEach(f=>{ae=f.isIntersecting,ae&&!ee?k=requestAnimationFrame(Q):cancelAnimationFrame(k);});},{root:P??null}),V;function O(){clearTimeout(V),V=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),Ce.observe(e),$e(e,{type:"animate",getProgress:()=>F,getTrigger:()=>({tStart:E,tEnd:g})}),{destroy(){cancelAnimationFrame(k),Ce.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(V),be(),Pe(e);},replay(){A=-1,K=false,F=0,ee=false,G(0);},pause(){ee=true,cancelAnimationFrame(k);},resume(){ee&&(ee=false,ae&&(k=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));F=f,A=f,ee=true,cancelAnimationFrame(k),G(f);},getProgress(){return F}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nt(e,n){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ge("scrollCounter: element not found:",e),lt;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:z}=n,L=S!==void 0?p=>p.toFixed(S):c??(p=>String(Math.round(p))),re=typeof u=="function"?u:te[u]??te["ease-out"],Me=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),z?.(),lt;let oe=0,Y=0,M=0,N=false,$=false,w=-1,I=0,C=false,P=()=>window.scrollY,T=()=>window.innerHeight;function X(){let p=t.getBoundingClientRect(),E=xe({top:p.top,height:p.height},P(),T(),Me,B);oe=E.tStart,Y=E.tEnd;}function x(p){t.textContent=L(l+(s-l)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function fe(){if(!N||$)return;let p=re(J(P(),oe,Y,1));d&&(w=Math.max(w,p),p=w),I=p,x(p),p>=1&&!C?(C=true,z?.()):p<1&&!d&&(C=false),M=requestAnimationFrame(fe);}X();{let p=re(J(P(),oe,Y,1));d&&p>0&&(w=p),I=p,x(p);}let be=new IntersectionObserver(p=>{p.forEach(E=>{N=E.isIntersecting,N&&!$?M=requestAnimationFrame(fe):cancelAnimationFrame(M);});}),se;function ie(){clearTimeout(se),se=setTimeout(X,150);}return window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie),be.observe(t),$e(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:oe,tEnd:Y})}),{destroy(){cancelAnimationFrame(M),be.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),clearTimeout(se),Pe(t);},replay(){w=-1,C=false,I=0,$=false,x(0);},pause(){$=true,cancelAnimationFrame(M);},resume(){$&&($=false,N&&(M=requestAnimationFrame(fe)));},seek(p){let E=Math.min(1,Math.max(0,p));I=E,w=E,$=true,cancelAnimationFrame(M),x(E);},getProgress(){return I}}}var Rt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ht(e,n={}){if(typeof window>"u")return Rt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ge("scrollVideo: <video> element not found:",e),Rt;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",triggerElement:d,onReady:S,onComplete:z,onProgress:L}=n,re=d??t,Me=window.matchMedia("(prefers-reduced-motion: reduce)").matches,B=typeof s=="function"?s:te[s]??te.linear,ne=de(l.start??"top top"),oe=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Y=n.from??0,M=n.to,N=0,$=0,w=0,I=false,C=false,P=-1,T=0,X=false,x=false,fe=()=>u==="x"?window.scrollX:window.scrollY,be=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let A=re.getBoundingClientRect(),F=u==="x"?A.left:A.top,K=u==="x"?A.width:A.height,we=xe({top:F,height:K},fe(),be(),ne,oe);N=we.tStart,$=we.tEnd,x&&$===N&&ge("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let ie=NaN;function p(A){if(!x)return;let F=M??t.duration??0,K=Y+(F-Y)*A;K!==ie&&(ie=K,t.currentTime=K),t.style.setProperty("--scroll-draw-progress",String(A)),L?.(A);}function E(){if(!I||C||!x||Me)return;let A=B(J(fe(),N,$,1));c&&(P=Math.max(P,A),A=P),T=A,p(A),A>=1&&!X?(X=true,z?.()):A<1&&!c&&(X=false),w=requestAnimationFrame(E);}function g(){if(x=true,M===void 0&&(M=t.duration),Me){p(1),S?.();return}se(),S?.(),I&&!C&&(w=requestAnimationFrame(E));}t.readyState>=1?g():t.addEventListener("loadedmetadata",g,{once:true}),x||se();let k=new IntersectionObserver(A=>{A.forEach(F=>{I=F.isIntersecting,I&&!C&&x?w=requestAnimationFrame(E):cancelAnimationFrame(w);});}),ae;function ee(){clearTimeout(ae),ae=setTimeout(se,150);}return window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee),k.observe(t),$e(t,{type:"video",getProgress:()=>T,getTrigger:()=>({tStart:N,tEnd:$})}),{destroy(){cancelAnimationFrame(w),k.disconnect(),t.removeEventListener("loadedmetadata",g),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),clearTimeout(ae),Pe(t);},replay(){P=-1,X=false,T=0,C=false,ie=NaN,p(0);},pause(){C=true,cancelAnimationFrame(w);},resume(){C&&(C=false,I&&x&&(w=requestAnimationFrame(E)));},seek(A){let F=Math.min(1,Math.max(0,A));T=F,P=F,C=true,cancelAnimationFrame(w),ie=NaN,p(F);},getProgress(){return T}}}function _t(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 yr(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 zt(e){let n=_t(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let S=m.nextElementSibling;u.appendChild(m),d<c.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function hr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function br(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 Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function qt(e,n={}){if(typeof window>"u")return Vt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ge("scrollText: element not found:",e),Vt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:S}=n,z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:te[c]??te["ease-out"],re=de(m.start??"top 85%"),Me=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ne;l==="chars"?ne=yr(t):l==="lines"?ne=zt(t):ne=_t(t);let oe=ne.length;function Y(g,k){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*k));let ae=br(k,u);ae&&(g.style.transform=ae);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),ne.forEach((k,ae)=>{let ee=L(hr(g,ae,oe,s));Y(k,ee);});}if(z)return M(1),S?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let N=0,$=0,w=0,I=false,C=false,P=-1,T=0,X=false,x=()=>window.scrollY,fe=()=>window.innerHeight;function be(){let g=t.getBoundingClientRect(),k=xe({top:g.top,height:g.height},x(),fe(),re,Me);N=k.tStart,$=k.tEnd;}function se(){if(!I||C)return;let g=J(x(),N,$,1);d&&(P=Math.max(P,g),g=P),T=g,M(g),g>=1&&!X?(X=true,S?.()):g<1&&!d&&(X=false),w=requestAnimationFrame(se);}be();let ie=new IntersectionObserver(g=>{g.forEach(k=>{I=k.isIntersecting,I&&!C?w=requestAnimationFrame(se):cancelAnimationFrame(w);});}),p;function E(){clearTimeout(p),p=setTimeout(()=>{if(l==="lines"){let g=T;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),ne=zt(t),M(g);}be();},150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),ie.observe(t),$e(t,{type:"text",getProgress:()=>T,getTrigger:()=>({tStart:N,tEnd:$})}),{destroy(){cancelAnimationFrame(w),ie.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(p),t.innerHTML=B,t.removeAttribute("aria-label"),Pe(t);},replay(){P=-1,X=false,T=0,C=false,M(0);},pause(){C=true,cancelAnimationFrame(w);},resume(){C&&(C=false,I&&(w=requestAnimationFrame(se)));},seek(g){let k=Math.min(1,Math.max(0,g));T=k,P=k,C=true,cancelAnimationFrame(w),M(k);},getProgress(){return T}}}var ze=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=at(r),this.instance=this.create(n,kt(r,()=>this.latest)),this}update(n){return this.el?at(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}},Wt=class extends ze{constructor(){super(Pt);}init(n,r={}){return super.init(n,r)}},Bt=class extends ze{constructor(){super(Dt);}},Gt=class extends ze{constructor(){super(Nt);}},jt=class extends ze{constructor(){super(Ht);}init(n,r={}){return super.init(n,r)}},Ut=class extends ze{constructor(){super(qt);}init(n,r={}){return super.init(n,r)}};exports.EngineRef=ze;exports.ScrollAnimateRef=Bt;exports.ScrollCounterRef=Gt;exports.ScrollDrawRef=Wt;exports.ScrollTextRef=Ut;exports.ScrollVideoRef=jt;
|
package/dist/angular/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-
|
|
1
|
+
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-TIRZOSQ4.mjs';import {a as a$4}from'../chunk-SNCRC6BA.mjs';import {a as a$2}from'../chunk-4MH5SQTH.mjs';import {a as a$1}from'../chunk-QJ4H2HW3.mjs';import {b as b$1}from'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.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 qt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<r;d++){let v=Math.pow(l,d);c.push(v),s+=v;}let u=[0],m=0;for(let d=0;d<r;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<r;v++)if(d<=u[v+1]){let _=(d-u[v])/(u[v+1]-u[v]);if(v===0)return _*(2-_);let T=1-Math.pow(t,v);return T+(1-T)*(2*_-1)*(2*_-1)}return 1}}function Wt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var 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:qt(),elastic:Wt()};function ht(e,n,r){return Math.min(r,Math.max(n,e))}function we(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 bt(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 wt(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 Z(e,n,r,t){return r===n?0:ht((e-n)/(r-n)*t,0,1)}function Le(e,n,r,t,l){let s=bt(e.top,e.height,n,t.element)-wt(t.viewport,r),c=bt(e.top,e.height,n,l.element)-wt(l.viewport,r);return {tStart:s,tEnd:c}}function Ke(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function Ve(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function vt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function qe(e,n,r){let t=vt(e),l=vt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var St={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 Ge=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function K(e,...n){Ge&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Bt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Et=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ut(e){let n=[];for(let r=0;r<Et;r++){let t=r/(Et-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Bt;case "ease-out":return Gt;case "ease-in-out":return jt()?Ut(le["ease-in-out"]):null;default:return null}}var Tt=Symbol.for("svg-scroll-draw.registry");function xt(){let e=globalThis;return e[Tt]||(e[Tt]=new Map)}function ke(e,n){xt().set(e,n);}function Ie(e){xt().delete(e);}var Yt=0;function Xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function At(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Mt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Jt(e){if(!Ge)return;let n=At(e,"stroke");if(!n||n==="none"){K("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Mt.has(r)&&!Mt.has(At(e,"fill"))&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Qt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,$t=/[MmLlHhVvCcSsQqTtAaZz]/g;function Qt(e,n,r){if(!Be)return;let t=(e.match($t)??[]).join("").toUpperCase(),l=(n.match($t)??[]).join("").toUpperCase(),s=(e.match(Mt)??[]).length,c=(n.match(Mt)??[]).length;if(t!==l){K(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&K(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function et(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...vt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:v={},stagger:_=0,direction:T="forward",once:ne=false,debug:Oe=false,axis:j="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:x,strokeWidth:W,fillOpacity:L,waypoints:A,velocityScale:R=false,threshold:B=0,rootMargin:P="0px",repeat:M=0,repeatDelay:me=0,morphTo:D,clip:de,autoplay:Se=false,duration:ge=1e3,native:Ee=true,onProgress:g,onStart:S,onComplete:y,onEnter:$,onLeave:ye,onEnterBack:he,onLeaveBack:Ce}=l,te=de===true?"left":typeof de=="string"?de:false,be=typeof d=="function"?d:ue[d]??ue.linear,Ae=ve(v.start??"top bottom"),He=ve(v.end??"bottom top"),fe=typeof oe=="string"?document.querySelector(oe):oe??null,pe=Array.isArray(x)?x[0]:null,Y=Array.isArray(x)?x[1]:typeof x=="string"?x:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Me(o){let a=o*100;switch(te){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let O=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,k=false,F=false,N=0,Te=false,ae=-1,U=-1,V=false,le=0,Pe=0,Fe,tt=null;function lt(){tt?.destroy(),tt=null;}let Re=new Set,ct=NaN,Ne=true,je=-1,ut=performance.now(),_e=NaN;function rt(){return fe?j==="x"?fe.scrollLeft:fe.scrollTop:j==="x"?window.scrollX:window.scrollY}function mt(){return fe?j==="x"?fe.clientWidth:fe.clientHeight:j==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Ze(e,fe,j);return Le(o,o.scroll,mt(),Ae,He)}function pt(){(({tStart:f,tEnd:ie}=ft())),Oe&&Be&&(lt(),tt=Jt(f,ie,j));}function nt(o,a=ft){ke(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function Nt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Me(b);return}O.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&Y?b.style.stroke=Ve(pe,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",it(i[J],D,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Me(0);return}O.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=T==="reverse"?"0":`${E[a]}`,m?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(O.forEach(o=>{Xt(o);let a=ze(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Qt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?"0":`${a}`,m?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Me(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Me(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof d=="string"?Ke(d):null;function Ht(){return !(Ee===false||!Yt()||!O.length||!dt||te||j!=="y"||fe||u!==1||_!==0||ne||se||R!==false||D||A||M||ee>0||g||S||y||$||ye||he||Ce||x!=null||W!=null||L!=null||(v.start??"top bottom").trim()!=="top bottom"||(v.end??"bottom top").trim()!=="bottom top")}function _t(){let o=++Ut,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=T==="reverse"?"0":"var(--ssd-len)",$e=T==="reverse"?"var(--ssd-len)":"0",xe=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(xe+=`opacity:${T==="reverse"?1:0};`,w+=`opacity:${T==="reverse"?0:1};`);let C=document.createElement("style");C.setAttribute("data-svg-scroll-draw",""),C.textContent=`@keyframes ${a}{from{${xe}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild(C),e.classList.add(b);function Q(p,q){p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}O.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:q,tEnd:we}=Le({top:p.top,height:p.height},rt(),mt(),Ae,He);return be(Z(rt(),q,we,u))}return {destroy(){e.classList.remove(b),O.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),C.remove();},replay(){h=false,I=-1,O.forEach(Q);},pause(){h=true,O.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,O.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let q=Math.min(1,Math.max(0,p));I=q,h=true,O.forEach((we,ce)=>{we.classList.remove(a),we.style.strokeDashoffset=T==="reverse"?`${E[ce]*q}`:`${E[ce]*(1-q)}`,m&&(we.style.opacity=T==="reverse"?`${1-q}`:`${q}`);});},getProgress(){return H()},refresh(){O.forEach((p,q)=>{E[q]=ze(p),p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`;});}}}if(Ht())return nt(_t());function zt(){let o=Math.max(1,ge),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=be(H);le=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Me(T==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else O.forEach((H,p)=>{let q=p*_*o,we=Math.min(1,Math.max(0,(h-q)/o)),ce=be(we);H.style.strokeDashoffset=T==="reverse"?`${E[p]*ce}`:`${E[p]*(1-ce)}`,m&&(H.style.opacity=T==="reverse"?`${1-ce}`:`${ce}`),pe&&Y?H.style.stroke=Ve(pe,Y,ce):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ce}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ce}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",it(i[p],D,ce)),p===0&&(le=ce,g?.(ce),e.style.setProperty("--scroll-draw-progress",String(ce))),we<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=be(H);for(let q in A){let we=parseFloat(q);p>=we&&!Re.has(we)&&(Re.add(we),A[q]?.());}}return I}function $e(h){if(V)return;let I=h-a;F||(F=true,S?.());let H=De(I);if(H&&!k){k=true,De(o*(1+Math.max(0,O.length-1)*_)),y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Fe=setTimeout(()=>{a=performance.now(),F=false,k=false,Re.clear(),Ue(),N=requestAnimationFrame($e);},me));return}H||(N=requestAnimationFrame($e));}function xe(){cancelAnimationFrame(N),clearTimeout(Fe),a=performance.now(),b=0,V=false,F=false,k=false,Pe=0,J=true,le=0,Re.clear(),Ue(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&k)?xe():!I.isIntersecting&&!ne&&!k&&(cancelAnimationFrame(N),clearTimeout(Fe),J=false);});},{root:fe??null,threshold:B,rootMargin:P}),C;function Q(){clearTimeout(C),C=setTimeout(()=>{O.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Fe),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(C);},replay(){Pe=0,xe();},pause(){V||!J||(V=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){V&&(V=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));le=I,V=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return le},refresh(){clearTimeout(C),O.forEach((h,I)=>{E[I]=ze(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(Se)return nt(zt());pt();function Ye(){if(!Te||V)return;let o=performance.now(),a=rt();if(!Ne&&R===false&&a===ct){N=requestAnimationFrame(Ye);return}Ne=false,ct=a;let b=u;if(R!==false){let w=o-ut,C=w>0?Math.abs(a-(je<0?a:je))/w:0;b=u*Math.max(.2,1+C*(typeof R=="number"?R:1)*.04);}je=a,ut=o;let J=se?U===-1||a>=U?"forward":"reverse":T;U=a;let De=ie-f,$e=true,xe=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&xe>0?$?.():_e>0&&xe<=0&&Ce?.(),_e<1&&xe>=1?ye?.():_e>=1&&xe<1&&he?.()),_e=xe,te){let w=be(Z(a,f,ie,b));ne&&!se&&(ae=Math.max(ae,w),w=ae),le=w,e.style.setProperty("--scroll-draw-progress",String(w));let C=J==="reverse"?1-w:w;e.style.clipPath=Me(C),g?.(w),!F&&Z(a,f,ie,b)>0&&(F=true,S?.()),w>=1&&!k?(k=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Fe=setTimeout(()=>{ae=-1,F=false,k=false,e.style.clipPath=Me(0);},me))):w<1&&!ne&&(k=false),N=requestAnimationFrame(Ye);return}if(O.forEach((w,C)=>{let Q=C*_*De,h=be(Z(a,f+Q,ie+Q,b));ne&&!se&&(ae=Math.max(ae,h),h=ae),le=h,w.style.strokeDashoffset=J==="reverse"?`${E[C]*h}`:`${E[C]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),pe&&Y?w.style.stroke=Ve(pe,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[C]&&w.setAttribute("d",it(i[C],D,h)),C===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=be(Z(a,f,ie,b));for(let C in A){let Q=parseFloat(C);w>=Q&&!Re.has(Q)&&(Re.add(Q),A[C]?.());}}!F&&Z(a,f,ie,b)>0&&(F=true,S?.()),$e&&!k?(k=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Fe=setTimeout(()=>{ae=-1,F=false,k=false,Re.clear(),Ue(),Ne=true;},me))):!$e&&!ne&&(k=false),N=requestAnimationFrame(Ye);}let ot=false;function Xe(){ot||(ot=true,N=requestAnimationFrame(function(){Ye();}));}function Je(){ot=false,cancelAnimationFrame(N);}let st=new IntersectionObserver(o=>{o.forEach(a=>{Te=a.isIntersecting,Te&&!V?(Ne=true,Xe()):Je();});},{root:fe??null,threshold:B,rootMargin:P});function gt(){O.forEach((o,a)=>{E[a]=ze(o),o.style.strokeDasharray=`${E[a]}`;}),pt(),Ne=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(gt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),ee>0?setTimeout(()=>st.observe(e),ee):st.observe(e),nt({destroy(){cancelAnimationFrame(N),clearTimeout(Fe),Je(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),lt();},replay(){ae=-1,U=-1,je=-1,F=false,k=false,Pe=0,V=false,le=0,Re.clear(),clearTimeout(Fe),Ue(),Ne=true,Te&&Xe();},pause(){V=true,Je();},resume(){V&&(V=false,Ne=true,Te&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));le=a,ae=a,V=true,Je(),Nt(a,T),Ne=true;},getProgress(){return le},refresh(){clearTimeout(Qe),gt(),Te&&!V&&Xe();}},()=>({tStart:f,tEnd:ie}))}function Zt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function Kt(e,n,r){let t=Lt(e),l=Lt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Ct(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Zt(t))return Ve(t,l,r);if(t.includes("("))return Kt(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function er(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var tr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rr=0,Pt="--scroll-draw-progress";function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Dt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:_=false,respectReducedMotion:T=true,triggerElement:ne,onProgress:Oe,onComplete:j,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:x}=n,W=T&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:ue[s]??ue["ease-out"],A=ve(l.start??"top bottom"),R=ve(l.end??"bottom top"),B=ne??e,P=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:er(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function me(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let de=new Map;for(let i of [...M.map(f=>f.prop),Pt])de.set(i,e.style.getPropertyValue(i));function Se(){for(let[i,f]of de)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),j?.(),{...r,destroy:Se,getProgress:()=>1};me();let ge=typeof s=="string"?Ke(s):null;function Ee(){if(!v||!nr()||!ge||m!=="y"||P||B!==e||u||c!==1||Oe||j||oe||se||ee||x||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!tr.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++rr}`,f=M.map(U=>`${U.prop}:${U.from}`).join(";"),ie=M.map(U=>`${U.prop}:${U.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(i);let F=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,Te=()=>{let U=e.getBoundingClientRect();return Le({top:U.top,height:U.height},F(),N(),A,R)};ke(e,{type:"animate",getProgress:()=>ae.getProgress(),getTrigger:Te});let ae={destroy(){e.classList.remove(i),k.remove(),e.style.animationPlayState="",Se(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(U){let V=Math.min(1,Math.max(0,U));e.classList.remove(i);for(let le of M)e.style.setProperty(le.prop,Ct(le.from,le.to,V));},getProgress(){let{tStart:U,tEnd:V}=Te();return L(Z(F(),U,V,c))}};return ae}if(Ee())return g();let S=0,y=0,$=0,ye=false,he=false,Ce=-1,te=0,be=false,Ae=NaN,He=-1,fe=0,pe=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Ze(B,P,m),f=Le(i,i.scroll,Y(),A,R);S=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty(Pt,String(i));for(let f of M)e.style.setProperty(f.prop,Ct(f.from,f.to,i));Oe?.(i);}function re(i){if(isNaN(Ae)){Ae=i;return}Ae<=0&&i>0?oe?.():Ae>0&&i<=0&&x?.(),Ae<1&&i>=1?se?.():Ae>=1&&i<1&&ee?.(),Ae=i;}function G(){if(!ye||he)return;let i=performance.now(),f=pe(),ie=c;if(_!==false){let N=i-fe,Te=N>0?Math.abs(f-(He<0?f:He))/N:0;ie=c*Math.max(.2,1+Te*(typeof _=="number"?_:1)*.04);}He=f,fe=i;let k=y===S?0:(f-S)/(y-S);re(k);let F=L(Z(f,S,y,ie));u&&(Ce=Math.max(Ce,F),F=Ce),te=F,z(F),F>=1&&!be?(be=true,j?.()):F<1&&!u&&(be=false),$=requestAnimationFrame(G);}X(),y===S&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(pe(),S,y,c));u&&i>0&&(Ce=i),te=i,z(i);}let Me=new IntersectionObserver(i=>{i.forEach(f=>{ye=f.isIntersecting,ye&&!he?$=requestAnimationFrame(G):cancelAnimationFrame($);});},{root:P??null}),O;function E(){clearTimeout(O),O=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Me.observe(e),ke(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:S,tEnd:y})}),{destroy(){cancelAnimationFrame($),Me.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(O),Se(),Ie(e);},replay(){Ce=-1,be=false,te=0,he=false,z(0);},pause(){he=true,cancelAnimationFrame($);},resume(){he&&(he=false,ye&&($=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Ce=f,he=true,cancelAnimationFrame($),z(f);},getProgress(){return te}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kt(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:v,onComplete:_}=n,T=v!==void 0?g=>g.toFixed(v):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:ue[u]??ue["ease-out"],Oe=ve(m.start??"top 80%"),j=ve(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=T(s),_?.(),at;let se=0,ee=0,x=0,W=false,L=false,A=-1,R=0,B=false,P=()=>window.scrollY,M=()=>window.innerHeight;function me(){let g=t.getBoundingClientRect(),S=Le({top:g.top,height:g.height},P(),M(),Oe,j);se=S.tStart,ee=S.tEnd;}function D(g){t.textContent=T(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function de(){if(!W||L)return;let g=ne(Z(P(),se,ee,1));d&&(A=Math.max(A,g),g=A),R=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),x=requestAnimationFrame(de);}me();{let g=ne(Z(P(),se,ee,1));d&&g>0&&(A=g),R=g,D(g);}let Se=new IntersectionObserver(g=>{g.forEach(S=>{W=S.isIntersecting,W&&!L?x=requestAnimationFrame(de):cancelAnimationFrame(x);});}),ge;function Ee(){clearTimeout(ge),ge=setTimeout(me,150);}return window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee),Se.observe(t),ke(t,{type:"counter",getProgress:()=>R,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(x),Se.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),clearTimeout(ge),Ie(t);},replay(){A=-1,B=false,R=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(x);},resume(){L&&(L=false,W&&(x=requestAnimationFrame(de)));},seek(g){let S=Math.min(1,Math.max(0,g));R=S,A=S,L=true,cancelAnimationFrame(x),D(S);},getProgress(){return R}}}function Ft(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 or(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 It(e){let n=Ft(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let v=m.nextElementSibling;u.appendChild(m),d<c.length-1&&v&&v.style.whiteSpace==="pre"&&u.appendChild(v);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function sr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ir(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 Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Rt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),Ot;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:v}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,T=typeof c=="function"?c:ue[c]??ue["ease-out"],ne=ve(m.start??"top 85%"),Oe=ve(m.end??"top 40%"),j=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=or(t):l==="lines"?oe=It(t):oe=Ft(t);let se=oe.length;function ee(y,$){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*$));let ye=ir($,u);ye&&(y.style.transform=ye);}function x(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach(($,ye)=>{let he=T(sr(y,ye,se,s));ee($,he);});}if(_)return x(1),v?.(),{destroy(){t.innerHTML=j,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let W=0,L=0,A=0,R=false,B=false,P=-1,M=0,me=false,D=()=>window.scrollY,de=()=>window.innerHeight;function Se(){let y=t.getBoundingClientRect(),$=Le({top:y.top,height:y.height},D(),de(),ne,Oe);W=$.tStart,L=$.tEnd;}function ge(){if(!R||B)return;let y=Z(D(),W,L,1);d&&(P=Math.max(P,y),y=P),M=y,x(y),y>=1&&!me?(me=true,v?.()):y<1&&!d&&(me=false),A=requestAnimationFrame(ge);}Se();let Ee=new IntersectionObserver(y=>{y.forEach($=>{R=$.isIntersecting,R&&!B?A=requestAnimationFrame(ge):cancelAnimationFrame(A);});}),g;function S(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=j,t.setAttribute("aria-label",t.textContent??""),oe=It(t),x(y);}Se();},150);}return window.addEventListener("resize",S),window.addEventListener("orientationchange",S),Ee.observe(t),ke(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:L})}),{destroy(){cancelAnimationFrame(A),Ee.disconnect(),window.removeEventListener("resize",S),window.removeEventListener("orientationchange",S),clearTimeout(g),t.innerHTML=j,t.removeAttribute("aria-label"),Ie(t);},replay(){P=-1,me=false,M=0,B=false,x(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,R&&(A=requestAnimationFrame(ge)));},seek(y){let $=Math.min(1,Math.max(0,y));M=$,P=$,B=true,cancelAnimationFrame(A),x($);},getProgress(){return M}}}function ar(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?et(t,n):(K("Container not found:",e),r)}function Ge(){return typeof document>"u"?null:document}function lr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return et(n,r)}):[]}function cr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return Dt(n,r)}):[]}function ur(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),kt(n,r)}):[]}function mr(e=Ge()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return Rt(n,r)}):[]}function an(e=Ge()){return {draw:lr(e),animate:cr(e),counter:ur(e),text:mr(e)}}exports.initAll=an;exports.initScrollAnimate=cr;exports.initScrollCounter=ur;exports.initScrollDraw=lr;exports.initScrollText=mr;exports.scrollDraw=ar;
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var $t=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Lt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Zt(e,n,r){if(!Ge)return;let t=(e.match(Lt)??[]).join("").toUpperCase(),l=(n.match(Lt)??[]).join("").toUpperCase(),s=(e.match($t)??[]).length,c=(n.match($t)??[]).length;if(t!==l){K(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&K(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function tt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...St[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:v={},stagger:_=0,direction:T="forward",once:ne=false,debug:Oe=false,axis:U="y",scrollContainer:oe,autoReverse:se=false,delay:ee=0,strokeColor:x,strokeWidth:W,fillOpacity:C,waypoints:A,velocityScale:R=false,threshold:B=0,rootMargin:P="0px",repeat:M=0,repeatDelay:ce=0,morphTo:D,clip:fe,autoplay:ve=false,duration:pe=1e3,native:Se=true,onProgress:g,onStart:S,onComplete:y,onEnter:L,onLeave:de,onEnterBack:ge,onLeaveBack:Ce}=l,te=fe===true?"left":typeof fe=="string"?fe:false,ye=typeof d=="function"?d:le[d]??le.linear,xe=we(v.start??"top bottom"),_e=we(v.end??"bottom top"),ue=typeof oe=="string"?document.querySelector(oe):oe??null,me=Array.isArray(x)?x[0]:null,Y=Array.isArray(x)?x[1]:typeof x=="string"?x:null,X=Array.isArray(W)?W[0]:null,z=Array.isArray(W)?W[1]:typeof W=="number"?W:null,re=Array.isArray(C)?C[0]:null,G=Array.isArray(C)?C[1]:typeof C=="number"?C:null;function Ae(o){let a=o*100;switch(te){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let O=te?[]:Array.from(e.querySelectorAll(c)),E=[],i=[],f=0,ie=0,k=false,F=false,N=0,Ee=false,he=-1,j=[],Fe=-1,V=false,Me=0,Pe=0,Re,rt=null;function ct(){rt?.destroy(),rt=null;}let Ne=new Set,ut=NaN,He=true,Ue=-1,mt=performance.now(),ze=NaN;function nt(){return ue?U==="x"?ue.scrollLeft:ue.scrollTop:U==="x"?window.scrollX:window.scrollY}function ft(){return ue?U==="x"?ue.clientWidth:ue.clientHeight:U==="x"?window.innerWidth:window.innerHeight}function pt(){let o=Ke(e,ue,U);return Le(o,o.scroll,ft(),xe,_e)}function dt(){(({tStart:f,tEnd:ie}=pt())),Oe&&Ge&&(ct(),rt=Qt(f,ie,U));}function ot(o,a=pt){ke(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ie(e);},o}function Ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let b=a==="reverse"?1-o:o;e.style.clipPath=Ae(b);return}O.forEach((b,J)=>{b.style.strokeDashoffset=a==="reverse"?`${E[J]*o}`:`${E[J]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),me&&Y?b.style.stroke=qe(me,Y,o):Y&&(b.style.stroke=Y),X!==null&&z!==null?b.style.strokeWidth=`${X+(z-X)*o}`:z!==null&&(b.style.strokeWidth=`${z}`),re!==null&&G!==null?b.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(b.style.fillOpacity=`${G}`),D&&b.tagName.toLowerCase()==="path"&&i[J]&&b.setAttribute("d",at(i[J],D,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=Ae(0);return}O.forEach((o,a)=>{o.style.strokeDasharray=`${E[a]}`,o.style.strokeDashoffset=T==="reverse"?"0":`${E[a]}`,m?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",me&&(o.style.stroke=me),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(O.forEach(o=>{Jt(o);let a=Ve(o);E.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Zt(i[i.length-1],D,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),z!==null&&(o.style.strokeWidth=`${z}`),G!==null&&(o.style.fillOpacity=`${G}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=T==="reverse"?"0":`${a}`,m?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",me&&(o.style.stroke=me),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(s)return e.style.clipPath=Ae(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ae(0);}else if(s)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof d=="string"?et(d):null;function _t(){return !(Se===false||!Xt()||!O.length||!gt||te||U!=="y"||ue||u!==1||_!==0||ne||se||R!==false||D||A||M||ee>0||g||S||y||L||de||ge||Ce||x!=null||W!=null||C!=null||(v.start??"top bottom").trim()!=="top bottom"||(v.end??"bottom top").trim()!=="bottom top")}function zt(){let o=++Yt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,J=`--svg-scroll-draw-${o}`,De=T==="reverse"?"0":"var(--ssd-len)",$e=T==="reverse"?"var(--ssd-len)":"0",Te=`stroke-dashoffset:${De};`,w=`stroke-dashoffset:${$e};`;m&&(Te+=`opacity:${T==="reverse"?1:0};`,w+=`opacity:${T==="reverse"?0:1};`);let $=document.createElement("style");$.setAttribute("data-svg-scroll-draw",""),$.textContent=`@keyframes ${a}{from{${Te}}to{${w}}}.${b}{view-timeline-name:${J};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${J};animation-range:cover 0% cover 100%;}`,document.head.appendChild($),e.classList.add(b);function Q(p,q){p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(a);}O.forEach(Q);let h=false,I=-1;function H(){if(I>=0)return I;let p=e.getBoundingClientRect(),{tStart:q,tEnd:be}=Le({top:p.top,height:p.height},nt(),ft(),xe,_e);return ye(Z(nt(),q,be,u))}return {destroy(){e.classList.remove(b),O.forEach(p=>{p.classList.remove(a),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),$.remove();},replay(){h=false,I=-1,O.forEach(Q);},pause(){h=true,O.forEach(p=>{p.style.animationPlayState="paused";});},resume(){h&&(h=false,O.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let q=Math.min(1,Math.max(0,p));I=q,h=true,O.forEach((be,ae)=>{be.classList.remove(a),be.style.strokeDashoffset=T==="reverse"?`${E[ae]*q}`:`${E[ae]*(1-q)}`,m&&(be.style.opacity=T==="reverse"?`${1-q}`:`${q}`);});},getProgress(){return H()},refresh(){O.forEach((p,q)=>{E[q]=Ve(p),p.style.setProperty("--ssd-len",String(E[q])),p.style.strokeDasharray=`${E[q]}`;});}}}if(_t())return ot(zt());function Vt(){let o=Math.max(1,pe),a=0,b=0,J=false;function De(h){let I=true;if(te){let H=Math.min(1,Math.max(0,h/o)),p=ye(H);Me=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=Ae(T==="reverse"?1-p:p),g?.(p),H<1&&(I=false);}else O.forEach((H,p)=>{let q=p*_*o,be=Math.min(1,Math.max(0,(h-q)/o)),ae=ye(be);H.style.strokeDashoffset=T==="reverse"?`${E[p]*ae}`:`${E[p]*(1-ae)}`,m&&(H.style.opacity=T==="reverse"?`${1-ae}`:`${ae}`),me&&Y?H.style.stroke=qe(me,Y,ae):Y&&(H.style.stroke=Y),X!==null&&z!==null?H.style.strokeWidth=`${X+(z-X)*ae}`:z!==null&&(H.style.strokeWidth=`${z}`),re!==null&&G!==null?H.style.fillOpacity=`${re+(G-re)*ae}`:G!==null&&(H.style.fillOpacity=`${G}`),D&&H.tagName.toLowerCase()==="path"&&i[p]&&H.setAttribute("d",at(i[p],D,ae)),p===0&&(Me=ae,g?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),be<1&&(I=false);});if(A){let H=Math.min(1,Math.max(0,h/o)),p=ye(H);for(let q in A){let be=parseFloat(q);p>=be&&!Ne.has(be)&&(Ne.add(be),A[q]?.());}}return I}function $e(h){if(V)return;let I=h-a;F||(F=true,S?.());let H=De(I);if(H&&!k){k=true,De(o*(1+Math.max(0,O.length-1)*_)),y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{a=performance.now(),F=false,k=false,Ne.clear(),Ye(),N=requestAnimationFrame($e);},ce));return}H||(N=requestAnimationFrame($e));}function Te(){cancelAnimationFrame(N),clearTimeout(Re),a=performance.now(),b=0,V=false,F=false,k=false,Pe=0,J=true,Me=0,Ne.clear(),Ye(),N=requestAnimationFrame($e);}let w=new IntersectionObserver(h=>{h.forEach(I=>{I.isIntersecting&&!(ne&&k)?Te():!I.isIntersecting&&!ne&&!k&&(cancelAnimationFrame(N),clearTimeout(Re),J=false);});},{root:ue??null,threshold:B,rootMargin:P}),$;function Q(){clearTimeout($),$=setTimeout(()=>{O.forEach((h,I)=>{E[I]=Ve(h),h.style.strokeDasharray=`${E[I]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),ee>0?setTimeout(()=>w.observe(e),ee):w.observe(e),{destroy(){cancelAnimationFrame(N),clearTimeout(Re),w.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout($);},replay(){Pe=0,Te();},pause(){V||!J||(V=true,b=performance.now()-a,cancelAnimationFrame(N));},resume(){V&&(V=false,J=true,a=performance.now()-b,N=requestAnimationFrame($e));},seek(h){let I=Math.min(1,Math.max(0,h));Me=I,V=true,b=I*o,a=performance.now()-b,cancelAnimationFrame(N),De(b);},getProgress(){return Me},refresh(){clearTimeout($),O.forEach((h,I)=>{E[I]=Ve(h),h.style.strokeDasharray=`${E[I]}`;});}}}if(ve)return ot(Vt());dt();function Xe(){if(!Ee||V)return;let o=performance.now(),a=nt();if(!He&&R===false&&a===ut){N=requestAnimationFrame(Xe);return}He=false,ut=a;let b=u;if(R!==false){let w=o-mt,$=w>0?Math.abs(a-(Ue<0?a:Ue))/w:0;b=u*Math.max(.2,1+$*(typeof R=="number"?R:1)*.04);}Ue=a,mt=o;let J=se?Fe===-1||a>=Fe?"forward":"reverse":T;Fe=a;let De=ie-f,$e=true,Te=De===0?0:(a-f)/De;if(isNaN(ze)||(ze<=0&&Te>0?L?.():ze>0&&Te<=0&&Ce?.(),ze<1&&Te>=1?de?.():ze>=1&&Te<1&&ge?.()),ze=Te,te){let w=ye(Z(a,f,ie,b));ne&&!se&&(he=Math.max(he,w),w=he),Me=w,e.style.setProperty("--scroll-draw-progress",String(w));let $=J==="reverse"?1-w:w;e.style.clipPath=Ae($),g?.(w),!F&&Z(a,f,ie,b)>0&&(F=true,S?.()),w>=1&&!k?(k=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{he=-1,F=false,k=false,e.style.clipPath=Ae(0);},ce))):w<1&&!ne&&(k=false),N=requestAnimationFrame(Xe);return}if(O.forEach((w,$)=>{let Q=$*_*De,h=ye(Z(a,f+Q,ie+Q,b));ne&&!se&&(h=j[$]=Math.max(j[$]??he,h)),Me=h,w.style.strokeDashoffset=J==="reverse"?`${E[$]*h}`:`${E[$]*(1-h)}`,m&&(w.style.opacity=J==="reverse"?`${1-h}`:`${h}`),me&&Y?w.style.stroke=qe(me,Y,h):Y&&(w.style.stroke=Y),X!==null&&z!==null?w.style.strokeWidth=`${X+(z-X)*h}`:z!==null&&(w.style.strokeWidth=`${z}`),re!==null&&G!==null?w.style.fillOpacity=`${re+(G-re)*h}`:G!==null&&(w.style.fillOpacity=`${G}`),D&&w.tagName.toLowerCase()==="path"&&i[$]&&w.setAttribute("d",at(i[$],D,h)),$===0&&(g?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&($e=false);}),A){let w=ye(Z(a,f,ie,b));for(let $ in A){let Q=parseFloat($);w>=Q&&!Ne.has(Q)&&(Ne.add(Q),A[$]?.());}}!F&&Z(a,f,ie,b)>0&&(F=true,S?.()),$e&&!k?(k=true,y?.(),Pe<(M==="infinite"?1/0:M??0)&&(Pe++,Re=setTimeout(()=>{he=-1,j=[],F=false,k=false,Ne.clear(),Ye(),He=true;},ce))):!$e&&!ne&&(k=false),N=requestAnimationFrame(Xe);}let st=false;function Je(){st||(st=true,N=requestAnimationFrame(function(){Xe();}));}function Qe(){st=false,cancelAnimationFrame(N);}let it=new IntersectionObserver(o=>{o.forEach(a=>{Ee=a.isIntersecting,Ee&&!V?(He=true,Je()):Qe();});},{root:ue??null,threshold:B,rootMargin:P});function yt(){O.forEach((o,a)=>{E[a]=Ve(o),o.style.strokeDasharray=`${E[a]}`;}),dt(),He=true;}let Ze;function We(){clearTimeout(Ze),Ze=setTimeout(yt,150);}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Be;return typeof ResizeObserver<"u"&&(Be=new ResizeObserver(()=>We()),Be.observe(document.body),Be.observe(document.documentElement),Be.observe(e)),ee>0?setTimeout(()=>it.observe(e),ee):it.observe(e),ot({destroy(){cancelAnimationFrame(N),clearTimeout(Re),Qe(),it.disconnect(),Be?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Ze),ct();},replay(){he=-1,j=[],Fe=-1,Ue=-1,F=false,k=false,Pe=0,V=false,Me=0,Ne.clear(),clearTimeout(Re),Ye(),He=true,Ee&&Je();},pause(){V=true,Qe();},resume(){V&&(V=false,He=true,Ee&&Je());},seek(o){let a=Math.min(1,Math.max(0,o));Me=a,he=a,j=[],V=true,Qe(),Ht(a,T),He=true;},getProgress(){return Me},refresh(){clearTimeout(Ze),yt(),Ee&&!V&&Je();}},()=>({tStart:f,tEnd:ie}))}function Kt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function er(e,n,r){let t=Ct(e),l=Ct(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Pt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Kt(t))return qe(t,l,r);if(t.includes("("))return er(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function tr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,Dt="--scroll-draw-progress";function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function kt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:_=false,respectReducedMotion:T=true,triggerElement:ne,onProgress:Oe,onComplete:U,onEnter:oe,onLeave:se,onEnterBack:ee,onLeaveBack:x}=n,W=T&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,C=typeof s=="function"?s:le[s]??le["ease-out"],A=we(l.start??"top bottom"),R=we(l.end??"bottom top"),B=ne??e,P=typeof d=="string"?document.querySelector(d):d??null,M=Object.entries(t).map(([i,f])=>({prop:tr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function ce(){let i=window.getComputedStyle(e);for(let f of M)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let fe=new Map;for(let i of [...M.map(f=>f.prop),Dt])fe.set(i,e.style.getPropertyValue(i));function ve(){for(let[i,f]of fe)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(W)return D(),U?.(),{...r,destroy:ve,getProgress:()=>1};ce();let pe=typeof s=="string"?et(s):null;function Se(){if(!v||!or()||!pe||m!=="y"||P||B!==e||u||c!==1||Oe||U||oe||se||ee||x||_!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!rr.has(i.prop))return false;return true}function g(){let i=`ssd-a-${++nr}`,f=M.map(j=>`${j.prop}:${j.from}`).join(";"),ie=M.map(j=>`${j.prop}:${j.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${i}{from{${f}}to{${ie}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${pe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(i);let F=()=>m==="x"?window.scrollX:window.scrollY,N=()=>m==="x"?window.innerWidth:window.innerHeight,Ee=()=>{let j=e.getBoundingClientRect();return Le({top:j.top,height:j.height},F(),N(),A,R)};ke(e,{type:"animate",getProgress:()=>he.getProgress(),getTrigger:Ee});let he={destroy(){e.classList.remove(i),k.remove(),e.style.animationPlayState="",ve(),Ie(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let Fe=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let V of M)e.style.setProperty(V.prop,Pt(V.from,V.to,Fe));},getProgress(){let{tStart:j,tEnd:Fe}=Ee();return C(Z(F(),j,Fe,c))}};return he}if(Se())return g();let S=0,y=0,L=0,de=false,ge=false,Ce=-1,te=0,ye=false,xe=NaN,_e=-1,ue=0,me=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,Y=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function X(){let i=Ke(B,P,m),f=Le(i,i.scroll,Y(),A,R);S=f.tStart,y=f.tEnd;}function z(i){e.style.setProperty(Dt,String(i));for(let f of M)e.style.setProperty(f.prop,Pt(f.from,f.to,i));Oe?.(i);}function re(i){if(isNaN(xe)){xe=i;return}xe<=0&&i>0?oe?.():xe>0&&i<=0&&x?.(),xe<1&&i>=1?se?.():xe>=1&&i<1&&ee?.(),xe=i;}function G(){if(!de||ge)return;let i=performance.now(),f=me(),ie=c;if(_!==false){let N=i-ue,Ee=N>0?Math.abs(f-(_e<0?f:_e))/N:0;ie=c*Math.max(.2,1+Ee*(typeof _=="number"?_:1)*.04);}_e=f,ue=i;let k=y===S?0:(f-S)/(y-S);re(k);let F=C(Z(f,S,y,ie));u&&(Ce=Math.max(Ce,F),F=Ce),te=F,z(F),F>=1&&!ye?(ye=true,U?.()):F<1&&!u&&(ye=false),L=requestAnimationFrame(G);}X(),y===S&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=C(Z(me(),S,y,c));u&&i>0&&(Ce=i),te=i,z(i);}let Ae=new IntersectionObserver(i=>{i.forEach(f=>{de=f.isIntersecting,de&&!ge?L=requestAnimationFrame(G):cancelAnimationFrame(L);});},{root:P??null}),O;function E(){clearTimeout(O),O=setTimeout(X,150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),Ae.observe(e),ke(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:S,tEnd:y})}),{destroy(){cancelAnimationFrame(L),Ae.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(O),ve(),Ie(e);},replay(){Ce=-1,ye=false,te=0,ge=false,z(0);},pause(){ge=true,cancelAnimationFrame(L);},resume(){ge&&(ge=false,de&&(L=requestAnimationFrame(G)));},seek(i){let f=Math.min(1,Math.max(0,i));te=f,Ce=f,ge=true,cancelAnimationFrame(L),z(f);},getProgress(){return te}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),lt;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:v,onComplete:_}=n,T=v!==void 0?g=>g.toFixed(v):c??(g=>String(Math.round(g))),ne=typeof u=="function"?u:le[u]??le["ease-out"],Oe=we(m.start??"top 80%"),U=we(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=T(s),_?.(),lt;let se=0,ee=0,x=0,W=false,C=false,A=-1,R=0,B=false,P=()=>window.scrollY,M=()=>window.innerHeight;function ce(){let g=t.getBoundingClientRect(),S=Le({top:g.top,height:g.height},P(),M(),Oe,U);se=S.tStart,ee=S.tEnd;}function D(g){t.textContent=T(l+(s-l)*g),t.style.setProperty("--scroll-draw-progress",String(g));}function fe(){if(!W||C)return;let g=ne(Z(P(),se,ee,1));d&&(A=Math.max(A,g),g=A),R=g,D(g),g>=1&&!B?(B=true,_?.()):g<1&&!d&&(B=false),x=requestAnimationFrame(fe);}ce();{let g=ne(Z(P(),se,ee,1));d&&g>0&&(A=g),R=g,D(g);}let ve=new IntersectionObserver(g=>{g.forEach(S=>{W=S.isIntersecting,W&&!C?x=requestAnimationFrame(fe):cancelAnimationFrame(x);});}),pe;function Se(){clearTimeout(pe),pe=setTimeout(ce,150);}return window.addEventListener("resize",Se),window.addEventListener("orientationchange",Se),ve.observe(t),ke(t,{type:"counter",getProgress:()=>R,getTrigger:()=>({tStart:se,tEnd:ee})}),{destroy(){cancelAnimationFrame(x),ve.disconnect(),window.removeEventListener("resize",Se),window.removeEventListener("orientationchange",Se),clearTimeout(pe),Ie(t);},replay(){A=-1,B=false,R=0,C=false,D(0);},pause(){C=true,cancelAnimationFrame(x);},resume(){C&&(C=false,W&&(x=requestAnimationFrame(fe)));},seek(g){let S=Math.min(1,Math.max(0,g));R=S,A=S,C=true,cancelAnimationFrame(x),D(S);},getProgress(){return R}}}function Rt(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 sr(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 Ot(e){let n=Rt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let v=m.nextElementSibling;u.appendChild(m),d<c.length-1&&v&&v.style.whiteSpace==="pre"&&u.appendChild(v);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ir(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ar(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 Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nt(e,n={}){if(typeof window>"u")return Ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollText: element not found:",e),Ft;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:v}=n,_=window.matchMedia("(prefers-reduced-motion: reduce)").matches,T=typeof c=="function"?c:le[c]??le["ease-out"],ne=we(m.start??"top 85%"),Oe=we(m.end??"top 40%"),U=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let oe;l==="chars"?oe=sr(t):l==="lines"?oe=Ot(t):oe=Rt(t);let se=oe.length;function ee(y,L){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*L));let de=ar(L,u);de&&(y.style.transform=de);}function x(y){t.style.setProperty("--scroll-draw-progress",String(y)),oe.forEach((L,de)=>{let ge=T(ir(y,de,se,s));ee(L,ge);});}if(_)return x(1),v?.(),{destroy(){t.innerHTML=U,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let W=0,C=0,A=0,R=false,B=false,P=-1,M=0,ce=false,D=()=>window.scrollY,fe=()=>window.innerHeight;function ve(){let y=t.getBoundingClientRect(),L=Le({top:y.top,height:y.height},D(),fe(),ne,Oe);W=L.tStart,C=L.tEnd;}function pe(){if(!R||B)return;let y=Z(D(),W,C,1);d&&(P=Math.max(P,y),y=P),M=y,x(y),y>=1&&!ce?(ce=true,v?.()):y<1&&!d&&(ce=false),A=requestAnimationFrame(pe);}ve();let Se=new IntersectionObserver(y=>{y.forEach(L=>{R=L.isIntersecting,R&&!B?A=requestAnimationFrame(pe):cancelAnimationFrame(A);});}),g;function S(){clearTimeout(g),g=setTimeout(()=>{if(l==="lines"){let y=M;t.innerHTML=U,t.setAttribute("aria-label",t.textContent??""),oe=Ot(t),x(y);}ve();},150);}return window.addEventListener("resize",S),window.addEventListener("orientationchange",S),Se.observe(t),ke(t,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:W,tEnd:C})}),{destroy(){cancelAnimationFrame(A),Se.disconnect(),window.removeEventListener("resize",S),window.removeEventListener("orientationchange",S),clearTimeout(g),t.innerHTML=U,t.removeAttribute("aria-label"),Ie(t);},replay(){P=-1,ce=false,M=0,B=false,x(0);},pause(){B=true,cancelAnimationFrame(A);},resume(){B&&(B=false,R&&(A=requestAnimationFrame(pe)));},seek(y){let L=Math.min(1,Math.max(0,y));M=L,P=L,B=true,cancelAnimationFrame(A),x(L);},getProgress(){return M}}}function lr(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let t=typeof e=="string"?document.querySelector(e):e;return t?tt(t,n):(K("Container not found:",e),r)}function je(){return typeof document>"u"?null:document}function cr(e=je()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let t=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";t&&(r=JSON.parse(t));}catch{}return tt(n,r)}):[]}function ur(e=je()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let t=n.dataset.scrollAnimateOptions??"";t&&(r=JSON.parse(t));}catch{}return kt(n,r)}):[]}function mr(e=je()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let t=n.dataset.scrollCounterOptions??"";t&&(r=JSON.parse(t));}catch{}return !r.to&&r.to!==0&&(K('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),It(n,r)}):[]}function fr(e=je()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let t=n.dataset.scrollTextOptions??"";t&&(r=JSON.parse(t));}catch{}return Nt(n,r)}):[]}function ln(e=je()){return {draw:cr(e),animate:ur(e),counter:mr(e),text:fr(e)}}exports.initAll=ln;exports.initScrollAnimate=ur;exports.initScrollCounter=mr;exports.initScrollDraw=cr;exports.initScrollText=fr;exports.scrollDraw=lr;
|
package/dist/astro/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollDraw}from'../chunk-
|
|
1
|
+
export{a as scrollDraw}from'../chunk-DIMNQPW5.mjs';import {a as a$2}from'../chunk-SNCRC6BA.mjs';import {a as a$1}from'../chunk-4MH5SQTH.mjs';import {a}from'../chunk-QJ4H2HW3.mjs';import {b}from'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import {b as b$1}from'../chunk-LFSU6LR3.mjs';function o(){return typeof document>"u"?null:document}function p(t=o()){return t?Array.from(t.querySelectorAll("[data-scroll-draw]")).map(n=>{let r={};try{let e=n.dataset.scrollDrawOptions??n.dataset.scrollDrawoptions??"";e&&(r=JSON.parse(e));}catch{}return b(n,r)}):[]}function u(t=o()){return t?Array.from(t.querySelectorAll("[data-scroll-animate]")).map(n=>{let r={props:{}};try{let e=n.dataset.scrollAnimateOptions??"";e&&(r=JSON.parse(e));}catch{}return a(n,r)}):[]}function S(t=o()){return t?Array.from(t.querySelectorAll("[data-scroll-counter]")).map(n=>{let r={};try{let e=n.dataset.scrollCounterOptions??"";e&&(r=JSON.parse(e));}catch{}return !r.to&&r.to!==0&&(b$1('initScrollCounter: element missing "to" in options JSON:',n),r.to=0),a$1(n,r)}):[]}function f(t=o()){return t?Array.from(t.querySelectorAll("[data-scroll-text]")).map(n=>{let r={};try{let e=n.dataset.scrollTextOptions??"";e&&(r=JSON.parse(e));}catch{}return a$2(n,r)}):[]}function x(t=o()){return {draw:p(t),animate:u(t),counter:S(t),text:f(t)}}export{x as initAll,u as initScrollAnimate,S as initScrollCounter,p as initScrollDraw,f as initScrollText};
|
|
@@ -476,6 +476,7 @@ var SvgScrollDraw = (() => {
|
|
|
476
476
|
let rafId = 0;
|
|
477
477
|
let isVisible = false;
|
|
478
478
|
let frozenAlpha = -1;
|
|
479
|
+
let frozenPath = [];
|
|
479
480
|
let prevScroll = -1;
|
|
480
481
|
let paused = false;
|
|
481
482
|
let currentAlpha = 0;
|
|
@@ -985,8 +986,7 @@ var SvgScrollDraw = (() => {
|
|
|
985
986
|
const offset = i * stagger * range;
|
|
986
987
|
let alpha = easeFn(computeProgress(currentScroll, tStart + offset, tEnd + offset, effectiveSpeed));
|
|
987
988
|
if (once && !autoReverse) {
|
|
988
|
-
|
|
989
|
-
alpha = frozenAlpha;
|
|
989
|
+
alpha = frozenPath[i] = Math.max(frozenPath[i] ?? frozenAlpha, alpha);
|
|
990
990
|
}
|
|
991
991
|
currentAlpha = alpha;
|
|
992
992
|
el.style.strokeDashoffset = effectiveDir === "reverse" ? `${lengths[i] * alpha}` : `${lengths[i] * (1 - alpha)}`;
|
|
@@ -1031,6 +1031,7 @@ var SvgScrollDraw = (() => {
|
|
|
1031
1031
|
repeatCount++;
|
|
1032
1032
|
repeatTimer = setTimeout(() => {
|
|
1033
1033
|
frozenAlpha = -1;
|
|
1034
|
+
frozenPath = [];
|
|
1034
1035
|
started = false;
|
|
1035
1036
|
completed = false;
|
|
1036
1037
|
firedWaypoints.clear();
|
|
@@ -1107,6 +1108,7 @@ var SvgScrollDraw = (() => {
|
|
|
1107
1108
|
},
|
|
1108
1109
|
replay() {
|
|
1109
1110
|
frozenAlpha = -1;
|
|
1111
|
+
frozenPath = [];
|
|
1110
1112
|
prevScroll = -1;
|
|
1111
1113
|
prevVelScroll = -1;
|
|
1112
1114
|
started = false;
|
|
@@ -1134,6 +1136,7 @@ var SvgScrollDraw = (() => {
|
|
|
1134
1136
|
const p = Math.min(1, Math.max(0, progress));
|
|
1135
1137
|
currentAlpha = p;
|
|
1136
1138
|
frozenAlpha = p;
|
|
1139
|
+
frozenPath = [];
|
|
1137
1140
|
paused = true;
|
|
1138
1141
|
stopLoop();
|
|
1139
1142
|
applyAlpha(p, direction);
|