{"version":3,"file":"ActiveSidebarNav.-epzoT0F.mjs","names":["React.useState","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/Fh9rSIb9bwvcRTW51j0P/VJ1J6rc5onyWMsJrKhJ9/ActiveSidebarNav.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{startTransition}from\"react\";// User request: Create a named Framer override `ActiveSidebarNav` that tracks section visibility on scroll and updates sidebar link active/inactive styles via a single injected style tag.\nconst SECTION_IDS=[\"overview\",\"problem\",\"research\",\"solution\",\"decisions\",\"learned\"];const STYLE_TAG_ID=\"sidebar-active-styles\";export function ActiveSidebarNav(props){const[activeId,setActiveId]=React.useState(SECTION_IDS[0]);React.useEffect(()=>{if(typeof window===\"undefined\"||typeof document===\"undefined\")return;let styleEl=document.getElementById(STYLE_TAG_ID);if(!styleEl){styleEl=document.createElement(\"style\");styleEl.id=STYLE_TAG_ID;document.head.appendChild(styleEl);}const updateActiveSection=()=>{const offset=window.scrollY+window.innerHeight*.35;let nextActive=SECTION_IDS[0];for(const id of SECTION_IDS){const el=document.getElementById(id);if(!el)continue;const sectionTop=el.getBoundingClientRect().top+window.scrollY;if(sectionTop<=offset){nextActive=id;}}startTransition(()=>{setActiveId(nextActive);});};updateActiveSection();window.addEventListener(\"scroll\",updateActiveSection,{passive:true});return()=>{window.removeEventListener(\"scroll\",updateActiveSection);const existing=document.getElementById(STYLE_TAG_ID);if(existing?.parentNode){existing.parentNode.removeChild(existing);}};},[]);React.useEffect(()=>{if(typeof document===\"undefined\")return;let styleEl=document.getElementById(STYLE_TAG_ID);if(!styleEl){styleEl=document.createElement(\"style\");styleEl.id=STYLE_TAG_ID;document.head.appendChild(styleEl);}const css=SECTION_IDS.map(id=>{const isActive=id===activeId;const color=isActive?\"#1a2433\":\"#9ba3ae\";const weight=isActive?500:400;return`a[href$=\"#${id}\"], a[href$=\"#${id}\"] * {\n  color: ${color} !important;\n  font-weight: ${weight} !important;\n  transition: color 0.25s ease, font-weight 0.1s ease;\n}`;}).join(\"\\n\");styleEl.textContent=css;},[activeId]);return props;}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withActiveSidebarNav(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ActiveSidebarNav(props)});};}withActiveSidebarNav.displayName=\"ActiveSidebarNav\";\nexport const __FramerMetadata__ = {\"exports\":{\"ActiveSidebarNav\":{\"type\":\"override\",\"name\":\"ActiveSidebarNav\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withActiveSidebarNav\":{\"type\":\"reactHoc\",\"name\":\"withActiveSidebarNav\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ActiveSidebarNav.map"],"mappings":"sMACgI,SAAgB,EAAiB,EAAM,CAAC,GAAK,CAAC,EAAS,GAAaA,EAAe,EAAY,EAAE,EAI1K,OAJ4K,MAAoB,CAAC,GAAU,IAAS,QAAa,OAAO,SAAW,IAAY,OAAO,IAAI,EAAQ,SAAS,eAAe,CAAY,EAAM,IAAS,EAAQ,SAAS,cAAc,OAAO,EAAE,EAAQ,GAAG,EAAa,SAAS,KAAK,YAAY,CAAO,GAAG,IAAM,MAAwB,CAAC,IAAM,EAAO,EAAO,QAAQ,EAAO,YAAY,IAAQ,EAAW,EAAY,GAAG,IAAI,IAAM,KAAM,EAAY,CAAC,IAAM,EAAG,SAAS,eAAe,CAAE,EAAM,GAA6B,EAAG,sBAAsB,CAAC,CAAC,IAAI,EAAO,SAAuB,IAAQ,EAAW,EAAI,CAAC,MAAoB,CAAC,EAAY,CAAU,CAAE,CAAC,CAAE,EAA6F,OAA3F,EAAoB,EAAE,EAAO,iBAAiB,SAAS,EAAoB,CAAC,QAAQ,EAAI,CAAC,MAAY,CAAC,EAAO,oBAAoB,SAAS,CAAmB,E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