UNPKG

@quasar/quasar-ui-qcalendar

Version:

QCalendar - Day/Month/Week Calendars, Popups, Date Pickers, Schedules, Agendas, Planners and Tasks for your Vue Apps

6 lines 45.3 kB
/*! * @quasar/quasar-ui-qcalendar v4.1.2 * (c) 2025 Jeff Galbraith <jeff@quasar.dev> * Released under the MIT License. */ import{reactive,ref,computed,withDirectives,h,watch,getCurrentInstance,onBeforeUnmount,defineComponent,onBeforeUpdate,onMounted,Transition}from"vue";const PARSE_DATETIME=/^(\d{4})-(\d{1,2})(-(\d{1,2}))?([^\d]+(\d{1,2}))?(:(\d{1,2}))?(:(\d{1,2}))?(.(\d{1,3}))?$/,PARSE_DATE=/^(\d{4})-(\d{1,2})(-(\d{1,2}))?/,PARSE_TIME=/(\d\d?)(:(\d\d?)|)(:(\d\d?)|)/,DAYS_IN_MONTH=[0,31,28,31,30,31,30,31,31,30,31,30,31],DAYS_IN_MONTH_LEAP=[0,31,29,31,30,31,30,31,31,30,31,30,31],TIME_CONSTANTS={MILLISECONDS_IN:{SECOND:1e3,MINUTE:6e4,HOUR:36e5,DAY:864e5,WEEK:6048e5},SECONDS_IN:{MINUTE:60,HOUR:3600,DAY:86400,WEEK:604800},MINUTES_IN:{MINUTE:1,HOUR:60,DAY:1440,WEEK:10080},HOURS_IN:{DAY:24,WEEK:168},DAYS_IN:{WEEK:7}},DAYS_IN_MONTH_MIN=28,DAYS_IN_MONTH_MAX=31,MONTH_MAX=12,MONTH_MIN=1,DAY_MIN=1,FIRST_HOUR=0;function validateTimestamp(e){return"string"===typeof e&&PARSE_DATETIME.test(e)}function parsed(e){if("string"!==typeof e)return null;const t=PARSE_DATETIME.exec(e);if(!t||!t[1]||!t[2])return null;const a=parseInt(t[1],10),n=parseInt(t[2],10),r=parseInt(t[4]||"1",10),d=parseInt(t[6]||"0",10),o=parseInt(t[8]||"0",10);return{date:e,time:d.toString().padStart(2,"0")+":"+o.toString().padStart(2,"0"),year:a,month:n,day:r,hour:d,minute:o,hasDay:!!t[4],hasTime:!0,past:!1,current:!1,future:!1,disabled:!1,weekday:0,doy:0,workweek:0}}function parseDate(e,t=!1){if(!(e instanceof Date))return null;const a=t?"UTC":"";return updateFormatted({date:padNumber(e[`get${a}FullYear`](),4)+"-"+padNumber(e[`get${a}Month`]()+1,2)+"-"+padNumber(e[`get${a}Date`](),2),time:padNumber(e[`get${a}Hours`]()||0,2)+":"+padNumber(e[`get${a}Minutes`]()||0,2),year:e[`get${a}FullYear`](),month:e[`get${a}Month`]()+1,day:e[`get${a}Date`](),hour:e[`get${a}Hours`](),minute:e[`get${a}Minutes`](),weekday:0,doy:0,workweek:0,hasDay:!0,hasTime:!0,past:!1,current:!1,future:!1,disabled:!1})}function padNumber(e,t){let a=String(e);while(a.length<t)a="0"+a;return a}function isLeapYear(e){return e%4===0&&e%100!==0||e%400===0}function daysInMonth(e,t){return(isLeapYear(e)?DAYS_IN_MONTH_LEAP:DAYS_IN_MONTH)[t]}function nextDay(e){const t=new Date(e.year,e.month-1,e.day+1);return updateFormatted(normalizeTimestamp({...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}))}function prevDay(e){const t=new Date(e.year,e.month-1,e.day-1);return updateFormatted(normalizeTimestamp({...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}))}function today(){const e=new Date,t=e.getMonth()+1,a=e.getDate(),n=e.getFullYear();return[n,padNumber(t,2),padNumber(a,2)].join("-")}function isToday(e){return e===today()}function getStartOfWeek(e,t,a){let n=copyTimestamp(e);if(t){if(1===n.day||0===n.weekday)while(!t.includes(Number(n.weekday)))n=nextDay(n);n=findWeekday(n,t[0],prevDay),n=updateFormatted(n),a&&(n=updateRelative(n,a,n.hasTime))}return n}function getEndOfWeek(e,t,a){let n=copyTimestamp(e);if(t&&Array.isArray(t)){const r=daysInMonth(n.year,n.month);if(r===n.day||n.weekday===t[t.length-1])while(!t.includes(Number(n.weekday)))n=prevDay(n);n=findWeekday(n,t[t.length-1],nextDay),n=updateFormatted(n),a&&(n=updateRelative(n,a,n.hasTime))}return n}function getStartOfMonth(e){let t=copyTimestamp(e);return t.day=DAY_MIN,t=updateFormatted(t),t}function getEndOfMonth(e){let t=copyTimestamp(e);return t.day=daysInMonth(t.year,t.month),t=updateFormatted(t),t}function parseTime(e){const t=Object.prototype.toString.call(e);switch(t){case"[object Number]":return e;case"[object String]":{const a=PARSE_TIME.exec(e);return a?60*parseInt(a[1],10)+parseInt(a[3]||"0",10):!1}case"[object Object]":return"object"!==typeof e||"number"!==typeof e.hour||"number"!==typeof e.minute?!1:"object"===typeof e&&"hour"in e&&"minute"in e&&60*e.hour+e.minute}return!1}function compareTimestamps(e,t){return!(!e||!t)&&e.year===t.year&&e.month===t.month&&e.day===t.day&&e.hour===t.hour&&e.minute===t.minute}function compareDate(e,t){return getDate(e)===getDate(t)}function compareTime(e,t){return getTime(e)===getTime(t)}function compareDateTime(e,t){return getDateTime(e)===getDateTime(t)}function parseTimestamp(e,t=null){let a=parsed(e);return a?(a=updateFormatted(a),t&&(a=updateRelative(a,t,a.hasTime)),a):null}function getDayIdentifier(e){return 1e8*(e.year??0)+1e6*(e.month??0)+1e4*(e.day??0)}function getTimeIdentifier(e){return 100*(e.hour??0)+(e.minute??0)}function getDayTimeIdentifier(e){return getDayIdentifier(e)+getTimeIdentifier(e)}function diffTimestamp(e,t,a=!1){const n=Date.UTC(e.year??0,(e.month??1)-1,e.day??1,e.hour??0,e.minute??0),r=Date.UTC(t.year??0,(t.month??1)-1,t.day??1,t.hour??0,t.minute??0);return!0===a&&r<n?0:r-n}function updateRelative(e,t,a=!1){let n=copyTimestamp(e),r=getDayIdentifier(t),d=getDayIdentifier(n),o=r===d;return n.hasTime&&a&&o&&(r=getTimeIdentifier(t),d=getTimeIdentifier(n),o=r===d),n.past=d<r,n.current=o,n.future=d>r,n.currentWeekday=n.weekday===t.weekday,n}function updateMinutes(e,t,a=null){let n=copyTimestamp(e);return n.hasTime=!0,n.hour=Math.floor(t/TIME_CONSTANTS.MINUTES_IN.HOUR),n.minute=t%TIME_CONSTANTS.MINUTES_IN.HOUR,n.time=getTime(n),a&&(n=updateRelative(n,a,!0)),n}function updateWeekday(e){let t=copyTimestamp(e);return t.weekday=getWeekday(t),t}function updateDayOfYear(e){let t=copyTimestamp(e);return t.doy=getDayOfYear(t)||0,t}function updateWorkWeek(e){let t=copyTimestamp(e);return t.workweek=getWorkWeek(t),t}function updateDisabled(e,t,a,n,r){let d=copyTimestamp(e);const o=getDayIdentifier(d);if(void 0!==t){const l=parsed(t);if(l){const c=getDayIdentifier(l);o<=c&&(d.disabled=!0)}}if(!0!==d.disabled&&void 0!==a){const m=parsed(a);if(m){const y=getDayIdentifier(m);o>=y&&(d.disabled=!0)}}if(!0!==d.disabled&&Array.isArray(n)&&n.length>0)for(var i in n)if(n[i]===d.weekday){d.disabled=!0;break}if(!0!==d.disabled&&Array.isArray(r)&&r.length>0)for(var s in r)if(Array.isArray(r[s])&&2===r[s].length&&r[s][0]&&r[s][1]){const p=parsed(r[s][0]),f=parsed(r[s][1]);if(p&&f&&isBetweenDates(d,p,f)){d.disabled=!0;break}}else{const v=r[s];if(Array.isArray(v))for(var u of v){const h=parseTimestamp(u);if(h){const T=getDayIdentifier(h);if(T===o){d.disabled=!0;break}}}else if(v){const g=parseTimestamp(v);if(g){const D=getDayIdentifier(g);D===o&&(d.disabled=!0)}}}return d}function updateFormatted(e){let t=copyTimestamp(e);return t.hasTime=!0,t.time=getTime(t),t.date=getDate(t),t.weekday=getWeekday(t),t.doy=getDayOfYear(t)||0,t.workweek=getWorkWeek(t),t}function getDayOfYear(e){if(0!==e.year)return(Date.UTC(e.year,e.month-1,e.day)-Date.UTC(e.year,0,0))/24/60/60/1e3}function getWorkWeek(e){let t=copyTimestamp(e);if(0===t.year){const r=parseTimestamp(today());r&&(t=r)}const a=new Date(Date.UTC(t.year,t.month-1,t.day)),n=4;a.setUTCDate(a.getUTCDate()-(a.getUTCDay()+6)%7+n),a.setUTCDate(a.getUTCDate()+n-(a.getUTCDay()||7));e=new Date(Date.UTC(a.getUTCFullYear(),0,1)),e=Math.ceil(((a.valueOf()-e.valueOf())/864e5+1)/7);return e}function getWeekday(e){let t=e.weekday;if(e.hasDay){const a=Math.floor,n=e.day,r=(e.month+9)%MONTH_MAX+1,d=a(e.year/100),o=e.year%100-(e.month<=2?1:0);t=((n+a(2.6*r-.2)-2*d+o+a(o/4)+a(d/4))%7+7)%7}return t??0}function copyTimestamp(e){return{...e}}function getDate(e){let t=padNumber(e.year,4)+"-"+padNumber(e.month,2);return e.hasDay&&(t+="-"+padNumber(e.day,2)),t}function getTime(e){return e.hasTime?padNumber(e.hour,2)+":"+padNumber(e.minute,2):""}function getDateTime(e){return getDate(e)+" "+(e.hasTime?getTime(e):"00:00")}function moveRelativeDays(e,t=nextDay,a=1,n=[0,1,2,3,4,5,6]){const r=copyTimestamp(e);return relativeDays(r,t,a,n)}function relativeDays(e,t=nextDay,a=1,n=[0,1,2,3,4,5,6]){let r=copyTimestamp(e);n.includes(Number(r.weekday))||0!==r.weekday||t!==nextDay||++a;while(--a>=0)r=t(r),n.length<7&&!n.includes(Number(r.weekday))&&++a;return r}function findWeekday(e,t,a=nextDay,n=6){let r=copyTimestamp(e);while(r.weekday!==t&&--n>=0)r=a(r);return r}function createDayList(e,t,a,n=[0,1,2,3,4,5,6],r=void 0,d=void 0,o=[],i=[],s=42,u=0){const l=getDayIdentifier(e),c=getDayIdentifier(t),m=[];let y=copyTimestamp(e),p=0,f=p===c;if(!(c<l))while((!f||m.length<u)&&m.length<s){if(p=getDayIdentifier(y),f=f||p>c&&m.length>=u,f)break;if(n.includes(Number(y.weekday))){let e=copyTimestamp(y);e=updateFormatted(e),e=updateRelative(e,a),e=updateDisabled(e,r,d,o,i),m.push(e)}y=relativeDays(y,nextDay)}return m}function createIntervalList(t,a,n,r,d){const o=[];for(let e=0;e<r;++e){const i=(a+e)*n,s=copyTimestamp(t);o.push(updateMinutes(s,i,d))}return o}function createNativeLocaleFormatter(n,r){const e=()=>"";return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?e:(t,e)=>{try{const a=new Intl.DateTimeFormat(n||void 0,r(t,e));return a.format(makeDateTime(t))}catch(e){return console.error(`Intl.DateTimeFormat: ${e.message} -> `+getDateTime(t)),""}}}function makeDate(e,t=!0){return t?new Date(Date.UTC(e.year,e.month-1,e.day,0,0)):new Date(e.year,e.month-1,e.day,0,0)}function makeDateTime(e,t=!0){return t?new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute)):new Date(e.year,e.month-1,e.day,e.hour,e.minute)}function validateNumber(e){return isFinite(Number(e))}function maxTimestamp(e,t=!1){const a=!0===t?getDayTimeIdentifier:getDayIdentifier;return e.reduce((e,t)=>{return Math.max(a(e),a(t))===a(e)?e:t})}function minTimestamp(e,t=!1){const a=!0===t?getDayTimeIdentifier:getDayIdentifier;return e.reduce((e,t)=>{return Math.min(a(e),a(t))===a(e)?e:t})}function isBetweenDates(e,t,a,n=!1){const r=getDayIdentifier(e)+(!0===n?getTimeIdentifier(e):0),d=getDayIdentifier(t)+(!0===n?getTimeIdentifier(t):0),o=getDayIdentifier(a)+(!0===n?getTimeIdentifier(a):0);return r>=d&&r<=o}function isOverlappingDates(e,t,a,n){const r=getDayIdentifier(e),d=getDayIdentifier(t),o=getDayIdentifier(a),i=getDayIdentifier(n);return r>=o&&r<=i||d>=o&&d<=i||o>=r&&d>=i}function addToDate(e,t){const a=copyTimestamp(e);return t.year&&(a.year+=t.year),t.month&&(a.month+=t.month),t.day&&(a.day+=t.day),t.hour&&(a.hour+=t.hour),t.minute&&(a.minute+=t.minute),updateFormatted(normalizeTimestamp(a))}function normalizeTimestamp(e){const t=new Date(e.year,e.month-1,e.day,e.hour,e.minute);return{...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate(),hour:t.getHours(),minute:t.getMinutes()}}function daysBetween(e,t){const a=diffTimestamp(e,t,!0);return Math.floor(a/TIME_CONSTANTS.MILLISECONDS_IN.DAY)}function weeksBetween(e,t){let a=copyTimestamp(e),n=copyTimestamp(t);return a=findWeekday(a,0),n=findWeekday(n,6),Math.ceil(daysBetween(a,n)/TIME_CONSTANTS.DAYS_IN.WEEK)}const weekdayDateMap={Sun:new Date("2020-01-05T00:00:00.000Z"),Mon:new Date("2020-01-06T00:00:00.000Z"),Tue:new Date("2020-01-07T00:00:00.000Z"),Wed:new Date("2020-01-08T00:00:00.000Z"),Thu:new Date("2020-01-09T00:00:00.000Z"),Fri:new Date("2020-01-10T00:00:00.000Z"),Sat:new Date("2020-01-11T00:00:00.000Z")};function getWeekdayFormatter(){const e=()=>"",r={long:{timeZone:"UTC",weekday:"long"},short:{timeZone:"UTC",weekday:"short"},narrow:{timeZone:"UTC",weekday:"narrow"}};return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?e:t;function t(t,e,a){try{const n=new Intl.DateTimeFormat(a||void 0,r[e]||r["long"]);return n.format(weekdayDateMap[t])}catch(e){return e instanceof Error&&console.error(`Intl.DateTimeFormat: ${e.message} -> day of week: `+t),""}}}function getWeekdayNames(t,a){const e=Object.keys(weekdayDateMap),n=getWeekdayFormatter();return e.map(e=>String(n(e,t,a)))}function getMonthFormatter(){const e=()=>"",d={long:{timeZone:"UTC",month:"long"},short:{timeZone:"UTC",month:"short"},narrow:{timeZone:"UTC",month:"narrow"}};return"undefined"===typeof Intl||"undefined"===typeof Intl.DateTimeFormat?e:t;function t(t,e,a){try{const n=new Intl.DateTimeFormat(a||void 0,d[e]||d["long"]),r=new Date;return r.setDate(1),r.setMonth(t),n.format(r)}catch(e){return e instanceof Error&&console.error(`Intl.DateTimeFormat: ${e.message} -> month: `+t),""}}}function getMonthNames(t,a){const n=getMonthFormatter();return[...Array(12).keys()].map(e=>n(e,t,a))}var Timestamp={PARSE_DATETIME:PARSE_DATETIME,PARSE_DATE:PARSE_DATE,PARSE_TIME:PARSE_TIME,DAYS_IN_MONTH:DAYS_IN_MONTH,DAYS_IN_MONTH_LEAP:DAYS_IN_MONTH_LEAP,DAYS_IN_MONTH_MIN:DAYS_IN_MONTH_MIN,DAYS_IN_MONTH_MAX:DAYS_IN_MONTH_MAX,MONTH_MAX:MONTH_MAX,MONTH_MIN:MONTH_MIN,DAY_MIN:DAY_MIN,TIME_CONSTANTS:TIME_CONSTANTS,FIRST_HOUR:FIRST_HOUR,today:today,getStartOfWeek:getStartOfWeek,getEndOfWeek:getEndOfWeek,getStartOfMonth:getStartOfMonth,getEndOfMonth:getEndOfMonth,parseTime:parseTime,validateTimestamp:validateTimestamp,parsed:parsed,parseTimestamp:parseTimestamp,parseDate:parseDate,getDayIdentifier:getDayIdentifier,getTimeIdentifier:getTimeIdentifier,getDayTimeIdentifier:getDayTimeIdentifier,diffTimestamp:diffTimestamp,updateRelative:updateRelative,updateMinutes:updateMinutes,updateWeekday:updateWeekday,updateDayOfYear:updateDayOfYear,updateWorkWeek:updateWorkWeek,updateDisabled:updateDisabled,updateFormatted:updateFormatted,getDayOfYear:getDayOfYear,getWorkWeek:getWorkWeek,getWeekday:getWeekday,isLeapYear:isLeapYear,daysInMonth:daysInMonth,copyTimestamp:copyTimestamp,padNumber:padNumber,getDate:getDate,getTime:getTime,getDateTime:getDateTime,nextDay:nextDay,prevDay:prevDay,relativeDays:relativeDays,findWeekday:findWeekday,createDayList:createDayList,createIntervalList:createIntervalList,createNativeLocaleFormatter:createNativeLocaleFormatter,makeDate:makeDate,makeDateTime:makeDateTime,validateNumber:validateNumber,isBetweenDates:isBetweenDates,isOverlappingDates:isOverlappingDates,daysBetween:daysBetween,weeksBetween:weeksBetween,addToDate:addToDate,compareTimestamps:compareTimestamps,compareDate:compareDate,compareTime:compareTime,compareDateTime:compareDateTime,getWeekdayFormatter:getWeekdayFormatter,getWeekdayNames:getWeekdayNames,getMonthFormatter:getMonthFormatter,getMonthNames:getMonthNames},Timestamp$1=Object.freeze({__proto__:null,DAYS_IN_MONTH:DAYS_IN_MONTH,DAYS_IN_MONTH_LEAP:DAYS_IN_MONTH_LEAP,DAYS_IN_MONTH_MAX:DAYS_IN_MONTH_MAX,DAYS_IN_MONTH_MIN:DAYS_IN_MONTH_MIN,DAY_MIN:DAY_MIN,FIRST_HOUR:FIRST_HOUR,MONTH_MAX:MONTH_MAX,MONTH_MIN:MONTH_MIN,PARSE_DATE:PARSE_DATE,PARSE_DATETIME:PARSE_DATETIME,PARSE_TIME:PARSE_TIME,TIME_CONSTANTS:TIME_CONSTANTS,addToDate:addToDate,compareDate:compareDate,compareDateTime:compareDateTime,compareTime:compareTime,compareTimestamps:compareTimestamps,copyTimestamp:copyTimestamp,createDayList:createDayList,createIntervalList:createIntervalList,createNativeLocaleFormatter:createNativeLocaleFormatter,daysBetween:daysBetween,daysInMonth:daysInMonth,default:Timestamp,diffTimestamp:diffTimestamp,findWeekday:findWeekday,getDate:getDate,getDateTime:getDateTime,getDayIdentifier:getDayIdentifier,getDayOfYear:getDayOfYear,getDayTimeIdentifier:getDayTimeIdentifier,getEndOfMonth:getEndOfMonth,getEndOfWeek:getEndOfWeek,getMonthFormatter:getMonthFormatter,getMonthNames:getMonthNames,getStartOfMonth:getStartOfMonth,getStartOfWeek:getStartOfWeek,getTime:getTime,getTimeIdentifier:getTimeIdentifier,getWeekday:getWeekday,getWeekdayFormatter:getWeekdayFormatter,getWeekdayNames:getWeekdayNames,getWorkWeek:getWorkWeek,isBetweenDates:isBetweenDates,isLeapYear:isLeapYear,isOverlappingDates:isOverlappingDates,isToday:isToday,makeDate:makeDate,makeDateTime:makeDateTime,maxTimestamp:maxTimestamp,minTimestamp:minTimestamp,moveRelativeDays:moveRelativeDays,nextDay:nextDay,padNumber:padNumber,parseDate:parseDate,parseTime:parseTime,parseTimestamp:parseTimestamp,parsed:parsed,prevDay:prevDay,relativeDays:relativeDays,today:today,updateDayOfYear:updateDayOfYear,updateDisabled:updateDisabled,updateFormatted:updateFormatted,updateMinutes:updateMinutes,updateRelative:updateRelative,updateWeekday:updateWeekday,updateWorkWeek:updateWorkWeek,validateNumber:validateNumber,validateTimestamp:validateTimestamp,weeksBetween:weeksBetween});function convertToUnit(e,t="px"){if(e)return isNaN(e)?String(e):"auto"===e?e:""+Number(e)+t}function indexOf(t,a){for(let e=0;e<t.length;e++)if(!0===a(t[e],e))return e;return-1}function minCharWidth(e,t){return 0===t?e:e.slice(0,t)}var helpers={convertToUnit:convertToUnit,indexOf:indexOf,minCharWidth:minCharWidth},helpers$1=Object.freeze({__proto__:null,convertToUnit:convertToUnit,default:helpers,indexOf:indexOf,minCharWidth:minCharWidth});const toCamelCase=e=>e.replace(/(-\w)/g,e=>e[1].toUpperCase());function getMouseEventHandlers(t,e,a,n){const r={};for(const d in a){const o=a[d],i=toCamelCase("on-"+d);if(!e.value)return console.warn("$listeners has not been set up"),{};if(void 0!==e.value[i]){const s="on"+o.event.charAt(0).toUpperCase()+o.event.slice(1),u=e=>{return(void 0===o.button||"buttons"in e&&e.buttons>0&&e.button===o.button)&&(o.prevent&&e.preventDefault(),o.stop&&e.stopPropagation(),t(d,n(e,d))),o.result};s in r?Array.isArray(r[s])?r[s].push(u):r[s]=[r[s],u]:r[s]=u}}return r}function getDefaultMouseEventHandlers(e,t,a,n){return getMouseEventHandlers(e,t,getMouseEventName(a),n)}function getMouseEventName(e){return{["click"+e]:{event:"click"},["contextmenu"+e]:{event:"contextmenu",prevent:!0,result:!1},["mousedown"+e]:{event:"mousedown"},["mousemove"+e]:{event:"mousemove"},["mouseup"+e]:{event:"mouseup"},["mouseenter"+e]:{event:"mouseenter"},["mouseleave"+e]:{event:"mouseleave"},["touchstart"+e]:{event:"touchstart"},["touchmove"+e]:{event:"touchmove"},["touchend"+e]:{event:"touchend"}}}function getRawMouseEvents(e){return Object.keys(getMouseEventName(e))}function useMouseEvents(a,n){return{getMouseEventHandlers:(e,t)=>getMouseEventHandlers(a,n,e,t),getDefaultMouseEventHandlers:(e,t)=>getDefaultMouseEventHandlers(a,n,e,t),getMouseEventName:getMouseEventName,getRawMouseEvents:getRawMouseEvents}}const ResizeObserverDirective={mounted(e,t){if("function"===typeof t.value){const a=t.value,n={callback:a,size:{width:0,height:0},observer:new ResizeObserver(e=>{const t=e[0].contentRect;t.width===n.size.width&&t.height===n.size.height||(n.size.width=t.width,n.size.height=t.height,n.debounceTimeout&&clearTimeout(n.debounceTimeout),n.debounceTimeout=setTimeout(()=>{n.callback(n.size),n.debounceTimeout=void 0},100))})};n.observer.observe(e),e.__onResizeObserver=n}},beforeUnmount(e){if(e.__onResizeObserver){const{observer:t,debounceTimeout:a}=e.__onResizeObserver;a&&clearTimeout(a),t.unobserve(e),delete e.__onResizeObserver}}};function useCalendar(t,a,{scrollArea:e,pane:n}){if(!a){const l="[error: renderCalendar] no renderFunc has been supplied to useCalendar";throw console.error(l),new Error(l)}const r=reactive({width:0,height:0}),d=ref(null);function o({width:e,height:t}){r.width=e,r.height=t}const i=computed(()=>{return!0!==t.noScroll&&e.value&&n.value&&r.height?e.value.offsetWidth-n.value.offsetWidth:0});function s(){}function u(){const e={ref:d,role:"complementary",lang:t.locale,class:`q-calendar ${t.dark?"q-calendar--dark":""} `+(t.bordered?"q-calendar__bordered":"")};return withDirectives(h("div",{...e},[a()]),[[ResizeObserverDirective,o]])}return{rootRef:d,scrollWidth:i,__initCalendar:s,__renderCalendar:u}}const isValidFocusType=e=>e.every(e=>["day","date","weekday","interval","time","resource","task"].includes(e)),useCommonProps={modelValue:{type:String,default:today(),validator:e=>""===e||validateTimestamp(e)},weekdays:{type:Array,default:()=>[0,1,2,3,4,5,6]},dateType:{type:String,default:"round",validator:e=>["round","rounded","square"].includes(e)},weekdayAlign:{type:String,default:"center",validator:e=>["left","center","right"].includes(e)},dateAlign:{type:String,default:"center",validator:e=>["left","center","right"].includes(e)},bordered:Boolean,dark:Boolean,noAria:Boolean,noActiveDate:Boolean,noHeader:Boolean,noScroll:Boolean,shortWeekdayLabel:Boolean,noDefaultHeaderText:Boolean,noDefaultHeaderBtn:Boolean,minWeekdayLabel:{type:[Number,String],default:1},weekdayBreakpoints:{type:Array,default:()=>[75,35],validator:e=>2===e.length},locale:{type:String,default:"en-US"},animated:Boolean,transitionPrev:{type:String,default:"slide-right"},transitionNext:{type:String,default:"slide-left"},disabledDays:Array,disabledBefore:String,disabledAfter:String,disabledWeekdays:{type:Array,default:()=>[]},dragEnterFunc:Function,dragOverFunc:Function,dragLeaveFunc:Function,dropFunc:Function,selectedDates:{type:[Array,Set],default:()=>[]},selectedStartEndDates:{type:Array,default:()=>[]},hoverable:Boolean,focusable:Boolean,focusType:{type:Array,default:()=>["date"],validator:isValidFocusType}};function useCommon(t,{startDate:e,endDate:a,times:n}){const r=computed(()=>parseTimestamp(e.value)),d=computed(()=>{return"0000-00-00"===a.value?getEndOfWeek(r.value,t.weekdays,n.today):parseTimestamp(a.value)||r.value}),o=computed(()=>createNativeLocaleFormatter(t.locale,()=>({timeZone:"UTC",day:"numeric"}))),i=computed(()=>createNativeLocaleFormatter(t.locale,(e,t)=>({timeZone:"UTC",weekday:t?"short":"long"}))),s=computed(()=>createNativeLocaleFormatter(t.locale,()=>({timeZone:"UTC",dateStyle:"full"})));function u(e,t){return e&&e.length>0&&e.includes(t.date)}function l(e,t){const a={firstDay:!1,betweenDays:!1,lastDay:!1};if(2===e.length){const n=getDayIdentifier(t),r=getDayIdentifier(parsed(e[0])),d=getDayIdentifier(parsed(e[1]));a.firstDay=r===n,a.lastDay=d===n,a.betweenDays=r<n&&d>n}return a}function c(e,t=!1,a=[],n=[],r=!1){const d=u(a,e),{firstDay:o,lastDay:i,betweenDays:s}=l(n,e);return{"q-past-day":!o&&!s&&!i&&!d&&!t&&!!e.past,"q-future-day":!o&&!s&&!i&&!d&&!t&&!!e.future,"q-outside":t,"q-current-day":!!e.current,"q-selected":d,"q-range-first":o,"q-range":s,"q-range-last":i,"q-range-hover":r&&(o||i||s),"q-disabled-day disabled":!0===e.disabled}}function m(e){return getStartOfWeek(e,t.weekdays,n.today)}function y(e){return getEndOfWeek(e,t.weekdays,n.today)}function p(){return{}}return{parsedStart:r,parsedEnd:d,dayFormatter:o,weekdayFormatter:i,ariaDateFormatter:s,arrayHasDate:u,checkDays:l,getRelativeClasses:c,startOfWeek:m,endOfWeek:y,dayStyleDefault:p}}const useTaskProps={modelValue:{type:String,default:today(),validator:e=>""===e||validateTimestamp(e)},modelTasks:{type:Array,default:()=>[]},modelTitle:{type:Array,default:()=>[]},modelFooter:{type:Array,default:()=>[]},taskKey:{type:[String,Number],default:"id"},weekdays:{type:Array,default:()=>[0,1,2,3,4,5,6]},dateType:{type:String,default:"round",validator:e=>["round","rounded","square"].includes(e)},dateHeader:{type:String,default:"stacked",validator:e=>["stacked","inline","inverted"].includes(e)},weekdayAlign:{type:String,default:"center",validator:e=>["left","center","right"].includes(e)},dateAlign:{type:String,default:"center",validator:e=>["left","center","right"].includes(e)},dayHeight:{type:[Number,String],default:0,validator:validateNumber},dayMinHeight:{type:[Number,String],default:40,validator:validateNumber},weekdayStyle:{type:Function,default:null},weekdayClass:{type:Function,default:null},dayStyle:{type:Function,default:null},dayClass:{type:Function,default:null},footerDayClass:{type:Function,default:null},view:{type:String,validator:e=>["day","week","month"].includes(e)},viewCount:{type:Number,default:1,validator:e=>validateNumber(e)&&e>0},taskWidth:{type:Number,default:200,validator:e=>validateNumber(e)&&e>0}};function useTask(t,e,{times:a}){const n=computed(()=>{if(!t.modelValue)throw new Error("QCalendarTask: no modelValue provided");if("day"===t.view)return parseTimestamp(t.modelValue);if("week"===t.view)return getStartOfWeek(parseTimestamp(t.modelValue),t.weekdays,a.today);if("month"===t.view)return getStartOfMonth(parseTimestamp(t.modelValue));throw new Error(`QCalendarTask: unknown 'view' type (${t.view})`)}),r=computed(()=>{if(!t.modelValue)throw new Error("QCalendarTask: no modelValue provided");if("day"===t.view){if(1===t.viewCount)return n.value;let e=copyTimestamp(n.value);return e=addToDate(e,{day:t.viewCount-1}),e}if("week"===t.view){if(1===t.viewCount)return getEndOfWeek(parseTimestamp(t.modelValue),t.weekdays,a.today);{let e=copyTimestamp(n.value);return e=addToDate(e,{day:(t.viewCount-1)*TIME_CONSTANTS.DAYS_IN.WEEK}),getEndOfWeek(e,t.weekdays,a.today)}}if("month"!==t.view)throw new Error(`QCalendarTask: unknown 'view' type (${t.view})`);if(1===t.viewCount)return getEndOfMonth(parseTimestamp(t.modelValue));{let e=copyTimestamp(n.value);return e=addToDate(e,{month:t.viewCount}),getEndOfMonth(e)}}),d=computed(()=>{return createDayList(n.value,r.value,a.today,t.weekdays,t.disabledBefore,t.disabledAfter,t.disabledWeekdays||[],t.disabledDays||[],Number.MAX_SAFE_INTEGER)});return{days:d,parsedStartDate:n,parsedEndDate:r}}const useTimesProps={now:{type:String,validator:e=>""===e||validateTimestamp(e),default:""}};function useTimes(e){const t=reactive({now:parseTimestamp("0000-00-00 00:00"),today:parseTimestamp("0000-00-00")}),a=computed(()=>e.now?parseTimestamp(e.now):d());function n(){t.now&&t.today&&(t.now.current=t.today.current=!0,t.now.past=t.today.past=!1,t.now.future=t.today.future=!1)}function r(){const e=a.value||d();o(e,t.now),i(e,t.now),o(e,t.today)}function d(){return parseDate(new Date)}function o(e,t){e.date!==t.date&&(t.year=e.year,t.month=e.month,t.day=e.day,t.weekday=e.weekday,t.date=e.date)}function i(e,t){e.time!==t.time&&(t.hour=e.hour,t.minute=e.minute,t.time=e.time)}return watch(a,()=>r()),{times:t,parsedNow:a,setCurrent:n,updateCurrent:r,getNow:d,updateDay:o,updateTime:i}}function useRenderValues(r,{parsedView:d,parsedValue:o,times:i}){const e=computed(()=>{const e=o.value;let t=r.maxDays,a=e,n=e;switch(d.value){case"month":a=getStartOfMonth(e),n=getEndOfMonth(e),t=daysInMonth(a.year,a.month);break;case"week":case"week-agenda":case"week-scheduler":a=getStartOfWeek(e,r.weekdays,i.today),n=getEndOfWeek(a,r.weekdays,i.today),t=r.weekdays.length;break;case"day":case"scheduler":case"agenda":n=moveRelativeDays(copyTimestamp(n),nextDay,t>1?t-1:t,r.weekdays),n=updateFormatted(n);break;case"month-interval":case"month-scheduler":case"month-agenda":a=getStartOfMonth(e),n=getEndOfMonth(e),n=updateFormatted(n),t=daysInMonth(a.year,a.month);break;case"resource":t=1,n=moveRelativeDays(copyTimestamp(n),nextDay,t,r.weekdays),n=updateFormatted(n);break}return{start:a,end:n,maxDays:t}});return{renderValues:e}}const useMoveEmits=["moved"];function useMove(s,{parsedView:u,parsedValue:l,direction:c,maxDays:m,times:y,emittedValue:p,emit:f}){function e(a=1){if(0===a)p.value=today();else{let e=copyTimestamp(l.value);const n=getEndOfMonth(e),r=a>0,d=r?nextDay:prevDay,o=r?n.day:1;let t=r?a:-a;c.value=r?"next":"prev";const i=s.weekdays.length;while(--t>=0)switch(u.value){case"month":e.day=o,e=d(e),e=updateWeekday(e);while(!s.weekdays.includes(Number(e.weekday)))e=addToDate(e,{day:r?1:-1});break;case"week":case"week-agenda":case"week-scheduler":e=relativeDays(e,d,i,s.weekdays);break;case"day":case"scheduler":case"agenda":e=relativeDays(e,d,m.value,s.weekdays);break;case"month-interval":case"month-agenda":case"month-scheduler":e.day=o,e=d(e);break;case"resource":e=relativeDays(e,d,m.value,s.weekdays);break}e=updateWeekday(e),e=updateFormatted(e),e=updateDayOfYear(e),e=updateRelative(e,y.now),p.value=e.date,f("moved",e)}}return{move:e}}const listenerRE=/^on[A-Z]/;function useEmitListeners(e=getCurrentInstance()){return{emitListeners:computed(()=>{const t={};return e?.vnode?.props&&Object.keys(e.vnode.props).forEach(e=>{listenerRE.test(e)&&(t[e]=!0)}),t})}}function useFocusHelper(){const e={"aria-hidden":"true",class:"q-calendar__focus-helper"};return[h("span",e)]}function useButton(){function e({focusable:e,focusType:t},a,n){const r=e&&t.includes("date");return h("button",{...a,tabindex:r?0:-1},[n,r&&useFocusHelper()])}return{renderButton:e}}const useCheckChangeEmits=["change"];function useCheckChange(n,{days:r,lastStart:d,lastEnd:o}){function e(){const e=r.value;if(0===e.length)return!1;const t=e[0].date,a=e[e.length-1].date;return(!d.value||!o.value||t!==d.value||a!==o.value)&&(d.value=t,o.value=a,n("change",{start:t,end:a,days:e}),!0)}return{checkChange:e}}function useEventUtils(){function e(e,t){return(Array.isArray(t)?t:[t]).includes(e.keyCode)}return{isKeyCode:e}}const isKeyCode=useEventUtils().isKeyCode,useNavigationProps={useNavigation:Boolean};function useNavigation(t,{rootRef:a,focusRef:n,focusValue:r,datesRef:d,parsedView:o,emittedValue:i,direction:s,times:u}){let e=!1;function l(){e||document&&(e=!0,document.addEventListener("keyup",f),document.addEventListener("keydown",p))}function c(){document&&(document.removeEventListener("keyup",f),document.removeEventListener("keydown",p),e=!1)}function m(e){if(e&&document){const t=document.activeElement;if(t!==document.body&&a.value?.contains(t))return!0}return!1}function y(){let t=0;const a=window.setInterval(()=>{const e=d.value[n.value];e&&(e.focus(),50!==++t)&&document.activeElement!==e||window.clearInterval(a)},250)}function p(e){m(e)&&isKeyCode(e,[33,34,35,36,37,38,39,40])&&(e.stopPropagation(),e.preventDefault())}function f(e){if(m(e)&&isKeyCode(e,[33,34,35,36,37,38,39,40])){const t={33:D,34:k,35:w,36:_,37:T,38:v,39:g,40:h};t[e.keyCode]?.()}}function v(){let e=copyTimestamp(r.value);if("month"===o.value){if(e=addToDate(e,{day:-7}),r.value.month!==e.month)return s.value="prev",void(i.value=e.date)}else e=addToDate(e,{minute:Number(t.intervalMinutes)});s.value="prev",n.value=e.date}function h(){let e=copyTimestamp(r.value);if("month"===o.value){if(e=addToDate(e,{day:7}),r.value.month!==e.month)return s.value="next",void(i.value=e.date)}else e=addToDate(e,{minute:Number(t.intervalMinutes)});s.value="next",n.value=e.date}function T(){let e=copyTimestamp(r.value);s.value="prev";do{e=addToDate(e,{day:-1})}while(!t.weekdays.includes(Number(e.weekday)));n.value=e.date}function g(){let e=copyTimestamp(r.value);s.value="next";do{e=addToDate(e,{day:1})}while(!t.weekdays.includes(Number(e.weekday)));n.value=e.date}function D(){let e=copyTimestamp(r.value);e="month"===o.value?addToDate(e,{month:-1}):addToDate(e,{day:-7}),s.value="prev",n.value=e.date}function k(){let e=copyTimestamp(r.value);e="month"===o.value?addToDate(e,{month:1}):addToDate(e,{day:7}),s.value="next",n.value=e.date}function _(){let e=copyTimestamp(r.value);e="month"===o.value?getStartOfMonth(e):getStartOfWeek(e,t.weekdays||[],u.today);while(!t.weekdays.includes(Number(e.weekday)))e=addToDate(e,{day:-1});n.value=e.date}function w(){let e=copyTimestamp(r.value);e="month"===o.value?getEndOfMonth(e):getEndOfWeek(e,t.weekdays||[],u.today);while(!t.weekdays.includes(Number(e.weekday)))e=addToDate(e,{day:-1});n.value=e.date}return onBeforeUnmount(()=>{c()}),watch(()=>t.useNavigation,e=>{(!0===e?l:c)()}),!0===t.useNavigation&&l(),{startNavigation:l,endNavigation:c,tryFocus:y}}const useCellWidthProps={cellWidth:[Number,String]},renderButton=useButton().renderButton;var QCalendarTask=defineComponent({name:"QCalendarTask",directives:{ResizeObserver:ResizeObserverDirective},props:{...useTimesProps,...useNavigationProps,...useCellWidthProps,...useCommonProps,...useTaskProps},emits:["update:model-value","update:model-tasks","update:model-title","update:model-footer","task-expanded",...useCheckChangeEmits,...useMoveEmits,...getRawMouseEvents("-date"),...getRawMouseEvents("-day"),...getRawMouseEvents("-head-day")],setup(c,{slots:m,emit:u,expose:H}){const e=ref(null),q=ref(null),d=ref("next"),o=ref(c.modelValue||today()),i=ref("0000-00-00"),t=ref(0),y=ref(c.modelValue),p=ref(c.modelValue||today()),a=ref(parsed(c.modelValue||today())),f=ref({}),s=reactive({width:0,height:0}),v=ref(""),T=ref(""),U=ref(null),Y=ref(null),n=(watch(()=>c.view,()=>{t.value=0}),computed(()=>{return"month"===c.view?"month-interval":c.view})),r=getCurrentInstance();if(null===r)throw new Error("current instance is null");const l=useEmitListeners(r).emitListeners,{times:g,setCurrent:L,updateCurrent:D}=useTimes(c),{parsedStart:B,dayFormatter:P,weekdayFormatter:V,ariaDateFormatter:z,dayStyleDefault:k,getRelativeClasses:_}=(D(),L(),useCommon(c,{startDate:o,endDate:i,times:g})),w=computed(()=>{return parseTimestamp(c.modelValue,g.now)||B.value||g.today}),$=(a.value=w.value,p.value=w.value.date,useRenderValues(c,{parsedView:n,times:g,parsedValue:w})).renderValues,{rootRef:K,__renderCalendar:Z}=useCalendar(c,Ae,{scrollArea:e,pane:q}),{days:N,parsedStartDate:b,parsedEndDate:M}=useTask(c,u,{times:g}),I=useMove(c,{parsedView:n,parsedValue:w,direction:d,maxDays:t,times:g,emittedValue:y,emit:u}).move,E=useMouseEvents(u,l).getDefaultMouseEventHandlers,j=useCheckChange(u,{days:N,lastStart:U,lastEnd:Y}).checkChange,S=useEventUtils().isKeyCode,X=useNavigation(c,{rootRef:K,focusRef:p,focusValue:a,datesRef:f,parsedView:n,emittedValue:y,direction:d,times:g}).tryFocus,O=ref(!0),A=computed(()=>{return void 0!==c.cellWidth?parseInt(String(c.cellWidth),10):150}),W=computed(()=>{return!0===c.focusable&&c.focusType.includes("day")}),Q=computed(()=>{return!0===c.focusable&&c.focusType.includes("date")&&!0!==W.value}),C=computed(()=>{return!0===c.focusable&&c.focusType.includes("weekday")}),G=computed(()=>{return parseInt(String(c.dayHeight),10)}),J=computed(()=>{return parseInt(String(c.dayMinHeight),10)});function ee(){y.value=today()}function te(e=1){I(e)}function ae(e=1){I(-e)}function ne({width:e,height:t}){s.width=e,s.height=t}function F(e){return e.date===y.value}function re(e,t,a){const n=m.day,r=c.dayStyle||k,d=!0!==c.noActiveDate&&w.value.date===e.date,o=t[c.taskKey],i={timestamp:e,task:t,taskIndex:a,activeDate:d,droppable:T.value===o},s=convertToUnit(A.value),u={width:s,minWidth:s,maxWidth:s,...r({scope:i})},l="function"===typeof c.dayClass?c.dayClass({scope:i}):{};return h("div",{tabindex:!0===W.value?0:-1,class:{"q-calendar-task__task--day":!0,...l,..._(e),"q-active-date":!0===d,"q-calendar__hoverable":!0===c.hoverable,"q-calendar__focusable":!0===W.value},style:u,onFocus:()=>{W.value},...E("-day",e=>{return{scope:i,event:e}}),onDragenter:e=>{void 0!==c.dragEnterFunc&&"function"===typeof c.dragEnterFunc&&(!0===c.dragEnterFunc(e,"day",{scope:i})?T.value=o:T.value="")},onDragover:e=>{void 0!==c.dragOverFunc&&"function"===typeof c.dragOverFunc&&(!0===c.dragOverFunc(e,"day",{scope:i})?T.value=o:T.value="")},onDragleave:e=>{void 0!==c.dragLeaveFunc&&"function"===typeof c.dragLeaveFunc&&(!0===c.dragLeaveFunc(e,"day",{scope:i})?T.value=o:T.value="")},onDrop:e=>{void 0!==c.dropFunc&&"function"===typeof c.dropFunc&&(!0===c.dropFunc(e,"day",{scope:i})?T.value=o:T.value="")}},[n&&n({scope:i}),useFocusHelper()])}function de(t,a){return N.value.map(e=>re(e,t,a))}function oe(e,t){const a=m.days,n={timestamps:N.value,days:N.value,task:e,taskIndex:t,cellWidth:A.value};return h("div",{class:"q-calendar-task__task--days-row"},[de(e,t),a&&a({scope:n})])}function ie(t,e,a=0,n=!0){const r=0===a?m.task:m.subtask,d={start:b.value,end:M.value,task:t,taskIndex:e,expanded:n},o=convertToUnit(c.taskWidth),i={width:o,minWidth:o,maxWidth:o},s=!0===c.focusable&&c.focusType.includes("task");return h("div",{class:{"q-calendar-task__task--item":!0,"q-calendar__sticky":!0===O.value,"q-calendar__hoverable":!0===c.hoverable,"q-calendar__focusable":!0===s},style:i},[h("div",{style:{flexDirection:"column",justifyContent:"center",alignItems:"center",width:10+10*a+"px"}},[h("div",{class:{"q-calendar__parent":void 0!==t.children,"q-calendar__parent--expanded":void 0!==t.children&&!0===t.expanded,"q-calendar__parent--collapsed":void 0!==t.children&&!0!==t.expanded},onClick:e=>{e.stopPropagation(),t.expanded=!t.expanded,u("task-expanded",{expanded:t.expanded,scope:d})}})]),r&&r({scope:d}),useFocusHelper()])}function se(e,t,a=0,n=!0){const r=void 0!==e.height?convertToUnit(parseInt(e.height,10)):G.value>0?convertToUnit(G.value):"auto",d=J.value>0?convertToUnit(J.value):void 0,o={height:r},i=(void 0!==d&&(o.minHeight=d),h("div",{key:e[c.taskKey]+"-"+t,class:{"q-calendar-task__task":0===a,"q-calendar-task__task--section":0!==a},style:o},[ie(e,t,a,n),oe(e,t)]));return void 0!==e.children?[i,h("div",{class:{"q-calendar__child":!0,"q-calendar__child--expanded":!0===n,"q-calendar__child--collapsed":!0!==n}},[ue(e.children,a+1,!1===n?n:e.expanded)])]:[i]}function ue(e=void 0,a=0,n=!0){return void 0===e&&(e=c.modelTasks),e.map((e,t)=>{return se(e,t,a,void 0!==e.children?e.expanded:n)}).flat()}function le(){return h("div",{class:{"q-calendar-task__task--container":!0,"q-calendar__sticky":!0===O.value}},[ue()])}function ce(e,t){const a=m["footer-task"],n={start:b.value,end:M.value,footer:e,index:t},r=convertToUnit(c.taskWidth),d={width:r,minWidth:r,maxWidth:r};return h("div",{class:{"q-calendar-task__footer--task":!0,"q-calendar__sticky":!0===O.value},style:d},[a&&a({scope:n})])}function me(e,t,a){const n=m["footer-day"],r={timestamp:e,footer:t,index:a},d=convertToUnit(A.value),o={width:d,minWidth:d,maxWidth:d},i="function"===typeof c.footerDayClass?c.footerDayClass({scope:r}):{};return h("div",{class:{"q-calendar-task__footer--day":!0,...i,..._(e),"q-calendar__hoverable":!0===c.hoverable,"q-calendar__focusable":!0===W.value},style:o},[n&&n({scope:r})])}function ye(t,a){return h("div",{class:"q-calendar-task__footer--day-wrapper"},[N.value.map(e=>me(e,t,a))])}function pe(){const a=!0===c.focusable&&c.focusType.includes("task");return c.modelFooter.map((e,t)=>{return h("div",{class:{"q-calendar-task__footer--wrapper":!0,"q-calendar__hoverable":!0===c.hoverable,"q-calendar__focusable":!0===a}},{default:()=>[ce(e,t),ye(e,t)]})})}function fe(){return h("div",{class:{"q-calendar-task__footer":!0,"q-calendar__sticky":!0===O.value}},pe())}function ve(){return h("div",{class:{"q-calendar-task__container":!0}},[!0!==c.noHeader&&Ee(),le(),fe()])}function he(){const e=m["head-tasks"],t={start:b.value,end:M.value},a=convertToUnit(parseInt(String(c.taskWidth),10)),n={width:a,minWidth:a,maxWidth:a};return h("div",{class:{"q-calendar-task__head--tasks":!0,"q-calendar__sticky":!0===O.value},style:n},[e&&e({scope:t})])}function Te(e,t){const a=m["title-task"],n=convertToUnit(parseInt(String(c.taskWidth),10)),r={width:n,minWidth:n,maxWidth:n},d={start:b.value,end:M.value,cellWidth:n,title:e,index:t};return h("div",{class:{"q-calendar-task__title--task":!0,"q-calendar__sticky":!0===O.value},style:r},[a&&a({scope:d})])}function x(e){const t=m["head-weekday-label"],a=!0!==c.noActiveDate&&F(e),n={activeDate:a,timestamp:e,disabled:!!c.disabledWeekdays&&c.disabledWeekdays.includes(Number(e.weekday))},r={class:{"q-calendar-task__head--weekday":!0,["q-calendar__"+c.weekdayAlign]:!0,"q-calendar__ellipsis":!0}};return h("div",r,t&&t({scope:n})||ge(e,c.shortWeekdayLabel))}function ge(e,t){const a=V.value(e,t||c.weekdayBreakpoints[0]>0&&A.value<=c.weekdayBreakpoints[0]);return h("span",{class:"q-calendar__ellipsis"},c.weekdayBreakpoints[1]>0&&A.value<=c.weekdayBreakpoints[1]?minCharWidth(a,Number(c.minWeekdayLabel)):a)}function R(e){const t={class:{"q-calendar-task__head--date":!0,["q-calendar__"+c.dateAlign]:!0}};return h("div",t,De(e))}function De(a){const e=!0!==c.noActiveDate&&F(a),t=P.value(a,!1),n=m["head-day-label"],r=m["head-day-button"],d={dayLabel:t,timestamp:a,activeDate:e},o=a.date,i={key:o,tabindex:!0===Q.value?0:-1,class:{"q-calendar-task__head--day__label":!0,"q-calendar__button":!0,"q-calendar__button--round":"round"===c.dateType,"q-calendar__button--rounded":"rounded"===c.dateType,"q-calendar__button--bordered":!0===a.current,"q-calendar__hoverable":!0===c.hoverable,"q-calendar__focusable":!0===Q.value},disabled:a.disabled,onKeydown:e=>{!0!==a.disabled&&S(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{!0!==a.disabled&&S(e,[13,32])&&(y.value=a.date,void 0!==l.value.onClickDate)&&u("click-date",{scope:d})},...E("-date",(e,t)=>{return"click-date"!==t&&"contextmenu-date"!==t||(y.value=a.date,"click-date"===t&&e.preventDefault()),{scope:d,event:e}})};return!0!==c.noAria&&(i.ariaLabel=z.value(a,!1)),r?r({scope:d}):renderButton(c,i,n?n({scope:d}):t)}function ke(e){return"stacked"===c.dateHeader?[!0!==c.noDefaultHeaderText&&x(e),!0!==c.noDefaultHeaderBtn&&R(e)].filter(e=>!1!==e):"inline"===c.dateHeader?("left"===c.weekdayAlign&&"right"===c.dateAlign||"right"===c.weekdayAlign&&c.dateAlign,h("div",{class:"q-calendar__header--inline"},[!0!==c.noDefaultHeaderText&&x(e),!0!==c.noDefaultHeaderBtn&&R(e)])):"inverted"===c.dateHeader?("left"===c.weekdayAlign&&"right"===c.dateAlign||"right"===c.weekdayAlign&&c.dateAlign,h("div",{class:"q-calendar__header--inline"},[!0!==c.noDefaultHeaderBtn&&R(e),!0!==c.noDefaultHeaderText&&x(e)])):void 0}function _e(e,t,a){const n=m["title-day"],r=convertToUnit(A.value),d={width:r,minWidth:r,maxWidth:r},o={timestamp:e,title:t,index:a,cellWidth:A.value},i="function"===typeof c.dayClass?c.dayClass({scope:o}):{},s=!0===c.focusable&&c.focusType.includes("day");return h("div",{class:{"q-calendar-task__title--day":!0,...i,..._(e),"q-calendar__hoverable":!0===c.hoverable,"q-calendar__focusable":!0===s},style:d},[n&&n({scope:o}),useFocusHelper()])}function we(t){const e=m["head-day"],a=m["head-date"],n=!0!==c.noActiveDate&&F(t),r={timestamp:t,activeDate:n,droppable:v.value=t.date,disabled:!!c.disabledWeekdays&&c.disabledWeekdays.includes(Number(t.weekday))},d=c.weekdayStyle||k,o="function"===typeof c.weekdayClass?c.weekdayClass({scope:r}):{},i=convertToUnit(A.value),s={width:i,minWidth:i,maxWidth:i,...d({scope:r})},u=t.date,l={key:u,ref:e=>{f.value[u]=e},tabindex:!0===C.value?0:-1,class:{"q-calendar-task__head--day":!0,...o,..._(t),"q-active-date":n,"q-calendar__hoverable":!0===c.hoverable,"q-calendar__focusable":!0===C.value},style:s,onFocus:()=>{!0===C.value&&(p.value=u)},onKeydown:e=>{!0!==t.disabled&&S(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{!0!==t.disabled&&S(e,[13,32])&&(y.value=t.date)},...E("-head-day",e=>{return{scope:r,event:e}}),onDragenter:e=>{void 0!==c.dragEnterFunc&&"function"===typeof c.dragEnterFunc&&(!0===c.dragEnterFunc(e,"head-day",{scope:r})?v.value=t.date:v.value="")},onDragover:e=>{void 0!==c.dragOverFunc&&"function"===typeof c.dragOverFunc&&(!0===c.dragOverFunc(e,"head-day",{scope:r})?v.value=t.date:v.value="")},onDragleave:e=>{void 0!==c.dragLeaveFunc&&"function"===typeof c.dragLeaveFunc&&(!0===c.dragLeaveFunc(e,"head-day",{scope:r})?v.value=t.date:v.value="")},onDrop:e=>{void 0!==c.dropFunc&&"function"===typeof c.dropFunc&&(!0===c.dropFunc(e,"head-day",{scope:r})?v.value=t.date:v.value="")}};return h("div",l,[void 0!==e&&e({scope:r}),void 0===e&&ke(t),void 0===e&&a&&a({scope:r}),useFocusHelper()])}function Ne(){return N.value.map(e=>we(e))}function be(t,a){return N.value.map(e=>_e(e,t,a))}function Me(){return h("div",{class:{"q-calendar-task__head--days":!0}},[...Ne()])}function Ie(e,t){return h("div",{class:{"q-calendar-task__title--days":!0}},[...be(e,t)])}function Ee(){return h("div",{roll:"presentation",class:{"q-calendar-task__head":!0,"q-calendar__sticky":!0===O.value},style:{}},[h("div",{style:{position:"relative",display:"flex"}},[he(),Me()]),c.modelTitle.map((e,t)=>h("div",{class:"q-calendar-task__title",style:{position:"relative",display:"flex"}},[Te(e,t),Ie(e,t)]))])}function Se(){return h("div",{class:"q-calendar-task__body"},[Oe()])}function Oe(){return h("div",{ref:e,class:{"q-calendar-task__scroll-area":!0,"q-calendar__scroll":!0}},[ve()])}function Ae(){const{start:e,end:t}=$.value,a=(o.value=e.date,i.value=t.date,s.width>0),n=withDirectives(h("div",{key:o.value,class:"q-calendar-task"},[!0===a&&Se()]),[[ResizeObserverDirective,ne]]);if(!0!==c.animated)return n;{const r="q-calendar--"+("prev"===d.value?c.transitionPrev:c.transitionNext);return h(Transition,{name:r,appear:!0},()=>n)}}return watch([N],j,{deep:!0,immediate:!0}),watch(()=>c.modelValue,(e,t)=>{if(y.value!==e){if(!0===c.animated){const a=getDayIdentifier(parsed(e)),n=getDayIdentifier(parsed(t));d.value=a>=n?"next":"prev"}y.value=e}p.value=e}),watch(y,(e,t)=>{if(y.value!==c.modelValue){if(!0===c.animated){const a=getDayIdentifier(parsed(e)),n=getDayIdentifier(parsed(t));d.value=a>=n?"next":"prev"}u("update:model-value",e)}}),watch(p,e=>{e&&(a.value=parseTimestamp(e))}),watch(a,()=>{f.value[p.value]?f.value[p.value].focus():X()}),onBeforeUpdate(()=>{f.value={}}),onMounted(()=>{}),H({prev:ae,next:te,move:I,moveToToday:ee,updateCurrent:D}),()=>Z()}});const version="4.1.2";var Plugin={version:version,QCalendarTask:QCalendarTask,...Timestamp$1,...helpers$1,install(e){e.component(String(QCalendarTask.name),QCalendarTask)}};export{DAYS_IN_MONTH,DAYS_IN_MONTH_LEAP,DAYS_IN_MONTH_MAX,DAYS_IN_MONTH_MIN,DAY_MIN,FIRST_HOUR,MONTH_MAX,MONTH_MIN,PARSE_DATE,PARSE_DATETIME,PARSE_TIME,QCalendarTask,TIME_CONSTANTS,addToDate,compareDate,compareDateTime,compareTime,compareTimestamps,convertToUnit,copyTimestamp,createDayList,createIntervalList,createNativeLocaleFormatter,daysBetween,daysInMonth,Plugin as default,diffTimestamp,findWeekday,getDate,getDateTime,getDayIdentifier,getDayOfYear,getDayTimeIdentifier,getEndOfMonth,getEndOfWeek,getMonthFormatter,getMonthNames,getStartOfMonth,getStartOfWeek,getTime,getTimeIdentifier,getWeekday,getWeekdayFormatter,getWeekdayNames,getWorkWeek,indexOf,isBetweenDates,isLeapYear,isOverlappingDates,isToday,makeDate,makeDateTime,maxTimestamp,minCharWidth,minTimestamp,moveRelativeDays,nextDay,padNumber,parseDate,parseTime,parseTimestamp,parsed,prevDay,relativeDays,today,updateDayOfYear,updateDisabled,updateFormatted,updateMinutes,updateRelative,updateWeekday,updateWorkWeek,validateNumber,validateTimestamp,version,weeksBetween};