From f9550a0abf89c4a16da90adfae8d1ad455bc1620 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Mon, 25 Nov 2024 10:20:32 +0200 Subject: [PATCH] init commit 4 --- .../storefront-account/chunks/CustomerInformationCard.js | 2 +- scripts/__dropins__/storefront-account/reload | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js b/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js index a05344d38..3e6716731 100644 --- a/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js +++ b/scripts/__dropins__/storefront-account/chunks/CustomerInformationCard.js @@ -1 +1 @@ -import{jsx as a,Fragment as Q,jsxs as j}from"@dropins/tools/preact-jsx-runtime.js";import{classes as X,Slot as Ae}from"@dropins/tools/lib.js";import{Field as le,Picker as Pe,Input as je,InputDate as We,Checkbox as we,TextArea as De,Card as he,Skeleton as xe,SkeletonRow as D,Button as oe,Tag as pe,Icon as Se,Modal as Ge,ProgressSpinner as Ke,IllustratedMessage as Je,Header as Xe,InLineAlert as Ye}from"@dropins/tools/components.js";import{useRef as Qe,useState as N,useEffect as ee,useCallback as q,useMemo as et}from"@dropins/tools/preact-hooks.js";import{k as Re,o as Ve,u as Ce,c as He,e as tt,n as rt,j as st,h as nt,i as at,d as ot}from"./removeCustomerAddress.js";import{useText as ne}from"@dropins/tools/i18n.js";import*as G from"@dropins/tools/preact-compat.js";import{memo as Ee,forwardRef as dt,useImperativeHandle as lt,useMemo as be,useCallback as _e}from"@dropins/tools/preact-compat.js";import{Fragment as Ne}from"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";const fe=({hideActionFormButtons:e,formName:s,showFormLoader:n,showSaveCheckBox:r,saveCheckBoxValue:o,forwardFormRef:d,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:p,billingCheckBoxValue:y,shippingCheckBoxValue:g,showBillingCheckBox:I,showShippingCheckBox:L,isOpen:w,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:_,onChange:T})=>a("div",{className:X(["account-address-form"]),children:a(Wt,{hideActionFormButtons:e,formName:s,showFormLoader:n,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:p,shippingCheckBoxValue:g,billingCheckBoxValue:y,showShippingCheckBox:L,showBillingCheckBox:I,isOpen:w,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:_,onChange:T,forwardFormRef:d,showSaveCheckBox:r,saveCheckBoxValue:o})}),ct=e=>e.reduce((s,n)=>({...s,[n.name]:n.value}),{}),it=e=>/^\d+$/.test(e),ut=e=>/^[a-zA-Z0-9\s]+$/.test(e),pt=e=>/^[a-zA-Z0-9]+$/.test(e),ft=e=>/^[a-zA-Z]+$/.test(e),mt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),ht=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),At=(e,s,n)=>{const r=new Date(e).getTime()/1e3;return isNaN(r)||r<0?!1:r>=s&&r<=n},Te=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],Lt=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),gt=(e,s,n)=>{const r=e.length;return r>=s&&r<=n},ye=(e,s,n,r)=>{var x,V;const{requiredFieldError:o,lengthTextError:d,numericError:c,alphaNumWithSpacesError:l,alphaNumericError:i,alphaError:u,emailError:p,dateError:y,urlError:g,dateLengthError:I}=n,L=s==null?void 0:s.customUpperCode,w={[L]:""};if(r[L]&&delete r[L],s!=null&&s.required&&!e)return{[L]:o};if(!(s!=null&&s.required)&&!e||!((x=s==null?void 0:s.validateRules)!=null&&x.length))return w;const t=ct(s==null?void 0:s.validateRules),h=t.MIN_TEXT_LENGTH??1,f=t.MAX_TEXT_LENGTH??255,_=t.DATE_RANGE_MIN,T=t.DATE_RANGE_MAX;if(!gt(e,+h,+f)&&!(_||T))return{[L]:d.replace("{min}",h).replace("{max}",f)};if(!At(e,+_,+T)&&(_||T))return{[L]:I.replace("{min}",Te(_)).replace("{max}",Te(T))};const U={numeric:{validate:it,error:c},"alphanum-with-spaces":{validate:ut,error:l},alphanumeric:{validate:pt,error:i},alpha:{validate:ft,error:u},email:{validate:mt,error:p},date:{validate:ht,error:y},url:{validate:Lt,error:g}}[t.INPUT_VALIDATION];return U&&!U.validate(e)&&!((V=r[L])!=null&&V.length)?{[L]:U.error}:w},Be=e=>{switch(e){case"on":case"true":case 1:case"1":return!0;case"0":case"off":case"false":case 0:return!1;default:return!1}},yt=["true","false","yes","on","off"],Ct={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:""},bt=e=>{const s={},n={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const o=e[r],d=r.match(/^(.*)Multiline_(\d+)$/);if(d){const c=d[1],l=parseInt(d[2],10);n[c]||(n[c]=[]),n[c].push({index:l,value:o})}else Object.keys(e).filter(l=>l.startsWith(`${r}Multiline_`)).length>0?n[r]=[{index:1,value:o}]:s[r]=o}for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const o=n[r];o.sort((d,c)=>d.index-c.index),s[r]=o.map(d=>d.value)}return s},Mt=e=>{const s={},n=[];for(const r in e){const o=yt.includes(e[r])?Be(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(Ct,r)?s[r]=o:n.push({code:Ve(r),value:o}))}return{...s,customAttributes:n}},ae=(e,s=!1)=>{const n=Re(e,"camelCase",{firstname:"firstName",lastname:"lastName"}),r=Mt(bt(n));if(!s)return r;const[o,d]=r.region?r.region.split(","):[];return{...r,region:{regionCode:o,...d&&{regionId:+d}}}},me=e=>{if(!e.current)return{};const s=e.current.elements;return Array.from(s).reduce((r,o)=>(o.name&&(r[o.name]=o.type==="checkbox"?o.checked:o.value),r),{})},Ze=(e,s)=>Object.keys(e).every(r=>r in s&&s[r]!==""),ze=e=>typeof e=="function",vt=e=>e.reduce((s,{customUpperCode:n,required:r,defaultValue:o})=>(r&&n&&(s.initialData[n]=o||"",s.errorList[n]=""),s),{initialData:{},errorList:{}}),$e=e=>Object.keys(e).length>0,Et=({fieldsConfig:e,onSubmit:s,onChange:n,setInputChange:r,formName:o,isWaitingForResponse:d})=>{const c=ne({requiredFieldError:"Account.FormText.requiredFieldError",lengthTextError:"Account.FormText.lengthTextError",numericError:"Account.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Account.FormText.alphaNumericError",alphaError:"Account.FormText.alphaError",emailError:"Account.FormText.emailError",dateError:"Account.FormText.dateError",dateLengthError:"Account.FormText.dateLengthError",urlError:"Account.FormText.urlError"}),l=Qe(null),[i,u]=N({}),[p,y]=N({}),[g,I]=N({}),[L,w]=N(!0),[t,h]=N(!1),[f,_]=N(!1),[T,Z]=N(!0),[U,x]=N(!1);ee(()=>{const m=()=>{if(l.current){const b=window.getComputedStyle(l.current).getPropertyValue("grid-template-rows").split(" ").length,M=l.current.querySelector(".account-address-form--saveAddressBook");M&&(M.style.gridRow=String(b-1))}};return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[e==null?void 0:e.length]);const V=q((m=!1)=>{let v=!0;const b={...p};let M=null;for(const[O,A]of Object.entries(i)){const $=e==null?void 0:e.find(S=>S.customUpperCode.includes(O)),k=ye(A.toString(),$,c,b);k[O]&&(Object.assign(b,k),v=!1),M||(M=Object.keys(b).find(S=>b[S])||null)}if(m||y(b),M&&l.current&&!m){const O=l.current.elements.namedItem(M);O==null||O.focus()}return v},[p,e,i,c]),C=q((m,v,b,M)=>{const O={...me(l),[v]:m,...v.includes("countryCode")?{region:""}:{}},A={data:ae(O,!0),isDataValid:Ze(b,O)};x(A.isDataValid),V(!0),["selectedShippingAddress","selectedBillingAddress"].includes(o)&&sessionStorage.setItem(`${o}_addressData`,JSON.stringify(A)),n==null||n(A,{},M)},[V,o,n]);ee(()=>{if(e!=null&&e.length){const{initialData:m,errorList:v}=vt(e);u(b=>({...m,...b})),y(v),I(v)}},[JSON.stringify(e)]),ee(()=>{if(f)return;const m=me(l),v=sessionStorage.getItem(`${o}_addressData`);if($e(i)&&$e(g)){let b={};const M=Ze(g,i);v?b=JSON.parse(v).data:b=ae(m,!0)??{},n==null||n({data:b,isDataValid:M},{},null),x(M),_(!0)}},[i,g]),ee(()=>{var O;if(!T)return;const m=me(l),v=!!(m!=null&&m.countryCode),b=!!((O=m==null?void 0:m.region)!=null&&O.length);m&&v&&!b&&ze(n)&&!d&&C(m==null?void 0:m.region,"region",g,null)},[T,L,e,l,n,C,g,t,d]);const H=q((m,v)=>{const{name:b,value:M,type:O,checked:A}=m==null?void 0:m.target,$=O==="checkbox"?A:M;u(z=>{const te={...z,[b]:$};return b==="countryCode"&&(te.region="",w(!0),h(!1)),te}),r==null||r({[b]:$}),_(!0);const k=e==null?void 0:e.find(z=>z.customUpperCode.includes(b));let S=v?{...v}:{...p};if(k){const z=ye($.toString(),k,c,S);z&&Object.assign(S,z),y(S)}C($,b,g,m)},[r,e,p,c,C,g,L]),B=q(m=>{const{name:v}=m==null?void 0:m.target,b=e==null?void 0:e.find(M=>M.customUpperCode===v);v==="region"&&(b!=null&&b.options.length)&&Z(!1),Z(v==="countryCode")},[]),P=q((m,v)=>{const{name:b,value:M,type:O,checked:A}=m==null?void 0:m.target,$=O==="checkbox"?A:M,k=e==null?void 0:e.find(S=>S.customUpperCode===b);if(k){const S=v?{...v}:{...p},z=ye($.toString(),k,c,S);z&&Object.assign(S,z),y(S)}},[p,e,c]),K=q(m=>{m.preventDefault();const v=V();s==null||s(m,v)},[V,s]);return{isDataValid:U,formData:i,errors:p,formRef:l,handleInputChange:H,onFocus:B,handleBlur:P,handleSubmit:K,handleValidationSubmit:V}};var se=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(se||{});const _t=Ee(({loading:e,values:s,fields:n=[],errors:r,className:o="",onChange:d,onBlur:c,onFocus:l,slots:i})=>{const u=`${o}__field`,p=(t,h)=>{if(!(i!=null&&i[`AddressFormInput_${t.code}`]))return;const f={inputName:t.customUpperCode,handleOnChange:d,handleOnBlur:c,handleOnFocus:l,errorMessage:h,errors:r,config:t};return a(Ae,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:i[`AddressFormInput_${t.code}`],context:f},t.id)},y=(t,h,f)=>{var T;const _=((T=t.options.find(Z=>Z.isDefault))==null?void 0:T.value)??h??t.defaultValue;return a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e||t.disabled,children:a(Pe,{id:t.code,required:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,"aria-label":t.label,options:t.options,onBlur:c,onFocus:l,handleSelect:d,defaultValue:_,value:_})},t.id)})},g=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e,children:a(je,{id:t.code,type:"text",name:t.customUpperCode,value:h??t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onFocus:l,onChange:d})},t.id)}),I=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e||t.disabled,children:a(We,{id:t.code,type:"text",name:t.customUpperCode,value:h||t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:d,disabled:e||t.disabled})},t.id)}),L=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e,children:a(we,{id:t.code,name:t.customUpperCode,checked:h||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:d})},t.id)}),w=(t,h,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e,children:a(De,{id:t.code,type:"text",name:t.customUpperCode,value:h??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:d})},t.id)});return n.length?a(Q,{children:n.map(t=>{const h=r==null?void 0:r[t.customUpperCode],f=s==null?void 0:s[t.customUpperCode];switch(t.fieldType){case se.TEXT:return t.options.length?y(t,f,h):g(t,f,h);case se.MULTILINE:return g(t,f,h);case se.SELECT:return y(t,f,h);case se.DATE:return I(t,f,h);case se.BOOLEAN:return L(t,f,h);case se.TEXTAREA:return w(t,f,h);default:return null}})}):null}),Ue=({testId:e,withCard:s=!0})=>{const n=j(xe,{"data-testid":e||"skeletonLoader",children:[a(D,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?n:a(he,{variant:"secondary",className:X(["account-account-loaders","account-account-loaders--card-loader"]),children:n})},Nt=()=>j(xe,{"data-testid":"addressFormLoader",children:[a(D,{variant:"heading",size:"medium"}),a(D,{variant:"empty",size:"medium"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0}),a(D,{size:"large",fullWidth:!0,lines:3}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0})]}),Tt=Ee(dt(({isWaitingForResponse:e,setInputChange:s,showFormLoader:n,slots:r,name:o,loading:d,children:c,className:l="defaultForm",fieldsConfig:i,onSubmit:u,onChange:p,forwardFormRef:y,regionOptions:g,showSaveCheckBox:I,handleSaveCheckBoxAddress:L,saveCheckBoxAddress:w})=>{const t=ne({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:h,formData:f,errors:_,formRef:T,handleInputChange:Z,handleBlur:U,handleSubmit:x,handleValidationSubmit:V,onFocus:C}=Et({fieldsConfig:i,onSubmit:u,onChange:p,setInputChange:s,regionOptions:g,formName:o,isWaitingForResponse:e});return lt(y,()=>{const H=me(T),B=ae(H,!0);return{handleValidationSubmit:V,formData:B,isDataValid:h}}),n||!(i!=null&&i.length)?a(Nt,{}):j("form",{className:X(["account-form",l]),onSubmit:x,name:o,ref:T,children:[a(_t,{className:l,loading:d,fields:i,onChange:Z,onBlur:U,errors:_,values:f,onFocus:C,slots:r}),r!=null&&r.AddressFormInputs?a(Ae,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:Z}}}):null,I?a("div",{className:"account-address-form--saveAddressBook",children:a(we,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:t.saveAddressBook,checked:w,onChange:H=>{Z(H),L==null||L(H)}})}):null,c]})})),Me=({slots:e,selectable:s,selectShipping:n,selectBilling:r,variant:o="secondary",minifiedView:d,keysSortOrder:c,addressData:l,loading:i,setAddressId:u,handleRenderModal:p,handleRenderForm:y})=>{const g=d?"minifiedView":"fullSizeView",I=ne({actionRemove:`Account.${g}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${g}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${g}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${g}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${g}.Addresses.addressCard.defaultLabelText`}),L=I.cardLabelBilling.toLocaleUpperCase(),w=I.cardLabelShipping.toLocaleUpperCase(),t=I.defaultLabelText.toLocaleUpperCase(),h=be(()=>{const C={shippingLabel:w,billingLabel:L,hideShipping:!1,hideBilling:!1};return s?n&&!r?{shippingLabel:t,billingLabel:t,hideShipping:!1,hideBilling:!0}:r&&!n?{shippingLabel:t,billingLabel:t,hideShipping:!0,hideBilling:!1}:C:C},[L,t,w,r,n,s]),f=_e(()=>{u==null||u(l==null?void 0:l.id),p==null||p()},[p,l==null?void 0:l.id,u]),_=_e(()=>{u==null||u(l==null?void 0:l.id),y==null||y()},[y,l==null?void 0:l.id,u]),T=be(()=>{if(!c)return[];const{region:C,...H}=l,B={...H,...C};return c.filter(({name:P})=>B[P]).map(P=>({name:P.name,orderNumber:P.orderNumber,value:B[P.name],label:P.label}))},[l,c]),{shippingLabel:Z,billingLabel:U,hideShipping:x,hideBilling:V}=h;return a(he,{variant:o,className:"account-address-card","data-testid":"addressCard",children:i?a(Ue,{}):j(Q,{children:[j("div",{className:"account-address-card__action",children:[p?a(oe,{type:"button",variant:"tertiary",onClick:f,"data-testid":"removeButton",children:I.actionRemove}):null,y?a(oe,{type:"button",variant:"tertiary",onClick:_,className:"account-address-card__action--editbutton","data-testid":"editButton",children:I.actionEdit}):null]}),a("div",{className:"account-address-card__description",children:e!=null&&e.AddressCard?a(Ae,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:T}}):a(Q,{children:T.map((C,H)=>{const B=C.label?`${C.label}: ${C==null?void 0:C.value}`:C==null?void 0:C.value;return a("p",{"data-testid":`${C.name}_${H}`,children:B},H)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?j("div",{className:"account-address-card__labels",children:[l!=null&&l.defaultShipping?a(pe,{label:w}):null,l!=null&&l.defaultBilling?a(pe,{label:L}):null]}):null,s?j("div",{className:"account-address-card__labels",children:[!x&&(l!=null&&l.defaultShipping)?a(pe,{label:Z}):null,!V&&(l!=null&&l.defaultBilling)?a(pe,{label:U}):null]}):null]})})},Zt=e=>G.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},G.createElement("g",{id:"Large"},G.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),G.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},G.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),G.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),$t=e=>G.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},G.createElement("g",{id:"Large"},G.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),G.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},G.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),Ft=e=>G.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},G.createElement("path",{d:"M3.375 7.38672C3.09886 7.38672 2.875 7.61058 2.875 7.88672C2.875 8.16286 3.09886 8.38672 3.375 8.38672V7.38672ZM5.88409 8.38672C6.16023 8.38672 6.38409 8.16286 6.38409 7.88672C6.38409 7.61058 6.16023 7.38672 5.88409 7.38672V8.38672ZM3.375 11.1836C3.09886 11.1836 2.875 11.4075 2.875 11.6836C2.875 11.9597 3.09886 12.1836 3.375 12.1836V11.1836ZM5.88409 12.1836C6.16023 12.1836 6.38409 11.9597 6.38409 11.6836C6.38409 11.4075 6.16023 11.1836 5.88409 11.1836V12.1836ZM3.375 15.6133C3.09886 15.6133 2.875 15.8371 2.875 16.1133C2.875 16.3894 3.09886 16.6133 3.375 16.6133V15.6133ZM5.88409 16.6133C6.16023 16.6133 6.38409 16.3894 6.38409 16.1133C6.38409 15.8371 6.16023 15.6133 5.88409 15.6133V16.6133ZM8.52059 16.4182C8.51422 16.6942 8.73286 16.9232 9.00893 16.9296C9.285 16.9359 9.51396 16.7173 9.52032 16.4412L8.52059 16.4182ZM9.19302 14.8261L8.70612 14.7124C8.70434 14.72 8.70274 14.7277 8.70132 14.7354L9.19302 14.8261ZM11.2762 13.3887L11.4404 13.8611L11.4499 13.8576L11.2762 13.3887ZM12.3195 13.1013C12.4035 12.8382 12.2583 12.5569 11.9953 12.4729C11.7322 12.3889 11.4509 12.5341 11.3669 12.7971L12.3195 13.1013ZM15.7342 16.4412C15.7406 16.7173 15.9695 16.9359 16.2456 16.9296C16.5217 16.9232 16.7403 16.6942 16.734 16.4182L15.7342 16.4412ZM16.0615 14.8261L16.5532 14.7354C16.5518 14.7277 16.5502 14.72 16.5484 14.7124L16.0615 14.8261ZM13.9784 13.3887L13.8046 13.8577L13.8142 13.861L13.9784 13.3887ZM13.8877 12.7971C13.8037 12.5341 13.5223 12.3889 13.2593 12.4729C12.9962 12.5569 12.8511 12.8382 12.9351 13.1013L13.8877 12.7971ZM10.9023 10.418L11.4023 10.418V10.418H10.9023ZM11.2309 8.60993L11.6861 8.81678L11.6861 8.81678L11.2309 8.60993ZM12.0518 12.7684L11.7218 13.1441L11.7682 13.1848L11.823 13.213L12.0518 12.7684ZM13.202 12.7684L13.4308 13.213L13.4787 13.1884L13.5203 13.1541L13.202 12.7684ZM3.375 8.38672H5.88409V7.38672H3.375V8.38672ZM3.375 12.1836H5.88409V11.1836H3.375V12.1836ZM3.375 16.6133H5.88409V15.6133H3.375V16.6133ZM6.41058 2.375H18.844V1.375H6.41058V2.375ZM18.844 2.375C19.4866 2.375 20.125 2.99614 20.125 3.9225H21.125C21.125 2.57636 20.1627 1.375 18.844 1.375V2.375ZM20.125 3.9225V20.0775H21.125V3.9225H20.125ZM20.125 20.0775C20.125 20.9945 19.485 21.625 18.844 21.625V22.625C20.1643 22.625 21.125 21.4105 21.125 20.0775H20.125ZM18.844 21.625H6.41058V22.625H18.844V21.625ZM6.41058 21.625C5.76792 21.625 5.12955 21.0039 5.12955 20.0775H4.12955C4.12955 21.4236 5.09185 22.625 6.41058 22.625V21.625ZM5.12955 20.0775V3.9225H4.12955V20.0775H5.12955ZM5.12955 3.9225C5.12955 3.0055 5.76956 2.375 6.41058 2.375V1.375C5.0902 1.375 4.12955 2.5895 4.12955 3.9225H5.12955ZM9.52032 16.4412C9.53194 15.9373 9.59014 15.4295 9.68473 14.9168L8.70132 14.7354C8.59869 15.2917 8.53362 15.853 8.52059 16.4182L9.52032 16.4412ZM9.67993 14.9397C9.69157 14.8899 9.78099 14.7261 10.1128 14.496C10.4223 14.2813 10.8711 14.0589 11.4404 13.861L11.112 12.9165C10.4856 13.1343 9.94827 13.3931 9.54284 13.6743C9.15974 13.94 8.80542 14.2871 8.70612 14.7124L9.67993 14.9397ZM11.4499 13.8576C11.5852 13.8074 11.7547 13.7102 11.8933 13.6105C11.9656 13.5584 12.0441 13.4954 12.1133 13.4247C12.1723 13.3646 12.2709 13.2534 12.3195 13.1013L11.3669 12.7971C11.3809 12.7532 11.3985 12.7277 11.4022 12.7225C11.407 12.7157 11.4073 12.7164 11.3993 12.7246C11.3827 12.7416 11.3525 12.7676 11.3092 12.7988C11.2674 12.8288 11.222 12.8575 11.1805 12.8808C11.1363 12.9057 11.1089 12.9175 11.1024 12.9199L11.4499 13.8576ZM16.734 16.4182C16.7209 15.853 16.6559 15.2917 16.5532 14.7354L15.5698 14.9168C15.6644 15.4295 15.7226 15.9373 15.7342 16.4412L16.734 16.4182ZM16.5484 14.7124C16.4491 14.2871 16.0948 13.94 15.7117 13.6743C15.3063 13.3931 14.769 13.1343 14.1426 12.9165L13.8142 13.861C14.3834 14.0589 14.8322 14.2813 15.1417 14.496C15.4736 14.7261 15.563 14.8899 15.5746 14.9397L16.5484 14.7124ZM14.1521 12.9199C14.1456 12.9175 14.1183 12.9057 14.074 12.8808C14.0325 12.8575 13.9871 12.8288 13.9453 12.7988C13.9021 12.7676 13.8719 12.7416 13.8552 12.7246C13.8472 12.7164 13.8476 12.7157 13.8524 12.7225C13.856 12.7277 13.8736 12.7532 13.8877 12.7971L12.9351 13.1013C12.9836 13.2534 13.0823 13.3646 13.1412 13.4247C13.2105 13.4954 13.2889 13.5584 13.3612 13.6105C13.4999 13.7102 13.6694 13.8074 13.8046 13.8576L14.1521 12.9199ZM11.4023 10.418C11.4023 9.83385 11.4811 9.26803 11.6861 8.81678L10.7757 8.40309C10.4878 9.03666 10.4023 9.76284 10.4023 10.418H11.4023ZM11.6861 8.81678C11.8053 8.55448 12.0796 8.38672 12.5813 8.38672V7.38672C11.8704 7.38672 11.1213 7.6426 10.7757 8.40309L11.6861 8.81678ZM12.5813 8.38672C13.087 8.38672 13.4614 8.60522 13.5777 8.83539L14.4703 8.38448C14.1169 7.685 13.2884 7.38672 12.5813 7.38672V8.38672ZM13.5777 8.83539C13.7606 9.19738 13.8523 9.72518 13.8523 10.418H14.8523C14.8523 9.66433 14.757 8.95213 14.4703 8.38448L13.5777 8.83539ZM12.5813 12.4492C12.5364 12.4492 12.5158 12.4464 12.5087 12.4451C12.5046 12.4444 12.5042 12.4442 12.5008 12.4428C12.4922 12.4391 12.4782 12.4321 12.438 12.4096C12.4018 12.3893 12.3471 12.358 12.2805 12.3238L11.823 13.213C11.8698 13.2371 11.9055 13.2576 11.9494 13.2821C11.9893 13.3045 12.0449 13.3354 12.1079 13.3623C12.2569 13.426 12.403 13.4492 12.5813 13.4492V12.4492ZM12.3817 12.3927C11.8273 11.9058 11.4022 11.3083 11.4023 10.418L10.4023 10.4179C10.4022 11.6973 11.0412 12.5462 11.7218 13.1441L12.3817 12.3927ZM13.8523 10.418C13.8523 11.3319 13.4575 11.9093 12.8838 12.3828L13.5203 13.1541C14.2611 12.5427 14.8523 11.7035 14.8523 10.418H13.8523ZM12.9733 12.3238C12.7638 12.4316 12.717 12.4492 12.5813 12.4492V13.4492C12.9639 13.4492 13.1869 13.3385 13.4308 13.213L12.9733 12.3238Z",fill:"#3D3D3D"})),It=e=>G.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},G.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"#D6D6D6"})),Fe=({selectable:e,className:s,addNewAddress:n,minifiedView:r,routeAddressesPage:o})=>{const d=r?"minifiedView":"fullSizeView",c=ne({viewAllAddressesButton:`Account.${d}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${d}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${d}.Addresses.differentAddressButton`}),l=e?"span":"button",i=e?{}:{AriaRole:"button",type:"button"},u=r&&!n?c.viewAllAddressesButton:c.addNewAddressButton,p=e?c.differentAddressButton:u;return j(l,{...i,className:X(["account-actions-address",["account-actions-address--viewall",r],["account-actions-address--address",!r],["account-actions-address--selectable",e],s]),"data-testid":"showRouteFullAddress",onClick:o,children:[a("span",{className:"account-actions-address__title","data-testid":"addressActionsText",children:p}),a(Se,{source:r&&!n?$t:Zt,size:"32"})]})},Ot=({minifiedView:e,keysSortOrder:s,addressData:n,open:r,submitLoading:o,onRemoveAddress:d,closeModal:c})=>{const l=e?"minifiedView":"fullSizeView",i=ne({title:`Account.${l}.Addresses.removeAddressModal.title`,description:`Account.${l}.Addresses.removeAddressModal.description`,actionCancel:`Account.${l}.Addresses.removeAddressModal.actionCancel`,actionConfirm:`Account.${l}.Addresses.removeAddressModal.actionConfirm`});return r?j(Ge,{title:a("h3",{children:i.title}),className:"account-address-modal",size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:c,children:[o?a("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:a(Ke,{stroke:"4",size:"large"})}):null,a("p",{children:i.description}),a(Me,{minifiedView:e,addressData:n,keysSortOrder:s}),j("div",{className:"account-address-modal__buttons",children:[a(oe,{type:"button",onClick:c,variant:"secondary",disabled:o,children:i.actionCancel}),a(oe,{disabled:o,onClick:d,children:i.actionConfirm})]})]}):null},wt=({typeList:e,isEmpty:s,minifiedView:n,className:r})=>{const o=n?"minifiedView":"fullSizeView",d=ne({addressesMessage:`Account.${o}.EmptyList.Addresses.message`,ordersListMessage:`Account.${o}.EmptyList.OrdersList.message`}),c=be(()=>{switch(e){case"address":return{icon:Ft,text:a("p",{children:d.addressesMessage})};case"orders":return{icon:It,text:a("p",{children:d.ordersListMessage})};default:return{icon:"",text:""}}},[e,d]);return!s||!e||!c.text?null:a(Je,{className:X(["account-empty-list",n?"account-empty-list--minified":"",r]),message:c.text,icon:a(Se,{source:c.icon}),"data-testid":"emptyList"})},xt=async(e,s)=>{if(s.length===1){const c=s[0],i=Object.values(c.region).every(p=>!!p)?{}:{region:{...c.region,regionId:0}};return!!await Ce({addressId:Number(c==null?void 0:c.id),defaultShipping:!1,defaultBilling:!1,...i})}const n=s.filter(c=>c.id!==e&&(c.defaultBilling||c.defaultShipping)||c.id!==e),r=s[s.length-1],o=n[0]||((r==null?void 0:r.id)!==e?r:null);return!o||!o.id?!1:!!await Ce({addressId:+o.id,defaultShipping:!0,defaultBilling:!0})},St=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_multiline_2","default_shipping","default_billing"],r1=["email","firstname","lastname","middlename","gender","dob","date_of_birth","prefix","suffix"],ke=(e,s,n)=>{if(s&&n||!s&&!n)return e;const r=e.slice();return s?r.sort((o,d)=>Number(d.defaultShipping)-Number(o.defaultShipping)):n?r.sort((o,d)=>Number(d.defaultBilling)-Number(o.defaultBilling)):e},ve=e=>e==null?!0:typeof e!="object"?!1:Object.keys(e).length===0||Object.values(e).every(ve),Rt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:n,onAddressData:r,minifiedView:o,routeAddressesPage:d,onSuccess:c})=>{const[l,i]=N(""),[u,p]=N(!1),[y,g]=N(!1),[I,L]=N(!1),[w,t]=N(!1),[h,f]=N(!1),[_,T]=N(""),[Z,U]=N([]),[x,V]=N([]),C=q(async()=>{L(!0),Promise.all([He("shortRequest"),tt()]).then(A=>{const[$,k]=A;if($){const S=$.map(({name:z,orderNumber:te,label:re})=>({name:rt(z),orderNumber:te,label:St.includes(z)?null:re}));V(S)}if(k)if(o){const S=k.filter(z=>!!z.defaultShipping||!!z.defaultBilling);U(S)}else U(k)}).finally(()=>{L(!1)})},[o]);ee(()=>{C()},[C]),ee(()=>{var A;if(Z.length)if(n===0)f(!0),i("0");else{const $=Z.find(S=>+S.id===n)||ke(Z,e,s)[0],k={data:ae($),isDataValid:!ve($)};i(n.toString()||((A=$==null?void 0:$.id)==null?void 0:A.toString())),r==null||r(k)}},[Z,n,r,s,e]);const H=q(A=>{T(A),f(!1)},[]),B=q((A,$)=>{const k=(A==null?void 0:A.target).value;i(k);const S={data:ae($),isDataValid:!ve(ae($))};r==null||r(S),k!=="0"&&f(!1)},[r]),P=q(()=>{g(!0)},[]),K=q(()=>{T(""),g(!1),p(!1)},[]),m=q(()=>{p(!0)},[]),v=q(async()=>{t(!0),await xt(_,Z),st(+_).then(()=>{C(),K()}).finally(()=>{t(!1)})},[Z,_,K,C]),b=q(()=>{f(!1)},[]),M=q(()=>{ze(d)&&o&&!h?window.location.href=d():(f(!0),T(""))},[h,d,o]),O=q(async()=>{await C(),await(c==null?void 0:c())},[C,c]);return{keysSortOrder:x,submitLoading:w,isModalRendered:u,isFormRendered:y,loading:I,addNewAddress:h,addressesList:Z,addressId:_,handleRenderForm:P,handleRenderModal:m,removeAddress:v,onCloseBtnClick:K,setEditingAddressId:H,closeNewAddressForm:b,redirectToAddressesRoute:M,handleOnSuccess:O,handleSelectAddressOption:B,selectedAddressOption:l}},s1=Ee(({hideActionFormButtons:e=!1,formName:s,slots:n,title:r="",addressFormTitle:o="",defaultSelectAddressId:d="",showFormLoader:c=!1,onAddressData:l,forwardFormRef:i,className:u,showSaveCheckBox:p=!1,saveCheckBoxValue:y=!1,selectShipping:g=!1,selectBilling:I=!1,selectable:L=!1,withHeader:w=!0,minifiedView:t=!1,withActionsInMinifiedView:h=!1,withActionsInFullSizeView:f=!0,inputsDefaultValueSet:_,showShippingCheckBox:T=!0,showBillingCheckBox:Z=!0,shippingCheckBoxValue:U=!0,billingCheckBoxValue:x=!0,routeAddressesPage:V,onSuccess:C,onError:H})=>{var J;const B=t?"minifiedView":"fullSizeView",P=ne({containerTitle:`Account.${B}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${B}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${B}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${B}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${B}.Addresses.newAddressFormTitle`}),{keysSortOrder:K,submitLoading:m,isModalRendered:v,isFormRendered:b,loading:M,addNewAddress:O,addressesList:A,addressId:$,handleRenderForm:k,handleRenderModal:S,removeAddress:z,onCloseBtnClick:te,handleOnSuccess:re,setEditingAddressId:Le,closeNewAddressForm:de,redirectToAddressesRoute:ce,handleSelectAddressOption:ie,selectedAddressOption:ue}=Rt({defaultSelectAddressId:d,minifiedView:t,routeAddressesPage:V,onSuccess:C,onAddressData:l,selectShipping:g,selectBilling:I}),R=s??(g&&I?"selectedAddress":g?"selectedShippingAddress":I?"selectedBillingAddress":"default"),W=L?j("div",{className:"account-addresses-wrapper--select-view",children:[(J=ke(A,g,I))==null?void 0:J.map((E,Y)=>j(Ne,{children:[a("input",{"data-testid":`radio-${Y+1}`,type:"radio",name:R,id:`${R}_${E.id}`,value:E.id,checked:ue===(E==null?void 0:E.id.toString()),onChange:ge=>ie(ge,E)}),a("label",{htmlFor:`${R}_${E.id}`,className:"account-addresses-wrapper__label",children:a(Me,{slots:n,selectable:L,selectShipping:g,selectBilling:I,minifiedView:t,addressData:E,keysSortOrder:K,loading:M})})]},E.id)),a("input",{"data-testid":"radio-0",type:"radio",name:R,id:`${R}_addressActions`,value:"0",checked:ue==="0",onChange:E=>ie(E,{})}),a("label",{htmlFor:`${R}_addressActions`,className:"account-addresses-wrapper__label",children:O?a("div",{className:X(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",O]]),children:a(fe,{slots:n,hideActionFormButtons:e,formName:R,showFormLoader:c,isOpen:O,forwardFormRef:i,showSaveCheckBox:p,saveCheckBoxValue:y,shippingCheckBoxValue:U,billingCheckBoxValue:x,addressesFormTitle:o||P.differentAddressFormTitle,inputsDefaultValueSet:_,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:de,onSuccess:re,onError:H,onChange:l})}):A!=null&&A.length?a(Fe,{selectable:L,minifiedView:t,addNewAddress:O,routeAddressesPage:ce}):null})]}):j(Q,{children:[A.map(E=>a(Ne,{children:$===E.id&&b?a(he,{variant:"secondary",style:{marginBottom:20},children:a(fe,{slots:n,isOpen:$===E.id&&b,addressFormId:$,inputsDefaultValueSet:E,addressesFormTitle:P.editAddressFormTitle,showShippingCheckBox:T,showBillingCheckBox:Z,shippingCheckBoxValue:U,billingCheckBoxValue:x,onCloseBtnClick:te,onSuccess:re,onError:H})}):a(Me,{slots:n,minifiedView:t,addressData:E,keysSortOrder:K,loading:M,setAddressId:Le,handleRenderModal:t&&h||!t&&f?S:void 0,handleRenderForm:t&&h||!t&&f?k:void 0},E.id)},E.id)),a("div",{className:"account-addresses__footer",children:O?a(he,{variant:"secondary",children:a(fe,{slots:n,isOpen:O,addressesFormTitle:P.newAddressFormTitle,inputsDefaultValueSet:_,showShippingCheckBox:!!(A!=null&&A.length),showBillingCheckBox:!!(A!=null&&A.length),shippingCheckBoxValue:U,billingCheckBoxValue:x,onCloseBtnClick:de,onSuccess:re,onError:H})}):a(Fe,{minifiedView:t,addNewAddress:O,routeAddressesPage:ce})})]});return j("div",{children:[a("div",{children:w?a(Xe,{title:r||P.containerTitle,divider:!t,className:t?"account-addresses-header":""}):null}),j("div",{className:X(["account-addresses-wrapper",u]),"data-testid":"addressesIdWrapper",children:[a(Ot,{minifiedView:t,addressData:A==null?void 0:A.find(E=>E.id===$),keysSortOrder:K,submitLoading:m,open:v,closeModal:te,onRemoveAddress:z}),M?a(Ue,{testId:"addressSkeletonLoader",withCard:!1}):L?a(fe,{slots:n,hideActionFormButtons:e,formName:R,isOpen:!(A!=null&&A.length),forwardFormRef:i,showSaveCheckBox:p,saveCheckBoxValue:y,shippingCheckBoxValue:U,billingCheckBoxValue:x,inputsDefaultValueSet:_,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:de,onSuccess:re,onError:H,onChange:l}):a(wt,{isEmpty:!(A!=null&&A.length),typeList:"address",minifiedView:t}),W]})]})}),qe={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:se.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},Vt={...qe,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},Ht={...qe,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},Bt=(e,s)=>s==null?void 0:s.map(n=>{const r={...e,firstName:e.firstname??e.firstName,lastName:e.lastname??e.lastName},o=JSON.parse(JSON.stringify(n));if(Object.hasOwn(r,n.customUpperCode)){const d=r[n.customUpperCode];n.customUpperCode==="region"&&typeof d=="object"?o.defaultValue=d.regionCode&&d.regionId?`${d.regionCode},${d.regionId}`:d.region??d.regionCode:o.defaultValue=d}return o}),Ie=e=>{if(!e)return null;const s=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(r=>{s.has(r.name)||s.set(r.name,"false"),r.checked&&s.set(r.name,"true")}),s&&typeof s.entries=="function"){const r=s.entries();if(r&&typeof r[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(r)))||{}}return{}},zt=({fields:e,addressId:s,countryOptions:n,disableField:r,regionOptions:o,isRequiredRegion:d,isRequiredPostCode:c})=>e.filter(i=>!(s&&(i.customUpperCode==="defaultShipping"||i.customUpperCode==="defaultBilling")&&i.defaultValue)).map(i=>i.customUpperCode==="countryCode"?{...i,options:n,disabled:r}:i.customUpperCode==="postcode"?{...i,required:c}:i.customUpperCode==="region"?{...i,options:o,required:d,disabled:r}:i),Ut=(e,s="address")=>{const n=s==="address"?["region","city","company","countryCode","countryId","defaultBilling","defaultShipping","fax","firstName","lastName","middleName","postcode","prefix","street","suffix","telephone","vatId","addressId"]:["email","firstName","lastName","middleName","gender","dob","dateOfBirth","prefix","suffix"],r={},o=[];return Object.keys(e).forEach(d=>{n.includes(d)?r[d]=e[d]:o.push({attribute_code:Ve(d),value:e[d]})}),o.length>0&&(r.custom_attributesV2=o),r},Oe=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],n=["on","off","true","false"],r=[],o={};for(const L in e){const w=e[L];n.includes(w)&&(o[L]=Be(w)),s.includes(L)&&r.push(w)}const{street:d,streetMultiline_2:c,streetMultiline_1:l,region:i,...u}=e,[p,y]=i?i.split(","):[void 0,void 0],g=y&&p?{regionId:+y,regionCode:p}:{region:p};return Ut({...u,...o,region:{...g},street:r})},kt=(e,s)=>{const n={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const o=e[r];if(r==="region"&&o.regionId){const d=s.find(c=>(c==null?void 0:c.id)===o.regionId);d?n[r]={...o,text:d.text}:n[r]=o}else Array.isArray(o)?(n[r]=o[0]||"",o.slice(1).forEach((d,c)=>{n[`${r}Multiline_${c+2}`]=d})):n[r]=o}return n},qt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Pt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:n,addressFormId:r,billingCheckBoxValue:o,shippingCheckBoxValue:d,showShippingCheckBox:c,showBillingCheckBox:l,inputsDefaultValueSet:i,onCloseBtnClick:u,onSuccess:p,onError:y,formName:g})=>{const[I,L]=N({text:"",type:"success"}),[w,t]=N(e??!1),[h,f]=N(r||""),[_,T]=N([]),[Z,U]=N([]),[x,V]=N([]),[C,H]=N([]),[B,P]=N([]),[K,m]=N(!1),[v,b]=N(!1),[M,O]=N(()=>{var R,W;const F=sessionStorage.getItem(`${g}_addressData`);return F?{countryCode:(W=(R=JSON.parse(F))==null?void 0:R.data)==null?void 0:W.countryCode}:i}),[A,$]=N(!1),[k,S]=N(!1),[z,te]=N(()=>{var W,J;const F=sessionStorage.getItem(`${g}_addressData`);return F?(J=(W=JSON.parse(F))==null?void 0:W.data)==null?void 0:J.saveAddressBook:n}),re=q(F=>{te(F.target.checked)},[]);ee(()=>{typeof e>"u"||t(e)},[e]),ee(()=>{He(h?"customer_address_edit":"customer_register_address").then(F=>{T(F)})},[h]),ee(()=>{$(!0),nt().then(({availableCountries:F,countriesWithRequiredRegion:R,optionalZipCountries:W})=>{U(F),H(R),P(W),$(!1)})},[]),ee(()=>{if(M!=null&&M.countryCode){$(!0),S(!0);const F=M==null?void 0:M.countryCode;at(F).then(R=>{V(R);const W=C.find(E=>E===F),J=B.find(E=>E===F);m(!!W),b(!J),$(!1),S(!1)})}},[M==null?void 0:M.countryCode,C,B]);const Le=q(()=>{L({text:"",type:"success"}),u==null||u()},[u]),de=q(async(F,R)=>{if(!R)return null;t(!0);const W=Ie(F.target),J=Oe(W);await Ce(J).then(()=>{var E;p==null||p(),u==null||u(),(E=F==null?void 0:F.target)==null||E.reset()}).catch(E=>{L(Y=>({...Y,text:E.message,type:"error"})),y==null||y(E)}).finally(()=>{f(""),t(!1)})},[u,y,p]),ce=q(async(F,R)=>{if(!R)return;t(!0);const{saveAddressBook:W,...J}=Ie(F.target),E=Oe(J);await ot(E).then(()=>{var Y;p==null||p(),u==null||u(),(Y=F==null?void 0:F.target)==null||Y.reset()}).catch(Y=>{L(ge=>({...ge,text:Y.message,type:"error"})),y==null||y(Y)}).finally(()=>{f(""),t(!1)})},[u,y,p]),ie=et(()=>{if(!_.length)return[];const F={...Vt,defaultValue:d,isHidden:s&&!z?!0:!c},R={...Ht,defaultValue:o,isHidden:s&&!z?!0:!l},W=[..._,F,R],J=sessionStorage.getItem(`${g}_addressData`),E=J?kt(JSON.parse(J).data,x):{},Y=Bt(qt(E,i),W);return zt({fields:Y,addressId:h,countryOptions:Z,disableField:A,regionOptions:x,isRequiredRegion:K,isRequiredPostCode:v})},[_,d,s,z,c,o,l,g,x,i,h,Z,A,K,v]),ue=q(F=>{O(R=>({...R,...F}))},[]);return{isWaitingForResponse:k,regionOptions:x,saveCheckBoxAddress:z,inLineAlert:I,addressId:h,submitLoading:w,normalizeFieldsConfig:ie,handleSaveCheckBoxAddress:re,handleUpdateAddress:de,handleCreateAddress:ce,handleOnCloseForm:Le,handleInputChange:ue}},jt=e=>{var o;if(!e)return{};if(e&&!Array.isArray(e.customAttributes))return e;const s={};(o=e==null?void 0:e.customAttributes)==null||o.forEach(d=>{d.code&&Object.prototype.hasOwnProperty.call(d,"value")&&(s[d.code]=d.value)});const{customAttributes:n,...r}=e;return{...r,...Re(s,"camelCase",{})}},Wt=({hideActionFormButtons:e,formName:s="",showFormLoader:n=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:o=!1,forwardFormRef:d,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:p,showShippingCheckBox:y=!0,showBillingCheckBox:g=!0,shippingCheckBoxValue:I=!0,billingCheckBoxValue:L=!0,isOpen:w,onSubmit:t,onCloseBtnClick:h,onSuccess:f,onError:_,onChange:T})=>{const Z=ne({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isWaitingForResponse:U,inLineAlert:x,addressId:V,submitLoading:C,normalizeFieldsConfig:H,handleUpdateAddress:B,handleCreateAddress:P,handleOnCloseForm:K,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,handleInputChange:b,regionOptions:M}=Pt({showFormLoader:n,addressFormId:u,inputsDefaultValueSet:jt(p),shippingCheckBoxValue:I,billingCheckBoxValue:L,showShippingCheckBox:y,showBillingCheckBox:g,saveCheckBoxValue:o,showSaveCheckBox:r,onSuccess:f,onError:_,onCloseBtnClick:h,formName:s});return w?j("div",{className:X(["account-address-form-wrapper",i]),children:[l?a("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:l}):null,x.text?a(Ye,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:x.type,variant:"secondary",heading:x.text,icon:x.icon}):null,j(Tt,{regionOptions:M,forwardFormRef:d,slots:c,className:"account-address-form",name:s||"addressesForm",fieldsConfig:H,onSubmit:t||(V?B:P),setInputChange:b,loading:C,showFormLoader:n,showSaveCheckBox:r,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,onChange:T,isWaitingForResponse:U,children:[V?a("input",{type:"hidden",name:"addressId",value:V,"data-testid":"hidden_test_id"}):null,e?null:a("div",{className:X(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:c!=null&&c.AddressFormActions?a(Ae,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:c.AddressFormActions,context:{handleUpdateAddress:B,handleCreateAddress:P,addressId:V}}):a(Q,{children:r?null:j(Q,{children:[a(oe,{type:"button",onClick:K,variant:"secondary",disabled:C,children:Z.secondaryButton}),a(oe,{disabled:C,children:Z.primaryButton})]})})})]})]}):null};export{fe as A,Ue as C,wt as E,Tt as F,$t as S,s1 as a,ze as c,r1 as d,Ie as g,Ut as n}; +import{jsx as a,Fragment as Q,jsxs as j}from"@dropins/tools/preact-jsx-runtime.js";import{classes as X,Slot as Ae}from"@dropins/tools/lib.js";import{Field as le,Picker as Pe,Input as je,InputDate as We,Checkbox as we,TextArea as De,Card as he,Skeleton as xe,SkeletonRow as D,Button as oe,Tag as pe,Icon as Se,Modal as Ge,ProgressSpinner as Ke,IllustratedMessage as Je,Header as Xe,InLineAlert as Ye}from"@dropins/tools/components.js";import{useRef as Qe,useState as N,useEffect as ee,useCallback as k,useMemo as et}from"@dropins/tools/preact-hooks.js";import{k as Re,o as Ve,u as Ce,c as He,e as tt,n as rt,j as st,h as nt,i as at,d as ot}from"./removeCustomerAddress.js";import{useText as ne}from"@dropins/tools/i18n.js";import*as G from"@dropins/tools/preact-compat.js";import{memo as Ee,forwardRef as dt,useImperativeHandle as lt,useMemo as be,useCallback as _e}from"@dropins/tools/preact-compat.js";import{Fragment as Ne}from"@dropins/tools/preact.js";import"@dropins/tools/event-bus.js";const fe=({hideActionFormButtons:e,formName:s,showFormLoader:n,showSaveCheckBox:r,saveCheckBoxValue:o,forwardFormRef:d,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:p,billingCheckBoxValue:C,shippingCheckBoxValue:g,showBillingCheckBox:I,showShippingCheckBox:L,isOpen:w,onSubmit:t,onCloseBtnClick:A,onSuccess:f,onError:_,onChange:T})=>a("div",{className:X(["account-address-form"]),children:a(Wt,{hideActionFormButtons:e,formName:s,showFormLoader:n,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:p,shippingCheckBoxValue:g,billingCheckBoxValue:C,showShippingCheckBox:L,showBillingCheckBox:I,isOpen:w,onSubmit:t,onCloseBtnClick:A,onSuccess:f,onError:_,onChange:T,forwardFormRef:d,showSaveCheckBox:r,saveCheckBoxValue:o})}),ct=e=>e.reduce((s,n)=>({...s,[n.name]:n.value}),{}),it=e=>/^\d+$/.test(e),ut=e=>/^[a-zA-Z0-9\s]+$/.test(e),pt=e=>/^[a-zA-Z0-9]+$/.test(e),ft=e=>/^[a-zA-Z]+$/.test(e),mt=e=>/^[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+(\.[a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]+)*@([a-z0-9-]+\.)+[a-z]{2,}$/i.test(e),ht=e=>/^\d{4}-\d{2}-\d{2}$/.test(e)&&!isNaN(Date.parse(e)),At=(e,s,n)=>{const r=new Date(e).getTime()/1e3;return isNaN(r)||r<0?!1:r>=s&&r<=n},Te=e=>new Date(parseInt(e,10)*1e3).toISOString().split("T")[0],Lt=e=>/^(https?|ftp):\/\/(([A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))(\.[A-Z0-9]([A-Z0-9_-]*[A-Z0-9]|))*)(:(\d+))?(\/[A-Z0-9~](([A-Z0-9_~-]|\.)*[A-Z0-9~]|))*\/?(.*)?$/i.test(e),gt=(e,s,n)=>{const r=e.length;return r>=s&&r<=n},ye=(e,s,n,r)=>{var x,V;const{requiredFieldError:o,lengthTextError:d,numericError:c,alphaNumWithSpacesError:l,alphaNumericError:i,alphaError:u,emailError:p,dateError:C,urlError:g,dateLengthError:I}=n,L=s==null?void 0:s.customUpperCode,w={[L]:""};if(r[L]&&delete r[L],s!=null&&s.required&&!e)return{[L]:o};if(!(s!=null&&s.required)&&!e||!((x=s==null?void 0:s.validateRules)!=null&&x.length))return w;const t=ct(s==null?void 0:s.validateRules),A=t.MIN_TEXT_LENGTH??1,f=t.MAX_TEXT_LENGTH??255,_=t.DATE_RANGE_MIN,T=t.DATE_RANGE_MAX;if(!gt(e,+A,+f)&&!(_||T))return{[L]:d.replace("{min}",A).replace("{max}",f)};if(!At(e,+_,+T)&&(_||T))return{[L]:I.replace("{min}",Te(_)).replace("{max}",Te(T))};const z={numeric:{validate:it,error:c},"alphanum-with-spaces":{validate:ut,error:l},alphanumeric:{validate:pt,error:i},alpha:{validate:ft,error:u},email:{validate:mt,error:p},date:{validate:ht,error:C},url:{validate:Lt,error:g}}[t.INPUT_VALIDATION];return z&&!z.validate(e)&&!((V=r[L])!=null&&V.length)?{[L]:z.error}:w},Be=e=>{switch(e){case"on":case"true":case 1:case"1":return!0;case"0":case"off":case"false":case 0:return!1;default:return!1}},yt=["true","false","yes","on","off"],Ct={firstName:"",lastName:"",city:"",company:"",countryCode:"",region:"",regionCode:"",regionId:"",id:"",telephone:"",vatId:"",postcode:"",defaultShipping:"",defaultBilling:"",street:"",saveAddressBook:""},bt=e=>{const s={},n={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const o=e[r],d=r.match(/^(.*)Multiline_(\d+)$/);if(d){const c=d[1],l=parseInt(d[2],10);n[c]||(n[c]=[]),n[c].push({index:l,value:o})}else Object.keys(e).filter(l=>l.startsWith(`${r}Multiline_`)).length>0?n[r]=[{index:1,value:o}]:s[r]=o}for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const o=n[r];o.sort((d,c)=>d.index-c.index),s[r]=o.map(d=>d.value)}return s},Mt=e=>{const s={},n=[];for(const r in e){const o=yt.includes(e[r])?Be(e[r]):e[r];Object.prototype.hasOwnProperty.call(e,r)&&(Object.prototype.hasOwnProperty.call(Ct,r)?s[r]=o:n.push({code:Ve(r),value:o}))}return{...s,customAttributes:n}},ae=(e,s=!1)=>{const n=Re(e,"camelCase",{firstname:"firstName",lastname:"lastName"}),r=Mt(bt(n));if(!s)return r;const[o,d]=r.region?r.region.split(","):[];return{...r,region:{regionCode:o,...d&&{regionId:+d}}}},me=e=>{if(!e.current)return{};const s=e.current.elements;return Array.from(s).reduce((r,o)=>(o.name&&(r[o.name]=o.type==="checkbox"?o.checked:o.value),r),{})},Ze=(e,s)=>Object.keys(e).every(r=>r in s&&s[r]!==""),ze=e=>typeof e=="function",vt=e=>e.reduce((s,{customUpperCode:n,required:r,defaultValue:o})=>(r&&n&&(s.initialData[n]=o||"",s.errorList[n]=""),s),{initialData:{},errorList:{}}),$e=e=>Object.keys(e).length>0,Et=({fieldsConfig:e,onSubmit:s,onChange:n,setInputChange:r,formName:o,isWaitingForResponse:d})=>{const c=ne({requiredFieldError:"Account.FormText.requiredFieldError",lengthTextError:"Account.FormText.lengthTextError",numericError:"Account.FormText.numericError",alphaNumWithSpacesError:"Account.FormText.alphaNumWithSpacesError",alphaNumericError:"Account.FormText.alphaNumericError",alphaError:"Account.FormText.alphaError",emailError:"Account.FormText.emailError",dateError:"Account.FormText.dateError",dateLengthError:"Account.FormText.dateLengthError",urlError:"Account.FormText.urlError"}),l=Qe(null),[i,u]=N({}),[p,C]=N({}),[g,I]=N({}),[L,w]=N(!0),[t,A]=N(!1),[f,_]=N(!1),[T,Z]=N(!0),[z,x]=N(!1);ee(()=>{const m=()=>{if(l.current){const y=window.getComputedStyle(l.current).getPropertyValue("grid-template-rows").split(" ").length,M=l.current.querySelector(".account-address-form--saveAddressBook");M&&(M.style.gridRow=String(y-1))}};return m(),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m)}},[e==null?void 0:e.length]);const V=k((m=!1)=>{let v=!0;const y={...p};let M=null;for(const[O,h]of Object.entries(i)){const $=e==null?void 0:e.find(S=>S.customUpperCode.includes(O)),U=ye(h.toString(),$,c,y);U[O]&&(Object.assign(y,U),v=!1),M||(M=Object.keys(y).find(S=>y[S])||null)}if(m||C(y),M&&l.current&&!m){const O=l.current.elements.namedItem(M);O==null||O.focus()}return v},[p,e,i,c]),b=k((m,v,y,M)=>{const O={...me(l),[v]:m,...v.includes("countryCode")?{region:""}:{}},h={data:ae(O,!0),isDataValid:Ze(y,O)};x(h.isDataValid),V(!0),["selectedShippingAddress","selectedBillingAddress"].includes(o)&&sessionStorage.setItem(`${o}_addressData`,JSON.stringify(h)),console.log("data",h),n==null||n(h,{},M)},[V,o,n]);ee(()=>{if(e!=null&&e.length){const{initialData:m,errorList:v}=vt(e);u(y=>({...m,...y})),C(v),I(v)}},[JSON.stringify(e)]),ee(()=>{if(f)return;const m=me(l),v=sessionStorage.getItem(`${o}_addressData`);if($e(i)&&$e(g)){let y={};const M=Ze(g,i);v?y=JSON.parse(v).data:y=ae(m,!0)??{},console.log("data",y),n==null||n({data:y,isDataValid:M},{},null),x(M),_(!0)}},[i,g]),ee(()=>{var O;if(!T)return;const m=me(l),v=!!(m!=null&&m.countryCode),y=!!((O=m==null?void 0:m.region)!=null&&O.length);m&&v&&!y&&ze(n)&&!d&&b(m==null?void 0:m.region,"region",g,null)},[T,L,e,l,n,b,g,t,d]);const H=k((m,v)=>{const{name:y,value:M,type:O,checked:h}=m==null?void 0:m.target,$=O==="checkbox"?h:M;u(B=>{const te={...B,[y]:$};return y==="countryCode"&&(te.region="",w(!0),A(!1)),te}),r==null||r({[y]:$}),_(!0);const U=e==null?void 0:e.find(B=>B.customUpperCode.includes(y));let S=v?{...v}:{...p};if(U){const B=ye($.toString(),U,c,S);B&&Object.assign(S,B),C(S)}b($,y,g,m)},[r,e,p,c,b,g,L]),q=k(m=>{const{name:v}=m==null?void 0:m.target,y=e==null?void 0:e.find(M=>M.customUpperCode===v);v==="region"&&(y!=null&&y.options.length)&&Z(!1),Z(v==="countryCode")},[]),P=k((m,v)=>{const{name:y,value:M,type:O,checked:h}=m==null?void 0:m.target,$=O==="checkbox"?h:M,U=e==null?void 0:e.find(S=>S.customUpperCode===y);if(U){const S=v?{...v}:{...p},B=ye($.toString(),U,c,S);B&&Object.assign(S,B),C(S)}},[p,e,c]),K=k(m=>{m.preventDefault();const v=V();s==null||s(m,v)},[V,s]);return{isDataValid:z,formData:i,errors:p,formRef:l,handleInputChange:H,onFocus:q,handleBlur:P,handleSubmit:K,handleValidationSubmit:V}};var se=(e=>(e.BOOLEAN="BOOLEAN",e.DATE="DATE",e.DATETIME="DATETIME",e.DROPDOWN="DROPDOWN",e.FILE="FILE",e.GALLERY="GALLERY",e.HIDDEN="HIDDEN",e.IMAGE="IMAGE",e.MEDIA_IMAGE="MEDIA_IMAGE",e.MULTILINE="MULTILINE",e.MULTISELECT="MULTISELECT",e.PRICE="PRICE",e.SELECT="SELECT",e.TEXT="TEXT",e.TEXTAREA="TEXTAREA",e.UNDEFINED="UNDEFINED",e.VISUAL="VISUAL",e.WEIGHT="WEIGHT",e.EMPTY="",e))(se||{});const _t=Ee(({loading:e,values:s,fields:n=[],errors:r,className:o="",onChange:d,onBlur:c,onFocus:l,slots:i})=>{const u=`${o}__field`,p=(t,A)=>{if(!(i!=null&&i[`AddressFormInput_${t.code}`]))return;const f={inputName:t.customUpperCode,handleOnChange:d,handleOnBlur:c,handleOnFocus:l,errorMessage:A,errors:r,config:t};return a(Ae,{"data-testid":`addressFormInput_${t.code}`,name:`AddressFormInput_${t.code}`,slot:i[`AddressFormInput_${t.code}`],context:f},t.id)},C=(t,A,f)=>{var T;const _=((T=t.options.find(Z=>Z.isDefault))==null?void 0:T.value)??A??t.defaultValue;return a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e||t.disabled,children:a(Pe,{id:t.code,required:t.required,name:t.customUpperCode,floatingLabel:`${t.label} ${t.required?"*":""}`,placeholder:t.label,"aria-label":t.label,options:t.options,onBlur:c,onFocus:l,handleSelect:d,defaultValue:_,value:_})},t.id)})},g=(t,A,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e,children:a(je,{id:t.code,type:"text",name:t.customUpperCode,value:A??t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onFocus:l,onChange:d})},t.id)}),I=(t,A,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e||t.disabled,children:a(We,{id:t.code,type:"text",name:t.customUpperCode,value:A||t.defaultValue,placeholder:t.label,floatingLabel:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:d,disabled:e||t.disabled})},t.id)}),L=(t,A,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e,children:a(we,{id:t.code,name:t.customUpperCode,checked:A||t.defaultValue,placeholder:t.label,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:d})},t.id)}),w=(t,A,f)=>a(Q,{children:p(t,f)??a(le,{error:f,className:X([u,`${u}--${t.id}`,[`${u}--${t.id}-hidden`,t.isHidden],t.className]),"data-testid":`${o}--${t.id}`,disabled:e,children:a(De,{id:t.code,type:"text",name:t.customUpperCode,value:A??t.defaultValue,label:`${t.label} ${t.required?"*":""}`,onBlur:c,onChange:d})},t.id)});return n.length?a(Q,{children:n.map(t=>{const A=r==null?void 0:r[t.customUpperCode],f=s==null?void 0:s[t.customUpperCode];switch(t.fieldType){case se.TEXT:return t.options.length?C(t,f,A):g(t,f,A);case se.MULTILINE:return g(t,f,A);case se.SELECT:return C(t,f,A);case se.DATE:return I(t,f,A);case se.BOOLEAN:return L(t,f,A);case se.TEXTAREA:return w(t,f,A);default:return null}})}):null}),Ue=({testId:e,withCard:s=!0})=>{const n=j(xe,{"data-testid":e||"skeletonLoader",children:[a(D,{variant:"heading",size:"xlarge",fullWidth:!1,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1}),a(D,{variant:"heading",size:"xlarge",fullWidth:!0,lines:1})]});return s?n:a(he,{variant:"secondary",className:X(["account-account-loaders","account-account-loaders--card-loader"]),children:n})},Nt=()=>j(xe,{"data-testid":"addressFormLoader",children:[a(D,{variant:"heading",size:"medium"}),a(D,{variant:"empty",size:"medium"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0}),a(D,{size:"large",fullWidth:!0,lines:3}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large"}),a(D,{size:"large",fullWidth:!0})]}),Tt=Ee(dt(({isWaitingForResponse:e,setInputChange:s,showFormLoader:n,slots:r,name:o,loading:d,children:c,className:l="defaultForm",fieldsConfig:i,onSubmit:u,onChange:p,forwardFormRef:C,regionOptions:g,showSaveCheckBox:I,handleSaveCheckBoxAddress:L,saveCheckBoxAddress:w})=>{const t=ne({saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isDataValid:A,formData:f,errors:_,formRef:T,handleInputChange:Z,handleBlur:z,handleSubmit:x,handleValidationSubmit:V,onFocus:b}=Et({fieldsConfig:i,onSubmit:u,onChange:p,setInputChange:s,regionOptions:g,formName:o,isWaitingForResponse:e});return lt(C,()=>{const H=me(T);return{handleValidationSubmit:V,formData:ae(H,!0),isDataValid:A}}),n||!(i!=null&&i.length)?a(Nt,{}):j("form",{className:X(["account-form",l]),onSubmit:x,name:o,ref:T,children:[a(_t,{className:l,loading:d,fields:i,onChange:Z,onBlur:z,errors:_,values:f,onFocus:b,slots:r}),r!=null&&r.AddressFormInputs?a(Ae,{"data-testid":"addressFormInputs",name:"AddressFormInputs",slot:r.AddressFormInputs,context:{formActions:{handleChange:Z}}}):null,I?a("div",{className:"account-address-form--saveAddressBook",children:a(we,{"data-testid":"testSaveAddressBook",name:"saveAddressBook",label:t.saveAddressBook,checked:w,onChange:H=>{Z(H),L==null||L(H)}})}):null,c]})})),Me=({slots:e,selectable:s,selectShipping:n,selectBilling:r,variant:o="secondary",minifiedView:d,keysSortOrder:c,addressData:l,loading:i,setAddressId:u,handleRenderModal:p,handleRenderForm:C})=>{const g=d?"minifiedView":"fullSizeView",I=ne({actionRemove:`Account.${g}.Addresses.addressCard.actionRemove`,actionEdit:`Account.${g}.Addresses.addressCard.actionEdit`,cardLabelShipping:`Account.${g}.Addresses.addressCard.cardLabelShipping`,cardLabelBilling:`Account.${g}.Addresses.addressCard.cardLabelBilling`,defaultLabelText:`Account.${g}.Addresses.addressCard.defaultLabelText`}),L=I.cardLabelBilling.toLocaleUpperCase(),w=I.cardLabelShipping.toLocaleUpperCase(),t=I.defaultLabelText.toLocaleUpperCase(),A=be(()=>{const b={shippingLabel:w,billingLabel:L,hideShipping:!1,hideBilling:!1};return s?n&&!r?{shippingLabel:t,billingLabel:t,hideShipping:!1,hideBilling:!0}:r&&!n?{shippingLabel:t,billingLabel:t,hideShipping:!0,hideBilling:!1}:b:b},[L,t,w,r,n,s]),f=_e(()=>{u==null||u(l==null?void 0:l.id),p==null||p()},[p,l==null?void 0:l.id,u]),_=_e(()=>{u==null||u(l==null?void 0:l.id),C==null||C()},[C,l==null?void 0:l.id,u]),T=be(()=>{if(!c)return[];const{region:b,...H}=l,q={...H,...b};return c.filter(({name:P})=>q[P]).map(P=>({name:P.name,orderNumber:P.orderNumber,value:q[P.name],label:P.label}))},[l,c]),{shippingLabel:Z,billingLabel:z,hideShipping:x,hideBilling:V}=A;return a(he,{variant:o,className:"account-address-card","data-testid":"addressCard",children:i?a(Ue,{}):j(Q,{children:[j("div",{className:"account-address-card__action",children:[p?a(oe,{type:"button",variant:"tertiary",onClick:f,"data-testid":"removeButton",children:I.actionRemove}):null,C?a(oe,{type:"button",variant:"tertiary",onClick:_,className:"account-address-card__action--editbutton","data-testid":"editButton",children:I.actionEdit}):null]}),a("div",{className:"account-address-card__description",children:e!=null&&e.AddressCard?a(Ae,{name:"AddressCard",slot:e==null?void 0:e.AddressCard,context:{addressData:T}}):a(Q,{children:T.map((b,H)=>{const q=b.label?`${b.label}: ${b==null?void 0:b.value}`:b==null?void 0:b.value;return a("p",{"data-testid":`${b.name}_${H}`,children:q},H)})})}),(l!=null&&l.defaultShipping||l!=null&&l.defaultBilling)&&!s?j("div",{className:"account-address-card__labels",children:[l!=null&&l.defaultShipping?a(pe,{label:w}):null,l!=null&&l.defaultBilling?a(pe,{label:L}):null]}):null,s?j("div",{className:"account-address-card__labels",children:[!x&&(l!=null&&l.defaultShipping)?a(pe,{label:Z}):null,!V&&(l!=null&&l.defaultBilling)?a(pe,{label:z}):null]}):null]})})},Zt=e=>G.createElement("svg",{id:"Icon_Add_Base","data-name":"Icon \\u2013 Add \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},G.createElement("g",{id:"Large"},G.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),G.createElement("g",{id:"Add_icon","data-name":"Add icon",transform:"translate(9.734 9.737)"},G.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_579","data-name":"Line 579",y2:12.7,transform:"translate(2.216 -4.087)",fill:"none",stroke:"currentColor"}),G.createElement("line",{vectorEffect:"non-scaling-stroke",id:"Line_580","data-name":"Line 580",x2:12.7,transform:"translate(-4.079 2.263)",fill:"none",stroke:"currentColor"})))),$t=e=>G.createElement("svg",{id:"Icon_Chevron_right_Base","data-name":"Icon \\u2013 Chevron right \\u2013 Base",xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...e},G.createElement("g",{id:"Large"},G.createElement("rect",{id:"Placement_area","data-name":"Placement area",width:24,height:24,fill:"#fff",opacity:0}),G.createElement("g",{id:"Chevron_right_icon","data-name":"Chevron right icon"},G.createElement("path",{vectorEffect:"non-scaling-stroke",id:"chevron",d:"M199.75,367.5l4.255,-4.255-4.255,-4.255",transform:"translate(-189.25 -351.0)",fill:"none",stroke:"currentColor"})))),Ft=e=>G.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},G.createElement("path",{d:"M3.375 7.38672C3.09886 7.38672 2.875 7.61058 2.875 7.88672C2.875 8.16286 3.09886 8.38672 3.375 8.38672V7.38672ZM5.88409 8.38672C6.16023 8.38672 6.38409 8.16286 6.38409 7.88672C6.38409 7.61058 6.16023 7.38672 5.88409 7.38672V8.38672ZM3.375 11.1836C3.09886 11.1836 2.875 11.4075 2.875 11.6836C2.875 11.9597 3.09886 12.1836 3.375 12.1836V11.1836ZM5.88409 12.1836C6.16023 12.1836 6.38409 11.9597 6.38409 11.6836C6.38409 11.4075 6.16023 11.1836 5.88409 11.1836V12.1836ZM3.375 15.6133C3.09886 15.6133 2.875 15.8371 2.875 16.1133C2.875 16.3894 3.09886 16.6133 3.375 16.6133V15.6133ZM5.88409 16.6133C6.16023 16.6133 6.38409 16.3894 6.38409 16.1133C6.38409 15.8371 6.16023 15.6133 5.88409 15.6133V16.6133ZM8.52059 16.4182C8.51422 16.6942 8.73286 16.9232 9.00893 16.9296C9.285 16.9359 9.51396 16.7173 9.52032 16.4412L8.52059 16.4182ZM9.19302 14.8261L8.70612 14.7124C8.70434 14.72 8.70274 14.7277 8.70132 14.7354L9.19302 14.8261ZM11.2762 13.3887L11.4404 13.8611L11.4499 13.8576L11.2762 13.3887ZM12.3195 13.1013C12.4035 12.8382 12.2583 12.5569 11.9953 12.4729C11.7322 12.3889 11.4509 12.5341 11.3669 12.7971L12.3195 13.1013ZM15.7342 16.4412C15.7406 16.7173 15.9695 16.9359 16.2456 16.9296C16.5217 16.9232 16.7403 16.6942 16.734 16.4182L15.7342 16.4412ZM16.0615 14.8261L16.5532 14.7354C16.5518 14.7277 16.5502 14.72 16.5484 14.7124L16.0615 14.8261ZM13.9784 13.3887L13.8046 13.8577L13.8142 13.861L13.9784 13.3887ZM13.8877 12.7971C13.8037 12.5341 13.5223 12.3889 13.2593 12.4729C12.9962 12.5569 12.8511 12.8382 12.9351 13.1013L13.8877 12.7971ZM10.9023 10.418L11.4023 10.418V10.418H10.9023ZM11.2309 8.60993L11.6861 8.81678L11.6861 8.81678L11.2309 8.60993ZM12.0518 12.7684L11.7218 13.1441L11.7682 13.1848L11.823 13.213L12.0518 12.7684ZM13.202 12.7684L13.4308 13.213L13.4787 13.1884L13.5203 13.1541L13.202 12.7684ZM3.375 8.38672H5.88409V7.38672H3.375V8.38672ZM3.375 12.1836H5.88409V11.1836H3.375V12.1836ZM3.375 16.6133H5.88409V15.6133H3.375V16.6133ZM6.41058 2.375H18.844V1.375H6.41058V2.375ZM18.844 2.375C19.4866 2.375 20.125 2.99614 20.125 3.9225H21.125C21.125 2.57636 20.1627 1.375 18.844 1.375V2.375ZM20.125 3.9225V20.0775H21.125V3.9225H20.125ZM20.125 20.0775C20.125 20.9945 19.485 21.625 18.844 21.625V22.625C20.1643 22.625 21.125 21.4105 21.125 20.0775H20.125ZM18.844 21.625H6.41058V22.625H18.844V21.625ZM6.41058 21.625C5.76792 21.625 5.12955 21.0039 5.12955 20.0775H4.12955C4.12955 21.4236 5.09185 22.625 6.41058 22.625V21.625ZM5.12955 20.0775V3.9225H4.12955V20.0775H5.12955ZM5.12955 3.9225C5.12955 3.0055 5.76956 2.375 6.41058 2.375V1.375C5.0902 1.375 4.12955 2.5895 4.12955 3.9225H5.12955ZM9.52032 16.4412C9.53194 15.9373 9.59014 15.4295 9.68473 14.9168L8.70132 14.7354C8.59869 15.2917 8.53362 15.853 8.52059 16.4182L9.52032 16.4412ZM9.67993 14.9397C9.69157 14.8899 9.78099 14.7261 10.1128 14.496C10.4223 14.2813 10.8711 14.0589 11.4404 13.861L11.112 12.9165C10.4856 13.1343 9.94827 13.3931 9.54284 13.6743C9.15974 13.94 8.80542 14.2871 8.70612 14.7124L9.67993 14.9397ZM11.4499 13.8576C11.5852 13.8074 11.7547 13.7102 11.8933 13.6105C11.9656 13.5584 12.0441 13.4954 12.1133 13.4247C12.1723 13.3646 12.2709 13.2534 12.3195 13.1013L11.3669 12.7971C11.3809 12.7532 11.3985 12.7277 11.4022 12.7225C11.407 12.7157 11.4073 12.7164 11.3993 12.7246C11.3827 12.7416 11.3525 12.7676 11.3092 12.7988C11.2674 12.8288 11.222 12.8575 11.1805 12.8808C11.1363 12.9057 11.1089 12.9175 11.1024 12.9199L11.4499 13.8576ZM16.734 16.4182C16.7209 15.853 16.6559 15.2917 16.5532 14.7354L15.5698 14.9168C15.6644 15.4295 15.7226 15.9373 15.7342 16.4412L16.734 16.4182ZM16.5484 14.7124C16.4491 14.2871 16.0948 13.94 15.7117 13.6743C15.3063 13.3931 14.769 13.1343 14.1426 12.9165L13.8142 13.861C14.3834 14.0589 14.8322 14.2813 15.1417 14.496C15.4736 14.7261 15.563 14.8899 15.5746 14.9397L16.5484 14.7124ZM14.1521 12.9199C14.1456 12.9175 14.1183 12.9057 14.074 12.8808C14.0325 12.8575 13.9871 12.8288 13.9453 12.7988C13.9021 12.7676 13.8719 12.7416 13.8552 12.7246C13.8472 12.7164 13.8476 12.7157 13.8524 12.7225C13.856 12.7277 13.8736 12.7532 13.8877 12.7971L12.9351 13.1013C12.9836 13.2534 13.0823 13.3646 13.1412 13.4247C13.2105 13.4954 13.2889 13.5584 13.3612 13.6105C13.4999 13.7102 13.6694 13.8074 13.8046 13.8576L14.1521 12.9199ZM11.4023 10.418C11.4023 9.83385 11.4811 9.26803 11.6861 8.81678L10.7757 8.40309C10.4878 9.03666 10.4023 9.76284 10.4023 10.418H11.4023ZM11.6861 8.81678C11.8053 8.55448 12.0796 8.38672 12.5813 8.38672V7.38672C11.8704 7.38672 11.1213 7.6426 10.7757 8.40309L11.6861 8.81678ZM12.5813 8.38672C13.087 8.38672 13.4614 8.60522 13.5777 8.83539L14.4703 8.38448C14.1169 7.685 13.2884 7.38672 12.5813 7.38672V8.38672ZM13.5777 8.83539C13.7606 9.19738 13.8523 9.72518 13.8523 10.418H14.8523C14.8523 9.66433 14.757 8.95213 14.4703 8.38448L13.5777 8.83539ZM12.5813 12.4492C12.5364 12.4492 12.5158 12.4464 12.5087 12.4451C12.5046 12.4444 12.5042 12.4442 12.5008 12.4428C12.4922 12.4391 12.4782 12.4321 12.438 12.4096C12.4018 12.3893 12.3471 12.358 12.2805 12.3238L11.823 13.213C11.8698 13.2371 11.9055 13.2576 11.9494 13.2821C11.9893 13.3045 12.0449 13.3354 12.1079 13.3623C12.2569 13.426 12.403 13.4492 12.5813 13.4492V12.4492ZM12.3817 12.3927C11.8273 11.9058 11.4022 11.3083 11.4023 10.418L10.4023 10.4179C10.4022 11.6973 11.0412 12.5462 11.7218 13.1441L12.3817 12.3927ZM13.8523 10.418C13.8523 11.3319 13.4575 11.9093 12.8838 12.3828L13.5203 13.1541C14.2611 12.5427 14.8523 11.7035 14.8523 10.418H13.8523ZM12.9733 12.3238C12.7638 12.4316 12.717 12.4492 12.5813 12.4492V13.4492C12.9639 13.4492 13.1869 13.3385 13.4308 13.213L12.9733 12.3238Z",fill:"#3D3D3D"})),It=e=>G.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},G.createElement("path",{d:"M12.002 21L11.8275 21.4686C11.981 21.5257 12.1528 21.5041 12.2873 21.4106C12.4218 21.3172 12.502 21.1638 12.502 21H12.002ZM3.89502 17.9823H3.39502C3.39502 18.1912 3.52485 18.378 3.72059 18.4509L3.89502 17.9823ZM3.89502 8.06421L4.07193 7.59655C3.91831 7.53844 3.74595 7.55948 3.61082 7.65284C3.47568 7.74619 3.39502 7.89997 3.39502 8.06421H3.89502ZM12.0007 21H11.5007C11.5007 21.1638 11.5809 21.3172 11.7154 21.4106C11.8499 21.5041 12.0216 21.5257 12.1751 21.4686L12.0007 21ZM20.1076 17.9823L20.282 18.4509C20.4778 18.378 20.6076 18.1912 20.6076 17.9823H20.1076ZM20.1076 8.06421H20.6076C20.6076 7.89997 20.527 7.74619 20.3918 7.65284C20.2567 7.55948 20.0843 7.53844 19.9307 7.59655L20.1076 8.06421ZM12.0007 11.1311L11.8238 10.6634C11.6293 10.737 11.5007 10.9232 11.5007 11.1311H12.0007ZM20.2858 8.53191C20.5441 8.43421 20.6743 8.14562 20.5766 7.88734C20.4789 7.62906 20.1903 7.49889 19.932 7.5966L20.2858 8.53191ZM12.002 4.94826L12.1775 4.48008C12.0605 4.43623 11.9314 4.43775 11.8154 4.48436L12.002 4.94826ZM5.87955 6.87106C5.62334 6.97407 5.49915 7.26528 5.60217 7.52149C5.70518 7.77769 5.99639 7.90188 6.2526 7.79887L5.87955 6.87106ZM18.1932 7.80315C18.4518 7.90008 18.74 7.76904 18.8369 7.51047C18.9338 7.2519 18.8028 6.96371 18.5442 6.86678L18.1932 7.80315ZM12 4.94827L11.5879 5.23148C11.6812 5.36719 11.8353 5.44827 12 5.44827C12.1647 5.44827 12.3188 5.36719 12.4121 5.23148L12 4.94827ZM14.0263 2L14.2028 1.53218C13.9875 1.45097 13.7446 1.52717 13.6143 1.71679L14.0263 2ZM21.8421 4.94827L22.2673 5.2113C22.3459 5.08422 22.3636 4.92863 22.3154 4.78717C22.2673 4.64571 22.1584 4.53319 22.0186 4.48045L21.8421 4.94827ZM9.97368 2L10.3857 1.71679C10.2554 1.52717 10.0125 1.45097 9.79721 1.53218L9.97368 2ZM2.15789 4.94827L1.98142 4.48045C1.84161 4.53319 1.73271 4.64571 1.68456 4.78717C1.63641 4.92863 1.65406 5.08422 1.73267 5.2113L2.15789 4.94827ZM12 11.1256L11.6702 11.5014C11.8589 11.667 12.1411 11.667 12.3298 11.5014L12 11.1256ZM15.0395 8.45812L14.8732 7.98659C14.8131 8.00779 14.7576 8.04028 14.7097 8.08232L15.0395 8.45812ZM23 5.65024L23.3288 6.0269C23.5095 5.86916 23.5527 5.60532 23.4318 5.39817C23.3109 5.19102 23.0599 5.09893 22.8337 5.17871L23 5.65024ZM8.96053 8.45812L9.29034 8.08232C9.24244 8.04028 9.18695 8.00779 9.12685 7.98659L8.96053 8.45812ZM1 5.65024L1.16632 5.17871C0.940115 5.09893 0.689119 5.19102 0.568192 5.39817C0.447264 5.60532 0.49048 5.86916 0.671176 6.0269L1 5.65024ZM12.1764 20.5314L4.06945 17.5137L3.72059 18.4509L11.8275 21.4686L12.1764 20.5314ZM4.39502 17.9823V8.06421H3.39502V17.9823H4.39502ZM3.71811 8.53187L11.8251 11.5987L12.1789 10.6634L4.07193 7.59655L3.71811 8.53187ZM11.502 11.1311V21H12.502V11.1311H11.502ZM12.1751 21.4686L20.282 18.4509L19.9332 17.5137L11.8262 20.5314L12.1751 21.4686ZM20.6076 17.9823V8.06421H19.6076V17.9823H20.6076ZM19.9307 7.59655L11.8238 10.6634L12.1776 11.5987L20.2845 8.53187L19.9307 7.59655ZM11.5007 11.1311V21H12.5007V11.1311H11.5007ZM19.932 7.5966L11.8251 10.6634L12.1789 11.5987L20.2858 8.53191L19.932 7.5966ZM11.8154 4.48436L5.87955 6.87106L6.2526 7.79887L12.1885 5.41217L11.8154 4.48436ZM11.8265 5.41645L18.1932 7.80315L18.5442 6.86678L12.1775 4.48008L11.8265 5.41645ZM11.502 4.94826V11.1311H12.502V4.94826H11.502ZM12.4121 5.23148L14.4384 2.28321L13.6143 1.71679L11.5879 4.66507L12.4121 5.23148ZM13.8498 2.46782L21.6656 5.4161L22.0186 4.48045L14.2028 1.53218L13.8498 2.46782ZM21.4169 4.68525L20.5485 6.08919L21.3989 6.61524L22.2673 5.2113L21.4169 4.68525ZM12.4121 4.66507L10.3857 1.71679L9.56162 2.28321L11.5879 5.23148L12.4121 4.66507ZM9.79721 1.53218L1.98142 4.48045L2.33437 5.4161L10.1502 2.46782L9.79721 1.53218ZM1.73267 5.2113L2.60109 6.61524L3.45154 6.08919L2.58312 4.68525L1.73267 5.2113ZM12.3298 11.5014L15.3693 8.83392L14.7097 8.08232L11.6702 10.7498L12.3298 11.5014ZM15.2058 8.92965L23.1663 6.12177L22.8337 5.17871L14.8732 7.98659L15.2058 8.92965ZM22.6712 5.27358L19.7764 7.80067L20.4341 8.554L23.3288 6.0269L22.6712 5.27358ZM12.3298 10.7498L9.29034 8.08232L8.63072 8.83392L11.6702 11.5014L12.3298 10.7498ZM9.12685 7.98659L1.16632 5.17871L0.83368 6.12177L8.79421 8.92965L9.12685 7.98659ZM0.671176 6.0269L3.56591 8.554L4.22356 7.80067L1.32882 5.27358L0.671176 6.0269Z",fill:"#D6D6D6"})),Fe=({selectable:e,className:s,addNewAddress:n,minifiedView:r,routeAddressesPage:o})=>{const d=r?"minifiedView":"fullSizeView",c=ne({viewAllAddressesButton:`Account.${d}.Addresses.viewAllAddressesButton`,addNewAddressButton:`Account.${d}.Addresses.addNewAddressButton`,differentAddressButton:`Account.${d}.Addresses.differentAddressButton`}),l=e?"span":"button",i=e?{}:{AriaRole:"button",type:"button"},u=r&&!n?c.viewAllAddressesButton:c.addNewAddressButton,p=e?c.differentAddressButton:u;return j(l,{...i,className:X(["account-actions-address",["account-actions-address--viewall",r],["account-actions-address--address",!r],["account-actions-address--selectable",e],s]),"data-testid":"showRouteFullAddress",onClick:o,children:[a("span",{className:"account-actions-address__title","data-testid":"addressActionsText",children:p}),a(Se,{source:r&&!n?$t:Zt,size:"32"})]})},Ot=({minifiedView:e,keysSortOrder:s,addressData:n,open:r,submitLoading:o,onRemoveAddress:d,closeModal:c})=>{const l=e?"minifiedView":"fullSizeView",i=ne({title:`Account.${l}.Addresses.removeAddressModal.title`,description:`Account.${l}.Addresses.removeAddressModal.description`,actionCancel:`Account.${l}.Addresses.removeAddressModal.actionCancel`,actionConfirm:`Account.${l}.Addresses.removeAddressModal.actionConfirm`});return r?j(Ge,{title:a("h3",{children:i.title}),className:"account-address-modal",size:"full","data-testid":"addressModal",showCloseButton:!0,onClose:c,children:[o?a("div",{className:"account-address-modal__spinner","data-testid":"progressSpinner",children:a(Ke,{stroke:"4",size:"large"})}):null,a("p",{children:i.description}),a(Me,{minifiedView:e,addressData:n,keysSortOrder:s}),j("div",{className:"account-address-modal__buttons",children:[a(oe,{type:"button",onClick:c,variant:"secondary",disabled:o,children:i.actionCancel}),a(oe,{disabled:o,onClick:d,children:i.actionConfirm})]})]}):null},wt=({typeList:e,isEmpty:s,minifiedView:n,className:r})=>{const o=n?"minifiedView":"fullSizeView",d=ne({addressesMessage:`Account.${o}.EmptyList.Addresses.message`,ordersListMessage:`Account.${o}.EmptyList.OrdersList.message`}),c=be(()=>{switch(e){case"address":return{icon:Ft,text:a("p",{children:d.addressesMessage})};case"orders":return{icon:It,text:a("p",{children:d.ordersListMessage})};default:return{icon:"",text:""}}},[e,d]);return!s||!e||!c.text?null:a(Je,{className:X(["account-empty-list",n?"account-empty-list--minified":"",r]),message:c.text,icon:a(Se,{source:c.icon}),"data-testid":"emptyList"})},xt=async(e,s)=>{if(s.length===1){const c=s[0],i=Object.values(c.region).every(p=>!!p)?{}:{region:{...c.region,regionId:0}};return!!await Ce({addressId:Number(c==null?void 0:c.id),defaultShipping:!1,defaultBilling:!1,...i})}const n=s.filter(c=>c.id!==e&&(c.defaultBilling||c.defaultShipping)||c.id!==e),r=s[s.length-1],o=n[0]||((r==null?void 0:r.id)!==e?r:null);return!o||!o.id?!1:!!await Ce({addressId:+o.id,defaultShipping:!0,defaultBilling:!0})},St=["firstname","lastname","city","company","country_code","region","region_code","region_id","telephone","id","vat_id","postcode","street","street_multiline_2","default_shipping","default_billing"],r1=["email","firstname","lastname","middlename","gender","dob","date_of_birth","prefix","suffix"],ke=(e,s,n)=>{if(s&&n||!s&&!n)return e;const r=e.slice();return s?r.sort((o,d)=>Number(d.defaultShipping)-Number(o.defaultShipping)):n?r.sort((o,d)=>Number(d.defaultBilling)-Number(o.defaultBilling)):e},ve=e=>e==null?!0:typeof e!="object"?!1:Object.keys(e).length===0||Object.values(e).every(ve),Rt=({selectShipping:e,selectBilling:s,defaultSelectAddressId:n,onAddressData:r,minifiedView:o,routeAddressesPage:d,onSuccess:c})=>{const[l,i]=N(""),[u,p]=N(!1),[C,g]=N(!1),[I,L]=N(!1),[w,t]=N(!1),[A,f]=N(!1),[_,T]=N(""),[Z,z]=N([]),[x,V]=N([]),b=k(async()=>{L(!0),Promise.all([He("shortRequest"),tt()]).then(h=>{const[$,U]=h;if($){const S=$.map(({name:B,orderNumber:te,label:re})=>({name:rt(B),orderNumber:te,label:St.includes(B)?null:re}));V(S)}if(U)if(o){const S=U.filter(B=>!!B.defaultShipping||!!B.defaultBilling);z(S)}else z(U)}).finally(()=>{L(!1)})},[o]);ee(()=>{b()},[b]),ee(()=>{var h;if(Z.length)if(n===0)f(!0),i("0");else{const $=Z.find(S=>+S.id===n)||ke(Z,e,s)[0],U={data:ae($),isDataValid:!ve($)};i(n.toString()||((h=$==null?void 0:$.id)==null?void 0:h.toString())),r==null||r(U)}},[Z,n,r,s,e]);const H=k(h=>{T(h),f(!1)},[]),q=k((h,$)=>{const U=(h==null?void 0:h.target).value;i(U);const S={data:ae($),isDataValid:!ve(ae($))};r==null||r(S),U!=="0"&&f(!1)},[r]),P=k(()=>{g(!0)},[]),K=k(()=>{T(""),g(!1),p(!1)},[]),m=k(()=>{p(!0)},[]),v=k(async()=>{t(!0),await xt(_,Z),st(+_).then(()=>{b(),K()}).finally(()=>{t(!1)})},[Z,_,K,b]),y=k(()=>{f(!1)},[]),M=k(()=>{ze(d)&&o&&!A?window.location.href=d():(f(!0),T(""))},[A,d,o]),O=k(async()=>{await b(),await(c==null?void 0:c())},[b,c]);return{keysSortOrder:x,submitLoading:w,isModalRendered:u,isFormRendered:C,loading:I,addNewAddress:A,addressesList:Z,addressId:_,handleRenderForm:P,handleRenderModal:m,removeAddress:v,onCloseBtnClick:K,setEditingAddressId:H,closeNewAddressForm:y,redirectToAddressesRoute:M,handleOnSuccess:O,handleSelectAddressOption:q,selectedAddressOption:l}},s1=Ee(({hideActionFormButtons:e=!1,formName:s,slots:n,title:r="",addressFormTitle:o="",defaultSelectAddressId:d="",showFormLoader:c=!1,onAddressData:l,forwardFormRef:i,className:u,showSaveCheckBox:p=!1,saveCheckBoxValue:C=!1,selectShipping:g=!1,selectBilling:I=!1,selectable:L=!1,withHeader:w=!0,minifiedView:t=!1,withActionsInMinifiedView:A=!1,withActionsInFullSizeView:f=!0,inputsDefaultValueSet:_,showShippingCheckBox:T=!0,showBillingCheckBox:Z=!0,shippingCheckBoxValue:z=!0,billingCheckBoxValue:x=!0,routeAddressesPage:V,onSuccess:b,onError:H})=>{var J;const q=t?"minifiedView":"fullSizeView",P=ne({containerTitle:`Account.${q}.Addresses.containerTitle`,differentAddressFormTitle:`Account.${q}.Addresses.differentAddressFormTitle`,editAddressFormTitle:`Account.${q}.Addresses.editAddressFormTitle`,viewAllAddressesButton:`Account.${q}.Addresses.viewAllAddressesButton`,newAddressFormTitle:`Account.${q}.Addresses.newAddressFormTitle`}),{keysSortOrder:K,submitLoading:m,isModalRendered:v,isFormRendered:y,loading:M,addNewAddress:O,addressesList:h,addressId:$,handleRenderForm:U,handleRenderModal:S,removeAddress:B,onCloseBtnClick:te,handleOnSuccess:re,setEditingAddressId:Le,closeNewAddressForm:de,redirectToAddressesRoute:ce,handleSelectAddressOption:ie,selectedAddressOption:ue}=Rt({defaultSelectAddressId:d,minifiedView:t,routeAddressesPage:V,onSuccess:b,onAddressData:l,selectShipping:g,selectBilling:I}),R=s??(g&&I?"selectedAddress":g?"selectedShippingAddress":I?"selectedBillingAddress":"default"),W=L?j("div",{className:"account-addresses-wrapper--select-view",children:[(J=ke(h,g,I))==null?void 0:J.map((E,Y)=>j(Ne,{children:[a("input",{"data-testid":`radio-${Y+1}`,type:"radio",name:R,id:`${R}_${E.id}`,value:E.id,checked:ue===(E==null?void 0:E.id.toString()),onChange:ge=>ie(ge,E)}),a("label",{htmlFor:`${R}_${E.id}`,className:"account-addresses-wrapper__label",children:a(Me,{slots:n,selectable:L,selectShipping:g,selectBilling:I,minifiedView:t,addressData:E,keysSortOrder:K,loading:M})})]},E.id)),a("input",{"data-testid":"radio-0",type:"radio",name:R,id:`${R}_addressActions`,value:"0",checked:ue==="0",onChange:E=>ie(E,{})}),a("label",{htmlFor:`${R}_addressActions`,className:"account-addresses-wrapper__label",children:O?a("div",{className:X(["account-addresses-form__footer__wrapper",["account-addresses-form__footer__wrapper-show",O]]),children:a(fe,{slots:n,hideActionFormButtons:e,formName:R,showFormLoader:c,isOpen:O,forwardFormRef:i,showSaveCheckBox:p,saveCheckBoxValue:C,shippingCheckBoxValue:z,billingCheckBoxValue:x,addressesFormTitle:o||P.differentAddressFormTitle,inputsDefaultValueSet:_,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:de,onSuccess:re,onError:H,onChange:l})}):h!=null&&h.length?a(Fe,{selectable:L,minifiedView:t,addNewAddress:O,routeAddressesPage:ce}):null})]}):j(Q,{children:[h.map(E=>a(Ne,{children:$===E.id&&y?a(he,{variant:"secondary",style:{marginBottom:20},children:a(fe,{slots:n,isOpen:$===E.id&&y,addressFormId:$,inputsDefaultValueSet:E,addressesFormTitle:P.editAddressFormTitle,showShippingCheckBox:T,showBillingCheckBox:Z,shippingCheckBoxValue:z,billingCheckBoxValue:x,onCloseBtnClick:te,onSuccess:re,onError:H})}):a(Me,{slots:n,minifiedView:t,addressData:E,keysSortOrder:K,loading:M,setAddressId:Le,handleRenderModal:t&&A||!t&&f?S:void 0,handleRenderForm:t&&A||!t&&f?U:void 0},E.id)},E.id)),a("div",{className:"account-addresses__footer",children:O?a(he,{variant:"secondary",children:a(fe,{slots:n,isOpen:O,addressesFormTitle:P.newAddressFormTitle,inputsDefaultValueSet:_,showShippingCheckBox:!!(h!=null&&h.length),showBillingCheckBox:!!(h!=null&&h.length),shippingCheckBoxValue:z,billingCheckBoxValue:x,onCloseBtnClick:de,onSuccess:re,onError:H})}):a(Fe,{minifiedView:t,addNewAddress:O,routeAddressesPage:ce})})]});return j("div",{children:[a("div",{children:w?a(Xe,{title:r||P.containerTitle,divider:!t,className:t?"account-addresses-header":""}):null}),j("div",{className:X(["account-addresses-wrapper",u]),"data-testid":"addressesIdWrapper",children:[a(Ot,{minifiedView:t,addressData:h==null?void 0:h.find(E=>E.id===$),keysSortOrder:K,submitLoading:m,open:v,closeModal:te,onRemoveAddress:B}),M?a(Ue,{testId:"addressSkeletonLoader",withCard:!1}):L?a(fe,{slots:n,hideActionFormButtons:e,formName:R,isOpen:!(h!=null&&h.length),forwardFormRef:i,showSaveCheckBox:p,saveCheckBoxValue:C,shippingCheckBoxValue:z,billingCheckBoxValue:x,inputsDefaultValueSet:_,showShippingCheckBox:T,showBillingCheckBox:Z,onCloseBtnClick:de,onSuccess:re,onError:H,onChange:l}):a(wt,{isEmpty:!(h!=null&&h.length),typeList:"address",minifiedView:t}),W]})]})}),qe={entityType:"CUSTOMER_ADDRESS",isUnique:!1,options:[],multilineCount:0,validateRules:[],defaultValue:!1,fieldType:se.BOOLEAN,className:"",required:!1,orderNumber:90,isHidden:!1},Vt={...qe,label:"Set as default shipping address",name:"default_shipping",id:"default_shipping",code:"default_shipping",customUpperCode:"defaultShipping"},Ht={...qe,label:"Set as default billing address",name:"default_billing",id:"default_billing",code:"default_billing",customUpperCode:"defaultBilling"},Bt=(e,s)=>s==null?void 0:s.map(n=>{const r={...e,firstName:e.firstname??e.firstName,lastName:e.lastname??e.lastName},o=JSON.parse(JSON.stringify(n));if(Object.hasOwn(r,n.customUpperCode)){const d=r[n.customUpperCode];n.customUpperCode==="region"&&typeof d=="object"?o.defaultValue=d.regionCode&&d.regionId?`${d.regionCode},${d.regionId}`:d.region??d.regionCode:o.defaultValue=d}return o}),Ie=e=>{if(!e)return null;const s=new FormData(e);if(e.querySelectorAll('input[type="checkbox"]').forEach(r=>{s.has(r.name)||s.set(r.name,"false"),r.checked&&s.set(r.name,"true")}),s&&typeof s.entries=="function"){const r=s.entries();if(r&&typeof r[Symbol.iterator]=="function")return JSON.parse(JSON.stringify(Object.fromEntries(r)))||{}}return{}},zt=({fields:e,addressId:s,countryOptions:n,disableField:r,regionOptions:o,isRequiredRegion:d,isRequiredPostCode:c})=>e.filter(i=>!(s&&(i.customUpperCode==="defaultShipping"||i.customUpperCode==="defaultBilling")&&i.defaultValue)).map(i=>i.customUpperCode==="countryCode"?{...i,options:n,disabled:r}:i.customUpperCode==="postcode"?{...i,required:c}:i.customUpperCode==="region"?{...i,options:o,required:d,disabled:r}:i),Ut=(e,s="address")=>{const n=s==="address"?["region","city","company","countryCode","countryId","defaultBilling","defaultShipping","fax","firstName","lastName","middleName","postcode","prefix","street","suffix","telephone","vatId","addressId"]:["email","firstName","lastName","middleName","gender","dob","dateOfBirth","prefix","suffix"],r={},o=[];return Object.keys(e).forEach(d=>{n.includes(d)?r[d]=e[d]:o.push({attribute_code:Ve(d),value:e[d]})}),o.length>0&&(r.custom_attributesV2=o),r},Oe=e=>{const s=["street","streetMultiline_1","streetMultiline_2"],n=["on","off","true","false"],r=[],o={};for(const L in e){const w=e[L];n.includes(w)&&(o[L]=Be(w)),s.includes(L)&&r.push(w)}const{street:d,streetMultiline_2:c,streetMultiline_1:l,region:i,...u}=e,[p,C]=i?i.split(","):[void 0,void 0],g=C&&p?{regionId:+C,regionCode:p}:{region:p};return Ut({...u,...o,region:{...g},street:r})},kt=(e,s)=>{const n={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const o=e[r];if(r==="region"&&o.regionId){const d=s.find(c=>(c==null?void 0:c.id)===o.regionId);d?n[r]={...o,text:d.text}:n[r]=o}else Array.isArray(o)?(n[r]=o[0]||"",o.slice(1).forEach((d,c)=>{n[`${r}Multiline_${c+2}`]=d})):n[r]=o}return n},qt=(e,s)=>e&&Object.keys(e).length>0?e:s&&Object.keys(s).length>0?s:{},Pt=({showFormLoader:e,showSaveCheckBox:s,saveCheckBoxValue:n,addressFormId:r,billingCheckBoxValue:o,shippingCheckBoxValue:d,showShippingCheckBox:c,showBillingCheckBox:l,inputsDefaultValueSet:i,onCloseBtnClick:u,onSuccess:p,onError:C,formName:g})=>{const[I,L]=N({text:"",type:"success"}),[w,t]=N(e??!1),[A,f]=N(r||""),[_,T]=N([]),[Z,z]=N([]),[x,V]=N([]),[b,H]=N([]),[q,P]=N([]),[K,m]=N(!1),[v,y]=N(!1),[M,O]=N(()=>{var R,W;const F=sessionStorage.getItem(`${g}_addressData`);return F?{countryCode:(W=(R=JSON.parse(F))==null?void 0:R.data)==null?void 0:W.countryCode}:i}),[h,$]=N(!1),[U,S]=N(!1),[B,te]=N(()=>{var W,J;const F=sessionStorage.getItem(`${g}_addressData`);return F?(J=(W=JSON.parse(F))==null?void 0:W.data)==null?void 0:J.saveAddressBook:n}),re=k(F=>{te(F.target.checked)},[]);ee(()=>{typeof e>"u"||t(e)},[e]),ee(()=>{He(A?"customer_address_edit":"customer_register_address").then(F=>{T(F)})},[A]),ee(()=>{$(!0),nt().then(({availableCountries:F,countriesWithRequiredRegion:R,optionalZipCountries:W})=>{z(F),H(R),P(W),$(!1)})},[]),ee(()=>{if(M!=null&&M.countryCode){$(!0),S(!0);const F=M==null?void 0:M.countryCode;at(F).then(R=>{V(R);const W=b.find(E=>E===F),J=q.find(E=>E===F);m(!!W),y(!J),$(!1),S(!1)})}},[M==null?void 0:M.countryCode,b,q]);const Le=k(()=>{L({text:"",type:"success"}),u==null||u()},[u]),de=k(async(F,R)=>{if(!R)return null;t(!0);const W=Ie(F.target),J=Oe(W);await Ce(J).then(()=>{var E;p==null||p(),u==null||u(),(E=F==null?void 0:F.target)==null||E.reset()}).catch(E=>{L(Y=>({...Y,text:E.message,type:"error"})),C==null||C(E)}).finally(()=>{f(""),t(!1)})},[u,C,p]),ce=k(async(F,R)=>{if(!R)return;t(!0);const{saveAddressBook:W,...J}=Ie(F.target),E=Oe(J);await ot(E).then(()=>{var Y;p==null||p(),u==null||u(),(Y=F==null?void 0:F.target)==null||Y.reset()}).catch(Y=>{L(ge=>({...ge,text:Y.message,type:"error"})),C==null||C(Y)}).finally(()=>{f(""),t(!1)})},[u,C,p]),ie=et(()=>{if(!_.length)return[];const F={...Vt,defaultValue:d,isHidden:s&&!B?!0:!c},R={...Ht,defaultValue:o,isHidden:s&&!B?!0:!l},W=[..._,F,R],J=sessionStorage.getItem(`${g}_addressData`),E=J?kt(JSON.parse(J).data,x):{},Y=Bt(qt(E,i),W);return zt({fields:Y,addressId:A,countryOptions:Z,disableField:h,regionOptions:x,isRequiredRegion:K,isRequiredPostCode:v})},[_,d,s,B,c,o,l,g,x,i,A,Z,h,K,v]),ue=k(F=>{O(R=>({...R,...F}))},[]);return{isWaitingForResponse:U,regionOptions:x,saveCheckBoxAddress:B,inLineAlert:I,addressId:A,submitLoading:w,normalizeFieldsConfig:ie,handleSaveCheckBoxAddress:re,handleUpdateAddress:de,handleCreateAddress:ce,handleOnCloseForm:Le,handleInputChange:ue}},jt=e=>{var o;if(!e)return{};if(e&&!Array.isArray(e.customAttributes))return e;const s={};(o=e==null?void 0:e.customAttributes)==null||o.forEach(d=>{d.code&&Object.prototype.hasOwnProperty.call(d,"value")&&(s[d.code]=d.value)});const{customAttributes:n,...r}=e;return{...r,...Re(s,"camelCase",{})}},Wt=({hideActionFormButtons:e,formName:s="",showFormLoader:n=!1,showSaveCheckBox:r=!1,saveCheckBoxValue:o=!1,forwardFormRef:d,slots:c,addressesFormTitle:l,className:i,addressFormId:u,inputsDefaultValueSet:p,showShippingCheckBox:C=!0,showBillingCheckBox:g=!0,shippingCheckBoxValue:I=!0,billingCheckBoxValue:L=!0,isOpen:w,onSubmit:t,onCloseBtnClick:A,onSuccess:f,onError:_,onChange:T})=>{const Z=ne({secondaryButton:"Account.AddressForm.formText.secondaryButton",primaryButton:"Account.AddressForm.formText.primaryButton",saveAddressBook:"Account.AddressForm.formText.saveAddressBook"}),{isWaitingForResponse:z,inLineAlert:x,addressId:V,submitLoading:b,normalizeFieldsConfig:H,handleUpdateAddress:q,handleCreateAddress:P,handleOnCloseForm:K,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,handleInputChange:y,regionOptions:M}=Pt({showFormLoader:n,addressFormId:u,inputsDefaultValueSet:jt(p),shippingCheckBoxValue:I,billingCheckBoxValue:L,showShippingCheckBox:C,showBillingCheckBox:g,saveCheckBoxValue:o,showSaveCheckBox:r,onSuccess:f,onError:_,onCloseBtnClick:A,formName:s});return w?j("div",{className:X(["account-address-form-wrapper",i]),children:[l?a("div",{className:"account-address-form-wrapper__title","data-testid":"addressesFormTitle",children:l}):null,x.text?a(Ye,{"data-testid":"inLineAlert",className:"account-address-form-wrapper__notification",type:x.type,variant:"secondary",heading:x.text,icon:x.icon}):null,j(Tt,{regionOptions:M,forwardFormRef:d,slots:c,className:"account-address-form",name:s||"addressesForm",fieldsConfig:H,onSubmit:t||(V?q:P),setInputChange:y,loading:b,showFormLoader:n,showSaveCheckBox:r,handleSaveCheckBoxAddress:m,saveCheckBoxAddress:v,onChange:T,isWaitingForResponse:z,children:[V?a("input",{type:"hidden",name:"addressId",value:V,"data-testid":"hidden_test_id"}):null,e?null:a("div",{className:X(["dropin-field account-address-form-wrapper__buttons",["account-address-form-wrapper__buttons--empty",r]]),children:c!=null&&c.AddressFormActions?a(Ae,{"data-testid":"addressFormActions",name:"AddressFormActions",slot:c.AddressFormActions,context:{handleUpdateAddress:q,handleCreateAddress:P,addressId:V}}):a(Q,{children:r?null:j(Q,{children:[a(oe,{type:"button",onClick:K,variant:"secondary",disabled:b,children:Z.secondaryButton}),a(oe,{disabled:b,children:Z.primaryButton})]})})})]})]}):null};export{fe as A,Ue as C,wt as E,Tt as F,$t as S,s1 as a,ze as c,r1 as d,Ie as g,Ut as n}; diff --git a/scripts/__dropins__/storefront-account/reload b/scripts/__dropins__/storefront-account/reload index bb19d61b6..391db9d6c 100644 --- a/scripts/__dropins__/storefront-account/reload +++ b/scripts/__dropins__/storefront-account/reload @@ -1 +1 @@ -{"at":1732522494897} \ No newline at end of file +{"at":1732522779616} \ No newline at end of file