svg-scroll-draw 2.23.0 → 2.23.3
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 +16 -13
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +77 -118
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-23EALNDF.mjs +3 -0
- package/dist/{chunk-DY5JCXVR.mjs → chunk-4H2SGMAQ.mjs} +1 -1
- package/dist/{chunk-VMUJMXKO.mjs → chunk-4I7MLTP5.mjs} +1 -1
- package/dist/{chunk-OTDD2ROH.mjs → chunk-BLY6F6EC.mjs} +1 -1
- package/dist/{chunk-GVBO5GRD.mjs → chunk-ETACBG7W.mjs} +1 -1
- package/dist/chunk-GMBIGV3M.mjs +1 -0
- package/dist/chunk-LGJQWZHH.mjs +1 -0
- package/dist/chunk-UPWWULKI.mjs +1 -0
- package/dist/chunk-V4L3ELVC.mjs +1 -0
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +4 -2
- package/dist/group/index.d.ts +4 -2
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +1 -1
- package/dist/timeline/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-HX4SP5WN.mjs +0 -3
- package/dist/chunk-KV3WCPQ5.mjs +0 -1
- package/dist/chunk-LTCJVVSC.mjs +0 -1
- package/dist/chunk-WXUOF4NM.mjs +0 -1
- package/dist/chunk-YWKPTYSG.mjs +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function lr({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Ot({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(n),a=0,c=[];for(let p=0;p<t;p++){let T=Math.pow(s,p);c.push(T),a+=T;}let m=[0],u=0;for(let p=0;p<t;p++)u+=c[p]/a,m.push(u);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<t;T++)if(p<=m[T+1]){let A=(p-m[T])/(m[T+1]-m[T]);if(T===0)return A*(2-A);let b=1-Math.pow(n,T);return b+(1-b)*(2*A-1)*(2*A-1)}return 1}}function Rt({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),s=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-s)*(2*Math.PI)/n)+1}var Z={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ot(),elastic:Rt()};function Ft(e,r,t){return Math.min(t,Math.max(r,e))}function Pe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}function Nt(e,r,t,n){switch(n){case "top":return e+t;case "center":return e+t+r/2;case "bottom":return e+t+r;default:return e+t}}function Ht(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function re(e,r,t,n){return t===r?0:Ft((e-r)/(t-r)*n,0,1)}function Ne(e,r,t,n,s){let a=Nt(e.top,e.height,r,n.element)-Ht(n.viewport,t),c=Nt(e.top,e.height,r,s.element)-Ht(s.viewport,t);return {tStart:a,tEnd:c}}function nt(e,r,t){let n=e.getBoundingClientRect(),s=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:s,scroll:0}:{top:t==="x"?n.left:n.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function We(e){let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(t+n)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function _t(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let 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 n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function ot(e,r,t){let n=_t(e),s=_t(r);return !n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*t)},${Math.round(n[1]+(s[1]-n[1])*t)},${Math.round(n[2]+(s[2]-n[2])*t)})`}var bt={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 Ye=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function G(e,...r){Ye&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var cr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",ur="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Vt=33;function mr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function fr(e){let r=[];for(let t=0;t<Vt;t++){let n=t/(Vt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function st(e){switch(e){case "linear":return "linear";case "ease-in":return cr;case "ease-out":return ur;case "ease-in-out":return mr()?fr(Z["ease-in-out"]):null;default:return null}}var zt=Symbol.for("svg-scroll-draw.registry");function qt(){let e=globalThis;return e[zt]||(e[zt]=new Map)}function $e(e,r){qt().set(e,r);}function ve(e){qt().delete(e);}var Xe,it=new Set,at=new WeakMap,Ze=new Map,Wt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function pr(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function Be(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();Xe??(Xe=new ResizeObserver(s=>{let a=false;for(let{target:c}of s)at.get(c)!==Wt(c)&&(a=true),at.set(c,"");a&&it.forEach(c=>c());})),it.add(t);let n=pr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{at.has(s)||at.set(s,Wt(s)),Ze.set(s,(Ze.get(s)??0)+1),Xe.observe(s);}),()=>{it.delete(t)&&(n.forEach(s=>{let a=(Ze.get(s)??1)-1;if(a)return void Ze.set(s,a);Ze.delete(s),Xe?.unobserve(s);}),it.size||(Xe?.disconnect(),Xe=void 0));}}function lt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function Ge(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=lt(a=>{if(!a)return;n();let c=(t.getProgress?.()??0)>=1;t.destroy(),t=r(c?{...e,onComplete:void 0}:e,true);}),s={};for(let a of Object.keys(t))s[a]=(...c)=>t[a]?.(...c);return s.destroy=()=>{n(),t.destroy();},s}var dr=0;function gr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Bt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Gt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function yr(e){if(!Ye)return;let r=Bt(e,"stroke");if(!r||r==="none"){G("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Gt.has(t)&&!Gt.has(Bt(e,"fill"))&&G("Element has a fill \u2014 it may obscure the stroke animation.",e);}function hr(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let a=t==="x"?window.scrollX:window.scrollY,c=e-a,m=r-a,u=t==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${u?`left:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Bt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Gt=/[MmLlHhVvCcSsQqTtAaZz]/g;function gr(e,r,t){if(!Xe)return;let n=(e.match(Gt)??[]).join("").toUpperCase(),s=(r.match(Gt)??[]).join("").toUpperCase(),a=(e.match(Bt)??[]).length,c=(r.match(Bt)??[]).length;if(n!==s){Y(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}a!==c&&Y(`morphTo: coordinate count differs (${a} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function bt(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let c=parseFloat(a),f=n[s++]??c;return String(+(c+(f-c)*t).toFixed(4))})}function jt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ge(r,(t,n)=>yr(e,t,n))}function yr(e,r,t){let{preset:n,...s}=r,a=n?{...ht[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:f=1,fade:u=false,easing:d="linear",trigger:L={},stagger:P=0,direction:S="forward",once:U=false,debug:pe=false,axis:F="y",scrollContainer:x,autoReverse:A=false,delay:p=0,strokeColor:E,strokeWidth:w,fillOpacity:O,waypoints:z,velocityScale:N=false,threshold:X=0,rootMargin:_e="0px",repeat:le=0,repeatDelay:ce=0,morphTo:H,clip:xe,autoplay:Ne=false,duration:Te=1e3,native:ie=true,onProgress:g,onStart:k,onComplete:de,onEnter:be,onLeave:Ae,onEnterBack:Me,onLeaveBack:He}=a,Z=xe===true?"left":typeof xe=="string"?xe:false,ge=typeof d=="function"?d:te[d]??te.linear,je=$e(L.start??"top bottom"),Qe=$e(L.end??"bottom top"),ae=typeof x=="string"?document.querySelector(x):x??null,K=Array.isArray(E)?E[0]:null,j=Array.isArray(E)?E[1]:typeof E=="string"?E:null,Q=Array.isArray(w)?w[0]:null,W=Array.isArray(w)?w[1]:typeof w=="number"?w:null,re=Array.isArray(O)?O[0]:null,G=Array.isArray(O)?O[1]:typeof O=="number"?O:null;function we(o){let l=o*100;switch(Z){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let D=Z?[]:Array.from(e.querySelectorAll(c)),M=[],ne=[],i=0,m=0,ye=P,ue=0,T=false,C=false,_=0,Ce=false,R=-1,Le=[],De=-1,J=false,ve=0,Pe=0,Ie,mt=null;function xt(){mt?.destroy(),mt=null;}let Oe=new Set,Tt=NaN,Re=true,Je=-1,At=performance.now(),Ve=NaN;function Ye(){return ae?F==="x"?ae.scrollLeft:ae.scrollTop:F==="x"?window.scrollX:window.scrollY}function Mt(){return ae?F==="x"?ae.clientWidth:ae.clientHeight:F==="x"?window.innerWidth:window.innerHeight}function Lt(){let o=ot(e,ae,F);return Fe(o,o.scroll,Mt(),je,Qe)}function Jt(){let o=m-i,l=D.length-1,h=ae??document.documentElement,q=F==="x"?"Width":"Height";if(ye=P,P>0&&l>0&&o>0){let me=h[`scroll${q}`]-h[`client${q}`]-1-i-o/f;me>=0&&(ye=Math.min(P,me/(l*o)));}ue=m+l*ye*o;}function Pt(){(({tStart:i,tEnd:m}=Lt())),Jt(),pe&&Xe&&(xt(),mt=dr(i,m,F));}function ft(o,l=Lt){ke(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let h=o.destroy;return o.destroy=()=>{h.call(o),Se(e);},o}function er(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let h=l==="reverse"?1-o:o;e.style.clipPath=we(h);return}D.forEach((h,q)=>{h.style.strokeDashoffset=l==="reverse"?`${M[q]*o}`:`${M[q]*(1-o)}`,u&&(h.style.opacity=l==="reverse"?`${1-o}`:`${o}`),K&&j?h.style.stroke=qe(K,j,o):j&&(h.style.stroke=j),Q!==null&&W!==null?h.style.strokeWidth=`${Q+(W-Q)*o}`:W!==null&&(h.style.strokeWidth=`${W}`),re!==null&&G!==null?h.style.fillOpacity=`${re+(G-re)*o}`:G!==null&&(h.style.fillOpacity=`${G}`),H&&h.tagName.toLowerCase()==="path"&&ne[q]&&h.setAttribute("d",bt(ne[q],H,o));});}function et(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=we(0);return}D.forEach((o,l)=>{o.style.strokeDasharray=`${M[l]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${M[l]}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",K&&(o.style.stroke=K),Q!==null&&(o.style.strokeWidth=`${Q}`),re!==null&&(o.style.fillOpacity=`${re}`),H&&o.tagName.toLowerCase()==="path"&&ne[l]&&o.setAttribute("d",ne[l]);});}if(D.forEach(o=>{pr(o);let l=We(o);M.push(l);let h=o.tagName.toLowerCase()==="path";h?ne.push(o.getAttribute("d")??""):ne.push(""),H&&(h?gr(ne[ne.length-1],H,o):Y(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=S==="reverse"?`${l}`:"0",u&&(o.style.opacity="1"),j&&(o.style.stroke=j),W!==null&&(o.style.strokeWidth=`${W}`),G!==null&&(o.style.fillOpacity=`${G}`),H&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",H)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=S==="reverse"?"0":`${l}`,u?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",K&&(o.style.stroke=K),Q!==null&&(o.style.strokeWidth=`${Q}`),re!==null&&(o.style.fillOpacity=`${re}`));}),Z){if(t)return e.style.clipPath=we(1),de?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=we(0);}else if(t)return de?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let $t=typeof d=="string"?st(d):null;function tr(){return !(ie===false||!fr()||!D.length||!$t||Z||F!=="y"||ae||f!==1||P!==0||U||A||N!==false||H||z||le||p>0||g||k||de||be||Ae||Me||He||E!=null||w!=null||O!=null||(L.start??"top bottom").trim()!=="top bottom"||(L.end??"bottom top").trim()!=="bottom top")}function rr(){let o=++mr,l=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,q=`--svg-scroll-draw-${o}`,me=S==="reverse"?"0":"var(--ssd-len)",Ee=S==="reverse"?"var(--ssd-len)":"0",he=`stroke-dashoffset:${me};`,v=`stroke-dashoffset:${Ee};`;u&&(he+=`opacity:${S==="reverse"?1:0};`,v+=`opacity:${S==="reverse"?0:1};`);let $=document.createElement("style");$.setAttribute("data-svg-scroll-draw",""),$.textContent=`@keyframes ${l}{from{${he}}to{${v}}}.${h}{view-timeline-name:${q};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${$t};animation-fill-mode:both;animation-timeline:${q};animation-range:cover 0% cover 100%;}`,document.head.appendChild($),e.classList.add(h);function ee(y,B){y.style.setProperty("--ssd-len",String(M[B])),y.style.strokeDasharray=`${M[B]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(l);}D.forEach(ee);let b=false,I=-1;function V(){if(I>=0)return I;let y=e.getBoundingClientRect(),{tStart:B,tEnd:fe}=Fe({top:y.top,height:y.height},Ye(),Mt(),je,Qe);return ge(se(Ye(),B,fe,f))}return {destroy(){e.classList.remove(h),D.forEach(y=>{y.classList.remove(l),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),$.remove();},replay(){b=false,I=-1,D.forEach(ee);},pause(){b=true,D.forEach(y=>{y.style.animationPlayState="paused";});},resume(){b&&(b=false,D.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let B=Math.min(1,Math.max(0,y));I=B,b=true,D.forEach((fe,oe)=>{fe.classList.remove(l),fe.style.strokeDashoffset=S==="reverse"?`${M[oe]*B}`:`${M[oe]*(1-B)}`,u&&(fe.style.opacity=S==="reverse"?`${1-B}`:`${B}`);});},getProgress(){return V()},refresh(){D.forEach((y,B)=>{M[B]=We(y),y.style.setProperty("--ssd-len",String(M[B])),y.style.strokeDasharray=`${M[B]}`;});}}}if(tr())return ft(rr());function nr(){let o=Math.max(1,Te),l=0,h=0,q=false;function me(b){let I=true;if(Z){let V=Math.min(1,Math.max(0,b/o)),y=ge(V);ve=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=we(S==="reverse"?1-y:y),g?.(y),V<1&&(I=false);}else D.forEach((V,y)=>{let B=y*P*o,fe=Math.min(1,Math.max(0,(b-B)/o)),oe=ge(fe);V.style.strokeDashoffset=S==="reverse"?`${M[y]*oe}`:`${M[y]*(1-oe)}`,u&&(V.style.opacity=S==="reverse"?`${1-oe}`:`${oe}`),K&&j?V.style.stroke=qe(K,j,oe):j&&(V.style.stroke=j),Q!==null&&W!==null?V.style.strokeWidth=`${Q+(W-Q)*oe}`:W!==null&&(V.style.strokeWidth=`${W}`),re!==null&&G!==null?V.style.fillOpacity=`${re+(G-re)*oe}`:G!==null&&(V.style.fillOpacity=`${G}`),H&&V.tagName.toLowerCase()==="path"&&ne[y]&&V.setAttribute("d",bt(ne[y],H,oe)),y===0&&(ve=oe,g?.(oe),e.style.setProperty("--scroll-draw-progress",String(oe))),fe<1&&(I=false);});if(z){let V=Math.min(1,Math.max(0,b/o)),y=ge(V);for(let B in z){let fe=parseFloat(B);y>=fe&&!Oe.has(fe)&&(Oe.add(fe),z[B]?.());}}return I}function Ee(b){if(J)return;let I=b-l;C||(C=true,k?.());let V=me(I);if(V&&!T){T=true,me(o*(1+Math.max(0,D.length-1)*P)),de?.(),Pe<(le==="infinite"?1/0:le??0)&&(Pe++,Ie=setTimeout(()=>{l=performance.now(),C=false,T=false,Oe.clear(),et(),_=requestAnimationFrame(Ee);},ce));return}V||(_=requestAnimationFrame(Ee));}function he(){cancelAnimationFrame(_),clearTimeout(Ie),l=performance.now(),h=0,J=false,C=false,T=false,Pe=0,q=true,ve=0,Oe.clear(),et(),_=requestAnimationFrame(Ee);}let v=new IntersectionObserver(b=>{b.forEach(I=>{I.isIntersecting&&!(U&&T)?he():!I.isIntersecting&&!U&&!T&&(cancelAnimationFrame(_),clearTimeout(Ie),q=false);});},{root:ae??null,threshold:X,rootMargin:_e}),$;function ee(){clearTimeout($),$=setTimeout(()=>{D.forEach((b,I)=>{M[I]=We(b),b.style.strokeDasharray=`${M[I]}`;});},150);}return window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee),p>0?setTimeout(()=>v.observe(e),p):v.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(Ie),v.disconnect(),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),clearTimeout($);},replay(){Pe=0,he();},pause(){J||!q||(J=true,h=performance.now()-l,cancelAnimationFrame(_));},resume(){J&&(J=false,q=true,l=performance.now()-h,_=requestAnimationFrame(Ee));},seek(b){let I=Math.min(1,Math.max(0,b));ve=I,J=true,h=I*o,l=performance.now()-h,cancelAnimationFrame(_),me(h);},getProgress(){return ve},refresh(){clearTimeout($),D.forEach((b,I)=>{M[I]=We(b),b.style.strokeDasharray=`${M[I]}`;});}}}if(Ne)return ft(nr());Pt();function kt(){if(J||!ze)return;let o=performance.now(),l=Ye();if(!Re&&N===false&&l===Tt){dt(l);return}Re=false,Tt=l;let h=f;if(N!==false){let v=o-At,$=v>0?Math.abs(l-(Je<0?l:Je))/v:0;h=f*Math.max(.2,1+$*(typeof N=="number"?N:1)*.04);}Je=l,At=o;let q=A?De===-1||l>=De?"forward":"reverse":S;De=l;let me=m-i,Ee=true,he=me===0?0:(l-i)/me;if(isNaN(Ve)||(Ve<=0&&he>0?be?.():Ve>0&&he<=0&&He?.(),Ve<1&&he>=1?Ae?.():Ve>=1&&he<1&&Me?.()),Ve=he,Z){let v=ge(se(l,i,m,h));U&&!A&&(R=Math.max(R,v),v=R),ve=v,e.style.setProperty("--scroll-draw-progress",String(v));let $=q==="reverse"?1-v:v;e.style.clipPath=we($),g?.(v),!C&&se(l,i,m,h)>0&&(C=true,k?.()),v>=1&&!T?(T=true,de?.(),Pe<(le==="infinite"?1/0:le??0)&&(Pe++,Ie=setTimeout(()=>{R=-1,C=false,T=false,e.style.clipPath=we(0);},ce))):v<1&&!U&&(T=false),dt(l);return}if(D.forEach((v,$)=>{let ee=$*ye*me,b=ge(se(l,i+ee,m+ee,h));U&&!A&&(b=Le[$]=Math.max(Le[$]??R,b)),v.style.strokeDashoffset=q==="reverse"?`${M[$]*b}`:`${M[$]*(1-b)}`,u&&(v.style.opacity=q==="reverse"?`${1-b}`:`${b}`),K&&j?v.style.stroke=qe(K,j,b):j&&(v.style.stroke=j),Q!==null&&W!==null?v.style.strokeWidth=`${Q+(W-Q)*b}`:W!==null&&(v.style.strokeWidth=`${W}`),re!==null&&G!==null?v.style.fillOpacity=`${re+(G-re)*b}`:G!==null&&(v.style.fillOpacity=`${G}`),H&&v.tagName.toLowerCase()==="path"&&ne[$]&&v.setAttribute("d",bt(ne[$],H,b)),$===0&&(ve=b,g?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Ee=false);}),z){let v=ge(se(l,i,m,h));for(let $ in z){let ee=parseFloat($);v>=ee&&!Oe.has(ee)&&(Oe.add(ee),z[$]?.());}}!C&&se(l,i,m,h)>0&&(C=true,k?.()),Ee&&!T?(T=true,de?.(),Pe<(le==="infinite"?1/0:le??0)&&(Pe++,Ie=setTimeout(()=>{R=-1,Le=[],C=false,T=false,Oe.clear(),et(),Re=true;},ce))):!Ee&&!U&&(T=false),dt(l);}function pt(o){return o>=m&&o<ue}function dt(o){Ce||pt(o)?_=requestAnimationFrame(kt):ze=false;}function gt(){return Ce||pt(Ye())}let ze=false;function tt(){ze||(ze=true,_=requestAnimationFrame(function(){kt();}));}function rt(){ze=false,cancelAnimationFrame(_);}let yt=new IntersectionObserver(o=>{o.forEach(l=>{Ce=l.isIntersecting,Ce&&!J?(Re=true,tt()):ze&&!J&&pt(Ye())||rt();});},{root:ae??null,threshold:X,rootMargin:_e});function Ct(){D.forEach((o,l)=>{M[l]=We(o),o.style.strokeDasharray=`${M[l]}`;}),Pt(),Re=true;}let nt;function Ue(){clearTimeout(nt),nt=setTimeout(Ct,150);}window.addEventListener("resize",Ue),window.addEventListener("orientationchange",Ue);let or=Be([e],Ue);return p>0?setTimeout(()=>yt.observe(e),p):yt.observe(e),ft({destroy(){cancelAnimationFrame(_),clearTimeout(Ie),rt(),yt.disconnect(),or(),window.removeEventListener("resize",Ue),window.removeEventListener("orientationchange",Ue),clearTimeout(nt),xt();},replay(){R=-1,Le=[],De=-1,Je=-1,C=false,T=false,Pe=0,J=false,ve=0,Oe.clear(),clearTimeout(Ie),et(),Re=true,gt()&&tt();},pause(){J=true,rt();},resume(){J&&(J=false,Re=true,gt()&&tt());},seek(o){let l=Math.min(1,Math.max(0,o));ve=l,R=l,Le=[],J=true,rt(),er(l,S),Re=true;},getProgress(){return ve},refresh(){clearTimeout(nt),Ct(),gt()&&!J&&tt();}},()=>({tStart:i,tEnd:m}))}function hr(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?jt(n,r):(Y("Container not found:",e),t)}function br(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Qt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],a=[],c=n[2].trim();if(c)for(let f of c.split(/[\s,]+/)){let u=f.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),a.push(u?u[2]:"");}r.push({fn:n[1],nums:s,units:a});}return r}function wr(e,r,t){let n=Qt(e),s=Qt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((a,c)=>{let f=s[c];return a.fn!==f.fn||a.nums.length!==f.nums.length?t<1?`${a.fn}(${a.nums.map((u,d)=>`${u}${a.units[d]}`).join(", ")})`:`${f.fn}(${f.nums.map((u,d)=>`${u}${f.units[d]}`).join(", ")})`:`${a.fn}(${a.nums.map((u,d)=>`${u+(f.nums[d]-u)*t}${a.units[d]}`).join(", ")})`}).join(" ")}function Yt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(br(n))return qe(n,s,t);if(n.includes("("))return wr(n,s,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(a&&c){let f=parseFloat(a[1]),u=parseFloat(c[1]);return `${f+(u-f)*t}${a[2]||c[2]}`}return t<1?n:s}function vr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Er=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Sr=0,Ut="--scroll-draw-progress";function xr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function wt(e,r){return typeof window>"u"?Zt:r.respectReducedMotion===false?Xt(e,r,false):Ge(r,(t,n)=>Xt(e,t,n))}function Xt(e,r,t){let{props:n,trigger:s={},easing:a="ease-out",speed:c=1,once:f=false,axis:u="y",scrollContainer:d,native:L=true,velocityScale:P=false,triggerElement:S,onProgress:U,onComplete:pe,onEnter:F,onLeave:x,onEnterBack:A,onLeaveBack:p}=r,E=typeof a=="function"?a:te[a]??te["ease-out"],w=$e(s.start??"top bottom"),O=$e(s.end??"bottom top"),z=S??e,N=typeof d=="string"?document.querySelector(d):d??null,X=Object.entries(n).map(([i,m])=>({prop:vr(i),from:Array.isArray(m)?m[0]:"",to:Array.isArray(m)?m[1]:m}));function _e(){let i=window.getComputedStyle(e);for(let m of X)m.from===""&&(m.from=i.getPropertyValue(m.prop).trim()||"0");}function le(){for(let i of X)e.style.setProperty(i.prop,String(i.to));}let ce=new Map;for(let i of [...X.map(m=>m.prop),Ut])ce.set(i,e.style.getPropertyValue(i));function H(){for(let[i,m]of ce)m?e.style.setProperty(i,m):e.style.removeProperty(i);}if(t)return le(),pe?.(),{...Zt,destroy:H,getProgress:()=>1};_e();let xe=typeof a=="string"?st(a):null;function Ne(){if(!L||!xr()||!xe||u!=="y"||N||z!==e||f||c!==1||U||pe||F||x||A||p||P!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let i of X)if(!Er.has(i.prop))return false;return true}function Te(){let i=`ssd-a-${++Sr}`,m=X.map(R=>`${R.prop}:${R.from}`).join(";"),ye=X.map(R=>`${R.prop}:${R.to}`).join(";"),ue=document.createElement("style");ue.setAttribute("data-ssd-animate",""),ue.textContent=`@keyframes ${i}{from{${m}}to{${ye}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${xe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue),e.classList.add(i);let T=()=>u==="x"?window.scrollX:window.scrollY,C=()=>u==="x"?window.innerWidth:window.innerHeight,_=()=>{let R=e.getBoundingClientRect();return Fe({top:R.top,height:R.height},T(),C(),w,O)};ke(e,{type:"animate",getProgress:()=>Ce.getProgress(),getTrigger:_});let Ce={refresh(){},destroy(){e.classList.remove(i),ue.remove(),e.style.animationPlayState="",H(),Se(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(R){let Le=Math.min(1,Math.max(0,R));e.classList.remove(i);for(let De of X)e.style.setProperty(De.prop,Yt(De.from,De.to,Le));},getProgress(){let{tStart:R,tEnd:Le}=_();return E(se(T(),R,Le,c))}};return Ce}if(Ne())return Te();let ie=0,g=0,k=0,de=false,be=false,Ae=-1,Me=0,He=false,Z=NaN,ge=-1,je=0,Qe=()=>N?u==="x"?N.scrollLeft:N.scrollTop:u==="x"?window.scrollX:window.scrollY,ae=()=>N?u==="x"?N.clientWidth:N.clientHeight:u==="x"?window.innerWidth:window.innerHeight,K=z===e?X:[],j=false;function Q(){let i=e.style,m=K.map(C=>i.getPropertyValue(C.prop)),ye=i.transition;K.length&&(i.transition="none"),K.forEach(C=>i.setProperty(C.prop,ce.get(C.prop)??""));let ue=ot(z,N,u);K.forEach((C,_)=>i.setProperty(C.prop,m[_])),K.length&&(e.offsetWidth,i.transition=ye);let T=Fe(ue,ue.scroll,ae(),w,O);j&&Math.abs(T.tStart-ie)<1&&Math.abs(T.tEnd-g)<1||(j=true,ie=T.tStart,g=T.tEnd);}function W(i){e.style.setProperty(Ut,String(i));for(let m of X)e.style.setProperty(m.prop,Yt(m.from,m.to,i));U?.(i);}function re(i){if(isNaN(Z)){Z=i;return}Z<=0&&i>0?F?.():Z>0&&i<=0&&p?.(),Z<1&&i>=1?x?.():Z>=1&&i<1&&A?.(),Z=i;}function G(){if(!de||be)return;let i=performance.now(),m=Qe(),ye=c;if(P!==false){let C=i-je,_=C>0?Math.abs(m-(ge<0?m:ge))/C:0;ye=c*Math.max(.2,1+_*(typeof P=="number"?P:1)*.04);}ge=m,je=i;let ue=g===ie?0:(m-ie)/(g-ie);re(ue);let T=E(se(m,ie,g,ye));f&&(Ae=Math.max(Ae,T),T=Ae),Me=T,W(T),T>=1&&!He?(He=true,pe?.()):T<1&&!f&&(He=false),k=requestAnimationFrame(G);}Q(),g===ie&&Y("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=E(se(Qe(),ie,g,c));f&&i>0&&(Ae=i),Me=i,W(i);}let we=new IntersectionObserver(i=>{i.forEach(m=>{de=m.isIntersecting,de&&!be?k=requestAnimationFrame(G):cancelAnimationFrame(k);});},{root:N??null}),D;function M(){clearTimeout(D),D=setTimeout(Q,150);}window.addEventListener("resize",M),window.addEventListener("orientationchange",M);let ne=Be([z],M);return we.observe(e),ke(e,{type:"animate",getProgress:()=>Me,getTrigger:()=>({tStart:ie,tEnd:g})}),{destroy(){cancelAnimationFrame(k),we.disconnect(),window.removeEventListener("resize",M),window.removeEventListener("orientationchange",M),ne(),clearTimeout(D),H(),Se(e);},replay(){Ae=-1,He=false,Me=0,be=false,W(0);},pause(){be=true,cancelAnimationFrame(k);},resume(){be&&(be=false,de&&(k=requestAnimationFrame(G)));},seek(i){let m=Math.min(1,Math.max(0,i));Me=m,Ae=m,be=true,cancelAnimationFrame(k),W(m);},getProgress(){return Me},refresh(){Q();}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Tr(e,r){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;return t?wt(t,r):(Y("scrollAnimate: element not found:",e),ct)}function Ar(e,r={}){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return Y("scrollParallax: element not found:",e),ct;let{speed:n=.3,axis:s="y",easing:a="linear",trigger:c,onProgress:f}=r,u=-n*100,d=t.style,L=!!t.ownerSVGElement,P=d.getPropertyValue("transform-box");L&&d.setProperty("transform-box","fill-box");let S=wt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:f});return L?{...S,destroy(){S.destroy(),d.setProperty("transform-box",P);}}:S}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Mr(e,r){if(typeof window>"u")return vt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ge(r,(n,s)=>Lr(t,n,s)):(Y("scrollCounter: element not found:",e),vt)}function Lr(e,r,t){let{from:n=0,to:s,format:a,easing:c="ease-out",trigger:f={},once:u=true,decimals:d,onComplete:L}=r,P=d!==void 0?g=>g.toFixed(d):a??(g=>String(Math.round(g))),S=typeof c=="function"?c:te[c]??te["ease-out"],U=$e(f.start??"top 80%"),pe=$e(f.end??"top 20%");if(t)return e.textContent=P(s),L?.(),{...vt,getProgress:()=>1};let F=0,x=0,A=false,p=0,E=false,w=false,O=-1,z=0,N=false,X=()=>window.scrollY,_e=()=>window.innerHeight;function le(){let g=e.getBoundingClientRect(),k=Fe({top:g.top,height:g.height},X(),_e(),U,pe);A&&Math.abs(k.tStart-F)<1&&Math.abs(k.tEnd-x)<1||(A=true,F=k.tStart,x=k.tEnd);}function ce(g){e.textContent=P(n+(s-n)*g),e.style.setProperty("--scroll-draw-progress",String(g));}function H(){if(!E||w)return;let g=S(se(X(),F,x,1));u&&(O=Math.max(O,g),g=O),z=g,ce(g),g>=1&&!N?(N=true,L?.()):g<1&&!u&&(N=false),p=requestAnimationFrame(H);}le();{let g=S(se(X(),F,x,1));u&&g>0&&(O=g),z=g,ce(g);}let xe=new IntersectionObserver(g=>{g.forEach(k=>{E=k.isIntersecting,E&&!w?p=requestAnimationFrame(H):cancelAnimationFrame(p);});}),Ne;function Te(){clearTimeout(Ne),Ne=setTimeout(le,150);}window.addEventListener("resize",Te),window.addEventListener("orientationchange",Te);let ie=Be([e],Te);return xe.observe(e),ke(e,{type:"counter",getProgress:()=>z,getTrigger:()=>({tStart:F,tEnd:x})}),{destroy(){cancelAnimationFrame(p),xe.disconnect(),window.removeEventListener("resize",Te),window.removeEventListener("orientationchange",Te),ie(),clearTimeout(Ne),Se(e);},replay(){O=-1,N=false,z=0,w=false,ce(0);},pause(){w=true,cancelAnimationFrame(p);},resume(){w&&(w=false,E&&(p=requestAnimationFrame(H)));},seek(g){let k=Math.min(1,Math.max(0,g));z=k,O=k,w=true,cancelAnimationFrame(p),ce(k);},getProgress(){return z}}}var Kt="http://www.w3.org/2000/svg",Pr="cinematic-photo",Et=e=>e<0?0:e>1?1:e;function ut(e){let r=parseFloat(e);return Number.isFinite(r)?Et(r/100):0}function $r(e){return te[e]??te.linear}var kr={destroy:()=>{},getProgress:()=>0},St=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||Y("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return kr;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let x of r.scenes){if(x.background){let p=document.createElement("img");p.id=Pr,p.src=x.background,p.alt="",p.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(p);}let A=x.animations.filter(p=>p.type==="draw");if(A.length){let p=document.createElementNS(Kt,"svg");p.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),p.setAttribute("preserveAspectRatio","xMidYMid meet"),p.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(p);for(let E of A){let w=document.createElementNS(Kt,"path");w.id=E.target.replace(/^#/,""),w.setAttribute("d",E.d),w.setAttribute("fill","none"),w.setAttribute("stroke",E.stroke),w.setAttribute("stroke-width",String(E.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let O=E.length||w.getTotalLength?.()||0;w.style.strokeDasharray=String(O),w.style.strokeDashoffset=String(O),p.appendChild(w),s.push({kind:"draw",el:w,start:ut(E.start),end:ut(E.end),ease:$r(E.easing),length:O});}}for(let p of x.animations){if(p.type!=="fade")continue;let E=n.querySelector(p.target)??document.querySelector(p.target);E&&(E.style.opacity=String(p.from),s.push({kind:"fade",el:E,start:ut(p.start),end:ut(p.end),ease:te["ease-in-out"]??te.linear,from:p.from,to:p.to}));}}let a=0,c=()=>{let x=t.offsetHeight-window.innerHeight;return x<=0?t.getBoundingClientRect().top<=0?1:0:Et(-t.getBoundingClientRect().top/x)},f=x=>{for(let A of s){let p=A.end-A.start,E=p<=0?x>=A.end?1:0:Et((x-A.start)/p),w=A.ease(E);A.kind==="draw"?A.el.style.strokeDashoffset=String(A.length*(1-w)):A.el.style.opacity=String(A.from+(A.to-A.from)*w);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return f(1),{destroy:()=>{},getProgress:()=>1};let u=0,d=false,L=false,P=()=>{a=c(),f(a),d&&(u=requestAnimationFrame(P));},S=()=>{d||(d=true,u=requestAnimationFrame(P));},U=()=>{d=false,cancelAnimationFrame(u);},pe=new IntersectionObserver(x=>{for(let A of x)L=A.isIntersecting,L?S():U();},{threshold:0});pe.observe(n),a=c(),f(a),ke(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let x=t.getBoundingClientRect().top+window.scrollY;return {tStart:x,tEnd:x+Math.max(0,t.offsetHeight-window.innerHeight)}}});let F=lt(x=>{x&&(F(),U(),pe.disconnect(),Se(t),a=1,f(1));});return {destroy(){F(),U(),pe.disconnect(),Se(t);},getProgress:()=>a}}};
|
|
4
|
-
exports.Cinematic=St;exports.PRESETS=
|
|
3
|
+
<div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Qt=/[MmLlHhVvCcSsQqTtAaZz]/g;function br(e,r,t){if(!Ye)return;let n=(e.match(Qt)??[]).join("").toUpperCase(),s=(r.match(Qt)??[]).join("").toUpperCase(),a=(e.match(jt)??[]).length,c=(r.match(jt)??[]).length;if(n!==s){G(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}a!==c&&G(`morphTo: coordinate count differs (${a} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function wr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let c=parseFloat(a),m=n[s++]??c;return String(+(c+(m-c)*t).toFixed(4))})}function Ut(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ge(r,(t,n)=>vr(e,t,n))}function vr(e,r,t){let{preset:n,...s}=r,a=n?{...bt[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=false,easing:p="linear",trigger:T={},stagger:A=0,direction:b="forward",once:K=false,debug:se=false,axis:R="y",scrollContainer:v,autoReverse:M=false,delay:f=0,strokeColor:w,strokeWidth:y,fillOpacity:z,waypoints:_,velocityScale:$=false,threshold:q=0,rootMargin:ke="0px",repeat:ce=0,repeatDelay:fe=0,morphTo:W,clip:ie,autoplay:Ce=false,duration:Ie=1e3,native:Ee=true,onProgress:Se,onStart:h,onComplete:E,onEnter:pe,onLeave:He,onEnterBack:de,onLeaveBack:Ve}=a,B=ie===true?"left":typeof ie=="string"?ie:false,j=typeof p=="function"?p:Z[p]??Z.linear,_e=Pe(T.start||"top bottom"),ge=Pe(T.end||"bottom top"),J=typeof v=="string"?document.querySelector(v):v??null,xe=Array.isArray(w)?w[0]:null,ae=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ye=Array.isArray(y)?y[0]:null,he=Array.isArray(y)?y[1]:typeof y=="number"?y:null,le=Array.isArray(z)?z[0]:null,De=Array.isArray(z)?z[1]:typeof z=="number"?z:null;function be(o){let i=o*100;switch(B){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let D=B?[]:Array.from(e.querySelectorAll(c)),k=[],ee=[],te=0,l=0,d=A,Te=0,L=false,C=false,x=0,I=false,ue=-1,me=[],Ke=-1,Q=false,we=0,Me=0,Oe,mt=null;function xt(){mt?.destroy(),mt=null;}let Re=new Set,Tt=NaN,Fe=true,Je=-1,Mt=performance.now(),ze=NaN;function je(){return J?R==="x"?J.scrollLeft:J.scrollTop:R==="x"?window.scrollX:window.scrollY}function At(){return J?R==="x"?J.clientWidth:J.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Lt(){let o=nt(e,J,R);return Ne(o,o.scroll,At(),_e,ge)}function tr(){let o=l-te,i=D.length-1,g=J??document.documentElement,F=R==="x"?"Width":"Height";if(d=A,A>0&&i>0&&o>0){let ne=g[`scroll${F}`]-g[`client${F}`]-1-te-o/m;ne>=0&&(d=Math.min(A,ne/(i*o)));}Te=l+i*d*o;}function Pt(){(({tStart:te,tEnd:l}=Lt())),tr(),se&&Ye&&(xt(),mt=hr(te,l,R));}function ft(o,i=Lt){$e(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let g=o.destroy;return o.destroy=()=>{g.call(o),ve(e);},o}function $t(o,i){return K&&!M?Math.max(ue,j(me[o]=Math.max(me[o]??0,i))):j(i)}function rr(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),B){let g=i==="reverse"?1-o:o;e.style.clipPath=be(g);return}D.forEach((g,F)=>pt(g,F,o,i));}function pt(o,i,g,F){o.style.strokeDashoffset=F==="reverse"?`${k[i]*g}`:`${k[i]*(1-g)}`,u&&(o.style.opacity=F==="reverse"?`${1-g}`:`${g}`),xe&&ae?o.style.stroke=ot(xe,ae,g):ae&&(o.style.stroke=ae),ye!==null&&he!==null?o.style.strokeWidth=`${ye+(he-ye)*g}`:he!==null&&(o.style.strokeWidth=`${he}`),le!==null&&De!==null?o.style.fillOpacity=`${le+(De-le)*g}`:De!==null&&(o.style.fillOpacity=`${De}`),W&&o.tagName.toLowerCase()==="path"&&ee[i]&&o.setAttribute("d",wr(ee[i],W,g));}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),B){e.style.clipPath=be(b==="reverse"?1:0);return}D.forEach((o,i)=>{o.style.strokeDasharray=`${k[i]}`,o.style.strokeDashoffset=b==="reverse"?"0":`${k[i]}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ye!==null&&(o.style.strokeWidth=`${ye}`),le!==null&&(o.style.fillOpacity=`${le}`),W&&o.tagName.toLowerCase()==="path"&&ee[i]&&o.setAttribute("d",ee[i]);});}if(D.forEach(o=>{yr(o);let i=We(o);k.push(i);let g=o.tagName.toLowerCase()==="path";g?ee.push(o.getAttribute("d")??""):ee.push(""),W&&(g?br(ee[ee.length-1],W,o):G(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=b==="reverse"?`${i}`:"0",u&&(o.style.opacity="1"),ae&&(o.style.stroke=ae),he!==null&&(o.style.strokeWidth=`${he}`),De!==null&&(o.style.fillOpacity=`${De}`),W&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",W)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=b==="reverse"?"0":`${i}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ye!==null&&(o.style.strokeWidth=`${ye}`),le!==null&&(o.style.fillOpacity=`${le}`));}),t)return B&&(e.style.clipPath=be(1)),E?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};B&&(e.style.clipPath=be(b==="reverse"?1:0));let kt=typeof p=="string"?st(p):null;function nr(){return !(Ee===false||Ce||se||!gr()||!D.length||!kt||B||R!=="y"||J||m!==1||A!==0||K||M||$!==false||W||_||ce||f>0||Se||h||E||pe||He||de||Ve||w!=null||y!=null||z!=null||(T.start||"top bottom").trim()!=="top bottom"||(T.end||"bottom top").trim()!=="bottom top")}function or(){let o=++dr,i=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,F=`--svg-scroll-draw-${o}`,ne=b==="reverse"?"0":"var(--ssd-len)",Ae=b==="reverse"?"var(--ssd-len)":"0",oe=`stroke-dashoffset:${ne};`,O=`stroke-dashoffset:${Ae};`;u&&(oe+=`opacity:${b==="reverse"?1:0};`,O+=`opacity:${b==="reverse"?0:1};`);let N=document.createElement("style");N.setAttribute("data-svg-scroll-draw",""),N.textContent=`@keyframes ${i}{from{${oe}}to{${O}}}.${g}{view-timeline-name:${F};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${kt};animation-fill-mode:both;animation-timeline:${F};animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(g);function U(S,P){S.style.setProperty("--ssd-len",String(k[P])),S.style.strokeDasharray=`${k[P]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(i);}D.forEach(U);let Y=false,H=-1;function V(){if(H>=0)return H;let S=e.getBoundingClientRect(),{tStart:P,tEnd:X}=Ne({top:S.top,height:S.height},je(),At(),_e,ge);return j(re(je(),P,X,m))}return {destroy(){e.classList.remove(g),D.forEach(S=>{S.classList.remove(i),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),N.remove();},replay(){Y=false,H=-1,D.forEach(U);},pause(){Y=true,D.forEach(S=>{S.style.animationPlayState="paused";});},resume(){Y&&(Y=false,D.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let P=Math.min(1,Math.max(0,S));H=P,Y=true,D.forEach((X,Le)=>{X.classList.remove(i),X.style.strokeDashoffset=b==="reverse"?`${k[Le]*P}`:`${k[Le]*(1-P)}`,u&&(X.style.opacity=b==="reverse"?`${1-P}`:`${P}`);});},getProgress(){return V()},refresh(){D.forEach((S,P)=>{k[P]=We(S),S.style.setProperty("--ssd-len",String(k[P])),S.style.strokeDasharray=`${k[P]}`;});}}}if(nr())return ft(or());function sr(){let o=Math.max(1,Ie),i=B?o:o*(1+Math.max(0,D.length-1)*A),g=0,F=0,ne=false;function Ae(H){let V=true,S=Math.min(1,Math.max(0,H/i));if(B){let P=Math.min(1,Math.max(0,H/o)),X=j(P);we=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=be(b==="reverse"?1-X:X),Se?.(X),P<1&&(V=false);}else {D.forEach((X,Le)=>{let ar=Le*A*o,Dt=Math.min(1,Math.max(0,(H-ar)/o));pt(X,Le,j(Dt),b),Dt<1&&(V=false);});let P=j(S);we=P,Se?.(P),e.style.setProperty("--scroll-draw-progress",String(P));}if(_){let P=j(S);for(let X in _){let Le=parseFloat(X);P>=Le&&!Re.has(Le)&&(Re.add(Le),_[X]?.());}}return V}function oe(H){if(Q)return;let V=H-g;C||(C=true,h?.());let S=Ae(V);if(S&&!L){L=true,Ae(i),E?.(),Me<(ce==="infinite"?1/0:ce??0)&&(Me++,Oe=setTimeout(()=>{g=performance.now(),C=false,L=false,Re.clear(),Qe(),x=requestAnimationFrame(oe);},fe));return}S||(x=requestAnimationFrame(oe));}function O(){cancelAnimationFrame(x),clearTimeout(Oe),g=performance.now(),F=0,Q=false,C=false,L=false,Me=0,ne=true,we=0,Re.clear(),Qe(),x=requestAnimationFrame(oe);}let N=new IntersectionObserver(H=>{H.forEach(V=>{V.isIntersecting&&!(K&&L)?O():!V.isIntersecting&&!K&&!L&&(cancelAnimationFrame(x),clearTimeout(Oe),ne=false);});},{root:J??null,threshold:q,rootMargin:ke}),U;function Y(){clearTimeout(U),U=setTimeout(()=>{D.forEach((H,V)=>{k[V]=We(H),H.style.strokeDasharray=`${k[V]}`;});},150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),f>0?setTimeout(()=>N.observe(e),f):N.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(Oe),N.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(U);},replay(){Me=0,O();},pause(){Q||!ne||(Q=true,F=performance.now()-g,cancelAnimationFrame(x));},resume(){Q&&(Q=false,ne=true,g=performance.now()-F,x=requestAnimationFrame(oe));},seek(H){let V=Math.min(1,Math.max(0,H));we=V,Q=true,F=V*i,g=performance.now()-F,cancelAnimationFrame(x),Ae(F);},getProgress(){return we},refresh(){clearTimeout(U),D.forEach((H,V)=>{k[V]=We(H),H.style.strokeDasharray=`${k[V]}`;});}}}if(Ce)return ft(sr());Pt();function Ct(){if(Q||!qe)return;let o=performance.now(),i=je();if(!Fe&&$===false&&i===Tt){gt(i);return}Fe=false,Tt=i;let g=m;if($!==false){let O=o-Mt,N=O>0?Math.abs(i-(Je<0?i:Je))/O:0;g=m*Math.max(.2,1+N*(typeof $=="number"?$:1)*.04);}Je=i,Mt=o;let F=M?Ke===-1||i>=Ke?"forward":"reverse":b;Ke=i;let ne=l-te,Ae=true,oe=ne===0?0:(i-te)/ne;if(isNaN(ze)||(ze<=0&&oe>0?pe?.():ze>0&&oe<=0&&Ve?.(),ze<1&&oe>=1?He?.():ze>=1&&oe<1&&de?.()),ze=oe,B){let O=$t(0,re(i,te,l,g));we=O,e.style.setProperty("--scroll-draw-progress",String(O));let N=F==="reverse"?1-O:O;e.style.clipPath=be(N),Se?.(O),!C&&re(i,te,l,g)>0&&(C=true,h?.()),O>=1&&!L?(L=true,E?.(),Me<(ce==="infinite"?1/0:ce??0)&&(Me++,Oe=setTimeout(()=>{ue=-1,me=[],C=false,L=false,Qe();},fe))):O<1&&!K&&(L=false),gt(i);return}if(D.forEach((O,N)=>{let U=N*d*ne,Y=$t(N,re(i,te+U,l+U,g));pt(O,N,Y,F),N===0&&(we=Y,Se?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(Ae=false);}),_){let O=j(re(i,te,l,g));for(let N in _){let U=parseFloat(N);O>=U&&!Re.has(U)&&(Re.add(U),_[N]?.());}}!C&&re(i,te,l,g)>0&&(C=true,h?.()),Ae&&!L?(L=true,E?.(),Me<(ce==="infinite"?1/0:ce??0)&&(Me++,Oe=setTimeout(()=>{ue=-1,me=[],C=false,L=false,Re.clear(),Qe(),Fe=true;},fe))):!Ae&&!K&&(L=false),gt(i);}function dt(o){return o>=l&&o<Te}function gt(o){I||dt(o)?x=requestAnimationFrame(Ct):qe=false;}function yt(){return I||dt(je())}let qe=false;function et(){qe||(qe=true,x=requestAnimationFrame(function(){Ct();}));}function tt(){qe=false,cancelAnimationFrame(x);}let ht=new IntersectionObserver(o=>{o.forEach(i=>{I=i.isIntersecting,I&&!Q?(Fe=true,et()):qe&&!Q&&dt(je())||tt();});},{root:J??null,threshold:q,rootMargin:ke});function It(){D.forEach((o,i)=>{k[i]=We(o),o.style.strokeDasharray=`${k[i]}`;}),Pt(),Fe=true;}let rt;function Ue(){clearTimeout(rt),rt=setTimeout(It,150);}window.addEventListener("resize",Ue),window.addEventListener("orientationchange",Ue);let ir=Be([e],Ue);return f>0?setTimeout(()=>ht.observe(e),f):ht.observe(e),ft({destroy(){cancelAnimationFrame(x),clearTimeout(Oe),tt(),ht.disconnect(),ir(),window.removeEventListener("resize",Ue),window.removeEventListener("orientationchange",Ue),clearTimeout(rt),xt();},replay(){ue=-1,me=[],Ke=-1,Je=-1,C=false,L=false,Me=0,Q=false,we=0,Re.clear(),clearTimeout(Oe),Qe(),Fe=true,yt()&&et();},pause(){Q=true,tt();},resume(){Q&&(Q=false,Fe=true,yt()&&et());},seek(o){let i=Math.min(1,Math.max(0,o));we=i,ue=i,me=[],Q=true,tt(),rr(i,b),Fe=true;},getProgress(){return we},refresh(){clearTimeout(rt),It(),yt()&&!Q&&et();}},()=>({tStart:te,tEnd:l}))}function Er(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Ut(n,r):(G("Container not found:",e),t)}function Sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Yt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],a=[],c=n[2].trim();if(c)for(let m of c.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),a.push(u?u[2]:"");}r.push({fn:n[1],nums:s,units:a});}return r}function xr(e,r,t){let n=Yt(e),s=Yt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((a,c)=>{let m=s[c];return a.fn!==m.fn||a.nums.length!==m.nums.length?t<1?`${a.fn}(${a.nums.map((u,p)=>`${u}${a.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,p)=>`${u}${m.units[p]}`).join(", ")})`:`${a.fn}(${a.nums.map((u,p)=>`${u+(m.nums[p]-u)*t}${a.units[p]}`).join(", ")})`}).join(" ")}function Xt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Sr(n))return ot(n,s,t);if(n.includes("("))return xr(n,s,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(a&&c){let m=parseFloat(a[1]),u=parseFloat(c[1]);return `${m+(u-m)*t}${a[2]||c[2]}`}return t<1?n:s}function Tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ar=0,Zt="--scroll-draw-progress";function Lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function wt(e,r){return typeof window>"u"?Jt:r.respectReducedMotion===false?Kt(e,r,false):Ge(r,(t,n)=>Kt(e,t,n))}function Kt(e,r,t){let{props:n,trigger:s={},easing:a="ease-out",speed:c=1,once:m=false,axis:u="y",scrollContainer:p,native:T=true,velocityScale:A=false,triggerElement:b,onProgress:K,onComplete:se,onEnter:R,onLeave:v,onEnterBack:M,onLeaveBack:f}=r,w=typeof a=="function"?a:Z[a]??Z["ease-out"],y=Pe(s.start||"top bottom"),z=Pe(s.end||"bottom top"),_=b??e,$=typeof p=="string"?document.querySelector(p):p??null,q=Object.entries(n).map(([l,d])=>({prop:Tr(l),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function ke(){let l=window.getComputedStyle(e);for(let d of q)d.from===""&&(d.from=l.getPropertyValue(d.prop).trim()||"0");}function ce(){for(let l of q)e.style.setProperty(l.prop,String(l.to));}let fe=new Map;for(let l of [...q.map(d=>d.prop),Zt])fe.set(l,e.style.getPropertyValue(l));function W(){for(let[l,d]of fe)d?e.style.setProperty(l,d):e.style.removeProperty(l);}if(t)return ce(),se?.(),{...Jt,destroy:W,getProgress:()=>1};ke();let ie=()=>$?u==="x"?$.scrollLeft:$.scrollTop:u==="x"?window.scrollX:window.scrollY,Ce=()=>$?u==="x"?$.clientWidth:$.clientHeight:u==="x"?window.innerWidth:window.innerHeight,Ie=typeof a=="string"?st(a):null;function Ee(){if(!T||!Lr()||!Ie||u!=="y"||$||_!==e||m||c!==1||K||se||R||v||M||f||A!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let l of q)if(!Mr.has(l.prop))return false;return true}function Se(){let l=`ssd-a-${++Ar}`,d=q.map(I=>`${I.prop}:${I.from}`).join(";"),Te=q.map(I=>`${I.prop}:${I.to}`).join(";"),L=document.createElement("style");L.setAttribute("data-ssd-animate",""),L.textContent=`@keyframes ${l}{from{${d}}to{${Te}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(L),e.classList.add(l);let C=()=>{let I=e.getBoundingClientRect();return Ne({top:I.top,height:I.height},ie(),Ce(),y,z)};$e(e,{type:"animate",getProgress:()=>x.getProgress(),getTrigger:C});let x={refresh(){},destroy(){e.classList.remove(l),L.remove(),e.style.animationPlayState="",W(),ve(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let ue=Math.min(1,Math.max(0,I));e.classList.remove(l);for(let me of q)e.style.setProperty(me.prop,Xt(me.from,me.to,ue));},getProgress(){let{tStart:I,tEnd:ue}=C();return w(re(ie(),I,ue,c))}};return x}if(Ee())return Se();let h=0,E=0,pe=0,He=false,de=false,Ve=-1,B=0,j=0,_e=false,ge=NaN,J=-1,xe=0,ae=_===e?q:[],ye=false;function he(){let l=e.style,d=ae.map(x=>l.getPropertyValue(x.prop)),Te=l.transition;ae.length&&(l.transition="none"),ae.forEach(x=>l.setProperty(x.prop,fe.get(x.prop)??""));let L=nt(_,$,u);ae.forEach((x,I)=>l.setProperty(x.prop,d[I])),ae.length&&(e.offsetWidth,l.transition=Te);let C=Ne(L,L.scroll,Ce(),y,z);ye&&Math.abs(C.tStart-h)<1&&Math.abs(C.tEnd-E)<1||(ye=true,h=C.tStart,E=C.tEnd);}function le(l){e.style.setProperty(Zt,String(l));for(let d of q)e.style.setProperty(d.prop,Xt(d.from,d.to,l));K?.(l);}function De(l){if(isNaN(ge)){ge=l;return}ge<=0&&l>0?R?.():ge>0&&l<=0&&f?.(),ge<1&&l>=1?v?.():ge>=1&&l<1&&M?.(),ge=l;}function be(){if(!He||de)return;let l=performance.now(),d=ie(),Te=c;if(A!==false){let I=l-xe,ue=I>0?Math.abs(d-(J<0?d:J))/I:0;Te=c*Math.max(.2,1+ue*(typeof A=="number"?A:1)*.04);}J=d,xe=l;let L=E===h?0:(d-h)/(E-h);De(L);let C=re(d,h,E,Te),x=m?Math.max(Ve,w(B=Math.max(B,C))):w(C);j=x,le(x),x>=1&&!_e?(_e=true,se?.()):x<1&&!m&&(_e=false),pe=requestAnimationFrame(be);}he(),E===h&&G("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),B=re(ie(),h,E,c),j=w(B),le(j);let D=new IntersectionObserver(l=>{l.forEach(d=>{He=d.isIntersecting,He&&!de?pe=requestAnimationFrame(be):cancelAnimationFrame(pe);});},{root:$??null}),k;function ee(){clearTimeout(k),k=setTimeout(he,150);}window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee);let te=Be([_],ee);return D.observe(e),$e(e,{type:"animate",getProgress:()=>j,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(pe),D.disconnect(),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),te(),clearTimeout(k),W(),ve(e);},replay(){Ve=-1,B=0,_e=false,j=0,de=false,le(0);},pause(){de=true,cancelAnimationFrame(pe);},resume(){de&&(de=false,He&&(pe=requestAnimationFrame(be)));},seek(l){let d=Math.min(1,Math.max(0,l));j=d,Ve=d,B=0,de=true,cancelAnimationFrame(pe),le(d);},getProgress(){return j},refresh(){he();}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Pr(e,r){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;return t?wt(t,r):(G("scrollAnimate: element not found:",e),ct)}function $r(e,r={}){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return G("scrollParallax: element not found:",e),ct;let{speed:n=.3,axis:s="y",easing:a="linear",trigger:c,onProgress:m}=r,u=-n*100,p=t.style,T=!!t.ownerSVGElement,A=p.getPropertyValue("transform-box");T&&p.setProperty("transform-box","fill-box");let b=wt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m});return T?{...b,destroy(){b.destroy(),p.setProperty("transform-box",A);}}:b}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return vt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ge(r,(n,s)=>Cr(t,n,s)):(G("scrollCounter: element not found:",e),vt)}function Cr(e,r,t){let{from:n=0,to:s,format:a,easing:c="ease-out",trigger:m={},once:u=true,decimals:p,onComplete:T}=r,A=p!==void 0?h=>h.toFixed(p):a??(h=>String(Math.round(h))),b=typeof c=="function"?c:Z[c]??Z["ease-out"],K=Pe(m.start||"top 80%"),se=Pe(m.end||"top 20%");if(t)return e.textContent=A(s),T?.(),{...vt,getProgress:()=>1};let R=0,v=0,M=false,f=0,w=false,y=false,z=-1,_=0,$=0,q=false,ke=()=>window.scrollY,ce=()=>window.innerHeight;function fe(){let h=e.getBoundingClientRect(),E=Ne({top:h.top,height:h.height},ke(),ce(),K,se);M&&Math.abs(E.tStart-R)<1&&Math.abs(E.tEnd-v)<1||(M=true,R=E.tStart,v=E.tEnd);}function W(h){e.textContent=A(n+(s-n)*h),e.style.setProperty("--scroll-draw-progress",String(h));}function ie(){if(!w||y)return;let h=re(ke(),R,v,1),E=u?Math.max(z,b(_=Math.max(_,h))):b(h);$=E,W(E),E>=1&&!q?(q=true,T?.()):E<1&&!u&&(q=false),f=requestAnimationFrame(ie);}fe();{_=re(ke(),R,v,1);let h=b(_);$=h,W(h);}let Ce=new IntersectionObserver(h=>{h.forEach(E=>{w=E.isIntersecting,w&&!y?f=requestAnimationFrame(ie):cancelAnimationFrame(f);});}),Ie;function Ee(){clearTimeout(Ie),Ie=setTimeout(fe,150);}window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee);let Se=Be([e],Ee);return Ce.observe(e),$e(e,{type:"counter",getProgress:()=>$,getTrigger:()=>({tStart:R,tEnd:v})}),{destroy(){cancelAnimationFrame(f),Ce.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),Se(),clearTimeout(Ie),ve(e);},replay(){z=-1,_=0,q=false,$=0,y=false,W(0);},pause(){y=true,cancelAnimationFrame(f);},resume(){y&&(y=false,w&&(f=requestAnimationFrame(ie)));},seek(h){let E=Math.min(1,Math.max(0,h));$=E,z=E,_=0,y=true,cancelAnimationFrame(f),W(E);},getProgress(){return $}}}var er="http://www.w3.org/2000/svg",Ir="cinematic-photo",Et=e=>e<0?0:e>1?1:e;function ut(e){let r=parseFloat(e);return Number.isFinite(r)?Et(r/100):0}function Dr(e){return Z[e]??Z.linear}var Or={destroy:()=>{},getProgress:()=>0},St=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||G("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return Or;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let v of r.scenes){if(v.background){let f=document.createElement("img");f.id=Ir,f.src=v.background,f.alt="",f.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(f);}let M=v.animations.filter(f=>f.type==="draw");if(M.length){let f=document.createElementNS(er,"svg");f.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),f.setAttribute("preserveAspectRatio","xMidYMid meet"),f.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(f);for(let w of M){let y=document.createElementNS(er,"path");y.id=w.target.replace(/^#/,""),y.setAttribute("d",w.d),y.setAttribute("fill","none"),y.setAttribute("stroke",w.stroke),y.setAttribute("stroke-width",String(w.strokeWidth)),y.setAttribute("stroke-linecap","round"),y.setAttribute("stroke-linejoin","round");let z=w.length||y.getTotalLength?.()||0;y.style.strokeDasharray=String(z),y.style.strokeDashoffset=String(z),f.appendChild(y),s.push({kind:"draw",el:y,start:ut(w.start),end:ut(w.end),ease:Dr(w.easing),length:z});}}for(let f of v.animations){if(f.type!=="fade")continue;let w=n.querySelector(f.target)??document.querySelector(f.target);w&&(w.style.opacity=String(f.from),s.push({kind:"fade",el:w,start:ut(f.start),end:ut(f.end),ease:Z["ease-in-out"]??Z.linear,from:f.from,to:f.to}));}}let a=0,c=()=>{let v=t.offsetHeight-window.innerHeight;return v<=0?t.getBoundingClientRect().top<=0?1:0:Et(-t.getBoundingClientRect().top/v)},m=v=>{for(let M of s){let f=M.end-M.start,w=f<=0?v>=M.end?1:0:Et((v-M.start)/f),y=M.ease(w);M.kind==="draw"?M.el.style.strokeDashoffset=String(M.length*(1-y)):M.el.style.opacity=String(M.from+(M.to-M.from)*y);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let u=0,p=false,T=false,A=()=>{a=c(),m(a),p&&(u=requestAnimationFrame(A));},b=()=>{p||(p=true,u=requestAnimationFrame(A));},K=()=>{p=false,cancelAnimationFrame(u);},se=new IntersectionObserver(v=>{for(let M of v)T=M.isIntersecting,T?b():K();},{threshold:0});se.observe(n),a=c(),m(a),$e(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let v=t.getBoundingClientRect().top+window.scrollY;return {tStart:v,tEnd:v+Math.max(0,t.offsetHeight-window.innerHeight)}}});let R=lt(v=>{v&&(R(),K(),se.disconnect(),ve(t),a=1,m(1));});return {destroy(){R(),K(),se.disconnect(),ve(t);},getProgress:()=>a}}};
|
|
4
|
+
exports.Cinematic=St;exports.PRESETS=bt;exports.createBounce=Ot;exports.createElastic=Rt;exports.createSpring=lr;exports.scrollAnimate=Pr;exports.scrollCounter=kr;exports.scrollDraw=Er;exports.scrollParallax=$r;
|
package/dist/index.d.mts
CHANGED
|
@@ -31,8 +31,9 @@ declare function createSpring({ tension, friction, }?: {
|
|
|
31
31
|
}): (t: number) => number;
|
|
32
32
|
/**
|
|
33
33
|
* Returns a bounce-out easing function.
|
|
34
|
-
* The animation rises to 1 and then makes `bounces` dips below 1 that settle
|
|
35
|
-
*
|
|
34
|
+
* The animation rises to 1 and then makes `bounces − 1` dips below 1 that settle:
|
|
35
|
+
* the rise is the first of the `bounces` segments.
|
|
36
|
+
* - `bounces` — segments, the first rise included (default 3: a rise, then 2 dips)
|
|
36
37
|
* - `decay` — amplitude reduction per bounce (0–1, default 0.5)
|
|
37
38
|
*
|
|
38
39
|
* @example
|
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,9 @@ declare function createSpring({ tension, friction, }?: {
|
|
|
31
31
|
}): (t: number) => number;
|
|
32
32
|
/**
|
|
33
33
|
* Returns a bounce-out easing function.
|
|
34
|
-
* The animation rises to 1 and then makes `bounces` dips below 1 that settle
|
|
35
|
-
*
|
|
34
|
+
* The animation rises to 1 and then makes `bounces − 1` dips below 1 that settle:
|
|
35
|
+
* the rise is the first of the `bounces` segments.
|
|
36
|
+
* - `bounces` — segments, the first rise included (default 3: a rise, then 2 dips)
|
|
36
37
|
* - `decay` — amplitude reduction per bounce (0–1, default 0.5)
|
|
37
38
|
*
|
|
38
39
|
* @example
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollAnimate,b as scrollParallax}from'./chunk-
|
|
1
|
+
export{a as scrollAnimate,b as scrollParallax}from'./chunk-ETACBG7W.mjs';export{a as Cinematic}from'./chunk-YNNA33A5.mjs';export{a as scrollDraw}from'./chunk-BLY6F6EC.mjs';export{a as scrollCounter}from'./chunk-LGJQWZHH.mjs';import'./chunk-V4L3ELVC.mjs';export{a as PRESETS}from'./chunk-23EALNDF.mjs';import'./chunk-OJFWQ6CU.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-YZV4Z3EQ.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-A4JCC3QQ.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-DM6EDKWH.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-BCV4RAIX.mjs';import'./chunk-LFSU6LR3.mjs';
|
package/dist/nuxt/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function
|
|
2
|
-
<div style="position:absolute;${f?`left:${
|
|
3
|
-
<div style="position:absolute;${f?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}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 Zt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Jt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Rn(e,n,t){if(!Ze)return;let r=(e.match(Jt)??[]).join("").toUpperCase(),o=(n.match(Jt)??[]).join("").toUpperCase(),i=(e.match(Zt)??[]).length,a=(n.match(Zt)??[]).length;if(r!==o){he(`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}i!==a&&he(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function vt(e,n,t){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),m=r[o++]??a;return String(+(a+(m-a)*t).toFixed(4))})}function St(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ge(n,(t,r)=>Dn(e,t,r))}function Dn(e,n,t){let{preset:r,...o}=n,i=r?{...Gt[r],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:f=false,easing:d="linear",trigger:x={},stagger:F=0,direction:$="forward",once:Q=false,debug:me=false,axis:R="y",scrollContainer:se,autoReverse:be=false,delay:D=0,strokeColor:H,strokeWidth:P,fillOpacity:M,waypoints:w,velocityScale:v=false,threshold:T=0,rootMargin:U="0px",repeat:N=0,repeatDelay:B=0,morphTo:L,clip:fe,autoplay:Se=false,duration:ie=1e3,native:z=true,onProgress:u,onStart:A,onComplete:h,onEnter:k,onLeave:te,onEnterBack:pe,onLeaveBack:Ee}=i,Z=fe===true?"left":typeof fe=="string"?fe:false,S=typeof d=="function"?d:oe[d]??oe.linear,de=ye(x.start??"top bottom"),Ae=ye(x.end??"bottom top"),ae=typeof se=="string"?document.querySelector(se):se??null,le=Array.isArray(H)?H[0]:null,ne=Array.isArray(H)?H[1]:typeof H=="string"?H:null,re=Array.isArray(P)?P[0]:null,Y=Array.isArray(P)?P[1]:typeof P=="number"?P:null,ge=Array.isArray(M)?M[0]:null,J=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function ke(s){let c=s*100;switch(Z){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let _=Z?[]:Array.from(e.querySelectorAll(a)),O=[],we=[],l=0,p=0,Ce=F,Te=0,C=false,V=false,G=0,ze=false,q=-1,Ne=[],_e=-1,ce=false,Re=0,Ve=0,We,dt=null;function kt(){dt?.destroy(),dt=null;}let qe=new Set,Rt=NaN,Be=true,ot=-1,Dt=performance.now(),je=NaN;function Xe(){return ae?R==="x"?ae.scrollLeft:ae.scrollTop:R==="x"?window.scrollX:window.scrollY}function It(){return ae?R==="x"?ae.clientWidth:ae.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Ft(){let s=ct(e,ae,R);return Le(s,s.scroll,It(),de,Ae)}function yn(){let s=p-l,c=_.length-1,y=ae??document.documentElement,X=R==="x"?"Width":"Height";if(Ce=F,F>0&&c>0&&s>0){let xe=y[`scroll${X}`]-y[`client${X}`]-1-l-s/m;xe>=0&&(Ce=Math.min(F,xe/(c*s)));}Te=p+c*Ce*s;}function Ht(){(({tStart:l,tEnd:p}=Ft())),yn(),me&&Ze&&(kt(),dt=kn(l,p,R));}function gt(s,c=Ft){Oe(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let y=s.destroy;return s.destroy=()=>{y.call(s),Pe(e);},s}function hn(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),Z){let y=c==="reverse"?1-s:s;e.style.clipPath=ke(y);return}_.forEach((y,X)=>{y.style.strokeDashoffset=c==="reverse"?`${O[X]*s}`:`${O[X]*(1-s)}`,f&&(y.style.opacity=c==="reverse"?`${1-s}`:`${s}`),le&&ne?y.style.stroke=Ye(le,ne,s):ne&&(y.style.stroke=ne),re!==null&&Y!==null?y.style.strokeWidth=`${re+(Y-re)*s}`:Y!==null&&(y.style.strokeWidth=`${Y}`),ge!==null&&J!==null?y.style.fillOpacity=`${ge+(J-ge)*s}`:J!==null&&(y.style.fillOpacity=`${J}`),L&&y.tagName.toLowerCase()==="path"&&we[X]&&y.setAttribute("d",vt(we[X],L,s));});}function st(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ke(0);return}_.forEach((s,c)=>{s.style.strokeDasharray=`${O[c]}`,s.style.strokeDashoffset=$==="reverse"?"0":`${O[c]}`,f?s.style.opacity=$==="reverse"?"1":"0":s.style.opacity="",le&&(s.style.stroke=le),re!==null&&(s.style.strokeWidth=`${re}`),ge!==null&&(s.style.fillOpacity=`${ge}`),L&&s.tagName.toLowerCase()==="path"&&we[c]&&s.setAttribute("d",we[c]);});}if(_.forEach(s=>{Pn(s);let c=Ue(s);O.push(c);let y=s.tagName.toLowerCase()==="path";y?we.push(s.getAttribute("d")??""):we.push(""),L&&(y?Rn(we[we.length-1],L,s):he(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),t?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=$==="reverse"?`${c}`:"0",f&&(s.style.opacity="1"),ne&&(s.style.stroke=ne),Y!==null&&(s.style.strokeWidth=`${Y}`),J!==null&&(s.style.fillOpacity=`${J}`),L&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",L)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=$==="reverse"?"0":`${c}`,f?s.style.opacity=$==="reverse"?"1":"0":s.style.opacity="",le&&(s.style.stroke=le),re!==null&&(s.style.strokeWidth=`${re}`),ge!==null&&(s.style.fillOpacity=`${ge}`));}),Z){if(t)return e.style.clipPath=ke(1),h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(t)return h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Nt=typeof d=="string"?ut(d):null;function bn(){return !(z===false||!On()||!_.length||!Nt||Z||R!=="y"||ae||m!==1||F!==0||Q||be||v!==false||L||w||N||D>0||u||A||h||k||te||pe||Ee||H!=null||P!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function wn(){let s=++$n,c=`svg-scroll-draw-${s}`,y=`svg-scroll-draw-host-${s}`,X=`--svg-scroll-draw-${s}`,xe=$==="reverse"?"0":"var(--ssd-len)",De=$==="reverse"?"var(--ssd-len)":"0",$e=`stroke-dashoffset:${xe};`,E=`stroke-dashoffset:${De};`;f&&($e+=`opacity:${$==="reverse"?1:0};`,E+=`opacity:${$==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${c}{from{${$e}}to{${E}}}.${y}{view-timeline-name:${X};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Nt};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(y);function ue(g,K){g.style.setProperty("--ssd-len",String(O[K])),g.style.strokeDasharray=`${O[K]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(c);}_.forEach(ue);let b=false,W=-1;function j(){if(W>=0)return W;let g=e.getBoundingClientRect(),{tStart:K,tEnd:Me}=Le({top:g.top,height:g.height},Xe(),It(),de,Ae);return S(ee(Xe(),K,Me,m))}return {destroy(){e.classList.remove(y),_.forEach(g=>{g.classList.remove(c),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),I.remove();},replay(){b=false,W=-1,_.forEach(ue);},pause(){b=true,_.forEach(g=>{g.style.animationPlayState="paused";});},resume(){b&&(b=false,_.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let K=Math.min(1,Math.max(0,g));W=K,b=true,_.forEach((Me,ve)=>{Me.classList.remove(c),Me.style.strokeDashoffset=$==="reverse"?`${O[ve]*K}`:`${O[ve]*(1-K)}`,f&&(Me.style.opacity=$==="reverse"?`${1-K}`:`${K}`);});},getProgress(){return j()},refresh(){_.forEach((g,K)=>{O[K]=Ue(g),g.style.setProperty("--ssd-len",String(O[K])),g.style.strokeDasharray=`${O[K]}`;});}}}if(bn())return gt(wn());function vn(){let s=Math.max(1,ie),c=0,y=0,X=false;function xe(b){let W=true;if(Z){let j=Math.min(1,Math.max(0,b/s)),g=S(j);Re=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=ke($==="reverse"?1-g:g),u?.(g),j<1&&(W=false);}else _.forEach((j,g)=>{let K=g*F*s,Me=Math.min(1,Math.max(0,(b-K)/s)),ve=S(Me);j.style.strokeDashoffset=$==="reverse"?`${O[g]*ve}`:`${O[g]*(1-ve)}`,f&&(j.style.opacity=$==="reverse"?`${1-ve}`:`${ve}`),le&&ne?j.style.stroke=Ye(le,ne,ve):ne&&(j.style.stroke=ne),re!==null&&Y!==null?j.style.strokeWidth=`${re+(Y-re)*ve}`:Y!==null&&(j.style.strokeWidth=`${Y}`),ge!==null&&J!==null?j.style.fillOpacity=`${ge+(J-ge)*ve}`:J!==null&&(j.style.fillOpacity=`${J}`),L&&j.tagName.toLowerCase()==="path"&&we[g]&&j.setAttribute("d",vt(we[g],L,ve)),g===0&&(Re=ve,u?.(ve),e.style.setProperty("--scroll-draw-progress",String(ve))),Me<1&&(W=false);});if(w){let j=Math.min(1,Math.max(0,b/s)),g=S(j);for(let K in w){let Me=parseFloat(K);g>=Me&&!qe.has(Me)&&(qe.add(Me),w[K]?.());}}return W}function De(b){if(ce)return;let W=b-c;V||(V=true,A?.());let j=xe(W);if(j&&!C){C=true,xe(s*(1+Math.max(0,_.length-1)*F)),h?.(),Ve<(N==="infinite"?1/0:N??0)&&(Ve++,We=setTimeout(()=>{c=performance.now(),V=false,C=false,qe.clear(),st(),G=requestAnimationFrame(De);},B));return}j||(G=requestAnimationFrame(De));}function $e(){cancelAnimationFrame(G),clearTimeout(We),c=performance.now(),y=0,ce=false,V=false,C=false,Ve=0,X=true,Re=0,qe.clear(),st(),G=requestAnimationFrame(De);}let E=new IntersectionObserver(b=>{b.forEach(W=>{W.isIntersecting&&!(Q&&C)?$e():!W.isIntersecting&&!Q&&!C&&(cancelAnimationFrame(G),clearTimeout(We),X=false);});},{root:ae??null,threshold:T,rootMargin:U}),I;function ue(){clearTimeout(I),I=setTimeout(()=>{_.forEach((b,W)=>{O[W]=Ue(b),b.style.strokeDasharray=`${O[W]}`;});},150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),D>0?setTimeout(()=>E.observe(e),D):E.observe(e),{destroy(){cancelAnimationFrame(G),clearTimeout(We),E.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(I);},replay(){Ve=0,$e();},pause(){ce||!X||(ce=true,y=performance.now()-c,cancelAnimationFrame(G));},resume(){ce&&(ce=false,X=true,c=performance.now()-y,G=requestAnimationFrame(De));},seek(b){let W=Math.min(1,Math.max(0,b));Re=W,ce=true,y=W*s,c=performance.now()-y,cancelAnimationFrame(G),xe(y);},getProgress(){return Re},refresh(){clearTimeout(I),_.forEach((b,W)=>{O[W]=Ue(b),b.style.strokeDasharray=`${O[W]}`;});}}}if(Se)return gt(vn());Ht();function Vt(){if(ce||!Qe)return;let s=performance.now(),c=Xe();if(!Be&&v===false&&c===Rt){ht(c);return}Be=false,Rt=c;let y=m;if(v!==false){let E=s-Dt,I=E>0?Math.abs(c-(ot<0?c:ot))/E:0;y=m*Math.max(.2,1+I*(typeof v=="number"?v:1)*.04);}ot=c,Dt=s;let X=be?_e===-1||c>=_e?"forward":"reverse":$;_e=c;let xe=p-l,De=true,$e=xe===0?0:(c-l)/xe;if(isNaN(je)||(je<=0&&$e>0?k?.():je>0&&$e<=0&&Ee?.(),je<1&&$e>=1?te?.():je>=1&&$e<1&&pe?.()),je=$e,Z){let E=S(ee(c,l,p,y));Q&&!be&&(q=Math.max(q,E),E=q),Re=E,e.style.setProperty("--scroll-draw-progress",String(E));let I=X==="reverse"?1-E:E;e.style.clipPath=ke(I),u?.(E),!V&&ee(c,l,p,y)>0&&(V=true,A?.()),E>=1&&!C?(C=true,h?.(),Ve<(N==="infinite"?1/0:N??0)&&(Ve++,We=setTimeout(()=>{q=-1,V=false,C=false,e.style.clipPath=ke(0);},B))):E<1&&!Q&&(C=false),ht(c);return}if(_.forEach((E,I)=>{let ue=I*Ce*xe,b=S(ee(c,l+ue,p+ue,y));Q&&!be&&(b=Ne[I]=Math.max(Ne[I]??q,b)),E.style.strokeDashoffset=X==="reverse"?`${O[I]*b}`:`${O[I]*(1-b)}`,f&&(E.style.opacity=X==="reverse"?`${1-b}`:`${b}`),le&&ne?E.style.stroke=Ye(le,ne,b):ne&&(E.style.stroke=ne),re!==null&&Y!==null?E.style.strokeWidth=`${re+(Y-re)*b}`:Y!==null&&(E.style.strokeWidth=`${Y}`),ge!==null&&J!==null?E.style.fillOpacity=`${ge+(J-ge)*b}`:J!==null&&(E.style.fillOpacity=`${J}`),L&&E.tagName.toLowerCase()==="path"&&we[I]&&E.setAttribute("d",vt(we[I],L,b)),I===0&&(Re=b,u?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(De=false);}),w){let E=S(ee(c,l,p,y));for(let I in w){let ue=parseFloat(I);E>=ue&&!qe.has(ue)&&(qe.add(ue),w[I]?.());}}!V&&ee(c,l,p,y)>0&&(V=true,A?.()),De&&!C?(C=true,h?.(),Ve<(N==="infinite"?1/0:N??0)&&(Ve++,We=setTimeout(()=>{q=-1,Ne=[],V=false,C=false,qe.clear(),st(),Be=true;},B))):!De&&!Q&&(C=false),ht(c);}function yt(s){return s>=p&&s<Te}function ht(s){ze||yt(s)?G=requestAnimationFrame(Vt):Qe=false;}function bt(){return ze||yt(Xe())}let Qe=false;function it(){Qe||(Qe=true,G=requestAnimationFrame(function(){Vt();}));}function at(){Qe=false,cancelAnimationFrame(G);}let wt=new IntersectionObserver(s=>{s.forEach(c=>{ze=c.isIntersecting,ze&&!ce?(Be=true,it()):Qe&&!ce&&yt(Xe())||at();});},{root:ae??null,threshold:T,rootMargin:U});function zt(){_.forEach((s,c)=>{O[c]=Ue(s),s.style.strokeDasharray=`${O[c]}`;}),Ht(),Be=true;}let lt;function Ke(){clearTimeout(lt),lt=setTimeout(zt,150);}window.addEventListener("resize",Ke),window.addEventListener("orientationchange",Ke);let Sn=Ie([e],Ke);return D>0?setTimeout(()=>wt.observe(e),D):wt.observe(e),gt({destroy(){cancelAnimationFrame(G),clearTimeout(We),at(),wt.disconnect(),Sn(),window.removeEventListener("resize",Ke),window.removeEventListener("orientationchange",Ke),clearTimeout(lt),kt();},replay(){q=-1,Ne=[],_e=-1,ot=-1,V=false,C=false,Ve=0,ce=false,Re=0,qe.clear(),clearTimeout(We),st(),Be=true,bt()&&it();},pause(){ce=true,at();},resume(){ce&&(ce=false,Be=true,bt()&&it());},seek(s){let c=Math.min(1,Math.max(0,s));Re=c,q=c,Ne=[],ce=true,at(),hn(c,$),Be=true;},getProgress(){return Re},refresh(){clearTimeout(lt),zt(),bt()&&!ce&&it();}},()=>({tStart:l,tEnd:p}))}var en=new WeakMap,In=0;function tn(e){return JSON.stringify(e,(n,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let r=en.get(t);return r===void 0&&en.set(t,r=++In),`el#${r}`}return t})}function nn(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 Fn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function rn(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let o=[],i=[],a=r[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let f=m.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}n.push({fn:r[1],nums:o,units:i});}return n}function Hn(e,n,t){let r=rn(e),o=rn(n);return r.length===0||r.length!==o.length?t<1?e:n:r.map((i,a)=>{let m=o[a];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((f,d)=>`${f}${i.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((f,d)=>`${f}${m.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,d)=>`${f+(m.nums[d]-f)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function on(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),o=String(n);if(Fn(r))return Ye(r,o,t);if(r.includes("("))return Hn(r,o,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let m=parseFloat(i[1]),f=parseFloat(a[1]);return `${m+(f-m)*t}${i[2]||a[2]}`}return t<1?r:o}function Nn(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Vn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),zn=0,sn="--scroll-draw-progress";function _n(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var ln={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,n){return typeof window>"u"?ln:n.respectReducedMotion===false?an(e,n,false):Ge(n,(t,r)=>an(e,t,r))}function an(e,n,t){let{props:r,trigger:o={},easing:i="ease-out",speed:a=1,once:m=false,axis:f="y",scrollContainer:d,native:x=true,velocityScale:F=false,triggerElement:$,onProgress:Q,onComplete:me,onEnter:R,onLeave:se,onEnterBack:be,onLeaveBack:D}=n,H=typeof i=="function"?i:oe[i]??oe["ease-out"],P=ye(o.start??"top bottom"),M=ye(o.end??"bottom top"),w=$??e,v=typeof d=="string"?document.querySelector(d):d??null,T=Object.entries(r).map(([l,p])=>({prop:Nn(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function U(){let l=window.getComputedStyle(e);for(let p of T)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function N(){for(let l of T)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...T.map(p=>p.prop),sn])B.set(l,e.style.getPropertyValue(l));function L(){for(let[l,p]of B)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(t)return N(),me?.(),{...ln,destroy:L,getProgress:()=>1};U();let fe=typeof i=="string"?ut(i):null;function Se(){if(!x||!_n()||!fe||f!=="y"||v||w!==e||m||a!==1||Q||me||R||se||be||D||F!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let l of T)if(!Vn.has(l.prop))return false;return true}function ie(){let l=`ssd-a-${++zn}`,p=T.map(q=>`${q.prop}:${q.from}`).join(";"),Ce=T.map(q=>`${q.prop}:${q.to}`).join(";"),Te=document.createElement("style");Te.setAttribute("data-ssd-animate",""),Te.textContent=`@keyframes ${l}{from{${p}}to{${Ce}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${fe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(Te),e.classList.add(l);let C=()=>f==="x"?window.scrollX:window.scrollY,V=()=>f==="x"?window.innerWidth:window.innerHeight,G=()=>{let q=e.getBoundingClientRect();return Le({top:q.top,height:q.height},C(),V(),P,M)};Oe(e,{type:"animate",getProgress:()=>ze.getProgress(),getTrigger:G});let ze={refresh(){},destroy(){e.classList.remove(l),Te.remove(),e.style.animationPlayState="",L(),Pe(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(q){let Ne=Math.min(1,Math.max(0,q));e.classList.remove(l);for(let _e of T)e.style.setProperty(_e.prop,on(_e.from,_e.to,Ne));},getProgress(){let{tStart:q,tEnd:Ne}=G();return H(ee(C(),q,Ne,a))}};return ze}if(Se())return ie();let z=0,u=0,A=0,h=false,k=false,te=-1,pe=0,Ee=false,Z=NaN,S=-1,de=0,Ae=()=>v?f==="x"?v.scrollLeft:v.scrollTop:f==="x"?window.scrollX:window.scrollY,ae=()=>v?f==="x"?v.clientWidth:v.clientHeight:f==="x"?window.innerWidth:window.innerHeight,le=w===e?T:[],ne=false;function re(){let l=e.style,p=le.map(V=>l.getPropertyValue(V.prop)),Ce=l.transition;le.length&&(l.transition="none"),le.forEach(V=>l.setProperty(V.prop,B.get(V.prop)??""));let Te=ct(w,v,f);le.forEach((V,G)=>l.setProperty(V.prop,p[G])),le.length&&(e.offsetWidth,l.transition=Ce);let C=Le(Te,Te.scroll,ae(),P,M);ne&&Math.abs(C.tStart-z)<1&&Math.abs(C.tEnd-u)<1||(ne=true,z=C.tStart,u=C.tEnd);}function Y(l){e.style.setProperty(sn,String(l));for(let p of T)e.style.setProperty(p.prop,on(p.from,p.to,l));Q?.(l);}function ge(l){if(isNaN(Z)){Z=l;return}Z<=0&&l>0?R?.():Z>0&&l<=0&&D?.(),Z<1&&l>=1?se?.():Z>=1&&l<1&&be?.(),Z=l;}function J(){if(!h||k)return;let l=performance.now(),p=Ae(),Ce=a;if(F!==false){let V=l-de,G=V>0?Math.abs(p-(S<0?p:S))/V:0;Ce=a*Math.max(.2,1+G*(typeof F=="number"?F:1)*.04);}S=p,de=l;let Te=u===z?0:(p-z)/(u-z);ge(Te);let C=H(ee(p,z,u,Ce));m&&(te=Math.max(te,C),C=te),pe=C,Y(C),C>=1&&!Ee?(Ee=true,me?.()):C<1&&!m&&(Ee=false),A=requestAnimationFrame(J);}re(),u===z&&he("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let l=H(ee(Ae(),z,u,a));m&&l>0&&(te=l),pe=l,Y(l);}let ke=new IntersectionObserver(l=>{l.forEach(p=>{h=p.isIntersecting,h&&!k?A=requestAnimationFrame(J):cancelAnimationFrame(A);});},{root:v??null}),_;function O(){clearTimeout(_),_=setTimeout(re,150);}window.addEventListener("resize",O),window.addEventListener("orientationchange",O);let we=Ie([w],O);return ke.observe(e),Oe(e,{type:"animate",getProgress:()=>pe,getTrigger:()=>({tStart:z,tEnd:u})}),{destroy(){cancelAnimationFrame(A),ke.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),we(),clearTimeout(_),L(),Pe(e);},replay(){te=-1,Ee=false,pe=0,k=false,Y(0);},pause(){k=true,cancelAnimationFrame(A);},resume(){k&&(k=false,h&&(A=requestAnimationFrame(J)));},seek(l){let p=Math.min(1,Math.max(0,l));pe=p,te=p,k=true,cancelAnimationFrame(A),Y(p);},getProgress(){return pe},refresh(){re();}}}var Tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function xt(e,n){if(typeof window>"u")return Tt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ge(n,(r,o)=>Wn(t,r,o)):(he("scrollCounter: element not found:",e),Tt)}function Wn(e,n,t){let{from:r=0,to:o,format:i,easing:a="ease-out",trigger:m={},once:f=true,decimals:d,onComplete:x}=n,F=d!==void 0?u=>u.toFixed(d):i??(u=>String(Math.round(u))),$=typeof a=="function"?a:oe[a]??oe["ease-out"],Q=ye(m.start??"top 80%"),me=ye(m.end??"top 20%");if(t)return e.textContent=F(o),x?.(),{...Tt,getProgress:()=>1};let R=0,se=0,be=false,D=0,H=false,P=false,M=-1,w=0,v=false,T=()=>window.scrollY,U=()=>window.innerHeight;function N(){let u=e.getBoundingClientRect(),A=Le({top:u.top,height:u.height},T(),U(),Q,me);be&&Math.abs(A.tStart-R)<1&&Math.abs(A.tEnd-se)<1||(be=true,R=A.tStart,se=A.tEnd);}function B(u){e.textContent=F(r+(o-r)*u),e.style.setProperty("--scroll-draw-progress",String(u));}function L(){if(!H||P)return;let u=$(ee(T(),R,se,1));f&&(M=Math.max(M,u),u=M),w=u,B(u),u>=1&&!v?(v=true,x?.()):u<1&&!f&&(v=false),D=requestAnimationFrame(L);}N();{let u=$(ee(T(),R,se,1));f&&u>0&&(M=u),w=u,B(u);}let fe=new IntersectionObserver(u=>{u.forEach(A=>{H=A.isIntersecting,H&&!P?D=requestAnimationFrame(L):cancelAnimationFrame(D);});}),Se;function ie(){clearTimeout(Se),Se=setTimeout(N,150);}window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie);let z=Ie([e],ie);return fe.observe(e),Oe(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:R,tEnd:se})}),{destroy(){cancelAnimationFrame(D),fe.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),z(),clearTimeout(Se),Pe(e);},replay(){M=-1,v=false,w=0,P=false,B(0);},pause(){P=true,cancelAnimationFrame(D);},resume(){P&&(P=false,H&&(D=requestAnimationFrame(L)));},seek(u){let A=Math.min(1,Math.max(0,u));w=A,M=A,P=true,cancelAnimationFrame(D),B(A);},getProgress(){return w}}}var cn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Mt(e,n={}){if(typeof window>"u")return cn;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),cn;let r=t,{trigger:o={},easing:i="linear",once:a=false,axis:m="y",preload:f="auto",triggerElement:d,onReady:x,onComplete:F,onProgress:$}=n,Q=d??r,me=window.matchMedia("(prefers-reduced-motion: reduce)").matches,R=typeof i=="function"?i:oe[i]??oe.linear,se=ye(o.start??"top top"),be=ye(o.end??"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=f);let D=n.from??0,H=n.to,P=0,M=0,w=0,v=false,T=false,U=-1,N=0,B=false,L=false,fe=()=>m==="x"?window.scrollX:window.scrollY,Se=()=>m==="x"?window.innerWidth:window.innerHeight;function ie(){let S=Q.getBoundingClientRect(),de=m==="x"?S.left:S.top,Ae=m==="x"?S.width:S.height,ae=Le({top:de,height:Ae},fe(),Se(),se,be);P=ae.tStart,M=ae.tEnd,L&&M===P&&he("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let z=NaN;function u(S){if(!L)return;let de=H??r.duration??0,Ae=D+(de-D)*S;Ae!==z&&(z=Ae,r.currentTime=Ae),r.style.setProperty("--scroll-draw-progress",String(S)),$?.(S);}function A(){if(!v||T||!L||me)return;let S=R(ee(fe(),P,M,1));a&&(U=Math.max(U,S),S=U),N=S,u(S),S>=1&&!B?(B=true,F?.()):S<1&&!a&&(B=false),w=requestAnimationFrame(A);}function h(){if(L=true,H===void 0&&(H=r.duration),me){u(1),x?.();return}ie(),x?.(),v&&!T&&(w=requestAnimationFrame(A));}r.readyState>=1?h():r.addEventListener("loadedmetadata",h,{once:true}),L||ie();let k=me?()=>{}:pt(S=>{S&&(k(),me=true,cancelAnimationFrame(w),u(1));}),te=new IntersectionObserver(S=>{S.forEach(de=>{v=de.isIntersecting,v&&!T&&L?w=requestAnimationFrame(A):cancelAnimationFrame(w);});}),pe;function Ee(){clearTimeout(pe),pe=setTimeout(ie,150);}window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee);let Z=Ie([Q],Ee);return te.observe(r),Oe(r,{type:"video",getProgress:()=>N,getTrigger:()=>({tStart:P,tEnd:M})}),{destroy(){cancelAnimationFrame(w),te.disconnect(),r.removeEventListener("loadedmetadata",h),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),Z(),k(),clearTimeout(pe),Pe(r);},replay(){U=-1,B=false,N=0,T=false,z=NaN,u(0);},pause(){T=true,cancelAnimationFrame(w);},resume(){T&&(T=false,v&&L&&(w=requestAnimationFrame(A)));},seek(S){let de=Math.min(1,Math.max(0,S));N=de,U=de,T=true,cancelAnimationFrame(w),z=NaN,u(de);},getProgress(){return N}}}function un(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 pn(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(r.textContent=t,r.style.whiteSpace="pre"):(r.textContent=t,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(t)?null:r}).filter(t=>t!==null)}function qn(e){let n=e.textContent??"";return e.textContent="",n.split("").map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=t,t===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),t===" "?null:r}).filter(t=>t!==null)}function mn(e){let n=pn(e),t=new Map;for(let i of n){let a=i.offsetTop;t.has(a)||t.set(a,[]),t.get(a).push(i);}let r=[],o=Array.from(t.keys()).sort((i,a)=>i-a);for(let i of o){let a=t.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",a.forEach((f,d)=>{let x=f.nextElementSibling;m.appendChild(f),d<a.length-1&&x&&x.style.whiteSpace==="pre"&&m.appendChild(x);}),r.push(m);}return e.textContent="",r.forEach((i,a)=>{e.appendChild(i),a<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Bn(e,n,t,r){if(t<=1||r===0)return e;let o=(t-1)*r,i=n*r,a=i+(1-o);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function Gn(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 fn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lt(e,n={}){if(typeof window>"u")return fn;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return he("scrollText: element not found:",e),fn;let r=t;return Ge(n,(o,i)=>jn(r,o,i))}function jn(e,n,t){let{split:r="words",stagger:o=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:m={},once:f=true,onComplete:d}=n,x=typeof i=="function"?i:oe[i]??oe["ease-out"],F=ye(m.start??"top 85%"),$=ye(m.end??"top 40%"),Q=e.innerHTML,me=e.textContent??"",R;r==="chars"?R=qn(e):r==="lines"?R=mn(e):R=pn(e),un(e,me);let se=R.length;function be(h,k){a?.opacity!==void 0&&(h.style.opacity=String(a.opacity+(1-a.opacity)*k));let te=Gn(k,a);te&&(h.style.transform=te);}function D(h){e.style.setProperty("--scroll-draw-progress",String(h)),R.forEach((k,te)=>{let pe=x(Bn(h,te,se,o));be(k,pe);});}if(t)return D(1),d?.(),{destroy(){e.innerHTML=Q;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};D(0);let H=0,P=0,M=0,w=false,v=false,T=-1,U=0,N=false,B=()=>window.scrollY,L=()=>window.innerHeight;function fe(){let h=e.getBoundingClientRect(),k=Le({top:h.top,height:h.height},B(),L(),F,$);H=k.tStart,P=k.tEnd;}function Se(){if(!w||v)return;let h=ee(B(),H,P,1);f&&(T=Math.max(T,h),h=T),U=h,D(h),h>=1&&!N?(N=true,d?.()):h<1&&!f&&(N=false),M=requestAnimationFrame(Se);}fe();let ie=new IntersectionObserver(h=>{h.forEach(k=>{w=k.isIntersecting,w&&!v?M=requestAnimationFrame(Se):cancelAnimationFrame(M);});}),z;function u(){clearTimeout(z),z=setTimeout(()=>{if(r==="lines"){let h=U;e.innerHTML=Q,R=mn(e),un(e,me),D(h);}fe();},150);}window.addEventListener("resize",u),window.addEventListener("orientationchange",u);let A=Ie([e],u);return ie.observe(e),Oe(e,{type:"text",getProgress:()=>U,getTrigger:()=>({tStart:H,tEnd:P})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",u),window.removeEventListener("orientationchange",u),A(),clearTimeout(z),e.innerHTML=Q,Pe(e);},replay(){T=-1,N=false,U=0,v=false,D(0);},pause(){v=true,cancelAnimationFrame(M);},resume(){v&&(v=false,w&&(M=requestAnimationFrame(Se)));},seek(h){let k=Math.min(1,Math.max(0,h));U=k,T=k,v=true,cancelAnimationFrame(M),D(k);},getProgress(){return U}}}var rt=e=>typeof e=="function"?e():vue.unref(e);function He(e,n,t){let r=null,o=n(),i=()=>{r?.destroy(),r=e.value?t(e.value,nn(o,()=>o)):null;};vue.onMounted(i),vue.watch(()=>tn(o=n()),i),vue.onUnmounted(()=>{r?.destroy(),r=null;});}function Kn(e={}){let n=vue.ref(null);return He(n,()=>rt(e),St),n}var dn={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},Zn=[null,Boolean,[Boolean,String],[Boolean,Number]],gn=e=>({type:e,default:void 0}),At=vue.defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(dn).map(([e,n])=>[e,n?gn(Zn[n]):null])),setup(e,{slots:n}){let t=vue.ref(null);return He(t,()=>{let r={};for(let o in dn){let i=e[o];i!=null&&(r[o]=i);}return r},St),()=>vue.h("div",{ref:t},n.default?.())}});function Jn(e){let n=vue.ref(null);return He(n,()=>rt(e),Et),n}var Ct=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let t=vue.ref(null);return He(t,()=>e.options,Et),()=>vue.h("div",{ref:t},n.default?.())}});function er(e){let n=vue.ref(null);return He(n,()=>rt(e),xt),n}var $t=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:gn(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let n=vue.ref(null);return He(n,()=>{let t={to:e.to};return e.from!=null&&(t.from=e.from),e.format!=null&&(t.format=e.format),e.easing!=null&&(t.easing=e.easing),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.decimals!=null&&(t.decimals=e.decimals),e.onComplete!=null&&(t.onComplete=e.onComplete),t},xt),()=>vue.h("span",{ref:n})}});function tr(e={}){let n=vue.ref(null);return He(n,()=>rt(e),Mt),n}var Ot=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let n=vue.ref(null);return He(n,()=>e.options??{},Mt),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function nr(e={}){let n=vue.ref(null);return He(n,()=>rt(e),Lt),n}var Pt=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let t=vue.ref(null);return He(t,()=>e.options??{},Lt),()=>vue.h(e.tag,{ref:t},n.default?.())}});function wo(){return {install(e){e.component("ScrollDraw",At),e.component("ScrollAnimate",Ct),e.component("ScrollCounter",$t),e.component("ScrollVideo",Ot),e.component("ScrollText",Pt);}}}exports.ScrollAnimate=Ct;exports.ScrollCounter=$t;exports.ScrollDraw=At;exports.ScrollText=Pt;exports.ScrollVideo=Ot;exports.createScrollDrawPlugin=wo;exports.useScrollAnimate=Jn;exports.useScrollCounter=er;exports.useScrollDraw=Kn;exports.useScrollText=nr;exports.useScrollVideo=tr;
|
|
1
|
+
'use strict';var vue=require('vue');function Mn({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),i=0,l=[];for(let d=0;d<t;d++){let v=Math.pow(s,d);l.push(v),i+=v;}let m=[0],f=0;for(let d=0;d<t;d++)f+=l[d]/i,m.push(f);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<t;v++)if(d<=m[v+1]){let R=(d-m[v])/(m[v+1]-m[v]);if(v===0)return R*(2-R);let S=1-Math.pow(r,v);return S+(1-S)*(2*R-1)*(2*R-1)}return 1}}function Ln({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 i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/r)+1}var ne={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Mn(),elastic:Ln()};function Bt(e,n,t){return Math.min(t,Math.max(n,e))}function fe(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}}function Wt(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function Gt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function ee(e,n,t,r){return t===n?0:Bt((e-n)/(t-n)*r,0,1)}function Te(e,n,t,r,s){let i=Wt(e.top,e.height,n,r.element)-Gt(r.viewport,t),l=Wt(e.top,e.height,n,s.element)-Gt(s.viewport,t);return {tStart:i,tEnd:l}}function lt(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 Qe(e){let n=e.tagName.toLowerCase();if(n==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),r=parseFloat(e.getAttribute("height")??"0");return 2*(t+r)}if(n==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function jt(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 ct(e,n,t){let r=jt(e),s=jt(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 Qt={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 Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function pe(e,...n){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var An="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Cn="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Ut=33;function On(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Pn(e){let n=[];for(let t=0;t<Ut;t++){let r=t/(Ut-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function ut(e){switch(e){case "linear":return "linear";case "ease-in":return An;case "ease-out":return Cn;case "ease-in-out":return On()?Pn(ne["ease-in-out"]):null;default:return null}}var Yt=Symbol.for("svg-scroll-draw.registry");function Xt(){let e=globalThis;return e[Yt]||(e[Yt]=new Map)}function Le(e,n){Xt().set(e,n);}function Ae(e){Xt().delete(e);}var Ze,mt=new Set,ft=new WeakMap,Je=new Map,Kt=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function $n(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 Re(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();Ze??(Ze=new ResizeObserver(s=>{let i=false;for(let{target:l}of s)ft.get(l)!==Kt(l)&&(i=true),ft.set(l,"");i&&mt.forEach(l=>l());})),mt.add(t);let r=$n(e);return [document.body,document.documentElement].forEach(s=>s&&r.add(s)),r.forEach(s=>{ft.has(s)||ft.set(s,Kt(s)),Je.set(s,(Je.get(s)??0)+1),Ze.observe(s);}),()=>{mt.delete(t)&&(r.forEach(s=>{let i=(Je.get(s)??1)-1;if(i)return void Je.set(s,i);Je.delete(s),Ze?.unobserve(s);}),mt.size||(Ze?.disconnect(),Ze=void 0));}}function pt(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 We(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=pt(i=>{if(!i)return;r();let l=(t.getProgress?.()??0)>=1;t.destroy(),t=n(l?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...l)=>t[i]?.(...l);return s.destroy=()=>{r(),t.destroy();},s}var kn=0;function Rn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Zt(e,n){let t="";try{t=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return t||(e.getAttribute(n)??"").trim()}var Jt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function In(e){if(!Ke)return;let n=Zt(e,"stroke");if(!n||n==="none"){pe("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Jt.has(t)&&!Jt.has(Zt(e,"fill"))&&pe("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Dn(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 s(){let i=t==="x"?window.scrollX:window.scrollY,l=e-i,m=n-i,f=t==="x";r.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${f?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${f?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}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",s,{passive:true}),s(),{el:r,destroy(){window.removeEventListener("scroll",s),r.remove();}}}var en=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,tn=/[MmLlHhVvCcSsQqTtAaZz]/g;function Fn(e,n,t){if(!Ke)return;let r=(e.match(tn)??[]).join("").toUpperCase(),s=(n.match(tn)??[]).join("").toUpperCase(),i=(e.match(en)??[]).length,l=(n.match(en)??[]).length;if(r!==s){pe(`morphTo: command sequence differs (${r||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==l&&pe(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function Hn(e,n,t){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),m=r[s++]??l;return String(+(l+(m-l)*t).toFixed(4))})}function St(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:We(n,(t,r)=>Nn(e,t,r))}function Nn(e,n,t){let{preset:r,...s}=n,i=r?{...Qt[r],...s}:s,{selector:l="path, polyline, line, polygon, rect, circle",speed:m=1,fade:f=false,easing:d="linear",trigger:v={},stagger:R=0,direction:S="forward",once:Z=false,debug:re=false,axis:M="y",scrollContainer:oe,autoReverse:ye=false,delay:C=0,strokeColor:O,strokeWidth:L,fillOpacity:A,waypoints:b,velocityScale:h=false,threshold:w=0,rootMargin:Y="0px",repeat:_=0,repeatDelay:X=0,morphTo:I,clip:F,autoplay:ce=false,duration:he=1e3,native:te=true,onProgress:G,onStart:p,onComplete:u,onEnter:T,onLeave:ue,onEnterBack:me,onLeaveBack:Ce}=i,H=F===true?"left":typeof F=="string"?F:false,J=typeof d=="function"?d:ne[d]??ne.linear,P=fe(v.start||"top bottom"),$=fe(v.end||"bottom top"),q=typeof oe=="string"?document.querySelector(oe):oe??null,ve=Array.isArray(O)?O[0]:null,Se=Array.isArray(O)?O[1]:typeof O=="string"?O:null,Oe=Array.isArray(L)?L[0]:null,Pe=Array.isArray(L)?L[1]:typeof L=="number"?L:null,Ee=Array.isArray(A)?A[0]:null,ze=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function $e(o){let a=o*100;switch(H){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let B=H?[]:Array.from(e.querySelectorAll(l)),N=[],de=[],ge=0,c=0,g=R,Fe=0,k=false,V=false,x=0,z=false,xe=-1,Me=[],rt=-1,se=false,ke=0,He=0,_e,dt=null;function kt(){dt?.destroy(),dt=null;}let qe=new Set,Rt=NaN,Be=true,ot=-1,It=performance.now(),Ge=NaN;function Ue(){return q?M==="x"?q.scrollLeft:q.scrollTop:M==="x"?window.scrollX:window.scrollY}function Dt(){return q?M==="x"?q.clientWidth:q.clientHeight:M==="x"?window.innerWidth:window.innerHeight}function Ft(){let o=lt(e,q,M);return Te(o,o.scroll,Dt(),P,$)}function bn(){let o=c-ge,a=B.length-1,y=q??document.documentElement,j=M==="x"?"Width":"Height";if(g=R,R>0&&a>0&&o>0){let be=y[`scroll${j}`]-y[`client${j}`]-1-ge-o/m;be>=0&&(g=Math.min(R,be/(a*o)));}Fe=c+a*g*o;}function Ht(){(({tStart:ge,tEnd:c}=Ft())),bn(),re&&Ke&&(kt(),dt=Dn(ge,c,M));}function gt(o,a=Ft){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let y=o.destroy;return o.destroy=()=>{y.call(o),Ae(e);},o}function Nt(o,a){return Z&&!ye?Math.max(xe,J(Me[o]=Math.max(Me[o]??0,a))):J(a)}function wn(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),H){let y=a==="reverse"?1-o:o;e.style.clipPath=$e(y);return}B.forEach((y,j)=>yt(y,j,o,a));}function yt(o,a,y,j){o.style.strokeDashoffset=j==="reverse"?`${N[a]*y}`:`${N[a]*(1-y)}`,f&&(o.style.opacity=j==="reverse"?`${1-y}`:`${y}`),ve&&Se?o.style.stroke=ct(ve,Se,y):Se&&(o.style.stroke=Se),Oe!==null&&Pe!==null?o.style.strokeWidth=`${Oe+(Pe-Oe)*y}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),Ee!==null&&ze!==null?o.style.fillOpacity=`${Ee+(ze-Ee)*y}`:ze!==null&&(o.style.fillOpacity=`${ze}`),I&&o.tagName.toLowerCase()==="path"&&de[a]&&o.setAttribute("d",Hn(de[a],I,y));}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),H){e.style.clipPath=$e(S==="reverse"?1:0);return}B.forEach((o,a)=>{o.style.strokeDasharray=`${N[a]}`,o.style.strokeDashoffset=S==="reverse"?"0":`${N[a]}`,f?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Oe!==null&&(o.style.strokeWidth=`${Oe}`),Ee!==null&&(o.style.fillOpacity=`${Ee}`),I&&o.tagName.toLowerCase()==="path"&&de[a]&&o.setAttribute("d",de[a]);});}if(B.forEach(o=>{In(o);let a=Qe(o);N.push(a);let y=o.tagName.toLowerCase()==="path";y?de.push(o.getAttribute("d")??""):de.push(""),I&&(y?Fn(de[de.length-1],I,o):pe(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?`${a}`:"0",f&&(o.style.opacity="1"),Se&&(o.style.stroke=Se),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ze!==null&&(o.style.fillOpacity=`${ze}`),I&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",I)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=S==="reverse"?"0":`${a}`,f?o.style.opacity=S==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Oe!==null&&(o.style.strokeWidth=`${Oe}`),Ee!==null&&(o.style.fillOpacity=`${Ee}`));}),t)return H&&(e.style.clipPath=$e(1)),u?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};H&&(e.style.clipPath=$e(S==="reverse"?1:0));let Vt=typeof d=="string"?ut(d):null;function vn(){return !(te===false||ce||re||!Rn()||!B.length||!Vt||H||M!=="y"||q||m!==1||R!==0||Z||ye||h!==false||I||b||_||C>0||G||p||u||T||ue||me||Ce||O!=null||L!=null||A!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function Sn(){let o=++kn,a=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,j=`--svg-scroll-draw-${o}`,be=S==="reverse"?"0":"var(--ssd-len)",Ne=S==="reverse"?"var(--ssd-len)":"0",we=`stroke-dashoffset:${be};`,W=`stroke-dashoffset:${Ne};`;f&&(we+=`opacity:${S==="reverse"?1:0};`,W+=`opacity:${S==="reverse"?0:1};`);let Q=document.createElement("style");Q.setAttribute("data-svg-scroll-draw",""),Q.textContent=`@keyframes ${a}{from{${we}}to{${W}}}.${y}{view-timeline-name:${j};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Vt};animation-fill-mode:both;animation-timeline:${j};animation-range:cover 0% cover 100%;}`,document.head.appendChild(Q),e.classList.add(y);function ie(E,D){E.style.setProperty("--ssd-len",String(N[D])),E.style.strokeDasharray=`${N[D]}`,E.style.strokeDashoffset="",E.style.opacity="",E.style.animationPlayState="",E.classList.add(a);}B.forEach(ie);let ae=false,U=-1;function K(){if(U>=0)return U;let E=e.getBoundingClientRect(),{tStart:D,tEnd:le}=Te({top:E.top,height:E.height},Ue(),Dt(),P,$);return J(ee(Ue(),D,le,m))}return {destroy(){e.classList.remove(y),B.forEach(E=>{E.classList.remove(a),E.style.removeProperty("--ssd-len"),E.style.animationPlayState="";}),Q.remove();},replay(){ae=false,U=-1,B.forEach(ie);},pause(){ae=true,B.forEach(E=>{E.style.animationPlayState="paused";});},resume(){ae&&(ae=false,B.forEach(E=>{E.style.animationPlayState="running";}));},seek(E){let D=Math.min(1,Math.max(0,E));U=D,ae=true,B.forEach((le,Ve)=>{le.classList.remove(a),le.style.strokeDashoffset=S==="reverse"?`${N[Ve]*D}`:`${N[Ve]*(1-D)}`,f&&(le.style.opacity=S==="reverse"?`${1-D}`:`${D}`);});},getProgress(){return K()},refresh(){B.forEach((E,D)=>{N[D]=Qe(E),E.style.setProperty("--ssd-len",String(N[D])),E.style.strokeDasharray=`${N[D]}`;});}}}if(vn())return gt(Sn());function En(){let o=Math.max(1,he),a=H?o:o*(1+Math.max(0,B.length-1)*R),y=0,j=0,be=false;function Ne(U){let K=true,E=Math.min(1,Math.max(0,U/a));if(H){let D=Math.min(1,Math.max(0,U/o)),le=J(D);ke=le,e.style.setProperty("--scroll-draw-progress",String(le)),e.style.clipPath=$e(S==="reverse"?1-le:le),G?.(le),D<1&&(K=false);}else {B.forEach((le,Ve)=>{let xn=Ve*R*o,qt=Math.min(1,Math.max(0,(U-xn)/o));yt(le,Ve,J(qt),S),qt<1&&(K=false);});let D=J(E);ke=D,G?.(D),e.style.setProperty("--scroll-draw-progress",String(D));}if(b){let D=J(E);for(let le in b){let Ve=parseFloat(le);D>=Ve&&!qe.has(Ve)&&(qe.add(Ve),b[le]?.());}}return K}function we(U){if(se)return;let K=U-y;V||(V=true,p?.());let E=Ne(K);if(E&&!k){k=true,Ne(a),u?.(),He<(_==="infinite"?1/0:_??0)&&(He++,_e=setTimeout(()=>{y=performance.now(),V=false,k=false,qe.clear(),Ye(),x=requestAnimationFrame(we);},X));return}E||(x=requestAnimationFrame(we));}function W(){cancelAnimationFrame(x),clearTimeout(_e),y=performance.now(),j=0,se=false,V=false,k=false,He=0,be=true,ke=0,qe.clear(),Ye(),x=requestAnimationFrame(we);}let Q=new IntersectionObserver(U=>{U.forEach(K=>{K.isIntersecting&&!(Z&&k)?W():!K.isIntersecting&&!Z&&!k&&(cancelAnimationFrame(x),clearTimeout(_e),be=false);});},{root:q??null,threshold:w,rootMargin:Y}),ie;function ae(){clearTimeout(ie),ie=setTimeout(()=>{B.forEach((U,K)=>{N[K]=Qe(U),U.style.strokeDasharray=`${N[K]}`;});},150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),C>0?setTimeout(()=>Q.observe(e),C):Q.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(_e),Q.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ie);},replay(){He=0,W();},pause(){se||!be||(se=true,j=performance.now()-y,cancelAnimationFrame(x));},resume(){se&&(se=false,be=true,y=performance.now()-j,x=requestAnimationFrame(we));},seek(U){let K=Math.min(1,Math.max(0,U));ke=K,se=true,j=K*a,y=performance.now()-j,cancelAnimationFrame(x),Ne(j);},getProgress(){return ke},refresh(){clearTimeout(ie),B.forEach((U,K)=>{N[K]=Qe(U),U.style.strokeDasharray=`${N[K]}`;});}}}if(ce)return gt(En());Ht();function zt(){if(se||!je)return;let o=performance.now(),a=Ue();if(!Be&&h===false&&a===Rt){bt(a);return}Be=false,Rt=a;let y=m;if(h!==false){let W=o-It,Q=W>0?Math.abs(a-(ot<0?a:ot))/W:0;y=m*Math.max(.2,1+Q*(typeof h=="number"?h:1)*.04);}ot=a,It=o;let j=ye?rt===-1||a>=rt?"forward":"reverse":S;rt=a;let be=c-ge,Ne=true,we=be===0?0:(a-ge)/be;if(isNaN(Ge)||(Ge<=0&&we>0?T?.():Ge>0&&we<=0&&Ce?.(),Ge<1&&we>=1?ue?.():Ge>=1&&we<1&&me?.()),Ge=we,H){let W=Nt(0,ee(a,ge,c,y));ke=W,e.style.setProperty("--scroll-draw-progress",String(W));let Q=j==="reverse"?1-W:W;e.style.clipPath=$e(Q),G?.(W),!V&&ee(a,ge,c,y)>0&&(V=true,p?.()),W>=1&&!k?(k=true,u?.(),He<(_==="infinite"?1/0:_??0)&&(He++,_e=setTimeout(()=>{xe=-1,Me=[],V=false,k=false,Ye();},X))):W<1&&!Z&&(k=false),bt(a);return}if(B.forEach((W,Q)=>{let ie=Q*g*be,ae=Nt(Q,ee(a,ge+ie,c+ie,y));yt(W,Q,ae,j),Q===0&&(ke=ae,G?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),ae<1&&(Ne=false);}),b){let W=J(ee(a,ge,c,y));for(let Q in b){let ie=parseFloat(Q);W>=ie&&!qe.has(ie)&&(qe.add(ie),b[Q]?.());}}!V&&ee(a,ge,c,y)>0&&(V=true,p?.()),Ne&&!k?(k=true,u?.(),He<(_==="infinite"?1/0:_??0)&&(He++,_e=setTimeout(()=>{xe=-1,Me=[],V=false,k=false,qe.clear(),Ye(),Be=true;},X))):!Ne&&!Z&&(k=false),bt(a);}function ht(o){return o>=c&&o<Fe}function bt(o){z||ht(o)?x=requestAnimationFrame(zt):je=false;}function wt(){return z||ht(Ue())}let je=false;function st(){je||(je=true,x=requestAnimationFrame(function(){zt();}));}function it(){je=false,cancelAnimationFrame(x);}let vt=new IntersectionObserver(o=>{o.forEach(a=>{z=a.isIntersecting,z&&!se?(Be=true,st()):je&&!se&&ht(Ue())||it();});},{root:q??null,threshold:w,rootMargin:Y});function _t(){B.forEach((o,a)=>{N[a]=Qe(o),o.style.strokeDasharray=`${N[a]}`;}),Ht(),Be=true;}let at;function Xe(){clearTimeout(at),at=setTimeout(_t,150);}window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe);let Tn=Re([e],Xe);return C>0?setTimeout(()=>vt.observe(e),C):vt.observe(e),gt({destroy(){cancelAnimationFrame(x),clearTimeout(_e),it(),vt.disconnect(),Tn(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(at),kt();},replay(){xe=-1,Me=[],rt=-1,ot=-1,V=false,k=false,He=0,se=false,ke=0,qe.clear(),clearTimeout(_e),Ye(),Be=true,wt()&&st();},pause(){se=true,it();},resume(){se&&(se=false,Be=true,wt()&&st());},seek(o){let a=Math.min(1,Math.max(0,o));ke=a,xe=a,Me=[],se=true,it(),wn(a,S),Be=true;},getProgress(){return ke},refresh(){clearTimeout(at),_t(),wt()&&!se&&st();}},()=>({tStart:ge,tEnd:c}))}var nn=new WeakMap,Vn=0;function rn(e){return JSON.stringify(e,(n,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let r=nn.get(t);return r===void 0&&nn.set(t,r=++Vn),`el#${r}`}return t})}function on(e,n){let t={...e};for(let r of Object.keys(t))typeof t[r]=="function"&&(t[r]=(...s)=>n()[r]?.(...s));return t}function zn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function sn(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let s=[],i=[],l=r[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let f=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}n.push({fn:r[1],nums:s,units:i});}return n}function _n(e,n,t){let r=sn(e),s=sn(n);return r.length===0||r.length!==s.length?t<1?e:n:r.map((i,l)=>{let m=s[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((f,d)=>`${f}${i.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((f,d)=>`${f}${m.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,d)=>`${f+(m.nums[d]-f)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function an(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),s=String(n);if(zn(r))return ct(r,s,t);if(r.includes("("))return _n(r,s,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),f=parseFloat(l[1]);return `${m+(f-m)*t}${i[2]||l[2]}`}return t<1?r:s}function qn(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Bn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Wn=0,ln="--scroll-draw-progress";function Gn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var un={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,n){return typeof window>"u"?un:n.respectReducedMotion===false?cn(e,n,false):We(n,(t,r)=>cn(e,t,r))}function cn(e,n,t){let{props:r,trigger:s={},easing:i="ease-out",speed:l=1,once:m=false,axis:f="y",scrollContainer:d,native:v=true,velocityScale:R=false,triggerElement:S,onProgress:Z,onComplete:re,onEnter:M,onLeave:oe,onEnterBack:ye,onLeaveBack:C}=n,O=typeof i=="function"?i:ne[i]??ne["ease-out"],L=fe(s.start||"top bottom"),A=fe(s.end||"bottom top"),b=S??e,h=typeof d=="string"?document.querySelector(d):d??null,w=Object.entries(r).map(([c,g])=>({prop:qn(c),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function Y(){let c=window.getComputedStyle(e);for(let g of w)g.from===""&&(g.from=c.getPropertyValue(g.prop).trim()||"0");}function _(){for(let c of w)e.style.setProperty(c.prop,String(c.to));}let X=new Map;for(let c of [...w.map(g=>g.prop),ln])X.set(c,e.style.getPropertyValue(c));function I(){for(let[c,g]of X)g?e.style.setProperty(c,g):e.style.removeProperty(c);}if(t)return _(),re?.(),{...un,destroy:I,getProgress:()=>1};Y();let F=()=>h?f==="x"?h.scrollLeft:h.scrollTop:f==="x"?window.scrollX:window.scrollY,ce=()=>h?f==="x"?h.clientWidth:h.clientHeight:f==="x"?window.innerWidth:window.innerHeight,he=typeof i=="string"?ut(i):null;function te(){if(!v||!Gn()||!he||f!=="y"||h||b!==e||m||l!==1||Z||re||M||oe||ye||C||R!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let c of w)if(!Bn.has(c.prop))return false;return true}function G(){let c=`ssd-a-${++Wn}`,g=w.map(z=>`${z.prop}:${z.from}`).join(";"),Fe=w.map(z=>`${z.prop}:${z.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${c}{from{${g}}to{${Fe}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${he};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(c);let V=()=>{let z=e.getBoundingClientRect();return Te({top:z.top,height:z.height},F(),ce(),L,A)};Le(e,{type:"animate",getProgress:()=>x.getProgress(),getTrigger:V});let x={refresh(){},destroy(){e.classList.remove(c),k.remove(),e.style.animationPlayState="",I(),Ae(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(z){let xe=Math.min(1,Math.max(0,z));e.classList.remove(c);for(let Me of w)e.style.setProperty(Me.prop,an(Me.from,Me.to,xe));},getProgress(){let{tStart:z,tEnd:xe}=V();return O(ee(F(),z,xe,l))}};return x}if(te())return G();let p=0,u=0,T=0,ue=false,me=false,Ce=-1,H=0,J=0,P=false,$=NaN,q=-1,ve=0,Se=b===e?w:[],Oe=false;function Pe(){let c=e.style,g=Se.map(x=>c.getPropertyValue(x.prop)),Fe=c.transition;Se.length&&(c.transition="none"),Se.forEach(x=>c.setProperty(x.prop,X.get(x.prop)??""));let k=lt(b,h,f);Se.forEach((x,z)=>c.setProperty(x.prop,g[z])),Se.length&&(e.offsetWidth,c.transition=Fe);let V=Te(k,k.scroll,ce(),L,A);Oe&&Math.abs(V.tStart-p)<1&&Math.abs(V.tEnd-u)<1||(Oe=true,p=V.tStart,u=V.tEnd);}function Ee(c){e.style.setProperty(ln,String(c));for(let g of w)e.style.setProperty(g.prop,an(g.from,g.to,c));Z?.(c);}function ze(c){if(isNaN($)){$=c;return}$<=0&&c>0?M?.():$>0&&c<=0&&C?.(),$<1&&c>=1?oe?.():$>=1&&c<1&&ye?.(),$=c;}function $e(){if(!ue||me)return;let c=performance.now(),g=F(),Fe=l;if(R!==false){let z=c-ve,xe=z>0?Math.abs(g-(q<0?g:q))/z:0;Fe=l*Math.max(.2,1+xe*(typeof R=="number"?R:1)*.04);}q=g,ve=c;let k=u===p?0:(g-p)/(u-p);ze(k);let V=ee(g,p,u,Fe),x=m?Math.max(Ce,O(H=Math.max(H,V))):O(V);J=x,Ee(x),x>=1&&!P?(P=true,re?.()):x<1&&!m&&(P=false),T=requestAnimationFrame($e);}Pe(),u===p&&pe("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),H=ee(F(),p,u,l),J=O(H),Ee(J);let B=new IntersectionObserver(c=>{c.forEach(g=>{ue=g.isIntersecting,ue&&!me?T=requestAnimationFrame($e):cancelAnimationFrame(T);});},{root:h??null}),N;function de(){clearTimeout(N),N=setTimeout(Pe,150);}window.addEventListener("resize",de),window.addEventListener("orientationchange",de);let ge=Re([b],de);return B.observe(e),Le(e,{type:"animate",getProgress:()=>J,getTrigger:()=>({tStart:p,tEnd:u})}),{destroy(){cancelAnimationFrame(T),B.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),ge(),clearTimeout(N),I(),Ae(e);},replay(){Ce=-1,H=0,P=false,J=0,me=false,Ee(0);},pause(){me=true,cancelAnimationFrame(T);},resume(){me&&(me=false,ue&&(T=requestAnimationFrame($e)));},seek(c){let g=Math.min(1,Math.max(0,c));J=g,Ce=g,H=0,me=true,cancelAnimationFrame(T),Ee(g);},getProgress(){return J},refresh(){Pe();}}}var Tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function xt(e,n){if(typeof window>"u")return Tt;let t=typeof e=="string"?document.querySelector(e):e;return t?We(n,(r,s)=>jn(t,r,s)):(pe("scrollCounter: element not found:",e),Tt)}function jn(e,n,t){let{from:r=0,to:s,format:i,easing:l="ease-out",trigger:m={},once:f=true,decimals:d,onComplete:v}=n,R=d!==void 0?p=>p.toFixed(d):i??(p=>String(Math.round(p))),S=typeof l=="function"?l:ne[l]??ne["ease-out"],Z=fe(m.start||"top 80%"),re=fe(m.end||"top 20%");if(t)return e.textContent=R(s),v?.(),{...Tt,getProgress:()=>1};let M=0,oe=0,ye=false,C=0,O=false,L=false,A=-1,b=0,h=0,w=false,Y=()=>window.scrollY,_=()=>window.innerHeight;function X(){let p=e.getBoundingClientRect(),u=Te({top:p.top,height:p.height},Y(),_(),Z,re);ye&&Math.abs(u.tStart-M)<1&&Math.abs(u.tEnd-oe)<1||(ye=true,M=u.tStart,oe=u.tEnd);}function I(p){e.textContent=R(r+(s-r)*p),e.style.setProperty("--scroll-draw-progress",String(p));}function F(){if(!O||L)return;let p=ee(Y(),M,oe,1),u=f?Math.max(A,S(b=Math.max(b,p))):S(p);h=u,I(u),u>=1&&!w?(w=true,v?.()):u<1&&!f&&(w=false),C=requestAnimationFrame(F);}X();{b=ee(Y(),M,oe,1);let p=S(b);h=p,I(p);}let ce=new IntersectionObserver(p=>{p.forEach(u=>{O=u.isIntersecting,O&&!L?C=requestAnimationFrame(F):cancelAnimationFrame(C);});}),he;function te(){clearTimeout(he),he=setTimeout(X,150);}window.addEventListener("resize",te),window.addEventListener("orientationchange",te);let G=Re([e],te);return ce.observe(e),Le(e,{type:"counter",getProgress:()=>h,getTrigger:()=>({tStart:M,tEnd:oe})}),{destroy(){cancelAnimationFrame(C),ce.disconnect(),window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),G(),clearTimeout(he),Ae(e);},replay(){A=-1,b=0,w=false,h=0,L=false,I(0);},pause(){L=true,cancelAnimationFrame(C);},resume(){L&&(L=false,O&&(C=requestAnimationFrame(F)));},seek(p){let u=Math.min(1,Math.max(0,p));h=u,A=u,b=0,L=true,cancelAnimationFrame(C),I(u);},getProgress(){return h}}}var mn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Mt(e,n={}){if(typeof window>"u")return mn;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return pe("scrollVideo: <video> element not found:",e),mn;let r=t,{trigger:s={},easing:i="linear",once:l=false,axis:m="y",preload:f="auto",triggerElement:d,onReady:v,onComplete:R,onProgress:S}=n,Z=d??r,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof i=="function"?i:ne[i]??ne.linear,oe=fe(s.start||"top top"),ye=fe(s.end||"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=f);let C=n.from??0,O=n.to,L=0,A=0,b=0,h=false,w=false,Y=-1,_=0,X=0,I=false,F=false,ce=()=>m==="x"?window.scrollX:window.scrollY,he=()=>m==="x"?window.innerWidth:window.innerHeight;function te(){let P=Z.getBoundingClientRect(),$=m==="x"?P.left:P.top,q=m==="x"?P.width:P.height,ve=Te({top:$,height:q},ce(),he(),oe,ye);L=ve.tStart,A=ve.tEnd,F&&A===L&&pe("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let G=NaN;function p(P){if(!F)return;let $=O??r.duration??0,q=C+($-C)*P;q!==G&&(G=q,r.currentTime=q),r.style.setProperty("--scroll-draw-progress",String(P)),S?.(P);}function u(){if(!h||w||!F||re)return;let P=ee(ce(),L,A,1),$=l?Math.max(Y,M(_=Math.max(_,P))):M(P);X=$,p($),$>=1&&!I?(I=true,R?.()):$<1&&!l&&(I=false),b=requestAnimationFrame(u);}function T(){if(F=true,O===void 0&&(O=r.duration),re){p(1),v?.();return}te(),v?.(),h&&!w&&(b=requestAnimationFrame(u));}r.readyState>=1?T():r.addEventListener("loadedmetadata",T,{once:true}),F||te();let ue=re?()=>{}:pt(P=>{P&&(ue(),re=true,cancelAnimationFrame(b),p(1));}),me=new IntersectionObserver(P=>{P.forEach($=>{h=$.isIntersecting,h&&!w&&F?b=requestAnimationFrame(u):cancelAnimationFrame(b);});}),Ce;function H(){clearTimeout(Ce),Ce=setTimeout(te,150);}window.addEventListener("resize",H),window.addEventListener("orientationchange",H);let J=Re([Z],H);return me.observe(r),Le(r,{type:"video",getProgress:()=>X,getTrigger:()=>({tStart:L,tEnd:A})}),{destroy(){cancelAnimationFrame(b),me.disconnect(),r.removeEventListener("loadedmetadata",T),window.removeEventListener("resize",H),window.removeEventListener("orientationchange",H),J(),ue(),clearTimeout(Ce),Ae(r);},replay(){Y=-1,_=0,I=false,X=0,w=false,G=NaN,p(0);},pause(){w=true,cancelAnimationFrame(b);},resume(){w&&(w=false,h&&F&&(b=requestAnimationFrame(u)));},seek(P){let $=Math.min(1,Math.max(0,P));X=$,Y=$,_=0,w=true,cancelAnimationFrame(b),G=NaN,p($);},getProgress(){return X}}}function fn(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 gn(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(r.textContent=t,r.style.whiteSpace="pre"):(r.textContent=t,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(t)?null:r}).filter(t=>t!==null)}function Qn(e){let n=e.textContent??"";return e.textContent="",n.split("").map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=t,t===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),t===" "?null:r}).filter(t=>t!==null)}function pn(e){let n=gn(e),t=new Map;for(let i of n){let l=i.offsetTop;t.has(l)||t.set(l,[]),t.get(l).push(i);}let r=[],s=Array.from(t.keys()).sort((i,l)=>i-l);for(let i of s){let l=t.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",l.forEach((f,d)=>{let v=f.nextElementSibling;m.appendChild(f),d<l.length-1&&v&&v.style.whiteSpace==="pre"&&m.appendChild(v);}),r.push(m);}return e.textContent="",r.forEach((i,l)=>{e.appendChild(i),l<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Un(e,n,t,r){if(t<=1||r===0)return e;let s=(t-1)*r,i=n*r,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function Yn(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 dn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lt(e,n={}){if(typeof window>"u")return dn;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return pe("scrollText: element not found:",e),dn;let r=t;return We(n,(s,i)=>Xn(r,s,i))}function Xn(e,n,t){let{split:r="words",stagger:s=.04,easing:i="ease-out",from:l={opacity:0,y:24},trigger:m={},once:f=true,onComplete:d}=n,v=typeof i=="function"?i:ne[i]??ne["ease-out"],R=fe(m.start||"top 85%"),S=fe(m.end||"top 40%"),Z=e.innerHTML,re=e.textContent??"",M;r==="chars"?M=Qn(e):r==="lines"?M=pn(e):M=gn(e),fn(e,re);let oe=M.length;function ye(u,T){l?.opacity!==void 0&&(u.style.opacity=String(l.opacity+(1-l.opacity)*T));let ue=Yn(T,l);ue&&(u.style.transform=ue);}function C(u){e.style.setProperty("--scroll-draw-progress",String(u)),M.forEach((T,ue)=>{let me=v(Un(u,ue,oe,s));ye(T,me);});}if(t)return C(1),d?.(),{destroy(){e.innerHTML=Z;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};C(0);let O=0,L=0,A=0,b=false,h=false,w=-1,Y=0,_=false,X=()=>window.scrollY,I=()=>window.innerHeight;function F(){let u=e.getBoundingClientRect(),T=Te({top:u.top,height:u.height},X(),I(),R,S);O=T.tStart,L=T.tEnd;}function ce(){if(!b||h)return;let u=ee(X(),O,L,1);f&&(w=Math.max(w,u),u=w),Y=u,C(u),u>=1&&!_?(_=true,d?.()):u<1&&!f&&(_=false),A=requestAnimationFrame(ce);}F();let he=new IntersectionObserver(u=>{u.forEach(T=>{b=T.isIntersecting,b&&!h?A=requestAnimationFrame(ce):cancelAnimationFrame(A);});}),te;function G(){clearTimeout(te),te=setTimeout(()=>{if(r==="lines"){let u=Y;e.innerHTML=Z,M=pn(e),fn(e,re),C(u);}F();},150);}window.addEventListener("resize",G),window.addEventListener("orientationchange",G);let p=Re([e],G);return he.observe(e),Le(e,{type:"text",getProgress:()=>Y,getTrigger:()=>({tStart:O,tEnd:L})}),{destroy(){cancelAnimationFrame(A),he.disconnect(),window.removeEventListener("resize",G),window.removeEventListener("orientationchange",G),p(),clearTimeout(te),e.innerHTML=Z,Ae(e);},replay(){w=-1,_=false,Y=0,h=false,C(0);},pause(){h=true,cancelAnimationFrame(A);},resume(){h&&(h=false,b&&(A=requestAnimationFrame(ce)));},seek(u){let T=Math.min(1,Math.max(0,u));Y=T,w=T,h=true,cancelAnimationFrame(A),C(T);},getProgress(){return Y}}}var nt=e=>typeof e=="function"?e():vue.unref(e);function De(e,n,t){let r=null,s=n(),i=()=>{r?.destroy(),r=e.value?t(e.value,on(s,()=>s)):null;};vue.onMounted(i),vue.watch(()=>rn(s=n()),i),vue.onUnmounted(()=>{r?.destroy(),r=null;});}function tr(e={}){let n=vue.ref(null);return De(n,()=>nt(e),St),n}var yn={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},nr=[null,Boolean,[Boolean,String],[Boolean,Number]],hn=e=>({type:e,default:void 0}),At=vue.defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(yn).map(([e,n])=>[e,n?hn(nr[n]):null])),setup(e,{slots:n}){let t=vue.ref(null);return De(t,()=>{let r={};for(let s in yn){let i=e[s];i!=null&&(r[s]=i);}return r},St),()=>vue.h("div",{ref:t},n.default?.())}});function rr(e){let n=vue.ref(null);return De(n,()=>nt(e),Et),n}var Ct=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let t=vue.ref(null);return De(t,()=>e.options,Et),()=>vue.h("div",{ref:t},n.default?.())}});function or(e){let n=vue.ref(null);return De(n,()=>nt(e),xt),n}var Ot=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:hn(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let n=vue.ref(null);return De(n,()=>{let t={to:e.to};return e.from!=null&&(t.from=e.from),e.format!=null&&(t.format=e.format),e.easing!=null&&(t.easing=e.easing),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.decimals!=null&&(t.decimals=e.decimals),e.onComplete!=null&&(t.onComplete=e.onComplete),t},xt),()=>vue.h("span",{ref:n})}});function sr(e={}){let n=vue.ref(null);return De(n,()=>nt(e),Mt),n}var Pt=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let n=vue.ref(null);return De(n,()=>e.options??{},Mt),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function ir(e={}){let n=vue.ref(null);return De(n,()=>nt(e),Lt),n}var $t=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let t=vue.ref(null);return De(t,()=>e.options??{},Lt),()=>vue.h(e.tag,{ref:t},n.default?.())}});function To(){return {install(e){e.component("ScrollDraw",At),e.component("ScrollAnimate",Ct),e.component("ScrollCounter",Ot),e.component("ScrollVideo",Pt),e.component("ScrollText",$t);}}}exports.ScrollAnimate=Ct;exports.ScrollCounter=Ot;exports.ScrollDraw=At;exports.ScrollText=$t;exports.ScrollVideo=Pt;exports.createScrollDrawPlugin=To;exports.useScrollAnimate=rr;exports.useScrollCounter=or;exports.useScrollDraw=tr;exports.useScrollText=ir;exports.useScrollVideo=sr;
|
package/dist/nuxt/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,d,f,h,j}from'../chunk-
|
|
1
|
+
import {b,d,f,h,j}from'../chunk-4I7MLTP5.mjs';export{d as ScrollAnimate,f as ScrollCounter,b as ScrollDraw,j as ScrollText,h as ScrollVideo,c as useScrollAnimate,e as useScrollCounter,a as useScrollDraw,i as useScrollText,g as useScrollVideo}from'../chunk-4I7MLTP5.mjs';import'../chunk-XSVTHCLO.mjs';import'../chunk-GMBIGV3M.mjs';import'../chunk-4H2SGMAQ.mjs';import'../chunk-LGJQWZHH.mjs';import'../chunk-V4L3ELVC.mjs';import'../chunk-23EALNDF.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';function s(){return {install(o){o.component("ScrollDraw",b),o.component("ScrollAnimate",d),o.component("ScrollCounter",f),o.component("ScrollVideo",h),o.component("ScrollText",j);}}}export{s as createScrollDrawPlugin};
|
package/dist/progress/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function ee({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),
|
|
1
|
+
'use strict';function ee({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),i=0,m=[];for(let s=0;s<n;s++){let a=Math.pow(o,s);m.push(a),i+=a;}let l=[0],w=0;for(let s=0;s<n;s++)w+=m[s]/i,l.push(w);return s=>{if(s<=0)return 0;if(s>=1)return 1;for(let a=0;a<n;a++)if(s<=l[a+1]){let f=(s-l[a])/(l[a+1]-l[a]);if(a===0)return f*(2-f);let g=1-Math.pow(r,a);return g+(1-g)*(2*f-1)*(2*f-1)}return 1}}function te({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 i=>i<=0?0:i>=1?1:n*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/r)+1}var A={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:ee(),elastic:te()};function V(e,t,n){return Math.min(n,Math.max(t,e))}function O(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function z(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function W(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function D(e,t,n,r){return n===t?0:V((e-t)/(n-t)*r,0,1)}function q(e,t,n,r,o){let i=z(e.top,e.height,t,r.element)-W(r.viewport,n),m=z(e.top,e.height,t,o.element)-W(o.viewport,n);return {tStart:i,tEnd:m}}function N(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}}var B=Symbol.for("svg-scroll-draw.registry");function k(){let e=globalThis;return e[B]||(e[B]=new Map)}function G(e,t){k().set(e,t);}function $(e){k().delete(e);}var E,_=new Set,R=new WeakMap,v=new Map,X=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function ne(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 K(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();E??(E=new ResizeObserver(o=>{let i=false;for(let{target:m}of o)R.get(m)!==X(m)&&(i=true),R.set(m,"");i&&_.forEach(m=>m());})),_.add(n);let r=ne(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{R.has(o)||R.set(o,X(o)),v.set(o,(v.get(o)??0)+1),E.observe(o);}),()=>{_.delete(n)&&(r.forEach(o=>{let i=(v.get(o)??1)-1;if(i)return void v.set(o,i);v.delete(o),E?.unobserve(o);}),_.size||(E?.disconnect(),E=void 0));}}var re=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function Y(e,...t){re&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var j={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function he(e,t={}){if(typeof window>"u")return j;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return Y("scrollProgress: element not found:",e),j;let r=n,{variable:o="--scroll-progress",easedVariable:i="--scroll-progress-eased",trigger:m={},easing:l="linear",speed:w=1,axis:s="y",scrollContainer:a,onProgress:f}=t,g=typeof l=="function"?l:A[l]??A.linear,J=O(m.start||"top bottom"),Q=O(m.end||"bottom top"),p=typeof a=="string"?document.querySelector(a):a??null,x=0,M=0,d=0,S=false,b=false,h=0,C=()=>p?s==="x"?p.scrollLeft:p.scrollTop:s==="x"?window.scrollX:window.scrollY,U=()=>p?s==="x"?p.clientWidth:p.clientHeight:s==="x"?window.innerWidth:window.innerHeight;function T(){let u=N(r,p,s),c=q(u,u.scroll,U(),J,Q);x=c.tStart,M=c.tEnd;}function P(u,c){r.style.setProperty(o,String(u)),i!=null&&r.style.setProperty(i,String(c)),f?.(u,c);}function L(){if(!S||b)return;let u=D(C(),x,M,w),c=g(u);h=u,P(u,c),d=requestAnimationFrame(L);}T();{let u=D(C(),x,M,w),c=g(u);h=u,P(u,c);}let F=new IntersectionObserver(u=>{u.forEach(c=>{S=c.isIntersecting,S&&!b?d=requestAnimationFrame(L):cancelAnimationFrame(d);});},{root:p??null}),I;function y(){clearTimeout(I),I=setTimeout(T,150);}window.addEventListener("resize",y),window.addEventListener("orientationchange",y);let Z=K([r],y);return F.observe(n),G(n,{type:"animate",getProgress:()=>h,getTrigger:()=>({tStart:x,tEnd:M})}),{destroy(){cancelAnimationFrame(d),F.disconnect(),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),Z(),clearTimeout(I),r.style.removeProperty(o),i!=null&&r.style.removeProperty(i),$(n);},replay(){T();},pause(){b=true,cancelAnimationFrame(d);},resume(){b&&(b=false,S&&(d=requestAnimationFrame(L)));},seek(u){let c=Math.min(1,Math.max(0,u)),H=g(c);h=c,b=true,cancelAnimationFrame(d),P(c,H);},getProgress(){return h}}}exports.scrollProgress=he;
|
package/dist/progress/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$2}from'../chunk-
|
|
1
|
+
import {a as a$2}from'../chunk-UPWWULKI.mjs';import {a,b as b$1,d as d$1,c}from'../chunk-A4JCC3QQ.mjs';import {d}from'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$1,b as b$2}from'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var D={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Q(m,H={}){if(typeof window>"u")return D;let i=typeof m=="string"?document.querySelector(m):m;if(!i)return b("scrollProgress: element not found:",m),D;let o=i,{variable:x="--scroll-progress",easedVariable:u="--scroll-progress-eased",trigger:F={},easing:f="linear",speed:A=1,axis:l="y",scrollContainer:w,onProgress:M}=H,y=typeof f=="function"?f:d[f]??d.linear,V=a(F.start||"top bottom"),k=a(F.end||"bottom top"),t=typeof w=="string"?document.querySelector(w):w??null,g=0,d$2=0,n=0,p=false,s=false,a$3=0,I=()=>t?l==="x"?t.scrollLeft:t.scrollTop:l==="x"?window.scrollX:window.scrollY,W=()=>t?l==="x"?t.clientWidth:t.clientHeight:l==="x"?window.innerWidth:window.innerHeight;function b$3(){let e=a$2(o,t,l),r=c(e,e.scroll,W(),V,k);g=r.tStart,d$2=r.tEnd;}function v(e,r){o.style.setProperty(x,String(e)),u!=null&&o.style.setProperty(u,String(r)),M?.(e,r);}function E(){if(!p||s)return;let e=b$1(I(),g,d$2,A),r=y(e);a$3=e,v(e,r),n=requestAnimationFrame(E);}b$3();{let e=b$1(I(),g,d$2,A),r=y(e);a$3=e,v(e,r);}let L=new IntersectionObserver(e=>{e.forEach(r=>{p=r.isIntersecting,p&&!s?n=requestAnimationFrame(E):cancelAnimationFrame(n);});},{root:t??null}),P;function c$1(){clearTimeout(P),P=setTimeout(b$3,150);}window.addEventListener("resize",c$1),window.addEventListener("orientationchange",c$1);let _=d$1([o],c$1);return L.observe(i),a$1(i,{type:"animate",getProgress:()=>a$3,getTrigger:()=>({tStart:g,tEnd:d$2})}),{destroy(){cancelAnimationFrame(n),L.disconnect(),window.removeEventListener("resize",c$1),window.removeEventListener("orientationchange",c$1),_(),clearTimeout(P),o.style.removeProperty(x),u!=null&&o.style.removeProperty(u),b$2(i);},replay(){b$3();},pause(){s=true,cancelAnimationFrame(n);},resume(){s&&(s=false,p&&(n=requestAnimationFrame(E)));},seek(e){let r=Math.min(1,Math.max(0,e)),G=y(r);a$3=r,s=true,cancelAnimationFrame(n),v(r,G);},getProgress(){return a$3}}}export{Q as scrollProgress};
|