import{j as e,L as ne,r as f,e as ie,u as oe}from"./vendor-react-CVHocMAO.js";import{j as q,bm as ce,a2 as H,B as C,c9 as F,G as N,N as de,O as me,c7 as E,c6 as G,X as J,cs as W,y as $,z as D,bx as ue,C as U,bP as O,dP as xe,l as he,I as fe,bN as ge,Z as X,cp as Z,K as pe,k as ee,x as be,dQ as K,cC as B,cz as se,bw as Q,F as z,bI as Y}from"./index-DXdAv5n3.js";import{I as te}from"./ImageWithFallback-BEJkpOin.js";import{m as P}from"./vendor-motion-CP2nHqR4.js";import{B as je}from"./briefcase-BIW9oRxC.js";import{g as ve}from"./listing-utils-DWgPJQzT.js";import{C as Ne}from"./clipboard-list-vcFLuu0b.js";import{A as we}from"./arrow-right-B6oF8gn-.js";import{C as ye}from"./copy--gtFY43f.js";import{C as ke,b as Ce}from"./card-BAusE3PF.js";import{B as _}from"./badge-Ce5c8tpv.js";import{f as Se}from"./vendor-amplify-BttVyssp.js";import{S as A}from"./star-WZhRtBdg.js";import{G as ae}from"./gift-CArYjjEm.js";import{P as Le}from"./plus-gZD8KbAO.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const re=q("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fe=q("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);function M({activeFilter:s,onFilterChange:t}){return e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"relative inline-flex items-center gap-1 bg-[#F2F2F2] p-1.5 rounded-full shadow-sm w-full md:w-auto",children:[e.jsxs("button",{onClick:()=>t("all"),className:`relative z-10 flex-1 md:flex-none px-6 py-2.5 rounded-full text-sm transition-colors duration-200 ${s==="all"?"text-white":"text-gray-600 hover:text-gray-900"}`,children:[s==="all"&&e.jsx(P.div,{layoutId:"activeFilter",className:"absolute inset-0 bg-gray-900 rounded-full shadow-md",transition:{type:"spring",stiffness:300,damping:30}}),e.jsx("span",{className:"relative z-10",children:"All"})]}),e.jsxs("button",{onClick:()=>t("venues"),className:`relative z-10 flex-1 md:flex-none px-6 py-2.5 rounded-full text-sm transition-colors duration-200 flex items-center justify-center gap-2 ${s==="venues"?"text-white":"text-gray-600 hover:text-gray-900"}`,children:[s==="venues"&&e.jsx(P.div,{layoutId:"activeFilter",className:"absolute inset-0 bg-gray-900 rounded-full shadow-md",transition:{type:"spring",stiffness:300,damping:30}}),e.jsx(ce,{size:16,className:"relative z-10"}),e.jsx("span",{className:"relative z-10",children:"Venues"})]}),e.jsxs("button",{onClick:()=>t("services"),className:`relative z-10 flex-1 md:flex-none px-6 py-2.5 rounded-full text-sm transition-colors duration-200 flex items-center justify-center gap-2 ${s==="services"?"text-white":"text-gray-600 hover:text-gray-900"}`,children:[s==="services"&&e.jsx(P.div,{layoutId:"activeFilter",className:"absolute inset-0 bg-gray-900 rounded-full shadow-md",transition:{type:"spring",stiffness:300,damping:30}}),e.jsx(je,{size:16,className:"relative z-10"}),e.jsx("span",{className:"relative z-10",children:"Services"})]})]})})}function Ie({tabName:s,message:t}){return e.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm p-12 md:p-20 text-center",children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx("span",{className:"text-3xl",children:"📋"})}),e.jsx("h3",{className:"text-gray-900 mb-2",children:s.charAt(0).toUpperCase()+s.slice(1)}),e.jsx("p",{className:"text-gray-500",children:t||`This section is coming soon. Your ${s} items will appear here once available.`})]})})}function ze({title:s,message:t,icon:a="clipboard",actionLabel:x,actionHref:o}){const h=a==="heart";return e.jsx("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsx(P.div,{animate:{y:[0,-4,0],scale:[1,1.02,1]},transition:{duration:2.5,repeat:1/0,ease:"easeInOut"},className:h?"rounded-2xl bg-rose-50 p-6 dark:bg-rose-950/30":"rounded-2xl bg-muted/50 p-6 dark:bg-muted/30",children:h?e.jsx(H,{className:"h-12 w-12 fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400"}):e.jsx(Ne,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("h3",{className:"text-foreground mt-4 text-center font-semibold",children:s}),e.jsx("p",{className:"text-muted-foreground mt-1 text-center text-sm",children:t}),x&&o&&e.jsx(C,{variant:"link",className:"mt-2 rounded-full text-sm text-primary",asChild:!0,children:e.jsx(ne,{to:o,children:x})})]})})}function Ee(s){const[t,a]=f.useState([]),[x,o]=f.useState(!0);return f.useEffect(()=>{if(!s){a([]),o(!1);return}(async()=>{try{o(!0);const d=[];let m,u=0;const n=20;for(;u<n;){const c=new URLSearchParams;c.set("limit","100"),m&&c.set("cursor",m);const l=await F(`/public/venues?${c.toString()}`);if(d.push(...l.items??[]),!l.nextCursor)break;m=l.nextCursor,u+=1}const i=d.filter(c=>{var r,p,y,S;return c.status!=="published"?!1:[c.ownerPublicId,(p=(r=c.draftData)==null?void 0:r.onboardingMetadata)==null?void 0:p.ownerPublicId,(S=(y=c.publishedData)==null?void 0:y.onboardingMetadata)==null?void 0:S.ownerPublicId,c.userId].filter(v=>typeof v=="string").map(v=>v.trim()).filter(Boolean).includes(s)});a(i)}catch(d){console.error("Failed to load published listings:",d),a([])}finally{o(!1)}})()},[s]),{listings:t,loading:x}}function rs({userId:s,showEdit:t=!0}){const{listings:a=[],loading:x}=Ee(s),[o,h]=f.useState("all"),d=n=>n&&n.listingKind==="service"?"service":"venue",m=f.useMemo(()=>(a??[]).filter(Boolean).filter(n=>{if(o==="all")return!0;const i=d(n);return o==="venues"?i==="venue":i==="service"}),[a,o]),u=f.useMemo(()=>m.slice().sort((n,i)=>new Date(i.createdAt).getTime()-new Date(n.createdAt).getTime()).slice(0,9),[m]);return x?e.jsxs(e.Fragment,{children:[e.jsx(M,{activeFilter:o,onFilterChange:h}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mt-4",children:[1,2,3].map(n=>e.jsxs("div",{className:"rounded-xl border border-gray-200 overflow-hidden",children:[e.jsx(N,{className:"aspect-video w-full"}),e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsx(N,{className:"h-5 w-3/4"}),e.jsx(N,{className:"h-4 w-1/2"}),e.jsx(N,{className:"h-4 w-full"})]})]},n))})]}):!a||a.length===0?e.jsx(e.Fragment,{children:e.jsx(ze,{title:"No hosted events yet",message:"No events have been hosted yet. Hosted listings will appear here once they do."})}):u.length===0?e.jsxs(e.Fragment,{children:[e.jsx(M,{activeFilter:o,onFilterChange:h}),e.jsx(Ie,{tabName:"hosted",message:"No listings match your filter yet."})]}):e.jsxs(e.Fragment,{children:[e.jsx(M,{activeFilter:o,onFilterChange:h}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5 md:gap-6",children:u.map(n=>{var L,g,b,j,w;const i=ve(n)??n.draftData,c=((L=i==null?void 0:i.serviceData)==null?void 0:L.cardTitle)||((g=i==null?void 0:i.serviceData)==null?void 0:g.title)||((b=i==null?void 0:i.basics)==null?void 0:b.title)||n.title||"Your listing",l=n.locationLabel||((j=i==null?void 0:i.location)==null?void 0:j.formatted)||"",r=d(n),p=(i==null?void 0:i.serviceData)??{},y=(p.offerings??[])[0],S=r==="service"?p.coverImage||(y==null?void 0:y.image)||"/default-venue-image.png":((w=i==null?void 0:i.media)==null?void 0:w.coverImage)||n.coverImage||"/default-venue-image.png",v=n.createdAt?de(new Date(n.createdAt),"MMM d, yyyy"):"—";return e.jsxs("div",{className:"group bg-white rounded-2xl overflow-hidden border border-gray-200 shadow-sm hover:shadow-lg transition-all",children:[e.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden",children:[e.jsx(te,{src:S,alt:c,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),e.jsx("span",{className:`
                    absolute top-4 left-4 px-3 py-1.5 rounded-full text-xs font-medium
                    bg-emerald-100 text-emerald-700
                  `,children:"Confirmed"})]}),e.jsxs("div",{className:"p-5",children:[e.jsx("h3",{className:"text-gray-900 mb-2 text-base font-semibold line-clamp-2",children:c}),e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600 text-sm mb-3",children:[e.jsx(me,{size:16}),e.jsx("span",{className:"truncate",children:l})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500 mb-4",children:[e.jsx(E,{size:14}),e.jsxs("span",{children:["Published · ",v]})]}),e.jsxs("div",{className:`flex ${t?"justify-between":"justify-start"} mt-4`,children:[e.jsx("button",{className:"rounded-full border border-gray-300 px-4 py-1.5 text-sm hover:bg-gray-50 transition",onClick:()=>{const k=d(n)==="service"?`/service/${n.listingId}`:`/venue/${n.listingId}`;window.location.assign(k)},children:"View"}),t&&e.jsxs("button",{className:"rounded-full px-4 py-1.5 text-gray-700 hover:bg-gray-100 transition flex items-center gap-1",onClick:()=>window.location.assign(`/host/listing/${n.listingId}/edit`),children:["Edit ",e.jsx(we,{size:16})]})]})]})]},n.listingId)})})]})}function ls({name:s,followers:t,photoURL:a,profileUrl:x,onClose:o}){const[h,d]=f.useState(!1),m=async()=>{try{await navigator.clipboard.writeText(x),d(!0),setTimeout(()=>d(!1),2e3)}catch(u){console.error("Copy failed",u)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:o,children:e.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl max-w-md w-full opacity-0 translate-y-4 scale-95 animate-[slideUpAndFade_0.3s_ease-out_forwards]",onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{className:"p-6 md:p-8 border-b border-gray-200",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h2",{className:"text-gray-900",children:"Share Profile"}),e.jsx("button",{onClick:o,className:G.modal.closeButton.buttonClassName,"aria-label":"Close",children:e.jsx(J,{className:G.modal.closeButton.iconSize})})]}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Share your PLEC profile with others"})]}),e.jsxs("div",{className:"p-6 md:p-8",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6 p-4 bg-gray-50 rounded-2xl",children:[e.jsx(te,{src:a||"/default-avatar.png",alt:s,className:"w-14 h-14 rounded-full object-cover ring-2 ring-white shadow-sm"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-gray-900 text-sm truncate",children:s}),e.jsxs("p",{className:"text-gray-500 text-xs",children:[t," followers"]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-gray-700 text-sm mb-3",children:"Profile Link"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 px-4 py-3 bg-gray-50 border border-gray-200 rounded-xl text-gray-600 text-sm truncate",children:x}),e.jsx("button",{onClick:m,className:`px-5 py-3 rounded-xl transition-all shadow-sm flex items-center gap-2 flex-shrink-0 ${h?"bg-green-600 text-white hover:bg-green-700":"bg-gradient-to-r from-brand-400 to-brand-500 hover:brightness-90 text-white"}`,children:h?e.jsxs(e.Fragment,{children:[e.jsx(W,{size:18}),e.jsx("span",{className:"hidden sm:inline",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(ye,{size:18}),e.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),h&&e.jsxs("div",{className:"flex items-center gap-2 p-4 bg-green-50 border border-green-200 rounded-xl mb-6",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-green-100 flex items-center justify-center flex-shrink-0",children:e.jsx(W,{size:16,className:"text-green-600"})}),e.jsx("p",{className:"text-green-700 text-sm",children:"Link copied to clipboard!"})]}),e.jsx("button",{onClick:o,className:"w-full px-6 py-3.5 bg-gray-100 text-gray-700 rounded-xl hover:bg-gray-200 transition-all",children:"Done"})]})]})})}function Pe(s){const t=(a,x)=>s[a]??s[x];return{publicId:s.publicId??s.public_id,name:t("name","name"),preferredName:t("preferredName","preferred_name"),firstName:t("firstName","first_name"),lastName:t("lastName","last_name"),photoURL:t("photoURL","photo_url")}}async function V(){var a,x;const t=(x=(a=(await Se()).tokens)==null?void 0:a.idToken)==null?void 0:x.toString();return t?{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}:{}}async function Te(s){const t=await V();return F(`/users/${s}/follow`,{method:"POST",headers:t})}async function Be(s){const t=await V();return F(`/users/${s}/follow`,{method:"DELETE",headers:t})}async function Ae(s){const t=await V();return F(`/users/${s}/follow-status`,{headers:t})}function le(s){return{items:(s.items??[]).map(a=>Pe(typeof a=="object"&&a!==null?a:{publicId:String(a)})),nextCursor:s.nextCursor??void 0}}async function _e(s){const t=await F(`/users/${s}/followers/all`);return le(t)}async function Me(s){const t=await F(`/users/${s}/following/all`);return le(t)}function R(s){return s.preferredName||[s.firstName,s.lastName].filter(Boolean).join(" ")||s.name||"User"}function Re({open:s,onOpenChange:t,publicId:a,type:x,title:o}){const h=ie(),[d,m]=f.useState(""),[u,n]=f.useState([]),[i,c]=f.useState(!1),[l,r]=f.useState(null),p=x==="followers"?"Followers":"Following",y=o??p,S=f.useCallback((g,b)=>{F(`/users/profile/by-id/${g}`).then(j=>{n(w=>{const I=[...w],k=I[b];return!k||k.publicId!==g?w:(I[b]={...k,name:j.name??k.name,preferredName:j.preferredName??k.preferredName,firstName:j.firstName??k.firstName,lastName:j.lastName??k.lastName,photoURL:j.photoURL??k.photoURL},I)})}).catch(()=>{})},[]);f.useEffect(()=>{if(!s||!a)return;m(""),r(null),c(!0),(x==="followers"?_e:Me)(a).then(b=>{const j=b.items??[];n(j),j.forEach((w,I)=>{R(w)==="User"&&w.publicId&&S(w.publicId,I)})}).catch(b=>{r((b==null?void 0:b.message)??"Failed to load list"),n([])}).finally(()=>c(!1))},[s,a,x,S]);const v=f.useMemo(()=>{if(!d.trim())return u;const g=d.trim().toLowerCase();return u.filter(b=>R(b).toLowerCase().includes(g))},[u,d]),L=g=>{t(!1),h(`/u/${g}`)};return e.jsx($,{open:s,onOpenChange:t,children:e.jsxs(D,{className:"flex flex-col max-h-[85vh] p-0 gap-0",hideCloseButton:!0,mobileBottomSheet:!0,children:[e.jsxs(ue,{className:"relative shrink-0 border-b border-border px-4 pb-3 pt-4",children:[e.jsx(U,{className:"text-center text-base font-semibold text-foreground",children:y}),e.jsx(O,{className:"sr-only",children:"Search and select from the list"}),e.jsx(xe,{asChild:!0,children:e.jsx("button",{type:"button",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":"Close",children:e.jsx(J,{className:"h-4 w-4"})})})]}),e.jsx("div",{className:"shrink-0 border-b border-border px-4 py-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(he,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(fe,{placeholder:"Search",value:d,onChange:g=>m(g.target.value),className:"border-border bg-muted/40 pl-9","aria-label":`Search ${p.toLowerCase()}`})]})}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-3 py-3",children:[i&&e.jsx("ul",{className:"space-y-1",children:[1,2,3,4,5].map(g=>e.jsxs("li",{className:"flex items-center gap-3 rounded-xl px-3 py-2.5",children:[e.jsx(N,{className:"h-10 w-10 shrink-0 rounded-full"}),e.jsx(N,{className:"h-4 w-24 rounded-md"})]},g))}),l&&e.jsx("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:e.jsx("p",{className:"text-sm text-destructive",children:l})}),!i&&!l&&v.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx("div",{className:"rounded-full bg-muted/60 p-4",children:e.jsx(ge,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("p",{className:"text-muted-foreground mt-3 text-sm",children:d.trim()?"No matches.":`No ${p.toLowerCase()} yet.`})]}),!i&&!l&&v.length>0&&e.jsx("ul",{className:"space-y-1",children:v.map(g=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>L(g.publicId),className:"flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left transition-colors hover:bg-muted/60",children:[e.jsx(X,{originalSrc:g.photoURL||Z,variant:"thumbnail",alt:"",className:"h-10 w-10 shrink-0 rounded-full object-cover"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-medium text-foreground",children:R(g)}),e.jsx(pe,{className:"h-4 w-4 shrink-0 text-muted-foreground"})]})},g.publicId))})]})]})})}class T extends Error{constructor(t="Authentication required"){super(t),this.name="AuthRequiredError"}}function $e(s,t,a){const{user:x,loading:o}=ee(),[h,d]=f.useState(null),[m,u]=f.useState(!0);f.useEffect(()=>{if(!s){u(!1);return}if(!o){if(!x){d(!1),u(!1);return}(async()=>{var c;try{const l=await Ae(s);d(l.following)}catch(l){(l==null?void 0:l.status)===401||(l==null?void 0:l.statusCode)===401||((c=l==null?void 0:l.message)==null?void 0:c.includes("Unauthorized"))||console.error("[useFollow] Error fetching follow status:",l),d(!1)}finally{u(!1)}})()}},[s,x,o]);const n=f.useCallback(async()=>{var c,l;u(!0);try{await Te(s),d(!0),t&&t(1)}catch(r){if((r==null?void 0:r.status)===401||(r==null?void 0:r.statusCode)===401||((c=r==null?void 0:r.message)==null?void 0:c.includes("Unauthorized"))||((l=r==null?void 0:r.message)==null?void 0:l.includes("No authentication token")))if(a)a();else throw new T("Please sign in to follow users");else throw r}finally{u(!1)}},[s,t,a]),i=f.useCallback(async()=>{var c,l;u(!0);try{await Be(s),d(!1),t&&t(-1)}catch(r){if((r==null?void 0:r.status)===401||(r==null?void 0:r.statusCode)===401||((c=r==null?void 0:r.message)==null?void 0:c.includes("Unauthorized"))||((l=r==null?void 0:r.message)==null?void 0:l.includes("No authentication token")))if(a)a();else throw new T("Please sign in to unfollow users");else throw r}finally{u(!1)}},[s,t,a]);return{isFollowing:h,loading:m,follow:n,unfollow:i}}const De=({targetUserId:s,size:t="default",onFollowingDelta:a})=>{const{user:x}=ee(),o=be(),h=oe(),[d,m]=f.useState(!1);f.useEffect(()=>{d&&typeof window<"u"&&sessionStorage.setItem("postAuthRedirect",h.pathname)},[d,h.pathname]);const{isFollowing:u,loading:n,follow:i,unfollow:c}=$e(s||"",a,()=>m(!0));if(!s)return e.jsx(C,{disabled:!0,size:t,className:"rounded-full px-6",children:"Loading..."});if(u===null)return e.jsx(C,{disabled:!0,size:t,className:"rounded-full px-6",children:"Loading..."});const l=async()=>{if(!x){m(!0);return}try{await c()}catch(p){p instanceof T&&m(!0)}};if(u)return e.jsxs(e.Fragment,{children:[e.jsx(C,{variant:"outline",size:t,className:"rounded-full px-6",disabled:n,onClick:l,children:"Following"}),e.jsx($,{open:d,onOpenChange:m,children:e.jsxs(D,{mobileBottomSheet:o,className:o?"min-h-[85vh] max-h-[90vh]":"max-w-[600px] max-h-[90vh] overflow-y-auto scrollbar-hide p-0",hideCloseButton:o,children:[e.jsx(U,{className:"sr-only",children:"Authentication"}),e.jsx(O,{className:"sr-only",children:"Sign in or create an account to follow users."}),e.jsx(K,{onSuccess:()=>m(!1),showRedirectScreen:!1})]})})]});const r=async()=>{if(!x){m(!0);return}try{await i()}catch(p){p instanceof T&&m(!0)}};return e.jsxs(e.Fragment,{children:[e.jsx(C,{size:t,className:"rounded-full px-6",disabled:n,onClick:r,children:"Follow"}),e.jsx($,{open:d,onOpenChange:m,children:e.jsxs(D,{mobileBottomSheet:o,className:o?"min-h-[85vh] max-h-[90vh]":"max-w-[600px] max-h-[90vh] overflow-y-auto scrollbar-hide p-0",hideCloseButton:o,children:[e.jsx(U,{className:"sr-only",children:"Authentication"}),e.jsx(O,{className:"sr-only",children:"Sign in or create an account to follow users."}),e.jsx(K,{onSuccess:()=>m(!1),showRedirectScreen:!1})]})})]})},Ue=[{id:"overview",label:"Overview",icon:re},{id:"bookings",label:"Bookings",icon:E},{id:"listings",label:"Listings",icon:B},{id:"saved",label:"Saved",icon:H},{id:"reviews",label:"Reviews",icon:A},{id:"rewards",label:"Rewards",icon:ae}],ns=[{id:"overview",label:"Overview",icon:re},{id:"listings",label:"Listings",icon:B},{id:"reviews",label:"Reviews",icon:A}],is=[{id:"bookings",label:"Bookings",icon:E},{id:"listings",label:"Listings",icon:B},{id:"rating",label:"Rating",icon:A}],os={overview:"Overview",bookings:"Bookings",listings:"Listings",saved:"Saved",reviews:"Reviews",rewards:"Rewards"},cs=[{id:"create-listing",label:"Create listing",icon:Le,kind:"route",value:"/host"},{id:"bookings",label:"View bookings",icon:E,kind:"tab",value:"bookings"},{id:"saved",label:"Saved",icon:H,kind:"tab",value:"saved"},{id:"settings",label:"Settings",icon:se,kind:"route",value:"/account-settings"}],ds=[{id:"bookings",label:"Bookings",icon:E},{id:"listings",label:"Listings",icon:B},{id:"rating",label:"Rating",icon:A},{id:"rewards",label:"Rewards",icon:ae}];function Oe({displayName:s,photoURL:t,memberSince:a,about:x,location:o,followersCount:h,followingCount:d,badges:m={},onEdit:u,onShare:n,onSettings:i,isOwnProfile:c,publicId:l,className:r,targetPublicId:p,onFollowingDelta:y,followingListHidden:S=!1}){const[v,L]=f.useState(null),g=m.email||m.phone||m.host,b=c||!S,j=(t==null?void 0:t.trim())||Z;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:z("relative flex flex-col",r),children:[c&&e.jsx(C,{variant:"ghost",size:"icon",className:"absolute right-2 top-2 h-8 w-8 rounded-full text-muted-foreground",onClick:i,"aria-label":"Settings",children:e.jsx(se,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx("div",{className:"relative flex h-24 w-24 shrink-0 overflow-hidden rounded-full border-2 border-muted",children:e.jsx(X,{originalSrc:j,variant:"medium",alt:s,className:"aspect-square h-full w-full object-cover"})}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h2",{className:"text-2xl font-semibold leading-tight text-foreground",children:s}),o&&e.jsx("p",{className:"text-muted-foreground mt-0.5 flex items-center justify-center gap-1 text-sm",children:o}),a&&e.jsxs("p",{className:"text-muted-foreground mt-1 text-sm",children:["Member since ",a]}),(x==null?void 0:x.trim())&&e.jsx("p",{className:"text-foreground/90 mt-2 pt-2 border-t border-border text-sm leading-relaxed max-w-[280px] mx-auto font-normal",children:x.trim()})]})]}),g&&e.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[m.email&&e.jsx(_,{variant:"secondary",className:"rounded-full border border-border bg-muted/30 px-3 py-1 text-xs font-normal",children:"Email verified"}),m.phone&&e.jsx(_,{variant:"secondary",className:"rounded-full border border-border bg-muted/30 px-3 py-1 text-xs font-normal",children:"Phone verified"}),m.host&&e.jsx(_,{variant:"secondary",className:"rounded-full border border-border bg-muted/30 px-3 py-1 text-xs font-normal",children:"Host verified"})]}),e.jsxs("div",{className:"mt-5 grid grid-cols-2 gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{b&&l&&L("followers")},className:z("rounded-full border border-border bg-muted/20 px-3 py-2.5 text-center transition-colors",b&&l&&"hover:bg-muted/50"),children:[e.jsx("p",{className:"text-lg font-semibold leading-none text-foreground",children:h}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Followers"})]}),e.jsxs("button",{type:"button",onClick:()=>{b&&l&&L("following")},className:z("rounded-full border border-border bg-muted/20 px-3 py-2.5 text-center transition-colors",b&&l&&"hover:bg-muted/50"),children:[e.jsx("p",{className:"text-lg font-semibold leading-none text-foreground",children:d}),e.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Following"})]})]}),c&&e.jsxs("div",{className:"mt-5 grid grid-cols-1 gap-2 md:grid-cols-2 lg:grid-cols-1",children:[e.jsxs(C,{onClick:u,className:"min-w-0 w-full rounded-full",size:"sm",children:[e.jsx(Fe,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:"Edit Profile"})]}),e.jsxs(C,{variant:"outline",size:"sm",className:"min-w-0 w-full rounded-full border-border bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:n,children:[e.jsx(Y,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:"Share Profile"})]})]}),!c&&p&&e.jsxs("div",{className:"mt-5 grid grid-cols-1 gap-2 md:grid-cols-2 lg:grid-cols-1",children:[e.jsx(De,{targetUserId:p,size:"sm",onFollowingDelta:y}),e.jsxs(C,{variant:"outline",size:"sm",className:"min-w-0 w-full rounded-full border-border bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:n,children:[e.jsx(Y,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:"Share Profile"})]})]})]}),l&&e.jsx(Re,{open:v!==null,onOpenChange:w=>!w&&L(null),publicId:l,type:v==="following"?"following":"followers"})]})}function ms(s){const{stats:t,activeTab:a,onTabChange:x,navItems:o,skeleton:h,...d}=s,m=o??Ue;return e.jsx(e.Fragment,{children:e.jsx("aside",{className:z("flex h-full flex-col",s.className),children:e.jsx(ke,{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[22px] border border-border bg-card shadow-sm",children:e.jsx(Ce,{className:"relative flex min-h-0 flex-1 flex-col p-6",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center text-center",children:[e.jsx(N,{className:"h-24 w-24 rounded-full"}),e.jsx(N,{className:"mt-4 h-7 w-32"}),e.jsx(N,{className:"mt-2 h-4 w-24"}),e.jsxs("div",{className:"mt-4 flex gap-2",children:[e.jsx(N,{className:"h-9 w-16 rounded-full"}),e.jsx(N,{className:"h-9 w-16 rounded-full"})]})]}),e.jsx("div",{className:"min-h-4 max-h-8 flex-1 shrink","aria-hidden":!0}),e.jsx(Q,{className:"mt-0"}),e.jsx("nav",{className:"mt-4 flex flex-col gap-1 shrink-0",children:m.map(({id:u})=>e.jsx(N,{className:"h-9 w-full rounded-full"},u))}),e.jsx("div",{className:"min-h-0 flex-1","aria-hidden":!0})]}):e.jsxs(e.Fragment,{children:[e.jsx(Oe,{...d}),e.jsx("div",{className:"min-h-4 max-h-8 flex-1 shrink","aria-hidden":!0}),e.jsx(Q,{className:"mt-0"}),e.jsx("nav",{className:"mt-4 flex flex-col gap-1 shrink-0",children:m.map(({id:u,label:n,icon:i})=>{const c=a===u;return e.jsxs(C,{variant:"ghost",size:"sm",className:z("relative justify-start rounded-full border border-transparent py-2.5 font-normal text-muted-foreground hover:bg-gray-100 hover:text-muted-foreground",c&&"bg-rose-50/70 text-foreground hover:text-foreground"),onClick:()=>x(u),children:[c&&e.jsx("span",{className:"absolute left-0 top-1 bottom-1 w-1 rounded-full bg-[#e85c2a]","aria-hidden":!0}),e.jsx(i,{className:"h-4 w-4 opacity-70"}),n]},u)})}),e.jsx("div",{className:"min-h-0 flex-1","aria-hidden":!0})]})})})})})}export{M as F,rs as H,Ie as P,ze as S,ds as a,cs as b,ms as c,Oe as d,os as e,ls as f,is as g,ns as h,Ee as u};