1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3890],{43890:(e,t,a)=>{a.r(t),a.d(t,{CheckoutPage:()=>J});var r,s=a(95155),l=a(12115),o=a(66766),c=a(9446),n=a(20003),i=a(82712),d=a(74191),u=a(46279),m=a(92716),x=a(93203),h=a(31530),p=a(31545),b="clover",f="https://js.stripe.com",y="".concat(f,"/").concat(b,"/stripe.js"),g=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,j=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,v=function(){for(var e=document.querySelectorAll('script[src^="'.concat(f,'"]')),t=0;t<e.length;t++){var a,r=e[t];if(a=r.src,g.test(a)||j.test(a))return r}return null},N=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",a=document.createElement("script");a.src="".concat(y).concat(t);var r=document.head||document.body;if(!r)throw Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(a),a},D=function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"8.2.0",startTime:t})},k=null,C=null,w=null,T=function(e,t,a){if(null===e)return null;var r,s=t[0].match(/^pk_test/),l=3===(r=e.version)?"v3":r;s&&l!==b&&console.warn("Stripe.js@".concat(l," was loaded on the page, but @stripe/stripe-js@").concat("8.2.0"," expected Stripe.js@").concat(b,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var o=e.apply(void 0,t);return D(o,a),o},$=!1,P=function(){return r?r:r=(null!==k?k:(k=new Promise(function(e,t){if("undefined"==typeof window||"undefined"==typeof document){e(null);return}if(window.Stripe,window.Stripe){e(window.Stripe);return}try{var a,r=v();r?r&&null!==w&&null!==C&&(r.removeEventListener("load",w),r.removeEventListener("error",C),null===(a=r.parentNode)||void 0===a||a.removeChild(r),r=N(null)):r=N(null),w=function(){window.Stripe?e(window.Stripe):t(Error("Stripe.js not available"))},C=function(e){t(Error("Failed to load Stripe.js",{cause:e}))},r.addEventListener("load",w),r.addEventListener("error",C)}catch(e){t(e);return}})).catch(function(e){return k=null,Promise.reject(e)})).catch(function(e){return r=null,Promise.reject(e)})};Promise.resolve().then(function(){return P()}).catch(function(e){$||console.warn(e)});var S=a(71489);function E(e,t){return Math.round(Math.max(0,Math.round(100*e)-Math.round(100*t))/100*100)/100}function I(e){let t=(0,l.useCallback)(()=>{let t=Number(e);return Number.isFinite(t)&&t>0&&t<=100?t:100},[e]),a=(0,l.useCallback)(e=>{let a=t();return Math.round(100*(Math.round(Math.round(100*e)*a/100)/100))/100},[t]),r=(0,l.useCallback)((e,t)=>E(e,t),[]);return(0,l.useMemo)(()=>({getPercentage:t,calculateAmount:a,calculateRemaining:r}),[t,a,r])}function F(e,t){return!(e<0)&&!(e>100)&&!(t<0)&&e>0&&t>0}var L=a(24783),A=a(6892),B=a(73167);let O=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];$=!0;var r=Date.now();return P().then(function(e){return T(e,t,r)})}(a(87358).env.NEXT_PUBLIC_CUSTOMER_STRIPE_PUBLISHABLE_KEY||"");function _(e){return e?Array.isArray(e)?e.map(e=>(0,x.k)(e)).filter(Boolean).join(" ")||"":(0,x.k)(e)||"":""}function q(e){return[{type:"text",label:{type:"root",children:[{type:"p",children:[{type:"text",text:e("checkoutFieldName")}]}]},placeholder:e("checkoutFieldNamePlaceholder"),inputName:"nombre",required:!0,widthFull:!1},{type:"text",label:{type:"root",children:[{type:"p",children:[{type:"text",text:e("checkoutFieldSurname")}]}]},placeholder:e("checkoutFieldSurnamePlaceholder"),inputName:"apellidos",required:!0,widthFull:!1},{type:"tel",label:{type:"root",children:[{type:"p",children:[{type:"text",text:e("checkoutFieldPhone")}]}]},placeholder:e("checkoutFieldPhonePlaceholder"),inputName:"telefono",required:!0,widthFull:!1},{type:"text",label:{type:"root",children:[{type:"p",children:[{type:"text",text:e("checkoutFieldDni")}]}]},placeholder:e("checkoutFieldDniPlaceholder"),inputName:"dni",required:!1,widthFull:!1},{type:"email",label:{type:"root",children:[{type:"p",children:[{type:"text",text:e("checkoutFieldEmail")}]}]},placeholder:e("checkoutFieldEmailPlaceholder"),inputName:"email",required:!0,widthFull:!0},{type:"textarea",label:{type:"root",children:[{type:"p",children:[{type:"text",text:e("checkoutFieldAdditionalInfo")}]}]},placeholder:e("checkoutFieldAdditionalInfoPlaceholder"),inputName:"informacionAdicional",required:!1,widthFull:!0}]}function R(e,t,a){if(!t||!a)return e.price;let r=(0,A.i1)(t,a),s=e.priceType??"per-reservation";return"per-reservation"===s?e.price:"per-day"===s?e.price*r:e.price}function H(e){let{extra:t,index:a,isSelected:r,onToggle:l,currencySymbol:o,effectivePrice:c,blockColor:n,theme:i,isPerDayByDays:d,unitPrice:u,numDaysInRange:m,onSelectedDaysChange:x,daysLabel:h,isObligatory:p=!1,obligatoryLabel:b}=e;return(0,s.jsxs)("div",{className:`flex flex-wrap items-center justify-between gap-2 p-4 rounded-lg transition-colors border-2 ${r?`${i.colorClasses.input[n]} border-current opacity-100`:`${i.colorClasses.input[n]} border-transparent hover:opacity-90`} ${p?"opacity-90":""}`,children:[(0,s.jsxs)("div",{className:"flex items-center flex-1 min-w-0",children:[(0,s.jsxs)("label",{className:`relative inline-flex items-center flex-shrink-0 ${p?"cursor-default":"cursor-pointer"}`,children:[(0,s.jsx)("input",{type:"checkbox",checked:r,onChange:p?void 0:l,disabled:p,className:"sr-only peer"}),(0,s.jsx)("span",{className:`w-5 h-5 mr-3 border-2 rounded flex items-center justify-center ${i.colorClasses.sectionText[n]}`,children:r&&(0,s.jsx)("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"})})})]}),(0,s.jsxs)("span",{className:`font-medium ${i.colorClasses.sectionText[n]}`,children:[t.label,p&&b&&(0,s.jsxs)("span",{className:"ml-1 text-xs opacity-75",children:["(",b,")"]})]})]}),(0,s.jsx)("div",{className:"flex items-center gap-2 flex-shrink-0",onClick:e=>p&&e.stopPropagation(),children:d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:`text-sm ${i.colorClasses.sectionText[n]}`,children:[o,u.toFixed(2)," \xd7 ",m," ",h]}),(0,s.jsxs)("span",{className:`font-bold ${i.colorClasses.sectionText[n]}`,children:[o,c.toFixed(2)]})]}):(0,s.jsxs)("span",{className:`font-bold ${i.colorClasses.sectionText[n]}`,children:[o,c.toFixed(2)]})})]})}function z(e){let{data:t,globalData:a,reservationData:r,selectedExtras:x,onExtrasChange:b,extraSelectedDays:f={},onExtraSelectedDaysChange:y,formData:g,onFormDataChange:j,locale:v}
1=e,N=(0,i.D)(),{t:D}=(0,d.J)(),k=(0,p.t2)(),C=(0,p.HH)(),w=t?.checkoutPage,T=w?.additionalFields||[],$=[...q(D),...T],P=e=>{try{let t=D(e);return t&&t!==e?t:e}catch{return e}},[F,O]=(0,l.useState)(new Set),z=x??F,M=b?e=>{b("function"==typeof e?e(z):e)}:O,[J,W]=(0,l.useState)(()=>{let e={};return $.forEach(t=>{e[t.inputName||_(t.label).toLowerCase().replace(/\s+/g,"")]=""}),e}),U=g??J,V=j?e=>{j("function"==typeof e?e(U):e)}:W,[G,Q]=(0,l.useState)({}),[K,X]=(0,l.useState)(!1),Y=!!(r.startDate&&r.endDate),Z=Y?(0,A.i1)(r.startDate,r.endDate):1,ee=(0,u.o)(a?.reservationPageConfig?.color||"blue"),et=(0,L.Q)(a?.reservationPageConfig?.currency||"EUR"),ea=e=>{M(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},er=()=>{if(!r)return 0;let e=r.basePrice;return z.forEach(t=>{let a=r.extras[t];a&&(e+=R(a,r.startDate,r.endDate))}),e},{getPercentage:es,calculateAmount:el}=I(t?.checkoutPage?.depositPercentage),eo=(e,t)=>{V({...U,[e]:t}),G[e]&&Q(t=>{let a={...t};return delete a[e],a})},ec=()=>{let e={};return $.forEach(t=>{let a=t.inputName||_(t.label).toLowerCase().replace(/\s+/g,""),r=U[a]||"";t.required&&!r.trim()?e[a]=P("checkoutFieldRequired"):"email"===t.type&&r&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)?e[a]=P("checkoutInvalidEmail"):"tel"===t.type&&r&&!/^[+]?[\d\s\-()]+$/.test(r)&&(e[a]=P("checkoutInvalidPhone"))}),Q(e),0===Object.keys(e).length},en=async e=>{if(e?.preventDefault(),ec()){if(!k||!C){h.Ay.error(P("paymentSystemNotReady"));return}X(!0);try{let{error:e}=await C.submit();if(e){h.Ay.error(e.message||P("paymentValidationError")),X(!1);return}let a=Array.from(z).reduce((e,t)=>{let a=r.extras[t];return e+(a?R(a,r.startDate,r.endDate):0)},0),s=r.basePrice+a,l=el(s),o=!!(r.startDate&&r.endDate),c=await fetch("/api/reservations/stripe-checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({totalPrice:l,reservationData:{boatTitle:r.boatTitle,...o?{startDate:r.startDate,endDate:r.endDate}:{date:r.date,turnId:r.turnId},calendarId:r.calendarId}})});if(!c.ok){h.Ay.error(P("createPaymentError")),X(!1);return}let{clientSecret:n}=await c.json(),i=t.checkoutPage?.callbackUrl||"/home",d=i.startsWith("/")&&v?(0,B.Ak)(i,v):i,u=d.startsWith("/")?`${window.location.origin}${d}`:d,{error:m,paymentIntent:x}=await k.confirmPayment({elements:C,clientSecret:n,confirmParams:{return_url:u},redirect:"if_required"});if(m){h.Ay.error(m.message||P("paymentError")),X(!1);return}if(x?.status!=="requires_capture"){h.Ay.error(P("paymentNotAuthorized")),X(!1);return}let p={};$.forEach(e=>{let t=e.inputName||_(e.label).toLowerCase().replace(/\s+/g,""),a=U[t]||"";""!==a.trim()&&(p[t]={value:a,label:_(e.label),type:e.type,inputName:e.inputName})});let b=!!(r.startDate&&r.endDate),f=r.extras.map(e=>{let t=R(e,r.startDate,r.endDate),a={label:e.label,price:t};return b&&"per-day"===e.priceType&&(a.selectedDays=Z),a}),y={calendarId:r.calendarId,boatTitle:r.boatTitle,...b?{startDate:r.startDate,endDate:r.endDate,...r.reservationPageRelativePath?{reservationPageRelativePath:r.reservationPageRelativePath}:{}}:{date:r.date,turnId:r.turnId},basePrice:r.basePrice,selectedExtrasIds:Array.from(z),extrasData:f,formData:p,totalPrice:s,depositPercentage:es(),depositAmount:l,paymentIntentId:x.id},g=await fetch("/api/reservations/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y)}),j=await g.json();if(!g.ok){if("SLOT_NO_LONGER_AVAILABLE"===j.error){h.Ay.error(P("timeSlotNotAvailable")),sessionStorage.removeItem("reservationCheckoutData"),window.location.href="/reservas";return}if("INVALID_BOAT"===j.error){h.Ay.error(P("boatNotExists")),sessionStorage.removeItem("reservationCheckoutData"),window.history.back();return}throw Error(j.message||"Error al crear la reserva")}sessionStorage.removeItem("reservationCheckoutData");let N=t.checkoutPage?.callbackUrl||"/home",D=N.startsWith("/")&&v?(0,B.Ak)(N,v):N,w=(D.startsWith("/"),`${D}?payment_intent=${x.id}`);window.location.href=w}catch(e){(0,S.y)("Error submitting reservation with payment",{error:e}),h.Ay.error(P("checkoutError"))}finally{X(!1)}}};return(0,s.jsx)(n.w,{blockIsFirst:!0,imagesHavePriority:!1,blockStyle:{color:ee},children:(0,s.jsxs)(c.m,{verticalSpacing:"large",blockStyle:{color:ee},children:[(0,s.jsx)("h1",{className:"text-4xl font-bold mb-8",children:P("checkoutPageTitle")}),(0,s.jsx)("div",{className:`text-lg mb-8 ${N.colorClasses.sectionText[ee]}`,children:(0,s.jsx)("p",{children:P("checkoutPageDescription")})}),(0,s.jsx)("form",{onSubmit:en,children:(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-5 ga
1p-8",children:[(0,s.jsxs)("div",{className:"sm:col-span-3",children:[(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${N.colorClasses.cardBackground[ee]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-6 ${N.colorClasses.sectionText[ee]}`,children:P("checkoutPersonalInfo")}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:$.map(e=>{let a=e.inputName||_(e.label).toLowerCase().replace(/\s+/g,""),r=(e.type||"").trim().toLowerCase(),l=e.widthFull||"textarea"===r,o=_(e.label);return(0,s.jsxs)("div",{className:l?"md:col-span-2":"",children:[(0,s.jsxs)("label",{htmlFor:a,className:`block text-sm font-medium mb-2 ${N.colorClasses.sectionText[ee]}`,"data-tina-field":(0,m.HH)(t,"checkoutPage"),children:[o," ",e.required&&"*"]}),"textarea"===r?(0,s.jsx)("textarea",{id:a,value:U[a]||"",onChange:e=>eo(a,e.target.value),placeholder:e.placeholder,className:`w-full px-4 py-2 rounded border ${G[a]?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-current placeholder-opacity-75`,rows:3}):"checkbox"===r?(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("input",{type:"checkbox",id:a,checked:"true"===U[a],onChange:e=>eo(a,e.target.checked?"true":"false"),className:"w-4 h-4 mr-2"}),(0,s.jsx)("label",{htmlFor:a,className:"text-sm",children:e.placeholder||o})]}):"dropdown"===r?(0,s.jsxs)("select",{id:a,required:e.required,value:U[a]||"",onChange:e=>eo(a,e.target.value),className:`w-full px-4 py-2 rounded border ${G[a]?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 relative z-10 ${U[a]?N.colorClasses.sectionText[ee]:`${N.colorClasses.sectionText[ee]} opacity-75`}`,children:[(0,s.jsx)("option",{value:"",disabled:!0,hidden:!0,children:e.placeholder||"Seleccione una opci\xf3n"}),(e.options??[]).filter(e=>!!e?.optionLabel).map(e=>(0,s.jsx)("option",{value:e.optionLabel,children:e.optionLabel},e.optionLabel))]}):(0,s.jsx)("input",{type:e.type||"text",id:a,value:U[a]||"",onChange:e=>eo(a,e.target.value),placeholder:e.placeholder,className:`w-full px-4 py-2 rounded border ${G[a]?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-current placeholder-opacity-75`}),G[a]&&(0,s.jsx)("p",{className:"text-red-500 text-sm mt-1",children:G[a]})]},a)})})]}),r.extras&&r.extras.length>0?(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${N.colorClasses.cardBackground[ee]}`,children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-4",children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold ${N.colorClasses.sectionText[ee]}`,children:P("checkoutExtrasTitle")}),r.startDate&&r.endDate&&(0,s.jsx)("span",{className:`text-sm ${N.colorClasses.sectionText[ee]} opacity-90`,children:P("checkoutExtrasTotalByDaysNote")||"Total for selected date range"})]}),(0,s.jsx)("div",{className:"space-y-3",children:r.extras.map((e,t)=>(0,s.jsx)(H,{extra:e,index:t,isSelected:z.has(t),onToggle:()=>ea(t),currencySymbol:et,effectivePrice:R(e,r.startDate,r.endDate),blockColor:ee,theme:N,isPerDayByDays:Y&&"per-day"===e.priceType,unitPrice:e.price,numDaysInRange:Z,onSelectedDaysChange:e=>y?.(e),daysLabel:P("checkoutExtraDaysLabel")||"d\xedas",isObligatory:!0===e.obligatory,obligatoryLabel:P("checkoutObligatoryExtra")||"Included"},`${e.label}-${t}`))})]}):(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${N.colorClasses.cardBackground[ee]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-4 ${N.colorClasses.sectionText[ee]}`,"data-tina-field":(0,m.HH)(t,"checkoutPage"),children:((e,t,a)=>{if(e)return e;try{let e=D(t);return e&&e!==t?e:a}catch{return a}})(w?.extrasSectionTitle,"checkoutExtrasTitle","Extras")}),(0,s.jsx)("div",{className:"text-center py-8",children:(0,s.jsx)("div",{className:"text-gray-500 text-lg",children:"No hay extras disponibles"})})]})]}),(0,s.jsx)("div",{className:"sm:col-span-2",children:(0,s.jsxs)("div",{className:`p-6 rounded-lg border-2 border-current sm:sticky sm:top-4 ${N.colorClasses.cardBackground[ee]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-6 ${N.colorClasses.sectionText[ee]}
1`,children:P("checkoutReservationSummary")}),(0,s.jsx)("div",{className:"mb-4 rounded-lg overflow-hidden",children:r.boatImage?(0,s.jsx)("div",{className:"relative w-full h-48",children:(0,s.jsx)(o.default,{src:r.boatImage,alt:r.boatTitle,fill:!0,className:"object-cover",sizes:"(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"})}):(0,s.jsx)("div",{className:"w-full h-48 bg-gray-200 flex items-center justify-center border-2 border-dashed border-gray-300",children:(0,s.jsxs)("div",{className:"text-center text-gray-500",children:[(0,s.jsx)("div",{className:"text-4xl mb-2",children:"\uD83D\uDDBCï¸"}),(0,s.jsx)("div",{className:"text-sm font-medium",children:"Imagen"})]})})}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${N.colorClasses.sectionText[ee]} opacity-75`,children:P("checkoutBoatTitle")}),(0,s.jsx)("p",{className:`text-lg font-semibold ${N.colorClasses.sectionText[ee]}`,children:r.boatTitle})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${N.colorClasses.sectionText[ee]} opacity-75`,children:P("reservationDate")}),(0,s.jsx)("p",{className:`text-base ${N.colorClasses.sectionText[ee]}`,children:r.startDate&&r.endDate?`${new Date(r.startDate).toLocaleDateString()} â ${new Date(r.endDate).toLocaleDateString()}`:r.date?new Date(r.date).toLocaleDateString():(()=>{try{let e=D("noData");return e&&"noData"!==e?e:"No data"}catch{return"No data"}})()})]}),!(r.startDate&&r.endDate)&&(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${N.colorClasses.sectionText[ee]} opacity-75`,children:P("reservationTurn")}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:`text-base ${N.colorClasses.sectionText[ee]}`,children:r.turnLabel}),(0,s.jsx)("p",{className:`text-sm ${N.colorClasses.sectionText[ee]} opacity-75`,children:r.turnTime})]})]}),(()=>{let e=(r.extras??[]).map((e,t)=>e.obligatory?t:-1).filter(e=>e>=0),t=Array.from(z).filter(e=>!r.extras?.[e]?.obligatory),a=t.reduce((e,t)=>e+(r.extras?.[t]?R(r.extras[t],r.startDate,r.endDate):0),0);return(0,s.jsxs)("div",{className:"border-t border-current pt-4 mb-4 space-y-2",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-sm ${N.colorClasses.sectionText[ee]}`,children:P("checkoutBasePrice")}),(0,s.jsx)("span",{className:`text-sm font-medium ${N.colorClasses.sectionText[ee]}`,children:`${et}${r.basePrice.toFixed(2)}`})]}),e.map(e=>{let t=r.extras?.[e];if(!t)return null;let a=R(t,r.startDate,r.endDate);return(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-sm ${N.colorClasses.sectionText[ee]}`,children:t.label}),(0,s.jsxs)("span",{className:`text-sm font-medium ${N.colorClasses.sectionText[ee]}`,children:[et,a.toFixed(2)]})]},`obligatory-${e}`)}),t.length>0&&(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("span",{className:`text-sm ${N.colorClasses.sectionText[ee]}`,children:[P("checkoutExtrasTotal")," (",t.length,")"]}),(0,s.jsxs)("span",{className:`text-sm font-medium ${N.colorClasses.sectionText[ee]}`,children:[et,a.toFixed(2)]})]})]})})(),(0,s.jsxs)("div",{className:"border-t-2 border-current pt-4 mb-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-xl font-bold ${N.colorClasses.sectionText[ee]}`,children:P("checkoutTotal")}),(0,s.jsx)("span",{className:`text-xl font-bold ${N.colorClasses.sectionText[ee]}`,children:`${et}${er().toFixed(2)}`})]}),100>es()&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex justify-between items-center mt-3 pt-3 border-t border-current",children:[(0,s.jsxs)("span",{className:`text-base font-semibold ${N.colorClasses.sectionText[ee]}`,children:[P("checkoutPayNow")," (",es(),"%)"]}),(0,s.jsxs)("span",{className:`text-base font-bold ${N.colorClasses.sectionText[ee]}`,children:[et,el(er()).toFixed(2)]})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,s.jsx)("span",{className:`text-base ${N.colorClasses.sectionText[ee]} opacity-75`,children:P("checkoutRemaining")}),(0,s.jsxs)("span",{className:`text-base ${N.colorClasses.sectionText[ee]} opacity-75`,children:[et,E(er(),el(er())).toFixed(2)]})]})]})]}),(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${N.colorClasses.cardBackgroun
1d[ee]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-4 ${N.colorClasses.sectionText[ee]}`,children:P("paymentInfoTitle")}),(0,s.jsx)(p.He,{})]}),(0,s.jsx)("button",{type:"button",onClick:en,disabled:K||!k||!C,className:`w-full py-4 px-6 rounded-lg font-bold text-lg transition-all ${!K&&k&&C?"hover:opacity-90":"opacity-50 cursor-not-allowed"} ${N.colorClasses.button[ee]}`,children:K?P("checkoutProcessing"):P("checkoutCompleteButton")})]})})]})}),!1]})})}function M(e){let{data:t,globalData:a,reservationData:r,selectedExtras:x,onExtrasChange:p,extraSelectedDays:b={},onExtraSelectedDaysChange:f,onPaymentIntentNeeded:y,formData:g,onFormDataChange:j,locale:v}=e,N=(0,i.D)(),{t:D}=(0,d.J)(),k=t?.checkoutPage,C=k?.additionalFields||[],w=[...q(D),...C],T=e=>{try{let t=D(e);return t&&t!==e?t:e}catch{return e}},[$,P]=(0,l.useState)(new Set),E=x??$,O=p?e=>{p("function"==typeof e?e(E):e)}:P,[z,M]=(0,l.useState)(()=>{let e={};return w.forEach(t=>{e[t.inputName||_(t.label).toLowerCase().replace(/\s+/g,"")]=""}),e}),J=g??z,W=j?e=>{j("function"==typeof e?e(J):e)}:M,[U,V]=(0,l.useState)({}),[G,Q]=(0,l.useState)(!1),K=!!(r.startDate&&r.endDate),X=K?(0,A.i1)(r.startDate,r.endDate):1,Y=(0,u.o)(a?.reservationPageConfig?.color||"blue"),Z=(0,L.Q)(a?.reservationPageConfig?.currency||"EUR"),ee=e=>{O(t=>{let a=new Set(t);a.has(e)?a.delete(e):a.add(e),p&&p(a);let s=r.basePrice;a.forEach(e=>{let t=r.extras[e];t&&(s+=R(t,r.startDate,r.endDate))});let l=ea();return s>0&&F(l,s)&&y&&y(s),a})},et=()=>{if(!r)return 0;let e=r.basePrice;return E.forEach(t=>{let a=r.extras[t];a&&(e+=R(a,r.startDate,r.endDate))}),e},{getPercentage:ea}=I(t?.checkoutPage?.depositPercentage),er=(e,t)=>{W(a=>({...a,[e]:t})),U[e]&&V(t=>{let a={...t};return delete a[e],a})},es=()=>{let e={};return w.forEach(t=>{let a=t.inputName||_(t.label).toLowerCase().replace(/\s+/g,""),r=J[a]||"";t.required&&!r.trim()?e[a]=T("checkoutFieldRequired"):"email"===t.type&&r&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r)?e[a]=T("checkoutInvalidEmail"):"tel"===t.type&&r&&!/^[+]?[\d\s\-()]+$/.test(r)&&(e[a]=T("checkoutInvalidPhone"))}),V(e),0===Object.keys(e).length},el=async e=>{if(e?.preventDefault(),es()){Q(!0);try{let e=Array.from(E).reduce((e,t)=>{let a=r.extras[t];return e+(a?R(a,r.startDate,r.endDate):0)},0),a=r.basePrice+e,s={};w.forEach(e=>{let t=e.inputName||_(e.label).toLowerCase().replace(/\s+/g,""),a=J[t]||"";""!==a.trim()&&(s[t]={value:a,label:_(e.label),type:e.type,inputName:e.inputName})});let l=r.extras.map(e=>{let t=R(e,r.startDate,r.endDate),a={label:e.label,price:t};return K&&"per-day"===e.priceType&&(a.selectedDays=X),a}),o={calendarId:r.calendarId,boatTitle:r.boatTitle,...K?{startDate:r.startDate,endDate:r.endDate,...r.reservationPageRelativePath?{reservationPageRelativePath:r.reservationPageRelativePath}:{}}:{date:r.date,turnId:r.turnId},basePrice:r.basePrice,selectedExtrasIds:Array.from(E),extrasData:l,formData:s,totalPrice:a,depositPercentage:ea(),depositAmount:0},c=await fetch("/api/reservations/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),n=await c.json();if(!c.ok){if("SLOT_NO_LONGER_AVAILABLE"===n.error){h.Ay.error(T("timeSlotNotAvailable")),sessionStorage.removeItem("reservationCheckoutData"),window.location.href="/reservas";return}if("INVALID_BOAT"===n.error){h.Ay.error(T("boatNotExists")),sessionStorage.removeItem("reservationCheckoutData"),window.history.back();return}throw Error(n.message||"Error al crear la reserva")}sessionStorage.removeItem("reservationCheckoutData");let i=t.checkoutPage?.callbackUrl||"/home",d=i.startsWith("/")&&v?(0,B.Ak)(i,v):i,u=d.startsWith("/")?`${window.location.origin}${d}`:d;window.location.href=u}catch(e){(0,S.y)("Error submitting reservation without payment",{error:e}),h.Ay.error(T("checkoutError"))}finally{Q(!1)}}},eo=et()>0;return(0,s.jsx)(n.w,{blockIsFirst:!0,imagesHavePriority:!1,blockStyle:{color:Y},children:(0,s.jsxs)(c.m,{verticalSpacing:"large",blockStyle:{color:Y},children:[(0,s.jsx)("h1",{className:"text-4xl font-bold mb-8",children:T("checkoutPageTitle")}),(0,s.jsx)("div",{className:`text-lg mb-8 ${N.colorClasses.sectionText[Y]}`,children:(0,s.jsx)("p",{children:T("checkoutPageDescription")})}),(0,s.jsx)("form",{onSubmit:el,children:(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-5 ga
1p-8",children:[(0,s.jsxs)("div",{className:"sm:col-span-3",children:[(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${N.colorClasses.cardBackground[Y]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-6 ${N.colorClasses.sectionText[Y]}`,children:T("checkoutPersonalInfo")}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:w.map(e=>{let a=e.inputName||_(e.label).toLowerCase().replace(/\s+/g,""),r=(e.type||"").trim().toLowerCase(),l=e.widthFull||"textarea"===r,o=_(e.label);return(0,s.jsxs)("div",{className:l?"md:col-span-2":"",children:[(0,s.jsxs)("label",{htmlFor:a,className:`block text-sm font-medium mb-2 ${N.colorClasses.sectionText[Y]}`,"data-tina-field":(0,m.HH)(t,"checkoutPage"),children:[o," ",e.required&&"*"]}),"textarea"===r?(0,s.jsx)("textarea",{id:a,value:J[a]||"",onChange:e=>er(a,e.target.value),placeholder:e.placeholder,className:`w-full px-4 py-2 rounded border ${U[a]?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-current placeholder-opacity-75`,rows:3}):"checkbox"===r?(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)("input",{type:"checkbox",id:a,checked:"true"===J[a],onChange:e=>er(a,e.target.checked?"true":"false"),className:"w-4 h-4 mr-2"}),(0,s.jsx)("label",{htmlFor:a,className:"text-sm",children:e.placeholder||o})]}):"dropdown"===r?(0,s.jsxs)("select",{id:a,required:e.required,value:J[a]||"",onChange:e=>er(a,e.target.value),className:`w-full px-4 py-2 rounded border ${U[a]?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 relative z-10 ${J[a]?N.colorClasses.sectionText[Y]:`${N.colorClasses.sectionText[Y]} opacity-75`}`,children:[(0,s.jsx)("option",{value:"",disabled:!0,hidden:!0,children:e.placeholder||"Seleccione una opci\xf3n"}),(e.options??[]).filter(e=>!!e?.optionLabel).map(e=>(0,s.jsx)("option",{value:e.optionLabel,children:e.optionLabel},e.optionLabel))]}):(0,s.jsx)("input",{type:e.type||"text",id:a,value:J[a]||"",onChange:e=>er(a,e.target.value),placeholder:e.placeholder,className:`w-full px-4 py-2 rounded border ${U[a]?"border-red-500":"border-gray-300"} focus:outline-none focus:ring-2 focus:ring-blue-500 placeholder-current placeholder-opacity-75`}),U[a]&&(0,s.jsx)("p",{className:"text-red-500 text-sm mt-1",children:U[a]})]},a)})})]}),r.extras&&r.extras.length>0?(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${N.colorClasses.cardBackground[Y]}`,children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-4",children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold ${N.colorClasses.sectionText[Y]}`,children:T("checkoutExtrasTitle")}),r.startDate&&r.endDate&&(0,s.jsx)("span",{className:`text-sm ${N.colorClasses.sectionText[Y]} opacity-90`,children:T("checkoutExtrasTotalByDaysNote")||"Total for selected date range"})]}),(0,s.jsx)("div",{className:"space-y-3",children:r.extras.map((e,t)=>(0,s.jsx)(H,{extra:e,index:t,isSelected:E.has(t),onToggle:()=>ee(t),currencySymbol:Z,effectivePrice:R(e,r.startDate,r.endDate),blockColor:Y,theme:N,isPerDayByDays:K&&"per-day"===e.priceType,unitPrice:e.price,numDaysInRange:X,onSelectedDaysChange:e=>f?.(e),daysLabel:T("checkoutExtraDaysLabel")||"d\xedas",isObligatory:!0===e.obligatory,obligatoryLabel:T("checkoutObligatoryExtra")||"Included"},`${e.label}-${t}`))})]}):(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${N.colorClasses.cardBackground[Y]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-4 ${N.colorClasses.sectionText[Y]}`,"data-tina-field":(0,m.HH)(t,"checkoutPage"),children:((e,t,a)=>{if(e)return e;try{let e=D(t);return e&&e!==t?e:a}catch{return a}})(k?.extrasSectionTitle,"checkoutExtrasTitle","Extras")}),(0,s.jsx)("div",{className:"text-center py-8",children:(0,s.jsx)("div",{className:"text-gray-500 text-lg",children:"No hay extras disponibles"})})]})]}),(0,s.jsx)("div",{className:"sm:col-span-2",children:(0,s.jsxs)("div",{className:`p-6 rounded-lg border-2 border-current sm:sticky sm:top-4 ${N.colorClasses.cardBackground[Y]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-6 ${N.colorClasses.sectionText[Y]}
1`,children:T("checkoutReservationSummary")}),(0,s.jsx)("div",{className:"mb-4 rounded-lg overflow-hidden",children:r.boatImage?(0,s.jsx)("div",{className:"relative w-full h-48",children:(0,s.jsx)(o.default,{src:r.boatImage,alt:r.boatTitle,fill:!0,className:"object-cover",sizes:"(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 33vw"})}):(0,s.jsx)("div",{className:"w-full h-48 bg-gray-200 flex items-center justify-center border-2 border-dashed border-gray-300",children:(0,s.jsxs)("div",{className:"text-center text-gray-500",children:[(0,s.jsx)("div",{className:"text-4xl mb-2",children:"\uD83D\uDDBCï¸"}),(0,s.jsx)("div",{className:"text-sm font-medium",children:"Imagen"})]})})}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${N.colorClasses.sectionText[Y]} opacity-75`,children:T("checkoutBoatTitle")}),(0,s.jsx)("p",{className:`text-lg font-semibold ${N.colorClasses.sectionText[Y]}`,children:r.boatTitle})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${N.colorClasses.sectionText[Y]} opacity-75`,children:T("reservationDate")}),(0,s.jsx)("p",{className:`text-base ${N.colorClasses.sectionText[Y]}`,children:r.startDate&&r.endDate?`${new Date(r.startDate).toLocaleDateString()} â ${new Date(r.endDate).toLocaleDateString()}`:r.date?new Date(r.date).toLocaleDateString():(()=>{try{let e=D("noData");return e&&"noData"!==e?e:"No data"}catch{return"No data"}})()})]}),!(r.startDate&&r.endDate)&&(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${N.colorClasses.sectionText[Y]} opacity-75`,children:T("reservationTurn")}),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:`text-base ${N.colorClasses.sectionText[Y]}`,children:r.turnLabel}),(0,s.jsx)("p",{className:`text-sm ${N.colorClasses.sectionText[Y]} opacity-75`,children:r.turnTime})]})]}),eo&&(0,s.jsxs)(s.Fragment,{children:[(()=>{let e=(r.extras??[]).map((e,t)=>e.obligatory?t:-1).filter(e=>e>=0),t=Array.from(E).filter(e=>!r.extras?.[e]?.obligatory),a=t.reduce((e,t)=>e+(r.extras?.[t]?R(r.extras[t],r.startDate,r.endDate):0),0);return(0,s.jsxs)("div",{className:"border-t border-current pt-4 mb-4 space-y-2",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-sm ${N.colorClasses.sectionText[Y]}`,children:T("checkoutBasePrice")}),(0,s.jsx)("span",{className:`text-sm font-medium ${N.colorClasses.sectionText[Y]}`,children:`${Z}${r.basePrice.toFixed(2)}`})]}),e.map(e=>{let t=r.extras?.[e];if(!t)return null;let a=R(t,r.startDate,r.endDate);return(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-sm ${N.colorClasses.sectionText[Y]}`,children:t.label}),(0,s.jsxs)("span",{className:`text-sm font-medium ${N.colorClasses.sectionText[Y]}`,children:[Z,a.toFixed(2)]})]},`obligatory-${e}`)}),t.length>0&&(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsxs)("span",{className:`text-sm ${N.colorClasses.sectionText[Y]}`,children:[T("checkoutExtrasTotal")," (",t.length,")"]}),(0,s.jsxs)("span",{className:`text-sm font-medium ${N.colorClasses.sectionText[Y]}`,children:[Z,a.toFixed(2)]})]})]})})(),(0,s.jsx)("div",{className:"border-t-2 border-current pt-4 mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-xl font-bold ${N.colorClasses.sectionText[Y]}`,children:T("checkoutTotal")}),(0,s.jsx)("span",{className:`text-xl font-bold ${N.colorClasses.sectionText[Y]}`,children:`${Z}${et().toFixed(2)}`})]})})]}),(0,s.jsx)("button",{type:"button",onClick:el,disabled:G||!1,className:`w-full py-4 px-6 rounded-lg font-bold text-lg transition-all ${G?"opacity-50 cursor-not-allowed":"hover:opacity-90"} ${N.colorClasses.button[Y]}`,children:G?T("checkoutProcessing"):T("checkoutCompleteButton")})]})})]})}),!1]})})}function J(e){let{data:t,globalData:a,locale:r}=e,[o,i]=(0,l.useState)(!1),[m,x]=(0,l.useState)(null),[b,f]=(0,l.useState)(""),[y,g]=(0,l.useState)(!0),[j,v]=(0,l.useState)(new Set),[N,D]=(0,l.useState)({}),k=t?.checkoutPage,{t:C}=(0,d.J)(),w=k?.additionalFields||[],T=[...q(C),...w],[$,P]=(0,l.useState)(()=>{let e={};return T.forEach(t=>{e[t.inputName||_(t.label).toLowerCase().replace(/\s+/g,"")]=""}),e}),E=e=>{try{let t=C(e);return t&&t!==e?t:e}catch{return e}},L=(0,u.o)(a?.reservationPageConfig?.color||"blue"),{calculateAmou
1nt:A}=I(t?.checkoutPage?.depositPercentage),B=e=>{if(!e||"object"!=typeof e||"string"!=typeof e.calendarId||!e.calendarId||"string"!=typeof e.boatTitle||!e.boatTitle||"number"!=typeof e.basePrice||isNaN(e.basePrice))return!1;let t="string"==typeof e.startDate&&e.startDate&&"string"==typeof e.endDate&&e.endDate,a="string"==typeof e.date&&e.date&&"string"==typeof e.turnId&&e.turnId;return!(!t&&!a||e.extras&&!Array.isArray(e.extras)||e.extras&&e.extras.some(e=>!e||"string"!=typeof e.label||"number"!=typeof e.price||isNaN(e.price)))};if((0,l.useEffect)(()=>{(async()=>{try{let e;if("undefined"==typeof sessionStorage){g(!1),i(!0);return}let a=sessionStorage.getItem("reservationCheckoutData");if(!a){g(!1),i(!0);return}try{e=JSON.parse(a)}catch(e){(0,S.y)("Error parsing reservation data from sessionStorage",{error:e}),sessionStorage.removeItem("reservationCheckoutData"),h.Ay.error("Datos de reserva inv\xe1lidos"),g(!1),i(!0);return}if(!B(e)){(0,S.y)("Invalid reservation data schema",{data:e}),sessionStorage.removeItem("reservationCheckoutData"),h.Ay.error("Datos de reserva incompletos o inv\xe1lidos"),g(!1),i(!0);return}x(e);let r=new Set;if(e.extras?.forEach((e,t)=>{e.obligatory&&r.add(t)}),r.size>0&&v(r),e.startDate&&e.endDate&&e.extras?.length){let t={};e.extras.forEach((e,a)=>{"per-day"===e.priceType&&(t[a]=1)}),D(t)}let s=t?.checkoutPage?.depositPercentage,l=e.basePrice;if(F("number"==typeof s&&s>=0&&s<=100?s:s??100,l)){let t=A(e.basePrice),a=!!(e.startDate&&e.endDate),r=await fetch("/api/reservations/stripe-checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({totalPrice:t,reservationData:{boatTitle:e.boatTitle,calendarId:e.calendarId,...a?{startDate:e.startDate,endDate:e.endDate}:{date:e.date,turnId:e.turnId}}})});if(!r.ok){let e=await r.json();(0,S.y)("Error creating payment intent",{error:e}),h.Ay.error("Error al inicializar el pago"),g(!1),i(!0);return}let s=await r.json();s.clientSecret?(f(s.clientSecret),i(!0),g(!1)):((0,S.y)("No client secret received",{result:s}),h.Ay.error("Error al inicializar el pago"),g(!1),i(!0))}else i(!0),g(!1)}catch(e){(0,S.y)("Error loading reservation data",{error:e}),h.Ay.error("Error al cargar datos de reserva"),g(!1),i(!0)}})()},[A,t]),(0,l.useEffect)(()=>{if(!m||!b)return;let e=m.basePrice;if(j.forEach(t=>{let a=m.extras[t];a&&(e+=R(a,m.startDate,m.endDate))}),0===e&&b){let e=setTimeout(()=>{f("")},400);return()=>clearTimeout(e)}},[j,m,b,N]),!o)return null;if(y)return(0,s.jsx)(n.w,{blockIsFirst:!0,imagesHavePriority:!1,blockStyle:{color:L},children:(0,s.jsx)(c.m,{verticalSpacing:"large",blockStyle:{color:L},children:(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"animate-spin w-12 h-12 border-4 border-blue-500 border-t-transparent rounded-full mx-auto mb-4"}),(0,s.jsx)("p",{className:"text-lg",children:E("reservationLoading")})]})})});let H=a||{};if(m){let e,a=t?.checkoutPage?.depositPercentage??100;if(F(a,(e=m.basePrice,j.forEach(t=>{let a=m.extras[t];a&&(e+=R(a,m.startDate,m.endDate))}),e))&&b)return(0,s.jsx)(p.S8,{stripe:O,options:{clientSecret:b},children:(0,s.jsx)(z,{data:t,globalData:H,reservationData:m,selectedExtras:j,onExtrasChange:e=>{v(e)},extraSelectedDays:N,onExtraSelectedDaysChange:D,formData:$,onFormDataChange:e=>{P(e)},locale:r})});if(m)return(0,s.jsx)(M,{data:t,globalData:H,reservationData:m,selectedExtras:j,onExtrasChange:e=>{v(e)},extraSelectedDays:N,onExtraSelectedDaysChange:D,formData:$,onFormDataChange:e=>{P(e)},locale:r,onPaymentIntentNeeded:async e=>{if(!b)try{let t=A(e),a=!!(m.startDate&&m.endDate),r=await fetch("/api/reservations/stripe-checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({totalPrice:t,reservationData:{boatTitle:m.boatTitle,calendarId:m.calendarId,...a?{startDate:m.startDate,endDate:m.endDate}:{date:m.date,turnId:m.turnId}}})});if(!r.ok){let e=await r.json().catch(()=>({}));(0,S.y)("Error creating payment intent for extras",{error:e,status:r.status}),h.Ay.error(e.message||E("paymentInitializationError")||"Error al inicializar el pago. Por favor, int\xe9ntalo de nuevo.");return}let s=await r.json();s.clientSecret?f(s.clientSecret):((0,S.y)("Payment intent created but no clientSecret returned",{result:s}),h.Ay.error(E("paymentInitializationError")||"Error al inicializar el pago. Por favor, int\xe9ntalo de nuevo."))}catch(e){(0,S.y)("Error creating payment intent for extras",{error:e}),h.Ay.error(E("paymentInitializationError")||"Error al inicializar el pago. Por favor, int\xe9ntalo de nuevo.")}}})}return(0,s.jsx)(W,{data:t,globalData:H})}function W(e){let{data:t,globalData:a}=e,r=(0,i.D)(),{t:l}=(0,d.J)(),o=t?.checkoutPage,x=o?.additionalFields||[],h=[...q(l),...x],p=(0,u.o)(a?.reservationPageConfig?.color||"blue"),b=e=>{try{let t=l(e);return t&&t!==e?t:e}catch{return e}},f=()=>{try{let e=l("noData");return e&&"noData"!==e?e:"No data"}catch{return"No data"}};return(0,s.jsx)(n.w,{blockIsFirst:!0,imagesHavePriority:!1,blockStyle:{color:p},children:(0,s.jsxs)(c.m,{verticalSpacing:"large",blockStyle:{color:p},children:[(0,s.jsx)("h1",{className:"text-4xl font-bold mb-8",children:b("checkoutPageTitle")}),(0,s.jsx)("div",{className:`text-lg mb-8 ${r.colorClasses.sectionText[p]}`,children:(0,s.jsx)("p",{children:b("checkoutPageDescription")})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-5 ga
1p-8",children:[(0,s.jsxs)("div",{className:"sm:col-span-3",children:[(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${r.colorClasses.cardBackground[p]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-6 ${r.colorClasses.sectionText[p]}`,children:b("checkoutPersonalInfo")}),(0,s.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:h.map((e,a)=>{let l=(e.type||"").trim().toLowerCase(),o=e.widthFull||"textarea"===l;return(0,s.jsxs)("div",{className:o?"md:col-span-2":"",children:[(0,s.jsxs)("label",{className:`block text-sm font-medium mb-2 ${r.colorClasses.sectionText[p]}`,"data-tina-field":(0,m.HH)(t,"checkoutPage"),children:[_(e.label)||"Field",e.required&&" *"]}),"textarea"===l?(0,s.jsx)("textarea",{className:"w-full px-4 py-2 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:e.placeholder||"",rows:3,disabled:!0}):"dropdown"===l?(0,s.jsxs)("select",{className:"w-full px-4 py-2 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500",disabled:!0,children:[(0,s.jsx)("option",{value:"",children:e.placeholder||""}),(e.options??[]).filter(e=>!!e?.optionLabel).map(e=>(0,s.jsx)("option",{value:e.optionLabel,children:e.optionLabel},e.optionLabel))]}):(0,s.jsx)("input",{type:e.type||"text",className:"w-full px-4 py-2 rounded border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:e.placeholder||"",disabled:!0})]},a)})})]}),(0,s.jsxs)("div",{className:`p-6 rounded-lg mb-6 ${r.colorClasses.cardBackground[p]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-4 ${r.colorClasses.sectionText[p]}`,children:b("checkoutExtrasTitle")}),(0,s.jsx)("div",{className:"text-center py-8",children:(0,s.jsx)("div",{className:"text-gray-500 text-lg",children:"No hay extras disponibles"})})]})]}),(0,s.jsx)("div",{className:"sm:col-span-2",children:(0,s.jsxs)("div",{className:`p-6 rounded-lg border-2 border-current sm:sticky sm:top-4 ${r.colorClasses.cardBackground[p]}`,children:[(0,s.jsx)("h2",{className:`text-2xl font-semibold mb-6 ${r.colorClasses.sectionText[p]}`,children:b("checkoutReservationSummary")}),(0,s.jsx)("div",{className:"mb-4 rounded-lg overflow-hidden",children:(0,s.jsx)("div",{className:"w-full h-48 bg-gray-200 flex items-center justify-center border-2 border-dashed border-gray-300",children:(0,s.jsxs)("div",{className:"text-center text-gray-500",children:[(0,s.jsx)("div",{className:"text-4xl mb-2",children:"\uD83D\uDDBCï¸"}),(0,s.jsx)("div",{className:"text-sm font-medium",children:"Imagen"})]})})}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${r.colorClasses.sectionText[p]} opacity-75`,children:b("checkoutBoatTitle")}),(0,s.jsx)("p",{className:`text-lg font-semibold ${r.colorClasses.sectionText[p]}`,children:f()})]}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${r.colorClasses.sectionText[p]} opacity-75`,children:b("reservationDate")}),(0,s.jsx)("p",{className:`text-base ${r.colorClasses.sectionText[p]}`,children:f()})]}),(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("p",{className:`text-sm font-medium mb-1 ${r.colorClasses.sectionText[p]} opacity-75`,children:b("reservationTurn")}),(0,s.jsx)("p",{className:`text-base ${r.colorClasses.sectionText[p]}`,children:f()})]}),(0,s.jsx)("div",{className:"border-t border-current pt-4 mb-4 space-y-2",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-sm ${r.colorClasses.sectionText[p]}`,children:b("checkoutBasePrice")}),(0,s.jsx)("span",{className:`text-sm font-medium ${r.colorClasses.sectionText[p]}`,children:f()})]})}),(0,s.jsx)("div",{className:"border-t-2 border-current pt-4 mb-6",children:(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:`text-xl font-bold ${r.colorClasses.sectionText[p]}`,children:b("checkoutTotal")}),(0,s.jsx)("span",{className:`text-xl font-bold ${r.colorClasses.sectionText[p]}`,children:f()})]})}),(0,s.jsx)("button",{className:`w-full py-4 px-6 rounded-lg font-bold text-lg transition-all opacity-50 cursor-not-allowed ${r.colorClasses.button[p]}`,disabled:!0,children:b("checkoutCompleteButton")})]})})]}),(0,s.jsx)("div",{className:"mt-8 p-6 bg-yellow-50 border border-yellow-200 rounded-lg",children:(0,s.jsx)("div",{className:"text-lg text-yellow-800 text-center",children:(0,s.jsx)("p",{children:b("checkoutNoDataMessage")})})})]})})}}}]);
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.