import{r as e,j as r}from"./router.chunk.YsRm4bSN.js";import{_ as __}from"./wordpress.chunk.BVds2GcU.js";const n=({rootRef:n=null,query:t,loadingText:o=__("Loading...","growfund"),noMoreText:s=__("No more records to load.","growfund"),showNoMore:u=!1})=>{const c=e.useRef(null),d=e.useRef(!1),{hasNextPage:f,isFetchingNextPage:a,fetchNextPage:g}=t,i=e.useCallback(()=>{!f||a||d.current||(d.current=!0,g().finally(()=>{d.current=!1}))},[g,f,a]);return e.useEffect(()=>{if(!f)return;const e=new IntersectionObserver(e=>{const[r]=e;r.isIntersecting&&i()},{root:n?.current??null,rootMargin:"0px",threshold:1}),r=c.current;return r&&e.observe(r),()=>{r&&e.unobserve(r),e.disconnect()}},[i,f,n]),r.jsxs(r.Fragment,{children:[r.jsx("div",{ref:c}),a&&r.jsx("p",{className:"growfund-text-center growfund-typo-tiny growfund-text-fg-secondary growfund-mt-4",children:o}),!f&&u&&r.jsx("p",{className:"growfund-type-tiny growfund-text-center growfund-text-fg-secondary growfund-mt-4",children:s})]})};export{n as I};
