PageSourceSearch

https://culturevulture.buzz/assets/cloud-auth-service-BpGR-1iG.js

js culturevulture.buzz collected 2026-10-09 22:02:23 UTC 5,910 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lovable-CPb4oN2T.js","assets/client-CwWy5XRD.js","assets/tslib.es6-Tae09705.js"])))=>i.map(i=>d[i]);
2import{t as e}from"./client-CwWy5XRD.js";import{t}from"./preload-helper-Czpn1I53.js";var n={email:!0,push:!1,weeklyDigest:!0,eventReminders:!0},r=e=>e.toLowerCase().trim().replace(/[^a-z0-9._-]+/g,``).slice(0,24),i=`id, username, display_name, bio, avatar_url, city, country, genres, interests, website, socials, onboarded, visibility, notification_prefs, created_at`,a=e=>Array.isArray(e)?e.filter(e=>e&&typeof e.href==`string`):[],o=e=>({...n,...e&&typeof e==`object`?e:{}}),s=(e,t)=>({id:e.id,username:e.username,displayName:e.display_name||e.username.toUpperCase(),avatar:e.avatar_url?{id:`avatar_${e.id}`,kind:`image`,url:e.avatar_url,alt:e.display_name}:void 0,bio:e.bio??void 0,city:e.city??void 0,country:e.country??void 0,genres:e.genres??[],website:e.website??void 0,socialLinks:a(e.socials),role:t,createdAt:e.created_at}),c=e=>({id:e.id,username:e.username,displayName:e.display_name||e.username.toUpperCase(),avatar:e.avatar_url?{id:`avatar_${e.
2id}`,kind:`image`,url:e.avatar_url,alt:e.display_name}:void 0,bio:e.bio??void 0,city:e.city??void 0,country:e.country??void 0,genres:e.genres??[],website:e.website??void 0,socialLinks:a(e.socials),joinedAt:e.created_at}),l=e=>({city:e.city??void 0,genres:e.genres??[],interests:e.interests??[],notifications:o(e.notification_prefs)});async function u(t){let{data:n}=await e.from(`user_roles`).select(`role`).eq(`user_id`,t),r=(n??[]).map(e=>e.role);return r.includes(`admin`)?`admin`:r.includes(`editor`)?`editor`:`member`}async function d(t,n){let{data:a}=await e.from(`profiles`).select(i).eq(`id`,t).maybeSingle();if(a)return a;let o=r(n?.split(`@`)[0]??`vulture`)||`vulture`,s=o.length>=3?o:`${o}vulture`,{data:c}=await e.from(`profiles`).insert({id:t,username:`${s}${Math.floor(Math.random()*900+100)}`,display_name:s.toUpperCase()}).select(i).maybeSingle();return c??null}var f=null,p=()=>f;async function m(e,t){let n=await d(e,t);return n?(f={user:s(n,await u(e)),preferences:l(n),onboarded:n.onboarded,provider:`cloud`,issuedAt:new Date().toISOString()},f):null}var h=e=>{let t=e.toLowerCase();return t.includes(`invalid login`)?`That email and password don't match an account.`:t.includes(`already registered`)?`An account already exists for this email. Try signing in.`:t.includes(`email not confirmed`)?`Confirm your email address, then sign in.`:t.includes(`password`)?e:e||`Something went wrong. Please try again.`},g={name:`cloudAuthService`,isLive:!0,async getSession(){let{data:t}=await e.auth.getSession(),n=t.session?.user;return n?m(n.id,n.email??void 0):(f=null,null)},async signIn({email:t,password:n}){let{data:r,error:i}=await e.auth.signInWithPassword({email:t.trim(),password:n});if(i)throw Error(h(i.message));let a=r.user?await m(r.user.id,r.user.email??void 0):null;if(!a)throw Error(`Signed in, but your profile could not be loaded.`);return a},async signUp({email:t,password:n,displayName:r}){let{data:i,error:a}=await e.auth.signUp({email:t.trim(),password:n,options:{emailRedirectTo:`${window.location.origin}/auth`,data:r?{display_name:r.trim()}:{}}});if(a)throw Error(h(a.message));if(!i.session)throw Error(`Check your inbox to confirm your email address, then sign in.`);let o=i.user?await m(i.user.id,i.user.email??void 0):null;if(!o)throw Error(`Account created, but your profile could not be loaded.`);return o},async signOut(){f=null,await e.auth.signOut()},async requestPasswordReset(t){let{error:n}=await e.auth.resetPasswordForEmail(t.trim(),{redirectTo:`${window.location.origin}/auth`});if(n)throw Error(h(n.message))},async signInWithOAuth(e){let{lovable:n}=await t(async()=>{let{lovable:e}=await import(`./lovable-CPb4oN2T.js`);return{lovable:e}},__vite__mapDeps([0,1,2])),r=await n.auth.signInWithOAuth(e,{redirect_uri:window.location.origin});if(r.error)throw Error(r.error.message??`Sign-in failed.`)}},_={async getProfile(t){let{data:n}=await e.from(`profiles`).select(i).ilike(`username`,t).maybeSingle();return n?c(n):void 0},async listProfiles(){let{data:t}=await e.from(`profiles`).select(i).eq(`visibility`,`public`).order(`created_at`,{ascending:!1}).limit(200);return(t??[]).map(c)},async updateProfile(t){let{data:n}=await e.auth.getUser(),i=n.user?.id;if(!i)return null;let a={};t.username!==void 0&&(a.username=r(t.username)),t.displayName!==void 0&&(a.display_name=t.displayName),t.bio!==void 0&&(a.bio=t.bio),t.city!==void 0&&(a.city=t.city),t.country!==void 0&&(a.country=t.country),t.genres!==void 0&&(a.genres=t.genres),t.website!==void 0&&(a.website=t.website),t.socialLinks!==void 0&&(a.socials=t.socialLinks),t.avatar!==void 0&&(a.avatar_url=t.avatar?.url??null);let{error:o}=await e.from(`profiles`).update(a).eq(`id`,i);if(o)throw Error(o.message.includes(`profiles_username_key`)?`That username is taken.`:o.message);return m(i)},async updatePreferences(t){let{data:n}=await e.auth.getUser(),r=n.user?.id;if(!r)return null;let i={};t.city!==void 0&&(i.city=t.city),t.genres!==void 0&&(i.genres=t.genres),t.interests!==void 0&&(i.interests=t.interests),t.notifications!==void 0&&(i.notification_prefs=t.notifications);let{error:a}=await e.from(`profiles`).update(i).eq(`id`,r);if(a)throw Error(a.message);return m(r)},async completeOnboarding({username:t,city:n,genres:i,interests:a}){let{data:o}=await e.auth.getUser(),s=o.user?.id;if(!s)return null;let{error:c}=await e.from(`profiles`).update({username:r(t),city:n??null,genres:i,interests:a,onboarded:!0}).eq(`id`,s);if(c)throw Error(c.message.includes(`username`)?`That username is taken.`:c.message);return m(s)},async isUsernameAvailable(t){let n=r(t);if(n.length<3)return!1;let{data:i}=await e.auth.getUser(),{data:a}=await e.from(`profiles`).select(`id`).ilike(`username`,n).maybeSingle();return!a||a.id===i.user?.id}};export{r as i,_ as n,p as r,g as t};

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.