vue-hotel-booking-calendar
Version:
A Vue 3 calendar component suite featuring hotel booking calendars, dashboard management, and resource scheduler with yearly/monthly/weekly/daily/hourly views. Includes price calculation, recurring events, event categories, working hours, and full interna
2 lines • 72.7 kB
JavaScript
(function(te,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(te=typeof globalThis<"u"?globalThis:te||self,e(te.VueHotelBookingCalendar={},te.Vue))})(this,function(te,e){"use strict";const ie={class:"calendar-header"},de=["disabled","aria-label"],me={class:"month-year"},he=["disabled","aria-label"],ge={key:0,class:"selection-error"},ke={class:"error-content"},ue={class:"error-message"},ye={key:0,class:"blocked-dates"},De=["aria-label"],pe={class:"calendar-body"},fe={class:"calendar-grid-container"},we=["onClick","onMouseenter","tabindex","aria-label","onKeydown"],Ee={class:"day-content"},be={class:"day-number"},Se={key:0,class:"day-price"},Be={key:1,class:"price-summary"},Ce={class:"price-summary-header"},$e=["aria-label"],Ve={class:"price-content"},_e={class:"stay-info"},Ne={class:"nights"},Te={class:"dates"},Me={key:0,class:"breakdown"},Ie={class:"breakdown-toggle"},He={class:"daily-list"},Fe={class:"totals"},Oe={class:"subtotal"},Le={class:"total"},ze=["disabled"],We={key:2,class:"calendar-legend"},Pe={class:"legend-item"},xe={class:"legend-item"},Ye={class:"legend-item"},Ae=e.defineComponent({__name:"HotelBookingCalendar",props:{modelValue:{default:()=>({checkIn:null,checkOut:null})},availabilityData:{default:()=>[]},minDate:{},maxDate:{},locale:{default:"en-GB"},disablePastDates:{type:Boolean,default:!0},allowPreviousMonthNavigation:{type:Boolean,default:!0},showPrices:{type:Boolean,default:!1},allowSingleDay:{type:Boolean,default:!1},theme:{default:"light"},basePrice:{default:85},currency:{default:"GBP"},showPriceCalculation:{type:Boolean,default:!0},showSelectionErrors:{type:Boolean,default:!0},textLabels:{default:()=>({})}},emits:["update:modelValue","date-click","date-select","selection-change","selection-error","price-calculation","book-now"],setup(A,{emit:J}){const t=A,p=J,D=e.ref(new Date),w=e.ref(null),z=e.ref(!1),T=e.ref(null),H=e.computed(()=>{if(!t.minDate){if(t.disablePastDates){const s=new Date;return s.setHours(0,0,0,0),s}return null}return typeof t.minDate=="string"?new Date(t.minDate):t.minDate}),q=e.computed(()=>t.maxDate?typeof t.maxDate=="string"?new Date(t.maxDate):t.maxDate:null),I=e.computed(()=>{const s=new Map;return t.availabilityData.forEach(g=>{s.set(g.date,g)}),s}),R=e.computed(()=>{const s=new Intl.DateTimeFormat(t.locale,{weekday:"short"}),g=[];for(let S=0;S<7;S++){const $=new Date(2023,0,S+1);g.push(s.format($))}return g}),Q=e.computed(()=>{const s=D.value.getFullYear(),g=D.value.getMonth(),S=new Date(s,g,1),$=new Date(s,g+1,0),F=new Date(S),f=new Date($),x=F.getDay();F.setDate(F.getDate()-x);const K=6-f.getDay();f.setDate(f.getDate()+K);const Z=[],Y=new Date(F);for(;Y<=f;){const v=E(Y),ae={date:new Date(Y),dateString:v,isToday:v===E(new Date),isCurrentMonth:Y.getMonth()===g,isPreviousMonth:Y.getMonth()<g,isNextMonth:Y.getMonth()>g,availability:I.value.get(v)};Z.push(ae),Y.setDate(Y.getDate()+1)}return Z}),P=e.computed(()=>{if(t.allowPreviousMonthNavigation||!H.value)return!0;const s=new Date(D.value);s.setMonth(s.getMonth()-1),s.setDate(1);const g=new Date(H.value);return g.setDate(1),s>=g}),j=e.computed(()=>{if(!q.value)return!0;const s=new Date(D.value);s.setMonth(s.getMonth()+1),s.setDate(1);const g=new Date(q.value);return g.setDate(1),s<=g}),N=e.computed(()=>{var s,g,S,$,F,f,x,K,Z,Y,v,ae,ee;return{previousMonth:((s=t.textLabels)==null?void 0:s.previousMonth)||"Previous month",nextMonth:((g=t.textLabels)==null?void 0:g.nextMonth)||"Next month",bookingSummary:((S=t.textLabels)==null?void 0:S.bookingSummary)||"Booking Summary",nights:(($=t.textLabels)==null?void 0:$.nights)||"nights",night:((F=t.textLabels)==null?void 0:F.night)||"night",priceBreakdown:((f=t.textLabels)==null?void 0:f.priceBreakdown)||"Price breakdown",total:((x=t.textLabels)==null?void 0:x.total)||"Total",bookNow:((K=t.textLabels)==null?void 0:K.bookNow)||"Book Now",available:((Z=t.textLabels)==null?void 0:Z.available)||"Available",checkoutOnly:((Y=t.textLabels)==null?void 0:Y.checkoutOnly)||"Checkout Only",blocked:((v=t.textLabels)==null?void 0:v.blocked)||"Blocked",clearSelection:((ae=t.textLabels)==null?void 0:ae.clearSelection)||"Clear selection",dismissError:((ee=t.textLabels)==null?void 0:ee.dismissError)||"Dismiss error"}}),M=e.computed(()=>{const{checkIn:s,checkOut:g}=t.modelValue;if(!s||!g)return null;const S=new Date(s),$=new Date(g),F=Math.ceil(($.getTime()-S.getTime())/(1e3*60*60*24));if(F<=0)return null;const f=[];let x=0;const K=new Date(S);for(;K<$;){const Z=E(K),Y=I.value.get(Z),v=(Y==null?void 0:Y.price)||t.basePrice||85;f.push({date:Z,price:v}),x+=v,K.setDate(K.getDate()+1)}return{basePrice:t.basePrice||85,nights:F,dailyPrices:f,totalPrice:x,currency:t.currency||"GBP",averagePerNight:x/F}}),E=s=>{const g=s.getFullYear(),S=String(s.getMonth()+1).padStart(2,"0"),$=String(s.getDate()).padStart(2,"0");return`${g}-${S}-${$}`},h=s=>new Intl.DateTimeFormat(t.locale,{month:"long",year:"numeric"}).format(s),r=s=>new Intl.NumberFormat(t.locale,{style:"currency",currency:t.currency||"GBP"}).format(s),o=(s,g)=>{const S=new Date(s),$=new Date(g),F=new Intl.DateTimeFormat(t.locale,{month:"short",day:"numeric"});return`${F.format(S)} - ${F.format($)}`},a=s=>new Intl.DateTimeFormat(t.locale,{month:"short",day:"numeric"}).format(new Date(s)),i=s=>s.map(g=>a(g)).join(", "),k=s=>{var g;return((g=s.availability)==null?void 0:g.price)||t.basePrice||0},_=s=>{if(!s.isCurrentMonth)return!0;if(t.disablePastDates){const g=new Date;g.setHours(0,0,0,0);const S=new Date(s.date);if(S.setHours(0,0,0,0),S<g)return!0}return!!(H.value&&s.date<H.value||q.value&&s.date>q.value)},u=s=>!!(_(s)||y(s)==="blocked"),y=s=>{var g;return((g=s.availability)==null?void 0:g.status)||"available"},b=s=>{var g,S;return((S=(g=T.value)==null?void 0:g.blockedDates)==null?void 0:S.includes(s))||!1},B=(s,g,S=!1)=>{const $=new Date(s),F=new Date(g),f=new Date($),x=[],K=[];for(f.setDate(f.getDate()+1);f<F||S&&f.getTime()===F.getTime();){const Z=E(f),Y=I.value.get(Z);(Y==null?void 0:Y.status)==="checkout-only"&&(!S||f<F)?K.push(Z):(Y==null?void 0:Y.status)==="blocked"&&x.push(Z),f.setDate(f.getDate()+1)}return{blockedDates:x,checkoutOnlyDates:K}},L=s=>s===t.modelValue.checkIn||s===t.modelValue.checkOut,U=s=>{const{checkIn:g,checkOut:S}=t.modelValue;return!g||!S?!1:s>g&&s<S},X=s=>s===t.modelValue.checkIn,n=s=>s===t.modelValue.checkOut,V=s=>{const g=s.date.toLocaleDateString(t.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),S=y(s),$=k(s);return`${g}, ${S}${$?`, ${r($)}`:""}`},l=()=>{T.value=null},m=(s,g)=>{const S={"blocked-dates-in-range":"Selected dates include unavailable periods. Please choose different dates.","min-stay-not-met":"Minimum stay requirement not met for selected dates.","max-stay-exceeded":"Selected stay exceeds maximum allowed duration.","invalid-range":(g==null?void 0:g[0])||"Invalid date range selected.","checkout-only-in-range":"Cannot include checkout-only dates within your stay. These dates can only be used as the final checkout date."};return{type:s,message:S[s],blockedDates:s==="blocked-dates-in-range"||s==="checkout-only-in-range"?g:void 0}},c=()=>{const s={checkIn:null,checkOut:null};p("update:modelValue",s),p("selection-change",s),l(),z.value=!1},d=()=>{if(M.value&&t.modelValue.checkIn&&t.modelValue.checkOut){const s={selection:{checkIn:t.modelValue.checkIn,checkOut:t.modelValue.checkOut},calculation:M.value};p("book-now",s)}},C=s=>{var f;if(u(s))return;l();const{checkIn:g,checkOut:S}=t.modelValue,$=s.dateString,F=y(s);if(p("date-click",$,F),!g||g&&S){if(F==="checkout-only"){const K=m("invalid-range",["Checkout-only dates cannot be used as check-in dates"]);T.value=K,p("selection-error",K);return}const x={checkIn:$,checkOut:null};p("update:modelValue",x),p("selection-change",x),z.value=!0}else if(g&&!S){if($===g&&!t.allowSingleDay)return;const x=$<g?$:g,K=$<g?g:$;if($<g&&F==="checkout-only"){const ee=m("invalid-range",["Checkout-only dates cannot be used as check-in dates"]);T.value=ee,p("selection-error",ee);return}if($>g&&((f=I.value.get(x))==null?void 0:f.status)==="checkout-only"){const oe=m("invalid-range",["Checkout-only dates cannot be used as check-in dates"]);T.value=oe,p("selection-error",oe);return}const{blockedDates:Z,checkoutOnlyDates:Y}=B(x,K,!0),v=y({});if(Z.length>0||v==="blocked"){const ee=[...Z];v==="blocked"&&ee.push(K);const oe=m("blocked-dates-in-range",ee);T.value=oe,p("selection-error",oe);const ce={checkIn:$,checkOut:null};p("update:modelValue",ce),p("selection-change",ce),z.value=!0;return}if(Y.length>0){const ee=m("checkout-only-in-range",Y);T.value=ee,p("selection-error",ee);const oe={checkIn:$,checkOut:null};p("update:modelValue",oe),p("selection-change",oe),z.value=!0;return}const ae={checkIn:x,checkOut:K};p("update:modelValue",ae),p("selection-change",ae),z.value=!1}},O=s=>{_(s)||(w.value=s.dateString)},W=()=>{if(!P.value)return;const s=new Date(D.value);s.setMonth(s.getMonth()-1),D.value=s},G=()=>{if(!j.value)return;const s=new Date(D.value);s.setMonth(s.getMonth()+1),D.value=s};return e.onMounted(()=>{if(t.modelValue.checkIn){const s=new Date(t.modelValue.checkIn);D.value=new Date(s.getFullYear(),s.getMonth(),1)}}),e.watch(()=>t.modelValue,(s,g)=>{if(s.checkIn&&!s.checkOut?z.value=!0:z.value=!1,s.checkIn&&s.checkIn!==(g==null?void 0:g.checkIn)){const S=new Date(s.checkIn);D.value=new Date(S.getFullYear(),S.getMonth(),1)}},{deep:!0}),e.watch(M,s=>{p("price-calculation",s)},{immediate:!0}),(s,g)=>{var S,$,F;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["hotel-booking-calendar",[`theme-${s.theme}`,{"show-prices":s.showPrices},{"has-selection-error":T.value}]])},[e.createElementVNode("div",ie,[e.createElementVNode("button",{type:"button",class:"nav-button prev",onClick:W,disabled:!P.value,"aria-label":N.value.previousMonth}," ‹ ",8,de),e.createElementVNode("div",me,[e.createElementVNode("h2",null,e.toDisplayString(h(D.value)),1)]),e.createElementVNode("button",{type:"button",class:"nav-button next",onClick:G,disabled:!j.value,"aria-label":N.value.nextMonth}," › ",8,he)]),T.value&&s.showSelectionErrors?(e.openBlock(),e.createElementBlock("div",ge,[g[0]||(g[0]=e.createElementVNode("div",{class:"error-icon"},"⚠️",-1)),e.createElementVNode("div",ke,[e.createElementVNode("div",ue,e.toDisplayString(T.value.message),1),(S=T.value.blockedDates)!=null&&S.length?(e.openBlock(),e.createElementBlock("div",ye," Blocked dates: "+e.toDisplayString(i(T.value.blockedDates)),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{onClick:l,class:"error-dismiss","aria-label":N.value.dismissError},"✕",8,De)])):e.createCommentVNode("",!0),e.createElementVNode("div",pe,[e.createElementVNode("div",fe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f,class:"weekday"},e.toDisplayString(f),1))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.dateString,class:e.normalizeClass(["day-cell",{"other-month":!f.isCurrentMonth,today:f.isToday,selected:L(f.dateString),"in-range":U(f.dateString),"range-start":X(f.dateString),"range-end":n(f.dateString),available:y(f)==="available",blocked:y(f)==="blocked","checkout-only":y(f)==="checkout-only",disabled:_(f),"click-disabled":u(f),"error-blocked":b(f.dateString)}]),onClick:x=>C(f),onMouseenter:x=>O(f),role:"button",tabindex:u(f)?-1:0,"aria-label":V(f),onKeydown:[e.withKeys(x=>C(f),["enter"]),e.withKeys(e.withModifiers(x=>C(f),["prevent"]),["space"])]},[e.createElementVNode("div",Ee,[e.createElementVNode("span",be,e.toDisplayString(f.date.getDate()),1),s.showPrices&&k(f)?(e.openBlock(),e.createElementBlock("div",Se,e.toDisplayString(r(k(f))),1)):e.createCommentVNode("",!0)])],42,we))),128))])]),s.showPriceCalculation&&M.value?(e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("div",Ce,[e.createElementVNode("h4",null,e.toDisplayString(N.value.bookingSummary),1),e.createElementVNode("button",{onClick:c,class:"clear-btn","aria-label":N.value.clearSelection},"✕",8,$e)]),e.createElementVNode("div",Ve,[e.createElementVNode("div",_e,[e.createElementVNode("span",Ne,e.toDisplayString(M.value.nights)+" "+e.toDisplayString(M.value.nights===1?N.value.night:N.value.nights),1),e.createElementVNode("span",Te,e.toDisplayString(($=s.modelValue)!=null&&$.checkIn&&((F=s.modelValue)!=null&&F.checkOut)?o(s.modelValue.checkIn,s.modelValue.checkOut):""),1)]),M.value.dailyPrices.length>1?(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("details",Ie,[e.createElementVNode("summary",null,[e.createTextVNode(e.toDisplayString(N.value.priceBreakdown)+" ",1),g[1]||(g[1]=e.createElementVNode("span",{class:"arrow"},"▼",-1))]),e.createElementVNode("div",He,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value.dailyPrices,f=>(e.openBlock(),e.createElementBlock("div",{key:f.date,class:"daily-row"},[e.createElementVNode("span",null,e.toDisplayString(a(f.date)),1),e.createElementVNode("span",null,e.toDisplayString(r(f.price)),1)]))),128))])])])):e.createCommentVNode("",!0),e.createElementVNode("div",Fe,[e.createElementVNode("div",Oe,[e.createElementVNode("span",null,e.toDisplayString(M.value.nights)+" × "+e.toDisplayString(r(M.value.averagePerNight)),1),e.createElementVNode("span",null,e.toDisplayString(r(M.value.totalPrice)),1)]),e.createElementVNode("div",Le,[e.createElementVNode("span",null,e.toDisplayString(N.value.total),1),e.createElementVNode("strong",null,e.toDisplayString(r(M.value.totalPrice)),1)])]),e.createElementVNode("button",{onClick:d,class:"book-btn",disabled:!M.value},e.toDisplayString(N.value.bookNow),9,ze)])])):e.createCommentVNode("",!0),(s.$slots.legend,e.openBlock(),e.createElementBlock("div",We,[e.renderSlot(s.$slots,"legend",{},()=>[e.createElementVNode("div",Pe,[g[2]||(g[2]=e.createElementVNode("div",{class:"legend-indicator available"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(N.value.available),1)]),e.createElementVNode("div",xe,[g[3]||(g[3]=e.createElementVNode("div",{class:"legend-indicator checkout-only"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(N.value.checkoutOnly),1)]),e.createElementVNode("div",Ye,[g[4]||(g[4]=e.createElementVNode("div",{class:"legend-indicator blocked"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(N.value.blocked),1)])],!0)]))],2)}}}),ne=(A,J)=>{const t=A.__vccOpts||A;for(const[p,D]of J)t[p]=D;return t},le=ne(Ae,[["__scopeId","data-v-405ca090"]]),Re={class:"dashboard-header"},Ue=["aria-label"],je={class:"nav-text"},Ge={class:"current-month"},qe=["aria-label"],Ke={class:"nav-text"},Je={class:"calendar-container desktop-view"},Qe={class:"calendar-grid"},Xe={class:"grid-header"},Ze={class:"room-header"},ve={class:"date-number"},et={class:"date-weekday"},tt={class:"room-name"},nt=["onClick","title"],ot={class:"span-content"},at={class:"span-text"},lt=["onClick","title"],rt={key:0,class:"booking-indicator"},st={class:"guest-initials"},ct={class:"calendar-container mobile-view"},it={class:"mobile-view-toggle"},dt={key:0,class:"vertical-mobile-view"},mt={class:"mobile-room-header"},ht={class:"mobile-calendar-grid"},gt={class:"mobile-weekdays"},kt={class:"mobile-days"},ut=["onClick"],yt={class:"mobile-date-number"},Dt={key:0,class:"mobile-booking-indicator"},pt={class:"mobile-guest-initials"},ft={key:1,class:"horizontal-mobile-view"},wt={class:"horizontal-calendar-container"},Et={class:"horizontal-calendar-grid"},bt={class:"horizontal-grid-header"},St={class:"horizontal-room-header"},Bt={class:"horizontal-date-number"},Ct={class:"horizontal-date-weekday"},$t={class:"horizontal-room-name"},Vt=["onClick","title"],_t={class:"horizontal-span-content"},Nt={class:"horizontal-span-text"},Tt=["onClick","title"],Mt={key:0,class:"horizontal-booking-indicator"},It={class:"horizontal-guest-initials"},Ht={class:"legend"},re=ne(e.defineComponent({__name:"HotelDashboardCalendar",props:{rooms:{},bookings:{},selectedMonth:{default:()=>new Date},theme:{default:"light"},statusConfig:{},allowPreviousMonthNavigation:{type:Boolean,default:!1},textLabels:{default:()=>({})}},emits:["update:selectedMonth","booking-click","booking-create"],setup(A,{emit:J}){const t=A,p=J,D=e.ref(new Date(t.selectedMonth)),w=e.ref(!1),z=[{key:"available",label:"Available",color:"#666",backgroundColor:"#f9f9f9",darkBackgroundColor:"#2a2a2a"},{key:"confirmed",label:"Confirmed",color:"#166534",backgroundColor:"#dcf8c6",darkBackgroundColor:"#1a4d14"},{key:"pending",label:"Pending",color:"#92400e",backgroundColor:"#fef3c7",darkBackgroundColor:"#4a3c00"},{key:"checked-in",label:"Checked In",color:"#1e40af",backgroundColor:"#dbeafe",darkBackgroundColor:"#1e3a8a"},{key:"checked-out",label:"Checked Out",color:"#7c3aed",backgroundColor:"#f3e8ff",darkBackgroundColor:"#5b21b6"},{key:"cancelled",label:"Cancelled",color:"#dc2626",backgroundColor:"#fee2e2",darkBackgroundColor:"#7f1d1d"}],T=e.computed(()=>t.statusConfig||z),H=e.computed(()=>{var l,m,c,d,C,O;return{previousMonth:((l=t.textLabels)==null?void 0:l.previousMonth)||"← Previous",nextMonth:((m=t.textLabels)==null?void 0:m.nextMonth)||"Next →",room:((c=t.textLabels)==null?void 0:c.room)||"Room",available:((d=t.textLabels)==null?void 0:d.available)||"Available",createBooking:((C=t.textLabels)==null?void 0:C.createBooking)||"Click to create booking",clickForDetails:((O=t.textLabels)==null?void 0:O.clickForDetails)||"Click for details"}}),q=e.computed(()=>{const l=new Intl.DateTimeFormat("en-US",{weekday:"short"}),m=[];for(let c=0;c<7;c++){const d=new Date(2023,0,c+1);m.push(l.format(d))}return m}),I=e.computed(()=>{const l=D.value.getFullYear(),m=D.value.getMonth(),c=new Date(l,m+1,0).getDate(),d=new Date;d.setHours(0,0,0,0);const C=[];for(let O=1;O<=c;O++){const W=new Date(l,m,O),G=`${l}-${String(m+1).padStart(2,"0")}-${String(O).padStart(2,"0")}`;C.push({day:O,dateString:G,date:W,isToday:W.getTime()===d.getTime(),isWeekend:W.getDay()===0||W.getDay()===6,weekday:new Intl.DateTimeFormat("en-US",{weekday:"short"}).format(W)})}return C}),R=e.computed(()=>{const l={};return t.rooms.forEach(m=>{l[m.id]=[],t.bookings.filter(d=>d.roomNumber===m.number).forEach(d=>{const C=new Date(d.checkIn),O=new Date(d.checkOut),W=D.value.getFullYear(),G=D.value.getMonth(),s=new Date(W,G,1),g=new Date(W,G+1,0);if(C<=g&&O>s){let S,$;if(C>=s?S=C.getDate():S=1,O<=g?$=O.getDate()-1:$=g.getDate(),$=Math.max(S,$),S>=1&&$<=g.getDate()&&S<=$){const F=h(d.status);l[m.id].push({booking:d,startDay:S,endDay:$,length:$-S+1,statusConfig:F})}}}),l[m.id].sort((d,C)=>d.startDay-C.startDay)}),l}),Q=l=>new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long"}).format(l),P=l=>{if(l<0&&!t.allowPreviousMonthNavigation){const c=new Date,d=new Date(D.value.getFullYear(),D.value.getMonth(),1),C=new Date(c.getFullYear(),c.getMonth(),1);if(d<=C)return}const m=new Date(D.value);m.setMonth(m.getMonth()+l),D.value=m,p("update:selectedMonth",m)},j=(l,m)=>{try{return!l||!m?(console.warn("HotelDashboardCalendar: Invalid room or dateString in hasBooking",{room:l,dateString:m}),!1):Array.isArray(t.bookings)?!!t.bookings.find(d=>{try{if(!d||typeof d!="object")return console.warn("HotelDashboardCalendar: Invalid booking object",d),!1;if(!d.roomNumber||!d.checkIn||!d.checkOut)return console.warn("HotelDashboardCalendar: Missing required booking properties",d),!1;const C=d.roomNumber===l.number&&N(m,d);return d.roomNumber===l.number&&!C&&console.debug("HotelDashboardCalendar: Date range mismatch",{room:l.number,date:m,booking:{checkIn:d.checkIn,checkOut:d.checkOut,normalized:{checkIn:new Date(d.checkIn).toISOString(),checkOut:new Date(d.checkOut).toISOString(),date:new Date(m).toISOString()}}}),C}catch(C){return console.error("HotelDashboardCalendar: Error processing booking",C,d),!1}}):(console.warn("HotelDashboardCalendar: bookings prop is not an array",t.bookings),!1)}catch(c){return console.error("HotelDashboardCalendar: Error in hasBooking",c,{room:l,dateString:m}),!1}},N=(l,m)=>{try{if(!l||!(m!=null&&m.checkIn)||!(m!=null&&m.checkOut))return console.warn("HotelDashboardCalendar: Invalid date or booking in isDateInBookingRange",{dateString:l,booking:m}),!1;let c,d,C;try{if(c=new Date(l),d=new Date(m.checkIn),C=new Date(m.checkOut),isNaN(c.getTime())||isNaN(d.getTime())||isNaN(C.getTime()))return console.warn("HotelDashboardCalendar: Invalid date format",{date:l,checkIn:m.checkIn,checkOut:m.checkOut}),!1}catch(W){return console.error("HotelDashboardCalendar: Date parsing error",W,{dateString:l,booking:m}),!1}c.setHours(0,0,0,0),d.setHours(0,0,0,0),C.setHours(0,0,0,0);const O=d.getTime()===C.getTime();return!O&&C<=d?(console.warn("HotelDashboardCalendar: Invalid booking dates (checkOut <= checkIn)",{checkIn:m.checkIn,checkOut:m.checkOut}),!1):O?c.getTime()===d.getTime():c>=d&&c<C}catch(c){return console.error("HotelDashboardCalendar: Error in isDateInBookingRange",c,{dateString:l,booking:m}),!1}},M=(l,m)=>t.bookings.find(c=>c.roomNumber===l.number&&N(m,c))||null,E=(l,m)=>{const c=M(l,m);return c?c.status:"available"},h=l=>T.value.find(m=>m.key===l)||T.value[0],r=(l,m)=>{const c=[],d=I.value.find(C=>C.dateString===m);return d!=null&&d.isToday&&c.push("is-today"),d!=null&&d.isWeekend&&c.push("is-weekend"),j(l,m)&&c.push("has-booking"),c},o=(l,m)=>{const c=E(l,m),d=h(c);return{backgroundColor:t.theme==="dark"&&d.darkBackgroundColor?d.darkBackgroundColor:d.backgroundColor,color:d.color}},a=(l,m)=>{const c=M(l,m);return c?c.guestName.split(" ").map(d=>d.charAt(0).toUpperCase()).join("").substring(0,2):""},i=(l,m)=>{const c=new Date(l),C=new Date(m).getTime()-c.getTime();return Math.ceil(C/(1e3*60*60*24))},k=(l,m)=>{const c=M(l,m);if(!c)return`${H.value.room} ${l.number} - ${H.value.available} (${H.value.createBooking})`;const d=h(c.status),C=i(c.checkIn,c.checkOut);return`${c.guestName} - ${H.value.room} ${l.number} - ${d.label} - ${C} nights (${H.value.clickForDetails})`},_=(l,m)=>{const c=M(l,m);c?p("booking-click",c):p("booking-create",{roomId:l.id,date:m})},u=l=>{var O;const m=[],c=R.value[l.id]||[],d=new Set,C=[...c].sort((W,G)=>W.startDay-G.startDay);for(let W=1;W<=I.value.length;W++){if(d.has(W))continue;const G=C.find(s=>s.startDay===W);if(G){const s=((O=I.value[W-1])==null?void 0:O.dateString)||"";m.push({type:"booking-span",booking:G.booking,startDay:G.startDay,endDay:G.endDay,length:G.length,statusConfig:G.statusConfig,startDate:s});for(let g=G.startDay;g<=G.endDay;g++)d.add(g)}else{const s=I.value[W-1];s&&m.push({type:"date-cell",dateString:s.dateString,day:W})}}return m},y=l=>({backgroundColor:t.theme==="dark"&&l.statusConfig.darkBackgroundColor?l.statusConfig.darkBackgroundColor:l.statusConfig.backgroundColor,color:l.statusConfig.color,border:`1px solid ${l.statusConfig.color}`,borderRadius:"4px",gridColumnStart:(l.startDay+1).toString(),gridColumnEnd:(l.endDay+2).toString()}),b=l=>{const m=i(l.booking.checkIn,l.booking.checkOut),c=l.booking.guestName;return l.length===1?c.split(" ").map(d=>d.charAt(0)).join("").substring(0,2):l.length<=3?c.split(" ")[0]:l.length<=6?`${c.split(" ")[0]} (${m}n)`:`${c} - ${m} nights`},B=l=>{const m=i(l.booking.checkIn,l.booking.checkOut),c=t.rooms.find(d=>d.number===l.booking.roomNumber);return`${l.booking.guestName} - Room ${c==null?void 0:c.number} - ${l.statusConfig.label} - ${m} nights`},L=l=>{p("booking-click",l)},U=()=>{w.value=!1},X=()=>{w.value=!0,e.nextTick(()=>{n()})},n=()=>{const l=new Date,m=`${l.getFullYear()}-${String(l.getMonth()+1).padStart(2,"0")}-${String(l.getDate()).padStart(2,"0")}`,c=I.value.findIndex(d=>d.dateString===m);if(c!==-1){const d=document.querySelector(".horizontal-calendar-container");if(d){const W=c*80+60-d.clientWidth/2+40;d.scrollTo({left:Math.max(0,W),behavior:"smooth"})}}},V=e.computed(()=>I.value.length===0?0:new Date(I.value[0].dateString).getDay());return e.watch(()=>t.selectedMonth,l=>{l&&(D.value=new Date(l),w.value&&e.nextTick(()=>{n()}))}),e.watch(w,l=>{l&&e.nextTick(()=>{n()})}),(l,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["hotel-dashboard-calendar",`theme-${l.theme}`]),style:e.normalizeStyle({"--days-in-month":I.value.length})},[e.createElementVNode("div",Re,[e.createElementVNode("button",{onClick:m[0]||(m[0]=c=>P(-1)),class:"nav-btn","aria-label":H.value.previousMonth},[e.createElementVNode("span",je,e.toDisplayString(H.value.previousMonth),1),m[2]||(m[2]=e.createElementVNode("span",{class:"nav-arrow"},"←",-1))],8,Ue),e.createElementVNode("h2",Ge,e.toDisplayString(Q(D.value)),1),e.createElementVNode("button",{onClick:m[1]||(m[1]=c=>P(1)),class:"nav-btn","aria-label":H.value.nextMonth},[e.createElementVNode("span",Ke,e.toDisplayString(H.value.nextMonth),1),m[3]||(m[3]=e.createElementVNode("span",{class:"nav-arrow"},"→",-1))],8,qe)]),e.createElementVNode("div",Je,[e.createElementVNode("div",Qe,[e.createElementVNode("div",Xe,[e.createElementVNode("div",Ze,e.toDisplayString(H.value.room),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,c=>(e.openBlock(),e.createElementBlock("div",{key:c.dateString,class:e.normalizeClass(["date-header",{"is-today":c.isToday,"is-weekend":c.isWeekend}])},[e.createElementVNode("div",ve,e.toDisplayString(c.day),1),e.createElementVNode("div",et,e.toDisplayString(c.weekday),1)],2))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rooms,c=>(e.openBlock(),e.createElementBlock("div",{key:c.id,class:"room-row"},[e.createElementVNode("div",tt,e.toDisplayString(c.number),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u(c),(d,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:`${c.id}-${C}`},[d.type==="booking-span"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["booking-span-cell",r(c,d.startDate)]),style:e.normalizeStyle(y(d)),onClick:O=>L(d.booking),title:B(d)},[e.createElementVNode("div",ot,[e.createElementVNode("span",at,e.toDisplayString(b(d)),1)])],14,nt)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["date-cell",r(c,d.dateString)]),style:e.normalizeStyle(o(c,d.dateString)),onClick:O=>_(c,d.dateString),title:k(c,d.dateString)},[j(c,d.dateString)?(e.openBlock(),e.createElementBlock("div",rt,[e.createElementVNode("span",st,e.toDisplayString(a(c,d.dateString)),1)])):e.createCommentVNode("",!0)],14,lt))],64))),128))]))),128))])]),e.createElementVNode("div",ct,[e.createElementVNode("div",it,[e.createElementVNode("button",{onClick:U,class:e.normalizeClass([{active:!w.value},"toggle-btn"])},m[4]||(m[4]=[e.createElementVNode("span",{class:"toggle-icon"},"⊞",-1),e.createElementVNode("span",{class:"toggle-text"},"Vertical",-1)]),2),e.createElementVNode("button",{onClick:X,class:e.normalizeClass([{active:w.value},"toggle-btn"])},m[5]||(m[5]=[e.createElementVNode("span",{class:"toggle-icon"},"⊟",-1),e.createElementVNode("span",{class:"toggle-text"},"Horizontal",-1)]),2)]),w.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",dt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rooms,c=>(e.openBlock(),e.createElementBlock("div",{key:c.id,class:"mobile-room-calendar"},[e.createElementVNode("div",mt,[e.createElementVNode("h3",null,e.toDisplayString(H.value.room)+" "+e.toDisplayString(c.number),1)]),e.createElementVNode("div",ht,[e.createElementVNode("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(q.value,d=>(e.openBlock(),e.createElementBlock("div",{key:d,class:"mobile-weekday"},e.toDisplayString(d),1))),128))]),e.createElementVNode("div",kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,d=>(e.openBlock(),e.createElementBlock("div",{key:`empty-${d}`,class:"mobile-date-cell empty"}))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,d=>(e.openBlock(),e.createElementBlock("div",{key:d.dateString,class:e.normalizeClass(["mobile-date-cell",[r(c,d.dateString),{"other-month":d.date.getMonth()!==D.value.getMonth()}]]),style:e.normalizeStyle(j(c,d.dateString)?o(c,d.dateString):{}),onClick:C=>_(c,d.dateString)},[e.createElementVNode("div",yt,e.toDisplayString(d.day),1),j(c,d.dateString)?(e.openBlock(),e.createElementBlock("div",Dt,[e.createElementVNode("span",pt,e.toDisplayString(a(c,d.dateString)),1)])):e.createCommentVNode("",!0)],14,ut))),128))])])]))),128))])),w.value?(e.openBlock(),e.createElementBlock("div",ft,[e.createElementVNode("div",wt,[e.createElementVNode("div",Et,[e.createElementVNode("div",bt,[e.createElementVNode("div",St,e.toDisplayString(H.value.room),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,c=>(e.openBlock(),e.createElementBlock("div",{key:c.dateString,class:e.normalizeClass(["horizontal-date-header",{"is-today":c.isToday,"is-weekend":c.isWeekend}])},[e.createElementVNode("div",Bt,e.toDisplayString(c.day),1),e.createElementVNode("div",Ct,e.toDisplayString(c.weekday),1)],2))),128))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.rooms,c=>(e.openBlock(),e.createElementBlock("div",{key:c.id,class:"horizontal-room-row"},[e.createElementVNode("div",$t,e.toDisplayString(c.number),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u(c),(d,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:`${c.id}-${C}`},[d.type==="booking-span"?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["horizontal-booking-span-cell",r(c,d.startDate)]),style:e.normalizeStyle(y(d)),onClick:O=>L(d.booking),title:B(d)},[e.createElementVNode("div",_t,[e.createElementVNode("span",Nt,e.toDisplayString(b(d)),1)])],14,Vt)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["horizontal-date-cell",r(c,d.dateString)]),style:e.normalizeStyle(o(c,d.dateString)),onClick:O=>_(c,d.dateString),title:k(c,d.dateString)},[j(c,d.dateString)?(e.openBlock(),e.createElementBlock("div",Mt,[e.createElementVNode("span",It,e.toDisplayString(a(c,d.dateString)),1)])):e.createCommentVNode("",!0)],14,Tt))],64))),128))]))),128))])])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ht,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,c=>(e.openBlock(),e.createElementBlock("div",{key:c.key,class:"legend-item"},[e.createElementVNode("div",{class:"legend-color",style:e.normalizeStyle({backgroundColor:c.backgroundColor,borderColor:c.color})},null,4),e.createElementVNode("span",null,e.toDisplayString(c.label),1)]))),128))])],6))}}),[["__scopeId","data-v-e4727a14"]]),Ft={class:"months-grid"},Ot=["onClick"],Lt={class:"month-header"},zt={class:"month-name"},Wt={key:0,class:"event-count"},Pt={class:"mini-calendar"},xt={key:0,class:"mini-day empty"},Yt=["onClick"],At={key:0,class:"category-indicators"},Rt=["title"],Ut={class:"year-summary"},jt={class:"summary-item"},Gt={class:"summary-value"},qt={class:"summary-item"},Kt={class:"summary-value"},Jt={class:"summary-item"},Qt={class:"summary-value"},Xt={class:"summary-item"},Zt={class:"summary-value"},vt=ne(e.defineComponent({__name:"YearlyView",props:{year:{},events:{},theme:{},locale:{},categories:{},highlightToday:{type:Boolean,default:!0},firstDayOfWeek:{default:0}},emits:["month-click","date-click"],setup(A,{emit:J}){const t=A,p=J,D=e.computed(()=>{const E=new Intl.DateTimeFormat(t.locale,{weekday:"narrow"}),h=[];for(let r=0;r<7;r++){const o=(t.firstDayOfWeek+r)%7,a=new Date(2023,0,1+o);h.push(E.format(a))}return h}),w=e.computed(()=>{const E=new Intl.DateTimeFormat(t.locale,{month:"long"}),h=new Intl.DateTimeFormat(t.locale,{month:"short"}),r=new Date;return Array.from({length:12},(o,a)=>{const i=new Date(t.year,a,1),k=I(a);return{date:i,month:a,year:t.year,name:E.format(i),shortName:h.format(i),eventCount:k,hasEvents:k>0,isCurrentMonth:r.getFullYear()===t.year&&r.getMonth()===a}})}),z=e.computed(()=>w.value.reduce((E,h)=>E+h.eventCount,0)),T=e.computed(()=>w.value.reduce((E,h)=>!E||h.eventCount>E.eventCount?h:E,null)),H=e.computed(()=>w.value.filter(E=>E.hasEvents).length),q=e.computed(()=>z.value===0?0:Math.round(z.value/12)),I=E=>t.events.filter(h=>{const r=new Date(h.start),o=new Date(h.end),a=new Date(t.year,E,1),i=new Date(t.year,E+1,0,23,59,59);return r<=i&&o>=a}).length,R=E=>{const h=new Date(t.year,E.month,1),o=new Date(t.year,E.month+1,0).getDate(),a=h.getDay(),i=[];for(let k=0;k<a;k++)i.push(null);for(let k=1;k<=o;k++)i.push(k);return i},Q=E=>{const h=new Set;return t.events.forEach(r=>{const o=new Date(r.start),a=new Date(r.end),i=new Date(t.year,E.month,1),k=new Date(t.year,E.month+1,0);if(o<=k&&a>=i){const _=o.getMonth()===E.month&&o.getFullYear()===t.year?o.getDate():1,u=a.getMonth()===E.month&&a.getFullYear()===t.year?a.getDate():k.getDate();for(let y=_;y<=u;y++)h.add(y)}}),Array.from(h)},P=E=>{const h=new Set;return t.events.forEach(r=>{const o=new Date(r.start),a=new Date(r.end),i=new Date(t.year,E.month,1),k=new Date(t.year,E.month+1,0);o<=k&&a>=i&&r.categoryId&&h.add(r.categoryId)}),t.categories.filter(r=>h.has(r.id)).slice(0,5)},j=(E,h)=>{const r=new Date,o=t.highlightToday&&r.getFullYear()===t.year&&r.getMonth()===E.month&&r.getDate()===h,a=Q(E).includes(h);return{"is-today":o,"has-event":a}},N=E=>{p("month-click",E)},M=(E,h)=>{const r=`${t.year}-${String(E.month+1).padStart(2,"0")}-${String(h).padStart(2,"0")}`;p("date-click",r)};return(E,h)=>{var r;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["yearly-view",[`theme-${E.theme}`]])},[e.createElementVNode("div",Ft,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o.month,class:e.normalizeClass(["month-card",{"current-month":o.isCurrentMonth,"has-events":o.hasEvents}]),onClick:a=>N(o.month)},[e.createElementVNode("div",Lt,[e.createElementVNode("span",zt,e.toDisplayString(o.name),1),o.eventCount>0?(e.openBlock(),e.createElementBlock("span",Wt,e.toDisplayString(o.eventCount),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Pt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a,class:"mini-weekday"},e.toDisplayString(a),1))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R(o),(a,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[a===null?(e.openBlock(),e.createElementBlock("div",xt)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["mini-day",j(o,a)]),onClick:e.withModifiers(k=>M(o,a),["stop"])},e.toDisplayString(a),11,Yt))],64))),128))]),P(o).length>0?(e.openBlock(),e.createElementBlock("div",At,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(P(o),(a,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:"category-dot",style:e.normalizeStyle({backgroundColor:a.color}),title:a.name},null,12,Rt))),128))])):e.createCommentVNode("",!0)],10,Ot))),128))]),e.createElementVNode("div",Ut,[e.createElementVNode("div",jt,[e.createElementVNode("div",Gt,e.toDisplayString(z.value),1),h[0]||(h[0]=e.createElementVNode("div",{class:"summary-label"},"Total Events",-1))]),e.createElementVNode("div",qt,[e.createElementVNode("div",Kt,e.toDisplayString(((r=T.value)==null?void 0:r.shortName)||"-"),1),h[1]||(h[1]=e.createElementVNode("div",{class:"summary-label"},"Busiest Month",-1))]),e.createElementVNode("div",Jt,[e.createElementVNode("div",Qt,e.toDisplayString(H.value),1),h[2]||(h[2]=e.createElementVNode("div",{class:"summary-label"},"Active Months",-1))]),e.createElementVNode("div",Xt,[e.createElementVNode("div",Zt,e.toDisplayString(q.value),1),h[3]||(h[3]=e.createElementVNode("div",{class:"summary-label"},"Avg per Month",-1))])])],2)}}}),[["__scopeId","data-v-02063305"]]),en={class:"weekday-headers"},tn={key:0,class:"weekday-header week-number-header"},nn={key:0,class:"week-number-cell"},on=["onClick"],an={class:"day-header"},ln={key:0,class:"more-events"},rn={class:"events-list"},sn=["title","onClick"],cn={key:0,class:"event-time"},dn=ne(e.defineComponent({__name:"MonthlyView",props:{currentDate:{},events:{},theme:{},locale:{},categories:{},firstDayOfWeek:{},highlightToday:{type:Boolean,default:!0},highlightWeekends:{type:Boolean,default:!1},maxEventsPerSlot:{default:3},showWeekNumbers:{type:Boolean,default:!1}},emits:["date-click","event-click","slot-click"],setup(A,{emit:J}){const t=A,p=J,D=e.computed(()=>{const h=new Intl.DateTimeFormat(t.locale,{weekday:"short"}),r=[];for(let o=0;o<7;o++){const a=(t.firstDayOfWeek+o)%7,i=new Date(2023,0,1+a);r.push(h.format(i))}return r}),w=e.computed(()=>{const h=t.currentDate.getFullYear(),r=t.currentDate.getMonth(),o=new Date(h,r,1),a=new Date(o);let k=(a.getDay()-t.firstDayOfWeek+7)%7;a.setDate(a.getDate()-k);const _=new Date(a);_.setDate(_.getDate()+41);const u=[],y=new Date(a),b=new Date;for(b.setHours(0,0,0,0);y<=_;){const B=T(y),L=I(B);u.push({date:new Date(y),dateString:B,isToday:y.getTime()===b.getTime(),isCurrentMonth:y.getMonth()===r,isCurrentWeek:H(y,b),isWeekend:y.getDay()===0||y.getDay()===6,isWorkingDay:q(y),events:L}),y.setDate(y.getDate()+1)}return u}),z=e.computed(()=>T(t.currentDate)),T=h=>{const r=h.getFullYear(),o=String(h.getMonth()+1).padStart(2,"0"),a=String(h.getDate()).padStart(2,"0");return`${r}-${o}-${a}`},H=(h,r)=>{const o=new Date(h),a=new Date(r);o.setHours(0,0,0,0),a.setHours(0,0,0,0);const i=new Date(o);i.setDate(o.getDate()-(o.getDay()-t.firstDayOfWeek+7)%7);const k=new Date(a);return k.setDate(a.getDate()-(a.getDay()-t.firstDayOfWeek+7)%7),i.getTime()===k.getTime()},q=h=>{const r=h.getDay();return r!==0&&r!==6},I=h=>t.events.filter(r=>{const o=new Date(r.start),a=new Date(r.end),i=new Date(h);return o.setHours(0,0,0,0),a.setHours(23,59,59,999),i.setHours(12,0,0,0),i>=o&&i<=a}).sort((r,o)=>r.allDay&&!o.allDay?-1:!r.allDay&&o.allDay?1:new Date(r.start).getTime()-new Date(o.start).getTime()),R=h=>I(h),Q=h=>h===z.value,P=h=>{let r=h.backgroundColor||"#3b82f6",o=h.color||"#ffffff";if(h.categoryId){const a=t.categories.find(i=>i.id===h.categoryId);a&&(r=t.theme==="dark"&&a.darkBackgroundColor?a.darkBackgroundColor:a.backgroundColor,o=a.color)}return{backgroundColor:r,color:o,borderLeft:`3px solid ${o}`}},j=h=>{const r=new Date(h);return new Intl.DateTimeFormat(t.locale,{hour:"numeric",minute:"2-digit"}).format(r)},N=h=>{p("date-click",h.dateString),p("slot-click",{start:`${h.dateString}T09:00:00`,end:`${h.dateString}T10:00:00`,date:h.dateString})},M=h=>{p("event-click",h)},E=h=>{const r=new Date(Date.UTC(h.getFullYear(),h.getMonth(),h.getDate())),o=r.getUTCDay()||7;r.setUTCDate(r.getUTCDate()+4-o);const a=new Date(Date.UTC(r.getUTCFullYear(),0,1));return Math.ceil(((r.getTime()-a.getTime())/864e5+1)/7)};return(h,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["monthly-view",[`theme-${h.theme}`,{"show-week-numbers":h.showWeekNumbers}]])},[e.createElementVNode("div",en,[h.showWeekNumbers?(e.openBlock(),e.createElementBlock("div",tn,"Wk")):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,o=>(e.openBlock(),e.createElementBlock("div",{key:o,class:"weekday-header"},e.toDisplayString(o),1))),128))]),e.createElementVNode("div",{class:e.normalizeClass(["calendar-grid",{"with-week-numbers":h.showWeekNumbers}])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.dateString},[h.showWeekNumbers&&a%7===0?(e.openBlock(),e.createElementBlock("div",nn,e.toDisplayString(E(o.date)),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["day-cell",{"other-month":!o.isCurrentMonth,today:h.highlightToday&&o.isToday,weekend:h.highlightWeekends&&o.isWeekend,selected:Q(o.dateString)}]),onClick:i=>N(o)},[e.createElementVNode("div",an,[e.createElementVNode("span",{class:e.normalizeClass(["day-number",{"today-number":h.highlightToday&&o.isToday}])},e.toDisplayString(o.date.getDate()),3),R(o.dateString).length>h.maxEventsPerSlot?(e.openBlock(),e.createElementBlock("span",ln," +"+e.toDisplayString(R(o.dateString).length-h.maxEventsPerSlot),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",rn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R(o.dateString).slice(0,h.maxEventsPerSlot),i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"event-item",style:e.normalizeStyle(P(i)),title:i.title,onClick:e.withModifiers(k=>M(i),["stop"])},[i.allDay?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",cn,e.toDisplayString(j(i.start)),1)),e.createTextVNode(" "+e.toDisplayString(i.title),1)],12,sn))),128))])],10,on)],64))),128))],2)],2))}}),[["__scopeId","data-v-3ffb4cee"]]),mn={class:"week-header"},hn={class:"day-name"},gn={key:0,class:"all-day-row"},kn=["onClick"],un=["onClick"],yn={class:"time-grid-container"},Dn={class:"time-grid"},pn=["onClick"],fn=["onClick"],wn={class:"event-title"},En={class:"event-time"},bn=ne(e.defineComponent({__name:"WeeklyView",props:{currentDate:{},events:{},theme:{},locale:{},categories:{},workingHours:{},timeInterval:{},firstDayOfWeek:{},showAllDaySlot:{type:Boolean},highlightToday:{type:Boolean,default:!0},highlightWeekends:{type:Boolean,default:!1},showCurrentTimeIndicator:{type:Boolean,default:!0},slotHeight:{default:48},eventMinHeight:{default:20}},emits:["date-click","event-click","slot-click"],setup(A,{emit:J}){const t=A,p=J,D=e.computed(()=>{if(t.slotHeight)return t.slotHeight;switch(t.timeInterval){case 15:return 20;case 30:return 30;default:return 48}}),w=e.computed(()=>{const r=[],o=T(t.currentDate),a=new Date;a.setHours(0,0,0,0);const i=new Intl.DateTimeFormat(t.locale,{weekday:"short"});for(let k=0;k<7;k++){const _=new Date(o);_.setDate(_.getDate()+k),r.push({date:new Date(_),dateString:H(_),weekdayShort:i.format(_),isToday:_.getTime()===a.getTime(),isWeekend:_.getDay()===0||_.getDay()===6})}return r}),z=e.computed(()=>{const r=[];for(let o=0;o<24;o++)r.push(o);return r}),T=r=>{const o=new Date(r),a=o.getDay(),i=(a<t.firstDayOfWeek?7:0)+a-t.firstDayOfWeek;return o.setDate(o.getDate()-i),o.setHours(0,0,0,0),o},H=r=>{const o=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),i=String(r.getDate()).padStart(2,"0");return`${o}-${a}-${i}`},q=r=>r>=t.workingHours.start&&r<t.workingHours.end,I=r=>{const o=new Date;return o.setHours(r,0,0,0),new Intl.DateTimeFormat(t.locale,{hour:"numeric",hour12:!0}).format(o)},R=r=>t.events.filter(o=>{if(!o.allDay)return!1;const a=new Date(o.start),i=new Date(o.end),k=new Date(r);return a.setHours(0,0,0,0),i.setHours(23,59,59,999),k.setHours(12,0,0,0),k>=a&&k<=i}),Q=(r,o)=>t.events.filter(a=>{if(a.allDay)return!1;const i=new Date(a.start),k=new Date(`${r}T${String(o).padStart(2,"0")}:00:00`),_=new Date(k);return _.setHours(_.getHours()+1),i>=k&&i<_}),P=r=>{let o=r.backgroundColor||"#3b82f6",a=r.color||"#ffffff";if(r.categoryId){const i=t.categories.find(k=>k.id===r.categoryId);i&&(o=t.theme==="dark"&&i.darkBackgroundColor?i.darkBackgroundColor:i.backgroundColor,a=i.color)}return{backgroundColor:o,color:a,borderLeft:`3px solid ${a}`}},j=r=>{const o=P(r),a=new Date(r.start),i=new Date(r.end),_=a.getMinutes()/60*D.value,y=(i.getTime()-a.getTime())/(1e3*60*60),b=Math.max(y*D.value,t.eventMinHeight);return{...o,top:`${_}px`,height:`${b}px`,minHeight:"20px"}},N=r=>{const o=new Date(r.start),a=new Date(r.end),i=new Intl.DateTimeFormat(t.locale,{hour:"numeric",minute:"2-digit"});return`${i.format(o)} - ${i.format(a)}`},M=(r,o)=>{const a=`${r.dateString}T${String(o).padStart(2,"0")}:00:00`,i=o+1,k=`${r.dateString}T${String(i).padStart(2,"0")}:00:00`;p("slot-click",{start:a,end:k,date:r.dateString,hour:o})},E=r=>{p("slot-click",{start:`${r.dateString}T00:00:00`,end:`${r.dateString}T23:59:59`,date:r.dateString,hour:0})},h=r=>{p("event-click",r)};return(r,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["weekly-view",[`theme-${r.theme}`]]),style:e.normalizeStyle({"--slot-height":`${D.value}px`,"--event-min-height":`${r.eventMinHeight}px`})},[e.createElementVNode("div",mn,[o[0]||(o[0]=e.createElementVNode("div",{class:"time-column-header"},null,-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a.dateString,class:e.normalizeClass(["day-column-header",{"is-today":r.highlightToday&&a.isToday,"is-weekend":r.highlightWeekends&&a.isWeekend}])},[e.createElementVNode("div",hn,e.toDisplayString(a.weekdayShort),1),e.createElementVNode("div",{class:e.normalizeClass(["day-number",{"today-number":r.highlightToday&&a.isToday}])},e.toDisplayString(a.date.getDate()),3)],2))),128))]),r.showAllDaySlot?(e.openBlock(),e.createElementBlock("div",gn,[o[1]||(o[1]=e.createElementVNode("div",{class:"time-label all-day-label"},"All Day",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,a=>(e.openBlock(),e.createElementBlock("div",{key:`allday-${a.dateString}`,class:e.normalizeClass(["all-day-cell",{"is-today":r.highlightToday&&a.isToday}]),onClick:i=>E(a)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(R(a.dateString),i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"all-day-event",style:e.normalizeStyle(P(i)),onClick:e.withModifiers(k=>h(i),["stop"])},e.toDisplayString(i.title),13,un))),128))],10,kn))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",yn,[e.createElementVNode("div",Dn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,a=>(e.openBlock(),e.createElementBlock("div",{key:a,class:"time-row"},[e.createElementVNode("div",{class:e.normalizeClass(["time-label",{"working-hour":q(a)}])},e.toDisplayString(I(a)),3),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,i=>(e.openBlock(),e.createElementBlock("div",{key:`${i.dateString}-${a}`,class:e.normalizeClass(["time-slot",{"working-hour":q(a),"is-today":r.highlightToday&&i.isToday,"is-weekend":r.highlightWeekends&&i.isWeekend}]),onClick:k=>M(i,a)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q(i.dateString,a),k=>(e.openBlock(),e.createElementBlock("div",{key:k.id,class:"slot-event",style:e.normalizeStyle(j(k)),onClick:e.withModifiers(_=>h(k),["stop"])},[e.createElementVNode("div",wn,e.toDisplayString(k.title),1),e.createElementVNode("div",En,e.toDisplayString(N(k)),1)],12,fn))),128))],10,pn))),128))]))),128))])])],6))}}),[["__scopeId","data-v-cb3c7540"]]),Sn={class:"day-header-section"},Bn={class:"weekday-label"},Cn={key:0,class:"all-day-section"},$n={key:0,class:"no-events"},Vn={class:"all-day-events"},_n=["onClick"],Nn={class:"event-title"},Tn={key:0,class:"event-description"},Mn={class:"time-grid-wrapper"},In={class:"time-grid"},Hn=["onClick"],Fn={class:"hour-events"},On=["onClick"],Ln={class:"event-header"},zn={class:"event-title"},Wn={class:"event-time-range"},Pn={key:0,class:"event-location"},xn={class:"summary-section"},Yn={class:"summary-count"},An=ne(e.defineComponent({__name:"DailyView",props:{currentDate:{},events:{},theme:{},locale:{},categories:{},workingHours:{},timeInterval:{},showAllDaySlot:{type:Boolean},highlightToday:{type:Boolean,default:!0},showCurrentTimeIndicator:{type:Boolean,default:!0},slotHeight:{default:48},eventMinHeight:{default:20}},emits:["event-click","slot-click"],setup(A,{emit:J}){const t=A,p=J,D=e.computed(()=>I(t.currentDate)),w=e.computed(()=>{const o=new Date;o.setHours(0,0,0,0);const a=new Date(t.currentDate);return a.setHours(0,0,0,0),{weekday:new Intl.DateTimeFormat(t.locale,{weekday:"long"}).format(t.currentDate),dayNumber:t.currentDate.getDate(),isToday:a.getTime()===o.getTime()}}),z=e.computed(()=>{const o=[];for(let a=0;a<24;a++)o.push(a);return o}),T=e.computed(()=>t.events.filter(o=>{if(!o.allDay)return!1;const a=new Date(o.start),i=new Date(o.end),k=new Date(D.value);return a.setHours(0,0,0,0),i.setHours(23,59,59,999),k.setHours(12,0,0,0),k>=a&&k<=i})),H=e.computed(()=>j().length),q=e.computed(()=>new Date().getMinutes()/60*100),I=o=>{const a=o.getFullYear(),i=String(o.getMonth()+1).padStart(2,"0"),k=String(o.getDate()).padStart(2,"0");return`${a}-${i}-${k}`},R=o=>o>=t.workingHours.start&&o<t.workingHours.end,Q=o=>w.value.isToday?new Date().getHours()===o:!1,P=o=>{const a=new Date;return a.setHours(o,0,0,0),new Intl.DateTimeFormat(t.locale,{hour:"numeric",minute:"2-digit",hour12:!0}).format(a)},j=()=>t.events.filter(o=>{const a=new Date(o.start),i=new Date(o.end),k=new Date(D.value),_=new Date(k);_.setHours(0,0,0,0);const u=new Date(k);return u.setHours(23,59,59,999),a<=u&&i>=_}),N=o=>t.events.filter(a=>{if(a.allDay)return!1;const i=new Date(a.start),k=new Date(a.end);if(I(i)!==D.value)return!1;const u=i.getHours(),y=k.getHours()+(k.getMinutes()>0?1:0);return o>=u&&o<y}).sort((a,i)=>new Date(a.start).getTime()-new Date(i.start).getTime()),M=o=>{let a=o.backgroundColor||"#3b82f6",i=o.color||"#ffffff";if(o.categoryId){const k=t.categories.find(_=>_.id===o.categoryId);k&&(a=t.theme==="dark"&&k.darkBackgroundColor?k.darkBackgroundColor:k.backgroundColor,i=k.color)}return{backgroundColor:a,color:i,borderLeft:`3px solid ${i}`}},E=o=>{const a=new Date(o.start),i=new Date(o.end),k=new Intl.DateTimeFormat(t.locale,{hour:"numeric",minute:"2-digit"});return`${k.format(a)} - ${k.format(i)}`},h=o=>{const a=`${D.value}T${String(o).padStart(2,"0")}:00:00`,i=o+1,k=`${D.value}T${String(i).padStart(2,"0")}:00:00`;p("slot-click",{start:a,end:k,date:D.value,hour:o})},r=o=>{p("event-click",o)};return(o,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["daily-view",[`theme-${o.theme}`]]),style:e.normalizeStyle({"--slot-height":`${o.slotHeight}px`,"--event-min-height":`${o.eventMinHeight}px`})},[e.createElementVNode("div",Sn,[e.createElementVNode("div",Bn,e.toDisplayString(w.value.weekday),1),e.createElementVNode("div",{class:e.normalizeClass(["date-display",{"is-today":o.highlightToday&&w.value.isToday}])},e.toDisplayString(w.value.dayNumber),3)]),o.showAllDaySlot?(e.openBlock(),e.createElementBlock("div",Cn,[a[0]||(a[0]=e.createElementVNode("div",{class:"section-label"},"All Day Events",-1)),T.value.length===0?(e.openBlock(),e.createElementBlock("div",$n,"No all-day events")):e.createCommentVNode("",!0),e.createElementVNode("div",Vn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:"all-day-event",style:e.normalizeStyle(M(i)),onClick:k=>r(i)},[e.createElementVNode("div",Nn,e.toDisplayString(i.title),1),i.description?(e.openBlock(),e.createElementBlock("div",Tn,e.toDisplayString(i.description),1)):e.createCommentVNode("",!0)],12,_n))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("div",Mn,[e.createElementVNode("div",In,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,i=>(e.openBlock(),e.createElementBlock("div",{key:i,class:"hour-row"},[e.createElementVNode("div",{class:e.normalizeClass(["hour-label",{"working-hour":R(i)}])},e.toDisplayString(P(i)),3),e.createElementVNode("div",{class:e.normalizeClass(["hour-slot",{"working-hour":R(i),"current-hour":Q(i)}]),onClick:k=>h(i)},[o.showCurrentTimeIndicator&&Q(i)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"current-time-indicator",style:e.normalizeStyle({top:`${q.value}%`})},a[1]||(a[1]=[e.createElementVNode("div",{class:"time-dot"},null,-1)]),4)):e.createCommentVNode("",!0),e.createElementVNode("div",Fn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N(i),k=>(e.openBlock(),e.createElementBlock("div",{key:k.id,class:"hour-event",style:e.normalizeStyle(M(k)),onClick:e.withModifiers(_=>r(k),["stop"])},[e.createElementVNode("div",Ln,[e.createElementVNode("span",zn,e.toDisplayString(k.title),1),e.createElementVNode("span",Wn,e.toDisplayString(E(k)),1)]),k.location?(e.openBlock(),e.createElementBlock("div",Pn,[a[2]||(a[2]=e.createElementVNode("span",{class:"location-icon"},"📍",-1)),e.createTextVNode(" "+e.toDisplayString(k.location),1)])):e.createCommentVNode("",!0)],12,On))),128))])],10,Hn)]))),128))])]),e.createElementVNode("div",xn,[a[3]||(a[3]=e.createElementVNode("span",{class:"summary-label"},"Total events today:",-1)),e.createElementVNode("span",Yn,e.toDisplayString(H.value),1)])],6))}}),[["__scopeId","data-v-406daf97"]]),Rn={class:"day-info-header"},Un={class:"date-info"},jn={class:"weekday-name"},Gn={class:"full-date"},qn={class:"day-status"},Kn={key:0,class:"today-badge"},Jn={class:"event-count-label"},Qn={class:"interval-selector"},Xn={class:"interval-buttons"},Zn=["onClick"],vn={class:"time-slots-container"},eo={class:"time-slots"},to=["onClick"],no={class:"slot-events"},oo=["onClick"],ao={class:"event-main"},lo={class:"event-title"},ro={class:"event-duration"},so={key:0,class:"event-desc"},co={key:1,class:"event-location"},io={class:"stats-section"},mo={class:"stat-item"},ho={class:"stat-value"},go={class:"stat-item"},ko={class:"stat-value"},uo={class:"stat-item"},yo={class:"stat-value highlight"},Do=ne(e.defineComponent({__name:"HourlyView",props:{currentDate:{},events:{},theme:{},locale:{},categories:{},workingHours:{},timeInterval:{},showCurrentTimeIndicator:{type:Boolean,default:!0},slotHeight:{default:60},eventMinHeight:{default:20}},emits:["event-click","slot-click"],setup(A,{emit:J}){const t=A,p=J,D=[15,30,60],w=e.ref(t.timeInterval),z=e.computed(()=>M(t.currentDate)),T=e.computed(()=>{const u=new Date;u.setHours(0,0,0,0);const y=new Date(t.currentDate);return y.setHours(0,0,0,0),{weekday:new Intl.DateTimeFormat(t.locale,{weekday:"long"}).format(t.currentDate),formattedDate:new Intl.DateTimeFormat(t.locale,{month:"long",day:"numeric",year:"numeric"}).format(t.currentDate),isToday:y.getTime()===u.getTime()}}),H=e.computed(()=>r().length),q=e.computed(()=>{if(t.slotHeight)return t.slotHeight;switch(w.value){case 15:return 40;case 30:return 50;default:return 70}}),I=e.computed(()=>{const u=[],y=w.value;for(let b=0;b<24;b++)for(let B=0;B<60;B+=y){const L=`${String(b).padStart(2,"0")}:${String(B).padStart(2,"0")}`,U=new Date;U.setHours(b,B,0,0);const X=new Intl.DateTimeFormat(t.locale,{hour:"numeric",minute:"2-digit",hour12:!0}).format(U);u.push({time:L,hour:b,minute:B,formattedTime:X,isWorkingHour:E(b)})}return u}),R=e.computed(()=>I.value.filter(u=>u.isWorkingHour)),Q=e.computed(()=>R.value.filter(u=>o(u).length===0).length),P=e.computed(()=>R.value.filter(u=>o(u).length>0).length),j=e.computed(()=>{const u=R.value.length;return u===0?0:Math.round(P.value/u*100)}),N=e.computed(()=>new Date().getMinutes()%w.value/w.value*100),M=u=>{const y=u.getFullYear(),b=String(u.getMonth()+1).padStart(2,"0"),B=String(u.getDate()).padStart(2,"0");return`${y}-${b}-${B}`},E=u=>u>=t.workingHours.start&&u<t.workingHours.end,h=u=>{if(!T.value.isToday)return!1;const y=new Date,b=y.getHours(),B=y.getMinutes(),L=u.minute+w.value;return u.hour===b&&B>=u.minute&&B<L},r=()=>t.events.filter(u=>{const y=new Date(u.start),b=new Date(u.end),B=new Date(z.value),L=new Date(B);L.setHours(0,0,0,0);const U=new Date(B);return U.setHours(23,59,59,999),y<=U&&b>=L}),o=u=>t.events.filter(y=>{if(y.allDay)return!1;const b=new Date(y.start),B=new Date(y.end);if(M(b)!==z.value)return!1;const U=new Date(t.currentDate);U.setHours(u.hour,u.minute,0,0);const X=new Date(U);return X.setMinutes(X.getMinutes()+w.value),b<X&&B>U}),a=u=>{let y=u.backgroundColor||"#3b82f6",b=u.color||"#ffffff";if(u.categoryId){const B=t.categories.find(L=>L.id===u.categoryId);B&&(y=t.theme==="dark"&&B.darkBackgroundColor?B.darkBackgroundColor:B.backgroundColor,b=B.color)}return{backgroundColor:y,color:b,borderLeft:`3px solid ${b}`}},i=u=>{const y=new Date(u.start),B=new Date(u.end).getTime()-y.getTime(),L=Math.round(B/(1e3*60));if(L<60)return`${L}m`;const U=Math.floor(L/60),X=L%60;return X>0?`${U}h ${X}m`:`${U}h`},k=u=>{const y=`${z.value}T${u.time}:00`,b=new Date(t.currentDate);b.setHours(u.hour,u.minute+w.value,0,0);const B=`${String(b.getHours()).padStart(2,"0")}:${String(b.getMinutes()).padStart(2,"0")}`,L=`${z.value}T${B}:00`;p("slot-click",{start:y,end:L,date:z.value,hour:u.hour,minute:u.minute})},_=u=>{p("event-click",u)};return(u,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["hourly-view",[`theme-${u.theme}`]]),style:e.normalizeStyle({"--slot-height":`${q.value}px`,"--event-min-height":`${u.eventMinHeight}px`})},[e.createElementVNode("div",Rn,[e.createElementVNode("div",Un,[e.createElementVNode("div",jn,e.toDisplayString(T.value.weekday),1),e.createElementVNode("div",Gn,e.toDisplayString(T.value.formattedDate),1)]),e.createElementVNode("div",qn,[T.value.isToday?(e.openBlock(),e.createElementBlock("span",Kn,"Today")):e.createCommentVNode("",!0),e.createElementVNode("span",Jn,e.toDisplayString(H.value)+" event"+e.toDisplayString(H.value!==1?"s":""),1)])]),e.createElementVNode("div",Qn,[y[0]||(y[0]=e.createElementVNode("span",{class:"interval-label"},"Interval:",-1)),e.createElementVNode("div",Xn,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(D,b=>e.createElementVNode("button",{key:b,type:"button",class:e.normalizeClass(["interval-btn",{active:w.value===b}]),onClick:B=>w.value=b},e.toDisplayString(b)+"min ",11,Zn)),64))])]),e.createElementVNode("div",vn,[e.createElementVNode("div",eo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.time,class:"time-slot-row"},[e.createElementVNode("div",{class:e.normalizeClass(["slot-time-label",{"working-hour":b.isWorkingHour,"hour-start":b.minute===0}])},e.toDisplayString(b.formattedTime),3),e.createElementVNode("div",{class:e.normalizeClass(["slot-content",{"working-hour":b.isWorkingHour,"current-slot":h(b)}]),onClick:B=>k(b)},[u.showCurrentTimeIndicator&&h(b)?(e.openBlock(),e.createElementBlock("div",{key:0,class:"current-time-line",style:e.normalizeStyle({top:`${N.value}%`})},y[1]||(y[1]=[e.createElementVNode("div",{class:"time-marker"},null,-1)]),4)):e.createCommentVNode("",!0),e.createElementVNode("div",no,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o(b),B=>(e.openBlock(),e.createElementBlock("div",{key:B.id,class:"slot-event",style:e.normalizeStyle(a(B)),onClick:e.withModifiers(L=>_(B),["stop"])},[e.createElementVNode("div",ao,[e.createElementVNode("span",lo,e.toDisplayString(B.title),1),e.createElementVNode("span",ro,e.toDisplayString(i(B)),1)]),B.description?(e.openBlock(),e.createElementBlock("div",so,e.toDisplayString(B.description),1)):e.createCommentVNode("",!0),B.location?(e.openBlock(),e.createElementBlock("div",co,[y[2]||(y[2]=e.createElementVNode("span",{class:"location-icon"},"📍",-1)),e.createTextVNode(" "+e.toDisplayString(B.location),1)])):e.createCommentVNode("",!0)],12,oo))),128))])],10,to)]))),128))])]),e.createElementVNode("div",io,[e.createElementVNode("div",mo,[e.createElementVNode("div",ho,e.toDisplayString(Q.value),1),y[3]||(y[3]=e.createElementVNode("div",{class:"stat-label"},"Free Slots",-1))]),e.createElementVNode("div",go,[e.createElementVNode("div",ko,e.toDisplayString(P.value),1),y[4]||(y[4]=e.createElementVNode("div",{class:"stat-label"},"Busy Slots",-1))]),e.createElementVNode("div",uo,[e.createElementVNode("div",yo,e.toDisplayString(j.value)+"%",1),y[5]||(y[5]=e.createElementVNode("div",{class:"stat-label"},"Utilization",-1))])])],6))}}),[["__scopeId","data-v-79e73dec"]]),po={key:0,class:"scheduler-legend legend-top"},fo={key:1,class:"scheduler-header"},wo={key:0,class:"nav-controls"},Eo=["aria-label"],bo=["aria-label"],So={key:1,class:"period-title"},Bo={key:2,class:"view-switcher"},Co=["onClick"],$o={class:"scheduler-content"},Vo={key:2,class:"scheduler-legend legend-bottom"},se=ne(e.defineComponent({__name:"ResourceSchedulerCalendar",props:{events:{default:()=>[]},categories:{default:()=>[]},selectedDate:{default:()=>new Date},view:{default:"monthly"},theme:{default:"light"},locale:{default:"en-US"},timeInterval:{default:60},workingHours:{default:()=>({start:9,end:17,daysOfWeek:[1,2,3,4,5]})},showWeekNumbers:{type:Boolean,default:!1},showAllDaySlot:{type:Boolean,default:!0},allowEventCreation:{type:Boolean,default:!0},allowEventEditing:{type:Boolean,default:!0},allowEventDeletion:{type:Boolean,default:!0},minDate:{},maxDate:{},textLabels:{default:()=>({})},firstDayOfWeek:{default:0},enabledViews:{default:()=>["yearly","monthly","weekly","daily","hourly"]},defaultView:{},slotHeight:{default:()=>({hourly:60,daily:48,weekly:48})},responsiveBreakpoints:{default:()=>({mobile:480,tablet:768,desktop:1024})},headerOptions:{default:()=>({showNavigation:!0,showToday:!0,showViewSwitcher:!0,showTitle:!0})},legendOptions:{default:()=>({show:!0,position:"bottom"})},showCurrentTimeIndicator:{type:Boolean,default:!0},highlightToday:{type:Boolean,default:!0},highlightWeekends:{type:Boolean,default:!1},maxEventsPerSlot:{default:3},eventMinHeight:{default:20},compactMode:{type:Boolean,default:!1}},emits:["update:selectedDate","update:view","event-click","event-create","event-update","event-delete","slot-click","date-click","view-change","date-range-change","conflict-detected"],setup(A,{emit:J}){const t=A,p=J,D=e.ref(new Date(t.selectedDate)),w=e.ref(t.view),z=e.computed(()=>{const n=t.headerOptions;return(n==null?void 0:n.showNavigation)||(n==null?void 0:n.showToday)||(n==null?void 0:n.showViewSwitcher)||(n==null?void 0:n.showTitle)}),T=e.computed(()=>{var n;return((n=t.headerOptions)==null?void 0:n.showNavigation)!==!1}),H=e.computed(()=>{var n;return((n=t.headerOptions)==null?void 0:n.showToday)!==!1}),q=e.computed(()=>{var n;return((n=t.headerOptions)==null?void 0:n.showViewSwitcher)!==!1}),I=e.computed(()=>{var n;return((n=t.headerOptions)==null?void 0:n.showTitle)!==!1}),R=e.computed(()=>{var n;return((n=t.legendOptions)==null?void 0:n.show)===!1?!1:t.categories&&t.categories.length>0}),Q=e.computed(()=>{var n;return((n=t.legendOptions)==null?void 0:n.position)||"bottom"}),P=e.computed(()=>{var n,V,l;return{hourly:((n=t.slotHeight)==null?void 0:n.hourly)??60,daily:((V=t.slotHeight)==null?void 0:V.daily)??48,weekly:((l=t.slotHeight)==null?void 0:l.weekly)??48}}),j=e.computed(()=>{var n,V,l;return{"--breakpoint-mobile":`${((n=t.responsiveBreakpoints)==null?void 0:n.mobile)??480}px`,"--breakpoint-tablet":`${((V=t.responsiveBreakpoints)==null?void 0:V.tablet)??768}px`,"--breakpoint-desktop":`${((l=t.responsiveBreakpoints)==null?void 0:l.desktop)??1024}px`,"--slot-height-hourly":`${P.value.hourly}px`,"--slot-height-daily":`${P.value.daily}px`,"--slot-height-weekly":`${P.value.weekly}px`,"--event-min-height":`${t.eventMinHeight??20}px`}}),N=e.computed(()=>{var n,V,l,m,c,d,C,O,W,G,s,g,S,$,F,f,x;return{today:((n=t.textLabels)==null?void 0:n.today)||"Today",previousPeriod:((V=t.textLabels)==null?void 0:V.previousPeriod)||"Previous",nextPeriod:((l=t.textLabels)==null?void 0:l.nextPeriod)||"Next",yearView:((m=t.textLabels)==null?void 0:m.yearView)||"Year",monthView:((c=t.textLabels)==null?void 0:c.monthView)||"Month",weekView:((d=t.textLabels)==null?void 0:d.weekView)||"Week",dayView:((C=t.textLabels)==null?void 0:C.dayView)||"Day",hourView:((O=t.textLabels)==null?void 0:O.hourView)||"Hour",allDay:((W=t.textLabels)==null?void 0:W.allDay)||"All Day",noEvents:((G=t.textLabels)==null?void 0:G.noEvents)||"No events",createEvent:((s=t.textLabels)==null?void 0:s.createEvent)||"Create Event",editEvent:((g=t.textLabels)==null?void 0:g.editEvent)||"Edit Event",deleteEvent:((S=t.textLabels)==null?void 0:S.deleteEvent)||"Delete Event",eventDetails:(($=t.textLabels)==null?void 0:$.eventDetails)||"Event Details",conflictWarning:((F=t.textLabels)==null?void 0:F.conflictWarning)||"Time conflict detected",cancel:((f=t.textLabels)==null?void 0:f.cancel)||"Cancel",save:((x=t.textLabels)==null?void 0:x.save)||"Save"}}),M=e.computed(()=>[{value:"yearly",label:N.value.yearView},{value:"monthly",label:N.value.monthView},{value:"weekly",label:N.value.weekView},{value:"daily",label:N.value.dayView},{value:"hourly",label:N.value.hourView}]),E=e.computed(()=>{const n=t.enabledViews||["yearly","monthly","weekly","daily","hourly"];return M.value.filter(V=>n.includes(V.value))}),h=e.computed(()=>D.value.getFullYear()),r=e.computed(()=>{const n=D.value;switch(w.value){case"yearly":return n.getFullYear().toString();case"monthly":return new Intl.DateTimeFormat(t.locale,{year:"numeric",month:"long"}).format(n);case"weekly":{const V=o(n),l=new Date(V);l.setDate(l.getDate()+6);const m=new Intl.DateTimeFormat(t.locale,{month:"short",day:"numeric"}).format(V),c=new Intl.DateTimeFormat(t.locale,{month:"short",day:"numeric",year:"numeric"}).format(l);return`${m} - ${c}`}case"daily":case"hourly":return new Intl.DateTimeFormat(t.locale,{weekday:"long",year:"numeric",month:"long",day:"numeric"}).format(n);default:return new Intl.DateTimeFormat(t.locale,{year:"numeric",month:"long",day:"numeric"}).format(n)}}),o=n=>{const V=new Date(n),l=V.getDay(),m=(l<t.firstDayOfWeek?7:0)+l-t.firstDayOfWeek;return V.setDate(V.getDate()-m),V.setHours(0,0,0,0),V},a=n=>{const V=n.getFullYear(),l=String(n.getMonth()+1).padStart(2,"0"),m=String(n.getDate()).padStart(2,"0");return`${V}-${l}-${m}`},i=()=>{const n=new Date(D.value);switch(w.value){case"yearly":n.setFullYear(n.getFullYear()-1);break;case"monthly":n.setMonth(n.getMonth()-1);break;case"weekly":n.setDate(n.getDate()-7);break;case"daily":case"hourly":n.setDate(n.getDate()-1);break}D.value=n,p("update:selectedDate",n),y()},k=()=>{const n=new Date(D.value);switch(w.value){case"yearly":n.setFullYear(n.getFullYear()+1);break;case"monthly":n.setMonth(n.getMonth()+1);break;case"weekly":n.setDate(n.getDate()+7);break;case"daily":case"hourly":n.setDate(n.getDate()+1);break}D.value=n,p("update:selectedDate",n),y()},_=()=>{D.value=new Date,p("update:selectedDate",D.value),y()},u=n=>{(t.enabledViews||["yearly","monthly","weekly","daily","hourly"]).includes(n)&&(w.value=n,p("update:view",n),p("view-change",n),y())},y=()=>{const n=b();p("date-range-change",n)},b=()=>{const n=D.value;let V,l;switch(w.value){case"yearly":V=new Date(n.getFullYear(),0,1),l=new Date(n.getFullYear(),11,31);break;case"monthly":V=new Date(n.getFullYear(),n.getMonth(),1),l=new Date(n.getFullYear(),n.getMonth()+1,0);break;case"weekly":V=o(n),l=new Date(V),l.setDate(l.getDate()+6);break;case"daily":case"hourly":default:V=new Date(n),V.setHours(0,0,0,0),l=new Date(n),l.setHours(23,59,59,999);break}return{start:a(V),end:a(l)}},B=n=>{const V=new Date(D.value);V.setMonth(n),D.value=V,(t.enabledViews||["yearly","monthly","weekly","daily","hourly"]).includes("monthly")&&u("monthly")},L=n=>{D.value=new Date(n),p("date-click",n),p("update:selectedDate",D.value)},U=n=>{p("event-click",n)},X=n=>{p("slot-click",n),t.allowEventCreation&&p("event-create",{start:n.start,end:n.end,allDay:!1})};return e.watch(()=>t.selectedDate,n=>{n&&(D.value=new Date(n))}),e.watch(()=>t.view,n=>{n&&(w.value=n)}),e.watch(()=>t.enabledViews,n=>{n&&n.length>0&&!n.includes(w.value)&&(w.value=n[0],p("update:view",w.value),p("view-change",w.value))},{immediate:!0}),(n,V)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["resource-scheduler-calendar",[`theme-${n.theme}`,{"compact-mode":n.compactMode},{"highlight-weekends":n.highlightWeekends}]]),style:e.normalizeStyle(j.value)},[R.value&&Q.value==="top"?(e.openBlock(),e.createElementBlock("div",po,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.categories,l=>(e.openBlock(),e.createElementBlock("div",{key:l.id,class:"legend-item"},[e.createElementVNode("div",{class:"legend-color",style:e.normalizeStyle({backgroundColor:n.theme==="dark"&&l.darkBackgroundColor?l.darkBackgroundColor:l.backgroundColor,borderColor:l.color})},null,4),e.createElementVNode("span",null,e.toDisplayString(l.name),1)]))),128))])):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createElementBlock("div",fo,[T.value?(e.openBlock(),e.createElementBlock("div",wo,[e.createElementVNode("button",{type:"button",onClick:i,class:"nav-btn","aria-label":N.value.previousPeriod},V[0]||(V[0]=[e.createElementVNode("span",{class:"nav-arrow"},"‹",-1)]),8,Eo),H.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",onClick:_,class:"today-btn"},e.toDisplayString(N.value.today),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",onClick:k,class:"nav-btn","aria-label":N.value.nextPeriod},V[1]||(V[1]=[e.createElementVNode("span",{class:"nav-arrow"},"›",-1)]),8,bo)])):e.createCommentVNode("",!0),I.value?(e.openBlock(),e.createElementBlock("h2",So,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0),q.value&&E.value.length>1?(e.openBlock(),e.createElementBlock("div",Bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,l=>(e.openBlock(),e.createElementBlock("button",{key:l.value,type:"button",onClick:m=>u(l.value),class:e.normalizeClass(["view-btn",{active:w.value===l.value}])},e.toDisplayString(l.label),11,Co))),128))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",$o,[w.value==="yearly"?(e.openBlock(),e.createBlock(vt,{key:0,year:h.value,events:n.events,theme:n.theme,locale:n.locale,categories:n.categories,"highlight-today":n.highlightToday,"first-day-of-week":n.firstDayOfWeek,onMonthClick:B,onDateClick:L},null,8,["year","events","theme","locale","categories","highlight-today","first-day-of-week"])):w.value==="monthly"?(e.openBlock(),e.createBlock(dn,{key:1,"current-date":D.value,events:n.events,theme:n.theme,locale:n.locale,categories:n.categories,"first-day-of-week":n.firstDayOfWeek,"highlight-today":n.highlightToday,"highlight-weekends":n.highlightWeekends,"max-events-per-slot":n.maxEventsPerSlot,"show-week-numbers":n.showWeekNumbers,onDateClick:L,onEventClick:U,onSlotClick:X},null,8,["current-date","events","theme","locale","categories","first-day-of-week","highlight-today","highlight-weekends","max-events-per-slot","show-week-numbers"])):w.value==="weekly"?(e.openBlock(),e.createBlock(bn,{key:2,"current-date":D.value,events:n.events,theme:n.theme,locale:n.locale,categories:n.categories,"working-hours":n.workingHours,"time-interval":n.timeInterval,"first-day-of-week":n.firstDayOfWeek,"show-all-day-slot":n.showAllDaySlot,"highlight-today":n.highlightToday,"highlight-weekends":n.highlightWeekends,"show-current-time-indicator":n.showCurrentTimeIndicator,"slot-height":P.value.weekly,"event-min-height":n.eventMinHeight,onDateClick:L,onEventClick:U,onSlotClick:X},null,8,["current-date","events","theme","locale","categories","working-hours","time-interval","first-day-of-week","show-all-day-slot","highlight-today","highlight-weekends","show-current-time-indicator","slot-height","event-min-height"])):w.value==="daily"?(e.openBlock(),e.createBlock(An,{key:3,"current-date":D.value,events:n.events,theme:n.theme,locale:n.locale,categories:n.categories,"working-hours":n.workingHours,"time-interval":n.timeInterval,"show-all-day-slot":n.showAllDaySlot,"highlight-today":n.highlightToday,"show-current-time-indicator":n.showCurrentTimeIndicator,"slot-height":P.value.daily,"event-min-height":n.eventMinHeight,onEventClick:U,onSlotClick:X},null,8,["current-date","events","theme","locale","categories","working-hours","time-interval","show-all-day-slot","highlight-today","show-current-time-indicator","slot-height","event-min-height"])):w.value==="hourly"?(e.openBlock(),e.createBlock(Do,{key:4,"current-date":D.value,events:n.events,theme:n.theme,locale:n.locale,categories:n.categories,"working-hours":n.workingHours,"time-interval":n.timeInterval,"show-current-time-indicator":n.showCurrentTimeIndicator,"slot-height":P.value.hourly,"event-min-height":n.eventMinHeight,onEventClick:U,onSlotClick:X},null,8,["current-date","events","theme","locale","categories","working-hours","time-interval","show-current-time-indicator","slot-height","event-min-height"])):e.createCommentVNode("",!0)]),R.value&&Q.value==="bottom"?(e.openBlock(),e.createElementBlock("div",Vo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.categories,l=>(e.openBlock(),e.createElementBlock("div",{key:l.id,class:"legend-item"},[e.createElementVNode("div",{class:"legend-color",style:e.normalizeStyle({backgroundColor:n.theme==="dark"&&l.darkBackgroundColor?l.darkBackgroundColor:l.backgroundColor,borderColor:l.color})},null,4),e.createElementVNode("span",null,e.toDisplayString(l.name),1)]))),128))])):e.createCommentVNode("",!0)],6))}}),[["__scopeId","data-v-6cd84d42"]]),_o={install(A){A.component("HotelBookingCalendar",le),A.component("HotelDashboardCalendar",re),A.component("ResourceSchedulerCalendar",se)}};te.HotelBookingCalendar=le,te.HotelDashboardCalendar=re,te.ResourceSchedulerCalendar=se,te.default=_o,Object.defineProperties(te,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});