{"version":3,"file":"Scrollnav.CWBj0gFT.mjs","names":["useState","useRef","useCallback","useMemo"],"sources":["https:/framerusercontent.com/modules/UQmwgVwA4CHPcDplbS8g/rEbq3NAgpWSNQLzJ8u9X/Scrollnav.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,startTransition,useCallback,useEffect,useMemo,useRef,useState}from\"react\";const SECTION_IDS=[\"overview\",\"problem\",\"research\",\"process\",\"solution\",\"reflection\",\"branding\",\"tryitout\"];const ACTIVE_COLOR=\"#000000\";const INACTIVE_COLOR=\"#979797\";const SOFT_TRANSITION=\"color 620ms cubic-bezier(0.22, 1, 0.36, 1), font-weight 620ms cubic-bezier(0.22, 1, 0.36, 1)\";let sharedActiveSection=null;let sharedInitialized=false;let rafId=null;const subscribers=new Set;function findSectionElementById(sectionId){if(typeof document===\"undefined\")return null;const byId=document.getElementById(sectionId);if(byId)return byId;const byHash=document.querySelector(`[id=\"${sectionId}\"]`);if(byHash)return byHash;const byFramerName=document.querySelector(`[data-framer-name*=\"${sectionId}\"]`);if(byFramerName)return byFramerName;const anchors=document.querySelectorAll(`a[href*=\"${sectionId}\"]`);for(const anchor of anchors){const linked=anchor.hash?.replace(\"#\",\"\");if(linked===sectionId){const next=anchor.nextElementSibling||anchor.parentElement;if(next)return next;}}return null;}function resolveActiveSection(){if(typeof window===\"undefined\"||typeof document===\"undefined\")return null;const anchorY=window.innerHeight*.25;let bestId=null;let bestScore=Number.POSITIVE_INFINITY;for(const sectionId of SECTION_IDS){const element=findSectionElementById(sectionId);if(!element)continue;const rect=element.getBoundingClientRect();if(rect.bottom<=0||rect.top>=window.innerHeight)continue;const containsAnchor=rect.top<=anchorY&&rect.bottom>=anchorY;const distance=containsAnchor?0:Math.min(Math.abs(rect.top-anchorY),Math.abs(rect.bottom-anchorY));if(distance<bestScore){bestScore=distance;bestId=sectionId;}}return bestId;}function notifySubscribers(){for(const subscriber of subscribers)subscriber(sharedActiveSection);}function updateSharedActiveSection(){const next=resolveActiveSection();if(next!==sharedActiveSection){sharedActiveSection=next;notifySubscribers();}}function scheduleSharedUpdate(){if(typeof window===\"undefined\")return;if(rafId!==null)return;rafId=window.requestAnimationFrame(()=>{rafId=null;updateSharedActiveSection();});}function ensureSharedResolver(){if(sharedInitialized||typeof window===\"undefined\"||typeof document===\"undefined\"){return;}sharedInitialized=true;scheduleSharedUpdate();window.addEventListener(\"scroll\",scheduleSharedUpdate,{passive:true});window.addEventListener(\"resize\",scheduleSharedUpdate);window.addEventListener(\"hashchange\",scheduleSharedUpdate);window.addEventListener(\"load\",scheduleSharedUpdate);}function NavItem(Component,sectionId){return /*#__PURE__*/forwardRef(function NavItemOverride({style,children,...props},ref){const typedSectionId=sectionId;const[active,setActive]=useState(sharedActiveSection===typedSectionId);const localRef=useRef(null);const setRefs=useCallback(node=>{localRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const resolvedStyle=useMemo(()=>({...style,color:active?ACTIVE_COLOR:INACTIVE_COLOR,fontWeight:active?600:400,transition:style?.transition?`${style.transition}, ${SOFT_TRANSITION}`:SOFT_TRANSITION}),[style,active]);useEffect(()=>{if(typeof document===\"undefined\")return;const root=localRef.current;if(!root)return;const targetColor=active?ACTIVE_COLOR:INACTIVE_COLOR;const elements=[root,...Array.from(root.querySelectorAll(\"span,a,p,div\"))];for(const el of elements){const currentTransition=el.style.transition;if(!currentTransition.includes(\"color\")){el.style.transition=currentTransition?`${currentTransition}, ${SOFT_TRANSITION}`:SOFT_TRANSITION;}el.style.setProperty(\"color\",targetColor,\"important\");}},[active]);useEffect(()=>{ensureSharedResolver();const subscriber=activeSection=>{const next=activeSection===typedSectionId;startTransition(()=>{setActive(next);});};subscribers.add(subscriber);subscriber(sharedActiveSection);scheduleSharedUpdate();return()=>{subscribers.delete(subscriber);};},[typedSectionId]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props,style:resolvedStyle,children:children});});}export function Overview(Component){return NavItem(Component,\"overview\");}export function FinalDesign(Component){return NavItem(Component,\"final-design\");}export function Problem(Component){return NavItem(Component,\"problem\");}export function Competition(Component){return NavItem(Component,\"competition\");}export function Research(Component){return NavItem(Component,\"research\");}export function Process(Component){return NavItem(Component,\"process\");}export function DesignSystem(Component){return NavItem(Component,\"designsystem\");}export function Outcome(Component){return NavItem(Component,\"outcome\");}export function Reflection(Component){return NavItem(Component,\"reflection\");}export function Solution(Component){return NavItem(Component,\"solution\");}export function Branding(Component){return NavItem(Component,\"branding\");}export function TryItOut(Component){return NavItem(Component,\"tryitout\");}\nexport const __FramerMetadata__ = {\"exports\":{\"Process\":{\"type\":\"reactHoc\",\"name\":\"Process\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Overview\":{\"type\":\"reactHoc\",\"name\":\"Overview\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Problem\":{\"type\":\"reactHoc\",\"name\":\"Problem\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Reflection\":{\"type\":\"reactHoc\",\"name\":\"Reflection\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Competition\":{\"type\":\"reactHoc\",\"name\":\"Competition\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Branding\":{\"type\":\"reactHoc\",\"name\":\"Branding\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"TryItOut\":{\"type\":\"reactHoc\",\"name\":\"TryItOut\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Outcome\":{\"type\":\"reactHoc\",\"name\":\"Outcome\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"FinalDesign\":{\"type\":\"reactHoc\",\"name\":\"FinalDesign\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Research\":{\"type\":\"reactHoc\",\"name\":\"Research\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Solution\":{\"type\":\"reactHoc\",\"name\":\"Solution\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"DesignSystem\":{\"type\":\"reactHoc\",\"name\":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