{"version":3,"file":"npm_react-intersection-observer@9.5.BBvyvKDh.mjs","names":["r","n","o","i","t","e","e.useState","e.useRef"],"sources":["https:/ga.jspm.io/npm:react-intersection-observer@9.5.2/index.mjs"],"sourcesContent":["import*as e from\"react\";\"use client\";var t=Object.defineProperty;var __defNormalProp=(e,i,r)=>i in e?t(e,i,{enumerable:true,configurable:true,writable:true,value:r}):e[i]=r;var __publicField=(e,t,i)=>{__defNormalProp(e,\"symbol\"!==typeof t?t+\"\":t,i);return i};var i=new Map;var r=new WeakMap;var n=0;var o=void 0;function defaultFallbackInView(e){o=e}function getRootId(e){if(!e)return\"0\";if(r.has(e))return r.get(e);n+=1;r.set(e,n.toString());return r.get(e)}function optionsToId(e){return Object.keys(e).sort().filter((t=>void 0!==e[t])).map((t=>`${t}_${\"root\"===t?getRootId(e.root):e[t]}`)).toString()}function createObserver(e){let t=optionsToId(e);let r=i.get(t);if(!r){const n=new Map;let o;const s=new IntersectionObserver((t=>{t.forEach((t=>{var i;const r=t.isIntersecting&&o.some((e=>t.intersectionRatio>=e));e.trackVisibility&&\"undefined\"===typeof t.isVisible&&(t.isVisible=r);null==(i=n.get(t.target))?void 0:i.forEach((e=>{e(r,t)}))}))}),e);o=s.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]);r={id:t,observer:s,elements:n};i.set(t,r)}return r}function observe(e,t,r={},n=o){if(\"undefined\"===typeof window.IntersectionObserver&&void 0!==n){const i=e.getBoundingClientRect();t(n,{isIntersecting:n,target:e,intersectionRatio:\"number\"===typeof r.threshold?r.threshold:0,time:0,boundingClientRect:i,intersectionRect:i,rootBounds:i});return()=>{}}const{id:s,observer:a,elements:l}=createObserver(r);let h=l.get(e)||[];l.has(e)||l.set(e,h);h.push(t);a.observe(e);return function unobserve(){h.splice(h.indexOf(t),1);if(0===h.length){l.delete(e);a.unobserve(e)}if(0===l.size){a.disconnect();i.delete(s)}}}function isPlainChildren(e){return\"function\"!==typeof e.children}var s=class extends e.Component{constructor(e){super(e);__publicField(this,\"node\",null);__publicField(this,\"_unobserveCb\",null);__publicField(this,\"handleNode\",(e=>{if(this.node){this.unobserve();e||this.props.triggerOnce||this.props.skip||this.setState({inView:!!this.props.initialInView,entry:void 0})}this.node=e||null;this.observeNode()}));__publicField(this,\"handleChange\",((e,t)=>{e&&this.props.triggerOnce&&this.unobserve();isPlainChildren(this.props)||this.setState({inView:e,entry:t});this.props.onChange&&this.props.onChange(e,t)}));this.state={inView:!!e.initialInView,entry:void 0}}componentDidUpdate(e){if(e.rootMargin!==this.props.rootMargin||e.root!==this.props.root||e.threshold!==this.props.threshold||e.skip!==this.props.skip||e.trackVisibility!==this.props.trackVisibility||e.delay!==this.props.delay){this.unobserve();this.observeNode()}}componentWillUnmount(){this.unobserve();this.node=null}observeNode(){if(!this.node||this.props.skip)return;const{threshold:e,root:t,rootMargin:i,trackVisibility:r,delay:n,fallbackInView:o}=this.props;this._unobserveCb=observe(this.node,this.handleChange,{threshold:e,root:t,rootMargin:i,trackVisibility:r,delay:n},o)}unobserve(){if(this._unobserveCb){this._unobserveCb();this._unobserveCb=null}}render(){const{children:t}=this.props;if(\"function\"===typeof t){const{inView:e,entry:i}=this.state;return t({inView:e,entry:i,ref:this.handleNode})}const{as:i,triggerOnce:r,threshold:n,root:o,rootMargin:s,onChange:a,skip:l,trackVisibility:h,delay:c,initialInView:d,fallbackInView:u,...p}=this.props;return e.createElement(i||\"div\",{ref:this.handleNode,...p},t)}};function useInView({threshold:t,delay:i,trackVisibility:r,rootMargin:n,root:o,triggerOnce:s,skip:a,initialInView:l,fallbackInView:h,onChange:c}={}){var d;const[u,p]=e.useState(null);const b=e.useRef();const[f,v]=e.useState({inView:!!l,entry:void 0});b.current=c;e.useEffect((()=>{if(a||!u)return;let e;e=observe(u,((t,i)=>{v({inView:t,entry:i});b.current&&b.current(t,i);if(i.isIntersecting&&s&&e){e();e=void 0}}),{root:o,rootMargin:n,threshold:t,trackVisibility:r,delay:i},h);return()=>{e&&e()}}),[Array.isArray(t)?t.toString():t,u,o,n,s,a,r,h,i]);const g=null==(d=f.entry)?void 0:d.target;const y=e.useRef();if(!u&&g&&!s&&!a&&y.current!==g){y.current=g;v({inView:!!l,entry:void 0})}const V=[p,f.inView,f.entry];V.ref=V[0];V.inView=V[1];V.entry=V[2];return V}export{s as InView,defaultFallbackInView,observe,useInView};\n\n//# sourceMappingURL=index.mjs.map"],"mappings":"gIAA8V,SAAS,EAAU,EAAE,CAAwE,OAAnE,EAAe,EAAE,IAAI,EAAE,CAAQ,EAAE,IAAI,EAAE,EAAC,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,UAAU,CAAC,CAAQ,EAAE,IAAI,EAAE,EAA1E,IAA2E,SAAS,EAAY,EAAE,CAAC,OAAO,OAAO,KAAK,EAAE,CAAC,MAAM,CAAC,QAAQ,GAAY,EAAE,KAAX,IAAK,IAAU,CAAC,KAAK,GAAG,GAAG,EAAE,GAAY,IAAT,OAAW,EAAU,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,SAAS,EAAe,EAAE,CAAC,IAAI,EAAE,EAAY,EAAE,CAAKA,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,CAACA,EAAE,CAAC,IAAMC,EAAE,IAAI,IAAQC,EAAQ,EAAE,IAAI,sBAAsB,GAAG,CAAC,EAAE,SAAS,GAAG,CAAC,IAAIC,EAAE,IAAMH,EAAEI,EAAE,gBAAgBF,EAAE,MAAM,GAAGE,EAAE,mBAAmBC,GAAG,CAAC,EAAE,iBAAsCD,EAAE,YAAvB,SAAmC,EAAE,UAAUJ,IAAU,EAAEC,EAAE,IAAIG,EAAE,OAAO,GAAxB,MAAiCD,EAAE,SAAS,GAAG,CAAC,EAAEH,EAAEI,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,aAAa,MAAM,QAAQ,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,SAAS,E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