svg-scroll-draw 2.25.0 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +69 -31
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-5SJE7725.mjs +1 -0
- 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-IXR6RML7.mjs +1 -0
- package/dist/chunk-KN2YB54Z.mjs +1 -0
- package/dist/chunk-NJV6S5LD.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/chunk-Z72TVDHY.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/react/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var an=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var an__default=/*#__PURE__*/_interopDefault(an);var Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function z(e,...n){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function Lr({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function Cr({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(r),s=0,i=[];for(let p=0;p<t;p++){let y=Math.pow(o,p);i.push(y),s+=y;}let l=[0],c=0;for(let p=0;p<t;p++)c+=i[p]/s,l.push(c);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let y=0;y<t;y++)if(p<=l[y+1]){let v=(p-l[y])/(l[y+1]-l[y]);if(y===0)return v*(2-v);let S=1-Math.pow(r,y);return S+(1-S)*(2*v-1)*(2*v-1)}return 1}}function Ar({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),o=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var Je={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:Lr(),bounce:Cr(),elastic:Ar()};function kr(e,n,t,r){let o=(s,i,l)=>((1+3*s-3*i)*l+3*i-6*s)*l*l+3*s*l;return s=>{if(s<=0||s>=1)return +(s>0);let i=s;for(let l=0;l<8;l++)i-=(o(e,t,i)-s)/((3*(1+3*e-3*t)*i+6*t-12*e)*i+3*e);if(!(i>=0&&i<=1&&Math.abs(o(e,t,i)-s)<1e-9))for(let l=0,c=0,p=1;l<30;l++)i=(c+p)/2,o(e,t,i)<s?c=i:p=i;return o(n,r,i)}}function xt(e){let n=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=n?n[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [kr(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var It=new Set;function Le(e,n="linear"){if(typeof e=="function")return e;if(e==null)return Je[n];if({}.hasOwnProperty.call(Je,e))return Je[e];let t=xt(String(e));return t?t[0]:(!It.has(e)&&It.add(e)&&z(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),Je[n])}function st(e,n,t){return Math.min(t,Math.max(n,e))}function ee(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}var zt=(e,n)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:n;function _t(e,n,t,r){return e+t+n*zt(r,0)}function Vt(e,n){return n*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:zt(e,1))}function j(e,n,t,r){return t===n?0:st((e-n)/(t-n)*r,0,1)}function he(e,n,t,r,o){let s=_t(e.top,e.height,n,r.element)-Vt(r.viewport,t),i=_t(e.top,e.height,n,o.element)-Vt(o.viewport,t);return {tStart:s,tEnd:i}}function Ze(e,n,t){let r=e.getBoundingClientRect(),o=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left-n.clientLeft+n.scrollLeft:r.top-n.getBoundingClientRect().top-n.clientTop+n.scrollTop,height:o,scroll:0}:{top:t==="x"?r.left:r.top,height:o,scroll:t==="x"?window.scrollX:window.scrollY}}function mt(e){let n=parseFloat(e.getAttribute("pathLength")??"");if(n>0)return n;let t=e.tagName.toLowerCase();if(t==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),o=parseFloat(e.getAttribute("height")??"0");return 2*(r+o)}if(t==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function pt(e){return `${e} ${e*2}`}function Wt(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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function dt(e,n,t){let r=Wt(e),o=Wt(n);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*t)},${Math.round(r[1]+(o[1]-r[1])*t)},${Math.round(r[2]+(o[2]-r[2])*t)})`}var Gt={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 Or="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",$r="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Bt=33;function Rr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fr(e){let n=[];for(let t=0;t<Bt;t++){let r=t/(Bt-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function gt(e){switch(e){case "linear":return "linear";case "ease-in":return Or;case "ease-out":return $r;case "ease-in-out":return Rr()?Fr(Je["ease-in-out"]):null;default:return xt(e)?.[1]??null}}var jt=Symbol.for("svg-scroll-draw.registry");function qt(){let e=globalThis;return e[jt]||(e[jt]=new Map)}function $e(e,n){qt().set(e,n);}function Re(e){qt().delete(e);}function Be(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}function je(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=Be(s=>{if(!s)return;r();let i=(t.getProgress?.()??0)>=1;t.destroy(),t=n(i?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(t))o[s]=(...i)=>t[s]?.(...i);return o.destroy=()=>{r(),t.destroy();},o}var it,ht=new Set,yt=new WeakMap,at=new Map,Ut=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function Hr(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function Yt(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();it??(it=new ResizeObserver(o=>{let s=false;for(let{target:i}of o)yt.get(i)!==Ut(i)&&(s=true),yt.set(i,"");s&&ht.forEach(i=>i());})),ht.add(t);let r=Hr(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{yt.has(o)||yt.set(o,Ut(o)),at.set(o,(at.get(o)??0)+1),it.observe(o);}),()=>{ht.delete(t)&&(r.forEach(o=>{let s=(at.get(o)??1)-1;if(s)return void at.set(o,s);at.delete(o),it?.unobserve(o);}),ht.size||(it?.disconnect(),it=void 0));}}function Ce(e,n,t,r,o){let s,i=NaN,l,c,p=()=>{s=0,r(),!l&&!s&&(i=t())>0&&i<1&&(s=requestAnimationFrame(p));},y=()=>{!s&&!l&&t()!==i&&(s=requestAnimationFrame(p));},v=R=>{l=R,cancelAnimationFrame(s),s=i=NaN,y();},S=()=>{clearTimeout(c),o(),y();},W=()=>{clearTimeout(c),c=setTimeout(S,150);},B=Yt(n,W),b=R=>{e[R]("scroll",y,{passive:true}),window[R]("resize",W),window[R]("orientationchange",W);};return b("addEventListener"),y(),{hold:v,remeasure:S,off(){v(true),b("removeEventListener"),B(),clearTimeout(c);}}}var Nr=0;function Dr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e,n){let t="";try{t=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return t||(e.getAttribute(n)??"").trim()}var Xt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ir(e){if(!Ke)return;let n=Qt(e,"stroke");if(!n||n==="none"){z("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Xt.has(t)&&!Xt.has(Qt(e,"fill"))&&z("Element has a fill \u2014 it may obscure the stroke animation.",e);}function _r(e,n,t){let r=document.createElement("div");r.setAttribute("data-svg-scroll-draw-debug",""),r.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=t==="x"?window.scrollX:window.scrollY,i=e-s,l=n-s,c=t==="x";r.innerHTML=`
|
|
3
3
|
<div style="position:absolute;${c?`left:${i}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${i}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;${c?`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",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var Ut=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Yt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Hr(e,n,r){if(!Je)return;let t=(e.match(Yt)??[]).join("").toUpperCase(),o=(n.match(Yt)??[]).join("").toUpperCase(),s=(e.match(Ut)??[]).length,i=(n.match(Ut)??[]).length;if(t!==o){B(`morphTo: command sequence differs (${t||"\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!==i&&B(`morphTo: coordinate count differs (${s} \u2192 ${i}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function Ir(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let i=parseFloat(s),u=t[o++]??i;return String(+(i+(u-i)*r).toFixed(4))})}function Qt(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Be(n,(r,t)=>Dr(e,r,t))}function Dr(e,n,r){let{preset:t,...o}=n,s=t?{..._t[t],...o}:o,{selector:i="path, polyline, line, polygon, rect, circle",speed:u=1,fade:c=false,easing:d="linear",trigger:y={},stagger:v=0,direction:S="forward",once:z=false,debug:G=false,axis:b="y",scrollContainer:$,autoReverse:J=false,delay:k=0,strokeColor:A,strokeWidth:T,fillOpacity:O,waypoints:h,velocityScale:R=false,threshold:D=0,rootMargin:re="0px",repeat:q=0,repeatDelay:N=0,morphTo:F,clip:M,autoplay:Z=false,duration:x=1e3,native:C=true,onProgress:be,onStart:_,onComplete:Y,onEnter:fe,onLeave:xe,onEnterBack:me,onLeaveBack:le}=s,P=M===true?"left":typeof M=="string"?M:false,L=typeof d=="function"?d:K[d]??K.linear,se=te(y.start||"top bottom"),Ne=te(y.end||"bottom top"),ee=typeof $=="string"?document.querySelector($):$??null,He=Array.isArray(A)?A[0]:null,Te=Array.isArray(A)?A[1]:typeof A=="string"?A:null,we=Array.isArray(T)?T[0]:null,_e=Array.isArray(T)?T[1]:typeof T=="number"?T:null,Ie=Array.isArray(O)?O[0]:null,Me=Array.isArray(O)?O[1]:typeof O=="number"?O:null;function Ce(a){let m=a*100;switch(P){case "right":return `inset(0 0 0 ${100-m}%)`;case "top":return `inset(0 0 ${100-m}% 0)`;case "bottom":return `inset(${100-m}% 0 0 0)`;case "center":return `circle(${a*150}% at 50% 50%)`;default:return `inset(0 ${100-m}% 0 0)`}}let l=P?[]:Array.from(e.querySelectorAll(i)),g=[],ie=[],H=0,W=0,U=v,Q=0,Fe=0,ae=false,De=false,ve=0,Qe=-1,qe=[],Ue=-1,pe=false,f=0,p=0,E,ce=false,Ee=null;function Ve(){Ee?.destroy(),Ee=null;}let ke=new Set,ze=NaN,We=true,ct=-1,Tt=performance.now(),Xe=NaN;function ut(){return ee?b==="x"?ee.scrollLeft:ee.scrollTop:b==="x"?window.scrollX:window.scrollY}function Mt(){return ee?b==="x"?ee.clientWidth:ee.clientHeight:b==="x"?window.innerWidth:window.innerHeight}function Pt(){let a=Ke(e,ee,b);return ye(a,a.scroll,Mt(),se,Ne)}function hr(){let a=W-H,m=l.length-1,w=ee??document.documentElement,V=b==="x"?"Width":"Height";if(U=v,v>0&&m>0&&a>0){let de=w[`scroll${V}`]-w[`client${V}`]-1-H-a/u;de>=0&&(U=Math.min(v,de/(m*a)));}let ue=Math.max(0,m)*U*a,Pe=a/Math.min(u,1);Q=H+Math.min(0,ue,Pe,ue+Pe),Fe=H+Math.max(0,ue,Pe,ue+Pe);}function Lt(){(({tStart:H,tEnd:W}=Pt())),hr(),G&&Je&&(Ve(),Ee=Nr(H,W,b));}function bt(a,m=Pt){Oe(e,{type:"draw",getProgress:()=>a.getProgress(),getTrigger:m});let w=a.destroy;return a.destroy=()=>{w.call(a),$e(e);},a}function At(a,m){return z&&!J?Math.max(Qe,L(qe[a]=Math.max(qe[a]??0,m))):L(m)}function yr(a,m){if(e.style.setProperty("--scroll-draw-progress",String(a)),P){let w=m==="reverse"?1-a:a;e.style.clipPath=Ce(w);return}l.forEach((w,V)=>wt(w,V,a,m));}function wt(a,m,w,V){a.style.strokeDashoffset=V==="reverse"?`${g[m]*w}`:`${g[m]*(1-w)}`,c&&(a.style.opacity=V==="reverse"?`${1-w}`:`${w}`),He&&Te?a.style.stroke=mt(He,Te,w):Te&&(a.style.stroke=Te),we!==null&&_e!==null?a.style.strokeWidth=`${we+(_e-we)*w}`:_e!==null&&(a.style.strokeWidth=`${_e}`),Ie!==null&&Me!==null?a.style.fillOpacity=`${Ie+(Me-Ie)*w}`:Me!==null&&(a.style.fillOpacity=`${Me}`),F&&a.tagName.toLowerCase()==="path"&&ie[m]&&a.setAttribute("d",Ir(ie[m],F,w));}function vt(){if(e.style.setProperty("--scroll-draw-progress","0"),P){e.style.clipPath=Ce(S==="reverse"?1:0);return}l.forEach((a,m)=>{a.style.strokeDasharray=`${g[m]}`,a.style.strokeDashoffset=S==="reverse"?"0":`${g[m]}`,c?a.style.opacity=S==="reverse"?"1":"0":a.style.opacity="",He&&(a.style.stroke=He),we!==null&&(a.style.strokeWidth=`${we}`),Ie!==null&&(a.style.fillOpacity=`${Ie}`),F&&a.tagName.toLowerCase()==="path"&&ie[m]&&a.setAttribute("d",ie[m]);});}function tt(a,m){let w=a.getAttribute("d"),V=ft(a);if(F&&ie[m]){a.setAttribute("d",F);let ue=ft(a);a.setAttribute("d",ie[m]),V=Math.max(ft(a),ue),a.setAttribute("d",w);}g[m]=V,a.style.strokeDasharray=`${V}`;}if(l.forEach((a,m)=>{$r(a);let w=a.tagName.toLowerCase()==="path";w?ie.push(a.getAttribute("d")??""):ie.push(""),tt(a,m);let V=g[m];F&&(w?Hr(ie[ie.length-1],F,a):B(`morphTo only applies to <path> elements \u2014 ignored on <${a.tagName}>.`,a)),r?(a.style.strokeDashoffset=S==="reverse"?`${V}`:"0",c&&(a.style.opacity="1"),Te&&(a.style.stroke=Te),_e!==null&&(a.style.strokeWidth=`${_e}`),Me!==null&&(a.style.fillOpacity=`${Me}`),F&&a.tagName.toLowerCase()==="path"&&a.setAttribute("d",F)):(a.style.strokeDashoffset=S==="reverse"?"0":`${V}`,c?a.style.opacity=S==="reverse"?"1":"0":a.style.opacity="",He&&(a.style.stroke=He),we!==null&&(a.style.strokeWidth=`${we}`),Ie!==null&&(a.style.fillOpacity=`${Ie}`));}),r)return P&&(e.style.clipPath=Ce(1)),Y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P&&(e.style.clipPath=Ce(S==="reverse"?1:0));let Ct=typeof d=="string"?pt(d):null;function br(){return !(C===false||Z||G&&Je||!Or()||!l.length||!Ct||P||b!=="y"||ee||u!==1||v!==0||z||J||R!==false||F||h||q||k>0||be||_||Y||fe||xe||me||le||A!=null||T!=null||O!=null||(y.start||"top bottom").trim()!=="top bottom"||(y.end||"bottom top").trim()!=="bottom top")}function wr(){let a=++Rr,m=`svg-scroll-draw-${a}`,w=`svg-scroll-draw-host-${a}`,V=`--svg-scroll-draw-${a}`,ue=S==="reverse"?"0":"var(--ssd-len)",Pe=S==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${ue};`,ne=`stroke-dashoffset:${Pe};`;c&&(de+=`opacity:${S==="reverse"?1:0};`,ne+=`opacity:${S==="reverse"?0:1};`);let oe=document.createElement("style");oe.setAttribute("data-svg-scroll-draw",""),oe.textContent=`@keyframes ${m}{from{${de}}to{${ne}}}.${w}{view-timeline-name:${V};view-timeline-axis:block;}.${m}{animation-name:${m};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${V};animation-range:cover 0% cover 100%;}`,document.head.appendChild(oe),e.classList.add(w);function Se(I,X){I.style.setProperty("--ssd-len",String(g[X])),I.style.strokeDasharray=`${g[X]}`,I.style.strokeDashoffset="",I.style.opacity="",I.style.animationPlayState="",I.classList.add(m);}l.forEach(Se);let ge=false,Le=-1;function Re(){if(Le>=0)return Le;let I=e.getBoundingClientRect(),{tStart:X,tEnd:he}=ye({top:I.top,height:I.height},ut(),Mt(),se,Ne);return L(j(ut(),X,he,u))}return {destroy(){e.classList.remove(w),l.forEach(I=>{I.classList.remove(m),I.style.removeProperty("--ssd-len"),I.style.animationPlayState="";}),oe.remove();},replay(){ge=false,Le=-1,l.forEach(Se);},pause(){ge=true,l.forEach(I=>{I.style.animationPlayState="paused";});},resume(){ge&&(ge=false,l.forEach(I=>{I.style.animationPlayState="running";}));},seek(I){let X=Math.min(1,Math.max(0,I));Le=X,ge=true,l.forEach((he,Ge)=>{he.classList.remove(m),he.style.strokeDashoffset=S==="reverse"?`${g[Ge]*X}`:`${g[Ge]*(1-X)}`,c&&(he.style.opacity=S==="reverse"?`${1-X}`:`${X}`);});},getProgress(){return Re()},refresh(){l.forEach((I,X)=>{tt(I,X),I.style.setProperty("--ssd-len",String(g[X]));});}}}if(br())return bt(wr());function vr(){let a=Math.max(1,x),m=P?a:a*(1+Math.max(0,l.length-1)*v),w=0,V=0,ue=false;function Pe(Le){let Re=true,I=Math.min(1,Math.max(0,Le/m));if(P){let X=Math.min(1,Math.max(0,Le/a)),he=L(X);f=he,e.style.setProperty("--scroll-draw-progress",String(he)),e.style.clipPath=Ce(S==="reverse"?1-he:he),be?.(he),X<1&&(Re=false);}else {l.forEach((he,Ge)=>{let Sr=Ge*v*a,Nt=Math.min(1,Math.max(0,(Le-Sr)/a));wt(he,Ge,L(Nt),S),Nt<1&&(Re=false);});let X=L(I);f=X,be?.(X),e.style.setProperty("--scroll-draw-progress",String(X));}if(h){let X=L(I);for(let he in h){let Ge=parseFloat(he);X>=Ge&&!ke.has(Ge)&&(ke.add(Ge),h[he]?.());}}return Re}function de(Le){if(pe)return;let Re=Le-w;De||(De=true,_?.());let I=Pe(Re);if(I&&!ae){ae=true,Pe(m),Y?.(),p<(q==="infinite"?1/0:q??0)&&(p++,E=setTimeout(()=>{w=performance.now(),De=false,ae=false,ke.clear(),vt(),ve=requestAnimationFrame(de);},N));return}I||(ve=requestAnimationFrame(de));}function ne(){cancelAnimationFrame(ve),clearTimeout(E),w=performance.now(),V=0,pe=false,De=false,ae=false,p=0,ue=true,f=0,ke.clear(),vt(),ve=requestAnimationFrame(de);}let oe=new IntersectionObserver(Le=>{Le.forEach(Re=>{Re.isIntersecting&&!(z&&ae)?ne():!Re.isIntersecting&&!z&&!ae&&(cancelAnimationFrame(ve),clearTimeout(E),ue=false);});},{root:ee??null,threshold:D,rootMargin:re}),Se;function ge(){clearTimeout(Se),Se=setTimeout(()=>l.forEach(tt),150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),k>0?setTimeout(()=>oe.observe(e),k):oe.observe(e),{destroy(){cancelAnimationFrame(ve),clearTimeout(E),oe.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(Se);},replay(){p=0,ne();},pause(){pe||!ue||(pe=true,V=performance.now()-w,cancelAnimationFrame(ve));},resume(){pe&&(pe=false,ue=true,w=performance.now()-V,ve=requestAnimationFrame(de));},seek(Le){let Re=Math.min(1,Math.max(0,Le));f=Re,pe=true,V=Re*m,w=performance.now()-V,cancelAnimationFrame(ve),Pe(V);},getProgress(){return f},refresh(){clearTimeout(Se),l.forEach(tt);}}}if(Z)return bt(vr());Lt();let kt=()=>j(ut(),Q,Fe,1);function Rt(){ae=true,Y?.(),p<(q==="infinite"?1/0:q)&&(p++,E=setTimeout(()=>{ce=true;},N));}function Ot(){Qe=-1,qe=[],De=false,ae=false,ce=false,ke.clear(),vt(),We=true;}function Er(){let a=performance.now(),m=ut();if(ce&&kt()%1&&Ot(),!We&&R===false&&m===ze)return;We=false,ze=m;let w=u;if(R!==false){let ne=a-Tt,oe=ne>0?Math.abs(m-(ct<0?m:ct))/ne:0;w=u*Math.max(.2,1+oe*(typeof R=="number"?R:1)*.04);}ct=m,Tt=a;let V=J?Ue===-1||m>=Ue?"forward":"reverse":S;Ue=m;let ue=W-H,Pe=true,de=ue===0?0:(m-H)/ue;if(isNaN(Xe)||(Xe<=0&&de>0&&fe?.(),Xe<1&&de>=1&&xe?.(),Xe>=1&&de<1&&me?.(),Xe>0&&de<=0&&le?.()),Xe=de,P){let ne=At(0,j(m,H,W,w));f=ne,e.style.setProperty("--scroll-draw-progress",String(ne));let oe=V==="reverse"?1-ne:ne;e.style.clipPath=Ce(oe),be?.(ne),!De&&j(m,H,W,w)>0&&(De=true,_?.()),ne>=1&&!ae?Rt():ne<1&&!z&&(ae=false);return}if(l.forEach((ne,oe)=>{let Se=oe*U*ue,ge=At(oe,j(m,H+Se,W+Se,w));wt(ne,oe,ge,V),oe===0&&(f=ge,be?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),ge<1&&(Pe=false);}),h){let ne=L(j(m,H,W,w));for(let oe in h){let Se=parseFloat(oe);ne>=Se&&!ke.has(Se)&&(ke.add(Se),h[oe]?.());}}!De&&j(m,H,W,w)>0&&(De=true,_?.()),Pe&&!ae?Rt():!Pe&&!z&&(ae=false);}let rt=Ae(ee??window,[e],kt,Er,()=>{let a=g.join();l.forEach(tt),Lt(),We=true,g.join()!==a&&nt();}),Et=k>0;function nt(){rt.hold(pe||Et);}let $t;return Et&&($t=setTimeout(()=>{Et=false,nt();},k)),nt(),bt({destroy(){clearTimeout(E),clearTimeout($t),rt.off(),Ve();},replay(){Ot(),Ue=-1,ct=-1,p=0,pe=false,f=0,clearTimeout(E),nt();},pause(){pe=true,rt.hold(true);},resume(){pe&&(pe=false,We=true,nt());},seek(a){let m=Math.min(1,Math.max(0,a));f=m,Qe=m,qe=[],pe=true,rt.hold(true),yr(m,S),We=true;},getProgress(){return f},refresh:rt.remeasure},()=>({tStart:H,tEnd:W}))}var Xt=new WeakMap,Fr=0;function at(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Xt.get(r);return t===void 0&&Xt.set(r,t=++Fr),`el#${t}`}return r})}function Kt(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...o)=>n()[t]?.(...o));return r}function _r(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Jt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],s=[],i=t[2].trim();if(i)for(let u of i.split(/[\s,]+/)){let c=u.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(c?parseFloat(c[1]):0),s.push(c?c[2]:"");}n.push({fn:t[1],nums:o,units:s});}return n}function Vr(e,n,r){let t=Jt(e),o=Jt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((s,i)=>{let u=o[i];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((c,d)=>`${c}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((c,d)=>`${c}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,d)=>`${c+(u.nums[d]-c)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Zt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(_r(t))return mt(t,o,r);if(t.includes("("))return Vr(t,o,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),i=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&i){let u=parseFloat(s[1]),c=parseFloat(i[1]);return `${u+(c-u)*r}${s[2]||i[2]}`}return r<1?t:o}function zr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Wr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Gr=0,er="--scroll-draw-progress";function jr(){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,n){return typeof window>"u"?rr:n.respectReducedMotion===false?tr(e,n,false):Be(n,(r,t)=>tr(e,r,t))}function tr(e,n,r){let{props:t,trigger:o={},easing:s="ease-out",speed:i=1,once:u=false,axis:c="y",scrollContainer:d,native:y=true,velocityScale:v=false,triggerElement:S,onProgress:z,onComplete:G,onEnter:b,onLeave:$,onEnterBack:J,onLeaveBack:k}=n,A=typeof s=="function"?s:K[s]??K["ease-out"],T=te(o.start||"top bottom"),O=te(o.end||"bottom top"),h=S??e,R=typeof d=="string"?document.querySelector(d):d??null,D=Object.entries(t).map(([l,g])=>({prop:zr(l),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function re(){let l=window.getComputedStyle(e);for(let g of D)g.from===""&&(g.from=l.getPropertyValue(g.prop).trim()||"0");}function q(){for(let l of D)e.style.setProperty(l.prop,String(l.to));}let N=new Map;for(let l of [...D.map(g=>g.prop),er])N.set(l,e.style.getPropertyValue(l));function F(){for(let[l,g]of N)g?e.style.setProperty(l,g):e.style.removeProperty(l);}if(r)return q(),G?.(),{...rr,destroy:F,getProgress:()=>1};re();let M=()=>R?c==="x"?R.scrollLeft:R.scrollTop:c==="x"?window.scrollX:window.scrollY,Z=()=>R?c==="x"?R.clientWidth:R.clientHeight:c==="x"?window.innerWidth:window.innerHeight,x=typeof s=="string"?pt(s):null;function C(){if(!y||!jr()||!x||c!=="y"||R||h!==e||u||i!==1||z||G||b||$||J||k||v!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let l of D)if(!Wr.has(l.prop))return false;return true}function be(){let l=`ssd-a-${++Gr}`,g=D.map(Q=>`${Q.prop}:${Q.from}`).join(";"),ie=D.map(Q=>`${Q.prop}:${Q.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${l}{from{${g}}to{${ie}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${x};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(l);let W=()=>{let Q=e.getBoundingClientRect();return ye({top:Q.top,height:Q.height},M(),Z(),T,O)};Oe(e,{type:"animate",getProgress:()=>U.getProgress(),getTrigger:W});let U={refresh(){},destroy(){e.classList.remove(l),H.remove(),e.style.animationPlayState="",F(),$e(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Q){let Fe=Math.min(1,Math.max(0,Q));e.classList.remove(l);for(let ae of D)e.style.setProperty(ae.prop,Zt(ae.from,ae.to,Fe));},getProgress(){let{tStart:Q,tEnd:Fe}=W();return A(j(M(),Q,Fe,i))}};return U}if(C())return be();let _=0,Y=0,fe=false,xe=-1,me=0,le=0,P=false,L=NaN,se=-1,Ne=0,ee=h===e?D:[],He=false;function Te(){let l=e.style,g=ee.map(U=>l.getPropertyValue(U.prop)),ie=l.transition;ee.length&&(l.transition="none"),ee.forEach(U=>l.setProperty(U.prop,N.get(U.prop)??""));let H=Ke(h,R,c);ee.forEach((U,Q)=>l.setProperty(U.prop,g[Q])),ee.length&&(e.offsetWidth,l.transition=ie);let W=ye(H,H.scroll,Z(),T,O);He&&Math.abs(W.tStart-_)<1&&Math.abs(W.tEnd-Y)<1||(He=true,_=W.tStart,Y=W.tEnd);}function we(l){e.style.setProperty(er,String(l));for(let g of D)e.style.setProperty(g.prop,Zt(g.from,g.to,l));z?.(l);}function _e(l){if(isNaN(L)){L=l;return}L<=0&&l>0&&b?.(),L<1&&l>=1&&$?.(),L>=1&&l<1&&J?.(),L>0&&l<=0&&k?.(),L=l;}function Ie(){if(fe)return;let l=performance.now(),g=M(),ie=i;if(v!==false){let Q=l-Ne,Fe=Q>0?Math.abs(g-(se<0?g:se))/Q:0;ie=i*Math.max(.2,1+Fe*(typeof v=="number"?v:1)*.04);}se=g,Ne=l;let H=Y===_?0:(g-_)/(Y-_);_e(H);let W=j(g,_,Y,ie),U=u?Math.max(xe,A(me=Math.max(me,W))):A(W);le=U,we(U),U>=1&&!P?(P=true,G?.()):U<1&&!u&&(P=false);}let Me=Ae(R??window,[h],()=>j(M(),_,Y,Math.min(i,1)),Ie,Te);Te(),Y===_&&B("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),me=j(M(),_,Y,i),le=A(me),we(le),Oe(e,{type:"animate",getProgress:()=>le,getTrigger:()=>({tStart:_,tEnd:Y})});function Ce(){fe=true,Me.hold(true);}return {destroy(){fe=true,Me.off(),F(),$e(e);},replay(){xe=-1,me=0,P=false,le=0,fe=false,we(0),Me.hold(false);},pause:Ce,resume(){fe&&(fe=false,Me.hold(false));},seek(l){let g=Math.min(1,Math.max(0,l));le=g,xe=g,me=0,Ce(),we(g);},getProgress(){return le},refresh:Me.remeasure}}var St={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,n){if(typeof window>"u")return St;let r=typeof e=="string"?document.querySelector(e):e;return r?Be(n,(t,o)=>Br(r,t,o)):(B("scrollCounter: element not found:",e),St)}function Br(e,n,r){let{from:t=0,to:o,format:s,easing:i="ease-out",trigger:u={},once:c=true,decimals:d,onComplete:y}=n,v=d!==void 0?x=>x.toFixed(d):s??(x=>String(Math.round(x))),S=typeof i=="function"?i:K[i]??K["ease-out"],z=te(u.start||"top 80%"),G=te(u.end||"top 20%");if(r)return e.textContent=v(o),y?.(),{...St,getProgress:()=>1};let b=0,$=0,J=false,k=-1,A=0,T=0,O=false,h=()=>window.scrollY,R=()=>window.innerHeight;function D(){let x=e.getBoundingClientRect(),C=ye({top:x.top,height:x.height},h(),R(),z,G);J&&Math.abs(C.tStart-b)<1&&Math.abs(C.tEnd-$)<1||(J=true,b=C.tStart,$=C.tEnd);}let re=e.style.getPropertyValue("--scroll-draw-progress");function q(x){e.textContent=v(t+(o-t)*x),e.style.setProperty("--scroll-draw-progress",String(x));}let N=()=>j(h(),b,$,1);function F(){let x=N(),C=c?Math.max(k,S(A=Math.max(A,x))):S(x);T=C,q(C),C>=1&&!O?(O=true,y?.()):C<1&&!c&&(O=false);}D();{A=j(h(),b,$,1);let x=S(A);T=x,q(x);}let M=Ae(window,[e],N,F,D);Oe(e,{type:"counter",getProgress:()=>T,getTrigger:()=>({tStart:b,tEnd:$})});let Z=()=>M.hold(false);return {destroy(){M.off(),e.style.setProperty("--scroll-draw-progress",re),$e(e);},replay(){k=-1,A=0,O=false,T=0,q(0),Z();},pause:()=>M.hold(true),resume:Z,seek(x){let C=Math.min(1,Math.max(0,x));T=C,k=C,A=0,M.hold(true),q(C);},getProgress(){return T}}}var sr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ir(e,n={}){if(typeof window>"u")return sr;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return B("scrollVideo: <video> element not found:",e),sr;let t=r,{trigger:o={},easing:s="linear",once:i=false,axis:u="y",preload:c="auto",triggerElement:d,onReady:y,onComplete:v,onProgress:S}=n,z=d??t,G=window.matchMedia("(prefers-reduced-motion: reduce)").matches,b=typeof s=="function"?s:K[s]??K.linear,$=te(o.start||"top top"),J=te(o.end||"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let k=n.from??0,A=n.to,T=0,O=0,h=false,R=-1,D=0,re=0,q=false,N=false,F=()=>u==="x"?window.scrollX:window.scrollY,M=()=>u==="x"?window.innerWidth:window.innerHeight;function Z(){let P=z.getBoundingClientRect(),L=u==="x"?P.left:P.top,se=u==="x"?P.width:P.height,Ne=ye({top:L,height:se},F(),M(),$,J);T=Ne.tStart,O=Ne.tEnd,N&&O===T&&B("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let x=NaN;function C(P){if(!N)return;let L=A??t.duration??0,se=k+(L-k)*P;se!==x&&(x=se,t.currentTime=se),t.style.setProperty("--scroll-draw-progress",String(P)),S?.(P);}let be=()=>j(F(),T,O,1);function _(){if(!N||G)return;let P=be(),L=i?Math.max(R,b(D=Math.max(D,P))):b(P);re=L,C(L),L>=1&&!q?(q=true,v?.()):L<1&&!i&&(q=false);}let Y=Ae(window,[z],be,_,Z),fe=()=>Y.hold(h||!N||G);fe();function xe(){if(N=true,A===void 0&&(A=t.duration),G){C(1),y?.();return}Z(),y?.(),h?C(re):fe();}t.readyState>=1?xe():t.addEventListener("loadedmetadata",xe,{once:true}),N||Z();let me=G?()=>{}:je(P=>{P&&(me(),G=true,Y.hold(true),C(1));});Oe(t,{type:"video",getProgress:()=>re,getTrigger:()=>({tStart:T,tEnd:O})});function le(){h&&(h=false,fe());}return {destroy(){Y.off(),t.removeEventListener("loadedmetadata",xe),me(),$e(t);},replay(){R=-1,D=0,q=false,re=0,x=NaN,C(0),le();},pause(){h=true,Y.hold(true);},resume:le,seek(P){let L=Math.min(1,Math.max(0,P));re=L,R=L,D=0,h=true,Y.hold(true),x=NaN,C(L);},getProgress(){return re}}}var ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function qr(e){let n=e>1?[0,e-1]:[0],r=[[0,e-1]];for(let t=0;t<r.length;t++){let[o,s]=r[t];if(s-o<2)continue;let i=o+s>>1;n.push(i),r.push([o,i],[i,s]);}return n}function ar(e,n){if(typeof window>"u")return ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="canvas")return B("scrollFrames: <canvas> element not found:",e),ht;let t=r,{frames:o,trigger:s={},easing:i="linear",once:u=false,axis:c="y",fit:d="cover",triggerElement:y,onReady:v,onLoad:S,onComplete:z,onProgress:G}=n||{},b=Array.isArray(o)?o:null,$=n?.count,J=Math.floor(b?Math.min($??b.length,b.length):$??NaN);if(!(b||typeof o=="function")||!Number.isFinite(J)||J<1)return B("scrollFrames: no frames. Pass `frames` as an array of URLs, or a function with a finite `count` of 1 or more.",t),ht;let k=n.concurrency??6;(!Number.isFinite(k)||k<1)&&(B("scrollFrames: `concurrency` must be a finite number of 1 or more; using 6.",n.concurrency),k=6),k=Math.floor(k);let A=t.getContext("2d");if(!A)return B("scrollFrames: the canvas has no 2D context.",t),ht;let T=J-1,O=y??t,h=window.matchMedia("(prefers-reduced-motion: reduce)").matches,R=typeof i=="function"?i:K[i]??K.linear,D=f=>{let p=R(f);return p===p?p:0},re=te(s.start||"top top"),q=te(s.end||"bottom top"),N=0,F=0,M=false,Z=-1,x=0,C=0,be=false,_=false,Y=false,fe=false,xe=0,me=-1,le=new Array(J),P=new Uint8Array(J),L=new Set,se=h?[T]:qr(J),Ne=0,ee=0,He=false,Te=(f,...p)=>{if(f)try{f(...p);}catch(E){typeof reportError=="function"?reportError(E):setTimeout(()=>{throw E});}},we=false,_e=f=>{let p;try{p=b?b[f]:o(f);}catch(E){p=E;}return typeof p=="string"&&p?p:(we||(we=true,B(`scrollFrames: no URL for frame ${f}; it is skipped for its nearest neighbour.`,p)),null)},Ie=()=>c==="x"?window.scrollX:window.scrollY,Me=()=>c==="x"?window.innerWidth:window.innerHeight;function Ce(){!He&&ee===se.length&&(He=true,Te(S));}function l(){for(;!_&&L.size<k&&Ne<se.length;){let f=se[Ne++];P[f]||g(f);}}function g(f){P[f]=1;let p=_e(f);if(p===null){ee++,queueMicrotask(()=>{_||Ce();});return}let E=new Image,ce=false,Ee=Ve=>{ce||_||(ce=true,E.onload=E.onerror=null,L.delete(E),Ve?le[f]=E:B("scrollFrames: a frame failed to load; its nearest neighbour shows instead:",p),ee++,l(),W(),Ce());};L.add(E),E.decoding="async",E.onerror=()=>Ee(false),E.src=p,typeof E.decode=="function"?E.decode().then(()=>Ee(true),()=>{E.complete?Ee(E.naturalWidth>0):E.onload=()=>Ee(true);}):E.onload=()=>Ee(true);}function ie(f){for(let p=0;p<=T;p++){if(le[f-p])return f-p;if(le[f+p])return f+p}return -1}function H(){let f=t.clientWidth,p=t.clientHeight;if(!f||!p)return;let E=Math.min(window.devicePixelRatio||1,2),ce=Math.round(f*E),Ee=Math.round(p*E);if(Math.abs(t.width-ce)<=1&&Math.abs(t.height-Ee)<=1)return;t.width=ce,t.height=Ee,me=-1;let Ve=t.clientWidth,ke=t.clientHeight;if(Ve!==f||ke!==p){let ze=t.style;Ve!==f&&ke!==p?(ze.width=`${f}px`,ze.height=`${p}px`):ze.aspectRatio=`${f} / ${p}`;}}function W(){let f=ie(xe);if(f<0||f===me)return;let p=le[f],E=t.width,ce=t.height,Ee=p.naturalWidth||E,Ve=p.naturalHeight||ce,ke=(d==="contain"?Math.min:Math.max)(E/Ee,ce/Ve),ze=Ee*ke,We=Ve*ke;A.clearRect(0,0,E,ce),A.drawImage(p,(E-ze)/2,(ce-We)/2,ze,We),me=f,Y||(Y=true,Te(v));}function U(f){xe=Math.min(T,Math.max(0,Math.round(f*T))),t.style.setProperty("--scroll-draw-progress",String(f)),W(),Te(G,f,xe);}function Q(){let f=O.getBoundingClientRect(),p=c==="x"?f.left:f.top,E=c==="x"?f.width:f.height,ce=ye({top:p,height:E},Ie(),Me(),re,q);N=ce.tStart,F=ce.tEnd,F===N&&E>0&&!h&&!fe&&(fe=true,B("scrollFrames: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t));}let Fe=()=>j(Ie(),N,F,1);function ae(){if(h)return;let f=Fe(),p=u?Math.max(Z,D(x=Math.max(x,f))):D(f);C=p,U(p),p>=1&&!be?(be=true,Te(z)):p<1&&!u&&(be=false);}function De(){C=1,U(1);}H(),h||Q();let ve=Ae(window,[O],Fe,ae,()=>{H(),h||Q(),W();}),Qe=()=>ve.hold(M||h);Qe(),h&&De(),l();let qe=typeof ResizeObserver=="function"?new ResizeObserver(()=>{H(),W();}):null;qe?.observe(t);let Ue=h?()=>{}:je(f=>{f&&(Ue(),h=true,ve.hold(true),se=se.slice(0,Ne),P[T]||se.push(T),Ce(),De(),l());});Oe(t,{type:"frames",getProgress:()=>C,getTrigger:()=>({tStart:N,tEnd:F})});function pe(){_||!M||(M=false,Qe());}return {destroy(){if(!_){_=true,ve.off(),qe?.disconnect(),Ue();for(let f of L)f.onload=f.onerror=null,f.src="";L.clear(),$e(t);}},replay(){_||(Z=-1,x=0,be=false,C=0,U(0),pe());},pause(){_||(M=true,ve.hold(true));},resume:pe,seek(f){if(_)return;let p=Math.min(1,Math.max(0,f===f?f:0));C=p,Z=p,x=0,M=true,ve.hold(true),U(p);},getProgress(){return C}}}var Ur=1e4;function lr(e){let{frames:n,count:r}=e;if(typeof n!="function")return at(e);let t=Number.isFinite(r)?Math.min(Math.max(Math.floor(r),0),Ur):0,o;try{o=Array.from({length:t},(s,i)=>n(i));}catch{o=["throws"];}return at({...e,frames:o})}function cr(e){if(!e||e.getAttribute("aria-hidden")==="true")return;let n=e.getAttribute("role");n==="presentation"||n==="none"||e.getAttribute("aria-label")||e.getAttribute("aria-labelledby")||B('<ScrollFrames>: the canvas has no aria-label. Say what the frames show, or set aria-hidden="true" if they are decoration.',e);}function ur(e,n){let r=document.createElement("span");r.textContent=n,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 yt(e=""){let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent=e,n}function mr(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=e.appendChild(yt(r)),o=/^\s+$/.test(r);return o?t.style.whiteSpace="pre":t.style.display="inline-block",o?null:t}).filter(r=>r!==null)}function Yr(e){let n=e.textContent??"";e.textContent="";let r=[],t=null;for(let o of n){let s=yt(o),i=o===" ";i?s.style.whiteSpace="pre":(s.style.display="inline-block",r.push(s)),i||o>"\u0DFF"?t=null:t||(t=e.appendChild(yt()),t.style.cssText="display:inline-block;white-space:nowrap"),(t??e).appendChild(s);}return r}function fr(e){let n=mr(e),r=new Map;for(let s of n){let i=s.offsetTop;r.has(i)||r.set(i,[]),r.get(i).push(s);}let t=[],o=Array.from(r.keys()).sort((s,i)=>s-i);for(let s of o){let i=r.get(s),u=yt();u.style.display="inline-block",i.forEach((c,d)=>{let y=c.nextElementSibling;u.appendChild(c),d<i.length-1&&y&&y.style.whiteSpace==="pre"&&u.appendChild(y);}),t.push(u);}return e.textContent="",t.forEach((s,i)=>{e.appendChild(s),i<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function Qr(e,n,r,t){if(r<=1||t===0)return e;t=Math.min(t,1/r);let o=(r-1)*t,s=n*t,i=s+(1-o);return i<=s?e>=s?1:0:ot((e-s)/(i-s),0,1)}function Xr(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 xt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pr(e,n={}){if(typeof window>"u")return xt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return B("scrollText: element not found:",e),xt;let t=r;return Be(n,(o,s)=>Kr(t,o,s))}function Kr(e,n,r){let{split:t="words",stagger:o=.04,easing:s="ease-out",from:i={opacity:0,y:24},trigger:u={},once:c=true,onComplete:d}=n,y=typeof s=="function"?s:K[s]??K["ease-out"],v=te(u.start||"top 85%"),S=te(u.end||"top 40%"),z=e.innerHTML,G=e.textContent??"",b;t==="chars"?b=Yr(e):t==="lines"?b=fr(e):b=mr(e),ur(e,G);let $=b.length;function J(M,Z){i?.opacity!==void 0&&(M.style.opacity=String(i.opacity+(1-i.opacity)*Z));let x=Xr(Z,i);x&&(M.style.transform=x);}function k(M){e.style.setProperty("--scroll-draw-progress",String(M)),b.forEach((Z,x)=>{let C=y(Qr(M,x,$,o));J(Z,C);});}if(r)return k(1),d?.(),{...xt,destroy:()=>{e.innerHTML=z;},getProgress:()=>1};k(0);let A=0,T=0,O=-1,h=0,R=false;function D(){({tStart:A,tEnd:T}=ye(e.getBoundingClientRect(),window.scrollY,window.innerHeight,v,S));}let re=()=>j(window.scrollY,A,T,1);function q(){let M=c?O=Math.max(O,re()):re();h=M,k(M),M>=1&&!R?(R=true,d?.()):M<1&&!c&&(R=false);}D();let N=Ae(window,[e],re,q,()=>{t==="lines"&&(e.innerHTML=z,b=fr(e),ur(e,G),k(h)),D();});Oe(e,{type:"text",getProgress:()=>h,getTrigger:()=>({tStart:A,tEnd:T})});let F=()=>N.hold(false);return {destroy(){N.off(),e.innerHTML=z,$e(e);},replay(){O=-1,R=false,h=0,k(0),F();},pause:()=>N.hold(true),resume:F,seek(M){N.hold(true),k(h=O=ot(M,0,1));},getProgress(){return h}}}function en(e,n={}){let[r,t]=tn.useState(0),o=tn.useRef(n);o.current=n;let s=tn.useRef(0);return tn.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let i=typeof e=="string"?document.querySelector(e):e.current;if(!i)return;let u=i,{axis:c="y",scrollContainer:d,trigger:y={}}=o.current,v=typeof d=="string"?document.querySelector(d):d??null,S=te(y.start||"top bottom"),z=te(y.end||"bottom top"),G=0,b=0;function $(){return v?c==="x"?v.scrollLeft:v.scrollTop:c==="x"?window.scrollX:window.scrollY}function J(){return v?c==="x"?v.clientWidth:v.clientHeight:c==="x"?window.innerWidth:window.innerHeight}function k(){let h=Ke(u,v,c);({tStart:G,tEnd:b}=ye(h,h.scroll,J(),S,z));}function A(){let{speed:h=1,easing:R="linear",once:D=false}=o.current,re=typeof R=="function"?R:K[R]??K.linear,q=j($(),G,b,h),N=re(D?s.current=Math.max(s.current,q):q);t(N);}k();let T=Ae(v??window,[u],()=>j($(),G,b,Math.min(o.current.speed??1,1)),A,k),O=je(h=>{h&&(O(),T.off(),t(1));});return ()=>{O(),T.off();}},[]),r}function Ze(e,n,r,t=at(n)){let o=tn.useRef(n);o.current=n,tn.useEffect(()=>{if(!e.current)return;let s=r(e.current,Kt(o.current,()=>o.current));return ()=>s.destroy()},[t]);}var rn=/^(data-|aria-)|^(id|role|title|tabIndex|lang|dir|hidden)$/;function et(e){let n={},r={};for(let[t,o]of Object.entries(e))(rn.test(t)?r:n)[t]=o;return [n,r]}function Vo({children:e,className:n,style:r,...t}){let o=tn.useRef(null),[s,i]=et(t);return Ze(o,s,Qt),jsxRuntime.jsx("div",{ref:o,className:n,style:r,...i,children:e})}function zo({children:e,className:n,style:r,...t}){let o=tn.useRef(null),[s,i]=et(t);return Ze(o,s,nr),jsxRuntime.jsx("div",{ref:o,className:n,style:r,...i,children:e})}function Wo({className:e,style:n,...r}){let t=tn.useRef(null),[o,s]=et(r);return Ze(t,o,or),jsxRuntime.jsx("span",{ref:t,className:e,style:n,...s})}function Go({src:e,poster:n,className:r,style:t,muted:o=true,playsInline:s=true,...i}){let u=tn.useRef(null),[c,d]=et(i);return Ze(u,c,ir),jsxRuntime.jsx("video",{...d,ref:u,src:e,poster:n,className:r,style:t,muted:o,playsInline:s,preload:c.preload??"auto"})}function jo({className:e,style:n,role:r="img",triggerElement:t,...o}){let s=tn.useRef(null),[i,u]=et(o),c=t&&"current"in t?t:null;return !c&&t&&(i.triggerElement=t),Ze(s,i,(d,y)=>ar(d,{...y,frames:i.frames,...c&&{triggerElement:c.current??void 0}}),lr(i)+(c?"+ref":"")),tn.useEffect(()=>cr(s.current),[]),jsxRuntime.jsx("canvas",{...u,ref:s,role:r,className:e,style:n})}function Bo({children:e,as:n="p",className:r,style:t,...o}){let s=tn.useRef(null),[i,u]=et(o);return Ze(s,i,pr),tn__default.default.createElement(n,{...u,ref:s,className:r,style:t},e)}exports.ScrollAnimate=zo;exports.ScrollCounter=Wo;exports.ScrollDraw=Vo;exports.ScrollFrames=jo;exports.ScrollText=Bo;exports.ScrollVideo=Go;exports.useScrollDrawProgress=en;
|
|
4
|
+
<div style="position:absolute;${c?`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(r),window.addEventListener("scroll",o,{passive:true}),o(),{el:r,destroy(){window.removeEventListener("scroll",o),r.remove();}}}var Kt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Jt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Vr(e,n,t){if(!Ke)return;let r=(e.match(Jt)??[]).join("").toUpperCase(),o=(n.match(Jt)??[]).join("").toUpperCase(),s=(e.match(Kt)??[]).length,i=(n.match(Kt)??[]).length;if(r!==o){z(`morphTo: command sequence differs (${r||"\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.`,t);return}s!==i&&z(`morphTo: coordinate count differs (${s} \u2192 ${i}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function zr(e,n,t){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let i=parseFloat(s),l=r[o++]??i;return String(+(i+(l-i)*t).toFixed(4))})}function Zt(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:je(n,(t,r)=>Wr(e,t,r))}function Wr(e,n,t){let{preset:r,...o}=n,s=r?{...Gt[r],...o}:o,{selector:i="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:p="linear",trigger:y={},stagger:v=0,direction:S="forward",once:W=false,debug:B=false,axis:b="y",scrollContainer:R,autoReverse:K=false,delay:k=0,strokeColor:C,strokeWidth:x,fillOpacity:O,waypoints:h,velocityScale:$=false,threshold:D=0,rootMargin:te="0px",repeat:q=0,repeatDelay:F=0,morphTo:I,clip:M,autoplay:J=false,duration:T=1e3,native:A=true,onProgress:ye,onStart:_,onComplete:Y,onEnter:ue,onLeave:Se,onEnterBack:fe,onLeaveBack:ae}=s,P=M===true?"left":typeof M=="string"?M:false,L=Le(p),oe=ee(y.start||"top bottom"),Fe=ee(y.end||"bottom top"),Z=typeof R=="string"?document.querySelector(R):R??null,He=Array.isArray(C)?C[0]:null,Te=Array.isArray(C)?C[1]:typeof C=="string"?C:null,be=Array.isArray(x)?x[0]:null,_e=Array.isArray(x)?x[1]:typeof x=="number"?x:null,Ne=Array.isArray(O)?O[0]:null,xe=Array.isArray(O)?O[1]:typeof O=="number"?O:null;function Ae(a){let m=a*100;switch(P){case "right":return `inset(0 0 0 ${100-m}%)`;case "top":return `inset(0 0 ${100-m}% 0)`;case "bottom":return `inset(${100-m}% 0 0 0)`;case "center":return `circle(${a*150}% at 50% 50%)`;default:return `inset(0 ${100-m}% 0 0)`}}let u=P?[]:Array.from(e.querySelectorAll(i)),g=[],se=[],H=0,G=0,U=v,Q=0,Ie=0,ie=false,De=false,we=0,Qe=-1,qe=[],Ue=-1,me=false,f=0,d=0,E,le=false,ve=null;function Ve(){ve?.destroy(),ve=null;}let ke=new Set,ze=NaN,We=true,ut=-1,Lt=performance.now(),Xe=NaN;function ft(){return Z?b==="x"?Z.scrollLeft:Z.scrollTop:b==="x"?window.scrollX:window.scrollY}function Ct(){return Z?b==="x"?Z.clientWidth:Z.clientHeight:b==="x"?window.innerWidth:window.innerHeight}function At(){let a=Ze(e,Z,b);return he(a,a.scroll,Ct(),oe,Fe)}function vr(){let a=G-H,m=u.length-1,w=Z??document.documentElement,V=b==="x"?"Width":"Height";if(U=v,v>0&&m>0&&a>0){let pe=w[`scroll${V}`]-w[`client${V}`]-1-H-a/l;pe>=0&&(U=Math.min(v,pe/(m*a)));}let ce=Math.max(0,m)*U*a,Me=a/Math.min(l,1);Q=H+Math.min(0,ce,Me,ce+Me),Ie=H+Math.max(0,ce,Me,ce+Me);}function kt(){(({tStart:H,tEnd:G}=At())),vr(),B&&Ke&&(Ve(),ve=_r(H,G,b));}function vt(a,m=At){$e(e,{type:"draw",getProgress:()=>a.getProgress(),getTrigger:m});let w=a.destroy;return a.destroy=()=>{w.call(a),Re(e);},a}function Ot(a,m){return W&&!K?Math.max(Qe,L(qe[a]=Math.max(qe[a]??0,m))):L(m)}function Er(a,m){if(e.style.setProperty("--scroll-draw-progress",String(a)),P){let w=m==="reverse"?1-a:a;e.style.clipPath=Ae(w);return}u.forEach((w,V)=>Et(w,V,a,m));}function Et(a,m,w,V){a.style.strokeDashoffset=V==="reverse"?`${g[m]*w}`:`${g[m]*(1-w)}`,c&&(a.style.opacity=V==="reverse"?`${1-w}`:`${w}`),He&&Te?a.style.stroke=dt(He,Te,w):Te&&(a.style.stroke=Te),be!==null&&_e!==null?a.style.strokeWidth=`${be+(_e-be)*w}`:_e!==null&&(a.style.strokeWidth=`${_e}`),Ne!==null&&xe!==null?a.style.fillOpacity=`${Ne+(xe-Ne)*w}`:xe!==null&&(a.style.fillOpacity=`${xe}`),I&&a.tagName.toLowerCase()==="path"&&se[m]&&a.setAttribute("d",zr(se[m],I,w));}function St(){if(e.style.setProperty("--scroll-draw-progress","0"),P){e.style.clipPath=Ae(S==="reverse"?1:0);return}u.forEach((a,m)=>{a.style.strokeDasharray=pt(g[m]),a.style.strokeDashoffset=S==="reverse"?"0":`${g[m]}`,c?a.style.opacity=S==="reverse"?"1":"0":a.style.opacity="",He&&(a.style.stroke=He),be!==null&&(a.style.strokeWidth=`${be}`),Ne!==null&&(a.style.fillOpacity=`${Ne}`),I&&a.tagName.toLowerCase()==="path"&&se[m]&&a.setAttribute("d",se[m]);});}function rt(a,m){let w=a.getAttribute("d"),V=mt(a);if(I&&se[m]){a.setAttribute("d",I);let ce=mt(a);a.setAttribute("d",se[m]),V=Math.max(mt(a),ce),a.setAttribute("d",w);}g[m]=V,a.style.strokeDasharray=pt(V);}if(u.forEach((a,m)=>{Ir(a);let w=a.tagName.toLowerCase()==="path";w?se.push(a.getAttribute("d")??""):se.push(""),rt(a,m);let V=g[m];I&&(w?Vr(se[se.length-1],I,a):z(`morphTo only applies to <path> elements \u2014 ignored on <${a.tagName}>.`,a)),t?(a.style.strokeDashoffset=S==="reverse"?`${V}`:"0",c&&(a.style.opacity="1"),Te&&(a.style.stroke=Te),_e!==null&&(a.style.strokeWidth=`${_e}`),xe!==null&&(a.style.fillOpacity=`${xe}`),I&&a.tagName.toLowerCase()==="path"&&a.setAttribute("d",I)):(a.style.strokeDashoffset=S==="reverse"?"0":`${V}`,c?a.style.opacity=S==="reverse"?"1":"0":a.style.opacity="",He&&(a.style.stroke=He),be!==null&&(a.style.strokeWidth=`${be}`),Ne!==null&&(a.style.fillOpacity=`${Ne}`));}),t)return P&&(e.style.clipPath=Ae(1)),Y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P&&(e.style.clipPath=Ae(S==="reverse"?1:0));let $t=typeof p=="string"?gt(p):null;function Sr(){return !(A===false||J||B&&Ke||!Dr()||!u.length||!$t||P||b!=="y"||Z||l!==1||v!==0||W||K||$!==false||I||h||q||k>0||ye||_||Y||ue||Se||fe||ae||C!=null||x!=null||O!=null||(y.start||"top bottom").trim()!=="top bottom"||(y.end||"bottom top").trim()!=="bottom top")}function Tr(){let a=++Nr,m=`svg-scroll-draw-${a}`,w=`svg-scroll-draw-host-${a}`,V=`--svg-scroll-draw-${a}`,ce=S==="reverse"?"0":"var(--ssd-len)",Me=S==="reverse"?"var(--ssd-len)":"0",pe=`stroke-dashoffset:${ce};`,re=`stroke-dashoffset:${Me};`;c&&(pe+=`opacity:${S==="reverse"?1:0};`,re+=`opacity:${S==="reverse"?0:1};`);let ne=document.createElement("style");ne.setAttribute("data-svg-scroll-draw",""),ne.textContent=`@keyframes ${m}{from{${pe}}to{${re}}}.${w}{view-timeline-name:${V};view-timeline-axis:block;}.${m}{animation-name:${m};animation-duration:auto;animation-timing-function:${$t};animation-fill-mode:both;animation-timeline:${V};animation-range:cover 0% cover 100%;}`,document.head.appendChild(ne),e.classList.add(w);function Ee(N,X){N.style.setProperty("--ssd-len",String(g[X])),N.style.strokeDasharray=pt(g[X]),N.style.strokeDashoffset="",N.style.opacity="",N.style.animationPlayState="",N.classList.add(m);}u.forEach(Ee);let de=false,Pe=-1;function Oe(){if(Pe>=0)return Pe;let N=e.getBoundingClientRect(),{tStart:X,tEnd:ge}=he({top:N.top,height:N.height},ft(),Ct(),oe,Fe);return L(j(ft(),X,ge,l))}return {destroy(){e.classList.remove(w),u.forEach(N=>{N.classList.remove(m),N.style.removeProperty("--ssd-len"),N.style.animationPlayState="";}),ne.remove();},replay(){de=false,Pe=-1,u.forEach(Ee);},pause(){de=true,u.forEach(N=>{N.style.animationPlayState="paused";});},resume(){de&&(de=false,u.forEach(N=>{N.style.animationPlayState="running";}));},seek(N){let X=Math.min(1,Math.max(0,N));Pe=X,de=true,u.forEach((ge,Ge)=>{ge.classList.remove(m),ge.style.strokeDashoffset=S==="reverse"?`${g[Ge]*X}`:`${g[Ge]*(1-X)}`,c&&(ge.style.opacity=S==="reverse"?`${1-X}`:`${X}`);});},getProgress(){return Oe()},refresh(){u.forEach((N,X)=>{rt(N,X),N.style.setProperty("--ssd-len",String(g[X]));});}}}if(Sr())return vt(Tr());function xr(){let a=Math.max(1,T),m=P?a:a*(1+Math.max(0,u.length-1)*v),w=0,V=0,ce=false;function Me(Pe){let Oe=true,N=Math.min(1,Math.max(0,Pe/m));if(P){let X=Math.min(1,Math.max(0,Pe/a)),ge=L(X);f=ge,e.style.setProperty("--scroll-draw-progress",String(ge)),e.style.clipPath=Ae(S==="reverse"?1-ge:ge),ye?.(ge),X<1&&(Oe=false);}else {u.forEach((ge,Ge)=>{let Pr=Ge*v*a,Dt=Math.min(1,Math.max(0,(Pe-Pr)/a));Et(ge,Ge,L(Dt),S),Dt<1&&(Oe=false);});let X=L(N);f=X,ye?.(X),e.style.setProperty("--scroll-draw-progress",String(X));}if(h){let X=L(N);for(let ge in h){let Ge=parseFloat(ge);X>=Ge&&!ke.has(Ge)&&(ke.add(Ge),h[ge]?.());}}return Oe}function pe(Pe){if(me)return;let Oe=Pe-w;De||(De=true,_?.());let N=Me(Oe);if(N&&!ie){ie=true,Me(m),Y?.(),d<(q==="infinite"?1/0:q??0)&&(d++,E=setTimeout(()=>{w=performance.now(),De=false,ie=false,ke.clear(),St(),we=requestAnimationFrame(pe);},F));return}N||(we=requestAnimationFrame(pe));}function re(){cancelAnimationFrame(we),clearTimeout(E),w=performance.now(),V=0,me=false,De=false,ie=false,d=0,ce=true,f=0,ke.clear(),St(),we=requestAnimationFrame(pe);}let ne=new IntersectionObserver(Pe=>{Pe.forEach(Oe=>{Oe.isIntersecting&&!(W&&ie)?re():!Oe.isIntersecting&&!W&&!ie&&(cancelAnimationFrame(we),clearTimeout(E),ce=false);});},{root:Z??null,threshold:D,rootMargin:te}),Ee;function de(){clearTimeout(Ee),Ee=setTimeout(()=>u.forEach(rt),150);}return window.addEventListener("resize",de),window.addEventListener("orientationchange",de),k>0?setTimeout(()=>ne.observe(e),k):ne.observe(e),{destroy(){cancelAnimationFrame(we),clearTimeout(E),ne.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),clearTimeout(Ee);},replay(){d=0,re();},pause(){me||!ce||(me=true,V=performance.now()-w,cancelAnimationFrame(we));},resume(){me&&(me=false,ce=true,w=performance.now()-V,we=requestAnimationFrame(pe));},seek(Pe){let Oe=Math.min(1,Math.max(0,Pe));f=Oe,me=true,V=Oe*m,w=performance.now()-V,cancelAnimationFrame(we),Me(V);},getProgress(){return f},refresh(){clearTimeout(Ee),u.forEach(rt);}}}if(J)return vt(xr());kt();let Rt=()=>j(ft(),Q,Ie,1);function Ft(){ie=true,Y?.(),d<(q==="infinite"?1/0:q)&&(d++,E=setTimeout(()=>{le=true;},F));}function Ht(){Qe=-1,qe=[],De=false,ie=false,le=false,ke.clear(),St(),We=true;}function Mr(){let a=performance.now(),m=ft();if(le&&Rt()%1&&Ht(),!We&&$===false&&m===ze)return;We=false,ze=m;let w=l;if($!==false){let re=a-Lt,ne=re>0?Math.abs(m-(ut<0?m:ut))/re:0;w=l*Math.max(.2,1+ne*(typeof $=="number"?$:1)*.04);}ut=m,Lt=a;let V=K?Ue===-1||m>=Ue?"forward":"reverse":S;Ue=m;let ce=G-H,Me=true,pe=ce===0?0:(m-H)/ce;if(isNaN(Xe)||(Xe<=0&&pe>0&&ue?.(),Xe<1&&pe>=1&&Se?.(),Xe>=1&&pe<1&&fe?.(),Xe>0&&pe<=0&&ae?.()),Xe=pe,P){let re=Ot(0,j(m,H,G,w));f=re,e.style.setProperty("--scroll-draw-progress",String(re));let ne=V==="reverse"?1-re:re;e.style.clipPath=Ae(ne),ye?.(re),!De&&j(m,H,G,w)>0&&(De=true,_?.()),re>=1&&!ie?Ft():re<1&&!W&&(ie=false);return}if(u.forEach((re,ne)=>{let Ee=ne*U*ce,de=Ot(ne,j(m,H+Ee,G+Ee,w));Et(re,ne,de,V),ne===0&&(f=de,ye?.(de),e.style.setProperty("--scroll-draw-progress",String(de))),de<1&&(Me=false);}),h){let re=L(j(m,H,G,w));for(let ne in h){let Ee=parseFloat(ne);re>=Ee&&!ke.has(Ee)&&(ke.add(Ee),h[ne]?.());}}!De&&j(m,H,G,w)>0&&(De=true,_?.()),Me&&!ie?Ft():!Me&&!W&&(ie=false);}let nt=Ce(Z??window,[e],Rt,Mr,()=>{let a=g.join();u.forEach(rt),kt(),We=true,g.join()!==a&&ot();}),Tt=k>0;function ot(){nt.hold(me||Tt);}let Nt;return Tt&&(Nt=setTimeout(()=>{Tt=false,ot();},k)),ot(),vt({destroy(){clearTimeout(E),clearTimeout(Nt),nt.off(),Ve();},replay(){Ht(),Ue=-1,ut=-1,d=0,me=false,f=0,clearTimeout(E),ot();},pause(){me=true,nt.hold(true);},resume(){me&&(me=false,We=true,ot());},seek(a){let m=Math.min(1,Math.max(0,a));f=m,Qe=m,qe=[],me=true,nt.hold(true),Er(m,S),We=true;},getProgress(){return f},refresh:nt.remeasure},()=>({tStart:H,tEnd:G}))}var er=new WeakMap,Gr=0;function lt(e){return JSON.stringify(e,(n,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let r=er.get(t);return r===void 0&&er.set(t,r=++Gr),`el#${r}`}return t})}function tr(e,n){let t={...e};for(let r of Object.keys(t))typeof t[r]=="function"&&(t[r]=(...o)=>n()[r]?.(...o));return t}function Br(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function rr(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let o=[],s=[],i=r[2].trim();if(i)for(let l of i.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(c?parseFloat(c[1]):0),s.push(c?c[2]:"");}n.push({fn:r[1],nums:o,units:s});}return n}function jr(e,n,t){let r=rr(e),o=rr(n);return r.length===0||r.length!==o.length?t<1?e:n:r.map((s,i)=>{let l=o[i];return s.fn!==l.fn||s.nums.length!==l.nums.length?t<1?`${s.fn}(${s.nums.map((c,p)=>`${c}${s.units[p]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,p)=>`${c}${l.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,p)=>`${c+(l.nums[p]-c)*t}${s.units[p]}`).join(", ")})`}).join(" ")}function nr(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),o=String(n);if(Br(r))return dt(r,o,t);if(r.includes("("))return jr(r,o,t);let s=r.match(/^([-+]?[\d.]+)(.*)$/),i=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&i){let l=parseFloat(s[1]),c=parseFloat(i[1]);return `${l+(c-l)*t}${s[2]||i[2]}`}return t<1?r:o}function qr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Ur=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Yr=0,or="--scroll-draw-progress";function Qr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var ir={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ar(e,n){return typeof window>"u"?ir:n.respectReducedMotion===false?sr(e,n,false):je(n,(t,r)=>sr(e,t,r))}function sr(e,n,t){let{props:r,trigger:o={},easing:s="ease-out",speed:i=1,once:l=false,axis:c="y",scrollContainer:p,native:y=true,velocityScale:v=false,triggerElement:S,onProgress:W,onComplete:B,onEnter:b,onLeave:R,onEnterBack:K,onLeaveBack:k}=n,C=Le(s,"ease-out"),x=ee(o.start||"top bottom"),O=ee(o.end||"bottom top"),h=S??e,$=typeof p=="string"?document.querySelector(p):p??null,D=Object.entries(r).map(([u,g])=>({prop:qr(u),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function te(){let u=window.getComputedStyle(e);for(let g of D)g.from===""&&(g.from=u.getPropertyValue(g.prop).trim()||"0");}function q(){for(let u of D)e.style.setProperty(u.prop,String(u.to));}let F=new Map;for(let u of [...D.map(g=>g.prop),or])F.set(u,e.style.getPropertyValue(u));function I(){for(let[u,g]of F)g?e.style.setProperty(u,g):e.style.removeProperty(u);}if(t)return q(),B?.(),{...ir,destroy:I,getProgress:()=>1};te();let M=()=>$?c==="x"?$.scrollLeft:$.scrollTop:c==="x"?window.scrollX:window.scrollY,J=()=>$?c==="x"?$.clientWidth:$.clientHeight:c==="x"?window.innerWidth:window.innerHeight,T=typeof s=="string"?gt(s):null;function A(){if(!y||!Qr()||!T||c!=="y"||$||h!==e||l||i!==1||W||B||b||R||K||k||v!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let u of D)if(!Ur.has(u.prop))return false;return true}function ye(){let u=`ssd-a-${++Yr}`,g=D.map(Q=>`${Q.prop}:${Q.from}`).join(";"),se=D.map(Q=>`${Q.prop}:${Q.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${u}{from{${g}}to{${se}}}.${u}{animation-name:${u};animation-duration:auto;animation-timing-function:${T};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(u);let G=()=>{let Q=e.getBoundingClientRect();return he({top:Q.top,height:Q.height},M(),J(),x,O)};$e(e,{type:"animate",getProgress:()=>U.getProgress(),getTrigger:G});let U={refresh(){},destroy(){e.classList.remove(u),H.remove(),e.style.animationPlayState="",I(),Re(e);},replay(){e.classList.remove(u),e.offsetWidth,e.classList.add(u);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Q){let Ie=Math.min(1,Math.max(0,Q));e.classList.remove(u);for(let ie of D)e.style.setProperty(ie.prop,nr(ie.from,ie.to,Ie));},getProgress(){let{tStart:Q,tEnd:Ie}=G();return C(j(M(),Q,Ie,i))}};return U}if(A())return ye();let _=0,Y=0,ue=false,Se=-1,fe=0,ae=0,P=false,L=NaN,oe=-1,Fe=0,Z=h===e?D:[],He=false;function Te(){let u=e.style,g=Z.map(U=>u.getPropertyValue(U.prop)),se=u.transition;Z.length&&(u.transition="none"),Z.forEach(U=>u.setProperty(U.prop,F.get(U.prop)??""));let H=Ze(h,$,c);Z.forEach((U,Q)=>u.setProperty(U.prop,g[Q])),Z.length&&(e.offsetWidth,u.transition=se);let G=he(H,H.scroll,J(),x,O);He&&Math.abs(G.tStart-_)<1&&Math.abs(G.tEnd-Y)<1||(He=true,_=G.tStart,Y=G.tEnd);}function be(u){e.style.setProperty(or,String(u));for(let g of D)e.style.setProperty(g.prop,nr(g.from,g.to,u));W?.(u);}function _e(u){if(isNaN(L)){L=u;return}L<=0&&u>0&&b?.(),L<1&&u>=1&&R?.(),L>=1&&u<1&&K?.(),L>0&&u<=0&&k?.(),L=u;}function Ne(){if(ue)return;let u=performance.now(),g=M(),se=i;if(v!==false){let Q=u-Fe,Ie=Q>0?Math.abs(g-(oe<0?g:oe))/Q:0;se=i*Math.max(.2,1+Ie*(typeof v=="number"?v:1)*.04);}oe=g,Fe=u;let H=Y===_?0:(g-_)/(Y-_);_e(H);let G=j(g,_,Y,se),U=l?Math.max(Se,C(fe=Math.max(fe,G))):C(G);ae=U,be(U),U>=1&&!P?(P=true,B?.()):U<1&&!l&&(P=false);}let xe=Ce($??window,[h],()=>j(M(),_,Y,Math.min(i,1)),Ne,Te);Te(),Y===_&&z("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),fe=j(M(),_,Y,i),ae=C(fe),be(ae),$e(e,{type:"animate",getProgress:()=>ae,getTrigger:()=>({tStart:_,tEnd:Y})});function Ae(){ue=true,xe.hold(true);}return {destroy(){ue=true,xe.off(),I(),Re(e);},replay(){Se=-1,fe=0,P=false,ae=0,ue=false,be(0),xe.hold(false);},pause:Ae,resume(){ue&&(ue=false,xe.hold(false));},seek(u){let g=Math.min(1,Math.max(0,u));ae=g,Se=g,fe=0,Ae(),be(g);},getProgress(){return ae},refresh:xe.remeasure}}var Mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lr(e,n){if(typeof window>"u")return Mt;let t=typeof e=="string"?document.querySelector(e):e;return t?je(n,(r,o)=>Xr(t,r,o)):(z("scrollCounter: element not found:",e),Mt)}function Xr(e,n,t){let{from:r=0,to:o,format:s,easing:i="ease-out",trigger:l={},once:c=true,decimals:p,onComplete:y}=n,v=p!==void 0?T=>T.toFixed(p):s??(T=>String(Math.round(T))),S=Le(i,"ease-out"),W=ee(l.start||"top 80%"),B=ee(l.end||"top 20%");if(t)return e.textContent=v(o),y?.(),{...Mt,getProgress:()=>1};let b=0,R=0,K=false,k=-1,C=0,x=0,O=false,h=()=>window.scrollY,$=()=>window.innerHeight;function D(){let T=e.getBoundingClientRect(),A=he({top:T.top,height:T.height},h(),$(),W,B);K&&Math.abs(A.tStart-b)<1&&Math.abs(A.tEnd-R)<1||(K=true,b=A.tStart,R=A.tEnd);}let te=e.style.getPropertyValue("--scroll-draw-progress");function q(T){e.textContent=v(r+(o-r)*T),e.style.setProperty("--scroll-draw-progress",String(T));}let F=()=>j(h(),b,R,1);function I(){let T=F(),A=c?Math.max(k,S(C=Math.max(C,T))):S(T);x=A,q(A),A>=1&&!O?(O=true,y?.()):A<1&&!c&&(O=false);}D();{C=j(h(),b,R,1);let T=S(C);x=T,q(T);}let M=Ce(window,[e],F,I,D);$e(e,{type:"counter",getProgress:()=>x,getTrigger:()=>({tStart:b,tEnd:R})});let J=()=>M.hold(false);return {destroy(){M.off(),e.style.setProperty("--scroll-draw-progress",te),Re(e);},replay(){k=-1,C=0,O=false,x=0,q(0),J();},pause:()=>M.hold(true),resume:J,seek(T){let A=Math.min(1,Math.max(0,T));x=A,k=A,C=0,M.hold(true),q(A);},getProgress(){return x}}}var cr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ur(e,n={}){if(typeof window>"u")return cr;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return z("scrollVideo: <video> element not found:",e),cr;let r=t,{trigger:o={},easing:s="linear",once:i=false,axis:l="y",preload:c="auto",triggerElement:p,onReady:y,onComplete:v,onProgress:S}=n,W=p??r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,b=Le(s),R=ee(o.start||"top top"),K=ee(o.end||"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=c);let k=n.from??0,C=n.to,x=0,O=0,h=false,$=-1,D=0,te=0,q=false,F=false,I=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function J(){let P=W.getBoundingClientRect(),L=l==="x"?P.left:P.top,oe=l==="x"?P.width:P.height,Fe=he({top:L,height:oe},I(),M(),R,K);x=Fe.tStart,O=Fe.tEnd,F&&O===x&&z("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let T=NaN;function A(P){if(!F)return;let L=C??r.duration??0,oe=k+(L-k)*P;oe!==T&&(T=oe,r.currentTime=oe),r.style.setProperty("--scroll-draw-progress",String(P)),S?.(P);}let ye=()=>j(I(),x,O,1);function _(){if(!F||B)return;let P=ye(),L=i?Math.max($,b(D=Math.max(D,P))):b(P);te=L,A(L),L>=1&&!q?(q=true,v?.()):L<1&&!i&&(q=false);}let Y=Ce(window,[W],ye,_,J),ue=()=>Y.hold(h||!F||B);ue();function Se(){if(F=true,C===void 0&&(C=r.duration),B){A(1),y?.();return}J(),y?.(),h?A(te):ue();}r.readyState>=1?Se():r.addEventListener("loadedmetadata",Se,{once:true}),F||J();let fe=B?()=>{}:Be(P=>{P&&(fe(),B=true,Y.hold(true),A(1));});$e(r,{type:"video",getProgress:()=>te,getTrigger:()=>({tStart:x,tEnd:O})});function ae(){h&&(h=false,ue());}return {destroy(){Y.off(),r.removeEventListener("loadedmetadata",Se),fe(),Re(r);},replay(){$=-1,D=0,q=false,te=0,T=NaN,A(0),ae();},pause(){h=true,Y.hold(true);},resume:ae,seek(P){let L=Math.min(1,Math.max(0,P));te=L,$=L,D=0,h=true,Y.hold(true),T=NaN,A(L);},getProgress(){return te}}}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Kr(e){let n=e>1?[0,e-1]:[0],t=[[0,e-1]];for(let r=0;r<t.length;r++){let[o,s]=t[r];if(s-o<2)continue;let i=o+s>>1;n.push(i),t.push([o,i],[i,s]);}return n}function fr(e,n){if(typeof window>"u")return bt;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="canvas")return z("scrollFrames: <canvas> element not found:",e),bt;let r=t,{frames:o,trigger:s={},easing:i="linear",once:l=false,axis:c="y",fit:p="cover",triggerElement:y,onReady:v,onLoad:S,onComplete:W,onProgress:B}=n||{},b=Array.isArray(o)?o:null,R=n?.count,K=Math.floor(b?Math.min(R??b.length,b.length):R??NaN);if(!(b||typeof o=="function")||!Number.isFinite(K)||K<1)return z("scrollFrames: no frames. Pass `frames` as an array of URLs, or a function with a finite `count` of 1 or more.",r),bt;let k=n.concurrency??6;(!Number.isFinite(k)||k<1)&&(z("scrollFrames: `concurrency` must be a finite number of 1 or more; using 6.",n.concurrency),k=6),k=Math.floor(k);let C=r.getContext("2d");if(!C)return z("scrollFrames: the canvas has no 2D context.",r),bt;let x=K-1,O=y??r,h=window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=Le(i),D=f=>{let d=$(f);return d===d?d:0},te=ee(s.start||"top top"),q=ee(s.end||"bottom top"),F=0,I=0,M=false,J=-1,T=0,A=0,ye=false,_=false,Y=false,ue=false,Se=0,fe=-1,ae=new Array(K),P=new Uint8Array(K),L=new Set,oe=h?[x]:Kr(K),Fe=0,Z=0,He=false,Te=(f,...d)=>{if(f)try{f(...d);}catch(E){typeof reportError=="function"?reportError(E):setTimeout(()=>{throw E});}},be=false,_e=f=>{let d;try{d=b?b[f]:o(f);}catch(E){d=E;}return typeof d=="string"&&d?d:(be||(be=true,z(`scrollFrames: no URL for frame ${f}; it is skipped for its nearest neighbour.`,d)),null)},Ne=()=>c==="x"?window.scrollX:window.scrollY,xe=()=>c==="x"?window.innerWidth:window.innerHeight;function Ae(){!He&&Z===oe.length&&(He=true,Te(S));}function u(){for(;!_&&L.size<k&&Fe<oe.length;){let f=oe[Fe++];P[f]||g(f);}}function g(f){P[f]=1;let d=_e(f);if(d===null){Z++,queueMicrotask(()=>{_||Ae();});return}let E=new Image,le=false,ve=Ve=>{le||_||(le=true,E.onload=E.onerror=null,L.delete(E),Ve?ae[f]=E:z("scrollFrames: a frame failed to load; its nearest neighbour shows instead:",d),Z++,u(),G(),Ae());};L.add(E),E.decoding="async",E.onerror=()=>ve(false),E.src=d,typeof E.decode=="function"?E.decode().then(()=>ve(true),()=>{E.complete?ve(E.naturalWidth>0):E.onload=()=>ve(true);}):E.onload=()=>ve(true);}function se(f){for(let d=0;d<=x;d++){if(ae[f-d])return f-d;if(ae[f+d])return f+d}return -1}function H(){let f=r.clientWidth,d=r.clientHeight;if(!f||!d)return;let E=Math.min(window.devicePixelRatio||1,2),le=Math.round(f*E),ve=Math.round(d*E);if(Math.abs(r.width-le)<=1&&Math.abs(r.height-ve)<=1)return;r.width=le,r.height=ve,fe=-1;let Ve=r.clientWidth,ke=r.clientHeight;if(Ve!==f||ke!==d){let ze=r.style;Ve!==f&&ke!==d?(ze.width=`${f}px`,ze.height=`${d}px`):ze.aspectRatio=`${f} / ${d}`;}}function G(){let f=se(Se);if(f<0||f===fe)return;let d=ae[f],E=r.width,le=r.height,ve=d.naturalWidth||E,Ve=d.naturalHeight||le,ke=(p==="contain"?Math.min:Math.max)(E/ve,le/Ve),ze=ve*ke,We=Ve*ke;C.clearRect(0,0,E,le),C.drawImage(d,(E-ze)/2,(le-We)/2,ze,We),fe=f,Y||(Y=true,Te(v));}function U(f){Se=Math.min(x,Math.max(0,Math.round(f*x))),r.style.setProperty("--scroll-draw-progress",String(f)),G(),Te(B,f,Se);}function Q(){let f=O.getBoundingClientRect(),d=c==="x"?f.left:f.top,E=c==="x"?f.width:f.height,le=he({top:d,height:E},Ne(),xe(),te,q);F=le.tStart,I=le.tEnd,I===F&&E>0&&!h&&!ue&&(ue=true,z("scrollFrames: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r));}let Ie=()=>j(Ne(),F,I,1);function ie(){if(h)return;let f=Ie(),d=l?Math.max(J,D(T=Math.max(T,f))):D(f);A=d,U(d),d>=1&&!ye?(ye=true,Te(W)):d<1&&!l&&(ye=false);}function De(){A=1,U(1);}H(),h||Q();let we=Ce(window,[O],Ie,ie,()=>{H(),h||Q(),G();}),Qe=()=>we.hold(M||h);Qe(),h&&De(),u();let qe=typeof ResizeObserver=="function"?new ResizeObserver(()=>{H(),G();}):null;qe?.observe(r);let Ue=h?()=>{}:Be(f=>{f&&(Ue(),h=true,we.hold(true),oe=oe.slice(0,Fe),P[x]||oe.push(x),Ae(),De(),u());});$e(r,{type:"frames",getProgress:()=>A,getTrigger:()=>({tStart:F,tEnd:I})});function me(){_||!M||(M=false,Qe());}return {destroy(){if(!_){_=true,we.off(),qe?.disconnect(),Ue();for(let f of L)f.onload=f.onerror=null,f.src="";L.clear(),Re(r);}},replay(){_||(J=-1,T=0,ye=false,A=0,U(0),me());},pause(){_||(M=true,we.hold(true));},resume:me,seek(f){if(_)return;let d=Math.min(1,Math.max(0,f===f?f:0));A=d,J=d,T=0,M=true,we.hold(true),U(d);},getProgress(){return A}}}var Jr=1e4;function mr(e){let{frames:n,count:t}=e;if(typeof n!="function")return lt(e);let r=Number.isFinite(t)?Math.min(Math.max(Math.floor(t),0),Jr):0,o;try{o=Array.from({length:r},(s,i)=>n(i));}catch{o=["throws"];}return lt({...e,frames:o})}function pr(e,n="<ScrollFrames>"){if(!e||e.getAttribute("aria-hidden")==="true")return;let t=e.getAttribute("role");t==="presentation"||t==="none"||e.getAttribute("aria-label")||e.getAttribute("aria-labelledby")||z(`${n}: the canvas has no aria-label. Say what the frames show, or set aria-hidden="true" if they are decoration.`,e);}function dr(e,n){let t=document.createElement("span");t.textContent=n,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function wt(e=""){let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent=e,n}function hr(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=e.appendChild(wt(t)),o=/^\s+$/.test(t);return o?r.style.whiteSpace="pre":r.style.display="inline-block",o?null:r}).filter(t=>t!==null)}function Zr(e){let n=e.textContent??"";e.textContent="";let t=[],r=null;for(let o of n){let s=wt(o),i=o===" ";i?s.style.whiteSpace="pre":(s.style.display="inline-block",t.push(s)),i||o>"\u0DFF"?r=null:r||(r=e.appendChild(wt()),r.style.cssText="display:inline-block;white-space:nowrap"),(r??e).appendChild(s);}return t}function gr(e){let n=hr(e),t=new Map;for(let s of n){let i=s.offsetTop;t.has(i)||t.set(i,[]),t.get(i).push(s);}let r=[],o=Array.from(t.keys()).sort((s,i)=>s-i);for(let s of o){let i=t.get(s),l=wt();l.style.display="inline-block",i.forEach((c,p)=>{let y=c.nextElementSibling;l.appendChild(c),p<i.length-1&&y&&y.style.whiteSpace==="pre"&&l.appendChild(y);}),r.push(l);}return e.textContent="",r.forEach((s,i)=>{e.appendChild(s),i<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function en(e,n,t,r){if(t<=1||r===0)return e;r=Math.min(r,1/t);let o=(t-1)*r,s=n*r,i=s+(1-o);return i<=s?e>=s?1:0:st((e-s)/(i-s),0,1)}function tn(e,n){let t=[];if(n?.y!==void 0&&t.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&t.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&t.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let r=n.scale+(1-n.scale)*e;t.push(`scale(${r})`);}return t.join(" ")}var Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yr(e,n={}){if(typeof window>"u")return Pt;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return z("scrollText: element not found:",e),Pt;let r=t;return je(n,(o,s)=>rn(r,o,s))}function rn(e,n,t){let{split:r="words",stagger:o=.04,easing:s="ease-out",from:i={opacity:0,y:24},trigger:l={},once:c=true,onComplete:p}=n,y=Le(s,"ease-out"),v=ee(l.start||"top 85%"),S=ee(l.end||"top 40%"),W=e.innerHTML,B=e.textContent??"",b;r==="chars"?b=Zr(e):r==="lines"?b=gr(e):b=hr(e),dr(e,B);let R=b.length;function K(M,J){i?.opacity!==void 0&&(M.style.opacity=String(i.opacity+(1-i.opacity)*J));let T=tn(J,i);T&&(M.style.transform=T);}function k(M){e.style.setProperty("--scroll-draw-progress",String(M)),b.forEach((J,T)=>{let A=y(en(M,T,R,o));K(J,A);});}if(t)return k(1),p?.(),{...Pt,destroy:()=>{e.innerHTML=W;},getProgress:()=>1};k(0);let C=0,x=0,O=-1,h=0,$=false;function D(){({tStart:C,tEnd:x}=he(e.getBoundingClientRect(),window.scrollY,window.innerHeight,v,S));}let te=()=>j(window.scrollY,C,x,1);function q(){let M=c?O=Math.max(O,te()):te();h=M,k(M),M>=1&&!$?($=true,p?.()):M<1&&!c&&($=false);}D();let F=Ce(window,[e],te,q,()=>{r==="lines"&&(e.innerHTML=W,b=gr(e),dr(e,B),k(h)),D();});$e(e,{type:"text",getProgress:()=>h,getTrigger:()=>({tStart:C,tEnd:x})});let I=()=>F.hold(false);return {destroy(){F.off(),e.innerHTML=W,Re(e);},replay(){O=-1,$=false,h=0,k(0),I();},pause:()=>F.hold(true),resume:I,seek(M){F.hold(true),k(h=O=st(M,0,1));},getProgress(){return h}}}function sn(e,n={}){let[t,r]=an.useState(0),o=an.useRef(n);o.current=n;let s=an.useRef(0);return an.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){r(1);return}let i=typeof e=="string"?document.querySelector(e):e.current;if(!i)return;let l=i,{axis:c="y",scrollContainer:p,trigger:y={}}=o.current,v=typeof p=="string"?document.querySelector(p):p??null,S=ee(y.start||"top bottom"),W=ee(y.end||"bottom top"),B=0,b=0;function R(){return v?c==="x"?v.scrollLeft:v.scrollTop:c==="x"?window.scrollX:window.scrollY}function K(){return v?c==="x"?v.clientWidth:v.clientHeight:c==="x"?window.innerWidth:window.innerHeight}function k(){let h=Ze(l,v,c);({tStart:B,tEnd:b}=he(h,h.scroll,K(),S,W));}function C(){let{speed:h=1,easing:$="linear",once:D=false}=o.current,te=Le($),q=j(R(),B,b,h),F=te(D?s.current=Math.max(s.current,q):q);r(F);}k();let x=Ce(v??window,[l],()=>j(R(),B,b,Math.min(o.current.speed??1,1)),C,k),O=Be(h=>{h&&(O(),x.off(),r(1));});return ()=>{O(),x.off();}},[]),t}function et(e,n,t,r=lt(n)){let o=an.useRef(n);o.current=n,an.useEffect(()=>{if(!e.current)return;let s=t(e.current,tr(o.current,()=>o.current));return ()=>s.destroy()},[r]);}var ln=/^(data-|aria-)|^(id|role|title|tabIndex|lang|dir|hidden)$/;function tt(e){let n={},t={};for(let[r,o]of Object.entries(e))(ln.test(r)?t:n)[r]=o;return [n,t]}function Yo({children:e,className:n,style:t,...r}){let o=an.useRef(null),[s,i]=tt(r);return et(o,s,Zt),jsxRuntime.jsx("div",{ref:o,className:n,style:t,...i,children:e})}function Qo({children:e,className:n,style:t,...r}){let o=an.useRef(null),[s,i]=tt(r);return et(o,s,ar),jsxRuntime.jsx("div",{ref:o,className:n,style:t,...i,children:e})}function Xo({className:e,style:n,...t}){let r=an.useRef(null),[o,s]=tt(t);return et(r,o,lr),jsxRuntime.jsx("span",{ref:r,className:e,style:n,...s})}function Ko({src:e,poster:n,className:t,style:r,muted:o=true,playsInline:s=true,...i}){let l=an.useRef(null),[c,p]=tt(i);return et(l,c,ur),jsxRuntime.jsx("video",{...p,ref:l,src:e,poster:n,className:t,style:r,muted:o,playsInline:s,preload:c.preload??"auto"})}function Jo({className:e,style:n,role:t="img",triggerElement:r,...o}){let s=an.useRef(null),[i,l]=tt(o),c=r&&"current"in r?r:null;return !c&&r&&(i.triggerElement=r),et(s,i,(p,y)=>fr(p,{...y,frames:i.frames,...c&&{triggerElement:c.current??void 0}}),mr(i)+(c?"+ref":"")),an.useEffect(()=>pr(s.current),[]),jsxRuntime.jsx("canvas",{...l,ref:s,role:t,className:e,style:n})}function Zo({children:e,as:n="p",className:t,style:r,...o}){let s=an.useRef(null),[i,l]=tt(o);return et(s,i,yr),an__default.default.createElement(n,{...l,ref:s,className:t,style:r},e)}exports.ScrollAnimate=Qo;exports.ScrollCounter=Xo;exports.ScrollDraw=Yo;exports.ScrollFrames=Jo;exports.ScrollText=Zo;exports.ScrollVideo=Ko;exports.useScrollDrawProgress=sn;
|
package/dist/react/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
|
-
import { E as
|
|
3
|
-
import { S as ScrollAnimateOptions } from '../engine-
|
|
4
|
-
import { S as ScrollCounterOptions } from '../index-
|
|
2
|
+
import { E as Easing, T as TriggerConfig, a as ScrollDrawOptions } from '../types-iITMwrru.mjs';
|
|
3
|
+
import { S as ScrollAnimateOptions } from '../engine-Bi2x8-X-.mjs';
|
|
4
|
+
import { S as ScrollCounterOptions } from '../index-BMMZ8aW7.mjs';
|
|
5
5
|
import { ScrollVideoOptions } from '../video/index.mjs';
|
|
6
6
|
import { ScrollFramesOptions } from '../frames/index.mjs';
|
|
7
7
|
import { ScrollTextOptions } from '../text/index.mjs';
|
|
@@ -10,7 +10,7 @@ interface UseScrollDrawProgressOptions {
|
|
|
10
10
|
/** Same speed multiplier as ScrollDraw. Values > 1 complete faster. Default 1. */
|
|
11
11
|
speed?: number;
|
|
12
12
|
/** Same easing curves as ScrollDraw. Default 'linear'. */
|
|
13
|
-
easing?:
|
|
13
|
+
easing?: Easing;
|
|
14
14
|
/** Same trigger syntax as ScrollDraw. Default: start 'top bottom', end 'bottom top'. */
|
|
15
15
|
trigger?: TriggerConfig;
|
|
16
16
|
/** Scroll axis. Default 'y'. */
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { RefObject } from 'react';
|
|
2
|
-
import { E as
|
|
3
|
-
import { S as ScrollAnimateOptions } from '../engine-
|
|
4
|
-
import { S as ScrollCounterOptions } from '../index-
|
|
2
|
+
import { E as Easing, T as TriggerConfig, a as ScrollDrawOptions } from '../types-iITMwrru.js';
|
|
3
|
+
import { S as ScrollAnimateOptions } from '../engine-DAlvk6i0.js';
|
|
4
|
+
import { S as ScrollCounterOptions } from '../index-MdQ4ti_z.js';
|
|
5
5
|
import { ScrollVideoOptions } from '../video/index.js';
|
|
6
6
|
import { ScrollFramesOptions } from '../frames/index.js';
|
|
7
7
|
import { ScrollTextOptions } from '../text/index.js';
|
|
@@ -10,7 +10,7 @@ interface UseScrollDrawProgressOptions {
|
|
|
10
10
|
/** Same speed multiplier as ScrollDraw. Values > 1 complete faster. Default 1. */
|
|
11
11
|
speed?: number;
|
|
12
12
|
/** Same easing curves as ScrollDraw. Default 'linear'. */
|
|
13
|
-
easing?:
|
|
13
|
+
easing?: Easing;
|
|
14
14
|
/** Same trigger syntax as ScrollDraw. Default: start 'top bottom', end 'bottom top'. */
|
|
15
15
|
trigger?: TriggerConfig;
|
|
16
16
|
/** Scroll axis. Default 'y'. */
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import {c,d as d$1,b as b$1,a as a$4}from'../chunk-KN2YB54Z.mjs';import {a as a$7}from'../chunk-HJTHOZK5.mjs';import {a as a$2}from'../chunk-GBFWTY5L.mjs';import {a as a$8}from'../chunk-UF3MO5XQ.mjs';import {a as a$6}from'../chunk-Z72TVDHY.mjs';import {a as a$5}from'../chunk-HAGTU5EX.mjs';import {b as b$2}from'../chunk-XLXVGQ3P.mjs';import'../chunk-7LDSB4FT.mjs';import {a as a$3}from'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-YOOPMYT6.mjs';import'../chunk-2PYLM3E7.mjs';import {a,e,b,c as c$1}from'../chunk-NV6YTPHI.mjs';import {f as f$1}from'../chunk-IXR6RML7.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$1}from'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';import ee,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function _(o,r={}){let[s,e$1]=useState(0),t=useRef(r);t.current=r;let n=useRef(0);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){e$1(1);return}let l=typeof o=="string"?document.querySelector(o):o.current;if(!l)return;let c=l,{axis:i="y",scrollContainer:m,trigger:g={}}=t.current,a$2=typeof m=="string"?document.querySelector(m):m??null,K=a(g.start||"top bottom"),W=a(g.end||"bottom top"),y=0,E=0;function R(){return a$2?i==="x"?a$2.scrollLeft:a$2.scrollTop:i==="x"?window.scrollX:window.scrollY}function X(){return a$2?i==="x"?a$2.clientWidth:a$2.clientHeight:i==="x"?window.innerWidth:window.innerHeight}function x(){let u=a$3(c,a$2,i);({tStart:y,tEnd:E}=c$1(u,u.scroll,X(),K,W));}function $(){let{speed:u=1,easing:G="linear",once:J=false}=t.current,Y=f$1(G),T=b(R(),y,E,u),B=Y(J?n.current=Math.max(n.current,T):T);e$1(B);}x();let P=e(a$2??window,[c],()=>b(R(),y,E,Math.min(t.current.speed??1,1)),$,x),b$1=a$1(u=>{u&&(b$1(),P.off(),e$1(1));});return ()=>{b$1(),P.off();}},[]),s}function f(o,r,s,e=a$4(r)){let t=useRef(r);t.current=r,useEffect(()=>{if(!o.current)return;let n=s(o.current,b$1(t.current,()=>t.current));return ()=>n.destroy()},[e]);}var te=/^(data-|aria-)|^(id|role|title|tabIndex|lang|dir|hidden)$/;function d(o){let r={},s={};for(let[e,t]of Object.entries(o))(te.test(e)?s:r)[e]=t;return [r,s]}function Ee({children:o,className:r,style:s,...e}){let t=useRef(null),[n,l]=d(e);return f(t,n,b$2),jsx("div",{ref:t,className:r,style:s,...l,children:o})}function Oe({children:o,className:r,style:s,...e}){let t=useRef(null),[n,l]=d(e);return f(t,n,a$5),jsx("div",{ref:t,className:r,style:s,...l,children:o})}function we({className:o,style:r,...s}){let e=useRef(null),[t,n]=d(s);return f(e,t,a$6),jsx("span",{ref:e,className:o,style:r,...n})}function Re({src:o,poster:r,className:s,style:e,muted:t=true,playsInline:n=true,...l}){let c=useRef(null),[i,m]=d(l);return f(c,i,a$7),jsx("video",{...m,ref:c,src:o,poster:r,className:s,style:e,muted:t,playsInline:n,preload:i.preload??"auto"})}function xe({className:o,style:r,role:s="img",triggerElement:e,...t}){let n=useRef(null),[l,c$1]=d(t),i=e&&"current"in e?e:null;return !i&&e&&(l.triggerElement=e),f(n,l,(m,g)=>a$2(m,{...g,frames:l.frames,...i&&{triggerElement:i.current??void 0}}),c(l)+(i?"+ref":"")),useEffect(()=>d$1(n.current),[]),jsx("canvas",{...c$1,ref:n,role:s,className:o,style:r})}function Pe({children:o,as:r="p",className:s,style:e,...t}){let n=useRef(null),[l,c]=d(t);return f(n,l,a$8),ee.createElement(r,{...c,ref:n,className:s,style:e},o)}export{Oe as ScrollAnimate,we as ScrollCounter,Ee as ScrollDraw,xe as ScrollFrames,Pe as ScrollText,Re as ScrollVideo,_ as useScrollDrawProgress};
|
package/dist/reveal/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function ze({tension:e=2.5,friction:t=2.2}={}){return n=>1-Math.cos(n*Math.PI*e)*Math.pow(1-n,t)}function Xe({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(r),s=0,a=[];for(let l=0;l<n;l++){let f=Math.pow(o,l);a.push(f),s+=f;}let m=[0],c=0;for(let l=0;l<n;l++)c+=a[l]/s,m.push(c);return l=>{if(l<=0)return 0;if(l>=1)return 1;for(let f=0;f<n;f++)if(l<=m[f+1]){let d=(l-m[f])/(m[f+1]-m[f]);if(f===0)return d*(2-d);let E=1-Math.pow(r,f);return E+(1-E)*(2*d-1)*(2*d-1)}return 1}}function Ye({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),o=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var H={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:ze(),bounce:Xe(),elastic:Ye()};function pe(e,t,n){return Math.min(n,Math.max(t,e))}function ne(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}var be=(e,t)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:t;function de(e,t,n,r){return e+n+t*be(r,0)}function ge(e,t){return t*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:be(e,1))}function V(e,t,n,r){return n===t?0:pe((e-t)/(n-t)*r,0,1)}function re(e,t,n,r,o){let s=de(e.top,e.height,t,r.element)-ge(r.viewport,n),a=de(e.top,e.height,t,o.element)-ge(o.viewport,n);return {tStart:s,tEnd:a}}function he(e,t,n){let r=e.getBoundingClientRect(),o=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:r.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:o,scroll:0}:{top:n==="x"?r.left:r.top,height:o,scroll:n==="x"?window.scrollX:window.scrollY}}function ye(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 n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function ve(e,t,n){let r=ye(e),o=ye(t);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*n)},${Math.round(r[1]+(o[1]-r[1])*n)},${Math.round(r[2]+(o[2]-r[2])*n)})`}var Ge="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Qe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Ee=33;function je(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function qe(e){let t=[];for(let n=0;n<Ee;n++){let r=n/(Ee-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function we(e){switch(e){case "linear":return "linear";case "ease-in":return Ge;case "ease-out":return Qe;case "ease-in-out":return je()?qe(H["ease-in-out"]):null;default:return null}}var Se=Symbol.for("svg-scroll-draw.registry");function Me(){let e=globalThis;return e[Se]||(e[Se]=new Map)}function oe(e,t){Me().set(e,t);}function se(e){Me().delete(e);}var Ue=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function q(e,...t){Ue&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function xe(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let r=t;return r.addListener?.(n),()=>r.removeListener?.(n)}function Le(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=xe(s=>{if(!s)return;r();let a=(n.getProgress?.()??0)>=1;n.destroy(),n=t(a?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(n))o[s]=(...a)=>n[s]?.(...a);return o.destroy=()=>{r(),n.destroy();},o}var W,U=new Set,K=new WeakMap,B=new Map,Re=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Ke(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let r=n;r;r=r.previousElementSibling)t.add(r);return t}function Te(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();W??(W=new ResizeObserver(o=>{let s=false;for(let{target:a}of o)K.get(a)!==Re(a)&&(s=true),K.set(a,"");s&&U.forEach(a=>a());})),U.add(n);let r=Ke(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{K.has(o)||K.set(o,Re(o)),B.set(o,(B.get(o)??0)+1),W.observe(o);}),()=>{U.delete(n)&&(r.forEach(o=>{let s=(B.get(o)??1)-1;if(s)return void B.set(o,s);B.delete(o),W?.unobserve(o);}),U.size||(W?.disconnect(),W=void 0));}}function Pe(e,t,n,r,o){let s,a=NaN,m,c,l=()=>{s=0,r(),!m&&!s&&(a=n())>0&&a<1&&(s=requestAnimationFrame(l));},f=()=>{!s&&!m&&n()!==a&&(s=requestAnimationFrame(l));},d=b=>{m=b,cancelAnimationFrame(s),s=a=NaN,f();},E=()=>{clearTimeout(c),o(),f();},h=()=>{clearTimeout(c),c=setTimeout(E,150);},w=Te(t,h),R=b=>{e[b]("scroll",f,{passive:true}),window[b]("resize",h),window[b]("orientationchange",h);};return R("addEventListener"),f(),{hold:d,remeasure:E,off(){d(true),R("removeEventListener"),w(),clearTimeout(c);}}}function Ze(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function $e(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let o=[],s=[],a=r[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(c?parseFloat(c[1]):0),s.push(c?c[2]:"");}t.push({fn:r[1],nums:o,units:s});}return t}function Je(e,t,n){let r=$e(e),o=$e(t);return r.length===0||r.length!==o.length?n<1?e:t:r.map((s,a)=>{let m=o[a];return s.fn!==m.fn||s.nums.length!==m.nums.length?n<1?`${s.fn}(${s.nums.map((c,l)=>`${c}${s.units[l]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,l)=>`${c}${m.units[l]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,l)=>`${c+(m.nums[l]-c)*n}${s.units[l]}`).join(", ")})`}).join(" ")}function Ae(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),o=String(t);if(Ze(r))return ve(r,o,n);if(r.includes("("))return Je(r,o,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let m=parseFloat(s[1]),c=parseFloat(a[1]);return `${m+(c-m)*n}${s[2]||a[2]}`}return n<1?r:o}function et(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var tt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nt=0,Ce="--scroll-draw-progress";function rt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Ie={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ne(e,t){return typeof window>"u"?Ie:t.respectReducedMotion===false?_e(e,t,false):Le(t,(n,r)=>_e(e,n,r))}function _e(e,t,n){let{props:r,trigger:o={},easing:s="ease-out",speed:a=1,once:m=false,axis:c="y",scrollContainer:l,native:f=true,velocityScale:d=false,triggerElement:E,onProgress:h,onComplete:w,onEnter:R,onLeave:b,onEnterBack:z,onLeaveBack:X}=t,T=typeof s=="function"?s:H[s]??H["ease-out"],A=ne(o.start||"top bottom"),C=ne(o.end||"bottom top"),Y=E??e,S=typeof l=="string"?document.querySelector(l):l??null,M=Object.entries(r).map(([i,u])=>({prop:et(i),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function Fe(){let i=window.getComputedStyle(e);for(let u of M)u.from===""&&(u.from=i.getPropertyValue(u.prop).trim()||"0");}function De(){for(let i of M)e.style.setProperty(i.prop,String(i.to));}let Z=new Map;for(let i of [...M.map(u=>u.prop),Ce])Z.set(i,e.style.getPropertyValue(i));function J(){for(let[i,u]of Z)u?e.style.setProperty(i,u):e.style.removeProperty(i);}if(n)return De(),w?.(),{...Ie,destroy:J,getProgress:()=>1};Fe();let O=()=>S?c==="x"?S.scrollLeft:S.scrollTop:c==="x"?window.scrollX:window.scrollY,ae=()=>S?c==="x"?S.clientWidth:S.clientHeight:c==="x"?window.innerWidth:window.innerHeight,ue=typeof s=="string"?we(s):null;function He(){if(!f||!rt()||!ue||c!=="y"||S||Y!==e||m||a!==1||h||w||R||b||z||X||d!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let i of M)if(!tt.has(i.prop))return false;return true}function Ve(){let i=`ssd-a-${++nt}`,u=M.map(p=>`${p.prop}:${p.from}`).join(";"),N=M.map(p=>`${p.prop}:${p.to}`).join(";"),L=document.createElement("style");L.setAttribute("data-ssd-animate",""),L.textContent=`@keyframes ${i}{from{${u}}to{${N}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ue};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(L),e.classList.add(i);let v=()=>{let p=e.getBoundingClientRect();return re({top:p.top,height:p.height},O(),ae(),A,C)};oe(e,{type:"animate",getProgress:()=>g.getProgress(),getTrigger:v});let g={refresh(){},destroy(){e.classList.remove(i),L.remove(),e.style.animationPlayState="",J(),se(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(p){let D=Math.min(1,Math.max(0,p));e.classList.remove(i);for(let j of M)e.style.setProperty(j.prop,Ae(j.from,j.to,D));},getProgress(){let{tStart:p,tEnd:D}=v();return T(V(O(),p,D,a))}};return g}if(He())return Ve();let y=0,x=0,_=false,ee=-1,I=0,P=0,G=false,$=NaN,te=-1,ce=0,k=Y===e?M:[],le=false;function me(){let i=e.style,u=k.map(g=>i.getPropertyValue(g.prop)),N=i.transition;k.length&&(i.transition="none"),k.forEach(g=>i.setProperty(g.prop,Z.get(g.prop)??""));let L=he(Y,S,c);k.forEach((g,p)=>i.setProperty(g.prop,u[p])),k.length&&(e.offsetWidth,i.transition=N);let v=re(L,L.scroll,ae(),A,C);le&&Math.abs(v.tStart-y)<1&&Math.abs(v.tEnd-x)<1||(le=true,y=v.tStart,x=v.tEnd);}function Q(i){e.style.setProperty(Ce,String(i));for(let u of M)e.style.setProperty(u.prop,Ae(u.from,u.to,i));h?.(i);}function We(i){if(isNaN($)){$=i;return}$<=0&&i>0&&R?.(),$<1&&i>=1&&b?.(),$>=1&&i<1&&z?.(),$>0&&i<=0&&X?.(),$=i;}function Be(){if(_)return;let i=performance.now(),u=O(),N=a;if(d!==false){let p=i-ce,D=p>0?Math.abs(u-(te<0?u:te))/p:0;N=a*Math.max(.2,1+D*(typeof d=="number"?d:1)*.04);}te=u,ce=i;let L=x===y?0:(u-y)/(x-y);We(L);let v=V(u,y,x,N),g=m?Math.max(ee,T(I=Math.max(I,v))):T(v);P=g,Q(g),g>=1&&!G?(G=true,w?.()):g<1&&!m&&(G=false);}let F=Pe(S??window,[Y],()=>V(O(),y,x,Math.min(a,1)),Be,me);me(),x===y&&q("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),I=V(O(),y,x,a),P=T(I),Q(P),oe(e,{type:"animate",getProgress:()=>P,getTrigger:()=>({tStart:y,tEnd:x})});function fe(){_=true,F.hold(true);}return {destroy(){_=true,F.off(),J(),se(e);},replay(){ee=-1,I=0,G=false,P=0,_=false,Q(0),F.hold(false);},pause:fe,resume(){_&&(_=false,F.hold(false));},seek(i){let u=Math.min(1,Math.max(0,i));P=u,ee=u,I=0,fe(),Q(u);},getProgress(){return P},refresh:F.remeasure}}var ot={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function st(e){let t={};e.opacity!==void 0&&(t.opacity=[e.opacity,1]);let n=[],r=[];return e.x!==void 0&&(n.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(n.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(n.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(n.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(n.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(n.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),n.length>0&&(t.transform=[n.join(" "),r.join(" ")]),t}function it(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function ie(e){let t=e.trim().split(/\s+/),[n,r]=t.length>1?t:/%$/.test(t[0])?["top",t[0]]:[t[0],"bottom"];return [n,/%$/.test(r)?parseFloat(r):r==="top"?0:r==="center"?50:100]}function Oe(e,t){let[n,r]=ie(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function at(e){let t=NaN,n=0,r=0;return e.map(o=>{let s=o.getBoundingClientRect();return Math.abs(s.top-t)<=Math.max(8,Math.min(s.height,n||s.height)/2)?r++:(t=s.top,n=s.height,r=0),r})}var ke={destroy:()=>{}};function kt(e,t={}){if(typeof window>"u")return ke;let n=it(e);if(!n.length)return q("scrollReveal: no elements found:",e),ke;let{preset:r="fadeUp",from:o,stagger:s=.15,easing:a="ease-out",once:m=true,trigger:c,onEnter:l,onLeave:f}=t,d={...ot[r],...o},E=st(d),h=c?.start||"top 88%",w=c?.end||"top 53%",R=Math.abs(ie(h)[1]-ie(w)[1]),b=Math.min(Math.max(s,0),1)*R,z=b>0?at(n):n.map(()=>0),X=n.map((T,A)=>{let C=Math.min(z[A]*b,R);return Ne(T,{props:E,easing:a,once:m,native:false,trigger:C>0?{start:Oe(h,C),end:Oe(w,C)}:{start:h,end:w},onEnter:A===0?l:void 0,onLeave:A===n.length-1?f:void 0})});return {destroy(){X.forEach(T=>T.destroy());}}}exports.scrollReveal=kt;
|
|
1
|
+
'use strict';var Qe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function O(e,...n){Qe&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function je({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function Ge({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),s=Math.sqrt(r),o=0,i=[];for(let m=0;m<t;m++){let f=Math.pow(s,m);i.push(f),o+=f;}let u=[0],c=0;for(let m=0;m<t;m++)c+=i[m]/o,u.push(c);return m=>{if(m<=0)return 0;if(m>=1)return 1;for(let f=0;f<t;f++)if(m<=u[f+1]){let d=(m-u[f])/(u[f+1]-u[f]);if(f===0)return d*(2-d);let E=1-Math.pow(r,f);return E+(1-E)*(2*d-1)*(2*d-1)}return 1}}function Ue({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),s=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return o=>o<=0?0:o>=1?1:t*Math.pow(2,-10*o)*Math.sin((o-s)*(2*Math.PI)/r)+1}var F={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:je(),bounce:Ge(),elastic:Ue()};function qe(e,n,t,r){let s=(o,i,u)=>((1+3*o-3*i)*u+3*i-6*o)*u*u+3*o*u;return o=>{if(o<=0||o>=1)return +(o>0);let i=o;for(let u=0;u<8;u++)i-=(s(e,t,i)-o)/((3*(1+3*e-3*t)*i+6*t-12*e)*i+3*e);if(!(i>=0&&i<=1&&Math.abs(s(e,t,i)-o)<1e-9))for(let u=0,c=0,m=1;u<30;u++)i=(c+m)/2,s(e,t,i)<o?c=i:m=i;return s(n,r,i)}}function ne(e){let n=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=n?n[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [qe(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var de=new Set;function ge(e,n="linear"){if(typeof e=="function")return e;if(e==null)return F[n];if({}.hasOwnProperty.call(F,e))return F[e];let t=ne(String(e));return t?t[0]:(!de.has(e)&&de.add(e)&&O(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),F[n])}function be(e,n,t){return Math.min(t,Math.max(n,e))}function re(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}var ve=(e,n)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:n;function he(e,n,t,r){return e+t+n*ve(r,0)}function ye(e,n){return n*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:ve(e,1))}function z(e,n,t,r){return t===n?0:be((e-n)/(t-n)*r,0,1)}function oe(e,n,t,r,s){let o=he(e.top,e.height,n,r.element)-ye(r.viewport,t),i=he(e.top,e.height,n,s.element)-ye(s.viewport,t);return {tStart:o,tEnd:i}}function Ee(e,n,t){let r=e.getBoundingClientRect(),s=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left-n.clientLeft+n.scrollLeft:r.top-n.getBoundingClientRect().top-n.clientTop+n.scrollTop,height:s,scroll:0}:{top:t==="x"?r.left:r.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function we(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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function Se(e,n,t){let r=we(e),s=we(n);return !r||!s?e:`rgb(${Math.round(r[0]+(s[0]-r[0])*t)},${Math.round(r[1]+(s[1]-r[1])*t)},${Math.round(r[2]+(s[2]-r[2])*t)})`}var Je="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ke="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Me=33;function Ze(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function et(e){let n=[];for(let t=0;t<Me;t++){let r=t/(Me-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function Le(e){switch(e){case "linear":return "linear";case "ease-in":return Je;case "ease-out":return Ke;case "ease-in-out":return Ze()?et(F["ease-in-out"]):null;default:return ne(e)?.[1]??null}}var xe=Symbol.for("svg-scroll-draw.registry");function Re(){let e=globalThis;return e[xe]||(e[xe]=new Map)}function se(e,n){Re().set(e,n);}function ie(e){Re().delete(e);}function Te(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}function $e(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=Te(o=>{if(!o)return;r();let i=(t.getProgress?.()??0)>=1;t.destroy(),t=n(i?{...e,onComplete:void 0}:e,true);}),s={};for(let o of Object.keys(t))s[o]=(...i)=>t[o]?.(...i);return s.destroy=()=>{r(),t.destroy();},s}var W,q=new Set,J=new WeakMap,B=new Map,Pe=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function tt(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function Ae(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();W??(W=new ResizeObserver(s=>{let o=false;for(let{target:i}of s)J.get(i)!==Pe(i)&&(o=true),J.set(i,"");o&&q.forEach(i=>i());})),q.add(t);let r=tt(e);return [document.body,document.documentElement].forEach(s=>s&&r.add(s)),r.forEach(s=>{J.has(s)||J.set(s,Pe(s)),B.set(s,(B.get(s)??0)+1),W.observe(s);}),()=>{q.delete(t)&&(r.forEach(s=>{let o=(B.get(s)??1)-1;if(o)return void B.set(s,o);B.delete(s),W?.unobserve(s);}),q.size||(W?.disconnect(),W=void 0));}}function Ce(e,n,t,r,s){let o,i=NaN,u,c,m=()=>{o=0,r(),!u&&!o&&(i=t())>0&&i<1&&(o=requestAnimationFrame(m));},f=()=>{!o&&!u&&t()!==i&&(o=requestAnimationFrame(m));},d=b=>{u=b,cancelAnimationFrame(o),o=i=NaN,f();},E=()=>{clearTimeout(c),s(),f();},h=()=>{clearTimeout(c),c=setTimeout(E,150);},w=Ae(n,h),R=b=>{e[b]("scroll",f,{passive:true}),window[b]("resize",h),window[b]("orientationchange",h);};return R("addEventListener"),f(),{hold:d,remeasure:E,off(){d(true),R("removeEventListener"),w(),clearTimeout(c);}}}function nt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function _e(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let s=[],o=[],i=r[2].trim();if(i)for(let u of i.split(/[\s,]+/)){let c=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}n.push({fn:r[1],nums:s,units:o});}return n}function rt(e,n,t){let r=_e(e),s=_e(n);return r.length===0||r.length!==s.length?t<1?e:n:r.map((o,i)=>{let u=s[i];return o.fn!==u.fn||o.nums.length!==u.nums.length?t<1?`${o.fn}(${o.nums.map((c,m)=>`${c}${o.units[m]}`).join(", ")})`:`${u.fn}(${u.nums.map((c,m)=>`${c}${u.units[m]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,m)=>`${c+(u.nums[m]-c)*t}${o.units[m]}`).join(", ")})`}).join(" ")}function Ie(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),s=String(n);if(nt(r))return Se(r,s,t);if(r.includes("("))return rt(r,s,t);let o=r.match(/^([-+]?[\d.]+)(.*)$/),i=s.match(/^([-+]?[\d.]+)(.*)$/);if(o&&i){let u=parseFloat(o[1]),c=parseFloat(i[1]);return `${u+(c-u)*t}${o[2]||i[2]}`}return t<1?r:s}function ot(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var st=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),it=0,Ne="--scroll-draw-progress";function at(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Fe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ke(e,n){return typeof window>"u"?Fe:n.respectReducedMotion===false?Oe(e,n,false):$e(n,(t,r)=>Oe(e,t,r))}function Oe(e,n,t){let{props:r,trigger:s={},easing:o="ease-out",speed:i=1,once:u=false,axis:c="y",scrollContainer:m,native:f=true,velocityScale:d=false,triggerElement:E,onProgress:h,onComplete:w,onEnter:R,onLeave:b,onEnterBack:X,onLeaveBack:Y}=n,T=ge(o,"ease-out"),A=re(s.start||"top bottom"),C=re(s.end||"bottom top"),Q=E??e,S=typeof m=="string"?document.querySelector(m):m??null,M=Object.entries(r).map(([a,l])=>({prop:ot(a),from:Array.isArray(l)?l[0]:"",to:Array.isArray(l)?l[1]:l}));function Ve(){let a=window.getComputedStyle(e);for(let l of M)l.from===""&&(l.from=a.getPropertyValue(l.prop).trim()||"0");}function ze(){for(let a of M)e.style.setProperty(a.prop,String(a.to));}let K=new Map;for(let a of [...M.map(l=>l.prop),Ne])K.set(a,e.style.getPropertyValue(a));function Z(){for(let[a,l]of K)l?e.style.setProperty(a,l):e.style.removeProperty(a);}if(t)return ze(),w?.(),{...Fe,destroy:Z,getProgress:()=>1};Ve();let k=()=>S?c==="x"?S.scrollLeft:S.scrollTop:c==="x"?window.scrollX:window.scrollY,ue=()=>S?c==="x"?S.clientWidth:S.clientHeight:c==="x"?window.innerWidth:window.innerHeight,ce=typeof o=="string"?Le(o):null;function We(){if(!f||!at()||!ce||c!=="y"||S||Q!==e||u||i!==1||h||w||R||b||X||Y||d!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let a of M)if(!st.has(a.prop))return false;return true}function Be(){let a=`ssd-a-${++it}`,l=M.map(p=>`${p.prop}:${p.from}`).join(";"),N=M.map(p=>`${p.prop}:${p.to}`).join(";"),x=document.createElement("style");x.setAttribute("data-ssd-animate",""),x.textContent=`@keyframes ${a}{from{${l}}to{${N}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(x),e.classList.add(a);let v=()=>{let p=e.getBoundingClientRect();return oe({top:p.top,height:p.height},k(),ue(),A,C)};se(e,{type:"animate",getProgress:()=>g.getProgress(),getTrigger:v});let g={refresh(){},destroy(){e.classList.remove(a),x.remove(),e.style.animationPlayState="",Z(),ie(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(p){let V=Math.min(1,Math.max(0,p));e.classList.remove(a);for(let U of M)e.style.setProperty(U.prop,Ie(U.from,U.to,V));},getProgress(){let{tStart:p,tEnd:V}=v();return T(z(k(),p,V,i))}};return g}if(We())return Be();let y=0,L=0,_=false,ee=-1,I=0,$=0,j=false,P=NaN,te=-1,le=0,D=Q===e?M:[],me=false;function fe(){let a=e.style,l=D.map(g=>a.getPropertyValue(g.prop)),N=a.transition;D.length&&(a.transition="none"),D.forEach(g=>a.setProperty(g.prop,K.get(g.prop)??""));let x=Ee(Q,S,c);D.forEach((g,p)=>a.setProperty(g.prop,l[p])),D.length&&(e.offsetWidth,a.transition=N);let v=oe(x,x.scroll,ue(),A,C);me&&Math.abs(v.tStart-y)<1&&Math.abs(v.tEnd-L)<1||(me=true,y=v.tStart,L=v.tEnd);}function G(a){e.style.setProperty(Ne,String(a));for(let l of M)e.style.setProperty(l.prop,Ie(l.from,l.to,a));h?.(a);}function Xe(a){if(isNaN(P)){P=a;return}P<=0&&a>0&&R?.(),P<1&&a>=1&&b?.(),P>=1&&a<1&&X?.(),P>0&&a<=0&&Y?.(),P=a;}function Ye(){if(_)return;let a=performance.now(),l=k(),N=i;if(d!==false){let p=a-le,V=p>0?Math.abs(l-(te<0?l:te))/p:0;N=i*Math.max(.2,1+V*(typeof d=="number"?d:1)*.04);}te=l,le=a;let x=L===y?0:(l-y)/(L-y);Xe(x);let v=z(l,y,L,N),g=u?Math.max(ee,T(I=Math.max(I,v))):T(v);$=g,G(g),g>=1&&!j?(j=true,w?.()):g<1&&!u&&(j=false);}let H=Ce(S??window,[Q],()=>z(k(),y,L,Math.min(i,1)),Ye,fe);fe(),L===y&&O("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),I=z(k(),y,L,i),$=T(I),G($),se(e,{type:"animate",getProgress:()=>$,getTrigger:()=>({tStart:y,tEnd:L})});function pe(){_=true,H.hold(true);}return {destroy(){_=true,H.off(),Z(),ie(e);},replay(){ee=-1,I=0,j=false,$=0,_=false,G(0),H.hold(false);},pause:pe,resume(){_&&(_=false,H.hold(false));},seek(a){let l=Math.min(1,Math.max(0,a));$=l,ee=l,I=0,pe(),G(l);},getProgress(){return $},refresh:H.remeasure}}var ut={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function ct(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function lt(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function ae(e){let n=e.trim().split(/\s+/),[t,r]=n.length>1?n:/%$/.test(n[0])?["top",n[0]]:[n[0],"bottom"];return [t,/%$/.test(r)?parseFloat(r):r==="top"?0:r==="center"?50:100]}function De(e,n){let[t,r]=ae(e);return `${t} ${+Math.max(0,r-n).toFixed(3)}%`}function mt(e){let n=NaN,t=0,r=0;return e.map(s=>{let o=s.getBoundingClientRect();return Math.abs(o.top-n)<=Math.max(8,Math.min(o.height,t||o.height)/2)?r++:(n=o.top,t=o.height,r=0),r})}var He={destroy:()=>{}};function zt(e,n={}){if(typeof window>"u")return He;let t=lt(e);if(!t.length)return O("scrollReveal: no elements found:",e),He;let{preset:r="fadeUp",from:s,stagger:o=.15,easing:i="ease-out",once:u=true,trigger:c,onEnter:m,onLeave:f}=n,d={...ut[r],...s},E=ct(d),h=c?.start||"top 88%",w=c?.end||"top 53%",R=Math.abs(ae(h)[1]-ae(w)[1]),b=Math.min(Math.max(o,0),1)*R,X=b>0?mt(t):t.map(()=>0),Y=t.map((T,A)=>{let C=Math.min(X[A]*b,R);return ke(T,{props:E,easing:i,once:u,native:false,trigger:C>0?{start:De(h,C),end:De(w,C)}:{start:h,end:w},onEnter:A===0?m:void 0,onLeave:A===t.length-1?f:void 0})});return {destroy(){Y.forEach(T=>T.destroy());}}}exports.scrollReveal=zt;
|
package/dist/reveal/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as Easing, T as TriggerConfig } from '../types-iITMwrru.mjs';
|
|
2
2
|
|
|
3
3
|
interface ScrollRevealFrom {
|
|
4
4
|
/** Start opacity (0–1). Animates to 1. */
|
|
@@ -53,7 +53,7 @@ interface ScrollRevealOptions {
|
|
|
53
53
|
*/
|
|
54
54
|
stagger?: number;
|
|
55
55
|
/** Animation easing. Default: `'ease-out'`. */
|
|
56
|
-
easing?:
|
|
56
|
+
easing?: Easing;
|
|
57
57
|
/** Freeze at max progress — don't reverse on scroll back. Default: true. */
|
|
58
58
|
once?: boolean;
|
|
59
59
|
/** Override the default trigger window. */
|
package/dist/reveal/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as Easing, T as TriggerConfig } from '../types-iITMwrru.js';
|
|
2
2
|
|
|
3
3
|
interface ScrollRevealFrom {
|
|
4
4
|
/** Start opacity (0–1). Animates to 1. */
|
|
@@ -53,7 +53,7 @@ interface ScrollRevealOptions {
|
|
|
53
53
|
*/
|
|
54
54
|
stagger?: number;
|
|
55
55
|
/** Animation easing. Default: `'ease-out'`. */
|
|
56
|
-
easing?:
|
|
56
|
+
easing?: Easing;
|
|
57
57
|
/** Freeze at max progress — don't reverse on scroll back. Default: true. */
|
|
58
58
|
once?: boolean;
|
|
59
59
|
/** Override the default trigger window. */
|
package/dist/reveal/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-HAGTU5EX.mjs';import'../chunk-7LDSB4FT.mjs';import'../chunk-UPWWULKI.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}from'../chunk-LFSU6LR3.mjs';var M={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function P(e){let r={};e.opacity!==void 0&&(r.opacity=[e.opacity,1]);let t=[],n=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),n.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),n.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),n.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),n.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),n.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),n.push("rotateY(0deg)")),t.length>0&&(r.transform=[t.join(" "),n.join(" ")]),r}function Y(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function d(e){let r=e.trim().split(/\s+/),[t,n]=r.length>1?r:/%$/.test(r[0])?["top",r[0]]:[r[0],"bottom"];return [t,/%$/.test(n)?parseFloat(n):n==="top"?0:n==="center"?50:100]}function y(e,r){let[t,n]=d(e);return `${t} ${+Math.max(0,n-r).toFixed(3)}%`}function w(e){let r=NaN,t=0,n=0;return e.map(a=>{let o=a.getBoundingClientRect();return Math.abs(o.top-r)<=Math.max(8,Math.min(o.height,t||o.height)/2)?n++:(r=o.top,t=o.height,n=0),n})}var v={destroy:()=>{}};function A(e,r={}){if(typeof window>"u")return v;let t=Y(e);if(!t.length)return b("scrollReveal: no elements found:",e),v;let{preset:n="fadeUp",from:a$1,stagger:o=.15,easing:R="ease-out",once:b$1=true,trigger:u,onEnter:x,onLeave:E}=r,S={...M[n],...a$1},X=P(S),s=u?.start||"top 88%",i=u?.end||"top 53%",f=Math.abs(d(s)[1]-d(i)[1]),g=Math.min(Math.max(o,0),1)*f,$=g>0?w(t):t.map(()=>0),L=t.map((l,c)=>{let p=Math.min($[c]*g,f);return a(l,{props:X,easing:R,once:b$1,native:false,trigger:p>0?{start:y(s,p),end:y(i,p)}:{start:s,end:i},onEnter:c===0?x:void 0,onLeave:c===t.length-1?E:void 0})});return {destroy(){L.forEach(l=>l.destroy());}}}export{A as scrollReveal};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ScrollDrawOptions, S as ScrollDrawInstance } from './types-
|
|
1
|
+
import { a as ScrollDrawOptions, S as ScrollDrawInstance } from './types-iITMwrru.mjs';
|
|
2
2
|
|
|
3
3
|
declare function scrollDraw(target: string | Element, options?: ScrollDrawOptions): ScrollDrawInstance;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ScrollDrawOptions, S as ScrollDrawInstance } from './types-
|
|
1
|
+
import { a as ScrollDrawOptions, S as ScrollDrawInstance } from './types-iITMwrru.js';
|
|
2
2
|
|
|
3
3
|
declare function scrollDraw(target: string | Element, options?: ScrollDrawOptions): ScrollDrawInstance;
|
|
4
4
|
|
package/dist/snap/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';var U=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function _(e,...t){U&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function X({tension:e=2.5,friction:t=2.2}={}){return n=>1-Math.cos(n*Math.PI*e)*Math.pow(1-n,t)}function j({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),l=Math.max(.01,Math.min(.99,t)),d=Math.sqrt(l),o=0,i=[];for(let c=0;c<n;c++){let u=Math.pow(d,c);i.push(u),o+=u;}let s=[0],g=0;for(let c=0;c<n;c++)g+=i[c]/o,s.push(g);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let u=0;u<n;u++)if(c<=s[u+1]){let h=(c-s[u])/(s[u+1]-s[u]);if(u===0)return h*(2-h);let M=1-Math.pow(l,u);return M+(1-M)*(2*h-1)*(2*h-1)}return 1}}function Z({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),l=Math.max(.1,t),d=n<=1?l/4:l/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-d)*(2*Math.PI)/l)+1}var R={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:X(),bounce:j(),elastic:Z()};function ee(e,t,n,l){let d=(o,i,s)=>((1+3*o-3*i)*s+3*i-6*o)*s*s+3*o*s;return o=>{if(o<=0||o>=1)return +(o>0);let i=o;for(let s=0;s<8;s++)i-=(d(e,n,i)-o)/((3*(1+3*e-3*n)*i+6*n-12*e)*i+3*e);if(!(i>=0&&i<=1&&Math.abs(d(e,n,i)-o)<1e-9))for(let s=0,g=0,c=1;s<30;s++)i=(g+c)/2,d(e,n,i)<o?g=i:c=i;return d(t,l,i)}}function ne(e){let t=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),n=t?t[1].split(",").map(parseFloat):[];if(n.length===4&&n.every(Number.isFinite)&&n[0]*(1-n[0])>=0&&n[2]*(1-n[2])>=0)return [ee(n[0],n[1],n[2],n[3]),`cubic-bezier(${n})`]}var q=new Set;function F(e,t="linear"){if(typeof e=="function")return e;if(e==null)return R[t];if({}.hasOwnProperty.call(R,e))return R[e];let n=ne(String(e));return n?n[0]:(!q.has(e)&&q.add(e)&&_(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),R[t])}function T(e,t,n){return Math.min(n,Math.max(t,e))}function P(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function $(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=d=>e(!!d.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let l=t;return l.addListener?.(n),()=>l.removeListener?.(n)}var H=Symbol.for("svg-scroll-draw.registry");function W(){let e=globalThis;return e[H]||(e[H]=new Map)}function B(e,t){W().set(e,t);}function G(e){W().delete(e);}var k={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function te(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function ge(e,t={}){if(typeof window>"u")return k;let n=te(e);if(!n.length)return _("scrollSnap: no sections found"),k;let{direction:l="vertical",duration:d=600,easing:o="ease-in-out",threshold:i=.3,scrollContainer:s,onSnap:g,respectReducedMotion:c=true}=t,u=c&&P(),h=c?$(r=>{u=r;}):()=>{},M=F(o,"ease-in-out"),E=l==="horizontal",x=E?"Width":"Height",N=E?"left":"top",b=typeof s=="string"?document.querySelector(s):s??null,I=false,w=0;function v(){return b?E?b.scrollLeft:b.scrollTop:E?window.scrollX:window.scrollY}function C(r){let a=b??window,m=E?{left:r}:{top:r};try{a.scrollTo({...m,behavior:"instant"});}catch{a.scrollTo(m);}}function S(){let r=b??document.scrollingElement??document.documentElement,a=r[`scroll${x}`]-r[`client${x}`],m=b?b.getBoundingClientRect()[N]+b[E?"clientLeft":"clientTop"]:0,p=v();return n.map(y=>T(y.getBoundingClientRect()[N]-m+p,0,a))}function Y(){let r=v(),a=S();return a.reduce((m,p,y)=>Math.abs(p-r)<Math.abs(a[m]-r)?y:m,0)}let f=Y();function A(r){I=false,f=r,g?.(r);}function L(r){let a=T(r,0,n.length-1);cancelAnimationFrame(w),I=true;let m=S(),p=v(),y=m[a];if(Math.abs(p-y)<1)return A(a);if(u)return C(y),A(a);let J=performance.now();function Q(K){let V=T((K-J)/d,0,1);C(p+(y-p)*M(V)),V<1?w=requestAnimationFrame(Q):A(a);}w=requestAnimationFrame(Q);}let O;function z(){I||(clearTimeout(O),O=setTimeout(()=>{let r=v(),a=S();if(Math.abs(r-a[f])<1)return;let m=n[f][`offset${x}`],p=r-a[f];p>m*i&&f<n.length-1?L(f+1):p<-(m*i)&&f>0?L(f-1):L(f);},100));}let D=b??window;return D.addEventListener("scroll",z,{passive:true}),B(n[0],{type:"snap",getProgress:()=>f/(n.length-1||1),getTrigger:()=>{let r=S();return {tStart:r[0],tEnd:r[r.length-1]}}}),{destroy(){cancelAnimationFrame(w),clearTimeout(O),D.removeEventListener("scroll",z),h(),G(n[0]);},snapTo:L,getCurrentIndex(){return f}}}exports.scrollSnap=ge;
|
package/dist/snap/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as Easing } from '../types-iITMwrru.mjs';
|
|
2
2
|
|
|
3
3
|
interface ScrollSnapOptions {
|
|
4
4
|
/** Scroll axis. Default: 'vertical'. */
|
|
@@ -6,7 +6,7 @@ interface ScrollSnapOptions {
|
|
|
6
6
|
/** Snap animation duration in ms. Default: 600. */
|
|
7
7
|
duration?: number;
|
|
8
8
|
/** Easing for the snap scroll animation. Default: 'ease-in-out'. */
|
|
9
|
-
easing?:
|
|
9
|
+
easing?: Easing;
|
|
10
10
|
/**
|
|
11
11
|
* Fraction of a section's size the user must scroll past before it snaps
|
|
12
12
|
* forward instead of snapping back. Range 0–1. Default: 0.3.
|
package/dist/snap/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as Easing } from '../types-iITMwrru.js';
|
|
2
2
|
|
|
3
3
|
interface ScrollSnapOptions {
|
|
4
4
|
/** Scroll axis. Default: 'vertical'. */
|
|
@@ -6,7 +6,7 @@ interface ScrollSnapOptions {
|
|
|
6
6
|
/** Snap animation duration in ms. Default: 600. */
|
|
7
7
|
duration?: number;
|
|
8
8
|
/** Easing for the snap scroll animation. Default: 'ease-in-out'. */
|
|
9
|
-
easing?:
|
|
9
|
+
easing?: Easing;
|
|
10
10
|
/**
|
|
11
11
|
* Fraction of a section's size the user must scroll past before it snaps
|
|
12
12
|
* forward instead of snapping back. Range 0–1. Default: 0.3.
|
package/dist/snap/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-AJ22VSHC.mjs';import {
|
|
1
|
+
import {a}from'../chunk-AJ22VSHC.mjs';import {f}from'../chunk-IXR6RML7.mjs';import {a as a$3}from'../chunk-4DOJSIEQ.mjs';import {a as a$1}from'../chunk-5PJEKEEP.mjs';import {a as a$2,b as b$1}from'../chunk-EBU6E26L.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var z={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function D(c){return typeof c=="string"?Array.from(document.querySelectorAll(c)):c instanceof NodeList?Array.from(c):c}function Z(c,N={}){if(typeof window>"u")return z;let i=D(c);if(!i.length)return b("scrollSnap: no sections found"),z;let{direction:$="vertical",duration:B=600,easing:P="ease-in-out",threshold:E=.3,scrollContainer:g,onSnap:_,respectReducedMotion:v=true}=N,y=v&&a(),W=v?a$1(e=>{y=e;}):()=>{},X=f(P,"ease-in-out"),a$4=$==="horizontal",S=a$4?"Width":"Height",w=a$4?"left":"top",s=typeof g=="string"?document.querySelector(g):g??null,h=false,u=0;function m(){return s?a$4?s.scrollLeft:s.scrollTop:a$4?window.scrollX:window.scrollY}function M(e){let t=s??window,n=a$4?{left:e}:{top:e};try{t.scrollTo({...n,behavior:"instant"});}catch{t.scrollTo(n);}}function d(){let e=s??document.scrollingElement??document.documentElement,t=e[`scroll${S}`]-e[`client${S}`],n=s?s.getBoundingClientRect()[w]+s[a$4?"clientLeft":"clientTop"]:0,r=m();return i.map(l=>a$3(l.getBoundingClientRect()[w]-n+r,0,t))}function Y(){let e=m(),t=d();return t.reduce((n,r,l)=>Math.abs(r-e)<Math.abs(t[n]-e)?l:n,0)}let o=Y();function T(e){h=false,o=e,_?.(e);}function f$1(e){let t=a$3(e,0,i.length-1);cancelAnimationFrame(u),h=true;let n=d(),r=m(),l=n[t];if(Math.abs(r-l)<1)return T(t);if(y)return M(l),T(t);let j=performance.now();function I(k){let A=a$3((k-j)/B,0,1);M(r+(l-r)*X(A)),A<1?u=requestAnimationFrame(I):T(t);}u=requestAnimationFrame(I);}let b$2;function x(){h||(clearTimeout(b$2),b$2=setTimeout(()=>{let e=m(),t=d();if(Math.abs(e-t[o])<1)return;let n=i[o][`offset${S}`],r=e-t[o];r>n*E&&o<i.length-1?f$1(o+1):r<-(n*E)&&o>0?f$1(o-1):f$1(o);},100));}let L=s??window;return L.addEventListener("scroll",x,{passive:true}),a$2(i[0],{type:"snap",getProgress:()=>o/(i.length-1||1),getTrigger:()=>{let e=d();return {tStart:e[0],tEnd:e[e.length-1]}}}),{destroy(){cancelAnimationFrame(u),clearTimeout(b$2),L.removeEventListener("scroll",x),W(),b$1(i[0]);},snapTo:f$1,getCurrentIndex(){return o}}}export{Z as scrollSnap};
|