https://eshelny.com/_next/static/chunks/pages/order/[location]/account/addresses-e9812a5406f3efd5.js
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2165,8763,9976],{38385:function(e,l,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/order/[location]/account/addresses",function(){return t(76059)}])},13163:function(e,l,t){"use strict";t.d(l,{HY:function(){return u},Kz:function(){return o},Um:function(){return c}});let r=e=>(null!=e?e:"").trim().toLowerCase(),s=e=>[r(e.formattedAddress),r(e.apt),r(e.floor),r(e.entrance)].join("|"),a=e=>{var l;return s({formattedAddress:e.formattedAddress,apt:null!==(l=e.apt)&&void 0!==l?l:e.unit,floor:e.floor,entrance:e.entrance})},n="Delivery address",d=/^Delivery address(?:\s+(\d+))?$/i,i=e=>{let l=e.map(e=>{var l;let t=(null!==(l=e.label)&&void 0!==l?l:"").trim().match(d);if(!t)return null;if(!t[1])return 1;let r=Number.parseInt(t[1],10);return Number.isFinite(r)&&r>0?r:null}).filter(e=>null!==e);return 0===l.length?n:"".concat(n," ").concat(Math.max(...l)+1)},o=e=>s({formattedAddress:e.formattedAddress,apt:e.apt,floor:e.floor,entrance:e.entrance}),c=(e,l)=>{let t=o(l);return e.some(e=>a(e)===t)},u=(e,l,t,r)=>{var s,a,n,d,o,c,u,m,h,f,v;let x=null===(a=e.metadata)||void 0===a?void 0:null===(s=a.find(e=>"google.place-id"===e.key))||void 0===s?void 0:s.value;return{label:(null==r?void 0:null===(n=r.label)||void 0===n?void 0:n.trim())||i(l),countryCode:e.countryCode,stateCode:e.stateCode,city:e.city,streetName:e.streetName,streetNumber:e.streetNumber,zipCode:e.zipCode,latitude:e.latitude,longitude:e.longitude,formattedAddress:null!==(d=e.formattedAddress)&&void 0!==d?d:"",unit:null!==(o=e.unit)&&void 0!==o?o:"",apt:null!==(c=e.apt)&&void 0!==c?c:"",floor:null!==(u=e.floor)&&void 0!==u?u:"",entrance:null!==(m=e.entrance)&&void 0!==m?m:"",note:null!==(h=e.note)&&void 0!==h?h:"",googlePlaceId:null!==(v=null!==(f=e.googlePlaceId)&&void 0!==f?f:x)&&void 0!==v?v:"",isDefault:t}}},76059:function(e,l,t){"use strict";t.r(l),t.d(l,{__N_SSP:function(){return S},default:function(){return D}});var r=t(85893),s=t(67294),a=t(87536),n=t(34651),d=t(96515),i=t(24366),o=t(1288),c=t(21203),u=t(25613),m=t(96098),h=t(41855),f=t(68850),v=t(78763),x=t(43765),b=t(10553),j=t(28151),p=t(9976),C=t(79758),g=t(7423),y=t(4235),N=t(54691),k=t(89361),w=t(54495),L=t(13163),A=t(63451);let H=["places","geometry"];var Z=e=>{var l,t;let{isOpen:s,setOpen:u,handleClose:f,addressesForm:v,editing:x,setEditing:j,setShowErrorToast:p,sortedAddresses:Z}=e,_=(0,h.Gc)(),M=(0,w.Z)(),{isLoaded:z,loadError:E}=(0,C.m)({googleMapsApiKey:"AIzaSyB6I0JRpwVu-zd0NEVkQ6YawItvCa7G-34",libraries:H}),{mutateAsync:S,isLoading:D}=(0,b.KD)(),{mutateAsync:P,isLoading:T}=(0,b.ub)(),F=(e,l)=>{j(t=>({...t||{},[e]:l}))},{register:I,formState:{errors:q}}=v,K=async e=>{F("formattedAddress",e);try{let{countryCode:l,stateCode:t,city:r,streetName:s,streetNumber:a,zipCode:n,lat:d,lng:i,place_id:o}=await (0,k.uR)(e,{caller:"AddAddressForm",isGeoLoggingEnabled:M});j(c=>({...c||{},formattedAddress:e,countryCode:l,stateCode:t,city:r,streetName:s,streetNumber:a,zipCode:n,latitude:d,longitude:i,googlePlaceId:o,floor:(null==x?void 0:x.floor)||"",entrance:(null==x?void 0:x.entrance)||"",unit:""}))}catch(e){}},O=v.handleSubmit(async()=>{var e,l;if(!x||!x.formattedAddress)return;let t={...x,isDefault:null!==(e=x.isDefault)&&void 0!==e?e:0===Z.length};try{if(x.id){let{id:e,...l}=t;await P({id:x.id,...l})}else await S((0,L.HY)(t,Z,null!==(l=t.isDefault)&&void 0!==l&&l,{label:x.label}));u(!1),j(null),(0,A.F)(x.id?"Address updated":"Address added"),n.ZP.capture("profile_address_added")}catch(e){p(!0)}});return s?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex-auto",children:[(0,r.jsx)(d.kC,{align:"center",className:"shrink-0",children:(0,r.jsx)(c.e,{title:"Back to delivery adresses",url:"#",onClick:f,hideTitleMobile:!0})}),(0,r.jsx)(i.Nb,{as:"h1",weight:"bold",size:20,className:"mt-500 tablet:mt-650 tablet:text-24",children:(null==x?void 0:x.id)?"Edit address":"New address"}),(0,r.jsx)(y.d,{when:"mobile"===_,children:(0,r.jsx)(m.iz,{className:"mb-100 mt-400 w-full shrink-0"})}),(0,r.jsx)("div",{className:"mt-400 w-full",children:(0,r.jsxs)(a.RV,{...v,children:[(0,r.jsx)(g.I,{type:"text",...I("label",{required:"The field is required"}),required:!0,placeholder:"Label (e.g., Home, Work)",value:(null==x?void 0:x.label)||"",onChange:e=>F("label",e.target.value),error:null===(l=q.label)||void 0===l?void 0:l.message,className:"mb-350"}),(0,r.jsx)("div",{className:"mb-350",children:!E&&z&&(0,r.jsx)(N.Z,{name:"delivery.address.formattedAddress",onSelect:K})}),(0,r.jsx)(g.I,{type:"text",...I("apt",{required:"Apartment / Unit is required for this address"}),required:!0,placeholder:"Apartament",value:(null==x?void 0:x.apt)||"",onChange:e=>F("apt",e.target.value),error:null===(t=q.apt)||void 0===t?void 0:t.message,className:"mb-350"}),(0,r.jsx)(g.I,{type:"text",...I("floor"),placeholder:"Floor",value:(null==x?void 0:x.floor)||"",onChange:e=>F("floor",e.target.value),className:"mb-350"}),(0,r.jsx)(g.I,{type:"text",...I("entrance"),placeholder:"Entrance",value:(null==x?void 0:x.entrance)||"",onChange:e=>F("entrance",e.target.value)})]})})]}),(0,r.jsx)(d.Le,{bottom:"0",className:"shrink-0 bg-white py-400",children:(0,r.jsx)(d.kC,{justify:"center",children:(0,r.jsx)(o.z,{variant:"outlined",size:"xl",onClick:O,loading:D||T,className:"mobile:py-150 mobile:text-16",children:"Save changes"})})})]}):null};let _={label:"",formattedAddress:"",apt:"",floor:"",entrance:"",note:""};var M=e=>{let{location:l}=e,t=(0,h.Gc)(),{data:C,isLoading:g}=(0,b.RQ)(),{mutate:y}
1=(0,b.eT)(),[N,k]=(0,s.useState)(!1),[w,L]=(0,s.useState)(null),[H,M]=(0,s.useState)(!1),z=(0,s.useMemo)(()=>(null!=C?C:[]).slice().sort((e,l)=>e.isDefault?-1:1),[C]),E=(0,a.cI)({mode:"onTouched",defaultValues:_});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Z,{isOpen:N,setOpen:k,handleClose:()=>{k(!1),M(!1),L(null)},addressesForm:E,editing:w,setEditing:L,setShowErrorToast:M,sortedAddresses:z}),(0,r.jsxs)(u.d,{when:!N,children:[(0,r.jsxs)("div",{className:"shrink-0",children:[(0,r.jsx)(d.kC,{align:"center",children:(0,r.jsx)(c.e,{title:"Back to account",url:x.g.account.overview(l.slug),hideTitleMobile:!0})}),(0,r.jsx)(d.kC,{className:"items-center justify-between",children:(0,r.jsx)(i.Nb,{as:"h1",weight:"bold",size:20,className:"mt-500 tablet:mt-650 tablet:text-24",children:"Delivery addresses"})})]}),(0,r.jsx)(u.d,{when:"mobile"===t,children:(0,r.jsx)(m.iz,{className:"mb-100 mt-400 w-full shrink-0"})}),(0,r.jsx)(d.kC,{direction:"column",className:"flex-auto pb-600 mobile:pb-300",children:(0,r.jsx)(u.d,{when:!g&&z.length>0,fallback:(0,r.jsxs)(d.kC,{role:"status",direction:"column",align:"center",justify:"center",className:"w-full flex-auto",children:[(0,r.jsx)(p.default,{size:32,color:"gray150"}),(0,r.jsx)(i.Nb,{className:"mt-100",size:14,color:"gray150",children:"No addresses added"})]}),children:(0,r.jsx)("ol",{"aria-label":"Saved delivery addresses",className:"m-0 mt-400 w-full list-none p-0",children:z.map(e=>(0,r.jsx)("li",{className:"mb-300 border-b-1 border-b-gray300 pb-300 last:mb-0",children:(0,r.jsxs)(d.kC,{align:"center",children:[(0,r.jsx)(d.kC,{align:"center",justify:"center",className:"h-[60px] w-[60px] shrink-0 rounded-8 bg-gray450",children:(0,r.jsx)(p.default,{size:32,color:"gray150",className:"mt-25 shrink-0"})}),(0,r.jsxs)("div",{className:"flex-auto px-300",children:[(0,r.jsxs)(i.Nb,{as:"strong",weight:"bold",size:14,children:[e.label||"Address"," ",e.isDefault?"(Default)":""]}),(0,r.jsx)(i.Nb,{as:"p",size:12,className:"mt-50",children:e.formattedAddress})]}),(0,r.jsxs)(d.kC,{className:"shrink-0",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{L(e),E.reset({delivery:{address:{formattedAddress:e.formattedAddress||""}}}),k(!0)},"aria-label":"Edit address",children:(0,r.jsx)(f.default,{size:16,color:"gray200"})}),(0,r.jsx)("button",{type:"button",onClick:()=>y({id:e.id},{onSuccess:()=>(0,A.F)("Address deleted")}),"aria-label":"Delete address",children:(0,r.jsx)(v.default,{size:16,color:"gray200",className:"ml-100"})})]})]})},e.id))})})}),(0,r.jsx)(d.Le,{bottom:"0",className:"shrink-0 bg-white py-400",children:(0,r.jsx)(d.kC,{justify:"center",children:(0,r.jsx)(o.z,{variant:"outlined",size:"xl",className:"",onClick:()=>{L(_),E.reset(_),k(!0),n.ZP.capture("profile_click_add_address")},children:"Add address"})})})]}),(0,r.jsx)(j.Z,{variant:"info",position:"top-right",showNotification:H,title:"Error",description:"Failed to save address. Please try again.",onOpenChange:M,closeButton:!0,closeHandle:()=>M(!1)})]})},z=t(85202),E=t(85540),S=!0,D=e=>{let{location:l}=e,{slug:t,loyalty:s}=l;return(0,E.H)({slug:t,loyalty:s}),(0,r.jsx)(z.G,{className:"pb-0",children:(0,r.jsx)(M,{location:l})})}},10553:function(e,l,t){"use strict";t.d(l,{KD:function(){return m},RQ:function(){return u},eT:function(){return f},ub:function(){return h}});var r=t(67848),s=t(85945),a=t(48228),n=t(88363),d=t(375),i=t(98724),o=t(75902);let c=["account-profile-addresses"],u=()=>{var e;let{auth:l}=(0,d.a)(),t=null!==(e=null==l?void 0:l.accessToken.token)&&void 0!==e?e:"",s=(0,i.Po)(),a=(0,o.Z)();return(0,r.a)({queryKey:c,queryFn:()=>(0,n.ck)({token:t,isStorefrontBffEnabled:a}),enabled:!!t,refetchOnMount:!0,refetchOnReconnect:!1,refetchOnWindowFocus:!1,retry:i.TI,onError:s})},m=()=>{var e;let{auth:l}=(0,d.a)(),t=null!==(e=null==l?void 0:l.accessToken.token)&&void 0!==e?e:"",r=(0,s.NL)(),u=(0,i.Po)(),m=(0,o.Z)();return(0,a.D)({mutationFn:e=>(0,n.wm)({payload:{...e,token:t},isStorefrontBffEnabled:m}),onSuccess:()=>{r.invalidateQueries({queryKey:c})},onError:u})},h=()=>{var e;let{auth:l}=(0,d.a)(),t=null!==(e=null==l?void 0:l.accessToken.token)&&void 0!==e?e:"",r=(0,s.NL)(),u=(0,i.Po)(),m=(0,o.Z)();return(0,a.D)({mutationFn:e=>(0,n.TG)({payload:{...e,token:t},isStorefrontBffEnabled:m}),onSuccess:()=>{r.invalidateQueries({queryKey:c})},onError:u})},f=()=>{var e;let{auth:l}=(0,d.a)(),t=null!==(e=null==l?void 0:l.accessToken.token)&&void 0!==e?e:"",r=(0,s.NL)(),u=(0,i.Po)(),m=(0,o.Z)();return(0,a.D)({mutationFn:e=>(0,n.em)({payload:{...e,token:t},isStorefrontBffEnabled:m}),onSuccess:()=>{r.invalidateQueries({queryKey:c})},onError:u})}},78763:function(e,l,t){"use strict";t.r(l);var r=t(85893);t(67294);var s=t(65623);l.default=e=>{let{color:l,secondColor:t,thirdColor:a,...n}=e;return(0,r.jsxs)(s.le,{...n,viewBox:"0 0 20 20",fill:l,children:[(0,r.jsx)(s.y$,{d:"M3.33398 17.7777C3.33398 19.0055 4.32841 19.9999 5.55622 19.9999H14.4451C15.6729 19.9999 16.6673 19.0055 16.6673 17.7777V4.44434H3.33398V17.7777Z",color:l}),(0,r.jsx)(s.y$,{d:"M13.8893 1.11109L12.7782 0H7.22266L6.11151 1.11109H2.22266V3.33333H17.7782V1.11109H13.8893Z",color:l})]})}},9976:function(e,l,t){"use strict";t.r(l);var r=t(85893);t(67294);var s=t(65623);l.default=e=>{let{color:l,secondColor:t,thirdColor:a,...n}=e;return(0,r.jsxs)(s.le,{...n,viewBox:"0 0 32 32",fill:l,children:[(0,r.jsxs)("g",{clipPath:"url(#clip0_12623_16610)",children:[(0,r.jsx)(s.y$,{d:"M19.75 16.25C19.405 16.25 19.125 16.53 19.125 16.875C19.125 17.22 19.405 17.5 19.75 17.5C20.095 17.5 20.375 17.22 20.375 16.875C20.375 16.53 20.095 16.25 19.75 16.25Z",color:l}),(0,r.jsx)(s.y$,{d:"M6.38545 23.1118L0.135457 30.9868C-0.0137128 31.1745 -0.0420331 31.4311 0.0622148 31.6469C0.166463 31.863 0.385212 32.0002 0.624958 32.0002H31.3749C31.6147 32.0002 31.8334 31.863 31.9377 31.6469C32.0422 31.4311 32.0136 31.1745 31.8644 30.9868L25.6144 23.1118C25.496 22.9624 25.3156 22.8752 25.1249 22.8752H19.6501L24.3241 15.5442C25.4206 13.9004 25.9999 11.9834 25.9999 10.0002C25.9999 4.48632 21.5141 0.000244141 15.9999 0.000244141C10.4858 0.000244141 5.99995 4.48632 5.99995 10.0002C5.99995 11.9834 6.5793 13.9001 7.67573 15.5442L12.3498 22.8752H6.87495C6.68428 22.8752 6.5041 22.9624 6.38545 23.1118ZM4.05196 28.0627H7.831L5.69819 30.7502H1.9189L4.05196 28.0627ZM13.1469 24.1252L14.8603 26.8127H10.4189L12.5519 24.1252H13.1469ZM18.8532 24.1252H19.4482L21.581 26.8127H17.1398L18.8532 24.1252ZM22.5732 28.0627L24.706 30.7502H7.29389L9.42695 28.0627H22.5732ZM26.3019 30.7502L24.1689 28.0627H27.9482L30.081 30.7502H26.3019ZM2
16.956 26.8127H23.1769L21.0439 24.1252H24.8232L26.956 26.8127ZM8.71918 14.8557C7.75801 13.4167 7.24995 11.7378 7.24995 10.0002C7.24995 5.17553 11.1752 1.25024 15.9999 1.25024C20.8246 1.25024 24.7499 5.17553 24.7499 10.0002C24.7499 11.7378 24.2419 13.4167 23.2809 14.8557C23.2782 14.8594 23.2761 14.863 23.2736 14.8667C22.8632 15.5105 16.3161 25.7795 15.9999 26.2751C15.2048 25.0278 9.53608 16.1367 8.72626 14.8667C8.72407 14.863 8.72163 14.8594 8.71918 14.8557ZM10.956 24.1252L8.82319 26.8127H5.0439L7.17695 24.1252H10.956Z",color:l}),(0,r.jsx)(s.y$,{d:"M16 16.25C19.4311 16.25 22.25 13.4714 22.25 9.99999C22.25 6.55371 19.4463 3.75 16 3.75C12.5537 3.75 9.75 6.55371 9.75 9.99999C9.75 13.4724 12.5698 16.25 16 16.25ZM16 5C18.7571 5 21 7.24292 21 9.99999C21 12.7827 18.739 15 16 15C13.2602 15 11 12.7827 11 9.99999C11 7.24292 13.2429 5 16 5Z",color:l}),(0,r.jsx)(s.y$,{d:"M18.6328 18.3828C18.3374 18.2046 17.9531 18.2998 17.7749 18.5954L15.4648 22.428C15.2866 22.7236 15.3818 23.1076 15.6775 23.2859C15.9744 23.4648 16.3579 23.3677 16.5354 23.0732L18.8454 19.2407C19.0237 18.9451 18.9284 18.561 18.6328 18.3828Z",color:l})]}),(0,r.jsx)("defs",{children:(0,r.jsx)("clipPath",{id:"clip0_12623_16610",children:(0,r.jsx)(s.UL,{width:"32",height:"32",fill:"white"})})})]})}}},function(e){e.O(0,[1182,2888,9774,179],function(){return e(e.s=38385)}),_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.