https://www.laensaladeria.cl/_next/static/chunks/pages/_sites/[site]/v2/checkout-9f13c4611221b847.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2353],{53219:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(84297);let s=(0,n.Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},45077:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(84297);let s=(0,n.Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},28463:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(84297);let s=(0,n.Z)("Package",[["path",{d:"M16.5 9.4 7.55 4.24",key:"10qotr"}],["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]])},55392:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(84297);let s=(0,n.Z)("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2v0a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12v0a2 2 0 0 1-2-2V7",key:"jon5kx"}]])},15570:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/_sites/[site]/v2/checkout",function(){return r(69021)}])},40034:function(e,t,r){"use strict";r.d(t,{fh:function(){return n},kO:function(){return l}});let n=15e3,s={PERCENTAGE:"percentage",AMOUNT:"amount"},l=e=>(null==e?void 0:e.type)===s.AMOUNT},6189:function(e,t,r){"use strict";r.d(t,{Z:function(){return u}});var n=r(67294),s=r(26982),l=r(44674),o=r(26628),a=r(82892),i=r(40034);let d=[0,5,10,15],c=(e,t)=>{let r=[0];return 0!==e&&r.push(e),r.push(e+t,e+2*t),r};var u=()=>{let e=(0,o.v9)(e=>{var t;return null===(t=e.cart)||void 0===t?void 0:t.subtotal}),t=(0,o.v9)(e=>{var t,r;return null===(t=e.searchStore)||void 0===t?void 0:null===(r=t.delivery)||void 0===r?void 0:r.defaultTip}),[r,u]=(0,n.useState)(!1),m=(0,i.kO)(t),x=(()=>{if(t){let e=m?a.N.differentialTip:5;return c(t.tip,e)}return d})();return{setTipValue:t=>m?t:(0,l.DU)(t,e),setTipLabel:e=>0===e?s.ZP.t("Tip:noThanks"):m?(0,l.T4)(e):"".concat(e,"%"),tipValues:x,isCustomTip:r,setIsCustomTip:u}}},2618:function(e,t,r){"use strict";r.d(t,{t:function(){return o}});var n=r(31842),s=r(57650);let{getStoreData:l}=n.default;async function o(e,t,r){var n,o,a,i;let d=null!==(a=t().cart)&&void 0!==a?a:{},{cartStoreId:c}=d;if((null!==(i=null===(n=d.cart)||void 0===n?void 0:n.length)&&void 0!==i?i:0)===0||null==c)return null;await e(l({id:String(c),dispatchType:r},{onSuccess:null,onFailure:null,skipNextActions:!0,skipCheckScheduledDateAvailability:!1,skipPersist:!1}));let u=null===(o=t().searchStore)||void 0===o?void 0:o.currentSubsidiary;return(null==u?void 0:u.id)&&(0,s.l)(u.id,c)?u:null}},69021:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSG:function(){return tb},default:function(){return ty}});var n=r(85893),s=r(5152),l=r.n(s),o=r(11163),a=r(67294),i=r(64192),d=r(31974),c=r(34484),u=r(80006),m=r(62609),x=r(45123),p=r(91075),v=r(98609);r(519);var h=r(26982),f=r(53219),b=r(41664),y=r.n(b),g=r(26628),j=r(50872),N=r(19034),P=r(3345),k=r(6728),C=r(92852),S=r(25296),w=r(85329),Z=r(82892),E=r(8949),O=r(83664),T=r(79819),_=r(19720),I=r(86133),M=r(18672),A=r(52813),D=r(40250),R=r(29554),L=r(94651),V=r(58846),F=r(83765),U=r(2919),H=r(9706),B=r(63253),Y=r(4376),G=r(57456),q=r(31842),z=r(4606),K=r(25339),W=r(37335),Q=r(23501),$=r(485),X=r(96579),J=r(70921),ee=r(25777),et=r(29632),er=r(98548),en=r(44035),es=r(36512),el=r.n(es),eo=r(44674);function ea(e){var t,r;let{values:n,retryNonce:s=0}=e,l=(0,g.I0)(),o=(0,g.v9)(e=>e.cart.cart),i=(0,g.v9)(e=>e.cart.loyaltyPoints),d=(0,g.v9)(e=>e.cart.coupon),c=(0,g.v9)(e=>{var t;return null===(t=e.searchStore)||void 0===t?void 0:t.currentSubsidiary}),u=(0,g.v9)(e=>{var t;return null===(t=e.auth.currentUser)||void 0===t?void 0:t.id}),m=null!==(r=null==d?void 0:null===(t=d.appliedCoupon)||void 0===t?void 0:t.code)&&void 0!==r?r:"",x=n.paymentMethod||"",p=null==c?void 0:c.id,v=(0,T.ib)(o),h=[v,null!=p?p:"",m,x,null!=u?u:"",s].join("|"),[f,b]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=setTimeout(()=>b(h),300);return()=>clearTimeout(e)},[h]);let y=(0,a.useRef)(null);return(0,a.useEffect)(()=>
1{if(null===f||!o.length||!p)return;let e=o.some(e=>e.addedByCoupon||!(0,k.g$)(e));e&&y.current!==f&&(y.current=f,l(U.ZP.checkCart({showModalError:!1,discount:{points:i,coupon:m,paymentMethod:x||void 0}})))},[f,l]),(0,a.useEffect)(()=>()=>{l(U.ZP.setPricingError(null))},[l]),null}function ei(e){let{title:t,headerRight:r,children:s}=e;return(0,n.jsxs)("div",{children:[(t||r)&&(0,n.jsxs)("div",{className:"mb-4 flex items-center justify-between",children:[t&&(0,n.jsx)("h3",{className:"text-lg font-semibold text-content",children:t}),r]}),(0,n.jsx)("div",{className:"rounded-xl bg-surface p-4 outline outline-1 outline-line",children:s})]})}r(79386);var ed=r(55392),ec=r(54976),eu=r(84297);let em=(0,eu.Z)("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]]);var ex=r(45077),ep=r(23217),ev=r(1832),eh=r(13515),ef=r(60589),eb=r(18413),ey=r(24754),eg=r(9643),ej=r(11087);function eN(e){let{values:t}=e,{handlerOpenCart:r,cartItemsCount:s}=(0,ej.Z)(!0),l=(0,g.v9)(e=>e.cart.cart),o=(0,T.Ir)();return(0,n.jsxs)("div",{className:t.onlyPay?"pointer-events-none opacity-60":"",children:[(0,n.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,n.jsxs)("h3",{className:"text-base font-semibold",children:[s," ",h.ZP.t("SimpleOrderDetail:".concat(s>1?"products":"product"))]}),(0,n.jsx)("button",{type:"button",onClick:r,className:"text-sm font-semibold text-primary underline",children:h.ZP.t("CheckoutSection:edit")})]}),(0,n.jsx)("div",{className:"flex flex-col",children:(0,eb.ak)(l,"addedByCoupon").map(e=>(0,n.jsx)(ey.d6,{item:e,onModify:()=>o.openForEdit(e)},e.hash))}),(0,n.jsx)(eg.e,{detail:o})]})}var eP=r(67255);function ek(e){let{values:t,setFieldValue:r}=e;return(0,n.jsxs)("label",{className:"flex cursor-pointer items-start gap-3",children:[(0,n.jsx)("input",{type:"checkbox",name:et._.MAILING,checked:t[et._.MAILING],onChange:()=>r(et._.MAILING,!t[et._.MAILING]),className:"mt-0.5 h-4 w-4 rounded border-line-strong accent-primary"}),(0,n.jsxs)("div",{className:"text-sm text-content-tertiary",children:[h.ZP.t("OrderSummary:subscription"),(0,n.jsxs)("span",{className:"ml-1 text-xs text-content-subtle",children:["(",h.ZP.t("OrderSummary:optional"),")"]})]})]})}function eC(e){var t;let{values:r,setFieldValue:s,errors:l,submitCount:o}=e,{mandatoryTermsAndConditions:a}=(0,g.v9)(e=>e.core.settings),i=(0,g.v9)(e=>e.pages.builderPages||[]),d=(null===(t=i.find(e=>e.type===eP.sL.TERMS_AND_CONDITIONS))||void 0===t?void 0:t.url)||eP.Fd,c=o>0&&(null==l?void 0:l[et._.TERMS_AND_CONDITIONS]);return(0,n.jsxs)("div",{className:"space-y-3",children:[a&&(0,n.jsxs)("label",{className:"flex cursor-pointer items-start gap-3 ".concat(c?"text-error-strong":""),children:[(0,n.jsx)("input",{type:"checkbox",name:et._.TERMS_AND_CONDITIONS,checked:r[et._.TERMS_AND_CONDITIONS],onChange:()=>s(et._.TERMS_AND_CONDITIONS,!r[et._.TERMS_AND_CONDITIONS]),className:"mt-0.5 h-4 w-4 rounded border-line-strong accent-primary ".concat(c?"!border-error":"")}),(0,n.jsx)("span",{className:"text-sm text-content-tertiary",children:h.ZP.t("OrderSummary:acceptTermsAndConditions")})]}
1),!a&&(0,n.jsxs)("p",{className:"text-xs text-content-subtle",children:[h.ZP.t("OrderSummary:complianceText"),(0,n.jsx)(y(),{href:d,className:"font-semibold",children:h.ZP.t("OrderSummary:termsAndConditions")})]})]})}var eS=r(28463),ew=r(8971),eZ=r(22131),eE=r(61966);function eO(e){var t,r;let{values:s,setFieldValue:l,errors:o}=e,a=(0,g.I0)(),i=(0,g.v9)(e=>e.searchStore.currentSubsidiary),d=(0,g.v9)(e=>e.searchStore.dispatchType===M.CK.PICKUP),c=(0,g.v9)(e=>{var t,r;return null===(t=e.auth.address)||void 0===t?void 0:null===(r=t.current)||void 0===r?void 0:r.textAddress}),u=(0,g.v9)(e=>e.order.futureOrder),m=(0,g.v9)(e=>e.cart.cart.some(e=>{let{product:t}=e;return t.deferred})),{hasAvailableSlots:x}=(0,eZ.h)();if(!i)return null;let{pickUpWaitTime:p,deliveryWaitTime:v}=i,f=!!i.futureOrdersEnabled&&x,b=d?h.ZP.t("CheckoutSection:pickUpFrom",{store:null==i?void 0:i.name,interpolation:{escapeValue:!1}}):h.ZP.t("CheckoutSection:deliveryTo",{address:""}),y=d?null==i?void 0:i.textAddress:c,j=s.onlyPay;return(0,n.jsxs)("div",{className:"overflow-hidden rounded-lg border border-line ".concat(j?"pointer-events-none opacity-60":""),children:[(0,n.jsxs)("button",{type:"button",onClick:()=>a(B.ZP.openModal(Y.ee.DELIVERY_OR_PICKUP)),className:"flex w-full items-start gap-2 px-4 py-3 text-left transition-colors hover:bg-surface-subtle",children:[d?(0,n.jsx)(ed.Z,{className:"mt-0.5 h-5 w-5 shrink-0 text-content-secondary"}):(0,n.jsx)(ec.Z,{className:"mt-0.5 h-5 w-5 shrink-0 text-content-secondary"}),(0,n.jsx)("span",{className:"text-base text-content",children:d?(0,n.jsxs)(n.Fragment,{children:[b," ",y&&(0,n.jsx)("span",{className:"font-bold",children:y})]}):(0,n.jsxs)(n.Fragment,{children:[h.ZP.t("CheckoutSection:deliveryTo",{address:""})," ",(0,n.jsx)("span",{className:"font-bold",children:c})]})})]}),(0,n.jsx)("hr",{className:"mx-4 border-line"}),(0,n.jsxs)("button",{type:"button",onClick:()=>{f&&a(B.ZP.openModal(Y.ee.FUTURE_ORDER))},disabled:!f,className:"flex w-full items-start gap-2 px-4 py-3 text-left transition-colors hover:bg-surface-subtle disabled:cursor-default disabled:hover:bg-transparent",children:[u?(0,n.jsx)(em,{className:"mt-0.5 h-5 w-5 shrink-0 text-content-secondary"}):(0,n.jsx)(ex.Z,{className:"mt-0.5 h-5 w-5 shrink-0 text-content-secondary"}),(0,n.jsx)("span",{className:"text-base text-content",children:m?h.ZP.t("FutureOrder:
1asap"):u?"".concat((0,ef.dayFormat)(u.date,!1,!0),". ").concat(u.time,"."):h.ZP.t("DispatchDetails:approximateTime",{time:d?p:v})})]}),!d&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("hr",{className:"mx-4 border-line"}),(0,n.jsxs)("label",{className:"relative flex w-full cursor-pointer items-center gap-2 px-4 py-3 text-left transition-colors hover:bg-surface-subtle",children:[(0,n.jsx)(eS.Z,{className:"h-5 w-5 shrink-0 text-content-secondary"}),(0,n.jsxs)("span",{className:"flex-1 text-base text-content",children:[h.ZP.t("DeliveryPreference:".concat(Array.isArray(s[eE.Tx])?null===(t=s[eE.Tx][0])||void 0===t?void 0:t.name:s[eE.Tx])),(0,n.jsx)(ew.Z,{className:"ml-1 inline h-4 w-4 text-content-subtle"})]}),(0,n.jsx)("select",{name:eE.Tx,value:Array.isArray(s[eE.Tx])?(null===(r=s[eE.Tx][0])||void 0===r?void 0:r.name)||"":s[eE.Tx]||"",onChange:e=>{let t=eE.hE.find(t=>t.name===e.target.value);t&&l(eE.Tx,[t])},className:"absolute inset-0 cursor-pointer opacity-0",children:eE.hE.map(e=>(0,n.jsx)("option",{value:e.name,children:h.ZP.t("DeliveryPreference:".concat(e.name))},e.name))})]}),o.deliveryOption&&(0,n.jsx)("p",{className:"px-4 pb-2 text-sm text-error",children:o.deliveryOption})]})]})}r(26276);var eT=r(41352),e_=r(7515);r(44263);let eI=(0,eu.Z)("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]);var eM=r(49491),eA=r(46245);function eD(e){let{values:t,setFieldValue:r}=e,s=(0,g.I0)(),l=(0,g.v9)(e=>e.core.settings.tenant),{cart:o,subtotal:i,discount:d}=(0,g.v9)(e=>e.cart),c=(0,g.v9)(e=>e.cart.cartLoading),u=(0,g.v9)(e=>e.cart.cartError),m=(0,g.v9)(e=>e.cart.couponRemovedError),x=(0,g.v9)(e=>{var t,r;return null===(t=e.cart)||void 0===t?void 0:null===(r=t.coupon)||void 0===r?void 0:r.appliedCoupon}),p=(0,g.v9)(e=>e.cart.loyaltyPoints),v=(0,g.v9)(e=>{var t,r;return null===(t=e.core)||void 0===t?void 0:null===(r=t.settings)||void 0===r?void 0:r.brandSecondary}),f=(0,a.useMemo)(()=>!(0,eM.N)(v),[v]),b=(null==x?void 0:x.kind)===ee.HW.GIFT,y=(null==x?void 0:x.value)&&parseInt(String(x.value),10)>0||b,[j,N]=(0,a.useState)((null==x?void 0:x.code)||t[et._.COUPON]||""),[P,k]=(0,a.useState)(!1),S=!y&&(P||!!m),w="text-content-subtle";y?w="text-success":S&&(w="text-error");let Z="border-line bg-surface-subtle text-content focus:border-line-strong focus:bg-surface";y?Z="border-success/30 bg-success-soft text-success-strong":S&&(Z="border-error/40 bg-error-soft text-error-emphasis"),(0,a.useEffect)(()=>{y&&(null==x?void 0:x.code)&&N(x.code)},[y,null==x?void 0:x.code]);let E=(0,a.useRef)(null==x?void 0:x.code);(0,a.useEffect)(()=>{let e=null==x?void 0:x.code;E.current&&!e&&(N(""),r(et._.COUPON,"")),E.current=e},[null==x?void 0:x.code,r]);let O=(0,a.useCallback)(()=>{let e=j.trim();e&&!c&&(m&&s(U.ZP.setCouponRemovedError(null)),r(et._.COUPON,e),new Promise(function(){for(var r=arguments.length,n=Array(r),l=0;l<r;l++)n[l]=arguments[l];s(U.ZP.addDiscount({couponData:{coupon:e,paymentMethod:null==t?void 0:t.paymentMethod},loyaltyData:{cashToExchange:p||null}},n))}).then(()=>{k(!1),C.Z.submitCoupon({coupon:{appliedCoupon:{code:e,kind:(null==x?void 0:x.kind)||"",value:(null==x?void 0:x.value)||0}},cart:o,total:i,discount:d,tenant:l})}).catch(()=>{k(!0),r(et._.COUPON,"")}))},[null==x?void 0:x.kind,null==x?void 0:x.value,o.length,c,j,m,d,s,p,r,i,l,null==t?void 0:t.paymentMethod]),T=(0,a.useCallback)(()=>{c||(C.Z.couponRemoved({tenant:l,couponCode:(null==x?void 0:x.code)||"",cartTotal:i}),k(!1),m&&s(U.ZP.setCouponRemovedError(null)),N(""),r(et._.COUPON,""),s(U.ZP.removeCoupon()),new Promise(function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];s(U.ZP.addDiscount({couponData:{coupon:"",paymentMethod:null==t?void 0:t.paymentMethod},loyaltyData:{cashToExchange:p||null}},r))}))},[null==x?void 0:x.code,c,m,s,p,r,i,l,null==t?void 0:t.paymentMethod]);return(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-stretch",children:[(0,n.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,n.jsx)(eI,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 ".concat(w)}),(0,n.jsx)("input",{type:"text",value:j,onChange:e=>{N(e.target.value),P&&k(!1),m&&s(U.ZP.setCouponRemovedError(null))},onKeyDown:e=>{"Enter"===e.key&&!y&&!c&&j.trim()&&(e.preventDefault(),O())},disabled:y||c,readOnly:y,placeholder:h.ZP.t("OrderSummary:discountCoupon",{code:""}),className:"w-full rounded-xl border py-3 pl-10 pr-4 text-sm transition-colors placeholder:text-content-subtle focus:outline-none ".concat(Z)})]}
1),y?(0,n.jsx)("button",{type:"button",onClick:T,disabled:c,className:"shrink-0 rounded-xl border-2 border-line-strong bg-surface-muted px-5 py-3 text-sm font-semibold text-content shadow-sm transition-colors hover:border-line-strong hover:bg-surface-strong disabled:cursor-not-allowed disabled:border-line disabled:bg-surface-muted disabled:text-content-subtle sm:self-stretch",children:h.ZP.t("OrderSummary:removeCoupon")}):(0,n.jsx)("button",{type:"button",onClick:O,disabled:!j.trim()||c,className:"border-line shrink-0 rounded-xl border !bg-secondary px-5 py-3 text-sm font-semibold shadow-md transition-[opacity,box-shadow] hover:opacity-90 disabled:cursor-not-allowed disabled:!bg-surface-strong disabled:!text-content-secondary disabled:opacity-100 disabled:shadow-none sm:self-stretch ".concat(f?"!text-content":"!text-content-inverse"),children:h.ZP.t("OrderSummary:applyCoupon")})]}),y&&(0,n.jsxs)("p",{className:"flex items-center gap-1 text-xs text-success",children:[(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"20 6 9 17 4 12"})}),h.ZP.t("OrderSummary:validCoupon"),!b&&" -".concat((0,eo.T4)(x.value))]}),S&&(0,n.jsxs)("p",{className:"flex items-center gap-1 text-xs text-error-strong",children:[(0,n.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,n.jsx)("line",{x1:"15",y1:"9",x2:"9",y2:"15"}),(0,n.jsx)("line",{x1:"9",y1:"9",x2:"15",y2:"15"})]}),(0,eA.Q)(m||u||void 0)]})]})}r(10341);var eR=r(27669),eL=r(80286);function eV(e){var t;let{values:r,setFieldValue:s}=e,l=(0,g.I0)(),{rewardPointsName:o,maxLoyaltyMoneyToUse:i,loyaltyPoints:d,minAmountCCLimit:c,maxAmountCCLimit:u,coupon:m,cartLoading:x,subtotal:p}=function(){let e=(0,g.v9)(e=>{var t,r,n;return null===(t=e.core)||void 0===t?void 0:null===(r=t.settings)||void 0===r?void 0:null===(n=r.loyaltyProgramParams)||void 0===n?void 0:n.name}),{maxLoyaltyMoneyToUse:t,loyaltyPoints:r,cartLoading:n}=(0,g.v9)(e=>e.cart),{minRedeemableMoney:s,maxRedeemableMoney:l}=(0,g.v9)(e_.L),o=(0,g.v9)(e=>e.cart.coupon),a=(0,g.v9)(e=>e.cart.subtotal);return{rewardPointsName:e,maxLoyaltyMoneyToUse:t,loyaltyPoints:r,minAmountCCLimit:s,maxAmountCCLimit:l,coupon:o,cartLoading:n,subtotal:a}}(),v=(0,g.v9)(e=>{var t,r;return null===(t=e.core)||void 0===t?void 0:null===(r=t.settings)||void 0===r?void 0:r.brandSecondary}),f=(0,a.useMemo)(()=>!(0,eM.N)(v),[v]),[b,y]=(0,a.useState)(Number(d)||i||0),[j,N]=(0,a.useState)(!!d),[P,k]=(0,a.useState)(""),S=!!(null==m?void 0:null===(t=m.appliedCoupon)||void 0===t?void 0:t.code),w=S?m.appliedCoupon.code:"";(0,a.useEffect)(()=>{y(Number(d)||i||0)},[i,d]),(0,a.useEffect)(()=>{d&&N(!0)},[d]),(0,a.useEffect)(()=>{j&&null===d&&(s(et._.LOYALTY_POINTS,null),N(!1))},[d,j,s]);let Z=j?"":b>p?"rewardHigherThanTotalPrice":b>i?"notEnoughPoints":null!=u&&b>u?"maxAmountToExchange":null!=c&&b<c?"minAmountToExchange":0===b?"notDiscount":"",E=!j&&!!Z,O=(0,a.useCallback)(()=>{x||E||(k(""),new Promise(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];l(U.ZP.addDiscount({couponData:{coupon:w,paymentMethod:null==r?void 0:r.paymentMethod},loyaltyData:{cashToExchange:b}},t,e=>{C.Z.submitLoyaltyPoints({...e})}))}).then(e=>{var t,r;s(et._.LOYALTY_POINTS,null!==(r=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.loyaltyPoints)&&void 0!==r?r:b),N(!0)}).catch(e=>{var t,r,n,s;let l=(null==e?void 0:null===(t=e.data)||void 0===t?void 0:null===(r=t.error)||void 0===r?void 0:r.message)||(null==e?void 0:null===(n=e.data)||void 0===n?void 0:null===(s=n.error)||void 0===s?void 0:s.detail);k(l||h.ZP.t("RewardPoints:errorResponse"))}))},[x,E,l,w,null==r?void 0:r.paymentMethod,b,s]),T=(0,a.useCallback)(()=>{x||new Promise(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];l(U.ZP.addDiscount({couponData:{coupon:w,paymentMethod:null==r?void 0:r.paymentMethod},loyaltyData:{cashToExchange:null}},t))}).then(()=>{s(et._.LOYALTY_POINTS,null),N(!1)})},[x,l,w,null==r?void 0:r.paymentMethod,s]);return 0!==i||j?(0,n.jsxs)("div",{className:"space-y-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 text-sm text-content-secondary",children:[(0,n.jsx)(eR.Z,{className:"h-4 w-4 text-warning"}),(0,n.jsxs)("span",{children:[h.ZP.t("RewardPoints:title",{amount:(0,eo.T4)(Number(d)||i)}),o]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-stretch",children:[(0,n.jsxs)("div",{className:"relative min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-sm text-content-subtle",children:"$"}),(0,n.jsx)("input",{type:"text",inputMode:"numeric",value:j?(0,eo.T4)(b):b||"",onChange:e=>{let t=parseInt(e.target.value.replace(/\D/g,""),10)||0;y(t),k("")},onKeyDown:e=>{"Enter"!==e.key||j||x||E||0===b||(e.preventDefault(),O())},disabled:j,readOnly:j,placeholder:h.ZP.t("RewardPoints:howManyPoints"),className:"w-full rounded-xl border border-line py-3 pl-7 pr-4 text-sm transition-colors placeholder:text-content-subtle focus:outline-none ".concat(E?"border-error/40 bg-error-soft text-error-emphasis focus:border-error/60":j?"border-success/30 bg-success-soft text-success-strong":"border-line bg-surface-subtle text-content focus:border-line-strong focus:bg-surface")})]}),j?(0,n.jsx)("button",{type:"button",onClick:T,disabled:x,className:"shrink-0 rounded-xl border-2 border-line-strong bg-surface-muted px-5 py-3 text-sm font-semibold text-content shadow-sm transition-colors hover:border-line-strong hover:bg-surface-strong disabled:cursor-not-allowed disabled:border-line disabled:bg-surface-muted disabled:text-content-subtle sm:self-stretch",children:h.ZP.t("RewardPoints:removePoints")}):(0,n.jsx)("button",{type:"button",onClick:O,disabled:0===b||E||x,className:"border-line shrink-0 rounded-xl border !bg-secondary px-5 py-3 text-sm font-semibold shadow-md transition-[opacity,box-shadow] hover:opacity-90 disabled:cursor-not-allowed disabled:!bg-surface-strong disabled:!text-content-secondary disabled:opacity-100 disabled:shadow-none sm:self-stretch ".concat(f?"!text-content":"!text-content-inverse"),children:h.ZP.t("RewardPoints:applyPoints")})]}),j&&(0,n.jsxs)("p",{className:"flex items-center gap-1 text-xs text-success",children:[(0,n.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,n.jsx)("polyline",{points:"20 6 9 17 4 12"})}),h.ZP.t("RewardPoints:validCoupon")]}),P?(0,n.jsx)("p",{className:"text-xs text-error-strong",children:P}):E&&Z&&(0,n.jsx)("p",{className:"text-xs text-error-strong",children:h.ZP.t("RewardPoints:".concat(Z),{amount:"minAmountToExchange"===Z?(0,eo.T4)(c||0):"maxAmountToExchange"===Z?(0,eo.T4)(u||0):""})})]}):(0,n.jsxs)("div",{className:"rounded-xl bg-surface-subtle px-4 py-3 text-sm text-content-muted",children:[h.ZP.t("RewardPoints:disclaimerCouponUsed"),(0,eL.kC)((0,eL._6)(o||"")),h.ZP.t("RewardPoints:disclaimerCouponUsed2")]})}function eF(e){let{setFieldValue:t}=e,r=(0,g.I0)(),[s,l]=(0,a.useState)(""),[o,i]=(0,a.useState)(""),[d,c]=(0,a.useState)(null),u=(0,g.v9)(e=>{var t;return null===(t=e.auth)||void 0===t?void 0:t.spoonityLoginLoading}),m=e=>{let t=null==e?void 0:e.data;if((null==t?void 0:t.description)==="EXTERNAL_AUTHENTICATION_FAILED"){c(h.ZP.t("OrderSummary:spoonityLoginErrorInvalidCredentials"));return}let r="string"==typeof(null==t?void 0:t.message)?t.message:"string"==typeof(null==t?void 0:t.description)?t.description:null;c(r||h.ZP.t("OrderSummary:spoonityLoginError"))},x=!!s.trim()&&!!o&&!u;return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)("p",{className:"text-sm text-content-secondary",children:h.ZP.t("OrderSummary:spoonityLogin")}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"spoonity-username",className:"mb-1 block text-xs font-medium text-content-tertiary",children:h.ZP.t("OrderSummary:spoonityUsernameLabel")}),(0,n.jsx)("input",{id:"spoonity-username",type:"text",value:s,onChange:e=>{let r=e.target.value.trim();l(r),t("spoonityUsername",r)},placeholder:h.ZP.t("OrderSummary:spoonityUsernamePlaceholder"),className:"w-full rounded-xl border border-line bg-surface-subtle px-4 py-3 text-sm text-content placeholder:text-content-subtle focus:border-line-strong focus:bg-surface focus:outline-none",disabled:u})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"spoonity-password",className:"mb-1 block text-xs font-medium text-content-tertiary",children:h.ZP.t("CompleteProfile:password")}),(0,n.jsx)("input",{id:"spoonity-password",type:"password",value:o,onChange:e=>{i(e.target.value),t("spoonityPassword",e.target.value)},placeholder:h.ZP.t("CompleteProfile:passwordPlaceholder"),className:"w-full rounded-xl border border-line bg-surface-subtle px-4 py-3 text-sm text-content placeholder:text-content-subtle focus:border-line-strong focus:bg-surface focus:outline-none",disabled:u})]}),d&&(0,n.jsx)("p",{className:"text-xs text-error-strong",children:"string"==typeof d?d:h.ZP.t("OrderSummary:spoonityLoginError")}),(0,n.jsx)("button",{type:"button",onClick:()=>{s.trim()&&o&&!u&&(c(null),r(F.default.spoonityLogin(s.trim(),o,()=>c(null),m)))},disabled:!x,className:"w-full rounded-xl bg-primary px-5 py-3 text-sm font-semibold text-content-inverse transition-opacity hover:opacity-90 disabled:opacity-50",children:u?(0,n.jsx)("span",{className:"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}):h.ZP.t("OrderSummary:login")})]})}function eU(e){let{values:t,setFieldValue:r}=e,s=(0,g.I0)(),l=(0,g.v9)(e=>e.auth.currentUser),o=(0,g.v9)(e=>e.cart.cartLoading),a=(0,g.v9)(e=>{var t,r;return null===(t=e.cart)||void 0===t?void 0:null===(r=t.coupon)||void 0===r?void 0:r.appliedCoupon}),i=(0,g.v9)(e=>e.cart.loyaltyPoints),d=(0,g.v9)(e=>{var t,r,n;return null===(t=e.core)||void 0===t?void 0:null===(r=t.settings)||void 0===r?void 0:null===(n=r.loyaltyProgramParams)||void 0===n?void 0:n.name}),c=(0,g.v9)(e_.S),u=(0,g.v9)(e=>{var t,r;return null===(t=e.core)||void 0===t?void 0:null===(r=t.settings)||void 0===r?void 0:r.spoonityLoyaltyProgram}),m=null==l?void 0:l.points,x=m&&m.moneyAvailable>0,p=u&&l&&!(null==m?void 0:m.availablePoints),v=t.onlyPay,f=parseInt(String(null!=i?i:0),10)>0;return(0,n.jsxs)("div",{className:v?"pointer-events-none opacity-60":"",children:[(0,n.jsx)("h3",{className:"mb-3 text-base font-semibold",children:h.ZP.t("CheckoutSection:discounts")}),l?(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(eD,{values:t,setFieldValue:r}),f&&!c&&(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-xl bg-warning-soft px-4 py-3",children:[(0,n.jsxs)("span",{className:"text-sm font-medium text-warning-strong",children:[d||"",": -",(0,eo.T4)(i)]}),(0,n.jsx)("button",{type:"button",onClick:()=>{o||(s(U.ZP.removeCoupon()),new Promise(function(){for(var e=arguments.length,r=Array(e),n=0;n<e;n++)r[n]=arguments[n];s(U.ZP.addDiscount({couponData:{coupon:(null==a?void 0:a.code)||"",paymentMethod:null==t?void 0:t.paymentMethod},loyaltyData:{cashToExchange:null}},r))}))},disabled:o,className:"rounded-full p-1 text-warning transition-colors hover:bg-warning-soft",children:(0,n.jsx)(eT.Z,{className:"h-4 w-4"})})]}),p&&(0,n.jsx)(eF,{setFieldValue:r}),c&&l&&!p&&x&&(0,n.jsx)(eV,{values:t,setFieldValue:r})]}):(0,n.jsxs)("div",{className:"flex flex-col gap-3 rounded-xl bg-surface-subtle px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[(0,n.jsxs)("span",{className:"text-sm text-content-muted",children:[h.ZP.t("CompleteProfile:".concat(c&&!u?"couponAndLoyaltyProgram":"coupon")),c&&!u&&d?" ".concat(d):""]}),(0,n.jsx)("button",{type:"button",onClick:()=>s(B.ZP.openModal(Y.ee.LOGIN)),className:"shrink-0 self-start whitespace-nowrap rounded-lg border border-primary px-4 py-2 text-sm font-semibold text-primary transition-colors hover:bg-primary hover:text-content-inverse sm:self-auto sm:border-0 sm:bg-transparent sm:p-0 sm:underline sm:hover:bg-transparent sm:hover:text-primary",children:h.ZP.t("CompleteProfile:login")})]})]})}r(64854);var eH=r(21656),eB=r(99932),eY=r(60044),eG=r(10130),eq=r(82215);function ez(){return(0,n.jsxs)("div",{className:"animate-pulse space-y-3","data-testid":"mp-brick-skeleton",children:[(0,n.jsx)("div",{className:"h-3 w-28 rounded bg-surface-strong"}),(0,n.jsx)("div",{className:"h-12 rounded-md bg-surface-strong"}),(0,n.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,n.jsx)("div",{className:"h-12 rounded-md bg-surface-strong"}),(0,n.jsx)("div",{className:"h-12 rounded-md bg-surface-strong"})]}),(0,n.jsx)("div",{className:"h-12 rounded-md bg-surface-strong"})]})}var eK=r(83620);let eW=l()(()=>Promise.all([r.e(9206),r.e(6410)]).then(r.bind(r,46410)),{loadableGenerated:{webpack:()=>[46410]},ssr:!1}),eQ="paymentMethod";function e$(e){var t,r;let{values:s,setFieldValue:l,errors:o,submitCount:i,mercadoPagoRef:d,onMercadoPagoComplete:c,isFixed:u}=e,m=(0,g.I0)(),[x,p]=(0,a.useState)(!1),v=(0,a.useRef)(!1),{currentSubsidiary:f}=(0,g.v9)(e=>e.searchStore),b=(0,g.v9)(e=>e.searchStore[z.mq]),y=(0,g.v9)(e=>e.order[G.sp.FUTURE_ORDER]),{total:j}
1=(0,g.v9)(e=>e.cart),{currentUser:P}=(0,g.v9)(e=>e.auth),k=(0,g.v9)(e=>e.core.settings),C=(null==f?void 0:f.paymentMethods)||{},{handleSelect:S,handleSelectCreditCard:w,sortedMethods:Z,isCashEnabled:E,subscriptionMethodEnabled:O}=(0,eG.Z)(C,l,s),{creditCardsFilteredByType:T,isKushkiCardSubscriptionEnabled:_}=(0,eH.Z)({subscriptionMethodEnabled:O}),I=!!(null==y?void 0:y.date),M=s[eQ],D=(0,a.useMemo)(()=>I?Z.reduce((e,t)=>{let r=t.name===A.ig.cash,n=(null==k?void 0:k.allowCashForFutureOrders)&&("number"!=typeof k.maxCashPaymentAmount||j<=k.maxCashPaymentAmount);if(r&&!n)return e;let s=t.isOnline||r&&n;return s?[...e,t]:e},[]):Z,[I,Z,k,j]),R="draft"===s.status&&(null===(t=s.originalOrder)||void 0===t?void 0:t.paymentMethodType),L=!!R;(0,a.useEffect)(()=>{var e;if(R&&(null===(e=s.originalOrder)||void 0===e?void 0:e.paymentMethodType)){let e=(0,eL._A)(s.originalOrder.paymentMethodType.replace(/Payment$/,"").replace("Webpay","online"));e!==M&&l(eQ,e)}},[R,null===(r=s.originalOrder)||void 0===r?void 0:r.paymentMethodType,M,l]),(0,a.useEffect)(()=>{if(L||s.idCard||v.current)return;if(O&&T.length>0){let e=T[T.length-1];w(O,e.id,e.token)();return}let e=D.some(e=>e.name===M);M&&e||!(D.length>0)||l(eQ,D[0].name)},[D,M,l,L,s,O,T,w]);let V=s.paymentMethod===A.ig.mercadoPagoCard,F=(0,a.useMemo)(()=>{let e=(0,eq.d$)(C,b);return e.some(e=>e.name===A.ig.mercadoPagoCard)},[C,b]),U=V&&F;(0,a.useEffect)(()=>{if(!U){p(!1);return}let e="__mp_paymentmethods_brick_owner__",t=window;if(!t)return;let r=!u,n=r?"desktop":"mobile",s=t[e];return!s||r&&"mobile"===s?(t[e]=n,p(!0)):s===n?p(!0):p(!1),()=>{setTimeout(()=>{t[e]===n&&(t[e]=!1)},300)}},[U,u]);let H=(0,a.useCallback)((e,t)=>{if(!e)return;m(N.default.setMercadoPagoToken(e)),m(N.default.setMercadoPagoDeviceId(t));let r=document.getElementById("v2-checkout-form");r&&r.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0})),null==c||c()},[m,c]);return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(eK.q,{methods:D,savedCards:T,selectedMethodName:M,selectedCardId:s.idCard||null,onSelectMethod:e=>{v.current=!0,S(e)()},onSelectCard:(e,t,r)=>{v.current=!0,w(e,t,r)()},onUseNewCard:()=>{let e=D.find(e=>e.name===A.ig.mercadoPagoCard||e.name===A.ig.kushki||e.name===A.ig.powertranz);e&&(v.current=!0,S(e.name)())},isLocked:L,renderCardForm:e=>e!==A.ig.kushki||s.idCard?e===A.ig.powertranz?(0,n.jsx)(eY.f,{}):e===A.ig.mercadoPagoCard?U&&x?(0,n.jsx)("div",{children:(0,n.jsx)(eW,{ref:d,total:j,userEmail:null==P?void 0:P.email,onTokenReceived:H,onSubmitRequest:()=>{let e=document.querySelector('[data-testid="card_payment_submit_button"]');null==e||e.click()}})},"mp-".concat((null==f?void 0:f.id)||"none","-").concat(u?"mobile":"desktop")):(0,n.jsx)(ez,{}):null:(0,n.jsx)(eB.t,{enableOptionSubscribeCard:_})}),!E&&(0,n.jsx)("p",{className:"text-sm text-content-muted",children:h.ZP.t("PaymentMethods:cashDisabled")}),i>0&&o.paymentMethod&&(0,n.jsx)("p",{className:"text-sm text-error",children:o.paymentMethod})]})}function eX(e){return(0,n.jsx)(e$,{...e})}var eJ=r(32927);let e0=/[^a-zA-ZÃñáÃéÃÃÃóÃúÃüÃçà ]/g,e2=e=>e.replace(e0,""),e1=e=>(0,E.Y1)(e,Z.N,Z.N.phoneValidation);function e4(e){let{values:t,setFieldValue:r,errors:s={},submitCount:l=0}=e,o=(0,g.v9)(e=>e.auth.currentUser);(0,a.useEffect)(()=>{if(o){var e,t;r(et._.NAME,null!==(e=o.name)&&void 0!==e?e:""),r(et._.EMAIL,null!==(t=o.email)&&void 0!==t?t:""),r(et._.PHONE,(0,E.Ov)(o.phone,Z.N))}},[o,r]),(0,a.useEffect)(()=>{var e;if(!o)return;let t=(0,eJ.c)(Z.N),n=(0,eJ.r)({name:t.name,phone:t.phone});n.validate({name:null!==(e=o.name)&&void 0!==e?e:"",phone:(0,E.Ov)(o.phone,Z.N)}).catch(()=>r(et._.IS_EDITING_USER,!0))},[o,r]);let i=t.isEditingUser||!o,d=!i||t.onlyPay,c=l>0||!!t.isEditingUser,u=c?s[et._.NAME]:void 0,m=c?s[et._.PHONE]:void 0,x=c?s[et._.EMAIL]:void 0,p=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="border-line focus:border-line-strong";return t?r="border-error/60 focus:border-error":(e||d)&&(r="border-line-subtle bg-surface-muted text-content-muted"),"w-full rounded-xl border bg-surface px-4 py-2.5 text-base text-content transition-colors placeholder:text-content-subtle focus:outline-none ".concat(r)};return(0,n.jsx)("div",{className:t.onlyPay?"pointer-events-none opacity-60":"",children:(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-content-secondary",children:h.ZP.t("CompleteProfile:name")}),(0,n.jsx)("input",{id:et._.NAME,name:et._.NAME,type:"text",value:t[et._.NAME]||"",onChange:e=>r(et._.NAME,e2(e.target.value)),placeholder:h.ZP.t("CompleteProfile:fullnamePlaceholder"),readOnly:d,className:p(!1,!!u)}),u&&(0,n.jsx)("p",{className:"mt-1 text-xs text-error",children:u})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-content-secondary",children:h.ZP.t("CompleteProfile:phone")}),(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)("span",{className:"flex items-center rounded-l-xl border border-r-0 border-line bg-surface-subtle px-3 text-base text-content-muted",children:Z.N.phonePrefix}),(0,n.jsx)("input",{id:et._.PHONE,name:et._.PHONE,type:"tel",value:t[et._.PHONE]||"",maxLength:Z.N.phoneValidation+4,onChange:e=>r(et._.PHONE,e1(e.target.value)),placeholder:Z.N.phonePlaceholder||h.ZP.t("CompleteProfile:phonePlaceholder"),readOnly:d,className:"".concat(p(!1,!!m)," !rounded-l-none")})]}),m&&(0,n.jsx)("p",{className:"mt-1 text-xs text-error",children:m})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-content-secondary",children:h.ZP.t("CompleteProfile:email")}),(0,n.jsx)("input",{id:et._.EMAIL,name:et._.EMAIL,type:"email",value:t[et._.EMAIL]||"",onChange:e=>r(et._.EMAIL,e.target.value),placeholder:h.ZP.t("CompleteProfile:emailPlaceholder"),readOnly:!!o||d,className:p(!!o,!!x)}),x&&(0,n.jsx)("p",{className:"mt-1 text-xs text-red-500",children:x})]})]})})}var e9=r(11731);function e3(){let{subtotal:e,total:t,discount:r,deliveryFee:s,tip:l,isDelivery:o,hasTip:a}=(0,V.Z)(),i=(0,g.v9)(e=>e.cart.cartLoading),d=(0,g.v9)(e=>e.cart.pricingSettled),c=(0,g.v9)(e=>{var t,r;return null===(t=e.cart)||void 0===t?void 0:null===(r=t.coupon)||void 0===r?void 0:r.appliedCoupon}),u=(0,g.v9)(e=>e.cart.loyaltyPoints),m=(0,g.v9)(e=>{var t,r,n;return null===(t=e.core)||void 0===t?void 0:null===(r=t.settings)||void 0===r?void 0:null===(n=r.loyaltyProgramParams)||void 0===n?void 0:n.name}),x=(0,g.v9)(e=>e.cart.serviceFee)||0,p=c&&r>0,v=parseInt(String(null!=u?u:0),10)>0,f=(0,e9.r)(),b=!f&&d&&e>0&&t<=1;return(0,n.jsxs)("div",{className:"space-y-2.5",children:[(0,n.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,n.jsx)("span",{className:"text-content-muted",children:"Subtotal"}),(0,n.jsx)("span",{className:"text-content",children:(0,eo.T4)(e)})]}),o&&s>0&&(0,n.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,n.jsx)("span",{className:"text-content-muted",children:h.ZP.t("SimpleOrderDetail
1:deliveryFee")}),(0,n.jsx)("span",{className:"text-content",children:(0,eo.T4)(s)})]}),o&&x>0&&(0,n.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,n.jsx)("span",{className:"text-content-muted",children:h.ZP.t("SimpleOrderDetail:serviceFee")}),(0,n.jsx)("span",{className:"text-content",children:(0,eo.T4)(x)})]}),a&&l>0&&(0,n.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,n.jsx)("span",{className:"text-content-muted",children:h.ZP.t("SimpleOrderDetail:tip")}),(0,n.jsx)("span",{className:"text-content",children:(0,eo.T4)(l)})]}),p&&(0,n.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,n.jsx)("span",{className:"text-success",children:h.ZP.t("SimpleOrderDetail:discount")}),(0,n.jsxs)("span",{className:"text-success",children:["-",(0,eo.T4)(null==c?void 0:c.value)]})]}),v&&(0,n.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,n.jsx)("span",{className:"text-success",children:m||""}),(0,n.jsxs)("span",{className:"text-success",children:["-",(0,eo.T4)(u)]})]}),(0,n.jsxs)("div",{className:"flex justify-between pt-1",children:[(0,n.jsx)("span",{className:"text-base font-bold text-content",children:h.ZP.t("OrderSummary:total")}),(0,n.jsx)("span",{className:"text-base font-bold text-content transition-opacity duration-200 ".concat(i&&!d?"opacity-40":"opacity-100"),"data-testid":"checkout-total",children:f?"â":b?h.ZP.t("OrderSummary:free"):(0,eo.T4)(t)})]})]})}var e5=r(4172),e6=r(32807);function e7(e){let{values:t,setFieldValue:r}=e,{answers:s,handleOnChange:l}=(0,e6.Z)({setFieldValue:r,values:t});return s.length?(0,n.jsx)("div",{className:"space-y-4 ".concat(t.onlyPay?"pointer-events-none opacity-60":""),children:s.map(e=>{let{answerFieldName:r,...s}=e;return(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{htmlFor:"checkout-answer-".concat(s.checkoutQuestionId),className:"mb-1.5 block text-sm font-medium text-content-secondary",children:s.checkoutQuestion}),(0,n.jsx)("textarea",{id:"checkout-answer-".concat(s.checkoutQuestionId),name:r,onChange:l(r,s),className:"w-full resize-none rounded-xl border border-line bg-surface-subtle px-3 py-2.5 text-sm text-content transition-colors placeholder:text-content-subtle focus:border-line-strong focus:bg-surface focus:outline-none",placeholder:h.ZP.t("Questions:answerPlaceholder"),value:s.answer,maxLength:e5.W,disabled:t.onlyPay,rows:3})]},s.checkoutQuestionId)})}):null}var e8=r(40034),te=r(6189),tt=r(2972);function tr(e){var t;let{setFieldValue:r}=e,s=(0,g.I0)(),l=(0,tt.Z)(),{setTipValue:o,setTipLabel:i,tipValues:d}=(0,te.Z)(),[c,u]=(0,a.useState)(!1),[m,x]=(0,a.useState)(""),[p,v]=(0,a.useState)(!1),[f,b]=(0,a.useState)(null),y=(0,g.v9)(e=>{var t,r;return null===(t=e.core)||void 0===t?void 0:null===(r=t.settings)||void 0===r?void 0:r.brandPrimary}),j=(0,a.useMemo)(()=>(0,eM.N)(y)?"text-content-inverse":"text-content",[y]),P=(0,g.v9)(e=>{var t;return null===(t=e.cart)||void 0===t?void 0:t.subtotal}),k=(0,g.v9)(e=>{var t,r;return null===(t=e.searchStore)||void 0===t?void 0:null===(r=t.delivery)||void 0===r?void 0:r.defaultTip}),C=(0,g.v9)(e=>{var t;return null===(t=e.searchStore)||void 0===t?void 0:t.dispatchType}),S=(0,g.v9)(e=>{var t;return null===(t=e.cart)||void 0===t?void 0:t.deliveryMethod}),w=(0,M.nS)(C,S),Z=e=>w&&e>e8.fh?e8.fh:e,E=null!==(t=null!=f?f:null==k?void 0:k.tip)&&void 0!==t?t:5;if((0,a.useEffect)(()=>{if(!l||p)return;let e=Z(o(E));r(et._.TIP,e),s(N.default.setTip(e,et._.TIP))},[l,p,P,k,f,w]),!l)return null;let O=e=>{b(e),v(!1),u(!1)};return(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"mb-3 text-base font-semibold",children:h.ZP.t("SimpleOrderDetail:tip")}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[d.map(e=>{let t=!p&&e===E;return(0,n.jsx)("button",{type:"button",onClick:()=>O(e),className:"rounded-full border px-4 py-2 text-sm font-medium transition-all ".concat(t?"border-primary !bg-primary ".concat(j):"border-line bg-surface text-content-secondary hover:border-line-strong"),children:i(e)},e)}),(0,n.jsx)("button",{type:"button",onClick:()=>u(!c),className:"rounded-full border px-4 py-2 text-sm font-medium transition-all ".concat(p?"border-primary !bg-primary ".concat(j):"border-line bg-surface text-content-secondary hover:border-line-strong"),children:h.ZP.t("Tip:other")})]}),c&&(0,n.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,n.jsx)("input",{type:"number",value:m,onChange:e=>x(e.target.value),placeholder:"0",className:"w-32 rounded-xl border border-line bg-surface-subtle px-4 py-2.5 text-sm focus:border-line-strong focus:bg-surface focus:outline-none"}),(0,n.jsx)("button",{type:"button",onClick:()=>{let e=parseInt(m,10);e>0&&(v(!0),b(null),r(et._.TIP,e),s(N.default.setTip(e,et._.TIP)),u(!1))},className:"rounded-xl !bg-primary px-4 py-2.5 text-sm font-semibold transition-opacity hover:opacity-90 ".concat(j),children:h.ZP.t("OrderSummary:apply")})]})]})}function tn(){let e=(0,g.v9)(e=>e.searchStore.currentSubsidiary),t=(0,g.v9)(e=>e.searchStore.dispatchType===M.CK.PICKUP),r=(0,g.v9)(e=>{var t,r;return null===(t=e.auth.address)||void 0===t?void 0:null===(r=t.current)||void 0===r?void 0:r.textAddress}),s=(0,g.v9)(e=>e.order.futureOrder),l=(0,g.v9)(e=>e.cart.cart.some(e=>{let{product:t}=e;return t.deferred}));if(!e)return null;let{pickUpWaitTime:o,deliveryWaitTime:a}=e,i=t?ed.Z:ec.Z,d=s?em:ex.Z;return(0,n.jsxs)("div",{className:"overflow-hidden rounded-lg border border-line",children:[(0,n.jsxs)("div",{className:"flex items-start gap-2 p-3",children:[(0,n.jsx)(i,{className:"mt-0.5 h-5 w-5 shrink-0 text-content-secondary","aria-hidden":"true"}),(0,n.jsx)("span",{className:"text-sm text-content",children:t?(0,n.jsxs)(n.Fragment,{children:[h.ZP.t("CheckoutSection:pickUpFrom",{store:e.name,interpolation:{escapeValue:!1}})," ",e.textAddress&&(0,n.jsx)("span",{className:"font-semibold",children:e.textAddress})]}):(0,n.jsxs)(n.Fragment,{children:[h.ZP.t("CheckoutSection:deliveryTo",{address:""})," ",(0,n.jsx)("span",{className:"font-semibold",children:r})]})})]}),(0,n.jsx)("hr",{className:"mx-3 border-line-subtle"}),(0,n.jsxs)("div",{className:"flex items-start gap-2 p-3",children:[(0,n.jsx)(d,{className:"mt-0.5 h-5 w-5 shrink-0 text-content-secondary","aria-hidden":"true"}),(0,n.jsx)("span",{className:"text-sm text-content",children:l?h.ZP.t("FutureOrder:
1asap"):s?"".concat((0,ef.dayFormat)(s.date,!1,!0),". ").concat(s.time,"."):h.ZP.t("DispatchDetails:approximateTime",{time:t?o:a})})]})]})}function ts(){var e;let t=(0,g.v9)(e=>e.cart.cart),r=t.reduce((t,r)=>t+(null!==(e=r.count)&&void 0!==e?e:0),0);return(0,n.jsxs)("div",{children:[(0,n.jsxs)("span",{className:"text-xs font-semibold uppercase tracking-wide text-content-subtle",children:[r," ",h.ZP.t("SimpleOrderDetail:".concat(r>1?"products":"product"))]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col",children:t.map(e=>{let t=(0,ev.Jt)(e.items,e=>e.name),r=(0,ev.xj)(e.items,e.count,e.basePrice);return(0,n.jsxs)("li",{className:"flex items-baseline gap-3 border-b border-line-subtle py-2.5 last:border-b-0",children:[(0,n.jsxs)("span",{className:"shrink-0 rounded-md bg-surface-muted px-1.5 py-0.5 text-xs font-semibold tabular-nums text-content-secondary",children:[e.count,"\xd7"]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"text-sm text-content",children:e.product.name}),t.length>0&&(0,n.jsx)("p",{className:"mt-0.5 text-xs text-content-muted",children:t.join(", ")})]}),(0,n.jsx)("span",{className:"shrink-0 text-sm tabular-nums text-content",children:(0,eo.T4)(r)})]},e.hash)})})]})}var tl=function(e){let{values:t}=e,[r,s]=(0,a.useState)(!1),l=(0,g.I0)(),o=(0,g.v9)(e=>{var t;return null===(t=e.modal)||void 0===t?void 0:t["".concat(Y.ee.CONFIRMATION_ORDER,"ModalIsOpen")]}),i=(0,a.useRef)(),d=(0,a.useRef)(t);d.current=t;let c=(0,a.useCallback)(()=>{clearTimeout(i.current),l(B.ZP.closeModal(Y.ee.CONFIRMATION_ORDER))},[l]);return(0,a.useEffect)(()=>(o&&(s(!1),i.current=setTimeout(()=>{s(!0),l(N.default.handleCreateOrder(d.current))},eh.o)),()=>{i.current&&clearTimeout(i.current)}),[l,o]),(0,n.jsx)(u.u_,{open:!!o,onClose:c,dismissible:!1,fullHeight:!0,title:h.ZP.t("CancelOrderCreationModal:processingOrder"),footer:(0,n.jsx)("button",{type:"button",disabled:r,onClick:c,className:"w-full rounded-xl border border-line bg-surface px-6 py-3 text-sm font-semibold text-content transition-colors hover:bg-surface-muted disabled:cursor-not-allowed disabled:opacity-50",children:h.ZP.t("CancelOrderCreationModal:cancel")}),children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"rounded-xl bg-surface-muted p-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,n.jsx)(ep.Z,{className:"h-5 w-5 shrink-0 animate-spin text-primary motion-reduce:animate-none","aria-hidden":"true"}),(0,n.jsx)("p",{className:"text-sm text-content-secondary",children:h.ZP.t("CancelOrderCreationModal:processingHint")})]}),(0,n.jsx)("div",{className:"mt-2.5 h-1.5 overflow-hidden rounded-full bg-line",children:(0,n.jsx)("div",{className:"h-full w-full rounded-full bg-primary motion-reduce:!animate-none",style:{animation:"confirm-progress ".concat(eh.o,"ms linear forwards")}},o?"running":"idle")})]}),(0,n.jsx)(tn,{}),(0,n.jsx)(ts,{}),(0,n.jsx)(e3,{})]})})};let to=()=>{let e=document.querySelector('[data-testid="card_payment_submit_button"]');if(e&&!e.disabled)return e.click(),!0;let t=document.querySelector("[data-mp-brick-root]");if(!t)return!1;let r=Array.from(t.querySelectorAll("button")).find(e=>{let t=(e.textContent||"").toLowerCase();return(t.includes("pagar")||t.includes("pay"))&&!e.disabled});return!!r&&(r.click(),!0)};function ta(e){let{submitCount:t,errors:r,tenant:n,cartTotal:s,cartSize:l,paymentMethod:o}=e,i=(0,a.useRef)(0);return(0,a.useEffect)(()=>{if(t>i.current){i.current=t;let e=Object.keys(r);e.length>0&&C.Z.checkoutValidationError({tenant:n,errorFields:e,cartTotal:s,cartSize:l,paymentMethod:o})}},[t]),null}function ti(e){let{paymentMethod:t,idCard:r,onReset:n}=e;return(0,a.useEffect)(()=>{n()},[t,r,n]),null}function td(e){let{isFreeOrder:t,paymentMethod:r,setFieldValue:n}=e;return(0,a.useEffect)(()=>{t&&r!==A.ig.noCharge&&n(et._.PAYMENT_METHOD,A.ig.noCharge)},[t,r,n]),null}function tc(e){let{show:t,className:r}=e;return t?(0,n.jsx)("div",{className:r,children:(0,n.jsx)(_.Z,{variant:"error",text:h.ZP.t("V2Common:paymentFormNotReady")})}):null}let tu="CALCULATE_DELIVERY_ERROR";function tm(e){let{show:t,errorCode:r,alternateStoreName:s,onRetry:l,onChangeAddress:o}=e;if(!t)return null;let a="V2Common:retry";
1r===H.uz.NO_DELIVERY_ADDRESS?a="V2Pricing:enterAddress":r===tu&&(a="V2Pricing:changeAddressOrStore");let i="V2Common:retry"!==a;return(0,n.jsxs)("div",{className:"mt-3 rounded-lg border border-error/40 bg-error-soft p-3","data-testid":"checkout-pricing-error",children:[(0,n.jsx)(_.Z,{variant:"error",text:function(e,t){if(e===H.uz.NO_DELIVERY_ADDRESS)return h.ZP.t("V2Pricing:noAddressBody");if(e===tu){let e=h.ZP.t("V2Pricing:deliveryUnavailableBody");return t?"".concat(e," ").concat(h.ZP.t("V2Pricing:alternateStoreBody",{storeName:t})):e}return"DEFAULT_ERROR"===e?h.ZP.t("V2Pricing:networkBody"):h.ZP.t("V2Pricing:genericBody")}(r,s)}),(0,n.jsx)("button",{type:"button",onClick:i?o:l,"data-testid":i?"checkout-pricing-cta":"checkout-pricing-retry",className:"mt-2 block text-sm font-semibold text-primary underline",children:h.ZP.t(a)})]})}function tx(){var e;let{v2StoreContextHydrated:t=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(0,o.useRouter)(),s=(0,g.I0)(),l=(0,a.useRef)(null),[i,d]=(0,a.useState)(!1),[c,u]=(0,a.useState)(!1),m=(0,a.useCallback)(()=>u(!1),[]),[x,p]=(0,a.useState)(0),v=(0,a.useCallback)(()=>p(e=>e+1),[]),{isDesktop:b,isHydrated:H}=(0,S.Z)(),es=(0,a.useMemo)(()=>{var e,t,r;return{...ee.bl,[et._.COUPON]:(null===(e=el().getCoupon)||void 0===e?void 0:null===(t=e.call(el()))||void 0===t?void 0:null===(r=t.appliedCoupon)||void 0===r?void 0:r.code)||""}},[]),{cart:ed,total:ec}=(0,g.v9)(e=>e.cart),{currentUser:eu,address:em}=(0,g.v9)(e=>e.auth),ex=(0,g.v9)(j.j),{mandatoryTermsAndConditions:ep,tenant:ev,minPriceForDelivery:eh,primaryLogo:ef,commerceName:eb}=(0,g.v9)(e=>e.core.settings),ey=(0,g.v9)(e=>{var t;return null===(t=e.searchStore)||void 0===t?void 0:t.currentSubsidiary}),eg=(0,g.v9)(e=>e.searchStore[z.Ie]),ej=(0,g.v9)(e=>e.searchStore[z.mq]),eP=(0,g.v9)(e=>e.core.settings.subscriptionStatus||D.q.ACTIVE),{cartLoading:eS,pricingSettled:ew}=(0,g.v9)(e=>e.cart),eZ=(0,g.v9)(e=>e.order.kushkiTokenError),eE=(0,g.v9)(e=>e.order.createOrderLoading),eT=(0,g.v9)(e=>e.pages.builderPages||[]),e_=ej===M.CK.DELIVERY,eI=(0,P.Z)(ev),{total:eM}=(0,V.Z)(),{total:eA}=(0,T.Cj)(),{orderDisabled:eD,futureOrdersEnabled:eR,storeClosed:eL}=(0,L.Z)(),eV=(0,T.Yt)(),eF=(0,g.v9)(e=>e.order[G.sp.FUTURE_ORDER]),{subtotal:eH}=(0,g.v9)(e=>e.cart),eB=eH>=(eh||0),eY=e_&&!eB,eG=null===(e=(0,O.LI)(eT))||void 0===e?void 0:e.url,eq=ed.some(e=>!e.addedByCoupon&&(0,k.g$)(e)),ez=(0,T.rC)(),eK=(0,g.v9)(e=>e.cart.pricingError),eW=(null==eg?void 0:eg.id)&&(null==ey?void 0:ey.id)&&String(eg.id)!==String(ey.id)?eg.name:void 0,eQ=0===ed.length,e$=!ez&&!eQ&&ew&&eM<=1,eJ=!ey||eY||eS||eD||eL&&!eR&&!eF||(0,D.o)(eP)||i||eq||ez,e0=()=>i?h.ZP.t("V2Common:validating"):ez?h.ZP.t("V2Common:pricingUnavailableButton"):eq?h.ZP.t("OrderSummary:completeOptionsToContinue",{defaultValue:"Completa los modificadores de tus productos"}):eY?h.ZP.t("OrderSummary:minPriceDelivery",{price:(0,eo.T4)(eh)}):e$?"".concat(h.ZP.t("OrderSummary:buy")," ").concat(h.ZP.t("OrderSummary:free")):"".concat(h.ZP.t("OrderSummary:buy")," ").concat((0,eo.T4)(eM)),e2=(0,a.useCallback)(()=>{d(!1)},[]),e1=async(e,t,r,n)=>{if(e$){e.preventDefault(),r();return}if(t[et._.PAYMENT_METHOD]===A.ig.mercadoPagoCard&&!t.idCard){e.preventDefault();let t=await n();if(Object.keys(t).length>0){r();return}u(!1),d(!0),setTimeout(()=>{var e,t,r;let n=document.querySelector("[data-mp-brick-root]");n&&"function"==typeof n.scrollIntoView&&n.scrollIntoView({behavior:"smooth",block:"center"});let s=null!==(r=null===(e=l.current)||void 0===e?void 0:null===(t=e.submit)||void 0===t?void 0:t.call(e))&&void 0!==r?r:to();s||(d(!1),u(!0))},80),setTimeout(()=>d(!1),4e3);return}u(!1),r()},e9=(0,a.useCallback)(()=>{s(B.ZP.openModal(Y.ee.DELIVERY_OR_PICKUP))},[s]),[e5,e6]=(0,a.useState)(!1);(0,a.useEffect)(()=>{e6(!0)},[]),(0,a.useEffect)(()=>{e5&&(null==ey?void 0:ey.id)&&"no-store"!==eV.kind&&(eV.canCheckout||r.replace("/"))},[e5,null==ey?void 0:ey.id,eV.canCheckout,eV.kind,r]),(0,a.useEffect)(()=>{t&&ed.length&&!ey&&e9()},[ed,ey,e9,t]),(0,a.useEffect)(()=>{s(B.ZP.closeModal(Y.ee.ORDER_CREATION_STATUS)),ey&&s(q.default.checkIfStoreIsOpen())},[s,ey]);let e8=(0,a.useRef)(!1),te=(0,a.useRef)(!1);(0,a.useEffect)(()=>{ev&&!e8.current&&(e8.current=!0,en.Z.viewCheckoutPageEvent(),C.Z.checkoutStepViewed({tenant:ev,stepName:"checkout"}))},[ev]),(0,a.useEffect)(()=>{ed.length>0&&ew&&!te.current&&(te.current=!0,en.Z.beginCheckoutEvent(ex,ec,ed,ev))},[ed,ex,ec,ew,ev]);let tt=(0,a.useRef)(!1);return((0,a.useEffect)(()=>{eE&&(tt.current=!0)},[eE]),(0,w.Z)(()=>{!tt.current&&ed.length>0&&C.Z.checkoutAbandoned({tenant:ev,lastStep:"checkout",cartTotal:ec||eA,cartSize:ed.length,dispatchMethod:ej})}),(0,a.useEffect)(()=>{t&&null===eg&&e_&&(s(B.ZP.openModalWithData(Y.ee.DELIVERY_OR_PICKUP,{storeChanged:!0})),e9())},[eg,s,e_,e9,t]),(0,a.useEffect)(()=>
1{if(!e_||null===em||null===em.current)return;let{latitude:e,longitude:t}=em.current;e_&&e&&t&&s(q.default.getStoreDelivery({lat:e,lng:t}))},[em,s,e_]),ed&&(!e_||em))?(0,n.jsx)(I.Z,{validationSchema:(0,er.p)(e_,ep),initialValues:es,onSubmit:(e,t)=>{var r;let{setFieldValue:n}=t;e.isEditingUser&&(s(F.default.updateUser(e)),n(et._.IS_EDITING_USER,!1)),null===(r=el().setProfile)||void 0===r||r.call(el(),{name:e.name,email:e.email,phone:(0,E.Wo)(e.phone,Z.N)}),s(N.default.clearKushkiTokenError()),s(B.ZP.openModal(Y.ee.CONFIRMATION_ORDER))},children:e=>{var t;let{values:o,handleSubmit:a,setFieldValue:i,errors:d,submitCount:u,validateForm:p}=e,g=c&&(null==o?void 0:o.paymentMethod)===A.ig.mercadoPagoCard,j=e_?h.ZP.t("CheckoutSection:deliveryDetails"):h.ZP.t("CheckoutSection:pickupDetails");return(0,n.jsxs)("form",{id:"v2-checkout-form",onSubmit:a,className:"mx-auto max-w-app px-4 lg:px-6",children:[(0,n.jsx)(ea,{values:o,retryNonce:x}),(0,n.jsx)(ti,{paymentMethod:null==o?void 0:o.paymentMethod,idCard:null==o?void 0:o.idCard,onReset:m}),(0,n.jsx)(td,{isFreeOrder:e$,paymentMethod:null==o?void 0:o.paymentMethod,setFieldValue:i}),(0,n.jsx)(ta,{submitCount:u,errors:d,tenant:ev,cartTotal:ec,cartSize:ed.length,paymentMethod:null==o?void 0:o.paymentMethod}),(0,n.jsxs)("div",{className:"relative flex h-16 w-full items-center justify-center pt-2",children:[(0,n.jsxs)("button",{type:"button",onClick:()=>r.push(eG||"/"),className:"absolute left-0 flex items-center gap-1.5 text-sm text-content-muted transition-colors hover:text-content",children:[(0,n.jsx)(f.Z,{className:"h-4 w-4"}),h.ZP.t("CheckoutSection:back")]}),(0,n.jsx)(y(),{href:"/","aria-label":h.ZP.t("CheckoutSection:goToMenu"),className:"shrink-0",children:ef?(0,n.jsx)("div",{className:"relative aspect-[5/3] h-auto max-h-12 w-14",children:(0,n.jsx)("img",{src:ef,alt:eb||"",className:"h-full w-full object-contain"})}):(0,n.jsx)("span",{className:"font-title text-lg font-bold text-content",children:eb})})]}),(0,n.jsx)("div",{className:"pt-2 lg:pt-4",children:(0,n.jsx)("h1",{className:"mb-4 text-2xl font-bold lg:mb-6 lg:text-3xl",children:h.ZP.t("V2Common:checkout")})}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-6 pb-24 lg:grid-cols-[minmax(0,3fr)_minmax(0,2fr)] lg:pb-8",children:[(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsx)(ei,{title:j,children:(0,n.jsx)(eO,{values:o,setFieldValue:i,errors:d})}),(0,n.jsxs)(ei,{title:h.ZP.t("CheckoutSection:contactInfo"),headerRight:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[eu&&(0,n.jsx)("button",{type:"button",onClick:o.isEditingUser?()=>{s(F.default.updateUser(o)),i(et._.IS_EDITING_USER,!1)}:()=>i(et._.IS_EDITING_USER,!0),className:"text-sm font-semibold text-primary underline",children:h.ZP.t(o.isEditingUser?"Profile:editDone":"Profile:editData")}),(0,n.jsx)("button",{type:"button",onClick:eu?()=>{i(et._.NAME,""),i(et._.EMAIL,""),i(et._.PHONE,""),s(U.ZP.removeCoupon()),s(F.default.closeSession())}:()=>s(B.ZP.openModal(Y.ee.LOGIN)),className:"text-sm font-semibold text-primary underline",children:h.ZP.t(eu?"ProfileLinks:closeSession":"CompleteProfile:login")})]}),children:[(0,n.jsx)(e4,{values:o,setFieldValue:i,errors:d,submitCount:u}),eI&&(0,n.jsx)("div",{className:"mt-4 border-t border-line pt-4",children:(0,n.jsx)(W.Z,{values:o,setFieldValue:i})})]}),!!(null==ey?void 0:null===(t=ey.checkoutQuestions)||void 0===t?void 0:t.length)&&(0,n.jsx)(ei,{title:h.ZP.t("CheckoutSection:questions"),children:(0,n.jsx)(e7,{values:o,setFieldValue:i})}),(0,n.jsx)(ei,{title:h.ZP.t("CheckoutSection:paymentMethods"),children:(0,n.jsxs)("div",{className:"space-y-4",children:[e$?(0,n.jsx)("p",{className:"text-sm text-content-muted",children:h.ZP.t("OrderSummary:noPaymentRequired")}):(0,n.jsxs)(n.Fragment,{children:[eZ&&(0,n.jsx)("div",{className:"mb-3",children:(0,n.jsx)(_.Z,{variant:"error",text:eZ.error})}),(0,n.jsx)(eX,{values:o,setFieldValue:i,errors:d,submitCount:u,mercadoPagoRef:l,onMercadoPagoComplete:e2,isFixed:!1})]}),(0,n.jsx)(eU,{values:o,setFieldValue:i}),(0,n.jsx)("div",{className:"border-t border-line pt-4",children:(0,n.jsx)(tr,{values:o,setFieldValue:i})})]})}),(0,n.jsx)(ei,{children:(0,n.jsx)(ek,{values:o,setFieldValue:i})})]}),(0,n.jsxs)("div",{className:"space-y-6 rounded-none bg-surface-muted p-4 lg:rounded-2xl lg:sticky lg:top-4 lg:self-start",children:[(0,n.jsxs)(ei,{title:h.ZP.t("CheckoutSection:orderSummary"),children:[(0,n.jsx)(eN,{values:o}),(0,n.jsxs)("div",{className:"mt-4 pt-0",children:[(0,n.jsx)(e3,{}),(0,n.jsx)(tm,{show:ez,errorCode:eK,alternateStoreName:eW,onRetry:v,onChangeAddress:e9}),eY&&(0,n.jsxs)("div",{className:"mt-3 rounded-lg bg-warning-soft p-3",children:[(0,n.jsx)(_.Z,{variant:"warning",text:h.ZP.t("OrderSummary:minPriceForDelivery",{remainingAmou
1nt:(0,eo.T4)((eh||0)-eH)})}),(0,n.jsx)(y(),{href:eG||"/",className:"mt-2 block text-sm font-semibold text-primary underline",children:h.ZP.t("OrderSummary:returnStore")})]})]})]}),(0,n.jsx)(eC,{values:o,setFieldValue:i,errors:d,submitCount:u}),(0,n.jsx)(tc,{show:g,className:"hidden lg:block"}),(0,n.jsx)("button",{type:"submit","data-testid":R.h.checkoutBuy,disabled:eJ,onClick:e=>e1(e,o,a,p),className:"hidden w-full rounded-xl !bg-primary py-4 text-base font-bold text-content-inverse shadow-md transition-colors hover:opacity-90 disabled:!bg-surface-strong lg:block",children:e0()})]})]}),H&&!1===b&&(0,n.jsxs)("div",{className:"fixed bottom-0 left-0 z-10 w-full border-t border-line bg-surface px-4 pb-[max(1rem,env(safe-area-inset-bottom))] pt-3",children:[(0,n.jsx)(tc,{show:g,className:"mb-2"}),(0,n.jsx)("button",{type:"submit","data-testid":R.h.checkoutBuy,disabled:eJ,onClick:e=>e1(e,o,a,p),className:"w-full rounded-xl !bg-primary py-4 text-base font-bold text-content-inverse shadow-md transition-colors hover:opacity-90 disabled:!bg-surface-strong",children:e0()})]}),(0,n.jsx)(tl,{values:o}),(0,n.jsx)(Q.Z,{}),(0,n.jsx)(X.Z,{}),(0,n.jsx)(J.Z,{}),(0,n.jsx)(K.Z,{}),(0,n.jsx)($.Z,{})]})}}):null}var tp=r(17251);let tv=()=>(0,n.jsxs)("div",{className:"mx-auto max-w-app px-4 lg:px-6",children:[(0,n.jsxs)("div",{className:"pt-6 lg:pt-8",children:[(0,n.jsx)(u.Od,{className:"mb-1 h-4 w-16"}),(0,n.jsx)(u.Od,{className:"mb-4 h-8 w-32"})]}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-6 pb-8 lg:grid-cols-[3fr_2fr]",children:[(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsx)(u.Od,{className:"h-48 w-full",rounded:"lg"}),(0,n.jsx)(u.Od,{className:"h-40 w-full",rounded:"lg"}),(0,n.jsx)(u.Od,{className:"h-56 w-full",rounded:"lg"})]}),(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsx)(u.Od,{className:"h-64 w-full",rounded:"lg"}),(0,n.jsx)(u.Od,{className:"h-12 w-full",rounded:"lg"})]})]})]}),th=l()(()=>Promise.all([r.e(9312),r.e(2333),r.e(5004),r.e(1149)]).then(r.bind(r,75004)),{loadableGenerated:{webpack:()=>[75004]},ssr:!1,loading:()=>(0,n.jsx)(tv,{})}),tf=()=>{let{v2StoreContextHydrated:e}=(0,x.X)();(0,c.w)();let{query:t}=(0,o.useRouter)(),r=!!t.order||!!t.authorization,[s,l]=(0,a.useState)(!1);return((0,a.useEffect)(()=>
1{l(!0)},[]),s)?r?(0,n.jsx)(m.SV,{scope:"CheckoutPrefillWithOrder",children:(0,n.jsx)(th,{})}):(0,n.jsx)(m.SV,{scope:"CheckoutScreen",children:(0,n.jsx)(tx,{v2StoreContextHydrated:e})}):(0,n.jsx)(tv,{})};tf.getLayout=function(e){return(0,n.jsxs)(d.p,{children:[(0,n.jsx)(p.Vw,{showHeader:!1,showFooter:!1,showCartBar:!1,showBrandBackground:!1,children:e}),(0,n.jsx)(tp.Q,{}),(0,n.jsx)(v.O,{}),(0,n.jsx)(i.D,{})]})};var tb=!0,ty=tf},45123:function(e,t,r){"use strict";r.d(t,{X:function(){return Z}});var n=r(31955),s=r(67294),l=r(26628),o=r(54865),a=r(18672),i=r(82586),d=r(83765),c=r(43919),u=r(4122),m=r(63253),x=r(4376),p=r(79011),v=r(19034),h=r(31842),f=r(2618);let{getCurrentUser:b,setAddress:y}=d.default,{getDefaultStoreId:g,getPopUpBanners:j}=c.default,{setMenuPreview:N}=u.default,{getLastOrder:P}=v.default,{getScheduledDateAvailability:k,getStoreData:C,getStoreDeliveryOptions:S,setDispatchType:w}=h.default;function Z(){let e=(0,l.I0)(),t=(0,l.oR)(),r=(0,s.useRef)(!1),[d,c]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{if(r.current)return;r.current=!0;let s=async()=>{try{var r,s,l,d,u,v,h,Z,E,O;let c=(null===(r=t.getState().core)||void 0===r?void 0:null===(s=r.settings)||void 0===s?void 0:s.tenant)||window.location.hostname.split(".")[0];
1c&&(0,o.sR)(c);let m=n.Z.get(i.r.accessToken),x=n.Z.get(i.r.guestUserToken),p=n.Z.get(i.r.dispatchType)||"store_delivery",j=n.Z.get(i.r.currentSubsidiary);if(m){(0,o.mC)(m);try{await e(b(void 0,void 0,m))}catch(e){console.error("[useV2Hydration] getCurrentUser failed:",e)}}else x&&(0,o.mC)(x);e(w(p));let T=(t,r)=>{e(N(!1)),t.futureOrdersEnabled&&e(k()).catch(e=>{console.warn("[useV2Hydration] availability prefetch failed (".concat(r,"):"),e)})};if(j)try{await e(C({id:j,dispatchType:p},{onSuccess:null,onFailure:null,skipNextActions:!0,skipCheckScheduledDateAvailability:!1,skipPersist:!0}));let r=t.getState(),n=null===(l=r.searchStore)||void 0===l?void 0:l.currentSubsidiary;if(null==n?void 0:n.id){T(n,"cookie");let t=null===(d=r.auth)||void 0===d?void 0:null===(u=d.address)||void 0===u?void 0:u.current;"in_store"!==p&&(null==t?void 0:t.latitude)&&(null==t?void 0:t.longitude)&&!(null==t?void 0:t.isStoreAddress)&&e(S({lat:t.latitude,lng:t.longitude})).catch(()=>{})}}catch(e){console.error("[useV2Hydration] getStoreData failed:",e)}else{let r=!1;try{let n=await (0,f.t)(e,t.getState,p);n&&(T(n,"cart-store"),r=!0)}catch(e){console.warn("[useV2Hydration] cart-store restore failed:",e)}let n=!1,s=m||x;if(!r&&s)try{await e(P(s));let r=null===(v=t.getState().order)||void 0===v?void 0:v.lastOrder,l=null==r?void 0:r.storeId,o=null!==(h=null==r?void 0:r.dispatchMethod)&&void 0!==h?h:p;if(l){e(w(o));let s=o!==a.CK.PICKUP&&(null==r?void 0:r.userAddress)?{placeId:r.googlePlaceId,textAddress:r.userAddress,description:r.userAddress,latitude:r.userLatitude,longitude:r.userLongitude,city:r.userCity,hasStreetNumber:!0}:null;s&&e(y(s)),await e(C({id:String(l),dispatchType:o},{onSuccess:null,onFailure:null,skipNextActions:!0,skipCheckScheduledDateAvailability:!1,skipPersist:!1}));let i=null===(Z=t.getState().searchStore)||void 0===Z?void 0:Z.currentSubsidiary;(null==i?void 0:i.id)&&(T(i,"last-order"),n=!0)}}catch(e){console.warn("[useV2Hydration] last-order restore failed:",e)}if(!r&&!n)try{await e(g());let r=null===(E=t.getState().core)||void 0===E?void 0:E.defaultStoreId;if(r){e(N(!0)),await e(C({id:r,dispatchType:p},{onSuccess:null,onFailure:null,skipNextActions:!0,skipCheckScheduledDateAvailability:!0,skipPersist:!0}));let n=null===(O=t.getState().searchStore)||void 0===O?void 0:O.currentSubsidiary;(null==n?void 0:n.id)&&n.futureOrdersEnabled&&e(k()).catch(e=>{console.warn("[useV2Hydration] availability prefetch failed (preview):",e)})}}catch(e){console.error("[useV2Hydration] preview load failed:",e)}}}finally{c(!0)}e(j()).then(()=>{e(p.ZP.setNextAction(m.ZP.openModal(x.ee.POP_UP_BANNERS)))}).catch(e=>{console.error("[useV2Hydration] getPopUpBanners failed:",e)})};s()},[e]),{v2StoreContextHydrated:d}}},49491:function(e,t,r){"use strict";function n(e){var t,r,n;if(!e)return!1;let s=e.replace(/^#/,"");if(6!==s.length||!/^[0-9a-fA-F]+$/.test(s))return!1;let l=[0,1,2].map(e=>{let t=parseInt(s.slice(2*e,2*e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}),o=.2126*(null!==(t=l[0])&&void 0!==t?t:0)+.7152*(null!==(r=l[1])&&void 0!==r?r:0)+.0722*(null!==(n=l[2])&&void 0!==n?n:0);return 1.05/(o+.05)>=4.5}r.d(t,{N:function(){return n}})}},function(e){e.O(0,[9774,3176,9306,9403,5039,2237,436,2300,4862,5675,7922,1974,4596,6515,1075,6,7905,7927,3023,7251,6988,4930,1378,2888,179],function(){return e(e.s=15570)}),_N_E=e.O()}]);
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.