(function(){"use strict";vart=function(t){vars={hoursPerDay:24,daysPerWeek:7,weeksPerMonth:4,monthsPerYear:12};t=t||{},this.settings=s;for(vareint)this.settings[e]=t[e];this.units={s:["s","sec","secs","second","seconds"],m:["m","min","mins","minute","minutes"],h:["h","hr","hrs","hour","hours"],d:["d","day","days"],w:["w","week","weeks"],mth:["mth","mths","month","months"],y:["y","yr","yrs","year","years"]},this.unitValues={s:1,m:60,h:3600},this.unitValues.d=this.settings.hoursPerDay*this.unitValues.h,this.unitValues.w=this.settings.daysPerWeek*this.unitValues.d,this.unitValues.mth=this.settings.weeksPerMonth*this.unitValues.w,this.unitValues.y=this.settings.monthsPerYear*this.unitValues.mth};t.prototype.parse=function(t,s){functione(t){for(varsinr.units)for(vareinr.units[s])if(t===r.units[s][e])returns;thrownewError("The unit ["+t+"] is not supported by timestring")}functioni(t,s){vari=r.unitValues[e(s)];returnt/i}functionn(t,s){vari=r.unitValues[e(s)];returnt*i}varr=this,u=0,h=t.toLowerCase().replace(/[^\.\w+-]+/g,"").match(/[-+]?[0-9]+[a-z]+/g);if(null!==h)for(vara=0;a<h.length;a++){varo=h[a],m=o.match(/[0-9]+/g)[0],l=o.match(/[a-z]+/g)[0];u+=n(m,l)}returns?i(u,s):u},String.prototype.parseTime=function(s,e){returnnewt(e).parse(this,s)},"undefined"!=typeofmodule&&module.exports?module.exports=t:this.Timestring=t}).call(this);