import{u as g}from"./useValidatedFormField-Bu_5cfth.js";import{z as V}from"./vendor-vue-tel-input-BVrpclZy.js";import{d as v,a as C,f as _,i as w,j as K}from"./vendor-vue-runtime-core-DwK6Ry68.js";import{r as u,u as k}from"./vendor-vue-reactivity-CheHbvBM.js";import"./vendor-vue-runtime-dom-B2rky8vu.js";import"./vendor-vue-shared-DrzsEcag.js";const P={class:"ccb-field__input-wrapper"},b=v({__name:"Phone",props:{field:{}},emits:["update","country-changed"],setup(l,{emit:s}){const o=s,r=l,a=u(r.field),{onCountryChanged:i}=g(r,o),n=u(""),d={placeholder:a.value.placeholder,inputmode:"numeric",pattern:"[0-9]*"},c=e=>e.replace(/\D+/g,""),p=e=>{var t;return e instanceof Event?((t=e.target)==null?void 0:t.value)||"":e},m=e=>{const t=c(p(e));n.value!==t&&(n.value=t),o("update",t)},f=e=>{e.ctrlKey||e.metaKey||e.altKey||["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Home","End"].includes(e.key)||/^\d$/.test(e.key)||e.preventDefault()},h=e=>{o("country-changed",e.iso2),setTimeout(()=>{i(n.value)},100)};return C(()=>{n.value=a.value.displayValue}),(e,t)=>(w(),_("div",P,[K(k(V),{onInput:m,onKeydownCapture:f,mode:"international",modelValue:n.value,"onUpdate:modelValue":t[0]||(t[0]=y=>n.value=y),inputOptions:d,onCountryChanged:h,"default-country":a.value.defaultCountry},null,8,["modelValue","default-country"])]))}});export{b as default};
//# sourceMappingURL=Phone-CfNFbiec.js.map
