svg-scroll-draw 2.15.2 → 2.16.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.
Files changed (128) hide show
  1. package/README.md +19 -16
  2. package/dist/angular/index.cjs +2 -2
  3. package/dist/angular/index.d.mts +7 -238
  4. package/dist/angular/index.d.ts +7 -238
  5. package/dist/angular/index.mjs +1 -3
  6. package/dist/aos/index.cjs +2 -2
  7. package/dist/aos/index.mjs +1 -2
  8. package/dist/aos/react/index.cjs +2 -2
  9. package/dist/aos/react/index.d.mts +1 -33
  10. package/dist/aos/react/index.d.ts +1 -33
  11. package/dist/aos/react/index.mjs +1 -2
  12. package/dist/astro/index.cjs +2 -2
  13. package/dist/astro/index.d.mts +4 -146
  14. package/dist/astro/index.d.ts +4 -146
  15. package/dist/astro/index.mjs +1 -3
  16. package/dist/cdn/aos.global.js +2 -2
  17. package/dist/cdn/scrollreveal.global.js +2 -2
  18. package/dist/cdn/svg-scroll-draw.dev.global.js +51 -39
  19. package/dist/cdn/svg-scroll-draw.global.js +2 -2
  20. package/dist/cdn/vivus.global.js +1 -1
  21. package/dist/chunk-4DOJSIEQ.mjs +1 -0
  22. package/dist/chunk-4MH5SQTH.mjs +1 -0
  23. package/dist/chunk-4T5R3ZTL.mjs +2 -0
  24. package/dist/chunk-5PJEKEEP.mjs +1 -0
  25. package/dist/chunk-AJ22VSHC.mjs +1 -0
  26. package/dist/chunk-BCV4RAIX.mjs +1 -0
  27. package/dist/chunk-DM6EDKWH.mjs +1 -0
  28. package/dist/chunk-E4M2PB7B.mjs +1 -0
  29. package/dist/chunk-JC5BD4RB.mjs +1 -0
  30. package/dist/chunk-KBFWDHF4.mjs +1 -0
  31. package/dist/chunk-KGAJQP2N.mjs +2 -0
  32. package/dist/chunk-LFSU6LR3.mjs +1 -0
  33. package/dist/chunk-OJFWQ6CU.mjs +1 -0
  34. package/dist/chunk-OMI46IXL.mjs +2 -0
  35. package/dist/chunk-OWMO2S3V.mjs +1 -0
  36. package/dist/chunk-PEFR3ZB7.mjs +1 -0
  37. package/dist/chunk-QJ4H2HW3.mjs +1 -0
  38. package/dist/chunk-SNCRC6BA.mjs +1 -0
  39. package/dist/chunk-WDIHLRZZ.mjs +3 -0
  40. package/dist/chunk-WQZKXAXK.mjs +2 -0
  41. package/dist/chunk-YWKPTYSG.mjs +1 -0
  42. package/dist/chunk-YZV4Z3EQ.mjs +1 -0
  43. package/dist/cinematic/index.cjs +1 -1
  44. package/dist/cinematic/index.mjs +1 -2
  45. package/dist/devtools/index.mjs +1 -1
  46. package/dist/engine-6AXEX8CL.d.ts +57 -0
  47. package/dist/engine-Ci08nM91.d.mts +57 -0
  48. package/dist/group/index.cjs +2 -2
  49. package/dist/group/index.d.mts +4 -205
  50. package/dist/group/index.d.ts +4 -205
  51. package/dist/group/index.mjs +1 -3
  52. package/dist/horizontal/index.cjs +1 -1
  53. package/dist/horizontal/index.d.mts +1 -33
  54. package/dist/horizontal/index.d.ts +1 -33
  55. package/dist/horizontal/index.mjs +1 -1
  56. package/dist/index-BDGQEK6X.d.mts +15 -0
  57. package/dist/index-BVuNgQSd.d.ts +14 -0
  58. package/dist/index-CGR7pSOR.d.mts +14 -0
  59. package/dist/index-DxjUOIbK.d.ts +15 -0
  60. package/dist/index.cjs +3 -3
  61. package/dist/index.d.mts +8 -292
  62. package/dist/index.d.ts +8 -292
  63. package/dist/index.mjs +1 -4
  64. package/dist/nuxt/index.cjs +2 -2
  65. package/dist/nuxt/index.d.mts +7 -505
  66. package/dist/nuxt/index.d.ts +7 -505
  67. package/dist/nuxt/index.mjs +1 -3
  68. package/dist/pin/index.cjs +1 -1
  69. package/dist/pin/index.mjs +1 -1
  70. package/dist/progress/index.cjs +1 -1
  71. package/dist/progress/index.d.mts +1 -33
  72. package/dist/progress/index.d.ts +1 -33
  73. package/dist/progress/index.mjs +1 -1
  74. package/dist/react/index.cjs +2 -2
  75. package/dist/react/index.d.mts +5 -210
  76. package/dist/react/index.d.ts +5 -210
  77. package/dist/react/index.mjs +1 -3
  78. package/dist/reveal/index.cjs +1 -1
  79. package/dist/reveal/index.d.mts +10 -8
  80. package/dist/reveal/index.d.ts +10 -8
  81. package/dist/reveal/index.mjs +1 -1
  82. package/dist/scroll-draw-BlJfbTDv.d.ts +5 -0
  83. package/dist/scroll-draw-CNlq4Z_L.d.mts +5 -0
  84. package/dist/scrollreveal/index.cjs +2 -2
  85. package/dist/scrollreveal/index.mjs +1 -2
  86. package/dist/scrollreveal/react/index.cjs +2 -2
  87. package/dist/scrollreveal/react/index.d.mts +1 -36
  88. package/dist/scrollreveal/react/index.d.ts +1 -36
  89. package/dist/scrollreveal/react/index.mjs +1 -2
  90. package/dist/snap/index.cjs +1 -1
  91. package/dist/snap/index.d.mts +1 -1
  92. package/dist/snap/index.d.ts +1 -1
  93. package/dist/snap/index.mjs +1 -1
  94. package/dist/solid/index.cjs +2 -2
  95. package/dist/solid/index.d.mts +6 -238
  96. package/dist/solid/index.d.ts +6 -238
  97. package/dist/solid/index.mjs +1 -3
  98. package/dist/svelte/index.cjs +2 -2
  99. package/dist/svelte/index.d.mts +6 -238
  100. package/dist/svelte/index.d.ts +6 -238
  101. package/dist/svelte/index.mjs +1 -3
  102. package/dist/text/index.cjs +1 -1
  103. package/dist/text/index.d.mts +1 -33
  104. package/dist/text/index.d.ts +1 -33
  105. package/dist/text/index.mjs +1 -1
  106. package/dist/timeline/index.cjs +7 -7
  107. package/dist/timeline/index.d.mts +1 -29
  108. package/dist/timeline/index.d.ts +1 -29
  109. package/dist/timeline/index.mjs +11 -11
  110. package/dist/types-DHU1zNEw.d.mts +147 -0
  111. package/dist/types-DHU1zNEw.d.ts +147 -0
  112. package/dist/video/index.cjs +1 -1
  113. package/dist/video/index.d.mts +1 -33
  114. package/dist/video/index.d.ts +1 -33
  115. package/dist/video/index.mjs +1 -1
  116. package/dist/vivus/index.cjs +2 -2
  117. package/dist/vivus/index.mjs +1 -2
  118. package/dist/vivus/react/index.cjs +2 -1
  119. package/dist/vivus/react/index.d.mts +1 -99
  120. package/dist/vivus/react/index.d.ts +1 -99
  121. package/dist/vivus/react/index.mjs +1 -1
  122. package/dist/vue/index.cjs +2 -2
  123. package/dist/vue/index.d.mts +6 -211
  124. package/dist/vue/index.d.ts +6 -211
  125. package/dist/vue/index.mjs +1 -3
  126. package/dist/web-component/index.cjs +2 -2
  127. package/dist/web-component/index.mjs +1 -3
  128. package/package.json +1 -1
@@ -1,3 +1 @@
1
- function Ft({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(t),c=0,m=[];for(let h=0;h<r;h++){let S=Math.pow(o,h);m.push(S),c+=S;}let i=[0],u=0;for(let h=0;h<r;h++)u+=m[h]/c,i.push(u);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let S=0;S<r;S++)if(h<=i[S+1]){let V=(h-i[S])/(i[S+1]-i[S]);if(S===0)return V*(2-V);let x=1-Math.pow(t,S);return x+(1-x)*(2*V-1)*(2*V-1)}return 1}}function _t({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),o=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return c=>c<=0?0:c>=1?1:r*Math.pow(2,-10*c)*Math.sin((c-o)*(2*Math.PI)/t)+1}var Se={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:Ft(),elastic:_t()};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 Ie(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 Ht(e,n,r){return Math.min(r,Math.max(n,e))}function ne(e,n,r,t){return r===n?0:Ht((e-n)/(r-n)*t,0,1)}function Ke(e,n,r){let t=e.getBoundingClientRect(),o=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:o,scroll:0}:{top:r==="x"?t.left:t.top,height:o,scroll:r==="x"?window.scrollX:window.scrollY}}function Ce(e,n,r,t,o){let c=ht(e.top,e.height,n,t.element)-bt(t.viewport,r),m=ht(e.top,e.height,n,o.element)-bt(o.viewport,r);return {tStart:c,tEnd:m}}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 Oe(e,n,r){let t=wt(e),o=wt(n);return !t||!o?e:`rgb(${Math.round(t[0]+(o[0]-t[0])*r)},${Math.round(t[1]+(o[1]-t[1])*r)},${Math.round(t[2]+(o[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 Ve=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...n){Ve&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Vt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",zt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Et=33;function Wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function qt(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 Vt;case "ease-out":return zt;case "ease-in-out":return Wt()?qt(Se["ease-in-out"]):null;default:return null}}var St=Symbol.for("svg-scroll-draw.registry");function xt(){let e=globalThis;return e[St]||(e[St]=new Map)}function ze(e,n){xt().set(e,n);}function We(e){xt().delete(e);}var Gt=0;function Bt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Tt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var $t=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function jt(e){if(!Ve)return;let n=Tt(e,"stroke");if(!n||n==="none"){ye("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!$t.has(r)&&!$t.has(Tt(e,"fill"))&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Ut(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 o(){let c=r==="x"?window.scrollX:window.scrollY,m=e-c,i=n-c,u=r==="x";t.innerHTML=`
2
- <div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}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:${i}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${i}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var At=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Xt(e,n,r){if(!Ve)return;let t=(e.match(Pt)??[]).join("").toUpperCase(),o=(n.match(Pt)??[]).join("").toUpperCase(),c=(e.match(At)??[]).length,m=(n.match(At)??[]).length;if(t!==o){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}c!==m&&ye(`morphTo: coordinate count differs (${c} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,c=>{let m=parseFloat(c),i=t[o++]??m;return String(+(m+(i-m)*r).toFixed(4))})}function lt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,o=r?{...vt[r],...t}:t,c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:i=1,fade:u=false,easing:h="linear",trigger:S={},stagger:V=0,direction:x="forward",once:fe=false,debug:Ge=false,axis:J="y",scrollContainer:Pe,autoReverse:xe=false,delay:he=0,strokeColor:oe,strokeWidth:me,fillOpacity:ee,waypoints:se,velocityScale:be=false,threshold:Re=0,rootMargin:Q="0px",repeat:C=0,repeatDelay:Ne=0,morphTo:z,clip:Me,autoplay:Fe=false,duration:Be=1e3,native:tt=true,onProgress:Te,onStart:U,onComplete:W,onEnter:ie,onLeave:$e,onEnterBack:ae,onLeaveBack:pe}=o,_=Me===true?"left":typeof Me=="string"?Me:false,Z=typeof h=="function"?h:Se[h]??Se.linear,le=De(S.start??"top bottom"),ke=De(S.end??"bottom top"),X=typeof Pe=="string"?document.querySelector(Pe):Pe??null,Y=Array.isArray(oe)?oe[0]:null,O=Array.isArray(oe)?oe[1]:typeof oe=="string"?oe:null,R=Array.isArray(me)?me[0]:null,M=Array.isArray(me)?me[1]:typeof me=="number"?me:null,H=Array.isArray(ee)?ee[0]:null,D=Array.isArray(ee)?ee[1]:typeof ee=="number"?ee:null;function ce(s){let l=s*100;switch(_){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(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let T=_?[]:Array.from(e.querySelectorAll(m)),b=[],a=[],f=0,q=0,v=false,$=false,A=0,te=false,G=-1,I=-1,k=false,B=0,de=0,we,rt=null;function ct(){rt?.destroy(),rt=null;}let ve=new Set,ut=NaN,Ee=true,je=-1,ft=performance.now(),Le=NaN;function nt(){return X?J==="x"?X.scrollLeft:X.scrollTop:J==="x"?window.scrollX:window.scrollY}function mt(){return X?J==="x"?X.clientWidth:X.clientHeight:J==="x"?window.innerWidth:window.innerHeight}function pt(){let s=Ke(e,X,J);return Ce(s,s.scroll,mt(),le,ke)}function dt(){(({tStart:f,tEnd:q}=pt())),Ge&&Ve&&(ct(),rt=Ut(f,q,J));}function ot(s,l=pt){ze(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:l});let g=s.destroy;return s.destroy=()=>{g.call(s),We(e);},s}function Ct(s,l){if(e.style.setProperty("--scroll-draw-progress",String(s)),_){let g=l==="reverse"?1-s:s;e.style.clipPath=ce(g);return}T.forEach((g,N)=>{g.style.strokeDashoffset=l==="reverse"?`${b[N]*s}`:`${b[N]*(1-s)}`,u&&(g.style.opacity=l==="reverse"?`${1-s}`:`${s}`),Y&&O?g.style.stroke=Oe(Y,O,s):O&&(g.style.stroke=O),R!==null&&M!==null?g.style.strokeWidth=`${R+(M-R)*s}`:M!==null&&(g.style.strokeWidth=`${M}`),H!==null&&D!==null?g.style.fillOpacity=`${H+(D-H)*s}`:D!==null&&(g.style.fillOpacity=`${D}`),z&&g.tagName.toLowerCase()==="path"&&a[N]&&g.setAttribute("d",at(a[N],z,s));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),_){e.style.clipPath=ce(0);return}T.forEach((s,l)=>{s.style.strokeDasharray=`${b[l]}`,s.style.strokeDashoffset=x==="reverse"?"0":`${b[l]}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",Y&&(s.style.stroke=Y),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`),z&&s.tagName.toLowerCase()==="path"&&a[l]&&s.setAttribute("d",a[l]);});}if(T.forEach(s=>{jt(s);let l=Ie(s);b.push(l);let g=s.tagName.toLowerCase()==="path";g?a.push(s.getAttribute("d")??""):a.push(""),z&&(g?Xt(a[a.length-1],z,s):ye(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),c?(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?`${l}`:"0",u&&(s.style.opacity="1"),O&&(s.style.stroke=O),M!==null&&(s.style.strokeWidth=`${M}`),D!==null&&(s.style.fillOpacity=`${D}`),z&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",z)):(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?"0":`${l}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",Y&&(s.style.stroke=Y),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`));}),_){if(c)return e.style.clipPath=ce(1),W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ce(0);}else if(c)return W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof h=="string"?Je(h):null;function Ot(){return !(tt===false||!Bt()||!T.length||!gt||_||J!=="y"||X||i!==1||V!==0||fe||xe||be!==false||z||se||C||he>0||Te||U||W||ie||$e||ae||pe||oe!=null||me!=null||ee!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Rt(){let s=++Gt,l=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,N=`--svg-scroll-draw-${s}`,ge=x==="reverse"?"0":"var(--ssd-len)",ue=x==="reverse"?"var(--ssd-len)":"0",re=`stroke-dashoffset:${ge};`,y=`stroke-dashoffset:${ue};`;u&&(re+=`opacity:${x==="reverse"?1:0};`,y+=`opacity:${x==="reverse"?0:1};`);let w=document.createElement("style");w.setAttribute("data-svg-scroll-draw",""),w.textContent=`@keyframes ${l}{from{${re}}to{${y}}}.${g}{view-timeline-name:${N};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${N};animation-range:cover 0% cover 100%;}`,document.head.appendChild(w),e.classList.add(g);function F(p,L){p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(l);}T.forEach(F);let d=false,E=-1;function P(){if(E>=0)return E;let p=e.getBoundingClientRect(),{tStart:L,tEnd:K}=Ce({top:p.top,height:p.height},nt(),mt(),le,ke);return Z(ne(nt(),L,K,i))}return {destroy(){e.classList.remove(g),T.forEach(p=>{p.classList.remove(l),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),w.remove();},replay(){d=false,E=-1,T.forEach(F);},pause(){d=true,T.forEach(p=>{p.style.animationPlayState="paused";});},resume(){d&&(d=false,T.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let L=Math.min(1,Math.max(0,p));E=L,d=true,T.forEach((K,j)=>{K.classList.remove(l),K.style.strokeDashoffset=x==="reverse"?`${b[j]*L}`:`${b[j]*(1-L)}`,u&&(K.style.opacity=x==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return P()},refresh(){T.forEach((p,L)=>{b[L]=Ie(p),p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`;});}}}if(Ot())return ot(Rt());function Nt(){let s=Math.max(1,Be),l=0,g=0,N=false;function ge(d){let E=true;if(_){let P=Math.min(1,Math.max(0,d/s)),p=Z(P);B=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=ce(x==="reverse"?1-p:p),Te?.(p),P<1&&(E=false);}else T.forEach((P,p)=>{let L=p*V*s,K=Math.min(1,Math.max(0,(d-L)/s)),j=Z(K);P.style.strokeDashoffset=x==="reverse"?`${b[p]*j}`:`${b[p]*(1-j)}`,u&&(P.style.opacity=x==="reverse"?`${1-j}`:`${j}`),Y&&O?P.style.stroke=Oe(Y,O,j):O&&(P.style.stroke=O),R!==null&&M!==null?P.style.strokeWidth=`${R+(M-R)*j}`:M!==null&&(P.style.strokeWidth=`${M}`),H!==null&&D!==null?P.style.fillOpacity=`${H+(D-H)*j}`:D!==null&&(P.style.fillOpacity=`${D}`),z&&P.tagName.toLowerCase()==="path"&&a[p]&&P.setAttribute("d",at(a[p],z,j)),p===0&&(B=j,Te?.(j),e.style.setProperty("--scroll-draw-progress",String(j))),K<1&&(E=false);});if(se){let P=Math.min(1,Math.max(0,d/s)),p=Z(P);for(let L in se){let K=parseFloat(L);p>=K&&!ve.has(K)&&(ve.add(K),se[L]?.());}}return E}function ue(d){if(k)return;let E=d-l;$||($=true,U?.());let P=ge(E);if(P&&!v){v=true,ge(s*(1+Math.max(0,T.length-1)*V)),W?.(),de<(C==="infinite"?1/0:C??0)&&(de++,we=setTimeout(()=>{l=performance.now(),$=false,v=false,ve.clear(),Ue(),A=requestAnimationFrame(ue);},Ne));return}P||(A=requestAnimationFrame(ue));}function re(){cancelAnimationFrame(A),clearTimeout(we),l=performance.now(),g=0,k=false,$=false,v=false,de=0,N=true,B=0,ve.clear(),Ue(),A=requestAnimationFrame(ue);}let y=new IntersectionObserver(d=>{d.forEach(E=>{E.isIntersecting&&!(fe&&v)?re():!E.isIntersecting&&!fe&&!v&&(cancelAnimationFrame(A),clearTimeout(we),N=false);});},{root:X??null,threshold:Re,rootMargin:Q}),w;function F(){clearTimeout(w),w=setTimeout(()=>{T.forEach((d,E)=>{b[E]=Ie(d),d.style.strokeDasharray=`${b[E]}`;});},150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),he>0?setTimeout(()=>y.observe(e),he):y.observe(e),{destroy(){cancelAnimationFrame(A),clearTimeout(we),y.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(w);},replay(){de=0,re();},pause(){k||!N||(k=true,g=performance.now()-l,cancelAnimationFrame(A));},resume(){k&&(k=false,N=true,l=performance.now()-g,A=requestAnimationFrame(ue));},seek(d){let E=Math.min(1,Math.max(0,d));B=E,k=true,g=E*s,l=performance.now()-g,cancelAnimationFrame(A),ge(g);},getProgress(){return B},refresh(){clearTimeout(w),T.forEach((d,E)=>{b[E]=Ie(d),d.style.strokeDasharray=`${b[E]}`;});}}}if(Fe)return ot(Nt());dt();function Xe(){if(!te||k)return;let s=performance.now(),l=nt();if(!Ee&&be===false&&l===ut){A=requestAnimationFrame(Xe);return}Ee=false,ut=l;let g=i;if(be!==false){let y=s-ft,w=y>0?Math.abs(l-(je<0?l:je))/y:0;g=i*Math.max(.2,1+w*(typeof be=="number"?be:1)*.04);}je=l,ft=s;let N=xe?I===-1||l>=I?"forward":"reverse":x;I=l;let ge=q-f,ue=true,re=ge===0?0:(l-f)/ge;if(isNaN(Le)||(Le<=0&&re>0?ie?.():Le>0&&re<=0&&pe?.(),Le<1&&re>=1?$e?.():Le>=1&&re<1&&ae?.()),Le=re,_){let y=Z(ne(l,f,q,g));fe&&!xe&&(G=Math.max(G,y),y=G),B=y,e.style.setProperty("--scroll-draw-progress",String(y));let w=N==="reverse"?1-y:y;e.style.clipPath=ce(w),Te?.(y),!$&&ne(l,f,q,g)>0&&($=true,U?.()),y>=1&&!v?(v=true,W?.(),de<(C==="infinite"?1/0:C??0)&&(de++,we=setTimeout(()=>{G=-1,$=false,v=false,e.style.clipPath=ce(0);},Ne))):y<1&&!fe&&(v=false),A=requestAnimationFrame(Xe);return}if(T.forEach((y,w)=>{let F=w*V*ge,d=Z(ne(l,f+F,q+F,g));fe&&!xe&&(G=Math.max(G,d),d=G),B=d,y.style.strokeDashoffset=N==="reverse"?`${b[w]*d}`:`${b[w]*(1-d)}`,u&&(y.style.opacity=N==="reverse"?`${1-d}`:`${d}`),Y&&O?y.style.stroke=Oe(Y,O,d):O&&(y.style.stroke=O),R!==null&&M!==null?y.style.strokeWidth=`${R+(M-R)*d}`:M!==null&&(y.style.strokeWidth=`${M}`),H!==null&&D!==null?y.style.fillOpacity=`${H+(D-H)*d}`:D!==null&&(y.style.fillOpacity=`${D}`),z&&y.tagName.toLowerCase()==="path"&&a[w]&&y.setAttribute("d",at(a[w],z,d)),w===0&&(Te?.(d),e.style.setProperty("--scroll-draw-progress",String(d))),d<1&&(ue=false);}),se){let y=Z(ne(l,f,q,g));for(let w in se){let F=parseFloat(w);y>=F&&!ve.has(F)&&(ve.add(F),se[w]?.());}}!$&&ne(l,f,q,g)>0&&($=true,U?.()),ue&&!v?(v=true,W?.(),de<(C==="infinite"?1/0:C??0)&&(de++,we=setTimeout(()=>{G=-1,$=false,v=false,ve.clear(),Ue(),Ee=true;},Ne))):!ue&&!fe&&(v=false),A=requestAnimationFrame(Xe);}let st=false;function Ye(){st||(st=true,A=requestAnimationFrame(function(){Xe();}));}function Qe(){st=false,cancelAnimationFrame(A);}let it=new IntersectionObserver(s=>{s.forEach(l=>{te=l.isIntersecting,te&&!k?(Ee=true,Ye()):Qe();});},{root:X??null,threshold:Re,rootMargin:Q});function yt(){T.forEach((s,l)=>{b[l]=Ie(s),s.style.strokeDasharray=`${b[l]}`;}),dt(),Ee=true;}let Ze;function _e(){clearTimeout(Ze),Ze=setTimeout(yt,150);}window.addEventListener("resize",_e),window.addEventListener("orientationchange",_e);let He;return typeof ResizeObserver<"u"&&(He=new ResizeObserver(()=>_e()),He.observe(document.body),He.observe(document.documentElement),He.observe(e)),he>0?setTimeout(()=>it.observe(e),he):it.observe(e),ot({destroy(){cancelAnimationFrame(A),clearTimeout(we),Qe(),it.disconnect(),He?.disconnect(),window.removeEventListener("resize",_e),window.removeEventListener("orientationchange",_e),clearTimeout(Ze),ct();},replay(){G=-1,I=-1,je=-1,$=false,v=false,de=0,k=false,B=0,ve.clear(),clearTimeout(we),Ue(),Ee=true,te&&Ye();},pause(){k=true,Qe();},resume(){k&&(k=false,Ee=true,te&&Ye());},seek(s){let l=Math.min(1,Math.max(0,s));B=l,G=l,k=true,Qe(),Ct(l,x),Ee=true;},getProgress(){return B},refresh(){clearTimeout(Ze),yt(),te&&!k&&Ye();}},()=>({tStart:f,tEnd:q}))}function Yt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Mt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],c=[],m=t[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let u=i.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),c.push(u?u[2]:"");}n.push({fn:t[1],nums:o,units:c});}return n}function Qt(e,n,r){let t=Mt(e),o=Mt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((c,m)=>{let i=o[m];return c.fn!==i.fn||c.nums.length!==i.nums.length?r<1?`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,h)=>`${u}${i.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u+(i.nums[h]-u)*r}${c.units[h]}`).join(", ")})`}).join(" ")}function kt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(Yt(t))return Oe(t,o,r);if(t.includes("("))return Qt(t,o,r);let c=t.match(/^([-+]?[\d.]+)(.*)$/),m=o.match(/^([-+]?[\d.]+)(.*)$/);if(c&&m){let i=parseFloat(c[1]),u=parseFloat(m[1]);return `${i+(u-i)*r}${c[2]||m[2]}`}return r<1?t:o}function Zt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Jt=0,Lt="--scroll-draw-progress";function er(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:o={},easing:c="ease-out",speed:m=1,once:i=false,axis:u="y",scrollContainer:h,native:S=true,velocityScale:V=false,respectReducedMotion:x=true,triggerElement:fe,onProgress:Ge,onComplete:J,onEnter:Pe,onLeave:xe,onEnterBack:he,onLeaveBack:oe}=n,me=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=typeof c=="function"?c:Se[c]??Se["ease-out"],se=De(o.start??"top bottom"),be=De(o.end??"bottom top"),Re=fe??e,Q=typeof h=="string"?document.querySelector(h):h??null,C=Object.entries(t).map(([a,f])=>({prop:Zt(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Ne(){let a=window.getComputedStyle(e);for(let f of C)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function z(){for(let a of C)e.style.setProperty(a.prop,String(a.to));}let Me=new Map;for(let a of [...C.map(f=>f.prop),Lt])Me.set(a,e.style.getPropertyValue(a));function Fe(){for(let[a,f]of Me)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(me)return z(),J?.(),{...r,destroy:Fe,getProgress:()=>1};Ne();let Be=typeof c=="string"?Je(c):null;function tt(){if(!S||!er()||!Be||u!=="y"||Q||Re!==e||i||m!==1||Ge||J||Pe||xe||he||oe||V!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let a of C)if(!Kt.has(a.prop))return false;return true}function Te(){let a=`ssd-a-${++Jt}`,f=C.map(I=>`${I.prop}:${I.from}`).join(";"),q=C.map(I=>`${I.prop}:${I.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${a}{from{${f}}to{${q}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Be};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),e.classList.add(a);let $=()=>u==="x"?window.scrollX:window.scrollY,A=()=>u==="x"?window.innerWidth:window.innerHeight,te=()=>{let I=e.getBoundingClientRect();return Ce({top:I.top,height:I.height},$(),A(),se,be)};ze(e,{type:"animate",getProgress:()=>G.getProgress(),getTrigger:te});let G={destroy(){e.classList.remove(a),v.remove(),e.style.animationPlayState="",Fe(),We(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let k=Math.min(1,Math.max(0,I));e.classList.remove(a);for(let B of C)e.style.setProperty(B.prop,kt(B.from,B.to,k));},getProgress(){let{tStart:I,tEnd:k}=te();return ee(ne($(),I,k,m))}};return G}if(tt())return Te();let U=0,W=0,ie=0,$e=false,ae=false,pe=-1,_=0,Z=false,le=NaN,ke=-1,X=0,Y=()=>Q?u==="x"?Q.scrollLeft:Q.scrollTop:u==="x"?window.scrollX:window.scrollY,O=()=>Q?u==="x"?Q.clientWidth:Q.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function R(){let a=Ke(Re,Q,u),f=Ce(a,a.scroll,O(),se,be);U=f.tStart,W=f.tEnd;}function M(a){e.style.setProperty(Lt,String(a));for(let f of C)e.style.setProperty(f.prop,kt(f.from,f.to,a));Ge?.(a);}function H(a){if(isNaN(le)){le=a;return}le<=0&&a>0?Pe?.():le>0&&a<=0&&oe?.(),le<1&&a>=1?xe?.():le>=1&&a<1&&he?.(),le=a;}function D(){if(!$e||ae)return;let a=performance.now(),f=Y(),q=m;if(V!==false){let A=a-X,te=A>0?Math.abs(f-(ke<0?f:ke))/A:0;q=m*Math.max(.2,1+te*(typeof V=="number"?V:1)*.04);}ke=f,X=a;let v=W===U?0:(f-U)/(W-U);H(v);let $=ee(ne(f,U,W,q));i&&(pe=Math.max(pe,$),$=pe),_=$,M($),$>=1&&!Z?(Z=true,J?.()):$<1&&!i&&(Z=false),ie=requestAnimationFrame(D);}R(),W===U&&ye("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let a=ee(ne(Y(),U,W,m));i&&a>0&&(pe=a),_=a,M(a);}let ce=new IntersectionObserver(a=>{a.forEach(f=>{$e=f.isIntersecting,$e&&!ae?ie=requestAnimationFrame(D):cancelAnimationFrame(ie);});},{root:Q??null}),T;function b(){clearTimeout(T),T=setTimeout(R,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),ce.observe(e),ze(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:U,tEnd:W})}),{destroy(){cancelAnimationFrame(ie),ce.disconnect(),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),Fe(),We(e);},replay(){pe=-1,Z=false,_=0,ae=false,M(0);},pause(){ae=true,cancelAnimationFrame(ie);},resume(){ae&&(ae=false,$e&&(ie=requestAnimationFrame(D)));},seek(a){let f=Math.min(1,Math.max(0,a));_=f,pe=f,ae=true,cancelAnimationFrame(ie),M(f);},getProgress(){return _}}}var Dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n={}){if(typeof window>"u")return Dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollParallax: element not found:",e),Dt;let{speed:t=.3,axis:o="y",easing:c="linear",trigger:m,onProgress:i}=n,u=r.getBoundingClientRect(),h=o==="x"?u.width:u.height,S=t*h;return et(r,{props:o==="x"?{transform:["translateX(0px)",`translateX(${-S}px)`]}:{transform:["translateY(0px)",`translateY(${-S}px)`]},trigger:m??{start:"top bottom",end:"bottom top"},easing:c,native:false,onProgress:i})}function qe(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var Ae={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function vr(e,n={}){if(typeof window>"u")return Ae;let r=qe(e).map(t=>lt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function Er(e,n={}){if(typeof window>"u")return Ae;let r=qe(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return lt(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function Sr(e,n){if(typeof window>"u")return Ae;let r=qe(e).map(t=>et(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function xr(e,n){if(typeof window>"u")return Ae;let r=qe(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return et(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function Tr(e,n={}){if(typeof window>"u")return Ae;let r=qe(e).map(t=>It(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}export{Sr as scrollAnimateGroup,xr as scrollAnimateSequence,vr as scrollDrawGroup,Er as scrollDrawSequence,Tr as scrollParallaxGroup};
1
+ import {b as b$1}from'../chunk-KBFWDHF4.mjs';import {a as a$1}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';function u(s){return s.map(o=>typeof o=="string"?document.querySelector(o):o).filter(o=>o!==null)}var a={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function y(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function E(s,o={}){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return b(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function d(s,o){if(typeof window>"u")return a;let r=u(s).map(e=>a$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function w(s,o){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return a$1(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function S(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}export{d as scrollAnimateGroup,w as scrollAnimateSequence,y as scrollDrawGroup,E as scrollDrawSequence,S as scrollParallaxGroup};
@@ -1 +1 @@
1
- 'use strict';function Re({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(n),i=0,l=[];for(let c=0;c<r;c++){let f=Math.pow(a,c);l.push(f),i+=f;}let m=[0],u=0;for(let c=0;c<r;c++)u+=l[c]/i,m.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let f=0;f<r;f++)if(c<=m[f+1]){let g=(c-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let E=1-Math.pow(n,f);return E+(1-E)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),a=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var R={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Re(),elastic:_e()};function Q(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function pe(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function fe(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 Ne(e,t,r){return Math.min(r,Math.max(t,e))}function k(e,t,r,n){return r===t?0:Ne((e-t)/(r-t)*n,0,1)}function de(e,t,r){let n=e.getBoundingClientRect(),a=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:r==="x"?n.left:n.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function K(e,t,r,n,a){let i=pe(e.top,e.height,t,n.element)-fe(n.viewport,r),l=pe(e.top,e.height,t,a.element)-fe(a.viewport,r);return {tStart:i,tEnd:l}}function ge(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function be(e,t,r){let n=ge(e),a=ge(t);return !n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*r)},${Math.round(n[1]+(a[1]-n[1])*r)},${Math.round(n[2]+(a[2]-n[2])*r)})`}var He="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fe(e){let t=[];for(let r=0;r<ye;r++){let n=r/(ye-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function he(e){switch(e){case "linear":return "linear";case "ease-in":return He;case "ease-out":return Oe;case "ease-in-out":return De()?Fe(R["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function we(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function Z(e,t){we().set(e,t);}function J(e){we().delete(e);}var ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function _(e,...t){ze&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Ve(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let a=[],i=[],l=n[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:a,units:i});}return t}function ke(e,t,r){let n=Se(e),a=Se(t);return n.length===0||n.length!==a.length?r<1?e:t:n.map((i,l)=>{let m=a[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,c)=>`${u}${m.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(m.nums[c]-u)*r}${i.units[c]}`).join(", ")})`}).join(" ")}function ve(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),a=String(t);if(Ve(n))return be(n,a,r);if(n.includes("("))return ke(n,a,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),u=parseFloat(l[1]);return `${m+(u-m)*r}${i[2]||l[2]}`}return r<1?n:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),qe=0,xe="--scroll-draw-progress";function Ge(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ee(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:a={},easing:i="ease-out",speed:l=1,once:m=false,axis:u="y",scrollContainer:c,native:f=true,velocityScale:g=false,respectReducedMotion:E=true,triggerElement:$,onProgress:b,onComplete:P,onEnter:p,onLeave:C,onEnterBack:te,onLeaveBack:ne}=t,Te=E&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof i=="function"?i:R[i]??R["ease-out"],re=Q(a.start??"top bottom"),oe=Q(a.end??"bottom top"),se=$??e,y=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(n).map(([o,s])=>({prop:We(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Pe(){let o=window.getComputedStyle(e);for(let s of w)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Ae(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}let ie=new Map;for(let o of [...w.map(s=>s.prop),xe])ie.set(o,e.style.getPropertyValue(o));function B(){for(let[o,s]of ie)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Te)return Ae(),P?.(),{...r,destroy:B,getProgress:()=>1};Pe();let ae=typeof i=="string"?he(i):null;function Le(){if(!f||!Ge()||!ae||u!=="y"||y||se!==e||m||l!==1||b||P||p||C||te||ne||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Be.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++qe}`,s=w.map(d=>`${d.prop}:${d.from}`).join(";"),F=w.map(d=>`${d.prop}:${d.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${o}{from{${s}}to{${F}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ae};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(o);let h=()=>u==="x"?window.scrollX:window.scrollY,z=()=>u==="x"?window.innerWidth:window.innerHeight,V=()=>{let d=e.getBoundingClientRect();return K({top:d.top,height:d.height},h(),z(),re,oe)};Z(e,{type:"animate",getProgress:()=>X.getProgress(),getTrigger:V});let X={destroy(){e.classList.remove(o),I.remove(),e.style.animationPlayState="",B(),J(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let U=Math.min(1,Math.max(0,d));e.classList.remove(o);for(let Y of w)e.style.setProperty(Y.prop,ve(Y.from,Y.to,U));},getProgress(){let{tStart:d,tEnd:U}=V();return W(k(h(),d,U,l))}};return X}if(Le())return Ie();let S=0,v=0,x=0,N=false,M=false,A=-1,L=0,H=false,T=NaN,q=-1,ue=0,le=()=>y?u==="x"?y.scrollLeft:y.scrollTop:u==="x"?window.scrollX:window.scrollY,$e=()=>y?u==="x"?y.clientWidth:y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=de(se,y,u),s=K(o,o.scroll,$e(),re,oe);S=s.tStart,v=s.tEnd;}function O(o){e.style.setProperty(xe,String(o));for(let s of w)e.style.setProperty(s.prop,ve(s.from,s.to,o));b?.(o);}function Ce(o){if(isNaN(T)){T=o;return}T<=0&&o>0?p?.():T>0&&o<=0&&ne?.(),T<1&&o>=1?C?.():T>=1&&o<1&&te?.(),T=o;}function G(){if(!N||M)return;let o=performance.now(),s=le(),F=l;if(g!==false){let z=o-ue,V=z>0?Math.abs(s-(q<0?s:q))/z:0;F=l*Math.max(.2,1+V*(typeof g=="number"?g:1)*.04);}q=s,ue=o;let I=v===S?0:(s-S)/(v-S);Ce(I);let h=W(k(s,S,v,F));m&&(A=Math.max(A,h),h=A),L=h,O(h),h>=1&&!H?(H=true,P?.()):h<1&&!m&&(H=false),x=requestAnimationFrame(G);}ce(),v===S&&_("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 o=W(k(le(),S,v,l));m&&o>0&&(A=o),L=o,O(o);}let me=new IntersectionObserver(o=>{o.forEach(s=>{N=s.isIntersecting,N&&!M?x=requestAnimationFrame(G):cancelAnimationFrame(x);});},{root:y??null}),j;function D(){clearTimeout(j),j=setTimeout(ce,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),me.observe(e),Z(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:S,tEnd:v})}),{destroy(){cancelAnimationFrame(x),me.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(j),B(),J(e);},replay(){A=-1,H=false,L=0,M=false,O(0);},pause(){M=true,cancelAnimationFrame(x);},resume(){M&&(M=false,N&&(x=requestAnimationFrame(G)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,A=s,M=true,cancelAnimationFrame(x),O(s);},getProgress(){return L}}}var Me={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function ot(e,t={}){if(typeof window>"u")return Me;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return _("scrollHorizontal: track element not found:",e),Me;let n=r,{easing:a="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:l,respectReducedMotion:m=false,onProgress:u}=t;function c(){let p=typeof l=="string"?document.querySelector(l):l??null;return p?p.clientWidth:window.innerWidth}function f(){return t.distance??n.scrollWidth-c()}function g(){if(t.triggerElement!==void 0){let p=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(p)return p;_("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let p=n.parentElement;p;p=p.parentElement)if(window.getComputedStyle(p).position==="sticky")return p.parentElement??p;return n}let E=f(),$=g(),b=ee(n,P(E,$));function P(p,C){return {props:{transform:["translateX(0px)",`translateX(${-p}px)`]},trigger:i,easing:a,native:false,respectReducedMotion:m,...C!==n&&{triggerElement:C},...l!==void 0&&{scrollContainer:l},...u!==void 0&&{onProgress:u}}}return {destroy(){b.destroy();},replay(){b.replay();},pause(){b.pause();},resume(){b.resume();},seek(p){b.seek(p);},getProgress(){return b.getProgress()},refresh(){b.destroy(),E=f(),$=g(),b=ee(n,P(E,$));}}}exports.scrollHorizontal=ot;
1
+ 'use strict';function _e({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(n),i=0,l=[];for(let c=0;c<r;c++){let f=Math.pow(a,c);l.push(f),i+=f;}let m=[0],u=0;for(let c=0;c<r;c++)u+=l[c]/i,m.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let f=0;f<r;f++)if(c<=m[f+1]){let g=(c-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let E=1-Math.pow(n,f);return E+(1-E)*(2*g-1)*(2*g-1)}return 1}}function He({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),a=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var C={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:_e(),elastic:He()};function pe(e,t,r){return Math.min(r,Math.max(t,e))}function Y(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function fe(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function ge(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 W(e,t,r,n){return r===t?0:pe((e-t)/(r-t)*n,0,1)}function K(e,t,r,n,a){let i=fe(e.top,e.height,t,n.element)-ge(n.viewport,r),l=fe(e.top,e.height,t,a.element)-ge(a.viewport,r);return {tStart:i,tEnd:l}}function de(e,t,r){let n=e.getBoundingClientRect(),a=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:r==="x"?n.left:n.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function be(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function ye(e,t,r){let n=be(e),a=be(t);return !n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*r)},${Math.round(n[1]+(a[1]-n[1])*r)},${Math.round(n[2]+(a[2]-n[2])*r)})`}var Ne="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",ze="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",he=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fe(e){let t=[];for(let r=0;r<he;r++){let n=r/(he-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function Ee(e){switch(e){case "linear":return "linear";case "ease-in":return Ne;case "ease-out":return ze;case "ease-in-out":return De()?Fe(C["ease-in-out"]):null;default:return null}}var we=Symbol.for("svg-scroll-draw.registry");function Se(){let e=globalThis;return e[we]||(e[we]=new Map)}function Z(e,t){Se().set(e,t);}function J(e){Se().delete(e);}var Oe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function _(e,...t){Oe&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Ve(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ve(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let a=[],i=[],l=n[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:a,units:i});}return t}function We(e,t,r){let n=ve(e),a=ve(t);return n.length===0||n.length!==a.length?r<1?e:t:n.map((i,l)=>{let m=a[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,c)=>`${u}${m.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(m.nums[c]-u)*r}${i.units[c]}`).join(", ")})`}).join(" ")}function Me(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),a=String(t);if(Ve(n))return ye(n,a,r);if(n.includes("("))return We(n,a,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),u=parseFloat(l[1]);return `${m+(u-m)*r}${i[2]||l[2]}`}return r<1?n:a}function ke(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),qe=0,xe="--scroll-draw-progress";function je(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ee(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:a={},easing:i="ease-out",speed:l=1,once:m=false,axis:u="y",scrollContainer:c,native:f=true,velocityScale:g=false,respectReducedMotion:E=true,triggerElement:I,onProgress:b,onComplete:P,onEnter:p,onLeave:R,onEnterBack:te,onLeaveBack:ne}=t,Pe=E&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,k=typeof i=="function"?i:C[i]??C["ease-out"],re=Y(a.start??"top bottom"),oe=Y(a.end??"bottom top"),se=I??e,y=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(n).map(([o,s])=>({prop:ke(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Le(){let o=window.getComputedStyle(e);for(let s of w)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Ae(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}let ie=new Map;for(let o of [...w.map(s=>s.prop),xe])ie.set(o,e.style.getPropertyValue(o));function B(){for(let[o,s]of ie)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Pe)return Ae(),P?.(),{...r,destroy:B,getProgress:()=>1};Le();let ae=typeof i=="string"?Ee(i):null;function $e(){if(!f||!je()||!ae||u!=="y"||y||se!==e||m||l!==1||b||P||p||R||te||ne||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Be.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++qe}`,s=w.map(d=>`${d.prop}:${d.from}`).join(";"),F=w.map(d=>`${d.prop}:${d.to}`).join(";"),$=document.createElement("style");$.setAttribute("data-ssd-animate",""),$.textContent=`@keyframes ${o}{from{${s}}to{${F}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ae};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild($),e.classList.add(o);let h=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight,V=()=>{let d=e.getBoundingClientRect();return K({top:d.top,height:d.height},h(),O(),re,oe)};Z(e,{type:"animate",getProgress:()=>X.getProgress(),getTrigger:V});let X={destroy(){e.classList.remove(o),$.remove(),e.style.animationPlayState="",B(),J(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let U=Math.min(1,Math.max(0,d));e.classList.remove(o);for(let Q of w)e.style.setProperty(Q.prop,Me(Q.from,Q.to,U));},getProgress(){let{tStart:d,tEnd:U}=V();return k(W(h(),d,U,l))}};return X}if($e())return Ie();let S=0,v=0,M=0,H=false,x=false,L=-1,A=0,N=false,T=NaN,q=-1,ue=0,le=()=>y?u==="x"?y.scrollLeft:y.scrollTop:u==="x"?window.scrollX:window.scrollY,Re=()=>y?u==="x"?y.clientWidth:y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=de(se,y,u),s=K(o,o.scroll,Re(),re,oe);S=s.tStart,v=s.tEnd;}function z(o){e.style.setProperty(xe,String(o));for(let s of w)e.style.setProperty(s.prop,Me(s.from,s.to,o));b?.(o);}function Ce(o){if(isNaN(T)){T=o;return}T<=0&&o>0?p?.():T>0&&o<=0&&ne?.(),T<1&&o>=1?R?.():T>=1&&o<1&&te?.(),T=o;}function j(){if(!H||x)return;let o=performance.now(),s=le(),F=l;if(g!==false){let O=o-ue,V=O>0?Math.abs(s-(q<0?s:q))/O:0;F=l*Math.max(.2,1+V*(typeof g=="number"?g:1)*.04);}q=s,ue=o;let $=v===S?0:(s-S)/(v-S);Ce($);let h=k(W(s,S,v,F));m&&(L=Math.max(L,h),h=L),A=h,z(h),h>=1&&!N?(N=true,P?.()):h<1&&!m&&(N=false),M=requestAnimationFrame(j);}ce(),v===S&&_("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 o=k(W(le(),S,v,l));m&&o>0&&(L=o),A=o,z(o);}let me=new IntersectionObserver(o=>{o.forEach(s=>{H=s.isIntersecting,H&&!x?M=requestAnimationFrame(j):cancelAnimationFrame(M);});},{root:y??null}),G;function D(){clearTimeout(G),G=setTimeout(ce,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),me.observe(e),Z(e,{type:"animate",getProgress:()=>A,getTrigger:()=>({tStart:S,tEnd:v})}),{destroy(){cancelAnimationFrame(M),me.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(G),B(),J(e);},replay(){L=-1,N=false,A=0,x=false,z(0);},pause(){x=true,cancelAnimationFrame(M);},resume(){x&&(x=false,H&&(M=requestAnimationFrame(j)));},seek(o){let s=Math.min(1,Math.max(0,o));A=s,L=s,x=true,cancelAnimationFrame(M),z(s);},getProgress(){return A}}}var Te={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function pt(e,t={}){if(typeof window>"u")return Te;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return _("scrollHorizontal: track element not found:",e),Te;let n=r,{easing:a="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:l,respectReducedMotion:m=false,onProgress:u}=t;function c(){let p=typeof l=="string"?document.querySelector(l):l??null;return p?p.clientWidth:window.innerWidth}function f(){return t.distance??n.scrollWidth-c()}function g(){if(t.triggerElement!==void 0){let p=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(p)return p;_("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let p=n.parentElement;p;p=p.parentElement)if(window.getComputedStyle(p).position==="sticky")return p.parentElement??p;return n}let E=f(),I=g(),b=ee(n,P(E,I));function P(p,R){return {props:{transform:["translateX(0px)",`translateX(${-p}px)`]},trigger:i,easing:a,native:false,respectReducedMotion:m,...R!==n&&{triggerElement:R},...l!==void 0&&{scrollContainer:l},...u!==void 0&&{onProgress:u}}}return {destroy(){b.destroy();},replay(){b.replay();},pause(){b.pause();},resume(){b.resume();},seek(p){b.seek(p);},getProgress(){return b.getProgress()},refresh(){b.destroy(),E=f(),I=g(),b=ee(n,P(E,I));}}}exports.scrollHorizontal=pt;
@@ -1,36 +1,4 @@
1
- type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
- interface TriggerConfig {
3
- start?: string;
4
- end?: string;
5
- }
6
- interface ScrollDrawInstance {
7
- destroy: () => void;
8
- /** Reset and replay the animation from the beginning. */
9
- replay: () => void;
10
- /** Pause the animation at the current progress. */
11
- pause: () => void;
12
- /** Resume a paused animation. */
13
- resume: () => void;
14
- /** Jump to a specific progress value (0–1) and pause. */
15
- seek: (progress: number) => void;
16
- /** Returns current draw progress (0–1). */
17
- getProgress: () => number;
18
- /**
19
- * Re-measure after a layout change: path lengths, and the scroll trigger window.
20
- *
21
- * The engine already re-measures on `resize`, on `orientationchange`, and via a
22
- * `ResizeObserver` on the document element — but none of those fire for a layout
23
- * change that leaves the document height alone, such as a tab switching, a
24
- * sibling collapsing, or a font swapping inside a fixed-height box. Call this
25
- * after one of those.
26
- *
27
- * Optional on this shared type because several instances here are fan-outs over
28
- * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
29
- * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
30
- * use `instance.refresh?.()` if you hold an instance of unknown origin.
31
- */
32
- refresh?: () => void;
33
- }
1
+ import { S as ScrollDrawInstance, T as TriggerConfig, E as EasingName } from '../types-DHU1zNEw.mjs';
34
2
 
35
3
  interface ScrollHorizontalOptions {
36
4
  /**
@@ -1,36 +1,4 @@
1
- type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
- interface TriggerConfig {
3
- start?: string;
4
- end?: string;
5
- }
6
- interface ScrollDrawInstance {
7
- destroy: () => void;
8
- /** Reset and replay the animation from the beginning. */
9
- replay: () => void;
10
- /** Pause the animation at the current progress. */
11
- pause: () => void;
12
- /** Resume a paused animation. */
13
- resume: () => void;
14
- /** Jump to a specific progress value (0–1) and pause. */
15
- seek: (progress: number) => void;
16
- /** Returns current draw progress (0–1). */
17
- getProgress: () => number;
18
- /**
19
- * Re-measure after a layout change: path lengths, and the scroll trigger window.
20
- *
21
- * The engine already re-measures on `resize`, on `orientationchange`, and via a
22
- * `ResizeObserver` on the document element — but none of those fire for a layout
23
- * change that leaves the document height alone, such as a tab switching, a
24
- * sibling collapsing, or a font swapping inside a fixed-height box. Call this
25
- * after one of those.
26
- *
27
- * Optional on this shared type because several instances here are fan-outs over
28
- * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
29
- * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
30
- * use `instance.refresh?.()` if you hold an instance of unknown origin.
31
- */
32
- refresh?: () => void;
33
- }
1
+ import { S as ScrollDrawInstance, T as TriggerConfig, E as EasingName } from '../types-DHU1zNEw.js';
34
2
 
35
3
  interface ScrollHorizontalOptions {
36
4
  /**
@@ -1 +1 @@
1
- function Re({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(n),i=0,l=[];for(let c=0;c<r;c++){let f=Math.pow(a,c);l.push(f),i+=f;}let m=[0],u=0;for(let c=0;c<r;c++)u+=l[c]/i,m.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let f=0;f<r;f++)if(c<=m[f+1]){let g=(c-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let E=1-Math.pow(n,f);return E+(1-E)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),a=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var R={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Re(),elastic:_e()};function Q(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function pe(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function fe(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 Ne(e,t,r){return Math.min(r,Math.max(t,e))}function k(e,t,r,n){return r===t?0:Ne((e-t)/(r-t)*n,0,1)}function de(e,t,r){let n=e.getBoundingClientRect(),a=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:r==="x"?n.left:n.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function K(e,t,r,n,a){let i=pe(e.top,e.height,t,n.element)-fe(n.viewport,r),l=pe(e.top,e.height,t,a.element)-fe(a.viewport,r);return {tStart:i,tEnd:l}}function ge(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function be(e,t,r){let n=ge(e),a=ge(t);return !n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*r)},${Math.round(n[1]+(a[1]-n[1])*r)},${Math.round(n[2]+(a[2]-n[2])*r)})`}var He="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fe(e){let t=[];for(let r=0;r<ye;r++){let n=r/(ye-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function he(e){switch(e){case "linear":return "linear";case "ease-in":return He;case "ease-out":return Oe;case "ease-in-out":return De()?Fe(R["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function we(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function Z(e,t){we().set(e,t);}function J(e){we().delete(e);}var ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function _(e,...t){ze&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Ve(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let a=[],i=[],l=n[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:a,units:i});}return t}function ke(e,t,r){let n=Se(e),a=Se(t);return n.length===0||n.length!==a.length?r<1?e:t:n.map((i,l)=>{let m=a[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,c)=>`${u}${m.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(m.nums[c]-u)*r}${i.units[c]}`).join(", ")})`}).join(" ")}function ve(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),a=String(t);if(Ve(n))return be(n,a,r);if(n.includes("("))return ke(n,a,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),u=parseFloat(l[1]);return `${m+(u-m)*r}${i[2]||l[2]}`}return r<1?n:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),qe=0,xe="--scroll-draw-progress";function Ge(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ee(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:a={},easing:i="ease-out",speed:l=1,once:m=false,axis:u="y",scrollContainer:c,native:f=true,velocityScale:g=false,respectReducedMotion:E=true,triggerElement:$,onProgress:b,onComplete:P,onEnter:p,onLeave:C,onEnterBack:te,onLeaveBack:ne}=t,Te=E&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof i=="function"?i:R[i]??R["ease-out"],re=Q(a.start??"top bottom"),oe=Q(a.end??"bottom top"),se=$??e,y=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(n).map(([o,s])=>({prop:We(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Pe(){let o=window.getComputedStyle(e);for(let s of w)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Ae(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}let ie=new Map;for(let o of [...w.map(s=>s.prop),xe])ie.set(o,e.style.getPropertyValue(o));function B(){for(let[o,s]of ie)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Te)return Ae(),P?.(),{...r,destroy:B,getProgress:()=>1};Pe();let ae=typeof i=="string"?he(i):null;function Le(){if(!f||!Ge()||!ae||u!=="y"||y||se!==e||m||l!==1||b||P||p||C||te||ne||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Be.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++qe}`,s=w.map(d=>`${d.prop}:${d.from}`).join(";"),F=w.map(d=>`${d.prop}:${d.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${o}{from{${s}}to{${F}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ae};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(o);let h=()=>u==="x"?window.scrollX:window.scrollY,z=()=>u==="x"?window.innerWidth:window.innerHeight,V=()=>{let d=e.getBoundingClientRect();return K({top:d.top,height:d.height},h(),z(),re,oe)};Z(e,{type:"animate",getProgress:()=>X.getProgress(),getTrigger:V});let X={destroy(){e.classList.remove(o),I.remove(),e.style.animationPlayState="",B(),J(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let U=Math.min(1,Math.max(0,d));e.classList.remove(o);for(let Y of w)e.style.setProperty(Y.prop,ve(Y.from,Y.to,U));},getProgress(){let{tStart:d,tEnd:U}=V();return W(k(h(),d,U,l))}};return X}if(Le())return Ie();let S=0,v=0,x=0,N=false,M=false,A=-1,L=0,H=false,T=NaN,q=-1,ue=0,le=()=>y?u==="x"?y.scrollLeft:y.scrollTop:u==="x"?window.scrollX:window.scrollY,$e=()=>y?u==="x"?y.clientWidth:y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=de(se,y,u),s=K(o,o.scroll,$e(),re,oe);S=s.tStart,v=s.tEnd;}function O(o){e.style.setProperty(xe,String(o));for(let s of w)e.style.setProperty(s.prop,ve(s.from,s.to,o));b?.(o);}function Ce(o){if(isNaN(T)){T=o;return}T<=0&&o>0?p?.():T>0&&o<=0&&ne?.(),T<1&&o>=1?C?.():T>=1&&o<1&&te?.(),T=o;}function G(){if(!N||M)return;let o=performance.now(),s=le(),F=l;if(g!==false){let z=o-ue,V=z>0?Math.abs(s-(q<0?s:q))/z:0;F=l*Math.max(.2,1+V*(typeof g=="number"?g:1)*.04);}q=s,ue=o;let I=v===S?0:(s-S)/(v-S);Ce(I);let h=W(k(s,S,v,F));m&&(A=Math.max(A,h),h=A),L=h,O(h),h>=1&&!H?(H=true,P?.()):h<1&&!m&&(H=false),x=requestAnimationFrame(G);}ce(),v===S&&_("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 o=W(k(le(),S,v,l));m&&o>0&&(A=o),L=o,O(o);}let me=new IntersectionObserver(o=>{o.forEach(s=>{N=s.isIntersecting,N&&!M?x=requestAnimationFrame(G):cancelAnimationFrame(x);});},{root:y??null}),j;function D(){clearTimeout(j),j=setTimeout(ce,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),me.observe(e),Z(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:S,tEnd:v})}),{destroy(){cancelAnimationFrame(x),me.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(j),B(),J(e);},replay(){A=-1,H=false,L=0,M=false,O(0);},pause(){M=true,cancelAnimationFrame(x);},resume(){M&&(M=false,N&&(x=requestAnimationFrame(G)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,A=s,M=true,cancelAnimationFrame(x),O(s);},getProgress(){return L}}}var Me={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function ot(e,t={}){if(typeof window>"u")return Me;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return _("scrollHorizontal: track element not found:",e),Me;let n=r,{easing:a="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:l,respectReducedMotion:m=false,onProgress:u}=t;function c(){let p=typeof l=="string"?document.querySelector(l):l??null;return p?p.clientWidth:window.innerWidth}function f(){return t.distance??n.scrollWidth-c()}function g(){if(t.triggerElement!==void 0){let p=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(p)return p;_("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let p=n.parentElement;p;p=p.parentElement)if(window.getComputedStyle(p).position==="sticky")return p.parentElement??p;return n}let E=f(),$=g(),b=ee(n,P(E,$));function P(p,C){return {props:{transform:["translateX(0px)",`translateX(${-p}px)`]},trigger:i,easing:a,native:false,respectReducedMotion:m,...C!==n&&{triggerElement:C},...l!==void 0&&{scrollContainer:l},...u!==void 0&&{onProgress:u}}}return {destroy(){b.destroy();},replay(){b.replay();},pause(){b.pause();},resume(){b.resume();},seek(p){b.seek(p);},getProgress(){return b.getProgress()},refresh(){b.destroy(),E=f(),$=g(),b=ee(n,P(E,$));}}}export{ot as scrollHorizontal};
1
+ import {a}from'../chunk-QJ4H2HW3.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var E={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function z(l,t={}){if(typeof window>"u")return E;let c=typeof l=="string"?document.querySelector(l):l;if(!c)return b("scrollHorizontal: track element not found:",l),E;let n=c,{easing:y="linear",trigger:b$1={start:"top top",end:"bottom bottom"},scrollContainer:o,respectReducedMotion:S=false,onProgress:m}=t;function w(){let e=typeof o=="string"?document.querySelector(o):o??null;return e?e.clientWidth:window.innerWidth}function u(){return t.distance??n.scrollWidth-w()}function d(){if(t.triggerElement!==void 0){let e=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(e)return e;b("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let e=n.parentElement;e;e=e.parentElement)if(window.getComputedStyle(e).position==="sticky")return e.parentElement??e;return n}let i=u(),s=d(),r=a(n,f(i,s));function f(e,p){return {props:{transform:["translateX(0px)",`translateX(${-e}px)`]},trigger:b$1,easing:y,native:false,respectReducedMotion:S,...p!==n&&{triggerElement:p},...o!==void 0&&{scrollContainer:o},...m!==void 0&&{onProgress:m}}}return {destroy(){r.destroy();},replay(){r.replay();},pause(){r.pause();},resume(){r.resume();},seek(e){r.seek(e);},getProgress(){return r.getProgress()},refresh(){r.destroy(),i=u(),s=d(),r=a(n,f(i,s));}}}export{z as scrollHorizontal};
@@ -0,0 +1,15 @@
1
+ import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-DHU1zNEw.mjs';
2
+
3
+ interface ScrollCounterOptions {
4
+ from?: number;
5
+ to: number;
6
+ format?: (value: number) => string;
7
+ easing?: EasingName | ((t: number) => number);
8
+ trigger?: TriggerConfig;
9
+ once?: boolean;
10
+ decimals?: number;
11
+ onComplete?: () => void;
12
+ }
13
+ declare function scrollCounter(target: string | Element, options: ScrollCounterOptions): ScrollDrawInstance;
14
+
15
+ export { type ScrollCounterOptions as S, scrollCounter as s };
@@ -0,0 +1,14 @@
1
+ import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-DHU1zNEw.js';
2
+ import { S as ScrollAnimateOptions } from './engine-6AXEX8CL.js';
3
+
4
+ interface ScrollParallaxOptions {
5
+ speed?: number;
6
+ axis?: 'x' | 'y';
7
+ easing?: EasingName | ((t: number) => number);
8
+ trigger?: TriggerConfig;
9
+ onProgress?: (alpha: number) => void;
10
+ }
11
+ declare function scrollAnimate(target: string | Element, options: ScrollAnimateOptions): ScrollDrawInstance;
12
+ declare function scrollParallax(target: string | Element, options?: ScrollParallaxOptions): ScrollDrawInstance;
13
+
14
+ export { type ScrollParallaxOptions as S, scrollParallax as a, scrollAnimate as s };
@@ -0,0 +1,14 @@
1
+ import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-DHU1zNEw.mjs';
2
+ import { S as ScrollAnimateOptions } from './engine-Ci08nM91.mjs';
3
+
4
+ interface ScrollParallaxOptions {
5
+ speed?: number;
6
+ axis?: 'x' | 'y';
7
+ easing?: EasingName | ((t: number) => number);
8
+ trigger?: TriggerConfig;
9
+ onProgress?: (alpha: number) => void;
10
+ }
11
+ declare function scrollAnimate(target: string | Element, options: ScrollAnimateOptions): ScrollDrawInstance;
12
+ declare function scrollParallax(target: string | Element, options?: ScrollParallaxOptions): ScrollDrawInstance;
13
+
14
+ export { type ScrollParallaxOptions as S, scrollParallax as a, scrollAnimate as s };
@@ -0,0 +1,15 @@
1
+ import { E as EasingName, T as TriggerConfig, S as ScrollDrawInstance } from './types-DHU1zNEw.js';
2
+
3
+ interface ScrollCounterOptions {
4
+ from?: number;
5
+ to: number;
6
+ format?: (value: number) => string;
7
+ easing?: EasingName | ((t: number) => number);
8
+ trigger?: TriggerConfig;
9
+ once?: boolean;
10
+ decimals?: number;
11
+ onComplete?: () => void;
12
+ }
13
+ declare function scrollCounter(target: string | Element, options: ScrollCounterOptions): ScrollDrawInstance;
14
+
15
+ export { type ScrollCounterOptions as S, scrollCounter as s };
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';function zt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Et({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(n),a=0,d=[];for(let f=0;f<t;f++){let x=Math.pow(l,f);d.push(x),a+=x;}let m=[0],c=0;for(let f=0;f<t;f++)c+=d[f]/a,m.push(c);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let x=0;x<t;x++)if(f<=m[x+1]){let D=(f-m[x])/(m[x+1]-m[x]);if(x===0)return D*(2-D);let A=1-Math.pow(n,x);return A+(1-A)*(2*D-1)*(2*D-1)}return 1}}function xt({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),l=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-l)*(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:Et(),elastic:xt()};function $e(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 wt(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 vt(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 Ve(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 qt(e,r,t){return Math.min(t,Math.max(r,e))}function le(e,r,t,n){return t===r?0:qt((e-r)/(t-r)*n,0,1)}function Ze(e,r,t){let n=e.getBoundingClientRect(),l=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left+r.scrollLeft:n.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:t==="x"?n.left:n.top,height:l,scroll:t==="x"?window.scrollX:window.scrollY}}function Fe(e,r,t,n,l){let a=wt(e.top,e.height,r,n.element)-vt(n.viewport,t),d=wt(e.top,e.height,r,l.element)-vt(l.viewport,t);return {tStart:a,tEnd:d}}function St(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 ze(e,r,t){let n=St(e),l=St(r);return !n||!l?e:`rgb(${Math.round(n[0]+(l[0]-n[0])*t)},${Math.round(n[1]+(l[1]-n[1])*t)},${Math.round(n[2]+(l[2]-n[2])*t)})`}var it={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 K(e,...r){Be&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Wt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Bt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Tt=33;function Gt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function jt(e){let r=[];for(let t=0;t<Tt;t++){let n=t/(Tt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function Ke(e){switch(e){case "linear":return "linear";case "ease-in":return Wt;case "ease-out":return Bt;case "ease-in-out":return Gt()?jt(Z["ease-in-out"]):null;default:return null}}var At=Symbol.for("svg-scroll-draw.registry");function $t(){let e=globalThis;return e[At]||(e[At]=new Map)}function Me(e,r){$t().set(e,r);}function Pe(e){$t().delete(e);}var Yt=0;function Ut(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Mt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Pt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Xt(e){if(!Be)return;let r=Mt(e,"stroke");if(!r||r==="none"){K("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Pt.has(t)&&!Pt.has(Mt(e,"fill"))&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Qt(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 l(){let a=t==="x"?window.scrollX:window.scrollY,d=e-a,m=r-a,c=t==="x";n.innerHTML=`
1
+ 'use strict';function qt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function vt({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(n),a=0,d=[];for(let f=0;f<t;f++){let x=Math.pow(l,f);d.push(x),a+=x;}let m=[0],c=0;for(let f=0;f<t;f++)c+=d[f]/a,m.push(c);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let x=0;x<t;x++)if(f<=m[x+1]){let I=(f-m[x])/(m[x+1]-m[x]);if(x===0)return I*(2-I);let A=1-Math.pow(n,x);return A+(1-A)*(2*I-1)*(2*I-1)}return 1}}function St({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),l=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-l)*(2*Math.PI)/n)+1}var K={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:vt(),elastic:St()};function Et(e,r,t){return Math.min(t,Math.max(r,e))}function $e(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 xt(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 Tt(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 le(e,r,t,n){return t===r?0:Et((e-r)/(t-r)*n,0,1)}function Fe(e,r,t,n,l){let a=xt(e.top,e.height,r,n.element)-Tt(n.viewport,t),d=xt(e.top,e.height,r,l.element)-Tt(l.viewport,t);return {tStart:a,tEnd:d}}function Ze(e,r,t){let n=e.getBoundingClientRect(),l=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left+r.scrollLeft:n.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:t==="x"?n.left:n.top,height:l,scroll:t==="x"?window.scrollX:window.scrollY}}function Ve(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 At(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 ze(e,r,t){let n=At(e),l=At(r);return !n||!l?e:`rgb(${Math.round(n[0]+(l[0]-n[0])*t)},${Math.round(n[1]+(l[1]-n[1])*t)},${Math.round(n[2]+(l[2]-n[2])*t)})`}var it={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 j(e,...r){Be&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Wt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Bt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",$t=33;function Gt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function jt(e){let r=[];for(let t=0;t<$t;t++){let n=t/($t-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function Ke(e){switch(e){case "linear":return "linear";case "ease-in":return Wt;case "ease-out":return Bt;case "ease-in-out":return Gt()?jt(K["ease-in-out"]):null;default:return null}}var Mt=Symbol.for("svg-scroll-draw.registry");function Pt(){let e=globalThis;return e[Mt]||(e[Mt]=new Map)}function Me(e,r){Pt().set(e,r);}function Pe(e){Pt().delete(e);}var Yt=0;function Ut(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function kt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Lt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Xt(e){if(!Be)return;let r=kt(e,"stroke");if(!r||r==="none"){j("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Lt.has(t)&&!Lt.has(kt(e,"fill"))&&j("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Qt(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 l(){let a=t==="x"?window.scrollX:window.scrollY,d=e-a,m=r-a,c=t==="x";n.innerHTML=`
2
2
  <div style="position:absolute;${c?`left:${d}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${d}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;${c?`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",l,{passive:true}),l(),{el:n,destroy(){window.removeEventListener("scroll",l),n.remove();}}}var kt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Lt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Zt(e,r,t){if(!Be)return;let n=(e.match(Lt)??[]).join("").toUpperCase(),l=(r.match(Lt)??[]).join("").toUpperCase(),a=(e.match(kt)??[]).length,d=(r.match(kt)??[]).length;if(n!==l){K(`morphTo: command sequence differs (${n||"\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.`,t);return}a!==d&&K(`morphTo: coordinate count differs (${a} \u2192 ${d}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function at(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let d=parseFloat(a),m=n[l++]??d;return String(+(d+(m-d)*t).toFixed(4))})}function Ct(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:t,...n}=r,l=t?{...it[t],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:f="linear",trigger:x={},stagger:D=0,direction:A="forward",once:J=false,debug:Ee=false,axis:S="y",scrollContainer:$,autoReverse:g=false,delay:E=0,strokeColor:b,strokeWidth:z,fillOpacity:F,waypoints:B,velocityScale:ee=false,threshold:ge=0,rootMargin:j="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ye,autoplay:Le=false,duration:Ce=1e3,native:Ie=true,onProgress:w,onStart:P,onComplete:ne,onEnter:he,onLeave:Ne,onEnterBack:be,onLeaveBack:xe}=l,te=ye===true?"left":typeof ye=="string"?ye:false,me=typeof f=="function"?f:Z[f]??Z.linear,we=$e(x.start??"top bottom"),He=$e(x.end??"bottom top"),ce=typeof $=="string"?document.querySelector($):$??null,ue=Array.isArray(b)?b[0]:null,Y=Array.isArray(b)?b[1]:typeof b=="string"?b:null,U=Array.isArray(z)?z[0]:null,H=Array.isArray(z)?z[1]:typeof z=="number"?z:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function ve(o){let i=o*100;switch(te){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 C=te?[]:Array.from(e.querySelectorAll(d)),T=[],s=[],u=0,oe=0,k=false,I=false,O=0,pe=false,se=-1,G=-1,_=false,ie=0,Te=0,De,tt=null;function mt(){tt?.destroy(),tt=null;}let Oe=new Set,ft=NaN,Re=true,Ge=-1,pt=performance.now(),_e=NaN;function rt(){return ce?S==="x"?ce.scrollLeft:ce.scrollTop:S==="x"?window.scrollX:window.scrollY}function dt(){return ce?S==="x"?ce.clientWidth:ce.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function gt(){let o=Ze(e,ce,S);return Fe(o,o.scroll,dt(),we,He)}function yt(){(({tStart:u,tEnd:oe}=gt())),Ee&&Be&&(mt(),tt=Qt(u,oe,S));}function nt(o,i=gt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e);},o}function Nt(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=i==="reverse"?1-o:o;e.style.clipPath=ve(h);return}C.forEach((h,X)=>{h.style.strokeDashoffset=i==="reverse"?`${T[X]*o}`:`${T[X]*(1-o)}`,c&&(h.style.opacity=i==="reverse"?`${1-o}`:`${o}`),ue&&Y?h.style.stroke=ze(ue,Y,o):Y&&(h.style.stroke=Y),U!==null&&H!==null?h.style.strokeWidth=`${U+(H-U)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[X]&&h.setAttribute("d",at(s[X],N,o));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=ve(0);return}C.forEach((o,i)=>{o.style.strokeDasharray=`${T[i]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${T[i]}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[i]&&o.setAttribute("d",s[i]);});}if(C.forEach(o=>{Xt(o);let i=Ve(o);T.push(i);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?Zt(s[s.length-1],N,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?`${i}`:"0",c&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?"0":`${i}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(a)return e.style.clipPath=ve(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ve(0);}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ht=typeof f=="string"?Ke(f):null;function Ht(){return !(Ie===false||!Ut()||!C.length||!ht||te||S!=="y"||ce||m!==1||D!==0||J||g||ee!==false||N||B||q||E>0||w||P||ne||he||Ne||be||xe||b!=null||z!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function _t(){let o=++Yt,i=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,X=`--svg-scroll-draw-${o}`,Ae=A==="reverse"?"0":"var(--ssd-len)",Se=A==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(de+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${i}{from{${de}}to{${v}}}.${h}{view-timeline-name:${X};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ht};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Q(p,V){p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(i);}C.forEach(Q);let y=false,L=-1;function R(){if(L>=0)return L;let p=e.getBoundingClientRect(),{tStart:V,tEnd:fe}=Fe({top:p.top,height:p.height},rt(),dt(),we,He);return me(le(rt(),V,fe,m))}return {destroy(){e.classList.remove(h),C.forEach(p=>{p.classList.remove(i),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),M.remove();},replay(){y=false,L=-1,C.forEach(Q);},pause(){y=true,C.forEach(p=>{p.style.animationPlayState="paused";});},resume(){y&&(y=false,C.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let V=Math.min(1,Math.max(0,p));L=V,y=true,C.forEach((fe,ae)=>{fe.classList.remove(i),fe.style.strokeDashoffset=A==="reverse"?`${T[ae]*V}`:`${T[ae]*(1-V)}`,c&&(fe.style.opacity=A==="reverse"?`${1-V}`:`${V}`);});},getProgress(){return R()},refresh(){C.forEach((p,V)=>{T[V]=Ve(p),p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`;});}}}if(Ht())return nt(_t());function Vt(){let o=Math.max(1,Ce),i=0,h=0,X=false;function Ae(y){let L=true;if(te){let R=Math.min(1,Math.max(0,y/o)),p=me(R);ie=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=ve(A==="reverse"?1-p:p),w?.(p),R<1&&(L=false);}else C.forEach((R,p)=>{let V=p*D*o,fe=Math.min(1,Math.max(0,(y-V)/o)),ae=me(fe);R.style.strokeDashoffset=A==="reverse"?`${T[p]*ae}`:`${T[p]*(1-ae)}`,c&&(R.style.opacity=A==="reverse"?`${1-ae}`:`${ae}`),ue&&Y?R.style.stroke=ze(ue,Y,ae):Y&&(R.style.stroke=Y),U!==null&&H!==null?R.style.strokeWidth=`${U+(H-U)*ae}`:H!==null&&(R.style.strokeWidth=`${H}`),re!==null&&W!==null?R.style.fillOpacity=`${re+(W-re)*ae}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[p]&&R.setAttribute("d",at(s[p],N,ae)),p===0&&(ie=ae,w?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),fe<1&&(L=false);});if(B){let R=Math.min(1,Math.max(0,y/o)),p=me(R);for(let V in B){let fe=parseFloat(V);p>=fe&&!Oe.has(fe)&&(Oe.add(fe),B[V]?.());}}return L}function Se(y){if(_)return;let L=y-i;I||(I=true,P?.());let R=Ae(L);if(R&&!k){k=true,Ae(o*(1+Math.max(0,C.length-1)*D)),ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,De=setTimeout(()=>{i=performance.now(),I=false,k=false,Oe.clear(),je(),O=requestAnimationFrame(Se);},ke));return}R||(O=requestAnimationFrame(Se));}function de(){cancelAnimationFrame(O),clearTimeout(De),i=performance.now(),h=0,_=false,I=false,k=false,Te=0,X=true,ie=0,Oe.clear(),je(),O=requestAnimationFrame(Se);}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?de():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(O),clearTimeout(De),X=false);});},{root:ce??null,threshold:ge,rootMargin:j}),M;function Q(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(De),v.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(M);},replay(){Te=0,de();},pause(){_||!X||(_=true,h=performance.now()-i,cancelAnimationFrame(O));},resume(){_&&(_=false,X=true,i=performance.now()-h,O=requestAnimationFrame(Se));},seek(y){let L=Math.min(1,Math.max(0,y));ie=L,_=true,h=L*o,i=performance.now()-h,cancelAnimationFrame(O),Ae(h);},getProgress(){return ie},refresh(){clearTimeout(M),C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`;});}}}if(Le)return nt(Vt());yt();function Ye(){if(!pe||_)return;let o=performance.now(),i=rt();if(!Re&&ee===false&&i===ft){O=requestAnimationFrame(Ye);return}Re=false,ft=i;let h=m;if(ee!==false){let v=o-pt,M=v>0?Math.abs(i-(Ge<0?i:Ge))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04);}Ge=i,pt=o;let X=g?G===-1||i>=G?"forward":"reverse":A;G=i;let Ae=oe-u,Se=true,de=Ae===0?0:(i-u)/Ae;if(isNaN(_e)||(_e<=0&&de>0?he?.():_e>0&&de<=0&&xe?.(),_e<1&&de>=1?Ne?.():_e>=1&&de<1&&be?.()),_e=de,te){let v=me(le(i,u,oe,h));J&&!g&&(se=Math.max(se,v),v=se),ie=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=X==="reverse"?1-v:v;e.style.clipPath=ve(M),w?.(v),!I&&le(i,u,oe,h)>0&&(I=true,P?.()),v>=1&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,De=setTimeout(()=>{se=-1,I=false,k=false,e.style.clipPath=ve(0);},ke))):v<1&&!J&&(k=false),O=requestAnimationFrame(Ye);return}if(C.forEach((v,M)=>{let Q=M*D*Ae,y=me(le(i,u+Q,oe+Q,h));J&&!g&&(se=Math.max(se,y),y=se),ie=y,v.style.strokeDashoffset=X==="reverse"?`${T[M]*y}`:`${T[M]*(1-y)}`,c&&(v.style.opacity=X==="reverse"?`${1-y}`:`${y}`),ue&&Y?v.style.stroke=ze(ue,Y,y):Y&&(v.style.stroke=Y),U!==null&&H!==null?v.style.strokeWidth=`${U+(H-U)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",at(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=false);}),B){let v=me(le(i,u,oe,h));for(let M in B){let Q=parseFloat(M);v>=Q&&!Oe.has(Q)&&(Oe.add(Q),B[M]?.());}}!I&&le(i,u,oe,h)>0&&(I=true,P?.()),Se&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,De=setTimeout(()=>{se=-1,I=false,k=false,Oe.clear(),je(),Re=true;},ke))):!Se&&!J&&(k=false),O=requestAnimationFrame(Ye);}let ot=false;function Ue(){ot||(ot=true,O=requestAnimationFrame(function(){Ye();}));}function Xe(){ot=false,cancelAnimationFrame(O);}let st=new IntersectionObserver(o=>{o.forEach(i=>{pe=i.isIntersecting,pe&&!_?(Re=true,Ue()):Xe();});},{root:ce??null,threshold:ge,rootMargin:j});function bt(){C.forEach((o,i)=>{T[i]=Ve(o),o.style.strokeDasharray=`${T[i]}`;}),yt(),Re=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(bt,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)),E>0?setTimeout(()=>st.observe(e),E):st.observe(e),nt({destroy(){cancelAnimationFrame(O),clearTimeout(De),Xe(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),mt();},replay(){se=-1,G=-1,Ge=-1,I=false,k=false,Te=0,_=false,ie=0,Oe.clear(),clearTimeout(De),je(),Re=true,pe&&Ue();},pause(){_=true,Xe();},resume(){_&&(_=false,Re=true,pe&&Ue());},seek(o){let i=Math.min(1,Math.max(0,o));ie=i,se=i,_=true,Xe(),Nt(i,A),Re=true;},getProgress(){return ie},refresh(){clearTimeout(Qe),bt(),pe&&!_&&Ue();}},()=>({tStart:u,tEnd:oe}))}function Kt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function It(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let l=[],a=[],d=n[2].trim();if(d)for(let m of d.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"");}r.push({fn:n[1],nums:l,units:a});}return r}function Jt(e,r,t){let n=It(e),l=It(r);return n.length===0||n.length!==l.length?t<1?e:r:n.map((a,d)=>{let m=l[d];return a.fn!==m.fn||a.nums.length!==m.nums.length?t<1?`${a.fn}(${a.nums.map((c,f)=>`${c}${a.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,f)=>`${c}${m.units[f]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,f)=>`${c+(m.nums[f]-c)*t}${a.units[f]}`).join(", ")})`}).join(" ")}function Dt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),l=String(r);if(Kt(n))return ze(n,l,t);if(n.includes("("))return Jt(n,l,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),d=l.match(/^([-+]?[\d.]+)(.*)$/);if(a&&d){let m=parseFloat(a[1]),c=parseFloat(d[1]);return `${m+(c-m)*t}${a[2]||d[2]}`}return t<1?n:l}function er(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var tr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rr=0,Ot="--scroll-draw-progress";function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Rt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:n,trigger:l={},easing:a="ease-out",speed:d=1,once:m=false,axis:c="y",scrollContainer:f,native:x=true,velocityScale:D=false,respectReducedMotion:A=true,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=r,z=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:Z[a]??Z["ease-out"],B=$e(l.start??"top bottom"),ee=$e(l.end??"bottom top"),ge=J??e,j=typeof f=="string"?document.querySelector(f):f??null,q=Object.entries(n).map(([s,u])=>({prop:er(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0");}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to));}let ye=new Map;for(let s of [...q.map(u=>u.prop),Ot])ye.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ye)u?e.style.setProperty(s,u):e.style.removeProperty(s);}if(z)return N(),S?.(),{...t,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Ke(a):null;function Ie(){if(!x||!nr()||!Ce||c!=="y"||j||ge!==e||m||d!==1||Ee||S||$||g||E||b||D!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let s of q)if(!tr.has(s.prop))return false;return true}function w(){let s=`ssd-a-${++rr}`,u=q.map(G=>`${G.prop}:${G.from}`).join(";"),oe=q.map(G=>`${G.prop}:${G.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let I=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight,pe=()=>{let G=e.getBoundingClientRect();return Fe({top:G.top,height:G.height},I(),O(),B,ee)};Me(e,{type:"animate",getProgress:()=>se.getProgress(),getTrigger:pe});let se={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e);},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(G){let _=Math.min(1,Math.max(0,G));e.classList.remove(s);for(let ie of q)e.style.setProperty(ie.prop,Dt(ie.from,ie.to,_));},getProgress(){let{tStart:G,tEnd:_}=pe();return F(le(I(),G,_,d))}};return se}if(Ie())return w();let P=0,ne=0,he=0,Ne=false,be=false,xe=-1,te=0,me=false,we=NaN,He=-1,ce=0,ue=()=>j?c==="x"?j.scrollLeft:j.scrollTop:c==="x"?window.scrollX:window.scrollY,Y=()=>j?c==="x"?j.clientWidth:j.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function U(){let s=Ze(ge,j,c),u=Fe(s,s.scroll,Y(),B,ee);P=u.tStart,ne=u.tEnd;}function H(s){e.style.setProperty(Ot,String(s));for(let u of q)e.style.setProperty(u.prop,Dt(u.from,u.to,s));Ee?.(s);}function re(s){if(isNaN(we)){we=s;return}we<=0&&s>0?$?.():we>0&&s<=0&&b?.(),we<1&&s>=1?g?.():we>=1&&s<1&&E?.(),we=s;}function W(){if(!Ne||be)return;let s=performance.now(),u=ue(),oe=d;if(D!==false){let O=s-ce,pe=O>0?Math.abs(u-(He<0?u:He))/O:0;oe=d*Math.max(.2,1+pe*(typeof D=="number"?D:1)*.04);}He=u,ce=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let I=F(le(u,P,ne,oe));m&&(xe=Math.max(xe,I),I=xe),te=I,H(I),I>=1&&!me?(me=true,S?.()):I<1&&!m&&(me=false),he=requestAnimationFrame(W);}U(),ne===P&&K("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 s=F(le(ue(),P,ne,d));m&&s>0&&(xe=s),te=s,H(s);}let ve=new IntersectionObserver(s=>{s.forEach(u=>{Ne=u.isIntersecting,Ne&&!be?he=requestAnimationFrame(W):cancelAnimationFrame(he);});},{root:j??null}),C;function T(){clearTimeout(C),C=setTimeout(U,150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ve.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(he),ve.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(C),Le(),Pe(e);},replay(){xe=-1,me=false,te=0,be=false,H(0);},pause(){be=true,cancelAnimationFrame(he);},resume(){be&&(be=false,Ne&&(he=requestAnimationFrame(W)));},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,be=true,cancelAnimationFrame(he),H(u);},getProgress(){return te}}}var Je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,r){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;return t?Rt(t,r):(K("scrollAnimate: element not found:",e),Je)}function sr(e,r={}){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return K("scrollParallax: element not found:",e),Je;let{speed:n=.3,axis:l="y",easing:a="linear",trigger:d,onProgress:m}=r,c=t.getBoundingClientRect(),f=l==="x"?c.width:c.height,x=n*f;return Rt(t,{props:l==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m})}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ir(e,r){if(typeof window>"u")return lt;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return K("scrollCounter: element not found:",e),lt;let n=t,{from:l=0,to:a,format:d,easing:m="ease-out",trigger:c={},once:f=true,decimals:x,onComplete:D}=r,A=x!==void 0?w=>w.toFixed(x):d??(w=>String(Math.round(w))),J=typeof m=="function"?m:Z[m]??Z["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=A(a),D?.(),lt;let g=0,E=0,b=0,z=false,F=false,B=-1,ee=0,ge=false,j=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Fe({top:w.top,height:w.height},j(),q(),Ee,S);g=P.tStart,E=P.tEnd;}function N(w){n.textContent=A(l+(a-l)*w),n.style.setProperty("--scroll-draw-progress",String(w));}function ye(){if(!z||F)return;let w=J(le(j(),g,E,1));f&&(B=Math.max(B,w),w=B),ee=w,N(w),w>=1&&!ge?(ge=true,D?.()):w<1&&!f&&(ge=false),b=requestAnimationFrame(ye);}ke();{let w=J(le(j(),g,E,1));f&&w>0&&(B=w),ee=w,N(w);}let Le=new IntersectionObserver(w=>{w.forEach(P=>{z=P.isIntersecting,z&&!F?b=requestAnimationFrame(ye):cancelAnimationFrame(b);});}),Ce;function Ie(){clearTimeout(Ce),Ce=setTimeout(ke,150);}return window.addEventListener("resize",Ie),window.addEventListener("orientationchange",Ie),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",Ie),window.removeEventListener("orientationchange",Ie),clearTimeout(Ce),Pe(n);},replay(){B=-1,ge=false,ee=0,F=false,N(0);},pause(){F=true,cancelAnimationFrame(b);},resume(){F&&(F=false,z&&(b=requestAnimationFrame(ye)));},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,B=P,F=true,cancelAnimationFrame(b),N(P);},getProgress(){return ee}}}var Ft="http://www.w3.org/2000/svg",ar="cinematic-photo",ct=e=>e<0?0:e>1?1:e;function et(e){let r=parseFloat(e);return Number.isFinite(r)?ct(r/100):0}function lr(e){return Z[e]??Z.linear}var cr={destroy:()=>{},getProgress:()=>0},ut=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||K("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return cr;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 l=[];for(let S of r.scenes){if(S.background){let g=document.createElement("img");g.id=ar,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(Ft,"svg");g.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(Ft,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let z=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(z),b.style.strokeDashoffset=String(z),g.appendChild(b),l.push({kind:"draw",el:b,start:et(E.start),end:et(E.end),ease:lr(E.easing),length:z});}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),l.push({kind:"fade",el:E,start:et(g.start),end:et(g.end),ease:Z["ease-in-out"]??Z.linear,from:g.from,to:g.to}));}}let a=0,d=()=>{let S=t.offsetHeight-window.innerHeight;return S<=0?t.getBoundingClientRect().top<=0?1:0:ct(-t.getBoundingClientRect().top/S)},m=S=>{for(let $ of l){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:ct((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,f=false,x=false,D=()=>{a=d(),m(a),f&&(c=requestAnimationFrame(D));},A=()=>{f||(f=true,c=requestAnimationFrame(D));},J=()=>{f=false,cancelAnimationFrame(c);},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?A():J();},{threshold:0});return Ee.observe(n),a=d(),m(a),Me(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=t.getBoundingClientRect().top+window.scrollY;return {tStart:S,tEnd:S+Math.max(0,t.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(t);},getProgress:()=>a}}};function Nr(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?Ct(n,r):(K("Container not found:",e),t)}
4
- exports.Cinematic=ut;exports.PRESETS=it;exports.createBounce=Et;exports.createElastic=xt;exports.createSpring=zt;exports.scrollAnimate=or;exports.scrollCounter=ir;exports.scrollDraw=Nr;exports.scrollParallax=sr;
3
+ <div style="position:absolute;${c?`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",l,{passive:true}),l(),{el:n,destroy(){window.removeEventListener("scroll",l),n.remove();}}}var Ct=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Zt(e,r,t){if(!Be)return;let n=(e.match(Dt)??[]).join("").toUpperCase(),l=(r.match(Dt)??[]).join("").toUpperCase(),a=(e.match(Ct)??[]).length,d=(r.match(Ct)??[]).length;if(n!==l){j(`morphTo: command sequence differs (${n||"\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.`,t);return}a!==d&&j(`morphTo: coordinate count differs (${a} \u2192 ${d}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function at(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let d=parseFloat(a),m=n[l++]??d;return String(+(d+(m-d)*t).toFixed(4))})}function It(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:t,...n}=r,l=t?{...it[t],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:f="linear",trigger:x={},stagger:I=0,direction:A="forward",once:J=false,debug:Ee=false,axis:S="y",scrollContainer:$,autoReverse:g=false,delay:E=0,strokeColor:b,strokeWidth:z,fillOpacity:F,waypoints:B,velocityScale:ee=false,threshold:ge=0,rootMargin:Y="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ye,autoplay:Le=false,duration:Ce=1e3,native:De=true,onProgress:w,onStart:P,onComplete:ne,onEnter:he,onLeave:Ne,onEnterBack:be,onLeaveBack:xe}=l,te=ye===true?"left":typeof ye=="string"?ye:false,me=typeof f=="function"?f:K[f]??K.linear,we=$e(x.start??"top bottom"),He=$e(x.end??"bottom top"),ce=typeof $=="string"?document.querySelector($):$??null,ue=Array.isArray(b)?b[0]:null,U=Array.isArray(b)?b[1]:typeof b=="string"?b:null,X=Array.isArray(z)?z[0]:null,H=Array.isArray(z)?z[1]:typeof z=="number"?z:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function ve(o){let i=o*100;switch(te){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 C=te?[]:Array.from(e.querySelectorAll(d)),T=[],s=[],u=0,oe=0,k=false,D=false,O=0,pe=false,se=-1,G=-1,_=false,ie=0,Te=0,Ie,tt=null;function ft(){tt?.destroy(),tt=null;}let Oe=new Set,pt=NaN,Re=true,Ge=-1,dt=performance.now(),_e=NaN;function rt(){return ce?S==="x"?ce.scrollLeft:ce.scrollTop:S==="x"?window.scrollX:window.scrollY}function gt(){return ce?S==="x"?ce.clientWidth:ce.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function yt(){let o=Ze(e,ce,S);return Fe(o,o.scroll,gt(),we,He)}function ht(){(({tStart:u,tEnd:oe}=yt())),Ee&&Be&&(ft(),tt=Qt(u,oe,S));}function nt(o,i=yt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e);},o}function Ht(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=i==="reverse"?1-o:o;e.style.clipPath=ve(h);return}C.forEach((h,Q)=>{h.style.strokeDashoffset=i==="reverse"?`${T[Q]*o}`:`${T[Q]*(1-o)}`,c&&(h.style.opacity=i==="reverse"?`${1-o}`:`${o}`),ue&&U?h.style.stroke=ze(ue,U,o):U&&(h.style.stroke=U),X!==null&&H!==null?h.style.strokeWidth=`${X+(H-X)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[Q]&&h.setAttribute("d",at(s[Q],N,o));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=ve(0);return}C.forEach((o,i)=>{o.style.strokeDasharray=`${T[i]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${T[i]}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[i]&&o.setAttribute("d",s[i]);});}if(C.forEach(o=>{Xt(o);let i=Ve(o);T.push(i);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?Zt(s[s.length-1],N,o):j(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?`${i}`:"0",c&&(o.style.opacity="1"),U&&(o.style.stroke=U),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?"0":`${i}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(a)return e.style.clipPath=ve(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ve(0);}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let bt=typeof f=="string"?Ke(f):null;function _t(){return !(De===false||!Ut()||!C.length||!bt||te||S!=="y"||ce||m!==1||I!==0||J||g||ee!==false||N||B||q||E>0||w||P||ne||he||Ne||be||xe||b!=null||z!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Vt(){let o=++Yt,i=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,Q=`--svg-scroll-draw-${o}`,Ae=A==="reverse"?"0":"var(--ssd-len)",Se=A==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(de+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${i}{from{${de}}to{${v}}}.${h}{view-timeline-name:${Q};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${bt};animation-fill-mode:both;animation-timeline:${Q};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Z(p,V){p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(i);}C.forEach(Z);let y=false,L=-1;function R(){if(L>=0)return L;let p=e.getBoundingClientRect(),{tStart:V,tEnd:fe}=Fe({top:p.top,height:p.height},rt(),gt(),we,He);return me(le(rt(),V,fe,m))}return {destroy(){e.classList.remove(h),C.forEach(p=>{p.classList.remove(i),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),M.remove();},replay(){y=false,L=-1,C.forEach(Z);},pause(){y=true,C.forEach(p=>{p.style.animationPlayState="paused";});},resume(){y&&(y=false,C.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let V=Math.min(1,Math.max(0,p));L=V,y=true,C.forEach((fe,ae)=>{fe.classList.remove(i),fe.style.strokeDashoffset=A==="reverse"?`${T[ae]*V}`:`${T[ae]*(1-V)}`,c&&(fe.style.opacity=A==="reverse"?`${1-V}`:`${V}`);});},getProgress(){return R()},refresh(){C.forEach((p,V)=>{T[V]=Ve(p),p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`;});}}}if(_t())return nt(Vt());function zt(){let o=Math.max(1,Ce),i=0,h=0,Q=false;function Ae(y){let L=true;if(te){let R=Math.min(1,Math.max(0,y/o)),p=me(R);ie=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=ve(A==="reverse"?1-p:p),w?.(p),R<1&&(L=false);}else C.forEach((R,p)=>{let V=p*I*o,fe=Math.min(1,Math.max(0,(y-V)/o)),ae=me(fe);R.style.strokeDashoffset=A==="reverse"?`${T[p]*ae}`:`${T[p]*(1-ae)}`,c&&(R.style.opacity=A==="reverse"?`${1-ae}`:`${ae}`),ue&&U?R.style.stroke=ze(ue,U,ae):U&&(R.style.stroke=U),X!==null&&H!==null?R.style.strokeWidth=`${X+(H-X)*ae}`:H!==null&&(R.style.strokeWidth=`${H}`),re!==null&&W!==null?R.style.fillOpacity=`${re+(W-re)*ae}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[p]&&R.setAttribute("d",at(s[p],N,ae)),p===0&&(ie=ae,w?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),fe<1&&(L=false);});if(B){let R=Math.min(1,Math.max(0,y/o)),p=me(R);for(let V in B){let fe=parseFloat(V);p>=fe&&!Oe.has(fe)&&(Oe.add(fe),B[V]?.());}}return L}function Se(y){if(_)return;let L=y-i;D||(D=true,P?.());let R=Ae(L);if(R&&!k){k=true,Ae(o*(1+Math.max(0,C.length-1)*I)),ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{i=performance.now(),D=false,k=false,Oe.clear(),je(),O=requestAnimationFrame(Se);},ke));return}R||(O=requestAnimationFrame(Se));}function de(){cancelAnimationFrame(O),clearTimeout(Ie),i=performance.now(),h=0,_=false,D=false,k=false,Te=0,Q=true,ie=0,Oe.clear(),je(),O=requestAnimationFrame(Se);}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?de():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(O),clearTimeout(Ie),Q=false);});},{root:ce??null,threshold:ge,rootMargin:Y}),M;function Z(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Ie),v.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(M);},replay(){Te=0,de();},pause(){_||!Q||(_=true,h=performance.now()-i,cancelAnimationFrame(O));},resume(){_&&(_=false,Q=true,i=performance.now()-h,O=requestAnimationFrame(Se));},seek(y){let L=Math.min(1,Math.max(0,y));ie=L,_=true,h=L*o,i=performance.now()-h,cancelAnimationFrame(O),Ae(h);},getProgress(){return ie},refresh(){clearTimeout(M),C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`;});}}}if(Le)return nt(zt());ht();function Ye(){if(!pe||_)return;let o=performance.now(),i=rt();if(!Re&&ee===false&&i===pt){O=requestAnimationFrame(Ye);return}Re=false,pt=i;let h=m;if(ee!==false){let v=o-dt,M=v>0?Math.abs(i-(Ge<0?i:Ge))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04);}Ge=i,dt=o;let Q=g?G===-1||i>=G?"forward":"reverse":A;G=i;let Ae=oe-u,Se=true,de=Ae===0?0:(i-u)/Ae;if(isNaN(_e)||(_e<=0&&de>0?he?.():_e>0&&de<=0&&xe?.(),_e<1&&de>=1?Ne?.():_e>=1&&de<1&&be?.()),_e=de,te){let v=me(le(i,u,oe,h));J&&!g&&(se=Math.max(se,v),v=se),ie=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=Q==="reverse"?1-v:v;e.style.clipPath=ve(M),w?.(v),!D&&le(i,u,oe,h)>0&&(D=true,P?.()),v>=1&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=false,k=false,e.style.clipPath=ve(0);},ke))):v<1&&!J&&(k=false),O=requestAnimationFrame(Ye);return}if(C.forEach((v,M)=>{let Z=M*I*Ae,y=me(le(i,u+Z,oe+Z,h));J&&!g&&(se=Math.max(se,y),y=se),ie=y,v.style.strokeDashoffset=Q==="reverse"?`${T[M]*y}`:`${T[M]*(1-y)}`,c&&(v.style.opacity=Q==="reverse"?`${1-y}`:`${y}`),ue&&U?v.style.stroke=ze(ue,U,y):U&&(v.style.stroke=U),X!==null&&H!==null?v.style.strokeWidth=`${X+(H-X)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",at(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=false);}),B){let v=me(le(i,u,oe,h));for(let M in B){let Z=parseFloat(M);v>=Z&&!Oe.has(Z)&&(Oe.add(Z),B[M]?.());}}!D&&le(i,u,oe,h)>0&&(D=true,P?.()),Se&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=false,k=false,Oe.clear(),je(),Re=true;},ke))):!Se&&!J&&(k=false),O=requestAnimationFrame(Ye);}let ot=false;function Ue(){ot||(ot=true,O=requestAnimationFrame(function(){Ye();}));}function Xe(){ot=false,cancelAnimationFrame(O);}let st=new IntersectionObserver(o=>{o.forEach(i=>{pe=i.isIntersecting,pe&&!_?(Re=true,Ue()):Xe();});},{root:ce??null,threshold:ge,rootMargin:Y});function wt(){C.forEach((o,i)=>{T[i]=Ve(o),o.style.strokeDasharray=`${T[i]}`;}),ht(),Re=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(wt,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)),E>0?setTimeout(()=>st.observe(e),E):st.observe(e),nt({destroy(){cancelAnimationFrame(O),clearTimeout(Ie),Xe(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),ft();},replay(){se=-1,G=-1,Ge=-1,D=false,k=false,Te=0,_=false,ie=0,Oe.clear(),clearTimeout(Ie),je(),Re=true,pe&&Ue();},pause(){_=true,Xe();},resume(){_&&(_=false,Re=true,pe&&Ue());},seek(o){let i=Math.min(1,Math.max(0,o));ie=i,se=i,_=true,Xe(),Ht(i,A),Re=true;},getProgress(){return ie},refresh(){clearTimeout(Qe),wt(),pe&&!_&&Ue();}},()=>({tStart:u,tEnd:oe}))}function Kt(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?It(n,r):(j("Container not found:",e),t)}function Jt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ot(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let l=[],a=[],d=n[2].trim();if(d)for(let m of d.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"");}r.push({fn:n[1],nums:l,units:a});}return r}function er(e,r,t){let n=Ot(e),l=Ot(r);return n.length===0||n.length!==l.length?t<1?e:r:n.map((a,d)=>{let m=l[d];return a.fn!==m.fn||a.nums.length!==m.nums.length?t<1?`${a.fn}(${a.nums.map((c,f)=>`${c}${a.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,f)=>`${c}${m.units[f]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,f)=>`${c+(m.nums[f]-c)*t}${a.units[f]}`).join(", ")})`}).join(" ")}function Rt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),l=String(r);if(Jt(n))return ze(n,l,t);if(n.includes("("))return er(n,l,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),d=l.match(/^([-+]?[\d.]+)(.*)$/);if(a&&d){let m=parseFloat(a[1]),c=parseFloat(d[1]);return `${m+(c-m)*t}${a[2]||d[2]}`}return t<1?n:l}function tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,Ft="--scroll-draw-progress";function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function lt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:n,trigger:l={},easing:a="ease-out",speed:d=1,once:m=false,axis:c="y",scrollContainer:f,native:x=true,velocityScale:I=false,respectReducedMotion:A=true,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=r,z=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:K[a]??K["ease-out"],B=$e(l.start??"top bottom"),ee=$e(l.end??"bottom top"),ge=J??e,Y=typeof f=="string"?document.querySelector(f):f??null,q=Object.entries(n).map(([s,u])=>({prop:tr(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0");}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to));}let ye=new Map;for(let s of [...q.map(u=>u.prop),Ft])ye.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ye)u?e.style.setProperty(s,u):e.style.removeProperty(s);}if(z)return N(),S?.(),{...t,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Ke(a):null;function De(){if(!x||!or()||!Ce||c!=="y"||Y||ge!==e||m||d!==1||Ee||S||$||g||E||b||I!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let s of q)if(!rr.has(s.prop))return false;return true}function w(){let s=`ssd-a-${++nr}`,u=q.map(G=>`${G.prop}:${G.from}`).join(";"),oe=q.map(G=>`${G.prop}:${G.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let D=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight,pe=()=>{let G=e.getBoundingClientRect();return Fe({top:G.top,height:G.height},D(),O(),B,ee)};Me(e,{type:"animate",getProgress:()=>se.getProgress(),getTrigger:pe});let se={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e);},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(G){let _=Math.min(1,Math.max(0,G));e.classList.remove(s);for(let ie of q)e.style.setProperty(ie.prop,Rt(ie.from,ie.to,_));},getProgress(){let{tStart:G,tEnd:_}=pe();return F(le(D(),G,_,d))}};return se}if(De())return w();let P=0,ne=0,he=0,Ne=false,be=false,xe=-1,te=0,me=false,we=NaN,He=-1,ce=0,ue=()=>Y?c==="x"?Y.scrollLeft:Y.scrollTop:c==="x"?window.scrollX:window.scrollY,U=()=>Y?c==="x"?Y.clientWidth:Y.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function X(){let s=Ze(ge,Y,c),u=Fe(s,s.scroll,U(),B,ee);P=u.tStart,ne=u.tEnd;}function H(s){e.style.setProperty(Ft,String(s));for(let u of q)e.style.setProperty(u.prop,Rt(u.from,u.to,s));Ee?.(s);}function re(s){if(isNaN(we)){we=s;return}we<=0&&s>0?$?.():we>0&&s<=0&&b?.(),we<1&&s>=1?g?.():we>=1&&s<1&&E?.(),we=s;}function W(){if(!Ne||be)return;let s=performance.now(),u=ue(),oe=d;if(I!==false){let O=s-ce,pe=O>0?Math.abs(u-(He<0?u:He))/O:0;oe=d*Math.max(.2,1+pe*(typeof I=="number"?I:1)*.04);}He=u,ce=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let D=F(le(u,P,ne,oe));m&&(xe=Math.max(xe,D),D=xe),te=D,H(D),D>=1&&!me?(me=true,S?.()):D<1&&!m&&(me=false),he=requestAnimationFrame(W);}X(),ne===P&&j("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 s=F(le(ue(),P,ne,d));m&&s>0&&(xe=s),te=s,H(s);}let ve=new IntersectionObserver(s=>{s.forEach(u=>{Ne=u.isIntersecting,Ne&&!be?he=requestAnimationFrame(W):cancelAnimationFrame(he);});},{root:Y??null}),C;function T(){clearTimeout(C),C=setTimeout(X,150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ve.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(he),ve.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(C),Le(),Pe(e);},replay(){xe=-1,me=false,te=0,be=false,H(0);},pause(){be=true,cancelAnimationFrame(he);},resume(){be&&(be=false,Ne&&(he=requestAnimationFrame(W)));},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,be=true,cancelAnimationFrame(he),H(u);},getProgress(){return te}}}var Je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function sr(e,r){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;return t?lt(t,r):(j("scrollAnimate: element not found:",e),Je)}function ir(e,r={}){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return j("scrollParallax: element not found:",e),Je;let{speed:n=.3,axis:l="y",easing:a="linear",trigger:d,onProgress:m}=r,c=t.getBoundingClientRect(),f=l==="x"?c.width:c.height,x=n*f;return lt(t,{props:l==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m})}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ar(e,r){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return j("scrollCounter: element not found:",e),ct;let n=t,{from:l=0,to:a,format:d,easing:m="ease-out",trigger:c={},once:f=true,decimals:x,onComplete:I}=r,A=x!==void 0?w=>w.toFixed(x):d??(w=>String(Math.round(w))),J=typeof m=="function"?m:K[m]??K["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=A(a),I?.(),ct;let g=0,E=0,b=0,z=false,F=false,B=-1,ee=0,ge=false,Y=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Fe({top:w.top,height:w.height},Y(),q(),Ee,S);g=P.tStart,E=P.tEnd;}function N(w){n.textContent=A(l+(a-l)*w),n.style.setProperty("--scroll-draw-progress",String(w));}function ye(){if(!z||F)return;let w=J(le(Y(),g,E,1));f&&(B=Math.max(B,w),w=B),ee=w,N(w),w>=1&&!ge?(ge=true,I?.()):w<1&&!f&&(ge=false),b=requestAnimationFrame(ye);}ke();{let w=J(le(Y(),g,E,1));f&&w>0&&(B=w),ee=w,N(w);}let Le=new IntersectionObserver(w=>{w.forEach(P=>{z=P.isIntersecting,z&&!F?b=requestAnimationFrame(ye):cancelAnimationFrame(b);});}),Ce;function De(){clearTimeout(Ce),Ce=setTimeout(ke,150);}return window.addEventListener("resize",De),window.addEventListener("orientationchange",De),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",De),window.removeEventListener("orientationchange",De),clearTimeout(Ce),Pe(n);},replay(){B=-1,ge=false,ee=0,F=false,N(0);},pause(){F=true,cancelAnimationFrame(b);},resume(){F&&(F=false,z&&(b=requestAnimationFrame(ye)));},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,B=P,F=true,cancelAnimationFrame(b),N(P);},getProgress(){return ee}}}var Nt="http://www.w3.org/2000/svg",lr="cinematic-photo",ut=e=>e<0?0:e>1?1:e;function et(e){let r=parseFloat(e);return Number.isFinite(r)?ut(r/100):0}function cr(e){return K[e]??K.linear}var ur={destroy:()=>{},getProgress:()=>0},mt=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||j("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return ur;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 l=[];for(let S of r.scenes){if(S.background){let g=document.createElement("img");g.id=lr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(Nt,"svg");g.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(Nt,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let z=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(z),b.style.strokeDashoffset=String(z),g.appendChild(b),l.push({kind:"draw",el:b,start:et(E.start),end:et(E.end),ease:cr(E.easing),length:z});}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),l.push({kind:"fade",el:E,start:et(g.start),end:et(g.end),ease:K["ease-in-out"]??K.linear,from:g.from,to:g.to}));}}let a=0,d=()=>{let S=t.offsetHeight-window.innerHeight;return S<=0?t.getBoundingClientRect().top<=0?1:0:ut(-t.getBoundingClientRect().top/S)},m=S=>{for(let $ of l){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:ut((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,f=false,x=false,I=()=>{a=d(),m(a),f&&(c=requestAnimationFrame(I));},A=()=>{f||(f=true,c=requestAnimationFrame(I));},J=()=>{f=false,cancelAnimationFrame(c);},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?A():J();},{threshold:0});return Ee.observe(n),a=d(),m(a),Me(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=t.getBoundingClientRect().top+window.scrollY;return {tStart:S,tEnd:S+Math.max(0,t.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(t);},getProgress:()=>a}}};
4
+ exports.Cinematic=mt;exports.PRESETS=it;exports.createBounce=vt;exports.createElastic=St;exports.createSpring=qt;exports.scrollAnimate=sr;exports.scrollCounter=ar;exports.scrollDraw=Kt;exports.scrollParallax=ir;