"use strict";function_classCallCheck(t,e){if(!(tinstanceofe))thrownewTypeError("Cannot call a class as a function")}Object.defineProperty(exports,"__esModule",{value:!0});var_createClass=function(){functiont(t,e){for(vars=0;s<e.length;s++){varn=e[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"inn&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}returnfunction(e,s,n){returns&&t(e.prototype,s),n&&t(e,n),e}}(),Timestring=function(){functiont(){vare=void0===arguments[0]?{}:arguments[0];_classCallCheck(this,t);vars={hoursPerDay:24,daysPerWeek:7,weeksPerMonth:4,monthsPerYear:12};this.settings=s;for(varnine)this.settings[n]=e[n];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}return_createClass(t,[{key:"parse",value:function(t){vare=this,s=void0===arguments[1]?"s":arguments[1],n=function(t){for(varsine.units)for(varnine.units[s])if(t===e.units[s][n])returns;thrownewError("The unit ["+t+"] is not supported by timestring")},r=function(t,s){varr=e.unitValues[n(s)];returnt/r},i=function(t,s){varr=e.unitValues[n(s)];returnt*r},a=0,u=t.toLowerCase().replace(/[^\.\w+-]+/g,"").match(/[-+]?[0-9]+[a-z]+/g);if(null!==u)for(varoinu){varh=u[o],l=h.match(/[0-9]+/g)[0],c=h.match(/[a-z]+/g)[0];a+=i(l,c)}returnr(a,s)}}]),t}();exports["default"]=Timestring,String.prototype.parseTime=function(t,e){returnnewTimestring(e).parse(this,t)},module.exports=exports["default"];