1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BGFlaWMN.js","assets/index-C0-ZLgEZ.css"])))=>i.map(i=>d[i]); 2import{a as Fe,r as c,w as G,x as A,aJ as Ue,j as e,N as te,H as lt,U as ae,aB as it,aK as ze,am as ct,at as Ne,O as H,aL as ge,al as X,aa as Y,ac as Z,ad as K,q as U,ae as Q,aM as Ve,K as qe,ab as _e,af as dt,aN as ke,p as z,E as Je,s as J,aO as ye,aP as Ce,aQ as mt,aR as xt,aS as ee,a8 as le,az as ve,aT as pt,aU as ht,ai as We,aV as ut,aW as ft,aX as bt,P as gt,T as jt,aY as wt,V as yt,aZ as vt,v as ce,a_ as Nt,a$ as _t,b0 as kt,b1 as Ct,b2 as se,l as St,b3 as B,b4 as He,G as It,u as de,aG as Xe,b5 as Et,C as Ae,b6 as Tt,b7 as Se,b8 as Ye,b9 as Rt,ba as Ze,bb as $t,bc as At,bd as Dt,be as Lt,bf as Pt,bg as Gt,bh as Bt,bi as Mt,bj as Ot,bk as Ft,bl as Ut,Z as zt,bm as Vt,bn as De,i as qt,au as Jt,ah as Wt,bo as Ht,bp as Xt,bq as Yt,br as Ke,bs as Qe,bt as et,a9 as tt,bu as Zt,bv as Kt,bw as Qt,bx as es,by as ts,bz as ss,bA as as,bB as rs,bC as ns,bD as os,J as ls,bE as is,bF as cs,bG as ds,bH as ms,bI as xs,y as ps}from"./index-BGFlaWMN.js";import{P as hs,a as us,b as fs,c as bs,u as gs}from"./useSubscriptionLimits-_1gbJ64g.js";import{g as Le}from"./sessionUtils-CtkvT435.js";import{L as js}from"./languages-zNEOoZdq.js";/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const ws=Fe("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/** 8 * @license lucide-react v0.462.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const ys=Fe("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]),vs=t=>{const[a,n]=c.useState(null),[i,l]=c.useState({featured:null,others:[]}),[f,p]=c.useState([]),[s,g]=c.useState([]),[j,u]=c.useState([]),[o,k]=c.useState([]),[b,N]=c.useState(!0),[h,y]=c.useState(!0),[S,C]=c.useState(!1),_=Ue,d=m=>{let x=0,I=0;for(let E=0;E<localStorage.length;E++){const T=localStorage.key(E);if(T&&T.startsWith(`reaction_${m}_`)){const r=localStorage.getItem(T);r==="like"&&x++,r==="dislike"&&I++}}return{likes:x,dislikes:I}};return c.useEffect(()=>{if(N(!0),y(!0),n(null),l({featured:null,others:[]}),p([]),g([]),u([]),k([]),C(!1),!t){G.warn("No identifier provided for guide details"),N(!1);return}(async()=>{var x,I,E;try{G.info("Fetching guide details",{identifier:t});let T=A.from("guide_profiles_public").select("*");/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?T=T.eq("id",t):T=T.eq("slug",t);const{data:v,error:w}=await T.maybeSingle();if(w)throw G.error("Guide query error",{identifier:t,error:w}),w;if(!v){G.warn("Guide not found",{identifier:t}),n(null),N(!1);return}G.info("Guide found successfully",{guideId:v.id,companyName:v.company_name,slug:v.slug});const R=A.from("reviews_public").select(` 13 id, guide_id, client_id, location_id, title, content, rating, status, verified, 14 is_anonymous, is_featured, is_incentivized, trip_date, guide_reply, guide_reply_date, 15 likes_count, dislikes_count, created_at, updated_at, submitter_country, 16 custom_location_text, has_pending_edit_suggestion, expedition_package_id, 17 expedition_package:guide_expedition_packages!reviews_expedition_package_id_fkey(id, package_name) 18 `).eq("guide_id",v.id).eq("status","approved").order("created_at",{ascending:!1}),[D,L,F,P,M]=await Promise.all([A.from("guide_images").select("image_url").eq("guide_id",v.id).eq("is_hero",!0).eq("is_logo",!1).maybeSingle(),A.from("guide_images").select("*").eq("guide_id",v.id).order("display_order"),A.from("guide_locations").select("*, location:locations(*)").eq("guide_id",v.id),A.from("guide_certifications").select("*").eq("guide_id",v.id).eq("verified",!0).order("sort_order",{ascending:!0}),A.rpc("guide_has_pending_reviews",{p_guide_id:v.id})]);C(M.data===!0);const ne={...v,has_verified_badge:v.has_verified_badge&&v.subscription_tier!=="basic",team_photo_url:((x=D.data)==null?void 0:x.image_url)||null};n(ne),L.error?G.error("Images query error",L.error):g(L.data||[]),F.error?G.error("Locations query error",F.error):u(F.data||[]),P.error?G.error("Certifications query error",P.error):k(P.data||[]),N(!1);const xe=await R;if(xe.error){G.error("Reviews query error",xe.error),y(!1);return}const at=(xe.data||[]).map(async $=>{const{likes:V,dislikes:q}=d($.id),ue=($.likes_count||0)+V,fe=($.dislikes_count||0)+q;let O=null;if(!$.is_anonymous){const{data:be,error:ot}=await A.rpc("get_reviewer_info_for_approved_review",{review_id:$.id});!ot&&be&&be.length>0&&(O=be[0])}return{...$,likes_count:ue,dislikes_count:fe,client:O?{first_name:O.first_name,last_name:O.last_name}:null}}),pe=await Promise.all(at),he=pe.map($=>
18$.id),Ee=[...new Set(pe.map($=>$.location_id).filter(Boolean))];let Te=[],Re=[],$e=[];if(he.length>0){const[$,V,q]=await Promise.all([A.from("review_categories").select("*").in("review_id",he),A.from("review_images").select("id, review_id, image_url, caption, display_order").in("review_id",he),Ee.length>0?A.from("locations").select("id, name, country, slug").in("id",Ee):Promise.resolve({data:[],error:null})]);$.error||(Te=$.data||[]),V.error||(Re=V.data||[]),q.error||($e=q.data||[])}const oe=pe.map($=>{const V=Te.find(O=>O.review_id===$.id),q=_(V),ue=Re.filter(O=>O.review_id===$.id),fe=$e.find(O=>O.id===$.location_id)||null;return{...$,review_categories:q,review_images:ue,location:fe}}),rt=oe.find($=>$.is_featured)||null,nt=oe.filter($=>!$.is_featured);l({featured:rt,others:nt}),p(oe),y(!1),G.info("Guide details fetched successfully",{guideId:v.id,reviewCount:oe.length,imageCount:((I=L.data)==null?void 0:I.length)||0,certificationCount:((E=P.data)==null?void 0:E.length)||0})}catch(T){G.error("Error fetching guide details",{identifier:t,error:T}),n(null)}finally{N(!1),y(!1)}})()},[t]),{guide:a,reviews:i,allReviews:f,images:s,locations:j,certifications:o,loading:b,reviewsLoading:h,hasPendingReviews:S}},je=()=>e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(te,{}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})})]}),Ns=({identifier:t})=>e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(te,{}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Guide not found"}),e.jsxs("p",{className:"text-gray-600 mt-2",children:['The guide "',t,`" you're looking for doesn't exist or may have been removed.`]}),e.jsxs("div",{className:"mt-4 p-4 bg-gray-100 rounded-lg text-left text-sm max-w-md mx-auto",children:[e.jsx("p",{children:e.jsx("strong",{children:"Debug Info:"})}),e.jsxs("p",{children:["Searched for: ",t]}),e.jsxs("p",{children:["Search type: ",t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t)?"UUID":"Slug"]}),e.jsx("p",{children:"Please check the console for more detailed logs."})]})]})})]}),_s=()=>e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(te,{}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Something went wrong"}),e.jsx("p",{className:"text-gray-600 mt-2",children:"Please try refreshing the page"})]})})]}),ks=({guide:t,trustIndex:a,totalReviews:n,logoUrl:i,reviews:l})=>{const f="https://www.expedreview.com",p=t.slug?`${f}/guide/${t.slug}`:`${f}/guide/id/${t.id}`,s=t.description||`Professional mountain guide services by ${t.company_name}. Read verified reviews and see their ExpedReview Trust Index.`,g={"@context":"https://schema.org","@type":"LocalBusiness",name:t.company_name,description:s,url:p};if(i&&(g.image=i),t.website&&(g.sameAs=t.website),t.phone&&(g.telephone=t.phone),t.base_country&&(g.address={"@type":"PostalAddress",addressCountry:t.base_country}),n>0&&a>0)g.aggregateRating={"@type":"AggregateRating",ratingValue:a.toFixed(1),bestRating:"5",worstRating:"1",ratingCount:n,reviewCount:n};else if(l&&l.length>0){const u=l.filter(o=>typeof o.rating=="number"&&o.rating>0);if(u.length>0){const o=u.reduce((k,b)=>k+(b.rating||0),0)/u.length;g.aggregateRating={"@type":"AggregateRating",ratingValue:o.toFixed(1),bestRating:"5",worstRating:"1",ratingCount:u.length,reviewCount:u.length}}}if(l&&l.length>0&&g.aggregateRating){const u=l.filter(o=>o.rating&&o.content).slice(0,5).map(o=>({"@type":"Review",author:{"@type":"Person",name:o.is_anonymous||!o.reviewer_name?"Verified Climber":o.reviewer_name},datePublished:o.created_at?new Date(o.created_at).toISOString().split("T")[0]:void 0,reviewRating:{"@type":"Rating",ratingValue:String(o.rating),bestRating:"5",worstRating:"1"},reviewBody:o.content.slice(0,300)}));u.length>0&&(g.review=u)}const j=i||`${f}/og-image.png`;return e.jsxs(lt,{children:[e.jsxs("title",{children:[t.company_name," | ExpedReview - Verified Guide Reviews"]}),e.jsx("meta",{name:"description",content:s.slice(0,160)}),e.jsx("link",{rel:"canonical",href:p}),e.jsx("meta",{property:"og:type",content:"business.business"}),e.jsx("meta",{property:"og:title",content:n>0?`${t.company_name} - ERTI ${a.toFixed(1)} | ExpedReview`:`${t.company_name} | ExpedReview`}),e.jsx("meta",{property:"og:description",content:s.slice(0,160)}),e.jsx("meta",{property:"og:url",content:p}),e.jsx("meta",{property:"og:image",content:j}),e.jsx("meta",{property:"og:site_name",content:"ExpedReview"}),e.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),e.jsx("meta",{name:"twitter:title",content:`${t.company_name} | ExpedReview`}),e.jsx("meta",{name:"twitter:description",content:s.slice(0,160)}),e.jsx("meta",{name:"twitter:image",content:j}),e.jsx("script",{type:"application/ld+json",children:JSON.stringify(g)})]})},Pe="own-profile-upgrade-banner-dismissed",Cs=({guideId:t,viewerGuideId:a,viewerTier:n})=>{const i=ae(),[l,f]=c.useState(()=>sessionStorage.getItem(Pe)==="1");if(it()||l||!a||a!==t||n!=="basic")return null;const p=()=>{f(!0),sessionStorage.setItem(Pe,"1")};return e.jsx("div",{className:"bg-pro-soft border-b border-pro-border",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-2.5 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[e.jsx(ze,{className:"h-4 w-4 text-pro mt-0.5 flex-shrink-0"}),e.jsxs("p",{className:"text-sm text-pro-foreground",children:[e.jsx("span",{className:"font-medium",children:"This is how clients see your Basic profile."})," ",e.jsxs("span",{className:"text-ink-muted",children:["Go Pro for full color, gallery, verified badge & more â ",hs,", ",us.toLowerCase(),"."]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsxs("button",{onClick:()=>i(fs),className:"text-sm font-semibold text-pro-foreground hover:text-pro flex items-center gap-1 transition-colors whitespace-nowrap",children:[bs," ",e.jsx(ct,{className:"h-3.5 w-3.5"})]}
18),e.jsx("button",{onClick:p,className:"text-pro-foreground/50 hover:text-pro-foreground transition-colors","aria-label":"Dismiss",children:e.jsx(Ne,{className:"h-4 w-4"})})]})]})})},Ss=({guide:t,images:a,certifications:n=[],trustIndex:i,totalReviews:l,verifiedCount:f,locationsCount:p,hasVerifiedBadge:s,tier:g="pro",isOwner:j=!1})=>{const u=g==="basic",o=a==null?void 0:a.find(x=>x.is_logo),k=u?null:(a==null?void 0:a.find(x=>x.is_hero))||(a==null?void 0:a.find(x=>x.is_featured_in_gallery))||(a==null?void 0:a.find(x=>!x.is_logo)),b=(n||[]).filter(x=>x.verified&&x.proof_status==="approved"),N=(x,I)=>(x.sort_order??999)-(I.sort_order??999)||new Date(x.created_at||0).getTime()-new Date(I.created_at||0).getTime(),h=b.filter(x=>x.is_featured).sort(N),y=b.filter(x=>!x.is_featured).sort(N),S=[...h,...y].slice(0,3),{score:C,isBaseline:_}=Ce(i,l),d=_?"Baseline":mt(C),m=xt(C);return e.jsx("section",{className:"relative w-full bg-brand-darker text-white overflow-hidden",children:e.jsxs("div",{className:u?"relative w-full min-h-[200px] sm:min-h-[220px]":"relative w-full aspect-[4/5] sm:aspect-[21/9] lg:aspect-[16/6] min-h-[420px]",children:[k?e.jsx(H,{src:k.image_url,size:"large",alt:`${t==null?void 0:t.company_name} hero`,className:"absolute inset-0 w-full h-full object-cover"}):e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-brand-dark to-brand-darker"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-stone-950 via-stone-950/40 to-stone-950/10"}),!k&&j&&!u&&e.jsx("div",{"data-owner-empty-hero":!0,className:"absolute inset-0 z-10 flex items-center justify-center px-5 pointer-events-none",children:e.jsxs("div",{className:"pointer-events-auto max-w-md w-full text-center rounded-2xl border-2 border-dashed border-white/30 bg-white/10 backdrop-blur-sm px-6 py-6 sm:py-8 shadow-xl",children:[e.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-white/15 flex items-center justify-center",children:e.jsx(ge,{className:"h-6 w-6 text-white"})}),e.jsx("h2",{className:"text-lg sm:text-xl font-display font-bold text-white leading-tight",children:"Bring your profile to life"}),e.jsx("p",{className:"text-[13px] sm:text-sm text-white/80 mt-1.5 leading-relaxed",children:"Add photos of your team, past expeditions, and landscapes. Profiles with gallery photos convert far better."}),e.jsxs("div",{className:"mt-4 flex flex-col sm:flex-row items-center justify-center gap-2",children:[e.jsxs(X,{to:"/guide-profile?tab=images",className:"inline-flex items-center gap-1.5 rounded-full bg-white text-stone-900 px-4 py-2 text-sm font-semibold shadow hover:bg-white/90 transition",children:[e.jsx(ge,{className:"h-4 w-4"}),"Add photos"]}),e.jsx(X,{to:"/resources/complete-guide-setup-walkthrough",className:"text-[12px] font-semibold uppercase tracking-widest text-white/70 hover:text-white transition",children:"Why this matters"})]}),e.jsx("p",{className:"text-[10px] uppercase tracking-widest text-white/50 mt-3",children:"Only you can see this prompt"})]})}),!k&&j&&u&&e.jsx("div",{className:"absolute top-2 right-2 z-10",children:e.jsxs(X,{to:"/guide-profile?tab=images","data-owner-empty-hero":!0,className:"inline-flex items-center gap-1.5 rounded-full bg-white/95 text-stone-900 px-3 py-1.5 text-[11px] font-bold uppercase tracking-widest shadow hover:bg-white transition",children:[e.jsx(ge,{className:"h-3.5 w-3.5"}),"Add photos"]})}),e.jsx("div",{className:u?"relative px-5 sm:px-8 lg:px-12 pt-8 sm:pt-10 pb-6 sm:pb-8":"absolute inset-x-0 bottom-0 px-5 sm:px-8 lg:px-12 pb-6 sm:pb-10 pt-24",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-4",children:[e.jsx(Y,{children:e.jsxs(Z,{children:[e.jsx(K,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center gap-1.5 bg-white/95 text-stone-900 rounded-full pl-2 pr-3 py-1 shadow-sm cursor-help focus:outline-none focus-visible:ring-2 focus-visible:ring-white/60",children:_?e.jsx("span",{className:"text-sm font-bold tracking-tight text-stone-600",children:"Unrated"}):e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"h-3.5 w-3.5 fill-amber-400 text-amber-400"}),e.jsx("span",{className:"text-sm font-bold tracking-tight",children:C.toFixed(1)}),e.jsx("span",{className:"text-[11px] text-stone-500 font-medium",children:"/ 5"}),e.jsx("span",{className:`text-[10px] font-bold uppercase tracking-widest ml-1 ${m}`,children:d})]})})}),e.jsx(Q,{className:"p-0",children:e.jsx(Ve,{currentScore:C,isBaseline:_})})]})}),f>0?e.jsxs("div",{className:"inline-flex items-center gap-1 bg-emerald-500/90 rounded-full px-2.5 py-1 text-[11px] font-bold uppercase tracking-widest text-white",children:[e.jsx(qe,{className:"h-3 w-3"}),f," verified review",f!==1?"s":""]}):l>0?e.jsxs("div",{className:"inline-flex items-center gap-1.5 bg-white/15 backdrop-blur-md rounded-full px-2.5 py-1 text-[11px] font-semibold uppercase tracking-widest text-white/90",children:[l," review",l!==1?"s":""]}):null]}),e.jsxs("div",{className:"flex items-end gap-3 sm:gap-4 mb-3",children:[o&&e.jsx(_e,{src:o.image_url,alt:`${t==null?void 0:t.company_name} logo`,containerClassName:`h-14 sm:h-16 aspect-[4/3] rounded-2xl bg-white border border-white/30 shadow-lg flex-shrink-0 ${u?"grayscale":""}`,className:u?"grayscale":""}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{translate:"no",className:`notranslate font-display font-bold leading-[1.05] tracking-tight ${u?"text-2xl sm:text-4xl lg:text-5xl":"text-3xl sm:text-5xl lg:text-6xl"}`,children:(t==null?void 0:t.company_name)||"Adventure Guide"}),u&&e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-white/60 mt-2",children:"Basic listing"})]}),!u&&s&&e.jsx("div",{className:"hidden sm:block pb-2",children:e.jsx(dt,{size:"lg"})})]}),(t==null?void 0:t.tagline)&&e.jsx("p",{className:"text-sm sm:text-base text-white/85 max-w-2xl leading-relaxed mb-4 line-clamp-2",children:t.tagline}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-2 text-[12px] sm:text-sm text-white/80",children:[(t==null?void 0:t.years_experience)>0&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(ke,{className:"h-3.5 w-3.5 opacity-80"}),e.jsx("span",{className:"font-semibold text-white",children:t.years_experience})," yrs experience"]}),(t==null?void 0:t.base_country)&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(z,{className:"h-3.5 w-3.5 opacity-80"}),"Based in ",e.jsx("span",{className:"font-semibold text-white",children:t.base_country})]}),(t==null?void 0:t.operation_scope)&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 capitalize",children:[e.jsx(Je,{className:"h-3.5 w-3.5 opacity-80"}),t.operation_scope," operator"]}),p>0&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:"font-semibold text-white",children:p})," location",p!==1?"s":""]})]}),!u&&S.length>0&&e.jsx("div",{className:"mt-4 flex flex-wrap gap-1.5",children:S.map(x=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-white/15 backdrop-blur-md border border-white/20 px-2.5 py-1 text-[11px] font-semibold text-white",title:x.issuing_organization||void 0,children:[e.jsx(J,{className:"h-3 w-3 text-emerald-300"}
18),e.jsx("span",{className:"truncate max-w-[180px]",children:ye(x.certification_type)})]},x.id))})]})})]})})},Is=({items:t})=>{var l;const[a,n]=c.useState((l=t[0])==null?void 0:l.id);c.useEffect(()=>{const f=t.map(s=>document.getElementById(s.id)).filter(s=>!!s);if(f.length===0)return;const p=new IntersectionObserver(s=>{const g=s.filter(j=>j.isIntersecting).sort((j,u)=>j.boundingClientRect.top-u.boundingClientRect.top);g[0]&&n(g[0].target.id)},{rootMargin:"-30% 0px -60% 0px",threshold:0});return f.forEach(s=>p.observe(s)),()=>p.disconnect()},[t]);const i=(f,p)=>{f.preventDefault();const s=document.getElementById(p);if(!s)return;const g=s.getBoundingClientRect().top+window.scrollY-56;window.scrollTo({top:g,behavior:"smooth"}),n(p)};return e.jsx("nav",{className:"sticky z-30 bg-background/90 backdrop-blur-md border-b border-border transition-[top] duration-300",style:{top:"var(--sticky-header-offset, 0px)"},children:e.jsx("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsx("div",{className:"flex gap-6 sm:gap-10 overflow-x-auto no-scrollbar py-3.5",children:t.map(f=>{const p=a===f.id;return e.jsxs("a",{href:`#${f.id}`,onClick:s=>i(s,f.id),className:ee("relative whitespace-nowrap text-[11px] sm:text-xs font-bold uppercase tracking-[0.14em] pb-1 transition-colors",p?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[f.label,e.jsx("span",{className:ee("absolute -bottom-[14px] left-0 right-0 h-[2px] bg-foreground transition-opacity",p?"opacity-100":"opacity-0")})]},f.id)})})})})},Es=({reviewId:t,initialLikes:a=0,initialDislikes:n=0})=>{const[i,l]=c.useState(a),[f,p]=c.useState(n),[s,g]=c.useState(null),[j,u]=c.useState(!1),[o,k]=c.useState(null);c.useEffect(()=>{(async()=>{const{data:{user:y}}=await A.auth.getUser();k(y)})()},[]),c.useEffect(()=>{b()},[t,o]);const b=async()=>{try{const h=o?null:Le(),y=(o==null?void 0:o.id)||null,S=`reaction_${t}_${y||h}`,C=localStorage.getItem(S);C&&g(C)}catch(h){console.error("Error fetching user reaction:",h)}},N=async h=>{if(!j){u(!0);try{const y=o?null:Le(),S=(o==null?void 0:o.id)||null,C=`reaction_${t}_${S||y}`;if(s)if(s===h){localStorage.removeItem(C),g(null),h==="like"?l(_=>Math.max(0,_-1)):p(_=>Math.max(0,_-1)),le.success("Reaction removed");return}else{localStorage.setItem(C,h),s==="like"&&h==="dislike"?(l(_=>Math.max(0,_-1)),p(_=>_+1)):s==="dislike"&&h==="like"&&(p(_=>Math.max(0,_-1)),l(_=>_+1)),g(h),le.success(`Changed to ${h}`);return}localStorage.setItem(C,h),g(h),h==="like"?l(_=>_+1):p(_=>_+1),le.success(`${h==="like"?"Liked":"Disliked"} review`)}catch(y){console.error("Error handling reaction:",y),le.error("Failed to process reaction")}finally{u(!1)}}};return e.jsxs("div",{className:"flex items-center gap-4 pt-2 border-t border-gray-100",children:[e.jsx("div",{className:"flex items-center gap-1",children:e.jsxs("button",{onClick:()=>N("like"),disabled:j,className:`flex items-center gap-1 px-3 py-1.5 rounded-full text-sm transition-all duration-200 ${s==="like"?"bg-green-100 text-green-700 border border-green-200":"bg-gray-50 text-gray-600 hover:bg-green-50 hover:text-green-600 border border-gray-200"} ${j?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[e.jsx(ys,{className:`h-4 w-4 ${s==="like"?"fill-current":""}`}),e.jsx("span",{className:"font-medium",children:i})]})}),e.jsx("div",{className:"flex items-center gap-1",children:e.jsxs("button",{onClick:()=>N("dislike"),disabled:j,className:`flex items-center gap-1 px-3 py-1.5 rounded-full text-sm transition-all duration-200 ${s==="dislike"?"bg-red-100 text-red-700 border border-red-200":"bg-gray-50 text-gray-600 hover:bg-red-50 hover:text-red-600 border border-gray-200"} ${j?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[e.jsx(ws,{className:`h-4 w-4 ${s==="dislike"?"fill-current":""}`}),e.jsx("span",{className:"font-medium",children:f})]})}),e.jsx("div",{className:"text-xs text-gray-500 ml-auto",children:"Was this review helpful?"})]})},Ts=()=>{const[t,a]=ve.useState(!1);return e.jsx(pt,{open:t,onOpenChange:a,children:e.jsxs("div",{className:"border border-border rounded-lg bg-muted/40",children:[e.jsx(ht,{asChild:!0,children:e.jsxs("button",{className:"flex items-center justify-between w-full px-4 py-3 text-left hover:bg-muted/60 transition-colors rounded-lg",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(qe,{className:"h-4 w-4 text-green-600 flex-shrink-0"}),e.jsx("span",{className:"text-sm font-semibold text-foreground",children:"Every review is manually checked by our team"})]}),e.jsx(We,{className:`h-4 w-4 text-muted-foreground transition-transform duration-200 ${t?"rotate-180":""}`})]})}),e.jsx(ut,{children:e.jsxs("div",{className:"px-4 pb-4 pt-1 space-y-3 text-sm text-muted-foreground",children:[e.jsxs("p",{children:["Our team personally reviews every submission for authenticity â no automated bots or algorithms. Reviews are labeled ",e.jsx("span",{className:"font-medium text-green-700",children:'"Verified"'})," when we can confirm the expedition took place."]}),e.jsxs("p",{children:["Suspicious or fake reviews are blocked. If you believe a review is fraudulent, you can flag it and our team will investigate."," ",e.jsx(X,{to:"/about",className:"text-primary hover:underline font-medium",children:"Learn more about our review process â"})]})]})})]})})},Rs=({featuredReview:t,otherReviews:a,renderStars:n,trustIndex:i,hasPendingReviews:l=!1,defaultSortOrder:f})=>{const[p,s]=c.useState("newest"),[g,j]=c.useState("all"),[u,o]=c.useState("all"),[k,b]=c.useState(!1),[N,h]=c.useState(new Set),[y,S]=c.useState(!1),C=r=>h(v=>{const w=new Set(v);return w.has(r)?w.delete(r):w.add(r),w});c.useEffect(()=>{f!==void 0&&!k&&(s(f),b(!0))},[f,k]);const _=c.useMemo(()=>{const r=t?[t,...a]:a,v=new Set;return r.forEach(w=>{var R;(R=w.location)!=null&&R.name&&v.add(w.location.name)}),Array.from(v).sort()},[t,a]),d=c.useMemo(()=>{const r=t?[t,...a]:a,v=new Map;return r.forEach(w=>{var R,D;(R=w.expedition_package)!=null&&R.id&&((D=w.expedition_package)!=null&&D.package_name)&&v.set(w.expedition_package.id,w.expedition_package.package_name)}),Array.from(v.entries()).map(([w,R])=>({id:w,name:R})).sort((w,R)=>w.name.localeCompare(R.name))},[t,a]),m=c.useMemo(()=>{let r=[...a];switch(g!=="all"&&(r=r.filter(v=>{var w;return((w=v.location)==null?void 0:w.name)===g})),u!=="all"&&(r=r.filter(v=>{var w;return((w=v.expedition_package)==null?void 0:w.id)===u})),p){case"newest":r.sort((v,w)=>new Date(w.created_at).getTime()-new Date(v.created_at).getTime());break;case"oldest":r.sort((v,w)=>new Date(v.created_at).getTime()-new Date(w.created_at).getTime());break;case"rating-high":r.sort((v,w)=>(w.rating||0)-(v.rating||0));break;case"rating-low":r.sort((v,w)=>(v.rating||0)-(w.rating||0));break}return r},[a,p,g,u]),x=c.useMemo(()=>{var r,v;return!(!t||g!=="all"&&((r=t.location)==null?void 0:r.name)!==g||u!=="all"&&((v=t.expedition_package)==null?void 0:v.id)!==u)},[t,g,u]);c.useEffect(()=>{if(y||typeof window>"u"||!window.location.hash.startsWith("#review-"))return;const r=requestAnimationFrame(()=>{const v=document.getElementById(window.location.hash.slice(1));v&&(v.scrollIntoView({behavior:"smooth",block:"center"}),S(!0))});return()=>cancelAnimationFrame(r)},[t,m,y]);const I=(r,v=!1)=>v?"Verified Reviewer":r?r.first_name||r.last_name?St(r.first_name,r.last_name):r.full_name||`${r.first_name||""} ${r.last_name||""}`.trim()||"Anonymous":"Anonymous",E=(r,v=!1)=>{var L,F;const w=I(r.client||r.profiles,r.is_anonymous),R=r.status==="approved",D=r.is_anonymous;return e.jsx(gt,{id:`review-${r.id}`,className:`${v?"border-blue-200 bg-gradient-to-r from-blue-50/50 to-indigo-50/30 shadow-lg":"hover:shadow-md transition-shadow duration-200"} mb-6 overflow-hidden`,children:e.jsxs(jt,{className:"p-0",children:[v&&e.jsx("div",{className:"bg-gradient-to-r from-blue-50 to-indigo-50 border-b border-blue-100 px-6 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{className:"h-4 w-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-medium text-blue-700",children:"Featured Review"})]})}),e.jsxs("div",{className:"p-6",children:[e.jsx("div",{className:"flex items-start justify-between mb-4",children:e.jsx("div",{className:"flex items-center gap-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:`w-10 h-10 rounded-full flex items-center justify-center text-white font-semibold text-sm ${D||!((L=r.client)!=null&&L.avatar_url)?"bg-gradient-to-br from-gray-400 to-gray-500":"bg-gradient-to-br from-blue-500 to-purple-600"}`,children:D?e.jsx(wt,{className:"h-5 w-5"}):w.charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[D?e.jsx(Y,{children:e.jsxs(Z,{children:[e.jsx(K,{asChild:!0,children:e.jsxs("div",{className:"flex items-center gap-2 cursor-help",children:[e.jsx("span",{translate:"no",className:"notranslate font-semibold text-gray-900",children:w}),e.jsx("span",{className:"text-xs bg-gray-100 text-gray-600 px-2 py-1 rounded-full",children:"Anonymous"})]})}),e.jsxs(Q,{className:"max-w-xs",children:[e.jsx("p",{className:"font-medium",children:"This reviewer chose to keep their identity private."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Our team has verified this review."})]})]})}):e.jsx("span",{translate:"no",className:"notranslate font-semibold text-gray-900",children:w}),R&&r.verified&&e.jsx(Y,{children:e.jsxs(Z,{children:[e.jsx(K,{children:e.jsx(yt,{className:"h-4 w-4 text-green-500"})}),e.jsx(Q,{children:e.jsx("p",{children:"This review has been verified by ExpedReview"})})]})}),R&&!r.verified&&e.jsx(Y,{children:e.jsxs(Z,{children:[e.jsx(K,{children:e.jsx(vt,{className:"h-4 w-4 text-amber-400"})}),e.jsxs(Q,{className:"max-w-xs",children:[e.jsx("p",{className:"font-medium",children:"This review is awaiting verification"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"This rating does not affect the guide's ExpedReview Trust Index until it is verified."})]})]})})]}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n(r.rating||r.overall_rating||0),e.jsxs("span",{className:"ml-2 text-sm font-medium text-gray-700",children:[r.rating||r.overall_rating||0,"/5"]})]})]})]})})}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 sm:gap-4 mb-4 text-sm text-gray-600",children:[r.location&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(z,{className:"h-4 w-4 flex-shrink-0 text-gray-500"}),e.jsx(X,{to:`/location/${r.location.slug||r.location.id}`,className:"text-blue-600 hover:text-blue-800 hover:underline transition-colors duration-200 truncate max-w-[200px] sm:max-w-none",title:r.location.name,children:r.location.name})]}),((F=r.expedition_package)==null?void 0:F.package_name)&&e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(ce,{variant:"outline",className:"text-xs font-normal bg-primary/5 border-primary/20 text-primary",children:r.expedition_package.package_name})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ke,{className:"h-4 w-4 flex-shrink-0 text-gray-500"}),e.jsx("span",{children:new Date(r.created_at).toLocaleDateString()})]}),r.is_incentivized&&e.jsx(ce,{variant:"outline",className:"text-xs text-muted-foreground",children:"Entered in review giveaway"})]}),r.title&&e.jsx("h4",{className:"font-semibold text-lg text-foreground mb-2",children:Nt(r.title)}),e.jsx("div",{className:"mb-6",children:(()=>{const P=r.content||r.review_text||"",M=!r.is_featured&&P.length>280,ne=N.has(r.id);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:M&&!ne?"line-clamp-3":"",children:e.jsx(_t,{content:P,className:"text-muted-foreground leading-relaxed text-base"})}),M&&e.jsx("button",{type:"button",onClick:()=>C(r.id),className:"mt-2 text-sm font-medium text-[hsl(var(--brand))] hover:underline",children:ne?"Show less":"Read more"})]})})()}),(()=>{const P=r.review_categories?Array.isArray(r.review_categories)?r.review_categories:Ue(r.review_categories):[];return P.length===0?null:e.jsxs("div",{className:"mb-6",children:[e.jsxs("h4",{className:"text-sm font-semibold text-gray-900 mb-3 flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-yellow-500"}),"Category Ratings"]}),e.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:P.map(M=>e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between bg-white rounded-md p-3 shadow-sm",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 mb-1 sm:mb-0",children:kt(M.category_name)}),e.jsxs("div",{className:"flex items-center gap-1",children:[n(M.rating||0),e.jsx("span",{className:"text-sm font-semibold text-gray-900 ml-1",children:M.rating||0})]})]},M.id||M.category_name))})})]})})(),r.review_images&&r.review_images.length>0&&e.jsxs("div",{className:"mb-6",children:[e.jsx("h4",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Photos"}),e.jsx(Ct,{images:r.review_images.map(P=>P.image_url),reviewTitle:r.title||"Review"})]}),r.guide_reply&&e.jsxs("div",{className:"mb-6 bg-blue-50 border border-blue-100 rounded-lg p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(se,{className:"h-4 w-4 text-blue-600"}),e.jsx("span",{className:"text-sm font-semibold text-blue-700",children:"Guide Reply"}),r.guide_reply_date&&e.jsxs("span",{className:"text-xs text-blue-500",children:["⢠",new Date(r.guide_reply_date).toLocaleDateString()]})]}),e.jsx("p",{className:"text-sm text-blue-900 whitespace-pre-line",children:r.guide_reply})]}),e.jsx("div",{className:"flex items-center justify-between pt-4 border-t border-gray-100",children:e.jsx(ce,{variant:R?"default":"secondary",className:`text-xs font-medium ${R&&r.verified?"bg-green-100 text-green-800 border-green-200 hover:bg-green-200":R&&!r.verified?"bg-amber-100 text-amber-800 border-amber-200 hover:bg-amber-200":"bg-gray-100 text-gray-700 border-gray-200"}`,children:r.status==="approved"&&r.verified?"Verified Review":r.status==="approved"&&!r.verified?"Pending Verification":r.status==="pending"?"Pending Review":"Unverified"})}),e.jsx(Es,{reviewId:r.id,initialLikes:r.likes_count||0,initialDislikes:r.dislikes_count||0})]})]})},r.id)},T=t||a.length>0;return e.jsxs("div",{className:"space-y-6",children:[T&&e.jsxs(e.Fragment,{children:[e.jsx(Ts,{}),e.jsx(ft,{sortBy:p,onSortByChange:s,filterLocation:g,onFilterLocationChange:j,locations:_,filterPackage:u,onFilterPackageChange:o,packages:d})]}),x&&t&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-bold text-gray-900 mb-6 flex items-center gap-2",children:[e.jsx(J,{className:"h-5 w-5 text-yellow-500"}),"Featured Review"]}),E(t,!0)]}),m.length>0&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-xl font-bold text-gray-900 mb-6 flex items-center gap-2",children:[e.jsx(U,{className:"h-5 w-5 text-blue-500"}),"All Reviews (",m.length,")"]}),m.map(r=>E(r))]}),!x&&m.length===0&&T&&e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"bg-gray-50 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4",children:e.jsx(z,{className:"h-8 w-8 text-gray-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No Reviews for This Location"}),e.jsx("p",{className:"text-gray-600 text-lg",children:"Try selecting a different location or clear the filter."})]}),!T&&e.jsx("div",{className:"text-center py-16",children:i&&i>0&&!l?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-amber-50 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4",children:e.jsx(bt,{className:"h-8 w-8 text-amber-500"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"Reviews Have Been Removed"}),e.jsx("p",{className:"text-gray-600 text-lg mb-4",children:"Previous reviews for this guide have been removed by the reviewers."}),e.jsx("p",{className:"text-sm text-gray-500",children:"The Trust Index shown reflects their historical rating."})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"bg-gray-50 rounded-full w-16 h-16 flex items-center justify-center mx-auto mb-4",children:e.jsx(U,{className:"h-8 w-8 text-gray-400"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2"
18,children:"No Reviews Yet"}),e.jsx("p",{className:"text-gray-600 text-lg",children:"Be the first to leave a review for this guide!"})]})})]})},$s=t=>e.jsx("div",{className:"flex",children:Array.from({length:5},(a,n)=>e.jsx("span",{className:n<t?"text-yellow-400":"text-gray-300",children:"â
"},n))}),As=({allReviews:t,trustIndex:a,totalReviews:n,verifiedCount:i,hasPendingReviews:l=!1,defaultReviewSort:f,loading:p=!1})=>{const s=(t==null?void 0:t.find(o=>o.is_featured))||null,g=(t==null?void 0:t.filter(o=>!o.is_featured))||[],{score:j,isBaseline:u}=Ce(a,n);return e.jsx("section",{id:"reviews",className:"scroll-mt-28 py-12 sm:py-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"flex items-end justify-between mb-6 sm:mb-8 gap-4",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-[10px] uppercase tracking-[0.2em] text-muted-foreground font-bold mb-1.5",children:"ExpedReview Trust Index"}),e.jsx("h2",{className:"font-display text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Reviews"})]}),e.jsx(Y,{children:e.jsxs(Z,{children:[e.jsx(K,{asChild:!0,children:e.jsxs("button",{type:"button",className:"text-right cursor-help focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded-md",children:[e.jsx("div",{className:"font-display text-3xl sm:text-4xl font-bold leading-none text-foreground tracking-tight",children:u?e.jsx("span",{className:"text-2xl text-muted-foreground",children:"Unrated"}):e.jsxs(e.Fragment,{children:[j.toFixed(1),e.jsx("span",{className:"text-base font-medium text-muted-foreground",children:"/5"})]})}),e.jsxs("div",{className:"mt-1.5 inline-flex items-center gap-1 text-[10px] font-bold uppercase tracking-widest text-muted-foreground",children:[!u&&e.jsx(U,{className:"h-3 w-3 fill-amber-400 text-amber-400"}),u?"No reviews yet":i>0?`${i} verified review${i!==1?"s":""}`:`${n} review${n!==1?"s":""}`]})]})}),e.jsx(Q,{className:"p-0",children:e.jsx(Ve,{currentScore:j,isBaseline:u})})]})})]}),p&&((t==null?void 0:t.length)||0)===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx(B,{className:"h-32 w-full rounded-lg"}),e.jsx(B,{className:"h-32 w-full rounded-lg"}),e.jsx(B,{className:"h-32 w-full rounded-lg"})]}):e.jsx(Rs,{featuredReview:s,otherReviews:g,renderStars:$s,trustIndex:a,hasPendingReviews:l,defaultSortOrder:f})]})})},Ds=(t,a,n)=>{try{const i=window;i.clarity&&(i.clarity("set","tour_inquiry_channel",n),i.clarity("set","tour_inquiry_guide",(t==null?void 0:t.slug)||(t==null?void 0:t.company_name)||""),i.clarity("event",`tour_inquiry_${n}`))}catch{}try{He(async()=>{const{logFeaturedFunnelEvent:i}=await Promise.resolve().then(()=>Ys);return{logFeaturedFunnelEvent:i}},void 0).then(({logFeaturedFunnelEvent:i})=>{i("contact_view",t==null?void 0:t.id)})}catch{}},Ls=()=>{const{user:t,loading:a}=de(),[n,i]=c.useState(!1),[l,f]=c.useState(!1);return c.useEffect(()=>{a||(async()=>{if(!t){i(!1),f(!0);return}try{const{data:s,error:g}=await A.from("guide_profiles").select("id").eq("id",t.id).maybeSingle();if(g)throw g;i(!!s)}catch(s){console.error("Error checking guide account:",s),i(!1)}finally{f(!0)}})()},[t,a]),{isGuideAccount:n,checked:l}},Ge=()=>{let t=localStorage.getItem("visitor_id");return t||(t=crypto.randomUUID(),localStorage.setItem("visitor_id",t)),t},Be=()=>{const a=sessionStorage.getItem("analytics_session");if(a){const{id:i,lastActivity:l}=JSON.parse(a);if(Date.now()-l<18e5)return sessionStorage.setItem("analytics_session",JSON.stringify({id:i,lastActivity:Date.now()})),i}const n=crypto.randomUUID();return sessionStorage.setItem("analytics_session",JSON.stringify({id:n,lastActivity:Date.now()})),n},Ps=30*1e3,Me=new Map,me=()=>{const{isAdmin:t,loading:a}=It(),{user:n,loading:i}=de(),{isGuideAccount:l,checked:f}=Ls(),{trackEvent:p}=Xe(),s=!i&&!a&&f,g=c.useCallback(d=>t||(n==null?void 0:n.id)===d||l,[t,n==null?void 0:n.id,l]),j=c.useCallback(async(d,m,x)=>{if(!g(d))try{const I=Ge(),E=Be(),T={...x,referrer:document.referrer||null,page_url:window.location.href,user_agent:navigator.userAgent},{error:r}=await A.functions.invoke("track-analytics",{body:{guide_id:d,event_type:m,visitor_id:I,session_id:E,event_data:T}});r&&console.error("Failed to track analytics event:",r)}catch(I){console.error("Analytics tracking error:",I)}},[g]),u=c.useCallback((d,m)=>{if(g(d))return Promise.resolve();const x=Me.get(d);return x&&Date.now()-x<Ps?Promise.resolve():(Me.set(d,Date.now()),j(d,"profile_view",{source:m}))},[j,g]),o=c.useCallback((d,m,x)=>{var I,E,T;if(!g(d))try{const r=Ge(),v=Be(),w={...x,referrer:document.referrer||null,page_url:window.location.href,user_agent:navigator.userAgent}
18,R=((T=(E=(I=A.auth)==null?void 0:I.session)==null?void 0:E.call(I))==null?void 0:T.access_token)??(()=>{var D;try{const L=`sb-${new URL("https://bekkcjkhrsfqwznxidkg.supabase.co").hostname.split(".")[0]}-auth-token`,F=localStorage.getItem(L);return F?(D=JSON.parse(F))==null?void 0:D.access_token:null}catch{return null}})();fetch("https://bekkcjkhrsfqwznxidkg.supabase.co/functions/v1/track-analytics",{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJla2tjamtocnNmcXd6bnhpZGtnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTk3NTk0MjIsImV4cCI6MjA3NTMzNTQyMn0.XcRSaBFsb82Eav3CCJaQ8E6zbXnWR0k12O6Cp9ZWdJk",Authorization:`Bearer ${R||"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJla2tjamtocnNmcXd6bnhpZGtnIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTk3NTk0MjIsImV4cCI6MjA3NTMzNTQyMn0.XcRSaBFsb82Eav3CCJaQ8E6zbXnWR0k12O6Cp9ZWdJk"}`},body:JSON.stringify({guide_id:d,event_type:m,visitor_id:r,session_id:v,event_data:w})}).catch(()=>{})}catch{}},[g]),k=c.useCallback(d=>{o(d,"website_click")},[o]),b=c.useCallback((d,m)=>{o(d,"social_click",{platform:m})},[o]),N=c.useCallback((d,m)=>{o(d,"contact_click",m?{channel:m}:void 0)},[o]),h=c.useCallback((d,m,x)=>j(d,"search_impression",{search_query:m,position:x}),[j]),y=c.useCallback((d,m,x)=>j(d,"search_click",{search_query:m,position:x}),[j]),S=c.useCallback(d=>j(d,"image_view"),[j]),C=c.useCallback((d,m)=>j(d,"review_read",{review_id:m}),[j]),_=c.useCallback((d,m,x)=>g(d)?Promise.resolve():(p("contact_click_attempted",{guide_id:d,guide_name:x||"",page_location:typeof window<"u"?window.location.href:"",source:m||""}),j(d,"contact_click_attempted",m?{source:m}:void 0)),[j,p,g]);return{trackEvent:j,trackingReady:s,trackProfileView:u,trackWebsiteClick:k,trackSocialClick:b,trackContactClick:N,trackContactAttempt:_,trackSearchImpression:h,trackSearchClick:y,trackImageView:S,trackReviewRead:C}},Oe=t=>`contact_attempt_${t}`,we="basic-contact-attempt",Ie=({guide:t,source:a,isOwner:n=!1,variant:i="inline",className:l})=>{const{trackContactAttempt:f}=me(),p=(t==null?void 0:t.company_name)||"This guide",s=t==null?void 0:t.id,[g,j]=c.useState(()=>{try{return!!s&&sessionStorage.getItem(Oe(s))==="1"}catch{return!1}});c.useEffect(()=>{if(!s)return;const b=N=>{N.detail===s&&j(!0)};return window.addEventListener(we,b),()=>window.removeEventListener(we,b)},[s]);const u=b=>{if(b.stopPropagation(),b.preventDefault(),!(g||!s)){j(!0);try{sessionStorage.setItem(Oe(s),"1")}catch{}window.dispatchEvent(new CustomEvent(we,{detail:s})),f(s,a,t==null?void 0:t.company_name)}},o=i==="section",k=i==="bar";return n?k?null:e.jsxs("div",{className:`rounded-xl border border-dashed border-border bg-muted/40 ${o?"p-5 sm:p-6":"p-3"} ${l||""}`,onClick:b=>b.stopPropagation(),children:[e.jsxs("p",{className:`font-semibold text-foreground flex items-center gap-1.5 ${o?"text-sm sm:text-base":"text-xs"}`,children:[e.jsx(Et,{className:"h-4 w-4 text-muted-foreground"}),"Client contact is locked on Basic"]}),e.jsx("p",{className:`text-muted-foreground mt-1 ${o?"text-sm":"text-xs"}`,children:"Visitors can't reach you here yet. We're counting how many try."}),e.jsx("a",{href:"/guide-profile?tab=plans",onClick:b=>b.stopPropagation(),className:`mt-2 inline-flex items-center gap-1.5 font-semibold text-primary hover:underline ${o?"text-sm":"text-xs"}`,children:"Upgrade to Professional"})]}):k?e.jsx("div",{className:l,children:g?e.jsxs("p",{className:"text-xs text-muted-foreground flex items-center justify-center gap-1.5 py-2",children:[e.jsx(Ae,{className:"h-3.5 w-3.5 text-primary shrink-0"}),"Thanks â we've passed your interest on."]}):e.jsxs("button",{type:"button",onClick:u,className:"w-full inline-flex items-center justify-center gap-2 px-4 py-3 rounded-full bg-foreground text-background text-xs font-bold uppercase tracking-wider hover:opacity-90 transition-opacity",children:[e.jsx(se,{className:"h-4 w-4"}),"I wanted to contact this guide"]})}):e.jsx("div",{className:`rounded-xl border border-border bg-background ${o?"p-5 sm:p-6":"bg-muted/40 p-3"} ${l||""}`,onClick:b=>b.stopPropagation(),children:g?e.jsxs("p",{className:`text-muted-foreground flex items-start gap-1.5 ${o?"text-sm":"text-xs"}`,children:[e.jsx(Ae,{className:`text-primary mt-0.5 shrink-0 ${o?"h-4 w-4":"h-3.5 w-3.5"}`}),e.jsxs("span",{children:["Thanks â we've let ",p," know someone wanted to get in touch."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:`font-semibold text-foreground ${o?"text-sm sm:text-base":"text-xs"}`,children:[p," hasn't unlocked client contact yet"]}),e.jsx("p",{className:`text-muted-foreground mt-1 ${o?"text-sm":"text-xs"}`,children:"Let them know there's interest â we'll pass it on."}),e.jsxs("button",{type:"button",onClick:u,className:`mt-3 inline-flex items-center justify-center gap-1.5 rounded-full bg-foreground text-background font-bold uppercase tracking-wider hover:opacity-90 transition-opacity ${o?"w-full sm:w-auto px-6 py-3 text-xs":"px-3 py-1.5 text-[11px]"}`,children:[e.jsx(se,{className:o?"h-4 w-4":"h-3 w-3"}),"I wanted to contact this guide"]})]})})},Gs={"mountain-snow":Ze,footprints:$t,binoculars:At,"grip-vertical":Dt,snowflake:Lt,timer:Pt,bike:Gt,waves:Bt,ship:Mt},Bs=t=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t/100),Ms=({guide:t,locations:a,hidePrices:n=!1,hideImages:i=!1,onContactRequest:l,isOwner:f=!1})=>{const[p,s]=c.useState({}),[g,j]=c.useState({}),[u,o]=c.useState("all"),[k,b]=c.useState({}),{activities:N}=Tt();c.useEffect(()=>{if(!(t!=null&&t.id)||!a||a.length===0)return;let d=!1;const m=a.map(x=>{var I;return(I=x.location)==null?void 0:I.id}
18).filter(Boolean);return(async()=>{const{data:x}=await A.from("guide_expedition_packages").select("*").eq("guide_id",t.id).eq("active",!0).order("display_order");if(d)return;if(!x||x.length===0){s({});return}const I=x.map(w=>w.id),E=A.from("guide_expedition_package_locations").select("package_id, location_id").in("package_id",I);A.from("reviews").select("expedition_package_id").eq("guide_id",t.id).in("expedition_package_id",I).in("status",["approved","pending"]).then(({data:w})=>{if(d||!w)return;const R={};w.forEach(D=>{D.expedition_package_id&&(R[D.expedition_package_id]=(R[D.expedition_package_id]||0)+1)}),j(R)});const{data:T}=await E;if(d)return;const r={};(T||[]).forEach(w=>{var R;(r[R=w.package_id]||(r[R]=[])).push(w.location_id)});const v={};x.forEach(w=>{var D;((D=r[w.id])!=null&&D.length?r[w.id]:[w.location_id]).filter(L=>m.includes(L)).forEach(L=>{(v[L]||(v[L]=[])).push({...w,location_id:L})})}),s(v)})(),()=>{d=!0}},[t==null?void 0:t.id,a]);const h=c.useMemo(()=>{const d={};return N.forEach(m=>{d[m.slug]={name:m.display_name,icon:m.icon_name}}),d},[N]),y=(d,m="h-3 w-3")=>{var E;const x=(E=h[d])==null?void 0:E.icon,I=x&&Gs[x]||Ze;return e.jsx(I,{className:m})},S=c.useMemo(()=>{if(!a)return[];const d=[];return a.forEach(m=>{const x=m.location;if(!x)return;(p[x.id]||[]).forEach(E=>{d.push({...E,locationName:x.name,locationCountry:x.country,locationImage:x.image_url,locationActivities:x.activity_types||[]})})}),d},[a,p]),C=c.useMemo(()=>u==="all"?S:S.filter(d=>d.location_id===u),[S,u]),_=c.useMemo(()=>(a||[]).filter(d=>{var x,I;const m=(x=d.location)==null?void 0:x.id;return m&&!((I=p[m])!=null&&I.length)}),[a,p]);return!a||a.length===0?null:e.jsx("section",{id:"tours",className:"scroll-mt-28 py-12 sm:py-16 px-4 sm:px-6 lg:px-8 bg-muted/30 border-y border-border",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx("div",{className:"flex items-end justify-between mb-6 sm:mb-8",children:e.jsxs("div",{children:[e.jsxs("span",{className:"block text-[10px] uppercase tracking-[0.2em] text-muted-foreground font-bold mb-1.5",children:[S.length," active ",S.length===1?"adventure":"adventures"]}),e.jsx("h2",{className:"font-display text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Adventures"})]})}),Object.keys(p).length>1&&e.jsxs("div",{className:"flex gap-2 overflow-x-auto no-scrollbar pb-1 mb-6 -mx-4 px-4 sm:mx-0 sm:px-0",children:[e.jsxs("button",{onClick:()=>o("all"),className:ee("shrink-0 px-3 py-1.5 rounded-full text-xs font-bold uppercase tracking-wider border transition-colors",u==="all"?"bg-foreground text-background border-foreground":"bg-background text-foreground border-border hover:border-foreground
18/30"),children:["All ",e.jsx("span",{className:"opacity-60 ml-1",children:S.length})]}),a.map(d=>{const m=d.location;if(!m)return null;const x=(p[m.id]||[]).length;if(x===0)return null;const I=u===m.id;return e.jsxs("button",{onClick:()=>o(m.id),className:ee("shrink-0 px-3 py-1.5 rounded-full text-xs font-bold uppercase tracking-wider border transition-colors",I?"bg-foreground text-background border-foreground":"bg-background text-foreground border-border hover:border-foreground/30"),children:[m.name," ",e.jsx("span",{className:"opacity-60 ml-1",children:x})]},d.id)})]}),(t==null?void 0:t.er_rate_enabled)&&e.jsx(Se,{guide:t,source:"package_list",sourceType:"guide_profile",sourceSlug:(t==null?void 0:t.slug)||null,className:"mb-6"}),C.length>0?e.jsx("div",{className:"space-y-5 sm:space-y-6",children:C.map(d=>{const m=!!k[d.id],x=!!d.description&&d.description.trim().length>0,I=g[d.id]||0,E=d.image_url||d.locationImage,T=()=>b(r=>({...r,[d.id]:!m}));return e.jsxs("article",{role:"button",tabIndex:0,"aria-expanded":m,onClick:T,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),T())},className:ee("group bg-background rounded-2xl border overflow-hidden transition-shadow hover:shadow-md cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-foreground/30",m?"border-foreground
18/40 shadow-md":"border-border"),children:[!i&&E&&e.jsxs("div",{className:"relative aspect-[16/10] bg-muted overflow-hidden",children:[e.jsx("img",{src:E,alt:d.package_name,loading:"lazy",className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-[1.02]"}),e.jsxs("div",{className:"absolute top-3 left-3 inline-flex items-center gap-1 bg-background/95 backdrop-blur-sm rounded-full px-2.5 py-1 text-[10px] font-bold uppercase tracking-widest text-foreground",children:[e.jsx(z,{className:"h-3 w-3"}),d.locationCountry]}),I>0&&e.jsxs("div",{className:"absolute top-3 right-3 inline-flex items-center gap-1 bg-background/95 backdrop-blur-sm rounded-full px-2.5 py-1 text-[10px] font-bold text-foreground",children:[e.jsx(U,{className:"h-3 w-3 fill-amber-400 text-amber-400"}),I," review",I!==1?"s":""]})]}),e.jsxs("div",{className:"p-4 sm:p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-1.5",children:[e.jsx("h3",{className:"font-display text-lg sm:text-xl font-bold text-foreground leading-tight flex-1",children:d.package_name}),e.jsxs("div",{className:"text-right shrink-0 flex items-center gap-2",children:[n?e.jsx("span",{className:"text-xs italic text-muted-foreground",children:"On request"}):e.jsx("span",{className:"text-base sm:text-lg font-bold text-foreground tracking-tight",children:Bs(d.price_usd)}),m?e.jsx(Ye,{className:"h-4 w-4 text-muted-foreground"}):e.jsx(We,{className:"h-4 w-4 text-muted-foreground"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground inline-flex items-center gap-1.5 mb-3",children:[e.jsx(z,{className:"h-3 w-3"}),d.locationName]}),d.locationActivities.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-3",children:d.locationActivities.slice(0,3).map(r=>{var v;return e.jsxs(ce,{variant:"secondary",className:"text-[10px] font-semibold inline-flex items-center gap-1 py-0.5 px-2",children:[y(r,"h-2.5 w-2.5"),((v=h[r])==null?void 0:v.name)||r]},r)})}),m&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-border space-y-3",children:[x?e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed whitespace-pre-wrap",children:d.description}):e.jsx("p",{className:"text-sm italic text-muted-foreground leading-relaxed",children:"Detailed itinerary coming soon â get in touch for dates, group sizes and what's included."}),l?e.jsxs("button",{type:"button",onClick:r=>{r.stopPropagation(),Ds(t,d.package_name,"contact_drawer"),l()},className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-foreground text-background text-xs font-bold uppercase tracking-wider hover:opacity-90 transition-opacity",children:[e.jsx(se,{className:"h-3.5 w-3.5"}),"Inquire about this adventure"]}):e.jsx(Ie,{guide:t,source:"tours_drawer",isOwner:f})]})]})]},`${d.id}-${d.location_id}`)})}):e.jsxs("div",{className:"text-center py-12 text-sm text-muted-foreground border border-dashed border-border rounded-2xl",children:[e.jsx(Rt,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),"No expedition packages for this location yet."]}),u==="all"&&_.length>0&&e.jsxs("div",{className:"mt-8 pt-6 border-t border-border",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-muted-foreground mb-3",children:"Also operates in"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:_.map(d=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-background border border-border text-xs text-foreground",children:[e.jsx(z,{className:"h-3 w-3 text-muted-foreground"}),d.location.name," · ",d.location.country]},d.id))})]})]})})},Os=(t,a)=>{if(!t||t.length<=a)return t;const n=t.slice(0,a),i=n.lastIndexOf(" ");return(i>a*.6?n.slice(0,i):n).trimEnd()+"â¦"},Fs=({guide:t,certifications:a,tier:n="pro"})=>{const i=n==="basic",l=(o,k)=>(o.sort_order??999)-(k.sort_order??999)||new Date(o.created_at||0).getTime()-new Date(k.created_at||0).getTime(),f=(a||[]).filter(o=>o.verified&&o.proof_status==="approved"),p=[...f.filter(o=>o.is_featured).sort(l),...f.filter(o=>!o.is_featured).sort(l)],s=p.filter(o=>o.is_umbrella),g=p.filter(o=>!o.is_umbrella),j=(t==null?void 0:t.description)||"",u=i?Os(j.replace(/<[^>]+>/g,""),240):"";return e.jsx("section",{id:"about",className:"scroll-mt-28 py-12 sm:py-16 px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"mb-6 sm:mb-8",children:[e.jsx("span",{className:"block text-[10px] uppercase tracking-[0.2em] text-muted-foreground font-bold mb-1.5",children:"About the guide"}),e.jsx("h2",{className:"font-display text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:t==null?void 0:t.company_name})]}),!i&&p.length>0&&e.jsxs("div",{className:"mb-8",children:[e.jsxs("h3",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-muted-foreground mb-3 inline-flex items-center gap-1.5",children:[e.jsx(J,{className:"h-3 w-3"})," Certifications"]}),s.length>0&&e.jsx("div",{className:"space-y-3 mb-3",children:s.map(o=>{const k=Ot(o.umbrella_body),b=Array.isArray(o.covered_disciplines)?o.covered_disciplines:[],N=k?`${k.short_name} Certified`:ye(o.certification_type);return e.jsx("div",{className:"relative rounded-2xl border-2 border-amber-300 bg-gradient-to-br from-amber-50 to-yellow-50 dark:from-amber-950/40 dark:to-yellow-950/30 dark:border-amber-800 p-4 sm:p-5 shadow-sm",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex-shrink-0 rounded-full bg-amber-100 dar
18k:bg-amber-900/50 border border-amber-200 dark:border-amber-800 p-2",children:e.jsx(J,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h4",{className:"font-bold text-sm sm:text-base text-foreground",children:N}),e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-600/10 text-amber-700 dark:text-amber-300 text-[10px] font-semibold uppercase tracking-wider px-2 py-0.5",children:[e.jsx(ze,{className:"h-3 w-3"})," Multi-discipline"]})]}),o.issuing_organization&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:o.issuing_organization}),b.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2.5",children:b.map(h=>e.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-200 dark:border-amber-800 bg-white/70 dark:bg-amber-950/40 px-2 py-0.5 text-[11px] font-medium text-amber-900 dark:text-amber-200",children:Ft(h)},h))})]})]})},o.id)})}),g.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:g.map(o=>e.jsxs("div",{className:"inline-flex items-center gap-1.5 rounded-full border border-emerald-200 bg-emerald-50 dark:bg-emerald-950/40 dark:border-emerald-900 px-3 py-1.5 text-xs",children:[e.jsx(J,{className:"h-3 w-3 text-emerald-600 dark:text-emerald-400"}),e.jsx("span",{className:"font-semibold text-foreground",children:ye(o.certification_type)}),o.issuing_organization&&e.jsxs("span",{className:"text-muted-foreground",children:["· ",o.issuing_organization]})]},o.id))})]}),i?u&&e.jsx("p",{className:"text-sm sm:text-base text-foreground/85 leading-relaxed mb-8",children:u}):(t==null?void 0:t.description)&&e.jsx("div",{className:"prose prose-sm sm:prose-base max-w-none text-foreground/85 leading-relaxed mb-8",dangerouslySetInnerHTML:{__html:Ut(t.description)}}),e.jsxs("dl",{className:"grid grid-cols-2 gap-3 sm:gap-4 mb-8",children:[(t==null?void 0:t.years_experience)>0&&e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/40 p-4",children:[e.jsxs("dt",{className:"text-[10px] font-bold uppercase tracking-[0.18em] text-muted-foreground inline-flex items-center gap-1.5",children:[e.jsx(ke,{className:"h-3 w-3"})," Experience"]}),e.jsxs("dd",{className:"font-display text-2xl font-bold text-foreground mt-1",children:[t.years_experience," ",e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"years"})]})]}),(t==null?void 0:t.base_country)&&e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/40 p-4",children:[e.jsxs("dt",{className:"text-[10px] font-bold uppercase tracking-[0.18em] text-muted-foreground inline-flex items-center gap-1.5",children:[e.jsx(z,{className:"h-3 w-3"})," Based in"]}),e.jsx("dd",{className:"font-display text-xl font-bold text-foreground mt-1 truncate",children:t.base_country})]}),(t==null?void 0:t.operation_scope)&&e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/40 p-4",children:[e.jsxs("dt",{className:"text-[10px] font-bold uppercase tracking-[0.18em] text-muted-foreground inline-flex items-center gap-1.5",children:[e.jsx(Je,{className:"h-3 w-3"})," Scope"]}),e.jsx("dd",{className:"font-display text-xl font-bold text-foreground mt-1 capitalize",children:t.operation_scope})]}),(t==null?void 0:t.languages)&&t.languages.length>0&&e.jsxs("div",{className:"rounded-2xl border border-border bg-muted/40 p-4",children:[e.jsxs("dt",{className:"text-[10px] font-bold uppercase tracking-[0.18em] text-muted-foreground inline-flex items-center gap-1.5",children:[e.jsx(js,{className:"h-3 w-3"})," Languages"]}),e.jsx("dd",{className:"text-sm font-semibold text-foreground mt-1 leading-snug",children:t.languages.join(", ")})]})]}),!i&&(t==null?void 0:t.team_photo_url)&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-[10px] font-bold uppercase tracking-[0.2em] text-muted-foreground mb-3 inline-flex items-center gap-1.5",children:[e.jsx(zt,{className:"h-3 w-3"})," Meet the team"]}),e.jsx("div",{className:"rounded-2xl overflow-hidden border border-border",children:e.jsx("img",{src:Vt(t.team_photo_url,"large"),alt:`${t.company_name} team`,className:"w-full h-auto max-h-[400px] object-cover",loading:"lazy"})})]})]})})},Us=({images:t})=>{const[a,n]=c.useState(null),[i,l]=c.useState(!0),f=ve.useRef(null),p=ve.useRef(null),s=(t==null?void 0:t.filter(h=>!h.is_logo))||[],g=a!==null;c.useEffect(()=>{if(!g)return;const h=y=>{y.key==="Escape"?n(null):y.key==="ArrowLeft"?(y.preventDefault(),n(S=>S!==null?(S-1+s.length)%s.length:null)):y.key==="ArrowRight"&&(y.preventDefault(),n(S=>S!==null?(S+1)%s.length:null))};return document.addEventListener("keydown",h),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",h),document.body.style.overflow=""}},[g,s.length]);const j=c.useCallback(h=>{l(!0),n(h)},[]),u=c.useCallback(()=>{n(null)},[]),o=c.useCallback(()=>
18{l(!0),n(h=>h!==null?(h-1+s.length)%s.length:null)},[s.length]),k=c.useCallback(()=>{l(!0),n(h=>h!==null?(h+1)%s.length:null)},[s.length]),b=()=>{if(s.length<=7)return s.map((C,_)=>_);const h=a??0,y=3,S=[];for(let C=-y;C<=y;C++){const _=(h+C+s.length)%s.length;S.push(_)}return S};if(s.length===0)return e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"bg-muted rounded-full p-6 w-24 h-24 mx-auto mb-4 flex items-center justify-center",children:e.jsx(De,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:"No Images Available"}),e.jsx("p",{className:"text-muted-foreground",children:"This guide hasn't uploaded any gallery images yet."})]});const N=a!==null?s[a]:null;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Photo Gallery"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[s.length," images"]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:s.map((h,y)=>e.jsxs("button",{onClick:()=>j(y),className:"group relative aspect-square overflow-hidden rounded-lg border border-border hover:border-primary/50 hover:shadow-lg transition-all duration-200 bg-muted",children:[e.jsx(H,{src:h.image_url,size:"medium",alt:h.caption||`Gallery image ${y+1}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-200"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-all duration-200 flex items-center justify-center",children:e.jsx(De,{className:"h-6 w-6 text-white opacity-0 group-hover:opacity-100 transition-opacity duration-200 drop-shadow-lg"})}),h.caption&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-2",children:e.jsx("p",{className:"text-white text-xs font-medium truncate",children:h.caption})})]},h.id||y))}),g&&N&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/95 flex flex-col touch-pan-y",onClick:u,onTouchStart:h=>{f.current=h.touches[0].clientX,p.current=h.touches[0].clientY},onTouchEnd:h=>{if(f.current===null||p.current===null)return;const y=h.changedTouches[0].clientX-f.current,S=h.changedTouches[0].clientY-p.current;Math.abs(y)>50&&Math.abs(y)>Math.abs(S)&&(y<0?k():o()),f.current=null,p.current=null},children:[e.jsxs("div",{className:"flex items-center justify-between p-4 bg-gradient-to-b from-black/60 to-transparent",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"bg-white/20 text-white px-3 py-1 rounded-full text-sm font-medium backdrop-blur-sm",children:[(a??0)+1," / ",s.length]}),N.caption&&e.jsx("span",{className:"text-white/80 text-sm hidden sm:block",children:N.caption})]}),e.jsx("button",{onClick:u,className:"text-white hover:bg-white/20 rounded-full p-2 transition-colors","aria-label":"Close lightbox",children:e.jsx(Ne,{className:"h-6 w-6"})})]}),e.jsxs("div",{className:"flex-1 flex items-center justify-center px-4 relative min-h-0",onClick:u,children:[i&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsx(qt,{className:"h-10 w-10 animate-spin text-white"})}),s.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:h=>{h.stopPropagation(),o()},className:"absolute left-4 top-1/2 -translate-y-1/2 z-20 bg-black/50 hover:bg-black/70 text-white rounded-full p-3 transition-colors backdrop-blur-sm","aria-label":"Previous image",children:e.jsx(Jt,{className:"h-6 w-6"})}),e.jsx("button",{onClick:h=>{h.stopPropagation(),k()},className:"absolute right-4 top-1/2 -translate-y-1/2 z-20 bg-black/50 hover:bg-black/70 text-white rounded-full p-3 transition-colors backdrop-blur-sm","aria-label":"Next image",children:e.jsx(Wt,{className:"h-6 w-6"})})]}),e.jsx(H,{src:N.image_url,size:"large",fallback:N.image_url,alt:N.caption||`Gallery image ${(a??0)+1}`,className:`max-w-full max-h-[70vh] object-contain rounded-lg transition-opacity duration-300 ${i?"opacity-0":"opacity-100"}`,onClick:h=>h.stopPropagation(),onLoad:()=>l(!1)})]}),s.length>1&&e.jsx("div",{className:"p-4 bg-gradient-to-t from-black/60 to-transparent",children:e.jsx("div",{className:"flex justify-center items-center gap-2",children:b().map(h=>e.jsx("button",{onClick:y=>{y.stopPropagation(),l(!0),n(h)},className:`flex-shrink-0 w-12 h-12 rounded-md overflow-hidden border-2 transition-all duration-200 ${h===a?"border-white scale-110 shadow-lg":"border-white/30 opacity-60 hover:opacity-100 hover:border-white/60"}`,children:e.jsx(H,{src:s[h].image_url,size:"thumbnail",alt:`Thumbnail ${h+1}`,className:"w-full h-full object-cover"})},h))})})]})]})},zs=12,Vs=({images:t})=>{const a=(t||[]).filter(p=>!p.is_logo),[n,i]=c.useState(!1);if(a.length===0)return null;const l=a.slice(0,zs),f=a.length-l.length;return e.jsx("section",{id:"gallery",className:"scroll-mt-28 py-12 sm:py-16 px-4 sm:px-6 lg:px-8 bg-muted/30 border-t border-border",children:e.jsxs("div",{className:"max-w-5xl mx-auto",children:[e.jsxs("div",{className:"mb-6 sm:mb-8",children:[e.jsxs("span",{className:"block text-[10px] uppercase tracking-[0.2em] text-muted-foreground font-bold mb-1.5",children:[a.length," ",a.length===1?"photo":"photos"]}),e.jsx("h2",{className:"font-display text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Gallery"})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 sm:gap-3",children:l.map((p,s)=>e.jsx("button",{type:"button",onClick:()=>i(!0),className:"group relative aspect-square overflow-hidden rounded-lg bg-muted focus:outline-none focus:ring-2 focus:ring-primary",children:e.jsx(H,{src:p.image_url||p.url,alt:p.caption||`Gallery photo ${s+1}`,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"})},p.id||s))}),f>0&&e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsxs("button",{type:"button",onClick:()=>i(!0),className:"inline-flex items-center justify-center h-11 px-6 rounded-xl bg-[hsl(var(--brand))] text-white text-sm font-bold uppercase tracking-wider hover:bg-[hsl(var(--brand-hover))] transition-colors shadow-[0_4px_16px_
18-4px_hsl(var(--brand)/0.4)]",children:["View all ",a.length," photos"]})}),e.jsx(Ht,{open:n,onOpenChange:i,children:e.jsxs(Xt,{className:"max-w-5xl w-[95vw] max-h-[90vh] overflow-y-auto p-4 sm:p-6",children:[e.jsx(Yt,{className:"sr-only",children:"All gallery photos"}),e.jsx(Us,{images:t})]})})]})})},qs="expedreview_featured_ref",Js=(t,a)=>`expedreview:featured-funnel:${t}:${a}`,Ws=()=>{if(typeof document>"u")return null;const t=document.cookie.split("; ").find(l=>l.startsWith(`${qs}=`));if(!t)return null;const a=decodeURIComponent(t.split("=")[1]||""),[n,i]=a.split(":");return n?{slot_id:n,surface:i||"unknown"}:null},Hs=()=>{if(typeof window>"u")return null;try{return new URLSearchParams(window.location.search).get("ref")!=="featured",null}catch{return null}},st=()=>Ws()||Hs(),W=new Map,Xs=async t=>{if(W.has(t))return W.get(t)??null;try{const{data:a,error:n}=await A.rpc("guide_id_for_slot",{_slot_id:t});if(n)return W.set(t,null),null;const i=a??null;return W.set(t,i),i}catch{return W.set(t,null),null}},re=async(t,a)=>{if(!a||typeof window>"u")return;const n=st();if(!n)return;const i=Js(t,a);try{if(sessionStorage.getItem(i))return}catch{}const l=await Xs(n.slot_id);if(!(!l||l!==a)){try{sessionStorage.setItem(i,String(Date.now()))}catch{}try{await A.from("featured_slot_events").insert({slot_id:n.slot_id,event_type:t,surface:n.surface,page_path:typeof window<"u"?window.location.pathname:null})}catch{}}},Ys=Object.freeze(Object.defineProperty({__proto__:null,logFeaturedFunnelEvent:re,readFeaturedRef:st},Symbol.toStringTag,{value:"Module"})),Zs=t=>{const a=c.useRef(null);return c.useEffect(()=>{if(!t||!a.current||typeof IntersectionObserver>"u")return;let n;const i=a.current,l=new IntersectionObserver(f=>{for(const p of f)p.isIntersecting&&p.intersectionRatio>=.5?n===void 0&&(n=window.setTimeout(()=>{re("contact_view",t)},1e3)):n!==void 0&&(window.clearTimeout(n),n=void 0)},{threshold:[0,.5,1]});return l.observe(i),()=>{l.disconnect(),n!==void 0&&window.clearTimeout(n)}},[t]),a},ie=({href:t,external:a,icon:n,title:i,subtitle:l,accent:f,onClick:p})=>e.jsxs("a",{href:t,onClick:p,target:a?"_blank":void 0,rel:a?"noopener noreferrer":void 0,className:`group flex items-center gap-4 p-4 rounded-2xl border transition-colors ${f==="whatsapp"?"bg-[#25D366] hover:bg-[#1ebe5d] border-transparent text-white":"bg-background hover:bg-muted/50 border-border text-foreground"}`,children:[e.jsx("div",{className:`p-2.5 rounded-xl ${f==="whatsapp"?"bg-white/20":"bg-muted"}`,children:e.jsx(n,{className:`h-5 w-5 ${f==="whatsapp"?"text-white":"text-foreground"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-bold text-sm leading-tight",children:i}),e.jsx("div",{className:`text-xs truncate ${f==="whatsapp"?"text-white/85":"text-muted-foreground"}`,children:l})]})]}),Ks=({guide:t})=>{const a=(t==null?void 0:t.whatsapp_number)||(t==null?void 0:t.phone)||(t==null?void 0:t.email)||(t==null?void 0:t.website),n=Zs(t==null?void 0:t.id),{trackWebsiteClick:i,trackContactClick:l}=me(),f=s=>()=>{re("contact_view",t==null?void 0:t.id),t!=null&&t.id&&(s==="website"?i(t.id):s&&l(t.id,s))};if(!a)return null;const p=t!=null&&t.whatsapp_number?String(t.whatsapp_number).replace(/[^\d]/g,""):"";return e.jsx("section",{id:"contact",ref:n,className:"scroll-mt-28 py-12 sm:py-16 px-4 sm:px-6 lg:px-8 bg-muted/30 border-t border-border",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"mb-6 sm:mb-8",children:[e.jsx("span",{className:"block text-[10px] uppercase tracking-[0.2em] text-muted-foreground font-bold mb-1.5",children:"Get in touch"}),e.jsxs("h2",{className:"font-display text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:["Contact ",t==null?void 0:t.company_name]})]}),(t==null?void 0:t.er_rate_enabled)&&e.jsx(Se,{guide:t,source:"guide_profile",sourceType:"guide_profile",sourceSlug:(t==null?void 0:t.slug)||null,className:"mb-6"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[p&&e.jsx(ie,{href:`https://wa.me/${p}`,external:!0,icon:Ke,title:"Message on WhatsApp",subtitle:t.whatsapp_number,accent:"whatsapp",onClick:f("whatsapp")}),(t==null?void 0:t.phone)&&e.jsx(ie,{href:`tel:${t.phone}`,icon:Qe,title:"Call directly",subtitle:t.phone,onClick:f("phone")}),(t==null?void 0:t.email)&&e.jsx(ie,{href:`mailto:${t.email}`,icon:et,title:"Send an email",subtitle:t.email,onClick:f("email")}),(t==null?void 0:t.website)&&e.jsx(ie,{href:t.website,external:!0,icon:tt,title:"Visit website",subt
18itle:t.website.replace(/^https?:\/\//,""),onClick:f("website")})]})]})})},Qs=({guide:t,open:a,onOpenChange:n})=>{const{trackWebsiteClick:i,trackSocialClick:l,trackContactClick:f}=me(),[p,s]=c.useState(!1),[g,j]=c.useState(!1),u=a!==void 0?a:g,o=_=>{n?n(_):j(_)};c.useEffect(()=>{const _=()=>s(window.scrollY>320);return _(),window.addEventListener("scroll",_,{passive:!0}),()=>window.removeEventListener("scroll",_)},[]);const k=t!=null&&t.whatsapp_number?String(t.whatsapp_number).replace(/[^\d]/g,""):"",b=t==null?void 0:t.id,N=[];k&&N.push({href:`https://wa.me/${k}`,external:!0,icon:Ke,label:"WhatsApp",value:t.whatsapp_number,accent:"whatsapp",track:()=>b&&f(b,"whatsapp")}),t!=null&&t.phone&&N.push({href:`tel:${t.phone}`,icon:Qe,label:"Call",value:t.phone,track:()=>b&&f(b,"phone")}),t!=null&&t.email&&N.push({href:`mailto:${t.email}`,icon:et,label:"Email",value:t.email,track:()=>b&&f(b,"email")});const h=[];t!=null&&t.website&&h.push({href:t.website,external:!0,icon:tt,label:"Website",value:t.website.replace(/^https?:\/\//,""),track:()=>b&&i(b)});const y=[];if(t!=null&&t.facebook_url&&y.push({href:t.facebook_url,external:!0,icon:Zt,label:"Facebook",value:"Visit profile",track:()=>b&&l(b,"facebook")}),t!=null&&t.instagram_url&&y.push({href:t.instagram_url,external:!0,icon:Kt,label:"Instagram",value:"Visit profile",track:()=>b&&l(b,"instagram")}),t!=null&&t.twitter_url&&y.push({href:t.twitter_url,external:!0,icon:Qt,label:"Twitter / X",value:"Visit profile",track:()=>b&&l(b,"twitter")}),t!=null&&t.linkedin_url&&y.push({href:t.linkedin_url,external:!0,icon:es,label:"LinkedIn",value:"Visit profile",track:()=>b&&l(b,"linkedin")}),N.length+h.length+y.length===0)return null;const C=({title:_,rows:d})=>d.length===0?null:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-[10px] uppercase tracking-[0.2em] text-muted-foreground font-bold px-1",children:_}),e.jsx("div",{className:"space-y-2",children:d.map(m=>e.jsxs("a",{href:m.href,onClick:()=>{var x;re("contact_view",t==null?void 0:t.id),(x=m.track)==null||x.call(m)},target:m.external?"_blank":void 0,rel:m.external?"noopener noreferrer":void 0,className:`flex items-center gap-3 p-3 rounded-2xl border transition-colors ${m.accent==="whatsapp"?"bg-[#25D366] hover:bg-[#1ebe5d] border-transparent text-white":"bg-background hover:bg-muted/50 border-border text-foreground"}`,children:[e.jsx("div",{className:`p-2 rounded-xl ${m.accent==="whatsapp"?"bg-white/20":"bg-muted"}`,children:e.jsx(m.icon,{className:`h-5 w-5 ${m.accent==="whatsapp"?"text-white":"text-foreground"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-bold text-sm leading-tight",children:m.label}),e.jsx("div",{className:`text-xs truncate ${m.accent==="whatsapp"?"text-white/85":"text-muted-foreground"}`,children:m.value})]})]},m.label))})]});return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`fixed inset-x-0 bottom-0 z-40 transition-transform duration-300 ${p?"translate-y-0":"translate-y-full"}`,style:{paddingBottom:"env(safe-area-inset-bottom)"},children:e.jsx("div",{className:"bg-gradient-to-t from-background via-background/95 to-background/0 backdrop-blur-md px-3 pt-6 pb-2.5 flex justify-center",children:e.jsxs("button",{type:"button",onClick:()=>o(!0),className:"inline-flex items-center justify-center gap-2 h-11 px-6 rounded-full bg-background text-[hsl(var(--brand))] text-sm font-semibold tracking-wide border border-[hsl(var(--brand)/0.35)] hover:bg-[hsl(var(--brand)/0.06)] transition-colors shadow-[0_6px_20px_-8px_hsl(var(--brand)/0.45)]",children:[e.jsx(se,{className:"h-4 w-4"}),"Contact guide",(t==null?void 0:t.er_rate_enabled)&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs font-medium opacity-80",children:[e.jsx(ts,{className:"h-3.5 w-3.5"}),"· rate available"]})]})})}),e.jsx(ss,{open:u,onOpenChange:o,children:e.jsxs(as,{side:"bottom",className:"rounded-t-2xl max-h-[85vh] overflow-y-auto p-5",children:[e.jsx(rs,{className:"mb-4 text-left",children:e.jsxs(ns,{className:"font-display text-xl font-bold tracking-tight",children:["Contact ",(t==null?void 0:t.company_name)||"guide"]})}),e.jsxs("div",{className:"space-y-5 pb-6",children:[(t==null?void 0:t.er_rate_enabled)&&e.jsx(Se,{guide:t,source:"guide_profile",sourceType:"guide_profile",sourceSlug:(t==null?void 0:t.slug)||null}),e.jsx(C,{title:"Direct",rows:N}),e.jsx(C,{title:"Web",rows:h}),e.jsx(C,{title:"Social",rows:y})]})]})})]})},ea=({guide:t,isOwner:a=!1})=>e.jsx("section",{id:"contact",className:"scroll-mt-28 py-12 sm:py-16 px-4 sm:px-6 lg:px-8 bg-muted/30 border-t border-border",children:e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"mb-6 sm:mb-8",children:[e.jsx("span",{className:"block text-[10px] uppercase tracking-[0.2em] text-muted-foreground font-bold mb-1.5",children:"Get in touch"}),e.jsxs("h2",{className:"font-display text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:["Contact ",(t==null?void 0:t.company_name)||"this guide"]})]}),e.jsx(Ie,{guide:t,source:"contact_section",isOwner:a,variant:"section"})]})}),ta=({guide:t,isOwner:a=!1})=>{const[n,i]=c.useState(!1);return c.useEffect(()=>{const l=()=>i(window.scrollY>320);return l(),window.addEventListener("scroll",l,{passive:!0}),()=>window.removeEventListener("scroll",l)},[]),a||!n?null:e.jsx("div",{className:"lg:hidden fixed bottom-0 inset-x-0 z-40 border-t border-border bg-background/95 backdrop-blur-sm px-4 py-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))]",children:e.jsx(Ie,{guide:t,source:"mobile_bar",variant:"bar"})})},sa=56,aa=({guide:t,images:a,trustIndex:n,totalReviews:i=0,tier:l="pro"})=>{const f=ae(),[p,s]=c.useState(!1),g=a==null?void 0:a.find(o=>o.is_logo),j=l==="basic",{score:u}=Ce(n,i);return c.useEffect(()=>{const o=()=>s(window.scrollY>420);return o(),window.addEventListener("scroll",o,{passive:!0}),()=>window.removeEventListener("scroll",o)},[]),c.useEffect(()=>(document.documentElement.style.setProperty("--sticky-header-offset",p?`${sa}px`:"0px"),()=>{document.documentElement.style.setProperty("--sticky-header-offset","0px")}),[p]),e.jsx("div",{className:`fixed top-0 inset-x-0 z-40 transition-transform duration-300 ${p?"translate-y-0":"-translate-y-full"}`,children:e.jsx("div",{className:"bg-card border-b border-border shadow-sm",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-6 lg:px-8 h-14 flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>f("/"),className:"flex-shrink-0 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":"ExpedReview home",children:e.jsx("img",{src:"/logo-blue.png",alt:"ExpedReview",className:"h-7 w-auto"})}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),g?e.jsx(_e,{src:g.image_url,alt:`${t==null?void 0:t.company_name} logo`,containerClassName:`h-8 aspect-[4/3] rounded-lg bg-background border border-border flex-shrink-0 ${j?"grayscale":""}`,className:j?"grayscale":""}):e.jsx("div",{className:"h-8 aspect-[4/3] rounded-lg bg-muted flex-shrink-0"}),e.jsx("span",{translate:"no",className:"notranslate font-display font-bold text-sm sm:text-base text-foreground truncate flex-1 min-w-0",children:t==null?void 0:t.company_name}),e.jsx("span",{className:"inline-flex items-center gap-1 text-xs font-bold text-foreground flex-shrink-0",children:u>0?e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"h-3.5 w-3.5 fill-amber-400 text-amber-400"}),u.toFixed(1)]}):e.jsx("span",{className:"text-muted-foreground",children:"Unrated"})}),e.jsx("button",{type:"button",onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),"aria-label":"Back to top",className:"hidden sm:inline-flex items-center justify-center h-8 w-8 rounded-full border border-border bg-background text-muted-foreground hover:text-foreground hover:bg-muted transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:e.jsx(Ye,{className:"h-4 w-4"})})]})})})},ra=({guide:t,allReviews:a,images:n,locations:i,certifications:l,trustIndex:f,totalReviews:p,verifiedCount:s,hasPendingReviews:g=!1,defaultReviewSort:j,tier:u="pro",reviewsLoading:o=!1})=>{const{user:k}=de(),b=!!k&&!!(t!=null&&t.user_id)&&k.id===t.user_id,N=u==="basic",h=c.useMemo(()=>(n||[]).filter(x=>!x.is_logo),[n]),y=(i||[]).length>0,S=!N&&h.length>0,C=!N&&!!(t!=null&&t.whatsapp_number||t!=null&&t.phone||t!=null&&t.email||t!=null&&t.website||t!=null&&t.facebook_url||t!=null&&t.instagram_url||t!=null&&t.twitter_url||t!=null&&t.linkedin_url),[_,d]=c.useState(!1),m=c.useMemo(()=>{const x=[];return x.push({id:"reviews",label:"Reviews"}),y&&x.push({id:"tours",label:"Adventures"}),x.push({id:"about",label:"About"}),S&&x.push({id:"gallery",label:"Gallery"}),(C||N)&&x.push({id:"contact",label:"Contact"}),x},[y,S,C,N]);return e.jsxs("div",{className:"bg-background",children:[e.jsx(aa,{guide:t,images:n,trustIndex:f,totalReviews:p,tier:u}),e.jsx(Ss,{guide:t,images:n,certifications:l,trustIndex:f,totalReviews:p,verifiedCount:s,locationsCount:(i||[]).length,hasVerifiedBadge:t==null?void 0:t.has_verified_badge,tier:u,isOwner:b}),e.jsx(Is,{items:m}),e.jsx(As,{allReviews:a,trustIndex:f,totalReviews:p,verifiedCount:s,hasPendingReviews:g,defaultReviewSort:j,loading:o}),y&&e.jsx(Ms,{guide:t,locations:i,hidePrices:!1,hideImages:N,onContactRequest:C?()=>d(!0):void 0,isOwner:b}),e.jsx(Fs,{guide:t,certifications:l,tier:u}),S&&e.jsx(Vs,{images:n}),C&&e.jsx(Ks,{guide:t}),N&&e.jsx(ea,{guide:t,isOwner:b}),C&&e.jsx(Qs,{guide:t,open:_,onOpenChange:d}),N&&e.jsx(ta,{guide:t,isOwner:b}),e.jsx(os,{}),(C||N&&!b)&&e.jsx("div",{className:"h-20"})]})},na=({excludeGuideId:t,baseCountry:a})=>{const n=ls(),i=ae(),{localGuides:l,internationalGuides:f,loading:p}=is(t,a),[s,g]=c.useState(!1);if(c.useEffect(()=>{if(!n||p||[...l,...f].length===0)return;const N=setTimeout(()=>g(!0),3e3);return()=>clearTimeout(N)},[n,p,l,f]),!n)return null;const j=[...l,...f].slice(0,6);if(j.length===0&&!p)return null;const u=()=>{g(!1)},o=b=>{g(!1),b.slug?i(`/guide/${b.slug}`):i(`/guide/id/${b.id}`)},k=b=>Array(5).fill(0).map((N,h)=>e.jsx(U,{className:`h-2.5 w-2.5 ${h<Math.floor(b)?"fill-yellow-400 text-yellow-400":"text-muted-foreground
18/30"}`},h));return e.jsx("div",{className:`fixed bottom-0 left-0 right-0 z-50 bg-card border-t border-border shadow-[0_-4px_16px_rgba(0,0,0,0.1)] transition-transform duration-500 ease-out ${s?"translate-y-0":"translate-y-full"}`,children:e.jsxs("div",{className:"px-3 py-3.5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(U,{className:"h-3.5 w-3.5 text-primary fill-primary"}),e.jsx("span",{className:"text-xs font-semibold text-foreground",children:"Top Operators"})]}),e.jsx("button",{onClick:u,className:"p-1 rounded-full hover:bg-muted transition-colors","aria-label":"Dismiss",children:e.jsx(Ne,{className:"h-4 w-4 text-muted-foreground"})})]}),e.jsx("div",{className:"flex gap-2 overflow-x-auto pb-1 -mx-1 px-1 scrollbar-hide",children:j.map(b=>e.jsxs("button",{onClick:()=>o(b),className:"flex-shrink-0 flex items-center gap-2.5 px-3 py-2 rounded-lg border border-border/50 bg-background hover:bg-accent/50 transition-colors",children:[e.jsx("div",{className:"h-8 w-8 flex-shrink-0 rounded-md overflow-hidden bg-muted",children:b.logo_url?e.jsx(_e,{src:b.logo_url,alt:b.company_name,containerClassName:"w-8 h-8 bg-card"}):e.jsx("div",{className:"w-full h-full flex items-center justify-center text-primary text-xs font-semibold",children:b.company_name.substring(0,2).toUpperCase()})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate max-w-[90px]",children:b.company_name}),e.jsx("div",{className:"flex items-center gap-0.5 mt-0.5",children:k(b.average_rating)})]})]},b.id))})]})})},oa=({guide:t,allReviews:a,images:n,locations:i,certifications:l,hasPendingReviews:f=!1,reviewsLoading:p=!1})=>{var d;const{user:s}=de(),g=ae(),j=cs(t==null?void 0:t.id),u=ds(t==null?void 0:t.id),{limits:o}=gs(t==null?void 0:t.id),k=u.loading,b=k||u.tier==="basic",N=!k&&u.tier==="standard",h=!k&&(u.tier==="professional"||u.tier==="enterprise");c.useEffect(()=>{window.location.hash==="#leave-review"&&(t!=null&&t.id)&&g(`/client-dashboard?tab=review&guide_id=${t.id}`,{replace:!0})},[t==null?void 0:t.id,g]);const y=((d=n==null?void 0:n.find(m=>m.is_logo))==null?void 0:d.image_url)||null;c.useMemo(()=>{const m=(n==null?void 0:n.filter(x=>!x.is_logo))||[];return k||!o?[]:b?[]:o.max_images>0&&!h?m.slice(0,o.max_images):m},[n,k,b,h,o]);let S=i||[],C=l||[];if(!k){if(b)C=[];else if(N)S=(i==null?void 0:i.slice(0,3))||[],C=(l==null?void 0:l.filter(m=>m.verified).slice(0,3))||[],l!=null&&l.filter(m=>m.is_featured&&m.verified).slice(0,1);else if(h){C=(l==null?void 0:l.filter(x=>x.verified))||[];const m=(l==null?void 0:l.filter(x=>x.is_featured&&x.verified))||[];m.length>0||C.slice(0,3)}}if(k)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(te,{}),e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:[e.jsx(B,{className:"w-full h-[300px] rounded-lg mt-4"}),e.jsxs("div",{className:"flex gap-4 mt-6",children:[e.jsx(B,{className:"h-8 w-24"}),e.jsx(B,{className:"h-8 w-24"}),e.jsx(B,{className:"h-8 w-24"})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 mt-8 pb-8",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.jsx(B,{className:"h-6 w-3/4"}),e.jsx(B,{className:"h-4 w-full"}),e.jsx(B,{className:"h-4 w-full"}),e.jsx(B,{className:"h-4 w-2/3"})]}),e.jsx("div",{className:"lg:col-span-1",children:e.jsx(B,{className:"h-48 w-full"})})]})]})]});const _=h?"pro":"basic";return e.jsxs("div",{className:"min-h-screen bg-background",children:[!j.loading&&e.jsx(ks,{guide:t,trustIndex:j.trustIndex||0,totalReviews:j.totalReviews||0,logoUrl:y,reviews:a}),e.jsx(te,{}),e.jsx(Cs,{guideId:t==null?void 0:t.id,viewerGuideId:s==null?void 0:s.id,viewerTier:k?"loading":u.tier}),e.jsx(ra,{guide:t,allReviews:a,images:_==="pro"?n:(n||[]).filter(m=>m.is_logo),locations:S,certifications:C,trustIndex:j.trustIndex||0,totalReviews:j.totalReviews||0,verifiedCount:j.verifiedReviewsCount||0,hasPendingReviews:f,reviewsLoading:p,defaultReviewSort:_==="pro"?(t==null?void 0:t.default_review_sort)||"newest":N||u.isOnTrial?"newest":"rating-low",tier:_}),_==="basic"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden lg:block border-t border-border bg-muted/30",children:e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-10",children:e.jsx(ms,{excludeGuideId:t==null?void 0:t.id,baseCountry:t==null?void 0:t.base_country})})}),e.jsx(na,{excludeGuideId:t==null?void 0:t.id,baseCountry:t==null?void 0:t.base_country})]})]})},la=xs(()=>He(()=>import("./index-BGFlaWMN.js").then(t=>t.d_),__vite__mapDeps([0,1]))),pa=()=>{const{id:t,slug:a}=ps(),n=ae(),i=a||t,{trackGuideView:l}=Xe(),{trackProfileView:f,trackingReady:p}=me(),{guide:s,reviews:g,allReviews:j,images:u,locations:o,certifications:k,loading:b,reviewsLoading:N,hasPendingReviews:h}=vs(i),y=c.useRef(l),S=c.useRef(f);y.current=l,S.current=f;const C=c.useRef(null),_=c.useRef(null);c.useEffect(()=>{!(s!=null&&s.id)||C.current===s.id||(C.current=s.id,y.current(s.id,s.company_name,s.slug||void 0),re("profile_view",s.id))},[s==null?void 0:s.id]),c.useEffect(()=>{!(s!=null&&s.id)||!p||_.current===s.id||(_.current=s.id,S.current(s.id,"direct"))},[s==null?void 0:s.id,p]);const[d,m]=c.useState(null),[x,I]=c.useState(!1),[E,T]=c.useState(!1);if(c.useEffect(()=>{T(!1),m(null),I(!1)},[i]),c.useEffect(()=>{if(!b&&!s&&i&&!E){I(!0);const r=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(i);A.from("unclaimed_guide_companies").select("id").eq(r?"id":"slug",i).is("deleted_at",null).maybeSingle().then(({data:w})=>{w&&m(w.id),I(!1),T(!0)})}},[b,s,i,E]),c.useEffect(()=>{t&&s&&s.slug&&n(`/guide/${s.slug}`,{replace:!0})},[t,s,n]),b||x)return e.jsx(je,{});if(!s&&(x||!E))return e.jsx(je,{});if(!s&&d)return e.jsx(c.Suspense,{fallback:e.jsx(je,{}),children:e.jsx(la,{unclaimedId:d})});if(!s)return e.jsx(Ns,{identifier:i});try{return e.jsx(oa,{guide:s,reviews:g,allReviews:j,images:u,locations:o,certifications:k,hasPendingReviews:h,reviewsLoading:N})}catch(r){return G.error("[B-test] Error rendering GuideDetailsB",r),e.jsx(_s,{})}};export{pa 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.