import{Q as f}from"./QDate-jX_qru4n.js";import{Q as V}from"./QPopupProxy-D6KhZL6Z.js";import{L as S,u as U,c as u,a as g,y as B,b as I,e as M,w as o,f as s,Q as k,P as x}from"./index-OSKNspXo.js";/* empty css                                                         */const C={name:"deenovaDateInput"},L=Object.assign(C,{props:{label:{type:String},item:{type:String},rules:{type:Array},disable:{type:Boolean},outlined:{type:Boolean},unset:{type:Boolean}},emits:["update:item"],setup(n,{emit:b}){const D=S(),{d:y,t:v}=U(),d=n,Y=u(()=>d.rules?[...d.rules,()=>c()||v("generic.invalid.date")]:[()=>c()||v("generic.invalid.date")]),w=u(()=>{var e;return(e=D.state.global.connectedUser)==null?void 0:e.lang.replaceAll("_","-")}),t=u({get:()=>d.item,set:function(e){Q("update:item",e)}}),Q=b;function c(){if(t.value){let e=new Date(t.value);return e instanceof Date&&!isNaN(e)}else return!0}const i=g(!1),m=g(!1),r=u({get:()=>{let e=t.value?new Date(t.value):new Date;return`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}`},set:e=>{t.value=e}}),p=u({get:()=>{if(t.value)try{return y(new Date(t.value),"short",w.value)}catch{return t.value}else return""},set:e=>t.value=e});return B(p,()=>{m.value=!1,i.value=!1}),(e,a)=>(M(),I(x,{modelValue:p.value,"onUpdate:modelValue":a[4]||(a[4]=l=>p.value=l),label:n.label,"input-class":"cursor-pointer",readonly:"",borderless:!n.disable,debounce:"1000","lazy-rules":"",outlined:n.outlined,disable:n.disable,rules:Y.value},{append:o(()=>[s(k,{name:"event",class:"cursor-pointer"},{default:o(()=>[s(V,{modelValue:i.value,"onUpdate:modelValue":a[1]||(a[1]=l=>i.value=l)},{default:o(()=>[s(f,{modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=l=>r.value=l),"no-unset":"",mask:"YYYY-MM-DD"},null,8,["modelValue"])]),_:1},8,["modelValue"])]),_:1})]),default:o(()=>[s(V,{modelValue:m.value,"onUpdate:modelValue":a[3]||(a[3]=l=>m.value=l)},{default:o(()=>[s(f,{modelValue:r.value,"onUpdate:modelValue":a[2]||(a[2]=l=>r.value=l),"no-unset":"",mask:"YYYY-MM-DD"},null,8,["modelValue"])]),_:1},8,["modelValue"])]),_:1},8,["modelValue","label","borderless","outlined","disable","rules"]))}});export{L as _};
//# sourceMappingURL=deenovaDateInput-Bt7GUYC2.js.map
