// Metro module 5980 (f5981). import { useRef, useLayoutEffect, useEffect, useMemo } from "react"; import useConstRef from "./useConstRef"; function $mk77553($env) { return () => { const r2 = $env; if (r2[1]) { const r7 = r2[4]; if (r7.current == null) { const r8 = $env.$parent; r7.current = (0, r8[0])(r8[2][2]).getIntersectionObserver(r2[3].current); } const current = r2[2].current; const current2 = r7.current; if (current != null && current2 != null) { const r19 = $env.$parent; (0, r19[0])(r19[2][2]).watch(current2, current, r2[0]); } } }; } function $mk77554($env) { return () => { const r2 = $env; if (r2[1]) { let env25662 = { $parent: $env.$parent }; const current = r2[2].current; env25662[0] = current; const current2 = r2[4].current; env25662[1] = current2; if (current != null && current2 != null) { return () => { const r2 = env25662.$parent; (0, r2[0])(r2[2][2]).unwatch(env25662[1], env25662[0]); }; } } }; } let env3775 = {}; const c3775_7 = {}; const c3775_8 = new Map([[1, { threshold: 1 }]]); export function useIntersectionObserver(a0, a1) { let env15340; const r3 = env15340 = { $parent: env3775 }; env15340[0] = a0; let r7 = arguments[2]; if (r7 === void 0) { r7 = true; } env15340[1] = r7; env15340[2] = void 0; env15340[3] = void 0; env15340[4] = void 0; const ref = useRef(null); env15340[2] = ref; const constRef = useConstRef(a1 == null ? c3775_7 : a1); env15340[3] = constRef; env15340[4] = useRef(null); (0, useLayoutEffect)($mk77553(r3), [r7, a0, constRef]); (0, useEffect)($mk77554(r3), [r7, a1]); return ref; } export function useIsVisible(c15341_0, r11 = 1) { const threshold = r11; let r8 = arguments[2]; if (r8 === void 0) { r8 = true; } let env15342; const constRef = useConstRef((a0) => { c15341_0(a0.isIntersecting); }); const r17 = (0, useMemo)(() => { let r8 = c3775_8.get(threshold); if (r8 == null) { const r2 = { threshold }; c3775_8.set(threshold, r2); r8 = r2; } return r8; }, [threshold]); const current = constRef.current; const r19 = env15342 = { $parent: env3775 }; env15342[1] = void 0; env15342[0] = current; if (r8 === void 0) { r8 = true; } env15342[1] = r8; env15342[2] = void 0; env15342[3] = void 0; env15342[4] = void 0; const ref = useRef(null); env15342[2] = ref; let r24 = r17; if (r24 == null) { r24 = c3775_7; } const constRef2 = useConstRef(r24); env15342[3] = constRef2; env15342[4] = useRef(null); (0, useLayoutEffect)($mk77553(r19), [r8, current, constRef2]); (0, useEffect)($mk77554(r19), [r8, r17]); return ref; }