svg-scroll-draw 2.17.1 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.mjs +1 -1
- package/dist/{chunk-HMSNYXKW.mjs → chunk-CTVQDBD3.mjs} +1 -1
- package/dist/chunk-TIRZOSQ4.mjs +1 -0
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +11 -0
- package/dist/video/index.d.ts +11 -0
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-JC5BD4RB.mjs +0 -1
package/dist/svelte/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function Ut({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),a=Math.sqrt(t),s=0,l=[];for(let
|
|
1
|
+
'use strict';function Ut({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),a=Math.sqrt(t),s=0,l=[];for(let d=0;d<n;d++){let S=Math.pow(a,d);l.push(S),s+=S;}let u=[0],m=0;for(let d=0;d<n;d++)m+=l[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let S=0;S<n;S++)if(d<=u[S+1]){let V=(d-u[S])/(u[S+1]-u[S]);if(S===0)return V*(2-V);let L=1-Math.pow(t,S);return L+(1-L)*(2*V-1)*(2*V-1)}return 1}}function Yt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),a=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-a)*(2*Math.PI)/t)+1}var te={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ut(),elastic:Yt()};function Tt(e,r,n){return Math.min(n,Math.max(r,e))}function de(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 xt(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 At(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 J(e,r,n,t){return n===r?0:Tt((e-r)/(n-r)*t,0,1)}function xe(e,r,n,t,a){let s=xt(e.top,e.height,r,t.element)-At(t.viewport,n),l=xt(e.top,e.height,r,a.element)-At(a.viewport,n);return {tStart:s,tEnd:l}}function Je(e,r,n){let t=e.getBoundingClientRect(),a=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:a,scroll:0}:{top:n==="x"?t.left:t.top,height:a,scroll:n==="x"?window.scrollX:window.scrollY}}function _e(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 Mt(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 qe(e,r,n){let t=Mt(e),a=Mt(r);return !t||!a?e:`rgb(${Math.round(t[0]+(a[0]-t[0])*n)},${Math.round(t[1]+(a[1]-t[1])*n)},${Math.round(t[2]+(a[2]-t[2])*n)})`}var Lt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ge=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ge(e,...r){Ge&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Xt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Kt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",$t=33;function Qt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Zt(e){let r=[];for(let n=0;n<$t;n++){let t=n/($t-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Xt;case "ease-out":return Kt;case "ease-in-out":return Qt()?Zt(te["ease-in-out"]):null;default:return null}}var Ct=Symbol.for("svg-scroll-draw.registry");function Pt(){let e=globalThis;return e[Ct]||(e[Ct]=new Map)}function $e(e,r){Pt().set(e,r);}function Ce(e){Pt().delete(e);}var Jt=0;function er(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function kt(e,r){let n="";try{n=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return n||(e.getAttribute(r)??"").trim()}var It=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function tr(e){if(!Ge)return;let r=kt(e,"stroke");if(!r||r==="none"){ge("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!It.has(n)&&!It.has(kt(e,"fill"))&&ge("Element has a fill \u2014 it may obscure the stroke animation.",e);}function rr(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 a(){let s=n==="x"?window.scrollX:window.scrollY,l=e-s,u=r-s,m=n==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${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",a,{passive:true}),a(),{el:t,destroy(){window.removeEventListener("scroll",a),t.remove();}}}var Ot=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function nr(e,r,n){if(!Ge)return;let t=(e.match(Dt)??[]).join("").toUpperCase(),a=(r.match(Dt)??[]).join("").toUpperCase(),s=(e.match(Ot)??[]).length,l=(r.match(Ot)??[]).length;if(t!==a){he(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${a||"\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!==l&&he(`morphTo: coordinate count differs (${s} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function it(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let l=parseFloat(s),u=t[a++]??l;return String(+(l+(u-l)*n).toFixed(4))})}function at(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,a=n?{...Lt[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:A="forward",once:ne=false,debug:$e=false,axis:B="y",scrollContainer:ee,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:C,fillOpacity:L,waypoints:w,velocityScale:I=false,threshold:D=0,rootMargin:P="0px",repeat:E=0,repeatDelay:oe=0,morphTo:F,clip:se,autoplay:ie=false,duration:te=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:$,onLeave:S,onEnterBack:R,onLeaveBack:fe}=a,K=se===true?"left":typeof se=="string"?se:false,ve=typeof p=="function"?p:re[p]??re.linear,Ce=de(T.start??"top bottom"),Ve=de(T.end??"bottom top"),be=typeof ee=="string"?document.querySelector(ee):ee??null,we=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(C)?C[0]:null,j=Array.isArray(C)?C[1]:typeof C=="number"?C:null,pe=Array.isArray(L)?L[0]:null,Q=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Pe(o){let c=o*100;switch(K){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let z=K?[]:Array.from(e.querySelectorAll(l)),k=[],i=[],f=0,ge=0,H=false,_=false,q=0,xe=false,Ee=-1,Z=[],Fe=-1,U=false,ke=0,Oe=0,Re,tt=null;function gt(){tt?.destroy(),tt=null;}let He=new Set,yt=NaN,Ne=true,Ue=-1,ht=performance.now(),ze=NaN;function rt(){return be?B==="x"?be.scrollLeft:be.scrollTop:B==="x"?window.scrollX:window.scrollY}function bt(){return be?B==="x"?be.clientWidth:be.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function wt(){let o=Je(e,be,B);return Te(o,o.scroll,bt(),Ce,Ve)}function vt(){(({tStart:f,tEnd:ge}=wt())),$e&&Ge&&(gt(),tt=rr(f,ge,B));}function nt(o,c=wt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let b=o.destroy;return o.destroy=()=>{b.call(o),Le(e);},o}function Wt(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let b=c==="reverse"?1-o:o;e.style.clipPath=Pe(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=c==="reverse"?`${k[ue]*o}`:`${k[ue]*(1-o)}`,m&&(b.style.opacity=c==="reverse"?`${1-o}`:`${o}`),we&&le?b.style.stroke=qe(we,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),F&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],F,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=Pe(0);return}z.forEach((o,c)=>{o.style.strokeDasharray=`${k[c]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${k[c]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),F&&o.tagName.toLowerCase()==="path"&&i[c]&&o.setAttribute("d",i[c]);});}if(z.forEach(o=>{tr(o);let c=_e(o);k.push(c);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),F&&(b?nr(i[i.length-1],F,o):he(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=A==="reverse"?`${c}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Q!==null&&(o.style.fillOpacity=`${Q}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=A==="reverse"?"0":`${c}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),K){if(s)return e.style.clipPath=Pe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Pe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Et=typeof p=="string"?et(p):null;function Bt(){return !(ae===false||!er()||!z.length||!Et||K||B!=="y"||be||u!==1||V!==0||ne||X||I!==false||F||w||E||G>0||d||x||g||$||S||R||fe||M!=null||C!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Gt(){let o=++Jt,c=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,De=A==="reverse"?"0":"var(--ssd-len)",Ie=A==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${Ie};`;m&&(Ae+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let O=document.createElement("style");O.setAttribute("data-svg-scroll-draw",""),O.textContent=`@keyframes ${c}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Et};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(c);}z.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Se}=Te({top:y.top,height:y.height},rt(),bt(),Ce,Ve);return ve(J(rt(),Y,Se,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(c),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),O.remove();},replay(){h=false,N=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));N=Y,h=true,z.forEach((Se,ye)=>{Se.classList.remove(c),Se.style.strokeDashoffset=A==="reverse"?`${k[ye]*Y}`:`${k[ye]*(1-Y)}`,m&&(Se.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return W()},refresh(){z.forEach((y,Y)=>{k[Y]=_e(y),y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`;});}}}if(Bt())return nt(Gt());function jt(){let o=Math.max(1,te),c=0,b=0,ue=false;function De(h){let N=true;if(K){let W=Math.min(1,Math.max(0,h/o)),y=ve(W);ke=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Pe(A==="reverse"?1-y:y),d?.(y),W<1&&(N=false);}else z.forEach((W,y)=>{let Y=y*V*o,Se=Math.min(1,Math.max(0,(h-Y)/o)),ye=ve(Se);W.style.strokeDashoffset=A==="reverse"?`${k[y]*ye}`:`${k[y]*(1-ye)}`,m&&(W.style.opacity=A==="reverse"?`${1-ye}`:`${ye}`),we&&le?W.style.stroke=qe(we,le,ye):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*ye}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Q!==null?W.style.fillOpacity=`${pe+(Q-pe)*ye}`:Q!==null&&(W.style.fillOpacity=`${Q}`),F&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],F,ye)),y===0&&(ke=ye,d?.(ye),e.style.setProperty("--scroll-draw-progress",String(ye))),Se<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=ve(W);for(let Y in w){let Se=parseFloat(Y);y>=Se&&!He.has(Se)&&(He.add(Se),w[Y]?.());}}return N}function Ie(h){if(U)return;let N=h-c;_||(_=true,x?.());let W=De(N);if(W&&!H){H=true,De(o*(1+Math.max(0,z.length-1)*V)),g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Re=setTimeout(()=>{c=performance.now(),_=false,H=false,He.clear(),Ye(),q=requestAnimationFrame(Ie);},oe));return}W||(q=requestAnimationFrame(Ie));}function Ae(){cancelAnimationFrame(q),clearTimeout(Re),c=performance.now(),b=0,U=false,_=false,H=false,Oe=0,ue=true,ke=0,He.clear(),Ye(),q=requestAnimationFrame(Ie);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&H)?Ae():!N.isIntersecting&&!ne&&!H&&(cancelAnimationFrame(q),clearTimeout(Re),ue=false);});},{root:be??null,threshold:D,rootMargin:P}),O;function me(){clearTimeout(O),O=setTimeout(()=>{z.forEach((h,N)=>{k[N]=_e(h),h.style.strokeDasharray=`${k[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Re),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(O);},replay(){Oe=0,Ae();},pause(){U||!ue||(U=true,b=performance.now()-c,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,c=performance.now()-b,q=requestAnimationFrame(Ie));},seek(h){let N=Math.min(1,Math.max(0,h));ke=N,U=true,b=N*o,c=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return ke},refresh(){clearTimeout(O),z.forEach((h,N)=>{k[N]=_e(h),h.style.strokeDasharray=`${k[N]}`;});}}}if(ie)return nt(jt());vt();function Xe(){if(!xe||U)return;let o=performance.now(),c=rt();if(!Ne&&I===false&&c===yt){q=requestAnimationFrame(Xe);return}Ne=false,yt=c;let b=u;if(I!==false){let v=o-ht,O=v>0?Math.abs(c-(Ue<0?c:Ue))/v:0;b=u*Math.max(.2,1+O*(typeof I=="number"?I:1)*.04);}Ue=c,ht=o;let ue=X?Fe===-1||c>=Fe?"forward":"reverse":A;Fe=c;let De=ge-f,Ie=true,Ae=De===0?0:(c-f)/De;if(isNaN(ze)||(ze<=0&&Ae>0?$?.():ze>0&&Ae<=0&&fe?.(),ze<1&&Ae>=1?S?.():ze>=1&&Ae<1&&R?.()),ze=Ae,K){let v=ve(J(c,f,ge,b));ne&&!X&&(Ee=Math.max(Ee,v),v=Ee),ke=v,e.style.setProperty("--scroll-draw-progress",String(v));let O=ue==="reverse"?1-v:v;e.style.clipPath=Pe(O),d?.(v),!_&&J(c,f,ge,b)>0&&(_=true,x?.()),v>=1&&!H?(H=true,g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Re=setTimeout(()=>{Ee=-1,_=false,H=false,e.style.clipPath=Pe(0);},oe))):v<1&&!ne&&(H=false),q=requestAnimationFrame(Xe);return}if(z.forEach((v,O)=>{let me=O*V*De,h=ve(J(c,f+me,ge+me,b));ne&&!X&&(h=Z[O]=Math.max(Z[O]??Ee,h)),ke=h,v.style.strokeDashoffset=ue==="reverse"?`${k[O]*h}`:`${k[O]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),we&&le?v.style.stroke=qe(we,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),F&&v.tagName.toLowerCase()==="path"&&i[O]&&v.setAttribute("d",it(i[O],F,h)),O===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Ie=false);}),w){let v=ve(J(c,f,ge,b));for(let O in w){let me=parseFloat(O);v>=me&&!He.has(me)&&(He.add(me),w[O]?.());}}!_&&J(c,f,ge,b)>0&&(_=true,x?.()),Ie&&!H?(H=true,g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Re=setTimeout(()=>{Ee=-1,Z=[],_=false,H=false,He.clear(),Ye(),Ne=true;},oe))):!Ie&&!ne&&(H=false),q=requestAnimationFrame(Xe);}let ot=false;function Ke(){ot||(ot=true,q=requestAnimationFrame(function(){Xe();}));}function Qe(){ot=false,cancelAnimationFrame(q);}let st=new IntersectionObserver(o=>{o.forEach(c=>{xe=c.isIntersecting,xe&&!U?(Ne=true,Ke()):Qe();});},{root:be??null,threshold:D,rootMargin:P});function St(){z.forEach((o,c)=>{k[c]=_e(o),o.style.strokeDasharray=`${k[c]}`;}),vt(),Ne=true;}let Ze;function We(){clearTimeout(Ze),Ze=setTimeout(St,150);}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Be;return typeof ResizeObserver<"u"&&(Be=new ResizeObserver(()=>We()),Be.observe(document.body),Be.observe(document.documentElement),Be.observe(e)),G>0?setTimeout(()=>st.observe(e),G):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(Re),Qe(),st.disconnect(),Be?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Ze),gt();},replay(){Ee=-1,Z=[],Fe=-1,Ue=-1,_=false,H=false,Oe=0,U=false,ke=0,He.clear(),clearTimeout(Re),Ye(),Ne=true,xe&&Ke();},pause(){U=true,Qe();},resume(){U&&(U=false,Ne=true,xe&&Ke());},seek(o){let c=Math.min(1,Math.max(0,o));ke=c,Ee=c,Z=[],U=true,Qe(),Wt(c,A),Ne=true;},getProgress(){return ke},refresh(){clearTimeout(Ze),St(),xe&&!U&&Ke();}},()=>({tStart:f,tEnd:ge}))}var Ft=new WeakMap,or=0;function lt(e){return JSON.stringify(e,(r,n)=>{if(typeof n=="function")return "\u0192";if(typeof Element<"u"&&n instanceof Element){let t=Ft.get(n);return t===void 0&&Ft.set(n,t=++or),`el#${t}`}return n})}function ct(e,r){let n={...e};for(let t of Object.keys(n))typeof n[t]=="function"&&(n[t]=(...a)=>r()[t]?.(...a));return n}function sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Rt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let a=[],s=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}r.push({fn:t[1],nums:a,units:s});}return r}function ir(e,r,n){let t=Rt(e),a=Rt(r);return t.length===0||t.length!==a.length?n<1?e:r:t.map((s,l)=>{let u=a[l];return s.fn!==u.fn||s.nums.length!==u.nums.length?n<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*n}${s.units[p]}`).join(", ")})`}).join(" ")}function Ht(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),a=String(r);if(sr(t))return qe(t,a,n);if(t.includes("("))return ir(t,a,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&l){let u=parseFloat(s[1]),m=parseFloat(l[1]);return `${u+(m-u)*n}${s[2]||l[2]}`}return n<1?t:a}function ar(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var lr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),cr=0,Nt="--scroll-draw-progress";function ur(){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:a={},easing:s="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:A=true,triggerElement:ne,onProgress:$e,onComplete:B,onEnter:ee,onLeave:X,onEnterBack:G,onLeaveBack:M}=r,C=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(a.start??"top bottom"),I=de(a.end??"bottom top"),D=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:ar(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function F(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),Nt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(C)return F(),B?.(),{...n,destroy:ie,getProgress:()=>1};oe();let te=typeof s=="string"?et(s):null;function ae(){if(!T||!ur()||!te||m!=="y"||P||D!==e||u||l!==1||$e||B||ee||X||G||M||V!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!lr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++cr}`,f=E.map(Z=>`${Z.prop}:${Z.from}`).join(";"),ge=E.map(Z=>`${Z.prop}:${Z.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${te};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,xe=()=>{let Z=e.getBoundingClientRect();return Te({top:Z.top,height:Z.height},_(),q(),w,I)};Me(e,{type:"animate",getProgress:()=>Ee.getProgress(),getTrigger:xe});let Ee={destroy(){e.classList.remove(i),H.remove(),e.style.animationPlayState="",ie(),Le(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Z){let Fe=Math.min(1,Math.max(0,Z));e.classList.remove(i);for(let U of E)e.style.setProperty(U.prop,Ht(U.from,U.to,Fe));},getProgress(){let{tStart:Z,tEnd:Fe}=xe();return L(J(_(),Z,Fe,l))}};return Ee}if(ae())return d();let x=0,g=0,$=0,S=false,R=false,fe=-1,K=0,ve=false,Ce=NaN,Ve=-1,be=0,we=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Je(D,P,m),f=Te(i,i.scroll,le(),w,I);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Nt,String(i));for(let f of E)e.style.setProperty(f.prop,Ht(f.from,f.to,i));$e?.(i);}function pe(i){if(isNaN(Ce)){Ce=i;return}Ce<=0&&i>0?ee?.():Ce>0&&i<=0&&M?.(),Ce<1&&i>=1?X?.():Ce>=1&&i<1&&G?.(),Ce=i;}function Q(){if(!S||R)return;let i=performance.now(),f=we(),ge=l;if(V!==false){let q=i-be,xe=q>0?Math.abs(f-(Ve<0?f:Ve))/q:0;ge=l*Math.max(.2,1+xe*(typeof V=="number"?V:1)*.04);}Ve=f,be=i;let H=g===x?0:(f-x)/(g-x);pe(H);let _=L(J(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),K=_,j(_),_>=1&&!ve?(ve=true,B?.()):_<1&&!u&&(ve=false),$=requestAnimationFrame(Q);}ce(),g===x&&he("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(J(we(),x,g,l));u&&i>0&&(fe=i),K=i,j(i);}let Pe=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!R?$=requestAnimationFrame(Q):cancelAnimationFrame($);});},{root:P??null}),z;function k(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),Pe.observe(e),Me(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),Pe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(z),ie(),Le(e);},replay(){fe=-1,ve=false,K=0,R=false,j(0);},pause(){R=true,cancelAnimationFrame($);},resume(){R&&(R=false,S&&($=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));K=f,fe=f,R=true,cancelAnimationFrame($),j(f);},getProgress(){return K}}}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 he("scrollCounter: element not found:",e),mt;let t=n,{from:a=0,to:s,format:l,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=r,A=T!==void 0?d=>d.toFixed(T):l??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],$e=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(s),V?.(),mt;let X=0,G=0,M=0,C=false,L=false,w=-1,I=0,D=false,P=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=Te({top:d.top,height:d.height},P(),E(),$e,B);X=x.tStart,G=x.tEnd;}function F(d){t.textContent=A(a+(s-a)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!C||L)return;let d=ne(J(P(),X,G,1));p&&(w=Math.max(w,d),d=w),I=d,F(d),d>=1&&!D?(D=true,V?.()):d<1&&!p&&(D=false),M=requestAnimationFrame(se);}oe();{let d=ne(J(P(),X,G,1));p&&d>0&&(w=d),I=d,F(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{C=x.isIntersecting,C&&!L?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),te;function ae(){clearTimeout(te),te=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Me(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(te),Le(t);},replay(){w=-1,D=false,I=0,L=false,F(0);},pause(){L=true,cancelAnimationFrame(M);},resume(){L&&(L=false,C&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));I=x,w=x,L=true,cancelAnimationFrame(M),F(x);},getProgress(){return I}}}var Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,r={}){if(typeof window>"u")return Vt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Vt;let t=n,{trigger:a={},easing:s="linear",once:l=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=r,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,$e=de(a.start??"top top"),B=de(a.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let ee=r.from??0,X=r.to,G=0,M=0,C=0,L=false,w=false,I=-1,D=0,P=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),R=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,K=Te({top:R,height:fe},oe(),F(),$e,B);G=K.tStart,M=K.tEnd;}let ie=NaN;function te(S){if(!E)return;let R=X??t.duration??0,fe=ee+(R-ee)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!L||w||!E||A)return;let S=ne(J(oe(),G,M,1));l&&(I=Math.max(I,S),S=I),D=S,te(S),S>=1&&!P?(P=true,T?.()):S<1&&!l&&(P=false),C=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),A){te(1),p?.();return}se(),p?.(),L&&!w&&(C=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(R=>{L=R.isIntersecting,L&&!w&&E?C=requestAnimationFrame(ae):cancelAnimationFrame(C);});}),g;function $(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),x.observe(t),Me(t,{type:"video",getProgress:()=>D,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame(C),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(g),Le(t);},replay(){I=-1,P=false,D=0,w=false,ie=NaN,te(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,L&&E&&(C=requestAnimationFrame(ae)));},seek(S){let R=Math.min(1,Math.max(0,S));D=R,I=R,w=true,cancelAnimationFrame(C),ie=NaN,te(R);},getProgress(){return D}}}function qt(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 mr(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 zt(e){let r=qt(e),n=new Map;for(let s of r){let l=s.offsetTop;n.has(l)||n.set(l,[]),n.get(l).push(s);}let t=[],a=Array.from(n.keys()).sort((s,l)=>s-l);for(let s of a){let l=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<l.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,l)=>{e.appendChild(s),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function fr(e,r,n,t){if(n<=1||t===0)return e;let a=(n-1)*t,s=r*t,l=s+(1-a);return l<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(l-s)))}function pr(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 _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,r={}){if(typeof window>"u")return _t;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return he("scrollText: element not found:",e),_t;let t=n,{split:a="words",stagger:s=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=r,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof l=="function"?l:re[l]??re["ease-out"],ne=de(m.start??"top 85%"),$e=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;a==="chars"?ee=mr(t):a==="lines"?ee=zt(t):ee=qt(t);let X=ee.length;function G(g,$){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*$));let S=pr($,u);S&&(g.style.transform=S);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach(($,S)=>{let R=A(fr(g,S,X,s));G($,R);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let C=0,L=0,w=0,I=false,D=false,P=-1,E=0,oe=false,F=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=Te({top:g.top,height:g.height},F(),se(),ne,$e);C=$.tStart,L=$.tEnd;}function te(){if(!I||D)return;let g=J(F(),C,L,1);p&&(P=Math.max(P,g),g=P),E=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(te);}ie();let ae=new IntersectionObserver(g=>{g.forEach($=>{I=$.isIntersecting,I&&!D?w=requestAnimationFrame(te):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(a==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),ee=zt(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Me(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),Le(t);},replay(){P=-1,oe=false,E=0,D=false,M(0);},pause(){D=true,cancelAnimationFrame(w);},resume(){D&&(D=false,I&&(w=requestAnimationFrame(te)));},seek(g){let $=Math.min(1,Math.max(0,g));E=$,P=$,D=true,cancelAnimationFrame(w),M($);},getProgress(){return E}}}function je(e,r,n){let t=r,a=lt(r),s=n(e,ct(r,()=>t));return {update(l){t=l;let u=lt(l);u!==a&&(a=u,s.destroy(),s=n(e,ct(l,()=>t)));},destroy(){s.destroy();}}}function pn(e,r={}){return je(e,r,at)}function dn(e={}){let r=null;function n(t){return r=at(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function gn(e,r){return je(e,r,ut)}function yn(e){let r=null;function n(t){return r=ut(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function hn(e,r){return je(e,r,ft)}function bn(e){let r=null;function n(t){return r=ft(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function wn(e,r={}){return je(e,r,pt)}function vn(e={}){let r=null;function n(t){return r=pt(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function En(e,r={}){return je(e,r,dt)}function Sn(e={}){let r=null;function n(t){return r=dt(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}exports.createScrollAnimate=yn;exports.createScrollCounter=bn;exports.createScrollDraw=dn;exports.createScrollText=Sn;exports.createScrollVideo=vn;exports.scrollAnimate=gn;exports.scrollCounterAction=hn;exports.scrollDraw=pn;exports.scrollTextAction=En;exports.scrollVideoAction=wn;
|
|
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",a,{passive:true}),a(),{el:t,destroy(){window.removeEventListener("scroll",a),t.remove();}}}var Ot=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function nr(e,r,n){if(!Ge)return;let t=(e.match(Dt)??[]).join("").toUpperCase(),a=(r.match(Dt)??[]).join("").toUpperCase(),s=(e.match(Ot)??[]).length,l=(r.match(Ot)??[]).length;if(t!==a){ge(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${a||"\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!==l&&ge(`morphTo: coordinate count differs (${s} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function it(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let l=parseFloat(s),u=t[a++]??l;return String(+(l+(u-l)*n).toFixed(4))})}function at(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,a=n?{...Lt[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:S={},stagger:V=0,direction:L="forward",once:re=false,debug:Ae=false,axis:B="y",scrollContainer:ne,autoReverse:oe=false,delay:Y=0,strokeColor:A,strokeWidth:R,fillOpacity:$,waypoints:w,velocityScale:O=false,threshold:P=0,rootMargin:C="0px",repeat:T=0,repeatDelay:X=0,morphTo:x,clip:fe,autoplay:be=false,duration:se=1e3,native:ie=true,onProgress:p,onStart:E,onComplete:g,onEnter:k,onLeave:ae,onEnterBack:ee,onLeaveBack:M}=a,D=fe===true?"left":typeof fe=="string"?fe:false,K=typeof d=="function"?d:te[d]??te.linear,we=de(S.start??"top bottom"),Ve=de(S.end??"bottom top"),ve=typeof ne=="string"?document.querySelector(ne):ne??null,Ee=Array.isArray(A)?A[0]:null,le=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ce=Array.isArray(R)?R[0]:null,G=Array.isArray(R)?R[1]:typeof R=="number"?R:null,pe=Array.isArray($)?$[0]:null,Q=Array.isArray($)?$[1]:typeof $=="number"?$:null;function Pe(o){let c=o*100;switch(D){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let z=D?[]:Array.from(e.querySelectorAll(l)),I=[],i=[],f=0,ye=0,H=false,_=false,q=0,Me=false,Se=-1,Z=[],Fe=-1,j=false,ke=0,Oe=0,Re,tt=null;function gt(){tt?.destroy(),tt=null;}let He=new Set,yt=NaN,Ne=true,Ue=-1,ht=performance.now(),ze=NaN;function rt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function bt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function wt(){let o=Je(e,ve,B);return xe(o,o.scroll,bt(),we,Ve)}function vt(){(({tStart:f,tEnd:ye}=wt())),Ae&&Ge&&(gt(),tt=rr(f,ye,B));}function nt(o,c=wt){$e(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let b=o.destroy;return o.destroy=()=>{b.call(o),Ce(e);},o}function Wt(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),D){let b=c==="reverse"?1-o:o;e.style.clipPath=Pe(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=c==="reverse"?`${I[ue]*o}`:`${I[ue]*(1-o)}`,m&&(b.style.opacity=c==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=qe(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&G!==null?b.style.strokeWidth=`${ce+(G-ce)*o}`:G!==null&&(b.style.strokeWidth=`${G}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),x&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],x,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),D){e.style.clipPath=Pe(0);return}z.forEach((o,c)=>{o.style.strokeDasharray=`${I[c]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${I[c]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),x&&o.tagName.toLowerCase()==="path"&&i[c]&&o.setAttribute("d",i[c]);});}if(z.forEach(o=>{tr(o);let c=_e(o);I.push(c);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),x&&(b?nr(i[i.length-1],x,o):ge(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=L==="reverse"?`${c}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),G!==null&&(o.style.strokeWidth=`${G}`),Q!==null&&(o.style.fillOpacity=`${Q}`),x&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",x)):(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=L==="reverse"?"0":`${c}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),D){if(s)return e.style.clipPath=Pe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Pe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Et=typeof d=="string"?et(d):null;function Bt(){return !(ie===false||!er()||!z.length||!Et||D||B!=="y"||ve||u!==1||V!==0||re||oe||O!==false||x||w||T||Y>0||p||E||g||k||ae||ee||M||A!=null||R!=null||$!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Gt(){let o=++Jt,c=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,De=L==="reverse"?"0":"var(--ssd-len)",Ie=L==="reverse"?"var(--ssd-len)":"0",Le=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${Ie};`;m&&(Le+=`opacity:${L==="reverse"?1:0};`,v+=`opacity:${L==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Le}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Et};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(c);}z.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},rt(),bt(),we,Ve);return K(J(rt(),U,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(c),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),F.remove();},replay(){h=false,N=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));N=U,h=true,z.forEach((Te,he)=>{Te.classList.remove(c),Te.style.strokeDashoffset=L==="reverse"?`${I[he]*U}`:`${I[he]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){z.forEach((y,U)=>{I[U]=_e(y),y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`;});}}}if(Bt())return nt(Gt());function jt(){let o=Math.max(1,se),c=0,b=0,ue=false;function De(h){let N=true;if(D){let W=Math.min(1,Math.max(0,h/o)),y=K(W);ke=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Pe(L==="reverse"?1-y:y),p?.(y),W<1&&(N=false);}else z.forEach((W,y)=>{let U=y*V*o,Te=Math.min(1,Math.max(0,(h-U)/o)),he=K(Te);W.style.strokeDashoffset=L==="reverse"?`${I[y]*he}`:`${I[y]*(1-he)}`,m&&(W.style.opacity=L==="reverse"?`${1-he}`:`${he}`),Ee&&le?W.style.stroke=qe(Ee,le,he):le&&(W.style.stroke=le),ce!==null&&G!==null?W.style.strokeWidth=`${ce+(G-ce)*he}`:G!==null&&(W.style.strokeWidth=`${G}`),pe!==null&&Q!==null?W.style.fillOpacity=`${pe+(Q-pe)*he}`:Q!==null&&(W.style.fillOpacity=`${Q}`),x&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],x,he)),y===0&&(ke=he,p?.(he),e.style.setProperty("--scroll-draw-progress",String(he))),Te<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=K(W);for(let U in w){let Te=parseFloat(U);y>=Te&&!He.has(Te)&&(He.add(Te),w[U]?.());}}return N}function Ie(h){if(j)return;let N=h-c;_||(_=true,E?.());let W=De(N);if(W&&!H){H=true,De(o*(1+Math.max(0,z.length-1)*V)),g?.(),Oe<(T==="infinite"?1/0:T??0)&&(Oe++,Re=setTimeout(()=>{c=performance.now(),_=false,H=false,He.clear(),Ye(),q=requestAnimationFrame(Ie);},X));return}W||(q=requestAnimationFrame(Ie));}function Le(){cancelAnimationFrame(q),clearTimeout(Re),c=performance.now(),b=0,j=false,_=false,H=false,Oe=0,ue=true,ke=0,He.clear(),Ye(),q=requestAnimationFrame(Ie);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(re&&H)?Le():!N.isIntersecting&&!re&&!H&&(cancelAnimationFrame(q),clearTimeout(Re),ue=false);});},{root:ve??null,threshold:P,rootMargin:C}),F;function me(){clearTimeout(F),F=setTimeout(()=>{z.forEach((h,N)=>{I[N]=_e(h),h.style.strokeDasharray=`${I[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),Y>0?setTimeout(()=>v.observe(e),Y):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Re),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(F);},replay(){Oe=0,Le();},pause(){j||!ue||(j=true,b=performance.now()-c,cancelAnimationFrame(q));},resume(){j&&(j=false,ue=true,c=performance.now()-b,q=requestAnimationFrame(Ie));},seek(h){let N=Math.min(1,Math.max(0,h));ke=N,j=true,b=N*o,c=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return ke},refresh(){clearTimeout(F),z.forEach((h,N)=>{I[N]=_e(h),h.style.strokeDasharray=`${I[N]}`;});}}}if(be)return nt(jt());vt();function Xe(){if(!Me||j)return;let o=performance.now(),c=rt();if(!Ne&&O===false&&c===yt){q=requestAnimationFrame(Xe);return}Ne=false,yt=c;let b=u;if(O!==false){let v=o-ht,F=v>0?Math.abs(c-(Ue<0?c:Ue))/v:0;b=u*Math.max(.2,1+F*(typeof O=="number"?O:1)*.04);}Ue=c,ht=o;let ue=oe?Fe===-1||c>=Fe?"forward":"reverse":L;Fe=c;let De=ye-f,Ie=true,Le=De===0?0:(c-f)/De;if(isNaN(ze)||(ze<=0&&Le>0?k?.():ze>0&&Le<=0&&M?.(),ze<1&&Le>=1?ae?.():ze>=1&&Le<1&&ee?.()),ze=Le,D){let v=K(J(c,f,ye,b));re&&!oe&&(Se=Math.max(Se,v),v=Se),ke=v,e.style.setProperty("--scroll-draw-progress",String(v));let F=ue==="reverse"?1-v:v;e.style.clipPath=Pe(F),p?.(v),!_&&J(c,f,ye,b)>0&&(_=true,E?.()),v>=1&&!H?(H=true,g?.(),Oe<(T==="infinite"?1/0:T??0)&&(Oe++,Re=setTimeout(()=>{Se=-1,_=false,H=false,e.style.clipPath=Pe(0);},X))):v<1&&!re&&(H=false),q=requestAnimationFrame(Xe);return}if(z.forEach((v,F)=>{let me=F*V*De,h=K(J(c,f+me,ye+me,b));re&&!oe&&(h=Z[F]=Math.max(Z[F]??Se,h)),ke=h,v.style.strokeDashoffset=ue==="reverse"?`${I[F]*h}`:`${I[F]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=qe(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&G!==null?v.style.strokeWidth=`${ce+(G-ce)*h}`:G!==null&&(v.style.strokeWidth=`${G}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),x&&v.tagName.toLowerCase()==="path"&&i[F]&&v.setAttribute("d",it(i[F],x,h)),F===0&&(p?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Ie=false);}),w){let v=K(J(c,f,ye,b));for(let F in w){let me=parseFloat(F);v>=me&&!He.has(me)&&(He.add(me),w[F]?.());}}!_&&J(c,f,ye,b)>0&&(_=true,E?.()),Ie&&!H?(H=true,g?.(),Oe<(T==="infinite"?1/0:T??0)&&(Oe++,Re=setTimeout(()=>{Se=-1,Z=[],_=false,H=false,He.clear(),Ye(),Ne=true;},X))):!Ie&&!re&&(H=false),q=requestAnimationFrame(Xe);}let ot=false;function Ke(){ot||(ot=true,q=requestAnimationFrame(function(){Xe();}));}function Qe(){ot=false,cancelAnimationFrame(q);}let st=new IntersectionObserver(o=>{o.forEach(c=>{Me=c.isIntersecting,Me&&!j?(Ne=true,Ke()):Qe();});},{root:ve??null,threshold:P,rootMargin:C});function St(){z.forEach((o,c)=>{I[c]=_e(o),o.style.strokeDasharray=`${I[c]}`;}),vt(),Ne=true;}let Ze;function We(){clearTimeout(Ze),Ze=setTimeout(St,150);}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Be;return typeof ResizeObserver<"u"&&(Be=new ResizeObserver(()=>We()),Be.observe(document.body),Be.observe(document.documentElement),Be.observe(e)),Y>0?setTimeout(()=>st.observe(e),Y):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(Re),Qe(),st.disconnect(),Be?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Ze),gt();},replay(){Se=-1,Z=[],Fe=-1,Ue=-1,_=false,H=false,Oe=0,j=false,ke=0,He.clear(),clearTimeout(Re),Ye(),Ne=true,Me&&Ke();},pause(){j=true,Qe();},resume(){j&&(j=false,Ne=true,Me&&Ke());},seek(o){let c=Math.min(1,Math.max(0,o));ke=c,Se=c,Z=[],j=true,Qe(),Wt(c,L),Ne=true;},getProgress(){return ke},refresh(){clearTimeout(Ze),St(),Me&&!j&&Ke();}},()=>({tStart:f,tEnd:ye}))}var Ft=new WeakMap,or=0;function lt(e){return JSON.stringify(e,(r,n)=>{if(typeof n=="function")return "\u0192";if(typeof Element<"u"&&n instanceof Element){let t=Ft.get(n);return t===void 0&&Ft.set(n,t=++or),`el#${t}`}return n})}function ct(e,r){let n={...e};for(let t of Object.keys(n))typeof n[t]=="function"&&(n[t]=(...a)=>r()[t]?.(...a));return n}function sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Rt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let a=[],s=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}r.push({fn:t[1],nums:a,units:s});}return r}function ir(e,r,n){let t=Rt(e),a=Rt(r);return t.length===0||t.length!==a.length?n<1?e:r:t.map((s,l)=>{let u=a[l];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 Ht(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),a=String(r);if(sr(t))return qe(t,a,n);if(t.includes("("))return ir(t,a,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&l){let u=parseFloat(s[1]),m=parseFloat(l[1]);return `${u+(m-u)*n}${s[2]||l[2]}`}return n<1?t:a}function ar(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var lr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),cr=0,Nt="--scroll-draw-progress";function ur(){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:a={},easing:s="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:d,native:S=true,velocityScale:V=false,respectReducedMotion:L=true,triggerElement:re,onProgress:Ae,onComplete:B,onEnter:ne,onLeave:oe,onEnterBack:Y,onLeaveBack:A}=r,R=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=typeof s=="function"?s:te[s]??te["ease-out"],w=de(a.start??"top bottom"),O=de(a.end??"bottom top"),P=re??e,C=typeof d=="string"?document.querySelector(d):d??null,T=Object.entries(t).map(([i,f])=>({prop:ar(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function X(){let i=window.getComputedStyle(e);for(let f of T)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function x(){for(let i of T)e.style.setProperty(i.prop,String(i.to));}let fe=new Map;for(let i of [...T.map(f=>f.prop),Nt])fe.set(i,e.style.getPropertyValue(i));function be(){for(let[i,f]of fe)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(R)return x(),B?.(),{...n,destroy:be,getProgress:()=>1};X();let se=typeof s=="string"?et(s):null;function ie(){if(!S||!ur()||!se||m!=="y"||C||P!==e||u||l!==1||Ae||B||ne||oe||Y||A||V!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let i of T)if(!lr.has(i.prop))return false;return true}function p(){let i=`ssd-a-${++cr}`,f=T.map(Z=>`${Z.prop}:${Z.from}`).join(";"),ye=T.map(Z=>`${Z.prop}:${Z.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${f}}to{${ye}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${se};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let Z=e.getBoundingClientRect();return xe({top:Z.top,height:Z.height},_(),q(),w,O)};$e(e,{type:"animate",getProgress:()=>Se.getProgress(),getTrigger:Me});let Se={destroy(){e.classList.remove(i),H.remove(),e.style.animationPlayState="",be(),Ce(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Z){let Fe=Math.min(1,Math.max(0,Z));e.classList.remove(i);for(let j of T)e.style.setProperty(j.prop,Ht(j.from,j.to,Fe));},getProgress(){let{tStart:Z,tEnd:Fe}=Me();return $(J(_(),Z,Fe,l))}};return Se}if(ie())return p();let E=0,g=0,k=0,ae=false,ee=false,M=-1,D=0,K=false,we=NaN,Ve=-1,ve=0,Ee=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Je(P,C,m),f=xe(i,i.scroll,le(),w,O);E=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Nt,String(i));for(let f of T)e.style.setProperty(f.prop,Ht(f.from,f.to,i));Ae?.(i);}function pe(i){if(isNaN(we)){we=i;return}we<=0&&i>0?ne?.():we>0&&i<=0&&A?.(),we<1&&i>=1?oe?.():we>=1&&i<1&&Y?.(),we=i;}function Q(){if(!ae||ee)return;let i=performance.now(),f=Ee(),ye=l;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(Ve<0?f:Ve))/q:0;ye=l*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}Ve=f,ve=i;let H=g===E?0:(f-E)/(g-E);pe(H);let _=$(J(f,E,g,ye));u&&(M=Math.max(M,_),_=M),D=_,G(_),_>=1&&!K?(K=true,B?.()):_<1&&!u&&(K=false),k=requestAnimationFrame(Q);}ce(),g===E&&ge("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=$(J(Ee(),E,g,l));u&&i>0&&(M=i),D=i,G(i);}let Pe=new IntersectionObserver(i=>{i.forEach(f=>{ae=f.isIntersecting,ae&&!ee?k=requestAnimationFrame(Q):cancelAnimationFrame(k);});},{root:C??null}),z;function I(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),Pe.observe(e),$e(e,{type:"animate",getProgress:()=>D,getTrigger:()=>({tStart:E,tEnd:g})}),{destroy(){cancelAnimationFrame(k),Pe.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(z),be(),Ce(e);},replay(){M=-1,K=false,D=0,ee=false,G(0);},pause(){ee=true,cancelAnimationFrame(k);},resume(){ee&&(ee=false,ae&&(k=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));D=f,M=f,ee=true,cancelAnimationFrame(k),G(f);},getProgress(){return D}}}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 ge("scrollCounter: element not found:",e),mt;let t=n,{from:a=0,to:s,format:l,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:V}=r,L=S!==void 0?p=>p.toFixed(S):l??(p=>String(Math.round(p))),re=typeof u=="function"?u:te[u]??te["ease-out"],Ae=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),V?.(),mt;let oe=0,Y=0,A=0,R=false,$=false,w=-1,O=0,P=false,C=()=>window.scrollY,T=()=>window.innerHeight;function X(){let p=t.getBoundingClientRect(),E=xe({top:p.top,height:p.height},C(),T(),Ae,B);oe=E.tStart,Y=E.tEnd;}function x(p){t.textContent=L(a+(s-a)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function fe(){if(!R||$)return;let p=re(J(C(),oe,Y,1));d&&(w=Math.max(w,p),p=w),O=p,x(p),p>=1&&!P?(P=true,V?.()):p<1&&!d&&(P=false),A=requestAnimationFrame(fe);}X();{let p=re(J(C(),oe,Y,1));d&&p>0&&(w=p),O=p,x(p);}let be=new IntersectionObserver(p=>{p.forEach(E=>{R=E.isIntersecting,R&&!$?A=requestAnimationFrame(fe):cancelAnimationFrame(A);});}),se;function ie(){clearTimeout(se),se=setTimeout(X,150);}return window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie),be.observe(t),$e(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:oe,tEnd:Y})}),{destroy(){cancelAnimationFrame(A),be.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),clearTimeout(se),Ce(t);},replay(){w=-1,P=false,O=0,$=false,x(0);},pause(){$=true,cancelAnimationFrame(A);},resume(){$&&($=false,R&&(A=requestAnimationFrame(fe)));},seek(p){let E=Math.min(1,Math.max(0,p));O=E,w=E,$=true,cancelAnimationFrame(A),x(E);},getProgress(){return O}}}var Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,r={}){if(typeof window>"u")return Vt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return ge("scrollVideo: <video> element not found:",e),Vt;let t=n,{trigger:a={},easing:s="linear",once:l=false,axis:u="y",preload:m="auto",triggerElement:d,onReady:S,onComplete:V,onProgress:L}=r,re=d??t,Ae=window.matchMedia("(prefers-reduced-motion: reduce)").matches,B=typeof s=="function"?s:te[s]??te.linear,ne=de(a.start??"top top"),oe=de(a.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Y=r.from??0,A=r.to,R=0,$=0,w=0,O=false,P=false,C=-1,T=0,X=false,x=false,fe=()=>u==="x"?window.scrollX:window.scrollY,be=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let M=re.getBoundingClientRect(),D=u==="x"?M.left:M.top,K=u==="x"?M.width:M.height,we=xe({top:D,height:K},fe(),be(),ne,oe);R=we.tStart,$=we.tEnd,x&&$===R&&ge("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let ie=NaN;function p(M){if(!x)return;let D=A??t.duration??0,K=Y+(D-Y)*M;K!==ie&&(ie=K,t.currentTime=K),t.style.setProperty("--scroll-draw-progress",String(M)),L?.(M);}function E(){if(!O||P||!x||Ae)return;let M=B(J(fe(),R,$,1));l&&(C=Math.max(C,M),M=C),T=M,p(M),M>=1&&!X?(X=true,V?.()):M<1&&!l&&(X=false),w=requestAnimationFrame(E);}function g(){if(x=true,A===void 0&&(A=t.duration),Ae){p(1),S?.();return}se(),S?.(),O&&!P&&(w=requestAnimationFrame(E));}t.readyState>=1?g():t.addEventListener("loadedmetadata",g,{once:true}),x||se();let k=new IntersectionObserver(M=>{M.forEach(D=>{O=D.isIntersecting,O&&!P&&x?w=requestAnimationFrame(E):cancelAnimationFrame(w);});}),ae;function ee(){clearTimeout(ae),ae=setTimeout(se,150);}return window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee),k.observe(t),$e(t,{type:"video",getProgress:()=>T,getTrigger:()=>({tStart:R,tEnd:$})}),{destroy(){cancelAnimationFrame(w),k.disconnect(),t.removeEventListener("loadedmetadata",g),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),clearTimeout(ae),Ce(t);},replay(){C=-1,X=false,T=0,P=false,ie=NaN,p(0);},pause(){P=true,cancelAnimationFrame(w);},resume(){P&&(P=false,O&&x&&(w=requestAnimationFrame(E)));},seek(M){let D=Math.min(1,Math.max(0,M));T=D,C=D,P=true,cancelAnimationFrame(w),ie=NaN,p(D);},getProgress(){return T}}}function qt(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 mr(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 zt(e){let r=qt(e),n=new Map;for(let s of r){let l=s.offsetTop;n.has(l)||n.set(l,[]),n.get(l).push(s);}let t=[],a=Array.from(n.keys()).sort((s,l)=>s-l);for(let s of a){let l=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((m,d)=>{let S=m.nextElementSibling;u.appendChild(m),d<l.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((s,l)=>{e.appendChild(s),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function fr(e,r,n,t){if(n<=1||t===0)return e;let a=(n-1)*t,s=r*t,l=s+(1-a);return l<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(l-s)))}function pr(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 _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,r={}){if(typeof window>"u")return _t;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ge("scrollText: element not found:",e),_t;let t=n,{split:a="words",stagger:s=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:S}=r,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof l=="function"?l:te[l]??te["ease-out"],re=de(m.start??"top 85%"),Ae=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ne;a==="chars"?ne=mr(t):a==="lines"?ne=zt(t):ne=qt(t);let oe=ne.length;function Y(g,k){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*k));let ae=pr(k,u);ae&&(g.style.transform=ae);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),ne.forEach((k,ae)=>{let ee=L(fr(g,ae,oe,s));Y(k,ee);});}if(V)return A(1),S?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let R=0,$=0,w=0,O=false,P=false,C=-1,T=0,X=false,x=()=>window.scrollY,fe=()=>window.innerHeight;function be(){let g=t.getBoundingClientRect(),k=xe({top:g.top,height:g.height},x(),fe(),re,Ae);R=k.tStart,$=k.tEnd;}function se(){if(!O||P)return;let g=J(x(),R,$,1);d&&(C=Math.max(C,g),g=C),T=g,A(g),g>=1&&!X?(X=true,S?.()):g<1&&!d&&(X=false),w=requestAnimationFrame(se);}be();let ie=new IntersectionObserver(g=>{g.forEach(k=>{O=k.isIntersecting,O&&!P?w=requestAnimationFrame(se):cancelAnimationFrame(w);});}),p;function E(){clearTimeout(p),p=setTimeout(()=>{if(a==="lines"){let g=T;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),ne=zt(t),A(g);}be();},150);}return window.addEventListener("resize",E),window.addEventListener("orientationchange",E),ie.observe(t),$e(t,{type:"text",getProgress:()=>T,getTrigger:()=>({tStart:R,tEnd:$})}),{destroy(){cancelAnimationFrame(w),ie.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),clearTimeout(p),t.innerHTML=B,t.removeAttribute("aria-label"),Ce(t);},replay(){C=-1,X=false,T=0,P=false,A(0);},pause(){P=true,cancelAnimationFrame(w);},resume(){P&&(P=false,O&&(w=requestAnimationFrame(se)));},seek(g){let k=Math.min(1,Math.max(0,g));T=k,C=k,P=true,cancelAnimationFrame(w),A(k);},getProgress(){return T}}}function je(e,r,n){let t=r,a=lt(r),s=n(e,ct(r,()=>t));return {update(l){t=l;let u=lt(l);u!==a&&(a=u,s.destroy(),s=n(e,ct(l,()=>t)));},destroy(){s.destroy();}}}function pn(e,r={}){return je(e,r,at)}function dn(e={}){let r=null;function n(t){return r=at(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function gn(e,r){return je(e,r,ut)}function yn(e){let r=null;function n(t){return r=ut(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function hn(e,r){return je(e,r,ft)}function bn(e){let r=null;function n(t){return r=ft(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function wn(e,r={}){return je(e,r,pt)}function vn(e={}){let r=null;function n(t){return r=pt(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function En(e,r={}){return je(e,r,dt)}function Sn(e={}){let r=null;function n(t){return r=dt(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}exports.createScrollAnimate=yn;exports.createScrollCounter=bn;exports.createScrollDraw=dn;exports.createScrollText=Sn;exports.createScrollVideo=vn;exports.scrollAnimate=gn;exports.scrollCounterAction=hn;exports.scrollDraw=pn;exports.scrollTextAction=En;exports.scrollVideoAction=wn;
|
package/dist/svelte/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$4,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-
|
|
1
|
+
import {a as a$4,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-TIRZOSQ4.mjs';import {a as a$2}from'../chunk-SNCRC6BA.mjs';import {a as a$1}from'../chunk-4MH5SQTH.mjs';import {a}from'../chunk-QJ4H2HW3.mjs';import {b}from'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';function r(n,t,o){let e=t,f=a$4(t),l=o(n,b$1(t,()=>e));return {update(c){e=c;let d=a$4(c);d!==f&&(f=d,l.destroy(),l=o(n,b$1(c,()=>e)));},destroy(){l.destroy();}}}function D(n,t={}){return r(n,t,b)}function I(n={}){let t=null;function o(e){return t=b(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function A(n,t){return r(n,t,a)}function H(n){let t=null;function o(e){return t=a(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function L(n,t){return r(n,t,a$1)}function M(n){let t=null;function o(e){return t=a$1(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function V(n,t={}){return r(n,t,a$3)}function g(n={}){let t=null;function o(e){return t=a$3(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function C(n,t={}){return r(n,t,a$2)}function v(n={}){let t=null;function o(e){return t=a$2(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}export{H as createScrollAnimate,M as createScrollCounter,I as createScrollDraw,v as createScrollText,g as createScrollVideo,A as scrollAnimate,L as scrollCounterAction,D as scrollDraw,C as scrollTextAction,V as scrollVideoAction};
|
package/dist/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function re({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),m=Math.sqrt(r),a=0,p=[];for(let i=0;i<n;i++){let s=Math.pow(m,i);p.push(s),a+=s;}let u=[0],E=0;for(let i=0;i<n;i++)E+=p[i]/a,u.push(E);return i=>{if(i<=0)return 0;if(i>=1)return 1;for(let s=0;s<n;s++)if(i<=u[s+1]){let g=(i-u[s])/(u[s+1]-u[s]);if(s===0)return g*(2-g);let v=1-Math.pow(r,s);return v+(1-v)*(2*g-1)*(2*g-1)}return 1}}function ne({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),m=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return a=>a<=0?0:a>=1?1:n*Math.pow(2,-10*a)*Math.sin((a-m)*(2*Math.PI)/r)+1}var N={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:re(),elastic:ne()};function k(e,t,n){return Math.min(n,Math.max(t,e))}function D(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 G(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 B(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 $(e,t,n,r){return n===t?0:k((e-t)/(n-t)*r,0,1)}function K(e,t,n,r,m){let a=G(e.top,e.height,t,r.element)-B(r.viewport,n),p=G(e.top,e.height,t,m.element)-B(m.viewport,n);return {tStart:a,tEnd:p}}var X=Symbol.for("svg-scroll-draw.registry");function j(){let e=globalThis;return e[X]||(e[X]=new Map)}function J(e,t){j().set(e,t);}function Q(e){j().delete(e);}var oe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function F(e,...t){oe&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var U={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ge(e,t={}){if(typeof window>"u")return U;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return F("scrollVideo: <video> element not found:",e),U;let r=n,{trigger:m={},easing:a="linear",once:p=false,axis:u="y",preload:E="auto",triggerElement:i,onReady:s,onComplete:g,onProgress:v}=t,Y=i??r,C=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Z=typeof a=="function"?a:N[a]??N.linear,H=D(m.start??"top top"),ee=D(m.end??"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=E);let O=t.from??0,I=t.to,x=0,M=0,l=0,b=false,d=false,w=-1,h=0,_=false,f=false,z=()=>u==="x"?window.scrollX:window.scrollY,te=()=>u==="x"?window.innerWidth:window.innerHeight;function L(){let o=Y.getBoundingClientRect(),c=u==="x"?o.left:o.top,y=u==="x"?o.width:o.height,W=K({top:c,height:y},z(),te(),H,ee);x=W.tStart,M=W.tEnd,f&&M===x&&F("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let S=NaN;function T(o){if(!f)return;let c=I??r.duration??0,y=O+(c-O)*o;y!==S&&(S=y,r.currentTime=y),r.style.setProperty("--scroll-draw-progress",String(o)),v?.(o);}function R(){if(!b||d||!f||C)return;let o=Z($(z(),x,M,1));p&&(w=Math.max(w,o),o=w),h=o,T(o),o>=1&&!_?(_=true,g?.()):o<1&&!p&&(_=false),l=requestAnimationFrame(R);}function V(){if(f=true,I===void 0&&(I=r.duration),C){T(1),s?.();return}L(),s?.(),b&&!d&&(l=requestAnimationFrame(R));}r.readyState>=1?V():r.addEventListener("loadedmetadata",V,{once:true}),f||L();let q=new IntersectionObserver(o=>{o.forEach(c=>{b=c.isIntersecting,b&&!d&&f?l=requestAnimationFrame(R):cancelAnimationFrame(l);});}),P;function A(){clearTimeout(P),P=setTimeout(L,150);}return window.addEventListener("resize",A),window.addEventListener("orientationchange",A),q.observe(r),J(r,{type:"video",getProgress:()=>h,getTrigger:()=>({tStart:x,tEnd:M})}),{destroy(){cancelAnimationFrame(l),q.disconnect(),r.removeEventListener("loadedmetadata",V),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),clearTimeout(P),Q(r);},replay(){w=-1,_=false,h=0,d=false,S=NaN,T(0);},pause(){d=true,cancelAnimationFrame(l);},resume(){d&&(d=false,b&&f&&(l=requestAnimationFrame(R)));},seek(o){let c=Math.min(1,Math.max(0,o));h=c,w=c,d=true,cancelAnimationFrame(l),S=NaN,T(c);},getProgress(){return h}}}exports.scrollVideo=ge;
|
package/dist/video/index.d.mts
CHANGED
|
@@ -8,6 +8,17 @@ interface ScrollVideoOptions {
|
|
|
8
8
|
once?: boolean;
|
|
9
9
|
axis?: 'x' | 'y';
|
|
10
10
|
preload?: 'auto' | 'metadata';
|
|
11
|
+
/**
|
|
12
|
+
* Measure the trigger window from this element instead of the video.
|
|
13
|
+
*
|
|
14
|
+
* Needed for the pinned-film pattern: a video in a `position: sticky` stage
|
|
15
|
+
* moves with the scroll while the stage is stuck, so its own box cannot
|
|
16
|
+
* describe a scrub that runs the length of the pin — and re-measuring it on
|
|
17
|
+
* a resize (a phone's address bar) lands on the wrong window. Point this at
|
|
18
|
+
* the tall track that holds the scroll room, with `start: 'top top'` and
|
|
19
|
+
* `end: 'bottom bottom'`, and the film runs exactly while the stage is stuck.
|
|
20
|
+
*/
|
|
21
|
+
triggerElement?: Element;
|
|
11
22
|
onReady?: () => void;
|
|
12
23
|
onComplete?: () => void;
|
|
13
24
|
onProgress?: (alpha: number) => void;
|
package/dist/video/index.d.ts
CHANGED
|
@@ -8,6 +8,17 @@ interface ScrollVideoOptions {
|
|
|
8
8
|
once?: boolean;
|
|
9
9
|
axis?: 'x' | 'y';
|
|
10
10
|
preload?: 'auto' | 'metadata';
|
|
11
|
+
/**
|
|
12
|
+
* Measure the trigger window from this element instead of the video.
|
|
13
|
+
*
|
|
14
|
+
* Needed for the pinned-film pattern: a video in a `position: sticky` stage
|
|
15
|
+
* moves with the scroll while the stage is stuck, so its own box cannot
|
|
16
|
+
* describe a scrub that runs the length of the pin — and re-measuring it on
|
|
17
|
+
* a resize (a phone's address bar) lands on the wrong window. Point this at
|
|
18
|
+
* the tall track that holds the scroll room, with `start: 'top top'` and
|
|
19
|
+
* `end: 'bottom bottom'`, and the film runs exactly while the stage is stuck.
|
|
20
|
+
*/
|
|
21
|
+
triggerElement?: Element;
|
|
11
22
|
onReady?: () => void;
|
|
12
23
|
onComplete?: () => void;
|
|
13
24
|
onProgress?: (alpha: number) => void;
|
package/dist/video/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollVideo}from'../chunk-
|
|
1
|
+
export{a as scrollVideo}from'../chunk-TIRZOSQ4.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';
|
package/dist/vue/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function Qt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(t),s=0,c=[];for(let
|
|
1
|
+
'use strict';var vue=require('vue');function Qt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(t),s=0,c=[];for(let d=0;d<r;d++){let E=Math.pow(a,d);c.push(E),s+=E;}let u=[0],m=0;for(let d=0;d<r;d++)m+=c[d]/s,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let E=0;E<r;E++)if(d<=u[E+1]){let V=(d-u[E])/(u[E+1]-u[E]);if(E===0)return V*(2-V);let L=1-Math.pow(t,E);return L+(1-L)*(2*V-1)*(2*V-1)}return 1}}function Zt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),a=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-a)*(2*Math.PI)/t)+1}var te={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Qt(),elastic:Zt()};function Mt(e,n,r){return Math.min(r,Math.max(n,e))}function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function At(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function Lt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function J(e,n,r,t){return r===n?0:Mt((e-n)/(r-n)*t,0,1)}function xe(e,n,r,t,a){let s=At(e.top,e.height,n,t.element)-Lt(t.viewport,r),c=At(e.top,e.height,n,a.element)-Lt(a.viewport,r);return {tStart:s,tEnd:c}}function nt(e,n,r){let t=e.getBoundingClientRect(),a=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:r==="x"?t.left:t.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function Be(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Ct(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function We(e,n,r){let t=Ct(e),a=Ct(n);return !t||!a?e:`rgb(${Math.round(t[0]+(a[0]-t[0])*r)},${Math.round(t[1]+(a[1]-t[1])*r)},${Math.round(t[2]+(a[2]-t[2])*r)})`}var $t={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 Ue=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ge(e,...n){Ue&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Jt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",er="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Pt=33;function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function rr(e){let n=[];for(let r=0;r<Pt;r++){let t=r/(Pt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function ot(e){switch(e){case "linear":return "linear";case "ease-in":return Jt;case "ease-out":return er;case "ease-in-out":return tr()?rr(te["ease-in-out"]):null;default:return null}}var Ot=Symbol.for("svg-scroll-draw.registry");function kt(){let e=globalThis;return e[Ot]||(e[Ot]=new Map)}function Ce(e,n){kt().set(e,n);}function $e(e){kt().delete(e);}var nr=0;function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Rt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Ft=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function sr(e){if(!Ue)return;let n=Rt(e,"stroke");if(!n||n==="none"){ge("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Ft.has(r)&&!Ft.has(Rt(e,"fill"))&&ge("Element has a fill \u2014 it may obscure the stroke animation.",e);}function ir(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function a(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",a,{passive:true}),a(),{el:t,destroy(){window.removeEventListener("scroll",a),t.remove();}}}var It=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function ar(e,n,r){if(!Ue)return;let t=(e.match(Dt)??[]).join("").toUpperCase(),a=(n.match(Dt)??[]).join("").toUpperCase(),s=(e.match(It)??[]).length,c=(n.match(It)??[]).length;if(t!==a){he(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${a||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&he(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function ut(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[a++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function mt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,a=r?{...$t[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:M="forward",once:ne=false,debug:Ce=false,axis:W="y",scrollContainer:ee,autoReverse:X=false,delay:G=0,strokeColor:A,strokeWidth:$,fillOpacity:L,waypoints:w,velocityScale:k=false,threshold:F=0,rootMargin:P="0px",repeat:S=0,repeatDelay:oe=0,morphTo:I,clip:se,autoplay:ie=false,duration:te=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:C,onLeave:E,onEnterBack:D,onLeaveBack:fe}=a,K=se===true?"left":typeof se=="string"?se:false,ve=typeof p=="function"?p:re[p]??re.linear,$e=de(T.start??"top bottom"),_e=de(T.end??"bottom top"),be=typeof ee=="string"?document.querySelector(ee):ee??null,we=Array.isArray(A)?A[0]:null,le=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ce=Array.isArray($)?$[0]:null,j=Array.isArray($)?$[1]:typeof $=="number"?$:null,pe=Array.isArray(L)?L[0]:null,Q=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Pe(o){let l=o*100;switch(K){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let z=K?[]:Array.from(e.querySelectorAll(c)),O=[],i=[],f=0,ge=0,N=false,_=false,q=0,xe=false,Se=-1,Z=[],Ne=-1,U=false,Oe=0,Ie=0,He,st=null;function ht(){st?.destroy(),st=null;}let Ve=new Set,bt=NaN,ze=true,Qe=-1,wt=performance.now(),qe=NaN;function it(){return be?W==="x"?be.scrollLeft:be.scrollTop:W==="x"?window.scrollX:window.scrollY}function vt(){return be?W==="x"?be.clientWidth:be.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function St(){let o=nt(e,be,W);return Te(o,o.scroll,vt(),$e,_e)}function Et(){(({tStart:f,tEnd:ge}=St())),Ce&&Ue&&(ht(),st=ir(f,ge,W));}function at(o,l=St){Ae(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let b=o.destroy;return o.destroy=()=>{b.call(o),Le(e);},o}function Ut(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let b=l==="reverse"?1-o:o;e.style.clipPath=Pe(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=l==="reverse"?`${O[ue]*o}`:`${O[ue]*(1-o)}`,m&&(b.style.opacity=l==="reverse"?`${1-o}`:`${o}`),we&&le?b.style.stroke=We(we,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),I&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",ut(i[ue],I,o));});}function Ze(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=Pe(0);return}z.forEach((o,l)=>{o.style.strokeDasharray=`${O[l]}`,o.style.strokeDashoffset=M==="reverse"?"0":`${O[l]}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),I&&o.tagName.toLowerCase()==="path"&&i[l]&&o.setAttribute("d",i[l]);});}if(z.forEach(o=>{sr(o);let l=Be(o);O.push(l);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),I&&(b?ar(i[i.length-1],I,o):he(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=M==="reverse"?`${l}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Q!==null&&(o.style.fillOpacity=`${Q}`),I&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",I)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=M==="reverse"?"0":`${l}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),K){if(s)return e.style.clipPath=Pe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Pe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Tt=typeof p=="string"?ot(p):null;function Yt(){return !(ae===false||!or()||!z.length||!Tt||K||W!=="y"||be||u!==1||V!==0||ne||X||k!==false||I||w||S||G>0||d||x||g||C||E||D||fe||A!=null||$!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Xt(){let o=++nr,l=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,De=M==="reverse"?"0":"var(--ssd-len)",ke=M==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${ke};`;m&&(Me+=`opacity:${M==="reverse"?1:0};`,v+=`opacity:${M==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.textContent=`@keyframes ${l}{from{${Me}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Tt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(l);}z.forEach(me);let h=false,H=-1;function B(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Ee}=Te({top:y.top,height:y.height},it(),vt(),$e,_e);return ve(J(it(),Y,Ee,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(l),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),R.remove();},replay(){h=false,H=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));H=Y,h=true,z.forEach((Ee,ye)=>{Ee.classList.remove(l),Ee.style.strokeDashoffset=M==="reverse"?`${O[ye]*Y}`:`${O[ye]*(1-Y)}`,m&&(Ee.style.opacity=M==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return B()},refresh(){z.forEach((y,Y)=>{O[Y]=Be(y),y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`;});}}}if(Yt())return at(Xt());function Kt(){let o=Math.max(1,te),l=0,b=0,ue=false;function De(h){let H=true;if(K){let B=Math.min(1,Math.max(0,h/o)),y=ve(B);Oe=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Pe(M==="reverse"?1-y:y),d?.(y),B<1&&(H=false);}else z.forEach((B,y)=>{let Y=y*V*o,Ee=Math.min(1,Math.max(0,(h-Y)/o)),ye=ve(Ee);B.style.strokeDashoffset=M==="reverse"?`${O[y]*ye}`:`${O[y]*(1-ye)}`,m&&(B.style.opacity=M==="reverse"?`${1-ye}`:`${ye}`),we&&le?B.style.stroke=We(we,le,ye):le&&(B.style.stroke=le),ce!==null&&j!==null?B.style.strokeWidth=`${ce+(j-ce)*ye}`:j!==null&&(B.style.strokeWidth=`${j}`),pe!==null&&Q!==null?B.style.fillOpacity=`${pe+(Q-pe)*ye}`:Q!==null&&(B.style.fillOpacity=`${Q}`),I&&B.tagName.toLowerCase()==="path"&&i[y]&&B.setAttribute("d",ut(i[y],I,ye)),y===0&&(Oe=ye,d?.(ye),e.style.setProperty("--scroll-draw-progress",String(ye))),Ee<1&&(H=false);});if(w){let B=Math.min(1,Math.max(0,h/o)),y=ve(B);for(let Y in w){let Ee=parseFloat(Y);y>=Ee&&!Ve.has(Ee)&&(Ve.add(Ee),w[Y]?.());}}return H}function ke(h){if(U)return;let H=h-l;_||(_=true,x?.());let B=De(H);if(B&&!N){N=true,De(o*(1+Math.max(0,z.length-1)*V)),g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{l=performance.now(),_=false,N=false,Ve.clear(),Ze(),q=requestAnimationFrame(ke);},oe));return}B||(q=requestAnimationFrame(ke));}function Me(){cancelAnimationFrame(q),clearTimeout(He),l=performance.now(),b=0,U=false,_=false,N=false,Ie=0,ue=true,Oe=0,Ve.clear(),Ze(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(ne&&N)?Me():!H.isIntersecting&&!ne&&!N&&(cancelAnimationFrame(q),clearTimeout(He),ue=false);});},{root:be??null,threshold:F,rootMargin:P}),R;function me(){clearTimeout(R),R=setTimeout(()=>{z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(He),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(R);},replay(){Ie=0,Me();},pause(){U||!ue||(U=true,b=performance.now()-l,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,l=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let H=Math.min(1,Math.max(0,h));Oe=H,U=true,b=H*o,l=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return Oe},refresh(){clearTimeout(R),z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(ie)return at(Kt());Et();function Je(){if(!xe||U)return;let o=performance.now(),l=it();if(!ze&&k===false&&l===bt){q=requestAnimationFrame(Je);return}ze=false,bt=l;let b=u;if(k!==false){let v=o-wt,R=v>0?Math.abs(l-(Qe<0?l:Qe))/v:0;b=u*Math.max(.2,1+R*(typeof k=="number"?k:1)*.04);}Qe=l,wt=o;let ue=X?Ne===-1||l>=Ne?"forward":"reverse":M;Ne=l;let De=ge-f,ke=true,Me=De===0?0:(l-f)/De;if(isNaN(qe)||(qe<=0&&Me>0?C?.():qe>0&&Me<=0&&fe?.(),qe<1&&Me>=1?E?.():qe>=1&&Me<1&&D?.()),qe=Me,K){let v=ve(J(l,f,ge,b));ne&&!X&&(Se=Math.max(Se,v),v=Se),Oe=v,e.style.setProperty("--scroll-draw-progress",String(v));let R=ue==="reverse"?1-v:v;e.style.clipPath=Pe(R),d?.(v),!_&&J(l,f,ge,b)>0&&(_=true,x?.()),v>=1&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{Se=-1,_=false,N=false,e.style.clipPath=Pe(0);},oe))):v<1&&!ne&&(N=false),q=requestAnimationFrame(Je);return}if(z.forEach((v,R)=>{let me=R*V*De,h=ve(J(l,f+me,ge+me,b));ne&&!X&&(h=Z[R]=Math.max(Z[R]??Se,h)),Oe=h,v.style.strokeDashoffset=ue==="reverse"?`${O[R]*h}`:`${O[R]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),we&&le?v.style.stroke=We(we,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),I&&v.tagName.toLowerCase()==="path"&&i[R]&&v.setAttribute("d",ut(i[R],I,h)),R===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=ve(J(l,f,ge,b));for(let R in w){let me=parseFloat(R);v>=me&&!Ve.has(me)&&(Ve.add(me),w[R]?.());}}!_&&J(l,f,ge,b)>0&&(_=true,x?.()),ke&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{Se=-1,Z=[],_=false,N=false,Ve.clear(),Ze(),ze=true;},oe))):!ke&&!ne&&(N=false),q=requestAnimationFrame(Je);}let lt=false;function et(){lt||(lt=true,q=requestAnimationFrame(function(){Je();}));}function tt(){lt=false,cancelAnimationFrame(q);}let ct=new IntersectionObserver(o=>{o.forEach(l=>{xe=l.isIntersecting,xe&&!U?(ze=true,et()):tt();});},{root:be??null,threshold:F,rootMargin:P});function xt(){z.forEach((o,l)=>{O[l]=Be(o),o.style.strokeDasharray=`${O[l]}`;}),Et(),ze=true;}let rt;function Ge(){clearTimeout(rt),rt=setTimeout(xt,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)),G>0?setTimeout(()=>ct.observe(e),G):ct.observe(e),at({destroy(){cancelAnimationFrame(q),clearTimeout(He),tt(),ct.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(rt),ht();},replay(){Se=-1,Z=[],Ne=-1,Qe=-1,_=false,N=false,Ie=0,U=false,Oe=0,Ve.clear(),clearTimeout(He),Ze(),ze=true,xe&&et();},pause(){U=true,tt();},resume(){U&&(U=false,ze=true,xe&&et());},seek(o){let l=Math.min(1,Math.max(0,o));Oe=l,Se=l,Z=[],U=true,tt(),Ut(l,M),ze=true;},getProgress(){return Oe},refresh(){clearTimeout(rt),xt(),xe&&!U&&et();}},()=>({tStart:f,tEnd:ge}))}var Nt=new WeakMap,lr=0;function Ht(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Nt.get(r);return t===void 0&&Nt.set(r,t=++lr),`el#${t}`}return r})}function Vt(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...a)=>n()[t]?.(...a));return r}function cr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function zt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let a=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:a,units:s});}return n}function ur(e,n,r){let t=zt(e),a=zt(n);return t.length===0||t.length!==a.length?r<1?e:n:t.map((s,c)=>{let u=a[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function _t(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),a=String(n);if(cr(t))return We(t,a,r);if(t.includes("("))return ur(t,a,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:a}function mr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var fr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),pr=0,qt="--scroll-draw-progress";function dr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ft(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:a={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:M=true,triggerElement:ne,onProgress:Ce,onComplete:W,onEnter:ee,onLeave:X,onEnterBack:G,onLeaveBack:A}=n,$=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(a.start??"top bottom"),k=de(a.end??"bottom top"),F=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,S=Object.entries(t).map(([i,f])=>({prop:mr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function I(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...S.map(f=>f.prop),qt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return I(),W?.(),{...r,destroy:ie,getProgress:()=>1};oe();let te=typeof s=="string"?ot(s):null;function ae(){if(!T||!dr()||!te||m!=="y"||P||F!==e||u||c!==1||Ce||W||ee||X||G||A||V!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!fr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++pr}`,f=S.map(Z=>`${Z.prop}:${Z.from}`).join(";"),ge=S.map(Z=>`${Z.prop}:${Z.to}`).join(";"),N=document.createElement("style");N.setAttribute("data-ssd-animate",""),N.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${te};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,xe=()=>{let Z=e.getBoundingClientRect();return Te({top:Z.top,height:Z.height},_(),q(),w,k)};Ae(e,{type:"animate",getProgress:()=>Se.getProgress(),getTrigger:xe});let Se={destroy(){e.classList.remove(i),N.remove(),e.style.animationPlayState="",ie(),Le(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Z){let Ne=Math.min(1,Math.max(0,Z));e.classList.remove(i);for(let U of S)e.style.setProperty(U.prop,_t(U.from,U.to,Ne));},getProgress(){let{tStart:Z,tEnd:Ne}=xe();return L(J(_(),Z,Ne,c))}};return Se}if(ae())return d();let x=0,g=0,C=0,E=false,D=false,fe=-1,K=0,ve=false,$e=NaN,_e=-1,be=0,we=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=nt(F,P,m),f=Te(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(qt,String(i));for(let f of S)e.style.setProperty(f.prop,_t(f.from,f.to,i));Ce?.(i);}function pe(i){if(isNaN($e)){$e=i;return}$e<=0&&i>0?ee?.():$e>0&&i<=0&&A?.(),$e<1&&i>=1?X?.():$e>=1&&i<1&&G?.(),$e=i;}function Q(){if(!E||D)return;let i=performance.now(),f=we(),ge=c;if(V!==false){let q=i-be,xe=q>0?Math.abs(f-(_e<0?f:_e))/q:0;ge=c*Math.max(.2,1+xe*(typeof V=="number"?V:1)*.04);}_e=f,be=i;let N=g===x?0:(f-x)/(g-x);pe(N);let _=L(J(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),K=_,j(_),_>=1&&!ve?(ve=true,W?.()):_<1&&!u&&(ve=false),C=requestAnimationFrame(Q);}ce(),g===x&&he("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(J(we(),x,g,c));u&&i>0&&(fe=i),K=i,j(i);}let Pe=new IntersectionObserver(i=>{i.forEach(f=>{E=f.isIntersecting,E&&!D?C=requestAnimationFrame(Q):cancelAnimationFrame(C);});},{root:P??null}),z;function O(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),Pe.observe(e),Ae(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame(C),Pe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(z),ie(),Le(e);},replay(){fe=-1,ve=false,K=0,D=false,j(0);},pause(){D=true,cancelAnimationFrame(C);},resume(){D&&(D=false,E&&(C=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));K=f,fe=f,D=true,cancelAnimationFrame(C),j(f);},getProgress(){return K}}}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n){if(typeof window>"u")return pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollCounter: element not found:",e),pt;let t=r,{from:a=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,M=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Ce=de(m.start??"top 80%"),W=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(s),V?.(),pt;let X=0,G=0,A=0,$=false,L=false,w=-1,k=0,F=false,P=()=>window.scrollY,S=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=Te({top:d.top,height:d.height},P(),S(),Ce,W);X=x.tStart,G=x.tEnd;}function I(d){t.textContent=M(a+(s-a)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!$||L)return;let d=ne(J(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,I(d),d>=1&&!F?(F=true,V?.()):d<1&&!p&&(F=false),A=requestAnimationFrame(se);}oe();{let d=ne(J(P(),X,G,1));p&&d>0&&(w=d),k=d,I(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{$=x.isIntersecting,$&&!L?A=requestAnimationFrame(se):cancelAnimationFrame(A);});}),te;function ae(){clearTimeout(te),te=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Ae(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(A),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(te),Le(t);},replay(){w=-1,F=false,k=0,L=false,I(0);},pause(){L=true,cancelAnimationFrame(A);},resume(){L&&(L=false,$&&(A=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,L=true,cancelAnimationFrame(A),I(x);},getProgress(){return k}}}var Bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Bt;let t=r,{trigger:a={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Ce=de(a.start??"top top"),W=de(a.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let ee=n.from??0,X=n.to,G=0,A=0,$=0,L=false,w=false,k=-1,F=0,P=false,S=false,oe=()=>u==="x"?window.scrollX:window.scrollY,I=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let E=t.getBoundingClientRect(),D=u==="x"?E.left:E.top,fe=u==="x"?E.width:E.height,K=Te({top:D,height:fe},oe(),I(),Ce,W);G=K.tStart,A=K.tEnd;}let ie=NaN;function te(E){if(!S)return;let D=X??t.duration??0,fe=ee+(D-ee)*E;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(E)),V?.(E);}function ae(){if(!L||w||!S||M)return;let E=ne(J(oe(),G,A,1));c&&(k=Math.max(k,E),E=k),F=E,te(E),E>=1&&!P?(P=true,T?.()):E<1&&!c&&(P=false),$=requestAnimationFrame(ae);}function d(){if(S=true,X===void 0&&(X=t.duration),M){te(1),p?.();return}se(),p?.(),L&&!w&&($=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),S||se();let x=new IntersectionObserver(E=>{E.forEach(D=>{L=D.isIntersecting,L&&!w&&S?$=requestAnimationFrame(ae):cancelAnimationFrame($);});}),g;function C(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",C),window.addEventListener("orientationchange",C),x.observe(t),Ae(t,{type:"video",getProgress:()=>F,getTrigger:()=>({tStart:G,tEnd:A})}),{destroy(){cancelAnimationFrame($),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(g),Le(t);},replay(){k=-1,P=false,F=0,w=false,ie=NaN,te(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,L&&S&&($=requestAnimationFrame(ae)));},seek(E){let D=Math.min(1,Math.max(0,E));F=D,k=D,w=true,cancelAnimationFrame($),ie=NaN,te(D);},getProgress(){return F}}}function jt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function gr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Wt(e){let n=jt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],a=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of a){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function yr(e,n,r,t){if(r<=1||t===0)return e;let a=(r-1)*t,s=n*t,c=s+(1-a);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function hr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yt(e,n={}){if(typeof window>"u")return Gt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollText: element not found:",e),Gt;let t=r,{split:a="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Ce=de(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;a==="chars"?ee=gr(t):a==="lines"?ee=Wt(t):ee=jt(t);let X=ee.length;function G(g,C){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*C));let E=hr(C,u);E&&(g.style.transform=E);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((C,E)=>{let D=M(yr(g,E,X,s));G(C,D);});}if(V)return A(1),T?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,L=0,w=0,k=false,F=false,P=-1,S=0,oe=false,I=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),C=Te({top:g.top,height:g.height},I(),se(),ne,Ce);$=C.tStart,L=C.tEnd;}function te(){if(!k||F)return;let g=J(I(),$,L,1);p&&(P=Math.max(P,g),g=P),S=g,A(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(te);}ie();let ae=new IntersectionObserver(g=>{g.forEach(C=>{k=C.isIntersecting,k&&!F?w=requestAnimationFrame(te):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(a==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),ee=Wt(t),A(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Ae(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=W,t.removeAttribute("aria-label"),Le(t);},replay(){P=-1,oe=false,S=0,F=false,A(0);},pause(){F=true,cancelAnimationFrame(w);},resume(){F&&(F=false,k&&(w=requestAnimationFrame(te)));},seek(g){let C=Math.min(1,Math.max(0,g));S=C,P=C,F=true,cancelAnimationFrame(w),A(C);},getProgress(){return S}}}var Ke=e=>typeof e=="function"?e():vue.unref(e);function Fe(e,n,r){let t=null,a=n(),s=()=>{t?.destroy(),t=e.value?r(e.value,Vt(a,()=>a)):null;};vue.onMounted(s),vue.watch(()=>Ht(a=n()),s),vue.onUnmounted(()=>{t?.destroy(),t=null;});}function En(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),mt),n}var Tn=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:n}){let r=vue.ref(null);return Fe(r,()=>{let t={};return 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),t},mt),()=>vue.h("div",{ref:r},n.default?.())}});function xn(e){let n=vue.ref(null);return Fe(n,()=>Ke(e),ft),n}var Mn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>e.options,ft),()=>vue.h("div",{ref:r},n.default?.())}});function An(e){let n=vue.ref(null);return Fe(n,()=>Ke(e),dt),n}var Ln=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 n=vue.ref(null);return Fe(n,()=>{let r={to:e.to};return e.from!=null&&(r.from=e.from),e.format!=null&&(r.format=e.format),e.easing!=null&&(r.easing=e.easing),e.trigger!=null&&(r.trigger=e.trigger),e.once!=null&&(r.once=e.once),e.decimals!=null&&(r.decimals=e.decimals),e.onComplete!=null&&(r.onComplete=e.onComplete),r},dt),()=>vue.h("span",{ref:n})}});function Cn(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),gt),n}var $n=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 n=vue.ref(null);return Fe(n,()=>e.options??{},gt),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Pn(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),yt),n}var On=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>e.options??{},yt),()=>vue.h(e.tag,{ref:r},n.default?.())}});exports.ScrollAnimate=Mn;exports.ScrollCounter=Ln;exports.ScrollDraw=Tn;exports.ScrollText=On;exports.ScrollVideo=$n;exports.useScrollAnimate=xn;exports.useScrollCounter=An;exports.useScrollDraw=En;exports.useScrollText=Pn;exports.useScrollVideo=Cn;
|
|
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",a,{passive:true}),a(),{el:t,destroy(){window.removeEventListener("scroll",a),t.remove();}}}var It=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function ar(e,n,r){if(!Ue)return;let t=(e.match(Dt)??[]).join("").toUpperCase(),a=(n.match(Dt)??[]).join("").toUpperCase(),s=(e.match(It)??[]).length,c=(n.match(It)??[]).length;if(t!==a){ge(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${a||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&ge(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function ut(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[a++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function mt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,a=r?{...$t[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:E={},stagger:V=0,direction:L="forward",once:re=false,debug:Me=false,axis:W="y",scrollContainer:ne,autoReverse:oe=false,delay:Y=0,strokeColor:M,strokeWidth:D,fillOpacity:C,waypoints:w,velocityScale:R=false,threshold:P=0,rootMargin:$="0px",repeat:T=0,repeatDelay:X=0,morphTo:x,clip:fe,autoplay:be=false,duration:se=1e3,native:ie=true,onProgress:p,onStart:S,onComplete:g,onEnter:O,onLeave:ae,onEnterBack:ee,onLeaveBack:A}=a,F=fe===true?"left":typeof fe=="string"?fe:false,K=typeof d=="function"?d:te[d]??te.linear,we=de(E.start??"top bottom"),_e=de(E.end??"bottom top"),ve=typeof ne=="string"?document.querySelector(ne):ne??null,Se=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(D)?D[0]:null,G=Array.isArray(D)?D[1]:typeof D=="number"?D:null,pe=Array.isArray(C)?C[0]:null,Q=Array.isArray(C)?C[1]:typeof C=="number"?C:null;function Pe(o){let l=o*100;switch(F){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let z=F?[]:Array.from(e.querySelectorAll(c)),k=[],i=[],f=0,ye=0,N=false,_=false,q=0,Ae=false,Ee=-1,Z=[],Ne=-1,j=false,Oe=0,Ie=0,He,st=null;function ht(){st?.destroy(),st=null;}let Ve=new Set,bt=NaN,ze=true,Qe=-1,wt=performance.now(),qe=NaN;function it(){return ve?W==="x"?ve.scrollLeft:ve.scrollTop:W==="x"?window.scrollX:window.scrollY}function vt(){return ve?W==="x"?ve.clientWidth:ve.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function St(){let o=nt(e,ve,W);return xe(o,o.scroll,vt(),we,_e)}function Et(){(({tStart:f,tEnd:ye}=St())),Me&&Ue&&(ht(),st=ir(f,ye,W));}function at(o,l=St){Ce(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Ut(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),F){let b=l==="reverse"?1-o:o;e.style.clipPath=Pe(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=l==="reverse"?`${k[ue]*o}`:`${k[ue]*(1-o)}`,m&&(b.style.opacity=l==="reverse"?`${1-o}`:`${o}`),Se&&le?b.style.stroke=We(Se,le,o):le&&(b.style.stroke=le),ce!==null&&G!==null?b.style.strokeWidth=`${ce+(G-ce)*o}`:G!==null&&(b.style.strokeWidth=`${G}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),x&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",ut(i[ue],x,o));});}function Ze(){if(e.style.setProperty("--scroll-draw-progress","0"),F){e.style.clipPath=Pe(0);return}z.forEach((o,l)=>{o.style.strokeDasharray=`${k[l]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${k[l]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),x&&o.tagName.toLowerCase()==="path"&&i[l]&&o.setAttribute("d",i[l]);});}if(z.forEach(o=>{sr(o);let l=Be(o);k.push(l);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),x&&(b?ar(i[i.length-1],x,o):ge(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=L==="reverse"?`${l}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),G!==null&&(o.style.strokeWidth=`${G}`),Q!==null&&(o.style.fillOpacity=`${Q}`),x&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",x)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=L==="reverse"?"0":`${l}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),F){if(s)return e.style.clipPath=Pe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Pe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Tt=typeof d=="string"?ot(d):null;function Yt(){return !(ie===false||!or()||!z.length||!Tt||F||W!=="y"||ve||u!==1||V!==0||re||oe||R!==false||x||w||T||Y>0||p||S||g||O||ae||ee||A||M!=null||D!=null||C!=null||(E.start??"top bottom").trim()!=="top bottom"||(E.end??"bottom top").trim()!=="bottom top")}function Xt(){let o=++nr,l=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,De=L==="reverse"?"0":"var(--ssd-len)",ke=L==="reverse"?"var(--ssd-len)":"0",Le=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${ke};`;m&&(Le+=`opacity:${L==="reverse"?1:0};`,v+=`opacity:${L==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${l}{from{${Le}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Tt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(k[U])),y.style.strokeDasharray=`${k[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(l);}z.forEach(me);let h=false,H=-1;function B(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},it(),vt(),we,_e);return K(J(it(),U,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(l),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),I.remove();},replay(){h=false,H=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));H=U,h=true,z.forEach((Te,he)=>{Te.classList.remove(l),Te.style.strokeDashoffset=L==="reverse"?`${k[he]*U}`:`${k[he]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return B()},refresh(){z.forEach((y,U)=>{k[U]=Be(y),y.style.setProperty("--ssd-len",String(k[U])),y.style.strokeDasharray=`${k[U]}`;});}}}if(Yt())return at(Xt());function Kt(){let o=Math.max(1,se),l=0,b=0,ue=false;function De(h){let H=true;if(F){let B=Math.min(1,Math.max(0,h/o)),y=K(B);Oe=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Pe(L==="reverse"?1-y:y),p?.(y),B<1&&(H=false);}else z.forEach((B,y)=>{let U=y*V*o,Te=Math.min(1,Math.max(0,(h-U)/o)),he=K(Te);B.style.strokeDashoffset=L==="reverse"?`${k[y]*he}`:`${k[y]*(1-he)}`,m&&(B.style.opacity=L==="reverse"?`${1-he}`:`${he}`),Se&&le?B.style.stroke=We(Se,le,he):le&&(B.style.stroke=le),ce!==null&&G!==null?B.style.strokeWidth=`${ce+(G-ce)*he}`:G!==null&&(B.style.strokeWidth=`${G}`),pe!==null&&Q!==null?B.style.fillOpacity=`${pe+(Q-pe)*he}`:Q!==null&&(B.style.fillOpacity=`${Q}`),x&&B.tagName.toLowerCase()==="path"&&i[y]&&B.setAttribute("d",ut(i[y],x,he)),y===0&&(Oe=he,p?.(he),e.style.setProperty("--scroll-draw-progress",String(he))),Te<1&&(H=false);});if(w){let B=Math.min(1,Math.max(0,h/o)),y=K(B);for(let U in w){let Te=parseFloat(U);y>=Te&&!Ve.has(Te)&&(Ve.add(Te),w[U]?.());}}return H}function ke(h){if(j)return;let H=h-l;_||(_=true,S?.());let B=De(H);if(B&&!N){N=true,De(o*(1+Math.max(0,z.length-1)*V)),g?.(),Ie<(T==="infinite"?1/0:T??0)&&(Ie++,He=setTimeout(()=>{l=performance.now(),_=false,N=false,Ve.clear(),Ze(),q=requestAnimationFrame(ke);},X));return}B||(q=requestAnimationFrame(ke));}function Le(){cancelAnimationFrame(q),clearTimeout(He),l=performance.now(),b=0,j=false,_=false,N=false,Ie=0,ue=true,Oe=0,Ve.clear(),Ze(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(re&&N)?Le():!H.isIntersecting&&!re&&!N&&(cancelAnimationFrame(q),clearTimeout(He),ue=false);});},{root:ve??null,threshold:P,rootMargin:$}),I;function me(){clearTimeout(I),I=setTimeout(()=>{z.forEach((h,H)=>{k[H]=Be(h),h.style.strokeDasharray=`${k[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),Y>0?setTimeout(()=>v.observe(e),Y):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(He),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(I);},replay(){Ie=0,Le();},pause(){j||!ue||(j=true,b=performance.now()-l,cancelAnimationFrame(q));},resume(){j&&(j=false,ue=true,l=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let H=Math.min(1,Math.max(0,h));Oe=H,j=true,b=H*o,l=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return Oe},refresh(){clearTimeout(I),z.forEach((h,H)=>{k[H]=Be(h),h.style.strokeDasharray=`${k[H]}`;});}}}if(be)return at(Kt());Et();function Je(){if(!Ae||j)return;let o=performance.now(),l=it();if(!ze&&R===false&&l===bt){q=requestAnimationFrame(Je);return}ze=false,bt=l;let b=u;if(R!==false){let v=o-wt,I=v>0?Math.abs(l-(Qe<0?l:Qe))/v:0;b=u*Math.max(.2,1+I*(typeof R=="number"?R:1)*.04);}Qe=l,wt=o;let ue=oe?Ne===-1||l>=Ne?"forward":"reverse":L;Ne=l;let De=ye-f,ke=true,Le=De===0?0:(l-f)/De;if(isNaN(qe)||(qe<=0&&Le>0?O?.():qe>0&&Le<=0&&A?.(),qe<1&&Le>=1?ae?.():qe>=1&&Le<1&&ee?.()),qe=Le,F){let v=K(J(l,f,ye,b));re&&!oe&&(Ee=Math.max(Ee,v),v=Ee),Oe=v,e.style.setProperty("--scroll-draw-progress",String(v));let I=ue==="reverse"?1-v:v;e.style.clipPath=Pe(I),p?.(v),!_&&J(l,f,ye,b)>0&&(_=true,S?.()),v>=1&&!N?(N=true,g?.(),Ie<(T==="infinite"?1/0:T??0)&&(Ie++,He=setTimeout(()=>{Ee=-1,_=false,N=false,e.style.clipPath=Pe(0);},X))):v<1&&!re&&(N=false),q=requestAnimationFrame(Je);return}if(z.forEach((v,I)=>{let me=I*V*De,h=K(J(l,f+me,ye+me,b));re&&!oe&&(h=Z[I]=Math.max(Z[I]??Ee,h)),Oe=h,v.style.strokeDashoffset=ue==="reverse"?`${k[I]*h}`:`${k[I]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Se&&le?v.style.stroke=We(Se,le,h):le&&(v.style.stroke=le),ce!==null&&G!==null?v.style.strokeWidth=`${ce+(G-ce)*h}`:G!==null&&(v.style.strokeWidth=`${G}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),x&&v.tagName.toLowerCase()==="path"&&i[I]&&v.setAttribute("d",ut(i[I],x,h)),I===0&&(p?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=K(J(l,f,ye,b));for(let I in w){let me=parseFloat(I);v>=me&&!Ve.has(me)&&(Ve.add(me),w[I]?.());}}!_&&J(l,f,ye,b)>0&&(_=true,S?.()),ke&&!N?(N=true,g?.(),Ie<(T==="infinite"?1/0:T??0)&&(Ie++,He=setTimeout(()=>{Ee=-1,Z=[],_=false,N=false,Ve.clear(),Ze(),ze=true;},X))):!ke&&!re&&(N=false),q=requestAnimationFrame(Je);}let lt=false;function et(){lt||(lt=true,q=requestAnimationFrame(function(){Je();}));}function tt(){lt=false,cancelAnimationFrame(q);}let ct=new IntersectionObserver(o=>{o.forEach(l=>{Ae=l.isIntersecting,Ae&&!j?(ze=true,et()):tt();});},{root:ve??null,threshold:P,rootMargin:$});function xt(){z.forEach((o,l)=>{k[l]=Be(o),o.style.strokeDasharray=`${k[l]}`;}),Et(),ze=true;}let rt;function Ge(){clearTimeout(rt),rt=setTimeout(xt,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)),Y>0?setTimeout(()=>ct.observe(e),Y):ct.observe(e),at({destroy(){cancelAnimationFrame(q),clearTimeout(He),tt(),ct.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(rt),ht();},replay(){Ee=-1,Z=[],Ne=-1,Qe=-1,_=false,N=false,Ie=0,j=false,Oe=0,Ve.clear(),clearTimeout(He),Ze(),ze=true,Ae&&et();},pause(){j=true,tt();},resume(){j&&(j=false,ze=true,Ae&&et());},seek(o){let l=Math.min(1,Math.max(0,o));Oe=l,Ee=l,Z=[],j=true,tt(),Ut(l,L),ze=true;},getProgress(){return Oe},refresh(){clearTimeout(rt),xt(),Ae&&!j&&et();}},()=>({tStart:f,tEnd:ye}))}var Nt=new WeakMap,lr=0;function Ht(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Nt.get(r);return t===void 0&&Nt.set(r,t=++lr),`el#${t}`}return r})}function Vt(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...a)=>n()[t]?.(...a));return r}function cr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function zt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let a=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:a,units:s});}return n}function ur(e,n,r){let t=zt(e),a=zt(n);return t.length===0||t.length!==a.length?r<1?e:n:t.map((s,c)=>{let u=a[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function _t(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),a=String(n);if(cr(t))return We(t,a,r);if(t.includes("("))return ur(t,a,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:a}function mr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var fr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),pr=0,qt="--scroll-draw-progress";function dr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ft(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:a={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:E=true,velocityScale:V=false,respectReducedMotion:L=true,triggerElement:re,onProgress:Me,onComplete:W,onEnter:ne,onLeave:oe,onEnterBack:Y,onLeaveBack:M}=n,D=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,C=typeof s=="function"?s:te[s]??te["ease-out"],w=de(a.start??"top bottom"),R=de(a.end??"bottom top"),P=re??e,$=typeof d=="string"?document.querySelector(d):d??null,T=Object.entries(t).map(([i,f])=>({prop:mr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function X(){let i=window.getComputedStyle(e);for(let f of T)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function x(){for(let i of T)e.style.setProperty(i.prop,String(i.to));}let fe=new Map;for(let i of [...T.map(f=>f.prop),qt])fe.set(i,e.style.getPropertyValue(i));function be(){for(let[i,f]of fe)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(D)return x(),W?.(),{...r,destroy:be,getProgress:()=>1};X();let se=typeof s=="string"?ot(s):null;function ie(){if(!E||!dr()||!se||m!=="y"||$||P!==e||u||c!==1||Me||W||ne||oe||Y||M||V!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let i of T)if(!fr.has(i.prop))return false;return true}function p(){let i=`ssd-a-${++pr}`,f=T.map(Z=>`${Z.prop}:${Z.from}`).join(";"),ye=T.map(Z=>`${Z.prop}:${Z.to}`).join(";"),N=document.createElement("style");N.setAttribute("data-ssd-animate",""),N.textContent=`@keyframes ${i}{from{${f}}to{${ye}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${se};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let Z=e.getBoundingClientRect();return xe({top:Z.top,height:Z.height},_(),q(),w,R)};Ce(e,{type:"animate",getProgress:()=>Ee.getProgress(),getTrigger:Ae});let Ee={destroy(){e.classList.remove(i),N.remove(),e.style.animationPlayState="",be(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Z){let Ne=Math.min(1,Math.max(0,Z));e.classList.remove(i);for(let j of T)e.style.setProperty(j.prop,_t(j.from,j.to,Ne));},getProgress(){let{tStart:Z,tEnd:Ne}=Ae();return C(J(_(),Z,Ne,c))}};return Ee}if(ie())return p();let S=0,g=0,O=0,ae=false,ee=false,A=-1,F=0,K=false,we=NaN,_e=-1,ve=0,Se=()=>$?m==="x"?$.scrollLeft:$.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>$?m==="x"?$.clientWidth:$.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=nt(P,$,m),f=xe(i,i.scroll,le(),w,R);S=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(qt,String(i));for(let f of T)e.style.setProperty(f.prop,_t(f.from,f.to,i));Me?.(i);}function pe(i){if(isNaN(we)){we=i;return}we<=0&&i>0?ne?.():we>0&&i<=0&&M?.(),we<1&&i>=1?oe?.():we>=1&&i<1&&Y?.(),we=i;}function Q(){if(!ae||ee)return;let i=performance.now(),f=Se(),ye=c;if(V!==false){let q=i-ve,Ae=q>0?Math.abs(f-(_e<0?f:_e))/q:0;ye=c*Math.max(.2,1+Ae*(typeof V=="number"?V:1)*.04);}_e=f,ve=i;let N=g===S?0:(f-S)/(g-S);pe(N);let _=C(J(f,S,g,ye));u&&(A=Math.max(A,_),_=A),F=_,G(_),_>=1&&!K?(K=true,W?.()):_<1&&!u&&(K=false),O=requestAnimationFrame(Q);}ce(),g===S&&ge("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=C(J(Se(),S,g,c));u&&i>0&&(A=i),F=i,G(i);}let Pe=new IntersectionObserver(i=>{i.forEach(f=>{ae=f.isIntersecting,ae&&!ee?O=requestAnimationFrame(Q):cancelAnimationFrame(O);});},{root:$??null}),z;function k(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),Pe.observe(e),Ce(e,{type:"animate",getProgress:()=>F,getTrigger:()=>({tStart:S,tEnd:g})}),{destroy(){cancelAnimationFrame(O),Pe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(z),be(),$e(e);},replay(){A=-1,K=false,F=0,ee=false,G(0);},pause(){ee=true,cancelAnimationFrame(O);},resume(){ee&&(ee=false,ae&&(O=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));F=f,A=f,ee=true,cancelAnimationFrame(O),G(f);},getProgress(){return F}}}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n){if(typeof window>"u")return pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ge("scrollCounter: element not found:",e),pt;let t=r,{from:a=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:E,onComplete:V}=n,L=E!==void 0?p=>p.toFixed(E):c??(p=>String(Math.round(p))),re=typeof u=="function"?u:te[u]??te["ease-out"],Me=de(m.start??"top 80%"),W=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),V?.(),pt;let oe=0,Y=0,M=0,D=false,C=false,w=-1,R=0,P=false,$=()=>window.scrollY,T=()=>window.innerHeight;function X(){let p=t.getBoundingClientRect(),S=xe({top:p.top,height:p.height},$(),T(),Me,W);oe=S.tStart,Y=S.tEnd;}function x(p){t.textContent=L(a+(s-a)*p),t.style.setProperty("--scroll-draw-progress",String(p));}function fe(){if(!D||C)return;let p=re(J($(),oe,Y,1));d&&(w=Math.max(w,p),p=w),R=p,x(p),p>=1&&!P?(P=true,V?.()):p<1&&!d&&(P=false),M=requestAnimationFrame(fe);}X();{let p=re(J($(),oe,Y,1));d&&p>0&&(w=p),R=p,x(p);}let be=new IntersectionObserver(p=>{p.forEach(S=>{D=S.isIntersecting,D&&!C?M=requestAnimationFrame(fe):cancelAnimationFrame(M);});}),se;function ie(){clearTimeout(se),se=setTimeout(X,150);}return window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie),be.observe(t),Ce(t,{type:"counter",getProgress:()=>R,getTrigger:()=>({tStart:oe,tEnd:Y})}),{destroy(){cancelAnimationFrame(M),be.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),clearTimeout(se),$e(t);},replay(){w=-1,P=false,R=0,C=false,x(0);},pause(){C=true,cancelAnimationFrame(M);},resume(){C&&(C=false,D&&(M=requestAnimationFrame(fe)));},seek(p){let S=Math.min(1,Math.max(0,p));R=S,w=S,C=true,cancelAnimationFrame(M),x(S);},getProgress(){return R}}}var Bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ge("scrollVideo: <video> element not found:",e),Bt;let t=r,{trigger:a={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",triggerElement:d,onReady:E,onComplete:V,onProgress:L}=n,re=d??t,Me=window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof s=="function"?s:te[s]??te.linear,ne=de(a.start??"top top"),oe=de(a.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Y=n.from??0,M=n.to,D=0,C=0,w=0,R=false,P=false,$=-1,T=0,X=false,x=false,fe=()=>u==="x"?window.scrollX:window.scrollY,be=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let A=re.getBoundingClientRect(),F=u==="x"?A.left:A.top,K=u==="x"?A.width:A.height,we=xe({top:F,height:K},fe(),be(),ne,oe);D=we.tStart,C=we.tEnd,x&&C===D&&ge("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let ie=NaN;function p(A){if(!x)return;let F=M??t.duration??0,K=Y+(F-Y)*A;K!==ie&&(ie=K,t.currentTime=K),t.style.setProperty("--scroll-draw-progress",String(A)),L?.(A);}function S(){if(!R||P||!x||Me)return;let A=W(J(fe(),D,C,1));c&&($=Math.max($,A),A=$),T=A,p(A),A>=1&&!X?(X=true,V?.()):A<1&&!c&&(X=false),w=requestAnimationFrame(S);}function g(){if(x=true,M===void 0&&(M=t.duration),Me){p(1),E?.();return}se(),E?.(),R&&!P&&(w=requestAnimationFrame(S));}t.readyState>=1?g():t.addEventListener("loadedmetadata",g,{once:true}),x||se();let O=new IntersectionObserver(A=>{A.forEach(F=>{R=F.isIntersecting,R&&!P&&x?w=requestAnimationFrame(S):cancelAnimationFrame(w);});}),ae;function ee(){clearTimeout(ae),ae=setTimeout(se,150);}return window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee),O.observe(t),Ce(t,{type:"video",getProgress:()=>T,getTrigger:()=>({tStart:D,tEnd:C})}),{destroy(){cancelAnimationFrame(w),O.disconnect(),t.removeEventListener("loadedmetadata",g),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),clearTimeout(ae),$e(t);},replay(){$=-1,X=false,T=0,P=false,ie=NaN,p(0);},pause(){P=true,cancelAnimationFrame(w);},resume(){P&&(P=false,R&&x&&(w=requestAnimationFrame(S)));},seek(A){let F=Math.min(1,Math.max(0,A));T=F,$=F,P=true,cancelAnimationFrame(w),ie=NaN,p(F);},getProgress(){return T}}}function jt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function gr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Wt(e){let n=jt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],a=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of a){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let E=m.nextElementSibling;u.appendChild(m),d<c.length-1&&E&&E.style.whiteSpace==="pre"&&u.appendChild(E);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function yr(e,n,r,t){if(r<=1||t===0)return e;let a=(r-1)*t,s=n*t,c=s+(1-a);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function hr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Gt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yt(e,n={}){if(typeof window>"u")return Gt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ge("scrollText: element not found:",e),Gt;let t=r,{split:a="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:E}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:te[c]??te["ease-out"],re=de(m.start??"top 85%"),Me=de(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ne;a==="chars"?ne=gr(t):a==="lines"?ne=Wt(t):ne=jt(t);let oe=ne.length;function Y(g,O){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*O));let ae=hr(O,u);ae&&(g.style.transform=ae);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),ne.forEach((O,ae)=>{let ee=L(yr(g,ae,oe,s));Y(O,ee);});}if(V)return M(1),E?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let D=0,C=0,w=0,R=false,P=false,$=-1,T=0,X=false,x=()=>window.scrollY,fe=()=>window.innerHeight;function be(){let g=t.getBoundingClientRect(),O=xe({top:g.top,height:g.height},x(),fe(),re,Me);D=O.tStart,C=O.tEnd;}function se(){if(!R||P)return;let g=J(x(),D,C,1);d&&($=Math.max($,g),g=$),T=g,M(g),g>=1&&!X?(X=true,E?.()):g<1&&!d&&(X=false),w=requestAnimationFrame(se);}be();let ie=new IntersectionObserver(g=>{g.forEach(O=>{R=O.isIntersecting,R&&!P?w=requestAnimationFrame(se):cancelAnimationFrame(w);});}),p;function S(){clearTimeout(p),p=setTimeout(()=>{if(a==="lines"){let g=T;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),ne=Wt(t),M(g);}be();},150);}return window.addEventListener("resize",S),window.addEventListener("orientationchange",S),ie.observe(t),Ce(t,{type:"text",getProgress:()=>T,getTrigger:()=>({tStart:D,tEnd:C})}),{destroy(){cancelAnimationFrame(w),ie.disconnect(),window.removeEventListener("resize",S),window.removeEventListener("orientationchange",S),clearTimeout(p),t.innerHTML=W,t.removeAttribute("aria-label"),$e(t);},replay(){$=-1,X=false,T=0,P=false,M(0);},pause(){P=true,cancelAnimationFrame(w);},resume(){P&&(P=false,R&&(w=requestAnimationFrame(se)));},seek(g){let O=Math.min(1,Math.max(0,g));T=O,$=O,P=true,cancelAnimationFrame(w),M(O);},getProgress(){return T}}}var Ke=e=>typeof e=="function"?e():vue.unref(e);function Fe(e,n,r){let t=null,a=n(),s=()=>{t?.destroy(),t=e.value?r(e.value,Vt(a,()=>a)):null;};vue.onMounted(s),vue.watch(()=>Ht(a=n()),s),vue.onUnmounted(()=>{t?.destroy(),t=null;});}function En(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),mt),n}var Tn=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:n}){let r=vue.ref(null);return Fe(r,()=>{let t={};return 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),t},mt),()=>vue.h("div",{ref:r},n.default?.())}});function xn(e){let n=vue.ref(null);return Fe(n,()=>Ke(e),ft),n}var Mn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>e.options,ft),()=>vue.h("div",{ref:r},n.default?.())}});function An(e){let n=vue.ref(null);return Fe(n,()=>Ke(e),dt),n}var Ln=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 n=vue.ref(null);return Fe(n,()=>{let r={to:e.to};return e.from!=null&&(r.from=e.from),e.format!=null&&(r.format=e.format),e.easing!=null&&(r.easing=e.easing),e.trigger!=null&&(r.trigger=e.trigger),e.once!=null&&(r.once=e.once),e.decimals!=null&&(r.decimals=e.decimals),e.onComplete!=null&&(r.onComplete=e.onComplete),r},dt),()=>vue.h("span",{ref:n})}});function Cn(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),gt),n}var $n=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 n=vue.ref(null);return Fe(n,()=>e.options??{},gt),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Pn(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),yt),n}var On=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>e.options??{},yt),()=>vue.h(e.tag,{ref:r},n.default?.())}});exports.ScrollAnimate=Mn;exports.ScrollCounter=Ln;exports.ScrollDraw=Tn;exports.ScrollText=On;exports.ScrollVideo=$n;exports.useScrollAnimate=xn;exports.useScrollCounter=An;exports.useScrollDraw=En;exports.useScrollText=Pn;exports.useScrollVideo=Cn;
|
package/dist/vue/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{d as ScrollAnimate,f as ScrollCounter,b as ScrollDraw,j as ScrollText,h as ScrollVideo,c as useScrollAnimate,e as useScrollCounter,a as useScrollDraw,i as useScrollText,g as useScrollVideo}from'../chunk-
|
|
1
|
+
export{d as ScrollAnimate,f as ScrollCounter,b as ScrollDraw,j as ScrollText,h as ScrollVideo,c as useScrollAnimate,e as useScrollCounter,a as useScrollDraw,i as useScrollText,g as useScrollVideo}from'../chunk-CTVQDBD3.mjs';import'../chunk-XSVTHCLO.mjs';import'../chunk-TIRZOSQ4.mjs';import'../chunk-SNCRC6BA.mjs';import'../chunk-4MH5SQTH.mjs';import'../chunk-QJ4H2HW3.mjs';import'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svg-scroll-draw",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Scroll-driven animation for the web — draw SVG paths, reveal elements, pin sections, scrub video. Zero dependencies, native CSS fast path, works with React, Vue, Svelte, Solid, Angular, Astro and vanilla JS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svg",
|
package/dist/chunk-JC5BD4RB.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a,c,b as b$2}from'./chunk-PEFR3ZB7.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var _={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function $(c$1,v={}){if(typeof window>"u")return _;let y=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!y||y.tagName.toLowerCase()!=="video")return b("scrollVideo: <video> element not found:",c$1),_;let t=y,{trigger:F={},easing:h="linear",once:P=false,axis:m="y",preload:B="auto",onReady:C,onComplete:G,onProgress:W}=v,z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,X=typeof h=="function"?h:d[h]??d.linear,Y=a(F.start??"top top"),j=a(F.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=B);let I=v.from??0,T=v.to,b$3=0,E=0,o=0,a$2=false,n=false,s=-1,l=0,u=false,i=false,M=()=>m==="x"?window.scrollX:window.scrollY,J=()=>m==="x"?window.innerWidth:window.innerHeight;function A(){let e=t.getBoundingClientRect(),r=m==="x"?e.left:e.top,d=m==="x"?e.width:e.height,R=c({top:r,height:d},M(),J(),Y,j);b$3=R.tStart,E=R.tEnd;}let f=NaN;function p(e){if(!i)return;let r=T??t.duration??0,d=I+(r-I)*e;d!==f&&(f=d,t.currentTime=d),t.style.setProperty("--scroll-draw-progress",String(e)),W?.(e);}function g(){if(!a$2||n||!i||z)return;let e=X(b$2(M(),b$3,E,1));P&&(s=Math.max(s,e),e=s),l=e,p(e),e>=1&&!u?(u=true,G?.()):e<1&&!P&&(u=false),o=requestAnimationFrame(g);}function S(){if(i=true,T===void 0&&(T=t.duration),z){p(1),C?.();return}A(),C?.(),a$2&&!n&&(o=requestAnimationFrame(g));}t.readyState>=1?S():t.addEventListener("loadedmetadata",S,{once:true}),i||A();let V=new IntersectionObserver(e=>{e.forEach(r=>{a$2=r.isIntersecting,a$2&&!n&&i?o=requestAnimationFrame(g):cancelAnimationFrame(o);});}),x;function w(){clearTimeout(x),x=setTimeout(A,150);}return window.addEventListener("resize",w),window.addEventListener("orientationchange",w),V.observe(t),a$1(t,{type:"video",getProgress:()=>l,getTrigger:()=>({tStart:b$3,tEnd:E})}),{destroy(){cancelAnimationFrame(o),V.disconnect(),t.removeEventListener("loadedmetadata",S),window.removeEventListener("resize",w),window.removeEventListener("orientationchange",w),clearTimeout(x),b$1(t);},replay(){s=-1,u=false,l=0,n=false,f=NaN,p(0);},pause(){n=true,cancelAnimationFrame(o);},resume(){n&&(n=false,a$2&&i&&(o=requestAnimationFrame(g)));},seek(e){let r=Math.min(1,Math.max(0,e));l=r,s=r,n=true,cancelAnimationFrame(o),f=NaN,p(r);},getProgress(){return l}}}export{$ as a};
|