import{u as E}from"./useWindowSize.BF2jp5cp.js";import{f as b,r as i,E as x,s as D,B as z,G as B,o as v,c as d,a as h,l as C,j as s,n as L,H}from"./entry.DV6a5_Hb.js";const M={key:0,class:"pt-10 svgImage"},R={key:1,class:"pt-10 noStickySvgImage"},I=b({__name:"ScrollParallax",setup(W){E();let l=i(),a=x({isSticky:!1,bottom:0}),n=i(!1),o=i(!1);const r=i(0),g=i(0);let c=i(),p=i(0);D(()=>{window.addEventListener("scroll",m),window.addEventListener("resize",S),w(),S()}),z(()=>{window.removeEventListener("scroll",m)});const S=()=>{if(!l.value)return;const t=l.value.querySelector(".right");t&&(g.value=t.clientWidth)};function w(){const t=c.value;p.value=t.clientHeight}function m(){var y;const t=c.value,f=l.value.querySelector(".left");if(l.value&&t&&f){const k=f.clientHeight,_=t.clientHeight,e=(y=l.value)==null?void 0:y.getBoundingClientRect();r.value=e==null?void 0:e.bottom,a.bottom=r==null?void 0:r.value,p.value=t.clientHeight,f&&((e==null?void 0:e.top)>0?(a.isSticky=!1,n.value=!0,o.value=!1):(e==null?void 0:e.top)<=0&&(e==null?void 0:e.bottom)>=0?(e==null?void 0:e.top)<-Math.abs(k-_)?(a.isSticky=!1,n.value=!1,o.value=!0):a.isSticky=!0:(e==null?void 0:e.top)<=-Math.abs(k-_)?(a.isSticky=!1,n.value=!1,o.value=!0):(a.isSticky=!1,n.value=!1,o.value=!1))}}const{isSticky:u}=B(a);return(t,f)=>(v(),d("div",{id:"parallax",ref_key:"parallaxContainer",ref:l,class:"parallaxContainer"},[h("div",{class:C(["leftContainer",{leftStart:s(n),leftEnd:s(o)}])},[h("div",{class:C(["left",{sticky:s(u)}]),style:L({width:s(u)?`${s(g)}px`:"auto"})},[H(t.$slots,"leftSide"),s(u)?(v(),d("div",M)):(v(),d("div",R))],6)],2),h("div",{class:"right rightPosition",ref_key:"rightContainer",ref:c},[H(t.$slots,"rightSide")],512)],512))}});export{I as _};