UNPKG

@sbh321/qcalendar

Version:

A forked version of Jeff Galbraith's fork of Quasar UI QCalendar

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