(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.date=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i0)--n;diff+=7*n;this.update(diff*_day);return this};date.prototype.update=function(ms){this.date=new Date(this.date.getTime()+ms);return this};function leapyear(yr){return yr%4===0&&yr%100!==0||yr%400===0}},{debug:10}],3:[function(require,module,exports){module.exports={op:{plus:["and","plus","+","add","on"],minus:["minus","subtract"],times:["times","multiply"],divide:["divide"]},o:{plus:["at","in","past","late","later","after","next","from","start","starting","since","coming"],minus:["last","minus","subtract","ago","before","from"]},n:{.25:["quarter"],.5:["half","1/2","half an"],0:["zero"],1:["one","a","an","first"],2:["two","second"],3:["three","third"],4:["four","fourth"],5:["five","fifth"],6:["six","sixth"],7:["seven","seventh"],8:["eight","eighth"],9:["nine","ninth"],10:["ten","tenth"],11:["eleven","eleventh"],12:["twelve","twelveth"],13:["thirteen","thirteenth"],14:["fourteen","fourteenth"],15:["fifteen","fifteenth"],16:["sixteen","sixteenth"],17:["seventeen","seventeenth"],18:["eighteen","eighteenth"],19:["nineteen","nineteenth"],20:["twenty","twentieth"],30:["thirty","thirtieth"],40:["fourty","fourtieth"],50:["fifty","fiftieth"],60:["sixty","sixtieth"],70:["seventy","seventieth"],80:["eighty","eightieth"],90:["ninety","ninetieth"],100:["hundred","hundreds","hundredth"],1000:["thousand","thousands","thousandth","k","K"]},t:{},dt:{s:["second","seconds","s","sec","secs"],m:["minute","minutes","m","min","mins"],h:["hour","hours","h","hr","hrs"],d:["day","days","d","dai"],w:["week","weeks","w","wk","wks"],M:["month","months","monthes","M","mo","moon","moons"],y:["year","years","y","yr","yrs"]},T:{"t:,dt:=3h":["later","soon"],"t:=1d,dt:":["st","nd","rd","th","st day","nd day","rd day","th day"],"t:,dt:1w":["st week","nd week","rd week","th week"],"t:,dt:14d":["day","fortnight"],"t:=0h=0m=0s1mer,dt:":["pm","p.m","p.m.","noon"],"t:,dt:1d":["tomorrow","tmr"],"t:,dt:-1d":["yesterday","ytd"],"t:,0dt:":["today"],"t:=2h=0m=0s1mer,dt:":["afternoon"],"t:=6h=0m=0s0mer,dt:":["dawn"],"t:=7h=0m=0s0mer,dt:":["am","a.m","a.m."],"t:=7h=0m=0s1mer,dt:":["evening"],"t:=8h=0m=0s0mer,dt:":["morning"],"t:=9h=0m=0s1mer,dt:":["tonight","night"],"t:=0h=0m=0s0mer,dt:1d":["midnight"],"t:,dt:=0w0wd":["sunday","sun"],"t:,dt:=0w1wd":["monday","mon"],"t:,dt:=0w2wd":["tuesday","tue","tues"],"t:,dt:=0w3wd":["wednesday","wed"],"t:,dt:=0w4wd":["thursday","thu","thur","thurs"],"t:,dt:=0w5wd":["friday","fri"],"t:,dt:=0w6wd":["saturday","sat"],"t:1M=1d,dt:":["january","jan"],"t:2M=1d,dt:":["february","feb"],"t:3M=1d,dt:":["march","mar"],"t:4M=1d,dt:":["april","apr"],"t:5M=1d,dt:":["may"],"t:6M=1d,dt:":["june","jun"],"t:7M=1d,dt:":["july","jul"],"t:8M=1d,dt:":["august","aug"],"t:9M=1d,dt:":["september","sept","sep"],"t:10M=1d,dt:":["october","oct"],"t:11M=1d,dt:":["november","nov"],"t:12M=1d,dt:":["december","dec"],"t:12M25d,dt:":["christmas"]},f:{1:["once"],2:["twice"]}}},{}],4:[function(require,module,exports){var _=require("./subdash");var util=require("./util");var symbol=require("./symbol");var tokenize=require("./tokenize");module.exports=norm;function norm(str,offset){try{var tokObj=tokenize(str);var syms=pickTokens(tokObj.symbols)||[];syms=reduce(syms,["n","n"]);syms=nTnRedistribute(syms);syms=reduce(syms,["o","o"]);var restored=restoreTokens(syms,tokObj);return restored}catch(e){return{str:str,tokens:[],normals:[]}}}function restoreTokens(syms,tokObj){var tokens=[],normals=[],tokensOut=tokObj.tokensOut,tokensIn=tokObj.tokensIn;syms=util.removeTnPlus(syms);for(var i=0;i0){res.push(sum);res.push(s);sum=null}}}return res}function execOp(L,op,R,offset){var otype=util.opType(L,op,R),res=null;if(_.includes(["nn"],otype)){res=nnOp(L,op,R)}else if(_.includes(["nT"],otype)){res=nTOp(L,op,R)}else if(_.includes(["TT"],otype)){res=TTOp(L,op,R)}else if(_.includes(["ToT","oT","To"],otype)){res=ToTOp(L,op,R,offset)}else if(_.includes(["oo"],otype)){res=ooOp(L,R)}else if(_.includes(["rT","TrT"],otype)){res=rTOp(L,R)}else if(_.includes(["cT","fcT","crT","fcrT"],otype)){res=cTOp(L,R)}else{res=op==null?[L,R]:[L,op,R]}return res}function atomicOp(Lval,op,Rval,dontOp){dontOp=dontOp||false;var oName=op.value;if(Lval==undefined){return oName=="minus"?Rval.toString().replace(/(\d)/,"-$1"):Rval}else if(Rval==undefined){return Lval}else{var defL=Lval.toString().match(/^=/),defR=Rval.toString().match(/^=/);var l=parseFloat(Lval.toString().replace(/^=/,"")),r=parseFloat(Rval.toString().replace(/^=/,""));if(defL&&defR){return r}else if(defL&&!defR){return r}else if(!defL&&defR){return l}else{if(dontOp){return l}else{if(oName=="minus"){return l-r}else if(oName=="plus"){return l+r}else if(oName=="times"){return l*r}else if(oName=="divide"){return l/r}}}}}function nnOp(L,op,R){var l=L.value,r=R.value;if(l>r){op=op||symbol("plus")}else{op=op||symbol("times")}var res=atomicOp(l,op,r);return symbol(res)}function nTnRedistribute(syms){if(syms.length<2){return syms}for(var i=0;i0?symbol("after"):symbol("before")}function nextAvailable(T,offset){var nextUnit=util.nextLargestUnit(T);var finT1=finalizeT([T],offset)[0],stdStr1=util.TtoStdT(finT1),UTC1=Date.parse(stdStr1),UTCnow=Date.parse(new Date),UTCdiff=UTC1-UTCnow;if(UTCdiff<0){T.dt[nextUnit]=(T.dt[nextUnit]||0)+1;var finT2=finalizeT([T],offset)[0];return finT2}else{return finT1}}function ToTOp(L,op,R,offset){if(L&&!R){R=symbol(util.nowT(offset))}else if(!L&&R){if(util.has_t(R)){var nextUnit=util.nextLargestUnit(R);R=nextAvailable(R,offset);L=execOp(symbol(.5),symbol("times"),symbol(nextUnit))}else{L=symbol(util.nowT(offset))}}else if(!L&&!R){L=symbol(util.nowT(offset));R=symbol(util.nowT(offset))}var Ttype=["t","dt"];for(var i=0;i12?value%12:value;syms[i]["t"]["h"]=isDefault+value}if(syms[i]["t"]["mer"]){var dt_h=(syms[i]["dt"]["h"]||"0").toString();dt_h=dt_h.replace(/^=/,"");if(syms[i]["t"]["mer"]==1){syms[i]["dt"]["h"]=parseFloat(dt_h)+12}delete syms[i]["t"]["mer"]}}}return syms}function weekModding(syms,offset){var offsetWD=new Date(util.TtoStdT(util.nowT())).getDay();for(var i=0;i0)this.stash.push(this.advance());return this.stash[--n]};parser.prototype.peek=function(){return this.lookahead(1)};parser.prototype.next=function(){var tok=this.stashed()||this.advance();return tok};parser.prototype.stashed=function(){var stashed=this.stash.shift();return stashed};parser.prototype.skip=function(len){this.str=this.str.substr(Array.isArray(len)?len[0].length:len)};parser.prototype.eos=function(){if(this.str.length)return;return"eos"};parser.prototype.space=function(){var captures;if(captures=/^([ \t]+)/.exec(this.str)){this.skip(captures);return this.advance()}};parser.prototype.second=function(){var captures;if(captures=/^s(ec|econd)?s?/.exec(this.str)){this.skip(captures);return"second"}};parser.prototype.minute=function(){var captures;if(captures=/^m(in|inute)?s?/.exec(this.str)){this.skip(captures);return"minute"}};parser.prototype.hour=function(){var captures;if(captures=/^h(r|our)s?/.exec(this.str)){this.skip(captures);return"hour"}};parser.prototype.day=function(){var captures;if(captures=/^d(ay)?s?/.exec(this.str)){this.skip(captures);return"day"}};parser.prototype.dayByName=function(){var captures;var r=new RegExp("^"+rDays.source);if(captures=r.exec(this.str)){var day=captures[1];this.skip(captures);this.date[day](1);return captures[1]}};parser.prototype.monthByName=function(){var captures;if(captures=rMonths.exec(this.str)){var day=captures[2];var month=captures[6];this.date.date.setMonth(months.indexOf(month));if(day)this.date.date.setDate(parseInt(day));this.skip(captures);return captures[0]}};parser.prototype.timeAgo=function(){var captures;if(captures=rAgo.exec(this.str)){var num=captures[1];var mod=captures[2];this.date[mod](-num);this.skip(captures);return"timeAgo"}};parser.prototype.week=function(){var captures;if(captures=/^w(k|eek)s?/.exec(this.str)){this.skip(captures);return"week"}};parser.prototype.month=function(){var captures;if(captures=/^mon(th)?(es|s)?\b/.exec(this.str)){this.skip(captures);return"month"}};parser.prototype.year=function(){var captures;if(captures=/^y(r|ear)s?/.exec(this.str)){this.skip(captures);return"year"}};parser.prototype.meridiem=function(){var captures;if(captures=rMeridiem.exec(this.str)){this.skip(captures);this.time(captures[1],captures[3],captures[5],captures[6]);return"meridiem"}};parser.prototype.hourminute=function(){var captures;if(captures=rHourMinute.exec(this.str)){this.skip(captures);this.time(captures[1],captures[3],captures[5],this._meridiem);return"hourminute"}};parser.prototype.athour=function(){var captures;if(captures=rAtHour.exec(this.str)){this.skip(captures);this.time(captures[1],0,0,this._meridiem);this._meridiem=null;return"athour"}};parser.prototype.time=function(h,m,s,meridiem){var d=this.date;var before=d.clone();if(meridiem){h="pm"==meridiem&&12>h?+h+12:h;h="am"==meridiem&&12==h?0:h}m=!m&&d.changed("minutes")?false:m;s=!s&&d.changed("seconds")?false:s;d.time(h,m,s)};parser.prototype.nextTime=function(before){var d=this.date;var orig=this.original;if(before<=d.date||rPast.test(orig))return this;if(rDays.test(orig)){d.day(7)}else if((before-d.date)/1e3>60){if(rMonths.test(orig)){d.day(0)}else{d.day(1)}}return this};parser.prototype.yesterday=function(){var captures;if(captures=/^(yes(terday)?)/.exec(this.str)){this.skip(captures);this.date.day(-1);return"yesterday"}};parser.prototype.tomorrow=function(){var captures;if(captures=/^tom(orrow)?/.exec(this.str)){this.skip(captures);this.date.day(1);return"tomorrow"}};parser.prototype.noon=function(){var captures;if(captures=/^noon\b/.exec(this.str)){this.skip(captures);var before=this.date.clone();this.date.date.setHours(12,0,0);return"noon"}};parser.prototype.midnight=function(){var captures;if(captures=/^midnight\b/.exec(this.str)){this.skip(captures);var before=this.date.clone();this.date.date.setHours(0,0,0);return"midnight"}};parser.prototype.night=function(){var captures;if(captures=/^night\b/.exec(this.str)){this.skip(captures);this._meridiem="pm";var before=this.date.clone();this.date.date.setHours(19,0,0);return"night"}};parser.prototype.evening=function(){var captures;if(captures=/^evening\b/.exec(this.str)){this.skip(captures);this._meridiem="pm";var before=this.date.clone();this.date.date.setHours(17,0,0);return"evening"}};parser.prototype.afternoon=function(){var captures;if(captures=/^afternoon\b/.exec(this.str)){this.skip(captures);this._meridiem="pm";var before=this.date.clone();if(this.date.changed("hours"))return"afternoon";this.date.date.setHours(14,0,0);return"afternoon"}};parser.prototype.morning=function(){var captures;if(captures=/^morning\b/.exec(this.str)){this.skip(captures);this._meridiem="am";var before=this.date.clone();if(!this.date.changed("hours"))this.date.date.setHours(8,0,0);return"morning"}};parser.prototype.tonight=function(){var captures;if(captures=/^tonight\b/.exec(this.str)){this.skip(captures);this._meridiem="pm";return"tonight"}};parser.prototype._next=function(){var captures;if(captures=/^next/.exec(this.str)){this.skip(captures);var d=new Date(this.date.date);var mod=this.peek();if(this.date[mod]){this.next();this.date=date(d);this.date[mod](1)}else if(rDayMod.test(mod)){this.date.day(1)}return"next"}};parser.prototype.last=function(){var captures;if(captures=/^last/.exec(this.str)){this.skip(captures);var d=new Date(this.date.date);var mod=this.peek();if(this.date[mod]){this.next();this.date=date(d);this.date[mod](-1)}else if(rDayMod.test(mod)){this.date.day(-1)}return"last"}};parser.prototype.ago=function(){var captures;if(captures=/^ago\b/.exec(this.str)){this.skip(captures);return"ago"}};parser.prototype.number=function(){var captures;if(captures=/^(\d+)/.exec(this.str)){var n=captures[1];this.skip(captures);var mod=this.peek();if(this.date[mod]){if("ago"==this.peek())n=-n;this.date[mod](n)}else if(this._meridiem){this.time(n,0,0,this._meridiem);this._meridiem=null}else if(this.original.indexOf("at")>-1){this.time(n,0,0,this._meridiem);this._meridiem=null}return"number"}};parser.prototype.string=function(){var captures;if(captures=/^\w+/.exec(this.str)){this.skip(captures);return"string"}};parser.prototype.other=function(){var captures;if(captures=/^./.exec(this.str)){this.skip(captures);return"other"}}},{"./date":2,"./norm":4,debug:10}],6:[function(require,module,exports){exports.difference=function(bigArr,smallArr){var diff=[];for(var i=0;i=0;i--){if(fn(arr[i])){found=i;break}}return found};exports.includes=function(arr,item){var found=false;for(var i=0;i6){tokensIn.push(normalDate);tokensOut.push(head)}head=""}catch(e){}}return{tokensIn:tokensIn,tokensOut:tokensOut}}function parseNormal2(str,tokensIn,tokensOut){var m,res;if(m=re.MMsDDdMMsDD.exec(str)){var yMd1=yMdParse(m[1],m[2]);var yMd2=yMdParse(m[3],m[4]);res=" t:"+yMd1+",dt: - t:"+yMd2+",dt: "}else if(m=re.MMsDDdDD.exec(str)){var yMd1=yMdParse(m[1],m[2]);var yMd2=yMdParse(m[1],m[3]);res=" t:"+yMd1+",dt: - t:"+yMd2+",dt: "}else if(m=re.MMsDD.exec(str)){var yMd=yMdParse(m[1],m[2]);res=" t:"+yMd+",dt: "}else if(m=re.hhcmm.exec(str)){res=" t:"+m[1].trim()+"h"+m[2]+"m"+",dt: "+(m[3]||"")}else{return{str:str,tokensIn:tokensIn,tokensOut:tokensOut}}tokensOut.push(m[0]);tokensIn.push(res);str=parseNormal2(str.replace(m[0],res),tokensIn,tokensOut).str;return{str:str,tokensIn:tokensIn,tokensOut:tokensOut}}function yMdParse(token1,token2){var part0=[token1,token2].filter(function(token){return token.length==4});var part1=[token1,token2].filter(function(token){return token.length!=4});var y=part0[0]?part0[0]+"y":"";var M=part1[0]+"M";var d=part1[1]?part1[1]+"d":"";return y+M+d}function notSubnormal(dateStr){var subnormalStr=parseNormal2(dateStr,[],[]).str;var noT=subnormalStr.replace(/t\:\S*,dt\:\S*(\s*-\s*t\:\S*,dt\:\S*)?/,"");return/\w+/g.exec(noT)!=null}function injectNormal(str,parsedArr){for(var i=0;i2){newSyms.push("trinull")}newSyms.push(s);count=0}}return newSyms}function hasSym(syms,symArr){var found=false;for(var i=0;i0}function has_pureTimeUnit(T){var dt=T.dt,t=T.t;var pure=true;for(var k in dt){if(!_.includes(timeUnitOrder,k)){pure=false;break}}for(var k in t){if(!_.includes(timeUnitOrder,k)){pure=false;break}}return pure}function has_t(T){return _.keys(T.t).length>0}function highestOverride(t){var lowestOverable=null;for(var i=0;i0){carry=decimal*factor[i];TO[u]=parseInt(TO[u])}else{carry=0}}return TO}function carryUp(TO){var ordering=tOrdering.slice().reverse(),factor=tFactor.slice().reverse();var carry=0;for(var i=0;i0){carry=deci;TO[u]=parseFloat(TO[u]||"0")%factor[i]}else{carry=0}}return TO}function stdT(date){if(typeof date=="string"){date=new Date(date)}var _y=date.getFullYear(),_M=date.getMonth()+1,_d=date.getDate(),_date=[_y,_M,_d].join("-");_time=/(\d\S+)/.exec(date.toTimeString())[1],format=_date+" "+_time;return format}function stdTtoT(str){var datetime=str.split(" ");var date=datetime[0].split("-"),time=datetime[1].split(":");return"t:"+date[0]+"y"+date[1]+"M"+date[2]+"d"+time[0]+"h"+time[1]+"m"+time[2]+"s,dt:"}function tokenToStr(syms){var tokens=[];for(var i=0;i=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}exports.formatters.j=function(v){try{return JSON.stringify(v)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}};function formatArgs(args){var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return;var c="color: "+this.color;args.splice(1,0,c,"color: inherit");var index=0;var lastC=0;args[0].replace(/%[a-zA-Z%]/g,function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c)}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}if(!r&&typeof process!=="undefined"&&"env"in process){r=process.env.DEBUG}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}},{"./debug":11}],11:[function(require,module,exports){exports=module.exports=createDebug.debug=createDebug["default"]=createDebug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=require("ms");exports.instances=[];exports.names=[];exports.skips=[];exports.formatters={};function selectColor(namespace){var hash=0,i;for(i in namespace){hash=(hash<<5)-hash+namespace.charCodeAt(i);hash|=0}return exports.colors[Math.abs(hash)%exports.colors.length]}function createDebug(namespace){var prevTime;function debug(){if(!debug.enabled)return;var self=debug;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;var args=new Array(arguments.length);for(var i=0;i0){return parse(val)}else if(type==="number"&&isNaN(val)===false){return options.long?fmtLong(val):fmtShort(val)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(val))};function parse(str){str=String(str);if(str.length>100){return}var match=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);if(!match){return}var n=parseFloat(match[1]);var type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return undefined}}function fmtShort(ms){if(ms>=d){return Math.round(ms/d)+"d"}if(ms>=h){return Math.round(ms/h)+"h"}if(ms>=m){return Math.round(ms/m)+"m"}if(ms>=s){return Math.round(ms/s)+"s"}return ms+"ms"}function fmtLong(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms