import{_ as e}from"./B7bXU_yt.js";import{j as a}from"./Dw8a-Wu3.js";import{c as t,w as l,B as i,L as r,V as s,P as m,$ as u,M as n,a2 as d,W as o,x as p,u as c,l as v}from"./CFGNYEIb.js";const y={class:"input-wrapper"},f=["for"],V={__name:"BaseDateInput",props:{name:{type:String,required:!0},label:{type:String,required:!1},placeholder:{type:String,required:!1},value:{type:String,required:!1},maxDate:{type:String,required:!1},minDate:{type:String,required:!1},timePicker:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1}},emits:["update:value"],setup(V,{emit:D}){const k=V,x=D,b=a(k.name),g=t(null);return l((()=>k.value),(e=>{e&&(k.timePicker?b.setValue(e):(b.setValue(e),g.value=new Date(e)))}),{deep:!0,immediate:!0}),l((()=>g.value),((e,a)=>{var t;if(e)if(k.timePicker){const a=e.hours<10?"0"+e.hours:e.hours+":"+(e.minutes<10?"0"+e.minutes:e.minutes);b.setValue(a),x("update:value",a)}else{const e=null==(t=null==g?void 0:g.value)?void 0:t.toISOString().slice(0,10);b.setValue(e),x("update:value",e)}else e!=a&&(b.setValue(void 0),x("update:value",void 0))}),{deep:!0,immediate:!0}),(a,t)=>{const l=e,D=i("VueDatePicker"),k=i("VeeErrorMessage"),x=i("VeeField");return r(),s(x,{name:V.name},{default:m((({field:e,meta:a})=>[u("div",y,[V.label?(r(),n("label",{key:0,for:V.name},d(V.label),9,f)):o("",!0),p(D,{modelValue:c(g),"onUpdate:modelValue":t[0]||(t[0]=e=>v(g)?g.value=e:null),placeholder:V.placeholder,format:V.timePicker?"HH:mm":"yyyy-MM-dd","max-date":V.maxDate&&new Date(V.maxDate),"min-date":V.minDate&&new Date(V.minDate),disabled:V.disabled,autocomplete:"off","time-picker":V.timePicker},{"input-icon":m((()=>[p(l,{name:"calendar",classes:"z-30 !relative !translate-y-0"})])),_:1},8,["modelValue","placeholder","format","max-date","min-date","disabled","time-picker"])]),p(k,{class:"text-sm text-red-500",name:V.name},null,8,["name"])])),_:1},8,["name"])}}};export{V as _};
