/*
: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
 @website: http://www.datejs.com/
*/
jQuery.fn.daterangepicker=function(a){function b(j){if(!j.getDate())return"";j.getDate();j.getMonth();j.getFullYear();return jQuery.datepicker.formatDate(e.dateFormat,j)}function d(){h.fadeIn(300);k.hide();m.show();h.find(".title-start").text(e.rangeStartTitle);h.find(".title-end").text(e.rangeEndTitle);h.find(".range-start").restoreDateFromData().show(400);h.find(".range-end").restoreDateFromData().show(400);setTimeout(function(){k.fadeIn()},400);e.onOpen()}function i(){h.fadeOut(300,function(){})}
var l=jQuery(this),e=jQuery.extend({presetRanges:[{text:"Today",dateStart:"today",dateEnd:"today"},{text:"Last 7 days",dateStart:"today-7days",dateEnd:"today"},{text:"Month to date",dateStart:function(){return Date.parse("today").moveToFirstDayOfMonth()},dateEnd:"today"},{text:"Year to date",dateStart:function(){var j=Date.parse("today");j.setMonth(0);j.setDate(1);return j},dateEnd:"today"}],presets:{specificDate:"Specific Date",allDatesBefore:"All Dates Before",allDatesAfter:"All Dates After",dateRange:"Date Range"},
rangeStartTitle:"Start date",rangeEndTitle:"End date",nextLinkText:"Next",prevLinkText:"Prev",doneButtonText:"Done",earliestDate:Date.parse("-15years"),latestDate:Date.parse("+15years"),rangeSplitter:"-",dateFormat:"d/m/yy",closeOnSelect:true,arrows:false,posX:l.offset().left,posY:l.offset().top+l.outerHeight(),appendTo:"body",onClose:function(){},onOpen:function(){},datepickerOptions:null},a),f={onSelect:function(){h.find(".ui-daterangepicker-specificDate").is(".ui-state-active")&&h.find(".range-end").datepicker("setDate",
h.find(".range-start").datepicker("getDate"));var j=b(h.find(".range-start").datepicker("getDate")),n=b(h.find(".range-end").datepicker("getDate"));if(l.length==2){l.eq(0).val(j);l.eq(1).val(n)}else l.val(j!=n?j+" "+e.rangeSplitter+" "+n:j);e.closeOnSelect&&!h.find("li.ui-state-active").is(".ui-daterangepicker-dateRange")&&h.is(":animated")},defaultDate:+0};e.datepickerOptions=a?jQuery.extend(f,a.datepickerOptions):f;var c;a=Date.parse("today");var g;if(l.size()==2){g=Date.parse(l.eq(0).val());f=
Date.parse(l.eq(1).val());if(g==null)g=f}else if(l.val()&&l.val().search("/")!=-1){f=l.val().split(e.rangeSplitter)[0];f=f.split("/")[1]+"/"+f.split("/")[0]+"/"+f.split("/")[2];g=Date.parse(f);f=l.val().split(e.rangeSplitter)[1];f=f.split("/")[1]+"/"+f.split("/")[0]+"/"+f.split("/")[2];f=Date.parse(f)}else f=null;if(f==null)f=f;if(g!=null)c=g;if(f!=null)a=f;var h=jQuery('<div class="ui-daterangepicker ui-widget ui-helper-clearfix ui-widget-content ui-corner-all"></div>');jQuery.fn.restoreDateFromData=
function(){jQuery(this).data("saveDate")&&jQuery(this).datepicker("setDate",jQuery(this).data("saveDate")).removeData("saveDate");return this};jQuery.fn.saveDateToData=function(){jQuery(this).data("saveDate")||jQuery(this).data("saveDate",jQuery(this).datepicker("getDate"));return this};jQuery.fn.clickActions=function(j,n,o){if(jQuery(this).is(".ui-daterangepicker-specificDate")){o.hide();n.show();j.find(".title-start").text(e.presets.specificDate);j.find(".range-start").restoreDateFromData().show(400);
j.find(".range-end").restoreDateFromData().hide(400);setTimeout(function(){o.fadeIn()},400)}else if(jQuery(this).is(".ui-daterangepicker-allDatesBefore")){o.hide();n.show();j.find(".title-end").text(e.presets.allDatesBefore);j.find(".range-start").saveDateToData().datepicker("setDate",e.earliestDate).hide(400);j.find(".range-end").restoreDateFromData().show(400);setTimeout(function(){o.fadeIn()},400)}else if(jQuery(this).is(".ui-daterangepicker-allDatesAfter")){o.hide();n.show();j.find(".title-start").text(e.presets.allDatesAfter);
j.find(".range-start").restoreDateFromData().show(400);j.find(".range-end").saveDateToData().datepicker("setDate",e.latestDate).hide(400);setTimeout(function(){o.fadeIn()},400)}else if(jQuery(this).is(".ui-daterangepicker-dateRange")){o.hide();n.show();j.find(".title-start").text(e.rangeStartTitle);j.find(".title-end").text(e.rangeEndTitle);j.find(".range-start").restoreDateFromData().show(400);j.find(".range-end").restoreDateFromData().show(400);setTimeout(function(){o.fadeIn()},400)}else{o.hide();
j.find(".range-start, .range-end").hide(400,function(){n.hide()});var p=typeof jQuery(this).data("dateStart")=="string"?Date.parse(jQuery(this).data("dateStart")):jQuery(this).data("dateStart")(),q=typeof jQuery(this).data("dateEnd")=="string"?Date.parse(jQuery(this).data("dateEnd")):jQuery(this).data("dateEnd")();j.find(".range-start").datepicker("setDate",p).find(".ui-datepicker-current-day").trigger("click");j.find(".range-end").datepicker("setDate",q).find(".ui-datepicker-current-day").trigger("click")}return false};
var m=jQuery('<div class="ranges ui-widget-header ui-corner-all ui-helper-clearfix"><div class="range-start"><span class="title-start">Start Date</span></div><div class="range-end"><span class="title-end">End Date</span></div></div>').appendTo(h);m.find(".range-start, .range-end").datepicker(e.datepickerOptions);m.find(".range-start").datepicker("setDate",c);m.find(".range-end").datepicker("setDate",a);var k=jQuery('<button class="btnDone ui-state-default ui-corner-all">'+e.doneButtonText+"</button>").click(function(){h.find(".ui-datepicker-current-day").trigger("click");
i();e.onClose()}).hover(function(){jQuery(this).addClass("ui-state-hover")},function(){jQuery(this).removeClass("ui-state-hover")}).appendTo(m);jQuery(this).click(function(){h.is(":visible")?i():d();return false});m.css("display","none").find(".range-start, .range-end, .btnDone").css("display","none");jQuery(e.appendTo).append(h);h.wrap('<div class="ui-daterangepickercontain"></div>');e.posX&&h.parent().css("left",e.posX);e.posY&&h.parent().css("top",e.posY);if(e.arrows&&l.size()==1){c=jQuery('<a href="#" class="ui-daterangepicker-prev ui-corner-all" title="'+
e.prevLinkText+'"><span class="ui-icon ui-icon-circle-triangle-w">'+e.prevLinkText+"</span></a>");g=jQuery('<a href="#" class="ui-daterangepicker-next ui-corner-all" title="'+e.nextLinkText+'"><span class="ui-icon ui-icon-circle-triangle-e">'+e.nextLinkText+"</span></a>");jQuery(this).addClass("ui-rangepicker-input ui-widget-content").wrap('<div class="ui-daterangepicker-arrows ui-widget ui-widget-header ui-helper-clearfix ui-corner-all"></div>').before(c).before(g).parent().find("a").click(function(){var j=
m.find(".range-start").datepicker("getDate"),n=m.find(".range-end").datepicker("getDate"),o=Math.abs((new TimeSpan(j-n)).getTotalMilliseconds())+864E5;if(jQuery(this).is(".ui-daterangepicker-prev"))o=-o;m.find(".range-start, .range-end ").each(function(){var p=jQuery(this).datepicker("getDate");if(p==null)return false;jQuery(this).datepicker("setDate",p.add({milliseconds:o})).find(".ui-datepicker-current-day").trigger("click")});return false}).hover(function(){jQuery(this).addClass("ui-state-hover")},
function(){jQuery(this).removeClass("ui-state-hover")})}jQuery(document).click(function(){h.is(":visible")&&i()});h.click(function(j){return $.browser.msie?j.srcElement.id!="usedatescb"?false:true:j.target.id!="usedatescb"?false:true}).hide();return this};
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan",
"Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,
feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,
tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",
PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};Date.getMonthNumberFromName=function(a){var b=Date.CultureInfo.monthNames,d=Date.CultureInfo.abbreviatedMonthNames;a=a.toLowerCase();for(var i=0;i<b.length;i++)if(b[i].toLowerCase()==a||d[i].toLowerCase()==a)return i;return-1};
Date.getDayNumberFromName=function(a){var b=Date.CultureInfo.dayNames,d=Date.CultureInfo.abbreviatedDayNames;a=a.toLowerCase();for(var i=0;i<b.length;i++)if(b[i].toLowerCase()==a||d[i].toLowerCase()==a)return i;return-1};Date.isLeapYear=function(a){return a%4===0&&a%100!==0||a%400===0};Date.getDaysInMonth=function(a,b){return[31,Date.isLeapYear(a)?29:28,31,30,31,30,31,31,30,31,30,31][b]};Date.getTimezoneOffset=function(a,b){return b?Date.CultureInfo.abbreviatedTimeZoneDST[a.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[a.toUpperCase()]};
Date.getTimezoneAbbreviation=function(a,b){var d=b?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,i;for(i in d)if(d[i]===a)return i;return null};Date.prototype.clone=function(){return new Date(this.getTime())};Date.prototype.compareTo=function(a){if(isNaN(this))throw Error(this);if(a instanceof Date&&!isNaN(a))return this>a?1:this<a?-1:0;else throw new TypeError(a);};Date.prototype.equals=function(a){return this.compareTo(a)===0};
Date.prototype.between=function(a,b){var d=this.getTime();return d>=a.getTime()&&d<=b.getTime()};Date.prototype.addMilliseconds=function(a){this.setMilliseconds(this.getMilliseconds()+a);return this};Date.prototype.addSeconds=function(a){return this.addMilliseconds(a*1E3)};Date.prototype.addMinutes=function(a){return this.addMilliseconds(a*6E4)};Date.prototype.addHours=function(a){return this.addMilliseconds(a*36E5)};Date.prototype.addDays=function(a){return this.addMilliseconds(a*864E5)};
Date.prototype.addWeeks=function(a){return this.addMilliseconds(a*6048E5)};Date.prototype.addMonths=function(a){var b=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+a);this.setDate(Math.min(b,this.getDaysInMonth()));return this};Date.prototype.addYears=function(a){return this.addMonths(a*12)};
Date.prototype.add=function(a){if(typeof a=="number"){this._orient=a;return this}if(a.millisecond||a.milliseconds)this.addMilliseconds(a.millisecond||a.milliseconds);if(a.second||a.seconds)this.addSeconds(a.second||a.seconds);if(a.minute||a.minutes)this.addMinutes(a.minute||a.minutes);if(a.hour||a.hours)this.addHours(a.hour||a.hours);if(a.month||a.months)this.addMonths(a.month||a.months);if(a.year||a.years)this.addYears(a.year||a.years);if(a.day||a.days)this.addDays(a.day||a.days);return this};
Date._validate=function(a,b,d,i){if(typeof a!="number")throw new TypeError(a+" is not a Number.");else if(a<b||a>d)throw new RangeError(a+" is not a valid value for "+i+".");return true};Date.validateMillisecond=function(a){return Date._validate(a,0,999,"milliseconds")};Date.validateSecond=function(a){return Date._validate(a,0,59,"seconds")};Date.validateMinute=function(a){return Date._validate(a,0,59,"minutes")};Date.validateHour=function(a){return Date._validate(a,0,23,"hours")};
Date.validateDay=function(a,b,d){return Date._validate(a,1,Date.getDaysInMonth(b,d),"days")};Date.validateMonth=function(a){return Date._validate(a,0,11,"months")};Date.validateYear=function(a){return Date._validate(a,1,9999,"seconds")};
Date.prototype.set=function(a){if(!a.millisecond&&a.millisecond!==0)a.millisecond=-1;if(!a.second&&a.second!==0)a.second=-1;if(!a.minute&&a.minute!==0)a.minute=-1;if(!a.hour&&a.hour!==0)a.hour=-1;if(!a.day&&a.day!==0)a.day=-1;if(!a.month&&a.month!==0)a.month=-1;if(!a.year&&a.year!==0)a.year=-1;a.millisecond!=-1&&Date.validateMillisecond(a.millisecond)&&this.addMilliseconds(a.millisecond-this.getMilliseconds());a.second!=-1&&Date.validateSecond(a.second)&&this.addSeconds(a.second-this.getSeconds());
a.minute!=-1&&Date.validateMinute(a.minute)&&this.addMinutes(a.minute-this.getMinutes());a.hour!=-1&&Date.validateHour(a.hour)&&this.addHours(a.hour-this.getHours());a.month!==-1&&Date.validateMonth(a.month)&&this.addMonths(a.month-this.getMonth());a.year!=-1&&Date.validateYear(a.year)&&this.addYears(a.year-this.getFullYear());a.day!=-1&&Date.validateDay(a.day,this.getFullYear(),this.getMonth())&&this.addDays(a.day-this.getDate());a.timezone&&this.setTimezone(a.timezone);a.timezoneOffset&&this.setTimezoneOffset(a.timezoneOffset);
return this};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return a%4===0&&a%100!==0||a%400===0};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun())};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1})};
Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};Date.prototype.moveToDayOfWeek=function(a,b){var d=(a-this.getDay()+7*(b||+1))%7;return this.addDays(d===0?d+=7*(b||+1):d)};Date.prototype.moveToMonth=function(a,b){var d=(a-this.getMonth()+12*(b||+1))%12;return this.addMonths(d===0?d+=12*(b||+1):d)};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/864E5)};
Date.prototype.getWeekOfYear=function(a){var b=this.getFullYear(),d=this.getMonth(),i=this.getDate();a=a||Date.CultureInfo.firstDayOfWeek;var l=8-(new Date(b,0,1)).getDay();if(l==8)l=1;d=(Date.UTC(b,d,i,0,0,0)-Date.UTC(b,0,1,0,0,0))/864E5+1;d=Math.floor((d-l+7)/7);if(d===a){b--;b=8-(new Date(b,0,1)).getDay();d=b==2||b==8?53:52}return d};Date.prototype.isDST=function(){return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};
Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};Date.prototype.setTimezoneOffset=function(a){var b=this.getTimezoneOffset();this.addMinutes(Number(a)*-6/10-b);return this};Date.prototype.setTimezone=function(a){return this.setTimezoneOffset(Date.getTimezoneOffset(a))};Date.prototype.getUTCOffset=function(){var a=this.getTimezoneOffset()*-10/6;if(a<0){a=(a-1E4).toString();return a[0]+a.substr(2)}else{a=(a+1E4).toString();return"+"+a.substr(1)}};
Date.prototype.getDayName=function(a){return a?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};Date.prototype.getMonthName=function(a){return a?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};Date.prototype._toString=Date.prototype.toString;
Date.prototype.toString=function(a){var b=this,d=function(i){return i.toString().length==1?"0"+i:i};return a?a.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(i){switch(i){case "hh":return d(b.getHours()<13?b.getHours():b.getHours()-12);case "h":return b.getHours()<13?b.getHours():b.getHours()-12;case "HH":return d(b.getHours());case "H":return b.getHours();case "mm":return d(b.getMinutes());case "m":return b.getMinutes();case "ss":return d(b.getSeconds());case "s":return b.getSeconds();
case "yyyy":return b.getFullYear();case "yy":return b.getFullYear().toString().substring(2,4);case "dddd":return b.getDayName();case "ddd":return b.getDayName(true);case "dd":return d(b.getDate());case "d":return b.getDate().toString();case "MMMM":return b.getMonthName();case "MMM":return b.getMonthName(true);case "MM":return d(b.getMonth()+1);case "M":return b.getMonth()+1;case "t":return b.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case "tt":return b.getHours()<
12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case "zzz":case "zz":case "z":return""}}):this._toString()};Date.now=function(){return new Date};Date.today=function(){return Date.now().clearTime()};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this};
Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var a={};a[this._dateElement]=this;return Date.now().add(a)};Number.prototype.ago=function(){var a={};a[this._dateElement]=this*-1;return Date.now().add(a)};
(function(){for(var a=Date.prototype,b=Number.prototype,d="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),i="january february march april may june july august september october november december".split(/\s/),l="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),e=function(c){return function(){if(this._is){this._is=false;return this.getDay()==c}return this.moveToDayOfWeek(c,this._orient)}},f=0;f<d.length;f++)a[d[f]]=a[d[f].substring(0,3)]=e(f);d=function(c){return function(){if(this._is){this._is=
false;return this.getMonth()===c}return this.moveToMonth(c,this._orient)}};for(e=0;e<i.length;e++)a[i[e]]=a[i[e].substring(0,3)]=d(e);d=function(c){return function(){if(c.substring(c.length-1)!="s")c+="s";return this["add"+c](this._orient)}};e=function(c){return function(){this._dateElement=c;return this}};for(f=0;f<l.length;f++){i=l[f].toLowerCase();a[i]=a[i+"s"]=d(l[f]);b[i]=b[i+"s"]=e(i)}})();Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};
Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};
Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};
(function(){Date.Parsing={Exception:function(e){this.message="Parse error at '"+e.substring(0,10)+" ...'"}};for(var a=Date.Parsing,b=a.Operators={rtoken:function(e){return function(f){var c=f.match(e);if(c)return[c[0],f.substring(c[0].length)];else throw new a.Exception(f);}},token:function(){return function(e){return b.rtoken(RegExp("^s*"+e+"s*"))(e)}},stoken:function(e){return b.rtoken(RegExp("^"+e))},until:function(e){return function(f){for(var c=[],g=null;f.length;){try{g=e.call(this,f)}catch(h){c.push(g[0]);
f=g[1];continue}break}return[c,f]}},many:function(e){return function(f){for(var c=[],g=null;f.length;){try{g=e.call(this,f)}catch(h){return[c,f]}c.push(g[0]);f=g[1]}return[c,f]}},optional:function(e){return function(f){var c=null;try{c=e.call(this,f)}catch(g){return[null,f]}return[c[0],c[1]]}},not:function(e){return function(f){try{e.call(this,f)}catch(c){return[null,f]}throw new a.Exception(f);}},ignore:function(e){return e?function(f){var c=null;c=e.call(this,f);return[null,c[1]]}:null},product:function(){for(var e=
arguments[0],f=Array.prototype.slice.call(arguments,1),c=[],g=0;g<e.length;g++)c.push(b.each(e[g],f));return c},cache:function(e){var f={},c=null;return function(g){try{c=f[g]=f[g]||e.call(this,g)}catch(h){c=f[g]=h}if(c instanceof a.Exception)throw c;else return c}},any:function(){var e=arguments;return function(f){for(var c=null,g=0;g<e.length;g++)if(e[g]!=null){try{c=e[g].call(this,f)}catch(h){c=null}if(c)return c}throw new a.Exception(f);}},each:function(){var e=arguments;return function(f){for(var c=
[],g=null,h=0;h<e.length;h++)if(e[h]!=null){try{g=e[h].call(this,f)}catch(m){throw new a.Exception(f);}c.push(g[0]);f=g[1]}return[c,f]}},all:function(){var e=e;return e.each(e.optional(arguments))},sequence:function(e,f,c){f=f||b.rtoken(/^\s*/);c=c||null;if(e.length==1)return e[0];return function(g){for(var h=null,m=null,k=[],j=0;j<e.length;j++){try{h=e[j].call(this,g)}catch(n){break}k.push(h[0]);try{m=f.call(this,h[1])}catch(o){m=null;break}g=m[1]}if(!h)throw new a.Exception(g);if(m)throw new a.Exception(m[1]);
if(c)try{h=c.call(this,h[1])}catch(p){throw new a.Exception(h[1]);}return[k,h?h[1]:g]}},between:function(e,f,c){c=c||e;var g=b.each(b.ignore(e),f,b.ignore(c));return function(h){h=g.call(this,h);return[[h[0][0],r[0][2]],h[1]]}},list:function(e,f,c){f=f||b.rtoken(/^\s*/);c=c||null;return e instanceof Array?b.each(b.product(e.slice(0,-1),b.ignore(f)),e.slice(-1),b.ignore(c)):b.each(b.many(b.each(e,b.ignore(f))),px,b.ignore(c))},set:function(e,f,c){f=f||b.rtoken(/^\s*/);c=c||null;return function(g){var h=
null;for(var m=h=null,k=null,j=[[],g],n=false,o=0;o<e.length;o++){h=m=null;n=e.length==1;try{h=e[o].call(this,g)}catch(p){continue}k=[[h[0]],h[1]];if(h[1].length>0&&!n)try{m=f.call(this,h[1])}catch(q){n=true}else n=true;if(!n&&m[1].length===0)n=true;if(!n){h=[];for(n=0;n<e.length;n++)o!=n&&h.push(e[n]);h=b.set(h,f).call(this,m[1]);if(h[0].length>0){k[0]=k[0].concat(h[0]);k[1]=h[1]}}if(k[1].length<j[1].length)j=k;if(j[1].length===0)break}if(j[0].length===0)return j;if(c){try{m=c.call(this,j[1])}catch(s){throw new a.Exception(j[1]);
}j[1]=m[1]}return j}},forward:function(e,f){return function(c){return e[f].call(this,c)}},replace:function(e,f){return function(c){c=e.call(this,c);return[f,c[1]]}},process:function(e,f){return function(c){c=e.call(this,c);return[f.call(this,c[0]),c[1]]}},min:function(e,f){return function(c){var g=f.call(this,c);if(g[0].length<e)throw new a.Exception(c);return g}}},d=function(e){return function(){var f=null,c=[];if(arguments.length>1)f=Array.prototype.slice.call(arguments);else if(arguments[0]instanceof
Array)f=arguments[0];if(f)for(var g=f.shift();0<g.length;){f.unshift(g[0]);c.push(e.apply(null,f));f.shift();return c}else return e.apply(null,arguments)}},i="optional not ignore cache".split(/\s/),l=0;l<i.length;l++)b[i[l]]=d(b[i[l]]);d=function(e){return function(){return arguments[0]instanceof Array?e.apply(null,arguments[0]):e.apply(null,arguments)}};i="each any all".split(/\s/);for(l=0;l<i.length;l++)b[i[l]]=d(b[i[l]])})();
(function(){var a=function(c){for(var g=[],h=0;h<c.length;h++)if(c[h]instanceof Array)g=g.concat(a(c[h]));else c[h]&&g.push(c[h]);return g};Date.Grammar={};Date.Translator={hour:function(c){return function(){this.hour=Number(c)}},minute:function(c){return function(){this.minute=Number(c)}},second:function(c){return function(){this.second=Number(c)}},meridian:function(c){return function(){this.meridian=c.slice(0,1).toLowerCase()}},timezone:function(c){return function(){var g=c.replace(/[^\d\+\-]/g,
"");if(g.length)this.timezoneOffset=Number(g);else this.timezone=c.toLowerCase()}},day:function(c){var g=c[0];return function(){this.day=Number(g.match(/\d+/)[0])}},month:function(c){return function(){this.month=c.length==3?Date.getMonthNumberFromName(c):Number(c)-1}},year:function(c){return function(){var g=Number(c);this.year=c.length>2?g:g+(g+2E3<Date.CultureInfo.twoDigitYearMax?2E3:1900)}},rday:function(c){return function(){switch(c){case "yesterday":this.days=-1;break;case "tomorrow":this.days=
1;break;case "today":this.days=0;break;case "now":this.days=0;this.now=true;break}}},finishExact:function(c){c=c instanceof Array?c:[c];var g=new Date;this.year=g.getFullYear();this.month=g.getMonth();this.day=1;for(g=this.second=this.minute=this.hour=0;g<c.length;g++)c[g]&&c[g].call(this);this.hour=this.meridian=="p"&&this.hour<13?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");c=new Date(this.year,this.month,
this.day,this.hour,this.minute,this.second);if(this.timezone)c.set({timezone:this.timezone});else this.timezoneOffset&&c.set({timezoneOffset:this.timezoneOffset});return c},finish:function(c){c=c instanceof Array?a(c):[c];if(c.length===0)return null;for(var g=0;g<c.length;g++)typeof c[g]=="function"&&c[g].call(this);if(this.now)return new Date;c=Date.today();if(this.days!=null||this.orient||this.operator){var h,m;m=this.orient=="past"||this.operator=="subtract"?-1:1;if(this.weekday){this.unit="day";
g=Date.getDayNumberFromName(this.weekday)-c.getDay();h=7;this.days=g?(g+m*h)%h:m*h}if(this.month){this.unit="month";g=this.month-c.getMonth();h=12;this.months=g?(g+m*h)%h:m*h;this.month=null}if(!this.unit)this.unit="day";if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value)this.value=1;if(this.unit=="week"){this.unit="day";this.value*=7}this[this.unit+"s"]=this.value*m}return c.add(this)}else{if(this.meridian&&this.hour)this.hour=this.hour<13&&this.meridian=="p"?this.hour+12:this.hour;
if(this.weekday&&!this.day)this.day=c.addDays(Date.getDayNumberFromName(this.weekday)-c.getDay()).getDate();if(this.month&&!this.day)this.day=1;return c.set(this)}}};var b=Date.Parsing.Operators,d=Date.Grammar,i=Date.Translator,l;d.datePartDelimiter=b.rtoken(/^([\s\-\.\,\/\x27]+)/);d.timePartDelimiter=b.stoken(":");d.whiteSpace=b.rtoken(/^\s*/);d.generalDelimiter=b.rtoken(/^(([\s\,]|at|on)+)/);var e={};d.ctoken=function(c){var g=e[c];if(!g){g=Date.CultureInfo.regexPatterns;for(var h=c.split(/\s+/),
m=[],k=0;k<h.length;k++)m.push(b.replace(b.rtoken(g[h[k]]),h[k]));g=e[c]=b.any.apply(null,m)}return g};d.ctoken2=function(c){return b.rtoken(Date.CultureInfo.regexPatterns[c])};d.h=b.cache(b.process(b.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),i.hour));d.hh=b.cache(b.process(b.rtoken(/^(0[0-9]|1[0-2])/),i.hour));d.H=b.cache(b.process(b.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),i.hour));d.HH=b.cache(b.process(b.rtoken(/^([0-1][0-9]|2[0-3])/),i.hour));d.m=b.cache(b.process(b.rtoken(/^([0-5][0-9]|[0-9])/),i.minute));
d.mm=b.cache(b.process(b.rtoken(/^[0-5][0-9]/),i.minute));d.s=b.cache(b.process(b.rtoken(/^([0-5][0-9]|[0-9])/),i.second));d.ss=b.cache(b.process(b.rtoken(/^[0-5][0-9]/),i.second));d.hms=b.cache(b.sequence([d.H,d.mm,d.ss],d.timePartDelimiter));d.t=b.cache(b.process(d.ctoken2("shortMeridian"),i.meridian));d.tt=b.cache(b.process(d.ctoken2("longMeridian"),i.meridian));d.z=b.cache(b.process(b.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),i.timezone));d.zz=b.cache(b.process(b.rtoken(/^(\+|\-)\s*\d\d\d\d/),i.timezone));
d.zzz=b.cache(b.process(d.ctoken2("timezone"),i.timezone));d.timeSuffix=b.each(b.ignore(d.whiteSpace),b.set([d.tt,d.zzz]));d.time=b.each(b.optional(b.ignore(b.stoken("T"))),d.hms,d.timeSuffix);d.d=b.cache(b.process(b.each(b.rtoken(/^([0-2]\d|3[0-1]|\d)/),b.optional(d.ctoken2("ordinalSuffix"))),i.day));d.dd=b.cache(b.process(b.each(b.rtoken(/^([0-2]\d|3[0-1])/),b.optional(d.ctoken2("ordinalSuffix"))),i.day));d.ddd=d.dddd=b.cache(b.process(d.ctoken("sun mon tue wed thu fri sat"),function(c){return function(){this.weekday=
c}}));d.M=b.cache(b.process(b.rtoken(/^(1[0-2]|0\d|\d)/),i.month));d.MM=b.cache(b.process(b.rtoken(/^(1[0-2]|0\d)/),i.month));d.MMM=d.MMMM=b.cache(b.process(d.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),i.month));d.y=b.cache(b.process(b.rtoken(/^(\d\d?)/),i.year));d.yy=b.cache(b.process(b.rtoken(/^(\d\d)/),i.year));d.yyy=b.cache(b.process(b.rtoken(/^(\d\d?\d?\d?)/),i.year));d.yyyy=b.cache(b.process(b.rtoken(/^(\d\d\d\d)/),i.year));l=function(){return b.each(b.any.apply(null,arguments),
b.not(d.ctoken2("timeContext")))};d.day=l(d.d,d.dd);d.month=l(d.M,d.MMM);d.year=l(d.yyyy,d.yy);d.orientation=b.process(d.ctoken("past future"),function(c){return function(){this.orient=c}});d.operator=b.process(d.ctoken("add subtract"),function(c){return function(){this.operator=c}});d.rday=b.process(d.ctoken("yesterday tomorrow today now"),i.rday);d.unit=b.process(d.ctoken("minute hour day week month year"),function(c){return function(){this.unit=c}});d.value=b.process(b.rtoken(/^\d\d?(st|nd|rd|th)?/),
function(c){return function(){this.value=c.replace(/\D/g,"")}});d.expression=b.set([d.rday,d.operator,d.value,d.unit,d.orientation,d.ddd,d.MMM]);l=function(){return b.set(arguments,d.datePartDelimiter)};d.mdy=l(d.ddd,d.month,d.day,d.year);d.ymd=l(d.ddd,d.year,d.month,d.day);d.dmy=l(d.ddd,d.day,d.month,d.year);d.date=function(c){return(d[Date.CultureInfo.dateElementOrder]||d.mdy).call(this,c)};d.format=b.process(b.many(b.any(b.process(b.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),
function(c){if(d[c])return d[c];else throw Date.Parsing.Exception(c);}),b.process(b.rtoken(/^[^dMyhHmstz]+/),function(c){return b.ignore(b.stoken(c))}))),function(c){return b.process(b.each.apply(null,c),i.finishExact)});var f={};d.formats=function(c){if(c instanceof Array){for(var g=[],h=0;h<c.length;h++)g.push(f[c[h]]=f[c[h]]||d.format(c[h])[0]);return b.any.apply(null,g)}else return f[c]=f[c]||d.format(c)[0]};d._formats=d.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz",
"d"]);d._start=b.process(b.set([d.date,d.time,d.expression],d.generalDelimiter,d.whiteSpace),i.finish);d.start=function(c){try{var g=d._formats.call({},c);if(g[1].length===0)return g}catch(h){}return d._start.call({},c)}})();Date._parse=Date.parse;Date.parse=function(a){var b=null;if(!a)return null;try{b=Date.Grammar.start.call({},a)}catch(d){return null}return b[1].length===0?b[0]:null};
Date.getParseFunction=function(a){var b=Date.Grammar.formats(a);return function(d){var i=null;try{i=b.call({},d)}catch(l){return null}return i[1].length===0?i[0]:null}};Date.parseExact=function(a,b){return Date.getParseFunction(b)(a)};
var TimeSpan=function(a,b,d,i,l){for(var e="days hours minutes seconds milliseconds".split(/\s+/),f=function(k){return function(){return this[k]}},c=function(k){return function(j){this[k]=j;return this}},g=0;g<e.length;g++){var h=e[g],m=h.slice(0,1).toUpperCase()+h.slice(1);TimeSpan.prototype[h]=0;TimeSpan.prototype["get"+m]=f(h);TimeSpan.prototype["set"+m]=c(h)}if(arguments.length==4){this.setDays(a);this.setHours(b);this.setMinutes(d);this.setSeconds(i)}else if(arguments.length==5){this.setDays(a);
this.setHours(b);this.setMinutes(d);this.setSeconds(i);this.setMilliseconds(l)}else if(arguments.length==1&&typeof a=="number"){e=a<0?-1:+1;this.setMilliseconds(Math.abs(a));this.setDays(Math.floor(this.getMilliseconds()/864E5)*e);this.setMilliseconds(this.getMilliseconds()%864E5);this.setHours(Math.floor(this.getMilliseconds()/36E5)*e);this.setMilliseconds(this.getMilliseconds()%36E5);this.setMinutes(Math.floor(this.getMilliseconds()/6E4)*e);this.setMilliseconds(this.getMilliseconds()%6E4);this.setSeconds(Math.floor(this.getMilliseconds()/
1E3)*e);this.setMilliseconds(this.getMilliseconds()%1E3);this.setMilliseconds(this.getMilliseconds()*e)}this.getTotalMilliseconds=function(){return this.getDays()*864E5+this.getHours()*36E5+this.getMinutes()*6E4+this.getSeconds()*1E3};this.compareTo=function(k){var j=new Date(1970,1,1,this.getHours(),this.getMinutes(),this.getSeconds());k=k===null?new Date(1970,1,1,0,0,0):new Date(1970,1,1,k.getHours(),k.getMinutes(),k.getSeconds());return j<k?-1:j>k?1:0};this.equals=function(k){return this.compareTo(k)===
0};this.add=function(k){return k===null?this:this.addSeconds(k.getTotalMilliseconds()/1E3)};this.subtract=function(k){return k===null?this:this.addSeconds(-k.getTotalMilliseconds()/1E3)};this.addDays=function(k){return new TimeSpan(this.getTotalMilliseconds()+k*864E5)};this.addHours=function(k){return new TimeSpan(this.getTotalMilliseconds()+k*36E5)};this.addMinutes=function(k){return new TimeSpan(this.getTotalMilliseconds()+k*6E4)};this.addSeconds=function(k){return new TimeSpan(this.getTotalMilliseconds()+
k*1E3)};this.addMilliseconds=function(k){return new TimeSpan(this.getTotalMilliseconds()+k)};this.get12HourHour=function(){return this.getHours()>12?this.getHours()-12:this.getHours()===0?12:this.getHours()};this.getDesignator=function(){return this.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator};this.toString=function(k){this._toString=function(){return this.getDays()!==null&&this.getDays()>0?this.getDays()+"."+this.getHours()+":"+this.p(this.getMinutes())+":"+this.p(this.getSeconds()):
this.getHours()+":"+this.p(this.getMinutes())+":"+this.p(this.getSeconds())};this.p=function(n){return n.toString().length<2?"0"+n:n};var j=this;return k?k.replace(/dd?|HH?|hh?|mm?|ss?|tt?/g,function(n){switch(n){case "d":return j.getDays();case "dd":return j.p(j.getDays());case "H":return j.getHours();case "HH":return j.p(j.getHours());case "h":return j.get12HourHour();case "hh":return j.p(j.get12HourHour());case "m":return j.getMinutes();case "mm":return j.p(j.getMinutes());case "s":return j.getSeconds();
case "ss":return j.p(j.getSeconds());case "t":return(j.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator).substring(0,1);case "tt":return j.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator}}):this._toString()};return this};Date.prototype.getTimeOfDay=function(){return new TimeSpan(0,this.getHours(),this.getMinutes(),this.getSeconds(),this.getMilliseconds())};
var TimePeriod=function(a,b,d,i,l,e,f){for(var c="years months days hours minutes seconds milliseconds".split(/\s+/),g=function(n){return function(){return this[n]}},h=function(n){return function(o){this[n]=o;return this}},m=0;m<c.length;m++){var k=c[m],j=k.slice(0,1).toUpperCase()+k.slice(1);TimePeriod.prototype[k]=0;TimePeriod.prototype["get"+j]=g(k);TimePeriod.prototype["set"+j]=h(k)}if(arguments.length==7){this.years=a;this.months=b;this.setDays(d);this.setHours(i);this.setMinutes(l);this.setSeconds(e);
this.setMilliseconds(f)}else if(arguments.length==2&&arguments[0]instanceof Date&&arguments[1]instanceof Date){c=a.clone();g=b.clone();h=c.clone();m=c>g?-1:+1;this.years=g.getFullYear()-c.getFullYear();h.addYears(this.years);if(m==+1)h>g&&this.years!==0&&this.years--;else h<g&&this.years!==0&&this.years++;c.addYears(this.years);if(m==+1)for(;c<g&&c.clone().addDays(Date.getDaysInMonth(c.getYear(),c.getMonth()))<g;){c.addMonths(1);this.months++}else for(;c>g&&c.clone().addDays(-c.getDaysInMonth())>
g;){c.addMonths(-1);this.months--}c=g-c;if(c!==0){c=new TimeSpan(c);this.setDays(c.getDays());this.setHours(c.getHours());this.setMinutes(c.getMinutes());this.setSeconds(c.getSeconds());this.setMilliseconds(c.getMilliseconds())}}return this};

