1import{r as i,u as qe,j as e}from"./react-vendor-DB__oAD1.js";import{t as ae,ad as ya,e as E,ae as Q,y as X,A as me,j as ja,af as Na,K as va,G as wa,q as Ca,D as Pa,B as V,I as _a,ag as Sa}from"./index-Roczq9UO.js";import{c as Ia,u as Ra,L as Re}from"./router-C-6PMgfl.js";import{f as $a,c as yt}from"./cancellation-D4OWQHLP.js";import{i as he,a as Oe,h as Ea}from"./validation-DKWgzMdP.js";import{s as qa}from"./booking-api-iNvvfp3n.js";import{A as La}from"./AvailabilityCalendar-B7HnJJDc.js";import{e as Fa,f as Zt,C as ie,az as Nt,w as Jt,x as ea,aA as Ma,m as Ta,aB as Da,aC as Aa,X as it,aD as Oa,y as $e,E as Wa,J as Ba,o as Qa,aE as za,aF as Ua,a as Ha,aG as Ya}from"./icons-DV-e10hj.js";import{D as Ga,a as Ka,b as Va}from"./dialog-j4BUPGFh.js";import Xa from"./CheckoutPaymentForm-BeMkjjNA.js";import{P as Za}from"./PhoneInput-BJQ_f7H3.js";import"./i18n-T6WqKCYf.js";import"./trpc-DdSNTANa.js";import"./query-D1ks93_H.js";import"./ui-evZO8Elf.js";import"./useMobile-CpeEK3Lo.js";import"./stripeLoader-BUyEGhck.js";function Ja(t,r,o){const u=ae.checkout.setOrigin.useMutation(),m=i.useRef(u.mutate);m.current=u.mutate,i.useEffect(()=>{if(!(!t||!r||o))return ya(h=>m.current({intentId:t,origin:h}))},[t,r,o])}const ct=["arrival","table","home","wellness","experiences"],Kt=106;function vt(t,r){if(t.pricingModel==="on_request"||t.unitPrice==null)return null;switch(t.pricingModel){case"per_stay":return t.unitPrice;case"per_day":return t.unitPrice*(r.days??1);case"per_person":return t.unitPrice*(r.people??t.minPeople??1);case"per_unit":{const o=r.qty??1;return t.tierPrices?.length?t.tierPrices[Math.min(o,t.tierPrices.length)-1]:t.unitPrice*o}case"per_person_per_unit":return t.unitPrice*(r.people??1)*(r.sessions??1);case"included_selectable":return t.unitPrice*Math.max(0,(r.qty??1)-1);case"per_person_per_day":return t.unitPrice*(r.people??1)*(r.days??1)}}function es(t,r){return!r||r.type==="self"?0:r.late?t.hostedLatePrice:t.hostedPrice}function Ee({value:t,min:r,max:o,onChange:u,ariaLabel:m}){return e.jsxs("div",{className:"flex items-center gap-2","aria-label":m,children:[e.jsx("button",{type:"button",onClick:()=>u(Math.max(r,t-1)),disabled:t<=r,className:"flex h-7 w-7 items-center justify-center rounded-full border border-pa-sand text-pa-earth hover:border-pa-dark hover:text-pa-dark disabled:opacity-25 transition-colors",children:e.jsx(Jt,{className:"w-3 h-3"})}),e.jsx("span",{className:"min-w-[2ch] text-center body-sm text-pa-dark tabular-nums",children:t}),e.jsx("button",{type:"button",onClick:()=>u(Math.min(o,t+1)),disabled:t>=o,className:"flex h-7 w-7 items-center justify-center rounded-full border border-pa-sand text-pa-earth hover:border-pa-dark hover:text-pa-dark disabled:opacity-25 transition-colors",children:e.jsx(ea,{className:"w-3 h-3"})})]})}function ts({children:t,className:r,id:o}){const u=i.useRef(null),[m,h]=i.useState(!1);return i.useEffect(()=>{const l=u.current;if(!l)return;const c=new IntersectionObserver($=>{$.some(x=>x.isIntersecting)&&(h(!0),c.disconnect())},{rootMargin:"0px 0px 240px 0px"});c.observe(l);const b=window.setTimeout(()=>h(!0),1200);return()=>{c.disconnect(),window.clearTimeout(b)}},[]),e.jsx("section",{ref:u,id:o,className:E("chapter-reveal",m&&"chapter-reveal-in",r),children:t})}function as({num:t,chapter:r,destination:o}){const{t:u}=qe(),m=o?u(`checkout.chapter.${r}.line_${o}`,u(`checkout.chapter.${r}.line`)):u(`checkout.chapter.${r}.line`);return e.jsxs("div",{className:"mb-8",children:[e.jsx("p",{className:"caption font-medium tracking-[0.14em] uppercase text-pa-gold mb-2.5",children:u("checkout.chapterLabel",{num:t})}),e.jsx("h2",{className:"font-display font-normal text-[32px] lg:text-[48px] leading-[1.05] text-pa-dark",children:u(`checkout.chapter.${r}.title`)}),e.jsx("p",{className:"body-lg lg:text-[17px] text-pa-earth mt-2.5",children:m})]})}function Vt({config:t,choice:r,lang:o,onChoose:u,nudge:m}){const{t:h}=qe(),l=({selected:c,name:b,value:$,desc:x,onClick:q})=>e.jsxs("button",{type:"button",role:"radio","aria-checked":c,onClick:q,className:E("text-left rounded-lg p-5 transition-all",c?"border-[1.5px] border-pa-dark bg-pa-warm":"border border-pa-sand bg-white hover:border-pa-gold"),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("span",{className:"flex items-center gap-2 body-sm font-medium text-pa-dark",children:[c&&e.jsx("span",{className:"w-[18px] h-[18px] rounded-full bg-pa-dark flex items-center justify-center shrink-0",children:e.jsx(ie,{className:"w-3 h-3 text-white"})}),b]}),$]}),e.jsx("p",{className:"body-sm text-pa-earth leading-snug mt-2",children:x})]});return e.jsxs("div",{id:"reception-choice",className:"space-y-2.5 scroll-mt-[150px]",children:[m&&!r?e.jsx("p",{className:"body-sm text-pa-dark bg-pa-warm border border-pa-gold rounded-md px-3 py-2.5",children:h("checkout.reception.required")}):e.jsx("p",{className:"body-sm text-pa-earth",children:h("checkout.reception.prompt")}),e.jsxs("div",{role:"radiogroup",className:E("grid sm:grid-cols-2 gap-3 rounded-lg transition-shadow",m&&!r&&"ring-2 ring-pa-gold ring-offset-2"),children:[e.jsx(l,{selected:r?.type==="self",name:h("checkout.reception.self.name"),value:e.jsx("span",{className:"eyebrow font-medium tracking-[0.1em] uppercase text-pa-gold shrink-0",children:h("checkout.included.badge")}),desc:h("checkout.reception.self.desc"),onClick:()=>u({type:"self"})}
1),e.jsx(l,{selected:r?.type==="hosted",name:h("checkout.reception.hosted.name"),value:e.jsx("span",{className:"body-sm text-pa-dark tabular-nums shrink-0",children:Q(r?.type==="hosted"&&r?.late?t.hostedLatePrice:t.hostedPrice,o)}),desc:`${h("checkout.reception.hosted.desc")} ${h("checkout.reception.lateNote",{hour:t.lateFromHour,price:Q(t.hostedLatePrice,o)})}`,onClick:()=>u({type:"hosted",late:r?.type==="hosted"?r.late:!1})})]}),r?.type==="hosted"&&e.jsxs("div",{className:"flex items-center gap-2 pt-0.5",children:[e.jsx("span",{className:"caption text-pa-stone-aa",children:h("checkout.reception.arrivalWindow")}),[!1,!0].map(c=>e.jsx("button",{type:"button",onClick:()=>u({type:"hosted",late:c}),className:E("pa-action caption text-inherit px-3 py-1 rounded-full border transition-colors",(r?.late??!1)===c?"border-pa-dark bg-pa-dark text-white":"border-pa-sand text-pa-earth hover:border-pa-dark"),children:c?h("checkout.reception.afterLate",{hour:t.lateFromHour}):h("checkout.reception.beforeLate",{hour:t.lateFromHour})},String(c)))]})]})}function ss(t,r,o,u){if(t.unitPrice==null)return null;const m=Q(t.unitPrice,o),h=c=>`${c} ${String(u("checkout.peopleLabel","People")).toLowerCase()}`,l=c=>`${c} ${String(u("checkout.daysLabel","Days")).toLowerCase()}`;switch(t.pricingModel){case"per_day":return`${l(r.days??1)} à ${m}`;case"per_unit":{const c=r.qty??1;return t.tierPrices?.length?t.tierPrices.slice(0,c).map(($,x)=>x===0?$:$-t.tierPrices[x-1]).map($=>Q($,o)).join(" + "):`${c} à ${m}`}case"per_person":return`${h(r.people??t.minPeople??1)} à ${m}`;case"per_person_per_unit":{const c=t.unitKey==="hour"?u("checkout.hoursLabel","Hours"):u("checkout.sessionsLabel","Sessions");return`${h(r.people??1)} à ${r.sessions??1} ${String(c).toLowerCase()} à ${m}`}case"per_person_per_day":return`${h(r.people??1)} à ${l(r.days??1)} à ${m}`;case"included_selectable":{const c=Math.max(0,(r.qty??1)-1);return c===0?String(u("checkout.included.badge")):`1 ${String(u("checkout.included.badge")).toLowerCase()} + ${c} à ${m}`}default:return null}}function ns(t,r,o,u,m){const h=[];return r.days&&h.push(`${r.days} ${String(m("checkout.daysLabel","Days")).toLowerCase()}`),r.qty&&h.push(`${r.qty}Ã`),r.people&&h.push(`${r.people} ${String(m("checkout.peopleLabel","People")).toLowerCase()}`),r.sessions&&r.sessions>1&&h.push(`${r.sessions} ${String(m("checkout.sessionsLabel","Sessions")).toLowerCase()}`),o!=null&&h.push(o===0&&t.pricingModel==="included_selectable"?m("checkout.included.badge"):Q(o,u)),h.join(" · ")}function We({item:t,sel:r,lang:o,guests:u,nights:m,onToggle:h,onAdjust:l}){const{t:c}=qe(),b=r!=null,$=b?vt(t,r):null,x=t.pricingModel==="on_request",q=()=>{switch(t.pricingModel){case"per_stay":return c("checkout.perStay","per stay");case"per_day":return c("checkout.perDay","per day");case"per_person":return c("checkout.perPerson","per person");case"per_unit":return t.sku.startsWith("transfer")?c("checkout.perTrip","per trip"):t.unitKey==="cleaning"?c("checkout.perCleaning","per cleaning"):t.sku==="pet-fee"?c("checkout.perPetStay","per pet · stay"):c("checkout.perChange","per change");case"per_person_per_unit":return t.unitKey==="hour"?c("checkout.perPersonHour","per child · hour"):c("checkout.perPersonSession","per person · session");case"per_person_per_day":return c("checkout.perPersonDay","per person · day");default:return""}};return e.jsxs("div",{className:E("px-5 py-4 transition-colors",b&&"bg-pa-warm"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"flex items-center gap-1.5 body-sm font-medium text-pa-dark",children:[b&&e.jsx(ie,{className:"w-3.5 h-3.5 text-pa-gold shrink-0",strokeWidth:2.5}),c(`checkout.extras.${t.sku}.name`)]}),e.jsx("p",{className:E("body-sm text-inherit leading-snug mt-0.5",b&&!x?"text-pa-dark":"text-pa-earth"),children:b&&!x&&t.pricingModel!=="per_stay"?ns(t,r,$,o,c):c(`checkout.extras.${t.sku}.desc`)}),(()=>{const w=c(`checkout.proof.${t.sku}`,{defaultValue:""});return w&&!b?e.jsx("p",{className:"caption text-pa-stone-aa mt-0.5",children:w}):null})(),t.fulfillment==="needs_confirmation"&&!b&&e.jsxs("p",{className:"inline-flex items-center gap-1 caption text-pa-stone-aa mt-1",children:[e.jsx(Nt,{className:"w-2.5 h-2.5"})," ",c("checkout.confirm24h","Confirmed within 24h")]}),!b&&t.pricingModel==="per_person_per_day"&&t.unitPrice!=null&&e.jsx("p",{className:"caption text-pa-stone-aa mt-1 tabular-nums",children:`${Math.min(u,30)} ${String(c("checkout.peopleLabel","People")).toLowerCase()} à ${Math.max(1,m)} ${String(c("checkout.daysLabel","Days")).toLowerCase()} = ${Q(t.unitPrice*Math.min(u,30)*Math.max(1,m),o)}`}),t.fulfillment==="needs_confirmation"&&!b&&e.jsx("p",{className:"caption text-pa-stone-aa mt-0.5",children:c("checkout.confirm24hNote","If we cannot secure it, the line is refunded automatically.")})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[x?e.jsx("p",{className:"caption text-pa-stone-aa max-w-[130px]",children:c("checkout.conciergeQuote","Quoted by your concierge")}):t.pricingModel==="included_selectable"?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"eyebrow font-medium tracking-[0.1em] uppercase text-pa-gold",children:c("checkout.included.badge")}),e.jsx("p",{className:"caption text-pa-stone-aa",children:c("checkout.firstIncluded",{price:Q(t.unitPrice,o)})})]}):e.jsxs("p",{className:"body-sm text-pa-dark tabular-nums",children:[Q(t.unitPrice,o)," ",e.jsxs("span",{className:"caption text-pa-stone-aa",children:["/ ",q()]})]}),t.minPeople?e.jsx("p",{className:"caption text-pa-stone-aa",children:c("checkout.minPeople",{count:t.minPeople})}):null,!b&&e.jsx("button",{type:"button",onClick:()=>h(t),className:"pa-action mt-1.5 min-h-[44px] sm:min-h-[32px] px-4 roun
1ded-full border border-pa-sand bg-white eyebrow font-medium tracking-[0.08em] uppercase text-pa-earth hover:border-pa-dark hover:text-pa-dark transition-colors",children:x?c("checkout.request","Request"):c("checkout.add","Add")})]})]}),b&&!x&&e.jsxs("div",{className:"flex items-center justify-between gap-4 mt-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-4 flex-wrap",children:[t.pricingModel==="per_day"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"caption text-pa-stone-aa",children:c("checkout.daysLabel","Days")}),e.jsx(Ee,{value:r.days??1,min:1,max:Math.max(1,m),onChange:w=>l(t.sku,{days:w}),ariaLabel:c("checkout.daysLabel","Days")})]}),t.pricingModel==="included_selectable"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"caption text-pa-stone-aa",children:c("checkout.qtyLabel","Quantity")}),e.jsx(Ee,{value:r.qty??1,min:t.minQty??1,max:t.maxQty??3,onChange:w=>l(t.sku,{qty:w}),ariaLabel:c("checkout.qtyLabel","Quantity")})]}),t.pricingModel==="per_unit"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"caption text-pa-stone-aa",children:t.sku.startsWith("transfer")?c("checkout.tripsLabel","Trips"):c("checkout.qtyLabel","Quantity")}),e.jsx(Ee,{value:r.qty??1,min:t.minQty??1,max:t.maxQty??10,onChange:w=>l(t.sku,{qty:w}),ariaLabel:c("checkout.qtyLabel","Quantity")})]}),(t.pricingModel==="per_person"||t.pricingModel==="per_person_per_unit"||t.pricingModel==="per_person_per_day")&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"caption text-pa-stone-aa",children:c("checkout.peopleLabel","People")}),e.jsx(Ee,{value:r.people??t.minPeople??Math.min(u,30),min:t.minPeople??1,max:30,onChange:w=>l(t.sku,{people:w}),ariaLabel:c("checkout.peopleLabel","People")})]}),t.pricingModel==="per_person_per_day"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"caption text-pa-stone-aa",children:c("checkout.daysLabel","Days")}),e.jsx(Ee,{value:r.days??1,min:1,max:Math.max(1,m),onChange:w=>l(t.sku,{days:w}),ariaLabel:c("checkout.daysLabel","Days")})]}),e.jsx("button",{type:"button",onClick:()=>l(t.sku,{days:Math.max(1,m)}),className:E("pa-action caption text-inherit px-3 py-1.5 rounded-full border transition-colors",(r.days??1)===Math.max(1,m)?"border-pa-dark bg-pa-dark text-white":"border-pa-sand text-pa-earth hover:border-pa-dark"),children:c("checkout.allDays","Every day")})]}),t.pricingModel==="per_person_per_unit"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"caption text-pa-stone-aa",children:t.unitKey==="hour"?c("checkout.hoursLabel","Hours"):c("checkout.sessionsLabel","Sessions")}),e.jsx(Ee,{value:r.sessions??1,min:1,max:10,onChange:w=>l(t.sku,{sessions:w}),ariaLabel:c("checkout.sessionsLabel","Sessions")})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[(()=>{const w=ss(t,r,o,c);return w?e.jsxs("span",{className:"caption text-pa-earth tabular-nums whitespace-nowrap",children:[w,$!=null&&$>0?` = ${Q($,o)}`:""]}):null})(),e.jsx("button",{type:"button",onClick:()=>h(t),className:"caption text-pa-stone-aa hover:text-pa-dark underline underline-offset-2 transition-colors",children:c("checkout.remove","Remove")})]})]}),b&&x&&e.jsx("div",{className:"flex justify-end mt-2",children:e.jsx("button",{type:"button",onClick:()=>h(t),className:"caption text-pa-stone-aa hover:text-pa-dark underline underline-offset-2 transition-colors",children:c("checkout.remove","Remove")})})]})}function rs(t){const{item:r}=t;return e.jsxs("div",{className:E("rounded-lg overflow-hidden bg-white flex flex-col sm:flex-row transition-all",t.sel!=null?"border-[1.5px] border-pa-dark":"border border-pa-sand"),children:[e.jsx("div",{className:"sm:w-[40%] shrink-0 aspect-[3/2] sm:aspect-auto bg-pa-warm",children:e.jsx("img",{src:r.photo,alt:"",className:"w-full h-full object-cover",loading:"eager",onError:o=>{const u=o.currentTarget.parentElement;u&&(u.style.display="none")}})}),e.jsx("div",{className:"flex-1 min-w-0 flex flex-col justify-center",children:e.jsx(We,{...t})})]})}function os({catalog:t,included:r,reception:o,receptionChoice:u,selection:m,nights:h,guests:l,propertyName:c,lang:b,destination:$,defaultAirport:x,onToggle:q,onAdjust:w,onChooseReception:s,onSkip:I,receptionNudge:xe}){const{t:N}=qe(),[M,y]=i.useState(!1),[Y,L]=i.useState({}),[je,C]=i.useState({}),[Be,v]=i.useState("arrival"),Ne=t.filter(g=>
1!g.parentSku&&!g.petsOnly&&g.pricingModel!=="included_selectable"&&!g.sku.startsWith("transfer")).sort((g,k)=>{const _=["private-chef","breakfast-box","grocery-setup"],G=Z=>_.includes(Z)?_.indexOf(Z):_.length;return G(g.sku)-G(k.sku)}).slice(0,3);i.useEffect(()=>{const g=()=>{let k=ct[0];for(const _ of ct){const G=document.getElementById(`chapter-${_}`);G&&G.getBoundingClientRect().top<=Kt+48&&(k=_)}v(_=>_===k?_:k)};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),()=>{window.removeEventListener("scroll",g),window.removeEventListener("resize",g)}},[t.length]);const Qe=g=>{const k=document.getElementById(`chapter-${g}`);if(!k)return;const _=Math.max(0,k.getBoundingClientRect().top+window.scrollY-Kt-16);window.scrollTo({top:_,behavior:"smooth"}),window.setTimeout(()=>{Math.abs(window.scrollY-_)>60&&window.scrollTo({top:_,behavior:"auto"})},500)},se=[...t.filter(g=>g.chapter==="experiences")].sort((g,k)=>+!!k.photo-+!!g.photo),Le=i.useRef(null),U=g=>{const k=Le.current;if(!k)return;const _=k.querySelector(":scope > div");k.scrollBy({left:g*((_?.offsetWidth??300)+12),behavior:"smooth"})};return e.jsxs("div",{children:[e.jsx("style",{children:` 2 .chapter-reveal { opacity: 0; transform: translateY(12px); } 3 .chapter-reveal-in { opacity: 1; transform: none; transition: opacity 300ms ease-out, transform 300ms ease-out; } 4 @media (prefers-reduced-motion: reduce) { 5 .chapter-reveal { opacity: 1; transform: none; } 6 .chapter-reveal-in { transition: none; } 7 } 8 .chapter-nav-scroll { scrollbar-width: none; } 9 .chapter-nav-scroll::-webkit-scrollbar { display: none; } 10 /* O scroll anchoring do Chrome luta com o smooth scroll programático 11 enquanto os reveals acima mudam de transform â desativar (C1) */ 12 .checkout-page { overflow-anchor: none; } 13 `}),e.jsxs("div",{className:"rounded-xl bg-pa-warm border border-pa-sand p-5 space-y-4",children:[e.jsx("h1",{className:"headline-md text-pa-dark",children:N("conversion.extrasTitle")}),e.jsx("p",{className:"body-sm text-pa-earth",children:N("conversion.extrasIntro")})]}),!M&&e.jsxs("div",{className:"space-y-6 mt-6",children:[o&&e.jsx(Vt,{config:o,choice:u,lang:b,onChoose:s,nudge:xe}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("button",{type:"button",onClick:I,className:"btn-primary w-full",children:N("conversion.continuePay")}),!u&&e.jsx("p",{className:"caption text-pa-earth",children:N("conversion.skipNote")})]}),e.jsx("div",{className:"rounded-xl border border-pa-sand divide-y divide-pa-sand overflow-hidden",children:Ne.map(g=>e.jsx(We,{item:g,sel:m[g.sku],lang:b,guests:l,nights:h,onToggle:q,onAdjust:w},g.sku))})]}),e.jsx("button",{type:"button",onClick:()=>y(g=>!g),"aria-expanded":M,className:"min-h-11 my-4 body-sm text-pa-dark underline underline-offset-4",children:N(M?"reviews.showFewer":"conversion.seeAllExtras")}),M&&e.jsxs(e.Fragment,{children:[e.jsx("nav",{className:"sticky top-[61px] z-30 -mx-1 px-1 bg-white/95 backdrop-blur-sm border-b border-pa-sand",children:e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"chapter-nav-scroll flex items-center gap-5 overflow-x-auto py-3",children:ct.map(g=>e.jsx("button",{type:"button",onClick:()=>Qe(g),className:E("shrink-0 caption text-inherit tracking-[0.02em] transition-colors pb-0.5 border-b",Be===g?"text-pa-dark border-pa-gold font-medium":"text-pa-stone-aa border-transparent hover:text-pa-dark"),children:N(`checkout.chapter.${g}.title`)},g))}),e.jsx("button",{type:"button",onClick:I,className:"shrink-0 caption text-pa-stone-aa hover:text-pa-dark underline underline-offset-2 transition-colors py-3",children:N("checkout.skipCustomize","Skip personalization")})]})}),ct.map((g,k)=>{const _=g==="arrival",G=g==="experiences",Z=t.filter(f=>f.chapter===g);if(!Z.length&&!(_&&o))return null;const ce=G?void 0:Z.find(f=>f.feature&&f.photo),ze=f=>{const O=f.map(le=>Z.find(fe=>fe.sku===le)).filter(Boolean);return O.length===2?O:null},T=_?ze(["transfer-porto","transfer-lisbon"]):null,ve=_?ze(["transfer-porto-van","transfer-lisbon-van"]):null,A=new Set([...T??[],...ve??[]].map(f=>f.sku)),Fe=Z.filter(f=>f!==ce&&!A.has(f.sku)&&(!f.parentSku||m[f.parentSku]!=null)),F=Fe.filter(f=>
13f.pricingModel==="included_selectable"||f.petsOnly),Ue=Fe.filter(f=>!F.includes(f)),He=G?[]:Ue;return e.jsxs(ts,{id:`chapter-${g}`,className:E("scroll-mt-[130px]",k===0?"mt-6":"mt-12 lg:mt-16"),children:[e.jsx(as,{num:String(k+1).padStart(2,"0"),chapter:g,destination:$}),_&&o&&e.jsx("div",{className:"mb-6",children:e.jsx(Vt,{config:o,choice:u,lang:b,onChoose:s,nudge:xe})}),ce&&e.jsx("div",{className:"mb-3",children:e.jsx(rs,{item:ce,sel:m[ce.sku],lang:b,guests:l,nights:h,onToggle:q,onAdjust:w})}),(T||ve)&&(()=>{const O=[T,ve].filter(Boolean).map(S=>S[0].sku.includes("porto")?S:[...S].reverse()),fe=(O.some(([,S])=>m[S.sku]!=null)?"lisbon":O.some(([S])=>m[S.sku]!=null)?"porto":null)??je.__all??x??"porto",Me=S=>{S!==fe&&(O.forEach(([J,de])=>{const ne=S==="lisbon"?J:de,pe=S==="lisbon"?de:J,ee=m[ne.sku];ee&&(q(ne),q(pe),ee.qty&&ee.qty>1&&w(pe.sku,{qty:ee.qty}))}),C({__all:S}))};return e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg divide-y divide-pa-sand overflow-hidden mb-3",children:[e.jsxs("div",{className:"px-5 py-3 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"caption text-pa-earth",children:N("checkout.arrivalAirport","Arrival airport")}),e.jsx("div",{className:"flex items-center gap-1.5",children:["porto","lisbon"].map(S=>e.jsx("button",{type:"button",onClick:()=>Me(S),className:E("pa-action caption text-inherit px-3 py-1 rounded-full border transition-colors",fe===S?"border-pa-dark bg-pa-dark text-white":"border-pa-sand text-pa-earth hover:border-pa-dark"),children:S==="porto"?N("checkout.airport.porto","Porto"):N("checkout.airport.lisbon","Lisbon")},S))})]}),O.map(([S,J])=>{const de=fe==="lisbon"?J:S;return e.jsx(We,{item:de,sel:m[de.sku],lang:b,guests:l,nights:h,onToggle:q,onAdjust:w},S.sku)})]})})(),!G&&He.length>0&&e.jsx("div",{className:"bg-white border border-pa-sand rounded-lg divide-y divide-pa-sand overflow-hidden",children:He.map(f=>e.jsx(We,{item:f,sel:m[f.sku],lang:b,guests:l,nights:h,onToggle:q,onAdjust:w},f.sku))}),F.length>0&&e.jsxs("div",{className:"mt-3",children:[e.jsx("p",{className:"caption font-medium tracking-[0.08em] uppercase text-pa-stone-aa mb-2",children:N("checkout.stayDetails.title","Stay details")}),e.jsx("div",{className:"bg-white border border-pa-sand rounded-lg divide-y divide-pa-sand overflow-hidden",children:F.map(f=>e.jsx(We,{item:f,sel:m[f.sku],lang:b,guests:l,nights:h,onToggle:q,onAdjust:w},f.sku))})]}),0>0,G&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-end gap-2 mb-3",children:[e.jsx("button",{type:"button",onClick:()=>U(-1),"aria-label":N("checkout.prev","Previous"),className:"w-10 h-10 rounded-full border border-pa-sand bg-white flex items-center justify-center text-pa-earth hover:border-pa-dark hover:text-pa-dark transition-colors",children:e.jsx(Fa,{className:"w-4 h-4"})}),e.jsx("button",{type:"button",onClick:()=>U(1),"aria-label":N("checkout.next","Next"),className:"w-10 h-10 rounded-full border border-pa-sand bg-white flex items-center justify-center text-pa-earth hover:border-pa-dark hover:text-pa-dark transition-colors",children:e.jsx(Zt,{className:"w-4 h-4"})})]}),e.jsx("div",{ref:Le,className:"chapter-nav-scroll flex gap-3 overflow-x-auto snap-x pb-1",children:se.map(f=>{const O=m[f.sku]!=null;return e.jsxs("div",{className:E("shrink-0 w-[70%] sm:w-[calc((100%-24px)/3)] snap-start rounded-lg overflow-hidden bg-white transition-all flex flex-col",O?"border-[1.5px] border-pa-dark":"border border-pa-sand"),children:[e.jsxs("div",{className:"aspect-[3/2] bg-pa-warm relative",children:[f.photo?e.jsx("img",{src:f.photo,alt:"",className:"w-full h-full object-cover",loading:"eager",onError:le=>{le.currentTarget.style.display="none"}}):e.jsx("div",{className:"w-full h-full flex items-center justify-center px-4",children:e.jsx("p",{className:"font-display text-[20px] text-pa-earth text-center leading-snug",children:N(`checkout.extras.${f.sku}.name`)})}),O&&e.jsx("span",{className:"absolute top-2 right-2 w-6 h-6 rounded-full bg-pa-dark flex items-center justify-center",children:e.jsx(ie,{className:"w-3.5 h-3.5 text-white"})})]}),e.jsxs("div",{className:"p-4 flex flex-col flex-1",children:[e.jsx("p",{className:"body-sm font-medium text-pa-dark leading-snug",children:N(`checkout.extras.${f.sku}.name`)}),e.jsxs("div",{className:"mt-2 mt-auto space-y-2",children:[e.jsxs("p",{className:"caption text-pa-earth leading-snug",children:[f.priceFrom!=null?N("checkout.fromPrice",{price:Q(f.priceFrom,b)}):N("checkout.onRequestShort","on request"),e.jsxs("span",{className:"text-pa-stone-aa",children:[" · ",N("checkout.noChargeNow","no charge now")]})]}),e.jsx("button",{type:"button",onClick:()=>q(f),className:E("pa-action w-full min-h-[44px] sm:min-h-[36px] rounded-full border eyebrow text-inherit font-medium tracking-[0.08em] uppercase transition-colors",O?"bg-pa-dark border-pa-dark text-white":"border-pa-sand text-pa-earth hover:border-pa-dark hover:text-pa-dark"),children:O?N("checkout.requested","Requested"):N("checkout.request","Request")})]})]})]},f.sku)})})]})]},g)}),e.jsx("p",{className:"caption text-pa-stone-aa leading-relaxed mt-10",children:N("checkout.extrasChargeNote")})]})]})}function is({config:t,selected:r,stayTotal:o,nonRefundableSelected:u,freeCancelUntil:m,lang:h,listingId:l,demo:c,gifted:b=!1,onToggle:$}){const{t:x}=qe(),[q,w]=i.useState(!1),s=i.useRef(!1),I=i.useRef(null);if(i.useEffect(()=>{if(s.current||c||o<t.minTotal)return;const y=I.current;if(!y)return;if(typeof IntersectionObserver>"u"){s.current=!0,X({event:"flex_viewed",property_id:l,value:t.price});return}const Y=new IntersectionObserver(L=>{s.current||L.some(je=>je.isIntersecting)&&(s.current=!0,X({event:"flex_viewed",property_id:l,value:t.price}),Y.disconnect())},{threshold:.5});return Y.observe(y),()=>Y.disconnect()},[c,l,t.price,o,t.minTotal]),o<t.minTotal)return null;const xe=u?x("checkout.flex.copyNonRefundable",{days:t.rescheduleDaysBefore}):m?x("checkout.flex.copyFlexible",{date:me(m,h,!0),days:t.rescheduleDaysBefore}):x("checkout.flex.copyNoWindow",{days:t.rescheduleDaysBefore}),N=[{icon:Ma,text:x("checkout.flex.benefit1",{days:t.rescheduleDaysBefore})}
13,{icon:Ta,text:x("checkout.flex.benefit2")},{icon:Da,text:x("checkout.flex.benefit3",{months:t.creditMonths})}],M=[x("checkout.flex.rule1",{days:t.rescheduleDaysBefore}),x("checkout.flex.rule2"),x("checkout.flex.rule3",{months:t.creditMonths}),x("checkout.flex.rule4"),x("checkout.flex.rule5"),x("checkout.flex.rule6")];return e.jsxs("div",{ref:I,className:E("rounded-lg border bg-pa-warm p-5 transition-all",r?"border-pa-gold ring-1 ring-pa-gold":"border-pa-gold/50"),children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:E("shrink-0 w-10 h-10 rounded-md flex items-center justify-center transition-colors",r?"bg-pa-gold text-white":"bg-pa-warm text-pa-gold"),children:e.jsx(Aa,{className:"w-5 h-5",strokeWidth:1.8})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-display text-[22px] text-pa-dark leading-snug",children:x("checkout.flex.title","Flex â guaranteed rebooking")}),e.jsx("p",{className:"body-sm text-pa-earth mt-0.5",children:x("checkout.flex.tagline","Rebook whenever you need. The amount you paid is never lost.")})]}),e.jsxs("div",{className:"text-right shrink-0 hidden sm:block max-w-[150px]",children:[b?e.jsxs("p",{className:"body-sm font-medium tabular-nums",children:[e.jsx("s",{className:"text-pa-stone-aa",children:Q(t.price,h)})," ",e.jsx("span",{className:"text-pa-gold",children:x("checkout.flex.gifted","Offered")})]}):e.jsx("p",{className:"body-sm text-pa-dark font-medium tabular-nums",children:Q(t.price,h)}),e.jsx("p",{className:"caption text-pa-stone-aa leading-snug",children:x("checkout.flex.percentNote","10% of the nightly total, one-time")})]})]}),e.jsxs("p",{className:"sm:hidden mt-2 body-sm text-pa-dark tabular-nums",children:[b?e.jsxs("span",{className:"font-medium",children:[e.jsx("s",{className:"text-pa-stone-aa",children:Q(t.price,h)})," ",e.jsx("span",{className:"text-pa-gold",children:x("checkout.flex.gifted","Offered")})]}):e.jsx("span",{className:"font-medium",children:Q(t.price,h)}),e.jsxs("span",{className:"text-pa-stone-aa caption",children:[" · ",x("checkout.flex.percentNote","10% of the nightly total, one-time")]})]}),e.jsx("div",{className:"mt-4 space-y-2",children:N.map(({icon:y,text:Y},L)=>e.jsxs("div",{className:"flex items-center gap-2 body-sm text-pa-earth",children:[e.jsx(y,{className:"w-3.5 h-3.5 text-pa-gold shrink-0",strokeWidth:1.8}),Y]},L))}),e.jsx("p",{className:"mt-3 caption leading-relaxed text-pa-dark bg-pa-warm border border-pa-sand rounded-md px-3 py-2.5",children:xe}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>w(!0),className:"inline-flex items-center gap-0.5 caption text-pa-gold hover:text-pa-dark transition-colors underline underline-offset-2",children:[x("checkout.flex.howItWorks","How it works"),e.jsx(Zt,{className:"w-3 h-3"})]}),e.jsx("button",{type:"button",onClick:()=>{const y=!r;$(y),c||X({event:y?"flex_added":"flex_removed",property_id:l,value:t.price})},"aria-pressed":r,className:E("pa-action min-h-[40px] px-5 rounded-full border eyebrow text-inherit font-medium tracking-[0.08em] uppercase transition-colors",r?"bg-pa-gold border-pa-gold text-white":"border-pa-gold text-pa-gold hover:bg-pa-gold hover:text-white"),children:r?e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(ie,{className:"w-3.5 h-3.5"})," ",x("checkout.flex.added","Added")]}):x("checkout.flex.add","Add Flex")})]}),e.jsx(Ga,{open:q,onOpenChange:w,children:e.jsx(Ka,{className:"max-w-[480px] bg-white",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(Va,{className:"font-display text-[20px] font-normal leading-normal text-pa-dark",children:x("checkout.flex.title","Flex â guaranteed rebooking")}),e.jsxs("p",{className:"body-sm text-pa-earth mt-1",children:[Q(t.price,h)," · ",x("checkout.flex.perBooking","one-time, per booking")]})]}),e.jsx("ol",{className:"space-y-2.5",children:M.map((y,Y)=>e.jsxs("li",{className:"flex gap-2.5 body-sm leading-relaxed text-pa-earth",children:[e.jsx("span",{className:"shrink-0 w-4 h-4 rounded-full bg-pa-warm text-pa-gold caption flex items-center justify-center mt-0.5",children:Y+1}),y]},Y))}),e.jsx("p",{className:"caption leading-relaxed text-pa-dark bg-pa-warm border border-pa-sand rounded-md px-3 py-2.5",children:x("checkout.flex.honesty")})]})})})]})}const ta=1380*60*1e3;function Xt(){const t=r=>{const o=new Date;o.setDate(o.getDate()+r);const u=m=>String(m).padStart(2,"0");return`${o.getFullYear()}-${u(o.getMonth()+1)}-${u(o.getDate())}`};return{id:"demo",listingId:"demo-listing",propertyName:"Abreu Retreat Palace â Luxury, Elegance & Leisure",propertySlug:"abreu-retreat-palace-luxury-elegance-leisure-e914e2",destination:"minho",guestyQuoteId:"demo",checkIn:t(30),checkOut:t(35),guests:4,ratePlanId:"demo-flex",email:"",guestFirstName:"",guestLastName:"",guestPhone:"",nif:"",quote:{nightlyRate:500,totalNights:2500,cleaningFee:200,taxesAndFees:0,total:2700,nights:5,currency:"EUR",quoteCreatedAt:Date.now(),ratePlanOptions:[{ratePlanId:"demo-flex",name:"Flexible",total:2700,nightlyRate:500,cleaningFee:200,taxesAndFees:0,cancellationPolicy:["moderate"]},{ratePlanId:"demo-nr",name:"Non-refundable",total:2430,nightlyRate:446,cleaningFee:200,taxesAndFees:0,cancellationPolicy:["super_strict"]}]},extras:[],reception:null,flex:!1,status:"draft",locale:null,reservationId:null,confirmationCode:null,expiresAt:new Date(Date.now()+ta),createdAt:new Date,updatedAt:new Date}}function cs(t,r=400){const[o,u]=i.useState(t),m=i.useRef(t);return i.useEffect(()=>{const h=m.current;if(h===t)return;m.current=t;const l=performance.now();let c;const b=$=>{const x=Math.min(1,($-l)/r),q=1-Math.pow(1-x,3);u(x===1?t:Math.round((h+(t-h)*q)*100)/100),x<1&&(c=requestAnimationFrame(b))};return c=requestAnimationFrame(b),()=>cancelAnimationFrame(c)},[t,r]),o}const ls={flexible:1,moderate:14,firm:30,strict:60};function ds(t,r){const o=(t.cancellationPolicy?.[0]||"").toLowerCase(),u=ls[o];if(!u||!r)return!0;const m=new Date(`${r}T12:00:00`);return m.setDate(m.getDate()-u),m.getTime()>Date.now()}function jt(t,r){if(!t||!t.length)return t;const o=l=>[...l].sort((c,b)=>c.total-b.total)[0],u=t.filter(l=>lt(l)),m=t.filter(l=>!lt(l)&&ds(l,r)),h=[];return m.length&&h.push(o(m)),u.length&&h.push(o(u)),h.length?h:[o(t)]}function lt(t){const r=(t.name||"").toLowerCase(),o=(t.cancellationPolicy?.[0]||"").toLowerCase();return r.includes("non")&&r.includes("refund")||r.includes("não")&&r.includes("reembols")||o==="super_strict"}function Rs(){const{t,i18n:r}=qe(),o=r.language,{intentId:u}=Ia(),[,m]=Ra(),h=ae.useUtils();ja({title:t("checkout.pageTitle","Checkout"),noindex:!0});const l=u==="demo",c=i.useMemo(()=>l?Xt():null,[l]),b=ae.checkout.getIntent.useQuery({intentId:u??""},{enabled:!!u&&!l,refetchOnWindowFocus:!1,retry:1}),[$,x]=i.useState(!1),q=ae.checkout.updateIntent.useMutation({onError:()=>x(!0),onSuccess:a=>x(!a?.ok)}),w=ae.checkout.captureLead.useMutation(),s=l?c:b.data?.intent??null;Ja(l?void 0:u,!!s,s?.status==="paid");const I=i.useCallback(a=>{!u||l||(h.checkout.getIntent.setData({intentId:u},n=>n?.intent?{...n,intent:{...n.intent,...a}}:n),q.mutate({intentId:u,patch:a}))},[u,l,h,q]),xe=i.useRef(!1),[N,M]=i.useState("stay"),[y,Y]=i.useState(""),[L,je]=i.useState(""),[C,Be]=i.useState(2),[v,Ne]=i.useState(null),Qe=i.useRef(null);Qe.current=v;const[se,Le]=i.useState(null),[U,g]=i.useState(null),[k,_]=i.useState(""),[G,Z]=i.useState(!1),[ce,ze]=i.useState(!1),[T,ve]=i.useState(""),[A,Fe]=i.useState(""),[F,Ue]=i.useState(""),[He,wt]=i.useState(!1),[f,O]=i.useState(""),[le,fe]=i.useState(!1),[Me,S]=i.useState(!1),[J,de]=i.useState(!1),[ne,pe]=i.useState(!1),[ee,Ye]=i.useState(!1),[dt,aa]=i.useState(!1),pt=i.useRef(!1),[ge,Te]=i.useState({}),[D,we]=i.useState(!1),[R,Ge]=i.useState(null),[sa,Ct]=i.useState(!1),[na,Ke]=i.useState(!1),[Ce,Pe]=i.useState(""),[ut,Pt]=i.useState(!1),[_t,_e]=i.useState(!1),[St,It]=i.useState(null),Ve=ae.booking.applyCoupon.useMutation();i.useEffect(()=>{if(!(!s||s.quote?.couponCode))try{const a=localStorage.getItem("pa_promo_code");a&&!Ce&&(Pe(a.toUpperCase().replace(/[^A-Z0-9_-]/g,"").slice(0,40)),Ke(!0))}catch{}},[s?.id]),i.useEffect(()=>{if(!s||xe.current)return;xe.current=!0,Y(s.checkIn),je(s.checkOut),Be(s.guests),Ne(s.quote??null),Le(s.guestyQuoteId??null),g(s.ratePlanId??null),s.email&&_(s.email),s.guestFirstName&&ve(s.guestFirstName),s.guestLastName&&Fe(s.guestLastName),s.guestPhone&&Ue(s.guestPhone),s.nif&&O(s.nif);let a=!1;try{a=!sessionStorage.getItem(`checkout_created_${s.id}`),sessionStorage.setItem(`checkout_created_${s.id}`,"1")}
13catch{}if(s.email&&(pt.current=!0),s.flex&&we(!0),s.reception?.type&&Ge(s.reception),s.quote?.couponCode&&Pe(String(s.quote.couponCode)),Array.isArray(s.extras)){const p={};for(const d of s.extras)typeof d?.sku=="string"&&(p[d.sku]={qty:typeof d.qty=="number"?d.qty:void 0,people:typeof d.people=="number"?d.people:void 0,sessions:typeof d.sessions=="number"?d.sessions:void 0,days:typeof d.days=="number"?d.days:void 0});Te(p)}s.status==="contact_captured"&&M("customize"),s.status==="payment_pending"&&M("pay"),a&&!l&&X({event:"checkout_resume",property_id:s.listingId});const n=s.quote?.quoteCreatedAt;(b.data?.expired||!s.guestyQuoteId||n!=null&&Date.now()-n>ta)&&pe(!0)},[s,b.data?.expired]),i.useEffect(()=>{const a=s?.expiresAt?new Date(s.expiresAt).getTime():NaN;if(!Number.isFinite(a))return;const n=a-Date.now();if(n<=0){pe(!0);return}const p=window.setTimeout(()=>pe(!0),Math.min(n,2**31-1));return()=>window.clearTimeout(p)},[s?.expiresAt]);const P=i.useMemo(()=>{if(!v)return null;const a=v.ratePlanOptions?.find(n=>n.ratePlanId===U);return a?{...v,nightlyRate:a.nightlyRate,totalNights:Na(a.total,a.cleaningFee,a.taxesAndFees??0),cleaningFee:a.cleaningFee,taxesAndFees:a.taxesAndFees??0,total:a.total,ratePlanId:a.ratePlanId,cancellationPolicy:a.cancellationPolicy}:{...v,ratePlanId:U??void 0,cancellationPolicy:void 0}},[v,U]),ra=y?Number(y.slice(5,7)):void 0,re=ae.checkout.getExtras.useQuery({listingId:s?.listingId??void 0,destination:s?.destination??void 0,nights:v?.nights??1,guests:C,month:ra},{staleTime:1800*1e3,enabled:!!s}),De=re.data?.extras??[],Rt=i.useRef(!1);i.useEffect(()=>{if(!l||Rt.current||!re.data)return;const a=new URLSearchParams(window.location.search);a.get("case")==="full"&&(Rt.current=!0,Ge({type:"hosted",late:!0}),Te({"transfer-porto":{qty:1},"grocery-setup":{qty:1},"daily-cleaning":{qty:3},"breakfast-box":{people:4,days:5},"pet-fee":{qty:2},"travel-crib":{qty:1},"private-chef":{people:4},"exp-canyoning":{}}),we(!0),M(a.get("step")==="pay"?"pay":"customize"))},[l,re.data]);const H=re.data?.flex??null,ue=re.data?.reception??null,oa=re.data?.promoEnabled??!1,ia=re.data?.included??[],Se=ae.properties.getBySlugForSite.useQuery({slug:s?.propertySlug??""},{enabled:!!s?.propertySlug,staleTime:3600*1e3}).data,Xe=Se?.images?.[0]?va(Se.images[0],800):void 0,oe=wa(s?.propertyName||Se?.name||""),Ze=new URLSearchParams;y&&Ze.set("checkin",y),L&&Ze.set("checkout",L),C&&Ze.set("guests",String(C));const $t=s?.propertySlug?`/homes/${s.propertySlug}?${Ze}`:"/homes",Et=ae.booking.getCalendar.useQuery({listingId:s?.listingId??"",from:new Date().toISOString().split("T")[0],to:(()=>{const a=new Date;return a.setMonth(a.getMonth()+18),a.toISOString().split("T")[0]})()},{enabled:!!s?.listingId&&Me,staleTime:600*1e3}),ca=Et.data?.days??[],Je=i.useCallback(async(a,n,p)=>{if(s){de(!0),Ye(!1);try{const d=await h.booking.getQuote.fetch({listingId:s.listingId,checkIn:a,checkOut:n,guests:p}),j=d.quoteId,te=d.source,W=d.pricing?.total??0;if(!j||te!=="live"&&te!=="cached"||W<=0){Ye(!0);return}const B={nightlyRate:d.pricing?.nightlyRate??0,totalNights:d.pricing?.totalNights??0,cleaningFee:d.pricing?.cleaningFee??0,taxesAndFees:d.pricing?.taxesAndFees??0,total:W,nights:d.nights,currency:"EUR",quoteCreatedAt:Date.now(),ratePlanOptions:jt(d.ratePlanOptions,a)};Te(Ie=>{const K={};for(const[ka,ot]of Object.entries(Ie))K[ka]=ot.days?{...ot,days:Math.min(ot.days,Math.max(1,B.nights))}:ot;return K}),H&&B.total<H.minTotal&&D&&(we(!1),I({flex:!1}));let Ae=B;const rt=Qe.current?.couponCode;if(rt){const Ie=()=>{It(rt),Pe(rt),Ke(!0)};try{const K=await Ve.mutateAsync({quoteId:j,listingId:s.listingId,checkIn:a,checkOut:n,coupon:rt});K.ok?(It(null),Ae={...B,nightlyRate:K.pricing.nightlyRate,totalNights:K.pricing.totalNights,cleaningFee:K.pricing.cleaningFee,taxesAndFees:K.pricing.taxesAndFees??0,total:K.total,couponCode:K.coupons?.[0]?.code||void 0,ratePlanOptions:jt(K.ratePlanOptions,a)}):Ie()}catch{Ie()}}const Gt=Ae.ratePlanOptions?.find(Ie=>Ie.ratePlanId===U)?.ratePlanId??d.ratePlanId??Ae.ratePlanOptions?.[0]?.ratePlanId??null;Ne(Ae),Le(j),g(Gt),Y(a),je(n),Be(p),pe(!1),I({checkIn:a,checkOut:n,guests:p,guestyQuoteId:j,ratePlanId:Gt??void 0,quote:Ae})}catch{Ye(!0)}finally{de(!1)}}},[s,U,I,h,Ve]),qt=i.useCallback(()=>{Z(!0),!(!s||!he(k))&&(l||w.mutateAsync({intentId:s.id,email:k,locale:o,consent:ce}).catch(()=>{}),h.checkout.getIntent.setData({intentId:s.id},a=>a?.intent?{...a,intent:{...a.intent,email:k}}:a),!pt.current&&!l&&(pt.current=!0,X({event:"add_contact_info",property_id:s.listingId,source:"checkout_v2"})),M("customize"),window.scrollTo({top:0,behavior:"smooth"}))},[s,k,o,w,h,l,ce]),ht=i.useCallback(async a=>{if(s){Pt(!0),_e(!1);try{if(l){if(a&&a!=="DEMO10"){_e(!0);return}const j=Xt().quote,te=a?.9:1,W=B=>Math.round(B*te);Ne({...j,nightlyRate:W(j.nightlyRate),totalNights:W(j.totalNights),total:W(j.total-j.cleaningFee)+j.cleaningFee,couponCode:
13a||void 0,ratePlanOptions:j.ratePlanOptions?.map(B=>({...B,nightlyRate:W(B.nightlyRate),total:W(B.total-B.cleaningFee)+B.cleaningFee}))}),a||Pe(""),Ke(!!a);return}if(!se){_e(!0);return}const n=await Ve.mutateAsync({quoteId:se,listingId:s.listingId,checkIn:y,checkOut:L,coupon:a});if(!n.ok){_e(!0);return}const p={nightlyRate:n.pricing.nightlyRate,totalNights:n.pricing.totalNights,cleaningFee:n.pricing.cleaningFee,taxesAndFees:n.pricing.taxesAndFees??0,total:n.total,nights:n.nights,currency:"EUR",quoteCreatedAt:v?.quoteCreatedAt??Date.now(),couponCode:n.coupons?.[0]?.code||void 0,ratePlanOptions:jt(n.ratePlanOptions,y)},d=p.ratePlanOptions?.find(j=>j.ratePlanId===U);Ne(p),g(d?.ratePlanId??n.ratePlanId??p.ratePlanOptions?.[0]?.ratePlanId??null),I({quote:p}),a||Pe(""),a&&X({event:"coupon_applied",coupon:a,property_id:s.listingId})}catch{_e(!0)}finally{Pt(!1)}}},[s,l,se,y,L,U,Ve,I]),la=i.useCallback(a=>{Ge(a),Ct(!1),I({reception:a}),a&&!l&&X({event:"reception_selected",reception_type:a.type,reception_late:!!a.late,property_id:s?.listingId})},[I,l,s?.listingId]),Lt=i.useCallback(a=>a.pricingModel==="per_day"?{days:a.suggestedDays??Math.max(1,v?.nights??1)}:a.pricingModel==="per_person"?{people:Math.max(a.minPeople??1,Math.min(C,30))}:a.pricingModel==="per_person_per_unit"?{people:1,sessions:1}:a.pricingModel==="per_person_per_day"?{people:Math.min(C,30),days:Math.max(1,v?.nights??1)}:a.pricingModel==="per_unit"||a.pricingModel==="included_selectable"?{qty:a.suggestedQty??a.minQty??1}:{},[C,v?.nights]),mt=i.useCallback(a=>{const n=!(a.sku in ge),p=n?Lt(a):ge[a.sku]??{};if(Te(te=>{const W={...te};if(n)W[a.sku]=p;else{delete W[a.sku];for(const B of De)B.parentSku===a.sku&&delete W[B.sku]}return W}),l)return;const d=vt(a,p);if(d==null){n&&X({event:"request_created",property_id:s?.listingId,item_id:a.sku,item_chapter:a.chapter});return}const j=p.qty??p.sessions??p.days??p.people??1;Ca({event:n?"add_to_cart":"remove_from_cart",property_id:s?.listingId,ecommerce:{currency:"EUR",value:d??0,items:[{item_id:a.sku,item_name:t(`checkout.extras.${a.sku}.name`,a.sku),item_category:"extra",item_category2:a.chapter,price:a.unitPrice??0,quantity:j}]}})},[ge,Lt,s?.listingId,De,l,t]),da=i.useCallback((a,n)=>{Te(p=>({...p,[a]:{...p[a],...n}}))},[]),z=i.useMemo(()=>Object.entries(ge).map(([a,n])=>{const p=De.find(d=>d.sku===a);return p?{item:p,sel:n,amount:vt(p,n)}:null}).filter(Boolean),[ge,De]),be=i.useMemo(()=>z.filter(a=>a.amount!=null),[z]),xt=i.useMemo(()=>z.filter(a=>a.amount==null),[z]),pa=i.useMemo(()=>be.reduce((a,n)=>a+(n.amount??0),0),[be]),ke=ue?es(ue,R):0,et=H?(v?.totalNights??0)>0?Math.round((v?.totalNights??0)*(H.pricePercent??10)/100):H.price:0,ft=!!s?.flexGiftUntil&&new Date(s.flexGiftUntil).getTime()>Date.now(),tt=D&&H&&!ft?et:0;i.useEffect(()=>{!D||!H||!P||P.total<H.minTotal&&(we(!1),I({flex:!1}))},[D,H?.minTotal,P?.total]);const at=(P?.total??0)+ke+pa+tt,Ft=cs(at),gt=v?.ratePlanOptions?.find(a=>a.ratePlanId===U),ua=gt?lt(gt):!1,ha=$a(gt?.cancellationPolicy?.[0],y),Mt=i.useRef(!1);i.useEffect(()=>{if(!s||l)return;if(!Mt.current){Mt.current=!0;return}const a=window.setTimeout(()=>{I({flex:D,extras:z.map(({item:n,sel:p,amount:d})=>({sku:n.sku,qty:p.qty,people:p.people,sessions:p.sessions,days:p.days,amount:d,fulfillment:n.fulfillment}))})},600);return()=>window.clearTimeout(a)},[ge,D]);const Tt=i.useCallback(a=>
13{if(!s)return;const n=a??R;if(!n){Ct(!0),document.getElementById("reception-choice")?.scrollIntoView({behavior:"smooth",block:"center"});return}I({status:"payment_pending",flex:D,reception:n,extras:z.map(({item:p,sel:d,amount:j})=>({sku:p.sku,qty:d.qty,people:d.people,sessions:d.sessions,days:d.days,amount:j,fulfillment:p.fulfillment}))}),M("pay"),window.scrollTo({top:0,behavior:"smooth"})},[s,R,z,D,I]),bt=i.useCallback(()=>{const a=R??{type:"self"};R||(Ge(a),l||X({event:"reception_selected",reception_type:"self",reception_late:!1,reception_default:!0,property_id:s?.listingId})),Tt(a)},[R,Tt,l,s?.listingId]),ma=i.useCallback(async()=>{if(!u||l||!s)return;const a={flex:D,extras:z.map(({item:p,sel:d,amount:j})=>({sku:p.sku,qty:d.qty,people:d.people,sessions:d.sessions,days:d.days,amount:j,fulfillment:p.fulfillment})),...R?{reception:R}:{},...he(k)?{email:k}:{},...T.trim()&&A.trim()&&Oe(F)?{guestFirstName:T.trim(),guestLastName:A.trim(),guestPhone:F,nif:f.trim()}:{}};if(h.checkout.getIntent.setData({intentId:u},p=>p?.intent?{...p,intent:{...p.intent,...a}}:p),!(await q.mutateAsync({intentId:u,patch:a}))?.ok)throw new Error("checkout state could not be saved")},[u,l,s,D,z,R,k,T,A,F,f,h,q]),xa=i.useMemo(()=>{const a=[];if(R&&a.push(R.type==="hosted"?` 14 15â RECEÃÃO: presencial${R.late?` (após as ${ue?.lateFromHour??21}h, ${ue?.hostedLatePrice??90} EUR)`:` (${ue?.hostedPrice??50} EUR)`}`:` 16 17â RECEÃÃO: self check-in (incluÃdo)`),z.length){const n=z.map(({item:p,sel:d,amount:j})=>[`- ${p.sku}`,d.qty?`x${d.qty}`:"",d.days?`${d.days} dias`:"",d.people?`${d.people} pessoas`:"",d.sessions?`${d.sessions} sessoes`:"",j!=null?`â ${j} EUR`:"(sob pedido)",p.fulfillment==="needs_confirmation"?"[CONFIRMAR 24H]":""].filter(Boolean).join(" "));a.push(` 18 19â ï¸ EXTRAS PEDIDOS NO CHECKOUT: 20${n.join(` 21`)}`)}return a.join("")},[R,ue,z]),Dt=T.trim().length>0&&A.trim().length>0&&Oe(F),At=i.useRef("");i.useEffect(()=>{if(!s||!Dt)return;const a=`${T}|${A}|${F}|${f}`;if(At.current===a)return;const n=setTimeout(()=>{At.current=a,I({guestFirstName:T.trim(),guestLastName:A.trim(),guestPhone:F,nif:f.trim()})},800);return()=>clearTimeout(n)},[s,Dt,T,A,F,f,I]);const st=i.useMemo(()=>{const a=[];for(const{item:n,sel:p,amount:d}of be){const j=Math.max(1,Number(p.qty??1));a.push({item_id:`EXTRA-${n.sku}`,item_name:t(`checkout.extras.${n.sku}.name`,n.sku),item_category:"extra",item_category2:n.chapter,price:Math.round((d??0)/j*100)/100,quantity:j})}return R?.type==="hosted"&&ke>0&&a.push({item_id:R.late?"RECEPTION-HOSTED-LATE":"RECEPTION-HOSTED",item_name:t("checkout.reception.hosted.name","Hosted reception"),item_category:"reception",price:ke,quantity:1}),D&&tt>0&&a.push({item_id:"FLEX",item_name:t("checkout.flex.title","Flex, guaranteed rebooking"),item_category:"protection",price:tt,quantity:1}),a},[be,R,ke,D,tt,t]),Ot=i.useCallback((a,n)=>{if(!s)return;const p=n||a;qa({reservationId:p,confirmationCode:a,method:"card",listingId:s.listingId,listingName:oe,location:s.destination||"",checkIn:y,checkOut:L,guestsCount:C,guestName:`${T} ${A}`.trim(),guestEmail:k,guestPhone:F,totalCents:Math.round(at*100),nightlyRateCents:P?Math.round(P.nightlyRate*100):void 0,nights:v?.nights,currency:"EUR",couponCode:v?.couponCode||void 0,purchaseItems:st}),h.checkout.getIntent.invalidate({intentId:s.id}),m(`/booking/thank-you/${p}?method=card`)},[s,oe,y,L,C,T,A,k,F,at,P,v?.nights,v?.couponCode,st,I,m]),fa=ae.checkout.finalizeCardCharge.useMutation(),[ga,Wt]=i.useState(!1),Bt=i.useRef(!1);i.useEffect(()=>{if(Bt.current||!s||l)return;const a=new URLSearchParams(window.location.search),n=a.get("payment_intent"),p=a.get("redirect_status");if(!n||!p)return;Bt.current=!0,a.delete("payment_intent"),a.delete("payment_intent_client_secret"),a.delete("redirect_status");const d=a.toString();window.history.replaceState(null,"",window.location.pathname+(d?`?${d}`:"")),!(p!=="succeeded"&&p!=="processing")&&(M("pay"),Wt(!0),fa.mutateAsync({intentId:s.id,paymentIntentId:n}).then(j=>Ot(j.confirmationCode,j.reservationId)).catch(()=>Wt(!1)))},[s?.id]);const nt=i.useMemo(()=>{if(!s?.expiresAt)return null;const a=new Date(s.expiresAt);if(Number.isNaN(a.getTime())||a.getTime()<Date.now())return null;const n=a.toLocaleTimeString(Pa(o),{hour:"2-digit",minute:"2-digit"}),p=j=>String(j).padStart(2,"0"),d=`${a.getFullYear()}-${p(a.getMonth()+1)}-${p(a.getDate())}`;return t("checkout.priceGuaranteed",{date:me(d,o),time:n})},[s?.expiresAt,o,t]),Qt=[{key:"stay",label:t("checkout.stepStay","Your stay")},{key:"customize",label:t("conversion.optionalStep")},{key:"pay",label:t("checkout.stepPay","Payment")}],ye=Qt.findIndex(a=>a.key===N);if(b.isLoading&&!l)return e.jsxs("div",{className:"min-h-screen bg-white",children:[e.jsx("div",{className:"sticky top-0 bg-white/95 border-b border-pa-sand h-[60px]"}),e.jsxs("div",{className:"max-w-[1100px] mx-auto px-4 pt-8 lg:grid lg:grid-cols-[minmax(0,640px)_380px] lg:gap-12",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"skeleton-shimmer h-8 w-56 rounded"}),e.jsx("div",{className:"skeleton-shimmer h-[110px] w-full rounded-lg"}),e.jsx("div",{className:"skeleton-shimmer h-[72px] w-full rounded-lg"}),e.jsx("div",{className:"skeleton-shimmer h-[72px] w-full rounded-lg"}),e.jsx("div",{className:"skeleton-shimmer h-[170px] w-full rounded-lg"})]}),e.jsxs("div",{className:"hidden lg:block",children:[e.jsx("div",{className:"skeleton-shimmer w-full rounded-lg",style:{aspectRatio:"4/3"}}),e.jsx("div",{className:"skeleton-shimmer h-[140px] w-full rounded-lg mt-3"})]})]}),e.jsx("p",{className:"sr-only",children:t("checkout.loading","Preparing your checkoutâ¦")})]});if(b.isError&&!l)return e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-[420px] text-center space-y-4",children:[e.jsx("h1",{className:"headline-md text-pa-dark",children:t("checkout.loadErrorTitle","We couldn't load your checkout")}),e.jsx("p",{className:"body-sm",children:t("checkout.loadErrorBody","This looks like a connection problem, not a problem with your booking. Check your internet and try again.")}),e.jsx("button",{type:"button",onClick:()=>b.refetch(),className:"btn-primary inline-flex",children:t("bookingWidget.tryAgain","Try again")})]})});if(!s)return e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-[420px] text-center space-y-4",children:[e.jsx("h1",{className:"headline-md text-pa-dark",children:t("checkout.notFoundTitle","Checkout not found")}),e.jsx("p",{className:"body-sm",children:t("checkout.notFoundBody","This checkout link has expired or is invali
21d. Your dates are not lost â start again from the property page.")}),e.jsx(Re,{href:"/homes",className:"btn-primary inline-flex",children:t("booking.backToProperty","Back to the property")})]})});if(s.status==="paid")return e.jsx("div",{className:"min-h-screen bg-white flex items-center justify-center px-6",children:e.jsxs("div",{className:"max-w-[440px] text-center space-y-4",children:[e.jsx("div",{className:"mx-auto w-12 h-12 rounded-full bg-pa-dark flex items-center justify-center",children:e.jsx(ie,{className:"w-6 h-6 text-white"})}),e.jsx("h1",{className:"headline-md text-pa-dark",children:t("checkout.alreadyPaidTitle","This booking is already confirmed")}),e.jsxs("p",{className:"body-sm",children:[t("checkout.alreadyPaidBody","The payment for this stay was completed. Check your email for the confirmation, or view your booking below."),s.confirmationCode?` (${s.confirmationCode})`:""]}),s.reservationId?e.jsx(Re,{href:`/booking/thank-you/${s.reservationId}?method=card`,className:"btn-primary inline-flex",children:t("checkout.viewBooking","View my booking")}):e.jsx(Re,{href:$t,className:"btn-primary inline-flex",children:t("booking.backToProperty","Back to the property")})]})});const kt=P&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between body-sm text-inherit",children:[e.jsxs("span",{className:"text-pa-earth",children:[P.nights," ",t("bookingWidget.nightsLabel","nights")]}),e.jsx("span",{className:"text-pa-dark tabular-nums",children:V(P.totalNights,o)})]}),P.cleaningFee>0&&e.jsxs("div",{className:"flex justify-between body-sm text-inherit",children:[e.jsx("span",{className:"text-pa-earth",children:t("property.cleaningFee")}),e.jsx("span",{className:"text-pa-dark tabular-nums",children:V(P.cleaningFee,o)})]}),P.taxesAndFees>0&&e.jsxs("div",{className:"flex justify-between body-sm text-inherit",children:[e.jsx("span",{className:"text-pa-earth",children:t("bookingWidget.taxesAndFees","Taxes & fees")}),e.jsx("span",{className:"text-pa-dark tabular-nums",children:V(P.taxesAndFees,o)})]}),R&&(R.type==="self"||ue)&&e.jsxs("div",{className:"flex justify-between body-sm text-inherit checkout-row-in",children:[e.jsx("span",{className:"text-pa-earth",children:R.type==="hosted"?t("checkout.reception.hosted.name"):t("checkout.reception.self.name")}),e.jsx("span",{className:E("tabular-nums",ke>0?"text-pa-dark":"text-pa-gold"),children:ke>0?V(ke,o):t("checkout.included.badge")})]}),be.map(({item:a,sel:n,amount:p})=>e.jsxs("div",{className:"flex justify-between items-center gap-2 body-sm text-inherit checkout-row-in",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-pa-earth min-w-0",children:[e.jsx("button",{type:"button",onClick:()=>mt(a),"aria-label":`${t("checkout.remove","Remove")}: ${t(`checkout.extras.${a.sku}.name`)}`,className:"shrink-0 w-4 h-4 rounded-full flex items-center justify-center text-pa-stone-aa hover:text-pa-dark hover:bg-pa-sand transition-colors",children:e.jsx(it,{className:"w-3 h-3"})}),e.jsxs("span",{className:"truncate",children:[t(`checkout.extras.${a.sku}.name`),(()=>{const d=[];return n.people&&d.push(`${n.people}p`),n.days&&d.push(`${n.days}d`),n.qty&&n.qty>1&&d.push(`Ã${n.qty}`),n.sessions&&n.sessions>1&&d.push(`Ã${n.sessions}`),d.length?e.jsxs("span",{className:"text-pa-stone-aa",children:[" · ",d.join(" · ")]}):null})()]})]}),e.jsx("span",{className:E("tabular-nums shrink-0",p===0?"text-pa-gold eyebrow uppercase tracking-[0.08em]":"text-pa-dark"),children:p===0?t("checkout.included.badge"):V(p,o)})]},a.sku)),D&&H&&e.jsxs("div",{className:"flex justify-between items-center gap-2 body-sm text-inherit checkout-row-in",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-pa-gold font-medium min-w-0",children:[e.jsx("button",{type:"button",onClick:()=>{we(!1),I({flex:!1})},"aria-label":`${t("checkout.remove","Remove")}: ${t("checkout.flex.title","Flex")}`,className:"shrink-0 w-4 h-4 rounded-full flex items-center justify-center text-pa-stone-aa hover:text-pa-dark hover:bg-pa-sand transition-colors",children:e.jsx(it,{className:"w-3 h-3"})}),e.jsx("span",{className:"truncate",children:t("checkout.flex.title","Flex â guaranteed rebooking")})]}),ft?e.jsxs("span",{className:"tabular-nums shrink-0",children:[e.jsx("s",{className:"text-pa-stone-aa",children:V(et,o)})," ",e.jsx("span",{className:"text-pa-gold",children:t("checkout.flex.gifted","Offered")})]}):e.jsx("span",{className:"text-pa-dark tabular-nums shrink-0",children:V(et,o)})]}),e.jsxs("div",{className:"flex justify-between items-baseline border-t border-pa-sand pt-2.5",children:[e.jsx("span",{className:"body-sm font-medium text-pa-dark",children:t("checkout.todayTotal","Total today")}),e.jsx("span",{className:"text-[20px] font-light text-pa-dark tabular-nums",children:V(Ft,o)})]})]}),zt=!oa&&!v?.couponCode?null:e.jsx("div",{className:"border-t border-pa-sand pt-3",children:!v?.couponCode&&!na?e.jsx("button",{type:"button",onClick:()=>Ke(!0),className:"caption text-pa-stone-aa hover:text-pa-dark underline underline-offset-2 transition-colors",children:t("checkout.coupon.have","Have a promo code?")}):v?.couponCode?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-1.5 caption text-pa-dark bg-pa-warm border border-pa-sand rounded-full px-2.5 py-1",children:[e.jsx(Oa,{className:"w-3 h-3 text-pa-gold"})," ",v.couponCode]}),e.jsx("button",{type:"button",onClick:()=>ht(""),disabled:ut,"aria-label":t("checkout.remove","Remove"),className:"caption text-pa-stone-aa hover:text-pa-dark underline underline-offset-2 transition-colors",children:t("checkout.remove","Remove")})]}):e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{value:Ce,onChange:a=>{Pe(a.target.value.toUpperCase().replace(/[^A-Z0-9_-]/g,"")),_e(!1)},onKeyDown:a=>{a.key==="Enter"&&Ce.trim()&&ht(Ce.trim())},placeholder:t("checkout.coupon.field","Promo code"),maxLength:40,className:"flex-1 min-w-0 h-[38px] border border-pa-sand bg-white px-3 rounded-md body-sm tracking-[0.04em] text-pa-dark placeholder:text-pa-stone-aa focus:ring-1 focus:ring-pa-dark focus:border-pa-dark outline-none"}),e.jsx("button",{type:"button",onClick:()=>ht(Ce.trim()),disabled:ut||!Ce.trim()||!l&&!se,className:"pa-action shrink-0 h-[38px] px-4 roun
21ded-md border border-pa-sand eyebrow font-medium tracking-[0.08em] uppercase text-pa-earth hover:border-pa-dark hover:text-pa-dark transition-colors disabled:opacity-40",children:ut?e.jsx($e,{className:"w-3.5 h-3.5 animate-spin"}):t("checkout.coupon.apply","Apply")})]}),_t&&e.jsx("p",{className:"caption text-pa-earth",children:t("checkout.coupon.invalid","Code not recognized. Check it and try again.")}),St&&!_t&&e.jsx("p",{className:"caption text-pa-earth",role:"status",children:t("checkout.coupon.dropped",{code:St,defaultValue:"Code {{code}} no longer applies to these dates."})})]})}),Ut=xt.length>0&&e.jsxs("div",{className:"border-t border-pa-sand pt-3 space-y-1.5",children:[e.jsx("p",{className:"eyebrow tracking-[0.12em] uppercase text-pa-stone-aa",children:t("checkout.conciergeRequests","Concierge requests")}),xt.map(({item:a})=>e.jsxs("div",{className:"flex justify-between items-center gap-2 body-sm text-inherit",children:[e.jsxs("span",{className:"flex items-center gap-1.5 text-pa-earth min-w-0",children:[e.jsx("button",{type:"button",onClick:()=>mt(a),"aria-label":`${t("checkout.remove","Remove")}: ${t(`checkout.extras.${a.sku}.name`)}`,className:"shrink-0 w-4 h-4 rounded-full flex items-center justify-center text-pa-stone-aa hover:text-pa-dark hover:bg-pa-sand transition-colors",children:e.jsx(it,{className:"w-3 h-3"})}),e.jsx("span",{className:"truncate",children:t(`checkout.extras.${a.sku}.name`)})]}),e.jsx("span",{className:"text-pa-stone-aa shrink-0",children:t("checkout.onRequestShort","on request")})]},a.sku)),e.jsx("p",{className:"caption text-pa-stone-aa leading-snug pt-0.5",children:t("checkout.conciergeRequestsNote","Quoted individually by your concierge â not part of today's payment.")})]}),ba=e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg overflow-hidden shadow-[0_4px_24px_rgba(26,26,24,0.06)]",children:[Xe&&e.jsx("img",{src:Xe,alt:oe,className:"w-full aspect-[4/3] object-cover",width:800,height:600}),e.jsxs("div",{className:"p-5 space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-display body-lg text-pa-dark leading-snug",children:oe}),s.destination&&e.jsx("p",{className:"eyebrow tracking-[0.08em] uppercase text-pa-stone-aa mt-1",children:s.destination})]}),e.jsxs("div",{className:"body-sm text-pa-earth",children:[me(y,o,!0)," â ",me(L,o,!0)," · ",C," ",t("booking.guestsLabel","guests")]}),kt,e.jsx("p",{className:"caption text-pa-earth leading-relaxed",children:t("securityDeposit.notice")}),zt,Ut,(()=>{const a=P?.cancellationPolicy?.[0];if(!a)return null;const n=yt(a,y,t,o);return n===t("cancellationPolicy.shortGeneric")?null:e.jsx("p",{className:"caption text-pa-stone-aa leading-snug",children:n})})(),nt&&e.jsxs("p",{className:"flex items-start gap-1.5 caption text-pa-gold leading-snug",children:[e.jsx(Nt,{className:"w-3 h-3 shrink-0 mt-[1px]"})," ",nt]})]})]}),Ht=e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg p-5",children:[e.jsx("p",{className:"eyebrow font-medium tracking-[0.12em] uppercase text-pa-gold-aa mb-3",children:t("trust.directHeadline","Why book direct")}),e.jsx("ul",{className:"space-y-2.5",children:[{icon:Wa,label:t("trust.bestRateTeeth","Best rate online â find these dates cheaper on Airbnb or Booking.com and we match the price")},{icon:Ba,label:t("trust.noServiceFees","No service fees â OTAs add 12â18% at checkout; here the price is the price")},{icon:Qa,label:t("trust.conciergeWhatsapp","WhatsApp concierge before, during and after your stay")}].map((a,n)=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(a.icon,{className:"w-3.5 h-3.5 text-pa-gold-aa shrink-0 mt-0.5"}),e.jsx("span",{className:"caption text-pa-dark leading-snug",children:a.label})]},n))}),e.jsx(Re,{href:"/best-rate-guarantee",className:"inline-flex items-center mt-1 caption text-pa-gold-aa underline underline-offset-2 hover:text-pa-dark",children:t("trust.guaranteeTerms","How the guarantee works")})]}),Yt=(v?.ratePlanOptions?.length??0)>1&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"eyebrow font-medium tracking-[0.12em] uppercase text-pa-gold",children:t("bookingWidget.ratePlan","Rate plan")}),(()=>{const a=Math.max(...v.ratePlanOptions.map(n=>n.total));return v.ratePlanOptions.map(n=>{const p=U===n.ratePlanId,d=lt(n),j=t(d?"booking.nonRefundable":"booking.flexibleRate"),te=a-n.total,W=n.cancellationPolicy?.[0]?yt(n.cancellationPolicy[0],y,t,o):null;return e.jsxs("label",{className:E("flex items-center gap-3 p-4 bg-white border rounded-lg cursor-pointer transition-all",p?"border-pa-dark ring-1 ring-pa-dark":"border-pa-sand hover:border-pa-gold"),children:[e.jsx("input",{type:"radio",name:"checkoutRatePlan",checked:p,onChange:()=>{g(n.ratePlanId),I({ratePlanId:n.ratePlanId}),X({event:"rate_plan_selected",rate_plan:d?"non_refundable":"flexible",value:n.total,property_id:s.listingId})},className:"accent-black w-4 h-4 shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("p",{className:"body-sm text-pa-dark font-medium",children:j}),!d&&Ea(n,v.ratePlanOptions,y)&&e.jsx("span",{className:"eyebrow font-medium tracking-wider up
21percase px-1.5 py-0.5 bg-pa-warm text-pa-gold border border-pa-sand rounded-sm",children:t("bookingWidget.recommended","Recommended")})]}),e.jsx("p",{className:"caption mt-0.5 text-pa-earth",children:d?t("bookingWidget.nonRefundableWarning","No refund if you cancel or modify"):W})]}),e.jsxs("div",{className:"text-right shrink-0",children:[e.jsx("span",{className:"body-sm text-pa-dark font-medium tabular-nums",children:V(n.total,o)}),te>0&&e.jsxs("p",{className:"caption text-pa-gold font-medium mt-0.5",children:[t("bookingWidget.save","Save")," ",V(te,o)]})]})]},n.ratePlanId)})})()]});return e.jsxs("div",{className:"checkout-page min-h-screen bg-white pb-28 lg:pb-12",children:[e.jsx("style",{children:` 22 /* The global 44px touch-target rule inflates radios/checkboxes â scope them back */ 23 .checkout-page input[type="radio"], 24 .checkout-page input[type="checkbox"] { 25 min-height: 16px; min-width: 16px; height: 16px; width: 16px; 26 } 27 @keyframes checkoutStepIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } } 28 .checkout-step-in { animation: checkoutStepIn 220ms ease-out; } 29 @keyframes checkoutRowIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } } 30 .checkout-row-in { animation: checkoutRowIn 200ms ease-out; } 31 @media (prefers-reduced-motion: reduce) { 32 .checkout-step-in, .checkout-row-in { animation: none; } 33 } 34 `}),e.jsx("header",{className:"sticky top-0 z-40 bg-white/95 backdrop-blur border-b border-pa-sand",children:e.jsxs("div",{className:"max-w-[1100px] mx-auto px-4 h-[60px] flex items-center justify-between gap-4",children:[e.jsx(Re,{href:"/",className:"shrink-0","aria-label":"Portugal Active",children:e.jsx("img",{src:_a.logoColor,alt:"Portugal Active",className:"h-[26px] w-auto"})}),e.jsx("nav",{"aria-label":t("checkout.stepsAria","Checkout steps"),className:"flex items-center gap-2 sm:gap-3",children:Qt.map((a,n)=>e.jsxs("div",{className:"flex items-center gap-2 sm:gap-3",children:[n>0&&e.jsx("span",{className:"w-6 sm:w-10 h-px bg-pa-sand"}),e.jsxs("button",{type:"button",disabled:n>=ye,onClick:()=>{n<ye&&(M(a.key),window.scrollTo({top:0,behavior:"smooth"}))},className:E("flex items-center gap-1.5",n<ye&&"cursor-pointer"),children:[e.jsx("span",{className:E("w-5 h-5 rounded-full caption text-inherit flex items-center justify-center border",n<ye?"bg-pa-dark border-pa-dark text-white":n===ye?"border-pa-dark text-pa-dark":"border-pa-sand text-pa-stone-aa"),children:n<ye?e.jsx(ie,{className:"w-3 h-3"}):n+1}),e.jsx("span",{className:E("eyebrow text-inherit tracking-[0.06em] uppercase",n===ye?"inline text-pa-dark font-medium":"hidden sm:inline text-pa-stone-aa"),children:a.label})]})]},a.key))}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("span",{className:$?"caption text-pa-earth":"hidden md:inline caption text-pa-stone-aa",children:$?t("checkout.saveIssue","Reconnecting, changes pending"):t("checkout.autosaved","Saved automatically")}),e.jsx(Re,{href:$t,"aria-label":t("checkout.closeAria","Back to the property"),className:"w-9 h-9 rounded-full border border-pa-sand flex items-center justify-center text-pa-earth hover:border-pa-dark hover:text-pa-dark transition-colors",children:e.jsx(it,{className:"w-4 h-4"})})]})]})}),e.jsxs("main",{className:"max-w-[1100px] mx-auto px-4 pt-8 lg:grid lg:grid-cols-[minmax(0,640px)_380px] lg:gap-12 lg:items-start",children:[e.jsxs("section",{className:"space-y-6 checkout-step-in",children:[l&&e.jsx("p",{role:"status",className:"rounded-lg border border-pa-gold bg-pa-warm p-3 body-sm text-pa-dark",children:t("conversion.demoNotice")}),ne&&!ee&&e.jsxs("div",{className:"flex items-start justify-between gap-4 p-4 bg-pa-warm border border-pa-sand rounded-lg",children:[e.jsx("p",{className:"body-sm text-pa-earth leading-snug",children:t("checkout.quoteExpiredBanner","This price has expired. Refresh to see the current price for your dates â your details are kept.")}),e.jsx("button",{type:"button",onClick:()=>Je(y,L,C),disabled:J,className:"shrink-0 caption font-medium text-pa-dark underline underline-offset-2 disabled:opacity-40",children:J?e.jsx($e,{className:"w-4 h-4 animate-spin"}):t("checkout.refreshPrice","Refresh price")})]}),ee&&e.jsxs("div",{className:"p-4 bg-red-50/70 border border-red-200/60 rounded-lg space-y-2",role:"alert",children:[e.jsx("p",{className:"body-sm text-inherit text-red-700 leading-snug",children:t("checkout.datesUnavailable","These dates are no longer available. Please choose new dates below or contact our concierge.")}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{type:"button",onClick:()=>{M("stay"),S(!0),Ye(!1)},className:"caption text-inherit font-medium text-red-700 underline underline-offset-2",children:t("bookingWidget.changeDates","Change dates")}),e.jsx("a",{href:`https://wa.me/351927161771?text=${encodeURIComponent(`${oe} · ${y} â ${L} · ${C}p`)}`,target:"_blank",rel:"noopener noreferrer",onClick:()=>{l||X({event:"whatsapp_click",source:"checkout_unavailable",property_id:s?.listingId})},className:"caption text-inherit font-medium text-red-700 underline underline-offset-2",children:t("bookingWidget.contactConcierge","Contact Concierge")})]})]}),N==="stay"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("h1",{className:"headline-md text-pa-dark mb-1",children:t("checkout.stayTitle","Your stay")}),e.jsx("p",{className:"body-sm",children:t("checkout.staySubtitle","Confirm your dates and choose your rate.")})]}),e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-4 flex-1",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow tracking-[0.12em] uppercase text-pa-stone-aa mb-1",children:t("bookingWidget.checkInLabel")}),e.jsx("p",{className:"body-sm text-pa-dark",children:me(y,o,!0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow tracking-[0.12em] uppercase text-pa-stone-aa mb-1",children:t("bookingWidget.checkOutLabel")}),e.jsx("p",{className:"body-sm text-pa-dark",children:me(L,o,!0)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow tracking-[0.12em] uppercase text-pa-stone-aa mb-1",children:t("booking.guestsLabel")}),e.jsx("p",{className:"body-sm text-pa-dark",children:C})]})]}),e.jsxs("button",{type:"button",onClick:()=>S(a=>!a),className:"shrink-0 flex items-center gap-1.5 caption text-pa-gold hover:text-pa-dark transition-colors",children:[e.jsx(za,{className:"w-3.5 h-3.5"}),Me?t("checkout.doneEditing","Done"):t("checkout.edit","Edit")]})]}),Me&&e.jsxs("div",{className:"border-t border-pa-sand pt-4 space-y-4",children:[Et.isLoading?e.jsxs("div",{className:"flex items-center justify-center py-8 gap-2 caption text-pa-stone-aa",children:[e.jsx($e,{className:"w-4 h-4 animate-spin"})," ",t("bookingWidget.loadingCalendar","Loading availability...")]}):e.jsx(La,{days:ca,checkIn:y,checkOut:L,minNights:Se?.minNights,onSelectRange:({checkIn:a,checkOut:n})=>{a&&n&&(Je(a,n,C),S(!1))}}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"eyebrow tracking-[0.12em] uppercase text-pa-stone-aa",children:t("booking.guestsLabel")}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>{const a=Math.max(1,C-1);a!==C&&Je(y,L,a)},disabled:C<=1||J,className:"flex h-8 w-8 items-center justify-center rounded-full border border-pa-sand text-pa-earth hover:border-pa-dark hover:text-pa-dark disabled:opacity-25 transition-colors","aria-label":t("booking.decreaseGuests","Decrease guests"),children:e.jsx(Jt,{className:"w-3 h-3"})}),e.jsx("span",{className:"min-w-[2ch] text-center body-sm text-pa-dark tabular-nums",children:C}),e.jsx("button",{type:"button",onClick:()=>{const a=Se?.maxGuests||30,n=Math.min(a,C+1);n!==C&&Je(y,L,n)},disabled:J||C>=(Se?.maxGuests||30),className:"flex h-8 w-8 items-center justify-center rounded-full border border-pa-sand text-pa-earth hover:border-pa-dark hover:text-pa-dark disabled:opacity-25 transition-colors","aria-label":t("booking.increaseGuests","Increase guests"),children:e.jsx(ea,{className:"w-3 h-3"})})]}),J&&e.jsx($e,{className:"w-4 h-4 animate-spin text-pa-gold"})]})]})]}),P&&e.jsx("div",{className:"lg:hidden bg-white border border-pa-sand rounded-lg p-5",children:kt}),Yt,e.jsx("p",{className:"caption text-pa-earth",children:t("conversion.totalNote")}),e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg p-5 space-y-3",children:[e.jsx("h2",{className:"font-display text-[19px] text-pa-dark leading-snug",children:t("checkout.emailTitle","Where should we send your booking?")}),e.jsx("label",{htmlFor:"checkout-email",className:"block caption font-medium text-pa-earth",children:t("checkout.emailLabel","Your email")}),e.jsx("input",{id:"checkout-email",type:"email",autoComplete:"email","aria-label":t("bookingWidget.emailPh"),value:k,onChange:a=>_(a.target.value),onBlur:()=>Z(!0),placeholder:t("checkout.emailPh","[email protected]"),className:"w-full h-[48px] border border-pa-sand bg-white px-3 rounded-md body-sm text-pa-dark placeholder:text-pa-stone-aa focus:ring-1 focus:ring-pa-dark focus:border-pa-dark outline-none"}),G&&k.length>0&&!he(k)&&e.jsx("p",{className:"caption text-inherit text-red-500",children:t("bookingWidget.invalidEmail","Please enter a valid email address")}),e.jsx("p",{className:"caption text-pa-stone-aa leading-relaxed",children:t("checkout.emailSupport","We hold your reservation for 24 hours and email you the quote.")}),e.jsxs("label",{className:"flex items-start gap-2.5 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:ce,onChange:a=>ze(a.target.checked),className:"mt-[1px] h-[14px] w-[14px] shrink-0 accent-pa-dark cursor-pointer"}),e.jsx("span",{className:"caption text-pa-stone-aa leading-relaxed",children:t("checkout.newsletterOptIn","Keep me updated by email.")})]}),e.jsx("button",{type:"button",onClick:qt,disabled:!he(k)||ne||ee,className:"hidden lg:inline-flex btn-primary w-full disabled:opacity-40",children:t("booking.continue","Continue")}),!he(k)&&!ne&&!ee&&e.jsx("p",{className:"caption text-pa-stone-aa",role:"status",children:k?t("checkout.emailInvalidHint","That email doesn't look right â check it to continue."):t("checkout.emailNeededHint","Enter your email above to continue.")})]})]}),N==="customize"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{children:e.jsxs("button",{type:"button",onClick:()=>M("stay"),className:"caption text-pa-stone-aa hover:text-pa-dark transition-colors",children:["â ",t("checkout.backToStay","Back to your stay")]})}),e.jsxs("details",{className:"rounded-lg border border-pa-sand p-4",children:[e.jsx("summary",{className:"cursor-pointer body-sm text-pa-dark font-medium",children:t("conversion.reviewRate")}),e.jsx("div",{className:"pt-4",children:Yt})]}),re.isLoading?e.jsxs("div",{className:"flex items-center justify-center py-10 gap-2 c
34aption text-pa-stone-aa",children:[e.jsx($e,{className:"w-4 h-4 animate-spin"})," ",t("checkout.loading","Preparing your checkoutâ¦")]}):e.jsx(os,{catalog:De,included:ia,reception:ue,receptionChoice:R,selection:ge,nights:v?.nights??1,guests:C,propertyName:oe,lang:o,destination:s.destination??void 0,defaultAirport:re.data?.defaultAirport,onToggle:mt,onAdjust:da,onChooseReception:la,onSkip:bt,receptionNudge:sa}),H&&P&&e.jsx(is,{config:{...H,price:et},gifted:ft,selected:D,stayTotal:P.total,nonRefundableSelected:ua,freeCancelUntil:ha,lang:o,listingId:s.listingId,demo:l,onToggle:a=>{we(a),I({flex:a})}}),e.jsx("button",{type:"button",onClick:bt,className:"hidden lg:inline-flex btn-primary w-full",children:z.length>0?t("checkout.continueWithExtras",{count:z.length}):t("checkout.continueWithoutExtras","Continue without extras")})]}),N==="pay"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>M("customize"),className:"caption text-pa-stone-aa hover:text-pa-dark transition-colors",children:["â ",t("checkout.backToCustomize","Back to personalization")]}),e.jsx("h1",{className:"headline-md text-pa-dark mb-1",children:t("checkout.payTitle","Payment")}),e.jsx("p",{className:"body-sm",children:t("checkout.paySubtitle","Your details, then a secure payment.")})]}),(R||be.length>0||D)&&e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg px-5 py-4",children:[e.jsx("p",{className:"font-display body-lg text-pa-dark leading-snug mb-2",children:t("checkout.tailoredTitle","Your stay, tailored")}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[R&&e.jsxs("span",{className:"inline-flex items-center gap-1 caption text-pa-earth bg-pa-warm border border-pa-sand rounded-full px-2.5 py-1",children:[e.jsx(ie,{className:"w-3 h-3 text-pa-gold"}),R.type==="hosted"?t("checkout.reception.hosted.name"):t("checkout.reception.self.name")]}),be.map(({item:a})=>e.jsxs("span",{className:"inline-flex items-center gap-1 caption text-pa-earth bg-pa-warm border border-pa-sand rounded-full px-2.5 py-1",children:[e.jsx(ie,{className:"w-3 h-3 text-pa-gold"})," ",t(`checkout.extras.${a.sku}.name`)]},a.sku)),D&&H&&e.jsxs("span",{className:"inline-flex items-center gap-1 caption text-pa-dark bg-pa-warm border border-pa-gold rounded-full px-2.5 py-1",children:[e.jsx(ie,{className:"w-3 h-3 text-pa-gold"})," Flex"]}),xt.map(({item:a})=>e.jsxs("span",{className:"inline-flex items-center gap-1 caption text-pa-stone-aa border border-dashed border-pa-sand rounded-full px-2.5 py-1",children:[t(`checkout.extras.${a.sku}.name`)," · ",t("checkout.onRequestShort","on request")]},a.sku))]})]}),e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg p-5 space-y-3",children:[e.jsx("p",{className:"eyebrow font-medium tracking-[0.12em] uppercase text-pa-gold",children:t("bookingWidget.guestInformation","Guest information")}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx("input",{type:"text",autoComplete:"given-name","aria-label":t("bookingWidget.firstNamePh"),placeholder:t("bookingWidget.firstNamePh"),value:T,onChange:a=>ve(a.target.value),className:"w-full h-[48px] border border-pa-sand bg-white px-3 rounded-md body-sm text-pa-dark placeholder:text-pa-stone-aa focus:ring-1 focus:ring-pa-dark focus:border-pa-dark outline-none"}),e.jsx("input",{type:"text",autoComplete:"family-name","aria-label":t("bookingWidget.lastNamePh"),placeholder:t("bookingWidget.lastNamePh"),value:A,onChange:a=>Fe(a.target.value),className:"w-full h-[48px] border border-pa-sand bg-white px-3 rounded-md body-sm text-pa-dark placeholder:text-pa-stone-aa focus:ring-1 focus:ring-pa-dark focus:border-pa-dark outline-none"})]}),e.jsx("input",{type:"email",autoComplete:"email","aria-label":t("bookingWidget.emailPh"),placeholder:t("bookingWidget.emailPh"),value:k,onChange:a=>_(a.target.value),className:"w-full h-[48px] border border-pa-sand bg-white px-3 rounded-md body-sm text-pa-dark placeholder:text-pa-stone-aa focus:ring-1 focus:ring-pa-dark focus:border-pa-dark outline-none"}),e.jsx(Za,{value:F,onChange:Ue,onBlur:()=>wt(!0),placeholder:t("bookingWidget.phonePh","Phone number *")}),He&&F&&!Oe(F)&&e.jsx("p",{className:"caption text-inherit text-red-500",children:t("bookingWidget.invalidPhone","Please enter a valid phone number")}),e.jsx("input",{type:"text",inputMode:"numeric",maxLength:20,"aria-label":t("checkout.nifPh"),value:f,onChange:a=>O(a.target.value),placeholder:t("checkout.nifPh","NIF â optional, for a Portuguese invoice"),className:"w-full h-[48px] border border-pa-sand bg-white px-3 rounded-md body-sm text-pa-dark placeholder:text-pa-stone-aa focus:ring-1 focus:ring-pa-dark focus:border-pa-dark outline-none"}),e.jsxs("label",{className:"flex items-start gap-2 cursor-pointer select-none pt-1",children:[e.jsx("input",{type:"checkbox",checked:le,onChange:a=>fe(a.target.checked),className:"mt-0.5 w-4 h-4 accent-black border-pa-sand rounded"}),e.jsxs("span",{className:"caption text-pa-earth leading-snug",children:[t("bookingWidget.termsAcceptLabel","I accept the")," ",e.jsx("a",{href:`/${o}
34/legal/terms`,target:"_blank",rel:"noopener noreferrer",className:"text-pa-dark underline hover:text-pa-gold",children:t("bookingWidget.termsLink","Terms & Conditions")})," ",t("bookingWidget.termsAnd","and the")," ",e.jsx("a",{href:`/${o}/legal/cancellation-policy`,target:"_blank",rel:"noopener noreferrer",className:"text-pa-dark underline hover:text-pa-gold",children:t("bookingWidget.cancellationPolicyLink")})]})]})]}),e.jsxs("div",{className:"bg-white border border-pa-sand rounded-lg p-5 space-y-4",children:[ga?e.jsxs("div",{className:"flex items-center justify-center gap-3 py-8",role:"status",children:[e.jsx($e,{className:"w-5 h-5 animate-spin text-pa-gold"}),e.jsx("p",{className:"body-sm text-pa-dark",children:t("checkout.confirmingPayment","Payment received â confirming your bookingâ¦")})]}):l?e.jsx("p",{role:"status",className:"body-sm text-pa-earth",children:t("conversion.demoNotice")}):le&&T.trim()&&A.trim()&&he(k)&&Oe(F)&&se&&P&&!ne?e.jsx(Xa,{onBeforePay:ma,onQuoteExpired:()=>pe(!0),listingId:s.listingId,checkIn:y,checkOut:L,guests:C,quoteId:se,ratePlanId:P.ratePlanId??U??"",total:at,currency:"EUR",propertyName:s.propertyName||oe,destination:s.destination||void 0,guestName:`${T.trim()} ${A.trim()}`,guestEmail:k,guestPhone:F,notes:xa||void 0,intentId:s.id,couponCode:v?.couponCode||void 0,purchaseItems:st,paymentItems:[Sa({id:s.listingId,name:s.propertyName||oe,destination:s.destination||void 0,priceFrom:P.nightlyRate},{nights:v?.nights,checkinDate:y,checkoutDate:L,guests:C}),...st],onSuccess:Ot,onCancel:()=>M("customize")}):e.jsxs("div",{className:"space-y-3",children:[ne?e.jsx("p",{className:"caption text-pa-earth",children:t("checkout.refreshBeforePay","Refresh the price above before paying.")}):(()=>{const a=[];return(!T.trim()||!A.trim())&&a.push(t("checkout.missing.name","your first and last name")),he(k)||a.push(t("checkout.missing.email","a valid email")),Oe(F)||a.push(t("checkout.missing.phone","a valid phone number")),le||a.push(t("checkout.missing.terms","accepting the terms")),(!se||!P)&&a.push(t("checkout.missing.quote","a confirmed price (refresh above)")),a.length?e.jsxs("p",{className:"caption text-pa-earth",role:"status",children:[t("checkout.missing.prefix","To pay, we still need:")," ",a.join(" · ")]}):null})(),e.jsx("button",{disabled:!0,className:"btn-primary w-full opacity-40 cursor-not-allowed",children:t("bookingWidget.proceedToPayment","Proceed to Payment")})]}),P?.cancellationPolicy?.[0]&&e.jsx("p",{className:"caption text-pa-stone-aa text-center leading-snug",children:yt(P.cancellationPolicy[0],y,t,o)}),e.jsxs("p",{className:"flex items-center justify-center gap-1.5 caption text-pa-stone-aa",children:[e.jsx(Ua,{className:"w-3 h-3"})," ",t("checkout.secureNote","Encrypted, secure payment")]})]})]})]},N),e.jsx("div",{className:"lg:hidden mt-8",children:Ht}),e.jsxs("aside",{className:"hidden lg:block sticky top-[84px] space-y-4",children:[ba,Ht]})]}),e.jsx("div",{"aria-hidden":!0,style:{height:"var(--cookie-banner-h, 0px)"}}),e.jsxs("div",{className:"lg:hidden fixed inset-x-0 z-40",style:{bottom:"var(--cookie-banner-h, 0px)"},children:[dt&&e.jsxs("div",{className:"max-h-[60vh] overflow-y-auto bg-white border-t border-pa-sand px-5 pt-4 pb-3 shadow-[0_-8px_32px_rgba(26,26,24,0.10)] space-y-4 checkout-step-in",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[Xe&&e.jsx("img",{src:Xe,alt:"",className:"w-14 h-14 rounded-md object-cover shrink-0",width:56,height:56}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-display body-sm text-pa-dark leading-snug truncate",children:oe}),e.jsxs("p",{className:"caption text-pa-earth mt-0.5",children:[me(y,o)," â ",me(L,o)," · ",C," ",t("booking.guestsLabel","guests")]})]})]}),kt,zt,Ut,nt&&e.jsxs("p",{className:"flex items-start gap-1.5 caption text-pa-gold leading-snug",children:[e.jsx(Nt,{className:"w-3 h-3 shrink-0 mt-[1px]"})," ",nt]})]}),e.jsxs("div",{className:"bg-white border-t border-pa-sand px-4 py-3 flex items-center justify-between gap-3",style:{paddingBottom:"calc(0.75rem + env(safe-area-inset-bottom, 0px))"},children:[e.jsx("button",{type:"button",onClick:()=>aa(a=>!a),className:"flex items-center gap-1.5 text-left","aria-expanded":dt,children:e.jsxs("div",{children:[e.jsx("p",{className:"body-lg font-medium text-pa-dark tabular-nums leading-tight",children:P?V(Ft,o):"â"}),e.jsxs("p",{className:"caption text-pa-stone-aa flex items-center gap-1",children:[t("checkout.viewDetails","View details"),dt?e.jsx(Ha,{className:"w-3 h-3"}):e.jsx(Ya,{className:"w-3 h-3"})]})]})}),N==="stay"&&e.jsx("button",{type:"button",onClick:qt,disabled:!he(k)||ne||ee,className:"btn-primary flex-1 max-w-[220px] disabled:opacity-40",children:t("booking.continue","Continue")}),N==="customize"&&e.jsx("button",{type:"button",onClick:bt,className:"btn-primary flex-1 max-w-[220px]",children:t("booking.continue","Continue")})]})]})]})}export{Rs as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.