@quasar/quasar-ui-qcalendar
Version:
QCalendar - Day/Month/Week Calendars, Popups, Date Pickers, Schedules, Agendas, Planners and Tasks for your Vue Apps
6 lines • 44.7 kB
JavaScript
/*!
* @quasar/quasar-ui-qcalendar v4.1.2
* (c) 2025 Jeff Galbraith <jeff@quasar.dev>
* Released under the MIT License.
*/
(function(e,t){"object"===typeof exports&&"undefined"!==typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define(["vue"],t):(e="undefined"!==typeof globalThis?globalThis:e||self,e.QCalendarScheduler=t(e.Vue))})(this,function(xe){const d=/^(\d{4})-(\d{1,2})(-(\d{1,2}))?([^\d]+(\d{1,2}))?(:(\d{1,2}))?(:(\d{1,2}))?(.(\d{1,3}))?$/,f=/^(\d{4})-(\d{1,2})(-(\d{1,2}))?/,y=/(\d\d?)(:(\d\d?)|)(:(\d\d?)|)/,k=[0,31,28,31,30,31,30,31,31,30,31,30,31],b=[0,31,29,31,30,31,30,31,31,30,31,30,31],r={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}},_=28,I=31,C=12,F=1,N=1,A=0;function t(e){return"string"===typeof e&&d.test(e)}function We(e){if("string"!==typeof e)return null;const t=d.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),o=parseInt(t[6]||"0",10),u=parseInt(t[8]||"0",10);return{date:e,time:o.toString().padStart(2,"0")+":"+u.toString().padStart(2,"0"),year:a,month:n,day:r,hour:o,minute:u,hasDay:!!t[4],hasTime:!0,past:!1,current:!1,future:!1,disabled:!1,weekday:0,doy:0,workweek:0}}function M(e,t=!1){if(!(e instanceof Date))return null;const a=t?"UTC":"";return w({date:o(e[`get${a}FullYear`](),4)+"-"+o(e[`get${a}Month`]()+1,2)+"-"+o(e[`get${a}Date`](),2),time:o(e[`get${a}Hours`]()||0,2)+":"+o(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 o(e,t){let a=String(e);while(a.length<t)a="0"+a;return a}function E(e){return e%4===0&&e%100!==0||e%400===0}function i(e,t){return(E(e)?b:k)[t]}function h(e){const t=new Date(e.year,e.month-1,e.day+1);return w(de({...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}))}function p(e){const t=new Date(e.year,e.month-1,e.day-1);return w(de({...e,year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()}))}function Oe(){const e=new Date,t=e.getMonth()+1,a=e.getDate(),n=e.getFullYear();return[n,o(t,2),o(a,2)].join("-")}function q(e){return e===Oe()}function K(e,t,a){let n=j(e);if(t){if(1===n.day||0===n.weekday)while(!t.includes(Number(n.weekday)))n=h(n);n=v(n,t[0],p),n=w(n),a&&(n=$(n,a,n.hasTime))}return n}function P(e,t,a){let n=j(e);if(t&&Array.isArray(t)){const r=i(n.year,n.month);if(r===n.day||n.weekday===t[t.length-1])while(!t.includes(Number(n.weekday)))n=p(n);n=v(n,t[t.length-1],h),n=w(n),a&&(n=$(n,a,n.hasTime))}return n}function T(e){let t=j(e);return t.day=N,t=w(t),t}function S(e){let t=j(e);return t.day=i(t.year,t.month),t=w(t),t}function Z(e){const t=Object.prototype.toString.call(e);switch(t){case"[object Number]":return e;case"[object String]":{const a=y.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 x(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 W(e,t){return s(e)===s(t)}function O(e,t){return c(e)===c(t)}function H(e,t){return X(e)===X(t)}function He(e,t=null){let a=We(e);return a?(a=w(a),t&&(a=$(a,t,a.hasTime)),a):null}function Re(e){return 1e8*(e.year??0)+1e6*(e.month??0)+1e4*(e.day??0)}function l(e){return 100*(e.hour??0)+(e.minute??0)}function z(e){return Re(e)+l(e)}function R(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 $(e,t,a=!1){let n=j(e),r=Re(t),o=Re(n),u=r===o;return n.hasTime&&a&&u&&(r=l(t),o=l(n),u=r===o),n.past=o<r,n.current=u,n.future=o>r,n.currentWeekday=n.weekday===t.weekday,n}function U(e,t,a=null){let n=j(e);return n.hasTime=!0,n.hour=Math.floor(t/r.MINUTES_IN.HOUR),n.minute=t%r.MINUTES_IN.HOUR,n.time=c(n),a&&(n=$(n,a,!0)),n}function g(e){let t=j(e);return t.weekday=u(t),t}function L(e){let t=j(e);return t.doy=a(t)||0,t}function B(e){let t=j(e);return t.workweek=n(t),t}function Y(e,t,a,n,r){let o=j(e);const u=Re(o);if(void 0!==t){const s=We(t);if(s){const c=Re(s);u<=c&&(o.disabled=!0)}}if(!0!==o.disabled&&void 0!==a){const v=We(a);if(v){const m=Re(v);u>=m&&(o.disabled=!0)}}if(!0!==o.disabled&&Array.isArray(n)&&n.length>0)for(var d in n)if(n[d]===o.weekday){o.disabled=!0;break}if(!0!==o.disabled&&Array.isArray(r)&&r.length>0)for(var i in r)if(Array.isArray(r[i])&&2===r[i].length&&r[i][0]&&r[i][1]){const f=We(r[i][0]),y=We(r[i][1]);if(f&&y&&oe(o,f,y)){o.disabled=!0;break}}else{const h=r[i];if(Array.isArray(h))for(var l of h){const p=He(l);if(p){const g=Re(p);if(g===u){o.disabled=!0;break}}}else if(h){const w=He(h);if(w){const D=Re(w);D===u&&(o.disabled=!0)}}}return o}function w(e){let t=j(e);return t.hasTime=!0,t.time=c(t),t.date=s(t),t.weekday=u(t),t.doy=a(t)||0,t.workweek=n(t),t}function a(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 n(e){let t=j(e);if(0===t.year){const r=He(Oe());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 u(e){let t=e.weekday;if(e.hasDay){const a=Math.floor,n=e.day,r=(e.month+9)%C+1,o=a(e.year/100),u=e.year%100-(e.month<=2?1:0);t=((n+a(2.6*r-.2)-2*o+u+a(u/4)+a(o/4))%7+7)%7}return t??0}function j(e){return{...e}}function s(e){let t=o(e.year,4)+"-"+o(e.month,2);return e.hasDay&&(t+="-"+o(e.day,2)),t}function c(e){return e.hasTime?o(e.hour,2)+":"+o(e.minute,2):""}function X(e){return s(e)+" "+(e.hasTime?c(e):"00:00")}function V(e,t=h,a=1,n=[0,1,2,3,4,5,6]){const r=j(e);return D(r,t,a,n)}function D(e,t=h,a=1,n=[0,1,2,3,4,5,6]){let r=j(e);n.includes(Number(r.weekday))||0!==r.weekday||t!==h||++a;while(--a>=0)r=t(r),n.length<7&&!n.includes(Number(r.weekday))&&++a;return r}function v(e,t,a=h,n=6){let r=j(e);while(r.weekday!==t&&--n>=0)r=a(r);return r}function J(e,t,a,n=[0,1,2,3,4,5,6],r=void 0,o=void 0,u=[],d=[],i=42,l=0){const s=Re(e),c=Re(t),v=[];let m=j(e),f=0,y=f===c;if(!(c<s))while((!y||v.length<l)&&v.length<i){if(f=Re(m),y=y||f>c&&v.length>=l,y)break;if(n.includes(Number(m.weekday))){let e=j(m);e=w(e),e=$(e,a),e=Y(e,r,o,u,d),v.push(e)}m=D(m,h)}return v}function ee(t,a,n,r,o){const u=[];for(let e=0;e<r;++e){const d=(a+e)*n,i=j(t);u.push(U(i,d,o))}return u}function Q(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(ae(t))}catch(e){return console.error(`Intl.DateTimeFormat: ${e.message} -> `+X(t)),""}}}function te(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 ae(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 e(e){return isFinite(Number(e))}function ne(e,t=!1){const a=!0===t?z:Re;return e.reduce((e,t)=>{return Math.max(a(e),a(t))===a(e)?e:t})}function re(e,t=!1){const a=!0===t?z:Re;return e.reduce((e,t)=>{return Math.min(a(e),a(t))===a(e)?e:t})}function oe(e,t,a,n=!1){const r=Re(e)+(!0===n?l(e):0),o=Re(t)+(!0===n?l(t):0),u=Re(a)+(!0===n?l(a):0);return r>=o&&r<=u}function ue(e,t,a,n){const r=Re(e),o=Re(t),u=Re(a),d=Re(n);return r>=u&&r<=d||o>=u&&o<=d||u>=r&&o>=d}function G(e,t){const a=j(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),w(de(a))}function de(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 ie(e,t){const a=R(e,t,!0);return Math.floor(a/r.MILLISECONDS_IN.DAY)}function le(e,t){let a=j(e),n=j(t);return a=v(a,0),n=v(n,6),Math.ceil(ie(a,n)/r.DAYS_IN.WEEK)}const se={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 ce(){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(se[t])}catch(e){return e instanceof Error&&console.error(`Intl.DateTimeFormat: ${e.message} -> day of week: `+t),""}}}function ve(t,a){const e=Object.keys(se),n=ce();return e.map(e=>String(n(e,t,a)))}function me(){const e=()=>"",o={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,o[e]||o["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 fe(t,a){const n=me();return[...Array(12).keys()].map(e=>n(e,t,a))}var ye={PARSE_DATETIME:d,PARSE_DATE:f,PARSE_TIME:y,DAYS_IN_MONTH:k,DAYS_IN_MONTH_LEAP:b,DAYS_IN_MONTH_MIN:_,DAYS_IN_MONTH_MAX:I,MONTH_MAX:C,MONTH_MIN:F,DAY_MIN:N,TIME_CONSTANTS:r,FIRST_HOUR:A,today:Oe,getStartOfWeek:K,getEndOfWeek:P,getStartOfMonth:T,getEndOfMonth:S,parseTime:Z,validateTimestamp:t,parsed:We,parseTimestamp:He,parseDate:M,getDayIdentifier:Re,getTimeIdentifier:l,getDayTimeIdentifier:z,diffTimestamp:R,updateRelative:$,updateMinutes:U,updateWeekday:g,updateDayOfYear:L,updateWorkWeek:B,updateDisabled:Y,updateFormatted:w,getDayOfYear:a,getWorkWeek:n,getWeekday:u,isLeapYear:E,daysInMonth:i,copyTimestamp:j,padNumber:o,getDate:s,getTime:c,getDateTime:X,nextDay:h,prevDay:p,relativeDays:D,findWeekday:v,createDayList:J,createIntervalList:ee,createNativeLocaleFormatter:Q,makeDate:te,makeDateTime:ae,validateNumber:e,isBetweenDates:oe,isOverlappingDates:ue,daysBetween:ie,weeksBetween:le,addToDate:G,compareTimestamps:x,compareDate:W,compareTime:O,compareDateTime:H,getWeekdayFormatter:ce,getWeekdayNames:ve,getMonthFormatter:me,getMonthNames:fe},ye=Object.freeze({__proto__:null,DAYS_IN_MONTH:k,DAYS_IN_MONTH_LEAP:b,DAYS_IN_MONTH_MAX:I,DAYS_IN_MONTH_MIN:_,DAY_MIN:N,FIRST_HOUR:A,MONTH_MAX:C,MONTH_MIN:F,PARSE_DATE:f,PARSE_DATETIME:d,PARSE_TIME:y,TIME_CONSTANTS:r,addToDate:G,compareDate:W,compareDateTime:H,compareTime:O,compareTimestamps:x,copyTimestamp:j,createDayList:J,createIntervalList:ee,createNativeLocaleFormatter:Q,daysBetween:ie,daysInMonth:i,default:ye,diffTimestamp:R,findWeekday:v,getDate:s,getDateTime:X,getDayIdentifier:Re,getDayOfYear:a,getDayTimeIdentifier:z,getEndOfMonth:S,getEndOfWeek:P,getMonthFormatter:me,getMonthNames:fe,getStartOfMonth:T,getStartOfWeek:K,getTime:c,getTimeIdentifier:l,getWeekday:u,getWeekdayFormatter:ce,getWeekdayNames:ve,getWorkWeek:n,isBetweenDates:oe,isLeapYear:E,isOverlappingDates:ue,isToday:q,makeDate:te,makeDateTime:ae,maxTimestamp:ne,minTimestamp:re,moveRelativeDays:V,nextDay:h,padNumber:o,parseDate:M,parseTime:Z,parseTimestamp:He,parsed:We,prevDay:p,relativeDays:D,today:Oe,updateDayOfYear:L,updateDisabled:Y,updateFormatted:w,updateMinutes:U,updateRelative:$,updateWeekday:g,updateWorkWeek:B,validateNumber:e,validateTimestamp:t,weeksBetween:le});function Ue(e,t="px"){if(e)return isNaN(e)?String(e):"auto"===e?e:""+Number(e)+t}function he(t,a){for(let e=0;e<t.length;e++)if(!0===a(t[e],e))return e;return-1}function Le(e,t){return 0===t?e:e.slice(0,t)}var pe={convertToUnit:Ue,indexOf:he,minCharWidth:Le},pe=Object.freeze({__proto__:null,convertToUnit:Ue,default:pe,indexOf:he,minCharWidth:Le});const Be={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 Ye(t,a,{scrollArea:e,pane:n}){if(!a){const s="[error: renderCalendar] no renderFunc has been supplied to useCalendar";throw console.error(s),new Error(s)}const r=xe.reactive({width:0,height:0}),o=xe.ref(null);function u({width:e,height:t}){r.width=e,r.height=t}const d=xe.computed(()=>{return!0!==t.noScroll&&e.value&&n.value&&r.height?e.value.offsetWidth-n.value.offsetWidth:0});function i(){}function l(){const e={ref:o,role:"complementary",lang:t.locale,class:`q-calendar ${t.dark?"q-calendar--dark":""} `+(t.bordered?"q-calendar__bordered":"")};return xe.withDirectives(xe.h("div",{...e},[a()]),[[Be,u]])}return{rootRef:o,scrollWidth:d,__initCalendar:i,__renderCalendar:l}}const ge=e=>e.every(e=>["day","date","weekday","interval","time","resource","task"].includes(e)),we={modelValue:{type:String,default:Oe(),validator:e=>""===e||t(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:ge}};function Ve(t,{startDate:e,endDate:a,times:n}){const r=xe.computed(()=>He(e.value)),o=xe.computed(()=>{return"0000-00-00"===a.value?P(r.value,t.weekdays,n.today):He(a.value)||r.value}),u=xe.computed(()=>Q(t.locale,()=>({timeZone:"UTC",day:"numeric"}))),d=xe.computed(()=>Q(t.locale,(e,t)=>({timeZone:"UTC",weekday:t?"short":"long"}))),i=xe.computed(()=>Q(t.locale,()=>({timeZone:"UTC",dateStyle:"full"})));function l(e,t){return e&&e.length>0&&e.includes(t.date)}function s(e,t){const a={firstDay:!1,betweenDays:!1,lastDay:!1};if(2===e.length){const n=Re(t),r=Re(We(e[0])),o=Re(We(e[1]));a.firstDay=r===n,a.lastDay=o===n,a.betweenDays=r<n&&o>n}return a}function c(e,t=!1,a=[],n=[],r=!1){const o=l(a,e),{firstDay:u,lastDay:d,betweenDays:i}=s(n,e);return{"q-past-day":!u&&!i&&!d&&!o&&!t&&!!e.past,"q-future-day":!u&&!i&&!d&&!o&&!t&&!!e.future,"q-outside":t,"q-current-day":!!e.current,"q-selected":o,"q-range-first":u,"q-range":i,"q-range-last":d,"q-range-hover":r&&(u||d||i),"q-disabled-day disabled":!0===e.disabled}}function v(e){return K(e,t.weekdays,n.today)}function m(e){return P(e,t.weekdays,n.today)}function f(){return{}}return{parsedStart:r,parsedEnd:o,dayFormatter:u,weekdayFormatter:d,ariaDateFormatter:i,arrayHasDate:l,checkDays:s,getRelativeClasses:c,startOfWeek:v,endOfWeek:m,dayStyleDefault:f}}function De(e,t){e instanceof Window?e.scrollTo({top:t,behavior:"instant"}):e.scrollTop=t}function ke(e){return e instanceof Window?e.scrollY:e.scrollTop}function be(o,u,d=500,i=performance.now(),l=ke(o)){d<=0||l===u?De(o,u):requestAnimationFrame(e=>{const t=e-i,a=Math.min(t/d,1),n=e=>e<.5?2*e*e:(4-2*e)*e-1,r=l+(u-l)*n(a);De(o,r),a<1&&be(o,u,d,i,l)})}function _e(r,e,o=500){const u=r.scrollLeft,d=e-u;let i=null;function l(e){null===i&&(i=e);const t=e-i,a=Math.min(t/o,1),n=e=>e<.5?2*e*e:(4-2*e)*e-1;r.scrollLeft=u+d*n(a),t<o&&requestAnimationFrame(l)}requestAnimationFrame(l)}const Te={view:{type:String,validator:e=>["day","week","month","month-interval"].includes(e),default:"day"},modelResources:{type:Array},resourceKey:{type:String,default:"id"},resourceLabel:{type:String,default:"label"},resourceHeight:{type:[Number,String],default:0,validator:e},resourceMinHeight:{type:[Number,String],default:70,validator:e},resourceStyle:{type:Function,default:null},resourceClass:{type:Function,default:null},weekdayStyle:{type:Function,default:null},weekdayClass:{type:Function,default:null},dayStyle:{type:Function,default:null},dayClass:{type:Function,default:null},dateHeader:{type:String,default:"stacked",validator:e=>["stacked","inline","inverted"].includes(e)}};function Ke(o,{times:t,scrollArea:n,parsedStart:e,parsedEnd:a,maxDays:r,size:u,headerColumnRef:d}){const i=xe.computed(()=>parseInt(String(o.intervalStart),10)),v=xe.computed(()=>parseInt(String(o.intervalMinutes),10)),l=xe.computed(()=>parseInt(String(o.intervalCount),10)),m=xe.computed(()=>parseFloat(String(o.intervalHeight))),f=xe.computed(()=>{let e=0;const t=Number(o.columnCount);return o.cellWidth?e=Number(o.cellWidth):u.width>0&&d.value&&(e=d.value.offsetWidth/(t>1?t:r.value)),e}),s=xe.computed(()=>i.value*v.value),c=xe.computed(()=>l.value*m.value),y=xe.computed(()=>l.value*f.value),h=xe.computed(()=>D(e.value)),p=xe.computed(()=>k(a.value)),g=xe.computed(()=>{return J(e.value,a.value,t.today,o.weekdays,o.disabledBefore,o.disabledAfter,o.disabledWeekdays,o.disabledDays,r.value)}),w=xe.computed(()=>{return g.value.map(e=>ee(e,i.value,v.value,l.value,t.now))});function D(e){return K(e,o.weekdays,t.today)}function k(e){return P(e,o.weekdays,t.today)}function b(e,t){return e&&e.length>0&&e.includes(X(t))}function _(e,t){const a={firstDay:!1,betweenDays:!1,lastDay:!1};if(e&&2===e.length){const n=z(t),r=z(We(e[0])),o=z(We(e[1]));a.firstDay=r===n,a.lastDay=o===n,a.betweenDays=r<n&&o>n}return a}function T(e,t=[],a=[]){const n=b(t,e),{firstDay:r,lastDay:o,betweenDays:u}=_(a,e);return{"q-selected":n,"q-range-first":!0===r,"q-range":!0===u,"q-range-last":!0===o,"q-disabled-interval disabled":!0===e.disabled}}function S(e,t,a){return[]}const I=xe.computed(()=>{const a={timeZone:"UTC",hour12:!o.hour24Format,hour:"2-digit",minute:"2-digit"},n={timeZone:"UTC",hour12:!o.hour24Format,hour:"numeric",minute:"2-digit"},r={timeZone:"UTC",hour12:!o.hour24Format,hour:"numeric"};return Q(o.locale,(e,t)=>t?0===e.minute?r:n:a)}),C=xe.computed(()=>{const e={timeZone:"UTC",dateStyle:"full",timeStyle:"short"};return Q(o.locale,()=>e)});function F(e){const t=w.value[0][0],a=t.hour===e.hour&&t.minute===e.minute;return!a&&0===e.minute}function N(e){}function A(e){return{}}function M(e,t,a=!1,n){let r=j(t);if(e.currentTarget){const o=e.currentTarget.getBoundingClientRect(),u=e,d=e,i=u.changedTouches||u.touches,l=(i&&i[0]?i[0]:d).clientY,s=(l-o.top)/m.value,c=Math.floor((a?Math.floor(s):s)*v.value);0!==c&&(r=G(r,{minute:c})),n&&(r=$(r,n,!0))}return r}function O(e,t,a=!1,n){let r=j(t);const o=e.currentTarget.getBoundingClientRect(),u=e,d=e,i=u.changedTouches||u.touches,l=(i&&i[0]?i[0]:d).clientY,s=(l-o.top)/m.value,c=Math.floor((a?Math.floor(s):s)*v.value);return 0!==c&&(r=G(r,{minute:c})),n&&(r=$(r,n,!0)),r}function H(e,t,a=!1,n){let r=j(t);if(e.currentTarget){const o=e.currentTarget.getBoundingClientRect(),u=e,d=e,i=u.changedTouches||u.touches,l=(i&&i[0]?i[0]:d).clientX,s=(l-o.left)/f.value,c=Math.floor((a?Math.floor(s):s)*v.value);0!==c&&(r=G(r,{minute:c})),n&&(r=$(r,n,!0))}return r}function R(e,t){const a={timestamp:e,timeStartPos:x,timeDurationHeight:E};return void 0!==t&&(a.columnIndex=t),a}function U(e,t){const a={timestamp:j(e),timeStartPosX:W,timeDurationWidth:q};return void 0!==t&&(a.index=t),a}function L(e,t=0){const a=x(e);return!(!1===a||!n.value)&&(be(n.value,a,t),!0)}function B(e,t=0){const a=W(e);return!(!1===a||!n.value)&&(_e(n.value,a,t),!0)}function E(e){return e/v.value*m.value}function q(e){return e/v.value*f.value}function Y(e){return e*v.value/m.value}function V(e){return e*v.value/f.value}function x(e,t=!0){const a=Z(e);if(!1===a)return!1;const n=s.value,r=l.value*v.value,o=(a-n)/r;let u=o*c.value;return t&&(u<0&&(u=0),u>c.value)&&(u=c.value),u}function W(e,t=!0){const a=Z(e);if(!1===a)return!1;const n=s.value,r=l.value*v.value,o=(a-n)/r;let u=o*y.value;return t&&(u<0&&(u=0),u>y.value)&&(u=y.value),u}return{parsedIntervalStart:i,parsedIntervalMinutes:v,parsedIntervalCount:l,parsedIntervalHeight:m,parsedCellWidth:f,parsedStartMinute:s,bodyHeight:c,bodyWidth:y,parsedWeekStart:h,parsedWeekEnd:p,days:g,intervals:w,intervalFormatter:I,ariaDateTimeFormatter:C,arrayHasDateTime:b,checkIntervals:_,getIntervalClasses:T,getResourceClasses:S,showIntervalLabelDefault:F,showResourceLabelDefault:N,styleDefault:A,getTimestampAtEventInterval:M,getTimestampAtEvent:O,getTimestampAtEventX:H,getScopeForSlot:R,getScopeForSlotX:U,scrollToTime:L,scrollToTimeX:B,timeDurationHeight:E,timeDurationWidth:q,heightToMinutes:Y,widthToMinutes:V,timeStartPos:x,timeStartPosX:W}}const Se={columnCount:{type:[Number,String],default:0,validator:e},columnIndexStart:{type:[Number,String],default:0,validator:e}},Ie={maxDays:{type:Number,default:1}},Ce={now:{type:String,validator:e=>""===e||t(e),default:""}};function Pe(e){const t=xe.reactive({now:He("0000-00-00 00:00"),today:He("0000-00-00")}),a=xe.computed(()=>e.now?He(e.now):o());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||o();u(e,t.now),d(e,t.now),u(e,t.today)}function o(){return M(new Date)}function u(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 d(e,t){e.time!==t.time&&(t.hour=e.hour,t.minute=e.minute,t.time=e.time)}return xe.watch(a,()=>r()),{times:t,parsedNow:a,setCurrent:n,updateCurrent:r,getNow:o,updateDay:u,updateTime:d}}function Ze(r,{parsedView:o,parsedValue:u,times:d}){const e=xe.computed(()=>{const e=u.value;let t=r.maxDays,a=e,n=e;switch(o.value){case"month":a=T(e),n=S(e),t=i(a.year,a.month);break;case"week":case"week-agenda":case"week-scheduler":a=K(e,r.weekdays,d.today),n=P(a,r.weekdays,d.today),t=r.weekdays.length;break;case"day":case"scheduler":case"agenda":n=V(j(n),h,t>1?t-1:t,r.weekdays),n=w(n);break;case"month-interval":case"month-scheduler":case"month-agenda":a=T(e),n=S(e),n=w(n),t=i(a.year,a.month);break;case"resource":t=1,n=V(j(n),h,t,r.weekdays),n=w(n);break}return{start:a,end:n,maxDays:t}});return{renderValues:e}}const Fe=e=>e.replace(/(-\w)/g,e=>e[1].toUpperCase());function Ne(t,e,a,n){const r={};for(const o in a){const u=a[o],d=Fe("on-"+o);if(!e.value)return console.warn("$listeners has not been set up"),{};if(void 0!==e.value[d]){const i="on"+u.event.charAt(0).toUpperCase()+u.event.slice(1),l=e=>{return(void 0===u.button||"buttons"in e&&e.buttons>0&&e.button===u.button)&&(u.prevent&&e.preventDefault(),u.stop&&e.stopPropagation(),t(o,n(e,o))),u.result};i in r?Array.isArray(r[i])?r[i].push(l):r[i]=[r[i],l]:r[i]=l}}return r}function Ae(e,t,a,n){return Ne(e,t,Me(a),n)}function Me(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 m(e){return Object.keys(Me(e))}function ze(a,n){return{getMouseEventHandlers:(e,t)=>Ne(a,n,e,t),getDefaultMouseEventHandlers:(e,t)=>Ae(a,n,e,t),getMouseEventName:Me,getRawMouseEvents:m}}const Ee=["moved"];function $e(i,{parsedView:l,parsedValue:s,direction:c,maxDays:v,times:m,emittedValue:f,emit:y}){function e(a=1){if(0===a)f.value=Oe();else{let e=j(s.value);const n=S(e),r=a>0,o=r?h:p,u=r?n.day:1;let t=r?a:-a;c.value=r?"next":"prev";const d=i.weekdays.length;while(--t>=0)switch(l.value){case"month":e.day=u,e=o(e),e=g(e);while(!i.weekdays.includes(Number(e.weekday)))e=G(e,{day:r?1:-1});break;case"week":case"week-agenda":case"week-scheduler":e=D(e,o,d,i.weekdays);break;case"day":case"scheduler":case"agenda":e=D(e,o,v.value,i.weekdays);break;case"month-interval":case"month-agenda":case"month-scheduler":e.day=u,e=o(e);break;case"resource":e=D(e,o,v.value,i.weekdays);break}e=g(e),e=w(e),e=L(e),e=$(e,m.now),f.value=e.date,y("moved",e)}}return{move:e}}const qe=/^on[A-Z]/;function je(e=xe.getCurrentInstance()){return{emitListeners:xe.computed(()=>{const t={};return e?.vnode?.props&&Object.keys(e.vnode.props).forEach(e=>{qe.test(e)&&(t[e]=!0)}),t})}}function Xe(){const e={"aria-hidden":"true",class:"q-calendar__focus-helper"};return[xe.h("span",e)]}function Qe(){function e({focusable:e,focusType:t},a,n){const r=e&&t.includes("date");return xe.h("button",{...a,tabindex:r?0:-1},[n,r&&Xe()])}return{renderButton:e}}const Ge={cellWidth:[Number,String]};function Je(e){const t=xe.computed(()=>void 0!==e.cellWidth);return{isSticky:t}}const et=["change"];function tt(n,{days:r,lastStart:o,lastEnd:u}){function e(){const e=r.value;if(0===e.length)return!1;const t=e[0].date,a=e[e.length-1].date;return(!o.value||!u.value||t!==o.value||a!==u.value)&&(o.value=t,u.value=a,n("change",{start:t,end:a,days:e}),!0)}return{checkChange:e}}function at(){function e(e,t){return(Array.isArray(t)?t:[t]).includes(e.keyCode)}return{isKeyCode:e}}const nt=at().isKeyCode,rt={useNavigation:Boolean};function ot(t,{rootRef:a,focusRef:n,focusValue:r,datesRef:o,parsedView:u,emittedValue:d,direction:i,times:l}){let e=!1;function s(){e||document&&(e=!0,document.addEventListener("keyup",y),document.addEventListener("keydown",f))}function c(){document&&(document.removeEventListener("keyup",y),document.removeEventListener("keydown",f),e=!1)}function v(e){if(e&&document){const t=document.activeElement;if(t!==document.body&&a.value?.contains(t))return!0}return!1}function m(){let t=0;const a=window.setInterval(()=>{const e=o.value[n.value];e&&(e.focus(),50!==++t)&&document.activeElement!==e||window.clearInterval(a)},250)}function f(e){v(e)&&nt(e,[33,34,35,36,37,38,39,40])&&(e.stopPropagation(),e.preventDefault())}function y(e){if(v(e)&&nt(e,[33,34,35,36,37,38,39,40])){const t={33:D,34:k,35:_,36:b,37:g,38:h,39:w,40:p};t[e.keyCode]?.()}}function h(){let e=j(r.value);if("month"===u.value){if(e=G(e,{day:-7}),r.value.month!==e.month)return i.value="prev",void(d.value=e.date)}else e=G(e,{minute:Number(t.intervalMinutes)});i.value="prev",n.value=e.date}function p(){let e=j(r.value);if("month"===u.value){if(e=G(e,{day:7}),r.value.month!==e.month)return i.value="next",void(d.value=e.date)}else e=G(e,{minute:Number(t.intervalMinutes)});i.value="next",n.value=e.date}function g(){let e=j(r.value);i.value="prev";do{e=G(e,{day:-1})}while(!t.weekdays.includes(Number(e.weekday)));n.value=e.date}function w(){let e=j(r.value);i.value="next";do{e=G(e,{day:1})}while(!t.weekdays.includes(Number(e.weekday)));n.value=e.date}function D(){let e=j(r.value);e="month"===u.value?G(e,{month:-1}):G(e,{day:-7}),i.value="prev",n.value=e.date}function k(){let e=j(r.value);e="month"===u.value?G(e,{month:1}):G(e,{day:7}),i.value="next",n.value=e.date}function b(){let e=j(r.value);e="month"===u.value?T(e):K(e,t.weekdays||[],l.today);while(!t.weekdays.includes(Number(e.weekday)))e=G(e,{day:-1});n.value=e.date}function _(){let e=j(r.value);e="month"===u.value?S(e):P(e,t.weekdays||[],l.today);while(!t.weekdays.includes(Number(e.weekday)))e=G(e,{day:-1});n.value=e.date}return xe.onBeforeUnmount(()=>{c()}),xe.watch(()=>t.useNavigation,e=>{(!0===e?s:c)()}),!0===t.useNavigation&&s(),{startNavigation:s,endNavigation:c,tryFocus:m}}const ut=Qe().renderButton;var dt=xe.defineComponent({name:"QCalendarScheduler",directives:{ResizeObserver:Be},props:{...we,...Te,...Se,...Ie,...Ce,...Ge,...rt},emits:["update:model-value","update:model-resources","resource-expanded",...et,...Ee,...m("-date"),...m("-day-resource"),...m("-head-resources"),...m("-head-day"),...m("-resource")],setup(h,{slots:p,emit:g,expose:O}){const e=xe.ref(null),t=xe.ref(null),H=xe.ref(null),m=xe.ref(h.modelValue||Oe()),a=xe.ref(We(h.modelValue||Oe())),f=xe.ref({}),R=xe.ref({}),n=xe.ref(),r=xe.ref(),d=xe.ref("next"),i=xe.ref(h.modelValue||Oe()),l=xe.ref("0000-00-00"),s=xe.ref(0),w=xe.ref(h.modelValue),c=xe.reactive({width:0,height:0}),y=xe.ref(""),D=xe.ref(""),U=xe.ref(null),L=xe.ref(null),o=(xe.watch(()=>h.view,()=>{s.value=0}),xe.computed(()=>{return"month"===h.view?"month-interval":h.view})),B=xe.getCurrentInstance();if(null===B)throw new Error("current instance is null");const k=je(B).emitListeners,b=Je(h).isSticky,{times:u,setCurrent:Y,updateCurrent:V}=Pe(h),{parsedStart:K,parsedEnd:P,dayFormatter:Z,weekdayFormatter:z,ariaDateFormatter:$,dayStyleDefault:j,getRelativeClasses:_}=(V(),Y(),Ve(h,{startDate:i,endDate:l,times:u})),T=xe.computed(()=>{return He(h.modelValue,u.now)||K.value||u.today}),X=(a.value=T.value,m.value=T.value.date,Ze(h,{parsedView:o,parsedValue:T,times:u})).renderValues,{rootRef:v,scrollWidth:Q,__renderCalendar:G}=Ye(h,qe,{scrollArea:e,pane:t}),{days:S,parsedCellWidth:I,styleDefault:J}=Ke(h,{times:u,scrollArea:e,parsedStart:K,parsedEnd:P,maxDays:s,size:c,headerColumnRef:H}),C=$e(h,{parsedView:o,parsedValue:T,direction:d,maxDays:s,times:u,emittedValue:w,emit:g}).move,F=ze(g,k).getDefaultMouseEventHandlers,ee=tt(g,{days:S,lastStart:U,lastEnd:L}).checkChange,N=at().isKeyCode,te=ot(h,{rootRef:v,focusRef:m,focusValue:a,datesRef:f,parsedView:o,emittedValue:w,direction:d,times:u}).tryFocus,A=xe.computed(()=>{const e=parseInt(String(h.columnCount),10);return"day"===o.value&&e>1?e:"day"===o.value&&h.maxDays&&h.maxDays>1?h.maxDays:S.value.length}),ae=xe.computed(()=>{return v.value?parseInt(window.getComputedStyle(v.value).getPropertyValue("--calendar-resources-width"),10):0}),M=xe.computed(()=>{const e=parseInt(String(h.resourceHeight),10);return 0===e?"auto":e}),ne=xe.computed(()=>{return parseInt(String(h.resourceMinHeight),10)}),E=xe.computed(()=>{if(v.value){const e=c.width||v.value.getBoundingClientRect().width;if(e&&ae.value&&A.value)return(e-Q.value-ae.value)/A.value+"px"}return 100/A.value+"%"});function re(){w.value=Oe()}function oe(e=1){C(e)}function ue(e=1){C(-e)}function de({width:e,height:t}){c.width=e,c.height=t}function q(e){return e.date===w.value}function ie(){return xe.h("div",{roll:"presentation",class:{"q-calendar-scheduler__head":!0,"q-calendar__sticky":!0===b.value},style:{marginRight:Q.value+"px"}},[le(),se()])}function le(){const e=p["head-resources"],t={days:S.value,timestamps:S.value,date:h.modelValue,resources:h.modelResources};return xe.h("div",{class:{"q-calendar-scheduler__head--resources":!0,"q-calendar__sticky":!0===b.value},...F("-head-resources",e=>{return{scope:t,event:e}})},[e&&e({scope:t})])}function se(){return xe.h("div",{ref:H,class:{"q-calendar-scheduler__head--days__column":!0}},[ce(),ve()])}function ce(){return xe.h("div",{class:{"q-calendar-scheduler__head--days__weekdays":!0}},[...me()])}function ve(){const e=p["head-days-events"];return xe.nextTick(()=>{if(r.value&&0===parseInt(String(h.columnCount),10)&&window)try{const e=window.getComputedStyle(r.value);n.value&&n.value.parentElement&&(n.value.parentElement.style.height=e.height,n.value.style.height=e.height)}catch{}}),xe.h("div",{class:{"q-calendar-scheduler__head--days__event":!0}},[e&&xe.h("div",{ref:n,style:{position:"absolute",left:0,top:0,right:0,overflow:"hidden",zIndex:1}},[e({scope:{timestamps:S.value,days:S.value,ref:r}})]),...fe()])}function me(){const e=parseInt(String(h.columnCount),10),a=parseInt(String(h.columnIndexStart),10);return 1===S.value.length&&e>0?Array.apply(null,new Array(e)).map((e,t)=>t+a).map(e=>ye(S.value[0],e)):S.value.map(e=>ye(e,0))}function fe(){const e=parseInt(String(h.columnCount),10),a=parseInt(String(h.columnIndexStart),10);return 1===S.value.length&&e>0?Array.apply(null,new Array(e)).map((e,t)=>t+a).map(e=>pe(S.value[0],e)):S.value.map(e=>pe(e,0))}function ye(t,e){const a=p["head-day"],n=p["head-date"],r=!0!==h.noActiveDate&&q(t),o={timestamp:t,activeDate:r,droppable:y.value===t.date,disabled:!!h.disabledWeekdays&&h.disabledWeekdays.includes(Number(t.weekday)),columnIndex:e??0},u=!0===b.value?Ue(I.value):E.value,d=h.weekdayStyle||j,i={width:u,maxWidth:u,minWidth:u,...d({scope:o})},l=(!0===b.value&&(i.minWidth=u),"function"===typeof h.weekdayClass?h.weekdayClass({scope:o}):{}),s=!0===h.focusable&&h.focusType.includes("weekday"),c=t.date+(void 0!==e?"-"+e:""),v={key:c,ref:e=>{null!==e&&(f.value[c]=e)},tabindex:!0===s?0:-1,class:{"q-calendar-scheduler__head--day":!0,...l,..._(t),"q-active-date":r,"q-calendar__hoverable":!0===h.hoverable,"q-calendar__focusable":!0===s},style:i,onFocus:()=>{!0===s&&(m.value=c)},onKeydown:e=>{!0!==t.disabled&&N(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{!0!==t.disabled&&N(e,[13,32])&&(w.value=t.date)},...F("-head-day",e=>{return{scope:o,event:e}}),onDragenter:e=>{void 0!==h.dragEnterFunc&&"function"===typeof h.dragEnterFunc&&(!0===h.dragEnterFunc(e,"head-day",{scope:o})?y.value=t.date:y.value="")},onDragover:e=>{void 0!==h.dragOverFunc&&"function"===typeof h.dragOverFunc&&(!0===h.dragOverFunc(e,"head-day",{scope:o})?y.value=t.date:y.value="")},onDragleave:e=>{void 0!==h.dragLeaveFunc&&"function"===typeof h.dragLeaveFunc&&(!0===h.dragLeaveFunc(e,"head-day",{scope:o})?y.value=t.date:y.value="")},onDrop:e=>{void 0!==h.dropFunc&&"function"===typeof h.dropFunc&&(!0===h.dropFunc(e,"head-day",{scope:o})?y.value=t.date:y.value="")}};return xe.h("div",v,[void 0!==a&&a({scope:o}),void 0===a&&De(t,e),void 0===a&&he(t),void 0===a&&n&&n({scope:o}),void 0===a&&ke(t,e),Xe()])}function he(e){return"stacked"===h.dateHeader?[!0!==h.noDefaultHeaderText?x(e):[],!0!==h.noDefaultHeaderBtn?W(e):[]].flat():"inline"===h.dateHeader?("left"===h.weekdayAlign&&"right"===h.dateAlign||"right"===h.weekdayAlign&&h.dateAlign,xe.h("div",{class:"q-calendar__header--inline"},[!0!==h.noDefaultHeaderText&&x(e),!0!==h.noDefaultHeaderBtn&&W(e)])):"inverted"===h.dateHeader?("left"===h.weekdayAlign&&"right"===h.dateAlign||"right"===h.weekdayAlign&&h.dateAlign,xe.h("div",{class:"q-calendar__header--inline"},[!0!==h.noDefaultHeaderBtn&&W(e),!0!==h.noDefaultHeaderText&&x(e)])):void 0}function pe(e,t){const a=p["head-day-event"],n=!0!==h.noActiveDate&&q(e),r={timestamp:e,activeDate:n,droppable:y.value===e.date,disabled:!!h.disabledWeekdays&&h.disabledWeekdays.includes(Number(e.weekday)),columnIndex:t??0},o=!0===b.value?Ue(I.value):E.value,u={width:o,maxWidth:o,minWidth:o};return!0===b.value&&(u.minWidth=o),xe.h("div",{key:"event-"+e.date+(void 0!==t?"-"+t:""),class:{"q-calendar-scheduler__head--day__event":!0,..._(e),"q-active-date":n},style:u},[a&&a({scope:r})])}function x(e){const t=p["head-weekday-label"],a=!0===h.shortWeekdayLabel,n={timestamp:e,shortWeekdayLabel:a},r={class:{"q-calendar-scheduler__head--weekday":!0,["q-calendar__"+h.weekdayAlign]:!0,"q-calendar__ellipsis":!0}};return xe.h("div",r,t&&t({scope:n})||ge(e,a))}function ge(e,t){const a=z.value(e,t||h.weekdayBreakpoints[0]>0&&I.value<=h.weekdayBreakpoints[0]);return xe.h("span",{class:"q-calendar-scheduler__head--weekday-label q-calendar__ellipsis"},h.weekdayBreakpoints[1]>0&&I.value<=h.weekdayBreakpoints[1]?Le(a,Number(h.minWeekdayLabel)):a)}function W(e){const t={class:{"q-calendar-scheduler__head--date":!0,["q-calendar__"+h.dateAlign]:!0}};return xe.h("div",t,we(e))}function we(a){const e=!0!==h.noActiveDate&&q(a),t=Z.value(a,!1),n=p["head-day-label"],r=p["head-day-button"],o={dayLabel:t,timestamp:a,activeDate:e},u={class:{"q-calendar-scheduler__head--day__label":!0,"q-calendar__button":!0,"q-calendar__button--round":"round"===h.dateType,"q-calendar__button--rounded":"rounded"===h.dateType,"q-calendar__button--bordered":!0===a.current,"q-calendar__focusable":!0},disabled:a.disabled,onKeydown:e=>{!0!==a.disabled&&N(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{!0!==a.disabled&&N(e,[13,32])&&(w.value=a.date,void 0!==k.value.onClickDate)&&g("click-date",{scope:o})},...F("-date",(e,t)=>{return"click-date"!==t&&"contextmenu-date"!==t||(w.value=a.date,"click-date"===t&&e.preventDefault()),{scope:o,event:e}})};return!0!==h.noAria&&(u.ariaLabel=$.value(a,!1)),r?xe.h("div",[r({scope:o})]):ut(h,u,n?n({scope:o}):t)}function De(e,t){const a=p["column-header-before"];if(a){const n={timestamp:e,columnIndex:t};return xe.h("div",{class:"q-calendar-scheduler__column-header--before"},[a({scope:n})])}}function ke(e,t){const a=p["column-header-after"];if(a){const n={timestamp:e,columnIndex:t};return xe.h("div",{class:"q-calendar-scheduler__column-header--after"},[a({scope:n})])}}function be(){return xe.h("div",{class:"q-calendar-scheduler__body"},[_e()])}function _e(){return!0===b.value?xe.h("div",{ref:e,class:{"q-calendar-scheduler__scroll-area":!0,"q-calendar__scroll":!0}},[!0!==b.value&&Ne(),Se()]):!0===h.noScroll?Te():xe.h("div",{ref:e,class:{"q-calendar-scheduler__scroll-area":!0,"q-calendar__scroll":!0}},[Te()])}function Te(){return xe.h("div",{ref:t,class:"q-calendar-scheduler__pane"},[Se()])}function Se(){return xe.h("div",{class:"q-calendar-scheduler__day--container"},[!0===b.value&&!0!==h.noHeader&&ie(),Ie()])}function Ie(e=void 0,a=0,n=!0){return void 0===e&&(e=h.modelResources),e.map((e,t)=>{return Ce(e,t,a,void 0!==e.children?e.expanded:n)}).flat()}function Ce(e,t,a=0,n=!0){const r={},o=(r.height=void 0!==e.height?Ue(parseInt(e.height,10)):M.value?Ue(M.value):"auto",ne.value>0&&(r.minHeight=Ue(ne.value)),xe.h("div",{key:e[h.resourceKey]+"-"+t,class:{"q-calendar-scheduler__resource--row":!0},style:r},[Fe(e,t,a,n),Ne(e,t,a,n)]));return void 0!==e.children?[o,xe.h("div",{class:{"q-calendar__child":!0,"q-calendar__child--expanded":!0===n,"q-calendar__child--collapsed":!0!==n}},[Ie(e.children,a+1,!1===n?n:e.expanded)])]:[o]}function Fe(t,e,a=0,n=!0){const r=p["resource-label"],o=parseInt(String(h.resourceMinHeight),10),u={},d=(u.height=void 0!==t.height?Ue(parseInt(t.height,10)):M.value?Ue(M.value):"auto",o>0&&(u.minHeight=Ue(o)),h.resourceStyle||J),i=t[h.resourceLabel],l=!0===h.focusable&&h.focusType.includes("resource")&&!0===n,s=t[h.resourceKey],c={resource:t,timestamps:S.value,days:S.value,resourceIndex:e,indentLevel:a,label:i,droppable:D.value===s},v="function"===typeof h.resourceClass?h.resourceClass({scope:c}):{};return xe.h("div",{key:t[h.resourceKey]+"-"+e,ref:e=>{null!==e&&(R.value[t[h.resourceKey]]=e)},tabindex:!0===l?0:-1,class:{"q-calendar-scheduler__resource":0===a,"q-calendar-scheduler__resource--section":0!==a,...v,"q-calendar__sticky":!0===b.value,"q-calendar__hoverable":!0===h.hoverable,"q-calendar__focusable":!0===l},style:{...u,...d({scope:c})},onDragenter:e=>{void 0!==h.dragEnterFunc&&"function"===typeof h.dragEnterFunc&&(!0===h.dragEnterFunc(e,"resource",{scope:c})?D.value=s:D.value="")},onDragover:e=>{void 0!==h.dragOverFunc&&"function"===typeof h.dragOverFunc&&(!0===h.dragOverFunc(e,"resource",{scope:c})?D.value=s:D.value="")},onDragleave:e=>{void 0!==h.dragLeaveFunc&&"function"===typeof h.dragLeaveFunc&&(!0===h.dragLeaveFunc(e,"resource",{scope:c})?D.value=s:D.value="")},onDrop:e=>{void 0!==h.dropFunc&&"function"===typeof h.dropFunc&&(!0===h.dropFunc(e,"resource",{scope:c})?D.value=s:D.value="")},onKeydown:e=>{N(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{N(e,[13,32])&&void 0!==k.value.onClickResource&&g("click-resource",{scope:c,event:e})},...F("-resource",e=>{return{scope:c,event:e}})},[[xe.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,g("resource-expanded",{expanded:t.expanded,scope:c})}}),xe.h("div",{class:{"q-calendar-scheduler__resource--text":!0,"q-calendar__ellipsis":!0},style:{paddingLeft:10*a+2+"px"}},[r?r({scope:c}):i]),Xe()]])}function Ne(e,t,a=0,n=!0){const r=p["resource-days"],o=!0===b.value?Ue(I.value):E.value,u={resource:e,resourceIndex:t,indentLevel:a,expanded:n,cellWidth:o,timestamps:S.value,days:S.value},d={},i=(d.height=parseInt(String(h.resourceHeight),10)>0?Ue(parseInt(String(h.resourceHeight),10)):"auto",parseInt(String(h.resourceMinHeight),10)>0&&(d.minHeight=Ue(parseInt(String(h.resourceMinHeight),10))),{class:"q-calendar-scheduler__resource--days",style:d});return xe.h("div",i,[...Ae(e,t,a,n),r&&r({scope:u})])}function Ae(t,a,n=0,r=!0){return 1===S.value.length&&parseInt(String(h.columnCount),10)>0?Array.apply(null,new Array(parseInt(String(h.columnCount),10))).map((e,t)=>t+parseInt(String(h.columnIndexStart),10)).map(e=>Me(S.value[0],e,t,a,n,r)):S.value.map(e=>Me(e,0,t,a,n,r))}function Me(e,t,a,n,r=0,o=!0){const u=p.day,d=h.dayStyle||j,i=!0!==h.noActiveDate&&T.value.date===e.date,l=e.date+":"+a[h.resourceKey]+(void 0!==t?":"+t:""),s=D.value===l,c={timestamp:e,columnIndex:t,resource:a,resourceIndex:n,indentLevel:r,activeDate:i,droppable:s},v=!0===b.value?Ue(I.value):E.value,m={width:v,maxWidth:v,...d({scope:c})},f=(m.height=parseInt(String(h.resourceHeight),10)>0?Ue(parseInt(String(h.resourceHeight),10)):"auto",parseInt(String(h.resourceMinHeight),10)>0&&(m.minHeight=Ue(parseInt(String(h.resourceMinHeight),10))),"function"===typeof h.dayClass?h.dayClass({scope:c}):{}),y=!0===h.focusable&&h.focusType.includes("day")&&!0===o;return xe.h("div",{key:e.date+(void 0!==t?":"+t:""),tabindex:!0===y?0:-1,class:{"q-calendar-scheduler__day":0===r,"q-calendar-scheduler__day--section":0!==r,...f,..._(e),"q-calendar__hoverable":!0===h.hoverable,"q-calendar__focusable":!0===y},style:m,onDragenter:e=>{void 0!==h.dragEnterFunc&&"function"===typeof h.dragEnterFunc&&(!0===h.dragEnterFunc(e,"day",{scope:c})?D.value=l:D.value="")},onDragover:e=>{void 0!==h.dragOverFunc&&"function"===typeof h.dragOverFunc&&(!0===h.dragOverFunc(e,"day",{scope:c})?D.value=l:D.value="")},onDragleave:e=>{void 0!==h.dragLeaveFunc&&"function"===typeof h.dragLeaveFunc&&(!0===h.dragLeaveFunc(e,"day",{scope:c})?D.value=l:D.value="")},onDrop:e=>{void 0!==h.dropFunc&&"function"===typeof h.dropFunc&&(!0===h.dropFunc(e,"day",{scope:c})?D.value=l:D.value="")},onKeydown:e=>{N(e,[13,32])&&(e.stopPropagation(),e.preventDefault())},onKeyup:e=>{N(e,[13,32])&&(w.value=c.timestamp.date,void 0!==k.value.onClickResource)&&g("click-resource",{scope:c,event:e})},...F("-day-resource",e=>{return{scope:c,event:e}})},[u&&u({scope:c}),Xe()])}function Ee(){return xe.h("div",{},"No resources have been defined")}function qe(){const{start:e,end:t,maxDays:a}=X.value,n=(i.value===e.date&&l.value===t.date&&s.value===a||(i.value=e.date,l.value=t.date,s.value=a),c.width>0),r=h.modelResources&&h.modelResources.length>0,o=xe.withDirectives(xe.h("div",{key:i.value,class:"q-calendar-scheduler"},[!0===n&&!0===r&&!0!==b.value&&!0!==h.noHeader&&ie(),!0===n&&!0===r&&be(),!1===r&&Ee()]),[[Be,de]]);if(!0!==h.animated)return o;{const u="q-calendar--"+("prev"===d.value?h.transitionPrev:h.transitionNext);return xe.h(xe.Transition,{name:u,appear:!0},()=>o)}}return xe.watch([S],ee,{deep:!0,immediate:!0}),xe.watch(()=>h.modelValue,(e,t)=>{if(w.value!==h.modelValue){if(!0===h.animated){const a=Re(We(e)),n=Re(We(t));d.value=a>=n?"next":"prev"}w.value=e}m.value=e}),xe.watch(w,(e,t)=>{if(w.value!==h.modelValue){if(!0===h.animated){const a=Re(We(e)),n=Re(We(t));d.value=a>=n?"next":"prev"}g("update:model-value",e)}}),xe.watch(m,e=>{e&&(a.value=He(e))}),xe.watch(a,()=>{f.value[m.value]?f.value[m.value].focus():te()}),xe.watch(()=>h.maxDays,e=>{s.value=e}),xe.onBeforeUpdate(()=>{f.value={},n.value=void 0,r.value=void 0,R.value={}}),xe.onMounted(()=>{}),O({prev:ue,next:oe,move:C,moveToToday:re,updateCurrent:V}),()=>G()}});const it="4.1.2";ye={version:it,QCalendarScheduler:dt,...ye,...pe,install(e){e.component(String(dt.name),dt)}};return ye});