import{j as e,r as o,b as M,f as Y,L as Q,e as Z}from"./vendor-react-CVHocMAO.js";import{u as ne}from"./useSeo-BXYcILQx.js";import{G as O,N as ie,X as le,l as U,O as oe,bn as ce,J as de,K as me,B as J,bo as B,a3 as H,bp as q,x as ue,a4 as X,_ as he,a5 as xe}from"./index-DXdAv5n3.js";import{A as ge}from"./vendor-maps-BX5dXCaZ.js";import{u as pe,a as fe,g as z,b as be,c as ye,s as ve,p as W,U as K}from"./UnifiedMobileNavbar-DB3kgBNQ.js";import"./vendor-amplify-BttVyssp.js";import{C as je}from"./CityAutocomplete-Dc7MIh9U.js";import{D as Ne}from"./date-picker-BM-CR-Ne.js";import{T as V}from"./time-picker-htHEl7t7.js";import{L as ee}from"./ListingCard-DIwNuqAS.js";import{a as we}from"./listings-C5R8R0UD.js";import{L as te}from"./loader-circle-CBzAjQAw.js";import"./vendor-radix-Boyzn9qx.js";import"./vendor-motion-CP2nHqR4.js";import"./parseISO-BeqhIhSi.js";import"./claimRequests-LbP6AkmD.js";import"./listing-Dh6xmhdV.js";import"./feeRates-DFYxRksI.js";import"./OptimizedImage-CFzueLcd.js";import"./utils-m29NAvmr.js";import"./wishlists-mdsVtVG_.js";import"./savedVenues-CqTNNALH.js";import"./ImageWithFallback-BEJkpOin.js";import"./plus-gZD8KbAO.js";import"./listing-utils-DWgPJQzT.js";import"./differenceInDays-st7ugZrd.js";import"./listingFeeInput-BVaxVJEf.js";import"./badge-check-CabiHZCA.js";import"./guestPricing-DaiRwFJy.js";import"./award-TfkAFFEh.js";import"./star-WZhRtBdg.js";import"./circle-check-CJi34ijI.js";const Se=({count:t=5,showFullStructure:c=!0,isMobile:g=!1})=>{const y=Array.from({length:t}),l=()=>e.jsxs("div",{className:"flex flex-col rounded-2xl border-2 border-gray-200 bg-white transition-all duration-200 overflow-hidden h-full",children:[e.jsx(O,{className:"aspect-[5/4] w-full rounded-t-2xl"}),e.jsxs("div",{className:"flex flex-col gap-0.5 pt-2 px-3 pb-3 bg-white rounded-b-2xl",children:[e.jsx(O,{className:"h-4 w-3/4"}),e.jsx(O,{className:"h-3 w-2/3 mt-0.5"}),e.jsxs("div",{className:"flex items-center gap-1.5 mt-1",children:[e.jsx(O,{className:"h-3 w-20"}),e.jsx(O,{className:"h-3 w-1"}),e.jsx(O,{className:"h-3 w-12"})]})]})]});return c?e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(O,{className:"h-9 w-64"})," ",e.jsx(O,{className:"h-4 w-48"})," "]}),Array.from({length:2}).map((d,n)=>e.jsxs("section",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(O,{className:"h-8 w-8"})," ",e.jsxs("div",{children:[e.jsx(O,{className:"h-6 w-32 mb-1"})," ",e.jsx(O,{className:"h-3 w-40"})," "]})]})}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:y.map((m,p)=>e.jsx("div",{children:l()},p))})]},n))]}):e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:y.map((d,n)=>e.jsx("div",{children:l()},n))})},Ce=[{id:"nearby",label:"Nearby",subtitle:"Find services near you"},{id:"austin",label:"Austin, TX",subtitle:"Live music capital & vibrant nightlife"},{id:"dallas",label:"Dallas, TX",subtitle:"Upscale venues & entertainment district"},{id:"houston",label:"Houston, TX",subtitle:"Diverse venues & cultural scene"},{id:"philadelphia",label:"Philadelphia, PA",subtitle:"Historic venues & nightlife"}],Ee=({isOpen:t,onClose:c,categories:g,onCategorySelect:y,locationInput:l,onLocationInputChange:d,whenValue:n,onWhenChange:m,durationStart:p,durationEnd:v,onDurationStartChange:j,onDurationEndChange:S,onClearAll:w,onSearch:C})=>{const[R,k]=o.useState(null),{location:b,isRequesting:N,requestLocation:i}=pe(),$=o.useMemo(()=>{if(!n)return null;try{const[r,s,a]=n.split("-").map(Number);if(!isNaN(r)&&!isNaN(s)&&!isNaN(a))return new Date(r,s-1,a)}catch{}return null},[n]),f=o.useMemo(()=>{if(!n)return"";try{const[r,s,a]=n.split("-").map(Number);if(!isNaN(r)&&!isNaN(s)&&!isNaN(a)){const h=new Date(r,s-1,a);return ie(h,"MMM d, yyyy")}}catch{}return""},[n]),P=o.useCallback(r=>{if(r){const s=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),h=String(r.getDate()).padStart(2,"0");m(`${s}-${a}-${h}`)}else m("")},[m]),u=o.useCallback(r=>{if(!r||!r.trim())return"";const s=r.split(":");if(s.length!==2)return"";const a=parseInt(s[0],10),h=parseInt(s[1],10);if(isNaN(a)||isNaN(h)||a<0||a>=24||h<0||h>=60)return"";const D=a>=12?"PM":"AM";return`${a%12||12}:${h.toString().padStart(2,"0")} ${D}`},[]),E=o.useMemo(()=>{if(!p&&!v)return"";const r=u(p),s=u(v);return r&&s?`${r} - ${s}`:r||s||""},[p,v,u]);return t?e.jsxs("div",{className:"fixed inset-0 z-[120] flex flex-col bg-white",children:[e.jsxs("div",{className:"flex-shrink-0 bg-white border-b border-gray-200",children:[e.jsx("div",{className:"px-4 py-3 border-b border-gray-100",children:e.jsx("div",{className:"flex items-center justify-between gap-1.5 text-[13px] font-semibold text-gray-900",children:g.map(r=>e.jsx("button",{onClick:()=>y(r.id),className:"flex-1 rounded-lg px-1.5 py-2 text-center transition-colors hover:bg-gray-50 active:bg-gray-100",children:e.jsxs("span",{className:"inline-flex flex-col items-center justify-center gap-1 truncate leading-tight",children:[e.jsx("img",{src:r.icon,alt:"","aria-hidden":"true",className:"h-7 w-7 flex-shrink-0 object-contain"}),e.jsx("span",{className:"text-[11px]",children:r.shortLabel})]})},r.id))})}),e.jsxs("div",{className:"flex items-center justify-between px-4 py-3",children:[e.jsx("button",{type:"button",className:"rounded-full border border-gray-200 p-2 text-gray-600 hover:bg-gray-100",onClick:c,children:e.jsx(le,{className:"h-4 w-4"})}),e.jsx("h2",{className:"text-base font-semibold text-gray-900",children:"Services search"}),e.jsx("span",{className:"w-8"})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden pb-28",children:e.jsxs("div",{className:"px-4 pt-4 space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm",children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-4 py-3",onClick:()=>k(r=>r==="where"?null:"where"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{className:"h-5 w-5 text-gray-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:"Where?"})]}),e.jsx("span",{className:"text-sm text-gray-500 truncate",children:l||"Add a location"})]}),R==="where"&&e.jsxs("div",{className:"px-4 pb-4 space-y-3",children:[e.jsx(ge,{apiKey:"AIzaSyATWdF6OVbFX1X_OuYCMZdxWZi7ggnhRWI",children:e.jsx(je,{value:l,onChange:d,onSelect:(r,s)=>{const a=s?`${r}, ${s}`:r;d(a)},placeholder:"Search by city or landmark",className:"w-full",persistOnScroll:!0,inOverlay:!0})}),e.jsxs("button",{type:"button",onClick:async()=>{i(),setTimeout(()=>{var r;if(b){const s=window.google;(r=s==null?void 0:s.maps)!=null&&r.Geocoder&&new s.maps.Geocoder().geocode({location:{lat:b.lat,lng:b.lng}},(h,D)=>{if(D==="OK"&&(h!=null&&h[0])){const L=h[0].address_components,A=L==null?void 0:L.find(x=>x.types.includes("locality")),_=L==null?void 0:L.find(x=>x.types.includes("administrative_area_level_1"));if(A&&_){const x=`${A.long_name}, ${_.short_name}`;d(x)}}})}},1e3)},disabled:N,className:"flex w-full items-center justify-center gap-2 rounded-xl border border-gray-300 bg-white px-4 py-3 text-sm font-semibold text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[e.jsx(oe,{className:"h-4 w-4"}),e.jsx("span",{children:N?"Getting location...":"Use my location"})]}),!l&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-700",children:"Suggested destinations"}),e.jsx("div",{className:"rounded-2xl border border-gray-100 bg-gray-50/60",children:e.jsx("ul",{className:"divide-y divide-gray-100",children:Ce.map(r=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>d(r.label),className:"flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-white",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-white shadow-sm border border-gray-100",children:e.jsx(U,{className:"h-5 w-5 text-[hsl(var(--brand))]"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-gray-900 truncate",children:r.label}),e.jsx("p",{className:"text-xs text-gray-600 truncate",children:r.subtitle})]})]})},r.id))})})]})]})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm",children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-4 py-3",onClick:()=>k(r=>r==="when"?null:"when"),children:[e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:"When"}),e.jsx("span",{className:"text-sm text-gray-500",children:f||"Add dates"})]}),R==="when"&&e.jsx("div",{className:"px-4 pb-4",children:e.jsx(Ne,{value:$,onChange:P,placeholder:"Select dates",className:"w-full"})})]}),e.jsxs("div",{className:"rounded-2xl border border-gray-200 bg-white shadow-sm",children:[e.jsxs("button",{type:"button",className:"flex w-full items-center justify-between px-4 py-3",onClick:()=>k(r=>r==="duration"?null:"duration"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ce,{className:"h-5 w-5 text-gray-500"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:"Duration"})]}),e.jsx("span",{className:"text-sm text-gray-500",children:E||"Add time"})]}),R==="duration"&&e.jsx("div",{className:"px-4 pb-4",children:e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Start"}),e.jsx(V,{value:p,onChange:j,placeholder:"Add time"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx("label",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"End"}),e.jsx(V,{value:v,onChange:S,placeholder:"Add time",minTime:p||void 0})]})]})})]})]})}),e.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-[120] border-t border-gray-200 bg-white px-4 py-3",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("button",{type:"button",onClick:w,className:"text-sm font-semibold text-gray-900 hover:underline",children:"Clear all"}),e.jsxs("button",{type:"button",onClick:C,className:"flex items-center gap-2 rounded-full bg-[hsl(var(--brand))] px-5 py-3 text-sm font-semibold text-white shadow-md hover:bg-[hsl(var(--brand))]/90",children:[e.jsx(U,{className:"h-4 w-4"}),e.jsx("span",{children:"Search"})]})]})})]}):null},I=12,Le=400,Re="[data-carousel-item='true']";function ke({items:t,renderItem:c,getItemKey:g,header:y,onReachEnd:l,reachEndThresholdPx:d=0,edgeLoadEnabled:n=!1,trailing:m,scrollButtonsDisabled:p=!1,itemSelector:v=Re}){const j=M.useRef(null),[S,w]=M.useState(!1),[C,R]=M.useState(!1),[k,b]=M.useState(1),N=M.useRef({onReachEnd:l,reachEndThresholdPx:d,edgeLoadEnabled:n});N.current={onReachEnd:l,reachEndThresholdPx:d,edgeLoadEnabled:n};const i=M.useRef(v);i.current=v;const $=M.useCallback(()=>{const s=j.current;if(!s)return;const a=s.clientWidth;let h=1;a>=1200?h=5:a>=950?h=4:a>=700?h=3:a>=480||a>=360?h=2:h=1,b(h)},[]),f=M.useCallback(()=>{const s=j.current;if(!s)return;const{scrollLeft:a,scrollWidth:h,clientWidth:D}=s;w(a>4),R(a+D<h-4);const{onReachEnd:L,reachEndThresholdPx:A,edgeLoadEnabled:_}=N.current;_&&L&&a+D>=h-A&&L()},[]);M.useEffect(()=>{const s=j.current;if(!s)return;const a=()=>{$(),f()};return $(),f(),s.addEventListener("scroll",f,{passive:!0}),window.addEventListener("resize",a),()=>{s.removeEventListener("scroll",f),window.removeEventListener("resize",a)}},[$,f]),M.useEffect(()=>{f()},[t.length,f]),M.useEffect(()=>{const s=j.current;if(!s)return;const a=s.querySelector(i.current);if(!a)return;const h=parseFloat(getComputedStyle(s).columnGap||`${I}`),L=a.getBoundingClientRect().width+h,A=s.scrollWidth-s.clientWidth,_=Math.min(Math.round(s.scrollLeft/L)*L,A);s.scrollTo({left:_,behavior:"auto"}),f()},[k,f]);const P=s=>{const a=j.current;if(!a)return;const h=a.querySelector(i.current);if(!h)return;const D=parseFloat(getComputedStyle(a).columnGap||`${I}`),A=h.getBoundingClientRect().width+D,_=a.scrollWidth-a.clientWidth,x=s==="left"?Math.max(0,a.scrollLeft-A):Math.min(_,a.scrollLeft+A);a.scrollTo({left:x,behavior:"smooth"})},u=M.useMemo(()=>k<=1?"100%":`calc((100% - ${(k-1)*I}px) / ${k})`,[k]),E=!p&&S,r=!p&&C;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[y,e.jsxs("div",{className:"hidden gap-2 lg:flex",children:[e.jsx("button",{type:"button",onClick:()=>P("left"),className:`grid h-10 w-10 place-items-center rounded-full border border-gray-200 bg-white text-gray-900 shadow-sm transition hover:scale-105 hover:shadow-md ${E?"opacity-100":"opacity-40 pointer-events-none"}`,"aria-label":"Scroll left",children:e.jsx(de,{className:"h-4 w-4"})}),e.jsx("button",{type:"button",onClick:()=>P("right"),className:`grid h-10 w-10 place-items-center rounded-full border border-gray-200 bg-white text-gray-900 shadow-sm transition hover:scale-105 hover:shadow-md ${r?"opacity-100":"opacity-40 pointer-events-none"}`,"aria-label":"Scroll right",children:e.jsx(me,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"relative",children:e.jsxs("div",{ref:j,className:"grid grid-flow-col gap-3 overflow-x-auto [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",style:{gridAutoColumns:u},children:[t.map((s,a)=>e.jsx("div",{"data-carousel-item":"true",className:"w-full snap-start",children:c(s,a)},g(s,a))),m]})})]})}const se=12;function re({serviceType:t,city:c,state:g,date:y,enabled:l}){const d=fe({queryKey:["published-services-by-type",t,c??"",g??"",y??""],initialPageParam:void 0,queryFn:({pageParam:m})=>we({listingKind:"service",serviceType:t,city:c||void 0,state:g?g.toUpperCase().trim().substring(0,2):void 0,date:y,limit:se,cursor:m}),getNextPageParam:m=>m.nextCursor,enabled:l,staleTime:12e4,refetchOnWindowFocus:!1});return{items:o.useMemo(()=>{var m;return((m=d.data)==null?void 0:m.pages.flatMap(p=>p.items))??[]},[d.data]),fetchNextPage:d.fetchNextPage,hasNextPage:d.hasNextPage,isFetchingNextPage:d.isFetchingNextPage,isLoading:d.isLoading,isError:d.isError,isResolved:l&&!d.isLoading}}const ae=({serviceTypeInfo:t})=>e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:t.icon}),e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:t.label})]}),e.jsx("div",{className:"grid grid-flow-col gap-3",style:{gridAutoColumns:"minmax(0, 1fr)"},children:Array.from({length:5}).map((c,g)=>e.jsx("div",{className:"h-56 w-full animate-pulse rounded-xl bg-gray-100","aria-hidden":"true"},g))})]}),Ae=({serviceTypeInfo:t,type:c,services:g,buildServicesLink:y,serializedSearchParams:l,onLoadMore:d,hasMore:n,isLoadingMore:m})=>{const p=n||g.length>se;return e.jsx(ke,{items:g,getItemKey:v=>v.listingId,renderItem:v=>e.jsx(ee,{kind:"service",service:v,className:"h-full",searchQuery:l}),header:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-2xl",children:t.icon}),e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:t.label}),p&&e.jsxs(Q,{to:y(c),className:"text-sm font-medium text-[hsl(var(--brand))] hover:underline",children:["See all ",t.label.toLowerCase()]})]}),onReachEnd:d,reachEndThresholdPx:Le,edgeLoadEnabled:n&&!m,trailing:n&&m?e.jsx("div",{className:"grid w-16 place-items-center","aria-hidden":"true",children:e.jsx(te,{className:"h-5 w-5 animate-spin text-gray-400"})}):null})},Me=({serviceTypeInfo:t,cityForApi:c,stateForApi:g,dateForApi:y,locationReady:l,buildServicesLink:d,serializedSearchParams:n,onResolve:m})=>{const{items:p,fetchNextPage:v,hasNextPage:j,isFetchingNextPage:S,isLoading:w,isResolved:C}=re({serviceType:t.id,city:c,state:g,date:y,enabled:l});o.useEffect(()=>{C&&m(t.id,p.length>0)},[C,p.length,m,t.id]);const R=o.useCallback(()=>{j&&!S&&v()},[j,S,v]);return w?e.jsx(ae,{serviceTypeInfo:t}):p.length===0?null:e.jsx("section",{children:e.jsx(Ae,{serviceTypeInfo:t,type:t.id,services:p,buildServicesLink:d,serializedSearchParams:n,onLoadMore:R,hasMore:!!j,isLoadingMore:S})})},$e=({serviceTypeInfo:t,cityForApi:c,stateForApi:g,dateForApi:y,locationReady:l,serializedSearchParams:d,onResolve:n})=>{const{items:m,fetchNextPage:p,hasNextPage:v,isFetchingNextPage:j,isLoading:S,isResolved:w}=re({serviceType:t.id,city:c,state:g,date:y,enabled:l});return o.useEffect(()=>{w&&n(t.id,m.length>0)},[w,m.length,n,t.id]),S?e.jsx(ae,{serviceTypeInfo:t}):m.length===0?null:e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-3xl",children:t.icon}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:t.label})]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:m.map(C=>e.jsx(ee,{kind:"service",service:C,className:"h-full",searchQuery:d},C.listingId))}),v&&e.jsx("div",{className:"flex justify-center pt-2",children:e.jsx(J,{variant:"outline",onClick:()=>void p(),disabled:j,children:j?e.jsx(te,{className:"h-4 w-4 animate-spin"}):`Show more ${t.label.toLowerCase()}`})})]})},De=({serviceTypes:t,selectedServiceTypes:c,serializedSearchParams:g,userCity:y,locationParam:l,cityForApi:d,stateForApi:n,dateForApi:m,locationReady:p})=>{const[v]=Y(),j=u=>{const E=new URLSearchParams(v);return E.set("services",u),`/services?${E.toString()}`},S=()=>{const u=new URLSearchParams(v);return u.delete("services"),u.delete("serviceType"),`/services?${u.toString()}`},w=c.length>0,C=o.useMemo(()=>w?c.map(u=>t.find(E=>E.id===u)).filter(u=>u!==void 0):t,[w,c,t]),[R,k]=o.useState({}),b=o.useCallback((u,E)=>{k(r=>r[u]===E?r:{...r,[u]:E})},[]),N=C.map(u=>u.id),i=N.every(u=>u in R),$=N.some(u=>R[u]),f=i&&!$,P=o.useMemo(()=>{const u=w?c.map(s=>{var a;return(a=t.find(h=>h.id===s))==null?void 0:a.label}).filter(s=>s!==void 0):[],E=u.length>0?u.join(", "):null,r=(()=>{const s=l==null?void 0:l.toLowerCase();return s==="nearby"||s==="current location"?"nearby":l?`in ${l}`:`in ${y}`})();return E?`${E} services ${r}`:`Services ${r}`},[w,c,t,l,y]);return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h1",{className:"text-3xl font-semibold text-gray-900",children:P}),(l==null?void 0:l.trim())&&l.toLowerCase()!=="nearby"&&l.toLowerCase()!=="current location"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Includes providers based here and those who travel to this area."})]}),f?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:w?"No services available for selected types":"No services available yet"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Check back soon for services in ",y]}),w&&e.jsx(J,{variant:"outline",asChild:!0,className:"mt-4",children:e.jsx(Q,{to:S(),children:"View all services"})})]}):e.jsx("div",{className:"space-y-8",children:C.map(u=>w?e.jsx($e,{serviceTypeInfo:u,cityForApi:d,stateForApi:n,dateForApi:m,locationReady:p,serializedSearchParams:g,onResolve:b},u.id):e.jsx(Me,{serviceTypeInfo:u,cityForApi:d,stateForApi:n,dateForApi:m,locationReady:p,buildServicesLink:j,serializedSearchParams:g,onResolve:b},u.id))})]})},_e=()=>{const[t]=Y(),c=Z(),[g,y]=o.useState(()=>t.get("location")||z()||""),[l,d]=o.useState(()=>t.get("date")||""),[n,m]=o.useState(()=>{const b=t.get("duration");return(b==null?void 0:b.split("-")[0])||""}),[p,v]=o.useState(()=>{const b=t.get("duration");return(b==null?void 0:b.split("-")[1])||""}),[j,S]=o.useState(t.get("serviceType"));o.useEffect(()=>{const b=t.get("location");y(b||z()||""),d(t.get("date")||"");const N=t.get("duration");m((N==null?void 0:N.split("-")[0])||""),v((N==null?void 0:N.split("-")[1])||""),S(t.get("serviceType"))},[t]);const w=o.useMemo(()=>new URLSearchParams(t).toString(),[t]),C=o.useCallback(()=>{const b=B(t,q,{location:g,date:l,duration:n||p?`${n}-${p}`:null,serviceType:j});c(`/services?${b.toString()}`)},[p,n,g,c,t,j,l]),R=o.useCallback(()=>{y(""),d(""),m(""),v(""),S(null);const b=B(t,q,{});c(`/services?${b.toString()}`)},[c,t]),k=o.useCallback(b=>b==="services"||b==="venues"?H(b,t):H("venues",t),[t]);return{searchParams:t,navigate:c,locationInput:g,setLocationInput:y,whenValue:l,setWhenValue:d,durationStart:n,setDurationStart:m,durationEnd:p,setDurationEnd:v,selectedServiceType:j,setSelectedServiceType:S,serializedSearchParams:w,applySearch:C,handleClearAll:R,buildCategoryUrl:k}},Te=({isMobile:t})=>{const[c,g]=o.useState(!1),[y,l]=o.useState(!1),d=o.useRef(null);return o.useEffect(()=>{if(!t)return;const n=()=>{l(window.scrollY>12)};return n(),window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)},[t]),o.useEffect(()=>{if(!c)return;const n=document.documentElement,m=n.style.overflow;return n.style.overflow="hidden",()=>{n.style.overflow=m}},[c]),{mobileSearchExpanded:c,setMobileSearchExpanded:g,isHeaderCollapsed:y,mobileHeaderRef:d}},G="Philadelphia",Oe=xe,F=t=>{const c=t==null?void 0:t.trim().toLowerCase();return c==="nearby"||c==="current location"},pt=()=>{var _;const t=ue(),c=Z();ne({title:"Event services & vendors | PLEC",description:"Find photographers, caterers, DJs, florists, and more for your next event. Browse event service providers on PLEC."});const{searchParams:g,locationInput:y,setLocationInput:l,whenValue:d,setWhenValue:n,durationStart:m,setDurationStart:p,durationEnd:v,setDurationEnd:j,serializedSearchParams:S,applySearch:w,handleClearAll:C,buildCategoryUrl:R}=_e(),k=o.useMemo(()=>{const x=g.get("services"),T=g.get("serviceType");return x?x.split(",").filter(Boolean):T?[T]:[]},[g]),{mobileSearchExpanded:b,setMobileSearchExpanded:N}=Te({isMobile:t}),i=g.get("location"),$=!(i!=null&&i.trim())||F(i),[f,P]=o.useState(()=>{if(typeof window>"u")return null;const x=new URLSearchParams(window.location.search).get("location");if(x!=null&&x.trim()&&!F(x))return null;const T=be();return!(T!=null&&T.city)||!(T!=null&&T.state)||Date.now()-new Date(T.detectedAt).getTime()>=30*24*60*60*1e3?null:{...T}});o.useEffect(()=>{$&&ye({defaultCity:{city:G,state:"PA"}}).then(P).catch(()=>P({city:G,state:"PA",detectedAt:new Date().toISOString()}))},[$]),o.useEffect(()=>{const x=i==null?void 0:i.trim();!x||F(x)||ve(x)},[i]);const u=$?f!==null:!0,E=o.useMemo(()=>{if(i!=null&&i.trim()&&!F(i)){const x=W(i);return((x==null?void 0:x.city)??i.trim()).toLowerCase()}return((f==null?void 0:f.city)??G).toLowerCase()},[i,f]),r=o.useMemo(()=>{if(i!=null&&i.trim()&&!F(i)){const x=W(i);return(x==null?void 0:x.state)??void 0}return(f==null?void 0:f.state)??void 0},[i,f]),s=((_=g.get("date"))==null?void 0:_.trim())||void 0,a=s&&/^\d{4}-\d{2}-\d{2}$/.test(s)?s:void 0,h=o.useMemo(()=>i!=null&&i.trim()?i:f?`${f.city}, ${f.state}`:G,[i,f]),D=o.useMemo(()=>{if(i!=null&&i.trim()&&!F(i)){const x=W(i);return(x==null?void 0:x.city)??i.trim()}return(f==null?void 0:f.city)??G},[i,f]),L=o.useCallback(x=>{c(R(x))},[R,c]),A=t&&b&&e.jsx(Ee,{isOpen:b,onClose:()=>N(!1),categories:Oe,onCategorySelect:L,locationInput:y,onLocationInputChange:l,whenValue:d,onWhenChange:n,durationStart:m,durationEnd:v,onDurationStartChange:p,onDurationEndChange:j,onClearAll:()=>{C(),N(!1)},onSearch:()=>{w(),N(!1)}});return u?e.jsxs(X,{showSearch:!0,showFooter:!0,children:[A,e.jsxs("div",{className:"min-h-screen bg-white",children:[t&&e.jsx(K,{onOpenSearch:()=>{N(!0),window.scrollTo({top:0,behavior:"smooth"})},searchQuery:y}),e.jsx("div",{className:"container mx-auto px-4 py-8 space-y-8",children:e.jsx(De,{serviceTypes:he,selectedServiceTypes:k,serializedSearchParams:S,userCity:D,locationParam:h,isMobile:t,cityForApi:E,stateForApi:r,dateForApi:a,locationReady:u})})]})]}):e.jsxs(X,{showSearch:!0,showFooter:!0,children:[A,e.jsxs("div",{className:"min-h-screen bg-white",children:[t&&e.jsx(K,{onOpenSearch:()=>{N(!0),window.scrollTo({top:0,behavior:"smooth"})},searchQuery:y}),e.jsx("div",{className:"container mx-auto px-4 py-8 space-y-8",children:e.jsx(Se,{count:5,showFullStructure:!0,isMobile:t})})]})]})};export{pt as Services,pt as default};