import{a as e,n as t}from"./chunk-BneVvdWh.js";import{t as n}from"./react-C7IZe2D1.js";import{t as r}from"./jsx-runtime-C2wGStra.js";import{n as i,t as a}from"./ObserveIntersection-zL3YLMv6.js";var o,s,c,l=t((()=>{o=e(n(),1),i(),s=r(),c=({onIntersect:e,once:t,threshold:n,tag:r,dataset:i,children:c})=>{let[l,u]=(0,o.useState)(!1);return(0,s.jsx)(a,{onIntersect:(0,o.useCallback)(()=>{l||u(!0),e?.()},[l,e]),once:e?t:!0,threshold:n,tag:r,dataset:i,children:l&&c})};try{c.displayName=`ShowOnIntersection`,c.__docgenInfo={description:`Only renders the wrapped components once it intersects with the viewport.

Note that elements will not be detached from the DOM if the component is
scrolled out of view again.

You can use \`React.lazy\` to lazy-load the wrapped components.

Additionally, an \`onIntersect\` callback can be provided. As with
\`ObserveIntersection\`, this callback will be called every time the component
intersects with the viewport, or only the first time if \`once\` is set to
\`true\`.`,displayName:`ShowOnIntersection`,props:{onIntersect:{defaultValue:null,description:``,name:`onIntersect`,required:!1,type:{name:`enum`,value:[{value:`() => void`}]}},once:{defaultValue:null,description:``,name:`once`,required:!1,type:{name:`enum`,value:[{value:`false`},{value:`true`}]}},threshold:{defaultValue:null,description:``,name:`threshold`,required:!1,type:{name:`enum`,value:[{value:`number`}]}},tag:{defaultValue:null,description:``,name:`tag`,required:!1,type:{name:`enum`,value:[{value:`"article"`},{value:`"caption"`},{value:`"div"`},{value:`"fieldset"`},{value:`"figcaption"`},{value:`"figure"`},{value:`"footer"`},{value:`"header"`},{value:`"li"`},{value:`"main"`},{value:`"ol"`},{value:`"p"`},{value:`"section"`},{value:`"span"`},{value:`"table"`},{value:`"tbody"`},{value:`"td"`},{value:`"tfoot"`},{value:`"th"`},{value:`"thead"`},{value:`"tr"`},{value:`"ul"`}]}},dataset:{defaultValue:null,description:``,name:`dataset`,required:!1,type:{name:`enum`,value:[{value:`Dataset`}]}}}}}catch{}}));export{l as n,c as t};