Object.defineProperty(exports,`__esModule`,{value:!0});const e=1e3,t=e*60,n=t*60,r=n*24,i=r*7,a=r*365.25,o=a/12;function s(e,t){if(typeof e==`string`)return l(e);if(typeof e==`number`)return p(e,t);throw Error(`Value provided to ms() must be a string or number. value=${JSON.stringify(e)}`)}var c=s;function l(s){if(typeof s!=`string`||s.length===0||s.length>100)throw Error(`Value provided to ms.parse() must be a string with length between 1 and 99. value=${JSON.stringify(s)}`);let c=/^(?<value>-?\d*\.?\d+) *(?<unit>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|months?|mo|years?|yrs?|y)?$/i.exec(s);if(!c?.groups)return NaN;let{value:l,unit:u=`ms`}=c.groups,d=parseFloat(l),f=u.toLowerCase();switch(f){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return d*a;case`months`:case`month`:case`mo`:return d*o;case`weeks`:case`week`:case`w`:return d*i;case`days`:case`day`:case`d`:return d*r;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return d*n;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return d*t;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return d*e;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return d;default:throw Error(`Unknown unit "${f}" provided to ms.parse(). value=${JSON.stringify(s)}`)}}function u(e){return l(e)}function d(s){let c=Math.abs(s);return c>=a?`${Math.round(s/a)}y`:c>=o?`${Math.round(s/o)}mo`:c>=i?`${Math.round(s/i)}w`:c>=r?`${Math.round(s/r)}d`:c>=n?`${Math.round(s/n)}h`:c>=t?`${Math.round(s/t)}m`:c>=e?`${Math.round(s/e)}s`:`${s}ms`}function f(s){let c=Math.abs(s);return c>=a?m(s,c,a,`year`):c>=o?m(s,c,o,`month`):c>=i?m(s,c,i,`week`):c>=r?m(s,c,r,`day`):c>=n?m(s,c,n,`hour`):c>=t?m(s,c,t,`minute`):c>=e?m(s,c,e,`second`):`${s} ms`}function p(e,t){if(typeof e!=`number`||!Number.isFinite(e))throw Error(`Value provided to ms.format() must be of type number.`);return t?.long?f(e):d(e)}function m(e,t,n,r){let i=t>=n*1.5;return`${Math.round(e/n)} ${r}${i?`s`:``}`}exports.default=c,exports.format=p,exports.ms=s,exports.parse=l,exports.parseStrict=u;
//# sourceMappingURL=index.cjs.map