import{Dt as e,kt as t}from"./BA99CCI5.js";import"./D7pSEO6W.js";function n(n){let{pageSize:r,rootMargin:i=`200px`}=n,a=t(r),o=t(0),s=e([a,o],([e,t])=>e<t),c=null;function l(){let e=0,t=0;a.subscribe(t=>e=t)(),o.subscribe(e=>t=e)(),e<t&&a.set(Math.min(e+r,t))}function u(e){return c=new IntersectionObserver(e=>{e[0]?.isIntersecting&&l()},{rootMargin:i}),c.observe(e),{destroy(){c?.disconnect(),c=null}}}function d(){a.set(r)}function f(e){o.set(e)}return{visibleCount:a,sentinel:u,reset:d,hasMore:s,setTotalCount:f}}export{n as t};