@progress/kendo-vue-dateinputs
Version:
15 lines • 133 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@progress/kendo-vue-common"),require("@progress/kendo-date-math"),require("@progress/kendo-vue-intl"),require("@progress/kendo-vue-buttons"),require("@progress/kendo-svg-icons"),require("@progress/kendo-vue-labels"),require("@progress/kendo-vue-popup")):"function"==typeof define&&define.amd?define(["exports","vue","@progress/kendo-vue-common","@progress/kendo-date-math","@progress/kendo-vue-intl","@progress/kendo-vue-buttons","@progress/kendo-svg-icons","@progress/kendo-vue-labels","@progress/kendo-vue-popup"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoVueDateinputs={},e.Vue,e.KendoVueCommon,e.KendoDateMath,e.KendoVueIntl,e.KendoVueButtons,e.KendoSVGIcons,e.KendoVueLabels,e.KendoVuePopup)}(this,(function(e,t,i,s,a,n,o,r,l){"use strict";const h={name:"@progress/kendo-vue-dateinputs",productName:"Kendo UI for Vue",productCode:"KENDOUIVUE",productCodes:["KENDOUIVUE"],publishDate:1641551183,version:"7.0.2",licensingDocsUrl:"https://www.telerik.com/kendo-vue-ui/my-license/?utm_medium=product&utm_source=kendovue&utm_campaign=kendo-ui-vue-purchase-license-keys-warning"},u=t.defineComponent({name:"KendoCalendarCell",emits:{click:e=>!0,mousedown:e=>!0,mouseenter:e=>!0,mouseleave:e=>!0},props:{isDisabled:Boolean,view:Number,formattedValue:String,id:String,isWeekend:Boolean,isFocused:Boolean,isSelected:Boolean,isInRange:Boolean,isRangeStart:Boolean,isRangeEnd:Boolean,isRangeMid:Boolean,isRangeSplitEnd:Boolean,isRangeSplitStart:Boolean,isToday:Boolean,title:String,value:Date},updated(){},render(){const e=i.getDefaultSlots(this),{formattedValue:s,isWeekend:a,isFocused:n,isInRange:o,isSelected:r,isRangeStart:l,isRangeMid:h,isRangeEnd:u,isRangeSplitStart:d,isRangeSplitEnd:c,isToday:p,isDisabled:m,view:g,value:f}=this.$props,v="end"===this.$props.activeRangeEnd&&u,w="start"===this.$props.activeRangeEnd&&l;return t.createVNode("td",{id:this.$props.id,title:this.$props.title,class:{"k-calendar-td":!0,"k-range-end":u,"k-range-mid":h,"k-range-split-end":c,"k-range-split-start":d,"k-range-start":l,"k-active":w||v,"k-focus":n,"k-selected":r||l||u,"k-today":p,"k-weekend":a,"k-disabled":m},onClick:this.handleClick,onMousedown:this.handleMouseDown,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave},[t.createVNode("span",{class:"k-link"},[e])])},methods:{handleClick(e){const{value:t}=this.$props;this.$emit("click",t,e)},handleMouseDown(e){const{value:t}=this.$props;this.$emit("mousedown",t,e)},handleMouseEnter(){const{value:e}=this.$props;this.$emit("mouseenter",e)},handleMouseLeave(){const{value:e}=this.$props;this.$emit("mouseleave",e)}}}),d=t.defineComponent({props:{id:String,value:Number,className:String},emits:{click:e=>!0},render(){const e=i.getDefaultSlots(this);return t.createVNode("td",{onClick:this.handleClick,id:this.$props.id},[void 0!==this.$props.value?this.$props.value:e])},methods:{handleClick(e){const{value:t}=this.$props;this.$emit("click",t,e)}}});var c=(e=>(e[e.month=0]="month",e[e.year=1]="year",e[e.decade=2]="decade",e[e.century=3]="century",e))(c||{});const p={start:null,end:null},m=(e,t,i)=>void 0===t||void 0===i||t<=e&&e<=i?e:e<t?t:i,g=new Date(1980,0,1),f=new Date(1900,0,1),v=new Date(2099,11,31),w=new Date(1980,0,1),$=new Date(1980,0,1,23,59,59),y=(e,t)=>{const i=s.cloneDate(e);return i.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),i},D=()=>s.getDate(new Date),S=(e,t,i)=>!e||!(t&&t>e||i&&i<e),b=(e,t,i)=>null===e||!(t&&s.getDate(t)>s.getDate(e)||i&&s.getDate(i)<s.getDate(e)),k=(e,t)=>{const{start:i,end:s}=t||p;return!(!i||!s)&&(i<e&&e<s)},V=(e,t,i=1)=>{const s=[];for(let a=e;a<t;a+=i)s.push(a);return s},I=(e,t)=>e.slice(t).concat(e.slice(0,t)),C=(e,t,i)=>e&&(t&&e<t?s.cloneDate(t):i&&e>i?s.cloneDate(i):e),M=e=>(t,i="",s={})=>{const a=document.createElement(e);return a.className=i,Object.keys(s).map((e=>a.style[e]=s[e])),"string"==typeof t?a.innerHTML=t||"":(t||[]).forEach((e=>e&&a.appendChild(e))),a};let F=class{constructor(e){this.intl=e}getWeekNames(e=!1){const t=I(this.intl.dateFormatNames({nameType:"short",type:"days"}),this.intl.firstDay());return e?[""].concat(t):t}};const x=t.defineComponent({name:"KendoView",inject:{kendoIntlService:{default:null}},props:{activeRangeEnd:{type:String},activeView:{type:Number,required:!0},cell:[String,Function,Object],cellUID:{type:String,required:!0},direction:{type:String,default:"vertical"},isActive:{type:Boolean,default:void 0},focusedDate:{type:Date,required:!0},max:{type:Date,required:!0},min:{type:Date,required:!0},selectedDate:{type:[Date,Array,Object],default:function(){return D()}},selectionRange:Object,showWeekNumbers:{type:Boolean,default:!1},viewDate:{type:Date,required:!0},weekCell:[String,Function,Object],bus:Object,service:Object,onChange:Function,onWeekcellclick:Function,onCellenter:Function,onViewmousedown:Function},computed:{isHorizontal(){return"horizontal"===this.$props.direction},isMonthView(){return this.$props.activeView===c.month},weekNumber(){return!(!this.$props.showWeekNumbers||this.$props.activeView!==c.month)}},methods:{getWeekNumber(e){return this.weekNumber?s.weekInYear(e,this._intl.firstDay()):null},firstDate(e){const t=this.firstWeekDateContext(e);return t?t.value:null},firstWeekDateContext(e){if(!this.weekNumber)return null;let t=0,i=e[t];for(;!i&&t<e.length;)i=e[++t];return i},handleClick(e,t){const i={value:s.cloneDate(e),target:this,event:t};this.$emit("change",i)},handleWeekCellClick(e,t){const i={value:e,event:t};this.$emit("weekcellclick",i)},handleMouseDown(e,t){const i={value:s.cloneDate(e),target:this,event:t};this.$emit("viewmousedown",i)},handleMouseEnter(e){this.$emit("cellenter",s.cloneDate(e))},handleMouseLeave(e){this.$emit("cellleave",s.cloneDate(e))}},setup:()=>({kendoIntlService:t.inject("kendoIntlService",{})}),render(){this._intl=a.provideIntlService(this),this._weekService=new F(this._intl);const e=e=>t.createVNode("td",{key:e,class:"k-calendar-td k-empty"},[t.createTextVNode(" ")]),s=D(),n=this.$props.isActive?this.$props.focusedDate:null,o=y(this.$props.viewDate,s),r=this.$props.service.data({cellUID:this.$props.cellUID,min:this.$props.min,max:this.$props.max,focusedDate:n,isActiveView:!this.$props.bus.canMoveDown(this.$props.activeView),selectedDate:this.$props.selectedDate,selectionRange:this.$props.selectionRange,viewDate:o}),l=function(s,a){if(!this.firstDate(s))return e(`week-cell-${a}`);const n=this.getWeekNumber(this.firstDate(s)),o=`kendo-vue-calendar-week-cell-${n}`,r=t.createVNode(d,{class:"k-calendar-td k-alt",value:n,onClick:this.handleWeekCellClick,key:o},function(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}(n)?n:{default:()=>[n]});return i.getTemplate.call(this,{h:t.h,template:this.$props.weekCell,defaultRendering:r,defaultSlots:n,additionalListeners:{click:this.handleWeekCellClick},additionalProps:{value:n,key:o}})},h=function(s){return s.map((function(s,a){if(!s)return e(a);const n=`kendo-vue-calendar-cell-${s.value.getTime()}`,o=t.createVNode(u,{"aria-selected":s.isSelected,formattedValue:s.formattedValue,id:s.id,isFocused:s.isFocused,isSelected:s.isSelected,isInRange:s.isInRange,isWeekend:s.isWeekend,isRangeStart:s.isRangeStart,isRangeMid:s.isRangeMid,isRangeEnd:s.isRangeEnd,isRangeSplitStart:s.isRangeSplitStart,isRangeSplitEnd:s.isRangeSplitEnd,isToday:s.isToday,title:s.title,value:s.value,isDisabled:!s.isInRange,view:this.$props.activeView,onClick:this.handleClick,onMousedown:this.handleMouseDown,onMouseenter:this.handleMouseEnter,onMouseleave:this.handleMouseLeave,key:n},{default:()=>[s.formattedValue]});return i.getTemplate.call(this,{h:t.h,template:this.$props.cell,defaultRendering:o,defaultSlots:s.formattedValue,additionalListeners:{click:this.handleClick,mousedown:this.handleMouseDown,mouseenter:this.handleMouseEnter,mouseleave:this.handleMouseLeave},additionalProps:{formattedValue:s.formattedValue,id:s.id,isFocused:s.isFocused,isSelected:s.isSelected,isInRange:s.isInRange,isWeekend:s.isWeekend,isRangeStart:s.isRangeStart,isRangeMid:s.isRangeMid,isRangeEnd:s.isRangeEnd,isRangeSplitStart:s.isRangeSplitStart,isRangeSplitEnd:s.isRangeSplitEnd,isToday:s.isToday,title:s.title,value:s.value,isDisabled:!s.isInRange,view:this.$props.activeView,key:n}})}),this)};return t.createVNode("tbody",{class:"k-calendar-tbody",role:"rowgroup"},[r.map((function(e,i){return t.createVNode("tr",{class:"k-calendar-tr",role:"row",key:i},[this.weekNumber&&l.call(this,e,i),h.call(this,e)])}),this)])}}),_=t.defineComponent({name:"KendoViewList",inheritAttrs:!1,inject:{kendoIntlService:{default:null}},props:{allowReverse:Boolean,hasFocusedDate:Boolean,activeView:{type:Number,required:!0},bottomOffset:{type:Number},cell:[String,Function,Object],cellUID:{type:String,required:!0},dates:Array,focusedDate:{type:Date,required:!0},isActive:{type:Boolean,default:void 0},max:{type:Date,required:!0},min:{type:Date,required:!0},selectionRange:Object,showWeekNumbers:{type:Boolean,default:!1},take:{type:Number,default:5},value:{type:[Date,Array,Object]},views:{type:Number,default:1},viewHeight:Number,viewOffset:Number,bus:Object,dom:Object,weekCell:[String,Function,Object],service:Object,tabIndex:Number,shouldScroll:Boolean,onChange:Function,onWeekcellclick:Function,onWeeknameclick:Function,onCellenter:Function,onViewmousedown:Function,onListfocus:Function,onListblur:Function,onListkeydown:Function,onListmousedown:Function},data:function(){return{lastViewsCount:0,valueHasUpdated:!1,shouldScrollValue:!1}},computed:{weekNames(){this._intl=a.provideIntlService(this);const e=I(this._intl.dateFormatNames({nameType:"short",type:"days"}),this._intl.firstDay());return this.weekNumber?[""].concat(e):e},weekNumber(){return!(!this.$props.showWeekNumbers||this.$props.activeView!==c.month)}},created(){this.lastView=this.$props.activeView,this.lastFocus=this.$props.focusedDate,this.shouldScrollValue=this.$props.shouldScroll},updated(){this.shouldScrollValue=!1,this.lastView=this.$props.activeView,this.$data.lastViewsCount=this.$props.views,this.indexToScroll=void 0},methods:{handleFocus(e){this.$emit("listfocus",e)},handleBlur(e){this.$emit("listblur",e)},handleKeyDown(e){this.$emit("listkeydown",e)},handleVirtualizationMount(e){},calculateHeights(){if(!this.$props.dom)return;const e=this.$props.activeView===c.month?this.$props.dom.scrollableContentHeight:this.$props.dom.scrollableYearContentHeight;this._bottomOffset=e-this.$props.dom.viewHeight(this.$props.activeView),this._viewOffset=-1*this.$props.dom.headerHeight,this._viewHeight=this.$props.dom.viewHeight(this.$props.activeView)||1},getTake(e,t){return Math.min(t-e,this.$props.take)},handleScrollAction(){},handleTodayClick(e){this.shouldScrollValue=!0,this.handleDateChange(e,!0)},handleMouseDown(e){const t={event:e.event,value:s.cloneDate(e.value),target:this};this.$emit("listmousedown",t)},handleDateChange(e,t=!1){const i={event:e.event,value:s.cloneDate(e.value),target:this,isTodayClick:t};this.$emit("change",i)},handleWeekCellClick(e){this.$emit("weekcellclick",e)},handleWeekNameClick(e,t){const i={value:t,event:e};this.$emit("weeknameclick",i)},handleCellEnter(e){this.$emit("cellenter",e)},rotateSelectionRange(e){if(null===e.start||null===e.end)return e;const t=e.end<e.start;return{start:t?e.end:e.start,end:t?e.start:e.end}}},setup:()=>({kendoIntlService:t.inject("kendoIntlService",{})}),mounted(){this._calendarView=this.$refs.calendarView},render(){const e=this.$props.allowReverse?this.rotateSelectionRange(this.$props.selectionRange):this.$props.selectionRange,s=i.classNames("k-calendar-view","k-hstack k-align-items-start k-justify-content-center",{"k-calendar-monthview":this.$props.activeView===c.month,"k-calendar-yearview":this.$props.activeView===c.year,"k-calendar-decadeview":this.$props.activeView===c.decade,"k-calendar-centuryview":this.$props.activeView===c.century}),a=i.classNames("k-calendar-table"),n=function(e){return t.createVNode("thead",{class:"k-calendar-thead"},[t.createVNode("tr",{class:"k-calendar-tr"},[e.map(((e,i)=>t.createVNode("th",{class:"k-calendar-th",key:i,onClick:t=>this.handleWeekNameClick(t,e)},[e])),this)])])};return t.createVNode("div",{style:this.$attrs.style,class:s,onFocusin:this.handleFocus,onFocusout:this.handleBlur},[function(){const i=this.$props.cellUID;return this.$props.dates.map((function(s){return t.createVNode("table",{role:"grid","aria-label":this.$props.service.title(this.$props.focusedDate),"aria-live":"polite","aria-activedescendant":i+this.$props.focusedDate.getTime(),tabindex:this.$props.tabIndex,class:a,onKeydown:this.handleKeyDown},[this.$props.activeView===c.month&&n.call(this,this.weekNames),t.createVNode(x,{key:s.getTime(),activeView:this.$props.activeView,viewDate:s,min:this.$props.min,max:this.$props.max,cellUID:i,isActive:this.$props.isActive,focusedDate:this.$props.focusedDate,cell:this.$props.cell,selectionRange:e,selectedDate:this.$props.value,showWeekNumbers:this.weekNumber,onChange:this.handleDateChange,onWeekcellclick:this.handleWeekCellClick,onCellenter:this.handleCellEnter,onViewmousedown:this.handleMouseDown,bus:this.$props.bus,service:this.$props.service,weekCell:this.$props.weekCell},null)])}),this)}.call(this)])}}),T=new Date(1980,0,1),R=new Date(1900,0,1),N=new Date(2099,11,31),O=new Date(1980,0,1),B=new Date(1980,0,1,23,59,59);var L=(e=>(e[e.Left=0]="Left",e[e.Right=1]="Right",e[e.Up=2]="Up",e[e.Down=3]="Down",e[e.PrevView=4]="PrevView",e[e.NextView=5]="NextView",e[e.FirstInView=6]="FirstInView",e[e.LastInView=7]="LastInView",e[e.LowerView=8]="LowerView",e[e.UpperView=9]="UpperView",e))(L||{});const E=[[]],A={[L.Left]:e=>s.addDecades(e,-1),[L.Up]:e=>s.addDecades(e,-4),[L.Right]:e=>s.addDecades(e,1),[L.Down]:e=>s.addDecades(e,4),[L.PrevView]:e=>s.addCenturies(e,-1),[L.NextView]:e=>s.addCenturies(e,1),[L.FirstInView]:e=>s.firstDecadeOfCentury(e),[L.LastInView]:e=>s.lastDecadeOfCentury(e)};const j=[[]],H={[L.Left]:e=>s.addYears(e,-1),[L.Up]:e=>s.addYears(e,-4),[L.Right]:e=>s.addYears(e,1),[L.Down]:e=>s.addYears(e,4),[L.PrevView]:e=>s.addDecades(e,-1),[L.NextView]:e=>s.addDecades(e,1),[L.FirstInView]:e=>s.firstYearOfDecade(e),[L.LastInView]:e=>s.lastYearOfDecade(e)};const P=[[]],z={[L.Left]:e=>s.addDays(e,-1),[L.Up]:e=>s.addWeeks(e,-1),[L.Right]:e=>s.addDays(e,1),[L.Down]:e=>s.addWeeks(e,1),[L.PrevView]:e=>s.addMonths(e,-1),[L.NextView]:e=>s.addMonths(e,1),[L.FirstInView]:e=>s.firstDayOfMonth(e),[L.LastInView]:e=>s.lastDayOfMonth(e)};const q=[[]],K={[L.Left]:e=>s.addMonths(e,-1),[L.Up]:e=>s.addMonths(e,-4),[L.Right]:e=>s.addMonths(e,1),[L.Down]:e=>s.addMonths(e,4),[L.PrevView]:e=>s.addYears(e,-1),[L.NextView]:e=>s.addYears(e,1),[L.FirstInView]:e=>s.firstMonthOfYear(e),[L.LastInView]:e=>s.lastMonthOfYear(e)};const Y={[c.month]:class{constructor(e){this.intl=e}addToDate(e,t){return s.addMonths(e,t)}datesList(e,t){return V(0,t).map((t=>s.addMonths(e,t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:a,max:n,min:o,selectedDate:r,selectionRange:l=p,viewDate:h}=e;if(!h)return P;const u=s.firstDayOfMonth(h),d=s.lastDayOfMonth(h),c=s.dayOfWeek(u,this.intl.firstDay(),-1),m=V(0,7),g=D();return V(0,6).map((e=>{const h=s.addDays(c,7*e);return m.map((e=>{const c=this.normalize(s.addDays(h,e),o,n);if(c<u||c>d)return null;const p=this.isEqual(c,l.start),m=this.isEqual(c,l.end),f=!p&&!m&&k(c,l),v=a&&(Array.isArray(r)?this.isSelectedFromArray(c,r,o,n):S(r,o,n)&&this.isEqual(c,r));return{formattedValue:this.value(c),id:`${t}${c.getTime()}`,isFocused:this.isEqual(c,i),isSelected:v,isInRange:S(c,o,n),isWeekend:this.isWeekend(c),isRangeStart:p,isRangeMid:f,isRangeEnd:m,isRangeSplitStart:f&&this.isEqual(c,u),isRangeSplitEnd:f&&this.isEqual(c,d),isToday:this.isEqual(c,g),title:this.cellTitle(c),value:c}}))}))}isEqual(e,t){return!(!e||!t)&&s.getDate(e).getTime()===s.getDate(t).getTime()}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{S(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isInArray(e,t){return!!t.length&&s.firstDayOfMonth(t[0])<=e&&e<=s.lastDayOfMonth(t[t.length-1])}isInRange(e,t,i){const a=s.getDate(e),n=!t||s.getDate(t)<=a,o=!i||a<=s.getDate(i);return n&&o}isInSameView(e,t){return 0===s.durationInMonths(e,t)}isRangeStart(e){return!e.getMonth()}move(e,t){const i=z[t];return i?i(e):e}cellTitle(e){return this.intl.formatDate(e,"D")}navigationTitle(e){return e?this.isRangeStart(e)?e.getFullYear().toString():this.abbrMonthNames()[e.getMonth()]:""}title(e){return`${this.wideMonthNames()[e.getMonth()]} ${e.getFullYear()}`}rowLength(e){return 7+(e?1:0)}skip(e,t){return s.durationInMonths(t,e)}total(e,t){return s.durationInMonths(e,t)+1}value(e){return e?e.getDate().toString():""}viewDate(e,t,i=1){return s.durationInMonths(e,t)<i?s.addMonths(e,-1):e}isWeekend(e){const t=e.getDay();return 6===t||0===t}abbrMonthNames(){return this.intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(e,t,i){return e<t&&this.isEqual(e,t)?s.getDate(t):e>i&&this.isEqual(e,i)?s.getDate(i):e}wideMonthNames(){return this.intl.dateFormatNames({nameType:"wide",type:"months",standAlone:!0})}},[c.year]:class{constructor(e){this._intl=e}addToDate(e,t){return s.addYears(e,t)}datesList(e,t){return V(0,t).map((t=>s.addYears(e,t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:a,max:n,min:o,selectedDate:r,selectionRange:l=p,viewDate:h}=e;if(!h)return q;const u=this.abbrMonthNames(),d=s.firstMonthOfYear(h),c=s.lastMonthOfYear(h),m=d.getFullYear(),g=V(0,4),f=D();return V(0,3).map((e=>{const h=s.addMonths(d,4*e);return g.map((e=>{const p=this.normalize(s.addMonths(h,e),o,n);if(!p||m<p.getFullYear())return null;const g=this.isEqual(p,l.start),v=this.isEqual(p,l.end),w=!g&&!v&&k(p,l),$=a&&(Array.isArray(r)?this.isSelectedFromArray(p,r,o,n):S(r,o,n)&&this.isEqual(p,r));return{formattedValue:u[p.getMonth()],id:`${t}${p.getTime()}`,isFocused:this.isEqual(p,i),isSelected:$,isInRange:S(p,o,n),isWeekend:!1,isRangeStart:g,isRangeMid:w,isRangeEnd:v,isRangeSplitEnd:w&&this.isEqual(p,c),isRangeSplitStart:w&&this.isEqual(p,d),isToday:this.isEqual(p,f),title:this.cellTitle(p),value:p}}))}))}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{S(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isEqual(e,t){return!(!e||!t)&&(e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth())}isInArray(e,t){if(!t.length)return!1;const i=e.getFullYear();return t[0].getFullYear()<=i&&i<=t[t.length-1].getFullYear()}isInRange(e,t,i){const a=s.createDate(e.getFullYear(),e.getMonth(),1),n=!t||s.createDate(t.getFullYear(),t.getMonth(),1)<=a,o=!i||a<=s.createDate(i.getFullYear(),i.getMonth(),1);return n&&o}isInSameView(e,t){return 0===s.durationInYears(e,t)}isRangeStart(e){return e.getFullYear()%10==0}move(e,t){const i=K[t];return i?i(e):e}cellTitle(e){return`${e.getFullYear()} ${this.value(e)}`}navigationTitle(e){return this.title(e)}title(e){return e?e.getFullYear().toString():""}rowLength(e){return 4}skip(e,t){return s.durationInYears(t,e)}total(e,t){return s.durationInYears(e,t)+1}value(e){return e?this.abbrMonthNames()[e.getMonth()]:""}viewDate(e,t,i=1){return s.durationInYears(e,t)<i?s.addYears(e,-1):e}abbrMonthNames(){return this._intl.dateFormatNames({nameType:"abbreviated",type:"months"})}normalize(e,t,s){return e<t&&this.isEqual(e,t)?i.cloneDate(t):e>s&&this.isEqual(e,s)?i.cloneDate(s):e}},[c.decade]:class{addToDate(e,t){return s.addDecades(e,t)}datesList(e,t){return V(0,t).map((t=>s.addDecades(s.firstYearOfDecade(e),t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:a,max:n,min:o,selectedDate:r,selectionRange:l=p,viewDate:h}=e;if(!h)return j;const u=V(0,4),d=s.firstYearOfDecade(h),c=s.lastYearOfDecade(h),m=D();return V(0,3).map((e=>{const h=s.addYears(d,4*e);return u.map((e=>{const u=this.normalize(s.addYears(h,e),o,n);if(!this.isInSameView(u,c))return null;const p=this.isEqual(u,l.start),g=this.isEqual(u,l.end),f=!p&&!g&&k(u,l),v=a&&(Array.isArray(r)?this.isSelectedFromArray(u,r,o,n):S(r,o,n)&&this.isEqual(u,r));return{formattedValue:this.value(u),id:`${t}${u.getTime()}`,isFocused:this.isEqual(u,i),isSelected:v,isWeekend:!1,isInRange:S(u,o,n),isRangeStart:p,isRangeMid:f,isRangeEnd:g,isRangeSplitEnd:f&&this.isEqual(u,c),isRangeSplitStart:f&&this.isEqual(u,d),isToday:this.isEqual(u,m),title:this.cellTitle(u),value:u}}))}))}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{S(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isEqual(e,t){return!(!e||!t)&&e.getFullYear()===t.getFullYear()}isInArray(e,t){if(!t.length)return!1;const i=e.getFullYear();return t[0].getFullYear()<=i&&i<=t[t.length-1].getFullYear()+9}isInRange(e,t,i){const s=e.getFullYear(),a=!t||t.getFullYear()<=s,n=!i||s<=i.getFullYear();return a&&n}isRangeStart(e){return e.getFullYear()%100==0}isInSameView(e,t){return 0===s.durationInDecades(e,t)}move(e,t){const i=H[t];return i?i(e):e}cellTitle(e){return e.getFullYear().toString()}navigationTitle(e){return e?s.firstYearOfDecade(e).getFullYear().toString():""}title(e){return e?`${s.firstYearOfDecade(e).getFullYear()} - ${s.lastYearOfDecade(e).getFullYear()}`:""}rowLength(e){return 4}skip(e,t){return s.durationInDecades(t,e)}total(e,t){return s.durationInDecades(e,t)+1}value(e){return e?e.getFullYear().toString():""}viewDate(e,t,i=1){return s.durationInDecades(e,t)<i?s.addDecades(e,-1):e}normalize(e,t,i){return e<t&&this.isEqual(e,t)?s.cloneDate(t):e>i&&this.isEqual(e,i)?s.cloneDate(i):e}},[c.century]:class{addToDate(e,t){return s.addCenturies(e,t)}datesList(e,t){return V(0,t).map((t=>s.addCenturies(e,t)))}data(e){const{cellUID:t,focusedDate:i,isActiveView:a,max:n,min:o,selectedDate:r,selectionRange:l=p,viewDate:h}=e;if(!h)return E;const u=V(0,4),d=s.firstDecadeOfCentury(h),c=s.lastDecadeOfCentury(h),m=D();return V(0,3).map((e=>{const h=s.addDecades(d,4*e);return u.map((e=>{const u=this.normalize(s.addDecades(h,e),o,n);if(!this.isInSameView(u,c))return null;const p=this.isEqual(u,l.start),g=this.isEqual(u,l.end),f=!p&&!g&&k(u,l),v=a&&(Array.isArray(r)?this.isSelectedFromArray(u,r,o,n):S(r,o,n)&&this.isEqual(u,r));return{formattedValue:this.value(u),id:`${t}${u.getTime()}`,isFocused:this.isEqual(u,i),isSelected:v,isWeekend:!1,isInRange:S(u,o,n),isRangeStart:p,isRangeMid:f,isRangeEnd:g,isRangeSplitEnd:f&&this.isEqual(u,c),isRangeSplitStart:f&&this.isEqual(u,d),isToday:this.isEqual(u,m),title:this.cellTitle(u),value:u}}))}))}isSelectedFromArray(e,t,i,s){let a=!1;return t.forEach((t=>{S(e,i,s)&&this.isEqual(e,t)&&(a=!0)})),a}isEqual(e,t){return!(!e||!t)&&s.firstYearOfDecade(e).getFullYear()===s.firstYearOfDecade(t).getFullYear()}isInArray(e,t){if(!t.length)return!1;const i=e.getFullYear();return t[0].getFullYear()<=i&&i<=t[t.length-1].getFullYear()+99}isInRange(e,t,i){const a=s.firstYearOfDecade(e).getFullYear(),n=!t||s.firstYearOfDecade(t).getFullYear()<=a,o=!i||a<=s.firstYearOfDecade(i).getFullYear();return n&&o}isInSameView(e,t){return 0===s.durationInCenturies(e,t)}isRangeStart(e){return e.getFullYear()%1e3==0}move(e,t){const i=A[t];return i?i(e):e}cellTitle(e){return s.firstYearOfDecade(e).getFullYear().toString()}navigationTitle(e){return e?s.firstDecadeOfCentury(e).getFullYear().toString():""}title(e){return e?`${s.firstDecadeOfCentury(e).getFullYear()} - ${s.lastDecadeOfCentury(e).getFullYear()}`:""}rowLength(e){return 4}skip(e,t){return s.durationInCenturies(t,e)}total(e,t){return s.durationInCenturies(e,t)+1}value(e){return e?s.firstYearOfDecade(e).getFullYear().toString():""}viewDate(e,t,i=1){return s.durationInCenturies(e,t)<i?s.addCenturies(e,-1):e}normalize(e,t,i){return e<t&&this.isEqual(e,t)?s.cloneDate(t):e>i&&this.isEqual(e,i)?s.cloneDate(i):e}}};let U=class{constructor(e){this.bottom=c.month,this.top=c.century,this.onViewChanged=e}configure(e,t){this.bottom=e,this.top=t}service(e,t){return new Y[`${e}`](t)}moveDown(e,t){this.move(e,-1,t)}moveUp(e,t){this.move(e,1,t)}moveToBottom(e){e!==this.bottom&&this.onViewChanged({view:this.bottom})}canMoveDown(e){return this.bottom<e}canMoveUp(e){return e<this.top}clamp(e){return e<this.bottom?this.bottom:e>this.top?this.top:e}move(e,t,i){const s=this.clamp(((e,t)=>{const i=c[c[e+t]];return void 0!==i?i:e})(e,t));s!==e&&this.onViewChanged({view:s},i)}},W=class{constructor(){this.didCalculate=!1}ensureHeights(){void 0===this.calendarHeight&&this.calculateHeights()}calculateHeights(e){if(!i.canUseDOM)return;const t=M("div"),s=M("ul"),a=M("li"),n=M("td"),o=M("th"),r=M("tr"),l=M("tbody"),h=M("thead"),u=M("table"),d=()=>t('\n <span class="k-calendar-title">March 2017</span>\n <span class="k-calendar-today">TODAY</span>\n ',"k-calendar-header"),c=(e,t)=>new Array(e).fill("1").map(t),p=e=>t(e,"k-content k-scrollable"),m=(()=>{let e;return()=>i.canUseDOM?(e||(e=t([p([s([a("<span>FEB</span>")])])],"k-calendar-navigation",{left:"0px",position:"absolute"})),e):null})(),g=({cells:e,rows:s},a,m)=>{let g;return()=>i.canUseDOM?(g||(g=((e,i,s)=>t(s?[d(),u([h([r([o("MO")])])]),p([e,e])]:[d(),p([e,e])],i,{left:"-10000px",position:"absolute"}))(((e,t=1)=>u([l([r([o("1")])].concat(c(e,(()=>r(c(t,(e=>n(`<span class="k-link">${e}</span>`))))))))]))(s,e),a,m)),g):null},f=e=>e.querySelector(".k-scrollable"),v=e=>{const t=f(e);return t.className=`${t.className} k-scrollable-horizontal`,e},w=g({cells:7,rows:6},"k-calendar-view k-calendar-monthview",!0),$=g({cells:5,rows:3},"k-calendar-view k-calendar-yearview",!1),y=g({cells:5,rows:2},"k-calendar-view k-calendar-decadeview",!1),D=e=>parseFloat(window.getComputedStyle(e).height)||e.offsetHeight,S=e=>{const t=window.getComputedStyle(e);return parseFloat(t.width)+parseFloat(t.paddingLeft)+parseFloat(t.paddingRight)||e.offsetWidth},b=e=>e.querySelector("tbody");this.didCalculate=!0,e&&(this.hostContainer=e),this.batch(w(),(e=>{const t=b(e);this.calendarHeight=D(e),this.monthViewHeight=D(t),this.headerHeight=D(t.children[0]),this.scrollableContentHeight=D(f(e))})),this.batch(v(w()),(e=>{const t=b(e);this.calendarWidth=S(e),this.monthViewWidth=S(t),this.scrollableContentWidth=S(f(e))})),this.batch($(),(e=>{this.yearViewHeight=D(b(e)),this.scrollableYearContentHeight=D(f(e))})),this.batch(v($()),(e=>{this.yearViewWidth=S(b(e))})),this.batch(y(),(e=>{this.decadeViewHeight=D(b(e)),this.centuryViewHeight=this.decadeViewHeight})),this.batch(v(y()),(e=>{this.decadeViewWidth=S(b(e)),this.centuryViewWidth=this.decadeViewWidth})),this.batch(m(),(e=>{this.navigationItemHeight=D(e.querySelector("li"))}))}viewHeight(e){return this.viewDimension(e,"height")}viewWidth(e){return this.viewDimension(e,"width")}viewDimension(e,t){const i="height"===t?"ViewHeight":"ViewWidth";switch(e){case c.month:return this[`month${i}`];case c.year:return this[`year${i}`];case c.decade:return this[`decade${i}`];case c.century:return this[`century${i}`];default:return 1}}batch(e,t){const i=this.hostContainer||document.body,s=i.appendChild(e);t(s),i.removeChild(s)}};const Z={33:L.PrevView,34:L.NextView,35:L.LastInView,36:L.FirstInView,37:L.Left,38:L.Up,39:L.Right,40:L.Down,"meta+38":L.UpperView,"meta+40":L.LowerView,"meta+37":L.PrevView,"meta+39":L.NextView};let G=class{constructor(e){this.bus=e}action(e){const t=`${e.ctrlKey||e.metaKey?"meta+":""}${e.keyCode}`;return Z[t]}move(e,t,i,s,a){return s?t===L.UpperView&&this.bus.canMoveUp(i)?(this.bus.moveUp(i,a),e):t===L.LowerView&&this.bus.canMoveDown(i)?(this.bus.moveDown(i,a),e):s.move(e,t):e}};const J=t.defineComponent({name:"KendoHeaderTitle",emits:{click:e=>!0},props:{id:String,value:String,view:Number},methods:{handleClick(e){this.$emit("click",e)}},render(){const e=i.getDefaultSlots(this);return t.createVNode(n.Button,{role:"link",type:"button",id:this.$props.id,fillMode:"flat",themeColor:"primary",onClick:this.handleClick,tabIndex:0},function(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}(e)?e:{default:()=>[e]})}}),Q="calendar.prevView",X="calendar.nextView",ee="dateinput.increment",te="dateinput.decrement",ie="calendar.today",se="datepicker.toggleCalendar",ae="daterangepicker.swapStartEnd",ne="daterangepicker.start",oe="daterangepicker.end",re="daterangepicker.separator",le="datetimepicker.toggleDateTimeSelector",he="timepicker.now",ue="timepicker.selectNow",de="timepicker.cancel",ce="timepicker.set",pe="timepicker.toggleTimeSelector",me="timepicker.toggleClock",ge="datetimepicker.date",fe="datetimepicker.time",ve="datetimepicker.cancel",we="datetimepicker.set",$e={[ie]:"Today",[he]:"NOW",[ce]:"Set",[de]:"Cancel",[ge]:"Date",[fe]:"Time",[ve]:"Cancel",[we]:"Set",[ne]:"Start",[oe]:"End",[re]:" ",[ue]:"Select Now",[pe]:"Toggle TimeSelector",[me]:"Toggle Clock",[ee]:"Increase value",[te]:"Decrease value",[se]:"Toggle calendar",[Q]:"Navigate to previous view",[X]:"Navigate to next view",[ae]:"Swap start and end values",[le]:"Toggle date-time selector"};function ye(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!t.isVNode(e)}const De=t.defineComponent({name:"KendoCalendarHeader",inheritAttrs:!1,inject:{kendoLocalizationService:{default:null}},emits:["titleclick","todayclick","nextclick","prevclick"],props:{activeView:{type:Number,required:!0},currentDate:{type:Date,required:!0},focusedDate:{type:Date,required:!0},headerTitle:{type:[String,Object,Function],default:function(){}},max:{type:Date,default:function(){return v}},min:{type:Date,default:function(){return R}},bus:Object,service:Object,rangeLength:{type:Number,default:1},tabIndex:{type:Number,default:0},onTodayClick:Function,onNextClick:Function,onPrevClick:Function,onTitleClick:Function},data:()=>({currentRtl:!1}),mounted(){this.currentRtl=i.isRtl(this.$el)},computed:{navigate(){return this.$props.bus.canMoveUp(this.$props.activeView)},todayIsInRange(){return S(D(),s.getDate(this.$props.min),s.getDate(this.$props.max))}},methods:{getTitle(){if(!this.$props.currentDate)return"";const e=this.$props.rangeLength-1,t=this.$props.service.title(this.$props.currentDate),i=this.$props.service.addToDate(this.$props.currentDate,e);return e<1||!this.$props.service.isInRange(i,this.$props.min,this.$props.max)?t:`${t} - ${this.$props.service.title(i)}`},handleTitleClick(e){this.navigate&&(this.$props.bus.moveUp(this.$props.activeView,e),this.$emit("titleclick",e))},canNavigate(e){if(!this.$props.service)return!1;const t=this.$props.service.move(this.$props.focusedDate,e);return this.$props.min<=t&&t<=this.$props.max||this.$props.service.isInSameView(t,this.$props.min)||this.$props.service.isInSameView(t,this.$props.max)},move(e){return this.clampDate(this.$props.service.move(this.$props.focusedDate,e))},clampDate(e){return C(e,this.$props.min,this.$props.max)},handleNextClick(e){const t={event:e,value:this.move(L.NextView),target:this};this.$emit("nextclick",t)},handlePrevClick(e){const t={event:e,value:this.move(L.PrevView),target:this};this.$emit("prevclick",t)},handleTodayClick(e){if(!this.todayIsInRange)return;this.$props.bus.moveToBottom(this.$props.activeView);const t={event:e,value:C(D(),this.$props.min,this.$props.max),target:this};this.$emit("todayclick",t)},todayKeyDown(e){const{keyCode:t}=e;t===i.Keys.enter&&this.handleTodayClick(e)}},setup:()=>({kendoLocalizationService:t.inject("kendoLocalizationService",{})}),render(){this._localization=a.provideLocalizationService(this);const e=this._localization.toLanguageString(ie,$e[ie]),s=this.getTitle(),r=this._localization.toLanguageString(Q,$e[Q]),l=this._localization.toLanguageString(X,$e[X]),h=!this.canNavigate(L.PrevView),u=!this.canNavigate(L.NextView),d=i.classNames("k-calendar-title",{"k-disabled":!this.navigate}),c=i.classNames("k-calendar-nav-today",{"k-disabled":!this.todayIsInRange});let p;const m=t.createVNode(J,{value:s,view:this.$props.activeView,class:d,onClick:this.handleTitleClick},ye(s)?s:{default:()=>[s]});p=i.getTemplate.call(this,{h:t.h,template:this.$props.headerTitle,defaultRendering:m});const g=t.createVNode(n.Button,{type:"button",fillMode:"flat",themeColor:"base",class:c,tabIndex:this.$props.tabIndex,onKeydown:this.todayKeyDown,onClick:this.handleTodayClick},ye(e)?e:{default:()=>[e]}),f=i.getTemplate.call(this,{h:t.h,defaultRendering:g});return t.createVNode("div",{class:"k-calendar-header k-hstack",style:this.$attrs.style},[p,t.createVNode("span",{class:"k-spacer"},null),t.createVNode("span",{class:"k-calendar-nav k-hstack"},[t.createVNode(n.Button,{type:"button",icon:this.currentRtl?"chevron-right":"chevron-left",svgIcon:this.currentRtl?o.chevronRightIcon:o.chevronLeftIcon,size:this.$props.size,fillMode:"flat",class:"k-calendar-nav-pre",disabled:h,"aria-label":r,title:r,onClick:this.handlePrevClick},null),f,t.createVNode(n.Button,{type:"button",icon:this.currentRtl?"chevron-left":"chevron-right",svgIcon:this.currentRtl?o.chevronLeftIcon:o.chevronRightIcon,size:this.$props.size,fillMode:"flat",class:"k-calendar-nav-next",disabled:u,"aria-label":l,title:l,onClick:this.handleNextClick},null)])])}}),Se=(e,t,i)=>i instanceof Date&&!Array.isArray(i)&&S(s.getDate(i),e,t)?s.getDate(i):null,be=(e,t,i)=>Array.isArray(i)?i.filter((i=>S(i,e,t))).map((e=>s.getDate(e))):null,ke=e=>!i.isObject(e)||e instanceof Date||null===e||Array.isArray(e)?p:e,Ve=(e,t,i)=>e||t&&t[0]||i&&i.start,Ie=t.defineComponent({name:"KendoCalendar",inject:{kendoIntlService:{default:null}},model:{event:"changemodel"},props:{activeRangeEnd:{type:String,default:void 0},allowReverse:{type:Boolean,default:!1},cell:[String,Function,Object],className:String,defaultActiveView:{type:String,default:"month"},modelValue:{type:[Date,Array,Object],default:void 0},defaultValue:{type:[Date,Array,Object],default:null},disabled:{type:Boolean,default:!1},focusedDate:Date,id:{type:String,default:function(){return i.guid()}},headerTitle:[String,Function,Object],max:{type:Date,default:function(){return N}},min:{type:Date,default:function(){return R}},mode:String,navigation:{type:Boolean,default:!0},tabIndex:Number,value:[Date,Array,Object],views:{type:Number,default:1},weekNumber:Boolean,weekCell:[String,Function,Object],topView:{type:String,default:"century"},bottomView:{type:String,default:"month"},onFocus:Function,onBlur:Function,onChange:Function,onKeydown:Function},data:function(){return{valueDuringOnChange:void 0,currentFocusedDate:null,currentActiveView:null,currentValue:null,cellUID:i.guid(),isActive:!1,oldValue:null,didNavigationChange:!1,currentActiveRangeEnd:void 0}},created:function(){i.validatePackage(h);const e=((e,t,i,s)=>void 0!==s?null!==s&&S(s,e,t)?s:null:null!==i&&S(i,e,t)?i:null)(this.currentMin,this.currentMax,this.$props.defaultValue,this.$props.value||this.$props.modelValue),t=Se(this.currentMin,this.currentMax,e),s=be(this.currentMin,this.currentMax,e),a=ke(e),n=Ve(t,s,a);this._hasMounted=!1,this.$data.currentFocusedDate=C(this.$props.focusedDate||n||D(),this.currentMin,this.currentMax),this.$data.currentValue=e,this.$data.currentActiveView=m(c[this.$props.defaultActiveView],c[this.$props.bottomView],c[this.$props.topView]),this.$data.currentActiveRangeEnd=((e,t)=>null===e.start&&null===t?"start":null===e.end?"end":"start")(a,t),this._dates=[],this._calculateFocusFromValue=!1,this._lastView=this.$props.activeView||this.$data.currentActiveView,this._lastViewsCount=this.$props.views,this._dom=new W,this._bus=new U(this.handleViewChange),this._navigation=new G(this._bus),this._oldValue=e},watch:{value:function(e){this.$data.currentFocusedDate=e},focusedDate:function(e){this.$data.currentFocusedDate=e}},setup:()=>({kendoIntlService:t.inject("kendoIntlService",{})}),mounted(){this.calendarViewList=this.calendarViewListRef,this._calculateFocusFromValue=!0},updated(){const e=Se(this.currentMin,this.currentMax,this.computedValue());this._calculateFocusFromValue=!!(this._selectedDate&&e&&this._selectedDate.getTime()&&e.getTime()),this._lastView=this.$props.activeView||this.$data.currentActiveView,this._lastViewsCount=this.$props.views,this._oldValue=this.computedValue(),this.calendarViewList||(this.calendarViewList=this.calendarViewListRef)},computed:{activeRange(){return void 0!==this.$props.activeRangeEnd?this.$props.activeRangeEnd:this.$data.currentActiveRangeEnd},currentMin(){return s.getDate(this.$props.min)},currentMax(){return s.getDate(this.$props.max)}},methods:{element(){return this.$el},computedValue(){return void 0!==this.$data.valueDuringOnChange?this.$data.valueDuringOnChange:void 0!==this.$props.value?this.$props.value:void 0!==this.$props.modelValue?this.$props.modelValue:this.$data.currentValue},focus(){this.calendarViewList&&this.calendarViewList.$el.firstElementChild.focus()},handleBlur(){this.$data.isActive=!1},handleFocus(){this.$data.isActive=!0},emitBlur(e){this.$emit("blur",e)},emitFocus(e){this.$emit("focus",e)},handleTodayClick(e){if(this.$props.disabled)return;this.$data.didNavigationChange=!0;const t=s.cloneDate(e.value);this.$data.currentFocusedDate=t,this.$data.currentValue=t,this.triggerChange(t,e)},handleViewChange({view:e}){this.$data.currentActiveView=e},handlePrevClick(e){const t=s.cloneDate(e.value);this.focus(),!this.$props.disabled&&(this.$data.currentFocusedDate=t)},handleTitleClick(){this.focus()},handleNextClick(e){const t=s.cloneDate(e.value);this.focus(),!this.$props.disabled&&(this.$data.currentFocusedDate=t)},handleCellEnter(e){"range"===this.$props.mode&&(this.$data.currentFocusedDate=e)},generateRange(e,t){let{end:i,start:s}=t;const a=null!==t.start&&e.getTime()<=t.start.getTime();return!this.$props.allowReverse&&a?{start:e,end:this._selectedRange.start}:"end"!==this.activeRange?{start:e,end:i}:{start:s||this._selectedDate,end:e}},clampRange:e=>({start:e,end:null}),handleWeekCellClick(e){this.$emit("weekcellclick",e)},handleWeekNameClick(e){this.$emit("weeknameclick",e)},handleDateChange(e){const t=s.cloneDate(e.value),i=this._bus.canMoveDown(this.$data.currentActiveView);if(this.$props.disabled)return;if(i){if(!e.isTodayClick)return this._bus.moveDown(this.$data.currentActiveView,e.event),void(this.$data.currentFocusedDate=t);this._bus.moveToBottom(this.$data.currentActiveView)}let a,n;switch(this.$props.mode){case"single":default:a=s.cloneDate(e.value);break;case"multiple":if(Array.isArray(this._selectedMultiple)){let t=this._selectedMultiple.slice(),i=-1;t.forEach(((t,a)=>{s.isEqualDate(t,e.value)&&(i=a)})),-1!==i?t.splice(i,1):t.push(s.cloneDate(e.value)),a=t.slice()}else a=this._selectedDate?[s.cloneDate(this._selectedDate),s.cloneDate(e.value)]:[s.cloneDate(e.value)];break;case"range":n=null!==this._selectedRange.start&&null!==this._selectedRange.end&&"start"===this.activeRange,a=n?this.clampRange(e.value):this.generateRange(e.value,this._selectedRange),this.$data.currentActiveRangeEnd="end"!==this.activeRange?"end":"start"}this.$data.currentValue=a,this.triggerChange(a,e)},triggerChange(e,t){this.$data.valueDuringOnChange=e;const i={event:t.event,value:e,component:this,target:{name:this.$props.name,value:e,valueAsDate:e}};this.$emit("changemodel",e),this.$emit("update:modelValue",e),this.$emit("change",i),this.$data.valueDuringOnChange=void 0},handleMouseDown(e){const t=s.cloneDate(e.value);this.$props.disabled||0!==this.$data.currentActiveView||(this.$data.currentFocusedDate=t)},tableKeyDown(e){const{keyCode:t}=e;if(this.$emit("keydown",e),t===i.Keys.enter){const t={event:e,value:this._focusedDate,component:this,target:{name:this.$props.name,value:this._focusedDate,valueAsDate:this._focusedDate}};this.handleDateChange(t)}else{const t=C(this._navigation.move(this._focusedDate,this._navigation.action(e),this.$data.currentActiveView,this._service,e),this.currentMin,this.currentMax);if(s.isEqualDate(this._focusedDate,t))return;this._calculateFocusFromValue=!1,this.$data.currentFocusedDate=t}e.preventDefault()},isValueEqual:(e,t)=>e instanceof Date&&t instanceof Date?s.isEqualDate(e,t):e instanceof Object&&t instanceof Object?!!(e&&t&&s.isEqualDate(e.start,t.start)&&s.isEqualDate(e.end,t.end)):e instanceof Array&&t instanceof Array&&!(!e||!t||e.length!==t.length),rangeWithFocused(e,t){return{start:e.start,end:null===e.end&&null!==e.start&&this.$data.isActive?t.end:e.end}}},render(){const e=this.$props.views,n=this.computedValue(),o=this.$data.currentFocusedDate,r=null!==n&&null!==this._oldValue?!this.isValueEqual(n,this._oldValue):n!==this._oldValue;this._selectedDate=Se(this.currentMin,this.currentMax,n),this._selectedMultiple=be(this.currentMin,this.currentMax,n);const l=i.templateRendering.call(this,this.$props.cell,i.getListeners.call(this)),h=i.templateRendering.call(this,this.$props.weekCell,i.getListeners.call(this)),u=i.templateRendering.call(this,this.$props.headerTitle,i.getListeners.call(this)),d=m(this.$data.currentActiveView,c[this.$props.bottomView],c[this.$props.topView]);this._selectedDate=Se(this.currentMin,this.currentMax,n),this._selectedMultiple=be(this.currentMin,this.currentMax,n),this._selectedRange=ke(n);const p=Ve(this._selectedDate,this._selectedMultiple,this._selectedRange),g=C(r&&null!==p?p:o,this.currentMin,this.currentMax);g instanceof Date?this._focusedDate=s.getDate(g):p&&(this._focusedDate=p);const f=this.rangeWithFocused(this._selectedRange,o);this._intl=a.provideIntlService(this),this._bus.configure(c[this.$props.bottomView],c[this.$props.topView]),this._service=this._bus.service(d,this._intl);const v=i.classNames("k-calendar","k-calendar-md",{"k-calendar-range":e>1,"k-disabled":this.$props.disabled,"k-week-number":this.$props.weekNumber},this.$props.className),w=this._lastView!==this.$data.currentActiveView,$=this._dates&&this._service.isInArray(this._focusedDate,this._dates),y=this._lastViewsCount!==this.$props.views;(!$||w||y)&&(this._dates=this._service.datesList(this._focusedDate,e));const D=s.cloneDate(this._dates&&this._dates[0]?this._dates[0]:void 0),S=[this.$props.navigation&&t.createVNode(De,{tabIndex:this.$props.disabled?void 0:this.$props.tabIndex||0,activeView:this.$data.currentActiveView,currentDate:D,focusedDate:this._focusedDate,min:this.currentMin,max:this.currentMax,rangeLength:this.$props.views,onTodayclick:this.handleTodayClick,onNextclick:this.handleNextClick,onPrevclick:this.handlePrevClick,onTitleclick:this.handleTitleClick,bus:this._bus,service:this._service,headerTitle:u},null),t.createVNode(_,{allowReverse:this.$props.allowReverse,isActive:this.$data.isActive,tabIndex:this.$props.tabIndex||0,ref:e=>{this.calendarViewListRef=e},activeView:this.$data.currentActiveView,focusedDate:this._focusedDate,min:this.currentMin,max:this.currentMax,bus:this._bus,dates:this._dates,shouldScroll:this.$data.didNavigationChange,service:this._service,cell:l,weekCell:h,dom:this._dom,views:this.$props.views,selectionRange:f,showWeekNumbers:this.$props.weekNumber,onChange:this.handleDateChange,onWeekcellclick:this.handleWeekCellClick,onWeeknameclick:this.handleWeekNameClick,onListmousedown:this.handleMouseDown,onCellenter:this.handleCellEnter,onListkeydown:this.tableKeyDown,onListfocus:this.handleFocus,onListblur:this.handleBlur,value:this._selectedMultiple||this._selectedDate,cellUID:this.$data.cellUID},null)];return t.createVNode("div",{"aria-disabled":!0===this.$props.disabled||void 0,class:v,id:this.$props.id,onFocusout:this.emitBlur,onFocusin:this.emitFocus},[S])}});let Ce=class{constructor(){this.symbols=""}};const Me="wide",Fe=(e,t)=>(e[t.pattern[0]]=t.type,e);let xe=class{constructor(e,t,i){this.year=!0,this.month=!0,this.date=!0,this.hours=!0,this.minutes=!0,this.seconds=!0,this.milliseconds=!0,this.leadingZero=null,this.typedMonthPart="",this.knownParts="adHhmMsEy",this.symbols={E:"E",H:"H",M:"M",a:"a",d:"d",h:"h",m:"m",s:"s",y:"y"},this._value=s.getDate(new Date),this.intlProvider=e,this.formatPlaceholder=t,this.format=i,this.monthNames=this.allFormatedMonths()}get intl(){return this.intlProvider()}get value(){return this._value}setValue(e){e?s.isEqual(e,this._value)||(this._value=s.cloneDate(e),this.modifyExisting(!0)):(this._value=s.getDate(new Date),this.modifyExisting(!1))}hasValue(){return this.intl.splitDateFormat(this.format).reduce(((e,t)=>e||"literal"!==t.type&&"dayperiod"!==t.type&&this.getExisting(t.pattern[0])),!1)}getDateObject(){for(let e=0;e<this.knownParts.length;e++)if(!this.getExisting(this.knownParts[e]))return null;return s.cloneDate(this.value)}getTextAndFormat(){return this.merge(this.intl.formatDate(this.value,this.format),this.dateFormatString(this.value,this.format))}modifyExisting(e){const t=this.dateFormatString(this.value,this.format).symbols;for(let i=0;i<t.length;i++)this.setExisting(t[i],e)}getExisting(e){switch(e){case"y":return this.year;case"M":case"L":return this.month;case"d":return this.date;case"E":return this.date&&this.month&&this.year;case"h":case"H":return this.hours;case"m":return this.minutes;case"s":return this.seconds;default:return!0}}setExisting(e,t){switch(e){case"y":this.year=t,!1===t&&this._value.setFullYear(2e3);break;case"M":this.month=t,!1===t&&this._value.setMonth(0);break;case"d":this.date=t;break;case"h":case"H":this.hours=t;break;case"m":this.minutes=t;break;case"s":this.seconds=t;break;default:return}}modifyPart(e,t){let i=s.cloneDate(this.value);switch(e){case"y":i.setFullYear(i.getFullYear()+t);break;case"M":i=s.addMonths(this.value,t);break;case"d":case"E":i.setDate(i.getDate()+t);break;case"h":case"H":i.setHours(i.getHours()+t);break;case"m":i.setMinutes(i.getMinutes()+t);break;case"s":i.setSeconds(i.getSeconds()+t);break;case"a":i.setHours(i.getHours()+12*t)}this.setExisting(e,!0),this._value=i}parsePart(e,t){if(this.resetLeadingZero(),!t)return this.setExisting(e,!1),{value:null};const i=this.intl.formatDate(this.value,this.format),a=this.dateFormatString(this.value,this.format),n=a.symbols;let o=!1,r="",l="",h="";for(let t=0;t<i.length;t++)n[t]===e?(l+=this.getExisting(e)?i[t]:"0",o=!0):o?h+=i[t]:r+=i[t];let u=null;const d=this.matchMonth(t);for(;l.length>0&&"0"===l.charAt(0);)l=l.slice(1);l.length>=4&&(l="");for(let i=0;i<2;i++){let i=l+t,a=parseInt(i,10);if(u=this.intl.parseDate(r+i+h,this.format),!u&&!isNaN(a)&&!isNaN(parseInt(t,10))){if("M"===e&&!d){const e=a-1;e>-1&&e<12&&(u=s.cloneDate(this.value),u.setMonth(e),u.getMonth()!==e&&(u=s.lastDayOfMonth(s.addMonths(u,-1))))}"y"===e&&(u=s.createDate(parseInt(i,10),this.month?this.value.getMonth():0,this.date?this.value.getDate():1,this.hours?this.value.getHours():0,this.minutes?this.value.getMinutes():0,this.seconds?this.value.getSeconds():0,this.milliseconds?this.value.getMilliseconds():0),this.date&&u.getDate()!==this.value.getDate()&&(u=s.lastDayOfMonth(s.addMonths(u,-1))))}if(u)return this._value=u,this.setExisting(e,!0),{value:this.value};l=""}return d&&(u=this.intl.parseDate(r+d+h,this.format),u)?(this._value=u,this.setExisting(e,!0),{value:this.value}):("0"===t&&(this.leadingZero=this.isAbbrMonth(a.partMap,e)?null:{[e]:!0},this.setExisting(e,!1)),{value:null})}symbolMap(e){return this.intl.splitDateFormat(this.format).reduce(Fe,{})[e]}resetLeadingZero(){const e=null!==this.leadingZero;return this.leadingZero=null,e}isAbbrMonth(e,t){const i=this.partPattern(e,t);return"month"===i.type&&i.names}partPattern(e,t){return e.filter((e=>-1!==e.pattern.indexOf(t)))[0]}matchMonth(e){if(this.typedMonthPart+=e.toLowerCase(),0===this.monthNames.length)return"";for(;this.typedMonthPart.length>0;){for(let e=0;e<this.monthNames.length;e++)if(0===this.monthNames[e].toLowerCase().indexOf(this.typedMonthPart))return this.monthNames[e];const e=parseInt(this.typedMonthPart,10);if(e>=1&&e<=12&&e.toString()===this.typedMonthPart)return this.monthNames[e-1];this.typedMonthPart=this.typedMonthPart.substring(1,this.typedMonthPart.length)}return""}allFormatedMonths(){const e=this.intl.splitDateFormat(this.format);for(let t=0;t<e.length;t++)if("month"===e[t].type&&e[t].names)return this.intl.dateFormatNames(e[t].names);return[]}dateFormatString(e,t){const i=this.intl.splitDateFormat(t),s=[],a=[];for(let t=0;t<i.length;t++){let n=this.intl.formatDate(e,{pattern:i[t].pattern}).length;for(;n>0;)s.push(this.symbols[i[t].pattern[0]]||"_"),a.push(i[t]),n--}const n=new Ce;return n.symbols=s.join(""),n.partMap=a,n}merge(e,t){var i;let s="",a="",n=t.symbols;for(let o=n.length-1;o>=0;){if(-1===this.knownParts.indexOf(n[o])||this.getExisting(n[o]))s=e[o]+s,a=n[o]+a;else{const e=n[o];for(;o>=0&&e===n[o];)o--;for(o++,s=null!=(i=this.leadingZero)&&i[e]?"0"+s:this.dateFieldName(t.partMap[o])+s;a.length<s.length;)a=n[o]+a}o--}return{text:s,format:a}}dateFieldName(e){const t=this.formatPlaceholder||"wide";return t[e.type]?t[e.type]:"formatPattern"===t?e.pattern:this.intl.dateFieldName(Object.assign(e,{nameType:t}))}};const _e="dayperiod",Te="hour",Re="minute",Ne="second",Oe=e=>(t,i)=>{const a=s.cloneDate(t);return a[e](i),a},Be=[{type:Te,getter:e=>e.getHours()},{type:Re,getter:e=>e.getMinutes()},{type:Ne,getter:e=>e.getSeconds()},{type:"millisecond",getter:e=>e.getMilliseconds()}],Le=(e=>t=>e.map((e=>t=>e[t.type]?(e=>(t,i)=>e(i))(t.getter):(e=>(t,i)=>e(t))(t.getter))((e=>e.reduce(((e,t)=>(e[t.type]=t.type,e)),{}))(t))))(Be),Ee=(e=>(t,i)=>e.map((e=>{const s=Math.floor(t[e.type]);return s?((e,t,i,s)=>a=>{const n=e(a),o=e(i);return"hour"===s?n-(n-o)%t:a.getTime()<=i.getTime()&&0!==n&&n<=o?Math.ceil(n/t)*t:n-n%t})(e.getter,s,i,e.type):e.getter})))(Be),Ae=e=>t=>{const i=s.cloneDate(t);return i.setHours(...e.map((e=>e(i)))),i},je=Oe("setHours"),He=Oe("setMinutes"),Pe=Oe("setSeconds"),ze=()=>new Date,qe=(e,t,i=1)=>{const s=[];for(let a=e;a<t;a+=i)s.push(a);return s},