import{l as _,i as b,a as S,F as C}from"./es-BwuR63_9.js";import{_ as V,y as d,o as k,c as x,b as B,h as M,d as v,r as w,L as r}from"./index-DjTYIUY5.js";const N={class:"month-pick"},$={class:"fc-wrap"},A={__name:"MonthPickCalendar",props:{modelValue:{type:String,default:""},highlightDates:{type:Array,default:()=>[]},badgeByDate:{type:Object,default:()=>({})},minDate:{type:String,default:""}},emits:["update:modelValue","range-change"],setup(u,{emit:p}){const a=u,i=p,s=w(null);function l(e){const t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${o}`}function f(){return new Set(a.highlightDates.map(e=>String(e).slice(0,10)))}function m(e){const t=l(e.start),n=l(new Date(e.end.getTime()-1));i("range-change",{from:t,to:n})}function h(e){const t=l(e.date);a.minDate&&t<a.minDate||i("update:modelValue",t)}function g(e){const t=l(e.date),n=[];return a.minDate&&t<a.minDate&&n.push("cal-day-past"),f().has(t)&&n.push("cal-day-has-slots"),a.modelValue&&t===a.modelValue.slice(0,10)&&n.push("cal-day-selected"),n}function y(e){if(e.el.querySelector(".cal-appt-badge"))return;const t=l(e.date),n=a.badgeByDate[t];if(n!=null&&Number(n)>0){e.el.setAttribute("title",`${n} cita(s)`);const o=document.createElement("span");o.className="cal-appt-badge",o.textContent=String(n);const c=e.el.querySelector(".fc-daygrid-day-top");c&&c.appendChild(o)}}const D={plugins:[b,S],initialView:"dayGridMonth",locale:_,initialDate:a.modelValue||void 0,headerToolbar:{left:"prev,next today",center:"title",right:""},buttonText:{today:"Hoy"},height:"auto",fixedWeekCount:!1,selectable:!1,dateClick:h,datesSet:m,dayCellClassNames:g,dayCellDidMount:y};return d(()=>[a.modelValue,a.highlightDates,a.minDate,a.badgeByDate],()=>{r(()=>{s.value?.getApi()?.render()})},{deep:!0}),d(()=>a.modelValue,e=>{e&&r(()=>{const t=s.value?.getApi();t&&t.gotoDate(e)})}),(e,t)=>(k(),x("div",N,[B("div",$,[M(v(C),{ref_key:"fcRef",ref:s,options:D},null,512)])]))}},q=V(A,[["__scopeId","data-v-f8c3be2c"]]);export{q as M};
