1import{b_ as H,h as d,j as s,a4 as b,b as o,aG as L,u as P,r as h,L as T,o as k,B as l,Q as M,ca as A,W as j,c7 as E,V as I,aH as K,e as C,f as S,at as U,q as B,N as Q,O as V,a as Z}from"./index-N0wys5lg.js";import{D as z,S as G}from"./SlotBookingModal-Dda-XOU2.js";import{C as W}from"./calendar-clock-DTG6_67E.js";import{a as Y}from"./addDays-QHu3ja8e.js";import{i as J}from"./isSameDay-BlN1sM_k.js";import{i as X}from"./isToday-Dzwa0Q-j.js";import{R as ee}from"./ReviewsSection-BZkLAvP1.js";import{F as se}from"./FollowUserButton-B1CDnjTO.js";import{Z as R}from"./zap-BVn_wFGE.js";function ae(a){return J(a,Y(H(a),1))}function O(a){return X(a)?`Today at ${b(a,"HH:mm")}`:ae(a)?`Tomorrow at ${b(a,"HH:mm")}`:b(a,"EEE d MMM 'at' HH:mm")}function re({hostEmail:a}){const{data:i=[],isLoading:y}=d({queryKey:["reader-next-slots",a],queryFn:async()=>{const c=await o.entities.AvailabilitySlot.filter({host_email:a,is_booked:!1},"start_time",100),u=Date.now();return c.map(t=>t.data||t).filter(t=>new Date(t.start_time).getTime()>u).slice(0,3)},enabled:!!a});if(y||i.length===0)return null;const w=new Date(i[0].start_time),x=i.slice(1);return s.jsxs("div",{className:"mb-3 rounded-lg border border-primary/20 bg-primary/5 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[s.jsx(W,{className:"w-4 h-4 text-primary shrink-0"}),s.jsxs("span",{children:["Next available ",s.jsx("span",{className:"font-semibold text-primary",children:O(w)})]})]}),x.length>0&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5 pl-6",children:["Also free: ",x.map(c=>O(new Date(c.start_time))).join(" · ")]})]})}function ue(){var v,_;const{slugOrId:a}=L(),i=P(),[y,w]=h.useState(!1),[x,c]=h.useState(30),[u,t]=h.useState(!1),[D,p]=h.useState("scheduled"),{data:N}=d({queryKey:["current-user"],queryFn:()=>o.auth.me()}),{data:$=[],isLoading:q}=d({queryKey:["reader-offer",a],queryFn:async()=>{const r=await o.entities.OneOnOneOffer.filter({slug:a});if(r.length)return r;try{const n=await o.entities.OneOnOneOffer.get(a);return n?[n]:[]}catch{return[]}},enabled:!!a}),e=$[0],{data:f,isLoading:F}=d({queryKey:["reader-host-profile",e==null?void 0:e.host_email],queryFn:async()=>(await o.entities.HostProfile.filter({host_email:e.host_email}))[0]||null,enabled:!!(e!=null&&e.host_email)}),{data:m=[]}=d({queryKey:["reader-reviews",e==null?void 0:e.host_email],queryFn:()=>o.entities.PsychicReview.filter({psychic_email:e.host_email}),enabled:!!(e!=null&&e.host_email)}),g=m.length>0?(m.reduce((r,n)=>r+(n.rating||0),0)/m.length).toFixed(1):null;return q||e&&F?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(T,{className:"w-8 h-8 animate-spin text-muted-foreground"})}):e&&(f==null?void 0:f.verification_status)!=="verified"?s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 p-6 text-center",children:[s.jsx(k,{className:"w-10 h-10 text-muted-foreground/30"}),s.jsx("p",{className:"text-muted-foreground",children:"This reader is not yet available for bookings."}),s.jsx(l,{variant:"outline",onClick:()=>i("/readers"),children:"Back to Readers"})]}):e?s.jsxs("div",{className:"min-h-screen p-4 sm:p-6",children:[s.jsx(M,{title:e.host_name||e.title,description:[(v=e.specialties)==null?void 0:v.slice(0,4).join(", "),e.bio,e.is_available?"Available now":""].filter(Boolean).join(" · ")||"Book a private psychic reading on Crystal Heart Radio.",image:e.profile_photo,type:"profile",url:`${j()}/readers/${e.slug||e.id}`,keywords:[`${e.host_name} psychic reader`,"private psychic reading online",...e.specialties||[]],schemaId:"reader-profile",schema:[A({name:e.host_name,description:e.bio,image:e.profile_photo,url:`${j()}/readers/${e.slug||e.id}`,jobTitle:e.title||"Psychic Reader",specialties:e.specialties,ratingValue:g,reviewCount:m.length}),E({name:`Private psychic reading with ${e.host_name}`,description:e.bio,url:`${j()}/readers/${e.slug||e.id}`,price:e.rate_per_minute_gbp,unit:"per minute",provider:e.host_name}),I([{name:"Home",path:"/"},{name:"Readers",path:"/readers"},{name:e.host_name,path:`/readers/${e.slug||e.id}`}])]}),s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsxs(l,{variant:"ghost",className:"mb-4 -ml-3",onClick:()=>i(-1),children:[s.jsx(K,{className:"w-4 h-4 mr-2"})," Back"]}),s.jsxs(C,{className:"bg-card border-border overflow-hidden mb-6",children:[s.jsx("div",{className:"h-24 bg-gradient-to-r from-primary/10 to-accent/10"}),s.jsxs(S,{className:"pt-0",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-end gap-4 -mt-10 mb-4",children:[s.jsx("div",{className:"w-20 h-20 rounded-lg border-4 border-card overflow-hidden shrink-0 bg-primary/20 flex items-center justify-center",children:e.profile_photo?s.jsx("img",{src:e.profile_photo,alt:e.host_name,className:"w-full h-full object-cover"}):s.jsx(k,{className:"w-8 h-8 text-primary"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("h1",{className:"font-heading text-2xl sm:text-3xl font-bold text-foreground",children:e.host_name}),s.jsxs("div",{className:"flex items-center gap-3 flex-wrap mt-1",children:[g&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(U,{className:"w-4 h-4 fill-primary text-primary"}),s.jsx("span",{className:"text-sm font-semibold",children:g}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",m.length," reviews)"]})]}),s.jsx(B,{className:e.is_in_session?"bg-yellow-500/20 text-yellow-400 border-yellow-500/30":e.is_available?"bg-green-500/20 text-green-400 border-green-500/30":"bg-secondary text-muted-foreground border-border",children:e.is_in_session?"ð¡ In a reading":e.is_available?"ð¢ Available":"â« Offline"})]})]}),s.jsx(se,{targetEmail:e.host_email,targetName:e.host_name})]}
1),e.bio&&s.jsx("p",{className:"text-foreground/80 text-sm mb-3",children:e.bio}),((_=e.specialties)==null?void 0:_.length)>0&&s.jsx("div",{className:"flex flex-wrap gap-2",children:e.specialties.map((r,n)=>s.jsx(B,{variant:"outline",className:"capitalize text-xs",children:r},n))})]})]}),s.jsxs(C,{className:"bg-card border-border mb-6",children:[s.jsx(Q,{children:s.jsxs(V,{className:"font-heading text-base flex items-center gap-2",children:[s.jsx(R,{className:"w-4 h-4 text-primary"})," Book a Reading"]})}),s.jsxs(S,{children:[s.jsxs("div",{className:"flex items-center gap-4 mb-4 text-sm text-muted-foreground",children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Z,{className:"w-4 h-4"})," Per-minute billing"]}),s.jsxs("span",{className:"text-primary font-semibold text-base",children:["£",e.rate_per_minute_gbp,"/min"]})]}),s.jsx("div",{className:"flex gap-2 mb-3 flex-wrap",children:[15,30,45,60].map(r=>s.jsxs("button",{onClick:()=>c(r),className:`px-3 py-1.5 rounded-full text-sm border transition-colors ${x===r?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:border-primary/50"}`,children:[r," min â £",e.rate_per_minute_gbp?(e.rate_per_minute_gbp*r).toFixed(2):"?"]},r))}),e.is_available&&!e.is_in_session?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm text-green-400",children:[s.jsx("span",{className:"w-2 h-2 rounded-full bg-green-400 animate-pulse"}),"Available now â start your reading instantly"]}),s.jsxs(l,{className:"w-full glow-purple mb-2",onClick:()=>{p("instant"),t(!0)},children:[s.jsx(R,{className:"w-4 h-4 mr-2"})," Start Instant Reading"]}),s.jsx(l,{variant:"outline",className:"w-full",onClick:()=>{p("scheduled"),t(!0)},children:"Book for Later"})]}):s.jsxs(s.Fragment,{children:[e.is_in_session&&s.jsx("p",{className:"text-xs text-yellow-400/90 mb-2",children:"This reader is currently in a live reading. You can still book â your session will be scheduled and confirmed."}),s.jsx(re,{hostEmail:e.host_email}),s.jsx(l,{className:"w-full glow-purple",onClick:()=>{p("scheduled"),t(!0)},children:"Book for Later"})]})]})]}),s.jsxs("div",{children:[s.jsx("h2",{className:"font-heading text-xl font-bold text-foreground mb-3",children:"Client Reviews"}),s.jsx(ee,{psychicEmail:e.host_email})]})]}),D==="instant"?s.jsx(z,{isOpen:u,onClose:()=>t(!1),reader:e,currentUser:N,mode:"instant"}):s.jsx(G,{isOpen:u,onClose:()=>t(!1),reader:e,currentUser:N})]}):s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4",children:[s.jsx("p",{className:"text-muted-foreground",children:"Reader not found."}),s.jsx(l,{variant:"outline",onClick:()=>i("/readers"),children:"Back to Readers"})]})}export{ue 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.