bootstrap-datepicker.min.js 27.4 KB
(function(d,g){var r="&laquo;";var a="&raquo;";var l=d(window);function o(){return new Date(Date.UTC.apply(Date,arguments))}function c(){var s=new Date();return o(s.getFullYear(),s.getMonth(),s.getDate())}function m(s){return function(){return this[s].apply(this,arguments)}}var n=(function(){var s={get:function(t){return this.slice(t)[0]},contains:function(w){var v=w&&w.valueOf();for(var u=0,t=this.length;u<t;u++){if(this[u].valueOf()===v){return u}}return -1},remove:function(t){this.splice(t,1)},replace:function(t){if(!t){return}if(!d.isArray(t)){t=[t]}this.clear();this.push.apply(this,t)},clear:function(){this.length=0},copy:function(){var t=new n();t.replace(this);return t}};return function(){var t=[];t.push.apply(t,arguments);d.extend(t,s);return t}})();var q=function(t,s){this.dates=new n();this.viewDate=c();this.focusDate=null;this._process_options(s);this.element=d(t);this.isInline=false;this.isInput=this.element.is("input");this.component=this.element.is(".date")?this.element.find(".add-on, .input-group-addon, .btn"):false;this.hasInput=this.component&&this.element.find("input").length;if(this.component&&this.component.length===0){this.component=false}this.picker=d(h.template);this._buildEvents();this._attachEvents();if(this.isInline){this.picker.addClass("datepicker-inline").appendTo(this.element)}else{this.picker.addClass("datepicker-dropdown dropdown-menu")}if(this.o.rtl){this.picker.addClass("datepicker-rtl")}this.viewMode=this.o.startView;if(this.o.calendarWeeks){this.picker.find("tfoot th.today").attr("colspan",function(u,v){return parseInt(v)+1})}this._allow_update=false;this.setStartDate(this._o.startDate);this.setEndDate(this._o.endDate);this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);this.fillDow();this.fillMonths();this._allow_update=true;this.update();this.showMode();if(this.isInline){this.show()}};q.prototype={constructor:q,_process_options:function(s){this._o=d.extend({},this._o,s);var w=this.o=d.extend({},this._o);var v=w.language;if(!f[v]){v=v.split("-")[0];if(!f[v]){v=i.language}}w.language=v;switch(w.startView){case 2:case"decade":w.startView=2;break;case 1:case"year":w.startView=1;break;default:w.startView=0}switch(w.minViewMode){case 1:case"months":w.minViewMode=1;break;case 2:case"years":w.minViewMode=2;break;default:w.minViewMode=0}w.startView=Math.max(w.startView,w.minViewMode);if(w.multidate!==true){w.multidate=Number(w.multidate)||false;if(w.multidate!==false){w.multidate=Math.max(0,w.multidate)}else{w.multidate=1}}w.multidateSeparator=String(w.multidateSeparator);w.weekStart%=7;w.weekEnd=((w.weekStart+6)%7);var t=h.parseFormat(w.format);if(w.startDate!==-Infinity){if(!!w.startDate){if(w.startDate instanceof Date){w.startDate=this._local_to_utc(this._zero_time(w.startDate))}else{w.startDate=h.parseDate(w.startDate,t,w.language)}}else{w.startDate=-Infinity}}if(w.endDate!==Infinity){if(!!w.endDate){if(w.endDate instanceof Date){w.endDate=this._local_to_utc(this._zero_time(w.endDate))}else{w.endDate=h.parseDate(w.endDate,t,w.language)}}else{w.endDate=Infinity}}w.daysOfWeekDisabled=w.daysOfWeekDisabled||[];if(!d.isArray(w.daysOfWeekDisabled)){w.daysOfWeekDisabled=w.daysOfWeekDisabled.split(/[,\s]*/)}w.daysOfWeekDisabled=d.map(w.daysOfWeekDisabled,function(y){return parseInt(y,10)});var u=String(w.orientation).toLowerCase().split(/\s+/g),x=w.orientation.toLowerCase();u=d.grep(u,function(y){return(/^auto|left|right|top|bottom$/).test(y)});w.orientation={x:"auto",y:"auto"};if(!x||x==="auto"){}else{if(u.length===1){switch(u[0]){case"top":case"bottom":w.orientation.y=u[0];break;case"left":case"right":w.orientation.x=u[0];break}}else{x=d.grep(u,function(y){return(/^left|right$/).test(y)});w.orientation.x=x[0]||"auto";x=d.grep(u,function(y){return(/^top|bottom$/).test(y)});w.orientation.y=x[0]||"auto"}}},_events:[],_secondaryEvents:[],_applyEvents:function(s){for(var t=0,v,u,w;t<s.length;t++){v=s[t][0];if(s[t].length===2){u=g;w=s[t][1]}else{if(s[t].length===3){u=s[t][1];w=s[t][2]}}v.on(w,u)}},_unapplyEvents:function(s){for(var t=0,v,w,u;t<s.length;t++){v=s[t][0];if(s[t].length===2){u=g;w=s[t][1]}else{if(s[t].length===3){u=s[t][1];w=s[t][2]}}v.off(w,u)}},_buildEvents:function(){if(this.isInput){this._events=[[this.element,{focus:d.proxy(this.show,this),keyup:d.proxy(function(s){if(d.inArray(s.keyCode,[27,37,39,38,40,32,13,9])===-1){this.update()}},this),keydown:d.proxy(this.keydown,this)}]]}else{if(this.component&&this.hasInput){this._events=[[this.element.find("input"),{focus:d.proxy(this.show,this),keyup:d.proxy(function(s){if(d.inArray(s.keyCode,[27,37,39,38,40,32,13,9])===-1){this.update()}},this),keydown:d.proxy(this.keydown,this)}],[this.component,{click:d.proxy(this.show,this)}]]}else{if(this.element.is("div")){this.isInline=true}else{this._events=[[this.element,{click:d.proxy(this.show,this)}]]}}}this._events.push([this.element,"*",{blur:d.proxy(function(s){this._focused_from=s.target},this)}],[this.element,{blur:d.proxy(function(s){this._focused_from=s.target},this)}]);this._secondaryEvents=[[this.picker,{click:d.proxy(this.click,this)}],[d(window),{resize:d.proxy(this.place,this)}],[d(document),{"mousedown touchstart":d.proxy(function(s){if(!(this.element.is(s.target)||this.element.find(s.target).length||this.picker.is(s.target)||this.picker.find(s.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(u,v){var t=v||this.dates.get(-1),s=this._utc_to_local(t);this.element.trigger({type:u,date:s,dates:d.map(this.dates,this._utc_to_local),format:d.proxy(function(w,y){if(arguments.length===0){w=this.dates.length-1;y=this.o.format}else{if(typeof w==="string"){y=w;w=this.dates.length-1}}y=y||this.o.format;var x=this.dates.get(w);return h.formatDate(x,y,this.o.language)},this)})},show:function(){if(!this.isInline){this.picker.appendTo("body")}this.picker.show();this.place();this._attachSecondaryEvents();this._trigger("show")},hide:function(){if(this.isInline){return}if(!this.picker.is(":visible")){return}this.focusDate=null;this.picker.hide().detach();this._detachSecondaryEvents();this.viewMode=this.o.startView;this.showMode();if(this.o.forceParse&&(this.isInput&&this.element.val()||this.hasInput&&this.element.find("input").val())){this.setValue()}this._trigger("hide")},remove:function(){this.hide();this._detachEvents();this._detachSecondaryEvents();this.picker.remove();delete this.element.data().datepicker;if(!this.isInput){delete this.element.data().date}},_utc_to_local:function(s){return s&&new Date(s.getTime()+(s.getTimezoneOffset()*60000))},_local_to_utc:function(s){return s&&new Date(s.getTime()-(s.getTimezoneOffset()*60000))},_zero_time:function(s){return s&&new Date(s.getFullYear(),s.getMonth(),s.getDate())},_zero_utc_time:function(s){return s&&new Date(Date.UTC(s.getUTCFullYear(),s.getUTCMonth(),s.getUTCDate()))},getDates:function(){return d.map(this.dates,this._utc_to_local)},getUTCDates:function(){return d.map(this.dates,function(s){return new Date(s)})},getDate:function(){return this._utc_to_local(this.getUTCDate())},getUTCDate:function(){return new Date(this.dates.get(-1))},setDates:function(){var s=d.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,s);this._trigger("changeDate");this.setValue()},setUTCDates:function(){var s=d.isArray(arguments[0])?arguments[0]:arguments;this.update.apply(this,d.map(s,this._utc_to_local));this._trigger("changeDate");this.setValue()},setDate:m("setDates"),setUTCDate:m("setUTCDates"),setValue:function(){var s=this.getFormattedDate();if(!this.isInput){if(this.component){this.element.find("input").val(s).change()}}else{this.element.val(s).change()}},getFormattedDate:function(s){if(s===g){s=this.o.format}var t=this.o.language;return d.map(this.dates,function(u){return h.formatDate(u,s,t)}).join(this.o.multidateSeparator)},setStartDate:function(s){this._process_options({startDate:s});this.update();this.updateNavArrows()},setEndDate:function(s){this._process_options({endDate:s});this.update();this.updateNavArrows()},setDaysOfWeekDisabled:function(s){this._process_options({daysOfWeekDisabled:s});this.update();this.updateNavArrows()},place:function(){if(this.isInline){return}var G=this.picker.outerWidth(),C=this.picker.outerHeight(),w=10,y=l.width(),t=l.height(),x=l.scrollTop();var E=parseInt(this.element.parents().filter(function(){return d(this).css("z-index")!=="auto"}).first().css("z-index"))+10;var B=this.component?this.component.parent().offset():this.element.offset();var F=this.component?this.component.outerHeight(true):this.element.outerHeight(false);var v=this.component?this.component.outerWidth(true):this.element.outerWidth(false);var A=B.left,D=B.top;this.picker.removeClass("datepicker-orient-top datepicker-orient-bottom datepicker-orient-right datepicker-orient-left");if(this.o.orientation.x!=="auto"){this.picker.addClass("datepicker-orient-"+this.o.orientation.x);if(this.o.orientation.x==="right"){A-=G-v}}else{this.picker.addClass("datepicker-orient-left");if(B.left<0){A-=B.left-w}else{if(B.left+G>y){A=y-G-w}}}var s=this.o.orientation.y,u,z;if(s==="auto"){u=-x+B.top-C;z=x+t-(B.top+F+C);if(Math.max(u,z)===z){s="top"}else{s="bottom"}}this.picker.addClass("datepicker-orient-"+s);if(s==="top"){D+=F}else{D-=C+parseInt(this.picker.css("padding-top"))}this.picker.css({top:D,left:A,zIndex:E})},_allow_update:true,update:function(){if(!this._allow_update){return}var t=this.dates.copy(),u=[],s=false;if(arguments.length){d.each(arguments,d.proxy(function(w,v){if(v instanceof Date){v=this._local_to_utc(v)}u.push(v)},this));s=true}else{u=this.isInput?this.element.val():this.element.data("date")||this.element.find("input").val();if(u&&this.o.multidate){u=u.split(this.o.multidateSeparator)}else{u=[u]}delete this.element.data().date}u=d.map(u,d.proxy(function(v){return h.parseDate(v,this.o.format,this.o.language)},this));u=d.grep(u,d.proxy(function(v){return(v<this.o.startDate||v>this.o.endDate||!v)},this),true);this.dates.replace(u);if(this.dates.length){this.viewDate=new Date(this.dates.get(-1))}else{if(this.viewDate<this.o.startDate){this.viewDate=new Date(this.o.startDate)}else{if(this.viewDate>this.o.endDate){this.viewDate=new Date(this.o.endDate)}}}if(s){this.setValue()}else{if(u.length){if(String(t)!==String(this.dates)){this._trigger("changeDate")}}}if(!this.dates.length&&t.length){this._trigger("clearDate")}this.fill()},fillDow:function(){var t=this.o.weekStart,u="<tr>";if(this.o.calendarWeeks){var s='<th class="cw">&nbsp;</th>';u+=s;this.picker.find(".datepicker-days thead tr:first-child").prepend(s)}while(t<this.o.weekStart+7){u+='<th class="dow">'+f[this.o.language].daysMin[(t++)%7]+"</th>"}u+="</tr>";this.picker.find(".datepicker-days thead").append(u)},fillMonths:function(){var t="",s=0;while(s<12){t+='<span class="month">'+f[this.o.language].monthsShort[s++]+"</span>"}this.picker.find(".datepicker-months td").html(t)},setRange:function(s){if(!s||!s.length){delete this.range}else{this.range=d.map(s,function(t){return t.valueOf()})}this.fill()},getClassNames:function(u){var s=[],v=this.viewDate.getUTCFullYear(),w=this.viewDate.getUTCMonth(),t=new Date();if(u.getUTCFullYear()<v||(u.getUTCFullYear()===v&&u.getUTCMonth()<w)){s.push("old")}else{if(u.getUTCFullYear()>v||(u.getUTCFullYear()===v&&u.getUTCMonth()>w)){s.push("new")}}if(this.focusDate&&u.valueOf()===this.focusDate.valueOf()){s.push("focused")}if(this.o.todayHighlight&&u.getUTCFullYear()===t.getFullYear()&&u.getUTCMonth()===t.getMonth()&&u.getUTCDate()===t.getDate()){s.push("today")}if(this.dates.contains(u)!==-1){s.push("active")}if(u.valueOf()<this.o.startDate||u.valueOf()>this.o.endDate||d.inArray(u.getUTCDay(),this.o.daysOfWeekDisabled)!==-1){s.push("disabled")}if(this.range){if(u>this.range[0]&&u<this.range[this.range.length-1]){s.push("range")}if(d.inArray(u.valueOf(),this.range)!==-1){s.push("selected")}}return s},fill:function(){var N=new Date(this.viewDate),C=N.getUTCFullYear(),O=N.getUTCMonth(),H=this.o.startDate!==-Infinity?this.o.startDate.getUTCFullYear():-Infinity,L=this.o.startDate!==-Infinity?this.o.startDate.getUTCMonth():-Infinity,z=this.o.endDate!==Infinity?this.o.endDate.getUTCFullYear():Infinity,I=this.o.endDate!==Infinity?this.o.endDate.getUTCMonth():Infinity,A=f[this.o.language].today||f.en.today||"",u=f[this.o.language].clear||f.en.clear||"",w;this.picker.find(".datepicker-days thead th.datepicker-switch").text(f[this.o.language].months[O]+" "+C);this.picker.find("tfoot th.today").text(A).toggle(this.o.todayBtn!==false);this.picker.find("tfoot th.clear").text(u).toggle(this.o.clearBtn!==false);this.updateNavArrows();this.fillMonths();var Q=o(C,O-1,28),K=h.getDaysInMonth(Q.getUTCFullYear(),Q.getUTCMonth());Q.setUTCDate(K);Q.setUTCDate(K-(Q.getUTCDay()-this.o.weekStart+7)%7);var s=new Date(Q);s.setUTCDate(s.getUTCDate()+42);s=s.valueOf();var B=[];var F;while(Q.valueOf()<s){if(Q.getUTCDay()===this.o.weekStart){B.push("<tr>");if(this.o.calendarWeeks){var t=new Date(+Q+(this.o.weekStart-Q.getUTCDay()-7)%7*86400000),x=new Date(Number(t)+(7+4-t.getUTCDay())%7*86400000),v=new Date(Number(v=o(x.getUTCFullYear(),0,1))+(7+4-v.getUTCDay())%7*86400000),D=(x-v)/86400000/7+1;B.push('<td class="cw">'+D+"</td>")}}F=this.getClassNames(Q);F.push("day");if(this.o.beforeShowDay!==d.noop){var E=this.o.beforeShowDay(this._utc_to_local(Q));if(E===g){E={}}else{if(typeof(E)==="boolean"){E={enabled:E}}else{if(typeof(E)==="string"){E={classes:E}}}}if(E.enabled===false){F.push("disabled")}if(E.classes){F=F.concat(E.classes.split(/\s+/))}if(E.tooltip){w=E.tooltip}}F=d.unique(F);B.push('<td class="'+F.join(" ")+'"'+(w?' title="'+w+'"':"")+">"+Q.getUTCDate()+"</td>");if(Q.getUTCDay()===this.o.weekEnd){B.push("</tr>")}Q.setUTCDate(Q.getUTCDate()+1)}this.picker.find(".datepicker-days tbody").empty().append(B.join(""));var y=this.picker.find(".datepicker-months").find("th:eq(1)").text(C).end().find("span").removeClass("active");d.each(this.dates,function(R,S){if(S.getUTCFullYear()===C){y.eq(S.getUTCMonth()).addClass("active")}});if(C<H||C>z){y.addClass("disabled")}if(C===H){y.slice(0,L).addClass("disabled")}if(C===z){y.slice(I+1).addClass("disabled")}B="";C=parseInt(C/10,10)*10;var P=this.picker.find(".datepicker-years").find("th:eq(1)").text(C+"-"+(C+9)).end().find("td");C-=1;var G=d.map(this.dates,function(R){return R.getUTCFullYear()}),M;for(var J=-1;J<11;J++){M=["year"];if(J===-1){M.push("old")}else{if(J===10){M.push("new")}}if(d.inArray(C,G)!==-1){M.push("active")}if(C<H||C>z){M.push("disabled")}B+='<span class="'+M.join(" ")+'">'+C+"</span>";C+=1}P.html(B)},updateNavArrows:function(){if(!this._allow_update){return}var u=new Date(this.viewDate),s=u.getUTCFullYear(),t=u.getUTCMonth();switch(this.viewMode){case 0:if(this.o.startDate!==-Infinity&&s<=this.o.startDate.getUTCFullYear()&&t<=this.o.startDate.getUTCMonth()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.o.endDate!==Infinity&&s>=this.o.endDate.getUTCFullYear()&&t>=this.o.endDate.getUTCMonth()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break;case 1:case 2:if(this.o.startDate!==-Infinity&&s<=this.o.startDate.getUTCFullYear()){this.picker.find(".prev").css({visibility:"hidden"})}else{this.picker.find(".prev").css({visibility:"visible"})}if(this.o.endDate!==Infinity&&s>=this.o.endDate.getUTCFullYear()){this.picker.find(".next").css({visibility:"hidden"})}else{this.picker.find(".next").css({visibility:"visible"})}break}},click:function(w){w.preventDefault();var x=d(w.target).closest("span, td, th"),z,y,A;if(x.length===1){switch(x[0].nodeName.toLowerCase()){case"th":switch(x[0].className){case"datepicker-switch":this.showMode(1);break;case"prev":case"next":var s=h.modes[this.viewMode].navStep*(x[0].className==="prev"?-1:1);switch(this.viewMode){case 0:this.viewDate=this.moveMonth(this.viewDate,s);this._trigger("changeMonth",this.viewDate);break;case 1:case 2:this.viewDate=this.moveYear(this.viewDate,s);if(this.viewMode===1){this._trigger("changeYear",this.viewDate)}break}this.fill();break;case"today":var t=new Date();t=o(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0);this.showMode(-2);var u=this.o.todayBtn==="linked"?null:"view";this._setDate(t,u);break;case"clear":var v;if(this.isInput){v=this.element}else{if(this.component){v=this.element.find("input")}}if(v){v.val("").change()}this.update();this._trigger("changeDate");if(this.o.autoclose){this.hide()}break}break;case"span":if(!x.is(".disabled")){this.viewDate.setUTCDate(1);if(x.is(".month")){A=1;y=x.parent().find("span").index(x);z=this.viewDate.getUTCFullYear();this.viewDate.setUTCMonth(y);this._trigger("changeMonth",this.viewDate);if(this.o.minViewMode===1){this._setDate(o(z,y,A))}}else{A=1;y=0;z=parseInt(x.text(),10)||0;this.viewDate.setUTCFullYear(z);this._trigger("changeYear",this.viewDate);if(this.o.minViewMode===2){this._setDate(o(z,y,A))}}this.showMode(-1);this.fill()}break;case"td":if(x.is(".day")&&!x.is(".disabled")){A=parseInt(x.text(),10)||1;z=this.viewDate.getUTCFullYear();y=this.viewDate.getUTCMonth();if(x.is(".old")){if(y===0){y=11;z-=1}else{y-=1}}else{if(x.is(".new")){if(y===11){y=0;z+=1}else{y+=1}}}this._setDate(o(z,y,A))}break}}if(this.picker.is(":visible")&&this._focused_from){d(this._focused_from).focus()}delete this._focused_from},_toggle_multidate:function(t){var s=this.dates.contains(t);if(!t){this.dates.clear()}else{if(s!==-1){this.dates.remove(s)}else{this.dates.push(t)}}if(typeof this.o.multidate==="number"){while(this.dates.length>this.o.multidate){this.dates.remove(0)}}},_setDate:function(s,u){if(!u||u==="date"){this._toggle_multidate(s&&new Date(s))}if(!u||u==="view"){this.viewDate=s&&new Date(s)}this.fill();this.setValue();this._trigger("changeDate");var t;if(this.isInput){t=this.element}else{if(this.component){t=this.element.find("input")}}if(t){t.change()}if(this.o.autoclose&&(!u||u==="date")){this.hide()}},moveMonth:function(s,t){if(!s){return g}if(!t){return s}var w=new Date(s.valueOf()),A=w.getUTCDate(),x=w.getUTCMonth(),v=Math.abs(t),z,y;t=t>0?1:-1;if(v===1){y=t===-1?function(){return w.getUTCMonth()===x}:function(){return w.getUTCMonth()!==z};z=x+t;w.setUTCMonth(z);if(z<0||z>11){z=(z+12)%12}}else{for(var u=0;u<v;u++){w=this.moveMonth(w,t)}z=w.getUTCMonth();w.setUTCDate(A);y=function(){return z!==w.getUTCMonth()}}while(y()){w.setUTCDate(--A);w.setUTCMonth(z)}return w},moveYear:function(t,s){return this.moveMonth(t,s*12)},dateWithinRange:function(s){return s>=this.o.startDate&&s<=this.o.endDate},keydown:function(y){if(this.picker.is(":not(:visible)")){if(y.keyCode===27){this.show()}return}var u=false,t,s,w,x=this.focusDate||this.viewDate;switch(y.keyCode){case 27:if(this.focusDate){this.focusDate=null;this.viewDate=this.dates.get(-1)||this.viewDate;this.fill()}else{this.hide()}y.preventDefault();break;case 37:case 39:if(!this.o.keyboardNavigation){break}t=y.keyCode===37?-1:1;if(y.ctrlKey){s=this.moveYear(this.dates.get(-1)||c(),t);w=this.moveYear(x,t);this._trigger("changeYear",this.viewDate)}else{if(y.shiftKey){s=this.moveMonth(this.dates.get(-1)||c(),t);w=this.moveMonth(x,t);this._trigger("changeMonth",this.viewDate)}else{s=new Date(this.dates.get(-1)||c());s.setUTCDate(s.getUTCDate()+t);w=new Date(x);w.setUTCDate(x.getUTCDate()+t)}}if(this.dateWithinRange(s)){this.focusDate=this.viewDate=w;this.setValue();this.fill();y.preventDefault()}break;case 38:case 40:if(!this.o.keyboardNavigation){break}t=y.keyCode===38?-1:1;if(y.ctrlKey){s=this.moveYear(this.dates.get(-1)||c(),t);w=this.moveYear(x,t);this._trigger("changeYear",this.viewDate)}else{if(y.shiftKey){s=this.moveMonth(this.dates.get(-1)||c(),t);w=this.moveMonth(x,t);this._trigger("changeMonth",this.viewDate)}else{s=new Date(this.dates.get(-1)||c());s.setUTCDate(s.getUTCDate()+t*7);w=new Date(x);w.setUTCDate(x.getUTCDate()+t*7)}}if(this.dateWithinRange(s)){this.focusDate=this.viewDate=w;this.setValue();this.fill();y.preventDefault()}break;case 32:break;case 13:x=this.focusDate||this.dates.get(-1)||this.viewDate;this._toggle_multidate(x);u=true;this.focusDate=null;this.viewDate=this.dates.get(-1)||this.viewDate;this.setValue();this.fill();if(this.picker.is(":visible")){y.preventDefault();if(this.o.autoclose){this.hide()}}break;case 9:this.focusDate=null;this.viewDate=this.dates.get(-1)||this.viewDate;this.fill();this.hide();break}if(u){if(this.dates.length){this._trigger("changeDate")}else{this._trigger("clearDate")}var v;if(this.isInput){v=this.element}else{if(this.component){v=this.element.find("input")}}if(v){v.change()}}},showMode:function(s){if(s){this.viewMode=Math.max(this.o.minViewMode,Math.min(2,this.viewMode+s))}this.picker.find(">div").hide().filter(".datepicker-"+h.modes[this.viewMode].clsName).css("display","block");this.updateNavArrows()}};var j=function(t,s){this.element=d(t);this.inputs=d.map(s.inputs,function(u){return u.jquery?u[0]:u});delete s.inputs;d(this.inputs).datepicker(s).bind("changeDate",d.proxy(this.dateUpdated,this));this.pickers=d.map(this.inputs,function(u){return d(u).data("datepicker")});this.updateDates()};j.prototype={updateDates:function(){this.dates=d.map(this.pickers,function(s){return s.getUTCDate()});this.updateRanges()},updateRanges:function(){var s=d.map(this.dates,function(t){return t.valueOf()});d.each(this.pickers,function(t,u){u.setRange(s)})},dateUpdated:function(v){if(this.updating){return}this.updating=true;var w=d(v.target).data("datepicker"),u=w.getUTCDate(),t=d.inArray(v.target,this.inputs),s=this.inputs.length;if(t===-1){return}d.each(this.pickers,function(x,y){if(!y.getUTCDate()){y.setUTCDate(u)}});if(u<this.dates[t]){while(t>=0&&u<this.dates[t]){this.pickers[t--].setUTCDate(u)}}else{if(u>this.dates[t]){while(t<s&&u>this.dates[t]){this.pickers[t++].setUTCDate(u)}}}this.updateDates();delete this.updating},remove:function(){d.map(this.pickers,function(s){s.remove()});delete this.element.data().datepicker}};function k(v,y){var x=d(v).data(),s={},w,u=new RegExp("^"+y.toLowerCase()+"([A-Z])");y=new RegExp("^"+y.toLowerCase());function z(B,A){return A.toLowerCase()}for(var t in x){if(y.test(t)){w=t.replace(u,z);s[w]=x[t]}}return s}function p(u){var s={};if(!f[u]){u=u.split("-")[0];if(!f[u]){return}}var t=f[u];d.each(e,function(w,v){if(v in t){s[v]=t[v]}});return s}var b=d.fn.datepicker;d.fn.datepicker=function(u){var s=Array.apply(null,arguments);s.shift();var t;this.each(function(){var C=d(this),A=C.data("datepicker"),w=typeof u==="object"&&u;if(!A){var y=k(this,"date"),v=d.extend({},i,y,w),x=p(v.language),z=d.extend({},i,x,y,w);if(C.is(".input-daterange")||z.inputs){var B={inputs:z.inputs||C.find("input").toArray()};C.data("datepicker",(A=new j(this,d.extend(z,B))))}else{C.data("datepicker",(A=new q(this,z)))}}if(typeof u==="string"&&typeof A[u]==="function"){t=A[u].apply(A,s);if(t!==g){return false}}});if(t!==g){return t}else{return this}};var i=d.fn.datepicker.defaults={autoclose:false,beforeShowDay:d.noop,calendarWeeks:false,clearBtn:false,daysOfWeekDisabled:[],endDate:Infinity,forceParse:true,format:"mm/dd/yyyy",keyboardNavigation:true,language:"en",minViewMode:0,multidate:false,multidateSeparator:",",orientation:"auto",rtl:false,startDate:-Infinity,startView:0,todayBtn:false,todayHighlight:false,weekStart:0};var e=d.fn.datepicker.locale_opts=["format","rtl","weekStart"];d.fn.datepicker.Constructor=q;var f=d.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"}};var h={modes:[{clsName:"days",navFnc:"Month",navStep:1},{clsName:"months",navFnc:"FullYear",navStep:1},{clsName:"years",navFnc:"FullYear",navStep:10}],isLeapYear:function(s){return(((s%4===0)&&(s%100!==0))||(s%400===0))},getDaysInMonth:function(s,t){return[31,(h.isLeapYear(s)?29:28),31,30,31,30,31,31,30,31,30,31][t]},validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,nonpunctuation:/[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,parseFormat:function(u){var s=u.replace(this.validParts,"\0").split("\0"),t=u.match(this.validParts);if(!s||!s.length||!t||t.length===0){throw new Error("Invalid date format.")}return{separators:s,parts:t}},parseDate:function(J,G,D){if(!J){return g}if(J instanceof Date){return J}if(typeof G==="string"){G=h.parseFormat(G)}var v=/([\-+]\d+)([dmwy])/,B=J.match(/([\-+]\d+)([dmwy])/g),C,A,F;if(/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(J)){J=new Date();for(F=0;F<B.length;F++){C=v.exec(B[F]);A=parseInt(C[1]);switch(C[2]){case"d":J.setUTCDate(J.getUTCDate()+A);break;case"m":J=q.prototype.moveMonth.call(q.prototype,J,A);break;case"w":J.setUTCDate(J.getUTCDate()+A*7);break;case"y":J=q.prototype.moveYear.call(q.prototype,J,A);break}}return o(J.getUTCFullYear(),J.getUTCMonth(),J.getUTCDate(),0,0,0)}B=J&&J.match(this.nonpunctuation)||[];J=new Date();var w={},H=["yyyy","yy","M","MM","m","mm","d","dd"],z={yyyy:function(L,s){return L.setUTCFullYear(s)},yy:function(L,s){return L.setUTCFullYear(2000+s)},m:function(L,s){if(isNaN(L)){return L}s-=1;while(s<0){s+=12}s%=12;L.setUTCMonth(s);while(L.getUTCMonth()!==s){L.setUTCDate(L.getUTCDate()-1)}return L},d:function(L,s){return L.setUTCDate(s)}},K,u;z.M=z.MM=z.mm=z.m;z.dd=z.d;J=o(J.getFullYear(),J.getMonth(),J.getDate(),0,0,0);var t=G.parts.slice();if(B.length!==t.length){t=d(t).filter(function(s,L){return d.inArray(L,H)!==-1}).toArray()}function I(){var s=this.slice(0,B[F].length),L=B[F].slice(0,s.length);return s===L}if(B.length===t.length){var E;for(F=0,E=t.length;F<E;F++){K=parseInt(B[F],10);C=t[F];if(isNaN(K)){switch(C){case"MM":u=d(f[D].months).filter(I);K=d.inArray(u[0],f[D].months)+1;break;case"M":u=d(f[D].monthsShort).filter(I);K=d.inArray(u[0],f[D].monthsShort)+1;break}}w[C]=K}var x,y;for(F=0;F<H.length;F++){y=H[F];if(y in w&&!isNaN(w[y])){x=new Date(J);z[y](x,w[y]);if(!isNaN(x)){J=x}}}}return J},formatDate:function(s,w,y){if(!s){return""}if(typeof w==="string"){w=h.parseFormat(w)}var x={d:s.getUTCDate(),D:f[y].daysShort[s.getUTCDay()],DD:f[y].days[s.getUTCDay()],m:s.getUTCMonth()+1,M:f[y].monthsShort[s.getUTCMonth()],MM:f[y].months[s.getUTCMonth()],yy:s.getUTCFullYear().toString().substring(2),yyyy:s.getUTCFullYear()};x.dd=(x.d<10?"0":"")+x.d;x.mm=(x.m<10?"0":"")+x.m;s=[];var v=d.extend([],w.separators);for(var u=0,t=w.parts.length;u<=t;u++){if(v.length){s.push(v.shift())}s.push(x[w.parts[u]])}return s.join("")},headTemplate:'<thead><tr><th class="prev">'+r+'</th><th colspan="5" class="datepicker-switch"></th><th class="next">'+a+"</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>'};h.template='<div class="datepicker"><div class="datepicker-days"><table class=" table-condensed">'+h.headTemplate+"<tbody></tbody>"+h.footTemplate+'</table></div><div class="datepicker-months"><table class="table-condensed">'+h.headTemplate+h.contTemplate+h.footTemplate+'</table></div><div class="datepicker-years"><table class="table-condensed">'+h.headTemplate+h.contTemplate+h.footTemplate+"</table></div></div>";d.fn.datepicker.DPGlobal=h;d.fn.datepicker.noConflict=function(){d.fn.datepicker=b;return this};d(document).on("focus.datepicker.data-api click.datepicker.data-api",'[data-provide="datepicker"]',function(t){var s=d(this);if(s.data("datepicker")){return}t.preventDefault();s.datepicker("show")});d(function(){d('[data-provide="datepicker-inline"]').datepicker()})}(window.jQuery));