import{j as n,r as g,b as J}from"./vendor-react-DgEFbQIi.js";import{aG as W,bF as Fe,a as y,bG as je,aY as se,aX as Re,bp as ve,aW as ke,V as Le,o as q,bR as X,bS as Q,bT as Z,bU as ee,u as Be,bV as L,f as S,C as Oe,j as Ve,bW as Ue,ba as ze,bX as Ge,bY as Ke,bZ as He,b_ as Je,b$ as re,c0 as Ye,c1 as We,c2 as qe,U as Ne,c3 as Xe,x as I,c4 as U,aw as oe,ax as ae,ah as ie,ai as le,B as P,k as ce,b3 as B,b4 as de,c5 as Qe,c6 as ue,c7 as me,O as Me,c8 as Ze,c9 as et,ca as tt,bi as nt,bh as st,T as Ce}from"./index-DFVuS8SP.js";import"./vendor-amplify-BBi2B1tW.js";import{g as rt}from"./claimRequests-54T7aAUE.js";import{L as F}from"./link-2-BCZlQqmz.js";import{T as R,s as ot}from"./listingBookingMode-C1OKcUc5.js";import{c as at,d as it,t as fe,m as lt,M as ct}from"./availability-uF5JIR8q.js";import{P as dt}from"./pencil-hVBxHOIk.js";import{T as he}from"./time-picker-CVBYk6mZ.js";import{p as be}from"./parse-DWUfxhsp.js";import{C as ut}from"./copy-Bg4Oavyf.js";import{M as mt}from"./message-circle-DUsZlt4V.js";import{S as ft}from"./send-CbUVXki9.js";import{p as Se}from"./parseTwoModelBreakdown-C0mm51kj.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 ht=W("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 bt=W("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 xt=W("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"}]]),pt=({valueControl:e,onDecrement:t,onIncrement:s,decrementAriaLabel:r,incrementAriaLabel:a,decrementDisabled:i=!1,incrementDisabled:o=!1,className:c,buttonClassName:d,decrementButtonClassName:l,incrementButtonClassName:m,iconClassName:x="h-4 w-4"})=>n.jsxs("div",{className:y("flex items-center gap-3",c),children:[n.jsx("button",{type:"button",onClick:t,className:y("touch-manipulation disabled:opacity-40 disabled:cursor-not-allowed",d,l),"aria-label":r,disabled:i,children:n.jsx(Fe,{className:x})}),e,n.jsx("button",{type:"button",onClick:s,className:y("touch-manipulation disabled:opacity-40 disabled:cursor-not-allowed",d,m),"aria-label":a,disabled:o,children:n.jsx(je,{className:x})})]}),gt="Priced when added";function z(e,t){const s=ke(e);if(s===null)return gt;switch(t){case"per_person":case"per_guest":return`${s}/person`;case"per_hour":return`${s}/hr`;default:return s}}function on({metadata:e,offerings:t}){var o,c;const s=(e==null?void 0:e.pricing)??{},r=[];if(Array.isArray(s.packages))for(const d of s.packages){const l=d;l.postBookingEligible===!0&&l.id&&l.name&&r.push({id:l.id,name:l.name,priceLabel:z(se(l)??Re(l),l.priceType)})}if(Array.isArray(t))for(const d of t)d.postBookingEligible===!0&&r.push({id:d.id,name:d.name,priceLabel:z(se(d),d.priceType)});const a=[];if(Array.isArray(s.addOns))for(const d of s.addOns){const l=d;((o=l.postBooking)==null?void 0:o.eligible)===!0&&l.id&&l.name&&a.push({id:l.id,name:l.name,priceLabel:z(ve(l),(c=l.priceModel)==null?void 0:c.kind.replace("fixed_",""))})}const i=[...r,...a];return i.length===0?null:n.jsxs("div",{className:"rounded-xl border border-blue-100 bg-blue-50/60 p-4 space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(bt,{className:"h-4 w-4 text-blue-600 shrink-0"}),n.jsx("p",{className:"text-sm font-medium text-blue-900",children:"Available after booking"})]}),n.jsx("p",{className:"text-xs text-blue-700 leading-relaxed",children:"These items can be added to your booking even after it's confirmed."}),n.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(d=>n.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:[d.name,d.priceLabel&&n.jsx("span",{className:"text-blue-500 font-normal",children:d.priceLabel})]},d.id))})]})}function an({slots:e,className:t}){return e.length===0?null:n.jsx("div",{className:`rounded-xl border border-emerald-200 bg-emerald-50 px-4 py-3 ${t??""}`,children:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(xt,{className:"mt-0.5 h-4 w-4 flex-shrink-0 text-emerald-600"}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-sm font-semibold text-emerald-800",children:"Early Booking Discount"}),e.map((s,r)=>{var a;return n.jsxs("p",{className:"text-sm text-emerald-700",children:["Book ",n.jsxs("span",{className:"font-medium",children:[s.daysAhead,"+ days"]})," in advance and save"," ",s.discountPercent!=null?n.jsxs("span",{className:"font-medium",children:[s.discountPercent,"%"]}):n.jsxs("span",{className:"font-medium",children:["$",(a=s.discountFixed)==null?void 0:a.toFixed(0)]})]},r)})]})]})})}function ln(e){return e?e.filter(t=>{var s;return t.type==="early_bird"&&typeof((s=t.conditions)==null?void 0:s.advanceDays)=="number"}).sort((t,s)=>{var r,a;return(((r=t.conditions)==null?void 0:r.advanceDays)??0)-(((a=s.conditions)==null?void 0:a.advanceDays)??0)}).map(t=>({daysAhead:t.conditions.advanceDays,discountPercent:t.value})):[]}function cn(e){const t=e.pricing,s=t==null?void 0:t.timelinePricing;return!(s!=null&&s.enabled)||!Array.isArray(s.slots)?[]:s.slots.filter(r=>r.adjustmentValue<0&&r.minDaysAhead>0).sort((r,a)=>r.minDaysAhead-a.minDaysAhead).map(r=>({daysAhead:r.minDaysAhead,...r.adjustmentType==="percent"?{discountPercent:Math.round(Math.abs(r.adjustmentValue)*100)}:{discountFixed:Math.abs(r.adjustmentValue)}}))}function dn(e,t=!0){const{user:s}=Le();return q({queryKey:["claim-request","me",e,s==null?void 0:s.id],queryFn:()=>rt(e),enabled:!!e&&!!s&&t,staleTime:6e4,retry:!1})}function un(e){return!["/host","/profile","/messages","/checkout","/payments","/bookings"].some(r=>e===r||e.startsWith(`${r}/`))}function mn(e){typeof window>"u"||(e&&sessionStorage.setItem("postAuthRedirect",e),window.dispatchEvent(new CustomEvent("openAuthModal")))}const xe={website:ee,instagram:Z,facebook:Q,twitter:R,"twitter/x":R,linkedin:X,x:R,youtube:F,tiktok:F,pinterest:F,other:F};function Ae(e){const t=e.trim().toLowerCase().replace(/\s+/g," ");return xe[t]??xe[t.replace(/\s*\/\s*x$/i,"")]??F}function _e(e){const t=Array.isArray(e.onlineProfiles)&&e.onlineProfiles.length>0,s=!!(e.website||e.instagram||e.facebook||e.twitter||e.linkedin);return{hasOnlineProfiles:t,hasFlatSocial:s,hasAnySocial:t||s}}const E="flex h-9 w-9 items-center justify-center rounded-full bg-gray-100 text-gray-600 transition-colors";function fn({social:e,className:t}){const{hasOnlineProfiles:s,hasAnySocial:r}=_e(e);if(!r)return null;const a=e.onlineProfiles??[];return n.jsxs("div",{className:y("flex flex-wrap items-center gap-2",t),children:[s?a.map((i,o)=>{const c=Ae(i.platform);return n.jsx("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",className:y(E,"hover:bg-brand hover:text-white"),title:i.label||i.platform,children:n.jsx(c,{className:"h-4 w-4"})},`${i.url}-${o}`)}):null,!s&&e.website?n.jsx("a",{href:e.website,target:"_blank",rel:"noopener noreferrer",className:y(E,"hover:bg-brand hover:text-white"),title:"Website",children:n.jsx(ee,{className:"h-4 w-4"})}):null,!s&&e.instagram?n.jsx("a",{href:e.instagram,target:"_blank",rel:"noopener noreferrer",className:y(E,"hover:bg-[#E4405F] hover:text-white"),title:"Instagram",children:n.jsx(Z,{className:"h-4 w-4"})}):null,!s&&e.facebook?n.jsx("a",{href:e.facebook,target:"_blank",rel:"noopener noreferrer",className:y(E,"hover:bg-[#1877F2] hover:text-white"),title:"Facebook",children:n.jsx(Q,{className:"h-4 w-4"})}):null,!s&&e.twitter?n.jsx("a",{href:e.twitter,target:"_blank",rel:"noopener noreferrer",className:y(E,"hover:bg-[#1DA1F2] hover:text-white"),title:"Twitter",children:n.jsx(R,{className:"h-4 w-4"})}):null,!s&&e.linkedin?n.jsx("a",{href:e.linkedin,target:"_blank",rel:"noopener noreferrer",className:y(E,"hover:bg-[#0A66C2] hover:text-white"),title:"LinkedIn",children:n.jsx(X,{className:"h-4 w-4"})}):null]})}const T="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 hn({social:e,className:t}){const{hasOnlineProfiles:s,hasAnySocial:r}=_e(e);if(!r)return null;const a=e.onlineProfiles??[];return n.jsxs("div",{className:y("flex flex-wrap gap-2",t),children:[s?a.map((i,o)=>{const c=Ae(i.platform);return n.jsxs("a",{href:i.url,target:"_blank",rel:"noopener noreferrer",className:T,children:[n.jsx(c,{className:"h-3.5 w-3.5"}),i.label||i.platform]},`${i.url}-${o}`)}):null,!s&&e.website?n.jsxs("a",{href:e.website,target:"_blank",rel:"noopener noreferrer",className:T,children:[n.jsx(ee,{className:"h-3.5 w-3.5"})," Website"]}):null,!s&&e.instagram?n.jsxs("a",{href:e.instagram,target:"_blank",rel:"noopener noreferrer",className:T,children:[n.jsx(Z,{className:"h-3.5 w-3.5"})," Instagram"]}):null,!s&&e.facebook?n.jsxs("a",{href:e.facebook,target:"_blank",rel:"noopener noreferrer",className:T,children:[n.jsx(Q,{className:"h-3.5 w-3.5"})," Facebook"]}):null,!s&&e.twitter?n.jsxs("a",{href:e.twitter,target:"_blank",rel:"noopener noreferrer",className:T,children:[n.jsx(R,{className:"h-3.5 w-3.5"})," Twitter"]}):null,!s&&e.linkedin?n.jsxs("a",{href:e.linkedin,target:"_blank",rel:"noopener noreferrer",className:T,children:[n.jsx(X,{className:"h-3.5 w-3.5"})," LinkedIn"]}):null]})}function yt(e,t){const r={0:"sunday",1:"monday",2:"tuesday",3:"wednesday",4:"thursday",5:"friday",6:"saturday"}[e.getDay()],a=t.find(i=>i.day===r);return!!(a!=null&&a.enabled)}function pe(e){const[t,s]=e.split(":").map(Number),r=t??0,a=s??0,i=r>=12?"PM":"AM";return`${r%12||12}:${String(a).padStart(2,"0")} ${i}`}const bn=({schedule:e,blockedDates:t,selectedDate:s,onDateSelect:r,bookingWindowDays:a=365,minimumLeadTimeHours:i,onTimeSlotSelect:o,plannerHighlights:c})=>{const d=Be(),l=d?1:2,m=g.useMemo(()=>{const f=new Date;return f.setHours(0,0,0,0),f},[]),x=g.useMemo(()=>{if(typeof i!="number"||i<=0)return m;const f=Math.ceil(i/24),h=new Date(m);return h.setDate(h.getDate()+f),h.setHours(0,0,0,0),h},[m,i]),[p,N]=g.useState(()=>L(new Date)),w=g.useMemo(()=>{if(s)try{return new Date(s+"T12:00:00")}catch{return}},[s]),j=g.useCallback(f=>{const h=new Date(f);if(h.setHours(0,0,0,0),h<m||h<x)return!0;const u=S(f,"yyyy-MM-dd");if(t.includes(u))return!0;if(a>0){const M=new Date(m);if(M.setDate(M.getDate()+a),h>M)return!0}return!yt(f,e)},[m,x,t,a,e]),v=g.useCallback(f=>{f&&r(S(f,"yyyy-MM-dd"))},[r]),b=g.useMemo(()=>{if(!s)return null;const f=new Date(s+"T12:00:00"),h=at(f),u=it(h,e);if(!(u!=null&&u.enabled)||u.windows.length===0)return null;const M=Math.max(60,Math.round(ct*60)),C=new Set;for(const k of u.windows){const te=fe(k.from),ne=fe(k.to),$e=ne<te?24*60:ne;for(let V=te;V+M<=$e;V+=60)C.add(lt(V))}return{dayLabel:S(f,"EEEE, MMM d"),windows:u.windows,slots:Array.from(C).sort()}},[s,e]);g.useCallback(f=>{o&&o(f)},[o]);const A=()=>N(f=>L(new Date(f.getFullYear(),f.getMonth()-1))),_=()=>N(f=>L(new Date(f.getFullYear(),f.getMonth()+1))),D=g.useMemo(()=>{const f=(c==null?void 0:c.cartDatesYmd)??[],h=c==null?void 0:c.partyDateYmd;return{plannerFromCart:u=>f.includes(S(u,"yyyy-MM-dd")),plannerFromParty:u=>{const M=S(u,"yyyy-MM-dd");return!!h&&M===h&&!f.includes(M)}}},[c]);return n.jsxs("section",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[n.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"Availability"}),a>0&&n.jsxs("span",{className:"text-xs text-muted-foreground",children:["Book up to ",a," days in advance"]})]}),n.jsxs("div",{className:"relative w-full overflow-hidden rounded-2xl border border-border/70 bg-white p-4 shadow-sm",children:[n.jsxs("div",{className:"flex items-center justify-between pb-2",children:[n.jsx("button",{type:"button",onClick:A,className:"flex h-11 w-11 md:h-8 md:w-8 items-center justify-center rounded-lg border border-input glass glass-surface","aria-label":"Previous month",children:n.jsx(Oe,{className:"h-4 w-4"})}),n.jsx("span",{className:"text-sm font-semibold text-gray-900",children:S(p,"MMMM yyyy")}),n.jsx("button",{type:"button",onClick:_,className:"flex h-11 w-11 md:h-8 md:w-8 items-center justify-center rounded-lg border border-input glass glass-surface","aria-label":"Next month",children:n.jsx(Ve,{className:"h-4 w-4"})})]}),n.jsx(Ue,{mode:"single",month:p,onMonthChange:N,selected:w,onSelect:v,disabled:j,numberOfMonths:l,fixedWeeks:!0,"aria-label":S(p,"MMMM yyyy"),modifiers:c?D:void 0,plannerHighlightDay:!!c,className:y("flex w-full [&_.rdp-months]:w-full [&_.rdp-month]:min-w-0",d?"[&_.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:y("w-full",d?"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:y("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"}}),n.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."}),b&&n.jsxs("div",{className:"mt-4 pt-4 border-t border-border/60 space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-gray-900",children:[n.jsx(ze,{className:"h-4 w-4 text-muted-foreground"}),n.jsx("span",{children:b.dayLabel})]}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Available"," ",b.windows.map(f=>`${pe(f.from)} – ${pe(f.to)}`).join(", "),". There may already be bookings on this date, so specific times can fill up quickly."]})]})]})]})};function wt(e,t,s={}){if(!e||e.length===0)return null;const r=e.filter(i=>i.kind==="package"),a=t?r.find(i=>i.sourceEntityId===t):void 0;return a||(s.soleSelection===!0?r[0]??null:null)}function xn(e,t,s={}){const r=wt(e,t,s);return r&&typeof r.amount=="number"&&Number.isFinite(r.amount)?r.amount:null}function pn({label:e,value:t,min:s,max:r,stepSize:a,format:i,onCommit:o}){const[c,d]=J.useState(null),l=J.useRef(!1),m=p=>{d(null);const N=Number.parseFloat(p.replace(/[^0-9.-]/g,""));if(!Number.isFinite(N))return;const w=Math.min(r,Math.max(s,N));o(ot(w,s,r,a))},x=c!==null?c:i(t);return n.jsxs("span",{className:y("inline-flex items-center gap-1 rounded-md border border-gray-300 bg-white px-1.5 py-0.5 leading-none","motion-safe:transition-colors motion-safe:duration-150","hover:border-brand/50","focus-within:border-brand focus-within:ring-1 focus-within:ring-brand/30"),children:[n.jsx(dt,{"aria-hidden":!0,className:"h-3 w-3 shrink-0 text-gray-400"}),n.jsx("input",{type:"text",inputMode:"decimal","aria-label":`${e} value`,value:x,onFocus:()=>d(String(t)),onChange:p=>d(p.target.value),onBlur:p=>{if(l.current){l.current=!1,d(null);return}m(p.target.value)},onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),l.current=!0,m(p.currentTarget.value),p.currentTarget.blur()):p.key==="Escape"&&(p.preventDefault(),l.current=!0,d(null),p.currentTarget.blur())},style:{width:`${Math.max(4,x.length+1)}ch`},className:"bg-transparent text-right text-sm font-semibold text-gray-900 tabular-nums outline-none"})]})}const jt="Priced at checkout";function vt(e){const t=e.priceModel;if(!t)return"Price on request";const s=ke(ve(e));if(s===null)return jt;switch(t.kind){case"fixed_per_event":return`${s} flat`;case"fixed_per_guest":return`${s} per guest`;case"fixed_per_hour":return`${s} per hour`;case"fixed_per_quantity":return`${s} each`;default:return s}}function kt({addOn:e,selection:t,onToggle:s,onSetQuantity:r}){var l;const a=!!t,i=((l=e.priceModel)==null?void 0:l.kind)==="fixed_per_quantity",o=(t==null?void 0:t.quantity)??1,c=()=>{o<=1?s():r(o-1)},d=()=>{r(o+1)};return n.jsx("div",{className:y("relative rounded-2xl border-2 p-4 transition-all",a?"border-brand bg-brand/5 shadow-md":"border-border/70 bg-white hover:border-brand/50 hover:shadow-sm"),children:n.jsxs("div",{className:"flex items-start gap-3 min-w-0",children:[e.imageUrl&&n.jsx("img",{src:e.imageUrl,alt:e.name,className:"h-14 w-14 shrink-0 rounded-lg object-cover",loading:"lazy"}),n.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[n.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n.jsx("h4",{className:"font-semibold text-sm text-gray-900",children:e.name})}),e.priceModel&&n.jsx("p",{className:"text-xs font-medium text-gray-900",children:vt(e)}),e.description&&n.jsx("p",{className:"text-xs text-gray-600 break-words",children:e.description})]}),n.jsx("div",{className:"shrink-0 flex items-center",children:a&&i?n.jsx(pt,{valueControl:n.jsx("span",{className:"w-8 text-center text-sm font-medium tabular-nums",children:o}),onDecrement:c,onIncrement:d,decrementAriaLabel:`Remove one ${e.name}`,incrementAriaLabel:`Add one more ${e.name}`,decrementDisabled:!1,incrementDisabled:!1,className:"gap-1",buttonClassName:"h-7 w-7",iconClassName:"h-3 w-3"}):n.jsxs("button",{type:"button",onClick:s,className:y("inline-flex items-center gap-1 rounded-full px-3 py-1.5 text-xs font-medium border",a?"border-brand bg-brand text-white glass-solid":"border-border glass glass-surface text-gray-700 hover:border-brand hover:text-brand"),children:[!a&&n.jsx(je,{className:"h-3 w-3"}),a?"Remove":"Add"]})})]})})}const gn=({addOns:e,selectedAddOns:t,onToggle:s,onSetQuantity:r})=>e.length===0?null:n.jsxs("div",{className:"space-y-3",children:[n.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"Optional Add-Ons"}),n.jsx("div",{className:"space-y-3",children:e.map(a=>{const i=t.find(o=>o.addOnId===a.id);return n.jsx(kt,{addOn:a,selection:i,onToggle:()=>s(a.id),onSetQuantity:o=>r(a.id,o)},a.id)})}),t.length>0&&n.jsxs("p",{className:"text-xs text-brand font-medium",children:[t.length," add-on",t.length!==1?"s":""," selected — included in your total at checkout."]})]}),$=e=>typeof e!="number"||!Number.isFinite(e)?null:e;function yn(e){var c,d,l,m;const t=$(((c=e.authoritative)==null?void 0:c.total)??null),s=$(((d=e.authoritative)==null?void 0:d.subtotal)??null),r=$(((l=e.authoritative)==null?void 0:l.serviceFee)??null);if(t!==null)return{subtotal:s,serviceFee:r,total:t,isAuthoritative:!0,source:"backend",...(m=e.authoritative)!=null&&m.twoModelBreakdown?{twoModelBreakdown:e.authoritative.twoModelBreakdown}:{}};const a=$(e.derivedSubtotal??null),i=$(e.derivedServiceFee??null),o=$(e.derivedTotal??null);return a!==null||i!==null||o!==null?{subtotal:a,serviceFee:i,total:o,isAuthoritative:!1,source:"derived",notes:e.notes,reason:"missing_total"}:{subtotal:null,serviceFee:null,total:null,isAuthoritative:!1,source:"unavailable",notes:e.notes,reason:"insufficient_input"}}function wn(e,t,s){const r=`${e}T${t}:00`,[a,i]=t.split(":").map(Number),[o,c]=s.split(":").map(Number),d=a*60+(i||0),m=o*60+(c||0)<=d,[x,p,N]=e.split("-").map(Number),w=new Date(x,p-1,N);m&&w.setDate(w.getDate()+1);const v=`${`${w.getFullYear()}-${String(w.getMonth()+1).padStart(2,"0")}-${String(w.getDate()).padStart(2,"0")}`}T${s}:00`;return{startDateTime:r,endDateTime:v,spansNextDay:m}}const jn=e=>typeof e=="number"&&Number.isFinite(e)&&e>0;function vn(e,t){const s=Math.floor(t);if(!e||s<=0)return"";const r=/^(\d{2}):(\d{2})$/.exec(e);if(!r)return"";const a=Number(r[1]),i=Number(r[2]);if(!Number.isFinite(a)||!Number.isFinite(i)||a>23||i>59)return"";const o=(a*60+i+s)%(24*60),c=Math.floor(o/60),d=o%60;return`${String(c).padStart(2,"0")}:${String(d).padStart(2,"0")}`}function ge(e,t){if(!e||!t)return null;const[s,r]=e.split(":").map(Number),[a,i]=t.split(":").map(Number);if([s,r,a,i].some(c=>!Number.isFinite(c)))return null;let o=a*60+i-(s*60+r);return o<=0&&(o+=24*60),o}function Nt(e){const t=Math.floor(e/60),s=e%60;return t&&s?`${t}h ${s}m`:t?`${t}h`:`${s}m`}function kn({startTime:e,endTime:t,onStartChange:s,onEndChange:r,startLabel:a="Start time",endLabel:i="End time",startOptions:o,endOptions:c,startMinTime:d,startMaxTime:l,endMinTime:m,endMaxTime:x,startDisabled:p,endDisabled:N,endSpansNextDay:w,timezoneLabel:j,onInvalidTime:v,labelClassName:b="text-sm font-semibold",className:A}){const _=g.useMemo(()=>ge(e,t),[e,t]),D=w??(e&&t&&ge(e,t)!==null?t<=e:!1);return n.jsxs("div",{className:y("space-y-2",A),children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx("p",{className:b,children:a}),n.jsx(he,{value:e,onChange:s,onInvalidTime:v,placeholder:"Add time",options:o,minTime:d,maxTime:l,disabled:p})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsxs("p",{className:b,children:[i,D&&n.jsx("span",{className:"ml-1 font-normal normal-case text-muted-foreground",children:"(next day)"})]}),n.jsx(he,{value:t,onChange:r,onInvalidTime:v,placeholder:"Add time",options:c,minTime:m,maxTime:x,disabled:N})]})]}),n.jsxs("div",{className:"flex items-center justify-between gap-2 pt-0.5",children:[_!=null?n.jsxs("span",{className:"text-xs font-medium text-muted-foreground",children:["Duration · ",Nt(_)]}):n.jsx("span",{}),j&&n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["All times in ",j]})]})]})}function Nn(e){return g.useMemo(()=>{if(!e.eventDate)return{isValid:!1,nextMissingRequirement:"Pick a date for your event."};if(!e.startTime)return{isValid:!1,nextMissingRequirement:"Pick a start time."};if(e.durationMinutes<=0)return{isValid:!1,nextMissingRequirement:"Set a duration for your event."};if(e.requiresPackageSelection&&!e.packageSelected)return{isValid:!1,nextMissingRequirement:"Choose a package."};if(e.guestCount<e.guestMin){const t=e.guestMin-e.guestCount;return{isValid:!1,nextMissingRequirement:`Add ${t} more guest${t===1?"":"s"} to meet the minimum (${e.guestMin}).`}}return e.guestCount>e.guestMax?{isValid:!1,nextMissingRequirement:`Reduce guests to at most ${e.guestMax} to fit this listing.`}:e.requiresEventLocation&&!e.hasVerifiedEventLocation?{isValid:!1,nextMissingRequirement:"Add a verified event address."}:{isValid:!0,nextMissingRequirement:null}},[e.eventDate,e.startTime,e.durationMinutes,e.guestCount,e.guestMin,e.guestMax,e.requiresEventLocation,e.hasVerifiedEventLocation,e.requiresPackageSelection,e.packageSelected])}const Mt={date:"Date",time:"Start time",location:"Address",guestCount:"Guests"},ye=(e,t)=>{try{if(e.field==="date")return S(be(t,"yyyy-MM-dd",new Date),"MMM d, yyyy");if(e.field==="time")return S(be(t,"HH:mm",new Date),"h:mm a")}catch{}return t},Mn=({deviations:e,onConfirm:t,onCancel:s})=>n.jsx(Ge,{open:e.length>0,onOpenChange:r=>{r||s()},children:n.jsxs(Ke,{children:[n.jsxs(He,{children:[n.jsx(Je,{children:"This doesn't match your other bookings"}),n.jsx(re,{children:"Your other bookings for this event are set up differently:"})]}),n.jsx("ul",{className:"space-y-1 text-sm",children:e.map(r=>n.jsxs("li",{className:"flex flex-wrap gap-x-2",children:[n.jsxs("span",{className:"font-medium",children:[Mt[r.field],":"]}),n.jsx("span",{className:"text-muted-foreground line-through",children:ye(r,r.eventValue)}),n.jsx("span",{"aria-hidden":!0,children:"→"}),n.jsx("span",{children:ye(r,r.bookingValue)})]},r.field))}),n.jsx(re,{children:"You can book it this way anyway — just let the host know directly."}),n.jsxs(Ye,{children:[n.jsx(We,{onClick:s,children:"Go back and edit"}),n.jsx(qe,{onClick:t,children:"Book anyway"})]})]})});function Cn(e){const t=g.useRef(new Set([0]));return{onPhotoViewed:g.useCallback(r=>{try{if(!e||r<0||t.current.has(r))return;t.current.add(r),Ne("gallery_engaged",{listingId:e,photosViewed:t.current.size})}catch{}},[e])}}const Ct=new Set(["US-TX"]);function Sn(e,t){return!e||!t?!1:Ct.has(`${e}-${t}`)}const G=Xe,An=e=>e==null||Number.isNaN(e)?null:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2}).format(e);function _n(e){return!e||typeof e!="string"?e:e.split(/[\s_-]+/).map(t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()).join(" ")}const Dn=({images:e,videos:t=[],serviceName:s,isMobile:r,onShareClick:a,onSaveClick:i,isSaved:o,onPhotoAdvance:c})=>{const[d,l]=g.useState(!1),[m,x]=g.useState(!1),[p,N]=g.useState(0),[w,j]=g.useState(0),v=g.useRef(null),b=e.length>0?e:[G],A=g.useMemo(()=>[...b.map(h=>({type:"image",src:h})),...t.map(h=>({type:"video",src:h}))],[b,t]),_=()=>l(!0),D=h=>{N(h),l(!1),x(!0)},f=()=>{x(!1),l(!0)};if(g.useEffect(()=>{j(0),v.current&&(v.current.scrollLeft=0)},[b.length]),g.useEffect(()=>{c==null||c(w)},[w,c]),r){const h=b[0],u=b.slice(1,3),M=b.length>3?b.length-3:0;return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"relative grid grid-cols-[1.75fr_1fr] grid-rows-2 gap-1 aspect-[4/3] max-h-[280px] w-full",children:[n.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:_,children:[n.jsx(I,{originalSrc:h??G,variant:"medium",alt:s,className:"h-full w-full object-cover",loading:"eager"}),t.length>0&&n.jsxs("div",{className:"pointer-events-none absolute bottom-2 left-2 flex items-center gap-1.5 rounded-full glass px-2.5 py-1.5 text-xs font-medium text-white",style:{"--glass-tint-hsl":"0 0% 0%","--glass-tint-opacity":.5},children:[n.jsx(U,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:[t.length," video",t.length!==1?"s":""]})]})]}),u.length===0?n.jsx("div",{className:"row-span-2 rounded-r-xl border border-black/5 bg-muted/30"}):u.map((C,k)=>n.jsxs("button",{type:"button",className:y("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&&k===0&&"rounded-tr-xl rounded-br-none",u.length===2&&k===1&&"rounded-br-xl rounded-tr-none"),onClick:_,children:[n.jsx(I,{originalSrc:C,variant:"thumbnail",alt:`${s} ${k+2}`,className:"h-full w-full object-cover",loading:"lazy"}),k===1&&M>0&&n.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 text-sm font-semibold text-white",children:["+",M," more"]})]},`${C}-${k}`))]}),n.jsx(oe,{open:d,onOpenChange:l,children:n.jsxs(ae,{fullScreen:!0,hideCloseButton:!0,className:"flex flex-col rounded-none border-0 bg-white p-0 overflow-hidden",children:[n.jsx(ie,{className:"sr-only",children:"Photo tour"}),n.jsx(le,{className:"sr-only",children:"Browse photos and videos"}),n.jsxs("header",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-3 bg-white",children:[n.jsx(P,{variant:"ghost",size:"icon",onClick:()=>l(!1),"aria-label":"Back",children:n.jsx(ce,{className:"h-5 w-5"})}),n.jsxs("div",{className:"flex items-center gap-2",children:[a&&n.jsxs(P,{variant:"ghost",size:"sm",onClick:a,children:[n.jsx(B,{className:"h-4 w-4"}),"Share"]}),i&&n.jsxs(P,{variant:"ghost",size:"sm",onClick:i,children:[n.jsx(de,{className:`h-4 w-4 ${o?"fill-red-500 text-red-500":""}`}),"Save"]})]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-white",children:n.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 sm:px-6 sm:py-8",children:[b.length>0&&n.jsxs("section",{className:"space-y-6",children:[n.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Photos"}),n.jsx("div",{className:"columns-2 gap-4 sm:columns-2 lg:columns-3 [column-fill:balance]",children:b.map((C,k)=>n.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:()=>D(k),children:n.jsx(I,{originalSrc:C,variant:"medium",alt:`${s} photo ${k+1}`,className:"w-full h-auto min-h-[200px] object-cover",loading:"lazy"})},`${C}-${k}`))})]}),t.length>0&&n.jsxs("section",{className:y("space-y-6",b.length>0&&"mt-10"),children:[n.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Videos"}),n.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map((C,k)=>n.jsxs("button",{type:"button",onClick:()=>D(b.length+k),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:[n.jsx(Qe,{src:C,className:"h-full w-full object-contain",preload:"metadata",muted:!0,playsInline:!0,disablePictureInPicture:!0,disableRemotePlayback:!0,"aria-label":`${s} video ${k+1}`}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 transition group-hover:bg-black/40",children:n.jsx("span",{className:"flex h-14 w-14 items-center justify-center rounded-full glass glass-overlay text-black",children:n.jsx(ue,{className:"h-7 w-7 fill-current pl-0.5"})})})]},`${C}-${k}`))})]})]})})]})}),n.jsx(me,{onIndexChange:c,items:A,initialIndex:p,open:m,onClose:()=>x(!1),onBack:f,title:s})]})}return n.jsxs(n.Fragment,{children:[n.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:[n.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:_,children:[n.jsx("div",{className:"absolute inset-0 overflow-hidden rounded-[32px] md:rounded-r-none",children:n.jsx(I,{originalSrc:b[0]??G,variant:"full",alt:s,className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105",loading:"eager"})}),n.jsx("div",{className:"pointer-events-none absolute inset-0 rounded-[32px] md:rounded-r-none border border-black/5 shadow-xl"}),t.length>0&&n.jsxs("div",{className:"pointer-events-none absolute bottom-3 left-3 flex items-center gap-1.5 rounded-full glass px-2.5 py-1.5 text-xs font-medium text-white",style:{"--glass-tint-hsl":"0 0% 0%","--glass-tint-opacity":.5},children:[n.jsx(U,{className:"h-3.5 w-3.5"}),n.jsxs("span",{children:[t.length," video",t.length!==1?"s":""]})]})]}),n.jsx("div",{className:"grid gap-1 md:h-[24rem] md:grid-cols-2 md:grid-rows-[repeat(2,1fr)]",children:b.slice(1,5).map((h,u)=>n.jsxs("button",{type:"button",onClick:_,className:y("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:[n.jsx(I,{originalSrc:h,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&&n.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:[n.jsx("span",{children:"View all photos"}),t.length>0&&n.jsxs("span",{className:"flex items-center gap-1 text-xs normal-case opacity-90",children:[n.jsx(U,{className:"h-3 w-3"}),t.length," video",t.length!==1?"s":""]})]})]},`${h}-${u}`))})]}),n.jsx(oe,{open:d,onOpenChange:l,children:n.jsxs(ae,{fullScreen:!0,hideCloseButton:!0,className:"flex flex-col rounded-none border-0 bg-white p-0 overflow-hidden",children:[n.jsx(ie,{className:"sr-only",children:"Photo tour"}),n.jsx(le,{className:"sr-only",children:"Browse photos and videos"}),n.jsxs("header",{className:"flex shrink-0 items-center justify-between border-b border-border/60 px-4 py-3 bg-white",children:[n.jsx(P,{variant:"ghost",size:"icon",onClick:()=>l(!1),"aria-label":"Back",children:n.jsx(ce,{className:"h-5 w-5"})}),n.jsxs("div",{className:"flex items-center gap-2",children:[a&&n.jsxs(P,{variant:"ghost",size:"sm",onClick:a,children:[n.jsx(B,{className:"h-4 w-4"}),"Share"]}),i&&n.jsxs(P,{variant:"ghost",size:"sm",onClick:i,children:[n.jsx(de,{className:`h-4 w-4 ${o?"fill-red-500 text-red-500":""}`}),"Save"]})]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto bg-white",children:n.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-6 sm:px-6 sm:py-8",children:[b.length>0&&n.jsxs("section",{className:"space-y-6",children:[n.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Photos"}),n.jsx("div",{className:"columns-2 gap-4 sm:columns-2 lg:columns-3 [column-fill:balance]",children:b.map((h,u)=>n.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:()=>D(u),children:n.jsx(I,{originalSrc:h,variant:"medium",alt:`${s} photo ${u+1}`,className:"w-full h-auto min-h-[200px] object-cover",loading:"lazy"})},`${h}-${u}`))})]}),t.length>0&&n.jsxs("section",{className:y("space-y-6",b.length>0&&"mt-10"),children:[n.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Videos"}),n.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map((h,u)=>n.jsxs("button",{type:"button",onClick:()=>D(b.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:[n.jsx("video",{src:h,className:"h-full w-full object-contain",preload:"metadata",muted:!0,playsInline:!0,disablePictureInPicture:!0,disableRemotePlayback:!0,"aria-label":`${s} video ${u+1}`}),n.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 transition group-hover:bg-black/40",children:n.jsx("span",{className:"flex h-14 w-14 items-center justify-center rounded-full glass glass-overlay text-black",children:n.jsx(ue,{className:"h-7 w-7 fill-current pl-0.5"})})})]},`${h}-${u}`))})]})]})})]})}),n.jsx(me,{onIndexChange:c,items:A,initialIndex:p,open:m,onClose:()=>x(!1),onBack:f,title:s})]})},St=["booking-event","active"],At=async()=>{const{data:e}=await Me.get("/booking-events/active");return(e==null?void 0:e.event)??null},Pn=(e=!0)=>q({queryKey:St,queryFn:At,enabled:e,staleTime:60*1e3,retry:!1}),In=async e=>{try{const{data:t}=await Me.post("/booking-events/preview",e);return{eventId:(t==null?void 0:t.eventId)??null,deviations:(t==null?void 0:t.deviations)??[]}}catch{return{eventId:null,deviations:[]}}},_t=Ze.replace(/\/$/,"");async function Dt(e,t){const s=await fetch(`${_t}/public/venues/${e}/availability?month=${t}`);if(!s.ok)return[];const r=await s.json();return Array.isArray(r.unavailableDates)?r.unavailableDates.filter(a=>typeof a=="string"):[]}async function Pt(e,t){const s=L(new Date),r=Array.from({length:t},(o,c)=>S(et(s,c),"yyyy-MM")),a=await Promise.all(r.map(o=>Dt(e,o))),i=new Set;for(const o of a)o.forEach(c=>i.add(c));return Array.from(i)}function En(e,t={}){const{numMonths:s=12,enabled:r=!0}=t,{data:a=[],isLoading:i}=q({queryKey:["listing-availability",e,s],queryFn:()=>Pt(e,s),enabled:!!(e&&r),staleTime:60*1e3});return{unavailableDates:a,isLoading:i}}function Tn(e){const t=(e==null?void 0:e.taxStatus)??"calculated_at_checkout",s=e==null?void 0:e.taxAmountCents;return t==="final"&&(typeof s!="number"||!Number.isFinite(s))?{taxStatus:"calculated_at_checkout",taxJurisdictionCollected:!0}:{taxStatus:t,...t==="final"?{taxAmountCents:s}:{},...typeof(e==null?void 0:e.taxJurisdictionCollected)=="boolean"?{taxJurisdictionCollected:e.taxJurisdictionCollected}:{}}}function $n(e,t){if(typeof e!="number"||!Number.isFinite(e))return;const s=(t==null?void 0:t.taxStatus)==="final"&&typeof t.taxAmountCents=="number"?t.taxAmountCents:0;return Math.round(e*100-s)/100}const K={venue:"Check out this venue on PLEC",service:"Check out this service on PLEC"};function It(e,t){const s=encodeURIComponent(e),r=encodeURIComponent(K[t]),a=encodeURIComponent(`${K[t]}

${e}`);return{copyLink:async()=>{await navigator.clipboard.writeText(e)},email:()=>{window.location.href=`mailto:?subject=${r}&body=${a}`},messages:()=>{window.location.href=`sms:?body=${s}`},whatsapp:()=>{window.open(`https://wa.me/?text=${s}`,"_blank")},messenger:()=>{const i=encodeURIComponent(e);window.open(`https://www.facebook.com/dialog/send?link=${s}&redirect_uri=${i}`,"_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:e,title:K[t],text:e}),"shared"}catch(i){if(i.name!=="AbortError")return await navigator.clipboard.writeText(e),"copied";throw i}return await navigator.clipboard.writeText(e),"copied"}}}const Et=[{id:"copyLink",label:"Copy link",icon:n.jsx(ut,{className:"h-4 w-4"})},{id:"email",label:"Email",icon:n.jsx(tt,{className:"h-4 w-4"})},{id:"messages",label:"Messages",icon:n.jsx(nt,{className:"h-4 w-4"})},{id:"whatsapp",label:"WhatsApp",icon:n.jsx(mt,{className:"h-4 w-4"})},{id:"messenger",label:"Messenger",icon:n.jsx(ft,{className:"h-4 w-4"})},{id:"facebook",label:"Facebook",icon:n.jsx(B,{className:"h-4 w-4"})},{id:"twitter",label:"Twitter",icon:n.jsx(B,{className:"h-4 w-4"})},{id:"moreOptions",label:"More options",icon:n.jsx(ht,{className:"h-4 w-4"})}];function Fn({shareUrl:e,context:t,className:s}){const{toast:r}=st(),a=J.useMemo(()=>It(e,t),[e,t]),i=async o=>{const c=a[o];if(o==="copyLink"){try{await c(),r({title:"Link copied",description:"The link has been copied to your clipboard."})}catch{r({title:"Failed to copy",description:"Please try again or copy the link manually.",variant:"destructive"})}return}if(o==="moreOptions"){try{await c()==="copied"&&r({title:"Link copied",description:"The link has been copied to your clipboard."})}catch{r({title:"Failed to copy",description:"Please try again or copy the link manually.",variant:"destructive"})}return}c()};return n.jsxs("div",{className:y("space-y-4",s),children:[n.jsx("div",{className:"rounded-2xl border border-border/70 bg-muted/40 p-3 text-xs text-muted-foreground break-all",children:e}),n.jsx("div",{className:"grid grid-cols-3 gap-2",children:Et.map(({id:o,label:c,icon:d})=>n.jsxs(P,{variant:"outline",size:"sm",className:"h-auto flex-col gap-1.5 rounded-xl py-3",onClick:()=>i(o),children:[d,n.jsx("span",{className:"text-xs font-medium",children:c})]},o))})]})}function Rn(e){return e.status==="success"&&!e.isRefreshing}const Tt=new Set(["fixed_per_event","fixed_per_guest","fixed_per_hour","fixed_per_quantity"]);function $t(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.kind=="string"&&Tt.has(t.kind)&&typeof t.unitAmount=="number"&&t.unitAmount>=0}function Ft(e){const t=e&&typeof e=="object"?e:void 0;return Array.isArray(t==null?void 0:t.addOns)?t.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:$t(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,r)=>(s.sortOrder??999)-(r.sortOrder??999)):[]}function Ln(e){return g.useMemo(()=>Ft(e),[e])}class Rt extends Error{constructor(t,s,r){super(t),this.code=s,this.reason=r,this.name="PricingPreviewRefusal"}}const Lt=new Set(["PROVIDER_ACCOUNT_NOT_READY","PROVIDER_NOT_CONNECTED","PROVIDER_LEDGER_BLOCKED","PROVIDER_PAYOUT_HOLD"]),Bt=new Set(["bar_tab_alone","bar_tab_amount","bar_tab_rates"]);function De(e,t){if(e!==400&&e!==409||!t||typeof t!="object")return null;const{code:s,reason:r,message:a}=t;return typeof a!="string"||!a.trim()?null:typeof s=="string"&&Lt.has(s)||typeof r=="string"&&Bt.has(r)?new Rt(a,typeof s=="string"?s:null,typeof r=="string"?r:null):null}function Pe(e){if(!e||typeof e!="object")return null;const t=e,s=o=>typeof o=="number"&&Number.isFinite(o)?o:null,r=s(t.percent),a=s(t.dueTodayCents),i=s(t.balanceCents);return r===null||a===null||i===null?null:{percent:r,dueTodayCents:a,dueTodayServiceFeeCents:s(t.dueTodayServiceFeeCents)??0,balanceCents:i,balanceServiceFeeCents:s(t.balanceServiceFeeCents)??0,balanceChargeAt:typeof t.balanceChargeAt=="string"?t.balanceChargeAt:"",balanceChargeDay:typeof t.balanceChargeDay=="string"?t.balanceChargeDay:"",text:typeof t.text=="string"?t.text:""}}const Ot=["base_rate","cleaning_fee","package","add_on","menu_item"];function Ie(e){if(!e||typeof e!="object")return null;const t=e;if(!Array.isArray(t.lines))return null;const s=d=>typeof d=="number"&&Number.isFinite(d)?d:void 0,r=[];let a=!1;for(const d of t.lines){if(!d||typeof d!="object")return null;const l=d,m=s(l.amount);if(m===void 0||typeof l.kind!="string"||typeof l.name!="string")return null;if(!Ot.includes(l.kind)){a=!0;continue}r.push({kind:l.kind,name:l.name,amount:m,...typeof l.sourceEntityId=="string"?{sourceEntityId:l.sourceEntityId}:{},...typeof l.selectionId=="string"?{selectionId:l.selectionId}:{},...s(l.baseAmount)!==void 0?{baseAmount:s(l.baseAmount)}:{},...l.timelineAdjustment&&typeof l.timelineAdjustment=="object"?{timelineAdjustment:l.timelineAdjustment}:{}})}const i=s(t.displaySubtotal),o=s(t.serviceFee),c=s(t.total);return i===void 0||o===void 0||c===void 0||a&&r.reduce((l,m)=>l+Math.round(m.amount*100),0)!==Math.round(i*100)?null:{lines:r,...s(t.baseRateHourly)!==void 0?{baseRateHourly:s(t.baseRateHourly)}:{},...s(t.billableHours)!==void 0?{billableHours:s(t.billableHours)}:{},displaySubtotal:i,serviceFee:o,total:c}}async function Bn(e){var c,d,l,m,x,p,N,w;const t={listingId:e.listingId,startTime:e.startTime,endTime:e.endTime,guestCount:e.guestCount,skipBaseRate:e.skipBaseRate??!1};(c=e.selectedPackageIds)!=null&&c.length?(t.selectedPackageIds=e.selectedPackageIds,t.selectedPackageId=e.selectedPackageIds[0]):e.selectedPackageId&&(t.selectedPackageId=e.selectedPackageId),(d=e.selectedAddOns)!=null&&d.length&&(t.selectedAddOns=e.selectedAddOns);const s=((l=e.selectedMenuItems)==null?void 0:l.length)??0;if(s>0&&(t.selectedMenuItems=e.selectedMenuItems.map(j=>{var v;return{menuItemId:j.menuItemId,quantity:j.quantity,...(v=j.selectedChoices)!=null&&v.length?{selectedChoices:j.selectedChoices.map(b=>({optionId:b.optionId,choiceId:b.choiceId}))}:{}}})),!((((m=e.selectedPackageIds)==null?void 0:m.length)??0)>0||!!e.selectedPackageId)&&((x=e.selectedPackages)!=null&&x.length)&&(t.selectedPackages=e.selectedPackages),(p=e.sliderSelections)!=null&&p.length&&(t.sliderSelections=e.sliderSelections),(w=(N=e.eventLocation)==null?void 0:N.formattedAddress)!=null&&w.trim()){const{formattedAddress:j,placeId:v,lat:b,lng:A}=e.eventLocation;t.eventLocation={formattedAddress:j,...v?{placeId:v}:{},...typeof b=="number"?{lat:b}:{},...typeof A=="number"?{lng:A}:{}}}const a=await Gt(t,e.signal);if(a)return a;const i=await fetch(Ce("/cart/preview"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t),signal:e.signal}),o=await i.json().catch(()=>({}));if(!i.ok){const j=De(i.status,o);if(j)throw j;const v=typeof(o==null?void 0:o.message)=="string"?o.message:"Failed to fetch pricing preview";throw new Error(v)}return{subtotal:typeof(o==null?void 0:o.subtotal)=="number"?o.subtotal:Number((o==null?void 0:o.subtotal)||0),serviceFee:typeof(o==null?void 0:o.serviceFee)=="number"?o.serviceFee:Number((o==null?void 0:o.serviceFee)||0),total:typeof(o==null?void 0:o.total)=="number"?o.total:Number((o==null?void 0:o.total)||0),selectionSnapshots:Array.isArray(o==null?void 0:o.selectionSnapshots)?o.selectionSnapshots:void 0,advanceBookingModifier:(o==null?void 0:o.advanceBookingModifier)??null,twoModelBreakdown:Se(o==null?void 0:o.twoModelBreakdown,{moneyVersion:o==null?void 0:o.moneyVersion}),feeDisclosure:Ee(o==null?void 0:o.feeDisclosure),pricingNotices:Te(o==null?void 0:o.pricingNotices),deposit:Pe(o==null?void 0:o.deposit),displayBreakdown:Ie(o==null?void 0:o.displayBreakdown),...Ut(o),...Vt(o,s>0)}}const O=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0;function Vt(e,t){const s=e==null?void 0:e.total,r=typeof s=="number"&&Number.isFinite(s),a=typeof(e==null?void 0:e.serviceFee)=="number"&&Number.isFinite(e.serviceFee),i=O(e==null?void 0:e.menuItemsPriced),o=O(e==null?void 0:e.guestTotalCents);return{...o!==void 0?{guestTotalCents:o}:r?{guestTotalCents:Math.round(s*100)}:{},...i!==void 0&&(!t||r&&a)?{menuItemsPriced:i}:{}}}const Ee=e=>typeof e=="string"&&e.trim().length>0?e:null,Te=e=>{if(!Array.isArray(e))return;const t=e.filter(s=>typeof s=="string"&&s.trim().length>0);return t.length>0?t:void 0},H=e=>typeof e=="number"&&Number.isFinite(e)?Math.round(e)/100:null,Y={taxStatus:"calculated_at_checkout",taxJurisdictionCollected:!0};function Ut(e){if((e==null?void 0:e.moneyVersion)!==2)return{};const t=e.taxStatus,s=e.taxJurisdictionCollected;if(t==="final"){const r=e.taxAmountCents;return typeof r=="number"&&Number.isFinite(r)?{taxStatus:"final",taxAmountCents:Math.round(r),taxJurisdictionCollected:s!==!1}:Y}return t==="calculated_at_checkout"||t==="not_taxable"?{taxStatus:t,...typeof s=="boolean"?{taxJurisdictionCollected:s}:{}}:{}}function zt(e){var r;const t=e==null?void 0:e.tax;if(!t||typeof t!="object")return{};const s=t.jurisdictionCollected===!0;if(t.status==="calculated"){const a=(r=e==null?void 0:e.presentation)==null?void 0:r.taxCents;return typeof a=="number"&&Number.isFinite(a)?{taxStatus:"final",taxAmountCents:Math.round(a),taxJurisdictionCollected:s}:Y}return t.status==="potentially_taxable"?Y:t.status==="not_taxable"?t.classifiedTaxable===!0&&!s?{taxStatus:"calculated_at_checkout",taxJurisdictionCollected:!1}:{taxStatus:"not_taxable",taxJurisdictionCollected:s}:{}}async function Gt(e,t){var c,d,l,m;let s;try{s=await fetch(Ce("/money/v2/pricing/preview"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(e),signal:t})}catch(x){if(x instanceof DOMException&&x.name==="AbortError")throw x;return null}if(!s.ok){const x=De(s.status,await s.json().catch(()=>null));if(x)throw x;return null}const r=await s.json().catch(()=>null),a=H((c=r==null?void 0:r.presentation)==null?void 0:c.displayPriceCents),i=H((d=r==null?void 0:r.presentation)==null?void 0:d.serviceFeeCents),o=H((l=r==null?void 0:r.presentation)==null?void 0:l.guestTotalCents);return a===null||i===null||o===null?null:{subtotal:a,serviceFee:i,total:o,selectionSnapshots:void 0,advanceBookingModifier:null,twoModelBreakdown:Se(r==null?void 0:r.barTab,{moneyVersion:2}),feeDisclosure:Ee(r==null?void 0:r.feeDisclosure),pricingNotices:Te(r==null?void 0:r.pricingNotices),deposit:Pe(r==null?void 0:r.deposit),displayBreakdown:Ie(r==null?void 0:r.displayBreakdown),...zt(r),...O((m=r==null?void 0:r.presentation)==null?void 0:m.guestTotalCents)!==void 0?{guestTotalCents:r.presentation.guestTotalCents}:{},...O(r==null?void 0:r.menuItemsPriced)!==void 0?{menuItemsPriced:r.menuItemsPriced}:{}}}function we(){const e=document.documentElement;if(e.scrollHeight-window.innerHeight<=0)return 100;const s=(window.scrollY+window.innerHeight)/e.scrollHeight*100;return Math.min(100,Math.max(0,Math.round(s)))}function On(e){const t=g.useRef(null),s=g.useRef(0),r=g.useRef(0),a=g.useRef(!1);g.useEffect(()=>{if(!e||typeof window>"u")return;t.current=document.visibilityState==="visible"?Date.now():null,s.current=0,r.current=we(),a.current=!1;const i=()=>{t.current!==null&&(s.current+=Date.now()-t.current,t.current=null)},o=()=>{if(a.current)return;i();const l=Math.round(s.current);l<=0||(a.current=!0,Ne("listing_dwell",{listingId:e,visibleMs:l,maxScrollPct:r.current}))},c=()=>{document.visibilityState==="hidden"?i():t.current===null&&!a.current&&(t.current=Date.now())},d=()=>{const l=we();l>r.current&&(r.current=l)};return document.addEventListener("visibilitychange",c),window.addEventListener("pagehide",o),window.addEventListener("scroll",d,{passive:!0}),()=>{document.removeEventListener("visibilitychange",c),window.removeEventListener("pagehide",o),window.removeEventListener("scroll",d),o()}},[e])}export{An as A,_e as B,_n as C,hn as D,pn as E,G as F,wt as G,ln as H,gn as L,fn as P,Dn as S,kn as T,bn as V,xn as a,yn as b,wn as c,Nn as d,Cn as e,an as f,Sn as g,on as h,jn as i,vn as j,Fn as k,Rt as l,Bn as m,In as n,mn as o,Tn as p,On as q,En as r,un as s,$n as t,dn as u,cn as v,Pn as w,Ln as x,Rn as y,Mn as z};