import{j as e,r as b,b as ve,e as we}from"./vendor-react-CVHocMAO.js";import{g as q}from"./feeRates-DFYxRksI.js";import{j as ee,cb as te,cc as se,cd as re,ce as ne,F as g,x as Ne,at as V,N as k,J as ke,K as Me,cf as Se,bn as Ce,bD as Ae,cg as Pe,Z as I,ch as Y,y as J,z as H,C as X,bP as Z,B as P,R as ae,bI as z,a2 as oe,ci as $e,cj as ie,ck as le,U as De,a7 as _e,cl as Ie,c8 as be,bT as pe,by as Fe,bx as Te,bA as Le,L as F,I as ce,bH as Re,bw as Ee,bN as Be,bR as Oe}from"./index-DXdAv5n3.js";import{L as E}from"./link-2-DaUeWpKB.js";import{T as B}from"./twitter-BCfeMkxW.js";import{d as qe,e as Ve,t as de,m as ze,M as Ue}from"./availability-D3RguKHT.js";import{Q as Ye}from"./QuantityStepper-Dhv2rSZr.js";import{P as Ge}from"./plus-gZD8KbAO.js";import{F as G}from"./utils-m29NAvmr.js";import{C as We}from"./copy--gtFY43f.js";import{M as Ke}from"./message-circle-IHAKsyw5.js";import{S as Qe}from"./send-sS4rooCm.js";import{f as ue}from"./timeUtils-J6UVSYhu.js";import{D as Je}from"./date-picker-BM-CR-Ne.js";import{T as me}from"./time-picker-htHEl7t7.js";import{p as he}from"./parse-BXhUshbw.js";import{C as He}from"./calendar-days-BZ6ScuUG.js";/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Xe=ee("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ze=ee("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/**
* @license lucide-react v0.462.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const et=ee("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);function W(t,r){if(t==null)return"";const s=`$${t.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}`;switch(r){case"per_person":case"per_guest":return`${s}/person`;case"per_hour":return`${s}/hr`;default:return s}}function _t({metadata:t,offerings:r,feeInput:s}){var i;const a=(t==null?void 0:t.pricing)??{},n=[];if(Array.isArray(a.packages))for(const c of a.packages){const m=c;m.postBookingEligible===!0&&m.id&&m.name&&n.push({id:m.id,name:m.name,priceLabel:W(q(m.price,s),m.priceType)})}if(Array.isArray(r))for(const c of r)c.postBookingEligible===!0&&n.push({id:c.id,name:c.name,priceLabel:W(q(c.price,s),c.priceType)});const o=[];if(Array.isArray(a.addOns))for(const c of a.addOns){const m=c;((i=m.postBooking)==null?void 0:i.eligible)===!0&&m.id&&m.name&&o.push({id:m.id,name:m.name,priceLabel:m.priceModel?W(q(m.priceModel.unitAmount,s),m.priceModel.kind.replace("fixed_","")):""})}const l=[...n,...o];return l.length===0?null:e.jsxs("div",{className:"rounded-xl border border-blue-100 bg-blue-50/60 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ze,{className:"h-4 w-4 text-blue-600 shrink-0"}),e.jsx("p",{className:"text-sm font-medium text-blue-900",children:"Available after booking"})]}),e.jsx("p",{className:"text-xs text-blue-700 leading-relaxed",children:"These items can be added to your booking even after it's confirmed."}),e.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(c=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-blue-200 bg-white px-3 py-1 text-xs font-medium text-blue-800",children:[c.name,c.priceLabel&&e.jsx("span",{className:"text-blue-500 font-normal",children:c.priceLabel})]},c.id))})]})}function It({slots:t,className:r}){return t.length===0?null:e.jsx("div",{className:`rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 ${r??""}`,children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(et,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-600"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-semibold text-emerald-800",children:"Early Booking Discount"}),t.map((s,a)=>{var n;return e.jsxs("p",{className:"text-sm text-emerald-700",children:["Book ",e.jsxs("span",{className:"font-medium",children:[s.daysAhead,"+ days"]})," in advance and save"," ",s.discountPercent!=null?e.jsxs("span",{className:"font-medium",children:[s.discountPercent,"%"]}):e.jsxs("span",{className:"font-medium",children:["$",(n=s.discountFixed)==null?void 0:n.toFixed(0)]})]},a)})]})]})})}function Ft(t){return t?t.filter(r=>{var s;return r.type==="early_bird"&&typeof((s=r.conditions)==null?void 0:s.advanceDays)=="number"}).sort((r,s)=>{var a,n;return(((a=r.conditions)==null?void 0:a.advanceDays)??0)-(((n=s.conditions)==null?void 0:n.advanceDays)??0)}).map(r=>({daysAhead:r.conditions.advanceDays,discountPercent:r.value})):[]}function Tt(t){const r=t.pricing,s=r==null?void 0:r.timelinePricing;return!(s!=null&&s.enabled)||!Array.isArray(s.slots)?[]:s.slots.filter(a=>a.adjustmentValue<0&&a.minDaysAhead>0).sort((a,n)=>a.minDaysAhead-n.minDaysAhead).map(a=>({daysAhead:a.minDaysAhead,...a.adjustmentType==="percent"?{discountPercent:Math.round(Math.abs(a.adjustmentValue)*100)}:{discountFixed:Math.abs(a.adjustmentValue)}}))}function Lt(t){return!["/host","/profile","/messages","/checkout","/payments","/bookings"].some(a=>t===a||t.startsWith(`${a}/`))}function Rt(t){typeof window>"u"||(t&&sessionStorage.setItem("postAuthRedirect",t),window.dispatchEvent(new CustomEvent("openAuthModal")))}const fe={website:ne,instagram:re,facebook:se,twitter:B,"twitter/x":B,linkedin:te,x:B,youtube:E,tiktok:E,pinterest:E,other:E};function ge(t){const r=t.trim().toLowerCase().replace(/\s+/g," ");return fe[r]??fe[r.replace(/\s*\/\s*x$/i,"")]??E}function ye(t){const r=Array.isArray(t.onlineProfiles)&&t.onlineProfiles.length>0,s=!!(t.website||t.instagram||t.facebook||t.twitter||t.linkedin);return{hasOnlineProfiles:r,hasFlatSocial:s,hasAnySocial:r||s}}const T="flex h-9 w-9 items-center justify-center rounded-full bg-gray-100 text-gray-600 transition-colors";function Et({social:t,className:r}){const{hasOnlineProfiles:s,hasAnySocial:a}=ye(t);if(!a)return null;const n=t.onlineProfiles??[];return e.jsxs("div",{className:g("flex flex-wrap items-center gap-2",r),children:[s?n.map((o,l)=>{const i=ge(o.platform);return e.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:g(T,"hover:bg-brand hover:text-white"),title:o.label||o.platform,children:e.jsx(i,{className:"h-4 w-4"})},`${o.url}-${l}`)}):null,!s&&t.website?e.jsx("a",{href:t.website,target:"_blank",rel:"noopener noreferrer",className:g(T,"hover:bg-brand hover:text-white"),title:"Website",children:e.jsx(ne,{className:"h-4 w-4"})}):null,!s&&t.instagram?e.jsx("a",{href:t.instagram,target:"_blank",rel:"noopener noreferrer",className:g(T,"hover:bg-[#E4405F] hover:text-white"),title:"Instagram",children:e.jsx(re,{className:"h-4 w-4"})}):null,!s&&t.facebook?e.jsx("a",{href:t.facebook,target:"_blank",rel:"noopener noreferrer",className:g(T,"hover:bg-[#1877F2] hover:text-white"),title:"Facebook",children:e.jsx(se,{className:"h-4 w-4"})}):null,!s&&t.twitter?e.jsx("a",{href:t.twitter,target:"_blank",rel:"noopener noreferrer",className:g(T,"hover:bg-[#1DA1F2] hover:text-white"),title:"Twitter",children:e.jsx(B,{className:"h-4 w-4"})}):null,!s&&t.linkedin?e.jsx("a",{href:t.linkedin,target:"_blank",rel:"noopener noreferrer",className:g(T,"hover:bg-[#0A66C2] hover:text-white"),title:"LinkedIn",children:e.jsx(te,{className:"h-4 w-4"})}):null]})}const L="inline-flex items-center gap-1.5 rounded-full bg-muted/60 px-3 py-1.5 text-xs text-gray-700 hover:bg-muted";function Bt({social:t,className:r}){const{hasOnlineProfiles:s,hasAnySocial:a}=ye(t);if(!a)return null;const n=t.onlineProfiles??[];return e.jsxs("div",{className:g("flex flex-wrap gap-2",r),children:[s?n.map((o,l)=>{const i=ge(o.platform);return e.jsxs("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",className:L,children:[e.jsx(i,{className:"h-3.5 w-3.5"}),o.label||o.platform]},`${o.url}-${l}`)}):null,!s&&t.website?e.jsxs("a",{href:t.website,target:"_blank",rel:"noopener noreferrer",className:L,children:[e.jsx(ne,{className:"h-3.5 w-3.5"})," Website"]}):null,!s&&t.instagram?e.jsxs("a",{href:t.instagram,target:"_blank",rel:"noopener noreferrer",className:L,children:[e.jsx(re,{className:"h-3.5 w-3.5"})," Instagram"]}):null,!s&&t.facebook?e.jsxs("a",{href:t.facebook,target:"_blank",rel:"noopener noreferrer",className:L,children:[e.jsx(se,{className:"h-3.5 w-3.5"})," Facebook"]}):null,!s&&t.twitter?e.jsxs("a",{href:t.twitter,target:"_blank",rel:"noopener noreferrer",className:L,children:[e.jsx(B,{className:"h-3.5 w-3.5"})," Twitter"]}):null,!s&&t.linkedin?e.jsxs("a",{href:t.linkedin,target:"_blank",rel:"noopener noreferrer",className:L,children:[e.jsx(te,{className:"h-3.5 w-3.5"})," LinkedIn"]}):null]})}function tt(t,r){const a={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"}[t.getDay()],n=r.find(o=>o.day===a);return!!(n!=null&&n.enabled)}function xe(t){const[r,s]=t.split(":").map(Number),a=r??0,n=s??0,o=a>=12?"PM":"AM";return`${a%12||12}:${String(n).padStart(2,"0")} ${o}`}const Ot=({schedule:t,blockedDates:r,selectedDate:s,onDateSelect:a,bookingWindowDays:n=365,minimumLeadTimeHours:o,onTimeSlotSelect:l,plannerHighlights:i})=>{const c=Ne(),m=c?1:2,f=b.useMemo(()=>{const d=new Date;return d.setHours(0,0,0,0),d},[]),N=b.useMemo(()=>{if(typeof o!="number"||o<=0)return f;const d=Math.ceil(o/24),u=new Date(f);return u.setDate(u.getDate()+d),u.setHours(0,0,0,0),u},[f,o]),[v,M]=b.useState(()=>V(new Date)),j=b.useMemo(()=>{if(s)try{return new Date(s+"T12:00:00")}catch{return}},[s]),$=b.useCallback(d=>{const u=new Date(d);if(u.setHours(0,0,0,0),u<f||u<N)return!0;const y=k(d,"yyyy-MM-dd");if(r.includes(y))return!0;if(n>0){const p=new Date(f);if(p.setDate(p.getDate()+n),u>p)return!0}return!tt(d,t)},[f,N,r,n,t]),x=b.useCallback(d=>{d&&a(k(d,"yyyy-MM-dd"))},[a]),S=b.useMemo(()=>{if(!s)return null;const d=new Date(s+"T12:00:00"),u=qe(d),y=Ve(u,t);if(!(y!=null&&y.enabled)||y.windows.length===0)return null;const p=Math.max(60,Math.round(Ue*60)),h=new Set;for(const _ of y.windows){const D=de(_.from),O=de(_.to),je=O<D?24*60:O;for(let U=D;U+p<=je;U+=60)h.add(ze(U))}return{dayLabel:k(d,"EEEE, MMM d"),windows:y.windows,slots:Array.from(h).sort()}},[s,t]);b.useCallback(d=>{l&&l(d)},[l]);const w=()=>M(d=>V(new Date(d.getFullYear(),d.getMonth()-1))),C=()=>M(d=>V(new Date(d.getFullYear(),d.getMonth()+1))),A=b.useMemo(()=>{const d=(i==null?void 0:i.cartDatesYmd)??[],u=i==null?void 0:i.partyDateYmd;return{plannerFromCart:y=>d.includes(k(y,"yyyy-MM-dd")),plannerFromParty:y=>{const p=k(y,"yyyy-MM-dd");return!!u&&p===u&&!d.includes(p)}}},[i]);return e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Availability"}),n>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Book up to ",n," days in advance"]})]}),e.jsxs("div",{className:"relative w-full overflow-hidden rounded-2xl border border-border/70 bg-white p-4 shadow-sm",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsx("button",{type:"button",onClick:w,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground","aria-label":"Previous month",children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:k(v,"MMMM yyyy")}),e.jsx("button",{type:"button",onClick:C,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-input bg-background hover:bg-accent hover:text-accent-foreground","aria-label":"Next month",children:e.jsx(Me,{className:"h-4 w-4"})})]}),e.jsx(Se,{mode:"single",month:v,onMonthChange:M,selected:j,onSelect:x,disabled:$,numberOfMonths:m,fixedWeeks:!0,"aria-label":k(v,"MMMM yyyy"),modifiers:i?A:void 0,plannerHighlightDay:!!i,className:g("flex w-full [&_.rdp-months]:w-full [&_.rdp-month]:min-w-0",c?"[&_.rdp-months]:flex [&_.rdp-months]:flex-col [&_.rdp-months]:gap-4":"[&_.rdp-months]:grid [&_.rdp-months]:grid-cols-2 [&_.rdp-months]:gap-6"),classNames:{months:g("w-full",c?"flex flex-col gap-4":"grid grid-cols-2 gap-6"),month:"flex flex-col w-full",caption:"hidden",caption_label:"hidden",nav:"hidden",table:"w-full border-collapse table-fixed",head_row:"flex w-full mb-2",head_cell:"text-gray-500 flex-1 flex items-center justify-center text-xs font-medium h-8 min-w-0",row:"flex w-full mt-1",cell:"flex-1 flex items-center justify-center p-0 relative min-w-0 h-10",day:g("h-10 w-10 flex items-center justify-center font-normal rounded-lg border border-transparent hover:border-border/60 hover:bg-accent/50 transition-colors text-sm cursor-pointer"),day_selected:"bg-brand text-white hover:bg-brand hover:text-white font-medium",day_today:"bg-muted/40 font-semibold border-border/40",day_outside:"text-gray-300 opacity-40",day_disabled:"text-gray-300 opacity-40 cursor-not-allowed line-through border-transparent hover:border-transparent hover:bg-transparent",day_hidden:"invisible"}}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Click a date to use it in the booking flow. Blocked and past dates are not selectable."}),S&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-border/60 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[e.jsx(Ce,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{children:S.dayLabel})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Available"," ",S.windows.map(d=>`${xe(d.from)} – ${xe(d.to)}`).join(", "),". There may already be bookings on this date, so specific times can fill up quickly."]})]})]})]})};function st(t,r){if(!t)return"Price on request";const{kind:s,unitAmount:a}=t,n=Ae(q(a,r));switch(s){case"fixed_per_event":return`${n} flat`;case"fixed_per_guest":return`${n} / person`;case"fixed_per_hour":return`${n} / hr`;case"fixed_per_quantity":return`${n} each`;default:return n}}function rt({addOn:t,feeInput:r,selection:s,onToggle:a,onSetQuantity:n}){var f;const o=!!s,l=((f=t.priceModel)==null?void 0:f.kind)==="fixed_per_quantity",i=(s==null?void 0:s.quantity)??1,c=()=>{i<=1?a():n(i-1)},m=()=>{n(i+1)};return e.jsx("div",{className:g("relative rounded-2xl border-2 p-4 transition-all",o?"border-brand bg-brand/5 shadow-md":"border-border/70 bg-white hover:border-brand/50 hover:shadow-sm"),children:e.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[t.imageUrl&&e.jsx("img",{src:t.imageUrl,alt:t.name,className:"h-14 w-14 shrink-0 rounded-lg object-cover",loading:"lazy"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:e.jsx("h4",{className:"font-semibold text-sm text-gray-900",children:t.name})}),t.priceModel&&e.jsx("p",{className:"text-xs font-medium text-gray-900",children:st(t.priceModel,r)}),t.description&&e.jsx("p",{className:"text-xs text-gray-600 break-words",children:t.description})]}),e.jsx("div",{className:"shrink-0 flex items-center",children:o&&l?e.jsx(Ye,{valueControl:e.jsx("span",{className:"w-8 text-center text-sm font-medium tabular-nums",children:i}),onDecrement:c,onIncrement:m,decrementAriaLabel:`Remove one ${t.name}`,incrementAriaLabel:`Add one more ${t.name}`,decrementDisabled:!1,incrementDisabled:!1,className:"gap-1",buttonClassName:"h-7 w-7",iconClassName:"h-3 w-3"}):e.jsxs("button",{type:"button",onClick:a,className:g("inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-xs font-medium border transition-colors",o?"border-brand bg-brand text-white hover:bg-brand/90":"border-border text-gray-700 hover:border-brand hover:text-brand"),children:[!o&&e.jsx(Ge,{className:"h-3 w-3"}),o?"Remove":"Add"]})})]})})}const qt=({addOns:t,feeInput:r,selectedAddOns:s,onToggle:a,onSetQuantity:n})=>t.length===0?null:e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Optional Add-Ons"}),e.jsx("div",{className:"space-y-3",children:t.map(o=>{const l=s.find(i=>i.addOnId===o.id);return e.jsx(rt,{addOn:o,feeInput:r,selection:l,onToggle:()=>a(o.id),onSetQuantity:i=>n(o.id,i)},o.id)})}),s.length>0&&e.jsxs("p",{className:"text-xs text-brand font-medium",children:[s.length," add-on",s.length!==1?"s":""," selected — included in your total at checkout."]})]}),nt=24*60*60*1e3;function Vt(t,r=new Date){if(!t)return null;const[s,a,n]=t.split("-"),o=Number(s),l=Number(a),i=Number(n);if(!Number.isFinite(o)||!Number.isFinite(l)||!Number.isFinite(i))return null;const c=Date.UTC(o,l-1,i),m=Date.UTC(r.getFullYear(),r.getMonth(),r.getDate());return Math.floor((c-m)/nt)}function zt(t,r,s){const a=`${t}T${r}:00`,[n,o]=r.split(":").map(Number),[l,i]=s.split(":").map(Number),c=n*60+(o||0),f=l*60+(i||0)<=c,[N,v,M]=t.split("-").map(Number),j=new Date(N,v-1,M);f&&j.setDate(j.getDate()+1);const x=`${`${j.getFullYear()}-${String(j.getMonth()+1).padStart(2,"0")}-${String(j.getDate()).padStart(2,"0")}`}T${s}:00`;return{startDateTime:a,endDateTime:x,spansNextDay:f}}const Ut=t=>typeof t=="number"&&Number.isFinite(t)&&t>0;function Yt(t,r){const s=Math.floor(r);if(!t||s<=0)return"";const a=/^(\d{2}):(\d{2})$/.exec(t);if(!a)return"";const n=Number(a[1]),o=Number(a[2]);if(!Number.isFinite(n)||!Number.isFinite(o)||n>23||o>59)return"";const l=(n*60+o+s)%(24*60),i=Math.floor(l/60),c=l%60;return`${String(i).padStart(2,"0")}:${String(c).padStart(2,"0")}`}function K(t){const r=Math.floor(t/60),s=t%60;return s===0?`${r}h`:`${r}h ${s}m`}function at(t,r,s){return Math.max(r,Math.min(s,t))}function Gt({valueMinutes:t,minMinutes:r,maxMinutes:s,stepMinutes:a,onChange:n,className:o}){const l=at(t,r,s);return e.jsxs("div",{className:g("flex flex-col gap-2",o),children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Duration"}),e.jsx("span",{className:"text-sm font-medium tabular-nums",children:K(l)})]}),e.jsx(Pe,{value:[l],min:r,max:s,step:a,onValueChange:i=>{const c=i[0];typeof c=="number"&&n(c)},"aria-label":"Duration"}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground tabular-nums",children:[e.jsx("span",{children:K(r)}),e.jsx("span",{children:K(s)})]})]})}function Wt(t){return b.useMemo(()=>{if(!t.eventDate)return{isValid:!1,nextMissingRequirement:"Pick a date for your event."};if(!t.startTime)return{isValid:!1,nextMissingRequirement:"Pick a start time."};if(t.durationMinutes<=0)return{isValid:!1,nextMissingRequirement:"Set a duration for your event."};if(t.requiresPackageSelection&&!t.packageSelected)return{isValid:!1,nextMissingRequirement:"Choose a package."};if(t.guestCount<t.guestMin){const r=t.guestMin-t.guestCount;return{isValid:!1,nextMissingRequirement:`Add ${r} more guest${r===1?"":"s"} to meet the minimum (${t.guestMin}).`}}return t.guestCount>t.guestMax?{isValid:!1,nextMissingRequirement:`Reduce guests to at most ${t.guestMax} to fit this listing.`}:t.requiresEventLocation&&!t.hasVerifiedEventLocation?{isValid:!1,nextMissingRequirement:"Add a verified event address."}:{isValid:!0,nextMissingRequirement:null}},[t.eventDate,t.startTime,t.durationMinutes,t.guestCount,t.guestMin,t.guestMax,t.requiresEventLocation,t.hasVerifiedEventLocation,t.requiresPackageSelection,t.packageSelected])}const ot=new Set(["US-TX"]);function Kt(t,r){return!t||!r?!1:ot.has(`${t}-${r}`)}const Qt=({images:t,videos:r=[],serviceName:s,isMobile:a,onShareClick:n,onSaveClick:o,isSaved:l})=>{const[i,c]=b.useState(!1),[m,f]=b.useState(!1),[N,v]=b.useState(0),[M,j]=b.useState(0),$=b.useRef(null),x=t.length>0?t:[G],S=b.useMemo(()=>[...x.map(d=>({type:"image",src:d})),...r.map(d=>({type:"video",src:d}))],[x,r]),w=()=>c(!0),C=d=>{v(d),c(!1),f(!0)},A=()=>{f(!1),c(!0)};if(b.useEffect(()=>{j(0),$.current&&($.current.scrollLeft=0)},[x.length]),a){const d=x[0],u=x.slice(1,3),y=x.length>3?x.length-3:0;return e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"relative grid grid-cols-[1.75fr_1fr] grid-rows-2 gap-1 aspect-[4/3] max-h-[280px] w-full",children:[e.jsxs("button",{type:"button",className:"row-span-2 relative overflow-hidden rounded-l-xl rounded-r-none border border-black/5 shadow-sm bg-muted text-left cursor-zoom-in",onClick:w,children:[e.jsx(I,{originalSrc:d??G,variant:"medium",alt:s,className:"h-full w-full object-cover",loading:"eager"}),r.length>0&&e.jsxs("div",{className:"pointer-events-none absolute bottom-2 left-2 flex items-center gap-1.5 rounded-full bg-black/50 px-2.5 py-1.5 text-xs font-medium text-white backdrop-blur-sm",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[r.length," video",r.length!==1?"s":""]})]})]}),u.length===0?e.jsx("div",{className:"row-span-2 rounded-r-xl border border-black/5 bg-muted/30"}):u.map((p,h)=>e.jsxs("button",{type:"button",className:g("relative overflow-hidden border border-black/5 shadow-sm bg-muted text-left cursor-zoom-in",u.length===1&&"row-span-2 rounded-r-xl",u.length===2&&h===0&&"rounded-tr-xl rounded-br-none",u.length===2&&h===1&&"rounded-br-xl rounded-tr-none"),onClick:w,children:[e.jsx(I,{originalSrc:p,variant:"thumbnail",alt:`${s} ${h+2}`,className:"h-full w-full object-cover",loading:"lazy"}),h===1&&y>0&&e.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 text-sm font-semibold text-white",children:["+",y," more"]})]},`${p}-${h}`))]}),e.jsx(J,{open:i,onOpenChange:c,children:e.jsxs(H,{fullScreen:!0,hideCloseButton:!0,className:"flex flex-col rounded-none border-0 bg-white p-0 overflow-hidden",children:[e.jsx(X,{className:"sr-only",children:"Photo tour"}),e.jsx(Z,{className:"sr-only",children:"Browse photos and videos"}),e.jsxs("header",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-3 bg-white",children:[e.jsx(P,{variant:"ghost",size:"icon",onClick:()=>c(!1),"aria-label":"Back",children:e.jsx(ae,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsxs(P,{variant:"ghost",size:"sm",onClick:n,children:[e.jsx(z,{className:"h-4 w-4"}),"Share"]}),o&&e.jsxs(P,{variant:"ghost",size:"sm",onClick:o,children:[e.jsx(oe,{className:`h-4 w-4 ${l?"fill-red-500 text-red-500":""}`}),"Save"]})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-white",children:e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 sm:px-6 sm:py-8",children:[x.length>0&&e.jsxs("section",{className:"space-y-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Photos"}),e.jsx("div",{className:"columns-2 gap-4 sm:columns-2 lg:columns-3 [column-fill:balance]",children:x.map((p,h)=>e.jsx("button",{type:"button",className:"break-inside-avoid mb-4 block w-full text-left rounded-xl overflow-hidden border border-border/80 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 min-h-[200px] bg-muted/30",onClick:()=>C(h),children:e.jsx(I,{originalSrc:p,variant:"medium",alt:`${s} photo ${h+1}`,className:"w-full h-auto min-h-[200px] object-cover",loading:"lazy"})},`${p}-${h}`))})]}),r.length>0&&e.jsxs("section",{className:g("space-y-6",x.length>0&&"mt-10"),children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Videos"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:r.map((p,h)=>e.jsxs("button",{type:"button",onClick:()=>C(x.length+h),className:"group relative aspect-video w-full rounded-xl overflow-hidden border border-border/80 bg-black/90 text-left focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[e.jsx($e,{src:p,className:"h-full w-full object-contain",preload:"metadata",muted:!0,playsInline:!0,disablePictureInPicture:!0,disableRemotePlayback:!0,"aria-label":`${s} video ${h+1}`}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 transition group-hover:bg-black/40",children:e.jsx("span",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-white/90 text-black shadow-lg transition group-hover:scale-110",children:e.jsx(ie,{className:"h-7 w-7 fill-current pl-0.5"})})})]},`${p}-${h}`))})]})]})})]})}),e.jsx(le,{items:S,initialIndex:N,open:m,onClose:()=>f(!1),onBack:A,title:s})]})}return e.jsxs(e.Fragment,{children:[e.jsxs("section",{"data-service-image-gallery":!0,className:"relative grid gap-1 md:grid-cols-[minmax(0,1.75fr)_minmax(0,1fr)] md:items-stretch",children:[e.jsxs("button",{type:"button",className:"group relative overflow-hidden rounded-[32px] md:rounded-r-none aspect-[4/3] md:aspect-auto md:h-[24rem] w-full text-left cursor-zoom-in",onClick:w,children:[e.jsx("div",{className:"absolute inset-0 overflow-hidden rounded-[32px] md:rounded-r-none",children:e.jsx(I,{originalSrc:x[0]??G,variant:"full",alt:s,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105",loading:"eager"})}),e.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[32px] md:rounded-r-none border border-black/5 shadow-xl"}),r.length>0&&e.jsxs("div",{className:"pointer-events-none absolute bottom-3 left-3 flex items-center gap-1.5 rounded-full bg-black/50 px-2.5 py-1.5 text-xs font-medium text-white backdrop-blur-sm",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsxs("span",{children:[r.length," video",r.length!==1?"s":""]})]})]}),e.jsx("div",{className:"grid gap-1 md:h-[24rem] md:grid-cols-2 md:grid-rows-[repeat(2,1fr)]",children:x.slice(1,5).map((d,u)=>e.jsxs("button",{type:"button",onClick:w,className:g("relative overflow-hidden border border-black/5 shadow-md aspect-[4/3] md:aspect-auto md:h-full",u===0&&"rounded-none",u===1&&"rounded-none md:rounded-tr-[32px]",u===2&&"rounded-none",u===3&&"rounded-none md:rounded-br-[32px]"),children:[e.jsx(I,{originalSrc:d,variant:"medium",alt:`${s} gallery ${u+2}`,className:"h-full w-full object-cover transition-transform duration-300 hover:scale-105",loading:"lazy"}),u===3&&e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-0.5 bg-black/40 text-sm font-medium uppercase tracking-wide text-white pointer-events-none",children:[e.jsx("span",{children:"View all photos"}),r.length>0&&e.jsxs("span",{className:"flex items-center gap-1 text-xs normal-case opacity-90",children:[e.jsx(Y,{className:"h-3 w-3"}),r.length," video",r.length!==1?"s":""]})]})]},`${d}-${u}`))})]}),e.jsx(J,{open:i,onOpenChange:c,children:e.jsxs(H,{fullScreen:!0,hideCloseButton:!0,className:"flex flex-col rounded-none border-0 bg-white p-0 overflow-hidden",children:[e.jsx(X,{className:"sr-only",children:"Photo tour"}),e.jsx(Z,{className:"sr-only",children:"Browse photos and videos"}),e.jsxs("header",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-3 bg-white",children:[e.jsx(P,{variant:"ghost",size:"icon",onClick:()=>c(!1),"aria-label":"Back",children:e.jsx(ae,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[n&&e.jsxs(P,{variant:"ghost",size:"sm",onClick:n,children:[e.jsx(z,{className:"h-4 w-4"}),"Share"]}),o&&e.jsxs(P,{variant:"ghost",size:"sm",onClick:o,children:[e.jsx(oe,{className:`h-4 w-4 ${l?"fill-red-500 text-red-500":""}`}),"Save"]})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-white",children:e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 sm:px-6 sm:py-8",children:[x.length>0&&e.jsxs("section",{className:"space-y-6",children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Photos"}),e.jsx("div",{className:"columns-2 gap-4 sm:columns-2 lg:columns-3 [column-fill:balance]",children:x.map((d,u)=>e.jsx("button",{type:"button",className:"break-inside-avoid mb-4 block w-full text-left rounded-xl overflow-hidden border border-border/80 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 min-h-[200px] bg-muted/30",onClick:()=>C(u),children:e.jsx(I,{originalSrc:d,variant:"medium",alt:`${s} photo ${u+1}`,className:"w-full h-auto min-h-[200px] object-cover",loading:"lazy"})},`${d}-${u}`))})]}),r.length>0&&e.jsxs("section",{className:g("space-y-6",x.length>0&&"mt-10"),children:[e.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Videos"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:r.map((d,u)=>e.jsxs("button",{type:"button",onClick:()=>C(x.length+u),className:"group relative aspect-video w-full rounded-xl overflow-hidden border border-border/80 bg-black/90 text-left focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[e.jsx("video",{src:d,className:"h-full w-full object-contain",preload:"metadata",muted:!0,playsInline:!0,disablePictureInPicture:!0,disableRemotePlayback:!0,"aria-label":`${s} video ${u+1}`}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 transition group-hover:bg-black/40",children:e.jsx("span",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-white/90 text-black shadow-lg transition group-hover:scale-110",children:e.jsx(ie,{className:"h-7 w-7 fill-current pl-0.5"})})})]},`${d}-${u}`))})]})]})})]})}),e.jsx(le,{items:S,initialIndex:N,open:m,onClose:()=>f(!1),onBack:A,title:s})]})},R=t=>typeof t!="number"||!Number.isFinite(t)?null:t;function Jt(t){var i,c,m;const r=R(((i=t.authoritative)==null?void 0:i.total)??null),s=R(((c=t.authoritative)==null?void 0:c.subtotal)??null),a=R(((m=t.authoritative)==null?void 0:m.serviceFee)??null);if(r!==null)return{subtotal:s,serviceFee:a,total:r,isAuthoritative:!0,source:"backend"};const n=R(t.derivedSubtotal??null),o=R(t.derivedServiceFee??null),l=R(t.derivedTotal??null);return n!==null||o!==null||l!==null?{subtotal:n,serviceFee:o,total:l,isAuthoritative:!1,source:"derived",notes:t.notes,reason:"missing_total"}:{subtotal:null,serviceFee:null,total:null,isAuthoritative:!1,source:"unavailable",notes:t.notes,reason:"insufficient_input"}}const it="https://api.plec-it.com";async function lt(t,r){const s=await fetch(`${it}/public/venues/${t}/availability?month=${r}`);if(!s.ok)return[];const a=await s.json();return Array.isArray(a.unavailableDates)?a.unavailableDates.filter(n=>typeof n=="string"):[]}async function ct(t,r){const s=V(new Date),a=Array.from({length:r},(l,i)=>k(_e(s,i),"yyyy-MM")),n=await Promise.all(a.map(l=>lt(t,l))),o=new Set;for(const l of n)l.forEach(i=>o.add(i));return Array.from(o)}function Ht(t,r={}){const{numMonths:s=12,enabled:a=!0}=r,{data:n=[],isLoading:o}=De({queryKey:["listing-availability",t,s],queryFn:()=>ct(t,s),enabled:!!(t&&a),staleTime:60*1e3});return{unavailableDates:n,isLoading:o}}const Q={venue:"Check out this venue on PLEC",service:"Check out this service on PLEC"};function dt(t,r){const s=encodeURIComponent(t),a=encodeURIComponent(Q[r]),n=encodeURIComponent(`${Q[r]}
${t}`);return{copyLink:async()=>{await navigator.clipboard.writeText(t)},email:()=>{window.location.href=`mailto:?subject=${a}&body=${n}`},messages:()=>{window.location.href=`sms:?body=${s}`},whatsapp:()=>{window.open(`https://wa.me/?text=${s}`,"_blank")},messenger:()=>{const o=encodeURIComponent(t);window.open(`https://www.facebook.com/dialog/send?link=${s}&redirect_uri=${o}`,"_blank")},facebook:()=>{window.open(`https://www.facebook.com/sharer/sharer.php?u=${s}`,"_blank")},twitter:()=>{window.open(`https://x.com/intent/tweet?url=${s}`,"_blank")},moreOptions:async()=>{if(navigator.share)try{return await navigator.share({url:t,title:Q[r],text:t}),"shared"}catch(o){if(o.name!=="AbortError")return await navigator.clipboard.writeText(t),"copied";throw o}return await navigator.clipboard.writeText(t),"copied"}}}const ut=[{id:"copyLink",label:"Copy link",icon:e.jsx(We,{className:"h-4 w-4"})},{id:"email",label:"Email",icon:e.jsx(Ie,{className:"h-4 w-4"})},{id:"messages",label:"Messages",icon:e.jsx(be,{className:"h-4 w-4"})},{id:"whatsapp",label:"WhatsApp",icon:e.jsx(Ke,{className:"h-4 w-4"})},{id:"messenger",label:"Messenger",icon:e.jsx(Qe,{className:"h-4 w-4"})},{id:"facebook",label:"Facebook",icon:e.jsx(z,{className:"h-4 w-4"})},{id:"twitter",label:"Twitter",icon:e.jsx(z,{className:"h-4 w-4"})},{id:"moreOptions",label:"More options",icon:e.jsx(Xe,{className:"h-4 w-4"})}];function Xt({shareUrl:t,context:r,className:s}){const{toast:a}=pe(),n=ve.useMemo(()=>dt(t,r),[t,r]),o=async l=>{const i=n[l];if(l==="copyLink"){try{await i(),a({title:"Link copied",description:"The link has been copied to your clipboard."})}catch{a({title:"Failed to copy",description:"Please try again or copy the link manually.",variant:"destructive"})}return}if(l==="moreOptions"){try{await i()==="copied"&&a({title:"Link copied",description:"The link has been copied to your clipboard."})}catch{a({title:"Failed to copy",description:"Please try again or copy the link manually.",variant:"destructive"})}return}i()};return e.jsxs("div",{className:g("space-y-4",s),children:[e.jsx("div",{className:"rounded-2xl border border-border/70 bg-muted/40 p-3 text-xs text-muted-foreground break-all",children:t}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ut.map(({id:l,label:i,icon:c})=>e.jsxs(P,{variant:"outline",size:"sm",className:"h-auto flex-col gap-1.5 rounded-xl py-3",onClick:()=>o(l),children:[c,e.jsx("span",{className:"text-xs font-medium",children:i})]},l))})]})}function Zt({open:t,onClose:r,listingId:s,defaultEventDate:a,defaultGuestCount:n,defaultStartTime:o,defaultEndTime:l}){const i=we(),{toast:c}=pe(),m=Fe(),[f,N]=b.useState(""),[v,M]=b.useState(""),[j,$]=b.useState(()=>{if(!a)return null;try{return he(a,"yyyy-MM-dd",new Date)}catch{return null}}),[x,S]=b.useState(n&&n>0?String(n):""),[w,C]=b.useState(o??""),[A,d]=b.useState(l??""),u=f.trim().length>0,y=()=>{N(""),M(""),$(a?he(a,"yyyy-MM-dd",new Date):null),S(n&&n>0?String(n):""),C(o??""),d(l??""),r()},p=async()=>{if(!u)return;const h=parseInt(x,10),_=[`Hi! I'd like to request a custom quote: ${f.trim()}`];v.trim()&&_.push(v.trim());const D=[];j&&D.push(`Date: ${k(j,"MMM d, yyyy")}`),!isNaN(h)&&h>0&&D.push(`Guests: ${h}`),w&&D.push(`Time: ${ue(w)}${A?` – ${ue(A)}`:""}`),D.length>0&&_.push(D.join(" · "));try{const O=await m.mutateAsync({listingId:s,initialMessage:_.join(`
`),customRequestContext:{title:f.trim(),description:v.trim()||void 0,eventDate:j?k(j,"yyyy-MM-dd"):void 0,eventTime:w||void 0,eventEndTime:A||void 0,guestCount:!isNaN(h)&&h>0?h:void 0,sourceListingId:s}});i(`/messages?conversationId=${O.conversation.conversationId}`)}catch{c({title:"Failed to send request",variant:"destructive"})}};return e.jsx(J,{open:t,onOpenChange:h=>!h&&y(),children:e.jsxs(H,{className:"sm:max-w-lg",children:[e.jsx(Te,{className:"pb-1",children:e.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-xl bg-brand/10 shrink-0",children:e.jsx(Le,{className:"h-4.5 w-4.5 text-brand"})}),e.jsxs("div",{children:[e.jsx(X,{className:"text-base",children:"Request a Custom Quote"}),e.jsx(Z,{className:"mt-0.5 text-xs text-muted-foreground",children:"Describe what you need and start a conversation with the host."})]})]})}),e.jsxs("div",{className:"space-y-5 py-1",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Your Request"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(F,{htmlFor:"cqr-title",children:"What do you need?"}),e.jsx(ce,{id:"cqr-title",placeholder:"e.g. Full event coordination for 80 guests",maxLength:200,value:f,onChange:h=>N(h.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(F,{htmlFor:"cqr-description",children:["Details"," ",e.jsx("span",{className:"text-muted-foreground text-xs font-normal",children:"(optional)"})]}),e.jsx(Re,{id:"cqr-description",placeholder:"Special requirements, theme, setup preferences…",maxLength:2e3,rows:3,value:v,onChange:h=>M(h.target.value)})]})]}),e.jsx(Ee,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(He,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Event Details"," ",e.jsx("span",{className:"normal-case font-normal",children:"(optional)"})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(F,{htmlFor:"cqr-event-date",children:"Event date"}),e.jsx(Je,{id:"cqr-event-date",value:j,onChange:$,placeholder:"Select date"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Be,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx(F,{htmlFor:"cqr-guests",children:"Guests"})]}),e.jsx(ce,{id:"cqr-guests",type:"number",min:1,placeholder:"50",value:x,onChange:h=>S(h.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(F,{htmlFor:"cqr-start-time",children:"Start time"}),e.jsx(me,{value:w,onChange:C,placeholder:"Add time"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(F,{htmlFor:"cqr-end-time",children:"End time"}),e.jsx(me,{value:A,onChange:d,placeholder:"Add time",minTime:w||void 0})]})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground bg-muted/50 rounded-lg px-3 py-2.5",children:"Your request starts a conversation with the host, who will review your details and send you a custom quote."})]}),e.jsxs("div",{className:"flex gap-2 pt-1",children:[e.jsx(P,{variant:"outline",size:"sm",className:"flex-1",onClick:y,children:"Cancel"}),e.jsx(P,{size:"sm",className:"flex-1",onClick:p,disabled:!u||m.isPending,children:m.isPending?"Sending…":"Send Request"})]})]})})}const mt=new Set(["fixed_per_event","fixed_per_guest","fixed_per_hour","fixed_per_quantity"]);function ht(t){if(!t||typeof t!="object")return!1;const r=t;return typeof r.kind=="string"&&mt.has(r.kind)&&typeof r.unitAmount=="number"&&r.unitAmount>=0}function ft(t){const r=t&&typeof t=="object"?t:void 0;return Array.isArray(r==null?void 0:r.addOns)?r.addOns.filter(s=>!!(s&&typeof s=="object")).filter(s=>s.status!=="archived").map(s=>({id:typeof s.id=="string"?s.id:String(s.id??""),name:typeof s.name=="string"?s.name:"",description:typeof s.description=="string"?s.description:void 0,imageUrl:typeof s.imageUrl=="string"?s.imageUrl:void 0,status:"active",priceModel:ht(s.priceModel)?s.priceModel:void 0,sortOrder:typeof s.sortOrder=="number"?s.sortOrder:void 0})).filter(s=>s.id.length>0&&s.name.length>0).sort((s,a)=>(s.sortOrder??999)-(a.sortOrder??999)):[]}function es(t){return b.useMemo(()=>ft(t),[t])}async function ts(t){var o,l,i,c,m;const r={listingId:t.listingId,startTime:t.startTime,endTime:t.endTime,guestCount:t.guestCount,skipBaseRate:t.skipBaseRate??!1};(o=t.selectedPackageIds)!=null&&o.length?(r.selectedPackageIds=t.selectedPackageIds,r.selectedPackageId=t.selectedPackageIds[0]):t.selectedPackageId&&(r.selectedPackageId=t.selectedPackageId),(l=t.selectedAddOns)!=null&&l.length&&(r.selectedAddOns=t.selectedAddOns),!((((i=t.selectedPackageIds)==null?void 0:i.length)??0)>0||!!t.selectedPackageId)&&((c=t.selectedPackages)!=null&&c.length)&&(r.selectedPackages=t.selectedPackages),(m=t.sliderSelections)!=null&&m.length&&(r.sliderSelections=t.sliderSelections);const a=await fetch(Oe("/cart/preview"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(r),signal:t.signal}),n=await a.json().catch(()=>({}));if(!a.ok){const f=typeof(n==null?void 0:n.message)=="string"?n.message:"Failed to fetch pricing preview";throw new Error(f)}return{subtotal:typeof(n==null?void 0:n.subtotal)=="number"?n.subtotal:Number((n==null?void 0:n.subtotal)||0),serviceFee:typeof(n==null?void 0:n.serviceFee)=="number"?n.serviceFee:Number((n==null?void 0:n.serviceFee)||0),total:typeof(n==null?void 0:n.total)=="number"?n.total:Number((n==null?void 0:n.total)||0),selectionSnapshots:Array.isArray(n==null?void 0:n.selectionSnapshots)?n.selectionSnapshots:void 0,advanceBookingModifier:(n==null?void 0:n.advanceBookingModifier)??null}}function ss(t){if(typeof t=="boolean")return t;if(typeof t=="number"){if(t===1)return!0;if(t===0)return!1}if(typeof t=="string"){const r=t.trim().toLowerCase();if(r==="true"||r==="1")return!0;if(r==="false"||r==="0")return!1}}export{Zt as C,Gt as D,It as E,qt as L,Et as P,Qt as S,Ot as V,Kt as a,zt as b,_t as c,Vt as d,Jt as e,Yt as f,ts as g,Ht as h,Ut as i,ss as j,es as k,Xt as l,ye as m,Bt as n,Rt as o,Ft as p,Lt as s,Wt as u,Tt as v};