ngx-bootstrap
Version:
Native Angular Bootstrap Components
1,558 lines (1,427 loc) • 834 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("@angular/core"), require("@angular/common"), require("rxjs/operators"), require("@angular/forms"));
else if(typeof define === 'function' && define.amd)
define(["@angular/core", "@angular/common", "rxjs/operators", "@angular/forms"], factory);
else if(typeof exports === 'object')
exports["ngx-bootstrap.umd"] = factory(require("@angular/core"), require("@angular/common"), require("rxjs/operators"), require("@angular/forms"));
else
root["ngx-bootstrap.umd"] = factory(root["@angular/core"], root["@angular/common"], root["rxjs/operators"], root["@angular/forms"]);
})(window, function(__WEBPACK_EXTERNAL_MODULE__0__, __WEBPACK_EXTERNAL_MODULE__1__, __WEBPACK_EXTERNAL_MODULE__2__, __WEBPACK_EXTERNAL_MODULE__3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
/***/ }),
/* 1 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__1__;
/***/ }),
/* 2 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__2__;
/***/ }),
/* 3 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__3__;
/***/ }),
/* 4 */
/***/ (function(module, exports) {
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./.tmp/chronos/create/date-from-array.ts
function createUTCDate(y, m, d) {
var date = new Date(Date.UTC.apply(null, arguments));
// the Date.UTC function remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
return date;
}
function createDate(y, m, d, h, M, s, ms) {
if (m === void 0) { m = 0; }
if (d === void 0) { d = 1; }
if (h === void 0) { h = 0; }
if (M === void 0) { M = 0; }
if (s === void 0) { s = 0; }
if (ms === void 0) { ms = 0; }
var date = new Date(y, m, d, h, M, s, ms);
// the date constructor remaps years 0-99 to 1900-1999
if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
date.setFullYear(y);
}
return date;
}
// CONCATENATED MODULE: ./.tmp/chronos/utils/zero-fill.ts
function zeroFill(num, targetLength, forceSign) {
var absNumber = "" + Math.abs(num);
var zerosToFill = targetLength - absNumber.length;
var sign = num >= 0;
var _sign = sign ? (forceSign ? '+' : '') : '-';
// todo: this is crazy slow
var _zeros = Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1);
return (_sign + _zeros + absNumber);
}
// CONCATENATED MODULE: ./.tmp/chronos/utils.ts
function mod(n, x) {
return (n % x + x) % x;
}
function absFloor(num) {
return num < 0 ? Math.ceil(num) || 0 : Math.floor(num);
}
// CONCATENATED MODULE: ./.tmp/chronos/utils/type-checks.ts
function isString(str) {
return typeof str === 'string';
}
function isDate(value) {
return value instanceof Date || Object.prototype.toString.call(value) === '[object Date]';
}
function isBoolean(value) {
return value === true || value === false;
}
function isDateValid(date) {
return date && date.getTime && !isNaN(date.getTime());
}
function isFunction(fn) {
return (fn instanceof Function ||
Object.prototype.toString.call(fn) === '[object Function]');
}
function isNumber(value) {
return typeof value === 'number' || Object.prototype.toString.call(value) === '[object Number]';
}
function isArray(input) {
return (input instanceof Array ||
Object.prototype.toString.call(input) === '[object Array]');
}
function hasOwnProp(a /*object*/, b) {
return Object.prototype.hasOwnProperty.call(a, b);
}
function isObject(input /*object*/) {
// IE8 will treat undefined and null as object if it wasn't for
// input != null
return (input != null && Object.prototype.toString.call(input) === '[object Object]');
}
function isObjectEmpty(obj) {
if (Object.getOwnPropertyNames) {
return (Object.getOwnPropertyNames(obj).length === 0);
}
var k;
for (k in obj) {
if (obj.hasOwnProperty(k)) {
return false;
}
}
return true;
}
function isUndefined(input) {
return input === void 0;
}
function toInt(argumentForCoercion) {
var coercedNumber = +argumentForCoercion;
var value = 0;
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
value = absFloor(coercedNumber);
}
return value;
}
// CONCATENATED MODULE: ./.tmp/chronos/format/format.ts
var formatFunctions = {};
var formatTokenFunctions = {};
// tslint:disable-next-line
var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g;
// token: 'M'
// padded: ['MM', 2]
// ordinal: 'Mo'
// callback: function () { this.month() + 1 }
function addFormatToken(token, padded, ordinal, callback) {
if (token) {
formatTokenFunctions[token] = callback;
}
if (padded) {
formatTokenFunctions[padded[0]] = function () {
return zeroFill(callback.apply(null, arguments), padded[1], padded[2]);
};
}
if (ordinal) {
formatTokenFunctions[ordinal] = function (date, opts) {
return opts.locale.ordinal(callback.apply(null, arguments), token);
};
}
}
function makeFormatFunction(format) {
var array = format.match(formattingTokens);
var length = array.length;
var formatArr = new Array(length);
for (var i = 0; i < length; i++) {
formatArr[i] = formatTokenFunctions[array[i]]
? formatTokenFunctions[array[i]]
: removeFormattingTokens(array[i]);
}
return function (date, locale, isUTC, offset) {
if (offset === void 0) { offset = 0; }
var output = '';
for (var j = 0; j < length; j++) {
output += isFunction(formatArr[j])
? formatArr[j].call(null, date, { format: format, locale: locale, isUTC: isUTC, offset: offset })
: formatArr[j];
}
return output;
};
}
function removeFormattingTokens(input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|\]$/g, '');
}
return input.replace(/\\/g, '');
}
// CONCATENATED MODULE: ./.tmp/chronos/utils/date-getters.ts
function getHours(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCHours() : date.getHours();
}
function getMinutes(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCMinutes() : date.getMinutes();
}
function getSeconds(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCSeconds() : date.getSeconds();
}
function getMilliseconds(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCMilliseconds() : date.getMilliseconds();
}
function getTime(date) {
return date.getTime();
}
function getDay(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCDay() : date.getDay();
}
function getDate(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCDate() : date.getDate();
}
function getMonth(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCMonth() : date.getMonth();
}
function getFullYear(date, isUTC) {
if (isUTC === void 0) { isUTC = false; }
return isUTC ? date.getUTCFullYear() : date.getFullYear();
}
function getUnixTime(date) {
return Math.floor(date.valueOf() / 1000);
}
function unix(date) {
return Math.floor(date.valueOf() / 1000);
}
function getFirstDayOfMonth(date) {
return createDate(date.getFullYear(), date.getMonth(), 1, date.getHours(), date.getMinutes(), date.getSeconds());
}
function daysInMonth(date) {
return date_getters_daysInMonth(date.getFullYear(), date.getMonth());
}
function date_getters_daysInMonth(year, month) {
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
}
function isFirstDayOfWeek(date, firstDayOfWeek) {
return date.getDay() === firstDayOfWeek;
}
function isSameMonth(date1, date2) {
if (!date1 || !date2) {
return false;
}
return isSameYear(date1, date2) && getMonth(date1) === getMonth(date2);
}
function isSameYear(date1, date2) {
if (!date1 || !date2) {
return false;
}
return getFullYear(date1) === getFullYear(date2);
}
function isSameDay(date1, date2) {
if (!date1 || !date2) {
return false;
}
return (isSameYear(date1, date2) &&
isSameMonth(date1, date2) &&
getDate(date1) === getDate(date2));
}
// CONCATENATED MODULE: ./.tmp/chronos/parse/regex.ts
var match1 = /\d/; // 0 - 9
var match2 = /\d\d/; // 00 - 99
var match3 = /\d{3}/; // 000 - 999
var match4 = /\d{4}/; // 0000 - 9999
var match6 = /[+-]?\d{6}/; // -999999 - 999999
var match1to2 = /\d\d?/; // 0 - 99
var match3to4 = /\d\d\d\d?/; // 999 - 9999
var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999
var match1to3 = /\d{1,3}/; // 0 - 999
var match1to4 = /\d{1,4}/; // 0 - 9999
var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999
var matchUnsigned = /\d+/; // 0 - inf
var matchSigned = /[+-]?\d+/; // -inf - inf
var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z
var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z
var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123
// any word (or two) characters or numbers including two/three word month in arabic.
// includes scottish gaelic two word and hyphenated months
// tslint:disable-next-line
var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;
var regexes = {};
function addRegexToken(token, regex, strictRegex) {
if (isFunction(regex)) {
regexes[token] = regex;
return;
}
regexes[token] = function (isStrict, locale) {
return (isStrict && strictRegex) ? strictRegex : regex;
};
}
function getParseRegexForToken(token, locale) {
var _strict = false;
if (!hasOwnProp(regexes, token)) {
return new RegExp(unescapeFormat(token));
}
return regexes[token](_strict, locale);
}
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
function unescapeFormat(str) {
// tslint:disable-next-line
return regexEscape(str
.replace('\\', '')
.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { return p1 || p2 || p3 || p4; }));
}
function regexEscape(str) {
return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
}
// CONCATENATED MODULE: ./.tmp/chronos/parse/token.ts
// tslint:disable:max-line-length
var token_tokens = {};
function addParseToken(token, callback) {
var _token = isString(token) ? [token] : token;
var func = callback;
if (isNumber(callback)) {
func = function (input, array, config) {
array[callback] = toInt(input);
return config;
};
}
if (isArray(_token) && isFunction(func)) {
var i = void 0;
for (i = 0; i < _token.length; i++) {
token_tokens[_token[i]] = func;
}
}
}
function addWeekParseToken(token, callback) {
addParseToken(token, function (input, array, config, _token) {
config._w = config._w || {};
return callback(input, config._w, config, _token);
});
}
function addTimeToArrayFromToken(token, input, config) {
if (input != null && hasOwnProp(token_tokens, token)) {
token_tokens[token](input, config._a, config, token);
}
return config;
}
// CONCATENATED MODULE: ./.tmp/chronos/units/constants.ts
// place in new Date([array])
var YEAR = 0;
var MONTH = 1;
var DATE = 2;
var HOUR = 3;
var MINUTE = 4;
var SECOND = 5;
var MILLISECOND = 6;
var WEEK = 7;
var WEEKDAY = 8;
// CONCATENATED MODULE: ./.tmp/chronos/units/priorities.ts
var priorities = {};
function addUnitPriority(unit, priority) {
priorities[unit] = priority;
}
/*
export function getPrioritizedUnits(unitsObj) {
const units = [];
let unit;
for (unit in unitsObj) {
if (unitsObj.hasOwnProperty(unit)) {
units.push({ unit, priority: priorities[unit] });
}
}
units.sort(function (a, b) {
return a.priority - b.priority;
});
return units;
}
*/
// CONCATENATED MODULE: ./.tmp/chronos/units/aliases.ts
var aliases_aliases = {};
var _mapUnits = {
date: 'day',
hour: 'hours',
minute: 'minutes',
second: 'seconds',
millisecond: 'milliseconds'
};
function addUnitAlias(unit, shorthand) {
var lowerCase = unit.toLowerCase();
var _unit = unit;
if (lowerCase in _mapUnits) {
_unit = _mapUnits[lowerCase];
}
aliases_aliases[lowerCase] = aliases_aliases[lowerCase + "s"] = aliases_aliases[shorthand] = _unit;
}
function normalizeUnits(units) {
return isString(units) ? aliases_aliases[units] || aliases_aliases[units.toLowerCase()] : undefined;
}
function normalizeObjectUnits(inputObject) {
var normalizedInput = {};
var normalizedProp;
var prop;
for (prop in inputObject) {
if (hasOwnProp(inputObject, prop)) {
normalizedProp = normalizeUnits(prop);
if (normalizedProp) {
normalizedInput[normalizedProp] = inputObject[prop];
}
}
}
return normalizedInput;
}
// CONCATENATED MODULE: ./.tmp/chronos/units/year.ts
// FORMATTING
function getYear(date, opts) {
return getFullYear(date, opts.isUTC).toString();
}
addFormatToken('Y', null, null, function (date, opts) {
var y = getFullYear(date, opts.isUTC);
return y <= 9999 ? y.toString(10) : "+" + y;
});
addFormatToken(null, ['YY', 2, false], null, function (date, opts) {
return (getFullYear(date, opts.isUTC) % 100).toString(10);
});
addFormatToken(null, ['YYYY', 4, false], null, getYear);
addFormatToken(null, ['YYYYY', 5, false], null, getYear);
addFormatToken(null, ['YYYYYY', 6, true], null, getYear);
// ALIASES
addUnitAlias('year', 'y');
// PRIORITIES
addUnitPriority('year', 1);
// PARSING
addRegexToken('Y', matchSigned);
addRegexToken('YY', match1to2, match2);
addRegexToken('YYYY', match1to4, match4);
addRegexToken('YYYYY', match1to6, match6);
addRegexToken('YYYYYY', match1to6, match6);
addParseToken(['YYYYY', 'YYYYYY'], YEAR);
addParseToken('YYYY', function (input, array, config) {
array[YEAR] = input.length === 2 ? parseTwoDigitYear(input) : toInt(input);
return config;
});
addParseToken('YY', function (input, array, config) {
array[YEAR] = parseTwoDigitYear(input);
return config;
});
addParseToken('Y', function (input, array, config) {
array[YEAR] = parseInt(input, 10);
return config;
});
function parseTwoDigitYear(input) {
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
}
function daysInYear(year) {
return isLeapYear(year) ? 366 : 365;
}
function isLeapYear(year) {
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
}
// CONCATENATED MODULE: ./.tmp/chronos/create/parsing-flags.ts
function defaultParsingFlags() {
// We need to deep clone this object.
return {
empty: false,
unusedTokens: [],
unusedInput: [],
overflow: -2,
charsLeftOver: 0,
nullInput: false,
invalidMonth: null,
invalidFormat: false,
userInvalidated: false,
iso: false,
parsedDateParts: [],
meridiem: null,
rfc2822: false,
weekdayMismatch: false
};
}
function getParsingFlags(config) {
if (config._pf == null) {
config._pf = defaultParsingFlags();
}
return config._pf;
}
// CONCATENATED MODULE: ./.tmp/chronos/units/month.ts
// todo: this is duplicate, source in date-getters.ts
function month_daysInMonth(year, month) {
if (isNaN(year) || isNaN(month)) {
return NaN;
}
var modMonth = mod(month, 12);
var _year = year + (month - modMonth) / 12;
return modMonth === 1
? isLeapYear(_year) ? 29 : 28
: (31 - modMonth % 7 % 2);
}
// FORMATTING
addFormatToken('M', ['MM', 2, false], 'Mo', function (date, opts) {
return (getMonth(date, opts.isUTC) + 1).toString(10);
});
addFormatToken('MMM', null, null, function (date, opts) {
return opts.locale.monthsShort(date, opts.format, opts.isUTC);
});
addFormatToken('MMMM', null, null, function (date, opts) {
return opts.locale.months(date, opts.format, opts.isUTC);
});
// ALIASES
addUnitAlias('month', 'M');
// PRIORITY
addUnitPriority('month', 8);
// PARSING
addRegexToken('M', match1to2);
addRegexToken('MM', match1to2, match2);
addRegexToken('MMM', function (isStrict, locale) {
return locale.monthsShortRegex(isStrict);
});
addRegexToken('MMMM', function (isStrict, locale) {
return locale.monthsRegex(isStrict);
});
addParseToken(['M', 'MM'], function (input, array, config) {
array[MONTH] = toInt(input) - 1;
return config;
});
addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
var month = config._locale.monthsParse(input, token, config._strict);
// if we didn't find a month name, mark the date as invalid.
if (month != null) {
array[MONTH] = month;
}
else {
getParsingFlags(config).invalidMonth = !!input;
}
return config;
});
// CONCATENATED MODULE: ./.tmp/chronos/utils/date-setters.ts
var defaultTimeUnit = {
year: 0,
month: 0,
day: 0,
hour: 0,
minute: 0,
seconds: 0
};
function shiftDate(date, unit) {
var _unit = Object.assign({}, defaultTimeUnit, unit);
var year = date.getFullYear() + (_unit.year || 0);
var month = date.getMonth() + (_unit.month || 0);
var day = date.getDate() + (_unit.day || 0);
if (_unit.month && !_unit.day) {
day = Math.min(day, month_daysInMonth(year, month));
}
return createDate(year, month, day, date.getHours() + (_unit.hour || 0), date.getMinutes() + (_unit.minute || 0), date.getSeconds() + (_unit.seconds || 0));
}
function setFullDate(date, unit) {
return createDate(getNum(date.getFullYear(), unit.year), getNum(date.getMonth(), unit.month), getNum(date.getDate(), unit.day), getNum(date.getHours(), unit.hour), getNum(date.getMinutes(), unit.minute), getNum(date.getSeconds(), unit.seconds), getNum(date.getMilliseconds(), unit.milliseconds));
}
function getNum(def, num) {
return isNumber(num) ? num : def;
}
function setFullYear(date, value, isUTC) {
var _month = getMonth(date, isUTC);
var _date = getDate(date, isUTC);
var _year = getFullYear(date, isUTC);
if (isLeapYear(_year) && _month === 1 && _date === 29) {
var _daysInMonth = month_daysInMonth(value, _month);
isUTC ? date.setUTCFullYear(value, _month, _daysInMonth) : date.setFullYear(value, _month, _daysInMonth);
}
isUTC ? date.setUTCFullYear(value) : date.setFullYear(value);
return date;
}
function setMonth(date, value, isUTC) {
var dayOfMonth = Math.min(getDate(date), month_daysInMonth(getFullYear(date), value));
isUTC ? date.setUTCMonth(value, dayOfMonth) : date.setMonth(value, dayOfMonth);
return date;
}
function setDay(date, value, isUTC) {
isUTC ? date.setUTCDate(value) : date.setDate(value);
return date;
}
function setHours(date, value, isUTC) {
isUTC ? date.setUTCHours(value) : date.setHours(value);
return date;
}
function setMinutes(date, value, isUTC) {
isUTC ? date.setUTCMinutes(value) : date.setMinutes(value);
return date;
}
function setSeconds(date, value, isUTC) {
isUTC ? date.setUTCSeconds(value) : date.setSeconds(value);
return date;
}
function setMilliseconds(date, value, isUTC) {
isUTC ? date.setUTCMilliseconds(value) : date.setMilliseconds(value);
return date;
}
function setDate(date, value, isUTC) {
isUTC ? date.setUTCDate(value) : date.setDate(value);
return date;
}
function setTime(date, value) {
date.setTime(value);
return date;
}
// CONCATENATED MODULE: ./.tmp/chronos/create/clone.ts
// fastest way to clone date
// https://jsperf.com/clone-date-object2
function cloneDate(date) {
return new Date(date.getTime());
}
// CONCATENATED MODULE: ./.tmp/chronos/duration/valid.ts
var ordering = ['year', 'quarter', 'month', 'week', 'day', 'hours', 'minutes', 'seconds', 'milliseconds'];
var orderingHash = ordering.reduce(function (mem, order) {
mem[order] = true;
return mem;
}, {});
function isDurationValid(duration) {
var durationKeys = Object.keys(duration);
if (durationKeys
.some(function (key) {
return (key in orderingHash)
&& duration[key] === null
|| isNaN(duration[key]);
})) {
return false;
}
// for (let key in duration) {
// if (!(indexOf.call(ordering, key) !== -1 && (duration[key] == null || !isNaN(duration[key])))) {
// return false;
// }
// }
var unitHasDecimal = false;
for (var i = 0; i < ordering.length; ++i) {
if (duration[ordering[i]]) {
// only allow non-integers for smallest unit
if (unitHasDecimal) {
return false;
}
if (duration[ordering[i]] !== toInt(duration[ordering[i]])) {
unitHasDecimal = true;
}
}
}
return true;
}
// export function isValid() {
// return this._isValid;
// }
//
// export function createInvalid(): Duration {
// return createDuration(NaN);
// }
// CONCATENATED MODULE: ./.tmp/chronos/utils/abs-ceil.ts
function absCeil(number) {
return number < 0 ? Math.floor(number) : Math.ceil(number);
}
// CONCATENATED MODULE: ./.tmp/chronos/duration/bubble.ts
function bubble(dur) {
var milliseconds = dur._milliseconds;
var days = dur._days;
var months = dur._months;
var data = dur._data;
// if we have a mix of positive and negative values, bubble down first
// check: https://github.com/moment/moment/issues/2166
if (!((milliseconds >= 0 && days >= 0 && months >= 0) ||
(milliseconds <= 0 && days <= 0 && months <= 0))) {
milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
days = 0;
months = 0;
}
// The following code bubbles up values, see the tests for
// examples of what that means.
data.milliseconds = milliseconds % 1000;
var seconds = absFloor(milliseconds / 1000);
data.seconds = seconds % 60;
var minutes = absFloor(seconds / 60);
data.minutes = minutes % 60;
var hours = absFloor(minutes / 60);
data.hours = hours % 24;
days += absFloor(hours / 24);
// convert days to months
var monthsFromDays = absFloor(daysToMonths(days));
months += monthsFromDays;
days -= absCeil(monthsToDays(monthsFromDays));
// 12 months -> 1 year
var years = absFloor(months / 12);
months %= 12;
data.day = days;
data.month = months;
data.year = years;
return dur;
}
function daysToMonths(day) {
// 400 years have 146097 days (taking into account leap year rules)
// 400 years have 12 months === 4800
return day * 4800 / 146097;
}
function monthsToDays(month) {
// the reverse of daysToMonths
return month * 146097 / 4800;
}
// CONCATENATED MODULE: ./.tmp/chronos/duration/humanize.ts
// tslint:disable:cyclomatic-complexity
var round = Math.round;
var thresholds = {
ss: 44,
s: 45,
m: 45,
h: 22,
d: 26,
M: 11 // months to year
};
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
function substituteTimeAgo(str, num, withoutSuffix, isFuture, locale) {
return locale.relativeTime(num || 1, !!withoutSuffix, str, isFuture);
}
function relativeTime(posNegDuration, withoutSuffix, locale) {
var duration = createDuration(posNegDuration).abs();
var seconds = round(duration.as('s'));
var minutes = round(duration.as('m'));
var hours = round(duration.as('h'));
var days = round(duration.as('d'));
var months = round(duration.as('M'));
var years = round(duration.as('y'));
var a = seconds <= thresholds.ss && ['s', seconds] ||
seconds < thresholds.s && ['ss', seconds] ||
minutes <= 1 && ['m'] ||
minutes < thresholds.m && ['mm', minutes] ||
hours <= 1 && ['h'] ||
hours < thresholds.h && ['hh', hours] ||
days <= 1 && ['d'] ||
days < thresholds.d && ['dd', days] ||
months <= 1 && ['M'] ||
months < thresholds.M && ['MM', months] ||
years <= 1 && ['y'] || ['yy', years];
var b = [a[0], a[1], withoutSuffix, +posNegDuration > 0, locale];
// a[2] = withoutSuffix;
// a[3] = +posNegDuration > 0;
// a[4] = locale;
return substituteTimeAgo.apply(null, b);
}
// This function allows you to set the rounding function for relative time strings
function getSetRelativeTimeRounding(roundingFunction) {
if (roundingFunction === undefined) {
return round;
}
if (typeof (roundingFunction) === 'function') {
round = roundingFunction;
return true;
}
return false;
}
// This function allows you to set a threshold for relative time strings
function getSetRelativeTimeThreshold(threshold, limit) {
if (thresholds[threshold] === undefined) {
return false;
}
if (limit === undefined) {
return thresholds[threshold];
}
thresholds[threshold] = limit;
if (threshold === 's') {
thresholds.ss = limit - 1;
}
return true;
}
// export function humanize(withSuffix) {
// if (!this.isValid()) {
// return this.localeData().invalidDate();
// }
//
// const locale = this.localeData();
// let output = relativeTime(this, !withSuffix, locale);
//
// if (withSuffix) {
// output = locale.pastFuture(+this, output);
// }
//
// return locale.postformat(output);
// }
// CONCATENATED MODULE: ./.tmp/chronos/duration/constructor.ts
var constructor_Duration = /** @class */ (function () {
function Duration(duration, config) {
if (config === void 0) { config = {}; }
this._data = {};
this._locale = getLocale();
this._locale = config && config._locale || getLocale();
// const normalizedInput = normalizeObjectUnits(duration);
var normalizedInput = duration;
var years = normalizedInput.year || 0;
var quarters = normalizedInput.quarter || 0;
var months = normalizedInput.month || 0;
var weeks = normalizedInput.week || 0;
var days = normalizedInput.day || 0;
var hours = normalizedInput.hours || 0;
var minutes = normalizedInput.minutes || 0;
var seconds = normalizedInput.seconds || 0;
var milliseconds = normalizedInput.milliseconds || 0;
this._isValid = isDurationValid(normalizedInput);
// representation for dateAddRemove
this._milliseconds = +milliseconds +
seconds * 1000 +
minutes * 60 * 1000 + // 1000 * 60
hours * 1000 * 60 * 60; // using 1000 * 60 * 60
// instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
// Because of dateAddRemove treats 24 hours as different from a
// day when working around DST, we need to store them separately
this._days = +days +
weeks * 7;
// It is impossible to translate months into days without knowing
// which months you are are talking about, so we have to store
// it separately.
this._months = +months +
quarters * 3 +
years * 12;
// this._data = {};
// this._locale = getLocale();
// this._bubble();
return bubble(this);
}
Duration.prototype.isValid = function () {
return this._isValid;
};
Duration.prototype.humanize = function (withSuffix) {
// throw new Error(`TODO: implement`);
if (!this.isValid()) {
return this.localeData().invalidDate;
}
var locale = this.localeData();
var output = relativeTime(this, !withSuffix, locale);
if (withSuffix) {
output = locale.pastFuture(+this, output);
}
return locale.postformat(output);
};
Duration.prototype.localeData = function () {
return this._locale;
};
Duration.prototype.locale = function (localeKey) {
if (!localeKey) {
return this._locale._abbr;
}
this._locale = getLocale(localeKey) || this._locale;
return this;
};
Duration.prototype.abs = function () {
var mathAbs = Math.abs;
var data = this._data;
this._milliseconds = mathAbs(this._milliseconds);
this._days = mathAbs(this._days);
this._months = mathAbs(this._months);
data.milliseconds = mathAbs(data.milliseconds);
data.seconds = mathAbs(data.seconds);
data.minutes = mathAbs(data.minutes);
data.hours = mathAbs(data.hours);
data.month = mathAbs(data.month);
data.year = mathAbs(data.year);
return this;
};
Duration.prototype.as = function (_units) {
if (!this.isValid()) {
return NaN;
}
var days;
var months;
var milliseconds = this._milliseconds;
var units = normalizeUnits(_units);
if (units === 'month' || units === 'year') {
days = this._days + milliseconds / 864e5;
months = this._months + daysToMonths(days);
return units === 'month' ? months : months / 12;
}
// handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + Math.round(monthsToDays(this._months));
switch (units) {
case 'week':
return days / 7 + milliseconds / 6048e5;
case 'day':
return days + milliseconds / 864e5;
case 'hours':
return days * 24 + milliseconds / 36e5;
case 'minutes':
return days * 1440 + milliseconds / 6e4;
case 'seconds':
return days * 86400 + milliseconds / 1000;
// Math.floor prevents floating point math errors here
case 'milliseconds':
return Math.floor(days * 864e5) + milliseconds;
default:
throw new Error("Unknown unit " + units);
}
};
Duration.prototype.valueOf = function () {
if (!this.isValid()) {
return NaN;
}
return (this._milliseconds +
this._days * 864e5 +
(this._months % 12) * 2592e6 +
toInt(this._months / 12) * 31536e6);
};
return Duration;
}());
function isDuration(obj) {
return obj instanceof constructor_Duration;
}
// CONCATENATED MODULE: ./.tmp/chronos/create/valid.ts
function valid_isValid(config) {
if (config._isValid == null) {
var flags = getParsingFlags(config);
var parsedParts = Array.prototype.some.call(flags.parsedDateParts, function (i) {
return i != null;
});
var isNowValid = !isNaN(config._d && config._d.getTime()) &&
flags.overflow < 0 &&
!flags.empty &&
!flags.invalidMonth &&
!flags.invalidWeekday &&
!flags.weekdayMismatch &&
!flags.nullInput &&
!flags.invalidFormat &&
!flags.userInvalidated &&
(!flags.meridiem || (flags.meridiem && parsedParts));
if (config._strict) {
isNowValid = isNowValid &&
flags.charsLeftOver === 0 &&
flags.unusedTokens.length === 0 &&
flags.bigHour === undefined;
}
if (Object.isFrozen == null || !Object.isFrozen(config)) {
config._isValid = isNowValid;
}
else {
return isNowValid;
}
}
return config._isValid;
}
function createInvalid(config, flags) {
config._d = new Date(NaN);
Object.assign(getParsingFlags(config), flags || { userInvalidated: true });
return config;
}
function markInvalid(config) {
config._isValid = false;
return config;
}
// CONCATENATED MODULE: ./.tmp/chronos/create/from-string.ts
// tslint:disable-next-line
// iso 8601 regex
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
// tslint:disable-next-line
var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
// tslint:disable-next-line
var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/;
var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/;
var isoDates = [
['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/, true],
['YYYY-MM-DD', /\d{4}-\d\d-\d\d/, true],
['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/, true],
['GGGG-[W]WW', /\d{4}-W\d\d/, false],
['YYYY-DDD', /\d{4}-\d{3}/, true],
['YYYY-MM', /\d{4}-\d\d/, false],
['YYYYYYMMDD', /[+-]\d{10}/, true],
['YYYYMMDD', /\d{8}/, true],
// YYYYMM is NOT allowed by the standard
['GGGG[W]WWE', /\d{4}W\d{3}/, true],
['GGGG[W]WW', /\d{4}W\d{2}/, false],
['YYYYDDD', /\d{7}/, true]
];
// iso time formats and regexes
var isoTimes = [
['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
['HH:mm:ss', /\d\d:\d\d:\d\d/],
['HH:mm', /\d\d:\d\d/],
['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
['HHmmss', /\d\d\d\d\d\d/],
['HHmm', /\d\d\d\d/],
['HH', /\d\d/]
];
var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
var obsOffsets = {
UT: 0,
GMT: 0,
EDT: -4 * 60,
EST: -5 * 60,
CDT: -5 * 60,
CST: -6 * 60,
MDT: -6 * 60,
MST: -7 * 60,
PDT: -7 * 60,
PST: -8 * 60
};
// RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
// tslint:disable-next-line
var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/;
// date from iso format
function configFromISO(config) {
if (!isString(config._i)) {
return config;
}
var input = config._i;
var match = extendedIsoRegex.exec(input) || basicIsoRegex.exec(input);
var allowTime;
var dateFormat;
var timeFormat;
var tzFormat;
if (!match) {
config._isValid = false;
return config;
}
// getParsingFlags(config).iso = true;
var i;
var l;
for (i = 0, l = isoDates.length; i < l; i++) {
if (isoDates[i][1].exec(match[1])) {
dateFormat = isoDates[i][0];
allowTime = isoDates[i][2] !== false;
break;
}
}
if (dateFormat == null) {
config._isValid = false;
return config;
}
if (match[3]) {
for (i = 0, l = isoTimes.length; i < l; i++) {
if (isoTimes[i][1].exec(match[3])) {
// match[2] should be 'T' or space
timeFormat = (match[2] || ' ') + isoTimes[i][0];
break;
}
}
if (timeFormat == null) {
config._isValid = false;
return config;
}
}
if (!allowTime && timeFormat != null) {
config._isValid = false;
return config;
}
if (match[4]) {
if (tzRegex.exec(match[4])) {
tzFormat = 'Z';
}
else {
config._isValid = false;
return config;
}
}
config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
return configFromStringAndFormat(config);
}
// tslint:disable-next-line
function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
var result = [
untruncateYear(yearStr),
defaultLocaleMonthsShort.indexOf(monthStr),
parseInt(dayStr, 10),
parseInt(hourStr, 10),
parseInt(minuteStr, 10)
];
if (secondStr) {
result.push(parseInt(secondStr, 10));
}
return result;
}
function untruncateYear(yearStr) {
var year = parseInt(yearStr, 10);
return year <= 49 ? year + 2000 : year;
}
function preprocessRFC2822(str) {
// Remove comments and folding whitespace and replace multiple-spaces with a single space
return str
.replace(/\([^)]*\)|[\n\t]/g, ' ')
.replace(/(\s\s+)/g, ' ').trim();
}
function checkWeekday(weekdayStr, parsedInput, config) {
if (weekdayStr) {
// TODO: Replace the vanilla JS Date object with an indepentent day-of-week check.
var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr);
var weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay();
if (weekdayProvided !== weekdayActual) {
getParsingFlags(config).weekdayMismatch = true;
config._isValid = false;
return false;
}
}
return true;
}
function calculateOffset(obsOffset, militaryOffset, numOffset) {
if (obsOffset) {
return obsOffsets[obsOffset];
}
else if (militaryOffset) {
// the only allowed military tz is Z
return 0;
}
else {
var hm = parseInt(numOffset, 10);
var m = hm % 100;
var h = (hm - m) / 100;
return h * 60 + m;
}
}
// date and time from ref 2822 format
function configFromRFC2822(config) {
if (!isString(config._i)) {
return config;
}
var match = rfc2822.exec(preprocessRFC2822(config._i));
if (!match) {
return markInvalid(config);
}
var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]);
if (!checkWeekday(match[1], parsedArray, config)) {
return config;
}
config._a = parsedArray;
config._tzm = calculateOffset(match[8], match[9], match[10]);
config._d = createUTCDate.apply(null, config._a);
config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
getParsingFlags(config).rfc2822 = true;
return config;
}
// date from iso format or fallback
function configFromString(config) {
if (!isString(config._i)) {
return config;
}
var matched = aspNetJsonRegex.exec(config._i);
if (matched !== null) {
config._d = new Date(+matched[1]);
return config;
}
// todo: update logic processing
// isISO -> configFromISO
// isRFC -> configFromRFC
configFromISO(config);
if (config._isValid === false) {
delete config._isValid;
}
else {
return config;
}
configFromRFC2822(config);
if (config._isValid === false) {
delete config._isValid;
}
else {
return config;
}
// Final attempt, use Input Fallback
// hooks.createFromInputFallback(config);
return createInvalid(config);
}
// hooks.createFromInputFallback = deprecate(
// 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
// 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
// 'discouraged and will be removed in an upcoming major release. Please refer to ' +
// 'http://momentjs.com/guides/#/warnings/js-date/ for more info.',
// function (config) {
// config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
// }
// );
// CONCATENATED MODULE: ./.tmp/chronos/units/day-of-month.ts
// FORMATTING
addFormatToken('D', ['DD', 2, false], 'Do', function (date, opts) {
return getDate(date, opts.isUTC).toString(10);
});
// ALIASES
addUnitAlias('date', 'D');
// PRIOROITY
addUnitPriority('date', 9);
// PARSING
addRegexToken('D', match1to2);
addRegexToken('DD', match1to2, match2);
addRegexToken('Do', function (isStrict, locale) {
return locale._dayOfMonthOrdinalParse || locale._ordinalParse;
});
addParseToken(['D', 'DD'], DATE);
addParseToken('Do', function (input, array, config) {
array[DATE] = toInt(input.match(match1to2)[0]);
return config;
});
// CONCATENATED MODULE: ./.tmp/chronos/units/hour.ts
// FORMATTING
function hFormat(date, isUTC) {
return getHours(date, isUTC) % 12 || 12;
}
function kFormat(date, isUTC) {
return getHours(date, isUTC) || 24;
}
addFormatToken('H', ['HH', 2, false], null, function (date, opts) {
return getHours(date, opts.isUTC).toString(10);
});
addFormatToken('h', ['hh', 2, false], null, function (date, opts) {
return hFormat(date, opts.isUTC).toString(10);
});
addFormatToken('k', ['kk', 2, false], null, function (date, opts) {
return kFormat(date, opts.isUTC).toString(10);
});
addFormatToken('hmm', null, null, function (date, opts) {
var _h = hFormat(date, opts.isUTC);
var _mm = zeroFill(getMinutes(date, opts.isUTC), 2);
return "" + _h + _mm;
});
addFormatToken('hmmss', null, null, function (date, opts) {
var _h = hFormat(date, opts.isUTC);
var _mm = zeroFill(getMinutes(date, opts.isUTC), 2);
var _ss = zeroFill(getSeconds(date, opts.isUTC), 2);
return "" + _h + _mm + _ss;
});
addFormatToken('Hmm', null, null, function (date, opts) {
var _H = getHours(date, opts.isUTC);
var _mm = zeroFill(getMinutes(date, opts.isUTC), 2);
return "" + _H + _mm;
});
addFormatToken('Hmmss', null, null, function (date, opts) {
var _H = getHours(date, opts.isUTC);
var _mm = zeroFill(getMinutes(date, opts.isUTC), 2);
var _ss = zeroFill(getSeconds(date, opts.isUTC), 2);
return "" + _H + _mm + _ss;
});
function meridiem(token, lowercase) {
addFormatToken(token, null, null, function (date, opts) {
return opts.locale.meridiem(getHours(date, opts.isUTC), getMinutes(date, opts.isUTC), lowercase);
});
}
meridiem('a', true);
meridiem('A', false);
// ALIASES
addUnitAlias('hour', 'h');
// PRIORITY
addUnitPriority('hour', 13);
// PARSING
function matchMeridiem(isStrict, locale) {
return locale._meridiemParse;
}
addRegexToken('a', matchMeridiem);
addRegexToken('A', matchMeridiem);
addRegexToken('H', match1to2);
addRegexToken('h', match1to2);
addRegexToken('k', match1to2);
addRegexToken('HH', match1to2, match2);
addRegexToken('hh', match1to2, match2);
addRegexToken('kk', match1to2, match2);
addRegexToken('hmm', match3to4);
addRegexToken('hmmss', match5to6);
addRegexToken('Hmm', match3to4);
addRegexToken('Hmmss', match5to6);
addParseToken(['H', 'HH'], HOUR);
addParseToken(['k', 'kk'], function (input, array, config) {
var kInput = toInt(input);
array[HOUR] = kInput === 24 ? 0 : kInput;
return config;
});
addParseToken(['a', 'A'], function (input, array, config) {
config._isPm = config._locale.isPM(input);
config._meridiem = input;
return config;
});
addParseToken(['h', 'hh'], function (input, array, config) {
array[HOUR] = toInt(input);
getParsingFlags(config).bigHour = true;
return config;
});
addParseToken('hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
getParsingFlags(config).bigHour = true;
return config;
});
addParseToken('hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
getParsingFlags(config).bigHour = true;
return config;
});
addParseToken('Hmm', function (input, array, config) {
var pos = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos));
array[MINUTE] = toInt(input.substr(pos));
return config;
});
addParseToken('Hmmss', function (input, array, config) {
var pos1 = input.length - 4;
var pos2 = input.length - 2;
array[HOUR] = toInt(input.substr(0, pos1));
array[MINUTE] = toInt(input.substr(pos1, 2));
array[SECOND] = toInt(input.substr(pos2));
return config;
});
// CONCATENATED MODULE: ./.tmp/chronos/units/millisecond.ts
// tslint:disable:no-bitwise
// FORMATTING
addFormatToken('S', null, null, function (date, opts) {
return (~~(getMilliseconds(date, opts.isUTC) / 100)).toString(10);
});
addFormatToken(null, ['SS', 2, false], null, function (date, opts) {
return (~~(getMilliseconds(date, opts.isUTC) / 10)).toString(10);
});
addFormatToken(null, ['SSS', 3, false], null, function (date, opts) {
return (getMilliseconds(date, opts.isUTC)).toString(10);
});
addFormatToken(null, ['SSSS', 4, false], null, function (date, opts) {
return (getMilliseconds(date, opts.isUTC) * 10).toString(10);
});
addFormatToken(null, ['SSSSS', 5, false], null, function (date, opts) {
return (getMilliseconds(date, opts.isUTC) * 100).toString(10);
});
addFormatToken(null, ['SSSSSS', 6, false], null, function (date, opts) {
return (getMilliseconds(date, opts.isUTC) * 1000).toString(10);
});
addFormatToken(null, ['SSSSSSS', 7, false], null, function (date, opts) {
return (getMilliseconds(date, opts.isUTC) * 10000).toString(10);
});
addFormatToken(null, ['SSSSSSSS', 8, false], null, function (date, opts) {
return (getMilliseconds(date, opts.isUTC) * 100000).toString(10);
});
addFormatToken(null, ['SSSSSSSSS', 9, false], null, function (date, opts) {
return (getMilliseconds(date, opts.isUTC) * 1000000).toString(10);
});
// ALIASES
addUnitAlias('millisecond', 'ms');
// PRIORITY
addUnitPriority('millisecond', 16);
// PARSING
addRegexToken('S', match1to3, match1);
addRegexToken('SS', match1to3, match2);
addRegexToken('SSS', match1to3, match3);
var millisecond_token;
for (millisecond_token = 'SSSS'; millisecond_token.length <= 9; millisecond_token += 'S') {
addRegexToken(millisecond_token, matchUnsigned);
}
function parseMs(input, array, config) {
array[MILLISECOND] = toInt(parseFloat("0." + input) * 1000);
return config;
}
for (millisecond_token = 'S'; millisecond_token.length <= 9; millisecond_token += 'S') {
addParseToken(millisecond_token, parseMs);
}
// MOMENTS
// CONCATENATED MODULE: ./.tmp/chronos/units/minute.ts
// FORMATTING
addFormatToken('m', ['mm', 2, false], null, function (date, opts) {
return getMinutes(date, opts.isUTC).toString(10);
});
// ALIASES
addUnitAlias('minute', 'm');
// PRIORITY
addUnitPriority('minute', 14);
// PARSING
addRegexToken('m', match1to2);
addRegexToken('mm', match1to2, match2);
addParseToken(['m', 'mm'], MINUTE);
// CONCATENATED MODULE: ./.tmp/chronos/units/offset.ts
// tslint:disable:no-bitwise max-line-length
// FORMATTING
function addOffsetFormatToken(token, separator) {
addFormatToken(token, null, null, function (date, config) {
var offset = getUTCOffset(date, { _isUTC: config.isUTC, _offset: config.offset });
var sign = '+';
if (