import{e as fe,r as m,j as t,b as ke,u as Ie}from"./vendor-react-DgEFbQIi.js";import{a3 as _e,a4 as Re,a5 as Te,a6 as Ee,V as Ae,a7 as W,B as L,a8 as re,a9 as Le,a as N,aa as xe,ab as Me,ac as De,ad as ge,ae as Oe,af as Pe,ag as Fe,X as pe,ah as He,ai as Ue,aj as $e,ak as We,al as ye,am as Ve,an as Ge,W as Qe,ao as ze,ap as Be,aq as Ye,G as ae,ar as Xe,as as Ke,at as qe,au as Je,av as Ze,aw as et,ax as tt,ay as st,U as be,S as D,az as nt,aA as rt,a2 as q,aB as at,aC as U,_ as it,aD as ot,aE as ct,s as lt,aF as dt}from"./index-DFVuS8SP.js";import{t as J,u as ut}from"./useHoverRipple-CBPqdLxA.js";import{C as ht}from"./circle-plus-DGhVgDs7.js";import{L as Z}from"./ListingCard-Cw2aMm7U.js";import"./vendor-amplify-BBi2B1tW.js";import{A as mt,u as ft}from"./vendor-maps-bOuA10hf.js";import{S as G}from"./star-C0MTo9W6.js";import{D as Q}from"./dollar-sign-Cz68EQu2.js";import{t as Y}from"./venues-BaWtNBkC.js";import{f as xt}from"./city-coordinates-9wKWO0xx.js";var gt=class extends _e{constructor(e,s){super(e,s)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,s){var w,p;const{state:a}=e,n=super.createResult(e,s),{isFetching:r,isRefetching:i,isError:o,isRefetchError:c}=n,l=(p=(w=a.fetchMeta)==null?void 0:w.fetchMore)==null?void 0:p.direction,u=o&&l==="forward",h=r&&l==="forward",f=o&&l==="backward",g=r&&l==="backward";return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Te(s,a.data),hasPreviousPage:Re(s,a.data),isFetchNextPageError:u,isFetchingNextPage:h,isFetchPreviousPageError:f,isFetchingPreviousPage:g,isRefetchError:c&&!u&&!f,isRefetching:i&&!h&&!g}}};function pt(e,s){return Ee(e,gt)}const yt=({hasSearchParams:e,query:s})=>{const a=fe(),{user:n}=Ae(),[r,i]=m.useState(!1),[o,c]=m.useState(null);return m.useLayoutEffect(()=>{const l=()=>{const u=document.querySelector("header"),h=u?u.getBoundingClientRect().height:0,f=window.innerHeight-h;c(f>0?f:window.innerHeight)};return l(),window.addEventListener("resize",l),window.addEventListener("orientationchange",l),()=>{window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l)}},[]),t.jsxs("div",{className:"flex flex-col items-center justify-center px-4 py-8",style:{minHeight:o?`${o}px`:void 0},children:[t.jsxs("div",{className:"max-w-md w-full text-center space-y-4",children:[t.jsx("div",{className:"flex justify-center",children:t.jsx("div",{className:"w-24 h-24 rounded-full bg-muted flex items-center justify-center",children:t.jsx(W,{className:"w-12 h-12 text-muted-foreground"})})}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:e?s?`No venues found with keyword "${s}"`:"No venues match your search":"No venues available yet"}),t.jsx("p",{className:"text-muted-foreground",children:e?"Try adjusting your filters or search criteria":"Be the first to list a venue in your area"})]}),t.jsx("div",{className:"flex flex-col sm:flex-row gap-3 justify-center pt-4",children:e?t.jsxs(t.Fragment,{children:[t.jsxs(L,{variant:"outline",onClick:()=>a("/venues"),className:"gap-2",children:[t.jsx(re,{className:"w-4 h-4"}),"Clear Filters"]}),t.jsx(L,{onClick:()=>a("/venues"),className:"gap-2",children:"Browse All Venues"})]}):t.jsxs(t.Fragment,{children:[t.jsxs(L,{variant:"outline",onClick:()=>a("/"),className:"gap-2",children:[t.jsx(re,{className:"w-4 h-4"}),"Back to Home"]}),t.jsxs(L,{onClick:()=>{i(!0)},className:"bg-brand hover:bg-brand/90 text-brand-foreground gap-2",children:[t.jsx(ht,{className:"w-4 h-4"}),"List Your Venue"]})]})}),t.jsx("div",{className:"pt-8 border-t border-border",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Looking for something specific?"," ",t.jsx("button",{onClick:()=>a("/help"),className:"text-brand hover:underline font-medium",children:"Visit Help Center"})]})})]}),t.jsx(Le,{open:r,onOpenChange:i})]})},us=({items:e,selectedId:s,onSelect:a,className:n})=>t.jsx("div",{className:N("flex gap-2 overflow-x-auto scrollbar-hide",n),children:e.map(r=>{const i=r.id===s;return t.jsxs("button",{type:"button","aria-pressed":i,onClick:()=>a(i?void 0:r.id),className:N("rounded-full border px-4 py-2 text-sm font-medium whitespace-nowrap transition-colors",i?"bg-brand text-brand-foreground border-brand":"bg-white text-foreground border-border hover:border-foreground"),children:[r.icon?t.jsx("span",{className:"mr-2 inline-flex items-center align-middle",children:r.icon}):null,r.label]},r.id)})}),bt=200;function vt(e){var n,r,i,o,c;const s=(r=(n=e.structured_formatting)==null?void 0:n.main_text)==null?void 0:r.trim(),a=(c=(o=(i=e.structured_formatting)==null?void 0:i.secondary_text)==null?void 0:o.split(",")[0])==null?void 0:c.trim();return s&&a?`${s}, ${a}`:e.description}const wt=({query:e,children:s})=>{const a=ft("places"),n=m.useRef(null),[r,i]=m.useState({matches:[],isLoading:!1});return m.useEffect(()=>{a&&!n.current&&(n.current=new a.AutocompleteService)},[a]),m.useEffect(()=>{const o=e.trim();if(o.length<2||o.toLowerCase()==="nearby"){i({matches:[],isLoading:!1});return}let c=!1;i(u=>({...u,isLoading:!0}));const l=window.setTimeout(()=>{const u=n.current;if(!u){i({matches:[],isLoading:!1});return}u.getPlacePredictions({input:o,types:["(cities)"],componentRestrictions:{country:"us"}},(h,f)=>{if(c)return;const g=f===google.maps.places.PlacesServiceStatus.OK&&h;i({isLoading:!1,matches:g?h.map(y=>{var p,x;const w=vt(y);return{title:((p=y.structured_formatting)==null?void 0:p.main_text)||w,subtitle:((x=y.structured_formatting)==null?void 0:x.secondary_text)||void 0,value:w,placeId:y.place_id}}):[]})})},bt);return()=>{c=!0,window.clearTimeout(l)}},[e,a]),t.jsx(t.Fragment,{children:s(r)})},jt=({query:e,children:s})=>{const a=m.useMemo(()=>{const n=e.trim();return!n||n.toLowerCase()==="nearby"?[]:xt(n).map(r=>({title:r.label,value:r.label}))},[e]);return t.jsx(t.Fragment,{children:s({matches:a,isLoading:!1})})},Nt=({query:e,children:s})=>ae?t.jsx(mt,{apiKey:ae,children:t.jsx(wt,{query:e,children:s})}):t.jsx(jt,{query:e,children:s}),St={what:"What?",where:"Where?",when:"When?",who:"Who?"},ve=({listboxId:e,value:s,onChange:a,onKeyDown:n,activeOptionId:r,placeholder:i,label:o})=>{const c=m.useRef(null);return t.jsxs("div",{className:"flex h-14 items-center gap-3 rounded-2xl border border-input bg-card px-4 transition-shadow focus-within:border-foreground focus-within:ring-1 focus-within:ring-foreground",children:[t.jsx(W,{className:"h-5 w-5 shrink-0 text-muted-foreground","aria-hidden":!0}),t.jsx("input",{ref:c,type:"text",role:"combobox","aria-label":o,"aria-expanded":!0,"aria-controls":e,"aria-activedescendant":r,"aria-autocomplete":"list",autoComplete:"off",enterKeyHint:"search",autoFocus:!0,value:s,placeholder:i,onChange:l=>a(l.target.value),onKeyDown:n,className:"h-full min-w-0 flex-1 bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground"}),s&&t.jsx("button",{type:"button",onMouseDown:l=>l.preventDefault(),onClick:()=>{var l;a(""),(l=c.current)==null||l.focus()},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted","aria-label":"Clear text",children:t.jsx(pe,{className:"h-4 w-4","aria-hidden":!0})})]})},Ct=({segment:e,onExpand:s})=>t.jsxs("button",{type:"button","aria-label":`${e.label}, ${e.value??e.placeholder}`,"aria-expanded":!1,onClick:s,className:"flex h-14 w-full items-center justify-between gap-4 rounded-2xl border border-border bg-card px-5 text-left shadow-sm transition-shadow active:shadow-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsx("span",{className:"shrink-0 text-sm text-muted-foreground",children:e.label}),t.jsx("span",{className:"min-w-0 truncate text-sm font-semibold text-foreground",children:e.value??e.placeholder})]}),kt=({tab:e,search:s,onClose:a,onDone:n})=>{var b;const r=fe(),{draft:i}=s,o=xe(i,e),[c,l]=m.useState("what"),[u,h]=m.useState(!1),f=d=>{d==="where"&&h(!1),l(d)},g=ke.useId(),y=`${g}-what`,w=`${g}-where`,p=o.some(d=>d.id===c)?c:"what",x=()=>{n(),s.submit()},S=((b=i.what)==null?void 0:b.kind)==="text"?i.what.text:"",{suggestions:C,isLoading:j}=Me({query:S,enabled:p==="what",minQueryLength:2,debounceMs:250}),_=m.useMemo(()=>De({query:S,tab:e,listings:C,isLoadingNames:j}),[S,e,C,j]),R=d=>{switch(d.type){case"listing":if(!d.suggestion.listingId)return;n(),r(Ye(d.suggestion));return;case"venue-type":s.pickVenueType(d.value),f("where");return;case"service-type":s.pickServiceType(d.value),f("where");return;case"text-search":s.setWhatText(d.query),x();return}},k=ge({rowCount:p==="what"?_.rows.length:0,resetKey:S,onPick:d=>{const v=_.rows[d];v&&R(v)},onSubmit:x}),[H]=m.useState(()=>Oe()),O=i.where.text,T=u?O:"",M=Pe(i,e)==="services",P=m.useMemo(()=>[{id:"nearby",label:"Nearby",subtitle:M?"Find services near you":"Find venues near you"},...Fe],[M]),V=d=>{switch(d.type){case"nearby":s.setWhereText("Nearby");break;case"recent":s.setWhereText(d.recent.label);break;case"destination":s.setWhereText(d.title);break;case"place":s.setWhereText(d.value);break;case"text-search":s.setWhereText(d.query),x();return}f("when")};return t.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-muted/50",children:[t.jsx("div",{className:"flex items-center px-3 pb-1 pt-[max(env(safe-area-inset-top),0.75rem)]",children:t.jsx(L,{type:"button",variant:"ghost",size:"icon",onClick:a,"aria-label":"Close search",className:"h-11 w-11 [&_svg]:size-5",children:t.jsx(pe,{"aria-hidden":!0})})}),t.jsx(He,{className:"sr-only",children:"Search"}),t.jsx(Ue,{className:"sr-only",children:"Pick what, where, when and who, then search. Every part is optional."}),t.jsx("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto overscroll-contain px-4 pb-4",children:o.map(d=>{if(d.id!==p)return t.jsx(Ct,{segment:d,onExpand:()=>f(d.id)},d.id);const v=`${g}-${d.id}-title`;return t.jsxs("section",{"aria-labelledby":v,"data-expanded":!0,className:"rounded-3xl border border-border bg-card p-4 shadow-lg",children:[t.jsx("h2",{id:v,className:"px-1 pb-3 text-[26px] leading-tight text-foreground",children:St[d.id]}),d.id==="what"&&t.jsxs(t.Fragment,{children:[t.jsx(ve,{listboxId:y,value:S,onChange:I=>s.setWhatText(I),onKeyDown:k.onKeyDown,activeOptionId:k.activeIndex>=0?ye(y,k.activeIndex):void 0,placeholder:e==="services"?$e:We,label:"Search venue types, services, or names"}),t.jsx("div",{className:"-mx-2 mt-2 max-h-[46dvh] overflow-y-auto overscroll-contain",children:t.jsx(Ve,{listboxId:y,result:_,activeIndex:k.activeIndex,onHighlight:k.setActiveIndex,onPick:I=>R(I),size:"large"})})]}),d.id==="where"&&t.jsx(Nt,{query:T,children:({matches:I,isLoading:B})=>t.jsx(It,{listboxId:w,value:O,onChange:E=>{h(!0),s.setWhereText(E)},result:Ge({query:T,places:I,recents:H,destinations:P,nearbySubtitle:P[0].subtitle,isLoading:B,offerTextSearch:!0,textSearchSubtitle:M?"Search this area":"Places, names and keywords that match"}),resetKey:T,onPick:V,onSubmit:x})}),d.id==="when"&&t.jsx(Qe,{value:i.whenUi,onChange:s.setWhenUi}),d.id==="who"&&t.jsx(ze,{value:i.guests,onChange:s.setGuests,className:"px-1 pb-1"})]},d.id)})}),t.jsxs("div",{className:"flex items-center justify-between gap-4 border-t border-border bg-background px-5 pb-[max(env(safe-area-inset-bottom),0.75rem)] pt-3",children:[t.jsx("button",{type:"button",onClick:()=>{s.clearAll(),f("what")},disabled:Be(i),className:"text-sm font-semibold text-foreground underline underline-offset-4 disabled:opacity-40",children:"Clear all"}),t.jsxs(L,{type:"button",onClick:x,className:"h-12 px-8 text-base font-semibold",children:[t.jsx(W,{"aria-hidden":!0}),"Search"]})]})]})},It=({listboxId:e,value:s,onChange:a,result:n,resetKey:r,onPick:i,onSubmit:o})=>{const c=ge({rowCount:n.rows.length,resetKey:r,onPick:l=>{const u=n.rows[l];u&&i(u)},onSubmit:o});return t.jsxs(t.Fragment,{children:[t.jsx(ve,{listboxId:e,value:s,onChange:a,onKeyDown:c.onKeyDown,activeOptionId:c.activeIndex>=0?ye(e,c.activeIndex):void 0,placeholder:"City, neighborhood, or address",label:"Search a city, neighborhood, or address"}),t.jsx("div",{className:"-mx-2 mt-2 max-h-[46dvh] overflow-y-auto overscroll-contain",children:t.jsx(Xe,{listboxId:e,result:n,activeIndex:c.activeIndex,onHighlight:c.setActiveIndex,onPick:l=>i(l),size:"large"})})]})},X="Start your search",_t=({compact:e=!1,className:s})=>{const{pathname:a}=Ie(),n=Ke(a),r=qe(n),[i,o]=m.useState(!1),c=Je(r.urlDraft,n),l=xe(r.urlDraft,n).filter(f=>!f.value).map(f=>f.shortPlaceholder).join(" · "),u=c?`Search: ${c}`:X,h=()=>{o(!1),r.reset()};return t.jsxs("div",{className:N("relative",s),children:[e?t.jsxs("button",{type:"button",onClick:()=>o(!0),"aria-haspopup":"dialog","aria-expanded":i,"aria-label":u,className:"flex h-11 w-full min-w-0 items-center gap-3 rounded-full border border-border bg-card px-4 text-left shadow-sm transition-shadow active:shadow-none",children:[t.jsx(W,{className:"h-5 w-5 shrink-0 text-foreground","aria-hidden":!0}),t.jsx("span",{className:N("min-w-0 flex-1 truncate text-sm",c?"font-semibold text-foreground":"text-muted-foreground"),children:c??X})]}):t.jsxs("button",{type:"button",onClick:()=>o(!0),"aria-haspopup":"dialog","aria-expanded":i,"aria-label":u,className:"flex h-[60px] w-full min-w-0 items-center gap-3 rounded-full border border-border bg-card pl-6 pr-2 text-left shadow-lg outline-none transition-shadow active:shadow-md focus-visible:ring-2 focus-visible:ring-ring",children:[t.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[t.jsx("span",{className:"truncate text-sm font-semibold leading-5 text-foreground",children:c??X}),l&&t.jsx("span",{className:"truncate text-xs leading-4 text-muted-foreground",children:l})]}),t.jsx("span",{"aria-hidden":!0,className:N(Ze({size:"icon"}),"h-11 w-11 shrink-0 [&_svg]:size-5"),children:t.jsx(W,{})})]}),t.jsx(et,{open:i,onOpenChange:f=>f?o(!0):h(),children:t.jsx(tt,{fullScreen:!0,hideCloseButton:!0,className:"flex flex-col bg-background",onOpenAutoFocus:f=>f.preventDefault(),children:t.jsx(kt,{tab:n,search:r,onClose:h,onDone:()=>o(!1)})})})]})},ie=.5,Rt=1e3,oe=new Set;function ee(){const e=m.useRef(null),s=m.useRef(new Map),a=m.useCallback(()=>e.current?e.current:typeof IntersectionObserver>"u"?null:(e.current=new IntersectionObserver(r=>{for(const i of r){const o=s.current.get(i.target);if(o)if(i.isIntersecting&&i.intersectionRatio>=ie){if(o.timer)continue;o.timer=setTimeout(()=>{o.timer=null;try{const c=`${st()}|${o.meta.listingId}|${window.location.pathname}`;if(oe.has(c))return;oe.add(c),be("listing_impression",o.meta)}catch{}},Rt)}else o.timer&&(clearTimeout(o.timer),o.timer=null)}},{threshold:ie}),e.current),[]),n=m.useCallback((r,i)=>{if(!r)return;const o=a();if(!o)return;const c=s.current.get(r);if(c){c.meta=i;return}s.current.set(r,{meta:i,timer:null}),o.observe(r)},[a]);return m.useEffect(()=>{const r=s.current;return()=>{var i;for(const o of r.values())o.timer&&clearTimeout(o.timer);r.clear(),(i=e.current)==null||i.disconnect(),e.current=null}},[]),{observeImpression:n}}const ce=({venues:e,label:s,isMobile:a,serializedSearchParams:n,hasAreaResults:r})=>{const{observeImpression:i}=ee();return e.length===0?null:t.jsxs("section",{className:N(r&&"mt-10 border-t border-border pt-8"),children:[t.jsxs("h3",{className:"mb-1 text-base font-medium text-gray-900",children:["Recommended ",s]}),t.jsx("p",{className:"mb-4 text-sm text-gray-500",children:r?`Strong matches from ${s}.`:`Nothing matched directly, but these ${s} did.`}),t.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-2 md:gap-4 xl:grid-cols-3 [grid-auto-rows:1fr]",children:e.map((o,c)=>t.jsx("div",{ref:l=>i(l,{listingId:o.id,category:"venue",position:c+1,source:"search_cross_kind"}),onClickCapture:l=>J({listingId:o.id,category:"venue",position:c+1,source:"search_cross_kind",searchQuery:n},l),children:t.jsx(Z,{kind:"venue",venue:o,hideOverlays:a,className:"h-full",searchQuery:n})},o.id))})]})},Tt=({count:e=8})=>{const s=Array.from({length:e});return t.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-2 md:gap-4 xl:grid-cols-3 [grid-auto-rows:1fr]",children:s.map((a,n)=>t.jsx("div",{className:"transition-shadow duration-150",children:t.jsxs("div",{className:"group flex h-full flex-col rounded-2xl bg-white",children:[t.jsx(D,{className:"aspect-square w-full rounded-2xl"}),t.jsxs("div",{className:"flex flex-1 flex-col gap-0.5 pt-2 px-0.5 pb-3 md:px-1.5 bg-white rounded-b-2xl",children:[t.jsx(D,{className:"h-4 w-3/4"}),t.jsxs("div",{className:"flex items-center gap-3 mt-1",children:[t.jsx(D,{className:"h-3 w-20"}),t.jsx(D,{className:"h-3 w-12"})]})]})]})},n))})},Et=({showResultsHeader:e=!1})=>t.jsxs("div",{className:"flex-1 pr-2",children:[e&&t.jsx("div",{className:"mb-4 flex-shrink-0",children:t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx(D,{className:"h-6 w-64"})," ",t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(D,{className:"h-4 w-16 hidden sm:block"})," ",t.jsx(D,{className:"h-9 w-[160px] sm:w-[180px] rounded-md"})," "]})]})}),t.jsx(Tt,{count:6})]});function At({onLoadMore:e,hasMore:s,isLoading:a,root:n,rootMargin:r="600px"}){const i=m.useRef(null),o=m.useRef(e);return o.current=e,m.useEffect(()=>{const c=i.current;if(!c||!s||a)return;const l=new IntersectionObserver(u=>{var h;(h=u[0])!=null&&h.isIntersecting&&o.current()},{root:(n==null?void 0:n.current)??null,rootMargin:r});return l.observe(c),()=>l.disconnect()},[s,a,n,r]),i}function Lt({total:e,query:s,location:a,noun:n={one:"venue",many:"venues"}}){const r=(s==null?void 0:s.trim())||"",i=a.trim(),o=!!r&&r.toLowerCase()===i.toLowerCase(),c=e===1?n.one:n.many,l=r&&!o?` with keyword "${r}"`:"",u=i?` in ${i}`:"";return`${e} ${c} found${l}${u}`}const Mt=500,le=new Set;function Dt(){try{return window.matchMedia("(hover: hover) and (pointer: fine)").matches}catch{return!1}}function Ot(e){let s=null;return{onHoverStart:()=>{try{if(!Dt())return;s=Date.now()}catch{}},onHoverEnd:()=>{try{if(s===null)return;const a=Date.now()-s;if(s=null,a<=Mt)return;const n=`${window.location.pathname}|${e}`;if(le.has(n))return;le.add(n),be("listing_card_hover",{listingId:e,ms:a})}catch{}}}}const Pt=({searchResults:e,displayLocation:s,query:a,sortBy:n,effectiveSort:r,canSortByDistance:i,onSortChange:o,isMobile:c,resultNoun:l})=>t.jsx("div",{className:"mb-4 flex-shrink-0",children:t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("h2",{className:"text-base md:text-lg font-medium text-gray-900",style:{fontSize:c?"0.875rem":"1rem",lineHeight:c?"1.25rem":"1.5rem"},children:Lt({total:e.meta.total,query:a,location:s,noun:l})}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsxs(nt,{value:r,onValueChange:u=>o(u),children:[t.jsx(rt,{className:"w-[160px] sm:w-[180px] h-9 text-sm border-gray-200 hover:bg-gray-50 focus:ring-0 focus:ring-ring focus:ring-offset-0",children:t.jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[n==="relevance"&&t.jsx(G,{className:"w-4 h-4 flex-shrink-0 text-gray-600"}),n==="price_asc"&&t.jsx(Q,{className:"w-4 h-4 flex-shrink-0 text-gray-600"}),n==="price_desc"&&t.jsx(Q,{className:"w-4 h-4 flex-shrink-0 text-gray-600"}),n==="distance"&&t.jsx(q,{className:"w-4 h-4 flex-shrink-0 text-gray-600"}),n==="rating"&&t.jsx(G,{className:"w-4 h-4 flex-shrink-0 text-gray-600"}),t.jsxs("span",{className:"truncate text-sm",children:[n==="relevance"&&"Relevance",n==="price_asc"&&"Low to High",n==="price_desc"&&"High to Low",n==="distance"&&"Distance",n==="rating"&&"Rating"]})]})}),t.jsxs(at,{children:[t.jsx(U,{value:"relevance",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(G,{className:"w-4 h-4"}),t.jsx("span",{children:"Relevance"})]})}),t.jsx(U,{value:"price_asc",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Q,{className:"w-4 h-4"}),t.jsx("span",{children:"Low to High"})]})}),t.jsx(U,{value:"price_desc",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Q,{className:"w-4 h-4"}),t.jsx("span",{children:"High to Low"})]})}),t.jsx(U,{value:"distance",disabled:!i,children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(q,{className:"w-4 h-4"}),t.jsx("span",{children:"Distance"}),!i&&t.jsx("span",{className:"text-xs text-muted-foreground",children:"(pick an address or search an area)"})]})}),t.jsx(U,{value:"rating",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(G,{className:"w-4 h-4"}),t.jsx("span",{children:"Rating"})]})})]})]}),!i&&t.jsx("p",{className:"text-[11px] text-gray-500 hidden md:block",children:"Search a specific address, or pan the map and click “Search this areaâ€, to enable distance sorting."})]})]})}),de=({venues:e,query:s,isMobile:a,serializedSearchParams:n,hasAreaResults:r})=>{const{observeImpression:i}=ee();return e.length===0?null:t.jsxs("section",{className:N(r&&"mt-10 border-t border-border pt-8"),children:[t.jsxs("h3",{className:"mb-1 text-base font-medium text-gray-900",children:['Other matches for "',s,'"']}),t.jsx("p",{className:"mb-4 text-sm text-gray-500",children:r?"Outside your search area or filters.":"Nothing matched in your search area, but these did elsewhere."}),t.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-2 md:gap-4 xl:grid-cols-3 [grid-auto-rows:1fr]",children:e.map((o,c)=>t.jsx("div",{ref:l=>i(l,{listingId:o.id,category:"venue",position:c+1,source:"search_outside_area"}),onClickCapture:l=>J({listingId:o.id,category:"venue",position:c+1,source:"search_outside_area",searchQuery:n},l),children:t.jsx(Z,{kind:"venue",venue:o,hideOverlays:a,className:"h-full",searchQuery:n})},o.id))})]})},hs=({searchResults:e,venues:s,outsideAreaVenues:a=[],crossKindVenues:n=[],crossKindLabel:r="services",resultNoun:i={one:"venue",many:"venues"},searchLoading:o,searchError:c,onRetry:l,displayLocation:u,query:h,sortBy:f,effectiveSort:g,canSortByDistance:y,onSortChange:w,isMobile:p,hasSearchParams:x,activeVenueId:S,onVenueHighlight:C,serializedSearchParams:j,onLoadMore:_,hasNextPage:R,isFetchingNextPage:k,scrollRootRef:H})=>{const O=At({onLoadMore:_,hasMore:R,isLoading:k,root:H}),{onItemHover:T,getStyle:M}=ut("grid"),{observeImpression:P}=ee(),V=m.useMemo(()=>new Map(s.map(d=>[d.id,Ot(d.id)])),[s]),b=()=>{if(c)return t.jsx("div",{className:"flex items-center justify-center py-12",children:t.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 max-w-md",children:[t.jsx("h3",{className:"text-red-800 font-semibold mb-2",children:"Search Error"}),t.jsx("p",{className:"text-red-700 text-sm mb-4",children:c}),t.jsx("button",{onClick:l,className:"bg-red-600 text-white px-4 py-2 rounded-lg hover:bg-red-700",children:"Try Again"})]})});if(o)return t.jsx(Et,{showResultsHeader:!!e});const d=(h==null?void 0:h.trim())||"";return s.length===0?(n.length>0||a.length>0)&&d?t.jsxs(t.Fragment,{children:[t.jsx(ce,{venues:n,label:r,isMobile:p,serializedSearchParams:j,hasAreaResults:!1}),t.jsx(de,{venues:a,query:d,isMobile:p,serializedSearchParams:j,hasAreaResults:!1})]}):t.jsx(yt,{hasSearchParams:!0,query:h||void 0}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:N("grid grid-cols-2 gap-3 md:grid-cols-2 md:gap-4 xl:grid-cols-3 [grid-auto-rows:1fr]"),onMouseLeave:()=>T(null),children:s.map((v,I)=>{const B=S===v.id,E=V.get(v.id);return t.jsx("div",{ref:F=>P(F,{listingId:v.id,category:"venue",position:I+1,source:"search"}),onClickCapture:F=>J({listingId:v.id,category:"venue",position:I+1,source:"search",searchQuery:j},F),className:"transition-[transform,box-shadow] duration-300 ease-out will-change-transform",style:M(I),onMouseEnter:()=>{C(v.id),E==null||E.onHoverStart(),T(I)},onMouseLeave:()=>{C(null),E==null||E.onHoverEnd()},onFocusCapture:()=>C(v.id),onBlurCapture:F=>{const ne=F.relatedTarget;(!ne||!F.currentTarget.contains(ne))&&C(null)},children:t.jsx(Z,{kind:"venue",venue:v,hideOverlays:p,className:N("h-full",B?"border-[hsl(var(--brand))] shadow-lg":""),searchQuery:j})},v.id)})}),t.jsx("div",{ref:O,"aria-hidden":"true",className:"h-px w-full"}),k&&t.jsx("div",{className:"flex items-center justify-center py-6",children:t.jsx(it,{className:"h-5 w-5 animate-spin text-gray-400"})}),R&&!k&&t.jsx("div",{className:"flex items-center justify-center py-6",children:t.jsxs("button",{type:"button",onClick:_,className:"rounded-full border border-border glass glass-surface px-6 py-2.5 text-sm font-medium text-foreground hover:border-foreground",children:["Show more ",i.many]})}),!R&&s.length>0&&t.jsx("p",{className:"py-6 text-center text-sm text-gray-400",children:"You've reached the end of the results"}),d&&t.jsx(ce,{venues:n,label:r,isMobile:p,serializedSearchParams:j,hasAreaResults:!0}),d&&t.jsx(de,{venues:a,query:d,isMobile:p,serializedSearchParams:j,hasAreaResults:!0})]})};return t.jsxs("div",{className:"flex-1 pr-2",children:[e&&t.jsx(Pt,{resultNoun:i,searchResults:e,displayLocation:u,query:h,sortBy:f,effectiveSort:g,canSortByDistance:y,onSortChange:w,isMobile:p}),b()]})},ms=({notice:e,onSearchRealLocation:s,onChangeLocation:a,className:n})=>t.jsxs("div",{role:"status","data-testid":"location-fallback-notice",className:N("mb-4 flex flex-col gap-3 rounded-xl border border-amber-200 bg-amber-50 p-4","sm:flex-row sm:items-center sm:justify-between",n),children:[t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx(q,{className:"mt-0.5 h-5 w-5 flex-shrink-0 text-amber-600","aria-hidden":"true"}),t.jsxs("div",{className:"space-y-1",children:[t.jsx("p",{className:"text-sm font-semibold text-gray-900",children:e.message}),t.jsx("p",{className:"text-xs text-gray-600",children:e.detail})]})]}),t.jsxs("div",{className:"flex flex-shrink-0 flex-wrap gap-2",children:[t.jsx(L,{type:"button",variant:"outline",size:"sm",className:"rounded-full bg-white",onClick:s,children:e.searchRealLabel}),t.jsx(L,{type:"button",variant:"ghost",size:"sm",className:"rounded-full",onClick:a,children:"Change location"})]})]}),te="plec_location",we=30;function Ft(e,s,a=we){if(typeof document>"u")return;const n=new Date(Date.now()+a*864e5).toUTCString();document.cookie=`${e}=${encodeURIComponent(s)}; expires=${n}; path=/; SameSite=Lax`}function Ht(){const e=ot(te);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function z(e){Ft(te,JSON.stringify(e),we)}function fs(){typeof document>"u"||(document.cookie=`${te}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`)}const Ut=30*24*60*60*1e3;function xs(e){const s=se(e);if(!(s!=null&&s.city)||!(s!=null&&s.state))return;const a={city:s.city,state:s.state,detectedAt:new Date().toISOString()};z(a)}function gs(){const e=je();return!(e!=null&&e.city)||!(e!=null&&e.state)?"":`${e.city}, ${e.state}`}function je(){const e=Ht();if(!(e!=null&&e.city))return null;const s=new Date(e.detectedAt).getTime();return!Number.isFinite(s)||Date.now()-s>=Ut?null:e}const Ne={alabama:"AL",alaska:"AK",arizona:"AZ",arkansas:"AR",california:"CA",colorado:"CO",connecticut:"CT",delaware:"DE","district of columbia":"DC",florida:"FL",georgia:"GA",hawaii:"HI",idaho:"ID",illinois:"IL",indiana:"IN",iowa:"IA",kansas:"KS",kentucky:"KY",louisiana:"LA",maine:"ME",maryland:"MD",massachusetts:"MA",michigan:"MI",minnesota:"MN",mississippi:"MS",missouri:"MO",montana:"MT",nebraska:"NE",nevada:"NV","new hampshire":"NH","new jersey":"NJ","new mexico":"NM","new york":"NY","north carolina":"NC","north dakota":"ND",ohio:"OH",oklahoma:"OK",oregon:"OR",pennsylvania:"PA","rhode island":"RI","south carolina":"SC","south dakota":"SD",tennessee:"TN",texas:"TX",utah:"UT",vermont:"VT",virginia:"VA",washington:"WA","west virginia":"WV",wisconsin:"WI",wyoming:"WY"},$t=new Set(Object.values(Ne));function ps(e){var r;const s=e.city.trim().toLowerCase(),a=(r=e.state)==null?void 0:r.trim().toUpperCase(),n=A.find(i=>i.city.toLowerCase()===s&&(!a||i.state===a));return n?{lat:n.lat,lng:n.lng}:void 0}function ue(e){const s=e.trim().replace(/\.$/,"");if(s){if(/^[A-Za-z]{2}$/.test(s)){const a=s.toUpperCase();return $t.has(a)?a:void 0}return Ne[s.toLowerCase()]}}function se(e){if(!e)return null;const s=e.trim();if(!s)return null;const n=s.replace(/[,\s]+(USA|U\.S\.A\.?|US|United States)$/i,"").trim().split(",").map(o=>o.trim()).filter(Boolean);if(n.length===0)return null;if(n.length===1){const o=n[0].match(/^(.+)\s+([A-Za-z.]+)$/),c=o?ue(o[2]):void 0;return o&&c?{city:o[1].trim(),state:c}:{city:n[0]}}const r=n[0],i=ue(n.slice(1).join(" "));return i?{city:r,state:i}:{city:r}}function Se(e){const s=e==null?void 0:e.trim().toLowerCase();return s==="nearby"||s==="current location"}function Wt(){if(typeof window>"u")return null;const s=new URLSearchParams(window.location.search).get("location");return!s||Se(s)?null:se(s)}function Vt(){return new Promise(e=>{if(typeof navigator>"u"||!navigator.geolocation){e(null);return}navigator.geolocation.getCurrentPosition(async s=>{var r;const{latitude:a,longitude:n}=s.coords;try{const i=window.google;(r=i==null?void 0:i.maps)!=null&&r.Geocoder?new i.maps.Geocoder().geocode({location:{lat:a,lng:n}},(c,l)=>{if(l==="OK"&&(c!=null&&c[0])){const u=c[0].address_components,h=u.find(g=>g.types.includes("locality")),f=u.find(g=>g.types.includes("administrative_area_level_1"));if(h&&f){const g={city:h.long_name,state:f.short_name,formatted:c[0].formatted_address,coordinates:{lat:a,lng:n},detectedAt:new Date().toISOString()};z(g),e(g)}else e(null)}else e(null)}):e(null)}catch(i){console.warn("Geolocation error:",i),e(null)}},s=>{console.warn("Geolocation denied or failed:",s),e(null)},{timeout:5e3,maximumAge:3e5})})}const A=[{city:"Austin",state:"TX",lat:30.2672,lng:-97.7431},{city:"Houston",state:"TX",lat:29.7604,lng:-95.3698},{city:"Dallas",state:"TX",lat:32.7767,lng:-96.797},{city:"Philadelphia",state:"PA",lat:39.9526,lng:-75.1652}],Gt=[{city:"Austin",state:"TX",suburbs:["menchaca","round rock","cedar park","pflugerville","georgetown","leander","bee cave","lakeway","dripping springs","buda","kyle","san marcos"]},{city:"Houston",state:"TX",suburbs:["sugar land","the woodlands","pearland","katy","cypress","spring","league city","pasadena"]},{city:"Dallas",state:"TX",suburbs:["plano","frisco","irving","garland","mckinney","carrollton","richardson","allen","lewisville"]},{city:"Philadelphia",state:"PA",suburbs:["philly","conshohocken","bala cynwyd","wynnewood","ardmore"]}],Qt=60,zt=3958.8;function Ce(e,s){const a=o=>o*Math.PI/180,n=a(s.lat-e.lat),r=a(s.lng-e.lng),i=Math.sin(n/2)**2+Math.cos(a(e.lat))*Math.cos(a(s.lat))*Math.sin(r/2)**2;return 2*zt*Math.asin(Math.min(1,Math.sqrt(i)))}function $(e,s,a){const n=e.trim().toLowerCase();if(!n)return null;const r=(s==null?void 0:s.trim().toUpperCase())||void 0,i=A.find(c=>c.city.toLowerCase()===n&&(!r||c.state===r));if(i)return{city:i.city,state:i.state};if(a&&Number.isFinite(a.lat)&&Number.isFinite(a.lng)){let c=null,l=1/0;for(const u of A){const h=Ce(a,u);h<l&&(l=h,c=u)}return c&&l<=Qt?{city:c.city,state:c.state}:null}const o=Gt.find(c=>(!r||c.state===r)&&c.suburbs.includes(n));return o?{city:o.city,state:o.state}:null}async function ys(e){const s=Wt();if(s){const c={...$(s.city,s.state)??s,detectedAt:new Date().toISOString()};return c.state&&z(c),c}const a=je();if(a){const o=$(a.city,a.state,a.coordinates);return o?{...a,...o}:a}const n=await Promise.race([Vt(),new Promise(o=>setTimeout(()=>o(null),3e3))]);if(!n)return null;const r=$(n.city,n.state,n.coordinates),i=r?{...n,...r}:n;return z(i),i}function bs({urlLocation:e,deviceLocation:s,storedLocation:a}){const n=e==null?void 0:e.trim();if(n&&!Se(n)){const i=se(n);return i?$(i.city,i.state)??i:null}const r=n?s:a;return r!=null&&r.city?$(r.city,r.state,r.coordinates)??{city:r.city,state:r.state}:null}function he(e){return e.state?`${e.city}, ${e.state}`:e.city}function Bt(e){var r;const s=e==null?void 0:e.coordinates;if(s&&Number.isFinite(s.lat)&&Number.isFinite(s.lng)){let i=A[0],o=1/0;for(const c of A){const l=Ce(s,c);l<o&&(o=l,i=c)}return{city:i.city,state:i.state}}const a=(r=e==null?void 0:e.state)==null?void 0:r.trim().toUpperCase(),n=a?A.find(i=>i.state===a):void 0;return n?{city:n.city,state:n.state}:{city:A[0].city,state:A[0].state}}function Yt(e){var o,c;const s=(o=e==null?void 0:e.city)==null?void 0:o.trim();if(!s)return null;const a=((c=e==null?void 0:e.state)==null?void 0:c.trim())||void 0,n=a?{city:s,state:a}:{city:s},r=Bt({...a?{state:a}:{},...e!=null&&e.coordinates?{coordinates:e.coordinates}:{}});return r.city.toLowerCase()===n.city.toLowerCase()&&(!a||a.toUpperCase()===r.state)?null:{realLocation:n,fallbackLocation:r,message:`Nothing in ${n.city} yet, here's ${r.city}.`,detail:`These results are in ${he(r)}, not ${he(n)}.`,searchRealLabel:`Search ${n.city} anyway`}}const me=e=>({key:e,notice:null,rejected:!1});function vs({realLocation:e,resetKey:s,enabled:a=!0}){var w,p;const[n,r]=m.useState(()=>me(s)),i=n.key===s?n:me(s),o=e==null?void 0:e.city,c=e==null?void 0:e.state,l=(w=e==null?void 0:e.coordinates)==null?void 0:w.lat,u=(p=e==null?void 0:e.coordinates)==null?void 0:p.lng,{notice:h,rejected:f}=i,g=m.useCallback(({loading:x,settled:S,count:C})=>{if(!a||f||x||!S||C>0)return;if(h){r({key:s,notice:null,rejected:!0});return}if(!o)return;const j=Yt({city:o,...c?{state:c}:{},...l!==void 0&&u!==void 0?{coordinates:{lat:l,lng:u}}:{}});j&&r({key:s,notice:j,rejected:!1})},[a,f,h,s,o,c,l,u]),y=m.useCallback(()=>{r({key:s,notice:null,rejected:!0})},[s]);return{notice:h,reportResults:g,searchRealLocationAnyway:y}}const K=e=>{const s=e?parseInt(e,10):NaN;return Number.isFinite(s)&&s>0?s:void 0};function ws({capacityMin:e,capacityMax:s,guests:a}){const n=K(e)??K(a),r=K(s);if(!(n===void 0&&r===void 0))return{min:n,max:r}}function Xt(e){var r;const s=e.amenities&&e.amenities.length>0?e.amenities:void 0,a=ct(e.venueType),n=a.length>0?a:void 0;return{priceMin:e.priceMin,priceMax:e.priceMax,venueSubTypes:n,amenities:s,ageRestriction:e.ageRestriction||void 0,capacity:e.capacity,minRating:e.minRating,instantBooking:e.instantBooking||void 0,confirmedOnly:e.confirmedOnly||void 0,ownerPublicId:((r=e.ownerPublicId)==null?void 0:r.trim())||void 0}}const Kt=10,qt=/^(usa|united states)$/i;function Jt({boundsSearchParams:e,geoSearchParams:s,location:a}){if(e)return{lat:e.center.lat,lng:e.center.lng,radiusMiles:e.radiusMiles};if(s)return{lat:s.lat,lng:s.lng,radiusMiles:s.radiusMiles};const n=a==null?void 0:a.trim();if(!n||n==="Nearby")return;const r=n.split(",").map(l=>l.trim()).filter(Boolean),i=r.length===2,o=r.length===3&&qt.test(r[2]),c=r.length===1;if(i||o||c)return{city:r[0],radiusMiles:Kt}}const Zt=18;function js({location:e,geoSearchParams:s,effectiveQuery:a,sortBy:n,boundsSearchParams:r,filters:i,date:o,startTime:c,endTime:l,listingKind:u="venue",serviceType:h}){const f=m.useMemo(()=>Xt(i),[i]),g=u==="service"&&(h==null?void 0:h.trim())||void 0,y=m.useMemo(()=>({date:o||void 0,startTime:c||void 0,endTime:l||void 0}),[o,c,l]),w=n==="distance"&&!r&&!s?"relevance":n,p=m.useMemo(()=>Jt({boundsSearchParams:r,geoSearchParams:s??null,location:e}),[r,s,e]),{data:x,isLoading:S,isFetching:C,error:j,refetch:_,fetchNextPage:R,hasNextPage:k,isFetchingNextPage:H}=pt({queryKey:["venues-search",{query:a,listingKind:u,serviceType:g,location:e,geoSearchParams:s,boundsSearchParams:r,sort:w,filters:f,when:y}],initialPageParam:1,queryFn:({pageParam:b})=>lt({query:a||void 0,listingKind:u,serviceType:g,filters:{location:p,...f,...y},sort:w,page:b,limit:Zt}),getNextPageParam:b=>{const{page:d,totalPages:v}=b.meta;return d<v?d+1:void 0},staleTime:5*60*1e3}),O=x==null?void 0:x.pages[0],T=m.useMemo(()=>x?x.pages.flatMap(b=>b.venues).map(Y):[],[x]),M=m.useMemo(()=>{var b;return(((b=x==null?void 0:x.pages[0])==null?void 0:b.outsideArea)??[]).map(Y)},[x]),P=m.useMemo(()=>{var b;return(((b=x==null?void 0:x.pages[0])==null?void 0:b.crossKind)??[]).map(Y)},[x]);return{searchResults:O,venues:T,outsideAreaVenues:M,crossKindVenues:P,searchLoading:S,isFetching:C,searchError:j?"Failed to search venues. Please try again.":null,refetch:_,fetchNextPage:R,hasNextPage:k,isFetchingNextPage:H}}const Ns=()=>{const e=m.useRef(null),[s,a]=m.useState(!1);return m.useEffect(()=>{const n=()=>{a(window.scrollY>12)};return n(),window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)},[]),t.jsx("div",{ref:e,className:"sticky top-0 z-40 glass",style:{"--glass-tint-opacity":"0.72"},children:t.jsxs("div",{className:N("px-4 transition-[padding] duration-200",s?"pt-2":"pt-4"),children:[t.jsx(_t,{}),t.jsx(dt,{size:"mobile",collapsed:s,className:N("justify-center transition-[margin] duration-200",s?"mt-2":"mt-4")})]})})};export{us as C,yt as E,ms as L,_t as M,hs as R,Ns as U,js as a,Xt as b,ws as c,fs as d,pt as e,he as f,gs as g,ys as h,Se as i,je as j,ps as k,se as p,bs as r,xs as s,vs as u};