1import{c as d,w as e,R}from"./index-jWWD7jul.js";import{L as T,s as te,c as L,b as fe,u as et,S as tt,V as st,h as nt}from"./routeTree.gen-BLs9mk7j.js";import{u as ot}from"./useSuspenseQuery-DE4Z54Zo.js";import{S as rt,a as at}from"./site-chrome-B1eQP17W.js";import{P as lt}from"./page-intro-Cjy7MTSY.js";import{C as ct,L as it}from"./listing-card-B9V4pdL5.js";import{C as dt,A as ut,l as mt,c as ft,S as pt,F as xt}from"./google-maps-loader-C1omkx0u.js";import{C as ge,a as ht}from"./chevron-right-c5ucTMIr.js";import{M as gt}from"./map-fallback-CMdUNcUZ.js";import{u as se,P as z,c as be,a as ve,b as bt}from"./index-DgthG9qA.js";import{c as vt,u as yt}from"./index-c7_exJcG.js";import{u as ye}from"./index-BzclYw72.js";import{u as je,P as jt}from"./index-DhZ4FOi6.js";import{R as Nt,T as wt,P as Ct,C as Ne,a as _t,b as we,O as Ce,D as _e}from"./index-D1CoOKQp.js";import{c as ke,B as kt}from"./button-BzLzroW1.js";import{X as Se}from"./x-CYm8NDs_.js";import{C as J}from"./checkbox-D6FHe82w.js";import{S as St}from"./search-DS0a4__d.js";import"./useBaseQuery-BqQO5Hyc.js";import"./maps-key.functions-CO3_-3QP.js";import"./index-DcJCkfhc.js";import"./index-ChqJLRjb.js";import"./check-B8uBImen.js";const At=278;function Rt({cities:t}){const n=d.useRef(null),[s,o]=d.useState(!1),[a,i]=d.useState(!1),c=d.useCallback(()=>{const l=n.current;l&&(o(l.scrollLeft>2),i(l.scrollLeft<l.scrollWidth-l.clientWidth-2))},[]);d.useEffect(()=>(c(),window.addEventListener("resize",c),()=>window.removeEventListener("resize",c)),[c,t.length]);const f=l=>{n.current?.scrollBy({left:l*At*2,behavior:"smooth"})};if(t.length===0)return null;const g=s||a;return e.jsx("section",{children:e.jsx("div",{className:"max-w-[1238px] mx-auto px-6",children:e.jsxs("div",{className:"py-9 border-b hairline",children:[e.jsxs("div",{className:"flex items-end justify-between gap-4 mb-4",children:[e.jsx("h2",{className:"t-h2",children:"Browse by city"}),g&&e.jsxs("div",{className:"hidden sm:flex gap-2 shrink-0",children:[e.jsx(pe,{direction:"left",disabled:!s,onClick:()=>f(-1)}),e.jsx(pe,{direction:"right",disabled:!a,onClick:()=>f(1)})]})]}),e.jsx("div",{ref:n,onScroll:c,className:"overflow-x-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:e.jsx("ul",{className:"flex gap-3.5 pb-0.5",children:t.map(l=>e.jsx("li",{className:"shrink-0 w-[264px]",children:e.jsx(It,{city:l})},l.id))})})]})})})}function pe({direction:t,disabled:n,onClick:s}){const o=t==="left"?dt:ge;return e.jsx("button",{type:"button",onClick:s,disabled:n,"aria-label":t==="left"?"Previous cities":"Next cities",className:"h-9 w-9 border hairline flex items-center justify-center rounded-md transition-colors hover:bg-foreground hover:text-background disabled:opacity-30 disabled:pointer-events-none",children:e.jsx(o,{className:"h-4 w-4"})})}function It({city:t}){const n=Pt(t),{listingCount:s}=t;return e.jsxs(T,{to:"/travel-directory/$city",params:{city:t.slug},"aria-label":n?`${t.name}, ${t.country}: read the full guide`:`${t.name}, ${t.country}: see ${s} ${s===1?"place":"places"}`,className:"group block h-full border hairline rounded-md overflow-hidden transition-colors hover:border-foreground",children:[e.jsx("div",{className:"h-[132px] bg-paper flex items-center justify-center overflow-hidden",children:t.hero_image?e.jsx("img",{src:t.hero_image,alt:t.name,loading:"lazy",className:"h-full w-full object-cover !rounded-none"}):e.jsx("span",{className:"label",children:"[ no image ]"})}),e.jsxs("div",{className:"p-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-baseline gap-2 min-w-0",children:[e.jsx("h3",{className:"t-h3 truncate",children:t.name}),e.jsx("span",{className:"text-sm text-muted-foreground truncate",children:t.country})]}),e.jsxs("p",{className:"mt-1.5 label flex items-center gap-1.5",children:[s>0&&e.jsxs("span",{children:[s," ",s===1?"place":"places"]}),s>0&&n&&e.jsx("span",{"aria-hidden":!0,className:"opacity-40",children:"/"}),n&&e.jsx("span",{className:"text-brand-green font-semibold",children:"Full Guide"}),e.jsx(ut,{className:"ml-auto h-4 w-4 shrink-0 text-foreground transition-transform group-hover:translate-x-0.5"})]})]})]})}function Pt(t){const n=t.show_summary_cards!==!1||t.show_quick_stats!==!1,s=!!(t.description||t.best_time_to_visit||t.best_way_to_visit||t.cost_of_living||t.safety_note||t.best_neighborhood||t.best_coworking||t.best_for&&t.best_for.length>0);return n&&s}function Mt({listing:t,cityName:n,cityCountry:s,categoryName:o,onHover:a}){return e.jsxs(T,{to:"/travel-directory/$city/$slug",params:{city:t.city_slug,slug:t.slug},onMouseEnter:a?()=>a(t):void 0,className:"group block border-b hairline py-4 px-2 -mx-2 transition-colors hover:bg-paper",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"relative shrink-0 h-16 w-16 overflow-hidden rounded-md border hairline bg-paper",children:t.cover_image?e.jsx("img",{src:t.cover_image,alt:t.name,loading:"lazy",decoding:"async",className:"h-full w-full object-cover !rounded-none"}):e.jsxs("span",{className:"absolute inset-0 flex items-center justify-center text-[9px] uppercase tracking-widest text-muted-foreground",children:["no",e.jsx("br",{}),"image"]})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("h3",{className:"text-[14px] md:text-[15px] font-semibold leading-snug",children:t.name}),t.price_level?e.jsx("span",{className:"label",children:"$".repeat(t.price_level)}):null]}),e.jsxs("p",{className:"mt-1 flex items-center gap-2 flex-wrap label",children:[e.jsx(ct,{city:n??t.city_slug,country:s,variant:"inline"}),t.category_slug?e.jsx("span",{children:o??t.category_slug.replace(/-/g," ")}):null]})]})]}),t.short_review?e.jsx("p",{className:"mt-2 text-sm text-muted-foreground line-clamp-3",children:te(t.short_review)}):null]})}const xe=9,Et=50;function $t(t,n=!1){const s=n?54:46,o=t>99?"99+":String(t),a=o.length>2?15:17,c=`<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${s}" viewBox="0 0 46 46"> 2<circle cx="23" cy="23" r="21" fill="#FFA8E6" stroke="#000" stroke-width="1.5"/>${n?'<circle cx="23" cy="23" r="17.5" fill="none" stroke="#000" stroke-opacity="0.25"/>':""} 3<text x="23" y="23" text-anchor="middle" dominant-baseline="central" font-family="Inter, system-ui, sans-serif" font-size="${a}" font-weight="600" fill="#000">${o}</text> 4</svg>`;return`data:image/svg+xml;utf8,${encodeURIComponent(c)}`}function Ot(t,n){const s=Math.sin(t*Math.PI/180);return{x:(n+180)/360,y:.5-Math.log((1+s)/(1-s))/(4*Math.PI)}}function Lt(t,n){const s=256*Math.pow(2,n),o=t.map(c=>{const f=Ot(c.lat,c.lng);return{c,x:f.x*s,y:f.y*s}});o.sort((c,f)=>f.c.count-c.c.count);const a=new Set,i=[];for(const c of o){if(a.has(c.c.slug))continue;a.add(c.c.slug);const f=[c.c];for(const l of o)a.has(l.c.slug)||Math.hypot(c.x-l.x,c.y-l.y)<Et&&(a.add(l.c.slug),f.push(l.c));const g=f.reduce((l,p)=>l+p.count,0);i.push({members:f,lat:c.c.lat,lng:c.c.lng,count:g})}return i}function Dt({listings:t,cities:n,onSelect:s,selectedId:o,height:a="100%"}){const i=d.useRef(null),c=d.useRef(null),f=d.useRef([]),[g,l]=d.useState(null),[p,x]=d.useState(!1),[j,v]=d.useState(2),_=d.useMemo(()=>t.filter(y=>y.latitude!=null&&y.longitude!=null),[t]),N=d.useMemo(()=>{const y=new Map;for(const m of _)y.has(m.city_slug)||y.set(m.city_slug,[]),y.get(m.city_slug).push(m);
4return[...y.entries()].map(([m,C])=>{const S=n.find(P=>P.slug===m),M=S?.latitude??C.reduce((P,D)=>P+D.latitude,0)/C.length,I=S?.longitude??C.reduce((P,D)=>P+D.longitude,0)/C.length;return{slug:m,name:S?.name??m,lat:M,lng:I,count:C.length}})},[_,n]),k=d.useCallback(()=>{f.current.forEach(y=>y.setMap(null)),f.current=[]},[]);d.useEffect(()=>{let y=!1;return mt().then(m=>{if(y||!i.current)return;const C=new m.maps.Map(i.current,{center:{lat:20,lng:10},zoom:2,disableDefaultUI:!0,zoomControl:!0,styles:[{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"transit",stylers:[{visibility:"off"}]}]});C.addListener("zoom_changed",()=>v(C.getZoom()??2)),c.current=C,x(!0)}).catch(m=>l(String(m))),()=>{y=!0,k()}},[k]);const A=N.map(y=>y.slug).sort().join(",");if(d.useEffect(()=>{if(!p||!c.current||!window.google||_.length===0)return;const y=new google.maps.LatLngBounds;_.forEach(m=>y.extend({lat:m.latitude,lng:m.longitude})),_.length===1?(c.current.setCenter(y.getCenter()),c.current.setZoom(12)):c.current.fitBounds(y,64)},[A,p]),d.useEffect(()=>{if(!p||!c.current||!window.google)return;k();const y=c.current;if(j<xe){Lt(N,j).forEach(m=>{const C=m.members.length>1,S=C?54:46,M=m.members.map(P=>P.name).join(", "),I=new google.maps.Marker({position:{lat:m.lat,lng:m.lng},map:y,title:C?`${M}: ${m.count} places`:`${M}: ${m.count} ${m.count===1?"place":"places"}`,icon:{url:$t(m.count,C),scaledSize:new google.maps.Size(S,S),anchor:new google.maps.Point(S/2,S/2)}});I.addListener("click",()=>{if(C){const P=new google.maps.LatLngBounds;m.members.forEach(D=>P.extend({lat:D.lat,lng:D.lng})),y.fitBounds(P,96)}else y.setCenter({lat:m.lat,lng:m.lng}),y.setZoom(13)}),f.current.push(I)});return}_.forEach(m=>{const C=o===m.id,S=C?34:28,M=new google.maps.Marker({position:{lat:m.latitude,lng:m.longitude},map:y,title:m.name,icon:{url:ft(m.category_slug,m.subcategory_slug,{selected:C}),scaledSize:new google.maps.Size(S,S),anchor:new google.maps.Point(S/2,S/2)}});M.addListener("click",()=>s?.(m)),f.current.push(M)})},[N,_,j,o,s,p,k]),g)return e.jsx(gt,{});const w=t.length-_.length;return e.jsxs("div",{className:"relative",style:{height:a,width:"100%"},children:[e.jsx("div",{ref:i,className:"h-full w-full bg-paper"}),j<xe&&N.length>0?e.jsx("p",{className:"absolute left-3 top-3 bg-background/90 border hairline rounded-md px-2.5 py-1.5 label",children:"Tap a cluster to zoom in"}):null,w>0?e.jsxs("p",{className:"absolute bottom-3 left-3 bg-background/90 border hairline rounded-md px-2.5 py-1.5 label",children:[w," without a location"]}):null]})}var q="Collapsible",[Tt,Ae]=ve(q),[zt,ne]=Tt(q),Re=d.forwardRef((t,n)=>{const{__scopeCollapsible:s,open:o,defaultOpen:a,disabled:i,onOpenChange:c,...f}=t,[g,l]=se({prop:o,defaultProp:a??!1,onChange:c,caller:q});return e.jsx(zt,{scope:s,disabled:i,contentId:je(),open:g,onOpenToggle:d.useCallback(()=>l(p=>!p),[l]),children:e.jsx(z.div,{"data-state":re(g),"data-disabled":i?"":void 0,...f,ref:n})})});Re.displayName=q;var Ie="CollapsibleTrigger",Pe=d.forwardRef((t,n)=>{const{__scopeCollapsible:s,...o}=t,a=ne(Ie,s);return e.jsx(z.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":re(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...o,ref:n,onClick:be(t.onClick,a.onOpenToggle)})});Pe.displayName=Ie;var oe="CollapsibleContent",Me=d.forwardRef((t,n)=>{const{forceMount:s,...o}=t,a=ne(oe,t.__scopeCollapsible);return e.jsx(jt,{present:s||a.open,children:({present:i})=>e.jsx(Bt,{...o,ref:n,present:i})})});Me.displayName=oe;var Bt=d.forwardRef((t,n)=>{const{__scopeCollapsible:s,present:o,children:a,...i}=t,c=ne(oe,s),[f,g]=d.useState(o),l=d.useRef(null),p=ye(n,l),x=d.useRef(0),j=x.current,v=d.useRef(0),_=v.current,N=c.open||f,k=d.useRef(N),A=d.useRef(void 0);return d.useEffect(()=>{const w=requestAnimationFrame(()=>k.current=!1);return()=>cancelAnimationFrame(w)},[]),bt(()=>{const w=l.current;if(w){A.current=A.current||{transitionDuration:w.style.transitionDuration,animationName:w.style.animationName},w.style.transitionDuration="0s",w.style.animationName="none";const y=w.getBoundingClientRect();x.current=y.height,v.current=y.width,k.current||(w.style.transitionDuration=A.current.transitionDuration,w.style.animationName=A.current.animationName),g(o)}},[c.open,o]),e.jsx(z.div,{"data-state":re(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!N,...i,ref:p,style:{"--radix-collapsible-content-height":j?`${j}px`:void 0,"--radix-collapsible-content-width":_?`${_}px`:void 0,...t.style},children:N&&a})});function re(t){return t?"open":"closed"}var Ft=Re,Vt=Pe,Ht=Me,E="Accordion",Gt=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[ae,Ut,qt]=vt(E),[K]=ve(E,[qt,Ae]),le=Ae(),Ee=R.forwardRef((t,
4n)=>{const{type:s,...o}=t,a=o,i=o;return e.jsx(ae.Provider,{scope:t.__scopeAccordion,children:s==="multiple"?e.jsx(Qt,{...i,ref:n}):e.jsx(Zt,{...a,ref:n})})});Ee.displayName=E;var[$e,Kt]=K(E),[Oe,Wt]=K(E,{collapsible:!1}),Zt=R.forwardRef((t,n)=>{const{value:s,defaultValue:o,onValueChange:a=()=>{},collapsible:i=!1,...c}=t,[f,g]=se({prop:s,defaultProp:o??"",onChange:a,caller:E});return e.jsx($e,{scope:t.__scopeAccordion,value:R.useMemo(()=>f?[f]:[],[f]),onItemOpen:g,onItemClose:R.useCallback(()=>i&&g(""),[i,g]),children:e.jsx(Oe,{scope:t.__scopeAccordion,collapsible:i,children:e.jsx(Le,{...c,ref:n})})})}),Qt=R.forwardRef((t,n)=>{const{value:s,defaultValue:o,onValueChange:a=()=>{},...i}=t,[c,f]=se({prop:s,defaultProp:o??[],onChange:a,caller:E}),g=R.useCallback(p=>f((x=[])=>[...x,p]),[f]),l=R.useCallback(p=>f((x=[])=>x.filter(j=>j!==p)),[f]);return e.jsx($e,{scope:t.__scopeAccordion,value:c,onItemOpen:g,onItemClose:l,children:e.jsx(Oe,{scope:t.__scopeAccordion,collapsible:!0,children:e.jsx(Le,{...i,ref:n})})})}),[Xt,W]=K(E),Le=R.forwardRef((t,n)=>{const{__scopeAccordion:s,disabled:o,dir:a,orientation:i="vertical",...c}=t,f=R.useRef(null),g=ye(f,n),l=Ut(s),x=yt(a)==="ltr",j=be(t.onKeyDown,v=>{if(!Gt.includes(v.key))return;const _=v.target,N=l().filter(I=>!I.ref.current?.disabled),k=N.findIndex(I=>I.ref.current===_),A=N.length;if(k===-1)return;v.preventDefault();let w=k;const y=0,m=A-1,C=()=>{w=k+1,w>m&&(w=y)},S=()=>{w=k-1,w<y&&(w=m)};switch(v.key){case"Home":w=y;break;case"End":w=m;break;case"ArrowRight":i==="horizontal"&&(x?C():S());break;case"ArrowDown":i==="vertical"&&C();break;case"ArrowLeft":i==="horizontal"&&(x?S():C());break;case"ArrowUp":i==="vertical"&&S();break}const M=w%A;N[M].ref.current?.focus()});return e.jsx(Xt,{scope:s,disabled:o,direction:a,orientation:i,children:e.jsx(ae.Slot,{scope:s,children:e.jsx(z.div,{...c,"data-orientation":i,ref:g,onKeyDown:o?void 0:j})})})}),U="AccordionItem",[Yt,ce]=K(U),De=R.forwardRef((t,n)=>{const{__scopeAccordion:s,value:o,...a}=t,i=W(U,s),c=Kt(U,s),f=le(s),g=je(),l=o&&c.value.includes(o)||!1,p=i.disabled||t.disabled;return e.jsx(Yt,{scope:s,open:l,disabled:p,triggerId:g,children:e.jsx(Ft,{"data-orientation":i.orientation,"data-state":He(l),...f,...a,ref:n,disabled:p,open:l,onOpenChange:x=>{x?c.onItemOpen(o):c.onItemClose(o)}})})});De.displayName=U;var Te="AccordionHeader",ze=R.forwardRef((t,n)=>{const{__scopeAccordion:s,...o}=t,a=W(E,s),i=ce(Te,s);return e.jsx(z.h3,{"data-orientation":a.orientation,"data-state":He(i.open),"data-disabled":i.disabled?"":void 0,...o,ref:n})});ze.displayName=Te;var ee="AccordionTrigger",Be=R.forwardRef((t,n)=>{const{__scopeAccordion:s,...o}=t,a=W(E,s),i=ce(ee,s),c=Wt(ee,s),f=le(s);return e.jsx(ae.ItemSlot,{scope:s,children:e.jsx(Vt,{"aria-disabled":i.open&&!c.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...f,...o,ref:n})})});Be.displayName=ee;var Fe="AccordionContent",Ve=R.forwardRef((t,n)=>{const{__scopeAccordion:s,...o}=t,a=W(E,s),i=ce(Fe,s),c=le(s);return e.jsx(Ht,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...c,...o,ref:n,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});Ve.displayName=Fe;function He(t){return t?"open":"closed"}var Jt=Ee,es=De,ts=ze,Ge=Be,Ue=Ve;const ss=Jt,F=d.forwardRef(({className:t,...n},s)=>e.jsx(es,{ref:s,className:L("border-b",t),...n}));F.displayName="AccordionItem";const V=d.forwardRef(({className:t,children:n,...s},o)=>e.jsx(ts,{className:"flex",children:e.jsxs(Ge,{ref:o,className:L("flex flex-1 items-center justify-between py-4 text-sm font-medium cursor-pointer transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",t),...s,children:[n,e.jsx(ht,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));V.displayName=Ge.displayName;const H=d.forwardRef(({className:t,children:n,...s},o)=>e.jsx(Ue,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...s,children:e.jsx("div",{className:L("pb-4 pt-0",t),children:n})}));H.displayName=Ue.displayName;const ns=Nt,os=wt,rs=Ct,qe=d.forwardRef(({className:t,...n},s)=>e.jsx(Ce,{className:L("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n,ref:s}));qe.displayName=Ce.displayName;const as=ke("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Ke=d.forwardRef(({side:t="right",className:n,children:s,...o},a)=>e.jsxs(rs,{children:[e.jsx(qe,{}),e.jsxs(Ne,{ref:a,className:L(as({side:t}),n),...o,children:[e.jsxs(_t,{className:"absolute right-4 top-4 roun
4ded-sm opacity-70 ring-offset-background cursor-pointer transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(Se,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]}),s]})]}));Ke.displayName=Ne.displayName;const We=({className:t,...n})=>e.jsx("div",{className:L("flex flex-col space-y-2 text-center sm:text-left",t),...n});We.displayName="SheetHeader";const Ze=d.forwardRef(({className:t,...n},s)=>e.jsx(we,{ref:s,className:L("text-lg font-semibold text-foreground",t),...n}));Ze.displayName=we.displayName;const ls=d.forwardRef(({className:t,...n},s)=>e.jsx(_e,{ref:s,className:L("text-sm text-muted-foreground",t),...n}));ls.displayName=_e.displayName;const cs=ke("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function G({className:t,variant:n,...s}){return e.jsx("div",{className:L(cs({variant:n}),t),...s})}const Q="newest",X="cards";function Y(t){return typeof t!="string"||!t?[]:t.split(",").map(n=>n.trim()).filter(Boolean)}function Ds(){const{data:t}=ot(nt),{cities:n,categories:s,listings:o}=t,a=t.cityStrip?.enabled!==!1,i=fe.useSearch(),c=et({from:fe.fullPath}),f=i.q??"",g=d.useMemo(()=>Y(i.cat),[i.cat]),l=d.useMemo(()=>Y(i.city),[i.city]),p=d.useMemo(()=>Y(i.tag),[i.tag]),x=i.sort??Q,j=i.view??X,v=d.useCallback((r,u={})=>{c({resetScroll:!1,search:b=>{const h={...b,...r};return h.q||delete h.q,h.cat||delete h.cat,h.city||delete h.city,h.tag||delete h.tag,(!h.sort||h.sort===Q)&&delete h.sort,(!h.view||h.view===X)&&delete h.view,h},replace:u.replace??!1})},[c]),_=d.useCallback(r=>v({q:r||void 0},{replace:!0}),[v]),N=d.useCallback(r=>v({cat:r.length?r.join(","):void 0}),[v]),k=d.useCallback(r=>v({city:r.length?r.join(","):void 0}),[v]),A=d.useCallback(r=>v({tag:r.length?r.join(","):void 0}),[v]),w=d.useCallback(r=>v({view:r===X?void 0:r},{replace:!0}),[v]),y=d.useCallback(r=>v({sort:r===Q?void 0:r},{replace:!0}),[v]),m=d.useMemo(()=>Object.fromEntries(n.map(r=>[r.slug,r])),[n]),C=d.useMemo(()=>Object.fromEntries(s.map(r=>[r.slug,r.name])),[s]),S=d.useMemo(()=>ms(s,o),[s,o]),M=d.useMemo(()=>{const r={};for(const u of o)r[u.city_slug]=(r[u.city_slug]??0)+1;return n.filter(u=>u.show_in_strip!==!1).map(u=>({...u,listingCount:r[u.slug]??0})).sort((u,b)=>{const h=(u.hero_image?0:1)-(b.hero_image?0:1);return h!==0?h:b.listingCount!==u.listingCount?b.listingCount-u.listingCount:u.name.localeCompare(b.name)})},[n,o]),I=d.useMemo(()=>{const r={};for(const u of o){const b=m[u.city_slug];b&&(r[b.slug]=(r[b.slug]??0)+1)}return[...n].filter(u=>r[u.slug]>0).sort((u,b)=>u.name.localeCompare(b.name)).map(u=>
4({value:u.slug,label:u.name,meta:String(r[u.slug]??0)}))},[n,m,o]),P=d.useMemo(()=>{const r=new Map;for(const u of I){const h=m[u.value]?.country?.trim()||"Other",O=r.get(h);O?O.push(u):r.set(h,[u])}return[...r.entries()].map(([u,b])=>({country:u,cities:b,total:b.reduce((h,O)=>h+Number(O.meta??0),0)})).sort((u,b)=>u.country.localeCompare(b.country))},[I,m]),D=d.useMemo(()=>{const r={};for(const u of o)for(const b of u.tags??[]){const h=b?.trim();h&&(r[h]=(r[h]??0)+1)}return Object.entries(r).sort(([u,b],[h,O])=>O-b||u.localeCompare(h)).map(([u,b])=>({value:u,label:u,meta:String(b)}))},[o]),$=d.useMemo(()=>{const r=f.trim().toLowerCase();return o.filter(u=>{const b=m[u.city_slug];if(r&&![u.name,te(u.short_review),u.address,b?.name,b?.country,...u.tags??[]].filter(Boolean).join(" ").toLowerCase().includes(r)||g.length>0&&!g.some(h=>u.category_slug===h||u.subcategory_slug===h)||l.length>0&&!l.includes(u.city_slug))return!1;if(p.length>0){const h=u.tags??[];if(!p.some(O=>h.includes(O)))return!1}return!0}).sort((u,b)=>{const h=(u.cover_image?0:1)-(b.cover_image?0:1);if(h!==0)return h;if(x==="alpha")return u.name.localeCompare(b.name);const O=u.created_at?Date.parse(u.created_at):0;return(b.created_at?Date.parse(b.created_at):0)-O})},[m,o,f,g,l,p,x]),ie=l.length,B=g.length+ie+p.length,Xe=!!(f||B),Z=()=>{c({search:{},replace:!0,resetScroll:!1})},[Ye,Je]=d.useState(["business","location","tags"]),[de,ue]=d.useState(null),me=e.jsx(is,{q:f,setQ:_,categoryOptions:S,cityOptions:I,countryGroups:P,tagOptions:D,selectedCategories:g,selectedCities:l,selectedTags:p,setSelectedCategories:N,setSelectedCities:k,setSelectedTags:A,activeFilterCount:B,locationCount:ie,clearAll:Z,openSections:Ye,setOpenSections:Je,filteredCount:$.length,totalCount:o.length});return e.jsxs("div",{className:"min-h-screen flex flex-col",children:[e.jsx(rt,{}),e.jsxs("main",{className:"flex-1",children:[e.jsx("section",{children:e.jsx("div",{className:"max-w-[1238px] mx-auto px-6",children:e.jsx("div",{className:"py-9 border-b hairline",children:e.jsx(lt,{eyebrow:"/ travel directory",children:e.jsx("p",{children:"This is a curated list of the businesses, attractions, sights, and activities I recommend to friends in cities across Europe, Africa, and Asia. I update it regularly, based on recent trips or my 15+ years of travel."})})})})}),a?e.jsx(Rt,{cities:M}):null,e.jsxs("section",{className:"max-w-[1238px] mx-auto px-6 py-9 w-full",children:[e.jsxs("div",{className:"lg:hidden mb-4 flex items-center justify-between gap-3",children:[e.jsxs(ns,{children:[e.jsx(os,{asChild:!0,children:e.jsxs(kt,{variant:"outline",className:"rounded-none gap-2",children:[e.jsx(pt,{className:"h-4 w-4"}),"Filters",B>0&&e.jsx(G,{variant:"secondary",className:"h-5 px-1.5 rounded-none font-sans text-[10px]",children:B})]})}),e.jsxs(Ke,{side:"left",className:"w-[340px] sm:w-[380px] p-0 flex flex-col",children:[e.jsx(We,{className:"px-4 py-3 border-b hairline",children:e.jsx(Ze,{className:"text-base",children:"Filters"})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:me}),e.jsxs("div",{className:"border-t hairline p-3 flex items-center justify-between gap-3",children:[e.jsx("button",{onClick:Z,className:"text-sm underline underline-offset-4 text-muted-foreground hover:text-foreground",children:"Reset all"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[$.length," results"]})]})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[$.length," of ",o.length]})]}),e.jsxs("div",{className:"grid lg:grid-cols-[280px_minmax(0,1fr)] gap-8 items-start",children:[e.jsx("aside",{className:"hidden lg:block sticky top-4 self-start",children:me}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("label",{className:"flex items-center gap-2 label",children:[e.jsx("span",{className:"sr-only",children:"Sort"}),e.jsx("select",{value:x,onChange:r=>y(r.target.value),className:"h-8 border hairline bg-background text-xs font-sans px-2 rounded-none focus:outline-none focus:border-foreground",children:tt.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))})]}),e.jsx("div",{className:"ml-auto flex items-center gap-1",role:"group","aria-label":"View",children:st.map(r=>{const u=r.icon,b=j===r.value;return e.jsxs("button",{type:"button",onClick:()=>w(r.value),"aria-pressed":b,"aria-label":r.label,className:`inline-flex items-center gap-1.5 border hairline rounded-md px-2.5 h-8 text-xs transition-colors ${b?"bg-foreground text-background border-foreground":"hover:border-foreground"}`,children:[e.jsx(u,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:r.label})]},r.value)})})]}),$.length&&j==="map"?e.jsxs("div",{className:"relative border hairline rounded-md overflow-hidden h-[70vh]",children:[e.jsx(Dt,{listings:$,cities:n,selectedId:de,onSelect:r=>ue(r.id)}),e.jsx(ds,{listing:$.find(r=>r.id===de)??null,categoryName:C,onClose:()=>ue(null)})]}):$.length&&j==="list"?e.jsx("div",{className:"border-t hairline",children:$.map(r=>e.jsx(Mt,{listing:r,cityName:m[r.city_slug]?.name,cityCountry:m[r.city_slug]?.country,categoryName:C[r.category_slug]},r.id))}):$.length?e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-5",children:$.map(r=>e.jsx(it,{listing:r,cityName:m[r.city_slug]?.name,cityCountry:m[r.city_slug]?.country,categoryName:C[r.category_slug]},r.id))}):e.jsxs("div",{className:"border hairline py-24 px-6 text-center",children:[e.jsx("p",{className:"label",children:"[ no results ]"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"No listings match the selected filters."}),Xe?e.jsx("button",{onClick:Z,className:"mt-4 inline-block border hairline px-3 py-2 text-xs font-sans uppercase hover:bg-foreground hover:text-background transition-colors",children:"Clear all filters"}):null]})]})]})]})]}),e.jsx(at,{})]})}function is({q:t,setQ:n,categoryOptions:s,cityOptions:o,countryGroups:a,tagOptions:i,selectedCategories:c,selectedCities:f,selectedTags:g,setSelectedCategories:l,setSelectedCities:p,setSelectedTags:x,activeFilterCount:j,locationCount:v,clearAll:_,openSections:N,setOpenSections:k,filteredCount:A}){return e.jsxs("div",{className:"border hairline bg-background",children:[e.jsxs("div",{className:"px-4 py-3 border-b hairline flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xt,{className:"h-4 w-4"}),e.jsx("h2",{className:"text-sm font-semibold",children:"Filters"}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[A," ",A===1?"result":"results"]})]}),j>0&&e.jsx("button",{onClick:_,className:"text-xs text-muted-foreground hover:text-foreground underline underline-offset-4",children:"Reset"})]}),e.jsx("div",{className:"px-4 pt-3 pb-1",children:e.jsxs("div",{className:"relative",children:[e.jsx(St,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx("input",{type:"text",placeholder:"Search by name, tag, city, country...",value:t,onChange:w=>n(w.target.value),className:"w-full h-10 pl-9 pr-8 border hairline bg-background text-sm rounded-md focus:outline-none focus:border-foreground"}),t&&e.jsx("button",{onClick:()=>n(""),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1 text-muted-foreground hover:text-foreground","aria-label":"Clear search",children:e.jsx(Se,{className:"h-4 w-4"})})]})}),e.jsxs(ss,{type:"multiple",value:N,onValueChange:k,className:"divide-y hairline",children:[e.jsxs(F,{value:"location",className:"border-0 px-4",children:[e.jsx(V,{className:"hover:no-underline py-4",children:e.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium",children:["Location",v>0&&e.jsx(G,{variant:"secondary",className:"h-5 px-1.5 rounded-none font-sans text-[10px]",children:v})]})}
4),e.jsxs(H,{className:"pb-4",children:[e.jsx(us,{groups:a,selected:f,onChange:p,emptyLabel:"No cities available"}),v>0&&e.jsx("button",{onClick:()=>p([]),className:"mt-3 text-xs text-muted-foreground hover:text-foreground underline underline-offset-4",children:"Clear location"})]})]}),e.jsxs(F,{value:"business",className:"border-0 px-4",children:[e.jsx(V,{className:"hover:no-underline py-4",children:e.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium",children:["Business type",c.length>0&&e.jsx(G,{variant:"secondary",className:"h-5 px-1.5 rounded-none font-sans text-[10px]",children:c.length})]})}),e.jsxs(H,{className:"pb-4",children:[e.jsx(he,{groupKey:"business",items:s,selected:c,onChange:l,emptyLabel:"No business types available"}),c.length>0&&e.jsx("button",{onClick:()=>l([]),className:"mt-3 text-xs text-muted-foreground hover:text-foreground underline underline-offset-4",children:"Clear business types"})]})]}),e.jsxs(F,{value:"tags",className:"border-0 px-4",children:[e.jsx(V,{className:"hover:no-underline py-4",children:e.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium",children:["Tags",g.length>0&&e.jsx(G,{variant:"secondary",className:"h-5 px-1.5 rounded-none font-sans text-[10px]",children:g.length})]})}
4),e.jsxs(H,{className:"pb-4",children:[e.jsx(he,{groupKey:"tag",items:i,selected:g,onChange:x,emptyLabel:"No tags available"}),g.length>0&&e.jsx("button",{onClick:()=>x([]),className:"mt-3 text-xs text-muted-foreground hover:text-foreground underline underline-offset-4",children:"Clear tags"})]})]})]})]})}function ds({listing:t,categoryName:n,onClose:s}){if(!t)return null;const o={city:t.city_slug,slug:t.slug};return e.jsxs("div",{className:"absolute left-3 right-3 bottom-3 z-10 bg-background border hairline shadow-lg flex gap-3 p-3 animate-in fade-in slide-in-from-bottom-2",children:[t.cover_image?e.jsx(T,{to:"/travel-directory/$city/$slug",params:o,className:"shrink-0",children:e.jsx("img",{src:t.cover_image,alt:t.name,className:"h-20 w-20 object-cover"})}):null,e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"label",children:n[t.category_slug]??t.category_slug.replace(/-/g," ")}),e.jsx(T,{to:"/travel-directory/$city/$slug",params:o,className:"block mt-0.5 font-medium hover:underline truncate",children:t.name}),t.short_review?e.jsx("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:te(t.short_review)}):e.jsx("p",{className:"mt-1 text-xs font-sans uppercase tracking-wider text-muted-foreground/60",children:"[ review coming soon ]"}),e.jsx(T,{to:"/travel-directory/$city/$slug",params:o,className:"mt-2 inline-block text-xs font-sans uppercase underline underline-offset-4 hover:no-underline",children:"View listing â"})]}),e.jsx("button",{onClick:s,"aria-label":"Close preview",className:"shrink-0 self-start p-1 text-muted-foreground hover:text-foreground",children:"â"})]})}function us({groups:t,selected:n,onChange:s,emptyLabel:o}){const[a,i]=d.useState(()=>t.filter(l=>l.cities.some(p=>n.includes(p.value))).map(l=>l.country));if(t.length===0)return e.jsx("p",{className:"text-xs text-muted-foreground py-1",children:o});const c=l=>i(p=>p.includes(l)?p.filter(x=>x!==l):[...p,l]),f=l=>s(n.includes(l)?Qe(n,l):[...n,l]),g=l=>{const p=l.cities.map(j=>j.value),x=p.every(j=>n.includes(j));s(x?n.filter(j=>!p.includes(j)):[...n,...p.filter(j=>!n.includes(j))])};return e.jsx("div",{className:"space-y-0.5",children:t.map(l=>{const p=l.cities.map(N=>N.value),x=p.filter(N=>n.includes(N)).length,j=x===0?!1:x===p.length?!0:"indeterminate",v=a.includes(l.country),_=`country-${l.country}`.replace(/\s+/g,"-").toLowerCase();return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-1 -mx-1 hover:bg-muted/50",children:[e.jsx("button",{type:"button",onClick:()=>c(l.country),"aria-expanded":v,"aria-label":`${v?"Collapse":"Expand"} ${l.country}`,className:"shrink-0 text-muted-foreground hover:text-foreground",children:e.jsx(ge,{className:L("h-3 w-3 transition-transform",v&&"rotate-90")})}),e.jsx(J,{id:_,checked:j,onCheckedChange:()=>g(l),className:"rounded-none"}),e.jsx("label",{htmlFor:_,className:"min-w-0 flex-1 text-sm truncate cursor-pointer",children:l.country}),e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:l.total})]}),v&&e.jsx("div",{className:"ml-[26px] border-l hairline pl-2",children:l.cities.map(N=>{const k=`city-${N.value}`.replace(/\s+/g,"-").toLowerCase();return e.jsxs("label",{htmlFor:k,className:"flex items-center gap-2 cursor-pointer py-1.5 px-1 -mx-1 hover:bg-muted/50",children:[e.jsx(J,{id:k,checked:n.includes(N.value),onCheckedChange:()=>f(N.value),className:"rounded-none"}),e.jsx("span",{className:"min-w-0 flex-1 text-sm truncate",children:N.label}),N.meta&&e.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:N.meta})]},N.value)})})]},l.country)})})}function he({groupKey:t,items:n,selected:s,onChange:o,emptyLabel:a}){const[i,c]=d.useState(!1),f=8,g=i?n:n.slice(0,f),l=Math.max(n.length-g.length,0);if(n.length===0)return e.jsx("p",{className:"text-xs text-muted-foreground py-1",children:a});const p=x=>{o(s.includes(x)?Qe(s,x):[...s,x])};return e.jsxs("div",{children:[e.jsx("div",{className:"space-y-1",children:g.map(x=>{const j=`${t}-${x.value}`.replace(/\s+/g,"-").toLowerCase(),v=s.includes(x.value);return e.jsxs("label",{htmlFor:j,className:"flex items-center gap-2 cursor-pointer py-1.5 px-1 -mx-1 hover:bg-muted/50",children:[e.jsx(J,{id:j,checked:v,onCheckedChange:()=>
4p(x.value),className:"rounded-none"}),e.jsx("span",{className:"min-w-0 flex-1 text-sm truncate",children:x.label}),x.meta&&e.jsx("span",{className:"label",children:x.meta})]},x.value)})}),l>0&&!i&&e.jsxs("button",{onClick:()=>c(!0),className:"mt-2 text-xs text-muted-foreground hover:text-foreground underline underline-offset-4",children:["Show ",l," more"]}),i&&n.length>f&&e.jsx("button",{onClick:()=>c(!1),className:"mt-2 text-xs text-muted-foreground hover:text-foreground underline underline-offset-4",children:"Show less"})]})}function ms(t,n){const s={},o=Object.fromEntries(t.map(a=>[a.slug,a]));for(const a of n){const c=o[a.category_slug]?.parent_slug??a.category_slug;s[c]=(s[c]??0)+1}return t.filter(a=>!a.parent_slug).sort((a,i)=>a.sort_order-i.sort_order||a.name.localeCompare(i.name)).filter(a=>(s[a.slug]??0)>0).map(a=>({value:a.slug,label:a.name,meta:String(s[a.slug]??0)}))}function Qe(t,n){return t.filter(s=>s!==n)}export{Ds as component};
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.