{"version":3,"file":"PageFadeIn.CyB_v3nE.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/d5E1r4zrzscnHIfuevY5/lxidSJQC7CEDbPxuYroI/PageFadeIn.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useEffect,useState,useRef}from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * PageFadeIn — Aggressive FOUC mask for Framer sites with runtime CSS injection\n * Place as FIRST child of every page's Desktop breakpoint.\n *\n * Strategy:\n * 1. Renders a <style> tag INLINE (not in useEffect) that sets body opacity:0\n *    immediately. This works during SSR — the browser parses the style before\n *    painting any content, so the page is invisible from the very first frame.\n * 2. After React hydrates and all component useEffect/injectStyles calls have\n *    fired, we remove the body-hiding style and fade out a white overlay.\n * 3. The overlay itself is a fixed div that provides a clean white screen\n *    during the brief opacity transition.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */// Unique ID so multiple instances don't conflict\nconst BODY_HIDE_ID=\"__fouc-body-hide__\";export default function PageFadeIn(props){const{backgroundColor=\"#ffffff\",duration=600,delay=200,style}=props;const[visible,setVisible]=useState(true);const[opacity,setOpacity]=useState(1);const cleanedUp=useRef(false);// --- SSR-safe body-hiding style ---\n// This <style> tag is rendered INLINE in JSX (not via useEffect), so it\n// is present in the server-rendered HTML. The browser applies it before\n// painting, ensuring the page is invisible from frame 0.\n// We generate it as a raw string to inject into dangerouslySetInnerHTML.\nconst bodyHideCSS=`\n        body {\n            opacity: 0 !important;\n            transition: none !important;\n        }\n    `;useEffect(()=>{// Once React hydrates and this effect runs, all sibling component\n// injectStyles() calls have already executed (useEffect fires after\n// the entire tree commits). Now safe to reveal.\nconst t1=setTimeout(()=>{// Step 1: Remove the body-hiding <style> tag so body becomes visible\n// (the overlay is still covering it at opacity 1)\nconst hideTag=document.getElementById(BODY_HIDE_ID);if(hideTag)hideTag.remove();// Also ensure body opacity is restored in case of stale inline styles\ndocument.body.style.opacity=\"1\";// Step 2: Start fading out the overlay\nsetOpacity(0);cleanedUp.current=true;},delay);const t2=setTimeout(()=>{// Step 3: Remove overlay from DOM entirely\nsetVisible(false);},delay+duration+50)// small buffer after transition ends\n;// Safety net: if component unmounts before timers fire, clean up body\nreturn()=>{clearTimeout(t1);clearTimeout(t2);if(!cleanedUp.current){const hideTag=document.getElementById(BODY_HIDE_ID);if(hideTag)hideTag.remove();document.body.style.opacity=\"1\";}};},[delay,duration]);// In the Framer canvas editor, don't show overlay (it would block editing)\nif(RenderTarget.current()!==RenderTarget.preview)return null;// Once fully faded, render nothing\nif(!visible)return null;return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{id:BODY_HIDE_ID,dangerouslySetInnerHTML:{__html:bodyHideCSS}}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"fixed\",inset:0,zIndex:2147483646,background:backgroundColor,opacity,transition:`opacity ${duration}ms ease`,pointerEvents:\"none\",...style}})]});}addPropertyControls(PageFadeIn,{backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#ffffff\"},duration:{type:ControlType.Number,title:\"Fade (ms)\",defaultValue:600,min:100,max:2e3,step:50},delay:{type:ControlType.Number,title:\"Delay (ms)\",defaultValue:200,min:0,max:1e3,step:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PageFadeIn\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PageFadeIn.map"],"mappings":"6MAgBwC,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,kBAAgB,UAAU,WAAS,IAAI,QAAM,IAAI,SAAO,EAAW,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAAM,CAAC,EAAQ,GAAYA,EAAS,EAAE,CAAO,EAAUC,EAAO,GAAM,CAsB1O,OAZlB,MAAc,CAGpB,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