1import{j as h}from"./vendor-ui-BeVD6iDL.js";import{f as p,a as f}from"./vendor-react-Dmhbt9i7.js";import{c as m,a7 as _,s as o,$ as g,a8 as b}from"./index-cXBC_5Uy.js";import"./vendor-query-vEtoV3ax.js";import"./vendor-motion-CENv1AvF.js";function w(){try{const e=sessionStorage.getItem("post_auth_redirect");return sessionStorage.removeItem("post_auth_redirect"),g(e)}catch{}return"/dashboard"}async function d(e){try{const{data:n}=await o.auth.getUser(),r=n?.user;if(!r)return e;const{data:a,error:t}=await o.from("app_users").select("username, display_name, bio, avatar_url, website_url, instagram_url, behance_url, twitter_url, linkedin_url, dribbble_url, github_url, portfolio_url").eq("id",r.id).maybeSingle();if(t&&console.warn("[auth] perfil não pôde ser lido na volta do OAuth:",t.message),b({profile:a,readFailed:!!t,createdAt:r.created_at}))return`/auth/complete-profile?redirect=${encodeURIComponent(e)}`}catch{}return e}function U(){m({title:"Signing you in",noindex:!0});const e=p();return f.useEffect(()=>{(async()=>{const r=w();try{const{data:a,error:t}=await o.auth.getSession();if(t){console.error("[Unbserved] OAuth callback error:",t),e("/auth/login?error=oauth_failed",{replace:!0});return}if(a.session){e(await d(r),{replace:!0});return}const s=window.location.hash;if(s&&s.includes("access_token")){const i=new URLSearchParams(s.slice(1)),c=i.get("access_token"),u=i.get("refresh_token");if(c&&u){const{error:l}=await o.auth.setSession({access_token:c,refresh_token:u});if(l){console.error("[Unbserved] setSession error:",l),e("/auth/login?error=session_failed",{replace:!0});return}e(await d(r),{replace:!0});return}}e("/auth/login",{replace:!0})}catch(a){console.error("[Unbserved] Unexpected callback error:",a),e("/auth/login?error=unexpected",{replace:!0})}})()},[e]),h.jsx(_,{})}export{U as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.