import{useRef as u,useState as l,useEffect as p}from"react";function b(n={}){const{threshold:r=.15,rootMargin:e="0px 0px -60px 0px",once:t=!0}=n,s=u(null),[c,a]=l(!1);return p(()=>{const o=s.current;if(!o)return;const i=new IntersectionObserver(([f])=>{f.isIntersecting?(a(!0),t&&i.unobserve(o)):t||a(!1)},{threshold:r,rootMargin:e});return i.observe(o),()=>i.disconnect()},[r,e,t]),{ref:s,isVisible:c}}function x(n,r="fade-up",e=0){const t=`opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1) ${e}ms, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1) ${e}ms`;return{opacity:n?1:0,transform:n?"none":{"fade-up":"translateY(32px)","fade-left":"translateX(40px)","fade-right":"translateX(-40px)","fade-in":"none"}[r],transition:t,willChange:"opacity, transform"}}export{x as scrollAnimClass,b as useScrollAnimation};
