import{r as o}from"./index-L_RBs0c_.js";function d(...e){const[i,r]=o.useState(new Array(e.length).fill({width:0,height:0,x:-1/0,y:-1/0})),c=o.useMemo(()=>new ResizeObserver(n=>{window.requestAnimationFrame(()=>{r(n.map(l=>l.contentRect))})}),[]);if(o.useEffect(()=>(e.forEach(n=>{n instanceof Window?c.observe(document.body):n.current&&c.observe(n.current)}),()=>{e.forEach(n=>{n instanceof Window?c.unobserve(document.body):n.current&&c.unobserve(n.current)})}),[e,c]),i.length==e.length)return i;{const n=[...i];for(let l=i.length;l<e.length;l++)n.push({width:0,height:0,x:-1/0,y:-1/0});return n}}function g({segmentDuration:e,timelineDuration:i,timelineRef:r}){const n=o.useCallback(t=>{const s=t%e,u=s!==0?e-s:0;return t+u},[e]),l=o.useCallback(t=>{const s=t%e,u=s===0?0:-s;return t+u},[e]),a=o.useCallback(t=>{let s=0;for(;t;)s+=t.scrollTop,t=t.parentElement;return s},[]),h=o.useCallback(()=>{if(r!=null&&r.current&&i){const{clientHeight:t}=r.current;return t/8*e}},[e,i,r]);return{alignEndDateToTimeline:n,alignStartDateToTimeline:l,getCumulativeScrollTop:a,getVisibleTimelineDuration:h,segmentHeight:8}}export{g as a,d as u};
