{"version":3,"file":"ProtectedPage.iSUGIZHT.mjs","names":[],"sources":["https:/framerusercontent.com/modules/z7lpqDZPa1rQvuoASGj8/3cMLEtFJVuNriqOsZb9u/ProtectedPage.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{createClient}from\"@supabase/supabase-js\";import{useCurrentLocation}from\"https://framer.com/m/UseCurrentLocation-oZyA.js@bdioF58F5hKfAbBswbPv\";const SUPABASE_URL=\"https://bukgytxjsomvglxcsphw.supabase.co\";const SUPABASE_ANON_KEY=\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJ1a2d5dHhqc29tdmdseGNzcGh3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDU5NDU1NjQsImV4cCI6MjA2MTUyMTU2NH0.-LXzYsE-eDVyYrNnTZT1UKf3fCXTaHEGioiblbrDA7o\";const supabase=createClient(SUPABASE_URL,SUPABASE_ANON_KEY);export default function ProtectedPageGuard(){const[checked,setChecked]=React.useState(false);const[_,setCurrentLocation]=useCurrentLocation();React.useEffect(()=>{const verifyAccess=async()=>{const url=new URL(window.location.href);const access_token=url.searchParams.get(\"access_token\");const refresh_token=url.searchParams.get(\"refresh_token\");// 1. aktuelle Session prüfen\nlet{data:sessionData}=await supabase.auth.getSession();let session=sessionData?.session;// 2. Falls nicht eingeloggt, aber Token vorhanden → Session setzen\nif(!session?.user&&access_token&&refresh_token){const{data,error}=await supabase.auth.setSession({access_token,refresh_token});if(error){console.error(\"❌ Fehler beim setSession:\",error);}else{session=data?.session;// Bereinige die URL nach erfolgreichem Login\nwindow.history.replaceState({},document.title,window.location.pathname);}}// 3. Zugang erlauben?\nconst isEditor=navigator.userAgent.includes(\"Framer\");const isPreview=window?.location.href.includes(\"framer.app\");const isLoggedIn=!!session?.user;const accessGranted=isLoggedIn||isEditor||isPreview;setChecked(true);if(!accessGranted){setCurrentLocation(\"/signin\");}};verifyAccess();},[]);if(!checked){return /*#__PURE__*/_jsx(\"div\",{style:{display:\"none\"}});}return /*#__PURE__*/_jsx(\"div\",{style:{display:\"none\"}});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ProtectedPageGuard\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ProtectedPage.map"],"mappings":"gYAAikB,SAAwB,GAAoB,CAAC,GAAK,CAAC,EAAQ,EAAW,CAAA,EAAgB,IAAY,CAAC,EAAE,EAAmB,CAAC,IAIjV,OAJsW,MAAoB,CAAC,IAAM,EAAa,SAAS,CAAC,IAAM,EAAI,IAAI,IAAI,EAAO,SAAS,MAAY,EAAa,EAAI,aAAa,IAAI,gBAAsB,EAAc,EAAI,aAAa,IAAI,iBACv4B,CAAC,KAAK,EAAY,CAAC,MAAM,EAAS,KAAK,aAAiB,EAAQ,GAAa,QAChF,GAAG,CAAC,GAAS,MAAM,GAAc,EAAc,CAAC,GAAK,CAAC,OAAK,QAAM,CAAC,MAAM,EAAS,KAAK,WAAW,CAAC,eAAa,gBAAc,EAAK,EAAO,QAAQ,MAAM,4BAA4B,IAAa,EAAQ,GAAM,QAC9M,EAAO,QAAQ,aAAa,EAAE,CAAC,SAAS,MAAM,EAAO,SAAS,UAAY,CAC1E,IAAM,EAAS,EAAU,UAAU,SAAS,UAAgB,EAAU,GAAQ,SAAS,KAAK,SAAS,cAAoB,EAAW,CAAC,CAAC,GAAS,KAAW,EAAc,GAAY,GAAU,EAAU,EAAW,IAAU,GAAe,EAAmB,UAAa,EAAC,GAAgB,EAAC,EAAE,EAA6F,EAAK,MAAM,CAAC,MAAM,CAAC,QAAQ,OAAO,CAAC,CAAG,yCAJjM,EAAa,2CAAiD,EAAkB,mNAAyN,EAAS,EAAa,EAAa"}