import{useRef as e,useState as t,useEffect as r}from"react";let u=null,n=n=>{let{index:o,activeItem:i,hoverItem:c,timeToScroll:m=0,setHoverItem:l,setActiveItem:T}=n??{},a=e(!0),[s,f]=t(!1),g=e(!1);return r(()=>{c===o?.toString()?(f(!0),u&&clearTimeout(u),u=setTimeout(()=>{g.current||(f(!1),l?.())},1e3)):f(!1)},[c,o,l]),r(()=>{if(a.current){u=setTimeout(()=>{a.current=!1},500);return}return i===o?.toString()?(f(!0),g.current=!0,u&&clearTimeout(u),u=setTimeout(()=>{f(!1),g.current=!1,T?.()},m+1e3)):f(!1),()=>{u&&clearTimeout(u)}},[i,o,T,m]),{isActive:s}};export{n as useMarqueeItem};
