!function(t,e){function a(){return new Date(Date.UTC.apply(Date,arguments))}function i(){var t=new Date;return a(t.getFullYear(),t.getMonth(),t.getDate())}function s(t,e){return t.getUTCFullYear()===e.getUTCFullYear()&&t.getUTCMonth()===e.getUTCMonth()&&t.getUTCDate()===e.getUTCDate()}function n(t){return function(){return this[t].apply(this,arguments)}}function r(e,a){function i(t,e){return e.toLowerCase()}var s,n=t(e).data(),r={},o=new RegExp("^"+a.toLowerCase()+"([A-Z])");a=new RegExp("^"+a.toLowerCase());for(var h in n)a.test(h)&&(s=h.replace(o,i),r[s]=n[h]);return r}function o(e){var a={};if(g[e]||(e=e.split("-")[0],g[e])){var i=g[e];return t.each(f,function(t,e){e in i&&(a[e]=i[e])}),a}}var h=function(){var e={get:function(t){return this.slice(t)[0]},contains:function(t){for(var e=t&&t.valueOf(),a=0,i=this.length;i>a;a++)if(this[a].valueOf()===e)return a;return-1},remove:function(t){this.splice(t,1)},replace:function(e){e&&(t.isArray(e)||(e=[e]),this.clear(),this.push.apply(this,e))},clear:function(){this.length=0},copy:function(){var t=new h;return t.replace(this),t}};return function(){var a=[];return a.push.apply(a,arguments),t.extend(a,e),a}}(),l=function(e,a){this._process_options(a),this.dates=new h,this.viewDate=this.o.defaultViewDate,this.focusDate=null,this.element=t(e),this.isInline=!1,this.isInput=this.element.is("input"),this.component=this.element.hasClass("date")?this.element.find(".add-on, .input-group-addon, .btn"):!1,this.hasInput=this.component&&this.element.find("input").length,this.component&&0===this.component.length&&(this.component=!1),this.picker=t(D.template),this._buildEvents(),this._attachEvents(),this.isInline?this.picker.addClass("datepicker-inline").appendTo(this.element):this.picker.addClass("datepicker-dropdown dropdown-menu"),this.o.rtl&&this.picker.addClass("datepicker-rtl"),this.viewMode=this.o.startView,this.o.calendarWeeks&&this.picker.find("tfoot .today, tfoot .clear").attr("colspan",function(t,e){return parseInt(e)+1}),this._allow_update=!1,this.setStartDate(this._o.startDate),this.setEndDate(this._o.endDate),this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled),this.setDatesDisabled(this.o.datesDisabled),this.fillDow(),this.fillMonths(),this._allow_update=!0,this.update(),this.showMode(),this.isInline&&this.show()};l.prototype={constructor:l,_process_options:function(s){this._o=t.extend({},this._o,s);var n=this.o=t.extend({},this._o),r=n.language;switch(g[r]||(r=r.split("-")[0],g[r]||(r=p.language)),n.language=r,n.startView){case 2:case"decade":n.startView=2;break;case 1:case"year":n.startView=1;break;default:n.startView=0}switch(n.minViewMode){case 1:case"months":n.minViewMode=1;break;case 2:case"years":n.minViewMode=2;break;default:n.minViewMode=0}n.startView=Math.max(n.startView,n.minViewMode),n.multidate!==!0&&(n.multidate=Number(n.multidate)||!1,n.multidate!==!1&&(n.multidate=Math.max(0,n.multidate))),n.multidateSeparator=String(n.multidateSeparator),n.weekStart%=7,n.weekEnd=(n.weekStart+6)%7;var o=D.parseFormat(n.format);if(n.startDate!==-1/0&&(n.startDate=n.startDate?n.startDate instanceof Date?this._local_to_utc(this._zero_time(n.startDate)):D.parseDate(n.startDate,o,n.language):-1/0),1/0!==n.endDate&&(n.endDate=n.endDate?n.endDate instanceof Date?this._local_to_utc(this._zero_time(n.endDate)):D.parseDate(n.endDate,o,n.language):1/0),n.daysOfWeekDisabled=n.daysOfWeekDisabled||[],t.isArray(n.daysOfWeekDisabled)||(n.daysOfWeekDisabled=n.daysOfWeekDisabled.split(/[,\s]*/)),n.daysOfWeekDisabled=t.map(n.daysOfWeekDisabled,function(t){return parseInt(t,10)}),n.datesDisabled=n.datesDisabled||[],!t.isArray(n.datesDisabled)){var h=[];h.push(D.parseDate(n.datesDisabled,o,n.language)),n.datesDisabled=h}n.datesDisabled=t.map(n.datesDisabled,function(t){return D.parseDate(t,o,n.language)});var l=String(n.orientation).toLowerCase().split(/\s+/g),d=n.orientation.toLowerCase();if(l=t.grep(l,function(t){return/^auto|left|right|top|bottom$/.test(t)}),n.orientation={x:"auto",y:"auto"},d&&"auto"!==d)if(1===l.length)switch(l[0]){case"top":case"bottom":n.orientation.y=l[0];break;case"left":case"right":n.orientation.x=l[0]}else d=t.grep(l,function(t){return/^left|right$/.test(t)}),n.orientation.x=d[0]||"auto",d=t.grep(l,function(t){return/^top|bottom$/.test(t)}),n.orientation.y=d[0]||"auto";else;if(n.defaultViewDate){var c=n.defaultViewDate.year||(new Date).getFullYear(),u=n.defaultViewDate.month||0,f=n.defaultViewDate.day||1;n.defaultViewDate=a(c,u,f)}else n.defaultViewDate=i();n.showOnFocus=n.showOnFocus!==e?n.showOnFocus:!0},_events:[],_secondaryEvents:[],_applyEvents:function(t){for(var a,i,s,n=0;n<t.length;n++)a=t[n][0],2===t[n].length?(i=e,s=t[n][1]):3===t[n].length&&(i=t[n][1],s=t[n][2]),a.on(s,i)},_unapplyEvents:function(t){for(var a,i,s,n=0;n<t.length;n++)a=t[n][0],2===t[n].length?(s=e,i=t[n][1]):3===t[n].length&&(s=t[n][1],i=t[n][2]),a.off(i,s)},_buildEvents:function(){var e={keyup:t.proxy(function(e){-1===t.inArray(e.keyCode,[27,37,39,38,40,32,13,9])&&this.update()},this),keydown:t.proxy(this.keydown,this)};this.o.showOnFocus===!0&&(e.focus=t.proxy(this.show,this)),this.isInput?this._events=[[this.element,e]]:this.component&&this.hasInput?this._events=[[this.element.find("input"),e],[this.component,{click:t.proxy(this.show,this)}]]:this.element.is("div")?this.isInline=!0:this._events=[[this.element,{click:t.proxy(this.show,this)}]],this._events.push([this.element,"*",{blur:t.proxy(function(t){this._focused_from=t.target},this)}],[this.element,{blur:t.proxy(function(t){this._focused_from=t.target},this)}]),this._secondaryEvents=[[this.picker,{click:t.proxy(this.click,this)}],[t(window),{resize:t.proxy(this.place,this)}],[t(document),{"mousedown touchstart":t.proxy(function(t){this.element.is(t.target)||this.element.find(t.target).length||this.picker.is(t.target)||this.picker.find(t.target).length||this.hide()},this)}]]},_attachEvents:function(){this._detachEvents(),this._applyEvents(this._events)},_detachEvents:function(){this._unapplyEvents(this._events)},_attachSecondaryEvents:function(){this._detachSecondaryEvents(),this._applyEvents(this._secondaryEvents)},_detachSecondaryEvents:function(){this._unapplyEvents(this._secondaryEvents)},_trigger:function(e,a){var i=a||this.dates.get(-1),s=this._utc_to_local(i);this.element.trigger({type:e,date:s,dates:t.map(this.dates,this._utc_to_local),format:t.proxy(function(t,e){0===arguments.length?(t=this.dates.length-1,e=this.o.format):"string"==typeof t&&(e=t,t=this.dates.length-1),e=e||this.o.format;var a=this.dates.get(t);return D.formatDate(a,e,this.o.language)},this)})},show:function(){return this.element.attr("readonly")&&this.o.enableOnReadonly===!1?void 0:(this.isInline||this.picker.appendTo(this.o.container),this.place(),this.picker.show(),this._attachSecondaryEvents(),this._trigger("show"),(window.navigator.msMaxTouchPoints||"ontouchstart"in document)&&this.o.disableTouchKeyboard&&t(this.element).blur(),this)},hide:function(){return this.isInline?this:this.picker.is(":visible")?(this.focusDate=null,this.picker.hide().detach(),this._detachSecondaryEvents(),this.viewMode=this.o.startView,this.showMode(),this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())&&this.setValue(),this._trigger("hide"),this):this},remove:function(){return this.hide(),this._detachEvents(),this._detachSecondaryEvents(),this.picker.remove(),delete this.element.data().datepicker,this.isInput||delete this.element.data().date,this},_utc_to_local:function(t){return t&&new Date(t.getTime()+6e4*t.getTimezoneOffset())},_local_to_utc:function(t){return t&&new Date(t.getTime()-6e4*t.getTimezoneOffset())},_zero_time:function(t){return t&&new Date(t.getFullYear(),t.getMonth(),t.getDate())},_zero_utc_time:function(t){return t&&new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()))},getDates:function(){return t.map(this.dates,this._utc_to_local)},getUTCDates:function(){return t.map(this.dates,function(t){return new Date(t)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){var t=this.dates.get(-1);return"undefined"!=typeof t?new Date(t):null},clearDates:function(){var t;this.isInput?t=this.element:this.component&&(t=this.element.find("input")),t&&t.val("").change(),this.update(),this._trigger("changeDate"),this.o.autoclose&&this.hide()},setDates:function(){var e=t.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,e),this._trigger("changeDate"),this.setValue(),this},setUTCDates:function(){var e=t.isArray(arguments[0])?arguments[0]:arguments;return this.update.apply(this,t.map(e,this._utc_to_local)),this._trigger("changeDate"),this.setValue(),this},setDate:n("setDates"),setUTCDate:n("setUTCDates"),setValue:function(){var t=this.getFormattedDate();return this.isInput?this.element.val(t).change():this.component&&this.element.find("input").val(t).change(),this},getFormattedDate:function(a){a===e&&(a=this.o.format);var i=this.o.language;return t.map(this.dates,function(t){return D.formatDate(t,a,i)}).join(this.o.multidateSeparator)},setStartDate:function(t){return this._process_options({startDate:t}),this.update(),this.updateNavArrows(),this},setEndDate:function(t){return this._process_options({endDate:t}),this.update(),this.updateNavArrows(),this},setDaysOfWeekDisabled:function(t){return this._process_options({daysOfWeekDisabled:t}),this.update(),this.updateNavArrows(),this},setDatesDisabled:function(t){this._process_options({datesDisabled:t}),this.update(),this.updateNavArrows()},place:function(){if(this.isInline)return this;var e=this.picker.outerWidth(),a=this.picker.outerHeight(),i=10,s=t(this.o.container).width(),n=t(this.o.container).height(),r=t(this.o.container).scrollTop(),o=t(this.o.container).offset(),h=[];this.element.parents().each(function(){var e=t(this).css("z-index");"auto"!==e&&0!==e&&h.push(parseInt(e))});var l=Math.max.apply(Math,h)+10,d=this.component?this.component.parent().offset():this.element.offset(),c=this.component?this.component.outerHeight(!0):this.element.outerHeight(!1),u=this.component?this.component.outerWidth(!0):this.element.outerWidth(!1),p=d.left-o.left,f=d.top-o.top;this.picker.removeClass("datepicker-orient-top datepicker-orient-bottom datepicker-orient-right datepicker-orient-left"),"auto"!==this.o.orientation.x?(this.picker.addClass("datepicker-orient-"+this.o.orientation.x),"right"===this.o.orientation.x&&(p-=e-u)):d.left<0?(this.picker.addClass("datepicker-orient-left"),p-=d.left-i):p+e>s?(this.picker.addClass("datepicker-orient-right"),p=d.left+u-e):this.picker.addClass("datepicker-orient-left");var g,D,v=this.o.orientation.y;if("auto"===v&&(g=-r+f-a,D=r+n-(f+c+a),v=Math.max(g,D)===D?"top":"bottom"),this.picker.addClass("datepicker-orient-"+v),"top"===v?f+=c:f-=a+parseInt(this.picker.css("padding-top")),this.o.rtl){var m=s-(p+u);this.picker.css({top:f,right:m,zIndex:l})}else this.picker.css({top:f,left:p,zIndex:l});return this},_allow_update:!0,update:function(){if(!this._allow_update)return this;var e=this.dates.copy(),a=[],i=!1;return arguments.length?(t.each(arguments,t.proxy(function(t,e){e instanceof Date&&(e=this._local_to_utc(e)),a.push(e)},this)),i=!0):(a=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val(),a=a&&this.o.multidate?a.split(this.o.multidateSeparator):[a],delete this.element.data().date),a=t.map(a,t.proxy(function(t){return D.parseDate(t,this.o.format,this.o.language)},this)),a=t.grep(a,t.proxy(function(t){return t<this.o.startDate||t>this.o.endDate||!t},this),!0),this.dates.replace(a),this.dates.length?this.viewDate=new Date(this.dates.get(-1)):this.viewDate<this.o.startDate?this.viewDate=new Date(this.o.startDate):this.viewDate>this.o.endDate&&(this.viewDate=new Date(this.o.endDate)),i?this.setValue():a.length&&String(e)!==String(this.dates)&&this._trigger("changeDate"),!this.dates.length&&e.length&&this._trigger("clearDate"),this.fill(),this},fillDow:function(){var t=this.o.weekStart,e="<tr>";if(this.o.calendarWeeks){this.picker.find(".datepicker-days thead tr:first-child .datepicker-switch").attr("colspan",function(t,e){return parseInt(e)+1});var a='<th class="cw">&#160;</th>';e+=a}for(;t<this.o.weekStart+7;)e+='<th class="dow">'+g[this.o.language].daysMin[t++%7]+"</th>";e+="</tr>",this.picker.find(".datepicker-days thead").append(e)},fillMonths:function(){for(var t="",e=0;12>e;)t+='<span class="month">'+g[this.o.language].monthsShort[e++]+"</span>";this.picker.find(".datepicker-months td").html(t)},setRange:function(e){e&&e.length?this.range=t.map(e,function(t){return t.valueOf()}):delete this.range,this.fill()},getClassNames:function(e){var a=[],i=this.viewDate.getUTCFullYear(),n=this.viewDate.getUTCMonth(),r=new Date;return e.getUTCFullYear()<i||e.getUTCFullYear()===i&&e.getUTCMonth()<n?a.push("old"):(e.getUTCFullYear()>i||e.getUTCFullYear()===i&&e.getUTCMonth()>n)&&a.push("new"),this.focusDate&&e.valueOf()===this.focusDate.valueOf()&&a.push("focused"),this.o.todayHighlight&&e.getUTCFullYear()===r.getFullYear()&&e.getUTCMonth()===r.getMonth()&&e.getUTCDate()===r.getDate()&&a.push("today"),-1!==this.dates.contains(e)&&a.push("active"),(e.valueOf()<this.o.startDate||e.valueOf()>this.o.endDate||-1!==t.inArray(e.getUTCDay(),this.o.daysOfWeekDisabled))&&a.push("disabled"),this.o.datesDisabled.length>0&&t.grep(this.o.datesDisabled,function(t){return s(e,t)}).length>0&&a.push("disabled","disabled-date"),this.range&&(e>this.range[0]&&e<this.range[this.range.length-1]&&a.push("range"),-1!==t.inArray(e.valueOf(),this.range)&&a.push("selected")),a},fill:function(){var i,s=new Date(this.viewDate),n=s.getUTCFullYear(),r=s.getUTCMonth(),o=this.o.startDate!==-1/0?this.o.startDate.getUTCFullYear():-1/0,h=this.o.startDate!==-1/0?this.o.startDate.getUTCMonth():-1/0,l=1/0!==this.o.endDate?this.o.endDate.getUTCFullYear():1/0,d=1/0!==this.o.endDate?this.o.endDate.getUTCMonth():1/0,c=g[this.o.language].today||g.en.today||"",u=g[this.o.language].clear||g.en.clear||"";if(!isNaN(n)&&!isNaN(r)){this.picker.find(".datepicker-days thead .datepicker-switch").text(g[this.o.language].months[r]+" "+n),this.picker.find("tfoot .today").text(c).toggle(this.o.todayBtn!==!1),this.picker.find("tfoot .clear").text(u).toggle(this.o.clearBtn!==!1),this.updateNavArrows(),this.fillMonths();var p=a(n,r-1,28),f=D.getDaysInMonth(p.getUTCFullYear(),p.getUTCMonth());p.setUTCDate(f),p.setUTCDate(f-(p.getUTCDay()-this.o.weekStart+7)%7);var v=new Date(p);v.setUTCDate(v.getUTCDate()+42),v=v.valueOf();for(var m,y=[];p.valueOf()<v;){if(p.getUTCDay()===this.o.weekStart&&(y.push("<tr>"),this.o.calendarWeeks)){var w=new Date(+p+(this.o.weekStart-p.getUTCDay()-7)%7*864e5),k=new Date(Number(w)+(11-w.getUTCDay())%7*864e5),C=new Date(Number(C=a(k.getUTCFullYear(),0,1))+(11-C.getUTCDay())%7*864e5),T=(k-C)/864e5/7+1;y.push('<td class="cw">'+T+"</td>")}if(m=this.getClassNames(p),m.push("day"),this.o.beforeShowDay!==t.noop){var b=this.o.beforeShowDay(this._utc_to_local(p));b===e?b={}:"boolean"==typeof b?b={enabled:b}:"string"==typeof b&&(b={classes:b}),b.enabled===!1&&m.push("disabled"),b.classes&&(m=m.concat(b.classes.split(/\s+/))),b.tooltip&&(i=b.tooltip)}m=t.unique(m),y.push('<td class="'+m.join(" ")+'"'+(i?' title="'+i+'"':"")+">"+p.getUTCDate()+"</td>"),i=null,p.getUTCDay()===this.o.weekEnd&&y.push("</tr>"),p.setUTCDate(p.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(y.join(""));var _=this.picker.find(".datepicker-months").find("th:eq(1)").text(n).end().find("span").removeClass("active");if(t.each(this.dates,function(t,e){e.getUTCFullYear()===n&&_.eq(e.getUTCMonth()).addClass("active")}),(o>n||n>l)&&_.addClass("disabled"),n===o&&_.slice(0,h).addClass("disabled"),n===l&&_.slice(d+1).addClass("disabled"),this.o.beforeShowMonth!==t.noop){var U=this;t.each(_,function(e,a){if(!t(a).hasClass("disabled")){var i=new Date(n,e,1),s=U.o.beforeShowMonth(i);s===!1&&t(a).addClass("disabled")}})}y="",n=10*parseInt(n/10,10);var M=this.picker.find(".datepicker-years").find("th:eq(1)").text(n+"-"+(n+9)).end().find("td");n-=1;for(var F,S=t.map(this.dates,function(t){return t.getUTCFullYear()}),x=-1;11>x;x++)F=["year"],-1===x?F.push("old"):10===x&&F.push("new"),-1!==t.inArray(n,S)&&F.push("active"),(o>n||n>l)&&F.push("disabled"),y+='<span class="'+F.join(" ")+'">'+n+"</span>",n+=1;M.html(y)}},updateNavArrows:function(){if(this._allow_update){var t=new Date(this.viewDate),e=t.getUTCFullYear(),a=t.getUTCMonth();switch(this.viewMode){case 0:this.picker.find(".prev").css(this.o.startDate!==-1/0&&e<=this.o.startDate.getUTCFullYear()&&a<=this.o.startDate.getUTCMonth()?{visibility:"hidden"}:{visibility:"visible"}),this.picker.find(".next").css(1/0!==this.o.endDate&&e>=this.o.endDate.getUTCFullYear()&&a>=this.o.endDate.getUTCMonth()?{visibility:"hidden"}:{visibility:"visible"});break;case 1:case 2:this.picker.find(".prev").css(this.o.startDate!==-1/0&&e<=this.o.startDate.getUTCFullYear()?{visibility:"hidden"}:{visibility:"visible"}),this.picker.find(".next").css(1/0!==this.o.endDate&&e>=this.o.endDate.getUTCFullYear()?{visibility:"hidden"}:{visibility:"visible"})}}},click:function(e){e.preventDefault();var i,s,n,r=t(e.target).closest("span, td, th");if(1===r.length)switch(r[0].nodeName.toLowerCase()){case"th":switch(r[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var o=D.modes[this.viewMode].navStep*("prev"===r[0].className?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,o),this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,o),1===this.viewMode&&this._trigger("changeYear",this.viewDate)}this.fill();break;case"today":var h=new Date;h=a(h.getFullYear(),h.getMonth(),h.getDate(),0,0,0),this.showMode(-2);var l="linked"===this.o.todayBtn?null:"view";this._setDate(h,l);break;case"clear":this.clearDates()}break;case"span":r.hasClass("disabled")||(this.viewDate.setUTCDate(1),r.hasClass("month")?(n=1,s=r.parent().find("span").index(r),i=this.viewDate.getUTCFullYear(),this.viewDate.setUTCMonth(s),this._trigger("changeMonth",this.viewDate),1===this.o.minViewMode&&this._setDate(a(i,s,n))):(n=1,s=0,i=parseInt(r.text(),10)||0,this.viewDate.setUTCFullYear(i),this._trigger("changeYear",this.viewDate),2===this.o.minViewMode&&this._setDate(a(i,s,n))),this.showMode(-1),this.fill());break;case"td":r.hasClass("day")&&!r.hasClass("disabled")&&(n=parseInt(r.text(),10)||1,i=this.viewDate.getUTCFullYear(),s=this.viewDate.getUTCMonth(),r.hasClass("old")?0===s?(s=11,i-=1):s-=1:r.hasClass("new")&&(11===s?(s=0,i+=1):s+=1),this._setDate(a(i,s,n)))}this.picker.is(":visible")&&this._focused_from&&t(this._focused_from).focus(),delete this._focused_from},_toggle_multidate:function(t){var e=this.dates.contains(t);if(t||this.dates.clear(),-1!==e?(this.o.multidate===!0||this.o.multidate>1||this.o.toggleActive)&&this.dates.remove(e):this.o.multidate===!1?(this.dates.clear(),this.dates.push(t)):this.dates.push(t),"number"==typeof this.o.multidate)for(;this.dates.length>this.o.multidate;)this.dates.remove(0)},_setDate:function(t,e){e&&"date"!==e||this._toggle_multidate(t&&new Date(t)),e&&"view"!==e||(this.viewDate=t&&new Date(t)),this.fill(),this.setValue(),e&&"view"===e||this._trigger("changeDate");var a;this.isInput?a=this.element:this.component&&(a=this.element.find("input")),a&&a.change(),!this.o.autoclose||e&&"date"!==e||this.hide()},moveMonth:function(t,a){if(!t)return e;if(!a)return t;var i,s,n=new Date(t.valueOf()),r=n.getUTCDate(),o=n.getUTCMonth(),h=Math.abs(a);if(a=a>0?1:-1,1===h)s=-1===a?function(){return n.getUTCMonth()===o}:function(){return n.getUTCMonth()!==i},i=o+a,n.setUTCMonth(i),(0>i||i>11)&&(i=(i+12)%12);else{for(var l=0;h>l;l++)n=this.moveMonth(n,a);i=n.getUTCMonth(),n.setUTCDate(r),s=function(){return i!==n.getUTCMonth()}}for(;s();)n.setUTCDate(--r),n.setUTCMonth(i);return n},moveYear:function(t,e){return this.moveMonth(t,12*e)},dateWithinRange:function(t){return t>=this.o.startDate&&t<=this.o.endDate},keydown:function(t){if(!this.picker.is(":visible"))return void(27===t.keyCode&&this.show());var e,a,s,n=!1,r=this.focusDate||this.viewDate;switch(t.keyCode){case 27:this.focusDate?(this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill()):this.hide(),t.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation)break;e=37===t.keyCode?-1:1,t.ctrlKey?(a=this.moveYear(this.dates.get(-1)||i(),e),s=this.moveYear(r,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(a=this.moveMonth(this.dates.get(-1)||i(),e),s=this.moveMonth(r,e),this._trigger("changeMonth",this.viewDate)):(a=new Date(this.dates.get(-1)||i()),a.setUTCDate(a.getUTCDate()+e),s=new Date(r),s.setUTCDate(r.getUTCDate()+e)),this.dateWithinRange(s)&&(this.focusDate=this.viewDate=s,this.setValue(),this.fill(),t.preventDefault());break;case 38:case 40:if(!this.o.keyboardNavigation)break;e=38===t.keyCode?-1:1,t.ctrlKey?(a=this.moveYear(this.dates.get(-1)||i(),e),s=this.moveYear(r,e),this._trigger("changeYear",this.viewDate)):t.shiftKey?(a=this.moveMonth(this.dates.get(-1)||i(),e),s=this.moveMonth(r,e),this._trigger("changeMonth",this.viewDate)):(a=new Date(this.dates.get(-1)||i()),a.setUTCDate(a.getUTCDate()+7*e),s=new Date(r),s.setUTCDate(r.getUTCDate()+7*e)),this.dateWithinRange(s)&&(this.focusDate=this.viewDate=s,this.setValue(),this.fill(),t.preventDefault());break;case 32:break;case 13:r=this.focusDate||this.dates.get(-1)||this.viewDate,this.o.keyboardNavigation&&(this._toggle_multidate(r),n=!0),this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.setValue(),this.fill(),this.picker.is(":visible")&&(t.preventDefault(),"function"==typeof t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,this.o.autoclose&&this.hide());break;case 9:this.focusDate=null,this.viewDate=this.dates.get(-1)||this.viewDate,this.fill(),this.hide()}if(n){this._trigger(this.dates.length?"changeDate":"clearDate");var o;this.isInput?o=this.element:this.component&&(o=this.element.find("input")),o&&o.change()}},showMode:function(t){t&&(this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+t))),this.picker.children("div").hide().filter(".datepicker-"+D.modes[this.viewMode].clsName).css("display","block"),this.updateNavArrows()}};var d=function(e,a){this.element=t(e),this.inputs=t.map(a.inputs,function(t){return t.jquery?t[0]:t}),delete a.inputs,u.call(t(this.inputs),a).bind("changeDate",t.proxy(this.dateUpdated,this)),this.pickers=t.map(this.inputs,function(e){return t(e).data("datepicker")}),this.updateDates()};d.prototype={updateDates:function(){this.dates=t.map(this.pickers,function(t){return t.getUTCDate()}),this.updateRanges()},updateRanges:function(){var e=t.map(this.dates,function(t){return t.valueOf()});t.each(this.pickers,function(t,a){a.setRange(e)})},dateUpdated:function(e){if(!this.updating){this.updating=!0;var a=t(e.target).data("datepicker"),i=a.getUTCDate(),s=t.inArray(e.target,this.inputs),n=s-1,r=s+1,o=this.inputs.length;if(-1!==s){if(t.each(this.pickers,function(t,e){e.getUTCDate()||e.setUTCDate(i)}),i<this.dates[n])for(;n>=0&&i<this.dates[n];)this.pickers[n--].setUTCDate(i);else if(i>this.dates[r])for(;o>r&&i>this.dates[r];)this.pickers[r++].setUTCDate(i);this.updateDates(),delete this.updating}}},remove:function(){t.map(this.pickers,function(t){t.remove()}),delete this.element.data().datepicker}};var c=t.fn.datepicker,u=function(a){var i=Array.apply(null,arguments);i.shift();var s;return this.each(function(){var n=t(this),h=n.data("datepicker"),c="object"==typeof a&&a;if(!h){var u=r(this,"date"),f=t.extend({},p,u,c),g=o(f.language),D=t.extend({},p,g,u,c);if(n.hasClass("input-daterange")||D.inputs){var v={inputs:D.inputs||n.find("input").toArray()};n.data("datepicker",h=new d(this,t.extend(D,v)))}else n.data("datepicker",h=new l(this,D))}return"string"==typeof a&&"function"==typeof h[a]&&(s=h[a].apply(h,i),s!==e)?!1:void 0}),s!==e?s:this};t.fn.datepicker=u;var p=t.fn.datepicker.defaults={autoclose:!1,beforeShowDay:t.noop,beforeShowMonth:t.noop,calendarWeeks:!1,clearBtn:!1,toggleActive:!1,daysOfWeekDisabled:[],datesDisabled:[],endDate:1/0,forceParse:!0,format:"mm/dd/yyyy",keyboardNavigation:!0,language:"en",minViewMode:0,multidate:!1,multidateSeparator:",",orientation:"auto",rtl:!1,startDate:-1/0,startView:0,todayBtn:!1,todayHighlight:!1,weekStart:0,disableTouchKeyboard:!1,enableOnReadonly:!0,container:"body"},f=t.fn.datepicker.locale_opts=["format","rtl","weekStart"];t.fn.datepicker.Constructor=l;var g=t.fn.datepicker.dates={en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],today:"Today",clear:"Clear"}},D={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(t){return t%4===0&&t%100!==0||t%400===0},getDaysInMonth:function(t,e){return[31,D.isLeapYear(t)?29:28,31,30,31,30,31,31,30,31,30,31][e]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(t){var e=t.replace(this.validParts,"\x00").split("\x00"),a=t.match(this.validParts);if(!e||!e.length||!a||0===a.length)throw new Error("Invalid date format.");return{separators:e,parts:a}},parseDate:function(i,s,n){function r(){var t=this.slice(0,u[d].length),e=u[d].slice(0,t.length);return t.toLowerCase()===e.toLowerCase()}if(!i)return e;if(i instanceof Date)return i;"string"==typeof s&&(s=D.parseFormat(s));var o,h,d,c=/([\-+]\d+)([dmwy])/,u=i.match(/([\-+]\d+)([dmwy])/g);if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(i)){for(i=new Date,d=0;d<u.length;d++)switch(o=c.exec(u[d]),h=parseInt(o[1]),o[2]){case"d":i.setUTCDate(i.getUTCDate()+h);break;case"m":i=l.prototype.moveMonth.call(l.prototype,i,h);break;case"w":i.setUTCDate(i.getUTCDate()+7*h);break;case"y":i=l.prototype.moveYear.call(l.prototype,i,h)}return a(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),0,0,0)}u=i&&i.match(this.nonpunctuation)||[],i=new Date;var p,f,v={},m=["yyyy","yy","M","MM","m","mm","d","dd"],y={yyyy:function(t,e){return t.setUTCFullYear(e)},yy:function(t,e){return t.setUTCFullYear(2e3+e)},m:function(t,e){if(isNaN(t))return t;for(e-=1;0>e;)e+=12;for(e%=12,t.setUTCMonth(e);t.getUTCMonth()!==e;)t.setUTCDate(t.getUTCDate()-1);return t},d:function(t,e){return t.setUTCDate(e)}};y.M=y.MM=y.mm=y.m,y.dd=y.d,i=a(i.getFullYear(),i.getMonth(),i.getDate(),0,0,0);var w=s.parts.slice();if(u.length!==w.length&&(w=t(w).filter(function(e,a){return-1!==t.inArray(a,m)}).toArray()),u.length===w.length){var k;for(d=0,k=w.length;k>d;d++){if(p=parseInt(u[d],10),o=w[d],isNaN(p))switch(o){case"MM":f=t(g[n].months).filter(r),p=t.inArray(f[0],g[n].months)+1;break;case"M":f=t(g[n].monthsShort).filter(r),p=t.inArray(f[0],g[n].monthsShort)+1}v[o]=p}var C,T;for(d=0;d<m.length;d++)T=m[d],T in v&&!isNaN(v[T])&&(C=new Date(i),y[T](C,v[T]),isNaN(C)||(i=C))}return i},formatDate:function(e,a,i){if(!e)return"";"string"==typeof a&&(a=D.parseFormat(a));var s={d:e.getUTCDate(),D:g[i].daysShort[e.getUTCDay()],DD:g[i].days[e.getUTCDay()],m:e.getUTCMonth()+1,M:g[i].monthsShort[e.getUTCMonth()],MM:g[i].months[e.getUTCMonth()],yy:e.getUTCFullYear().toString().substring(2),yyyy:e.getUTCFullYear()};s.dd=(s.d<10?"0":"")+s.d,s.mm=(s.m<10?"0":"")+s.m,e=[];for(var n=t.extend([],a.separators),r=0,o=a.parts.length;o>=r;r++)n.length&&e.push(n.shift()),e.push(s[a.parts[r]]);return e.join("")},headTemplate:'<thead><tr><th class="prev">&#171;</th><th colspan="5" class="datepicker-switch"></th><th class="next">&#187;</th></tr></thead>',contTemplate:'<tbody><tr><td colspan="7"></td></tr></tbody>',footTemplate:'<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'};D.template='<div class="datepicker"><div class="datepicker-days"><table class=" table-condensed">'+D.headTemplate+"<tbody></tbody>"+D.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+D.headTemplate+D.contTemplate+D.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+D.headTemplate+D.contTemplate+D.footTemplate+"</table></div></div>",t.fn.datepicker.DPGlobal=D,t.fn.datepicker.noConflict=function(){return t.fn.datepicker=c,this},t.fn.datepicker.version="1.4.0",t(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(e){var a=t(this);a.data("datepicker")||(e.preventDefault(),u.call(a,"show"))}),t(function(){u.call(t('[data-provide="datepicker-inline"]'))})}(window.jQuery);