svg-scroll-draw 2.16.1 → 2.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -325,6 +325,11 @@ import { ScrollDraw } from 'svg-scroll-draw/vue';
325
325
  </template>
326
326
  ```
327
327
 
328
+ > **Options are live** (from 2.17.0): React and Vue component props, Vue composable options passed as
329
+ > a getter or ref, Solid options passed as an accessor, Svelte action parameters and Angular's
330
+ > `update()` from `ngOnChanges` all rebuild the animation when an option really changes. Equal
331
+ > options — an inline object recreated each render, a new callback — keep the running one.
332
+
328
333
  #### scrollDraw options
329
334
 
330
335
  | Option | Type | Default | Description |
@@ -624,8 +629,8 @@ devtools.highlight('#my-element'); // outline for 2 seconds
624
629
  | Entry | Gzipped |
625
630
  |---|---|
626
631
  | `svg-scroll-draw` (main, every core API) | 10.7 KB |
627
- | `svg-scroll-draw/react` (includes the engine) | 11.8 KB |
628
- | `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 13.2 KB |
632
+ | `svg-scroll-draw/react` (includes the engine) | 12.0 KB |
633
+ | `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 13.4 KB |
629
634
  | `svg-scroll-draw/reveal` | 5.0 KB |
630
635
  | `svg-scroll-draw/text` | 2.8 KB |
631
636
  | `svg-scroll-draw/video` | 2.3 KB |
@@ -1,3 +1,3 @@
1
- 'use strict';function Ut({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),o=0,c=[];for(let p=0;p<n;p++){let T=Math.pow(l,p);c.push(T),o+=T;}let u=[0],m=0;for(let p=0;p<n;p++)m+=c[p]/o,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<n;T++)if(p<=u[T+1]){let z=(p-u[T])/(u[T+1]-u[T]);if(T===0)return z*(2-z);let A=1-Math.pow(t,T);return A+(1-A)*(2*z-1)*(2*z-1)}return 1}}function Yt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-l)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ut(),elastic:Yt()};function dt(e,r,n){return Math.min(n,Math.max(r,e))}function de(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function gt(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function 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 K(e,r,n,t){return n===r?0:dt((e-r)/(n-r)*t,0,1)}function xe(e,r,n,t,l){let o=gt(e.top,e.height,r,t.element)-ht(t.viewport,n),c=gt(e.top,e.height,r,l.element)-ht(l.viewport,n);return {tStart:o,tEnd:c}}function Ze(e,r,n){let t=e.getBoundingClientRect(),l=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:n==="x"?t.left:t.top,height:l,scroll:n==="x"?window.scrollX:window.scrollY}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function yt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Ve(e,r,n){let t=yt(e),l=yt(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}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 Be=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function we(e,...r){Be&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Xt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Qt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",wt=33;function Zt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Kt(e){let r=[];for(let n=0;n<wt;n++){let t=n/(wt-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function Ke(e){switch(e){case "linear":return "linear";case "ease-in":return Xt;case "ease-out":return Qt;case "ease-in-out":return Zt()?Kt(re["ease-in-out"]):null;default:return null}}var vt=Symbol.for("svg-scroll-draw.registry");function Et(){let e=globalThis;return e[vt]||(e[vt]=new Map)}function Le(e,r){Et().set(e,r);}function $e(e){Et().delete(e);}var Jt=0;function er(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function St(e,r){let n="";try{n=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return n||(e.getAttribute(r)??"").trim()}var Tt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function tr(e){if(!Be)return;let r=St(e,"stroke");if(!r||r==="none"){we("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!Tt.has(n)&&!Tt.has(St(e,"fill"))&&we("Element has a fill \u2014 it may obscure the stroke animation.",e);}function rr(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let o=n==="x"?window.scrollX:window.scrollY,c=e-o,u=r-o,m=n==="x";t.innerHTML=`
1
+ 'use strict';function Qt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(l,p);c.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<r;p++)m+=c[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<r;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let M=1-Math.pow(t,T);return M+(1-M)*(2*V-1)*(2*V-1)}return 1}}function Zt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Qt(),elastic:Zt()};function yt(e,n,r){return Math.min(r,Math.max(n,e))}function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function ht(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function bt(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 Z(e,n,r,t){return r===n?0:yt((e-n)/(r-n)*t,0,1)}function xe(e,n,r,t,l){let s=ht(e.top,e.height,n,t.element)-bt(t.viewport,r),c=ht(e.top,e.height,n,l.element)-bt(l.viewport,r);return {tStart:s,tEnd:c}}function Ze(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function ze(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function wt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function qe(e,n,r){let t=wt(e),l=wt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var vt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ge=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function we(e,...n){Ge&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Jt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",er="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Et=33;function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function rr(e){let n=[];for(let r=0;r<Et;r++){let t=r/(Et-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return Jt;case "ease-out":return er;case "ease-in-out":return tr()?rr(re["ease-in-out"]):null;default:return null}}var St=Symbol.for("svg-scroll-draw.registry");function Tt(){let e=globalThis;return e[St]||(e[St]=new Map)}function Le(e,n){Tt().set(e,n);}function $e(e){Tt().delete(e);}var nr=0;function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function xt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Mt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function sr(e){if(!Ge)return;let n=xt(e,"stroke");if(!n||n==="none"){we("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Mt.has(r)&&!Mt.has(xt(e,"fill"))&&we("Element has a fill \u2014 it may obscure the stroke animation.",e);}function ir(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
2
2
  <div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,At=/[MmLlHhVvCcSsQqTtAaZz]/g;function nr(e,r,n){if(!Be)return;let t=(e.match(At)??[]).join("").toUpperCase(),l=(r.match(At)??[]).join("").toUpperCase(),o=(e.match(xt)??[]).length,c=(r.match(xt)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}o!==c&&we(`morphTo: coordinate count differs (${o} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function st(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let c=parseFloat(o),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function Mt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...bt[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:z=0,direction:A="forward",once:ne=false,debug:Pe=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:P,fillOpacity:L,waypoints:w,velocityScale:I=false,threshold:O=0,rootMargin:C="0px",repeat:E=0,repeatDelay:se=0,morphTo:F,clip:oe,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:$,onLeave:S,onEnterBack:N,onLeaveBack:fe}=l,Q=oe===true?"left":typeof oe=="string"?oe:false,Se=typeof p=="function"?p:re[p]??re.linear,Ce=de(T.start??"top bottom"),He=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(P)?P[0]:null,j=Array.isArray(P)?P[1]:typeof P=="number"?P:null,pe=Array.isArray(L)?L[0]:null,Z=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function ke(s){let a=s*100;switch(Q){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(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=Q?[]:Array.from(e.querySelectorAll(c)),k=[],i=[],f=0,ge=0,R=false,V=false,q=0,Ae=false,he=-1,te=-1,U=false,ye=0,Oe=0,De,Je=null;function it(){Je?.destroy(),Je=null;}let Ne=new Set,at=NaN,Re=true,Ge=-1,lt=performance.now(),ze=NaN;function et(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function ct(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ut(){let s=Ze(e,ve,B);return xe(s,s.scroll,ct(),Ce,He)}function mt(){(({tStart:f,tEnd:ge}=ut())),Pe&&Be&&(it(),Je=rr(f,ge,B));}function tt(s,a=ut){Le(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:a});let b=s.destroy;return s.destroy=()=>{b.call(s),$e(e);},s}function Wt(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),Q){let b=a==="reverse"?1-s:s;e.style.clipPath=ke(b);return}_.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${k[ue]*s}`:`${k[ue]*(1-s)}`,m&&(b.style.opacity=a==="reverse"?`${1-s}`:`${s}`),Ee&&le?b.style.stroke=Ve(Ee,le,s):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*s}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Z!==null?b.style.fillOpacity=`${pe+(Z-pe)*s}`:Z!==null&&(b.style.fillOpacity=`${Z}`),F&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",st(i[ue],F,s));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=ke(0);return}_.forEach((s,a)=>{s.style.strokeDasharray=`${k[a]}`,s.style.strokeDashoffset=A==="reverse"?"0":`${k[a]}`,m?s.style.opacity=A==="reverse"?"1":"0":s.style.opacity="",Ee&&(s.style.stroke=Ee),ce!==null&&(s.style.strokeWidth=`${ce}`),pe!==null&&(s.style.fillOpacity=`${pe}`),F&&s.tagName.toLowerCase()==="path"&&i[a]&&s.setAttribute("d",i[a]);});}if(_.forEach(s=>{tr(s);let a=_e(s);k.push(a);let b=s.tagName.toLowerCase()==="path";b?i.push(s.getAttribute("d")??""):i.push(""),F&&(b?nr(i[i.length-1],F,s):we(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=A==="reverse"?`${a}`:"0",m&&(s.style.opacity="1"),le&&(s.style.stroke=le),j!==null&&(s.style.strokeWidth=`${j}`),Z!==null&&(s.style.fillOpacity=`${Z}`),F&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",F)):(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=A==="reverse"?"0":`${a}`,m?s.style.opacity=A==="reverse"?"1":"0":s.style.opacity="",Ee&&(s.style.stroke=Ee),ce!==null&&(s.style.strokeWidth=`${ce}`),pe!==null&&(s.style.fillOpacity=`${pe}`));}),Q){if(o)return e.style.clipPath=ke(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ft=typeof p=="string"?Ke(p):null;function Bt(){return !(ae===false||!er()||!_.length||!ft||Q||B!=="y"||ve||u!==1||z!==0||ne||X||I!==false||F||w||E||G>0||d||x||g||$||S||N||fe||M!=null||P!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Gt(){let s=++Jt,a=`svg-scroll-draw-${s}`,b=`svg-scroll-draw-host-${s}`,ue=`--svg-scroll-draw-${s}`,Fe=A==="reverse"?"0":"var(--ssd-len)",Ie=A==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${Ie};`;m&&(Me+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Me}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ft};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(b);function me(h,Y){h.style.setProperty("--ssd-len",String(k[Y])),h.style.strokeDasharray=`${k[Y]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}_.forEach(me);let y=false,H=-1;function W(){if(H>=0)return H;let h=e.getBoundingClientRect(),{tStart:Y,tEnd:Te}=xe({top:h.top,height:h.height},et(),ct(),Ce,He);return Se(K(et(),Y,Te,u))}return {destroy(){e.classList.remove(b),_.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){y=false,H=-1,_.forEach(me);},pause(){y=true,_.forEach(h=>{h.style.animationPlayState="paused";});},resume(){y&&(y=false,_.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let Y=Math.min(1,Math.max(0,h));H=Y,y=true,_.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=A==="reverse"?`${k[be]*Y}`:`${k[be]*(1-Y)}`,m&&(Te.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return W()},refresh(){_.forEach((h,Y)=>{k[Y]=_e(h),h.style.setProperty("--ssd-len",String(k[Y])),h.style.strokeDasharray=`${k[Y]}`;});}}}if(Bt())return tt(Gt());function jt(){let s=Math.max(1,ee),a=0,b=0,ue=false;function Fe(y){let H=true;if(Q){let W=Math.min(1,Math.max(0,y/s)),h=Se(W);ye=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=ke(A==="reverse"?1-h:h),d?.(h),W<1&&(H=false);}else _.forEach((W,h)=>{let Y=h*z*s,Te=Math.min(1,Math.max(0,(y-Y)/s)),be=Se(Te);W.style.strokeDashoffset=A==="reverse"?`${k[h]*be}`:`${k[h]*(1-be)}`,m&&(W.style.opacity=A==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=Ve(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Z!==null?W.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(W.style.fillOpacity=`${Z}`),F&&W.tagName.toLowerCase()==="path"&&i[h]&&W.setAttribute("d",st(i[h],F,be)),h===0&&(ye=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(H=false);});if(w){let W=Math.min(1,Math.max(0,y/s)),h=Se(W);for(let Y in w){let Te=parseFloat(Y);h>=Te&&!Ne.has(Te)&&(Ne.add(Te),w[Y]?.());}}return H}function Ie(y){if(U)return;let H=y-a;V||(V=true,x?.());let W=Fe(H);if(W&&!R){R=true,Fe(s*(1+Math.max(0,_.length-1)*z)),g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,De=setTimeout(()=>{a=performance.now(),V=false,R=false,Ne.clear(),je(),q=requestAnimationFrame(Ie);},se));return}W||(q=requestAnimationFrame(Ie));}function Me(){cancelAnimationFrame(q),clearTimeout(De),a=performance.now(),b=0,U=false,V=false,R=false,Oe=0,ue=true,ye=0,Ne.clear(),je(),q=requestAnimationFrame(Ie);}let v=new IntersectionObserver(y=>{y.forEach(H=>{H.isIntersecting&&!(ne&&R)?Me():!H.isIntersecting&&!ne&&!R&&(cancelAnimationFrame(q),clearTimeout(De),ue=false);});},{root:ve??null,threshold:O,rootMargin:C}),D;function me(){clearTimeout(D),D=setTimeout(()=>{_.forEach((y,H)=>{k[H]=_e(y),y.style.strokeDasharray=`${k[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(De),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(D);},replay(){Oe=0,Me();},pause(){U||!ue||(U=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(Ie));},seek(y){let H=Math.min(1,Math.max(0,y));ye=H,U=true,b=H*s,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return ye},refresh(){clearTimeout(D),_.forEach((y,H)=>{k[H]=_e(y),y.style.strokeDasharray=`${k[H]}`;});}}}if(ie)return tt(jt());mt();function Ue(){if(!Ae||U)return;let s=performance.now(),a=et();if(!Re&&I===false&&a===at){q=requestAnimationFrame(Ue);return}Re=false,at=a;let b=u;if(I!==false){let v=s-lt,D=v>0?Math.abs(a-(Ge<0?a:Ge))/v:0;b=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}Ge=a,lt=s;let ue=X?te===-1||a>=te?"forward":"reverse":A;te=a;let Fe=ge-f,Ie=true,Me=Fe===0?0:(a-f)/Fe;if(isNaN(ze)||(ze<=0&&Me>0?$?.():ze>0&&Me<=0&&fe?.(),ze<1&&Me>=1?S?.():ze>=1&&Me<1&&N?.()),ze=Me,Q){let v=Se(K(a,f,ge,b));ne&&!X&&(he=Math.max(he,v),v=he),ye=v,e.style.setProperty("--scroll-draw-progress",String(v));let D=ue==="reverse"?1-v:v;e.style.clipPath=ke(D),d?.(v),!V&&K(a,f,ge,b)>0&&(V=true,x?.()),v>=1&&!R?(R=true,g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,De=setTimeout(()=>{he=-1,V=false,R=false,e.style.clipPath=ke(0);},se))):v<1&&!ne&&(R=false),q=requestAnimationFrame(Ue);return}if(_.forEach((v,D)=>{let me=D*z*Fe,y=Se(K(a,f+me,ge+me,b));ne&&!X&&(he=Math.max(he,y),y=he),ye=y,v.style.strokeDashoffset=ue==="reverse"?`${k[D]*y}`:`${k[D]*(1-y)}`,m&&(v.style.opacity=ue==="reverse"?`${1-y}`:`${y}`),Ee&&le?v.style.stroke=Ve(Ee,le,y):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*y}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Z!==null?v.style.fillOpacity=`${pe+(Z-pe)*y}`:Z!==null&&(v.style.fillOpacity=`${Z}`),F&&v.tagName.toLowerCase()==="path"&&i[D]&&v.setAttribute("d",st(i[D],F,y)),D===0&&(d?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Ie=false);}),w){let v=Se(K(a,f,ge,b));for(let D in w){let me=parseFloat(D);v>=me&&!Ne.has(me)&&(Ne.add(me),w[D]?.());}}!V&&K(a,f,ge,b)>0&&(V=true,x?.()),Ie&&!R?(R=true,g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,De=setTimeout(()=>{he=-1,V=false,R=false,Ne.clear(),je(),Re=true;},se))):!Ie&&!ne&&(R=false),q=requestAnimationFrame(Ue);}let rt=false;function Ye(){rt||(rt=true,q=requestAnimationFrame(function(){Ue();}));}function Xe(){rt=false,cancelAnimationFrame(q);}let nt=new IntersectionObserver(s=>{s.forEach(a=>{Ae=a.isIntersecting,Ae&&!U?(Re=true,Ye()):Xe();});},{root:ve??null,threshold:O,rootMargin:C});function pt(){_.forEach((s,a)=>{k[a]=_e(s),s.style.strokeDasharray=`${k[a]}`;}),mt(),Re=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(pt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),G>0?setTimeout(()=>nt.observe(e),G):nt.observe(e),tt({destroy(){cancelAnimationFrame(q),clearTimeout(De),Xe(),nt.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),it();},replay(){he=-1,te=-1,Ge=-1,V=false,R=false,Oe=0,U=false,ye=0,Ne.clear(),clearTimeout(De),je(),Re=true,Ae&&Ye();},pause(){U=true,Xe();},resume(){U&&(U=false,Re=true,Ae&&Ye());},seek(s){let a=Math.min(1,Math.max(0,s));ye=a,he=a,U=true,Xe(),Wt(a,A),Re=true;},getProgress(){return ye},refresh(){clearTimeout(Qe),pt(),Ae&&!U&&Ye();}},()=>({tStart:f,tEnd:ge}))}function sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],o=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}r.push({fn:t[1],nums:l,units:o});}return r}function or(e,r,n){let t=Lt(e),l=Lt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((o,c)=>{let u=l[c];return o.fn!==u.fn||o.nums.length!==u.nums.length?n<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*n}${o.units[p]}`).join(", ")})`}).join(" ")}function $t(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(sr(t))return Ve(t,l,n);if(t.includes("("))return or(t,l,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(o&&c){let u=parseFloat(o[1]),m=parseFloat(c[1]);return `${u+(m-u)*n}${o[2]||c[2]}`}return n<1?t:l}function ir(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ar=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),lr=0,Pt="--scroll-draw-progress";function cr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ct(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:o="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:z=false,respectReducedMotion:A=true,triggerElement:ne,onProgress:Pe,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=r,P=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof o=="function"?o:re[o]??re["ease-out"],w=de(l.start??"top bottom"),I=de(l.end??"bottom top"),O=ne??e,C=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:ir(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function se(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function F(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let oe=new Map;for(let i of [...E.map(f=>f.prop),Pt])oe.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of oe)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(P)return F(),B?.(),{...n,destroy:ie,getProgress:()=>1};se();let ee=typeof o=="string"?Ke(o):null;function ae(){if(!T||!cr()||!ee||m!=="y"||C||O!==e||u||c!==1||Pe||B||J||X||G||M||z!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!ar.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++lr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let V=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},V(),q(),w,I)};Le(e,{type:"animate",getProgress:()=>he.getProgress(),getTrigger:Ae});let he={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let U=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let ye of E)e.style.setProperty(ye.prop,$t(ye.from,ye.to,U));},getProgress(){let{tStart:te,tEnd:U}=Ae();return L(K(V(),te,U,c))}};return he}if(ae())return d();let x=0,g=0,$=0,S=false,N=false,fe=-1,Q=0,Se=false,Ce=NaN,He=-1,ve=0,Ee=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Ze(O,C,m),f=xe(i,i.scroll,le(),w,I);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Pt,String(i));for(let f of E)e.style.setProperty(f.prop,$t(f.from,f.to,i));Pe?.(i);}function pe(i){if(isNaN(Ce)){Ce=i;return}Ce<=0&&i>0?J?.():Ce>0&&i<=0&&M?.(),Ce<1&&i>=1?X?.():Ce>=1&&i<1&&G?.(),Ce=i;}function Z(){if(!S||N)return;let i=performance.now(),f=Ee(),ge=c;if(z!==false){let q=i-ve,Ae=q>0?Math.abs(f-(He<0?f:He))/q:0;ge=c*Math.max(.2,1+Ae*(typeof z=="number"?z:1)*.04);}He=f,ve=i;let R=g===x?0:(f-x)/(g-x);pe(R);let V=L(K(f,x,g,ge));u&&(fe=Math.max(fe,V),V=fe),Q=V,j(V),V>=1&&!Se?(Se=true,B?.()):V<1&&!u&&(Se=false),$=requestAnimationFrame(Z);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(K(Ee(),x,g,c));u&&i>0&&(fe=i),Q=i,j(i);}let ke=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!N?$=requestAnimationFrame(Z):cancelAnimationFrame($);});},{root:C??null}),_;function k(){clearTimeout(_),_=setTimeout(ce,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),ke.observe(e),Le(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),ke.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(_),ie(),$e(e);},replay(){fe=-1,Se=false,Q=0,N=false,j(0);},pause(){N=true,cancelAnimationFrame($);},resume(){N&&(N=false,S&&($=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,N=true,cancelAnimationFrame($),j(f);},getProgress(){return Q}}}var ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kt(e,r){if(typeof window>"u")return ot;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return we("scrollCounter: element not found:",e),ot;let t=n,{from:l=0,to:o,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:z}=r,A=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Pe=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(o),z?.(),ot;let X=0,G=0,M=0,P=false,L=false,w=-1,I=0,O=false,C=()=>window.scrollY,E=()=>window.innerHeight;function se(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},C(),E(),Pe,B);X=x.tStart,G=x.tEnd;}function F(d){t.textContent=A(l+(o-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function oe(){if(!P||L)return;let d=ne(K(C(),X,G,1));p&&(w=Math.max(w,d),d=w),I=d,F(d),d>=1&&!O?(O=true,z?.()):d<1&&!p&&(O=false),M=requestAnimationFrame(oe);}se();{let d=ne(K(C(),X,G,1));p&&d>0&&(w=d),I=d,F(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{P=x.isIntersecting,P&&!L?M=requestAnimationFrame(oe):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(se,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,O=false,I=0,L=false,F(0);},pause(){L=true,cancelAnimationFrame(M);},resume(){L&&(L=false,P&&(M=requestAnimationFrame(oe)));},seek(d){let x=Math.min(1,Math.max(0,d));I=x,w=x,L=true,cancelAnimationFrame(M),F(x);},getProgress(){return I}}}var It={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ot(e,r={}){if(typeof window>"u")return It;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),It;let t=n,{trigger:l={},easing:o="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:z}=r,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof o=="function"?o:re[o]??re.linear,Pe=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=r.from??0,X=r.to,G=0,M=0,P=0,L=false,w=false,I=-1,O=0,C=false,E=false,se=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function oe(){let S=t.getBoundingClientRect(),N=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,Q=xe({top:N,height:fe},se(),F(),Pe,B);G=Q.tStart,M=Q.tEnd;}let ie=NaN;function ee(S){if(!E)return;let N=X??t.duration??0,fe=J+(N-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),z?.(S);}function ae(){if(!L||w||!E||A)return;let S=ne(K(se(),G,M,1));c&&(I=Math.max(I,S),S=I),O=S,ee(S),S>=1&&!C?(C=true,T?.()):S<1&&!c&&(C=false),P=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),A){ee(1),p?.();return}oe(),p?.(),L&&!w&&(P=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||oe();let x=new IntersectionObserver(S=>{S.forEach(N=>{L=N.isIntersecting,L&&!w&&E?P=requestAnimationFrame(ae):cancelAnimationFrame(P);});}),g;function $(){clearTimeout(g),g=setTimeout(oe,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),x.observe(t),Le(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame(P),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(g),$e(t);},replay(){I=-1,C=false,O=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(P);},resume(){w&&(w=false,L&&E&&(P=requestAnimationFrame(ae)));},seek(S){let N=Math.min(1,Math.max(0,S));O=N,I=N,w=true,cancelAnimationFrame(P),ie=NaN,ee(N);},getProgress(){return O}}}function Nt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function ur(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function Ft(e){let r=Nt(e),n=new Map;for(let o of r){let c=o.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(o);}let t=[],l=Array.from(n.keys()).sort((o,c)=>o-c);for(let o of l){let c=n.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((o,c)=>{e.appendChild(o),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function mr(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,o=r*t,c=o+(1-l);return c<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(c-o)))}function fr(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var Dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Rt(e,r={}){if(typeof window>"u")return Dt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return we("scrollText: element not found:",e),Dt;let t=n,{split:l="words",stagger:o=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=r,z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Pe=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=ur(t):l==="lines"?J=Ft(t):J=Nt(t);let X=J.length;function G(g,$){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*$));let S=fr($,u);S&&(g.style.transform=S);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach(($,S)=>{let N=A(mr(g,S,X,o));G($,N);});}if(z)return M(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let P=0,L=0,w=0,I=false,O=false,C=-1,E=0,se=false,F=()=>window.scrollY,oe=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=xe({top:g.top,height:g.height},F(),oe(),ne,Pe);P=$.tStart,L=$.tEnd;}function ee(){if(!I||O)return;let g=K(F(),P,L,1);p&&(C=Math.max(C,g),g=C),E=g,M(g),g>=1&&!se?(se=true,T?.()):g<1&&!p&&(se=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach($=>{I=$.isIntersecting,I&&!O?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Ft(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:P,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){C=-1,se=false,E=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,I&&(w=requestAnimationFrame(ee)));},seek(g){let $=Math.min(1,Math.max(0,g));E=$,C=$,O=true,cancelAnimationFrame(w),M($);},getProgress(){return E}}}var Ht=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=Mt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},zt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=Ct(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},_t=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=kt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Vt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=Ot(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},qt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=Rt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};exports.ScrollAnimateRef=zt;exports.ScrollCounterRef=_t;exports.ScrollDrawRef=Ht;exports.ScrollTextRef=qt;exports.ScrollVideoRef=Vt;
3
+ <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var At=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Lt=/[MmLlHhVvCcSsQqTtAaZz]/g;function ar(e,n,r){if(!Ge)return;let t=(e.match(Lt)??[]).join("").toUpperCase(),l=(n.match(Lt)??[]).join("").toUpperCase(),s=(e.match(At)??[]).length,c=(n.match(At)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function st(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function $t(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...vt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:M="forward",once:ne=false,debug:Pe=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:A,strokeWidth:P,fillOpacity:L,waypoints:w,velocityScale:O=false,threshold:I=0,rootMargin:C="0px",repeat:E=0,repeatDelay:oe=0,morphTo:F,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:$,onLeave:S,onEnterBack:N,onLeaveBack:fe}=l,K=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,Ce=de(T.start??"top bottom"),Ve=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(A)?A[0]:null,le=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ce=Array.isArray(P)?P[0]:null,j=Array.isArray(P)?P[1]:typeof P=="number"?P:null,pe=Array.isArray(L)?L[0]:null,Q=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function ke(o){let a=o*100;switch(K){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 _=K?[]:Array.from(e.querySelectorAll(c)),k=[],i=[],f=0,ge=0,R=false,z=false,q=0,Me=false,ye=-1,te=-1,U=false,he=0,Ie=0,De,et=null;function lt(){et?.destroy(),et=null;}let Ne=new Set,ct=NaN,Re=true,je=-1,ut=performance.now(),_e=NaN;function tt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function mt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ft(){let o=Ze(e,ve,B);return xe(o,o.scroll,mt(),Ce,Ve)}function pt(){(({tStart:f,tEnd:ge}=ft())),Pe&&Ge&&(lt(),et=ir(f,ge,B));}function rt(o,a=ft){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Ut(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let b=a==="reverse"?1-o:o;e.style.clipPath=ke(b);return}_.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${k[ue]*o}`:`${k[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=qe(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),F&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",st(i[ue],F,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=ke(0);return}_.forEach((o,a)=>{o.style.strokeDasharray=`${k[a]}`,o.style.strokeDashoffset=M==="reverse"?"0":`${k[a]}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),F&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(_.forEach(o=>{sr(o);let a=ze(o);k.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),F&&(b?ar(i[i.length-1],F,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=M==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Q!==null&&(o.style.fillOpacity=`${Q}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=M==="reverse"?"0":`${a}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),K){if(s)return e.style.clipPath=ke(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let dt=typeof p=="string"?Je(p):null;function Yt(){return !(ae===false||!or()||!_.length||!dt||K||B!=="y"||ve||u!==1||V!==0||ne||X||O!==false||F||w||E||G>0||d||x||g||$||S||N||fe||A!=null||P!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Xt(){let o=++nr,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Fe=M==="reverse"?"0":"var(--ssd-len)",Oe=M==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${Oe};`;m&&(Ae+=`opacity:${M==="reverse"?1:0};`,v+=`opacity:${M==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${dt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}_.forEach(me);let h=false,H=-1;function W(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Te}=xe({top:y.top,height:y.height},tt(),mt(),Ce,Ve);return Se(Z(tt(),Y,Te,u))}return {destroy(){e.classList.remove(b),_.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),D.remove();},replay(){h=false,H=-1,_.forEach(me);},pause(){h=true,_.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,_.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));H=Y,h=true,_.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=M==="reverse"?`${k[be]*Y}`:`${k[be]*(1-Y)}`,m&&(Te.style.opacity=M==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return W()},refresh(){_.forEach((y,Y)=>{k[Y]=ze(y),y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`;});}}}if(Yt())return rt(Xt());function Kt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Fe(h){let H=true;if(K){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=ke(M==="reverse"?1-y:y),d?.(y),W<1&&(H=false);}else _.forEach((W,y)=>{let Y=y*V*o,Te=Math.min(1,Math.max(0,(h-Y)/o)),be=Se(Te);W.style.strokeDashoffset=M==="reverse"?`${k[y]*be}`:`${k[y]*(1-be)}`,m&&(W.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=qe(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Q!==null?W.style.fillOpacity=`${pe+(Q-pe)*be}`:Q!==null&&(W.style.fillOpacity=`${Q}`),F&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",st(i[y],F,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(H=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);for(let Y in w){let Te=parseFloat(Y);y>=Te&&!Ne.has(Te)&&(Ne.add(Te),w[Y]?.());}}return H}function Oe(h){if(U)return;let H=h-a;z||(z=true,x?.());let W=Fe(H);if(W&&!R){R=true,Fe(o*(1+Math.max(0,_.length-1)*V)),g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,De=setTimeout(()=>{a=performance.now(),z=false,R=false,Ne.clear(),Ue(),q=requestAnimationFrame(Oe);},oe));return}W||(q=requestAnimationFrame(Oe));}function Ae(){cancelAnimationFrame(q),clearTimeout(De),a=performance.now(),b=0,U=false,z=false,R=false,Ie=0,ue=true,he=0,Ne.clear(),Ue(),q=requestAnimationFrame(Oe);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(ne&&R)?Ae():!H.isIntersecting&&!ne&&!R&&(cancelAnimationFrame(q),clearTimeout(De),ue=false);});},{root:ve??null,threshold:I,rootMargin:C}),D;function me(){clearTimeout(D),D=setTimeout(()=>{_.forEach((h,H)=>{k[H]=ze(h),h.style.strokeDasharray=`${k[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(De),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(D);},replay(){Ie=0,Ae();},pause(){U||!ue||(U=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(Oe));},seek(h){let H=Math.min(1,Math.max(0,h));he=H,U=true,b=H*o,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return he},refresh(){clearTimeout(D),_.forEach((h,H)=>{k[H]=ze(h),h.style.strokeDasharray=`${k[H]}`;});}}}if(ie)return rt(Kt());pt();function Ye(){if(!Me||U)return;let o=performance.now(),a=tt();if(!Re&&O===false&&a===ct){q=requestAnimationFrame(Ye);return}Re=false,ct=a;let b=u;if(O!==false){let v=o-ut,D=v>0?Math.abs(a-(je<0?a:je))/v:0;b=u*Math.max(.2,1+D*(typeof O=="number"?O:1)*.04);}je=a,ut=o;let ue=X?te===-1||a>=te?"forward":"reverse":M;te=a;let Fe=ge-f,Oe=true,Ae=Fe===0?0:(a-f)/Fe;if(isNaN(_e)||(_e<=0&&Ae>0?$?.():_e>0&&Ae<=0&&fe?.(),_e<1&&Ae>=1?S?.():_e>=1&&Ae<1&&N?.()),_e=Ae,K){let v=Se(Z(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let D=ue==="reverse"?1-v:v;e.style.clipPath=ke(D),d?.(v),!z&&Z(a,f,ge,b)>0&&(z=true,x?.()),v>=1&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,De=setTimeout(()=>{ye=-1,z=false,R=false,e.style.clipPath=ke(0);},oe))):v<1&&!ne&&(R=false),q=requestAnimationFrame(Ye);return}if(_.forEach((v,D)=>{let me=D*V*Fe,h=Se(Z(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${k[D]*h}`:`${k[D]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=qe(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),F&&v.tagName.toLowerCase()==="path"&&i[D]&&v.setAttribute("d",st(i[D],F,h)),D===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Oe=false);}),w){let v=Se(Z(a,f,ge,b));for(let D in w){let me=parseFloat(D);v>=me&&!Ne.has(me)&&(Ne.add(me),w[D]?.());}}!z&&Z(a,f,ge,b)>0&&(z=true,x?.()),Oe&&!R?(R=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,De=setTimeout(()=>{ye=-1,z=false,R=false,Ne.clear(),Ue(),Re=true;},oe))):!Oe&&!ne&&(R=false),q=requestAnimationFrame(Ye);}let nt=false;function Xe(){nt||(nt=true,q=requestAnimationFrame(function(){Ye();}));}function Ke(){nt=false,cancelAnimationFrame(q);}let ot=new IntersectionObserver(o=>{o.forEach(a=>{Me=a.isIntersecting,Me&&!U?(Re=true,Xe()):Ke();});},{root:ve??null,threshold:I,rootMargin:C});function gt(){_.forEach((o,a)=>{k[a]=ze(o),o.style.strokeDasharray=`${k[a]}`;}),pt(),Re=true;}let Qe;function We(){clearTimeout(Qe),Qe=setTimeout(gt,150);}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Be;return typeof ResizeObserver<"u"&&(Be=new ResizeObserver(()=>We()),Be.observe(document.body),Be.observe(document.documentElement),Be.observe(e)),G>0?setTimeout(()=>ot.observe(e),G):ot.observe(e),rt({destroy(){cancelAnimationFrame(q),clearTimeout(De),Ke(),ot.disconnect(),Be?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Qe),lt();},replay(){ye=-1,te=-1,je=-1,z=false,R=false,Ie=0,U=false,he=0,Ne.clear(),clearTimeout(De),Ue(),Re=true,Me&&Xe();},pause(){U=true,Ke();},resume(){U&&(U=false,Re=true,Me&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,U=true,Ke(),Ut(a,M),Re=true;},getProgress(){return he},refresh(){clearTimeout(Qe),gt(),Me&&!U&&Xe();}},()=>({tStart:f,tEnd:ge}))}var Pt=new WeakMap,lr=0;function it(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Pt.get(r);return t===void 0&&Pt.set(r,t=++lr),`el#${t}`}return r})}function Ct(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...l)=>n()[t]?.(...l));return r}function cr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function kt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function ur(e,n,r){let t=kt(e),l=kt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function Ot(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(cr(t))return qe(t,l,r);if(t.includes("("))return ur(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function mr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var fr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),pr=0,It="--scroll-draw-progress";function dr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ft(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:M=true,triggerElement:ne,onProgress:Pe,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:A}=n,P=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),O=de(l.end??"bottom top"),I=ne??e,C=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:mr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function F(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),It])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(P)return F(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?Je(s):null;function ae(){if(!T||!dr()||!ee||m!=="y"||C||I!==e||u||c!==1||Pe||B||J||X||G||A||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!fr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++pr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},z(),q(),w,O)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let U=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of E)e.style.setProperty(he.prop,Ot(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Me();return L(Z(z(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,$=0,S=false,N=false,fe=-1,K=0,Se=false,Ce=NaN,Ve=-1,ve=0,Ee=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Ze(I,C,m),f=xe(i,i.scroll,le(),w,O);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(It,String(i));for(let f of E)e.style.setProperty(f.prop,Ot(f.from,f.to,i));Pe?.(i);}function pe(i){if(isNaN(Ce)){Ce=i;return}Ce<=0&&i>0?J?.():Ce>0&&i<=0&&A?.(),Ce<1&&i>=1?X?.():Ce>=1&&i<1&&G?.(),Ce=i;}function Q(){if(!S||N)return;let i=performance.now(),f=Ee(),ge=c;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(Ve<0?f:Ve))/q:0;ge=c*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}Ve=f,ve=i;let R=g===x?0:(f-x)/(g-x);pe(R);let z=L(Z(f,x,g,ge));u&&(fe=Math.max(fe,z),z=fe),K=z,j(z),z>=1&&!Se?(Se=true,B?.()):z<1&&!u&&(Se=false),$=requestAnimationFrame(Q);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(Ee(),x,g,c));u&&i>0&&(fe=i),K=i,j(i);}let ke=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!N?$=requestAnimationFrame(Q):cancelAnimationFrame($);});},{root:C??null}),_;function k(){clearTimeout(_),_=setTimeout(ce,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),ke.observe(e),Le(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),ke.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(_),ie(),$e(e);},replay(){fe=-1,Se=false,K=0,N=false,j(0);},pause(){N=true,cancelAnimationFrame($);},resume(){N&&(N=false,S&&($=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));K=f,fe=f,N=true,cancelAnimationFrame($),j(f);},getProgress(){return K}}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Dt(e,n){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),at;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,M=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Pe=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(s),V?.(),at;let X=0,G=0,A=0,P=false,L=false,w=-1,O=0,I=false,C=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},C(),E(),Pe,B);X=x.tStart,G=x.tEnd;}function F(d){t.textContent=M(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!P||L)return;let d=ne(Z(C(),X,G,1));p&&(w=Math.max(w,d),d=w),O=d,F(d),d>=1&&!I?(I=true,V?.()):d<1&&!p&&(I=false),A=requestAnimationFrame(se);}oe();{let d=ne(Z(C(),X,G,1));p&&d>0&&(w=d),O=d,F(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{P=x.isIntersecting,P&&!L?A=requestAnimationFrame(se):cancelAnimationFrame(A);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(A),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,I=false,O=0,L=false,F(0);},pause(){L=true,cancelAnimationFrame(A);},resume(){L&&(L=false,P&&(A=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));O=x,w=x,L=true,cancelAnimationFrame(A),F(x);},getProgress(){return O}}}var Nt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Rt(e,n={}){if(typeof window>"u")return Nt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Nt;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Pe=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,A=0,P=0,L=false,w=false,O=-1,I=0,C=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),N=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,K=xe({top:N,height:fe},oe(),F(),Pe,B);G=K.tStart,A=K.tEnd;}let ie=NaN;function ee(S){if(!E)return;let N=X??t.duration??0,fe=J+(N-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!L||w||!E||M)return;let S=ne(Z(oe(),G,A,1));c&&(O=Math.max(O,S),S=O),I=S,ee(S),S>=1&&!C?(C=true,T?.()):S<1&&!c&&(C=false),P=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),M){ee(1),p?.();return}se(),p?.(),L&&!w&&(P=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(N=>{L=N.isIntersecting,L&&!w&&E?P=requestAnimationFrame(ae):cancelAnimationFrame(P);});}),g;function $(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),x.observe(t),Le(t,{type:"video",getProgress:()=>I,getTrigger:()=>({tStart:G,tEnd:A})}),{destroy(){cancelAnimationFrame(P),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(g),$e(t);},replay(){O=-1,C=false,I=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(P);},resume(){w&&(w=false,L&&E&&(P=requestAnimationFrame(ae)));},seek(S){let N=Math.min(1,Math.max(0,S));I=N,O=N,w=true,cancelAnimationFrame(P),ie=NaN,ee(N);},getProgress(){return I}}}function _t(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function gr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Ht(e){let n=_t(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function yr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function hr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function zt(e,n={}){if(typeof window>"u")return Vt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Vt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Pe=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=gr(t):l==="lines"?J=Ht(t):J=_t(t);let X=J.length;function G(g,$){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*$));let S=hr($,u);S&&(g.style.transform=S);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach(($,S)=>{let N=M(yr(g,S,X,s));G($,N);});}if(V)return A(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let P=0,L=0,w=0,O=false,I=false,C=-1,E=0,oe=false,F=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=xe({top:g.top,height:g.height},F(),se(),ne,Pe);P=$.tStart,L=$.tEnd;}function ee(){if(!O||I)return;let g=Z(F(),P,L,1);p&&(C=Math.max(C,g),g=C),E=g,A(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach($=>{O=$.isIntersecting,O&&!I?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Ht(t),A(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:P,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){C=-1,oe=false,E=0,I=false,A(0);},pause(){I=true,cancelAnimationFrame(w);},resume(){I&&(I=false,O&&(w=requestAnimationFrame(ee)));},seek(g){let $=Math.min(1,Math.max(0,g));E=$,C=$,I=true,cancelAnimationFrame(w),A($);},getProgress(){return E}}}var He=class{constructor(n){this.create=n;this.instance=null;this.el=null;this.key="";}init(n,r){return this.destroy(),this.el=n,this.latest=r,this.key=it(r),this.instance=this.create(n,Ct(r,()=>this.latest)),this}update(n){return this.el?it(n)!==this.key?this.init(this.el,n):(this.latest=n,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(n){return this.instance?.seek(n),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},qt=class extends He{constructor(){super($t);}init(n,r={}){return super.init(n,r)}},Wt=class extends He{constructor(){super(Ft);}},Bt=class extends He{constructor(){super(Dt);}},Gt=class extends He{constructor(){super(Rt);}init(n,r={}){return super.init(n,r)}},jt=class extends He{constructor(){super(zt);}init(n,r={}){return super.init(n,r)}};exports.EngineRef=He;exports.ScrollAnimateRef=Wt;exports.ScrollCounterRef=Bt;exports.ScrollDrawRef=qt;exports.ScrollTextRef=jt;exports.ScrollVideoRef=Gt;
@@ -1,38 +1,60 @@
1
- import { a as ScrollDrawOptions } from '../types-DHU1zNEw.mjs';
2
- export { S as ScrollDrawInstance } from '../types-DHU1zNEw.mjs';
1
+ import { S as ScrollDrawInstance, a as ScrollDrawOptions } from '../types-DHU1zNEw.mjs';
3
2
  import { S as ScrollAnimateOptions } from '../engine-Ci08nM91.mjs';
4
3
  import { S as ScrollCounterOptions } from '../index-BDGQEK6X.mjs';
5
4
  import { ScrollVideoOptions } from '../video/index.mjs';
6
5
  import { ScrollTextOptions } from '../text/index.mjs';
7
6
 
7
+ /**
8
+ * What every Ref class shares. `init()` starts the engine; `update()` is for
9
+ * `ngOnChanges`: it rebuilds the engine when an option really changed and does
10
+ * nothing for an equal object, so binding it to every change is safe. Callbacks
11
+ * are read live, so a new function alone never rebuilds. Exported for typing;
12
+ * use the five Ref classes below.
13
+ */
14
+ declare class EngineRef<E extends Element, O extends object> {
15
+ private readonly create;
16
+ private instance;
17
+ private el;
18
+ private key;
19
+ private latest;
20
+ constructor(create: (el: E, options: O) => ScrollDrawInstance);
21
+ init(element: E, options: O): this;
22
+ /** Call from `ngOnChanges` with the current options. A no-op before `init()`. */
23
+ update(options: O): this;
24
+ replay(): this;
25
+ pause(): this;
26
+ resume(): this;
27
+ seek(p: number): this;
28
+ getProgress(): number;
29
+ destroy(): this;
30
+ }
8
31
  /**
9
32
  * Framework-agnostic class for use in Angular components.
10
33
  * No @angular/core dependency required.
11
34
  *
12
35
  * @example
13
36
  * @Component({ template: '<div #container><svg>...</svg></div>' })
14
- * export class HeroComponent implements AfterViewInit, OnDestroy {
37
+ * export class HeroComponent implements AfterViewInit, OnChanges, OnDestroy {
15
38
  * @ViewChild('container') containerRef!: ElementRef<HTMLElement>;
16
39
  * private draw = new ScrollDrawRef();
17
40
  *
41
+ * @Input() speed = 1.2;
42
+ *
18
43
  * ngAfterViewInit() {
19
- * this.draw.init(this.containerRef.nativeElement, {
20
- * easing: 'ease-out', speed: 1.2, fade: true,
21
- * });
44
+ * this.draw.init(this.containerRef.nativeElement, this.options());
22
45
  * }
23
46
  *
47
+ * // Rebuilds only when an option really changed.
48
+ * ngOnChanges() { this.draw.update(this.options()); }
49
+ *
24
50
  * ngOnDestroy() { this.draw.destroy(); }
51
+ *
52
+ * private options() { return { easing: 'ease-out', speed: this.speed, fade: true }; }
25
53
  * }
26
54
  */
27
- declare class ScrollDrawRef {
28
- private instance;
55
+ declare class ScrollDrawRef extends EngineRef<HTMLElement, ScrollDrawOptions> {
56
+ constructor();
29
57
  init(element: HTMLElement, options?: ScrollDrawOptions): this;
30
- replay(): this;
31
- pause(): this;
32
- resume(): this;
33
- seek(p: number): this;
34
- getProgress(): number;
35
- destroy(): this;
36
58
  }
37
59
  /**
38
60
  * Animate any CSS property on any element driven by scroll — Angular class-based API.
@@ -54,15 +76,8 @@ declare class ScrollDrawRef {
54
76
  * ngOnDestroy() { this.animate.destroy(); }
55
77
  * }
56
78
  */
57
- declare class ScrollAnimateRef {
58
- private instance;
59
- init(element: HTMLElement, options: ScrollAnimateOptions): this;
60
- replay(): this;
61
- pause(): this;
62
- resume(): this;
63
- seek(p: number): this;
64
- getProgress(): number;
65
- destroy(): this;
79
+ declare class ScrollAnimateRef extends EngineRef<HTMLElement, ScrollAnimateOptions> {
80
+ constructor();
66
81
  }
67
82
  /**
68
83
  * Animate a number from `from` to `to` as the element scrolls into view — Angular class-based API.
@@ -84,15 +99,8 @@ declare class ScrollAnimateRef {
84
99
  * ngOnDestroy() { this.counter.destroy(); }
85
100
  * }
86
101
  */
87
- declare class ScrollCounterRef {
88
- private instance;
89
- init(element: HTMLElement, options: ScrollCounterOptions): this;
90
- replay(): this;
91
- pause(): this;
92
- resume(): this;
93
- seek(p: number): this;
94
- getProgress(): number;
95
- destroy(): this;
102
+ declare class ScrollCounterRef extends EngineRef<HTMLElement, ScrollCounterOptions> {
103
+ constructor();
96
104
  }
97
105
  /**
98
106
  * Tie a <video> element's currentTime to scroll — Angular class-based API.
@@ -112,15 +120,9 @@ declare class ScrollCounterRef {
112
120
  * ngOnDestroy() { this.video.destroy(); }
113
121
  * }
114
122
  */
115
- declare class ScrollVideoRef {
116
- private instance;
123
+ declare class ScrollVideoRef extends EngineRef<HTMLVideoElement, ScrollVideoOptions> {
124
+ constructor();
117
125
  init(element: HTMLVideoElement, options?: ScrollVideoOptions): this;
118
- replay(): this;
119
- pause(): this;
120
- resume(): this;
121
- seek(p: number): this;
122
- getProgress(): number;
123
- destroy(): this;
124
126
  }
125
127
  /**
126
128
  * Split text and stagger-animate each piece on scroll — Angular class-based API.
@@ -143,15 +145,9 @@ declare class ScrollVideoRef {
143
145
  * ngOnDestroy() { this.text.destroy(); }
144
146
  * }
145
147
  */
146
- declare class ScrollTextRef {
147
- private instance;
148
+ declare class ScrollTextRef extends EngineRef<HTMLElement, ScrollTextOptions> {
149
+ constructor();
148
150
  init(element: HTMLElement, options?: ScrollTextOptions): this;
149
- replay(): this;
150
- pause(): this;
151
- resume(): this;
152
- seek(p: number): this;
153
- getProgress(): number;
154
- destroy(): this;
155
151
  }
156
152
 
157
- export { ScrollAnimateOptions, ScrollAnimateRef, ScrollCounterOptions, ScrollCounterRef, ScrollDrawOptions, ScrollDrawRef, ScrollTextOptions, ScrollTextRef, ScrollVideoOptions, ScrollVideoRef };
153
+ export { EngineRef, ScrollAnimateOptions, ScrollAnimateRef, ScrollCounterOptions, ScrollCounterRef, ScrollDrawInstance, ScrollDrawOptions, ScrollDrawRef, ScrollTextOptions, ScrollTextRef, ScrollVideoOptions, ScrollVideoRef };
@@ -1,38 +1,60 @@
1
- import { a as ScrollDrawOptions } from '../types-DHU1zNEw.js';
2
- export { S as ScrollDrawInstance } from '../types-DHU1zNEw.js';
1
+ import { S as ScrollDrawInstance, a as ScrollDrawOptions } from '../types-DHU1zNEw.js';
3
2
  import { S as ScrollAnimateOptions } from '../engine-6AXEX8CL.js';
4
3
  import { S as ScrollCounterOptions } from '../index-DxjUOIbK.js';
5
4
  import { ScrollVideoOptions } from '../video/index.js';
6
5
  import { ScrollTextOptions } from '../text/index.js';
7
6
 
7
+ /**
8
+ * What every Ref class shares. `init()` starts the engine; `update()` is for
9
+ * `ngOnChanges`: it rebuilds the engine when an option really changed and does
10
+ * nothing for an equal object, so binding it to every change is safe. Callbacks
11
+ * are read live, so a new function alone never rebuilds. Exported for typing;
12
+ * use the five Ref classes below.
13
+ */
14
+ declare class EngineRef<E extends Element, O extends object> {
15
+ private readonly create;
16
+ private instance;
17
+ private el;
18
+ private key;
19
+ private latest;
20
+ constructor(create: (el: E, options: O) => ScrollDrawInstance);
21
+ init(element: E, options: O): this;
22
+ /** Call from `ngOnChanges` with the current options. A no-op before `init()`. */
23
+ update(options: O): this;
24
+ replay(): this;
25
+ pause(): this;
26
+ resume(): this;
27
+ seek(p: number): this;
28
+ getProgress(): number;
29
+ destroy(): this;
30
+ }
8
31
  /**
9
32
  * Framework-agnostic class for use in Angular components.
10
33
  * No @angular/core dependency required.
11
34
  *
12
35
  * @example
13
36
  * @Component({ template: '<div #container><svg>...</svg></div>' })
14
- * export class HeroComponent implements AfterViewInit, OnDestroy {
37
+ * export class HeroComponent implements AfterViewInit, OnChanges, OnDestroy {
15
38
  * @ViewChild('container') containerRef!: ElementRef<HTMLElement>;
16
39
  * private draw = new ScrollDrawRef();
17
40
  *
41
+ * @Input() speed = 1.2;
42
+ *
18
43
  * ngAfterViewInit() {
19
- * this.draw.init(this.containerRef.nativeElement, {
20
- * easing: 'ease-out', speed: 1.2, fade: true,
21
- * });
44
+ * this.draw.init(this.containerRef.nativeElement, this.options());
22
45
  * }
23
46
  *
47
+ * // Rebuilds only when an option really changed.
48
+ * ngOnChanges() { this.draw.update(this.options()); }
49
+ *
24
50
  * ngOnDestroy() { this.draw.destroy(); }
51
+ *
52
+ * private options() { return { easing: 'ease-out', speed: this.speed, fade: true }; }
25
53
  * }
26
54
  */
27
- declare class ScrollDrawRef {
28
- private instance;
55
+ declare class ScrollDrawRef extends EngineRef<HTMLElement, ScrollDrawOptions> {
56
+ constructor();
29
57
  init(element: HTMLElement, options?: ScrollDrawOptions): this;
30
- replay(): this;
31
- pause(): this;
32
- resume(): this;
33
- seek(p: number): this;
34
- getProgress(): number;
35
- destroy(): this;
36
58
  }
37
59
  /**
38
60
  * Animate any CSS property on any element driven by scroll — Angular class-based API.
@@ -54,15 +76,8 @@ declare class ScrollDrawRef {
54
76
  * ngOnDestroy() { this.animate.destroy(); }
55
77
  * }
56
78
  */
57
- declare class ScrollAnimateRef {
58
- private instance;
59
- init(element: HTMLElement, options: ScrollAnimateOptions): this;
60
- replay(): this;
61
- pause(): this;
62
- resume(): this;
63
- seek(p: number): this;
64
- getProgress(): number;
65
- destroy(): this;
79
+ declare class ScrollAnimateRef extends EngineRef<HTMLElement, ScrollAnimateOptions> {
80
+ constructor();
66
81
  }
67
82
  /**
68
83
  * Animate a number from `from` to `to` as the element scrolls into view — Angular class-based API.
@@ -84,15 +99,8 @@ declare class ScrollAnimateRef {
84
99
  * ngOnDestroy() { this.counter.destroy(); }
85
100
  * }
86
101
  */
87
- declare class ScrollCounterRef {
88
- private instance;
89
- init(element: HTMLElement, options: ScrollCounterOptions): this;
90
- replay(): this;
91
- pause(): this;
92
- resume(): this;
93
- seek(p: number): this;
94
- getProgress(): number;
95
- destroy(): this;
102
+ declare class ScrollCounterRef extends EngineRef<HTMLElement, ScrollCounterOptions> {
103
+ constructor();
96
104
  }
97
105
  /**
98
106
  * Tie a <video> element's currentTime to scroll — Angular class-based API.
@@ -112,15 +120,9 @@ declare class ScrollCounterRef {
112
120
  * ngOnDestroy() { this.video.destroy(); }
113
121
  * }
114
122
  */
115
- declare class ScrollVideoRef {
116
- private instance;
123
+ declare class ScrollVideoRef extends EngineRef<HTMLVideoElement, ScrollVideoOptions> {
124
+ constructor();
117
125
  init(element: HTMLVideoElement, options?: ScrollVideoOptions): this;
118
- replay(): this;
119
- pause(): this;
120
- resume(): this;
121
- seek(p: number): this;
122
- getProgress(): number;
123
- destroy(): this;
124
126
  }
125
127
  /**
126
128
  * Split text and stagger-animate each piece on scroll — Angular class-based API.
@@ -143,15 +145,9 @@ declare class ScrollVideoRef {
143
145
  * ngOnDestroy() { this.text.destroy(); }
144
146
  * }
145
147
  */
146
- declare class ScrollTextRef {
147
- private instance;
148
+ declare class ScrollTextRef extends EngineRef<HTMLElement, ScrollTextOptions> {
149
+ constructor();
148
150
  init(element: HTMLElement, options?: ScrollTextOptions): this;
149
- replay(): this;
150
- pause(): this;
151
- resume(): this;
152
- seek(p: number): this;
153
- getProgress(): number;
154
- destroy(): this;
155
151
  }
156
152
 
157
- export { ScrollAnimateOptions, ScrollAnimateRef, ScrollCounterOptions, ScrollCounterRef, ScrollDrawOptions, ScrollDrawRef, ScrollTextOptions, ScrollTextRef, ScrollVideoOptions, ScrollVideoRef };
153
+ export { EngineRef, ScrollAnimateOptions, ScrollAnimateRef, ScrollCounterOptions, ScrollCounterRef, ScrollDrawInstance, ScrollDrawOptions, ScrollDrawRef, ScrollTextOptions, ScrollTextRef, ScrollVideoOptions, ScrollVideoRef };
@@ -1 +1 @@
1
- import {a as a$2}from'../chunk-JC5BD4RB.mjs';import {a as a$3}from'../chunk-SNCRC6BA.mjs';import {a as a$1}from'../chunk-4MH5SQTH.mjs';import {a}from'../chunk-QJ4H2HW3.mjs';import {b}from'../chunk-WDIHLRZZ.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';var o=class{constructor(){this.instance=null;}init(t,s={}){return this.destroy(),this.instance=b(t,s),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},l=class{constructor(){this.instance=null;}init(t,s){return this.destroy(),this.instance=a(t,s),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},u=class{constructor(){this.instance=null;}init(t,s){return this.destroy(),this.instance=a$1(t,s),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},c=class{constructor(){this.instance=null;}init(t,s={}){return this.destroy(),this.instance=a$2(t,s),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},p=class{constructor(){this.instance=null;}init(t,s={}){return this.destroy(),this.instance=a$3(t,s),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};export{l as ScrollAnimateRef,u as ScrollCounterRef,o as ScrollDrawRef,p as ScrollTextRef,c as ScrollVideoRef};
1
+ import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-JC5BD4RB.mjs';import {a as a$4}from'../chunk-SNCRC6BA.mjs';import {a as a$2}from'../chunk-4MH5SQTH.mjs';import {a as a$1}from'../chunk-QJ4H2HW3.mjs';import {b as b$1}from'../chunk-WDIHLRZZ.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';var r=class{constructor(t){this.create=t;this.instance=null;this.el=null;this.key="";}init(t,e){return this.destroy(),this.el=t,this.latest=e,this.key=a(e),this.instance=this.create(t,b(e,()=>this.latest)),this}update(t){return this.el?a(t)!==this.key?this.init(this.el,t):(this.latest=t,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},u=class extends r{constructor(){super(b$1);}init(t,e={}){return super.init(t,e)}},h=class extends r{constructor(){super(a$1);}},m=class extends r{constructor(){super(a$2);}},O=class extends r{constructor(){super(a$3);}init(t,e={}){return super.init(t,e)}},d=class extends r{constructor(){super(a$4);}init(t,e={}){return super.init(t,e)}};export{r as EngineRef,h as ScrollAnimateRef,m as ScrollCounterRef,u as ScrollDrawRef,d as ScrollTextRef,O as ScrollVideoRef};
@@ -0,0 +1 @@
1
+ var i=new WeakMap,u=0;function f(t){return JSON.stringify(t,(o,n)=>{if(typeof n=="function")return "\u0192";if(typeof Element<"u"&&n instanceof Element){let e=i.get(n);return e===void 0&&i.set(n,e=++u),`el#${e}`}return n})}function s(t,o){let n={...t};for(let e of Object.keys(n))typeof n[e]=="function"&&(n[e]=(...r)=>o()[e]?.(...r));return n}export{f as a,s as b};
@@ -0,0 +1 @@
1
+ import {a,b}from'./chunk-XSVTHCLO.mjs';import {a as a$3}from'./chunk-JC5BD4RB.mjs';import {a as a$4}from'./chunk-SNCRC6BA.mjs';import {a as a$2}from'./chunk-4MH5SQTH.mjs';import {a as a$1}from'./chunk-QJ4H2HW3.mjs';import {b as b$1}from'./chunk-WDIHLRZZ.mjs';import {defineComponent,ref,h,onMounted,watch,onUnmounted,unref}from'vue';var c=e=>typeof e=="function"?e():unref(e);function r(e,t,n){let o=null,a$1=t(),S=()=>{o?.destroy(),o=e.value?n(e.value,b(a$1,()=>a$1)):null;};onMounted(S),watch(()=>a(a$1=t()),S),onUnmounted(()=>{o?.destroy(),o=null;});}function H(e={}){let t=ref(null);return r(t,()=>c(e),b$1),t}var L=defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:t}){let n=ref(null);return r(n,()=>{let o={};return e.selector!=null&&(o.selector=e.selector),e.speed!=null&&(o.speed=e.speed),e.fade!=null&&(o.fade=e.fade),e.stagger!=null&&(o.stagger=e.stagger),e.easing!=null&&(o.easing=e.easing),e.direction!=null&&(o.direction=e.direction),e.trigger!=null&&(o.trigger=e.trigger),e.once!=null&&(o.once=e.once),e.debug!=null&&(o.debug=e.debug),e.onProgress!=null&&(o.onProgress=e.onProgress),e.onStart!=null&&(o.onStart=e.onStart),e.onComplete!=null&&(o.onComplete=e.onComplete),o},b$1),()=>h("div",{ref:n},t.default?.())}});function V(e){let t=ref(null);return r(t,()=>c(e),a$1),t}var A=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:t}){let n=ref(null);return r(n,()=>e.options,a$1),()=>h("div",{ref:n},t.default?.())}});function F(e){let t=ref(null);return r(t,()=>c(e),a$2),t}var G=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let t=ref(null);return r(t,()=>{let n={to:e.to};return e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete),n},a$2),()=>h("span",{ref:t})}});function j(e={}){let t=ref(null);return r(t,()=>c(e),a$3),t}var B=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 t=ref(null);return r(t,()=>e.options??{},a$3),()=>h("video",{ref:t,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function N(e={}){let t=ref(null);return r(t,()=>c(e),a$4),t}var P=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:t}){let n=ref(null);return r(n,()=>e.options??{},a$4),()=>h(e.tag,{ref:n},t.default?.())}});export{H as a,L as b,V as c,A as d,F as e,G as f,j as g,B as h,N as i,P as j};