svg-scroll-draw 2.9.0 → 2.10.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/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +42 -0
- package/dist/angular/index.d.ts +42 -0
- package/dist/angular/index.mjs +3 -3
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.d.mts +20 -5
- package/dist/astro/index.d.ts +20 -5
- package/dist/astro/index.mjs +3 -3
- package/dist/cdn/svg-scroll-draw.dev.global.js +1878 -0
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.mjs +2 -2
- package/dist/cli/init.js +104 -101
- package/dist/devtools/index.cjs +1 -1
- package/dist/devtools/index.mjs +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +42 -0
- package/dist/group/index.d.ts +42 -0
- package/dist/group/index.mjs +3 -3
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +48 -1
- package/dist/horizontal/index.d.ts +48 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +42 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.mjs +4 -4
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +27 -0
- package/dist/nuxt/index.d.ts +27 -0
- package/dist/nuxt/index.mjs +3 -3
- package/dist/pin/index.cjs +1 -1
- package/dist/pin/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +15 -0
- package/dist/progress/index.d.ts +15 -0
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +27 -0
- package/dist/react/index.d.ts +27 -0
- package/dist/react/index.mjs +3 -3
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +8 -0
- package/dist/snap/index.d.ts +8 -0
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +42 -0
- package/dist/solid/index.d.ts +42 -0
- package/dist/solid/index.mjs +3 -3
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +42 -0
- package/dist/svelte/index.d.ts +42 -0
- package/dist/svelte/index.mjs +3 -3
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +15 -0
- package/dist/text/index.d.ts +15 -0
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +8 -8
- package/dist/timeline/index.d.mts +31 -0
- package/dist/timeline/index.d.ts +31 -0
- package/dist/timeline/index.mjs +8 -8
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +15 -0
- package/dist/video/index.d.ts +15 -0
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +27 -0
- package/dist/vue/index.d.ts +27 -0
- package/dist/vue/index.mjs +3 -3
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +3 -3
- package/package.json +22 -5
package/dist/video/index.d.mts
CHANGED
|
@@ -15,6 +15,21 @@ interface ScrollDrawInstance {
|
|
|
15
15
|
seek: (progress: number) => void;
|
|
16
16
|
/** Returns current draw progress (0–1). */
|
|
17
17
|
getProgress: () => number;
|
|
18
|
+
/**
|
|
19
|
+
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
20
|
+
*
|
|
21
|
+
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
22
|
+
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
23
|
+
* change that leaves the document height alone, such as a tab switching, a
|
|
24
|
+
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
25
|
+
* after one of those.
|
|
26
|
+
*
|
|
27
|
+
* Optional on this shared type because several instances here are fan-outs over
|
|
28
|
+
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
29
|
+
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
30
|
+
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
31
|
+
*/
|
|
32
|
+
refresh?: () => void;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
interface ScrollVideoOptions {
|
package/dist/video/index.d.ts
CHANGED
|
@@ -15,6 +15,21 @@ interface ScrollDrawInstance {
|
|
|
15
15
|
seek: (progress: number) => void;
|
|
16
16
|
/** Returns current draw progress (0–1). */
|
|
17
17
|
getProgress: () => number;
|
|
18
|
+
/**
|
|
19
|
+
* Re-measure after a layout change: path lengths, and the scroll trigger window.
|
|
20
|
+
*
|
|
21
|
+
* The engine already re-measures on `resize`, on `orientationchange`, and via a
|
|
22
|
+
* `ResizeObserver` on the document element — but none of those fire for a layout
|
|
23
|
+
* change that leaves the document height alone, such as a tab switching, a
|
|
24
|
+
* sibling collapsing, or a font swapping inside a fixed-height box. Call this
|
|
25
|
+
* after one of those.
|
|
26
|
+
*
|
|
27
|
+
* Optional on this shared type because several instances here are fan-outs over
|
|
28
|
+
* other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
|
|
29
|
+
* `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
|
|
30
|
+
* use `instance.refresh?.()` if you hold an instance of unknown origin.
|
|
31
|
+
*/
|
|
32
|
+
refresh?: () => void;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
interface ScrollVideoOptions {
|
package/dist/video/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Y({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),c=Math.sqrt(r),s=0,p=[];for(let i=0;i<n;i++){let a=Math.pow(c,i);p.push(a),s+=a;}let u=[0],y=0;for(let i=0;i<n;i++)y+=p[i]/s,u.push(y);return i=>{if(i<=0)return 0;if(i>=1)return 1;for(let a=0;a<n;a++)if(i<=u[a+1]){let f=(i-u[a])/(u[a+1]-u[a]);if(a===0)return f*(2-f);let x=1-Math.pow(r,a);return x+(1-x)*(2*f-1)*(2*f-1)}return 1}}function Z({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),c=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-c)*(2*Math.PI)/r)+1}var V={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:Y(),elastic:Z()};function P(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function O(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function $(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function H(e,t,n){return Math.min(n,Math.max(t,e))}function z(e,t,n,r){return n===t?0:H((e-t)/(n-t)*r,0,1)}function G(e,t,n,r,c){let s=O(e.top,e.height,t,r.element)-$(r.viewport,n),p=O(e.top,e.height,t,c.element)-$(c.viewport,n);return {tStart:s,tEnd:p}}var q=new Map;function B(e,t){q.set(e,t);}function W(e){q.delete(e);}var ee=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function k(e,...t){ee&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var X={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ae(e,t={}){if(typeof window>"u")return X;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return k("scrollVideo: <video> element not found:",e),X;let r=n,{trigger:c={},easing:s="linear",once:p=false,axis:u="y",preload:y="auto",onReady:i,onComplete:a,onProgress:f}=t,x=window.matchMedia("(prefers-reduced-motion: reduce)").matches,j=typeof s=="function"?s:V[s]??V.linear,J=P(c.start??"top top"),K=P(c.end??"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=y);let C=t.from??0,S=t.to,I=0,T=0,l=0,b=false,d=false,h=-1,w=0,v=false,g=false,F=()=>u==="x"?window.scrollX:window.scrollY,Q=()=>u==="x"?window.innerWidth:window.innerHeight;function A(){let o=r.getBoundingClientRect(),m=u==="x"?o.left:o.top,U=u==="x"?o.width:o.height,N=G({top:m,height:U},F(),Q(),J,K);I=N.tStart,T=N.tEnd;}function M(o){if(!g)return;let m=S??r.duration??0;r.currentTime=C+(m-C)*o,r.style.setProperty("--scroll-draw-progress",String(o)),f?.(o);}function E(){if(!b||d||!g)return;let o=j(z(F(),I,T,1));p&&(h=Math.max(h,o),o=h),w=o,M(o),o>=1&&!v?(v=true,a?.()):o<1&&!p&&(v=false),l=requestAnimationFrame(E);}function R(){if(g=true,S===void 0&&(S=r.duration),x){M(1),i?.();return}A(),i?.(),b&&!d&&(l=requestAnimationFrame(E));}r.readyState>=1?R():r.addEventListener("loadedmetadata",R,{once:true}),g||A();let D=new IntersectionObserver(o=>{o.forEach(m=>{b=m.isIntersecting,b&&!d&&g?l=requestAnimationFrame(E):cancelAnimationFrame(l);});}),L;function _(){clearTimeout(L),L=setTimeout(A,150);}return window.addEventListener("resize",_),window.addEventListener("orientationchange",_),D.observe(r),B(r,{type:"video",getProgress:()=>w,getTrigger:()=>({tStart:I,tEnd:T})}),{destroy(){cancelAnimationFrame(l),D.disconnect(),r.removeEventListener("loadedmetadata",R),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),clearTimeout(L),W(r);},replay(){h=-1,v=false,w=0,d=false,M(0);},pause(){d=true,cancelAnimationFrame(l);},resume(){d&&(d=false,b&&g&&(l=requestAnimationFrame(E)));},seek(o){let m=Math.min(1,Math.max(0,o));w=m,h=m,d=true,cancelAnimationFrame(l),M(m);},getProgress(){return w}}}export{ae as scrollVideo};
|
package/dist/vue/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),t}function Ke(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),c=t[l++]??m;return String(+(m+(c-m)*n).toFixed(4))})}function Qe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...ft[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:c=1,fade:u=false,easing:h="linear",trigger:P={},stagger:H=0,direction:S="forward",once:Y=false,debug:he=false,axis:V="y",scrollContainer:ee,autoReverse:U=false,delay:Z=0,strokeColor:E,strokeWidth:M,fillOpacity:C,waypoints:g,velocityScale:x=false,threshold:k=0,rootMargin:G="0px",repeat:O=0,repeatDelay:se=0,morphTo:L,clip:W,autoplay:_=false,duration:j=1e3,native:z=true,onProgress:p,onStart:T,onComplete:b,onEnter:y,onLeave:q,onEnterBack:Ae,onLeaveBack:Me}=l,be=W===true?"left":typeof W=="string"?W:false,we=typeof h=="function"?h:ae[h]??ae.linear,ke=le(P.start??"top bottom"),qe=le(P.end??"bottom top"),te=typeof ee=="string"?document.querySelector(ee):ee??null,pe=Array.isArray(E)?E[0]:null,J=Array.isArray(E)?E[1]:typeof E=="string"?E:null,K=Array.isArray(M)?M[0]:null,i=Array.isArray(M)?M[1]:typeof M=="number"?M:null,d=Array.isArray(C)?C[0]:null,F=Array.isArray(C)?C[1]:typeof C=="number"?C:null;function ne(o){let a=o*100;switch(be){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let $=be?[]:Array.from(e.querySelectorAll(m)),R=[],I=[],ie=0,ce=0,re=false,de=false,oe=0,Be=false,ve=-1,We=-1,ue=false,Fe=0,Ce=0,Le,Ue=null,$e=new Set,_e=-1,st=performance.now(),Ne=NaN;function He(){return te?V==="x"?te.scrollLeft:te.scrollTop:V==="x"?window.scrollX:window.scrollY}function it(){return te?V==="x"?te.clientWidth:te.clientHeight:V==="x"?window.innerWidth:window.innerHeight}function at(){let o=e.getBoundingClientRect(),a,v,X;if(te){let me=te.getBoundingClientRect();a=V==="x"?o.left-me.left+te.scrollLeft:o.top-me.top+te.scrollTop,v=V==="x"?o.width:o.height,X=He();}else a=V==="x"?o.left:o.top,v=V==="x"?o.width:o.height,X=He();let fe=ye({top:a,height:v},X,it(),ke,qe);ie=fe.tStart,ce=fe.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=kt(ie,ce,V));}function Et(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),be){let v=a==="reverse"?1-o:o;e.style.clipPath=ne(v);return}$.forEach((v,X)=>{v.style.strokeDashoffset=a==="reverse"?`${R[X]*o}`:`${R[X]*(1-o)}`,u&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&J?v.style.stroke=Re(pe,J,o):J&&(v.style.stroke=J),K!==null&&i!==null?v.style.strokeWidth=`${K+(i-K)*o}`:i!==null&&(v.style.strokeWidth=`${i}`),d!==null&&F!==null?v.style.fillOpacity=`${d+(F-d)*o}`:F!==null&&(v.style.fillOpacity=`${F}`),L&&v.tagName.toLowerCase()==="path"&&I[X]&&v.setAttribute("d",Ke(I[X],L,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),be){e.style.clipPath=ne(0);return}$.forEach((o,a)=>{o.style.strokeDasharray=`${R[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${R[a]}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`),L&&o.tagName.toLowerCase()==="path"&&I[a]&&o.setAttribute("d",I[a]);});}if($.forEach(o=>{Ot(o);let a=Ye(o);R.push(a),o.tagName.toLowerCase()==="path"?I.push(o.getAttribute("d")??""):I.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",u&&(o.style.opacity="1"),J&&(o.style.stroke=J),i!==null&&(o.style.strokeWidth=`${i}`),F!==null&&(o.style.fillOpacity=`${F}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`));}),be){if(s)return e.style.clipPath=ne(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ne(0);}else if(s)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(z===false||!Pt()||!$.length||typeof h!="string"||!(h in pt)||be||V!=="y"||te||c!==1||H!==0||Y||U||x!==false||L||g||O||Z>0||p||T||b||y||q||Ae||Me||E!=null||M!=null||C!=null||(P.start??"top bottom").trim()!=="top bottom"||(P.end??"bottom top").trim()!=="bottom top")}function Tt(){let o=`svg-scroll-draw-${++$t}`,a=S==="reverse"?"0":"var(--ssd-len)",v=S==="reverse"?"var(--ssd-len)":"0",X=`stroke-dashoffset:${a};`,fe=`stroke-dashoffset:${v};`;u&&(X+=`opacity:${S==="reverse"?1:0};`,fe+=`opacity:${S==="reverse"?0:1};`);let me=document.createElement("style");me.setAttribute("data-svg-scroll-draw",""),me.textContent=`@keyframes ${o}{from{${X}}to{${fe}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${pt[h]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(me);function ge(f,A){f.style.setProperty("--ssd-len",String(R[A])),f.style.strokeDasharray=`${R[A]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(o);}$.forEach(ge);let w=false,N=-1;function D(){if(N>=0)return N;let f=e.getBoundingClientRect(),{tStart:A,tEnd:B}=ye({top:f.top,height:f.height},He(),it(),ke,qe);return we(Q(He(),A,B,c))}return {destroy(){$.forEach(f=>{f.classList.remove(o),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),me.remove();},replay(){w=false,N=-1,$.forEach(ge);},pause(){w=true,$.forEach(f=>{f.style.animationPlayState="paused";});},resume(){w&&(w=false,$.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let A=Math.min(1,Math.max(0,f));N=A,w=true,$.forEach((B,Ie)=>{B.classList.remove(o),B.style.strokeDashoffset=S==="reverse"?`${R[Ie]*A}`:`${R[Ie]*(1-A)}`,u&&(B.style.opacity=S==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return D()}}}if(xt())return Tt();function At(){let o=Math.max(1,j),a=0,v=0;function X(D){let f=true;if(be){let A=Math.min(1,Math.max(0,D/o)),B=we(A);Fe=B,e.style.setProperty("--scroll-draw-progress",String(B)),e.style.clipPath=ne(S==="reverse"?1-B:B),p?.(B),A<1&&(f=false);}else $.forEach((A,B)=>{let Ie=B*H*o,De=Math.min(1,Math.max(0,(D-Ie)/o)),Se=we(De);A.style.strokeDashoffset=S==="reverse"?`${R[B]*Se}`:`${R[B]*(1-Se)}`,u&&(A.style.opacity=S==="reverse"?`${1-Se}`:`${Se}`),pe&&J?A.style.stroke=Re(pe,J,Se):J&&(A.style.stroke=J),K!==null&&i!==null?A.style.strokeWidth=`${K+(i-K)*Se}`:i!==null&&(A.style.strokeWidth=`${i}`),d!==null&&F!==null?A.style.fillOpacity=`${d+(F-d)*Se}`:F!==null&&(A.style.fillOpacity=`${F}`),L&&A.tagName.toLowerCase()==="path"&&I[B]&&A.setAttribute("d",Ke(I[B],L,Se)),B===0&&(p?.(Se),e.style.setProperty("--scroll-draw-progress",String(Se))),De<1&&(f=false);});if(g){let A=Math.min(1,Math.max(0,D/o)),B=we(A);for(let Ie in g){let De=parseFloat(Ie);B>=De&&!$e.has(De)&&($e.add(De),g[Ie]?.());}}return f}function fe(D){if(ue)return;let f=D-a;de||(de=true,T?.());let A=X(f);if(A&&!re){re=true,X(o*(1+Math.max(0,$.length-1)*H)),b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{a=performance.now(),de=false,re=false,$e.clear(),Ge(),oe=requestAnimationFrame(fe);},se));return}A||(oe=requestAnimationFrame(fe));}function me(){cancelAnimationFrame(oe),clearTimeout(Le),a=performance.now(),v=0,ue=false,de=false,re=false,Ce=0,$e.clear(),Ge(),oe=requestAnimationFrame(fe);}let ge=new IntersectionObserver(D=>{D.forEach(f=>{f.isIntersecting&&!(Y&&re)?me():!f.isIntersecting&&!Y&&!re&&(cancelAnimationFrame(oe),clearTimeout(Le),a=null);});},{root:te??null,threshold:k,rootMargin:G}),w;function N(){clearTimeout(w),w=setTimeout(()=>{$.forEach((D,f)=>{R[f]=Ye(D),D.style.strokeDasharray=`${R[f]}`;});},150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),Z>0?setTimeout(()=>ge.observe(e),Z):ge.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),ge.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(w);},replay(){Ce=0,me();},pause(){ue||(ue=true,v=performance.now()-a,cancelAnimationFrame(oe));},resume(){ue&&(ue=false,a=performance.now()-v,oe=requestAnimationFrame(fe));},seek(D){let f=Math.min(1,Math.max(0,D));Fe=f,ue=true,v=f*o,a=performance.now()-v,cancelAnimationFrame(oe),X(v);},getProgress(){return Fe}}}if(_)return At();at();function je(){if(!Be||ue)return;let o=performance.now(),a=He(),v=c;if(x!==false){let w=o-st,N=w>0?Math.abs(a-(_e<0?a:_e))/w:0;v=c*Math.max(.2,1+N*(typeof x=="number"?x:1)*.04);}_e=a,st=o;let X=U?We===-1||a>=We?"forward":"reverse":S;We=a;let fe=ce-ie,me=true,ge=fe===0?0:(a-ie)/fe;if(isNaN(Ne)||(Ne<=0&&ge>0?y?.():Ne>0&&ge<=0&&Me?.(),Ne<1&&ge>=1?q?.():Ne>=1&&ge<1&&Ae?.()),Ne=ge,be){let w=we(Q(a,ie,ce,v));Y&&!U&&(ve=Math.max(ve,w),w=ve),Fe=w,e.style.setProperty("--scroll-draw-progress",String(w));let N=X==="reverse"?1-w:w;e.style.clipPath=ne(N),p?.(w),!de&&Q(a,ie,ce,v)>0&&(de=true,T?.()),w>=1&&!re?(re=true,b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{ve=-1,de=false,re=false,e.style.clipPath=ne(0);},se))):w<1&&!Y&&(re=false),oe=requestAnimationFrame(je);return}if($.forEach((w,N)=>{let D=N*H*fe,f=we(Q(a,ie+D,ce+D,v));Y&&!U&&(ve=Math.max(ve,f),f=ve),Fe=f,w.style.strokeDashoffset=X==="reverse"?`${R[N]*f}`:`${R[N]*(1-f)}`,u&&(w.style.opacity=X==="reverse"?`${1-f}`:`${f}`),pe&&J?w.style.stroke=Re(pe,J,f):J&&(w.style.stroke=J),K!==null&&i!==null?w.style.strokeWidth=`${K+(i-K)*f}`:i!==null&&(w.style.strokeWidth=`${i}`),d!==null&&F!==null?w.style.fillOpacity=`${d+(F-d)*f}`:F!==null&&(w.style.fillOpacity=`${F}`),L&&w.tagName.toLowerCase()==="path"&&I[N]&&w.setAttribute("d",Ke(I[N],L,f)),N===0&&(p?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(me=false);}),g){let w=we(Q(a,ie,ce,v));for(let N in g){let D=parseFloat(N);w>=D&&!$e.has(D)&&($e.add(D),g[N]?.());}}!de&&Q(a,ie,ce,v)>0&&(de=true,T?.()),me&&!re?(re=true,b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{ve=-1,de=false,re=false,$e.clear(),Ge();},se))):!me&&!Y&&(re=false),oe=requestAnimationFrame(je);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{Be=a.isIntersecting,Be&&!ue?oe=requestAnimationFrame(je):cancelAnimationFrame(oe);});},{root:te??null,threshold:k,rootMargin:G}),Je;function Xe(){clearTimeout(Je),Je=setTimeout(()=>{$.forEach((o,a)=>{R[a]=Ye(o),o.style.strokeDasharray=`${R[a]}`;}),at();},150);}return window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe),Z>0?setTimeout(()=>Ze.observe(e),Z):Ze.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),Ze.disconnect(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,We=-1,_e=-1,de=false,re=false,Ce=0,ue=false,$e.clear(),clearTimeout(Le),Ge();},pause(){ue=true,cancelAnimationFrame(oe);},resume(){ue&&(ue=false,Be&&(oe=requestAnimationFrame(je)));},seek(o){let a=Math.min(1,Math.max(0,o));Fe=a,ve=a,ue=true,cancelAnimationFrame(oe),Et(a,S);},getProgress(){return Fe}}}var dt=new Map;function Pe(e,r){dt.set(e,r);}function Oe(e){dt.delete(e);}function Ft(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function gt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],m=t[2].trim();if(m)for(let c of m.split(/[\s,]+/)){let u=c.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function It(e,r,n){let t=gt(e),l=gt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,m)=>{let c=l[m];return s.fn!==c.fn||s.nums.length!==c.nums.length?n<1?`${s.fn}(${s.nums.map((u,h)=>`${u}${s.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,h)=>`${u+(c.nums[h]-u)*n}${s.units[h]}`).join(", ")})`}).join(" ")}function yt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Ft(t))return Re(t,l,n);if(t.includes("("))return It(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let c=parseFloat(s[1]),u=parseFloat(m[1]);return `${c+(u-c)*n}${s[2]||m[2]}`}return n<1?t:l}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ht={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Rt=0;function Ht(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:m=1,once:c=false,axis:u="y",scrollContainer:h,native:P=true,velocityScale:H=false,onProgress:S,onComplete:Y,onEnter:he,onLeave:V,onEnterBack:ee,onLeaveBack:U}=r,Z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof s=="function"?s:ae[s]??ae["ease-out"],M=le(l.start??"top bottom"),C=le(l.end??"bottom top"),g=typeof h=="string"?document.querySelector(h):h??null,x=Object.entries(t).map(([i,d])=>({prop:Nt(i),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function k(){let i=window.getComputedStyle(e);for(let d of x)d.from===""&&(d.from=i.getPropertyValue(d.prop).trim()||"0");}function G(){for(let i of x)e.style.setProperty(i.prop,String(i.to));}if(Z)return G(),Y?.(),n;k();function O(){if(!P||!Ht()||typeof s!="string"||!(s in ht)||u!=="y"||g||c||m!==1||S||Y||he||V||ee||U||H!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of x)if(!Dt.has(i.prop))return false;return true}function se(){let i=`ssd-a-${++Rt}`,d=x.map(I=>`${I.prop}:${I.from}`).join(";"),F=x.map(I=>`${I.prop}:${I.to}`).join(";"),ne=document.createElement("style");ne.setAttribute("data-ssd-animate",""),ne.textContent=`@keyframes ${i}{from{${d}}to{${F}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ht[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ne),e.classList.add(i);let $=()=>u==="x"?window.scrollX:window.scrollY,R=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),ne.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let ie=Math.min(1,Math.max(0,I));e.classList.remove(i);for(let ce of x)e.style.setProperty(ce.prop,yt(ce.from,ce.to,ie));},getProgress(){let I=e.getBoundingClientRect(),ie=$(),ce=R(),{tStart:re,tEnd:de}=ye({top:I.top,height:I.height},ie,ce,M,C);return E(Q(ie,re,de,m))}}}if(O())return se();let L=0,W=0,_=0,j=false,z=false,p=-1,T=0,b=false,y=NaN,q=-1,Ae=0,Me=()=>g?u==="x"?g.scrollLeft:g.scrollTop:u==="x"?window.scrollX:window.scrollY,be=()=>g?u==="x"?g.clientWidth:g.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function we(){let i=e.getBoundingClientRect(),d,F;if(g){let $=g.getBoundingClientRect();d=u==="x"?i.left-$.left+g.scrollLeft:i.top-$.top+g.scrollTop,F=u==="x"?i.width:i.height;}else d=u==="x"?i.left:i.top,F=u==="x"?i.width:i.height;let ne=ye({top:d,height:F},Me(),be(),M,C);L=ne.tStart,W=ne.tEnd;}function ke(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let d of x)e.style.setProperty(d.prop,yt(d.from,d.to,i));S?.(i);}function qe(i){if(isNaN(y)){y=i;return}y<=0&&i>0?he?.():y>0&&i<=0&&U?.(),y<1&&i>=1?V?.():y>=1&&i<1&&ee?.(),y=i;}function te(){if(!j||z)return;let i=performance.now(),d=Me(),F=m;if(H!==false){let R=i-Ae,I=R>0?Math.abs(d-(q<0?d:q))/R:0;F=m*Math.max(.2,1+I*(typeof H=="number"?H:1)*.04);}q=d,Ae=i;let ne=W===L?0:(d-L)/(W-L);qe(ne);let $=E(Q(d,L,W,F));c&&(p=Math.max(p,$),$=p),T=$,ke($),$>=1&&!b?(b=true,Y?.()):$<1&&!c&&(b=false),_=requestAnimationFrame(te);}we();{let i=E(Q(Me(),L,W,m));c&&i>0&&(p=i),T=i,ke(i);}let pe=new IntersectionObserver(i=>{i.forEach(d=>{j=d.isIntersecting,j&&!z?_=requestAnimationFrame(te):cancelAnimationFrame(_);});},{root:g??null}),J;function K(){clearTimeout(J),J=setTimeout(we,150);}return window.addEventListener("resize",K),window.addEventListener("orientationchange",K),pe.observe(e),Pe(e,{type:"animate",getProgress:()=>T,getTrigger:()=>({tStart:L,tEnd:W})}),{destroy(){cancelAnimationFrame(_),pe.disconnect(),window.removeEventListener("resize",K),window.removeEventListener("orientationchange",K),clearTimeout(J),Oe(e);},replay(){p=-1,b=false,T=0,z=false,ke(0);},pause(){z=true,cancelAnimationFrame(_);},resume(){z&&(z=false,j&&(_=requestAnimationFrame(te)));},seek(i){let d=Math.min(1,Math.max(0,i));T=d,p=d,z=true,cancelAnimationFrame(_),ke(d);},getProgress(){return T}}}var tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,r){if(typeof window>"u")return tt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),tt;let t=n,{from:l=0,to:s,format:m,easing:c="ease-out",trigger:u={},once:h=true,decimals:P,onComplete:H}=r,S=P!==void 0?p=>p.toFixed(P):m??(p=>String(Math.round(p))),Y=typeof c=="function"?c:ae[c]??ae["ease-out"],he=le(u.start??"top 80%"),V=le(u.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(s),H?.(),tt;t.textContent=S(l);let U=0,Z=0,E=0,M=false,C=false,g=-1,x=0,k=false,G=()=>window.scrollY,O=()=>window.innerHeight;function se(){let p=t.getBoundingClientRect(),T=ye({top:p.top,height:p.height},G(),O(),he,V);U=T.tStart,Z=T.tEnd;}function L(p){t.textContent=S(l+(s-l)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function W(){if(!M||C)return;let p=Y(Q(G(),U,Z,1));h&&(g=Math.max(g,p),p=g),x=p,L(p),p>=1&&!k?(k=true,H?.()):p<1&&!h&&(k=false),E=requestAnimationFrame(W);}se();{let p=Y(Q(G(),U,Z,1));h&&p>0&&(g=p),x=p,L(p);}let _=new IntersectionObserver(p=>{p.forEach(T=>{M=T.isIntersecting,M&&!C?E=requestAnimationFrame(W):cancelAnimationFrame(E);});}),j;function z(){clearTimeout(j),j=setTimeout(se,150);}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),_.observe(t),Pe(t,{type:"counter",getProgress:()=>x,getTrigger:()=>({tStart:U,tEnd:Z})}),{destroy(){cancelAnimationFrame(E),_.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(j),Oe(t);},replay(){g=-1,k=false,x=0,C=false,L(0);},pause(){C=true,cancelAnimationFrame(E);},resume(){C&&(C=false,M&&(E=requestAnimationFrame(W)));},seek(p){let T=Math.min(1,Math.max(0,p));x=T,g=T,C=true,cancelAnimationFrame(E),L(T);},getProgress(){return x}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,r={}){if(typeof window>"u")return bt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),bt;let t=n,{trigger:l={},easing:s="linear",once:m=false,axis:c="y",preload:u="auto",onReady:h,onComplete:P,onProgress:H}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Y=typeof s=="function"?s:ae[s]??ae.linear,he=le(l.start??"top top"),V=le(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=u);let ee=r.from??0,U=r.to,Z=0,E=0,M=0,C=false,g=false,x=-1,k=0,G=false,O=false,se=()=>c==="x"?window.scrollX:window.scrollY,L=()=>c==="x"?window.innerWidth:window.innerHeight;function W(){let y=t.getBoundingClientRect(),q=c==="x"?y.left:y.top,Ae=c==="x"?y.width:y.height,Me=ye({top:q,height:Ae},se(),L(),he,V);Z=Me.tStart,E=Me.tEnd;}function _(y){if(!O)return;let q=U??t.duration??0;t.currentTime=ee+(q-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),H?.(y);}function j(){if(!C||g||!O)return;let y=Y(Q(se(),Z,E,1));m&&(x=Math.max(x,y),y=x),k=y,_(y),y>=1&&!G?(G=true,P?.()):y<1&&!m&&(G=false),M=requestAnimationFrame(j);}function z(){if(O=true,U===void 0&&(U=t.duration),S){_(1),h?.();return}W(),h?.(),C&&!g&&(M=requestAnimationFrame(j));}t.readyState>=1?z():t.addEventListener("loadedmetadata",z,{once:true}),O||W();let p=new IntersectionObserver(y=>{y.forEach(q=>{C=q.isIntersecting,C&&!g&&O?M=requestAnimationFrame(j):cancelAnimationFrame(M);});}),T;function b(){clearTimeout(T),T=setTimeout(W,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),p.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:Z,tEnd:E})}),{destroy(){cancelAnimationFrame(M),p.disconnect(),t.removeEventListener("loadedmetadata",z),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),Oe(t);},replay(){x=-1,G=false,k=0,g=false,_(0);},pause(){g=true,cancelAnimationFrame(M);},resume(){g&&(g=false,C&&O&&(M=requestAnimationFrame(j)));},seek(y){let q=Math.min(1,Math.max(0,y));k=q,x=q,g=true,cancelAnimationFrame(M),_(q);},getProgress(){return k}}}function St(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function Vt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function wt(e){let r=St(e),n=new Map;for(let s of r){let m=s.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(s);}let t=[],l=Array.from(n.keys()).sort((s,m)=>s-m);for(let s of l){let m=n.get(s),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block";for(let u of m)c.appendChild(u);t.push(c);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function zt(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,m=s+(1-l);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ot(e,r={}){if(typeof window>"u")return vt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),vt;let t=n,{split:l="words",stagger:s=.04,easing:m="ease-out",from:c={opacity:0,y:24},trigger:u={},once:h=true,onComplete:P}=r,H=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof m=="function"?m:ae[m]??ae["ease-out"],Y=le(u.start??"top 85%"),he=le(u.end??"top 40%"),V=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;l==="chars"?ee=Vt(t):l==="lines"?ee=wt(t):ee=St(t);let U=ee.length;function Z(b,y){c?.opacity!==void 0&&(b.style.opacity=String(c.opacity+(1-c.opacity)*y));let q=qt(y,c);q&&(b.style.transform=q);}function E(b){t.style.setProperty("--scroll-draw-progress",String(b)),ee.forEach((y,q)=>{let Ae=S(zt(b,q,U,s));Z(y,Ae);});}if(H)return E(1),P?.(),{destroy(){t.innerHTML=V,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};E(0);let M=0,C=0,g=0,x=false,k=false,G=-1,O=0,se=false,L=()=>window.scrollY,W=()=>window.innerHeight;function _(){let b=t.getBoundingClientRect(),y=ye({top:b.top,height:b.height},L(),W(),Y,he);M=y.tStart,C=y.tEnd;}function j(){if(!x||k)return;let b=Q(L(),M,C,1);h&&(G=Math.max(G,b),b=G),O=b,E(b),b>=1&&!se?(se=true,P?.()):b<1&&!h&&(se=false),g=requestAnimationFrame(j);}_();let z=new IntersectionObserver(b=>{b.forEach(y=>{x=y.isIntersecting,x&&!k?g=requestAnimationFrame(j):cancelAnimationFrame(g);});}),p;function T(){clearTimeout(p),p=setTimeout(()=>{if(l==="lines"){let b=O;t.innerHTML=V,t.setAttribute("aria-label",t.textContent??""),ee=wt(t),E(b);}_();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),z.observe(t),Pe(t,{type:"text",getProgress:()=>O,getTrigger:()=>({tStart:M,tEnd:C})}),{destroy(){cancelAnimationFrame(g),z.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(p),t.innerHTML=V,t.removeAttribute("aria-label"),Oe(t);},replay(){G=-1,se=false,O=0,k=false,E(0);},pause(){k=true,cancelAnimationFrame(g);},resume(){k&&(k=false,x&&(g=requestAnimationFrame(j)));},seek(b){let y=Math.min(1,Math.max(0,b));O=y,G=y,k=true,cancelAnimationFrame(g),E(y);},getProgress(){return O}}}function pn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=Qe(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var dn=vue.defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=Qe(n.value,t);vue.onUnmounted(()=>l.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function gn(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=et(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var yn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=et(n.value,e.options);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function hn(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=nt(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var bn=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=nt(r.value,n);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("span",{ref:r})}});function wn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=rt(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var vn=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=rt(r.value,e.options??{});vue.onUnmounted(()=>n.destroy());}),()=>vue.h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Sn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=ot(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var En=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=ot(n.value,e.options??{});vue.onUnmounted(()=>t.destroy());}),()=>vue.h(e.tag,{ref:n},r.default?.())}});exports.ScrollAnimate=yn;exports.ScrollCounter=bn;exports.ScrollDraw=dn;exports.ScrollText=En;exports.ScrollVideo=vn;exports.useScrollAnimate=gn;exports.useScrollCounter=hn;exports.useScrollDraw=pn;exports.useScrollText=Sn;exports.useScrollVideo=wn;
|
|
1
|
+
'use strict';var vue=require('vue');function _t({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<n;d++){let x=Math.pow(l,d);c.push(x),s+=x;}let u=[0],m=0;for(let d=0;d<n;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<n;x++)if(d<=u[x+1]){let N=(d-u[x])/(u[x+1]-u[x]);if(x===0)return N*(2-N);let L=1-Math.pow(t,x);return L+(1-L)*(2*N-1)*(2*N-1)}return 1}}function qt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:_t(),elastic:qt()};function pe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Et(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Tt(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Be(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Bt(e,r,n){return Math.min(n,Math.max(r,e))}function Q(e,r,n,t){return n===r?0:Bt((e-r)/(n-r)*t,0,1)}function tt(e,r,n){let t=e.getBoundingClientRect(),l=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:n==="x"?t.left:t.top,height:l,scroll:n==="x"?window.scrollX:window.scrollY}}function xe(e,r,n,t,l){let s=Et(e.top,e.height,r,t.element)-Tt(t.viewport,n),c=Et(e.top,e.height,r,l.element)-Tt(l.viewport,n);return {tStart:s,tEnd:c}}function xt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function We(e,r,n){let t=xt(e),l=xt(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}var At={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 nt=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...r){nt&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Wt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ut(e){let r=[];for(let n=0;n<Mt;n++){let t=n/(Mt-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function rt(e){switch(e){case "linear":return "linear";case "ease-in":return Wt;case "ease-out":return Gt;case "ease-in-out":return jt()?Ut(ee["ease-in-out"]):null;default:return null}}var Xt=0;function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?ye("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Zt(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=n==="x"?window.scrollX:window.scrollY,c=e-s,u=r-s,m=n==="x";t.innerHTML=`
|
|
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 Lt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ct=/[MmLlHhVvCcSsQqTtAaZz]/g;function Jt(e,r,n){if(!nt)return;let t=(e.match(Ct)??[]).join("").toUpperCase(),l=(r.match(Ct)??[]).join("").toUpperCase(),s=(e.match(Lt)??[]).length,c=(r.match(Lt)??[]).length;if(t!==l){ye(`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.`,n);return}s!==c&&ye(`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.`,n);}function lt(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function ct(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...At[n],...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:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Me=false,axis:B="y",scrollContainer:Z,autoReverse:X=false,delay:W=0,strokeColor:A,strokeWidth:C,fillOpacity:M,waypoints:w,velocityScale:O=false,threshold:k=0,rootMargin:$="0px",repeat:E=0,repeatDelay:ne=0,morphTo:F,clip:re,autoplay:oe=false,duration:J=1e3,native:ue=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:I,onEnterBack:de,onLeaveBack:ve}=l,me=re===true?"left":typeof re=="string"?re:false,Se=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),_e=pe(x.end??"bottom top"),he=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(A)?A[0]:null,se=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray(C)?C[0]:null,G=Array.isArray(C)?C[1]:typeof C=="number"?C:null,fe=Array.isArray(M)?M[0]:null,Y=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function Ce(o){let a=o*100;switch(me){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=me?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,we=0,D=false,z=false,_=0,j=false,ae=-1,$e=-1,K=false,Ee=0,Re=0,De,ot=null;function gt(){ot?.destroy(),ot=null;}let He=new Set,yt=NaN,Ne=true,Ye=-1,ht=performance.now(),qe=NaN;function st(){return he?B==="x"?he.scrollLeft:he.scrollTop:B==="x"?window.scrollX:window.scrollY}function bt(){return he?B==="x"?he.clientWidth:he.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function wt(){let o=tt(e,he,B),a=xe(o,o.scroll,bt(),Le,_e);f=a.tStart,we=a.tEnd,Me&&nt&&(gt(),ot=Zt(f,we,B));}function Ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),me){let v=a==="reverse"?1-o:o;e.style.clipPath=Ce(v);return}V.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${P[le]*o}`:`${P[le]*(1-o)}`,m&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&se?v.style.stroke=We(be,se,o):se&&(v.style.stroke=se),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*o}`:Y!==null&&(v.style.fillOpacity=`${Y}`),F&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",lt(i[le],F,o));});}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=Ce(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${P[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`),F&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{Qt(o);let a=Be(o);P.push(a);let v=o.tagName.toLowerCase()==="path";v?i.push(o.getAttribute("d")??""):i.push(""),F&&(v?Jt(i[i.length-1],F,o):ye(`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"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),Y!==null&&(o.style.fillOpacity=`${Y}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`));}),me){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 vt=typeof d=="string"?rt(d):null;function Nt(){return !(ue===false||!Yt()||!V.length||!vt||me||B!=="y"||he||u!==1||N!==0||te||X||O!==false||F||w||E||W>0||y||T||g||p||I||de||ve||A!=null||C!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Vt(){let o=++Xt,a=`svg-scroll-draw-${o}`,v=`svg-scroll-draw-host-${o}`,le=`--svg-scroll-draw-${o}`,Ie=L==="reverse"?"0":"var(--ssd-len)",Pe=L==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Ie};`,S=`stroke-dashoffset:${Pe};`;m&&(Ae+=`opacity:${L==="reverse"?1:0};`,S+=`opacity:${L==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.textContent=`@keyframes ${a}{from{${Ae}}to{${S}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${vt};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(v);function ce(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(ce);let b=false,H=-1;function q(){if(H>=0)return H;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},st(),bt(),Le,_e);return Se(Q(st(),U,Te,u))}return {destroy(){e.classList.remove(v),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),R.remove();},replay(){b=false,H=-1,V.forEach(ce);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));H=U,b=true,V.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${P[ge]*U}`:`${P[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=Be(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(Nt())return Vt();function zt(){let o=Math.max(1,J),a=0,v=0,le=false;function Ie(b){let H=true;if(me){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);Ee=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Ce(L==="reverse"?1-h:h),y?.(h),q<1&&(H=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),ge=Se(Te);q.style.strokeDashoffset=L==="reverse"?`${P[h]*ge}`:`${P[h]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&se?q.style.stroke=We(be,se,ge):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),F&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",lt(i[h],F,ge)),h===0&&(Ee=ge,y?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(H=false);});if(w){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);for(let U in w){let Te=parseFloat(U);h>=Te&&!He.has(Te)&&(He.add(Te),w[U]?.());}}return H}function Pe(b){if(K)return;let H=b-a;z||(z=true,T?.());let q=Ie(H);if(q&&!D){D=true,Ie(o*(1+Math.max(0,V.length-1)*N)),g?.(),Re<(E==="infinite"?1/0:E??0)&&(Re++,De=setTimeout(()=>{a=performance.now(),z=false,D=false,He.clear(),Qe(),_=requestAnimationFrame(Pe);},ne));return}q||(_=requestAnimationFrame(Pe));}function Ae(){cancelAnimationFrame(_),clearTimeout(De),a=performance.now(),v=0,K=false,z=false,D=false,Re=0,le=true,Ee=0,He.clear(),Qe(),_=requestAnimationFrame(Pe);}let S=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&D)?Ae():!H.isIntersecting&&!te&&!D&&(cancelAnimationFrame(_),clearTimeout(De),le=false);});},{root:he??null,threshold:k,rootMargin:$}),R;function ce(){clearTimeout(R),R=setTimeout(()=>{V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),W>0?setTimeout(()=>S.observe(e),W):S.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(De),S.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(R);},replay(){Re=0,Ae();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(_));},resume(){K&&(K=false,le=true,a=performance.now()-v,_=requestAnimationFrame(Pe));},seek(b){let H=Math.min(1,Math.max(0,b));Ee=H,K=true,v=H*o,a=performance.now()-v,cancelAnimationFrame(_),Ie(v);},getProgress(){return Ee},refresh(){clearTimeout(R),V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});}}}if(oe)return zt();wt();function Ze(){if(!j||K)return;let o=performance.now(),a=st();if(!Ne&&O===false&&a===yt){_=requestAnimationFrame(Ze);return}Ne=false,yt=a;let v=u;if(O!==false){let S=o-ht,R=S>0?Math.abs(a-(Ye<0?a:Ye))/S:0;v=u*Math.max(.2,1+R*(typeof O=="number"?O:1)*.04);}Ye=a,ht=o;let le=X?$e===-1||a>=$e?"forward":"reverse":L;$e=a;let Ie=we-f,Pe=true,Ae=Ie===0?0:(a-f)/Ie;if(isNaN(qe)||(qe<=0&&Ae>0?p?.():qe>0&&Ae<=0&&ve?.(),qe<1&&Ae>=1?I?.():qe>=1&&Ae<1&&de?.()),qe=Ae,me){let S=Se(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,S),S=ae),Ee=S,e.style.setProperty("--scroll-draw-progress",String(S));let R=le==="reverse"?1-S:S;e.style.clipPath=Ce(R),y?.(S),!z&&Q(a,f,we,v)>0&&(z=true,T?.()),S>=1&&!D?(D=true,g?.(),Re<(E==="infinite"?1/0:E??0)&&(Re++,De=setTimeout(()=>{ae=-1,z=false,D=false,e.style.clipPath=Ce(0);},ne))):S<1&&!te&&(D=false),_=requestAnimationFrame(Ze);return}if(V.forEach((S,R)=>{let ce=R*N*Ie,b=Se(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Ee=b,S.style.strokeDashoffset=le==="reverse"?`${P[R]*b}`:`${P[R]*(1-b)}`,m&&(S.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&se?S.style.stroke=We(be,se,b):se&&(S.style.stroke=se),ie!==null&&G!==null?S.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(S.style.strokeWidth=`${G}`),fe!==null&&Y!==null?S.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(S.style.fillOpacity=`${Y}`),F&&S.tagName.toLowerCase()==="path"&&i[R]&&S.setAttribute("d",lt(i[R],F,b)),R===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),w){let S=Se(Q(a,f,we,v));for(let R in w){let ce=parseFloat(R);S>=ce&&!He.has(ce)&&(He.add(ce),w[R]?.());}}!z&&Q(a,f,we,v)>0&&(z=true,T?.()),Pe&&!D?(D=true,g?.(),Re<(E==="infinite"?1/0:E??0)&&(Re++,De=setTimeout(()=>{ae=-1,z=false,D=false,He.clear(),Qe(),Ne=true;},ne))):!Pe&&!te&&(D=false),_=requestAnimationFrame(Ze);}let it=false;function Je(){it||(it=true,_=requestAnimationFrame(function(){Ze();}));}function Ke(){it=false,cancelAnimationFrame(_);}let at=new IntersectionObserver(o=>{o.forEach(a=>{j=a.isIntersecting,j&&!K?(Ne=true,Je()):Ke();});},{root:he??null,threshold:k,rootMargin:$});function St(){V.forEach((o,a)=>{P[a]=Be(o),o.style.strokeDasharray=`${P[a]}`;}),wt(),Ne=true;}let et;function Ge(){clearTimeout(et),et=setTimeout(St,150);}window.addEventListener("resize",Ge),window.addEventListener("orientationchange",Ge);let je;return typeof ResizeObserver<"u"&&(je=new ResizeObserver(()=>Ge()),je.observe(document.body),je.observe(document.documentElement),je.observe(e)),W>0?setTimeout(()=>at.observe(e),W):at.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(De),Ke(),at.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(et),gt();},replay(){ae=-1,$e=-1,Ye=-1,z=false,D=false,Re=0,K=false,Ee=0,He.clear(),clearTimeout(De),Qe(),Ne=true,j&&Je();},pause(){K=true,Ke();},resume(){K&&(K=false,Ne=true,j&&Je());},seek(o){let a=Math.min(1,Math.max(0,o));Ee=a,ae=a,K=true,Ke(),Ht(a,L),Ne=true;},getProgress(){return Ee},refresh(){clearTimeout(et),St(),j&&!K&&Je();}}}var $t=new Map;function Ve(e,r){$t.set(e,r);}function ze(e){$t.delete(e);}function Kt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Pt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.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]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function en(e,r,n){let t=Pt(e),l=Pt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?n<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)*n}${s.units[d]}`).join(", ")})`}).join(" ")}function Ot(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Kt(t))return We(t,l,n);if(t.includes("("))return en(t,l,n);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)*n}${s[2]||c[2]}`}return n<1?t:l}function tn(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var nn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rn=0,kt="--scroll-draw-progress";function on(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ut(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Me,onComplete:B,onEnter:Z,onLeave:X,onEnterBack:W,onLeaveBack:A}=r,C=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:ee[s]??ee["ease-out"],w=pe(l.start??"top bottom"),O=pe(l.end??"bottom top"),k=te??e,$=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([i,f])=>({prop:tn(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function ne(){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 re=new Map;for(let i of [...E.map(f=>f.prop),kt])re.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of re)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(C)return F(),B?.(),{...n,destroy:oe,getProgress:()=>1};ne();let J=typeof s=="string"?rt(s):null;function ue(){if(!x||!on()||!J||m!=="y"||$||k!==e||u||c!==1||Me||B||Z||X||W||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!nn.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++rn}`,f=E.map(j=>`${j.prop}:${j.from}`).join(";"),we=E.map(j=>`${j.prop}:${j.to}`).join(";"),D=document.createElement("style");D.setAttribute("data-ssd-animate",""),D.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),D.remove(),e.style.animationPlayState="",oe();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let $e of E)e.style.setProperty($e.prop,Ot($e.from,$e.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=z(),$e=_(),{tStart:K,tEnd:Ee}=xe({top:j.top,height:j.height},ae,$e,w,O);return M(Q(ae,K,Ee,c))}}}if(ue())return y();let T=0,g=0,p=0,I=false,de=false,ve=-1,me=0,Se=false,Le=NaN,_e=-1,he=0,be=()=>$?m==="x"?$.scrollLeft:$.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>$?m==="x"?$.clientWidth:$.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=tt(k,$,m),f=xe(i,i.scroll,se(),w,O);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(kt,String(i));for(let f of E)e.style.setProperty(f.prop,Ot(f.from,f.to,i));Me?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&A?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&W?.(),Le=i;}function Y(){if(!I||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let _=i-he,j=_>0?Math.abs(f-(_e<0?f:_e))/_:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}_e=f,he=i;let D=g===T?0:(f-T)/(g-T);fe(D);let z=M(Q(f,T,g,we));u&&(ve=Math.max(ve,z),z=ve),me=z,G(z),z>=1&&!Se?(Se=true,B?.()):z<1&&!u&&(Se=false),p=requestAnimationFrame(Y);}ie(),g===T&&ye("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=M(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let Ce=new IntersectionObserver(i=>{i.forEach(f=>{I=f.isIntersecting,I&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:$??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),Ce.observe(e),Ve(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),Ce.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),ze(e);},replay(){ve=-1,Se=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,I&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,r){if(typeof window>"u")return mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollCounter: element not found:",e),mt;let t=n,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=r,L=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Me=pe(m.start??"top 80%"),B=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),N?.(),mt;let X=0,W=0,A=0,C=false,M=false,w=-1,O=0,k=false,$=()=>window.scrollY,E=()=>window.innerHeight;function ne(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},$(),E(),Me,B);X=T.tStart,W=T.tEnd;}function F(y){t.textContent=L(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function re(){if(!C||M)return;let y=te(Q($(),X,W,1));d&&(w=Math.max(w,y),y=w),O=y,F(y),y>=1&&!k?(k=true,N?.()):y<1&&!d&&(k=false),A=requestAnimationFrame(re);}ne();{let y=te(Q($(),X,W,1));d&&y>0&&(w=y),O=y,F(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{C=T.isIntersecting,C&&!M?A=requestAnimationFrame(re):cancelAnimationFrame(A);});}),J;function ue(){clearTimeout(J),J=setTimeout(ne,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),oe.observe(t),Ve(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:X,tEnd:W})}),{destroy(){cancelAnimationFrame(A),oe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),ze(t);},replay(){w=-1,k=false,O=0,M=false,F(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,C&&(A=requestAnimationFrame(re)));},seek(y){let T=Math.min(1,Math.max(0,y));O=T,w=T,M=true,cancelAnimationFrame(A),F(T);},getProgress(){return O}}}var Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,r={}){if(typeof window>"u")return Ft;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),Ft;let t=n,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=r,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,Me=pe(l.start??"top top"),B=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=r.from??0,X=r.to,W=0,A=0,C=0,M=false,w=false,O=-1,k=0,$=false,E=false,ne=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function re(){let p=t.getBoundingClientRect(),I=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:I,height:de},ne(),F(),Me,B);W=ve.tStart,A=ve.tEnd;}function oe(p){if(!E)return;let I=X??t.duration??0;t.currentTime=Z+(I-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!M||w||!E)return;let p=te(Q(ne(),W,A,1));c&&(O=Math.max(O,p),p=O),k=p,oe(p),p>=1&&!$?($=true,x?.()):p<1&&!c&&($=false),C=requestAnimationFrame(J);}function ue(){if(E=true,X===void 0&&(X=t.duration),L){oe(1),d?.();return}re(),d?.(),M&&!w&&(C=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),E||re();let y=new IntersectionObserver(p=>{p.forEach(I=>{M=I.isIntersecting,M&&!w&&E?C=requestAnimationFrame(J):cancelAnimationFrame(C);});}),T;function g(){clearTimeout(T),T=setTimeout(re,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Ve(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:W,tEnd:A})}),{destroy(){cancelAnimationFrame(C),y.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),ze(t);},replay(){O=-1,$=false,k=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,M&&E&&(C=requestAnimationFrame(J)));},seek(p){let I=Math.min(1,Math.max(0,p));k=I,O=I,w=true,cancelAnimationFrame(C),oe(I);},getProgress(){return k}}}function Dt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function sn(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function Rt(e){let r=Dt(e),n=new Map;for(let s of r){let c=s.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(s);}let t=[],l=Array.from(n.keys()).sort((s,c)=>s-c);for(let s of l){let c=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function an(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ln(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var It={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,r={}){if(typeof window>"u")return It;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollText: element not found:",e),It;let t=n,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=r,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Me=pe(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=sn(t):l==="lines"?Z=Rt(t):Z=Dt(t);let X=Z.length;function W(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let I=ln(p,u);I&&(g.style.transform=I);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,I)=>{let de=L(an(g,I,X,s));W(p,de);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let C=0,M=0,w=0,O=false,k=false,$=-1,E=0,ne=false,F=()=>window.scrollY,re=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},F(),re(),te,Me);C=p.tStart,M=p.tEnd;}function J(){if(!O||k)return;let g=Q(F(),C,M,1);d&&($=Math.max($,g),g=$),E=g,A(g),g>=1&&!ne?(ne=true,x?.()):g<1&&!d&&(ne=false),w=requestAnimationFrame(J);}oe();let ue=new IntersectionObserver(g=>{g.forEach(p=>{O=p.isIntersecting,O&&!k?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),Z=Rt(t),A(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Ve(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=B,t.removeAttribute("aria-label"),ze(t);},replay(){$=-1,ne=false,E=0,k=false,A(0);},pause(){k=true,cancelAnimationFrame(w);},resume(){k&&(k=false,O&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));E=p,$=p,k=true,cancelAnimationFrame(w),A(p);},getProgress(){return E}}}function Bn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=ct(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var Wn=vue.defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=ct(n.value,t);vue.onUnmounted(()=>l.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function Gn(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=ut(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var jn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=ut(n.value,e.options);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("div",{ref:n},r.default?.())}});function Un(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=ft(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var Xn=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=ft(r.value,n);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("span",{ref:r})}});function Yn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=pt(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var Qn=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=pt(r.value,e.options??{});vue.onUnmounted(()=>n.destroy());}),()=>vue.h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Zn(e={}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let n=dt(r.value,e);vue.onUnmounted(()=>n.destroy());}),r}var Jn=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let t=dt(n.value,e.options??{});vue.onUnmounted(()=>t.destroy());}),()=>vue.h(e.tag,{ref:n},r.default?.())}});exports.ScrollAnimate=jn;exports.ScrollCounter=Xn;exports.ScrollDraw=Wn;exports.ScrollText=Jn;exports.ScrollVideo=Qn;exports.useScrollAnimate=Gn;exports.useScrollCounter=Un;exports.useScrollDraw=Bn;exports.useScrollText=Zn;exports.useScrollVideo=Yn;
|
package/dist/vue/index.d.mts
CHANGED
|
@@ -131,6 +131,33 @@ interface ScrollAnimateOptions {
|
|
|
131
131
|
* Higher values = more dramatic speed-up. Default sensitivity: 1.
|
|
132
132
|
*/
|
|
133
133
|
velocityScale?: boolean | number;
|
|
134
|
+
/**
|
|
135
|
+
* Honour `prefers-reduced-motion: reduce` by applying the final state and not
|
|
136
|
+
* animating. Default: `true`.
|
|
137
|
+
*
|
|
138
|
+
* Set to `false` only when the movement is *scroll-linked scrubbing* rather
|
|
139
|
+
* than autonomous motion — it advances solely as the user scrolls, 1:1 with
|
|
140
|
+
* their input, so it is direct manipulation rather than something that plays at
|
|
141
|
+
* them. `scrollHorizontal` sets this, because jumping to the final state there
|
|
142
|
+
* would leave every panel but the last unreachable inside the sticky
|
|
143
|
+
* `overflow: hidden` container.
|
|
144
|
+
*/
|
|
145
|
+
respectReducedMotion?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Element whose geometry defines the trigger window, when that is not the
|
|
148
|
+
* element being animated. Defaults to the animated element.
|
|
149
|
+
*
|
|
150
|
+
* Needed whenever the animated element cannot supply the scroll length itself —
|
|
151
|
+
* the case that matters is a `position: sticky` stage, where the pinned element
|
|
152
|
+
* is exactly one viewport tall and all of the scroll room belongs to its
|
|
153
|
+
* container. Resolving `top top` → `bottom bottom` against the pinned element
|
|
154
|
+
* there yields tStart === tEnd, a zero-length window, and no movement at all.
|
|
155
|
+
*
|
|
156
|
+
* Setting this disables the native CSS fast path: `animation-timeline: view()`
|
|
157
|
+
* always measures the element the animation is attached to, so it cannot express
|
|
158
|
+
* a separate subject.
|
|
159
|
+
*/
|
|
160
|
+
triggerElement?: Element;
|
|
134
161
|
onProgress?: (alpha: number) => void;
|
|
135
162
|
onComplete?: () => void;
|
|
136
163
|
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -131,6 +131,33 @@ interface ScrollAnimateOptions {
|
|
|
131
131
|
* Higher values = more dramatic speed-up. Default sensitivity: 1.
|
|
132
132
|
*/
|
|
133
133
|
velocityScale?: boolean | number;
|
|
134
|
+
/**
|
|
135
|
+
* Honour `prefers-reduced-motion: reduce` by applying the final state and not
|
|
136
|
+
* animating. Default: `true`.
|
|
137
|
+
*
|
|
138
|
+
* Set to `false` only when the movement is *scroll-linked scrubbing* rather
|
|
139
|
+
* than autonomous motion — it advances solely as the user scrolls, 1:1 with
|
|
140
|
+
* their input, so it is direct manipulation rather than something that plays at
|
|
141
|
+
* them. `scrollHorizontal` sets this, because jumping to the final state there
|
|
142
|
+
* would leave every panel but the last unreachable inside the sticky
|
|
143
|
+
* `overflow: hidden` container.
|
|
144
|
+
*/
|
|
145
|
+
respectReducedMotion?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Element whose geometry defines the trigger window, when that is not the
|
|
148
|
+
* element being animated. Defaults to the animated element.
|
|
149
|
+
*
|
|
150
|
+
* Needed whenever the animated element cannot supply the scroll length itself —
|
|
151
|
+
* the case that matters is a `position: sticky` stage, where the pinned element
|
|
152
|
+
* is exactly one viewport tall and all of the scroll room belongs to its
|
|
153
|
+
* container. Resolving `top top` → `bottom bottom` against the pinned element
|
|
154
|
+
* there yields tStart === tEnd, a zero-length window, and no movement at all.
|
|
155
|
+
*
|
|
156
|
+
* Setting this disables the native CSS fast path: `animation-timeline: view()`
|
|
157
|
+
* always measures the element the animation is attached to, so it cannot express
|
|
158
|
+
* a separate subject.
|
|
159
|
+
*/
|
|
160
|
+
triggerElement?: Element;
|
|
134
161
|
onProgress?: (alpha: number) => void;
|
|
135
162
|
onComplete?: () => void;
|
|
136
163
|
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
package/dist/vue/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {defineComponent,ref,onMounted,onUnmounted,h}from'vue';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),t}function Ke(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let m=parseFloat(s),c=t[l++]??m;return String(+(m+(c-m)*n).toFixed(4))})}function Qe(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...ft[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:c=1,fade:u=false,easing:h="linear",trigger:P={},stagger:H=0,direction:S="forward",once:Y=false,debug:he=false,axis:V="y",scrollContainer:ee,autoReverse:U=false,delay:Z=0,strokeColor:E,strokeWidth:M,fillOpacity:C,waypoints:g,velocityScale:x=false,threshold:k=0,rootMargin:G="0px",repeat:O=0,repeatDelay:se=0,morphTo:L,clip:W,autoplay:_=false,duration:j=1e3,native:z=true,onProgress:p,onStart:T,onComplete:b,onEnter:y,onLeave:q,onEnterBack:Ae,onLeaveBack:Me}=l,be=W===true?"left":typeof W=="string"?W:false,we=typeof h=="function"?h:ae[h]??ae.linear,ke=le(P.start??"top bottom"),qe=le(P.end??"bottom top"),te=typeof ee=="string"?document.querySelector(ee):ee??null,pe=Array.isArray(E)?E[0]:null,J=Array.isArray(E)?E[1]:typeof E=="string"?E:null,K=Array.isArray(M)?M[0]:null,i=Array.isArray(M)?M[1]:typeof M=="number"?M:null,d=Array.isArray(C)?C[0]:null,F=Array.isArray(C)?C[1]:typeof C=="number"?C:null;function ne(o){let a=o*100;switch(be){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let $=be?[]:Array.from(e.querySelectorAll(m)),R=[],I=[],ie=0,ce=0,re=false,de=false,oe=0,Be=false,ve=-1,We=-1,ue=false,Fe=0,Ce=0,Le,Ue=null,$e=new Set,_e=-1,st=performance.now(),Ne=NaN;function He(){return te?V==="x"?te.scrollLeft:te.scrollTop:V==="x"?window.scrollX:window.scrollY}function it(){return te?V==="x"?te.clientWidth:te.clientHeight:V==="x"?window.innerWidth:window.innerHeight}function at(){let o=e.getBoundingClientRect(),a,v,X;if(te){let me=te.getBoundingClientRect();a=V==="x"?o.left-me.left+te.scrollLeft:o.top-me.top+te.scrollTop,v=V==="x"?o.width:o.height,X=He();}else a=V==="x"?o.left:o.top,v=V==="x"?o.width:o.height,X=He();let fe=ye({top:a,height:v},X,it(),ke,qe);ie=fe.tStart,ce=fe.tEnd,he&&process.env.NODE_ENV!=="production"&&(Ue?.remove(),Ue=kt(ie,ce,V));}function Et(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),be){let v=a==="reverse"?1-o:o;e.style.clipPath=ne(v);return}$.forEach((v,X)=>{v.style.strokeDashoffset=a==="reverse"?`${R[X]*o}`:`${R[X]*(1-o)}`,u&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),pe&&J?v.style.stroke=Re(pe,J,o):J&&(v.style.stroke=J),K!==null&&i!==null?v.style.strokeWidth=`${K+(i-K)*o}`:i!==null&&(v.style.strokeWidth=`${i}`),d!==null&&F!==null?v.style.fillOpacity=`${d+(F-d)*o}`:F!==null&&(v.style.fillOpacity=`${F}`),L&&v.tagName.toLowerCase()==="path"&&I[X]&&v.setAttribute("d",Ke(I[X],L,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),be){e.style.clipPath=ne(0);return}$.forEach((o,a)=>{o.style.strokeDasharray=`${R[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${R[a]}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`),L&&o.tagName.toLowerCase()==="path"&&I[a]&&o.setAttribute("d",I[a]);});}if($.forEach(o=>{Ot(o);let a=Ye(o);R.push(a),o.tagName.toLowerCase()==="path"?I.push(o.getAttribute("d")??""):I.push(""),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",u&&(o.style.opacity="1"),J&&(o.style.stroke=J),i!==null&&(o.style.strokeWidth=`${i}`),F!==null&&(o.style.fillOpacity=`${F}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",pe&&(o.style.stroke=pe),K!==null&&(o.style.strokeWidth=`${K}`),d!==null&&(o.style.fillOpacity=`${d}`));}),be){if(s)return e.style.clipPath=ne(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ne(0);}else if(s)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(z===false||!Pt()||!$.length||typeof h!="string"||!(h in pt)||be||V!=="y"||te||c!==1||H!==0||Y||U||x!==false||L||g||O||Z>0||p||T||b||y||q||Ae||Me||E!=null||M!=null||C!=null||(P.start??"top bottom").trim()!=="top bottom"||(P.end??"bottom top").trim()!=="bottom top")}function Tt(){let o=`svg-scroll-draw-${++$t}`,a=S==="reverse"?"0":"var(--ssd-len)",v=S==="reverse"?"var(--ssd-len)":"0",X=`stroke-dashoffset:${a};`,fe=`stroke-dashoffset:${v};`;u&&(X+=`opacity:${S==="reverse"?1:0};`,fe+=`opacity:${S==="reverse"?0:1};`);let me=document.createElement("style");me.setAttribute("data-svg-scroll-draw",""),me.textContent=`@keyframes ${o}{from{${X}}to{${fe}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${pt[h]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(me);function ge(f,A){f.style.setProperty("--ssd-len",String(R[A])),f.style.strokeDasharray=`${R[A]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(o);}$.forEach(ge);let w=false,N=-1;function D(){if(N>=0)return N;let f=e.getBoundingClientRect(),{tStart:A,tEnd:B}=ye({top:f.top,height:f.height},He(),it(),ke,qe);return we(Q(He(),A,B,c))}return {destroy(){$.forEach(f=>{f.classList.remove(o),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),me.remove();},replay(){w=false,N=-1,$.forEach(ge);},pause(){w=true,$.forEach(f=>{f.style.animationPlayState="paused";});},resume(){w&&(w=false,$.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let A=Math.min(1,Math.max(0,f));N=A,w=true,$.forEach((B,Ie)=>{B.classList.remove(o),B.style.strokeDashoffset=S==="reverse"?`${R[Ie]*A}`:`${R[Ie]*(1-A)}`,u&&(B.style.opacity=S==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return D()}}}if(xt())return Tt();function At(){let o=Math.max(1,j),a=0,v=0;function X(D){let f=true;if(be){let A=Math.min(1,Math.max(0,D/o)),B=we(A);Fe=B,e.style.setProperty("--scroll-draw-progress",String(B)),e.style.clipPath=ne(S==="reverse"?1-B:B),p?.(B),A<1&&(f=false);}else $.forEach((A,B)=>{let Ie=B*H*o,De=Math.min(1,Math.max(0,(D-Ie)/o)),Se=we(De);A.style.strokeDashoffset=S==="reverse"?`${R[B]*Se}`:`${R[B]*(1-Se)}`,u&&(A.style.opacity=S==="reverse"?`${1-Se}`:`${Se}`),pe&&J?A.style.stroke=Re(pe,J,Se):J&&(A.style.stroke=J),K!==null&&i!==null?A.style.strokeWidth=`${K+(i-K)*Se}`:i!==null&&(A.style.strokeWidth=`${i}`),d!==null&&F!==null?A.style.fillOpacity=`${d+(F-d)*Se}`:F!==null&&(A.style.fillOpacity=`${F}`),L&&A.tagName.toLowerCase()==="path"&&I[B]&&A.setAttribute("d",Ke(I[B],L,Se)),B===0&&(p?.(Se),e.style.setProperty("--scroll-draw-progress",String(Se))),De<1&&(f=false);});if(g){let A=Math.min(1,Math.max(0,D/o)),B=we(A);for(let Ie in g){let De=parseFloat(Ie);B>=De&&!$e.has(De)&&($e.add(De),g[Ie]?.());}}return f}function fe(D){if(ue)return;let f=D-a;de||(de=true,T?.());let A=X(f);if(A&&!re){re=true,X(o*(1+Math.max(0,$.length-1)*H)),b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{a=performance.now(),de=false,re=false,$e.clear(),Ge(),oe=requestAnimationFrame(fe);},se));return}A||(oe=requestAnimationFrame(fe));}function me(){cancelAnimationFrame(oe),clearTimeout(Le),a=performance.now(),v=0,ue=false,de=false,re=false,Ce=0,$e.clear(),Ge(),oe=requestAnimationFrame(fe);}let ge=new IntersectionObserver(D=>{D.forEach(f=>{f.isIntersecting&&!(Y&&re)?me():!f.isIntersecting&&!Y&&!re&&(cancelAnimationFrame(oe),clearTimeout(Le),a=null);});},{root:te??null,threshold:k,rootMargin:G}),w;function N(){clearTimeout(w),w=setTimeout(()=>{$.forEach((D,f)=>{R[f]=Ye(D),D.style.strokeDasharray=`${R[f]}`;});},150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),Z>0?setTimeout(()=>ge.observe(e),Z):ge.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),ge.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(w);},replay(){Ce=0,me();},pause(){ue||(ue=true,v=performance.now()-a,cancelAnimationFrame(oe));},resume(){ue&&(ue=false,a=performance.now()-v,oe=requestAnimationFrame(fe));},seek(D){let f=Math.min(1,Math.max(0,D));Fe=f,ue=true,v=f*o,a=performance.now()-v,cancelAnimationFrame(oe),X(v);},getProgress(){return Fe}}}if(_)return At();at();function je(){if(!Be||ue)return;let o=performance.now(),a=He(),v=c;if(x!==false){let w=o-st,N=w>0?Math.abs(a-(_e<0?a:_e))/w:0;v=c*Math.max(.2,1+N*(typeof x=="number"?x:1)*.04);}_e=a,st=o;let X=U?We===-1||a>=We?"forward":"reverse":S;We=a;let fe=ce-ie,me=true,ge=fe===0?0:(a-ie)/fe;if(isNaN(Ne)||(Ne<=0&&ge>0?y?.():Ne>0&&ge<=0&&Me?.(),Ne<1&&ge>=1?q?.():Ne>=1&&ge<1&&Ae?.()),Ne=ge,be){let w=we(Q(a,ie,ce,v));Y&&!U&&(ve=Math.max(ve,w),w=ve),Fe=w,e.style.setProperty("--scroll-draw-progress",String(w));let N=X==="reverse"?1-w:w;e.style.clipPath=ne(N),p?.(w),!de&&Q(a,ie,ce,v)>0&&(de=true,T?.()),w>=1&&!re?(re=true,b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{ve=-1,de=false,re=false,e.style.clipPath=ne(0);},se))):w<1&&!Y&&(re=false),oe=requestAnimationFrame(je);return}if($.forEach((w,N)=>{let D=N*H*fe,f=we(Q(a,ie+D,ce+D,v));Y&&!U&&(ve=Math.max(ve,f),f=ve),Fe=f,w.style.strokeDashoffset=X==="reverse"?`${R[N]*f}`:`${R[N]*(1-f)}`,u&&(w.style.opacity=X==="reverse"?`${1-f}`:`${f}`),pe&&J?w.style.stroke=Re(pe,J,f):J&&(w.style.stroke=J),K!==null&&i!==null?w.style.strokeWidth=`${K+(i-K)*f}`:i!==null&&(w.style.strokeWidth=`${i}`),d!==null&&F!==null?w.style.fillOpacity=`${d+(F-d)*f}`:F!==null&&(w.style.fillOpacity=`${F}`),L&&w.tagName.toLowerCase()==="path"&&I[N]&&w.setAttribute("d",Ke(I[N],L,f)),N===0&&(p?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(me=false);}),g){let w=we(Q(a,ie,ce,v));for(let N in g){let D=parseFloat(N);w>=D&&!$e.has(D)&&($e.add(D),g[N]?.());}}!de&&Q(a,ie,ce,v)>0&&(de=true,T?.()),me&&!re?(re=true,b?.(),Ce<(O==="infinite"?1/0:O??0)&&(Ce++,Le=setTimeout(()=>{ve=-1,de=false,re=false,$e.clear(),Ge();},se))):!me&&!Y&&(re=false),oe=requestAnimationFrame(je);}let Ze=new IntersectionObserver(o=>{o.forEach(a=>{Be=a.isIntersecting,Be&&!ue?oe=requestAnimationFrame(je):cancelAnimationFrame(oe);});},{root:te??null,threshold:k,rootMargin:G}),Je;function Xe(){clearTimeout(Je),Je=setTimeout(()=>{$.forEach((o,a)=>{R[a]=Ye(o),o.style.strokeDasharray=`${R[a]}`;}),at();},150);}return window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe),Z>0?setTimeout(()=>Ze.observe(e),Z):Ze.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(Le),Ze.disconnect(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(Je),Ue?.remove();},replay(){ve=-1,We=-1,_e=-1,de=false,re=false,Ce=0,ue=false,$e.clear(),clearTimeout(Le),Ge();},pause(){ue=true,cancelAnimationFrame(oe);},resume(){ue&&(ue=false,Be&&(oe=requestAnimationFrame(je)));},seek(o){let a=Math.min(1,Math.max(0,o));Fe=a,ve=a,ue=true,cancelAnimationFrame(oe),Et(a,S);},getProgress(){return Fe}}}var dt=new Map;function Pe(e,r){dt.set(e,r);}function Oe(e){dt.delete(e);}function Ft(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function gt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],m=t[2].trim();if(m)for(let c of m.split(/[\s,]+/)){let u=c.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function It(e,r,n){let t=gt(e),l=gt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,m)=>{let c=l[m];return s.fn!==c.fn||s.nums.length!==c.nums.length?n<1?`${s.fn}(${s.nums.map((u,h)=>`${u}${s.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,h)=>`${u+(c.nums[h]-u)*n}${s.units[h]}`).join(", ")})`}).join(" ")}function yt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Ft(t))return Re(t,l,n);if(t.includes("("))return It(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),m=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let c=parseFloat(s[1]),u=parseFloat(m[1]);return `${c+(u-c)*n}${s[2]||m[2]}`}return n<1?t:l}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ht={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Rt=0;function Ht(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:m=1,once:c=false,axis:u="y",scrollContainer:h,native:P=true,velocityScale:H=false,onProgress:S,onComplete:Y,onEnter:he,onLeave:V,onEnterBack:ee,onLeaveBack:U}=r,Z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof s=="function"?s:ae[s]??ae["ease-out"],M=le(l.start??"top bottom"),C=le(l.end??"bottom top"),g=typeof h=="string"?document.querySelector(h):h??null,x=Object.entries(t).map(([i,d])=>({prop:Nt(i),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function k(){let i=window.getComputedStyle(e);for(let d of x)d.from===""&&(d.from=i.getPropertyValue(d.prop).trim()||"0");}function G(){for(let i of x)e.style.setProperty(i.prop,String(i.to));}if(Z)return G(),Y?.(),n;k();function O(){if(!P||!Ht()||typeof s!="string"||!(s in ht)||u!=="y"||g||c||m!==1||S||Y||he||V||ee||U||H!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of x)if(!Dt.has(i.prop))return false;return true}function se(){let i=`ssd-a-${++Rt}`,d=x.map(I=>`${I.prop}:${I.from}`).join(";"),F=x.map(I=>`${I.prop}:${I.to}`).join(";"),ne=document.createElement("style");ne.setAttribute("data-ssd-animate",""),ne.textContent=`@keyframes ${i}{from{${d}}to{${F}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ht[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ne),e.classList.add(i);let $=()=>u==="x"?window.scrollX:window.scrollY,R=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),ne.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let ie=Math.min(1,Math.max(0,I));e.classList.remove(i);for(let ce of x)e.style.setProperty(ce.prop,yt(ce.from,ce.to,ie));},getProgress(){let I=e.getBoundingClientRect(),ie=$(),ce=R(),{tStart:re,tEnd:de}=ye({top:I.top,height:I.height},ie,ce,M,C);return E(Q(ie,re,de,m))}}}if(O())return se();let L=0,W=0,_=0,j=false,z=false,p=-1,T=0,b=false,y=NaN,q=-1,Ae=0,Me=()=>g?u==="x"?g.scrollLeft:g.scrollTop:u==="x"?window.scrollX:window.scrollY,be=()=>g?u==="x"?g.clientWidth:g.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function we(){let i=e.getBoundingClientRect(),d,F;if(g){let $=g.getBoundingClientRect();d=u==="x"?i.left-$.left+g.scrollLeft:i.top-$.top+g.scrollTop,F=u==="x"?i.width:i.height;}else d=u==="x"?i.left:i.top,F=u==="x"?i.width:i.height;let ne=ye({top:d,height:F},Me(),be(),M,C);L=ne.tStart,W=ne.tEnd;}function ke(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let d of x)e.style.setProperty(d.prop,yt(d.from,d.to,i));S?.(i);}function qe(i){if(isNaN(y)){y=i;return}y<=0&&i>0?he?.():y>0&&i<=0&&U?.(),y<1&&i>=1?V?.():y>=1&&i<1&&ee?.(),y=i;}function te(){if(!j||z)return;let i=performance.now(),d=Me(),F=m;if(H!==false){let R=i-Ae,I=R>0?Math.abs(d-(q<0?d:q))/R:0;F=m*Math.max(.2,1+I*(typeof H=="number"?H:1)*.04);}q=d,Ae=i;let ne=W===L?0:(d-L)/(W-L);qe(ne);let $=E(Q(d,L,W,F));c&&(p=Math.max(p,$),$=p),T=$,ke($),$>=1&&!b?(b=true,Y?.()):$<1&&!c&&(b=false),_=requestAnimationFrame(te);}we();{let i=E(Q(Me(),L,W,m));c&&i>0&&(p=i),T=i,ke(i);}let pe=new IntersectionObserver(i=>{i.forEach(d=>{j=d.isIntersecting,j&&!z?_=requestAnimationFrame(te):cancelAnimationFrame(_);});},{root:g??null}),J;function K(){clearTimeout(J),J=setTimeout(we,150);}return window.addEventListener("resize",K),window.addEventListener("orientationchange",K),pe.observe(e),Pe(e,{type:"animate",getProgress:()=>T,getTrigger:()=>({tStart:L,tEnd:W})}),{destroy(){cancelAnimationFrame(_),pe.disconnect(),window.removeEventListener("resize",K),window.removeEventListener("orientationchange",K),clearTimeout(J),Oe(e);},replay(){p=-1,b=false,T=0,z=false,ke(0);},pause(){z=true,cancelAnimationFrame(_);},resume(){z&&(z=false,j&&(_=requestAnimationFrame(te)));},seek(i){let d=Math.min(1,Math.max(0,i));T=d,p=d,z=true,cancelAnimationFrame(_),ke(d);},getProgress(){return T}}}var tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,r){if(typeof window>"u")return tt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),tt;let t=n,{from:l=0,to:s,format:m,easing:c="ease-out",trigger:u={},once:h=true,decimals:P,onComplete:H}=r,S=P!==void 0?p=>p.toFixed(P):m??(p=>String(Math.round(p))),Y=typeof c=="function"?c:ae[c]??ae["ease-out"],he=le(u.start??"top 80%"),V=le(u.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(s),H?.(),tt;t.textContent=S(l);let U=0,Z=0,E=0,M=false,C=false,g=-1,x=0,k=false,G=()=>window.scrollY,O=()=>window.innerHeight;function se(){let p=t.getBoundingClientRect(),T=ye({top:p.top,height:p.height},G(),O(),he,V);U=T.tStart,Z=T.tEnd;}function L(p){t.textContent=S(l+(s-l)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function W(){if(!M||C)return;let p=Y(Q(G(),U,Z,1));h&&(g=Math.max(g,p),p=g),x=p,L(p),p>=1&&!k?(k=true,H?.()):p<1&&!h&&(k=false),E=requestAnimationFrame(W);}se();{let p=Y(Q(G(),U,Z,1));h&&p>0&&(g=p),x=p,L(p);}let _=new IntersectionObserver(p=>{p.forEach(T=>{M=T.isIntersecting,M&&!C?E=requestAnimationFrame(W):cancelAnimationFrame(E);});}),j;function z(){clearTimeout(j),j=setTimeout(se,150);}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),_.observe(t),Pe(t,{type:"counter",getProgress:()=>x,getTrigger:()=>({tStart:U,tEnd:Z})}),{destroy(){cancelAnimationFrame(E),_.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(j),Oe(t);},replay(){g=-1,k=false,x=0,C=false,L(0);},pause(){C=true,cancelAnimationFrame(E);},resume(){C&&(C=false,M&&(E=requestAnimationFrame(W)));},seek(p){let T=Math.min(1,Math.max(0,p));x=T,g=T,C=true,cancelAnimationFrame(E),L(T);},getProgress(){return x}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,r={}){if(typeof window>"u")return bt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),bt;let t=n,{trigger:l={},easing:s="linear",once:m=false,axis:c="y",preload:u="auto",onReady:h,onComplete:P,onProgress:H}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Y=typeof s=="function"?s:ae[s]??ae.linear,he=le(l.start??"top top"),V=le(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=u);let ee=r.from??0,U=r.to,Z=0,E=0,M=0,C=false,g=false,x=-1,k=0,G=false,O=false,se=()=>c==="x"?window.scrollX:window.scrollY,L=()=>c==="x"?window.innerWidth:window.innerHeight;function W(){let y=t.getBoundingClientRect(),q=c==="x"?y.left:y.top,Ae=c==="x"?y.width:y.height,Me=ye({top:q,height:Ae},se(),L(),he,V);Z=Me.tStart,E=Me.tEnd;}function _(y){if(!O)return;let q=U??t.duration??0;t.currentTime=ee+(q-ee)*y,t.style.setProperty("--scroll-draw-progress",String(y)),H?.(y);}function j(){if(!C||g||!O)return;let y=Y(Q(se(),Z,E,1));m&&(x=Math.max(x,y),y=x),k=y,_(y),y>=1&&!G?(G=true,P?.()):y<1&&!m&&(G=false),M=requestAnimationFrame(j);}function z(){if(O=true,U===void 0&&(U=t.duration),S){_(1),h?.();return}W(),h?.(),C&&!g&&(M=requestAnimationFrame(j));}t.readyState>=1?z():t.addEventListener("loadedmetadata",z,{once:true}),O||W();let p=new IntersectionObserver(y=>{y.forEach(q=>{C=q.isIntersecting,C&&!g&&O?M=requestAnimationFrame(j):cancelAnimationFrame(M);});}),T;function b(){clearTimeout(T),T=setTimeout(W,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),p.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:Z,tEnd:E})}),{destroy(){cancelAnimationFrame(M),p.disconnect(),t.removeEventListener("loadedmetadata",z),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),Oe(t);},replay(){x=-1,G=false,k=0,g=false,_(0);},pause(){g=true,cancelAnimationFrame(M);},resume(){g&&(g=false,C&&O&&(M=requestAnimationFrame(j)));},seek(y){let q=Math.min(1,Math.max(0,y));k=q,x=q,g=true,cancelAnimationFrame(M),_(q);},getProgress(){return k}}}function St(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function Vt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function wt(e){let r=St(e),n=new Map;for(let s of r){let m=s.offsetTop;n.has(m)||n.set(m,[]),n.get(m).push(s);}let t=[],l=Array.from(n.keys()).sort((s,m)=>s-m);for(let s of l){let m=n.get(s),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block";for(let u of m)c.appendChild(u);t.push(c);}e.textContent="";for(let s of t)e.appendChild(s),e.appendChild(document.createTextNode(" "));return t}function zt(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,m=s+(1-l);return m<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(m-s)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ot(e,r={}){if(typeof window>"u")return vt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),vt;let t=n,{split:l="words",stagger:s=.04,easing:m="ease-out",from:c={opacity:0,y:24},trigger:u={},once:h=true,onComplete:P}=r,H=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof m=="function"?m:ae[m]??ae["ease-out"],Y=le(u.start??"top 85%"),he=le(u.end??"top 40%"),V=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;l==="chars"?ee=Vt(t):l==="lines"?ee=wt(t):ee=St(t);let U=ee.length;function Z(b,y){c?.opacity!==void 0&&(b.style.opacity=String(c.opacity+(1-c.opacity)*y));let q=qt(y,c);q&&(b.style.transform=q);}function E(b){t.style.setProperty("--scroll-draw-progress",String(b)),ee.forEach((y,q)=>{let Ae=S(zt(b,q,U,s));Z(y,Ae);});}if(H)return E(1),P?.(),{destroy(){t.innerHTML=V,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};E(0);let M=0,C=0,g=0,x=false,k=false,G=-1,O=0,se=false,L=()=>window.scrollY,W=()=>window.innerHeight;function _(){let b=t.getBoundingClientRect(),y=ye({top:b.top,height:b.height},L(),W(),Y,he);M=y.tStart,C=y.tEnd;}function j(){if(!x||k)return;let b=Q(L(),M,C,1);h&&(G=Math.max(G,b),b=G),O=b,E(b),b>=1&&!se?(se=true,P?.()):b<1&&!h&&(se=false),g=requestAnimationFrame(j);}_();let z=new IntersectionObserver(b=>{b.forEach(y=>{x=y.isIntersecting,x&&!k?g=requestAnimationFrame(j):cancelAnimationFrame(g);});}),p;function T(){clearTimeout(p),p=setTimeout(()=>{if(l==="lines"){let b=O;t.innerHTML=V,t.setAttribute("aria-label",t.textContent??""),ee=wt(t),E(b);}_();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),z.observe(t),Pe(t,{type:"text",getProgress:()=>O,getTrigger:()=>({tStart:M,tEnd:C})}),{destroy(){cancelAnimationFrame(g),z.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(p),t.innerHTML=V,t.removeAttribute("aria-label"),Oe(t);},replay(){G=-1,se=false,O=0,k=false,E(0);},pause(){k=true,cancelAnimationFrame(g);},resume(){k&&(k=false,x&&(g=requestAnimationFrame(j)));},seek(b){let y=Math.min(1,Math.max(0,b));O=y,G=y,k=true,cancelAnimationFrame(g),E(y);},getProgress(){return O}}}function pn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=Qe(r.value,e);onUnmounted(()=>n.destroy());}),r}var dn=defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=Qe(n.value,t);onUnmounted(()=>l.destroy());}),()=>h("div",{ref:n},r.default?.())}});function gn(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=et(r.value,e);onUnmounted(()=>n.destroy());}),r}var yn=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=et(n.value,e.options);onUnmounted(()=>t.destroy());}),()=>h("div",{ref:n},r.default?.())}});function hn(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=nt(r.value,e);onUnmounted(()=>n.destroy());}),r}var bn=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=nt(r.value,n);onUnmounted(()=>t.destroy());}),()=>h("span",{ref:r})}});function wn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=rt(r.value,e);onUnmounted(()=>n.destroy());}),r}var vn=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=rt(r.value,e.options??{});onUnmounted(()=>n.destroy());}),()=>h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Sn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=ot(r.value,e);onUnmounted(()=>n.destroy());}),r}var En=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=ot(n.value,e.options??{});onUnmounted(()=>t.destroy());}),()=>h(e.tag,{ref:n},r.default?.())}});export{yn as ScrollAnimate,bn as ScrollCounter,dn as ScrollDraw,En as ScrollText,vn as ScrollVideo,gn as useScrollAnimate,hn as useScrollCounter,pn as useScrollDraw,Sn as useScrollText,wn as useScrollVideo};
|
|
1
|
+
import {defineComponent,ref,onMounted,onUnmounted,h}from'vue';function _t({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),s=0,c=[];for(let d=0;d<n;d++){let x=Math.pow(l,d);c.push(x),s+=x;}let u=[0],m=0;for(let d=0;d<n;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<n;x++)if(d<=u[x+1]){let N=(d-u[x])/(u[x+1]-u[x]);if(x===0)return N*(2-N);let L=1-Math.pow(t,x);return L+(1-L)*(2*N-1)*(2*N-1)}return 1}}function qt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:_t(),elastic:qt()};function pe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Et(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Tt(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function Be(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Bt(e,r,n){return Math.min(n,Math.max(r,e))}function Q(e,r,n,t){return n===r?0:Bt((e-r)/(n-r)*t,0,1)}function tt(e,r,n){let t=e.getBoundingClientRect(),l=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:n==="x"?t.left:t.top,height:l,scroll:n==="x"?window.scrollX:window.scrollY}}function xe(e,r,n,t,l){let s=Et(e.top,e.height,r,t.element)-Tt(t.viewport,n),c=Et(e.top,e.height,r,l.element)-Tt(l.viewport,n);return {tStart:s,tEnd:c}}function xt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function We(e,r,n){let t=xt(e),l=xt(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}var At={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 nt=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...r){nt&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Wt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ut(e){let r=[];for(let n=0;n<Mt;n++){let t=n/(Mt-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function rt(e){switch(e){case "linear":return "linear";case "ease-in":return Wt;case "ease-out":return Gt;case "ease-in-out":return jt()?Ut(ee["ease-in-out"]):null;default:return null}}var Xt=0;function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?ye("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Zt(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=n==="x"?window.scrollX:window.scrollY,c=e-s,u=r-s,m=n==="x";t.innerHTML=`
|
|
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 Lt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ct=/[MmLlHhVvCcSsQqTtAaZz]/g;function Jt(e,r,n){if(!nt)return;let t=(e.match(Ct)??[]).join("").toUpperCase(),l=(r.match(Ct)??[]).join("").toUpperCase(),s=(e.match(Lt)??[]).length,c=(r.match(Lt)??[]).length;if(t!==l){ye(`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.`,n);return}s!==c&&ye(`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.`,n);}function lt(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function ct(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...At[n],...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:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Me=false,axis:B="y",scrollContainer:Z,autoReverse:X=false,delay:W=0,strokeColor:A,strokeWidth:C,fillOpacity:M,waypoints:w,velocityScale:O=false,threshold:k=0,rootMargin:$="0px",repeat:E=0,repeatDelay:ne=0,morphTo:F,clip:re,autoplay:oe=false,duration:J=1e3,native:ue=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:I,onEnterBack:de,onLeaveBack:ve}=l,me=re===true?"left":typeof re=="string"?re:false,Se=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),_e=pe(x.end??"bottom top"),he=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(A)?A[0]:null,se=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray(C)?C[0]:null,G=Array.isArray(C)?C[1]:typeof C=="number"?C:null,fe=Array.isArray(M)?M[0]:null,Y=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function Ce(o){let a=o*100;switch(me){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=me?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,we=0,D=false,z=false,_=0,j=false,ae=-1,$e=-1,K=false,Ee=0,Re=0,De,ot=null;function gt(){ot?.destroy(),ot=null;}let He=new Set,yt=NaN,Ne=true,Ye=-1,ht=performance.now(),qe=NaN;function st(){return he?B==="x"?he.scrollLeft:he.scrollTop:B==="x"?window.scrollX:window.scrollY}function bt(){return he?B==="x"?he.clientWidth:he.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function wt(){let o=tt(e,he,B),a=xe(o,o.scroll,bt(),Le,_e);f=a.tStart,we=a.tEnd,Me&&nt&&(gt(),ot=Zt(f,we,B));}function Ht(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),me){let v=a==="reverse"?1-o:o;e.style.clipPath=Ce(v);return}V.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${P[le]*o}`:`${P[le]*(1-o)}`,m&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&se?v.style.stroke=We(be,se,o):se&&(v.style.stroke=se),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*o}`:Y!==null&&(v.style.fillOpacity=`${Y}`),F&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",lt(i[le],F,o));});}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=Ce(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${P[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`),F&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{Qt(o);let a=Be(o);P.push(a);let v=o.tagName.toLowerCase()==="path";v?i.push(o.getAttribute("d")??""):i.push(""),F&&(v?Jt(i[i.length-1],F,o):ye(`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"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),Y!==null&&(o.style.fillOpacity=`${Y}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`));}),me){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 vt=typeof d=="string"?rt(d):null;function Nt(){return !(ue===false||!Yt()||!V.length||!vt||me||B!=="y"||he||u!==1||N!==0||te||X||O!==false||F||w||E||W>0||y||T||g||p||I||de||ve||A!=null||C!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Vt(){let o=++Xt,a=`svg-scroll-draw-${o}`,v=`svg-scroll-draw-host-${o}`,le=`--svg-scroll-draw-${o}`,Ie=L==="reverse"?"0":"var(--ssd-len)",Pe=L==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Ie};`,S=`stroke-dashoffset:${Pe};`;m&&(Ae+=`opacity:${L==="reverse"?1:0};`,S+=`opacity:${L==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.textContent=`@keyframes ${a}{from{${Ae}}to{${S}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${vt};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(v);function ce(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(ce);let b=false,H=-1;function q(){if(H>=0)return H;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},st(),bt(),Le,_e);return Se(Q(st(),U,Te,u))}return {destroy(){e.classList.remove(v),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),R.remove();},replay(){b=false,H=-1,V.forEach(ce);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));H=U,b=true,V.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${P[ge]*U}`:`${P[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=Be(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(Nt())return Vt();function zt(){let o=Math.max(1,J),a=0,v=0,le=false;function Ie(b){let H=true;if(me){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);Ee=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Ce(L==="reverse"?1-h:h),y?.(h),q<1&&(H=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),ge=Se(Te);q.style.strokeDashoffset=L==="reverse"?`${P[h]*ge}`:`${P[h]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&se?q.style.stroke=We(be,se,ge):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),F&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",lt(i[h],F,ge)),h===0&&(Ee=ge,y?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(H=false);});if(w){let q=Math.min(1,Math.max(0,b/o)),h=Se(q);for(let U in w){let Te=parseFloat(U);h>=Te&&!He.has(Te)&&(He.add(Te),w[U]?.());}}return H}function Pe(b){if(K)return;let H=b-a;z||(z=true,T?.());let q=Ie(H);if(q&&!D){D=true,Ie(o*(1+Math.max(0,V.length-1)*N)),g?.(),Re<(E==="infinite"?1/0:E??0)&&(Re++,De=setTimeout(()=>{a=performance.now(),z=false,D=false,He.clear(),Qe(),_=requestAnimationFrame(Pe);},ne));return}q||(_=requestAnimationFrame(Pe));}function Ae(){cancelAnimationFrame(_),clearTimeout(De),a=performance.now(),v=0,K=false,z=false,D=false,Re=0,le=true,Ee=0,He.clear(),Qe(),_=requestAnimationFrame(Pe);}let S=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&D)?Ae():!H.isIntersecting&&!te&&!D&&(cancelAnimationFrame(_),clearTimeout(De),le=false);});},{root:he??null,threshold:k,rootMargin:$}),R;function ce(){clearTimeout(R),R=setTimeout(()=>{V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),W>0?setTimeout(()=>S.observe(e),W):S.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(De),S.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(R);},replay(){Re=0,Ae();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(_));},resume(){K&&(K=false,le=true,a=performance.now()-v,_=requestAnimationFrame(Pe));},seek(b){let H=Math.min(1,Math.max(0,b));Ee=H,K=true,v=H*o,a=performance.now()-v,cancelAnimationFrame(_),Ie(v);},getProgress(){return Ee},refresh(){clearTimeout(R),V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});}}}if(oe)return zt();wt();function Ze(){if(!j||K)return;let o=performance.now(),a=st();if(!Ne&&O===false&&a===yt){_=requestAnimationFrame(Ze);return}Ne=false,yt=a;let v=u;if(O!==false){let S=o-ht,R=S>0?Math.abs(a-(Ye<0?a:Ye))/S:0;v=u*Math.max(.2,1+R*(typeof O=="number"?O:1)*.04);}Ye=a,ht=o;let le=X?$e===-1||a>=$e?"forward":"reverse":L;$e=a;let Ie=we-f,Pe=true,Ae=Ie===0?0:(a-f)/Ie;if(isNaN(qe)||(qe<=0&&Ae>0?p?.():qe>0&&Ae<=0&&ve?.(),qe<1&&Ae>=1?I?.():qe>=1&&Ae<1&&de?.()),qe=Ae,me){let S=Se(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,S),S=ae),Ee=S,e.style.setProperty("--scroll-draw-progress",String(S));let R=le==="reverse"?1-S:S;e.style.clipPath=Ce(R),y?.(S),!z&&Q(a,f,we,v)>0&&(z=true,T?.()),S>=1&&!D?(D=true,g?.(),Re<(E==="infinite"?1/0:E??0)&&(Re++,De=setTimeout(()=>{ae=-1,z=false,D=false,e.style.clipPath=Ce(0);},ne))):S<1&&!te&&(D=false),_=requestAnimationFrame(Ze);return}if(V.forEach((S,R)=>{let ce=R*N*Ie,b=Se(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Ee=b,S.style.strokeDashoffset=le==="reverse"?`${P[R]*b}`:`${P[R]*(1-b)}`,m&&(S.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&se?S.style.stroke=We(be,se,b):se&&(S.style.stroke=se),ie!==null&&G!==null?S.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(S.style.strokeWidth=`${G}`),fe!==null&&Y!==null?S.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(S.style.fillOpacity=`${Y}`),F&&S.tagName.toLowerCase()==="path"&&i[R]&&S.setAttribute("d",lt(i[R],F,b)),R===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),w){let S=Se(Q(a,f,we,v));for(let R in w){let ce=parseFloat(R);S>=ce&&!He.has(ce)&&(He.add(ce),w[R]?.());}}!z&&Q(a,f,we,v)>0&&(z=true,T?.()),Pe&&!D?(D=true,g?.(),Re<(E==="infinite"?1/0:E??0)&&(Re++,De=setTimeout(()=>{ae=-1,z=false,D=false,He.clear(),Qe(),Ne=true;},ne))):!Pe&&!te&&(D=false),_=requestAnimationFrame(Ze);}let it=false;function Je(){it||(it=true,_=requestAnimationFrame(function(){Ze();}));}function Ke(){it=false,cancelAnimationFrame(_);}let at=new IntersectionObserver(o=>{o.forEach(a=>{j=a.isIntersecting,j&&!K?(Ne=true,Je()):Ke();});},{root:he??null,threshold:k,rootMargin:$});function St(){V.forEach((o,a)=>{P[a]=Be(o),o.style.strokeDasharray=`${P[a]}`;}),wt(),Ne=true;}let et;function Ge(){clearTimeout(et),et=setTimeout(St,150);}window.addEventListener("resize",Ge),window.addEventListener("orientationchange",Ge);let je;return typeof ResizeObserver<"u"&&(je=new ResizeObserver(()=>Ge()),je.observe(document.body),je.observe(document.documentElement),je.observe(e)),W>0?setTimeout(()=>at.observe(e),W):at.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(De),Ke(),at.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(et),gt();},replay(){ae=-1,$e=-1,Ye=-1,z=false,D=false,Re=0,K=false,Ee=0,He.clear(),clearTimeout(De),Qe(),Ne=true,j&&Je();},pause(){K=true,Ke();},resume(){K&&(K=false,Ne=true,j&&Je());},seek(o){let a=Math.min(1,Math.max(0,o));Ee=a,ae=a,K=true,Ke(),Ht(a,L),Ne=true;},getProgress(){return Ee},refresh(){clearTimeout(et),St(),j&&!K&&Je();}}}var $t=new Map;function Ve(e,r){$t.set(e,r);}function ze(e){$t.delete(e);}function Kt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Pt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.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]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function en(e,r,n){let t=Pt(e),l=Pt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?n<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)*n}${s.units[d]}`).join(", ")})`}).join(" ")}function Ot(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Kt(t))return We(t,l,n);if(t.includes("("))return en(t,l,n);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)*n}${s[2]||c[2]}`}return n<1?t:l}function tn(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var nn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rn=0,kt="--scroll-draw-progress";function on(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ut(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Me,onComplete:B,onEnter:Z,onLeave:X,onEnterBack:W,onLeaveBack:A}=r,C=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:ee[s]??ee["ease-out"],w=pe(l.start??"top bottom"),O=pe(l.end??"bottom top"),k=te??e,$=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([i,f])=>({prop:tn(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function ne(){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 re=new Map;for(let i of [...E.map(f=>f.prop),kt])re.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of re)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(C)return F(),B?.(),{...n,destroy:oe,getProgress:()=>1};ne();let J=typeof s=="string"?rt(s):null;function ue(){if(!x||!on()||!J||m!=="y"||$||k!==e||u||c!==1||Me||B||Z||X||W||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!nn.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++rn}`,f=E.map(j=>`${j.prop}:${j.from}`).join(";"),we=E.map(j=>`${j.prop}:${j.to}`).join(";"),D=document.createElement("style");D.setAttribute("data-ssd-animate",""),D.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),D.remove(),e.style.animationPlayState="",oe();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let $e of E)e.style.setProperty($e.prop,Ot($e.from,$e.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=z(),$e=_(),{tStart:K,tEnd:Ee}=xe({top:j.top,height:j.height},ae,$e,w,O);return M(Q(ae,K,Ee,c))}}}if(ue())return y();let T=0,g=0,p=0,I=false,de=false,ve=-1,me=0,Se=false,Le=NaN,_e=-1,he=0,be=()=>$?m==="x"?$.scrollLeft:$.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>$?m==="x"?$.clientWidth:$.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=tt(k,$,m),f=xe(i,i.scroll,se(),w,O);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(kt,String(i));for(let f of E)e.style.setProperty(f.prop,Ot(f.from,f.to,i));Me?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&A?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&W?.(),Le=i;}function Y(){if(!I||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let _=i-he,j=_>0?Math.abs(f-(_e<0?f:_e))/_:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}_e=f,he=i;let D=g===T?0:(f-T)/(g-T);fe(D);let z=M(Q(f,T,g,we));u&&(ve=Math.max(ve,z),z=ve),me=z,G(z),z>=1&&!Se?(Se=true,B?.()):z<1&&!u&&(Se=false),p=requestAnimationFrame(Y);}ie(),g===T&&ye("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=M(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let Ce=new IntersectionObserver(i=>{i.forEach(f=>{I=f.isIntersecting,I&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:$??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),Ce.observe(e),Ve(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),Ce.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),ze(e);},replay(){ve=-1,Se=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,I&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,r){if(typeof window>"u")return mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollCounter: element not found:",e),mt;let t=n,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=r,L=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Me=pe(m.start??"top 80%"),B=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),N?.(),mt;let X=0,W=0,A=0,C=false,M=false,w=-1,O=0,k=false,$=()=>window.scrollY,E=()=>window.innerHeight;function ne(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},$(),E(),Me,B);X=T.tStart,W=T.tEnd;}function F(y){t.textContent=L(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function re(){if(!C||M)return;let y=te(Q($(),X,W,1));d&&(w=Math.max(w,y),y=w),O=y,F(y),y>=1&&!k?(k=true,N?.()):y<1&&!d&&(k=false),A=requestAnimationFrame(re);}ne();{let y=te(Q($(),X,W,1));d&&y>0&&(w=y),O=y,F(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{C=T.isIntersecting,C&&!M?A=requestAnimationFrame(re):cancelAnimationFrame(A);});}),J;function ue(){clearTimeout(J),J=setTimeout(ne,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),oe.observe(t),Ve(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:X,tEnd:W})}),{destroy(){cancelAnimationFrame(A),oe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),ze(t);},replay(){w=-1,k=false,O=0,M=false,F(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,C&&(A=requestAnimationFrame(re)));},seek(y){let T=Math.min(1,Math.max(0,y));O=T,w=T,M=true,cancelAnimationFrame(A),F(T);},getProgress(){return O}}}var Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,r={}){if(typeof window>"u")return Ft;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),Ft;let t=n,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=r,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,Me=pe(l.start??"top top"),B=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=r.from??0,X=r.to,W=0,A=0,C=0,M=false,w=false,O=-1,k=0,$=false,E=false,ne=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function re(){let p=t.getBoundingClientRect(),I=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:I,height:de},ne(),F(),Me,B);W=ve.tStart,A=ve.tEnd;}function oe(p){if(!E)return;let I=X??t.duration??0;t.currentTime=Z+(I-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!M||w||!E)return;let p=te(Q(ne(),W,A,1));c&&(O=Math.max(O,p),p=O),k=p,oe(p),p>=1&&!$?($=true,x?.()):p<1&&!c&&($=false),C=requestAnimationFrame(J);}function ue(){if(E=true,X===void 0&&(X=t.duration),L){oe(1),d?.();return}re(),d?.(),M&&!w&&(C=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),E||re();let y=new IntersectionObserver(p=>{p.forEach(I=>{M=I.isIntersecting,M&&!w&&E?C=requestAnimationFrame(J):cancelAnimationFrame(C);});}),T;function g(){clearTimeout(T),T=setTimeout(re,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Ve(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:W,tEnd:A})}),{destroy(){cancelAnimationFrame(C),y.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),ze(t);},replay(){O=-1,$=false,k=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,M&&E&&(C=requestAnimationFrame(J)));},seek(p){let I=Math.min(1,Math.max(0,p));k=I,O=I,w=true,cancelAnimationFrame(C),oe(I);},getProgress(){return k}}}function Dt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function sn(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function Rt(e){let r=Dt(e),n=new Map;for(let s of r){let c=s.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(s);}let t=[],l=Array.from(n.keys()).sort((s,c)=>s-c);for(let s of l){let c=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function an(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ln(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var It={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,r={}){if(typeof window>"u")return It;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollText: element not found:",e),It;let t=n,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=r,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Me=pe(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=sn(t):l==="lines"?Z=Rt(t):Z=Dt(t);let X=Z.length;function W(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let I=ln(p,u);I&&(g.style.transform=I);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,I)=>{let de=L(an(g,I,X,s));W(p,de);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let C=0,M=0,w=0,O=false,k=false,$=-1,E=0,ne=false,F=()=>window.scrollY,re=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},F(),re(),te,Me);C=p.tStart,M=p.tEnd;}function J(){if(!O||k)return;let g=Q(F(),C,M,1);d&&($=Math.max($,g),g=$),E=g,A(g),g>=1&&!ne?(ne=true,x?.()):g<1&&!d&&(ne=false),w=requestAnimationFrame(J);}oe();let ue=new IntersectionObserver(g=>{g.forEach(p=>{O=p.isIntersecting,O&&!k?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),Z=Rt(t),A(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Ve(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=B,t.removeAttribute("aria-label"),ze(t);},replay(){$=-1,ne=false,E=0,k=false,A(0);},pause(){k=true,cancelAnimationFrame(w);},resume(){k&&(k=false,O&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));E=p,$=p,k=true,cancelAnimationFrame(w),A(p);},getProgress(){return E}}}function Bn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=ct(r.value,e);onUnmounted(()=>n.destroy());}),r}var Wn=defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=ct(n.value,t);onUnmounted(()=>l.destroy());}),()=>h("div",{ref:n},r.default?.())}});function Gn(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=ut(r.value,e);onUnmounted(()=>n.destroy());}),r}var jn=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=ut(n.value,e.options);onUnmounted(()=>t.destroy());}),()=>h("div",{ref:n},r.default?.())}});function Un(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=ft(r.value,e);onUnmounted(()=>n.destroy());}),r}var Xn=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n={to:e.to};e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete);let t=ft(r.value,n);onUnmounted(()=>t.destroy());}),()=>h("span",{ref:r})}});function Yn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=pt(r.value,e);onUnmounted(()=>n.destroy());}),r}var Qn=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=pt(r.value,e.options??{});onUnmounted(()=>n.destroy());}),()=>h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Zn(e={}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let n=dt(r.value,e);onUnmounted(()=>n.destroy());}),r}var Jn=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let t=dt(n.value,e.options??{});onUnmounted(()=>t.destroy());}),()=>h(e.tag,{ref:n},r.default?.())}});export{jn as ScrollAnimate,Xn as ScrollCounter,Wn as ScrollDraw,Jn as ScrollText,Qn as ScrollVideo,Gn as useScrollAnimate,Un as useScrollCounter,Bn as useScrollDraw,Zn as useScrollText,Yn as useScrollVideo};
|