1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7912],{82656:function(e,t,r){"use strict";r.d(t,{K:function(){return p}});var i=r(85893),s=r(67294),n=r(24402),o=r(2327),a=r(54866),d=r(7711);let l=(0,a.ZP)(o.Z,{name:"Radio",slot:"Radio",shouldForwardProp:e=>"hidden"!==e})(e=>{let{hidden:t}=e;return{display:t?"none":"inline-flex","&:hover":{backgroundColor:"transparent"}}}),u=(0,a.ZP)("span",{name:"RadioIcon",slot:"RadioIcon"})(e=>{let{theme:t}=e;return{borderRadius:18,width:16,height:16,backgroundColor:"transparent",borderWidth:1,borderColor:t.palette.text.dark.primary,borderStyle:"solid","input:disabled ~ &":{boxShadow:"none",borderColor:t.palette.text.light.tertiary,background:"transparent"},".errorIcon":{borderRadius:18,width:16,height:16,backgroundColor:"transparent",borderWidth:1,borderColor:t.palette.color.error,borderStyle:"solid"}}}),c=(0,a.ZP)("span",{name:"RadioCheckedIconWrapper",slot:"RadioIcon"})(e=>{let{theme:t}=e;return{borderRadius:18,color:t.palette.text.light.primary,width:16,height:16,display:"inherit",borderWidth:1,borderColor:t.palette.text.dark.primary,borderStyle:"solid",position:"relative","input:disabled ~ &":{boxShadow:"none",borderColor:t.palette.text.light.tertiary,background:"transparent"},"& > svg":{position:"absolute",height:24,width:24,right:-4.7,top:-4.7}}}),p=s.forwardRef(e=>{let{error:t,disabled:r,...s}=e,o=(0,d.Z)();return(0,i.jsx)(l,{icon:(0,i.jsx)(u,{className:t?"errorIcon":""}),disableRipple:!0,checkedIcon:(0,i.jsx)(c,{theme:o,children:(0,i.jsx)(n.b2,{htmlColor:r?o.palette.text.light.tertiary:o.palette.text.dark.primary})}),disabled:r,error:t,...s})})},46936:function(e,t,r){"use strict";r.d(t,{E:function(){return n},P:function(){return o}});var i=r(47318),s=r(54866);let n=(0,s.ZP)(i.Z)(e=>{let{row:t,theme:r}=e;return{".MuiFormControlLabel-root":{alignItems:"flex-start",marginBottom:t?0:24,padding:0},".MuiRadio-root":{"&:hover":{backgroundColor:"transparent"},padding:r.spacing(1,3,0,0),margin:0}}}),o=(0,s.ZP)("div",{name:"StyledRadio",slot:"Description"})(e=>{let{theme:t}=e;return{fontSize:t.typography.body2.fontSize,marginLeft:t.spacing(7)}})},55690:function(e,t,r){"use strict";r.d(t,{L:function(){return c}});var i=r(75900),s=r(41493),n=r(65474),o=r(10558),a=r(97388),d=r(67294),l=r(14416);let u=e=>e.filter(e=>!["addressLine1","addressLine2","city","state","country","zipCode"].includes(e.fieldName)),c=e=>{let{setUpdateShippingFormFields:t}=e,{mySite:r}=(0,n.W4)(),{totalProductPrice:c}=(0,l.useSelector)(i.iq),p=(0,o.q)(),h=(0,l.useSelector)(a.xn),f=p?u(h):h,[m]=(0,s.Lz)(),g=(0,d.useCallback)(e=>!!(e.threshold&&Number(e.threshold))&&c<e.threshold,[c]),v=(0,d.useCallback)(e=>e.map(e=>"fiscalCode"===e.fieldName?{...e,mandatory:!!e.mandatory||g(e)}:e),[g]),b=async e=>{let t={formValues:e,storeId:r.storeID};await m(t)};return(0,d.useEffect)(()=>{h&&c&&t(v(f))},[h,c,v,t]),{fetchPostFiscalCode:b}}},62877:function(e,t,r){"use strict";r.d(t,{Z:function(){return q}});var i=r(85893),s=r(66812),n=r(3954),o=r(75900),a=r(24779),d=r(48550),l=r(52840),u=r(82669),c=r(55690),p=r(10558),h=r(97083),f=r(89848),m=r(18434),g=r(73707),v=r(67294),b=r(14416),y=r(20891),S=r(74440),x=r(85),C=r(65474),I=r(7056);let N=e=>{var t;let{subscribe:r}=e,{hasNewsletter:i}=(0,h.v)(),[s,n]=(0,v.useState)(i),{langCode:o}=(0,I.d)(),{mySite:a}=(0,C.W4)(),d=(0,v.useMemo)(()=>{var e;return(0,x.Ab)(null==a?void 0:null===(e=a.xStoreCfg)||void 0===e?void 0:e.optInBoxes)},[null==a?void 0:null===(t=a.xStoreCfg)||void 0===t?void 0:t.optInBoxes]),u=!i&&(!d||d&&s);return(0,v.useEffect)(()=>{u&&!d&&x.Fo.includes(o)&&((0,l.qu)({service:"newsletter",event:"subscribe-to-newsletter-use-effect"},{hasNewsletter:i,hasNewsletterSubscriptionCheckmark:d,isNewsletterSubscribeChecked:s,langCode:o,shouldSubscribeToNewsletter:u}),r())},[i,d,s,o,u]),{isNewsletterSubscribeChecked:s,setIsNewsletterSubscribeChecked:n,hasNewsletterSubscriptionCheckmark:d,shouldSubscribeToNewsletter:u}};var w=r(18778),k=r(6137),A=r(73353),_=r(41843),E=r(79963),j=r(2115);let L=e=>{let{benefits:t}=e;return(0,j.a)(t),null},P=()=>{var e;let{mySite:t}=(0,C.W4)(),r=null==t?void 0:null===(e=t.xStoreCfg)||void 0===e?void 0:e.DIRECT_BILLING_ENABLED,{benefits:s,loading:n,serviceStatus:o}=(0,E.S)();return r&&"unavailable"!==o?"ready"===o&&s&&!n?(0,i.jsx)(L,{benefits:s}):null:(0,i.jsx)(L,{})};var T=r(34945),Z=r(67648),R=r(88174),M=r(90512),D=r(34357),F=r(97388),O=r(28928),V=r.n(O),B=e=>{let{hasNewsletterSubscriptionCheckmark:t,isNewsletterSubscribeChecked:r,shippingLoading:n,isTermsAndAgeChecked:o,onTermsAndAgeChange:a,onButtonClick:d,onNewsletterSubscribeChange:l,w
1asTermsAndAgeTouched:u}=e,{t:c,i18n:p}=(0,g.$G)(),h=!o&&u,{basePath:f,langCode:m}=(0,I.d)(),v=(0,b.useSelector)(F.li),y=m||(null===D.default||void 0===D.default?void 0:D.default.defaultLocale),S=f+(null==v?void 0:v.privacy);return(0,i.jsxs)("div",{className:V()["shipping-footer-wrapper"],children:[t&&(0,i.jsx)(T.I,{className:(0,M.Z)(V()["shipping-footer-control-label"]),label:(0,i.jsx)(g.cC,{i18nKey:"Shipping.Actions.ReceiveOffers",children:(0,i.jsx)(R.j,{variant:"no-underline",className:V()["privacy-policy-link"],href:S,external:!0})}),style:{margin:0},control:(0,i.jsx)(s.P,{color:"primary",value:r,checked:r,onChange:()=>l(!r)})}),(0,i.jsxs)("div",{children:[(0,i.jsx)(T.I,{className:(0,M.Z)(V()["shipping-footer-control-label"],{"with-error":h}),label:(0,i.jsx)(g.cC,{i18nKey:"Shipping.Actions.ConfirmTermsAndAge",children:(0,i.jsx)("a",{className:V()["privacy-policy-link"],href:"/pdfs/".concat(y,"/faq-4.pdf"),target:"_blank",rel:"noopener noreferrer"})}),style:{margin:0},control:(0,i.jsx)(s.P,{color:"primary",error:h,value:o,checked:o,onChange:()=>a(!o)})}),h&&(0,i.jsx)("div",{className:(0,M.Z)(V()["shipping-footer-control-error"]),children:c("Shipping.Msgs.PleaseFlagTheBox")})]}),(0,i.jsx)("div",{children:(0,i.jsx)(Z.z,{className:V()["shipping-footer-button"],dataAttr:{id:"Cart_ProceedToPayment",testId:"shipping-can-continue"},isLoading:n,disabled:n,type:"button",onClick:d,children:c("Shipping.Actions.Next")})}),"en-us"===p.language.toLowerCase()&&(0,i.jsx)("div",{className:V()["shipping-footer-note"],children:c("Shipping.Msgs.ProceedToPaymentNote")})]})},W=r(49078),z=r.n(W),G=r(68691),q=()=>{let[e,t]=(0,v.useState)(!1),[r,x]=(0,v.useState)(!1),C=(0,p.q)(),{usableShipAddresses:I,orderShippingAddressIdForList:E,shippingListSelectedAddressId:j,submit:L,subscribeToNewsletter:T,newShippingAddress:Z,addressId:R,handleAddressChange:M,isShippingUsedAsBilling:D,billingAddressData:F,shippingAddressData:O,setBillingAddressData:V,setShippingAddressData:W,userHasSavedAddresses:q,shippingLoading:H,addressChanging:J,setAddressId:K,handleShippingUpdateAddress:U,isProceedButtonEnabled:$}=(0,G.b)(),{isNewsletterSubscribeChecked:X,setIsNewsletterSubscribeChecked:Y,hasNewsletterSubscriptionCheckmark:Q,shouldSubscribeToNewsletter:ee}=N({subscribe:T}),{updateBillingFormFields:et,updatedShippingFormFields:er,shippingForm:ei,billingForm:es,setUpdateShippingFormFields:en,isEditingAddress:eo,setIsEditingAddress:ea,isSaveAddressChecked:ed}=(0,S.g)({billingAddressData:F,shippingAddressData:O,addressId:R,setShippingAddressData:W}),{userEmail:el,loggedIn:eu}=(0,h.v)();(0,v.useEffect)(()=>{C&&ep((0,a.jk)(!1))},[C]),(0,y.z)(u.A.SHIPPING);let{fetchPostFiscalCode:ec}=(0,c.L)({setUpdateShippingFormFields:en}),ep=(0,b.useDispatch)(),{t:eh}=(0,g.$G)(),ef=(0,b.useSelector)(o.wY),em=()=>{setTimeout(()=>{X&&el&&(0,d.aI)(el)},3e3)},eg=(0,v.useCallback)(e=>{r||x(!0),t(e)},[r]);return(0,v.useEffect)(()=>{ep((0,a.$P)([]))},[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(P,{}),(0,i.jsxs)("div",{children:[C&&(0,i.jsx)("p",{className:z()["shipping-description"],children:eh("Shipping.Description")}),!C&&(0,i.jsx)(_.Sh,{hidden:eo||!q,children:(0,i.jsx)(w.Z,{addressList:I,orderShippingAddressIdForList:E,selectedAddressId:j,handleChange:e=>M(e),setIsEditingAddress:ea,setAddressId:K})}),(0,i.jsx)(k.Z,{addressFormFields:er,addressType:D?n.Z1:n.ER,form:ei,formName:"address-form-".concat(A.I.SHIPPING),updateAddress:U,updateAddressData:O,isEditingAddress:eo,setIsEditingAddress:ea,hidden:!C&&!Z&&!eo,page:A.I.SHIPPING,onFormDataChanged:(e,t)=>{var r;ep((0,a.aj)(null!==(r=t.zipCode)&&void 0!==r?r:null)),W(t)}}),(0,i.jsx)(m.g,{}),!C&&(0,i.jsx)(f.Z,{control:(0,i.jsx)(s.P,{color:"primary",value:D,checked:D,onChange:e=>ep((0,a.jk)(e.target.checked)),style:{marginRight:9}}),label:eh("Shipping.Labels.UseBillingAsShipping"),style:{margin:0}}),!D&&!eo&&(0,i.jsx)("p",{className:z()["shipping-billing-title"],children:eh("Shipping.billingTitle")}),(0,i.jsx)(k.Z,{addressFormFields:et,addressType:n.BO,form:es,formName:"address-form-".concat(A.I.PAYMENT),hidden:D,page:A.I.PAYMENT,onFormDataChanged:(e,t)=>V(t),updateAddress:U,setIsEditingAddress:ea})]}),(0,i.jsx)(B,{hasNewsletterSubscriptionCheckmark:Q,isNewsletterSubscribeChecked:X,isProceesButtonDisabled:ef||!$,shippingLoading:H||J,onButtonClick:async()=>
1{if(await es.trigger(void 0,{shouldFocus:!0}),await ei.trigger(void 0,{shouldFocus:!0}),r||x(!0),!e)return;eo&&O&&(await U(O,D?n.Z1:n.ER),ea(!1)),em(),(0,l.qu)({service:"newsletter",event:"subscribe-to-newsletter-shipping"},{shouldSubscribeToNewsletter:ee,isNewsletterSubscribeChecked:X,userEmail:el}),await L(ee,X,el);let t=ei.control._formValues;""!==t.fiscalCode&&ec(t)},onNewsletterSubscribeChange:e=>Y(e),isTermsAndAgeChecked:e,wasTermsAndAgeTouched:r,onTermsAndAgeChange:eg})]})}},18778:function(e,t,r){"use strict";r.d(t,{Z:function(){return A}});var i=r(85893),s=r(67294),n=r(46936),o=r(33976),a=r(82656),d=r(2351),l=r(45403),u=r(65474),c=r(54866),p=r(97388),h=r(37606),f=r(73707),m=r(14416),g=r(34945);let v=(0,c.ZP)("div",{name:"AddressSelection",slot:"Container",shouldForwardProp:e=>"addressChanging"!==e})(e=>{let{addressChanging:t}=e;return{pointerEvents:t?"none":"initial"}}),b=(0,c.ZP)(g.I,{name:"AddressSelection",slot:"Label"})(e=>{let{theme:t}=e;return{border:"1px solid ".concat(t.palette.custom.black),padding:"".concat(t.spacing(4)," !important"),margin:"0 0 ".concat(t.spacing(10)," 0"),maxWidth:569,backgroundColor:t.palette.background.light.primary,position:"relative",borderRadius:16}}),y=(0,c.ZP)(o.f,{name:"AddressSelectionNameAndSurname",slot:"Label"})(()=>({fontWeight:"bold"}));(0,c.ZP)(g.I,{name:"AddressListSelection",slot:"RadioButton",shouldForwardProp:e=>"hidden"!==e})(e=>{let{theme:t,hidden:r}=e;return{paddingBottom:t.spacing(7.5),display:r?"none":""}});let S=(0,c.ZP)(g.I,{name:"NewAddressSelection",slot:"Wrapper"})(e=>{let{theme:t}=e;return{margin:"0 0 ".concat(t.spacing(1.5)," 0")}}),x=(0,c.ZP)(o.f,{name:"NewAddressSelection",slot:"Label"})(e=>{let{theme:t}=e;return{fontWeight:"bold",color:t.palette.text.dark.primary,fontSize:12,textDecoration:"underline"}});(0,c.ZP)("div")(()=>({display:"flex",flexDirection:"column"}));let C=(0,c.ZP)("div",{name:"AddressSelection",slot:"editLinkButton"})(e=>{let{theme:t}=e;return{cursor:"pointer",fontSize:t.typography.body2.fontSize,fontWeight:"bold",color:t.palette.custom.blue,textDecoration:"underline",position:"absolute",top:"".concat(t.spacing(4)),right:"".concat(t.spacing(4))}}),I=(0,c.ZP)("div",{name:"AddressSelection",slot:"wrapper"})(()=>({display:"flex",flexDirection:"column"}));var N=r(73047),w=r.n(N);let k=(0,c.ZP)(a.K,{shouldForwardProp:e=>"hidden"!==e,name:"AddressListSelection",slot:"StyledRadioButton"})(e=>{let{theme:t,hidden:r}=e;return{paddingBottom:t.spacing(7.5),display:r?"none":""}});var A=e=>{var t;let{addressList:r=[],orderShippingAddressIdForList:c=null,selectedAddressId:g,handleChange:N,setIsEditingAddress:A,setAddressId:_}=e,{t:E}=(0,f.$G)(),j=(null===(t=(0,m.useSelector)(d.ED))||void 0===t?void 0:t.contact)||[],L=(0,m.useSelector)(p.xn);(0,m.useSelector)(d.Zg);let P=(0,u.W4)(),T=(0,s.useMemo)(()=>l.Z.generateContactMap(j),[j]),[Z,R]=(0,s.useState)(!1),[M,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(0!==r.length&&!g&&!M){let e=c&&r.some(e=>e.addressId===c)?c:null;if(e){_(e),D(!0);return}let t=r.find(e=>{var t;return(null===(t=T[e.addressId])||void 0===t?void 0:t.primary)==="true"});t&&(_(t.addressId),D(!0))}},[g,r,T,M,c]);let F=(0,s.useMemo)(()=>r.filter(e=>Object.prototype.hasOwnProperty.call(T,e.addressId)),[r,T]),O=(e,t,r)=>(g?g===e.addressId:(null==t?void 0:t.primary)==="true")&&!r;return(0,i.jsx)(v,{className:"checkout-addresses-list-selection",children:(0,i.jsxs)(n.E,{name:"shippingAddress",value:g,onChange:e=>N&&N(e),children:[(0,i.jsx)(I,{children:F.map(e=>{var t;let r=T[e.addressId]||{},{firstName:s,lastName:n,addressLine:d,city:l,state:u,zipCode:c,country:p,attributes:f}=r,m=[[s||"",n||""].join(" "),d?d[0].replace(/\s/g," ")||" ":"",c||"",l||"",u||"",p||""],v=r?h.Z.getAddressNickName(m.slice(1)):e.nickName,S=f&&f.length>0?null===(t=f.find(e=>"addressField1"===e.key))||void 0===t?void 0:t.value:void 0,x=null==L?void 0:L.some(e=>{let t="addressLine1"===e.fieldName?"addressLine":e.fieldName,i="addressLine1"===e.fieldName?r[t]?r[t][0]:r[t]:"";return!!e.mandatory&&(!i||!new RegExp(e.validation||"^$").test(i))});if(!Z){let t=O(e,r,x);t&&R(t)}return(0,i.jsx)(b,{checked:g===e.addressId,value:e.addressId,control:(0,i.jsx)(a.K,{}),label:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(C,{onClick:()=>{_(e.addressId),A(!0)},children:E("Shipping.Labels.EditAddress")}),(0,i.jsx)(y,{children:m[0]}),P.mySite.xStoreCfg.FISCAL_CODE_SERVICE_ENABLED&&(0,i.jsx)("p",{className:w()["address-fiscal-code"],children:null!=S?S:E("Shipping.Msgs.NoFiscalCode")}),(0,i.jsx)(o.f,{variant:"body2",children:v})]})},e.addressId)})}
1),"newAddress"!==g&&(0,i.jsx)(S,{"data-element-id":"Cart_newAddress",value:"newAddress",control:(0,i.jsx)(k,{hidden:!0}),label:(0,i.jsx)(x,{variant:"body2",children:E("Shipping.Labels.AddNewAddress")})},"newAddress")]})})}},73353:function(e,t,r){"use strict";r.d(t,{I:function(){return s}});var i,s,n=r(85893),o=r(3954),a=r(67294),d=r(24779),l=r(14055),u=r(73707),c=r(14416),p=r(41843);(i=s||(s={})).SHIPPING="shipping",i.PAYMENT="payment",t.Z=e=>{let{addressFormFields:t,addressType:r,form:i,formName:s,hidden:h,onFormDataChanged:f,updateAddress:m,setIsEditingAddress:g,isEditingAddress:v,updateAddressData:b}=e,y=(0,c.useDispatch)(),{t:S}=(0,u.$G)(),[x,C]=(0,a.useState)(!1);return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(p.Sh,{hidden:h,className:"checkout-address-selection",children:(0,n.jsxs)(p.tT,{className:"checkout-address-selection__form","data-testid":"checkout-address-form",children:[v&&(0,n.jsx)(p.xA,{children:S("Shipping.Labels.EditAddressTitle")}),(0,n.jsx)(l.Z,{addressFormFields:t,addressType:r,cid:"newAddress-".concat(r),form:i,formName:s,onFormDataChanged:(e,t)=>{f&&f(e,t)},onFormValidaTionStatusChanged:(e,t)=>{C(t),e===o.BO&&y((0,d.FV)(t)),(e===o.ER||r===o.Z1)&&y((0,d.Ru)(t))}})]})})})}},41843:function(e,t,r){"use strict";r.d(t,{Sh:function(){return s},tT:function(){return n},xA:function(){return o}});var i=r(54866);let s=(0,i.ZP)("div",{name:"CheckoutAddressSelection",slot:"Wrapper"})(e=>{let{hidden:t}=e;return{display:"".concat(t?"none":"block"),form:{width:"100%"}}});(0,i.ZP)("div",{name:"CheckoutAddressSelection",slot:"NewAddressTitle"})(e=>{let{theme:t}=e;return{size:20,fontWeight:"bold",paddingBottom:t.spacing(6)}});let n=(0,i.ZP)("div",{name:"CheckoutAddressSelection",slot:"ContentForm"})(e=>{let{theme:t}=e;return{width:"100%",[t.breakpoints.up("md")]:{width:"60%"},[t.breakpoints.only("md")]:{width:"90%"}}}),o=(0,i.ZP)("div",{name:"CheckoutAddressSelection",slot:"FormTitle"})(e=>{let{theme:t}=e;return{paddingBottom:"".concat(t.spacing(11)),fontWeight:"bold"}});(0,i.ZP)("div",{name:"CheckoutAddressForm",slot:"ButtonContainer"})(e=>{let{theme:t}=e;return{display:"flex",flexDirection:"row",columnGap:t.spacing(4),flexWrap:"wrap",marginBottom:t.spacing(6),"& > button":{flexGrow:1},[t.breakpoints.up("sm")]:{"& > button":{flexGrow:"initial"}}}}),(0,i.ZP)("div",{name:"CheckoutAddressForm",slot:"CloseLinkButton"})(e=>{let{theme:t}=e;return{cursor:"pointer",fontSize:t.typography.body2.fontSize,fontWeight:"bold",color:t.palette.custom.blue,lineHeight:t.spacing(10),padding:"".concat(t.spacing(2)," ").concat(t.spacing(0)),[t.breakpoints.down("sm")]:{width:"100%",textAlign:"center"}}})},6137:function(e,t,r){"use strict";r.d(t,{Z:function(){return i.Z}});var i=r(73353)},68691:function(e,t,r){"use strict";r.d(t,{b:function(){return Z}});var i=r(38270),s=r(85),n=r(3954),o=r(92233),a=r(87658),d=r(92186),l=r(24779),u=r(2690),c=r(8838),p=r(91540),h=r(52840),f=r(37755),m=r(7056),g=r(92431),v=r(10558),b=r(61286),y=r(82271),S=r(50622),x=r(72803),C=r(9669),I=r.n(C),N=r(11163),w=r(67294),k=r(14416),A=r(75900),_=r(2351),E=r(48550),j=r(49769),L=r(65474),P=r(71143),T=r(62877);let Z=()=>{var e;let t=T.Z.name,r=(0,N.useRouter)(),C=(0,k.useDispatch)(),Z=(0,k.useSelector)(_.ED),R=(0,k.useSelector)(A.Mb),M=(0,k.useSelector)(a.um),D=(0,k.useSelector)(A.w8),F=(0,k.useSelector)(A.C7),O=(0,v.q)(),[V,{isLoading:B}]=(0,u.XO)(),[W,z]=(0,w.useState)([]),[G,q]=(0,w.useState)([]),{mySite:H}=(0,L.W4)(),[J,K]=(0,w.useState)(!1),[U,$]=(0,w.useState)(null),[X,Y]=(0,w.useState)(),Q=(0,k.useSelector)(A.SC),ee=(0,k.useSelector)(A.k8),[et,er]=(0,w.useState)(!1),[ei,es]=(0,w.useState)(!1),[en,eo]=(0,w.useState)(!1),[ea,ed]=(0,w.useState)(!1),{country:el}=(0,m.d)(),eu=(0,k.useSelector)(A.iq),ec=(0,w.useMemo)(()=>((null==Z?void 0:Z.contact)||[]).filter(e=>{var t,r;return(null===(t=e.country)||void 0===t?void 0:t.toLowerCase())===el.toLowerCase()&&["shipping","shippingandbilling"].includes(null===(r=e.addressType)||void 0===r?void 0:r.toLowerCase())}).sort((e,t)=>Number((0,y.hb)(t.primary))-Number((0,y.hb)(e.primary))),[null==Z?void 0:Z.contact,el]),ep=(0,w.useMemo)(()=>ec.map(e=>({addressId:e.addressId,nickName:e.nickName||""})),[ec]),eh=(0,w.useMemo)(()=>{var e;return ep.length&&R.length&&null!==(e=R.flatMap(e=>e.addressId).find(e=>ep.some(t=>t.addressId===e)))&&void 0!==e?e:null},[R,ep]),ef=(0,k.useSelector)(A.m6,S.Xy),em=(0,S.VO)(ef),[eg,ev]=(0,w.useState)(""),eb=(0,w.useRef)(null),ey=(0,w.useMemo)(()=>J&&eg===n.PN?n.PN:(eg&&eg!==n.PN?eg:"")||W[0]||n.v6,[J,eg,W]),[eS]=u.Eh.endpoints.updateOrderShippingInfo.useMutation(),ex=(0,f.h)(),eC=(0,w.useMemo)(()=>{var e;return(0,x.G)(null==H?void 0:null===(e=H.xStoreCfg)||void 0===e?void 0:e.SHIP_MOD_CAN_REPLACED_FROM_OTHER)},[null==H?void 0:null===(e=H.xStoreCfg)||void 0===e?void 0:e.SHIP_MOD_CAN_REPLACED_FROM_OTHER]),eI=I().CancelToken,eN=[],ew={currency:H?H.defaultCurrencyID:n.v6,contractId:M,widget:t,storeId:H.storeID,cancelToken:new eI(function(e){eN.push(e)})},{createAddress:ek,updateAddress:eA}=(0,g.S)(ew),e_={x_calculateOrder:i.T.calculateOrder,x_calculationUsage:i.T.calculationUsage,x_allocate:i.T.allocate,x_backorder:i.T.backOrder,x_remerge:i.T.remerge,x_check:i.T.check,orderId:"."},eE=async(e,t)=>{let r=[...W];r.splice(e,1,t);let i={...e_,addressId:r[0]},s={...ew,body:i};try{eo(!0),await eS(s),await j.Z.calculateTax({...ew}).catch(e=>{throw e}),await C(u.Eh.endpoints.getCart.initiate({...ew,storeId:H.storeID,fetchCatentries:!0,fetchShippingInfo:!1,fetchPrescriptionDetail
1s:!0,refetch:!0,sessionId:Date.now()})),C((0,l.aj)(null)),eo(!1)}catch(e){eo(!1)}finally{eo(!1)}},ej=(0,w.useMemo)(()=>G.length>0&&W.length>0&&!J,[G.length,W.length,J]),eL=(0,w.useMemo)(()=>{let e=F||!F&&Q.isValid,t=J&&ee.isValid||ee.isValid;return ej?e:e&&t},[ej,Q.isValid,ee.isValid,F,J]),eP=(0,w.useMemo)(()=>(0,x.z)(R,G[0],eC),[R,G,eC]);async function eT(e){es(!0);let t=R.map(e=>e.addressId),r=!0;if((null==R?void 0:R.length)>1){let e=R.map(e=>e.addressId);if(!e.every((e,t)=>e===t[0])){let t={...e_,addressId:e[0],addressType:n.ER},r={...ew,body:t};await eS(r).catch(e=>{throw e})}r=R.map(e=>e.shipModeId).every((e,t,r)=>e===r[0])}if(function(){if(!R[0])return!0;let e=R.every(e=>e.shipModeId===R[0].shipModeId);return eP!==R[0].shipModeId||!e}()||!r){let e={...e_,addressId:t[0],addressType:n.ER,shipModeId:eP,orderItem:[]},r={...ew,body:e};await eS(r).catch(e=>{throw e})}await eF().catch(e=>{throw e}),e&&eO().catch(e=>{throw e})}let eZ=async function(e,t,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(eL)try{await eT(e).then(()=>{setTimeout(()=>{if(t&&i){var e;(0,E.r_)({products:em,isOptin:t,shippingMode:null==eu?void 0:null===(e=eu.orderItem[0])||void 0===e?void 0:e.shipModeCode})}},4e3),setTimeout(()=>{t&&i&&(0,E.aI)(i)},3e3),s||r.push(ex.payment)})}catch(e){es(!1),b.Z.error(window.location.href,"order shipping info error",e.message),C((0,d.Ee)({errorMessage:e.message}))}},eR=async(e,t)=>{var r,i;let o={...e,addressType:t,addressLine:[null!==(r=e.addressLine1)&&void 0!==r?r:"",null!==(i=e.addressLine2)&&void 0!==i?i:""]},a=await ek(o),d=null==a?void 0:a.addressId;return d&&((t===n.ER||t===n.Z1)&&(await eE(0,d),eb.current=d,ev(d),z([d])),(t===n.BO||t===n.Z1)&&P.T7.set(s._X,d)),K(!1),a},eM=async(e,t)=>{try{let r=await eA(e);C((0,c.$n)({orderItems:null==eu?void 0:eu.orderItem,orderId:eu.orderId}));let i=null==r?void 0:r.addressId;i&&(t===n.ER||t===n.Z1)&&(ev(i),await eE(0,i)),i&&(t===n.BO||t===n.Z1)&&P.T7.set(s._X,i)}catch(e){b.Z.error("update address error: ",e.message)}},eD=async e=>{var t,r,i,s;let n=[{attributeName:"RecipientName",attributeType:"string",attributeValue:null!==(t=e.firstName)&&void 0!==t?t:""},{attributeName:"RecipientSurname",attributeType:"string",attributeValue:null!==(r=e.lastName)&&void 0!==r?r:""},{attributeName:"RecipientTelephone",attributeType:"string",attributeValue:null!==(i=e.phone1)&&void 0!==i?i:""},{attributeName:"RecipientEmail",attributeType:"string",attributeValue:null!==(s=e.email1)&&void 0!==s?s:""}];await V({storeId:H.storeID,orderExtendAttribute:n})},eF=async()=>{if(O&&await eD(X||{}).catch(e=>{throw e}),J){let e=F?n.Z1:n.ER;await eR({...X},e).catch(e=>{throw e})}if(!F){let e=R.find(e=>!!e.email1),t=X?X.email1:null==e?void 0:e.email1;JSON.stringify(U)!==JSON.stringify(X)?await eR({...U,email1:t},n.BO).catch(e=>{throw e}):P.T7.set(s._X,eg)}if(!J&&F){let e=eg||W[0];P.T7.set(s._X,e)}await j.Z.deleteAllPaymentInstructions({storeId:H.storeID}).catch(e=>{throw e}),await j.Z.calculateTax({...ew}).catch(e=>{throw e})},eO=async()=>{var e,t;let r=(null==X?void 0:X.email)||(null==X?void 0:X.email1)||(null==Z?void 0:Z.email1),i=(null==X?void 0:X.firstName)||(null==Z?void 0:Z.firstName)||"";(0,h.qu)({service:"newsletter",event:"subscribe-to-newsletter-use-shipping"},{isNewsletterSubscriptionRequestSent:ea,email:r}),!ea&&r&&(p.B.subscribeToNewsletter({firstName:i,from:"checkout",email:r,newsletter_id:null!==(t=null===(e=H.xStoreCfg)||void 0===e?void 0:e.newsletterSubscrType)&&void 0!==t?t:"NEWSLETTER",storeId:H.storeID}),(0,h.qu)({service:"newsletter",event:"subscribe-to-newsletter-use-shipping-sent"}),ed(!0))};return(0,w.useEffect)(()=>{if(0!==R.length){if(eg&&ep&&ep.length>0)ep.some(e=>e.addressId===eg)&&JSON.stringify(W)!==JSON.stringify([eg])&&z([eg]);else if((0===W.length||!W[0])&&ep&&ep.length>0){let e=R.flatMap(e=>e.addressId).filter(e=>null==ep?void 0:ep.map(e=>e.addressId).includes(e));JSON.stringify(W)!==JSON.stringify(e)&&z(e)}if(0===G.length||!G[0]){let e=R.filter(e=>void 0!==e&&e.shipModeCode!==o.F4.shipModeCode.PickUp).map(e=>e.shipModeId),t=(0,x.z)(R,e[0],eC);t&&JSON.stringify(G)!==JSON.stringify([t])&&q([t])}}},[ep.length,R.length,eg,eC]),(0,w.useEffect)(()=>{let e;let t=!!ep&&!!ep[0];er(t),J!==(e=eg===n.PN||!t&&!ej)&&K(e)},[ep,ej,eg]),(0,w.useEffect)(()=>(eg&&eg!==n.v6&&eg!==n.PN&&(eb.current===eg?eb.current=null:eE(0,eg)),et&&K(eg===n.PN),()=>
1{eN.forEach(e=>e())}),[eg]),{usableShipAddresses:ep,orderShippingAddressIdForList:eh,shippingListSelectedAddressId:ey,submit:eZ,subscribeToNewsletter:eO,newShippingAddress:J,addressId:eg,selectedShipAddressIds:W,handleAddressChange:e=>{let t=e.target.value;t&&ev(t)},isShippingUsedAsBilling:F,billingAddressData:U,shippingAddressData:X,setBillingAddressData:$,setShippingAddressData:Y,usableShipInfos:D,userHasSavedAddresses:et,shippingLoading:ei,setShippingLoading:es,addressChanging:en,setAddressId:ev,handleShippingUpdateAddress:eM,updateAddress:eA,isProceedButtonEnabled:eL}}},74440:function(e,t,r){"use strict";r.d(t,{g:function(){return h}});var i=r(65474),s=r(7056),n=r(12767),o=r(97083),a=r(97388),d=r(67294),l=r(14416);let u=(e,t)=>{let r={};return e.forEach(e=>{(t||"fiscalCode"!==e.fieldName)&&(r[e.fieldName]="")}),r},c=(e,t)=>"US"!==t||e.some(e=>"state"===e.fieldName.toLowerCase())?e:[...e,{fieldName:"state",mandatory:!0}],p=(e,t)=>{if(!t){let{fiscalCode:t,...r}=e;return r}return e},h=e=>{var t,r,h,f,m,g,v,b;let{billingAddressData:y,shippingAddressData:S,addressId:x,setShippingAddressData:C}=e,I=(0,l.useSelector)(a.N),[N,w]=(0,d.useState)([]),[k,A]=(0,d.useState)([]),[_,E]=(0,d.useState)(!1),[j,L]=(0,d.useState)(!1),{firstName:P,lastName:T,userEmail:Z,contact:R}=(0,o.v)(),{country:M}=(0,s.d)(),D=(0,i.W4)().mySite.xStoreCfg.FISCAL_CODE_SERVICE_ENABLED,F=(0,d.useMemo)(()=>R?R.find(e=>"true"===e.primary):void 0,[R]),O=((null==S?void 0:S.country)||M).toUpperCase(),V=null==R?void 0:R.find(e=>e.addressId===x),B=u(N,D),W=u(k,D),z=p({...B,...S,email1:Z||"",firstName:P||"",lastName:T||"",phone1:(null==F?void 0:F.phone1)||"",fiscalCode:(null==F?void 0:null===(r=F.attributes)||void 0===r?void 0:null===(t=r[0])||void 0===t?void 0:t.value)||"",addressLine1:(null==F?void 0:null===(h=F.addressLine)||void 0===h?void 0:h[0])||"",addressLine2:(null==F?void 0:null===(f=F.addressLine)||void 0===f?void 0:f[1])||"",addressLine:(null==F?void 0:F.addressLine)||[],city:(null==F?void 0:F.city)||"",state:(null==F?void 0:F.state)||"",zipCode:(null==F?void 0:F.zipCode)||"",country:O},D),G=(0,n.j)({defaultValues:z,fields:N}),q=(0,n.j)({defaultValues:p({...W,...y,firstName:P||"",lastName:T||"",country:O},D),fields:k}),H=p({...V,addressLine1:(null==V?void 0:null===(m=V.addressLine)||void 0===m?void 0:m[0])||"",addressLine2:(null==V?void 0:null===(g=V.addressLine)||void 0===g?void 0:g[1])||"",addressLine:(null==V?void 0:V.addressLine)||[],fiscalCode:(null==V?void 0:null===(b=V.attributes)||void 0===b?void 0:null===(v=b[0])||void 0===v?void 0:v.value)||"",country:O},D);return(0,d.useEffect)(()=>{I&&A(c(I.filter(e=>D||"fiscalCode"!==e.fieldName),O))},[I,O,D]),(0,d.useEffect)(()=>{var e,t,r,i;G.setValue("email1",Z||""),G.setValue("firstName",P||""),G.setValue("lastName",T||""),q.setValue("firstName",P||""),q.setValue("lastName",T||""),F&&(G.setValue("phone1",(null==F?void 0:F.phone1)||""),D?G.setValue("fiscalCode",(null==F?void 0:null===(i=F.attributes)||void 0===i?void 0:null===(r=i[0])||void 0===r?void 0:r.value)||""):G.unregister("fiscalCode"),G.setValue("addressLine1",(null==F?void 0:null===(e=F.addressLine)||void 0===e?void 0:e[0])||""),G.setValue("addressLine2",(null==F?void 0:null===(t=F.addressLine)||void 0===t?void 0:t[1])||""),G.setValue("addressLine",(null==F?void 0:F.addressLine)||""),G.setValue("city",(null==F?void 0:F.state)||""),G.setValue("state",(null==F?void 0:F.zipCode)||""),G.setValue("zipCode",(null==F?void 0:F.zipCode)||""))},[O,P,T,C,F,Z,G,q,D]),(0,d.useEffect)(()=>{let e=N.filter(e=>D||"fiscalCode"!==e.fieldName);N.map(e=>e.fieldName).sort().join(",")!==e.map(e=>e.fieldName).sort().join(",")&&w(e)},[N,D]),(0,d.useEffect)(()=>{G.reset(_?H:z)},[_]),{isSaveAddressChecked:j,setIsSaveAddressChecked:L,updateBillingFormFields:k,setUpdateBillingFormFields:A,updatedShippingFormFields:N,setUpdateShippingFormFields:w,isEditingAddress:_,setIsEditingAddress:E,shippingForm:G,billingForm:q,defaultShippingAddress:z,selectedShippingAddress:H}}},73047:function(e){e.exports={"address-fiscal-code":"styles_address-fiscal-code__Qj6q3"}},28928:function(e){e.exports={"shipping-footer-wrapper":"styles_shipping-footer-wrapper__J2_fH","shipping-footer-button":"styles_shipping-footer-button__EY7LR","shipping-footer-control-label":"styles_shipping-footer-control-label__nCeUs","privacy-policy-link":"styles_privacy-policy-link__KhhST","shipping-footer-control-error":"styles_shipping-footer-control-error__jbWET","shipping-footer-note":"styles_shipping-footer-note__lHryg"}},49078:function(e){e.exports={"shipping-description":"styles_shipping-description__r7KR_","shipping-billing-title":"styles_shipping-billing-title__k4d6c"}}}]);
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.