import{a as D,C as N,b as p,k as _,m as c,g as o,p as i,q as d,f as x,L as k,D as f,u as r,M as R,U as I,I as M}from"./convert-case-to-camel-case.utils-DDUpNI96.js";import{a as O,w as W,v as F,t as H}from"./widget-BUAABBRb.js";import{u as L}from"./translationsStore-DBJu9sBR.js";import{_ as q}from"./RequiredHint.vue_vue_type_style_index_0_lang-R4Bqx90z.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";const U={class:"ccb-order-field__wrapper"},$={key:0,class:"ccb-required-tooltip"},z={class:"ccb-order-field__label"},P={key:0,class:"ccb-order-required-mark"},j=["placeholder"],A={key:0,class:"ccb-order-field__wrapper",style:{"padding-top":"10px"}},G={class:"ccb-order-field__label"},J=["placeholder"],K={key:0,class:"ccb-order-field__same-email"},ae=D({__name:"OrderEmail",props:{field:{}},setup(y){const T=y,{field:t}=N(T),{checkFieldRequired:E}=W(),u=L(),v=O(),V=p(()=>{var a,e;return((e=(a=v.getWarningTexts)==null?void 0:a.formFields)==null?void 0:e.emailField)||u.getTranslations.requiredField}),S=p(()=>{var a,e;return((e=(a=v.getWarningTexts)==null?void 0:a.formFields)==null?void 0:e.emailFormat)||u.getTranslations.incorrectEmailFormat}),n=_(""),b=_(!0),m=_(""),w=a=>{n.value="";const{updateValue:e}=H(),s=a.target.value;s&&!F(s)&&(n.value="incorrect_email"),e(t.value.id,s),g()},g=()=>{b.value=t.value.value===m.value},C=a=>{const l=a.target.value;l&&!F(l)&&(n.value="incorrect_email")},h=p(()=>n.value==="incorrect_email"?!0:t.value.required?E(t.value):!1);return(a,e)=>{var l,s;return o(),c("div",{class:M(["ccb-order-field ccb-order-email",{[`ccb-col-${r(t).fieldWidth}`]:!0,"ccb-order-field--required":h.value}])},[i("div",U,[h.value?(o(),c("div",$,[n.value==="incorrect_email"?(o(),x(q,{key:0,text:S.value},null,8,["text"])):(o(),x(q,{key:1,text:V.value},null,8,["text"]))])):d("",!0),i("label",z,[k(f(r(t).label)+" ",1),r(t).required?(o(),c("span",P,"*")):d("",!0)]),i("input",{type:"text",onFocusout:C,onInput:w,placeholder:r(t).placeholder},null,40,j)]),(l=r(t).attributes)!=null&&l.confirmation?(o(),c("div",A,[i("label",G,[k(f((s=r(t).attributes)==null?void 0:s.confirmationLabel)+" ",1),e[1]||(e[1]=i("span",{class:"ccb-order-required-mark"},"*",-1))]),R(i("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=B=>m.value=B),onInput:g,placeholder:r(t).attributes.confirmationPlaceholder},null,40,J),[[I,m.value]]),b.value?d("",!0):(o(),c("span",K,f(r(u).getTranslations.theEmailDoNotMatch),1))])):d("",!0)],2)}}});export{ae as default};
//# sourceMappingURL=OrderEmail-Cqf2vqD6.js.map
