{"version":3,"file":"LogoLoading.DsghqgJV.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/lQGJ4GjP3bXn736G9e7R/z3E93hPXSRtoB8ydlspP/LogoLoading.js"],"sourcesContent":["/*\nimport { useEffect, useState } from \"react\"\nimport lottie from \"lottie-web\"\n\nexport function LogoLoading() {\n    const [loading, setLoading] = useState(true)\n    const [fadeOut, setFadeOut] = useState(false)\n\n    useEffect(() => {\n        // Check if returning from a subpage\n        const isReturningFromSubPage = sessionStorage.getItem(\n            \"isReturningFromSubPage\"\n        )\n\n        if (isReturningFromSubPage) {\n            setLoading(false)\n            return\n        }\n\n        // Add scroll lock class\n        document.body.classList.add(\"scroll-lock\")\n\n        const animation = lottie.loadAnimation({\n            container: document.getElementById(\"lottie\"),\n            renderer: \"svg\",\n            loop: false,\n            autoplay: true,\n            path: \"https://lottie.host/b36d23f5-c51c-43b1-b439-db46896ae3c0/hF6YrZlKBG.json\",\n        })\n\n        animation.setSpeed(1.7) // Set the speed to 1.7\n\n        animation.onComplete = () => {\n            setFadeOut(true) // Trigger fade-out effect\n            // Wait for the fade-out duration before hiding the loading block\n            setTimeout(() => {\n                setLoading(false)\n                // Remove scroll lock class\n                document.body.classList.remove(\"scroll-lock\")\n            }, 500) // Match the duration of the fade-out\n        }\n\n        // Set to indicate that the user is returning from the main page\n        sessionStorage.setItem(\"isReturningFromSubPage\", \"true\")\n\n        return () => {\n            animation.destroy()\n            // Ensure scroll lock is removed on unmount\n            document.body.classList.remove(\"scroll-lock\")\n        }\n    }, [])\n\n    return (\n        <div\n            style={{\n                display: loading ? \"flex\" : \"none\",\n                justifyContent: \"center\",\n                alignItems: \"center\",\n                height: \"100vh\",\n                transition: \"opacity 0.5s ease\",\n                opacity: fadeOut ? 0 : 1, // Control opacity for fade-out effect\n                backgroundColor: \"rgba(255, 255, 255, 1)\", // Keep white background until fade-out\n                position: \"fixed\", // Fix position to cover the entire viewport\n                top: 0,\n                left: 0,\n                right: 0,\n                bottom: 0,\n                zIndex: 9999, // Ensure the block is on top of other content\n            }}\n        >\n            <div id=\"lottie\" style={{ width: \"300px\", height: \"300px\" }}></div>\n        </div>\n    )\n}\n*/import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";export function LogoLoading(){const[loading,setLoading]=useState(true);const[fadeOut,setFadeOut]=useState(false);useEffect(()=>{const isReturningFromSubPage=sessionStorage.getItem(\"isReturningFromSubPage\");if(isReturningFromSubPage){setLoading(false);return;}document.body.classList.add(\"scroll-lock\");sessionStorage.setItem(\"isReturningFromSubPage\",\"true\");// Duration of one full GIF loop in milliseconds — set to 6.9 seconds\nconst gifDurationMs=6900// 6.9s\n;// Safety cap: don't let the overlay hang forever (optional)\nconst maxCapMs=3e4;const hideAfter=Math.min(Math.max(gifDurationMs,500),maxCapMs);const timer=setTimeout(()=>{setFadeOut(true);// match fade-out duration (500ms) before removing overlay and unlocking scroll\nsetTimeout(()=>{setLoading(false);document.body.classList.remove(\"scroll-lock\");},500);},hideAfter);return()=>{clearTimeout(timer);document.body.classList.remove(\"scroll-lock\");};},[]);const gifUrl=\"https://github.com/LindsayYang1006/LYYH-logo-animation/raw/main/logo_shorten.gif\";// Recommended for production:\n// const gifUrl = \"https://cdn.jsdelivr.net/gh/LindsayYang1006/LYYH-logo-animation@main/logo_shorten.gif\"\nreturn /*#__PURE__*/_jsx(\"div\",{style:{display:loading?\"block\":\"none\",position:\"fixed\",inset:0,backgroundColor:\"rgba(255,255,255,1)\",zIndex:9999,transition:\"opacity 0.5s ease\",opacity:fadeOut?0:1,touchAction:\"none\"},children:/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"50%\",left:\"50%\",transform:\"translate(-50%, -50%)\",width:300,height:300,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:/*#__PURE__*/_jsx(\"img\",{src:gifUrl,alt:\"Loading…\",style:{width:\"100%\",height:\"100%\",objectFit:\"contain\",pointerEvents:\"none\"}})})});}\nexport const __FramerMetadata__ = {\"exports\":{\"LogoLoading\":{\"type\":\"reactComponent\",\"name\":\"LogoLoading\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./LogoLoading.map"],"mappings":"yHA0EmF,SAAgB,GAAa,CAAC,GAAK,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAM,CAMnM,OANoM,MAAc,CAA+E,GAAjD,eAAe,QAAQ,yBAAyB,CAA2B,CAAC,EAAW,GAAM,CAAC,OAAQ,SAAS,KAAK,UAAU,IAAI,cAAc,CAAC,eAAe,QAAQ,yBAAyB,OAAO,CAGra,IAAqE,EAAM,eAAe,CAAC,EAAW,GAAK,CAC9H,eAAe,CAAC,EAAW,GAAM,CAAC,SAAS,KAAK,UAAU,OAAO,cAAc,EAAG,IAAI,EAAG,KAAU,CAAC,UAAU,CAAC,aAAa,EAAM,CAAC,SAAS,KAAK,UAAU,OAAO,cAAc,GAAK,EAAE,CAAC,CAEpK,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAQ,QAAQ,OAAO,SAAS,QAAQ,MAAM,EAAE,gBAAgB,sBAAsB,OAAO,KAAK,WAAW,oBAAoB,QAAQ,EAAQ,EAAE,EAAE,YAAY,OAAO,CAAC,SAAsB,EAAK,MAAM,CAAC,MAAM,CAAC,SAAS,WAAW,IAAI,MAAM,KAAK,MAAM,UAAU,wBAAwB,MAAM,IAAI,OAAO,IAAI,QAAQ,OAAO,WAAW,SAAS,eAAe,SAAS,CAAC,SAAsB,EAAK,MAAM,CAAC,IAFzP,mFAEoQ,IAAI,WAAW,MAAM,CAAC,MAAM,OAAO,OAAO,OAAO,UAAU,UAAU,cAAc,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,kBAN7f,IAAsC"}