{"version":3,"file":"SolarisHeaderActiveNav.Bm-bgPYO.mjs","names":["useRef","useMemo","useCallback","__esmMin","pe","init_npm_react_18_3_1","ne","init_ssg_sandbox_shims","window","J","init_jsx_runtime","ce","de","SolarisHeaderActiveNav","rootRef","routeSet","assignRef","node","ref","getPath","pathname","isTextNavLink","anchor","classHint","applyActiveStyles","root","currentPath","parsedPath","normalizedAnchorPath","isActive","ACTIVE_COLOR","INACTIVE_COLOR","ACTIVE_WEIGHT","INACTIVE_WEIGHT","rafId","scheduleApply","onNavigationEvent","onDocumentClick","originalPushState","originalReplaceState","args","Component","props","init_SolarisHeaderActiveNav"],"sources":["https:/framerusercontent.com/modules/dQR6SHuDJX5xJ59PVsgE/btotqtuxfpCAXiqdUZP9/SolarisHeaderActiveNav.js"],"sourcesContent":["// Create a Framer code override named SolarisHeaderActiveNav that keeps layout/content unchanged and automatically styles only normal header navigation text links based on the active route.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useMemo,useRef}from\"react\";const ACTIVE_COLOR=\"#111111\";const INACTIVE_COLOR=\"#777777\";const ACTIVE_WEIGHT=\"600\";const INACTIVE_WEIGHT=\"400\";export function SolarisHeaderActiveNav(Component){return /*#__PURE__*/forwardRef(function SolarisHeaderActiveNavOverride(props,ref){const rootRef=useRef(null);const routeSet=useMemo(()=>new Set([\"/\",\"/about\",\"/service\",\"/how-we-work\",\"/our-work\",\"/contact\"]),[]);const assignRef=useCallback(node=>{rootRef.current=node;if(typeof ref===\"function\"){ref(node);}else if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);const getPath=useCallback(()=>{if(typeof window===\"undefined\")return\"/\";const pathname=window.location.pathname||\"/\";const normalized=pathname.length>1?pathname.replace(/\\/+$/,\"\"):pathname;return normalized||\"/\";},[]);const isTextNavLink=useCallback(anchor=>{if(!anchor.textContent||anchor.textContent.trim().length===0)return false;if(anchor.querySelector(\"img, svg, picture, video\"))return false;const classHint=`${anchor.className} ${anchor.getAttribute(\"aria-label\")||\"\"}`.toLowerCase();if(classHint.includes(\"logo\")||classHint.includes(\"cta\")||classHint.includes(\"button\")){return false;}if(anchor.getAttribute(\"role\")===\"button\")return false;return true;},[]);const applyActiveStyles=useCallback(()=>{if(typeof window===\"undefined\")return;const root=rootRef.current;if(!root)return;const currentPath=getPath();const scopedRoot=root.querySelector(\"nav\")??root;const anchors=scopedRoot.querySelectorAll(\"a[href]\");anchors.forEach(anchor=>{let parsedPath=\"\";try{parsedPath=new URL(anchor.href,window.location.origin).pathname||\"\";}catch{parsedPath=\"\";}const normalizedAnchorPath=parsedPath.length>1?parsedPath.replace(/\\/+$/,\"\"):parsedPath||\"/\";if(!routeSet.has(normalizedAnchorPath))return;if(!isTextNavLink(anchor))return;const isActive=normalizedAnchorPath===currentPath;anchor.style.color=isActive?ACTIVE_COLOR:INACTIVE_COLOR;anchor.style.fontWeight=isActive?ACTIVE_WEIGHT:INACTIVE_WEIGHT;});},[getPath,isTextNavLink,routeSet]);useEffect(()=>{if(typeof window===\"undefined\")return;let rafId=0;const scheduleApply=()=>{if(rafId)window.cancelAnimationFrame(rafId);rafId=window.requestAnimationFrame(()=>{applyActiveStyles();});};const onNavigationEvent=()=>{scheduleApply();};const onDocumentClick=()=>{scheduleApply();};const originalPushState=window.history.pushState;const originalReplaceState=window.history.replaceState;window.history.pushState=function(...args){originalPushState.apply(this,args);window.dispatchEvent(new Event(\"solaris-route-change\"));};window.history.replaceState=function(...args){originalReplaceState.apply(this,args);window.dispatchEvent(new Event(\"solaris-route-change\"));};window.addEventListener(\"popstate\",onNavigationEvent);window.addEventListener(\"hashchange\",onNavigationEvent);window.addEventListener(\"solaris-route-change\",onNavigationEvent);document.addEventListener(\"click\",onDocumentClick,true);scheduleApply();return()=>{if(rafId)window.cancelAnimationFrame(rafId);window.history.pushState=originalPushState;window.history.replaceState=originalReplaceState;window.removeEventListener(\"popstate\",onNavigationEvent);window.removeEventListener(\"hashchange\",onNavigationEvent);window.removeEventListener(\"solaris-route-change\",onNavigationEvent);document.removeEventListener(\"click\",onDocumentClick,true);};},[applyActiveStyles]);return /*#__PURE__*/_jsx(Component,{ref:assignRef,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"SolarisHeaderActiveNav\":{\"type\":\"reactHoc\",\"name\":\"SolarisHeaderActiveNav\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SolarisHeaderActiveNav.map"],"mappings":"A,uJACgO,SAAgBa,EAAuB,EAAU,CAAC,MAAoB,gBAAW,SAAwC,EAAM,EAAI,CAAC,IAAMC,EAAQd,EAAO,IAAI,EAAQe,EAASd,sBAAY,IAAI,IAAI,CAAC,IAAI,SAAS,WAAW,eAAe,YAAY,UAAU,CAAC,EAAE,CAAC,CAAC,EAAQe,EAAUd,EAAY,GAAM,CAAC,EAAQ,QAAQe,EAAQ,OAAOC,GAAM,WAAYA,EAAID,CAAI,EAAWC,GAAK,OAAOA,GAAM,WAAU,EAAI,QAAQD,EAAM,EAAE,CAACC,CAAG,CAAC,EAAQC,EAAQjB,MAAgB,CAAC,GAAUM,IAAS,OAAY,MAAM,IAAI,IAAMY,EAASZ,EAAO,SAAS,UAAU,IAA4E,OAAvDY,EAAS,OAAO,EAAEA,EAAS,QAAQ,OAAO,EAAE,EAAEA,IAA4B,GAAI,EAAE,CAAC,CAAC,EAAQC,EAAcnB,EAAY,GAAQ,CAA2E,GAAvE,CAACoB,EAAO,aAAaA,EAAO,YAAY,KAAK,CAAC,CAAC,SAAS,GAAkBA,EAAO,cAAc,0BAA0B,EAAE,MAAO,GAAM,IAAMC,EAAU,GAAGD,EAAO,UAAU,GAAGA,EAAO,aAAa,YAAY,GAAG,KAAK,YAAY,EAA+J,MAAvD,EAAnGC,EAAU,SAAS,MAAM,GAAGA,EAAU,SAAS,KAAK,GAAGA,EAAU,SAAS,QAAQ,GAAoBD,EAAO,aAAa,MAAM,IAAI,SAAkC,EAAE,CAAC,CAA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