import{a as z,g as P,i as x,aH as A,H as j,j as d,_ as v,f as _,bG as g,ba as F}from"./main-634.js";import{F as c}from"./bf-767-388.js";import{S as E}from"./bf-982-242.js";import"./bf-25-81.js";import"./bf-497-246.js";import"./bf-641-107.js";import"./bf-400-72.js";import"./bf-438-114.js";const H=[{value:"international",label:"International"},{value:"us",label:"United States"},{value:"ca",label:"Canada"},{value:"uk",label:"United Kingdom"},{value:"au",label:"Australia"},{value:"custom",label:"Custom"}],N={international:{activeFields:["address_1","address_2","city","state","zip","country"],labels:{state:"State / Province / Region",zip:"Zip / Postal code"}},us:{activeFields:["address_1","address_2","city","state","zip","country"],labels:{state:"State",zip:"ZIP Code"}},ca:{activeFields:["address_1","address_2","city","state","zip","country"],labels:{state:"Province",zip:"Postal Code"}},uk:{activeFields:["address_1","address_2","city","zip","country"],labels:{zip:"Postcode"}},au:{activeFields:["address_1","address_2","city","state","zip","country"],labels:{state:"State / Territory",zip:"Postcode"}},custom:{activeFields:[],labels:{}}};function M(){var u;const{css:n}=z(),{fieldKey:e}=P(),[o,m]=x(A);if(!e)return null;const a=j(o[e]),y=((u=a.config)==null?void 0:u.scheme)||"international",S=({target:{value:s}})=>{if(a.config.scheme=s,s==="custom"){const t=_(o,i=>{i[e]=a});m(t),g({event:`Address scheme changed to ${s}: ${a.lbl||e}`,type:"address_scheme_changed",state:{fields:t,fldKey:e}}),F(e);return}const l=N[s],C=a.childFields||[],p=_(o,t=>{t[e].config.scheme=s,C.forEach(({fldKey:i})=>{var f,b;const h=t[i];if(!h)return;const r=((b=(f=h.fieldName)==null?void 0:f.split("[").pop())==null?void 0:b.replace("]",""))||"";l.activeFields.length>0&&(t[i].isDeactive=!l.activeFields.includes(r)),l.labels[r]&&(t[i].lbl=l.labels[r])})});m(p),g({event:`Address scheme changed to ${s}: ${a.lbl||e}`,type:"address_scheme_changed",state:{fields:p,fldKey:e}}),F(e)};return d.jsx(E,{id:"addr-scheme-stng",title:v("Address Scheme"),className:n(c.fieldSection,c.hover_tip),open:!0,children:d.jsx("div",{className:n(c.placeholder),children:d.jsx("select",{"data-testid":"addr-scheme-stng-slct",className:n(c.input),"aria-label":v("Address scheme preset"),value:y,onChange:S,children:H.map(s=>d.jsx("option",{value:s.value,children:s.label},s.value))})})})}export{M as default};
