{"version":3,"file":"WithScrollDots.DRr93Jeq.mjs","names":["useRef","useCallback"],"sources":["https:/framerusercontent.com/modules/j9lPMPuW1J4D9KNo19UD/XodC1kxJZpNVzeA4SnwC/WithScrollDots.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";// Creates a reusable Framer code override named `withScrollDots` that tracks horizontal native scroll on a wrapped container and updates its next-sibling dot row styles based on the most visible slide.\nexport function withScrollDots(Component){return /*#__PURE__*/forwardRef(function WithScrollDots(props,forwardedRef){const containerRef=useRef(null);const rafIdRef=useRef(null);const scrollbarStyleRef=useRef(null);const scrollbarScopeValueRef=useRef(\"\");const previousScrollbarWidthRef=useRef(\"\");const previousMsOverflowStyleRef=useRef(\"\");const setCombinedRef=useCallback(node=>{containerRef.current=node;if(typeof forwardedRef===\"function\"){forwardedRef(node);}else if(forwardedRef&&\"current\"in forwardedRef){forwardedRef.current=node;}},[forwardedRef]);const updateDots=useCallback(()=>{const container=containerRef.current;if(!container)return;const slides=Array.from(container.children).filter(child=>child instanceof HTMLElement);if(slides.length===0)return;const viewportStart=container.scrollLeft;const viewportEnd=viewportStart+container.clientWidth;const viewportCenter=viewportStart+container.clientWidth/2;let activeIndex=0;let bestOverlap=-1;let bestCenterDistance=Number.POSITIVE_INFINITY;slides.forEach((slide,index)=>{const slideStart=slide.offsetLeft;const slideEnd=slideStart+slide.offsetWidth;const overlap=Math.max(0,Math.min(viewportEnd,slideEnd)-Math.max(viewportStart,slideStart));const slideCenter=slideStart+slide.offsetWidth/2;const centerDistance=Math.abs(slideCenter-viewportCenter);if(overlap>bestOverlap||overlap===bestOverlap&&centerDistance<bestCenterDistance){bestOverlap=overlap;bestCenterDistance=centerDistance;activeIndex=index;}});const dotsRow=container.nextElementSibling;if(!(dotsRow instanceof HTMLElement))return;const dots=Array.from(dotsRow.children).filter(child=>child instanceof HTMLElement);if(dots.length===0)return;dots.forEach((dot,index)=>{if(dot.dataset.scrollDotsInitialized!==\"1\"){dot.style.height=\"4px\";dot.style.borderRadius=\"4px\";dot.style.transition=\"width 0.25s ease, background-color 0.25s ease\";dot.dataset.scrollDotsInitialized=\"1\";}if(index===activeIndex){dot.style.width=\"22px\";dot.style.backgroundColor=\"#002C68\";}else{dot.style.width=\"8px\";dot.style.backgroundColor=\"rgba(0,0,0,0.15)\";}});},[]);const scheduleUpdate=useCallback(()=>{if(typeof window===\"undefined\")return;if(rafIdRef.current!==null)return;rafIdRef.current=window.requestAnimationFrame(()=>{rafIdRef.current=null;updateDots();});},[updateDots]);useEffect(()=>{const container=containerRef.current;if(!container)return;const containerStyle=container.style;previousScrollbarWidthRef.current=container.style.scrollbarWidth;previousMsOverflowStyleRef.current=containerStyle.msOverflowStyle??\"\";container.style.scrollbarWidth=\"none\";containerStyle.msOverflowStyle=\"none\";if(typeof document!==\"undefined\"){if(!scrollbarScopeValueRef.current){scrollbarScopeValueRef.current=`scroll-dots-${Math.random().toString(36).slice(2,10)}`;}const scopeValue=scrollbarScopeValueRef.current;container.setAttribute(\"data-scroll-dots-scope\",scopeValue);const styleEl=document.createElement(\"style\");styleEl.setAttribute(\"data-scroll-dots-style\",scopeValue);styleEl.textContent=`[data-scroll-dots-scope=\"${scopeValue}\"]::-webkit-scrollbar{display:none;width:0;height:0;}`;document.head.appendChild(styleEl);scrollbarStyleRef.current=styleEl;}scheduleUpdate();const handleScroll=()=>{scheduleUpdate();};const handleResize=()=>{scheduleUpdate();};container.addEventListener(\"scroll\",handleScroll,{passive:true});if(typeof window!==\"undefined\"){window.addEventListener(\"resize\",handleResize);}return()=>{container.removeEventListener(\"scroll\",handleScroll);if(typeof window!==\"undefined\"){window.removeEventListener(\"resize\",handleResize);}if(typeof window!==\"undefined\"&&rafIdRef.current!==null){window.cancelAnimationFrame(rafIdRef.current);rafIdRef.current=null;}container.style.scrollbarWidth=previousScrollbarWidthRef.current;containerStyle.msOverflowStyle=previousMsOverflowStyleRef.current;const scopeValue=scrollbarScopeValueRef.current;if(scopeValue){container.removeAttribute(\"data-scroll-dots-scope\");}const styleEl=scrollbarStyleRef.current;if(styleEl&&styleEl.parentNode){styleEl.parentNode.removeChild(styleEl);}scrollbarStyleRef.current=null;};},[scheduleUpdate]);return /*#__PURE__*/_jsx(Component,{ref:setCombinedRef,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollDots\":{\"type\":\"reactHoc\",\"name\":\"withScrollDots\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WithScrollDots.map"],"mappings":"gJACA,SAAgB,EAAe,EAAU,CAAC,OAAoB,EAAW,SAAwB,EAAM,EAAa,CAAC,IAAM,EAAaA,EAAO,IAAI,EAAQ,EAASA,EAAO,IAAI,EAAQ,EAAkBA,EAAO,IAAI,EAAQ,EAAuBA,EAAO,EAAE,EAAQ,EAA0BA,EAAO,EAAE,EAAQ,EAA2BA,EAAO,EAAE,EAAQ,EAAeC,EAAY,GAAM,CAAC,EAAa,QAAQ,EAAQ,OAAO,GAAe,WAAY,EAAa,CAAI,EAAW,GAAc,YAAY,IAAc,EAAa,QAAQ,EAAM,EAAE,CAAC,CAAY,CAAC,EAAQ,EAAWA,MAAgB,CAAC,IAAM,EAAU,EAAa,QAAQ,GAAG,CAAC,EAAU,OAAO,IAAM,EAAO,MAAM,KAAK,EAAU,QAAQ,CAAC,CAAC,OAAO,GAAO,aAAiB,WAAW,EAAE,GAAG,EAAO,SAAS,EAAE,OAAO,IAAM,EAAc,EAAU,WAAiB,EAAY,EAAc,EAAU,YAAkB,EAAe,EAAc,EAAU,YAAY,EAAM,EAAY,EAAM,EAAY,GAAO,EAAmB,IAAyB,EAAO,SAAS,EAAM,IAAQ,CAAC,IAAM,EAAW,EAAM,WAAiB,EAAS,EAAW,EAAM,YAAkB,EAAQ,KAAK,IAAI,EAAE,KAAK,IAAI,EAAY,CAAQ,EAAE,KAAK,IAAI,EAAc,CAAU,CAAC,EAAQ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