import{a as y,g as _,i as z,aH as b,H as C,j as t,_ as d,f as g,bG as f}from"./main-634.js";import{F as r}from"./bf-767-388.js";import{S as I}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 j=[{value:"auto",label:"Auto (country-driven)"},{value:"off",label:"Off"},{value:"custom",label:"Custom regex"}];function R(){var u,m;const{css:s}=y(),{fieldKey:e}=_(),[o,c]=z(b);if(!e)return null;const l=C(o[e]),p=((u=l.config)==null?void 0:u.zipValidation)||"auto",x=((m=l.config)==null?void 0:m.zipCustomRegex)||"",v=({target:{value:a}})=>{const i=g(o,n=>{n[e].config.zipValidation=a});c(i),f({event:`ZIP validation set to '${a}': ${l.lbl||e}`,type:"address_zip_validation_changed",state:{fields:i,fldKey:e}})},h=({target:{value:a}})=>{const i=g(o,n=>{n[e].config.zipCustomRegex=a});c(i),f({event:`ZIP custom regex updated: ${l.lbl||e}`,type:"address_zip_regex_changed",state:{fields:i,fldKey:e}})};return t.jsx(I,{id:"addr-zip-val-stng",title:d("ZIP / Postal Validation"),className:s(r.fieldSection,r.hover_tip),open:!0,children:t.jsxs("div",{className:s({px:6,py:10}),children:[j.map(a=>t.jsxs("label",{className:s({dy:"flex",alignItems:"center",gap:8,mb:6,cursor:"pointer"}),children:[t.jsx("input",{type:"radio",name:`zip-val-${e}`,value:a.value,checked:p===a.value,onChange:v}),d(a.label)]},a.value)),p==="custom"&&t.jsx("div",{className:s({mt:8}),children:t.jsx("input",{"data-testid":"addr-zip-regex-inp",className:s(r.input),type:"text",placeholder:"e.g. ^\\d{5}(-\\d{4})?$","aria-label":d("Custom ZIP regex pattern"),value:x,onChange:h})})]})})}export{R as default};
