{"version":3,"file":"VIP_Access_Guard.LBvGtQAI.mjs","names":["__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/BxUWLl9N1TppYGFUCZEF/tSDA6VjTzkBHZEBBTGju/VIP_Access_Guard.js"],"sourcesContent":["// VipAccessGate.tsx\nimport{jsx as _jsx}from\"react/jsx-runtime\";const STAGING_DOMAIN_PREFIX=\"significant-imaginations-\";export async function hash(input){const enc=new TextEncoder().encode(input);const buffer=await crypto.subtle.digest(\"SHA-256\",enc);return Array.from(new Uint8Array(buffer)).map(b=>b.toString(16).padStart(2,\"0\")).join(\"\");}export function setRootDisplayStyle(value=\"\"){const dataFramerRoot=document.querySelector(\"[data-framer-root]\");if(dataFramerRoot)dataFramerRoot.style.display=value;}export function getSessionKey(path){return`authPassed_${path}`;}/**\n * useVipAccessGate:\n * - If visiting a protected route and sessionStorage doesn't have the right key,\n *   it will save the path and redirect to /vip-access?redirectedFrom=<path>\n * - If authorized (session key exists), simply shows the page (no overlay)\n */export function useVipAccessGuard(props){/*const [authorized, setAuthorized] = useState(false)\n    const [currentPath, setCurrentPath] = useState(\"\")\n    const VipAccessRoutes = vipAccessConfig.routes\n\n    const isStaging =\n        typeof window !== \"undefined\" &&\n        window.location.href.includes(STAGING_DOMAIN_PREFIX)\n\n    useEffect(() => {\n        if (typeof window === \"undefined\") return\n\n        const path = window.location.pathname\n        setCurrentPath(path)\n\n        // If the path is not a protected route, nothing to do\n        const currentProtectedRoute = VipAccessRoutes.find(\n            (route) => route.path === path\n        )\n\n        if (!currentProtectedRoute) {\n            setRootDisplayStyle()\n            setAuthorized(true)\n            return\n        }\n\n        // If we already have a valid session hash for this path, allow\n        const sessionKey = getSessionKey(path)\n        const storedHash = sessionStorage.getItem(sessionKey)\n\n        if (\n            storedHash &&\n            currentProtectedRoute.accessCodes.includes(storedHash)\n        ) {\n            setRootDisplayStyle()\n            setAuthorized(true)\n            return\n        }\n\n        // Not authorized: store redirect, send to /vip-access\n        // Avoid redirect loop in case /vip-access is itself configured (it shouldn't be)\n        // Save the original path so the vip access page can send user back\n        try {\n            sessionStorage.setItem(\"redirectAfterLogin\", path)\n        } catch (e) {\n            // ignore sessionStorage errors\n            console.warn(\"Could not set sessionStorage redirect:\", e)\n        }\n\n        const provider = path.replace(\"/\", \"\").split(\"-\")[0]\n        // Redirect to /vip-access (use full path)\n        const redirectTo = `/vip-access-${provider}?redirectedFrom=${encodeURIComponent(path)}`\n        // Small timeout to ensure any UI updates commit before navigation\n        window.location.replace(redirectTo)\n    }, [isStaging])\n\n    // This override renders nothing; it exists to run the redirect logic.\n    // For safety, if unauthorized and the redirect hasn't happened (rare), hide root.\n    const isProtected = VipAccessRoutes.some(\n        (route) => route.path === currentPath\n    )\n\n    if (\n        typeof window === \"undefined\" ||\n        !isProtected ||\n        isStaging ||\n        authorized\n    ) {\n        return {}\n    }\n\n    // If we're here, the redirect should already be happening. Hide root as fallback.\n    return {\n        children: null,\n    }*/return{};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withuseVipAccessGuard(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...useVipAccessGuard(props)});};}withuseVipAccessGuard.displayName=\"useVipAccessGuard\";\nexport const __FramerMetadata__ = {\"exports\":{\"withuseVipAccessGuard\":{\"type\":\"reactHoc\",\"name\":\"withuseVipAccessGuard\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"hash\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"setRootDisplayStyle\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"useVipAccessGuard\":{\"type\":\"override\",\"name\":\"useVipAccessGuard\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"getSessionKey\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./VIP_Access_Guard.map"],"mappings":"iPACmG,eAAsB,EAAK,EAAM,CAAC,IAAM,EAAI,IAAI,aAAa,CAAC,OAAO,EAAM,CAAO,EAAO,MAAM,OAAO,OAAO,OAAO,UAAU,EAAI,CAAC,OAAO,MAAM,KAAK,IAAI,WAAW,EAAO,CAAC,CAAC,IAAI,GAAG,EAAE,SAAS,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,KAAK,GAAG,CAAwK,SAAgB,EAAc,EAAK,CAAC,MAAM,cAAc,IAK5hB,SAAgB,EAAkB,EAAM,CAyEpC,MAAM,EAAE,CAAqJ,SAAgB,EAAsB,EAAE,CAAC,MAAO,KAAQ,EAA+BA,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAkB,EAAM,CAAC,CAAC,mBA9E9S,IA8EsC,IAAmF,CAAyL,EAAsB,YAAY"}