{"version":3,"file":"CaseStudySectionSpy.cdSLFiuZ.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/LBFLZOU0H9pEiy4JAxcD/rnw2SIgCVpCWe8ImYql0/CaseStudySectionSpy.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";function prefersReducedMotion(){if(typeof window===\"undefined\"||typeof window.matchMedia!==\"function\"){return false;}return window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;}function headerOffset(){const named=document.querySelectorAll('[data-framer-name=\"New-Nav-bar\"]');for(const el of named){const style=window.getComputedStyle(el);if(style.display===\"none\"||style.visibility===\"hidden\")continue;if(style.position===\"fixed\"||style.position===\"sticky\"){const rect=el.getBoundingClientRect();if(rect.height>0)return Math.round(rect.bottom);}}const all=document.body.querySelectorAll(\"*\");let bottom=0;for(const el of all){const style=window.getComputedStyle(el);if(style.position!==\"fixed\"||style.display===\"none\")continue;const rect=el.getBoundingClientRect();if(rect.top>12||rect.height<24||rect.height>180)continue;if(rect.bottom>bottom)bottom=rect.bottom;}return Math.round(bottom)||88;}function sectionIdFromHref(href){if(!href)return\"\";const hashIndex=href.indexOf(\"#\");if(hashIndex===-1)return\"\";try{return decodeURIComponent(href.slice(hashIndex+1).split(\"?\")[0]);}catch(error){return href.slice(hashIndex+1).split(\"?\")[0];}}export function withCaseStudySectionSpy(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const localRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const root=localRef.current;if(!root)return;root.setAttribute(\"data-case-study-nav\",\"true\");const style=document.createElement(\"style\");style.setAttribute(\"data-case-study-nav-style\",\"true\");style.textContent=[\"[data-case-study-nav] a { transition: color 0.2s ease; }\",'[data-case-study-nav] [data-framer-name=\"ActiveDot\"] { transition: opacity 0.2s ease; }',\"[data-case-study-nav] a:focus-visible { outline: 2px solid rgb(40, 40, 40); outline-offset: 2px; }\",'[data-case-study-nav] a[aria-current=\"location\"] [data-framer-name=\"ActiveDot\"] { opacity: 1 !important; }','[data-case-study-nav] a[aria-current=\"location\"], [data-case-study-nav] a[aria-current=\"location\"] * { color: rgb(40, 40, 40) !important; }','@media (prefers-reduced-motion: reduce) { [data-case-study-nav] a, [data-case-study-nav] [data-framer-name=\"ActiveDot\"] { transition: none; } }'].join(\"\\n\");document.head.appendChild(style);const links=()=>Array.from(root.querySelectorAll(\"a[href*='#']\"));const setActive=id=>{for(const anchor of links()){const sid=sectionIdFromHref(anchor.getAttribute(\"href\"));if(sid&&sid===id)anchor.setAttribute(\"aria-current\",\"location\");else anchor.removeAttribute(\"aria-current\");}};const pickActive=()=>{const items=links().map(anchor=>{const id=sectionIdFromHref(anchor.getAttribute(\"href\"));const el=id?document.getElementById(id):null;return{id,el};}).filter(item=>Boolean(item.id&&item.el));if(!items.length)return;const unique=[];const seen=new Set;for(const item of items){if(seen.has(item.id))continue;seen.add(item.id);unique.push(item);}const offset=headerOffset();const line=offset+12;const doc=document.documentElement;const atBottom=window.innerHeight+window.scrollY>=doc.scrollHeight-32;if(atBottom){setActive(unique[unique.length-1].id);return;}let current=unique[0].id;for(const item of unique){if(item.el.getBoundingClientRect().top<=line)current=item.id;}setActive(current);};let frame=0;const onScroll=()=>{if(frame)return;frame=window.requestAnimationFrame(()=>{frame=0;pickActive();});};const scrollToId=(id,smooth)=>{const el=document.getElementById(id);if(!el)return false;const top=el.getBoundingClientRect().top+window.scrollY-headerOffset();window.scrollTo({top:Math.max(0,top),behavior:smooth&&!prefersReducedMotion()?\"smooth\":\"auto\"});setActive(id);return true;};const onClick=event=>{const target=event.target;if(!(target instanceof Element))return;const anchor=target.closest(\"a\");if(!anchor||!root.contains(anchor))return;const id=sectionIdFromHref(anchor.getAttribute(\"href\"));if(!id||!document.getElementById(id))return;event.preventDefault();if(history.replaceState)history.replaceState(null,\"\",\"#\"+id);scrollToId(id,true);};const onHashChange=()=>{const id=sectionIdFromHref(window.location.hash);if(id)scrollToId(id,false);else pickActive();};const initial=sectionIdFromHref(window.location.hash);if(initial&&document.getElementById(initial)){scrollToId(initial,false);}else{pickActive();}window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);window.addEventListener(\"hashchange\",onHashChange);root.addEventListener(\"click\",onClick);return()=>{if(frame)window.cancelAnimationFrame(frame);window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);window.removeEventListener(\"hashchange\",onHashChange);root.removeEventListener(\"click\",onClick);style.remove();};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:node=>{localRef.current=node;if(typeof ref===\"function\")ref(node);else if(ref)ref.current=node;}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCaseStudySectionSpy\":{\"type\":\"reactHoc\",\"name\":\"withCaseStudySectionSpy\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CaseStudySectionSpy.map"],"mappings":"8IAA0F,SAAS,GAAsB,CAAsF,OAA3E,IAAS,QAAa,OAAO,EAAO,YAAa,WAAmB,GAAc,EAAO,WAAW,kCAAkC,CAAC,CAAC,OAAQ,CAAC,SAAS,GAAc,CAAC,IAAM,EAAM,SAAS,iBAAiB,kCAAkC,EAAE,IAAI,IAAM,KAAM,EAAM,CAAC,IAAM,EAAM,EAAO,iBAAiB,CAAE,EAAK,OAAM,UAAU,QAAQ,EAAM,aAAa,YAAqB,EAAM,WAAW,SAAS,EAAM,WAAW,UAAS,CAAC,IAAM,EAAK,EAAG,sBAAsB,EAAE,GAAG,EAAK,OAAO,EAAE,OAAO,KAAK,MAAM,EAAK,MAAM,CAAE,CAAC,CAAC,IAAM,EAAI,SAAS,KAAK,iBAAiB,GAAG,EAAM,EAAO,EAAE,IAAI,IAAM,KAAM,EAAI,CAAC,IAAM,EAAM,EAAO,iBAAiB,CAAE,EAAE,GAAG,EAAM,WAAW,SAAS,EAAM,UAAU,OAAO,SAAS,IAAM,EAAK,EAAG,sBAAsB,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