svg-scroll-draw 2.17.1 → 2.18.1
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/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +9 -2
- package/dist/horizontal/index.d.ts +9 -2
- package/dist/horizontal/index.mjs +1 -1
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +11 -0
- package/dist/video/index.d.ts +11 -0
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-JC5BD4RB.mjs +0 -1
package/dist/nuxt/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,d,f,h,j}from'../chunk-
|
|
1
|
+
import {b,d,f,h,j}from'../chunk-CTVQDBD3.mjs';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';function s(){return {install(o){o.component("ScrollDraw",b),o.component("ScrollAnimate",d),o.component("ScrollCounter",f),o.component("ScrollVideo",h),o.component("ScrollText",j);}}}export{s as createScrollDrawPlugin};
|
package/dist/react/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var vr=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var vr__default=/*#__PURE__*/_interopDefault(vr);function Kt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,l=[];for(let p=0;p<r;p++){let S=Math.pow(i,p);l.push(S),o+=S;}let u=[0],m=0;for(let p=0;p<r;p++)m+=l[p]/o,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let S=0;S<r;S++)if(p<=u[S+1]){let k=(p-u[S])/(u[S+1]-u[S]);if(S===0)return k*(2-k);let
|
|
2
|
+
'use strict';var vr=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var vr__default=/*#__PURE__*/_interopDefault(vr);function Kt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,l=[];for(let p=0;p<r;p++){let S=Math.pow(i,p);l.push(S),o+=S;}let u=[0],m=0;for(let p=0;p<r;p++)m+=l[p]/o,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let S=0;S<r;S++)if(p<=u[S+1]){let k=(p-u[S])/(u[S+1]-u[S]);if(S===0)return k*(2-k);let C=1-Math.pow(t,S);return C+(1-C)*(2*k-1)*(2*k-1)}return 1}}function Qt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),i=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return o=>o<=0?0:o>=1?1:r*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/t)+1}var K={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:Kt(),elastic:Qt()};function bt(e,n,r){return Math.min(r,Math.max(n,e))}function se(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 wt(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 vt(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 Q(e,n,r,t){return r===n?0:bt((e-n)/(r-n)*t,0,1)}function ve(e,n,r,t,i){let o=wt(e.top,e.height,n,t.element)-vt(t.viewport,r),l=wt(e.top,e.height,n,i.element)-vt(i.viewport,r);return {tStart:o,tEnd:l}}function et(e,n,r){let t=e.getBoundingClientRect(),i=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:i,scroll:0}:{top:r==="x"?t.left:t.top,height:i,scroll:r==="x"?window.scrollX:window.scrollY}}function _e(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 Et(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function qe(e,n,r){let t=Et(e),i=Et(n);return !t||!i?e:`rgb(${Math.round(t[0]+(i[0]-t[0])*r)},${Math.round(t[1]+(i[1]-t[1])*r)},${Math.round(t[2]+(i[2]-t[2])*r)})`}var St={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...n){je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Jt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Zt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Tt=33;function er(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function tr(e){let n=[];for(let r=0;r<Tt;r++){let t=r/(Tt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function tt(e){switch(e){case "linear":return "linear";case "ease-in":return Jt;case "ease-out":return Zt;case "ease-in-out":return er()?tr(K["ease-in-out"]):null;default:return null}}var xt=Symbol.for("svg-scroll-draw.registry");function At(){let e=globalThis;return e[xt]||(e[xt]=new Map)}function Le(e,n){At().set(e,n);}function Ce(e){At().delete(e);}var rr=0;function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Mt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Pt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function or(e){if(!je)return;let n=Mt(e,"stroke");if(!n||n==="none"){ye("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Pt.has(r)&&!Pt.has(Mt(e,"fill"))&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function sr(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 i(){let o=r==="x"?window.scrollX:window.scrollY,l=e-o,u=n-o,m=r==="x";t.innerHTML=`
|
|
3
3
|
<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>
|
|
4
|
-
<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",i,{passive:true}),i(),{el:t,destroy(){window.removeEventListener("scroll",i),t.remove();}}}var Lt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ct=/[MmLlHhVvCcSsQqTtAaZz]/g;function ir(e,n,r){if(!je)return;let t=(e.match(Ct)??[]).join("").toUpperCase(),i=(n.match(Ct)??[]).join("").toUpperCase(),o=(e.match(Lt)??[]).length,l=(n.match(Lt)??[]).length;if(t!==i){be(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}o!==l&&be(`morphTo: coordinate count differs (${o} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function lt(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let l=parseFloat(o),u=t[i++]??l;return String(+(l+(u-l)*r).toFixed(4))})}function $t(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...St[r],...t}:t,o=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:S={},stagger:k=0,direction:M="forward",once:re=false,debug:we=false,axis:H="y",scrollContainer:W,autoReverse:D=false,delay:z=0,strokeColor:P,strokeWidth:L,fillOpacity:x,waypoints:b,velocityScale:C=false,threshold:R=0,rootMargin:w="0px",repeat:g=0,repeatDelay:U=0,morphTo:I,clip:B,autoplay:X=false,duration:ae=1e3,native:le=true,onProgress:d,onStart:$,onComplete:y,onEnter:O,onLeave:A,onEnterBack:V,onLeaveBack:pe}=i,ne=B===true?"left":typeof B=="string"?B:false,Se=typeof p=="function"?p:Q[p]??Q.linear,Ce=ie(S.start??"top bottom"),ze=ie(S.end??"bottom top"),ve=typeof W=="string"?document.querySelector(W):W??null,Ee=Array.isArray(P)?P[0]:null,ce=Array.isArray(P)?P[1]:typeof P=="string"?P:null,ue=Array.isArray(L)?L[0]:null,Z=Array.isArray(L)?L[1]:typeof L=="number"?L:null,de=Array.isArray(x)?x[0]:null,oe=Array.isArray(x)?x[1]:typeof x=="number"?x:null;function $e(s){let c=s*100;switch(ne){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(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let G=ne?[]:Array.from(e.querySelectorAll(l)),F=[],a=[],f=0,ge=0,_=false,j=false,Y=0,Ae=false,Te=-1,se=[],Fe=-1,ee=false,ke=0,Oe=0,Ne,nt=null;function ut(){nt?.destroy(),nt=null;}let De=new Set,mt=NaN,He=true,Xe=-1,ft=performance.now(),Ve=NaN;function ot(){return ve?H==="x"?ve.scrollLeft:ve.scrollTop:H==="x"?window.scrollX:window.scrollY}function pt(){return ve?H==="x"?ve.clientWidth:ve.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function dt(){let s=et(e,ve,H);return he(s,s.scroll,pt(),Ce,ze)}function gt(){(({tStart:f,tEnd:ge}=dt())),we&&je&&(ut(),nt=sr(f,ge,H));}function st(s,c=dt){Pe(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let E=s.destroy;return s.destroy=()=>{E.call(s),Le(e);},s}function jt(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),ne){let E=c==="reverse"?1-s:s;e.style.clipPath=$e(E);return}G.forEach((E,me)=>{E.style.strokeDashoffset=c==="reverse"?`${F[me]*s}`:`${F[me]*(1-s)}`,m&&(E.style.opacity=c==="reverse"?`${1-s}`:`${s}`),Ee&&ce?E.style.stroke=qe(Ee,ce,s):ce&&(E.style.stroke=ce),ue!==null&&Z!==null?E.style.strokeWidth=`${ue+(Z-ue)*s}`:Z!==null&&(E.style.strokeWidth=`${Z}`),de!==null&&oe!==null?E.style.fillOpacity=`${de+(oe-de)*s}`:oe!==null&&(E.style.fillOpacity=`${oe}`),I&&E.tagName.toLowerCase()==="path"&&a[me]&&E.setAttribute("d",lt(a[me],I,s));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),ne){e.style.clipPath=$e(0);return}G.forEach((s,c)=>{s.style.strokeDasharray=`${F[c]}`,s.style.strokeDashoffset=M==="reverse"?"0":`${F[c]}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Ee&&(s.style.stroke=Ee),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`),I&&s.tagName.toLowerCase()==="path"&&a[c]&&s.setAttribute("d",a[c]);});}if(G.forEach(s=>{or(s);let c=_e(s);F.push(c);let E=s.tagName.toLowerCase()==="path";E?a.push(s.getAttribute("d")??""):a.push(""),I&&(E?ir(a[a.length-1],I,s):be(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),ce&&(s.style.stroke=ce),Z!==null&&(s.style.strokeWidth=`${Z}`),oe!==null&&(s.style.fillOpacity=`${oe}`),I&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",I)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?"0":`${c}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Ee&&(s.style.stroke=Ee),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`));}),ne){if(o)return e.style.clipPath=$e(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(o)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let yt=typeof p=="string"?tt(p):null;function Ut(){return !(le===false||!nr()||!G.length||!yt||ne||H!=="y"||ve||u!==1||k!==0||re||D||C!==false||I||b||g||z>0||d||$||y||O||A||V||pe||P!=null||L!=null||x!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Xt(){let s=++rr,c=`svg-scroll-draw-${s}`,E=`svg-scroll-draw-host-${s}`,me=`--svg-scroll-draw-${s}`,Ie=M==="reverse"?"0":"var(--ssd-len)",Re=M==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${Ie};`,T=`stroke-dashoffset:${Re};`;m&&(Me+=`opacity:${M==="reverse"?1:0};`,T+=`opacity:${M==="reverse"?0:1};`);let N=document.createElement("style");N.setAttribute("data-svg-scroll-draw",""),N.textContent=`@keyframes ${c}{from{${Me}}to{${T}}}.${E}{view-timeline-name:${me};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${yt};animation-fill-mode:both;animation-timeline:${me};animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(E);function fe(h,te){h.style.setProperty("--ssd-len",String(F[te])),h.style.strokeDasharray=`${F[te]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}G.forEach(fe);let v=false,q=-1;function K(){if(q>=0)return q;let h=e.getBoundingClientRect(),{tStart:te,tEnd:xe}=he({top:h.top,height:h.height},ot(),pt(),Ce,ze);return Se(J(ot(),te,xe,u))}return {destroy(){e.classList.remove(E),G.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),N.remove();},replay(){v=false,q=-1,G.forEach(fe);},pause(){v=true,G.forEach(h=>{h.style.animationPlayState="paused";});},resume(){v&&(v=false,G.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let te=Math.min(1,Math.max(0,h));q=te,v=true,G.forEach((xe,ye)=>{xe.classList.remove(c),xe.style.strokeDashoffset=M==="reverse"?`${F[ye]*te}`:`${F[ye]*(1-te)}`,m&&(xe.style.opacity=M==="reverse"?`${1-te}`:`${te}`);});},getProgress(){return K()},refresh(){G.forEach((h,te)=>{F[te]=_e(h),h.style.setProperty("--ssd-len",String(F[te])),h.style.strokeDasharray=`${F[te]}`;});}}}if(Ut())return st(Xt());function Yt(){let s=Math.max(1,ae),c=0,E=0,me=false;function Ie(v){let q=true;if(ne){let K=Math.min(1,Math.max(0,v/s)),h=Se(K);ke=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=$e(M==="reverse"?1-h:h),d?.(h),K<1&&(q=false);}else G.forEach((K,h)=>{let te=h*k*s,xe=Math.min(1,Math.max(0,(v-te)/s)),ye=Se(xe);K.style.strokeDashoffset=M==="reverse"?`${F[h]*ye}`:`${F[h]*(1-ye)}`,m&&(K.style.opacity=M==="reverse"?`${1-ye}`:`${ye}`),Ee&&ce?K.style.stroke=qe(Ee,ce,ye):ce&&(K.style.stroke=ce),ue!==null&&Z!==null?K.style.strokeWidth=`${ue+(Z-ue)*ye}`:Z!==null&&(K.style.strokeWidth=`${Z}`),de!==null&&oe!==null?K.style.fillOpacity=`${de+(oe-de)*ye}`:oe!==null&&(K.style.fillOpacity=`${oe}`),I&&K.tagName.toLowerCase()==="path"&&a[h]&&K.setAttribute("d",lt(a[h],I,ye)),h===0&&(ke=ye,d?.(ye),e.style.setProperty("--scroll-draw-progress",String(ye))),xe<1&&(q=false);});if(b){let K=Math.min(1,Math.max(0,v/s)),h=Se(K);for(let te in b){let xe=parseFloat(te);h>=xe&&!De.has(xe)&&(De.add(xe),b[te]?.());}}return q}function Re(v){if(ee)return;let q=v-c;j||(j=true,$?.());let K=Ie(q);if(K&&!_){_=true,Ie(s*(1+Math.max(0,G.length-1)*k)),y?.(),Oe<(g==="infinite"?1/0:g??0)&&(Oe++,Ne=setTimeout(()=>{c=performance.now(),j=false,_=false,De.clear(),Ye(),Y=requestAnimationFrame(Re);},U));return}K||(Y=requestAnimationFrame(Re));}function Me(){cancelAnimationFrame(Y),clearTimeout(Ne),c=performance.now(),E=0,ee=false,j=false,_=false,Oe=0,me=true,ke=0,De.clear(),Ye(),Y=requestAnimationFrame(Re);}let T=new IntersectionObserver(v=>{v.forEach(q=>{q.isIntersecting&&!(re&&_)?Me():!q.isIntersecting&&!re&&!_&&(cancelAnimationFrame(Y),clearTimeout(Ne),me=false);});},{root:ve??null,threshold:R,rootMargin:w}),N;function fe(){clearTimeout(N),N=setTimeout(()=>{G.forEach((v,q)=>{F[q]=_e(v),v.style.strokeDasharray=`${F[q]}`;});},150);}return window.addEventListener("resize",fe),window.addEventListener("orientationchange",fe),z>0?setTimeout(()=>T.observe(e),z):T.observe(e),{destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),T.disconnect(),window.removeEventListener("resize",fe),window.removeEventListener("orientationchange",fe),clearTimeout(N);},replay(){Oe=0,Me();},pause(){ee||!me||(ee=true,E=performance.now()-c,cancelAnimationFrame(Y));},resume(){ee&&(ee=false,me=true,c=performance.now()-E,Y=requestAnimationFrame(Re));},seek(v){let q=Math.min(1,Math.max(0,v));ke=q,ee=true,E=q*s,c=performance.now()-E,cancelAnimationFrame(Y),Ie(E);},getProgress(){return ke},refresh(){clearTimeout(N),G.forEach((v,q)=>{F[q]=_e(v),v.style.strokeDasharray=`${F[q]}`;});}}}if(X)return st(Yt());gt();function Ke(){if(!Ae||ee)return;let s=performance.now(),c=ot();if(!He&&C===false&&c===mt){Y=requestAnimationFrame(Ke);return}He=false,mt=c;let E=u;if(C!==false){let T=s-ft,N=T>0?Math.abs(c-(Xe<0?c:Xe))/T:0;E=u*Math.max(.2,1+N*(typeof C=="number"?C:1)*.04);}Xe=c,ft=s;let me=D?Fe===-1||c>=Fe?"forward":"reverse":M;Fe=c;let Ie=ge-f,Re=true,Me=Ie===0?0:(c-f)/Ie;if(isNaN(Ve)||(Ve<=0&&Me>0?O?.():Ve>0&&Me<=0&&pe?.(),Ve<1&&Me>=1?A?.():Ve>=1&&Me<1&&V?.()),Ve=Me,ne){let T=Se(J(c,f,ge,E));re&&!D&&(Te=Math.max(Te,T),T=Te),ke=T,e.style.setProperty("--scroll-draw-progress",String(T));let N=me==="reverse"?1-T:T;e.style.clipPath=$e(N),d?.(T),!j&&J(c,f,ge,E)>0&&(j=true,$?.()),T>=1&&!_?(_=true,y?.(),Oe<(g==="infinite"?1/0:g??0)&&(Oe++,Ne=setTimeout(()=>{Te=-1,j=false,_=false,e.style.clipPath=$e(0);},U))):T<1&&!re&&(_=false),Y=requestAnimationFrame(Ke);return}if(G.forEach((T,N)=>{let fe=N*k*Ie,v=Se(J(c,f+fe,ge+fe,E));re&&!D&&(v=se[N]=Math.max(se[N]??Te,v)),ke=v,T.style.strokeDashoffset=me==="reverse"?`${F[N]*v}`:`${F[N]*(1-v)}`,m&&(T.style.opacity=me==="reverse"?`${1-v}`:`${v}`),Ee&&ce?T.style.stroke=qe(Ee,ce,v):ce&&(T.style.stroke=ce),ue!==null&&Z!==null?T.style.strokeWidth=`${ue+(Z-ue)*v}`:Z!==null&&(T.style.strokeWidth=`${Z}`),de!==null&&oe!==null?T.style.fillOpacity=`${de+(oe-de)*v}`:oe!==null&&(T.style.fillOpacity=`${oe}`),I&&T.tagName.toLowerCase()==="path"&&a[N]&&T.setAttribute("d",lt(a[N],I,v)),N===0&&(d?.(v),e.style.setProperty("--scroll-draw-progress",String(v))),v<1&&(Re=false);}),b){let T=Se(J(c,f,ge,E));for(let N in b){let fe=parseFloat(N);T>=fe&&!De.has(fe)&&(De.add(fe),b[N]?.());}}!j&&J(c,f,ge,E)>0&&(j=true,$?.()),Re&&!_?(_=true,y?.(),Oe<(g==="infinite"?1/0:g??0)&&(Oe++,Ne=setTimeout(()=>{Te=-1,se=[],j=false,_=false,De.clear(),Ye(),He=true;},U))):!Re&&!re&&(_=false),Y=requestAnimationFrame(Ke);}let it=false;function Qe(){it||(it=true,Y=requestAnimationFrame(function(){Ke();}));}function Je(){it=false,cancelAnimationFrame(Y);}let at=new IntersectionObserver(s=>{s.forEach(c=>{Ae=c.isIntersecting,Ae&&!ee?(He=true,Qe()):Je();});},{root:ve??null,threshold:R,rootMargin:w});function ht(){G.forEach((s,c)=>{F[c]=_e(s),s.style.strokeDasharray=`${F[c]}`;}),gt(),He=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(ht,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),z>0?setTimeout(()=>at.observe(e),z):at.observe(e),st({destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),Je(),at.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),ut();},replay(){Te=-1,se=[],Fe=-1,Xe=-1,j=false,_=false,Oe=0,ee=false,ke=0,De.clear(),clearTimeout(Ne),Ye(),He=true,Ae&&Qe();},pause(){ee=true,Je();},resume(){ee&&(ee=false,He=true,Ae&&Qe());},seek(s){let c=Math.min(1,Math.max(0,s));ke=c,Te=c,se=[],ee=true,Je(),jt(c,M),He=true;},getProgress(){return ke},refresh(){clearTimeout(Ze),ht(),Ae&&!ee&&Qe();}},()=>({tStart:f,tEnd:ge}))}var kt=new WeakMap,ar=0;function Rt(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=kt.get(r);return t===void 0&&kt.set(r,t=++ar),`el#${t}`}return r})}function Ot(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...i)=>n()[t]?.(...i));return r}function lr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function It(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function cr(e,n,r){let t=It(e),i=It(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,l)=>{let u=i[l];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function Ft(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(lr(t))return qe(t,i,r);if(t.includes("("))return cr(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),l=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&l){let u=parseFloat(o[1]),m=parseFloat(l[1]);return `${u+(m-u)*r}${o[2]||l[2]}`}return r<1?t:i}function ur(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),fr=0,Nt="--scroll-draw-progress";function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Dt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:p,native:S=true,velocityScale:k=false,respectReducedMotion:M=true,triggerElement:re,onProgress:we,onComplete:H,onEnter:W,onLeave:D,onEnterBack:z,onLeaveBack:P}=n,L=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof o=="function"?o:Q[o]??Q["ease-out"],b=ie(i.start??"top bottom"),C=ie(i.end??"bottom top"),R=re??e,w=typeof p=="string"?document.querySelector(p):p??null,g=Object.entries(t).map(([a,f])=>({prop:ur(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function U(){let a=window.getComputedStyle(e);for(let f of g)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function I(){for(let a of g)e.style.setProperty(a.prop,String(a.to));}let B=new Map;for(let a of [...g.map(f=>f.prop),Nt])B.set(a,e.style.getPropertyValue(a));function X(){for(let[a,f]of B)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(L)return I(),H?.(),{...r,destroy:X,getProgress:()=>1};U();let ae=typeof o=="string"?tt(o):null;function le(){if(!S||!pr()||!ae||m!=="y"||w||R!==e||u||l!==1||we||H||W||D||z||P||k!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let a of g)if(!mr.has(a.prop))return false;return true}function d(){let a=`ssd-a-${++fr}`,f=g.map(se=>`${se.prop}:${se.from}`).join(";"),ge=g.map(se=>`${se.prop}:${se.to}`).join(";"),_=document.createElement("style");_.setAttribute("data-ssd-animate",""),_.textContent=`@keyframes ${a}{from{${f}}to{${ge}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ae};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(a);let j=()=>m==="x"?window.scrollX:window.scrollY,Y=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let se=e.getBoundingClientRect();return he({top:se.top,height:se.height},j(),Y(),b,C)};Pe(e,{type:"animate",getProgress:()=>Te.getProgress(),getTrigger:Ae});let Te={destroy(){e.classList.remove(a),_.remove(),e.style.animationPlayState="",X(),Le(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(se){let Fe=Math.min(1,Math.max(0,se));e.classList.remove(a);for(let ee of g)e.style.setProperty(ee.prop,Ft(ee.from,ee.to,Fe));},getProgress(){let{tStart:se,tEnd:Fe}=Ae();return x(J(j(),se,Fe,l))}};return Te}if(le())return d();let $=0,y=0,O=0,A=false,V=false,pe=-1,ne=0,Se=false,Ce=NaN,ze=-1,ve=0,Ee=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ce=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ue(){let a=et(R,w,m),f=he(a,a.scroll,ce(),b,C);$=f.tStart,y=f.tEnd;}function Z(a){e.style.setProperty(Nt,String(a));for(let f of g)e.style.setProperty(f.prop,Ft(f.from,f.to,a));we?.(a);}function de(a){if(isNaN(Ce)){Ce=a;return}Ce<=0&&a>0?W?.():Ce>0&&a<=0&&P?.(),Ce<1&&a>=1?D?.():Ce>=1&&a<1&&z?.(),Ce=a;}function oe(){if(!A||V)return;let a=performance.now(),f=Ee(),ge=l;if(k!==false){let Y=a-ve,Ae=Y>0?Math.abs(f-(ze<0?f:ze))/Y:0;ge=l*Math.max(.2,1+Ae*(typeof k=="number"?k:1)*.04);}ze=f,ve=a;let _=y===$?0:(f-$)/(y-$);de(_);let j=x(J(f,$,y,ge));u&&(pe=Math.max(pe,j),j=pe),ne=j,Z(j),j>=1&&!Se?(Se=true,H?.()):j<1&&!u&&(Se=false),O=requestAnimationFrame(oe);}ue(),y===$&&be("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let a=x(J(Ee(),$,y,l));u&&a>0&&(pe=a),ne=a,Z(a);}let $e=new IntersectionObserver(a=>{a.forEach(f=>{A=f.isIntersecting,A&&!V?O=requestAnimationFrame(oe):cancelAnimationFrame(O);});},{root:w??null}),G;function F(){clearTimeout(G),G=setTimeout(ue,150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),$e.observe(e),Pe(e,{type:"animate",getProgress:()=>ne,getTrigger:()=>({tStart:$,tEnd:y})}),{destroy(){cancelAnimationFrame(O),$e.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(G),X(),Le(e);},replay(){pe=-1,Se=false,ne=0,V=false,Z(0);},pause(){V=true,cancelAnimationFrame(O);},resume(){V&&(V=false,A&&(O=requestAnimationFrame(oe)));},seek(a){let f=Math.min(1,Math.max(0,a));ne=f,pe=f,V=true,cancelAnimationFrame(O),Z(f);},getProgress(){return ne}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ht(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return be("scrollCounter: element not found:",e),ct;let t=r,{from:i=0,to:o,format:l,easing:u="ease-out",trigger:m={},once:p=true,decimals:S,onComplete:k}=n,M=S!==void 0?d=>d.toFixed(S):l??(d=>String(Math.round(d))),re=typeof u=="function"?u:Q[u]??Q["ease-out"],we=ie(m.start??"top 80%"),H=ie(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(o),k?.(),ct;let D=0,z=0,P=0,L=false,x=false,b=-1,C=0,R=false,w=()=>window.scrollY,g=()=>window.innerHeight;function U(){let d=t.getBoundingClientRect(),$=he({top:d.top,height:d.height},w(),g(),we,H);D=$.tStart,z=$.tEnd;}function I(d){t.textContent=M(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function B(){if(!L||x)return;let d=re(J(w(),D,z,1));p&&(b=Math.max(b,d),d=b),C=d,I(d),d>=1&&!R?(R=true,k?.()):d<1&&!p&&(R=false),P=requestAnimationFrame(B);}U();{let d=re(J(w(),D,z,1));p&&d>0&&(b=d),C=d,I(d);}let X=new IntersectionObserver(d=>{d.forEach($=>{L=$.isIntersecting,L&&!x?P=requestAnimationFrame(B):cancelAnimationFrame(P);});}),ae;function le(){clearTimeout(ae),ae=setTimeout(U,150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),X.observe(t),Pe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:D,tEnd:z})}),{destroy(){cancelAnimationFrame(P),X.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(ae),Le(t);},replay(){b=-1,R=false,C=0,x=false,I(0);},pause(){x=true,cancelAnimationFrame(P);},resume(){x&&(x=false,L&&(P=requestAnimationFrame(B)));},seek(d){let $=Math.min(1,Math.max(0,d));C=$,b=$,x=true,cancelAnimationFrame(P),I($);},getProgress(){return C}}}var zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Vt(e,n={}){if(typeof window>"u")return zt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return be("scrollVideo: <video> element not found:",e),zt;let t=r,{trigger:i={},easing:o="linear",once:l=false,axis:u="y",preload:m="auto",onReady:p,onComplete:S,onProgress:k}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:Q[o]??Q.linear,we=ie(i.start??"top top"),H=ie(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let W=n.from??0,D=n.to,z=0,P=0,L=0,x=false,b=false,C=-1,R=0,w=false,g=false,U=()=>u==="x"?window.scrollX:window.scrollY,I=()=>u==="x"?window.innerWidth:window.innerHeight;function B(){let A=t.getBoundingClientRect(),V=u==="x"?A.left:A.top,pe=u==="x"?A.width:A.height,ne=he({top:V,height:pe},U(),I(),we,H);z=ne.tStart,P=ne.tEnd;}let X=NaN;function ae(A){if(!g)return;let V=D??t.duration??0,pe=W+(V-W)*A;pe!==X&&(X=pe,t.currentTime=pe),t.style.setProperty("--scroll-draw-progress",String(A)),k?.(A);}function le(){if(!x||b||!g||M)return;let A=re(J(U(),z,P,1));l&&(C=Math.max(C,A),A=C),R=A,ae(A),A>=1&&!w?(w=true,S?.()):A<1&&!l&&(w=false),L=requestAnimationFrame(le);}function d(){if(g=true,D===void 0&&(D=t.duration),M){ae(1),p?.();return}B(),p?.(),x&&!b&&(L=requestAnimationFrame(le));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),g||B();let $=new IntersectionObserver(A=>{A.forEach(V=>{x=V.isIntersecting,x&&!b&&g?L=requestAnimationFrame(le):cancelAnimationFrame(L);});}),y;function O(){clearTimeout(y),y=setTimeout(B,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),$.observe(t),Pe(t,{type:"video",getProgress:()=>R,getTrigger:()=>({tStart:z,tEnd:P})}),{destroy(){cancelAnimationFrame(L),$.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(y),Le(t);},replay(){C=-1,w=false,R=0,b=false,X=NaN,ae(0);},pause(){b=true,cancelAnimationFrame(L);},resume(){b&&(b=false,x&&g&&(L=requestAnimationFrame(le)));},seek(A){let V=Math.min(1,Math.max(0,A));R=V,C=V,b=true,cancelAnimationFrame(L),X=NaN,ae(V);},getProgress(){return R}}}function Wt(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 dr(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 _t(e){let n=Wt(e),r=new Map;for(let o of n){let l=o.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(o);}let t=[],i=Array.from(r.keys()).sort((o,l)=>o-l);for(let o of i){let l=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((m,p)=>{let S=m.nextElementSibling;u.appendChild(m),p<l.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((o,l)=>{e.appendChild(o),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function gr(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,l=o+(1-i);return l<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(l-o)))}function yr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var qt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Bt(e,n={}){if(typeof window>"u")return qt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return be("scrollText: element not found:",e),qt;let t=r,{split:i="words",stagger:o=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:S}=n,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof l=="function"?l:Q[l]??Q["ease-out"],re=ie(m.start??"top 85%"),we=ie(m.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let W;i==="chars"?W=dr(t):i==="lines"?W=_t(t):W=Wt(t);let D=W.length;function z(y,O){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*O));let A=yr(O,u);A&&(y.style.transform=A);}function P(y){t.style.setProperty("--scroll-draw-progress",String(y)),W.forEach((O,A)=>{let V=M(gr(y,A,D,o));z(O,V);});}if(k)return P(1),S?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P(0);let L=0,x=0,b=0,C=false,R=false,w=-1,g=0,U=false,I=()=>window.scrollY,B=()=>window.innerHeight;function X(){let y=t.getBoundingClientRect(),O=he({top:y.top,height:y.height},I(),B(),re,we);L=O.tStart,x=O.tEnd;}function ae(){if(!C||R)return;let y=J(I(),L,x,1);p&&(w=Math.max(w,y),y=w),g=y,P(y),y>=1&&!U?(U=true,S?.()):y<1&&!p&&(U=false),b=requestAnimationFrame(ae);}X();let le=new IntersectionObserver(y=>{y.forEach(O=>{C=O.isIntersecting,C&&!R?b=requestAnimationFrame(ae):cancelAnimationFrame(b);});}),d;function $(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let y=g;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),W=_t(t),P(y);}X();},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),le.observe(t),Pe(t,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:L,tEnd:x})}),{destroy(){cancelAnimationFrame(b),le.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Le(t);},replay(){w=-1,U=false,g=0,R=false,P(0);},pause(){R=true,cancelAnimationFrame(b);},resume(){R&&(R=false,C&&(b=requestAnimationFrame(ae)));},seek(y){let O=Math.min(1,Math.max(0,y));g=O,w=O,R=true,cancelAnimationFrame(b),P(O);},getProgress(){return g}}}function wr(e,n={}){let[r,t]=vr.useState(0),i=vr.useRef(n);i.current=n;let o=vr.useRef(-1);return vr.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let l=typeof e=="string"?document.querySelector(e):e.current;if(!l)return;let u=l,{axis:m="y",scrollContainer:p,trigger:S={}}=i.current,k=typeof p=="string"?document.querySelector(p):p??null,M=ie(S.start??"top bottom"),re=ie(S.end??"bottom top"),we=0,H=0,W=false,D=0;function z(){return k?m==="x"?k.scrollLeft:k.scrollTop:m==="x"?window.scrollX:window.scrollY}function P(){return k?m==="x"?k.clientWidth:k.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function L(){let w=u.getBoundingClientRect(),g=z(),U=m==="x"?w.left:w.top,I=m==="x"?w.width:w.height,B=he({top:U,height:I},g,P(),M,re);we=B.tStart,H=B.tEnd;}function x(){if(!W)return;let{speed:w=1,easing:g="linear",once:U=false}=i.current,I=typeof g=="function"?g:Q[g]??Q.linear,B=J(z(),we,H,w),X=I(B);U&&(o.current=Math.max(o.current,X),X=o.current),t(X),D=requestAnimationFrame(x);}let b=new IntersectionObserver(w=>{w.forEach(g=>{W=g.isIntersecting,W?D=requestAnimationFrame(x):cancelAnimationFrame(D);});},{root:k??null,threshold:0});L(),b.observe(u);let C;function R(){clearTimeout(C),C=setTimeout(L,150);}return window.addEventListener("resize",R),window.addEventListener("orientationchange",R),()=>{cancelAnimationFrame(D),clearTimeout(C),b.disconnect(),window.removeEventListener("resize",R),window.removeEventListener("orientationchange",R);}},[]),r}function Ue(e,n,r){let t=vr.useRef(n);t.current=n;let i=Rt(n);vr.useEffect(()=>{if(!e.current)return;let o=r(e.current,Ot(t.current,()=>t.current));return ()=>o.destroy()},[i]);}function Mn({children:e,className:n,style:r,...t}){let i=vr.useRef(null);return Ue(i,t,$t),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function Pn({children:e,className:n,style:r,...t}){let i=vr.useRef(null);return Ue(i,t,Dt),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function Ln({className:e,style:n,...r}){let t=vr.useRef(null);return Ue(t,r,Ht),jsxRuntime.jsx("span",{ref:t,className:e,style:n})}function Cn({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let l=vr.useRef(null);return Ue(l,o,Vt),jsxRuntime.jsx("video",{ref:l,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function $n({children:e,as:n="p",className:r,style:t,...i}){let o=vr.useRef(null);return Ue(o,i,Bt),vr__default.default.createElement(n,{ref:o,className:r,style:t},e)}exports.ScrollAnimate=Pn;exports.ScrollCounter=Ln;exports.ScrollDraw=Mn;exports.ScrollText=$n;exports.ScrollVideo=Cn;exports.useScrollDrawProgress=wr;
|
|
4
|
+
<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",i,{passive:true}),i(),{el:t,destroy(){window.removeEventListener("scroll",i),t.remove();}}}var Lt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ct=/[MmLlHhVvCcSsQqTtAaZz]/g;function ir(e,n,r){if(!je)return;let t=(e.match(Ct)??[]).join("").toUpperCase(),i=(n.match(Ct)??[]).join("").toUpperCase(),o=(e.match(Lt)??[]).length,l=(n.match(Lt)??[]).length;if(t!==i){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}o!==l&&ye(`morphTo: coordinate count differs (${o} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function lt(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let l=parseFloat(o),u=t[i++]??l;return String(+(l+(u-l)*r).toFixed(4))})}function $t(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...St[r],...t}:t,o=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:S={},stagger:k=0,direction:C="forward",once:te=false,debug:he=false,axis:H="y",scrollContainer:j,autoReverse:q=false,delay:W=0,strokeColor:P,strokeWidth:F,fillOpacity:L,waypoints:b,velocityScale:$=false,threshold:A=0,rootMargin:w="0px",repeat:y=0,repeatDelay:z=0,morphTo:T,clip:U,autoplay:ie=false,duration:le=1e3,native:ce=true,onProgress:d,onStart:M,onComplete:g,onEnter:I,onLeave:ue,onEnterBack:ae,onLeaveBack:R}=i,N=U===true?"left":typeof U=="string"?U:false,re=typeof p=="function"?p:K[p]??K.linear,Ee=se(S.start??"top bottom"),ze=se(S.end??"bottom top"),Se=typeof j=="string"?document.querySelector(j):j??null,Te=Array.isArray(P)?P[0]:null,me=Array.isArray(P)?P[1]:typeof P=="string"?P:null,fe=Array.isArray(F)?F[0]:null,J=Array.isArray(F)?F[1]:typeof F=="number"?F:null,ge=Array.isArray(L)?L[0]:null,ne=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function $e(s){let c=s*100;switch(N){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(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let B=N?[]:Array.from(e.querySelectorAll(l)),O=[],a=[],f=0,be=0,V=false,G=false,X=0,Me=false,xe=-1,oe=[],Fe=-1,Z=false,ke=0,Ie=0,Ne,nt=null;function ut(){nt?.destroy(),nt=null;}let De=new Set,mt=NaN,He=true,Xe=-1,ft=performance.now(),Ve=NaN;function ot(){return Se?H==="x"?Se.scrollLeft:Se.scrollTop:H==="x"?window.scrollX:window.scrollY}function pt(){return Se?H==="x"?Se.clientWidth:Se.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function dt(){let s=et(e,Se,H);return ve(s,s.scroll,pt(),Ee,ze)}function gt(){(({tStart:f,tEnd:be}=dt())),he&&je&&(ut(),nt=sr(f,be,H));}function st(s,c=dt){Le(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let E=s.destroy;return s.destroy=()=>{E.call(s),Ce(e);},s}function jt(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),N){let E=c==="reverse"?1-s:s;e.style.clipPath=$e(E);return}B.forEach((E,pe)=>{E.style.strokeDashoffset=c==="reverse"?`${O[pe]*s}`:`${O[pe]*(1-s)}`,m&&(E.style.opacity=c==="reverse"?`${1-s}`:`${s}`),Te&&me?E.style.stroke=qe(Te,me,s):me&&(E.style.stroke=me),fe!==null&&J!==null?E.style.strokeWidth=`${fe+(J-fe)*s}`:J!==null&&(E.style.strokeWidth=`${J}`),ge!==null&&ne!==null?E.style.fillOpacity=`${ge+(ne-ge)*s}`:ne!==null&&(E.style.fillOpacity=`${ne}`),T&&E.tagName.toLowerCase()==="path"&&a[pe]&&E.setAttribute("d",lt(a[pe],T,s));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),N){e.style.clipPath=$e(0);return}B.forEach((s,c)=>{s.style.strokeDasharray=`${O[c]}`,s.style.strokeDashoffset=C==="reverse"?"0":`${O[c]}`,m?s.style.opacity=C==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),fe!==null&&(s.style.strokeWidth=`${fe}`),ge!==null&&(s.style.fillOpacity=`${ge}`),T&&s.tagName.toLowerCase()==="path"&&a[c]&&s.setAttribute("d",a[c]);});}if(B.forEach(s=>{or(s);let c=_e(s);O.push(c);let E=s.tagName.toLowerCase()==="path";E?a.push(s.getAttribute("d")??""):a.push(""),T&&(E?ir(a[a.length-1],T,s):ye(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=C==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),me&&(s.style.stroke=me),J!==null&&(s.style.strokeWidth=`${J}`),ne!==null&&(s.style.fillOpacity=`${ne}`),T&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",T)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=C==="reverse"?"0":`${c}`,m?s.style.opacity=C==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),fe!==null&&(s.style.strokeWidth=`${fe}`),ge!==null&&(s.style.fillOpacity=`${ge}`));}),N){if(o)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let yt=typeof p=="string"?tt(p):null;function Ut(){return !(ce===false||!nr()||!B.length||!yt||N||H!=="y"||Se||u!==1||k!==0||te||q||$!==false||T||b||y||W>0||d||M||g||I||ue||ae||R||P!=null||F!=null||L!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Xt(){let s=++rr,c=`svg-scroll-draw-${s}`,E=`svg-scroll-draw-host-${s}`,pe=`--svg-scroll-draw-${s}`,Oe=C==="reverse"?"0":"var(--ssd-len)",Re=C==="reverse"?"var(--ssd-len)":"0",Pe=`stroke-dashoffset:${Oe};`,x=`stroke-dashoffset:${Re};`;m&&(Pe+=`opacity:${C==="reverse"?1:0};`,x+=`opacity:${C==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${Pe}}to{${x}}}.${E}{view-timeline-name:${pe};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${yt};animation-fill-mode:both;animation-timeline:${pe};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(E);function de(h,ee){h.style.setProperty("--ssd-len",String(O[ee])),h.style.strokeDasharray=`${O[ee]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}B.forEach(de);let v=false,_=-1;function Y(){if(_>=0)return _;let h=e.getBoundingClientRect(),{tStart:ee,tEnd:Ae}=ve({top:h.top,height:h.height},ot(),pt(),Ee,ze);return re(Q(ot(),ee,Ae,u))}return {destroy(){e.classList.remove(E),B.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){v=false,_=-1,B.forEach(de);},pause(){v=true,B.forEach(h=>{h.style.animationPlayState="paused";});},resume(){v&&(v=false,B.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let ee=Math.min(1,Math.max(0,h));_=ee,v=true,B.forEach((Ae,we)=>{Ae.classList.remove(c),Ae.style.strokeDashoffset=C==="reverse"?`${O[we]*ee}`:`${O[we]*(1-ee)}`,m&&(Ae.style.opacity=C==="reverse"?`${1-ee}`:`${ee}`);});},getProgress(){return Y()},refresh(){B.forEach((h,ee)=>{O[ee]=_e(h),h.style.setProperty("--ssd-len",String(O[ee])),h.style.strokeDasharray=`${O[ee]}`;});}}}if(Ut())return st(Xt());function Yt(){let s=Math.max(1,le),c=0,E=0,pe=false;function Oe(v){let _=true;if(N){let Y=Math.min(1,Math.max(0,v/s)),h=re(Y);ke=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=$e(C==="reverse"?1-h:h),d?.(h),Y<1&&(_=false);}else B.forEach((Y,h)=>{let ee=h*k*s,Ae=Math.min(1,Math.max(0,(v-ee)/s)),we=re(Ae);Y.style.strokeDashoffset=C==="reverse"?`${O[h]*we}`:`${O[h]*(1-we)}`,m&&(Y.style.opacity=C==="reverse"?`${1-we}`:`${we}`),Te&&me?Y.style.stroke=qe(Te,me,we):me&&(Y.style.stroke=me),fe!==null&&J!==null?Y.style.strokeWidth=`${fe+(J-fe)*we}`:J!==null&&(Y.style.strokeWidth=`${J}`),ge!==null&&ne!==null?Y.style.fillOpacity=`${ge+(ne-ge)*we}`:ne!==null&&(Y.style.fillOpacity=`${ne}`),T&&Y.tagName.toLowerCase()==="path"&&a[h]&&Y.setAttribute("d",lt(a[h],T,we)),h===0&&(ke=we,d?.(we),e.style.setProperty("--scroll-draw-progress",String(we))),Ae<1&&(_=false);});if(b){let Y=Math.min(1,Math.max(0,v/s)),h=re(Y);for(let ee in b){let Ae=parseFloat(ee);h>=Ae&&!De.has(Ae)&&(De.add(Ae),b[ee]?.());}}return _}function Re(v){if(Z)return;let _=v-c;G||(G=true,M?.());let Y=Oe(_);if(Y&&!V){V=true,Oe(s*(1+Math.max(0,B.length-1)*k)),g?.(),Ie<(y==="infinite"?1/0:y??0)&&(Ie++,Ne=setTimeout(()=>{c=performance.now(),G=false,V=false,De.clear(),Ye(),X=requestAnimationFrame(Re);},z));return}Y||(X=requestAnimationFrame(Re));}function Pe(){cancelAnimationFrame(X),clearTimeout(Ne),c=performance.now(),E=0,Z=false,G=false,V=false,Ie=0,pe=true,ke=0,De.clear(),Ye(),X=requestAnimationFrame(Re);}let x=new IntersectionObserver(v=>{v.forEach(_=>{_.isIntersecting&&!(te&&V)?Pe():!_.isIntersecting&&!te&&!V&&(cancelAnimationFrame(X),clearTimeout(Ne),pe=false);});},{root:Se??null,threshold:A,rootMargin:w}),D;function de(){clearTimeout(D),D=setTimeout(()=>{B.forEach((v,_)=>{O[_]=_e(v),v.style.strokeDasharray=`${O[_]}`;});},150);}return window.addEventListener("resize",de),window.addEventListener("orientationchange",de),W>0?setTimeout(()=>x.observe(e),W):x.observe(e),{destroy(){cancelAnimationFrame(X),clearTimeout(Ne),x.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),clearTimeout(D);},replay(){Ie=0,Pe();},pause(){Z||!pe||(Z=true,E=performance.now()-c,cancelAnimationFrame(X));},resume(){Z&&(Z=false,pe=true,c=performance.now()-E,X=requestAnimationFrame(Re));},seek(v){let _=Math.min(1,Math.max(0,v));ke=_,Z=true,E=_*s,c=performance.now()-E,cancelAnimationFrame(X),Oe(E);},getProgress(){return ke},refresh(){clearTimeout(D),B.forEach((v,_)=>{O[_]=_e(v),v.style.strokeDasharray=`${O[_]}`;});}}}if(ie)return st(Yt());gt();function Ke(){if(!Me||Z)return;let s=performance.now(),c=ot();if(!He&&$===false&&c===mt){X=requestAnimationFrame(Ke);return}He=false,mt=c;let E=u;if($!==false){let x=s-ft,D=x>0?Math.abs(c-(Xe<0?c:Xe))/x:0;E=u*Math.max(.2,1+D*(typeof $=="number"?$:1)*.04);}Xe=c,ft=s;let pe=q?Fe===-1||c>=Fe?"forward":"reverse":C;Fe=c;let Oe=be-f,Re=true,Pe=Oe===0?0:(c-f)/Oe;if(isNaN(Ve)||(Ve<=0&&Pe>0?I?.():Ve>0&&Pe<=0&&R?.(),Ve<1&&Pe>=1?ue?.():Ve>=1&&Pe<1&&ae?.()),Ve=Pe,N){let x=re(Q(c,f,be,E));te&&!q&&(xe=Math.max(xe,x),x=xe),ke=x,e.style.setProperty("--scroll-draw-progress",String(x));let D=pe==="reverse"?1-x:x;e.style.clipPath=$e(D),d?.(x),!G&&Q(c,f,be,E)>0&&(G=true,M?.()),x>=1&&!V?(V=true,g?.(),Ie<(y==="infinite"?1/0:y??0)&&(Ie++,Ne=setTimeout(()=>{xe=-1,G=false,V=false,e.style.clipPath=$e(0);},z))):x<1&&!te&&(V=false),X=requestAnimationFrame(Ke);return}if(B.forEach((x,D)=>{let de=D*k*Oe,v=re(Q(c,f+de,be+de,E));te&&!q&&(v=oe[D]=Math.max(oe[D]??xe,v)),ke=v,x.style.strokeDashoffset=pe==="reverse"?`${O[D]*v}`:`${O[D]*(1-v)}`,m&&(x.style.opacity=pe==="reverse"?`${1-v}`:`${v}`),Te&&me?x.style.stroke=qe(Te,me,v):me&&(x.style.stroke=me),fe!==null&&J!==null?x.style.strokeWidth=`${fe+(J-fe)*v}`:J!==null&&(x.style.strokeWidth=`${J}`),ge!==null&&ne!==null?x.style.fillOpacity=`${ge+(ne-ge)*v}`:ne!==null&&(x.style.fillOpacity=`${ne}`),T&&x.tagName.toLowerCase()==="path"&&a[D]&&x.setAttribute("d",lt(a[D],T,v)),D===0&&(d?.(v),e.style.setProperty("--scroll-draw-progress",String(v))),v<1&&(Re=false);}),b){let x=re(Q(c,f,be,E));for(let D in b){let de=parseFloat(D);x>=de&&!De.has(de)&&(De.add(de),b[D]?.());}}!G&&Q(c,f,be,E)>0&&(G=true,M?.()),Re&&!V?(V=true,g?.(),Ie<(y==="infinite"?1/0:y??0)&&(Ie++,Ne=setTimeout(()=>{xe=-1,oe=[],G=false,V=false,De.clear(),Ye(),He=true;},z))):!Re&&!te&&(V=false),X=requestAnimationFrame(Ke);}let it=false;function Qe(){it||(it=true,X=requestAnimationFrame(function(){Ke();}));}function Je(){it=false,cancelAnimationFrame(X);}let at=new IntersectionObserver(s=>{s.forEach(c=>{Me=c.isIntersecting,Me&&!Z?(He=true,Qe()):Je();});},{root:Se??null,threshold:A,rootMargin:w});function ht(){B.forEach((s,c)=>{O[c]=_e(s),s.style.strokeDasharray=`${O[c]}`;}),gt(),He=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(ht,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),W>0?setTimeout(()=>at.observe(e),W):at.observe(e),st({destroy(){cancelAnimationFrame(X),clearTimeout(Ne),Je(),at.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),ut();},replay(){xe=-1,oe=[],Fe=-1,Xe=-1,G=false,V=false,Ie=0,Z=false,ke=0,De.clear(),clearTimeout(Ne),Ye(),He=true,Me&&Qe();},pause(){Z=true,Je();},resume(){Z&&(Z=false,He=true,Me&&Qe());},seek(s){let c=Math.min(1,Math.max(0,s));ke=c,xe=c,oe=[],Z=true,Je(),jt(c,C),He=true;},getProgress(){return ke},refresh(){clearTimeout(Ze),ht(),Me&&!Z&&Qe();}},()=>({tStart:f,tEnd:be}))}var kt=new WeakMap,ar=0;function Rt(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=kt.get(r);return t===void 0&&kt.set(r,t=++ar),`el#${t}`}return r})}function It(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...i)=>n()[t]?.(...i));return r}function lr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ot(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function cr(e,n,r){let t=Ot(e),i=Ot(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,l)=>{let u=i[l];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function Ft(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(lr(t))return qe(t,i,r);if(t.includes("("))return cr(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),l=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&l){let u=parseFloat(o[1]),m=parseFloat(l[1]);return `${u+(m-u)*r}${o[2]||l[2]}`}return r<1?t:i}function ur(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),fr=0,Nt="--scroll-draw-progress";function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Dt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:p,native:S=true,velocityScale:k=false,respectReducedMotion:C=true,triggerElement:te,onProgress:he,onComplete:H,onEnter:j,onLeave:q,onEnterBack:W,onLeaveBack:P}=n,F=C&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof o=="function"?o:K[o]??K["ease-out"],b=se(i.start??"top bottom"),$=se(i.end??"bottom top"),A=te??e,w=typeof p=="string"?document.querySelector(p):p??null,y=Object.entries(t).map(([a,f])=>({prop:ur(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function z(){let a=window.getComputedStyle(e);for(let f of y)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function T(){for(let a of y)e.style.setProperty(a.prop,String(a.to));}let U=new Map;for(let a of [...y.map(f=>f.prop),Nt])U.set(a,e.style.getPropertyValue(a));function ie(){for(let[a,f]of U)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(F)return T(),H?.(),{...r,destroy:ie,getProgress:()=>1};z();let le=typeof o=="string"?tt(o):null;function ce(){if(!S||!pr()||!le||m!=="y"||w||A!==e||u||l!==1||he||H||j||q||W||P||k!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let a of y)if(!mr.has(a.prop))return false;return true}function d(){let a=`ssd-a-${++fr}`,f=y.map(oe=>`${oe.prop}:${oe.from}`).join(";"),be=y.map(oe=>`${oe.prop}:${oe.to}`).join(";"),V=document.createElement("style");V.setAttribute("data-ssd-animate",""),V.textContent=`@keyframes ${a}{from{${f}}to{${be}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${le};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(V),e.classList.add(a);let G=()=>m==="x"?window.scrollX:window.scrollY,X=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let oe=e.getBoundingClientRect();return ve({top:oe.top,height:oe.height},G(),X(),b,$)};Le(e,{type:"animate",getProgress:()=>xe.getProgress(),getTrigger:Me});let xe={destroy(){e.classList.remove(a),V.remove(),e.style.animationPlayState="",ie(),Ce(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(oe){let Fe=Math.min(1,Math.max(0,oe));e.classList.remove(a);for(let Z of y)e.style.setProperty(Z.prop,Ft(Z.from,Z.to,Fe));},getProgress(){let{tStart:oe,tEnd:Fe}=Me();return L(Q(G(),oe,Fe,l))}};return xe}if(ce())return d();let M=0,g=0,I=0,ue=false,ae=false,R=-1,N=0,re=false,Ee=NaN,ze=-1,Se=0,Te=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,me=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function fe(){let a=et(A,w,m),f=ve(a,a.scroll,me(),b,$);M=f.tStart,g=f.tEnd;}function J(a){e.style.setProperty(Nt,String(a));for(let f of y)e.style.setProperty(f.prop,Ft(f.from,f.to,a));he?.(a);}function ge(a){if(isNaN(Ee)){Ee=a;return}Ee<=0&&a>0?j?.():Ee>0&&a<=0&&P?.(),Ee<1&&a>=1?q?.():Ee>=1&&a<1&&W?.(),Ee=a;}function ne(){if(!ue||ae)return;let a=performance.now(),f=Te(),be=l;if(k!==false){let X=a-Se,Me=X>0?Math.abs(f-(ze<0?f:ze))/X:0;be=l*Math.max(.2,1+Me*(typeof k=="number"?k:1)*.04);}ze=f,Se=a;let V=g===M?0:(f-M)/(g-M);ge(V);let G=L(Q(f,M,g,be));u&&(R=Math.max(R,G),G=R),N=G,J(G),G>=1&&!re?(re=true,H?.()):G<1&&!u&&(re=false),I=requestAnimationFrame(ne);}fe(),g===M&&ye("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let a=L(Q(Te(),M,g,l));u&&a>0&&(R=a),N=a,J(a);}let $e=new IntersectionObserver(a=>{a.forEach(f=>{ue=f.isIntersecting,ue&&!ae?I=requestAnimationFrame(ne):cancelAnimationFrame(I);});},{root:w??null}),B;function O(){clearTimeout(B),B=setTimeout(fe,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),$e.observe(e),Le(e,{type:"animate",getProgress:()=>N,getTrigger:()=>({tStart:M,tEnd:g})}),{destroy(){cancelAnimationFrame(I),$e.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(B),ie(),Ce(e);},replay(){R=-1,re=false,N=0,ae=false,J(0);},pause(){ae=true,cancelAnimationFrame(I);},resume(){ae&&(ae=false,ue&&(I=requestAnimationFrame(ne)));},seek(a){let f=Math.min(1,Math.max(0,a));N=f,R=f,ae=true,cancelAnimationFrame(I),J(f);},getProgress(){return N}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ht(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollCounter: element not found:",e),ct;let t=r,{from:i=0,to:o,format:l,easing:u="ease-out",trigger:m={},once:p=true,decimals:S,onComplete:k}=n,C=S!==void 0?d=>d.toFixed(S):l??(d=>String(Math.round(d))),te=typeof u=="function"?u:K[u]??K["ease-out"],he=se(m.start??"top 80%"),H=se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=C(o),k?.(),ct;let q=0,W=0,P=0,F=false,L=false,b=-1,$=0,A=false,w=()=>window.scrollY,y=()=>window.innerHeight;function z(){let d=t.getBoundingClientRect(),M=ve({top:d.top,height:d.height},w(),y(),he,H);q=M.tStart,W=M.tEnd;}function T(d){t.textContent=C(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function U(){if(!F||L)return;let d=te(Q(w(),q,W,1));p&&(b=Math.max(b,d),d=b),$=d,T(d),d>=1&&!A?(A=true,k?.()):d<1&&!p&&(A=false),P=requestAnimationFrame(U);}z();{let d=te(Q(w(),q,W,1));p&&d>0&&(b=d),$=d,T(d);}let ie=new IntersectionObserver(d=>{d.forEach(M=>{F=M.isIntersecting,F&&!L?P=requestAnimationFrame(U):cancelAnimationFrame(P);});}),le;function ce(){clearTimeout(le),le=setTimeout(z,150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),ie.observe(t),Le(t,{type:"counter",getProgress:()=>$,getTrigger:()=>({tStart:q,tEnd:W})}),{destroy(){cancelAnimationFrame(P),ie.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(le),Ce(t);},replay(){b=-1,A=false,$=0,L=false,T(0);},pause(){L=true,cancelAnimationFrame(P);},resume(){L&&(L=false,F&&(P=requestAnimationFrame(U)));},seek(d){let M=Math.min(1,Math.max(0,d));$=M,b=M,L=true,cancelAnimationFrame(P),T(M);},getProgress(){return $}}}var zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Vt(e,n={}){if(typeof window>"u")return zt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),zt;let t=r,{trigger:i={},easing:o="linear",once:l=false,axis:u="y",preload:m="auto",triggerElement:p,onReady:S,onComplete:k,onProgress:C}=n,te=p??t,he=window.matchMedia("(prefers-reduced-motion: reduce)").matches,H=typeof o=="function"?o:K[o]??K.linear,j=se(i.start??"top top"),q=se(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let W=n.from??0,P=n.to,F=0,L=0,b=0,$=false,A=false,w=-1,y=0,z=false,T=false,U=()=>u==="x"?window.scrollX:window.scrollY,ie=()=>u==="x"?window.innerWidth:window.innerHeight;function le(){let R=te.getBoundingClientRect(),N=u==="x"?R.left:R.top,re=u==="x"?R.width:R.height,Ee=ve({top:N,height:re},U(),ie(),j,q);F=Ee.tStart,L=Ee.tEnd,T&&L===F&&ye("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let ce=NaN;function d(R){if(!T)return;let N=P??t.duration??0,re=W+(N-W)*R;re!==ce&&(ce=re,t.currentTime=re),t.style.setProperty("--scroll-draw-progress",String(R)),C?.(R);}function M(){if(!$||A||!T||he)return;let R=H(Q(U(),F,L,1));l&&(w=Math.max(w,R),R=w),y=R,d(R),R>=1&&!z?(z=true,k?.()):R<1&&!l&&(z=false),b=requestAnimationFrame(M);}function g(){if(T=true,P===void 0&&(P=t.duration),he){d(1),S?.();return}le(),S?.(),$&&!A&&(b=requestAnimationFrame(M));}t.readyState>=1?g():t.addEventListener("loadedmetadata",g,{once:true}),T||le();let I=new IntersectionObserver(R=>{R.forEach(N=>{$=N.isIntersecting,$&&!A&&T?b=requestAnimationFrame(M):cancelAnimationFrame(b);});}),ue;function ae(){clearTimeout(ue),ue=setTimeout(le,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),I.observe(t),Le(t,{type:"video",getProgress:()=>y,getTrigger:()=>({tStart:F,tEnd:L})}),{destroy(){cancelAnimationFrame(b),I.disconnect(),t.removeEventListener("loadedmetadata",g),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ue),Ce(t);},replay(){w=-1,z=false,y=0,A=false,ce=NaN,d(0);},pause(){A=true,cancelAnimationFrame(b);},resume(){A&&(A=false,$&&T&&(b=requestAnimationFrame(M)));},seek(R){let N=Math.min(1,Math.max(0,R));y=N,w=N,A=true,cancelAnimationFrame(b),ce=NaN,d(N);},getProgress(){return y}}}function Wt(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 dr(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 _t(e){let n=Wt(e),r=new Map;for(let o of n){let l=o.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(o);}let t=[],i=Array.from(r.keys()).sort((o,l)=>o-l);for(let o of i){let l=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((m,p)=>{let S=m.nextElementSibling;u.appendChild(m),p<l.length-1&&S&&S.style.whiteSpace==="pre"&&u.appendChild(S);}),t.push(u);}return e.textContent="",t.forEach((o,l)=>{e.appendChild(o),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function gr(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,l=o+(1-i);return l<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(l-o)))}function yr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var qt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Bt(e,n={}){if(typeof window>"u")return qt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollText: element not found:",e),qt;let t=r,{split:i="words",stagger:o=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:S}=n,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,C=typeof l=="function"?l:K[l]??K["ease-out"],te=se(m.start??"top 85%"),he=se(m.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let j;i==="chars"?j=dr(t):i==="lines"?j=_t(t):j=Wt(t);let q=j.length;function W(g,I){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*I));let ue=yr(I,u);ue&&(g.style.transform=ue);}function P(g){t.style.setProperty("--scroll-draw-progress",String(g)),j.forEach((I,ue)=>{let ae=C(gr(g,ue,q,o));W(I,ae);});}if(k)return P(1),S?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P(0);let F=0,L=0,b=0,$=false,A=false,w=-1,y=0,z=false,T=()=>window.scrollY,U=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),I=ve({top:g.top,height:g.height},T(),U(),te,he);F=I.tStart,L=I.tEnd;}function le(){if(!$||A)return;let g=Q(T(),F,L,1);p&&(w=Math.max(w,g),g=w),y=g,P(g),g>=1&&!z?(z=true,S?.()):g<1&&!p&&(z=false),b=requestAnimationFrame(le);}ie();let ce=new IntersectionObserver(g=>{g.forEach(I=>{$=I.isIntersecting,$&&!A?b=requestAnimationFrame(le):cancelAnimationFrame(b);});}),d;function M(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let g=y;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),j=_t(t),P(g);}ie();},150);}return window.addEventListener("resize",M),window.addEventListener("orientationchange",M),ce.observe(t),Le(t,{type:"text",getProgress:()=>y,getTrigger:()=>({tStart:F,tEnd:L})}),{destroy(){cancelAnimationFrame(b),ce.disconnect(),window.removeEventListener("resize",M),window.removeEventListener("orientationchange",M),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ce(t);},replay(){w=-1,z=false,y=0,A=false,P(0);},pause(){A=true,cancelAnimationFrame(b);},resume(){A&&(A=false,$&&(b=requestAnimationFrame(le)));},seek(g){let I=Math.min(1,Math.max(0,g));y=I,w=I,A=true,cancelAnimationFrame(b),P(I);},getProgress(){return y}}}function wr(e,n={}){let[r,t]=vr.useState(0),i=vr.useRef(n);i.current=n;let o=vr.useRef(-1);return vr.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let l=typeof e=="string"?document.querySelector(e):e.current;if(!l)return;let u=l,{axis:m="y",scrollContainer:p,trigger:S={}}=i.current,k=typeof p=="string"?document.querySelector(p):p??null,C=se(S.start??"top bottom"),te=se(S.end??"bottom top"),he=0,H=0,j=false,q=0;function W(){return k?m==="x"?k.scrollLeft:k.scrollTop:m==="x"?window.scrollX:window.scrollY}function P(){return k?m==="x"?k.clientWidth:k.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function F(){let w=u.getBoundingClientRect(),y=W(),z=m==="x"?w.left:w.top,T=m==="x"?w.width:w.height,U=ve({top:z,height:T},y,P(),C,te);he=U.tStart,H=U.tEnd;}function L(){if(!j)return;let{speed:w=1,easing:y="linear",once:z=false}=i.current,T=typeof y=="function"?y:K[y]??K.linear,U=Q(W(),he,H,w),ie=T(U);z&&(o.current=Math.max(o.current,ie),ie=o.current),t(ie),q=requestAnimationFrame(L);}let b=new IntersectionObserver(w=>{w.forEach(y=>{j=y.isIntersecting,j?q=requestAnimationFrame(L):cancelAnimationFrame(q);});},{root:k??null,threshold:0});F(),b.observe(u);let $;function A(){clearTimeout($),$=setTimeout(F,150);}return window.addEventListener("resize",A),window.addEventListener("orientationchange",A),()=>{cancelAnimationFrame(q),clearTimeout($),b.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A);}},[]),r}function Ue(e,n,r){let t=vr.useRef(n);t.current=n;let i=Rt(n);vr.useEffect(()=>{if(!e.current)return;let o=r(e.current,It(t.current,()=>t.current));return ()=>o.destroy()},[i]);}function Mn({children:e,className:n,style:r,...t}){let i=vr.useRef(null);return Ue(i,t,$t),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function Pn({children:e,className:n,style:r,...t}){let i=vr.useRef(null);return Ue(i,t,Dt),jsxRuntime.jsx("div",{ref:i,className:n,style:r,children:e})}function Ln({className:e,style:n,...r}){let t=vr.useRef(null);return Ue(t,r,Ht),jsxRuntime.jsx("span",{ref:t,className:e,style:n})}function Cn({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let l=vr.useRef(null);return Ue(l,o,Vt),jsxRuntime.jsx("video",{ref:l,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function $n({children:e,as:n="p",className:r,style:t,...i}){let o=vr.useRef(null);return Ue(o,i,Bt),vr__default.default.createElement(n,{ref:o,className:r,style:t},e)}exports.ScrollAnimate=Pn;exports.ScrollCounter=Ln;exports.ScrollDraw=Mn;exports.ScrollText=$n;exports.ScrollVideo=Cn;exports.useScrollDrawProgress=wr;
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {a as a$1,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$4}from'../chunk-
|
|
2
|
+
import {a as a$1,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$4}from'../chunk-TIRZOSQ4.mjs';import {a as a$5}from'../chunk-SNCRC6BA.mjs';import {a as a$3}from'../chunk-4MH5SQTH.mjs';import {a as a$2}from'../chunk-QJ4H2HW3.mjs';import {b as b$2}from'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import {a,c,b}from'../chunk-PEFR3ZB7.mjs';import {d}from'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';import Y,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function K(r,t={}){let[n,e]=useState(0),o=useRef(t);o.current=t;let s=useRef(-1);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){e(1);return}let u=typeof r=="string"?document.querySelector(r):r.current;if(!u)return;let b$1=u,{axis:a$1="y",scrollContainer:y,trigger:h={}}=o.current,l=typeof y=="string"?document.querySelector(y):y??null,W=a(h.start??"top bottom"),X=a(h.end??"bottom top"),O=0,C=0,w=false,f=0;function N(){return l?a$1==="x"?l.scrollLeft:l.scrollTop:a$1==="x"?window.scrollX:window.scrollY}function B(){return l?a$1==="x"?l.clientWidth:l.clientHeight:a$1==="x"?window.innerWidth:window.innerHeight}function D(){let i=b$1.getBoundingClientRect(),c$1=N(),v=a$1==="x"?i.left:i.top,x=a$1==="x"?i.width:i.height,g=c({top:v,height:x},c$1,B(),W,X);O=g.tStart,C=g.tEnd;}function A(){if(!w)return;let{speed:i=1,easing:c="linear",once:v=false}=o.current,x=typeof c=="function"?c:d[c]??d.linear,g=b(N(),O,C,i),P=x(g);v&&(s.current=Math.max(s.current,P),P=s.current),e(P),f=requestAnimationFrame(A);}let L=new IntersectionObserver(i=>{i.forEach(c=>{w=c.isIntersecting,w?f=requestAnimationFrame(A):cancelAnimationFrame(f);});},{root:l??null,threshold:0});D(),L.observe(b$1);let E;function d$1(){clearTimeout(E),E=setTimeout(D,150);}return window.addEventListener("resize",d$1),window.addEventListener("orientationchange",d$1),()=>{cancelAnimationFrame(f),clearTimeout(E),L.disconnect(),window.removeEventListener("resize",d$1),window.removeEventListener("orientationchange",d$1);}},[]),n}function p(r,t,n){let e=useRef(t);e.current=t;let o=a$1(t);useEffect(()=>{if(!r.current)return;let s=n(r.current,b$1(e.current,()=>e.current));return ()=>s.destroy()},[o]);}function ce({children:r,className:t,style:n,...e}){let o=useRef(null);return p(o,e,b$2),jsx("div",{ref:o,className:t,style:n,children:r})}function ae({children:r,className:t,style:n,...e}){let o=useRef(null);return p(o,e,a$2),jsx("div",{ref:o,className:t,style:n,children:r})}function me({className:r,style:t,...n}){let e=useRef(null);return p(e,n,a$3),jsx("span",{ref:e,className:r,style:t})}function ue({src:r,className:t,style:n,muted:e=true,playsInline:o=true,...s}){let u=useRef(null);return p(u,s,a$4),jsx("video",{ref:u,src:r,className:t,style:n,muted:e,playsInline:o,preload:"auto"})}function pe({children:r,as:t="p",className:n,style:e,...o}){let s=useRef(null);return p(s,o,a$5),Y.createElement(t,{ref:s,className:n,style:e},r)}export{ae as ScrollAnimate,me as ScrollCounter,ce as ScrollDraw,pe as ScrollText,ue as ScrollVideo,K as useScrollDrawProgress};
|
package/dist/solid/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var solidJs=require('solid-js');function Ut({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,l=[];for(let
|
|
1
|
+
'use strict';var solidJs=require('solid-js');function Ut({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,l=[];for(let d=0;d<r;d++){let S=Math.pow(a,d);l.push(S),s+=S;}let u=[0],m=0;for(let d=0;d<r;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<r;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: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:Ut(),elastic:Yt()};function Et(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 St(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 Tt(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:Et((e-n)/(r-n)*t,0,1)}function xe(e,n,r,t,a){let s=St(e.top,e.height,n,t.element)-Tt(t.viewport,r),l=St(e.top,e.height,n,a.element)-Tt(a.viewport,r);return {tStart:s,tEnd:l}}function Je(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 qe(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function xt(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=xt(e),a=xt(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 At={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ge(e,...n){je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Xt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Kt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function Qt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Zt(e){let n=[];for(let r=0;r<Mt;r++){let t=r/(Mt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Xt;case "ease-out":return Kt;case "ease-in-out":return Qt()?Zt(te["ease-in-out"]):null;default:return null}}var Lt=Symbol.for("svg-scroll-draw.registry");function $t(){let e=globalThis;return e[Lt]||(e[Lt]=new Map)}function $e(e,n){$t().set(e,n);}function Ce(e){$t().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 Ct(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Pt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function tr(e){if(!je)return;let n=Ct(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&&!Pt.has(r)&&!Pt.has(Ct(e,"fill"))&&ge("Element has a fill \u2014 it may obscure the stroke animation.",e);}function rr(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,l=e-s,u=n-s,m=r==="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,kt=/[MmLlHhVvCcSsQqTtAaZz]/g;function nr(e,n,r){if(!je)return;let t=(e.match(kt)??[]).join("").toUpperCase(),a=(n.match(kt)??[]).join("").toUpperCase(),s=(e.match(Ot)??[]).length,l=(n.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.`,r);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.`,r);}function it(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 l=parseFloat(s),u=t[a++]??l;return String(+(l+(u-l)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,a=r?{...At[r],...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:k=false,threshold:F=0,rootMargin:P="0px",repeat:E=0,repeatDelay:oe=0,morphTo:D,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"),ze=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)),O=[],i=[],f=0,ge=0,H=false,_=false,q=0,xe=false,Ee=-1,Z=[],Re=-1,U=false,Oe=0,Fe=0,He,tt=null;function pt(){tt?.destroy(),tt=null;}let Ne=new Set,dt=NaN,Ve=true,Ue=-1,gt=performance.now(),_e=NaN;function rt(){return be?B==="x"?be.scrollLeft:be.scrollTop:B==="x"?window.scrollX:window.scrollY}function yt(){return be?B==="x"?be.clientWidth:be.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ht(){let o=Je(e,be,B);return Te(o,o.scroll,yt(),Ce,ze)}function bt(){(({tStart:f,tEnd:ge}=ht())),$e&&je&&(pt(),tt=rr(f,ge,B));}function nt(o,c=ht){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"?`${O[ue]*o}`:`${O[ue]*(1-o)}`,m&&(b.style.opacity=c==="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}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],D,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=`${O[c]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${O[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}`),D&&o.tagName.toLowerCase()==="path"&&i[c]&&o.setAttribute("d",i[c]);});}if(z.forEach(o=>{tr(o);let c=qe(o);O.push(c);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?nr(i[i.length-1],D,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}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(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 wt=typeof p=="string"?et(p):null;function Bt(){return !(ae===false||!er()||!z.length||!wt||K||B!=="y"||be||u!==1||V!==0||ne||X||k!==false||D||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)",ke=A==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${ke};`;m&&(Ae+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.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:${wt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),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(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(),yt(),Ce,ze);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="";}),I.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"?`${O[ye]*Y}`:`${O[ye]*(1-Y)}`,m&&(Se.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return W()},refresh(){z.forEach((y,Y)=>{O[Y]=qe(y),y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[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);Oe=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"?`${O[y]*ye}`:`${O[y]*(1-ye)}`,m&&(W.style.opacity=A==="reverse"?`${1-ye}`:`${ye}`),we&&le?W.style.stroke=We(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}`),D&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],D,ye)),y===0&&(Oe=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&&!Ne.has(Se)&&(Ne.add(Se),w[Y]?.());}}return N}function ke(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?.(),Fe<(E==="infinite"?1/0:E??0)&&(Fe++,He=setTimeout(()=>{c=performance.now(),_=false,H=false,Ne.clear(),Ye(),q=requestAnimationFrame(ke);},oe));return}W||(q=requestAnimationFrame(ke));}function Ae(){cancelAnimationFrame(q),clearTimeout(He),c=performance.now(),b=0,U=false,_=false,H=false,Fe=0,ue=true,Oe=0,Ne.clear(),Ye(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&H)?Ae():!N.isIntersecting&&!ne&&!H&&(cancelAnimationFrame(q),clearTimeout(He),ue=false);});},{root:be??null,threshold:F,rootMargin:P}),I;function me(){clearTimeout(I),I=setTimeout(()=>{z.forEach((h,N)=>{O[N]=qe(h),h.style.strokeDasharray=`${O[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(He),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(I);},replay(){Fe=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(ke));},seek(h){let N=Math.min(1,Math.max(0,h));Oe=N,U=true,b=N*o,c=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return Oe},refresh(){clearTimeout(I),z.forEach((h,N)=>{O[N]=qe(h),h.style.strokeDasharray=`${O[N]}`;});}}}if(ie)return nt(jt());bt();function Xe(){if(!xe||U)return;let o=performance.now(),c=rt();if(!Ve&&k===false&&c===dt){q=requestAnimationFrame(Xe);return}Ve=false,dt=c;let b=u;if(k!==false){let v=o-gt,I=v>0?Math.abs(c-(Ue<0?c:Ue))/v:0;b=u*Math.max(.2,1+I*(typeof k=="number"?k:1)*.04);}Ue=c,gt=o;let ue=X?Re===-1||c>=Re?"forward":"reverse":A;Re=c;let De=ge-f,ke=true,Ae=De===0?0:(c-f)/De;if(isNaN(_e)||(_e<=0&&Ae>0?$?.():_e>0&&Ae<=0&&fe?.(),_e<1&&Ae>=1?S?.():_e>=1&&Ae<1&&R?.()),_e=Ae,K){let v=ve(J(c,f,ge,b));ne&&!X&&(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),d?.(v),!_&&J(c,f,ge,b)>0&&(_=true,x?.()),v>=1&&!H?(H=true,g?.(),Fe<(E==="infinite"?1/0:E??0)&&(Fe++,He=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,I)=>{let me=I*V*De,h=ve(J(c,f+me,ge+me,b));ne&&!X&&(h=Z[I]=Math.max(Z[I]??Ee,h)),Oe=h,v.style.strokeDashoffset=ue==="reverse"?`${O[I]*h}`:`${O[I]*(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}`),D&&v.tagName.toLowerCase()==="path"&&i[I]&&v.setAttribute("d",it(i[I],D,h)),I===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=ve(J(c,f,ge,b));for(let I in w){let me=parseFloat(I);v>=me&&!Ne.has(me)&&(Ne.add(me),w[I]?.());}}!_&&J(c,f,ge,b)>0&&(_=true,x?.()),ke&&!H?(H=true,g?.(),Fe<(E==="infinite"?1/0:E??0)&&(Fe++,He=setTimeout(()=>{Ee=-1,Z=[],_=false,H=false,Ne.clear(),Ye(),Ve=true;},oe))):!ke&&!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?(Ve=true,Ke()):Qe();});},{root:be??null,threshold:F,rootMargin:P});function vt(){z.forEach((o,c)=>{O[c]=qe(o),o.style.strokeDasharray=`${O[c]}`;}),bt(),Ve=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(vt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),G>0?setTimeout(()=>st.observe(e),G):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(He),Qe(),st.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),pt();},replay(){Ee=-1,Z=[],Re=-1,Ue=-1,_=false,H=false,Fe=0,U=false,Oe=0,Ne.clear(),clearTimeout(He),Ye(),Ve=true,xe&&Ke();},pause(){U=true,Qe();},resume(){U&&(U=false,Ve=true,xe&&Ke());},seek(o){let c=Math.min(1,Math.max(0,o));Oe=c,Ee=c,Z=[],U=true,Qe(),Wt(c,A),Ve=true;},getProgress(){return Oe},refresh(){clearTimeout(Ze),vt(),xe&&!U&&Ke();}},()=>({tStart:f,tEnd:ge}))}var It=new WeakMap,or=0;function Ft(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=It.get(r);return t===void 0&&It.set(r,t=++or),`el#${t}`}return r})}function Dt(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 sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Rt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.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]:"");}n.push({fn:t[1],nums:a,units:s});}return n}function ir(e,n,r){let t=Rt(e),a=Rt(n);return t.length===0||t.length!==a.length?r<1?e:n:t.map((s,l)=>{let u=a[l];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 Ht(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),a=String(n);if(sr(t))return We(t,a,r);if(t.includes("("))return ir(t,a,r);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)*r}${s[2]||l[2]}`}return r<1?t:a}function ar(e){return e.replace(/([A-Z])/g,n=>`-${n.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 lt(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: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}=n,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"),k=de(a.end??"bottom top"),F=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 D(){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 D(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let te=typeof s=="string"?et(s):null;function ae(){if(!T||!ur()||!te||m!=="y"||P||F!==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,k)};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 Re=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,Re));},getProgress(){let{tStart:Z,tEnd:Re}=xe();return L(J(_(),Z,Re,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,ze=-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(F,P,m),f=Te(i,i.scroll,le(),w,k);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-(ze<0?f:ze))/q:0;ge=l*Math.max(.2,1+xe*(typeof V=="number"?V:1)*.04);}ze=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 O(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),Pe.observe(e),Me(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),Pe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),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 ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollCounter: element not found:",e),ct;let t=r,{from:a=0,to:s,format:l,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,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?.(),ct;let X=0,G=0,M=0,C=false,L=false,w=-1,k=0,F=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 D(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),k=d,D(d),d>=1&&!F?(F=true,V?.()):d<1&&!p&&(F=false),M=requestAnimationFrame(se);}oe();{let d=ne(J(P(),X,G,1));p&&d>0&&(w=d),k=d,D(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:()=>k,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,F=false,k=0,L=false,D(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));k=x,w=x,L=true,cancelAnimationFrame(M),D(x);},getProgress(){return k}}}var Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return Vt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Vt;let t=r,{trigger:a={},easing:s="linear",once:l=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,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=n.from??0,X=n.to,G=0,M=0,C=0,L=false,w=false,k=-1,F=0,P=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>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(),D(),$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&&(k=Math.max(k,S),S=k),F=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:()=>F,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(){k=-1,P=false,F=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));F=R,k=R,w=true,cancelAnimationFrame(C),ie=NaN,te(R);},getProgress(){return F}}}function qt(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 mr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function zt(e){let n=qt(e),r=new Map;for(let s of n){let l=s.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(s);}let t=[],a=Array.from(r.keys()).sort((s,l)=>s-l);for(let s of a){let l=r.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,n,r,t){if(r<=1||t===0)return e;let a=(r-1)*t,s=n*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,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 _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,n={}){if(typeof window>"u")return _t;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollText: element not found:",e),_t;let t=r,{split:a="words",stagger:s=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,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,k=false,F=false,P=-1,E=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=Te({top:g.top,height:g.height},D(),se(),ne,$e);C=$.tStart,L=$.tEnd;}function te(){if(!k||F)return;let g=J(D(),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($=>{k=$.isIntersecting,k&&!F?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,F=false,M(0);},pause(){F=true,cancelAnimationFrame(w);},resume(){F&&(F=false,k&&(w=requestAnimationFrame(te)));},seek(g){let $=Math.min(1,Math.max(0,g));E=$,P=$,F=true,cancelAnimationFrame(w),M($);},getProgress(){return E}}}function Ie(e,n){let r,t,a,s;return solidJs.createEffect(()=>{s=typeof e=="function"?e():e;let l=Ft(s);!r||l===a||(a=l,solidJs.untrack(()=>{t?.destroy(),t=n(r,Dt(s,()=>s));}));}),solidJs.onCleanup(()=>{t?.destroy(),t=a=void 0;}),{ref:l=>{r=l;},getInstance:()=>t}}function hn(e={}){return Ie(e,at).ref}function bn(e={}){return Ie(e,at)}function wn(e){return Ie(e,lt).ref}function vn(e){return Ie(e,lt)}function En(e){return Ie(e,ut).ref}function Sn(e){return Ie(e,ut)}function Tn(e={}){return Ie(e,mt).ref}function xn(e={}){return Ie(e,mt)}function An(e={}){return Ie(e,ft).ref}function Mn(e={}){return Ie(e,ft)}exports.createScrollAnimate=vn;exports.createScrollCounter=Sn;exports.createScrollDraw=bn;exports.createScrollText=Mn;exports.createScrollVideo=xn;exports.useScrollAnimate=wn;exports.useScrollCounter=En;exports.useScrollDraw=hn;exports.useScrollText=An;exports.useScrollVideo=Tn;
|
|
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,kt=/[MmLlHhVvCcSsQqTtAaZz]/g;function nr(e,n,r){if(!je)return;let t=(e.match(kt)??[]).join("").toUpperCase(),a=(n.match(kt)??[]).join("").toUpperCase(),s=(e.match(Ot)??[]).length,l=(n.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.`,r);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.`,r);}function it(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 l=parseFloat(s),u=t[a++]??l;return String(+(l+(u-l)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,a=r?{...At[r],...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:I=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:O,onLeave:ae,onEnterBack:ee,onLeaveBack:M}=a,F=fe===true?"left":typeof fe=="string"?fe:false,K=typeof d=="function"?d:te[d]??te.linear,we=de(S.start??"top bottom"),ze=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(F){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=F?[]:Array.from(e.querySelectorAll(l)),k=[],i=[],f=0,ye=0,H=false,_=false,q=0,Me=false,Se=-1,Z=[],Re=-1,j=false,Oe=0,Fe=0,He,tt=null;function pt(){tt?.destroy(),tt=null;}let Ne=new Set,dt=NaN,Ve=true,Ue=-1,gt=performance.now(),_e=NaN;function rt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function yt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ht(){let o=Je(e,ve,B);return xe(o,o.scroll,yt(),we,ze)}function bt(){(({tStart:f,tEnd:ye}=ht())),Ae&&je&&(pt(),tt=rr(f,ye,B));}function nt(o,c=ht){$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)),F){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}`),Ee&&le?b.style.stroke=We(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&G!==null?b.style.strokeWidth=`${ce+(G-ce)*o}`:G!==null&&(b.style.strokeWidth=`${G}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),x&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],x,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),F){e.style.clipPath=Pe(0);return}z.forEach((o,c)=>{o.style.strokeDasharray=`${k[c]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${k[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=qe(o);k.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}`));}),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 wt=typeof d=="string"?et(d):null;function Bt(){return !(ie===false||!er()||!z.length||!wt||F||B!=="y"||ve||u!==1||V!==0||re||oe||I!==false||x||w||T||Y>0||p||E||g||O||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)",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 D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.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:${wt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(k[U])),y.style.strokeDasharray=`${k[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(),yt(),we,ze);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="";}),D.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"?`${k[he]*U}`:`${k[he]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){z.forEach((y,U)=>{k[U]=qe(y),y.style.setProperty("--ssd-len",String(k[U])),y.style.strokeDasharray=`${k[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(F){let W=Math.min(1,Math.max(0,h/o)),y=K(W);Oe=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"?`${k[y]*he}`:`${k[y]*(1-he)}`,m&&(W.style.opacity=L==="reverse"?`${1-he}`:`${he}`),Ee&&le?W.style.stroke=We(Ee,le,he):le&&(W.style.stroke=le),ce!==null&&G!==null?W.style.strokeWidth=`${ce+(G-ce)*he}`:G!==null&&(W.style.strokeWidth=`${G}`),pe!==null&&Q!==null?W.style.fillOpacity=`${pe+(Q-pe)*he}`:Q!==null&&(W.style.fillOpacity=`${Q}`),x&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],x,he)),y===0&&(Oe=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&&!Ne.has(Te)&&(Ne.add(Te),w[U]?.());}}return N}function ke(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?.(),Fe<(T==="infinite"?1/0:T??0)&&(Fe++,He=setTimeout(()=>{c=performance.now(),_=false,H=false,Ne.clear(),Ye(),q=requestAnimationFrame(ke);},X));return}W||(q=requestAnimationFrame(ke));}function Le(){cancelAnimationFrame(q),clearTimeout(He),c=performance.now(),b=0,j=false,_=false,H=false,Fe=0,ue=true,Oe=0,Ne.clear(),Ye(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(re&&H)?Le():!N.isIntersecting&&!re&&!H&&(cancelAnimationFrame(q),clearTimeout(He),ue=false);});},{root:ve??null,threshold:P,rootMargin:C}),D;function me(){clearTimeout(D),D=setTimeout(()=>{z.forEach((h,N)=>{k[N]=qe(h),h.style.strokeDasharray=`${k[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(He),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(D);},replay(){Fe=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(ke));},seek(h){let N=Math.min(1,Math.max(0,h));Oe=N,j=true,b=N*o,c=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return Oe},refresh(){clearTimeout(D),z.forEach((h,N)=>{k[N]=qe(h),h.style.strokeDasharray=`${k[N]}`;});}}}if(be)return nt(jt());bt();function Xe(){if(!Me||j)return;let o=performance.now(),c=rt();if(!Ve&&I===false&&c===dt){q=requestAnimationFrame(Xe);return}Ve=false,dt=c;let b=u;if(I!==false){let v=o-gt,D=v>0?Math.abs(c-(Ue<0?c:Ue))/v:0;b=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}Ue=c,gt=o;let ue=oe?Re===-1||c>=Re?"forward":"reverse":L;Re=c;let De=ye-f,ke=true,Le=De===0?0:(c-f)/De;if(isNaN(_e)||(_e<=0&&Le>0?O?.():_e>0&&Le<=0&&M?.(),_e<1&&Le>=1?ae?.():_e>=1&&Le<1&&ee?.()),_e=Le,F){let v=K(J(c,f,ye,b));re&&!oe&&(Se=Math.max(Se,v),v=Se),Oe=v,e.style.setProperty("--scroll-draw-progress",String(v));let D=ue==="reverse"?1-v:v;e.style.clipPath=Pe(D),p?.(v),!_&&J(c,f,ye,b)>0&&(_=true,E?.()),v>=1&&!H?(H=true,g?.(),Fe<(T==="infinite"?1/0:T??0)&&(Fe++,He=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,D)=>{let me=D*V*De,h=K(J(c,f+me,ye+me,b));re&&!oe&&(h=Z[D]=Math.max(Z[D]??Se,h)),Oe=h,v.style.strokeDashoffset=ue==="reverse"?`${k[D]*h}`:`${k[D]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=We(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&G!==null?v.style.strokeWidth=`${ce+(G-ce)*h}`:G!==null&&(v.style.strokeWidth=`${G}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),x&&v.tagName.toLowerCase()==="path"&&i[D]&&v.setAttribute("d",it(i[D],x,h)),D===0&&(p?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=K(J(c,f,ye,b));for(let D in w){let me=parseFloat(D);v>=me&&!Ne.has(me)&&(Ne.add(me),w[D]?.());}}!_&&J(c,f,ye,b)>0&&(_=true,E?.()),ke&&!H?(H=true,g?.(),Fe<(T==="infinite"?1/0:T??0)&&(Fe++,He=setTimeout(()=>{Se=-1,Z=[],_=false,H=false,Ne.clear(),Ye(),Ve=true;},X))):!ke&&!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?(Ve=true,Ke()):Qe();});},{root:ve??null,threshold:P,rootMargin:C});function vt(){z.forEach((o,c)=>{k[c]=qe(o),o.style.strokeDasharray=`${k[c]}`;}),bt(),Ve=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(vt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),Y>0?setTimeout(()=>st.observe(e),Y):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(He),Qe(),st.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),pt();},replay(){Se=-1,Z=[],Re=-1,Ue=-1,_=false,H=false,Fe=0,j=false,Oe=0,Ne.clear(),clearTimeout(He),Ye(),Ve=true,Me&&Ke();},pause(){j=true,Qe();},resume(){j&&(j=false,Ve=true,Me&&Ke());},seek(o){let c=Math.min(1,Math.max(0,o));Oe=c,Se=c,Z=[],j=true,Qe(),Wt(c,L),Ve=true;},getProgress(){return Oe},refresh(){clearTimeout(Ze),vt(),Me&&!j&&Ke();}},()=>({tStart:f,tEnd:ye}))}var It=new WeakMap,or=0;function Ft(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=It.get(r);return t===void 0&&It.set(r,t=++or),`el#${t}`}return r})}function Dt(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 sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Rt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.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]:"");}n.push({fn:t[1],nums:a,units:s});}return n}function ir(e,n,r){let t=Rt(e),a=Rt(n);return t.length===0||t.length!==a.length?r<1?e:n:t.map((s,l)=>{let u=a[l];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 Ht(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),a=String(n);if(sr(t))return We(t,a,r);if(t.includes("("))return ir(t,a,r);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)*r}${s[2]||l[2]}`}return r<1?t:a}function ar(e){return e.replace(/([A-Z])/g,n=>`-${n.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 lt(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: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}=n,R=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=typeof s=="function"?s:te[s]??te["ease-out"],w=de(a.start??"top bottom"),I=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?.(),{...r,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,I)};$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 Re=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,Re));},getProgress(){let{tStart:Z,tEnd:Re}=Me();return $(J(_(),Z,Re,l))}};return Se}if(ie())return p();let E=0,g=0,O=0,ae=false,ee=false,M=-1,F=0,K=false,we=NaN,ze=-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,I);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-(ze<0?f:ze))/q:0;ye=l*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}ze=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),F=_,G(_),_>=1&&!K?(K=true,B?.()):_<1&&!u&&(K=false),O=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),F=i,G(i);}let Pe=new IntersectionObserver(i=>{i.forEach(f=>{ae=f.isIntersecting,ae&&!ee?O=requestAnimationFrame(Q):cancelAnimationFrame(O);});},{root:C??null}),z;function k(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),Pe.observe(e),$e(e,{type:"animate",getProgress:()=>F,getTrigger:()=>({tStart:E,tEnd:g})}),{destroy(){cancelAnimationFrame(O),Pe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(z),be(),Ce(e);},replay(){M=-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,M=f,ee=true,cancelAnimationFrame(O),G(f);},getProgress(){return F}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ge("scrollCounter: element not found:",e),ct;let t=r,{from:a=0,to:s,format:l,easing:u="ease-out",trigger:m={},once:d=true,decimals:S,onComplete:V}=n,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?.(),ct;let oe=0,Y=0,A=0,R=false,$=false,w=-1,I=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),I=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),I=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:()=>I,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,I=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));I=E,w=E,$=true,cancelAnimationFrame(A),x(E);},getProgress(){return I}}}var Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return Vt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ge("scrollVideo: <video> element not found:",e),Vt;let t=r,{trigger:a={},easing:s="linear",once:l=false,axis:u="y",preload:m="auto",triggerElement:d,onReady:S,onComplete:V,onProgress:L}=n,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=n.from??0,A=n.to,R=0,$=0,w=0,I=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(),F=u==="x"?M.left:M.top,K=u==="x"?M.width:M.height,we=xe({top:F,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 F=A??t.duration??0,K=Y+(F-Y)*M;K!==ie&&(ie=K,t.currentTime=K),t.style.setProperty("--scroll-draw-progress",String(M)),L?.(M);}function E(){if(!I||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?.(),I&&!P&&(w=requestAnimationFrame(E));}t.readyState>=1?g():t.addEventListener("loadedmetadata",g,{once:true}),x||se();let O=new IntersectionObserver(M=>{M.forEach(F=>{I=F.isIntersecting,I&&!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),O.observe(t),$e(t,{type:"video",getProgress:()=>T,getTrigger:()=>({tStart:R,tEnd:$})}),{destroy(){cancelAnimationFrame(w),O.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,I&&x&&(w=requestAnimationFrame(E)));},seek(M){let F=Math.min(1,Math.max(0,M));T=F,C=F,P=true,cancelAnimationFrame(w),ie=NaN,p(F);},getProgress(){return T}}}function qt(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 mr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function zt(e){let n=qt(e),r=new Map;for(let s of n){let l=s.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(s);}let t=[],a=Array.from(r.keys()).sort((s,l)=>s-l);for(let s of a){let l=r.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,n,r,t){if(r<=1||t===0)return e;let a=(r-1)*t,s=n*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,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 _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,n={}){if(typeof window>"u")return _t;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ge("scrollText: element not found:",e),_t;let t=r,{split:a="words",stagger:s=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:S}=n,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,O){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*O));let ae=pr(O,u);ae&&(g.style.transform=ae);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),ne.forEach((O,ae)=>{let ee=L(fr(g,ae,oe,s));Y(O,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,I=false,P=false,C=-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,Ae);R=O.tStart,$=O.tEnd;}function se(){if(!I||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(O=>{I=O.isIntersecting,I&&!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,I&&(w=requestAnimationFrame(se)));},seek(g){let O=Math.min(1,Math.max(0,g));T=O,C=O,P=true,cancelAnimationFrame(w),A(O);},getProgress(){return T}}}function Ie(e,n){let r,t,a,s;return solidJs.createEffect(()=>{s=typeof e=="function"?e():e;let l=Ft(s);!r||l===a||(a=l,solidJs.untrack(()=>{t?.destroy(),t=n(r,Dt(s,()=>s));}));}),solidJs.onCleanup(()=>{t?.destroy(),t=a=void 0;}),{ref:l=>{r=l;},getInstance:()=>t}}function hn(e={}){return Ie(e,at).ref}function bn(e={}){return Ie(e,at)}function wn(e){return Ie(e,lt).ref}function vn(e){return Ie(e,lt)}function En(e){return Ie(e,ut).ref}function Sn(e){return Ie(e,ut)}function Tn(e={}){return Ie(e,mt).ref}function xn(e={}){return Ie(e,mt)}function An(e={}){return Ie(e,ft).ref}function Mn(e={}){return Ie(e,ft)}exports.createScrollAnimate=vn;exports.createScrollCounter=Sn;exports.createScrollDraw=bn;exports.createScrollText=Mn;exports.createScrollVideo=xn;exports.useScrollAnimate=wn;exports.useScrollCounter=En;exports.useScrollDraw=hn;exports.useScrollText=An;exports.useScrollVideo=Tn;
|
package/dist/solid/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-
|
|
1
|
+
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-TIRZOSQ4.mjs';import {a as a$4}from'../chunk-SNCRC6BA.mjs';import {a as a$2}from'../chunk-4MH5SQTH.mjs';import {a as a$1}from'../chunk-QJ4H2HW3.mjs';import {b as b$1}from'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';import {createEffect,onCleanup,untrack}from'solid-js';function o(e,f){let l,t,c,r;return createEffect(()=>{r=typeof e=="function"?e():e;let n=a(r);!l||n===c||(c=n,untrack(()=>{t?.destroy(),t=f(l,b(r,()=>r));}));}),onCleanup(()=>{t?.destroy(),t=c=void 0;}),{ref:n=>{l=n;},getInstance:()=>t}}function D(e={}){return o(e,b$1).ref}function V(e={}){return o(e,b$1)}function C(e){return o(e,a$1).ref}function H(e){return o(e,a$1)}function L(e){return o(e,a$2).ref}function g(e){return o(e,a$2)}function I(e={}){return o(e,a$3).ref}function k(e={}){return o(e,a$3)}function v(e={}){return o(e,a$4).ref}function j(e={}){return o(e,a$4)}export{H as createScrollAnimate,g as createScrollCounter,V as createScrollDraw,j as createScrollText,k as createScrollVideo,C as useScrollAnimate,L as useScrollCounter,D as useScrollDraw,v as useScrollText,I as useScrollVideo};
|