/*!
* Accessible Datepicker v2.1.19
* Copyright 2015-2019 Eureka2, Jacques Archimède.
* Based on the example of the Open AJAX Alliance Accessibility Tools Task Force : http://www.oaa-accessibility.org/examplep/datepicker1/
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Inspired by :
* http://wet-boew.github.io/wet-boew/demos/datepicker/datepicker-fr.html
* http://eternicode.github.io/bootstrap-datepicker
*/
(function(){"use strict";if(typeof Date.dp_locales==="undefined"){Date.dp_locales={texts:{buttonTitle:"Select date...",buttonLabel:"Click or press the Enter key or the spacebar to open the calendar",prevButtonLabel:"Go to previous month",prevMonthButtonLabel:"Go to the previous year",prevYearButtonLabel:"Go to the previous twenty years",nextButtonLabel:"Go to next month",nextMonthButtonLabel:"Go to the next year",nextYearButtonLabel:"Go to the next twenty years",changeMonthButtonLabel:"Click or press the Enter key or the spacebar to change the month",changeYearButtonLabel:"Click or press the Enter key or the spacebar to change the year",changeRangeButtonLabel:"Click or press the Enter key or the spacebar to go to the next twenty years",closeButtonTitle:"Close",closeButtonLabel:"Close the calendar",calendarHelp:"- Up Arrow and Down Arrow - goes to the same day of the week in the previous or next week respectively. If the end of the month is reached, continues into the next or previous month as appropriate.\r\n- Left Arrow and Right Arrow - advances one day to the next, also in a continuum. Visually focus is moved from day to day and wraps from row to row in the grid of days.\r\n- Control+Page Up - Moves to the same date in the previous year.\r\n- Control+Page Down - Moves to the same date in the next year.\r\n- Home - Moves to the first day of the current month.\r\n- End - Moves to the last day of the current month.\r\n- Page Up - Moves to the same date in the previous month.\r\n- Page Down - Moves to the same date in the next month.\r\n- Enter or Espace - closes the calendar, and the selected date is shown in the associated text box.\r\n- Escape - closes the calendar without any action."},directionality:"LTR",month_names:["January","February","March","April","May","June","July","August","September","October","November","December"],month_names_abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"],month_names_narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],day_names:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],day_names_abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],day_names_short:["Su","Mo","Tu","We","Th","Fr","Sa"],day_names_narrow:["S","M","T","W","T","F","S"],day_periods:{am:"AM",noon:"noon",pm:"PM"},day_periods_abbreviated:{am:"AM",noon:"noon",pm:"PM"},day_periods_narrow:{am:"a",noon:"n",pm:"p"},quarter_names:["1st quarter","2nd quarter","3rd quarter","4th quarter"],quarter_names_abbreviated:["Q1","Q2","Q3","Q4"],quarter_names_narrow:["1","2","3","4"],era_names:["Before Christ","Anno Domini"],era_names_abbreviated:["BC","AD"],era_names_narrow:["B","A"],full_format:"EEEE, MMMM d, y",long_format:"MMMM d, y",medium_format:"MMM d, y",short_format:"M/d/yy",firstday_of_week:0}}})();(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof exports==="object"){factory(require("jquery"))}else{if(typeof jQuery==="undefined"){throw new Error("Datepicker's JavaScript requires jQuery")}factory(jQuery)}})((function($){"use strict";var GLYPHICONS={calendar:"glyphicon glyphicon-calendar",forward:"glyphicon glyphicon-forward",backward:"glyphicon glyphicon-backward","triangle-right":"glyphicon glyphicon-triangle-right","triangle-left":"glyphicon glyphicon-triangle-left","is-fa":""};var FAICONS={calendar:"far fa-calendar-alt",forward:"fas fa-forward",backward:"fas fa-backward","triangle-right":"fas fa-caret-right","triangle-left":"fas fa-caret-left","is-fa":"use-fa-icons"};const VIEW_DAYS=0,VIEW_MONTHS=1,VIEW_YEARS=2;const helpText='
Page up/down to skip months, Alt + page up/down to skip years
';var datepickerButton3=['','\tSelect Date... '," "];var datepickerCalendar3=['','
','
','\t
','\t\t
','\t\t
','\t\t
','\t\t
','\t\t
July 2015
',"\t
",'\t
','\t\t','\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t',"\t\t\t ","\t\t ",'\t\t',"\t\t\t",'\t\t\t\tJavascript must be enabled ',"\t\t\t ","\t\t ","\t
","
",'
',"
",helpText,'\t
','\t\tClose ',"\t
",'\t
Click or press the Enter key or the spacebar to open the calendar
','\t
Go to previous month
','\t
Go to next month
','\t
Go to previous year
','\t
Go to next year
','\t
Close the date picker
',"
"];var datepickerButton4=['','\t '," "];var datepickerCalendar4=['','
','
','\t
','\t\t
','\t\t
','\t\t
','\t\t
','\t\t
July 2015
',"\t
",'\t
','\t\t','\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t','\t\t\t\t',"\t\t\t ","\t\t ",'\t\t',"\t\t\t",'\t\t\t\tJavascript must be enabled ',"\t\t\t ","\t\t ","\t
","
",'
',"
",helpText,'\t
','\t\tClose ',"\t
",'\t
Click or press the Enter key or the spacebar to open the calendar
','\t
Go to previous month
','\t
Go to next month
','\t
Go to previous year
','\t
Go to next year
','\t
Close the date picker
',"
"];function replaceIcons(html,iconSet){return html.replace(/{icon-([^}]+)}/g,(function(e,name){return iconSet[name]}))}var Datepicker=function(target,options){var self=this;this.$target=$(target);this.options=$.extend({},Datepicker.DEFAULTS,options);this.log=this.options.loggingEnabled&&window.console&&console.log?console.log.bind(console):function(){};this.log("Initialising Datepicker");this.locales=Date.dp_locales;this.startview(this.options.startView);if(typeof this.options.inputFormat==="string"){this.options.inputFormat=[this.options.inputFormat]}if(!$.isArray(this.options.datesDisabled)){this.options.datesDisabled=[this.options.datesDisabled]}$.each(this.options.datesDisabled,(function(i,v){if(typeof v==="string"){var date=self.parseDate(v);if(date===null){self.options.datesDisabled[i]=null}else{self.options.datesDisabled[i]=self.format(date)}}else if(v instanceof Date&&!isNaN(v.valueOf())){self.options.datesDisabled[i]=self.format(v)}else{self.options.datesDisabled[i]=null}}));if(this.options.min!=null){this.options.min=this.parseDate(this.options.min)}else if(this.$target.attr("min")){this.options.min=this.parseDate(this.$target.attr("min"))}if(this.options.max!=null){this.options.max=this.parseDate(this.options.max)}else if(this.$target.attr("max")){this.options.max=this.parseDate(this.$target.attr("max"))}if(typeof this.options.previous==="string"){this.options.previous=$(this.options.previous)}else if(!(this.options.previous instanceof jQuery)){this.options.previous=null}if(typeof this.options.next==="string"){this.options.next=$(this.options.next)}else if(!(this.options.next instanceof jQuery)){this.options.next=null}this.id=this.$target.attr("id")||"datepicker-"+Math.floor(Math.random()*1e5);this.$linkField=this.options.linkField?$(document.getElementById(this.options.linkField)):null;const needsWrapper=!this.options.button;function specificFaIcons(){return jQuery.extend({},FAICONS,{"fa-edition":self.options.fontAwesomePro?"use-fa-pro":"use-fa-free"})}var iconSet=this.options.fontAwesome||this.options.markup==="bootstrap4"?specificFaIcons():GLYPHICONS;var calendar=this.options.markup=="bootstrap3"?datepickerCalendar3.join(""):datepickerCalendar4.join("");calendar=calendar.replace(/CALENDARID/g,this.id+"");calendar=replaceIcons(calendar,iconSet);if(needsWrapper){if(this.$target.parent(".input-group").length===0){this.$target.wrap('
')}this.$group=this.$target.parent(".input-group")}this.$target.attr("aria-autocomplete","none");this.$target.css("min-width","7em");this.$target.addClass("form-control");if(!this.$target.attr("placeholder")){this.$target.attr("placeholder",this.options.inputFormat[0])}if(options.button){this.$button=$(document.getElementById(options.button));this.$button.attr("aria-haspopup","true").attr("aria-labelledby","datepicker-bn-open-label-"+this.id)}else{var button=this.options.markup=="bootstrap3"?datepickerButton3.join(""):datepickerButton4.join("");button=button.replace(/CALENDARID/g,this.id+"");button=replaceIcons(button,iconSet);this.$button=$(button);this.$button.addClass(this.options.theme);if(this.options.buttonLeft){this.$target.before(this.$button)}else{this.$target.after(this.$button)}}const $offsetFrom=needsWrapper?this.$target.parent():this.$button;this.$calendar=$(calendar);this.$calendar.addClass(this.options.theme);if(this.$calendar.parent().css("position")==="static"){this.$calendar.parent().css("position","relative")}this.$calendar.find(".datepicker-bn-open-label").html(this.options.buttonLabel);if(this.$target.attr("id")){this.$calendar.attr("aria-controls",this.$target.attr("id"))}this.$button.find("span").attr("title",this.options.buttonTitle);this.$calendar.css("left",$offsetFrom.position().left+"px");this.$monthObj=this.$calendar.find(".datepicker-month");this.$prev=this.$calendar.find(".datepicker-month-prev");this.$next=this.$calendar.find(".datepicker-month-next");this.$fastprev=this.$calendar.find(".datepicker-month-fast-prev");this.$fastnext=this.$calendar.find(".datepicker-month-fast-next");this.$grid=this.$calendar.find(".datepicker-grid");if(this.locales.directionality==="RTL"){this.$grid.addClass("rtl")}this.$timeview=this.$calendar.find(".datepicker-time-view");this.drawCalendarHeader();if(this.options.inline==false&&this.options.modal==true){this.$close=this.$calendar.find(".datepicker-close");this.$close.html(this.options.closeButtonTitle).attr("title",this.options.closeButtonLabel);this.$calendar.find(".datepicker-bn-close-label").html(this.options.closeButtonLabel)}else{this.hideObject(this.$calendar.find(".datepicker-close-wrap"));this.hideObject(this.$calendar.find(".datepicker-bn-close-label"))}if(this.options.inline!=false){this.hideObject(this.$button);var $container=typeof this.options.inline==="string"?$(document.getElementById(this.options.inline)):this.options.inline;$container.append(this.$calendar);this.$calendar.css({position:"relative",left:"0px"});this.initializeDate()}else{this.$calendar.css({display:"none"});$offsetFrom.after(this.$calendar);this.hide(!this.options.gainFocusOnConstruction)}this.keys={tab:9,enter:13,esc:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40};this.bindHandlers();this.$button.click((function(e){e.preventDefault();e.stopPropagation();if(!$(this).hasClass("disabled")){if(self.$calendar.attr("aria-hidden")==="true"){self.initializeDate();self.show()}else{self.hide()}if(!self.options.timeOnly){self.selectGridCell(self.$grid.attr("aria-activedescendant"))}}return false}));this.$button.keydown((function(ev){self.keyboardUsed();if(ev.keyCode==self.keys.enter||ev.keyCode==self.keys.space){$(this).trigger("click");return false}}));this.$calendar.on("blur",(function(){if(self.$calendar.attr("aria-hidden")==="false"){self.hide()}}))};Datepicker.VERSION="2.1.19";Datepicker.DEFAULTS={firstDayOfWeek:Date.dp_locales.firstday_of_week,weekDayFormat:"short",startView:VIEW_DAYS,daysOfWeekDisabled:[],datesDisabled:[],timeEnabled:false,timeOnly:false,isDateDisabled:null,isMonthDisabled:null,isYearDisabled:null,linkField:null,linkFormat:"yyyy-MM-dd",inputFormat:[Date.dp_locales.short_format],outputFormat:Date.dp_locales.short_format,titleFormat:Date.dp_locales.full_format,buttonLeft:false,buttonTitle:Date.dp_locales.texts.buttonTitle,buttonLabel:Date.dp_locales.texts.buttonLabel,prevButtonLabel:Date.dp_locales.texts.prevButtonLabel,prevMonthButtonLabel:Date.dp_locales.texts.prevMonthButtonLabel,prevYearButtonLabel:Date.dp_locales.texts.prevYearButtonLabel,nextButtonLabel:Date.dp_locales.texts.nextButtonLabel,nextMonthButtonLabel:Date.dp_locales.texts.nextMonthButtonLabel,nextYearButtonLabel:Date.dp_locales.texts.nextYearButtonLabel,changeMonthButtonLabel:Date.dp_locales.texts.changeMonthButtonLabel,changeYearButtonLabel:Date.dp_locales.texts.changeYearButtonLabel,changeRangeButtonLabel:Date.dp_locales.texts.changeRangeButtonLabel,closeButtonTitle:Date.dp_locales.texts.closeButtonTitle,closeButtonLabel:Date.dp_locales.texts.closeButtonLabel,onUpdate:function(){},previous:null,next:null,allowSameDate:true,markup:"bootstrap3",theme:"default",modal:false,inline:false,gainFocusOnConstruction:true,min:null,max:null,minHour:0,maxHour:23,minuteIncrements:30,fontAwesome:false,fontAwesomePro:false,clientValidation:true};Datepicker.prototype.initializeDate=function(){this.setDate(this.getDate(),true)};Datepicker.prototype.getDate=function(){var val=this.$target.val();var date=val===""?new Date:this.parseDate(val);return date};Datepicker.prototype.setDate=function(newDate,init){this.dateObj=newDate;init=typeof init==="undefined"?false:init;if(this.dateObj==null){this.markHasError(true);this.dateObj=new Date;this.dateObj.setHours(0,0,0,0)}if(this.options.min!=null&&this.dateObjthis.options.max){this.markHasError(true);this.dateObj=this.options.max}if(!init||this.$target.val()!=""){this.$target.val(this.format(this.dateObj))}this.curYear=this.dateObj.getFullYear();this.year=this.curYear;this.curMonth=this.dateObj.getMonth();this.month=this.curMonth;this.date=this.dateObj.getDate();if(this.options.timeEnabled){this.hour=this.dateObj.getHours();this.minute=this.dateObj.getMinutes();this.populateTimePane()}else{this.$timeview.hide()}switch(this.options.startView){case VIEW_MONTHS:this.populateMonthsCalendar();this.$grid.attr("aria-activedescendant",this.$grid.find(".curMonth").attr("id"));break;case VIEW_YEARS:this.populateYearsCalendar();this.$grid.attr("aria-activedescendant",this.$grid.find(".curYear").attr("id"));break;default:this.populateDaysCalendar();this.$grid.attr("aria-activedescendant",this.$grid.find(".curDay").attr("id"))}if(this.options.timeOnly){let $calendarColumn=this.$calendar.find(".datepicker-calendar-column");$calendarColumn.find("[tabindex]").removeAttr("tabindex");$calendarColumn.on("click",(function(e){e.preventDefault();e.stopPropagation();return false}));$calendarColumn.find("[role=button], .datepicker-month").removeClass("enabled").addClass("disabled text-muted");$calendarColumn.find("th").addClass("text-muted");$calendarColumn.find(".selectable").removeClass("selectable").addClass("unselectable")}};Datepicker.prototype.populateTimePane=function(){var h,m,$li;this.log("populateTimePane");this.$timeview.attr("tabindex","-1");var $list=$("").addClass("list-unstyled").attr("role","listbox").attr("tabindex",0);var d=new Date;for(h=this.options.minHour;h<=this.options.maxHour;h++){for(m=0;m<60;m+=this.options.minuteIncrements){d.setHours(h);d.setMinutes(m);$li=$("").text(this.formatDate(d,"HH:mm")).addClass("selectable").data("hours",h).data("minutes",m).attr("id","time-"+h+"_"+m+"-"+this.id).attr("role","option");if(this.dateObj.getHours()===h&&this.dateObj.getMinutes()===m){$li.focus().addClass("curTime")}$list.append($li)}}if(!$list.find(".curTime").length){$list.find("li").first().addClass("curTime")}this.$timeview.empty().append($list)};Datepicker.prototype.drawCalendarHeader=function(){this.log("drawCalendarHeader");var $days=this.$grid.find("th.datepicker-day");var weekday=this.options.firstDayOfWeek;for(var i=0;i<7;i++){$days.eq(i).attr("aria-label",this.locales.day_names[weekday]);$days.children("abbr").eq(i).attr("title",this.locales.day_names[weekday]).text(this.options.weekDayFormat==="short"?this.locales.day_names_short[weekday]:this.locales.day_names_narrow[weekday]);weekday=(weekday+1)%7}};Datepicker.prototype.populateDaysCalendar=function(){const today=new Date;today.setHours(0,0,0,0);this.log("populateDaysCalendar");this.$calendar.find(".datepicker-bn-prev-label").html(this.options.prevButtonLabel);this.$calendar.find(".datepicker-bn-next-label").html(this.options.nextButtonLabel);this.$calendar.find(".datepicker-bn-fast-prev-label").html(this.options.prevMonthButtonLabel);this.$calendar.find(".datepicker-bn-fast-next-label").html(this.options.nextMonthButtonLabel);if(this.options.min!=null&&(this.year-1this.options.max.getFullYear()||nextMonth.year==this.options.max.getFullYear()&&nextMonth.month>this.options.max.getMonth())){this.$next.attr("title","");this.$next.addClass("disabled");this.$next.removeClass("enabled")}else{this.$next.attr("title",this.options.nextButtonLabel);this.$next.addClass("enabled");this.$next.removeClass("disabled")}if(this.options.max!=null&&(this.year+1>this.options.max.getFullYear()||this.year+1==this.options.max.getFullYear()&&this.month>this.options.max.getMonth())){this.$fastnext.attr("title","");this.$fastnext.addClass("disabled");this.$fastnext.removeClass("enabled")}else{this.$fastnext.attr("title",this.options.nextMonthButtonLabel);this.$fastnext.addClass("enabled");this.$fastnext.removeClass("disabled")}this.showObject(this.$fastprev);this.showObject(this.$fastnext);var numDays=this.getDaysInMonth(this.year,this.month);var numPrevDays=this.getDaysInMonth(previousMonth.year,previousMonth.month);var startWeekday=new Date(this.year,this.month,1).getDay();var lastDayOfWeek=(this.options.firstDayOfWeek+6)%7;var curDay=1;var rowCount=1;this.$monthObj.html(this.locales.month_names[this.month]+" "+this.year);this.showObject(this.$grid.find("thead"));var gridCells='\t\n';var numEmpties=0;var weekday=this.options.firstDayOfWeek;while(weekday!=startWeekday){numEmpties++;weekday=(weekday+1)%7}for(;numEmpties>0;numEmpties--){gridCells+='\t\t'+(numPrevDays-numEmpties+1)+" \n"}var isYearDisabled=this.options.isYearDisabled&&this.options.isYearDisabled(this.year);var isMonthDisabled=this.options.isMonthDisabled&&this.options.isMonthDisabled(this.year,this.month+1);for(curDay=1;curDay<=numDays;curDay++){var date=new Date(this.year,this.month,curDay,0,0,0,0);var longdate=this.formatDate(date,this.options.titleFormat);var curDayClass=curDay==this.date&&this.month==this.curMonth&&this.year==this.curYear?" curDay":"";const isToday=date.toISOString()===today.toISOString();if(isYearDisabled||isMonthDisabled){gridCells+='\t\t-1){gridCells+='\t\t this.options.max){gridCells+='\t\t -1){gridCells+='\t\t '+curDay;gridCells+=" ";if(weekday==lastDayOfWeek&&curDay\n\t\n';rowCount++}if(curDay'+ ++numEmpties+"\n";weekday=(weekday+1)%7}gridCells+="\t ";var $tbody=this.$grid.find("tbody");$tbody.empty();$tbody.append(gridCells);this.gridType=VIEW_DAYS};Datepicker.prototype.populateMonthsCalendar=function(){const today=new Date;this.log("populateMonthsCalendar");this.$calendar.find(".datepicker-bn-prev-label").html(this.options.prevMonthButtonLabel);this.$calendar.find(".datepicker-bn-next-label").html(this.options.nextMonthButtonLabel);this.hideObject(this.$fastprev);this.hideObject(this.$fastnext);if(this.options.min!=null&&this.year-1this.options.max.getFullYear()){this.$next.attr("title","");this.$next.addClass("disabled");this.$next.removeClass("enabled")}else{this.$next.attr("title",this.options.nextMonthButtonLabel);this.$next.addClass("enabled");this.$next.removeClass("disabled")}var curMonth=0;var rowCount=1;var $tbody=this.$grid.find("tbody");this.$monthObj.html(this.year);this.hideObject(this.$grid.find("thead"));$tbody.empty();$("#datepicker-err-msg-"+this.id).empty();var gridCells='\t\n';var isYearDisabled=this.options.isYearDisabled&&this.options.isYearDisabled(this.year);for(curMonth=0;curMonth<12;curMonth++){if(isYearDisabled){gridCells+='\t\tthis.options.max.getFullYear()||this.year==this.options.max.getFullYear()&&curMonth>this.options.max.getMonth())){gridCells+='\t\t '+this.locales.month_names_abbreviated[curMonth];gridCells+=" ";if(curMonth==3||curMonth==7){gridCells+='\t \n\t\n';rowCount++}}gridCells+="\t ";$tbody.append(gridCells);this.gridType=VIEW_MONTHS};Datepicker.prototype.populateYearsCalendar=function(){const thisYear=(new Date).getFullYear();this.$calendar.find(".datepicker-bn-prev-label").html(this.options.prevYearButtonLabel);this.$calendar.find(".datepicker-bn-next-label").html(this.options.nextYearButtonLabel);this.hideObject(this.$fastprev);this.hideObject(this.$fastnext);if(this.options.min!=null&&this.year-20this.options.max.getFullYear()){this.$next.attr("title","");this.$next.addClass("disabled");this.$next.removeClass("enabled")}else{this.$next.attr("title",this.options.nextYearButtonLabel);this.$next.addClass("enabled");this.$next.removeClass("disabled")}var startYear=Math.floor(this.year/10)*10;var endYear=startYear+19;var rowCount=1;var $tbody=this.$grid.find("tbody");this.$monthObj.html(startYear+"-"+endYear);this.hideObject(this.$grid.find("thead"));$tbody.empty();$("#datepicker-err-msg-"+this.id).empty();var gridCells='\t\n';for(var curYear=startYear;curYear<=endYear;curYear++){if(curYear==this.year){gridCells+='\t\tthis.options.max.getFullYear()){gridCells+='\t\t '+curYear;gridCells+=" ";var curPos=curYear-startYear;if(curPos==4||curPos==9||curPos==14){gridCells+='\t \n\t\n';rowCount++}}gridCells+="\t ";$tbody.append(gridCells);this.gridType=VIEW_YEARS};Datepicker.prototype.showDaysOfPrevMonth=function(offset){var previousMonth=this.previousMonth(this.year,this.month);if(this.options.min!=null&&(previousMonth.year=0&&!$allCells.eq(offset).hasClass("selectable")){offset--}if(offset>=0){var day=$allCells.eq(offset).attr("id");this.$grid.attr("aria-activedescendant",day);this.selectGridCell(day)}}return true};Datepicker.prototype.setCurrentTime=function($li){if($li.length){this.$timeview.find("li").removeClass("curTime");$li.addClass("curTime")}};Datepicker.prototype.setSelectedTime=function($li){if($li.length){this.$timeview.find("li").removeClass("focus").attr("tabindex","-1").attr("aria-selected","false");this.$timeview.attr("aria-activedescendant",$li.attr("id"));$li.addClass("focus").attr("tabindex","0").attr("aria-selected","true");this.dateObj.setHours($li.data("hours"));this.dateObj.setMinutes($li.data("minutes"))}};Datepicker.prototype.scrollIntoView=function($li){if($li.length){let li=$li[0];if(li&&li.scrollIntoViewIfNeeded){li.scrollIntoViewIfNeeded(true)}else if(li&&li.scrollIntoView){li.scrollIntoView({behaviour:"smooth",block:"center"})}}};Datepicker.prototype.focusTime=function(){this.$timeview.focus();this.setSelectedTime(this.$timeview.find(".curTime"));return true};Datepicker.prototype.showDaysOfMonth=function(month){if(this.options.min!=null&&(this.yearthis.options.max.getFullYear()||this.year==this.options.max.getFullYear()&&month>this.options.max.getMonth())){return false}this.month=month;this.date=Math.min(this.date,this.getDaysInMonth(this.year,this.month));this.populateDaysCalendar();var $active=this.$grid.find("tbody td[data-value='"+this.date+"']");this.selectGridCell($active.attr("id"));return true};Datepicker.prototype.showMonthsOfPrevYear=function(offset){if(this.options.min!=null&&this.year-1=0&&!$allCells.eq(offset).hasClass("selectable")){offset--}if(offset>=0){var month=$allCells.eq(offset).attr("id");this.$grid.attr("aria-activedescendant",month);this.selectGridCell(month)}}return true};Datepicker.prototype.showMonthsOfYear=function(year){if(this.options.min!=null&&yearthis.options.max.getFullYear()){return false}this.year=year;this.populateMonthsCalendar();var $active=this.$grid.find("tbody td[data-value='"+this.month+"']");this.$grid.attr("aria-activedescendant",$active.attr("id"));this.selectGridCell($active.attr("id"));return true};Datepicker.prototype.showYearsOfPrevRange=function(offset){if(this.options.min!=null&&this.year-20=0&&!$allCells.eq(offset).hasClass("selectable")){offset--}if(offset>=0){var year=$allCells.eq(offset).attr("id");this.$grid.attr("aria-activedescendant",year);this.selectGridCell(year)}}return true};Datepicker.prototype.showDaysOfNextMonth=function(offset){var nextMonth=this.nextMonth(this.year,this.month);if(this.options.max!=null&&(nextMonth.year>this.options.max.getFullYear()||nextMonth.year==this.options.max.getFullYear()&&nextMonth.month>this.options.max.getMonth())){return false}this.month=nextMonth.month;this.year=nextMonth.year;this.populateDaysCalendar();if(offset!=null){var $allCells=this.$grid.find("td");offset--;while(offset<$allCells.length&&!$allCells.eq(offset).hasClass("selectable")){offset++}if(offset<$allCells.length){var day=$allCells.eq(offset).attr("id");this.$grid.attr("aria-activedescendant",day);this.selectGridCell(day)}}return true};Datepicker.prototype.showMonthsOfNextYear=function(offset){if(this.options.max!=null&&this.year+1>this.options.max.getFullYear()){return false}this.year++;this.populateMonthsCalendar();if(offset!=null){var $allCells=this.$grid.find("td");offset--;while(offset<$allCells.length&&!$allCells.eq(offset).hasClass("selectable")){offset++}if(offset<$allCells.length){var month=$allCells.eq(offset).attr("id");this.$grid.attr("aria-activedescendant",month);this.selectGridCell(month)}}return true};Datepicker.prototype.showYearsOfNextRange=function(offset){if(this.options.max!=null&&this.year+20>this.options.max.getFullYear()){return false}this.year+=20;this.populateYearsCalendar();if(offset!=null){var $allCells=this.$grid.find("td");offset--;while(offset<$allCells.length&&!$allCells.eq(offset).hasClass("selectable")){offset++}if(offset<$allCells.length){var year=$allCells.eq(offset).attr("id");this.$grid.attr("aria-activedescendant",year);this.selectGridCell(year)}}return true};Datepicker.prototype.showDaysOfPrevYear=function(){if(this.options.min!=null&&(this.year-1this.options.max.getFullYear()||this.year+1==this.options.max.getFullYear()&&this.month>this.options.max.getMonth())){return false}this.year++;this.populateDaysCalendar();return true};Datepicker.prototype.bindHandlers=function(){var self=this;this.$fastprev.click((function(e){return self.handleFastPrevClick(e)}));this.$prev.click((function(e){return self.handlePrevClick(e)}));this.$next.click((function(e){return self.handleNextClick(e)}));this.$fastnext.click((function(e){return self.handleFastNextClick(e)}));this.$monthObj.click((function(e){return self.handleMonthClick(e)}));this.$monthObj.keydown((function(e){return self.handleMonthKeyDown(e)}));this.$fastprev.keydown((function(e){return self.handleFastPrevKeyDown(e)}));this.$prev.keydown((function(e){return self.handlePrevKeyDown(e)}));this.$next.keydown((function(e){return self.handleNextKeyDown(e)}));this.$fastnext.keydown((function(e){return self.handleFastNextKeyDown(e)}));if(this.options.modal==true){this.$close.click((function(e){return self.handleCloseClick(e)}));this.$close.keydown((function(e){return self.handleCloseKeyDown(e)}))}this.$grid.keydown((function(e){return self.handleGridKeyDown(e)}));this.$grid.keypress((function(e){return self.handleGridKeyPress(e)}));this.$grid.focus((function(e){return self.handleGridFocus(e)}));this.$grid.blur((function(e){return self.handleGridBlur(e)}));this.$grid.delegate("td","click",(function(e){return self.handleGridClick(this,e)}));this.$timeview.keydown((function(e){return self.handleTimeViewKeyDown(e)}));this.$timeview.click((function(e){return self.handleTimeViewClick(e)}));this.$target.change((function(){const currentValue=$(this).val();const date=self.parseDate(currentValue);self.markHasError(!!currentValue&&!date);self.updateLinked(date);self.updateLinkField(date)}))};Datepicker.prototype.handleTimeViewKeyDown=function(e){this.log("handleTimeViewKeyDown");this.keyboardUsed();var $li=this.$timeview.find("li.focus");switch(e.keyCode){case this.keys.esc:e.preventDefault();this.hide();break;case this.keys.space:case this.keys.enter:e.preventDefault();this.setCurrentTime($li);this.update();this.hide();break;case this.keys.pageup:case this.keys.up:e.preventDefault();$li=$li.prev("li");this.setSelectedTime($li);this.scrollIntoView($li);break;case this.keys.pagedown:case this.keys.down:e.preventDefault();$li=$li.next("li");this.setSelectedTime($li);this.scrollIntoView($li);break}};Datepicker.prototype.handleTimeViewClick=function(e){this.log("handleTimeViewClick");var $li=$(e.target).closest("li");if($li.length){this.setSelectedTime($li);this.setCurrentTime($li);this.update();this.hide()}};Datepicker.prototype.handleFastPrevClick=function(e){if(this.showDaysOfPrevYear()){var active=this.$grid.attr("aria-activedescendant");if(this.month!=this.curMonth||this.year!=this.curYear){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}else{this.$grid.attr("aria-activedescendant",active);this.selectGridCell(active)}}e.stopPropagation();return false};Datepicker.prototype.handlePrevClick=function(e){var active=this.$grid.attr("aria-activedescendant");switch(this.gridType){case VIEW_DAYS:var ok;if(e.ctrlKey){ok=this.showDaysOfPrevYear()}else{ok=this.showDaysOfPrevMonth()}if(ok){if(this.month!=this.curMonth||this.year!=this.curYear){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}else{this.$grid.attr("aria-activedescendant",active);this.selectGridCell(active)}}break;case VIEW_MONTHS:if(this.showMonthsOfPrevYear()){if(this.year!=this.curYear){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}else{this.$grid.attr("aria-activedescendant",active);this.selectGridCell(active)}}break;case VIEW_YEARS:if(this.showYearsOfPrevRange()){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}break}e.stopPropagation();return false};Datepicker.prototype.handleMonthClick=function(e){this.log("handleMonthClick");if(this.options.timeOnly){return true}this.changeGrid(e);e.stopPropagation();return false};Datepicker.prototype.handleNextClick=function(e){if(this.options.timeOnly){return true}var active=this.$grid.attr("aria-activedescendant");switch(this.gridType){case VIEW_DAYS:var ok;if(e.ctrlKey){ok=this.showDaysOfNextYear()}else{ok=this.showDaysOfNextMonth()}if(ok){if(this.month!=this.curMonth||this.year!=this.curYear){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}else{this.$grid.attr("aria-activedescendant",active);this.selectGridCell(active)}}break;case VIEW_MONTHS:if(this.showMonthsOfNextYear()){if(this.year!=this.curYear){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}else{this.$grid.attr("aria-activedescendant",active);this.selectGridCell(active)}}break;case VIEW_YEARS:if(this.showYearsOfNextRange()){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}break}e.stopPropagation();return false};Datepicker.prototype.handleFastNextClick=function(e){if(this.options.timeOnly){return true}if(this.showDaysOfNextYear()){var active=this.$grid.attr("aria-activedescendant");if(this.month!=this.curMonth||this.year!=this.curYear){this.$grid.attr("aria-activedescendant","cell1"+"-"+this.id);this.selectGridCell("cell1"+"-"+this.id)}else{this.$grid.attr("aria-activedescendant",active);this.selectGridCell(active)}}e.stopPropagation();return false};Datepicker.prototype.handleCloseClick=function(e){this.hide();e.stopPropagation();return false};Datepicker.prototype.handleFastPrevKeyDown=function(e){if(this.options.timeOnly){return true}if(e.altKey){return true}switch(e.keyCode){case this.keys.tab:{if(this.options.modal==false||e.ctrlKey){return true}if(e.shiftKey){this.$close.focus()}else{this.$prev.focus()}e.stopPropagation();return false}case this.keys.enter:case this.keys.space:{if(e.shiftKey||e.ctrlKey){return true}this.showDaysOfPrevYear();e.stopPropagation();return false}case this.keys.esc:{this.hide();e.stopPropagation();return false}}return true};Datepicker.prototype.handlePrevKeyDown=function(e){if(this.options.timeOnly){return true}if(e.altKey){return true}switch(e.keyCode){case this.keys.tab:{if(this.options.modal==false||e.ctrlKey){return true}if(e.shiftKey){if(this.gridType==VIEW_DAYS){this.$fastprev.focus()}else{this.$close.focus()}}else{this.$monthObj.focus()}e.stopPropagation();return false}case this.keys.enter:case this.keys.space:{if(e.shiftKey){return true}switch(this.gridType){case VIEW_DAYS:if(e.ctrlKey){this.showDaysOfPrevYear()}else{this.showDaysOfPrevMonth()}break;case VIEW_MONTHS:this.showMonthsOfPrevYear();break;case VIEW_YEARS:this.showYearsOfPrevRange();break}e.stopPropagation();return false}case this.keys.esc:{this.hide();e.stopPropagation();return false}}return true};Datepicker.prototype.handleMonthKeyDown=function(e){this.log("handleMonthKeyDown");if(this.options.timeOnly){return true}if(e.altKey){return true}switch(e.keyCode){case this.keys.tab:{if(this.options.modal==false||e.ctrlKey){return true}if(e.shiftKey){this.$prev.focus()}else{this.$next.focus()}e.stopPropagation();return false}case this.keys.enter:case this.keys.space:{this.changeGrid(e);e.stopPropagation();return false}case this.keys.esc:{this.hide();e.stopPropagation();return false}}return true};Datepicker.prototype.handleNextKeyDown=function(e){if(this.options.timeOnly){return true}if(e.altKey){return true}switch(e.keyCode){case this.keys.tab:{if(this.options.modal==false||e.ctrlKey){return true}if(e.shiftKey){this.$monthObj.focus()}else{if(this.gridType==VIEW_DAYS){this.$fastnext.focus()}else{this.$grid.focus()}}e.stopPropagation();return false}case this.keys.enter:case this.keys.space:{switch(this.gridType){case VIEW_DAYS:if(e.ctrlKey){this.showDaysOfNextYear()}else{this.showDaysOfNextMonth()}break;case VIEW_MONTHS:this.showMonthsOfNextYear();break;case VIEW_YEARS:this.showYearsOfNextRange();break}e.stopPropagation();return false}case this.keys.esc:{this.hide();e.stopPropagation();return false}}return true};Datepicker.prototype.handleFastNextKeyDown=function(e){if(this.options.timeOnly){return true}if(e.altKey){return true}switch(e.keyCode){case this.keys.tab:{if(this.options.modal==false||e.ctrlKey){return true}if(e.shiftKey){this.$next.focus()}else{this.$grid.focus()}e.stopPropagation();return false}case this.keys.enter:case this.keys.space:{this.showDaysOfNextYear();e.stopPropagation();return false}case this.keys.esc:{this.hide();e.stopPropagation();return false}}return true};Datepicker.prototype.handleCloseKeyDown=function(e){if(e.altKey){return true}switch(e.keyCode){case this.keys.tab:{if(e.ctrlKey){return true}if(e.shiftKey){this.$grid.focus()}else{if(this.gridType==VIEW_DAYS){this.$fastprev.focus()}else{this.$prev.focus()}}e.stopPropagation();return false}case this.keys.enter:case this.keys.esc:case this.keys.space:{if(e.shiftKey||e.ctrlKey){return true}this.hide();e.stopPropagation();return false}}return true};Datepicker.prototype.handleGridKeyDown=function(e){this.log("gridKeyDown");if(this.options.timeOnly){return true}this.keyboardUsed();var $curCell=$("#"+this.$grid.attr("aria-activedescendant"));var $cells=this.$grid.find("td.selectable");var colCount=this.$grid.find("tbody tr").eq(0).find("td").length;if(e.altKey&&e.keyCode!=this.keys.pageup&&e.keyCode!=this.keys.pagedown){return true}switch(e.keyCode){case this.keys.tab:{if(this.options.modal==true){if(e.shiftKey){if(this.gridType==VIEW_DAYS){this.$fastnext.focus()}else{this.$next.focus()}}else{this.$close.focus()}e.stopPropagation()}else{this.hide();this.handleTabOut(e);e.stopPropagation()}return false}case this.keys.enter:case this.keys.space:{if(e.ctrlKey){return true}switch(this.gridType){case VIEW_DAYS:if(this.options.timeEnabled){let value=parseInt($curCell.attr("data-value"),10);this.log("Day "+value+" selected, moving on to hours");this.focusTime(value)}else{this.update();this.hide()}break;case VIEW_MONTHS:this.showDaysOfMonth(parseInt($curCell.attr("data-value"),10));break;case VIEW_YEARS:this.showMonthsOfYear(parseInt($curCell.attr("data-value"),10));break}e.stopPropagation();return false}case this.keys.esc:{this.hide();e.stopPropagation();return false}case this.keys.left:case this.keys.right:{if(e.keyCode==this.keys.left&&this.locales.directionality==="LTR"||e.keyCode==this.keys.right&&this.locales.directionality==="RTL"){if(e.ctrlKey||e.shiftKey){return true}let cellIndex=$cells.index($curCell)-1;let $prevCell=null;if(cellIndex>=0){$prevCell=$cells.eq(cellIndex);this.unSelectGridCell($curCell.attr("id"));this.$grid.attr("aria-activedescendant",$prevCell.attr("id"));this.selectGridCell($prevCell.attr("id"))}else{switch(this.gridType){case VIEW_DAYS:this.showDaysOfPrevMonth(0);break;case VIEW_MONTHS:this.showMonthsOfPrevYear(0);break;case VIEW_YEARS:this.showYearsOfPrevRange(0);break}}e.stopPropagation();return false}else{if(e.ctrlKey||e.shiftKey){return true}let cellIndex=$cells.index($curCell)+1;let $nextCell=null;if(cellIndex<$cells.length){$nextCell=$cells.eq(cellIndex);this.unSelectGridCell($curCell.attr("id"));this.$grid.attr("aria-activedescendant",$nextCell.attr("id"));this.selectGridCell($nextCell.attr("id"))}else{switch(this.gridType){case VIEW_DAYS:this.showDaysOfNextMonth(1);break;case VIEW_MONTHS:this.showMonthsOfNextYear(1);break;case VIEW_YEARS:this.showYearsOfNextRange(1);break}}e.stopPropagation();return false}}case this.keys.up:{if(e.ctrlKey||e.shiftKey){return true}let $allCells=this.$grid.find("td");let cellIndex=$allCells.index($curCell)-colCount;let $prevCell=null;while(cellIndex>=0&&!$allCells.eq(cellIndex).hasClass("selectable")){cellIndex--}if(cellIndex>=0){$prevCell=$allCells.eq(cellIndex);this.unSelectGridCell($curCell.attr("id"));this.$grid.attr("aria-activedescendant",$prevCell.attr("id"));this.selectGridCell($prevCell.attr("id"))}else{cellIndex=colCount-$allCells.index($curCell)%colCount;switch(this.gridType){case VIEW_DAYS:this.showDaysOfPrevMonth(cellIndex);break;case VIEW_MONTHS:this.showMonthsOfPrevYear(cellIndex);break;case VIEW_YEARS:this.showYearsOfPrevRange(cellIndex);break}}e.stopPropagation();return false}case this.keys.down:{if(e.ctrlKey||e.shiftKey){return true}var $allCells=this.$grid.find("td");var cellIndex=$allCells.index($curCell)+colCount;while(cellIndex<$allCells.length&&!$allCells.eq(cellIndex).hasClass("selectable")){cellIndex++}if(cellIndex<$allCells.length){var $nextCell=$allCells.eq(cellIndex);this.unSelectGridCell($curCell.attr("id"));this.$grid.attr("aria-activedescendant",$nextCell.attr("id"));this.selectGridCell($nextCell.attr("id"))}else{cellIndex=$allCells.index($curCell)%colCount+1;switch(this.gridType){case VIEW_DAYS:this.showDaysOfNextMonth(cellIndex);break;case VIEW_MONTHS:this.showMonthsOfNextYear(cellIndex);break;case VIEW_YEARS:this.showYearsOfNextRange(cellIndex);break}}e.stopPropagation();return false}case this.keys.pageup:{var active=this.$grid.attr("aria-activedescendant");if(e.shiftKey||e.ctrlKey){return true}e.preventDefault();var ok=false;switch(this.gridType){case VIEW_DAYS:if(e.altKey){e.stopImmediatePropagation();ok=this.showDaysOfPrevYear()}else{ok=this.showDaysOfPrevMonth()}break;case VIEW_MONTHS:ok=this.showMonthsOfPrevYear();break;case VIEW_YEARS:ok=this.showYearsOfPrevRange();break}if(ok){if($("#"+active).attr("id")==undefined){$cells=this.$grid.find("td.selectable");var $lastCell=$cells.eq($cells.length-1);this.$grid.attr("aria-activedescendant",$lastCell.attr("id"));this.selectGridCell($lastCell.attr("id"))}else{this.selectGridCell(active)}}e.stopPropagation();return false}case this.keys.pagedown:{let active=this.$grid.attr("aria-activedescendant");if(e.shiftKey||e.ctrlKey){return true}e.preventDefault();let ok=false;switch(this.gridType){case VIEW_DAYS:if(e.altKey){e.stopImmediatePropagation();ok=this.showDaysOfNextYear()}else{ok=this.showDaysOfNextMonth()}break;case VIEW_MONTHS:ok=this.showMonthsOfNextYear();break;case VIEW_YEARS:ok=this.showYearsOfNextRange();break}if(ok){if($("#"+active).attr("id")==undefined){$cells=this.$grid.find("td.selectable");let $lastCell=$cells.eq($cells.length-1);this.$grid.attr("aria-activedescendant",$lastCell.attr("id"));this.selectGridCell($lastCell.attr("id"))}else{this.selectGridCell(active)}}e.stopPropagation();return false}case this.keys.home:{if(e.ctrlKey||e.shiftKey){return true}var $firstCell=$cells.eq(0);this.unSelectGridCell($curCell.attr("id"));this.$grid.attr("aria-activedescendant",$firstCell.attr("id"));this.selectGridCell($firstCell.attr("id"));e.stopPropagation();return false}case this.keys.end:{if(e.ctrlKey||e.shiftKey){return true}let $lastCell=$cells.eq($cells.length-1);this.unSelectGridCell($curCell.attr("id"));this.$grid.attr("aria-activedescendant",$lastCell.attr("id"));this.selectGridCell($lastCell.attr("id"));e.stopPropagation();return false}}return true};Datepicker.prototype.handleGridKeyPress=function(e){if(e.altKey){return true}switch(e.keyCode){case this.keys.tab:case this.keys.enter:case this.keys.space:case this.keys.esc:case this.keys.left:case this.keys.right:case this.keys.up:case this.keys.down:case this.keys.pageup:case this.keys.pagedown:case this.keys.home:case this.keys.end:{e.stopPropagation();return false}}return true};Datepicker.prototype.handleGridClick=function(id,e){this.log("handleGridClick");if(this.options.timeOnly){return true}var $cell=$(id);if($cell.is(".empty")||$cell.is(".unselectable")){return true}this.$grid.find(".focus").removeClass("focus").attr("aria-selected","false").attr("tabindex",-1);switch(this.gridType){case VIEW_DAYS:{this.$grid.attr("aria-activedescendant",$cell.attr("id"));this.selectGridCell($cell.attr("id"));let value=parseInt($cell.attr("data-value"),10);this.date=value;if(this.options.timeEnabled){this.log("Day "+value+"selected, moving on to hours");this.focusTime(value)}else{this.update();this.hide()}break}case VIEW_MONTHS:this.showDaysOfMonth(parseInt($cell.attr("data-value"),10));break;case VIEW_YEARS:this.showMonthsOfYear(parseInt($cell.attr("data-value"),10));break}e.stopPropagation();return false};Datepicker.prototype.handleGridFocus=function(){if(this.options.timeOnly){return true}let active=this.$grid.attr("aria-activedescendant");if($("#"+active).attr("id")==undefined){let $cells=this.$grid.find("td.selectable");let $lastCell=$cells.eq($cells.length-1);this.$grid.attr("aria-activedescendant",$lastCell.attr("id"));this.selectGridCell($lastCell.attr("id"))}else{this.selectGridCell(active)}return true};Datepicker.prototype.handleGridBlur=function(){this.unSelectGridCell(this.$grid.attr("aria-activedescendant"));return true};Datepicker.prototype.handleTabOut=function(e){var fields=$("body").find(":input:visible:not([disabled], .datepicker-button), a[href]:visible:not([disabled], .datepicker-button)");var index=fields.index(this.$target);if(index>-1&&index0){index--}}else{if(index+1date){let previousVal=this.formatDate(date,this.options.previous.datepicker("outputFormat"));this.options.previous.val(previousVal)}}else{if(previousDate>=date){let previousVal=this.formatDate(new Date(date.getTime()-60*60*24*1e3),this.options.previous.datepicker("outputFormat"));this.options.previous.val(previousVal)}}}if(this.options.next!==null&&this.options.next.val()!==""){let nextDate=this.options.next.datepicker("getDate");if(this.options.allowSameDate){if(nextDate');$overlay=$("#datepicker-overlay")}if(on){$overlay.fadeIn(500)}else{$overlay.fadeOut(500)}};Datepicker.prototype.getDaysInMonth=function(year,month){return 32-new Date(year,month,32).getDate()};Datepicker.prototype.previousMonth=function(year,month){if(month==0){month=11;year--}else{month--}return{year:year,month:month}};Datepicker.prototype.nextMonth=function(year,month){if(month==11){month=0;year++}else{month++}return{year:year,month:month}};Datepicker.prototype.formatDate=function(date,format){var zeroPad=function(x){return(x<0||x>9?"":"0")+x};var getWeekOfMonth=function(date){return Math.ceil((date.getDate()-1-date.getDay())/7)};var getWeekOfYear=function(date){var onejan=new Date(date.getFullYear(),0,1);return Math.ceil(((date-onejan)/864e5+onejan.getDay()+1)/7)};var getDayOfYear=function(date){var start=new Date(date.getFullYear(),0,0);return Math.floor((date-start)/864e5)};var getMillisecondsInDay=function(date){var date1=new Date(date.getTime());date1.setHours(0);return date-date1};var y=date.getFullYear()+"";var M=date.getMonth()+1;var d=date.getDate();var D=getDayOfYear(date);var E=date.getDay();var H=date.getHours();var m=date.getMinutes();var s=date.getSeconds();var w=getWeekOfYear(date);var W=getWeekOfMonth(date);var F=Math.floor(date.getDate()/7)+1;var Q=Math.ceil((date.getMonth()+1)/3);var era=date.getFullYear()<1?0:1;var values={y:""+y,yyyy:y,yy:y.substring(2,4),L:M,LL:zeroPad(M),LLL:this.locales.month_names_abbreviated[M-1],LLLL:this.locales.month_names[M-1],LLLLL:this.locales.month_names_narrow[M-1],M:M,MM:zeroPad(M),MMM:this.locales.month_names_abbreviated[M-1],MMMM:this.locales.month_names[M-1],MMMMM:this.locales.month_names_narrow[M-1],d:d,dd:zeroPad(d),D:D,DD:D,DDD:D,A:Math.round(getMillisecondsInDay(date)*Math.pow(10,-2)),AA:Math.round(getMillisecondsInDay(date)*Math.pow(10,-1)),AAA:Math.round(getMillisecondsInDay(date)*Math.pow(10,0)),AAAA:Math.round(getMillisecondsInDay(date)*Math.pow(10,1)),AAAAA:Math.round(getMillisecondsInDay(date)*Math.pow(10,2)),AAAAAA:Math.round(getMillisecondsInDay(date)*Math.pow(10,3)),E:this.locales.day_names_abbreviated[E],EE:this.locales.day_names_abbreviated[E],EEE:this.locales.day_names_abbreviated[E],EEEE:this.locales.day_names[E],EEEEE:this.locales.day_names_narrow[E],EEEEEE:this.locales.day_names_short[E],e:E,ee:E,eee:this.locales.day_names_abbreviated[E],eeee:this.locales.day_names[E],eeeee:this.locales.day_names_narrow[E],eeeeee:this.locales.day_names_short[E],c:E,cc:E,ccc:this.locales.day_names_abbreviated[E],cccc:this.locales.day_names[E],ccccc:this.locales.day_names_narrow[E],cccccc:this.locales.day_names_short[E],F:F,G:this.locales.era_names_abbreviated[era],GG:this.locales.era_names_abbreviated[era],GGG:this.locales.era_names_abbreviated[era],GGGG:this.locales.era_names[era],GGGGG:this.locales.era_names_narrow[era],Q:Q,QQ:zeroPad(Q),QQQ:this.locales.quarter_names_abbreviated[Q-1],QQQQ:this.locales.quarter_names[Q-1],QQQQQ:this.locales.quarter_names_narrow[Q-1],q:Q,qq:zeroPad(Q),qqq:this.locales.quarter_names_abbreviated[Q-1],qqqq:this.locales.quarter_names[Q-1],qqqqq:this.locales.quarter_names_narrow[Q-1],H:H,HH:zeroPad(H),h:H==0?12:H>12?H-12:H,hh:zeroPad(H==0?12:H>12?H-12:H),K:H>11?H-12:H,k:H+1,KK:zeroPad(H>11?H-12:H),kk:zeroPad(H+1),a:H>11?this.locales.day_periods.pm:this.locales.day_periods.am,m:m,mm:zeroPad(m),s:s,ss:zeroPad(s),w:w,ww:zeroPad(w),W:W};return format.replace(/('[^']+'|y{1,4}|L{1,5}|M{1,5}|c{1,6}|d{1,2}|D{1,3}|E{1,6}|e{1,6}|F{1,1}|G{1,5}|Q{1,5}|q{1,5}|H{1,2}|h{1,2}|K{1,2}|k{1,2}|m{1,2}|s{1,2}|w{1,2}|W{1,1}|A{1,6})/g,(function(mask){return mask.charAt(0)==="'"?mask.substr(1,mask.length-2):values[mask]||mask}))};Datepicker.prototype.createDateFromFormat=function(format,value){var extractInteger=function(str,pos,minlength,maxlength){for(var x=maxlength;x>=minlength;x--){var integer=str.substring(pos,pos+x);if(integer.length12){return null}pos+=month.length;break;case"dd":case"d":date=extractInteger(value,pos,token.length,2);if(date==null||date<1||date>31){return null}pos+=date.length;break;case"hh":case"h":hh=extractInteger(value,pos,token.length,2);if(hh==null||hh<1||hh>12){return null}pos+=hh.length;break;case"HH":case"H":hh=extractInteger(value,pos,token.length,2);if(hh==null||hh<0||hh>23){return null}pos+=hh.length;break;case"KK":case"K":hh=extractInteger(value,pos,token.length,2);if(hh==null||hh<0||hh>11){return null}pos+=hh.length;break;case"kk":case"k":hh=extractInteger(value,pos,token.length,2);if(hh==null||hh<1||hh>24){return null}pos+=hh.length;hh--;break;case"mm":case"m":mm=extractInteger(value,pos,token.length,2);if(mm==null||mm<0||mm>59){return null}pos+=mm.length;break;case"ss":case"s":ss=extractInteger(value,pos,token.length,2);if(ss==null||ss<0||ss>59){return null}pos+=ss.length;break;case"a":var amlength=self.locales.day_periods.am.length;var pmlength=self.locales.day_periods.pm.length;if(value.substring(pos,pos+amlength)==self.locales.day_periods.am){ampm="AM";pos+=amlength}else if(value.substring(pos,pos+pmlength)==self.locales.day_periods.pm){ampm="PM";pos+=pmlength}else{return null}break;default:if(value.substring(pos,pos+token.length)!=token){return null}else{pos+=token.length}}}));if(pos!=value.length){return null}if(year==null){return null}if(year.length==2){if(year>50){year=1900+(year-0)}else{year=2e3+(year-0)}}if(month<1||month>12){return null}if(month==2){if(year%4==0&&year%100!=0||year%400==0){if(date>29){return null}}else{if(date>28){return null}}}if(month==4||month==6||month==9||month==11){if(date>30){return null}}if(hh<12&&m=="PM"){hh=hh-0+12}else if(hh>11&&m=="AM"){hh-=12}return new Date(year,month-1,date,hh,mm,ss)};Datepicker.prototype.parseDate=function(value){var date=null;var self=this;$.each(this.options.inputFormat,(function(i,format){date=self.createDateFromFormat(format,value);if(date!=null){return false}}));if(date==null){date=self.createDateFromFormat(this.options.outputFormat,value)}return date};Datepicker.prototype.min=function(value){if(value!=null){this.options.min=value instanceof Date?value:this.parseDate(value);if(this.options.min!=null&&this.dateObjthis.options.max){this.markHasError(true);this.dateObj=this.options.max}if(this.options.inline!=false){this.refresh()}}return this.options.max};Datepicker.prototype.next=function(value){if(value!=null){if(typeof value==="string"){this.options.next=$(value)}else if(this.options.next instanceof jQuery){this.options.next=value}}return this.options.next};Datepicker.prototype.previous=function(value){if(value!=null){if(typeof value==="string"){this.options.previous=$(value)}else if(this.options.previous instanceof jQuery){this.options.previous=value}}return this.options.previous};Datepicker.prototype.theme=function(value){if(value!=null){this.$button.removeClass(this.options.theme);this.$calendar.removeClass(this.options.theme);this.options.theme=value;this.$button.addClass(this.options.theme);this.$calendar.addClass(this.options.theme)}return this.options.theme};Datepicker.prototype.firstDayOfWeek=function(value){if(value!=null){this.options.firstDayOfWeek=parseInt(value,10);if(this.options.inline==false){this.drawCalendarHeader()}else{this.refresh()}}return this.options.firstDayOfWeek};Datepicker.prototype.daysOfWeekDisabled=function(value){if(value!=null){this.options.daysOfWeekDisabled=[];if(!$.isArray(value)){value=[value]}var self=this;$.each(value,(function(i,val){if(typeof val==="number"){self.options.daysOfWeekDisabled.push(val)}else if(typeof val==="string"){self.options.daysOfWeekDisabled.push(parseInt(val,10))}}))}return this.options.daysOfWeekDisabled};Datepicker.prototype.weekDayFormat=function(value){if(value!=null){this.options.weekDayFormat=value;this.drawCalendarHeader()}return this.options.weekDayFormat};Datepicker.prototype.inputFormat=function(value){if(value!=null){if(!$.isArray(value)){value=[value]}if(this.$target.attr("placeholder")==this.options.inputFormat[0]){this.$target.attr("placeholder",value[0])}this.options.inputFormat=value}return this.options.inputFormat};Datepicker.prototype.outputFormat=function(value){if(value!=null){this.options.outputFormat=value}return this.options.outputFormat};Datepicker.prototype.modal=function(value){if(value!=null){this.options.modal=value;if(this.options.modal==true){if(this.options.inline==false){this.showObject(this.$calendar.find(".datepicker-close-wrap"));this.showObject(this.$calendar.find(".datepicker-bn-close-label"))}this.$close=this.$calendar.find(".datepicker-close");this.$close.html(this.options.closeButtonTitle).attr("title",this.options.closeButtonLabel);this.$calendar.find(".datepicker-bn-close-label").html(this.options.closeButtonLabel);var self=this;this.$close.click((function(e){return self.handleCloseClick(e)}));this.$close.keydown((function(e){return self.handleCloseKeyDown(e)}))}else{this.hideObject(this.$calendar.find(".datepicker-close-wrap"));this.hideObject(this.$calendar.find(".datepicker-bn-close-label"))}}return this.options.modal};Datepicker.prototype.inline=function(value){if(value!=null){if(value!=false){this.hideObject(this.$button);this.hideObject(this.$calendar.find(".datepicker-close-wrap"));this.hideObject(this.$calendar.find(".datepicker-bn-close-label"));var $container=typeof value==="string"?$("#"+value):value;$container.append(this.$calendar);this.$calendar.css({position:"relative",left:"0px",top:"0px"});this.options.inline=value;this.initializeDate();this.showObject(this.$calendar)}else{this.$target.parent().after(this.$calendar);this.showObject(this.$button);if(this.options.modal==true){this.showObject(this.$calendar.find(".datepicker-close-wrap"));this.showObject(this.$calendar.find(".datepicker-bn-close-label"))}if(this.$calendar.parent().css("position")==="static"){this.$calendar.parent().css("position","relative")}this.$calendar.css({position:"absolute"});this.options.inline=value;this.hide()}}return this.options.inline};Datepicker.prototype.format=function(date){return this.formatDate(date,this.options.outputFormat)};Datepicker.prototype.enable=function(){this.$button.removeClass("disabled");this.$button.attr("aria-disabled",false);this.$button.attr("tabindex",0)};Datepicker.prototype.disable=function(){this.hide();this.$button.addClass("disabled");this.$button.attr("aria-disabled",true);this.$button.attr("tabindex",-1)};Datepicker.prototype.datesDisabled=function(dates){this.options.datesDisabled=[];if(!$.isArray(dates)){dates=[dates]}var self=this;$.each(dates,(function(i,v){if(typeof v==="string"){var date=self.parseDate(v);if(date!==null){self.options.datesDisabled.push(self.format(date))}}else if(v instanceof Date&&!isNaN(v.valueOf())){self.options.datesDisabled.push(self.format(v))}}))};Datepicker.prototype.startview=function(view){switch(view){case VIEW_MONTHS:case"months":this.options.startView=1;break;case VIEW_YEARS:case"years":this.options.startView=2;break;default:this.options.startView=0}};Datepicker.prototype.setLocales=function(value){this.locales=value;this.options.inputFormat=[this.locales.short_format];this.options.outputFormat=this.locales.short_format;this.options.titleFormat=this.locales.full_format,this.options.firstDayOfWeek=this.locales.firstday_of_week;this.options.buttonTitle=this.locales.texts.buttonTitle;this.$button.find("span").attr("title",this.options.buttonTitle);this.options.buttonLabel=this.locales.texts.buttonLabel;this.options.prevButtonLabel=this.locales.texts.prevButtonLabel;this.options.prevMonthButtonLabel=this.locales.texts.prevMonthButtonLabel;this.options.prevYearButtonLabel=this.locales.texts.prevYearButtonLabel;this.options.nextButtonLabel=this.locales.texts.nextButtonLabel;this.options.nextMonthButtonLabel=this.locales.texts.nextMonthButtonLabel;this.options.nextYearButtonLabel=this.locales.texts.nextYearButtonLabel;this.options.changeMonthButtonLabel=this.locales.texts.changeMonthButtonLabel;this.options.changeYearButtonLabel=this.locales.texts.changeYearButtonLabel;this.options.changeRangeButtonLabel=this.locales.texts.changeRangeButtonLabel;this.options.closeButtonTitle=this.locales.texts.closeButtonTitle;this.options.closeButtonLabel=this.locales.texts.closeButtonLabel;this.options.calendarHelp=this.locales.texts.calendarHelp;this.drawCalendarHeader();if(this.locales.directionality==="RTL"){this.$grid.addClass("rtl")}else{this.$grid.removeClass("rtl")}};Datepicker.prototype.keyboardUsed=function(){this.$calendar.find(".datepicker-help-text").show()};var old=$.fn.datepicker;$.fn.datepicker=function(option,value){if(typeof option=="string"&&$(this).length==1){var data=$(this).eq(0).data("ab.datepicker");if(data){return data[option](value)}else{var $this=$(this);setTimeout((function(){var data=$this.eq(0).data("ab.datepicker");if(data)return data[option](value)}),0)}}else{return this.each((function(){var $this=$(this);var data=$this.data("ab.datepicker");var options=$.extend({},Datepicker.DEFAULTS,$this.data(),typeof option=="object"&&option);if(!data)$this.data("ab.datepicker",data=new Datepicker(this,options));if(typeof option=="string")data[option](value)}))}};$.fn.datepicker.Constructor=Datepicker;$.fn.datepicker.noConflict=function(){$.fn.datepicker=old;return this}}));
//# sourceMappingURL=datepicker.min.js.map