1import{_ as D,N as R,r as l,j as e,S as o}from"./vendor-BOadm9Gy.js";import{u as C}from"./vendor-toast-D6B0hGGw.js";import{u as T,c as z,B as c,x as Y,v as p,l as m}from"./index-DcN63-UG.js";import{u as H}from"./useSignInPrompt-CBJ21Bsr.js";import{S as k}from"./SEO-BlctqH_J.js";import{A as q,a as W,b as O}from"./avatar-Cn6RInez.js";import{B as V}from"./badge-7z_Rspf7.js";import{R as _}from"./ReportButton-CtaQmsdm.js";import{x as G,A as J,i as K,y as Q,z as X}from"./social-hBeLCJIX.js";import{U as Z,t as ee,x as se,c as ae,a5 as te,n as ie,aa as re,bq as le,M as A,H as ne,bk as I,f as oe}from"./vendor-icons-kUGsRs8M.js";import"./vendor-ui-CeWyqG0w.js";import"./vendor-classnames-CSqCgoPn.js";import"./vendor-motion-DwikGbVM.js";import"./urlState-B_08S4CE.js";import"./listingCard-CQCxl9Sv.js";import"./textarea-Du0P8z2Y.js";import"./adminFeaturesApi-7Qqpvd5d.js";const ce="https://snestico.ai",me=i=>{if(!i)return null;const r=new Date(i);return Number.isFinite(r.getTime())?r.toLocaleDateString(m("en-US","en-IN"),{month:"long",year:"numeric"}):null},F=i=>{if(!i)return"";const r=new Date(i);return Number.isFinite(r.getTime())?r.toLocaleDateString(m("en-US","en-IN"),{month:"short",day:"numeric",year:"numeric"}):""};function Ie(){const{userId:i=""}=D(),{apiCall:r,isAuthenticated:g,isLoading:f}=T(),u=H(),M=R(),[a,P]=l.useState(null),[d,j]=l.useState("loading"),[h,b]=l.useState(!1),[N,y]=l.useState(0),[B,w]=l.useState(!1),v=l.useCallback(async()=>{try{const s=await G(r,i);P(s),b(s.viewer.isFollowing),y(s.stats.followers),j("ready")}catch(s){j(s instanceof J&&s.status===404?"missing":"error")}},[r,i]);l.useEffect(()=>{f||v()},[v,f,g]);const $=async()=>{if(!g)return u();w(!0);try{const s=await X(r,i);b(s),y(E=>Math.max(0,E+(s?1:-1))),C.success(s?`You're following ${a?.firstName}`:`You unfollowed ${a?.firstName}`)}catch(s){C.error(s instanceof Error?s.message:"Couldn't update follow")}finally{w(!1)}},L=()=>
1{if(!g)return u();M(Q(i))};if(d==="loading")return e.jsx(z,{label:"Loading profile",size:"lg",fullScreen:!0});if(d!=="ready"||!a)return e.jsxs("div",{className:"flex min-h-[60vh] flex-col items-center justify-center px-4 text-center",children:[e.jsx(k,{title:"Member not found",description:"This profile doesn't exist or is no longer available.",noindex:!0}),e.jsx(Z,{className:"mb-3 h-10 w-10 text-gray-300","aria-hidden":"true"}),e.jsx("h1",{className:"text-xl font-semibold text-gray-900",children:d==="missing"?"Member not found":"Couldn't load this profile"}),e.jsx("p",{className:"mt-1 text-sm text-gray-600",children:d==="missing"?"This profile may have been removed.":"Please try again in a moment."}),e.jsx(c,{asChild:!0,variant:"outline",className:"mt-4",children:e.jsx(o,{to:"/community",children:"Back to the community"})})]});const{viewer:n,roommate:t}=a,S=me(a.memberSince),U=`${ce}${Y(`/u/${a.id}`)}`;return e.jsxs("div",{className:"min-h-screen sn-page-bg",children:[e.jsx(k,{title:`${a.name} on Snestico`,description:a.bio?a.bio.slice(0,150):`${a.name} is a member of the Snestico community.`,url:U,type:"profile",noindex:!0}),e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-6 sm:px-6 lg:py-8",children:[e.jsxs("header",{className:"overflow-hidden rounded-2xl border border-gray-100 bg-white shadow-sm",children:[e.jsx("div",{className:"h-24 bg-gradient-to-r from-[#0C1A2B] via-[#2A4470] to-[#3A5A8C] sm:h-28","aria-hidden":"true"}),e.jsxs("div",{className:"px-5 pb-5",children:[e.jsxs("div",{className:"-mt-12 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs(q,{className:"h-24 w-24 ring-4 ring-white shadow-md",children:[e.jsx(W,{src:a.avatar||void 0,alt:a.name}),e.jsx(O,{className:"!bg-[#0C1A2B] text-2xl font-semibold text-white",children:K(a.name)})]}),!n.isSelf&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(c,{onClick:L,disabled:n.signedIn&&!n.canMessage,className:"gap-1.5",title:n.blocked?"You can't message this member":void 0,children:[e.jsx(ee,{className:"h-4 w-4"})," Message"]}),e.jsx(c,{variant:h?"outline":"secondary",onClick:$,disabled:B,className:"gap-1.5","aria-pressed":h,children:h?e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"h-4 w-4"})," Following"]}):e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"h-4 w-4"})," Follow"]})}),e.jsx(_,{targetType:"user",targetId:a.id,targetLabel:a.name,variant:"icon",className:"border border-gray-200"})]}),n.isSelf&&e.jsx(c,{asChild:!0,variant:"outline",children:e.jsx(o,{to:"/dashboard?section=profile",children:"Edit your profile"})})]}),e.jsxs("div",{className:"mt-4",children:[e.jsxs("h1",{className:"flex items-center gap-2 text-2xl font-bold text-[#0C1A2B]",children:[a.name,a.verified&&e.jsx(te,{className:"h-5 w-5 text-blue-500","aria-label":"Verified member"})]}),e.jsxs("p",{className:"mt-1 flex flex-wrap items-center gap-x-4 gap-y-1 text-sm text-gray-500",children:[a.city&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ie,{className:"h-4 w-4"})," ",a.city]}),S&&e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(re,{className:"h-4 w-4"})," Member since ",S]}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-gray-900",children:N})," follower",N===1?"":"s"]}),e.jsxs("span",{children:[e.jsx("strong",{className:"text-gray-900",children:a.stats.following})," following"]})]}),a.bio&&e.jsx("p",{className:"mt-3 max-w-2xl whitespace-pre-line text-sm leading-relaxed text-gray-700",children:a.bio}),a.limited&&e.jsxs("p",{className:"mt-3 inline-flex items-center gap-1.5 rounded-full bg-gray-100 px-3 py-1 text-xs text-gray-600",children:[e.jsx(le,{className:"h-3.5 w-3.5"})," ",a.firstName," keeps their profile private"]})]})]})]}),!a.limited&&e.jsxs("div",{className:"mt-6 grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"space-y-6 lg:col-span-2",children:[e.jsxs("section",{className:"rounded-2xl border border-gray-100 bg-white p-5 shadow-sm","aria-labelledby":"profile-posts",children:[e.jsxs("h2",{id:"profile-posts",className:"mb-4 flex items-center gap-2 text-base font-semibold text-gray-900",children:[e.jsx(A,{className:"h-4 w-4 text-[#2A4470]"})," Community posts"]}),a.posts.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:"No posts yet."}):e.jsx("ul",{className:"divide-y divide-gray-100",children:a.posts.map(s=>e.jsx("li",{className:"py-4 first:pt-0 last:pb-0",children:e.jsxs(o,{to:`/community?post=${encodeURIComponent(s.id)}`,className:"block rounded-lg hover:bg-gray-50/80",children:[s.title&&e.jsx("p",{className:"font-medium text-gray-900",children:s.title}),e.jsx("p",{className:"line-clamp-3 whitespace-pre-line text-sm text-gray-700",children:s.content}),s.images[0]&&e.jsx("img",{src:s.images[0],alt:"",loading:"lazy",className:"mt-2 h-40 w-full rounded-lg object-cover"}),e.jsxs("p",{className:"mt-2 flex items-center gap-3 text-xs text-gray-500",children:[e.jsx("span",{children:F(s.createdAt)}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(ne,{className:"h-3 w-3"})," ",s.likeCount]}),e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx(A,{className:"h-3 w-3"})," ",s.commentCount]})]})]})},s.id))})]}),e.jsxs("section",{className:"rounded-2xl border border-gray-100 bg-white p-5 shadow-sm","aria-labelledby":"profile-listings",children:[e.jsxs("h2",{id:"profile-listings",className:"mb-4 flex items-center gap-2 text-base font-semibold text-gray-900",children:[e.jsx(I,{className:"h-4 w-4 text-[#2A4470]"})," For sale"]}),a.listings.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:"Nothing for sale right now."}):e.jsx("ul",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:a.listings.map(s=>e.jsx("li",{children:e.jsxs(o,{to:`/listing-detail/${encodeURIComponent(s.id)}`,className:"block overflow-hidden rounded-xl border border-gray-100 hover:shadow-md",children:[s.image?e.jsx("img",{src:s.image,alt:s.title,loading:"lazy",className:"h-28 w-full object-cover"}):e.jsx("div",{className:"flex h-28 items-center justify-center bg-gray-50",children:e.jsx(I,{className:"h-6 w-6 text-gray-300"})}),e.jsxs("div",{className:"p-2.5",children:[e.jsx("p",{className:"line-clamp-1 text-sm font-medium text-gray-900",children:s.title}),e.jsx("p",{className:"text-sm font-semibold text-gray-900",children:p(s.price)}),s.place&&e.jsx("p",{className:"line-clamp-1 text-xs text-gray-500",children:s.place})]})]})},s.id))})]})]}),e.jsx("aside",{children:t?e.jsxs("section",{className:"rounded-2xl border border-gray-100 bg-white p-5 shadow-sm","aria-labelledby":"profile-roommate",children:[e.jsxs("h2",{id:"profile-roommate",className:"mb-3 flex items-center gap-2 text-base font-semibold text-gray-900",children:[e.jsx(oe,{className:"h-4 w-4 text-[#2A4470]"})," ",m("Looking for a roommate","Looking for a flatmate")]}),e.jsxs("dl",{className:"space-y-2 text-sm",children:[t.place&&e.jsx(x,{label:"Where",value:t.place}),t.budget&&(t.budget.min>0||t.budget.max>0)&&e.jsx(x,{label:"Budget",value:`${p(t.budget.min)} â ${p(t.budget.max)}/mo`}),t.moveInDate&&e.jsx(x,{label:"Move in",value:F(t.moveInDate)}),t.occupation&&e.jsx(x,{label:"Works as",value:t.occupation})]}),t.bio&&e.jsx("p",{className:"mt-3 text-sm text-gray-700",children:t.bio}),t.interests.length>0&&e.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:t.interests.map(s=>e.jsx(V,{variant:"secondary",className:"text-xs",children:s},s))}),e.jsx(c,{asChild:!0,variant:"outline",className:"mt-4 w-full",children:e.jsx(o,{to:`/roommates?profile=${encodeURIComponent(a.id)}`,children:m("See roommate profile","See flatmate profile")})})]}):e.jsxs("section",{className:"rounded-2xl border border-dashed border-gray-200 bg-white/60 p-5 text-sm text-gray-500",children:[a.firstName," ",m("isn't looking for a roommate right now.","isn't looking for a flatmate right now.")
1]})})]})]})]})}function x({label:i,value:r}){return e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("dt",{className:"text-gray-500",children:i}),e.jsx("dd",{className:"text-right font-medium text-gray-900",children:r})]})}export{Ie as PublicProfilePage};
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.