{"version":3,"file":"PageFade.BCJO6mbS.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/WM24b1raHLnzvRdhOnja/PFKfOzuFbntqPA0MeoOQ/PageFade.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";/**\n * Page Fade\n *\n * Full crossfade controller. On mount the curtain (page background colour) fades\n * from opaque to transparent, so the arriving page dissolves in. It also\n * intercepts clicks on internal links: the curtain fades back to opaque over the\n * departing page, and only once it's covered does the browser navigate — so the\n * same curtain that just faded out on this page fades in on the next one, reading\n * as one continuous dissolve between pages.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function PageFade(props){const{color=\"var(--token-cb345d94-6646-49eb-bc4d-b26842605036, #0F0E0E)\",duration=.6}=props;const isStatic=useIsStaticRenderer();// 1 = fully covered, 0 = fully revealed. Start covered, then reveal on mount.\nconst[opacity,setOpacity]=useState(1);const leaving=useRef(false);useEffect(()=>{// Reveal the arriving page on the next frame so the transition runs.\nconst id=requestAnimationFrame(()=>setOpacity(0));return()=>cancelAnimationFrame(id);},[]);useEffect(()=>{function onClick(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const anchor=e.target?.closest?.(\"a[href]\");if(!anchor)return;if(anchor.target&&anchor.target!==\"_self\")return;const href=anchor.getAttribute(\"href\")||\"\";if(href.startsWith(\"#\")||href.startsWith(\"mailto:\")||href.startsWith(\"tel:\"))return;let dest;try{dest=new URL(anchor.href,window.location.href);}catch{return;}// Different origin → let the browser handle it normally.\nif(dest.origin!==window.location.origin)return;// Same page (only hash/scroll changes) → let it scroll, no curtain.\nif(dest.pathname===window.location.pathname&&dest.search===window.location.search)return;e.preventDefault();if(leaving.current)return;leaving.current=true;setOpacity(1)// fade the curtain back over the departing page\n;window.setTimeout(()=>{window.location.href=dest.href;},duration*1e3);}document.addEventListener(\"click\",onClick,true);return()=>document.removeEventListener(\"click\",onClick,true);},[duration]);if(isStatic)return null;return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":true,style:{position:\"fixed\",inset:0,width:\"100vw\",height:\"100vh\",background:color,zIndex:9999,pointerEvents:\"none\",opacity,transition:`opacity ${duration}s cubic-bezier(0.4, 0, 0.2, 1)`}});}addPropertyControls(PageFade,{color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#0F0E0E\"},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:.6,min:.2,max:1.5,step:.05,unit:\"s\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PageFade\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PageFade.map"],"mappings":"8MAYG,SAAwB,EAAS,EAAM,CAAC,GAAK,CAAC,QAAM,6DAA6D,WAAS,IAAI,EAAY,EAAS,EAAoB,EACrK,CAAC,EAAQ,GAAYA,EAAS,CAAC,EAAQ,EAAQC,EAAO,EAAK,EAI2J,OAJzJ,MAAc,CAChF,IAAM,EAAG,0BAA0B,EAAW,CAAC,CAAC,EAAE,UAAU,qBAAqB,CAAE,CAAE,EAAE,CAAC,CAAC,EAAE,MAAc,CAAC,SAAS,EAAQ,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,SAAS,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,OAAO,IAAM,EAAO,EAAE,QAAQ,UAAU,SAAS,EAAoB,GAAf,CAAC,GAAiB,EAAO,QAAQ,EAAO,SAAS,QAAQ,OAAO,IAAM,EAAK,EAAO,aAAa,MAAM,GAAG,GAAG,GAAG,EAAK,WAAW,GAAG,GAAG,EAAK,WAAW,S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