(function(root,factory){"use strict";if(typeof define==='function'&&define.amd){define(['moment','jquery'],function(moment,jquery){return(root.daterangepicker=factory(moment,jquery));});}else if(typeof module==='object'&&module.exports){var jQuery=(typeof window!='undefined')?window.jQuery:undefined;if(!jQuery){jQuery=require('jquery');if(!jQuery.fn)jQuery.fn={};}
module.exports=factory(require('moment'),jQuery);}else{root.daterangepicker=factory(root.moment,root.jQuery);}}(this,function(moment,$){"use strict";var DateRangePicker=function(element,options,cb){this.parentEl='body';this.element=$(element);this.startDate=moment().startOf('day');this.endDate=moment().endOf('day');this.minDate=false;this.maxDate=false;this.dateLimit=false;this.autoApply=false;this.singleDatePicker=false;this.showDropdowns=false;this.showWeekNumbers=false;this.showISOWeekNumbers=false;this.showCustomRangeLabel=true;this.timePicker=false;this.timePicker24Hour=false;this.timePickerIncrement=1;this.timePickerSeconds=false;this.linkedCalendars=true;this.autoUpdateInput=true;this.alwaysShowCalendars=false;this.ranges={};this.alwaysShow=false;this.showTodayButton=false;this.disabledPast=false;this.dateFormat='YYYY-MM-DD';this.timeFormat='hh:mm a';this.singleDay=false;this.widthCalendar=650;this.widthSingle=300;this.elmDate=false;this.opens='right';if(this.element.hasClass('pull-right'))
this.opens='left';this.drops='down';if(this.element.hasClass('dropup'))
this.drops='up';this.buttonClasses='btn btn-small';this.applyClass='btn-primary ';this.cancelClass='btn-ghost';this.locale={direction:'ltr',format:moment.localeData().longDateFormat('L'),separator:'-',applyLabel:'Apply',cancelLabel:'Cancel',weekLabel:'W',customRangeLabel:'Custom Range',daysOfWeek:moment.weekdaysMin(),monthNames:moment.monthsShort(),firstDay:moment.localeData().firstDayOfWeek(),today:'Today',labelStartTime:''+st_params.start_at_text,labelEndTime:''+st_params.end_at_text,};this.callback=function(){};this.isShowing=false;this.leftCalendar={};this.rightCalendar={};this.enableLoading=false;this.loadingText='
';this.allEvents=[];this.clickedDate=false;this.fetchEvents=null;this.positionFixed=false;this.customClass='';this.sameDate=false;this.sameDateMulti=false;this.minimumCheckin=0;this.responSingle=false;this.onlyShowCurrentMonth=false;if(typeof options!=='object'||options===null)
options={};options=$.extend(this.element.data(),options);if(typeof options.disabledDates=='object'){this.disabledDates=options.disabledDates;}
if(typeof options.showCalendar=='boolean'){this.showCalendar=options.showCalendar;}
if(typeof options.onlyShowCurrentMonth=='boolean'){this.onlyShowCurrentMonth=options.onlyShowCurrentMonth;}
if(typeof options.responSingle=='boolean'){this.responSingle=options.responSingle;}
if(typeof options.alwaysShow=='boolean'){this.alwaysShow=options.alwaysShow;}
if(typeof options.showTodayButton=='boolean'){this.showTodayButton=options.showTodayButton;}
if(typeof options.disabledPast=='boolean'){this.disabledPast=options.disabledPast;}
if(typeof options.enableLoading=='boolean'){this.enableLoading=options.enableLoading;}
if(typeof options.loadingText=='string'){this.loadingText=options.loadingText;}
if(typeof options.allEvents=='object'){this.allEvents=options.allEvents;}
if(typeof options.fetchEvents=='function'){this.fetchEvents=options.fetchEvents;}
if(typeof options.positionFixed=='boolean'){this.positionFixed=options.positionFixed;}
if(typeof options.customClass=='string'){this.customClass=options.customClass;}
if(typeof options.sameDate=='boolean'){this.sameDate=options.sameDate;}
if(typeof options.sameDateMulti=='boolean'){this.sameDateMulti=options.sameDateMulti;}
if(typeof options.dateFormat=='string'){this.dateFormat=options.dateFormat;}
if(typeof options.minimumCheckin=='number'){this.minimumCheckin=options.minimumCheckin;}
if(typeof options.widthSingle=='number'){this.widthSingle=options.widthSingle;}
if(typeof options.widthCalendar=='number'){this.widthCalendar=options.widthCalendar;}
if(typeof options.classNotAvailable=='object'){this.classNotAvailable=options.classNotAvailable;}
if(typeof options.showEventTooltip=='boolean'){this.showEventTooltip=options.showEventTooltip;}
if(typeof options.singleDay=='boolean'){this.singleDay=options.singleDay;}
if(typeof options.template!=='string'&&!(options.template instanceof $)){options.template='';}
this.parentEl=(options.parentEl&&$(options.parentEl).length)?$(options.parentEl):$(this.parentEl);if(this.showCalendar){this.container=$(options.template).appendTo(this.parentEl);}else{this.container=$(options.template).appendTo($('body'));}
if(typeof options.locale==='object'){if(typeof options.locale.direction==='string')
this.locale.direction=options.locale.direction;if(typeof options.locale.separator==='string')
this.locale.separator=options.locale.separator;if(typeof options.locale.daysOfWeek==='object')
this.locale.daysOfWeek=options.locale.daysOfWeek.slice();if(typeof options.locale.monthNames==='object')
this.locale.monthNames=options.locale.monthNames.slice();if(typeof options.locale.firstDay==='string')
this.locale.firstDay=parseInt(options.locale.firstDay);if(typeof options.locale.applyLabel==='string')
this.locale.applyLabel=options.locale.applyLabel;if(typeof options.locale.cancelLabel==='string')
this.locale.cancelLabel=options.locale.cancelLabel;if(typeof options.locale.weekLabel==='string')
this.locale.weekLabel=options.locale.weekLabel;if(typeof options.locale.customRangeLabel==='string')
this.locale.customRangeLabel=options.locale.customRangeLabel;if(typeof options.locale.labelStartTime==='string')
this.locale.labelStartTime=options.locale.labelStartTime;if(typeof options.locale.labelEndTime==='string')
this.locale.labelEndTime=options.locale.labelEndTime;}
this.container.addClass(this.locale.direction);if(typeof options.startDate==='string')
this.startDate=moment(options.startDate,this.locale.format);if(typeof options.endDate==='string')
this.endDate=moment(options.endDate,this.locale.format);if(typeof options.minDate==='string')
this.minDate=moment(options.minDate,this.locale.format);if(typeof options.maxDate==='string')
this.maxDate=moment(options.maxDate,this.locale.format);if(typeof options.startDate==='object')
this.startDate=moment(options.startDate);if(typeof options.endDate==='object')
this.endDate=moment(options.endDate);if(typeof options.minDate==='object')
this.minDate=moment(options.minDate);if(typeof options.maxDate==='object')
this.maxDate=moment(options.maxDate);if(this.minDate&&this.startDate.isBefore(this.minDate))
this.startDate=this.minDate.clone();if(this.maxDate&&this.endDate.isAfter(this.maxDate))
this.endDate=this.maxDate.clone();if(typeof options.applyClass==='string')
this.applyClass=options.applyClass;if(typeof options.cancelClass==='string')
this.cancelClass=options.cancelClass;if(typeof options.dateLimit==='object')
this.dateLimit=options.dateLimit;if(typeof options.opens==='string')
this.opens=options.opens;if(typeof options.drops==='string')
this.drops=options.drops;if(typeof options.showWeekNumbers==='boolean')
this.showWeekNumbers=options.showWeekNumbers;if(typeof options.showISOWeekNumbers==='boolean')
this.showISOWeekNumbers=options.showISOWeekNumbers;if(typeof options.buttonClasses==='string')
this.buttonClasses=options.buttonClasses;if(typeof options.buttonClasses==='object')
this.buttonClasses=options.buttonClasses.join(' ');if(typeof options.showDropdowns==='boolean')
this.showDropdowns=options.showDropdowns;if(typeof options.showCustomRangeLabel==='boolean')
this.showCustomRangeLabel=options.showCustomRangeLabel;if(typeof options.singleDatePicker==='boolean'){this.singleDatePicker=options.singleDatePicker;if(this.singleDatePicker)
this.endDate=this.startDate.clone();}
if(typeof options.timePicker==='boolean')
this.timePicker=options.timePicker;if(typeof options.timePickerSeconds==='boolean')
this.timePickerSeconds=options.timePickerSeconds;if(typeof options.timePickerIncrement==='number')
this.timePickerIncrement=options.timePickerIncrement;if(typeof options.timePicker24Hour==='boolean')
this.timePicker24Hour=options.timePicker24Hour;if(typeof options.autoApply==='boolean')
this.autoApply=options.autoApply;if(typeof options.autoUpdateInput==='boolean')
this.autoUpdateInput=options.autoUpdateInput;if(typeof options.linkedCalendars==='boolean')
this.linkedCalendars=options.linkedCalendars;if(typeof options.isInvalidDate==='function')
this.isInvalidDate=options.isInvalidDate;if(typeof options.isCustomDate==='function')
this.isCustomDate=options.isCustomDate;if(typeof options.alwaysShowCalendars==='boolean')
this.alwaysShowCalendars=options.alwaysShowCalendars;if(this.locale.firstDay!=0){var iterator=this.locale.firstDay;while(iterator>0){this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift());iterator--;}}
this.locale.format=this.dateFormat+' '+this.timeFormat;var start,end,range;if(typeof options.startDate==='undefined'&&typeof options.endDate==='undefined'){if($(this.element).is('input[type=text]')){var val=$(this.element).val(),split=val.split(this.locale.separator);start=end=null;if(split.length==2){start=moment(split[0],this.locale.format);end=moment(split[1],this.locale.format);}else if(this.singleDatePicker&&val!==""){start=moment(val,this.locale.format);end=moment(val,this.locale.format);}
if(start!==null&&end!==null){this.setStartDate(start);this.setEndDate(end);}}}
if(typeof options.ranges==='object'){for(range in options.ranges){if(typeof options.ranges[range][0]==='string')
start=moment(options.ranges[range][0],this.locale.format);else
start=moment(options.ranges[range][0]);if(typeof options.ranges[range][1]==='string')
end=moment(options.ranges[range][1],this.locale.format);else
end=moment(options.ranges[range][1]);if(this.minDate&&start.isBefore(this.minDate))
start=this.minDate.clone();var maxDate=this.maxDate;if(this.dateLimit&&maxDate&&start.clone().add(this.dateLimit).isAfter(maxDate))
maxDate=start.clone().add(this.dateLimit);if(maxDate&&end.isAfter(maxDate))
end=maxDate.clone();if((this.minDate&&end.isBefore(this.minDate,this.timepicker?'minute':'day'))||(maxDate&&start.isAfter(maxDate,this.timepicker?'minute':'day')))
continue;var elem=document.createElement('textarea');elem.innerHTML=range;var rangeHtml=elem.value;this.ranges[rangeHtml]=[start,end];}
var list='';for(range in this.ranges){list+='- '+range+'
';}
if(this.showCustomRangeLabel){list+='- '+this.locale.customRangeLabel+'
';}
list+='
';this.container.find('.ranges').prepend(list);}
if(typeof cb==='function'){this.callback=cb;}
if(!this.timePicker){this.startDate=this.startDate.startOf('day');this.endDate=this.endDate.endOf('day');this.container.find('.calendar-time').hide();}
if(this.timePicker&&this.autoApply)
this.autoApply=false;if(this.autoApply&&typeof options.ranges!=='object'){this.container.find('.ranges').hide();}else if(this.autoApply){this.container.find('.applyBtn, .cancelBtn').addClass('hide');}
if(this.singleDatePicker){this.container.addClass('single');this.container.find('.calendar.left').addClass('single');this.container.find('.calendar.left').show();this.container.find('.calendar.right').hide();this.container.find('.daterangepicker_input input, .daterangepicker_input > i').hide();if(this.timePicker){this.container.find('.ranges ul').hide();}else{this.container.find('.ranges').hide();}}
this.container.find('.input-mini').hide();if((typeof options.ranges==='undefined'&&!this.singleDatePicker)||this.alwaysShowCalendars){this.container.addClass('show-calendar');}
this.container.addClass('opens'+this.opens);if(typeof options.ranges!=='undefined'&&this.opens=='right'){this.container.find('.ranges').prependTo(this.container.find('.calendar.left').parent());}
this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses);if(this.applyClass.length)
this.container.find('.applyBtn').addClass(this.applyClass);if(this.cancelClass.length)
this.container.find('.cancelBtn').addClass(this.cancelClass);this.container.find('.applyBtn').html(this.locale.applyLabel);this.container.find('.cancelBtn').html(this.locale.cancelLabel);this.container.find('.calendar').on('click.daterangepicker','.prev',$.proxy(this.clickPrev,this)).on('click.daterangepicker','.next',$.proxy(this.clickNext,this)).on('click.daterangepicker','.btn-today',$.proxy(this.clickToday,this)).on('mousedown.daterangepicker','td.available .date',$.proxy(this.clickDate,this)).on('mouseenter.daterangepicker','td.available .date',$.proxy(this.hoverDate,this)).on('mouseleave.daterangepicker','td.available .date',$.proxy(this.updateFormInputs,this)).on('change.daterangepicker','select.yearselect',$.proxy(this.monthOrYearChanged,this)).on('change.daterangepicker','select.monthselect',$.proxy(this.monthOrYearChanged,this)).on('click.daterangepicker','.daterangepicker_input input',$.proxy(this.showCalendars,this)).on('focus.daterangepicker','.daterangepicker_input input',$.proxy(this.formInputsFocused,this)).on('blur.daterangepicker','.daterangepicker_input input',$.proxy(this.formInputsBlurred,this)).on('change.daterangepicker','.daterangepicker_input input',$.proxy(this.formInputsChanged,this));this.container.find('.calendar-time').on('change.daterangepicker','select.hourselect,select.minuteselect,select.secondselect,select.ampmselect',$.proxy(this.timeChanged,this));this.container.find('.ranges').on('click.daterangepicker','button.applyBtn',$.proxy(this.clickApply,this)).on('click.daterangepicker','button.cancelBtn',$.proxy(this.clickCancel,this)).on('click.daterangepicker','li',$.proxy(this.clickRange,this)).on('mouseenter.daterangepicker','li',$.proxy(this.hoverRange,this)).on('mouseleave.daterangepicker','li',$.proxy(this.updateFormInputs,this));if(this.element.is('input')||this.element.is('button')){this.element.on({'click.daterangepicker':$.proxy(this.show,this),'focus.daterangepicker':$.proxy(this.show,this),'keyup.daterangepicker':$.proxy(this.elementChanged,this),'keydown.daterangepicker':$.proxy(this.keydown,this)});}else{this.element.on('click.daterangepicker',$.proxy(this.toggle,this));this.element.on('keydown.daterangepicker',$.proxy(this.toggle,this));}
if(this.element.is('input')&&!this.singleDatePicker&&this.autoUpdateInput){this.element.val(this.startDate.format(this.locale.format)+this.locale.separator+this.endDate.format(this.locale.format));this.element.trigger('change');}else if(this.element.is('input')&&this.autoUpdateInput){this.element.val(this.startDate.format(this.locale.format));this.element.trigger('change');}};DateRangePicker.prototype={constructor:DateRangePicker,setStartDate:function(startDate){if(typeof startDate==='string')
this.startDate=moment(startDate,this.locale.format);if(typeof startDate==='object')
this.startDate=moment(startDate);if(!this.timePicker)
this.startDate=this.startDate.startOf('day');if(this.timePicker&&this.timePickerIncrement)
this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement);if(this.minDate&&this.startDate.isBefore(this.minDate)){this.startDate=this.minDate.clone();if(this.timePicker&&this.timePickerIncrement)
this.startDate.minute(Math.round(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement);}
if(this.maxDate&&this.startDate.isAfter(this.maxDate)){this.startDate=this.maxDate.clone();if(this.timePicker&&this.timePickerIncrement)
this.startDate.minute(Math.floor(this.startDate.minute()/this.timePickerIncrement)*this.timePickerIncrement);}
if(!this.isShowing)
this.updateElement();this.updateMonthsInView();},setEndDate:function(endDate){if(typeof endDate==='string')
this.endDate=moment(endDate,this.locale.format);if(typeof endDate==='object')
this.endDate=moment(endDate);if(!this.timePicker)
this.endDate=this.endDate.endOf('day');if(this.timePicker&&this.timePickerIncrement)
this.endDate.minute(Math.round(this.endDate.minute()/this.timePickerIncrement)*this.timePickerIncrement);if(this.endDate.isBefore(this.startDate))
this.endDate=this.startDate.clone();if(this.maxDate&&this.endDate.isAfter(this.maxDate))
this.endDate=this.maxDate.clone();if(this.dateLimit&&this.startDate.clone().add(this.dateLimit).isBefore(this.endDate))
this.endDate=this.startDate.clone().add(this.dateLimit);this.previousRightTime=this.endDate.clone();if(!this.isShowing)
this.updateElement();this.updateMonthsInView();},isInvalidDate:function(){return false;},isCustomDate:function(){return false;},updateView:function(){if(this.timePicker){this.renderTimePicker('left');this.renderTimePicker('right');if(!this.endDate){this.container.find('.calendar-time.right select').attr('disabled','disabled').addClass('disabled');}else{this.container.find('.calendar-time.right select').removeAttr('disabled').removeClass('disabled');}}
if(this.endDate){this.container.find('input[name="daterangepicker_end"]').removeClass('active');this.container.find('input[name="daterangepicker_start"]').addClass('active');}else{this.container.find('input[name="daterangepicker_end"]').addClass('active');this.container.find('input[name="daterangepicker_start"]').removeClass('active');}
this.updateMonthsInView();this.updateCalendars();this.updateFormInputs();},updateMonthsInView:function(){if(this.endDate){if(!this.singleDatePicker&&this.leftCalendar.month&&this.rightCalendar.month&&(this.startDate.format('YYYY-MM')==this.leftCalendar.month.format('YYYY-MM')||this.startDate.format('YYYY-MM')==this.rightCalendar.month.format('YYYY-MM'))&&(this.endDate.format('YYYY-MM')==this.leftCalendar.month.format('YYYY-MM')||this.endDate.format('YYYY-MM')==this.rightCalendar.month.format('YYYY-MM'))){return;}
this.leftCalendar.month=this.startDate.clone().date(2);if(!this.linkedCalendars&&(this.endDate.month()!=this.startDate.month()||this.endDate.year()!=this.startDate.year())){this.rightCalendar.month=this.endDate.clone().date(2);}else{this.rightCalendar.month=this.startDate.clone().date(2).add(1,'month');}}else{if(this.leftCalendar.month.format('YYYY-MM')!=this.startDate.format('YYYY-MM')&&this.rightCalendar.month.format('YYYY-MM')!=this.startDate.format('YYYY-MM')){this.leftCalendar.month=this.startDate.clone().date(2);this.rightCalendar.month=this.startDate.clone().date(2).add(1,'month');}}
if(this.maxDate&&this.linkedCalendars&&!this.singleDatePicker&&this.rightCalendar.month>this.maxDate){this.rightCalendar.month=this.maxDate.clone().date(2);this.leftCalendar.month=this.maxDate.clone().date(2).subtract(1,'month');}},updateCalendars:function(){if(this.timePicker){var hour,minute,second;if(this.endDate){hour=parseInt(this.container.find('.left .hourselect').val(),10);minute=parseInt(this.container.find('.left .minuteselect').val(),10);if(isNaN(minute)){minute=parseInt(this.container.find('.left .minuteselect option:last').val(),10);}
second=this.timePickerSeconds?parseInt(this.container.find('.left .secondselect').val(),10):0;if(!this.timePicker24Hour){var ampm=this.container.find('.left .ampmselect').val();if(ampm==='PM'&&hour<12)
hour+=12;if(ampm==='AM'&&hour===12)
hour=0;}}else{hour=parseInt(this.container.find('.right .hourselect').val(),10);minute=parseInt(this.container.find('.right .minuteselect').val(),10);if(isNaN(minute)){minute=parseInt(this.container.find('.right .minuteselect option:last').val(),10);}
second=this.timePickerSeconds?parseInt(this.container.find('.right .secondselect').val(),10):0;if(!this.timePicker24Hour){var ampm=this.container.find('.right .ampmselect').val();if(ampm==='PM'&&hour<12)
hour+=12;if(ampm==='AM'&&hour===12)
hour=0;}}
this.leftCalendar.month.hour(hour).minute(minute).second(second);this.rightCalendar.month.hour(hour).minute(minute).second(second);}
this.createCalendarData('left');if(this.clickedDate){this.renderCalendar('left');if(!this.singleDatePicker){this.createCalendarData('right');this.renderCalendar('right');}
this.clickedDate=false;}else{if(typeof this.fetchEvents=='function'&&this.setEvents){if(!this.singleDatePicker){this.createCalendarData('right');}
if(this.singleDatePicker){this.fetchEvents(this.leftCalendar.calendar[0][0],this.leftCalendar.calendar[5][6],this,this.setEvents);}else{this.fetchEvents(this.leftCalendar.calendar[0][0],this.rightCalendar.calendar[5][6],this,this.setEvents);}}else{this.renderCalendar('left');if(!this.singleDatePicker){this.renderCalendar('right');}}}
this.container.find('.ranges li').removeClass('active');if(this.endDate==null)return;this.calculateChosenLabel();},createCalendarData:function(side){var calendar=side=='left'?this.leftCalendar:this.rightCalendar;var month=calendar.month.month();var year=calendar.month.year();var hour=calendar.month.hour();var minute=calendar.month.minute();var second=calendar.month.second();var daysInMonth=moment([year,month]).daysInMonth();var firstDay=moment([year,month,1]);var lastDay=moment([year,month,daysInMonth]);var lastMonth=moment(firstDay).subtract(1,'month').month();var lastYear=moment(firstDay).subtract(1,'month').year();var daysInLastMonth=moment([lastYear,lastMonth]).daysInMonth();var dayOfWeek=firstDay.day();var calendar=[];calendar.firstDay=firstDay;calendar.lastDay=lastDay;for(var i=0;i<6;i++){calendar[i]=[];}
var startDay=daysInLastMonth-dayOfWeek+this.locale.firstDay+1;if(startDay>daysInLastMonth)
startDay-=7;if(dayOfWeek==this.locale.firstDay)
startDay=daysInLastMonth-6;var curDate=moment([lastYear,lastMonth,startDay,12,minute,second]);var col,row;for(var i=0,col=0,row=0;i<42;i++,col++,curDate=moment(curDate).add(24,'hour')){if(i>0&&col%7===0){col=0;row++;}
calendar[row][col]=curDate.clone().hour(hour).minute(minute).second(second);curDate.hour(12);if(this.minDate&&calendar[row][col].format('YYYY-MM-DD')==this.minDate.format('YYYY-MM-DD')&&calendar[row][col].isBefore(this.minDate)&&side=='left'){calendar[row][col]=this.minDate.clone();}
if(this.maxDate&&calendar[row][col].format('YYYY-MM-DD')==this.maxDate.format('YYYY-MM-DD')&&calendar[row][col].isAfter(this.maxDate)&&side=='right'){calendar[row][col]=this.maxDate.clone();}}
if(side=='left'){this.leftCalendar.calendar=calendar;}else{if(side=='right'&&!this.singleDatePicker){this.rightCalendar.calendar=calendar;}}},setEvents:function(events,el){el.allEvents=events;el.renderCalendar('left');if(!el.singleDatePicker){el.renderCalendar('right');}},renderCalendar:function(side){this.createCalendarData(side);var calendar={};if(side=='left'){calendar=this.leftCalendar.calendar;}else{calendar=this.rightCalendar.calendar;}
var minDate=side=='left'?this.minDate:this.startDate;var maxDate=this.maxDate;var selected=side=='left'?this.startDate:this.endDate;var arrow=this.locale.direction=='ltr'?{left:'chevron-left',right:'chevron-right'}:{left:'chevron-right',right:'chevron-left'};var dateHtml='';var currentMonth=calendar[1][1].month();if(this.showDropdowns){var currentYear=calendar[1][1].year();var maxYear=(maxDate&&maxDate.year())||(currentYear+5);var minYear=(minDate&&minDate.year())||(currentYear-50);var inMinYear=currentYear==minYear;var inMaxYear=currentYear==maxYear;var monthHtml='";var yearHtml='';dateHtml='';}
var html='';html+='';html+='';html+='';html+='';if(this.endDate==null&&this.dateLimit){var maxLimit=this.startDate.clone().add(this.dateLimit).endOf('day');if(!maxDate||maxLimit.isBefore(maxDate)){maxDate=maxLimit;}}
for(var row=0;row<6;row++){html+='';if(this.showWeekNumbers)
html+='| '+calendar[row][0].week()+' | ';else if(this.showISOWeekNumbers)
html+=''+calendar[row][0].isoWeek()+' | ';for(var col=0;col<7;col++){var classes=[];if(calendar[row][col].isSame(new Date(),"day"))
classes.push('today');if(this.minimumCheckin>0){for(var _i=0;_i5)
classes.push('weekend');if(calendar[row][col].month()!=calendar[1][1].month())
classes.push('off not-show');if(this.minDate&&calendar[row][col].isBefore(this.minDate,'day'))
classes.push('off','disabled in-past');if(maxDate&&calendar[row][col].isAfter(maxDate,'day'))
classes.push('off','disabled');if(this.isInvalidDate(calendar[row][col]))
classes.push('off','disabled');if(calendar[row][col].format('YYYY-MM-DD')==this.startDate.format('YYYY-MM-DD'))
classes.push('active','start-date');if(this.endDate!=null&&calendar[row][col].format('YYYY-MM-DD')==this.endDate.format('YYYY-MM-DD'))
classes.push('active','end-date');if(this.endDate!=null&&calendar[row][col]>this.startDate&&calendar[row][col]'+this.allEvents[i].event+'
';if(typeof this.allEvents[i].has_starttime!=='undefined'){if(this.allEvents[i].has_starttime){has_starttime=' has_starttime ';}}}else{event_html=''+this.allEvents[i].event+'
';}
if(typeof this.allEvents[i].status=='string'&&this.allEvents[i].status=='not_available'){if(typeof this.classNotAvailable=='object'){$.each(this.classNotAvailable,function(index,val){classes.push(val);});}else{classes.push('not-available');}}else{if(in_pass){classes.push('not-available');}}
break;}}
var isCustom=this.isCustomDate(calendar[row][col]);if(isCustom!==false){if(typeof isCustom==='string')
classes.push(isCustom);else
Array.prototype.push.apply(classes,isCustom);}
var cname='',disabled=false;for(var i=0;i'+''+event_html+'';}else{html+=''+' '+calendar[row][col].date()+' '+event_html+' | ';}}
html+='
';}
html+='';html+='
';if(this.showTodayButton&&side=='left'){html+=''+this.locale.today+'';}
if(side=='left'){this.container.find('.calendar.left .calendar-table').html(html);}
if(!this.singleDatePicker&&side=='right'){this.container.find('.calendar.right .calendar-table').html(html);}},renderTimePicker:function(side){if(side=='right'&&!this.endDate)return;var html,selected,minDate,maxDate=this.maxDate;if(this.dateLimit&&(!this.maxDate||this.startDate.clone().add(this.dateLimit).isAfter(this.maxDate)))
maxDate=this.startDate.clone().add(this.dateLimit);if(side=='left'){selected=this.startDate.clone();minDate=this.minDate;var timeSelector=this.container.find('.calendar-time.left');if(timeSelector.html()!=''){selected.hour(!isNaN(selected.hour())?selected.hour():timeSelector.find('.hourselect option:selected').val());selected.minute(!isNaN(selected.minute())?selected.minute():timeSelector.find('.minuteselect option:selected').val());selected.second(!isNaN(selected.second())?selected.second():timeSelector.find('.secondselect option:selected').val());if(!this.timePicker24Hour){var ampm=timeSelector.find('.ampmselect option:selected').val();if(ampm==='PM'&&selected.hour()<12)
selected.hour(selected.hour()+12);if(ampm==='AM'&&selected.hour()===12)
selected.hour(0);}}}else if(side=='right'){selected=this.endDate.clone();minDate=this.startDate;var timeSelector=this.container.find('.calendar-time.right div');var currentTime=timeSelector.find('.timepicker option:selected').val();if(!this.endDate&&timeSelector.html()!=''){var timeSelector=this.container.find('.calendar.right .calendar-time');if(timeSelector.html()!=''){selected.hour(!isNaN(selected.hour())?selected.hour():timeSelector.find('.hourselect option:selected').val());selected.minute(!isNaN(selected.minute())?selected.minute():timeSelector.find('.minuteselect option:selected').val());selected.second(!isNaN(selected.second())?selected.second():timeSelector.find('.secondselect option:selected').val());if(!this.timePicker24Hour){var ampm=timeSelector.find('.ampmselect option:selected').val();if(ampm==='PM'&&selected.hour()<12)
selected.hour(selected.hour()+12);if(ampm==='AM'&&selected.hour()===12)
selected.hour(0);}}
if(selected.isBefore(this.startDate))
selected=this.startDate.clone();if(maxDate&&selected.isAfter(maxDate))
selected=maxDate.clone();}}
if(side==='left'){html='