1import{j as t,r as u}from"./react-CReYJ9E5.js";import{b as j,p as ct,F as oe,aE as dt,w as ut,T as p,q as mt,x as B,aF as ht,v as gt,aG as R,aH as ft,a2 as ue,aI as we,W as pt,aJ as yt,ag as xt,aK as Dt,Y as Me,au as vt,aL as bt,B as _,C as w,K as J,N as Oe,a as I,j as V,af as Ae,aM as me,aw as Y,aN as $t,am as jt,aO as Ct,aP as St,X as Tt,a6 as Ee,a7 as Pt,aQ as M,aR as D,aS as wt,ab as Mt,a4 as Ot,aT as At,aU as Et,E as Lt,aV as kt,aW as Bt,aX as Rt}from"./index-Ckck2ys9.js";import{u as C,x as S,k as E,e as ae,ac as It,Z as U,ad as Vt}from"./i18n-CZzEtILY.js";import{a as T,c as Le}from"./mobx-CvbbKE_c.js";import{l as ke,av as he,X as P,L as b,j as O,Y as $,r as Wt,n as Be,$ as L,Z as Re,a8 as Ie,p as zt,ag as Ve,aw as ne}from"./ui-kit-mQfLyY6y.js";import{L as We,M as ze}from"./map-selector-modal-BkuuEZ4o.js";import{B as Z}from"./index-B3yTu6yA.js";import{B as He,m as Ht,C as K}from"./index-BlUlJ71-.js";import{f as N,c as le,s as Ne,d as Fe,p as Nt,v as Ft,i as Gt,e as _t,g as Yt,h as Ut,n as Ge,r as Kt,j as Qt,u as Xt,b as qt,k as ge,l as Q,U as _e}from"./index-DW-Yrc4s.js";import{u as Jt,D as Zt,P as Ye,C as Ue,M as en}from"./index-D1boUxM8.js";import{B as tn}from"./index-DzndkCRC.js";import{L as fe}from"./chevron-CrVgvHdu.js";import"./social-yandex-D-CaYQCH.js";import"./use-dynamic-import-BAOEpYuN.js";import"./index-DUfqjWGt.js";const Ke=function(e){const{thumbProps:n,...r}=e,{background:i}=ke({name:"brand"});return t.jsx(he,{borderWidth:"$0",size:0,width:"$md",backgroundColor:e.checked?i?.val:"$gray3",animation:"medium",padding:"$0.5",cursor:"pointer",...r,children:t.jsx(he.Thumb,{width:"$2.5",height:"$2.5",animation:"medium",backgroundColor:"$white",...n})})};var F=(s=>(s.VISA="VISA",s.MASTERCARD="MASTERCARD",s.MIR="MIR",s.BELCARD="BELCARD",s.ANY="ANY",s))(F||{});class nn{static paymentProcessingBrands=[{name:"VISA",binPattern:/^4/},{name:"MIR",binPattern:/^(2200|2201|2202|2203|2204)/},{name:"MASTERCARD",binPattern:/^(51|52|53|54|55|22|23|24|25|26|27)/},{name:"BELCARD",binPattern:/^6/}];static getPaymentProcessingBrandByBinNumber(e){const n=this.paymentProcessingBrands.find(r=>r.binPattern.test(e));return n?n.name:"ANY"}}function Qe(s,e){let n;const r=()=>{const{currentTime:i}=e,a=(i===null?0:i.value)/100;n!==a&&s(a),n=a};return N.preUpdate(r,!0),()=>le(r)}function sn(s,e,n){u.useInsertionEffect(()=>s.on(e,n),[s,e,n])}function ee(s){return typeof window>"u"?!1:s?Ne():Fe()}const rn=50,pe=()=>({current:0,offset:[],progress:0,scrollLength:0,targetOffset:0,targetLength:0,containerLength:0,velocity:0}),on=()=>({time:0,x:pe(),y:pe()}),an={x:{length:"Width",position:"Left"},y:{length:"Height",position:"Top"}};function ye(s,e,n,r){const i=n[e],{length:o,position:a}=an[e],l=i.current,c=n.time;i.current=Math.abs(s[`scroll${a}`]),i.scrollLength=s[`scroll${o}`]-s[`client${o}`],i.offset.length=0,i.offset[0]=0,i.offset[1]=i.scrollLength,i.progress=Nt(0,i.scrollLength,i.current);const d=r-c;i.velocity=d>rn?0:Ft(i.current-l,d)}function ln(s,e,n){ye(s,"x",e,n),ye(s,"y",e,n),e.time=n}function cn(s,e){const n={x:0,y:0};let r=s;for(;r&&r!==e;)if(Gt(r))n.x+=r.offsetLeft,n.y+=r.offsetTop,r=r.offsetParent;else if(r.tagName==="svg"){const i=r.getBoundingClientRect();r=r.parentElement;const o=r.getBoundingClientRect();n.x+=i.left-o.left,n.y+=i.top-o.top}else if(r instanceof SVGGraphicsElement){const{x:i,y:o}=r.getBBox();n.x+=i,n.y+=o;let a=null,l=r.parentNode;for(;!a;)l.tagName==="svg"&&(a=l),l=r.parentNode;r=a}else break;return n}const ce={start:0,center:.5,end:1};function xe(s,e,n=0){let r=0;if(s in ce&&(s=ce[s]),typeof s=="string"){const i=parseFloat(s);s.endsWith("px")?r=i:s.endsWith("%")?s=i/100:s.endsWith("vw")?r=i/100*document.documentElement.clientWidth:s.endsWith("vh")?r=i/100*document.documentElement.clientHeight:s=i}return typeof s=="number"&&(r=e*s),n+r}const dn=[0,0];function un(s,e,n,r){let i=Array.isArray(s)?s:dn,o=0,a=0;return typeof s=="number"?i=[s,s]:typeof s=="string"&&(s=s.trim(),s.includes(" ")?i=s.split(" "):i=[s,ce[s]?s:"0"]),o=xe(i[0],n,r),a=xe(i[1],e),o-a}const G={Enter:[[0,1],[1,1]],Exit:[[0,0],[1,0]],Any:[[1,0],[0,1]],All:[[0,0],[1,1]]},mn={x:0,y:0};function hn(s){return"getBBox"in s&&s.tagName!=="svg"?s.getBBox():{width:s.clientWidth,height:s.clientHeight}}function gn(s,e,n){const{offset:r=G.All}=n,{target:i=s,axis:o="y"}=n,a=o==="y"?"height":"width",l=i!==s?cn(i,s):mn,c=i===s?{width:s.scrollWidth,height:s.scrollHeight}:hn(i),d={width:s.clientWidth,height:s.clientHeight};e[o].offset.length=0;let h=!e[o].interpolate;const g=r.length;for(let m=0;m<g;m++){const y=un(r[m],d[a],c[a],l[o]);
1!h&&y!==e[o].interpolatorOffsets[m]&&(h=!0),e[o].offset[m]=y}h&&(e[o].interpolate=_t(e[o].offset,Yt(r),{clamp:!1}),e[o].interpolatorOffsets=[...e[o].offset]),e[o].progress=Ut(0,1,e[o].interpolate(e[o].current))}function fn(s,e=s,n){if(n.x.targetOffset=0,n.y.targetOffset=0,e!==s){let r=e;for(;r&&r!==s;)n.x.targetOffset+=r.offsetLeft,n.y.targetOffset+=r.offsetTop,r=r.offsetParent}n.x.targetLength=e===s?e.scrollWidth:e.clientWidth,n.y.targetLength=e===s?e.scrollHeight:e.clientHeight,n.x.containerLength=s.clientWidth,n.y.containerLength=s.clientHeight}function pn(s,e,n,r={}){return{measure:i=>{fn(s,r.target,n),ln(s,n,i),(r.offset||r.target)&&gn(s,n,r)},notify:()=>e(n)}}const k=new WeakMap,De=new WeakMap,se=new WeakMap,ve=new WeakMap,X=new WeakMap,be=s=>s===document.scrollingElement?window:s;function Xe(s,{container:e=document.scrollingElement,trackContentSize:n=!1,...r}={}){if(!e)return Ge;let i=se.get(e);i||(i=new Set,se.set(e,i));const o=on(),a=pn(e,s,o,r);if(i.add(a),!k.has(e)){const c=()=>{for(const m of i)m.measure(Qt.timestamp);N.preUpdate(d)},d=()=>{for(const m of i)m.notify()},h=()=>N.read(c);k.set(e,h);const g=be(e);window.addEventListener("resize",h),e!==document.documentElement&&De.set(e,Kt(e,h)),g.addEventListener("scroll",h),h()}if(n&&!X.has(e)){const c=k.get(e),d={width:e.scrollWidth,height:e.scrollHeight};ve.set(e,d);const h=()=>{const m=e.scrollWidth,y=e.scrollHeight;(d.width!==m||d.height!==y)&&(c(),d.width=m,d.height=y)},g=N.read(h,!0);X.set(e,g)}const l=k.get(e);return N.read(l,!1,!0),()=>{le(l);const c=se.get(e);if(!c||(c.delete(a),c.size))return;const d=k.get(e);k.delete(e),d&&(be(e).removeEventListener("scroll",d),De.get(e)?.(),window.removeEventListener("resize",d));const h=X.get(e);h&&(le(h),X.delete(e)),ve.delete(e)}}const yn=[[G.Enter,"entry"],[G.Exit,"exit"],[G.Any,"cover"],[G.All,"contain"]],$e={start:0,end:1};function xn(s){const e=s.trim().split(/\s+/);if(e.length!==2)return;const n=$e[e[0]],r=$e[e[1]];if(!(n===void 0||r===void 0))return[n,r]}function Dn(s){if(s.length!==2)return;const e=[];for(const n of s)if(Array.isArray(n))e.push(n);else if(typeof n=="string"){const r=xn(n);if(!r)return;e.push(r)}else return;return e}function vn(s,e){const n=Dn(s);if(!n)return!1;for(let r=0;r<2;r++){const i=n[r],o=e[r];if(i[0]!==o[0]||i[1]!==o[1])return!1}return!0}function de(s){if(!s)return{rangeStart:"contain 0%",rangeEnd:"contain 100%"};for(const[e,n]of yn)if(vn(s,e))return{rangeStart:`${n} 0%`,rangeEnd:`${n} 100%`}}const je=new Map;function Ce(s){const e={value:0},n=Xe(r=>{e.value=r[s.axis].progress*100},s);return{currentTime:e,cancel:n}}function qe({source:s,container:e,...n}){const{axis:r}=n;s&&(e=s);let i=je.get(e);i||(i=new Map,je.set(e,i));const o=n.target??"self";let a=i.get(o);a||(a={},i.set(o,a));const l=r+(n.offset??[]).join(",");return a[l]||(n.target&&ee(n.target)?de(n.offset)?a[l]=new ViewTimeline({subject:n.target,axis:r}):a[l]=Ce({container:e,...n}):ee()?a[l]=new ScrollTimeline({source:e,axis:r}):a[l]=Ce({container:e,...n})),a[l]}function bn(s,e){const n=qe(e),r=e.target?de(e.offset):void 0,i=e.target?ee(e.target)&&!!r:ee();return s.attachTimeline({timeline:i?n:void 0,...r&&i&&{rangeStart:r.rangeStart,rangeEnd:r.rangeEnd},observe:o=>(o.pause(),Qe(a=>{o.time=o.iterationDuration*a},n))})}function $n(s){return s.length===2}function jn(s,e){return $n(s)?Xe(n=>{s(n[e.axis].progress,n)},e):Qe(s,qe(e))}function Je(s,{axis:e="y",container:n=document.scrollingElement,...r}={}){if(!n)return Ge;const i={axis:e,container:n,...r};return typeof s=="function"?jn(s,i):bn(s,i)}const Cn=()=>({scrollX:Q(0),scrollY:Q(0),scrollXProgress:Q(0),scrollYProgress:Q(0)}),q=s=>s?!s.current:!1;function Se(s,e,n,r){return{factory:i=>Je(i,{...e,axis:s,container:n?.current||void 0,target:r?.current||void 0}),times:[0,1],keyframes:[0,1],ease:i=>i,duration:1}}function Sn(s,e){return typeof window>"u"?!1:s?Ne()&&!!de(e):Fe()}function Tn({container:s,target:e,...n}={}){const r=Xt(Cn);Sn(e,n.offset)&&(r.scrollXProgress.accelerate=Se("x",n,s,e),r.scrollYProgress.accelerate=Se("y",n,s,e));const i=u.useRef(null),o=u.useRef(!1),a=u.useCallback(()=>(i.current=Je((l,{x:c,y:d})=>{r.scrollX.set(c.current),r.scrollXProgress.set(c.progress),r.scrollY.set(d.current),r.scrollYProgress.set(d.progress)}
1,{...n,container:s?.current||void 0,target:e?.current||void 0}),()=>{i.current?.()}),[s,e,JSON.stringify(n.offset)]);return qt(()=>{if(o.current=!1,q(s)||q(e)){o.current=!0;return}else return a()},[a]),u.useEffect(()=>{if(o.current)return ge(!q(s)),ge(!q(e)),a()},[a]),r}const Pn=function(e){const{receivingStore:n}=j(),r=e.position.dish.dictionaryEntity;return t.jsxs(P,{alignItems:"center",gap:"$3",paddingHorizontal:"$4",paddingVertical:"$4",children:[t.jsx(b,{width:"$3",height:"$3",borderRadius:"$lib-2",overflow:"hidden",children:t.jsx(ct,{url:r.imageUrlFull})}),t.jsx(b,{flex:1,children:t.jsx(oe,{title:r.title,size:"$title-s",numberOfLines:2,semibold:!0,fadeColor:"$white",wrapperProps:{justifyContent:"flex-start"},additionalTextProps:{backgroundColor:"$white"},additionalText:t.jsx(dt,{salesLink:r.sales.get(String(n.selectedLocation?.id)),dishMeasuredWeight:r.measuredWeight,dishMeasuredVolume:r.measuredVolume,size:"$title-s",backgroundColor:"$white",semibold:!0,disabled:!0})})})]})},wn=function(e){const{t:n}=C("cart"),{attention:r}=ke(),i=r?.val,o=O("$6","space"),a=e.group.timeRange?n("offer-schedule-validation.modal.time-range",e.group.timeRange):null,l=e.group.positions.length>0;return t.jsxs(b,{children:[t.jsxs(P,{gap:"$2",alignItems:"center",paddingHorizontal:"$4",paddingTop:"$3",paddingBottom:l?"$8":"$3",backgroundColor:mt(i,.16),borderRadius:"$7",children:[t.jsx(ut,{color:i}),t.jsxs($,{flex:1,gap:"$0.5",children:[t.jsx(p,{size:"$title-s",semibold:!0,color:"$attention",children:e.group.title}),a!==null&&t.jsx(p,{size:"$label",color:"$attention",children:a})]})]}),l&&t.jsx(B,{marginTop:-o,padding:"$0",overflow:"hidden",children:e.group.positions.map((c,d)=>t.jsxs(b,{children:[d>0&&t.jsx(Wt,{marginLeft:"$15",borderColor:"$backgroundLight"}),t.jsx(Pn,{position:c})]},`${e.group.id}:${c.orderItemGuid??`${c.dish.dictionaryEntity.id}:${d}`}`))})]})},Mn=function(e){const{t:n}=C("cart"),r=ht(e.groups),i=ft(r),o=t.jsx(gt,{position:"absolute",bottom:"$0",left:"$0",right:"$0",paddingBottom:"$4",testID:"offer-schedule-conflict-footer",children:r.hasRemovablePositions?t.jsx(R.Footer,{cancelText:n("offer-schedule-validation.modal.change-time"),submitText:n("offer-schedule-validation.modal.remove"),onCancelPress:e.onChangeTime,onSubmitPress:e.onRemove,margin:"$0",marginTop:"$0",width:"100%",submitButtonProps:{loading:e.isRemoving}}):t.jsx(R.Footer,{cancelText:n("offer-schedule-validation.modal.change-time"),submitText:n("offer-schedule-validation.modal.continue"),onCancelPress:e.onChangeTime,onSubmitPress:e.onContinue,margin:"$0",marginTop:"$0",width:"100%"})});return t.jsxs(b,{position:"relative",flexShrink:1,minHeight:0,children:[t.jsx(Be,{scrollbarWidth:"none",flexShrink:1,minHeight:0,children:t.jsx(b,{paddingTop:"$18",paddingBottom:"$18",children:t.jsxs(b,{paddingBottom:"$5",testID:"offer-schedule-conflict-content",children:[t.jsx(R.Header,{title:n(i.titleKey),description:n(i.descriptionKey),marginHorizontal:"$0",paddingTop:"$0"}),t.jsx($,{gap:"$3",marginTop:"$6",children:e.groups.map(a=>t.jsx(wn,{group:a},a.id))})]})})}),o]})},On=function(e){const{open:n,onOpenChange:r,...i}=e;return t.jsxs(ue,{open:n,onOpenChange:r,contentProps:{width:"100%",maxWidth:400,maxHeight:"calc(100dvh - 64px)"},bottomSheetFrameProps:{maxHeight:"calc(100dvh - 16px)",borderBottomLeftRadius:"$bottom-sheet",borderBottomRightRadius:"$bottom-sheet"},children:[t.jsx(ue.Header,{transparent:!0}),t.jsx(Mn,{...i})]})},An=T(function(){const e=j(),n=we(),r=pt(),[i,o]=u.useState(!1),a=e.preorderStore.selectedLocation,l=e.preorderStore.targetDueDate,c=!e.preorderStore.preorder||!a||!l?[]:yt({currentPreorder:e.preorderStore.preorder,availableOffers:e.repositoryOffers.data,targetDueDate:l,timeOffset:a.timeOffset}),d=y=>{y||n.closeOfferScheduleConflictModal()},h=()=>{n.closeOfferScheduleConflictModal(),n.openDueDateModal()},g=async()=>{n.closeOfferScheduleConflictModal(),e.preorderStore.clearOfferScheduleConflicts(),await e.preorderStore.syncPreorder()},m=async()=>{const y=Array.from(new Set(c.flatMap(f=>f.positions)));if(y.length!==0){o(!0),n.closeOfferScheduleConflictModal();try{for(const f of y)e.preorderStore.preorder?.items.includes(f)&&await e.preorderStore.removePosition(f);await e.preorderStore.syncPreorder(),await r({to:"/cart/dishes"})}finally{o(!1)}}};return t.jsx(On,{open:n.isOfferScheduleConflictModalOpen,groups:c,isRemoving:i,onOpenChange:d,onChangeTime:h,onRemove:()=>{m()},onContinue:()=>{g()}})});function Ze(){const{preorderStore:s}=j(),{preorderGuid:e,tgWebAppStartParam:n}=xt({from:"/_base-layout/cart/payment"});if(!e&&!n?.includes("preorderGuid_"))return;if(!s.isAuthenticated){s.resetPreorderStore();return}let r="";return e?r=e:n&&(r=Dt(n)),r}const En=T(function(e){const{t:n}=C("cart"),{preorderStore:r,repositoryCustomer:i}=j(),[o,a]=u.useState(String(r.preorderOptions?.writeOffBonuses??r.maxBonusesToWriteOff)),[l,c]=u.useState(!0),{userEmoji:d}
1=i,h=i.data?.convertedTotalAvailableBonuses,g=()=>a("0"),m=W=>{let v=W.replace(",",".");if(v=v.replace(/[^.0-9]/gim,""),(v.match(/\./g)||[]).length>1&&(v=v.slice(0,-1)),(v.match(/0/g)||[]).length>1&&v.startsWith("0")&&(v=v.slice(0,-1)),v.match(/\./g)&&(v=v.substring(0,v.indexOf(".")+3)),!v.endsWith(".")&&!v.startsWith(".")&&v!==""){const z=Number(v);c(z<=r.maxBonusesToWriteOff),z>r.maxBonusesToWriteOff&&(v=String(r.maxBonusesToWriteOff),c(!0)),z<0&&(v="",c(!1))}else c(!1);a(v)},y=()=>{r.setWriteOffBonuses(Number(o)),e.closeModal()},f=L();return t.jsxs(t.Fragment,{children:[h&&t.jsx(P,{position:"absolute",left:"$0",right:"$0",top:"$8",justifyContent:"center",pointerEvents:"none",$sm:{top:"$5"},children:t.jsx(He,{bonuses:h,padding:"$0.5",paddingRight:"$2",gap:"$1",borderRadius:"$5",children:t.jsx(_e,{emojiName:d??Me.alien,width:"$1.75",height:"$1.75",emojiWidth:f.sm?O("$tiny","size"):O("$1.5","size"),$sm:{width:"$2.5",height:"$2.5"}})})}),t.jsxs($,{$sm:{marginHorizontal:"$5",marginBottom:"$5"},$gtSm:{marginRight:"$4"},children:[t.jsx(p,{size:"$display-m",bold:!0,textAlign:"center",marginTop:"$4",marginBottom:"$2",children:n("payment-stage.bonuses.modal.title")}),t.jsx(p,{size:"$body",textAlign:"center",marginBottom:"$6",children:n("payment-stage.bonuses.modal.description",{value:r.maxBonusesToWriteOff})}),t.jsx(vt,{value:o,onChangeText:m,placeholder:n("payment-stage.bonuses.modal.placeholder"),inputProps:{backgroundColor:"$white"},...o!=="0"&&{rightItem:t.jsx(bt,{onPress:g})},marginBottom:"$8"}),t.jsx(Re,{name:"brand",children:t.jsx(_,{onPress:y,disabled:!l,children:t.jsx(_.Text,{children:n("textDictionary:done")})})})]})]})}),Ln=function(e){return t.jsxs(w,{open:e.isOpen,onOpenChange:e.onOpenChange,children:[t.jsx(w.Overlay,{},"overlay"),t.jsxs(w.Content,{width:400,paddingLeft:"$10",paddingTop:"$6",paddingRight:"$6",paddingBottom:"$10",$sm:{position:"absolute",bottom:"$1",left:"$1",right:"$1",width:"auto",borderRadius:"$11",height:"auto",maxWidth:"none",paddingHorizontal:"$6"},children:[t.jsx(w.Close,{alignSelf:"flex-end",children:t.jsx(J,{children:t.jsx(Oe,{})})}),t.jsx(En,{closeModal:e.closeModal})]},"content")]})},et=T(function(){const{repositoryCustomer:e,preorderStore:n}=j(),{t:r}=C("cart"),[i,o]=u.useState(!1),a=()=>{o(!0)},l=()=>{o(!1)},c=e.data,d=c?.convertedTotalAvailableBonuses;if(!(c&&c.bonusAccounts.length>0&&d!==void 0)||n.maxBonusesToWriteOff<=0)return null;const g=n.preorderOptions?.writeOffBonuses??0,{userEmoji:m}=e,y=W=>{W?n.setWriteOffBonuses(n.maxBonusesToWriteOff):n.setWriteOffBonuses(0)},f=g>0;return t.jsxs(B,{justifyContent:"space-between",alignItems:"center",$sm:{marginHorizontal:"$5"},children:[t.jsxs(P,{alignItems:"center",width:"100%",children:[t.jsxs($,{gap:"$1",flex:1,children:[t.jsxs(P,{gap:"$2",children:[t.jsx(p,{size:"$display-s",children:r("payment-stage.bonuses.info.title")}),t.jsx(He,{bonuses:d,padding:"$0.5",paddingRight:"$2",gap:"$1",borderRadius:"$5",children:t.jsx(_e,{emojiName:m??Me.alien,width:"$1.75",height:"$1.75",emojiWidth:O("$1.5","size"),$sm:{width:"$1.75",height:"$1.75"}})})]}),t.jsx(p,{size:"$label",disabled:!0,children:`${r("payment-stage.bonuses.info.description")} ${n.maxBonusesToWriteOff}`})]}),t.jsx(Ke,{height:"$2.75",checked:f,onCheckedChange:y})]}),f&&t.jsx(Z,{justifyContent:"flex-start",backgroundColor:"$backgroundLight",alignItems:"center",marginTop:"$4",borderRadius:"$5",width:"100%",onPress:a,children:t.jsxs($,{flex:1,children:[t.jsx(p,{size:"$title-m",semibold:!0,children:g}),t.jsx(p,{size:"$label",disabled:!0,children:r("payment-stage.bonuses.info.button")})]})}),t.jsx(Ln,{isOpen:i,onOpenChange:o,closeModal:l})]})}),kn=()=>t.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("rect",{width:"12",height:"12",rx:"6",fill:"#1E1E1E"}),t.jsx("path",{d:"M5 3.30005L7.625 5.92505L5 8.55005",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]});function Bn(s){const{apiHttpClient:e}=I(),{data:n}=V({apiHttpClient:e});u.useEffect(()=>{n!==void 0&&s.receivingStore.selectedLocation?.dueDatesGenerator.setIsDueDateAsapShown(n.isDueDateAsapShown)})}
1function Rn(s){const{apiHttpClient:e}=I(),{data:n}=V({apiHttpClient:e});u.useEffect(()=>{n!==void 0&&s.receivingStore.selectedLocation?.dueDatesGenerator.setIsOrderNextDayAvailable(n.isOrderNextDayAvailable)})}function In(s){const{apiHttpClient:e}=I(),{data:n}=V({apiHttpClient:e});u.useEffect(()=>{n!==void 0&&s.receivingStore.selectedLocation?.dueDatesGenerator.setIsOrderForCurrentDayInClosedLocationAvailable(n.isOrderForCurrentDayInClosedLocationAvailable)})}function Vn(s){const{apiHttpClient:e}=I(),{data:n}=V({apiHttpClient:e});u.useEffect(()=>{typeof n?.preorderDaysQuantity=="number"&&s.receivingStore.selectedLocation?.dueDatesGenerator.setPreorderDaysQuantity(n.preorderDaysQuantity)})}function Wn(s){const{apiHttpClient:e}=I(),{data:n}=V({apiHttpClient:e});u.useEffect(()=>{typeof n?.dueDatesTimeInterval=="number"&&s.receivingStore.selectedLocation?.dueDatesGenerator.setTimeInterval(n.dueDatesTimeInterval)})}function zn(s){u.useEffect(()=>{const e=s.receivingStore.receivingTime;e!==null&&s.receivingStore.selectedLocation?.dueDatesGenerator.setReceivingTime(e)},[s.receivingStore.receivingTime,s.receivingStore.selectedLocation])}function Hn(){const s=j();Bn(s),Rn(s),Wn(s),In(s),Vn(s),zn(s)}class Nn{constructor(e,n,r,i){this.selectedLocation=e,this.preorderOptions=n,this.receivingTime=r,this.receivingType=i,this.dueDatesGenerator=this.selectedLocation.dueDatesGenerator,this.scheduleList=this.generateDueDateList()}selectedLocation;preorderOptions;receivingTime;receivingType;dueDatesGenerator;scheduleList;get execute(){return{modalViewModel:!this.selectedLocation||Object.keys(this.scheduleList).length===0?null:{scheduleList:this.scheduleList,isDayWheelPickerHidden:!!(Object.keys(this.scheduleList).length===1&&this.scheduleList[this.dueDatesGenerator.currentDate.format("DD.MM")])},infoViewModel:{canEditDate:this.canEditDate(),canReceiveAsap:this.canReceiveAsap(),isClosestAvailableTimeSelected:this.isClosestAvailableTimeSelected,dueDate:this.dueDateText,asap:this.getAsapText()}}}getAsapText(){return this.canEditDate()?this.dueDatesGenerator.isDueDateAsapShown?this.receivingTime===null?S("payment-stage.due-date.info.asap",{ns:"cart"}):`~${S("minutes",{ns:"textDictionary",count:this.receivingTime,context:"nominative"})}`:`~${S("minutes",{ns:"textDictionary",count:this.receivingTime??this.selectedLocation.dueDatesGenerator.timeInterval,context:"nominative"})}`:this.receivingType===Ae.DELIVERY?S("payment-stage.due-date.info.asap-delivery",{ns:"cart"}):S("payment-stage.due-date.info.asap-pickup",{ns:"cart"})}canReceiveAsap(){const n=this.dueDatesGenerator.currentDate.format("DD.MM")in this.scheduleList,r=this.receivingTime??this.selectedLocation.dueDatesGenerator.timeInterval,o=this.selectedLocation.dueDatesGenerator.closestAvailableDueDate?.diff(this.dueDatesGenerator.currentDate,"minutes")??1/0;return n&&me.roundMinutes(r)>=me.roundMinutes(o)}get dueDateText(){const e=this.preorderOptions?.dueDate,n=S("payment-stage.due-date.info.when-convenient",{ns:"cart"});if(!e)return{day:null,time:n};const r=E(e).format("HH:mm"),i=this.isClosestAvailableTimeSelected?n:r,o=this.isClosestAvailableTimeSelected?null:S("textDictionary:today").toLowerCase();return this.isSelectedDueDateToday()?this.dueDatesGenerator.isOrderNextDayAvailable?{day:o,time:i}:{day:null,time:i}:{day:this.getFutureDayTitle(e).toLowerCase(),time:r}}get isClosestAvailableTimeSelected(){const e=this.selectedLocation.dueDatesGenerator.closestAvailableDueDate;if(!e)return!1;const n=this.preorderOptions?.dueDate??null,r=this.dueDatesGenerator.isDueDateAsapShown,i=n===null,o=e?.toDate().toString()===n?.toString();return r?i:i?!0:this.canReceiveAsap()&&o}generateDueDateList=()=>{const e={},n=this.dueDatesGenerator.currentDayDueDates;n.length!==0&&this.adaptToDueDateView(n).forEach((o,a)=>{if(a===0){const l=this.dueDatesGenerator.currentDate.format("DD.MM");e[l]={title:S("textDictionary:today"),dueDateViews:[o]}}else{const l=E(o.date).format("DD.MM");e[l]?e[l].dueDateViews.push(o):e[l]={title:this.getFutureDayTitle(o.date),dueDateViews:[o]}}});const r=this.dueDatesGenerator.futureDaysDueDates;return r.length!==0&&this.adaptToDueDateView(r).forEach(o=>{const a=E(o.date).format("DD.MM");e[a]?e[a].dueDateViews.push(o):e[a]={title:this.getFutureDayTitle(o.date),dueDateViews:[o]}}),e};getFutureDayTitle=e=>{const n=E().add(1,"days");return E(e).day()===n.day()?S("textDictionary:tomorrow"):E(e).format("D MMMM")};adaptToDueDateView=e=>e.map((n,r)=>({id:r,date:n.toDate(),dateToDisplay:n.format("HH:mm"),selected:n.toDate().toString()===this.preorderOptions?.dueDate?.toString()}));isSelectedDueDateToday=()=>E().isSame(this.preorderOptions?.dueDate,"date");canEditDate(){if(Object.keys(this.scheduleList).length===0)return!1;if(Object.keys(this.scheduleList).length>1)return!0;const e=Object.keys(this.scheduleList)[0];return this.scheduleList[e].dueDateViews.length>1}}const Fn=s=>{const e=u.useRef(null),{scrollYProgress:n}=Tn({container:e});return sn(n,"change",r=>{s(r)}),{scrolledContainerRef:e}},Gn="_gradient_2k9nx_1",_n={gradient:Gn},Yn=T(function(e){const{preorderStore:n}=j(),{dueDateModalVM:r}=e,{t:i}=C("cart"),o=Object.keys(r.scheduleList).map(x=>({label:r.scheduleList[x]?.title,value:x})),a=()=>{const x=n.preorderOptions?.isDueDateToday;return o.length>1&&!x?{item:o[1],index:1}:{item:o[0],index:0}},[l,c]=u.useState(a().item),d=x=>x?{label:x.dateToDisplay,value:x.date}:{label:"",value:null},h=()=>{const x=r.scheduleList[l.value]?.dueDateViews.find(A=>A.selected);
1return d(x||r.scheduleList[l.value]?.dueDateViews[0])},[g,m]=u.useState(h()),y=()=>{n.setDueDate(g.value),e.closeModal()},[f,W]=u.useState(!0),{scrolledContainerRef:v}=Fn(x=>{W(x!==1)});if(o.length===0)return null;const z=x=>{const A=o.findIndex(lt=>String(lt.value)===x),H=o[A];if(!H)return;c(H);const te=r.scheduleList[H.value]?.dueDateViews[0];te!==void 0&&m({label:te?.dateToDisplay,value:te?.date})},at=x=>{m(x)};return t.jsxs($,{gap:"$5",children:[!r.isDayWheelPickerHidden&&t.jsx(b,{height:"$4",children:t.jsx(Y,{value:String(l.value),onValueChange:z,backgroundColor:"$white",borderRadius:"$8",children:o.map(x=>t.jsx(Y.Item,{value:String(x.value),children:t.jsx(p,{size:"$title-s",semibold:!0,children:x.label})},x.label))})}),t.jsxs(b,{position:"relative",overflow:"hidden",children:[t.jsx(b,{maxHeight:248,width:"100%",backgroundColor:"$white",borderRadius:"$8",padding:"$1",scrollbarWidth:"none",overflow:"scroll",ref:v,children:r.scheduleList[l.value]?.dueDateViews.map(x=>{const A=d(x),H=JSON.stringify({label:x.dateToDisplay,value:x.date})===JSON.stringify(g);return t.jsx(_,{alignItems:"center",backgroundColor:H?"$backgroundLight":"transparent",size:"$sm",stadium:!0,onPress:()=>at(A),children:t.jsx(p,{size:"$title-s",semibold:!0,children:A.label})},A.label)})}),f&&t.jsx("div",{className:_n.gradient})]}),t.jsx(Re,{name:"brand",children:t.jsx(_,{onPress:y,children:t.jsx(_.Text,{size:"$title-l-sb",children:i("payment-stage.due-date.modal.button")})})})]})}),Un=s=>{const e=j(),{t:n}=C("cart"),r=e.receivingStore.receivingType==="DELIVERY";return s.dueDateVM.modalViewModel?t.jsxs($,{$gtSm:{paddingRight:"$4"},children:[t.jsx(p,{size:"$display-m",textAlign:"center",children:n("payment-stage.due-date.modal.title")}),t.jsx(p,{size:"$body",textAlign:"center",marginTop:"$2",marginBottom:"$6",children:n(`payment-stage.due-date.modal.description-${r?"delivery":"pickup"}`)}),t.jsx(Yn,{closeModal:s.closeModal,dueDateModalVM:s.dueDateVM.modalViewModel})]}):null},Kn=s=>{const{dueDateVM:e}=s;return e.modalViewModel?t.jsxs(w,{open:s.isOpen,onOpenChange:s.onOpenChange,children:[t.jsx(w.Overlay,{},"overlay"),t.jsxs(w.Content,{width:400,paddingLeft:"$10",paddingTop:"$6",paddingRight:"$6",paddingBottom:"$10",$sm:{position:"absolute",bottom:"$1",left:"$1",right:"$1",width:"auto",borderRadius:"$11",height:"auto",maxWidth:"none",paddingHorizontal:"$6"},children:[t.jsx(w.Close,{alignSelf:"flex-end",children:t.jsx(J,{children:t.jsx(Oe,{})})}),t.jsx(Un,{closeModal:s.onClose,dueDateVM:e})]},"content")]}):null},tt=T(function(){const e=j(),n=we(),[r,i]=u.useState(!1),{t:o}=C("cart");Hn();const a=()=>{i(!0)},l=()=>{i(!1)};u.useEffect(()=>n.registerDueDateModalOpenHandler(()=>i(!0)),[n]);const c=e.preorderStore.selectedLocation;if(!c)return null;const{receivingTime:d,receivingType:h}=e.receivingStore,g=()=>e.preorderStore.setDueDateFromSelectedLocation(c),m=Le(()=>new Nn(c,e.preorderStore.preorderOptions,d,h)).get().execute,y=f=>{f==="asap"?g():a()};return t.jsxs($,{backgroundColor:"$white",borderRadius:"$8",paddingTop:"$5",paddingBottom:"$4",paddingHorizontal:"$4",$sm:{marginHorizontal:"$5"},children:[t.jsx(p,{marginBottom:"$4",size:"$display-s",children:o("payment-stage.due-date.info.title")}),m.infoViewModel.canEditDate?t.jsx(b,{height:66,children:t.jsxs(Y,{value:m.infoViewModel.isClosestAvailableTimeSelected?"asap":"by-time",onValueChange:y,borderRadius:"$7",backgroundColor:"$backgroundLight",children:[t.jsx(Y.Item,{value:"asap",disabled:!m.infoViewModel.canReceiveAsap,children:t.jsxs($,{gap:"$0.5",alignItems:"center",children:[t.jsx(p,{size:"$title-s",semibold:!0,disabled:!m.infoViewModel.canReceiveAsap,children:o("payment-stage.due-date.info.faster")}),t.jsx(p,{size:"$label",secondary:!0,disabled:!m.infoViewModel.canReceiveAsap,children:m.infoViewModel.asap})]})}),t.jsx(Y.Item,{value:"by-time",disabled:!m.modalViewModel,children:t.jsxs($,{gap:"$0.5",alignItems:"center",children:[t.jsxs(P,{justifyContent:"center",alignItems:"center",gap:"$1",children:[t.jsx(p,{size:"$title-s",semibold:!0,children:o("payment-stage.due-date.info.by-time")}),!m.infoViewModel.isClosestAvailableTimeSelected&&t.jsx(kn,{})]}),t.jsxs(P,{alignItems:"center",gap:"$2",children:[m.infoViewModel.dueDate.day&&t.jsxs(t.Fragment,{children:[t.jsx(p,{size:"$label",color:"$textGray",children:m.infoViewModel.dueDate.day}),t.jsx(Ie,{size:"$0.5",backgroundColor:"$textGray"})]}),t.jsx(p,{size:"$label",color:"$textGray",children:m.infoViewModel.dueDate.time})]})]})})]})}):t.jsxs(b,{justifyContent:"space-between",paddingVertical:"$3",paddingHorizontal:"$4",backgroundColor:"$backgroundLight",borderRadius:"$5",children:[t.jsx(p,{size:"$title-m",semibold:!0,children:o("payment-stage.due-date.info.faster")}),t.jsx(p,{size:"$label",disabled:!0,children:m.infoViewModel.asap})]}),t.jsx(Kn,{isOpen:r,onOpenChange:i,onClose:l,dueDateVM:m})]})}),nt=s=>{const{t:e}=C("cart"),{isPending:n,error:r}=$t({preorderGuid:s.preorderGuid,useQueryFunc:St});return t.jsxs(t.Fragment,{children:[n&&t.jsxs($,{height:"100%",alignItems:"center",justifyContent:"center",$sm:{backgroundColor:"$backgroundLight",width:"100%",height:"100dvh",paddingHorizontal:"$7"},children:[t.jsx(jt,{size:"large",color:"$gray5"}),t.jsx(zt,{height:"$3"}),t.jsx(p,{size:"$display-s",bold:!0,marginBottom:"$2",textAlign:"center",children:e("payment-verification-screen.title")}),t.jsx(p,{size:"$body",children:e("payment-verification-screen.description-shop")})]}),!!r&&t.jsx(Ct,{})]})},Qn=T(function(){const{preorderStore:e}=j(),{t:n}=C("cart"),r=e.preorderOptions?.dontCallBack,i=o=>{e.setDontCallBack(o)};return t.jsxs(b,{flexDirection:"row",justifyContent:"space-between",padding:"$3",backgroundColor:"$backgroundLight",alignItems:"center",borderRadius:"$5",children:[t.jsx(p,{size:"$title-m",semibold:!0,children:n("payment-stage.location-info.switcher")}),t.jsx(Ke,{checked:r,onCheckedChange:i})]})}),st=T(function(e){const{receivingStore:n,deliveryStore:r}
1=j(),{apiHttpClient:i}=I(),{data:o}=V({apiHttpClient:i}),{t:a}=C("cart"),l=n.receivingType===ae.DELIVERY,c=a(l?"payment-stage.location-info.title-delivery":"payment-stage.location-info.title-pickup"),d=Tt(n.receivingType,r.address,n.selectedLocation),h=()=>{e.onOpenMap()},g=o?.isCallBackAvailable;return t.jsxs($,{gap:"$4",backgroundColor:"$white",borderRadius:"$8",paddingTop:"$5",paddingBottom:"$4",paddingHorizontal:"$4",$sm:{marginHorizontal:"$5"},children:[t.jsx(p,{size:"$display-s",children:c}),t.jsxs(tn,{onPress:h,gap:"$3",padding:"$0",margin:"$0",children:[l?t.jsx(Ee,{}):t.jsx(Pt,{}),t.jsxs(b,{flex:1,alignItems:"flex-start",children:[d.title&&t.jsx(oe,{numberOfLines:1,title:d.title,size:"$title-m",semibold:!0}),d.subTitle&&t.jsx(oe,{numberOfLines:1,title:d.subTitle,...d.title?{size:"$label",disabled:!0}:{size:"$title-m"}})]})]}),g&&t.jsx(Qn,{})]})});class Te{static generateCurrentPaymentTypeView(e,n,r,i){return this.generateAllAvailablePaymentTypeViews(e,n,i).find(a=>a.kind===M.PREDEFINED?a.type===r?.paymentType:a.type===r?.paymentType&&a.id===r.cardUId)}static generateAvailablePaymentTypeViewsByDueDate(e,n,r,i){const o=this.generateAllAvailablePaymentTypeViews(e,n,r?.preorderPaymentTypes);return r?.isSbpAllowed(i)?o:o.filter(a=>a.type!==D.SBP_NEW_PAY)}static generateAllAvailablePaymentTypeViews(e,n,r){return[...It(!!r?.includes(D.CARD)&&e.length>0,this.generateAvailableSavedCardViews(e)),...U(!!r?.includes(D.CARD),{kind:M.PREDEFINED,type:D.CARD,name:S("cart:paymentTypes.onlineNewCard"),icon:"card-new.png",id:D.CARD}),...U(!!r?.includes(D.CARD_TO_COURIER)&&n===ae.DELIVERY,{kind:M.PREDEFINED,type:D.CARD_TO_COURIER,name:S("cart:paymentTypes.cardToCourier"),id:D.CARD_TO_COURIER}),...U(!!r?.includes(D.ON_COLLECT),{kind:M.PREDEFINED,type:D.ON_COLLECT,name:n===ae.PICKUP?S("cart:paymentTypes.onCollectCash"):S("cart:paymentTypes.cashToCourier"),id:D.ON_COLLECT}),...U(!!r?.includes(D.SBP_NEW_PAY),{kind:M.PREDEFINED,type:D.SBP_NEW_PAY,name:S("cart:paymentTypes.sbp"),icon:"sbp.png",id:D.SBP_NEW_PAY})]}static generateAvailableSavedCardViews(e){return e.map(n=>({kind:M.SAVED,type:D.SAVED_CARD,name:n.mask,icon:this.getPaymentProcessingIcon(n.bin),id:n.id}))}static getPaymentProcessingIcon(e){switch(nn.getPaymentProcessingBrandByBinNumber(e)){case F.MASTERCARD:return"card-mastercard.png";case F.VISA:return"card-visa.png";case F.MIR:return"card-mir.png";case F.BELCARD:return"card-belcard.png";default:return"card-new.png"}}}class Xn{constructor(e,n,r){this.preorderStoreData=e,this.savedCards=n,this.receivingType=r}preorderStoreData;savedCards;receivingType;execute(){return{availablePaymentTypes:Te.generateAvailablePaymentTypeViewsByDueDate(this.savedCards,this.receivingType,this.preorderStoreData.selectedLocation,this.preorderStoreData.preorderOptions?.dueDate),currentPaymentType:Te.generateCurrentPaymentTypeView(this.savedCards,this.receivingType,this.preorderStoreData.preorderOptions,this.preorderStoreData.selectedLocation?.preorderPaymentTypes)}}}const rt=function(e){return t.jsxs(P,{alignItems:"center",gap:"$1",children:[t.jsx(P,{gap:"$0.5",children:Array.from({length:4}).map((n,r)=>t.jsx(Ie,{size:3,backgroundColor:"$textBlack"},r))}),t.jsx(p,{size:"$title-m",semibold:!0,children:e.cardNumber})]})},qn=T(function(){const{t:e}=C("cart"),{preorderStore:n}=j(),[r,i]=u.useState(n.preorderOptions?.customerCashAmount??""),o=a=>{const l=Number(Vt(a));if(l){const c=Mt(l,"",{dropEmptyFractionalPart:!0});i(c),n.setCustomerCashAmount(c)}else i(""),n.setCustomerCashAmount("")};return t.jsx(wt,{value:r,onChangeText:o,label:e("payment-stage.payment-type-info.change-amount-modal.placeholder"),backgroundColor:"$backgroundLight",height:"$5"})}),re=function(e){const{t:n}=C("cart"),r=e.currentPaymentType.type===D.ON_COLLECT&&e.receivingType===Ae.DELIVERY,i=e.currentPaymentType.type===D.CARD_TO_COURIER||r,o=L();return t.jsxs($,{gap:"$4",children:[t.jsxs(Z,{gap:"$3",padding:"$0",margin:"$0",onPress:e.onPress,disabled:e.disabled,bottomChevron:!0,"data-testid":"current-payment-type",children:[i&&t.jsx(Ee,{}),e.currentPaymentType.icon&&t.jsx(Ve,{src:`/card-payment-images/${e.currentPaymentType.icon}`,objectFit:"contain",width:32,height:"$2.5"}),t.jsx($,{flex:1,children:e.currentPaymentType.kind===M.SAVED?t.jsxs(t.Fragment,{children:[t.jsx(rt,{cardNumber:e.currentPaymentType.name}),t.jsx(p,{size:"$label",disabled:!0,children:n("payment-stage.payment-type-info.card")})]}):t.jsx(p,{size:"$title-m",semibold:!0,children:e.currentPaymentType.name})})]}),r&&o.gtSm&&t.jsx(qn,{})]})},Jn=s=>u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none",viewBox:"0 0 20 20",...s},u.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"m2.5 10 5 5 10-10"})),Zn=s=>u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none",viewBox:"0 0 20 20",...s},u.createElement("path",{fill:"currentColor",d:"m13.993 8.505-6.419 6.42c-.452.452-.679.678-.942.857s-.558.304-1.145.556l-.824.353c-1.622.695-2.434 1.043-2.833.644-.398-.399-.05-1.21.645-2.832l.352-.824c.252-.588.379-.882.557-1.145.178-.264.405-.49.857-.943l6.42-6.42zm2.673 7.329a.834.834 0 1 1 0 1.666h-5a.833.833 0 0 1 0-1.666zm-2.5-13.823c.345 0 .624.278 1.179.833l.977.977c.555.555.832.834.833 1.179 0 .345-.278.623-.833 1.178l-1.15 1.149-3.334-3.334 1.15-1.149c.555-.555.833-.833 1.178-.833"})),es=s=>{const{t:e}=C("cart"),n=()=>s.setIsEditMode(!s.isEditMode),r=L();return t.jsxs(P,{justifyContent:"space-between",backgroundColor:"$backgroundLight",paddingVertical:"$2",paddingHorizontal:"$4",marginTop:"$2",alignItems:"center",$sm:{paddingHorizontal:"$5",paddingVertical:"$3"},children:[r.sm&&t.jsx(J,{onPress:s.closeModal,children:t.jsx(Ot,{})}),t.jsx(p,{size:"$title-l",semibold:!0,children:e("payment-type-modal.header")}),t.jsx(J,{onPress:n,children:s.isEditMode?t.jsx(Jn,{}):t.jsx(Zn,{})})]})},ts=s=>u.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none",viewBox:"0 0 20 20",...s},u.createElement("path",{fill:"currentColor",d:"M9.999.834c.602 0 1.125-.002 1.552.047.447.053.88.17 1.268.467q.066.052.13.106c.367.322.566.724.705 1.152.133.408.234.922.352 1.512l.047.235c1.694.156 2.964.374 3.664.514a.77.77 0 0 1 .616.764c0 .526-.495.921-1.013.827q-.137-.025-.292-.051l-.77 8.226c-.202 2.154-.303 3.23-1.019 3.882-.715.652-1.797.651-3.96.651H8.72c-2.163 0-3.244 0-3.96-.65-.71
15-.652-.816-1.73-1.018-3.883L2.97 6.407l-.292.05c-.518.095-1.012-.3-1.012-.826 0-.37.252-.692.616-.764.7-.14 1.969-.358 3.662-.514l.048-.235c.118-.59.22-1.104.353-1.512.139-.428.338-.83.706-1.152a3 3 0 0 1 .128-.106C7.567 1.051 8 .934 8.447.881c.427-.05.95-.047 1.552-.047m-2.083 7.5a.833.833 0 0 0-.833.833v5a.833.833 0 0 0 1.666 0v-5a.833.833 0 0 0-.833-.833m4.167 0a.833.833 0 0 0-.833.833v5a.833.833 0 1 0 1.666 0v-5a.833.833 0 0 0-.833-.833M9.999 2.5c-.641 0-1.05.002-1.357.038-.286.033-.39.087-.45.133l-.043.036c-.057.05-.13.14-.22.414-.083.259-.156.6-.258 1.107a45 45 0 0 1 4.656 0c-.102-.506-.174-.849-.258-1.107-.089-.274-.163-.365-.22-.414l-.042-.036c-.06-.046-.163-.1-.45-.133C11.05 2.502 10.641 2.5 10 2.5"})),ns=s=>{const{repositorySavedCards:e}=j(),{t:n}=C("cart"),[r,i]=u.useState(!1),o=async()=>{try{i(!0),await e.removeSavedCard(s.cardView.id)}finally{s.onOpenChange(!1)}},a=()=>s.onOpenChange(!1);return t.jsx(At,{open:s.isOpen,onOpenChange:s.onOpenChange,children:t.jsxs(R,{onClose:a,children:[t.jsx(R.Header,{title:n("remove-saved-card-modal.title"),description:n("remove-saved-card-modal.description")}),t.jsx(R.Footer,{submitText:n("remove-saved-card-modal.submit"),onSubmitPress:o,submitButtonProps:{disabled:r},cancelText:n("remove-saved-card-modal.cancel"),onCancelPress:a})]})})},ss=function(e){const n=e.paymentType.kind===M.SAVED,[r,i]=u.useState(!1),o=()=>i(!0),a=L(),l=e.isEditMode&&a.gtSm&&!n,c=()=>{e.onSelect(e.paymentType)};return t.jsxs(b,{flexDirection:"row",justifyContent:"space-between",alignItems:"flex-start",paddingBottom:e.withSeparator?"$3":0,hoverStyle:{cursor:"pointer"},children:[t.jsxs(P,{onPress:c,disabled:e.isEditMode,gap:"$3",width:"100%",children:[e.paymentType.icon&&t.jsx(Ve,{src:`/card-payment-images/${e.paymentType.icon}`,objectFit:"contain",width:32,height:"$2.5"}),t.jsxs(b,{flexDirection:"row",alignItems:"center",flex:1,justifyContent:"space-between",...e.withSeparator&&{borderColor:"$backgroundLight",paddingBottom:"$3",borderBottomWidth:1},children:[n?t.jsx(rt,{cardNumber:e.paymentType.name}):t.jsx(p,{size:"$title-m",semibold:!0,children:e.paymentType.name}),e.isEditMode&&n?t.jsx(b,{onPress:o,children:t.jsx(ts,{height:O("$2.25","size"),color:O("$alert","color")})}):t.jsx(Et,{pointerEvents:"none",checked:e.selected,disabled:l})]}),l&&t.jsx(b,{position:"absolute",inset:0,backgroundColor:"$white",opacity:.5,cursor:"not-allowed"})]}),n&&t.jsx(ns,{onOpenChange:i,cardView:e.paymentType,isOpen:r})]})},ie=T(function(e){return e.paymentTypes.length?t.jsx(B,{marginHorizontal:"$2",$sm:{marginHorizontal:"$5"},children:e.paymentTypes.map((n,r,i)=>t.jsx(ss,{paymentType:n,onSelect:e.onSelect,selected:e.selectedPaymentType?.id===n.id,withSeparator:r<i.length-1,isEditMode:e.isEditMode},n.name))}):null}),it=T(s=>{const{preorderStore:e}=j(),[n,r]=u.useState(!1),[i,o]=u.useState(s.currentPaymentType),a=Jt(),l=L(),c=n&&l.sm,d=s.paymentTypes.filter(f=>f.type===D.CARD&&!c||f.type===D.SAVED_CARD),h=!!s.paymentTypes.find(f=>f.type===D.SAVED_CARD),g=s.paymentTypes.filter(f=>f.type===D.SBP_NEW_PAY),m=s.paymentTypes.filter(f=>!(f.type===D.CARD||f.type===D.SAVED_CARD||f.type===D.SBP_NEW_PAY)),y=f=>{a.impactLight(),o(f),e.setPaymentType(f.type),e.setCardUId(f.kind===M.SAVED?f.id:void 0),s.closeModal()};return u.useEffect(()=>{!h&&n&&r(!1)},[h,n]),t.jsxs($,{gap:"$2",marginBottom:"$2",children:[t.jsx(es,{isEditMode:n,setIsEditMode:r,closeModal:s.closeModal}),t.jsx(ie,{paymentTypes:d,onSelect:y,selectedPaymentType:i,isEditMode:n}),!c&&t.jsxs(t.Fragment,{children:[t.jsx(ie,{paymentTypes:g,onSelect:y,selectedPaymentType:i,isEditMode:n}),t.jsx(ie,{paymentTypes:m,onSelect:y,selectedPaymentType:i,isEditMode:n})]})]})}),rs=s=>t.jsx(w,{open:s.isOpen,children:t.jsx(w.Content,{children:t.jsx(it,{closeModal:s.closeModal,paymentTypes:s.paymentTypes,currentPaymentType:s.currentPaymentType})})}),is="_pseudoPayment_2ppcv_1",os={pseudoPayment:is},Pe=s=>{const e=u.useRef(null),n=u.useRef(null),[r,i]=u.useState(0),[o,a]=u.useState(0),[l,c]=u.useState(0),[d,h]=u.useState(0),[g,m]=u.useState(!1);u.useLayoutEffect(()=>{const f=e.current;f&&(a(f.getBoundingClientRect().width),i(f.getBoundingClientRect().height),c(f.getBoundingClientRect().width))},[]),u.useEffect(()=>{const f=n.current;g&&f&&h(r+f.getBoundingClientRect().height)},[g,r]);const y=()=>
1{Ht.animateScroll.scrollToBottom({containerId:"paymentScrollView",duration:150})};return t.jsxs(b,{children:[t.jsxs(ne,{onOpenChange:f=>m(f),open:g,children:[t.jsx(ne.Trigger,{ref:e,asChild:!0,children:s.children}),t.jsx(ne.Content,{unstyled:!0,width:o,ref:n,backgroundColor:"$backgroundLight",borderRadius:"$8",onOpenAutoFocus:y,children:t.jsx(it,{paymentTypes:s.paymentTypes,currentPaymentType:s.currentPaymentType,closeModal:()=>{m(!1)}})})]}),t.jsx(b,{position:"absolute",className:os.pseudoPayment,style:{width:l,height:d,display:g?"flex":"none"}})]})},ot=T(function(){const{t:e}=C("cart"),{preorderStore:n,repositorySavedCards:r,receivingStore:i}=j(),[o,a]=u.useState(!1),l=()=>{a(!0)},c=()=>{a(!1)},d=Le(()=>new Xn(n,r.data,i.receivingType)).get().execute(),h=d.availablePaymentTypes,g=d.currentPaymentType,m=L();return h.length===0&&!g?null:m.sm?t.jsxs(t.Fragment,{children:[g&&t.jsxs(B,{gap:"$4",onPress:l,marginHorizontal:"$5",children:[t.jsx(p,{size:"$display-s",children:e("payment-stage.payment-type-info.title")}),t.jsx(re,{currentPaymentType:g,receivingType:i.receivingType})]}),!g&&t.jsx(Z,{gap:"$3",padding:"$0",onPress:l,justifyContent:"space-between",marginHorizontal:"$5",bottomChevron:!0,children:t.jsx(p,{size:"$title-m",semibold:!0,children:e("payment-stage.payment-type-info.unselected-payment-type")})}),t.jsx(rs,{isOpen:o,paymentTypes:h,closeModal:c,currentPaymentType:g})]}):t.jsxs(t.Fragment,{children:[g&&h.length===1&&t.jsxs(B,{gap:"$4",children:[t.jsx(p,{size:"$display-s",children:e("payment-stage.payment-type-info.title")}),t.jsx(re,{currentPaymentType:g,receivingType:i.receivingType,disabled:!0})]}),g&&h.length>=2&&t.jsx(Pe,{currentPaymentType:g,paymentTypes:h,children:t.jsxs(B,{gap:"$4",children:[t.jsx(p,{size:"$display-s",children:e("payment-stage.payment-type-info.title")}),t.jsx(re,{currentPaymentType:g,receivingType:i.receivingType})]})}),!g&&t.jsx(Pe,{currentPaymentType:g,paymentTypes:h,children:t.jsx(Z,{gap:"$3",justifyContent:"space-between",bottomChevron:!0,children:t.jsx(p,{size:"$title-m",semibold:!0,children:e("payment-stage.payment-type-info.unselected-payment-type")})})})]})}),as=T(function(){const{receivingStore:e}=j(),n=Lt(),r=Ze(),[i,o]=u.useState(!1),a=e.selectedLocation,l=()=>{o(!0)};return u.useEffect(()=>{a||l()},[a]),r?t.jsx(nt,{preorderGuid:r}):t.jsxs(t.Fragment,{children:[t.jsxs(P,{overflow:"hidden",height:"100%",children:[t.jsxs(Be,{paddingVertical:"$6",scrollbarWidth:"none",width:fe.cartDesktopMain,paddingHorizontal:"$6",id:"paymentScrollView",children:[t.jsx(b,{ref:n,height:1,flexShrink:0}),t.jsxs($,{gap:"$5",children:[t.jsx(Zt,{}),t.jsx(We,{title:a?.disclaimerTitle,description:a?.disclaimerText}),t.jsx(st,{onOpenMap:l}),t.jsx(tt,{}),t.jsx(ot,{}),t.jsx(et,{})]})]}),t.jsxs($,{width:fe.cartDesktopSidebar,maxHeight:660,backgroundColor:"$white",marginTop:"$6",borderRadius:"$8",justifyContent:"space-between",children:[t.jsx(Ye,{}),t.jsx(Ue,{})]})]}),t.jsx(ze,{isOpen:i,onOpenChange:o})]})}),ls=T(function(){const{receivingStore:e}=j(),[n,r]=u.useState(0),[i,o]=u.useState(!1),a=e.selectedLocation,l=h=>{r(h)},c=()=>{o(!0)};u.useEffect(()=>{a||c()},[a]);const d=Ze();return d?t.jsx(nt,{preorderGuid:d}):t.jsxs(K,{children:[t.jsx(K.Header,{children:t.jsx(en,{})}),t.jsx(K.ScrolledContent,{children:t.jsxs($,{gap:"$5",marginBottom:n+O("$5","
1space"),paddingTop:"$2",children:[t.jsx(We,{title:a?.disclaimerTitle,description:a?.disclaimerText,marginHorizontal:"$5"}),t.jsx(st,{onOpenMap:c}),t.jsx(tt,{}),t.jsx(ot,{}),t.jsx(et,{}),t.jsx(Ye,{})]})}),t.jsx(K.Footer,{children:t.jsx(Ue,{onLayout:l})}),t.jsx(ze,{isOpen:i,onOpenChange:o})]})}),cs=()=>{const s=L(),e=u.useMemo(()=>new kt,[]);return u.useEffect(()=>{if(s.sm){const n=document.querySelector("meta[name=theme-color]");n&&n.setAttribute("content",O("$backgroundLight","color"))}return()=>{if(s.sm){const n=document.querySelector("meta[name=theme-color]");n&&n.setAttribute("content",O("$black","color"))}}},[s.sm]),t.jsxs(Bt.Provider,{value:e,children:[s.gtSm?t.jsx(as,{}):t.jsx(ls,{}),t.jsx(An,{}),t.jsx(Rt,{})]})},Ss=cs;export{Ss as component};
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.