svg-scroll-draw 2.25.0 → 2.26.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 +116 -15
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +60 -6
- package/dist/angular/index.d.ts +60 -6
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.d.mts +3 -3
- package/dist/astro/index.d.ts +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +71 -34
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/{chunk-NX74KN5X.mjs → chunk-5U4JXBHR.mjs} +1 -1
- package/dist/chunk-7LDSB4FT.mjs +1 -0
- package/dist/chunk-ASCOHQQD.mjs +2 -0
- package/dist/chunk-GBFWTY5L.mjs +1 -0
- package/dist/chunk-HAGTU5EX.mjs +1 -0
- package/dist/chunk-HJTHOZK5.mjs +1 -0
- package/dist/chunk-IJPLLT7E.mjs +1 -0
- package/dist/chunk-IXR6RML7.mjs +1 -0
- package/dist/chunk-KN2YB54Z.mjs +1 -0
- package/dist/chunk-NJV6S5LD.mjs +1 -0
- package/dist/chunk-OGFXZCKC.mjs +1 -0
- package/dist/chunk-UBH4K5YD.mjs +1 -0
- package/dist/chunk-UF3MO5XQ.mjs +1 -0
- package/dist/chunk-XLXVGQ3P.mjs +3 -0
- package/dist/chunk-YOOPMYT6.mjs +1 -0
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.d.mts +3 -1
- package/dist/cinematic/index.d.ts +3 -1
- package/dist/cinematic/index.mjs +1 -1
- package/dist/{engine-6VsjEwzb.d.ts → engine-Bi2x8-X-.d.mts} +2 -2
- package/dist/{engine-BLWKCfxC.d.mts → engine-DAlvk6i0.d.ts} +2 -2
- package/dist/frames/index.cjs +1 -1
- package/dist/frames/index.d.mts +2 -2
- package/dist/frames/index.d.ts +2 -2
- package/dist/frames/index.mjs +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +3 -3
- package/dist/group/index.d.ts +3 -3
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +2 -2
- package/dist/horizontal/index.d.ts +2 -2
- package/dist/horizontal/index.mjs +1 -1
- package/dist/{index-BN8yKeQ3.d.ts → index-BMMZ8aW7.d.mts} +2 -2
- package/dist/{index-hSQqLVbg.d.ts → index-CEMsUTEG.d.ts} +3 -3
- package/dist/{index-DAiRJgtF.d.mts → index-ClAFxNEp.d.mts} +3 -3
- package/dist/{index-DVjblK_4.d.mts → index-MdQ4ti_z.d.ts} +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/lenis/index.cjs +1 -1
- package/dist/lenis/index.d.mts +15 -16
- package/dist/lenis/index.d.ts +15 -16
- package/dist/lenis/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +4 -3
- package/dist/nuxt/index.d.ts +4 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +2 -2
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.mts +4 -4
- package/dist/react/index.d.ts +4 -4
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +2 -2
- package/dist/reveal/index.d.ts +2 -2
- package/dist/reveal/index.mjs +1 -1
- package/dist/{scroll-draw-Fzir8hlU.d.mts → scroll-draw-CKZysh22.d.mts} +1 -1
- package/dist/{scroll-draw-BsU_Ohmu.d.ts → scroll-draw-DbY8RUJE.d.ts} +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +2 -2
- package/dist/snap/index.d.ts +2 -2
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +40 -4
- package/dist/solid/index.d.ts +40 -4
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +47 -4
- package/dist/svelte/index.d.ts +47 -4
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +2 -2
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +10 -10
- package/dist/timeline/index.d.mts +2 -2
- package/dist/timeline/index.d.ts +2 -2
- package/dist/timeline/index.mjs +2 -2
- package/dist/{types-9bcJdVcg.d.mts → types-iITMwrru.d.mts} +10 -2
- package/dist/{types-9bcJdVcg.d.ts → types-iITMwrru.d.ts} +10 -2
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +2 -2
- package/dist/video/index.d.ts +2 -2
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +4 -7
- package/dist/vue/index.d.ts +4 -7
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/dist/wrapper-BOHrDnBO.d.mts +8 -0
- package/dist/wrapper-Cm7JTIVl.d.ts +8 -0
- package/package.json +1 -1
- package/dist/chunk-22P4KBPG.mjs +0 -1
- package/dist/chunk-32ZCSGFZ.mjs +0 -1
- package/dist/chunk-7USW2XFB.mjs +0 -1
- package/dist/chunk-7XOFQCQE.mjs +0 -3
- package/dist/chunk-BDXWPUBJ.mjs +0 -2
- package/dist/chunk-BRV2B2YW.mjs +0 -1
- package/dist/chunk-D2BHE4F2.mjs +0 -1
- package/dist/chunk-QZKYGS74.mjs +0 -1
- package/dist/chunk-THPTANES.mjs +0 -1
- package/dist/chunk-U5TKLHGW.mjs +0 -1
- package/dist/chunk-V3Z6G5JE.mjs +0 -1
- package/dist/chunk-WKOT2MND.mjs +0 -1
- package/dist/chunk-XSVTHCLO.mjs +0 -1
package/dist/astro/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';var Ve=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function N(e,...t){Ve&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function hr({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function br({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(n),s=0,a=[];for(let m=0;m<r;m++){let y=Math.pow(o,m);a.push(y),s+=y;}let l=[0],u=0;for(let m=0;m<r;m++)u+=a[m]/s,l.push(u);return m=>{if(m<=0)return 0;if(m>=1)return 1;for(let y=0;y<r;y++)if(m<=l[y+1]){let v=(m-l[y])/(l[y+1]-l[y]);if(y===0)return v*(2-v);let h=1-Math.pow(n,y);return h+(1-h)*(2*v-1)*(2*v-1)}return 1}}function wr({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),o=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/n)+1}var ze={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:hr(),bounce:br(),elastic:wr()};function vr(e,t,r,n){let o=(s,a,l)=>((1+3*s-3*a)*l+3*a-6*s)*l*l+3*s*l;return s=>{if(s<=0||s>=1)return +(s>0);let a=s;for(let l=0;l<8;l++)a-=(o(e,r,a)-s)/((3*(1+3*e-3*r)*a+6*r-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(o(e,r,a)-s)<1e-9))for(let l=0,u=0,m=1;l<30;l++)a=(u+m)/2,o(e,r,a)<s?u=a:m=a;return o(t,n,a)}}function wt(e){let t=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),r=t?t[1].split(",").map(parseFloat):[];if(r.length===4&&r.every(Number.isFinite)&&r[0]*(1-r[0])>=0&&r[2]*(1-r[2])>=0)return [vr(r[0],r[1],r[2],r[3]),`cubic-bezier(${r})`]}var Rt=new Set;function Pe(e,t="linear"){if(typeof e=="function")return e;if(e==null)return ze[t];if({}.hasOwnProperty.call(ze,e))return ze[e];let r=wt(String(e));return r?r[0]:(!Rt.has(e)&&Rt.add(e)&&N(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),ze[t])}function Qe(e,t,r){return Math.min(r,Math.max(t,e))}function ce(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}var _t=(e,t)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:t;function Nt(e,t,r,n){return e+r+t*_t(n,0)}function Ft(e,t){return t*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:_t(e,1))}function V(e,t,r,n){return r===t?0:Qe((e-t)/(r-t)*n,0,1)}function de(e,t,r,n,o){let s=Nt(e.top,e.height,t,n.element)-Ft(n.viewport,r),a=Nt(e.top,e.height,t,o.element)-Ft(o.viewport,r);return {tStart:s,tEnd:a}}function tt(e,t,r){let n=e.getBoundingClientRect(),o=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:n.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:o,scroll:0}:{top:r==="x"?n.left:n.top,height:o,scroll:r==="x"?window.scrollX:window.scrollY}}function rt(e){let t=parseFloat(e.getAttribute("pathLength")??"");if(t>0)return t;let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),o=parseFloat(e.getAttribute("height")??"0");return 2*(n+o)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function nt(e){return `${e} ${e*2}`}function Vt(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[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 n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function ot(e,t,r){let n=Vt(e),o=Vt(t);return !n||!o?e:`rgb(${Math.round(n[0]+(o[0]-n[0])*r)},${Math.round(n[1]+(o[1]-n[1])*r)},${Math.round(n[2]+(o[2]-n[2])*r)})`}var zt={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 Er="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Sr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Wt=33;function Tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Mr(e){let t=[];for(let r=0;r<Wt;r++){let n=r/(Wt-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function st(e){switch(e){case "linear":return "linear";case "ease-in":return Er;case "ease-out":return Sr;case "ease-in-out":return Tr()?Mr(ze["ease-in-out"]):null;default:return wt(e)?.[1]??null}}var Gt=Symbol.for("svg-scroll-draw.registry");function Bt(){let e=globalThis;return e[Gt]||(e[Gt]=new Map)}function xe(e,t){Bt().set(e,t);}function Le(e){Bt().delete(e);}function qt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",r),()=>t.removeEventListener("change",r);let n=t;return n.addListener?.(r),()=>n.removeListener?.(r)}function $e(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let r=t(e,false),n=qt(s=>{if(!s)return;n();let a=(r.getProgress?.()??0)>=1;r.destroy(),r=t(a?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(r))o[s]=(...a)=>r[s]?.(...a);return o.destroy=()=>{n(),r.destroy();},o}var Ue,it=new Set,at=new WeakMap,Ye=new Map,jt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function xr(e){let t=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let n=r;n;n=n.previousElementSibling)t.add(n);return t}function Qt(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let r=()=>t();Ue??(Ue=new ResizeObserver(o=>{let s=false;for(let{target:a}of o)at.get(a)!==jt(a)&&(s=true),at.set(a,"");s&&it.forEach(a=>a());})),it.add(r);let n=xr(e);return [document.body,document.documentElement].forEach(o=>o&&n.add(o)),n.forEach(o=>{at.has(o)||at.set(o,jt(o)),Ye.set(o,(Ye.get(o)??0)+1),Ue.observe(o);}),()=>{it.delete(r)&&(n.forEach(o=>{let s=(Ye.get(o)??1)-1;if(s)return void Ye.set(o,s);Ye.delete(o),Ue?.unobserve(o);}),it.size||(Ue?.disconnect(),Ue=void 0));}}function De(e,t,r,n,o){let s,a=NaN,l,u,m=()=>{s=0,n(),!l&&!s&&(a=r())>0&&a<1&&(s=requestAnimationFrame(m));},y=()=>{!s&&!l&&r()!==a&&(s=requestAnimationFrame(m));},v=F=>{l=F,cancelAnimationFrame(s),s=a=NaN,y();},h=()=>{clearTimeout(u),o(),y();},M=()=>{clearTimeout(u),u=setTimeout(h,150);},z=Qt(t,M),E=F=>{e[F]("scroll",y,{passive:true}),window[F]("resize",M),window[F]("orientationchange",M);};return E("addEventListener"),y(),{hold:v,remeasure:h,off(){v(true),E("removeEventListener"),z(),clearTimeout(u);}}}var Lr=0;function Ar(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Ut(e,t){let r="";try{r=getComputedStyle(e).getPropertyValue(t).trim();}catch{}return r||(e.getAttribute(t)??"").trim()}var Yt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Cr(e){if(!Ve)return;let t=Ut(e,"stroke");if(!t||t==="none"){N("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Yt.has(r)&&!Yt.has(Ut(e,"fill"))&&N("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Pr(e,t,r){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.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 o(){let s=r==="x"?window.scrollX:window.scrollY,a=e-s,l=t-s,u=r==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${u?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}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;${u?`left:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}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(n),window.addEventListener("scroll",o,{passive:true}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove();}}}var jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Qt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Mr(e,t,r){if(!We)return;let n=(e.match(Qt)??[]).join("").toUpperCase(),o=(t.match(Qt)??[]).join("").toUpperCase(),i=(e.match(jt)??[]).length,a=(t.match(jt)??[]).length;if(n!==o){j(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==a&&j(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function Lr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),f=n[o++]??a;return String(+(a+(f-a)*r).toFixed(4))})}function it(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:De(t,(r,n)=>Ar(e,r,n))}function Ar(e,t,r){let{preset:n,...o}=t,i=n?{...Nt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:f=1,fade:u=false,easing:m="linear",trigger:g={},stagger:S=0,direction:y="forward",once:H=false,debug:ie=false,axis:b="y",scrollContainer:$,autoReverse:pe=false,delay:R=0,strokeColor:x,strokeWidth:C,fillOpacity:D,waypoints:M,velocityScale:A=false,threshold:W=0,rootMargin:he="0px",repeat:ee=0,repeatDelay:te=0,morphTo:N,clip:w,autoplay:ae=false,duration:v=1e3,native:F=true,onProgress:Oe,onStart:J,onComplete:re,onEnter:be,onLeave:Ne,onEnterBack:we,onLeaveBack:de}=i,Z=w===true?"left":typeof w=="string"?w:false,Q=typeof m=="function"?m:se[m]??se.linear,Fe=me(g.start||"top bottom"),Ge=me(g.end||"bottom top"),G=typeof $=="string"?document.querySelector($):$??null,ve=Array.isArray(x)?x[0]:null,Ee=Array.isArray(x)?x[1]:typeof x=="string"?x:null,ue=Array.isArray(C)?C[0]:null,Pe=Array.isArray(C)?C[1]:typeof C=="number"?C:null,Se=Array.isArray(D)?D[0]:null,fe=Array.isArray(D)?D[1]:typeof D=="number"?D:null;function Te(s){let c=s*100;switch(Z){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 l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],z=[],T=0,P=0,_=S,k=0,$e=0,B=false,xe=false,Me=0,ut=-1,Xe=[],Je=-1,le=false,ge=0,Ie=0,He,ft=false,mt=null;function vt(){mt?.destroy(),mt=null;}let Re=new Set,Et=NaN,_e=true,Ze=-1,St=performance.now(),Ve=NaN;function Ke(){return G?b==="x"?G.scrollLeft:G.scrollTop:b==="x"?window.scrollX:window.scrollY}function Tt(){return G?b==="x"?G.clientWidth:G.clientHeight:b==="x"?window.innerWidth:window.innerHeight}function xt(){let s=et(e,G,b);return ye(s,s.scroll,Tt(),Fe,Ge)}function ir(){let s=P-T,c=l.length-1,d=G??document.documentElement,E=b==="x"?"Width":"Height";if(_=S,S>0&&c>0&&s>0){let Y=d[`scroll${E}`]-d[`client${E}`]-1-T-s/f;Y>=0&&(_=Math.min(S,Y/(c*s)));}let q=Math.max(0,c)*_*s,ne=s/Math.min(f,1);k=T+Math.min(0,q,ne,q+ne),$e=T+Math.max(0,q,ne,q+ne);}function Mt(){(({tStart:T,tEnd:P}=xt())),ir(),ie&&We&&(vt(),mt=xr(T,P,b));}function pt(s,c=xt){Ae(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let d=s.destroy;return s.destroy=()=>{d.call(s),Ce(e);},s}function Lt(s,c){return H&&!pe?Math.max(ut,Q(Xe[s]=Math.max(Xe[s]??0,c))):Q(c)}function ar(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),Z){let d=c==="reverse"?1-s:s;e.style.clipPath=Te(d);return}l.forEach((d,E)=>dt(d,E,s,c));}function dt(s,c,d,E){s.style.strokeDashoffset=E==="reverse"?`${p[c]*d}`:`${p[c]*(1-d)}`,u&&(s.style.opacity=E==="reverse"?`${1-d}`:`${d}`),ve&&Ee?s.style.stroke=rt(ve,Ee,d):Ee&&(s.style.stroke=Ee),ue!==null&&Pe!==null?s.style.strokeWidth=`${ue+(Pe-ue)*d}`:Pe!==null&&(s.style.strokeWidth=`${Pe}`),Se!==null&&fe!==null?s.style.fillOpacity=`${Se+(fe-Se)*d}`:fe!==null&&(s.style.fillOpacity=`${fe}`),N&&s.tagName.toLowerCase()==="path"&&z[c]&&s.setAttribute("d",Lr(z[c],N,d));}function gt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=Te(y==="reverse"?1:0);return}l.forEach((s,c)=>{s.style.strokeDasharray=`${p[c]}`,s.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,u?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ve&&(s.style.stroke=ve),ue!==null&&(s.style.strokeWidth=`${ue}`),Se!==null&&(s.style.fillOpacity=`${Se}`),N&&s.tagName.toLowerCase()==="path"&&z[c]&&s.setAttribute("d",z[c]);});}function ze(s,c){let d=s.getAttribute("d"),E=tt(s);if(N&&z[c]){s.setAttribute("d",N);let q=tt(s);s.setAttribute("d",z[c]),E=Math.max(tt(s),q),s.setAttribute("d",d);}p[c]=E,s.style.strokeDasharray=`${E}`;}if(l.forEach((s,c)=>{Tr(s);let d=s.tagName.toLowerCase()==="path";d?z.push(s.getAttribute("d")??""):z.push(""),ze(s,c);let E=p[c];N&&(d?Mr(z[z.length-1],N,s):j(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),r?(s.style.strokeDashoffset=y==="reverse"?`${E}`:"0",u&&(s.style.opacity="1"),Ee&&(s.style.stroke=Ee),Pe!==null&&(s.style.strokeWidth=`${Pe}`),fe!==null&&(s.style.fillOpacity=`${fe}`),N&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",N)):(s.style.strokeDashoffset=y==="reverse"?"0":`${E}`,u?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ve&&(s.style.stroke=ve),ue!==null&&(s.style.strokeWidth=`${ue}`),Se!==null&&(s.style.fillOpacity=`${Se}`));}),r)return Z&&(e.style.clipPath=Te(1)),re?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=Te(y==="reverse"?1:0));let At=typeof m=="string"?nt(m):null;function lr(){return !(F===false||ae||ie&&We||!Sr()||!l.length||!At||Z||b!=="y"||G||f!==1||S!==0||H||pe||A!==false||N||M||ee||R>0||Oe||J||re||be||Ne||we||de||x!=null||C!=null||D!=null||(g.start||"top bottom").trim()!=="top bottom"||(g.end||"bottom top").trim()!=="bottom top")}function cr(){let s=++Er,c=`svg-scroll-draw-${s}`,d=`svg-scroll-draw-host-${s}`,E=`--svg-scroll-draw-${s}`,q=y==="reverse"?"0":"var(--ssd-len)",ne=y==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${q};`,O=`stroke-dashoffset:${ne};`;u&&(Y+=`opacity:${y==="reverse"?1:0};`,O+=`opacity:${y==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${c}{from{${Y}}to{${O}}}.${d}{view-timeline-name:${E};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${E};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(d);function K(h,L){h.style.setProperty("--ssd-len",String(p[L])),h.style.strokeDasharray=`${p[L]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}l.forEach(K);let U=false,oe=-1;function ce(){if(oe>=0)return oe;let h=e.getBoundingClientRect(),{tStart:L,tEnd:X}=ye({top:h.top,height:h.height},Ke(),Tt(),Fe,Ge);return Q(V(Ke(),L,X,f))}return {destroy(){e.classList.remove(d),l.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),I.remove();},replay(){U=false,oe=-1,l.forEach(K);},pause(){U=true,l.forEach(h=>{h.style.animationPlayState="paused";});},resume(){U&&(U=false,l.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let L=Math.min(1,Math.max(0,h));oe=L,U=true,l.forEach((X,Le)=>{X.classList.remove(c),X.style.strokeDashoffset=y==="reverse"?`${p[Le]*L}`:`${p[Le]*(1-L)}`,u&&(X.style.opacity=y==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return ce()},refresh(){l.forEach((h,L)=>{ze(h,L),h.style.setProperty("--ssd-len",String(p[L]));});}}}if(lr())return pt(cr());function ur(){let s=Math.max(1,v),c=Z?s:s*(1+Math.max(0,l.length-1)*S),d=0,E=0,q=false;function ne(oe){let ce=true,h=Math.min(1,Math.max(0,oe/c));if(Z){let L=Math.min(1,Math.max(0,oe/s)),X=Q(L);ge=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=Te(y==="reverse"?1-X:X),Oe?.(X),L<1&&(ce=false);}else {l.forEach((X,Le)=>{let mr=Le*S*s,kt=Math.min(1,Math.max(0,(oe-mr)/s));dt(X,Le,Q(kt),y),kt<1&&(ce=false);});let L=Q(h);ge=L,Oe?.(L),e.style.setProperty("--scroll-draw-progress",String(L));}if(M){let L=Q(h);for(let X in M){let Le=parseFloat(X);L>=Le&&!Re.has(Le)&&(Re.add(Le),M[X]?.());}}return ce}function Y(oe){if(le)return;let ce=oe-d;xe||(xe=true,J?.());let h=ne(ce);if(h&&!B){B=true,ne(c),re?.(),Ie<(ee==="infinite"?1/0:ee??0)&&(Ie++,He=setTimeout(()=>{d=performance.now(),xe=false,B=false,Re.clear(),gt(),Me=requestAnimationFrame(Y);},te));return}h||(Me=requestAnimationFrame(Y));}function O(){cancelAnimationFrame(Me),clearTimeout(He),d=performance.now(),E=0,le=false,xe=false,B=false,Ie=0,q=true,ge=0,Re.clear(),gt(),Me=requestAnimationFrame(Y);}let I=new IntersectionObserver(oe=>{oe.forEach(ce=>{ce.isIntersecting&&!(H&&B)?O():!ce.isIntersecting&&!H&&!B&&(cancelAnimationFrame(Me),clearTimeout(He),q=false);});},{root:G??null,threshold:W,rootMargin:he}),K;function U(){clearTimeout(K),K=setTimeout(()=>l.forEach(ze),150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),R>0?setTimeout(()=>I.observe(e),R):I.observe(e),{destroy(){cancelAnimationFrame(Me),clearTimeout(He),I.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(K);},replay(){Ie=0,O();},pause(){le||!q||(le=true,E=performance.now()-d,cancelAnimationFrame(Me));},resume(){le&&(le=false,q=true,d=performance.now()-E,Me=requestAnimationFrame(Y));},seek(oe){let ce=Math.min(1,Math.max(0,oe));ge=ce,le=true,E=ce*c,d=performance.now()-E,cancelAnimationFrame(Me),ne(E);},getProgress(){return ge},refresh(){clearTimeout(K),l.forEach(ze);}}}if(ae)return pt(ur());Mt();let Ct=()=>V(Ke(),k,$e,1);function Pt(){B=true,re?.(),Ie<(ee==="infinite"?1/0:ee)&&(Ie++,He=setTimeout(()=>{ft=true;},te));}function $t(){ut=-1,Xe=[],xe=false,B=false,ft=false,Re.clear(),gt(),_e=true;}function fr(){let s=performance.now(),c=Ke();if(ft&&Ct()%1&&$t(),!_e&&A===false&&c===Et)return;_e=false,Et=c;let d=f;if(A!==false){let O=s-St,I=O>0?Math.abs(c-(Ze<0?c:Ze))/O:0;d=f*Math.max(.2,1+I*(typeof A=="number"?A:1)*.04);}Ze=c,St=s;let E=pe?Je===-1||c>=Je?"forward":"reverse":y;Je=c;let q=P-T,ne=true,Y=q===0?0:(c-T)/q;if(isNaN(Ve)||(Ve<=0&&Y>0&&be?.(),Ve<1&&Y>=1&&Ne?.(),Ve>=1&&Y<1&&we?.(),Ve>0&&Y<=0&&de?.()),Ve=Y,Z){let O=Lt(0,V(c,T,P,d));ge=O,e.style.setProperty("--scroll-draw-progress",String(O));let I=E==="reverse"?1-O:O;e.style.clipPath=Te(I),Oe?.(O),!xe&&V(c,T,P,d)>0&&(xe=true,J?.()),O>=1&&!B?Pt():O<1&&!H&&(B=false);return}if(l.forEach((O,I)=>{let K=I*_*q,U=Lt(I,V(c,T+K,P+K,d));dt(O,I,U,E),I===0&&(ge=U,Oe?.(U),e.style.setProperty("--scroll-draw-progress",String(U))),U<1&&(ne=false);}),M){let O=Q(V(c,T,P,d));for(let I in M){let K=parseFloat(I);O>=K&&!Re.has(K)&&(Re.add(K),M[I]?.());}}!xe&&V(c,T,P,d)>0&&(xe=true,J?.()),ne&&!B?Pt():!ne&&!H&&(B=false);}let Be=ke(G??window,[e],Ct,fr,()=>{let s=p.join();l.forEach(ze),Mt(),_e=true,p.join()!==s&&qe();}),yt=R>0;function qe(){Be.hold(le||yt);}let Dt;return yt&&(Dt=setTimeout(()=>{yt=false,qe();},R)),qe(),pt({destroy(){clearTimeout(He),clearTimeout(Dt),Be.off(),vt();},replay(){$t(),Je=-1,Ze=-1,Ie=0,le=false,ge=0,clearTimeout(He),qe();},pause(){le=true,Be.hold(true);},resume(){le&&(le=false,_e=true,qe());},seek(s){let c=Math.min(1,Math.max(0,s));ge=c,ut=c,Xe=[],le=true,Be.hold(true),ar(c,y),_e=true;},getProgress(){return ge},refresh:Be.remeasure},()=>({tStart:T,tEnd:P}))}function Cr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Yt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let o=[],i=[],a=n[2].trim();if(a)for(let f of a.split(/[\s,]+/)){let u=f.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:o,units:i});}return t}function Pr(e,t,r){let n=Yt(e),o=Yt(t);return n.length===0||n.length!==o.length?r<1?e:t:n.map((i,a)=>{let f=o[a];return i.fn!==f.fn||i.nums.length!==f.nums.length?r<1?`${i.fn}(${i.nums.map((u,m)=>`${u}${i.units[m]}`).join(", ")})`:`${f.fn}(${f.nums.map((u,m)=>`${u}${f.units[m]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,m)=>`${u+(f.nums[m]-u)*r}${i.units[m]}`).join(", ")})`}).join(" ")}function Ut(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),o=String(t);if(Cr(n))return rt(n,o,r);if(n.includes("("))return Pr(n,o,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let f=parseFloat(i[1]),u=parseFloat(a[1]);return `${f+(u-f)*r}${i[2]||a[2]}`}return r<1?n:o}function $r(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Dr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),kr=0,Xt="--scroll-draw-progress";function Or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Kt(e,t){return typeof window>"u"?Zt:t.respectReducedMotion===false?Jt(e,t,false):De(t,(r,n)=>Jt(e,r,n))}function Jt(e,t,r){let{props:n,trigger:o={},easing:i="ease-out",speed:a=1,once:f=false,axis:u="y",scrollContainer:m,native:g=true,velocityScale:S=false,triggerElement:y,onProgress:H,onComplete:ie,onEnter:b,onLeave:$,onEnterBack:pe,onLeaveBack:R}=t,x=typeof i=="function"?i:se[i]??se["ease-out"],C=me(o.start||"top bottom"),D=me(o.end||"bottom top"),M=y??e,A=typeof m=="string"?document.querySelector(m):m??null,W=Object.entries(n).map(([l,p])=>({prop:$r(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function he(){let l=window.getComputedStyle(e);for(let p of W)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function ee(){for(let l of W)e.style.setProperty(l.prop,String(l.to));}let te=new Map;for(let l of [...W.map(p=>p.prop),Xt])te.set(l,e.style.getPropertyValue(l));function N(){for(let[l,p]of te)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(r)return ee(),ie?.(),{...Zt,destroy:N,getProgress:()=>1};he();let w=()=>A?u==="x"?A.scrollLeft:A.scrollTop:u==="x"?window.scrollX:window.scrollY,ae=()=>A?u==="x"?A.clientWidth:A.clientHeight:u==="x"?window.innerWidth:window.innerHeight,v=typeof i=="string"?nt(i):null;function F(){if(!g||!Or()||!v||u!=="y"||A||M!==e||f||a!==1||H||ie||b||$||pe||R||S!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let l of W)if(!Dr.has(l.prop))return false;return true}function Oe(){let l=`ssd-a-${++kr}`,p=W.map(k=>`${k.prop}:${k.from}`).join(";"),z=W.map(k=>`${k.prop}:${k.to}`).join(";"),T=document.createElement("style");T.setAttribute("data-ssd-animate",""),T.textContent=`@keyframes ${l}{from{${p}}to{${z}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${v};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(T),e.classList.add(l);let P=()=>{let k=e.getBoundingClientRect();return ye({top:k.top,height:k.height},w(),ae(),C,D)};Ae(e,{type:"animate",getProgress:()=>_.getProgress(),getTrigger:P});let _={refresh(){},destroy(){e.classList.remove(l),T.remove(),e.style.animationPlayState="",N(),Ce(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let $e=Math.min(1,Math.max(0,k));e.classList.remove(l);for(let B of W)e.style.setProperty(B.prop,Ut(B.from,B.to,$e));},getProgress(){let{tStart:k,tEnd:$e}=P();return x(V(w(),k,$e,a))}};return _}if(F())return Oe();let J=0,re=0,be=false,Ne=-1,we=0,de=0,Z=false,Q=NaN,Fe=-1,Ge=0,G=M===e?W:[],ve=false;function Ee(){let l=e.style,p=G.map(_=>l.getPropertyValue(_.prop)),z=l.transition;G.length&&(l.transition="none"),G.forEach(_=>l.setProperty(_.prop,te.get(_.prop)??""));let T=et(M,A,u);G.forEach((_,k)=>l.setProperty(_.prop,p[k])),G.length&&(e.offsetWidth,l.transition=z);let P=ye(T,T.scroll,ae(),C,D);ve&&Math.abs(P.tStart-J)<1&&Math.abs(P.tEnd-re)<1||(ve=true,J=P.tStart,re=P.tEnd);}function ue(l){e.style.setProperty(Xt,String(l));for(let p of W)e.style.setProperty(p.prop,Ut(p.from,p.to,l));H?.(l);}function Pe(l){if(isNaN(Q)){Q=l;return}Q<=0&&l>0&&b?.(),Q<1&&l>=1&&$?.(),Q>=1&&l<1&&pe?.(),Q>0&&l<=0&&R?.(),Q=l;}function Se(){if(be)return;let l=performance.now(),p=w(),z=a;if(S!==false){let k=l-Ge,$e=k>0?Math.abs(p-(Fe<0?p:Fe))/k:0;z=a*Math.max(.2,1+$e*(typeof S=="number"?S:1)*.04);}Fe=p,Ge=l;let T=re===J?0:(p-J)/(re-J);Pe(T);let P=V(p,J,re,z),_=f?Math.max(Ne,x(we=Math.max(we,P))):x(P);de=_,ue(_),_>=1&&!Z?(Z=true,ie?.()):_<1&&!f&&(Z=false);}let fe=ke(A??window,[M],()=>V(w(),J,re,Math.min(a,1)),Se,Ee);Ee(),re===J&&j("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),we=V(w(),J,re,a),de=x(we),ue(de),Ae(e,{type:"animate",getProgress:()=>de,getTrigger:()=>({tStart:J,tEnd:re})});function Te(){be=true,fe.hold(true);}return {destroy(){be=true,fe.off(),N(),Ce(e);},replay(){Ne=-1,we=0,Z=false,de=0,be=false,ue(0),fe.hold(false);},pause:Te,resume(){be&&(be=false,fe.hold(false));},seek(l){let p=Math.min(1,Math.max(0,l));de=p,Ne=p,we=0,Te(),ue(p);},getProgress(){return de},refresh:fe.remeasure}}var ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function er(e,t){if(typeof window>"u")return ht;let r=typeof e=="string"?document.querySelector(e):e;return r?De(t,(n,o)=>Ir(r,n,o)):(j("scrollCounter: element not found:",e),ht)}function Ir(e,t,r){let{from:n=0,to:o,format:i,easing:a="ease-out",trigger:f={},once:u=true,decimals:m,onComplete:g}=t,S=m!==void 0?v=>v.toFixed(m):i??(v=>String(Math.round(v))),y=typeof a=="function"?a:se[a]??se["ease-out"],H=me(f.start||"top 80%"),ie=me(f.end||"top 20%");if(r)return e.textContent=S(o),g?.(),{...ht,getProgress:()=>1};let b=0,$=0,pe=false,R=-1,x=0,C=0,D=false,M=()=>window.scrollY,A=()=>window.innerHeight;function W(){let v=e.getBoundingClientRect(),F=ye({top:v.top,height:v.height},M(),A(),H,ie);pe&&Math.abs(F.tStart-b)<1&&Math.abs(F.tEnd-$)<1||(pe=true,b=F.tStart,$=F.tEnd);}let he=e.style.getPropertyValue("--scroll-draw-progress");function ee(v){e.textContent=S(n+(o-n)*v),e.style.setProperty("--scroll-draw-progress",String(v));}let te=()=>V(M(),b,$,1);function N(){let v=te(),F=u?Math.max(R,y(x=Math.max(x,v))):y(v);C=F,ee(F),F>=1&&!D?(D=true,g?.()):F<1&&!u&&(D=false);}W();{x=V(M(),b,$,1);let v=y(x);C=v,ee(v);}let w=ke(window,[e],te,N,W);Ae(e,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:b,tEnd:$})});let ae=()=>w.hold(false);return {destroy(){w.off(),e.style.setProperty("--scroll-draw-progress",he),Ce(e);},replay(){R=-1,x=0,D=false,C=0,ee(0),ae();},pause:()=>w.hold(true),resume:ae,seek(v){let F=Math.min(1,Math.max(0,v));C=F,R=F,x=0,w.hold(true),ee(F);},getProgress(){return C}}}function tr(e,t){let r=document.createElement("span");r.textContent=t,r.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(r);}function at(e=""){let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=e,t}function nr(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(r=>{let n=e.appendChild(at(r)),o=/^\s+$/.test(r);return o?n.style.whiteSpace="pre":n.style.display="inline-block",o?null:n}).filter(r=>r!==null)}function Hr(e){let t=e.textContent??"";e.textContent="";let r=[],n=null;for(let o of t){let i=at(o),a=o===" ";a?i.style.whiteSpace="pre":(i.style.display="inline-block",r.push(i)),a||o>"\u0DFF"?n=null:n||(n=e.appendChild(at()),n.style.cssText="display:inline-block;white-space:nowrap"),(n??e).appendChild(i);}return r}function rr(e){let t=nr(e),r=new Map;for(let i of t){let a=i.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(i);}let n=[],o=Array.from(r.keys()).sort((i,a)=>i-a);for(let i of o){let a=r.get(i),f=at();f.style.display="inline-block",a.forEach((u,m)=>{let g=u.nextElementSibling;f.appendChild(u),m<a.length-1&&g&&g.style.whiteSpace==="pre"&&f.appendChild(g);}),n.push(f);}return e.textContent="",n.forEach((i,a)=>{e.appendChild(i),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function Rr(e,t,r,n){if(r<=1||n===0)return e;n=Math.min(n,1/r);let o=(r-1)*n,i=t*n,a=i+(1-o);return a<=i?e>=i?1:0:je((e-i)/(a-i),0,1)}function Nr(e,t){let r=[];if(t?.y!==void 0&&r.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&r.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&r.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let n=t.scale+(1-t.scale)*e;r.push(`scale(${n})`);}return r.join(" ")}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,t={}){if(typeof window>"u")return bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return j("scrollText: element not found:",e),bt;let n=r;return De(t,(o,i)=>Fr(n,o,i))}function Fr(e,t,r){let{split:n="words",stagger:o=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:f={},once:u=true,onComplete:m}=t,g=typeof i=="function"?i:se[i]??se["ease-out"],S=me(f.start||"top 85%"),y=me(f.end||"top 40%"),H=e.innerHTML,ie=e.textContent??"",b;n==="chars"?b=Hr(e):n==="lines"?b=rr(e):b=nr(e),tr(e,ie);let $=b.length;function pe(w,ae){a?.opacity!==void 0&&(w.style.opacity=String(a.opacity+(1-a.opacity)*ae));let v=Nr(ae,a);v&&(w.style.transform=v);}function R(w){e.style.setProperty("--scroll-draw-progress",String(w)),b.forEach((ae,v)=>{let F=g(Rr(w,v,$,o));pe(ae,F);});}if(r)return R(1),m?.(),{...bt,destroy:()=>{e.innerHTML=H;},getProgress:()=>1};R(0);let x=0,C=0,D=-1,M=0,A=false;function W(){({tStart:x,tEnd:C}=ye(e.getBoundingClientRect(),window.scrollY,window.innerHeight,S,y));}let he=()=>V(window.scrollY,x,C,1);function ee(){let w=u?D=Math.max(D,he()):he();M=w,R(w),w>=1&&!A?(A=true,m?.()):w<1&&!u&&(A=false);}W();let te=ke(window,[e],he,ee,()=>{n==="lines"&&(e.innerHTML=H,b=rr(e),tr(e,ie),R(M)),W();});Ae(e,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:x,tEnd:C})});let N=()=>te.hold(false);return {destroy(){te.off(),e.innerHTML=H,Ce(e);},replay(){D=-1,A=false,M=0,R(0),N();},pause:()=>te.hold(true),resume:N,seek(w){te.hold(true),R(M=D=je(w,0,1));},getProgress(){return M}}}function _r(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?it(n,t):(j("Container not found:",e),r)}function Ue(){return typeof document>"u"?null:document}var wt=new WeakMap,sr;function lt(e,t,r,n){let o=wt.get(e)??new Map;wt.set(e,o);let i=()=>{let u=r(),m=o.get(t);m&&m.key===u||(m?.inst.destroy(),o.set(t,{inst:n(u),key:u,build:i,users:m?.users??0}));};i(),o.get(t).users++;let a=true;typeof MutationObserver<"u"&&(sr??(sr=new MutationObserver(u=>u.forEach(m=>wt.get(m.target)?.forEach(g=>g.build())))),sr.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(u=>`data-scroll-${u}-options`).concat("data-scroll-drawoptions")}));let f=()=>o.get(t)?.inst;return {destroy:()=>{let u=o.get(t);!a||!u||(a=false,!(--u.users>0)&&(u.inst.destroy(),o.delete(t)));},replay:()=>f()?.replay(),pause:()=>f()?.pause(),resume:()=>f()?.resume(),seek:u=>f()?.seek(u),getProgress:()=>f()?.getProgress()??0,refresh:()=>f()?.refresh?.()}}function ct(e,t){try{return e?JSON.parse(e):t}catch{return t}}function Vr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(t=>lt(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",r=>it(t,ct(r,{})))):[]}function Wr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(t=>lt(t,"animate",()=>t.dataset.scrollAnimateOptions??"",r=>Kt(t,ct(r,{props:{}})))):[]}function Gr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(t=>lt(t,"counter",()=>t.dataset.scrollCounterOptions??"",r=>{let n=ct(r,{});return !n.to&&n.to!==0&&(j('initScrollCounter: element missing "to" in options JSON:',t),n.to=0),typeof n.format!="function"&&n.format!==void 0&&(j('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete n.format),er(t,n)})):[]}function zr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(t=>lt(t,"text",()=>t.dataset.scrollTextOptions??"",r=>or(t,ct(r,{})))):[]}function eo(e=Ue()){return {draw:Vr(e),animate:Wr(e),counter:Gr(e),text:zr(e)}}exports.initAll=eo;exports.initScrollAnimate=Wr;exports.initScrollCounter=Gr;exports.initScrollDraw=Vr;exports.initScrollText=zr;exports.scrollDraw=_r;
|
|
3
|
+
<div style="position:absolute;${u?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}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(n),window.addEventListener("scroll",o,{passive:true}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove();}}}var Xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Jt=/[MmLlHhVvCcSsQqTtAaZz]/g;function $r(e,t,r){if(!Ve)return;let n=(e.match(Jt)??[]).join("").toUpperCase(),o=(t.match(Jt)??[]).join("").toUpperCase(),s=(e.match(Xt)??[]).length,a=(t.match(Xt)??[]).length;if(n!==o){N(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${o||"\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!==a&&N(`morphTo: coordinate count differs (${s} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function Dr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let a=parseFloat(s),l=n[o++]??a;return String(+(a+(l-a)*r).toFixed(4))})}function lt(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:$e(t,(r,n)=>Or(e,r,n))}function Or(e,t,r){let{preset:n,...o}=t,s=n?{...zt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:l=1,fade:u=false,easing:m="linear",trigger:y={},stagger:v=0,direction:h="forward",once:M=false,debug:z=false,axis:E="y",scrollContainer:F,autoReverse:Z=false,delay:L=0,strokeColor:P,strokeWidth:_,fillOpacity:W,waypoints:A,velocityScale:C=false,threshold:H=0,rootMargin:fe="0px",repeat:ue=0,repeatDelay:Q=0,morphTo:D,clip:g,autoplay:S=false,duration:ge=1e3,native:We=true,onProgress:Oe,onStart:K,onComplete:re,onEnter:ye,onLeave:Re,onEnterBack:he,onLeaveBack:me}=s,ee=g===true?"left":typeof g=="string"?g:false,U=Pe(m),Ne=ce(y.start||"top bottom"),Ge=ce(y.end||"bottom top"),G=typeof F=="string"?document.querySelector(F):F??null,be=Array.isArray(P)?P[0]:null,we=Array.isArray(P)?P[1]:typeof P=="string"?P:null,ae=Array.isArray(_)?_[0]:null,Ae=Array.isArray(_)?_[1]:typeof _=="number"?_:null,ve=Array.isArray(W)?W[0]:null,le=Array.isArray(W)?W[1]:typeof W=="number"?W:null;function Ee(i){let f=i*100;switch(ee){case "right":return `inset(0 0 0 ${100-f}%)`;case "top":return `inset(0 0 ${100-f}% 0)`;case "bottom":return `inset(${100-f}% 0 0 0)`;case "center":return `circle(${i*150}% at 50% 50%)`;default:return `inset(0 ${100-f}% 0 0)`}}let c=ee?[]:Array.from(e.querySelectorAll(a)),p=[],B=[],T=0,$=0,R=v,O=0,Ce=0,q=false,Se=false,Te=0,mt=-1,Je=[],Ze=-1,se=false,pe=0,ke=0,Ie,pt=false,dt=null;function Tt(){dt?.destroy(),dt=null;}let He=new Set,Mt=NaN,Fe=true,Ke=-1,xt=performance.now(),_e=NaN;function et(){return G?E==="x"?G.scrollLeft:G.scrollTop:E==="x"?window.scrollX:window.scrollY}function Lt(){return G?E==="x"?G.clientWidth:G.clientHeight:E==="x"?window.innerWidth:window.innerHeight}function At(){let i=tt(e,G,E);return de(i,i.scroll,Lt(),Ne,Ge)}function ur(){let i=$-T,f=c.length-1,d=G??document.documentElement,w=E==="x"?"Width":"Height";if(R=v,v>0&&f>0&&i>0){let Y=d[`scroll${w}`]-d[`client${w}`]-1-T-i/l;Y>=0&&(R=Math.min(v,Y/(f*i)));}let j=Math.max(0,f)*R*i,ne=i/Math.min(l,1);O=T+Math.min(0,j,ne,j+ne),Ce=T+Math.max(0,j,ne,j+ne);}function Ct(){(({tStart:T,tEnd:$}=At())),ur(),z&&Ve&&(Tt(),dt=Pr(T,$,E));}function gt(i,f=At){xe(e,{type:"draw",getProgress:()=>i.getProgress(),getTrigger:f});let d=i.destroy;return i.destroy=()=>{d.call(i),Le(e);},i}function Pt(i,f){return M&&!Z?Math.max(mt,U(Je[i]=Math.max(Je[i]??0,f))):U(f)}function fr(i,f){if(e.style.setProperty("--scroll-draw-progress",String(i)),ee){let d=f==="reverse"?1-i:i;e.style.clipPath=Ee(d);return}c.forEach((d,w)=>yt(d,w,i,f));}function yt(i,f,d,w){i.style.strokeDashoffset=w==="reverse"?`${p[f]*d}`:`${p[f]*(1-d)}`,u&&(i.style.opacity=w==="reverse"?`${1-d}`:`${d}`),be&&we?i.style.stroke=ot(be,we,d):we&&(i.style.stroke=we),ae!==null&&Ae!==null?i.style.strokeWidth=`${ae+(Ae-ae)*d}`:Ae!==null&&(i.style.strokeWidth=`${Ae}`),ve!==null&&le!==null?i.style.fillOpacity=`${ve+(le-ve)*d}`:le!==null&&(i.style.fillOpacity=`${le}`),D&&i.tagName.toLowerCase()==="path"&&B[f]&&i.setAttribute("d",Dr(B[f],D,d));}function ht(){if(e.style.setProperty("--scroll-draw-progress","0"),ee){e.style.clipPath=Ee(h==="reverse"?1:0);return}c.forEach((i,f)=>{i.style.strokeDasharray=nt(p[f]),i.style.strokeDashoffset=h==="reverse"?"0":`${p[f]}`,u?i.style.opacity=h==="reverse"?"1":"0":i.style.opacity="",be&&(i.style.stroke=be),ae!==null&&(i.style.strokeWidth=`${ae}`),ve!==null&&(i.style.fillOpacity=`${ve}`),D&&i.tagName.toLowerCase()==="path"&&B[f]&&i.setAttribute("d",B[f]);});}function Be(i,f){let d=i.getAttribute("d"),w=rt(i);if(D&&B[f]){i.setAttribute("d",D);let j=rt(i);i.setAttribute("d",B[f]),w=Math.max(rt(i),j),i.setAttribute("d",d);}p[f]=w,i.style.strokeDasharray=nt(w);}if(c.forEach((i,f)=>{Cr(i);let d=i.tagName.toLowerCase()==="path";d?B.push(i.getAttribute("d")??""):B.push(""),Be(i,f);let w=p[f];D&&(d?$r(B[B.length-1],D,i):N(`morphTo only applies to <path> elements \u2014 ignored on <${i.tagName}>.`,i)),r?(i.style.strokeDashoffset=h==="reverse"?`${w}`:"0",u&&(i.style.opacity="1"),we&&(i.style.stroke=we),Ae!==null&&(i.style.strokeWidth=`${Ae}`),le!==null&&(i.style.fillOpacity=`${le}`),D&&i.tagName.toLowerCase()==="path"&&i.setAttribute("d",D)):(i.style.strokeDashoffset=h==="reverse"?"0":`${w}`,u?i.style.opacity=h==="reverse"?"1":"0":i.style.opacity="",be&&(i.style.stroke=be),ae!==null&&(i.style.strokeWidth=`${ae}`),ve!==null&&(i.style.fillOpacity=`${ve}`));}),r)return ee&&(e.style.clipPath=Ee(1)),re?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};ee&&(e.style.clipPath=Ee(h==="reverse"?1:0));let $t=typeof m=="string"?st(m):null;function mr(){return !(We===false||S||z&&Ve||!Ar()||!c.length||!$t||ee||E!=="y"||G||l!==1||v!==0||M||Z||C!==false||D||A||ue||L>0||Oe||K||re||ye||Re||he||me||P!=null||_!=null||W!=null||(y.start||"top bottom").trim()!=="top bottom"||(y.end||"bottom top").trim()!=="bottom top")}function pr(){let i=++Lr,f=`svg-scroll-draw-${i}`,d=`svg-scroll-draw-host-${i}`,w=`--svg-scroll-draw-${i}`,j=h==="reverse"?"0":"var(--ssd-len)",ne=h==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${j};`,k=`stroke-dashoffset:${ne};`;u&&(Y+=`opacity:${h==="reverse"?1:0};`,k+=`opacity:${h==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${f}{from{${Y}}to{${k}}}.${d}{view-timeline-name:${w};view-timeline-axis:block;}.${f}{animation-name:${f};animation-duration:auto;animation-timing-function:${$t};animation-fill-mode:both;animation-timeline:${w};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(d);function te(b,x){b.style.setProperty("--ssd-len",String(p[x])),b.style.strokeDasharray=nt(p[x]),b.style.strokeDashoffset="",b.style.opacity="",b.style.animationPlayState="",b.classList.add(f);}c.forEach(te);let X=false,oe=-1;function ie(){if(oe>=0)return oe;let b=e.getBoundingClientRect(),{tStart:x,tEnd:J}=de({top:b.top,height:b.height},et(),Lt(),Ne,Ge);return U(V(et(),x,J,l))}return {destroy(){e.classList.remove(d),c.forEach(b=>{b.classList.remove(f),b.style.removeProperty("--ssd-len"),b.style.animationPlayState="";}),I.remove();},replay(){X=false,oe=-1,c.forEach(te);},pause(){X=true,c.forEach(b=>{b.style.animationPlayState="paused";});},resume(){X&&(X=false,c.forEach(b=>{b.style.animationPlayState="running";}));},seek(b){let x=Math.min(1,Math.max(0,b));oe=x,X=true,c.forEach((J,Me)=>{J.classList.remove(f),J.style.strokeDashoffset=h==="reverse"?`${p[Me]*x}`:`${p[Me]*(1-x)}`,u&&(J.style.opacity=h==="reverse"?`${1-x}`:`${x}`);});},getProgress(){return ie()},refresh(){c.forEach((b,x)=>{Be(b,x),b.style.setProperty("--ssd-len",String(p[x]));});}}}if(mr())return gt(pr());function dr(){let i=Math.max(1,ge),f=ee?i:i*(1+Math.max(0,c.length-1)*v),d=0,w=0,j=false;function ne(oe){let ie=true,b=Math.min(1,Math.max(0,oe/f));if(ee){let x=Math.min(1,Math.max(0,oe/i)),J=U(x);pe=J,e.style.setProperty("--scroll-draw-progress",String(J)),e.style.clipPath=Ee(h==="reverse"?1-J:J),Oe?.(J),x<1&&(ie=false);}else {c.forEach((J,Me)=>{let yr=Me*v*i,Ht=Math.min(1,Math.max(0,(oe-yr)/i));yt(J,Me,U(Ht),h),Ht<1&&(ie=false);});let x=U(b);pe=x,Oe?.(x),e.style.setProperty("--scroll-draw-progress",String(x));}if(A){let x=U(b);for(let J in A){let Me=parseFloat(J);x>=Me&&!He.has(Me)&&(He.add(Me),A[J]?.());}}return ie}function Y(oe){if(se)return;let ie=oe-d;Se||(Se=true,K?.());let b=ne(ie);if(b&&!q){q=true,ne(f),re?.(),ke<(ue==="infinite"?1/0:ue??0)&&(ke++,Ie=setTimeout(()=>{d=performance.now(),Se=false,q=false,He.clear(),ht(),Te=requestAnimationFrame(Y);},Q));return}b||(Te=requestAnimationFrame(Y));}function k(){cancelAnimationFrame(Te),clearTimeout(Ie),d=performance.now(),w=0,se=false,Se=false,q=false,ke=0,j=true,pe=0,He.clear(),ht(),Te=requestAnimationFrame(Y);}let I=new IntersectionObserver(oe=>{oe.forEach(ie=>{ie.isIntersecting&&!(M&&q)?k():!ie.isIntersecting&&!M&&!q&&(cancelAnimationFrame(Te),clearTimeout(Ie),j=false);});},{root:G??null,threshold:H,rootMargin:fe}),te;function X(){clearTimeout(te),te=setTimeout(()=>c.forEach(Be),150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),L>0?setTimeout(()=>I.observe(e),L):I.observe(e),{destroy(){cancelAnimationFrame(Te),clearTimeout(Ie),I.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(te);},replay(){ke=0,k();},pause(){se||!j||(se=true,w=performance.now()-d,cancelAnimationFrame(Te));},resume(){se&&(se=false,j=true,d=performance.now()-w,Te=requestAnimationFrame(Y));},seek(oe){let ie=Math.min(1,Math.max(0,oe));pe=ie,se=true,w=ie*f,d=performance.now()-w,cancelAnimationFrame(Te),ne(w);},getProgress(){return pe},refresh(){clearTimeout(te),c.forEach(Be);}}}if(S)return gt(dr());Ct();let Dt=()=>V(et(),O,Ce,1);function Ot(){q=true,re?.(),ke<(ue==="infinite"?1/0:ue)&&(ke++,Ie=setTimeout(()=>{pt=true;},Q));}function kt(){mt=-1,Je=[],Se=false,q=false,pt=false,He.clear(),ht(),Fe=true;}function gr(){let i=performance.now(),f=et();if(pt&&Dt()%1&&kt(),!Fe&&C===false&&f===Mt)return;Fe=false,Mt=f;let d=l;if(C!==false){let k=i-xt,I=k>0?Math.abs(f-(Ke<0?f:Ke))/k:0;d=l*Math.max(.2,1+I*(typeof C=="number"?C:1)*.04);}Ke=f,xt=i;let w=Z?Ze===-1||f>=Ze?"forward":"reverse":h;Ze=f;let j=$-T,ne=true,Y=j===0?0:(f-T)/j;if(isNaN(_e)||(_e<=0&&Y>0&&ye?.(),_e<1&&Y>=1&&Re?.(),_e>=1&&Y<1&&he?.(),_e>0&&Y<=0&&me?.()),_e=Y,ee){let k=Pt(0,V(f,T,$,d));pe=k,e.style.setProperty("--scroll-draw-progress",String(k));let I=w==="reverse"?1-k:k;e.style.clipPath=Ee(I),Oe?.(k),!Se&&V(f,T,$,d)>0&&(Se=true,K?.()),k>=1&&!q?Ot():k<1&&!M&&(q=false);return}if(c.forEach((k,I)=>{let te=I*R*j,X=Pt(I,V(f,T+te,$+te,d));yt(k,I,X,w),I===0&&(pe=X,Oe?.(X),e.style.setProperty("--scroll-draw-progress",String(X))),X<1&&(ne=false);}),A){let k=U(V(f,T,$,d));for(let I in A){let te=parseFloat(I);k>=te&&!He.has(te)&&(He.add(te),A[I]?.());}}!Se&&V(f,T,$,d)>0&&(Se=true,K?.()),ne&&!q?Ot():!ne&&!M&&(q=false);}let qe=De(G??window,[e],Dt,gr,()=>{let i=p.join();c.forEach(Be),Ct(),Fe=true,p.join()!==i&&je();}),bt=L>0;function je(){qe.hold(se||bt);}let It;return bt&&(It=setTimeout(()=>{bt=false,je();},L)),je(),gt({destroy(){clearTimeout(Ie),clearTimeout(It),qe.off(),Tt();},replay(){kt(),Ze=-1,Ke=-1,ke=0,se=false,pe=0,clearTimeout(Ie),je();},pause(){se=true,qe.hold(true);},resume(){se&&(se=false,Fe=true,je());},seek(i){let f=Math.min(1,Math.max(0,i));pe=f,mt=f,Je=[],se=true,qe.hold(true),fr(f,h),Fe=true;},getProgress(){return pe},refresh:qe.remeasure},()=>({tStart:T,tEnd:$}))}function kr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Zt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let o=[],s=[],a=n[2].trim();if(a)for(let l of a.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}t.push({fn:n[1],nums:o,units:s});}return t}function Ir(e,t,r){let n=Zt(e),o=Zt(t);return n.length===0||n.length!==o.length?r<1?e:t:n.map((s,a)=>{let l=o[a];return s.fn!==l.fn||s.nums.length!==l.nums.length?r<1?`${s.fn}(${s.nums.map((u,m)=>`${u}${s.units[m]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,m)=>`${u}${l.units[m]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,m)=>`${u+(l.nums[m]-u)*r}${s.units[m]}`).join(", ")})`}).join(" ")}function Kt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),o=String(t);if(kr(n))return ot(n,o,r);if(n.includes("("))return Ir(n,o,r);let s=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let l=parseFloat(s[1]),u=parseFloat(a[1]);return `${l+(u-l)*r}${s[2]||a[2]}`}return r<1?n:o}function Hr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Nr=0,er="--scroll-draw-progress";function Fr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var rr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nr(e,t){return typeof window>"u"?rr:t.respectReducedMotion===false?tr(e,t,false):$e(t,(r,n)=>tr(e,r,n))}function tr(e,t,r){let{props:n,trigger:o={},easing:s="ease-out",speed:a=1,once:l=false,axis:u="y",scrollContainer:m,native:y=true,velocityScale:v=false,triggerElement:h,onProgress:M,onComplete:z,onEnter:E,onLeave:F,onEnterBack:Z,onLeaveBack:L}=t,P=Pe(s,"ease-out"),_=ce(o.start||"top bottom"),W=ce(o.end||"bottom top"),A=h??e,C=typeof m=="string"?document.querySelector(m):m??null,H=Object.entries(n).map(([c,p])=>({prop:Hr(c),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function fe(){let c=window.getComputedStyle(e);for(let p of H)p.from===""&&(p.from=c.getPropertyValue(p.prop).trim()||"0");}function ue(){for(let c of H)e.style.setProperty(c.prop,String(c.to));}let Q=new Map;for(let c of [...H.map(p=>p.prop),er])Q.set(c,e.style.getPropertyValue(c));function D(){for(let[c,p]of Q)p?e.style.setProperty(c,p):e.style.removeProperty(c);}if(r)return ue(),z?.(),{...rr,destroy:D,getProgress:()=>1};fe();let g=()=>C?u==="x"?C.scrollLeft:C.scrollTop:u==="x"?window.scrollX:window.scrollY,S=()=>C?u==="x"?C.clientWidth:C.clientHeight:u==="x"?window.innerWidth:window.innerHeight,ge=typeof s=="string"?st(s):null;function We(){if(!y||!Fr()||!ge||u!=="y"||C||A!==e||l||a!==1||M||z||E||F||Z||L||v!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let c of H)if(!Rr.has(c.prop))return false;return true}function Oe(){let c=`ssd-a-${++Nr}`,p=H.map(O=>`${O.prop}:${O.from}`).join(";"),B=H.map(O=>`${O.prop}:${O.to}`).join(";"),T=document.createElement("style");T.setAttribute("data-ssd-animate",""),T.textContent=`@keyframes ${c}{from{${p}}to{${B}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(T),e.classList.add(c);let $=()=>{let O=e.getBoundingClientRect();return de({top:O.top,height:O.height},g(),S(),_,W)};xe(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:$});let R={refresh(){},destroy(){e.classList.remove(c),T.remove(),e.style.animationPlayState="",D(),Le(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(O){let Ce=Math.min(1,Math.max(0,O));e.classList.remove(c);for(let q of H)e.style.setProperty(q.prop,Kt(q.from,q.to,Ce));},getProgress(){let{tStart:O,tEnd:Ce}=$();return P(V(g(),O,Ce,a))}};return R}if(We())return Oe();let K=0,re=0,ye=false,Re=-1,he=0,me=0,ee=false,U=NaN,Ne=-1,Ge=0,G=A===e?H:[],be=false;function we(){let c=e.style,p=G.map(R=>c.getPropertyValue(R.prop)),B=c.transition;G.length&&(c.transition="none"),G.forEach(R=>c.setProperty(R.prop,Q.get(R.prop)??""));let T=tt(A,C,u);G.forEach((R,O)=>c.setProperty(R.prop,p[O])),G.length&&(e.offsetWidth,c.transition=B);let $=de(T,T.scroll,S(),_,W);be&&Math.abs($.tStart-K)<1&&Math.abs($.tEnd-re)<1||(be=true,K=$.tStart,re=$.tEnd);}function ae(c){e.style.setProperty(er,String(c));for(let p of H)e.style.setProperty(p.prop,Kt(p.from,p.to,c));M?.(c);}function Ae(c){if(isNaN(U)){U=c;return}U<=0&&c>0&&E?.(),U<1&&c>=1&&F?.(),U>=1&&c<1&&Z?.(),U>0&&c<=0&&L?.(),U=c;}function ve(){if(ye)return;let c=performance.now(),p=g(),B=a;if(v!==false){let O=c-Ge,Ce=O>0?Math.abs(p-(Ne<0?p:Ne))/O:0;B=a*Math.max(.2,1+Ce*(typeof v=="number"?v:1)*.04);}Ne=p,Ge=c;let T=re===K?0:(p-K)/(re-K);Ae(T);let $=V(p,K,re,B),R=l?Math.max(Re,P(he=Math.max(he,$))):P($);me=R,ae(R),R>=1&&!ee?(ee=true,z?.()):R<1&&!l&&(ee=false);}let le=De(C??window,[A],()=>V(g(),K,re,Math.min(a,1)),ve,we);we(),re===K&&N("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),he=V(g(),K,re,a),me=P(he),ae(me),xe(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:K,tEnd:re})});function Ee(){ye=true,le.hold(true);}return {destroy(){ye=true,le.off(),D(),Le(e);},replay(){Re=-1,he=0,ee=false,me=0,ye=false,ae(0),le.hold(false);},pause:Ee,resume(){ye&&(ye=false,le.hold(false));},seek(c){let p=Math.min(1,Math.max(0,c));me=p,Re=p,he=0,Ee(),ae(p);},getProgress(){return me},refresh:le.remeasure}}var _r=({decimals:e,format:t})=>e!==void 0?r=>r.toFixed(e):t??(r=>String(Math.round(r)));var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,t){if(typeof window>"u")return vt;let r=typeof e=="string"?document.querySelector(e):e;return r?$e(t,(n,o)=>Vr(r,n,o)):(N("scrollCounter: element not found:",e),vt)}function Vr(e,t,r){let{from:n=0,to:o,easing:s="ease-out",trigger:a={},once:l=true,onComplete:u}=t,m=_r(t),y=Pe(s,"ease-out"),v=ce(a.start||"top 80%"),h=ce(a.end||"top 20%");if(r)return e.textContent=m(o),u?.(),{...vt,getProgress:()=>1};let M=0,z=0,E=false,F=-1,Z=0,L=0,P=false,_=()=>window.scrollY,W=()=>window.innerHeight;function A(){let g=e.getBoundingClientRect(),S=de({top:g.top,height:g.height},_(),W(),v,h);E&&Math.abs(S.tStart-M)<1&&Math.abs(S.tEnd-z)<1||(E=true,M=S.tStart,z=S.tEnd);}let C=e.style.getPropertyValue("--scroll-draw-progress");function H(g){e.textContent=m(n+(o-n)*g),e.style.setProperty("--scroll-draw-progress",String(g));}let fe=()=>V(_(),M,z,1);function ue(){let g=fe(),S=l?Math.max(F,y(Z=Math.max(Z,g))):y(g);L=S,H(S),S>=1&&!P?(P=true,u?.()):S<1&&!l&&(P=false);}A();{Z=V(_(),M,z,1);let g=y(Z);L=g,H(g);}let Q=De(window,[e],fe,ue,A);xe(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:M,tEnd:z})});let D=()=>Q.hold(false);return {destroy(){Q.off(),e.style.setProperty("--scroll-draw-progress",C),Le(e);},replay(){F=-1,Z=0,P=false,L=0,H(0),D();},pause:()=>Q.hold(true),resume:D,seek(g){let S=Math.min(1,Math.max(0,g));L=S,F=S,Z=0,Q.hold(true),H(S);},getProgress(){return L}}}function sr(e,t){let r=document.createElement("span");r.textContent=t,r.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(r);}function ct(e=""){let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=e,t}function ar(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(r=>{let n=e.appendChild(ct(r)),o=/^\s+$/.test(r);return o?n.style.whiteSpace="pre":n.style.display="inline-block",o?null:n}).filter(r=>r!==null)}function zr(e){let t=e.textContent??"";e.textContent="";let r=[],n=null;for(let o of t){let s=ct(o),a=o===" ";a?s.style.whiteSpace="pre":(s.style.display="inline-block",r.push(s)),a||o>"\u0DFF"?n=null:n||(n=e.appendChild(ct()),n.style.cssText="display:inline-block;white-space:nowrap"),(n??e).appendChild(s);}return r}function ir(e){let t=ar(e),r=new Map;for(let s of t){let a=s.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(s);}let n=[],o=Array.from(r.keys()).sort((s,a)=>s-a);for(let s of o){let a=r.get(s),l=ct();l.style.display="inline-block",a.forEach((u,m)=>{let y=u.nextElementSibling;l.appendChild(u),m<a.length-1&&y&&y.style.whiteSpace==="pre"&&l.appendChild(y);}),n.push(l);}return e.textContent="",n.forEach((s,a)=>{e.appendChild(s),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function Wr(e,t,r,n){if(r<=1||n===0)return e;n=Math.min(n,1/r);let o=(r-1)*n,s=t*n,a=s+(1-o);return a<=s?e>=s?1:0:Qe((e-s)/(a-s),0,1)}function Gr(e,t){let r=[];if(t?.y!==void 0&&r.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&r.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&r.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let n=t.scale+(1-t.scale)*e;r.push(`scale(${n})`);}return r.join(" ")}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lr(e,t={}){if(typeof window>"u")return Et;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return N("scrollText: element not found:",e),Et;let n=r;return $e(t,(o,s)=>Br(n,o,s))}function Br(e,t,r){let{split:n="words",stagger:o=.04,easing:s="ease-out",from:a={opacity:0,y:24},trigger:l={},once:u=true,onComplete:m}=t,y=Pe(s,"ease-out"),v=ce(l.start||"top 85%"),h=ce(l.end||"top 40%"),M=e.innerHTML,z=e.textContent??"",E;n==="chars"?E=zr(e):n==="lines"?E=ir(e):E=ar(e),sr(e,z);let F=E.length;function Z(g,S){a?.opacity!==void 0&&(g.style.opacity=String(a.opacity+(1-a.opacity)*S));let ge=Gr(S,a);ge&&(g.style.transform=ge);}function L(g){e.style.setProperty("--scroll-draw-progress",String(g)),E.forEach((S,ge)=>{let We=y(Wr(g,ge,F,o));Z(S,We);});}if(r)return L(1),m?.(),{...Et,destroy:()=>{e.innerHTML=M;},getProgress:()=>1};L(0);let P=0,_=0,W=-1,A=0,C=false;function H(){({tStart:P,tEnd:_}=de(e.getBoundingClientRect(),window.scrollY,window.innerHeight,v,h));}let fe=()=>V(window.scrollY,P,_,1);function ue(){let g=u?W=Math.max(W,fe()):fe();A=g,L(g),g>=1&&!C?(C=true,m?.()):g<1&&!u&&(C=false);}H();let Q=De(window,[e],fe,ue,()=>{n==="lines"&&(e.innerHTML=M,E=ir(e),sr(e,z),L(A)),H();});xe(e,{type:"text",getProgress:()=>A,getTrigger:()=>({tStart:P,tEnd:_})});let D=()=>Q.hold(false);return {destroy(){Q.off(),e.innerHTML=M,Le(e);},replay(){W=-1,C=false,A=0,L(0),D();},pause:()=>Q.hold(true),resume:D,seek(g){Q.hold(true),L(A=W=Qe(g,0,1));},getProgress(){return A}}}function qr(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?lt(n,t):(N("Container not found:",e),r)}function Xe(){return typeof document>"u"?null:document}var St=new WeakMap,cr;function ut(e,t,r,n){let o=St.get(e)??new Map;St.set(e,o);let s=()=>{let u=r(),m=o.get(t);m&&m.key===u||(m?.inst.destroy(),o.set(t,{inst:n(u),key:u,build:s,users:m?.users??0}));};s(),o.get(t).users++;let a=true;typeof MutationObserver<"u"&&(cr??(cr=new MutationObserver(u=>u.forEach(m=>St.get(m.target)?.forEach(y=>y.build())))),cr.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(u=>`data-scroll-${u}-options`).concat("data-scroll-drawoptions")}));let l=()=>o.get(t)?.inst;return {destroy:()=>{let u=o.get(t);!a||!u||(a=false,!(--u.users>0)&&(u.inst.destroy(),o.delete(t)));},replay:()=>l()?.replay(),pause:()=>l()?.pause(),resume:()=>l()?.resume(),seek:u=>l()?.seek(u),getProgress:()=>l()?.getProgress()??0,refresh:()=>l()?.refresh?.()}}function ft(e,t){try{return e?JSON.parse(e):t}catch{return t}}function jr(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(t=>ut(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",r=>lt(t,ft(r,{})))):[]}function Qr(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(t=>ut(t,"animate",()=>t.dataset.scrollAnimateOptions??"",r=>nr(t,ft(r,{props:{}})))):[]}function Ur(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(t=>ut(t,"counter",()=>t.dataset.scrollCounterOptions??"",r=>{let n=ft(r,{});return !n.to&&n.to!==0&&(N('initScrollCounter: element missing "to" in options JSON:',t),n.to=0),typeof n.format!="function"&&n.format!==void 0&&(N('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete n.format),or(t,n)})):[]}function Yr(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(t=>ut(t,"text",()=>t.dataset.scrollTextOptions??"",r=>lr(t,ft(r,{})))):[]}function co(e=Xe()){return {draw:jr(e),animate:Qr(e),counter:Ur(e),text:Yr(e)}}exports.initAll=co;exports.initScrollAnimate=Qr;exports.initScrollCounter=Ur;exports.initScrollDraw=jr;exports.initScrollText=Yr;exports.scrollDraw=qr;
|
package/dist/astro/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ScrollDrawInstance } from '../types-
|
|
2
|
-
export { a as ScrollDrawOptions } from '../types-
|
|
3
|
-
export { s as scrollDraw } from '../scroll-draw-
|
|
1
|
+
import { S as ScrollDrawInstance } from '../types-iITMwrru.mjs';
|
|
2
|
+
export { a as ScrollDrawOptions } from '../types-iITMwrru.mjs';
|
|
3
|
+
export { s as scrollDraw } from '../scroll-draw-CKZysh22.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Auto-initialises all elements with a [data-scroll-draw] attribute on the page.
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ScrollDrawInstance } from '../types-
|
|
2
|
-
export { a as ScrollDrawOptions } from '../types-
|
|
3
|
-
export { s as scrollDraw } from '../scroll-draw-
|
|
1
|
+
import { S as ScrollDrawInstance } from '../types-iITMwrru.js';
|
|
2
|
+
export { a as ScrollDrawOptions } from '../types-iITMwrru.js';
|
|
3
|
+
export { s as scrollDraw } from '../scroll-draw-DbY8RUJE.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Auto-initialises all elements with a [data-scroll-draw] attribute on the page.
|
package/dist/astro/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollDraw}from'../chunk-
|
|
1
|
+
export{a as scrollDraw}from'../chunk-5U4JXBHR.mjs';import {a as a$1}from'../chunk-UF3MO5XQ.mjs';import {b as b$2}from'../chunk-OGFXZCKC.mjs';import {a}from'../chunk-HAGTU5EX.mjs';import {b}from'../chunk-XLXVGQ3P.mjs';import'../chunk-7LDSB4FT.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-YOOPMYT6.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-IXR6RML7.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import {b as b$1}from'../chunk-LFSU6LR3.mjs';function i(){return typeof document>"u"?null:document}var p=new WeakMap,g;function c(r,t,n,o){let l=p.get(r)??new Map;p.set(r,l);let f=()=>{let e=n(),s=l.get(t);s&&s.key===e||(s?.inst.destroy(),l.set(t,{inst:o(e),key:e,build:f,users:s?.users??0}));};f(),l.get(t).users++;let S=true;typeof MutationObserver<"u"&&(g??(g=new MutationObserver(e=>e.forEach(s=>p.get(s.target)?.forEach(O=>O.build())))),g.observe(r,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(e=>`data-scroll-${e}-options`).concat("data-scroll-drawoptions")}));let a=()=>l.get(t)?.inst;return {destroy:()=>{let e=l.get(t);!S||!e||(S=false,!(--e.users>0)&&(e.inst.destroy(),l.delete(t)));},replay:()=>a()?.replay(),pause:()=>a()?.pause(),resume:()=>a()?.resume(),seek:e=>a()?.seek(e),getProgress:()=>a()?.getProgress()??0,refresh:()=>a()?.refresh?.()}}function u(r,t){try{return r?JSON.parse(r):t}catch{return t}}function E(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-draw]")).map(t=>c(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",n=>b(t,u(n,{})))):[]}function A(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-animate]")).map(t=>c(t,"animate",()=>t.dataset.scrollAnimateOptions??"",n=>a(t,u(n,{props:{}})))):[]}function I(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-counter]")).map(t=>c(t,"counter",()=>t.dataset.scrollCounterOptions??"",n=>{let o=u(n,{});return !o.to&&o.to!==0&&(b$1('initScrollCounter: element missing "to" in options JSON:',t),o.to=0),typeof o.format!="function"&&o.format!==void 0&&(b$1('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete o.format),b$2(t,o)})):[]}function M(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-text]")).map(t=>c(t,"text",()=>t.dataset.scrollTextOptions??"",n=>a$1(t,u(n,{})))):[]}function H(r=i()){return {draw:E(r),animate:A(r),counter:I(r),text:M(r)}}export{H as initAll,A as initScrollAnimate,I as initScrollCounter,E as initScrollDraw,M as initScrollText};
|
|
@@ -32,6 +32,28 @@ var SvgScrollDraw = (() => {
|
|
|
32
32
|
scrollParallax: () => scrollParallax
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
// src/core/env.ts
|
|
36
|
+
var IS_DEV = (
|
|
37
|
+
/*
|
|
38
|
+
* Build-time override, substituted as a literal by the two CDN builds.
|
|
39
|
+
*
|
|
40
|
+
* The `process` test below is unanswerable without a bundler — `process` does
|
|
41
|
+
* not exist in a browser — so `IS_DEV` was false for every CDN user, the people
|
|
42
|
+
* least likely to have any other diagnostics available. Every warning this
|
|
43
|
+
* library has was invisible to exactly them, including the zero-length trigger
|
|
44
|
+
* window that would have caught the `scrollHorizontal` defect.
|
|
45
|
+
*
|
|
46
|
+
* `svg-scroll-draw.dev.global.js` defines this to `true`; the production CDN
|
|
47
|
+
* build defines it to `false`, which also lets the minifier drop the warning
|
|
48
|
+
* bodies outright. Left undefined for the npm builds, where the `process` test
|
|
49
|
+
* is the right one and bundlers fold it away.
|
|
50
|
+
*/
|
|
51
|
+
true ? true : typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.NODE_ENV !== "production"
|
|
52
|
+
);
|
|
53
|
+
function warn(msg, ...rest) {
|
|
54
|
+
if (IS_DEV) console.warn(`[svg-scroll-draw] ${msg}`, ...rest);
|
|
55
|
+
}
|
|
56
|
+
|
|
35
57
|
// src/core/easing.ts
|
|
36
58
|
function createSpring({
|
|
37
59
|
tension = 2.5,
|
|
@@ -98,6 +120,39 @@ var SvgScrollDraw = (() => {
|
|
|
98
120
|
bounce: createBounce(),
|
|
99
121
|
elastic: createElastic()
|
|
100
122
|
};
|
|
123
|
+
function cubicBezier(x1, y1, x2, y2) {
|
|
124
|
+
const at = (a, b, u) => ((1 + 3 * a - 3 * b) * u + 3 * b - 6 * a) * u * u + 3 * a * u;
|
|
125
|
+
return (x) => {
|
|
126
|
+
if (x <= 0 || x >= 1) return +(x > 0);
|
|
127
|
+
let u = x;
|
|
128
|
+
for (let i = 0; i < 8; i++)
|
|
129
|
+
u -= (at(x1, x2, u) - x) / ((3 * (1 + 3 * x1 - 3 * x2) * u + 6 * x2 - 12 * x1) * u + 3 * x1);
|
|
130
|
+
if (!(u >= 0 && u <= 1 && Math.abs(at(x1, x2, u) - x) < 1e-9))
|
|
131
|
+
for (let i = 0, lo = 0, hi = 1; i < 30; i++) {
|
|
132
|
+
u = (lo + hi) / 2;
|
|
133
|
+
if (at(x1, x2, u) < x) lo = u;
|
|
134
|
+
else hi = u;
|
|
135
|
+
}
|
|
136
|
+
return at(y1, y2, u);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function cssEasing(s) {
|
|
140
|
+
const m = /^cubic-bezier\((.*)\)$/.exec(s === "ease" ? "cubic-bezier(.25,.1,.25,1)" : s.trim());
|
|
141
|
+
const v = m ? m[1].split(",").map(parseFloat) : [];
|
|
142
|
+
if (v.length === 4 && v.every(Number.isFinite) && v[0] * (1 - v[0]) >= 0 && v[2] * (1 - v[2]) >= 0)
|
|
143
|
+
return [cubicBezier(v[0], v[1], v[2], v[3]), `cubic-bezier(${v})`];
|
|
144
|
+
}
|
|
145
|
+
var warned = /* @__PURE__ */ new Set();
|
|
146
|
+
function resolveEasing(easing, fallback = "linear") {
|
|
147
|
+
if (typeof easing === "function") return easing;
|
|
148
|
+
if (easing == null) return EASINGS[fallback];
|
|
149
|
+
if ({}.hasOwnProperty.call(EASINGS, easing)) return EASINGS[easing];
|
|
150
|
+
const css = cssEasing(String(easing));
|
|
151
|
+
if (css) return css[0];
|
|
152
|
+
if (!warned.has(easing) && warned.add(easing))
|
|
153
|
+
warn(`Unknown easing ${JSON.stringify(easing)}: use a name, cubic-bezier() or a function.`);
|
|
154
|
+
return EASINGS[fallback];
|
|
155
|
+
}
|
|
101
156
|
|
|
102
157
|
// src/core/math.ts
|
|
103
158
|
function clamp(value, min, max) {
|
|
@@ -160,6 +215,11 @@ var SvgScrollDraw = (() => {
|
|
|
160
215
|
return el.getTotalLength();
|
|
161
216
|
}
|
|
162
217
|
|
|
218
|
+
// src/core/dash.ts
|
|
219
|
+
function dashFor(len) {
|
|
220
|
+
return `${len} ${len * 2}`;
|
|
221
|
+
}
|
|
222
|
+
|
|
163
223
|
// src/core/color.ts
|
|
164
224
|
function parseColor(color) {
|
|
165
225
|
const short = /^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(color);
|
|
@@ -231,28 +291,6 @@ var SvgScrollDraw = (() => {
|
|
|
231
291
|
}
|
|
232
292
|
};
|
|
233
293
|
|
|
234
|
-
// src/core/env.ts
|
|
235
|
-
var IS_DEV = (
|
|
236
|
-
/*
|
|
237
|
-
* Build-time override, substituted as a literal by the two CDN builds.
|
|
238
|
-
*
|
|
239
|
-
* The `process` test below is unanswerable without a bundler — `process` does
|
|
240
|
-
* not exist in a browser — so `IS_DEV` was false for every CDN user, the people
|
|
241
|
-
* least likely to have any other diagnostics available. Every warning this
|
|
242
|
-
* library has was invisible to exactly them, including the zero-length trigger
|
|
243
|
-
* window that would have caught the `scrollHorizontal` defect.
|
|
244
|
-
*
|
|
245
|
-
* `svg-scroll-draw.dev.global.js` defines this to `true`; the production CDN
|
|
246
|
-
* build defines it to `false`, which also lets the minifier drop the warning
|
|
247
|
-
* bodies outright. Left undefined for the npm builds, where the `process` test
|
|
248
|
-
* is the right one and bundlers fold it away.
|
|
249
|
-
*/
|
|
250
|
-
true ? true : typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.NODE_ENV !== "production"
|
|
251
|
-
);
|
|
252
|
-
function warn(msg, ...rest) {
|
|
253
|
-
if (IS_DEV) console.warn(`[svg-scroll-draw] ${msg}`, ...rest);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
294
|
// src/core/css-easing.ts
|
|
257
295
|
var QUAD_IN = "cubic-bezier(0.333333, 0, 0.666667, 0.333333)";
|
|
258
296
|
var QUAD_OUT = "cubic-bezier(0.333333, 0.666667, 0.666667, 1)";
|
|
@@ -279,7 +317,7 @@ var SvgScrollDraw = (() => {
|
|
|
279
317
|
case "ease-in-out":
|
|
280
318
|
return supportsLinearTiming() ? sampleAsLinear(EASINGS["ease-in-out"]) : null;
|
|
281
319
|
default:
|
|
282
|
-
return null;
|
|
320
|
+
return cssEasing(easing)?.[1] ?? null;
|
|
283
321
|
}
|
|
284
322
|
}
|
|
285
323
|
|
|
@@ -569,7 +607,7 @@ var SvgScrollDraw = (() => {
|
|
|
569
607
|
onLeaveBack
|
|
570
608
|
} = options;
|
|
571
609
|
const clipDirection = clip === true ? "left" : typeof clip === "string" ? clip : false;
|
|
572
|
-
const easeFn =
|
|
610
|
+
const easeFn = resolveEasing(easing);
|
|
573
611
|
const startConfig = parseTrigger(trigger.start || "top bottom");
|
|
574
612
|
const endConfig = parseTrigger(trigger.end || "bottom top");
|
|
575
613
|
const scrollEl = typeof scrollContainer === "string" ? document.querySelector(scrollContainer) : scrollContainer ?? null;
|
|
@@ -703,7 +741,7 @@ var SvgScrollDraw = (() => {
|
|
|
703
741
|
return;
|
|
704
742
|
}
|
|
705
743
|
paths.forEach((el, i) => {
|
|
706
|
-
el.style.strokeDasharray =
|
|
744
|
+
el.style.strokeDasharray = dashFor(lengths[i]);
|
|
707
745
|
el.style.strokeDashoffset = direction === "reverse" ? "0" : `${lengths[i]}`;
|
|
708
746
|
if (fade) el.style.opacity = direction === "reverse" ? "1" : "0";
|
|
709
747
|
else el.style.opacity = "";
|
|
@@ -725,7 +763,7 @@ var SvgScrollDraw = (() => {
|
|
|
725
763
|
el.setAttribute("d", d);
|
|
726
764
|
}
|
|
727
765
|
lengths[i] = len;
|
|
728
|
-
el.style.strokeDasharray =
|
|
766
|
+
el.style.strokeDasharray = dashFor(len);
|
|
729
767
|
}
|
|
730
768
|
paths.forEach((el, i) => {
|
|
731
769
|
checkElement(el);
|
|
@@ -814,7 +852,7 @@ var SvgScrollDraw = (() => {
|
|
|
814
852
|
container.classList.add(containerCls);
|
|
815
853
|
function attach(el, i) {
|
|
816
854
|
el.style.setProperty("--ssd-len", String(lengths[i]));
|
|
817
|
-
el.style.strokeDasharray =
|
|
855
|
+
el.style.strokeDasharray = dashFor(lengths[i]);
|
|
818
856
|
el.style.strokeDashoffset = "";
|
|
819
857
|
el.style.opacity = "";
|
|
820
858
|
el.style.animationPlayState = "";
|
|
@@ -1343,7 +1381,7 @@ var SvgScrollDraw = (() => {
|
|
|
1343
1381
|
onEnterBack,
|
|
1344
1382
|
onLeaveBack
|
|
1345
1383
|
} = options;
|
|
1346
|
-
const easeFn =
|
|
1384
|
+
const easeFn = resolveEasing(easing, "ease-out");
|
|
1347
1385
|
const startConfig = parseTrigger(trigger.start || "top bottom");
|
|
1348
1386
|
const endConfig = parseTrigger(trigger.end || "bottom top");
|
|
1349
1387
|
const triggerEl = triggerElement ?? el;
|
|
@@ -1651,6 +1689,7 @@ var SvgScrollDraw = (() => {
|
|
|
1651
1689
|
}
|
|
1652
1690
|
|
|
1653
1691
|
// src/counter/index.ts
|
|
1692
|
+
var formatter = ({ decimals, format }) => decimals !== void 0 ? (n) => n.toFixed(decimals) : format ?? ((n) => String(Math.round(n)));
|
|
1654
1693
|
var NOOP3 = {
|
|
1655
1694
|
destroy: () => {
|
|
1656
1695
|
},
|
|
@@ -1677,15 +1716,13 @@ var SvgScrollDraw = (() => {
|
|
|
1677
1716
|
const {
|
|
1678
1717
|
from = 0,
|
|
1679
1718
|
to,
|
|
1680
|
-
format,
|
|
1681
1719
|
easing = "ease-out",
|
|
1682
1720
|
trigger = {},
|
|
1683
1721
|
once = true,
|
|
1684
|
-
decimals,
|
|
1685
1722
|
onComplete
|
|
1686
1723
|
} = options;
|
|
1687
|
-
const fmt =
|
|
1688
|
-
const easeFn =
|
|
1724
|
+
const fmt = formatter(options);
|
|
1725
|
+
const easeFn = resolveEasing(easing, "ease-out");
|
|
1689
1726
|
const startConfig = parseTrigger(trigger.start || "top 80%");
|
|
1690
1727
|
const endConfig = parseTrigger(trigger.end || "top 20%");
|
|
1691
1728
|
if (prefersReduced) {
|
|
@@ -1787,7 +1824,7 @@ var SvgScrollDraw = (() => {
|
|
|
1787
1824
|
return Number.isFinite(n) ? clamp01(n / 100) : 0;
|
|
1788
1825
|
}
|
|
1789
1826
|
function easeOf(name) {
|
|
1790
|
-
return
|
|
1827
|
+
return resolveEasing(name);
|
|
1791
1828
|
}
|
|
1792
1829
|
var still = (progress) => ({ destroy() {
|
|
1793
1830
|
}, getProgress: () => progress });
|
|
@@ -1837,7 +1874,7 @@ var SvgScrollDraw = (() => {
|
|
|
1837
1874
|
path.setAttribute("stroke-linecap", "round");
|
|
1838
1875
|
path.setAttribute("stroke-linejoin", "round");
|
|
1839
1876
|
const len = a.length || path.getTotalLength?.() || 0;
|
|
1840
|
-
path.style.strokeDasharray =
|
|
1877
|
+
path.style.strokeDasharray = dashFor(len);
|
|
1841
1878
|
path.style.strokeDashoffset = String(len);
|
|
1842
1879
|
svg.appendChild(path);
|
|
1843
1880
|
records.push({
|