svg-scroll-draw 2.23.6 → 2.23.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -649,9 +649,9 @@ devtools.highlight('#my-element'); // outline for 2 seconds
649
649
  <!-- size-table:start -->
650
650
  | Entry | Gzipped |
651
651
  |---|---|
652
- | `svg-scroll-draw` (main, every core API) | 11.4 KB |
652
+ | `svg-scroll-draw` (main, every core API) | 11.5 KB |
653
653
  | `svg-scroll-draw/react` (includes the engine) | 12.8 KB |
654
- | `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.3 KB |
654
+ | `svg-scroll-draw` + `svg-scroll-draw/react` (together; the engine ships once) | 14.4 KB |
655
655
  | `svg-scroll-draw/reveal` | 5.7 KB |
656
656
  | `svg-scroll-draw/text` | 3.5 KB |
657
657
  | `svg-scroll-draw/video` | 2.9 KB |
@@ -1221,17 +1221,17 @@ var SvgScrollDraw = (() => {
1221
1221
 
1222
1222
  // src/core/scroll-draw.ts
1223
1223
  function scrollDraw(target, options) {
1224
- const noop2 = { destroy: () => {
1224
+ const noop = { destroy: () => {
1225
1225
  }, replay: () => {
1226
1226
  }, pause: () => {
1227
1227
  }, resume: () => {
1228
1228
  }, seek: () => {
1229
1229
  }, getProgress: () => 0 };
1230
- if (typeof window === "undefined") return noop2;
1230
+ if (typeof window === "undefined") return noop;
1231
1231
  const container = typeof target === "string" ? document.querySelector(target) : target;
1232
1232
  if (!container) {
1233
1233
  warn("Container not found:", target);
1234
- return noop2;
1234
+ return noop;
1235
1235
  }
1236
1236
  return createEngine(container, options);
1237
1237
  }
@@ -1789,8 +1789,8 @@ var SvgScrollDraw = (() => {
1789
1789
  function easeOf(name) {
1790
1790
  return EASINGS[name] ?? EASINGS.linear;
1791
1791
  }
1792
- var noop = { destroy: () => {
1793
- }, getProgress: () => 0 };
1792
+ var still = (progress) => ({ destroy() {
1793
+ }, getProgress: () => progress });
1794
1794
  var Cinematic = class {
1795
1795
  constructor(options) {
1796
1796
  if (typeof document === "undefined") {
@@ -1802,7 +1802,7 @@ var SvgScrollDraw = (() => {
1802
1802
  }
1803
1803
  loadStory(story) {
1804
1804
  const mount = this.mount;
1805
- if (typeof window === "undefined" || !mount) return noop;
1805
+ if (typeof window === "undefined" || !mount) return still(0);
1806
1806
  mount.style.position = "relative";
1807
1807
  mount.style.height = story.totalHeight;
1808
1808
  mount.style.display = "block";
@@ -1860,17 +1860,30 @@ var SvgScrollDraw = (() => {
1860
1860
  el,
1861
1861
  start: parsePercent(a.start),
1862
1862
  end: parsePercent(a.end),
1863
- ease: EASINGS["ease-in-out"] ?? EASINGS.linear,
1863
+ ease: easeOf("ease-in-out"),
1864
1864
  from: a.from,
1865
1865
  to: a.to
1866
1866
  });
1867
1867
  }
1868
1868
  }
1869
1869
  let progress = 0;
1870
- const computeProgress2 = () => {
1871
- const scrollable = mount.offsetHeight - window.innerHeight;
1872
- if (scrollable <= 0) return mount.getBoundingClientRect().top <= 0 ? 1 : 0;
1873
- return clamp01(-mount.getBoundingClientRect().top / scrollable);
1870
+ let sc = null;
1871
+ for (let n = mount.parentElement; n?.parentElement; n = n.parentElement) {
1872
+ if (/[ao]/.test(getComputedStyle(n).overflowY) && n.scrollHeight > n.clientHeight && (n !== document.body || /[aoh]/.test(getComputedStyle(n.parentElement).overflowY))) {
1873
+ sc = n;
1874
+ break;
1875
+ }
1876
+ }
1877
+ let tStart = 0;
1878
+ let tEnd = 0;
1879
+ const measure = () => {
1880
+ const top = mount.getBoundingClientRect().top;
1881
+ tStart = sc ? top - sc.getBoundingClientRect().top - sc.clientTop + sc.scrollTop : top + window.scrollY;
1882
+ tEnd = tStart + Math.max(0, mount.offsetHeight - (sc ? sc.clientHeight : window.innerHeight));
1883
+ };
1884
+ const at = () => {
1885
+ const y = sc ? sc.scrollTop : window.scrollY;
1886
+ return tEnd <= tStart ? y >= tStart ? 1 : 0 : computeProgress(y, tStart, tEnd, 1);
1874
1887
  };
1875
1888
  const apply = (global) => {
1876
1889
  for (const r of records) {
@@ -1886,52 +1899,24 @@ var SvgScrollDraw = (() => {
1886
1899
  };
1887
1900
  if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
1888
1901
  apply(1);
1889
- return { destroy: () => {
1890
- }, getProgress: () => 1 };
1902
+ return still(1);
1891
1903
  }
1892
- let rafId = 0;
1893
- let running = false;
1894
- let visible = false;
1895
- const tick = () => {
1896
- progress = computeProgress2();
1904
+ const frame = () => {
1905
+ progress = at();
1897
1906
  apply(progress);
1898
- if (running) rafId = requestAnimationFrame(tick);
1899
- };
1900
- const start = () => {
1901
- if (running) return;
1902
- running = true;
1903
- rafId = requestAnimationFrame(tick);
1904
1907
  };
1905
- const stop = () => {
1906
- running = false;
1907
- cancelAnimationFrame(rafId);
1908
- };
1909
- const observer2 = new IntersectionObserver(
1910
- (entries) => {
1911
- for (const e of entries) {
1912
- visible = e.isIntersecting;
1913
- if (visible) start();
1914
- else stop();
1915
- }
1916
- },
1917
- { threshold: 0 }
1918
- );
1919
- observer2.observe(stage);
1920
- progress = computeProgress2();
1921
- apply(progress);
1908
+ measure();
1909
+ frame();
1910
+ const gate = frameGate(sc || window, [mount], at, frame, measure);
1922
1911
  _register(mount, {
1923
1912
  type: "draw",
1924
1913
  getProgress: () => progress,
1925
- getTrigger: () => {
1926
- const tStart = mount.getBoundingClientRect().top + window.scrollY;
1927
- return { tStart, tEnd: tStart + Math.max(0, mount.offsetHeight - window.innerHeight) };
1928
- }
1914
+ getTrigger: () => ({ tStart, tEnd })
1929
1915
  });
1930
1916
  const unwatchMotion = watchReducedMotion((reduced) => {
1931
1917
  if (!reduced) return;
1932
1918
  unwatchMotion();
1933
- stop();
1934
- observer2.disconnect();
1919
+ gate.off();
1935
1920
  _unregister(mount);
1936
1921
  progress = 1;
1937
1922
  apply(1);
@@ -1939,8 +1924,7 @@ var SvgScrollDraw = (() => {
1939
1924
  return {
1940
1925
  destroy() {
1941
1926
  unwatchMotion();
1942
- stop();
1943
- observer2.disconnect();
1927
+ gate.off();
1944
1928
  _unregister(mount);
1945
1929
  },
1946
1930
  getProgress: () => progress
@@ -1,3 +1,3 @@
1
- "use strict";var SvgScrollDraw=(()=>{var ht=Object.defineProperty;var dr=Object.getOwnPropertyDescriptor;var gr=Object.getOwnPropertyNames;var yr=Object.prototype.hasOwnProperty;var hr=(e,t)=>{for(var r in t)ht(e,r,{get:t[r],enumerable:!0})},br=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of gr(t))!yr.call(e,s)&&s!==r&&ht(e,s,{get:()=>t[s],enumerable:!(n=dr(t,s))||n.enumerable});return e};var wr=e=>br(ht({},"__esModule",{value:!0}),e);var Wr={};hr(Wr,{Cinematic:()=>ct,PRESETS:()=>et,createBounce:()=>wt,createElastic:()=>vt,createSpring:()=>bt,scrollAnimate:()=>nr,scrollCounter:()=>sr,scrollDraw:()=>Zt,scrollParallax:()=>or});function bt({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function wt({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),s=Math.sqrt(n),i=0,c=[];for(let f=0;f<r;f++){let h=Math.pow(s,f);c.push(h),i+=h}let m=[0],u=0;for(let f=0;f<r;f++)u+=c[f]/i,m.push(u);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let h=0;h<r;h++)if(f<=m[h+1]){let S=(f-m[h])/(m[h+1]-m[h]);if(h===0)return S*(2-S);let b=1-Math.pow(n,h);return b+(1-b)*(2*S-1)*(2*S-1)}return 1}}function vt({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),s=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-s)*(2*Math.PI)/n)+1}var U={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:bt(),bounce:wt(),elastic:vt()};function Ht(e,t,r){return Math.min(r,Math.max(t,e))}function Te(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return{element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return{element:r,viewport:n}}var Vt=(e,t)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:t;function Ft(e,t,r,n){return e+r+t*Vt(n,0)}function _t(e,t){return t*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Vt(e,1))}function X(e,t,r,n){return r===t?0:Ht((e-t)/(r-t)*n,0,1)}function ke(e,t,r,n,s){let i=Ft(e.top,e.height,t,n.element)-_t(n.viewport,r),c=Ft(e.top,e.height,t,s.element)-_t(s.viewport,r);return{tStart:i,tEnd:c}}function Ze(e,t,r){let n=e.getBoundingClientRect(),s=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:n.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:s,scroll:0}:{top:r==="x"?n.left:n.top,height:s,scroll:r==="x"?window.scrollX:window.scrollY}}function Je(e){let t=parseFloat(e.getAttribute("pathLength")??"");if(t>0)return t;let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Gt(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 Ke(e,t,r){let n=Gt(e),s=Gt(t);return!n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*r)},${Math.round(n[1]+(s[1]-n[1])*r)},${Math.round(n[2]+(s[2]-n[2])*r)})`}var et={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};function W(e,...t){}var vr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Sr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Wt=33;function Er(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function xr(e){let t=[];for(let r=0;r<Wt;r++){let n=r/(Wt-1);t.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${t.join(",")})`}function tt(e){switch(e){case"linear":return"linear";case"ease-in":return vr;case"ease-out":return Sr;case"ease-in-out":return Er()?xr(U["ease-in-out"]):null;default:return null}}var zt=Symbol.for("svg-scroll-draw.registry");function Bt(){let e=globalThis;return e[zt]||(e[zt]=new Map)}function Me(e,t){Bt().set(e,t)}function pe(e){Bt().delete(e)}function rt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=s=>e(!!s.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",r),()=>t.removeEventListener("change",r);let n=t;return n.addListener?.(r),()=>n.removeListener?.(r)}function Fe(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,!0);let r=t(e,!1),n=rt(i=>{if(!i)return;n();let c=(r.getProgress?.()??0)>=1;r.destroy(),r=t(c?{...e,onComplete:void 0}:e,!0)}),s={};for(let i of Object.keys(r))s[i]=(...c)=>r[i]?.(...c);return s.destroy=()=>{n(),r.destroy()},s}var qe,nt=new Set,ot=new WeakMap,je=new Map,qt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Tr(e){let t=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let n=r;n;n=n.previousElementSibling)t.add(n);return t}function jt(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return()=>{};let r=()=>t();qe??(qe=new ResizeObserver(s=>{let i=!1;for(let{target:c}of s)ot.get(c)!==qt(c)&&(i=!0),ot.set(c,"");i&&nt.forEach(c=>c())})),nt.add(r);let n=Tr(e);return[document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{ot.has(s)||ot.set(s,qt(s)),je.set(s,(je.get(s)??0)+1),qe.observe(s)}),()=>{nt.delete(r)&&(n.forEach(s=>{let i=(je.get(s)??1)-1;if(i)return void je.set(s,i);je.delete(s),qe?.unobserve(s)}),nt.size||(qe?.disconnect(),qe=void 0))}}function _e(e,t,r,n,s){let i,c=NaN,m,u,f=()=>{i=0,n(),!m&&!i&&(c=r())>0&&c<1&&(i=requestAnimationFrame(f))},h=()=>{!i&&!m&&r()!==c&&(i=requestAnimationFrame(f))},S=y=>{m=y,cancelAnimationFrame(i),i=c=NaN,h()},b=()=>{clearTimeout(u),s(),h()},O=()=>{clearTimeout(u),u=setTimeout(b,150)},ee=jt(t,O),A=y=>{e[y]("scroll",h,{passive:!0}),window[y]("resize",O),window[y]("orientationchange",O)};return A("addEventListener"),h(),{hold:S,remeasure:b,off(){S(!0),A("removeEventListener"),ee(),clearTimeout(u)}}}var Mr=0;function Ar(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e,t){let r="";try{r=getComputedStyle(e).getPropertyValue(t).trim()}catch{}return r||(e.getAttribute(t)??"").trim()}var Yt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Pr(e){if(!!1)return;let t=Qt(e,"stroke");if(!t||t==="none"){W("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Yt.has(r)&&!Yt.has(Qt(e,"fill"))&&W("Element has a fill \u2014 it may obscure the stroke animation.",e)}function Lr(e,t,r){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=r==="x"?window.scrollX:window.scrollY,c=e-i,m=t-i,u=r==="x";n.innerHTML=`
2
- <div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:!0}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove()}}}var Ut=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Xt=/[MmLlHhVvCcSsQqTtAaZz]/g;function kr(e,t,r){if(!!1)return;let n=(e.match(Xt)??[]).join("").toUpperCase(),s=(t.match(Xt)??[]).join("").toUpperCase(),i=(e.match(Ut)??[]).length,c=(t.match(Ut)??[]).length;if(n!==s){W(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==c&&W(`morphTo: coordinate count differs (${i} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function Cr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let c=parseFloat(i),m=n[s++]??c;return String(+(c+(m-c)*r).toFixed(4))})}function it(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Fe(t,(r,n)=>$r(e,r,n))}function $r(e,t,r){let{preset:n,...s}=t,i=n?{...et[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=!1,easing:f="linear",trigger:h={},stagger:S=0,direction:b="forward",once:O=!1,debug:ee=!1,axis:A="y",scrollContainer:y,autoReverse:x=!1,delay:g=0,strokeColor:w,strokeWidth:v,fillOpacity:I,waypoints:z,velocityScale:N=!1,threshold:te=0,rootMargin:Ve="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:re,autoplay:Ae=!1,duration:L=1e3,native:H=!0,onProgress:Ce,onStart:Z,onComplete:ne,onEnter:ge,onLeave:Ie,onEnterBack:ye,onLeaveBack:me}=i,J=re===!0?"left":typeof re=="string"?re:!1,q=typeof f=="function"?f:U[f]??U.linear,Re=Te(h.start||"top bottom"),Ge=Te(h.end||"bottom top"),F=typeof y=="string"?document.querySelector(y):y??null,he=Array.isArray(w)?w[0]:null,be=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ce=Array.isArray(v)?v[0]:null,Pe=Array.isArray(v)?v[1]:typeof v=="number"?v:null,we=Array.isArray(I)?I[0]:null,ue=Array.isArray(I)?I[1]:typeof I=="number"?I:null;function ve(o){let l=o*100;switch(J){case"right":return`inset(0 0 0 ${100-l}%)`;case"top":return`inset(0 0 ${100-l}% 0)`;case"bottom":return`inset(${100-l}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-l}% 0 0)`}}let a=J?[]:Array.from(e.querySelectorAll(c)),p=[],_=[],M=0,k=0,R=S,C=0,Le=0,V=!1,Se=!1,Ee=0,ut=-1,Qe=[],Ye=-1,ie=!1,fe=0,$e=0,De,mt=!1,ft=null;function Tt(){ft?.destroy(),ft=null}let Oe=new Set,Mt=NaN,Ne=!0,Ue=-1,At=performance.now(),He=NaN;function Xe(){return F?A==="x"?F.scrollLeft:F.scrollTop:A==="x"?window.scrollX:window.scrollY}function Pt(){return F?A==="x"?F.clientWidth:F.clientHeight:A==="x"?window.innerWidth:window.innerHeight}function Lt(){let o=Ze(e,F,A);return ke(o,o.scroll,Pt(),Re,Ge)}function ar(){let o=k-M,l=a.length-1,d=F??document.documentElement,T=A==="x"?"Width":"Height";if(R=S,S>0&&l>0&&o>0){let j=d[`scroll${T}`]-d[`client${T}`]-1-M-o/m;j>=0&&(R=Math.min(S,j/(l*o)))}let G=Math.max(0,l)*R*o,oe=o/Math.min(m,1);C=M+Math.min(0,G,oe,G+oe),Le=M+Math.max(0,G,oe,G+oe)}function kt(){({tStart:M,tEnd:k}=Lt()),ar(),ee&&!1&&(Tt(),ft=Lr(M,k,A))}function pt(o,l=Lt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let d=o.destroy;return o.destroy=()=>{d.call(o),pe(e)},o}function Ct(o,l){return O&&!x?Math.max(ut,q(Qe[o]=Math.max(Qe[o]??0,l))):q(l)}function lr(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),J){let d=l==="reverse"?1-o:o;e.style.clipPath=ve(d);return}a.forEach((d,T)=>dt(d,T,o,l))}function dt(o,l,d,T){o.style.strokeDashoffset=T==="reverse"?`${p[l]*d}`:`${p[l]*(1-d)}`,u&&(o.style.opacity=T==="reverse"?`${1-d}`:`${d}`),he&&be?o.style.stroke=Ke(he,be,d):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*d}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*d}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",Cr(_[l],B,d))}function gt(){if(e.style.setProperty("--scroll-draw-progress","0"),J){e.style.clipPath=ve(b==="reverse"?1:0);return}a.forEach((o,l)=>{o.style.strokeDasharray=`${p[l]}`,o.style.strokeDashoffset=b==="reverse"?"0":`${p[l]}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",_[l])})}function We(o,l){let d=o.getAttribute("d"),T=Je(o);if(B&&_[l]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[l]),T=Math.max(Je(o),G),o.setAttribute("d",d)}p[l]=T,o.style.strokeDasharray=`${T}`}if(a.forEach((o,l)=>{Pr(o);let d=o.tagName.toLowerCase()==="path";d?_.push(o.getAttribute("d")??""):_.push(""),We(o,l);let T=p[l];B&&(d?kr(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),r?(o.style.strokeDashoffset=b==="reverse"?`${T}`:"0",u&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=b==="reverse"?"0":`${T}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`))}),r)return J&&(e.style.clipPath=ve(1)),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};J&&(e.style.clipPath=ve(b==="reverse"?1:0));let $t=typeof f=="string"?tt(f):null;function cr(){return!(H===!1||Ae||ee&&!1||!Ar()||!a.length||!$t||J||A!=="y"||F||m!==1||S!==0||O||x||N!==!1||B||z||le||g>0||Ce||Z||ne||ge||Ie||ye||me||w!=null||v!=null||I!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function ur(){let o=++Mr,l=`svg-scroll-draw-${o}`,d=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=b==="reverse"?"0":"var(--ssd-len)",oe=b==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,$=`stroke-dashoffset:${oe};`;u&&(j+=`opacity:${b==="reverse"?1:0};`,$+=`opacity:${b==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${l}{from{${j}}to{${$}}}.${d}{view-timeline-name:${T};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${$t};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(d);function K(E,P){E.style.setProperty("--ssd-len",String(p[P])),E.style.strokeDasharray=`${p[P]}`,E.style.strokeDashoffset="",E.style.opacity="",E.style.animationPlayState="",E.classList.add(l)}a.forEach(K);let Q=!1,se=-1;function ae(){if(se>=0)return se;let E=e.getBoundingClientRect(),{tStart:P,tEnd:Y}=ke({top:E.top,height:E.height},Xe(),Pt(),Re,Ge);return q(X(Xe(),P,Y,m))}return{destroy(){e.classList.remove(d),a.forEach(E=>{E.classList.remove(l),E.style.removeProperty("--ssd-len"),E.style.animationPlayState=""}),D.remove()},replay(){Q=!1,se=-1,a.forEach(K)},pause(){Q=!0,a.forEach(E=>{E.style.animationPlayState="paused"})},resume(){Q&&(Q=!1,a.forEach(E=>{E.style.animationPlayState="running"}))},seek(E){let P=Math.min(1,Math.max(0,E));se=P,Q=!0,a.forEach((Y,xe)=>{Y.classList.remove(l),Y.style.strokeDashoffset=b==="reverse"?`${p[xe]*P}`:`${p[xe]*(1-P)}`,u&&(Y.style.opacity=b==="reverse"?`${1-P}`:`${P}`)})},getProgress(){return ae()},refresh(){a.forEach((E,P)=>{We(E,P),E.style.setProperty("--ssd-len",String(p[P]))})}}}if(cr())return pt(ur());function mr(){let o=Math.max(1,L),l=J?o:o*(1+Math.max(0,a.length-1)*S),d=0,T=0,G=!1;function oe(se){let ae=!0,E=Math.min(1,Math.max(0,se/l));if(J){let P=Math.min(1,Math.max(0,se/o)),Y=q(P);fe=Y,e.style.setProperty("--scroll-draw-progress",String(Y)),e.style.clipPath=ve(b==="reverse"?1-Y:Y),Ce?.(Y),P<1&&(ae=!1)}else{a.forEach((Y,xe)=>{let pr=xe*S*o,Nt=Math.min(1,Math.max(0,(se-pr)/o));dt(Y,xe,q(Nt),b),Nt<1&&(ae=!1)});let P=q(E);fe=P,Ce?.(P),e.style.setProperty("--scroll-draw-progress",String(P))}if(z){let P=q(E);for(let Y in z){let xe=parseFloat(Y);P>=xe&&!Oe.has(xe)&&(Oe.add(xe),z[Y]?.())}}return ae}function j(se){if(ie)return;let ae=se-d;Se||(Se=!0,Z?.());let E=oe(ae);if(E&&!V){V=!0,oe(l),ne?.(),$e<(le==="infinite"?1/0:le??0)&&($e++,De=setTimeout(()=>{d=performance.now(),Se=!1,V=!1,Oe.clear(),gt(),Ee=requestAnimationFrame(j)},de));return}E||(Ee=requestAnimationFrame(j))}function $(){cancelAnimationFrame(Ee),clearTimeout(De),d=performance.now(),T=0,ie=!1,Se=!1,V=!1,$e=0,G=!0,fe=0,Oe.clear(),gt(),Ee=requestAnimationFrame(j)}let D=new IntersectionObserver(se=>{se.forEach(ae=>{ae.isIntersecting&&!(O&&V)?$():!ae.isIntersecting&&!O&&!V&&(cancelAnimationFrame(Ee),clearTimeout(De),G=!1)})},{root:F??null,threshold:te,rootMargin:Ve}),K;function Q(){clearTimeout(K),K=setTimeout(()=>a.forEach(We),150)}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),g>0?setTimeout(()=>D.observe(e),g):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(De),D.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(K)},replay(){$e=0,$()},pause(){ie||!G||(ie=!0,T=performance.now()-d,cancelAnimationFrame(Ee))},resume(){ie&&(ie=!1,G=!0,d=performance.now()-T,Ee=requestAnimationFrame(j))},seek(se){let ae=Math.min(1,Math.max(0,se));fe=ae,ie=!0,T=ae*l,d=performance.now()-T,cancelAnimationFrame(Ee),oe(T)},getProgress(){return fe},refresh(){clearTimeout(K),a.forEach(We)}}}if(Ae)return pt(mr());kt();let Dt=()=>X(Xe(),C,Le,1);function Ot(){V=!0,ne?.(),$e<(le==="infinite"?1/0:le)&&($e++,De=setTimeout(()=>{mt=!0},de))}function It(){ut=-1,Qe=[],Se=!1,V=!1,mt=!1,Oe.clear(),gt(),Ne=!0}function fr(){let o=performance.now(),l=Xe();if(mt&&Dt()%1&&It(),!Ne&&N===!1&&l===Mt)return;Ne=!1,Mt=l;let d=m;if(N!==!1){let $=o-At,D=$>0?Math.abs(l-(Ue<0?l:Ue))/$:0;d=m*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04)}Ue=l,At=o;let T=x?Ye===-1||l>=Ye?"forward":"reverse":b;Ye=l;let G=k-M,oe=!0,j=G===0?0:(l-M)/G;if(isNaN(He)||(He<=0&&j>0&&ge?.(),He<1&&j>=1&&Ie?.(),He>=1&&j<1&&ye?.(),He>0&&j<=0&&me?.()),He=j,J){let $=Ct(0,X(l,M,k,d));fe=$,e.style.setProperty("--scroll-draw-progress",String($));let D=T==="reverse"?1-$:$;e.style.clipPath=ve(D),Ce?.($),!Se&&X(l,M,k,d)>0&&(Se=!0,Z?.()),$>=1&&!V?Ot():$<1&&!O&&(V=!1);return}if(a.forEach(($,D)=>{let K=D*R*G,Q=Ct(D,X(l,M+K,k+K,d));dt($,D,Q,T),D===0&&(fe=Q,Ce?.(Q),e.style.setProperty("--scroll-draw-progress",String(Q))),Q<1&&(oe=!1)}),z){let $=q(X(l,M,k,d));for(let D in z){let K=parseFloat(D);$>=K&&!Oe.has(K)&&(Oe.add(K),z[D]?.())}}!Se&&X(l,M,k,d)>0&&(Se=!0,Z?.()),oe&&!V?Ot():!oe&&!O&&(V=!1)}let ze=_e(F??window,[e],Dt,fr,()=>{let o=p.join();a.forEach(We),kt(),Ne=!0,p.join()!==o&&Be()}),yt=g>0;function Be(){ze.hold(ie||yt)}let Rt;return yt&&(Rt=setTimeout(()=>{yt=!1,Be()},g)),Be(),pt({destroy(){clearTimeout(De),clearTimeout(Rt),ze.off(),Tt()},replay(){It(),Ye=-1,Ue=-1,$e=0,ie=!1,fe=0,clearTimeout(De),Be()},pause(){ie=!0,ze.hold(!0)},resume(){ie&&(ie=!1,Ne=!0,Be())},seek(o){let l=Math.min(1,Math.max(0,o));fe=l,ut=l,Qe=[],ie=!0,ze.hold(!0),lr(l,b),Ne=!0},getProgress(){return fe},refresh:ze.remeasure},()=>({tStart:M,tEnd:k}))}function Zt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?it(n,t):(W("Container not found:",e),r)}function Dr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Jt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let s=[],i=[],c=n[2].trim();if(c)for(let m of c.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"")}t.push({fn:n[1],nums:s,units:i})}return t}function Or(e,t,r){let n=Jt(e),s=Jt(t);return n.length===0||n.length!==s.length?r<1?e:t:n.map((i,c)=>{let m=s[c];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,f)=>`${u}${i.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,f)=>`${u}${m.units[f]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,f)=>`${u+(m.nums[f]-u)*r}${i.units[f]}`).join(", ")})`}).join(" ")}function Kt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),s=String(t);if(Dr(n))return Ke(n,s,r);if(n.includes("("))return Or(n,s,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&c){let m=parseFloat(i[1]),u=parseFloat(c[1]);return`${m+(u-m)*r}${i[2]||c[2]}`}return r<1?n:s}function Ir(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Nr=0,er="--scroll-draw-progress";function Hr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var rr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,t){return typeof window>"u"?rr:t.respectReducedMotion===!1?tr(e,t,!1):Fe(t,(r,n)=>tr(e,r,n))}function tr(e,t,r){let{props:n,trigger:s={},easing:i="ease-out",speed:c=1,once:m=!1,axis:u="y",scrollContainer:f,native:h=!0,velocityScale:S=!1,triggerElement:b,onProgress:O,onComplete:ee,onEnter:A,onLeave:y,onEnterBack:x,onLeaveBack:g}=t,w=typeof i=="function"?i:U[i]??U["ease-out"],v=Te(s.start||"top bottom"),I=Te(s.end||"bottom top"),z=b??e,N=typeof f=="string"?document.querySelector(f):f??null,te=Object.entries(n).map(([a,p])=>({prop:Ir(a),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ve(){let a=window.getComputedStyle(e);for(let p of te)p.from===""&&(p.from=a.getPropertyValue(p.prop).trim()||"0")}function le(){for(let a of te)e.style.setProperty(a.prop,String(a.to))}let de=new Map;for(let a of[...te.map(p=>p.prop),er])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,p]of de)p?e.style.setProperty(a,p):e.style.removeProperty(a)}if(r)return le(),ee?.(),{...rr,destroy:B,getProgress:()=>1};Ve();let re=()=>N?u==="x"?N.scrollLeft:N.scrollTop:u==="x"?window.scrollX:window.scrollY,Ae=()=>N?u==="x"?N.clientWidth:N.clientHeight:u==="x"?window.innerWidth:window.innerHeight,L=typeof i=="string"?tt(i):null;function H(){if(!h||!Hr()||!L||u!=="y"||N||z!==e||m||c!==1||O||ee||A||y||x||g||S!==!1||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return!1;for(let a of te)if(!Rr.has(a.prop))return!1;return!0}function Ce(){let a=`ssd-a-${++Nr}`,p=te.map(C=>`${C.prop}:${C.from}`).join(";"),_=te.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${p}}to{${_}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${L};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(a);let k=()=>{let C=e.getBoundingClientRect();return ke({top:C.top,height:C.height},re(),Ae(),v,I)};Me(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:k});let R={refresh(){},destroy(){e.classList.remove(a),M.remove(),e.style.animationPlayState="",B(),pe(e)},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Le=Math.min(1,Math.max(0,C));e.classList.remove(a);for(let V of te)e.style.setProperty(V.prop,Kt(V.from,V.to,Le))},getProgress(){let{tStart:C,tEnd:Le}=k();return w(X(re(),C,Le,c))}};return R}if(H())return Ce();let Z=0,ne=0,ge=!1,Ie=-1,ye=0,me=0,J=!1,q=NaN,Re=-1,Ge=0,F=z===e?te:[],he=!1;function be(){let a=e.style,p=F.map(R=>a.getPropertyValue(R.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(R=>a.setProperty(R.prop,de.get(R.prop)??""));let M=Ze(z,N,u);F.forEach((R,C)=>a.setProperty(R.prop,p[C])),F.length&&(e.offsetWidth,a.transition=_);let k=ke(M,M.scroll,Ae(),v,I);he&&Math.abs(k.tStart-Z)<1&&Math.abs(k.tEnd-ne)<1||(he=!0,Z=k.tStart,ne=k.tEnd)}function ce(a){e.style.setProperty(er,String(a));for(let p of te)e.style.setProperty(p.prop,Kt(p.from,p.to,a));O?.(a)}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&A?.(),q<1&&a>=1&&y?.(),q>=1&&a<1&&x?.(),q>0&&a<=0&&g?.(),q=a}function we(){if(ge)return;let a=performance.now(),p=re(),_=c;if(S!==!1){let C=a-Ge,Le=C>0?Math.abs(p-(Re<0?p:Re))/C:0;_=c*Math.max(.2,1+Le*(typeof S=="number"?S:1)*.04)}Re=p,Ge=a;let M=ne===Z?0:(p-Z)/(ne-Z);Pe(M);let k=X(p,Z,ne,_),R=m?Math.max(Ie,w(ye=Math.max(ye,k))):w(k);me=R,ce(R),R>=1&&!J?(J=!0,ee?.()):R<1&&!m&&(J=!1)}let ue=_e(N??window,[z],()=>X(re(),Z,ne,Math.min(c,1)),we,be);be(),ne===Z&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=X(re(),Z,ne,c),me=w(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:Z,tEnd:ne})});function ve(){ge=!0,ue.hold(!0)}return{destroy(){ge=!0,ue.off(),B(),pe(e)},replay(){Ie=-1,ye=0,J=!1,me=0,ge=!1,ce(0),ue.hold(!1)},pause:ve,resume(){ge&&(ge=!1,ue.hold(!1))},seek(a){let p=Math.min(1,Math.max(0,a));me=p,Ie=p,ye=0,ve(),ce(p)},getProgress(){return me},refresh:ue.remeasure}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nr(e,t){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;return r?St(r,t):(W("scrollAnimate: element not found:",e),at)}function or(e,t={}){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return W("scrollParallax: element not found:",e),at;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:c,onProgress:m}=t,u=-n*100,f=r.style,h=!!r.ownerSVGElement,S=f.getPropertyValue("transform-box");h&&f.setProperty("transform-box","fill-box");let b=St(r,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:m});return h?{...b,destroy(){b.destroy(),f.setProperty("transform-box",S)}}:b}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function sr(e,t){if(typeof window>"u")return Et;let r=typeof e=="string"?document.querySelector(e):e;return r?Fe(t,(n,s)=>Fr(r,n,s)):(W("scrollCounter: element not found:",e),Et)}function Fr(e,t,r){let{from:n=0,to:s,format:i,easing:c="ease-out",trigger:m={},once:u=!0,decimals:f,onComplete:h}=t,S=f!==void 0?L=>L.toFixed(f):i??(L=>String(Math.round(L))),b=typeof c=="function"?c:U[c]??U["ease-out"],O=Te(m.start||"top 80%"),ee=Te(m.end||"top 20%");if(r)return e.textContent=S(s),h?.(),{...Et,getProgress:()=>1};let A=0,y=0,x=!1,g=-1,w=0,v=0,I=!1,z=()=>window.scrollY,N=()=>window.innerHeight;function te(){let L=e.getBoundingClientRect(),H=ke({top:L.top,height:L.height},z(),N(),O,ee);x&&Math.abs(H.tStart-A)<1&&Math.abs(H.tEnd-y)<1||(x=!0,A=H.tStart,y=H.tEnd)}let Ve=e.style.getPropertyValue("--scroll-draw-progress");function le(L){e.textContent=S(n+(s-n)*L),e.style.setProperty("--scroll-draw-progress",String(L))}let de=()=>X(z(),A,y,1);function B(){let L=de(),H=u?Math.max(g,b(w=Math.max(w,L))):b(L);v=H,le(H),H>=1&&!I?(I=!0,h?.()):H<1&&!u&&(I=!1)}te();{w=X(z(),A,y,1);let L=b(w);v=L,le(L)}let re=_e(window,[e],de,B,te);Me(e,{type:"counter",getProgress:()=>v,getTrigger:()=>({tStart:A,tEnd:y})});let Ae=()=>re.hold(!1);return{destroy(){re.off(),e.style.setProperty("--scroll-draw-progress",Ve),pe(e)},replay(){g=-1,w=0,I=!1,v=0,le(0),Ae()},pause:()=>re.hold(!0),resume:Ae,seek(L){let H=Math.min(1,Math.max(0,L));v=H,g=H,w=0,re.hold(!0),le(H)},getProgress(){return v}}}var ir="http://www.w3.org/2000/svg",_r="cinematic-photo",xt=e=>e<0?0:e>1?1:e;function lt(e){let t=parseFloat(e);return Number.isFinite(t)?xt(t/100):0}function Vr(e){return U[e]??U.linear}var Gr={destroy:()=>{},getProgress:()=>0},ct=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||W("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return Gr;r.style.position="relative",r.style.height=t.totalHeight,r.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;",r.appendChild(n);let s=[];for(let y of t.scenes){if(y.background){let g=document.createElement("img");g.id=_r,g.src=y.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 x=y.animations.filter(g=>g.type==="draw");if(x.length){let g=document.createElementNS(ir,"svg");g.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.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 w of x){let v=document.createElementNS(ir,"path");v.id=w.target.replace(/^#/,""),v.setAttribute("d",w.d),v.setAttribute("fill","none"),v.setAttribute("stroke",w.stroke),v.setAttribute("stroke-width",String(w.strokeWidth)),v.setAttribute("stroke-linecap","round"),v.setAttribute("stroke-linejoin","round");let I=w.length||v.getTotalLength?.()||0;v.style.strokeDasharray=String(I),v.style.strokeDashoffset=String(I),g.appendChild(v),s.push({kind:"draw",el:v,start:lt(w.start),end:lt(w.end),ease:Vr(w.easing),length:I})}}for(let g of y.animations){if(g.type!=="fade")continue;let w=n.querySelector(g.target)??document.querySelector(g.target);w&&(w.style.opacity=String(g.from),s.push({kind:"fade",el:w,start:lt(g.start),end:lt(g.end),ease:U["ease-in-out"]??U.linear,from:g.from,to:g.to}))}}let i=0,c=()=>{let y=r.offsetHeight-window.innerHeight;return y<=0?r.getBoundingClientRect().top<=0?1:0:xt(-r.getBoundingClientRect().top/y)},m=y=>{for(let x of s){let g=x.end-x.start,w=g<=0?y>=x.end?1:0:xt((y-x.start)/g),v=x.ease(w);x.kind==="draw"?x.el.style.strokeDashoffset=String(x.length*(1-v)):x.el.style.opacity=String(x.from+(x.to-x.from)*v)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let u=0,f=!1,h=!1,S=()=>{i=c(),m(i),f&&(u=requestAnimationFrame(S))},b=()=>{f||(f=!0,u=requestAnimationFrame(S))},O=()=>{f=!1,cancelAnimationFrame(u)},ee=new IntersectionObserver(y=>{for(let x of y)h=x.isIntersecting,h?b():O()},{threshold:0});ee.observe(n),i=c(),m(i),Me(r,{type:"draw",getProgress:()=>i,getTrigger:()=>{let y=r.getBoundingClientRect().top+window.scrollY;return{tStart:y,tEnd:y+Math.max(0,r.offsetHeight-window.innerHeight)}}});let A=rt(y=>{y&&(A(),O(),ee.disconnect(),pe(r),i=1,m(1))});return{destroy(){A(),O(),ee.disconnect(),pe(r)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class t extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let s=JSON.stringify(e.map(S=>this.getAttribute(S)));if(this.instance&&s===this.key)return;this.instance?.destroy(),this.key=s;let i={},c=this.getAttribute("speed"),m=this.getAttribute("easing"),u=this.getAttribute("stagger"),f=this.getAttribute("direction"),h=this.getAttribute("selector");c&&(i.speed=parseFloat(c)),m&&(i.easing=m),u&&(i.stagger=parseFloat(u)),f&&(i.direction=f),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=it(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}t.observedAttributes=e,customElements.define("scroll-draw",t)}return wr(Wr);})();
1
+ "use strict";var SvgScrollDraw=(()=>{var ht=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var hr=Object.getOwnPropertyNames;var br=Object.prototype.hasOwnProperty;var wr=(e,t)=>{for(var r in t)ht(e,r,{get:t[r],enumerable:!0})},vr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of hr(t))!br.call(e,s)&&s!==r&&ht(e,s,{get:()=>t[s],enumerable:!(n=yr(t,s))||n.enumerable});return e};var Er=e=>vr(ht({},"__esModule",{value:!0}),e);var Wr={};wr(Wr,{Cinematic:()=>ct,PRESETS:()=>et,createBounce:()=>wt,createElastic:()=>vt,createSpring:()=>bt,scrollAnimate:()=>rr,scrollCounter:()=>or,scrollDraw:()=>Xt,scrollParallax:()=>nr});function bt({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function wt({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),s=Math.sqrt(n),i=0,a=[];for(let d=0;d<r;d++){let h=Math.pow(s,d);a.push(h),i+=h}let u=[0],m=0;for(let d=0;d<r;d++)m+=a[d]/i,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let h=0;h<r;h++)if(d<=u[h+1]){let E=(d-u[h])/(u[h+1]-u[h]);if(h===0)return E*(2-E);let y=1-Math.pow(n,h);return y+(1-y)*(2*E-1)*(2*E-1)}return 1}}function vt({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),s=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-s)*(2*Math.PI)/n)+1}var oe={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:bt(),bounce:wt(),elastic:vt()};function Nt(e,t,r){return Math.min(r,Math.max(t,e))}function Te(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return{element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return{element:r,viewport:n}}var _t=(e,t)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:t;function Ht(e,t,r,n){return e+r+t*_t(n,0)}function Ft(e,t){return t*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:_t(e,1))}function R(e,t,r,n){return r===t?0:Nt((e-t)/(r-t)*n,0,1)}function ke(e,t,r,n,s){let i=Ht(e.top,e.height,t,n.element)-Ft(n.viewport,r),a=Ht(e.top,e.height,t,s.element)-Ft(s.viewport,r);return{tStart:i,tEnd:a}}function Ze(e,t,r){let n=e.getBoundingClientRect(),s=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:n.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:s,scroll:0}:{top:r==="x"?n.left:n.top,height:s,scroll:r==="x"?window.scrollX:window.scrollY}}function Je(e){let t=parseFloat(e.getAttribute("pathLength")??"");if(t>0)return t;let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Vt(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return[parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function Ke(e,t,r){let n=Vt(e),s=Vt(t);return!n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*r)},${Math.round(n[1]+(s[1]-n[1])*r)},${Math.round(n[2]+(s[2]-n[2])*r)})`}var et={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};function W(e,...t){}var Sr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",xr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Gt=33;function Tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Mr(e){let t=[];for(let r=0;r<Gt;r++){let n=r/(Gt-1);t.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${t.join(",")})`}function tt(e){switch(e){case"linear":return"linear";case"ease-in":return Sr;case"ease-out":return xr;case"ease-in-out":return Tr()?Mr(oe["ease-in-out"]):null;default:return null}}var Wt=Symbol.for("svg-scroll-draw.registry");function zt(){let e=globalThis;return e[Wt]||(e[Wt]=new Map)}function Me(e,t){zt().set(e,t)}function pe(e){zt().delete(e)}function rt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=s=>e(!!s.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",r),()=>t.removeEventListener("change",r);let n=t;return n.addListener?.(r),()=>n.removeListener?.(r)}function _e(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,!0);let r=t(e,!1),n=rt(i=>{if(!i)return;n();let a=(r.getProgress?.()??0)>=1;r.destroy(),r=t(a?{...e,onComplete:void 0}:e,!0)}),s={};for(let i of Object.keys(r))s[i]=(...a)=>r[i]?.(...a);return s.destroy=()=>{n(),r.destroy()},s}var qe,nt=new Set,ot=new WeakMap,je=new Map,Bt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Ar(e){let t=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let n=r;n;n=n.previousElementSibling)t.add(n);return t}function qt(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return()=>{};let r=()=>t();qe??(qe=new ResizeObserver(s=>{let i=!1;for(let{target:a}of s)ot.get(a)!==Bt(a)&&(i=!0),ot.set(a,"");i&&nt.forEach(a=>a())})),nt.add(r);let n=Ar(e);return[document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{ot.has(s)||ot.set(s,Bt(s)),je.set(s,(je.get(s)??0)+1),qe.observe(s)}),()=>{nt.delete(r)&&(n.forEach(s=>{let i=(je.get(s)??1)-1;if(i)return void je.set(s,i);je.delete(s),qe?.unobserve(s)}),nt.size||(qe?.disconnect(),qe=void 0))}}function Ce(e,t,r,n,s){let i,a=NaN,u,m,d=()=>{i=0,n(),!u&&!i&&(a=r())>0&&a<1&&(i=requestAnimationFrame(d))},h=()=>{!i&&!u&&r()!==a&&(i=requestAnimationFrame(d))},E=v=>{u=v,cancelAnimationFrame(i),i=a=NaN,h()},y=()=>{clearTimeout(m),s(),h()},I=()=>{clearTimeout(m),m=setTimeout(y,150)},se=qt(t,I),f=v=>{e[v]("scroll",h,{passive:!0}),window[v]("resize",I),window[v]("orientationchange",I)};return f("addEventListener"),h(),{hold:E,remeasure:y,off(){E(!0),f("removeEventListener"),se(),clearTimeout(m)}}}var Pr=0;function Lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function jt(e,t){let r="";try{r=getComputedStyle(e).getPropertyValue(t).trim()}catch{}return r||(e.getAttribute(t)??"").trim()}var Yt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function kr(e){if(!!1)return;let t=jt(e,"stroke");if(!t||t==="none"){W("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Yt.has(r)&&!Yt.has(jt(e,"fill"))&&W("Element has a fill \u2014 it may obscure the stroke animation.",e)}function Cr(e,t,r){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=r==="x"?window.scrollX:window.scrollY,a=e-i,u=t-i,m=r==="x";n.innerHTML=`
2
+ <div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
+ <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:!0}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove()}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function $r(e,t,r){if(!!1)return;let n=(e.match(Ut)??[]).join("").toUpperCase(),s=(t.match(Ut)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,a=(t.match(Qt)??[]).length;if(n!==s){W(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==a&&W(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function Dr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),u=n[s++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function it(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:_e(t,(r,n)=>Or(e,r,n))}function Or(e,t,r){let{preset:n,...s}=t,i=n?{...et[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=!1,easing:d="linear",trigger:h={},stagger:E=0,direction:y="forward",once:I=!1,debug:se=!1,axis:f="y",scrollContainer:v,autoReverse:b=!1,delay:x=0,strokeColor:w,strokeWidth:L,fillOpacity:U,waypoints:z,velocityScale:N=!1,threshold:K=0,rootMargin:Ve="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:ee,autoplay:Ae=!1,duration:P=1e3,native:H=!0,onProgress:$e,onStart:X,onComplete:te,onEnter:ge,onLeave:Re,onEnterBack:ye,onLeaveBack:me}=i,Z=ee===!0?"left":typeof ee=="string"?ee:!1,q=typeof d=="function"?d:oe[d]??oe.linear,Ne=Te(h.start||"top bottom"),Ge=Te(h.end||"bottom top"),F=typeof v=="string"?document.querySelector(v):v??null,he=Array.isArray(w)?w[0]:null,be=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ce=Array.isArray(L)?L[0]:null,Pe=Array.isArray(L)?L[1]:typeof L=="number"?L:null,we=Array.isArray(U)?U[0]:null,ue=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function ve(o){let c=o*100;switch(Z){case"right":return`inset(0 0 0 ${100-c}%)`;case"top":return`inset(0 0 ${100-c}% 0)`;case"bottom":return`inset(${100-c}% 0 0 0)`;case"center":return`circle(${o*150}% at 50% 50%)`;default:return`inset(0 ${100-c}% 0 0)`}}let l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],_=[],M=0,k=0,O=E,C=0,Le=0,V=!1,Ee=!1,Se=0,ut=-1,Ye=[],Qe=-1,ie=!1,fe=0,De=0,Oe,mt=!1,ft=null;function xt(){ft?.destroy(),ft=null}let Ie=new Set,Tt=NaN,He=!0,Ue=-1,Mt=performance.now(),Fe=NaN;function Xe(){return F?f==="x"?F.scrollLeft:F.scrollTop:f==="x"?window.scrollX:window.scrollY}function At(){return F?f==="x"?F.clientWidth:F.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function Pt(){let o=Ze(e,F,f);return ke(o,o.scroll,At(),Ne,Ge)}function cr(){let o=k-M,c=l.length-1,g=F??document.documentElement,T=f==="x"?"Width":"Height";if(O=E,E>0&&c>0&&o>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-o/u;j>=0&&(O=Math.min(E,j/(c*o)))}let G=Math.max(0,c)*O*o,re=o/Math.min(u,1);C=M+Math.min(0,G,re,G+re),Le=M+Math.max(0,G,re,G+re)}function Lt(){({tStart:M,tEnd:k}=Pt()),cr(),se&&!1&&(xt(),ft=Cr(M,k,f))}function pt(o,c=Pt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),pe(e)},o}function kt(o,c){return I&&!b?Math.max(ut,q(Ye[o]=Math.max(Ye[o]??0,c))):q(c)}function ur(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let g=c==="reverse"?1-o:o;e.style.clipPath=ve(g);return}l.forEach((g,T)=>dt(g,T,o,c))}function dt(o,c,g,T){o.style.strokeDashoffset=T==="reverse"?`${p[c]*g}`:`${p[c]*(1-g)}`,m&&(o.style.opacity=T==="reverse"?`${1-g}`:`${g}`),he&&be?o.style.stroke=Ke(he,be,g):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*g}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*g}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",Dr(_[c],B,g))}function gt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ve(y==="reverse"?1:0);return}l.forEach((o,c)=>{o.style.strokeDasharray=`${p[c]}`,o.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",_[c])})}function We(o,c){let g=o.getAttribute("d"),T=Je(o);if(B&&_[c]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[c]),T=Math.max(Je(o),G),o.setAttribute("d",g)}p[c]=T,o.style.strokeDasharray=`${T}`}if(l.forEach((o,c)=>{kr(o);let g=o.tagName.toLowerCase()==="path";g?_.push(o.getAttribute("d")??""):_.push(""),We(o,c);let T=p[c];B&&(g?$r(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),r?(o.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`))}),r)return Z&&(e.style.clipPath=ve(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=ve(y==="reverse"?1:0));let Ct=typeof d=="string"?tt(d):null;function mr(){return!(H===!1||Ae||se&&!1||!Lr()||!l.length||!Ct||Z||f!=="y"||F||u!==1||E!==0||I||b||N!==!1||B||z||le||x>0||$e||X||te||ge||Re||ye||me||w!=null||L!=null||U!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function fr(){let o=++Pr,c=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,$=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,$+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${j}}to{${$}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function J(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=`${p[A]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c)}l.forEach(J);let Y=!1,ne=-1;function ae(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=ke({top:S.top,height:S.height},Xe(),At(),Ne,Ge);return q(R(Xe(),A,Q,u))}return{destroy(){e.classList.remove(g),l.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState=""}),D.remove()},replay(){Y=!1,ne=-1,l.forEach(J)},pause(){Y=!0,l.forEach(S=>{S.style.animationPlayState="paused"})},resume(){Y&&(Y=!1,l.forEach(S=>{S.style.animationPlayState="running"}))},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=!0,l.forEach((Q,xe)=>{Q.classList.remove(c),Q.style.strokeDashoffset=y==="reverse"?`${p[xe]*A}`:`${p[xe]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`)})},getProgress(){return ae()},refresh(){l.forEach((S,A)=>{We(S,A),S.style.setProperty("--ssd-len",String(p[A]))})}}}if(mr())return pt(fr());function pr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,l.length-1)*E),g=0,T=0,G=!1;function re(ne){let ae=!0,S=Math.min(1,Math.max(0,ne/c));if(Z){let A=Math.min(1,Math.max(0,ne/o)),Q=q(A);fe=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=ve(y==="reverse"?1-Q:Q),$e?.(Q),A<1&&(ae=!1)}else{l.forEach((Q,xe)=>{let gr=xe*E*o,Rt=Math.min(1,Math.max(0,(ne-gr)/o));dt(Q,xe,q(Rt),y),Rt<1&&(ae=!1)});let A=q(S);fe=A,$e?.(A),e.style.setProperty("--scroll-draw-progress",String(A))}if(z){let A=q(S);for(let Q in z){let xe=parseFloat(Q);A>=xe&&!Ie.has(xe)&&(Ie.add(xe),z[Q]?.())}}return ae}function j(ne){if(ie)return;let ae=ne-g;Ee||(Ee=!0,X?.());let S=re(ae);if(S&&!V){V=!0,re(c),te?.(),De<(le==="infinite"?1/0:le??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),Ee=!1,V=!1,Ie.clear(),gt(),Se=requestAnimationFrame(j)},de));return}S||(Se=requestAnimationFrame(j))}function $(){cancelAnimationFrame(Se),clearTimeout(Oe),g=performance.now(),T=0,ie=!1,Ee=!1,V=!1,De=0,G=!0,fe=0,Ie.clear(),gt(),Se=requestAnimationFrame(j)}let D=new IntersectionObserver(ne=>{ne.forEach(ae=>{ae.isIntersecting&&!(I&&V)?$():!ae.isIntersecting&&!I&&!V&&(cancelAnimationFrame(Se),clearTimeout(Oe),G=!1)})},{root:F??null,threshold:K,rootMargin:Ve}),J;function Y(){clearTimeout(J),J=setTimeout(()=>l.forEach(We),150)}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Se),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(J)},replay(){De=0,$()},pause(){ie||!G||(ie=!0,T=performance.now()-g,cancelAnimationFrame(Se))},resume(){ie&&(ie=!1,G=!0,g=performance.now()-T,Se=requestAnimationFrame(j))},seek(ne){let ae=Math.min(1,Math.max(0,ne));fe=ae,ie=!0,T=ae*c,g=performance.now()-T,cancelAnimationFrame(Se),re(T)},getProgress(){return fe},refresh(){clearTimeout(J),l.forEach(We)}}}if(Ae)return pt(pr());Lt();let $t=()=>R(Xe(),C,Le,1);function Dt(){V=!0,te?.(),De<(le==="infinite"?1/0:le)&&(De++,Oe=setTimeout(()=>{mt=!0},de))}function Ot(){ut=-1,Ye=[],Ee=!1,V=!1,mt=!1,Ie.clear(),gt(),He=!0}function dr(){let o=performance.now(),c=Xe();if(mt&&$t()%1&&Ot(),!He&&N===!1&&c===Tt)return;He=!1,Tt=c;let g=u;if(N!==!1){let $=o-Mt,D=$>0?Math.abs(c-(Ue<0?c:Ue))/$:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04)}Ue=c,Mt=o;let T=b?Qe===-1||c>=Qe?"forward":"reverse":y;Qe=c;let G=k-M,re=!0,j=G===0?0:(c-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&ge?.(),Fe<1&&j>=1&&Re?.(),Fe>=1&&j<1&&ye?.(),Fe>0&&j<=0&&me?.()),Fe=j,Z){let $=kt(0,R(c,M,k,g));fe=$,e.style.setProperty("--scroll-draw-progress",String($));let D=T==="reverse"?1-$:$;e.style.clipPath=ve(D),$e?.($),!Ee&&R(c,M,k,g)>0&&(Ee=!0,X?.()),$>=1&&!V?Dt():$<1&&!I&&(V=!1);return}if(l.forEach(($,D)=>{let J=D*O*G,Y=kt(D,R(c,M+J,k+J,g));dt($,D,Y,T),D===0&&(fe=Y,$e?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=!1)}),z){let $=q(R(c,M,k,g));for(let D in z){let J=parseFloat(D);$>=J&&!Ie.has(J)&&(Ie.add(J),z[D]?.())}}!Ee&&R(c,M,k,g)>0&&(Ee=!0,X?.()),re&&!V?Dt():!re&&!I&&(V=!1)}let ze=Ce(F??window,[e],$t,dr,()=>{let o=p.join();l.forEach(We),Lt(),He=!0,p.join()!==o&&Be()}),yt=x>0;function Be(){ze.hold(ie||yt)}let It;return yt&&(It=setTimeout(()=>{yt=!1,Be()},x)),Be(),pt({destroy(){clearTimeout(Oe),clearTimeout(It),ze.off(),xt()},replay(){Ot(),Qe=-1,Ue=-1,De=0,ie=!1,fe=0,clearTimeout(Oe),Be()},pause(){ie=!0,ze.hold(!0)},resume(){ie&&(ie=!1,He=!0,Be())},seek(o){let c=Math.min(1,Math.max(0,o));fe=c,ut=c,Ye=[],ie=!0,ze.hold(!0),ur(c,y),He=!0},getProgress(){return fe},refresh:ze.remeasure},()=>({tStart:M,tEnd:k}))}function Xt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?it(n,t):(W("Container not found:",e),r)}function Ir(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Zt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"")}t.push({fn:n[1],nums:s,units:i})}return t}function Rr(e,t,r){let n=Zt(e),s=Zt(t);return n.length===0||n.length!==s.length?r<1?e:t:n.map((i,a)=>{let u=s[a];return i.fn!==u.fn||i.nums.length!==u.nums.length?r<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${i.units[d]}`).join(", ")})`}).join(" ")}function Jt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),s=String(t);if(Ir(n))return Ke(n,s,r);if(n.includes("("))return Rr(n,s,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let u=parseFloat(i[1]),m=parseFloat(a[1]);return`${u+(m-u)*r}${i[2]||a[2]}`}return r<1?n:s}function Nr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Hr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Fr=0,Kt="--scroll-draw-progress";function _r(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var tr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,t){return typeof window>"u"?tr:t.respectReducedMotion===!1?er(e,t,!1):_e(t,(r,n)=>er(e,r,n))}function er(e,t,r){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:u=!1,axis:m="y",scrollContainer:d,native:h=!0,velocityScale:E=!1,triggerElement:y,onProgress:I,onComplete:se,onEnter:f,onLeave:v,onEnterBack:b,onLeaveBack:x}=t,w=typeof i=="function"?i:oe[i]??oe["ease-out"],L=Te(s.start||"top bottom"),U=Te(s.end||"bottom top"),z=y??e,N=typeof d=="string"?document.querySelector(d):d??null,K=Object.entries(n).map(([l,p])=>({prop:Nr(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ve(){let l=window.getComputedStyle(e);for(let p of K)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0")}function le(){for(let l of K)e.style.setProperty(l.prop,String(l.to))}let de=new Map;for(let l of[...K.map(p=>p.prop),Kt])de.set(l,e.style.getPropertyValue(l));function B(){for(let[l,p]of de)p?e.style.setProperty(l,p):e.style.removeProperty(l)}if(r)return le(),se?.(),{...tr,destroy:B,getProgress:()=>1};Ve();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Ae=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?tt(i):null;function H(){if(!h||!_r()||!P||m!=="y"||N||z!==e||u||a!==1||I||se||f||v||b||x||E!==!1||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return!1;for(let l of K)if(!Hr.has(l.prop))return!1;return!0}function $e(){let l=`ssd-a-${++Fr}`,p=K.map(C=>`${C.prop}:${C.from}`).join(";"),_=K.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${p}}to{${_}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let k=()=>{let C=e.getBoundingClientRect();return ke({top:C.top,height:C.height},ee(),Ae(),L,U)};Me(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:k});let O={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",B(),pe(e)},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Le=Math.min(1,Math.max(0,C));e.classList.remove(l);for(let V of K)e.style.setProperty(V.prop,Jt(V.from,V.to,Le))},getProgress(){let{tStart:C,tEnd:Le}=k();return w(R(ee(),C,Le,a))}};return O}if(H())return $e();let X=0,te=0,ge=!1,Re=-1,ye=0,me=0,Z=!1,q=NaN,Ne=-1,Ge=0,F=z===e?K:[],he=!1;function be(){let l=e.style,p=F.map(O=>l.getPropertyValue(O.prop)),_=l.transition;F.length&&(l.transition="none"),F.forEach(O=>l.setProperty(O.prop,de.get(O.prop)??""));let M=Ze(z,N,m);F.forEach((O,C)=>l.setProperty(O.prop,p[C])),F.length&&(e.offsetWidth,l.transition=_);let k=ke(M,M.scroll,Ae(),L,U);he&&Math.abs(k.tStart-X)<1&&Math.abs(k.tEnd-te)<1||(he=!0,X=k.tStart,te=k.tEnd)}function ce(l){e.style.setProperty(Kt,String(l));for(let p of K)e.style.setProperty(p.prop,Jt(p.from,p.to,l));I?.(l)}function Pe(l){if(isNaN(q)){q=l;return}q<=0&&l>0&&f?.(),q<1&&l>=1&&v?.(),q>=1&&l<1&&b?.(),q>0&&l<=0&&x?.(),q=l}function we(){if(ge)return;let l=performance.now(),p=ee(),_=a;if(E!==!1){let C=l-Ge,Le=C>0?Math.abs(p-(Ne<0?p:Ne))/C:0;_=a*Math.max(.2,1+Le*(typeof E=="number"?E:1)*.04)}Ne=p,Ge=l;let M=te===X?0:(p-X)/(te-X);Pe(M);let k=R(p,X,te,_),O=u?Math.max(Re,w(ye=Math.max(ye,k))):w(k);me=O,ce(O),O>=1&&!Z?(Z=!0,se?.()):O<1&&!u&&(Z=!1)}let ue=Ce(N??window,[z],()=>R(ee(),X,te,Math.min(a,1)),we,be);be(),te===X&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=R(ee(),X,te,a),me=w(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:X,tEnd:te})});function ve(){ge=!0,ue.hold(!0)}return{destroy(){ge=!0,ue.off(),B(),pe(e)},replay(){Re=-1,ye=0,Z=!1,me=0,ge=!1,ce(0),ue.hold(!1)},pause:ve,resume(){ge&&(ge=!1,ue.hold(!1))},seek(l){let p=Math.min(1,Math.max(0,l));me=p,Re=p,ye=0,ve(),ce(p)},getProgress(){return me},refresh:ue.remeasure}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rr(e,t){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;return r?Et(r,t):(W("scrollAnimate: element not found:",e),at)}function nr(e,t={}){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return W("scrollParallax: element not found:",e),at;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:a,onProgress:u}=t,m=-n*100,d=r.style,h=!!r.ownerSVGElement,E=d.getPropertyValue("transform-box");h&&d.setProperty("transform-box","fill-box");let y=Et(r,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:u});return h?{...y,destroy(){y.destroy(),d.setProperty("transform-box",E)}}:y}var St={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,t){if(typeof window>"u")return St;let r=typeof e=="string"?document.querySelector(e):e;return r?_e(t,(n,s)=>Vr(r,n,s)):(W("scrollCounter: element not found:",e),St)}function Vr(e,t,r){let{from:n=0,to:s,format:i,easing:a="ease-out",trigger:u={},once:m=!0,decimals:d,onComplete:h}=t,E=d!==void 0?P=>P.toFixed(d):i??(P=>String(Math.round(P))),y=typeof a=="function"?a:oe[a]??oe["ease-out"],I=Te(u.start||"top 80%"),se=Te(u.end||"top 20%");if(r)return e.textContent=E(s),h?.(),{...St,getProgress:()=>1};let f=0,v=0,b=!1,x=-1,w=0,L=0,U=!1,z=()=>window.scrollY,N=()=>window.innerHeight;function K(){let P=e.getBoundingClientRect(),H=ke({top:P.top,height:P.height},z(),N(),I,se);b&&Math.abs(H.tStart-f)<1&&Math.abs(H.tEnd-v)<1||(b=!0,f=H.tStart,v=H.tEnd)}let Ve=e.style.getPropertyValue("--scroll-draw-progress");function le(P){e.textContent=E(n+(s-n)*P),e.style.setProperty("--scroll-draw-progress",String(P))}let de=()=>R(z(),f,v,1);function B(){let P=de(),H=m?Math.max(x,y(w=Math.max(w,P))):y(P);L=H,le(H),H>=1&&!U?(U=!0,h?.()):H<1&&!m&&(U=!1)}K();{w=R(z(),f,v,1);let P=y(w);L=P,le(P)}let ee=Ce(window,[e],de,B,K);Me(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:v})});let Ae=()=>ee.hold(!1);return{destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ve),pe(e)},replay(){x=-1,w=0,U=!1,L=0,le(0),Ae()},pause:()=>ee.hold(!0),resume:Ae,seek(P){let H=Math.min(1,Math.max(0,P));L=H,x=H,w=0,ee.hold(!0),le(H)},getProgress(){return L}}}var sr="http://www.w3.org/2000/svg",Gr="cinematic-photo",lr=e=>e<0?0:e>1?1:e;function lt(e){let t=parseFloat(e);return Number.isFinite(t)?lr(t/100):0}function ir(e){return oe[e]??oe.linear}var ar=e=>({destroy(){},getProgress:()=>e}),ct=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||W("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return ar(0);r.style.position="relative",r.style.height=t.totalHeight,r.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;",r.appendChild(n);let s=[];for(let f of t.scenes){if(f.background){let b=document.createElement("img");b.id=Gr,b.src=f.background,b.alt="",b.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(b)}let v=f.animations.filter(b=>b.type==="draw");if(v.length){let b=document.createElementNS(sr,"svg");b.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),b.setAttribute("preserveAspectRatio","xMidYMid meet"),b.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(b);for(let x of v){let w=document.createElementNS(sr,"path");w.id=x.target.replace(/^#/,""),w.setAttribute("d",x.d),w.setAttribute("fill","none"),w.setAttribute("stroke",x.stroke),w.setAttribute("stroke-width",String(x.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let L=x.length||w.getTotalLength?.()||0;w.style.strokeDasharray=String(L),w.style.strokeDashoffset=String(L),b.appendChild(w),s.push({kind:"draw",el:w,start:lt(x.start),end:lt(x.end),ease:ir(x.easing),length:L})}}for(let b of f.animations){if(b.type!=="fade")continue;let x=n.querySelector(b.target)??document.querySelector(b.target);x&&(x.style.opacity=String(b.from),s.push({kind:"fade",el:x,start:lt(b.start),end:lt(b.end),ease:ir("ease-in-out"),from:b.from,to:b.to}))}}let i=0,a=null;for(let f=r.parentElement;f?.parentElement;f=f.parentElement)if(/[ao]/.test(getComputedStyle(f).overflowY)&&f.scrollHeight>f.clientHeight&&(f!==document.body||/[aoh]/.test(getComputedStyle(f.parentElement).overflowY))){a=f;break}let u=0,m=0,d=()=>{let f=r.getBoundingClientRect().top;u=a?f-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:f+window.scrollY,m=u+Math.max(0,r.offsetHeight-(a?a.clientHeight:window.innerHeight))},h=()=>{let f=a?a.scrollTop:window.scrollY;return m<=u?f>=u?1:0:R(f,u,m,1)},E=f=>{for(let v of s){let b=v.end-v.start,x=b<=0?f>=v.end?1:0:lr((f-v.start)/b),w=v.ease(x);v.kind==="draw"?v.el.style.strokeDashoffset=String(v.length*(1-w)):v.el.style.opacity=String(v.from+(v.to-v.from)*w)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),ar(1);let y=()=>{i=h(),E(i)};d(),y();let I=Ce(a||window,[r],h,y,d);Me(r,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let se=rt(f=>{f&&(se(),I.off(),pe(r),i=1,E(1))});return{destroy(){se(),I.off(),pe(r)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class t extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let s=JSON.stringify(e.map(E=>this.getAttribute(E)));if(this.instance&&s===this.key)return;this.instance?.destroy(),this.key=s;let i={},a=this.getAttribute("speed"),u=this.getAttribute("easing"),m=this.getAttribute("stagger"),d=this.getAttribute("direction"),h=this.getAttribute("selector");a&&(i.speed=parseFloat(a)),u&&(i.easing=u),m&&(i.stagger=parseFloat(m)),d&&(i.direction=d),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=it(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}t.observedAttributes=e,customElements.define("scroll-draw",t)}return Er(Wr);})();
@@ -0,0 +1,2 @@
1
+ import {e,b as b$2}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$1}from'./chunk-5PJEKEEP.mjs';import {a,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var x="http://www.w3.org/2000/svg",G="cinematic-photo",D=a=>a<0?0:a>1?1:a;function u(a){let i=parseFloat(a);return Number.isFinite(i)?D(i/100):0}function L(a){return d[a]??d.linear}var P=a=>({destroy(){},getProgress:()=>a}),R=class{constructor(i){if(typeof document>"u"){this.mount=null;return}this.mount=typeof i.wrapper=="string"?document.querySelector(i.wrapper):i.wrapper,this.mount||b("Cinematic: wrapper not found:",i.wrapper);}loadStory(i){let s=this.mount;if(typeof window>"u"||!s)return P(0);s.style.position="relative",s.style.height=i.totalHeight,s.style.display="block";let l=document.createElement("div");l.setAttribute("data-cinematic-stage",""),l.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",s.appendChild(l);let f=[];for(let t of i.scenes){if(t.background){let e=document.createElement("img");e.id=G,e.src=t.background,e.alt="",e.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",l.appendChild(e);}let n=t.animations.filter(e=>e.type==="draw");if(n.length){let e=document.createElementNS(x,"svg");e.setAttribute("viewBox",`0 0 ${i.canvas.width} ${i.canvas.height}`),e.setAttribute("preserveAspectRatio","xMidYMid meet"),e.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",l.appendChild(e);for(let o of n){let r=document.createElementNS(x,"path");r.id=o.target.replace(/^#/,""),r.setAttribute("d",o.d),r.setAttribute("fill","none"),r.setAttribute("stroke",o.stroke),r.setAttribute("stroke-width",String(o.strokeWidth)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round");let h=o.length||r.getTotalLength?.()||0;r.style.strokeDasharray=String(h),r.style.strokeDashoffset=String(h),e.appendChild(r),f.push({kind:"draw",el:r,start:u(o.start),end:u(o.end),ease:L(o.easing),length:h});}}for(let e of t.animations){if(e.type!=="fade")continue;let o=l.querySelector(e.target)??document.querySelector(e.target);o&&(o.style.opacity=String(e.from),f.push({kind:"fade",el:o,start:u(e.start),end:u(e.end),ease:L("ease-in-out"),from:e.from,to:e.to}));}}let d=0,c=null;for(let t=s.parentElement;t?.parentElement;t=t.parentElement)if(/[ao]/.test(getComputedStyle(t).overflowY)&&t.scrollHeight>t.clientHeight&&(t!==document.body||/[aoh]/.test(getComputedStyle(t.parentElement).overflowY))){c=t;break}let m=0,p=0,b=()=>{let t=s.getBoundingClientRect().top;m=c?t-c.getBoundingClientRect().top-c.clientTop+c.scrollTop:t+window.scrollY,p=m+Math.max(0,s.offsetHeight-(c?c.clientHeight:window.innerHeight));},S=()=>{let t=c?c.scrollTop:window.scrollY;return p<=m?t>=m?1:0:b$2(t,m,p,1)},g=t=>{for(let n of f){let e=n.end-n.start,o=e<=0?t>=n.end?1:0:D((t-n.start)/e),r=n.ease(o);n.kind==="draw"?n.el.style.strokeDashoffset=String(n.length*(1-r)):n.el.style.opacity=String(n.from+(n.to-n.from)*r);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return g(1),P(1);let E=()=>{d=S(),g(d);};b(),E();let v=e(c||window,[s],S,E,b);a(s,{type:"draw",getProgress:()=>d,getTrigger:()=>({tStart:m,tEnd:p})});let k=a$1(t=>{t&&(k(),v.off(),b$1(s),d=1,g(1));});return {destroy(){k(),v.off(),b$1(s);},getProgress:()=>d}}};
2
+ export{R as a};
@@ -1,2 +1,2 @@
1
- 'use strict';function D({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function H({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),o=Math.max(.01,Math.min(.99,n)),p=Math.sqrt(o),c=0,y=[];for(let i=0;i<t;i++){let d=Math.pow(p,i);y.push(d),c+=d;}let l=[0],g=0;for(let i=0;i<t;i++)g+=y[i]/c,l.push(g);return i=>{if(i<=0)return 0;if(i>=1)return 1;for(let d=0;d<t;d++)if(i<=l[d+1]){let f=(i-l[d])/(l[d+1]-l[d]);if(d===0)return f*(2-f);let b=1-Math.pow(o,d);return b+(1-b)*(2*f-1)*(2*f-1)}return 1}}function P({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),o=Math.max(.1,n),p=t<=1?o/4:o/(2*Math.PI)*Math.asin(1/t);return c=>c<=0?0:c>=1?1:t*Math.pow(2,-10*c)*Math.sin((c-p)*(2*Math.PI)/o)+1}var h={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:D(),bounce:H(),elastic:P()};var V=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function _(e,...n){V&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var A=Symbol.for("svg-scroll-draw.registry");function R(){let e=globalThis;return e[A]||(e[A]=new Map)}function k(e,n){R().set(e,n);}function S(e){R().delete(e);}function T(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=p=>e(!!p.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let o=n;return o.addListener?.(t),()=>o.removeListener?.(t)}var C="http://www.w3.org/2000/svg",O="cinematic-photo",x=e=>e<0?0:e>1?1:e;function w(e){let n=parseFloat(e);return Number.isFinite(n)?x(n/100):0}function Q(e){return h[e]??h.linear}var q={destroy:()=>{},getProgress:()=>0},I=class{constructor(n){if(typeof document>"u"){this.mount=null;return}this.mount=typeof n.wrapper=="string"?document.querySelector(n.wrapper):n.wrapper,this.mount||_("Cinematic: wrapper not found:",n.wrapper);}loadStory(n){let t=this.mount;if(typeof window>"u"||!t)return q;t.style.position="relative",t.style.height=n.totalHeight,t.style.display="block";let o=document.createElement("div");o.setAttribute("data-cinematic-stage",""),o.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(o);let p=[];for(let s of n.scenes){if(s.background){let r=document.createElement("img");r.id=O,r.src=s.background,r.alt="",r.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",o.appendChild(r);}let a=s.animations.filter(r=>r.type==="draw");if(a.length){let r=document.createElementNS(C,"svg");r.setAttribute("viewBox",`0 0 ${n.canvas.width} ${n.canvas.height}`),r.setAttribute("preserveAspectRatio","xMidYMid meet"),r.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",o.appendChild(r);for(let m of a){let u=document.createElementNS(C,"path");u.id=m.target.replace(/^#/,""),u.setAttribute("d",m.d),u.setAttribute("fill","none"),u.setAttribute("stroke",m.stroke),u.setAttribute("stroke-width",String(m.strokeWidth)),u.setAttribute("stroke-linecap","round"),u.setAttribute("stroke-linejoin","round");let E=m.length||u.getTotalLength?.()||0;u.style.strokeDasharray=String(E),u.style.strokeDashoffset=String(E),r.appendChild(u),p.push({kind:"draw",el:u,start:w(m.start),end:w(m.end),ease:Q(m.easing),length:E});}}for(let r of s.animations){if(r.type!=="fade")continue;let m=o.querySelector(r.target)??document.querySelector(r.target);m&&(m.style.opacity=String(r.from),p.push({kind:"fade",el:m,start:w(r.start),end:w(r.end),ease:h["ease-in-out"]??h.linear,from:r.from,to:r.to}));}}let c=0,y=()=>{let s=t.offsetHeight-window.innerHeight;return s<=0?t.getBoundingClientRect().top<=0?1:0:x(-t.getBoundingClientRect().top/s)},l=s=>{for(let a of p){let r=a.end-a.start,m=r<=0?s>=a.end?1:0:x((s-a.start)/r),u=a.ease(m);a.kind==="draw"?a.el.style.strokeDashoffset=String(a.length*(1-u)):a.el.style.opacity=String(a.from+(a.to-a.from)*u);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return l(1),{destroy:()=>{},getProgress:()=>1};let g=0,i=false,d=false,f=()=>{c=y(),l(c),i&&(g=requestAnimationFrame(f));},b=()=>{i||(i=true,g=requestAnimationFrame(f));},v=()=>{i=false,cancelAnimationFrame(g);},M=new IntersectionObserver(s=>{for(let a of s)d=a.isIntersecting,d?b():v();},{threshold:0});M.observe(o),c=y(),l(c),k(t,{type:"draw",getProgress:()=>c,getTrigger:()=>{let s=t.getBoundingClientRect().top+window.scrollY;return {tStart:s,tEnd:s+Math.max(0,t.offsetHeight-window.innerHeight)}}});let L=T(s=>{s&&(L(),v(),M.disconnect(),S(t),c=1,l(1));});return {destroy(){L(),v(),M.disconnect(),S(t);},getProgress:()=>c}}};
2
- exports.Cinematic=I;
1
+ 'use strict';function W({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function Y({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(r),s=0,u=[];for(let d=0;d<t;d++){let m=Math.pow(o,d);u.push(m),s+=m;}let l=[0],g=0;for(let d=0;d<t;d++)g+=u[d]/s,l.push(g);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let m=0;m<t;m++)if(d<=l[m+1]){let b=(d-l[m])/(l[m+1]-l[m]);if(m===0)return b*(2-b);let h=1-Math.pow(r,m);return h+(1-h)*(2*b-1)*(2*b-1)}return 1}}function B({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),o=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var A={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:W(),bounce:Y(),elastic:B()};var z=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function T(e,...n){z&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var R=Symbol.for("svg-scroll-draw.registry");function k(){let e=globalThis;return e[R]||(e[R]=new Map)}function C(e,n){k().set(e,n);}function _(e){k().delete(e);}function D(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}var w,M=new Set,S=new WeakMap,v=new Map,H=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function $(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function O(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();w??(w=new ResizeObserver(o=>{let s=false;for(let{target:u}of o)S.get(u)!==H(u)&&(s=true),S.set(u,"");s&&M.forEach(u=>u());})),M.add(t);let r=$(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{S.has(o)||S.set(o,H(o)),v.set(o,(v.get(o)??0)+1),w.observe(o);}),()=>{M.delete(t)&&(r.forEach(o=>{let s=(v.get(o)??1)-1;if(s)return void v.set(o,s);v.delete(o),w?.unobserve(o);}),M.size||(w?.disconnect(),w=void 0));}}function G(e,n,t,r,o){let s,u=NaN,l,g,d=()=>{s=0,r(),!l&&!s&&(u=t())>0&&u<1&&(s=requestAnimationFrame(d));},m=()=>{!s&&!l&&t()!==u&&(s=requestAnimationFrame(d));},b=c=>{l=c,cancelAnimationFrame(s),s=u=NaN,m();},h=()=>{clearTimeout(g),o(),m();},y=()=>{clearTimeout(g),g=setTimeout(h,150);},E=O(n,y),i=c=>{e[c]("scroll",m,{passive:true}),window[c]("resize",y),window[c]("orientationchange",y);};return i("addEventListener"),m(),{hold:b,remeasure:h,off(){b(true),i("removeEventListener"),E(),clearTimeout(g);}}}function I(e,n,t){return Math.min(t,Math.max(n,e))}function N(e,n,t,r){return t===n?0:I((e-n)/(t-n)*r,0,1)}var P="http://www.w3.org/2000/svg",j="cinematic-photo",q=e=>e<0?0:e>1?1:e;function x(e){let n=parseFloat(e);return Number.isFinite(n)?q(n/100):0}function V(e){return A[e]??A.linear}var F=e=>({destroy(){},getProgress:()=>e}),Q=class{constructor(n){if(typeof document>"u"){this.mount=null;return}this.mount=typeof n.wrapper=="string"?document.querySelector(n.wrapper):n.wrapper,this.mount||T("Cinematic: wrapper not found:",n.wrapper);}loadStory(n){let t=this.mount;if(typeof window>"u"||!t)return F(0);t.style.position="relative",t.style.height=n.totalHeight,t.style.display="block";let r=document.createElement("div");r.setAttribute("data-cinematic-stage",""),r.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(r);let o=[];for(let i of n.scenes){if(i.background){let a=document.createElement("img");a.id=j,a.src=i.background,a.alt="",a.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",r.appendChild(a);}let c=i.animations.filter(a=>a.type==="draw");if(c.length){let a=document.createElementNS(P,"svg");a.setAttribute("viewBox",`0 0 ${n.canvas.width} ${n.canvas.height}`),a.setAttribute("preserveAspectRatio","xMidYMid meet"),a.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",r.appendChild(a);for(let f of c){let p=document.createElementNS(P,"path");p.id=f.target.replace(/^#/,""),p.setAttribute("d",f.d),p.setAttribute("fill","none"),p.setAttribute("stroke",f.stroke),p.setAttribute("stroke-width",String(f.strokeWidth)),p.setAttribute("stroke-linecap","round"),p.setAttribute("stroke-linejoin","round");let L=f.length||p.getTotalLength?.()||0;p.style.strokeDasharray=String(L),p.style.strokeDashoffset=String(L),a.appendChild(p),o.push({kind:"draw",el:p,start:x(f.start),end:x(f.end),ease:V(f.easing),length:L});}}for(let a of i.animations){if(a.type!=="fade")continue;let f=r.querySelector(a.target)??document.querySelector(a.target);f&&(f.style.opacity=String(a.from),o.push({kind:"fade",el:f,start:x(a.start),end:x(a.end),ease:V("ease-in-out"),from:a.from,to:a.to}));}}let s=0,u=null;for(let i=t.parentElement;i?.parentElement;i=i.parentElement)if(/[ao]/.test(getComputedStyle(i).overflowY)&&i.scrollHeight>i.clientHeight&&(i!==document.body||/[aoh]/.test(getComputedStyle(i.parentElement).overflowY))){u=i;break}let l=0,g=0,d=()=>{let i=t.getBoundingClientRect().top;l=u?i-u.getBoundingClientRect().top-u.clientTop+u.scrollTop:i+window.scrollY,g=l+Math.max(0,t.offsetHeight-(u?u.clientHeight:window.innerHeight));},m=()=>{let i=u?u.scrollTop:window.scrollY;return g<=l?i>=l?1:0:N(i,l,g,1)},b=i=>{for(let c of o){let a=c.end-c.start,f=a<=0?i>=c.end?1:0:q((i-c.start)/a),p=c.ease(f);c.kind==="draw"?c.el.style.strokeDashoffset=String(c.length*(1-p)):c.el.style.opacity=String(c.from+(c.to-c.from)*p);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return b(1),F(1);let h=()=>{s=m(),b(s);};d(),h();let y=G(u||window,[t],m,h,d);C(t,{type:"draw",getProgress:()=>s,getTrigger:()=>({tStart:l,tEnd:g})});let E=D(i=>{i&&(E(),y.off(),_(t),s=1,b(1));});return {destroy(){E(),y.off(),_(t);},getProgress:()=>s}}};
2
+ exports.Cinematic=Q;
@@ -49,7 +49,7 @@ interface CinematicOptions {
49
49
  wrapper: string | HTMLElement;
50
50
  }
51
51
  interface CinematicInstance {
52
- /** Stop the scroll loop and detach observers (built DOM is left in place). */
52
+ /** Stop the scroll loop and detach its listeners (built DOM is left in place). */
53
53
  destroy: () => void;
54
54
  /** Current global scroll progress through the story (0–1). */
55
55
  getProgress: () => number;
@@ -49,7 +49,7 @@ interface CinematicOptions {
49
49
  wrapper: string | HTMLElement;
50
50
  }
51
51
  interface CinematicInstance {
52
- /** Stop the scroll loop and detach observers (built DOM is left in place). */
52
+ /** Stop the scroll loop and detach its listeners (built DOM is left in place). */
53
53
  destroy: () => void;
54
54
  /** Current global scroll progress through the story (0–1). */
55
55
  getProgress: () => number;
@@ -1 +1 @@
1
- export{a as Cinematic}from'../chunk-BSW7W2Y5.mjs';import'../chunk-THPTANES.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';
1
+ export{a as Cinematic}from'../chunk-G6K54ZFI.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';function Dt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Ot({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(n),i=0,c=[];for(let p=0;p<t;p++){let v=Math.pow(s,p);c.push(v),i+=v;}let m=[0],u=0;for(let p=0;p<t;p++)u+=c[p]/i,m.push(u);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let v=0;v<t;v++)if(p<=m[v+1]){let S=(p-m[v])/(m[v+1]-m[v]);if(v===0)return S*(2-S);let h=1-Math.pow(n,v);return h+(1-h)*(2*S-1)*(2*S-1)}return 1}}function It({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),s=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}var U={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:Dt(),bounce:Ot(),elastic:It()};function Rt(e,r,t){return Math.min(t,Math.max(r,e))}function Te(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}}var Ft=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function Nt(e,r,t,n){return e+t+r*Ft(n,0)}function Ht(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Ft(e,1))}function X(e,r,t,n){return t===r?0:Rt((e-r)/(t-r)*n,0,1)}function $e(e,r,t,n,s){let i=Nt(e.top,e.height,r,n.element)-Ht(n.viewport,t),c=Nt(e.top,e.height,r,s.element)-Ht(s.viewport,t);return {tStart:i,tEnd:c}}function Ke(e,r,t){let n=e.getBoundingClientRect(),s=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:s,scroll:0}:{top:t==="x"?n.left:n.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function Je(e){let r=parseFloat(e.getAttribute("pathLength")??"");if(r>0)return r;let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function _t(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function et(e,r,t){let n=_t(e),s=_t(r);return !n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*t)},${Math.round(n[1]+(s[1]-n[1])*t)},${Math.round(n[2]+(s[2]-n[2])*t)})`}var dt={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 Fe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function W(e,...r){Fe&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var cr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",ur="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Vt=33;function mr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function fr(e){let r=[];for(let t=0;t<Vt;t++){let n=t/(Vt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function tt(e){switch(e){case "linear":return "linear";case "ease-in":return cr;case "ease-out":return ur;case "ease-in-out":return mr()?fr(U["ease-in-out"]):null;default:return null}}var Gt=Symbol.for("svg-scroll-draw.registry");function Wt(){let e=globalThis;return e[Gt]||(e[Gt]=new Map)}function Me(e,r){Wt().set(e,r);}function pe(e){Wt().delete(e);}function rt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function _e(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=rt(i=>{if(!i)return;n();let c=(t.getProgress?.()??0)>=1;t.destroy(),t=r(c?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...c)=>t[i]?.(...c);return s.destroy=()=>{n(),t.destroy();},s}var je,nt=new Set,ot=new WeakMap,Qe=new Map,zt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function pr(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function Bt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();je??(je=new ResizeObserver(s=>{let i=false;for(let{target:c}of s)ot.get(c)!==zt(c)&&(i=true),ot.set(c,"");i&&nt.forEach(c=>c());})),nt.add(t);let n=pr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{ot.has(s)||ot.set(s,zt(s)),Qe.set(s,(Qe.get(s)??0)+1),je.observe(s);}),()=>{nt.delete(t)&&(n.forEach(s=>{let i=(Qe.get(s)??1)-1;if(i)return void Qe.set(s,i);Qe.delete(s),je?.unobserve(s);}),nt.size||(je?.disconnect(),je=void 0));}}function Ve(e,r,t,n,s){let i,c=NaN,m,u,p=()=>{i=0,n(),!m&&!i&&(c=t())>0&&c<1&&(i=requestAnimationFrame(p));},v=()=>{!i&&!m&&t()!==c&&(i=requestAnimationFrame(p));},S=y=>{m=y,cancelAnimationFrame(i),i=c=NaN,v();},h=()=>{clearTimeout(u),s(),v();},O=()=>{clearTimeout(u),u=setTimeout(h,150);},ee=Bt(r,O),A=y=>{e[y]("scroll",v,{passive:true}),window[y]("resize",O),window[y]("orientationchange",O);};return A("addEventListener"),v(),{hold:S,remeasure:h,off(){S(true),A("removeEventListener"),ee(),clearTimeout(u);}}}var dr=0;function gr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function qt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var jt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function yr(e){if(!Fe)return;let r=qt(e,"stroke");if(!r||r==="none"){W("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!jt.has(t)&&!jt.has(qt(e,"fill"))&&W("Element has a fill \u2014 it may obscure the stroke animation.",e);}function hr(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=t==="x"?window.scrollX:window.scrollY,c=e-i,m=r-i,u=t==="x";n.innerHTML=`
2
- <div style="position:absolute;${u?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Yt=/[MmLlHhVvCcSsQqTtAaZz]/g;function br(e,r,t){if(!Fe)return;let n=(e.match(Yt)??[]).join("").toUpperCase(),s=(r.match(Yt)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,c=(r.match(Qt)??[]).length;if(n!==s){W(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==c&&W(`morphTo: coordinate count differs (${i} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function wr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let c=parseFloat(i),m=n[s++]??c;return String(+(c+(m-c)*t).toFixed(4))})}function Ut(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:_e(r,(t,n)=>vr(e,t,n))}function vr(e,r,t){let{preset:n,...s}=r,i=n?{...dt[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=false,easing:p="linear",trigger:v={},stagger:S=0,direction:h="forward",once:O=false,debug:ee=false,axis:A="y",scrollContainer:y,autoReverse:x=false,delay:g=0,strokeColor:b,strokeWidth:w,fillOpacity:I,waypoints:z,velocityScale:N=false,threshold:te=0,rootMargin:Ge="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:re,autoplay:Ae=false,duration:L=1e3,native:H=true,onProgress:ke,onStart:Z,onComplete:ne,onEnter:ge,onLeave:Ie,onEnterBack:ye,onLeaveBack:me}=i,K=re===true?"left":typeof re=="string"?re:false,q=typeof p=="function"?p:U[p]??U.linear,Re=Te(v.start||"top bottom"),We=Te(v.end||"bottom top"),F=typeof y=="string"?document.querySelector(y):y??null,he=Array.isArray(b)?b[0]:null,be=Array.isArray(b)?b[1]:typeof b=="string"?b:null,ce=Array.isArray(w)?w[0]:null,Pe=Array.isArray(w)?w[1]:typeof w=="number"?w:null,we=Array.isArray(I)?I[0]:null,ue=Array.isArray(I)?I[1]:typeof I=="number"?I:null;function ve(o){let l=o*100;switch(K){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let a=K?[]:Array.from(e.querySelectorAll(c)),f=[],_=[],M=0,$=0,R=S,k=0,Le=0,V=false,Se=false,Ee=0,at=-1,Ye=[],Ue=-1,ie=false,fe=0,Ce=0,De,lt=false,ct=null;function wt(){ct?.destroy(),ct=null;}let Oe=new Set,vt=NaN,Ne=true,Xe=-1,St=performance.now(),He=NaN;function Ze(){return F?A==="x"?F.scrollLeft:F.scrollTop:A==="x"?window.scrollX:window.scrollY}function Et(){return F?A==="x"?F.clientWidth:F.clientHeight:A==="x"?window.innerWidth:window.innerHeight}function xt(){let o=Ke(e,F,A);return $e(o,o.scroll,Et(),Re,We)}function rr(){let o=$-M,l=a.length-1,d=F??document.documentElement,T=A==="x"?"Width":"Height";if(R=S,S>0&&l>0&&o>0){let j=d[`scroll${T}`]-d[`client${T}`]-1-M-o/m;j>=0&&(R=Math.min(S,j/(l*o)));}let G=Math.max(0,l)*R*o,oe=o/Math.min(m,1);k=M+Math.min(0,G,oe,G+oe),Le=M+Math.max(0,G,oe,G+oe);}function Tt(){(({tStart:M,tEnd:$}=xt())),rr(),ee&&Fe&&(wt(),ct=hr(M,$,A));}function ut(o,l=xt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let d=o.destroy;return o.destroy=()=>{d.call(o),pe(e);},o}function Mt(o,l){return O&&!x?Math.max(at,q(Ye[o]=Math.max(Ye[o]??0,l))):q(l)}function nr(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let d=l==="reverse"?1-o:o;e.style.clipPath=ve(d);return}a.forEach((d,T)=>mt(d,T,o,l));}function mt(o,l,d,T){o.style.strokeDashoffset=T==="reverse"?`${f[l]*d}`:`${f[l]*(1-d)}`,u&&(o.style.opacity=T==="reverse"?`${1-d}`:`${d}`),he&&be?o.style.stroke=et(he,be,d):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*d}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*d}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",wr(_[l],B,d));}function ft(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=ve(h==="reverse"?1:0);return}a.forEach((o,l)=>{o.style.strokeDasharray=`${f[l]}`,o.style.strokeDashoffset=h==="reverse"?"0":`${f[l]}`,u?o.style.opacity=h==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",_[l]);});}function ze(o,l){let d=o.getAttribute("d"),T=Je(o);if(B&&_[l]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[l]),T=Math.max(Je(o),G),o.setAttribute("d",d);}f[l]=T,o.style.strokeDasharray=`${T}`;}if(a.forEach((o,l)=>{yr(o);let d=o.tagName.toLowerCase()==="path";d?_.push(o.getAttribute("d")??""):_.push(""),ze(o,l);let T=f[l];B&&(d?br(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=h==="reverse"?`${T}`:"0",u&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=h==="reverse"?"0":`${T}`,u?o.style.opacity=h==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`));}),t)return K&&(e.style.clipPath=ve(1)),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};K&&(e.style.clipPath=ve(h==="reverse"?1:0));let At=typeof p=="string"?tt(p):null;function or(){return !(H===false||Ae||ee&&Fe||!gr()||!a.length||!At||K||A!=="y"||F||m!==1||S!==0||O||x||N!==false||B||z||le||g>0||ke||Z||ne||ge||Ie||ye||me||b!=null||w!=null||I!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function sr(){let o=++dr,l=`svg-scroll-draw-${o}`,d=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=h==="reverse"?"0":"var(--ssd-len)",oe=h==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,C=`stroke-dashoffset:${oe};`;u&&(j+=`opacity:${h==="reverse"?1:0};`,C+=`opacity:${h==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${l}{from{${j}}to{${C}}}.${d}{view-timeline-name:${T};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(d);function J(E,P){E.style.setProperty("--ssd-len",String(f[P])),E.style.strokeDasharray=`${f[P]}`,E.style.strokeDashoffset="",E.style.opacity="",E.style.animationPlayState="",E.classList.add(l);}a.forEach(J);let Q=false,se=-1;function ae(){if(se>=0)return se;let E=e.getBoundingClientRect(),{tStart:P,tEnd:Y}=$e({top:E.top,height:E.height},Ze(),Et(),Re,We);return q(X(Ze(),P,Y,m))}return {destroy(){e.classList.remove(d),a.forEach(E=>{E.classList.remove(l),E.style.removeProperty("--ssd-len"),E.style.animationPlayState="";}),D.remove();},replay(){Q=false,se=-1,a.forEach(J);},pause(){Q=true,a.forEach(E=>{E.style.animationPlayState="paused";});},resume(){Q&&(Q=false,a.forEach(E=>{E.style.animationPlayState="running";}));},seek(E){let P=Math.min(1,Math.max(0,E));se=P,Q=true,a.forEach((Y,xe)=>{Y.classList.remove(l),Y.style.strokeDashoffset=h==="reverse"?`${f[xe]*P}`:`${f[xe]*(1-P)}`,u&&(Y.style.opacity=h==="reverse"?`${1-P}`:`${P}`);});},getProgress(){return ae()},refresh(){a.forEach((E,P)=>{ze(E,P),E.style.setProperty("--ssd-len",String(f[P]));});}}}if(or())return ut(sr());function ir(){let o=Math.max(1,L),l=K?o:o*(1+Math.max(0,a.length-1)*S),d=0,T=0,G=false;function oe(se){let ae=true,E=Math.min(1,Math.max(0,se/l));if(K){let P=Math.min(1,Math.max(0,se/o)),Y=q(P);fe=Y,e.style.setProperty("--scroll-draw-progress",String(Y)),e.style.clipPath=ve(h==="reverse"?1-Y:Y),ke?.(Y),P<1&&(ae=false);}else {a.forEach((Y,xe)=>{let lr=xe*S*o,Ct=Math.min(1,Math.max(0,(se-lr)/o));mt(Y,xe,q(Ct),h),Ct<1&&(ae=false);});let P=q(E);fe=P,ke?.(P),e.style.setProperty("--scroll-draw-progress",String(P));}if(z){let P=q(E);for(let Y in z){let xe=parseFloat(Y);P>=xe&&!Oe.has(xe)&&(Oe.add(xe),z[Y]?.());}}return ae}function j(se){if(ie)return;let ae=se-d;Se||(Se=true,Z?.());let E=oe(ae);if(E&&!V){V=true,oe(l),ne?.(),Ce<(le==="infinite"?1/0:le??0)&&(Ce++,De=setTimeout(()=>{d=performance.now(),Se=false,V=false,Oe.clear(),ft(),Ee=requestAnimationFrame(j);},de));return}E||(Ee=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Ee),clearTimeout(De),d=performance.now(),T=0,ie=false,Se=false,V=false,Ce=0,G=true,fe=0,Oe.clear(),ft(),Ee=requestAnimationFrame(j);}let D=new IntersectionObserver(se=>{se.forEach(ae=>{ae.isIntersecting&&!(O&&V)?C():!ae.isIntersecting&&!O&&!V&&(cancelAnimationFrame(Ee),clearTimeout(De),G=false);});},{root:F??null,threshold:te,rootMargin:Ge}),J;function Q(){clearTimeout(J),J=setTimeout(()=>a.forEach(ze),150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),g>0?setTimeout(()=>D.observe(e),g):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(De),D.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(J);},replay(){Ce=0,C();},pause(){ie||!G||(ie=true,T=performance.now()-d,cancelAnimationFrame(Ee));},resume(){ie&&(ie=false,G=true,d=performance.now()-T,Ee=requestAnimationFrame(j));},seek(se){let ae=Math.min(1,Math.max(0,se));fe=ae,ie=true,T=ae*l,d=performance.now()-T,cancelAnimationFrame(Ee),oe(T);},getProgress(){return fe},refresh(){clearTimeout(J),a.forEach(ze);}}}if(Ae)return ut(ir());Tt();let Pt=()=>X(Ze(),k,Le,1);function Lt(){V=true,ne?.(),Ce<(le==="infinite"?1/0:le)&&(Ce++,De=setTimeout(()=>{lt=true;},de));}function $t(){at=-1,Ye=[],Se=false,V=false,lt=false,Oe.clear(),ft(),Ne=true;}function ar(){let o=performance.now(),l=Ze();if(lt&&Pt()%1&&$t(),!Ne&&N===false&&l===vt)return;Ne=false,vt=l;let d=m;if(N!==false){let C=o-St,D=C>0?Math.abs(l-(Xe<0?l:Xe))/C:0;d=m*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Xe=l,St=o;let T=x?Ue===-1||l>=Ue?"forward":"reverse":h;Ue=l;let G=$-M,oe=true,j=G===0?0:(l-M)/G;if(isNaN(He)||(He<=0&&j>0&&ge?.(),He<1&&j>=1&&Ie?.(),He>=1&&j<1&&ye?.(),He>0&&j<=0&&me?.()),He=j,K){let C=Mt(0,X(l,M,$,d));fe=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=ve(D),ke?.(C),!Se&&X(l,M,$,d)>0&&(Se=true,Z?.()),C>=1&&!V?Lt():C<1&&!O&&(V=false);return}if(a.forEach((C,D)=>{let J=D*R*G,Q=Mt(D,X(l,M+J,$+J,d));mt(C,D,Q,T),D===0&&(fe=Q,ke?.(Q),e.style.setProperty("--scroll-draw-progress",String(Q))),Q<1&&(oe=false);}),z){let C=q(X(l,M,$,d));for(let D in z){let J=parseFloat(D);C>=J&&!Oe.has(J)&&(Oe.add(J),z[D]?.());}}!Se&&X(l,M,$,d)>0&&(Se=true,Z?.()),oe&&!V?Lt():!oe&&!O&&(V=false);}let Be=Ve(F??window,[e],Pt,ar,()=>{let o=f.join();a.forEach(ze),Tt(),Ne=true,f.join()!==o&&qe();}),pt=g>0;function qe(){Be.hold(ie||pt);}let kt;return pt&&(kt=setTimeout(()=>{pt=false,qe();},g)),qe(),ut({destroy(){clearTimeout(De),clearTimeout(kt),Be.off(),wt();},replay(){$t(),Ue=-1,Xe=-1,Ce=0,ie=false,fe=0,clearTimeout(De),qe();},pause(){ie=true,Be.hold(true);},resume(){ie&&(ie=false,Ne=true,qe());},seek(o){let l=Math.min(1,Math.max(0,o));fe=l,at=l,Ye=[],ie=true,Be.hold(true),nr(l,h),Ne=true;},getProgress(){return fe},refresh:Be.remeasure},()=>({tStart:M,tEnd:$}))}function Sr(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Ut(n,r):(W("Container not found:",e),t)}function Er(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],c=n[2].trim();if(c)for(let m of c.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function xr(e,r,t){let n=Xt(e),s=Xt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,c)=>{let m=s[c];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((u,p)=>`${u}${i.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,p)=>`${u}${m.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,p)=>`${u+(m.nums[p]-u)*t}${i.units[p]}`).join(", ")})`}).join(" ")}function Zt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Er(n))return et(n,s,t);if(n.includes("("))return xr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&c){let m=parseFloat(i[1]),u=parseFloat(c[1]);return `${m+(u-m)*t}${i[2]||c[2]}`}return t<1?n:s}function Tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ar=0,Kt="--scroll-draw-progress";function Pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var er={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,r){return typeof window>"u"?er:r.respectReducedMotion===false?Jt(e,r,false):_e(r,(t,n)=>Jt(e,t,n))}function Jt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:c=1,once:m=false,axis:u="y",scrollContainer:p,native:v=true,velocityScale:S=false,triggerElement:h,onProgress:O,onComplete:ee,onEnter:A,onLeave:y,onEnterBack:x,onLeaveBack:g}=r,b=typeof i=="function"?i:U[i]??U["ease-out"],w=Te(s.start||"top bottom"),I=Te(s.end||"bottom top"),z=h??e,N=typeof p=="string"?document.querySelector(p):p??null,te=Object.entries(n).map(([a,f])=>({prop:Tr(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Ge(){let a=window.getComputedStyle(e);for(let f of te)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function le(){for(let a of te)e.style.setProperty(a.prop,String(a.to));}let de=new Map;for(let a of [...te.map(f=>f.prop),Kt])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,f]of de)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(t)return le(),ee?.(),{...er,destroy:B,getProgress:()=>1};Ge();let re=()=>N?u==="x"?N.scrollLeft:N.scrollTop:u==="x"?window.scrollX:window.scrollY,Ae=()=>N?u==="x"?N.clientWidth:N.clientHeight:u==="x"?window.innerWidth:window.innerHeight,L=typeof i=="string"?tt(i):null;function H(){if(!v||!Pr()||!L||u!=="y"||N||z!==e||m||c!==1||O||ee||A||y||x||g||S!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let a of te)if(!Mr.has(a.prop))return false;return true}function ke(){let a=`ssd-a-${++Ar}`,f=te.map(k=>`${k.prop}:${k.from}`).join(";"),_=te.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${f}}to{${_}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${L};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(a);let $=()=>{let k=e.getBoundingClientRect();return $e({top:k.top,height:k.height},re(),Ae(),w,I)};Me(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:$});let R={refresh(){},destroy(){e.classList.remove(a),M.remove(),e.style.animationPlayState="",B(),pe(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Le=Math.min(1,Math.max(0,k));e.classList.remove(a);for(let V of te)e.style.setProperty(V.prop,Zt(V.from,V.to,Le));},getProgress(){let{tStart:k,tEnd:Le}=$();return b(X(re(),k,Le,c))}};return R}if(H())return ke();let Z=0,ne=0,ge=false,Ie=-1,ye=0,me=0,K=false,q=NaN,Re=-1,We=0,F=z===e?te:[],he=false;function be(){let a=e.style,f=F.map(R=>a.getPropertyValue(R.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(R=>a.setProperty(R.prop,de.get(R.prop)??""));let M=Ke(z,N,u);F.forEach((R,k)=>a.setProperty(R.prop,f[k])),F.length&&(e.offsetWidth,a.transition=_);let $=$e(M,M.scroll,Ae(),w,I);he&&Math.abs($.tStart-Z)<1&&Math.abs($.tEnd-ne)<1||(he=true,Z=$.tStart,ne=$.tEnd);}function ce(a){e.style.setProperty(Kt,String(a));for(let f of te)e.style.setProperty(f.prop,Zt(f.from,f.to,a));O?.(a);}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&A?.(),q<1&&a>=1&&y?.(),q>=1&&a<1&&x?.(),q>0&&a<=0&&g?.(),q=a;}function we(){if(ge)return;let a=performance.now(),f=re(),_=c;if(S!==false){let k=a-We,Le=k>0?Math.abs(f-(Re<0?f:Re))/k:0;_=c*Math.max(.2,1+Le*(typeof S=="number"?S:1)*.04);}Re=f,We=a;let M=ne===Z?0:(f-Z)/(ne-Z);Pe(M);let $=X(f,Z,ne,_),R=m?Math.max(Ie,b(ye=Math.max(ye,$))):b($);me=R,ce(R),R>=1&&!K?(K=true,ee?.()):R<1&&!m&&(K=false);}let ue=Ve(N??window,[z],()=>X(re(),Z,ne,Math.min(c,1)),we,be);be(),ne===Z&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=X(re(),Z,ne,c),me=b(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:Z,tEnd:ne})});function ve(){ge=true,ue.hold(true);}return {destroy(){ge=true,ue.off(),B(),pe(e);},replay(){Ie=-1,ye=0,K=false,me=0,ge=false,ce(0),ue.hold(false);},pause:ve,resume(){ge&&(ge=false,ue.hold(false));},seek(a){let f=Math.min(1,Math.max(0,a));me=f,Ie=f,ye=0,ve(),ce(f);},getProgress(){return me},refresh:ue.remeasure}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lr(e,r){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;return t?gt(t,r):(W("scrollAnimate: element not found:",e),st)}function $r(e,r={}){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return W("scrollParallax: element not found:",e),st;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:c,onProgress:m}=r,u=-n*100,p=t.style,v=!!t.ownerSVGElement,S=p.getPropertyValue("transform-box");v&&p.setProperty("transform-box","fill-box");let h=gt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:m});return v?{...h,destroy(){h.destroy(),p.setProperty("transform-box",S);}}:h}var yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return yt;let t=typeof e=="string"?document.querySelector(e):e;return t?_e(r,(n,s)=>Cr(t,n,s)):(W("scrollCounter: element not found:",e),yt)}function Cr(e,r,t){let{from:n=0,to:s,format:i,easing:c="ease-out",trigger:m={},once:u=true,decimals:p,onComplete:v}=r,S=p!==void 0?L=>L.toFixed(p):i??(L=>String(Math.round(L))),h=typeof c=="function"?c:U[c]??U["ease-out"],O=Te(m.start||"top 80%"),ee=Te(m.end||"top 20%");if(t)return e.textContent=S(s),v?.(),{...yt,getProgress:()=>1};let A=0,y=0,x=false,g=-1,b=0,w=0,I=false,z=()=>window.scrollY,N=()=>window.innerHeight;function te(){let L=e.getBoundingClientRect(),H=$e({top:L.top,height:L.height},z(),N(),O,ee);x&&Math.abs(H.tStart-A)<1&&Math.abs(H.tEnd-y)<1||(x=true,A=H.tStart,y=H.tEnd);}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function le(L){e.textContent=S(n+(s-n)*L),e.style.setProperty("--scroll-draw-progress",String(L));}let de=()=>X(z(),A,y,1);function B(){let L=de(),H=u?Math.max(g,h(b=Math.max(b,L))):h(L);w=H,le(H),H>=1&&!I?(I=true,v?.()):H<1&&!u&&(I=false);}te();{b=X(z(),A,y,1);let L=h(b);w=L,le(L);}let re=Ve(window,[e],de,B,te);Me(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:A,tEnd:y})});let Ae=()=>re.hold(false);return {destroy(){re.off(),e.style.setProperty("--scroll-draw-progress",Ge),pe(e);},replay(){g=-1,b=0,I=false,w=0,le(0),Ae();},pause:()=>re.hold(true),resume:Ae,seek(L){let H=Math.min(1,Math.max(0,L));w=H,g=H,b=0,re.hold(true),le(H);},getProgress(){return w}}}var tr="http://www.w3.org/2000/svg",Dr="cinematic-photo",ht=e=>e<0?0:e>1?1:e;function it(e){let r=parseFloat(e);return Number.isFinite(r)?ht(r/100):0}function Or(e){return U[e]??U.linear}var Ir={destroy:()=>{},getProgress:()=>0},bt=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||W("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return Ir;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let y of r.scenes){if(y.background){let g=document.createElement("img");g.id=Dr,g.src=y.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 x=y.animations.filter(g=>g.type==="draw");if(x.length){let g=document.createElementNS(tr,"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 b of x){let w=document.createElementNS(tr,"path");w.id=b.target.replace(/^#/,""),w.setAttribute("d",b.d),w.setAttribute("fill","none"),w.setAttribute("stroke",b.stroke),w.setAttribute("stroke-width",String(b.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let I=b.length||w.getTotalLength?.()||0;w.style.strokeDasharray=String(I),w.style.strokeDashoffset=String(I),g.appendChild(w),s.push({kind:"draw",el:w,start:it(b.start),end:it(b.end),ease:Or(b.easing),length:I});}}for(let g of y.animations){if(g.type!=="fade")continue;let b=n.querySelector(g.target)??document.querySelector(g.target);b&&(b.style.opacity=String(g.from),s.push({kind:"fade",el:b,start:it(g.start),end:it(g.end),ease:U["ease-in-out"]??U.linear,from:g.from,to:g.to}));}}let i=0,c=()=>{let y=t.offsetHeight-window.innerHeight;return y<=0?t.getBoundingClientRect().top<=0?1:0:ht(-t.getBoundingClientRect().top/y)},m=y=>{for(let x of s){let g=x.end-x.start,b=g<=0?y>=x.end?1:0:ht((y-x.start)/g),w=x.ease(b);x.kind==="draw"?x.el.style.strokeDashoffset=String(x.length*(1-w)):x.el.style.opacity=String(x.from+(x.to-x.from)*w);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let u=0,p=false,v=false,S=()=>{i=c(),m(i),p&&(u=requestAnimationFrame(S));},h=()=>{p||(p=true,u=requestAnimationFrame(S));},O=()=>{p=false,cancelAnimationFrame(u);},ee=new IntersectionObserver(y=>{for(let x of y)v=x.isIntersecting,v?h():O();},{threshold:0});ee.observe(n),i=c(),m(i),Me(t,{type:"draw",getProgress:()=>i,getTrigger:()=>{let y=t.getBoundingClientRect().top+window.scrollY;return {tStart:y,tEnd:y+Math.max(0,t.offsetHeight-window.innerHeight)}}});let A=rt(y=>{y&&(A(),O(),ee.disconnect(),pe(t),i=1,m(1));});return {destroy(){A(),O(),ee.disconnect(),pe(t);},getProgress:()=>i}}};
4
- exports.Cinematic=bt;exports.PRESETS=dt;exports.createBounce=Ot;exports.createElastic=It;exports.createSpring=Dt;exports.scrollAnimate=Lr;exports.scrollCounter=kr;exports.scrollDraw=Sr;exports.scrollParallax=$r;
1
+ 'use strict';function Ct({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Dt({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(n),i=0,l=[];for(let d=0;d<t;d++){let v=Math.pow(s,d);l.push(v),i+=v;}let u=[0],m=0;for(let d=0;d<t;d++)m+=l[d]/i,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<t;v++)if(d<=u[v+1]){let E=(d-u[v])/(u[v+1]-u[v]);if(v===0)return E*(2-E);let y=1-Math.pow(n,v);return y+(1-y)*(2*E-1)*(2*E-1)}return 1}}function Ot({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),s=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}var oe={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:Ct(),bounce:Dt(),elastic:Ot()};function It(e,r,t){return Math.min(t,Math.max(r,e))}function Te(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}}var Ht=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function Rt(e,r,t,n){return e+t+r*Ht(n,0)}function Nt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Ht(e,1))}function R(e,r,t,n){return t===r?0:It((e-r)/(t-r)*n,0,1)}function $e(e,r,t,n,s){let i=Rt(e.top,e.height,r,n.element)-Nt(n.viewport,t),l=Rt(e.top,e.height,r,s.element)-Nt(s.viewport,t);return {tStart:i,tEnd:l}}function Ke(e,r,t){let n=e.getBoundingClientRect(),s=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:s,scroll:0}:{top:t==="x"?n.left:n.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function Je(e){let r=parseFloat(e.getAttribute("pathLength")??"");if(r>0)return r;let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Ft(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 et(e,r,t){let n=Ft(e),s=Ft(r);return !n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*t)},${Math.round(n[1]+(s[1]-n[1])*t)},${Math.round(n[2]+(s[2]-n[2])*t)})`}var dt={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 _e=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function W(e,...r){_e&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var mr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",fr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",_t=33;function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function dr(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 tt(e){switch(e){case "linear":return "linear";case "ease-in":return mr;case "ease-out":return fr;case "ease-in-out":return pr()?dr(oe["ease-in-out"]):null;default:return null}}var Vt=Symbol.for("svg-scroll-draw.registry");function Gt(){let e=globalThis;return e[Vt]||(e[Vt]=new Map)}function Me(e,r){Gt().set(e,r);}function pe(e){Gt().delete(e);}function rt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function Ve(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=rt(i=>{if(!i)return;n();let l=(t.getProgress?.()??0)>=1;t.destroy(),t=r(l?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...l)=>t[i]?.(...l);return s.destroy=()=>{n(),t.destroy();},s}var je,nt=new Set,ot=new WeakMap,Ye=new Map,Wt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function gr(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function zt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();je??(je=new ResizeObserver(s=>{let i=false;for(let{target:l}of s)ot.get(l)!==Wt(l)&&(i=true),ot.set(l,"");i&&nt.forEach(l=>l());})),nt.add(t);let n=gr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{ot.has(s)||ot.set(s,Wt(s)),Ye.set(s,(Ye.get(s)??0)+1),je.observe(s);}),()=>{nt.delete(t)&&(n.forEach(s=>{let i=(Ye.get(s)??1)-1;if(i)return void Ye.set(s,i);Ye.delete(s),je?.unobserve(s);}),nt.size||(je?.disconnect(),je=void 0));}}function ke(e,r,t,n,s){let i,l=NaN,u,m,d=()=>{i=0,n(),!u&&!i&&(l=t())>0&&l<1&&(i=requestAnimationFrame(d));},v=()=>{!i&&!u&&t()!==l&&(i=requestAnimationFrame(d));},E=w=>{u=w,cancelAnimationFrame(i),i=l=NaN,v();},y=()=>{clearTimeout(m),s(),v();},I=()=>{clearTimeout(m),m=setTimeout(y,150);},se=zt(r,I),f=w=>{e[w]("scroll",v,{passive:true}),window[w]("resize",I),window[w]("orientationchange",I);};return f("addEventListener"),v(),{hold:E,remeasure:y,off(){E(true),f("removeEventListener"),se(),clearTimeout(m);}}}var yr=0;function hr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Bt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var qt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function br(e){if(!_e)return;let r=Bt(e,"stroke");if(!r||r==="none"){W("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!qt.has(t)&&!qt.has(Bt(e,"fill"))&&W("Element has a fill \u2014 it may obscure the stroke animation.",e);}function wr(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=t==="x"?window.scrollX:window.scrollY,l=e-i,u=r-i,m=t==="x";n.innerHTML=`
2
+ <div style="position:absolute;${m?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
+ <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Yt=/[MmLlHhVvCcSsQqTtAaZz]/g;function vr(e,r,t){if(!_e)return;let n=(e.match(Yt)??[]).join("").toUpperCase(),s=(r.match(Yt)??[]).join("").toUpperCase(),i=(e.match(jt)??[]).length,l=(r.match(jt)??[]).length;if(n!==s){W(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==l&&W(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function Er(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),u=n[s++]??l;return String(+(l+(u-l)*t).toFixed(4))})}function Qt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ve(r,(t,n)=>Sr(e,t,n))}function Sr(e,r,t){let{preset:n,...s}=r,i=n?{...dt[n],...s}:s,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:v={},stagger:E=0,direction:y="forward",once:I=false,debug:se=false,axis:f="y",scrollContainer:w,autoReverse:h=false,delay:x=0,strokeColor:b,strokeWidth:L,fillOpacity:U,waypoints:z,velocityScale:N=false,threshold:J=0,rootMargin:Ge="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:ee,autoplay:Ae=false,duration:P=1e3,native:H=true,onProgress:Ce,onStart:X,onComplete:te,onEnter:ge,onLeave:Re,onEnterBack:ye,onLeaveBack:me}=i,Z=ee===true?"left":typeof ee=="string"?ee:false,q=typeof d=="function"?d:oe[d]??oe.linear,Ne=Te(v.start||"top bottom"),We=Te(v.end||"bottom top"),F=typeof w=="string"?document.querySelector(w):w??null,he=Array.isArray(b)?b[0]:null,be=Array.isArray(b)?b[1]:typeof b=="string"?b:null,ce=Array.isArray(L)?L[0]:null,Pe=Array.isArray(L)?L[1]:typeof L=="number"?L:null,we=Array.isArray(U)?U[0]:null,ue=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function ve(o){let c=o*100;switch(Z){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let a=Z?[]:Array.from(e.querySelectorAll(l)),p=[],_=[],M=0,$=0,O=E,k=0,Le=0,V=false,Ee=false,Se=0,at=-1,Qe=[],Ue=-1,ie=false,fe=0,De=0,Oe,lt=false,ct=null;function bt(){ct?.destroy(),ct=null;}let Ie=new Set,wt=NaN,He=true,Xe=-1,vt=performance.now(),Fe=NaN;function Ze(){return F?f==="x"?F.scrollLeft:F.scrollTop:f==="x"?window.scrollX:window.scrollY}function Et(){return F?f==="x"?F.clientWidth:F.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function St(){let o=Ke(e,F,f);return $e(o,o.scroll,Et(),Ne,We)}function or(){let o=$-M,c=a.length-1,g=F??document.documentElement,T=f==="x"?"Width":"Height";if(O=E,E>0&&c>0&&o>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-o/u;j>=0&&(O=Math.min(E,j/(c*o)));}let G=Math.max(0,c)*O*o,re=o/Math.min(u,1);k=M+Math.min(0,G,re,G+re),Le=M+Math.max(0,G,re,G+re);}function xt(){(({tStart:M,tEnd:$}=St())),or(),se&&_e&&(bt(),ct=wr(M,$,f));}function ut(o,c=St){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),pe(e);},o}function Tt(o,c){return I&&!h?Math.max(at,q(Qe[o]=Math.max(Qe[o]??0,c))):q(c)}function sr(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let g=c==="reverse"?1-o:o;e.style.clipPath=ve(g);return}a.forEach((g,T)=>mt(g,T,o,c));}function mt(o,c,g,T){o.style.strokeDashoffset=T==="reverse"?`${p[c]*g}`:`${p[c]*(1-g)}`,m&&(o.style.opacity=T==="reverse"?`${1-g}`:`${g}`),he&&be?o.style.stroke=et(he,be,g):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*g}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*g}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",Er(_[c],B,g));}function ft(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ve(y==="reverse"?1:0);return}a.forEach((o,c)=>{o.style.strokeDasharray=`${p[c]}`,o.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",_[c]);});}function ze(o,c){let g=o.getAttribute("d"),T=Je(o);if(B&&_[c]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[c]),T=Math.max(Je(o),G),o.setAttribute("d",g);}p[c]=T,o.style.strokeDasharray=`${T}`;}if(a.forEach((o,c)=>{br(o);let g=o.tagName.toLowerCase()==="path";g?_.push(o.getAttribute("d")??""):_.push(""),ze(o,c);let T=p[c];B&&(g?vr(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`));}),t)return Z&&(e.style.clipPath=ve(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=ve(y==="reverse"?1:0));let Mt=typeof d=="string"?tt(d):null;function ir(){return !(H===false||Ae||se&&_e||!hr()||!a.length||!Mt||Z||f!=="y"||F||u!==1||E!==0||I||h||N!==false||B||z||le||x>0||Ce||X||te||ge||Re||ye||me||b!=null||L!=null||U!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function ar(){let o=++yr,c=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,C=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,C+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${j}}to{${C}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Mt};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function K(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=`${p[A]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c);}a.forEach(K);let Y=false,ne=-1;function ae(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=$e({top:S.top,height:S.height},Ze(),Et(),Ne,We);return q(R(Ze(),A,Q,u))}return {destroy(){e.classList.remove(g),a.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),D.remove();},replay(){Y=false,ne=-1,a.forEach(K);},pause(){Y=true,a.forEach(S=>{S.style.animationPlayState="paused";});},resume(){Y&&(Y=false,a.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=true,a.forEach((Q,xe)=>{Q.classList.remove(c),Q.style.strokeDashoffset=y==="reverse"?`${p[xe]*A}`:`${p[xe]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return ae()},refresh(){a.forEach((S,A)=>{ze(S,A),S.style.setProperty("--ssd-len",String(p[A]));});}}}if(ir())return ut(ar());function lr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,a.length-1)*E),g=0,T=0,G=false;function re(ne){let ae=true,S=Math.min(1,Math.max(0,ne/c));if(Z){let A=Math.min(1,Math.max(0,ne/o)),Q=q(A);fe=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=ve(y==="reverse"?1-Q:Q),Ce?.(Q),A<1&&(ae=false);}else {a.forEach((Q,xe)=>{let ur=xe*E*o,kt=Math.min(1,Math.max(0,(ne-ur)/o));mt(Q,xe,q(kt),y),kt<1&&(ae=false);});let A=q(S);fe=A,Ce?.(A),e.style.setProperty("--scroll-draw-progress",String(A));}if(z){let A=q(S);for(let Q in z){let xe=parseFloat(Q);A>=xe&&!Ie.has(xe)&&(Ie.add(xe),z[Q]?.());}}return ae}function j(ne){if(ie)return;let ae=ne-g;Ee||(Ee=true,X?.());let S=re(ae);if(S&&!V){V=true,re(c),te?.(),De<(le==="infinite"?1/0:le??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),Ee=false,V=false,Ie.clear(),ft(),Se=requestAnimationFrame(j);},de));return}S||(Se=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Se),clearTimeout(Oe),g=performance.now(),T=0,ie=false,Ee=false,V=false,De=0,G=true,fe=0,Ie.clear(),ft(),Se=requestAnimationFrame(j);}let D=new IntersectionObserver(ne=>{ne.forEach(ae=>{ae.isIntersecting&&!(I&&V)?C():!ae.isIntersecting&&!I&&!V&&(cancelAnimationFrame(Se),clearTimeout(Oe),G=false);});},{root:F??null,threshold:J,rootMargin:Ge}),K;function Y(){clearTimeout(K),K=setTimeout(()=>a.forEach(ze),150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Se),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(K);},replay(){De=0,C();},pause(){ie||!G||(ie=true,T=performance.now()-g,cancelAnimationFrame(Se));},resume(){ie&&(ie=false,G=true,g=performance.now()-T,Se=requestAnimationFrame(j));},seek(ne){let ae=Math.min(1,Math.max(0,ne));fe=ae,ie=true,T=ae*c,g=performance.now()-T,cancelAnimationFrame(Se),re(T);},getProgress(){return fe},refresh(){clearTimeout(K),a.forEach(ze);}}}if(Ae)return ut(lr());xt();let At=()=>R(Ze(),k,Le,1);function Pt(){V=true,te?.(),De<(le==="infinite"?1/0:le)&&(De++,Oe=setTimeout(()=>{lt=true;},de));}function Lt(){at=-1,Qe=[],Ee=false,V=false,lt=false,Ie.clear(),ft(),He=true;}function cr(){let o=performance.now(),c=Ze();if(lt&&At()%1&&Lt(),!He&&N===false&&c===wt)return;He=false,wt=c;let g=u;if(N!==false){let C=o-vt,D=C>0?Math.abs(c-(Xe<0?c:Xe))/C:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Xe=c,vt=o;let T=h?Ue===-1||c>=Ue?"forward":"reverse":y;Ue=c;let G=$-M,re=true,j=G===0?0:(c-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&ge?.(),Fe<1&&j>=1&&Re?.(),Fe>=1&&j<1&&ye?.(),Fe>0&&j<=0&&me?.()),Fe=j,Z){let C=Tt(0,R(c,M,$,g));fe=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=ve(D),Ce?.(C),!Ee&&R(c,M,$,g)>0&&(Ee=true,X?.()),C>=1&&!V?Pt():C<1&&!I&&(V=false);return}if(a.forEach((C,D)=>{let K=D*O*G,Y=Tt(D,R(c,M+K,$+K,g));mt(C,D,Y,T),D===0&&(fe=Y,Ce?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=false);}),z){let C=q(R(c,M,$,g));for(let D in z){let K=parseFloat(D);C>=K&&!Ie.has(K)&&(Ie.add(K),z[D]?.());}}!Ee&&R(c,M,$,g)>0&&(Ee=true,X?.()),re&&!V?Pt():!re&&!I&&(V=false);}let Be=ke(F??window,[e],At,cr,()=>{let o=p.join();a.forEach(ze),xt(),He=true,p.join()!==o&&qe();}),pt=x>0;function qe(){Be.hold(ie||pt);}let $t;return pt&&($t=setTimeout(()=>{pt=false,qe();},x)),qe(),ut({destroy(){clearTimeout(Oe),clearTimeout($t),Be.off(),bt();},replay(){Lt(),Ue=-1,Xe=-1,De=0,ie=false,fe=0,clearTimeout(Oe),qe();},pause(){ie=true,Be.hold(true);},resume(){ie&&(ie=false,He=true,qe());},seek(o){let c=Math.min(1,Math.max(0,o));fe=c,at=c,Qe=[],ie=true,Be.hold(true),sr(c,y),He=true;},getProgress(){return fe},refresh:Be.remeasure},()=>({tStart:M,tEnd:$}))}function xr(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?Qt(n,r):(W("Container not found:",e),t)}function Tr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ut(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],l=n[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function Mr(e,r,t){let n=Ut(e),s=Ut(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,l)=>{let u=s[l];return i.fn!==u.fn||i.nums.length!==u.nums.length?t<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function Xt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Tr(n))return et(n,s,t);if(n.includes("("))return Mr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let u=parseFloat(i[1]),m=parseFloat(l[1]);return `${u+(m-u)*t}${i[2]||l[2]}`}return t<1?n:s}function Ar(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Pr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Lr=0,Zt="--scroll-draw-progress";function $r(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,r){return typeof window>"u"?Jt:r.respectReducedMotion===false?Kt(e,r,false):Ve(r,(t,n)=>Kt(e,t,n))}function Kt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:E=false,triggerElement:y,onProgress:I,onComplete:se,onEnter:f,onLeave:w,onEnterBack:h,onLeaveBack:x}=r,b=typeof i=="function"?i:oe[i]??oe["ease-out"],L=Te(s.start||"top bottom"),U=Te(s.end||"bottom top"),z=y??e,N=typeof d=="string"?document.querySelector(d):d??null,J=Object.entries(n).map(([a,p])=>({prop:Ar(a),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ge(){let a=window.getComputedStyle(e);for(let p of J)p.from===""&&(p.from=a.getPropertyValue(p.prop).trim()||"0");}function le(){for(let a of J)e.style.setProperty(a.prop,String(a.to));}let de=new Map;for(let a of [...J.map(p=>p.prop),Zt])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,p]of de)p?e.style.setProperty(a,p):e.style.removeProperty(a);}if(t)return le(),se?.(),{...Jt,destroy:B,getProgress:()=>1};Ge();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Ae=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?tt(i):null;function H(){if(!v||!$r()||!P||m!=="y"||N||z!==e||u||l!==1||I||se||f||w||h||x||E!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let a of J)if(!Pr.has(a.prop))return false;return true}function Ce(){let a=`ssd-a-${++Lr}`,p=J.map(k=>`${k.prop}:${k.from}`).join(";"),_=J.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${p}}to{${_}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(a);let $=()=>{let k=e.getBoundingClientRect();return $e({top:k.top,height:k.height},ee(),Ae(),L,U)};Me(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:$});let O={refresh(){},destroy(){e.classList.remove(a),M.remove(),e.style.animationPlayState="",B(),pe(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Le=Math.min(1,Math.max(0,k));e.classList.remove(a);for(let V of J)e.style.setProperty(V.prop,Xt(V.from,V.to,Le));},getProgress(){let{tStart:k,tEnd:Le}=$();return b(R(ee(),k,Le,l))}};return O}if(H())return Ce();let X=0,te=0,ge=false,Re=-1,ye=0,me=0,Z=false,q=NaN,Ne=-1,We=0,F=z===e?J:[],he=false;function be(){let a=e.style,p=F.map(O=>a.getPropertyValue(O.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(O=>a.setProperty(O.prop,de.get(O.prop)??""));let M=Ke(z,N,m);F.forEach((O,k)=>a.setProperty(O.prop,p[k])),F.length&&(e.offsetWidth,a.transition=_);let $=$e(M,M.scroll,Ae(),L,U);he&&Math.abs($.tStart-X)<1&&Math.abs($.tEnd-te)<1||(he=true,X=$.tStart,te=$.tEnd);}function ce(a){e.style.setProperty(Zt,String(a));for(let p of J)e.style.setProperty(p.prop,Xt(p.from,p.to,a));I?.(a);}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&f?.(),q<1&&a>=1&&w?.(),q>=1&&a<1&&h?.(),q>0&&a<=0&&x?.(),q=a;}function we(){if(ge)return;let a=performance.now(),p=ee(),_=l;if(E!==false){let k=a-We,Le=k>0?Math.abs(p-(Ne<0?p:Ne))/k:0;_=l*Math.max(.2,1+Le*(typeof E=="number"?E:1)*.04);}Ne=p,We=a;let M=te===X?0:(p-X)/(te-X);Pe(M);let $=R(p,X,te,_),O=u?Math.max(Re,b(ye=Math.max(ye,$))):b($);me=O,ce(O),O>=1&&!Z?(Z=true,se?.()):O<1&&!u&&(Z=false);}let ue=ke(N??window,[z],()=>R(ee(),X,te,Math.min(l,1)),we,be);be(),te===X&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=R(ee(),X,te,l),me=b(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:X,tEnd:te})});function ve(){ge=true,ue.hold(true);}return {destroy(){ge=true,ue.off(),B(),pe(e);},replay(){Re=-1,ye=0,Z=false,me=0,ge=false,ce(0),ue.hold(false);},pause:ve,resume(){ge&&(ge=false,ue.hold(false));},seek(a){let p=Math.min(1,Math.max(0,a));me=p,Re=p,ye=0,ve(),ce(p);},getProgress(){return me},refresh:ue.remeasure}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;return t?gt(t,r):(W("scrollAnimate: element not found:",e),st)}function Cr(e,r={}){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return W("scrollParallax: element not found:",e),st;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:l,onProgress:u}=r,m=-n*100,d=t.style,v=!!t.ownerSVGElement,E=d.getPropertyValue("transform-box");v&&d.setProperty("transform-box","fill-box");let y=gt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:l??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:u});return v?{...y,destroy(){y.destroy(),d.setProperty("transform-box",E);}}:y}var yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Dr(e,r){if(typeof window>"u")return yt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ve(r,(n,s)=>Or(t,n,s)):(W("scrollCounter: element not found:",e),yt)}function Or(e,r,t){let{from:n=0,to:s,format:i,easing:l="ease-out",trigger:u={},once:m=true,decimals:d,onComplete:v}=r,E=d!==void 0?P=>P.toFixed(d):i??(P=>String(Math.round(P))),y=typeof l=="function"?l:oe[l]??oe["ease-out"],I=Te(u.start||"top 80%"),se=Te(u.end||"top 20%");if(t)return e.textContent=E(s),v?.(),{...yt,getProgress:()=>1};let f=0,w=0,h=false,x=-1,b=0,L=0,U=false,z=()=>window.scrollY,N=()=>window.innerHeight;function J(){let P=e.getBoundingClientRect(),H=$e({top:P.top,height:P.height},z(),N(),I,se);h&&Math.abs(H.tStart-f)<1&&Math.abs(H.tEnd-w)<1||(h=true,f=H.tStart,w=H.tEnd);}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function le(P){e.textContent=E(n+(s-n)*P),e.style.setProperty("--scroll-draw-progress",String(P));}let de=()=>R(z(),f,w,1);function B(){let P=de(),H=m?Math.max(x,y(b=Math.max(b,P))):y(P);L=H,le(H),H>=1&&!U?(U=true,v?.()):H<1&&!m&&(U=false);}J();{b=R(z(),f,w,1);let P=y(b);L=P,le(P);}let ee=ke(window,[e],de,B,J);Me(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:w})});let Ae=()=>ee.hold(false);return {destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ge),pe(e);},replay(){x=-1,b=0,U=false,L=0,le(0),Ae();},pause:()=>ee.hold(true),resume:Ae,seek(P){let H=Math.min(1,Math.max(0,P));L=H,x=H,b=0,ee.hold(true),le(H);},getProgress(){return L}}}var er="http://www.w3.org/2000/svg",Ir="cinematic-photo",nr=e=>e<0?0:e>1?1:e;function it(e){let r=parseFloat(e);return Number.isFinite(r)?nr(r/100):0}function tr(e){return oe[e]??oe.linear}var rr=e=>({destroy(){},getProgress:()=>e}),ht=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||W("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return rr(0);t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let f of r.scenes){if(f.background){let h=document.createElement("img");h.id=Ir,h.src=f.background,h.alt="",h.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(h);}let w=f.animations.filter(h=>h.type==="draw");if(w.length){let h=document.createElementNS(er,"svg");h.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),h.setAttribute("preserveAspectRatio","xMidYMid meet"),h.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(h);for(let x of w){let b=document.createElementNS(er,"path");b.id=x.target.replace(/^#/,""),b.setAttribute("d",x.d),b.setAttribute("fill","none"),b.setAttribute("stroke",x.stroke),b.setAttribute("stroke-width",String(x.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let L=x.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(L),b.style.strokeDashoffset=String(L),h.appendChild(b),s.push({kind:"draw",el:b,start:it(x.start),end:it(x.end),ease:tr(x.easing),length:L});}}for(let h of f.animations){if(h.type!=="fade")continue;let x=n.querySelector(h.target)??document.querySelector(h.target);x&&(x.style.opacity=String(h.from),s.push({kind:"fade",el:x,start:it(h.start),end:it(h.end),ease:tr("ease-in-out"),from:h.from,to:h.to}));}}let i=0,l=null;for(let f=t.parentElement;f?.parentElement;f=f.parentElement)if(/[ao]/.test(getComputedStyle(f).overflowY)&&f.scrollHeight>f.clientHeight&&(f!==document.body||/[aoh]/.test(getComputedStyle(f.parentElement).overflowY))){l=f;break}let u=0,m=0,d=()=>{let f=t.getBoundingClientRect().top;u=l?f-l.getBoundingClientRect().top-l.clientTop+l.scrollTop:f+window.scrollY,m=u+Math.max(0,t.offsetHeight-(l?l.clientHeight:window.innerHeight));},v=()=>{let f=l?l.scrollTop:window.scrollY;return m<=u?f>=u?1:0:R(f,u,m,1)},E=f=>{for(let w of s){let h=w.end-w.start,x=h<=0?f>=w.end?1:0:nr((f-w.start)/h),b=w.ease(x);w.kind==="draw"?w.el.style.strokeDashoffset=String(w.length*(1-b)):w.el.style.opacity=String(w.from+(w.to-w.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),rr(1);let y=()=>{i=v(),E(i);};d(),y();let I=ke(l||window,[t],v,y,d);Me(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let se=rt(f=>{f&&(se(),I.off(),pe(t),i=1,E(1));});return {destroy(){se(),I.off(),pe(t);},getProgress:()=>i}}};
4
+ exports.Cinematic=ht;exports.PRESETS=dt;exports.createBounce=Dt;exports.createElastic=Ot;exports.createSpring=Ct;exports.scrollAnimate=kr;exports.scrollCounter=Dr;exports.scrollDraw=xr;exports.scrollParallax=Cr;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{a as scrollAnimate,b as scrollParallax}from'./chunk-CZLUBJAI.mjs';export{a as Cinematic}from'./chunk-BSW7W2Y5.mjs';export{a as scrollDraw}from'./chunk-22B37AWY.mjs';export{a as scrollCounter}from'./chunk-PAGN26EH.mjs';import'./chunk-VJ5ZU55P.mjs';export{a as PRESETS}from'./chunk-K6VATIJH.mjs';import'./chunk-V3Z6G5JE.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-NV6YTPHI.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-THPTANES.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-BCV4RAIX.mjs';import'./chunk-LFSU6LR3.mjs';
1
+ export{a as scrollAnimate,b as scrollParallax}from'./chunk-CZLUBJAI.mjs';export{a as Cinematic}from'./chunk-G6K54ZFI.mjs';export{a as scrollDraw}from'./chunk-22B37AWY.mjs';export{a as scrollCounter}from'./chunk-PAGN26EH.mjs';import'./chunk-VJ5ZU55P.mjs';export{a as PRESETS}from'./chunk-K6VATIJH.mjs';import'./chunk-V3Z6G5JE.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-NV6YTPHI.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-THPTANES.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-BCV4RAIX.mjs';import'./chunk-LFSU6LR3.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svg-scroll-draw",
3
- "version": "2.23.6",
3
+ "version": "2.23.7",
4
4
  "description": "SVG line drawing on scroll, on the browser's own scroll timeline (CSS animation-timeline, JS fallback). Drop-in for AOS, ScrollReveal and vivus. Plus reveal, pin, snap, text, video. Zero dependencies. React, Vue, Svelte, Solid, Angular, Astro, vanilla JS",
5
5
  "keywords": [
6
6
  "svg",
@@ -1,2 +0,0 @@
1
- import {d}from'./chunk-THPTANES.mjs';import {a as a$1}from'./chunk-5PJEKEEP.mjs';import {a,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var M="http://www.w3.org/2000/svg",P="cinematic-photo",S=a=>a<0?0:a>1?1:a;function p(a){let s=parseFloat(a);return Number.isFinite(s)?S(s/100):0}function L(a){return d[a]??d.linear}var R={destroy:()=>{},getProgress:()=>0},T=class{constructor(s){if(typeof document>"u"){this.mount=null;return}this.mount=typeof s.wrapper=="string"?document.querySelector(s.wrapper):s.wrapper,this.mount||b("Cinematic: wrapper not found:",s.wrapper);}loadStory(s){let i=this.mount;if(typeof window>"u"||!i)return R;i.style.position="relative",i.style.height=s.totalHeight,i.style.display="block";let c=document.createElement("div");c.setAttribute("data-cinematic-stage",""),c.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",i.appendChild(c);let f=[];for(let e of s.scenes){if(e.background){let t=document.createElement("img");t.id=P,t.src=e.background,t.alt="",t.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",c.appendChild(t);}let n=e.animations.filter(t=>t.type==="draw");if(n.length){let t=document.createElementNS(M,"svg");t.setAttribute("viewBox",`0 0 ${s.canvas.width} ${s.canvas.height}`),t.setAttribute("preserveAspectRatio","xMidYMid meet"),t.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",c.appendChild(t);for(let o of n){let r=document.createElementNS(M,"path");r.id=o.target.replace(/^#/,""),r.setAttribute("d",o.d),r.setAttribute("fill","none"),r.setAttribute("stroke",o.stroke),r.setAttribute("stroke-width",String(o.strokeWidth)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round");let b=o.length||r.getTotalLength?.()||0;r.style.strokeDasharray=String(b),r.style.strokeDashoffset=String(b),t.appendChild(r),f.push({kind:"draw",el:r,start:p(o.start),end:p(o.end),ease:L(o.easing),length:b});}}for(let t of e.animations){if(t.type!=="fade")continue;let o=c.querySelector(t.target)??document.querySelector(t.target);o&&(o.style.opacity=String(t.from),f.push({kind:"fade",el:o,start:p(t.start),end:p(t.end),ease:d["ease-in-out"]??d.linear,from:t.from,to:t.to}));}}let d$1=0,v=()=>{let e=i.offsetHeight-window.innerHeight;return e<=0?i.getBoundingClientRect().top<=0?1:0:S(-i.getBoundingClientRect().top/e)},l=e=>{for(let n of f){let t=n.end-n.start,o=t<=0?e>=n.end?1:0:S((e-n.start)/t),r=n.ease(o);n.kind==="draw"?n.el.style.strokeDashoffset=String(n.length*(1-r)):n.el.style.opacity=String(n.from+(n.to-n.from)*r);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return l(1),{destroy:()=>{},getProgress:()=>1};let g=0,u=false,A=false,k=()=>{d$1=v(),l(d$1),u&&(g=requestAnimationFrame(k));},I=()=>{u||(u=true,g=requestAnimationFrame(k));},h=()=>{u=false,cancelAnimationFrame(g);},y=new IntersectionObserver(e=>{for(let n of e)A=n.isIntersecting,A?I():h();},{threshold:0});y.observe(c),d$1=v(),l(d$1),a(i,{type:"draw",getProgress:()=>d$1,getTrigger:()=>{let e=i.getBoundingClientRect().top+window.scrollY;return {tStart:e,tEnd:e+Math.max(0,i.offsetHeight-window.innerHeight)}}});let E=a$1(e=>{e&&(E(),h(),y.disconnect(),b$1(i),d$1=1,l(1));});return {destroy(){E(),h(),y.disconnect(),b$1(i);},getProgress:()=>d$1}}};
2
- export{T as a};